<?xml version="1.0" encoding="utf-8"?>
<posts>
  <row Id="1" PostTypeId="1" AcceptedAnswerId="20" CreationDate="2011-08-16T19:13:36.950" Score="15" ViewCount="846" Body="&lt;p&gt;Are there ways to increase computational performance of a normalized least squares (NLMS) filter? &lt;a href=&quot;http://en.wikipedia.org/wiki/Multidelay_block_frequency_domain_adaptive_filter&quot; rel=&quot;nofollow&quot;&gt;Multidelay block frequency-domain (MDF)&lt;/a&gt; filters have been proposed to do this, but they also take away from convergence speed and accuracy, because they only update the estimated impulse response once every block, not once every sample. Are there any other methods?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="128" LastEditDate="2019-06-26T08:43:33.673" LastActivityDate="2019-06-26T08:43:33.673" Title="How to Improve Least Means Squares (LMS) / NLMS Filter Performance?" Tags="|adaptive-filters|performance|least-squares|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5" PostTypeId="1" AcceptedAnswerId="27" CreationDate="2011-08-16T20:01:31.747" Score="16" ViewCount="2620" Body="&lt;p&gt;When developing products I do all of my algorithm design in Matlab. They are usually pretty basic, an IIR or FIR filter or two, a couple FFTs, etc. When it comes time to move it to an embedded environment I always have a hard time deciding what platform to run it on. I usually think of these (broad) platforms:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;DSP core&lt;/li&gt;&#xA;&lt;li&gt;FPGA&lt;/li&gt;&#xA;&lt;li&gt;Microcontroller&lt;/li&gt;&#xA;&lt;li&gt;ARM&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What factors should I consider when trying to make this decision?&lt;/p&gt;&#xA;" OwnerUserId="17" LastEditorUserId="17" LastEditDate="2011-08-16T20:40:38.407" LastActivityDate="2011-09-07T14:32:39.710" Title="How to decide what platform is best to implement real-time audio processing on?" Tags="|arm|dsp-core|hardware|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="6" PostTypeId="1" AcceptedAnswerId="342" CreationDate="2011-08-16T20:12:39.013" Score="28" ViewCount="2729" Body="&lt;p&gt;I have a project where I would like to image an object and be able to derive the heights of features in this image to sub-millimetre precision (exactly how precise is still yet to be determined, but let's say 100ths of a millimetre for now).&lt;/p&gt;&#xA;&lt;p&gt;I have been previously advised that direct laser ranging techniques will not be appropriate&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the travel time will be too small and thus will require too much precision to make precise calculations&lt;/li&gt;&#xA;&lt;li&gt;minor vibrations (such as a person walking near the apparatus) will perturb the results&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I have observed a laser device that sells for approximately $1000 that can achieve the precision but suffers from the vibration problem (which is fine, mechanically isolating the apparatus is another discussion).&lt;/p&gt;&#xA;&lt;p&gt;I would prefer to achieve a result that is more cost effective, and considered stereo vision as an alternative.  Being a novice to this field I am uncertain if the desired precision can be achieved.&lt;/p&gt;&#xA;&lt;p&gt;Is the desired precision (at least) theoretically attainable?&lt;/p&gt;&#xA;&lt;p&gt;Is there a recommended paper or resource that would help explain this topic further?&lt;/p&gt;&#xA;&lt;h3&gt;Additional notes&lt;/h3&gt;&#xA;&lt;p&gt;The objects in question will range from approximately 1/2&amp;quot; square up to about 2 1/2&amp;quot; square with some times very low thickness (1/16&amp;quot;?). A large percentage of the surface should be flat, though one test will be to confirm that assertion. Features will be fairly rough (generally sharp transitions). &lt;sup&gt;Aug 17 at 11:00&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;p&gt;One of the &amp;quot;harder&amp;quot; interesting objects would be about 20mm square, 1.25mm high. The surface features in question would be on the order of .1 - .3mm I'm estimating. The camera position would likely be on the order of 6&amp;quot; above. Does this give you better insight? &lt;sup&gt;Aug 17 at 15:15&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am not looking to perform a single profile/relief measurement, but rather attempting to generate a surface height map of the object.  The surface features of the object, as well as the overall profile, are of significant interest.&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-10-26T15:09:11.910" Title="Are Computer Stereo Vision techniques appropriate for sub-millimetre measurements?" Tags="|stereo-vision|computer-vision|" AnswerCount="8" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7" PostTypeId="1" CreationDate="2011-08-16T20:27:23.140" Score="18" ViewCount="1600" Body="&lt;p&gt;We can easily design interpolation filters that obey certain frequency-domain constraints using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm&quot;&gt;Parks-McClellan&lt;/a&gt; algorithm.  However, it's not immediately clear how to enforce time-domain constraints; in particular, I'm interested in generating Nyquist filters.  So if I'm oversampling by a factor of &lt;code&gt;N&lt;/code&gt;, I want the filter to have zero-crossings at &lt;code&gt;kN&lt;/code&gt;, for non-zero integer &lt;code&gt;k&lt;/code&gt; (this ensures that the input samples to my interpolator will appear in the output sequence).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen Harris&lt;sup&gt;1&lt;/sup&gt; talk about a technique for designing half-band filters, i.e. the special case where &lt;code&gt;N=2&lt;/code&gt;.  Is there a general solution for this?  (I know that we can easily design filters with the window method, but that doesn't give us the same control.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&#xA;[1] &lt;em&gt;Multirate Signal Processing for Communication Systems&lt;/em&gt;, pp. 208-209&#xA;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="77" LastEditDate="2011-08-23T03:16:34.833" LastActivityDate="2011-08-23T03:16:34.833" Title="How can I design Nyquist interpolation filters with the Parks-McClellan algorithm?" Tags="|filters|parks-mclellan|interpolation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8" PostTypeId="1" AcceptedAnswerId="24" CreationDate="2011-08-16T20:35:14.063" Score="9" ViewCount="527" Body="&lt;p&gt;I know that a Hidden Markov Model (HMM) is used in speech recognition and understand it to some degree. However, what I don't know is how input (speech) is &quot;transformed&quot; to a vector which in later used in HMM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you get a vector from a sound input? Is this vector readable by a human? &lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="77" LastEditDate="2011-08-17T13:51:17.980" LastActivityDate="2011-08-22T05:22:33.550" Title="What does a &quot;vector&quot; in a hidden Markov model mean?" Tags="|speech-recognition|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9" PostTypeId="2" ParentId="7" CreationDate="2011-08-16T20:45:01.113" Score="6" Body="&lt;p&gt;One method to get your desired zero crossings is to do a hybrid design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start out with a Parks-McLellan/Remez half-band filter given equal weight to passband and stopband.  Since it is a &lt;a href=&quot;http://www.dspguru.com/dsp/reference/filter-terminology&quot; rel=&quot;nofollow&quot;&gt;halfband filter&lt;/a&gt;, it will have zeros at alternate samples.&#xA; You can then interpolate the time domain by sin(x)/x by zero-stuffing in the frequency domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: creating a fs/12 lowpass filter with zero crossings every 6 samples.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% prototype Remez filter &#xA;taps=18; &#xA;b = remez(taps,[0 .4 .6 1],[1 1 0 0])';  &#xA;% force halfband condition of zeros at every other sample&#xA;b(2:2:end)=0;  b(taps/2+1)=.5; &#xA;&#xA;% zero pad the time domain to give the Gibbs ripple some deadspace&#xA;B=fft(b,4*(taps+1) ); &#xA;% split the frequency domain into two halves, split the Nyquist bin&#xA;Blo = [ B(1:length(B)/2) 0.5*B(length(B)/2+1) ]; &#xA;Bhi = [ 0.5*B(length(B)/2+1) B(length(B)/2+2:length(B))  ]; &#xA;&#xA;% insert padding at pi to increase size 3x&#xA;Bpad = [ Blo zeros(1,3*length(B)-length(Blo)-length(Bhi) ) Bhi];  &#xA;bint = real( ifft(Bpad) ); % this has zeros every 6 samples&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting filter is close to, but not quite as good as, the prototype in terms of stopband/passband ripple.  The sin(x)/x interpolation does introduce some low level ringing. You might need to slightly overdesign the prototype filter to get the required level of attenuation in the interpolated filter.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2011-08-16T21:52:50.490" LastActivityDate="2011-08-16T21:52:50.490" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10" PostTypeId="2" ParentId="6" CreationDate="2011-08-16T21:07:30.923" Score="4" Body="&lt;p&gt;The precision of a stereo system is limited by the pixel size.  Theoretically high-end cameras should have sufficient pixel density for such precision.  Of course, the cameras will need to be calibrated, and the object will have to be reasonably close to the cameras.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2011-08-16T21:07:30.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11" PostTypeId="2" ParentId="6" CreationDate="2011-08-16T21:10:57.830" Score="3" Body="&lt;p&gt;In theory there's nothing to stop you. However, I can think at least of a couple image capture issues that will manifest themselves at this scale. I'm not an expert in the issues of microscopy, here are a couple of issues:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What would the depth variation along the line of sight be compared to&#xA;the distance from the camera to the object? While rectification is&#xA;easier under scaled orthographic constraints (the depth change of the&#xA;object is tiny compared to the distance along the line of sight from&#xA;the object to the camera) this would not give you the desired detail.&#xA;So the camera would need to be quite close to the object.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What would the baseline be, compared to the size of the object? Wide &#xA;baselines are hard, while there are good techniques for narrow   baselines. It sounds like at this scale physically locating two cameras that are close to each other can be challenging.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="72" LastEditorUserId="72" LastEditDate="2011-08-16T21:18:02.017" LastActivityDate="2011-08-16T21:18:02.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12" PostTypeId="2" ParentId="5" CreationDate="2011-08-16T21:20:29.243" Score="11" Body="&lt;p&gt;As far as I know, ARM should be considered an architecture rather than a platform. However, the question is quite relevant as to what platform to use for RT signal (in this case audio) processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could begin by asking following questions, not in strict order:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How much time do I have for the implementation? &lt;/li&gt;&#xA;&lt;li&gt;What are my power constraints?&lt;/li&gt;&#xA;&lt;li&gt;What mathematical operations do I need? You might end up requiring lots of multipliers in parallel and hence limit your choice.&lt;/li&gt;&#xA;&lt;li&gt;How much memory do I need? (most MCUs are limited)&lt;/li&gt;&#xA;&lt;li&gt;[Important] What is my frequency of operation? How much can I squeeze in within the sampling period keeping operating frequency low?&lt;/li&gt;&#xA;&lt;li&gt;What libraries are available for my choice of implementation?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would begin by looking at the algorithm first and foremost. If, for example, you need a lot of FFTs and MAC operations, you can probably rule out most microcontrollers and focus more on DSP cores.  Bear in mind that there are MCUs with embedded DSP cores as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another important consideration would be your ability and expertise in the area of implementation. Most people shy away from FPGA because you must use an HDL for the implementation. Another reason to shy away from FPGAs is the power requirement.&lt;/p&gt;&#xA;" OwnerUserId="73" LastEditorUserId="10" LastEditDate="2011-08-17T13:51:50.617" LastActivityDate="2011-08-17T13:51:50.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13" PostTypeId="1" CreationDate="2011-08-16T22:08:10.157" Score="107" ViewCount="94033" Body="&lt;p&gt;In speech recognition, the front end generally does signal processing to allow feature extraction from the audio stream. A discrete Fourier transform (DFT) is applied twice in this process. The first time is after windowing; after this Mel binning is applied and then another Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;I've noticed however, that it is common in speech recognizers (the default front end in &lt;a href=&quot;http://cmusphinx.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CMU Sphinx&lt;/a&gt;, for example) to use a discrete cosine transform (DCT) instead of a DFT for the second operation. What is the difference between these two operations? Why would you do DFT the first time and then a DCT the second time?&lt;/p&gt;&#xA;" OwnerUserId="79" LastEditorUserId="7092" LastEditDate="2023-11-21T16:41:05.527" LastActivityDate="2023-11-21T16:41:05.527" Title="What is the difference between a Fourier transform and a cosine transform?" Tags="|discrete-signals|dft|dct|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14" PostTypeId="2" ParentId="8" CreationDate="2011-08-16T22:18:06.980" Score="0" Body="&lt;p&gt;Every wave can be decomposed into the addition of many other waves. Using a Fourier transform, you can analyze a wave into its frequency components. The amplitude of these frequency components can then be used as a vector. &lt;a href=&quot;http://cmusphinx.sourceforge.net/sphinx4/javadoc/edu/cmu/sphinx/frontend/transform/DiscreteFourierTransform.html&quot; rel=&quot;nofollow&quot;&gt;Here's&lt;/a&gt; the documentation on the Sphinx class that does this and &lt;a href=&quot;http://altdevblogaday.com/2011/05/17/understanding-the-fourier-transform/&quot; rel=&quot;nofollow&quot;&gt;here's&lt;/a&gt; a good visual explanation of the Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="79" LastActivityDate="2011-08-16T22:18:06.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15" PostTypeId="2" ParentId="13" CreationDate="2011-08-17T00:51:38.983" Score="9" Body="&lt;p&gt;The difference between a Discrete Fourier Transform and a &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform&quot;&gt;Discrete Cosine transformation&lt;/a&gt; is that the DCT uses only real numbers, while a Fourier transform can use complex numbers. The most common use of a DCT is compression. It is equivalent to a FFT of twice the length.&lt;/p&gt;&#xA;" OwnerUserId="88" LastEditorUserId="88" LastEditDate="2011-08-17T01:02:49.583" LastActivityDate="2011-08-17T01:02:49.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17" PostTypeId="2" ParentId="13" CreationDate="2011-08-17T01:22:24.683" Score="78" Body="&lt;p&gt;The Discrete Fourier Transform (DFT) and Discrete Cosine Transform (DCT) perform similar functions: they both decompose a finite-length discrete-time vector into a sum of scaled-and-shifted basis functions. The difference between the two is the type of basis function used by each transform; the DFT uses a set of harmonically-related complex exponential functions, while the DCT uses only (real-valued) cosine functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT is widely used for general spectral analysis applications that find their way into a range of fields. It is also used as a building block for techniques that take advantage of properties of signals' frequency-domain representation, such as the overlap-save and overlap-add fast convolution algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DCT is frequently used in lossy data compression applications, such as the JPEG image format. The property of the DCT that makes it quite suitable for compression is its high degree of &quot;spectral compaction;&quot; at a qualitative level, a signal's DCT representation tends to have more of its energy concentrated in a small number of coefficients when compared to other transforms like the DFT. This is desirable for a compression algorithm; if you can approximately represent the original (time- or spatial-domain) signal using a relatively small set of DCT coefficients, then you can reduce your data storage requirement by only storing the DCT outputs that contain significant amounts of energy.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-08-17T01:22:24.683" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18" PostTypeId="2" ParentId="13" CreationDate="2011-08-17T01:40:31.787" Score="33" Body="&lt;p&gt;I found that some of the details in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform&quot; rel=&quot;noreferrer&quot;&gt;DCT wiki&lt;/a&gt; (also shared by Pearsonartphoto) point out that the DCT is well-suited for compression applications. The end of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform#Informal_overview&quot; rel=&quot;noreferrer&quot;&gt;Informal overview section&lt;/a&gt; is helpful (bolding is mine).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In particular, it is well known that any discontinuities in a function reduce the rate of convergence of the Fourier series...the smoother the function is, the fewer terms in its DFT or DCT are required to represent it accurately, and the more it can be &lt;strong&gt;compressed&lt;/strong&gt;... However, the implicit periodicity of the DFT means that discontinuities usually occur at the boundaries... In contrast, a DCT where &lt;em&gt;both&lt;/em&gt; boundaries are even &lt;em&gt;always&lt;/em&gt; yields a continuous extension at the boundaries. &lt;strong&gt;This is why DCTs...generally perform better for signal compression than DFTs and DSTs.&lt;/strong&gt; In practice, a type-II DCT is usually preferred for such applications, in part for reasons of computational convenience.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Additionally, you may find that this &lt;a href=&quot;https://math.stackexchange.com/questions/1177/comparing-contrasting-cosine-and-fourier-transforms/1205#1205&quot;&gt;answer&lt;/a&gt; is useful too (from math.stackexchange.com). It states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Cosine transforms are nothing more than shortcuts for computing the&#xA;  Fourier transform of a sequence with special symmetry (e.g. if the&#xA;  sequence represents samples from an even function).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="38" LastEditorUserId="-1" LastEditDate="2018-09-30T15:46:28.630" LastActivityDate="2018-09-30T15:46:28.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20" PostTypeId="2" ParentId="1" CreationDate="2011-08-17T04:22:53.650" Score="6" Body="&lt;p&gt;If you want to implement the &quot;standard&quot; NLMS algorithm without cutting any corners, then you're probably not going to find a structure that is significantly more efficient. Block forms of LMS filtering aim to use fast convolution techniques (like overlap-save or overlap-add) to speed that part of the process. However, as you noted, the filter coefficients are only updated per block, as the filter must be constant over the block to use the fast convolution approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The highly recursive nature of NLMS is going to limit you if you want to keep the sample-by-sample update characteristic. While the filtering action is non-recursive, the filter coefficients at time instant N are a function of the coefficients at time instant N-1, which limits your ability to speed the process by using parallelism or block-oriented computation. As in most cases, there isn't a free lunch: if you want pure NLMS, then you're best off just implementing that.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-08-17T04:22:53.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21" PostTypeId="1" CreationDate="2011-08-17T05:38:54.923" Score="17" ViewCount="2510" Body="&lt;p&gt;I have a 2D image, which I want to lowpass filter, with these constraints / quality metrics:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I can not &quot;add&quot; light to the image, so each pixel in the result&#xA;should be &amp;lt;= the corresponding pixel in the input.&lt;/li&gt;&#xA;&lt;li&gt;The lowpass cutoff frequency should be a parameter, to experiment with&lt;/li&gt;&#xA;&lt;li&gt;Applying this filter repeatedly should not change the result in a significant way.&lt;/li&gt;&#xA;&lt;li&gt;The time it takes to run this algorithm (5 minutes for a 5MPix image seems reasonable)&lt;/li&gt;&#xA;&lt;li&gt;Minimizing the amount of light that is filtered away.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Below are some approaches I have tried, together with their shortcomings:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Gaussian filter like normal, then pull the result down to comply with constraint 1. This complies very well with the first 3 points, but reduces a lot more light than necessary.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fitting &quot;upwards&quot; parabolas through the &quot;low&quot; points and &quot;downwards&quot; parabolas between them to smooth out. This works great in 1D, but applying it first horizontally, then vertically produces bad results in 2D. It takes a lot longer, but not too long for my application. However, repeatably applying this filter will drastically change the result. If the (1D) input is a perfect &quot;downward&quot; parabola (which should not be filtered at all), it will be replaced by 2 &quot;upward&quot; parabolas sitting at the start/end.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using some other form of 2D &quot;basic&quot; functions and linear solving to find the optimal parameters. This is an idea only currently, not implemented / tested yet.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My domain of experience in signal processing is almost exclusively image processing, so I hope to find alternatives to this problem with the input of experts active in other areas of signal processing.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;update 2011/08/18&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Based on the current reactions, I decided to make things a bit more clear by adding graphs of a typical input and the results of the 3 approaches I described originally + the suggestions I received so far.&#xA;For easy comparison, I used just 1D filtering in these examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Input data:&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/dVjOi.png&quot; alt=&quot;Input data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Gaussian filter&lt;/strong&gt; + bring it down to comply with requirement (1).&lt;br&gt;&#xA;You can see that bringing it down results in unnecessary light reductions on the right hand side.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DmG4y.png&quot; alt=&quot;gaussian filtered&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Parabolas&lt;/strong&gt;&lt;br&gt;&#xA;As far as I am concerned, this is pretty much excellent, sadly it does not translate perfectly into 2D by applying first horizontal, then vertical. In this case, you also see I can evaluate the fitted parabolas in floating point resolution, which is a small benefit, but not absolutely required.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VMRhJ.png&quot; alt=&quot;parabola fitting&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Grayscale erosion&lt;/strong&gt;&lt;br&gt;&#xA;Based on the suggestion from rwong, I tried grayscale erosion. I used a structuring element with the same parabolic shape as my &quot;fitted&quot; parabolas. The result is almost exactly the same, so this looks promising. However, there are still a few problems:&#xA; 1. My structuring element was not &quot;big enough&quot; (although it was already 801 pixels wide)&#xA; 1. I only have &quot;upwards&quot; parabolas, no &quot;downward parabolas to smooth the transition from one parabola to the next.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/E1zu0.png&quot; alt=&quot;grayscale erosion&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Median filtering&lt;/strong&gt;&lt;br&gt;&#xA;Only included for completeness, it is not really what I want.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/50yK7.png&quot; alt=&quot;median filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;raw data&lt;/strong&gt;&lt;br&gt;&#xA;I pasted the raw input data + the various python commands onto pastebin, so you can experiment with the same data too.&lt;br&gt;&#xA;&lt;a href=&quot;http://pastebin.com/ASnJ9M0p&quot; rel=&quot;noreferrer&quot;&gt;http://pastebin.com/ASnJ9M0p&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="99" LastEditDate="2011-08-18T13:35:55.637" LastActivityDate="2020-12-29T13:56:27.590" Title="How can I lowpass filter by only reducing peak data?" Tags="|image-processing|lowpass-filter|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22" PostTypeId="2" ParentId="6" CreationDate="2011-08-17T05:47:50.830" Score="3" Body="&lt;p&gt;(Posting this answer in the hope of helping OP, even though my answer is off-topic for this site)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edited:&lt;/strong&gt; My calculations below were for horizontal and vertical measurements across the image. They are not valid for stereo-based depth estimation. To see a valid calculation for stereo-based depth estimation, see &lt;a href=&quot;https://dsp.stackexchange.com/questions/36/how-can-i-estimate-the-spatial-resolution-of-consumer-grade-electronics/40#40&quot;&gt;Martin Thompson's answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;According to Wikipedia, &lt;a href=&quot;http://en.wikipedia.org/wiki/Confocal_laser_scanning_microscopy&quot; rel=&quot;nofollow noreferrer&quot;&gt;confocal laser scanning microscopy&lt;/a&gt; is useful for &lt;a href=&quot;http://en.wikipedia.org/wiki/Profilometer&quot; rel=&quot;nofollow noreferrer&quot;&gt;surface profiling&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;10μm (100th of a millimetre) is the starting point of usefulness of all sorts of microscopy devices, because it is just one order of magnitude below the usefulness of digital imaging devices (about 100μm per pixel, at maybe 10 - 20 cm distance).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My assumptions are: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Distance from object: 15cm&lt;/li&gt;&#xA;&lt;li&gt;field of view: 10cm&lt;/li&gt;&#xA;&lt;li&gt;image width in pixels: 3000&lt;/li&gt;&#xA;&lt;li&gt;raw resolution power: 30 pixels per mm&lt;/li&gt;&#xA;&lt;li&gt;Assuming correctly focused, and due to noises, optics and compression artifacts, &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(point spread function) objects may be blurred up to 5 pixels apart&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;estimated resolution power: 6 pixels per mm (160μm)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That said, it's a matter of building a number of laser, optics and imaging components (and the enclosure, which is very important) at the required machining precision. I'm not sure whether it is feasible to build a poor man's confocal laser scanning microscopy. (I also don't know the second-hand price of such machines.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At such resolution, stereo vision alone without the help of a special light source (structured light, laser, etc), would suffer from the &quot;lack of texture&quot; problem.&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2011-08-18T05:03:25.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23" PostTypeId="2" ParentId="21" CreationDate="2011-08-17T06:26:31.950" Score="8" Body="&lt;p&gt;There is indeed a 2D version for your attempt #2 - it is similar in theory, but it cannot be decomposed into two 1D operations. Please read about &quot;2D grayscale morphological filtering&quot;. It is faster than curve fitting.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://opencv.willowgarage.com/documentation/image_filtering.html&quot; rel=&quot;nofollow&quot;&gt;http://opencv.willowgarage.com/documentation/image_filtering.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dilation_%28morphology%29&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Dilation_(morphology)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Median filtering might also be useful if you are trying to remove speckles. A more advanced form of median filtering is &quot;ordinal filtering&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all cases, requirement #1 can be met trivially by taking the pixelwise minimum between the output and the input. It is an important quality criteria, but it will not limit the choice of algorithms.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Gaussian filtering (and a number of other useful filters) can be decomposed (first from 2D to 1D operations, then via Fourier transform), but there are many other useful image processing techniques that are not decomposable, which make them slow but does not diminish their usefulness.&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="483" LastEditDate="2011-10-31T20:25:47.753" LastActivityDate="2011-10-31T20:25:47.753" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24" PostTypeId="2" ParentId="8" CreationDate="2011-08-17T06:41:42.450" Score="8" Body="&lt;p&gt;The way speech recognition is carried out with HTK (or any other tool) is sort of similar to the way speech recognition is carried out in the brain. When you hear a word, you instantly break it down into its constituent &lt;a href=&quot;http://en.wikipedia.org/wiki/Phone_%28phonetics%29&quot; rel=&quot;nofollow&quot;&gt;phones&lt;/a&gt; and then compare the &lt;a href=&quot;http://en.wikipedia.org/wiki/Phone_%28phonetics%29&quot; rel=&quot;nofollow&quot;&gt;phones&lt;/a&gt; with an internal mental &quot;model&quot; of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Phone_%28phonetics%29&quot; rel=&quot;nofollow&quot;&gt;phones&lt;/a&gt;. These &quot;models&quot; are constructed over years of listening to speech and gives you the ability to distinguish between similar-sounding sentences like &quot;How to wreck a nice beach&quot; and &quot;How to recognize speech&quot;. Speech recognition with HTK or any other model-based scheme works in a similar manner. Here, in a few steps, is how you do it:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You take the input speech signal and convert it into a feature vector representation.&lt;/li&gt;&#xA;&lt;li&gt;Take a large number of sentences and perform step 1 on each of them.&lt;/li&gt;&#xA;&lt;li&gt;Use the feature vectors in step 2 to build a statistical model for each of the phones/words in the sentences (there are a limited number of phones/words as against an infinite number of ways of saying them - so you reduce the unknowns by modelling). &lt;/li&gt;&#xA;&lt;li&gt;When a new word comes in, break it into phones and compare with each of the known models. The sequence of phones with the highest probability wins!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All the above steps are critical to the successful completion of any speech recognition task. By decomposing a sound into its feature vector, you are taking it into a model-space, giving it a representation that makes it more suited to making-a-model-out-of than other representations (say the time-amplitude representation). Most such representations lie in the frequency, or the time-frequency domain. One of the most popular such representations is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel-frequency_cepstral_coefficient&quot; rel=&quot;nofollow&quot;&gt;MFCC (Mel Frequency Cepstral Coefficient)&lt;/a&gt;. In a way, this technique mimics the human hearing response with a set of filters. An input signal is decomposed with this set of filters that have a logarithmic spacing of their center frequencies. The MFCC coefficients of any one sentence (say) are then used to model each of the phones that the sentence is made of. As an example, consider,  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sentence: HI.   Phonetic description: hh aa ey&lt;br&gt;&#xA;When you feed the MFCC coefficients into HTK, it will associate the MFCC coefficients of a portion of the sentence with hh, another with aa and so on. When this is repeated many times over, the models for the phones begin to form.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;HTK uses the tool &lt;code&gt;HCopy&lt;/code&gt; to convert an input sentence into its feature-vector representation. There are many &quot;flavours&quot; to MFCC's as well (E_D_A or E_D_A_Z representations). It would be a good idea to read up on the documentation for &lt;code&gt;HCopy&lt;/code&gt; within the htkbook.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MFCC coefficients are written to a file with extension &lt;code&gt;.mfc&lt;/code&gt; by HTK. It is not possible to read that file using any one of the text editors because (I think) the coefficients are written in binary. You can try to read the files with &lt;code&gt;C&lt;/code&gt; though.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;HTH.&lt;/p&gt;&#xA;" OwnerUserId="102" LastEditorUserId="140" LastEditDate="2011-08-22T05:22:33.550" LastActivityDate="2011-08-22T05:22:33.550" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25" PostTypeId="2" ParentId="6" CreationDate="2011-08-17T07:54:38.647" Score="4" Body="&lt;p&gt;It depends on the geometry, but certainly in principle.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your objects need to have sufficient &quot;texture&quot; that you can match identifying features from one camera to another, and then your cameras need to have a sufficient number of pixels that a depth discrepancy of 0.01mm corresponds to &gt; 1 pixel when projected onto the image plane.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mapping out lens distortions may be a bigger issue than it normally is at these scales.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2011-08-17T07:54:38.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26" PostTypeId="1" AcceptedAnswerId="32" CreationDate="2011-08-17T09:57:31.830" Score="23" ViewCount="1008" Body="&lt;p&gt;I have 100,000 samples of a signal $x[n]$ that was sampled at 20kHz. The data is vibration data  from a rotating machine, and contains a significant spectral component related to the speed of the machine's rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the speed of the machine varies over the duration of the sample, using the peak of the FFT does not yield the result I am looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I want to use estimators such as &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=45547&quot;&gt;Kay's estimator&lt;/a&gt; that allow short-term estimates, but assume a signal model of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n] = A \exp(j \omega n + \theta) + z[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where  $n$ = 0... 99,999, $A$ is the amplitude, $\omega$ is the frequency to be estimated, $\theta$ is the initial offset, and $z[n]$ is the complex noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, my signal is real-valued and looks more like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n] = A \cos(\omega n + \theta) + z_r[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $z_r$ and $A$ are now real-valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I transform my real-valued signal into a complex-valued signal, so that I can use Kay's estimator?&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="77" LastEditDate="2011-08-23T03:24:38.643" LastActivityDate="2011-08-23T03:24:38.643" Title="How should I pre-process a real valued signal in order to use Kay's estimator?" Tags="|analytic-signal|preprocessing|estimators|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27" PostTypeId="2" ParentId="5" CreationDate="2011-08-17T10:27:25.940" Score="13" Body="&lt;p&gt;If you are keeping to &quot;standard algorithms&quot; like IIR, FIR, radix-2 or 4 FFT (ie stuff that fits DSP architectures well without much control flow), you can try this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Count up how many &quot;multiply accumulates&quot; you need per second in all your algorithms.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&amp;lt; 10 million you can probably get a fast microcontroller to do the job (or even a slow one if you are &amp;lt;1M)&lt;/li&gt;&#xA;&lt;li&gt;&amp;lt; 100M is easy DSP territory&lt;/li&gt;&#xA;&lt;li&gt;&amp;lt; 1G is likely to be doable fast DSP territory&lt;/li&gt;&#xA;&lt;li&gt;1G-10G is where the cross-over between DSP and FPGA comes&lt;/li&gt;&#xA;&lt;li&gt;&gt; 10G is multiple DSPs or FPGA&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastActivityDate="2011-08-17T10:27:25.940" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28" PostTypeId="1" CreationDate="2011-08-17T12:35:02.107" Score="17" ViewCount="317" Body="&lt;p&gt;For microscopy, we're frequently testing cameras. Since my applications involve very low signal-to-noise ratio, it becomes important that the noise is free of correlations and patterns, because local correlation is all that really distinguishes signal from background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To test the noise, I usually acquire a series of ~100 dark frames, i.e. frames where no external light hits the camera, determine the fixed camera pattern by time-averaging, and subtract that from the series. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've observed patterns in the noise by simply taking the standard deviation for each pixel through time and looking at the resulting image (where e.g. different rows/columns of the camera had different noise standard deviations), and by doing row and column-wise cross-correlation (where I noticed for some interleaved camera that the noise was correlated between every other row). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first of these tests is qualitative only, and the second only gives me (relatively) global correlations. Are there better (and faster?) ways to determine whether there is any correlation or dynamic pattern in the noise of the camera?&lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2011-08-18T05:28:43.553" Title="How do I determine whether I have pattern-free noise?" Tags="|noise|camera|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29" PostTypeId="2" ParentId="28" CreationDate="2011-08-17T13:20:16.480" Score="5" Body="&lt;p&gt;If I were you, I would simply take a large number of no-signal, where you aren't measuring any real signal. Run it through whatever identification algorithms you have, and see if you see anything. If you do, then you need to worry about correlations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what you might be missing is that correlation does not always mean a false detection, especially if you have a robust algorithm to this kind of noise.&lt;/p&gt;&#xA;" OwnerUserId="88" LastActivityDate="2011-08-17T13:20:16.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="31" PostTypeId="1" AcceptedAnswerId="362" CreationDate="2011-08-17T13:37:24.547" Score="30" ViewCount="16198" Body="&lt;p&gt;In most audio processing tasks, one of the most used transformations is &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel-frequency_cepstral_coefficient&quot;&gt;MFCC (Mel-frequency cepstral coefficients)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mostly know the math that's behind the MFCC: I understand both the filterbank step and the Mel frequency scaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't get is the DCT (Discrete Cosine Transform) step: What kind of information do I get in this step? What is a good visual representation of this step?&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="1746" LastEditDate="2012-08-10T21:11:22.430" LastActivityDate="2021-12-29T08:35:50.737" Title="How do I interpret the DCT step in the MFCC extraction process?" Tags="|filters|mfcc|cepstral-analysis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="32" PostTypeId="2" ParentId="26" CreationDate="2011-08-17T13:51:01.600" Score="12" Body="&lt;p&gt;The tool for converting real signals into their &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow noreferrer&quot;&gt;analytic&lt;/a&gt; representation is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hilbert transform&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose your signal were a projection of some helical rotation with variable amplitude onto the real-time plane, like in the image below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pVsbY.gif&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;sub&gt;&lt;a href=&quot;http://www.aapg.org/explorer/2010/06jun/geocorner0610.cfm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Hilbert transform produces such complex signal given its real part. It is a linear transform and it's very easy to do in frequency domain. Without going into its mathematics and derivations too much in depth, the Fourier Transform imaginary part of your signal is the same as the one of your real signal multiplied by &lt;span class=&quot;math-container&quot;&gt;$-j$&lt;/span&gt; (rotated by 90 degrees). By symmetrical properties of real signal, you get the following relationship:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;All your negative ferquency components become 0.&lt;/p&gt;&#xA;&lt;p&gt;Your DC component stays the same.&lt;/p&gt;&#xA;&lt;p&gt;All your positive frequency components double&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In Matlab, for example, you would do the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;a = rand(1,201);&#xA;&#xA;hilbert_a = ifft( [ 1, 2*ones(1,100), zeros(1,100)] .* fft(a) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or simply use built-in the &lt;code&gt;hilbert&lt;/code&gt; function.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2011-08-23T03:21:06.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="33" PostTypeId="2" ParentId="26" CreationDate="2011-08-17T14:02:58.737" Score="7" Body="&lt;p&gt;If you would like to use Kay's estimator, you need to convert the signal of interest to its &quot;analytic signal&quot; representation. This essentially eliminates the redundant (e.g. the negative) frequencies from the original real-valued signal. Since the conjugate symmetry of the signal's frequency-domain representation is destroyed in this process, the result is complex. Then, you should be able to apply the technique you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other approaches are also available to the frequency-tracking problem. It is possible to apply the LMS algorithm to perform instantaneous frequency estimation (Haykin, &quot;Adaptive Filter Theory,&quot; pp. 244-246). Alternatively, you could use a phase-locked loop to track the discrete spectral component over time. The right solution is a function of what your ultimate goal is and what the specific characteristics of your signal are.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-08-17T14:02:58.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="36" PostTypeId="1" CreationDate="2011-08-17T18:06:35.843" Score="10" ViewCount="421" Body="&lt;p&gt;I have been looking at stereo vision applications, and one working example involves using two USB web cams, mounted together and calibrated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to estimate the theoretical spatial resolution of such a set up?  The goal is to avoid purchasing and testing blindly but rather to be relatively confident ahead of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do understand that the EXACT resolution will probably require a test setup due to lensing, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What information would be needed to make this determination?  Would the minimum focal length and the maximum resolution be sufficient?  Pixel density obviously plays some role in this, and is advertised on most digital cameras (which have a much higher maximum resolution), if I was attempting to compute an estimate, how should I incorporate this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example consider the following setup:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a 4&quot; minimum focal length (MS HD Webcam focal length)&lt;/li&gt;&#xA;&lt;li&gt;a maximum resolution of 1920x1080&lt;/li&gt;&#xA;&lt;li&gt;object is on the order of a couple of centimeters&lt;/li&gt;&#xA;&lt;li&gt;details on the order of tenths of millimeters&lt;/li&gt;&#xA;&lt;li&gt;the distance between cameras and objects should be smallish, I was considering something like 15 cm to 25 cm, flexible based on the answer here&lt;/li&gt;&#xA;&lt;li&gt;the distance between cameras, the number of cameras can be flexible but should stay in the smallish range ... if I need $10,000 in cameras, it's a bad solution&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="36" LastEditorUserId="36" LastEditDate="2011-10-08T13:02:09.173" LastActivityDate="2011-10-08T13:02:09.173" Title="How can I estimate the spatial resolution of consumer grade electronics?" Tags="|stereo-vision|resolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="37" PostTypeId="5" CreationDate="2011-08-17T18:34:34.517" Score="0" Body="&lt;p&gt;Stereo vision, or specifically Computer Stereo Vision, is the process of extracting 3 dimensional information from 2 dimensional images by using multiple points of view of an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The multiple images of the same object are processed to remove artifacts, apply filters and general clean the image of distortions.  The images are then processed by a series of transformations, such as rotations and scalings, to place both in the same plane.  This process is known as image rectification.  The features of the images are then compared to produce a disparity map which describes the best correspondence of the features.  The disparity map can be further processed to produce a height (distance) map of the features of the original object.&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="36" LastEditDate="2011-08-18T03:25:46.230" LastActivityDate="2011-08-18T03:25:46.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="38" PostTypeId="4" CreationDate="2011-08-17T18:34:34.517" Score="0" Body="Stereo vision, or Stereopsis, is the process in visual perception leading to the perception of depth from the two slightly different projections of an object onto the two eyes.  Computer stereo vision mimics this behaviour by having the computer compare multiple images of a scene and determine the differences between identified features." OwnerUserId="36" LastEditorUserId="36" LastEditDate="2011-08-18T03:25:51.643" LastActivityDate="2011-08-18T03:25:51.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="39" PostTypeId="1" AcceptedAnswerId="55" CreationDate="2011-08-17T20:07:57.850" Score="12" ViewCount="152" Body="&lt;p&gt;In &lt;a href=&quot;https://dsp.stackexchange.com/questions/6/are-computer-stereo-vision-techniques-appropriate-for-sub-millimetre-measurements/25#25&quot;&gt;the comment to this answer&lt;/a&gt; using a laser diode and diffraction grating to provide texture on a surface was suggested to aid in height calculations in a computer vision system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the pattern that I'm familiar with is projecting a chessboard pattern on the object.  I was under the (incomplete) understanding that the deformation of the projected image was somehow used directly.  That is to say the formerly square pattern that is projected becomes a curved polygon and the transformation back to a square gave some information about the 3D structure.  Is this incorrect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there preferred patterns?  What are the dependencies in choosing a pattern?  Does it depend on the shape, material, etc, of the target object or is it more a function of the amount of variability in the features?&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2011-08-26T04:17:31.677" Title="Are there preferred patterns for creating texture on objects to aid computer vision?" Tags="|computer-vision|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="40" PostTypeId="2" ParentId="36" CreationDate="2011-08-17T20:48:31.417" Score="7" Body="&lt;p&gt;Consider the following figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MARBLE/medium/stereo/corresp.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yN7yl.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cameras are separated by baseline 2b - say 10cm, so b=5cm.  Your focal length of 4&quot; sounds looong (about 100mm) for a webcam, but hey, let's go with it.  f=100mm (or also 10cm!). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $xr-xl = \frac {2bf}{z}$ an object at 10m away will have a pixel difference between the two cameras ($xr-xl$) of 0.1*0.1/10 = 0.001m.  So, if your pixels are 5 micron square $xr-xl$ is about 200 pixels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is a lot - large disparities are expensive to search for.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a more normal focal length of say 5mm, your disparity is more like 10 pixels.  11m is about 9 pixels, so your distance resolution is about 1m @ 10m.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a specific camera in mind you can run the numbers for your particular geometry.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="77" LastEditDate="2011-08-19T13:20:45.030" LastActivityDate="2011-08-19T13:20:45.030" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="41" PostTypeId="5" CreationDate="2011-08-17T22:53:59.537" Score="0" Body="&lt;p&gt;It it is commonly defined by the following summation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ X_k = \sum\limits_{n=0}^{N-1} x_n e^{-\frac{2i\pi}{N}kn} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $ k =0,1,..N-1 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is invertible; the inversion is known as the IDFT (Inverse Discrete Fourier Transform) and is defined by the following summation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x_n = \frac{1}{N} \sum\limits_{k=0}^{N-1} X_k e^{\frac{2i\pi}{N}nk}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $ n =0,1,..N-1 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should not be confused with the &lt;a href=&quot;/questions/tagged/dtft&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;dtft&amp;#39;&quot; rel=&quot;tag&quot;&gt;dtft&lt;/a&gt;, which is applied to an infinite set of discrete points, or the lesser-known &lt;a href=&quot;/questions/tagged/cft&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;cft&amp;#39;&quot; rel=&quot;tag&quot;&gt;cft&lt;/a&gt;, which is applied to continuous signals.&lt;/p&gt;&#xA;" OwnerUserId="5" LastEditorUserId="15892" LastEditDate="2016-08-24T11:18:12.987" LastActivityDate="2016-08-24T11:18:12.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="42" PostTypeId="4" CreationDate="2011-08-17T22:53:59.537" Score="0" Body="The Discrete Fourier Transform (DFT) is a mapping between a finite set of discrete points in a  (primal) domain (time, space) and the dual frequency domain.  DFT requires an input sequence which is discrete, such as a sampling from an analogue audio signal." OwnerUserId="36" LastEditorUserId="15892" LastEditDate="2016-08-24T11:18:12.987" LastActivityDate="2016-08-24T11:18:12.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="43" PostTypeId="5" CreationDate="2011-08-17T22:56:26.820" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-08-17T22:56:26.820" LastActivityDate="2011-08-17T22:56:26.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="44" PostTypeId="4" CreationDate="2011-08-17T22:56:26.820" Score="0" Body="Speech recognition is the process of converting the spoken word to text, usually without regard to a particular speaker (which is more commonly referred to as &quot;voice recognition&quot;)." OwnerUserId="36" LastEditorUserId="36" LastEditDate="2011-08-18T03:26:04.343" LastActivityDate="2011-08-18T03:26:04.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="45" PostTypeId="5" CreationDate="2011-08-17T23:00:19.657" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-08-17T23:00:19.657" LastActivityDate="2011-08-17T23:00:19.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="46" PostTypeId="4" CreationDate="2011-08-17T23:00:19.657" Score="0" Body="Structured light is the process of projecting a known pattern of pixels on to a scene or object. The way that the pattern deforms when striking surfaces allows computer vision systems to calculate the depth and surface information of the objects in the scene." OwnerUserId="36" LastEditorUserId="36" LastEditDate="2011-08-18T03:26:11.970" LastActivityDate="2011-08-18T03:26:11.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="47" PostTypeId="5" CreationDate="2011-08-17T23:21:53.227" Score="0" Body="&lt;p&gt;FPGAs are programmed using a Hardware Description Language, or HDL.  The two most popular HDLs are Verilog and VHDL.  It is also possible to program some FPGAs using logic diagrams and bare digital gates, however, complex systems are easier to create with HDLs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Common vendors include Xilinx and Altera. &lt;/p&gt;&#xA;" OwnerUserId="10" LastEditorUserId="10" LastEditDate="2011-08-18T15:27:14.060" LastActivityDate="2011-08-18T15:27:14.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="48" PostTypeId="4" CreationDate="2011-08-17T23:21:53.227" Score="0" Body="A Field-Programmable Gate Array is an IC which can be programmed to do high-speed, highly parallel signal processing operations." OwnerUserId="10" LastEditorUserId="10" LastEditDate="2011-08-18T15:27:19.253" LastActivityDate="2011-08-18T15:27:19.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="49" PostTypeId="5" CreationDate="2011-08-17T23:29:00.537" Score="0" Body="&lt;p&gt;The project includes a number of libraries, including: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;core - a compact module defining basic data structures, including the dense multi-dimensional array Mat and basic functions used by all other modules.&lt;/li&gt;&#xA;&lt;li&gt;imgproc - an image processing module that includes linear and non-linear image filtering, geometrical image transformations (resize, affine and perspective warping, generic table-based remapping), color space conversion, histograms, and so on.&lt;/li&gt;&#xA;&lt;li&gt;video - a video analysis module that includes motion estimation, background subtraction, and object tracking algorithms.&lt;/li&gt;&#xA;&lt;li&gt;calib3d - basic multiple-view geometry algorithms, single and stereo camera calibration, object pose estimation, stereo correspondence algorithms, and elements of 3D reconstruction.&lt;/li&gt;&#xA;&lt;li&gt;features2d - salient feature detectors, descriptors, and descriptor matchers.&#xA;objdetect - detection of objects and instances of the predefined classes (for example, faces, eyes, mugs, people, cars, and so on).&lt;/li&gt;&#xA;&lt;li&gt;highgui - an easy-to-use interface to video capturing, image and video codecs, as well as simple UI capabilities.&lt;/li&gt;&#xA;&lt;li&gt;gpu - GPU-accelerated algorithms from different OpenCV modules.&lt;/li&gt;&#xA;&lt;li&gt;... some other helper modules, such as FLANN and Google test wrappers, Python bindings, and others.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The project homepage is here: &lt;a href=&quot;http://opencv.willowgarage.com/wiki/&quot; rel=&quot;nofollow&quot;&gt;http://opencv.willowgarage.com/wiki/&lt;/a&gt;&lt;br&gt;&#xA;Project documentation is here: &lt;a href=&quot;http://opencv.itseez.com/modules/core/doc/intro.html&quot; rel=&quot;nofollow&quot;&gt;http://opencv.itseez.com/modules/core/doc/intro.html&lt;/a&gt;&lt;br&gt;&#xA;&lt;sub&gt;Note: Some of the above information was copied from these sources.&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="10" LastEditorUserId="10" LastEditDate="2011-08-18T15:27:24.747" LastActivityDate="2011-08-18T15:27:24.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="50" PostTypeId="4" CreationDate="2011-08-17T23:29:00.537" Score="0" Body="OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision." OwnerUserId="10" LastEditorUserId="10" LastEditDate="2011-08-18T03:26:38.960" LastActivityDate="2011-08-18T03:26:38.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="51" PostTypeId="1" AcceptedAnswerId="224" CreationDate="2011-08-17T23:39:22.150" Score="17" ViewCount="2257" Body="&lt;p&gt;IIR filters may be implemented as &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_filter#Filter_realization&quot;&gt;direct form 1 or 2&lt;/a&gt;. But how do you decide which form to use? What are the pros and cons of each? &lt;/p&gt;&#xA;" OwnerUserId="73" LastEditorUserId="77" LastEditDate="2011-09-14T20:50:31.927" LastActivityDate="2015-05-20T19:42:22.667" Title="What factors should I consider when choosing an IIR filter realization?" Tags="|filters|infinite-impulse-response|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="52" PostTypeId="2" ParentId="51" CreationDate="2011-08-18T00:09:46.883" Score="9" Body="&lt;p&gt;First of all, a bit from wikipedia on &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_filter#Direct_Form_I&quot; rel=&quot;nofollow&quot;&gt;Direct Form I and II&lt;/a&gt; implementation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Direct form I requires more memory, but is a somewhat simpler strategy, and is less likely to have round-off and resonance problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Direct form II requires less memory, but it has the potential for unusual interactions, larger numbers, and more round off error. Much of this can be reduced by cascading smaller filters, especially 2nd order filters.&lt;/p&gt;&#xA;" OwnerUserId="88" LastActivityDate="2011-08-18T00:09:46.883" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="54" PostTypeId="2" ParentId="7" CreationDate="2011-08-18T04:00:56.667" Score="10" Body="&lt;p&gt;One design method, albeit one that is limited to powers of two, would be to start with one halfband filter, insert zeros at every other (creates a spectral replica), then convolve it with a second halfband filter having a wider transition band.  Repeat the process until you get to the required power of 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example that creates a lowpass filter with Fc=fs/8 and zero crossings every 4 samples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b0=remez(34,[0 .45 .55 1],[1 1 0 0])';&#xA;b1=remez(6,[0 .25 .75 1],[1 1 0 0])';&#xA;b0up = zeros(1,2*length(b0)-1);&#xA;b0up(1:2:end) = b0;&#xA;B0up=freqz(b0up);&#xA;b2 = conv(b0up,b1);  % length = 34*2+1 + 6 = 75 coefficients&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FbUwa.png&quot; alt=&quot;Comparison of example filters&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2011-08-18T04:00:56.667" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="55" PostTypeId="2" ParentId="39" CreationDate="2011-08-18T04:42:09.737" Score="4" Body="&lt;p&gt;There are some generally applicable advices, and some application-specific advices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shi and Tomasi's paper, &lt;a href=&quot;http://www.ces.clemson.edu/~stb/klt/shi-tomasi-good-features-cvpr1994.pdf&quot; rel=&quot;nofollow&quot;&gt;Good features to track&lt;/a&gt; explains the criteria for choosing patterns: &lt;strong&gt;two-dimensional localizability&lt;/strong&gt;, or &quot;cornerness&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To put it simply, suppose you are trying to find an object at position &lt;code&gt;(x,y)&lt;/code&gt;, but instead the object appears in the image at &lt;code&gt;(x + dx, y + dy)&lt;/code&gt;. It is not very useful if our vision system can only tell us that &quot;no, the position is wrong.&quot; Instead, we expect the vision system to be able to estimate the amounts &lt;code&gt;dx&lt;/code&gt; and &lt;code&gt;dy&lt;/code&gt; provided that it is not too far off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sharp point (dot) is the most cornerful, but it is also easily buried in random pixel noise. By following through with the mathematics, we learn that there are other patterns that are &lt;em&gt;just as cornerful&lt;/em&gt; as a sharp point. (Think about a 1D &quot;edge&quot; being a 1D delta transformed by integration.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Some applications would call for localizability in fewer, or higher dimensions.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Added 8/25&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two line-like patterns can also be &quot;intersected&quot; to yield a point during calibration, provided that lens distortion is not significant or has been parameterized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In deblurring applications, a sharp point is often used for recovering the point spread function (psf). However, in theory any arbitrary-shaped objects could be used, provided that the ground truth is available to the calibration software.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In some applications, we would deliberately make the pattern un-sharp. &lt;a href=&quot;http://www.cs.columbia.edu/CAVE/projects/depth_defocus/&quot; rel=&quot;nofollow&quot;&gt;Depth from defocus&lt;/a&gt; uses the bluriness to reason about the position of the focal plane relative to the object, which gives an estimate of the object depth.&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="58" LastEditDate="2011-08-26T04:17:31.677" LastActivityDate="2011-08-26T04:17:31.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="57" PostTypeId="1" CreationDate="2011-08-18T05:55:42.690" Score="18" ViewCount="626" Body="&lt;p&gt;I need to implement an approximation to the inverse of $x^x$, i.e. the &lt;em&gt;square super-root&lt;/em&gt; (ssrt) function. For example, $\mathrm{ssrt}(2) \approx 1.56$ means that $1.56^{1.56} \approx 2$.  I'm not as interested in any particular accuracy/bit-depth as I am in understanding what my options are in contrast to more straightforward approaches using power series. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wolfram Alpha gives a nice &lt;a href=&quot;http://www.wolframalpha.com/input/?i=inverse%20x%5Ex&quot; rel=&quot;nofollow noreferrer&quot;&gt;symbolic solution&lt;/a&gt; in terms of the Lambert W function (i.e. $\ln(x)/W(\ln(x))$ ).  Wikipedia gives the &lt;a href=&quot;http://en.wikipedia.org/wiki/Tetration#Square_super-root&quot; rel=&quot;nofollow noreferrer&quot;&gt;same formula&lt;/a&gt;, as well as the equivalent $e^{W(\ln(x))}$. Given that there's a reasonable amount of information on computing $W(x)$ [1] [2], technically that's everything needed to implement &lt;em&gt;something&lt;/em&gt; for a variety of requirements.  I know of at least two books that go into extensive detail about approximating $\ln(x)$ [3] [4], so there's even plenty of room to optimize from that direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Have approximation techniques specific to this function been published anywhere?&lt;/li&gt;&#xA;&lt;li&gt;Does it go by another name besides &quot;square super-root&quot; that would make searching for references at a little easier?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Wikipedia/Google has turned up some references dedicated to more general &quot;tetration&quot; functions that include $\mathrm{ssrt}(x)$ as a special case, but most of them seem to be more geared to exploring/defining the general cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Corless, R.; Gonnet, G.; Hare, D.; Jeffrey, D.; Knuth, Donald (1996), &lt;em&gt;&quot;On the Lambert W function&quot;&lt;/em&gt; &lt;a href=&quot;http://www.apmaths.uwo.ca/~djeffrey/Offprints/W-adv-cm.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.apmaths.uwo.ca/~djeffrey/Offprints/W-adv-cm.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Digital Library of Mathematical Functions&lt;/em&gt;. &lt;a href=&quot;http://dlmf.nist.gov/4.13&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://dlmf.nist.gov/4.13&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Crenshaw, Jack W. (2000), &lt;em&gt;Math Toolkit for Real-Time Programming.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Hart, John F. (1978), &lt;em&gt;Computer Approximations.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Chapeau-Blondeau, F. and Monir, A. (2002). &lt;em&gt;Numerical evaluation of the Lambert W&#xA;function and application to generation of generalized Gaussian noise with exponent 1/2.&lt;/em&gt; IEEE&#xA;Transactions on Signal Processing 50, 2160-2165. &lt;a href=&quot;http://www.istia.univ-angers.fr/~chapeau/papers/lambertw.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.istia.univ-angers.fr/~chapeau/papers/lambertw.pdf&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;Minero, Paul. &lt;em&gt;Fast Approximate Lambert W&lt;/em&gt;. &lt;a href=&quot;http://www.machinedlearnings.com/2011/07/fast-approximate-lambert-w.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.machinedlearnings.com/2011/07/fast-approximate-lambert-w.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After doing some more research over the past few days, I still haven't found the kind of hands-on &quot;Crenshaw style&quot; $[3]$ treatment of $\mathrm{ssrt}(x)$ I was hoping for, but I did find a new reference worth documenting here.  On page three in $[5]$, there's a section titled &quot;Fast Approximation&quot; that goes into great detail about approximating $W(x)$ in the context of noise generation. As an interesting aside, the probability density of &quot;Gaussian noise with exponent 1/2&quot; [in the paper] looks strikingly similar to the histogram in &lt;a href=&quot;https://dsp.stackexchange.com/users/17/kellenjb&quot;&gt;Kellenjb&lt;/a&gt;'s answer to &lt;a href=&quot;https://dsp.stackexchange.com/questions/65/what-are-good-ways-to-detect-signal-clipping-in-a-recording&quot;&gt;this question about detecting signal clipping&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, the link given by &lt;a href=&quot;https://dsp.stackexchange.com/users/58/rwong&quot;&gt;rwong&lt;/a&gt; in the comments $[6]$ is a great resource for actually implementing $W(x)$, and it even links to the author's BSD licensed project called &lt;a href=&quot;http://code.google.com/p/fastapprox/&quot; rel=&quot;nofollow noreferrer&quot;&gt;fastapprox&lt;/a&gt;, which includes the implementation described.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="26573" LastEditDate="2018-09-24T22:46:11.763" LastActivityDate="2018-09-24T22:46:11.763" Title="What approximation techniques exist for the square super-root function?" Tags="|approximation|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="59" PostTypeId="5" CreationDate="2011-08-18T12:28:55.027" Score="0" Body="&lt;p&gt;HTK consists of a set of library modules and tools available in C source form. The tools provide facilities for speech analysis, HMM training, testing and results analysis. The software supports Hidden Markov Models using both continuous density mixture Gaussians and discrete distributions and can be used to build complex HMM systems. The HTK release contains extensive documentation and examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HTK was originally developed at the Machine Intelligence Laboratory of the Cambridge University Engineering Department.  In 1993 Entropic Research Laboratory Inc. acquired the rights to sell HTK and the development of HTK was fully transferred to Entropic in 1995 when the Entropic Cambridge Research Laboratory Ltd was established. HTK was sold by Entropic until 1999 when Microsoft bought Entropic. Microsoft has now licensed HTK back to CUED and is providing support so that CUED can redistribute HTK and provide development support via the HTK3 web site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While Microsoft retains the copyright to the original HTK code, everybody is encouraged to make changes to the source code and contribute them for inclusion in HTK3.&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="36" LastEditDate="2011-08-18T15:27:49.440" LastActivityDate="2011-08-18T15:27:49.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="60" PostTypeId="4" CreationDate="2011-08-18T12:28:55.027" Score="0" Body="The Hidden Markov Model Toolkit (HTK) is a portable toolkit for building and manipulating hidden Markov models. HTK is primarily used for speech recognition research although it has been used for numerous other applications including research into speech synthesis, character recognition and DNA sequencing." OwnerUserId="36" LastEditorUserId="36" LastEditDate="2011-08-18T15:27:51.937" LastActivityDate="2011-08-18T15:27:51.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="62" PostTypeId="1" AcceptedAnswerId="64" CreationDate="2011-08-18T13:14:38.277" Score="18" ViewCount="8262" Body="&lt;p&gt;I have a wireless communication system that I am simulating in Matlab. I am performing some watermarking through slightly adjusting the phase of the transmitted signal. My simulation takes the original I (inphase) and Q (quadrature) values and adds in the watermark. I then have to simulate the resulting bit error rate after being transmitted. For now I just need to add varying amounts of thermal noise to the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I have the signal represented as its I and Q channel it would be easiest to add &lt;a href=&quot;http://en.wikipedia.org/wiki/Additive_white_Gaussian_noise&quot; rel=&quot;nofollow&quot;&gt;AWGN&lt;/a&gt;(additive white Gaussian noise) to the I and Q directly. One thought was to add noise to both channels independently, but my intuition tells me that this isn't the same as adding it to the signal as a whole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can I add noise to it when it is in this form?&lt;/p&gt;&#xA;" OwnerUserId="17" LastEditorUserId="4682" LastEditDate="2013-07-06T01:59:01.917" LastActivityDate="2013-07-06T01:59:01.917" Title="How do I add AWGN to an I and Q representation of a signal?" Tags="|noise|gaussian|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="64" PostTypeId="2" ParentId="62" CreationDate="2011-08-18T14:21:59.227" Score="15" Body="&lt;p&gt;Yes, you can add AWGN of variance $\sigma^2$ separately to each of the two terms, because &lt;strong&gt;the sum of two Gaussians is also a Gaussian and their variances add up&lt;/strong&gt;. This will have the same effect as adding an AWGN of variance $2\sigma^2$ to the original signal. Here's some more explanation if you're interested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An analytic signal $x(t)=a(t)\sin\left(2\pi f t + \varphi(t)\right)$ can be written in its in-phase and quadrature components as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=I(t)\sin(2\pi ft) + Q(t)\cos(2\pi ft)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $I(t)=a(t)\cos(\varphi(t))$ and $Q(t)=a(t)\sin(\varphi(t))$. If you wish to add AWGN to your original signal as $x(t)+u(t)$, where $u(t)\sim\mathcal{N}(\mu,\sigma^2)$, then you can add AWGN to each of the terms as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_1(t)=\left[I(t)\sin(2\pi ft) + v(t)\right] + \left[Q(t)\cos(2\pi ft) + w(t)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $v(t), w(t)\sim\mathcal{N}(\mu/2,\sigma^2/2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that because the in-phase and quadrature terms are additive, the AWGN can also be simply added to either of the two terms in the $IQ$ representation of $x(t)$ above. In otherwords,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_2=I(t)\sin(2\pi ft) + \left[Q(t)\cos(2\pi ft) + u(t)\right]$$&#xA;$$y_3=\left[I(t)\sin(2\pi ft) +u(t)\right]+ Q(t)\cos(2\pi ft)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;are statistically equivalent to $y_1$, although I prefer using $y_1$ because I don't have to keep track of which component has noise added to it.&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="77" LastEditDate="2011-08-18T15:10:25.833" LastActivityDate="2011-08-18T15:10:25.833" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="65" PostTypeId="1" AcceptedAnswerId="68" CreationDate="2011-08-18T19:37:44.083" Score="38" ViewCount="14818" Body="&lt;p&gt;Given a recording I need to detect whether any clipping has occurred. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I safely conclude there was clipping if any (one) sample reaches the maximum sample value, or should I look for a series of subsequent samples at the maximum level? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The recording may be taken from 16 or 24-bit A/D converters, and are converted to floating point values ranging from $-1...1$. If this conversion takes the form of a division by $2^{15}-1$ or $2^{23}-1$, then presumably the negative peaks can be somewhat lower than -1, and samples with the value -1 are not clipped?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously one can always create a signal specifically to defeat the clipping detection algorithm, but I'm looking at recordings of speech, music, sine waves or pink/white noise. &lt;/p&gt;&#xA;" OwnerUserId="108" LastEditorUserId="4682" LastEditDate="2013-07-06T01:59:37.840" LastActivityDate="2018-04-23T18:29:38.530" Title="What are good ways to detect signal clipping in a recording?" Tags="|audio|algorithms|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="66" PostTypeId="2" ParentId="65" CreationDate="2011-08-18T19:56:06.510" Score="9" Body="&lt;p&gt;A bit of this depends on the method of record. It sounds like you are using only 1 convertor, which simplifies things somewhat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should look for anything above some threshold, and specifically for more than one point next to each other. Typically, A/D convertors don't actually read to their max value unless you test it very exactly, so realize that the max value might be lower than seems possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given your parameters, I would look for consecutive signals above .98 or below -.98, with some tweaking to determine what the optimal threshold should be (I wouldn't bring it below .9). It might be wise to detect one at the max, and another close by over something like .8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason to ignore 1 specific measurement is that it is common for spikes to occur that have nothing to do with the signal at all. This will be reduced in the case that you are using one known good A/D convertor. It is likely that if you are using an array of detectors, or an image, that some of the detectors will be bad, potentially clipping frequently. &lt;/p&gt;&#xA;" OwnerUserId="88" LastActivityDate="2011-08-18T19:56:06.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="67" PostTypeId="2" ParentId="65" CreationDate="2011-08-18T20:51:31.090" Score="21" Body="&lt;p&gt;The simplest answer if you're dealing with short recordings is to listen to it and detect &quot;pops&quot; (short spiked sound) in the playback. However, a more robust solution is to analyze the frequency spectrum of the recording.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that when a signal gets clipped at some threshold, it locally resembles a square wave in the clipped regions. This introduces higher harmonics in the frequency spectrum which would not have been there originally. If your signal is bandlimited (most real world signals are) and you're sampling well above the Nyquist rate, then this stands out quite clear as day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a short example in MATLAB demonstrating this. Here, I create a bandlimited signal of 1s duration, sampled at 1000Hz, and then clip it to between &lt;code&gt;±0.8&lt;/code&gt; (see the top plot in the figure below)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time = 0:0.001:1;&#xA;cleanSignal = sin(2*pi*75*time).*chirp(time,50,1,200);&#xA;clippedSignal = min(abs(cleanSignal),0.8).*sign(cleanSignal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lAy2B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can clearly see that the frequency spectrum of the original, unclipped waveform is clean and goes to zero outside the bandwidth (bottom left), whereas in the clipped signal, there is a general minor distortion of the spectrum (expected if clipped) and most importantly, higher harmonics/spikes/non-zero contributions in the spectrum outside the bandwidth of the signal (bottom right).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might generally be a better approach, because detecting clipping by looking at the values is generally not accurate unless if you designed the equipment yourself and know precisely the value of the threshold.&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="77" LastEditDate="2011-08-19T03:42:42.827" LastActivityDate="2011-08-19T03:42:42.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="68" PostTypeId="2" ParentId="65" CreationDate="2011-08-18T21:46:52.123" Score="32" Body="&lt;p&gt;I was in the middle of typing an answer pretty much exactly like &lt;a href=&quot;https://dsp.stackexchange.com/questions/65/what-are-good-ways-to-detect-signal-clipping-in-a-recording/67#67&quot;&gt;Yoda's&lt;/a&gt;.  He's is probably the most reliable but, I'll proposed a different solution so you have some options.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you take a histogram of your signal, you will more than likely a bell or triangle like shape depending on the signal type. Clean signals will tend to follow this pattern. Many recording studios add a &quot;loudness&quot; effect that causes a little bump near the top, but it is still somewhat smooth looking. Here is an example from a real song from a major musician:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RuuU1.jpg&quot; alt=&quot;Histogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the histogram of signal that Yoda gives in his answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qxgXy.jpg&quot; alt=&quot;Histogram with no Clipping&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now the case of their being clipping:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3PA7G.jpg&quot; alt=&quot;Histogram with Clipping&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method can be fooled at times, but it is at least something to throw in your tool bag for situations that the FFT method doesn't seem to be working for you or is too many computations for your environment.&lt;/p&gt;&#xA;" OwnerUserId="17" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2011-10-11T19:46:43.397" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="69" PostTypeId="1" AcceptedAnswerId="70" CreationDate="2011-08-19T04:40:06.970" Score="146" ViewCount="177681" Body="&lt;p&gt;Everyone discusses the Fourier transform when discussing signal processing. Why is it so important to signal processing and what does it tell us about the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it only apply to digital signal processing or does it apply to analog signals as well?&lt;/p&gt;&#xA;" OwnerUserId="20" LastEditorUserId="77" LastEditDate="2011-08-25T17:29:50.803" LastActivityDate="2018-07-31T21:11:53.137" Title="Why is the Fourier transform so important?" Tags="|fourier-transform|" AnswerCount="8" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="70" PostTypeId="2" ParentId="69" CreationDate="2011-08-19T07:50:56.307" Score="162" Body="&lt;p&gt;This is quite a broad question and it indeed is quite hard to pinpoint &lt;em&gt;why exactly&lt;/em&gt; Fourier transforms are important in signal processing. The simplest, hand waving answer one can provide is that it is an &lt;em&gt;extremely&lt;/em&gt; powerful mathematical tool that allows you to view your signals in a different domain, inside which several difficult problems become very simple to analyze.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its ubiquity in nearly every field of engineering and physical sciences, all for different reasons, makes it all the more harder to narrow down a reason. I hope that looking at some of its properties which led to its widespread adoption along with some practical examples and a dash of history might help one to understand its importance.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;History:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;To understand the importance of the Fourier transform, it is important to step back a little and appreciate the power of the Fourier series put forth by Joseph Fourier. In a nut-shell, any periodic function $g(x)$ integrable on the domain $\mathcal{D}=[-\pi,\pi]$ can be written as an infinite sum of sines and cosines as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(x)=\sum_{k=-\infty}^{\infty}\tau_k e^{\jmath k x}$$&#xA;$$\tau_k=\frac{1}{2\pi}\int_{\mathcal{D}}g(x)e^{-\jmath k x}\ dx$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $e^{\imath\theta}=\cos(\theta)+\jmath\sin(\theta)$. &lt;em&gt;This idea that a function could be broken down into its constituent frequencies (i.e., into sines and cosines of all frequencies) was a powerful one and forms the backbone of the Fourier transform.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The Fourier transform:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform can be viewed as an extension of the above Fourier series to non-periodic functions. For completeness and for clarity, I'll define the Fourier transform here. If $x(t)$ is a continuous, integrable signal, then its Fourier transform, $X(f)$ is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f)=\int_{\mathbb{R}}x(t)e^{-\jmath 2\pi f t}\ dt,\quad \forall f\in\mathbb{R}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the inverse transform is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\int_{\mathbb{R}}X(f)e^{\jmath 2\pi f t}\ df,\quad \forall t\in\mathbb{R}$$&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Importance in signal processing:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;First and foremost, a Fourier transform of a signal tells you &lt;strong&gt;what frequencies are present in your signal and in what proportions&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Have you ever noticed that each of your phone's number buttons&#xA;  sounds different when you press during a call and that it sounds the same for every phone model? That's because they're each composed of two different sinusoids which can be used to uniquely identify the button. When you use your phone to punch in combinations to navigate a menu, the way that the other party knows what keys you pressed is by doing a Fourier transform of the input and looking at the frequencies present.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Apart from some very useful &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Basic_properties&quot;&gt;elementary properties&lt;/a&gt; which make the mathematics involved simple, some of the other reasons why it has such a widespread importance in signal processing are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The magnitude square of the Fourier transform, $\vert X(f)\vert^2$ instantly tells us how much power the signal $x(t)$ has at a particular frequency $f$. &lt;/li&gt;&#xA;&lt;li&gt;From Parseval's theorem (more generally Plancherel's theorem), we have &#xA;$$\int_\mathbb{R}\vert x(t)\vert^2\ dt = \int_\mathbb{R}\vert X(f)\vert^2\ df$$&#xA;which means that &lt;em&gt;the total energy in a signal across all time is equal to the total energy in the transform across all frequencies&lt;/em&gt;. Thus, the transform is energy preserving.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Convolutions in the time domain are equivalent to multiplications in the frequency domain, i.e., given two signals $x(t)$ and $y(t)$, then if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z(t)=x(t)\star y(t)$$&#xA;where $\star$ denotes convolution, then the Fourier transform of $z(t)$ is merely&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Z(f)=X(f)\cdot Y(f)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For discrete signals, with the development of efficient FFT algorithms, almost always, it is faster to implement a convolution operation in the frequency domain than in the time domain.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Similar to the convolution operation, cross-correlations are also easily implemented in the frequency domain as $Z(f)=X(f)^*Y(f)$, where $^*$ denotes complex conjugate.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By being able to split signals into their constituent frequencies, one can easily block out certain frequencies selectively by nullifying their contributions.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; If you're a football (soccer) fan, you might've been&#xA;  annoyed at the constant drone of the vuvuzelas that pretty much&#xA;  drowned all the commentary during the 2010 world cup in South Africa.&#xA;  However, the vuvuzela has a constant pitch of ~235Hz which made it&#xA;  easy for broadcasters to implement a notch filter to cut-off the&#xA;  offending noise.&lt;sup&gt;&lt;a href=&quot;http://soccernet.espn.go.com/world-cup/story/_/id/5287552/ce/us/bbc-mulls-vuvuzela-free-option-viewers?cc=5901&amp;amp;ver=us&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A shifted (delayed) signal in the time domain manifests as a phase change in the frequency domain. While this falls under the elementary property category, this is a widely used property in practice, especially in imaging and tomography applications,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; When a wave travels through a heterogenous medium, it&#xA;  slows down and speeds up according to changes in the speed of wave&#xA;  propagation in the medium. So by observing a change in phase from&#xA;  what's expected and what's measured, one can infer the excess time&#xA;  delay which in turn tells you how much the wave speed has changed in&#xA;  the medium. This is of course, a very simplified layman explanation, but&#xA;  forms the basis for tomography.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Derivatives of signals (n&lt;sup&gt;th&lt;/sup&gt; derivatives too) can be &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Tables_of_important_Fourier_transforms&quot;&gt;easily calculated&lt;/a&gt;(see 106) using Fourier transforms.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h3&gt;Digital signal processing (DSP) vs. Analog signal processing (ASP)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The theory of Fourier transforms is applicable irrespective of whether the signal is continuous or discrete, as long as it is &quot;nice&quot; and absolutely integrable. So yes, ASP uses Fourier transforms as long as the signals satisfy this criterion. However, it is perhaps more common to talk about Laplace transforms, which is a generalized Fourier transform, in ASP. The Laplace transform is defined as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(s)=\int_{0}^{\infty}x(t)e^{-st}\ dt,\quad \forall s\in\mathbb{C}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The advantage is that one is not necessarily confined to &quot;nice signals&quot; as in the Fourier transform, but the transform is valid only within a certain region of convergence. It is widely used in studying/analyzing/designing LC/RC/LCR circuits, which in turn are used in radios/electric guitars, wah-wah pedals, etc.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is pretty much all I could think of right now, but do note that &lt;em&gt;no amount&lt;/em&gt; of writing/explanation can fully capture the true importance of Fourier transforms in signal processing and in science/engineering&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="77" LastEditDate="2011-09-20T14:40:15.163" LastActivityDate="2011-09-20T14:40:15.163" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="71" PostTypeId="1" AcceptedAnswerId="73" CreationDate="2011-08-19T10:03:31.170" Score="17" ViewCount="3219" Body="&lt;p&gt;In Image/Signal processing context we have seen/we know that if there are say 4 samples and if we take an average of those 4 samples, then we say that the result sample is a low pass filtered output sample. This is very relevant in Image processing context. Now then, what is the operation which implies a high pass filtering, is it finding some max of the 4 samples and putting that as the output sample, or what other mathematical operations implies high pass filtering as averaging implies low pass filtering.&lt;/p&gt;&#xA;" OwnerUserId="69" LastEditorUserId="88" LastEditDate="2011-08-19T13:20:52.673" LastActivityDate="2011-09-16T17:04:02.113" Title="What is the physical interpretation of Lowpass/Highpass filtering?" Tags="|lowpass-filter|highpass-filter|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="72" PostTypeId="2" ParentId="71" CreationDate="2011-08-19T12:02:08.267" Score="8" Body="&lt;p&gt;Firstly, an average is a very specific low-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;High-pass filtering means keeping fast-changes and discarding the &quot;gradual changes&quot;.  Differentiation is one classic mathematical way of doing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the discrete domain, if you convolve a signal vector with $(\begin{matrix} 1 &amp;amp; -1 \end{matrix})$ you see peaks wherever the signal changes quickly.  This is a high-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;High-pass filtering is also called &quot;edge-detection&quot; in image processing circles.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2011-08-19T12:31:01.220" LastActivityDate="2011-08-19T12:31:01.220" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="73" PostTypeId="2" ParentId="71" CreationDate="2011-08-19T12:04:50.753" Score="13" Body="&lt;p&gt;The example you gave of taking 4 samples and taking the average of it is sort of a poor-man's low-pass filter. Generally things aren't as simple as that. But for understanding sake there is some value in using these simple examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A low pass filter is indeed like taking 4 samples and taking an average of it. Ex:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;samples = [6 1 -10 -4];&#xA;avg_value = mean(samples) = -1.75&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The high pass filter is removing the &quot;DC&quot; term. Or more generally, it is removing the data that isn't changing. A simple way of thinking of this is to subtract your avg_value from every sample. Ex:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;samples = [6 1 -10 -4];&#xA;avg_value = mean(samples) = -1.75;&#xA;high_pass = samples-avg_value;&#xA;high_pass: [7.75 2.75 -8.25 -2.25]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now if you take the average of the &quot;high passed&quot; signal you end up getting 0.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;These two 'filters' that I mention are both to the extreme in that you have one filter that only gives you DC and another filter that only removes DC. Basically what you end up getting is this ideal filter where the low-pass filter gives you the green and the high pass filter gives you the yellow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YucTv.jpg&quot; alt=&quot;ideal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the filters you will use will have a response that looks more like this for a low pass:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U32QQ.jpg&quot; alt=&quot;low pass&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this for a high pass:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J7yXN.jpg&quot; alt=&quot;high pass&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="17" LastEditorUserId="17" LastEditDate="2011-08-19T12:47:27.610" LastActivityDate="2011-08-19T12:47:27.610" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="74" PostTypeId="1" AcceptedAnswerId="86" CreationDate="2011-08-19T13:19:25.280" Score="35" ViewCount="5485" Body="&lt;p&gt;I've learned about a number of edge detection algorithms, including algorithms like Sobel, Laplacian, and Canny methods. It seems to me the most popular edge detector is a Canny edge detector, but is there cases where this isn't the optimal algorithm to use? How can I decide which algorithm to use? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="88" LastEditorUserId="15347" LastEditDate="2019-10-10T08:17:42.187" LastActivityDate="2019-10-10T08:17:42.187" Title="What factors should I consider in choosing an edge detection algorithm?" Tags="|algorithms|image-processing|edge-detection|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="75" PostTypeId="1" AcceptedAnswerId="76" CreationDate="2011-08-19T13:29:03.667" Score="22" ViewCount="4069" Body="&lt;p&gt;I can't think of a better way for asking this question so I will start with an example. Suppose that I have an input signal with a max frequency of 50Hz (sampled at 100Hz). Now the signals of interest lie in the range 0-5Hz, so I can add a low-pass filter with a cut-off of 5Hz, and use the resulting signal for further processing. My understanding is that now I can downsample the filtered signal by a factor of 10 and hence reduce processing load. Am I right?&#xA;If yes, why is downsampling not ALWAYS performed after filtering because it seems to me as the obvious way to go?&#xA;And if I am wrong in my assumption, where am I mistaken?&lt;/p&gt;&#xA;" OwnerUserId="73" LastEditorUserId="25" LastEditDate="2011-08-19T15:52:57.363" LastActivityDate="2011-09-20T15:37:27.237" Title="Why would I leave a signal oversampled?" Tags="|filters|decimation|downsampling|sampling|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="76" PostTypeId="2" ParentId="75" CreationDate="2011-08-19T13:50:01.013" Score="18" Body="&lt;p&gt;You are correct that if your signal is bandlimited to &amp;lt;5 Hz, then you can perfectly represent it with a 10Hz sampling rate.  This is the well-known &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot;&gt;sampling theorem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;But&lt;/em&gt;&lt;/strong&gt; ... there may be practical considerations for why one would not be able and/or inclined to use critically sampled data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One reason is the difficulty of making a signal critically sampled. Any operation you perform to change the rate of the signal is going to have some filter with a non-zero transition bandwidth.  In your example, this limits the unaliased frequency content to 5-ftrans  This transition bandwidth can be made very narrow with long impulse response filters but this has costs both in terms of processing and in transients (ringing) at signal start and end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another reason is the efficacy of algorithms that work on the resulting signal. If you need to work with a blackbox component that can only choose the nearest sample, then you'll be better off feeding it oversampled data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most (all?) non-linear operations will behave differently with critically sampled vs oversampled data.  One example is squaring a signal, a well known method of BPSK carrier recovery. Without a 2x oversampled condition, the multiplication of the time domain signal with itself causes wraparound garbage aliasing when the frequency domain convolves with itself.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2011-08-19T18:23:35.953" LastActivityDate="2011-08-19T18:23:35.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="77" PostTypeId="2" ParentId="75" CreationDate="2011-08-19T15:05:19.327" Score="2" Body="&lt;p&gt;There are a number of factors to consider when determining a sampling rate. Let me list some of them, to give you an idea of what other consequences might occur if you lowered the sampling rate. Of course, much of this depends on exactly how you lower the sampling rate, but...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Nyquist Frequency: One cannot detect frequencies more than the Nyquist, which is half of the detection rate, at least, using typical processing methods. There are methods which involve filtering signals prior to A/D conversion to those within a Nyquist band. &lt;/li&gt;&#xA;&lt;li&gt;Detections of frequencies near the Nyquist can potentially be difficult, and subject to error. Note, this is typically only for those really close the the band. In this example, limiting the range to 12Hz (6 Hz Nyquist) would more than adequately address any concerns related to this.&lt;/li&gt;&#xA;&lt;li&gt;High frequency components tend to be reduced in strength compared to lower frequency. This basically occurs because sampling theory assumes a comb function, ie, detections in an instant of time evenly spaced. The truth is, all signals are measured over some small window of time. The effect of this is to convolve a rectangle in the time domain, or multiply by a sinc signal in the frequency domain. Of course, if you simply take every 10th signal (As opposed to using a longer sample time), this affect will be mitigated.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To illustrate some of these principals, I have written a simple matlab program, which I will show the output to as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pis=linspace(0,2*pi,2048);&#xA;for f=1:512&#xA;sig=cos(f*pis+pi/2);&#xA;sig_average=filter(ones(16,1),1/16,sig);&#xA;sam_sig=sig_average(1:16:end);&#xA;freq=abs(fft(sam_sig));&#xA;freqs(f)=max(freq);&#xA;end&#xA;figure;plot((1:512)/64,freqs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SVr3f.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="88" LastEditorUserId="88" LastEditDate="2011-08-19T17:30:08.683" LastActivityDate="2011-08-19T17:30:08.683" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="78" PostTypeId="2" ParentId="74" CreationDate="2011-08-19T15:42:56.343" Score="18" Body="&lt;p&gt;While Sobel and Laplacian are simply filters, Canny goes further than that in&#xA;two ways. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, it does &lt;em&gt;non-maximum suppression&lt;/em&gt; which gets rid of noise produced by all sorts of objects and color gradients in an image. Secondly, it actually includes a step that allows you to discern between different edge directions and to fill missing points of a line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, Canny edge detector is in a completely different class from Sobel and Laplacian. It's much smarter in that it includes a whole bunch of post processing whereas Sobel and Laplacian are simply high pass filter outputs followed by linear binary thresholding.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-03-28T15:42:10.697" LastActivityDate="2012-03-28T15:42:10.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="79" PostTypeId="1" AcceptedAnswerId="82" CreationDate="2011-08-19T17:16:54.920" Score="29" ViewCount="11273" Body="&lt;p&gt;What exactly is meant by &quot;stochastic sampling&quot; and is it profoundly different from the regular &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot;&gt;Nyquist-Shannon sampling theorem&lt;/a&gt;? Is it related to sampling a stochastic process?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="77" LastEditDate="2011-08-23T18:09:52.787" LastActivityDate="2011-08-23T18:09:52.787" Title="What is meant by &quot;stochastic sampling&quot;?" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="80" PostTypeId="1" AcceptedAnswerId="94" CreationDate="2011-08-19T19:11:19.997" Score="19" ViewCount="5415" Body="&lt;p&gt;What are the proper steps for preprocessing my waveforms in order to perform an &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot;&gt;independent component analysis&lt;/a&gt; (ICA) later? I understand the how, though further explanation of that doesn't hurt, but I'm more interested in the why.&lt;/p&gt;&#xA;" OwnerUserId="76" LastEditorUserId="77" LastEditDate="2011-09-07T05:23:22.823" LastActivityDate="2014-03-29T06:43:43.673" Title="What are the proper pre-processing steps to perform Independent Component Analysis?" Tags="|preprocessing|ica|" AnswerCount="1" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="82" PostTypeId="2" ParentId="79" CreationDate="2011-08-20T02:17:57.160" Score="33" Body="&lt;p&gt;Stochastic sampling doesn't have anything to do with sampling stochastic waveforms. It simply means that instead of sampling at regular intervals, the waveform is sampled randomly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that in a sampling scheme per the Nyquist-Shannon sampling theorem, a continuous signal $x(t)$ on $\mathbb{R}$ is sampled as $x[n]=x(nT),\ n\in\mathbb{Z}$, where $T$ is the sampling interval and $f_s=1/T$ is the sampling frequency. If the maximum frequency in the signal is $f_{max}$, then $f_s$ must be such that $f_s\geq 2f_{max}$ so as to avoid aliasing. For ease of comparison with stochastic sampling later on in the answer, let me redefine the sampling in a slightly different form than usual as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;s(t)&amp;amp;=\sum_{n=0}^{f_s\tau -1}\delta(t-nT)\\&#xA;x[n]&amp;amp;=x(t)\cdot s(t)&#xA;\end{align}&#xA;$$&#xA;where $\delta(t)$ is the Dirac delta function and $x(t)$ is only sampled on the interval $[0,\tau]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you actually think about it, regular sampling is pretty limiting in practice. Aliasing crops up in several places, and probably a well known and visible effect is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Moir%C3%A9_pattern&quot; rel=&quot;noreferrer&quot;&gt;Moiré patterns&lt;/a&gt; which can be reproduced at home by taking a photo of regular patterns displayed on a television (examples below). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D9Xxl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is always a problem with cameras, but never with your eyes if you were to see the pattern directly! The reason is because the photoreceptors in your retina are not laid out in a regular pattern unlike the CCD in a camera. The idea behind (not necessarily the idea that led to its development) stochastic sampling is very similar to the non-regular layout of photoreceptors in the eye. It is an anti-aliasing technique which works by breaking up the regularity in the sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In stochastic sampling, every point in the signal has a non-zero probability of being sampled (unlike regular sampling where certain sections will &lt;em&gt;never&lt;/em&gt; be sampled). A simple uniform stochastic sampling scheme can be implemented over the same interval $[0,\tau]$ as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;s(t)&amp;amp;=\sum_{n=0}^{f_s \tau -1}\delta(t-t_n),\quad t_n\sim \mathcal{U}(0,\tau)\\&#xA;x[n]&amp;amp;=x(t)\cdot s(t)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathcal{U}(0,\tau)$ is the uniform distribution on the interval $[0,\tau]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By sampling stochastically, there is no &quot;Nyquist frequency&quot; to talk about, so aliasing will no longer be a problem as before. However, this comes at a price. What you gain in anti-aliasing, you lose by noise in the system. The stochastic sampling introduces high-frequency noise, although for several applications (especially in imaging), aliasing is a much stronger nuisance than noise (e.g., you can see the Moiré patterns easily in the above images, but to a lesser extent the speckle noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, stochastic sampling schemes are almost always used in spatial sampling (in image processing, computer graphics, array processing, etc.) and sampling in the time domain is still predominantly regular (I'm not sure if people even bother with stochastic sampling in the time domain). There are several different stochastic sampling schemes such as Poisson sampling, jittered sampling, etc., which you can look up if you're interested. For a general, low key introduction to the topic, see &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;M. A. Z. Dippé and E. H. Wold, &lt;em&gt;&quot;Antialiasing Through Stochastic Sampling&quot;&lt;/em&gt;, SIGGRAPH, Vol. 19, No. 5, pp. 69-78, 1985.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-08-20T02:17:57.160" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="83" PostTypeId="2" ParentId="75" CreationDate="2011-08-20T03:13:13.900" Score="2" Body="&lt;p&gt;The Nyquist criterion (oversample twofold to perfectly describe your signal) applies to noise-free data. If you want to reconstruct noisy data, you need to sample with higher than the minimum frequency. This is especially true in the case of images, where you don't usually have periodic signals, and where you thus cannot simply time-average to reduce the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, if you want to fit a model to your data, you benefit again from higher sampling, since fitting a model into three datapoints won't be particularly stable, especially in the presence of noise. &lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="59" LastEditDate="2011-08-21T18:45:47.717" LastActivityDate="2011-08-21T18:45:47.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="84" PostTypeId="2" ParentId="74" CreationDate="2011-08-20T03:19:49.600" Score="9" Body="&lt;p&gt;The two most important decisions when trying to detect edges are, to me usually:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Can I segment the objects instead, and then use a morphological operator to find the edge of the binary (segmented) image? With noisy data, this tends to be more robust.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What edge-preserving smoothing filter should I use to reduce image noise? Edge filters are based on differencing, which will suffer with noisy data. The simplest choice is the median filter, but anisotropic diffusion or nonlocal means filters will offer better performance at the cost of having more parameters to tweak.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For edge detection itself, I can't think for a good reason not to use Canny.&lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2011-08-20T03:19:49.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="85" PostTypeId="1" AcceptedAnswerId="87" CreationDate="2011-08-20T09:49:34.563" Score="18" ViewCount="2848" Body="&lt;p&gt;One of the standard ways to implement a Butterworth filter is with a cascade of second-order sections, each corresponding to a pair of complex-conjugate poles.  For a fourth-order filter, for example, there would be two second-order sections.  If we consider how the pole locations for a lowpass filter change in the z-plane as the cutoff is designed for near 0hz to near Nyquist, the path &quot;swept out&quot; by each pair of poles corresponds to a pair of arcs inside the unit circle, as illustrated by the following figure [for fourth-order filters]:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NjRBb.png&quot; alt=&quot;Z-plane Pole Positions for Fourth-Order Butterworth Lowpass Filters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given how long these filters have been around, and given the fact these &quot;arcs&quot; correspond to straight lines in the s-plane, it stands to reason that someone would have developed an implementation form with a single parameter which is able to sweep the poles along the arcs at &quot;run time&quot; [as opposed to &quot;design time&quot;].  However, I haven't come across anything like that yet.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's relatively straightforward to come up with various ways of doing this, especially within segments of the range, and with a willingness to throw a little extra computation at it.  What I'm wondering is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there some standard way of implementing a tunable [digital] Butterworth filter of a given order that 1) has optimal properties (e.g. efficiency, robustness), and 2) covers the entire range?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is this really just such an easy problem that nobody bothers to talk about it?  If that's the case, it seems like it would show up in filter design programs next to the options for &quot;static&quot; designs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did find this: &lt;a href=&quot;http://books.google.com/books?id=QUKIOgAACAAJ&amp;amp;dq=%22A%20multiple%20purpose%20Butterworth%20filter%20with%20variable%20cutoff%20frequency%22&amp;amp;hl=en&amp;amp;ei=g3ZPTtI-5uHRAfrUkeUG&amp;amp;sa=X&amp;amp;oi=book_result&amp;amp;ct=result&amp;amp;resnum=1&amp;amp;ved=0CCoQ6AEwAA&quot; rel=&quot;noreferrer&quot;&gt;A multiple purpose Butterworth filter with variable cutoff frequency&lt;/a&gt;, but at first &lt;a href=&quot;http://www.google.com/search?dq=%22A%20multiple%20purpose%20Butterworth%20filter%20with%20variable%20cutoff%20frequency%22&amp;amp;hl=en&amp;amp;resnum=1&amp;amp;q=%22A%20multiple%20purpose%20Butterworth%20filter%20with%20variable%20cutoff%20frequency%22&amp;amp;sa=N&amp;amp;tab=pw&quot; rel=&quot;noreferrer&quot;&gt;Googling&lt;/a&gt; there doesn't seem to be much information about what's in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update (re: answers)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to be a little more clear:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'm looking for a &quot;meta-design&quot; with a parameter (say from [0,1]) that will automatically adjust the cutoff from DC to Nyquist (while keeping the gain normalized) for use in a time-varying system.  Something like &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Time_Varying_Two_Pole_Filters.html&quot; rel=&quot;noreferrer&quot;&gt;this two-pole resonator&lt;/a&gt;, except with Butterworth constraints.  The idea is that calculating the parameter would be more efficient than going through the typical offline design procedure at runtime.&lt;/li&gt;&#xA;&lt;li&gt;I'm not necessarily even looking for &lt;em&gt;how&lt;/em&gt; to design a &quot;meta-filter&quot; (i.e. do the math with variables instead of numbers), I'm wondering whether there are choices for standard [non-obvious] implementation forms--because, say, the straightforward approach that corresponds to the static case ends up having numerical issues in the time-varying case.&lt;/li&gt;&#xA;&lt;li&gt;Maybe there are no issues, and the straightforward approach is what's used in practice. That would be great. My concern is that I haven't seen this topic mentioned explicitly in any of the sources I've consulted, but maybe I just missed something really obvious, so I'm asking.&lt;/li&gt;&#xA;&lt;li&gt;In the process of adding more detail here, I ran across a &lt;a href=&quot;http://www.citeulike.org/user/blloyd00/article/7085987&quot; rel=&quot;noreferrer&quot;&gt;general treatment&lt;/a&gt; of parametric biquad structures, which is almost what I'm looking for (and has some nice references).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for answers like the one I put in my second comment to Jason R, as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Oh yeah, you want to use parametrization III-2b from so-and-so's&#xA;  thesis, in tapped state lattice form because it resolves such-and-such&#xA;  edge case while using the minimal number of multiplies.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Maybe nothing like that exists, but my question is whether it does, and if so, what is it, or where can I find it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Jackpot&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on a reference to &quot;observer canonical form&quot; given by Tim Wescott in the &lt;a href=&quot;http://groups.google.com/group/comp.dsp/browse_thread/thread/ae91ea02e19ee382/af3375b26b890e54?pli=1&quot; rel=&quot;noreferrer&quot;&gt;comp.dsp thread in Jason R's answer&lt;/a&gt;, I decided to assume that I might have to start digging around in the control systems literature, so I tried doing a search for &lt;a href=&quot;http://www.google.com/search?q=butterworth%20%22state%20space%22&quot; rel=&quot;noreferrer&quot;&gt;butterworth &quot;state space&quot;&lt;/a&gt;, and it turned up the following, very cool, treatment of designing/implementing, not only parametric Butterworth, but also Chebyshev and Elliptic filters:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Sophocles J. Orfanidis, &quot;High-Order Digital Parametric Equalizer&#xA;  Design,&quot; J. Audio Eng. Soc., vol. 53, pp. 1026-1046, Nov. 2005.&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Paper: &lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/ece348/hpeq.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://www.ece.rutgers.edu/~orfanidi/ece348/hpeq.pdf&lt;/a&gt;  &lt;/li&gt;&#xA;  &lt;li&gt;Matlab Toolbox: &lt;a href=&quot;http://eceweb1.rutgers.edu/~orfanidi/hpeq/&quot; rel=&quot;noreferrer&quot;&gt;http://eceweb1.rutgers.edu/~orfanidi/hpeq/&lt;/a&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's going to take a little while to dig into, but based on what I've read so far, I'd be very surprised if it's not what I'm looking for.  I'm giving this one to Jason R for the comp.dsp reference that led me to the Orfanidis paper. His answer is also a nice practical overview of designing Butterworth filters as well.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="77" LastEditDate="2011-09-01T16:23:53.923" LastActivityDate="2012-08-24T23:29:21.477" Title="Are there any standard implementation forms for tunable Butterworth filters?" Tags="|filters|software-implementation|infinite-impulse-response|hardware-implementation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="86" PostTypeId="2" ParentId="74" CreationDate="2011-08-20T13:59:41.247" Score="29" Body="&lt;p&gt;There are lots of edge detection possibilities, but the 3 examples you mention happen to fall in 3 distinct categories.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;noreferrer&quot;&gt;Sobel&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This approximates a first order derivative. Gives extrema at the gradient positions, 0 where no gradient is present. In 1D, it is = $\left[ \begin{array}{ccc} -1 &amp;amp; 0 &amp;amp; 1 \end{array} \right]$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;smooth edge =&gt; local minimum or maximum, depending on the signal going up or down.&lt;/li&gt;&#xA;&lt;li&gt;1 pixel line =&gt; 0 at the line itself, with local extrema (of different sign) right next to it. In 1D, it is = $\left[ \begin{array}{ccc} 1 &amp;amp; -2 &amp;amp; 1 \end{array} \right]$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are other alternatives to Sobel, which have +/- the same characteristics. On the &lt;a href=&quot;http://en.wikipedia.org/wiki/Roberts_Cross&quot; rel=&quot;noreferrer&quot;&gt;Roberts Cross&lt;/a&gt; page on wikipedia you can find a comparison of a few of them.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Laplace_operator&quot; rel=&quot;noreferrer&quot;&gt;Laplace&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This approximates a second order derivative. Gives 0 at the gradient positions and also 0 where no gradient is present. It gives extrema where a (longer) gradient starts or stops.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;smooth edge =&gt; 0 along the edge, local extrema at the start/stop of the edge.&lt;/li&gt;&#xA;&lt;li&gt;1 pixel line =&gt; a &quot;double&quot; extremum at the line, with &quot;normal&quot; extrema with a different sign right next to it&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The effect of these 2 on different types of edges can be best viewed visually:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yaId3.png&quot; alt=&quot;Comparison of Sobel vs Laplace&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Canny_edge_detector&quot; rel=&quot;noreferrer&quot;&gt;Canny&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is not a simple operator, but is a multi-step approach, which uses Sobel as one of the steps. Where Sobel and Laplace give you a grayscale / floating point result, which you need to threshold yourself, the Canny algorithm has smart thresholding as one of its steps, so you just get a binary yes/no result. Also, on a smooth edge, you will likely find just 1 line somewhere in the middle of the gradient.&lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="80" LastEditDate="2011-09-04T23:49:54.433" LastActivityDate="2011-09-04T23:49:54.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="87" PostTypeId="2" ParentId="85" CreationDate="2011-08-21T14:36:01.613" Score="10" Body="&lt;p&gt;I'm not sure exactly what you're looking for. As you noted in your question, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter#Transfer_function&quot; rel=&quot;noreferrer&quot;&gt;transfer functions of the Butterworth filter family&lt;/a&gt; are well-understood and easily calculated analytically. It is pretty simple to implement a Butterworth filter structure that is tunable by filter order and cutoff frequency:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Based on the selected filter order, cutoff frequency, and sample rate, calculate the pole locations for the Butterworth analog prototype filter. Since Butterworth filters have no zeros, the transfer function is determined by the pole locations (and the DC gain).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;noreferrer&quot;&gt;bilinear transform&lt;/a&gt;, map the pole locations of the analog prototype to their corresponding locations in your digital realization of the filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Again, the digital filter is defined by the pole locations found in step 2. Break the filter into &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_biquad_filter&quot; rel=&quot;noreferrer&quot;&gt;second-order sections&lt;/a&gt; by grouping the poles in pairs.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's it. As I said, it's straightforward to programmatically design a Butterworth filter using whatever parameters you might need; none of the operations are terribly complicated to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I'm not really sure what end result you're looking for. I think you're instead most interested in how to implement IIR filters with time-varying coefficients, not necessarily specific to a Butterworth filter. I assume your goal is to minimize artifacts when changing the filter cutoff frequency; this was covered in a &lt;a href=&quot;http://groups.google.com/group/comp.dsp/browse_thread/thread/ae91ea02e19ee382/af3375b26b890e54&quot; rel=&quot;noreferrer&quot;&gt;discussion on the comp.dsp newsgroup&lt;/a&gt; earlier this year. While I'm not sure what your use case or requirements are for this filter structure, there are a number of ways to accomplish the switching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you said you would like your filter to have a single parameter that defines the cutoff frequency, but the fact remains that your tunable structure must have a way to translate the cutoff frequency to the required coefficients (or in the Butterworth case, just the pole locations). The process I described above is appropriate for generating the pole locations based on the desired normalized sample rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could potentially simplify the pole-location-calculation process by analyzing the geometry of the digital filter's pole locations in the z-plane. The analog Butterworth filter has poles that lie in a semicircle in the left half of the s-plane; the bilinear transform maps this semicircle into the elliptic-looking pattern that you illustrated in your question description. Using this known pattern to the analog Butterworth filter's poles, the mapping function of the bilinear transform, and some algebra, you may be able to come up with a relatively simple expression for the digital filter's pole locations, thus giving you more straightforward-looking filter tuning action.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-08-22T03:43:24.927" LastActivityDate="2011-08-22T03:43:24.927" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="88" PostTypeId="1" AcceptedAnswerId="212" CreationDate="2011-08-21T16:11:48.457" Score="21" ViewCount="9749" Body="&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt; Often times I am doing some sort of signal processing task that requires a unique filter. Usually at this point I go to MATLAB and generate a new unique filter using &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/firpm.html&quot; rel=&quot;nofollow&quot;&gt;$\tt firpm()$&lt;/a&gt;. The MATLAB &lt;code&gt;firpm()&lt;/code&gt; function implements that Parks-McClellan algorithm. Now I have a filter and I put the filter into a hardcoded array. But here's the problem I now have a hardcoded filter that only works for one scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt; I can now solve my signal processing problem du-jour... but only for a very SPECIFIC single sample rate or SPECIFIC scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The goal:&lt;/strong&gt; I want to be able to call &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/firpm.html&quot; rel=&quot;nofollow&quot;&gt;$\tt firpm()$&lt;/a&gt; from C code or some other language and make my signal processing code more generic. I can't find an open source implementation of &lt;code&gt;firpm()&lt;/code&gt; !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where can I get an open source implementation of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm&quot; rel=&quot;nofollow&quot;&gt;Parks-McClellan optimal FIR filter design algorithm&lt;/a&gt; (aka &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/firpm.html&quot; rel=&quot;nofollow&quot;&gt;$\tt firpm()$&lt;/a&gt; in MATLAB)?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;P.S.&lt;/strong&gt; I am aware that I can design filters differently using windowing or something else... feel free to mention those in the comments. But the point of this question is not to ask &quot;what are other filter design techniques?&quot; the point is to find an open source implementation of the VERY VERY useful &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/firpm.html&quot; rel=&quot;nofollow&quot;&gt;$\tt firpm()$&lt;/a&gt;... or something similar.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;P.P.S.&lt;/strong&gt; One of the goals of this question is to learn how the Parks-McClellan algorithm works by looking at the code first and then I plan on reading some background theory.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="151" LastEditorUserId="21075" LastEditDate="2020-04-30T13:34:42.697" LastActivityDate="2020-04-30T13:34:42.697" Title="Where can I get an open source implementation of the Parks-McClellan optimal FIR filter design algorithm?" Tags="|filters|filter-design|finite-impulse-response|software-implementation|parks-mclellan|" AnswerCount="7" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="90" PostTypeId="2" ParentId="6" CreationDate="2011-08-21T16:48:37.947" Score="2" Body="&lt;p&gt;Theoretically it is possible. Practically... it seems like a difficult problem that would require very high resolution stero cameras and figuring out some math equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, you will need to come up with at the very least a math equation to figure out what is the minimum resolution stereo camera you need. Then you will need to figure out what kind of ranging algorithm you need and how good a quality metric is needed so that you are measuring what you calculate you measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But bottom line is that theoretically it is possible to measure sub-milimeter ranging using stereo camers... this is more of a &quot;engineering&quot; problem to try and get it working.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="151" LastActivityDate="2011-08-21T16:48:37.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="92" PostTypeId="2" ParentId="88" CreationDate="2011-08-21T18:23:47.163" Score="11" Body="&lt;p&gt;There is an open-source implementation of Parks-McClellan (also known as the Remez exchange algorithm) in GNU Octave, a free-software implementation of a MATLAB-like environment. The function, called &quot;remez&quot;, is contained in the &lt;a href=&quot;http://octave.sourceforge.net/signal/index.html&quot;&gt;&quot;signal&quot; package&lt;/a&gt;, which is hosted at &lt;a href=&quot;http://octave.sourceforge.net/&quot;&gt;Octave-Forge&lt;/a&gt;. If you download the package, you'll find &quot;remez.cc&quot;, a C++ implementation of the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One nice thing about Octave is that it is almost code-compatible with MATLAB, so you can easily port code over to use there if you like. It's a good way to peek under the hood at implementations of algorithms that are provided in MEX form in MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-08-21T18:23:47.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="93" PostTypeId="1" AcceptedAnswerId="156" CreationDate="2011-08-22T18:16:16.237" Score="17" ViewCount="2567" Body="&lt;p&gt;From what I understand, the DCT has half the bin size as a DFT of the same size N.  The DFT also includes phase information, but often this is not needed when only the magnitude spectrum is desired.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Could the DCT be used to provide a magnitude spectrum with twice the density (half the bin spacing) of the DFT or would out of phase information be lost?  &lt;/li&gt;&#xA;&lt;li&gt;How about with a 50% overlap?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="153" LastEditorUserId="1629" LastEditDate="2016-09-08T18:58:11.573" LastActivityDate="2016-09-09T09:37:30.793" Title="Could a DCT be used for an audio magnitude spectrum rather than DFT?" Tags="|dct|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="94" PostTypeId="2" ParentId="80" CreationDate="2011-08-23T07:45:38.973" Score="16" Body="&lt;p&gt;Independent component analysis (ICA) is used to separate a &lt;strong&gt;linear&lt;/strong&gt; mixture of &lt;strong&gt;statistically independent&lt;/strong&gt; and most importantly, &lt;strong&gt;non-Gaussian&lt;/strong&gt;&lt;sup&gt;†&lt;/sup&gt; components into its constituents. The standard model for a noise-free ICA is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{x}=\mathbf{As}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{x}$ is the observation or data vector, $\mathbf{s}$ is a source signal/original components (non-Gaussian) and $\mathbf{A}$ is a transformation vector that defines the linear mixing of the constituent signals. Typically, $\mathbf{A}$ and $\mathbf{s}$ are unknown.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Pre-processing&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;There are two main pre-processing strategies in ICA, namely centering and whitening/sphering. The primary reasons for pre-processing are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Simplification of algorithms&lt;/li&gt;&#xA;&lt;li&gt;Reduction of dimensionality of the problem&lt;/li&gt;&#xA;&lt;li&gt;Reduction of number of parameters to be estimated.&lt;/li&gt;&#xA;&lt;li&gt;Highlighting features of the data set not readily explained by the mean and covariance.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From the introduction of G. Li and J. Zhang, &quot;Sphering and its properties&quot;, The Indian Journal of Statistics, Vol. 60, Series A, Part I, pp. 119-133, 1998:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Outliers, clusters or other kind&#xA;  of groups, and concentrations near curves or non-ﬂat surfaces are probably the&#xA;  important features that interest data analysts. They are, in general, not obtainable through mere knowledge of the sample mean and covariance matrix. In&#xA;  these circumstances, it is desirable to separate oﬀ the information contained in&#xA;  the mean and the covariance matrices and forces us to examine aspects of our&#xA;  data sets other than those well-understood natures. Centering and sphering is a simple and intuitive approach that eliminates the mean-covariance information&#xA;  and helps to highlight structures beyond linear correlation and elliptic shapes,&#xA;  and therefore is often performed before exploring displays or analyses of data&#xA;  sets&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Centering:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Centering is a very simple operation and simply refers to subtracting the mean $\mathbb{E}\{\mathbf{x}\}$. In practice, you use the sample mean and create a new vector $\mathbf{x}_c=\mathbf{x}-\overline{\mathbf{x}}$, where $\overline{\mathbf{x}}$ is the mean of the data. Geometrically, subtracting the mean is equivalent to &lt;em&gt;translating&lt;/em&gt; the center of coordinates to the origin. The mean can always be re-added to the result the end (this is possible because matrix multiplication is distributive).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Whitening:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whitening is a transformation that converts the data such that it has an identity covariance matrix, i.e., $\mathbb{E}\{\mathbf{x}_c\mathbf{x}_c^T\}=\mathbf{I}$. Normally, you work with the sample covariance matrix, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\widehat{\mathbf{\Sigma}}=C.\mathbf{x}_c\mathbf{x}_c^T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $C$ is just my lazy placeholder for the appropriate normalization factor (depending on the dimensions of $\mathbf{x}$). A new whitened vector is created as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{x}_w=\widehat{\mathbf{\Sigma}}^{-1/2}\mathbf{x}_c$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which will have a covariance of $\mathbf{I}$. Geometrically, whitening is a &lt;em&gt;scaling&lt;/em&gt; transformation. Here is a small example in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = RandomReal[{-1, 1}, {2000, 2}];&#xA;A = {{2, 3}, {4, 2}};&#xA;x = s.A;&#xA;whiteningMatrix = Inverse@CholeskyDecomposition[Transpose@x.x/Length@x];&#xA;y = x.whiteningMatrix;&#xA;FullGraphics@GraphicsRow[&#xA;  ListPlot[#, AspectRatio -&amp;gt; 1, Frame -&amp;gt; True] &amp;amp; /@ {s, x, y}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iVDO1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first plot is the joint density of two uniformly distributed random vectors, or the components $\mathbf{s}$. The second shows the effect of multiplying by a transformation vector $\mathbf{A}$. The square gets skewed and scaled into a rhombus. By multiplying with the whitening matrix, the joint density is back to a square which is slightly rotated from the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the whitening transformation, in the new system that is being solved, i.e. $\mathbf{x}_w=\mathbf{A}_w\mathbf{s}_w$, $\mathbf{A}_w$ is an orthogonal matrix. This can be easily shown:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;\mathbb{E}\{\mathbf{x}_w\mathbf{x}_w^T\}&amp;amp;=\mathbb{E}\{\mathbf{A}_w\mathbf{s}_w(\mathbf{A}_w\mathbf{s}_w)^T\}\\&#xA;&amp;amp;=\mathbf{A}_w\mathbb{E}\{\mathbf{s}_w\mathbf{s}_w^T\}\mathbf{A}_w^T\\&#xA;&amp;amp;=\mathbf{A}_w\mathbf{A}_w^T=\mathbf{I}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the last step follows because of the statistical independence of $\mathbf{s}_i$ The orthogonality condition means that there are only about half as many parameters that need to be estimated. (Note: Although this is true in this case and in my example, $\mathbf{A}$ need not be square to begin with).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, after the transformation, there are eigenvalues close to zero, then these can be safely discarded as they are just noise and will only hamper the estimation due to &quot;overlearning&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Other pre-processing&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There might be other pre-processing steps involved in certain specific applications that are impossible to cover in an answer. For example, I've seen a few articles which use the log of the time-series and a few others that filter the time-series. While it might be suited for their particular application/conditions, the results don't carry over to all fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;†&lt;/sup&gt;&lt;sub&gt;I believe it is possible to use ICA if &lt;em&gt;at most&lt;/em&gt; one of the components is Gaussian, although I can't find a reference for this right now.&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Why is it called &quot;sphering&quot;?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is probably well known, but just as a fun fact, sphering comes from the change in the structure of covariance matrices in the case of Gaussian components from an $n$-dimensional  hyper ellipsoid to an $n$-dimensional sphere due to whitening. Here's an example (use the same code as above, but replace &lt;code&gt;{-1,1}&lt;/code&gt; with &lt;code&gt;NormalDistribution[]&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kye8H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is the joint density for two uncorrelated Gaussians, the second under transformation and the third is after whitening. In practice only steps 2 and 3 are visible.&lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-08-23T07:45:38.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="95" PostTypeId="1" AcceptedAnswerId="98" CreationDate="2011-08-23T17:01:10.153" Score="12" ViewCount="3646" Body="&lt;p&gt;Huffman coding is a widely used method of &lt;a href=&quot;http://en.wikipedia.org/wiki/Entropy_encoding&quot; rel=&quot;nofollow&quot;&gt;entropy coding&lt;/a&gt; used for data compression. It assumes that we have complete knowledge of a signal's statistics. However, there are versions of Huffman coding that are used with streaming media and cannot possibly know everything about the signal's statistics. How do these &lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_Huffman_coding&quot; rel=&quot;nofollow&quot;&gt;adaptive Huffman encoders&lt;/a&gt; work?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="4682" LastEditDate="2013-07-06T01:58:47.257" LastActivityDate="2013-07-06T01:58:47.257" Title="How does adaptive Huffman coding work?" Tags="|compression|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="96" PostTypeId="1" AcceptedAnswerId="99" CreationDate="2011-08-23T21:29:23.900" Score="18" ViewCount="3448" Body="&lt;p&gt;Suppose we have a signal $n$ that consists of Gaussian white noise.  If we modulate this signal by multiplying it by $\sin 2\omega t$, the resulting signal still has a white power spectrum, but clearly the noise is now &quot;bunched&quot; in time.  This is an example of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Cyclostationary_process&quot; rel=&quot;nofollow noreferrer&quot;&gt;cyclostationary process&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = n(t) \sin2\omega t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that we now demodulate this signal at a frequency $\omega$ by mixing with sine and cosine local oscillators, forming I and Q signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I = x(t) \times \sin\omega t$$&#xA;$$Q = x(t) \times \cos\omega t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naively observing that the power spectrum of $x(t)$ (taken over a time interval much greater than $1/f$) is white, we would expect $I$ and $Q$ to both contain white Gaussian noise of the same amplitude.   However, what really happens is that the $I$ quadrature selectively samples the portions of the timeseries $x(t)$ with high variance, while $Q$, ninety degrees out of phase, samples the lower variance portions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Aq2yC.png&quot; alt=&quot;modulated noise depiction&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is that the noise spectral density in I is $\sqrt{3}$ times that of $Q$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly there must be something beyond the power spectrum that is useful in describing modulated noise.  The literature of my field has a number of accessible papers describing the above process, but I would like to learn how it is treated more generally by the signal processing / EE communities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are some useful mathematical tools for understanding and manipulating cyclostationary noise?&lt;/strong&gt;   Any references to literature would also be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Niebauer et al, &quot;Nonstationary shot noise and its effect on the sensitivity of interferometers&quot;. &lt;a href=&quot;http://en.wikipedia.org/wiki/Cyclostationary_process&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phys. Rev. A 43, 5022–5029&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="64" LastEditorUserId="23777" LastEditDate="2018-07-07T16:12:28.290" LastActivityDate="2018-07-07T16:12:28.290" Title="What mathematical tools exist for understanding modulated noise?" Tags="|noise|modulation|cyclostationary-random-process|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="97" PostTypeId="1" AcceptedAnswerId="100" CreationDate="2011-08-23T23:16:25.067" Score="5" ViewCount="420" Body="&lt;p&gt;Let's say that I have a 1 dimensional signal that has data which comes from one of 2 different spectral bands. The measurements come evenly mixed between the two bands. I'm interested in a method of extending the frequency calculation by combining information from both signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show an example, let's just say that I have a Red band and a Green Band. The detector arrays would look like this: &lt;code&gt;RGRGRGRGRG&lt;/code&gt;. Let's say that I had 512 R, and 512 G, just to give a concrete example. As the detectors are neighboring each other, and most signals have some component of red and green, it seems likely that a common frequency calculation could be made by combining the bands, and possibly double the frequency range which can be detected. How could I best go about doing this?&lt;/p&gt;&#xA;" OwnerUserId="88" LastActivityDate="2011-08-24T06:14:27.943" Title="How can I calculate the frequency using different color bands?" Tags="|frequency|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="98" PostTypeId="2" ParentId="95" CreationDate="2011-08-24T02:32:21.337" Score="8" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_Huffman_coding&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia article&lt;/a&gt; has a pretty good description of the adaptive Huffman coding process using one of the notable implementations, the Vitter algorithm. As you noted, a standard Huffman coder has access to the probability mass function of its input sequence, which it uses to construct efficient encodings for the most probable symbol values. In the prototypical example of file-based data compression, for example, this probability distribution can be calculated by histogramming the input sequence, counting the number of occurrences of each symbol value (symbols could be 1-byte sequences, for example). This histogram is used to generate a Huffman tree, like this one (taken from the Wikipedia article):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VBU2Z.png&quot; alt=&quot;Huffman tree example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tree is arranged by decreasing weight, or probability of occurrence in the input sequence; leaf nodes at the top represent the most probable symbols, which therefore receive the shortest representations in the compressed data stream. The tree is then saved along with the compressed data and is subsequently used by the decompressor later to regenerate the (uncompressed) input sequence again. As one of the early entropy code implementations, standard Huffman coding is fairly straightforward.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The adaptive Huffman coder's structure is quite similar; it uses a similar tree-based representation of the input sequence's statistics to select efficient encodings for each input symbol value. The main difference is that, as a streaming implementation of the algorithm, no &lt;em&gt;a priori&lt;/em&gt; knowledge of the input's probability mass function is available; the sequence's statistics must be estimated on the fly. If one is to use the same Huffman encoding scheme, this means that the tree used to generate each symbol's encoding in the compressed stream must be built and maintained dynamically as the input stream is processed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Vitter algorithm is one way of accomplishing this; as each input symbol is processed, the tree is updated, maintaining its characteristic of decreasing probability of symbol occurrence as you move down the tree. The algorithm defines a set of rules for how the tree is updated over time, and how the resulting compressed data is encoded in the output stream. As the input sequence is consumed, the tree's structure should represent a more and more accurate description of the input's probability distribution. In contrast to the standard Huffman coding approach, the decompressor does not have a static tree to use for decoding; it must perform the same tree-maintenance functions continuously during the decompression process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In summary&lt;/strong&gt;: The adaptive Huffman coder operates very similarly to the standard algorithm; however, instead of a static measurement of the entire input sequence's statistics (the Huffman tree), a dynamic, cumulative (i.e. from the first symbol to the current symbol) estimate of the sequence's probability distribution is used to encode (and decode) each symbol. In contrast to the standard Huffman coding approach, the adaptive Huffman algorithm requires this statistical analysis at both the encoder and decoder.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-08-24T02:32:21.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="99" PostTypeId="2" ParentId="96" CreationDate="2011-08-24T04:01:23.927" Score="9" Body="&lt;p&gt;I'm not sure specifically what you're looking for here. Noise is typically described via its power spectral density, or equivalently its autocorrelation function; the autocorrelation function of a random process and its PSD are a Fourier transform pair. White noise, for example, has an impulsive autocorrelation; this transforms to a flat power spectrum in the Fourier domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your example (while somewhat impractical) is analogous to a communication receiver that observes carrier-modulated white noise at a carrier frequency of $ 2 \omega $. The example receiver is quite fortunate, as it has its an oscillator that is coherent with that of the transmitter; there is no phase offset between the sinusoids generated at the modulator and demodulator, allowing for the possibility of &quot;perfect&quot; downconversion to baseband. This isn't impractical on its own; there are numerous structures for coherent communications receivers. However, noise is typically modeled as an additive element of the communication channel that is uncorrelated with the modulated signal that the receiver seeks to recover; it would be rare for a transmitter to actually transmit noise as part of its modulated output signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that out of the way, though, a look at the mathematics behind your example can explain your observation. In order to get the results that you describe (at least in the original question), the modulator and demodulator have oscillators that operate at an identical reference frequency and phase. The modulator outputs the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{align}&#xD;&#xA;n(t) &amp;amp;\sim \mathcal{N}(0, \sigma^2) \\&#xD;&#xA;x(t) &amp;amp; = n(t) \sin(2\omega t)&#xD;&#xA;\end{align}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The receiver generates the downconverted I and Q signals as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{align}&#xD;&#xA;I(t) &amp;amp;= x(t) \sin(2 \omega t) = n(t) \sin^2(2 \omega t)\\&#xD;&#xA;Q(t) &amp;amp;= x(t) \cos(2 \omega t) = n(t) \sin(2 \omega t) \cos(2 \omega t)&#xD;&#xA;\end{align}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_trigonometric_identities&quot; rel=&quot;nofollow&quot;&gt;trigonometric identities&lt;/a&gt; can help flesh out $ I(t) $ and $ Q(t) $ some more:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{align}&#xD;&#xA;\sin^2(2 \omega t) &amp;amp;= \frac{1 - \cos(4 \omega t)}{2}\\&#xD;&#xA;\sin(2 \omega t) \cos(2 \omega t) &amp;amp;= \frac{\sin(4 \omega t) + \sin(0)}{2} = \frac{1}{2} \sin(4 \omega t)&#xD;&#xA;\end{align}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can rewrite the downconverted signal pair as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{align}&#xD;&#xA;I(t) &amp;amp;= n(t) \frac{1 - \cos(4 \omega t)}{2}\\&#xD;&#xA;Q(t) &amp;amp;= \frac{1}{2} n(t) \sin(4 \omega t)&#xD;&#xA;\end{align}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input noise is zero-mean, so $ I(t) $ and $ Q(t) $ are also zero-mean. This means that their variances are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{align}&#xD;&#xA;\sigma^{2}_{I(t)} &amp;amp;= \mathbb{E}(I^2(t)) = \mathbb{E}\left(n^2(t) \left[\frac{1 - \cos(4 \omega t)}{2}\right]^2\right) = \mathbb{E}\left(n^2(t)\right) \mathbb{E}\left(\left[\frac{1 - \cos(4 \omega t)}{2}\right]^2\right) \\&#xD;&#xA;\sigma^{2}_{Q(t)} &amp;amp;= \mathbb{E}(Q^2(t)) = \mathbb{E}\left(n^2(t) \sin^2(4 \omega t)\right) = \mathbb{E}\left(n^2(t)\right) \mathbb{E}\left(\sin^2(4 \omega t)\right)&#xD;&#xA;\end{align}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You noted the ratio between the variances of $ I(t) $ and $ Q(t) $ in your question. It can be simplified to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{\sigma^{2}_{I(t)}}{\sigma^{2}_{Q(t)}} = \frac{\mathbb{E}\left(\left[\frac{1 - \cos(4 \omega t)}{2}\right]^2\right)}{\mathbb{E}\left(\sin^2(4 \omega t)\right)}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expectations are taken over the random process $ n(t) $ 's time variable $ t $. Since the functions are deterministic and periodic, this is really just equivalent to the mean-squared value of each sinusoidal function over one period; for the values shown here, you get a ratio of $ \sqrt 3 $, as you noted. The fact that you get more noise power in the I channel is an artifact of noise being modulated coherently (i.e. in phase) with the demodulator's own sinusoidal reference. Based on the underlying mathematics, this result is to be expected. As I stated before, however, this type of situation is not typical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although you didn't directly ask about it, I wanted to note that this type of operation (modulation by a sinusoidal carrier followed by demodulation of an identical or nearly-identical reproduction of the carrier) is a fundamental building block in communication systems. A real communication receiver, however, would include an additional step after the carrier demodulation: a lowpass filter to remove the I and Q signal components at frequency $ 4 \omega $. If we eliminate the double-carrier-frequency components, the ratio of I energy to Q energy looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{\sigma^{2}_{I(t)}}{\sigma^{2}_{Q(t)}} = \frac{\mathbb{E}\left((\frac{1}{2})^2\right)}{\mathbb{E}(0)} = \infty&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the goal of a coherent quadrature modulation receiver: signal that is placed in the in-phase (I) channel is carried into the receiver's I signal with no leakage into the quadrature (Q) signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I wanted to address your comments below. For a quadrature receiver, the carrier frequency would in most cases be at the center of the transmitted signal bandwidth, so instead of being bandlimited to the carrier frequency $ \omega\ $, a typical communications signal would be bandpass over the interval $ [\omega - \frac{B}{2}, \omega + \frac{B}{2}] $, where $ B $ is its modulated bandwidth. A quadrature receiver aims to downconvert the signal to baseband as an initial step; this can be done by treating the I and Q channels as the real and imaginary components of a complex-valued signal for subsequent analysis steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regard to your comment on the second-order statistics of the cyclostationary $ x(t) $, you have an error. The cyclostationary nature of the signal is captured in its autocorrelation function. Let the function be $ R(t, \tau) $:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;R(t, \tau) = \mathbb{E}(x(t)x(t - \tau))&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;R(t, \tau) = \mathbb{E}(n(t)n(t - \tau) \sin(2 \omega t) \sin(2 \omega(t - \tau)))&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;R(t, \tau) = \mathbb{E}(n(t)n(t - \tau)) \sin(2 \omega t) \sin(2 \omega(t - \tau))&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the whiteness of the original noise process $ n(t) $, the expectation (and therefore the entire right-hand side of the equation) is zero for all nonzero values of $ \tau $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;R(t, \tau) = \sigma^2 \delta(\tau) \sin^2(2 \omega t)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The autocorrelation is no longer just a simple impulse at zero lag; instead, it is time-variant and periodic because of the sinusoidal scaling factor. This causes the phenomenon that you originally observed, in that there are periods of &quot;high variance&quot; in $ x(t) $ and other periods where the variance is lower. The &quot;high variance&quot; periods are selected by demodulating by a sinusoid that is coherent with the one used to modulate it, which stands to reason.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-09-27T17:25:24.560" LastActivityDate="2011-09-27T17:25:24.560" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="100" PostTypeId="2" ParentId="97" CreationDate="2011-08-24T06:14:27.943" Score="8" Body="&lt;p&gt;From a practical perspective, there's good news and there's bad news.  The good news is that, in a sense, consumer grade digital cameras [at least] already do something like what you're describing, so there's a large amount of information available about the process, which is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Demosaicing&quot; rel=&quot;nofollow&quot;&gt;demosaicing&lt;/a&gt;.  The bad news is that, in &quot;standard&quot; designs, the various RAW color channels actually have &lt;em&gt;lower&lt;/em&gt; resolution than the physical sensor array, and the color channels in non-RAW images have already been reconstructed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this is that the physical sensors only detect light intensity (not color), and therefore each available physical &quot;pixel&quot; is paired with a color filter, according to some pattern. For example, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bayer_filter&quot; rel=&quot;nofollow&quot;&gt;Bayer Filter&lt;/a&gt; is a common pattern which allocates 50% of the available spatial resolution to the green channel, but only 25% each to the red and blue channels.  The various spatial patterns are called &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_filter_array&quot; rel=&quot;nofollow&quot;&gt;Color Filter Arrays&lt;/a&gt; (CFAs).  In effect they model the &lt;em&gt;idea&lt;/em&gt; of separate RGB sensors, just in a more cost-effective manner.  If there is some way of exploiting &quot;spectral crosstalk&quot; from the materials used in a given CFA, it would be handled in the context of demosaicing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means, if you're dealing with a camera which uses that type of sensing scheme, the most reasonable thing you can hope for is access to the camera RAW data (i.e. un-demosaiced), from which you can apply a higher-quality demosaicing algorithm to reconstruct the image.  From the &lt;a href=&quot;http://en.wikipedia.org/wiki/Demosaicing&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When one has access to the raw image data from a digital camera, one&#xA;  can use computer software with a variety of different demosaicing&#xA;  algorithms instead of being limited to the one built into the&#xA;  camera...The differences in rendering the finest detail (and grain&#xA;  texture) that come from the choice of demosaicing algorithm are among&#xA;  the main differences between various raw developers; often&#xA;  photographers will prefer a particular program for aesthetic reasons&#xA;  related to this effect.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The following link seems to be a good overview of various reconstruction algorithms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://scien.stanford.edu/pages/labsite/1999/psych221/projects/99/tingchen/&quot; rel=&quot;nofollow&quot;&gt;A Study of Spatial Color Interpolation Algorithms for Single-Detector Digital Cameras&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In higher-end cameras, however, the RAW color channels might not even be spatially interleaved.  Two of the different higher-end schemes (beam splitting, temporal interleaving) are reviewed &lt;a href=&quot;http://electronics.howstuffworks.com/cameras-photography/digital/digital-camera4.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One type of sensor that I think works more like what you had in mind is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Foveon_X3_sensor&quot; rel=&quot;nofollow&quot;&gt;Foveon X3 Sensor&lt;/a&gt;. The following paragraph from the link gives a good overview of the resolution issues:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For example, the dimensions of the photosite array in the sensor in&#xA;  the Sigma SD10 camera are 2268 × 1512, and the camera produces a&#xA;  native file size of those dimensions (times three color layers). This&#xA;  amounts to approximately 3.4 million three-color pixels. However, it&#xA;  has been advertised as a 10.2 MP camera by taking account of the fact&#xA;  that each photosite contains stacked red, green, and blue color&#xA;  sensing photodiodes, or pixel sensors (2268 × 1512 × 3). By&#xA;  comparison, the dimensions of the photosite array in the 10.2 MP Bayer&#xA;  sensor in the Nikon D200 camera are 3872 × 2592, but there is only one&#xA;  photodiode, or one pixel sensor, at each site. The cameras have equal&#xA;  numbers of photodiodes, and produce similar RAW data file sizes, but&#xA;  the Bayer filter camera produces a larger native file size via&#xA;  demosaicing.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think this is what you're looking for, assuming I understood the question.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2011-08-24T06:14:27.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="101" PostTypeId="1" AcceptedAnswerId="123" CreationDate="2011-08-25T04:31:43.800" Score="26" ViewCount="16848" Body="&lt;p&gt;I have a signal of some length, say 1000 samples. I would like to extend this signal to 5000 samples, sampled at the same rate as the original (i.e., I want to predict what the signal would be if I continued to sample it for a longer period of time). The signal is composed of several sinusoidal components added together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method that first came to me was to take the entire FFT, and extend it, but this leaves a very strong discontinuity at frame 1001. I've also considered only using the part of the spectrum near the peaks, and while this seems to improve the signal somewhat, it doesn't seem to me that the phase is guaranteed to be correct. What is the best method for extending this signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some MATLAB code showing an idealized method of what I want. Of course, I won't know beforehand that there are exactly 3 sinusoidal components, nor their exact phase and frequency. I want to make sure that the function is continuous, that there isn't a jump as we move to point 501, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vals = 1:50;&#xA;signal = 100+5*sin(vals/3.7+.3)+3*sin(vals/1.3+.1)+2*sin(vals/34.7+.7); % This is the measured signal&#xA;% Note, the real signal will have noise and not be known exactly.&#xA;output_vals = 1:200;&#xA;output_signal = 100+5*sin(output_vals/3.7+.3)+3*sin(output_vals/1.3+.1)+2*sin(output_vals/34.7+.7); % This is the output signal&#xA;&#xA;figure;&#xA;plot(output_signal);&#xA;hold all;&#xA;plot(signal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically, given the green line, I want to find the blue line.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/a3dEw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="88" LastEditorUserId="128" LastEditDate="2020-07-22T10:06:29.763" LastActivityDate="2020-07-22T10:06:29.763" Title="How to Extrapolate a 1D Signal?" Tags="|matlab|discrete-signals|sampling|extrapolation|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="102" PostTypeId="1" AcceptedAnswerId="105" CreationDate="2011-08-25T11:29:38.217" Score="16" ViewCount="1270" Body="&lt;p&gt;I have an image and I would like to measure the amount of detail in it. Another way to look at it is to measure how blurry an image is. One way is to analyse the high frequency components in the Fourier transform of the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other/better methods?&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="77" LastEditDate="2011-08-25T17:28:42.413" LastActivityDate="2011-08-25T17:28:42.413" Title="How do you measure &quot;detail&quot; of a signal?" Tags="|image-processing|fourier-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="103" PostTypeId="1" AcceptedAnswerId="153" CreationDate="2011-08-25T11:34:39.223" Score="18" ViewCount="2082" Body="&lt;p&gt;In &lt;em&gt;Five short stories about the cardinal series&lt;/em&gt; $[1]$, the author makes the following comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Interestingly enough, Shannon goes on to mention that other sets of&#xA;  data can also be used to determine the band-limited signal--for&#xA;  example, the values of ƒ and its first derivative at every other&#xA;  sample point, the values of ƒ and its first and second derivatives at&#xA;  every third sample point, and so on.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The paper mentions some historical developments, but I'm curious what the &quot;killer apps&quot; are for derivative sampling.  Does it go by any other names?  Are there further generalizations of this approach? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple overview, or pointers to some references would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;J. R. Higgins, &lt;em&gt;Five short stories about the cardinal series&lt;/em&gt;, Bull. Amer. Math. Soc. (N. S.) 12 (1985), no. 1, 45-89. &lt;a href=&quot;http://bit.ly/plioNg&quot;&gt;http://bit.ly/plioNg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="35" LastEditorDisplayName="user42" LastEditDate="2011-09-22T20:27:57.377" LastActivityDate="2013-12-24T19:15:15.017" Title="What are the advantages, if any, of derivative sampling?" Tags="|sampling|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="104" PostTypeId="2" ParentId="102" CreationDate="2011-08-25T13:03:20.767" Score="9" Body="&lt;p&gt;I think that if you talk about the amount of &lt;em&gt;detail&lt;/em&gt; in an image, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_wavelet_transform&quot; rel=&quot;nofollow&quot;&gt;discrete wavelet transform&lt;/a&gt; (DWT) fits your description perfectly. It isn't completely dissimilar from the discrete Fourier transform (DFT) in that it, too, operates in terms of fine and coarse scale components of a signal, but it's also very localized unlike the DFT. A fantastic introduction for one-dimensional signals by I. Selesnick is &lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;source=web&amp;amp;cd=8&amp;amp;sqi=2&amp;amp;ved=0CF4QFjAH&amp;amp;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.139.1481%26rep%3Drep1%26type%3Dpdf&amp;amp;rct=j&amp;amp;q=wavelet%20transform&amp;amp;ei=M0RWTtfQG9HUgAfR0pG6DA&amp;amp;usg=AFQjCNGhMnlRj7mwQpnRTjCjJJCKW2muww&amp;amp;sig2=eO0YO2asA3D4pV7GzjHHrg&amp;amp;cad=rja&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A wavelet transform essentially is a series of nested orthogonal band-pass filters that in the end create signals of different spectral components, so in this sense you can use either wavelet of Fourier transform. However, if you would like to actually plot the components separately from each other, you have to use WFT because is also gives you the right window and localization in space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to simply compute the amount of detail on each scale level, calculating total energy of each band in interest in the Fourier transform would suffice:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D_{\beta} = \sum_{\omega_{\beta} \in \beta}\left\vert S^f(\omega_{\beta})\right\vert^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $S^f(\omega)$ is the Fourier transform of some signal $s(t)$, and $\beta$ is some interval of frequencies in the Fourier domain.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="77" LastEditDate="2011-08-25T17:04:11.453" LastActivityDate="2011-08-25T17:04:11.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="105" PostTypeId="2" ParentId="102" CreationDate="2011-08-25T13:19:49.020" Score="14" Body="&lt;p&gt;What you are referring to is typically known as &quot;Image Sharpness&quot;. A quick scan, as well as some prior knowledge, comes to the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Fourier analysis- Using this has 2 key disadvantages. First of all, noise would tend to show up no matter what, and thus higher frequency components would tend to show up. Secondly, sharpness tends to be a local phenomena, and thus might not show up if you do a transform of the entire image.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dl.acm.org/citation.cfm?id=1235910&quot; rel=&quot;noreferrer&quot;&gt;Eigenvalue analysis&lt;/a&gt;- I haven't actually read this paper, but it proposes using eigenvalue analysis to determine the sharpness of an image.&lt;/li&gt;&#xA;&lt;li&gt;Edge detection algorithms depend on a certain amount of sharpness. One could use different values for edge detection parameters to determine the amount of sharpness. &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://enpub.fulton.asu.edu/resp/vpqm2005/papers/224.pdf&quot; rel=&quot;noreferrer&quot;&gt;Kurtosis Measurement of wavelet coefficients&lt;/a&gt;- Again, I haven't read the entire paper, but this seems to suggest calculating wavelet coefficients, performing an FFT of the entire set of coefficients, and measuring the kurtosis. This should be relatively immune to noise.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm sure there are many more. This is a very active field of study currently. If none of these methods suits you, then continue to search through academic papers, and see if you can find a better method.&lt;/p&gt;&#xA;" OwnerUserId="88" LastActivityDate="2011-08-25T13:19:49.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="106" PostTypeId="2" ParentId="101" CreationDate="2011-08-25T15:37:22.023" Score="6" Body="&lt;p&gt;If you're completely sure that there are only few frequency components to the signal, you can try the &lt;a href=&quot;http://en.wikipedia.org/wiki/Multiple_signal_classification&quot; rel=&quot;nofollow noreferrer&quot;&gt;MUSIC&lt;/a&gt; algorithm to find out which frequencies are contained in your signal and try to work from there. I'm not completely sure that this can be made to work perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, because your data is completely deterministic, you can try to build some sort of a non-linear predictor, train it using your existing data set and let it &lt;em&gt;extrapolate&lt;/em&gt; the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general this is an extrapolation problem, do you might want to Google something like &lt;a href=&quot;https://www.google.se/search?q=fourier+extrapolation+of+price&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fourier extrapolation of price&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="28720" LastEditDate="2017-05-25T11:37:58.000" LastActivityDate="2017-05-25T11:37:58.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="107" PostTypeId="1" CreationDate="2011-08-25T15:47:08.240" Score="24" ViewCount="2737" Body="&lt;p&gt;I have a set of contours (set of line segments) grouped in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S_i = \{I^0, I^\frac{\pi}{4}, I^\frac{2\pi}{4}, \ldots, I^\frac{7\pi}{4} \}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$S_i$ denote sequence of photos of one concrete object.  &lt;/li&gt;&#xA;&lt;li&gt;$I^j$ denote an image, with $j^{th}$ point of view ($j=0$ means front view).  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is example of $I^\pi$ (rear view):  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sBZZ7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I reconstruct 3d structure of object with given $S_i$?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me to some papers or even give me some keywords? I know that there are a lot of articles that operate with clouds of points and so on, but those don't work as I'm operating with lines.&lt;/p&gt;&#xA;" OwnerUserId="43" LastEditorUserId="4682" LastEditDate="2013-07-06T02:00:49.140" LastActivityDate="2013-07-06T02:00:49.140" Title="How can I reconstruct a 3D structure from a set of images?" Tags="|image-processing|computer-vision|3d|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="109" PostTypeId="1" AcceptedAnswerId="115" CreationDate="2011-08-25T19:09:34.757" Score="29" ViewCount="5371" Body="&lt;p&gt;When designing a digital filter based on an analog filter we usually use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform&quot;&gt;bilinear transform&lt;/a&gt;. To approximate a discrete transfer function $D_a(z)$ from analog (continuous) transfer function $A(s)$ we substitute &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z = \frac{1+sT/2}{1-sT/2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is the sampling period. Alternatively, to approximate an continuous transfer function $A_a(s)$ from discrete transfer function $D(z)$ we substitute&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s = \frac{2}{T} \frac{z-1}{z+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there alternative methods of performing such conversions? Are there better approximations?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="77" LastEditDate="2011-08-25T20:54:46.040" LastActivityDate="2023-03-15T09:12:29.217" Title="Are there alternatives to the bilinear transform?" Tags="|continuous-signals|discrete-signals|transfer-function|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="110" PostTypeId="2" ParentId="101" CreationDate="2011-08-25T19:12:42.290" Score="19" Body="&lt;p&gt;I think &lt;strong&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_prediction&quot;&gt;linear predictive coding&lt;/a&gt;&lt;/strong&gt; (otherwise known as an &lt;a href=&quot;http://en.wikipedia.org/wiki/Autoregressive_moving_average_model&quot;&gt;auto-regressive moving average&lt;/a&gt;) is what you are looking for.  LPC extrapolates a time series by first fitting a linear model to the time series, in which each sample is assumed to be a linear combination of previous samples.  After fitting this model to the existing time series, it can be run forward to extrapolate further values while maintaining a stationary(?) power spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a little example in Matlab, using the &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/lpc.html&quot;&gt;&lt;code&gt;lpc&lt;/code&gt;&lt;/a&gt; function to estimate the LPC coefficients.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 150;    % Order of LPC auto-regressive model&#xA;P = 500;    % Number of samples in the extrapolated time series&#xA;M = 150;    % Point at which to start predicting&#xA;&#xA;t = 1:P;&#xA;&#xA;x = 5*sin(t/3.7+.3)+3*sin(t/1.3+.1)+2*sin(t/34.7+.7); %This is the measured signal&#xA;&#xA;a = lpc(x, N);&#xA;&#xA;y = zeros(1, P);&#xA;&#xA;% fill in the known part of the time series&#xA;y(1:M) = x(1:M);&#xA;&#xA;% in reality, you would use `filter` instead of the for-loop&#xA;for ii=(M+1):P      &#xA;    y(ii) = -sum(a(2:end) .* y((ii-1):-1:(ii-N)));&#xA;end&#xA;&#xA;plot(t, x, t, y);&#xA;l = line(M*[1 1], get(gca, 'ylim'));&#xA;set(l, 'color', [0,0,0]);&#xA;legend('actual signal', 'extrapolated signal', 'start of extrapolation');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, in real code you would use &lt;code&gt;filter&lt;/code&gt; to implement the extrapolation, by using the LPC coefficients &lt;code&gt;a&lt;/code&gt; as an IIR filter and pre-loading the known timeseries values into the filter state; something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Run the initial timeseries through the filter to get the filter state &#xA;[~, zf] = filter(-[0 a(2:end)], 1, x(1:M));     &#xA;&#xA;% Now use the filter as an IIR to extrapolate&#xA;y((M+1):P) = filter([0 0], -a, zeros(1, P-M), zf); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/469OT.png&quot; alt=&quot;LPC example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does a reasonable job, though the prediction dies off with time for some reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't actually know much about AR models and would also be curious to learn more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: @china and @Emre are right, the Burg method appears to work much better than LPC.  Simply by changing &lt;code&gt;lpc&lt;/code&gt; to &lt;a href=&quot;http://www.mathworks.de/help/toolbox/signal/ref/arburg.html&quot;&gt;&lt;code&gt;arburg&lt;/code&gt;&lt;/a&gt; in the above code yields the following results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DyRNG.png&quot; alt=&quot;Extrapolation using the Burg method&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is available here: &lt;a href=&quot;https://gist.github.com/2843661&quot;&gt;https://gist.github.com/2843661&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-05-31T14:34:56.110" LastActivityDate="2012-05-31T14:34:56.110" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="111" PostTypeId="2" ParentId="69" CreationDate="2011-08-25T20:38:01.090" Score="66" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/69/why-is-the-fourier-transform-so-important/70#70&quot;&gt;Lorem Ipsum's great answer&lt;/a&gt; misses one thing:  The Fourier transform decomposes signals into constituent complex exponentials:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ e^{\jmath \omega t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and complex exponentials are the &lt;strong&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Eigenfunction&quot; rel=&quot;noreferrer&quot;&gt;eigenfunctions&lt;/a&gt;&lt;/strong&gt; for &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory&quot; rel=&quot;noreferrer&quot;&gt;linear, time invariant systems&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put simply, if a system, $H$ is linear and time-invariant, then its response to a complex exponential will be a complex exponential of the same frequency but (possibly) different phase, $\phi$, and amplitude, $A$, --- and the amplitude may be zero:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = H[e^{\jmath \omega t}] = A e^{\jmath \phi} e^{\jmath \omega t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the Fourier transform is a useful tool for analyzing linear, time-invariant systems.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-12-08T18:02:04.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="112" PostTypeId="2" ParentId="31" CreationDate="2011-08-25T21:40:28.117" Score="10" Body="&lt;p&gt;The key to understanding MFCC is in the start of the sentence in the linked-to article:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;They are derived from a type of cepstral representation of the audio clip...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;MFCCs are like a spectrum-of-a-&lt;em&gt;log&lt;/em&gt;-spectrum, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cepstrum&quot; rel=&quot;nofollow noreferrer&quot;&gt;cepstrum&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The cepstrum of a signal &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;is just:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C(z) = {\cal F}^{-1}(\log(|{\cal F}(x(t))|^2) )$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;${\cal F}$&lt;/span&gt; is the Fourier transform and &lt;span class=&quot;math-container&quot;&gt;${\cal F}^{-1}$&lt;/span&gt; its inverse.&lt;/p&gt;&#xA;&lt;p&gt;The reason the cepstrum is neat is that the interposed logarithm operation means that &lt;strong&gt;convolutions of the original signal show up as simple additions in the cepstrum&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That advantage carries over to the MFCCs, although &lt;a href=&quot;http://en.wikipedia.org/wiki/Cepstrum#Liftering&quot; rel=&quot;nofollow noreferrer&quot;&gt;liftering&lt;/a&gt; is not as direct as with the standard cepstrum.&lt;/p&gt;&#xA;&lt;p&gt;Where the MFCC differs is in the use of the discrete cosine transform (DCT) as the final transform instead of the inverse Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;The advantage the DCT has over the Fourier transform is that &lt;strong&gt;the resulting coefficients are real-valued&lt;/strong&gt;, which makes subsequent processing and storage easier.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2021-12-29T08:35:50.737" LastActivityDate="2021-12-29T08:35:50.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="113" PostTypeId="2" ParentId="109" CreationDate="2011-08-26T01:07:18.623" Score="12" Body="&lt;p&gt;There are many ways to do the mapping from &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;.  The &lt;a href=&quot;http://en.wikibooks.org/wiki/Control_Systems/Z_Transform_Mappings&quot; rel=&quot;nofollow noreferrer&quot;&gt;control community&lt;/a&gt; has some things to say about it.&lt;/p&gt;&#xA;&lt;p&gt;Some examples are:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The Matched Z-Transform&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here, the &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;-domain transfer function is written as a partial fraction expansion:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y(s) = \frac{a_0}{s + s_0} +  \frac{a_1}{s + s_1} + ...$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And the conversion of each part of the partial fraction expansion is done directly using:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ s + s_n = 1 - z^{-1} \exp(-s_nT)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Simpson's Rule&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;One interpretation of the bilinear transform is that it is a way of transforming from &lt;a href=&quot;https://web.archive.org/web/20150406040322/http://lorien.ncl.ac.uk/ming/digicont/digimath/sampled2.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;continuous to discrete time by approximate integration using the Trapezoidal Rule&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A more accurate technique for approximate integration uses Simpson's Rule. If this approximation is used then the resulting mapping&#xA;is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$s = \frac{3}{T} \frac{z^2 - 1}{z^2+4z+1}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="15347" LastEditDate="2023-03-15T09:12:29.217" LastActivityDate="2023-03-15T09:12:29.217" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="114" PostTypeId="1" CreationDate="2011-08-26T03:00:59.293" Score="7" ViewCount="945" Body="&lt;p&gt;What are less computationally demanding alternatives to the Viterbi Decoder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally what I would like is a list of the most commonly used approximate methods, along with brief pros and cons.&lt;/p&gt;&#xA;" OwnerUserId="66" LastEditorUserId="128" LastEditDate="2019-03-24T17:17:22.870" LastActivityDate="2019-03-24T17:17:22.870" Title="What Are Less Computationally Demanding Alternatives to the Viterbi Decoder?" Tags="|digital-communications|deconvolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="115" PostTypeId="2" ParentId="109" CreationDate="2011-08-26T03:24:49.797" Score="20" Body="&lt;p&gt;Analog filters are stable if the poles are in the left half of the s-plane (figure on the left) and digital filters are stable if the poles are inside the unit circle (figure on the right). So mathematically all that is needed to convert from analog to digital is a mapping (conformal?) from the half-space to the unit disk and the &lt;span class=&quot;math-container&quot;&gt;$\jmath\Omega$&lt;/span&gt; axis to the unit circle &lt;span class=&quot;math-container&quot;&gt;$\vert z\vert=1$&lt;/span&gt;. Any transformation that does this is a possible candidate for being an alternative to the bilateral transform.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sGADr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Two of the well known methods are the &lt;a href=&quot;http://en.wikipedia.org/wiki/Impulse_invariance&quot; rel=&quot;noreferrer&quot;&gt;impulse invariance method&lt;/a&gt; and the &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_Z-transform_method&quot; rel=&quot;noreferrer&quot;&gt;matched Z-transform method&lt;/a&gt;. Conceptually, both of these are similar to sampling a continuous waveform that we're familiar with. Denoting the inverse Laplace transform by &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}^{-1}$&lt;/span&gt; and the Z transform as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;, both these methods involve calculating the impulse response of the analog filter as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a(t)=\mathcal{L}^{-1}\{A(s)\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and sampling &lt;span class=&quot;math-container&quot;&gt;$a(t)$&lt;/span&gt; at a sampling interval &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; that is high enough so as to avoid aliasing. The transfer function of the digital filter is then obtained from the sampled sequence &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_a(z)=\mathcal{Z}\{a[n]\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, there are key differences between the two.&lt;/p&gt;&#xA;&lt;h3&gt;Impulse invariance method:&lt;/h3&gt;&#xA;&lt;p&gt;In this method, you expand the analog transfer function as partial fractions (not in the matched Z transform as &lt;a href=&quot;https://dsp.stackexchange.com/questions/109/are-there-alternatives-to-the-bilinear-transform/113#113&quot;&gt;mentioned by Peter&lt;/a&gt;) as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A(s)=\sum_m \frac{C_m}{s-\alpha_m}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$C_m$&lt;/span&gt; is some constant and &lt;span class=&quot;math-container&quot;&gt;$\alpha_m$&lt;/span&gt; are the poles. Mathematically, any transfer function with a numerator of lesser degree than the denominator can be expressed as a sum of &lt;a href=&quot;http://en.wikipedia.org/wiki/Partial_fraction&quot; rel=&quot;noreferrer&quot;&gt;partial fractions&lt;/a&gt;. Only low-pass filters satisfy this criterion (high-pass and bandpass/bandstop have at least the same degree), and hence impulse invariant method cannot be used to design other filters.&lt;/p&gt;&#xA;&lt;p&gt;The reason why it fails is also quite clear. If you had a polynomial in the numerator of the same degree as in the denominator, you will have a free standing constant term, which upon inverse transforming, will give a delta function that cannot be sampled.&lt;/p&gt;&#xA;&lt;p&gt;If you carry out the inverse Laplace and forward Z transforms, you'll see that the poles are transformed as &lt;span class=&quot;math-container&quot;&gt;$\alpha_m \to e^{\alpha_m T}$&lt;/span&gt; which means that if your analog filter is stable, the digital filter will also be stable. Hence it preserves the stability of the filter.&lt;/p&gt;&#xA;&lt;h3&gt;Matched Z-transform&lt;/h3&gt;&#xA;&lt;p&gt;In this method, instead of splitting the impulse response as partial fractions, you do a simple transform of both the poles and the zeros in a similar manner (matched) as &lt;span class=&quot;math-container&quot;&gt;$\beta_m\to e^{\beta_m T}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha_m\to e^{\alpha_m T}$&lt;/span&gt; (also stability preserving), giving&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A(s)=\frac{\prod_m (s-\beta_m)}{\prod_n (s-\alpha_n)}\longrightarrow \frac{\prod_m \left(1-z^{-1}e^{\beta_m T}\right)}{\prod_n \left(1-z^{-1}e^{\alpha_n T}\right)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can easily see the limitation of both these methods. Impulse invariant is applicable only if your filter is low pass and matched z-transform method is applicable to bandstop and bandpass filters (and high pass up to the Nyquist frequency). They are also limited in practice by the sampling rate (after all, you can only go up to a certain point) and suffer from the effects of aliasing.&lt;/p&gt;&#xA;&lt;p&gt;The bilinear transform is by far the most commonly used method in practice and the above two are rather more for academic interests. As for conversion back to analog, I'm sorry but I do not know and can't be of much help there as I hardly ever use analog filters.&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2011-08-26T03:30:29.630" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="116" PostTypeId="2" ParentId="103" CreationDate="2011-08-26T04:36:31.113" Score="5" Body="&lt;p&gt;I'm not aware of any applications of such a sampling scheme. It's typically more difficult to accurately sample a signal's derivative than its instantaneous value (differentiators are vulnerable to high-frequency noise due to their ramp-shaped frequency response). As endolith pointed out in the comment above, if you have enough information in your discrete samples to reconstruct the original signal, then you can calculate all of the derivatives that you would want.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-08-26T04:36:31.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="117" PostTypeId="1" AcceptedAnswerId="122" CreationDate="2011-08-26T04:44:14.103" Score="12" ViewCount="3800" Body="&lt;p&gt;Given a filter used to shape the digital signal, $p(x)$, and given that we do not want the filter combination to cause any ISI, what &quot;matched&quot; filter, $q(x)$ will maximise the SNR?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matched filters are used in digital communications to maximize the signal to noise ratio.  Often a root-raised-cosine filter is used to shape the signal, since it is bounded in frequency space and the same filter can be applied to the received signal to improve the signal-to-noise ratio (SNR) without causing inter-symbol-interference (ISI).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if a less optimum filter is used to shape the signal, then using the same filter at the receiver can introduce ISI.  It is not immediately obvious what the best choice of filter at the receiving end is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that the SNR is maximized by maximizing $\int{p(x)q(x)dx}$, so I want to maximize this while satisfying the constraint that filters cause no ISI ($p(x)*q(x) = 0$ for $x=kT$, $k$ is an integer, $T$ is symbol width).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presumably one could do this by solving a Euler-Lagrange equation with some lagrange multipliers for the constraints.  Is there an easier way, or am I making a mistake, or going in the wrong direction? &lt;/p&gt;&#xA;" OwnerUserId="66" LastActivityDate="2011-11-04T14:48:22.500" Title="Optimum matched filter without ISI" Tags="|matched-filter|digital-communications|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="118" PostTypeId="2" ParentId="107" CreationDate="2011-08-26T11:23:17.653" Score="20" Body="&lt;p&gt;Actually it is quite a hard topic. Classical multi-view 3d reconstruction deals with point matching in the first place, i.e. find the same point on every image. Given the camera (view) parameters for each image, the original 3d point can be reconstructed. (Using a laser or a projector the scene can be lit so the matching can be done relatively easily.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bible of the field is &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/index.html&quot;&gt;Multiple View Geometry in Computer Vision by Hartley and Zisserman &lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the book there is a section about the trifocal tensor, which is a multilinear constraint between 3 views. It contains not just point but line correspondence constraints as well. It can be used for building reconstruction very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your contours should be matched at the first place, and maybe can be reconstructed knowing the camera parameters (camera calibration is also covered in the book). Then you will have contours in 3d but nothing more. For real surfaces you have to do dense point matching. Though the tensor I mentioned look good it is used for straight lines and I am sure that a modern car has curved lines all over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know how you got those contours but seeing the image you have posted I am quite sceptic about the robustness of that algorithm, so the reconstruction will be poor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method it came to my mind is &lt;a href=&quot;http://en.wikipedia.org/wiki/Visual_hull&quot;&gt;visual hull or space carving&lt;/a&gt;. The contour mathcing should also be done. Running the method on each contour you can have the model.&lt;/p&gt;&#xA;" OwnerUserId="156" LastActivityDate="2011-08-26T11:23:17.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="120" PostTypeId="2" ParentId="114" CreationDate="2011-08-26T21:41:30.400" Score="4" Body="&lt;p&gt;One (far from optimal) approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A half-rate &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolutional_code&quot; rel=&quot;nofollow&quot;&gt;convolutional code&lt;/a&gt; can be viewed as two &lt;a href=&quot;http://en.wikipedia.org/wiki/Multiplicative_scrambler&quot; rel=&quot;nofollow&quot;&gt;multiplicatively scrambled&lt;/a&gt; channel coders multiplexed together. You could decode the two paths with the inverse multiplicative descramblers then combine the two paths.  Even if you make the descramblers create soft decisions, the results will be &lt;strong&gt;far&lt;/strong&gt; from optimal, but should be very fast.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2011-08-26T21:41:30.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="121" PostTypeId="2" ParentId="103" CreationDate="2011-08-27T00:47:43.983" Score="3" Body="&lt;p&gt;That's a very nice article that you linked to (I hadn't read it before), and in fact, the answer that you seek is in that very article in §2.3! I've reproduced below a portion of §2.3 that is relevant.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;2.3 Derivative sampling&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In order to illustrate a practical sampling situation, &#xA;  J. Fogel (1955) has mentioned the example of an airplane pilot's instrument &#xA;  panel, which traditionally consists of dials with pointers giving information &#xA;  about the plane's altitude, attitude, speed, etc. Pilots scan their instruments, &#xA;  obtaining information from any one of them on a roughly periodic basis. It is &#xA;  possible that derivative information could be available to the pilot as well; for &#xA;  example, the altimeter would be noticed to be &quot;unwinding&quot; at an alarming &#xA;  rate if the plane were in a nose dive! It is just conceivable that the acceleration &#xA;  of the pointer could be observed as well; at any rate this little example does &#xA;  point out the general need for a sampling theorem which takes account of &#xA;  samples not only from the function itself but also from its first $r$ derivatives. &#xA;  When just the samples of $f$ (band-limited to $[-\pi W,\pi W]$) and $f'$ are available, the formula is &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$f(t)=\sum\left\{f\left(\frac{2\pi}{W}\right)+\left(t-\frac{2\pi}{W}\right)f'\left(\frac{2\pi}{W}\right)\right\}\left\{\frac{\sin \pi(Wt-2n)/2}{\pi(Wt-2n)/2}\right\}^2$$&#xA;  and in this form it was first given by Jagerman and Fogel (1956).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I believe that this is still a very valid application of derivative sampling, as planes haven't gone out of fashion. There might have been several other technological advances (that I'm unaware of) that might make the use of derivative sampling unnecessary these days, but the point still remains.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;L. J. Fogel (1955), &lt;em&gt;A note on the sampling theorem&lt;/em&gt;, IRE Trans. Inform. Theory &lt;strong&gt;1&lt;/strong&gt;, 47–48&lt;/p&gt;&#xA;&#xA;&lt;p&gt;D. L. Jagerman and L. J. Fogel (1956), &lt;em&gt;Some general aspects of the sampling theorem&lt;/em&gt;, IEEE Trans. Inform. Theory &lt;strong&gt;2&lt;/strong&gt;, 139–156&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="7369" LastEditDate="2013-12-24T19:15:15.017" LastActivityDate="2013-12-24T19:15:15.017" CommentCount="5" CommunityOwnedDate="2011-09-25T08:05:32.457" ContentLicense="CC BY-SA 3.0" />
  <row Id="122" PostTypeId="2" ParentId="117" CreationDate="2011-08-27T05:31:16.923" Score="7" Body="&lt;p&gt;For the case of linear modulation on the AWGN channel with equiprobable symbols (a very common case) the optimum approach is to truly use a filter that is matched to the symbol waveform, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;q(x) = p(x)&#xD;&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a matched filter provides the optimum signal-to-noise ratio at the filter output at each decision instant. This is easy to see when you remember that a matched filter acts like a sliding cross-correlator between its input signal and the expected symbol waveform, correlating the two at all possible lags. At optimum decision instants, the filter's impulse response (typically scaled to have unit energy) lines up exactly with a transmitted symbol, analogous to a zero-lag condition on the cross-correlation operation. At this time value, the filter's output is equal to the amount of energy in the received symbol, scaled by a data-dependent factor (e.g. for BPSK, the matched filter would output $ E_s $ or $ -E_s $), plus a noise term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The noise energy at the filter output during the sampling instant is not dependent upon the time-domain shape of the filter's impulse response, only the impulse response's total energy (as noted previously, typically unity). Therefore, the signal to noise ratio is maximized by maximizing the amount of signal energy in the filter output at the sampling instant. By choosing the receiver filter to be matched to the symbol shape, we have done so, as the symbol waveform has maximum correlation with a filter impulse response that has an identical shape. Thus, the matched filter provides maximum SNR, for the AWGN channel case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that bout of hand-waving out of the way (you can definitely get at it with more mathematical rigor, but I'm an engineer and this is a free service; if you want to dig into the details, check any digital communication theory text), you might be thinking that I forgot that you asked about the non-ideal, ISI case. Fear not, for I assert that if you know the transmitted pulse shape, the matched filter is still the optimum choice for the AWGN channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key: &lt;strong&gt;if you know the responses of the pulse-shaping and receiver detection filters $p(x)$ and $q(x)$, and the last &quot;few&quot; transmitted symbols, you can calculate what the ISI induced by those previous symbols would be and account for it accordingly&lt;/strong&gt;; it is a deterministic quantity. The amount of symbol history that you require is related to the amount of ISI you have, i.e. how many symbol periods the cascaded filter response smears across. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you typically don't know with certainty what the previous few symbols were; if you did, then you might be at a high enough SNR that your ISI can be neglected. In the more interesting case, you can't make that assumption. Instead, a maximum-likelihood sequence detection approach is employed using the Viterbi algorithm. This process is referred to as &lt;strong&gt;Viterbi equalization&lt;/strong&gt;, because in this model you treat the ISI induced by the pulse shape like a soft-valued convolutional code that is applied to your transmit waveform. The time duration of the ISI in the Viterbi equalizer defines the required number of algorithm states, similar to the constraint length in a convolutional code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach is often used in systems that have the non-optimum pulse shape that you noted; one notable example is GSM (which uses a Gaussian pulse shape that extends across multiple symbol intervals). One great reference on this topic was published by Sklar in 2003:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B. Sklar, “How I learned to love the trellis“, IEEE Signal Processing Magazine, pp. 87-102, May, 2003&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-08-27T05:31:16.923" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="123" PostTypeId="2" ParentId="101" CreationDate="2011-08-27T09:12:22.053" Score="18" Body="&lt;p&gt;Depending on the source material, the DCT-based spectral interpolation method described in the following paper looks promising:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;lk, H.G., Güler S. &lt;a href=&quot;http://elect.eng.ankara.edu.tr/inc/papers/a12.pdf&quot; rel=&quot;noreferrer&quot;&gt;&quot;Signal transformation and interpolation based on&#xA;  modified DCT synthesis&quot;&lt;/a&gt;, Digital Signal Processing, Article in Press,&#xA;  2011.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's one of the figures from the paper showing an example of interpolation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lopxw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The applications of the technique to the recovery of lost segments (&lt;em&gt;e.g. 4.2. Synthesis of lost pitch periods&lt;/em&gt;) are probably most relevant to extrapolation.  In other words, grab a piece of the existing source material, pretend there's a lost segment between the edge and the arbitrary segment you selected, then &quot;reconstruct&quot; the &quot;missing&quot; portion (and perhaps discard the piece you used at the end).  It appears an even simpler application of the technique would work for looping the source material seamlessly (&lt;em&gt;e.g. 3.1. Interpolation of the spectral amplitude&lt;/em&gt;).&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2011-08-27T09:12:22.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="124" PostTypeId="1" AcceptedAnswerId="126" CreationDate="2011-08-29T17:37:49.700" Score="21" ViewCount="11210" Body="&lt;p&gt;I have a floating-point digital signal processing system that operates at a fixed sample rate of $f_s = 32768$ samples per second implemented using an x86-64 processor.  Assuming that the DSP system is synchronously locked to whatever matters, what is the best way to implement a digital oscillator at some frequency $f$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I want to generate the signal:&#xA;$$y(t) = \sin(2\pi f t)$$&#xA;where  $t=n/f_s$ for sample number $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One idea is to keep track of a vector $(x,y)$ which we rotate by an angle $\Delta\phi = 2\pi f/f_s$ on each clock cycle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a Matlab pseudocode implementation (the real implementation is in C):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Initialization code&#xA;&#xA;f_s = 32768;             % sample rate [Hz]&#xA;f = 19.875;              % some constant frequency [Hz]&#xA;&#xA;v = [1 0];               % initial condition     &#xA;d_phi = 2*pi * f / f_s;  % change in angle per clock cycle&#xA;&#xA;% initialize the rotation matrix (only once):&#xA;R = [cos(d_phi), -sin(d_phi) ; ...&#xA;     sin(d_phi),  cos(d_phi)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, on each clock cycle, we rotate the vector around a little bit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% in-loop code&#xA;&#xA;while (forever),&#xA;  v = R*v;        % rotate the vector by d_phi&#xA;  y = v(1);       % this is the sine wave we're generating&#xA;  output(y);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This allows the oscillator to be computed with only 4 multiplications per cycle.  However, I'd worry about phase error and amplitude stability.  (In simple tests I was surprised that the amplitude did not die or explode immediately--maybe the &lt;code&gt;sincos&lt;/code&gt; instruction guarantees $\sin^2+\cos^2=1$?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the right way to do this?&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="4682" LastEditDate="2013-07-06T02:00:31.233" LastActivityDate="2019-12-06T22:06:47.947" Title="How to implement a digital oscillator?" Tags="|software-implementation|oscillator|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="125" PostTypeId="1" AcceptedAnswerId="127" CreationDate="2011-08-29T18:08:05.253" Score="8" ViewCount="2690" Body="&lt;p&gt;The same floating-point AMD X86-64 digital signal processing system mentioned in my &lt;a href=&quot;https://dsp.stackexchange.com/questions/124/how-to-implement-a-digital-oscillator&quot;&gt;previous question&lt;/a&gt; has a problem where it sometimes slows down substantially when signals attain values very near (but not exactly) zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that &lt;a href=&quot;http://www.wikipedia.org/wiki/Denormal_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;denormalized floating point values&lt;/a&gt; require special processing by the CPU which is dramatically slower than dealing with normal floating point values.  This can cause the DSP system to run too slow--taking longer than $1/f_s$ to compute everything that needs to be computed in one cycle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A workaround is to add a small offset to all numbers to force them into the range of normal numbers.  Is there a way to instead instruct the FPU to simply not generate denormal numbers in the first place?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The OS is Linux and the compiler is &lt;code&gt;gcc&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Also, what are the numerical consequences of disabling denormal numbers?&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="26573" LastEditDate="2018-12-22T17:18:06.747" LastActivityDate="2023-06-06T16:42:00.213" Title="How to avoid denormalized numbers?" Tags="|floating-point|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="126" PostTypeId="2" ParentId="124" CreationDate="2011-08-29T18:44:50.510" Score="13" Body="&lt;p&gt;You're right that the strictly recursive approach is vulnerable to the accumulation of error as the number of iterations increases. One more robust way this is typically done is to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Numerically-controlled_oscillator&quot; rel=&quot;noreferrer&quot;&gt;numerically-controlled oscillator (NCO)&lt;/a&gt;. Basically, you have an accumulator that keeps track of the instantaneous phase of the oscillator, updated as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\delta = \frac{2\pi f}{f_s}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\phi[n] = (\phi[n-1] + \delta) \mod 2\pi&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At each time instant, then, you're left with converting the accumulated phase in the NCO to the desired sinusoidal outputs. How you do this depends on your requirements for computational complexity, accuracy, etc. One obvious way is to just calculate the outputs as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;x_c[n] = \cos(\phi[n])&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;x_s[n] = \sin(\phi[n])&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using whatever implementation of sine/cosine you have available. In high-throughput and/or embedded systems, the mapping from phase to sine/cosine values is often done via a lookup table. The size of the lookup table (i.e. the amount of quantization you do on the phase argument to sine and cosine) can be used as a tradeoff between memory consumption and approximation error. The nice thing is that the amount of computations required is typically independent of the table size. In addition, you can limit your LUT size if needed by taking advantage of the symmetry inherent in the cosine and sine functions; you only really need to store one-fourth of a period of the sampled sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need higher accuracy than a reasonably-sized LUT can give you, then you can always look at interpolation between table samples (linear or cubic interpolation, for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another benefit of this approach is that it is trivial to incorporate frequency or phase modulation with this structure. The frequency of the output can be modulated by varying $\delta$ accordingly, and phase modulation can be implemented by simply adding to $\phi[n]$ directly.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="80" LastEditDate="2011-09-05T02:56:38.623" LastActivityDate="2011-09-05T02:56:38.623" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="127" PostTypeId="2" ParentId="125" CreationDate="2011-08-29T19:41:51.040" Score="12" Body="&lt;p&gt;You can force denormal numbers to zero by setting the &amp;quot;flush to zero&amp;quot; and &amp;quot;denormals are zero&amp;quot; bits (15,6) in the &lt;a href=&quot;https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/set-the-ftz-and-daz-flags.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MXCSR&lt;/a&gt; register.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;_mm_setcsr( _mm_getcsr() | (1&amp;lt;&amp;lt;15) | (1&amp;lt;&amp;lt;6));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2023-06-06T16:42:00.213" LastActivityDate="2023-06-06T16:42:00.213" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="128" PostTypeId="2" ParentId="124" CreationDate="2011-08-29T20:13:26.183" Score="7" Body="&lt;p&gt;You can avoid the unstable magnitude drift if you do not make it recursively update the vector v.&#xA;Instead, rotate your prototype vector v to the current output phase.  This still requires some trig functions, but only once per buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No magnitude drift and arbitrary frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;init(freq)&#xA;  precompute Nphasor samples in phasor&#xA;  phase=0&#xA;&#xA;gen(Nsamps)&#xA;    done=0&#xA;    while done &amp;lt; Nsamps:&#xA;       ndo = min(Nsamps -done, Nphasor)&#xA;       append to output : multiply buf[done:done+ndo) by cexp( j*phase )&#xA;       phase = rem( phase + ndo * 2*pi*freq/fs,2*pi)&#xA;       done = done+ndo&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can do away with the multiply, the trig functions required by cexp, and the modulus remainder over 2pi if you can tolerate a quantized frequency translation. e.g. fs/1024 for a 1024 sample phasor buffer.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2011-08-29T20:13:26.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="129" PostTypeId="1" AcceptedAnswerId="2098" CreationDate="2011-08-29T20:40:33.097" Score="23" ViewCount="11330" Body="&lt;p&gt;I would like to compute a power spectrum in which the frequencies are logarithmically spaced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;http://en.wikipedia.org/wiki/Welch%27s_method&quot;&gt;Welch's method&lt;/a&gt; there is a trade-off between the frequency resolution of the resulting power spectrum and the number of averages (i.e. error in the result).  I would like this trade-off to be dynamic, i.e. do fewer averages for low-frequency points in order to have a finer resolution at low frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a standard way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose one way would be to initially do &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/pwelch.html&quot;&gt;&lt;code&gt;pwelch&lt;/code&gt;&lt;/a&gt; with a very high resolution (low number of averages), and then rebin the resulting spectrum using logarithmic binning.&lt;/p&gt;&#xA;" OwnerUserId="64" LastActivityDate="2012-04-18T14:23:27.877" Title="How can I compute a log-spaced power spectrum?" Tags="|dft|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="130" PostTypeId="2" ParentId="129" CreationDate="2011-08-30T02:14:04.350" Score="1" Body="&lt;p&gt;In this case, I would use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Least-squares_spectral_analysis&quot; rel=&quot;nofollow&quot;&gt;least squares method&lt;/a&gt; to calculate the frequency of some known list of values. The most common method is the Lomb method. It works quite similar to a FFT or DFT, but it will only calculate the frequency at per-determined frequencies, and it could handle missing data, should that be an issue. The idea is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Decide a list of frequencies ($w$) over which to calculate, that fit the desired frequency bands you wish to sample at. &lt;/li&gt;&#xA;&lt;li&gt;Given the frequencies $w$, times at which they were sampled $t_j$, and values $X_j$, find the power of the frequencies as follows:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$P_x(\omega) = \frac{1}{2} &#xD;&#xA;\left(&#xD;&#xA;  \frac { \left[ \sum_j X_j \cos \omega ( t_j - \tau ) \right] ^ 2}&#xD;&#xA;        { \sum_j \cos^2 \omega ( t_j - \tau ) }&#xD;&#xA;+&#xD;&#xA; \frac {\left[ \sum_j X_j \sin \omega ( t_j - \tau ) \right] ^ 2}&#xD;&#xA;        { \sum_j \sin^2 \omega ( t_j - \tau ) }&#xD;&#xA;\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, this will not scale as nicely as an FFT will, so I would only do this if the number of desired frequencies is much lower than the FFT which would be required to collect all of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, one could do an interpolation method or any other re-sampling of an FFT or DFT.&lt;/p&gt;&#xA;" OwnerUserId="88" LastActivityDate="2011-08-30T02:14:04.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="131" PostTypeId="1" AcceptedAnswerId="133" CreationDate="2011-08-30T13:45:24.353" Score="16" ViewCount="11667" Body="&lt;p&gt;Suppose we have a linear represented in the standard state space notation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \dot{x}(t)=Ax(t)+Bu(t)$$&#xA;$$y(t) = Cx(t) + Du(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get its impulse response, it is possible to take its Laplace transform to get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$sX=AX+BU$$&#xA;$$Y=CX+DU$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then solve for the transfer function which is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{Y}{U}=C(sI-A)^{-1}B+D$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for a discrete system, the $\mathcal{Z}$-transform of&#xA;$$ x[n+1]=Ax[n]+Bu[n]$$&#xA;$$y[n] = Cx[n] + Du[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{Y}{U}=C(zI-A)^{-1}B+D$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This process seems a bit long and I remember that there is a way to find the impulse response using the state transition matrix which is the solution for $x$ of the first equations of each pair. Does anyone know how to do this?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="77" LastEditDate="2011-08-30T18:41:43.063" LastActivityDate="2011-08-30T20:11:20.233" Title="How do I find a system's impulse response from its state-space repersentation using the state transition matrix?" Tags="|impulse-response|state-space|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="132" PostTypeId="1" AcceptedAnswerId="140" CreationDate="2011-08-30T17:55:22.720" Score="25" ViewCount="17565" Body="&lt;p&gt;Is there a generically accepted method of removing motion blur from an image. For a simple case, we can assume that motion happens in a straight line. I assume that it's a two part process composed of motion estimation and then deconvolution, but how is it actually done?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="4682" LastEditDate="2013-07-06T01:59:20.120" LastActivityDate="2018-07-30T15:26:38.087" Title="How do I remove motion blur?" Tags="|image-processing|blur|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="133" PostTypeId="2" ParentId="131" CreationDate="2011-08-30T20:11:20.233" Score="7" Body="&lt;p&gt;You can approach the problem using the state transition matrix by solving the standard non-homogeneous ODE in the first equation. The solution to $\dot{x}(t)=A x(t) + B u(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=x_0 e^{At}+\int_{0}^te^{A(t-t&amp;#39;)}Bu(t&amp;#39;)dt&amp;#39;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_0=x(0)$. The quantity $e^{At}$ is called the state transition matrix (also the solution to the homogeneous ODE), which I'll refer to as $\Xi(t)$ (I don't recall the standard notation for this). Taking $x_0=0$, the equation for $y(t)$ becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=C\int_0^t\Xi(t-t&amp;#39;)Bu(t&amp;#39;)dt&amp;#39;+Du(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above equation gives you the output as the input convolved with the system impulse response and indeed, you can take the Laplace transform of the above equation to verify. Noting that the Laplace transform of $\Xi(t)=e^{At}$ is $(sI-A)^{-1}$ and convolutions in the time domain become products in the s-domain, we get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y=C(sI-A)^{-1}BU+DU$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives you the same transfer function as in your question.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Regarding your comment on the fully Laplace transform approach being long, I wouldn't necessarily say it is so. However, state transition matrix approach might be &lt;em&gt;simpler to implement&lt;/em&gt;, because several operations involving it can be computed with simple matrix multiplications and nothing more.&lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-08-30T20:11:20.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="134" PostTypeId="1" AcceptedAnswerId="144" CreationDate="2011-08-30T21:51:01.283" Score="15" ViewCount="1762" Body="&lt;p&gt;Suppose I've got an audio signal sampled at $48000$ Hz, and I'd like to design a low-pass filter that isolates everything below ~$60$Hz. In the digital world, this is a low-pass filter with the passband at $[-\frac{\pi}{400} , \frac{\pi}{400} ] $. Also, the transition band should be reasonable as well. Building a FIR filter for this can have a lot of taps which in the long run affects precision. An IIR filter is too not ideal because audio suffers for non-linear-phase response in filters, so unless the signal is filtered, then reversed and filtered again, it is not really an option. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could a wavelet transform be better at this than in-one-go regular filtering?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="1473" LastEditDate="2012-07-01T23:26:15.117" LastActivityDate="2016-01-10T14:13:52.183" Title="How can I design a very narrow filter?" Tags="|filters|finite-impulse-response|infinite-impulse-response|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="135" PostTypeId="1" AcceptedAnswerId="150" CreationDate="2011-08-31T00:49:18.183" Score="9" ViewCount="161" Body="&lt;p&gt;In trying to understand &lt;a href=&quot;https://dsp.stackexchange.com/questions/36/how-can-i-estimate-the-spatial-resolution-of-consumer-grade-electronics/40#40&quot;&gt;this answer&lt;/a&gt; to &lt;a href=&quot;https://dsp.stackexchange.com/q/36/36&quot;&gt;my earlier question&lt;/a&gt;, can someone explain why it is important that the cameras are not in the same plane when the focal distance is large compared to the separation between the cameras and the object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is meant by &quot;looking in&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this change if the number of views/cameras increases?&lt;/p&gt;&#xA;" OwnerUserId="36" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-07-06T02:00:17.437" Title="In computer stereo vision, what does it mean to &quot;look in&quot;?" Tags="|computer-vision|stereo-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="140" PostTypeId="2" ParentId="132" CreationDate="2011-09-01T00:22:22.037" Score="12" Body="&lt;p&gt;Yes, deconvolution.  This page describes a number of deconvolution methods and methods for estimating the point spread function:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.sweaglesw.com/cs448/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Removing Motion Blur from Astrophotographic Images&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;They say the deconvolution literature is &quot;extremely extensive&quot;.   They choose &lt;a href=&quot;http://en.wikipedia.org/wiki/Richardson%E2%80%93Lucy_deconvolution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lucy-Richardson algorithm&lt;/a&gt; for deconvolution and develop their own motion estimation algorithm for determining the point spread function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fT42Z.jpg&quot; alt=&quot;before&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Y4Lg9.jpg&quot; alt=&quot;after&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2018-07-30T15:26:38.087" LastActivityDate="2018-07-30T15:26:38.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="141" PostTypeId="2" ParentId="132" CreationDate="2011-09-01T04:35:55.523" Score="9" Body="&lt;p&gt;Removing motion blur, with the exception of blur from either point source objects, or near point source objects, can be quite difficult. The general steps are as follows. Note, some of this information comes from a paper entitled &quot;&lt;a href=&quot;http://research.microsoft.com/pubs/75571/Joshi-CVPR08.pdf&quot;&gt;PSF estimation using Sharp Edge Prediction&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the equivalent PSF for the motion blur. This may vary in different regions of the FPA, depending on how wide the lens is, and what kind of motion it is subject to. The easiest way is to find a point source object, and find it's PSF. This can be accomplished if the background is uniform, especially if it is uniformly dark, such as stars. A more complex method could involve looking for edges, and seeing the effective PSF at that edge. The edge will give you a one dimensional PSF, but can be used to find a complete PSF.&lt;/li&gt;&#xA;&lt;li&gt;Using the PSF, deconvolve the image. As Endolith previously mentioned, there is a plethora of deconvolution algorithms, choose one to meet your needs.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="88" LastActivityDate="2011-09-01T04:35:55.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="142" PostTypeId="2" ParentId="134" CreationDate="2011-09-01T06:27:01.410" Score="6" Body="&lt;p&gt;Try an overlap add/save convolution filter with the longest FFT/IFFT that fits your latency and computational performance constraints.  You can design extremely long FIR filters when using this method with even longer FFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can FFT the entire song, or your entire audio signal file, in one very long FFT+IFFT (there are special FFT algorithms for long vectors that don't fit in dcache or RAM), you won't need to do any overlap add/save processing, and you can get a very narrow transition band.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-09-01T06:27:01.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="143" PostTypeId="1" CreationDate="2011-09-01T15:40:42.207" Score="20" ViewCount="578" Body="&lt;p&gt;The following paper describes an application of the Teager-Kaiser energy operator to x-ray image enhancement:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Reinhard Bernstein, Michael S. Moore and Sanjit K. Mitra, &lt;em&gt;&quot;Adjustable&#xA;  Quadratic Filters for Image Enhancement&quot;&lt;/em&gt; Proc. IEEE International&#xA;  Conference on Image Processing (ICIP), Santa Barbara, CA, vol. 1, pp.&#xA;  287-290, Oct. 1997. &lt;a href=&quot;http://vision.ece.ucsb.edu/publications/view_abstract.cgi?52&quot;&gt;http://vision.ece.ucsb.edu/publications/view_abstract.cgi?52&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The authors develop intuition for the behavior of the filter through analogy with a similar linear operator (i.e. &lt;em&gt;&quot;Thus the output of a Teager filter is approximately equal to a highpass filter response weighted by the local mean.&quot;&lt;/em&gt;). For the sake of precision, by quadratic polynomial filters, I mean non-linear, non-recursive filters that can be completely characterized by a truncated &lt;a href=&quot;http://en.wikipedia.org/wiki/Volterra_series&quot;&gt;Volterra Series&lt;/a&gt;, as follows (for the 1D case):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;y(n) = \sum_{m_1=0}^{N_1-1}{ h_1(m_1)x(n - m_1) } + \sum_{m_1=0}^{N_2-1}{\hphantom{.}\sum_{m_2=0}^{N_2-1}{ h_2(m_1,m_2)x(n - m_1)x(n - m_2) } } &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that most approaches to the design of low-order polynomial filters involve system identification frameworks, but without any deep understanding as to why the estimated filters work.  Are analytic approaches based on linear analogies currently the state-of-the-art, or are there any known mathematical tools that can be used?&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="35" LastEditDate="2012-04-17T18:04:56.670" LastActivityDate="2013-10-02T14:31:24.193" Title="Are there any analytic approaches to the design of quadratic polynomial filters?" Tags="|filters|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="144" PostTypeId="2" ParentId="134" CreationDate="2011-09-01T15:54:37.937" Score="22" Body="&lt;p&gt;If you are optimizing for engineering time and are on a platform that supports large FFTs well (i..e not fixed point), then take hotpaw2's advice and use &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap-save_method&quot;&gt;fast convolution&lt;/a&gt;.  It will perform much better than a naive FIR implementation and should be relatively easy to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if you have some time to spend on this to get the best implementation or are on a fixed-point platform, you should use a &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0131465112&quot;&gt;multirate&lt;/a&gt; down-filter-up-subtract structure.  But it's a bit trickier to get everything right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got access to trusted and highly optimized implementations of both fast convolution and multirate filtering tools. The fast convolution takes about 3x longer to get equivalent signal performance compared to the multirate structure.  Furthermore, that is even on a floating point platform. The gap would widen considerably on a fixed point dsp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general terms:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Down-conversion:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Use 8 stages of halfband,decimate-by-2 filters to transform your 48kHz signal into a 187.5 Hz signal.  The first stage of this downsampling can have a very wide transition band, allowing energy to alias as long as it doesn't alias back into the sub 60 Hz range. As the stages progress, the number of taps needs to increase, but they will be applied at a progressively lower sampling rates, so the overall cost of each stage remains small.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Filtering:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Perform your tight filtering around the 60 Hz bw to keep the energy you will eventually want to subtract.  There is a double advantage to doing your tight filtering at the low rate: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;1Hz of transition bandwidth is 256 times larger in terms of digital frequency at the low rate vs. the original rate. So every tap of your filter is 256 times as powerful.&lt;/li&gt;&#xA;&lt;li&gt;The signal itself is at a lower rate, so the filter only needs to process 1/256 the data.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Up-conversion:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Essentially, this is the reverse of the decimation stages.  Each of the 8 interpolator stages doubles the rate by estimating the sample that goes between consecutive input samples.  The transition band gets wider as the sample rate gets higher.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Subtract:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Subtract your full-rate low-pass filtered signal from the original signal. If you've adjusted for all the group delays properly, the overall structure will be a highpass filter with a narrow transition bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2011-09-01T19:20:50.687" LastActivityDate="2011-09-01T19:20:50.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="145" PostTypeId="1" CreationDate="2011-09-01T17:18:32.993" Score="14" ViewCount="1555" Body="&lt;p&gt;What techniques might one use to estimate the onset time of a sinusoidal tone burst in a noisy signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the tone burst has a known fixed frequency (but unknown phase) and a very sharp rise time, and that the goal is to estimate the onset time within better than half the rise time, and/or one period of the frequency of the tone, if possible.  How might the estimation techniques change if the S/N ratio is very low (much less than 1)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added: Assume the tone burst is of unknown length, but longer than a small multiple of the rise time and the frequency period. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added: A DFT/FFT shows the very probable existence of a tone.  The problem is figuring out exactly precisely where in the FFT window the tone (or perhaps multiple tone bursts of the same frequency) may have started within the FFT window, or determining if the current tone started outside that DFT window, provided I have all that additional time domain data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Radar pulse detection accuracy is closer to the resolution I need, except I only have an edge, as the tone is of unknown length, and, other than a known rise time, unmodulated.  Narrow band pass filters distort the rise time, and thus kill edge arrival estimation resolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="80" LastEditDate="2016-05-16T14:01:43.903" LastActivityDate="2016-05-16T14:01:43.903" Title="Estimating onset time of a tone burst in noise?" Tags="|audio|algorithms|edge-detection|" AnswerCount="1" CommentCount="27" ContentLicense="CC BY-SA 3.0" />
  <row Id="146" PostTypeId="1" CreationDate="2011-09-02T19:55:28.543" Score="14" ViewCount="592" Body="&lt;p&gt;Compared to standard (conventional) beamformers, adaptive beamformers such as minimum variance distortionless response (MVDR) have much better resolution and interference nulling capabilities. Briefly, the MVDR beamformer is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $\mathbf{a}_\theta$ is the look-vector in the direction $\theta$ and if $\widehat{\mathbf{R}}$ is the covariance matrix of observations, then the adaptive weight vectors are calculated as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{w}_\theta=\frac{\widehat{\mathbf{R}}^{-1} \mathbf{a}_\theta}{\mathbf{a}^H_\theta \widehat{\mathbf{R}}^{-1} \mathbf{a}_\theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the output power of the MVDR beamformer is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$B_{mvdr}(\theta)=\mathbf{w}_\theta^H \widehat{\mathbf{R}}\mathbf{w}_\theta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of completeness, the conventional beamformer output power is $B_{conv}(\theta)=\mathbf{a}_\theta^H \widehat{\mathbf{R}}\mathbf{a}_\theta$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, these adaptive beamformers are also prone to severe performance hits when there is a signal mismatch i.e., when the steering vector model for the signal of interest doesn't match what's in the data or when the actual array positions are perturbed from the array positions used in the steering/look vectors (which is what happens in practice). The performance degradation can be so large that it becomes inferior to the conventional beamformer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can one increase the robustness of adaptive beamformers (in this case, the MVDR, but applicable more generally) to signal mismatches?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Example:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Here's the result from a simulation with two plane wave signals, one at $+30^\circ$ and the other at $-22.5^\circ$ and 10 dB down from the first, impinging on a 10 element uniform line array (spaced at $\lambda/2$, where $\lambda$ is the wavelength) in a noisy environment (the exact value of the noise power is immaterial here and you can assume it to be much lower than the signal powers). The covariance matrix is formed from 50 observations (snapshots). The top two panels show the outputs of the MVDR and the conventional beamformers and you can clearly see that the MVDR has high resolution compared to the conventional. Both do a good job of estimating the signal power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when the element positions are slightly perturbed (perturbation is unknown to the beamformer), causing a mismatch in the actual signal steering vector and the model, the signal power estimates of the MVDR beamformer goes kaput. It can hardly measure them correctly, although it still does a good job of localising the signals. Comparatively, the conventional beamformer gets the relative powers right, although its harder to localise the signal due to increased sidelobes. (Note: The plots have all been normalized by the maximum power so although you can't see it, the peak at $30^\circ$ in the top left plot is at 0 dB. So this doesn't truly show how the &lt;em&gt;actual&lt;/em&gt; power estimate degrades due to mismatches, as I just wanted to paint a qualitative picture.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VvzkF.png&quot; alt=&quot;Plots with MVDR Perturbed Array sloppily corrected in Gimp&quot;&gt;&#xA;http://dsp.stackexchange.com/questions/146/how-can-one-improve-the-robustness-of-adaptive-beamformers-to-signal-mismatches#comment-308 :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The title for the lower left plot should read MVDR: Perturbed array. &#xA;  I'll correct the mistake sometime soon. &#xA;  – yoda Sep 3 at 5:28&#xA;  --&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is it possible for me to improve the estimates of the signal powers using the MVDR beamformer in the perturbed case?&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="26573" LastEditDate="2019-12-31T13:12:09.117" LastActivityDate="2019-12-31T13:12:09.117" Title="How can one improve the robustness of adaptive beamformers to signal mismatches?" Tags="|beamforming|distortion|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="147" PostTypeId="1" CreationDate="2011-09-03T11:05:12.273" Score="27" ViewCount="3967" Body="&lt;p&gt;In Hamming's book, &lt;a href=&quot;http://books.google.com/books?id=49QuCOLIJLUC&amp;amp;dq=inauthor%3a%22Richard+W.+Hamming%22&amp;amp;source=gbs_navlinks_s&quot;&gt;The Art of Doing Science and Engineering&lt;/a&gt;, he relates the following story:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A group at Naval Postgraduate School was modulating a very high&#xA;  frequency signal down to where they could afford to sample, according&#xA;  to the sampling theorem as they understood it.  But I realized if they&#xA;  cleverly sampled the high frequency then the sampling act itself would&#xA;  modulate (alias) it down.  After some days of argument, they removed&#xA;  the rack of frequency lowering equipment, and the rest of the&#xA;  equipment ran better!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Are there any other ways to use aliasing as a &lt;em&gt;primary technique&lt;/em&gt; for processing a signal, as opposed to a side-effect to be avoided?&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="80" LastEditDate="2011-09-03T15:45:07.267" LastActivityDate="2011-09-17T20:29:42.080" Title="When is aliasing a good thing?" Tags="|sampling|bandpass|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="148" PostTypeId="2" ParentId="147" CreationDate="2011-09-03T15:17:37.077" Score="19" Body="&lt;p&gt;The quoted text in the question is a case of using &lt;a href=&quot;http://www.ws.binghamton.edu/fowler/fowler%20personal%20page/EE521_files/II-2%20BP%20Sampling_2007.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;bandpass sampling&lt;/em&gt;&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;undersampling&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, to avoid &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;noreferrer&quot;&gt;aliasing&lt;/a&gt; distortion, the signal of interest must be &lt;a href=&quot;http://en.wikipedia.org/wiki/Bandpass&quot; rel=&quot;noreferrer&quot;&gt;bandpass&lt;/a&gt;. That means that the signal's power spectrum is only non-zero between $f_L &amp;lt; |f| &amp;lt; f_H$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we sample the signal at a rate $f_s$, then the condition that the subsequent repeated spectra do not overlap means we can avoid aliasing. The repeated spectra happen at every integer multiple of $f_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, we can write this condition for avoiding aliasing distortion as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2 f_H}{n} \le f_s \le \frac{2 f_L}{n - 1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n$ is an integer that satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1 \le n \le \frac{f_H}{f_H - f_L}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a number of valid frequency ranges you can do this with, as illustrated by the diagram below (taken from the wikipedia link above).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2a8ti.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above diagram, if the problem lies in the grey areas, then we can avoid aliasing distortion with bandpass sampling --- even though the sampled signal is aliased, we have not distorted the shape of the signal's spectrum.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="77" LastEditDate="2011-09-03T22:24:14.860" LastActivityDate="2011-09-03T22:24:14.860" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="149" PostTypeId="2" ParentId="147" CreationDate="2011-09-04T03:07:27.430" Score="12" Body="&lt;p&gt;One instance that jumps to mind is digital demodulation.  The optimal detector for a linear modulation scheme is matched filtering and decimating to the middle sample of each symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matched filtering may not do a very good job of reducing the bandwidth, but we still want to make decisions at the symbol rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aliasing of energy in this case is part of reconstructing the modulated symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key point is that the energy must alias coherently in the correct phase i.e. timing is crucial.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2011-09-06T18:48:42.930" LastActivityDate="2011-09-06T18:48:42.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="150" PostTypeId="2" ParentId="135" CreationDate="2011-09-04T15:53:33.720" Score="4" Body="&lt;p&gt;&quot;Looking-in&quot; simply means that the cameras will need to be angled such that their principal axes cross over at some point in front of the camera (rather than being parallel as is often assumed for stereo work)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for doing this when the cameras are far apart is also simple: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stereo requires you to match features from one image to the other. Hence the cameras must both have a view of the objects you are interested in.  Parallel cameras only overlap when the object is sufficiently far away - by pointing them inwards, you can solve this. (Of course, if your object looks significantly different from the two viewpoints, you still won't be able to do a good stereo match.)&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2011-09-04T15:53:33.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="151" PostTypeId="2" ParentId="145" CreationDate="2011-09-04T19:47:40.627" Score="6" Body="&lt;p&gt;As we've been discussing in the comments, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Goertzel algorithm&lt;/a&gt; is the usual way to detect a tone in noise.  After the discussion, I'm not sure it's quite what you are after (you want the &lt;em&gt;onset time&lt;/em&gt;), but there seemed to be confusion over how the Goertzel algorithm might be applied to your problem, so I thought I'd write it up here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Goertzel Algorithm&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Goertzel algorithm is good to use if you know the frequency of the tone you are looking for (call it $f_g$), and if you have a reasonable idea of the noise level so that you can select an appropriate detection threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Goertzel algorithm can be thought of as always calculating the output of ONE FFT bin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) = e^{\jmath 2\pi f_g n} \sum_{k=0}^n x(n) e^{-\jmath 2\pi f_g k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_g$ is the frequency you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm#Implementation&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Wikipedia page&lt;/a&gt; has a better way to calculate this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a (feeble) &lt;a href=&quot;http://www.scilab.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scilab&lt;/a&gt; attempt at implementing it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [y,resultr,resulti] = goertzel(f_goertzel,x)&#xA;realW = 2.0*cos(2.0*%pi*f_goertzel);&#xA;imagW = sin(2.0*%pi*f_goertzel);&#xA;&#xA;d1 = 0;&#xA;d2 = 0;&#xA;&#xA;for n = 0:length(x)-1,&#xA;    y(n+1) = x(n+1) + realW*d1 - d2;&#xA;    d2 = d1;&#xA;    d1 = y(n+1);&#xA;    resultr(n+1) = 0.5*realW*d1 - d2;&#xA;    resulti(n+1) = imagW*d1;&#xA;end&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Consider the signal with $f = 0.0239074$ and $\phi = 4.4318752$ :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x = \sin(2\pi fn + \phi) + \epsilon(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\epsilon(n)$ is zero-mean, unit variance Gaussian white noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, the tone starts one third of the way into the signal at index 1001.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we run the Goertzel algorithm on it with $f_g = f - 0.001$ then we get the top two traces of the figure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we run the Goertzel algorithm on it with $f_g = f$ then we get the bottom two traces of the figure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The four traces are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$x$ (blue) and $y$ (red) for $f_g = 0.0229074$&lt;/li&gt;&#xA;&lt;li&gt;The resulting $\sqrt{resultr^2 + resulti^2}$&lt;/li&gt;&#xA;&lt;li&gt;$x$ (blue) and $y$ (red) for $f_g = 0.0239074$&lt;/li&gt;&#xA;&lt;li&gt;The resulting $\sqrt{resultr^2 + resulti^2}$ (solid line) and the first result (dashed line).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As you can see, the case where the tone we are interested in is present peaks at about 250.  If we set the detection threshold at about half this value (125), then the detection occurs (the square-rooted value is greater than 125) at about index 1450 --- 450 samples after the tone started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This threshold (125) will not cause a detection in the other case (for this run, anyway), but the maximum value of that output is 115.24, we we cannot reduce the threshold too much without getting a false detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reducing the threshold to 116 will cause detection in the true case (for this run) at index 1401... but we run the risk of more false alarms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/96qMJ.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2011-09-04T20:09:47.640" LastActivityDate="2011-09-04T20:09:47.640" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="152" PostTypeId="2" ParentId="74" CreationDate="2011-09-04T23:51:09.620" Score="7" Body="&lt;p&gt;&lt;strong&gt;SUSAN Approach&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach to edge and corner detection is &lt;a href=&quot;http://users.fmrib.ox.ac.uk/~steve/susan/susan/susan.html&quot;&gt;the SUSAN approach&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this approach, rather than derivative approximations, &lt;a href=&quot;http://users.fmrib.ox.ac.uk/~steve/susan/susan/node2.html#SECTION00020000000000000000&quot;&gt;an integral approximation&lt;/a&gt; approach is used.  This has the advantage of not only being able to detect edges, but also to be able to detect &quot;two dimensional features&quot; (i.e. corners).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another advantage of a integral approximation approach is that noise tends to have less of an effect on the results.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2011-09-05T20:38:16.713" LastActivityDate="2011-09-05T20:38:16.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="153" PostTypeId="2" ParentId="103" CreationDate="2011-09-05T04:03:14.363" Score="7" Body="&lt;p&gt;Papoulis introduced a generalization of the sampling theorem [1], of which derivative sampling approach is one case. The gist of the theorem, quoting from [2] is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In 1977, Papoulis introduced a powerful extension of Shannon’s sampling theory, showing that a band-limited signal could be reconstructed exactly from the samples of the response of $m$ linear shift-invariant systems sampled at $1/m$ the reconstruction rate. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Perhaps one reason why it's hard to search for the term is because Papoulis' generalized sampling theorem is mentioned more often than &quot;derivative sampling&quot;. [2] is also a very good article which presents a broad overview of the sampling approaches at the time of publication. [3], also by the same author is an extension of [1] to the class of non-bandlimited functions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for applications, in a recent paper [4], the derivative sampling approach is used to design wideband fractional delay filters and the authors show that sampling the derivative results in smaller errors. From the abstract:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In this paper, the design of wideband fractional delay filter is investigated. First, the reconstruction formula of derivative sampling method is applied to design wideband fractional delay filter by using index substitution and window method. ... Finally, numerical examples are demonstrated to show that &lt;strong&gt;the proposed method has smaller design error than the conventional fractional delay filter without sampling the derivative of signal.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While there certainly are more, I'll refrain from posting more references and application to keep it short (and avoid it turning into a list). A good point to start looking would be to check which papers have cited [1]-[3] and narrow down the list based on the abstract.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1]: A. Papoulis, “Generalized sampling expansion,” &lt;em&gt;IEEE Trans. Circuits and Systems&lt;/em&gt;, vol. 24, no. 11, pp. 652-654, 1977.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2]: &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=843002&quot;&gt;M. Unser, &quot;Sampling - 50 years after Shannon,&quot; &lt;em&gt;Proceedings of the IEEE&lt;/em&gt;, vol. 88, num. 4, p. 569-587, 2000&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3]: &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=718806&quot;&gt;M. Unser and J. Zerubia, &quot;A generalized sampling theory without band-limiting constraints,&quot; &lt;em&gt;IEEE Trans. Circuits and Systems II&lt;/em&gt;, vol. 45, num. 8, p. 959–969, 1998&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[4]: &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=05361351&quot;&gt;C-C Tseng and S-L Lee, &quot;Design of Wideband Fractional Delay Filters Using Derivative Sampling Method&quot;, &lt;em&gt;IEEE Trans. Circuits and Systems I&lt;/em&gt;, vol. 57, num. 8, p. 2087-2098, 2010&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-09-05T04:03:14.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="154" PostTypeId="2" ParentId="74" CreationDate="2011-09-05T08:59:08.430" Score="6" Body="&lt;p&gt;Canny yields a binary image and is dependent on externally given thresholds (which are image/application dependent).&lt;br&gt;&#xA;Convolution based filters yield an &quot;edge intensity&quot; image. This is useful if the edge weight or strength is important (e.g. in weighted Hough Transform).&lt;/p&gt;&#xA;" OwnerUserId="163" LastActivityDate="2011-09-05T08:59:08.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="155" PostTypeId="2" ParentId="114" CreationDate="2011-09-06T22:34:33.300" Score="5" Body="&lt;p&gt;An straightforward alternative to a Viterbi decoder for decoding convolutional codes is a Sequential Decoder.   The algorithm is simpler, but the performance isn't as good.   For example, the common constraint lengths for systems using Viterbi decoding are typically k = 7 or k = 9.  A system decoded with a sequential decoder typically has a constraint length in the thirties or so.   The complexity of a Viterbi decoder would be prohibitive at such a long constraint length, and the performance of a Sequential Decoder is very poor with the short constraint lengths used with a Viterbi decoder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another alternative would be to use an APP or MAP decoder, but those are more complex than a Viterbi decoder (since they're essentially two Viterbi decoders running together in opposite directions).  But if you just want to say you're not using a &quot;Viterbi&quot; decoder that might qualify.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2011-09-06T22:34:33.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="156" PostTypeId="2" ParentId="93" CreationDate="2011-09-07T00:04:06.697" Score="3" Body="&lt;p&gt;Yes, DCT can be used to provide a magnitude spectrum with twice the density. I do not quite understand overlap, but I am assuming that since DCT covers less, you thought there would be an overlap. To provide an eligible answer to the question, let me make a quick review for usage of DCT in mainly image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we need to make some assumptions. In order to use DCT, you need to have a real signal. This is by definition. While you are saying, DCT has half the bin size comparing to DFT in size N, you are assuming that the signal is low frequency signal. Otherwise, not so much.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For usage of DCT in compression, since DFT of image will be symmetric, it produces redundant information (one side mirror will be enough to reproduce the signal). Therefore, kernel of DCT is used in order to produce denser information comparing to DFT. This is also true for low frequency audio signals, it can be used in the same way. While it makes it denser, coefficients gets bigger, since kernel of DCT covers both sides(real and imaginary parts) of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My major is image processing, so I tried to map DCT and DFT concepts and explanations in image processing. One difference between image and audio could be sizes, though. In image processing, you know the sizes(row and columns for FFT and other purpose of processing). I guess that you need to divide the vector of audio data somehow in order to further process. Without knowing the data, this could be troublesome(I am not sure).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an image taken from web, but I did not write it down where I took it, could be wikipedia.;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9RNHE.png&quot; alt=&quot;Image Processing&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, transformed image is represented in DCT by magnitude spectrum with no problem. In a more compact and denser way, and look at the magnitude of coefficients. It is bigger than two times of DFT. DFT is symmetric, you could just divide it into two. One part is redundant. And one more thing, DCT can store the information is not just half of DFT but nearly quarter of DFT. That is generally the case of DCT overcoming to DFT in images.&lt;/p&gt;&#xA;" OwnerUserId="175" LastEditorUserId="77" LastEditDate="2011-09-07T01:08:26.080" LastActivityDate="2011-09-07T01:08:26.080" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="157" PostTypeId="1" CreationDate="2011-09-07T01:53:43.580" Score="-2" ViewCount="667" Body="&lt;p&gt;We know that in quantum mechanics, momentum space is the fourier transform of position space (and vice versa)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also, in time-series analysis, that frequency (of cycles) is the fourier transform of the distribution of all cycle lengths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about electromagnetic radiation? Is the distribution of frequencies the Fourier transform of the distribution of wavelengths?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it physically feasible to think of a distribution of positions (each position value with a certain count), and then to take a fourier transform of that, and end up with a distribution of momentum values? Even in JPG compression, you have frequency and position (each position value has a certain count that corresponds to the color value on a scale of $0$ to $255$)&lt;/p&gt;&#xA;" OwnerUserId="173" LastEditorUserId="1473" LastEditDate="2012-07-01T20:51:34.623" LastActivityDate="2012-07-01T20:51:34.623" Title="In Fourier transforms, can momentum space be analogized to frequency, and position space be analogized to wavelength?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="158" PostTypeId="1" AcceptedAnswerId="162" CreationDate="2011-09-07T02:05:57.813" Score="-2" ViewCount="205" Body="&lt;p&gt;A signal might have both continuous and discrete parts (where the &quot;discrete&quot; parts are regions where a sinusoidal Fourier transform would be subject to unnecessary Gibbs Noise). So I would think that it could be useful, even if it would require an entirely different implementation strategy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is possible, what are some concrete examples?&lt;/p&gt;&#xA;" OwnerUserId="173" LastEditorUserId="173" LastEditDate="2011-09-07T02:39:51.730" LastActivityDate="2011-09-07T14:44:23.623" Title="Is it possible for a signal to be represented by *both* sinusoidal *and* rectangular/triangular Fourier transforms?" Tags="|fourier-transform|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="159" PostTypeId="1" AcceptedAnswerId="234" CreationDate="2011-09-07T03:01:26.113" Score="10" ViewCount="1434" Body="&lt;p&gt;I am referring to the the following paper : &lt;a href=&quot;http://www.periodistadigital.com/documentos/2010/11/07/espejosalud.pdf&quot;&gt;Non-contact, automated cardiac pulse measurements using video imaging and blind source separation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above article, the authors are able to extract cardiac pulse signal out from RGB components. I try to visualize the process as follow.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R' = R + cardiac pulse&#xA;G' = G + cardiac pulse&#xA;B' = B + cardiac pulse&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;R', G' and B' are the colour components observed by camera. R, G, B are the colour components for a person, by assuming that he doesn't have any cardiac pulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that we will be having 4 sources (R, G, B, Cardiac pulse). We are now trying to obtain 1 of the 4 sources (Cardiac pulse) from 3 mixture signals (R', G', B'), by using ICA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it make sense? Am I missing some techniques? Or, am I making a wrong assumption on the process?&lt;/p&gt;&#xA;" OwnerUserId="184" LastEditorUserId="29" LastEditDate="2013-06-18T20:39:29.730" LastActivityDate="2013-06-18T20:39:29.730" Title="Can ICA be applied, when the number of mixture signal is less than number of source signal?" Tags="|ica|source-separation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="160" PostTypeId="1" AcceptedAnswerId="172" CreationDate="2011-09-07T03:15:50.750" Score="10" ViewCount="7255" Body="&lt;p&gt;When decimating a narrow-band signal with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Cascaded_integrator-comb_filter&quot;&gt;cascaded integrator-comb (CIC) filter&lt;/a&gt;, which  FIR  filter is more suitable to compensate the CIC frecuency response?&lt;/p&gt;&#xA;" OwnerUserId="187" LastEditorUserId="77" LastEditDate="2011-09-08T04:24:03.860" LastActivityDate="2012-10-09T08:13:40.483" Title="FIR filter compensator when using a CIC decimation filter" Tags="|filter-design|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="161" PostTypeId="2" ParentId="159" CreationDate="2011-09-07T04:55:40.123" Score="6" Body="&lt;p&gt;You are making a wrong assumption on the process. In &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;ICA&lt;/a&gt;, the number of mixtures must be &lt;em&gt;at least&lt;/em&gt; as many as the number of components. The paper you cite does in fact, acknowledge this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;These observed signals from the red, green and blue color sensors are denoted by $x_1(t)$, $x_2(t)$ and $x_3(t)$ respectively, which are amplitudes of the recorded signals (averages of all pixels in the facial region) at time point $t$. In conventional ICA the number of recoverable sources cannot exceed the number of observations, thus we assumed three underlying source signals, represented by $s_1(t)$, $s_2(t)$ and $s_3(t)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The conversion $x_i^'=(x_i-\mu_i)/\sigma_i$ is merely centering and sphering of the data, which &lt;a href=&quot;https://dsp.stackexchange.com/questions/80/what-are-the-proper-pre-processing-steps-to-perform-independent-component-analysi/94#94&quot;&gt;I explain in another answer&lt;/a&gt; on this site.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The cases considered in the paper are the noiseless ICA model and noisy ICA. In other words, the heart rate measurements considered at rest (not a pulseless model as you suggested) is the ICA model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{x}(t)=\mathbf{As}(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{x}$ is the observed vector, $\mathbf{s}$ is the underlying component vector and $\mathbf{A}$ is the mixing matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, heart rate measurements when in motion can be considered as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{x}(t)=\mathbf{As}(t)+\mathbf{n}(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{n}(t)$ is a noise vector (in this case the motions).&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2011-09-07T04:55:40.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="162" PostTypeId="2" ParentId="158" CreationDate="2011-09-07T09:18:58.863" Score="3" Body="&lt;p&gt;Yes, but it would be&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculation costly&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;coefficient would depend on number of harmonics $N$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;depend on error norm&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Most probably not worth the effort -you will probably be better with wavelets instead&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can define $N$ and calculate least square error (or other error norm) as (discrete case) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\sum_{k = 0}^{K-1} | f(k) - \sum_{n=0}^{N-1} A_n \cos(2p nk) + B_n \sin(2p nk) + C_n \mathrm{sq_0}(2p nk) + D_n \mathrm{sq_1}(2p nk) |^2 &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and find the minimum of the sum as function of $4N$ variables $A_n$, $B_n$, $C_n$, $D_n.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $A_n, B_n, C_n, D_n$ are your representation&lt;/p&gt;&#xA;" OwnerUserId="198" LastEditorUserId="77" LastEditDate="2011-09-07T14:31:40.260" LastActivityDate="2011-09-07T14:31:40.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="163" PostTypeId="2" ParentId="159" CreationDate="2011-09-07T09:52:47.530" Score="0" Body="&lt;p&gt;When there are more sources than sensors the problem is referred to as over-complete ICA or under-determined ICA. You can google that. &#xA;Your case is more tractable than for instance the case of one sensor and two sources and if your model is really correct you already know the mixing matrix. It might be worth to look further into.&#xA;Cheers&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-09-07T09:52:47.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="164" PostTypeId="2" ParentId="132" CreationDate="2011-09-07T10:25:12.890" Score="0" Body="&lt;p&gt;Just an idea: maybe one should study some HDR imaging for this task.&#xA;There is a &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.129.9780&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; about radiometric camera calibration for composing correct HDR images. It is shown that there is a huge difference between the images resulting by applying synthetic motion blur on LDR and HDR images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a page for this: &lt;a href=&quot;http://ict.debevec.org/~debevec/Research/HDR/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ict.debevec.org/~debevec/Research/HDR/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Motion blur on LDR and HDR images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Aikwh.jpg&quot; alt=&quot;LDR&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/o3Q26.jpg&quot; alt=&quot;HDR&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="156" LastActivityDate="2011-09-07T10:25:12.890" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="165" PostTypeId="2" ParentId="147" CreationDate="2011-09-07T14:07:57.537" Score="8" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Super-resolution&quot;&gt;Super-resolution&lt;/a&gt; is another area where aliasing is necessary, or to put it better, the optical system should not be the weakest link in the chain (and optical components that effectively anti-alias such as anti-moire optical filters should not be part of the chain)&lt;/p&gt;&#xA;" OwnerUserId="208" LastEditorUserId="77" LastEditDate="2011-09-07T14:29:53.583" LastActivityDate="2011-09-07T14:29:53.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="166" PostTypeId="2" ParentId="75" CreationDate="2011-09-07T14:15:08.430" Score="2" Body="&lt;p&gt;One reason to keep the signal oversampled is the dynamic range / oversampling tradeoff. Roughly, every time you double the bandwidth &quot;unnecessarily&quot; for the signal of interest you get an extra bit of sampling resolution, once filtering is applied (which can happen in the digital domain) you can store the results at a higher bit depth and those bits contain valid signal content, not extra noise (for the bandwidth of interest). If your system is operating under conditions where some additional dynamic range could be helpful, then there is a good reason to keep the signal at a high sampling rate as it enters the ADC.&lt;/p&gt;&#xA;" OwnerUserId="208" LastActivityDate="2011-09-07T14:15:08.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="167" PostTypeId="2" ParentId="5" CreationDate="2011-09-07T14:32:39.710" Score="2" Body="&lt;p&gt;With just the information you provide the choice is probably ARM, (simple IIRs and FIRs) but there are other factors to consider such as power requirements, IO requirements, additional features you expect to implement: How much development time would you save if this device had a network connection and an API to modify DSP parameters in the field?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you considered expanding your range of options to smartphones or compact computers such as the Beagle Board? You might realize that the signal processing is only a small part of the entire problem you're solving.&lt;/p&gt;&#xA;" OwnerUserId="208" LastActivityDate="2011-09-07T14:32:39.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="168" PostTypeId="2" ParentId="158" CreationDate="2011-09-07T14:44:23.623" Score="6" Body="&lt;p&gt;An orthogonal set of functions is required for signal decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In basic terms, orthogonality is another way of saying all the functions in the set cover the entire bandwidth of interest without overlap. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no such thing as a rectangular FFT that I know of, but there is in fact a rectangular set of orthogonal functions. One such example is Haar wavelets: &lt;a href=&quot;http://en.wikipedia.org/wiki/Haar_wavelet&quot;&gt;http://en.wikipedia.org/wiki/Haar_wavelet&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, there are applications where a signal is analyzed by more than just an orthogonal transform (such as DCT or FFT) in order to minimize Gibbs noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in AAC compression noise is specifically detected and encoded, instead of just relying on the DCT for noisy portions of the audio (such as applause).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your application and available signal processing resources you are probably looking at a combination of approaches and signal detection to select among them.&lt;/p&gt;&#xA;" OwnerUserId="208" LastActivityDate="2011-09-07T14:44:23.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="169" PostTypeId="1" AcceptedAnswerId="223" CreationDate="2011-09-08T02:07:45.537" Score="14" ViewCount="450" Body="&lt;p&gt;Polyphonic music transcription does not currently appear to be a solved problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How about the inverse of a small portion of the problem.  Are there any kind of spectral characteristics (from an STFT) that can be used to eliminate some musical chords from the probability space?  (e.g. this snippet of sound most likely does not contain any C# chord, or any kind of diminished minor chord, or this is a single note not a chord, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the audio snippet is more-or-less stationary (transient attack removed, etc.), and that overtones for most or all individual notes are very likely present.  (And this question is not about inverted chords.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-09-14T10:55:49.177" Title="Inverse polyphonic chord recognition" Tags="|music|frequency-spectrum|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="170" PostTypeId="2" ParentId="71" CreationDate="2011-09-08T02:24:39.940" Score="6" Body="&lt;p&gt;In image processing, low pass filter makes images smoother, and more blurry since it averages the neighborhood of the pixel. &#xA;High pass filter makes edges become more visible and sharper since it detects edges in images. This is because where edges occur is the most dramatic change occurs in the images. Low pass tries to decrease this dramatic increase or decrease in image by averaging the the neighborhood whereas high pass filter makes it more visible by subtracting the pixel values.  &lt;/p&gt;&#xA;" OwnerUserId="175" LastActivityDate="2011-09-08T02:24:39.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="171" PostTypeId="2" ParentId="147" CreationDate="2011-09-08T02:30:09.733" Score="5" Body="&lt;p&gt;One other time when aliasing isn't a problem is when designing lowpass filters used for decimation. You can allow some amount of aliasing after the decimation operation to relax the constraints on the filter's performance, resulting in a lower-order design. Instead of placing the stopband edge at the post-decimation Nyquist frequency, you can slide it out just far enough that it doesn't alias back into the filter's passband (and therefore corrupt your signal of interest).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stated more mathematically, assume that your original signal is sampled at rate $f_s$ and you are decimating by a factor $D$. The filter's passband edge $f_p$ is defined by the bandwidth of the signal of interest. The Nyquist frequency after decimation will be $\frac{f_s}{2 D}$, so obviously the passband edge frequency must be less than this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I've asserted that you can allow the stopband to bleed past the decimated Nyquist frequency, recall how aliasing in the second Nyquist zone works: any content at frequency $\frac{f_s}{2 D} + \Delta f$ before the decimation operation will appear to be located at $\frac{f_s}{2 D} - \Delta f$ afterward. Thus, we can place the stopband edge at some frequency $f_{stop} = \frac{f_s}{2 D} + \Delta f$ and select $\Delta f$ in such a way that the filter's transition band doesn't overlap with the passband after we decimate. In order for this to be true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_{stop_{aliased}} = \frac{f_s}{2 D} - \Delta f \ge f_p&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Delta f \le \frac{f_s}{2 D} - f_p&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The takeaway from this is if there is still a decent amount of oversampling present in the post-decimated signal (&lt;a href=&quot;https://dsp.stackexchange.com/questions/75/why-would-i-leave-a-signal-oversampled&quot;&gt;there are some reasons why you would do this&lt;/a&gt;), then you can push the stopband out by a nontrivial amount. As a quantitative measure, you can look at the transition ratios of the &quot;naive&quot; and &quot;relaxed&quot; filter specifications:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T_{naive} = \frac{f_p}{f_{stop_{naive}}} = \frac{f_p}{\frac{f_s}{2 D}} = \frac{2 D f_p}{f_s}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T_{relaxed} = \frac{f_p}{f_{stop_{relaxed}}} = \frac{f_p}{\frac{f_s}{2 D} + (\frac{f_s}{2 D} - f_p)} = \frac{f_p}{\frac{f_s}{D} - f_p}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{T_{relaxed}}{T_{naive}} = \frac{\frac{f_p}{\frac{f_s}{D} - f_p}}{\frac{2 D f_p}{f_s}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{T_{relaxed}}{T_{naive}} = \frac{1}{2 - \frac{f_p}{\frac{f_s}{2 D}}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This last expression gives you a compact representation of the improvement in transition ratio that can be obtained by relaxing the filter specification in this way, parameterized by the ratio of the filter's passband (i.e. the signal of interest's bandwidth) to the post-decimation Nyquist frequency. Plotting this ratio as a function of the passband frequency (normalized by the post-decimation sample rate), you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HinxH.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in summary, if your signal is still decently oversampled after the decimation operation, then you can reduce the filter's transition ratio by a factor of up to 2 by relaxing its specification in this way. As a rule of thumb, the number of required taps for an FIR filter is roughly proportional to the transition ratio. It does allow some aliasing when performing the decimation, but the specifications are designed such that the aliasing does not overlap with the desired signal. This allows it to be removed later if needed, by a filter that operates at the decimated sample rate $\frac{f_s}{D}$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2011-09-08T02:30:09.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="172" PostTypeId="2" ParentId="160" CreationDate="2011-09-08T03:02:28.300" Score="3" Body="&lt;p&gt;There is no single answer to your question: as with any filter-design problem, it depends upon your requirements. As described pretty well on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cascaded_integrator-comb_filter&quot; rel=&quot;nofollow&quot;&gt;Wikipedia page&lt;/a&gt;, CIC (cascaded-integrator-comb) filters consist of a number of pairs of integrator and comb stages (hence the name). Each integrator-comb stage has an aggregate impulse response that is equivalent to a boxcar filter (i.e. one with a rectangular frequency response). A boxcar's frequency (magnitude) response has a shape resembling a sinc function, so the overall CIC structure is going to have a magnitude response that looks like a sinc function taken to some power $N$, where $N$ is the number of integrator-comb stages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There aren't a whole lot of knobs for you to tweak based on any application-specific requirements, however. You can tweak the decimation/interpolation ratio of the CIC structure, the comb delay, and the number of stages, but you're still stuck with the sinc-like frequency response, which isn't particularly ideal, as it's not flat across the main lobe and has relatively high sidelobes. So, it's typical for a CIC to be followed by another filter that &quot;cleans up&quot; the overall response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rub: what you need from any compensating filter that you put after the CIC is going to be defined by your application. What's really important is the response of the overall cascade, which you would constrain based on your application's needs. There's no specific filter that is &quot;most suitable.&quot;&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-08T03:02:28.300" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="173" PostTypeId="1" CreationDate="2011-09-08T03:44:04.057" Score="-3" ViewCount="3621" Body="&lt;p&gt;Actually after reading the data from ADC is an $Q15$ format (ie. ADC supports 0-3.3v, ADC is an unipolar type). then the $Q15$ data is converted to $q31$ format ($Q31$ value = $q15_{data}$ &amp;lt;&amp;lt;16). this $Q31$ value is fed in to FIR filter (FIR filter is an $Q31$ format) then filter output is fed in to the fftr(real fft). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Iam facing the problem like if my input is more than 600mv the value of the $Q31$ (after filter stage) is exceeding the $2^{31}$($q31$) limit. Kindly give some suggestion how to solve this problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My ADC output is 16bit (ADC MAX vge is 0-3v unipolar type). &#xA;then this value i am converting to $Q31$ as follows &#xA;uint_16 ADC_value;\ADC value&#xA;$Q31$ value = (Q31) ((q15) (ADC_value-offset))&amp;lt;&amp;lt;16; \ here offset is (unipolar to bipolar conversion ie. AVG of ADC_value )16 bit to $Q15$ conversion &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if my input voltage is more than 600mv $Q31$ value is not correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kindly suggest me how to convert $Q15$ to $Q31$&lt;/p&gt;&#xA;" OwnerUserId="217" LastEditorUserId="1473" LastEditDate="2012-06-06T15:20:12.127" LastActivityDate="2012-06-06T15:20:12.127" Title="FIXED POINT conversion Problem (DSP)" Tags="|sampling|computer-vision|dsp-core|" AnswerCount="5" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="174" PostTypeId="2" ParentId="107" CreationDate="2011-09-08T04:11:28.077" Score="2" Body="&lt;p&gt;While mentioned by Fodor Hartley and Zisserman book is definitely worth to read it's more for general understanding than for practical algorithms. It's quite outdated and those methods are not efficient.&#xA;About your problem - the problem formulation itself is very uncommon. As it was  mentioned by Fodor starting with matching feature points instead of contours is a lot more easy. In case of points the absolutely best overview of available modern methods is the paper by Triggs &quot;Bundle Adjustment — A Modern Synthesis&quot; But before using bundle adjustment you would have match corresponding point on the images using something like &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;nofollow&quot;&gt;SIFT&lt;/a&gt; or template matching. Google for &lt;a href=&quot;http://en.wikipedia.org/wiki/3D_reconstruction&quot; rel=&quot;nofollow&quot;&gt;3D reconstruction&lt;/a&gt; for examples of some complete methods. You can also use open source packages for it, there are several available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you insist on using contours the problem is a lot more difficult, though still (barely) tractable . First you will have identify and match corresponding contours in all the images, after that write the cost function - of sum of reprojection errors for each matched contours group as function from camera position&amp;amp;orientation of each image. After that find the set of camera position which minimize this cost function.&#xA;Each step of this process is extremely difficult, and there is no good overview like Triggs.&#xA;You can google some relevant papers as some combination of terms &quot;contours&quot; &quot;conturs matching&quot; &quot;bundle adjustment&quot; &quot;reprojection error&quot; &quot;3D reconstruction&quot; .&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2011-09-08T04:11:28.077" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="175" PostTypeId="2" ParentId="173" CreationDate="2011-09-08T07:23:04.510" Score="2" Body="&lt;p&gt;If your filter is saturating/overflowing if the input data is getting above 600mV then you will need to reduce the value that is being fed into the filter or scale the filter coefficients so that the gain in the filter stage is not going to cause the values to overflow.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do not say but if the DSP operates on 32 bit data It would be easy to reduce the input data to the filter by a factor of 8 (only shift up by 13 bits) so that the 2^31 value will not be exceeded until the input reaches 4.8V.  If the DSP operates on the full 32 bit data then there will be no loss of resolution in the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scaling the filter coefficients may not be quite so easy.&lt;/p&gt;&#xA;" OwnerUserId="193" LastActivityDate="2011-09-08T07:23:04.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="176" PostTypeId="2" ParentId="173" CreationDate="2011-09-08T08:32:13.580" Score="5" Body="&lt;p&gt;If you are pretty sure that the problem is not with the ADC, meaning that the input to the FIR is as expected then the problem might be the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your input is in Q31 and as I understand from your post that coefficients are also represented in Q31.&#xA;If your output is also represented in Q31 you will have problems if your code looks something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// compute one output sample of FIR&#xA;int outputQ31 = 0;&#xA;int iC;&#xA;for(iC = 0; iC &amp;lt; N; iC++)&#xA;{&#xA;    outputQ31 += input[iC] * coefficiets[iC];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here two 32 bit integers in Q31 are multiplied and saved in an int. The result of the multiplication is a 64 bit number in Q62 that doesn't fit in an int. You will need to shift it down like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int outputQ31 = 0;&#xA;int iC;&#xA;for(iC = 0; iC &amp;lt; N; iC++)&#xA;{&#xA;   outputQ31 += (input[iC] * coefficiets[iC]) &amp;gt;&amp;gt; 31;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you have that shift in your code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another issue is that you might was to do a rounding instead of a truncation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another issue is that you might want to save the result in a 64 bit accumulator such that you only do the rounding/truncation in the end (be careful that the result doesn't wrap around!).&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2011-09-08T08:43:04.327" LastActivityDate="2011-09-08T08:43:04.327" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="178" PostTypeId="2" ParentId="173" CreationDate="2011-09-08T11:03:32.410" Score="1" Body="&lt;p&gt;It shouldn't overflow like that. If you look at the ADC value as a raw count of 0 to 4095, which is just 12 bits, and you shift it over 16 bits, it shouldn't take more than 28 bits to hold the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would bet that what's happening is that you are treating the value as an integer, rather than a fraction. Numbers are very slippery things with the ezDSP compiler, it's easy to accidentally do this. Remember that Q numbers represent fractional values using the number of bits after the Q for fractions. So the value of unity in Q15 is 0x0000_8000, while in Q31 it is 0x4000_0000. The value of 4095 in Q15 is 0x07ff_8000, &lt;em&gt;not&lt;/em&gt; 0x0000_0FFF; if you shift the latter value left 16 places, you have no problem, but shift the other one the same and you lose bits. So what you need to do is represent the ADC reading as a fraction in the range of 0 to 1, rather than as a raw integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you innocently try to read the ADC value and massage it into a Q30 all in one expression, the compiler is apt to do some intermediate casts that will surprise you. It may be ugly, but with the ezDSP and in particular with ADC code on the ezDSP, I've found it best to break such conversions into small steps. Something like so ..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int adc_raw;    // a plain int representation&#xA;_iq15 adc_q15;    // Q15 holder for the same data&#xA;_iq31 adc_q31;    // Q31 holder for same&#xA;&#xA;adc_raw = however_youre_reading_the_ADC();&#xA;adc_q15 = (_iq15)(adc_raw &amp;lt;&amp;lt; (15 - 12));   // the tricky bit. read below..&#xA;adc_q31 = adc_q15 &amp;lt;&amp;lt; (31 - 15);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key here is the the line 'adc_q15 = ...' - you may be tempted to say instead 'adc_q15 = _IQ15(adc_raw);', but that will change an ADC count of 1 into 0x0000_8000, 2 into 0x0001_0000, etc, which is not what you want! Instead, you have to produce a Q15 value that represents the ADC reading in the range of 0 to 1, with half scale at 0.5, etc; this you do by sliding the value left so that the ADC's MSB lines up just to the right of the binary point. As the binary point in Q15 is to the right of bit 15, and the MSB of the ADC is to the right of bit 12, left shift that amount and voila, a normalized ADC value, you just have to cast it to the _iq15 type and you're halfway there! One more shift and you have the same fraction in Q31 format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suffixing the variable names like that is just a convention I've found helpful when I have the same data lying around in a bunch of different formats. There may be a macro to do the Q15 to Q31 conversion, something like adc_q31 = IQ15toIQ31(adc_q15), check your IQmathLib.h header file. It can also be done with macros in two steps, as adc_q31 = IQtoIQ31(IQ15toIQ(adc_q15)), though this uses the 'global Q setting', which again could give you incorrect intermediate results if it's not set correctly. The form given in the code snippet is succinct and relatively clear, at least with the Q values explicitly stated as 15 - 12, and 31 - 15, rather than the somewhat more mysterious 3 and 16.&lt;/p&gt;&#xA;" OwnerUserId="221" LastEditorUserId="221" LastEditDate="2011-09-17T20:32:01.060" LastActivityDate="2011-09-17T20:32:01.060" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="179" PostTypeId="1" CreationDate="2011-09-08T13:00:51.383" Score="3" ViewCount="6143" Body="&lt;p&gt;Does anyone know where there are any benchhmark timings for the DSP functionality in the ARM CMSIS V2 running on a Cortex-M4 processor.  I am trying to work out whether this processor is powerful enough to meet my requirements, and to compare it to other microcontroller devices with DSP extensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;edited to add&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will add a little background. I have an existing product that uses an old and relatively expensive DSP. I have been looking at alternative processors including the Renesas MX and ARM M4 both of which have MACC type instructions. There are benchmark figures for the supplied Renesas libraries that are of the form the x-point FFT at Y MHz takes Z ms, The FIR filter with W coefficients takes Vms etc. I was hoping that there were figures somewhere for the ARM library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attempting to evaluate the performance of a number of target platforms myself will be extremely expensive in tools (different compiler for each target), development boards and implementation time.&lt;/p&gt;&#xA;" OwnerUserId="193" LastEditorUserId="193" LastEditDate="2011-09-23T10:06:23.277" LastActivityDate="2014-07-22T19:02:50.263" Title="DSP Benchmarks for ARM Cortex-M4 processor" Tags="|hardware|performance|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="180" PostTypeId="2" ParentId="169" CreationDate="2011-09-08T15:02:01.460" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there any kind of spectral characteristics (from an STFT) ... this is a single note not a chord, etc.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, for this, the STFT will only contain a fundamental frequency component and other frequencies that are close to harmonics of it (not exact, though, because of &lt;a href=&quot;http://en.wikipedia.org/wiki/Inharmonicity&quot; rel=&quot;nofollow&quot;&gt;inharmonicity&lt;/a&gt;).  &lt;a href=&quot;http://flic.kr/p/7notw6&quot; rel=&quot;nofollow&quot;&gt;Find the peaks in the spectrum&lt;/a&gt; and see if the higher frequencies are close to integer multiples of the lowest frequency present.  If there are non-harmonic frequencies present, then it's not a single tone.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(But what about instruments with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Missing_fundamental&quot; rel=&quot;nofollow&quot;&gt;missing fundamental&lt;/a&gt;, or fundamentally inharmonic things like bells?  What about two instruments perfectly in tune playing an octave apart, so their partials mostly line up with each other?  Do you want to detect that as a single note or two notes?)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2011-09-08T15:02:01.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="181" PostTypeId="2" ParentId="75" CreationDate="2011-09-08T15:07:58.500" Score="8" Body="&lt;p&gt;Two more reasons to over-sample:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Low latency: for example control loops require very low latency. Oversampling gets data in and out faster, so that reduces latency. Also any lowpass filtering introduces group delay. The sharper the lowpass filter, the higher the group delay. If you oversample, you need a less steep anti-aliasing filters and end up with less group delay and thus latency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Practicality: If your input and output run at the same (high) rate you can potentially downsample, but you would have to upsample again before you can output the result. Example: in a home theater system you could downsample the Bass processing path but you would have to upsample again since the outputs are running at the high rate. In many cases the savings in MIPS isn't worth the bother  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastEditorUserId="26" LastEditDate="2011-09-20T15:37:27.237" LastActivityDate="2011-09-20T15:37:27.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="182" PostTypeId="2" ParentId="134" CreationDate="2011-09-08T15:26:45.427" Score="4" Body="&lt;p&gt;There are clearly two choices: FIR &amp;amp; IIR. As already stated FIR requires a VERY long (1000s of taps) impulse response and is expensive in terms of memory, MIPS &amp;amp; latency with overlap add/save being the most efficient choice. However, latency can be a real issue. If you want to use that as a high pass for a home theater subwoofer, the latency will be so high that you will be losing lip synch with the video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IIR is several orders of magnitude less expensive and therefore frequently used. It does indeed have a non-flat phase response but in many cases this is not a problem or can be worked around. For example if you need a high pass filter to protect the drivers in a bass box, the phase response is not very important as the overall system phase response is dominated by the driver, the enclosure and the acoustics in the room. The filter plays only a minor role here.&#xA;In many cases you also need to maintain &quot;relative&quot; phase not absolute phase. Let's say you want to apply the highpass on signal A but not on signal B, you can simply put a matching allpass on signal B so that the relative phase of A and B stay the same. The overall latency &amp;amp; group delay of this approach is still a lot less than that of the FIR method.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="29" LastEditDate="2016-01-10T14:13:52.183" LastActivityDate="2016-01-10T14:13:52.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="183" PostTypeId="2" ParentId="173" CreationDate="2011-09-08T15:33:32.313" Score="1" Body="&lt;p&gt;Have you checked whether your Q15 doesn't clip in the first place?&#xA;If that's clean, you may have the wrong data types for some variables. To be safe all variables (Q31, Q15, offset, 2^16) should signed 32-bit integers. What lanuage do you use?&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-09-08T15:33:32.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="184" PostTypeId="1" AcceptedAnswerId="237" CreationDate="2011-09-08T18:36:26.443" Score="27" ViewCount="2737" Body="&lt;p&gt;A while ago I was trying &lt;a href=&quot;http://www.flickr.com/photos/omegatron/sets/72157623798266403/&quot; rel=&quot;noreferrer&quot;&gt;different ways to draw digital waveforms&lt;/a&gt;, and one of the things I tried was, instead of the standard silhouette of the amplitude envelope, to display it more like an oscilloscope.  This is what a sine and square wave look like on a scope:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Opm9m.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The naïve way to do this is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Divide up the audio file into one chunk per horizontal pixel in the output image&lt;/li&gt;&#xA;&lt;li&gt;Calculate the histogram of sample amplitudes for each chunk&lt;/li&gt;&#xA;&lt;li&gt;Plot the histogram by brightness as a column of pixels&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It produces something like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5mp9n.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fine if there are a lot of samples per chunk and the signal's frequency is unrelated to the sampling frequency, but not otherwise.   If the signal frequency is an exact submultiple of the sampling frequency, for instance, the samples will always occur at exactly the same amplitudes in each cycle and the histogram will just be a few points, even though the actual reconstructed signal exists between these points.  This sine pulse should be as smooth as the above left, but it isn't because it's exactly 1 kHz and the samples always occur around the same points:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C2gqy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried upsampling to increase the number of points, but it doesn't solve the issue, just helps smooth things out in some cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I'd really like is a way to calculate the true &lt;a href=&quot;http://en.wikipedia.org/wiki/Probability_density_function&quot; rel=&quot;noreferrer&quot;&gt;PDF&lt;/a&gt; (probability vs amplitude) of the continuous reconstructed signal from its digital samples (amplitude vs time).  I don't know what algorithm to use for this.  In general, the PDF of a function is the derivative of its &lt;a href=&quot;http://en.wikipedia.org/wiki/Inverse_function&quot; rel=&quot;noreferrer&quot;&gt;inverse function&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PDF of sin(x): $\frac{d}{dx} \arcsin x = \frac{1}{\sqrt{1-x^2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't know how to calculate this for waves where the inverse is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Multi-valued_function&quot; rel=&quot;noreferrer&quot;&gt;multi-valued function&lt;/a&gt;, or how to do it fast.  Break it up into &lt;a href=&quot;http://en.wikipedia.org/wiki/Branch_point&quot; rel=&quot;noreferrer&quot;&gt;branches&lt;/a&gt; and calculate the inverse of each, take the derivatives, and sum them all together?  But that's pretty complicated and there's probably a simpler way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &quot;PDF of interpolated data&quot; is also applicable to an attempt I made to do kernel density estimation of a GPS track.  It should have been ring shaped, but because it was only looking at the samples and not considering the interpolated points between the samples, the KDE looked more like a hump than a ring.  If the samples are all we know, then this is the best we can do.  But the samples are not all we know.  We also know that there's a path between the samples.  For GPS, there's no perfect Nyquist reconstruction like there is for bandlimited audio, but the basic idea still applies, with some guesswork in the interpolation function.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2011-09-09T13:53:43.897" LastActivityDate="2011-09-17T02:33:33.440" Title="Calculating the PDF of a waveform from its samples" Tags="|algorithms|interpolation|audio|" AnswerCount="6" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="185" PostTypeId="2" ParentId="184" CreationDate="2011-09-08T20:06:40.930" Score="4" Body="&lt;p&gt;&lt;em&gt;Kernel Density Estimation&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to estimate the PDF of a waveform is to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_density_estimation&quot; rel=&quot;nofollow&quot;&gt;kernel density estimator&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This takes all your samples $x(n)$ and a kernel function (e.g. a Gaussian), $K(\mathrm{x})$ and convolves them with $\delta(\mathrm{x} - x(n))$ (the Dirac delta) to give an estimate of the PDF, $\hat{P}$ :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{P}(\mathrm{x}) = \sum_{n=0}^N K( \mathrm{x} - x(n) ) $$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update: Interesting additional information.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you have your signal $x(n)$ for $n= 0,1,...,N-1$, then --- as you say --- you can also know its DFT $X(k)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(k) = \sum_{n=0}^{N-1} x(n) e^{-\jmath 2\pi n k /N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that $X(k)$ is the coefficient of $e^{\jmath 2\pi n k /N}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n) = \frac{1}{N} \sum_{k=0}^{N-1} X(k) e^{\jmath 2\pi n k /N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a &lt;strong&gt;guess&lt;/strong&gt; at what you're aftermight be to convolve all the PDFs of each Fourier component together:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |X(k)| \frac{1}{\sqrt{1-x^2}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However that does not take account of the way the phase of $X(k)$ contributes (or not) to the addition in $x(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More thought required, though!&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2011-09-08T21:01:36.143" LastActivityDate="2011-09-08T21:01:36.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="186" PostTypeId="2" ParentId="184" CreationDate="2011-09-08T20:30:09.470" Score="1" Body="&lt;p&gt;You need to smooth the histogram (this will yield similar results as using a kernel method). Exactly how the smoothing has to be performed needs experimentation. Maybe it could also be done by interpolation. In addition to the smoothing I believe you will also get improved results if you upsample your waveform in such a way that the sampling frequency is 'significantly higher' than the highest frequency in your input. This should help in the 'tricky' case where a sine wave is related to the sampling frequency in such a way that only a few bins in the histogram gets populated. If taken to the extreme a sufficiently high sample rate should give you nice plots without smoothing. So upsampling combined with some kind of smoothing should yield better plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You give an example of a 1kHz tone, where the plot is not as you expect. Here is my proposal (Matlab/Octave code)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pixels_vertical = 100;&#xA;% This needs to be tuned to your configuration and acceptance&#xA;upsampling_factor = 16*(pixels_vertical/100); &#xA;fs_original = 48000;&#xA;fsine = 1000; % in Hz&#xA;fs_up = upsampling_factor*fs_original;&#xA;duration = 1; % in seconds&#xA;x = sin(2*pi*fsine*[0:duration*fs_up]/fs_up);&#xA;period_in_samples = fs_up/fsine;&#xA;hist_points = linspace(-1,1,pixels_vertical);&#xA;istart = 1;&#xA;iend   = period_in_samples;&#xA;pixel_values = hist(x(istart:iend), hist_points);&#xA;% smooth pixel values&#xA;[b,a] = butter(2,0.2);&#xA;pixel_values_smooth = filtfilt(b,a,pixel_values);&#xA;figure;hold on;&#xA;plot(hist_points, pixel_values);&#xA;plot(hist_points, pixel_values_smooth,'r');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For your 1000Hz tone you get this&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hfHsn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do is to tune the upsampling_factor expression to your preference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still not 100% sure exactly what your requirements are. But using the above principle of upsampling and smoothing you will get this for the 1kHz tone (made with Matlab). Note that in the raw histogram there are many bins with zero hits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/glDWd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2011-09-12T18:55:50.940" LastActivityDate="2011-09-12T18:55:50.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="188" PostTypeId="1" AcceptedAnswerId="190" CreationDate="2011-09-09T23:17:31.993" Score="16" ViewCount="9947" Body="&lt;p&gt;I usually use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mean_squared_error&quot;&gt;mean squared error&lt;/a&gt; (MSE) or &lt;a href=&quot;http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio&quot;&gt;peak signal-to-noise ratio&lt;/a&gt; (PSNR) to compare two images, but this isn't good enough. I need to find a formula that returns a very big distance between an image A and its pixellated (or blurred) version B, but I don't know how to proceed. What would be a good metric for my needs?&lt;/p&gt;&#xA;" OwnerUserId="238" LastEditorUserId="77" LastEditDate="2011-09-11T05:48:25.083" LastActivityDate="2021-03-02T20:41:14.333" Title="What distance metric can I use for comparing images?" Tags="|image-processing|distance-metrics|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="189" PostTypeId="2" ParentId="184" CreationDate="2011-09-10T00:45:34.407" Score="5" Body="&lt;p&gt;While your approach is theoretically correct (and needs to be slightly modified for non-monotonic functions), it is extremely hard to calculate the inverse of a generic function. As you say you'll have to deal with branch points and branch cuts, which is doable, but you seriously wouldn't want to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you already mentioned, regular sampling samples the same set of points and as such is highly susceptible to poor estimates in regions where it doesn't sample (even if the Nyquist criterion is satisfied). In this case, sampling for a longer period doesn't help either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, when dealing with probability density functions and histograms, its a much better idea to think in terms of &lt;a href=&quot;https://dsp.stackexchange.com/questions/79/what-is-meant-by-stochastic-sampling/82#82&quot;&gt;stochastic sampling&lt;/a&gt; than regular sampling (see the linked answer for an introduction). By sampling stochastically, you can ensure that every point has an equal probability of being &quot;hit&quot; and is a much better way to estimate the pdf. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example: Consider the function $f(x)=\sin(20\pi x) + \sin(100\pi x)$. Now if I sample this with a sampling frequency $f_s=1000$ Hz (Nyquist frequency, $f_N=100$ Hz), the resulting probability density is the plot on the left (401 equispaced bins between -2 and 2). It doesn't matter if I sample for 10 seconds or 100. It still remains the same. On the other hand, sampling stochastically at a rate of $1000$ samples (uniform distribution) per second (I'm not using Hz here, because that implies a different meaning) for 30 seconds gives the plot on the right (same binning). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can easily see that although it is noisy, it is a much better approximation to the actual PDF than the one on the right which shows zeros in several intervals and large errors in several others. By having a longer observation time, you can bring down the variance in the one on the right, eventually converging to the exact PDF (dashed black line) in the limit of large observations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BrhXZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2011-09-10T00:45:34.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="190" PostTypeId="2" ParentId="188" CreationDate="2011-09-10T05:10:49.827" Score="9" Body="&lt;p&gt;&lt;em&gt;The following is not intended to be an answer, but is a statistic that will help us choose an appropriate image comparison technique based on the characteristics of the images you are analyzing.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step is to plot a &quot;delta histogram&quot; as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (x,y) in [0, width] x [0, height] begin&#xA;    delta = abs( SecondImage(x, y) - FirstImage(x, y) )&#xA;    hist[delta] += 1&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given a plot of this histogram, we will know a bit more about the &quot;magnitude&quot; of the changes you are looking for, and will make better recommendations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Alternatively, post some sample images. Remember that if the sample images aren't representative of the image differences you are interested in, we might make inferior recommendations.)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You can also test &lt;a href=&quot;https://ece.uwaterloo.ca/~z70wang/research/ssim/&quot; rel=&quot;nofollow&quot;&gt;Structural Similarity (SSIM)&lt;/a&gt; on your image set and post your results here. Remember that SSIM is designed to mimic human's ability to recognize obstructiveness of image degradation, so it would detect pixelation but maybe not blurring.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If your images are &lt;em&gt;not&lt;/em&gt; photographic images (or, are scientific images that are &lt;em&gt;not&lt;/em&gt; ordinary subjects of photography), then please also post examples of their 2D autocorrelation, suitably cropped and scaled.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Face recognition&lt;/strong&gt; is too big a topic to be discussed in a single question. Blurring arises in multiple context in face recognition - it can be a data quality issue, or it can be done intentionally as an intermediate step in data processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In face recognition we want to detect the &lt;em&gt;identity&lt;/em&gt; of faces, therefore we have to ignore image differences that are &lt;em&gt;not&lt;/em&gt; caused by identity differences. The basic category of differences that should be ignored in face recognition are: pose, illumination and facial expression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A general approach to ignore irrelevant differences is called &lt;strong&gt;normalization&lt;/strong&gt;, which attempts to apply various operations and transforms on the input image to obtain a &quot;canonical&quot; or &quot;preprocessed&quot; image, which in turn can be used for identification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A second approach is to extract features from images that are highly-&lt;strong&gt;invariant&lt;/strong&gt; from the irrelevant factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quality of a face image is subject to the capturing device and the environment where it was captured. When a face image is captured without cooperation of the subject (such as from a security camera), poor image quality is an unavoidable consequence and had to be remedied by software so as not to hamper identification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In cooperative capture, a computerized measure of image quality is good: the operator can be notified of quality problems and the image can be re-taken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blurring can also be an example of malicious tampering of biometrics in order to evade detection (along with occlusion and disguise). If the image is encoded digitally, a digital checksum and cryptographic signature is sufficient to solve the problem completely. If the blurred image is submitted in physical print by an impersonator, a computerized measure of facial image quality can be used to reject such submissions.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The lack of &lt;a href=&quot;http://www.ri.cmu.edu/publication_view.html?pub_id=3266&quot; rel=&quot;nofollow&quot;&gt;2D-localizable features&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Feature_detection_%28computer_vision%29&quot; rel=&quot;nofollow&quot;&gt;interest points&lt;/a&gt; in a certain part of facial image can be a sign of intentional blurring. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the broad category of digital image tampering (by a skilled user of image-editing software), can only be dealt with &lt;a href=&quot;http://www.cs.dartmouth.edu/farid/Hany_Farid/Papers/Entries/2011/5/3_Digital_Image_Forensics.html&quot; rel=&quot;nofollow&quot;&gt;Digital image forensics&lt;/a&gt; which compares pixel statistics against known camera models.&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="58" LastEditDate="2011-09-11T22:19:48.697" LastActivityDate="2011-09-11T22:19:48.697" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="191" PostTypeId="2" ParentId="184" CreationDate="2011-09-10T19:00:31.917" Score="4" Body="&lt;p&gt;As you indicated in one of your comments, it would be attractive to be able to calculate the histogram of the reconstructed signal using only the samples and the PDF of the sinc function that interpolates bandlimited signals. Unfortunately, I don't think this is possible because the sinc's histogram doesn't have all of the information that the signal itself has; all information on the time-domain positions where each value is encountered is lost. This makes it impossible to model how the scaled and time-delayed versions of the sinc would sum together, which is what you would want in order to calculate the histogram of the &quot;continuous&quot; or up-sampled version of the signal without actually doing the up-sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you're left with interpolation as the best option. You did indicate a couple of issues that prevented you from wanting to do this, which I think can be addressed:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Computational expense:&lt;/strong&gt; This is of course always a relative concern, depending upon the specific application that you want to use this for. Based on the link that you posted to the gallery of renderings that you've collected, I'm assuming you're wanting to do this for visualization of audio signals. Whether you're interested in this for a real-time or offline application, I would encourage you to prototype an efficient interpolator and see if it is truly too costly. &lt;a href=&quot;http://cnx.org/content/m10431/latest/&quot; rel=&quot;nofollow&quot;&gt;Polyphase resampling&lt;/a&gt; is a good way to do this that is flexible (you can use any rational factor).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bias to periodic components related rationally to the sampling frequency:&lt;/strong&gt; While you can't eliminate this completely, you should be able to mitigate it somewhat by interpolating by a &quot;strange&quot; factor: instead of up-sampling by 4, try 71/18 (just an example). This will be a somewhat more complicated structure, but it still can be implemented efficiently. This will give you a more uniform distribution of samples across the periods of components that have frequencies related to your sample rate. Alternatively, use a resampling scheme that allows you to select an arbitrary resampling ratio and then resample by an (approximately) irrational number, like $\pi$. This can be done efficiently using a &lt;a href=&quot;http://www.signumconcepts.com/IP_center/paper018.pdf&quot; rel=&quot;nofollow&quot;&gt;Farrow interpolator&lt;/a&gt;, which uses polynomial interpolation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-10T19:00:31.917" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="192" PostTypeId="1" AcceptedAnswerId="196" CreationDate="2011-09-11T12:47:59.643" Score="21" ViewCount="1969" Body="&lt;p&gt;For someone who has some experience in software development, loves his synths and knows the [very] basics of digital audio representation, what are the first steps he should follow in order to program a music synthesizer, DSP-wise?&lt;/p&gt;&#xA;" OwnerUserId="245" LastEditorUserId="50887" LastEditDate="2020-06-23T10:49:16.083" LastActivityDate="2020-06-23T10:49:16.083" Title="What does one need to know in order to build a software synthesizer?" Tags="|audio|digital|software-implementation|" AnswerCount="6" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="194" PostTypeId="2" ParentId="192" CreationDate="2011-09-11T15:14:17.340" Score="6" Body="&lt;p&gt;First you need to decide what kind of synthesiser you want to build - additive, FM, sample-based, etc. You also need to decide whether you want to emulate some kind of existing analogue synthesiser or just design your own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest is fairly easy - you just need to implement the various synthesiser building blocks (e.g. oscillators, filters, noise generators, envelope shapers, etc) in software and then implement a way of &quot;wiring&quot; these together and controlling their parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Hal Chamberlin's book, &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0810457687&quot;&gt;Musical Applications of Microprocessors&lt;/a&gt;, which is a good introduction to many of the basics.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2011-09-11T15:14:17.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="195" PostTypeId="2" ParentId="192" CreationDate="2011-09-11T16:12:26.357" Score="6" Body="&lt;p&gt;I would read an introductory book on DSP plus some books on the subject of computer music (Amazon and other bookstores list several).  There's also a wealth of &lt;a href=&quot;https://ccrma.stanford.edu/~jos/&quot;&gt;course material from Stanford&lt;/a&gt; on DSP and sound synthesis.  Books on the human auditory system and psychoacoustics might also be helpful.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-09-11T16:12:26.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="196" PostTypeId="2" ParentId="192" CreationDate="2011-09-11T17:09:52.947" Score="18" Body="&lt;p&gt;Get &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1568811683&quot; rel=&quot;nofollow noreferrer&quot;&gt;Real Sound Synthesis for Interactive Applications&lt;/a&gt;, and download the &lt;a href=&quot;https://ccrma.stanford.edu/software/stk/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Synthesis Toolkit&lt;/a&gt;.  That will give you practical introductions and quality source code for most digital synthesis methods in use.  Then pick whichever method you find most interesting, and start modifying the corresponding STK code to do what you want.  &lt;em&gt;Then&lt;/em&gt; try building something similar from scratch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, like &lt;a href=&quot;https://dsp.stackexchange.com/questions/192/what-does-one-need-to-know-in-order-to-build-a-software-synthesizer/195#195&quot;&gt;hotpaw2 suggested&lt;/a&gt;, anything from JOS is also great introductory material.  In particular, &lt;a href=&quot;http://www.dsprelated.com/dspbooks/filters/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to Digital Filters with Audio Applications&lt;/a&gt; and &lt;a href=&quot;http://www.dsprelated.com/dspbooks/mdft/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mathematics of the Discrete Fourier Transform&lt;/a&gt; both start from the basics, and don't assume a lot of background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a digital filter/effects perspective, another good starting point is to check out &lt;a href=&quot;http://faust.grame.fr/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Faust&lt;/a&gt;.  You don't even have to learn their block-diagram signal processing language, you can just use the examples to dump out VST, LADSPA, etc. template code as quick way of getting something running [which you can then modify].  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, it's even easier to start out with sound rendering, which is basically the same thing, but without worrying about real-time operation or interactivity.  You just save wav files to disk.  It's a great way to experiment with new techniques before going through the trouble of making them run quickly.  &lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2011-09-11T17:09:52.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="197" PostTypeId="2" ParentId="192" CreationDate="2011-09-11T21:09:41.097" Score="4" Body="&lt;p&gt;I'm quite surprised nobody mentioned &lt;a href=&quot;http://www.outsim.co.uk/&quot; rel=&quot;nofollow&quot;&gt;SynthMaker&lt;/a&gt; yet. It's ridiculously easy to use, and though it makes it difficult to go low-level (be sure to use &lt;em&gt;developer mode&lt;/em&gt;), you can learn a lot about Synthesizer architecture with it, and also about general DSP. And you can actually make use of the things built with it, in fact, I use it to construct almost all of my plugins.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2011-09-11T21:09:41.097" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="199" PostTypeId="1" AcceptedAnswerId="200" CreationDate="2011-09-12T13:49:51.750" Score="20" ViewCount="12385" Body="&lt;p&gt;I'm trying to implement an 8th order IIR filter and every application note and textbook I've read says that it is best to implement any filter of order more than 2 as second order sections. I used &lt;code&gt;tf2sos&lt;/code&gt; in MATLAB to get the coefficients for second order sections which gave me a 6x4 coeffs for 4 second order sections, as expected. &#xA;Prior to implementation as SOS, the 8th order filter required 7 previous sample values to be stored (and output values as well). Now when implementing as second order sections how does the flow work from input to output, do I need to store only 2 previous sample values? Or does the output of the first filter feed as &lt;code&gt;x_in&lt;/code&gt; in to the second filter and so on?&lt;/p&gt;&#xA;" OwnerUserId="73" LastEditorUserId="77" LastEditDate="2011-09-14T20:52:28.787" LastActivityDate="2015-09-30T12:07:36.900" Title="How does cascading biquad sections for higher order filters work?" Tags="|filters|filter-design|infinite-impulse-response|biquad|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="200" PostTypeId="2" ParentId="199" CreationDate="2011-09-12T14:11:54.963" Score="13" Body="&lt;p&gt;It's the last thing you said (&quot;Or does the output of the first filter feed as x_in in to the second filter and so on?&quot;). The idea is simple: you treat the biquads as separate second-order filters that are in cascade. The output from the first filter is the input to the second, and so on, so the delay lines are spread out among the filters. If you need to optimize the structure in a memory-constrained environment, you can note that adjacent biquads have redundant delay memory (i.e. the last few output samples of stage 1 are the same as the last few input samples of stage 2, so you don't have to store them separately like you would if you just implement the filters in isolation).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-12T14:11:54.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="201" PostTypeId="1" AcceptedAnswerId="205" CreationDate="2011-09-12T14:16:44.550" Score="11" ViewCount="737" Body="&lt;p&gt;I am completely new to image analysis. Do you know how to binarize this image in such a way to get the fibers only?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pGypz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A step by step procedure would be awesome, but any hint is appreciated as well. I can use Matlab, .NET and I am open to any other tool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: At this &lt;a href=&quot;https://stackoverflow.com/questions/7387801/image-analysis-fiber-recognition&quot;&gt;address&lt;/a&gt; you can find the same question&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2011-09-13T06:00:07.823" Title="Image analysis - fiber recognition" Tags="|filters|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="202" PostTypeId="2" ParentId="184" CreationDate="2011-09-12T14:49:34.650" Score="8" Body="&lt;p&gt;What I'd go with is essentially Jason R's &quot;random resampler&quot;, which in turn is a presampled-signal based implementation of yoda's stochastic sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used simple cubic interpolation to one random point between each two samples. For a primitive synth sound (decaying from a saturated non-bandlimited square-like signal +even harmonics to a sine) it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/arMQ3.png&quot; alt=&quot;Random-resampled synth PDF&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's compare it to a higher-sampled version,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vAwcA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the weird one with the same samplerate but no interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ebny0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notable artifact of this method is the overshoot in the square-like domain, but this is actually what the PDF of the sinc-filtered signal (as I said, my signal is not bandlimited) would also look like and represents the perceived loudness much better than the peaks, if this were an audio signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code (Haskell):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cubInterpolate vll vl v vr vrr vrrr x&#xA;    = v*lSpline x + vr*rSpline x&#xA;      + ((vr-vl) - (vrr-vll)/4)*ldSpline x&#xA;      + ((vrr-v) - (vrrr-vl)/4)*rdSpline x&#xA;     where lSpline x = rSpline (1-x)&#xA;           rSpline x = x*x * (3-2*x)&#xA;           ldSpline x = x * (1 + x*(x-2))&#xA;           rdSpline x = -ldSpline (1-x)&#xA;&#xA;                   --  rand list   IN samples  OUT samples&#xA;stochasticAntiAlias :: [Double] -&amp;gt; [Double] -&amp;gt; [Double]&#xA;stochasticAntiAlias rs (lsll:lsl:lsc:lsr:lsrr:[]) = []&#xA;stochasticAntiAlias (r:rLst) (lsll:lsl:lsc:lsr:lsrr:lsrrr:t)&#xA;    = ( cubInterpolate lsll lsl lsc lsr lsrr lsrrr r )&#xA;          : stochasticAntiAlias rLst (lsll:lsl:lsc:lsr:lsrr:lsrrr:t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;rand list&lt;/code&gt; is a list of random variables in range [0,1].&lt;/p&gt;&#xA;" OwnerUserId="246" LastEditorUserId="246" LastEditDate="2011-09-12T14:58:06.593" LastActivityDate="2011-09-12T14:58:06.593" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="205" PostTypeId="2" ParentId="201" CreationDate="2011-09-12T16:00:35.677" Score="9" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot;&gt;Hough transform&lt;/a&gt; is your friend. Basicaly it deals with straight lines (and almost all fibers in your example are straight). You can find open source implementation in OpenCV (&lt;a href=&quot;http://opencv.willowgarage.com/documentation/feature_detection.html#houghlines2&quot;&gt;here is doc + result example&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover there is some generalizations that able to detect custom shapes.&lt;br&gt;&#xA;P.S. Since you're using C#, &lt;a href=&quot;http://www.emgu.com/wiki/index.php/Main_Page&quot;&gt;OpenCV wrapper&lt;/a&gt; could be helpfull for you.&lt;/p&gt;&#xA;" OwnerUserId="43" LastEditorUserId="43" LastEditDate="2011-09-12T16:05:38.380" LastActivityDate="2011-09-12T16:05:38.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="206" PostTypeId="1" AcceptedAnswerId="217" CreationDate="2011-09-12T16:14:22.720" Score="55" ViewCount="78926" Body="&lt;p&gt;I'm studying some DSP and I'm having trouble understanding the difference between &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Phase_Delay.html&quot; rel=&quot;noreferrer&quot;&gt;phase delay&lt;/a&gt; and &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Group_Delay.html&quot; rel=&quot;noreferrer&quot;&gt;group delay&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that they both measure the delay time of sinusoids passed through a filter.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Am I correct in thinking this?  &lt;/li&gt;&#xA;&lt;li&gt;If so, how do the two measurements differ?&lt;/li&gt;&#xA;&lt;li&gt;Could someone give an example of a situation in which one measurement would be more useful than the other?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading ahead in Julius Smith's &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/filters.html&quot; rel=&quot;noreferrer&quot;&gt;Introduction to Digital Filters&lt;/a&gt;, I've found a situation where the two measurements at least give different results: &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Antisymmetric_Linear_Phase_Filters.html&quot; rel=&quot;noreferrer&quot;&gt;affine-phase filters&lt;/a&gt;. That's a partial answer to my question, I guess.&lt;/p&gt;&#xA;" OwnerUserId="255" LastEditorUserId="21075" LastEditDate="2017-03-25T02:25:51.280" LastActivityDate="2020-08-01T13:26:47.917" Title="What is the difference between phase delay and group delay?" Tags="|filters|audio|phase|group-delay|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="207" PostTypeId="2" ParentId="157" CreationDate="2011-09-12T16:36:05.197" Score="5" Body="&lt;p&gt;The notions of position and momentum are not fundamental to the uncertainty principle, but the fact that position and momentum are analogous to instantaneous time and instantaneous frequency is. There is no necessity to translate the spatial domain of an image and its fourier representation in terms of position and momentum. The notion of frequency in this case expresses how fast an image changes or where one finds sharp discontinuities/edge like structures in an image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question might be motivated by a misunderstanding of the origins of the Heisenberg Uncertainty principle. The basis of any uncertainty princple is time-frequency uncertainty, i.e. given any two functions where one of them can be expressed in terms of the fourier transform of the other, both cannot be localized in their respective domains. See &lt;a href=&quot;http://www-stat.stanford.edu/~donoho/Reports/Oldies/UPSR.pdf&quot; rel=&quot;nofollow&quot; title=&quot;Uncertainty Principles and Signal Recovery&quot;&gt;1&lt;/a&gt; for other types of discrete-time uncertainty principles that don't have the classical time-frequency interpretation.  &lt;/p&gt;&#xA;" OwnerUserId="254" LastEditorUserId="254" LastEditDate="2011-09-13T05:18:49.653" LastActivityDate="2011-09-13T05:18:49.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="208" PostTypeId="1" AcceptedAnswerId="210" CreationDate="2011-09-12T20:23:23.577" Score="30" ViewCount="21511" Body="&lt;p&gt;If one wants to smooth a time series using a window function such as Hanning, Hamming, Blackman etc., what are the considerations for favouring any one window over another?&lt;/p&gt;&#xA;" OwnerUserId="260" LastEditorUserId="77" LastEditDate="2011-10-01T13:55:48.883" LastActivityDate="2011-10-01T14:12:28.760" Title="What should be considered when selecting a windowing function when smoothing a time series?" Tags="|filters|window-functions|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="210" PostTypeId="2" ParentId="208" CreationDate="2011-09-12T23:44:20.950" Score="28" Body="&lt;p&gt;The two primary factors that describe a window function are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Width of the main lobe (i.e., at what frequency bin is the power half that of the maximum response)&lt;/li&gt;&#xA;&lt;li&gt;Attenuation of the side lobes (i.e., how far away down are the side lobes from the mainlobe). This tells you about the spectral leakage in the window.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Another not so frequently considered factor is the rate of attenuation of the sidelobes, i.e., how fast do the sidelobes die down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a quick comparison for four well known window functions: Rectangular, Blackman, Blackman-Harris and Hamming. The curves below are 2048-point FFTs of 64-point windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yijti.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that the rectangular function has a very narrow main lobe, but the side lobes are quite high, at ~13 dB. Other filters have significantly fatter main lobes, but fare much better in the side lobe suppression. In the end, it's all a trade-off. You can't have both, you have to pick one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that said, your choice of window function is highly dependent on your specific needs. For instance, if you're trying to separate/identify two signals that are fairly close in frequency, but similar in strength, then you should choose the rectangular, because it will give you the best resolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if you're trying to do the same with two different strength signals with differing frequencies, you can easily see how energy from one can leak in through the high sidelobes. In this case, you wouldn't mind one of the fatter main lobes and would trade a slight loss in resolution to be able to estimate their powers more accurately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In seismic and geophysics, it is common to use &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Slepian_DPSS_Window.html&quot; rel=&quot;noreferrer&quot;&gt;Slepian windows&lt;/a&gt; (or discrete prolate spheroidal wavefunctions, which are the eigenfunctions of a sinc kernel) to maximize the energy concentrated in the main lobe.&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="272" LastEditDate="2011-10-01T14:12:28.760" LastActivityDate="2011-10-01T14:12:28.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="211" PostTypeId="2" ParentId="201" CreationDate="2011-09-13T00:45:30.543" Score="3" Body="&lt;p&gt;In my experience, the results are not good if you do not use a proper low pass filter as you clearly stated that you do not want noise. Also, for usage in Hough Transform, you have lot of option to change in order to detect. Length of line segment and angle of the line segments, you may adjust what you want. &#xA; &lt;img src=&quot;https://i.stack.imgur.com/QdlKp.jpg&quot; alt=&quot;Hough Transform Result with little noise&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="175" LastActivityDate="2011-09-13T00:45:30.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="212" PostTypeId="2" ParentId="88" CreationDate="2011-09-13T03:02:01.737" Score="5" Body="&lt;p&gt;Here's an &lt;a href=&quot;http://www.janovetz.com/jake/remez/remez-19980711.zip&quot; rel=&quot;nofollow&quot;&gt;LGPL version&lt;/a&gt; of the Remez exchange algorithm. The octave code seems to be derived from it. It was linked from the wikipedia page &lt;a href=&quot;http://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm&quot; rel=&quot;nofollow&quot;&gt;Parks McClellan&lt;/a&gt; page.&lt;br&gt;&#xA;The original Janovetz code might be more easily usable in your project, since it doesn't have the octave calls, but it would be wise to dig through the &lt;a href=&quot;http://octave.sourceforge.net/developers.html&quot; rel=&quot;nofollow&quot;&gt;octave-forge svn&lt;/a&gt; changelog for any info about bugfixes or speedups in the remez.cc file.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2011-09-13T16:07:47.603" LastActivityDate="2011-09-13T16:07:47.603" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="213" PostTypeId="2" ParentId="201" CreationDate="2011-09-13T06:00:07.823" Score="1" Body="&lt;p&gt;I concur about Hough transform, but before it would be good to pass image through the edge detector (&lt;a href=&quot;http://en.wikipedia.org/wiki/Canny_edge_detector&quot; rel=&quot;nofollow&quot;&gt;Canny&lt;/a&gt; is preferable and available in OpenCV)&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2011-09-13T06:00:07.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="214" PostTypeId="2" ParentId="208" CreationDate="2011-09-13T09:13:28.110" Score="8" Body="&lt;p&gt;There's a large variety of windows compared in this seminal &lt;a href=&quot;http://electrical.sdsu.edu/faculty/frederick_harris.html&quot;&gt;fred harris&lt;/a&gt; paper from 1978:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://web.mit.edu/xiphmont/Public/windows.pdf&quot;&gt;&quot;On the use of Windows for Harmonic Analysis with the Discrete Fourier Transform&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well worth a read!&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2011-09-13T09:13:28.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="215" PostTypeId="1" AcceptedAnswerId="225" CreationDate="2011-09-13T10:04:13.893" Score="7" ViewCount="1069" Body="&lt;p&gt;I have a 3D volume image that consists of 2D tomographic images. In MatLab, for 2D images, we can use bwmorph and call for 'skel' operation to infinity to get a pixel thick overall outline of the image. bwmorph cannot deal with 3D images, however, so I am looking around for implementing &quot;skel&quot; operation for such tomographic case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that MatLab has provided an explanation for thinning algorithm (in 2D) but not skeleton algorithm. They are pretty much similar, but I just want to ask the community first: if I want to implement an algorithm for &quot;skeletonize&quot; all voxels of a volume (the end result should be all objects in the volume becoming 1 voxel thin. Ex. A 3D cylinder becomes a 3D line, a 10 voxels thick in diameter spline should become a 1 voxel thick in diameter spline, etc.), what are some of the things should I be looking for?&lt;/p&gt;&#xA;" OwnerUserId="263" LastActivityDate="2011-09-14T14:11:43.873" Title="Skel to infinity morphological operations on 3D volume" Tags="|image-processing|algorithms|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="216" PostTypeId="2" ParentId="208" CreationDate="2011-09-13T11:31:14.143" Score="1" Body="&lt;p&gt;Your question is slightly confusing because smoothing a time series is normally not used in the same context as windowing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you probably mean is that windowing a time series has the effect of smoothing (or smearing) the frequency response. You can find a description of the properties of most used windows and design trade-offs in almost any DSP book and wiki covers the topic as well &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Window_function&lt;/a&gt;. There is one criterion for choosing a window function which I haven't yet seen described in a DSP book in addition to the traditional ones of mainlobe width and sidelobe attenuation and that is computational convenience. For instance, in some applications a Hamming window is preferred because if you FFT a Hamming window you get only 3 non-zero taps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can of course smooth a time series by filtering it with a window function because a window function has a low-pass characteristic. But that is probably not what you're asking about. &lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-09-13T11:31:14.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="217" PostTypeId="2" ParentId="206" CreationDate="2011-09-13T12:39:23.200" Score="27" Body="&lt;p&gt;First of all the definitions are different:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Phase delay: (the negative of) Phase divided by frequency&lt;/li&gt;&#xA;&lt;li&gt;Group delay: (the negative of) First derivative of phase vs frequency &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In words that means:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Phase delay: Phase angle at this point in frequency&lt;/li&gt;&#xA;&lt;li&gt;Group delay: Rate of change of the phase around this point in frequency. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When to use one or the other really depends on your application. The classical application for group delay is modulated sine waves, for example AM radio. The time that it takes for the modulation signal to get through the system is given by the group delay not by the phase delay. Another audio example could be a kick drum: This is mostly a modulated sine wave so if you want to determine how much the kick drum will be delayed (and potentially smeared out in time) the group delay is the way to look at it. &lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="4346" LastEditorDisplayName="user42" LastEditDate="2017-01-10T23:27:23.403" LastActivityDate="2017-01-10T23:27:23.403" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="218" PostTypeId="2" ParentId="199" CreationDate="2011-09-13T13:22:00.043" Score="9" Body="&lt;p&gt;There are actually two ways to implement second order sections: parallel and serial.&#xA;In the serial version, the outputs of section N are the inputs to section N+1. In the parallel version all sections have the same input (and only one real zero instead of a conjugate complex pair of zeros) and each sections output is simply summed up.&#xA;The two methods are related through partial-fraction expansion of the Z-domain transfer function. WARNING: this is a numerically tricky problem and the standard Matlab implementation &quot;residuez&quot; can have very large numerical errors for typical audio filters that have poles close to the unit circle.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-09-13T13:22:00.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="219" PostTypeId="2" ParentId="173" CreationDate="2011-09-13T13:30:41.793" Score="1" Body="&lt;p&gt;Either I haven't understood the question or it lacks details. Let me try to understand: You have an ADC giving a 16 bit output (which YOU are INTERPRETING as Q15). YOU then convert it to Q31 format, shifting left by 16 bits. The converted value is fed to FIR filter, from which the output goes to FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you mean by exceeding 2^31 limit. Is it overflowing? Saturating? I'd assume so anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My gut feeling is that your filter coefficients are not scaled enough and hence the filter output is incorrect when the filter input value increases to a certain level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the order of your FIR filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd start by making sure that the input to my filter is absolutely correct - easy to check. Then debug each stage of your filter. Are you sure your filter implementation is correct? If the order of filter is high, chances are that MAC operations are leading to an overflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in summary: Look out for coefficient scaling, ensure filter input is correct and check if filter implementation is correct by feeding in a known vector.&lt;/p&gt;&#xA;" OwnerUserId="73" LastActivityDate="2011-09-13T13:30:41.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="220" PostTypeId="1" AcceptedAnswerId="221" CreationDate="2011-09-13T21:38:47.517" Score="24" ViewCount="7005" Body="&lt;p&gt;A &lt;a href=&quot;https://dsp.stackexchange.com/questions/88/where-can-i-get-an-open-source-implementation-of-the-parks-mcclellan-optimal-fir&quot;&gt;question&lt;/a&gt; recently came up regarding Parks-McClellan and some of the comments point out that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia article on Parks-McClellan&lt;/a&gt; states, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...the Parks-McClellan algorithm is a variation of the Remez algorithm or Remez exchange algorithm.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a difference in performance?  Is the &lt;code&gt;remez&lt;/code&gt; function in octave equivalent to the Matlab function &lt;code&gt;firpm&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-03-09T16:03:17.233" Title="What is the difference between Remez exchange and Parks-McClellan filter design?" Tags="|algorithms|filter-design|parks-mclellan|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="221" PostTypeId="2" ParentId="220" CreationDate="2011-09-13T22:30:45.560" Score="10" Body="&lt;p&gt;The Remez exchange algorithm is a generic iterative procedure to approximate any function optimally in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Uniform_norm&quot; rel=&quot;nofollow&quot;&gt;$L^\infty$&lt;/a&gt; sense (i.e., give the best worst-case approximation or in other words, minimize the maximum error or minmax).  The Parks-McClellan algorithm (PM) is a variation of the Remez exchange algorithm, applied specifically for FIR filters. From the wiki article you cited:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thomas [Parks] drove from Houston to Princeton in order to attend a conference. At the conference, he heard Ed Hofstetter's presentation about a new FIR filter design algorithm (Maximal Ripple algorithm). He brought the paper by Hofstetter, Oppenheim, and Siegel, back to Houston, thinking about the possibility of using the Chebyshev approximation theory to design FIR filters. He heard that the method implemented in Hofstetter's algorithm was similar to the Remez exchange algorithm and decided to pursue the path of using the Remez exchange algorithm.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Without going into too much detail, the primary difference between the two algorithms is that the Remez exchange algorithm (RE) gives you conditions to design the optimal filter (specifically, &lt;a href=&quot;http://en.wikipedia.org/wiki/Remez_algorithm#Procedure&quot; rel=&quot;nofollow&quot;&gt;see #3 here&lt;/a&gt;: the errors must be of equal weighted magnitude and alternating in sign).  RE implements an iterative procedure to calculate polynomial coefficients (which can be mapped to FIR filter coefficients) that satisfy the above criterion, which is the &quot;Alternation Theorem&quot;.  The &quot;E&quot; in RE is the part of the procedure where the maxima in the error, that are used in the iterative procedure, are replaced by the new maxima, which are closer to the optimal values.  PM uses Tchebyshev polynomials to convert polynomial coefficients to coefficients governing a series of cosine functions which are directly translated to symmetrical FIR coefficients.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Coming to your question about the &lt;code&gt;remez&lt;/code&gt; function in Octave and the &lt;code&gt;firpm&lt;/code&gt; function in MATLAB, I believe they're the same. MATLAB used to have a &lt;code&gt;remez&lt;/code&gt;, which was phased out in favour of &lt;code&gt;firpm&lt;/code&gt;. Octave probably still sticks to the former. Typing &lt;code&gt;help remez&lt;/code&gt; in MATLAB R2011b gives the following: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;REMEZ Parks-McClellan optimal equiripple FIR filter design.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;REMEZ is obsolete.  REMEZ still works but may be removed in the future.&#xA;Use FIRPM instead.&#xA;&#xA;See also FIRPM.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="77" LastEditorUserId="4346" LastEditDate="2014-03-09T16:03:17.233" LastActivityDate="2014-03-09T16:03:17.233" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="222" PostTypeId="2" ParentId="192" CreationDate="2011-09-14T10:23:38.013" Score="4" Body="&lt;p&gt;As some of the other contributors have mentioned, a good primer on DSP is a must. This is a great book&gt; &lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/&lt;/a&gt; and the author has kindly provided a full and free PDF download. Another common music tech course book which gives good high level views of various synthesis techniques is&gt; &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0262680823&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Computer-Music-Tutorial-Curtis-Roads/dp/0262680823&lt;/a&gt;. I would also reiterate what the previous contributor suggested, Synthmaker, which is a very convenient visual development environment for developing VST plugins. Finally, if you just want to experiment without going to deeply into it you could try using Csound which is a programming language specifically designed for sound synthesis.&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-09-14T10:23:38.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="223" PostTypeId="2" ParentId="169" CreationDate="2011-09-14T10:55:49.177" Score="4" Body="&lt;p&gt;The problem of polyphonic music transcription has received a huge amount of attention in the research community in recent years and I would go as far as to say that for single instrument polyphonies (piano, guitar etc...) the results are very good. Here are a few papers/authors who have looked at this problem deeply. &lt;a href=&quot;http://www.audioresearchgroup.com/main.php?page=Publications&amp;amp;aid=489&quot; rel=&quot;nofollow&quot;&gt;Derry Fitzgerald&lt;/a&gt; has done a lot in the area, a lot of his NMF work on source separation produces accurate transcriptions. &lt;a href=&quot;http://www.elec.qmul.ac.uk/people/anssik/publications.htm&quot; rel=&quot;nofollow&quot;&gt;Anssi Klapuri&lt;/a&gt; has looked even more specifically at the problem of chord detection within multi instrument polyphonies. And finally, although not published, &lt;a href=&quot;http://www.audioresearchgroup.com/main.php?page=Publications&amp;amp;aid=482&quot; rel=&quot;nofollow&quot;&gt;Mikel Gainza&lt;/a&gt; has developed very accurate chord transcription algorithms for commercial music soon to be released in a guitar based software product &lt;a href=&quot;http://www.riffstation.com&quot; rel=&quot;nofollow&quot;&gt;Riffstation&lt;/a&gt;.&#xA;The publications in the linkes here should give you a good idea of how the Polyphonic music transcription landscape currently lies. &lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-09-14T10:55:49.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="224" PostTypeId="2" ParentId="51" CreationDate="2011-09-14T13:22:42.940" Score="9" Body="&lt;p&gt;A little dated but may deserve a more comprehensive answer, especially since Direct Form II can get you into a lot of trouble.&#xA;First of all, there is no &quot;one size fits all&quot; and the best choice depends on your specific application and constraints. What you can consider is&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Memory:&lt;/strong&gt; Direct Form II and Transposed Form II take a little less state memory then Direct Form I and Transposed Form I but in a cascaded second-order section implementation the difference is minor&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;MIPS:&lt;/strong&gt; In terms of number of multiplies and additions, all four implementations are the same. However depending on the instruction set of the specific processor, there can be significant differences in implementation efficiency. So &quot;it depends&quot;. &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Fixed Point properties:&lt;/strong&gt; This makes a huge difference. Primarily you have to make sure that your state variables don't overflow so you need to analyze the transfer function between in/output and the state variables. Here Direct Form I and Transposed Form II are the clear winners. State variables are bound to +106dB or thereabouts vs input and output. In direct Form II for example, the transfer function from input to state is given by the poles only. I have seen real world examples where this can actually exceed 100 dB of gain. This is an absolute no non for fixed point implementation.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Noise:&lt;/strong&gt; In terms of truncation and round off error, all implementations are roughly the same. The state variable transfer function problem mentioned in 3) also affects this to some extend and I have seen audible noise issues with Direct Form II filters even when using 32-bit floating point.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So in summary Transposed Form II is more often than not the best choice. In some fixed point scenarios, especially if there are significant noise problems Direct Form I is better since it can more easily augmented with things like Error Spectrum Shaping, etc.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="77" LastEditDate="2011-09-14T15:29:16.283" LastActivityDate="2011-09-14T15:29:16.283" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="225" PostTypeId="2" ParentId="215" CreationDate="2011-09-14T14:11:43.873" Score="4" Body="&lt;p&gt;As a start, you could look at the &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/distance.htm&quot; rel=&quot;nofollow&quot;&gt;distance transform&lt;/a&gt;. The distance transform will assign each voxel the minimal distance to the volume boundary. Afterwards you could do a &lt;a href=&quot;http://users.ecs.soton.ac.uk/msn/book/new_demo/nonmax/&quot; rel=&quot;nofollow&quot;&gt;non-maximum suppression&lt;/a&gt;. The results should look similar to a skeleton.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I bet there are more sophisticated algorithms available for 3d skeleton extraction, but this is not my field of research, so I cannot help you with that.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2011-09-14T14:11:43.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="226" PostTypeId="2" ParentId="51" CreationDate="2011-09-14T15:17:46.510" Score="1" Body="&lt;p&gt;Unless your working with a very resource-scarce system or have extreme requirements it really doesn't matter in practice whether you choose direct form I or II. For instance, if you're doing stuff on a PC or a smartphone it really doesn't matter. Personally, I prefer Form I.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real issue is normally MIPS and if you plan to do a fixed-point implementation things get more complicated. For instance, on ARM your IIR filter will consume much more MIPS if both coefficients and filter states are 32-bits. 32 bits in states and coefficients is a requirement if you need to implement for instance a low-pass filter with very low cut-off frequency. In those cases you can use a different type of filter, such as for instance a state-variable filter. &lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-09-14T15:17:46.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="227" PostTypeId="1" AcceptedAnswerId="228" CreationDate="2011-09-15T05:13:37.943" Score="26" ViewCount="11943" Body="&lt;p&gt;I am looking for the fastest available algorithm for distance transform.&lt;/p&gt;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://homepages.inf.ed.ac.uk/rbf/HIPR2/distance.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Processing Learning Resources - HIPR 2 (HYPERMEDIA IMAGE PROCESSING REFERENCE) - Morphology - Distance Transform&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The distance transform can be calculated much more efficiently using&#xA;clever algorithms in only two passes (e.g. Rosenfeld and Pfaltz&#xA;1968).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Searching around, I found: &amp;quot;Rosenfeld, A and Pfaltz, J L. 1968. Distance Functions on Digital Pictures. Pattern Recognition, 1, 33-61.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;But I believe we should have a better and faster algorithm than the one in 1968 already? In fact, I could not find the source from 1968, so any help is highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="263" LastEditorUserId="7092" LastEditDate="2022-01-22T14:45:26.220" LastActivityDate="2023-10-03T23:53:30.663" Title="Fastest Algorithm for Distance Transform" Tags="|image-processing|algorithms|distance-metrics|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="228" PostTypeId="2" ParentId="227" CreationDate="2011-09-15T08:04:52.000" Score="17" Body="&lt;p&gt;Pedro F. Felzenszwalb and Daniel P. Huttenlocher have published their implementation for the &lt;a href=&quot;http://people.cs.uchicago.edu/%7Epff/dt/&quot; rel=&quot;nofollow noreferrer&quot;&gt;distance transform&lt;/a&gt; [&lt;a href=&quot;https://web.archive.org/web/20230207044011/http://cs.brown.edu/people/pfelzens/dt/&quot; rel=&quot;nofollow noreferrer&quot;&gt;archive&lt;/a&gt;]. You cannot use it for volumetric images, but maybe you can extend it to support 3d data. I have only used it as a black box.&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="7092" LastEditDate="2023-10-03T23:53:30.663" LastActivityDate="2023-10-03T23:53:30.663" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="229" PostTypeId="1" AcceptedAnswerId="230" CreationDate="2011-09-15T20:32:47.237" Score="4" ViewCount="309" Body="&lt;p&gt;Am new to signal processing and was wondering when given two signals, what are the widely used statistical analysis methods to understand the relationship between them?&lt;/p&gt;&#xA;" OwnerUserId="280" LastEditorUserId="1650" LastEditDate="2013-02-23T14:48:26.013" LastActivityDate="2013-02-23T14:48:26.013" Title="signals comparison metrics" Tags="|analytic-signal|continuous-signals|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="230" PostTypeId="2" ParentId="229" CreationDate="2011-09-15T22:47:22.647" Score="4" Body="&lt;p&gt;There are for instance coherence and (cross)correlation which are commonly used mostly because of their computational/practical attractiveness. If you need to go beyond second order relationship, that is higher order dependencies, you can look at (cross)cumulants. From information theory you may want to look at (cross)entropy and mutual information.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-09-15T22:47:22.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="231" PostTypeId="1" AcceptedAnswerId="232" CreationDate="2011-09-16T07:58:06.383" Score="13" ViewCount="1942" Body="&lt;p&gt;I already posted &lt;a href=&quot;https://stackoverflow.com/questions/7432427/documentation-about-filters-in-general&quot;&gt;this question&lt;/a&gt; on StackOverflow. I got a suggestion to go for a better answer here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the question more concise I'm interested in an introduction to digital filters, any resource is good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But first I will be satisfied if someone could point me to some resources explaining this filter (used in Android):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://gitorious.org/rowboat/frameworks-base/blobs/671a6ff4be11b3e2d8eb017e0c7a78e6133fb2b8/services/sensorservice/SecondOrderLowPassFilter.cpp&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://gitorious.org/rowboat/frameworks-base/blobs/671a6ff4be11b3e2d8eb017e0c7a78e6133fb2b8/services/sensorservice/SecondOrderLowPassFilter.cpp&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm interested is the way the filter's parameters are chosen. While I can copy it without thinking, I guess I should understand the basic concept/idea behind before using it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Iulian&lt;/p&gt;&#xA;" OwnerUserId="281" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2013-06-03T12:46:25.943" Title="Documentation about filters in general" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="232" PostTypeId="2" ParentId="231" CreationDate="2011-09-16T10:13:19.913" Score="11" Body="&lt;p&gt;You can derive the expression for the coefficients by doing bilinear transformation of the following analog low-pass prototype filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s) = \frac{w_0^2}{s^2 + (w_0/Q)s + w_0^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w_0$ is the cut-off frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can lookup the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform&quot;&gt;bilinear transformation on Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter used in the Android app is a Butterworth filter because the chosen value of Q is $1/\sqrt{2}$. Note that in the constructor the inverse of Q is computed and assigned to variable iQ which is used in the computation of the coefficients. Note also that the variable K holds the 'frequency-warped' value of the specified cut-off frequency. You can find more information about the frequency-warping phenomenon in the above link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find many examples on digital filter design using bilinear transformation. I found &lt;a href=&quot;http://www.earlevel.com/main/2003/03/02/the-bilinear-z-transform/&quot;&gt;this one&lt;/a&gt;, which is quite close to the Android example.&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="77" LastEditDate="2011-09-22T20:30:28.997" LastActivityDate="2011-09-22T20:30:28.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="233" PostTypeId="2" ParentId="231" CreationDate="2011-09-16T12:35:12.087" Score="5" Body="&lt;p&gt;A really good and thorough introduction to digital filters is &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/filters.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/filters.html&lt;/a&gt; .&#xA;Your particularly example is a very simple 2nd or 4th order low pass filter. If you use the &quot;Biquad&quot; object you would get a second order Butterworth filter. If you use the &quot;CascadedBiquad&quot;&#xA;object you would get what's called a 4th order Linkwitz Riley filter (but NOT a 4th order Butterworth). &#xA;The implementation is fairly specific. With a little more work you can do something that is much more generic and usable for all applications. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-09-16T12:35:12.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="234" PostTypeId="2" ParentId="159" CreationDate="2011-09-16T14:29:07.590" Score="5" Body="&lt;p&gt;You might also want to consider Principal Component Analysis (PCA) or an extension of it known as Independent Subspace Analysis which is PCA followed by ICA. These techniques work very well for extracting pitch stationary signals from a single observation signal. I'm an audio specialist but have discussed biomedical signals with colleagues in the past and from recollection cardiac pulses from a single observation are pretty well characterised and thus would be suitable sources for extraction using ISA. I have used it to great avail to separate drums from full musical polyphonies.   &lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-09-16T14:29:07.590" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="235" PostTypeId="2" ParentId="231" CreationDate="2011-09-16T15:24:43.000" Score="5" Body="&lt;p&gt;My first reference that I found to be really helpful was &lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;The Scientist's and Engineer's Guide to Digital Signal Processing&lt;/a&gt;. I think it's strong suit is that it's geared toward getting the reader familiar with the concepts and terminology of DSP without getting too deep into the math. This tack fit my learning style and background as a Software Engineer with a light emphasis on EE. These days I always approach new topics in this way trying to understand the high-level concepts first and then dig deeper into the details with other information sources that are more detail/math-heavy. &lt;/p&gt;&#xA;" OwnerUserId="282" LastActivityDate="2011-09-16T15:24:43.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="236" PostTypeId="2" ParentId="71" CreationDate="2011-09-16T17:04:02.113" Score="0" Body="&lt;p&gt;From a different analog point of view, filtering meaning rejecting some parts of the input signal. In other words, the filter &quot;impedance&quot; does not match with some parts of the signal, hence it gets reflected back.&lt;/p&gt;&#xA;" OwnerUserId="286" LastActivityDate="2011-09-16T17:04:02.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="237" PostTypeId="2" ParentId="184" CreationDate="2011-09-16T17:38:17.937" Score="8" Body="&lt;p&gt;Interpolate to several times the original rate (e.g. 8x oversampled). This allows you to assume a piecewise linear signal.  This signal will have very little error compared to the infinite resolution, continuous sin(x)/x interpolation of the waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume every &lt;strong&gt;pair&lt;/strong&gt; of oversampled values has a continuous line from one value to the next. Use &lt;strong&gt;all&lt;/strong&gt; the values between.  This gives you one thin horizontal slice from y1 to y2 to be accumulated into an arbitrary resolution PDF.   Each rectangular slice of probability must be scaled to a 1/nsamples area.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the line between samples rather than the sample themselves prevents a &quot;spikey&quot; PDF, even in the case when there is a fundamental relationship between the sampling period and the waveform. &lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2011-09-17T02:33:33.440" LastActivityDate="2011-09-17T02:33:33.440" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="238" PostTypeId="1" CreationDate="2011-09-17T02:51:56.773" Score="10" ViewCount="1964" Body="&lt;p&gt;I've a question about the effect of aliasing on the magnitude of autocorrelations. From a simulation in MATLAB, I don't see any effect of aliasing or any need to anti-alias filter when I take the magnitude of the autocorrelation. Which means I can undersample the data and then take the autocorrelation. There is a paper &lt;a href=&quot;http://journals.ametsoc.org/doi/pdf/10.1175/1520-0450%281984%29023%3C0848%3AEOAOSM%3E2.0.CO%3B2&quot;&gt;&quot;Effects of Aliasing on Spectral Moment Estimates Derived from the Complete Autocorrelation Function&quot;&lt;/a&gt; which says something like what I claim. Would anybody please let me know if I've made a mistake?&lt;/p&gt;&#xA;" OwnerUserId="290" LastEditorUserId="77" LastEditDate="2011-09-17T03:41:12.690" LastActivityDate="2011-09-19T09:01:58.880" Title="What is the effect of aliasing on the magnitude of the autocorrelation?" Tags="|sampling|discrete-signals|downsampling|aliasing|" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="240" PostTypeId="2" ParentId="238" CreationDate="2011-09-17T13:54:17.257" Score="2" Body="&lt;p&gt;Seems a little odd to me. The Matlab script below compares the &quot;downsampled autocorrelation&quot; to the &quot;autocorrelation of the downsampled signals&quot;. For dual sine waves this actually comes pretty close (relative error of about -50dB)  but for white noise it's simply wrong (relative error &gt; +6 dB). While there may be some computational advantage it's not clear to me how useful the downsampled autocorrelations is even in the dual sine wave case. The peaks in the spectrum still show up in the wrong place.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% script to check whether autocorrelation is immune to aliasing&#xA;% create two sine waves at 18k and 21k (assuming sample rate of 444.1k) &#xA;n = 8192;&#xA;t = (0:n-1)'/44100;&#xA;x = sin(2*pi*t*21000)+sin(2*pi*t*18000);&#xA;% calculate autocorrelation of original signal and one that's downsampled&#xA;% by 4 and thus heavily aliased&#xA;y = xcorr(x,x);&#xA;y2 = xcorr(x(1:4:end),x(1:4:end));&#xA;d = y(4:4:end)-4*y2;&#xA;% calculate the error in dB&#xA;err = 10*log10(sum(d.^2)./sum(y2.^2));&#xA;fprintf('Dual sine wave relative error = %6.2f dB\n',err);&#xA;&#xA;%% try the same thing for white noise&#xA;x = 2*rand(n,1)-1;&#xA;y = xcorr(x,x);&#xA;y2 = xcorr(x(1:4:end),x(1:4:end));&#xA;d = y(4:4:end)-4*y2;&#xA;err = 10*log10(sum(d.^2)./sum(y2.^2));&#xA;fprintf('White noise relative error = %6.2f dB\n',err);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-09-17T13:54:17.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="242" PostTypeId="2" ParentId="147" CreationDate="2011-09-17T20:22:06.567" Score="2" Body="&lt;p&gt;Aliasing can indeed be a good thing under certain conditions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at it this way: lets say your sampling rate is 100 Hz. Lets also say you have a signal somewhere out there, that is sitting from, say, 990 to 1010 Hz. (So its total bandwidth is 20 Hz, and it is centered at 1000 Hz).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok great, now what?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets suppose you sampled this signal at your 100 Hz rate. All that happens, is that your signal (sitting from 990-1010, centered at 1000Hz) is copied and shifted at integer multiples of 100 right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now all the sudden you have a copy of your original 990-1010 signal, except now you have one centered at 900, 800, 700, 600, etc etc, and also 1100, 1200, 1300, etc etc. The BW is the same of course. So your copy of your signal centered at 900 occupies 890-910 Hz. The copy sitting at 800 Hz occupies 790-810 Hz, and so on and so forth. You will also have a copy at 'baseband', (meaning it is centered at 0Hz, and so occupues -10 to 10Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when is this useful? Well, look at what you just did - you just managed to take your signal sitting at 1000Hz, put it down at baseband, and all this with a sampler running at just 100Hz! And guess what! You did this all legally according to Nyquist! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because Nyquist &lt;em&gt;doesn't&lt;/em&gt; say you have to sample at at least twice of the maximum freuqnency - wrong wrong wrong wrong wrong! (But &lt;em&gt;very&lt;/em&gt; common misconception.) He says you have to sample at least twice the maximum &lt;em&gt;bandwidth&lt;/em&gt; of your signal, which in this case, is 20Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applications? Well, a lot of basestations for cell phones actually use this 'undersampling' technique. So your cell phone signal is sitting at some high up Ghz range, and the basestation is sampling in the hundreds of Mhz range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And by the way, seeing as how Nyquist actually works, I dont like the term 'undersampling' - because that implies that we are, well, under-sampling. But we arent! We are completely following Nyquist, and &lt;em&gt;always&lt;/em&gt; sampling at least twice the maximum bandwidth of the signal in question. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="77" LastEditDate="2011-09-17T20:29:42.080" LastActivityDate="2011-09-17T20:29:42.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="245" PostTypeId="1" AcceptedAnswerId="261" CreationDate="2011-09-18T01:01:12.210" Score="6" ViewCount="919" Body="&lt;p&gt;If a device generates clicks and pops at start and end of audio file playback, even when those audio files are completely zeroed out and dc-offset corrected, what could've caused them?&lt;/p&gt;&#xA;" OwnerUserId="295" LastEditorUserId="77" LastEditDate="2011-09-18T03:48:48.203" LastActivityDate="2011-09-19T14:47:59.570" Title="What are the typical causes of clicks and pops in an audio file?" Tags="|noise|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="246" PostTypeId="2" ParentId="245" CreationDate="2011-09-18T03:21:48.723" Score="7" Body="&lt;p&gt;Clicking in an audio stream is typically indicative of some kind of discontinuity in the time-domain waveform. I'm not sure what you mean by &quot;zeroed out and dc-offset corrected,&quot; but these sort of artifacts can be created via unsophisticated audio editing methods. If you're suggesting, though, that an all-zero (i.e. pure silence) audio file will cause this behavior, then there's probably some little implementation detail that's causing it. Examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Audible effects caused by turn-on/turn-off of the output audio amplifier. This is relatively common.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Significant differences between the initial/final sample values and the output level forced to the DAC when &quot;idle&quot; (I can't think of a sane reason why the designer wouldn't make the DAC output zero when not in use, but it's possible to do something else).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-18T03:21:48.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="247" PostTypeId="2" ParentId="238" CreationDate="2011-09-18T04:47:48.993" Score="5" Body="&lt;p&gt;Decimating before calculating the autocorrelation, in the presence of noise, is inferior to calculating the autocorrelation using the full dataset. Assume that the signal of interest is embedded in white noise. The vector $x[n], n = 0, 1, ..., N-1$ consists of samples from a discrete random process. The autocorrelation function of the vector $x[n]$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;A_x[k] = \frac{1}{N-k} \sum_{i=0}^{N-1-k} x[i]x[i+k]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, $k$ is the lag used for the autocorrelation calculation. In your proposed scenario, you are decimating the autocorrelation function output by a factor $D$ (i.e. you are only calculating the function for lags $0, D, 2D, ...$) and comparing that result to the autocorrelation function of $x[n]$ decimated by the same factor $D$. Let $x_d[n]$ be the decimated sequence; its autocorrelation function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;A_{x_d}[k] = \frac{D}{N-k} \sum_{i=0}^{\frac{N-1-k}{D}} x[iD]x[(i+k)D]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(for simplicity here, I have assumed that $D$ is a factor of $N$ in the above equation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your inquiry can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;A_x[kD] \stackrel{?}{\approx} A_{x_d}[k]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{1}{N-kD} \sum_{i=0}^{N-1-kD} x[i]x[i+kD] \stackrel{?}{\approx} \frac{D}{N-k} \sum_{i=0}^{\frac{N-1-k}{D}} x[iD]x[(i+k)D]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at this qualitatively, the summation on the left hand side has more terms than its counterpart on the right side. If $x[n]$ is second-order stationary, then the expected value of each term in each sum is the same; the act of averaging multiple samples that have the same expected value increases the signal to noise ratio. Stated a little differently, you can think the terms in each sum as samples from a new random process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;y[n] = x[n]x[n+kD]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the noise present in $x[n]$ is white, the expected value of $y[n]$ is the true autocorrelation of the signal of interest at lag $kD$. Therefore, we would like to accurately estimate the expected value of $y[n]$. Our method for doing so is by calculating a sample average; it can easily be shown that the variance in the sample average estimator decreases given a larger sample size, converging to the actual expected value as the number of samples tends to $\infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if there is white noise present in the signal (which is often the case), you're going to get a better estimate of the underlying signal's second-order statistics by using a larger sample size in the calculation (this might sound intuitively obvious). In the context of your two approaches, this is accomplished by using the full, non-decimated signal in the autocorrelation calculation and decimating afterward (i.e. only calculating the result for certain lag values).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-18T04:47:48.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="248" PostTypeId="1" CreationDate="2011-09-18T13:58:51.653" Score="19" ViewCount="20401" Body="&lt;p&gt;I have many EEG signals and I want to analyze them using linear methods such as STFT (Short Time Fourier Transform). In STFT , How can I optimize the analysis window length, to reflect the frequency spectrum of each analysis window in a proper way?&lt;/p&gt;&#xA;" OwnerUserId="298" LastEditorUserId="77" LastEditDate="2011-09-18T14:38:05.333" LastActivityDate="2016-01-26T20:51:16.073" Title="How do I optimize the window lengths in STFT?" Tags="|fourier-transform|stft|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="249" PostTypeId="1" AcceptedAnswerId="259" CreationDate="2011-09-18T16:33:03.630" Score="5" ViewCount="177" Body="&lt;p&gt;[Thank you, @leftaroundabout for your helpful comments to my &lt;a href=&quot;https://dsp.stackexchange.com/questions/243/correlation-between-two-in-phase-signals-of-equal-length&quot;&gt;related question&lt;/a&gt;. I'm trying to ask a less confusing question here.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$0\leq\phi\leq 2\pi$ is a parameter that theoretically describes a system. $\alpha=\sin(\phi)$ and $\alpha' = \cos(\phi)$ are observables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a measurement, $\phi(t)$ is a continuous periodic function of the time $t$. $\alpha$ can be directly measured and $A_i$ is a noisy over-sampled digital representation of such a measurement. $\beta$ is a different observable, the relation between $\beta$ and $\phi$ shall be studied. $B_i$ is a sampled synchronously with $A_i$ and noisy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Three questions are interesting and the answer shall be found from $A_i$ and $B_i$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is $\delta = \beta(\phi=-\pi/2) - \beta(\phi=+\pi/2)$? This the difference of the $\beta$ values corresponding to the extrema of $\alpha$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is $\beta = a * \alpha + c$ a valid model and what is the coefficient $a$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we give a confidence interval for $a$ or $\delta$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Inspection of the data shows that a better model for $B_i$ is $\beta' = a * \alpha + a' * \alpha' + c$. Does this affect the recipe to find $\delta$ or $a$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third alternative model is $\beta'' = f(\phi) + c$. How to reliably find $\delta$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nature of the noise is unknown. The noise spectrum has both frequencies less then the modulation frequency of $\phi$ and higher frequencies. A Fourier filter (e.g. lowpass) renders $A_i$ and $B_i$ reasonably smooth.&lt;/p&gt;&#xA;" OwnerUserId="294" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2011-09-19T13:47:58.700" Title="Find the relation between two noisy periodic signals of equal length" Tags="|filters|discrete-signals|preprocessing|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="250" PostTypeId="1" AcceptedAnswerId="257" CreationDate="2011-09-18T21:01:50.263" Score="11" ViewCount="541" Body="&lt;p&gt;When a &lt;strong&gt;digital&lt;/strong&gt; device (PC, portable media player, etc.) plays a digital audio file (ogg, mp3, flac, etc.) the audio signal output is always the same, regardless of the device type/brand, am I right? Thus the sound quality should not differ. For instance, I have an iPod that plays an mp3 file. If I play the same file on a different brand media player the sound quality should be the same since it is the very same signal (no equalizers, or any sound alterations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this true? If it is true then I reckon it is only the headphones/speakers that matter as far as the sound quality is concerned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: all of the answers are really nice! wish i could accept 'em all&lt;/p&gt;&#xA;" OwnerUserId="302" LastEditorUserId="302" LastEditDate="2011-09-21T21:55:55.527" LastActivityDate="2011-09-22T08:12:56.317" Title="Audio output quality" Tags="|audio|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="251" PostTypeId="1" CreationDate="2011-09-18T22:45:35.357" Score="18" ViewCount="20207" Body="&lt;p&gt;When downsampling an image by an integer factor $n$, the obvious method is to set the pixels of the output image to the average of the corresponding $n \times n$ blocks in the input image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I remember vaguely having read somewhere that this method is not optimal (sorry I don't remember any details)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it true that there is a better method (and if so, where does the above method fail, although it seems &quot;obviously&quot; correct)? I do not know a lot about signal processing, this question just interests me.&lt;/p&gt;&#xA;" OwnerUserId="303" LastEditorUserId="4682" LastEditDate="2013-07-06T01:58:33.320" LastActivityDate="2016-02-11T11:43:25.317" Title="Downsampling an image by an integer factor" Tags="|image-processing|sampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="252" PostTypeId="2" ParentId="250" CreationDate="2011-09-19T00:43:51.357" Score="9" Body="&lt;p&gt;For the output quality to be the same, not only would the final digital signal have to be the same, but the path from the digital data to your ear (D/A converter including any digital preprocessing, amp, induced noise into the analog wiring, transducers/speakers, spatial paths to your ear, etc.) would have to add no audible differences.  This may or may not be true.  Not all D/A converters are equally linear.  Not all amp power supplies are equally shielded (especially really cheap ones).  Etc.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-09-19T00:43:51.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="253" PostTypeId="2" ParentId="251" CreationDate="2011-09-19T03:17:47.677" Score="17" Body="&lt;p&gt;Downsampling an image reduces the number of samples that can represent the signal. In terms of frequency domain, when a signal is downsampled, the high-frequency portion of the signal will be aliased with the low-frequency portion. When applied to image processing, the desired outcome is to preserve only the low-frequency portion. In order to do this, the original image needs to be preprocessed (alias-filtered) to remove the high-frequency portion so that aliasing will not occur.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The optimal digital filter to remove the high-frequency portion (with the sharpest cutoff) is &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot;&gt;sinc function&lt;/a&gt;. The reason is that the Sinc function's frequency domain representation is a nearly constant 1 over the entire low-frequency region, and nearly constant 0 over the entire high-frequency region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{sinc}(x)=\frac{\sin(\pi x)}{\pi x}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impulse response of the sinc filter is infinite. &lt;a href=&quot;http://en.wikipedia.org/wiki/Lanczos_resampling&quot;&gt;Lanczos filter&lt;/a&gt; is a modified sinc filter which attenuates the sinc coefficients and truncates them once the values drop to insignificance.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, being optimal in frequency domain does not imply being optimal in human eyes. There are upsampling and downsampling methods that do not obey linear transformations but produce better results than linear ones.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;With regard to the statement about $n \times n$, it is important to keep in mind that during image sampling, the choice of coordinates correspondence between the high-resolution signal and the low-resolution signal is not arbitrary, nor is it sufficient to align them to the same origin (0) on the real or discrete number line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The minimum requirement in the coordinates correspondence is that&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Upsampling an image containing arbitrary random values by an integer factor, then downsampling by the same integer factor, should result in the same image with minimal change numerically.&lt;/li&gt;&#xA;&lt;li&gt;Upsampling/downsampling an image consisting of just one uniform value, followed by the opposite operation, should result in an image consisting of the same value uniformly, with minimal numerical deviations.&lt;/li&gt;&#xA;&lt;li&gt;Repeatedly applying pairs of upsampling/downsampling should minimize the shift in image content as much as possible.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="58" LastEditorUserId="77" LastEditDate="2011-09-19T03:44:15.107" LastActivityDate="2011-09-19T03:44:15.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="254" PostTypeId="2" ParentId="250" CreationDate="2011-09-19T06:05:46.430" Score="3" Body="&lt;p&gt;It is very unlikely that the audio signal output is always the same. First off, the audio HW (chipset) is different between devices but before the digital audio actually gets D/A converted there is a good chance that it has been heavily processed. The reason being that the processing compensates for poor quality loudspeakers and a far from optimal stereo setup. Even though you disable everything you can in menus on the device (phone or laptop) it is almost certain that the audio is getting processed in one way or another. On a laptop I once experienced very weird audio quality until I found that default some noise reduction and echo cancellation stuff was enabled. If you use a different media player it could also make a difference. The answer to your question is that sound quality is almost certain going to be different from one device type to device type.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-09-19T06:05:46.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="255" PostTypeId="2" ParentId="248" CreationDate="2011-09-19T06:10:46.750" Score="1" Body="&lt;p&gt;I don't know EEG but the basic (maybe I should say fundamental) issue when using the STFT is choosing a proper window length. If your EEG is periodic and you want to resolve the fundamental and harmonics you should use a 'long' window. If you instead want to detect the onset or presence of some event or you're more interested in the envelope of the spectrum you can use a 'short' window.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-09-19T06:10:46.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="256" PostTypeId="2" ParentId="238" CreationDate="2011-09-19T06:24:33.427" Score="0" Body="&lt;p&gt;For specific types of inputs the effect of frequency aliasing on the magnitude of autocorrelations may be negligible. However, I don't think this will be true in general. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, for a bandlimited input or for white noise the under-sampling will not impact the shape of the autocorrelation (although it might change the scaling in a predictive way). The autocorrelation of white noise is a delta and it will remain to be a delta if down-sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the power spectrum is related to the autocorrelation by the fourier transform. So if your claim would be true it seems that you could also claim that frequency aliasing does not change the frequency contents of the input. And this is not true. But there might be exceptions (special cases).&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2011-09-19T09:01:58.880" LastActivityDate="2011-09-19T09:01:58.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="257" PostTypeId="2" ParentId="250" CreationDate="2011-09-19T10:51:58.567" Score="12" Body="&lt;p&gt;Unfortunately, the real-world gets in the way - there's a whole host of things between you and the &quot;bit-perfect&quot; waveform that comes from the MP3 decoder:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;As you noted, user controllable filtering (graphic eq for example) - this may be disabled.&lt;/li&gt;&#xA;&lt;li&gt;&quot;improvements&quot; to the sound made in the digital domain (for example compression to make it sound &quot;louder&quot; and bass boosting) - this may also be disabled&lt;/li&gt;&#xA;&lt;li&gt;The internal processing is often done at a greater bit depth than the output DAC capability - for example, 32 bit processing but only a 16 bit DAC.  There must then be a process to reduce the bit depth.  This may or may not include dithering of some sort.  The results of this will sound different depending on the implementation.&lt;/li&gt;&#xA;&lt;li&gt;The digital to analogue converters may be of differing quality, which will impact on (amongst other things) the linearity and noise floor of the analogue output.  &lt;/li&gt;&#xA;&lt;li&gt;The clock feeding the DAC will also have an impact on the performance - higher jitter will be noisier.&lt;/li&gt;&#xA;&lt;li&gt;The headphone driver will also have various analogue characteristics - eg. noise floor, frequency colouration etc.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2011-09-22T08:12:56.317" LastActivityDate="2011-09-22T08:12:56.317" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="258" PostTypeId="2" ParentId="248" CreationDate="2011-09-19T10:55:11.470" Score="7" Body="&lt;p&gt;This is the classic &quot;uncertainty principle&quot; of the Fourier Transform. You can either have high resolution in time or high resolution in frequency but not both at the same time. The window lengths allow you to trade off between the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to detect &quot;events&quot; in your EEG signal with a resolution of say 10ms, then this should be your window length. This will give you a frequency resolution of about 100 Hz. &lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="77" LastEditDate="2011-09-19T14:37:56.203" LastActivityDate="2011-09-19T14:37:56.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="259" PostTypeId="2" ParentId="249" CreationDate="2011-09-19T13:47:58.700" Score="2" Body="&lt;p&gt;All right, we can cope with this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So first, we should like to have some knowledge about the relation of  $i$ and $\phi$,&#xA;$$&#xD;&#xA;  \phi\colon\ \mathbb{Z} \to S^1,\qquad i\ \mapsto\ \phi_0+\frac1{\nu_{\!s}\cdot\omega_0}i&#xD;&#xA;  =: \varphi + \lambda i\quad {}_{^{(\operatorname{mod}2\pi)}}&#xD;&#xA;$$&#xA;Where we can essentially forget about the $\operatorname{mod}2\pi$, just view it as $S^1=\mathbb{R}/\!{\sim}$.&lt;br&gt;&#xA;There are multiple ways to determine the most likely values of $\varphi$ and $\lambda$; what I'd do is a least-square fit in those variables and $A_M$, perhaps also an offset $A_O$ such that&#xA;$$&#xD;&#xA;  \zeta := \sum_i \bigl(A_{\!M}\cdot\sin\,\phi(i) + A_O - A_i\bigr)^2&#xD;&#xA;$$&#xA;is minimized. A fitting algorithm like this can be somewhat slowish if you want it to work reliable, I don't know if that's a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we have this relation $\phi(i)$, we can just read out the $B_i$ for which $i$ is close to $\tfrac\pi2$ resp. close to $-\tfrac\pi2$. We can simply average over all next-neighbours to these real values, this way we're quite immune from nonlinear response, but rather more subject to noise than with using some kind of interpolation. You want to do it this way if you have a very large amount of data, spanning many periods of $\phi$. If you don't, better use some interpolation between the $B_i$ with $\phi(i)\approx\pm\tfrac\pi2$. I'd try a Friedrichs function as convolution kernel.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2011-09-19T13:47:58.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="260" PostTypeId="2" ParentId="251" CreationDate="2011-09-19T14:08:13.260" Score="6" Body="&lt;p&gt;You're right that area-averaging is pretty close to the &quot;most correct&quot; you can get, but the problem is inconsistent behavior when downscaling a sharp width-N line by a factor of N. If the location of the line is aligned modulo N, you'll get a sharp 1-pixel line, but if it's roughly N/2 mod N, you'll get a very blurred line (2 pixels wide at half intensity). This can look very bad, and with nonlinear gamma, it will even result in differences in intensity. (Ideally all resampling has to take place with gamma corrected for a linear intensity scale, but in practice almost nobody does that because it's really expensive.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to improve on this, you need to first accept the fact that it's impossible to reduce blurring in some cases, so the only way to get uniform output involves &lt;em&gt;increasing&lt;/em&gt; the blurring. The ideal way is to use a gaussian kernel with radius larger than N/2, rather than a step function, as the convolution function with the source image. A cheap way way to tack on an approximation, however, if you already have your N-by-N area averaging implementation, is just to apply a (1/4,1/2,1/4) blur convolution to the resulting downsampled image.&lt;/p&gt;&#xA;" OwnerUserId="309" LastActivityDate="2011-09-19T14:08:13.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="261" PostTypeId="2" ParentId="245" CreationDate="2011-09-19T14:47:59.570" Score="1" Body="&lt;p&gt;If your question relates to playback from a computer system, some audio drivers and codecs often have buffering schemes to stream audio to and from the hardware. I have found that some such drivers/codecs don't empty the queue of samples buffered up, even when the previous file is closed. This can account for a click at the start of playback. If you are getting a click at the beginning and the end it is most likely a driver issue.   &lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-09-19T14:47:59.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="262" PostTypeId="2" ParentId="250" CreationDate="2011-09-19T15:07:06.573" Score="8" Body="&lt;p&gt;WAV or FLAC are lossless, so the digital data should be identical when fed to the DAC.  Lossy formats like MP3 and OGG don't store a waveform, though.  It needs to be reconstructed from sparser data, and it's possible for the decoder to differ in its interpretation of the data.  However, for MP3:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Decoding, on the other hand, is carefully defined in the standard. Most decoders are &quot;bitstream compliant&quot;, which means that the decompressed output – that they produce from a given MP3 file – will be the same, within a specified degree of rounding tolerance, as the output specified mathematically in the ISO/IEC high standard document (ISO/IEC 11172-3). Therefore, comparison of decoders is usually based on how computationally efficient they are (i.e., how much memory or CPU time they use in the decoding process).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So assuming the EQ and other enhancements are turned off, as you said, there should be no difference from file to DAC.  The only differences would be after the DAC, in the quality of the analog circuitry, amplifiers, and speakers (which are usually the biggest cause of differences anyway).&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2011-09-19T15:07:06.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="263" PostTypeId="1" CreationDate="2011-09-19T23:53:04.717" Score="14" ViewCount="208" Body="&lt;p&gt;Back in the days of 1 MHz 8-bit CPU personal computers (Apple II, Atari 800, et.al.), there were software programs that could do comprehendible arbitrary text-to-speech synthesis on those PCs.  What published speech synthesis algorithms might be suitable for implementation on micro-controllers with similarly limited performance and memory?  (If any...)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2018-12-12T12:30:54.373" Title="Speech synthesis requiring very little CPU performance?" Tags="|speech-synthesis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="265" PostTypeId="2" ParentId="179" CreationDate="2011-09-20T01:26:43.907" Score="2" Body="&lt;p&gt;You're best off looking one level up, at datasheets or published benchmarks for actual devices that are available. One notable manufacturer of Cortex-M4 parts is Freescale. The Cortex-M4 is just a processor core design that is licensed by silicon manufacturers as the basis for their microprocessors. Each manufacturer designs their own peripherals and memory architecture and stitches them together with the core design. Therefore, what you might get from a core-level benchmark is the number of cycles required to execute your algorithm implemented in assembly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this doesn't capture are implementation-specific issues that can affect performance, such as memory latency, interrupt response latency, etc. These quantities will vary from manufacturer to manufacturer (and in some cases, across devices in a single family). Therefore, you really need to take the entire microprocessor into account if you're looking to do something that is pushing the envelope of what the chip might be capable of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even better: you can often find low-cost development kits for ARM processors (&lt;a href=&quot;http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KWIKSTIK-K40&amp;amp;tid=vanKWIKSTIK-K40&quot; rel=&quot;nofollow&quot;&gt;examples for Freescale's Cortex-M4 family&lt;/a&gt;). With that in hand, you can get a very good feel for how performant your algorithm will be once implemented in-system.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-20T01:26:43.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="267" PostTypeId="1" AcceptedAnswerId="268" CreationDate="2011-09-20T14:34:30.147" Score="2" ViewCount="83" Body="&lt;p&gt;If I have the details of a scene and a camera, how can I tell how much of my camera's image sensor will be taken by a certain object in space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I have a painting that is 1m by 1m, it is straight ahead 10 m away from my camera.  If my image sensor is 5 mm by 5 mm, and I fix the focal length of the camera, how do I determine how much of the image sensor will be taken up by the painting?&lt;/p&gt;&#xA;" OwnerUserId="324" LastActivityDate="2011-09-20T15:24:30.803" Title="Given some parameters, how do you determine how much of an image sensor an object will consume?" Tags="|image-processing|computer-vision|camera|" AnswerCount="1" CommentCount="1" ClosedDate="2013-01-06T22:31:05.710" ContentLicense="CC BY-SA 3.0" />
  <row Id="268" PostTypeId="2" ParentId="267" CreationDate="2011-09-20T15:24:30.803" Score="2" Body="&lt;p&gt;The basic idea is that the ratio of the distance/focal length will be the same as the physical/image ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, assuming a focal length of 100mm, this gives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$mag=10m/100mm=100$&#xA;$size_{image}=1m/mag=10mm$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, the distance is the distance measured from the focal point, which will be 1 focal length from the sensor, so that might factor into the equation as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://www.giangrandi.ch/optics/lenses/focalcalc.html&quot; rel=&quot;nofollow&quot;&gt;this calculator&lt;/a&gt; to play around with things a bit more.&lt;/p&gt;&#xA;" OwnerUserId="88" LastActivityDate="2011-09-20T15:24:30.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="269" PostTypeId="1" CreationDate="2011-09-20T17:13:24.747" Score="5" ViewCount="2562" Body="&lt;p&gt;I was watching the American and Indian idol auditions on youtube earlier in the day. I watched both successful and failed contestants and I was able to distinguish the really bad from the good singers even if I did not recognize the song or had ever heard the melody. Among the good singers, however, my limited knowledge of music prevented me from further discerning how good or bad they were. That set me thinking and I have the following questions to ask:   &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When we say that a singer is &quot;good&quot;, what do we mean by it in signal processing terms?&lt;/li&gt;&#xA;&lt;li&gt;What factors/characteristics should we consider when we say (with some authority) that the person is a &quot;good&quot; singer? Is it pitch, the &quot;tune&quot;, &quot;melody&quot;? How much weight should these (and other parameters) have when taking such a decision? &lt;/li&gt;&#xA;&lt;li&gt;How important a role would pitch play in this? I mean, if a man was to sing &lt;code&gt;My heart will go on&lt;/code&gt; in perfect tune (with low pitch), would he get a score higher than a woman who sang the same song (but much less perfectly)?&lt;/li&gt;&#xA;&lt;li&gt;When the contestants are shown singing, there is no background score playing. Yet, we are able to figure out who is singing well and who is not. So does that mean that the background score is pretty much irrelevant when it comes to deciding good/bad singing ability?  &lt;/li&gt;&#xA;&lt;li&gt;Can the above points be extended to all types of songs and genres? For instance, in most classical music (vocal), the singer is pretty much primary. The instruments etc. are present simply to aid the singer. These songs are tougher to sing (any Hindustani classical or &lt;code&gt;Largo al Factotum&lt;/code&gt;). Songs from rock/heavy metal (We will rock you/Suicide blonde) are a little easier to sing (IMO), because the instruments are primary and vocals are secondary.  &lt;/li&gt;&#xA;&lt;li&gt;How do we (if at all) compare two songs?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I suppose that the above problem would eventually lead me to look at karaoke scoring algorithms, of which there are good open-source options (Performous, UltraStar Deluxe etc.). But before I look at these in detail, I thought it would be great to put this out and see what ideas others in the community (with a far greater knowledge of music and ability) have on this.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: Reference to some papers/material on this would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: Some of the above examples/points are my opinions. Given what I know about music, they may be way off the mark. Please feel free to add/suggest more questions or correct opinions I may have expressed. I will be only too happy to make the necessary edits.&lt;/p&gt;&#xA;" OwnerUserId="102" LastEditorUserId="58" LastEditDate="2011-09-26T19:52:11.080" LastActivityDate="2011-09-26T19:52:11.080" Title="How is a &quot;good&quot; or &quot;bad&quot; singer defined in signal processing terms?" Tags="|algorithms|music|singing|voice|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="270" PostTypeId="1" CreationDate="2011-09-20T18:11:46.390" Score="9" ViewCount="17839" Body="&lt;p&gt;If a wide-sense stationary signal $X$ is fed to an LTI filter with the transfer function $H$, the power spectral density (PSD) of the output $Y$ can be expressed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_Y(f) = \left|H(f)\right|^2R_X(f)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $R_X$ denotes the PSD of $X$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this relation have a common name?&lt;/p&gt;&#xA;" OwnerDisplayName="user42" LastEditorUserId="1629" LastEditDate="2016-04-18T22:52:06.720" LastActivityDate="2016-04-18T22:52:06.720" Title="What is the relation between the PSDs of filter input and output called? $R_Y = |H|^2R_X$" Tags="|transfer-function|terminology|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="271" PostTypeId="2" ParentId="270" CreationDate="2011-09-20T18:31:17.803" Score="6" Body="&lt;p&gt;The relation that you have results from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem&quot; rel=&quot;nofollow&quot;&gt;Wiener-Khinchin theorem&lt;/a&gt; (WK). The WK theorem primarily relates the autocorrelation of the input and its power spectral density (PSD) as a Fourier transform pair. I have not heard it referred to by any particular name other than explicitly saying &lt;em&gt;&quot;From the WK theorem, we have blah...&quot;&lt;/em&gt; From the article cited:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A corollary [of the WK theorem] is that the Fourier transform of the autocorrelation function of the output of an LTI system is equal to the product of the Fourier transform of the autocorrelation function of the input of the system times the squared magnitude of the Fourier transform of the system impulse response.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While it was written and proven for signals (or functions) that are square integrable, and hence have a Fourier transform, it is commonly used to study &lt;a href=&quot;http://en.wikipedia.org/wiki/Stationary_process#Weak_or_wide-sense_stationarity&quot; rel=&quot;nofollow&quot;&gt;WSS random processes&lt;/a&gt; (which do not have a Fourier transform) by relating the autocorrelation via expectations rather than integrals.&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="77" LastEditDate="2011-09-20T23:52:04.993" LastActivityDate="2011-09-20T23:52:04.993" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="272" PostTypeId="2" ParentId="269" CreationDate="2011-09-20T18:40:26.850" Score="2" Body="&lt;p&gt;I think it is possible to make a DSP application (Android, iPhone, or whatever) that records a singing voice and rate the performance of the singer (maybe even provide feedback to the singer).&#xA;One of the things that the DSP program could do is to examine if the notes in the recording are at the correct frequencies or if they are off. &#xA;If the program knows the song, it might also be able to examine if the singer maintains a correct tempo.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-09-20T18:40:26.850" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="273" PostTypeId="2" ParentId="270" CreationDate="2011-09-20T18:41:24.217" Score="9" Body="&lt;p&gt;I don't know the name of the relationship, but $\vert H(f)\vert^2$ is&#xA;called the &lt;em&gt;power&lt;/em&gt; transfer function of the LTI system.  The output&#xA;&lt;em&gt;power&lt;/em&gt; spectrum is the input &lt;em&gt;power&lt;/em&gt; spectrum multiplied by the&#xA;&lt;em&gt;power&lt;/em&gt; transfer function, just as for deterministic signals, the output&#xA;spectrum is the input spectrum multiplied by the transfer function&#xA;$H(f)$. &lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2011-09-20T18:41:24.217" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="274" PostTypeId="2" ParentId="248" CreationDate="2011-09-20T19:33:55.650" Score="4" Body="&lt;p&gt;The optimum window length will depend on your application. If your application is such that you need time domain information to be more accurate, reduce the size of your windows. If the application demands frequency domain information to be more specific, then increase the size of the windows. As Hilmar mentioned, the &lt;code&gt;Uncertainty Principle&lt;/code&gt; really leaves you with no other choice. You cannot get perfect resolution in both domains at once. You can get perfect resolution in only one domain at the cost of zero resolution in the other (time and frequency domains) or in-between resolution, but in both domains.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know if this answers your question since you asked specifically about STFT. You could try to use &lt;code&gt;wavelet transforms&lt;/code&gt; to get at the information in the signal. &lt;code&gt;Wavelet transforms&lt;/code&gt; will give you resolution over a much larger range by analyzing the signal at multiple window resolutions.&lt;/p&gt;&#xA;" OwnerUserId="102" LastActivityDate="2011-09-20T19:33:55.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="275" PostTypeId="1" CreationDate="2011-09-20T21:00:58.133" Score="17" ViewCount="527" Body="&lt;p&gt;A generic implementation of ICA for the separation of a mixture of $N$ signals into their $M$ constituent components requires that the signals be assumed to be a linear instantaneous mixture of the sources.  Every description of ICA that I have come across seems to take for granted the fact that all $M$ sources are present to some extent in all $N$ signal mixtures.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what if the $M$ sources are only present in &lt;em&gt;some&lt;/em&gt; but not all of the signal mixtures?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this scenario violate the fundamental assumptions necessary for ICA to be able to separate these signals?  (Assume, for the sake of argument, that we are dealing with an overcomplete or complete system ($N&amp;gt;M$ or $N=M$), and that each of the $M$ source signals are in fact statistically independent from each other).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The implementation I am considering using ICA for, in which this situation arises, is the following: I have data from 4 different types of sensors, each with a different number of channels.  Specifically, I have 24 channels of EEG data, 3 channels of electrooculographic (EOG) data, 4 channels of EMG data, and 1 channel of ECG data.  All data is recorded simultaneously.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to identify the contributions of the ECG, EMG, and EOG signals within the EEG data so that I can remove them.  The expectation is that EMG+ECG+EOG signals will be picked up by the EEG sensors, but not vice versa.  Also, EOG and EMG will likely contaminate each other and be contaminated by ECG, but ECG will probably be pretty isolated from all the other signals.  Also, I'm assuming that where mixing does occur, it is linear and instantaneous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My intuition tells me that, hypothetically, ICA should be smart enough to return mixing filters with very small (close to 0) coefficients to account for the lack of contribution of sources to a mixed signal.  But I am worried that something about the way that ICA demixes the signals inherently enforces the expectation that all sources will be present in all mixtures.  The implementation I am using is FastICA, which is a projection pursuit-based approach.&lt;/p&gt;&#xA;" OwnerUserId="328" LastEditorUserId="76" LastEditDate="2012-08-23T12:09:57.110" LastActivityDate="2012-08-23T12:09:57.110" Title="Is ICA appropriate for separating mixed signals when all source signals are NOT detectable at all sensors?" Tags="|ica|eeg|separability|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="276" PostTypeId="2" ParentId="263" CreationDate="2011-09-20T23:54:13.903" Score="3" Body="&lt;p&gt;The methods I played with on 8-bit home computers back in the 80's involved having a small set of phonetic samples and then having the text you want to speak defined in terms of those samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I didn't know about &lt;a href=&quot;http://en.wikipedia.org/wiki/IPA&quot; rel=&quot;nofollow noreferrer&quot;&gt;IPA&lt;/a&gt; at the time, I just used two sounds per letter and allocated the short sound to lower case letters and long sounds to the uppercase. This did leave quite a few gaps though, &lt;strong&gt;o&lt;/strong&gt; for /ɒ/ (&lt;a href=&quot;https://commons.wikimedia.org/wiki/File:En-uk-hot.ogg?embedplayer=yes&quot; rel=&quot;nofollow noreferrer&quot;&gt;hot&lt;/a&gt;) and &lt;strong&gt;O&lt;/strong&gt; for /oʊ/ (&lt;a href=&quot;https://commons.wikimedia.org/wiki/File:En-uk-to_open.ogg?embedplayer=yes&quot; rel=&quot;nofollow noreferrer&quot;&gt;open&lt;/a&gt;) were easy, but /uː/ (the &lt;strong&gt;oo&lt;/strong&gt; sound in &lt;a href=&quot;https://commons.wikimedia.org/wiki/File:En-uk-moon.ogg?embedplayer=yes&quot; rel=&quot;nofollow noreferrer&quot;&gt;moon&lt;/a&gt;) couldn't be represented in my system, which was a problem for me, given my name (/buːð/ rhymes with /smuːð/, try them in &lt;a href=&quot;https://github.com/itinerarium/phoneme-synthesis/&quot; rel=&quot;nofollow noreferrer&quot;&gt;itinerarium&lt;/a&gt;s &lt;a href=&quot;https://itinerarium.github.io/phoneme-synthesis/&quot; rel=&quot;nofollow noreferrer&quot;&gt;phoneme synthesis&lt;/a&gt; web page).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These days, you could do much more clever stuff. For a start you could use lookup techniques to translate known words in &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthography&quot; rel=&quot;nofollow noreferrer&quot;&gt;orthographic text&lt;/a&gt; into your known &lt;a href=&quot;http://en.wikipedia.org/wiki/Phonetic_transcription&quot; rel=&quot;nofollow noreferrer&quot;&gt;phonetic&lt;/a&gt; symbols, and for unknown words, implementing &lt;a href=&quot;http://en.wikipedia.org/wiki/Phonics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phonics&lt;/a&gt; as an algorithm should do a reasonable job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After getting your phonetic stream, you could then probably use &lt;a href=&quot;http://en.wikipedia.org/wiki/Direct_memory_access&quot; rel=&quot;nofollow noreferrer&quot;&gt;DMA&lt;/a&gt; techniques to stream individual &lt;a href=&quot;http://en.wikipedia.org/wiki/Phoneme&quot; rel=&quot;nofollow noreferrer&quot;&gt;phoneme&lt;/a&gt; samples from memory to your DAC, with less overhead to your CPU.&lt;/p&gt;&#xA;" OwnerUserId="329" LastEditorUserId="329" LastEditDate="2018-12-12T12:30:54.373" LastActivityDate="2018-12-12T12:30:54.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="277" PostTypeId="1" CreationDate="2011-09-21T03:39:47.327" Score="1" ViewCount="169" Body="&lt;p&gt;Propose that we have a signal with a model of&#xA;$$&#xD;&#xA;f_{4at0} = v_0(1 - \epsilon + \epsilon \exp(-c_l(t_{t2d}-t_0)))&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{4at0}$ is dependent variable while $t_{t2d}$is independent variable,others are parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a representation of the relationship of biological material concentration-time that is inside the blood serum.Since this material cannot be assayed real time in the human body, the blood samples have to be collected from patients.It's really inconvenient to obtain blood samples from human.&lt;strong&gt;So, my question is what's the lower limit of sampling points? And how to schedule the sampling points?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps: here is the matlab code that I used .I want to use the &quot;Nyquist Sampling Principle&quot;,but I don't know how.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cl=6.2;&#xA;&#xA;epsilon=0.95;&#xA;&#xA;t0=0.3625;&#xA;&#xA;delta=0.1;&#xA;&#xA;v0=1000000;&#xA;&#xA;f4at0=v0*(1-epsilon+epsilon*exp(-cl*(tt2d-t0)));&#xA;&#xA;syms tt2d;&#xA;&#xA;f4=v0*(1-epsilon+epsilon*exp(-cl*(tt2d-t0)));&#xA;&#xA;fourier(f4,tt2d)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ans =&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;100000*pi*dirac(-tt2d) + 950000*transform::fourier(exp((31*tt2d)/5 + 899/400), -tt2d, -tt2d)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't know how to understand &lt;code&gt;transform::fourier(exp((31*tt2d)/5 + 899/400), -tt2d, -tt2d)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to calculate T since there is also a Dirac function.&#xA;I don't know if there are other principles apart from the &quot;Nyquist Sampling Principle&quot; that can be used here.&lt;/p&gt;&#xA;" OwnerUserId="332" LastEditorUserId="90" LastEditDate="2011-09-21T13:12:35.187" LastActivityDate="2011-09-21T13:58:13.460" Title="What is the smallest sampling points that can recover the signal?" Tags="|sampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="278" PostTypeId="2" ParentId="275" CreationDate="2011-09-21T06:31:39.843" Score="2" Body="&lt;p&gt;&quot;My question is, what if the M sources are only present in some but not all of the signal mixtures?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the same as saying that in your mixing matrix you will have some zeros. When M=N, I don't think it matters if you just make sure that the mixing matrix is non-singular. I'm not 100% sure though. But you could make a simple 3-by-3 toy experiment with one or more zeros in the mixing matrix to get some hands-on. If you read up on FastICA I bet you will find in the requirements placed on the mixing matrix that it has to be non-singular.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-09-21T06:31:39.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="279" PostTypeId="2" ParentId="277" CreationDate="2011-09-21T13:58:13.460" Score="3" Body="&lt;p&gt;This depends if you want to do sampling or just model identification. Model identification means &quot;figuring out the numbers in your model from actually measured data&quot;. If the model is good and the data is not noisy you only need a few points. The minimum is equal to the number of unknown model parameters. Let's say you don't know v0, cl, epsilon and t0. In this case you need at least four points to identify those. Your model isn't linear so there is some math involved, however it's not overly complicated and very workable.&#xA;If the measurements are noisy it would be good to take more points and do a least square error fit. The number of points depends on the amount of noise and precision required for the results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also sample the sequence but you need to consider sampling theorem. Your time sequence represents a first order lowpass filter. The cutoff frequency is determined only through your model parameter &quot;cl&quot; and is simply cl divided by 2 pi. At this frequency the spectrum is at -3 dB, at ten times this frequency it's at -20dB and at a 100 times this frequency it's -40 dB etc. Since it never gets all the way to zero you have to live with some amount of aliasing. Again it boils down to how much error you can/want to tolerate.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-09-21T13:58:13.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="280" PostTypeId="2" ParentId="275" CreationDate="2011-09-21T14:07:21.150" Score="4" Body="&lt;p&gt;You should be fine, zeros in the mixing matrix are not a problem....and theoretically it should converge even quicker than if all sources existed in all sensors.&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-09-21T14:07:21.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="281" PostTypeId="2" ParentId="269" CreationDate="2011-09-21T14:33:23.963" Score="3" Body="&lt;p&gt;This is a difficult question to answer in a scientifically rigorous fashion given that music (an art form) is generally a subjective issue and people will differ greatly on opinion. The problem is that, quantitatively, a singer could be &quot;perfect&quot; in pitch but have an objectionable tonal quality (timbre in musical terms). This can be due to accent, punctuation, emphasis etc... Most great singers the world has never heard of fall into this category. Then there is the opposite problem, someone who has poor pitch control but a pleasing voice. Frank Sinatra, is a fantastic example of this...it widely accepted that he sang slightly flat a great deal of the time. Tom Waits and Bob Dylan are yet more examples of less than perfect singers but there seems to be a general consensus that they have pleasing voices but again this all purely subjective. In DSP terms you would be forced to stick with quantitative features of the voice signal such as pitch accuracy and note timing (rhythm). Although not a &quot;serious&quot; voice analysis application, the technology behind Sony's Playstation game Singstar, uses a short-time frequency analysis technique to derive pitch from the players singing voice and then compares it against a time aligned annotation of the vocal track from the song. Other technologies use frequency analysis followed by pitch shifting to actually correct pitch in the singing voice in realtime &gt; Eg&gt; &lt;a href=&quot;http://www.celemony.com/cms/&quot; rel=&quot;nofollow&quot;&gt;http://www.celemony.com/cms/&lt;/a&gt; and &lt;a href=&quot;http://www.antarestech.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.antarestech.com/&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-09-21T14:33:23.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="282" PostTypeId="1" AcceptedAnswerId="284" CreationDate="2011-09-21T15:05:03.143" Score="10" ViewCount="6218" Body="&lt;p&gt;I asked a question over on &lt;a href=&quot;https://stackoverflow.com/questions/7498338/encoding-an-image-in-to-the-fourier-domain-of-a-sound/7498840#7498840&quot;&gt;stack overflow&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having a slight problem however.  As suggested by Paul R I am mirroring my lower $n/2$ bins into the upper $n/2$ bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few questions however.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'm assuming $n$ is $2^{fftOrder}$?  Thus for an order 10 IFFT I would be mirroring the bottom 512 frequency bins in to the top 512?  This would also produce me 1024 real samples in the end?&lt;/li&gt;&#xA;&lt;li&gt;When mirroring does this mean that bin 0 would go to bin $n - 1$, bin 1 to bin $n - 2$ and so on?&lt;/li&gt;&#xA;&lt;li&gt;I appear to be getting some form of reflection at a quarter of my sampling frequency?  This means that the top half of my frequency range is actually appearing over the bottom half.  Has anyone any ideas why? &lt;/li&gt;&#xA;&lt;li&gt;Does anyone have any idea why I am getting a striping effect where I get 512 samples of one magnitude and the next 512 of a different? (This &quot;could&quot; be where my mirroring is coming from)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think thats it for now.  Any help would be hugely helpful!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Giving you an image of the reflection will be near enough impossible as its very hard to see!  Basically I'm sampling at 22 kHz and getting nothing but &quot;noise&quot; above 11 kHz.  What &quot;ought&quot; (though obviously I'm doing something wrong) to be above 11 kHz seems to get reflected down from 11 kHz to 0.  Its very odd.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the image of the stripes they can be seen &lt;a href=&quot;http://www.trueharmoniccolours.co.uk/Stripes.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each stripe, I believe, is 512 samples wide.&lt;/p&gt;&#xA;" OwnerUserId="333" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2017-10-30T13:04:02.110" Title="Complex conjugate and IFFT" Tags="|fourier-transform|audio|" AnswerCount="4" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="283" PostTypeId="1" AcceptedAnswerId="292" CreationDate="2011-09-21T15:40:23.463" Score="13" ViewCount="581" Body="&lt;p&gt;I'm new to DSP, and just discovered this StackExchange, so apologies if this isn't the right place to post this question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a resource that describes genres in a more mathematical terms? For example, if I've performed an FFT on the signal on this section of the song (2:09 if the link doesn't start there), is there any way of me being able to detect that this section has that rough sort of sound? Do sounds like this follow some mathematical function with which I can compare?&#xA;&lt;a href=&quot;http://www.youtube.com/watch?v=SFu2DfPDGeU&amp;amp;feature=player_detailpage#t=130s&quot;&gt;http://www.youtube.com/watch?v=SFu2DfPDGeU&amp;amp;feature=player_detailpage#t=130s&lt;/a&gt; (link starts playing sound straight away)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the only way to use supervised learning techniques, or is there a different approach (which  preferably doesn't require supervision)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any advice.&lt;/p&gt;&#xA;" OwnerUserId="334" LastActivityDate="2011-09-28T03:29:28.207" Title="Recognizing math functions within songs" Tags="|algorithms|fourier-transform|audio|frequency-spectrum|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="284" PostTypeId="2" ParentId="282" CreationDate="2011-09-21T17:04:00.460" Score="4" Body="&lt;p&gt;I'm not sure what you're getting at with &quot;reflection&quot; or &quot;striping,&quot; but you want to duplicate your data points such that the frequency-domain signal (the input to the IFFT) is conjugate symmetric. That means, for $N$ even:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;X[k] = X^*[N-k], k = 1, 2, \ldots, \frac{N}{2}-1&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $k$ is zero-based; the first element in the vector is $X[0]$. The above indicates that you do not duplicate the zeroth and $\frac{N}{2}$-th elements in the input vector. This relationship is based on the periodicity of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete Fourier transform&lt;/a&gt;; the first half of the frequency-domain vector corresponds to &quot;positive&quot; frequencies covering the angular frequency range from $0$ to $\frac{(N-1)\pi}{N}$. The second half covers from $\pi$ to $\frac{(N-1)2\pi}{N}$, which, taking advantage of the $2\pi$ periodicity in the frequency domain, is equivalent to $-\pi$ to $\frac{-2\pi}{N}$. In order for the frequency-domain vector to have conjugate symmetry, then it can be easily shown that the above relationship must be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speaking to your original goal of converting a spectrogram into an audio signal that sounds meaningful, there's no guarantee that what you get out will be in any way pleasing. As was pointed out on Stack Overflow, the spectrogram has no phase information; the method suggested there assumes the phase of each frequency-domain bin is zero (so the conjugate operation shown above is superfluous). While the human ear isn't terribly sensitive to phase distortion in audio, you might have to do something else depending upon exactly what you're hoping to achieve.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-21T17:04:00.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="285" PostTypeId="1" AcceptedAnswerId="353" CreationDate="2011-09-21T17:07:37.040" Score="17" ViewCount="18097" Body="&lt;p&gt;I'm trying to get my head round the operation of the Wiener filter for the purpose of image noise reduction. In my case I'll have used another noise reduction filter first and will then use the result of this as an approximation of the noise characteristics for the Wiener filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding information on the Wiener filter, I found the following Matlab code &amp;amp; description useful:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.co.uk/help/toolbox/images/f11-12251.html#f11-14272&quot;&gt;http://www.mathworks.co.uk/help/toolbox/images/f11-12251.html#f11-14272&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and a few other good links such as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://blogs.mathworks.com/steve/2007/11/02/image-deblurring-wiener-filter/&quot;&gt;http://blogs.mathworks.com/steve/2007/11/02/image-deblurring-wiener-filter/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So from a Matlab perspective I can see how to use the inbuilt Matlab function, but I'd like to gain a more fundamental understanding rather than just use the function call, yet at the same time I'd prefer to find something more digestible than &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot;&gt;the Wikipedia entry on Wiener filtering&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone care to offer a brief explanation on Wiener filtering?&lt;/p&gt;&#xA;" OwnerUserId="300" LastEditorUserId="128" LastEditDate="2018-08-21T07:22:04.770" LastActivityDate="2018-08-21T07:22:04.770" Title="Wiener Filter for Image Noise Reduction (Image Denoising)" Tags="|image-processing|filters|noise|denoising|wiener-filter|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="286" PostTypeId="2" ParentId="269" CreationDate="2011-09-21T19:40:10.937" Score="5" Body="&lt;p&gt;First order, some DSP analysis might be able to detect central pitch, pitch variation (vibrato), timbre (overtone richness), and note onset, and say whether these are grossly out-of-tune, thin, or off-time, by how much and how often.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, second-order, good musicians play with subtile variations in pitch (equal vs. just intonation, barbershop quartet harmonization as the key changes, etc.) and in timing (jazz, blues, &quot;swing&quot; rhythms, etc.).  How to &quot;score&quot; the latter is probably more a topic for computer AI than DSP.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-09-21T19:40:10.937" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="287" PostTypeId="1" AcceptedAnswerId="288" CreationDate="2011-07-23T17:27:23.853" Score="9" ViewCount="1352" Body="&lt;p&gt;A filter that can be used for &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_signal_processing&quot; rel=&quot;noreferrer&quot;&gt;digital signals&lt;/a&gt; like audio, video or image processing can be defined using a matrix (&quot;kernel&quot;) that weights the surrounding area (this is a description I read in lecture notes from someone else).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The kernel&#xA;$$\left(\begin{array}{ccc} 1 &amp;amp; 1 &amp;amp; 1 \\&#xD;&#xA;1 &amp;amp; 1 &amp;amp; 1\\&#xD;&#xA;1 &amp;amp; 1 &amp;amp; 1\end{array}\right)$$&#xA; defines an &lt;a href=&quot;http://docs.gimp.org/en/plug-in-erode.html&quot; rel=&quot;noreferrer&quot;&gt;erode filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please tell me how this kernel is applied to e.g. an image (and therefore a 2D field of pixels)?&#xA;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="4497" OwnerDisplayName="muffel" LastEditorUserId="90" LastEditDate="2011-09-22T12:15:22.380" LastActivityDate="2016-11-04T08:04:28.263" Title="How to apply a filter kernel" Tags="|filters|image-processing|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="288" PostTypeId="2" ParentId="287" CreationDate="2011-07-23T19:00:37.167" Score="2" Body="&lt;p&gt;Your erode filter is incorrect. The link you gave says it is supposed to find the &lt;em&gt;maximum&lt;/em&gt; of the adjacent pixels, and your array does not do this. Instead, it gives the sum of the adjacent pixels. If you normalize the result (since all these additions will increase the brightness), then you will find that your filter simply evenly averages the adjacent pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you would generally do is take your image and convolve 3x3 blocks of it (or however big the filter is) with your filter. You can also do these in parallel, for speed.&lt;/p&gt;&#xA;" OwnerUserId="1059" OwnerDisplayName="Emre" LastActivityDate="2011-07-23T19:00:37.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="289" PostTypeId="2" ParentId="287" CreationDate="2011-07-23T22:22:42.573" Score="5" Body="&lt;p&gt;In image processing, to apply such a filter you would iterate over all pixels of the input image and in each step place the filter mask over the image so that its center is located at your current pixel. You then &quot;evaluate&quot; the pixels in the neighborhood that are covered by the mask in some way and write the result back to the current pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a normal convolution, you multiply each element of the filter with the value of the corresponding pixel, add up the results and write the sum to the current pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Erosion is a morphological operation, and you would implement it (on a binary image) by checking whether all &quot;1&quot; values of your mask lie over &quot;1&quot; pixels in the image. If so, you write a &quot;1&quot; to the current pixel (otherwise a &quot;0&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases, make sure to always read your input pixels from an umodified version of the image (rather than modifying the image in-place).&lt;/p&gt;&#xA;" OwnerUserId="477" OwnerDisplayName="koletenbert" LastActivityDate="2011-07-23T22:22:42.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="290" PostTypeId="1" AcceptedAnswerId="291" CreationDate="2011-09-22T01:46:18.807" Score="16" ViewCount="10160" Body="&lt;p&gt;I'm trying to calculate the loudness of an audio track I have stored in a buffer. The buffer contains PCM data of the signal and I want to get how 'loud' it is by using Root Mean Squared. I assume I can do this in the time-domain instead of having to switch to the frequency domain. What would be the pseudo-code for doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would I simply sample for one second (audio[0] - audio[44099], audio[44099] - audio[88199] etc..) and calculate the RMS of those values? So, for example, would I do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$RMS = \sqrt{\frac{\text{audio}[0]^2 + \text{audio}[1]^2 + \text{audio}[2]^2.....\text{audio}[44099]^2}{44100}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for each second?&lt;/p&gt;&#xA;" OwnerUserId="334" LastEditorUserId="6" LastEditDate="2011-09-22T20:32:36.517" LastActivityDate="2011-09-22T20:32:36.517" Title="Getting loudness of a track with RMS" Tags="|audio|discrete-signals|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="291" PostTypeId="2" ParentId="290" CreationDate="2011-09-22T04:29:10.597" Score="13" Body="&lt;p&gt;Another thing is that the RMS value is not very well correlated with perceived loudness. You might want to consider calling it level or volume instead. &#xA;There is something called equal loudness contours which quantifies how sensitive the ear is to one particular frquency compared to another frequency, see &lt;a href=&quot;http://en.wikipedia.org/wiki/Equal-loudness_contour&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Wikipedia article&lt;/a&gt;. These curves are level dependent.&#xA;For instance, the ear is very sensitive to a 1kHz tone compared to a 100Hz tone, as shown in this image (horizontal axis is frequency in Hz): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Lindos1.svg/400px-Lindos1.svg.png&quot; alt=&quot;equal loudness contours&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the relative simple things you can do is to filter your PCM data with an inverted equal loudness curve. Or you can apply the standard A weighting, see the Wikipedia &lt;a href=&quot;http://en.wikipedia.org/wiki/Weighting_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Weighting Filter article&lt;/a&gt;. Then you can compute the RMS value of the output of the equal loudness weighted filter. &lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.670" LastActivityDate="2011-09-22T20:29:06.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="292" PostTypeId="2" ParentId="283" CreationDate="2011-09-22T04:31:48.703" Score="11" Body="&lt;p&gt;I think the distinction you're looking for is more like empirical vs. theoretical (as opposed to supervised vs. unsupervised), but I could be wrong about that.  In other words, the ideal thing would be to have a theoretical definition of various genres, rather than just a bunch of opaque data which can be used to classify a song [without any real understanding].&lt;/p&gt;&#xA;&lt;p&gt;However, for general genre classification, you're probably stuck at least with training from examples, even if just to create the definitions of genres in the first place.  With respect to your example, consider how frequently people will argue [on YouTube] over whether a given track is really dubstep (e.g. any track that's more &lt;a href=&quot;http://www.youtube.com/watch?v=qWX3ZA7Gziw&amp;amp;fmt=18&quot; rel=&quot;nofollow noreferrer&quot;&gt;dubby&lt;/a&gt; and less &lt;a href=&quot;http://www.youtube.com/watch?v=BVZJb4zbms0&amp;amp;fmt=18&quot; rel=&quot;nofollow noreferrer&quot;&gt;wobbly&lt;/a&gt;, even though the genre started out without any real wobble). People define genres over time through examples, so it's reasonable to expect that algorithms which replicate that behavior would also require some examples.  The way people describe genres is almost like a &lt;a href=&quot;http://en.wikipedia.org/wiki/Feature_vector&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature vector&lt;/a&gt; anyway--they ask a list of questions about the song (e.g. Is it more breaky or wobbly? Does it have a lot of sub bass? How long is it? What's the tempo? Is there a vocal? etc.).&lt;/p&gt;&#xA;&lt;p&gt;Of course, you may be able to choose a list of features that also provide an intuitive understanding of the genre.  A feature like &amp;quot;Dynamic Range&amp;quot; is something that a person can also detect by ear, but something like &amp;quot;Time Domain Zero Crossings&amp;quot; wouldn't be very intuitive--even if it works well for classification.  The following paper has quite a few features that might be interesting to you:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;George Tzanetakis, Perry R. Cook: Musical genre classification of&#xA;audio signals. IEEE Transactions on Speech and Audio Processing 10(5):&#xA;293-302 (2002) &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.126.380&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For measuring roughness, &lt;a href=&quot;http://en.wikipedia.org/wiki/Roughness_%28psychophysics%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;psychoacoustic roughness&lt;/a&gt; would be a good place to start, but it might not be sufficient to distinguish between dubstep leads and electro leads, for example.  For finer-grained distinctions, one thing to look into is &lt;a href=&quot;http://www.google.com/search?q=timbre%20recognition&quot; rel=&quot;nofollow noreferrer&quot;&gt;timbre recognition&lt;/a&gt;.  The following thesis has a decent survey of techniques:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;T. H. Park, “Towards automatic musical instrument timbre recognition,”&#xA;Ph.D. dissertation, Princeton University, NJ, 2004. &lt;a href=&quot;http://www.tulane.edu/%7Epark/publications/ParkPrincetonThesis2004.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There's also a model related to perceptual roughness in &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/1849969221&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Timbre, Tuning, Spectrum and Scale&lt;/a&gt;  which is used for constructing custom scales for arbitrary timbres.  The idea is that harmonics which are very close together produce beat frequencies which are perceived as dissonance.  Paraphrasing from &lt;a href=&quot;http://books.google.com/books?id=wgoPicjjy6gC&amp;amp;lpg=PR2&amp;amp;dq=timbre%20tuning%20spectrum%20and%20scale&amp;amp;pg=PR15#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Appendix F and E&lt;/a&gt;,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is a spectrum with partials at frequencies &lt;span class=&quot;math-container&quot;&gt;$f_1,f_2,...,f_n$&lt;/span&gt;,&#xA;the intrinsic dissonance [assuming unit amplitudes] is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ D_F = 1/2 \space \sum_{i=1}^{n}{} \space \sum_{j=1}^{n}{\space d\left({|f_i - f_j| \over{\min(f_i,f_j)}} \right) } $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$d(x) = e^{-3.5 x} - e^{-5.75 x}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is a model of the &lt;a href=&quot;http://sethares.engr.wisc.edu/consemi.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plomp-Levelt Curve&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It's used for measuring how pleasing a given chord is with respect to a timbre (by minimizing the dissonance).  I don't know if either roughness of the psychoacoustic variety, or intrinsic dissonance would be very fruitful for your purposes on their own, but they may be useful in combination with other metrics.&lt;/p&gt;&#xA;&lt;p&gt;You'll probably have more luck classifying timbres mathematically than genres. For example, strings have even and odd harmonics, but a clarinet has only odd harmonics (cf. &lt;a href=&quot;http://en.wikipedia.org/wiki/Sawtooth_wave&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sawtooth wave&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Square_wave&quot; rel=&quot;nofollow noreferrer&quot;&gt;Square wave&lt;/a&gt;). Dubstep wobble tends to be done with LFO-driven filters (low pass and/or formant filters), so something like &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_flux&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spectral Flux&lt;/a&gt; (see [Tzanetakis], above) might be a good starting point as a feature. However, I doubt anyone has studied mathematical classification of wobble yet ;)&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2011-09-28T03:29:28.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="293" PostTypeId="1" CreationDate="2011-09-22T06:46:45.367" Score="7" ViewCount="968" Body="&lt;p&gt;Just out of curiousity, does anyone know how does google map put together all those massive quantity of satellite pictures with with high accuracy? What advanced computer science technology has it employed?&lt;/p&gt;&#xA;" OwnerUserId="338" LastEditorUserId="90" LastEditDate="2011-09-22T12:13:39.013" LastActivityDate="2011-09-28T15:16:00.027" Title="How does google map put together satellite pictures?" Tags="|image-processing|image-registration|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="294" PostTypeId="1" AcceptedAnswerId="296" CreationDate="2011-09-22T09:23:27.147" Score="20" ViewCount="1116" Body="&lt;p&gt;I always see the Kalman filter used with such input data. For example, the inputs are commonly a position and the correspondent velocity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;(x, \dfrac{dx}{dt})&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case, I only have 2D positions and angles at each sample time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;P_i(x_i, y_i) \qquad \text{and} \qquad (\alpha_1, \alpha_2, \alpha_3)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I compute velocities for each point and for each angle to be able to fit the Kalman framework?&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="90" LastEditDate="2011-09-22T12:15:53.987" LastActivityDate="2015-02-02T06:57:44.167" Title="Should the input of a Kalman filter always be a signal and its derivative?" Tags="|filters|adaptive-filters|kalman-filters|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="295" PostTypeId="2" ParentId="282" CreationDate="2011-09-22T10:40:28.083" Score="3" Body="&lt;p&gt;Your [0] index is the DC component and should not be mirrored. The reflection point should be (N/2)+1&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-09-22T10:40:28.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="296" PostTypeId="2" ParentId="294" CreationDate="2011-09-22T12:24:59.440" Score="12" Body="&lt;p&gt;A state variable and its derivative are often included as inputs to a Kalman filter, but this is not required. The essence of the Kalman framework is that the system in question has some internal state that you are trying to estimate. You estimate those state variables based on your measurements of that system's observables over time. In many cases, you can't directly measure the state that you're interested in estimating, but if you know a relationship between your measurements and the internal state variables, you can use the Kalman framework for your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a good example of this on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical&quot;&gt;Wikipedia page&lt;/a&gt;. In that example, 1-dimensional linear motion of an object is considered. The object's state variables consist of its position versus time and its velocity on the one-dimensional line of movement. The example assumes that the only observable is the object's position versus time; its velocity is not observed directly. Therefore, the filter structure &quot;infers&quot; the velocity estimate based on the position measurements and the known relationship between velocity and position (i.e. $\dot{x_k} \approx \frac{(x_k - x_{k-1})}{\Delta t}$ if acceleration is assumed to be slowly-varying).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-22T12:24:59.440" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="297" PostTypeId="2" ParentId="282" CreationDate="2011-09-22T12:50:27.667" Score="2" Body="&lt;p&gt;Let's say you have a 1024 point real sequence. A complex FFT turns that into 1024 complex numbers. However X[0] (DC) and X[512] Nyuist are real and X[1]..X[511] are conjugate symmetric so the whole spectrum can still be represented with 1024 numbers (2 reals and 511 complex).&#xA;Let's say you have a half sided spectrum X[0]...x[512] and want to create the conjugate symmetric version of it Y[0] ... Y[1023]. Do the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y[0] = X[0], Y[1] = X[1] .... Y[512] = X[512];&#xA;Y[513] = conjugate(X[511]), Y[514] = conjugate(X[510]) ... Y[1023] = conjugate(X[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you use Matlab you need to add &quot;1&quot; to all indices as Matlab starts counting at 1 (not at 0).&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-09-22T12:50:27.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="298" PostTypeId="5" CreationDate="2011-09-22T13:00:05.540" Score="0" Body="&lt;p&gt;In statistics, the Kalman filter is a mathematical method named after Rudolf E. Kálmán. Its purpose is to use measurements observed over time, containing noise (random variations) and other inaccuracies, and produce values that tend to be closer to the true values of the measurements and their associated calculated values. The Kalman filter has many applications in technology, and is an essential part of space and military technology development. A very simple example and perhaps the most commonly used type of Kalman filter is the phase-locked loop, which is now ubiquitous in FM radios and most electronic communications equipment. Extensions and generalizations to the method have also been developed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot; rel=&quot;nofollow&quot;&gt;Kalman filter article of Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2011-09-22T20:29:17.313" LastActivityDate="2011-09-22T20:29:17.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="299" PostTypeId="4" CreationDate="2011-09-22T13:00:05.540" Score="0" Body="The Kalman filter is a mathematical method using noisy measurements observed over time to produce values that tend to be closer to the true values of the measurements and their associated calculated values." OwnerUserId="16" LastEditorUserId="16" LastEditDate="2011-09-22T20:29:23.820" LastActivityDate="2011-09-22T20:29:23.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="300" PostTypeId="2" ParentId="146" CreationDate="2011-09-22T19:31:21.503" Score="8" Body="&lt;p&gt;One approach that I'm aware of is to &quot;load&quot; the diagonal of $\widehat{\mathbf{R}}$ by some value $\sigma_d^2$ in order to stabilize the covariance matrix and make the adaptive vectors more robust to signal mismatches. This is often done in matched field processing and is referred to as &lt;em&gt;diagonal loading&lt;/em&gt; or &lt;em&gt;white noise constraint beamforming&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the &lt;em&gt;robustified&lt;/em&gt; adaptive weight vectors are calculated as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\widehat{\mathbf{w}}_\theta=\frac{\left(\widehat{\mathbf{R}}+\sigma_d^2\mathbf{I}\right)^{-1} \mathbf{a}_\theta}{\mathbf{a}^H_\theta \left(\widehat{\mathbf{R}}+\sigma_d^2\mathbf{I}\right)^{-1} \mathbf{a}_\theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the output beam power is now computed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\widehat{B}_{mvdr}(\theta)=\widehat{\mathbf{w}}_\theta^H \left(\widehat{\mathbf{R}}+\sigma_d^2\mathbf{I}\right)\widehat{\mathbf{w}}_\theta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the result comparing the no mismatch, mismatch due to perturbed array and diagonally loaded cases for the MVDR beamformer for the situation in the question. There is an improvement in the signal power estimation, &lt;em&gt;at the expense of increased background noise power.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AHZhRm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-09-22T19:31:21.503" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="302" PostTypeId="2" ParentId="101" CreationDate="2011-09-23T14:10:53.080" Score="6" Body="&lt;p&gt;1-D 'Extrapolation' is quite simple by using the BURG's method to estimate the LP coefficients. Once LP coefficients are available one can easily compute the time samples by applying filter. The samples which are predicted with Burg's are the next time samples of your input time segment.&lt;/p&gt;&#xA;" OwnerUserId="351" LastActivityDate="2011-09-23T14:10:53.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="303" PostTypeId="1" CreationDate="2011-09-23T16:37:26.750" Score="7" ViewCount="5623" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/146/how-can-one-improve-the-robustness-of-adaptive-beamformers-to-signal-mismatches&quot;&gt;It has been shown&lt;/a&gt; that 'diagonal loading' a covariance matrix derived for an adaptive beamformer can improve robustness of the beamformer when the antenna array is perturbed, albeit at the expense of background noise power. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is &lt;em&gt;why&lt;/em&gt; does this work? Is the diagonal loading stopping the adaptive filter from reaching a local minima? Or is there some other mechanism at work here? &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2017-09-13T18:34:05.537" Title="Why does diagonal loading of a covariance matrix make an adaptive beamformer more robust in the case of a perturbed array?" Tags="|covariance|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="309" PostTypeId="1" AcceptedAnswerId="315" CreationDate="2011-09-23T20:58:12.377" Score="9" ViewCount="4106" Body="&lt;p&gt;I recently implemented an MMSE channel equalizer, and I have read about many other types of channel estimation/compensation algorithms out there. However, one thing that is never talked about it how to estimate the number of &lt;em&gt;taps&lt;/em&gt; in your model of the channel you are trying to estimate. How is this accomplished?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the MMSE implementation I have, I know the training sequence, and thus, and use the training sequence to minimize my error. However, what if the channel impulse response is longer than the training sequence? I would never see its effects, and thus its effects on the training sequence will not be seen. How does one then estimate the number of taps needed for channel estimation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2011-09-25T14:51:46.747" Title="How to estimate the number of taps needed for subsequent channel estimation algorithms?" Tags="|impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="314" PostTypeId="2" ParentId="309" CreationDate="2011-09-25T13:34:42.980" Score="5" Body="&lt;p&gt;The length of the impulse response is typically related to the frequency resolution of the channel transfer function. As a rule of thumb: the more detail there is in the frequency response, the longer the impulse response will be. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice there are a few things you can do: If you have full access to a similar, you can simply measure it with a very long impulse response measurement. Than you can truncate the impulse response and see what happens to the transfer function. The truncation will create errors and this way you can dial in the impulse response length to the point where the error is still tolerable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use physical knowledge about the channel. For example an audio amplifier has only a few electronic components, all of which are specifically designed to create a flat transfer function with little phase distortion. A handful of samples is fine for that. On the other hand  look at a loudspeaker in a room: the sound bounces around with multiple reflections until it finally dies off. In this case you would need many thousands of samples (not practical at all).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many systems have bandpass or high pass characteristic: all acoustic systems are high pass because air can't transmit DC sound. Most communication systems are band pass since the information needs to stay away from the extreme edges of the band. In these case often the length of the impulse response is determined by the high pass roll off, i.e. the frequency and steepness of the high pass.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-09-25T13:34:42.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="315" PostTypeId="2" ParentId="309" CreationDate="2011-09-25T14:51:46.747" Score="3" Body="&lt;p&gt;What you're looking for is a way to estimate the channel's &lt;em&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Delay_spread&quot; rel=&quot;nofollow&quot;&gt;delay spread&lt;/a&gt;&lt;/em&gt;. The delay spread is a measure of the effective duration of the channel's impulse response (often caused by &lt;a href=&quot;http://en.wikipedia.org/wiki/Multipath_propagation&quot; rel=&quot;nofollow&quot;&gt;multipath&lt;/a&gt;, which is useful for deciding how long your equalizing filter must be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How you go about doing this will vary depending upon the characteristics of your system. A couple potential approaches are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have the ability to institute a training period to your communication system, you can use a &lt;em&gt;channel sounding&lt;/em&gt; technique to estimate the response of your channel. There are a few ways to do this: you can transmit a short, impulse-like waveform through the channel and directly measure the impulse response, or you could send a waveform with known spectral properties (such as pseudorandom white noise) and measure the frequency response at the receiver. You can then inverse-transform the frequency response to get an estimate of the channel's impulse response. Then, estimate the effective length of the response by inspection of the result. These methods of estimating the delay spread somewhat defeat the purpose of using an adaptive equalizer, but if the channel's delay spread isn't expected to change much during system operation, then it can work.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If your waveform has good autocorrelation properties, like a direct-sequence spread spectrum signal or an OFDM waveform with a cyclic prefix, then you can use a correlator-based approach. During the synchronization process for signals such as these, one will often use a correlator (e.g. a &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;matched filter&lt;/a&gt;) to obtain accurate symbol timing by searching for peaks in the correlator's output. If there is multipath present in the channel, the correlator output will contain multiple peaks commensurate with the different paths that the signal can take through the channel. The delay spread can be estimated by measuring the duration in time between the first and last peaks.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Just like for equalizers in general, there is a lot of literature out there on methods of delay spread estimation. If you combine that search with the type of system that you're looking to implement, you are more likely to find results that work for your application.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-09-25T14:51:46.747" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="318" PostTypeId="1" AcceptedAnswerId="319" CreationDate="2011-09-26T04:01:04.880" Score="4" ViewCount="505" Body="&lt;p&gt;I need some help clarifying FFTs and what they represent. I have a buffer containing compressed audio. Due to limitations, I can't handle the full uncompressed audio but can decompress small segments at a time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say I take 10 seconds of uncompressed samples, I would need to store this in  &lt;code&gt;PCMaudiobuffer&lt;/code&gt; of size &lt;code&gt;10 * 44100 * sizeof(float)&lt;/code&gt; and I'd have &lt;code&gt;441000&lt;/code&gt; samples. I then loop through these &lt;code&gt;441000&lt;/code&gt; samples with a length of 1024 (with a 512 overlap).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for(int i =0; i &amp;lt; 441000; i += 512)&#xA;{&#xA;   //code to copy (i + 1024) from PCMaudiobuffer to tempbuffer. (not shown)&#xA;&#xA;   //perform FFT&#xA;   InPlaceFFT(tempbuffer);&#xA;&#xA;   //copy the first 512 values of the tempbuffer across to &#xA;   //a new buffer so tempbuffer can be reused in the loop&#xA;   CopyArray(512, finalbuffer);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming all of this is correct, this is where I'm confused. Am I right in copying only the first 512 values (N/2) to the &lt;code&gt;finalbuffer&lt;/code&gt;? (I'm using the Accelerate framework's FFT method). Is this an efficient/correct way of performing FFTs offline? Lastly, I want to be able to create a frequency spectrum from &lt;code&gt;finalbuffer&lt;/code&gt;. To do this do I simply loop through every &lt;code&gt;44100&lt;/code&gt; (1 second) and calculate the magnitude, or is 1 second generally too inaccurate for a frequency spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may be misunderstanding all of this, so feel free to tell me to throw all this out the window :) Thanks for any help, this is quite confusing! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&#xA;The Apple docs on this aren't easy to follow, but I'm using the method outlined here in &lt;a href=&quot;http://developer.apple.com/library/mac/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html#//apple_ref/c/func/vDSP_fft_zrip&quot; rel=&quot;nofollow noreferrer&quot;&gt;vDSP_fft_zrip&lt;/a&gt;. (The formatting of the Apple site sometimes messes up the anchor position, so you may have to scroll down slightly). I found &lt;a href=&quot;https://stackoverflow.com/questions/3398753/using-the-apple-fft-and-accelerate-framework&quot;&gt;this post&lt;/a&gt; to be a helpful guide on how to use it.&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="334" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2011-09-27T13:18:21.093" Title="Am I handling offline FFT correctly?" Tags="|algorithms|fourier-transform|audio|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="319" PostTypeId="2" ParentId="318" CreationDate="2011-09-26T06:44:26.377" Score="2" Body="&lt;p&gt;You are missing one important piece of information in your question and that is the prototype definition for the InPlaceFFT() function. The most important thing to be aware of is that the FFT returns complex valued numbers. It can be that the function expects the data to be formatted such that real and imaginary values are interleaved or it could be that the function expects the real parts to be placed first in the buffer and the imaginary part to be placed in the end of the buffer. It could also be that the function returns data bit reversed (see section &quot;Data reordering, bit reversal, and in-place algorithms&quot; here &lt;a href=&quot;http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another potential issue is the length of the buffer you pass as argument, your temp buffer. You might have to pass a buffer with a length that is at least 1024*sizeof(float) or 2048*sizeof(float), if you are sure that the InPlaceFFT() function expects a float* as input. If the InPlaceFFT() function is constrained to work on real input, a buffer size of 1024 might be sufficient. But you should take a better look at the documentation for how the InPlaceFFT() works in order to find out how large the size of you temp buffer should be and how the output is laid out in the temp buffer after it returns. Another thing that looks strange is that you don't need to pass the FFT size to InPlaceFFT().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are sure that the sample rate is always 44.1kHz it is fine to hardcode 44.1kHz into the code, otherwise you might want to make your code more flexible by loading the sample rate into a variable and use that in your code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 1024 point FFT returns 1024 values (complex). You only need the first 513 output values (these values are typically called bins), the rest are in principle redundant (although the can be handy to have). If you then want to compute the magnitude spectrum you need to compute the absolute value of the complex numbers (so your abs() function should work on complex numbers) and you are in principle done. The only thing left to do is to correct the values from index 1 to index 511 by multiplying them with 2. The values at index 0 and index 512 are real and need no correction. If you are going to plot the magnitude spectrum in a GUI you probably want to plot the magnitudes in dB. So you need to compute the log (base 10) of the magnitude values and multiply by 20.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be useful if you could update your post with the documentation for InPlaceFFT().&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="90" LastEditDate="2011-09-27T13:18:21.093" LastActivityDate="2011-09-27T13:18:21.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="320" PostTypeId="1" AcceptedAnswerId="321" CreationDate="2011-09-26T10:08:27.463" Score="17" ViewCount="10326" Body="&lt;p&gt;My system is the following. I use the camera of a mobile device to track an object. From this tracking, I get four 3D points that I project on the screen, to get four 2D points. These 8 values are kinda noisy, due to the detection, so I want to filter them to make the movement smoother and more realistic. As a second measurement, I use the device's gyroscope output, which provides three Euler angles (i.e. the device attitude). Those are more precise and at greater frequency (up to 100 Hz) than 2D positions (around 20 Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first attempt was with a simple low-pass filter, but the lag was important, so I now try to use a Kalman filter, hoping it will be able to smooth the positions with little delay. &lt;a href=&quot;https://dsp.stackexchange.com/questions/294/should-the-input-of-a-kalman-filter-always-be-a-signal-and-its-derivative&quot;&gt;As seen in a previous question&lt;/a&gt;, one key point in a Kalman filter is the relation between the measurements and the internal state variables. Here the measurements are both my 8 2D point coordinates and the 3 Euler angles, but I'm not sure about what I should use as internal state variables and how I should connect the Euler angles to the 2D points. Hence the primary question, is a Kalman filter even suitable for this problem? And if yes, how?&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-02-04T17:45:16.307" Title="Is a Kalman filter suitable to filter projected points positions, given Euler angles of the capturing device?" Tags="|filters|kalman-filters|state-space|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="321" PostTypeId="2" ParentId="320" CreationDate="2011-09-26T17:08:37.917" Score="4" Body="&lt;p&gt;&lt;strong&gt;Low Pass Filtering&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be good to know what you mean by &quot;simple low pass filter&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your measurements at time $k$ are &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;p_{k} = \left[ \begin{array}{c} x_k \\ y_k \end{array} \right]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and your low pass filtered estimates are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;p^{\tt LPF}_k = \alpha p^{\tt LPF}_{k-1} + (1-\alpha)p_k&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then you will have quite a large group delay in the filter of about $1/(1-\alpha)$ (for alpha close to 1).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Modeling the Signal: Simplistic Approach&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use the Kalman filter (or any similar approach), you need to have a model for how your measurements are acquired and updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually this looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;p^{\tt TRUE}_{k+1} = {\mathbf A} p^{\tt TRUE}_k + {\mathbf B} \epsilon_k&#xD;&#xA;$$&#xA;where $\epsilon_k$ is the process (driving) noise, ${\mathbf A}$ is the state transition matrix, and ${\mathbf B}$ is your input matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then your measured $p_k$ are:&#xA;$$&#xD;&#xA;p_k = {\mathbf C} p^{\tt TRUE}_k + {\mathbf D} \nu_k&#xD;&#xA;$$&#xA;where $\nu_k$ is the output (measurement) noise,  ${\mathbf C}$ is the output matrix, and ${\mathbf D}$ is your measurement noise matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the &quot;state&quot; of the model is chosen as the true positions, and the things you measure are the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then apply the Kalman filter equations to this to get state estimates $\hat{p^{\tt TRUE}_k }$ of the true position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this approach is simplistic because it does not use any knowledge of how the points might move (nor does it use your 4 points and any knowledge you might have about how they move together).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Modeling the Signal: Starting a Better Approach&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://campar.in.tum.de/Chair/KalmanFilter&quot; rel=&quot;nofollow&quot;&gt;This page shows how to set up the problem involving the positions and euler angles.&lt;/a&gt;&#xA;It's doing something different from what you need, but the state is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;p^{\tt TRUE}_{k} = \left[ &#xD;&#xA;x_k\  y_k\  z_k\  &#xD;&#xA;\dot{x}_k\  \dot{y}_k\  \dot{z}_k\  &#xD;&#xA;\ddot{x}_k\  \ddot{y}_k\  \ddot{z}_k\  &#xD;&#xA;\phi\ \psi\ \theta\ &#xD;&#xA;\dot{\phi}\ \dot{\psi}\ \dot{\theta}\ &#xD;&#xA;\ddot{\phi}\ \ddot{\psi}\ \ddot{\theta}\ &#xD;&#xA; \right]^T&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the measurements (output) is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;p_k = \left[ x_k\  y_k\  z_k\  \phi\ \psi\ \theta\ \right ]^T&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the model on that page is really doing is saying:&#xA;$$&#xD;&#xA;x^{\tt TRUE}_k = \sum_{n=0}^k \dot{x}^{\tt TRUE}_n n\Delta t + \frac{1}{2}  \sum_{n=0}^k \ddot{x}^{\tt TRUE}_n (n\Delta t)^2&#xD;&#xA;$$&#xA;(but for each of $x,y,$ and $z$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just the classic &quot;equations of motion&quot;. &lt;a href=&quot;http://en.wikipedia.org/wiki/Equations_of_motion#Classic_version&quot; rel=&quot;nofollow&quot;&gt;See equation (3) here.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2011-09-27T13:25:12.967" LastActivityDate="2011-09-27T13:25:12.967" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="322" PostTypeId="1" AcceptedAnswerId="323" CreationDate="2011-09-26T21:18:46.947" Score="24" ViewCount="8642" Body="&lt;p&gt;What are some algorithms for generating a good pseudo-random approximation to $1/f$ (pink) noise, yet suitable for implementation with low computational cost on an integer DSP?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-09-27T01:42:29.733" LastActivityDate="2019-05-08T20:09:56.027" Title="Pink ($1/f$) pseudo-random noise generation" Tags="|noise|random|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="323" PostTypeId="2" ParentId="322" CreationDate="2011-09-26T21:31:49.690" Score="16" Body="&lt;p&gt;There are several. &lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/&quot; rel=&quot;noreferrer&quot;&gt;This site has a reasonable (but possibly old) list:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/#Filtering&quot; rel=&quot;noreferrer&quot;&gt;Filtering white noise to make it pink&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/#Voss&quot; rel=&quot;noreferrer&quot;&gt;The Voss algorithm.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/#Voss-McCartney&quot; rel=&quot;noreferrer&quot;&gt;The Voss-McCartney algorithm.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastActivityDate="2011-09-26T21:31:49.690" CommentCount="2" CommunityOwnedDate="2011-10-09T18:22:45.040" ContentLicense="CC BY-SA 3.0" />
  <row Id="325" PostTypeId="2" ParentId="285" CreationDate="2011-09-27T00:33:27.350" Score="11" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;nofollow&quot;&gt;There is another Wikipedia entry&lt;/a&gt; on Wiener filtering more applicable to image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize (and convert to 2D), given a system:&#xA;$$&#xA;y(n,m) = h(n,m) * x(n,m)  + v(n,m)&#xA;$$&#xA;where &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$*$ denotes convolution, &lt;/li&gt;&#xA;&lt;li&gt;$x$ is the (unknown) true image,&lt;/li&gt;&#xA;&lt;li&gt;$h$ is the impulse response of a linear, time-invariant filter,&lt;/li&gt;&#xA;&lt;li&gt;$v$ is additive unknown noise independent of $x$, and&lt;/li&gt;&#xA;&lt;li&gt;$y$ is the observed image.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We want to find a deconvolution filter $g$ so that we can estimate $x$ as follows:&#xA;$$&#xA;\hat{x}(n,m) = g(n,m) * y(n,m)&#xA;$$&#xA;where $\hat{x}$ is an estimate of $x$ that minimizes the mean square error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain, the transfer function of $g$, $G$ is:&#xA;$$&#xA;G(\omega_1, \omega_2) = \frac{H^*(\omega_1, \omega_2)S(\omega_1, \omega_2)}{|H(\omega_1, \omega_2)|^2S(\omega_1, \omega_2) + N(\omega_1, \omega_2)}&#xA;$$&#xA;where&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$G$ is the Fourier transform of $g$,  &lt;/li&gt;&#xA;&lt;li&gt;$H$ is the Fourier transform of $h$,  &lt;/li&gt;&#xA;&lt;li&gt;$S$ is the mean power spectral density of the input $x$, and  &lt;/li&gt;&#xA;&lt;li&gt;$N$ is the mean power spectral density of the noise $v$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The equation for $G$ can be re-written as:&#xA;$$&#xA;G(\omega_1, \omega_2) = \frac{1}{H(\omega_1, \omega_2)} &#xA;\left[ \frac{|H(\omega_1, \omega_2)|^2}{H(\omega_1, \omega_2)|^2 + \frac{N(\omega_1, \omega_2)}{S(\omega_1, \omega_2)}}&#xA;\right]&#xA;$$&#xA;So the Wiener filter has the inverse filter for $H$, but also a frequency-dependent term that attenuates the gain based on the signal to noise ratio. &lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="8233" LastEditDate="2016-02-04T22:13:12.973" LastActivityDate="2016-02-04T22:13:12.973" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="326" PostTypeId="2" ParentId="62" CreationDate="2011-09-27T05:18:37.210" Score="-1" Body="&lt;p&gt;Kellenjb, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The noise in both the I and Q are not in fact going to be gaussian. In fact they are going to originate from the same original noise vector. This is because there was only one noise vector to begin with at the receiver. So what is happening, is your signal comes into the receiver, where AWGN is added of course. Soon afterwards though, the receiver is going to project that (signal + noise) onto a sin basis, and onto a cosine basis, thereby giving you your I and Q components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now the noise in either branch is no longer gaussian, but are in fact, the product of a sin basis times orignal noise vector, and product of cosine basis times original noise vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I would recommend to simulate this, (are you doing all of this in baseband?), is to simply construct a sin and cosine basis, and simply multiply against (signal+noise), where 'signal' is your original signal of course, and then of course take it down to baseband after that. In fact once you filter for taking it down to baseband, your noise vectors are going to be non-white, and non-gaussian. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps! :)&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2011-09-27T05:18:37.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="327" PostTypeId="1" CreationDate="2011-09-27T11:45:27.917" Score="2" ViewCount="196" Body="&lt;p&gt;I'm looking for an algorithm to store small dimensions of some pictures and later search on the stored data for matches similar to a new picture. Maybe something with Self Organizing Map in machine learning ?&lt;/p&gt;&#xA;" OwnerUserId="277" LastEditorUserId="1650" LastEditDate="2013-01-16T02:09:56.647" LastActivityDate="2013-01-16T07:25:01.573" Title="Is there an algorithm to compare several pictures?" Tags="|image-processing|algorithms|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="328" PostTypeId="1" CreationDate="2011-09-27T19:06:52.943" Score="43" ViewCount="6087" Body="&lt;p&gt;I am trying to teach myself more about image compression using the wavelet transform method.  What is it about certain wavelets that make them preferable when compressing images?  Are they easier to compute? Do they produce smoother images?&lt;/p&gt;&#xA;&lt;p&gt;Example: &lt;a href=&quot;http://en.wikipedia.org/wiki/JPEG_2000&quot; rel=&quot;nofollow noreferrer&quot;&gt;JPEG 2000&lt;/a&gt; uses the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cohen-Daubechies-Feauveau_wavelet&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cohen-Daubechies-Feauveau&lt;/a&gt; 9/7 Wavelet. Why this one?&lt;/p&gt;&#xA;" OwnerUserId="370" LastEditorUserId="7092" LastEditDate="2023-11-21T16:42:11.937" LastActivityDate="2023-11-21T16:42:11.937" Title="What properties make certain wavelets &quot;better&quot; than others in image compression?" Tags="|image-processing|wavelet|image-compression|" AnswerCount="6" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="329" PostTypeId="5" CreationDate="2011-09-28T09:49:28.203" Score="0" Body="&lt;p&gt;DCTs are important to numerous applications in science and engineering, from lossy compression of audio (e.g. MP3) and images (e.g. JPEG) (where small high-frequency components can be discarded), to spectral methods for the numerical solution of partial differential equations. The use of cosine rather than sine functions is critical in these applications: for compression, it turns out that cosine functions are much more efficient (as described below, fewer are needed to approximate a typical signal), whereas for differential equations the cosines express a particular choice of boundary conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2011-09-28T14:45:17.633" LastActivityDate="2011-09-28T14:45:17.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="330" PostTypeId="4" CreationDate="2011-09-28T09:49:28.203" Score="0" Body="The Discrete Cosine Transform expresses a sequence of finitely many data points in terms of a sum of cosine functions oscillating at different frequencies." OwnerUserId="16" LastEditorUserId="16" LastEditDate="2011-09-28T14:45:15.823" LastActivityDate="2011-09-28T14:45:15.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="331" PostTypeId="1" CreationDate="2011-09-28T12:24:43.510" Score="20" ViewCount="6827" Body="&lt;p&gt;Suppose we wish to interpolate a periodic signal with an even number of samples (e.g. N=8) by zero-padding in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let the DFT &lt;code&gt;X=[A,B,C,D,E,F,G,H]&lt;/code&gt;&lt;br&gt;&#xA;Now let's pad it to 16 samples to give &lt;code&gt;Y&lt;/code&gt;.  Every textbook example and online tutorial I have seen inserts zeros at &lt;code&gt;[Y&lt;sub&gt;4&lt;/sub&gt;...Y&lt;sub&gt;11&lt;/sub&gt;]&lt;/code&gt; giving&lt;br&gt;&#xA;&lt;code&gt;Y=[2A,2B,2C,2D,0,0,0,0,0,0,0,0,2E,2F,2G,2H]&lt;/code&gt;.&lt;br&gt;&#xA;(Then &lt;code&gt;y = idft(Y)&lt;/code&gt; is the interpolated signal.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why not instead use&#xA;&lt;code&gt;Y=[2A,2B,2C,2D,E,0,0,0,0,0,0,0,E,2F,2G,2H]&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell (my math knowledge is limited):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It minimises the total power&lt;/li&gt;&#xA;&lt;li&gt;It ensures that if &lt;code&gt;x&lt;/code&gt; is real-valued then so is &lt;code&gt;y&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;y&lt;/code&gt; still intersects &lt;code&gt;x&lt;/code&gt; at all the sample points, as required (I think this is true for any &lt;code&gt;p&lt;/code&gt; where &lt;code&gt;Y=[2A,2B,2C,2D,pE,0,0,0,0,0,0,0,(2-p)E,2F,2G,2H]&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So why is it never done this way?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: &lt;code&gt;x&lt;/code&gt; is not necessarily real-valued or band-limited.&lt;/p&gt;&#xA;" OwnerUserId="272" LastEditorUserId="272" LastEditDate="2011-09-28T18:19:51.393" LastActivityDate="2022-03-30T13:42:26.587" Title="Frequency-domain zero padding - special treatment of X[N/2]" Tags="|dft|interpolation|zero-padding|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="332" PostTypeId="2" ParentId="331" CreationDate="2011-09-28T12:54:02.600" Score="2" Body="&lt;p&gt;There are many ways to interpolate data. Interpolation in my mind means that you 'draw' lines between some data points. This can be done many ways. One type of interpolation which is useful in DSP (especially in multirate DSP) is 'Bandlimited interpolation'. If you google that you will get many interesting and useful hits. What you propose is not bandlimited interpolation. In your 'upsampled' x you have frequency components not present in the original x. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit (too long to fit into a comment):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a quite significant difference between your construction, starting with $X=[A,B,C,D,E,F,G,H]$ and the example in the reference you provide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering real input&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X=[A,B,C,D,E,D^*,C^*,B^*]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upsampling by a factor of 2 for fullband input. In this case upsampling can be performed by first placing zeros in the input interleaved (that is $x_0,0,x_1,0,...$. The result is a signal with a frequency spectrum containing a compressed version of the frequency spectrum of x (in range $0-\pi/2$) and an image extending from $\pi/2 - \pi$ (considering only the positive frequency axis). If x2 is the upsampled version then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X2=[A,B,C,D,E,D^*,C^*,B^*,A,B,C,D,E,D^*,C^*,B^*]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the ideal case an ideal brick-wall filter with cutoff frequency $\pi/2$ is required in order to remove the image. That is (for infinite input)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_n = \sum_{k=-\infty}^{\infty} x2_k  sinc(0.5n - k)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice though there will be some distortion because the brick-wall filter is not realistic. The practical filter can suppress/remove frequencies in the input or it can leave in some of the  frequency components in the image in the upsampled signal. Or the filter can make a compromise between the two. I think your frequency-domain construction also reflects this compromise. These two examples, represents two different choices:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y=[A,B,C,D,E,0,0,0,0,0,0,0,E^*,D^*,C^*,B^*]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y=[A,B,C,D,0,0,0,0,0,0,0,0,0,D^*,C^*,B^*]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input is bandlimited below the nyquist frequency as in your reference this issue disappears. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe it is possible to find a value of $\rho$ below, such that some error function, for instance the squared error between the input spectrum and the upsampled output spectrum is minimum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y=[A,B,C,D,\rho,0,0,0,0,0,0,0,\rho^*,D^*,C^*,B^*]$&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2011-09-30T13:16:55.753" LastActivityDate="2011-09-30T13:16:55.753" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="333" PostTypeId="2" ParentId="331" CreationDate="2011-09-28T13:24:57.360" Score="8" Body="&lt;p&gt;Let's look at the frequencies of the bins in your 8-point DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{array}{c}&#xD;&#xA;\omega_A = 0,\\&#xD;&#xA; \omega_B = \pi/4,\\&#xD;&#xA; \omega_C = \pi/2,\\&#xD;&#xA; \omega_D = 3\pi/4,\\&#xD;&#xA; \omega_E = \pi = -\pi\ ({\tt mod}\ 2\pi),\\&#xD;&#xA; \omega_F = 5\pi/4 = -3\pi/4\ ({\tt mod}\ 2\pi),\\&#xD;&#xA; \omega_G = 3\pi/2 = -\pi/2\ ({\tt mod}\ 2\pi), \\&#xD;&#xA; \omega_H = 7\pi/4 = -\pi/4\ ({\tt mod}\ 2\pi)&#xD;&#xA;\end{array}&#xD;&#xA;$$&#xA;So when you interpolate by a factor of 2, point $E$'s frequency becomes $-\pi$ or $+ \pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At a first glance, I can't see what the problem is with your approach as it's not clear whether $E$ should be put into the bin associated with $\pi$ or $-\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On &lt;a href=&quot;https://ccrma.stanford.edu/~jos/mdft/Zero_Padding.html&quot; rel=&quot;noreferrer&quot;&gt;Julius O. Smith III's page&lt;/a&gt;, he states a condition:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Furthermore, we require $x(N/2) = x(-N/2) = 0$  when $N$  is even, while odd  requires no &#xA;  such restriction. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And his example there is for an odd $N$, which avoids the problem.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Not sure it's required, but here's the full reference to Julius's work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Smith, J.O. Mathematics of the Discrete Fourier Transform (DFT)&#xA;with Audio Applications, Second Edition,&#xA;&lt;a href=&quot;http://ccrma.stanford.edu/~jos/mdft/&quot; rel=&quot;noreferrer&quot;&gt;http://ccrma.stanford.edu/~jos/mdft/&lt;/a&gt;, 2007, online book, &#xA;accessed September 28, 2011.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2011-09-28T18:24:04.360" LastActivityDate="2011-09-28T18:24:04.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="334" PostTypeId="2" ParentId="293" CreationDate="2011-09-28T15:16:00.027" Score="5" Body="&lt;p&gt;This certainly is a signal processing question albeit a little vague. I can't say for certain that Google use it but the SIFT (shift invariant feature transform) algorithm &lt;a href=&quot;http://www.cs.ubc.ca/~lowe/keypoints/&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.ubc.ca/~lowe/keypoints/&lt;/a&gt; has been used in variant form in technologies such as Microsoft's Photosynth. It allows key features of multiple images containing overlapping content (supject to arbitrary X,Y,Z shifts) to be registered and matched. In simple terms...very clever image stitching.  The link provides all the paper references to the original algorithm. For another example of such technology check out this lecture about photosynth &gt; &lt;a href=&quot;http://www.ted.com/talks/blaise_aguera_y_arcas_demos_photosynth.html&quot; rel=&quot;nofollow&quot;&gt;http://www.ted.com/talks/blaise_aguera_y_arcas_demos_photosynth.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-09-28T15:16:00.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="335" PostTypeId="5" CreationDate="2011-09-28T15:54:44.410" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-09-28T15:54:44.410" LastActivityDate="2011-09-28T15:54:44.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="336" PostTypeId="4" CreationDate="2011-09-28T15:54:44.410" Score="0" Body="The fast Fourier transform is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse." OwnerUserId="16" LastEditorUserId="16" LastEditDate="2011-09-28T15:57:03.977" LastActivityDate="2011-09-28T15:57:03.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="337" PostTypeId="2" ParentId="327" CreationDate="2011-09-29T07:02:02.500" Score="2" Body="&lt;p&gt;It looks like you are looking for algorithms for &lt;a href=&quot;http://en.wikipedia.org/wiki/Content-based_image_retrieval&quot; rel=&quot;nofollow&quot;&gt;Content-Based Image Retrieval&lt;/a&gt;. As long as you don't expect any miracles, you should be quite happy with a colour histogram approach. Have a look at &lt;a href=&quot;http://mpeg.chiariglione.org/standards/mpeg-7/mpeg-7.htm#E11E2&quot; rel=&quot;nofollow&quot;&gt;MPEG-7 colour descriptors&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2011-09-29T07:02:02.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="338" PostTypeId="1" AcceptedAnswerId="343" CreationDate="2011-09-29T18:02:53.800" Score="16" ViewCount="10541" Body="&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am designing a system that will have a single small microphone and speakers for use in a phone type setting. Easiest example I can give is a Skype conversation where you are using your computers speakers and a desktop microphone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am worried about the audio from the speakers getting picked up by the microphone and sent back to the original person. I used to hear this happen all the time in the early days of VoIP conversations, but hardly hear it any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My assumption is that groups have come up with ways to cancel out the echo, but how do they do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Approaches&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought was to just simply subtract the signal being sent to the speakers from the microphone signal, except with this method you have to be concerned with the delay. I am not sure how to determine what the delay is with out some sort of pre-calibration, which I would like to avoid. There is also the issue of how much to scale the signal by before subtracting it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I next thought about doing some sort of correlation between the speaker signal and the mic signal in order to determine the likelihood of the mic signal being an echo as well as being able to determine the actual delay. This method was able to work alright when I was playing with some recorded signals, but there seemed to be far to large of latency in computing the correlation to be useful in real-time system. Also the adjustable volume on the speakers made it difficult to determine if something was actually correlated or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My next thought that there must be someone on the internet who has done this before with success, but didn't find any great examples. So I come here to see what methods can be used to solve this type of issue.&lt;/p&gt;&#xA;" OwnerUserId="17" LastActivityDate="2015-06-24T09:54:51.293" Title="What methods can be used to identify and remove echo from an audio system?" Tags="|audio|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="340" PostTypeId="1" CreationDate="2011-09-29T21:36:28.217" Score="1" ViewCount="130" Body="&lt;p&gt;I am looking for information on how to decode &lt;a href=&quot;http://en.wikipedia.org/wiki/Slow-scan_television&quot; rel=&quot;nofollow&quot;&gt;slow scan TV&lt;/a&gt; signals, which is a method of transmitting static images using everyday FM radio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen software but I don't understand how to start. Any open source would help as well. To very specific I want to know how to decode the sound into an image.&lt;/p&gt;&#xA;" OwnerUserId="379" OwnerDisplayName="Jonathan Kaufman" LastEditorUserId="6" LastEditDate="2011-09-29T22:05:44.060" LastActivityDate="2011-09-29T22:05:44.060" Title="Slow Scan TV Documentation" Tags="|video-processing|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="341" PostTypeId="2" ParentId="294" CreationDate="2011-09-30T05:58:26.513" Score="3" Body="&lt;p&gt;Yaw-rate of the camera may be calculated from deviding the velocity of a 2D position by a image depth(one of the 3D position).&#xA;So, basicaly  you have two types of solutions of the yaw-rate, oen is by image position processing ,another is by yaw-rate senser.&#xA;They may be combined each another with Kalman filter to refine the yaw-rate.&lt;/p&gt;&#xA;" OwnerUserId="355" LastActivityDate="2011-09-30T05:58:26.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="342" PostTypeId="2" ParentId="6" CreationDate="2011-09-30T12:35:10.200" Score="11" Body="&lt;h3&gt;Stereo imaging&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Given the large field of view you need in relation to the accuracy you want, and how close you want to be, I think that stereo imaging may be a challenging, so you need to somehow &lt;em&gt;amplify&lt;/em&gt; the differences you are trying to measure.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Structured lighting&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you are essentially trying to measure the profile of an object, have you considered a single high resolution camera and structured lighting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3LRNB.gif&quot; alt=&quot;Structured lighting&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;Thanks to &lt;a href=&quot;http://www.looptechnology.com/machine-vision-lighting-techniques.asp#Structured&quot; rel=&quot;nofollow noreferrer&quot;&gt;looptechnology&lt;/a&gt; for this image, used without permission, but hopefully attribution will be enough.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, the shallower the grazing angle, the the greater accuracy you can measure, but the lower the supported depth of field would be, so for your application you would need to optimise for your needs or make your system adjustable (one laser angle for 0-500um, another for 500-1500um and so on). In this case though, you would probably have to calibrate each time you changed laser position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, a very cheap way to try this out would be to pick up a pair of &lt;em&gt;&lt;a href=&quot;http://www.amazon.co.uk/Bargain-House-Laser-Scissors/dp/B0013LUDQQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laser Scissors&lt;/a&gt;&lt;/em&gt; which include a basic line laser LED.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you can remove the vibration problem by sampling multiple times, rejecting outliers and then averaging. A better solution though would be to mount the whole test apparatus on a block of granite. This worked well for laser micro-machining tools I've worked with in the past, which require micron level position and depth of focus accuracy, even when located in factories.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Some back of the envelope calculations.&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Lets assume an incident angle of 10 degree from horizontal, and a camera with a 640x480 resolution and a field of view of 87 x 65mm. If we place the beam so that it is right at the bottom of the portrait frame with no sample, and then place the sample with the beam crossing it, this should give us a maximum height of around 15mm and thus an uncorrected resolution of around 24um for each pixel the line &lt;em&gt;walks&lt;/em&gt; up the screen. With this setup, a 0.1mm variation should be visible as a 4 pixel variation in position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, if we use an incident angle of 2 degrees from horizontal then this should give us a maximum height of around 3mm (Tan(2deg)*87mm) and thus an uncorrected resolution of around 4.7um per pixel, for a much more noticeable 20 pixel &lt;em&gt;jump&lt;/em&gt;. This would probably require a much more accurate line laser however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, if the camera is close enough then the you may need to do a second trig calculation, using the camera height, to determine the the true position of the line relative to the base line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that if you don't need absolute &lt;a href=&quot;http://en.wikipedia.org/wiki/Accuracy_and_precision&quot; rel=&quot;nofollow noreferrer&quot;&gt;accuracy&lt;/a&gt;, and local repeatability is enough (say you are profiling the flatness of a sample to ensure it is within given tolerances) then just being able to see the relative position of the laser line might be enough.&lt;/p&gt;&#xA;" OwnerUserId="329" LastEditorUserId="329" LastEditDate="2016-10-26T15:09:11.910" LastActivityDate="2016-10-26T15:09:11.910" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="343" PostTypeId="2" ParentId="338" CreationDate="2011-09-30T16:27:01.133" Score="17" Body="&lt;p&gt;You are correct. Many methods of echo cancellation exist, but none of them are exactly trivial. The most generic and popular method is echo cancellation via an adaptive filter. In one sentence, the adaptive filter's job is to alter the signal that it's playing back by minimizing the amount of information coming from the input.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Adaptive filters&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;An adaptive (digital) filter is a filter that changes its coefficients and eventually converges to some optimal configuration. The mechanism for this adaptation works by comparing the output of the filter to some desired output. Below is a diagram of a generic adaptive filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LsfP6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from the diagram, the signal $x[n]$ is filtered by (convolved with) $\vec{w}_n$ to produce output signal $\hat{d}[n]$. We then subtract $\hat{d}[n]$ from the &lt;em&gt;desired&lt;/em&gt; signal $d[n]$ to produce the &lt;em&gt;error&lt;/em&gt; signal $e[n]$. Note that $\vec{w}_n$ is a vector of coefficients, not a number (hence we don't write $w[n]$). Because it changes every iteration (every sample), we subscript the current collection of these coefficients with $n$. Once $e[n]$ is obtained we use it to update $\vec{w}_n$ by an update algorithm of choice (more on that later). If input and output satisfy a linear relationship that does not change over time and given a well-designed update algorithm, $\vec{w}_n$ will eventually converge to the optimal filter and $\hat{d}[n]$ will be closely following $d[n]$.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Echo cancellation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The problem of echo cancellation can be presented in terms of a adaptive filter problem where we're trying to produce some known ideal output given an input by finding the optimal filter satisfying the input-output relationship. In particular, when you grab your headset and say &quot;hello&quot;, it's received on the other end of the network, altered by acoustic response of a room (if it's being played back out loud), and fed back into the network to go back to you as an echo. However, because the system knows what the initial &quot;hello&quot; sounded like and now it knows what the reverberated and delayed &quot;hello&quot; sounds like, we can try and guess what that room response is using an adaptive filter. Then we can use that estimate, convolve all incoming signals with that impulse response (which would give us the estimate of the echo signal) and subtract it from what goes into the microphone of the person you called. The diagram below shows an adaptive echo canceller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eGz0d.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this diagram, your “hello” signal is $x[n]$. After being played out of a loudspeaker, bouncing off the walls and getting picked up by the device’s microphone it becomes an echoed signal $d[n]$. The adaptive filter $\vec{w}_n$ takes in $x[n]$ and produces output $y[n]$ which after convergence should be ideally tracking echoed signal $d[n]$. Therefore $e[n]=d[n]-y[n]$ should eventually go to zero, given that nobody is talking on the other end of the line, which is usually the case when you’ve just picked up the headset and said “hello”. This is not always true, and some non-ideal case consideration will be discussed later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, the &lt;a href=&quot;http://en.wikipedia.org/wiki/NLMS&quot; rel=&quot;noreferrer&quot;&gt;NLMS&lt;/a&gt; (normalized least mean square) adaptive filter is implemented as follows. We update $\vec{w}_n$ every step using the error signal of the previous step. Namely, let &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\vec{x}_n = \left ( x[n], x[n-1], \ldots , x[n-N+1] \right)^T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the number of taps (samples) in $\vec{w}_n$. Notice what samples of $x$ are in reverse order. And let &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\vec{w}_n = \left ( w[0], w[1], \ldots , x[N-1] \right )^T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we calculate $y[n]$ via (by convolution) finding the inner product (dot product if both signals are real) of $= \vec{x}_n$ and $= \vec{w}_n$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = \vec{x}_n^T \vec{w}_n = \vec{x}_n \cdot \vec{w}_n $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we can calculate the error, we’re using a normalized &lt;a href=&quot;http://en.wikipedia.org/wiki/Gradient_descent&quot; rel=&quot;noreferrer&quot;&gt;gradient descent method&lt;/a&gt; for minimizing it. We get the following update rule for $\vec{w}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\vec{w}_{n+1} = \vec{w}_n + \mu \vec{x}_n \frac{e[n]}{ \vec{x}_n^T \vec{x}_n}= \vec{w}_n + \mu \vec{x}_n \frac{\vec{x}_n^T \vec{w}_n - d[n]}{ \vec{x}_n^T \vec{x}_n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mu$ is the adaptation step size such that $0 \leq \mu \leq 2$.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Real life applications and challenges&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Several things can present difficulty with this method of echo cancellation. First of all, like mentioned before, it is not always true that the other person is silent whilst they receive your “hello” signal. It can be shown (but is beyond the scope of this reply) that in some cases it can still be useful to estimate the impulse response while there is a significant amount of input present on the other end of the line because input signal and echo are assumed to be statistically independent; therefore, minimizing the error will still be a valid procedure. In general, a more sophisticated system is needed to detect good time intervals for echo estimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, think of what happens when you’re trying to estimate echo when the received signal is approximately silence (noise, actually). In absence of a meaningful input signal, the adaptive algorithm will diverge and quickly start producing meaningless results, culminating eventually in a random echo patter. This means that we also need to take into consideration &lt;a href=&quot;http://en.wikipedia.org/wiki/Voice_activity_detection&quot; rel=&quot;noreferrer&quot;&gt;speech detection&lt;/a&gt;. Modern echo cancellers look more like the figure below, but above description is the jist of it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kw4fz.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are plenty of literature on both adaptive filters and echo cancellation out there, as well as some open source libraries you can tap into.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2014-03-06T20:11:40.993" LastActivityDate="2014-03-06T20:11:40.993" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="344" PostTypeId="1" AcceptedAnswerId="349" CreationDate="2011-09-30T19:01:51.277" Score="7" ViewCount="481" Body="&lt;p&gt;Is it possible for two different decoders to output two different sample results for the same MP3? I'm decoding an mp3 on Matlab and it produces two columns (presumably one for each channel). When I extract the sample data from the same file using AVAssetReader (iOS), I get different results. When I tried the same code with a WAV file, the two results matched, so I'm guessing the code is fine (although the Matlab result had a few extra blank frames). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I, non-scientifically, choose random values from my AVAssetReader MP3 result, and search for them in the Matlab results, they tend to exist, but not always. I don't know if this is just coincidence, different rounding off errors or if they genuinely match. The problem is, when they match, the surrounding numbers differ from one another. For example, &lt;code&gt;0.0021&lt;/code&gt; occurs in both results, but the surrounding numbers on Matlab are -0.0649,0.0147 etc.. (which don't appear near the 0.0021 in the AVAssetReader results). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could cause this discrepancy, does it cause a serious lack of integrity in my app and how would I fix it? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="334" LastActivityDate="2012-04-12T10:12:18.587" Title="MP3 Decoding Discrepancy" Tags="|audio|preprocessing|mp3|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="345" PostTypeId="2" ParentId="338" CreationDate="2011-09-30T22:32:21.077" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I am not sure how to determine what the delay is with out some sort of pre-calibration&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would start by modifying an acoustic fingerprinting algorithm such as &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf&quot; rel=&quot;nofollow&quot;&gt;the one used by Shazam&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your requirements are similar to Shazam's in many ways (the features must survive a compression algorithm designed for telephony, they also pass through low-quality microphones) so you could probably use the same features (local maxima of power in time/frequency space) though you might want to increase time resolution at the expense of frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There is also the issue of how much to scale the signal by before subtracting it.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Uniform scaling will almost certainly not be accurate enough.  You would need to do something like approximating the frequency response with a FIR filter then passing your (delayed) mic signal through the inverted filter before subtracting it from the received signal.&lt;/p&gt;&#xA;" OwnerUserId="272" LastActivityDate="2011-09-30T22:32:21.077" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="346" PostTypeId="1" CreationDate="2011-10-01T11:48:58.957" Score="6" ViewCount="11069" Body="&lt;p&gt;I can calculate RMS in frequency domain as derived from &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's Theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if I have applied a windowing function before doing the FFT (in my case a Hann window)?. Now the RMS values are not correct any more. How do I calculate the correct RMS values?&lt;/p&gt;&#xA;" OwnerUserId="217" LastEditorUserId="29" LastEditDate="2011-10-01T14:33:49.110" LastActivityDate="2015-02-15T17:44:44.273" Title="RMS calculation in frequency domain after windowing" Tags="|fourier-transform|discrete-signals|fft|window-functions|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="347" PostTypeId="2" ParentId="346" CreationDate="2011-10-01T14:26:36.253" Score="0" Body="&lt;p&gt;Half-baked answer: Hmm...  Is this possible?  If the waveform consists of a high frequency sine and low frequency sine alternating in time, then the time at which you happen to window it would alter the height of different parts of the frequency spectrum.  Would the overall RMS value of the spectrum still be the same no matter when you window it?  If so, I'd think it's just a matter of scaling by the energy of the window itself.  If not, I'd say it's impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 1000&#xA;t = linspace(0, 1, n, endpoint=False)&#xA;x = sin(2*pi*t)        * sin(2*pi*100*t)&#xA;y = sin(2*pi*t + pi/2) * sin(2*pi*100*t) # just a phase shift&#xA;print(sum(abs(x)**2))          # = 250&#xA;print(sum(abs(y)**2))          # = 250&#xA;print(sum(abs(fft(x))**2)/n)   # = 250&#xA;print(sum(abs(fft(y))**2)/n)   # = 250&#xA;&#xA;w = hamming(n)&#xA;print(sum(abs(fft(x*w))**2)/sum(w**2))  # = 216&#xA;print(sum(abs(fft(y*w))**2)/sum(w**2))  # = 283&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MZvMe.png&quot; alt=&quot;x*w&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mAmBM.png&quot; alt=&quot;y*w&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think it's impossible.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2015-02-15T17:44:44.273" LastActivityDate="2015-02-15T17:44:44.273" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="348" PostTypeId="2" ParentId="346" CreationDate="2011-10-01T15:00:29.473" Score="1" Body="&lt;p&gt;A window function (except the implicit rectangle function) in informationally lossy, especially of transient signals near the edge of the window, and for low frequency stationary sinusoids that are not periodic in the window.  For high frequency sinusoidal content that is of constant amplitude and periodic in the aperture, the approximation of scaling magnitudes by the area of the window function is closer to accurate, but will still vary slightly with the phase of the each sinusoid.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-01T15:00:29.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="349" PostTypeId="2" ParentId="344" CreationDate="2011-10-01T15:44:32.373" Score="10" Body="&lt;p&gt;It is possible that two decoders will have different results and be compliant with standard. The standard &quot;ISO/IEC 11172-4 (part 4) compliance testing&quot; specify two classes of decoders: &#xA;&quot;accurate&quot; and with &quot;limited accuracy&quot; *). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The accuracy is measured by comparing decoded stream with reference stream (reference input and output is specified in standard). If the RMS of difference is below $2^{-15}/\sqrt{12}$ the decoder is classified as accurate and  if below $2^{-11}/\sqrt{12}$ it is classified as &quot;limited accuracy&quot; one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you are going to use different decoders or even the same decoder on different processor architectures you have to be prepared for this kind of discrepancy in output. Do not know your application or intend but maybe you can mimic the standard and work with RMS of error too?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*) I do not have text of the standard in English in front of me so actual name used in standard may be different. &lt;/p&gt;&#xA;" OwnerUserId="354" LastEditorUserId="440" LastEditDate="2012-04-12T10:12:18.587" LastActivityDate="2012-04-12T10:12:18.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="351" PostTypeId="2" ParentId="346" CreationDate="2011-10-02T15:49:24.133" Score="3" Body="&lt;p&gt;For a reasonably stationary time domain signal you can assume&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rms(signal*windows) = rms(signal)*rms(window)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and can estimate the RMS of the un-windowed time signal this way. For a hanning window that means calculate the RMS using Perceval and then multiply with sqrt(8/3). It's not exact but will be fairly close if the signal is stationary with respect to the window length.&#xA;If it isn't stationary the interpretation of RMS isn't particularly well defined and it would helpful to learn more about your application and what exactly you are trying to do.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-02T15:49:24.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="352" PostTypeId="2" ParentId="328" CreationDate="2011-10-03T03:07:37.803" Score="6" Body="&lt;p&gt;Natural images consist of different image features, we can broadly categorize them into smooth or slow-to-vary features, textures and edges. A good compression method is one that tranforms an image into a domain where all the energy of a signal is conserved in just a few coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fourier transform tries to approximate an image using sines and cosines. Now sines and cosines can approximate smooth signals fairly concisely, but are notoriously bad for approximating discontinuities. If you are familiar with the Gibbs phenomenon, you'll know that one needs a large number fourier coefficients in order to avoid the artifacts of approximating a discontinuity in time. However, the smaller the number of coefficients, the better the compression. Therefore, there is an inherent tradeoff between number of coefficients and the lossiness of the compression method, which we usually refer to as the rate-distortion tradeoff. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When searching for a better compression scheme than jpeg, which uses fourier transforms, we would require a transformation that can approximate discontinuities with fewer coefficients than the fourier transform, for the same distortion. Enter wavelets which offers better approximation and therefore better compression of point singularities without the gibbs phenomenon like artifacts. Images are never purely smooth in practice and therefore wavelets are more versatile than fourier for diverse image features. If we were to compare the best k-term approximation of an image containing edges using both fourier and wavelets, the errors would decay as $k^{-2/3}$ and $k^{-1}$, respectively. For the same number of terms, the error decays faster for wavelets. This means that wavelets have better energy compaction when images are not perfectly smooth (slowly varying) and contain singularities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we as yet do not have a single basis or transform that can approximate smooth features, point singularities, edges and textures.&lt;/p&gt;&#xA;" OwnerUserId="254" LastEditorUserId="2010" LastEditDate="2012-09-27T19:57:25.633" LastActivityDate="2012-09-27T19:57:25.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="353" PostTypeId="2" ParentId="285" CreationDate="2011-10-03T03:21:40.660" Score="5" Body="&lt;p&gt;What you are looking for is information on empirical Weiner filtering [1,2]. The BM3D folks use the Weiner filter to optimize the parameters of the first step of denoising, specifically to choose the threshold at which to eliminate small coefficients of the their 3D transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]  &lt;a href=&quot;http://dune.ece.wisc.edu/pdfs/ghael_spie97.pdf&quot; rel=&quot;nofollow&quot;&gt;Improved Wavelet Denoising via Empirical Wiener Filtering&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] &lt;a href=&quot;http://dune.ece.wisc.edu/pdfs/gallaire_tfts_wieny98.pdf&quot; rel=&quot;nofollow&quot;&gt;http://dune.ece.wisc.edu/pdfs/gallaire_tfts_wieny98.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="254" LastEditorUserId="254" LastEditDate="2013-01-17T21:30:20.087" LastActivityDate="2013-01-17T21:30:20.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="354" PostTypeId="2" ParentId="320" CreationDate="2011-10-03T06:08:14.307" Score="0" Body="&lt;p&gt;Your low pass filter may be like;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;p_k = \alpha p_{k-1} + (1-\alpha) z_k&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $z_k$ is $k$th observed data. $p_k$ is $k$th estimated value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The LPF can be deformed to next:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p_k = p_{k-1} + K (z_k - p_{k-1})$$&#xA;   where $K = (1-\alpha)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is quite similar to Kalman filter. In Kalman filter, $K$ is Kalman gain and generally variable. &lt;/p&gt;&#xA;" OwnerUserId="355" LastEditorUserId="13585" LastEditDate="2015-02-04T17:45:16.307" LastActivityDate="2015-02-04T17:45:16.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="355" PostTypeId="2" ParentId="62" CreationDate="2011-10-03T20:03:01.513" Score="9" Body="&lt;p&gt;Kellenjb has not responded to queries from Rajesh D and endolith, and it is not easy to figure out what exactly he needs.  But since I disagree with some of the details of the Answers given by yoda and Mohammad, I am posting a separate answer, where, with due apologies to Mark Borgerding, all the useful stuff appears at the very end after all the boring equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a typical communication system, the incoming signal is a bandpass&#xA;signal of bandwidth $2B$ at center frequency $f_c \gg B$ Hz and can be expressed as&#xA;$$&#xD;&#xA;r(t) = I(t) \cos(2\pi f_c t) - Q(t) \sin(2\pi f_c t)&#xD;&#xA;$$&#xA;where $I(t)$ and $Q(t)$ are &lt;em&gt;low-pass&lt;/em&gt; signals of bandwidth $B$ Hz&#xA;and are referred to as the in-phase and quadrature components. Note &#xA;the difference in signs and terminology from yoda'a writing: this&#xA;way we can write &#xA;$$r(t) = \text{Re}\left\{ [I(t) + jQ(t)] e^{j2\pi f_c t}\right\}$$&#xA;where $I(t) + jQ(t)$ is the &lt;em&gt;complex baseband signal&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A local oscillator in the receiver generates signals $2\cos(2\pi f_c t + \theta)$&#xA;and $-2\sin(2\pi f_c t + \theta)$ but we assume perfect synchronization&#xA;for simplicity so that the phase error $\theta = 0$.&#xA;$I(t)$ and $Q(t)$ are recovered through two mixers (multipliers)&#xA;and low-pass filters:&#xA;$$&#xD;&#xA;\begin{align*}&#xD;&#xA;r(t)[2\cos(2\pi f_c t)] &#xD;&#xA;&amp;amp;= I(t)[2\cos^2(2\pi f_c t)] - Q(t)[2\sin(2\pi f_c t)\cos(2\pi f_c t)]\\&#xD;&#xA;&amp;amp;= I(t) + \left [ I(t) \cos(2\pi (2f_c)t) - Q(t) \sin(2\pi (2f_c) t) \right ]\\&#xD;&#xA;r(t)[-2\sin(2\pi f_c t)] &#xD;&#xA;&amp;amp;= I(t)[-2\sin(2\pi f_c t)\cos(2\pi f_c t)] + Q(t)[2\sin^2(2\pi f_c t)]\\&#xD;&#xA;&amp;amp;= Q(t) + \left [ - I(t) \sin(2\pi (2f_c)t) - Q(t) \cos(2\pi (2f_c) t) \right ]&#xD;&#xA;\end{align*}&#xD;&#xA;$$&#xA;where the double frequency terms (in square brackets) are eliminated by &#xA;the low-pass filters&#xA;which we assume to have sufficient bandwidth to pass $I(t)$ and $Q(t)$ &#xA;without distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Broadband noise is present in the front end of the receiver and the&#xA;key questions that need to be answered are what happens in an actual&#xA;receiver, and what must be done to simulate the reality.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In an actual system, the net result is that the outputs of the low-pass&#xA;filters are&#xA;$$&#xD;&#xA;\begin{align*}&#xD;&#xA;x(t) &amp;amp;= I(t) + N_I(t)\\&#xD;&#xA;y(t) &amp;amp;= Q(t) + N_Q(t)&#xD;&#xA;\end{align*}&#xD;&#xA;$$&#xA;where $N_I(t)$ and $N_Q(t)$ are independent zero-mean Gaussian random processes&#xA;with common variance&#xA;$$&#xD;&#xA;\sigma^2 = \frac{N_0}{2}\int_{-\infty}^\infty \vert H(f) \vert^2 \mathrm df&#xD;&#xA;$$&#xA;where $H(f)$ is the common transfer function of the low pass filters.&#xA;In particular, for each $t_0$, $N_I(t_0)$ and $N_Q(t_0)$ are independent&#xA;zero-mean Gaussian random variables with variance $\sigma^2$.  However,&#xA;$N_I(t_0)$ and $N_I(t_1)$  &lt;em&gt;need not&lt;/em&gt; be independent.  The SNR can be&#xA;taken to be the&#xA;ratio of the signal power in $I(t)$ and $Q(t)$  to the noise variance.&lt;/li&gt;&#xA;&lt;li&gt;In a quadrature down-sampling system or in a MATLAB simulation wishing to&#xA;capture every nuance, &quot;$r(t) + ~$ noise&quot; is sampled $M$ times each &#xA;cycle of the RF carrier at $f_c$ Hz, and so the $m$-th sample is&#xA;$$&#xD;&#xA;\begin{align*}&#xD;&#xA;r[m] &amp;amp;= r(m/Mf_c) + N[m]\\&#xD;&#xA;&amp;amp;= I(m/Mf_c)\cos(2\pi (m/M)) - Q(m/Mf_c)\sin(2\pi(m/M)) + N[m]&#xD;&#xA;\end{align*}&#xD;&#xA;$$&#xA;where the $N[m]$'s zero-mean Gaussian random variables with common variance&#xA;whose value depends on the SNR.  These can be tracked through the&#xA;mixers and the low-pass filters during the detailed simulation.&lt;/li&gt;&#xA;&lt;li&gt;I do not recommend adding noise between the mixer outputs and the&#xA;low-pass filter units.  While there &lt;em&gt;is&lt;/em&gt; noise introduced at that&#xA;stage, this is typically overwhelmed by the noise from the front&#xA;end that is coming through the mixers. &lt;/li&gt;&#xA;&lt;li&gt;In some systems, A/D conversion is done at the output of the low&#xA;pass filters.  If more filtering is to be done (e.g. matched&#xA;filtering), the sampling will typically be at a higher rate&#xA;than $B^{-1}$ or the inverse of the filter bandwidth.  If noise&#xA;is introduced at this stage, then for each $m$, $N_I[m]$ and&#xA;$N_Q[m]$ should be taken to be independent zero-mean Gaussian&#xA;random variables, but whether  $N_I[m]$ and $N_I[m+i]$ are&#xA;independent or not requires a lot of thought and analysis,&#xA;and details that are known to Kellenjb but not to us.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2011-10-03T20:55:10.123" LastActivityDate="2011-10-03T20:55:10.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="356" PostTypeId="1" AcceptedAnswerId="402" CreationDate="2011-10-04T03:38:47.320" Score="15" ViewCount="898" Body="&lt;p&gt;It's well known that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform&quot;&gt;bilinear transform&lt;/a&gt; is also known as Tustin's Method.  As far as I know, &lt;a href=&quot;http://en.wikipedia.org/wiki/Arnold_Tustin&quot;&gt;Arnold Tustin&lt;/a&gt; really did introduce the idea into the control systems literature, so the name isn't just a case of &lt;a href=&quot;http://en.wikipedia.org/wiki/Stigler%27s_law_of_eponymy&quot;&gt;Stigler's Law&lt;/a&gt;.  For example, I managed to find the following reference:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Tustin in the UK developed the bilinear transformation for time series&#xA;  models, while Oldenbourg and Sartorius also used difference equations&#xA;  to model such systems. $[1]$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What isn't clear is where he first introduced the idea--even when browsing the &lt;a href=&quot;http://www.google.com/search?q=inauthor%3a%22Arnold%20Tustin%22&amp;amp;btnG=Search%20Books&amp;amp;tbm=bks&amp;amp;tbo=1&quot;&gt;titles of his publications&lt;/a&gt;.  I'm guessing that it only became known as the bilinear transform later on, so &lt;a href=&quot;http://www.google.com/search?q=inauthor%3a%22Arnold%20Tustin%22&amp;amp;btnG=Search%20Books&amp;amp;tbm=bks&amp;amp;tbo=1&amp;amp;q=bilinear&quot;&gt;he probably didn't use that terminology&lt;/a&gt;.  I'd like to read his exposition of the technique. Does anyone know where he first published it?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Bissel, C.C. &lt;em&gt;A History of Automatic Control&lt;/em&gt;. &lt;a href=&quot;http://siamun.weebly.com/uploads/4/1/7/3/4173241/history_of_automatic_control.pdf&quot;&gt;link&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="35" LastEditorUserId="21075" LastEditDate="2020-04-30T14:10:20.580" LastActivityDate="2020-04-30T14:10:20.580" Title="Where did Arnold Tustin first introduce the bilinear transform?" Tags="|discrete-signals|reference-request|bilinear-transform|signals-history|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="357" PostTypeId="1" CreationDate="2011-10-04T16:15:30.203" Score="10" ViewCount="185" Body="&lt;p&gt;Is there a data decomposition method similar to eigenvalue that estimates projection matrix to reduce dimensionality but does not project similar vectors too far away in euclidian distance terms from each other if original data from the same class varies a little in scale, shift and rotation (2D case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = E  x;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. a ECG classification problem example. Cardio cycles have different duration. In addition scale and shift depends on the accuracy on the beat detection. Thus cardio cycles belonging to the same class might be projected to far away due to that variation.&lt;/p&gt;&#xA;" OwnerUserId="390" LastEditorUserId="6" LastEditDate="2011-10-04T18:19:47.573" LastActivityDate="2011-12-23T03:30:25.453" Title="Data decomposition method invariant to small shift and scale?" Tags="|image-processing|algorithms|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="360" PostTypeId="1" CreationDate="2011-10-04T19:21:04.543" Score="12" ViewCount="12220" Body="&lt;p&gt;I'm looking at decoding an OFDM signal which consists of 6 carriers (or tones) which are BPSK modulated and a pilot tone which aids tuning. This is the first time I have worked with OFDM so I need to know if I'm approaching this in the right way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I'm thinking of decoding it is to use the pilot tone to calibrate (as the receiver may be slightly mistuned) then to have six band pass filters to separate out each carrier which is then demodulated in the usual way. Can anyone see any problems with this ? or can you suggest a better way of doing this.&lt;/p&gt;&#xA;" OwnerUserId="1411" LastEditorUserId="90" LastEditDate="2011-10-05T04:19:42.900" LastActivityDate="2012-10-12T09:24:02.120" Title="How to demodulate an OFDM signal" Tags="|ofdm|demodulation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="361" PostTypeId="2" ParentId="65" CreationDate="2011-10-04T19:29:24.573" Score="4" Body="&lt;p&gt;MLS (maximum length sequences) are particularly tricky to analyze for clipping. Their crest factor (=peak/rms) is very close to 1, which is even three dB smaller than that of a sine wave. Many D/A converters are designed to take a sine wave as the worst case and an MLS played at full amplitude can easily clip the output interpolation circuit of a D/A. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next problem is that a clipped MLS looks almost identical to a non clipped one since the amplitudes are almost all +-peak in the first place. Also the PDF analysis doesn't work since the PDF of an MLS is simply two large peaks at the edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a typical room impulse response measurement, the most likely clipping point is actually the D/A, the amp, or the speaker. Once it got through the room it looks a lot less like an MLS and therefor it's easier to assess clipping with the methods described above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In nearly all acoustic measurements the noise floor is determined by the self noise of the microphone or background noises and not the A/D. Therefore it is not very important to optimize the input gain into the A/D and leaving ample head room before clipping (10dB or so) is perfectly fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's typically a good idea to measure with a a number of different excitation levels and look at the SNR of the measurement. At low levels the acoustic background noise dominates and at high levels something will limit, compress or clip. The trick to making a good measurement is to find a good spot in between.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-04T19:29:24.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="362" PostTypeId="2" ParentId="31" CreationDate="2011-10-05T01:21:11.157" Score="21" Body="&lt;p&gt;You can think of the DCT as a compression step. Typically with MFCCs, you will take the DCT and then keep only the first few coefficients. This is basically the same reason that the DCT is used in JPEG compression. DCTs are chosen because their boundary conditions work better on these types of signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's contrast the DCT with the Fourier transform. The Fourier transform is made up of sinusoids that have an integer number of cycles. This means, all of the Fourier basis functions start and end at the same value -- they do not do a good job of representing signals that start and end at different values. Remember that the Fourier transform assumes a periodic extension: If you imagine your signal on a sheet of paper, the Fourier transform wants to roll that sheet into a cylinder so that the left and right sides meet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of a spectrum that is shaped roughly like a line with negative slope (which is pretty typical). The Fourier transform will have to use a lot of different coefficients to fit this shape. On the other hand, the DCT has cosines with half-integer numbers of cycles. There is, for example, a DCT basis function that looks vaguely like that line with negative slope. It does not assume a period extension (instead, an even extension), so it will do a better job of fitting that shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's put this together. Once you've computed the Mel-frequency spectrum, you have a representation of the spectrum that is sensitive in a way similar to how human hearing works. Some aspects of this shape are more relevant than others. Usually, the larger more overarching spectral shape is more important than the noisy fine details in the spectrum. You can imagine drawing a smooth line to follow the spectral shape, and that the smooth line you draw might tell you just about as much about the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you take the DCT and discard the higher coefficients, you are taking this spectral shape, and only keeping the parts that are more important for representing this smooth shape. If you used the Fourier transform, it wouldn't do such a good job of keeping the important information in the low coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think about feeding the MFCCs as features to a machine learning algorithm, these lower-order coefficients will make good features, since they represent some simple aspects of the spectral shape, while the higher-order coefficients that you discard are more noise-like and are not important to train on. Additionally, training on the Mel spectrum magnitudes themselves would probably not be as good because the particular amplitude at different frequencies are less important than the general shape of the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2011-10-05T01:21:11.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="363" PostTypeId="1" CreationDate="2011-10-05T02:07:12.527" Score="9" ViewCount="5987" Body="&lt;p&gt;We know that the under-sampling results in aliasing and frequencies higher than half of the Nyquist rate is not distinguishable. I've a base band signal that I want to use the higher frequencies which are higher than the half of the Nyquist rate (Nyquist frequency) as well as low frequencies(all parts). I've a special process with this path:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\textrm{Input}{\longrightarrow}\boxed{\textrm{anti-aliasing pre-filter}}{\longrightarrow}\boxed{\textrm{decimate}}{\longrightarrow}\boxed{\textrm{FFT}}{\longrightarrow}\boxed{\textrm{tune on special part}\\{\textrm{of the signal}}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The low-pass post-filter that people usually use as anti-aliasing filter removes the high frequencies that are of interest for me. &#xA;What is the digital or analog anti-aliasing pre-filter that I don't lose high frequencies.&lt;/p&gt;&#xA;" OwnerUserId="290" LastEditorUserId="1629" LastEditDate="2016-09-10T08:02:34.090" LastActivityDate="2016-09-10T08:02:34.090" Title="What is anti-alias pre-filter for preventing aliasing after under-sampling?" Tags="|sampling|downsampling|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="364" PostTypeId="2" ParentId="363" CreationDate="2011-10-05T02:37:32.737" Score="5" Body="&lt;p&gt;Provided you can meet the conditions &lt;a href=&quot;https://dsp.stackexchange.com/questions/147/when-is-aliasing-a-good-thing/148#148&quot;&gt;shown in this answer&lt;/a&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2 f_H}{n} \le f_s \le \frac{2 f_L}{n - 1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;your anti-aliasing pre-filter should be a bandpass filter, with $f_L$ the lower band limit and $f_H$ the higher bandlimit, filtering the signal frequencies of interest to you.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2011-10-05T12:56:14.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="365" PostTypeId="1" AcceptedAnswerId="369" CreationDate="2011-10-05T04:09:56.350" Score="8" ViewCount="2953" Body="&lt;p&gt;I am attempting to convert YV12 to RGB using the following fragment shader:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;precision mediump float;&#xA;uniform sampler2D tex0, tex1, tex2;&#xA;varying vec2 v_texCoord;&#xA;&#xA;void main(void) {&#xA;    float r, g, b, y, u, v;&#xA;    y = texture2D(tex0, v_texCoord).x;&#xA;    u = texture2D(tex1, v_texCoord).x;&#xA;    v = texture2D(tex2, v_texCoord).x;&#xA;&#xA;    y = 1.1643 * (y - 0.0625);&#xA;    u = u - 0.5;&#xA;    v = v - 0.5;&#xA;&#xA;    r = y + 1.5958 * v;&#xA;    g = y - 0.39173 * u - 0.81290 * v;&#xA;    b = y + 2.017 * u;&#xA;&#xA;    gl_FragColor = vec4(r, g, b, 1.0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Below is the original image followed by the converted image.  Based on the output, can you determine where I might look to determine what is causing the improper decoding?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6QdiN.jpg&quot; alt=&quot;Source&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vqkOp.png&quot; alt=&quot;Decoded image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="393" LastEditorUserId="4682" LastEditDate="2013-07-06T02:00:42.640" LastActivityDate="2013-07-06T02:00:42.640" Title="YV12 to RGB - What is wrong with my algorithm?" Tags="|image-processing|color|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="366" PostTypeId="2" ParentId="363" CreationDate="2011-10-05T04:15:34.357" Score="8" Body="&lt;p&gt;I think you're looking for a free lunch that does not exist. Your original question and response to Peter K's answer suggests that you want to sample a signal that has both lowpass and highpass content, with the highpass content extending beyond the Nyquist frequency associated with your target sample rate. That is probably not going to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a sample rate $f_s$ (and real samples), you can only unambiguously represent frequencies on the interval $[0, \frac{f_s}{2})$. More generally, you can only represent a swath of bandwidth that is up to $\frac{f_s}{2}$ wide. Frequencies above the Nyquist rate alias down such that they appear to be located in this interval after you sample them. If you have a signal of interest that meets this bandwidth constraint, then you can use &lt;a href=&quot;http://en.wikipedia.org/wiki/Sampling_%28signal_processing%29#Undersampling&quot;&gt;bandpass sampling&lt;/a&gt; techniques; basically you select a sample rate taking into account the center frequency and bandwidth of the desired signal. You allow the signal to alias in a &quot;controlled&quot; manner, so that it appears to be present in a contiguous portion of $[0, \frac{f_s}{2})$ after you sample it (perhaps with the spectrum inverted, but that is easily fixed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not seem to line up well with what you seem to want. Your question indicated that you have lowpass content (i.e. content near zero frequency) that you want to preserve in addition to highpass content above $\frac{f_s}{2}$. In many cases, this is not going to be achievable without the highpass content aliasing down on top of the lowpass signal of interest after you sample. However, under certain conditions, you might be able to make this work. If:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The lowpass and highpass components are separated in frequency (i.e. there is a gap between the two regions where you don't care about preserving the signal's content),&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You know the center frequency and bandwidth of the highpass portion (so it is more accurately termed &quot;bandpass&quot; instead),&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And you have control over the sample rate,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then you may be able to make it work. In that relatively special case, you would simply apply the bandpass sampling approach described before, except the sample rate must be selected with caution so that the higher-frequency content does not alias down into the portion of the band that the lowpass signal occupies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether you would actually want to do this in a practical system is still an open problem. It's not clear specifically what you're trying to accomplish, or what the constraints in your application are. An alternate approach would be to separate the two signal components using analog filters (lowpass for one channel, highpass/bandpass for the other), then sample them independently. This could allow you to use a lower sample rate, commensurate with the bandwidths of each component.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-10-05T04:15:34.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="367" PostTypeId="2" ParentId="365" CreationDate="2011-10-05T06:32:22.750" Score="1" Body="&lt;p&gt;I don't know anything about fragment shader programming, but to me it looks like the word size of the input and output vary. And to me it looks like, you don't pay attention to unpacking and repacking the &lt;a href=&quot;http://en.wikipedia.org/wiki/YV12#Y.27UV420p_.28and_Y.27V12_or_YV12.29&quot; rel=&quot;nofollow&quot;&gt;YV12&lt;/a&gt; bytes.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2011-10-05T06:32:22.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="368" PostTypeId="2" ParentId="360" CreationDate="2011-10-05T06:41:12.297" Score="10" Body="&lt;p&gt;One of the nice features of &lt;a href=&quot;http://en.wikipedia.org/wiki/OFDM&quot;&gt;OFDM&lt;/a&gt; is that it allows a very simple structure for the modulator and demodulator: given a set of symbols (in general complex-valued, taken from a signal constellation such as BPSK, QPSK, or QAM) to map onto each carrier, the modulator can be implemented using an inverse &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_fourier_transform&quot;&gt;discrete Fourier transform&lt;/a&gt;, typically implemented using an &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_fourier_transform&quot;&gt;FFT&lt;/a&gt;. Each set of symbols (one per carrier) is transformed to yield an &lt;em&gt;OFDM symbol&lt;/em&gt;, which is then sent to the channel. The DFT length will typically be chosen to be larger than the number of desired carriers to allow some &quot;guard band&quot; near the system Nyquist rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to the above DFT-based structure, most OFDM systems also incorporate a &lt;a href=&quot;http://en.wikipedia.org/wiki/Cyclic_prefix&quot;&gt;cyclic prefix&lt;/a&gt;, which allows for simple implementation of an equalizer in the frequency domain. Equalization can provide improved link performance in multipath environments (e.g. many wireless communication scenarios). It can also be used to aid in synchronization, as described below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simple structure carries over to the receiver; an OFDM waveform can be demodulated using the inverse transform to that used at the transmitter, yielding the original symbol values. The inverse to the inverse DFT used at the transmitter is a &quot;regular&quot; (forward) DFT. Thus, you will often see OFDM receivers diagrammed with an &quot;FFT&quot; block at the front end. The output of the transform contains the symbol values mapped onto each of the carriers, including all of the unused ones that make up the guard band. The demodulator plucks out the (complex-valued) amplitudes of each of the carriers of interest and passes those on to any further decoding logic (equalization as described above, channel decoding, mapping to bits, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As usual, however, the answer isn't quite so simple; the above explanation overlooks some important issues that must be addressed for a practical system:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Timing synchronization:&lt;/strong&gt; When you actually think about how you would build an OFDM receiver, one of the first problems you will run into is how to align the receiver's FFT frame with the stream of incoming samples. Synchronization with the OFDM signal's symbol timing is required to properly align the receiver's FFT operation with the appropriate time period in the observed sample stream.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be implemented using a correlation-based approach. As stated previously, most OFDM waveforms include a cyclic prefix, which is a scheme of forceably adding some circular periodicity to the transmitted waveform. This can be exploited at the receiver to obtain symbol timing; the timing detector simply calculates the sliding autocorrelation of the observed symbol stream using a lag commensurate with the known period between the transmitted signal and its cyclic copy. The magnitude of the result will reach a peak at the instant that corresponds to the start of each OFDM symbol.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Frequency synchronization:&lt;/strong&gt; Fine frequency synchronization is also key to robust OFDM reception, as frequency error causes intercarrier interference. Correction of frequency error can also be estimated using the timing synchronizer's correlator output. As stated previously, the autocorrelation of the observed stream at a lag equal to the cyclic prefix delay has a large magnitude at the start of each OFDM symbol. The phase of the correlator output provides a measure of the amount of phase drift over the course of each symbol time. This measure of &quot;phase drift per unit time&quot; can be recast as a measure of &quot;frequency drift&quot; instead. If the receiver can safely assume that the frequency error is constant over the course of a symbol time (which is reasonable for many cases), then the bulk frequency offset can be removed before calculating the DFT.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There can be even more problems to tackle for each of your carriers, depending upon the modulation used on each. For the simple case of BPSK, you may also need to worry about phase synchronization if you desire a coherent receiver. However, synchronization of timing and frequency are the key implementation details that often seemed to be glossed over in discussion of OFDM receiver structures.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-10-05T06:41:12.297" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="369" PostTypeId="2" ParentId="365" CreationDate="2011-10-05T08:20:55.423" Score="5" Body="&lt;p&gt;The output image has lines shifted one against another, which is typically due to incorrect [byte] distance between the lines (stride). That is, the color conversion math is perhaps correct, however you are either taking source pixel from wrong position and/or putting output pixel into wrong place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For performance reasons YV12 images might be using extended strides in hardware to facilitate performance. For example, 320x240 YV12 image might have a stride of 512 and this means that the data buffer is a 512x240 data space (512x240 bytes for Y, followed by two 256x120 arrays for V and U) where the payload image on the left, and there is invisible padding on the right.&lt;/p&gt;&#xA;" OwnerUserId="394" LastEditorUserId="394" LastEditDate="2011-10-05T08:37:17.750" LastActivityDate="2011-10-05T08:37:17.750" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="370" PostTypeId="1" CreationDate="2011-10-05T10:38:11.527" Score="24" ViewCount="1623" Body="&lt;p&gt;My question is: What mathematical model of polyphonic sound can make possible the changing (i.e. pitch shifting) of individual musical notes in a multi-voice-in-single-channel audio recording of a polyphonic acoustic musical instrument? By 'changing notes in polyphonic audio', I mean doing something like editing sound with the so-called '&lt;a href=&quot;http://www.celemony.com/cms/index.php?id=dna_qa&quot;&gt;Direct Note Access&lt;/a&gt;' feature in celeony's Melodyne software. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Pitch-shifting#Untangling_phase_and_time&quot;&gt;According to wikipedia&lt;/a&gt;, what Melodyne uses to model audio signal of a single line melody played on an acoustic (and thus timbrally complex) musical instrument is something like what Henning Thielemann describes in his paper entitled '&lt;a href=&quot;http://scholar.google.com/scholar?cluster=11466864455507182858&quot;&gt;Untangling phase and time in monophonic sounds&lt;/a&gt;' However, I cannot find any reference to models of audio signals of polyphonic musical instruments; according to &lt;a href=&quot;http://www.youtube.com/watch?v=u573PyXo-pY&quot;&gt;an interview on Youtube&lt;/a&gt; of Peter Neubacker (transcribed below), Melodyne's feature for dealing with editing polyphonic audio requires an approach unlike the one described by Thielemann.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One clue from &lt;a href=&quot;http://www.youtube.com/watch?v=Pr2xnexcjsU&quot;&gt;another youtube clip&lt;/a&gt; is that Neubacker's model works better with audio record of one KIND of instrument only (i.e. only piano, only guitar, only strings, only winds, etc). Another clues is &lt;a href=&quot;http://www.youtube.com/watch?v=jFCjv4_jqAY&quot;&gt;yet another clip&lt;/a&gt; showing the ability to not only shift pitch of a note but also the (starting and ending) timing of it. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Below is transcript of youtube video which mentioned that 'polyphonic materials calls for a different approach' (in case you have not time to watch it from from 22:00). &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The question, from which Melodyne arose: how can I obtain a sound&#xA;from a 3 dimensional form like this [gesturing with stone in hand]?&#xA;By which means, the sound can then be freed from its dependence upon&#xA;continuous time? This sculpture is actually what emerged from this...&#xA;It's a piece of plastic.... This was derived directly from musical&#xA;data. This object is [plucking a note on lute] this note. It is best&#xA;visualized as this, from left to right. Time runs in this direction&#xA;[gesturing left to right]. And that is the amplitude [gesturing big&#xA;and small with finger opposing thumb]. If I turn it, it ...&#xA;represents the timbre of this sound at any given instance. You can&#xA;see very clearly here a structure [pointing to cross section at&#xA;bottom of sculpture] that is somewhat triangular; that is because in&#xA;this sound, the third overtune (the fifth) is particularly loud, and&#xA;that introduces an element of threeness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Melodyne didn't exist yet and I was simply experimenting with&#xA;the translation of the sound into this shape, I worked for almost a&#xA;year with this one sound. ... I know this sound inside and out and by&#xA;heart. This also provides a good illustration of local sound. I can,&#xA;not only play back the sound [clicking mouse], but I can also enter&#xA;the sound of any point, and moved through it as slowly or quickly as&#xA;I like.  I can even linger in the sound, or move forwards and&#xA;backwards, so if I examine one place here ...  go around it. ... Ten&#xA;years ago it was new. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently dna (direct note access) was added. With it, I can also edit&#xA;polyphonic music. In other words, I can edit individually notes that&#xA;sounds simultaneously, such as for example a guitar recording. If I&#xA;now play a small chord [selecting Poly -&gt; Separate Notes on screen],&#xA;we see here the 3 notes I've just played as separate entities. Let's&#xA;just listen again [computer plays minor chord]. And now, as if by&#xA;moving my finger to a higher fret, I can raise this one note&#xA;[dragging a note on screen up; computer plays major chord]. For the&#xA;divided-up audio, I can isolated this one note, and can move it up or&#xA;down at will now, to any pitch I please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why it was no one able previously to isolate individual tones within&#xA;complex material in this way? I honestly don't know. In science, the&#xA;natural tendency is to begin with something simple, a sine wave for&#xA;example, or individual notes, and analyze that first, only to&#xA;discover when the material becomes more complex, or has to be treated&#xA;in its entirety, that the system doesn't work. My approach is&#xA;different. I actually begin with complex signals, and it's only when&#xA;I want to examine something in detail that I go back to simpler ones,&#xA;but first, i have to have an overall impression of what is actually&#xA;happening in reality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the secret perhaps lies in this roll? Heheh, this is actually a&#xA;loo roll. The question originally raised by the stone was how can I&#xA;translate a given sound into a three-dimensional form. Here, I have&#xA;arranged the individuals sampling values of the sound, indicated here&#xA;by one two three and so, in a spiral. And it turns out, that if you&#xA;interpolate between the points [gesturing across the spiral], a&#xA;landscape emerges that also represents the individual cross-sections&#xA;in the sound [gesturing cross sections of sculpture].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How old is the roll? 12 years. So that idea is the well-spring of&#xA;Melodyne, of all that we've seen today ... ? Yes, but&#xA;this manner of coiling up the the sound would no longer be of use for&#xA;polyphonic materials, which calls for a different approach.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="395" LastEditorUserId="267" LastEditDate="2011-12-13T19:09:54.670" LastActivityDate="2013-07-24T19:56:56.940" Title="What mathematical model of audio can make possible pitch shifting of individual notes in (timbrally complex) polyphony?" Tags="|frequency|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="371" PostTypeId="2" ParentId="370" CreationDate="2011-10-05T16:47:11.543" Score="3" Body="&lt;p&gt;One possibility might be analysis/re-synthesis using a statistical pattern matching approach.  If you know or can reasonably guess the mix of instruments involved and have templates (including initial transients, spectrum plus spectral evolution, etc.) for the instrument sounds for all expected notes, you could try a statistical matching of a large number of sane chord combinations using the template sound patterns to estimate the most likely polyphonic combination(s).  This would very likely be a very computationally intensive search for global minima's, where various &quot;AI&quot;-like search techniques might be useful.  You could then take the various individual chord probabilities and then use decision theories to pick the most likely polyphonic sequences in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then take the estimated notes and re-synthesize them at your chosen key pitch and duration.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-05T16:47:11.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="372" PostTypeId="2" ParentId="363" CreationDate="2011-10-05T16:55:34.060" Score="1" Body="&lt;p&gt;Put a notch in the low-pass filter where the image of the high frequency of interest will show up after sampling, and parallel this notched low-pass filter with a narrow-band filter of the high frequency spectrum of interest that is narrower than the notch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't put a wide-enough notch in the low-pass anti-alias filter so that the 2 spectra don't overlap, you won't be able to unscramble the egg.  (...unless something else is going on, like a cleanly separated time-multiplexing of spectral content, etc.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-10-05T17:00:53.427" LastActivityDate="2011-10-05T17:00:53.427" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="373" PostTypeId="2" ParentId="360" CreationDate="2011-10-05T17:12:49.967" Score="3" Body="&lt;p&gt;Normally OFDM is demodulated using FFTs.  But if you have a very few number of carriers, you might be able to use a small number of orthogonal quadrature demodulators (1-bin DFTs, or complex-output Goertzel filters), depending the number of carriers vs. log(n) the length of each DFT frame (each frame of a length where the frequency of all carriers are orthogonal to one another and the pilot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will also need to find a way to synchronize the decoding frames so that they do not cross the encoding frames transition times (nor near the very beginning of each transition where multi-path problems are more likely).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-05T17:12:49.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="374" PostTypeId="1" AcceptedAnswerId="375" CreationDate="2011-10-05T18:03:44.260" Score="186" ViewCount="66247" Body="&lt;p&gt;Over on the TeX stackexchange, we have been discussing how to detect &quot;rivers&quot; in paragraphs in &lt;a href=&quot;https://tex.stackexchange.com/q/29049/627&quot;&gt;this question&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this context, rivers are bands of white space that result from accidental alignment of interword spaces in the text. Since this can be quite distracting to a reader bad rivers are considered to be a symptom of poor typography. An example of text with rivers is this one, where there are two rivers flowing diagonally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4ShOW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is interest in detecting these rivers automatically, so that they can be avoided (probably by manual editing of the text). Raphink is making some progress at the TeX level (which only knows of glyph positions and bounding boxes), but I feel confident that the best way to detect rivers is with some image processing (since glyph shapes are very important and not available to TeX). I have tried various ways to extract the rivers from the above image, but my simple idea of applying a small amount of ellipsoidal blurring doesn't seem to be good enough. I also tried some &lt;strike&gt;Radon&lt;/strike&gt; Hough transform based filtering, but I didn't get anywhere with those either. The rivers are very visible to the feature-detection circuits of the human eye/retina/brain and somehow I would think this could be translated to some kind of filtering operation, but I am not able to make it work. Any ideas? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be specific, I'm looking for some operation that will detect the 2 rivers in the above image, but not have too many other false positive detections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; endolith asked why I am pursuing a image-processing-based approach given that in TeX we have access to the glyph positions, spacings, etc, and it might be much faster and more reliable to use an algorithm that examines the actual text. My reason for doing things the other way is that the &lt;em&gt;shape&lt;/em&gt; of the glyphs can affect how noticeable a river is, and at the text level it is very difficult to consider this shape (which depends on the font, on ligaturing, etc). For an example of how the shape of the glyphs can be important, consider the following two examples, where the difference between them is that I have replaced a few glyphs with others of almost the same width, so that a text-based analysis would consider them equally good/bad. Note, however, that the rivers in the first example are much worse than in the second. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vEGUw.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5UQwb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="371" LastEditorUserId="8202" LastEditDate="2022-08-23T17:00:43.750" LastActivityDate="2022-08-23T17:00:43.750" Title="&quot;River&quot; detection in text" Tags="|image-processing|matlab|python|" AnswerCount="5" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="375" PostTypeId="2" ParentId="374" CreationDate="2011-10-05T19:07:34.737" Score="139" Body="&lt;p&gt;I have thought about this some more, and think that the following should be fairly stable. Note that I have limited myself to morphological operations, because these should be available in any standard image processing library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Open image with a nPix-by-1 mask, where nPix is about the vertical distance between letters&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#% read image&#xA;img = rgb2gray('https://i.stack.imgur.com/4ShOW.png');&#xA;&#xA;%# threshold and open with a rectangle&#xA;%# that is roughly letter sized&#xA;bwImg = img &amp;gt; 200; %# threshold of 200 is better than 128&#xA;&#xA;opImg = imopen(bwImg,ones(13,1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mzNQI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) Open image with a 1-by-mPix mask to eliminate whatever is too narrow to be a river.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;opImg = imopen(opImg,ones(1,5));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LG0PL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) Remove horizontal &quot;rivers and lakes&quot; that are due to space between paragraphs, or indentation. For this, we remove all rows that are all true, and open with the nPix-by-1 mask that we know will not affect the rivers we have found previously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To remove lakes, we can use an opening mask that is slightly larger than nPix-by-nPix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this step, we can also throw out everything that is too small to be a real river, i.e. everything that covers less area than (nPix+2)*(mPix+2)*4 (that will give us ~3 lines). The +2 is there because we know that all objects are at least nPix in height, and mPix in width, and we want to go a little above that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%# horizontal river: just look for rows that are all true&#xA;opImg(all(opImg,2),:) = false;&#xA;%# open with line spacing (nPix)&#xA;opImg = imopen(opImg,ones(13,1));&#xA;&#xA;%# remove lakes with nPix+2&#xA;opImg = opImg &amp;amp; ~imopen(opImg,ones(15,15)); &#xA;&#xA;%# remove small fry&#xA;opImg = bwareaopen(opImg,7*15*4);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6rFi9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4) If we're interested in not only the length, but also the width of the river, we can combine distance transform with skeleton.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   dt = bwdist(~opImg);&#xA;   sk = bwmorph(opImg,'skel',inf);&#xA;   %# prune the skeleton a bit to remove branches&#xA;   sk = bwmorph(sk,'spur',7);&#xA;&#xA;   riversWithWidth = dt.*sk;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8dRdp.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;(colors correspond to width of river (though color bar is off by a factor of 2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can get the approximate length of the rivers by counting the number of pixels in each connected component, and the average width by averaging their pixel values.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here's the exact same analysis applied to the second, &quot;no-river&quot; image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a3mHH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="59" LastEditDate="2011-10-06T13:16:07.280" LastActivityDate="2011-10-06T13:16:07.280" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="376" PostTypeId="2" ParentId="322" CreationDate="2011-10-06T02:12:22.013" Score="24" Body="&lt;p&gt;&lt;strong&gt;Linear Filtering&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first approach in &lt;a href=&quot;https://dsp.stackexchange.com/questions/322/pink-1-f-pseudo-random-noise-generation/323#323&quot;&gt;Peter's answer&lt;/a&gt; (i.e. filtering white noise) is a very straightforward approach. In &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/sasp.html&quot; rel=&quot;noreferrer&quot;&gt;Spectral Audio Signal Processing&lt;/a&gt;, JOS gives a low-order filter that can be used to produce &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Example_Synthesis_1_F_Noise.html&quot; rel=&quot;noreferrer&quot;&gt;a decent approximation&lt;/a&gt;, along with an &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Example_Pink_Noise_Analysis.html&quot; rel=&quot;noreferrer&quot;&gt;analysis&lt;/a&gt; of how well the resulting power spectral density matches the ideal.  Linear filtering will always yield an approximation, but that may not matter in practice.  To paraphrase JOS:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There is no exact (rational, finite-order) filter which can produce&#xA;  pink noise from white noise. This is because the ideal amplitude&#xA;  response of the filter must be proportional to the irrational function&#xA;  $1/\sqrt{f}$, where $f$ denotes frequency in Hz. However, it is easy&#xA;  enough to generate pink noise to any desired degree of approximation,&#xA;  including perceptually exact.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The coefficients of the filter he gives are as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B = [0.049922035, -0.095993537, 0.050612699, -0.004408786];&#xA;A = [1, -2.494956002, 2.017265875, -0.522189400];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They're formatted as parameters to the &lt;a href=&quot;http://www.mathworks.com/help/techdoc/ref/filter.html&quot; rel=&quot;noreferrer&quot;&gt;MATLAB filter function&lt;/a&gt;, so for the sake of clarity, they correspond to the following transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = { .041 - .096z^{-1} + .051z^{-2} - .004z^{-3} \over{}  1 -2.495z^{-1} + 2.017z^{-2} - .522z^{-3}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, it's better to use the full precision of the coefficients in practice. Here's a link to what the pink noise generated using that filter sounds like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;div class=&quot;soundcloud-embed&quot;&gt;&#xD;&#xA;            &lt;iframe src=&quot;https://w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/24825086?show_artwork=false&quot; width=&quot;640&quot; height=&quot;116&quot; scrolling=&quot;no&quot; frameborder=&quot;no&quot;&gt;&lt;/iframe&gt;&#xD;&#xA;            &lt;/div&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fixed-point implementation, since it's usually more convenient to work with coefficients in the range [-1,1), some reworking of the transfer function will be in order.  Generally, the recommendation is to break things up into &lt;a href=&quot;http://www.eumus.edu.uy/eme/cursos/dsp/material/libros_html/filters/Real_Second_Order_Sections.html&quot; rel=&quot;noreferrer&quot;&gt;second-order sections&lt;/a&gt;, but part of the reason for that (as opposed to using first-order sections) is for the convenience of working with real coefficients when the roots are complex.  For this particular filter, all the roots are real, and combining then into second-order sections would probably still yield some denominator coefficients &gt;1, so three first-order sections is a reasonable choice, as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = { 1 - b_1z^{-1}\over{1 - a_1z^{-1}} } \space { 1-b_2z^{-1} \over{1-a_2z^{-1} } } \space &#xA;{1 - b_3z^{-1} \over{ 1 - a_3z^{-1} } }&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;b_1 = 0.98223157, \space b_2 = 0.83265661, \space b_3 = 0.10798089&#xA;$$&#xA;$$&#xA;a_1 = 0.99516897, \space a_2 = 0.94384177, \space a_3 = 0.55594526&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some judicious choice of sequencing for those sections, combined with some choice of gain factors for each section will be required to prevent overflow.  I haven't tried any of the other filters given &lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/#Filtering&quot; rel=&quot;noreferrer&quot;&gt;in the link in Peter's answer&lt;/a&gt;, but similar considerations would probably apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;White Noise&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the filtering approach requires a source of uniform random numbers in the first place.  If a library routine isn't available for a given platform, one of the simplest approaches is to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_congruential_generator&quot; rel=&quot;noreferrer&quot;&gt;linear congruential generator&lt;/a&gt;.  One example of an efficient fixed-point implementation is given by TI in &lt;a href=&quot;http://www.ti.com/lit/an/spra239/spra239.pdf&quot; rel=&quot;noreferrer&quot;&gt;Random Number Generation on a TMS320C5x (pdf)&lt;/a&gt;.  A detailed theoretical discussion of various other methods can be found in &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/0387001786&quot; rel=&quot;noreferrer&quot;&gt;Random Number Generation and Monte Carlo Methods&lt;/a&gt; by James Gentle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Several sources based on following links in Peter's answer are worth highlighting. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The first filter-based chunk of code references &lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/&quot; rel=&quot;noreferrer&quot;&gt;Introduction to Signal Processing&lt;/a&gt; by Orfanidis.  The full text is available at that link, and [in Appendix B] it has coverage of both pink and white noise generation.  As the comment mentions, Orfanidis mostly covers the Voss algorithm.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/allan-2/spectrum2.html&quot; rel=&quot;noreferrer&quot;&gt;The Spectrum Produced by the Voss-McCartney Pink Noise Generator&lt;/a&gt;.  Way down near the bottom of the page, after extensive discussion of variants of the Voss algorithm, this link is referenced &lt;em&gt;in giant pink letters&lt;/em&gt;.  It's much easier reading than some of the preceding ASCII diagrams.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://web.archive.org/web/20120623112516/http://www.nslij-genetics.org/wli/1fnoise/&quot; rel=&quot;noreferrer&quot;&gt;A Bibliograph on 1/f Noise&lt;/a&gt; by Wentian Li.  This is referenced both in Peter's source and by JOS.  It has a dizzying number of references on 1/f noise in general, dating all the way back to 1918.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="35" LastEditorUserId="35" LastEditDate="2018-07-25T19:07:40.773" LastActivityDate="2018-07-25T19:07:40.773" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="377" PostTypeId="2" ParentId="374" CreationDate="2011-10-06T03:29:21.497" Score="30" Body="&lt;p&gt;Hmmm... I guess &lt;a href=&quot;http://en.wikipedia.org/wiki/Radon_transform&quot; rel=&quot;noreferrer&quot;&gt;Radon transform&lt;/a&gt; isn't that easy to extract from.  (Radon transform basically rotates the image while &quot;looking through it&quot; edge-on.  It's the principle behind CAT scans.)  The transform of your image produces this sinogram, with the &quot;rivers&quot; forming bright peaks, which are circled:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wQUeM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one at 70 degrees rotation can be seen pretty clearly as the peak on the left of this plot of a slice along the horizontal axis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i8AAm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Especially if the text was Gaussian blurred first:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eTIGE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure how to reliably extract these peaks from the rest of the noise.  The bright top and bottom ends of the sinogram represent the &quot;rivers&quot; between horizontal lines of text, which you obviously don't care about.  Maybe a weighting function vs angle that emphasizes more vertical lines and minimizes the horizontal ones?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple cosine weighting function works well on this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hJE2d.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;finding the vertical river at 90 degrees, which is the global maxima in the sinogram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9HApT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and on this image finding the one at 104 degrees, though blurring first makes it more accurate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/II2Kh.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xO5uu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(SciPy's &lt;code&gt;radon()&lt;/code&gt; function is &lt;a href=&quot;http://flic.kr/p/aKEZvg&quot; rel=&quot;noreferrer&quot;&gt;kind of dumb&lt;/a&gt;, or I'd map this peak back onto the original image as a line going through the middle of the river.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it doesn't find either of the two main peaks in the sinogram for your image, after blurring and weighting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sHDUL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're there, but they're overwhelmed by the stuff near the middle peak of the weighting function.  With the right weighting and tweaking this method probably &lt;em&gt;could&lt;/em&gt; work, but I'm not sure what the right tweaks are.  It probably depends on the properties of the scans of the page, too.  Maybe the weighting needs to be derived from the overall energy in the slice or something, like a normalization.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pylab import *&#xA;from scipy.misc import radon&#xA;import Image&#xA;&#xA;filename = 'rivers.png'&#xA;I = asarray(Image.open(filename).convert('L').rotate(90))&#xA;&#xA;# Do the radon transform and display the result&#xA;a = radon(I, theta = mgrid[0:180])&#xA;&#xA;# Remove offset&#xA;a = a - min(a.flat)&#xA;&#xA;# Weight it to emphasize vertical lines&#xA;b = arange(shape(a)[1]) #&#xA;d = (0.5-0.5*cos(b*pi/90))*a&#xA;&#xA;figure()&#xA;imshow(d.T)&#xA;gray()&#xA;show()&#xA;&#xA;# Find the global maximum, plot it, print it&#xA;peak_x, peak_y = unravel_index(argmax(d),shape(d))&#xA;plot(peak_x, peak_y,'ro')&#xA;print len(d)- peak_x, 'pixels', peak_y, 'degrees'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-02-28T21:07:35.543" LastActivityDate="2012-02-28T21:07:35.543" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="378" PostTypeId="1" AcceptedAnswerId="380" CreationDate="2011-10-06T13:15:44.533" Score="25" ViewCount="20287" Body="&lt;p&gt;Assume the following first order IIR Filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = \alpha x[n] + (1 - \alpha) y[n - 1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I choose the parameter $ \alpha $ s.t. the IIR approximates as good as possible the FIR which is the arithmetic mean of the last $ k $ samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ z[n] = \frac{1}{k}x[n] + \frac{1}{k}x[n-1] + \ldots + \frac{1}{k}x[n-k+1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ n \in [k, \infty) $, meaning the input for the IIR might be longer than $ k $ and yet I'd like to have the best approximation of the mean of last $ k $ inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the IIR has infinite impulse response, hence I'm looking for the best approximation.&#xA;I'd be happy for analytic solution whether it is for $ {L}_{2} $ or $ {L}_{1} $ cost function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could this optimization problems can be solved given only 1st order IIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-06-02T17:49:55.293" LastActivityDate="2018-06-02T17:49:55.293" Title="What Is the Best First Order IIR (AR Filter) Approximation to a Moving Average Filter (FIR Filter)?" Tags="|filters|filter-design|infinite-impulse-response|optimization|approximation|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="379" PostTypeId="2" ParentId="378" CreationDate="2011-10-06T15:58:52.187" Score="19" Body="&lt;p&gt;OK, let's try to derive the best:&#xA;$$&#xA;\begin{array}{lcl}&#xA;y[n] &amp;amp;=&amp;amp; \alpha x[n] + (1 - \alpha) y[n - 1] \\&#xA;&amp;amp;=&amp;amp;  \alpha x[n] + (1 - \alpha) \alpha x[n-1] + (1 - \alpha)^2 y[n - 2]\\&#xA;&amp;amp;=&amp;amp;  \alpha x[n] + (1 - \alpha) \alpha x[n-1] + (1 - \alpha)^2 \alpha x[n-2] + (1 - \alpha)^3 y[n - 3]\\&#xA;\end{array}&#xA;$$&#xA;so that the coefficient of $x[n-m]$ is $\alpha(1-\alpha)^m$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best mean-square approximation will minimize:&#xA;$$&#xA;\begin{array}{lcl}&#xA;J(\alpha) &amp;amp;=&amp;amp; \sum_{m=0}^{k-1} (\alpha(1-\alpha)^m - \frac{1}{k})^2 + \sum_{m=k}^\infty \alpha^2(1-\alpha)^{2m}\\&#xA;&amp;amp;=&amp;amp; \sum_{m=0}^{k-1} \left(\alpha^2(1-\alpha)^{2m} - \frac{2}{k}\alpha(1-\alpha)^m + \frac{1}{k^2}\right) + \alpha^2 (1-\alpha)^{2k} \sum_{m=0}^\infty (1-\alpha)^{2m} \\&#xA;&amp;amp;=&amp;amp; \alpha^2\frac{1- (1-\alpha)^{2k}}{1 - (1-\alpha)^2} + \frac{2\alpha}{k} \frac{1 - (1 - \alpha)^k}{1 - (1 - \alpha)} + \frac{\alpha^2(1-\alpha)^{2k}}{1 - (1 - \alpha)^2}+ \frac{1}{k}\\&#xA;&amp;amp;=&amp;amp; \frac{\alpha^2}{1 - (1 - \alpha)^2} + \frac{2}{k} (1-(1-\alpha)^k) + \frac{1}{k}\\&#xA;&amp;amp;=&amp;amp; \frac{\alpha^2}{2\alpha - \alpha^2 }+ \frac{2}{k} (1-(1-\alpha)^k)+ \frac{1}{k}\\&#xA;&amp;amp;=&amp;amp; \frac{\alpha}{2 - \alpha }+ \frac{2}{k} (1-(1-\alpha)^k)+ \frac{1}{k}\\&#xA;\end{array}&#xA;$$&#xA;because the FIR coefficients are zero for $m &amp;gt; k - 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next step is to take derivatives and equate to zero.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Looking at a plot of the derived $J$ for $K = 1000$ and $\alpha$ from 0 to 1, it looks like the problem (as I've set it up) is ill-posed, because the best answer is $\alpha = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7JAGz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I think there's a mistake here.&#xA;The way it should be according to my calculations is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{array}{lcl}&#xA;J(\alpha) &amp;amp;=&amp;amp; \sum_{m=0}^{k-1} (\alpha(1-\alpha)^m - \frac{1}{k})^2 + \sum_{m=k}^\infty \alpha^2(1-\alpha)^{2m} \\&#xA;&amp;amp;=&amp;amp; \sum_{m=0}^{k-1} \left(\alpha^2(1-\alpha)^{2m} - \frac{2}{k}\alpha(1-\alpha)^m + \frac{1}{k^2}\right) + \alpha^2 (1-\alpha)^{2k} \sum_{m=0}^\infty (1-\alpha)^{2m} \\&#xA;&amp;amp;=&amp;amp; \alpha^2\frac{1- (1-\alpha)^{2k}}{1 - (1-\alpha)^2} - \frac{2\alpha}{k} \frac{1 - (1 - \alpha)^k}{1 - (1 - \alpha)} + \frac{1}{k} + \frac{\alpha^2(1-\alpha)^{2k}}{1 - (1 - \alpha)^2}&#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.wolframalpha.com/input/?i=%28a%20%5E%202%29%20*%20%28%281%20-%20%28%281%20-%20a%29%20%5E%20%282%20*%20k%29%29%29%20/%20%281%20-%20%28%281%20-%20a%29%20%5E%202%29%29%29%20-%20%28%282%20*%20a%20/%20k%29%20*%20%28%281%20-%20%28%281%20-%20a%29%20%5E%20k%29%29%20/%20%281%20-%20%281%20-%20a%29%29%29%29%20%2b%20%281%20/%20k%29%20%2b%20%28%28%28a%20%5E%202%29%20*%20%28%281%20-%20a%29%20%5E%20%282%20*%20k%29%29%29%20/%20%281%20-%20%28%281%20-%20a%29%20%5E%202%29%29%29&quot; rel=&quot;noreferrer&quot;&gt;Simplifying it according to Mathematica&lt;/a&gt; yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ J(\alpha) = \frac{\alpha}{2 - \alpha} + \frac{2 {(1 - \alpha)}^{k} -1}{k} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the following code on MATLAB yields something equivalent though different:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;syms a k;&#xA;&#xA;expr1 = (a ^ 2) * ((1 - ((1 - a) ^ (2 * k))) / (1 - ((1 - a) ^ 2)));&#xA;expr2 = ((2 * a) / k) * ((1 - ((1 - a) ^ (k))) / (1 - (1 - a)));&#xA;expr3 = (1 / k);&#xA;expr4 = ((a ^ 2) * ((1 - a) ^ (2 * k))) / (1 - ((1 - a) ^ (2)));&#xA;&#xA;simpExpr = simplify(expr1 - expr2 + expr3 + expr4);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$$ J(\alpha) = \frac{-2}{\alpha - 2} - \frac{k - 2{(1 - \alpha)}^{k} + 1}{k} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyhow, those functions do have minimum.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So let's assume that we really only care about the approximation over the support (length) of the FIR filter. In that case, the optimization problem is just:&#xA;$$&#xA;J_2(\alpha) = \sum_{m=0}^{k-1} (\alpha(1-\alpha)^m - \frac{1}{k})^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plotting $J_2(\alpha)$ for various values of $K$ versus $\alpha$ results in the date in the plots and table below.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For $K$ = 8.     $\alpha_{\tt min}$ = 0.1533333&lt;br&gt;&#xA;     For $K$ = 16.    $\alpha_{\tt min}$ = 0.08&lt;br&gt;&#xA;     For $K$ = 24.    $\alpha_{\tt min}$ = 0.0533333&lt;br&gt;&#xA;     For $K$ = 32.    $\alpha_{\tt min}$ = 0.04&lt;br&gt;&#xA;     For $K$ = 40.    $\alpha_{\tt min}$ = 0.0333333&lt;br&gt;&#xA;     For $K$ = 48.    $\alpha_{\tt min}$ = 0.0266667&lt;br&gt;&#xA;     For $K$ = 56.    $\alpha_{\tt min}$ = 0.0233333&lt;br&gt;&#xA;     For $K$ = 64.    $\alpha_{\tt min}$ = 0.02&lt;br&gt;&#xA;     For $K$ = 72.    $\alpha_{\tt min}$ = 0.0166667   &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ge0JH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red dashed lines are $1/K$ and the green lines are $\alpha_{\tt min}$, the value of $\alpha$ that minimizes $J_2(\alpha)$ (chosen from $\tt alpha = [0:.01:1]/3;$).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="128" LastEditDate="2011-10-10T05:52:24.610" LastActivityDate="2011-10-10T05:52:24.610" CommentCount="10" CommunityOwnedDate="2011-10-06T15:58:52.187" ContentLicense="CC BY-SA 3.0" />
  <row Id="380" PostTypeId="2" ParentId="378" CreationDate="2011-10-06T21:01:56.330" Score="13" Body="&lt;p&gt;There is no analytic solution for $\alpha$ being a scalar (I think). Here is a script that gives you $\alpha$ for a given $K$. If you need it online you can build a LUT. The script finds the solution that minimizes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\int_{0}^{\pi} dw  \quad \left|H_1(jw) - H_2(jw)\right|^2&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H_1$ is the FIR frequency response and $H_2$ is the IIR frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You did not specify any range for K. But I just want to make it clear that the following system is equivalent to your mean filter and has the same computational complexity and your first order IIR!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = \frac{1}{K} \frac{1 - z^{-K}}{1-z^{-1}}$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function a = find_a(K)&#xA;&#xA;w = 0.0001:0.001:pi;&#xA;as = [-1:0.001:-0.001  0.001:0.001:1];&#xA;&#xA;E = zeros(size(as));&#xA;for idx=1:length(as)&#xA;    fJ = J(w,as(idx),K);&#xA;    E(idx) = sum(fJ);&#xA;end&#xA;&#xA;[Emin, indx] = min(E)&#xA;a = as(indx)&#xA;&#xA;function f = J(w,a,K)&#xA;    num = 2*(2-a)*(1-cos(w*K)) + 2*(cos(w*(K-1)) - cos(w)) - 2*(1-a)*(cos(w)-cos(w*(K+1)));&#xA;    den = (2-a)^2 + 1 + (1-a)^2 + 2*(1-a)*cos(2*w) - 2*(2-a)^2*cos(w);&#xA;    f = -(a/K)*num./den;&#xA;    f = f+(1/K^2)*(1-cos(w*K))./(1-cos(w))+a^2./(1+(1-a)^2-2*(1-a)*cos(w));&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2011-10-07T09:28:18.010" LastActivityDate="2011-10-07T09:28:18.010" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="384" PostTypeId="2" ParentId="378" CreationDate="2011-10-07T21:37:26.747" Score="17" Body="&lt;p&gt;There's a nice discussion of this problem in &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0471738417&quot; rel=&quot;noreferrer&quot;&gt;Embedded Signal Processing with the Micro Signal Architecture&lt;/a&gt;, roughly &lt;a href=&quot;http://books.google.com/books?id=Lg0aN3vYw20C&amp;amp;lpg=PA67&amp;amp;ots=ZoKuNZP3tq&amp;amp;dq=%22moving%20average%22%20%22unit%20circle%22%20stability&amp;amp;pg=PA68#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;between pages 63 and 69&lt;/a&gt;.  On &lt;a href=&quot;http://books.google.com/books?id=Lg0aN3vYw20C&amp;amp;lpg=PA67&amp;amp;ots=ZoKuNZP3tq&amp;amp;dq=%22moving%20average%22%20%22unit%20circle%22%20stability&amp;amp;pg=PA63#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;page 63&lt;/a&gt;, it includes a derivation of the exact recursive moving average filter (which niaren gave in &lt;a href=&quot;https://dsp.stackexchange.com/questions/378/memory-of-iir-filter/380#380&quot;&gt;his answer&lt;/a&gt;),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = { 1 \over{N} } { 1 - z^{-N} \over { 1 - z^{-1} } }.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For convenience with respect to the following discussion, it corresponds to the following difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; y_n = y_{n-1} + {1\over{N} }(x_n - x_{n-N}).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approximation which puts the filter into the form you specified requires assuming that $x_{n-N} \approx y_{n-1}$, because (and I quote from &lt;a href=&quot;http://books.google.com/books?id=Lg0aN3vYw20C&amp;amp;lpg=PA67&amp;amp;ots=ZoKuNZP3tq&amp;amp;dq=%22moving%20average%22%20%22unit%20circle%22%20stability&amp;amp;pg=PA68#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;pg. 68&lt;/a&gt;) &quot;$y_{n-1}$ is the average of $x_n$ samples&quot;.  That approximation allows us to simplify the preceding difference equation as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{array}\\&#xA; y_{n} = y_{n-1} + {1\over{N}}(x_n - y_{n-1}) \\&#xA;y_{n} = y_{n-1} - {1\over{N}} y_{n-1} + {1\over{N}}x_n \\&#xA;y_{n} = (1-{1\over{N}})y_{n-1} + {1\over{N}}x_n.&#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting $\alpha = {1\over{N}}$, we arrive at your original form, $y_{n} =  \alpha x_n + (1-\alpha)y_{n-1}$, which shows that the coefficient you want (with respect to this approximation) is exactly $1\over{N}$ (where $N$ is the number of samples).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this approximation the &quot;best&quot; in some respect?  It's certainly elegant.  Here's how the magnitude response compares [at 44.1kHz] for N = 3, and as N increases to 10 (approximation in blue):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0ehnj.png&quot; alt=&quot;N=3&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qOpek.png&quot; alt=&quot;N=[3,10]&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://dsp.stackexchange.com/questions/378/memory-of-iir-filter/379#379&quot;&gt;Peter's answer&lt;/a&gt; suggests, approximating an FIR filter with a recursive filter can be problematic under a least squares norm.  An extensive discussion of how to solve this problem in general can be found in JOS's thesis, &lt;a href=&quot;https://ccrma.stanford.edu/papers/techniques-digital-filter-design-and-system-identification-with-application-violin&quot; rel=&quot;noreferrer&quot;&gt;Techniques for Digital Filter Design and System Identification with Application to the Violin&lt;/a&gt;. He advocates the use of the Hankel Norm, but in cases where the phase response doesn't matter, he also covers Kopec's Method, which might work well in this case (and uses an $L^2$ norm).  A broad overview of the techniques in the thesis can be found &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Digital_Filter_Design_Overview.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. They may yield other interesting approximations.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2011-10-07T21:37:26.747" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="385" PostTypeId="2" ParentId="370" CreationDate="2011-10-08T11:15:49.807" Score="12" Body="&lt;p&gt;&lt;b&gt;TL;DR?  Google Scholar for &lt;a href=&quot;http://scholar.google.com/scholar?hl=en&amp;amp;q=partial%20separation%20harmonic&quot;&gt;harmonic partial separation&lt;/a&gt;.&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A good starting point would be sinusoidal modeling techniques that separate the signal into sines+noise (deterministic and stochastic) components. The deterministic component, made up of sines, can be resynthesized convincingly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mtg.upf.edu/files/projectsweb/sms-piano-original.wav&quot;&gt;http://mtg.upf.edu/files/projectsweb/sms-piano-original.wav&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mtg.upf.edu/files/projectsweb/sms-piano-deterministic.wav&quot;&gt;http://mtg.upf.edu/files/projectsweb/sms-piano-deterministic.wav&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sines are subtracted from the signal and the noisy/stochastic portion remains. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mtg.upf.edu/files/projectsweb/sms-piano-stochastic.wav&quot;&gt;http://mtg.upf.edu/files/projectsweb/sms-piano-stochastic.wav&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stochastic portion is synthesized by putting noise through some noise-shaping filter.  Some others have extended this to a sines+noise+transients model which helps preserve transient stochastic features in time stretching. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Sines_Noise_Modeling.html&quot;&gt;https://ccrma.stanford.edu/~jos/sasp/Sines_Noise_Modeling.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mtg.upf.edu/technologies/sms&quot;&gt;http://mtg.upf.edu/technologies/sms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the sinusoidal parameters of a signal, it is possible to separate the sines of overlapping notes by looking for harmonic ratios and grouping by onset, etc. Partial tracking turns up a lot of results on Google Scholar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://recherche.ircam.fr/equipes/analyse-synthese/lagrange/research/papers/lagrangeIcassp05.pdf&quot;&gt;http://recherche.ircam.fr/equipes/analyse-synthese/lagrange/research/papers/lagrangeIcassp05.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dream.cs.bath.ac.uk/software/sndan/mqan.html&quot;&gt;http://dream.cs.bath.ac.uk/software/sndan/mqan.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.acoustics.hut.fi/dafx08/papers/dafx08_20.pdf&quot;&gt;Hidden Markov Models&lt;/a&gt;, &lt;a href=&quot;http://dept-info.labri.fr/~sm/Publications/dafx05-1.pdf&quot;&gt;polynomials&lt;/a&gt;, and &lt;a href=&quot;http://www.clear.rice.edu/elec301/Projects02/lorisFor/mqmethod2.html&quot;&gt;Macaulay-Quatieri&lt;/a&gt; are some of the methods.&#xA;I am stumped about separating the stochastic leftovers into two notes.  I don't know how Melodyne addresses this.&lt;/p&gt;&#xA;" OwnerUserId="267" LastEditorUserId="267" LastEditDate="2011-10-08T11:40:58.127" LastActivityDate="2011-10-08T11:40:58.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="386" PostTypeId="1" AcceptedAnswerId="388" CreationDate="2011-10-09T16:03:57.170" Score="16" ViewCount="25555" Body="&lt;p&gt;I'm reading up on &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot;&gt;Autocorrelation&lt;/a&gt;, but I'm not sure I understand exactly how it works and what output I should expect. Am I right in thinking that I should input my signal to the AC function and have a sliding window input. Each window (of 1024 samples, for example) would output a coefficient between -1 and 1. The sign simply states if the line is upwards or downwards and the value states how strong the correlation is. For simplicity, lets say I don't have an overlap and just move the window 1024 samples each time. In a sample of 44100, would I get 43 coefficients and do I need to keep all of them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say I perform this for a 200 second signal, giving me 8600 coefficients. How would I use these coefficients to detect repetition and, in turn, tempo? Should I create some sort of neural network to group them, or is that overkill?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="334" LastActivityDate="2022-12-02T17:59:51.613" Title="Autocorrelation in audio analysis" Tags="|algorithms|audio|autocorrelation|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="387" PostTypeId="2" ParentId="386" CreationDate="2011-10-09T22:14:30.793" Score="1" Body="&lt;p&gt;The auto correlation is simply the cross correlation of a signal with itself. An easy way to compute it is to do a convolution between the original signal and a time flipped version of the signal. If you have a signal that is 1000 samples long, than its auto correlation has 1999 (2*N-1) non-zero samples. Only 1000 of those samples are unique because the auto correlation (for a real signal) is always symmetric in time, i.e. ac[n] = ac[-n].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuous signals need to be broken down into finite segments. That is similar to the Fourier Transform: technically you need to integrate from -inf to +inf but breaking it down into segments (with overlap and/or windowing as needed) also yields useful results. Choice of window length, shape and overlap depends on the application.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-09T22:14:30.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="388" PostTypeId="2" ParentId="386" CreationDate="2011-10-10T04:14:19.983" Score="28" Body="&lt;p&gt;The idea of autocorrelation is to provide a measure of similarity between a signal and itself at a given lag.  There are several ways to approach it, but for the purposes of pitch/tempo detection, you can think of it as a search procedure.  In other words, you step through the signal sample-by-sample and perform a correlation between your reference window and the lagged window.&lt;/p&gt;&#xA;&lt;p&gt;The correlation at &amp;quot;lag 0&amp;quot; will be the global maximum because you're comparing the reference to a verbatim copy of itself.  As you step forward, the correlation will necessarily decrease, but in the case of a periodic signal, at some point it will begin to increase again, then reach a local maximum.  The distance between &amp;quot;lag 0&amp;quot; and that first peak gives you an estimate of your pitch/tempo.&lt;/p&gt;&#xA;&lt;p&gt;The way I'm going to describe how to compute it in practice yields something slightly different (i.e. cyclic vs. acyclic mostly), but that's the conceptual basis for how it works.&lt;/p&gt;&#xA;&lt;p&gt;Computing sample-by-sample correlations can be very computationally expensive at high sample rates, so typically an FFT-based approach is used.  Taking the FFT of the segment of interest, multiplying it by its &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_conjugate&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex conjugate&lt;/a&gt;, then taking the inverse FFT will give you the &lt;a href=&quot;https://ccrma.stanford.edu/%7Ejos/sasp/Cyclic_Autocorrelation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;cyclic autocorrelation&lt;/a&gt;. In code (using &lt;a href=&quot;https://numpy.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;numpy&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;freqs = numpy.fft.rfft(signal)&#xA;autocorr = numpy.fft.irfft(freqs * numpy.conj(freqs))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The effect will be to decrease the amount of noise in the signal (which is uncorrelated with itself) relative to the periodic components (which are similar to themselves by definition).  Repeating the autocorrelation (i.e. conjugate multiplication) before taking the inverse transform will reduce the noise even more.  Consider the example of a sine wave mixed with white noise.  The following plot shows a 440hz sine wave, the same sine wave &amp;quot;corrupted&amp;quot; by noise, the cyclic autocorrelation of the noisy wave, and the double cyclic autocorrelation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FSbyd.png&quot; alt=&quot;Autocorrelation&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note how the first peak of both autocorrelation signals is located exactly at end of the first cycle of the original signal.  That's the peak you're looking for in order to determine the periodicity (pitch in this case).  The first autocorrelation signal is still a little &amp;quot;wiggly&amp;quot;, so in order to do peak detection, some kind of smoothing would be required.  Autocorrelating twice in the frequency domain accomplishes the same thing (and is relatively fast).  Note that by &amp;quot;wiggly&amp;quot;, I mean how the signal looks when zoomed way in, not the dip that occurs in the center of the plot.  The second half of the cyclic autcorrelation will always be the mirror image of the first half, so that kind of &amp;quot;dip&amp;quot; is typical. Just to be clear about the algorithm, here's what the code would look like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;freqs = numpy.fft.rfft(signal)&#xA;auto1 = freqs * numpy.conj(freqs)&#xA;auto2 = auto1 * numpy.conj(auto1)&#xA;result = numpy.fft.irfft(auto2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Whether you would need to do more than one autocorrelation depends on how much noise is in the signal.&lt;/p&gt;&#xA;&lt;p&gt;Of course, there are many subtle variations on this idea, and I'm not going to get into all of them here.  The most comprehensive coverage I've seen (in the context of pitch detection) is in &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0132136031&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Processing of Speech Signals&lt;/a&gt; by Rabiner and Schafer.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, as to whether autocorrelation will be sufficient for tempo detection.  The answer is yes and no.  You can get some tempo information (depending on the source signal), but it may be hard to make sense of what it means in all cases.  For example, here's a plot of two loops of a breakbeat, followed by a plot of the cyclic autocorrelation of the entire sequence:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q1Mm7.png&quot; alt=&quot;Breakbeat Autocorrelation&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;For reference, here's the corresponding audio:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://soundcloud.com/datageist/breakbeat-autocorrelation&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://soundcloud.com/datageist/breakbeat-autocorrelation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Sure enough, there's a nice spike right in the middle corresponding to the loop point, but it came from processing quite a long segment.  On top of that, if it wasn't an exact copy (e.g. if there were instrumentation with it), that spike wouldn't be as clean.  Autocorrelation will definitely be useful in tempo detection, but it probably won't be sufficient by itself for complex source material.  For example, even if you find a spike, how do you know whether it's a full measure, or quarter note, a half note, or something else?  In this case it's clear enough that it's a full measure, but that won't always be the case.  I'd suggest playing around with using AC on simpler signals until the inner workings become clear, then asking another question about tempo detection in general (as it's a &amp;quot;bigger&amp;quot; subject).&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="7092" LastEditDate="2022-12-02T17:59:51.613" LastActivityDate="2022-12-02T17:59:51.613" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="389" PostTypeId="1" CreationDate="2011-10-10T10:11:43.023" Score="5" ViewCount="122" Body="&lt;p&gt;I have an image. I find features on it using different methods. I want to quantify that which method performs the best. The creteria is how many features per unit area of the image are and how they are spread. More the features are spread, the better it is. How to visualize them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at the end the criteria is &quot;how many features per unit area are found and how well are they spread all over the image&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will be great if there are some suggestions that how to visualize the quantified results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="415" LastActivityDate="2011-10-11T20:16:16.680" Title="How to statistically quantify the coverage of features in the data?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="390" PostTypeId="1" AcceptedAnswerId="392" CreationDate="2011-10-10T14:38:45.557" Score="5" ViewCount="670" Body="&lt;p&gt;Is there any way to take advantage of the frequency domain to make a clean/nice sampling rate reduction effect ? and how ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, deducted from my tests:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if I set to 0 the magnitude uppon a certain threshold I only get a filter(quite obvious...)&lt;/li&gt;&#xA;&lt;li&gt;if I set to 0 one sample over 2 before the buffer transfrom it's not at all some freq domain processing ( if I do the same on the transformed buffers it's also a filter)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is it possible to make SR reduction in the freq domain ? (actually I have some overlapped phase and magnitude arrays...)&lt;/p&gt;&#xA;" OwnerUserId="416" LastEditorUserId="416" LastEditDate="2011-10-10T16:17:09.520" LastActivityDate="2011-10-14T18:25:07.793" Title="Is there any way to make a sampling rate reduction in the frequency domain?" Tags="|audio|sampling|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="392" PostTypeId="2" ParentId="390" CreationDate="2011-10-10T16:25:47.137" Score="4" Body="&lt;p&gt;If you multiply a frequency spectrum by a low-pass filter frequency response, this could leave an area in the resulting spectrum around Fs/2 zero, or nearly so, depending on the filter response.  Don't use a low-pass filter with a rectangular frequency response by just zeroing FFT bins, as this frequency response has severe ripples in both the stop band and pass band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When working with the frequency response from a DFT/FFT, after you have filtered a sufficient number of bins around Fs/2 to zero, or nearly so (down to your desired noise level), you can shorten the FFT vector by removing those bins symmetrically around Fs/2.  Given a shorter complex vector in the frequency domain, an IFFT of this vector will produce a shorter vector in the time domain, equivalent to a lower sample rate over the same time period.  The lower the cutoff of the low-pass filter, the shorter the truncated vectors can be, the more you can lower the sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency response is already sufficiently low-pass, or you don't care about severe ripple in the resulting frequency response, you can just reduce the size of the FFT vector and IFFT to reduce the sample rate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-10-10T17:00:25.363" LastActivityDate="2011-10-10T17:00:25.363" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="393" PostTypeId="2" ParentId="390" CreationDate="2011-10-10T17:28:33.170" Score="7" Body="&lt;p&gt;Yes, you can do what you're looking for. Think about what happens in the frequency domain when you downsample a signal in the time domain: the spectrum &quot;folds over&quot; on top of itself and sums, the well-known aliasing effect. If your signal is already sufficiently bandlimited, then you can obtain the downsampled time-domain signal without computing the samples that you would subsequently throw out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a signal $x[n], n = 0, 1, \ldots , N-1 $ that has DFT $X[k], k = 0, 1, \ldots , N-1$, a new signal $x_d[n]$ that is $x[n]$ decimated by a factor $D$ can be generated by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;X_d[k&amp;#39;] = \sum_{d=0}^{D-1} X[k&amp;#39; + d\frac{N}{D}], k&amp;#39; = 0, 1, \ldots , \frac{N}{D} - 1&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;x_d[n] = IDFT(X_d[k&amp;#39;])&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse DFT (and subsequently $x_d[n]$) is of length $\frac{N}{D}$. This method is sometimes referred to as &quot;stack and add&quot;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-10-14T18:25:07.793" LastActivityDate="2011-10-14T18:25:07.793" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="395" PostTypeId="1" CreationDate="2011-10-10T22:47:40.037" Score="6" ViewCount="3186" Body="&lt;p&gt;I am working on acoustic echo cancellation which has a double talk detector. During the single talk, the ERLE (Echo Return Loss Enhancement) exceeds 100dB and during double talk around 20dB to 40 dB. I have read few papers and saw that for a good echo canceler the ERLE should be between 40-50dB. Am I going wrong anywhere? Is is ok to get such high ERLE? &lt;/p&gt;&#xA;" OwnerUserId="421" LastEditorUserId="77" LastEditDate="2011-10-10T23:56:14.803" LastActivityDate="2020-03-01T13:39:10.267" Title="What are reasonable levels for the ERLE (Echo Return Loss Enhancement) in acoustic echo cancellation?" Tags="|acoustics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="396" PostTypeId="2" ParentId="389" CreationDate="2011-10-11T01:10:11.387" Score="2" Body="&lt;p&gt;To visualize the features, why don't you just do scatter plots? I assume that if you do feature extraction, you know &lt;em&gt;where&lt;/em&gt; in the image the features are found. If different features have different &quot;sizes&quot;, i.e. some features are point features, whereas others take up e.g. a 5x5 window (and are non-overlapping), you may want to adjust the size of your symbols for the scatter plot to visually improve the relative amount of coverage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to quantify the coverage, then you're looking at two independent measures&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Density: To this end, you can simply divide the number of features by the image size.&lt;/li&gt;&#xA;&lt;li&gt;Homogeneity: I've seen &lt;a href=&quot;http://en.wikipedia.org/wiki/Spatial_descriptive_statistics#Ripley.27s_K_and_L_functions&quot; rel=&quot;nofollow&quot;&gt;Ripley's K&lt;/a&gt; used to great success when looking at whether data is homogeneously distributed, or whether it is clustered.  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="59" LastEditorUserId="59" LastEditDate="2011-10-11T20:16:16.680" LastActivityDate="2011-10-11T20:16:16.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="397" PostTypeId="1" CreationDate="2011-10-11T03:48:47.070" Score="17" ViewCount="7686" Body="&lt;p&gt;I'll use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;noreferrer&quot;&gt;Scale-invariant feature transform&lt;/a&gt; algorithm as an example here.  SIFT creates a scale space based on scaled gaussian filtering of an image, and then computes the difference of gaussians to detect potential interest points.  These points are defined as the local minima and maxima across the difference of gaussians.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is claimed that this approach is scale invariant (among other puzzling invariances).  Why is this?  It's unclear to me why this is the case.&lt;/p&gt;&#xA;" OwnerUserId="423" LastEditorUserId="818" LastEditDate="2013-07-19T15:10:48.373" LastActivityDate="2013-07-19T15:10:48.373" Title="Why is the difference of gaussians scale space scale invariant?" Tags="|image-processing|computer-vision|sift|scale-space|" AnswerCount="2" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="398" PostTypeId="2" ParentId="389" CreationDate="2011-10-11T06:23:38.223" Score="1" Body="&lt;p&gt;The hardcore approach is to measure the mutual information between your input and your features. I have once applied this approach to audio with some degree of success. Take a look at this &lt;a href=&quot;http://www.bme.ogi.edu/~lantian/bibo/feature%20selection/Input%20Feature%20Selection%20for%20Classification%20Problems.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.bme.ogi.edu/~lantian/bibo/feature%20selection/Input%20Feature%20Selection%20for%20Classification%20Problems.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2011-10-11T06:23:38.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="399" PostTypeId="2" ParentId="397" CreationDate="2011-10-11T09:34:09.707" Score="5" Body="&lt;p&gt;Difference of gaussians is not scale invariant. SIFT (to limited degree) scale invariant because it looks for DoG extrema across scale-space - that is finding scale in with DoG extremal both spatially and relatively to neighboring scales. Because output DoG is obtained for this fixed scale (that is not a function of input scale) result is scale-independent, that is scale-invariant.&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2011-10-11T09:34:09.707" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="401" PostTypeId="1" AcceptedAnswerId="404" CreationDate="2011-10-11T16:02:46.550" Score="15" ViewCount="11416" Body="&lt;p&gt;I have binary 160x120 images such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/71yih.png&quot; alt=&quot;original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to detect corners of those white blobs. They are previously closed by mathematical morphology so there shouldn't have any inner corners. In this specific case, I would want 16 corners, like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lHJky.png&quot; alt=&quot;example of corners detection&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first attempt was using some OpenCV functions like &lt;a href=&quot;http://opencv.itseez.com/modules/imgproc/doc/feature_detection.html?highlight=goodfeaturestotrack#void%20cvGoodFeaturesToTrack%28const%20CvArr*%20image,%20CvArr*%20eigImage,%20CvArr*%20tempImage,%20CvPoint2D32f*%20corners,%20int*%20cornerCount,%20double%20qualityLevel,%20double%20minDistance,%20const%20CvArr*%20mask,%20int%20blockSize,%20int%20useHarris,%20double%20k%29&quot; rel=&quot;noreferrer&quot;&gt;goodFeaturesToTrack&lt;/a&gt; or &lt;a href=&quot;http://opencv.itseez.com/modules/features2d/doc/feature_detection_and_description.html?highlight=fast#void%20FAST%28const%20Mat&amp;amp;%20image,%20vector%3CKeyPoint%3E&amp;amp;%20keypoints,%20int%20threshold,%20bool%20nonmaxSupression%29&quot; rel=&quot;noreferrer&quot;&gt;FAST&lt;/a&gt; but they are particularly slow (plus FAST is very unstable). My idea would be to do such a computation on the GPU, as my source image comes from it. I looked for ideas on the web on how to write such shaders (I'm using OpenGL ES 2.0), but found nothing concrete. Any idea how I could start such an algorithm?&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="6" LastEditDate="2011-10-11T16:59:33.570" LastActivityDate="2016-03-09T11:13:14.800" Title="How to detect corners in a binary images with OpenGL?" Tags="|image-processing|computer-vision|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="402" PostTypeId="2" ParentId="356" CreationDate="2011-10-11T22:02:50.773" Score="8" Body="&lt;p&gt;Even though I couldn't find a decent table of contents, I took a shot on ordering a source book of papers &lt;em&gt;edited&lt;/em&gt; by Tustin (i.e. &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/B000BWI716&quot;&gt;Automatic and Manual Control&lt;/a&gt;), thinking he may have included something relevant.  The direct source wasn't in there, but in a paper by B. M. Brown, &lt;em&gt;Application of Finite Difference Operators to Linear Systems&lt;/em&gt;, the following citation is given:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The simplest of these [approximations in the form of rational&#xA;  fractions] has been derived &lt;em&gt;ad hoc&lt;/em&gt; by $Tustin^6$.  It is the time&#xA;  series equivalent of the operator   $$ {2\over{\delta}} \space {1 - E^{-1} \over {1 + E^{-1}}} $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This can be written as&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$ {2\over{\delta}} {E - 1 \over{ E + 1 }} \space = \space {1\over{\delta}} {\Delta \over { 1 + 1/2 \Delta} } \space = \space {1\over{\delta}} (\Delta - 1/2 \Delta^2 + 1/4 \Delta^3  - \space \ldots \space) $$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That looks like the bilinear transform. The actual reference is a little vague,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ &#xD;&#xA;^{6} \space Tustin, A. \space \space J. Inst. Elect. Engrs. \space&#xD;&#xA;94 \space (1947) \space 130. &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I'm pretty sure it corresponds to &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=5296805&quot;&gt;A method of analysing the behaviour of linear systems in terms of time series&lt;/a&gt;.  That paper has a pretty detailed exposition, and Tustin doesn't seem to cite any of his other works as references, so it's reasonable to assume that's where he first introduced it. What's really interesting is the notation he used, &#xA;$$&#xD;&#xA;{2\over{\delta}} { [1,-1] \over{ [1, 1] } }.&#xD;&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="35" LastEditDate="2011-10-11T23:13:22.453" LastActivityDate="2011-10-11T23:13:22.453" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="403" PostTypeId="1" CreationDate="2011-10-12T06:58:14.923" Score="2" ViewCount="965" Body="&lt;p&gt;Is it possible to read a JPEG file and skip parts that are corrupt?  I have three corrupt JPEG files and I can detect the first corrupt block, but can I skip it and continue with the next block?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can already stop and convert the blocks I've processed so far, but I would like to recover as much as I can.  This is not a JPEG in a sequence, so skipping all the remaining blocks wouldn't help.&lt;/p&gt;&#xA;" OwnerUserId="428" LastEditorUserId="8330" LastEditDate="2014-03-26T21:47:57.573" LastActivityDate="2021-04-06T20:18:47.333" Title="Skip corrupt part of jpeg" Tags="|image-processing|image-compression|jpeg|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="404" PostTypeId="2" ParentId="401" CreationDate="2011-10-12T09:32:29.137" Score="3" Body="&lt;p&gt;What size images are you operating on?  At what frame rate?  On what hardware?  FAST is pretty, erm, fast in my experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also seen FAST used as a ROI detector with goodFeaturesToTrack run on the ROIs identified to provide better stability without running the penalty of gFTT on the whole image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Corner_detection#The_Harris_.26_Stephens_.2F_Plessey_.2F_Shi-Tomasi_corner_detection_algorithm&quot; rel=&quot;nofollow&quot;&gt;&quot;Harris&quot; corner detector&lt;/a&gt; is also potentially very quick as it is made up of very simple operations (no sqrt() per pixel for example!) - not as stable as gFTT, but possibly more so than FAST.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In terms of GPU implementation, Googling &lt;code&gt;gpu corner&lt;/code&gt; seems to present quite a lot of links, but I have no idea how suitable they might be - I tend to implement in FPGA.)&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="29" LastEditDate="2011-10-12T14:41:06.133" LastActivityDate="2011-10-12T14:41:06.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="406" PostTypeId="2" ParentId="397" CreationDate="2011-10-12T14:27:54.407" Score="7" Body="&lt;p&gt;The term &quot;scale-invariant&quot; means the following here.&#xA;Let's say you have image &lt;em&gt;I&lt;/em&gt;, and you have detected a feature (aka an interest point) &lt;em&gt;f&lt;/em&gt; at some location &lt;em&gt;(x,y)&lt;/em&gt; and at some scale level &lt;em&gt;s&lt;/em&gt;.  Now let's say you have an image &lt;em&gt;I'&lt;/em&gt;, which is a scaled version of &lt;em&gt;I&lt;/em&gt; (downsampled, for instance).  Then, if your feature detector is scale-invariant, you should be able to detect the corresponding feature &lt;em&gt;f'&lt;/em&gt; in &lt;em&gt;I'&lt;/em&gt; at the corresponding location &lt;em&gt;(x',y')&lt;/em&gt; and corresponding scale &lt;em&gt;s'&lt;/em&gt;, where &lt;em&gt;(x, y, s)&lt;/em&gt; and &lt;em&gt;(x', y', s')&lt;/em&gt; are related by the appropriate scaling transformation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if your scale-invariant detector has detected a feature point corresponding to someone's face, and then you zoom in or out with your camera on the same scene, you should still detect a feature point on that face.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you would also want a &quot;feature descriptor&quot; which would allow you to match the two features, which is exactly what SIFT gives you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, at the risk of confusing you further, there are two things that are scale-invariant here.  One is the DoG interest point detector, which is scale-invariant, because it detects a particular type of image features (blobs) irrespective of their scale.  In other words, the DoG detector detects blobs of any size.  The other scale-invariant thing is the feature descriptor, which is a histogram of gradient orientation, which stays more or less similar for the same image feature despite a change in scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, the difference of Gaussians is used here as an approximation to the Laplacian-of-Gaussians filter.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2011-10-12T14:35:49.510" LastActivityDate="2011-10-12T14:35:49.510" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="407" PostTypeId="2" ParentId="403" CreationDate="2011-10-12T15:09:18.770" Score="9" Body="&lt;p&gt;This is a hard problem because the image data is encoded using variable length codes (VLC's).  This means that the starting bit of each DCT coefficient is dependent on all of the previous coefficients.  A single bit error will often produce a different code length for that coefficient and in turn throw off the alignment for the rest of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have written automated programs before to toggle bits around where the first corrupt block is and try to find where the errors might be.  Basically, it just toggles a bit, redecodes the image, and runs some kind of metric to determine if it helped or not.  This method may or may not work if there are multiple bit errors close together.  The key is that you don't necessarily need to fix all bit errors, just produce a VLC that is the right length to recover alignment.&lt;/p&gt;&#xA;" OwnerUserId="52" LastActivityDate="2011-10-12T15:09:18.770" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="408" PostTypeId="1" CreationDate="2011-10-12T17:22:14.400" Score="-4" ViewCount="642" Body="&lt;p&gt;In my project, the ADC is an 16-bit unipolar type, 0 - 3.3&amp;nbsp;V. This 16-bit data we are making as bipolar ($-1.65$ to $+1.65$ range), converting as &lt;a href=&quot;http://en.wikipedia.org/wiki/Q_%28number_format%29&quot; rel=&quot;nofollow&quot;&gt;Q15&lt;/a&gt; data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conversion is as follows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Q31_data = (q31_t) ((16bit_ADC_data- Offset) &amp;lt;&amp;lt;15) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here I am making it as a Q30 format, so I'll get Q30 (range is $-2$ to $+2$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We only have the Q format like Q31, Q15 and Q7 (the processor is a 32-bit ARM Cortex-M4), &#xA;FFT and FIR is a Q31 format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My input range is $-1.65$ to $+1.65$, and then I am doing the above scaling process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my input range is $-5$ to $+5$ that time I want to multiply with 3.03 (in hardware if the input is $-5$ to $5$ attenuate as $-1.65$ to $+1.65$ in software we are reconstruct to the $-5$ to $+5$ range).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then this data I want to process to FIR and FFT. For this case, I didn't get an idea for scaling. How I can muliply 3.3 with a Q31 value? How do I do this? Is it possible to do?&lt;/p&gt;&#xA;" OwnerUserId="217" LastEditorUserId="1473" LastEditDate="2012-07-01T17:30:23.447" LastActivityDate="2012-07-01T19:47:57.040" Title="How to do scaling in fixed format?" Tags="|discrete-signals|dsp-core|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="410" PostTypeId="1" AcceptedAnswerId="413" CreationDate="2011-10-13T00:27:47.000" Score="12" ViewCount="7214" Body="&lt;p&gt;I want to calculate the loudness of a given signal and I've come across &lt;a href=&quot;https://dsp.stackexchange.com/questions/290/getting-loudness-of-a-track-with-rms&quot;&gt;this thread&lt;/a&gt;. I'm slightly confused about the A-Weighting aspect of it. I can't post images, but I think &lt;a href=&quot;http://www.diracdelta.co.uk/science/source/a/w/aweighting/source.html&quot; rel=&quot;noreferrer&quot;&gt;this site&lt;/a&gt; has the formula I need. (Wa = 10log...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is how to actually use it in my program. If the &lt;code&gt;f&lt;/code&gt; stands for frequency, then presumably I can hardcode the values since they will remain constant. If that is the case, how do I apply &lt;code&gt;Wa&lt;/code&gt; to my sample values and what values do I use? Do I calculate the power spectrum to get &lt;code&gt;WINDOW_SIZE/2&lt;/code&gt; values and multiply each value in the frequency band with relevant precalculated &lt;code&gt;Wa&lt;/code&gt; value or is that the wrong way of doing it? Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="380" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2017-05-10T18:17:49.120" Title="Applying A-weighting" Tags="|algorithms|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="411" PostTypeId="1" AcceptedAnswerId="412" CreationDate="2011-10-13T00:33:30.110" Score="25" ViewCount="12692" Body="&lt;p&gt;I'm working on a simple web app that allows the user to tune his/her guitar. I'm a real beginner in signal processing, so please don't judge me too harshly if my question is inappropriate.&lt;/p&gt;&#xA;&lt;p&gt;So, I managed to get the fundamental frequency using an FFT algorithm and at this point the application is somehow functional. However, there is room for improvement. Right now, I send raw PCM to the FFT algorithm, but I was thinking that maybe there are some pre/post algorithms/filters that may improve the detection. Can you suggest any?&lt;/p&gt;&#xA;&lt;p&gt;My main problem is that when it detects a certain frequency, it shows that frequency for 1-2sec and then jumps to other random frequencies and comes back again and so on, even if the sound is continuous.&lt;/p&gt;&#xA;&lt;p&gt;I'm also interested in any other type of optimization if anyone has experience with such things.&lt;/p&gt;&#xA;" OwnerUserId="33" LastEditorUserId="50223" LastEditDate="2020-06-23T11:02:58.343" LastActivityDate="2020-06-23T11:02:58.343" Title="Tips for improving pitch detection" Tags="|fft|fourier-transform|audio|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="412" PostTypeId="2" ParentId="411" CreationDate="2011-10-13T02:42:29.923" Score="22" Body="&lt;p&gt;I'm guessing the other frequencies it gets are harmonics of the fundamental?  Like you're playing 100 Hz and it picks out 200 Hz or 300 Hz instead?  First, you should limit your search space to the frequencies that a guitar is likely to be.  Find the &lt;a href=&quot;http://en.wikipedia.org/wiki/Guitar_tunings#Higher_tunings&quot; rel=&quot;noreferrer&quot;&gt;highest fundamental you're likely to need&lt;/a&gt; and limit to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;noreferrer&quot;&gt;Autocorrelation&lt;/a&gt; will work better than FFT at finding the fundamental, if &lt;a href=&quot;http://flic.kr/p/7notw6&quot; rel=&quot;noreferrer&quot;&gt;the fundamental is lower in amplitude than the harmonics&lt;/a&gt; (or missing altogether, but that's not an issue with guitar):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eJvFQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also try weighting the lower frequencies to emphasize the fundamental and minimize harmonics, or use a &lt;a href=&quot;https://stackoverflow.com/q/1713335/125507&quot;&gt;peak-picking algorithm like this&lt;/a&gt; and then just choose the lowest in frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you should be windowing your signal before applying the FFT.  You just multiply it by a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;noreferrer&quot;&gt;window function&lt;/a&gt;, which tapers off the beginning and end of the waveform to make the frequency spectrum cleaner.  Then you get tall narrow spikes for frequency components instead of broad ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use interpolation to get a more accurate peak.  Take the log of the spectrum, then fit a parabola to the peak and the two neighboring points, and find the parabola's true peak.  You might not need this much accuracy, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is &lt;a href=&quot;https://gist.github.com/255291#L38&quot; rel=&quot;noreferrer&quot;&gt;my example Python code for all of this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2011-10-13T15:31:25.147" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="413" PostTypeId="2" ParentId="410" CreationDate="2011-10-13T02:51:20.947" Score="8" Body="&lt;p&gt;Yes, you could hardcode the values, do an FFT of your signal, and multiply by the hardcoded values, then &lt;a href=&quot;https://dsp.stackexchange.com/questions/346/rms-calculation-in-frequency-domain-after-windowing&quot;&gt;get the amplitude in the frequency domain&lt;/a&gt; from &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Parseval's theorem&lt;/a&gt; (&lt;a href=&quot;https://gist.github.com/1257010&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also implement a digital filter and do it in the time domain.  Here's &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/69&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab code&lt;/a&gt; and &lt;a href=&quot;https://gist.github.com/148112&quot; rel=&quot;nofollow noreferrer&quot;&gt;my translation to Python&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the bilinear transform causes the digital filter to roll-off more quickly than the analog filter, introducing measurement errors at common sample rates. A simple fix is to upsample the data first, so the discrepancy is minimized. Other filter design approaches here: &lt;a href=&quot;http://dsp.stackexchange.com/q/36077/29&quot;&gt;http://dsp.stackexchange.com/q/36077/29&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2017-05-10T18:17:49.120" LastActivityDate="2017-05-10T18:17:49.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="414" PostTypeId="1" AcceptedAnswerId="416" CreationDate="2011-10-13T06:15:10.487" Score="5" ViewCount="4317" Body="&lt;p&gt;We can use the narrowband spectrogram for finding the pitch of an utterance. But is it possible to find the pitch using the wideband spectrogram? If so, how would that be done? &lt;/p&gt;&#xA;" OwnerUserId="102" LastActivityDate="2011-10-13T14:38:15.430" Title="Finding pitch from a wideband spectrogram" Tags="|spectrogram|pitch|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="415" PostTypeId="2" ParentId="408" CreationDate="2011-10-13T10:17:11.343" Score="4" Body="&lt;p&gt;I think what you are asking is how to convert your samples (which are $16$ bit values) back to the original $+-5V$ range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd ask why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have numbers between $-32768$ and $32767$ which you know represent $-5V$ to $+5V$.  Just carry on, doing your processing as you require.  Keep track of the conversions &quot;in your head&quot; (in code comments if it gets complex).  The processor has no idea about the real world and just sees numbers: it's up to us to put meaning on the numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If at some point during the processing you need to convert some value back into a voltage, then (assuming you haven't scaled the signals any more during the processing), just perform a linear scaling to convert the numbers back to volts.  You'll get very close by multiplying the internal number by $5$ (take care to use a wide enough data type to not overflow) and then dividing by $32768$.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="1473" LastEditDate="2012-07-01T19:47:57.040" LastActivityDate="2012-07-01T19:47:57.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="416" PostTypeId="2" ParentId="414" CreationDate="2011-10-13T10:18:36.837" Score="6" Body="&lt;p&gt;If your window length is shorter than the pitch period of a voiced utterance, the spectrogram will not be able to capture the fundamental frequency. This is the problem, yes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But evidence of the fundamental frequency will still be available in the spectrogram because spoken voice has plenty of harmonic content. If you can identify the upper harmonics, showing up as horizontal stripes in the spectrogram, and find the size of the gap between them, this will be the fundamental pitch. Say your FFT resolution is very coarse under 200 hz, but you find a peak at 240 hz, 360 hz, and 480 hz. Well, this is a dead giveaway that the fundamental was 120 hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover: The glottal impulse (vocal folds slamming together) is like a broadband impulse. You will get periodic vertical stripes along the spectrogram if the pitch is low enough, and your FFT window short enough.  The time difference between these stripes is the pitch period of the voice, so this is another clue you can use to determine the pitch even when the fundamental is ambiguous.&lt;/p&gt;&#xA;" OwnerUserId="267" LastActivityDate="2011-10-13T10:18:36.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="417" PostTypeId="2" ParentId="411" CreationDate="2011-10-13T14:29:49.357" Score="12" Body="&lt;p&gt;Pitch is not the same as peak magnitude frequency bin of an FFT.  Pitch is a human psycho-acoustic phenomena.  The pitch sound could have a missing or very weak fundamental (common in some voice, piano and guitar sounds) and/or lots of powerful overtones in its spectrum that overwhelm the pitch frequency (but still be heard as that pitch note by a human).  So any FFT peak frequency detector (even including some windowing and interpolation) will not be a robust method of pitch estimation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://stackoverflow.com/questions/7181630/fft-on-iphone-to-ignore-background-noise-and-find-lower-pitches&quot;&gt;stackoverflow question&lt;/a&gt; includes a list of some alternate methods of estimating pitch that might produce better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDED: If you are doing this for guitar sounds, note that the lowest guitar strings may actually produce slightly inharmonic overtones, making pitch estimation even more difficult, as the human ear may hear a pitch frequency more closely related to sub-multiples of the overtones, rather than to the actual fundamental vibration frequency of the string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDED #2: This gets asked so often that I wrote up a longer blog post on the topic: &lt;a href=&quot;http://www.musingpaw.com/2012/04/musical-pitch-is-not-just-fft-frequency.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.musingpaw.com/2012/04/musical-pitch-is-not-just-fft-frequency.html&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2017-08-07T05:26:27.837" LastActivityDate="2017-08-07T05:26:27.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="418" PostTypeId="2" ParentId="414" CreationDate="2011-10-13T14:38:15.430" Score="0" Body="&lt;p&gt;Frequency is the derivative of phase.  Most spectrograms throw away phase, and just show spectral magnitudes.  Wide-band spectrograms throw away phase more often, and thus are more informationally lossy regarding frequency information, compared with narrowband (longer time window) spectrograms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One might be able to use non-local information (the overtone series or adjacents time points in the spectrogram) to infer more information about a particular frequency band, but this assumes the overtones are harmonically related and not inharmonic or accidental, or that the spectrum is stationary or predictable across time.  If not, these estimation methods can fail.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-13T14:38:15.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="419" PostTypeId="1" AcceptedAnswerId="421" CreationDate="2011-10-13T18:27:45.040" Score="18" ViewCount="4322" Body="&lt;p&gt;Disclaimer: I am in NO way engaged in signal processing.  Just very curious...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ny question is, very simply: is it possible to apply software processing to an image to remove or reduce headlight glare?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be a picture such as this:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/KuUU0.jpg&quot; alt=&quot;http://www.driversedguru.com/wp-content/gallery/jamie-gallery/Lots%20of%20Glare.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this IS possible, is there a software library available for this?  I don't care which language, I just want the capabilities.  Slash does anyone know if there is current research on this?&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2011-10-14T09:51:18.670" Title="Removing Glare from Image" Tags="|image-processing|software-implementation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="421" PostTypeId="2" ParentId="419" CreationDate="2011-10-14T09:51:18.670" Score="6" Body="&lt;p&gt;The problem you might have is that when bright lights are present, the camera will be using a fast shutter speed to keep the image from saturating too much.  All the detail you are interested in is in the bottom few bits of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So even if you remove the glare and then try and pull the rest of the image up in level, it's very noisy.  For example, if you take your image and play with the levels to pull up the darker sections and just allow the glare to clip, this is the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7rMAF.jpg&quot; alt=&quot;&amp;quot;Brighter&amp;quot; version&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's OK for onward processing (I don't know what you have in mind) then you could maybe remove the glare by looking at distributions of saturated pixels, and expand into the &quot;glow&quot; around them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better solution (if you have the option) can be to use a high-dynamic range camera which has an non-linear response in the pixels, and also often 10 or 12 bits per pixel of usable resolution, which means you can keep 7-8 bits for the darker sections.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2011-10-14T09:51:18.670" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="422" PostTypeId="1" AcceptedAnswerId="423" CreationDate="2011-10-14T15:16:21.357" Score="17" ViewCount="6798" Body="&lt;p&gt;I was wondering what good method(s) exist for the estimation (and subsequent compensation) of doppler shift for transmitted signals, be they acoustic or RF, in the context of comms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question: &lt;em&gt;Specifically, if the degree of doppler shift is varying over the duration of a packet, how best to estimate (track it?) and then compensate for it. Assume we have a trainer sequence. You may also assume the signal passband BW is on the order of its carrier. (e.g, if the passband signal exists from 2500-7500 Hz, its BW is 5000Hz, as is its carrier.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some additional background for context:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One method I found during my research:&lt;br&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Since I have a trainer sequence and know its frequency, first I estimate its received      frequency.     &lt;/li&gt;&#xA;&lt;li&gt;Next, I resample the entire packet by a ratio that is related to the speed of the wave in the medium, my known transmitted frequency, and my new estimated doppler shifted frequency.&lt;/li&gt;&#xA;&lt;li&gt;This works well in simulations, but the weak points are that the frequency estimation must be very accurate, and it also assumes the doppler shift is not changing during the duration of the packet. &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Are there any other methods that can be utilized to solve the problem when the doppler is changing during the duration of the packet? What is the opinion of the above aforementioned method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2017-01-28T16:28:47.657" Title="How to estimate and compensate for doppler shift in wireless signals?" Tags="|digital-communications|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="423" PostTypeId="2" ParentId="422" CreationDate="2011-10-14T16:42:24.793" Score="15" Body="&lt;p&gt;This is a very common communications problem. Look in a textbook for &quot;frequency synchronization&quot;; whole books have been written on these and related topics. The technique that you would choose is a function of the specifics of your system. There are two common sources of frequency offset:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Differences in frequency between the reference oscillator at the transmitter and receiver.&lt;/strong&gt; This error is usually small, depending upon the precision of the timebases available, and can be mitigated at some cost. Cheap crystal oscillators typically achieve 50 parts per million of error or better (although this does drift as the crystal ages). If you have a larger budget, you can use something like a Rubidium standard, which provides ~1 part per trillion of frequency error. A cheaper and increasingly common approach is to use a GPS receiver that has precision frequency output (typically 10 MHz). The highly accurate timebase available from the GPS constellation can be used to train the reference precisely on-frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Physical dynamics effects between the transmitter and receiver.&lt;/strong&gt; One notable example in which this comes into play are for satellite communications applications (especially in lower orbits), where the satellite is moving (and accelerating) very rapidly relative to any observer on the Earth. The high radial velocity of the satellite toward the receiver will cause a Doppler shift, and any change in that velocity caused by its orbit will cause that shift to change over time. In applications where you have these sort of dynamics, you typically can't mitigate it much, so you're left with building a receiver that tolerates the effects.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So how does a receiver synchronize with the transmitter in these cases? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;One common approach useful for phase- or frequency-modulated signals is to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/PLL&quot;&gt;phase-locked loop&lt;/a&gt;. Design of PLLs is a complex topic in itself, but in essence, they are feedback systems can be used to acquire and track phase and frequency offset while your receiver is in operation. If you only need frequency synchronization, then you can use a frequency-locked loop instead; while they will not provide phase synchronization for you, they often have better acquisition properties.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As an alternative to a feedback loop, there are also &lt;em&gt;feedforward&lt;/em&gt; approaches to estimating frequency or phase offset. One feedforward approach would take advantage of your training sequence to estimate the frequency error based on how the phase offset changes over the course of the sequence. If the frequency offset changes as time goes on, however, you would need to repeat the estimation procedure to allow your receiver to catch up.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another technique is to design your system to be robust to (reasonably small) frequency offsets. Differentially-encoded phase modulation is an example of this (although frequency error will show up as a phase offset after differential decoding, which must be handled). Frequency-modulated waveforms such as FSK also have some level of resistance to frequency offset, as long as the offset is small relative to the amount of frequency deviation used by the transmitter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This very short summary really just scratches the surface of some of the more well-known approaches. Synchronization can be a difficult problem to solve in practical ways, and there has been much research over the years on different ways to do it. It's going to depend upon exactly how your system is structured, and one very important variable: the target SNR. There isn't a single &quot;correct&quot; answer. I will make one textbook recommendation; while it is very expensive, &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0306457253&quot;&gt;&quot;Synchronization Techniques for Digital Receivers&quot; by Mengali&lt;/a&gt; is a comprehensive text on timing, phase, and frequency synchronization.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-10-14T17:02:34.417" LastActivityDate="2011-10-14T17:02:34.417" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="424" PostTypeId="1" AcceptedAnswerId="425" CreationDate="2011-10-14T19:07:44.707" Score="39" ViewCount="55190" Body="&lt;p&gt;I've heard that the Hilbert transform can be used to calculate the envelope of a signal.  How does this work? And how is this &quot;Hilbert envelope&quot; different from the envelope one gets by simply rectifying a signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested specifically in finding a way to calculate an envelope for use in dynamic range compression (i.e., &quot;turning down the volume&quot; of the loud parts of an audio signal automatically).&lt;/p&gt;&#xA;" OwnerUserId="255" LastActivityDate="2016-03-10T20:25:29.330" Title="Hilbert transform to compute signal envelope?" Tags="|audio|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="425" PostTypeId="2" ParentId="424" CreationDate="2011-10-14T20:03:29.943" Score="25" Body="&lt;p&gt;The Hilbert transform is used to calculate the &quot;analytic&quot; signal. See for example &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Analytic_signal&lt;/a&gt;. If your signal is a sine wave or an modulated sine wave, the magnitude of the analytic signal will indeed look like the envelope. However, the computation of the Hilbert transform is not trivial. Technically it requires a non-causal FIR filter of considerable length so it will require a fair amount of MIPS, memory and latency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a broad band signal, it really depends on how you define &quot;envelope&quot; for your specific application. For your application of dynamic range compression you want a metric that is well correlated with the the perception of loudness over time. The Hilbert Transform is not the right tool for that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better option would be to apply an A-weighted filter (&lt;a href=&quot;http://en.wikipedia.org/wiki/A-weighting&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/A-weighting&lt;/a&gt;) and then do a lossy peak or lossy RMS detector. This will correlate fairly well with perceived loudness over time and is relatively cheap to do.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="745" LastEditDate="2016-03-10T20:25:29.330" LastActivityDate="2016-03-10T20:25:29.330" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="426" PostTypeId="2" ParentId="424" CreationDate="2011-10-14T23:47:37.093" Score="8" Body="&lt;p&gt;You can use the Hilbert transform to compute an envelope in the following way. (I will write it as MATLAB code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;envelope = abs(hilbert(yourTimeDomainSignal));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do not have time to write the math out right now, (I will try later on), but very simply, say your signal is a sine wave. The Hilbert transform of a sine is a -cosine. (In other words, the hilbert transform will always give you your signal shifted by -90 degrees phase - its quadrature in other words). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you add your signal (the sine wave) to &lt;code&gt;j&lt;/code&gt; times your hilberted signal, (-cosine wave), you get: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sin(wt) - j.*cos(wt)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which also happens to be e^(j*(wt - pi/2)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, when you take the absolute value of this, you get 1, which is your envelope. (For this case).&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2011-10-15T03:56:33.613" LastActivityDate="2011-10-15T03:56:33.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="427" PostTypeId="1" AcceptedAnswerId="428" CreationDate="2011-10-15T04:50:26.053" Score="54" ViewCount="39928" Body="&lt;p&gt;What are some recommended resources (books, tutorials, lectures, etc.) on digital signal processing, and how to begin working with it on a technical level?&lt;/p&gt;&#xA;" OwnerUserId="439" LastEditorUserId="128" LastEditDate="2018-06-02T10:12:16.720" LastActivityDate="2022-03-27T13:33:49.217" Title="What Resources Are Recommended for an Introduction to Signal Processing (DSP)?" Tags="|reference-request|self-study|soft-question|" AnswerCount="16" CommentCount="0" CommunityOwnedDate="2011-10-15T05:39:00.217" ContentLicense="CC BY-SA 4.0" />
  <row Id="428" PostTypeId="2" ParentId="427" CreationDate="2011-10-15T08:10:29.280" Score="37" Body="&lt;p&gt;My recommendation in terms of text books is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0137027419&quot;&gt;Rick Lyons's &lt;em&gt;Understanding DSP&lt;/em&gt;&lt;/a&gt;.  &lt;a href=&quot;http://www.amazon.com/review/R2NNCPTJJPIL06/ref=cm_cr_pr_perm?ie=UTF8&amp;amp;ASIN=0137027419&amp;amp;nodeID=&amp;amp;tag=&amp;amp;linkCode=&quot;&gt;My review of the latest edition is here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I, and many others from the ${\tt comp.dsp}$ community and elsewhere, have helped Rick revise parts of the text since the first edition.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For self-study, I know of no better book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an on-line, free resource, &lt;a href=&quot;http://www.dspguide.com/&quot;&gt;I recommend Steve Smith's book&lt;/a&gt;.  Personally, I prefer Rick's style, but Steve's book as the advantage of online accessibility (and the online version is free!).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rick sent me some feedback that I thought I'd share here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For your colleagues that have a copy of my DSP book,&#xA;I'll be happy to send them the errata for my book.  All they have &#xA;to do is send me an E-mail telling me (1) The Edition Number, &#xA;and (2) the Printing Number of their copy of the book.  The Printing &#xA;Number can be found on the page just before the 'Dedication' page.&#xA;My E-mail address is:&#xA;R.Lyons [at] ieee.org&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I recommend that your colleagues have a look at:&#xA;&lt;a href=&quot;http://www.redcedar.com/learndsp.htm&quot;&gt;http://www.redcedar.com/learndsp.htm&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rick also gave me a long list of online DSP references.  There are way too many to put here. I will see about setting up a GoogleDocs version and re-post here later.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2012-06-22T12:24:23.473" LastActivityDate="2012-06-22T12:24:23.473" CommentCount="11" CommunityOwnedDate="2011-10-15T08:10:29.280" ContentLicense="CC BY-SA 3.0" />
  <row Id="429" PostTypeId="2" ParentId="427" CreationDate="2011-10-15T08:22:11.383" Score="19" Body="&lt;p&gt;Paul Falstad's Java applets are a fantastic way to interact with systems and learn them intuitively. The &lt;strong&gt;&lt;a href=&quot;http://www.falstad.com/dfilter/&quot;&gt;Digital Filter&lt;/a&gt; applet&lt;/strong&gt; is a revelation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out the rest at &lt;a href=&quot;http://www.falstad.com/mathphysics.html&quot;&gt;http://www.falstad.com/mathphysics.html&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more informal introduction, I like &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0805316841&quot;&gt;A Digital Signal Processing Primer&lt;/a&gt; by Ken Steiglitz, which is exactly what it says it is.  I TAed a class using this text and really liked the style. It's well written, and makes the material pretty interesting. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A DSP Primer is written for a broad audience including:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Students of DSP in Engineering and Computer Science courses.&lt;/li&gt;&#xA;  &lt;li&gt;Composers of computer music and those who work with digital sound.&lt;/li&gt;&#xA;  &lt;li&gt;WWW and Internet developers who work with multimedia.&lt;/li&gt;&#xA;  &lt;li&gt;General readers interested in science that want an introduction to DSP.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;Features:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Offers a simple and uncluttered step-by-step approach to DSP for first-time users, especially beginners in computer music.&lt;/li&gt;&#xA;  &lt;li&gt;Designed to provide a working knowledge and understanding of frequency domain methods, including FFT and digital filtering.&lt;/li&gt;&#xA;  &lt;li&gt;Contains thought-provoking questions and suggested experiments that help the reader to understand and apply DSP theory and techniques.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="267" LastEditorUserId="267" LastEditDate="2011-10-28T06:32:48.180" LastActivityDate="2011-10-28T06:32:48.180" CommentCount="1" CommunityOwnedDate="2011-10-15T08:22:11.383" ContentLicense="CC BY-SA 3.0" />
  <row Id="430" PostTypeId="2" ParentId="427" CreationDate="2011-10-15T08:58:22.980" Score="18" Body="&lt;p&gt;The below three are the best referred Text books on this subject.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Discrete-Time Signal Processing&lt;/em&gt;,&#xA;Prentice-Hall Signal Processing Series&#xA;by Alan V. Oppenheim, Ronald W. Schafer, John R. Buck.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Digital Signal Processing: Principles, Algorithms and Applications&lt;/em&gt;,&#xA;Prentice Hall &#xA;John G. Proakis, Dimitris K Manolakis&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Signals and Systems&lt;/em&gt;,&#xA;Prentice Hall&#xA;Alan V. Oppenheim, Alan S. Willsky, with S. Hamid&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you need to pick one of them, pick - &lt;em&gt;Discrete-Time Signal Processing Prentice-Hall Signal Processing Series by Alan V. Oppenheim, Ronald W. Schafer, John R. Buck&lt;/em&gt;. Of course, as listed in &lt;a href=&quot;https://dsp.stackexchange.com/questions/427/what-resources-are-recommended-for-an-introduction-to-dsp/433#433&quot;&gt;Hossein's answer&lt;/a&gt; Sanjit Mitra might just be easy for beginner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further books with their individual strengths:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Digital Processing of Signals&lt;/em&gt;, Wiley &amp;amp; Sons by M. Bellanger.  &lt;em&gt;Nice intro to filters, very cheap used.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;A Foundation in Digital Communications&lt;/em&gt;, Cambridge University Press by Amos Lapidoth.  *A really smooth and clean intro to signal theory. Available for free &lt;a href=&quot;http://www.afidc.ethz.ch/A_Foundation_in_Digital_Communication/Home.html&quot; rel=&quot;noreferrer&quot;&gt;online&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;A statistical Theory of Mobile-Radio Reception&lt;/em&gt;, The Bell System Technical Journal (BSTJ), July-Aug 1968. &lt;em&gt;Ever wondered how to model random channels and what they do to signals? Great classical paper, available &lt;a href=&quot;http://faculty.poly.edu/~tsr/EL5013_fall12/docs/bstj47-6-957.pdf&quot; rel=&quot;noreferrer&quot;&gt;online&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2017-04-06T11:58:55.077" CommentCount="2" CommunityOwnedDate="2011-10-15T08:58:22.980" ContentLicense="CC BY-SA 3.0" />
  <row Id="431" PostTypeId="1" AcceptedAnswerId="465" CreationDate="2011-10-15T19:41:15.793" Score="118" ViewCount="101556" Body="&lt;p&gt;This has been one of the holes in my cheddar cheese block of understanding DSP, so what is the physical interpretation of having a negative frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a physical tone at some frequency and it is DFT'd, you get a result in both the positive and negative frequencies - why and how does this occur? What does it mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Oct 18th 2011. I have provided my own answer, but expanded the question to include the roots of why negative frequencies MUST exist. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="50076" LastEditDate="2023-05-27T13:59:34.730" LastActivityDate="2023-06-16T03:30:43.117" Title="What is the physical significance of negative frequencies?" Tags="|fourier-transform|frequency|" AnswerCount="12" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="432" PostTypeId="1" AcceptedAnswerId="438" CreationDate="2011-10-15T19:56:07.090" Score="8" ViewCount="8013" Body="&lt;p&gt;I am confused by the dual concepts of time-resolution and bandwidth. Often I will hear that a pulse-compressed radar application 'doesnt have enough BW' for some specific time resolution that is sought. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isnt the maximum time resolution simply the reciprocal of your sampling rate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are those concepts related?&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="90" LastEditDate="2011-10-19T13:48:21.893" LastActivityDate="2011-11-08T18:29:31.390" Title="How are time resolution and signal bandwidth  related?" Tags="|resolution|bandwidth|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="433" PostTypeId="2" ParentId="427" CreationDate="2011-10-15T22:14:19.937" Score="10" Body="&lt;p&gt;For theoretical studies, Oppenheim is the god but if you're going to use it in practice, Mitra is one of the best: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Digital Signal Processing: A Computer-Based Approach, Sanjit K. Mitra&lt;/p&gt;&#xA;" OwnerUserId="290" LastActivityDate="2011-10-15T22:14:19.937" CommentCount="1" CommunityOwnedDate="2011-10-15T22:14:19.937" ContentLicense="CC BY-SA 3.0" />
  <row Id="434" PostTypeId="2" ParentId="431" CreationDate="2011-10-15T22:58:17.760" Score="6" Body="&lt;p&gt;You should study the Fourier transform or series to understand the negative frequency. Indeed Fourier showed that we can show all of waves using some sinusoids. Each sinusoid can be shown with two peaks at the frequency of this wave one in positive side and one in negative. So the theoretical reason is clear. But for the physical reason, I always see that people say negative frequency has just mathematical meaning. But I guess a physical interpretation that I'm not pretty sure; When you study the circular motion as the principal of discussions about the waves, the direction of speed of the movement on the half-circle is inverse of the another half. This can be the reason why we have two peaks in both sides of the frequency domain for each sine wave. &lt;/p&gt;&#xA;" OwnerUserId="290" LastActivityDate="2011-10-15T22:58:17.760" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="435" PostTypeId="2" ParentId="431" CreationDate="2011-10-15T23:26:54.630" Score="52" Body="&lt;p&gt;Let's say you had a spinning wheel. How would you describe how fast it is spinning? You'd probably say it's spinning at &lt;code&gt;X&lt;/code&gt; revolutions per minute (rpm). Now how do you convey in what &lt;em&gt;direction&lt;/em&gt; it's spinning with this number? It's the same &lt;code&gt;X&lt;/code&gt; rpm if it's spinning clockwise or anti-clockwise. So you scratch your head and say oh well, here's a smart idea: I'll use the convention of &lt;code&gt;+X&lt;/code&gt; to indicate that it's spinning clockwise and &lt;code&gt;-X&lt;/code&gt; for anti-clockwise. Voila! You've invented negative rpms!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Negative frequency is no different from the above simple example. A simple mathematical explanation of how the negative frequency pops up can be seen from the Fourier transforms of pure tone sinusoids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the Fourier transform pair of a complex sinusoid: $e^{\jmath \omega_0 t}\longleftrightarrow \delta(\omega+\omega_0)$ (ignoring constant multiplier terms). For a pure sinusoid (real), we have from Euler's relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos(\omega_0 t)=\frac{e^{\jmath \omega_0t}+e^{-\jmath \omega_0 t}}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and hence, its Fourier transform pair (again, ignoring constant multipliers):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos(\omega_0 t)\longleftrightarrow \delta(\omega+\omega_0) + \delta(\omega-\omega_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that it has two frequencies: a positive one at $\omega_0$ and a negative one at $-\omega_0$ by definition! The complex sinusoid of $ae^{\jmath \omega_0 t}$ is widely used because it is incredibly useful in simplifying our mathematical calculations. However, it has only one frequency and a real sinusoid actually has two. &lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-10-15T23:26:54.630" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="438" PostTypeId="2" ParentId="432" CreationDate="2011-10-16T04:28:55.280" Score="6" Body="&lt;p&gt;Dilip's points in his answer are correct. Speaking more to the context that you referenced of &lt;a href=&quot;http://en.wikipedia.org/wiki/Pulse_compression&quot; rel=&quot;noreferrer&quot;&gt;pulse-compression&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Radar&quot; rel=&quot;noreferrer&quot;&gt;radar&lt;/a&gt;, I think you're getting confused by differing meanings of the oft-used word &quot;resolution.&quot; In a broad signal processing sense, your time resolution is defined to some extent by your sample rate. But in the specific problem domain of building a radar receiver, you are concerned with being able to identify multiple echoes from distant objects and precisely observe their arrival time. &quot;Resolution&quot; in this context refers to resolving and separating multiple received echoes so that they can be processed independently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical radar receiver uses a sliding cross-correlator to locate echoes from objects that have reflected the transmitted radar signal. The receiver knows the format of the transmitted pulse, so cross-correlation between the RF receiver's output and the transmitted pulse waveform is the optimum scheme for detecting the presence of reflected pulses in &lt;a href=&quot;http://en.wikipedia.org/wiki/AWGN&quot; rel=&quot;noreferrer&quot;&gt;AWGN&lt;/a&gt;. The correlator output will contain copies of the transmitted pulse waveform's autocorrelation function (which typically has a &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;noreferrer&quot;&gt;sinc&lt;/a&gt;-like shape) for each received echo, shifted in time based on the range to the target that caused the reflection. In order to discriminate between the targets, their corresponding lobes at the correlator output must be sufficiently separated in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &quot;high-resolution&quot; radar is able to finely discriminate between multiple targets in the range dimension. If your radar has multiple targets at approximately the same range, then their echoes will reach the receiver at nearly the same time. Therefore, their autocorrelation lobes will appear at the output of the correlator at nearly the same time. The ability of the radar to discriminate between the echoes depends upon the time duration of the waveform's autocorrelation lobes; a narrower autocorrelation function (ideally one that looks like an impulse) is better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This long-winded introduction brings us to the idea of pulse compression. Pulse-compression radar waveforms are typically implemented using linear frequency modulation (also known as &quot;chirping&quot;); instead of transmitting a constant-frequency pulse, the transmitted frequency is swept linearly over the course of the pulse. In practice, the sweep can be done over tens or even hundreds of MHz of spectrum. What's the benefit? &lt;a href=&quot;http://en.wikipedia.org/wiki/Pulse_compression#Cross-correlation_between_the_transmitted_and_the_received_signal&quot; rel=&quot;noreferrer&quot;&gt;An autocorrelation function with nice properties:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;&amp;lt;s_{c&amp;#39;}, s_{c&amp;#39;}&amp;gt;(t) = T \Lambda \left(\frac{t}{T} \right) \mathrm{sinc} \left[ \pi \Delta f t \Lambda \left( \frac{t}{T}\right) \right] e^{2 i \pi f_0 t}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation above is borrowed from the Wikipedia article; I'll defer the full explanation to that source. What's important here is the $\Delta f$ term; it refers to the amount of frequency covered by the linear frequency chirp. Since $\Delta f$ is a factor in the argument of the $\mathrm{sinc}$ function, it can easily be seen that by chirping over a larger bandwidth, the main lobe of the pulse's autocorrelation function will be narrower. Narrower lobes are more easily discriminated by the radar receiver, giving such a radar high &quot;resolution&quot; in terms of differentiating between similarly-ranged targets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to wrap up a bit, this sort of finding should make sense. Recall that a &lt;a href=&quot;http://en.wikipedia.org/wiki/Wide_sense_stationary&quot; rel=&quot;noreferrer&quot;&gt;wide-sense stationary&lt;/a&gt; signal's &lt;a href=&quot;http://en.wikipedia.org/wiki/Power_spectral_density&quot; rel=&quot;noreferrer&quot;&gt;power spectral density&lt;/a&gt; can be defined as the Fourier transform of its autocorrelation function. The ideal autocorrelation function for a radar pulse would be an impulse; separating a bunch of echoes with &quot;zero&quot; width is easier than separating a bunch of more broad lobes. The Fourier transform of an impulse has infinite frequency extent. Qualitatively, it follows that autocorrelation functions with very short time extent would be comparatively wideband in the frequency domain. This is the basis for the oft-used rule of thumb in detection and estimation theory that you need a high-bandwidth signal in order to make high-resolution time-of-arrival measurements.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-10-16T04:36:04.700" LastActivityDate="2011-10-16T04:36:04.700" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="439" PostTypeId="1" CreationDate="2011-10-16T05:11:44.183" Score="10" ViewCount="6975" Body="&lt;p&gt;When we apply the DFT operation on a real signal $x[n]$ to get $X[k]$, &#xA;then take the square magnitude of the $X[k]$, $\lvert X[k]\rvert^2$, the power spectrum is symmetrical. &#xA;You can take the positive frequencies or negative frequencies as the frequency information in $X[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However this is not true for complex valued signals; the power spectrum is not symmetrical. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In this case, how would you determine the frequency components in original signal?&lt;/li&gt;&#xA;&lt;li&gt;Can we just drop the negative frequency part?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="442" LastEditorUserId="1629" LastEditDate="2016-09-09T18:49:36.933" LastActivityDate="2018-01-22T03:52:18.350" Title="How do you handle negative frequencies in the power spectrum of a complex signal?" Tags="|fft|frequency-spectrum|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="440" PostTypeId="2" ParentId="432" CreationDate="2011-10-16T07:14:38.570" Score="4" Body="&lt;p&gt;You don't have usually have a resolution of 1/Fs, because you don't know if it's your signal or not from a single sample.  How long does it take to determine that it's your 100 MHz signal and not somebody else's 101 MHz signal?  Longer than knowing it's your 100 MHz signal and not somebody else's 110 MHz signal.  The closer the enemy signal to be excluded (thus the narrower the bandwidth allowed for your signal), the longer it takes to differentiate friend or foe, which leads to a worse time resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you could tell from one sample, that implies you're accepting an infinite bandwidth, which is just one corner case of the time-bandwidth dual.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-16T07:14:38.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="441" PostTypeId="2" ParentId="431" CreationDate="2011-10-16T07:30:30.213" Score="5" Body="&lt;p&gt;What is the meaning of negative distance?  One possibility is that it's for continuity, so you don't have to flip planet Earth upside down every time you walk across the equator, and want to plot your position North with a continuous 1st derivative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same with frequency, when one might do such things as FM modulation with a modulation wider than the carrier frequency.   How would you plot that?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-16T07:30:30.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="442" PostTypeId="2" ParentId="439" CreationDate="2011-10-16T14:28:12.980" Score="0" Body="&lt;p&gt;In case of real we can drop e.g in practice when you use the spectrum analyzer, for real wave it is simpler to see the half because the other side is mirror. But in case of complex signal no real device answers and you have a theoretical studies so you should keep both sides.&lt;/p&gt;&#xA;" OwnerUserId="290" LastActivityDate="2011-10-16T14:28:12.980" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="445" PostTypeId="2" ParentId="439" CreationDate="2011-10-17T00:50:31.257" Score="8" Body="&lt;p&gt;For a real signal, content at the negative frequencies generated by using the DFT is redundant. This is due to the well-known property of real signals with respect to the Fourier transform family: their transforms are &lt;a href=&quot;http://en.wikipedia.org/wiki/Hermitian_symmetry&quot;&gt;Hermitian symmetric&lt;/a&gt;. That is, for any real signal $x[n]$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;X[k] = \sum_{n=0}^{N-1}x[n] e^{-j2\pi n k / N} = (\sum_{n=0}^{N-1}x[n] e^{-j(-2\pi n k / N)})^* = X[-k] = X[N - k]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if your input is a real signal, all of the information is in the positive frequency bins; the negative frequencies can be discarded for many applications. However, there is no such proprety for general complex signals. They can have power spectra that are asymmetric about zero frequency, so you may not discard any of the frequency bins of a complex signal's power spectrum without loss of information.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-10-17T14:02:16.313" LastActivityDate="2011-10-17T14:02:16.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="447" PostTypeId="2" ParentId="431" CreationDate="2011-10-17T10:06:40.140" Score="20" Body="&lt;p&gt;Currently, my viewpoint (it is subject to change) is the following &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sinusoidal repetition only positive frequencies makes sense. The physical interpretation is clear.&#xA;For complex exponential repetition both positive and negative frequencies makes sense. It may be possible to attach a physical interpretation to negative frequency. That physical interpretation of negative frequency has to do with direction of repetition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of frequency as provided on wiki is: &quot;Frequency is the number of occurrences of a repeating event per unit time&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If sticking to this definition negative frequency does not make sense and therefore has no physical interpretation. However, this definition of frequency is not thorough for complex exponential repetition which can also have direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Negative frequencies are used all the time when doing signal or system analysis. The fundamental reason for this being the Euler formula $$e^{j\omega n} = \cos( \omega n) + j\, \sin(\omega n)$$ and the fact that complex exponentials are eigenfunctions of LTI systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sinusoidal repetition is normally of interest and the complex exponential repetition is often used to obtain the sinusoidal repetition indirectly. That the two are related can be easily seen by considering the Fourier representation written using complex exponentials e.g.&#xA;$$ x[n]= \frac{1}{2\pi} \int_{-\pi}^{\pi}\!\!\!d\omega  \;\;\;\;X(e^{j\omega}) e^{j\omega n}  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \frac{1}{2\pi} \int_{0}^{\pi}\!\!d\omega  \;\;[a(\omega) \cos(\omega n) + b(\omega) \sin(\omega n)] = \frac{1}{2\pi} \int_{0}^{\pi}\!\!d\omega  \;\; \alpha(\omega) \sin(\omega n + \phi(\omega))] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of considering a positive 'sinusoidal frequency axis', a negative and positive 'complex exponential frequency axis' is considered.&#xA;On the 'complex exponential frequency axis', for real signals, it is well known that the negative frequency part is redundant and only the positive 'complex exponential frequency axis' is considered. In making this step implicitly we know that the frequency axis represents complex exponential repetition and not sinusoidal repetition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complex exponential repetition is a circular rotation in the complex plane. In order to create a sinusoidal repetition it takes two complex exponential repetitions, one repetition clock-wise and one repetition counter clock-wise. &#xA;If a physical device is constructed that produces a sinusoidal repetition inspired by how the sinusoidal repetition is created in the complex plane, that is, by two physically rotating devices that rotates in opposite directions, one of the rotating devices can be said to have a negative frequency and thereby the negative frequency has a physical interpretation.&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="29" LastEditDate="2016-03-02T14:52:25.237" LastActivityDate="2016-03-02T14:52:25.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="449" PostTypeId="2" ParentId="431" CreationDate="2011-10-17T14:47:54.773" Score="151" Body="&lt;p&gt;Negative frequency doesn't make much sense for sinusoids, but the Fourier transform doesn't break up a signal into sinusoids, it breaks it up into &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;noreferrer&quot;&gt;complex exponentials&lt;/a&gt; (also called &quot;complex sinusoids&quot; or &quot;&lt;a href=&quot;https://en.wiktionary.org/wiki/cisoid&quot; rel=&quot;noreferrer&quot;&gt;cisoid&lt;/a&gt;s&quot;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega) = \int_{-\infty}^{\infty} f(t) \color{Red}{e^{- j\omega t}}\,dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are actually spirals, spinning around in the complex plane:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eCpbp.gif&quot; alt=&quot;complex exponential showing time and real and imaginary axes&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://www.researchgate.net/publication/261779218_Understanding_Digital_Signal_Processing&amp;#39;s_Frequency_Domain&quot; rel=&quot;noreferrer&quot;&gt;Source: Richard Lyons&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spirals can be either left-handed or right-handed (rotating clockwise or counterclockwise), which is where the concept of negative frequency comes from.  You can also think of it as the phase angle going forward or backward in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of real signals, there are always &lt;em&gt;two&lt;/em&gt; equal-amplitude complex exponentials, rotating in opposite directions, so that their real parts combine and imaginary parts cancel out, leaving only a real sinusoid as the result.  This is why the spectrum of a sine wave always has 2 spikes, one positive frequency and one negative.  Depending on the phase of the two spirals, they could cancel out, leaving a purely real sine wave, or a real cosine wave, or a purely imaginary sine wave, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The negative and positive frequency components &lt;em&gt;are&lt;/em&gt; both necessary to produce the real signal, but if you already know that it's a real signal, the other side of the spectrum doesn't provide any extra information, so it's often hand-waved and ignored.  For the general case of complex signals, you need to know both sides of the frequency spectrum.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2018-07-06T18:51:06.907" LastActivityDate="2018-07-06T18:51:06.907" CommentCount="15" ContentLicense="CC BY-SA 4.0" />
  <row Id="450" PostTypeId="1" CreationDate="2011-10-15T20:27:33.117" Score="6" ViewCount="3214" Body="&lt;p&gt;I have an audio spectrum (FFT) that looks like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;101761.00 :                                 *                                                                                                                    &#xA; 76309.98 :                                                                                                                                                      &#xA; 57224.41 :                                                                                                                                                      &#xA; 42912.26 :       *     *                     *                                                                                                                  &#xA; 32179.65 :       *                                 *                                                                                                            &#xA; 24131.34 :                *      *       *                                                                                                                      &#xA; 18095.95 :                                                                                                                                                      &#xA; 13570.05 :          *             *     *                                                                                                                       &#xA; 10176.10 :                 *                *  *                                                                                                                &#xA;  7631.00 :                                  *  *                                                                                                                &#xA;  5722.44 :                           *     *       *                                                                                                            &#xA;  4291.23 :        *     * **               *  ** *                                                                                                              &#xA;  3217.97 :        *                       *              *                                                                                                      &#xA;  2413.13 :         *            *                   *                                                                                                           &#xA;  1809.59 :    * *    *               *               *    *                                                    *                                                &#xA;  1357.00 :                  ***    **             *       *                                                                                                     &#xA;  1017.61 :                       *     **        *                                            *        *        **                                              &#xA;   763.10 :        * * * **          *                                                                     *     **                                              &#xA;   572.24 :               *   * *   *                  *      **     *    *             *                                                                        &#xA;   429.12 :     *              *       *         *             *    *                                             *                                              &#xA;   321.80 :   *                         *              *                                                      *                                                  &#xA;   241.31 :                                *  *     *    **       * *               *                  *             *                                           &#xA;   180.96 :   *  *    *   *            * *       *                            *   *     **           *      * * *                                                &#xA;   135.70 :           **                                *             * *                *             *   *        *                                            &#xA;   101.76 :  * *                                        *     *  * *  *   *  *                       *       * *    *   *                                        &#xA;    76.31 :                  *                                                         *                 *         *                                             &#xA;    57.22 :  *                                 *   *                 *                             *   *                                                         &#xA;    42.91 :                                              *   *     *   ***       ** *     *               *            *    *                                    &#xA;    32.18 : *                                                * *         **  *       **     **           *         *  *    **   *     *                          &#xA;    24.13 :                                                                                                                                                      &#xA;    18.10 : *                   **        *                            *   ***   *              *****      *          *   *    *  ***                  *       * &#xA;    13.57 :                                                                                                                                                      &#xA;    10.18 :     *                * *                        *   ***                *        *   ** **        **          **  *   *      *    * * **   *     *    &#xA;     7.63 :                                                                                                                                                      &#xA;     5.72 :                                                                                                                                                      &#xA;     4.29 :             *     *                       *           *   *         *    ***  *** **      *   * *          *   *          ** **     *        *  **** &#xA;     3.22 :                                                                                                                                                      &#xA;     2.41 :                                                                                                                                                      &#xA;     1.81 :                                                                                                                                                      &#xA;     1.36 :    *                                     *      *   *          ** **** *    *  * **   *     *            *  **   ********* ****************** ** ** **&#xA;========= : ======================================================================================================================================================&#xA;          :  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2&#xA;          :  0 0 0 1 1 1 2 2 2 3 3 3 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 6 6 6 7 7 7 8 8 8 9 9 9 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5&#xA;          :  1 5 8 2 5 8 2 5 9 2 6 9 3 6 0 3 6 0 3 7 0 4 7 1 4 7 1 4 8 1 5 8 2 5 8 2 5 9 2 6 9 3 6 9 3 6 0 3 7 0 4 7 0 4 7 1 4 8 1 5 8 1 5 8 2 5 9 2 6 9 2 6 9 3 6&#xA;          :  7 2 6 1 5 9 4 8 3 7 2 6 1 5 0 4 8 3 7 2 6 1 5 0 4 9 3 7 2 6 1 5 0 4 9 3 8 2 6 1 5 0 4 9 3 8 2 7 1 5 0 4 9 3 8 2 7 1 6 0 4 9 3 8 2 7 1 6 0 4 9 3 8 2 7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Basically, there's a broad peak near 500Hz, and a narrower peak around 1750Hz.  And clearly there's a lot of noise in the data.  (This is a snore, for those who are interested.)&lt;/p&gt;&#xA;&lt;p&gt;A different person has a similar frequency distribution, only the peaks may be scaled up/down (based, presumably, on the resonant frequencies of the throat and mouth).&lt;/p&gt;&#xA;&lt;p&gt;How would one distinguish that from a different sound that is more random in distribution?  For instance, a choking sound looks about like this in one instance:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;339889.00 :                                **                                                                                                                    &#xA;254880.80 :                                                                                                                                                      &#xA;191133.62 :                                                                                                                                                      &#xA;143330.00 :                                    *                                                                                                                 &#xA;107482.34 :                             *                                                                                                                        &#xA;80600.38 :                              *                                                                                                                       &#xA;60441.76 :                                                                          *                                                                           &#xA;45324.93 :                              *   *                                                                                                                   &#xA;33988.90 :                         *        *                                    *                                                                              &#xA;25488.08 :                          * *    *  *                                      *                                                                          &#xA;19113.36 :                                        *                               **                                                                            &#xA;14333.00 :                                 * * *  *                             *                                                                               &#xA;10748.23 :                                *                                          *                                                                          &#xA;  8060.04 :                               *   *        *                               **                                                                        &#xA;  6044.18 :                     ***               * *     *                  *       *                                                                           &#xA;  4532.49 :                          **              *       *                   *     *                                                                         &#xA;  3398.89 :                 * *  *       **              *                      *                                                                                &#xA;  2548.81 :                     *  *            *                      *    *  *        *                                                                        &#xA;  1911.34 :           *                                  *       *  *                       *                                                                    &#xA;  1433.30 :              *        * *                  *        *    *  *      *    *                                                                            &#xA;  1074.82 :            *       *        *                 *   * * *                     *                                                                        &#xA;   806.00 :             *  * **                                  *       ***                                                                                     &#xA;   604.42 :           *   *            *                     *    **   *      *           *                                                                      &#xA;   453.25 :                  *       *                     *       *      *                 *                                                  * ** *            &#xA;   339.89 :        *   *   *                     *  *   *             *      *                  * *   *                                         *  * *           &#xA;   254.88 :        *          *                       **       *      * ***                      *                                                *              &#xA;   191.13 :   *          *                           *         *    *                      **   **                                                     *         &#xA;   143.33 :                                                                               *            *             *                                           &#xA;   107.48 :    *    *                                                *     *                  *   *    *   *     *    *                    **      *   *     *   &#xA;    80.60 : *  *  *                                                                          *                         *                                *        &#xA;    60.44 :      *  *                                                                    *   *     *        *   **    *              *     *         **  *       &#xA;    45.32 :                                                                  *             *        ***    * *    *       **          *   *    *    *    *       &#xA;    33.99 :                                                                                                                                                      &#xA;    25.49 :      *    *   *                                    *              *                    *    * * * **            *        *    *      *               *&#xA;    19.11 : *   *           *    *               *          *                                  *     *       ***            *  ***  *    *  *             *      &#xA;    14.33 :                                                                                                                                                      &#xA;    10.75 :       *  *         *      *             *         *   *                *                *      *       *     *   * * *  *  **                  ** *  *&#xA;     8.06 :                                                                                                                                                      &#xA;     6.04 :                                                                                                                                                      &#xA;     4.53 : *** *  *    *          *              *   * *  **         *         *        *    ***  *   ****   * * ********** ** ***** ****  *****     *** *******&#xA;========= : ======================================================================================================================================================&#xA;          :  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2&#xA;          :  0 0 0 1 1 1 2 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 7 8 8 8 9 9 9 0 0 0 1 1 1 2 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 7 8 8 8 9 9 9 0 0 0 1 1 1 2 2 2 2 3&#xA;          :  1 4 7 0 4 7 0 3 6 9 2 5 9 2 5 8 1 4 7 0 4 7 0 3 6 9 2 5 9 2 5 8 1 4 7 0 4 7 0 3 6 9 2 5 9 2 5 8 1 4 7 0 4 7 0 3 6 9 2 5 9 2 5 8 1 4 7 0 4 7 0 3 6 9 2&#xA;          :  6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 4 6 7 8 9 1 2 3 4 6 7 8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As you can see, it's a bit more disorganized (if that's possible), at least in some cases more &amp;quot;peaky&amp;quot;, and, it appears, much less reproducible -- the next sound would be quite a bit different, while snores tend to look a lot alike (when standing 10 feet back, at least).&lt;/p&gt;&#xA;&lt;p&gt;I can see attempting identification by breaking the sound up into bands and giving each band a score, then coming up with heuristics such as &amp;quot;band A and C should be relatively loud, while bands B and D should be relatively silent&amp;quot;, but it would be nice if there was a more systematic approach.&lt;/p&gt;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&lt;p&gt;Until I get something better, here is a screen shot of the graph:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xGNPn.jpg&quot; alt=&quot;snore spectrum&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's a spectrum from Audacity of some similar data:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://farm7.static.flickr.com/6051/6258190696_3f21851f1a_o.png&quot; alt=&quot;Audacity snore spectrum&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a different sound source, and I only approximated the time duration of the sample (which is 1024 samples at 8000 samples/second in the other images).  The sample rate for this sound file is 44.1K, so it has much more high frequency data than is available in &amp;quot;real life&amp;quot;.  The first three peaks are at roughly 215Hz, 600Hz, and 2000Hz.&lt;/p&gt;&#xA;&lt;p&gt;This next one is from a different sound file (&amp;amp; individual) where the sound level is much poorer.  We especially have trouble with these.  The peaks are about 124, 248, and 581.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://farm7.static.flickr.com/6169/6257755831_fa952cb1bf_o.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&lt;p&gt;I added code to build a &amp;quot;filter&amp;quot; by taking snapshots of the frequency spectrum during peak snore (as determined by an existing heuristic), summing together several successive snapshots, &amp;quot;smoothing&amp;quot; a bit, and &amp;quot;normalizing&amp;quot; to an average unity gain.  Did the same with snapshots taken during periods of relative quiet.  I then multiply the signal by both filters and sum (over the frequency range) the difference of the two products to produce a &amp;quot;delta&amp;quot;.  This seems to produce a fairly sensitive indicator of snoring.&lt;/p&gt;&#xA;&lt;p&gt;(Did this description make sense?)&lt;/p&gt;&#xA;&lt;p&gt;To the extent that you can understand the above description does it make sense?  Is a simple multiplication the most reasonable way to apply a filter of this sort?&lt;/p&gt;&#xA;" OwnerUserId="447" OwnerDisplayName="Daniel R Hicks" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-05-27T13:13:13.130" Title="How to recognize patterns in a noisy audio frequency spectrum?" Tags="|audio|noise|frequency-spectrum|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="451" PostTypeId="2" ParentId="431" CreationDate="2011-10-17T15:40:05.067" Score="12" Body="&lt;p&gt;In many common applications negative frequencies have no direct physical meaning at all. Consider a case where there is an input and an output voltage in some electrical circuit with resistors, capacitors, and inductors. There is simply a real input voltage with one frequency and there is a single output voltage with the same frequency but different amplitude and phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ONLY reason why you would consider complex signals, complex Fourier Transforms and phasor math at this point is mathematically convenience. You could do it just as well with entirely real math, it would just be a lot harder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are different types of time/frequency transforms. The Fourier Transform uses a complex exponential as its basis function and applied to a single real-valued sine wave happens to produces a two valued results which is interpreted as positive and negative frequency. There are other transforms (like the Discrete Cosine Transform) which would not produce any negative frequencies at all. Again, it’s a matter of mathematical convenience; the Fourier Transform is often the quickest and most efficient way to solve a specific problem.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-17T15:40:05.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="452" PostTypeId="2" ParentId="450" CreationDate="2011-10-18T04:19:28.730" Score="2" Body="&lt;p&gt;This is a far wider problem than merely how to compute and plot spectra correctly; I am merely trying to answer the latter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First things first: You've got a WAV of this stuff, right? Just download &lt;a href=&quot;http://audacity.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;Audacity&lt;/a&gt; and use its spectrum/spectrogram plots. They're inadequate in several ways &amp;mdash; in particular, it has fairly poor control over window length, it's really slow, its colormap facilities are kinda poor &amp;mdash; but it's free, it gets a lot of things right, and it gives you results pretty quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your own spectrum analysis, like Audacity's, should be using &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Welch%27s_method&quot; rel=&quot;nofollow&quot;&gt;Welch's method&lt;/a&gt; (with 50% overlap) for improved quality. The optimal window length and function are typically very situational, but the Hann/Hanning window is usually a pretty safe choice of window function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a power spectrum plot may not even be the best way to go here &amp;mdash; an autocorrelation approach might be better. (Sorry, I'm not a speech guy.)&lt;/p&gt;&#xA;" OwnerUserId="448" LastActivityDate="2011-10-18T04:19:28.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="453" PostTypeId="2" ParentId="450" CreationDate="2011-10-18T12:26:09.823" Score="0" Body="&lt;p&gt;Speech analysis uses frequently technique called &quot;formant analysis&quot; that tries to extract the areas of interest out of an audio spectrogram (e.g. &lt;a href=&quot;http://www.phon.ucl.ac.uk/resource/sfs/howto/formant.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.phon.ucl.ac.uk/resource/sfs/howto/formant.htm&lt;/a&gt;).&#xA;This may be overkill for what you need. A simpler approach would be&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;bandpass filter to frequency region of interest &lt;/li&gt;&#xA;&lt;li&gt;normalize spectrum to overall energy in the spectrogram&lt;/li&gt;&#xA;&lt;li&gt;define a threshold, everything above the threshold is a &quot;peak&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This should give a list of peaks in terms of position and width which you can use as a &quot;pattern&quot;. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-18T12:26:09.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="454" PostTypeId="1" CreationDate="2011-10-14T13:34:34.623" Score="33" ViewCount="2704" Body="&lt;p&gt;Is anyone aware of any research/papers/software for identifying a trail (as a line or point-to-point curve) in an image of a forest scene (from the perspective of the camera standing somewhere along the trail)?&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to find an algorithm that could take an image like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FdniK.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FdniK.jpg&quot; alt=&quot;alt text&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and produce a mask, identifying a likely &amp;quot;trail&amp;quot;, such as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rR0o1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rR0o1.jpg&quot; alt=&quot;alt text&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the original image is a bit blurry, which is purposeful. The image source can't guarantee perfect focus, so I need to be able to handle a reasonable amount of noise and blurriness.&lt;/p&gt;&#xA;&lt;p&gt;My first thought was to apply a Gaussian blur, and segment the image into blocks, comparing adjacent blocks looking for sharp color differences (indicating a trail &amp;quot;edge&amp;quot;). However, I quickly realized that shadows and other changes in lighting easily throws that off.&lt;/p&gt;&#xA;&lt;p&gt;I was thinking about extracting SURF features, but I've only had success with SURF/SIFT when the image is perfectly clear and with consistent lighting.&lt;/p&gt;&#xA;&lt;p&gt;I've also tried scaling the images and masks down to much smaller sizes (e.g. 100x75), converting them into 1xN vectors, and using them to train a &lt;a href=&quot;https://leenissen.dk/fann/wp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;FANN&lt;/a&gt;-based neural network (where the image is the input and the mask is the desired output). Even at such a small size, with 1 hidden layer with 75% the size of the input vector, it took 6 hours to train, and still couldn't predict any masks in the testing set.&lt;/p&gt;&#xA;&lt;p&gt;Can anyone suggest any other methods or papers on the subject?&lt;/p&gt;&#xA;" OwnerUserId="451" OwnerDisplayName="Cerin" LastEditorUserId="26573" LastEditDate="2020-12-21T22:02:57.170" LastActivityDate="2022-06-29T23:17:36.107" Title="Detecting Trail in Forest Images" Tags="|image-processing|computer-vision|" AnswerCount="6" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="455" PostTypeId="2" ParentId="454" CreationDate="2011-10-14T14:11:12.747" Score="13" Body="&lt;p&gt;I don't believe you have enough information &lt;em&gt;in&lt;/em&gt; the source image to produce the mask image.  You might start by segmenting on color, i.e. green is not trail, gray/brown is.  However, there are gray/brown regions on the &quot;trail borders&quot; that are not represented in your mask.  (See the lower left quadrant of your source image.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mask you provide implies structural constraints not evident in the source image: for example, perhaps your trails are of fixed width - then you can use that information to constrain the preliminary mask returned by your pattern recognizer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuing the topic of structure: Do trails merge with others? Are trails delineated with certain soil/gravel features?  As a human (that is reasonably good at pattern recognition!), I'm challenged by the features shown in the lower left quadrant: I see gray/brown regions that I cannot discount as &quot;trail&quot;.  Perhaps I could do so conclusively if I had more information: a map and a coarsely-known location, personal experience on this trail, or perhaps a sequence of images leading to this point - perhaps this view is not so ambiguous if the recognizer &quot;knows&quot; what led to this scene. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A collection of images is the most interesting approach in my opinion. Continuing that line of thought: one image might not provide enough data, but a panoramic view might disambiguate the scene.&lt;/p&gt;&#xA;" OwnerUserId="457" OwnerDisplayName="Throwback1986" LastActivityDate="2011-10-14T14:11:12.747" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="456" PostTypeId="2" ParentId="454" CreationDate="2011-10-14T14:23:15.540" Score="10" Body="&lt;p&gt;Is this of any interest?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.158.4002&quot;&gt;Real-time traversable surface detection by colour space fusion and temporal analysis&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" OwnerDisplayName="Martin Thompson" LastActivityDate="2011-10-14T14:23:15.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="459" PostTypeId="2" ParentId="454" CreationDate="2011-10-18T13:42:27.993" Score="13" Body="&lt;p&gt;It may not be sufficient by itself, but since one of the problems has to do with lighting variations, a shadow removal pre-processing step may help.  The technique I'm thinking of is described in the following paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;On the Removal of Shadows From Images&quot;, G. D. Finlayson, S. D.&#xA;  Hordley, C. Lu, and M. S. Drew, IEEE Pattern Analysis and Machine&#xA;  Intelligence (PAMI), Vol.28, No.1, Jan, 2006, pp.59-68.&#xA;  &lt;a href=&quot;http://www.cs.sfu.ca/~mark/ftp/Pami06/pami06.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cs.sfu.ca/~mark/ftp/Pami06/pami06.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The first part of the process produces an illumination invariant grayscale image, which is probably what you want in this case.  Here's a shot of the example they give in the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ILKL2.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ILKL2.jpg&quot; alt=&quot;Shadow Removal&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;&lt;sub&gt;(source: &lt;a href=&quot;http://www.datageist.com/shadow-removal.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;datageist.com&lt;/a&gt;)&lt;/sub&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, taking the process one step further to produce a &quot;chromaticity&quot; image may be what you need to cleanly distinguish between the live and dead leaves.  Once again, an example from the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/U5cpO.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U5cpO.jpg&quot; alt=&quot;Chromaticity&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;&lt;sub&gt;(source: &lt;a href=&quot;http://www.datageist.com/chromaticity.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;datageist.com&lt;/a&gt;)&lt;/sub&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The catch, however, is that the camera needs to be calibrated first.  Assuming that's possible, some combination of the representations they describe will probably make the other methods you're using more effective.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="26573" LastEditDate="2019-02-16T19:38:14.970" LastActivityDate="2019-02-16T19:38:14.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="460" PostTypeId="1" CreationDate="2011-10-18T14:36:15.950" Score="5" ViewCount="416" Body="&lt;p&gt;I am trying to implement a karaoke scoring algorithm and, for a particular song, have the note information (done by a professional) that indicates what note occurs in which part of the lyric.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use a pitch detector and plot the pitch values for the portion of the lyric where a single note is held, the pitch varies a lot in the beginning (for the first few pitch values), hits a steady value (that roughly corresponds with the note that needs to be sung) and again shows a lot of variation before it transitions to the next note. I want to derive a single pitch value that is representative of the pitch value when the note is held steadily.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I go about it? Is this a problem of pitch smoothing (median)?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a pitch algorithm based on the G.729 pitch detector with a pitch smoothing algorithm that seems to work really well (so far) on speech and on male singers singing in the presence of background music (very low volume).  &lt;/p&gt;&#xA;" OwnerUserId="102" LastEditorUserId="102" LastEditDate="2011-10-19T08:36:04.043" LastActivityDate="2011-10-25T07:12:31.663" Title="Finding the pitch value of a note" Tags="|pitch|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="461" PostTypeId="2" ParentId="460" CreationDate="2011-10-18T22:01:52.273" Score="3" Body="&lt;p&gt;You may need to ignore the transients between stable pitches (for example, most consonants when singing lyrics) as these may be un-pitched sounds or noises, and thus confusing your pitch estimation algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The singer(s) may also be producing some vibrato, which should correctly show as pitch variations towards the end of some held notes. &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-10-19T14:11:25.417" LastActivityDate="2011-10-19T14:11:25.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="462" PostTypeId="1" AcceptedAnswerId="463" CreationDate="2011-10-19T06:25:18.363" Score="4" ViewCount="635" Body="&lt;p&gt;I am trying to use Octave to generate a pure sine wave. The code for the same is as follows:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x = 10.*sin(2*pi*(300/16000)*(0:1:400));&lt;/code&gt;&lt;br&gt;&#xA;The sampling rate is 16000Hz, the sine wave is at 300 Hz. I write the above wave to a file using &lt;code&gt;wavwrite&lt;/code&gt; like so:&lt;br&gt;&#xA;&lt;code&gt;wavwrite(x, 16000, 16, &quot;temp.wav&quot;)&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to read it back into a variable, like so:&lt;br&gt;&#xA;&lt;code&gt;y = wavread('temp.wav');&lt;/code&gt;, I get square waves upon plotting &lt;code&gt;y&lt;/code&gt;.&lt;br&gt;&#xA;I have checked the sine wave and the period indicates a frequency of 300Hz.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can a pure sine wave become a square wave on simply writing and reading? Or am I going wrong somewhere?&lt;/p&gt;&#xA;" OwnerUserId="102" LastEditorUserId="90" LastEditDate="2011-10-19T13:46:46.813" LastActivityDate="2011-10-19T14:06:52.830" Title="Why did my sine wave turn into a square wave when written to a WAV file in Octave?" Tags="|audio|octave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="463" PostTypeId="2" ParentId="462" CreationDate="2011-10-19T06:50:03.090" Score="10" Body="&lt;p&gt;&lt;code&gt;x&lt;/code&gt; is being clipped and that is why &lt;code&gt;y&lt;/code&gt; looks like a square wave. When writing &lt;code&gt;x&lt;/code&gt; to disk using &lt;code&gt;wavwrite&lt;/code&gt;, the samples of &lt;code&gt;x&lt;/code&gt; are stored in 16 bits Q15 fixed-point format. That means your data must be in range &lt;code&gt;-1&lt;/code&gt; to &lt;code&gt;+1&lt;/code&gt; (in principle &lt;code&gt;+1&lt;/code&gt; minus one lsb). Therefore, &lt;code&gt;x&lt;/code&gt; must be normalized to be in this range before calling &lt;code&gt;wavwrite&lt;/code&gt; in order to avoid clipping.&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="77" LastEditDate="2011-10-19T14:06:52.830" LastActivityDate="2011-10-19T14:06:52.830" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="464" PostTypeId="2" ParentId="450" CreationDate="2011-10-19T07:11:52.940" Score="0" Body="&lt;p&gt;It is customary to always plot audio spectra on a log-frequency scale unless you have a good reason not to do so. One thing that raises an alarm is that your corrupted speech seems to have an extremely low level, in fact it seems that it is of such low level that most of the speech is below the noise floor or what can be represented in Q15. That would also explain why your speech appear bandlimited. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has the speech you record been processed in anyway?&lt;br&gt;&#xA;Is the speech of such low level that your plot indicates?&lt;br&gt;&#xA;What is the data type used to represent the samples (short, int, float)?&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2011-10-19T07:36:22.940" LastActivityDate="2011-10-19T07:36:22.940" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="465" PostTypeId="2" ParentId="431" CreationDate="2011-10-19T08:36:56.180" Score="-3" Body="&lt;p&gt;This has turned out to be quite the hot topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading the rich multitude of good and diverse opinions and interpretations and &#xA;letting the issue simmer in my head for sometime, I believe I have a physical interpretation of the phenomenon of negative frequencies. And I believe the key interpretation here is that fourier is blind to time. Expaning on this further:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There has been a lot of talk about the 'direction' of the frequency, and thus how it can be &#xA;+ve or -ve. While the overarching insights of the authors saying this is not lost, this &#xA;statement is nontheless inconsistent with the definition of temporal frequency, so first we &#xA;must define our terms very carefully. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Distance&lt;/em&gt; is a scalar (can only ever be +ve), while &lt;em&gt;displacement&lt;/em&gt; is a vector. (ie, has &#xA;direction, can be +ve or -ve to illustrate heading).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Speed&lt;/em&gt; is a scalar (can only be +ve), while &lt;em&gt;velocity&lt;/em&gt; is a vector. (ie, again, has &#xA;direction, and can be +ve or -ve). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus by the same tokens, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Temporal Frequency&lt;/em&gt; is a scalar, (can only be +ve)! Frequency is defined as number of &#xA;cycles per unit time. If this is the accepted definition, we &lt;strong&gt;cannot&lt;/strong&gt; simply claim that it is going in 'a different direction'. Its a scalar after-all. Instead, we must define a new term - the vector equivalent of frequency. Perhaps 'angular frequency' would be the right terminology here, and indeed, that is precisely what a &lt;em&gt;digital&lt;/em&gt; frequency measures.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now all the sudden we are in the business of measuring number of &lt;em&gt;rotations&lt;/em&gt; per unit time, &#xA;(a vector quantity that can have direction), VS just the number of repititions of some physical oscillation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus when we are asking about the physical interpretation of negative frequencies, we are &#xA;also implicitly asking about &lt;strong&gt;how&lt;/strong&gt; the scalar and very real measures of number of &#xA;oscillations per unit time of some physical phenomenon like waves on a beach, sinusoidal AC &#xA;current over a wire, &lt;em&gt;map&lt;/em&gt; to this angular-frequency that now all the sudden happens to have direction, either clockwise or counterclockwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here, to arrive at a physical interpretation of negative frequencies two facts need to &#xA;be heeded. The first one is that as Fourier pointed out, an oscillatory real tone with &#xA;&lt;em&gt;scalar temporal frequency, f&lt;/em&gt;, can be constructed by adding two oscillatory complex tones, &#xA;with &lt;em&gt;vector angular frequencies, +w and -w&lt;/em&gt; together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\cos(\omega_0 t)=\frac{e^{\jmath \omega_0t}+e^{-\jmath \omega_0 t}}{2}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thats great, but so what? Well, the complex tones are rotating in directions opposite to &#xA;each other. (See also Sebastian's comment). But what is the significance of the 'directions' here that give our angular frequencies their vector status? What physical quantity is being reflected in the direction of rotation? The answer is time. In the first complex tone, time is travelling in the +ve direction, and in the second complex tone, time is travelling in the -ve direction. Time is going backwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keeping this in mind and taking a quick diversion to recall that temporal frequency is the &#xA;first derivative of phase with respect to time, (simply the change of phase over time), everything begins to fall into place:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The physical interpretation of negative frequencies is as follows:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first realization was that &lt;em&gt;fourier is time-agnostic&lt;/em&gt;. That is, if you think about it, &#xA;there is nothing in fourier analysis or the transform itself that can tell you what the &#xA;'direction' of time is. Now, imagine a physically oscillating system (ie a real sinusoid &#xA;from say, a current over a wire) that is oscillating at some &lt;em&gt;scalar temporal-frequency, f&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine 'looking' down this wave, in the forwards direction of time as it progresses. Now &#xA;imagine calculating its difference in phase at every point in time you progress further. &#xA;This will give you your scalar temporal frequency, and your frquency is positive. So far so &#xA;good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But wait a minute - if fourier is blind to time, then why should it only consider your wave &#xA;in the 'forward' time direction? There is nothing special about that direction in time. Thus by symmetry, the other direction of time must also be considered. Thus now imagine 'looking' up at the same wave, (ie, &lt;em&gt;backwards&lt;/em&gt; in time), and also performing the same delta-phase calculation. Since time is going backwards now, and your frequency is change-of-phase/(negative time), your frequency will now be negative!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What Fourier is really saying, is that this signal has energy if played forward in time at &#xA;frequency bin f, but ALSO has energy if played &lt;em&gt;backwards&lt;/em&gt; in time albeit at frequency bin &#xA;-f. In a sense it MUST say this because fourier has no way of 'knowing' what the 'true' &#xA;direction of time is! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does fourier capture this? Well, in order to show the &lt;em&gt;direction&lt;/em&gt; of time, a rotation of some sort &lt;em&gt;must&lt;/em&gt; be employed such that a clockwise roation dealinates 'looking' at the signal in the forward arrow of time, and a counterclockwise roation dealinates 'looking' at the signal as if time was going backwards. The scalar temporal frequency we are all familiar with should now be equal to the (scaled) absolute value of our vector angular frequency. But how can a point signifying the displacement of a sinusoid wave arrive at its starting point after one cycle yet simultaneously rotate around a circle and maintain a manifestation of the temporal frequency it signifies? Only if the major axes of that circle are composed of measuring displacement of this point relative to the original sinusoid, and a sinusoid off by 90 degrees. (This is exactly how fourier gets his sine and cosine bases the you project against every time you perform a DFT!). And finally, how do we keep those axes seperate? The 'j' guarantees that the magnitude on each axis is always independant of the magnitude on the other, since real and imaginary numbers cannot be added to yield a new number in either domain. (But this is just a side note).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus in summary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fourier transform is time-agnostic. It cannot tell the direction of time. This is at the heart of negative frequencies. Since frequency = phase-change/time, anytime you take the DFT of a signal, fourier is saying that if time was going forwards, your energy is located on the +ve frequency axis, but if your time was going backwards, your energy is located on the -ve frequency axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As our universe has &lt;a href=&quot;http://en.wikipedia.org/w/index.php?title=Time_reversal_symmetry&amp;amp;redirect=no&quot; rel=&quot;nofollow&quot;&gt;shown before&lt;/a&gt;, it is precisely because Fourier does not know the direction of time, that both sides of the DFT &lt;em&gt;must&lt;/em&gt; be symmetric, and why the existence of negative frequencies are necessary and in fact very real indeed.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2011-10-20T01:01:00.513" LastActivityDate="2011-10-20T01:01:00.513" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="466" PostTypeId="2" ParentId="454" CreationDate="2011-10-19T17:50:08.530" Score="13" Body="&lt;p&gt;There's no single algorithm that will magically detect trails in a random image. You will need to implement a machine learning based routine and &quot;train&quot; it to detect trails. Without going into too many details, here's a rough outline of what you would do in a supervised learning approach.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You will need a set of &quot;training examples&quot;, by which I mean several pictures of trails in different environments, in which you (the supervisor) have labeled what counts as &quot;trail&quot; and what's the background &quot;forest&quot;. You break the images up into smaller sections (typically 8x8) and transform it to a &quot;feature space&quot; by taking the DCT (discrete cosine transform) of the blocks. The DCT of each block in this case gives you a 64 point &quot;feature vector&quot;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Defining a feature space $\mathcal{X}$, set of features $\mathbf{x}$ (a subset of your 64 point feature vector), and a class space $\mathcal{Y}$ with classes $y_1=trail$ and $y_2=forest$, you calculate from your training sets: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the class conditional distributions&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\mathcal{P}_\mathcal{X|Y}(\mathbf{x}|trail)$, the conditional density for the features when the class is $trail$.  &lt;/li&gt;&#xA;&lt;li&gt;$\mathcal{P}_\mathcal{X|Y}(\mathbf{x}|forest)$, the conditional density for the features when the class is $forest$.  &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;the class probabilities or the prior&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\mathcal{P}_\mathcal{Y}(trail)$, probability of finding a $trail$ in a block&lt;/li&gt;&#xA;&lt;li&gt;$\mathcal{P}_\mathcal{Y}(forest)$, probability of finding a $forest$ in a block&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With this, you test your image (again, breaking it up into smaller pieces) and calculate the posterior probability. Using Bayes' decision theory, you'd define your binary (in this case) selection criteria something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\widetilde{y}_i(\mathbf{x})=\arg \max_{y_i}\quad \mathcal{P}_\mathcal{X|Y}(\mathbf{x}|y_i)\ \mathcal{P}_\mathcal{Y}(y_i)$$&#xA;where you assign each block to that class which has the highest posterior probability. This will result in your binary mask.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that this is a very simplified overview of the approach. There are several things to take into consideration and the most important of them is choosing the right set of features for your problem. You can also do more complicated things like use mixture models and kernel based density estimations, but all of that is too detailed and time consuming to write in an answer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a motivation and confirmation that this approach is worth trying, here's an example from something I did a long time ago as a course homework, which is very similar to what you're trying to achieve. The objective was to detect the animal from the background vegetation (left image). The figure on the right shows the binary mask obtained after &quot;learning&quot; to distinguish between the foreground and the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wMZRu.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/lRIdT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To learn more about machine learning, you might want to look at a few text books. One of the well known and often recommended textbooks in the field is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www-stat.stanford.edu/~tibs/ElemStatLearn/&quot; rel=&quot;noreferrer&quot;&gt;T. Hastie, R. Tibshirani and J. Friedman, &lt;em&gt;The Elements of Statistical Learning: Data Mining, Inference, and Prediction.&lt;/em&gt; 2nd Ed., Springer-Verlag (2008) &lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which is now available as a free PDF at the link provided. Another decent book is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0471056693&quot; rel=&quot;noreferrer&quot;&gt;R. O. Duda, P. E. Hart and D. G. Stork, &lt;em&gt;Pattern Classification&lt;/em&gt;, 2nd Ed., John Wiley &amp;amp; Sons (2001)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="77" LastEditorUserId="77" LastEditDate="2011-10-26T14:16:43.730" LastActivityDate="2011-10-26T14:16:43.730" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="467" PostTypeId="1" CreationDate="2011-10-20T12:21:51.930" Score="10" ViewCount="4792" Body="&lt;p&gt;I am trying to make a high pass filter for electroencephalographic (EEG) datasets, in order to get rid of very slow drifts. However frequencies around 0.3 Hz are very important for the research these data serve. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use Matlab and I tried various things. It seems that a very low dB attenuation, of 3 dB is fine with FIR filters. For example I used that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h=fdesign.highpass('Fst,Fp,Ast,Ap',0.005,0.01,3,1,250); % i needed to cut &#xA;d=design(h,'butter');&#xA;fvtool(d)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this filter makes a dc drift at the start of the data and I would not wish to loose these first datapoints. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read through your pages that a clever idea is to design a low pass filter that later I would subtract from the real data. I did it with an equiripple filter and it worked but left a baseline lift. I do not want to run now average removal as this is in a next step in the analysis protocol. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions? &lt;/p&gt;&#xA;" OwnerUserId="14830" OwnerDisplayName="forsker_for_dsp" LastActivityDate="2015-02-23T21:38:32.420" Title="High pass filter of 0.01 Hz for EEG slow drifts" Tags="|filters|" AnswerCount="6" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="468" PostTypeId="2" ParentId="467" CreationDate="2011-10-20T18:48:44.420" Score="6" Body="&lt;p&gt;You're asking for a time machine: in order to avoid the DC bump at $t=0$, you need to know the state of the filter &lt;em&gt;as if&lt;/em&gt; it had been running before the recording ever began. That's not going to happen no matter what kind of filter you use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a trick which &lt;em&gt;may&lt;/em&gt; come in handy for you. Let's say you have an $N$-tap FIR filter (or an IIR filter whose impulse response decays adequately to 0 after $N$ samples). Take the first $N$ samples of your signal, reverse them, and prepend that to the start of your signal. In effect, we're defining a new signal $g(t)=g(-t)=f(t)$ for the purposes of filtering. When you filter that, the filter state will have already been &quot;primed&quot; with the initial signal: delete the first $N$ samples of the output, and the DC bump should have hopefully gone away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Needless to say, there are numerous gotchas with that scheme &amp;mdash; for starters, it's harder to do for realtime processing, and if the signal derivative is high at $t=0$, you are still going to have trust issues with the first few samples. But it should get rid of the bump.&lt;/p&gt;&#xA;" OwnerUserId="448" LastActivityDate="2011-10-20T18:48:44.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="469" PostTypeId="2" ParentId="467" CreationDate="2011-10-20T20:49:47.460" Score="6" Body="&lt;p&gt;Take a look at the filtfilt function. It gives zero-phase response and a perfect step response. Especially, the step response property of the filtfilt filtering may solve your problem. &lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2011-10-20T21:14:52.803" LastActivityDate="2011-10-20T21:14:52.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="470" PostTypeId="1" AcceptedAnswerId="472" CreationDate="2011-10-21T14:49:53.113" Score="40" ViewCount="21140" Body="&lt;p&gt;I'm familiar with the Radon transform from learning about CT scans, but not the Hough transform.  Wikipedia says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The (r,θ) plane is sometimes referred to as Hough space for the set of straight lines in two dimensions. This representation makes the Hough transform conceptually very close to the two-dimensional Radon transform. (They can be seen as different ways of looking at the same transform.[5])&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://northstar-www.dartmouth.edu/doc/idl/html_6.2/Transforming_to_and_from_the_Hough_and_Radon_Domains.html&quot; rel=&quot;noreferrer&quot;&gt;Their output&lt;/a&gt; looks the same to me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5BRJq.jpg&quot; alt=&quot;side-by-side rho vs theta plots for Hough and Radon transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Wolfram Alpha: &lt;a href=&quot;http://www.wolframalpha.com/input/?i=radon%20transform%20building%20image&quot; rel=&quot;noreferrer&quot;&gt;Radon&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Wolfram Alpha: &lt;a href=&quot;http://www.wolframalpha.com/input/?i=hough%20transform%20building%20image&quot; rel=&quot;noreferrer&quot;&gt;Hough&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I don't understand what the difference is.  Are they just the same thing seen in different ways?  What are the benefits of each different view?  Why aren't they combined into &quot;the Hough-Radon transform&quot;?&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2018-04-19T13:46:00.177" LastActivityDate="2018-05-04T19:46:48.163" Title="What's the difference between the Hough and Radon transforms?" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="471" PostTypeId="1" AcceptedAnswerId="535" CreationDate="2011-10-21T15:36:31.460" Score="57" ViewCount="7792" Body="&lt;p&gt;Are there some good sites or blogs where I can keep myself updated on the latest news and papers about image and signal processing research, or I should just check out &quot;classical&quot; providers like IEEE Transactions, Elsevier, etc?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="77" LastEditDate="2011-10-21T15:46:27.123" LastActivityDate="2017-04-06T20:14:47.153" Title="What are some good signal and image processing blogs worth following?" Tags="|image-processing|" AnswerCount="8" CommentCount="2" CommunityOwnedDate="2011-10-21T15:46:36.593" ContentLicense="CC BY-SA 3.0" />
  <row Id="472" PostTypeId="2" ParentId="470" CreationDate="2011-10-21T16:48:18.720" Score="38" Body="&lt;p&gt;The Hough transform and the Radon transform are indeed very similar to each other and their relation can be loosely defined as the former being a discretized form of the latter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Radon transform is a mathematical integral transform, defined for continuous functions on $\mathbb{R}^n$ on hyperplanes in $\mathbb{R}^n$. The Hough transform, on the other hand, is inherently a discrete algorithm that detects lines (extendable to other shapes) in an image by polling and binning (or voting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think a reasonable analogy for the difference between the two would be like the difference between &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;calculating the characteristic function of a random variable as the Fourier transform of its probability density function (PDF) and&lt;/li&gt;&#xA;&lt;li&gt;generating a random sequence, calculating its empirical PDF by histogram binning and then transforming it appropriately.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, the Hough transform is a quick algorithm that can be prone to certain artifacts. Radon, being more mathematically sound, is more accurate but slower. You can in fact see the artifacts in your Hough transform example as vertical striations. Here's another quick example in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = Import[&quot;https://i.stack.imgur.com/mODZj.gif&quot;];&#xA;radon = Radon[img, Method -&amp;gt; &quot;Radon&quot;];&#xA;hough = Radon[img, Method -&amp;gt; &quot;Hough&quot;];&#xA;GraphicsRow[{#1, #2, ColorNegate@ImageDifference[#1, #2]} &amp;amp; @@ {radon,hough}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IAGi4.png&quot; rel=&quot;noreferrer&quot;&gt;&#xA;    &lt;img src=&quot;https://i.stack.imgur.com/IAGi4.png&quot; width=&quot;215&quot; /&gt;&#xA;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/b4HWW.png&quot; rel=&quot;noreferrer&quot;&gt;&#xA;    &lt;img src=&quot;https://i.stack.imgur.com/b4HWW.png&quot; width=&quot;215&quot; /&gt;&#xA;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ZJ11a.png&quot; rel=&quot;noreferrer&quot;&gt;&#xA;    &lt;img src=&quot;https://i.stack.imgur.com/ZJ11a.png&quot; width=&quot;215&quot; /&gt;&#xA;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last image is really faint, even though I negated it to show the striations in dark color, but it is there. Tilting the monitor will help. You can click all figures for a larger image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of the reason why the similarity between the two is not very well known is because different fields of science &amp;amp; engineering have historically used only one of these two for their needs. For example, in tomography (medical, seismic, etc.), microscopy, etc., Radon transform is perhaps used exclusively. I think the reason for this is that keeping artifacts to a minimum is of utmost importance (an artifact could be a misdiagnosed tumor). On the other hand, in image processing, computer vision, etc., it is the Hough transform that is used  because speed is primary.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You might find this article quite interesting and topical:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://tnw.home.tudelft.nl/fileadmin/Faculteit/TNW/Over_de_faculteit/Afdelingen/Imaging_Science_and_Technology/Research/Research_Groups/Quantitative_Imaging/Publications/Technical_Reports/doc/mvanginkel_radonandhough_tr2004.pdf&quot; rel=&quot;noreferrer&quot;&gt;M. van Ginkel, C. L. Luengo Hendriks and L. J. van Vliet, &lt;em&gt;A short introduction to the Radon and Hough transforms and how they relate to each other&lt;/em&gt;, Quantitative Imaging Group, Imaging Science &amp;amp; Technology Department, TU Delft&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The authors argue that although the two are very closely related (in their original definitions) and equivalent if you write the Hough transform as a continuous transform, the Radon has the advantage of being more intuitive and having a solid mathematical basis.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There is also the generalized Radon transform similar to the generalized Hough transform, which works with parametrized curves instead of lines. Here is a reference that deals with it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=545862&quot; rel=&quot;noreferrer&quot;&gt;Toft, P. A., &lt;em&gt;&quot;Using the generalized Radon transform for detection of curves in noisy images&quot;&lt;/em&gt;, IEEE ICASSP-96, Vol. 4, 2219-2222 (1996)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="77" LastEditorUserId="33605" LastEditDate="2018-05-04T19:46:48.163" LastActivityDate="2018-05-04T19:46:48.163" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="473" PostTypeId="2" ParentId="467" CreationDate="2011-10-22T20:20:09.813" Score="0" Body="&lt;p&gt;I did the trick Mr rtollert explained and thought it was the best I could do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go down the route of continuous sampling/hardware compensation, then efficiency might make you interested in &lt;a href=&quot;http://www.digitalsignallabs.com/dcblock.pdf&quot; rel=&quot;nofollow&quot;&gt;DC blockers&lt;/a&gt; as described by Randy Yates and Richard Lyons in dsp Tips &amp;amp; Tricks March 2008&lt;/p&gt;&#xA;" OwnerUserId="465" LastActivityDate="2011-10-22T20:20:09.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="474" PostTypeId="2" ParentId="401" CreationDate="2011-10-23T14:26:43.577" Score="3" Body="&lt;p&gt;&quot;Robust&quot; corner detectors like Shi-Tomasi and Moravec are notoriously slow. &#xA;check them here - &lt;a href=&quot;http://en.wikipedia.org/wiki/Corner_detection&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Corner_detection&lt;/a&gt;&#xA;FAST probably is the only good enough lightweight corner detector. You can improve FAST by doing non-maximum suppression - chose FAST output with best &quot;cornerness&quot; score (there are several intuitive way to calculate it, including Shi-Tomasi and Moravec as cornerness score)&#xA;You also have a choice from several FAST detectors - from FAST-5 to FAST-12 and FAST_ER(last one is probably too huge for mobile)&#xA;Another way is to get generated FAST - get FAST code generator from author site and train it on the set of likely images.&#xA;&lt;a href=&quot;http://www.edwardrosten.com/work/fast.html&quot; rel=&quot;nofollow&quot;&gt;http://www.edwardrosten.com/work/fast.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2011-10-23T14:26:43.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="475" PostTypeId="2" ParentId="401" CreationDate="2011-10-23T20:30:22.683" Score="2" Body="&lt;p&gt;Not really GPU-specific, but the &lt;a href=&quot;http://users.fmrib.ox.ac.uk/~steve/susan/index.html&quot; rel=&quot;nofollow&quot;&gt;SUSAN algorithm by Steve Smith&lt;/a&gt; is good for corner detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm is pretty simple, as &lt;a href=&quot;http://users.fmrib.ox.ac.uk/~steve/susan/susan2l.c&quot; rel=&quot;nofollow&quot;&gt;the source code in C&lt;/a&gt; shows.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2011-10-23T20:30:22.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="476" PostTypeId="2" ParentId="467" CreationDate="2011-10-24T03:35:34.397" Score="-1" Body="&lt;p&gt;You don't care about absolute DC value, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why not just add a static offset to your data so that the first data point is at zero?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure, you would have to add the offset to every datapoint, but it would completely avoid the big step-response issues you are having with the filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Effectively the filter starts up initialized to zero. Therefore, when your data begins, the filter sees a big stair-step from zero to whatever DC level you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just add offset to remove the stair-step.&lt;/p&gt;&#xA;" OwnerUserId="467" LastActivityDate="2011-10-24T03:35:34.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="477" PostTypeId="2" ParentId="427" CreationDate="2011-10-24T13:16:04.570" Score="5" Body="&lt;p&gt;In addition to the already mentioned books, if you are focused towards algorithm development, Proakis' &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1111427372&quot; rel=&quot;noreferrer&quot;&gt;Digital Signal Processing using MATLAB&lt;/a&gt; is an excellent resource for starters. The &lt;a href=&quot;http://www.nr.com/&quot; rel=&quot;noreferrer&quot;&gt;numerical recipes series&lt;/a&gt; is also an excellent resource regarding how to implement some core DSP algorithms (spectral decomposition, convolutions, interpolation and extrapolation etc.) in practical situations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me, Oppenheim gives a much more rigorous theoretical treatment to the subject as compared to Proakis. Proakis, I've always felt, provides somewhat more applicability to real world scenarios.&lt;/p&gt;&#xA;" OwnerUserId="469" LastActivityDate="2011-10-24T13:16:04.570" CommentCount="0" CommunityOwnedDate="2011-10-24T13:16:04.570" ContentLicense="CC BY-SA 3.0" />
  <row Id="478" PostTypeId="2" ParentId="403" CreationDate="2011-10-24T15:28:02.163" Score="2" Body="&lt;p&gt;VLC encoding in any compressed format makes it almost impossible to recover and it is even theoretical impossible to recover. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, most file formats take due care about this. So if you are reading JPEG files - a typical .jpg in JFIF format - it is practically very easy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, there are many markers that are placed in the stream which forms the segments of individual runs in these file which are independently identifiable. The VLC encoding of one segment is independent from the other segment - so if you find that a particular section of bytes broken, you can simply give up on the VLC decoding for that segment and search for the next segment marker. Typically the same concept is used to make MPEG compressed video to allow skipping in the case of streaming error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For JPEG's JFIF format, there are following markers which helps achieve the above: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. SOS &lt;em&gt;n&lt;/em&gt; (Start of scan) markers&#xA;b. SOF (Start of frame) markers&#xA;c. RST &lt;em&gt;n&lt;/em&gt; (Restart) markers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See references for more information:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The JFIF file format - &lt;a href=&quot;http://www.w3.org/Graphics/JPEG/jfif3.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.w3.org/Graphics/JPEG/jfif3.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;FileFormat.Info - &lt;a href=&quot;http://www.fileformat.info/format/jpeg/egff.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.fileformat.info/format/jpeg/egff.htm&lt;/a&gt; or &lt;/li&gt;&#xA;&lt;li&gt;Book &lt;em&gt;Compressed image file formats: JPEG, PNG, GIF, XBM, BMP by John Miano&lt;/em&gt; &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-01-22T13:37:58.677" LastActivityDate="2012-01-22T13:37:58.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="479" PostTypeId="2" ParentId="328" CreationDate="2011-10-24T15:40:11.170" Score="7" Body="&lt;p&gt;As a very short answer - any transform is better than other transform when it has, what is known as &quot;energy Compaction property&quot; which is explained as below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&quot;when only a small fraction of transform coefficients have large magnitude such that keeping only a few co-efficient and discarding or quantizing others still allows re-construction is near perfect&quot;. Such property is related to the decorrelating capability of unitary transforms.&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transform with lesser energy compaction property is the one which will need smallest number of symbols and hence lesser bits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transform with highest energy compaction property is DCT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dipan.&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2011-10-24T15:40:11.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="480" PostTypeId="2" ParentId="471" CreationDate="2011-10-24T17:38:07.100" Score="5" Body="&lt;p&gt;Check out the Image Processing blog by &lt;a href=&quot;http://blogs.mathworks.com/steve/&quot;&gt;Steve Eddins&lt;/a&gt; from The Mathworks.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2011-10-24T17:38:07.100" CommentCount="1" CommunityOwnedDate="2011-10-24T17:38:07.100" ContentLicense="CC BY-SA 3.0" />
  <row Id="481" PostTypeId="1" AcceptedAnswerId="488" CreationDate="2011-10-24T17:49:11.250" Score="39" ViewCount="11859" Body="&lt;p&gt;Is a stochastic process completely described by its autocorrelation function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, which additional properties would be needed?&lt;/p&gt;&#xA;" OwnerUserId="471" LastEditorUserId="90" LastEditDate="2012-01-05T15:31:31.720" LastActivityDate="2022-02-14T20:00:53.053" Title="Does the autocorrelation function completely describe a stochastic process?" Tags="|autocorrelation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="483" PostTypeId="1" AcceptedAnswerId="484" CreationDate="2011-10-24T18:18:51.197" Score="16" ViewCount="978" Body="&lt;p&gt;Wavelets seem to be very useful for image processing. Assuming that I'm only ever going to study signals of time, i.e. 1D signals, should I still take a course in wavelet analysis? Are they applicable to 1D signals?&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2012-02-24T14:51:15.810" Title="Is wavelet analysis useful for 1D signals?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="484" PostTypeId="2" ParentId="483" CreationDate="2011-10-24T18:33:15.300" Score="15" Body="&lt;p&gt;They absolutely are applicable. They are used for signal compression, denoising, feature extraction, filter-bank signal processing and many more things. In fact, a course of wavelet analysis will (should) stress one-dimensional analysis, which 2D is an extension of.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-02-24T14:51:15.810" LastActivityDate="2012-02-24T14:51:15.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="486" PostTypeId="2" ParentId="328" CreationDate="2011-10-24T23:30:11.253" Score="12" Body="&lt;p&gt;The goodness of signal transforms is evaluated on two different metrics: compression, and in the case of lossy compression, quality. Compression is defined by energy compaction but quality is harder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Traditionally quality has been measured by mean-square error or average per-pixel SNR. However, humans don't tend to evaluate signals with MSE or SNR. Humans are very sensitive to structured noise where MSE tends not to be. Developing algorithms that deliver human-like quality metrics is an active area of research. &lt;a href=&quot;https://ece.uwaterloo.ca/~z70wang/research/ssim/&quot;&gt;Bovik's Structural SIMilarity (SSIM) index&lt;/a&gt; is a good place to start. &lt;/p&gt;&#xA;" OwnerUserId="476" LastEditorUserId="90" LastEditDate="2011-10-25T02:43:58.933" LastActivityDate="2011-10-25T02:43:58.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="487" PostTypeId="2" ParentId="471" CreationDate="2011-10-24T23:53:13.960" Score="11" Body="&lt;p&gt;Igor over at &lt;a href=&quot;http://nuit-blanche.blogspot.com/&quot;&gt;Nuit Blanche&lt;/a&gt; does a good job keeping up with publications in the field of Compressive Sensing. &lt;/p&gt;&#xA;" OwnerUserId="476" LastActivityDate="2011-10-24T23:53:13.960" CommentCount="2" CommunityOwnedDate="2011-10-24T23:53:13.960" ContentLicense="CC BY-SA 3.0" />
  <row Id="488" PostTypeId="2" ParentId="481" CreationDate="2011-10-25T02:26:16.100" Score="61" Body="&lt;p&gt;What is meant by a complete description of a stochastic process?  Well, mathematically, a stochastic process is a collection &lt;span class=&quot;math-container&quot;&gt;$\{X(t) \colon t \in {\mathbb T}\}$&lt;/span&gt; of random variables, one for each time instant &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; in an &lt;em&gt;index set&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathbb T$&lt;/span&gt;, where usually &lt;span class=&quot;math-container&quot;&gt;$\mathbb T$&lt;/span&gt; is the entire real line or the positive real line, and a &lt;em&gt;complete description&lt;/em&gt; means that for each integer &lt;span class=&quot;math-container&quot;&gt;$n \geq 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; time instants &lt;span class=&quot;math-container&quot;&gt;$t_1, t_2, \ldots, t_n \in \mathbb T$&lt;/span&gt;, we know the (joint) distributions of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; random variables &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ldots, X(t_n)$&lt;/span&gt;.  This is an &lt;em&gt;enormous&lt;/em&gt; amount of information:  we need to know the CDF of &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; for each time instant &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, the (two-dimensional) joint CDF of &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt; for all choices of time instants &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t_2$&lt;/span&gt;, the (three-dimensional) CDFs of &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$X(t_3)$&lt;/span&gt;, etc. etc. etc.&lt;/p&gt;&#xA;&lt;p&gt;So naturally people have looked about for simpler descriptions and more restrictive models.  One simplification occurs when the process is invariant to a change in the time origin.  What this means is that&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;All&lt;/em&gt; the random variables in the process have identical CDFs: &lt;span class=&quot;math-container&quot;&gt;$F_{X(t_1)}(x) = F_{X(t_2)}(x)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$t_1, t_2$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Any two&lt;/em&gt; random variables separated by some specified amount of time have the same joint CDF as &lt;em&gt;any other&lt;/em&gt; pair of random variables separated by the &lt;em&gt;same&lt;/em&gt; amount of time.  For example, the random variables &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t_1 + \tau)$&lt;/span&gt; are separated by &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; seconds, as are the random variables &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t_2 + \tau)$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$F_{X(t_1), X(t_1 + \tau)}(x,y) = F_{X(t_2), X(t_2 + \tau)}(x,y)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Any &lt;em&gt;three&lt;/em&gt; random variables &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(t_1 + \tau_1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(t_1 + \tau_1 + \tau_2)$&lt;/span&gt; spaced &lt;span class=&quot;math-container&quot;&gt;$\tau_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tau_2$&lt;/span&gt; apart have the same joint CDF as &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(t_2 + \tau_1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(t_2 + \tau_1 + \tau_2)$&lt;/span&gt; which as also spaced &lt;span class=&quot;math-container&quot;&gt;$\tau_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tau_2$&lt;/span&gt; apart. Equivalently, the joint CDF of &lt;span class=&quot;math-container&quot;&gt;$X(t_1), X(t_2), X(t_3)$&lt;/span&gt; is the same as the joint CDF of &lt;span class=&quot;math-container&quot;&gt;$X(t_1+\tau), X(t_2+\tau), X(t_3+\tau)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;and similarly for &lt;em&gt;all&lt;/em&gt; multidimensional CDFs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Effectively, the probabilistic descriptions of the random process do not depend on what we choose to call the origin on the time axis: shifting all time instants &lt;span class=&quot;math-container&quot;&gt;$t_1, t_2, \ldots, t_n$&lt;/span&gt; by some fixed amount &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$t_1 + \tau, t_2 + \tau, \ldots, t_n + \tau$&lt;/span&gt; gives the same probabilistic description of the random variables.   This property is called &lt;em&gt;strict-sense stationarity&lt;/em&gt; and a random process that enjoys this property is&#xA;called a strictly stationary random process or, more simply, a stationary random process. Be aware that in some of the statistics literature (especially the parts related to econometrics and time-series analysis), stationary processes are defined somewhat differently; in fact as what are described later in this answer as &lt;em&gt;wide-sense stationary&lt;/em&gt; processes.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Note that strict stationarity by itself does not require any particular form of CDF.  For example, it does not say that all the variables are Gaussian.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The adjective &lt;em&gt;strictly&lt;/em&gt; suggests that  is possible to define a looser form of stationarity. If the &lt;span class=&quot;math-container&quot;&gt;$N^{\text{th}}$&lt;/span&gt;-order joint CDF of&#xA;&lt;span class=&quot;math-container&quot;&gt;$X(t_1), X(t_2), \ldots, X(t_N)$&lt;/span&gt; is the same as the &lt;span class=&quot;math-container&quot;&gt;$N^{\text{th}}$&lt;/span&gt;-order joint CDF of &lt;span class=&quot;math-container&quot;&gt;$X(t_1+\tau), X(t_2+\tau), \ldots, X(t_N +\tau)$&lt;/span&gt; for all&#xA;choices of &lt;span class=&quot;math-container&quot;&gt;$t_1,t_2, \ldots, t_N$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, then the random process&#xA;is said to be stationary to order &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and is referred to as a &lt;span class=&quot;math-container&quot;&gt;$N^{\text{th}}$&lt;/span&gt;-order stationary random process. Note that a&#xA;&lt;span class=&quot;math-container&quot;&gt;$N^{\text{th}}$&lt;/span&gt;-order stationary random process is also stationary&#xA;to order &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; for each positive &lt;span class=&quot;math-container&quot;&gt;$n &amp;lt; N$&lt;/span&gt;. (This is because the &lt;span class=&quot;math-container&quot;&gt;$n^{\text{th}}$&lt;/span&gt;-order joint CDF is the limit of the &lt;span class=&quot;math-container&quot;&gt;$N^{\text{th}}$&lt;/span&gt;-order CDF as &lt;span class=&quot;math-container&quot;&gt;$N-n$&lt;/span&gt; of the arguments approach &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;: a generalization of  &lt;span class=&quot;math-container&quot;&gt;$F_X(x) = \lim_{y\to\infty}F_{X,Y}(x,y)$&lt;/span&gt;). A strictly stationary random&#xA;process then is a random process that is stationary to all orders &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If a random process is stationary to (at least) order &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, then all the &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt;'s have the same distribution and so, assuming the mean exists, &lt;span class=&quot;math-container&quot;&gt;$E[X(t)] = \mu$&lt;/span&gt; is the same for all &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.  Similarly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$E[(X(t))^2]$&lt;/span&gt; is the same for all &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, and is referred to as the &lt;em&gt;power&lt;/em&gt; of the process.&#xA;All physical processes have &lt;em&gt;finite&lt;/em&gt; power and so it is common to assume that&#xA;&lt;span class=&quot;math-container&quot;&gt;$E[(X(t))^2] &amp;lt; \infty$&lt;/span&gt; in which case, and especially in the older engineering&#xA;literature, the process is called a &lt;em&gt;second-order&lt;/em&gt; process. The choice&#xA;of name is unfortunate because it invites confusion with second-order&#xA;&lt;em&gt;stationarity&lt;/em&gt; (cf. &lt;a href=&quot;https://stats.stackexchange.com/a/65359/6633&quot;&gt;this answer of mine on stats.SE&lt;/a&gt;), and so here we will call&#xA;a process for which &lt;span class=&quot;math-container&quot;&gt;$E[(X(t))^2]$&lt;/span&gt; is finite for all &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; (whether or&#xA;not &lt;span class=&quot;math-container&quot;&gt;$E[(X(t))^2]$&lt;/span&gt; is a constant) as a &lt;em&gt;finite-power&lt;/em&gt; process and avoid this confusion.&#xA;But note again that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a first-order stationary process &lt;em&gt;need not be&lt;/em&gt; a finite-power process.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Consider a random process that is stationary to order &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. Now, since the joint distribution of &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t_1 + \tau)$&lt;/span&gt; is the same as the joint distribution function of &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t_2 + \tau)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$E[X(t_1)X(t_1 + \tau)] = E[X(t_2)X(t_2 + \tau)]$&lt;/span&gt; and the value depends only on &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;.  These expectations are finite&#xA;for a finite-power process and their value is called the autocorrelation function of the process: &lt;span class=&quot;math-container&quot;&gt;$R_X(\tau) = E[X(t)X(t+\tau)]$&lt;/span&gt; is a function of &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, the time separation of the random variables &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t+\tau)$&lt;/span&gt;, and does not depend on &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; at all.  Note also that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E[X(t)X(t+\tau)] = E[X(t+\tau)X(t)] = E[X(t+\tau)X(t + \tau - \tau)] = R_X(-\tau),$$&lt;/span&gt; and so&#xA;the autocorrelation function is an even function of its argument.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A finite-power &lt;em&gt;second-order stationary&lt;/em&gt; random process has the properties that&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Its mean &lt;span class=&quot;math-container&quot;&gt;$E[X(t)]$&lt;/span&gt; is a constant&lt;/li&gt;&#xA;&lt;li&gt;Its autocorrelation function &lt;span class=&quot;math-container&quot;&gt;$R_X(\tau) = E[X(t)X(t+\tau)]$&lt;/span&gt; is a function of &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, the time separation of the random variables &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t+\tau)$&lt;/span&gt;, and does not depend on &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; at all.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The assumption of stationarity simplifies the description of a random process to some extent but, for engineers and statisticians interested in building models from experimental data, estimating all those CDFs is a nontrivial task, particularly when there is only a segment of one sample path (or realization) &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; on which measurements can be made. Two measurements&#xA;that are relatively easy to make (because the engineer already has the necessary instruments on his workbench (or programs in MATLAB/Python/Octave/C++ in his software library) are the &lt;em&gt;DC value&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac 1T\int_0^T x(t)\,\mathrm dt$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; and the autocorrelation function &lt;span class=&quot;math-container&quot;&gt;$R_x(\tau) = \frac 1T\int_0^T x(t)x(t+\tau)\,\mathrm dt$&lt;/span&gt; (or its Fourier transform, the power spectrum of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;). Taking these measurements as &lt;em&gt;estimates&lt;/em&gt; of the mean and the autocorrelation function of a finite-power&#xA;process leads to a very useful model that we discuss next.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A finite-power random process is called a &lt;em&gt;wide-sense-stationary&lt;/em&gt; (WSS) process (also &lt;em&gt;weakly&lt;/em&gt; stationary stochastic process which fortunately also&#xA;has the same initialism WSS) if it has a constant mean and its autocorrelation function &lt;span class=&quot;math-container&quot;&gt;$R_X(t_1, t_2) = E[X(t_1)X(t_2)]$&lt;/span&gt; depends only on the time difference &lt;span class=&quot;math-container&quot;&gt;$t_1 - t_2$&lt;/span&gt;  (or &lt;span class=&quot;math-container&quot;&gt;$t_2 - t_1$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Note that the definition says &lt;em&gt;nothing&lt;/em&gt; about the CDFs of the random&#xA;variables comprising the process; it is entirely a constraint on the&#xA;first-order and second-order &lt;em&gt;moments&lt;/em&gt; of the random variables. Of course, a finite-power second-order stationary (or &lt;span class=&quot;math-container&quot;&gt;$N^{\text{th}}$&lt;/span&gt;-order stationary (for &lt;span class=&quot;math-container&quot;&gt;$N&amp;gt;2$&lt;/span&gt;) or strictly stationary) random process &lt;em&gt;is&lt;/em&gt;&#xA;a WSS process, but the converse need not be true.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A WSS process need not be stationary to any order.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Consider, for example, the random process&#xA;&lt;span class=&quot;math-container&quot;&gt;$\{X(t)\colon X(t)= \cos (t + \Theta), -\infty &amp;lt; t &amp;lt; \infty\}$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\Theta$&lt;/span&gt; takes on four equally likely values &lt;span class=&quot;math-container&quot;&gt;$0, \pi/2, \pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3\pi/2$&lt;/span&gt;. (Do not be scared: the four possible sample paths of this random process are just the four signal waveforms of a QPSK signal).&#xA;Note that each &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; is a &lt;em&gt;discrete&lt;/em&gt; random variable that, in general, takes on four equally likely values &lt;span class=&quot;math-container&quot;&gt;$\cos(t), \cos(t+\pi/2)=-\sin(t), \cos(t+\pi) = -\cos(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos(t+3\pi/2)=\sin(t)$&lt;/span&gt;,  It is easy to see that in general &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(s)$&lt;/span&gt; have different distributions, and so the process is not even first-order stationary. On the other hand,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E[X(t)] = \frac 14\cos(t)+&#xA;\frac 14(-\sin(t)) + \frac 14(-\cos(t))+\frac 14 \sin(t)  = 0$$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; while&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;E[X(t)X(s)]&amp;amp;= \left.\left.\frac 14\right[\cos(t)\cos(s) +  (-\cos(t))(-\cos(s)) + \sin(t)\sin(s) + (-\sin(t))(-\sin(s))\right]\\&#xA;&amp;amp;= \left.\left.\frac 12\right[\cos(t)\cos(s) + \sin(t)\sin(s)\right]\\&#xA;&amp;amp;= \frac 12 \cos(t-s).&#xA;\end{align}&lt;/span&gt;&#xA;In short, the process has zero mean and its autocorrelation function depends only on the time difference &lt;span class=&quot;math-container&quot;&gt;$t-s$&lt;/span&gt;, and so the process &lt;em&gt;is&lt;/em&gt; wide sense stationary. But it is not first-order stationary and so cannot be&#xA;stationary to higher orders either.&lt;/p&gt;&#xA;&lt;p&gt;Even for WSS processes that &lt;em&gt;are&lt;/em&gt; second-order stationary (or strictly stationary) random processes, little can be&#xA;said about the specific forms of the &lt;em&gt;distributions&lt;/em&gt; of the random variables.  In short,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A WSS process is not necessarily stationary (to any order), and the mean and autocorrelation function of&#xA;a WSS process is &lt;em&gt;not enough&lt;/em&gt; to give a complete statistical description&#xA;of the process.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;WSS processes are a &lt;em&gt;subclass&lt;/em&gt; of what are called &lt;em&gt;covariance-stationary&lt;/em&gt; random processes. Covariance-stationary processes have the property that the _covariance function of the process,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}C_X(t_1,t_2) &amp;amp;= \operatorname{cov}(X(t_1), X(t_2))\\&#xA;&amp;amp;= E[(X(t_1)-\mu_X(t_1))(X(t_2)-\mu_X(t_2))]\\&#xA;&amp;amp;=E[X(t_1)X(t_2)]-\mu_X(t_1)\mu_X(t_2),\end{align}&lt;/span&gt; is a function only of &lt;span class=&quot;math-container&quot;&gt;$t_1-t_2$&lt;/span&gt; and not of the individual values of &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t_2$&lt;/span&gt;. (Notice the absence of any claim that the mean is a constant). Since for a WSS process, &lt;span class=&quot;math-container&quot;&gt;$$C_X(t_1,t_2) = R_X(t_1,t_2)-\mu_X(t_1)\mu_X(t_2)=R_X(t_1-t_2)-\mu_X^2$$&lt;/span&gt;&#xA;is a function only of &lt;span class=&quot;math-container&quot;&gt;$t_1-t_2$&lt;/span&gt;, we see that every WSS process is a covariance-stationary process. In fact, the prototypical covariance-stationary process is of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\{X(t) \colon t \in {\mathbb T}\} = \{Y(t) + s(t)\colon t \in {\mathbb T}\}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{Y(t)\colon t \in {\mathbb T}\}$&lt;/span&gt; is a &lt;em&gt;zero-mean&lt;/em&gt; WSS process. It is a model for a deterministic signal &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt; observed in the noise &lt;span class=&quot;math-container&quot;&gt;$Y(t)$&lt;/span&gt;.&#xA;The verification of the claim that the prototypical process is indeed a covariance-stationary process is left as an exercise for the reader.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Finally, suppose that a stochastic process is &lt;strong&gt;assumed&lt;/strong&gt; to be a &lt;em&gt;Gaussian&lt;/em&gt; process (&amp;quot;proving&amp;quot; this with any reasonable degree of confidence is not a trivial task).&#xA;This means that for each &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; is a Gaussian random variable and for all positive integers &lt;span class=&quot;math-container&quot;&gt;$n \geq 2$&lt;/span&gt; and choices of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; time instants &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$t_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ldots, t_n$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;&#xA;random variables &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ldots, X(t_n)$&lt;/span&gt; are &lt;em&gt;jointly Gaussian&lt;/em&gt; random&#xA;variables.  Now a joint Gaussian density function is &lt;em&gt;completely&lt;/em&gt; determined by the means &lt;span class=&quot;math-container&quot;&gt;$E[X(t_i)]= \mu_X(t_i)$&lt;/span&gt;, variances&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\operatorname{var}(X(t_i)) &amp;amp;= E[(X(t_i)-\mu_X(t_i))^2]\\&#xA;&amp;amp;= E[(X(t_i)^2]-(\mu_X(t_i))^2\\&amp;amp;= R_X(t_i,t_i)-(\mu_X(t_i))^2,\end{align}&lt;/span&gt; and covariances&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\operatorname{cov}(X(t_i),X(t_j)) &amp;amp;= E[(X(t_i)-\mu_X(t_i)])(X(t_j)-\mu_X(t_j))]\\&amp;amp;= E[X(t_i)X(t_j)]-\mu_X(t_i)\mu_X(t_j)\\&#xA;&amp;amp;=R_X(t_i,t_j)-\mu_X(t_i)\mu_X(t_j)\end{align}&lt;/span&gt;&#xA;of the random variables. Thus, knowing the mean function &lt;span class=&quot;math-container&quot;&gt;$\mu_X(t) = E[X(t)]$&lt;/span&gt; (it need not be a constant as is required for wide-sense-stationarity) and the autocorrelation function &lt;span class=&quot;math-container&quot;&gt;$R_X(t_1, t_2) = E[X(t_1)X(t_2)]$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$t_1, t_2$&lt;/span&gt; (it need not depend only on &lt;span class=&quot;math-container&quot;&gt;$t_1-t_2$&lt;/span&gt; as is required for wide-sense-stationarity) is sufficient to determine the statistics of the process completely.&lt;/p&gt;&#xA;&lt;p&gt;If a Gaussian process &lt;em&gt;is&lt;/em&gt; a WSS process, then&#xA;it is also a &lt;em&gt;strictly stationary&lt;/em&gt; Gaussian process.  Fortunately&#xA;for engineers and signal processors, many physical noise processes&#xA;can be well-modeled as WSS Gaussian processes (and therefore strictly&#xA;stationary processes), so that experimental observation of the&#xA;autocorrelation function readily provides all the joint distributions.&#xA;Furthermore since Gaussian processes retain their Gaussian character&#xA;as they pass through linear systems, and the output autocorrelation&#xA;function is related to th input autocorrelation function as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_y = h*\tilde{h}*R_X$$&lt;/span&gt;&#xA;so that the output statistics can also be easily determined, WSS&#xA;process in general and WSS Gaussian processes in particular are&#xA;of great importance in engineering applications.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2022-02-14T20:00:53.053" LastActivityDate="2022-02-14T20:00:53.053" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="489" PostTypeId="1" AcceptedAnswerId="492" CreationDate="2011-10-25T06:44:06.650" Score="5" ViewCount="386" Body="&lt;p&gt;I have a 1D signal that is roughly periodical (but not exactly) - think of some kind of motion that someone performs repeatedly, and which is measured by some sensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a way to&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;automatically chop up the signal into the individual cycles, and&lt;/li&gt;&#xA;&lt;li&gt;somehow calculate an &quot;average&quot; that preserves the characteristics of the measured motion&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How could this be done?&lt;/p&gt;&#xA;" OwnerUserId="477" LastActivityDate="2011-10-25T21:14:11.013" Title="Chopping up and averaging a signal" Tags="|discrete-signals|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="490" PostTypeId="2" ParentId="460" CreationDate="2011-10-25T07:12:31.663" Score="1" Body="&lt;p&gt;In terms of pitch estimation, few people have published more extensively than Anssi Klapuri. I hope you find these papers useful &gt; &lt;a href=&quot;http://www.elec.qmul.ac.uk/people/anssik/publications.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.elec.qmul.ac.uk/people/anssik/publications.htm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-10-25T07:12:31.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="491" PostTypeId="2" ParentId="489" CreationDate="2011-10-25T07:18:58.000" Score="0" Body="&lt;p&gt;You can use &quot;zero crossing detection&quot; to segment your signal. Provided each of the segments are of equal length, i.e, you have a periodic signal, you can then get the point by point mean of all segments. If on the other hand, your segments are of different lengths, you may need to normalise the length of each segment using resampling or something more exotic if each period of the signal has variable characteristics. &lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-10-25T07:18:58.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="492" PostTypeId="2" ParentId="489" CreationDate="2011-10-25T09:47:31.680" Score="1" Body="&lt;p&gt;What you need to achieve is to estimate the typical periodicity of a cycle. What is required is to do harmonic analysis on the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are few things - i am making assumption which is critical to your solution. &#xA;1. Signal you have is not a fixed analytical expression but some arbitrary format. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;We don't quite know a prior what could be the range of periodicity. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is periodic but not perfectly - so we should rather treat it is a random process rather than a pure analytical function. There is probably noise at play as well - but we will worry about it a bit later.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We need to implement such a system - so we are more interested in discrete time representation of signal and a device to detect such periodicity rather than analytic solution of the given arbitrary function in continuous time. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To describe the solution - we shall start the other way and include each assumption. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;a. Case for perfect periodic signal&lt;/em&gt;. &#xA;Suppose if you have a pure sine wave of a frequency say Omega - W. Since it is expressed as an infinite time continuous sequence, the frequency domain is a finite spectrum - which is pure impulse. So If we can observe the signal in a frequency domain - the position of the said impulse is nothing but the periodicity of the wave form. That's quite easy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the signal is sampled (as it would be in real world) as opposed to an analytical form - the resultant frequency response is Discrete Time Fourier Transform - where one see continuous &lt;em&gt;lobes&lt;/em&gt; rather than impulses in frequency domain. Here the dominant and subordinates lobes are equivalent to the frequency impulses earlier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;b. what if the signal is not analytic form but arbitrary&lt;/em&gt;&#xA;Now consider a case of the square wave or any such similar function. For a square wave what you will see is that now you will have many more harmonics. But you will notice one important thing. The primary harmonic you will observe will be also the one which has highest energy - and &lt;em&gt;THAT&lt;/em&gt; is also the periodicity. This is usually known as Dominant harmonic. For any arbitrary signal we need to consider DOMINANT harmonic which is the best approximation of the frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;c. when signal is not perfectly periodic&lt;/em&gt; &#xA;When the signal is not perfectly periodic, the observation in frequency spectrum is time varying. In such cases, the primary dominant frequency component will fluctuate around the most expected periodicity. If the periodicity is firm - only shape varies - the location of the dominant component will be static but magnitude of all critical composition will vary. If the periodicity also fluctuates - the same fluctuation will be visible in the position of the frequency component and consequently one needs to &lt;em&gt;&quot;track&quot;&lt;/em&gt; such a change over time which is the information we are seeking essentially. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So looking at a, b, and c - the conclusion is simpler - find the dominant principle component (and track it). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;d. when the signal is finite time&lt;/em&gt; &#xA;When the signal is finite in time - the spectrum is infinite - in such cases one usually cannot hope to plot the infinitely long frequency spectrum. However, typically the approaches with finding Segment wise is to have apply the STFT domain &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is the catch. What should be the Finite time window for which Finite frequency spectrum should be calculated? The simple answer is the larger the periodicity - even larger needs to be the size of the window. This is equivalent of Nyquist criteria but not exactly same. In order to capture the real periodicity - multiple dominant cycles must be visible in the given Time window span - to ensure that frequency of measured accurately. However, this means that period for which periodicity is measured is larger than a few cycles at least; but this means resolution of change estimate is lesser. Higher the period higher the accuracy - lesser the resolution of change! This is known as uncertainty principle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, a large number of approaches to do pitch detection from a speech signal does exactly this - and most tools use STFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Over time- of course, more modern way of doing things are based on wavelet based approaches. Wavelets doesn't eliminate the uncertainty principle but just hope to get you closest combination of resolution and accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dipan. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2011-10-25T09:47:31.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="493" PostTypeId="1" CreationDate="2011-10-25T11:10:50.687" Score="8" ViewCount="1355" Body="&lt;p&gt;I'm in a biomedical engineering master's program and am mostly interested in signal processing. Unfortunately, I feel that I'd like to get deeper into the subject, and my university can't accommodate that request -- there's a limited number of courses, and the professor I've asked doesn't know of any local project that I could join.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any open source projects related to biomedical/bioelectric signal processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, could you recommend any other type of beneficial extracurricular activities? I could probably spend 1-2h a day on this project.&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2011-10-26T08:35:24.487" Title="Are there any open source biomedical signal processing projects?" Tags="|soft-question|" AnswerCount="3" CommentCount="1" CommunityOwnedDate="2011-10-25T14:02:56.523" ContentLicense="CC BY-SA 3.0" />
  <row Id="494" PostTypeId="2" ParentId="493" CreationDate="2011-10-25T12:04:34.253" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://ocw.mit.edu/courses/&quot; rel=&quot;nofollow&quot;&gt;MIT OpenCourseWare&lt;/a&gt; is a great resource containing free course materials for actual MIT courses. In the department of &lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/&quot; rel=&quot;nofollow&quot;&gt;Electrical Engineering and Computer Science&lt;/a&gt;, there may be some courses of interest that you could go through. A quick look shows &lt;a href=&quot;http://ocw.mit.edu/courses/health-sciences-and-technology/hst-582j-biomedical-signal-and-image-processing-spring-2007/&quot; rel=&quot;nofollow&quot;&gt;Biomedical Signal and Image Processing&lt;/a&gt; and &lt;a href=&quot;http://ocw.mit.edu/courses/health-sciences-and-technology/hst-950j-biomedical-computing-fall-2010/&quot; rel=&quot;nofollow&quot;&gt;Biomedical Computing&lt;/a&gt;, which might be up your alley.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-10-25T12:04:34.253" CommentCount="0" CommunityOwnedDate="2011-10-25T14:02:56.523" ContentLicense="CC BY-SA 3.0" />
  <row Id="495" PostTypeId="2" ParentId="493" CreationDate="2011-10-25T12:37:43.517" Score="2" Body="&lt;p&gt;For image processing in biology, there is the &lt;a href=&quot;http://fiji.sc/wiki/index.php/Fiji&quot; rel=&quot;nofollow&quot;&gt;FIJI&lt;/a&gt; project, a very worthwhile endeavor. They have a list of &lt;a href=&quot;http://fiji.sc/wiki/index.php/Project_ideas&quot; rel=&quot;nofollow&quot;&gt;project ideas&lt;/a&gt; as well, maybe there's something that's perfect for you? &lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2011-10-25T12:37:43.517" CommentCount="0" CommunityOwnedDate="2011-10-25T14:02:56.523" ContentLicense="CC BY-SA 3.0" />
  <row Id="496" PostTypeId="1" AcceptedAnswerId="503" CreationDate="2011-10-23T22:53:44.443" Score="7" ViewCount="857" Body="&lt;p&gt;It has been a long time since I studied engineering, please forgive my mistakes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got data sampled from a digital accelerometer. It is sampled at 20 hz, then collapsed into 1 second epochs. The data is then filtered to remove noise.  The system outputs 0 at rest, a lot more during activity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking at the fourier transform of the signal, 1024 samples, sampled once per second. I'm  seeing this: &lt;img src=&quot;https://i.stack.imgur.com/S2HGJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a real-imaginary plot of the real-imaginary results of the Fourier transform.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0QUmD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal appears to be a helix in frequency domain.The system appears to oscillate around some limit cycle within frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? &#xA;Is Fourier transform completely wrong for the digital signal?&#xA; Should using only the &lt;strong&gt;DFT&lt;/strong&gt; for this kind of analysis? &#xA;Is my &lt;strong&gt;window size&lt;/strong&gt; wrong ?&#xA; &lt;strong&gt;Am I seeing aliasing due to incorrect window size&lt;/strong&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been a few years since my last engineering class, and I'd really appreciate any help on the subject. I got 3 books on engineering, signal analysis and transforms, but it takes time for this kind of knowledge to come back to me. &lt;/p&gt;&#xA;" OwnerUserId="480" OwnerDisplayName="Alex Stone" LastActivityDate="2011-10-25T20:51:05.860" Title="Weird results out of fourier transform of unknown signal, what am I doing wrong?" Tags="|frequency|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="497" PostTypeId="2" ParentId="496" CreationDate="2011-10-24T00:31:24.487" Score="3" Body="&lt;p&gt;&lt;strong&gt;Possible thought starters:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ensure that input to ADC is low pass  filtered to well below half sampling rate to avoid aliasing. At 20 Hz sample you need either a &quot;barn door&quot; infinite cutoff low pass filter at 10 Hz or something real at somewhat lower. Sheet 21 has a feel of aliasing components, but maybe not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 second samples with a cutoff frequency below 10 Hz only gives you a few samples. I may be totally missing what you are really doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowing may be needed to handle other than complete waveform cycles included in the sampled window. For few samples and frequency components which have arbitrary parts of a cycle included in an FFT pass you can generate strong non-existent components.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT should deal with in-pass-band noise. Your &quot;noise filtering&quot; may also be data filtering. You need a Nyquist rate filter as above but then anything in the remaining passband is potentially legitimate signal.&lt;/p&gt;&#xA;" OwnerUserId="47816" OwnerDisplayName="Russell McMahon" LastActivityDate="2011-10-24T00:31:24.487" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="498" PostTypeId="2" ParentId="454" CreationDate="2011-10-25T13:09:29.183" Score="7" Body="&lt;p&gt;It looks like a problem for texture segmentation (not a color segmentation)&lt;/p&gt;&#xA;&lt;p&gt;There are many methods:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://note.sonots.com/SciSoftware/GaborTextureSegmentation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gabor wavelets&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ttic.uchicago.edu/%7Exren/research/superpixel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superpixels based segmentation&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Graph_cuts_in_computer_vision&quot; rel=&quot;nofollow noreferrer&quot;&gt;Graph Cut Segmentation&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Segmentation_(image_processing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Segmentation&lt;/a&gt; has a great overview of the subject.&lt;/p&gt;&#xA;" OwnerUserId="198" LastEditorUserId="7092" LastEditDate="2022-06-29T12:53:24.813" LastActivityDate="2022-06-29T12:53:24.813" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="499" PostTypeId="2" ParentId="489" CreationDate="2011-10-25T13:33:25.933" Score="1" Body="&lt;p&gt;You can probably use &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow&quot;&gt;autocorrelation&lt;/a&gt; to get an approximate cycle length, if you don't know it already.  Then search around that length for zero crossings or local maxima or whatever signifies the beginning of a cycle.  You need to describe the signal in more detail.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2011-10-25T13:33:25.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="500" PostTypeId="1" CreationDate="2011-10-19T00:47:13.323" Score="6" ViewCount="528" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M1ZxH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;    &lt;br&gt;I have an object (orange color object) and I know its centroid/center mass C. I want program to automatically find another point ( can be point 1, point 2, point 3 or point 4 and so on) such that the line connect point C and one of those points (so as green line in figure 2) must stay inside the object. Moreover, the green line length must be as long as possible, or at least 3/4 of the maximum length. The yellow point in figure bottom is not qualified because the violet line which connect it to the center mass C has a part which is not inside the object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea? I am doing it on Matlab (image processing)&lt;/p&gt;&#xA;" OwnerDisplayName="John" LastActivityDate="2011-10-25T17:15:58.223" Title="find a line go through the center mass and that line must be inside object area" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="501" PostTypeId="2" ParentId="500" CreationDate="2011-10-24T15:47:06.900" Score="1" Body="&lt;p&gt;How about:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Separate the foreground from the background and keep a list of indices or a logical mask from the background&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert the image to a (rho, theta) coordinate space, meaning that each pixel is encoded by the angle and length of vector from the origin to itself. You can scan along this vector to see if you encounter any background pixels. Have a look at the so-called &lt;a href=&quot;http://www2.ee.ic.ac.uk/publications/p4673.pdf&quot; rel=&quot;nofollow&quot;&gt;Trace Transform&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alternatively you can stay in the original coordinate domain and use &lt;a href=&quot;http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm&quot; rel=&quot;nofollow&quot;&gt;Bresenham's line algorithm&lt;/a&gt; to get all pixels belonging to a scan-line between a point and the center and then comparing them against the list of background labeled pixels.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Perhaps you can optimize a bit by starting on the edge of the foreground shape, working your way inward to the center, discarding any scan-line the moment it encounters a background labeled pixel. &lt;/p&gt;&#xA;" OwnerUserId="420" OwnerDisplayName="Maurits" LastActivityDate="2011-10-24T15:47:06.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="503" PostTypeId="2" ParentId="496" CreationDate="2011-10-25T18:45:08.287" Score="7" Body="&lt;p&gt;My guess: nothing to see here. Move along.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention that &quot;the signal appears to be a helix in [the] frequency domain&quot;. I assert that what this helix &lt;em&gt;really&lt;/em&gt; is, is a complex exponential. And there is nothing wrong with that, because complex exponentials are what you get when you time-delay a signal: $f(x-a)\Leftrightarrow \hat{f}(\xi)e^{-2\pi i a \xi}$. The helix pattern simply reflects that most of the power in the signal you are acquiring isn't located at $T=0$. (And it shouldn't be there anyway!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eyeballing, the period of oscillation in your frequency plot appears to be ~28 samples. At a sampling rate of 20hz, if what I'm saying is true, then most of the energy in your time-domain signal should be centered roughly around $t\approx\frac{28}{20}=1.4$ seconds. Was I close?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;real&lt;/em&gt; problem here is likely to be your plots. It seems like you're plotting raw real/imag DFT outputs. Don't do that. Instead, compute magnitude/phase from real/imag values, and plot that.&lt;/p&gt;&#xA;" OwnerUserId="448" LastActivityDate="2011-10-25T18:45:08.287" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="504" PostTypeId="2" ParentId="328" CreationDate="2011-10-25T19:07:38.037" Score="6" Body="&lt;p&gt;The DCT has very good energy compaction for a lot of common signals, and it also meshes fairly well with how diffraction (the underlying physical process in imaging) works, as diffraction can be represented as a fourier kernel.  These give it a lot of advantages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the DCT coefficients are necessarily delocalized over the entire transform area.  This requires that many small transform areas (blocks) be created so that energy in one area does not spill over into another when transforming.  This both restricts the ability of the transform to compact energy, and also introduces artifacts at the many block boundaries.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't done much with wavelets so I could be wrong, but they're more delocalized, with different coefficients representing different area/frequency tradeoffs.  This allows larger block sizes with less artifacts.  No sure in practice how much of a difference that really makes though.  &lt;/p&gt;&#xA;" OwnerUserId="479" LastActivityDate="2011-10-25T19:07:38.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="505" PostTypeId="2" ParentId="496" CreationDate="2011-10-25T20:51:05.860" Score="2" Body="&lt;p&gt;What you are seeing is the fact that your 1 second &quot;epoch&quot; window is not synchronized to your data.  The phase of the FFT results are relative to the edge of the window, and thus will rotate as your window edge moves along to different phase relationships with your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you actually care about phase or relative phase, lock the window offset to the period of your signal.  If you don't care about phase just calculate the magnitude of the complex result and use that.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-25T20:51:05.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="506" PostTypeId="2" ParentId="489" CreationDate="2011-10-25T21:14:11.013" Score="0" Body="&lt;p&gt;An alternative to &quot;chopping up&quot; and averaging a &quot;roughly&quot; periodic signal might be frequency domain analysis and resynthesis.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Window some (large enough) multiple of periods, calculate the FFT, extract an estimate of the fundamental frequency (perhaps an interpolated peak), plus the estimated peak component of all the significant harmonics, plus the phase of these harmonics relative to the fundamental, discard everything else not related to your chosen fundamental period, then use the overtone series for the resynthesis one &quot;template&quot; period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the fundamental frequency might be missing or nearly so, and, if so, that you may have to guess the roughly correct range of the fundamental frequency to avoid the infinite suboctave or subharmonic problem.  This would be true with autocorrelation analysis as well.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-25T21:14:11.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="507" PostTypeId="2" ParentId="493" CreationDate="2011-10-26T08:35:24.487" Score="1" Body="&lt;p&gt;You might also be interested in Yale's open course material on the subject: &lt;a href=&quot;http://oyc.yale.edu/biomedical-engineering/frontiers-in-biomedical-engineering/&quot; rel=&quot;nofollow&quot;&gt;Frontiers in Biomedical Engineering&lt;/a&gt;. It isn't focused on biomedical signal processing per se but discusses at some length the possibilities of engineering solutions in the biomedical industry.&lt;/p&gt;&#xA;" OwnerUserId="469" LastActivityDate="2011-10-26T08:35:24.487" CommentCount="0" CommunityOwnedDate="2011-10-26T08:35:24.487" ContentLicense="CC BY-SA 3.0" />
  <row Id="508" PostTypeId="1" CreationDate="2011-10-26T08:58:21.240" Score="10" ViewCount="442" Body="&lt;p&gt;My problem is that I don't know the energy of the background noise, so I can't just threshold the energy. The processing is done in real time, and I have about 500msec to decide.&#xA;Ideally, I'd want quiet consonants considered non-silence.&lt;/p&gt;&#xA;" OwnerUserId="519" LastActivityDate="2011-10-27T11:25:28.090" Title="How to segment phone call audio into silence/non silence?" Tags="|audio|speech-recognition|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="509" PostTypeId="1" AcceptedAnswerId="510" CreationDate="2011-10-26T12:26:50.400" Score="26" ViewCount="62931" Body="&lt;p&gt;If I have a signal that is time limited, say a sinusoid that only lasts for $T$ seconds, and I take the FFT of that signal, I see the frequency response. In the example this would be a spike at the sinusoid's main frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, say I take that same time signal and delay it by some time constant and then take the FFT, how do things change? Is the FFT able to represent that time delay? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recognize that a time delay represents a $\exp(-j\omega t)$ change in the frequency domain, but I'm having a hard time determining what that actually &lt;em&gt;means&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically speaking, is the frequency domain an appropriate place to determine the time delay between various signals?&lt;/p&gt;&#xA;" OwnerUserId="461" LastEditorUserId="15892" LastEditDate="2018-08-22T20:08:00.983" LastActivityDate="2023-03-07T21:32:58.937" Title="What effect does a delay in the time domain have in the frequency domain?" Tags="|fft|fourier-transform|delay|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="510" PostTypeId="2" ParentId="509" CreationDate="2011-10-26T13:44:57.790" Score="27" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot;&gt;discrete Fourier transform (DFT)&lt;/a&gt;, commonly implemented by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot;&gt;fast Fourier transform (FFT)&lt;/a&gt;, maps a finite-length sequence of discrete time-domain samples into an equal-length sequence of frequency-domain samples. The samples in the frequency domain are in general complex numbers; they represent coefficients that can be used in a weighted sum of complex exponential functions in the time domain to reconstruct the original time-domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These complex numbers represent an &lt;em&gt;amplitude&lt;/em&gt; and &lt;em&gt;phase&lt;/em&gt; that is associated with each exponential function. Thus, each number in the FFT output sequence can be interpreted as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;X[k] = \sum_{n=0}^{N-1} x[n] e^{\frac{-j 2 \pi n k}{N}} = A_k e^{j \phi_k}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can interpret this as follows: if you want to reconstruct x[n], the signal that you started with, you can take a bunch of complex exponential functions $e^{\frac{j 2 \pi n k}{N}}, k = 0, 1, \ldots, N-1$, weight each one by $X[k] = A_k e^{j \phi_k}$, and sum them. The result is exactly equal (within numerical precision) to $x[n]$. This is just a word-based definition of the inverse DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, speaking to your question, the various flavors of the Fourier transform have the property that a delay in the time domain maps to a phase shift in the frequency domain. For the DFT, this property is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;x[n] \leftrightarrow X[k]&#xD;&#xA;$$&#xA;$$&#xD;&#xA;x[n-D] \leftrightarrow e^{\frac{-j2 \pi k D}{N}}X[k]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, if you delay your input signal by $D$ samples, then each complex value in the FFT of the signal is multiplied by the constant $e^{\frac{-j2 \pi k D}{N}}$. It's common for people to not realize that the outputs of the DFT/FFT are complex values, because they are often visualized as magnitudes only (or sometimes as magnitude and phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I want to point out that there are some subtleties to this rule for the DFT due to its finiteness in time coverage. Specifically, the shift in your signal must be circular for the relation to hold; that is, when you delay $x[n]$ by $D$ samples, you need to wrap the last $D$ samples that were at the end of $x[n]$ to the front of the delayed signal. This wouldn't really match what you would see in a real situation where the signal just doesn't start until after the beginning of the DFT aperture (and is preceded by zeros, for example). You can always get around this by zero-padding the original signal $x[n]$ so that when you delay by $D$ samples, you just wrap around zeros to the front anyway. This relationship only applies to the DFT since it is finite in time; it's does not apply to the classic Fourier transform or &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot;&gt;discrete-time Fourier transform&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-10-26T17:35:26.750" LastActivityDate="2011-10-26T17:35:26.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="511" PostTypeId="2" ParentId="509" CreationDate="2011-10-26T16:10:57.820" Score="3" Body="&lt;p&gt;Gallamine,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This simply means that there will be a phase offset in your FFT vector. When you FFT your (real) signal, your answer will be complex, so you will have real, and imaginary part. If you took their phase, (inverse_tangent(imag/real)), this will display all the phases of the frequencies. The way their phases differ from if you had no delay is related directly to the delay you have in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In matlab you can also get the phase by simply &quot;angle(fft_result)&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way if you do a correlation of your signal with delay and without delay and pick the peak, you can get the delay in that way. In the freq-domain it is subtracting all the phases of your signal with no delay, from all the signal with delay, and taking the average. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2011-10-26T16:10:57.820" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="512" PostTypeId="1" AcceptedAnswerId="522" CreationDate="2011-10-26T16:29:03.933" Score="8" ViewCount="4910" Body="&lt;p&gt;I have a simple BPSK demodulator. Very simply, the signal comes in and is split into two branches, one for I and one for Q. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The I branch is mixed with a sin wave of the carrier, and the Q branch mixed with the cosine wave of the carrier. &lt;/li&gt;&#xA;&lt;li&gt;Then, each of the outputs is convolved with a matched filter, (in this case a root-raised-cosine, which initially pulse shaped my transmitted bits). &lt;/li&gt;&#xA;&lt;li&gt;Now, if I combine both outputs and take the magnitude of both of them (I^2 + Q^2), I get the envelope. &lt;/li&gt;&#xA;&lt;li&gt;From here, I look for peaks, and choose their indicies. &lt;/li&gt;&#xA;&lt;li&gt;I then use those same indicies that I got from (4), and sample my I and Q at those same indicies. Now I have complex softbit values, and am able to correct for any phase or frequency offsets, and can make hard decisions from there. (I have the luxury of post processing btw).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This technique worked well with high to medium SNR. The problem is that with lower SNR (and maybe multipath), I do not know how to perform bullet (4). The problem is that instead of one peak in the envelopes corresponding to one bit, I now have multiple peaks, and 'peak picking' wont work because there are so many to choose from... how is this problem mitigated? This seems to be a bottleneck because if I cannot tell where my 'bit' is, I cannot move forward. Any thoughts?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated, math is good, although I would ask the answers be more pesudo-code /concept oriented in advance. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Thanks to feedback from Dilip, I should also add that I can clearly see 'energy' in the envelope when there is a signal and there isnt a signal. (ie, before my signal arrived), so this leads me to believe that I &lt;em&gt;should&lt;/em&gt; be able to sync/demod and that it isnt an SNR issue solely...&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="13320" LastEditDate="2016-05-13T10:41:01.817" LastActivityDate="2016-05-13T10:41:01.817" Title="How to determine where to sample for demodulation of BPSK signals?" Tags="|sampling|demodulation|bpsk|synchronization|timing|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="513" PostTypeId="1" AcceptedAnswerId="3169" CreationDate="2011-10-26T18:15:05.970" Score="4" ViewCount="3711" Body="&lt;p&gt;I am looking for an algorithm that adds borders to a bitmap image(very much like the photoshop stroke effect) but one that will also have antialiasing to the borders(or one that copies alpha from the original bitmap to make the border look antialiased).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't answer with an algorithm a direction of creating one myself would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*****Update***&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cihox.png&quot; alt=&quot;An example of the stroke effect&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part coloured black is the original ellipse and the part coloured green is the stroke.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stroke is basically adding a contour to the bitmap or edges.&lt;/p&gt;&#xA;" OwnerUserId="483" LastEditorUserId="483" LastEditDate="2011-10-27T11:19:45.413" LastActivityDate="2012-12-24T18:11:43.887" Title="Bitmap border/stroke alogirthm?" Tags="|image-processing|filters|algorithms|edge-detection|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="514" PostTypeId="1" CreationDate="2011-10-26T18:47:22.717" Score="1" ViewCount="89" Body="&lt;p&gt;This question takes off from this &lt;a href=&quot;https://dsp.stackexchange.com/questions/512/how-to-determine-where-to-sample-for-demodulation-of-bpsk-signals&quot;&gt;question regarding syncronization of BPSK signals&lt;/a&gt;. For the sake of argument let us assume 10 samples make up 1 bit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One method currently suggested is break up the envelope of the downmixed and matched filtered I and Q signals into multiple 10 sample bit intervals, Then, the average of those multiple 10-sample long vectors is taken, to yield a final 10-sample long vector. The position with the largest peak is taken to give an estimate of the optimal sampling position for a bit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea in the averaging cancel out the effects of the noise in this case. Can this method be counted on to also mitigate multipath effects? If not, why not? Is it because the position will 'slip' over time? I tend to not think this will happen, but would like your inputs. Thanks&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-05-13T10:40:08.660" Title="What effect does mutipath have on estimating optimal sampling time using the averaging method described therein" Tags="|demodulation|bpsk|multipath|synchronization|timing|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="515" PostTypeId="1" AcceptedAnswerId="553" CreationDate="2011-10-26T20:18:13.440" Score="14" ViewCount="1418" Body="&lt;p&gt;The definition of $\rm SNR$ seems to be somewhat of a tower of babel in industry. What definitions of $\rm SNR$ are there (feel free to site application), and how exactly can it be measured for that applications?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My specific questions on $\rm SNR$ are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How may we measure $\rm SNR$ for a communications system, if we have not yet been able to attain optimal bit sampling timing, and all we have to work with are all the signals in the receiver up to and including the envelope of the I and Q channels? &lt;a href=&quot;https://dsp.stackexchange.com/questions/512/how-to-determine-where-to-sample-for-demodulation-of-bpsk-signals&quot;&gt;See this post for context&lt;/a&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Once we attain optimal bit sampling, and softbits are attained, how best to measure $\rm SNR$ (or $E_bN_0$)? One way I use is:&#xA;$$&#xA;10\log_{10}\left[ \frac{\textrm{mean}\left\{\lvert s_n \rvert^2\right\}}{\textrm{var}\textrm\{\lvert s_n \rvert\textrm\}}\right],&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however I understand this is not suitable for low $\rm SNR$ cases. What other ways exist?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-08-19T08:08:30.177" Title="What are the various definitions for $\rm SNR$, and their associated methods for measuring it?" Tags="|noise|bpsk|snr|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="516" PostTypeId="1" CreationDate="2011-10-26T21:06:20.037" Score="6" ViewCount="197" Body="&lt;p&gt;Let's say I have a time series $ \{t_i, x_i\} $ where the $x_i$ are strictly increasing and the $t_i$ are not regularly spaced. I can define a differential operator as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \Delta_i = \frac{x_i-x_{i-1}}{t_i-t_{i-1}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but that is very noisy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Müller et. alia define a different operator with characteristic time $\tau$ in terms of iterated &lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average&quot; rel=&quot;nofollow&quot;&gt;EMA&lt;/a&gt;s $\epsilon^n_T$ of levels $n=1,2,4$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \Delta_\tau = \gamma(\epsilon^1_{\alpha\tau} + \epsilon^2_{\alpha\tau} - 2\epsilon^4_{\alpha \beta \tau})  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ \gamma=1.22208,\beta=0.65, \alpha^{-1}=\gamma(8\beta-3)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This operator has a good-looking kernel with a nice small tail, but for monotonically increasing series $x$ it is not strictly positive. What differential operator works well but lacks this sign problem?  Should I just be smoothing the straight differentials?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I am tracking how frequently a stock has been mentioned in the news in the last 5 years.  Some days there are no mentions, while on other days they are bountiful.  The rate of mention is of course the derivative of the number of total times the stock has been mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could just smooth the mention counts within a window and be done, but it seems elegant to apply a differential operator to the mention count.  Unfortunately, as I noticed, I get some negative value which are clearly silly.&lt;/p&gt;&#xA;" OwnerUserId="485" LastEditorUserId="485" LastEditDate="2011-10-31T19:04:17.373" LastActivityDate="2011-10-31T19:04:17.373" Title="EWMA based differential that is strictly positive on strictly increasing irregular time series?" Tags="|discrete-signals|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="517" PostTypeId="1" AcceptedAnswerId="523" CreationDate="2011-10-27T07:41:43.300" Score="48" ViewCount="11253" Body="&lt;p&gt;Having two different size of sets of points (2D for simplicity) dispersed within two different size squares the question are that:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- &lt;strong&gt;how to find any occurrence of the the small one through the large one?&lt;/strong&gt;&lt;br&gt;&#xA;2- Any idea on how to rank the occurrences as shown on the following figure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a simple demonstration of the question and a desired solution:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Zo9jf.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 1:&lt;/strong&gt;&lt;br&gt;&#xA;The following figure shows a bit more realistic view of the problem being investigated.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Bhvp1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the comments the following properties apply:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;exact location of points are available&lt;/li&gt;&#xA;&lt;li&gt;exact size of points are available&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;size can be zero(~1) = only a point&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;all points are black on a white background&lt;/li&gt;&#xA;&lt;li&gt;there is no gray-scale/anti-aliasing effect&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is my implementation of the method presented by &lt;code&gt;endolith&lt;/code&gt; with some small changes (I rotated target instead of source since it is smaller and faster in rotation). I accepted 'endolith's answer because I was thinking about that before. About RANSAC I have no experience so far. Furthermore the implementation of RANSAC requires lots of code.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TV2AA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="488" LastEditorUserId="29" LastEditDate="2011-11-18T05:34:18.050" LastActivityDate="2018-05-27T23:32:45.287" Title="Point Pattern Recognition" Tags="|image-processing|computer-vision|image-registration|" AnswerCount="5" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="519" PostTypeId="1" CreationDate="2011-10-27T09:43:19.570" Score="10" ViewCount="4785" Body="&lt;p&gt;I am trying to use the Hough transform for edge detection, and would like to use gradient images as the basis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have done so far, given the image &lt;code&gt;I&lt;/code&gt; of size &lt;code&gt;[M,N]&lt;/code&gt; and its partial derivatives &lt;code&gt;gx&lt;/code&gt;, &lt;code&gt;gy&lt;/code&gt;, is to calculate the gradient angle in each pixel as &lt;code&gt;thetas = atan(gy(x,y) ./ gx&lt;/code&gt;. Similarly I calculate the gradient magnitude as &lt;code&gt;magnitudes = sqrt(gx.^2+gy.^2)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To build the Hough transform, I use the following MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max_rho = ceil(sqrt(M^2 + N^2));&#xA;hough = zeros(2*max_rho, 101);&#xA;for x=1:M&#xA;    for y=1:N&#xA;        theta = thetas(x,y);&#xA;        rho = x*cos(theta) + y*sin(theta);&#xA;&#xA;        rho_idx = round(rho)+max_rho;&#xA;        theta_idx = floor((theta + pi/2) / pi * 100) + 1;&#xA;        hough(rho_idx, theta_idx) = hough(rho_idx, theta_idx) + magnitudes(x,y);&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting Hough transform looks plausible (see &lt;a href=&quot;https://i.stack.imgur.com/hC9mP.png&quot; rel=&quot;noreferrer&quot;&gt;https://i.stack.imgur.com/hC9mP.png&lt;/a&gt;), but when I try to use its maxima as edge parameters in the original image, the results look more or less random. Did I do something wrong in constructing the Hough transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: I had a stupid mistake in my code: &lt;code&gt;rho&lt;/code&gt; was calculated as &lt;code&gt;x*cos(theta)+y*cos(theta)&lt;/code&gt; instead of &lt;code&gt;x*cos(theta)+y*sin(theta)&lt;/code&gt;. That is, I was using two cosines instead of a cosine and a sine. I have edited the code above and the new resulting image is below. This did not give much better edges though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@endolith: To plot an edge, given a maximal value in the &lt;code&gt;hough&lt;/code&gt;-matrix at &lt;code&gt;rho_idx, theta_idx&lt;/code&gt;, I translate the indices to &lt;code&gt;rho,theta&lt;/code&gt; values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;theta = (theta_idx -1) / 100 * pi - pi / 2;&#xA;rho = rho_idx - max_rho;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally I plot the edge as &lt;code&gt;y= (rho - x*cos(theta)) / sin(theta)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pCmV6.png&quot; alt=&quot;New result&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="490" LastEditorUserId="490" LastEditDate="2011-10-28T10:08:52.540" LastActivityDate="2012-01-12T11:10:33.483" Title="How to implement a gradient based Hough transform" Tags="|image-processing|edge-detection|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="520" PostTypeId="2" ParentId="508" CreationDate="2011-10-27T11:25:28.090" Score="4" Body="&lt;p&gt;There are a bunch of parameters that you can look at:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Overall energy&lt;/li&gt;&#xA;&lt;li&gt;Short term spectrum: Speech has a fairly distinctive &quot;pink-like&quot; spectrum and noise (which is happening during the non-speech parts) tends to be white if it's electrically dominated or &quot;red&quot; (i.e. low frequency heavy) if it's acoustic background noise or microphone noise&lt;/li&gt;&#xA;&lt;li&gt;Amplitude statistics. Most noise signals have a Gaussian distribution, speech is closer to a Laplace distribution&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I think a combination of these three should give a fairly robust detection scheme.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-27T11:25:28.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="521" PostTypeId="2" ParentId="519" CreationDate="2011-10-27T12:19:07.833" Score="2" Body="&lt;p&gt;I have no idea whether this an issue but atan() only gives you angles from -90 to +90 degree because of the quadrant ambiguity. To get the full gradient angle (from -180 to 180) you need to use atan2().&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-27T12:19:07.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="522" PostTypeId="2" ParentId="512" CreationDate="2011-10-27T13:45:54.347" Score="9" Body="&lt;p&gt;I have done something similar to this in MATLAB. In my cause, I used an &lt;strong&gt;Early/Late Gate&lt;/strong&gt; clock recovery method to get an &lt;em&gt;estimate&lt;/em&gt; of the offset between transmit and receive symbol timing. This method uses &lt;em&gt;3&lt;/em&gt; samples per symbol - one at the optimal sample time, one that is 1 sample delayed and 1 that is one sample advanced. This works well for on/off keying signals, since there is no negative portion of the signal, but the methods below I think will work better for bipolar signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method is the &lt;strong&gt;Muller and Mueller Algorithm&lt;/strong&gt;, which uses 1 sample per symbol. This uses the equation $e_n = (\widehat{y_n}y_{n-1}) - (y_n\widehat{y}_{n-1})$, where $e_n$ is the error , $y_{n-1}$ and $y_{n}$ are the previous and current symbol samples, and $\widehat{y_n}$ and $\widehat{y}_{n-1}$ are the decision outputs (-1 or +1 in your case). M&amp;amp;M requires that the carrier is recovered first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third algorithm, which is very similar to the one above, is the &lt;strong&gt;Gardner algorithm&lt;/strong&gt;. In this algorithm, the error signal is $e_n = (y_n - y_{n-T})y_{n-T/2}$, where $y_{n-T}$ is the sample one symbol in the past, and $y_{n-T/2}$ is &lt;em&gt;half&lt;/em&gt; a symbol in the past. This requires 2 samples per symbol, but is not sensitive to the carrier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;M&amp;amp;M detector&lt;/em&gt; is looking at the &lt;em&gt;peaks&lt;/em&gt;, while the &lt;em&gt;Gardner&lt;/em&gt; method is looking at the &lt;em&gt;peak&lt;/em&gt; and &lt;em&gt;zero crossing&lt;/em&gt; to get timing estimates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all cases, you'll take the error estimate, feed it into a &lt;strong&gt;loop filter&lt;/strong&gt; whose output is then used to &lt;em&gt;advance&lt;/em&gt; or &lt;em&gt;retard&lt;/em&gt; the symbol clock for the next timing estimate. The loop filter can be thought of as either a low-pass filter, a smoothing filter or simply as weighting older estimates less than newer ones. The loop filter controls a) how fast the timing converges and b) how much noise affects the estimates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to use an &lt;strong&gt;equalizer&lt;/strong&gt; which will then remove timing delay from the signal. This can also help for very noisy signals I believe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used these resources in forming this answer:&#xA;&lt;a href=&quot;http://www.comlab.hut.fi/opetus/333/2004_2005_slides/CarrierTimingRecovery.pdf&quot;&gt;http://www.comlab.hut.fi/opetus/333/2004_2005_slides/CarrierTimingRecovery.pdf&lt;/a&gt;&#xA;http://mobiledevdesign.com/tutorials/radio_matched_filtering_timing/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This article is especially helpful: &lt;a href=&quot;http://rfdesign.com/images/archive/0901Litwin32.pdf&quot;&gt;http://rfdesign.com/images/archive/0901Litwin32.pdf&lt;/a&gt;&#xA;Here is a link to Gardner's original paper from 1986: &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1096561&amp;amp;tag=1&quot;&gt;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1096561&amp;amp;tag=1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; In general this area is called &quot;clock and data recovery&quot; or &quot;CDR&quot;. Specifically we're dealing with &quot;symbol synchronization&quot;. These terms should aid you in your search.&lt;/p&gt;&#xA;" OwnerUserId="461" LastEditorUserId="461" LastEditDate="2011-10-27T14:01:23.410" LastActivityDate="2011-10-27T14:01:23.410" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="523" PostTypeId="2" ParentId="517" CreationDate="2011-10-27T13:59:21.103" Score="17" Body="&lt;p&gt;&lt;em&gt;This is not the best solution, but it's &lt;strong&gt;a&lt;/strong&gt; solution.  I'd like to learn of better techniques:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they were not going to be rotated or scaled, you could use a simple cross-correlation of the images. There will be a bright peak wherever the small image occurs in the large image. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mathworks.com/products/demos/image/cross_correlation/imreg.html&quot; rel=&quot;noreferrer&quot;&gt;Registering an Image Using Normalized Cross-Correlation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Template_matching#Template-based_matching_and_convolution&quot; rel=&quot;noreferrer&quot;&gt;Template-based matching and convolution&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can speed up cross-correlation by using an FFT method, but if you're just matching a small source image with a large target image, the brute-force multiply-and-add method is sometimes (not usually) faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hIX8O.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Target:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nYrHK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross-correlation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a0tVE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two bright spots are the locations that match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you &lt;em&gt;do&lt;/em&gt; have a rotation parameter in your example image, so that won't work by itself.  If only rotation is allowed, and not scaling, then it is still possible to use cross-correlation, but you need to cross-correlate, rotate the source, cross-correlate it with the entire target image, rotate it again, etc. for all rotations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this will not necessarily ever find the image.  If the source image is random noise, and the target is random noise, you won't find it unless you search at exactly the right angle.  For normal situations, it will probably find it, but it depends on the image properties and the angles you search in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://paulbourke.net/miscellaneous/correlate/&quot; rel=&quot;noreferrer&quot;&gt;This page&lt;/a&gt; shows an example of how it would be done, but doesn't give the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any offset where the sum is above some threshold is a match.  You can calculate the goodness of the match by correlating the source image with itself and dividing all your sums by this number.  A perfect match will be 1.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be very computationally heavy, though, and there are probably better methods for matching patterns of dots (which I would like to know about).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quick Python example using grayscale and FFT method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from __future__ import division&#xA;from pylab import *&#xA;import Image&#xA;import ImageOps&#xA;&#xA;source_file = 'dots source.png'&#xA;target_file = 'dots target.png'&#xA;&#xA;# Load file as grayscale with white dots&#xA;target = asarray(ImageOps.invert(Image.open(target_file).convert('L')))&#xA;&#xA;close('all')&#xA;figure()&#xA;imshow(target)&#xA;gray()&#xA;show()&#xA;&#xA;source_Image = ImageOps.invert(Image.open(source_file).convert('L'))&#xA;&#xA;for angle in (0, 180):&#xA;    source = asarray(source_Image.rotate(angle, expand = True))&#xA;    best_match = max(fftconvolve(source[::-1,::-1], source).flat)&#xA;&#xA;    # Cross-correlation using FFT&#xA;    d = fftconvolve(source[::-1,::-1], target, mode='same')&#xA;&#xA;    figure()&#xA;    imshow(source)&#xA;&#xA;&#xA;    # This only finds a single peak.  Use something that finds multiple peaks instead:&#xA;    peak_x, peak_y = unravel_index(argmax(d),shape(d))&#xA;&#xA;    figure()    &#xA;    plot(peak_y, peak_x,'ro')&#xA;    imshow(d)&#xA;&#xA;    # Keep track of all these matches:&#xA;    print angle, peak_x, peak_y, d[peak_x,peak_y] / best_match&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;1-color bitmaps&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;For 1-color bitmaps, this would be much faster, though.  Cross-correlation becomes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Place source image over target image&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;bitwise-AND all overlapping pixels (much faster than multiplication)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Hamming_weight#Efficient_implementation&quot; rel=&quot;noreferrer&quot;&gt;sum all the 1s in the overlapped area&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Move source image by 1 pixel&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;bitwise-AND all overlapping pixels&lt;/li&gt;&#xA;&lt;li&gt;sum all the 1s&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thresholding a grayscale image to binary and then doing this might be good enough.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Point cloud&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If the source and target are both patterns of dots, a faster method would be to find the centers of each dot (cross-correlate once with a known dot and then find the peaks) and store them as a set of points, then match source to target by rotating, translating, and finding the least squares error between nearest points in the two sets.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2011-11-26T16:19:39.653" LastActivityDate="2011-11-26T16:19:39.653" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="524" PostTypeId="2" ParentId="427" CreationDate="2011-10-27T14:03:30.707" Score="3" Body="&lt;p&gt;I found this applet very helpful when understanding the nature of convolution in time. &lt;a href=&quot;http://jhu.edu/~signals/convolve/&quot; rel=&quot;nofollow&quot;&gt;The Joy of Convolution.&lt;/a&gt; It lets you &quot;draw&quot; your time signals and convolve them so you get a picture of what's happening in the time domain.&lt;/p&gt;&#xA;" OwnerUserId="461" LastActivityDate="2011-10-27T14:03:30.707" CommentCount="0" CommunityOwnedDate="2011-10-27T14:03:30.707" ContentLicense="CC BY-SA 3.0" />
  <row Id="525" PostTypeId="1" AcceptedAnswerId="706" CreationDate="2011-10-27T20:08:03.280" Score="7" ViewCount="361" Body="&lt;p&gt;This probably walks a fine line between Cross Validated and this site, but I think the practical application of it lies more on the signal processing side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have had the occasion to record some EEG data for an experiment, and determined the mean-squared coherence between each lead:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ C_{xy} = \frac{\lvert{G_{xy}}\rvert^2}{G_{xx}G_{yy}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I also performed an event-related coherence calculation within certain frequency bands, which gives me a power value, but doesn't buy me anything further in the analysis of significance)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I end up with is a list of values for the pairwise interaction of the electrodes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Site1-Site2 = 0.24&#xA;Site2-Site3 = 0.13&#xA;...&#xA;Site7-Site45 = 0.37&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so the challenge is to determine, within this sample of mean-squared coherence values, whether the MSC of the Site1-Site2 interaction is significantly different from that of the Site7-Site45 interaction, given a specific set of experimental conditions (e.g., the subject is tapping their foot or something).  Of course, ultimately comparing between subjects is necessary, but that would follow from being able to compare the results of one subject, and is probably more an issue of statistics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing that the data are not normally distributed, my question is, what is an optimal method of determining whether these values are significant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am familiar with 3 approaches that may be used:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Take everything above 0.5 as significant.  This is one that people could probably argue about over in stats land, but even with my untrained eye, that seems like its fudging it a bit&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use surrogate data to construct a distribution -- the signal processing piece of it would be, what would be a realistic set of surrogate data to use&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the Bootstrap method, or basically derive the distribution from the data.  I get the idea of this method, but I don't fully understand whether this is any more realistic than using the surrogate data, or whether or not this would be SOP in signal processing&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Would any of these 3 methods be appropriate for this type of analysis?  Is there another method that I've missed?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't searched the literature on this in a while, but I never found a consensus anyway.  Are these standard sets of tests that you would perform on signal processing data?&lt;/p&gt;&#xA;" OwnerUserId="76" LastEditorUserId="76" LastEditDate="2011-11-09T23:33:29.870" LastActivityDate="2011-11-25T22:14:46.383" Title="How to discern the distribution function of mean-squared coherence values?" Tags="|statistics|coherence|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="526" PostTypeId="2" ParentId="517" CreationDate="2011-10-27T20:11:09.957" Score="22" Body="&lt;p&gt;From a computer vision perspective: the basic problem is estimating a &lt;a href=&quot;http://en.wikipedia.org/wiki/Homography&quot; rel=&quot;noreferrer&quot;&gt;homography&lt;/a&gt; between your target point set and a subset of points in the large set. In your case, with rotation only, it will be an affine homography. You should look into the &lt;a href=&quot;http://en.wikipedia.org/wiki/RANSAC&quot; rel=&quot;noreferrer&quot;&gt;RANSAC&lt;/a&gt; method. It is designed to find a match in a set with many outliers.  So, you are armed with two important keywords, &lt;strong&gt;homography&lt;/strong&gt; and &lt;strong&gt;RANSAC&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;OpenCV offers tools for computing these solutions, but you can also use MATLAB. Here is a &lt;a href=&quot;http://www.cc.gatech.edu/~richard/ransacld4/&quot; rel=&quot;noreferrer&quot;&gt;RANSAC example using OpenCV&lt;/a&gt;. And another &lt;a href=&quot;https://engineering.purdue.edu/kak/courses-i-teach/ECE661.08/solution/hw4_s1.pdf&quot; rel=&quot;noreferrer&quot;&gt;complete implementation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical application might be to find a book cover in a picture.  You have a picture of the book cover, and a photo of the book on a table.  The approach is not to do template matching, but to find salient corners in each image, and compare those point sets.  Your problem looks like the second half of this process - finding the point set in a big cloud. RANSAC was designed to do this robustly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WATe9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess cross-correlation methods can also work for you since the data is so clean. The problem is, you add another degree of freedom with rotation, and the method becomes very slow.&lt;/p&gt;&#xA;" OwnerUserId="267" LastEditorUserId="267" LastEditDate="2011-10-28T01:34:48.930" LastActivityDate="2011-10-28T01:34:48.930" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="527" PostTypeId="1" AcceptedAnswerId="550" CreationDate="2011-10-28T00:10:19.517" Score="12" ViewCount="346" Body="&lt;p&gt;Background: The software that i use to anaylze my signals is matlab. I have two audio signals that were recorded using two magnetic sensors. Lets call one sensor A and the other one B. A and B have mutual inductance between them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While sensors A and B are working, I would like to subtract the information that was received in sensor A due to mutual inductance from sensor B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to subtract signal B from signal A, by simply writing in matlab (A-B), but it gives me a wierd answer.&#xA;I think that it derives from a shift that I have in phase. The beginning recording time of the two tracks is the same, and therefore I think that it is not a time delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know how to do this subtraction process in theory, and if anyone have any tips how to implement it easily in matlab I would like to know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will really appreciate any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below I attached pictures of the signals graphs.&#xA;In the first pic you can see the signals that are received from sensor A and sensor B.&#xA;In the second picture, I plotted sensor A in red and sensor B in blue, in the range of 2.12:2.16 and zoomed in even more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://bit.ly/rxq3rD&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://bit.ly/rOlMwi&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="492" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.797" LastActivityDate="2011-10-30T13:39:16.907" Title="Subtracting sensors output that have mutual inductnace between them" Tags="|audio|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="528" PostTypeId="2" ParentId="527" CreationDate="2011-10-28T02:17:04.713" Score="5" Body="&lt;p&gt;This sounds like &lt;a href=&quot;http://en.wikipedia.org/wiki/Blind_signal_separation&quot; rel=&quot;noreferrer&quot;&gt;blind source separation&lt;/a&gt;.  In general, you can't unmix things after they've been mixed. If you have two different recordings of two sources with some of each source in each recording, you can sometimes use &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;noreferrer&quot;&gt;independent component analysis&lt;/a&gt; to separate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have &lt;a href=&quot;http://www.endolith.com/wordpress/2009/11/22/a-simple-fastica-example/&quot; rel=&quot;noreferrer&quot;&gt;a Python example here&lt;/a&gt;.  There's also &lt;a href=&quot;http://research.ics.tkk.fi/ica/fastica/&quot; rel=&quot;noreferrer&quot;&gt;FastICA for MATLAB&lt;/a&gt;.  If they are audio signals, being picked up magnetically, there's probably no appreciable delay between them.  ICA works well in this case.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2011-10-28T02:24:54.797" LastActivityDate="2011-10-28T02:24:54.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="529" PostTypeId="2" ParentId="513" CreationDate="2011-10-28T06:23:51.417" Score="2" Body="&lt;p&gt;This is just like the dilation morphological operator, which doesn't typically anti-alias. I can see a couple solutions based on what OpenCV (and other image processing libraries) can do: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use the dilation operator with an anti-aliased structuring element (not supported in OpenCV)&lt;/li&gt;&#xA;&lt;li&gt;Find contours, then stroke the contours with a wide antialiased brush:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use the alpha values to convert the image to a path - the contours&lt;/li&gt;&#xA;&lt;li&gt;Then use an antialised brush to stroke them.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Use the (Euclidean) distance transform and threshold the result near the desired offset distance (use a soft threshold to prevent edge aliasing):&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kfsW8.png&quot; alt=&quot;distance transform&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="267" LastEditorUserId="483" LastEditDate="2011-10-31T15:24:19.270" LastActivityDate="2011-10-31T15:24:19.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="530" PostTypeId="1" AcceptedAnswerId="533" CreationDate="2011-10-28T11:49:15.277" Score="16" ViewCount="7104" Body="&lt;p&gt;I am looking to create an algorithm which adds a bevel effect to a bitmap using it's alpha as a bump map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go doing something like this? I have tried specular lighting but I only get the highlight and not the shade.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the effect I am talking about(made using Photoshop):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cvcYB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these were done using &lt;code&gt;size: 30px&lt;/code&gt;(The depth of the bevel from the contour of the bitmap), &lt;code&gt;angle 130&lt;/code&gt;, &lt;code&gt;altitude 50&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From left to right, top to bottom:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Chisel Hard bevel&lt;/li&gt;&#xA;&lt;li&gt;Chisel Soft Bevel&lt;/li&gt;&#xA;&lt;li&gt;Smooth Bevel&lt;/li&gt;&#xA;&lt;li&gt;Chisel Hard with &lt;code&gt;soften: 16px&lt;/code&gt; - a blurred bevel?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am trying to create each of these effects, how would I go about creating the basic bevel? and what do I need to get to each of these from that bevel&lt;/p&gt;&#xA;" OwnerUserId="483" LastEditorUserId="483" LastEditDate="2011-10-29T10:38:09.817" LastActivityDate="2012-12-26T14:57:24.090" Title="Bitmap alpha bevel algorithm?" Tags="|image-processing|filters|algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="531" PostTypeId="2" ParentId="519" CreationDate="2011-10-28T17:58:39.230" Score="2" Body="&lt;p&gt;I am a bit confused by your question.  Hough transform is used to detect lines, not edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all you want is an edge map, you should simply threshold the gradient magnitude, or use something more fancy like the Canny edge detector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to detect straight lines, you would be better off starting with an edge map, and then using the &lt;code&gt;hough&lt;/code&gt; function if the Image Processing toolbox, if you have access to it. The problem with doing a Hough transform on the gradient is that edge pixels forming a straight line might have opposite gradient orientations.  For example, consider a checkerboard pattern.  A edge between two rows of squares flips orientation depending on whether you have a black square above and a white square below, or the other way around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to your implementation, I think the problem is that the bins in your Hough matrix are too small.  Essentially the bin size in the rho dimension is 1, and the bin size in the theta dimension is less than 2 degrees.  That means that the gradient orientations must alight very precisely to form a line, which rarely happens in practice.  If you caculate rho_idx and theta_idx so that the bins are larger, that will make your line detector more tolerant to errors, and you might get better lines.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2011-10-28T18:24:56.453" LastActivityDate="2011-10-28T18:24:56.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="532" PostTypeId="1" CreationDate="2011-10-28T18:59:00.233" Score="11" ViewCount="2117" Body="&lt;p&gt;In my group, we have developed an algorithm which shows abstract information from quantum mechanical systems as images. This way, given a quantum system, we obtain an associated image which has the same information and makes some features visible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the important features is obtained using a &quot;cross-correlation matrix&quot;: We divide the image into $L\times L$ sub-images and find the &quot;overlap&quot; between all pairs. So, the entry for sub-images $i$ and $j$, $A_{i,j}$ is a number stating how similar they are. The matrix dimension is $L^2\times L^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is: is this matrix, or a close relative, used in image-processing? If it does, does it have a name? Does it have any interesting properties, or does it help for any useful algorithms?&lt;/p&gt;&#xA;" OwnerUserId="496" LastEditorUserId="128" LastEditDate="2020-04-03T07:01:27.450" LastActivityDate="2020-04-03T07:01:27.450" Title="Cross Correlation Matrix" Tags="|image-processing|cross-correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="533" PostTypeId="2" ParentId="530" CreationDate="2011-10-29T03:05:51.953" Score="11" Body="&lt;p&gt;This can be accomplished with a convolution of the distance transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use a distance transform on the edge of the mask. Then threshold this distance transform to remove values beyond some distance. I think the secret to getting the shading is to convolve the distance transform result with a kernel that looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ -1.0  -1.0  -1.0&#xA;  -1.0   0.0   0.0&#xA;  -1.0   0.0   1.0 ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should get you started in the right direction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;opencv/cv.h&quot;&#xA;#include &quot;opencv/highgui.h&quot;&#xA;&#xA;using namespace cv;&#xA;using namespace std;&#xA;&#xA;int main() {&#xA;    Mat mask, dist, bevel;&#xA;    mask = Mat::zeros(200, 400, CV_8U);&#xA;    rectangle(mask, Point(30,30), Point(180,180), Scalar(255), -1);&#xA;    circle(mask, Point(30,30), 50, Scalar(0), -1);&#xA;    circle(mask, Point(180,180), 50, Scalar(0), -1);&#xA;    circle(mask, Point(300,100), 75, Scalar(255), -1);&#xA;    imshow(&quot;1&quot;,mask);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PEnpA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    //find edges and invert image for distance transform&#xA;    Canny(mask, dist, 50, 150);&#xA;    dist = 255-dist;&#xA;    distanceTransform(dist, dist, CV_DIST_L2, CV_DIST_MASK_5);&#xA;    threshold(dist, dist, 20, 20, CV_THRESH_TRUNC);&#xA;    blur(dist, dist, Size(3,3));&#xA;    dist.convertTo(bevel, CV_8U);&#xA;    equalizeHist(bevel, bevel);&#xA;    imshow(&quot;2&quot;,bevel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QYQUW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    //convolve with secret sauce&#xA;    float d[] = {-1,-2,-3,&#xA;                 -2, 0, 0,&#xA;                 -3, 0, 1 };&#xA;    Mat kernel(3, 3, CV_32F, d);&#xA;    kernel = kernel - mean(kernel)[0];&#xA;    filter2D(dist, dist, CV_32F, kernel);&#xA;&#xA;    //normalize filtering result to [-1, 1]&#xA;    double maxVal;&#xA;    minMaxLoc(dist, NULL, &amp;amp;maxVal);&#xA;    dist = 128 * dist / maxVal;&#xA;&#xA;    //convert and display result&#xA;    dist.convertTo(bevel, CV_8U, 1, 128);&#xA;    bevel = bevel.mul(mask)/255;&#xA;    imshow(&quot;3&quot;, bevel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DIfg6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    waitKey(0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="267" LastActivityDate="2011-10-29T03:05:51.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="534" PostTypeId="1" CreationDate="2011-10-29T09:53:14.353" Score="5" ViewCount="6736" Body="&lt;p&gt;I'm working on a control system that measures the movement of a vibrating robot arm. Because there is some deadtime, I need to look into the future of the somewhat noisy signal. My idea was to use the frequencies in the sampled signal and produce a fourier function that could be used for extrapolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: I already have the FFT of the signal vector (containing 60-100 values e.g.) and can see the main frequencies in the amplitude spectrum. Now I want to have a function f(t) which fits to the signal, removes some noise, and can be used to predict the near future of the signal. How do I calculate the coefficients for the sine/cosine functions out of the complex FFT data?&lt;/p&gt;&#xA;" OwnerUserId="499" LastEditorUserId="440" LastEditDate="2012-04-17T08:09:27.900" LastActivityDate="2012-04-17T18:25:01.903" Title="How to get coefficients for sine/cosine function from complex FFT?" Tags="|fourier-transform|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="535" PostTypeId="2" ParentId="471" CreationDate="2011-10-29T11:29:02.193" Score="33" Body="&lt;p&gt;There are many for different subjects -&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Efg's algorithm collection : &lt;a href=&quot;http://www.efg2.com/Lab/Library/ImageProcessing/index.html&quot;&gt;http://www.efg2.com/Lab/Library/ImageProcessing/index.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;DSP Forum : &lt;a href=&quot;http://www.dsprelated.com/&quot;&gt;http://www.dsprelated.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Data compression - &lt;a href=&quot;http://datacompression.info/&quot;&gt;http://datacompression.info/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;About rendering - &lt;a href=&quot;http://www.realtimerendering.com/portal.html&quot;&gt;http://www.realtimerendering.com/portal.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For all research papers - &lt;a href=&quot;http://ieeexplore.ieee.org/Xplore/guesthome.jsp&quot;&gt;http://ieeexplore.ieee.org/Xplore/guesthome.jsp&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Resources on Mp3 and Audio - &lt;a href=&quot;http://www.mp3-tech.org/programmer/docs/index.php&quot;&gt;http://www.mp3-tech.org/programmer/docs/index.php&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Steve on Image Processing - &lt;a href=&quot;http://blogs.mathworks.com/steve/&quot;&gt;http://blogs.mathworks.com/steve/&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Image Processing and Retrieval &lt;a href=&quot;http://savvash.blogspot.com/&quot;&gt;http://savvash.blogspot.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Accelerated Image Processing - &lt;a href=&quot;http://visionexperts.blogspot.com/&quot;&gt;http://visionexperts.blogspot.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Digital Signal Processing Blog - &lt;a href=&quot;http://centerk.net/dspblog/&quot;&gt;http://centerk.net/dspblog/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Noise &amp;amp; Vibration Measurement Blog - &lt;a href=&quot;http://blog.prosig.com/&quot;&gt;http://blog.prosig.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Image Processing with Matlab, Open Blog - &lt;a href=&quot;http://imageprocessingblog.com/&quot;&gt;http://imageprocessingblog.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastEditorUserId="29" LastEditDate="2013-07-08T19:26:38.917" LastActivityDate="2013-07-08T19:26:38.917" CommentCount="1" CommunityOwnedDate="2011-10-29T11:29:02.193" ContentLicense="CC BY-SA 3.0" />
  <row Id="536" PostTypeId="1" AcceptedAnswerId="544" CreationDate="2011-10-29T15:43:34.497" Score="86" ViewCount="239286" Body="&lt;p&gt;Can anyone state the difference between frequency response and impulse response in simple English? &lt;/p&gt;&#xA;" OwnerUserId="381" LastEditorUserId="90" LastEditDate="2011-10-30T15:44:40.650" LastActivityDate="2018-01-18T14:47:48.233" Title="What is meant by a system's &quot;impulse response&quot; and &quot;frequency response?&quot;" Tags="|frequency|impulse-response|linear-systems|frequency-response|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="537" PostTypeId="2" ParentId="536" CreationDate="2011-10-29T17:46:09.253" Score="12" Body="&lt;p&gt;The impulse response is the response of a system to a single pulse of infinitely small duration and unit energy (a Dirac pulse). The frequency response shows how much each frequency is attenuated or amplified by the system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response of a system is the impulse response transformed to the frequency domain. If you have an impulse response, you can use the FFT to find the frequency response, and you can use the inverse FFT to go from a frequency response to an impulse response.&lt;/p&gt;&#xA;" OwnerUserId="108" LastActivityDate="2011-10-29T17:46:09.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="538" PostTypeId="1" AcceptedAnswerId="545" CreationDate="2011-10-29T19:48:16.773" Score="8" ViewCount="5878" Body="&lt;p&gt;As part of a homework assignment, we are implementing the Inverse Filter. Degrade an image then recover with an Inverse Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I convolve the image in the spatial domain with a 5x5 box filter. I FFT the filter, FFT the degraded image, then divide the degraded image by the filter. Inverse FFT the result into an image and I get garbage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I FFT the image, FFT the filter, multiply the two, divide that result by the FFT'd filter, obviously I get very close to the original image. ((X*Y)/Y ~== X)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an inkling the math is not as simple as &quot;spatially convolved == FFT multiplication&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is is the correct way to use the Inverse Filter? I have the exact kernel used degrade the image. I'm not adding any noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bovik's textbook, &lt;em&gt;The Essential Guide to Image Processing&lt;/em&gt; is almost completely dismissive of the Inverse Filter. Gonzalez&amp;amp;Woods is a bit more hopeful but almost immediately skips to the Wiener Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a similar question on stackoverflow.com &#xA;&lt;a href=&quot;https://stackoverflow.com/questions/7930803/inverse-filter-of-spatially-convolved-versus-frequency-convolved-image&quot;&gt;https://stackoverflow.com/questions/7930803/inverse-filter-of-spatially-convolved-versus-frequency-convolved-image&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This questions should also be tagged [homework] but the tag doesn't exist yet and I haven't the rep to create it.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT. For some of the great suggestions below. &#xA;@dipan-mehta Before I FFT, I am padding the convolution kernel to the same size as the image. I'm putting the kernel into the upper left. I ifft(ifftshift()) then save to an image and I get a good result. I've done the ifft(ifftshift()) on both the kernel and the image. Good(ish) results. (Images are in my &lt;a href=&quot;https://stackoverflow.com/questions/7930803/inverse-filter-of-spatially-convolved-versus-frequency-convolved-image&quot;&gt;https://stackoverflow.com/questions/7930803/inverse-filter-of-spatially-convolved-versus-frequency-convolved-image&lt;/a&gt; question.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;@jason-r is probably correct. I don't understand the mathematics of the underlying convolution + transform. &quot;Deconvolution&quot; was a new word for me. Still have much to learn. Thanks for the help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution for the homework assignment is to do everything in the frequency domain. I spoke with the professor. I was making the assignment harder than necessary. She wanted us to add noise then try the Inverse Filter, Wiener Filter, and Constrained Least Squares Filter. The point of the exercise was to see how the filters handled noise. &lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="128" LastEditDate="2019-12-29T14:54:45.120" LastActivityDate="2019-12-29T14:54:45.120" Title="Using the Inverse Filter to Correct a Spatially Convolved Image (Deconvolution)" Tags="|image-processing|filters|fourier-transform|deconvolution|inverse-problem|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="539" PostTypeId="2" ParentId="536" CreationDate="2011-10-29T22:13:07.453" Score="14" Body="&lt;p&gt;Bang on something sharply once and plot how it responds in the time domain (as with an oscilloscope or pen plotter).  That will be close to the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get a tone generator and vibrate something with different frequencies.  Some resonant frequencies it will amplify.  Others it may not respond at all.  Plot the response size and phase versus the input frequency.  That will be close to the frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For certain common classes of systems (where the system doesn't much change over time, and any non-linearity is small enough to ignore for the purpose at hand), the two responses are related, and a Laplace or Fourier transform might be applicable to approximate the relationship.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-29T22:13:07.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="540" PostTypeId="1" CreationDate="2011-10-29T20:22:12.093" Score="15" ViewCount="5506" Body="&lt;p&gt;I'm calculating FFT from microphone input. I notice that lower frequencies always seems to have more power (higher dB) than higher frequencies. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I cut the data into frames of 24576 bytes (4096*6).&lt;/li&gt;&#xA;&lt;li&gt;Apply Hamming window: &lt;code&gt;input[i] *= (0.54d - 0.46d*(double) Math.Cos((2d*Math.PI*i)/fs));&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Run it through FFTW &lt;code&gt;Process1D()&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Convert from complex numbers: &lt;code&gt;output[i] = 10.0 * Math.Log10((fout[i * 2] * fout[i * 2]) + (fout[i * 2 + 1] * fout[i * 2 + 1]));&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Average out 6 values to get a complete FFT of 4096 bytes.&lt;/li&gt;&#xA;&lt;li&gt;Paint pretty picture (colors mapped to a palette).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The averaging (pt. 5) is done to lower FFT noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the image shows both with sound and with mic off there is more energy (and more noise) in the lower frequencies. This indicates its more than just a mic/sub problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;br /&gt;&#xA; 1. Is this expected? Why?&lt;br /&gt;&#xA; 2. Any standard way of fixing this? Almost looks like some Math.Tan() magic could lift it up where it belongs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to be able to identify the top 5 frequencies without lower frequencies winning by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Fmlmg.png&quot; alt=&quot;FFT&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="684" OwnerDisplayName="Tedd Hansen" LastEditorUserId="684" LastEditDate="2011-12-16T07:52:31.193" LastActivityDate="2012-09-28T14:39:51.223" Title="Lower frequencies stronger in FFT?" Tags="|audio|fft|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="541" PostTypeId="2" ParentId="540" CreationDate="2011-10-29T21:02:32.433" Score="8" Body="&lt;p&gt;In step 2, the formula should be &lt;code&gt;input[i] *= (0.54d - 0.46d*(double) Math.Cos((2d*Math.PI*i)/N));&lt;/code&gt;, where &lt;code&gt;N&lt;/code&gt; is the number of samples in the buffer, in your case &lt;code&gt;24576&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In steps 4 &amp;amp; 5, I would do the bin-wise averaging on the squared magnitude values, not the dB values. Say you have the squared magnitudes &lt;code&gt;[4,6]&lt;/code&gt;. Their average is &lt;code&gt;5&lt;/code&gt;, &lt;code&gt;10*log10(5) ~= 6.99&lt;/code&gt;. The average of &lt;code&gt;10*log10(4)&lt;/code&gt; and &lt;code&gt;10*log10(6)&lt;/code&gt; is &lt;code&gt;6.90&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first problem might be the cause the of the bias towards low frequencies, as it will cause spectral leakage, and the low frequencies will get more contamination from the DC line (which is inevitably a poor estimate). The second problem is probably not going to make a difference on the low frequencies, but I think gets closer to the intent of your measurement.&lt;/p&gt;&#xA;" OwnerUserId="275" OwnerDisplayName="mtrw" LastEditorUserId="275" LastEditDate="2011-10-31T22:11:34.617" LastActivityDate="2011-10-31T22:11:34.617" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="542" PostTypeId="2" ParentId="540" CreationDate="2011-10-29T21:07:04.900" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this expected? Why?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A lot of natural sounds have &lt;a href=&quot;http://en.wikipedia.org/wiki/Harmonic&quot; rel=&quot;nofollow&quot;&gt;harmonics&lt;/a&gt;, so there will be a lower fundamental frequencies and then less energy in higher multiples of the fundamental.  There may be a DC bias which would mean a lot of energy at the very left.  Another influence is your &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function#Hamming_window&quot; rel=&quot;nofollow&quot;&gt;windowing function&lt;/a&gt; which distorts the frequency response.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Any standard way of fixing this? Almost looks like some Math.Tan() magic could lift it up where it belongs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can deal with the DC bias by using a high-pass filter.  A simple implementation is to subtract the long term average from every sample (EDIT: or even simpler, discard the lower frequencies, e.g. &amp;lt;50Hz from your FFT result).  You can also experiment with different window functions.  make sure (as @mtrw points out) that you're applying the window properly.  Any other non-linearities in the response can be corrected by measuring some ideal input and normalizing to that curve.&lt;/p&gt;&#xA;" OwnerUserId="2048" OwnerDisplayName="Guy Sirton" LastActivityDate="2011-10-29T21:42:45.387" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="543" PostTypeId="2" ParentId="540" CreationDate="2011-10-29T22:10:56.630" Score="5" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Pink_noise&quot; rel=&quot;nofollow noreferrer&quot;&gt;1/f noise occurs in many physical, biological and economic systems. Some researchers describe it as being ubiquitous.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jAyzR.jpg&quot; alt=&quot;pink and white noises&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pink noise (left) and white noise (right) on an FFT spectrogram with linear frequency vertical axis (on a typical audio or similar spectrum analyzer the pink noise would be flat, not downward-sloping, and the white noise rising)&lt;/p&gt;&#xA;" OwnerUserId="1408" OwnerDisplayName="Alex" LastActivityDate="2011-10-29T22:10:56.630" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="544" PostTypeId="2" ParentId="536" CreationDate="2011-10-30T05:15:15.423" Score="167" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Impulse_response&quot; rel=&quot;noreferrer&quot;&gt;impulse response&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_response&quot; rel=&quot;noreferrer&quot;&gt;frequency response&lt;/a&gt; are two attributes that are useful for characterizing &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_time_invariant&quot; rel=&quot;noreferrer&quot;&gt;linear time-invariant (LTI)&lt;/a&gt; systems. They provide two different ways of calculating what an LTI system's output will be for a given input signal. A continuous-time LTI system is usually illustrated like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yzWBM.png&quot; alt=&quot;LTI system diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, the system $H$ maps its input signal $x(t)$ to a corresponding output signal $y(t)$. There are many types of LTI systems that can have apply very different transformations to the signals that pass through them. But, they all share two key characteristics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The system is &lt;em&gt;linear&lt;/em&gt;, so it obeys the principle of &lt;a href=&quot;http://en.wikipedia.org/wiki/Superposition_principle&quot; rel=&quot;noreferrer&quot;&gt;superposition&lt;/a&gt;. Stated simply, if you linearly combine two signals and input them to the system, the output is the same linear combination of what the outputs would have been had the signals been passed through individually. That is, if $x_1(t)$ maps to an output of $y_1(t)$ and $x_2(t)$ maps to an output of $y_2(t)$, then for all values of $a_1$ and $a_2$,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H\{a_1 x_1(t) + a_2 x_2(t)\} = a_1 y_1(t) + a_2 y_2(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The system is &lt;em&gt;time-invariant&lt;/em&gt;, so its characteristics do not change with time. If you add a delay to the input signal, then you simply add the same delay to the output. For an input signal $x(t)$ that maps to an output signal $y(t)$, then for all values of $\tau$,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H\{x(t - \tau)\} = y(t - \tau)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Discrete-time LTI systems have the same properties; the notation is different because of the discrete-versus-continuous difference, but they are a lot alike. These characteristics allow the operation of the system to be straightforwardly characterized using its impulse and frequency responses. They provide two perspectives on the system that can be used in different contexts.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Impulse Response:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;impulse&lt;/em&gt; that is referred to in the term &lt;em&gt;impulse response&lt;/em&gt; is generally a short-duration time-domain signal. For continuous-time systems, this is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirac_delta&quot; rel=&quot;noreferrer&quot;&gt;Dirac delta function&lt;/a&gt; $\delta(t)$, while for discrete-time systems, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Kronecker_delta&quot; rel=&quot;noreferrer&quot;&gt;Kronecker delta function&lt;/a&gt; $\delta[n]$ is typically used. A system's impulse response (often annotated as $h(t)$ for continuous-time systems or $h[n]$ for discrete-time systems) is defined as the output signal that results when an impulse is applied to the system input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this useful? It allows us to predict what the system's output will look like in the time domain. Remember the linearity and time-invariance properties mentioned above? If we can decompose the system's input signal into a sum of a bunch of components, then the output is equal to the sum of the system outputs for each of those components. What if we could decompose our input signal into a sum of scaled and time-shifted impulses? Then, the output would be equal to the sum of copies of the impulse response, scaled and time-shifted in the same way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For discrete-time systems, this is possible, because you can write any signal $x[n]$ as a sum of scaled and time-shifted Kronecker delta functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = \sum_{k=0}^{\infty} x[k] \delta[n - k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each term in the sum is an impulse scaled by the value of $x[n]$ at that time instant. What would we get if we passed $x[n]$ through an LTI system to yield $y[n]$? Simple: each scaled and time-delayed impulse that we put in yields a scaled and time-delayed copy of the impulse response at the output. That is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = \sum_{k=0}^{\infty} x[k] h[n-k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h[n]$ is the system's impulse response. The above equation is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_time_invariant#Impulse_response_and_convolution&quot; rel=&quot;noreferrer&quot;&gt;convolution theorem&lt;/a&gt; for discrete-time LTI systems. That is, for any signal $x[n]$ that is input to an LTI system, the system's output $y[n]$ is equal to the discrete convolution of the input signal and the system's impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For continuous-time systems, the above straightforward decomposition isn't possible in a strict mathematical sense (the Dirac delta has zero width and infinite height), but at an engineering level, it's an approximate, intuitive way of looking at the problem. A similar convolution theorem holds for these systems:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = \int_{-\infty}^{\infty} x(\tau) h(t - \tau) d\tau&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where, again, $h(t)$ is the system's impulse response. There are a number of ways of deriving this relationship (I think you could make a similar argument as above by claiming that Dirac delta functions at all time shifts make up an orthogonal basis for the $L^2$ Hilbert space, noting that you can use the delta function's sifting property to project any function in $L^2$ onto that basis, therefore allowing you to express system outputs in terms of the outputs associated with the basis (i.e. time-shifted impulse responses), but I'm not a licensed mathematician, so I'll leave that aside). One method that relies only upon the aforementioned LTI system properties is shown &lt;a href=&quot;http://www.swarthmore.edu/NatSci/echeeve1/Ref/Convolution/SysConvolve.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In summary:&lt;/strong&gt; For both discrete- and continuous-time systems, the impulse response is useful because it allows us to calculate the output of these systems for any input signal; the output is simply the input signal convolved with the impulse response function.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Frequency response:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;An LTI system's frequency response provides a similar function: it allows you to calculate the effect that a system will have on an input signal, except those effects are illustrated in the &lt;em&gt;frequency domain&lt;/em&gt;. Recall the definition of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Fourier transform&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(f) = \int_{-\infty}^{\infty} x(t) e^{-j 2 \pi ft} dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More importantly for the sake of this illustration, look at its inverse:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = \int_{-\infty}^{\infty} X(f) e^{j 2 \pi ft} df&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In essence, this relation tells us that any time-domain signal $x(t)$ can be broken up into a linear combination of many complex exponential functions at varying frequencies (there is an analogous relationship for discrete-time signals called the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;discrete-time Fourier transform&lt;/a&gt;; I only treat the continuous-time case below for simplicity). For a time-domain signal $x(t)$, the Fourier transform yields a corresponding function $X(f)$ that specifies, for each frequency $f$, the scaling factor to apply to the complex exponential at frequency $f$ in the aforementioned linear combination. These scaling factors are, in general, complex numbers. One way of looking at complex numbers is in amplitude/phase format, that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(f) = A(f) e^{j \phi(f)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at it this way, then, $x(t)$ can be written as a linear combination of many complex exponential functions, each scaled in amplitude by the function $A(f)$ and shifted in phase by the function $\phi(f)$. This lines up well with the LTI system properties that we discussed previously; if we can decompose our input signal $x(t)$ into a linear combination of a bunch of complex exponential functions, then we can write the output of the system as the same linear combination of the system response to those complex exponential functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's where it gets better: exponential functions are the &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_time_invariant#Exponentials_as_eigenfunctions&quot; rel=&quot;noreferrer&quot;&gt;eigenfunctions&lt;/a&gt; of linear time-invariant systems. The idea is, similar to eigenvectors in linear algebra, if you put an exponential function into an LTI system, you get the same exponential function out, scaled by a (generally complex) value. This has the effect of changing the amplitude and phase of the exponential function that you put in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is immensely useful when combined with the Fourier-transform-based decomposition discussed above. As we said before, we can write any signal $x(t)$ as a linear combination of many complex exponential functions at varying frequencies. If we pass $x(t)$ into an LTI system, then (because those exponentials are eigenfunctions of the system), the output contains complex exponentials at the same frequencies, only scaled in amplitude and shifted in phase. These effects on the exponentials' amplitudes and phases, as a function of frequency, is the system's &lt;em&gt;frequency response&lt;/em&gt;. That is, for an input signal with Fourier transform $X(f)$ passed into system $H$ to yield an output with a Fourier transform $Y(f)$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y(f) = H(f) X(f) = A(f) e^{j \phi(f)} X(f)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In summary:&lt;/strong&gt; So, if we know a system's frequency response $H(f)$ and the Fourier transform of the signal that we put into it $X(f)$, then it is straightforward to calculate the Fourier transform of the system's output; it is merely the product of the frequency response and the input signal's transform. For each complex exponential frequency that is present in the spectrum $X(f)$, the system has the effect of scaling that exponential in amplitude by $A(f)$ and shifting the exponential in phase by $\phi(f)$ radians.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Bringing them together:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;An LTI system's impulse response and frequency response are intimately related. The frequency response is simply the Fourier transform of the system's impulse response (to see why this relation holds, see the answers to &lt;a href=&quot;https://dsp.stackexchange.com/questions/11282/for-a-lti-system-why-does-the-fourier-transform-of-the-impulse-response-give-th&quot;&gt;this other question&lt;/a&gt;). So, for a continuous-time system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(f) = \int_{-\infty}^{\infty} h(t) e^{-j 2 \pi ft} dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, given either a system's impulse response or its frequency response, you can calculate the other. Either one is sufficient to fully characterize the behavior of the system; the impulse response is useful when operating in the time domain and the frequency response is useful when analyzing behavior in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2018-01-18T14:47:48.233" LastActivityDate="2018-01-18T14:47:48.233" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="545" PostTypeId="2" ParentId="538" CreationDate="2011-10-30T05:31:58.960" Score="8" Body="&lt;p&gt;There's a couple subquestions that I'll address separately:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Convolution in the spatial domain (or correspondingly in the time domain for time-sampled signals) is equivalent to multiplication in the frequency domain. In sampled systems, there are some subtleties to boundary cases (i.e. when using the DFT, multiplication in the frequency domain actually gives you circular convolution, not linear convolution), but in general, it really is that simple.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Pure inverse filtering is almost never the right solution in practice. In most cases, you don't have access to the exact filter that has been applied to your data, so you can't simply invert it anyway. Even if you do know the filter, then it's still problematic. Consider the fact that the filter may have zeros at certain spatial frequencies; if it does, then after applying the filter to your image, all information at those frequencies is lost. If you naively invert that filter, it will have infinite (or at least very high) gain at those nulls. If you then apply the naive inverse to an image that has any additive content at those frequencies (e.g. noise, which is likely to be the case), then that unwatned component will be greatly amplified. This is generally not desirable.&lt;/p&gt;&#xA;&lt;p&gt;This inverse-filtering problem is very similar to equalization in communications systems, where this phenomenon is referred to as &lt;em&gt;noise enhancement&lt;/em&gt;. In that context, the inverse-filter approach is referred to as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Zero_Forcing_Equalizer&quot; rel=&quot;noreferrer&quot;&gt;zero-forcing equalizer&lt;/a&gt;, which is rarely actually used.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The area that you're exploring is known more generally as &lt;a href=&quot;http://en.wikipedia.org/wiki/Deconvolution&quot; rel=&quot;noreferrer&quot;&gt;deconvolution&lt;/a&gt;. As a general rule, deconvolution is a tricky operation. Even if you know the exact filter that was applied and want to undo it, it's not always that easy. As you noted, the inverse filter approach is usually brushed aside in favor of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;noreferrer&quot;&gt;Wiener filter&lt;/a&gt; or some other structure that aims not to &lt;em&gt;exactly&lt;/em&gt; invert the system, but instead to estimate what the input to the system was while minimizing some error criterion (minimizing mean-squared error is a common goal). As you might expect, applying a Wiener filter to this problem is referred to as &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;noreferrer&quot;&gt;Wiener deconvolution&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2011-10-31T13:36:56.923" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="546" PostTypeId="2" ParentId="538" CreationDate="2011-10-30T05:58:45.400" Score="3" Body="&lt;p&gt;I hope you have not made mistake in the way computation is done for - &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I convolve the image in the spatial domain with a 5x5 box filter. I&#xA;  FFT the filter, FFT the degraded image, then divide the degraded image&#xA;  by the filter. Inverse FFT the result into an image and I get garbage.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Suppose your image is 256x256 size, and Filter is 5x5 - in order to apply the Filtering by multiplying the FFTs, you must first convert the filter into equivalent size first. For this, you must keep 5x5 box filter at the &quot;TOP corner&quot; (not center of the image) and pad it rest with &lt;strong&gt;zeros&lt;/strong&gt; to fill 256x256 - you should get an FFT of 256x256 for the filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To help diagnose, in programming&#xA;step #1 - first just take 256x256 FFT of filter alone and check if the IFFT - routine is able to give you back the filter. Same way test if FFT --&gt; IFFT of image itself works backwards properly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step #2 - if you only apply filter (and no inverse filter) in the FFT domain by multiplying - check the resultant image after IFFT is fine. It should be basically blurred image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all your programming is correct - please ensure that when you do 1/x for FFT co-efficient there are no divide by zero error, and conversely when there is too much peaking the multiplications results in heavy distortions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general - for any &lt;em&gt;stable&lt;/em&gt; filter, the inverse filter by definition unstable - this could be the primary reason. However, i would always like to cross check implementation before exploring theoretical limits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If done well, i have seen multiplication in FFT &lt;em&gt;is&lt;/em&gt; convolution in sample space both for images as well as audio signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dipan.&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2011-10-30T05:58:45.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="547" PostTypeId="2" ParentId="517" CreationDate="2011-10-30T08:17:10.220" Score="3" Body="&lt;p&gt;Iif the pattern is sparse binary you can do simple covariance of coordinate vectors instead of images. Take coordinates of points in the sub-window sorted left-up, make a vector from all the coordinates and calculate covariance with vector made of coordinates of points of pattern sorted left-up. You can also use weights. After that make brute force nearest neighbor search for max covariance on some grid in the big window (and also grid in rotation angles). After finding approximate coordinates with search you can refine them with reweighted least square method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS&#xA;Idea is, instead of working with image you can work with coordinates of non-zero pixels. Common nearest-neighbor search.  You should do exhaustive search of all search space, both translational and rotational using some grid, that is some step in coordinate and rot angle. For each coordinate/angle you take subset of pixel in the window with center with that coordinate rotated to that angle, take their coordinates(rel to center) and compare them with coordinates of pixel of the pattern you seek. You should make sure that in both sets points sorted in the same way. You find coordinates with minimum difference(maximum covariance). After that rough match you can find precise match with some optimization method.&#xA;Sorry I can not relay it more simple than that. &lt;/p&gt;&#xA;" OwnerUserId="198" LastEditorUserId="198" LastEditDate="2011-11-01T12:03:46.563" LastActivityDate="2011-11-01T12:03:46.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="548" PostTypeId="1" AcceptedAnswerId="552" CreationDate="2011-10-30T10:55:35.467" Score="7" ViewCount="985" Body="&lt;p&gt;If I sample sound with a microphone and find the absolute square of the (non-normalized) DFT, I get the discrete power spectrum (correct me if I'm wrong). Which unit does it have?&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2011-10-30T14:02:40.777" Title="Which unit does the power spectrum of microphone output have?" Tags="|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="549" PostTypeId="2" ParentId="548" CreationDate="2011-10-30T11:22:03.967" Score="5" Body="&lt;p&gt;Power is measured in Watts ($W$). For a power spectrum the indiviudal bins have units of $W / Hz$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However unless you calibrate you microphone/ADC input and eliminate other scaling factors (e.g. window compensation, factor of N / 2 in your FFT, implicit scaling in integer sample values, etc) then there is an arbitrary overall scale factor which needs to be accounted for if you really do want to measure absolute power levels.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2011-10-30T11:22:03.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="550" PostTypeId="2" ParentId="527" CreationDate="2011-10-30T13:39:16.907" Score="4" Body="&lt;p&gt;That looks like a straight forward cross-talk problem. You cannot simply subtract out the signal directly since magnetic coupling is different for every frequency (in terms of amplitude and phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have two audio signals xa(t) and xb(t) and two sensor signals ya(t) and yb(t). Since there is coupling between the sensors you will get cross talk and we can write in the frequency domain&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ya(w) = Haa(w)*xa(w) + Hba(w)*xb(w)&#xA;Yb(w) = Hab(w)*xa(w) + Hbb(w)*xb(w)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where&#xA;Hxy(w) is the transfer function from signal &quot;x&quot; to sensor signal &quot;y&quot;. The 4 transfer functions form a 2x2 matrix and in order to fully recover the original signals you need to invert the matrix and apply the inverted matrix transfer functions to your received sensor signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your cross talk is small, you can simply measure the transfer function Hba(w) directly and subtract it out as follows: Measure the transfer function from signal A to sensor B when signal B is 0. Create a filter from this transfer function (FIR or IIR, depending on it's shape). Now you can measure and subtract a filtered version from sensor signal A from sensor signal B:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yb(t)' = yb(t)-hab(t)**ya(t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where hab(t) is the impulse response of your cross talk filter and ** the convolution operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cross talk filter represents the amplitude and phase shift as a function of frequency of your specific sensor coupling and it ensures that the correct signal gets subtracted.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-30T13:39:16.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="551" PostTypeId="2" ParentId="540" CreationDate="2011-10-30T13:51:00.527" Score="12" Body="&lt;p&gt;Yes, this is very much expected. What you see is a &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Pink_noise&quot; rel=&quot;nofollow&quot;&gt;pink&lt;/a&gt;&quot; spectrum, i.e. constant energy per relative bandwidth, as compared to &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/White_noise&quot; rel=&quot;nofollow&quot;&gt;white&lt;/a&gt;&quot; which is constant energy per absolute bandwidth. For pink signals the energy between 1-2kHz is the same as from 2-4kHz (each represents a doubling of bandwidth or an &quot;octave&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most natural audio signals (Speech, music, movies, etc.) have a pink-like spectrum. Also most acoustic background noises (microphone noise, HVAC noise, air pressure fluctuations, generic background) tend to be pink or even more skewed towards lower frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The human auditory systems works that way, too. In the inner ear the audio signals are broken down into bands of constant relative bandwidth (called &quot;Critical Bands&quot;) which are roughly the same as a third octave spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to look at audio spectrum data is to plot it on a logarithmic frequency scale. &lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="29" LastEditDate="2012-09-28T14:39:51.223" LastActivityDate="2012-09-28T14:39:51.223" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="552" PostTypeId="2" ParentId="548" CreationDate="2011-10-30T14:02:40.777" Score="11" Body="&lt;p&gt;This depends a little on how thorough you want to be. Your microphone measures pressure and not actual power. That means your time domain signal has the units of Pascal and the spectrum has Pascal squared per Hz. In order to turn that into Intensity you would have to normalize by the free field impedance of air which is density*speed_of_sound and roughly 410 Newton seconds per cubic meter (at sea level &amp;amp; room temperature). Then the units would be Watt per square meter per Hz. You would only get to Watts per Hz if you integrate over a full sphere . This requires either an omnidirectional source or a rather tedious measurement involving a large number of microphone positions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is added complexity if you want to calibrate in dBSPL (sound pressure level). The 0 dB reference for this is 20 micro Pascal (which is close to the human threshold of hearing) and a pressure of 1 Pascal corresponds to roughly 94 dBSPL. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-10-30T14:02:40.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="553" PostTypeId="2" ParentId="515" CreationDate="2011-10-30T19:30:40.463" Score="5" Body="&lt;p&gt;It's not practical to come up with a comprehensive list of definitions of signal-to-noise ratio, because different measures are relevant in different applications. Here are a few common measures that I've come across and/or used in the past (you'll find that they are bent toward communications applications):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&amp;quot;Pure&amp;quot; SNR:&lt;/strong&gt; I call this &amp;quot;pure&amp;quot; because it is a literal interpreation of the term &amp;quot;signal to noise ratio.&amp;quot; This measure is just the ratio of the power in the signal of interest to the total noise power over the signal's bandwidth. Any noise present outside of the signal bandwidth can be filtered out without removing any signal power, so it can be ignored. This definition isn't often used for digital communications; there are more useful quantities that I reference below. SNR is more relevant for analog modulation.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{E_b}{N_0}$&lt;/span&gt;: This is the most common measure of signal to noise ratio used for digital communications. Referred to in the comments above by Dilip as the &amp;quot;BEND&amp;quot; ratio, &lt;a href=&quot;http://en.wikipedia.org/wiki/Eb/No&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eb/N0&lt;/a&gt; is the ratio of the energy per (information) bit (&lt;span class=&quot;math-container&quot;&gt;$E_b$&lt;/span&gt;) to the (assumed to be white) noise power spectral density (&lt;span class=&quot;math-container&quot;&gt;$N_0$&lt;/span&gt;) over the signal bandwidth. This is often used as a figure of merit for digital communications systems because it is normalized by the system's symbol rate and modulation format (since it is the energy per bit). This allows very different system implementations to be compared for efficiency on a level playing field, in an apples-to-apples fashion.&lt;/p&gt;&#xA;&lt;p&gt;In some other specific applications, you might also see &lt;span class=&quot;math-container&quot;&gt;$\frac{E_s}{N_0}$&lt;/span&gt; (energy per symbol instead of energy per bit in the numerator) or &lt;span class=&quot;math-container&quot;&gt;$\frac{E_c}{N_0}$&lt;/span&gt;. I've seen two different meanings for the latter: first, in coded communications systems, you might see this, where &lt;span class=&quot;math-container&quot;&gt;$E_c$&lt;/span&gt; stands for the energy per coded bit, in contrast to &lt;span class=&quot;math-container&quot;&gt;$E_b$&lt;/span&gt;, which is the energy per information bit. Another meaning: in &lt;a href=&quot;http://en.wikipedia.org/wiki/DSSS&quot; rel=&quot;nofollow noreferrer&quot;&gt;direct-sequence spread spectrum&lt;/a&gt; systems, you might see &lt;span class=&quot;math-container&quot;&gt;$E_c$&lt;/span&gt; refer to the energy per &lt;em&gt;chip&lt;/em&gt; instead.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{C}{N_0}$&lt;/span&gt;: This quantity is often termed &amp;quot;carrier to noise ratio.&amp;quot; One place that I've seen this used as a common measure of signal quality is in &lt;a href=&quot;http://en.wikipedia.org/wiki/Gps&quot; rel=&quot;nofollow noreferrer&quot;&gt;GPS&lt;/a&gt;-related literature. This is very similar to the &amp;quot;pure&amp;quot; definition of SNR, except that the (again, assumed to be white) noise power spectral density value &lt;span class=&quot;math-container&quot;&gt;$N_0$&lt;/span&gt; is used in lieu of the total noise power over the signal bandwidth. Since bandwidth is a somewhat squishy term that has many different definitions (there is no one particular measure of what a signal's &amp;quot;bandwidth&amp;quot; is that is accepted to be correct), this ratio is somewhat more precise and less ambiguous than the &amp;quot;pure&amp;quot; SNR metric.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2011-10-30T19:30:40.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="554" PostTypeId="1" CreationDate="2011-10-31T05:42:34.537" Score="10" ViewCount="9483" Body="&lt;p&gt;I'm a novice in DSP and I have few doubts regarding the $\mathcal Z$-transform and its region of convergence (ROC). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know what a $\mathcal Z$-transform is. But I'm having trouble with understanding the ROC. First of all I have some confusion with $X(z)$ and $x(z)$. I easily get caught by exchanging these terms. I know the ROC defines the region of where the $\mathcal Z$-transform exists. From the web and my books states that: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If $x[n]$ is a finite-duration sequence, then the ROC is the entire $z$-plane, except possibly $z = 0$ or $\lvert z\rvert = \infty$. A finite-duration sequence is a sequence that is nonzero in a finite interval $n_1 \le n \le n_2$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And later it says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When $n_2 &amp;gt; 0 $ there will be a $z^{-1}$ term and thus the ROC will not include $z=0$. When $n_1 &amp;lt; 0$ then the sum will be infinite and thus the ROC will not include $\lvert z\rvert=\infty$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is where I get stuck!. What they try to say in the above line &quot;&lt;strong&gt;When $n_2 &amp;gt; 0$ there will be a $z^{-1}$ term and thus the ROC will not include $z=0$&lt;/strong&gt;&quot; What do they mean by $z=0$? Are they substituting $z$ as $0$, if so in which equation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we calculate the region of convergence for an infinite sequence?&lt;/p&gt;&#xA;" OwnerUserId="381" LastEditorUserId="1629" LastEditDate="2016-06-25T15:37:02.007" LastActivityDate="2016-06-25T15:37:02.007" Title="How does the $\mathcal Z$-transform's &quot;region of convergence&quot; work?" Tags="|discrete-signals|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="555" PostTypeId="1" CreationDate="2011-10-31T16:35:40.973" Score="11" ViewCount="772" Body="&lt;p&gt;I wanted to ping the DSP hivemind for general thoughts on what would be the best modulation type to use for low frequency underwater communications. I have chosen this project since I can learn a lot from it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some context:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Low frequency as in &amp;lt; 500 Hz (for both carrier and modulated data obviously)&lt;/li&gt;&#xA;&lt;li&gt;BPS of say, 200 Hz would be good.&lt;/li&gt;&#xA;&lt;li&gt;Will certainly have multipath.&lt;/li&gt;&#xA;&lt;li&gt;Frequencies can be smeared due to doppler by a maximum factor of about 0.3% of the original frequency.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I have found thus far:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I was thinking about OFDM, but I have learnt that while channel estimation is much easier, it is much more sensitive to doppler effects.&lt;/li&gt;&#xA;&lt;li&gt;I was also thinking about chirp modulation, has anyone ever done something like that?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What are your thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I have attached some of what I believe are 'worst case' scenarios of the (multipath channel, for a bps = 200 Hz). The channel is in terms of number of bits in the time domain so you can more easily see how many bits pass before the next reflection arrives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Case 1: &lt;img src=&quot;https://i.stack.imgur.com/gWsK9.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Case 2: &lt;img src=&quot;https://i.stack.imgur.com/8brrG.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Case 3: &lt;img src=&quot;https://i.stack.imgur.com/a8gjv.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Case 4: &lt;img src=&quot;https://i.stack.imgur.com/1k1NA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;As we can see, I almost always have a second path of nearly equal magnitude but opposite phase ready to stick it to my main path. &lt;/li&gt;&#xA;&lt;li&gt;For a packet of 1000 bits @ 200 bps, (5 seconds), I suppose the channel could change significantly... but at the same time, we have total control over the packet length and content.&lt;/li&gt;&#xA;&lt;li&gt;We may assume that frequency offsets due to doppler is relatively 'well behaved', ie, no sudden 'jerks'. Frequency offsets due to carrier mismatches can also be thought of as well behaved.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="293" LastEditorUserId="21075" LastEditDate="2020-04-30T16:58:21.960" LastActivityDate="2020-04-30T16:58:21.960" Title="What are thoughts on best modulation to use for underwater acoustic communications at low frequencies?" Tags="|digital-communications|modulation|acoustics|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="557" PostTypeId="2" ParentId="554" CreationDate="2011-10-31T18:37:44.723" Score="5" Body="&lt;p&gt;To be completely honest, I thought the theory behind the Z-transform was kinda opaque in college too. In hindsight, taking a course in complex analysis would have made it clearer. And I too dislike the notational conventions that seem to be used for this stuff. Strictly speaking, the &lt;em&gt;usual&lt;/em&gt; convention here is that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$x[n]$ denotes a discrete-time sequence&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$n\in \mathbb{Z}$&lt;/li&gt;&#xA;&lt;li&gt;the brackets denote a discrete argument&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;$X(z)$ denotes a continuous-valued transformed function&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$z\in\mathbb{C}$ (is a complex number)&lt;/li&gt;&#xA;&lt;li&gt;the parentheses denote a function accepting a continuous-valued parameter&lt;/li&gt;&#xA;&lt;li&gt;the capital $X$ denotes a transformed version of some other function/sequence $x$ (a similar notation is used for Fourier transforms: $F(j\omega)\leftrightarrow f(t)$&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What do they mean by z=0? Are they substituting z as 0, if so in which equation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They mean, just plug $z=0$ into your usual definition of the Z-transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(z) = \sum_{n=\infty}^{\infty} x[n] z^{-n}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally (more precisely, when $x[n] \ne 0$ for some $n \ne 0$), this sum will diverge (to infinity) for some complex $z$. For instance, let $x[0] = 1, x[1] = 1$, and $x[n]=0$ for $n&amp;lt;0$ and $n&amp;gt;1$. Then $X(z) = 1 + z^{-1}$. The ROC does not includes $z=0$, for $\lim_{z\rightarrow 0} X(z)=\infty$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your text says &quot;&lt;em&gt;When $n_2&amp;gt;0$ there will be a $z^{−1}$ term and thus the ROC will not include $z=0$&lt;/em&gt;&quot;, what they mean by that is, when $x[n]$ is nonzero for some $n&amp;gt;0$, it is unavoidable for the z-transform to include a $z^{-n}$ term, which diverges to infinity at $z=0$. That's all.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do we calculate the region of convergence for an infinite sequence?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Lots of math. Ha!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;srsly, the way this is done is to obtain an algebraic formulation for the sequence in question, plug it into the Z-transform definition, and use the tools available from the analysis of geometric series (and complex power series) to determine where this Z-transform converges/diverges. In practice, determining whether $|z|=1$ converges is the most important question to answer, because that determines stability, and whether or not you can obtain a frequency response from the system, etc. But causality might matter too, depending on what you're doing. &lt;/p&gt;&#xA;" OwnerUserId="448" LastActivityDate="2011-10-31T18:37:44.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="558" PostTypeId="1" AcceptedAnswerId="560" CreationDate="2011-10-31T19:51:04.587" Score="14" ViewCount="5382" Body="&lt;p&gt;The definitions of the Fourier transform and inverse Fourier transform I learned in college were&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;F(j\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t}\ dt&#xD;&#xA;$$&#xA;$$&#xD;&#xA;f(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty}F(j\omega)e^{j\omega t} d\omega&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The salient characteristics of this convention are&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Non-unitary transform; frequency-domain units are radians (variable is $\omega$)&lt;/li&gt;&#xA;&lt;li&gt;&quot;Time-domain&quot; units are in time (variable is $t$)&lt;/li&gt;&#xA;&lt;li&gt;Function transforms are denoted by capital letters ($F$ vs. $f$)&lt;/li&gt;&#xA;&lt;li&gt;The $j$ in $F(j\omega)$ strictly denotes that the function is a Fourier transform&lt;/li&gt;&#xA;&lt;li&gt;And of course, the usual EE convention that $j=\sqrt{-1}$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Nowadays I use a much different convention, essentially that used on&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform&quot;&gt;the wikipedias&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-j2\pi\xi x}dx&#xD;&#xA;$$&#xA;$$&#xD;&#xA;f(x) = \int_{-\infty}^{\infty} \hat{f}(\xi) e^{j2\pi\xi x} d\xi&#xD;&#xA;$$&#xA;The characteristics of this convention are&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Unitary transform; frequency-domain units are normalized frequency (variable is $\xi$)&lt;/li&gt;&#xA;&lt;li&gt;&quot;Time-domain&quot; units are unitless (variable is $x$)&lt;/li&gt;&#xA;&lt;li&gt;Function transforms wear hats ($\hat{f}$ vs. $f$)&lt;/li&gt;&#xA;&lt;li&gt;Variables in the Greek alphabet denote transformed variables in the Latin alphabet ($\xi$ vs. $x$)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I greatly prefer this convention for several reasons. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using a unitary convention greatly increases the symmetry and clarity of Fourier duals:&#xA;compare&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\mathrm{rect}(x)\leftrightarrow\mathrm{sinc}(\xi)$,&lt;/li&gt;&#xA;&lt;li&gt;$\mathrm{sinc}(x)\leftrightarrow\mathrm{rect}(\xi)$ to&lt;/li&gt;&#xA;&lt;li&gt;$\mathrm{rect}(t)\leftrightarrow\mathrm{sinc}(\frac{\omega}{2\pi})$,&lt;/li&gt;&#xA;&lt;li&gt;$\mathrm{sinc}(t)\leftrightarrow\mathrm{rect}(\frac{\omega}{2\pi})$.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Using $x$ instead of $t$ for the &quot;time-domain&quot; variable makes the equations more&#xA;agnostic of one's problem domain. This makes it much easier to analogize about&#xA;2D image processing concepts in terms of 1D signal processing concepts, without&#xA;the cognitive dissonance of using $t$ as a variable representing&#xA;&lt;em&gt;distance&lt;/em&gt;, or having to change variables around when going from one domain to the other.&lt;/li&gt;&#xA;&lt;li&gt;I find capital letters to be more useful for denoting discrete-valued variables/functions than for representing transformed functions.&lt;/li&gt;&#xA;&lt;li&gt;Using the hat more clearly denotes the Fourier transform as an &lt;em&gt;operator&lt;/em&gt; that is&#xA;&lt;em&gt;applied&lt;/em&gt; to $f$, where the resulting function accepts a frequency-domain parameter $\xi$. Compare this to the far more ungainly $\mathcal{F}\{f\}$, the&#xA;&quot;traditional&quot; way I learned in college to denote the Fourier transform as an operator,&#xA;which just seemed way too confusing to me at the time ($\mathcal{F}{f(t)}$ vs&#xA;$\mathcal{F}\{f\}(t)$ vs $\mathcal{F}\{f\}(\omega)$ etc.)&lt;/li&gt;&#xA;&lt;li&gt;I generally found that doing signal processing analysis with radians just sprinkled&#xA;a lot more $\pi$s around than I felt necessary. Using units of normalized frequency&#xA;makes a &lt;em&gt;lot&lt;/em&gt; more sense to me, particularly when working through problems involving&#xA;sampling theory.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course, it would be quite vain of me to consider my choice of convention to be&#xA;&lt;em&gt;superior&lt;/em&gt; to that used by others. But I'm having a hard time coming up with good&#xA;reasons to prefer the convention I originally learned in college (ie, reasons&#xA;that don't involve tradition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presently, I can think of one decent reasons for preferring the &quot;traditional&quot; convention:&#xA;Using the non-unitary transform, and the $F(j\omega)$ parameter notation, greatly&#xA;improves notaional consistency with the&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Laplace_transform&quot;&gt;Laplace transform&lt;/a&gt;. Also, hats might be easier to lose/confuse than capital letters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody think of other reasons to prefer the &quot;traditional&quot; (non-unitary) convention?&#xA;Is this &quot;traditional&quot; convention the same as what you learned a signal processing course&#xA;(if you took one)?&#xA;Which convention do &lt;em&gt;you&lt;/em&gt; prefer?&lt;/p&gt;&#xA;" OwnerUserId="448" LastActivityDate="2012-01-29T23:05:55.987" Title="Choices of convention and notation for the Fourier transform?" Tags="|fourier-transform|frequency|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="559" PostTypeId="2" ParentId="558" CreationDate="2011-10-31T20:25:35.820" Score="1" Body="&lt;p&gt;The choice of convention should be the one most appropriate (or familiar) for the audience you are trying to communicate with.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-10-31T20:25:35.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="560" PostTypeId="2" ParentId="558" CreationDate="2011-10-31T20:47:12.830" Score="0" Body="&lt;p&gt;One thing about using x(t) for a signal is the parallel between &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$y = x^2$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$y(t) = x(t)^2$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where x is still an input and y is still an output, just in this case they're signals instead of numbers.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2011-10-31T20:47:12.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="561" PostTypeId="1" AcceptedAnswerId="562" CreationDate="2011-11-01T02:51:15.840" Score="6" ViewCount="327" Body="&lt;p&gt;Is angle modulation spectrum always discrete or this property only holds for periodic modulating signal? &lt;/p&gt;&#xA;" OwnerUserId="504" LastActivityDate="2011-11-02T01:36:26.360" Title="Angle modulation spectrum" Tags="|frequency|frequency-spectrum|modulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="562" PostTypeId="2" ParentId="561" CreationDate="2011-11-01T03:32:52.293" Score="6" Body="&lt;p&gt;You will see lines in the spectrum of a phase-modulated signal if there is some periodicity in the modulating signal. If the modulating signal is not periodic, then the power spectrum of the modulated signal will be smooth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example: consider a BPSK signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If the bits used to modulate the waveform are equally likely to be a one or a zero and are uncorrelated with one another, then there is no periodicity in the modulating signal. The power spectrum of a BPSK signal with independent equally-likely bits has a $sinc^2$ shape with no discrete lines. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you then changed the data bits to add some repetitive framing data, for instance, causing a pattern of invariant bits in the modulating signal, you will begin to see lines appear due to the deterministic periodicity in the modulated signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In practice, one often makes an effort to ensure that bits are equally distributed to ones and zeros without repetitive patterns. Adding a source encoder (e.g. data compression) to your system can help to remove any repetitiveness in your data and whiten the transmitted bitstream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One caveat to the above, courtesy of Dilip Sarwate's comment below, is duplicated here to make it more visible:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, modulating signals such as $\cos(\omega_1 t)+\cos(\omega_2 t)$ where $\omega_1 / \omega_2$ is an irrational number (i.e. no harmonic relationship exists) are not periodic but have lines in the spectrum at $\omega_c \pm m \omega_1$, $\omega_c \pm m \omega_2$, and $\omega_c \pm m \omega_1 \pm n \omega_2$ plus a lot of clutter (smooth spectrum) in between the lines. Here $\omega_c$ denotes the carrier frequency. There are also similar lines (and clutter) near the harmonics of the carrier frequency.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-11-02T01:36:26.360" LastActivityDate="2011-11-02T01:36:26.360" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="565" PostTypeId="2" ParentId="21" CreationDate="2011-11-01T11:32:55.917" Score="2" Body="&lt;p&gt;I suggest using a smoothing spline. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how you can do this using Matlab with the robust spline smoothing function &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/25634-robust-spline-smoothing-for-1-d-to-n-d-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;SMOOTHN&lt;/a&gt; from the Matlab File Exchange (which contains the full source code, so that you can re-implement it somewhere else if needed). Note that it functions with n-dimensional data as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%# - get inputlist from pastebin&#xA;&#xA;%# - smoothen data. Lower factor means less smooth&#xA;smoothingFactor = 1000;&#xA;smoothData = smoothn(inputlist,smoothingFactor);&#xA;&#xA;%# - shift down&#xA;smoothData = smoothData - max(inputlist-smoothData);&#xA;&#xA;%# - show results&#xA;plot(inputlist,'b'),hold on,plot(smoothData,'r')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Rqqk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2011-11-01T11:32:55.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="568" PostTypeId="1" CreationDate="2011-11-01T13:45:03.087" Score="3" ViewCount="3378" Body="&lt;p&gt;I want to help someone with a homework in signal processing, and the courses he provided are some slides, without clear definitions in them. I am required in solving a problem to represent the amplitude spectrum and the phase spectrum of a given signal. I searched the internet and didn't found the definitions of these two. I want to create a Matlab script for these, but if I don't know the definitions I cannot do that. Please give me the definitions for these.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Amplitude spectrum&lt;/li&gt;&#xA;  &lt;li&gt;Phase spectrum&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If there is a Matlab command, or some other program which plots these spectrums directly, I would be very interested. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="229" OwnerDisplayName="Beni Bogosel" LastActivityDate="2011-11-01T21:56:37.870" Title="Definitions for amplitude spectrum and phase spectrum" Tags="|reference-request|" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="569" PostTypeId="2" ParentId="568" CreationDate="2011-11-01T18:35:12.723" Score="1" Body="&lt;p&gt;Beni I think you want something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;samplingFrequency = 1000; % / Hz &#xA;signalFrequency = 50;     % / Hz&#xA;signalLength = 500;&#xA;signal = cos(2*pi*signalFrequency./ samplingFrequency .*[0:1:signalLength - 1]);&#xA;[hh ff] = freqz(signal, 1, 2048, samplingFrequency);&#xA;figure(10);&#xA;plot(ff,10*log10(abs(hh)));&#xA;ylabel('Amplitude in log scale');&#xA;xlabel('Frequency / Hz');&#xA;figure(20);&#xA;plot(ff, angle(hh)); &#xA;ylabel('Phase');&#xA;xlabel('Frequency / Hz');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You do have MATLAB correct?... if you do try it and let me know how else I can help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zyVNb.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/QZcMp.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/u0zYl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, a couple things. First off, remember, since this is a digital signal, it means of course that it was sampled at some frequency $samplingFrequency= 128 or 127$ in your case. The physical frequency of your signal in this case seems to be $signalFrequency = 21$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ratio of $\frac{signalFrequency}{samplingFrequency}$ is equal to the $f_0$ in your case. This is called the 'digital frequency'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your problem it sounds like he also wants you to fix the fft size, (change the 2048 in my code to 128) and the rest of the numbers as I described and run the code. Does he mention how long he wants your signal to be? &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2011-11-01T21:56:37.870" LastActivityDate="2011-11-01T21:56:37.870" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="570" PostTypeId="1" AcceptedAnswerId="571" CreationDate="2011-11-01T18:47:32.097" Score="13" ViewCount="1235" Body="&lt;p&gt;In the scale-space theory the scale-space representation of the signal $f(x), x = (x_1, ..., x_d)$, (in case of image $d = 2$) is given as:&#xA;$L(x, y; t) = g(x, y; t) * f(x, y)$ where $g(x, y; t)$ is a gaussian kernel with parameter $t$ and $*$ is a convolution. By changing the $t$ parameter we receive a more or less smoothed image. As the result coarser representation (parameter $t$) will not contain small objects or noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main point is to find a way of scale-invariant feature detection, right? So that for some image at it's reduced in size copy the features like keypoints will be detected correctly, even if size is different, without finding other noise keypoints. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In the paper they are using the $\gamma$-normalized derivatives.&#xA;$\delta_{\xi, \gamma-norm} = t^{\gamma / 2} \delta_x$. &#xA;What is the meaning of using the $\gamma$-normalized derivative, how does it helps in scale-invariancy?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;From this image we can see that at near the same positions the different keypoints found (different in size). How is that possible?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5u6ef.jpg&quot; alt=&quot;Detected features&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can explain the step-by-step algorithm of scale-invariant feature detection, this would be great. What is actually done? The derivatives can be taken by $x, y$ or $t$. Blob can be detected by taking the the derivative of $L$ by $(x, y)$ variables. How is the derivative by $t$ is helping here? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper I was reading is: &lt;a href=&quot;ftp://ftp.nada.kth.se/CVAP/reports/cvap198.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feature detection with automatic scale selection&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="128" LastEditDate="2019-01-18T23:48:55.673" LastActivityDate="2019-01-18T23:48:55.673" Title="The Scale Space Theory Understanding" Tags="|image-processing|computer-vision|scale-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="571" PostTypeId="2" ParentId="570" CreationDate="2011-11-01T20:00:40.523" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;It &lt;em&gt;really&lt;/em&gt; has been a long time since I have read Lindeberg's papers, so the&#xA;notation looks a bit strange.  As a result, my initial answer was wrong. &#xA;$\gamma$ is not a scale level.  It seems to be a parameter of some sort that can be tuned.  It is true that you need to multiply the derivative by the&#xA;appropriate power of $t$. $t$ itself corresponds to a scale level, and the power  depends on the &lt;em&gt;order&lt;/em&gt; of the derivative.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can find keypoints at multiple scales in the same location.  That is because you look for the &lt;em&gt;local&lt;/em&gt; maxima over scales.  Here's the intuition: think of an image of a face.  At a fine scale you get a blob corresponding to the nose.  At a course scale you get a blob corresponding to the whole face.  The two blobs are centered at the same point, but have different scales.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Here is the whole algorithm:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Decide which image features you are interested in (e. g. blobs, corners, edges)&lt;/li&gt;&#xA;&lt;li&gt;Define a corresponding &quot;detector function&quot; in terms of derivatives, e. g. a Laplacian for blobs.&lt;/li&gt;&#xA;&lt;li&gt;Compute derivatives that you need for your detector function at a range of scales.&lt;/li&gt;&#xA;&lt;li&gt;Multiply the derivative responses by $t^{m \gamma / 2}$, where $m$ is the order of the derivative, to compensate for magnitude decrease.&lt;/li&gt;&#xA;&lt;li&gt;Compute the detector function over the whole scale space.&lt;/li&gt;&#xA;&lt;li&gt;Find local maxima of the detector function over $x, y, t$.&lt;/li&gt;&#xA;&lt;li&gt;These are your interest points, or keypoints.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Edit:&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Lindeberg proves in the paper that $t^{\gamma / 2}$ is the appropriate factor for normalization of derivatives.  I don't think I can reproduce the proof here.&lt;/li&gt;&#xA;&lt;li&gt;You do not take derivatives with respect to $t$.  You only compute derivatives with respect to $x$ and $y$, but you compute them at a range of scales. One way to think about this is you generate a Gaussian scale space first, by repeatedly blurring the image with a Gaussian filter of some variance $t$.  Then compute derivatives with respect to $x$ and $y$ at each scale level.&lt;/li&gt;&#xA;&lt;li&gt;You want to find local maxima over scales because you may have image features of different size at the same location.  Think of an image of concentric circles, like a bulls-eye.  It will give you high responses of a Laplacian at several scales.  Or think of an image of a real human eye filtered by a Laplacian at a range of scales.  You will get a high response at a fine scale for the pupil, a high response an some medium scale for the iris, and a high response at a coarse scale for the whole eye.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The whole point is that you do not know at what scale the features of interest might be ahead of time.  So you look at all scales.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2011-11-02T17:52:39.150" LastActivityDate="2011-11-02T17:52:39.150" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="572" PostTypeId="1" CreationDate="2011-11-02T15:50:07.023" Score="11" ViewCount="4506" Body="&lt;p&gt;I've made a pitch detection algorithm using HPS and I'm facing a problem. I'm a beginner with signal processing and this site helped me before, so I though I should ask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For higher pitches ( &lt;code&gt;eg. &amp;gt;C6:1046.50hz&lt;/code&gt; ) I'm starting to get garbage data from the HPS. The higher the pitch the more garbage I get (by garbage I mean frequencies that are not octave errors nor harmonics and are around 1Hz-20Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've empirical observed:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;the results are worst for higher pitches, if the fundamental is above A6 or so, I get only garbage data.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the FFT works fine even for a very high pitch, (by fine I mean that its peak shows either the fundamental or one of its harmonics, but not garbage)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if I lower the number of harmonics I take in consideration for the HPS, the garbage diminishes, but that makes it harder to discriminate between the fundamental and the harmonics.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is my algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;-&amp;gt;raw buffer -&amp;gt; hann window, 16384 samples, 50% overlap -&amp;gt; zero padding -&amp;gt; FFT -&amp;gt; HPS&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE 1: So, there are a few more things I want to add:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The sample rate I'm recording at is 44100 Hz&lt;/li&gt;&#xA;&lt;li&gt;I've observed that this behavior is barely visible on a guitar, but very visible on an &lt;strong&gt;digital&lt;/strong&gt; piano (for the same played note)&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Here is my hps algorithm, maybe someone with greater experience can spot a problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int hps(float* spectrum, int spectrumSize, int harmonics) {&#xA;&#xA;int i, j, maxSearchIndex, maxBin;&#xA;maxSearchIndex = spectrumSize/harmonics;&#xA;&#xA;maxBin = 1;&#xA;for (j=1; j&amp;lt;=maxSearchIndex; j++) {&#xA;    for (i=1; i&amp;lt;=harmonics; i++) { &#xA;        spectrum[j] *= spectrum[j*i];&#xA;    }&#xA;    if (spectrum[j] &amp;gt; spectrum[maxBin]) {&#xA;        maxBin = j;&#xA;    }&#xA;}&#xA;&#xA;// Fixing octave too high errors    &#xA;int correctMaxBin = 1;&#xA;int maxsearch = maxBin * 3 / 4;&#xA;for (i=2; i&amp;lt;maxsearch; i++) {&#xA;    if (spectrum[i] &amp;gt; spectrum[correctMaxBin]) {&#xA;        correctMaxBin = i;&#xA;    }&#xA;}&#xA;if (abs(correctMaxBin * 2 - maxBin) &amp;lt; 4) {&#xA;    if (spectrum[correctMaxBin]/spectrum[maxBin] &amp;gt; 0.2) {&#xA;        maxBin = correctMaxBin;&#xA;    }&#xA;}&#xA;&#xA;return maxBin;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="33" LastEditorUserId="33" LastEditDate="2011-11-03T14:53:45.920" LastActivityDate="2016-07-01T16:13:24.223" Title="Harmonic Product Spectrum limitations in pitch detection" Tags="|fourier-transform|frequency-spectrum|pitch|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="573" PostTypeId="1" AcceptedAnswerId="578" CreationDate="2011-11-02T11:15:34.233" Score="20" ViewCount="4427" Body="&lt;p&gt;I want to use my phone as a CCTV system to control a room in my house, and display an alert when something is moving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, what I have succeeded in doing is to grab a picture every minute and upload them via a PHP script to my server. Now, I would like to compare the current picture and the picture 1 minute ago and detect if someone entered the room. So basically, I would need to compare differences of pixels on the picture (but also taking in account that a cloud may just say hello and changed brightness during one minute)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a clue on how to achieve that or some doc to read?&lt;/p&gt;&#xA;" OwnerUserId="510" OwnerDisplayName="Profete162" LastEditorUserId="77" LastEditDate="2011-11-16T13:57:12.273" LastActivityDate="2011-11-16T13:57:12.273" Title="How can I compare two pictures from the camera and tell if there are enough differences to detect movement?" Tags="|image-processing|computer-vision|background-subtraction|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="574" PostTypeId="2" ParentId="573" CreationDate="2011-11-02T11:29:31.007" Score="2" Body="&lt;p&gt;I don't know exact solution, but you should make some kind of hash of the image; a smaller data set extracted from the image, which is comparable better than the whole image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think, &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_histogram&quot; rel=&quot;nofollow&quot;&gt;color histogram&lt;/a&gt; is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_matching&quot; rel=&quot;nofollow&quot;&gt;good choice&lt;/a&gt; for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you split your image to areas and make separate histograms for these areas, you can determine the position/path of the intruder.&lt;/p&gt;&#xA;" OwnerDisplayName="ern0" LastActivityDate="2011-11-02T11:29:31.007" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="575" PostTypeId="2" ParentId="573" CreationDate="2011-11-02T11:46:16.057" Score="5" Body="&lt;p&gt;Remember: There are shadows (not just brightness).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really like the idea from James Webster, since it is basically scaling down the resolution in each dimension and comparing the scaled down images (also I don't like thresholds - they are to arbitrary, you have to test and tweak them until you get a good value and the next day these values could be obsolete because of different weather or some other environmental effects)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But to be fair, I also don't have a really good solution. My first idea was to diff each image to a reference image of the empty room and run an edge detection on the diff image. But this would also detect shadows. But I guess you can't differ between shadows and other objects...at least I don't know how. But maybe you can compare the result after the Edge detection between 2 frames, since shadows are mostly moving slowly (still there will be problems when cars move by or when a cloud moves by)&lt;/p&gt;&#xA;" OwnerUserId="513" OwnerDisplayName="Philipp Wendt" LastActivityDate="2011-11-02T11:46:16.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="576" PostTypeId="2" ParentId="572" CreationDate="2011-11-03T07:33:43.330" Score="3" Body="&lt;p&gt;It could be that too few harmonic partials are present in the signal at these higher pitches. The HPS algorithm is pretty simple and relies on those upper harmonics to keep stacking up until the fundamental emerges from the background. Of course, we should wonder, what's your sampling rate? If it's 8000 hz, then there's only room for 3 harmonics of a 1000 hz pitch...&lt;/p&gt;&#xA;" OwnerUserId="267" LastActivityDate="2011-11-03T07:33:43.330" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="577" PostTypeId="1" AcceptedAnswerId="579" CreationDate="2011-11-03T13:28:50.983" Score="10" ViewCount="4407" Body="&lt;p&gt;I'm working on a real-time audio processing project in which I have to downsample a 44.1 kHz to a yet-to-be-determined lower sampling rate essentially for reducing computational complexity. I'm looking for a decent downsampling filter, and I found articles suggesting both IIR (mainly elliptic) and FIR (mainly minimum phase). FIR minumum phase filter wouldn't necessarily work for me, because I need a linear phase filter. So the options are either linear phase FIR that could have a considerable latency in it or a double-filtering IIR (MATLAB &lt;code&gt;filtfilt&lt;/code&gt; command) that first filters forward then backward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are some pros and cons of FIR and IIR as downsampling filters? Which is more practical in a real-time application?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="29" LastEditDate="2013-02-22T17:27:05.503" LastActivityDate="2014-02-13T05:42:38.630" Title="Downsampling lowpass filter for audio: FIR or IIR?" Tags="|infinite-impulse-response|downsampling|finite-impulse-response|linear-phase|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="578" PostTypeId="2" ParentId="573" CreationDate="2011-11-03T13:45:33.040" Score="10" Body="&lt;p&gt;It seems to me what you are looking for is background subtraction technique. With noisy images and changing lighting conditions it could be nontrivial. The current state of the art technique for this is the low-rank matrix representation, but it require not two but many (~dozen) images. Some heavy duty math follow:&#xA;Each image considered as  a vector of pixels, vectors combined into matrix and this matrix is decomposed into low-rank matrix and remnant. Low-rank matrix columns are backgrounds and remnant is moving objects. There are some open-sourced implementations, but only for factorization itself, not complete image pipeline IIRC&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a paper and code for matrix factorization&#xA;&lt;a href=&quot;http://www.ece.rice.edu/~aew2/sparcs.html&quot;&gt;http://www.ece.rice.edu/~aew2/sparcs.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is overview from CS blog and link to other code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://sites.google.com/site/igorcarron2/matrixfactorizations&quot;&gt;https://sites.google.com/site/igorcarron2/matrixfactorizations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://nuit-blanche.blogspot.com/search/label/MF&quot;&gt;http://nuit-blanche.blogspot.com/search/label/MF&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Survey of some other techniques:&#xA;&lt;a href=&quot;http://www.vis.uni-stuttgart.de/uploads/tx_vispublications/Brutzer2011-2.pdf&quot;&gt;http://www.vis.uni-stuttgart.de/uploads/tx_vispublications/Brutzer2011-2.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="198" LastEditorUserId="198" LastEditDate="2011-11-03T13:59:31.993" LastActivityDate="2011-11-03T13:59:31.993" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="579" PostTypeId="2" ParentId="577" CreationDate="2011-11-03T13:56:42.627" Score="10" Body="&lt;p&gt;If linear phase is a requirement, that will probably steer you toward an FIR implementation. It is possible to build IIR filters that have approximate linear phase, but it is easy to design a linear-phase FIR. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're concerned about latency, forward-backward filtering as in &lt;code&gt;filtfilt&lt;/code&gt; isn't really a good option. In general, it's really meant to be used an offline process, since to implement the technique exactly, you have to run the entire signal through forward, then do the same in reverse. That implies that you have access to the entire signal at once, which is not commensurate with low delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, an FIR filter will require a higher order for a given set of performance requierments. However, FIR filters bring some real advantages, such as guaranteed stability, lower susceptibility to roundoff errors (since the quantization error doesn't get fed back through the filter, although you can &lt;a href=&quot;http://en.wikipedia.org/wiki/Noise_shaping&quot;&gt;compensate for this&lt;/a&gt; with some increased complexity), and simply-achieved linear phase response. In addition, efficient FIR filter implementations are available for many processor architectures, mitigating the cost of the extra taps somewhat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to mitigate the extra-tap cost for FIR filters in your situation is to take advantage of efficient multirate signal processing techniques. Specifically, you can use a &lt;a href=&quot;http://www.ws.binghamton.edu/fowler/fowler%20personal%20page/EE521_files/IV-05%20Polyphase%20Filters_2003.pdf&quot;&gt;polyphase decimation&lt;/a&gt; approach to significantly reduce the number of computations that you perform in the process of decimating your signal. This has the effect of decreasing the number of effective taps (in terms of computational complexity) in the decimation filter. In addition, if you need to decimate by a large factor, then multistage approaches can help further reduce your load. &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0137027419&quot;&gt;Lyons' introductory DSP book&lt;/a&gt; has some good easy-to-read material on these topics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given more specific parameters of your system, one could make more pointed recommendations. What are your filter design requirements? What sort of computational capabilities does your platform have? What sample rate will you decimate to?&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-03T13:56:42.627" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="580" PostTypeId="2" ParentId="572" CreationDate="2011-11-03T21:57:57.997" Score="2" Body="&lt;p&gt;For some instruments, the number of significant harmonics produced may change over different pitch ranges.  The partials of the very lowest and highest notes for some physical instruments may exhibit greater inharmonicity.  The number of harmonics that can fit below the anti-alias filter cutoff below Fs/2 will certainly be lower for very high notes.  Your HPS pitch estimator mdy want to take those factors into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The attack transient of some instruments may produce an aharmonic spectral band of noise which may overlap with the HPS search region of some pitches or their significant harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Potentially, the overtones of very high frequencies might even wrap around Fs/2 if the low pass filter before the audio ADC doesn't have a good enough stop band attenuation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-11-03T22:04:21.950" LastActivityDate="2011-11-03T22:04:21.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="581" PostTypeId="2" ParentId="577" CreationDate="2011-11-04T01:49:29.077" Score="1" Body="&lt;p&gt;How low do you mean by &quot;low latency&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you mean below 1 mS with a large sample rate reduction, then a minimum phase FIR may be required.    If you mean around 1/30th of a second, then you might even be able to implement an efficient linear-phase FIR filter using an FFT overlap add/save (fast convolution) approach.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-11-04T01:49:29.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="585" PostTypeId="2" ParentId="573" CreationDate="2011-11-04T16:03:03.390" Score="4" Body="&lt;p&gt;The &quot;matrix factorization&quot; technique &lt;strong&gt;will NOT&lt;/strong&gt; help you do your job! The paper referred by @mirror2image is about the background subtraction but NOT based on &quot;matrix factorization&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using running video to detect moving objects (be it human or vehicles) is an active area of research. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a basic principle the system estimates a typical static background by sampling over multiple pictures and take a difference of energy between incoming image to the background. If the energy is significant the pixel is classified as foreground. Such set of foreground tells you if there is an entry of the object in the system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best reference to your research paper (and also relatively simpler if you want to really implement) would be - W4 System find it &lt;a href=&quot;http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.54.7209&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and see Picardi paper &lt;a href=&quot;http://www-staff.it.uts.edu.au/~massimo/BackgroundSubtractionReview-Piccardi.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; as a more detailed survey for other techniques in the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many challenges that applies to the problem:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Presence of noise creates the issues of major ambiguity. The approach here is to apply efficient temporal filtering and considering variance of noise to make it immune to threshold.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Presence of shadow creates ambiguity of neither being a foreground nor. There are papers who model the color vs. intensity distinction to distinguish shadow vs. real foreground.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The background can be complex like waving trees or sea etc. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The background can have slow or sudden variation of lighting where earlier &quot;learned&quot; background is then adapted to the new one. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;One of the most referred landmark paper is called &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/jckrumm/Publications/WallFlower/final%20published.pdf&quot; rel=&quot;nofollow&quot;&gt;Wall flower algorithm&lt;/a&gt; shows the best way to combine various such scenarios to produce robust moving object detection.&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2011-11-04T16:03:03.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="586" PostTypeId="1" CreationDate="2011-11-04T20:14:10.300" Score="7" ViewCount="3572" Body="&lt;p&gt;Say you wanted to run a X point FFT on the last X audio samples that were played. The problem being, using a normal hann window function would place emphasis on the &quot;middle&quot; of the audio sample. However, the most current audio samples played (the audio samples toward the end) are of the greater importance for algorithms such as real-time beat detection. The question is, which window function best emphasizes the frequencies at the end of the waveform?&lt;/p&gt;&#xA;" OwnerUserId="509" LastActivityDate="2011-11-05T06:08:54.883" Title="Whats the optimal window function to use for analyzing real-time data samples?" Tags="|audio|fourier-transform|window-functions|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="587" PostTypeId="2" ParentId="586" CreationDate="2011-11-05T00:26:07.867" Score="1" Body="&lt;p&gt;I think the glitch in your question comes out at the very end: there are no &quot;frequencies at the end&quot; of the windowed signal. When performing the Fourier transform, the frequency bins don't have localized time; they describe the entire signal.  But you knew that, that's why you are doing the STFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are doing beat detection, you could work in the time domain to get the absolute lowest latency.  But if you are doing beat detection that also detects some transient in the frequency domain, where a sine tone shifting from 440 to 880 hz counts as an onset -- I'd suggest there's more of a fundamental limit to your latency, dependent on the pitch period; and in that case your best bet is to reduce the window size to, say, capture 4 periods of the lowest frequency you are interested in.  If you are &quot;weighting&quot; the last bunch of samples coming in, you might as well shrink the window and get a predictable frequency response out of it. Another thought is to run parallel FFTs, one with a short window, and one with a long window...&lt;/p&gt;&#xA;" OwnerUserId="267" LastActivityDate="2011-11-05T00:26:07.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="588" PostTypeId="2" ParentId="586" CreationDate="2011-11-05T06:08:54.883" Score="4" Body="&lt;p&gt;A full-width rectangular window (a.k.a no window) would best emphasize spectral content near the edges of an FFT aperture, at the cost of artifacts caused by convolution of the spectum with a Sinc function, also called &quot;spectral leakage&quot;.  If you can ignore or compensate for these spectral artifacts then there's little reason to window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you might be asking the wrong question.  If you want the fastest possible response to some specific frequency band, you should be using a minimum phase filter (or a bank of them, as needed) or a close approximation to such, not a faster block DFT.  Then you can update with each new sample instead of waiting to process a block, and tune the time-frequency response of the filter(s) for each specific band of interest.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-11-05T06:08:54.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="589" PostTypeId="1" AcceptedAnswerId="591" CreationDate="2011-11-06T09:22:02.603" Score="7" ViewCount="1565" Body="&lt;p&gt;I've got an offline signal that I want to high-pass filter. Should I use a Butterworth filter, or could I use the fact that the whole signal is known and use an ideal (step) filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a high-degree Butterworth filter is, I think, practically the same thing as using an ideal filter, and a higher degree means a better filter if there's no implementation and processing cost. Could the sharp change in impulse response cause a problem, though?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal is a bioelectric signal that is almost periodic, and I've got 100 periods or so.&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2011-11-06T15:28:14.613" Title="Should I use ideal or non-ideal filters for offline filtering?" Tags="|filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="590" PostTypeId="2" ParentId="589" CreationDate="2011-11-06T14:48:39.677" Score="2" Body="&lt;p&gt;Have you tried to implement a step filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such ideal filters, even in the digital domain, will break.&#xA;Consider that a 'ideal' step response in the frequency domain required an infinite sized array to adequately represent it in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So performing a signal transform to frequency domain, performing a 'perfect' filter, then going back to time domain will give you some erroneous results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out the DSP Guide's chapter on the &lt;a href=&quot;http://www.dspguide.com/ch16.htm&quot; rel=&quot;nofollow&quot;&gt;Windowed Sync Filter&lt;/a&gt; and you will get a good understanding of this phenomena&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2011-11-06T14:48:39.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="591" PostTypeId="2" ParentId="589" CreationDate="2011-11-06T15:28:14.613" Score="5" Body="&lt;p&gt;For most practical applications, filter responses that approach the behavior of the ideal &quot;brick-wall&quot; filter are overkill. I know it's tempting to try to design a really sharp filter when you've got all the time in the world (i.e. for offline applications), but if you really look at the characteristics of your problem, you can most likely get away with something much more reasonable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another good reason not to use a brick-wall filter: its impulse response is infinite in length, and it has the form of a $sinc$ function. When you apply such a filter to your signal, you may notice long-duration &lt;a href=&quot;http://en.wikipedia.org/wiki/Ringing_artifacts&quot; rel=&quot;nofollow&quot;&gt;ringing&lt;/a&gt; in the signal at the output of the filter. This comes from the fact that the $sinc$ function in the filter's impulse response is infinitely long and doesn't decay very fast; the resulting effect is most likely not desirable. In general, filters with long frequency responses are not very suitable for analysis of short signals, as the filter output is dominated by the transient behavior of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aforementioned effects aren't limited strictly to ideal filter responses; if you design a filter with a really sharp cutoff, it's still possible that you will get time-domain artifacts that you don't want. This intuitively makes sense, because you can view the frequency response of the &quot;not-quite-ideal&quot; filter as the response of the ideal filter convolved with a narrow main lobe that smears the response out a bit. Frequency-domain convolution is equivalent to windowing in the time domain; if you look at the impulse response of a very sharp filter that you've designed, it's likely to look much like a $sinc$ function with a window applied to taper the impulse response off at a faster rate than the $sinc$ does on its own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I give the same advice as with most filter-design problems: you should really try to tackle the problem as quantitatively as possible. Using intuition on what might seem like a good approach can often steer you down the wrong path. Instead, think about the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Where is my signal of interest in the spectrum?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What unwanted signals are in the spectrum? Where are they?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How large are the unwanted signals relative to the signal of interest? In order to accomplish my ultimate goal, how much must it be suppressed?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How much distortion can I tolerate on my signal of interest (both in amplitude and phase)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What computational limitations do I have?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The first four questions will give you filter performance specifications that you can use with any number of design methods to arrive at filters that will achieve your goals. The last question is also important, and can be used to choose between different filter topologies (i.e. FIR versus IIR) to find one that is implementable for your application.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-06T15:28:14.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="592" PostTypeId="1" AcceptedAnswerId="601" CreationDate="2011-11-06T17:17:23.727" Score="8" ViewCount="6303" Body="&lt;p&gt;MATLAB has a &lt;code&gt;butter&lt;/code&gt;, which constructs a Butterworth filter given an order and relative cutoff frequency. The filter created can be used to &lt;code&gt;filter&lt;/code&gt; any finite signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does MATLAB do this if the filter has an infinite impulse response? I suppose it must window the signal -- is this done by a simple rectangular window so that all known values are used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, how is the continuous filter discretized? Bilinear transform, impulse response matching, etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think the MATLAB help text explains this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;Y = FILTER(B,A,X)&lt;/code&gt; filters the data in vector &lt;code&gt;X&lt;/code&gt; with the&#xA;     filter described by vectors &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;B&lt;/code&gt; to create the filtered&#xA;     data &lt;code&gt;Y&lt;/code&gt;.  The filter is a &quot;Direct Form II Transposed&quot;&#xA;     implementation of the standard difference equation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)&#xA;                      - a(2)*y(n-1) - ... - a(na+1)*y(n-na)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="471" LastEditorUserId="77" LastEditDate="2011-11-07T01:38:47.840" LastActivityDate="2011-11-07T15:03:09.583" Title="How does MATLAB handle IIR filters?" Tags="|filters|infinite-impulse-response|software-implementation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="593" PostTypeId="1" CreationDate="2011-11-06T17:48:47.060" Score="14" ViewCount="2576" Body="&lt;p&gt;I'm writing a program to filter a 20,000-sample signal with a fifth-order Butterworth filter offline. I've got access to an FFT implementation. There seems to be two alternatives for implementing the filtering:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;convolving the signal with the impulse response in the time domain, or&lt;/li&gt;&#xA;&lt;li&gt;multiplying the signal with the impulse response in the frequency domain and inverse-transforming the result&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These methods would be identical in the theoretical FT case. Doing it in real life with the DFT, though, I suppose things are different. Is one of the methods numerically more stable? Are there any other problems that I should be aware of? The number of calculations is not important.&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2011-11-07T13:13:49.763" Title="Is it numerically more stable to implement filtering as multiplication or convolution?" Tags="|filters|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="594" PostTypeId="1" AcceptedAnswerId="600" CreationDate="2011-11-06T21:29:20.480" Score="7" ViewCount="1550" Body="&lt;p&gt;I have written my own LSE equalizer (that works on the bit level), and literature I have read says that 'fractional' based ones are much better. So how exactly does one get 'fractional' bits? Is it as simple as resampling the softbit decisions to 2x, 4x or whatever of their bit rate and applying the equalizer like that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2011-11-07T13:49:53.137" Title="How exactly to implement the fractional part of a 'fractional equalizer'?" Tags="|demodulation|equalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="595" PostTypeId="2" ParentId="593" CreationDate="2011-11-07T02:02:10.543" Score="2" Body="&lt;p&gt;Why do you suppose things will be different? The theoretical concepts should translate to practical applications, with the only difference being that of floating point issues, which we can't escape. You can easily verify with a simple example in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=randn(5,1);&#xA;y=randn(5,1);&#xA;X=fft(x,length(x)+length(y)-1);&#xA;Y=fft(y,length(x)+length(y)-1);&#xA;&#xA;z1=conv(x,y);z2=ifft(X.*Y);&#xA;z1-z2&#xA;&#xA;ans =&#xA;&#xA;   1.0e-15 *&#xA;&#xA;   -0.4441&#xA;   -0.6661&#xA;         0&#xA;   -0.2220&#xA;    0.8882&#xA;   -0.2220&#xA;         0&#xA;   -0.4441&#xA;    0.8882&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, the errors are of the order of machine precision. There shouldn't be any reason to not use the FFT method. As Endolith mentioned, it is much more common to use the FFT approach to filter/convolve/cross-correlate, etc. and a lot faster except for very small samples (like in this example). Not that time-domain processing is never done... it all boils down to the application, needs and constraints.&lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-11-07T02:02:10.543" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="596" PostTypeId="2" ParentId="206" CreationDate="2011-11-07T03:54:07.377" Score="24" Body="&lt;p&gt;They don't both measure how much a sinusoid is delayed. Phase delay measures exactly that. Group delay is a little more complicated. Picture a short sine wave with an amplitude envelope applied to it so that it fades in and fades out, say, a gaussian multiplied by a sinusoid. This envelope has a shape to it, and in particular, it has a peak that represents the center of that &quot;packet.&quot; Group delay tells you how much that amplitude envelope will be delayed, in particular, how much the peak of that packet will move by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to think about this by going back to the definition of group delay: it's the derivative of phase. The derivative gives you a linearization of the phase response at that point. In other words, at some frequency, the group delay is telling you approximately how the phase response of the neighboring frequencies relate to the phase response at that point. Now, remember how we're using an amplitude-modulated sinusoid. The amplitude modulation will take the sinusoid's peak, and introduce sidebands at neighboring frequencies. So, in a way, the group delay is giving you information about how the sidebands will be delayed relative to that carrier frequency, and applying that delay will change the shape of the amplitude envelope in some way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The crazy thing? Causal filters can have negative group delay! Take your gaussian multiplied by a sinusoid: you can build an analog circuit such that when you send that signal through, the envelope's peak will appear in the output before the input. It seems like a paradox, since it would appear that the filter has to &quot;see&quot; into the future. It's definitely weird, but a way to think about it is that since the envelope has a very predictable shape, the filter already has enough information to anticipate what is going to happen. If a spike were inserted in the middle of the signal, the filter would not anticipate that. Here's a really interesting article about this: &lt;a href=&quot;http://www.dsprelated.com/showarticle/54.php&quot;&gt;http://www.dsprelated.com/showarticle/54.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2011-11-07T03:54:07.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="597" PostTypeId="2" ParentId="593" CreationDate="2011-11-07T04:07:37.140" Score="7" Body="&lt;p&gt;With convolution, you are not going to run into any stability problems, because there is no recursive filtering, so you are not going to accumulate any errors. In other words, the system is all zeros, no poles. I have heard anecdotally, but not verified for myself, that FFT-based convolution has &lt;em&gt;lower&lt;/em&gt; error than time-domain convolution, simply because it has O(n log n) arithmetic operations rather than O(n^2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, as far as I am aware, Butterworth filters are implemented as recursive (IIR) filters, so that is a different topic. IIR filters have poles as well as zeros, so there can be stability issues in practice. Also, for IIR filters, FFT-based methods are not an option, but on the upside, IIR filters tend to be very low order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as stability issues with IIR filters, they tend to have problems at higher orders -- I'll just throw out a number and say roughly 6th order is pushing it. Instead, they are typically implemented as cascaded biquads (2nd order filter sections). For your 5th order filter, write it as a z-domain transfer function (it'll be a 5th degree rational function), and then factor it into its 5 poles and 5 zeros. Collect the complex conjugates, and you'll have two biquads and one first-order filter. In general, stability problems tend to crop up as the poles get closer to the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There can also be issues with noise and limit cycles in IIR filters, so there are different filter topologies (i.e. direct form I, direct form II) that have different numeric properties, but I wouldn't overthink this point -- just use double-precision and it'll almost certainly be good enough.&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2011-11-07T04:07:37.140" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="598" PostTypeId="2" ParentId="592" CreationDate="2011-11-07T12:35:04.490" Score="2" Body="&lt;p&gt;MATLAB's filter function simply implements the difference equation for a Direct form II transformed filter. There is no reason to digitize the filter as it it's design in the discrete space in the first place. filter()'s output has the same the length as the input. That's technically &quot;wrong&quot; as it truncates the part of the filter that would extend that length. If you went to get access to the tail you can append a decent amount of zeros to your input signal. Since it's an &quot;infinite&quot; response you can't do that perfectly but in practice in most application it's not very difficult to do.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-11-07T12:35:04.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="599" PostTypeId="2" ParentId="593" CreationDate="2011-11-07T13:13:49.763" Score="6" Body="&lt;p&gt;In nearly all cases your best choice is neither convolution nor FFT but simply applying the IIR filter directly (using e.g. the sosfilt() function). This will be vastly more efficient in terms of CPU and memory consumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether it makes a numerical difference depends on the specific filter. The only case where some difference may creep in are if the poles are very, very close to the unit circle. Even there a few tricks that can help. DO NOT USE transfer function representation and filter() but use poles and zeroes with sosfilt(). Here is an example for the difference.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 2^16;  % filter length&#xA;fs = 44100; % sample rate&#xA;x = zeros(n,1); x(1) = 1;&#xA;f0 = 15; % cutoff frequency in Hz&#xA;% design with poles and zeroes&#xA;[z,p,k] = butter(5,f0*2/fs);&#xA;clf&#xA;plot(sosfilt(zp2sos(z,p,k),x));&#xA;% design with transfer function&#xA;[b,a] = butter(5,f0*2/fs);&#xA;hold on&#xA;plot(filter(b,a,x),'k');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;filter() goes bad at a cutoff of about 15Hz @44.1kHz. For sosfilt() the cutoff can be well below 1/100 of Hz @44.1kHz without any problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;IF you have stability problems the FFT doesn't help much either. Since your filter is an IIR filter, the impulse response is infinite and would have to be truncated first. At these very low frequency the impulse response gets so long that the FFT becomes impractical as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you want a cutoff of 1/100 Hz @ 44.1 kHz and want a dynamic range in the impulse response of 100 dB, you need roughly 25 million samples !!! That's almost 10 minutes at 44.1 kHz and many, many times longer than your original signal&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-11-07T13:13:49.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="600" PostTypeId="2" ParentId="594" CreationDate="2011-11-07T13:49:53.137" Score="3" Body="&lt;p&gt;A typical (&quot;non-fractional&quot;) equalizer operates at the symbol rate. That is, the inputs that you apply to the equalizer are generally soft decisions on what the unequalized received symbols are. A linear equalizer then takes this stream of soft symbol metrics and applies a linear filter that (hopefully) corrects for any non-ideal frequency response found in the path from modulator to demodulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference with a fractionally-spaced equalizer (FSE) is the sample rate that it runs at: instead of the one sample per symbol that you see with a &quot;standard&quot; equalizer, an FSE operates at some multiple of the symbol rate. Typical values I've seen before are $T/2$- and $T/4$-spaced equalizers, which operate at twice and four times the symbol rate, respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These samples should be straightforward to obtain; whatever processing steps in your system are used to generate the symbol decisions (e.g. when obtaining symbol timing synchronization) almost certainly operate at a minimum of 2 samples per symbol. Instead of decimating the receiver output to one sample per symbol, keep the higher sample rate intact through the equalizer in that case.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-07T13:49:53.137" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="601" PostTypeId="2" ParentId="592" CreationDate="2011-11-07T15:03:09.583" Score="8" Body="&lt;p&gt;This isn't really a MATLAB-specific issue; I see a couple more general questions:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How do you implement a digital IIR filter?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You can apply any general digital filter by &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution#Discrete_convolution&quot;&gt;convolving&lt;/a&gt; its &lt;a href=&quot;http://en.wikipedia.org/wiki/Impulse_response&quot;&gt;impulse response&lt;/a&gt; with the signal that you want to filter. That looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;y[n] = \sum_{k=0}^{N-1} x[k] h[n-k]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works great for &lt;a href=&quot;http://en.wikipedia.org/wiki/Fir_filter&quot;&gt;FIR&lt;/a&gt; filters, but you run into complications with &lt;a href=&quot;http://en.wikipedia.org/wiki/Iir_filter&quot;&gt;IIR&lt;/a&gt; systems, because their impulse responses are infinitely long ($N \rightarrow \infty$ in the above sum). That makes the filter output difficult to calculate using the straightforward convolution sum above. To actually implement an IIR filter, we need a way to express the filter output in a way that is more computationally tractable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The attribute of an IIR filter that makes its impulse response infinitely long is the system's &lt;a href=&quot;http://en.wikipedia.org/wiki/Recursion&quot;&gt;recursive&lt;/a&gt; nature; there is &lt;a href=&quot;http://en.wikipedia.org/wiki/Feedback&quot;&gt;feedback&lt;/a&gt; from the output back to the filter input. This means that the output of an IIR filter at any given instant of time can depend upon two separate information sources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The input signal to the filter, past and present, and&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Past values of the filter output signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This leads to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Difference_equation&quot;&gt;difference equation&lt;/a&gt; representation of the IIR system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;a_0 y[n] = \sum_{k=1}^{M-1} a_k y[n-k] + \sum_{k=0}^{N-1} b_k x[n-k]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This representation illustrates that we can implement an IIR filter by calculating a weighted sum of $M$ past outputs of the filter and $N$ past inputs of the filter (in practice, $N$ and $M$ could and often are the same; the &lt;em&gt;order&lt;/em&gt; of the filter when defined as above is $max(M,N) - 1$). This is a closed-form expression that captures the behavior of the filter fully, suitable for automated implementation, and is the equation referenced in the MATLAB help excerpt that you showed in your question. Note that $a_0$ is almost exclusively assumed to be equal to $1$; I only included it because it is shown in the quoted help text, referenced as &lt;code&gt;a(1)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to specifically answer your question, as the text suggests, MATLAB implements IIR systems using the above equation. When you design an IIR filter with MATLAB or otherwise, you get two sets of coefficients ($a_k$ and $b_k$ in the difference equation) that define how to weight past filter inputs and outputs in the filter implementation. There are some other subtleties that are sometimes relevant; for instance, the text refers to using a &quot;direct-form II transposed&quot; realization of the filter. You then apply the filter by calculating the difference equation above for each desired output sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are in fact &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_filter#Filter_realization&quot;&gt;a number of topologies&lt;/a&gt; that can be used to implement digital filters, each with their own tradeoffs. DF2T is often used because of its more efficient structure (it contains a minimum number of delay elements) and its improved robustness to roundoff error (since the feedforward coefficients $b_k$ are implemented first).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How does MATLAB design Butterworth filters?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The documentation for the &lt;code&gt;butter&lt;/code&gt; function does not specify how it generates the discrete approximation to the analog &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter&quot;&gt;Butterworth filter&lt;/a&gt; prototype. However, by peeking into &lt;code&gt;butter.m&lt;/code&gt;, you find:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% step 5: Use Bilinear transformation to find discrete equivalent:&#xA;if ~analog,&#xA;    [a,b,c,d] = bilinear(a,b,c,d,fs);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it seems that it uses the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform&quot;&gt;bilinear transform&lt;/a&gt; to map the Butterworth filter prototype to a digital filter realization.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-07T15:03:09.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="602" PostTypeId="1" AcceptedAnswerId="610" CreationDate="2011-11-06T22:20:20.593" Score="10" ViewCount="7247" Body="&lt;p&gt;I am trying to create a pitch-detection program which extracts the frequencies of peaks in a power spectrum obtained from an FFT (&lt;code&gt;fftpack&lt;/code&gt;). I am extracting the peak frequencies from my spectrum using &lt;a href=&quot;http://www.dspguru.com/dsp/howtos/how-to-interpolate-fft-peak&quot; rel=&quot;nofollow&quot;&gt;Quinn's First Estimator&lt;/a&gt; to interpolate between bin numbers. This scheme seems to work well under certain conditions. For example, using a rectangular window function with a window size of 1024 and a sample rate of 16000, my algorithm correctly identifies the frequency of a &lt;a href=&quot;http://en.wikipedia.org/wiki/A440_(pitch_standard)&quot; rel=&quot;nofollow&quot;&gt;pure A440 tone&lt;/a&gt; as 440.06 with a second partial frequency of 880.1. However, under other conditions, it produces inaccurate results. If I change the sample rate (e.g to 8000) or the window size (e.g. to 2048), it still correctly identifies the first partial as 440, but the second partial is somewhere around 892.  The problem becomes even worse for inharmonic tones like those produced by a guitar or piano.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My general question is: In what way do the sample rate, window size, and window function affect frequency estimation of FFT peaks? My assumption was that simply increasing the resolution of the spectrum would increase the accuracy of peak frequency estimation, but this is clearly not my experience (zero padding also does not help).  I am also assuming that the choice of window function will not have much effect because spectral leakage should not change the peak &lt;em&gt;location&lt;/em&gt; (though, now that I think about it, spectral leakage could potentially influence the interpolated frequency estimate if the magnitudes of bins adjacent to the peak are artificially increased by leakage from other peaks...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="526" OwnerDisplayName="will.pett" LastEditorUserId="1629" LastEditDate="2016-06-03T09:34:23.797" LastActivityDate="2016-06-03T09:34:23.797" Title="How do window size, sample rate influence FFT pitch estimation?" Tags="|fft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="603" PostTypeId="2" ParentId="602" CreationDate="2011-11-07T06:25:24.983" Score="1" Body="&lt;p&gt;You definitely need a suitable window function - the effects of spectral leakage vary significantly depending on how the pitch period and FFT window length are related - if you get a large transient between the last and first sample of the FFT window then this will produce very nasty smearing of the spectrum, whereas if you get lucky and this discontinuity is small then the resulting spectrum will be a lot cleaner. This is probably why you are seeing inconsistencies when you change any of your parameters such as FFT size. With a suitable window function you will get a consistent spectrum as the pitch changes.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastActivityDate="2011-11-07T15:44:51.663" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="604" PostTypeId="2" ParentId="602" CreationDate="2011-11-07T07:03:32.583" Score="4" Body="&lt;p&gt;First, peak frequency estimation and pitch estimation are two different things.  Pitch is a psycho-acoustic phenomenon.  People can hear a pitch even with the fundamental frequency completely missing, or relatively weak compared to most other peaks, as in the low notes produced by some instruments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, using no window on an FFT is equivalent to using a rectangular window, which convolves your spectrum with the Sinc function.  The Sinc function has lot of humps spread far from the peak which will show up for all frequencies that are not exactly periodic in the FFT length (also know as &quot;spectral leakage&quot;).  All this energy leakage from one strong frequency will interfere with the position estimation of other frequency peaks.  So a more suitable window function (Hamming or von Hann) might help reduce this interference between peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A longer FFT will reduce the delta frequency between bin centers, which should increase interpolation and thus frequency estimation accuracy for stationary spectrums.  However if the FFT is so long that the spectrum changes within the FFT window, all those changed frequencies will be blurred together in a longer FFT.&lt;/p&gt;&#xA;" OwnerUserId="154" OwnerDisplayName="hotpaw2" LastEditorUserId="154" LastEditDate="2011-12-30T05:52:12.080" LastActivityDate="2011-12-30T05:52:12.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="605" PostTypeId="1" CreationDate="2011-11-07T21:15:55.877" Score="9" ViewCount="121" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/u73Uj.png&quot; alt=&quot;Example image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a set of images which consist of a fairly regular pattern - essentially a set of roughly concentric distorted ellipses - with a small area (&amp;lt;1% of the total image area) obscured by a circular disk. I'd like to be able, digitally, to reconstruct the part of the pattern which is hidden by the disk and produce an image which is 'complete', as it would look if the disk were not there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the pattern is not completely regular (the ellipses are distorted and the centre moves around from image to image), it's pretty obvious to a human observer what the obscured part of the pattern would look like - one could draw it in with a pencil in a moment! I wonder therefore if there exists an image-processing algorithm which would enable me to do this automatically - for example, transforming the image into some suitable space that separates the circular disk from the rest of the pattern, filtering out the disk, then doing the inverse transform to reconstruct the image. Not being a specialist in this field, however, I don't really know what I'm looking for. Does anyone have any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="527" LastEditorUserId="527" LastEditDate="2011-11-08T19:33:05.053" LastActivityDate="2011-11-09T01:24:53.563" Title="How do I reconstruct a covered-over part of a regular pattern" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="606" PostTypeId="1" AcceptedAnswerId="607" CreationDate="2011-11-07T21:16:23.740" Score="10" ViewCount="4924" Body="&lt;p&gt;I've got a first-order Butterworth filter with the cutoff frequency $\omega_c$. Its transfer function is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s) = \frac{\omega_c}{s+\omega_c}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the bilinear transform to find an $H(z)$ (what is that function called?), I get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{\omega_c}{\frac{2}{T}\frac{z-1}{z+1} + \omega_c}&#xD;&#xA;= \frac{\omega_c z + \omega_c}{\left(\frac{2}{T}+\omega_c\right)z + \omega_c-\frac{2}{T}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I can't reconcile this result with what Matlab is doing. It seems wrong, no matter what value of $T$. I assume that &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;A&lt;/code&gt; below are the coefficients of $H(z)$.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; [B,A] = butter(1,0.5)&#xA;B = 0.5000    0.5000&#xA;A = 1.0000   -0.0000&#xA;&amp;gt;&amp;gt; [B,A] = butter(1,0.6)&#xA;B = 0.5792    0.5792&#xA;A = 1.0000    0.1584&#xA;&amp;gt;&amp;gt; [B,A] = butter(1,0.7)&#xA;B = 0.6625    0.6625&#xA;A = 1.0000    0.3249&#xA;&amp;gt;&amp;gt; [B,A] = butter(1,0.8)&#xA;B = 0.7548    0.7548&#xA;A = 1.0000    0.5095&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I misunderstanding?&lt;/p&gt;&#xA;&#xA;&#xA;" OwnerUserId="471" LastEditorUserId="440" LastEditDate="2012-04-17T08:55:43.667" LastActivityDate="2012-04-17T08:55:43.667" Title="Why does this manual bilinear transformation yield different results from Matlab's?" Tags="|filters|matlab|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="607" PostTypeId="2" ParentId="606" CreationDate="2011-11-07T21:44:39.907" Score="10" Body="&lt;p&gt;A couple things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before making the substitution $s = \frac{2}{T} \frac{z-1}{z+1}$, you need to &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform#Frequency_warping&quot;&gt;prewarp&lt;/a&gt; the cutoff frequency by making the substitution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\omega_{c,w} = \frac{2}{T} \tan (\omega_c\frac{T}{2})&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_{c,w}$ is the warped cutoff frequency. This is necessary because the bilinear transform maps the left-half plane in the Laplace domain (used in analog filter design) to the unit circle in the $z$-domain in a nonlinear fashion. Therefore, as you approach the Nyquist rate (digital frequencies of $\pm \pi$), the approximation to the analog filter prototype becomes inaccurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the second parameter that you are passing to the &lt;code&gt;butter&lt;/code&gt; function is the normalized cutoff frequency, not the sampling interval $T$. The normalized frequency used by that function is in the interval $(0,1)$ and is equal to the ratio of the desired cutoff frequency to the Nyquist rate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\omega_n = \frac{\omega_c}{2 \pi \frac{f_s}{2}}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\omega_n = \frac{\omega_c}{\pi f_s}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\omega_n = \frac{\omega_c T}{\pi}&#xD;&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-07T21:44:39.907" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="608" PostTypeId="2" ParentId="606" CreationDate="2011-11-07T21:45:39.530" Score="5" Body="&lt;p&gt;When opening the code for MATLAB's &lt;code&gt;butter&lt;/code&gt; function, we see that it uses frequency &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform#Frequency_warping&quot;&gt;pre-warping&lt;/a&gt; :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%# step 1: get analog, pre-warped frequencies&#xA;if ~analog,&#xA;    fs = 2;&#xA;    u = 2*fs*tan(pi*Wn/fs);&#xA;else&#xA;    u = Wn;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6" LastActivityDate="2011-11-07T21:45:39.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="609" PostTypeId="2" ParentId="605" CreationDate="2011-11-08T00:23:32.250" Score="4" Body="&lt;p&gt;You can try using the Hough transform to detect the disk and the visible ellipses.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you may want to do a search for &quot;texture generation&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most importantly, keep in mind that just because a person can do something effortlessly, it doesn't mean that it is easy to program a computer to do it. Virtually any vision task is very easy for people, but are extremely hard for computers.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2011-11-09T01:24:53.563" LastActivityDate="2011-11-09T01:24:53.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="610" PostTypeId="2" ParentId="602" CreationDate="2011-11-08T05:22:17.617" Score="8" Body="&lt;ol&gt;&#xA;&lt;li&gt;Use a Gaussian window - the Fourier transform of a Gaussian is a Gaussian&lt;/li&gt;&#xA;&lt;li&gt;Log-scale the spectrum to emphasize peaks and turn the Gaussian peaks into parabolic peaks&lt;/li&gt;&#xA;&lt;li&gt;Use parabolic interpolation to find the true peaks.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note that, as mentioned in §D.1, the Gaussian window transform magnitude is precisely a parabola on a dB scale. As a result, quadratic spectral peak interpolation is &lt;em&gt;exact&lt;/em&gt; under the Gaussian window. Of course, we must somehow remove the infinitely long tails of the Gaussian window in practice, but this does not cause much deviation from a parabola, as shown in Fig.3.30.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dHcGC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I estimate 1000.000004 Hz for a 1000 Hz waveform this way: &lt;a href=&quot;https://gist.github.com/255291#file_parabolic.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/255291#file_parabolic.py&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're having trouble, plot the spectrum and use your eyes to see why it's not working.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2011-11-08T05:22:17.617" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="611" PostTypeId="1" AcceptedAnswerId="618" CreationDate="2011-11-08T05:37:05.133" Score="9" ViewCount="5675" Body="&lt;p&gt;This question is related to on &lt;a href=&quot;https://dsp.stackexchange.com/questions/5/how-to-decide-what-platform-is-best-to-implement-real-time-audio-processing-on&quot;&gt;How to decide what platform is best to implement real-time audio processing on?&lt;/a&gt;, but focusing on Windows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to be able to take input from a data acquisition board and process it (either through Matlab or a custom program), and use the result of that program to drive an external device that is attached through USB.  I know that getting hard real-time responses with Windows is nearly impossible (as there is a &quot;wiggle&quot; (technical term) of 3-15ms).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the most effective way to decrease this wiggle time?  Is this possible?  Should I be looking for an embedded solution straight away?&lt;/p&gt;&#xA;" OwnerUserId="76" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2020-07-22T16:39:49.343" Title="Is real-time signal processing possible under Windows?" Tags="|real-time|online-processing|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="612" PostTypeId="1" CreationDate="2011-11-08T06:14:24.000" Score="5" ViewCount="154" Body="&lt;p&gt;I have discrete-time model of 2-user CDMA system with: $b_1=-1, b_2=+1, \alpha_1, \alpha_2, s_1, s_2$ and $n$ white noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the recovered infromation bits for user 1 and user 2 respectively if polarity detection is used?&#xA;If the optimum MLE is used, what are the recovered infromation bits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to solve but stucked with polarity.&lt;/p&gt;&#xA;" OwnerUserId="486" LastActivityDate="2011-11-08T06:14:24.000" Title="Discrete-time model of 2-user CDMA system, recovered information at receiver using polarity detection?" Tags="|discrete-signals|matched-filter|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="613" PostTypeId="2" ParentId="611" CreationDate="2011-11-08T14:22:12.020" Score="9" Body="&lt;p&gt;if you need to keep jitter (assuming that's what you mean by &quot;wiggle&quot; :) down to &amp;lt;1ms I'd say forget Windows.  Does the absolute latency from input to output matter, or is it &lt;em&gt;just&lt;/em&gt; the jitter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might manage it some of the time, but &lt;em&gt;guaranteeing&lt;/em&gt; it is unlikely.  What's the penalty for failing to meet the deadline?  Will it blow up speakers?  Drive a robot arm too hard against an end-stop?  Or something more benign?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that your output is USB is also not likely to help in the jitter stakes as there's lots of extra OS interaction there, and the topology of the bus will also hinder your potential latency - if your output is at the end of a string of a few hubs, for example.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2011-11-08T14:22:12.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="614" PostTypeId="1" AcceptedAnswerId="619" CreationDate="2011-11-08T14:45:00.353" Score="9" ViewCount="1089" Body="&lt;p&gt;What are the Fourier-, Laplace- and Z-transforms of the impulse response of a filter called? I've seen $H(s)$ referred to as the system function or transfer function, what about $H(i\omega)$ and the discretized $H(z)$?&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2011-11-08T23:03:36.157" Title="What are $H(i\omega)$, $H(s)$ and $H(z)$ called?" Tags="|filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="615" PostTypeId="2" ParentId="611" CreationDate="2011-11-08T14:58:08.620" Score="5" Body="&lt;p&gt;Whether this is possible or not depends on your latency requirements, i.e. the total delay between input and output. A good starting point could be setting up a digital audio workstation using recording software such as ProTools, Sonar, Ableton, Cubase etc. These work with inexpensive (sort of) I/O hardware and come with low latency optimized drivers. Some of these have &quot;plug in&quot; interfaces that allow you to loop in your own signal processing. A popular format is VST from Steinberg which is supported by many hosts. It used to be open and free but may require a license now. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://www.kvraudio.com/wiki/&quot;&gt;http://www.kvraudio.com/wiki/&lt;/a&gt; is a good resource for that sort of thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to process in Matlab you may have to write your own drivers. I've seen that done with DLLs and also native JAVA interfaces. You can also hack something together with audioplayer() and audiorecorder() but these may require fairly high latency to deal with Windows interrupts and doing other stuff. In essence you setup a GUI control with a  callback that's triggered to a time. In the call back you read all available inputs, process them, shove them into the output and hope for the best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general it helps to keep the Windows box as &quot;clean&quot; as possible, i.e. no network connection (while you process audio), no anti-virus software and run only the absolute minimum of start up items, software &amp;amp; services. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-11-08T14:58:08.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="616" PostTypeId="1" AcceptedAnswerId="632" CreationDate="2011-11-08T16:13:32.680" Score="10" ViewCount="173" Body="&lt;p&gt;I'm trying to HP-filter a signal by LP-filtering it and subtracting the output from the original filter. To obtain the LP-filtered signal, I backward-forward filtered using a third-order Butterworth filter for a 16,000-sample signal. The cutoff frequency was 0.5 Hz @ 250 Hz. No window was used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first 85% or so of samples, the output of this method seems to overlap completely with the actually HP-filtered signal. However, at the end of the output, there is a supsiciously sinc-like phenomenon.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What causes it?&lt;/li&gt;&#xA;&lt;li&gt;What could I change to make this method feasible? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here are the two signals overlaid. The blue one is HP-filtered, and the red one obtained by subtraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sbRLH.png&quot; alt=&quot;HP and orig-LP signals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the absolute difference per sample. They are never exactly equal; the minimum difference is 8e-12. 87% of the values are below 0.01.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gjd1Z.png&quot; alt=&quot;difference between the two methods&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If there's a better way to obtain an HP filter from an LP filter's $H(z)$, I'd be happy to learn it.)&lt;/p&gt;&#xA;" OwnerUserId="471" LastEditorUserId="471" LastEditDate="2011-11-08T16:23:14.853" LastActivityDate="2011-11-11T21:02:34.453" Title="What is this sinc doing in my LP-turned-HP filter output?" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="617" PostTypeId="2" ParentId="616" CreationDate="2011-11-08T17:13:01.390" Score="0" Body="&lt;p&gt;You are doing a backwards-forwards filter for one, and a forwards-only filter for the other.  Thus the two filters will behave differently at one or both edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is strongly stationary and exactly periodic in the data window length, you could try wrapping the data around circularly and start your filters outset by their impulse response lengths.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-11-08T17:13:01.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="618" PostTypeId="2" ParentId="611" CreationDate="2011-11-08T18:39:38.610" Score="4" Body="&lt;p&gt;Windows is not real time OS, so well, you don't have true realtime processing capabilities in Windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Windows Vista, Microsoft offered a new API that among other thing targeted strict performance, where &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/dd370844%28v=vs.85%29.aspx&quot; rel=&quot;nofollow&quot;&gt;Exclusive-Mode Streams&lt;/a&gt; promised performance close to real-time. This is achieved with a few powerful things working together, including short and exclusive path to audio hardware from user mode components, specific multimedia scheduling. Let me quote &lt;a href=&quot;http://en.wikipedia.org/wiki/Technical_features_new_to_Windows_Vista#Audio_performance&quot; rel=&quot;nofollow&quot;&gt;Wiki&lt;/a&gt; on this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For audio professionals, a new WaveRT port driver has been introduced&#xA;  that strives to achieve real-time performance by using the multimedia&#xA;  class scheduler and supports audio applications that reduce the&#xA;  latency of audio streams. As a result, user mode applications can&#xA;  completely govern streams of audio without any code execution in the&#xA;  kernel during runtime. WaveRT allows the user mode application direct&#xA;  access to the internal audio hardware buffers and sample position&#xA;  counters (data in the memory that is mapped to the audio hardware DMA&#xA;  engine). It allows applications to poll the current position in the&#xA;  DMA memory window that the hardware is accessing. WaveRT also supports&#xA;  the notion of a hardware generated clock notification event, similar&#xA;  to the ASIO API, so that applications need not poll for current&#xA;  position if they don't want to. WaveRT however works only with PCI,&#xA;  PCI Express or onboard audio devices; it does not work with USB or&#xA;  FireWire interfaces which are more widespread in the professional&#xA;  audio industry.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This new mode of operation opened exciting opportunities for low latency audio processing, such as &lt;a href=&quot;http://social.msdn.microsoft.com/Forums/en-AU/windowspro-audiodevelopment/thread/b545f1ac-213f-4e61-b7fa-b61df9823b73&quot; rel=&quot;nofollow&quot;&gt;reported by happy users&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I get perfect rock solid stable audio with 2ms buffers + 0.5ms&#xA;  latency, compared to semi-stable audio in 4ms buffers (+5ms output&#xA;  latency), with ASIO.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Depending on whether this real-time approximation is good for you, Windows might still be a good environment for the mentioned task.&lt;/p&gt;&#xA;" OwnerUserId="394" LastActivityDate="2011-11-08T18:39:38.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="619" PostTypeId="2" ParentId="614" CreationDate="2011-11-08T23:03:36.157" Score="5" Body="&lt;p&gt;I would consider them to all be 'transfer' or 'system' functions. &#xA;Those two names are interchangable, but in control theory books I see then listed more as transfer functions rather than system functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The domain you are in, whether it be fourier, laplace, Z or time, isn't entirely relevant to the name in that respect.&lt;/p&gt;&#xA;" OwnerUserId="87" LastActivityDate="2011-11-08T23:03:36.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="620" PostTypeId="1" CreationDate="2011-11-09T17:12:13.093" Score="15" ViewCount="712" Body="&lt;p&gt;I've got an algorithm that zero pads a sequence to 4N, does an FFT, and only uses the lowest frequency N points out of the generated 4N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like a lot of wasted work, any ideas how this can be done faster?&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2011-11-11T07:02:56.223" Title="How to efficiently calculate only the low coefficients of a zero-padded FFT" Tags="|fft|dft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="622" PostTypeId="2" ParentId="620" CreationDate="2011-11-10T18:00:24.710" Score="0" Body="&lt;p&gt;Zero padding in the time domain gives you higher frequency solution but no new information, so it provides essentially interpolating in the frequency domain. Depending on the nature of your signals and the precision required you may be able to get the additional frequency points with a regular FFT of N points and doing a suitable interpolation (linear, spline, pchip, sinc etc).&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-11-10T18:00:24.710" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="623" PostTypeId="2" ParentId="620" CreationDate="2011-11-10T21:27:37.370" Score="2" Body="&lt;p&gt;If you only a few bins then the following may be very efficient for you:&lt;br/&gt;&#xA;1. Simply do the DFT of at each frequency you need.&lt;br/&gt;&#xA;2. Use the Goertzel algorithm for each frequency in question.&lt;br/&gt;&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2011-11-10T21:27:37.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="624" PostTypeId="2" ParentId="620" CreationDate="2011-11-11T07:02:56.223" Score="2" Body="&lt;p&gt;Zero padding to 4X length, computing the longer FFT, and then using only the bottom 1/4th bins produces almost identical results to windowed Sinc interpolation of the original length FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So just use the original FFT length and interpolate using a 3 phase Sinc interpolation kernel with a suitable window width.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-11-11T07:02:56.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="625" PostTypeId="1" AcceptedAnswerId="628" CreationDate="2011-11-11T08:28:41.577" Score="6" ViewCount="822" Body="&lt;p&gt;Specifically, I am a tech writer working with WiFi hardware, and I need to understand why the 2.4GHz frequency band has only three channels, while the 5.0 GHz band has so many more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would presume that, since they're both &quot;frequency bands&quot;, they would both have about the same bandwidth, and so would have about the same number of channels.   Yet it appears that the 5.0GHz spectrum is divided into channels about 5MHz wide, and occupies the 4.9GHz to 5.9GHz spectrum, while the 2.4 GHz band has only three or four usable channels (1, 6, 11, and 14), and occupies only the 2.4~2.5GHz spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Were these allocations strictly arbitrary, or is there some sort of physical explanation for these allocations?  Does anyone know why the decision was made to allocate these frequency bands in the way they have been set up?&lt;/p&gt;&#xA;" OwnerUserId="538" LastActivityDate="2011-11-11T14:45:54.167" Title="Could someone please explain to me the relationship between frequency bands and channels?" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="626" PostTypeId="1" AcceptedAnswerId="629" CreationDate="2011-11-11T13:12:50.927" Score="8" ViewCount="328" Body="&lt;p&gt;I have a problem in DFT. It was one of my past-year exam papers questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let $F(u,v)$ be the 2-D Fourier transform of a 2-D continuous function&#xA;  $f(x,y)$. Derive in terms of $F(:,:)$ the 2-D Fourier transform of&#xA;  each of the following functions&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1) $f(x,-2y)$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2) $f(x+2y,y)$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know how to do 1-D Fourier transforms but not 2-D. I'm not sure how to start on it and need some guidance.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the second part, this was my approach. Please let me know if it's right or correct me if it's wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $τ= x + 2y$ hence $x = τ-2y$ and $dx = dτ$&#xA;$$&#xD;&#xA;\begin{align}&#xD;&#xA;\mathfrak{F}\{f(x+2y,y)\}&amp;amp;=∬ f(τ,y)e^{−j2π(u(τ-2y) +vy )} dx\ dv\\ &#xD;&#xA;&#xD;&#xA;\mathfrak{F}\{f(x+2y,y)\}&amp;amp;= ∬ f(τ,y)e^{−j2π(uτ+(-2u+v)y  )} dx\ dτ \\&#xD;&#xA;\mathfrak{F}\{f(x+2y,y)\}&amp;amp;= F(u,-2u+v) &#xD;&#xA;\end{align}&#xD;&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="77" LastEditDate="2011-11-11T20:26:42.503" LastActivityDate="2011-11-11T20:26:42.503" Title="Deriving 2-D discrete Fourier transforms" Tags="|fourier-transform|dft|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="628" PostTypeId="2" ParentId="625" CreationDate="2011-11-11T14:45:54.167" Score="5" Body="&lt;p&gt;The answer is mostly political: spectrum allocation is handled by the regional authorities based on a large number of economical, technical, political factors, and not the least on how much money can me made selling or leasing the rights. In the US that's done by the FCC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This being said, most bands tend to have constant relative bandwidth, not absolute bandwidth. Bands that are centered in the GHz range are typically 100s of MHz wide. Bands that are centered in the 100kHZ range are maybe 10s of kHZ wide (if at all).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this reasoning you would expect 5 GHz band to have roughly twice the bandwidths than the 2.4 GHz band. Since the WIFI channels are constant absolute bandwidth (20 MHz), there will be more channels the higher the center frequency of the band is. But again, it's most regulatory determined.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-11-11T14:45:54.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="629" PostTypeId="2" ParentId="626" CreationDate="2011-11-11T16:07:03.023" Score="8" Body="&lt;p&gt;Here is the first one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By definition,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathfrak{F}\{ f(x,-2y)\} = \iint_{- \infty}^{\infty} f(x,-2y)e^{-j2\pi (ux+vy)}dxdy$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let $\tau = -2y$ and conversely $y=\frac{-\tau}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathfrak{F}\{ f(x,-2y)\} = \iint_{- \infty}^{\infty} f(x,\tau)e^{-j2\pi (ux-\frac{v\tau}{2})}dxd(-\frac{\tau}{2})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathfrak{F}\{ f(x,-2y)\} = -\frac{1}{2}\iint_{- \infty}^{\infty} f(x,\tau)e^{-j2\pi (ux-\frac{v\tau}{2})}dxd\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathfrak{F}\{ f(x,-2y)\} = -\frac{1}{2} F(u,-\frac{v}{2})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other one will be harder, but I will leave it to you.&lt;/p&gt;&#xA;" OwnerUserId="52" LastActivityDate="2011-11-11T16:07:03.023" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="630" PostTypeId="1" AcceptedAnswerId="640" CreationDate="2011-11-11T17:22:36.777" Score="13" ViewCount="16529" Body="&lt;p&gt;I am trying to understand how exactly to implement what is known as a 'pre-whitening' filter or simply a 'whitening' filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that the purpose is to make it have a delta as its autocorrelation function, but I am not sure how to do this exactly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The context here is the following: A signal is received at two different receivers, and their cross-correlation is computed. The cross-correlation can look like a triangle, or some other godforsaken shape. Due to this, it becomes hard to find the peak of the cross-correlation signal. In this case I hear about having to 'whiten' the signals before a cross correlation is performed on them, such that the cross-correlation is now more delta-like. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2021-02-05T16:31:10.510" Title="How to 'whiten' a time domain signal?" Tags="|autocorrelation|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="631" PostTypeId="2" ParentId="630" CreationDate="2011-11-11T18:05:58.373" Score="7" Body="&lt;p&gt;Pre-whitening can be done by filtering with a transfer function that is roughly the inverse of the power spectrum of the signal. Let's say you have an audio signal that's roughly pink. In order to whiten that, you would apply an inverse pink filter (frequency response rises by 3 dB per octave).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not sure whether this will help with your issue. Pre-whitening tends to amplify the low energy parts in the signal, which can be noisy and therefore increase the overall noise in your system. If you are trying to determine whether two signals are time aligned (or what the time alignment is) then there is some inherent fuzziness in the problem that's related to the bandwidth of the signal. That is exactly represented in the time domain shape of the autocorrelation function.&amp;nbsp;&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="29" LastEditDate="2011-11-12T15:49:08.477" LastActivityDate="2011-11-12T15:49:08.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="632" PostTypeId="2" ParentId="616" CreationDate="2011-11-11T21:02:34.453" Score="0" Body="&lt;p&gt;Methinks @hotpaw2 is on the right track. My guess is that filtfilt is not handling the initial conditions for the reverse filter quite right. It sounds like a really hard problem -- I don't think I can fault Mathworks for getting it wrong...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fix seems easy enough to me: zero-pad the end of your signal until the sinc goes away, and delete the (now nonzero!) padding after the filter.&lt;/p&gt;&#xA;" OwnerUserId="448" LastActivityDate="2011-11-11T21:02:34.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="633" PostTypeId="1" AcceptedAnswerId="635" CreationDate="2011-11-12T00:59:55.777" Score="16" ViewCount="11869" Body="&lt;p&gt;I'm involved with an effort to implement an FFT algorithm, and am curious what the recommended advice is for the input test data to use -- and why! -- and what accuracy to expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On test inputs, I've found a little guidance in old Usenet posts that I'll post as an answer, but it's just one person's suggestions without a lot of justification -- I haven't found anything that looks like a solid answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On accuracy, Wikipedia says that the error should be O(e log N), but what's a reasonable expectation in absolute terms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit to add: The actual tests are in a form where I have stored arrays of input data and pre-computed &quot;reference&quot; output data to compare to, so I don't necessarily need something with a closed-form solution.&lt;/p&gt;&#xA;" OwnerUserId="168" LastEditorUserId="168" LastEditDate="2011-11-12T01:07:55.217" LastActivityDate="2011-11-12T16:46:33.010" Title="What data should I use to test an FFT implementation, and what accuracy should I expect?" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="634" PostTypeId="2" ParentId="633" CreationDate="2011-11-12T01:04:43.243" Score="5" Body="&lt;p&gt;As mentioned in the question, I did find one set of suggestions in archived comp.dsp Usenet posts ( &lt;a href=&quot;http://www.dsprelated.com/showmessage/71595/1.php&quot;&gt;http://www.dsprelated.com/showmessage/71595/1.php&lt;/a&gt; , post by &quot;tdillon&quot;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A.Single FFT tests - N inputs and N outputs&#xA; 1.Input random data&#xA; 2.Inputs are all zeros&#xA; 3.Inputs are all ones (or some other nonzero value)&#xA; 4.Inputs alternate between +1 and -1.&#xA; 5.Input is e^(8*j*2*pi*i/N) for i = 0,1,2, ...,N-1. (j = sqrt(-1))&#xA; 6.Input is cos(8*2*pi*i/N) for i = 0,1,2, ...,N-1.&#xA; 7.Input is e^((43/7)*j*2*pi*i/N) for i = 0,1,2, ...,N-1. (j = sqrt(-1))&#xA; 8.Input is cos((43/7)*2*pi*i/N) for i = 0,1,2, ...,N-1.&#xA;&#xA;B.Multi FFT tests - run continuous sets of random data&#xA; 1.Data sets start at times 0, N, 2N, 3N, 4N, ....&#xA; 2.Data sets start at times 0, N+1, 2N+2, 3N+3, 4N+4, ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The thread also suggests doing two sines, one with a large amplitude and one with a small amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I say in the main question, I'm not sure if this is a particularly good set of answers, or if it's very complete, but I'm putting here so people can vote and comment on it.&lt;/p&gt;&#xA;" OwnerUserId="168" LastEditorUserId="168" LastEditDate="2011-11-12T01:14:10.033" LastActivityDate="2011-11-12T01:14:10.033" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="635" PostTypeId="2" ParentId="633" CreationDate="2011-11-12T05:08:01.163" Score="12" Body="&lt;p&gt;If you want to verify an FFT algorithm for &lt;em&gt;correctness&lt;/em&gt;, in the sense that it performs the desired function that has the known properties of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot;&gt;discrete Fourier transform&lt;/a&gt;, then you can use the approach proposed in:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.38.3924&quot;&gt;Ergün, Funda. (1995, June). Testing multivariate linear functions: Overcoming the generator bottleneck. In &lt;em&gt;Proc. Twenty-Seventh Ann. ACM Symp. Theory of Computing&lt;/em&gt;. (p. 407–416).&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The above paper is referenced by the makers of &lt;a href=&quot;http://www.fftw.org&quot;&gt;FFTW&lt;/a&gt; as their method of choice for verifying that a particular FFT implementation does what it should. The proposed technique distills the function into three main components that are verified with separate tests:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Linearity:&lt;/strong&gt; The DFT (along with its other cousin transforms in the Fourier family) is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_operator&quot;&gt;linear operator&lt;/a&gt;, so for all values of $a_1, a_2, x_1[n], x_2[n]$, the following equation must hold:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\mathrm{FFT}(a_1 x_1[n] + a_2 x_2[n]) = a_1\mathrm{FFT}(x_1[n]) + a_2\mathrm{FFT}(x_2[n]) &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;DFT of the unit impulse:&lt;/strong&gt; A time-domain signal equal to the Kronecker delta function is applied to the input of the FFT algorithm and the output is checked against the known DFT of the unit impulse function (it transforms to a constant value in all output bins). If the FFT algorithm provides an IFFT, it can be tested in reverse to show that it yields the unit impulse function again.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Time shift:&lt;/strong&gt; Two sets of data are applied to the input of the FFT algorithm; the only difference between the two in the time domain is a constant time shift. Based on the known properties of the DFT, this should effect a known linear phase shift between the two signals' frequency domain representations, where the slope of the phase shift is proportional to the time shift.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The authors of the paper assert that these tests are sufficient to validate the correctness of an FFT implementation. I've not used this technique in the past, but it does seem to make sense, and I would trust FFTW's authors (who have produced a great piece of free software) as credible authorities on good approaches to the validation problem.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-12T05:08:01.163" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="636" PostTypeId="1" AcceptedAnswerId="643" CreationDate="2011-11-12T07:54:35.070" Score="11" ViewCount="2051" Body="&lt;p&gt;I have used both correlation and coherence as measures of correlation between signals.  I was thinking that a time-frequency approach would give me the best of these worlds.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is whether this extra data adds enough to the overall picture of the signal to justify the increased computational cost associated with doing the wavelet transforms as part of the calculation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: an &lt;a href=&quot;http://arxiv.org/ftp/gr-qc/papers/0208/0208007.pdf&quot;&gt;ArXiv&lt;/a&gt; paper: &quot;A cross-correlation technique in wavelet domain for detection of stochastic gravitational waves&quot; by S.Klimenko, G.Mitselmakher, A.Sazonov&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2017-07-11T03:56:34.630" Title="Is a wavelet-based correlation measure worth any additional computational overhead?" Tags="|coherence|correlation|wavelet|" AnswerCount="2" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="637" PostTypeId="1" CreationDate="2011-10-23T09:41:52.873" Score="12" ViewCount="847" Body="&lt;p&gt;I'm a masters student, preparing a seminar in computer vision. Among the topics is the Kanade-Lucas-Tomasi (KLT) tracker, as described in &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=323794&quot;&gt;J. Shi, C. Tomasi, &lt;em&gt;&quot;Good features to track&quot;&lt;/em&gt;.  Proceedings CVPR '94.&lt;/a&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cmp.felk.cvut.cz/cmp/courses/XE33PVR/WS20072008/Lectures/Motion/klt-print.pdf&quot;&gt;Here's a web resource&lt;/a&gt; that I'm using to understand the KLT tracker. I need some help with the math, as I'm a bit rusty in linear algebra and have no prior experience with computer vision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this formula for $\Delta p$ (step 5 in the summary), note the inverse Hessian:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta p = H^{-1}\Sigma_x\left[\nabla I \frac{\partial W}{\partial p}\right]^\mathsf{T} \left[T(x) − I(W(x; p))\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the article, good features to track are defined as ones where the sum of inverse Hessian matrices have large, similar eigenvalues: $\min(\lambda_1,\lambda_2)&amp;gt;threshold$. I was unable to understand how and where this is derived from, mathematically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intuition is that this represents a corner; T get that. What does that have to do with eigenvalues? I expect that if the values of the Hessian are low, there's no change, and it's not a corner. If they're high, it's a corner. Does anyone know how the intuition of cornerness comes into play in the eigenvalues of the inverse Hessian in order to determine $\Delta p$ across iterations of the KLT tracker?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been able to find resources claiming that the inverse Hessian correlates to the image covariance matrix. Furthermore, the image covariance indicates the intensity change, and then it makes sense... but I've been unable to find what exactly an image covariance matrix is with respect to an image, and not a vector, or a collection of images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, eigenvalues have meaning in principle component analysis, which is why I get the idea for an image covariance matrix, but I'm not sure how to apply this to the Hessian, as it's usually applied to an image. The Hessian, as far as I understand, is a $2\times 2$ matrix defining the 2nd derivatives for $x$, $y$, and $xy$ at a certain location $(x,y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate help with this, as I've been on it for 3+ days, it's just one small formula and time is running out.&lt;/p&gt;&#xA;" OwnerDisplayName="nathan g" LastEditorUserId="77" LastEditDate="2011-11-12T15:42:06.050" LastActivityDate="2011-11-12T15:42:06.050" Title="Interpretation of the eigenvalues of the inverse Hessian in a KLT tracker" Tags="|computer-vision|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="638" PostTypeId="2" ParentId="637" CreationDate="2011-11-09T10:01:57.163" Score="5" Body="&lt;p&gt;Think of them as 2D smoothness terms.&lt;br&gt;&#xA;The smoother the patch, the lower the matrix rank and the closer the matrix is to being singular.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On an straight edge (not a corner), just one eigenvalue will be large.&lt;br&gt;&#xA;On a corner both will be large.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using eigenvalues means that the &lt;em&gt;angle&lt;/em&gt; of the edge is not a factor, and at any angle, an edge will give just one large e.v.&lt;/p&gt;&#xA;" OwnerUserId="163" OwnerDisplayName="Adi Shavit" LastActivityDate="2011-11-09T10:01:57.163" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="640" PostTypeId="2" ParentId="630" CreationDate="2011-11-12T17:39:56.190" Score="9" Body="&lt;p&gt;Suppose you have signals $x(t)$ and $y(t)$ whose cross-correlation function $R_{x,y}(t)$ is not something you like; you want $R_{x,y}$ to be impulse-like.  Note that in the frequency domain, &#xA;$$\mathcal{F}[R_{x,y}] = S_{x,y}(f) = X(f)Y^*(f).$$&#xA;So you filter the signals through linear filters $g$ and $h$ respectively to get &#xA;$\hat{x}(t) = x*g$, $\hat{X}(f) = X(f)G(f)$, and $\hat{y} = y*h$, $\hat{Y}(f) = Y(f)H(f)$, and now their cross-correlation function is&#xA;$R_{\hat{x},\hat{y}}$ whose Fourier transform is&#xA;$$\begin{align*}&#xA;\mathcal{F}[R_{\hat{x},\hat{y}}] = S_{\hat{x},\hat{y}}(f) &amp;amp;= [X(f)G(f)][Y(f)H(f)]^*\\&#xA;&amp;amp;= [X(f)Y^*(f)][G(f)H^*(f)]\\ &amp;amp;= [X(f)Y^*(f)][G^*(f)H(f)]^*,&#xA;\end{align*}$$&#xA;that is, $R_{\hat{x},\hat{y}}$ is the cross-correlation of $R_{x,y}$ with &#xA;$R_{h,g}$.  More importantly, you want to choose $g$ and $h$ so that &#xA;the &lt;em&gt;cross-spectral density&lt;/em&gt; $G(f)H^*(f)$ of $g$ and $h$ is the multiplicative&#xA;inverse of the  &lt;em&gt;cross-spectral density&lt;/em&gt; $X(f)Y^*(f)$ of $x$ and $y$, or &#xA;something close to it.  If you have only one signal and one filter, then&#xA;you get the result given by Hilmar (with amendment as given by my comment there).&#xA;In either case, the issue of compensating for spectral nulls, or generally,&#xA;frequency bands where the signals have little energy still remains.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="80" LastEditDate="2018-03-04T22:12:00.760" LastActivityDate="2018-03-04T22:12:00.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="642" PostTypeId="1" AcceptedAnswerId="659" CreationDate="2011-11-13T09:43:09.663" Score="4" ViewCount="326" Body="&lt;p&gt;This was a question on one of my past year paper questions.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;  Prove&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$f(m,n)*g(m-r,n-s) = f(m-r,n-s) *g(m,n)$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where $f(m,n)$ and $g(m,n)$ are 2-D discrete functions, $r$ and $s$&#xA;  are integers and $*$ is the 2-D convolution operator.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not sure how to start on this and need some guidance on it.&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="77" LastEditDate="2011-11-13T17:00:05.127" LastActivityDate="2011-11-15T14:08:40.743" Title="Question on 2-D Convolution" Tags="|homework|convolution|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="643" PostTypeId="2" ParentId="636" CreationDate="2011-11-14T15:17:59.673" Score="5" Body="&lt;p&gt;First off, you should use whichever tool is appropriate for the job.  &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Cross-correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Correlation&lt;/a&gt; vs &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Coherence_%28signal_processing%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;coherence&lt;/a&gt; vs wavelet-based correlation are all different things, so this question is kind of like asking &quot;Which is better? Screwdrivers or hammers?&quot;  It depends on what you're trying to do, and whether you care about similarity in time, frequency spectra, or both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, I have only a minimal understanding of wavelets, but your assumption that wavelets require more computation might be wrong.  The &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Coherence_%28signal_processing%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Fourier Transform&lt;/a&gt; takes $O(n\log n)$ &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Big_O_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;operations&lt;/a&gt;, while the &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Coherence_%28signal_processing%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Wavelet Transform&lt;/a&gt; takes $O(n)$.  So the wavelet method might actually require &lt;em&gt;less&lt;/em&gt; computation, depending on whether you can use the information you get out of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/1363263&quot; rel=&quot;nofollow noreferrer&quot;&gt;Empirically&lt;/a&gt;, producing &lt;em&gt;n&lt;/em&gt; outputs from &lt;em&gt;n&lt;/em&gt; real inputs, the multi-level wavelet transform in &lt;a href=&quot;http://www.pybytes.com/pywavelets/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;PyWavelets&lt;/a&gt; becomes faster than NumPy's FFT when n is greater than about 4096. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cWPhc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It's Python, and the two implementations could be very differently efficient.  I don't even know if &lt;code&gt;wavedec()&lt;/code&gt; would be considered a Fast Wavelet Transform.  They use the abbreviation &lt;em&gt;DWT&lt;/em&gt; in their documentation.  Are Haar DWT and FWT the same thing?&lt;/li&gt;&#xA;&lt;li&gt;The time varies depending on the wavelet used.  Meyer wavelet takes 6 times as long as Daubechies to produce the same amount of data.&lt;/li&gt;&#xA;&lt;li&gt;I still don't understand &lt;a href=&quot;https://dsp.stackexchange.com/q/651/29&quot;&gt;how the FWT tiles the time-frequency plane&lt;/a&gt;, or if producing &lt;em&gt;n&lt;/em&gt; outputs is sufficient to get the same kind of similarity measurement as an &lt;em&gt;n&lt;/em&gt;-point circular cross-correlation using FFTs. (Technically it's a time-scale plane, not time-frequency, but I think they're the same for the &lt;a href=&quot;http://www.mathworks.com/help/toolbox/wavelet/ref/cmorwavf.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex Morlet wavelet&lt;/a&gt;?)  FWT is a &quot;critical sampling&quot; of the plane, and produces the same amount of data as FFT, so it seems fair to compare them.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The main point is that computation time is at least roughly similar for both, so I don't think you should worry about it when deciding which to use.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2011-11-15T14:26:41.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="644" PostTypeId="1" CreationDate="2011-11-14T15:24:40.000" Score="13" ViewCount="1035" Body="&lt;p&gt;How viable would it be to classify the texture of an image using features from a discrete cosine transform? Googling &quot;texture classification dct&quot; only finds a &lt;a href=&quot;http://www.softcomputing.net/mjcs.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;single academic paper&lt;/a&gt; on this topic, using a neural network.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my application, I have a large corpus of labeled images, in which the entire image is a consistent texture (e.g. close-up shots of a blanket, tree bark, a grassy field, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inspired by a response to a &lt;a href=&quot;https://dsp.stackexchange.com/questions/454/detecting-trail-in-forest-images&quot;&gt;previous question&lt;/a&gt;, I was considering the following approach:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;split up each image into NxN blocks of pixels&lt;/li&gt;&#xA;&lt;li&gt;take the DCT of each block&lt;/li&gt;&#xA;&lt;li&gt;flatten each DCT into a 1xM array and feed it to a K-Means clustering algorithm, and get the cluster label for each DCT&lt;/li&gt;&#xA;&lt;li&gt;calculate a histogram of clustering labels for each image by counting each label per image from #3&lt;/li&gt;&#xA;&lt;li&gt;train a SVM classifier by feeding it a set of [(histogram,image label)]&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How well would this work? I implemented a similar system, using features extracted via the SIFT/SURF algorithms, but I was only able to get about 60% accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In what other ways could I use the DCT to classify textures?&lt;/p&gt;&#xA;" OwnerUserId="451" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-08-07T12:44:55.220" Title="Texture Classification via DCT" Tags="|image-processing|classification|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="645" PostTypeId="2" ParentId="644" CreationDate="2011-11-14T16:37:46.813" Score="6" Body="&lt;p&gt;So far what you are proposing sounds like a reasonable approach. However, I don't think you will know how well it works until you try it, just like you have tried SIFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a question though.  Why are you restricting yourself to DCT?  There are lots of representations that have been used for texture classification: co-occurrence matrices, local binary patterns, etc.  The fact that you have only found one paper on using DCT for texture classification would suggest that this is not the most commonly used feature for this problem.  I would recommend that you widen your literature search to see what other features people have used, and how well they have worked.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2011-11-14T18:05:34.307" LastActivityDate="2011-11-14T18:05:34.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="646" PostTypeId="1" CreationDate="2011-11-14T17:22:07.760" Score="39" ViewCount="7585" Body="&lt;p&gt;Even after having studied these for quite sometime, I tend to forget (if I'm out of touch for a while) how they are related to each other and what each stands for (since they have such similar sounding names). I'm hoping you'd come up with an explanation that is so intuitive and mathematically beautiful that they'll get embedded into my memory forever and this thread will serve as a super quick refresher whenever I (or anyone else) needs it.&lt;/p&gt;&#xA;" OwnerUserId="550" LastEditorUserId="50223" LastEditDate="2020-06-23T11:03:00.657" LastActivityDate="2021-08-31T23:36:29.090" Title="What is the most lucid, intuitive explanation for the various FTs - CFT, DFT, DTFT and the Fourier Series?" Tags="|fourier-transform|fourier-series|" AnswerCount="7" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="647" PostTypeId="2" ParentId="646" CreationDate="2011-11-14T19:37:44.433" Score="13" Body="&lt;p&gt;For a lucid and correct explanation of these concepts, you would have to go through some of the standard textbooks (Oppenheim-Schafer, Proakis-Manolakis or &quot;Understanding Digital Signal Processing&quot; by Richard Lyons which is a very good but relatively less popular book). But assuming a coffee-table discussion, I will be making some extremely loose statements in what follows. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a general continuous time signal, you wouldn't expect any particular frequency to be absent, so its Fourier Transform (or the Continuous Fourier Transform) would be a continuous curve with support possibly -inf to +inf.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a periodic continuous signal (period T), Fourier expressed the signal as a combination of sines and cosines having the same period (T, T/2, T/3, T/4, ...). Effectively, the spectrum of this signal is a series of spikes at locations 1/T, 2/T, 3/T, 4/T, ... This is called the Fourier Series representation. There is a theorem that says that the Fourier series representation of any periodic continuous time signal converges to the signal as you include more and more sines and cosines (or complex exponentials) in the mean square sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moral so far: periodicity in time =&gt; spiky spectrum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On to discrete time...&#xA;What happens if you sample a continuous time signal? It should be clear that for a sufficiently high signal, you wouldn't be able to reconstruct the signal. If you make no assumption about the frequencies in the signal, then given the sampled signal, there is no way you can say what the true signal is. In other words, different frequencies are represented equivalently in the discrete-time signal. Going through some math tells you that you can obtain the spectrum of the sampled signal from the original continuous signal. How? You shift the spectrum of the continuous time signal by amounts +-1/T, +-2/T, ... and add all the shifted copies (with some scaling). This gives you a continuous spectrum that's periodic with period 1/T. (note: the spectrum is periodic as a result of sampling in time, the time signal doesn't have to be periodic) Since the spectrum is continuous, you can as well represent it with just one of its periods. This is the DTFT (&quot;Discrete-Time&quot; Fourier Transform). In the case where your original continuous time signal has frequencies no higher than +-1/2T, the shifted copies of the spectrum don't overlap and hence, you can recover the original continuous-time signal by selecting one period of the spectrum (the Nyquist sampling theorem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to remember: spiky time signal =&gt; periodicity in spectrum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens if you sample a continuous-time periodic signal with sampling period T/k for some k? Well, the spectrum of the continuous-time signal was spiky to being with, and sampling it by some divisor of T means that the spikes in the shifted copies fall exactly on multiples of 1/T, so the resulting spectrum is a spiky periodic spectrum.&#xA;spiky periodic time signal &amp;lt;=&gt; spiky periodic spectrum (assuming that the period and sampling frequency are &quot;nicely related&quot; as above.)&#xA;This is what is known as the DFT (Discrete Fourier Transform). FFT (Fast Fourier Transform) is a class of algorithms to compute the DFT efficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way DFT is invoked is as follows:  Say you want to analyze a sequence of N samples in time. You could take DTFT and deal with one of its periods, but if you assume that your signal is periodic with period N, then DTFT reduces to DFT and you have just N samples of one period of DTFT which completely characterize the signal. You can zero-pad the signal in time to get a finer sampling of the spectrum and (many more such properties). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the above is useful only if accompanied by a study of DSP. The above are just some very rough guidelines.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2011-11-14T19:37:44.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="648" PostTypeId="2" ParentId="646" CreationDate="2011-11-14T20:42:35.780" Score="6" Body="&lt;p&gt;Endolith is correct in that, if you actually start with the Fourier series, and see how it is extended to the Fourier transform, then things start beginning to make a lot of sense. I give a brief explanation for this in the first half of &lt;a href=&quot;https://dsp.stackexchange.com/questions/69/why-is-the-fourier-transform-so-important/70#70&quot;&gt;this answer&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good (perhaps not simple) way to look at the Fourier transform family (by which I mean the 4 you've listed above), is through the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pontryagin_duality&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pontryagin duality&lt;/a&gt; goggles. It gives you a nice way to remember the different transforms by the original and transformed domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a complex valued function on $\mathbb{R}$ (assuming other necessary conditions for the F.T. to exist), its Fourier transform is also a complex valued function on $\mathbb{R}$. The space $\mathbb{R}$ is a Pontryagin self-dual and you can say that if a transform in the entire family has $\mathbb{R}$ as both the original and transformed domain, then it is the &lt;strong&gt;Fourier transform&lt;/strong&gt; (or CFT, as you called it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A complex valued sequence of $n$ numbers can be viewed as a periodic complex valued function on $\mathbb{Z}/n\mathbb{Z}$, which is a cyclic integer modulo $n$ group (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Abelian_group#Finite_abelian_groups&quot; rel=&quot;nofollow noreferrer&quot;&gt;finite abelian groups&lt;/a&gt; for more info). The transform for this sequence also has the domain $\mathbb{Z}/n\mathbb{Z}$ (self-dual) and this is the &lt;strong&gt;discrete Fourier transform.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The domain of the unit circle, $\mathbb{T}$ (all complex numbers with absolute value 1; also see &lt;a href=&quot;http://en.wikipedia.org/wiki/Circle_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;circle group&lt;/a&gt;) and the set of integers $\mathbb{Z}$ are Pontryagin duals of each other. Similar to the first two, a transform between $\mathbb{Z}$ to $\mathbb{T}$ exists and is what we call the &lt;strong&gt;discrete-time Fourier transform&lt;/strong&gt; and the other way round is the &lt;strong&gt;Fourier series&lt;/strong&gt;, from which everything started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This answer isn't fully complete and I'll perhaps build on this answer to make a few points clear when I have the time, but until then, this might be something to chew on until you get a more intuitive explanation from someone else. Also try reading &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_analysis#Variants_of_Fourier_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;variants of Fourier analysis&lt;/a&gt; on Wikipedia. &lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2011-11-14T20:42:35.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="649" PostTypeId="2" ParentId="646" CreationDate="2011-11-14T21:32:38.587" Score="9" Body="&lt;p&gt;Let $x(t)$ denote a bounded function with period $T$, that is, for all real numbers $t$, $x(t+T) = x(t)$.  As a particular example, $\cos(2\pi t/T)$ is such a function.  We want to find the &quot;best&quot; approximation $a_n\cos(2\pi nt/T)$ for this function where we &#xA;wish to choose&#xA;the coefficient $a_n$ so that&#xA;$$\int_0^T (x(t) - a_n\cos(2\pi nt/T))^2\,\mathrm dt,$$&#xA;the &lt;em&gt;squared error&lt;/em&gt; is as small as possible.  Expanding out the integrand, we have&#xA;$$\text{squared error} =   \int_0^T x^2(t)\,\mathrm dt &#xD;&#xA;- 2a_n \int_0^T x(t)\cos(2\pi nt/T)\,\mathrm dt&#xD;&#xA;+(a_n)^2\int_0^T \cos^2(2\pi nt/T)\,\mathrm dt.$$&#xA;The leftmost integral is the energy $E$ delivered by one period of $x(t)$ while&#xA;rightmost integral has value $T/2$ and so we see that&#xA;$$\text{squared error} =  E &#xD;&#xA;- 2a_n \int_0^T x(t)\cos(2\pi nt/T)\,\mathrm dt&#xD;&#xA;+(a_n)^2\frac{T}{2}.$$&#xA;Now. for $a &amp;gt; 0$, the quadratic function $az^2 + bz + c$ has a minimum at $z = -b/2a$&#xA;(midway between the roots $(-b/2a) \pm \sqrt{b^2 - 4ac}/2a$ !!) and so, since&#xA;we have expressed the squared error as a quadratic function of $a_n$,&#xA;the choice of $a_n$ that minimizes the squared error is &#xA;$$a_n = \frac{2}{T}\int_0^T x(t)\cos(2\pi nt/T)\,\mathrm dt.$$&#xA;Similarly, choosing $b_n$ as&#xA;$$b_n = \frac{2}{T}\int_0^T x(t)\sin(2\pi nt/T)\,\mathrm dt$$&#xA;minimizes the squared error between $x(t)$ and $b_n\sin(2\pi nt/T)$.&#xA;Thus we see that Fourier series is nothing but a cheap trick to find&#xA;the minimum squared error approximation to a periodic function $x(t)$ in terms&#xA;of the sine and cosine signals of the same period and harmonics thereof.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2011-11-14T21:32:38.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="650" PostTypeId="2" ParentId="646" CreationDate="2011-11-14T22:37:48.060" Score="4" Body="&lt;p&gt;I think the foremost thing is to fundamentally understand why do we need fourier transforms. They are one of many possible signal transforms, but also one of the most useful ones. A transform basically transforms a signal into another domain which may give us insight about the signal in that domain, or or it may be that the domain is mathematically easy to work. Once we are done working in that domain, we can take inverse transform to get to the desired result more easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most basic building block in fourier theory are monotones (sines and cosines). We can decompose a signal into its frequency components(monotones) using the fourier math. So, fourier transform basically transforms a signal from time domain to frequecy domain. The coefficient of each of the monotones in the fourier series tells us about the strength of that frequency component in the signal. Fourier transforms(CFT, DFT) explicitly gives us a frequency domain view of the signal. In nature, sines and cosines are the prominent waveforms. Synthetic signals like square wave, or signals having sharp fluctuations are less likely to occur naturally and not surprisingly compose of infinite range of frequencies as very clearly explained by fourier transforms. People had doubts whether any signal can be wretten as sum of sines/cosines. Fourier showed square waveform(which is far away from sines/cosines) can indeed be. White noise contains all the frequencies with equal strength.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you are working with fourier series, then the coefficients along with the phase term can be seen as that required to properly superimpose the constituent sinosoidal waveforms so that the superposition is indeed the required signal of which you are taking the transform. When working with fourier transforms, the complex numbers implicitly have the phase terms and the required magnitude of each of the monotones. (integration is roughly like summation. continuous=&gt;integration, discrete=&gt; summation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think once you have the understanding of the theme of a concept, rest all are just details that you will yourself have to understand by reading books. Reading about the application of fourier transforms to various fields will give you better perceptive.&lt;/p&gt;&#xA;" OwnerUserId="552" LastEditorUserId="552" LastEditDate="2011-11-14T23:08:28.213" LastActivityDate="2011-11-14T23:08:28.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="651" PostTypeId="1" CreationDate="2009-11-24T03:08:33.817" Score="29" ViewCount="6310" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Fast Fourier Transform&lt;/a&gt; takes $\mathcal O(N \log N)$ operations, while the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_wavelet_transform&quot; rel=&quot;noreferrer&quot;&gt;Fast Wavelet Transform&lt;/a&gt; takes $\mathcal O(N)$. But what, specifically, does the FWT compute?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although they are often compared, it seems like the FFT and FWT are apples and oranges.  As I understand it, it would be more appropriate to compare the STFT (FFTs of small chunks over time) with the &lt;a href=&quot;http://www.mathworks.com/help/toolbox/wavelet/ref/cmorwavf.html&quot; rel=&quot;noreferrer&quot;&gt;complex Morlet WT&lt;/a&gt;, since they're both time-frequency representations based on complex sinusoids (please correct me if I'm wrong). This is often shown with a diagram like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i7V58.png&quot; alt=&quot;Grids showing how the coefficients of the FFT and WT correspond to the time-frequency plane&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;http://www.ndt.net/article/v07n09/08/fig4.gif&quot; rel=&quot;noreferrer&quot;&gt;Another example&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The left shows how the STFT is a bunch of FFTs stacked on top of each other as time passes (this representation is the origin of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;noreferrer&quot;&gt;spectrogram&lt;/a&gt;), while the right shows the dyadic WT, which has better time resolution at high frequencies and better frequency resolution at low frequencies (this representation is called a &lt;a href=&quot;http://support.sas.com/rnd/app/da/new/802ce/iml/chap1/sect8.htm&quot; rel=&quot;noreferrer&quot;&gt;scalogram&lt;/a&gt;). In this example, $N$ for the STFT is the number of vertical columns (6), and a single $\mathcal O(N \log N)$ FFT operation calculates a single row of $N$ coefficients from $N$ samples. The total is 8 FFTs of 6 points each, or 48 samples in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How many coefficients does a single $\mathcal O(N)$ FWT operation compute, and where are they located on the time-frequency chart above?       &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Which rectangles get filled in by a single computation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If we calculate an equal-area block of time-frequency coefficients using both, do we get the same amount of data out?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the FWT still more efficient than the FFT?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Concrete example using &lt;a href=&quot;http://www.pybytes.com/pywavelets/&quot; rel=&quot;noreferrer&quot;&gt;PyWavelets&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In [2]: dwt([1, 0, 0, 0, 0, 0, 0, 0], 'haar')&#xA;Out[2]:&#xA;(array([ 0.70710678,  0.        ,  0.        ,  0.        ]),&#xA; array([ 0.70710678,  0.        ,  0.        ,  0.        ]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It creates two sets of 4 coefficients, so it's the same as the number of samples in the original signal. But what's the relationship between these 8 coefficients and the tiles in the diagram?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, I was probably doing this wrong, and should be using &lt;code&gt;wavedec()&lt;/code&gt;, which does a multi-level DWT decomposition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In [4]: wavedec([1, 0, 0, 0, 0, 0, 0, 0], 'haar')&#xA;Out[4]: &#xA;[array([ 0.35355339]),&#xA; array([ 0.35355339]),&#xA; array([ 0.5,  0. ]),&#xA; array([ 0.70710678,  0.        ,  0.        ,  0.        ])]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="29" OwnerDisplayName="endolith" LastEditorUserId="1629" LastEditDate="2016-05-18T07:29:32.507" LastActivityDate="2017-12-25T21:00:04.187" Title="Which time-frequency coefficients does the Wavelet transform compute?" Tags="|frequency|fft|wavelet|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="652" PostTypeId="2" ParentId="651" CreationDate="2009-11-24T03:32:08.170" Score="3" Body="&lt;p&gt;Your reference has it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A sequence of coefficients based on an orthogonal basis of small finite waves, or wavelets.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For more, you may like the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete%5Fwavelet%5Ftransform#Comparison%5Fwith%5FFourier%5Ftransform&quot; rel=&quot;nofollow&quot;&gt;DWT page&lt;/a&gt;.  There it introduces Haar wavelets,  Daubechies wavelets and others.  It points out how&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Wavelets have location – the (1,1,–1,–1) wavelet corresponds to “left side” versus “right side”, while the last two wavelets have support on the left side or the right side, and one is a translation of the other.&lt;/li&gt;&#xA;&lt;li&gt;Sinusoidal waves do not have location – they spread across the whole space – but do have phase – the second and third waves are translations of each other, corresponding to being 90° out of phase, like cosine and sine, of which these are discrete versions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If, instead of discrete wavelets, you want to now about continuous wavelets or complex wavelets, you might start with &lt;a href=&quot;http://en.wikipedia.org/wiki/Wavelet%5Fseries&quot; rel=&quot;nofollow&quot;&gt;wavelet series&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond wikipedia, a textbook and a course might do you well.&lt;/p&gt;&#xA;" OwnerDisplayName="Ewan Todd" LastActivityDate="2009-11-24T03:32:08.170" CommentCount="4" ContentLicense="CC BY-SA 2.5" />
  <row Id="653" PostTypeId="2" ParentId="651" CreationDate="2009-11-24T16:33:26.193" Score="13" Body="&lt;p&gt;You are correct that the FWT is better thought of as a &quot;cousin&quot; of the STFT, rather than the FT.  In fact, the FWT is just a discrete sampling of the CWT (continuous wavelet transform), as the FFT/DFT is a discrete sampling of the Fourier transform.  This may seem like a subtle point, but it is relevant when choosing how you discretize the transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CWT and STFT are both redundant analyses of a signal.  In other words, you have more &quot;coefficients&quot; (in the discrete case) than you need to fully represent a signal.  However, a Fourier transform (or say a wavelet transform using only one scale) integrate a signal from -infinity to +infinity.  This is not very useful on real world signals, so we truncate (i.e. window) the transforms to shorter lengths.  Windowing of a signal changes the transform -- you multiply by the window in time/space, so in transform space you have the convolution of the transform of the window with the transform of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the STFT, the windows are (usually) the same length (non-zero extent) at all time, and are frequency agnostic (you window a 10 Hz signal the same width as a 10 kHz signal).  So you get the rectangular grid spectrogram like you have drawn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CWT has this windowing built in by the fact that the wavelets get shorter (in time or space) as the scale decreases (like higher frequency).  Thus for higher frequencies, the effective window is shorter in duration, and you end up with a scaleogram that looks like what you have drawn for the FWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How you discretize the CWT is somewhat up to you, though I think there are minimum samplings in both shift and scale to fully represent a signal.  Typically (at least how I've used them), for lowest scale (highest frequency), you will sample at all shift locations (time/space).  As you get higher in scale (lower in frequency), you can sample less often.  The rationale is that low frequencies don't change that rapidly (think of a cymbal crash vs. a bass guitar -- the cymbal crash has very short transients, whereas the bass guitar would take longer to change).  In fact, at the shortest scale (assuming you sample at all shift locations), you have the full representation of a signal (you can reconstruct it using only the coefficients at this scale).  I'm not so sure about the rationale of sampling the scale.  I've seen this suggested as logarithmic, with (I think) closer spacing between shorter scales.  I think this is because the wavelets at longer scales have a broader Fourier transform (therefore they &quot;pick up&quot; more frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I admit I do not fully understand the FWT.  My hunch is that it is actually the minimum sampling in shift/scale, and is not a redundant representation.  But then I think you lose the ability to analyze (and mess with) a signal in short time without introducing unwanted artifacts.  I will read more about it and, if I learn anything useful, report back.  Hopefully others will like to comment.&lt;/p&gt;&#xA;" OwnerUserId="570" OwnerDisplayName="Patrick" LastActivityDate="2009-11-24T16:33:26.193" CommentCount="4" ContentLicense="CC BY-SA 2.5" />
  <row Id="654" PostTypeId="2" ParentId="651" CreationDate="2010-02-08T05:37:56.543" Score="12" Body="&lt;p&gt;Consider the Haar wavelet case. The Fast Wavelet Transform recursively subdivides your signal and computes the sum and difference of the two halves each time. The difference is the magnitude of the transform for the current wavelet and the sum is returned for the caller to compute the magnitude of the transform for a dilated wavelet with half the frequency. Thus, the FWT covers the time-frequency plane using the pattern described in the diagram you gave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the diagram you gave is a bit misleading. What they are really trying to tell you is that you get one sample at the lowest frequency, two samples at double that frequency, four samples at quadruple that frequency and so on. The time-frequency properties of each wavelet are &lt;em&gt;not&lt;/em&gt; such that they cover their tile. In practice, each wavelet will cover an infinite area because they have compact support and, therefore, must be completely delocalized in terms of frequency. So you should just think about the centers of those tiles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the FWT requires a discrete wavelet that must adhere to a far more restrictive admissibility criterion than continuous wavelets for the CWT. Consequently, the time-frequency properties of discrete wavelets are generally awful (e.g. the Daubechies wavelets are either full of sharp features or have changing frequency) and the utility of the time-frequency plane is greatly diminished in the context of the FWT. However, continuous wavelets are used to compute time-frequency representations of signals.&lt;/p&gt;&#xA;" OwnerDisplayName="Jon Harrop" LastActivityDate="2010-02-08T05:37:56.543" CommentCount="5" ContentLicense="CC BY-SA 2.5" />
  <row Id="655" PostTypeId="2" ParentId="642" CreationDate="2011-11-15T00:08:12.413" Score="2" Body="&lt;p&gt;In addition to the above comment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Show that the 2D Z-transforms of both sides are equal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step-by-step: If $F(z_1, z_2)$ is the 2D Z-transform of $f(m,n)$, then what is the 2D Z-transform of &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$f(m-r, n)$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$f(m-r, n-s)$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$f(m, n) * g(m, n)$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$f(m-r, n-s) * g(m, n)$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(Yes, I realize that the 2D Z-transform may not be taught before this exam was presented, but it is a valid solution, nonetheless.)&lt;/p&gt;&#xA;" OwnerUserId="553" LastActivityDate="2011-11-15T00:08:12.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="656" PostTypeId="2" ParentId="646" CreationDate="2011-11-15T03:28:10.467" Score="2" Body="&lt;p&gt;A DFT is a transform of a vector of numbers pairs from one orthogonal space to another.  Very commonly done as a numerical computation.  For some reason, when taking one bunch of numbers from the real world, the 2nd bunch of numbers often turns out to be close enough to something quite useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am reminded of the &lt;a href=&quot;http://en.wikipedia.org/wiki/The_Unreasonable_Effectiveness_of_Mathematics_in_the_Natural_Sciences&quot; rel=&quot;nofollow&quot;&gt;The Unreasonable Effectiveness of Mathematics in the Natural Sciences&lt;/a&gt;, especially regarding applying the DFT to many systems the seem to be approximated by various kinds of 2nd degree differential equation, even the sound of the coffee spoon I just dropped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other 3 XYZ-FTs make assumptions about the existence of some mythical infinite entities to help symbolic solutions fit on the whiteboard before the coffee gets too cold.  They are the &quot;spherical cows&quot; of signal processing.  The DTFT and Fourier Series pretend that one vector can be extended infinitely at the cost of infinite density of the other entity.  The Fourier Series pretends that both entities can be infinite continuous functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take enough math courses and one might even determine all the definitions and assumptions required to make these fictional entities exact and complete duals in some sense.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-11-15T03:28:10.467" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="657" PostTypeId="2" ParentId="646" CreationDate="2011-11-15T05:22:43.037" Score="25" Body="&lt;p&gt;I wrote &lt;a href=&quot;https://drive.google.com/file/d/1ov_X0a7tlJzuVRJS1_mJLbIwnpACoeXK/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;this handout&lt;/a&gt; as a complement to &lt;em&gt;Oppenheim and Willsky&lt;/em&gt;. Please take a look at &lt;strong&gt;Table 4.1&lt;/strong&gt; on page 14, reproduced below. (Click for larger image.) I wrote that table specifically to answer questions such as yours.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://up.stevetjoa.com/fourier_table41.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fMr0J.png&quot; alt=&quot;Comparison of Fourier series and Fourier transform.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note the similarities and differences among the four operations:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&amp;quot;Series&amp;quot;: periodic in time, discrete in frequency&lt;/li&gt;&#xA;&lt;li&gt;&amp;quot;Transform&amp;quot;: aperiodic in time, continuous in frequency&lt;/li&gt;&#xA;&lt;li&gt;&amp;quot;Continuous Time&amp;quot;: continuous in time, aperiodic in frequency&lt;/li&gt;&#xA;&lt;li&gt;&amp;quot;Discrete Time&amp;quot;: discrete in time, periodic in frequency&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I hope you find these notes helpful! Please feel free to distribute as you wish.&lt;/p&gt;&#xA;" OwnerUserId="553" LastEditorUserId="553" LastEditDate="2021-08-31T23:36:29.090" LastActivityDate="2021-08-31T23:36:29.090" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="658" PostTypeId="1" AcceptedAnswerId="663" CreationDate="2011-11-15T12:29:39.990" Score="0" ViewCount="1045" Body="&lt;p&gt;This was a past year paper question. Not sure how to answer it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: The 1-D discrete cosine transform(DCT) of a sequence f(x), x =0,1,...,N-1 is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;F(u) = c(u)* Summation of f(x) cos ( (2x+1)u*pi/2N) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;show that 1-D DCT of the sequence &lt;/p&gt;&#xA;&#xA;&lt;p&gt;g(x) = f(N-1-x), x = 0,1,...,N-1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be expressed as G(u) = (-1)*F(u), u=0,1..., N-1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solution (If wrong please correct me)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;G(u) = c(u)* Summation of f(N-1-x) cos ((2(N-1-x)+1)u*pi/2N) &#xA;     = c(u)* Summation of f(N-1-x) cos (2N-2x-1)u*pi/2N) &lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="278" LastEditDate="2011-11-15T12:45:39.413" LastActivityDate="2011-11-17T18:44:31.330" Title="1-D discrete cosine transform(DCT)" Tags="|dct|homework|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="659" PostTypeId="2" ParentId="642" CreationDate="2011-11-15T13:58:38.930" Score="1" Body="&lt;p&gt;1-D convolution&#xA;x(t) * h(t) = Summation x(r)h(t-r)dr&#xA;            let t-r =s&#xA;            = - Inverse Summation x(t-s)h(s)ds&#xA;            = Summation x(t-s)h(s)ds&#xA;            = h(t)*x(t)&#xA;2-D convolution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;f(m,n)∗g(m−r,n−s)=Summation Summationf(h,b)g(m-r-h,n-s-b)&#xA;Let m-r-h = e&#xA;    n-s-b = c&#xA;                 = Summation Summation f(m-r-e,n-s-c)g(h,b)&#xA;                 = f(m−r,n−s)∗g(m,n) &lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="278" LastEditDate="2011-11-15T14:08:40.743" LastActivityDate="2011-11-15T14:08:40.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="661" PostTypeId="2" ParentId="644" CreationDate="2011-11-16T07:37:15.543" Score="4" Body="&lt;p&gt;If you would not split image into NxN block but instead use sliding window - calculate DCT for blocks centered at each point of the image it would be essentially using wavelets approach.&#xA;Your splitting image into blocks is the same as using sliding window and downsampling image. So essentially you are using reduced form of wavelets texture segmentation. Gabor wavelet used instead of DCT usually because: it has more parameters (+scale and +direction) and smooth attenuation (instead of sharp edge of the window).&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2011-11-16T07:37:15.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="662" PostTypeId="2" ParentId="573" CreationDate="2011-11-16T08:30:05.827" Score="1" Body="&lt;p&gt;Taking difference twice i.e. difference of differences may help.. so if the double derivative of pixels is larger than a threshold in some regions, so you may term it as someone entered the room. Change in brightness will give approximately constant gradient throughout the image, but taking the Hessian or double derivative will give a good indication of movement or major changes in the room.&lt;/p&gt;&#xA;" OwnerUserId="555" LastActivityDate="2011-11-16T08:30:05.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="663" PostTypeId="2" ParentId="658" CreationDate="2011-11-17T18:44:31.330" Score="4" Body="&lt;p&gt;If $g(x)= f(N-1-x)$ then&#xA;$$\begin{aligned}&#xD;&#xA;  (\operatorname{DCT}\:g)(u)&#xD;&#xA;    =&amp;amp; c(u)\cdot\sum_{x=0}^{N-1}g(x)\cdot\cos\bigl((2x+1)u\cdot\tfrac\pi{2N}\bigr)&#xD;&#xA;  \\=&amp;amp; c(u)\cdot\sum_{x=0}^{N-1}f(N-1-x)&#xD;&#xA;        \cdot\cos\bigl((2N-2N+1+2x)u\cdot\tfrac\pi{2N}\bigr)&#xD;&#xA;  \\=&amp;amp; c(u)\cdot\sum_{(N-1-x)=(N-1)}^{0}f(N-1-x)&#xD;&#xA;        \cdot\cos\Bigl(\bigl(2N-1-2(N-1-x)\bigr)u\cdot\tfrac\pi{2N}\Bigr)&#xD;&#xA;\end{aligned}$$&#xA;substitute now $N-1-x=:\xi$,&#xA;$$\begin{aligned}&#xD;&#xA;  (\operatorname{DCT}\:g)(u)&#xD;&#xA;    =&amp;amp; c(u)\cdot\sum_{\xi=0}^{N-1}f(\xi)&#xD;&#xA;        \cdot\cos\Bigl(\bigl(2N-1-2\xi\bigr)u\cdot\tfrac\pi{2N}\Bigr)&#xD;&#xA;  \\=&amp;amp; c(u)\cdot\sum_{\xi=0}^{N-1}f(\xi)&#xD;&#xA;        \cdot\cos\Bigl(\pi\bigl(\tfrac{2N}{2N}-\tfrac{2\xi+1}{2N}\bigr)u\Bigr).&#xD;&#xA;\end{aligned}$$&#xA;In the cosine, we have now a shift by an integer multiple ($u$) of $\pi$. Such a shift in a sine or cosine function is equivalent to multiplying the function with $(-1)^u$, So the result is&#xA;$$\begin{aligned}&#xD;&#xA;  (\operatorname{DCT}\:g)(u)&#xD;&#xA;    =&amp;amp; c(u)\cdot\sum_{\xi=0}^{N-1}f(\xi)&#xD;&#xA;        \cdot\cos\bigl(\pi\tfrac{2\xi+1}{2N}u\bigr)\cdot(-1)^u&#xD;&#xA;  \\=&amp;amp; (-1)^u\cdot(\operatorname{DCT}\:f)(u).&#xD;&#xA;\end{aligned}$$&#xA;Not quite the expression you wanted to show, but this should be the correct one.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2011-11-17T18:44:31.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="664" PostTypeId="1" CreationDate="2011-11-18T04:31:07.173" Score="11" ViewCount="1240" Body="&lt;p&gt;So I recently implemented a CMA equalizer in MATLAB that uses method of steepest descent to converge to the minimal cost. (Im on an equalizer implementation binge).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) It seems to me that the CMA algorithm is only good for channels where they are relatively 'flat'. In other words, it is not expected to work for channels with deep fades/nulls? Is this generally true? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I am using a BPSK signal, and we can see from the first figure here, that after the multipath effects I have a smearing on the complex plane of my BPSK signal - there arent two nice clusters as one would expect. Instead, we see 4 red clusters. My question is how come after the CMA equalizer I &lt;em&gt;still&lt;/em&gt; have 4 clusters? (I colored those blue). I suppose it makes some sense because the CMA simply forces the envelopes to be 1, and doesnt 'care' which cluster you are talking about. I have heard that CMA can suffer from local minima problems however. Would this be an example of it? (ie, getting 4 clusters instead of 2 since this is BPSK). If not, what can be done about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LgGt1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Almost as if answering question 2, I went ahead and changed the constant modulus that I seek to minimize the error against. Instead of choosing 1 (as is supposed to be the case for BPSK), I chose 0.25 to be the modulus. This is the constellation I got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/feafj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that even if this is a 'solution', how does one know apriori what to chose the modulus to be? The reason I consider it a problem is that if I have 4 clusters instead of 2 it makes post-symbol phase/frequency offset estimation/correction more complicated especially when one expects 2 clusters due to BPSK signalling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(For completeness I have attached the same plots but when I added frequency offsets)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0BfEk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bbHQ7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any insights you can give into this equalizer! &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-03-23T23:38:25.180" Title="General questions on the CMA equalizer" Tags="|equalization|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="666" PostTypeId="2" ParentId="644" CreationDate="2011-11-18T17:32:12.390" Score="3" Body="&lt;p&gt;One of the biggest attraction why  one would want to do DCT based texture segmentation/classification (or any other activity) is the fact that most JPEG images and MPEG videos are already in DCT. On the other hand, it is generally believed that Gabor based approach is computationally costly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DCT co-efficients MID to high frequencies and or diagonal frequencies reflect a good representation of local variations in the pixel domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, all this may not be as good as it sounds. First off, in most standards DCT blocks are 8x8 size. So it's implied implication is that if the scene has pattern which has periodicity of 8 pixel points, this resonating effect will be visible in terms of similarity of the corresponding co-efficients of adjoining blocks however, when the periodicity changes this relationship varies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Understand the critical difference between pure blocks of DCT vs. Gabor is that Gabor has a scale. So if you change the &quot;periodicity&quot; or &quot;fineness/roughness&quot; of the texture, Gabor will discover it where as DCT's fixed evaluation @ 8x8 block size won't be able to fit well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what one needs to realize is to build such patterns by looking at multiple blocks together to evaluate such &lt;em&gt;scale&lt;/em&gt; phenomenon. As a basic approach for example, ask if i would have had 16x16 blocks or 32x32 size blocks, what would have been the resultant patterns in the co-efficients? The co-efficients in respective locations will have some relationship to exploit and allows one to discover true scale of the texture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This indeed is a good research topic to pursue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE: Even MPEG7 (who is very close to committees who created MPEG) - they propose Gabor based features for texture rather than DCT based.   &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2011-11-18T17:32:12.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="667" PostTypeId="1" CreationDate="2011-11-18T19:09:27.553" Score="5" ViewCount="898" Body="&lt;p&gt;I have an image processing algorithm which uses Gaussian and Laplacian Pyramid Decomposition.&#xA;At each level of the pyramid the algorithm decimates the previous level by a factor of 2.&#xA;The LPF the algorithm uses is Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering whether I could get the same results without the decimation step (By altering the LPF).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, the decimation step is equivalent of cutting by half the bandwidth of the LPF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I tried, with no success, is to double the STD of the LPF at each step and skip the decimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another / better way to do it?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-08-18T14:49:52.063" LastActivityDate="2019-08-18T14:49:52.063" Title="Image Pyramid Without Decimation" Tags="|image-processing|decimation|multi-scale-analysis|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="668" PostTypeId="2" ParentId="667" CreationDate="2011-11-18T19:21:02.487" Score="1" Body="&lt;p&gt;In wavelet analysis, assuming you're operating on two-dimensional dyadic wavelets, in order to get the next (larger) wavelet, you convolve the current one with itself. Take you current LPF, convolve it with itself, and you'll get you next one. Proceed for however many iteration you need.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2011-11-18T19:21:02.487" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="669" PostTypeId="2" ParentId="667" CreationDate="2011-11-18T21:11:50.747" Score="2" Body="&lt;p&gt;You can generate a scale volume from an image by convolving it with Gaussians of increasing $\sigma$. Or, equivalently, by convlolving it repeatedly with the same Gaussian.  It just won't be a pyramid. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One reason to generate a pyramid by downsampling is to reduce the amount of computation, because once you apply a low-pass filter the full resolution becomes redundant.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, are you computing the Laplacian pyramid by using the difference of Gaussians?  In that case, you need to downsample each subsequent scale level, and then upsample it before you take the difference with the previous level.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2011-11-18T21:11:50.747" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="670" PostTypeId="1" AcceptedAnswerId="677" CreationDate="2011-11-19T15:43:19.603" Score="11" ViewCount="434" Body="&lt;p&gt;Would someone be able to give me some info or a link etc ... regarding &lt;strong&gt;haarlets&lt;/strong&gt; aka &lt;strong&gt;Haar wavelet-like features&lt;/strong&gt;. I'm reading several papers for my master dissertation and several of these papers briefly mention haarlets. I can't seem to really get what they are and how they are used. I apologize if this is a basic question. But i would really appreciate some clear, structured info on the subject. &lt;/p&gt;&#xA;" OwnerUserId="569" LastActivityDate="2015-02-20T00:24:48.413" Title="Explanation on Haarlets" Tags="|image-processing|edge-detection|wavelet|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="671" PostTypeId="2" ParentId="670" CreationDate="2011-11-20T03:14:56.133" Score="2" Body="&lt;p&gt;The Haar wavelet is used for edge detection and edge detection is a common problem in image processing, specially for pattern recognition. Haarlets are recommended for that purpose. As an example, this project uses haarlets to achieve that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bergh, M, Koller-Meier, E, &amp;amp; Gool, L 2009, 'Real-Time Body Pose Recognition Using 2D or 3D Haarlets', International Journal Of Computer Vision, 83, 1, pp. 72-84, Computers &amp;amp; Applied Sciences Complete, EBSCOhost.&lt;/p&gt;&#xA;" OwnerUserId="571" LastEditorUserId="571" LastEditDate="2015-02-20T00:24:48.413" LastActivityDate="2015-02-20T00:24:48.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="672" PostTypeId="1" AcceptedAnswerId="673" CreationDate="2011-11-20T05:12:38.523" Score="34" ViewCount="20242" Body="&lt;p&gt;I have heard anecdotaly that sampling complex signals need not follow Nyquist sampling rates but can actually be gotten away with half Nyquist sampling rates. I am wondering if there is any truth to this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Nyquist, we know that to unambiguously sample a signal, we need to sample at least higher than double the bandwidth of that signal. (I am defining bandwidth here as they do in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot;&gt;wiki&lt;/a&gt; link, aka, the occupancy of the positive frequency). In other words, if my signal exists from -B to B, I need to sample at least &gt; 2*B to satisfy nyquist. If I mixed this signal up to fc, and wished to do bandpass sampling, I would need to sample at least &gt; 4*B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is all great for real signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there any truth to the statement that a complex baseband signal (aka, one that only exists on one side of the frequency spectrum) need &lt;strong&gt;not&lt;/strong&gt; be sampled at a rate of at least &gt; 2*B, but can in fact be adequately sampled at a rate of at least &gt; B? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I tend to think that if this is the case this is simply semantics, because you still have to take &lt;em&gt;two&lt;/em&gt; samples (one real and one imaginary) per sample time in order to completely represent the rotating phasor, thereby strictly still following Nyquist...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are your thoughts?&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2022-11-19T13:47:46.143" Title="&quot;Complex sampling&quot; can break Nyquist?" Tags="|sampling|frequency-spectrum|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="673" PostTypeId="2" ParentId="672" CreationDate="2011-11-20T15:39:23.973" Score="25" Body="&lt;p&gt;Your understanding is correct. If you sample at rate $f_s$, then with real samples only, you can unambiguously represent frequency content in the region $[0, \frac{f_s}{2})$ (although the caveat that allows &lt;a href=&quot;http://en.wikipedia.org/wiki/Bandpass_sampling&quot;&gt;bandpass sampling&lt;/a&gt; still applies). No additional information can be held in the other half of the spectrum when the samples are real, because real signals exhibit &lt;a href=&quot;http://en.wikipedia.org/wiki/Hermitian_symmetry&quot;&gt;conjugate symmetry&lt;/a&gt; in the frequency domain; if your signal is real and you know its spectrum from $0$ to $\frac{f_s}{2}$, then you can trivially conclude what the other half of its spectrum is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no such restriction for complex signals, so a complex signal sampled at rate $f_s$ can unambiguously contain content from $-\frac{f_s}{2}$ to $\frac{f_s}{2}$ (for a total bandwidth of $f_s$). As you noted, however, there's not an inherent efficiency improvement to be made here, as each complex sample contains two components (real and imaginary), so while you require half as many samples, each requires twice the amount of data storage, which cancels out any immediate benefit. Complex signals are often used in signal processing, however, where you have problems that map well to that structure (such as in quadrature communications systems).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-20T15:39:23.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="675" PostTypeId="1" CreationDate="2011-11-21T10:17:37.670" Score="28" ViewCount="1742" Body="&lt;p&gt;Here is a question for image processing experts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on a difficult computer vision problem. The task is to count the stomata (marked below) in DIC microscopy images.  These images are resistant to most superficial image processing techniques like morphological operations and edge detection. It is also different from other cell counting tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am  using OpenCV. My plan is to review potentially useful features for stomata discrimination.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Texture classifiers&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;DCT (Discrete cosine transform/frequency-domain analysis)&lt;/li&gt;&#xA;&lt;li&gt;LBP (Local binary patterns)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;HOG (Histogram of oriented gradients)&lt;/li&gt;&#xA;&lt;li&gt;Robust feature detectors (I am skeptical)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Harris corners&lt;/li&gt;&#xA;&lt;li&gt;SIFT, SURF, STAR, etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Haar cascade classifier/Viola-Jones features&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And possibly design a novel feature descriptor. I am leaving out the selection of a classifier for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I missed?  How would you solve this? Solutions for similar object detection problems would be very helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample images &lt;a href=&quot;http://www.mattmontag.com/images/stomata&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5T5Ds.jpg&quot; alt=&quot;stomata&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After bandpass filter:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/38Ysw.jpg&quot; alt=&quot;bandpass filtered&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Canny edge detection is not promising. Some image areas are out of focus:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GeFBs.jpg&quot; alt=&quot;canny edge detection&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="267" LastActivityDate="2013-05-15T03:03:28.290" Title="Find the stomata in a plant microscopy image" Tags="|image-processing|computer-vision|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="676" PostTypeId="2" ParentId="675" CreationDate="2011-11-21T12:49:43.747" Score="11" Body="&lt;p&gt;First thing I would try is template matching, with templates rotated for all the angles with some step. Rotating template essential here. Also choice of template could be non-trivial - could be several with different lighting, and it could be blurred to allow for difference in shapes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Template_matching#Template-based_matching_and_convolution&quot;&gt;http://en.wikipedia.org/wiki/Template_matching#Template-based_matching_and_convolution&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next - HOG looks promising here. Another solution could be using strong corner detector like Moravec or Shi-Tomasi (with non-maximum suppression) and look for groups of 2-corners or 3-4 corners on the same line as candidates. After finding candidates you can apply active contour for verification (not sure if it would really help, but that is possibility)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Corner_detector&quot;&gt;http://en.wikipedia.org/wiki/Corner_detector&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Active_contour&quot;&gt;http://en.wikipedia.org/wiki/Active_contour&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet another possibility is to use Hough transform for ellipses, possibly with not 2 but 3-4 free parameters.&lt;/p&gt;&#xA;" OwnerUserId="198" LastEditorUserId="198" LastEditDate="2011-11-21T12:55:30.927" LastActivityDate="2011-11-21T12:55:30.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="677" PostTypeId="2" ParentId="670" CreationDate="2011-11-21T18:17:41.303" Score="5" Body="&lt;p&gt;Have you seen &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_IJCV.pdf&quot;&gt;Robust Real-time Object Detection&lt;/a&gt; by Viola and Jones?  This is probably the most widely used face detection algorithm, and also the most famous example of the use of the Haar wavelet-like features.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2011-11-21T18:17:41.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="678" PostTypeId="2" ParentId="675" CreationDate="2011-11-21T18:28:07.583" Score="1" Body="&lt;p&gt;I would start by using a sensitive edge detector (e. g. gradient magnitude with a low threshold), and then use the Hough transform to try to find the ellipses.  Canny might still work as well.  I am sure there are parameters you can tweak to make it more sensitive and pick up the blurred edges.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2011-11-21T18:28:07.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="679" PostTypeId="1" AcceptedAnswerId="711" CreationDate="2011-11-21T23:16:28.340" Score="15" ViewCount="2637" Body="&lt;p&gt;A &lt;strong&gt;point cloud&lt;/strong&gt; is generated using uniform random function for &lt;code&gt;(x,y,z)&lt;/code&gt;. As shown on the following figure, a flat intersecting plane (&lt;strong&gt;profile&lt;/strong&gt;) is being investigated that matches as the best (even if not the exact one) a target profile i.e., given at the left-bottom corner. So &lt;strong&gt;&lt;em&gt;the question&lt;/em&gt;&lt;/strong&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1- How to find such a match of given &lt;code&gt;target 2D point map&lt;/code&gt; through &lt;code&gt;point cloud&lt;/code&gt; considering the following notes/conditions?&lt;br&gt;&#xA;  2- What are then the coordinates/orientations/degree of similarity etc?  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note 1:&lt;/strong&gt; The profile of interest could be anywhere with any rotation along axes and also could be in different shape e.g., a triangle, rectangle, quadrangle etc depending on its location and orientation. At the following demonstration only a simple rectangle one is shown.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note 2:&lt;/strong&gt; A tolerance value could be considered as the distance of the points from the profile. To demonstrate this for the following figure suppose a tolerance of &lt;code&gt;0.01&lt;/code&gt; times the smallest dimension &lt;code&gt;(~1)&lt;/code&gt; so &lt;code&gt;tol=0.01&lt;/code&gt;. So if we remove the rest and project all remaining points on the plane of the profile being investigated then we will be able to check its similarity with the target profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note 3:&lt;/strong&gt; A related topic could be found at &lt;a href=&quot;https://dsp.stackexchange.com/questions/517/point-pattern-recognition&quot;&gt;Point Pattern Recognition&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2EzKR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="488" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2011-12-15T10:29:03.217" Title="Profile Matching in a Point Cloud" Tags="|image-processing|computer-vision|image-registration|point-cloud|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="681" PostTypeId="2" ParentId="675" CreationDate="2011-11-22T01:37:22.347" Score="7" Body="&lt;p&gt;Partial answer. Finding candidates with Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p = ColorConvert[Import@&quot;https://i.stack.imgur.com/38Ysw.jpg&quot;, &#xA;    &quot;GrayScale&quot;] // ImageAdjust;&#xA;m = DeleteSmallComponents[Erosion[Dilation[DeleteSmallComponents[&#xA;      Binarize[EntropyFilter[p, 1] // ImageAdjust, .97], 10], 3], 5], 100];&#xA;ImageMultiply[Dilation[m, 3], p]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4ppkw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="61" LastActivityDate="2011-11-22T01:37:22.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="682" PostTypeId="2" ParentId="374" CreationDate="2011-11-22T02:00:46.900" Score="58" Body="&lt;p&gt;In Mathematica, using erosion and Hough transform:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(*Get Your Images*)&#xA;i = Import /@ {&quot;https://i.stack.imgur.com/4ShOW.png&quot;, &#xA;               &quot;https://i.stack.imgur.com/5UQwb.png&quot;};&#xA;&#xA;(*Erode and binarize*)&#xA;i1 = Binarize /@ (Erosion[#, 2] &amp;amp; /@ i);&#xA;&#xA;(*Hough transform*)&#xA;lines = ImageLines[#, .5, &quot;Segmented&quot; -&amp;gt; True] &amp;amp; /@ i1;&#xA;&#xA;(*Ready, show them*)&#xA;Show[#[[1]],Graphics[{Thick,Orange, Line /@ #[[2]]}]] &amp;amp; /@ Transpose[{i, lines}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bpbaJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; Answering Mr. Wizard's comment&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get rid of the horizontal lines, just do something like this instead (probably someone could make it simpler):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Show[#[[1]], Graphics[{Thick, Orange, Line /@ #[[2]]}]] &amp;amp; /@ &#xA; Transpose[{i, Select[Flatten[#, 1], Chop@Last@(Subtract @@ #) != 0 &amp;amp;] &amp;amp; /@ lines}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DbYvg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="61" LastEditorUserId="61" LastEditDate="2011-11-22T12:53:33.320" LastActivityDate="2011-11-22T12:53:33.320" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="684" PostTypeId="1" CreationDate="2011-09-23T08:10:33.477" Score="6" ViewCount="319" Body="&lt;p&gt;Suppose I have 4 of 300bps synchronous digital input and 1 of analogue input with a bandwidth of 500Hz. The analogue input is sampled at 4bit using PCM. All the channels are multiplexed with TDM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As one of the input is of analogue, I need to convert that to digital input first before TDM can be carried out. Since the analogue signal will be sampled at 4bits, my initial idea was to use the Nyquist sampling theorem to have 500Hz × 2 = 1000 samplings per second. But on a second thought, this is merely the bandwidth and I cannot do this unless it is said that the highest frequency is 500Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, then how should I find out the input bit rate of the analogue input channel for the TDM multiplexing?&lt;/p&gt;&#xA;" OwnerUserId="3769" OwnerDisplayName="xEnOn" LastEditorUserId="29" LastEditDate="2011-11-22T16:04:57.853" LastActivityDate="2012-04-20T21:09:16.040" Title="Finding the input bit rate of an analogue input" Tags="|frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="685" PostTypeId="2" ParentId="684" CreationDate="2011-11-22T18:01:57.520" Score="1" Body="&lt;p&gt;Theoretically speaking you need 2 samples per second for 1 Hz of bandwidth (regardless whether the signal is centered around DC or not), so in this case a sample rate of 1 kHz would be enough.&#xA;Practically speaking, you always need more since the theoretical requirements is based on the assumption of an ideal low pass (or bandpass) filter.&#xA;The correct choice of sample rate depends on how the band limiting is achieved and what bandwidth you are really interested in and what noise and sampling accuracy you need. Most audio systems use 44.1 kHz or 48 kHz to achieve 20 kHz usable bandwidth.&#xA;Another consideration is that you already have some digital inputs. These are derived from some master clock anyway. If you can use the same clock to sample your input, you can make the subsequent processing a lot easier.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-11-22T18:01:57.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="686" PostTypeId="1" AcceptedAnswerId="695" CreationDate="2011-11-23T00:34:10.433" Score="13" ViewCount="2690" Body="&lt;p&gt;When converting scanned text to a 1-bit black-and-white image what are some filters that one can apply in the process to improve the result? Right now I am running into the problem where dithering errors make the image look horrible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&#xA;I think trying to undo dithering is a much harder problem. How can I convert the first image to a monochrome image? The default approach &lt;code&gt;convert -monochrome img1 img2&lt;/code&gt; is shown below. I've also tried a two-step approach: 1) decrease depth (color palette) and gamma 2) convert to a bilevel image (not shown). Other things I played with included imagemagick's &lt;a href=&quot;http://www.imagemagick.org/Usage/bugs/ordered-dither/&quot; rel=&quot;noreferrer&quot;&gt;ordered-dither&lt;/a&gt; (at various settings), but it wasn't as good as the two-step approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cbXCv.png&quot; alt=&quot;text image&quot; title=&quot;grayscale text&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/3xQAh.png&quot; alt=&quot;monochrome image&quot; title=&quot;dithering horror&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="580" LastEditorUserId="580" LastEditDate="2011-11-24T01:45:54.497" LastActivityDate="2011-11-24T08:28:45.097" Title="monochrome (1-bit black-and-white) image conversion" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="687" PostTypeId="2" ParentId="675" CreationDate="2011-11-23T06:33:19.647" Score="15" Body="&lt;p&gt;Sorry I don't know OpenCV, and this is more a pre-processing step than a complete answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you don't want an edge detector.  An edge detector converts transitions (like this dark-to-light):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VAtBS.png&quot; alt=&quot;    _____/‾‾‾‾‾&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;into ridges (bright lines on dark) like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M2BMy.png&quot; alt=&quot;    ____/_____&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It performs a differentiation, in other words.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in your images, there is a light shining down from one direction, which shows us the relief of the 3D surface.  We perceive this as lines and edges, because we're used to seeing things in 3D, but they aren't really, which is why edge detectors aren't working, and template matching won't work easily with rotated images (a perfect match at 0 degrees rotation would actually cancel out completely at 180 degrees, because light and dark would line up with each other).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the height of one of these mazy lines looks like this from the side:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M2BMy.png&quot; alt=&quot;    ____/_____&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the brightness function when illuminated from one side will look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IsOOh.png&quot; alt=&quot;    ____∧v____&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what you see in your images.  The facing surface becomes brighter and the trailing surface becomes darker.  So you don't want to differentiate.  You need to &lt;em&gt;integrate&lt;/em&gt; the image along the direction of illumination, and it will give you the original height map of the surface (approximately).  Then it will be easier to match things, whether through Hough transform or template matching or whatever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to automate finding the direction of illumination.  If it's the same for all your images, great.  Otherwise you'd have to find the biggest contrast line and assume the light is perpendicular to it or something.  For my example, I rotated the image manually to what I thought was the right direction, with light coming from the left:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8zN3Z.jpg&quot; alt=&quot;original, rotated&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need to remove all the low-frequency changes in the image, though, to highlight only the quickly-changing line-like features.  To avoid ringing artifacts, I used 2D Gaussian blur and then subtracted that from the original:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KUVCW.png&quot; alt=&quot;high pass filtered&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The integration (cumulative sum) can runaway easily, which produces horizontal streaks.  I removed these with another Gaussian high-pass, but only in the horizontal direction this time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9x2jr.png&quot; alt=&quot;output&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the stomata are white ellipses all the way around, instead of white in some places and black in others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZL8eT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integrated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KWfNZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pylab import *&#xA;import Image&#xA;from scipy.ndimage import gaussian_filter, gaussian_filter1d&#xA;&#xA;filename = 'rotated_sample.jpg'&#xA;I = Image.open(filename).convert('L')&#xA;I = asarray(I)&#xA;&#xA;# Remove DC offset&#xA;I = I - average(I)&#xA;&#xA;close('all')&#xA;figure()&#xA;imshow(I)&#xA;gray()&#xA;show()&#xA;title('Original')&#xA;&#xA;# Remove slowly-varying features&#xA;sigma_2d = 2&#xA;I = I - gaussian_filter(I, sigma_2d)&#xA;&#xA;figure()&#xA;imshow(I)&#xA;title('2D filtered with %s' % sigma_2d)&#xA;&#xA;# Integrate&#xA;summed = cumsum(I, 1)&#xA;&#xA;# Remove slowly-changing streaks in horizontal direction&#xA;sigma_1d = 5&#xA;output = summed - gaussian_filter1d(summed, sigma_1d, axis=1)&#xA;&#xA;figure()&#xA;imshow(output)&#xA;title('1D filtered with %s' % sigma_1d)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Hough_Transform#Hough_transform_of_curves.2C_and_Generalised_Hough_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hough transform&lt;/a&gt; can be used to detect ridge ellipses like this, made of &quot;edge pixels&quot;, though it's really expensive in computation and memory, and they are not perfect ellipses so it would have to be a bit of a &quot;sloppy&quot; detector.  I've never done it, but there are a lot of Google results for &quot;&lt;a href=&quot;http://google.com/?q=hough%20ellipse%20detection&quot; rel=&quot;nofollow noreferrer&quot;&gt;hough ellipse detection&lt;/a&gt;&quot;.  I'd say if you detect one ellipse inside the other, within a certain size search space, it should be counted as a stoma.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://tech.groups.yahoo.com/group/OpenCV/message/1992&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV: How to detect a ellipse in the binary image&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/q/5368449/125507&quot;&gt;Python and OpenCV. How do I detect all (filled)circles/round objects in an image?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/q/4785419/125507&quot;&gt;Detection of coins (and fit ellipses) on an image&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-05-15T03:03:28.290" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="688" PostTypeId="1" AcceptedAnswerId="54338" CreationDate="2011-11-23T12:55:44.333" Score="13" ViewCount="2753" Body="&lt;p&gt;Can someone explain the algorithm behind the &amp;quot;Black and White&amp;quot; adjustment layer in photoshop?&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RHPZO.png&quot; alt=&quot;Photoshop screenshot&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have to reproduce it using C++ for an application that emphasizes non-red/magenta(ish) pixels from an image (with a percent-like configurable tolerance), and this resource showed the behavior I'm expecting.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Update: Still couldn't reproduce it, but I found a clue:&lt;/p&gt;&#xA;&lt;p&gt;Each pixel is defined by up to two controls, one additive (RGB) and one subtractive (CMY).&lt;/p&gt;&#xA;" OwnerUserId="582" LastEditorUserId="7092" LastEditDate="2022-04-15T11:00:45.823" LastActivityDate="2022-04-15T11:00:45.823" Title="What Is the Algorithm Behind Photoshop's &quot;Black and White&quot; Adjustment Layer?" Tags="|image-processing|matlab|algorithms|color|reverse-engineering|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="689" PostTypeId="2" ParentId="688" CreationDate="2011-11-23T14:06:36.610" Score="7" Body="&lt;p&gt;Each (color) image is composed of RGB components. when you add (or reduce) a constant value to all pixels only in RED components you will see the effect equivalent to moving the RED tab towards the right, and same way reducing the RED component by a constant will have the reverse effect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like wise you can increment/decrement each component by a fixed value as described. If you increase/decrease ALL RGB components by a same value this will be equivalent to change in brightness (basically you are adding/removing WHITE color). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Cyan, Blue, Magenta - corresponds to such transformation in CMYK color space. (But i guess, Blue in this color space corresponds to mix of Cyan and Yellow. So that's a bit tricky. The transformation is essentially same for all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last element Tint: { Hue and Saturation } corresponds to same operations but here, the images is first transformed in HSV model and then HUE and Saturation is added/subtracted independently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know about the exact relationships of markers of the dial to the corresponding numbers but that you can figure out by trying out practical values. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2011-11-23T14:06:36.610" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="690" PostTypeId="2" ParentId="686" CreationDate="2011-11-23T14:16:22.893" Score="4" Body="&lt;p&gt;What you are looking at is called and &lt;strong&gt;un-dithering&lt;/strong&gt;. Theoretically, the problems is ill-posed if you want to reconstruct exact images prior to dithering and printing. However, some linear filtering over a broader window (depending on the amount of quantization of dithering) can be applied. For example, in your case, you can take a collection of total score of 8x8 window and apply the sum that would give you the intensity in terms of 0-256. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper listed &lt;a href=&quot;http://arxiv.org/pdf/1108.2475v1&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; is the solution to your exact problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;br&gt;&#xA;Ok, if i have understood, since you are scanning the image rather than taking a digitally dithered image, your problem is not much of un-dithering. I answered the first part before your update. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, on this case, i would suggest that you can have two step process. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;find an optimal threshold to convert the image into a bi level image. This is best done using trying the find the &quot;valley between the white and black intensities within the histogram. &lt;a href=&quot;http://morse.cs.byu.edu/650/lectures/lect04/thresholding.slides.printing.6.pdf&quot; rel=&quot;nofollow&quot;&gt;See here for basics on thresholding&lt;/a&gt;. But may be you have tried this as well. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now, you might see that some of the edges might be too thin or too thick depending on the type of noise. So in order to reconstruct more optimal image you can apply morphology with operations like Dilation and Erosion. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://www.intelligence.tuc.gr/~petrakis/courses/computervision/binary.pdf&quot; rel=&quot;nofollow&quot;&gt;this presentation&lt;/a&gt; for reference. This will give you a direction of what i was saying. Here is a &lt;a href=&quot;http://www.mathworks.in/help/toolbox/images/f18-12508.html&quot; rel=&quot;nofollow&quot;&gt;reference&lt;/a&gt; on how to apply various morphology filters &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2011-11-24T08:28:45.097" LastActivityDate="2011-11-24T08:28:45.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="691" PostTypeId="1" AcceptedAnswerId="692" CreationDate="2011-11-23T14:59:48.140" Score="17" ViewCount="7387" Body="&lt;p&gt;I found contours on two images with same object and I want to find displacement and rotation of this object. I've tried with rotated bounding boxes of this contours and then its angles and center points but rotations of bounding boxes don't tell about contour rotation correctly because it's the same for angles a+0, a+90, a+180 etc. degrees. Is it any other good way to find rotation and displacement of contours? Maybe some use of convex hull, convexity defects? I've read in Learning OpenCv about matching contours but it hasn't helped. Could someone give some example?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/u6Xgx.jpg&quot; alt=&quot;1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/E2diO.jpg&quot; alt=&quot;2&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UdjnR.png&quot; alt=&quot;3&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PGZkZ.png&quot; alt=&quot;4&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to detect for example pink square, and in the second case pen. Other examples could be squares with some holes, stars etc. As I said I want to make some uniwersal thing. Any suggestions are appreciated because I want to test as many methods as it's possible.&lt;/p&gt;&#xA;" OwnerUserId="583" LastEditorUserId="583" LastEditDate="2011-11-26T10:24:34.353" LastActivityDate="2013-01-11T07:54:33.657" Title="Contours matching - finding contours displacement" Tags="|image-processing|computer-vision|algorithms|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="692" PostTypeId="2" ParentId="691" CreationDate="2011-11-23T18:08:41.843" Score="4" Body="&lt;p&gt;Do you have to worry about a difference in scale between contours?  If not than you can simply find the centroid of each contour, and compute displacement by subtracting one from the other.  Then you can calculate the principal axes of the contours, and find the rotation angle between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If scaling is involved, then you can calculate the scale factor by taking the ratio of the corresponding principal axes.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2011-11-23T20:47:51.877" LastActivityDate="2011-11-23T20:47:51.877" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="693" PostTypeId="1" CreationDate="2011-11-23T22:12:13.577" Score="8" ViewCount="382" Body="&lt;p&gt;I've recorded a 2-sec pronunciation of a vowel sound. The first 0.12 or so seconds of the signal are shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I've constructed an auto-regressive (AR) 8th-order model to compress this signal. (Actually, I'm just modelling 160 samples or 0.02 sec at a time.) The &lt;code&gt;ar&lt;/code&gt; function in Matlab's &lt;a href=&quot;http://www.mathworks.se/products/sysid/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;System Identification Toolbox&lt;/a&gt; can estimate the parameters for an &quot;optimal&quot; spectrum fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is choosing the stochastic input to the model filter. I suppose there's something better than white noise. The periodicity (14 periods per 0.02 seconds) leads me to think that an impulse train with the same period would be suitable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, how would I choose the amplitude, and how would I find the periodicity? ACF and PSD estimations are quite noisy. Am I even on the right track? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wdHgm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2011-11-24T04:56:09.297" Title="What input to use for an AR model of a vowel sound?" Tags="|digital-communications|autoregressive-model|speech|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="694" PostTypeId="2" ParentId="693" CreationDate="2011-11-24T00:32:15.900" Score="5" Body="&lt;p&gt;A pitch estimator is commonly used to find the vocal periodicity.  Common pitch estimators include cepstrum/cepstral analysis, harmonic product spectrum, and composite algorithms, such as &lt;a href=&quot;http://www.ws.binghamton.edu/zahorian/pdf/yet%20another%20algorithm%20for%20pitch%20tracking.pdf&quot;&gt;YAAPT&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-11-24T00:32:15.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="695" PostTypeId="2" ParentId="686" CreationDate="2011-11-24T04:47:23.140" Score="5" Body="&lt;p&gt;I would suggest for this case that you upsample and apply a slight blur and then a sharpen, then apply the threshold operation.  You won't get any more information from the pixel data, it's simply not there. But you'll get a smoother result out of the thresholding operation, and you won't need to dither. The end result is like a photocopier degradation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2lnmc.gif&quot; alt=&quot;result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this is what it looks like when you just use a better diffusion dither algorithm ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dghh7.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="267" LastActivityDate="2011-11-24T04:47:23.140" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="696" PostTypeId="2" ParentId="693" CreationDate="2011-11-24T04:56:09.297" Score="4" Body="&lt;p&gt;I think your best bet is the &quot;YIN&quot; pitch detector, described in this paper: &lt;a href=&quot;http://audition.ens.fr/adc/pdf/2002_JASA_YIN.pdf&quot; rel=&quot;nofollow&quot;&gt;http://audition.ens.fr/adc/pdf/2002_JASA_YIN.pdf&lt;/a&gt;. It's fairly simple, and performs very well. They present it in steps, or improvements upon the previous idea, and even just implementing the first few steps should be sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most pitch detectors that are actually in use are related to autocorrelation. The biggest issue with most pitch detection algorithms is that of octave errors -- either detecting a lower or higher pitch. It's interesting that you say your autocorrelation function is noisy. You should see a bunch of noise, with peaks at integer multiples and divisors of the fundamental frequency. Hopefully the pitch lag corresponding to the fundamental frequency has the largest value, but often it will be at a sub-octave (because the signals is not perfectly periodic), or at a higher octave (because of a strong formant causing one of the higher harmonics to be really loud). I would recommend a window size that is about as large as two of your lowest possible pitch periods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That signal also looks like it has a very low frequency component -- speech usually doesn't wave up and down like that. I might recommend processing it with, say, a 24 dB/oct high-pass filter at around 50 Hz.&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2011-11-24T04:56:09.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="697" PostTypeId="1" CreationDate="2011-11-24T05:35:38.187" Score="10" ViewCount="740" Body="&lt;p&gt;What is the algorithm employed by video cards when one talks about for example &lt;code&gt;8xAA&lt;/code&gt;?&#xA;I thought the algorithm was about looking at neighboring pixels for correction. Yet, I hear that the implementation is just upsampling followed by downsampling.&lt;/p&gt;&#xA;" OwnerUserId="580" LastEditorUserId="26" LastEditDate="2012-04-17T14:16:23.247" LastActivityDate="2012-04-17T14:16:23.247" Title="What is the antialiasing algorithm employed by video cards?" Tags="|image-processing|aliasing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="699" PostTypeId="2" ParentId="532" CreationDate="2011-11-24T13:36:04.007" Score="5" Body="&lt;p&gt;If you look around for &quot;image patch self-similarity&quot; there are some things that are along those lines, for example the work of Eli Shechtman and Michal Irani&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.wisdom.weizmann.ac.il/~vision/SelfSimilarities.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.wisdom.weizmann.ac.il/~vision/SelfSimilarities.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or the Calvin research centre:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.vision.ee.ethz.ch/~calvin/software.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.vision.ee.ethz.ch/~calvin/software.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(see Global and Efficient Self-Similarity for Object Classification and Detection)&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2011-11-24T13:36:04.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="700" PostTypeId="1" CreationDate="2011-11-23T11:41:46.107" Score="10" ViewCount="1155" Body="&lt;p&gt;I want to implement an adaptive thresholding algorithm in MATLAB for filtering data received by an underwater sonar receiver. The data received has an interactive noise component resulting from underwater noise and specular reflection. &lt;a href=&quot;http://www.mathworks.com/help/toolbox/phased/ug/bsvefre.html&quot; rel=&quot;nofollow&quot;&gt;CFARD&lt;/a&gt; method is close, but it does not serve my purpose. I have to image the data so that i am able to see the object, on a screen, that is placed underwater within the scandepth of the sonar. Any help will be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is an underwater environment. I am trying to threshold a signal that has been received from a sonar transducer after it has been reflected by a solid target, that is situated in the same environment as the transducer. The problems belongs to &lt;strong&gt;Underwater Acoustic Imaging&lt;/strong&gt; sonar domain. Problem is, I haven't been able to model the underwater environmental noise. From what I have read till now about this topic, the noise model follows a &lt;a href=&quot;https://en.wikipedia.org/wiki/K-distribution&quot; rel=&quot;nofollow&quot;&gt;$K$-distribution&lt;/a&gt;. Also the environmental noise is not additive in nature, rather it's interactive. Hence the threshold has to be adaptive. I also mentioned CFARD method in my question. That is useful for signal processing in radar applications as we're just interested in finding a single point in a large area which has high energy. Same cannot be said about underwater acoustic imaging sonar, where we try to display the target on the screen as a video. I hope I have made it more clear now. &lt;/p&gt;&#xA;" OwnerUserId="651" OwnerDisplayName="Saurabh" LastEditorUserId="21075" LastEditDate="2020-04-30T16:58:26.967" LastActivityDate="2020-04-30T16:58:26.967" Title="How do I implement an adaptive thresholding algorithm for underwater sonar" Tags="|algorithms|adaptive-algorithms|thresholding|sonar|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="701" PostTypeId="1" AcceptedAnswerId="703" CreationDate="2011-11-24T17:29:08.453" Score="8" ViewCount="5177" Body="&lt;p&gt;Some unsharp algorithms (e.g. Matlab's &lt;em&gt;fspecial&lt;/em&gt;) use a Laplacian kernel to achieve sharpening of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I know, the image needs to be blurred first, and then the blurred image is subtracted from the original to get a sharper image. The Laplacian part comes exactly where alleged smoothing should take place. Correct me if I'm wrong, but Laplacian doesn't do any smoothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does the Laplacian help in sharpening the image?&lt;/p&gt;&#xA;" OwnerUserId="519" LastActivityDate="2011-11-25T02:21:07.740" Title="How is the Laplacian used for Unsharp Mask?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="702" PostTypeId="2" ParentId="697" CreationDate="2011-11-24T18:00:50.373" Score="8" Body="&lt;p&gt;There are various algorithms to do anti-aliasing. I think that the one that you mean is called super-sampling. The idea is that the scene is rendered in x8 resolution of what you eventually see. Then it is low-pass filtered, to eliminate aliasing of higher frequencies in the next step, which is down-sampling x8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is described in detail &lt;a href=&quot;http://en.wikipedia.org/wiki/Supersampling&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a more general discussion of AA algorithms &lt;a href=&quot;http://en.wikipedia.org/wiki/Spatial_anti-aliasing&quot;&gt;here&lt;/a&gt;, and another type of AA algorithm called Multisample AA &lt;a href=&quot;http://en.wikipedia.org/wiki/Multisample_anti-aliasing&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="519" LastActivityDate="2011-11-24T18:00:50.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="703" PostTypeId="2" ParentId="701" CreationDate="2011-11-24T18:39:45.637" Score="9" Body="&lt;p&gt;The regular &lt;em&gt;sharpening&lt;/em&gt; i.e. high pass filter, essentially applies the inverse filter of blurring. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, when you do unsharp masking - instead of subtracting the blurred image, you &lt;em&gt;add&lt;/em&gt; the edge image as a portion of it. we can have $g(x,y)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(x,y)=f(x,y)-f_{smooth}(x,y)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is nothing but an edge image using LoG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sharp image is produced by adding portion of this is added back to original image and hence contrast near edge increases drastically. This is how you produce the sharp image $f_{sharp}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_{sharp}(x,y)=f(x,y)+k*g(x,y)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Courtesy &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/unsharp.htm&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/unsharp.htm&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More details are given in that page.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="77" LastEditDate="2011-11-25T02:21:07.740" LastActivityDate="2011-11-25T02:21:07.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="704" PostTypeId="1" AcceptedAnswerId="709" CreationDate="2011-11-24T14:21:36.140" Score="8" ViewCount="459" Body="&lt;p&gt;I am playing with the &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/periodogram.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;periodogram&lt;/code&gt;&lt;/a&gt; of MATLAB. I created a simple script to observe how it behaves:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rng(1);  %# initialize the random number generator&#xA;&#xA;Fs = 1000;  %# Sampling frequency&#xA;duration = 0.1; %# seconds&#xA;&#xA;A = 1; %# Sinusoid amplitude&#xA;f = 150; %# Sinusoid frequency&#xA;eps = 0.01;&#xA;&#xA;t = 0:1/Fs:duration;&#xA;x = A * sin(2*pi*f*t) + eps * randn(size(t));&#xA;&#xA;periodogram(x,[],1024,Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fDXS6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no problem with the code and can write my own &lt;code&gt;periodogram&lt;/code&gt; function using the algorithms given in the documentation but I wonder the theoretical reason behind the comb-like hills which are not 150 Hz. What do I get those instead of getting a single spike over 150 Hz? Is there anything special in the distances of the peaks of these hills?&lt;/p&gt;&#xA;" OwnerUserId="482" OwnerDisplayName="İsmail Arı" LastEditorUserId="77" LastEditDate="2011-11-25T14:38:03.550" LastActivityDate="2011-11-27T15:34:13.280" Title="Why are there comb-like hills in a periodogram?" Tags="|frequency-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="705" PostTypeId="2" ParentId="704" CreationDate="2011-11-24T14:46:26.813" Score="13" Body="&lt;p&gt;A single spike (as you call it) appears theoretically only for a infinite-length sinusoid. Since your signal is 100 samples length, it is not infinite. You actually multiplied your infinite signal with a window which has a value of 1 over 100 samples, and 0 elsewhere. Since multiplication in time domain is equivalent to convolution in the frequency domain, your spectrum is a convolution of the single spike and the frequency response of the window (btw it is called rectangular window). This is the function you got. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you read about windowing: &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot;&gt;http://en.wikipedia.org/wiki/Window_function&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="605" OwnerDisplayName="Itamar Katz" LastActivityDate="2011-11-24T14:46:26.813" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="706" PostTypeId="2" ParentId="525" CreationDate="2011-11-25T09:07:19.243" Score="2" Body="&lt;p&gt;One approach might be an old method from &quot;An approximation to the cumulative distribution function of the magnitude-squared coherence estimate&quot; by Nutall and Carter (1981), who basically apply a non-linear distortion to transform the MSC to near-Gaussian random variables, then you could apply standard methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1163657&quot; rel=&quot;nofollow&quot;&gt;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1163657&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more recent approach used overlapping segments to create an (approximate) PDF and CDF for the MSC: &quot;Approximation of statistical distribution of magnitude squared coherence estimated with segment overlapping&quot; by Bortel and Sovka (2006):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0165168406003471&quot; rel=&quot;nofollow&quot;&gt;http://www.sciencedirect.com/science/article/pii/S0165168406003471&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They give a procedure for the comparison of two MSC estimates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may be more refined methods, but I'm not aware of them.&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="584" LastEditDate="2011-11-25T22:14:46.383" LastActivityDate="2011-11-25T22:14:46.383" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="707" PostTypeId="1" AcceptedAnswerId="708" CreationDate="2011-11-25T12:24:06.903" Score="26" ViewCount="10271" Body="&lt;p&gt;Mathematica's &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/ImageResize.html&quot;&gt;&lt;code&gt;ImageResize&lt;/code&gt;&lt;/a&gt; function supports many &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/Resampling.html&quot;&gt;resampling&lt;/a&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not being familiar with this area, beyond nearest neighbour, bilinear, biquadratic and bicubic (which are obvious from the name), I am lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you point me to some source that will explain the basic (mathematical) differences between these methods, and in particular &lt;em&gt;point out the practical differences&lt;/em&gt; (e.g. by showing sample images where the choice of method really matters and introduces noticeable differences)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;I don't have a signal processing background, so I'd prefer a &quot;gentle&quot; and concise introduction :-)&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'll copy here the list of &lt;code&gt;ImageResize&lt;/code&gt; methods for those &quot;lazy&quot; to click the link:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Nearest&quot;  nearest neighbor resampling&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Bilinear&quot; bilinear interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Biquadratic&quot;  biquadratic spline interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Bicubic&quot;  bicubic spline interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Gaussian&quot; Gaussian resampling&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Lanczos&quot;  Lanczos multivariate interpolation method&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Cosine&quot;   cosine interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Hamming&quot;  raised-cosine Hamming interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Hann&quot; raised-cosine Hann interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Blackman&quot; three-term generalized raised cosine&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Bartlett&quot; triangular window interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Connes&quot;   squared Welch interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Welch&quot;    Welch quadratic interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Parzen&quot;   piecewise cubic interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;Kaiser&quot;   zero-order modified Bessel interpolation&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="581" LastActivityDate="2016-07-09T09:07:51.210" Title="What are the practically relevant differences between various image resampling methods?" Tags="|image-processing|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="708" PostTypeId="2" ParentId="707" CreationDate="2011-11-25T20:48:59.387" Score="16" Body="&lt;p&gt;Given an image $I(m,n)$ with $m,n$ integers, the interpolation of that image at any arbitrary point $m',n'$ can be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{I}(m',n')=\sum_{m=\left\lfloor m'\right\rfloor-w+1}^{\left\lfloor m'\right\rfloor+w}\ \sum_{n=\left\lfloor n'\right\rfloor-w+1}^{\left\lfloor n'\right\rfloor+w}I(m,n)\ f(m'-m,n'-n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result $\tilde{I}$ is still only an &lt;em&gt;approximation&lt;/em&gt; to the true underlying continuous image $\mathcal{I}(x,y)$ and all that different interpolating functions do is to minimize the approximation error under different constraints and goals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In signal processing, you'd like the interpolating function $f(m,n)$ to be the ideal low-pass filter. However, its frequency response requires infinite support and is useful only for bandlimited signals. Most images are not bandlimited and in image processing there are other factors to consider (such as how the eye interprets images. What's mathematically optimal might not be visually appealing). The choice of an interpolating function, much like &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;noreferrer&quot;&gt;window functions&lt;/a&gt;, depends very much on the specific problem at hand. I have not heard of Connes, Welch and Parzen (perhaps they're domain specific), but the others should be the 2-D equivalents of the mathematical functions for a 1-D window given in the Wikipedia link above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as with window functions for temporal signals, it is easy to get a gist of what an image interpolating kernel does by looking at its frequency response. From &lt;a href=&quot;https://dsp.stackexchange.com/questions/208/what-should-be-considered-when-selecting-a-windowing-function-when-smoothing-a-t/210#210&quot;&gt;my answer on window functions&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The two primary factors that describe a window function are:&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Width of the main lobe (i.e., at what frequency bin is the power half that of the maximum response)&lt;/li&gt;&#xA;  &lt;li&gt;Attenuation of the side lobes (i.e., how far away down are the side lobes from the mainlobe). This tells you about the spectral&#xA;  leakage in the window.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This pretty much holds true for interpolation kernels. The choice is basically a trade-off between frequency filtering (attenuation of sidelobes), spatial localization (width of mainlobe) and reducing other effects such as ringing (Gibbs effect), aliasing, blurring, etc. For example, a kernel with oscillations such as the sinc kernel and the Lanczos4 kernel will introduce &lt;a href=&quot;http://en.wikipedia.org/wiki/Ringing_artifacts&quot; rel=&quot;noreferrer&quot;&gt;&quot;ringing&quot;&lt;/a&gt; in the image, whereas a Gaussian resampling will not introduce ringing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a simplified example in Mathematica that let's you see the effects of different interpolating functions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;true = ExampleData[{&quot;TestImage&quot;, &quot;Lena&quot;}];&#xA;resampling = {&quot;Nearest&quot;, &quot;Bilinear&quot;, &quot;Biquadratic&quot;, &quot;Bicubic&quot;, &#xA;   &quot;Gaussian&quot;, &quot;Lanczos&quot;, &quot;Cosine&quot;, &quot;Hamming&quot;, &quot;Hann&quot;, &quot;Blackman&quot;, &#xA;   &quot;Bartlett&quot;, &quot;Connes&quot;, &quot;Welch&quot;, &quot;Parzen&quot;, &quot;Kaiser&quot;};&#xA;small = ImageResize[true, Scaled[1/4]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here, &lt;code&gt;true&lt;/code&gt; represents the image which I assume to be the discrete equivalent of the &quot;exact&quot; image $\mathcal{I}(x,y)$, and &lt;code&gt;small&lt;/code&gt; represents a smaller scale image $I(m,n)$ (we don't know how it was obtained). We'll interpolate $I(m,n)$ by 4x to give $\tilde{I}(m',n')$ which is the same size as the original. Below, I show the results of this interpolation and a comparison with the true image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vue9h.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sfDFL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see for yourself that different interpolating functions have different effects. Nearest and a few others have very coarse features and you can essentially see jagged lines (see full sized image, not the grid display). Bicubic, biquadratic and Parzen overcome this but introduce a lot of blurring. Of all the kernels, Lanczos seems (visually) to be the most appealing and one that does the best job of the lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try to expand upon this answer and provide more intuitive examples demonstrating the differences when I have the time. You might want to read &lt;a href=&quot;http://bigwww.epfl.ch/publications/thevenaz9901.pdf&quot; rel=&quot;noreferrer&quot;&gt;this pretty easy and informative article that I found on the web&lt;/a&gt; (PDF warning).&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2011-11-25T20:48:59.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="709" PostTypeId="2" ParentId="704" CreationDate="2011-11-26T04:14:18.540" Score="5" Body="&lt;p&gt;I'm not entirely satisfied by Itamar Katz's answer, so here's my explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT of an $N$ length complex signal, $x[n]=e^{\imath 2\pi f n/N}$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\mathcal{F}\{x[n]\}=\frac{e^{\imath 2\pi (f-k)}-1}{e^{\imath 2\pi (f-k)/N}-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the power or the magnitude squared response is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left\vert X[k]\right\vert^2 = \left(\frac{\sin\left(\pi(f-k)\right)}{\sin\left(\pi(f-k)/N\right)}\right)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the above expression is zero whenever $f-k$ is an integer. You can convince yourself that the denominator is zero at only one point, and at this point, taking limits gives you a value $N^2$ for the ratio. Hence, there is no point at which the expression blows up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when you take the log of the above expression, $log_{10}(0)$ is $-\infty$ (or for that matter, in any base) and hence you get nulls everywhere you had a zero. This is what results in the &quot;comb like hills&quot; in your plot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a short illustration in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Clear@X&#xA;X[f_, n_] := (Sin[π (f - #)]/Sin[π (f - #)/n])^2 &amp;amp;&#xA;Plot[X[3, 10][k], {k, -5, 5}, PlotRange -&amp;gt; All]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2jApI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency is on the x-axis and power (linear) is on the y-axis. You can see that the zeros occur at integer values and the peak is at 3, which is the frequency I had chosen. Now taking $log_{10}$ of the above, you get nulls which give rise to the comb like structure&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E0DbS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's another example with a larger $N$, showing more nulls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IsDlr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="77" LastEditDate="2011-11-27T15:34:13.280" LastActivityDate="2011-11-27T15:34:13.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="710" PostTypeId="1" AcceptedAnswerId="716" CreationDate="2011-11-26T12:29:16.580" Score="15" ViewCount="2970" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;In mathematics, the term ergodic is used to describe a dynamical system which, broadly speaking, has the same behavior averaged over time as averaged over space.  &lt;a href=&quot;http://en.wikipedia.org/wiki/Ergodicity&quot;&gt;-from wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From the perspective of engineering a signal processing system, does knowing whether a signal is ergodic change the plan of attack for analyzing the signals?  I've always found this a fascinating concept, but I don't really know what do do with it once the determination is made.  What analysis methods would be more pertinent knowing this information?&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2011-11-28T17:17:34.613" Title="Does the determination of the ergodicity of a signal force any changes in methodology?" Tags="|ergodic|averaging|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="711" PostTypeId="2" ParentId="679" CreationDate="2011-11-26T16:01:08.100" Score="4" Body="&lt;p&gt;This is always going to require a lot of computation, especially if you want to process as many as 2000 points.  I'm sure there are highly-optimized solutions for this kind of pattern-matching already, but you have to figure out what it's called in order to find them.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're talking about a point cloud (sparse data) instead of an image, &lt;a href=&quot;https://dsp.stackexchange.com/q/523/29&quot;&gt;my cross-correlation method&lt;/a&gt; doesn't really apply (and would be even worse computationally).  Something like RANSAC probably finds a match quickly, but I don't know much about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt at a solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assumptions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You want to find the best match, not just a loose or &quot;probably correct&quot; match&lt;/li&gt;&#xA;&lt;li&gt;Match will have some small amount of error due to noise in measurement or computation&lt;/li&gt;&#xA;&lt;li&gt;Source points are coplanar&lt;/li&gt;&#xA;&lt;li&gt;All source points must exist in target (= &lt;em&gt;any&lt;/em&gt; unmatched point is a mismatch for the entire profile)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So you should be able to take a lot of shortcuts by disqualifying things and decrease computation time.  In short:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;pick three points from source&lt;/li&gt;&#xA;&lt;li&gt;search through target points, finding sets of 3 points with the same shape&lt;/li&gt;&#xA;&lt;li&gt;when a match of 3 points is found, check all the other points in the plane they define to see if they're a close match&lt;/li&gt;&#xA;&lt;li&gt;if more than one match of all points is found, choose the one with the smallest sum of 3D distances error&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;More detailed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pick a point from the source for testing s1 = (x1, y1)&#xA;Find nearest point in source s2 = (x2, y2)&#xA;d12 = (x1-x2)^2 + (y1-y2)^2&#xA;Find second nearest point in source s3 = (x3, y3)&#xA;d13 = (x1-x3)^2 + (y1-y3)^2&#xA;d23 = (x2-x3)^2 + (y2-y3)^2&#xA;&#xA;for all (x,y,z) test points t1 in target:&#xA;    # imagine s1 and t1 are coincident&#xA;    for all other points t2 in target:&#xA;        if distance from test point &amp;gt; d12:    &#xA;            break out of loop and try another t2 point&#xA;        if distance ≈ d12:&#xA;            # imagine source is now rotated so that s1 and s2 are collinear with t1 and t2&#xA;            for all other points t3 in target:&#xA;                if distance from t1 &amp;gt; d13 or from t2 &amp;gt; d23:&#xA;                    break and try another t3&#xA;                if distance from t1 ≈ d13 and from t2 ≈ d23:&#xA;                    # Now you've found matching triangles in source and target&#xA;                    # align source so that s1, s2, s3 are coplanar with t1, t2, t3&#xA;                    project all source points onto this target plane &#xA;                    for all other points in source:&#xA;                        find nearest point in target&#xA;                        measure distance from source point to target point&#xA;                        if it's not within a threshold:&#xA;                            break and try a new t3&#xA;                        else:&#xA;                            sum errors of all matched points for this configuration (defined by t1, t2, t3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whichever configuration has the least squared error for all other points is the best match&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we're working with 3 nearest neighbor test points, matching target points can be simplified by checking if they are within some radius.  If searching for a radius of 1 from (0, 0), for instance, we can disqualify (2, 0) based on x1 - x2, without calculating the actual Euclidean distance, to speed it up a bit.  This assumes that subtraction is faster than multiplication. There are &lt;a href=&quot;https://en.wikipedia.org/wiki/Fixed-radius_near_neighbors&quot; rel=&quot;nofollow noreferrer&quot;&gt;optimized searches based on more arbitrary fixed radius&lt;/a&gt;, too.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function is_closer_than(x1, y1, z1, x2, y2, z2, distance):&#xA;    if abs(x1 - x2) or abs(y1 - y2) or abs(z1 - z2) &amp;gt; distance:&#xA;        return False&#xA;    return (x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2 &amp;gt; distance^2 # sqrt is slow&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Euclidean_distance#Three_dimensions&quot; rel=&quot;nofollow noreferrer&quot;&gt;3D Euclidean distance&lt;/a&gt; is $d = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2+(z_1 - z_2)^2}$&#xA;but square roots are slow. Since we're just comparing relative distance, I think we could drop the sqrt and consider &quot;distance&quot; to be sums of squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The minimum calculation time would be if no 2-point matches are found.  &lt;s&gt;If there are 2000 points in the target, this would be 2000 * 2000 distance calculations, though many would be disqualified by a subtraction, and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nearest_neighbor_search#All_nearest_neighbors&quot; rel=&quot;nofollow noreferrer&quot;&gt;results of previous calculations could be stored&lt;/a&gt; so you only have to do $2000 \choose 2$ = 1,999,000.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, since you will need to calculate all of these anyway, whether you find matches or not, and since you only care about nearest neighbors for this step, if you have the memory it's probably better to pre-compute these values using an optimized algorithm.  Something like a &lt;a href=&quot;https://en.wikipedia.org/wiki/Delaunay_triangulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Delaunay&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Pitteway_triangulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pitteway triangulation&lt;/a&gt;, where every point in the target is connected to its nearest neighbors.  Store those in a table, then look them up for each point when trying to fit the source triangle to one of the target triangles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a lot of calculations involved, but it should be relatively fast since it's only operating on the data, which is sparse, instead of multiplying lots of meaningless zeros together like cross-correlation of volumetric data would involve.  This same idea would work for the 2D case if you found the centers of the dots first and stored them as a set of coordinates.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2011-11-28T14:40:44.733" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="712" PostTypeId="1" CreationDate="2011-11-26T16:06:42.153" Score="15" ViewCount="623" Body="&lt;p&gt;I am a biologist with very little experience with image processing but have sufficient knowledge of MATLAB and have the image processing toolbox. Ideally I am looking for a MATLAB based solution, but an approach outlining how to go about it would also be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update (28 Nov 2011)&lt;/strong&gt;&#xA;It appears that there are certain problems (such as overlaps in signal and definition of color) when using composite images (which is what I presented in the initial question).  I am attaching separate images from the 2 channels: green &lt;img src=&quot;https://i.stack.imgur.com/gdpKp.png&quot; alt=&quot;enter image description here&quot;&gt; and red &lt;img src=&quot;https://i.stack.imgur.com/8EBrF.png&quot; alt=&quot;enter image description here&quot;&gt; (the turquoise regions in the composite image can be ignored), and the coposite image &lt;img src=&quot;https://i.stack.imgur.com/HPhmv.jpg&quot; alt=&quot;enter image description here&quot;&gt;. The red channel is bad for 2 reasons: 1. It has poor contrast due to higher background, 2. Since Red seems to bleed into the green at the background level.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;em&gt;feature&lt;/em&gt; is defined as a region on the composite image that has&#xA;Green-Red-turquoise-Red-Green or equivalently the 2 adjacent linear segments on the green and the red that are colinear and contagious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am hoping that looking at the images from the two separate channels makes identification of the features easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following suggestions for the algorithm:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First identify co-linear green segments (and determine lengths of the green segments)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Determine if there are adjacent contagious and colinear segments facing toward each other (i.e. green-&gt;red-&gt;  &amp;lt;-red &amp;lt;-green) in the red channel. If yes define the red segment length from the point where green segments end  (because they will overlap with the green segments) till the point on the red segment that is closest to the other red segment of the feature. (i.e. one of the ends of the red segment is set to the end of the overlapping green segment).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question relates to extracting feature from an image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oCKJu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original image (tif) is located here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/18072545/c_34.tif&quot; rel=&quot;noreferrer&quot;&gt;Image example 1&lt;/a&gt; (dropbox)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This image is a composite of 3 channels (in tif format): red, green and turquoise. The turquoise colored fibers simply marks all the DNA we have on the coverslip. The feature of interest is the Green-Red--turquoise--Red-Green feature on the single DNA strand that is the middle of the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Red is generally the noisiest. This example is good because the contrast is good. However, sometimes the images are not so nice and there is hue throughout the image, so hard-coding a specific RGB value for the green and red color might not work for all images. Also, note that the fibers are not necessarily horizontal, they might be rotated (but never vertical). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see this image for an example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fBuSD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;The original image (tif) is located here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/18072545/c_29.tif&quot; rel=&quot;noreferrer&quot;&gt;Image example 2&lt;/a&gt; (dropbox) &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Also, sometimes a single image has many such features and sometimes there are multiple features on the same DNA strand. Finally sometimes there might be only partial features (i.e. isolated green or isolated red or isolated green-red segments, but unpaired). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be grateful if someone can help me obtain the lengths of the individual segments of green and the red segments i.e. since the feature of interest is Green-Red--turquoise--Red-Green, each feature would have an array of 5 values (length of the first green segment, length of the first red segment, length of the turquoise segment, length of the second Red segment and the length of the second Green segment).&lt;/p&gt;&#xA;" OwnerUserId="596" OwnerDisplayName="Lee Sande" LastEditorUserId="596" LastEditDate="2011-11-28T14:41:03.347" LastActivityDate="2011-11-28T14:41:03.347" Title="Measuring length of DNA fibers from an image of single molecules" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="713" PostTypeId="2" ParentId="712" CreationDate="2011-11-27T03:25:33.797" Score="12" Body="&lt;p&gt;Example in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(* Get your image*)&#xA;img = Import[&quot;http://dl.dropbox.com/u/18072545/c_29.tif&quot;];&#xA;(*Detect the extended minima and remove background*)&#xA;nB = ImageSubtract[img, ColorNegate@FillingTransform@ColorNegate[img]]  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4NWgz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(*Separate RGB channels*)&#xA;cS = ImageAdjust /@ ColorSeparate[img]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FUONc.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(*Binarize*)&#xA;bcS = Binarize[#, .4] &amp;amp; /@ cS  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/277u2.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(*Remove large elements*)&#xA;tH = TopHatTransform[#, DiskMatrix[2]] &amp;amp; /@ bcS  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i2voC.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(*Detect lines using a Hough Transform*)&#xA;lines = ImageLines[#, .01, .8] &amp;amp; /@ tH&#xA;(*Plot them*)&#xA;Show[img, Graphics[{&#xA;   Thickness[.01], Red, Line /@ (lines[[1]]),&#xA;   Thickness[.006], Green, Line /@ (lines[[2]]),&#xA;   Thickness[.004], Blue, Line /@ (lines[[3]])}]]&#xA;(*Red and green are superimposed*)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/659zb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you may see the Red and Green clusters apart. As you can imagine, you have to decide &lt;em&gt;when&lt;/em&gt; a portion is red!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PuoE3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="61" LastEditorUserId="61" LastEditDate="2011-11-27T18:10:18.650" LastActivityDate="2011-11-27T18:10:18.650" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="714" PostTypeId="2" ParentId="691" CreationDate="2011-11-27T08:51:07.130" Score="2" Body="&lt;p&gt;If you don't have to worry about scale or projective distortions chain codes may help here. If you have chain codes of approximately same shape with the same scale  you can find translation with one-dimensional FFT phase correlation&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_correlation&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Phase_correlation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have to take into account projective distortion you may also consider possibility of using feature points (like corners) instead of contours.&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2011-11-27T08:51:07.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="715" PostTypeId="1" AcceptedAnswerId="722" CreationDate="2011-11-27T14:22:29.257" Score="24" ViewCount="8604" Body="&lt;p&gt;I am faced with a tricky challenge:  To extract binary data from an &lt;a href=&quot;http://www.wired.com/reviews/2010/02/pr_square_iphone/&quot; rel=&quot;nofollow noreferrer&quot;&gt;iPhone magnetic strip card reader&lt;/a&gt;. This is what the magnetisation on the card looks like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sujgQ.gif&quot; alt=&quot;enter image description here&quot; /&gt;&lt;br&gt;&#xA;&lt;sub&gt;&lt;a href=&quot;http://www.eetimes.com/design/communications-design/4200127/Building-a-reliable-magnetic-card-reader-Part-1-of-2-&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://minus.com/mk2YL2iPr#&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here is the .WAV&lt;/a&gt; the iPhone receives when you swipe a card (don't get your hopes up too much, it is a bonus loyalty card ;)). That's three swipes by the way, at different speeds. &lt;a href=&quot;http://minus.com/m7gHBNEW7#&quot; rel=&quot;nofollow noreferrer&quot;&gt;This is the raw SInt16 dump&lt;/a&gt; for the swipe I am using.&lt;/p&gt;&#xA;&lt;p&gt;Someone seems to have done it &lt;a href=&quot;http://cosmodro.me/blog/2011/mar/25/rhombus-square-iskewedi/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;  but the actual data I capture isn't particularly easy to process.&lt;/p&gt;&#xA;&lt;p&gt;The reading starts (and finishes) with an indeterminate number of 'zeros ' --  note that the wave only repeats after 2 ZEROS have been collected, this represents N-S followed by S-N:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QCmsN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;(note that each of the three lines represents me swiping a different card; the bottom card in this image is 15 years old, so the magnetic field is clearly severely degraded in some places, not visible in this shot)&lt;/p&gt;&#xA;&lt;p&gt;This will allow an algorithm to ascertain a clock tick.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The magnetic field reverses on each clock tick.  &lt;em&gt;Also for a binary 1, the magnetic field reverses exactly in the middle of a tick:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KQQ0L.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The sequence always starts with a 1101+0(parity bit) start sentinel.   You can pick this out in all three readings in the above graph.   It is indicated more clearly in the cosmodro article I linked at the top of the question.&lt;/p&gt;&#xA;&lt;p&gt;Here is an example of magnetic degradation (taken further along on the bottom card reading):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Kbury.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am trying to figure out a sensible way to convert this waveform into its corresponding binary sequence.&lt;/p&gt;&#xA;&lt;p&gt;I have found &lt;a href=&quot;http://www.silabs.com/Support%20Documents/TechnicalDocs/AN148.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;one PDF&lt;/a&gt; that goes into some detail,  but I can't figure out the algorithm they are using.&lt;/p&gt;&#xA;&lt;p&gt;This PDF contains one interesting image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/XEgKf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;If I could extract the red and blue lines as per this diagram,  I could use either one of them to extract the data, but I can't figure out the logic behind the construction.&lt;/p&gt;&#xA;&lt;p&gt;So this is my question: &lt;strong&gt;How do I extract the binary sequence?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;PS.  Note that the swipe speed is not going to be constant. So once the clock has been determined, in needs to be constantly adjusted from one tick to the next.&lt;/p&gt;&#xA;&lt;p&gt;PPS.  Would autocorrelation catch &lt;em&gt;pairs&lt;/em&gt; of ticks?  (seeing as ticks will alternate N-S S-N ... )&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;EDIT (June '12): I needed a lot of help on this one, but finally I have completed a solid reader.  Thanks for everyone who helped!  I recommend #musicdsp on IRC's efnet channel for anyone dedicated enough to take the challenge of getting to grips with the maths -- it's really really hard!&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2022-08-06T10:25:25.963" LastActivityDate="2022-08-06T10:28:53.613" Title="Extracting Binary Magnetic-Strip Card Data from raw WAV" Tags="|digital-communications|demodulation|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="716" PostTypeId="2" ParentId="710" CreationDate="2011-11-27T17:03:46.403" Score="13" Body="&lt;p&gt;The concept of space as used in the statement ascribed to Wikipedia is presumably that of the &lt;em&gt;ensemble&lt;/em&gt; of all possible signals, not space as in &quot;Space: the final frontier...&quot;.  In the absence of parallel universes in which different signals from the ensemble can be observed simultaneously, it is rare for engineers to &lt;em&gt;determine&lt;/em&gt; that a signal is ergodic by comparing time averages to ensemble averages.  More commonly, signals are &lt;em&gt;assumed&lt;/em&gt; to be ergodic so that the values of time averages can be used as estimates of ensemble averages.  For example, an engineer takes $1000$ samples of a stochastic signal and plots a histogram of values.  This looks vaguely bell-shaped and so the signal is modeled as a Gaussian random process whose mean is the mean of the $1000$ samples etc.  Ultimately, the proof of the pudding is in the eating.  If this Gaussian model leads to predictions that differ wildly from observed results, the assumption of ergodicity might be discarded, or maybe $10,000$ samples, or $100,000$ samples might be tried (for example, predicting traffic at $5:30$ pm based on observations of traffic between $2:00$ am and $3:00$ am is rarely accurate, but &#xA;observations over several weeks might lead to a better model). &lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2011-11-27T17:03:46.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="717" PostTypeId="2" ParentId="679" CreationDate="2011-11-28T05:34:34.020" Score="2" Body="&lt;p&gt;I would add @mirror2image description on the alternative solution beside RANSAC, you may consider ICP algorithm (iterative closest point), a description can be found &lt;a href=&quot;http://www.cs.technion.ac.il/~cs236329/tutorials/ICP.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the next challenge in using this ICP is to define your own cost function, and the starting pose of the target plane with respect to the 3d cloud point data. Some practical approach is to introduce some random noise in the data during the iteration to avoid converging to the false minima. This is the heuristic part I guess you need to design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps in simplified form is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the closest point for each input point.&lt;/li&gt;&#xA;&lt;li&gt;Compute the transform from the input to the target, and then move the input points using the transform.&lt;/li&gt;&#xA;&lt;li&gt;Compute the similarity function (e.g. the distance for each input point w.r.t to its corresponding pair target point).&lt;/li&gt;&#xA;&lt;li&gt;Check the stopping condition.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Iterate the step 1-4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is available library that you can consider &lt;a href=&quot;http://pointclouds.org/documentation/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;! (I have not tried it yet), there is one section on the registration part (including other methods).&lt;/p&gt;&#xA;" OwnerUserId="600" LastEditorUserId="600" LastEditDate="2011-11-29T01:50:53.827" LastActivityDate="2011-11-29T01:50:53.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="718" PostTypeId="1" CreationDate="2011-11-28T07:13:15.060" Score="4" ViewCount="195" Body="&lt;p&gt;I'm trying to apply a decay envelope to a sinusoidal waveform using Verilog. Hardware constraints prevent use of multiplication to simply multiply by the envelope. The sine values and envelope values, for which I'm simply using $1-e^{-x}$, are stored in ROMs to speed everything up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm simply calculating the output sample by subtracting the exponential value from the sine value if the sine value is larger. If the exponential value is larger than the sine value, the output sample is zero. This works pretty well, but the current exponential value to subtract needs to be modulated by the current location on the sine wave so that the full value is subtracted when the sine is maximum and zero is subtracted when the sine is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd appreciate any advice that anyone can give and I can provide more details if required. &lt;/p&gt;&#xA;" OwnerUserId="604" OwnerDisplayName="user1068795" LastEditorUserId="90" LastEditDate="2011-11-28T13:41:09.873" LastActivityDate="2011-11-29T04:04:31.713" Title="Apply decay envelope to waveform without multiplication" Tags="|hardware-implementation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="719" PostTypeId="2" ParentId="718" CreationDate="2011-11-28T13:56:46.877" Score="3" Body="&lt;p&gt;There are other methods if you can't support direct hardware multiplication, but you're going to have to sacrifice something. For instance, if you have multiple clock cycles to spare, you could use an iterative approach. C-like pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;accum = 0&#xA;for (i = 0; i &amp;lt; LENGTH(envelope); ++i)&#xA;{&#xA;    if (((envelope &amp;gt;&amp;gt; i) &amp;amp; 0x1) == 0) accum += signal &amp;gt;&amp;gt; (i + 1)&#xA;}&#xA;// &quot;accum&quot; now holds the multiplication result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Translating the above functionality to Verilog is an exercise left to the interested reader (it's been a while since I've written in that language). This scheme essentially performs long base-2 multiplication using additions and shifts. For each bit that is set in the envelope scaling factor, an appropriately-right-shifted version of the signal sample is added to the accumulator. The result of the multiplication is held in the accumulator after the loop is complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said, this isn't the most efficient approach in the world; it's probable that a good synthesis tool would come up with something better even on a device without hardware multipliers. This method trades resource usage for latency in the form of extra clock cycles required to perform the iterations of the unrolled multiply. I'm left to wonder what drives the no-multiplication constraint in your application. Could you add more details on that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You may need to tweak the amount of extra shift that you apply to the signal when adding to the accumulator based on the numeric format of &lt;code&gt;accum&lt;/code&gt; and &lt;code&gt;signal&lt;/code&gt;. If they are both of the same fixed-point format (like Q15), then the above approach should work properly.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-11-28T15:35:14.497" LastActivityDate="2011-11-28T15:35:14.497" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="720" PostTypeId="2" ParentId="715" CreationDate="2011-11-28T16:01:15.367" Score="10" Body="&lt;p&gt;This is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Biphase_mark_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;biphase mark code&lt;/a&gt;, and you have to focus on the zero-crossings instead of the pulse amplitudes.  You have multiple zero crossings per pulse, though, because of the low-cut filters inherent to the pickup and the phone's mic input.  Yours drop farther than this between transitions, and cross zero:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1v8j1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could restore a more pulsy shape by using a low-boost filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oAwhU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then measure the pulse lengths by how long they spend above some threshold.  Maybe a better idea is to differentiate the input to make the transitions into large spikes, take the absolute value, and detect them when they go above some threshold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iGFNj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then measure the time between pulses, and when the time between two pulses is approximately the same as the last two pulses, it's a 0, when it's approximately half of what it was between the last two pulses, it's a 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnetic degradation you talk about should be easy to remove with a low-pass filter.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2011-11-28T16:01:15.367" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="721" PostTypeId="2" ParentId="710" CreationDate="2011-11-28T17:17:34.613" Score="5" Body="&lt;p&gt;A good example of a non-ergodic system is a pool table (or similarly ray tracing in a rectangular environment). A large number of balls (or rays) see a random set of reflection angles (according to a &quot;diffuse&quot; distribution), however every single ball only sees the same angle of reflection again and again during its entire path. Let's say the energy abortion at every bounce is a function of angle of incidence. In an ergodic system (for a decent number of bounces) you could simply use the absorption at an &quot;average&quot; angle and multiply with the number of bounces. However, since this is non-ergodic, you'd get the wrong result. You will have to calculate the absorption based on the specific angle for each ball.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2011-11-28T17:17:34.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="722" PostTypeId="2" ParentId="715" CreationDate="2011-11-28T19:39:13.087" Score="5" Body="&lt;p&gt;This was quite a challenge.  I tried at least four approaches before cracking it.  This is how I did it:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NCY6R.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I start by smoothing the data (&lt;em&gt;&lt;strong&gt;first reading&lt;/strong&gt;&lt;/em&gt;) with a simple...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;x_new = 0.9 * x_prev + 0.1 * x_in&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;... IIR filter.  I do this in both directions (&lt;em&gt;&lt;strong&gt;second reading&lt;/strong&gt;&lt;/em&gt;).  This gets rid of all the fuzzy noise, however it creates discontinuities which come back with a vengeance in the derivatives.&lt;/p&gt;&#xA;&lt;p&gt;I then get all derivatives up to the fourth (&lt;em&gt;&lt;strong&gt;third and fourth readings&lt;/strong&gt;&lt;/em&gt; represent the third and fourth derivative), and create a new function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;g(x) = f'''(x)^2 + k*f''''(x)^2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Why?  because I noticed that by the time we get to the third derivative, what we have is effectively a sinusoid inside an envelope:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nOsGK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;...and everyone knows from high school that:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sin^2 + cos^2=1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n255I.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;and that &lt;em&gt;&lt;strong&gt;sin&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;cos&lt;/strong&gt;&lt;/em&gt; differentiate into each other:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cIVhm.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence the implied envelope can be recovered.&lt;/p&gt;&#xA;&lt;p&gt;Why derivatives 3 and 4?  basically each higher derivative purifies the signal.   That which is sinusoidal remains sinusoidal (just shifts phase 90° so sin-&amp;gt;cos etc) whereas that which isn't falls away.&lt;/p&gt;&#xA;&lt;p&gt;I wanted to use 11 &amp;amp; 12 or something crazy, but the derivatives fall apart quite quickly, 4 is the highest I can get before things go haywire, even then the little derivative lines you see in the picture are heavily smoothed.&lt;/p&gt;&#xA;&lt;p&gt;This produces a wonderful little bump on every flux transition (&lt;em&gt;&lt;strong&gt;fifth reading&lt;/strong&gt;&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Next I walk through the turning points, rejecting duds (&lt;em&gt;&lt;strong&gt;sixth reading&lt;/strong&gt;&lt;/em&gt;)..&lt;/p&gt;&#xA;&lt;p&gt;Finally I walk through the maxima (&lt;em&gt;&lt;strong&gt;seventh reading&lt;/strong&gt;&lt;/em&gt;), evaluating whether each skip is a half step or a whole step, and then reconstruct the binary.&lt;/p&gt;&#xA;&lt;p&gt;Yay!&lt;/p&gt;&#xA;&lt;p&gt;EDIT:&#xA;It is now several months since I completed this project.  the most difficult challenge is to construct some transform that isolates flux transitions; technically speaking, ' retrieving the amplitude envelope '.   this is done by constructing the π/2 phase shift signal from the original (this is also known as quadrature signal).   then E(t)^2 = S(t)^2 + Q(S(t))^2.&lt;/p&gt;&#xA;&lt;p&gt;To get the quadrature signal, I simply did an FFT,  and rotated each bin a quarter turn,  then recombined the modified spectral components.&lt;/p&gt;&#xA;&lt;p&gt;There is a lot of confusing abusive terminology in this field;  keywords are ' analytic signal ', ' Hilbert transform '...  I've avoided using those keywords as different disciplines assign different meanings to them.&lt;/p&gt;&#xA;&lt;p&gt;There is a much smarter way of achieving this amplitude envelope using digital filters, thus avoiding the Fourier transform. This allows the algorithm to run on very low powered microcontrollers.&lt;/p&gt;&#xA;&lt;p&gt;This process produces a waveform that should have a unique bump over each flux transition.&lt;/p&gt;&#xA;&lt;p&gt;Decoding this waveform into a binary sequence is still a nontrivial task.  the complexity and this component is algorithmic rather than mathematical; the difficulty is comparable.&lt;/p&gt;&#xA;&lt;p&gt;All in all this is an extremely difficult problem.   It took me the best part of three months to achieve on their performance algorithm.&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2022-08-06T10:28:53.613" LastActivityDate="2022-08-06T10:28:53.613" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="724" PostTypeId="1" AcceptedAnswerId="725" CreationDate="2011-11-29T10:47:39.753" Score="25" ViewCount="63968" Body="&lt;p&gt;I am new to signal processing and especially to FFT, hence I am not sure if I am doing the correct thing here and I am a bit confused with the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a discrete real function (measurement data) and want to set up a low pass filter on that. The tool of choice is Python with the numpy package. I follow this procedure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;compute the fft of my function&lt;/li&gt;&#xA;&lt;li&gt;cut off high frequencies&lt;/li&gt;&#xA;&lt;li&gt;perform the inverse fft&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is the code that I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;sampling_length = 15.0*60.0 # measured every 15 minutes&#xA;Fs = 1.0/sampling_length&#xA;ls = range(len(data)) # data contains the function&#xA;freq = np.fft.fftfreq(len(data), d = sampling_length)&#xA;fft = np.fft.fft(data)&#xA;x = freq[:len(data)/2] &#xA;for i in range(len(x)):&#xA;if x[i] &amp;gt; 0.005: # cut off all frequencies higher than 0.005&#xA;    fft[i] = 0.0&#xA;    fft[len(data)/2 + i] = 0.0&#xA;inverse = np.fft.ifft(fft)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the correct procedure? The result &lt;code&gt;inverse&lt;/code&gt; contains complex values, that confuses me. &lt;/p&gt;&#xA;" OwnerUserId="607" LastEditorUserId="306" LastEditDate="2012-04-26T11:56:22.340" LastActivityDate="2012-04-26T11:56:22.340" Title="low pass filter and FFT for beginners with Python" Tags="|fft|lowpass-filter|python|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="725" PostTypeId="2" ParentId="724" CreationDate="2011-11-29T13:41:31.693" Score="25" Body="&lt;p&gt;The fact that the result is complex is to be expected. I want to point out a couple things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are applying a brick-wall frequency-domain filter to the data, attempting to zero out all FFT outputs that correspond to a frequency greater than 0.005 Hz, then inverse-transforming to get a time-domain signal again. In order for the result to be real, then the input to the inverse FFT must be &lt;a href=&quot;http://en.wikipedia.org/wiki/Hermitian_symmetry&quot; rel=&quot;noreferrer&quot;&gt;conjugate symmetric&lt;/a&gt;. This means that for a length-$N$ FFT,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = X^*[N-k], k = 1, 2, \ldots , \frac{N}{2} - 1\;\;\;\;\;\;\;(N\;\; even)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = X^*[N-k], k = 1, 2, \ldots , \lfloor \frac{N}{2} \rfloor\;\;\;\;\;\;\;\;(N\;\; odd)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Note that for $N$ even, $X[0]$ and $X[\frac{N}{2}]$ are not equal in general, but they are both real. For odd $N$, $X[0]$ must be real.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I see that you attempted to do something like this in your code above, but it is not quite correct. If you enforce the above condition on the signal that you pass to the inverse FFT, then you should get a real signal out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second point is more of a philosophical one: what you're doing will work, in that it will suppress the frequency-domain content that you don't want. However, this is not typically the way a lowpass filter would be implemented in practice. As I mentioned before, what you're doing is essentially applying a filter that has a brick-wall (i.e. perfectly rectangular) magnitude response. The impulse response of such a filter has a $sinc(x)$ shape. Since multiplication in the frequency domain is equivalent to (in the case of using the DFT, circular) convolution in the time domain, this operation is equivalent to convolving the time domain signal with a $sinc$ function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this a problem? Recall what the $sinc$ function looks like in the time domain (below image shamelessly borrowed from Wikipedia):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qdU3r.png&quot; alt=&quot;plot of the sinc function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $sinc$ function has very broad support in the time domain; it decays very slowly as you move in time away from its main lobe. For many applications, this is not a desirable property; when you convolve a signal with a $sinc$, the effects of the slowly-decaying sidelobes will often be apparent in the time-domain form of the filtered output signal. This sort of effect is often referred to as &lt;a href=&quot;http://en.wikipedia.org/wiki/Ringing_%28signal%29&quot; rel=&quot;noreferrer&quot;&gt;ringing&lt;/a&gt;. If you know what you're doing, there are some instances where this type of filtering might be appropriate, but in the general case, it's not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are more practical means of applying lowpass filters, both in the time and frequency domains. &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response&quot; rel=&quot;noreferrer&quot;&gt;Finite impulse response&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Infinite_impulse_response&quot; rel=&quot;noreferrer&quot;&gt;infinite impulse response&lt;/a&gt; filters can be applied directly using their &lt;a href=&quot;http://en.wikipedia.org/wiki/Difference_equation&quot; rel=&quot;noreferrer&quot;&gt;difference equation&lt;/a&gt; representation. Or, if your filter has a sufficiently-long impulse response, you can often obtain performance benefits using &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution#Fast_convolution_algorithms&quot; rel=&quot;noreferrer&quot;&gt;fast convolution&lt;/a&gt; techniques based on the FFT (applying the filter by multiplying in the frequency domain instead of convolution in the time domain), like the &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap_save&quot; rel=&quot;noreferrer&quot;&gt;overlap-save&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap_add&quot; rel=&quot;noreferrer&quot;&gt;overlap-add&lt;/a&gt; methods.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-29T13:41:31.693" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="726" PostTypeId="1" CreationDate="2011-11-29T03:10:52.230" Score="9" ViewCount="5524" Body="&lt;p&gt;I have an interesting problem that I'm trying to solve. So for example, if we have a black and white image containing two textures (A and B), I'm interested in knowing the pixel values of the boundaries that would completely cover the individual textures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of using cross correlation, which would give me a cluster of the positions, of the template (legends) on the image but is there a way to use that to get the pixel values of the boundaries (these are typically irregular)? Also, is there any other better way of doing this?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A real world example of this would be in detecting the regions of rainfall on a map showing three levels of rainfall in a year. Each level is assigned a texture thats present in the legend, which is used for texture matching on the same image. &lt;/p&gt;&#xA;" OwnerDisplayName="user1070502" LastEditorUserId="77" LastEditDate="2011-11-29T19:33:47.110" LastActivityDate="2012-01-02T03:29:22.750" Title="Texture detection and region properties on an image" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="728" PostTypeId="1" CreationDate="2011-11-29T16:01:05.583" Score="9" ViewCount="3344" Body="&lt;p&gt;Matlab's &lt;code&gt;spectrogram()&lt;/code&gt; function calculates the STFT of a signal. It describes its &lt;code&gt;NFFT&lt;/code&gt; argument as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;S = SPECTROGRAM(X,WINDOW,NOVERLAP,NFFT)&lt;/code&gt; specifies the number of&#xA;     frequency points used to calculate the discrete Fourier transforms.&#xA;     If &lt;code&gt;NFFT&lt;/code&gt; is not specified, the default &lt;code&gt;NFFT&lt;/code&gt; is used.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Am I correct in that &lt;code&gt;NFFT&lt;/code&gt; is a trade-off only between frequency resolution and number of computations? For my offline work, there's no need to save cycles. Is there any maximum limit for &lt;code&gt;NFFT&lt;/code&gt;, imposed e.g. by spectral leakage, or any other problem that I should know about, or can I set that argument to as high as possible?&lt;/p&gt;&#xA;" OwnerUserId="471" LastEditorUserId="90" LastEditDate="2011-11-29T16:38:28.077" LastActivityDate="2011-11-29T16:38:28.077" Title="What is the maximal frequency resolution for Matlab's STFT implementation spectrogram()?" Tags="|resolution|spectrogram|matlab|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="729" PostTypeId="1" CreationDate="2011-11-29T16:09:24.733" Score="6" ViewCount="1596" Body="&lt;p&gt;I'm currently devising a solution for demodulating a DPSK signal in C#. So far I've got a working FFT with phase detection, BUT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now have an issue of aligning the window of the FFT to synchronise with each symbol transmitted on the audio stream - now I've done some manual testing and for a test transmission I rendered, and I have symbols with a window width of 19 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do understand that DPSK is designed to avoid a reference signal for demodulating the input signal but FFT window alignment is still needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the problem is that because this will be potentially used on amateur radio where transmission times are entirely random, the alignment of each symbol will have to be determined. The transmission I rendered has a clock timing header of 1024 symbols, but how can I be sure to get the alignment right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the header is like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 0 1 0 1 0 1 0 etc etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the phase of the sine wave rendered from this bit stream would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, 90 0, 90, 0, 90 etc etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I make sure that the receiver will determine the transmitted phase and not anything like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;15, 105 ,15, 105, etc etc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as this would also introduce spurious phase calculations from the FFT detecting the higher-frequency harmonics due to the jump in phase.&lt;/p&gt;&#xA;" OwnerUserId="610" LastEditorUserId="90" LastEditDate="2011-11-29T16:38:05.347" LastActivityDate="2012-04-16T14:33:39.830" Title="FFT window phase syncronising" Tags="|fft|demodulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="730" PostTypeId="2" ParentId="728" CreationDate="2011-11-29T16:37:11.150" Score="4" Body="&lt;p&gt;The length of the FFT is a tradeoff between frequency and time resolution. Spectrograms are often generated by calculating overlapping FFTs on the signal of interest. If you make the FFT longer, then the effective bandwidth of each output bin becomes smaller, so the resolution along the frequency axis improves. The only limiting factor to the frequency resolution that you can obtain is the total observation time that you have from the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the same time, however, your ability to resolve a feature that is localized in time diminishes. An intuitive way to think about this is to view the FFT as a complex downconversion followed by an integrate-and-dump operation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;X[k] = \sum_{n=0}^{N-1} (x[n] e^{\frac{-j2 \pi n k}{N}})&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Viewing it in this way makes the loss of time resolution more apparent. The product in parentheses shifts $x[n]$ down in frequency by $\frac{2 \pi n k}{N}$, and the resulting signal is integrated over a window of $N$ samples. If there is a feature in $x[n]$ that is only located in a limited time span, then as $N$ becomes larger, more of the overlapped FFTs will contain that time period inside their integration time windows. Therefore, the feature will appear in more rows of the spectrogram image (assuming time is along the Y axis). If you then make a cut down the columns (i.e. the frequency bins) of the spectrogram that the feature is located in, you would notice a broader, smeared out peak. You therefore have a lesser ability to resolve the actual time location of the feature's onset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are also right that increasing the FFT length does require more computations, which might be relevant for real-time applications.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-11-29T16:37:11.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="731" PostTypeId="2" ParentId="370" CreationDate="2011-11-29T21:53:02.173" Score="5" Body="&lt;p&gt;The approach used in melodyne requires 2 separate frequency domain operations. Firstly, polyphonic transcription techniques are used to group frequency components (from a standard frequency transform) of polyphonic audio into note activations. In other words, group harmonic subsets according to most likely note activations. See my response to &quot;Inverse polyphonic chord recognition&quot; post on this forum for references and mathematical models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second operation is that of frequency domain pitch shifting of the harmonic subsets extracted above. I'm not certain but I would almost guarantee that Melodyne uses a phase vocoder approach to achieve this. You can also carry out time stretching using &lt;a href=&quot;http://505606.pbworks.com/f/LaroD99-pvoc.pdf&quot; rel=&quot;nofollow&quot;&gt;this technique&lt;/a&gt;. We use techniques similar to these in Riffstation and they work quite well.    &lt;/p&gt;&#xA;" OwnerUserId="271" LastEditorUserId="6" LastEditDate="2011-11-29T21:56:52.143" LastActivityDate="2011-11-29T21:56:52.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="734" PostTypeId="1" AcceptedAnswerId="744" CreationDate="2011-11-30T16:13:29.657" Score="5" ViewCount="3523" Body="&lt;p&gt;I'm trying to calculate the envelope of an arbitrary spectrum but I'm slightly lost as to the best way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at cepstral enveloping but its very fiddly and I can't seem to get it to give the right results.  I've also tried LPC but again it eems to miss a lot of the minor peaks while enveloping the major peaks perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm beginning to wonder of the best way would be just to run a sliding window across each frequency bin in an FFT returned magnitude spectrum and select the maximum value within that window.  This way I'd simply pull out all the peaks (at whatever granularity I'm after) and then I can simply plot a curve through the resulting points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a correct way to calculate the spectral envelope?&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2011-11-30T22:07:19.520" Title="Calculating a spectral envelope" Tags="|frequency-spectrum|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="735" PostTypeId="2" ParentId="734" CreationDate="2011-11-30T16:36:31.773" Score="6" Body="&lt;p&gt;Cepstral windowing is the most obvious way to extract a spectral envelope, you have a description &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Cepstral_Windowing.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I've looked at cepstral enveloping but its very fiddly and I can't&#xA;  seem to get it to give the right results. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the linked description, try lowering the lowpass &quot;cut-off&quot; sample (nc) until you retain the amount of detail you want. You can get useful implementation examples &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Spectral_Envelope_Cepstral_Windowing.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I've also tried LPC but again it eems to miss a lot of the minor peaks&#xA;  while enveloping the major peaks perfectly.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Isn't that the point of extracting the spectral envelope? By LPC are you referring to the &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Linear_Prediction_Spectral_Envelope.html&quot;&gt;Linear Prediction Spectral Envelope&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="548" LastActivityDate="2011-11-30T16:36:31.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="736" PostTypeId="1" CreationDate="2010-10-29T07:04:47.807" Score="69" ViewCount="128623" Body="&lt;p&gt;I have to do cross correlation of two audio file to prove they are similar.&#xA;I have taken the FFT of the two audio files and have their power spectrum values in separate arrays. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I proceed further to cross-correlate them and prove that they're similar? Is there a better way to do it? Any basic ideas will be helpful for me to learn and apply it.&lt;/p&gt;&#xA;" OwnerDisplayName="Warrior" LastEditorUserId="77" LastEditDate="2011-11-30T18:22:55.303" LastActivityDate="2021-12-20T14:13:04.377" Title="How do I implement cross-correlation to prove two audio files are similar?" Tags="|audio|fft|waveform-similarity|cross-correlation|" AnswerCount="8" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="737" PostTypeId="2" ParentId="736" CreationDate="2010-10-29T08:12:01.010" Score="3" Body="&lt;p&gt;if you are using Matlab try the cross correlate function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;c= xcorr(x,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/xcorr.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's the Matlab documentation:&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;xcorr&lt;/code&gt; estimates the cross-correlation sequence of a random process. Autocorrelation is handled as a special case.&lt;/p&gt;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;c = xcorr(x,y)&lt;/code&gt; returns the cross-correlation sequence in a length 2*N-1 vector, where &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; are length &lt;code&gt;N&lt;/code&gt; vectors (&lt;code&gt;N &amp;gt; 1&lt;/code&gt;). If &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; are not the same length, the shorter vector is zero-padded to the length of the longer vector.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/eqn1263487323.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;correlation http://www.mathworks.com/help/toolbox/signal/ref/eqn1263487323.gif&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="31159" OwnerDisplayName="smashtastic" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2011-11-30T18:16:53.170" CommentCount="1" ContentLicense="CC BY-SA 2.5" />
  <row Id="738" PostTypeId="2" ParentId="736" CreationDate="2010-10-29T08:27:28.250" Score="18" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Correlation_and_dependence&quot; rel=&quot;noreferrer&quot;&gt;Correlation&lt;/a&gt; is a way to express the similarity of two timeseries (audio samples in your case) in one number. It is an adaptation of &lt;a href=&quot;http://en.wikipedia.org/wiki/Covariance&quot; rel=&quot;noreferrer&quot;&gt;covariance&lt;/a&gt; which is implemented as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;period = 1/sampleFrequency;&#xA;covariance=0;&#xA;&#xA;for (iSample = 0; iSample&amp;lt;nSamples; iSample++)&#xA;    covariance += (timeSeries_1(iSample)*timeSeries_2(iSample))/period;&#xA;    //Dividing by `period` might not even be necessary&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The correlation is the normalized version of covariance, which is the covariance divided by the product of the standard deviations of both the time series. The correlation will yield a 0 when there is no correlation (totally not similar) and a 1 for total correlation (totally similar). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can imagine that two sound samples might be similar but are not synchronized. That's where &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross_correlation&quot; rel=&quot;noreferrer&quot;&gt;cross correlation&lt;/a&gt; comes in. You calculate the correlation between the time series where you have one of them shifted by one sample:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (iShift=0; iShift&amp;lt;nSamples; iShift++)&#xA;    xcorr(iShift) = corr(timeSeries_1, timeSeries_2_shifted_one_sample);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then seek out the maximum value in the &lt;code&gt;corr&lt;/code&gt; series and you're done. (or stop if you've found a sufficient correlation) There's slightly more to it of course. You must implement the standard deviation and you must do some memory management and implement the time shifting stuff. If all your audio samples are equal in length, you might do without normalizing the covariance and go ahead and calculate the cross-covariance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A cool relation to &lt;a href=&quot;https://electronics.stackexchange.com/questions/5769/how-to-check-the-fft-results-of-a-sine-wave&quot;&gt;your earlier question&lt;/a&gt;: Fourier analysis is just an adaptation of the cross covariance. Rather than shifting one time series and calculating the covariances with the other signal, you calculate the covariances between one signal and a number of (co)sine waves with different frequencies. It's all based on the same principle.&lt;/p&gt;&#xA;" OwnerDisplayName="bpijls" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2010-10-29T10:58:36.730" CommentCount="2" ContentLicense="CC BY-SA 2.5" />
  <row Id="739" PostTypeId="2" ParentId="736" CreationDate="2010-10-29T15:49:57.497" Score="70" Body="&lt;p&gt;Cross-correlation and convolution are closely related.  In short, to do &lt;em&gt;convolution&lt;/em&gt; with FFTs, you&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;zero-pad the input signals &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; (add zeros to the end of each. The zero padding should fill the vectors until they reach a size of at least &lt;code&gt;N = size(a)+size(b)-1)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;take the FFT of both signals&lt;/li&gt;&#xA;&lt;li&gt;multiply the results together (element-wise multiplication)&lt;/li&gt;&#xA;&lt;li&gt;do the inverse FFT&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;code&gt;conv(a, b) = ifft(fft(a_and_zeros) * fft(b_and_zeros))&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;You need to do the zero-padding because the FFT method is actually &lt;em&gt;circular&lt;/em&gt; cross-correlation, meaning the signal wraps around at the ends.  So you add enough zeros to get rid of the overlap, to simulate a signal that is zero out to infinity.&lt;/p&gt;&#xA;&lt;p&gt;To get &lt;em&gt;cross-correlation&lt;/em&gt; instead of convolution, you either need to time-reverse one of the signals before doing the FFT, or take the complex conjugate of one of the signals after the FFT:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;corr(a, b) = ifft(fft(a_and_zeros) * fft(b_and_zeros[reversed]))&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;corr(a, b) = ifft(fft(a_and_zeros) * conj(fft(b_and_zeros)))&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;whichever is easier with your hardware/software.  For autocorrelation (cross-correlation of a signal with itself), it's better to do the complex conjugate, because then you only need to calculate the FFT once.&lt;/p&gt;&#xA;&lt;p&gt;If the signals are real, you can use real FFTs (RFFT/IRFFT) and save half your computation time by only calculating half of the spectrum.&lt;/p&gt;&#xA;&lt;p&gt;Also you can save computation time by padding to a larger size that the FFT is optimized for (such as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Smooth_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;5-smooth number&lt;/a&gt; for FFTPACK, a &lt;a href=&quot;http://www.fftw.org/fftw2_doc/fftw_3.html#IDX112&quot; rel=&quot;nofollow noreferrer&quot;&gt;~13-smooth number for FFTW&lt;/a&gt;, or a power of 2 for a simple hardware implementation).&lt;/p&gt;&#xA;&lt;p&gt;Here's an example in Python of FFT correlation compared with brute-force correlation:  &lt;a href=&quot;https://stackoverflow.com/a/1768140/125507&quot;&gt;https://stackoverflow.com/a/1768140/125507&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This will give you the cross-correlation function, which is a measure of similarity vs offset.  To get the offset at which the waves are &amp;quot;lined up&amp;quot; with each other, there will be a peak in the correlation function:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://jfk-records.com/NRC_Science/science.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dzOuV.png&quot; alt=&quot;peak in correlation function&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The x value of the peak is the offset, which could be negative or positive.&lt;/p&gt;&#xA;&lt;p&gt;I've only seen this used to find the offset between two waves.  You can get a more precise estimate of the offset (better than the resolution of your samples) by using &lt;a href=&quot;https://ccrma.stanford.edu/%7Ejos/sasp/Quadratic_Interpolation_Spectral_Peaks.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;parabolic/quadratic interpolation&lt;/a&gt; on the peak.&lt;/p&gt;&#xA;&lt;p&gt;To get a similarity value between -1 and 1 (a negative value indicating one of the signals decreases as the other increases) you'd need to scale the amplitude according to the length of the inputs, length of the FFT, your particular FFT implementation's scaling, etc.  The autocorrelation of a wave with itself will give you the value of the maximum possible match.&lt;/p&gt;&#xA;&lt;p&gt;Note that this will only work on waves that have the same shape.  If they've been sampled on different hardware or have some noise added, but otherwise still have the same shape, this comparison will work, but if the wave shape has been changed by filtering or phase shifts, they may sound the same, but won't correlate as well.&lt;/p&gt;&#xA;" OwnerUserId="29" OwnerDisplayName="endolith" LastEditorUserId="7092" LastEditDate="2021-12-20T14:13:04.377" LastActivityDate="2021-12-20T14:13:04.377" CommentCount="15" ContentLicense="CC BY-SA 4.0" />
  <row Id="740" PostTypeId="2" ParentId="736" CreationDate="2010-10-30T05:12:15.817" Score="18" Body="&lt;p&gt;In signal processing the cross-correlation (xcorr in MATLAB) is a convolution operation with one of the two sequences reversed. Since time reversal corresponds to complex conjugation in the frequency domain, you can use the DFT to compute the cross-correlation as follows: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R_xy = ifft(fft(x,N) * conj(fft(y,N)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where N = size(x) + size(y) - 1 (preferably rounded up to a power of 2) is the length of the DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplication of DFTs is equivalent to &lt;em&gt;circular&lt;/em&gt; convolution in time. Zero padding both vectors to length N keeps the circularly shifted components of y from overlapping with x, which makes the result identical to the linear convolution of x and time reversed y.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lag of 1 is a right circular shift of y, while a lag of -1 is a left circular shift. The cross-correlation is simply the sequence of dot products for all lags. Based on standard fft ordering, these will be in an array that can be accessed as follows. Indices 0 through size(x)-1 are the positive lags. Indices N-size(y)+1 to N-1 are the negative lags in reverse order. (In Python the negative lags can be accessed conveniently with negative indices such as R_xy[-1].) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of the zero-padded x and y as N-dimensional vectors. The dot product of x and y for a given lag is &lt;code&gt;|x|*|y|*cos(theta)&lt;/code&gt;. The norms of x and y are constant for circular shifts, so dividing them out leaves just the varying cosine of the angle theta. If x and y (for a given lag) are orthogonal in N-space, the correlation is 0 (i.e. theta = 90 degrees). If they're co-linear, the value is either 1 (positively correlated) or -1 (negatively correlated, i.e. theta = 180 degrees). This leads to the cross-correlation normalized to unity:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R_xy = ifft(fft(x,N) * conj(fft(y,N))) / (norm(x) * norm(y))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This can be made unbiased by recomputing the norms for just the overlapping parts, but then you may as well do the entire computation in the time domain. Also, you'll see different versions of normalization. Instead of being normalized to unity, sometimes the cross-correlation is normalized by M (biased), where M = max(size(x), size(y)), or M-|m| (an unbiased estimate of the mth lag).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For maximum statistical significance the mean (DC bias) should be removed before computing the correlation. This is called the cross-covariance (xcov in MATLAB):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x2 = x - mean(x)&#xA;y2 = y - mean(y)&#xA;phi_xy = ifft(fft(x2,N) * conj(fft(y2,N))) / (norm(x2) * norm(y2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="159" OwnerDisplayName="eryksun" LastActivityDate="2010-10-30T05:31:45.807" CommentCount="3" ContentLicense="CC BY-SA 2.5" />
  <row Id="741" PostTypeId="1" AcceptedAnswerId="745" CreationDate="2011-11-30T20:54:11.180" Score="101" ViewCount="209166" Body="&lt;p&gt;In an answer to a &lt;a href=&quot;https://dsp.stackexchange.com/a/739/59&quot;&gt;previous question&lt;/a&gt;, it was stated that one should&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;zero-pad the input signals (add zeros to the end so that at least half of the wave is &amp;quot;blank&amp;quot;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What's the reason for this?&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="7092" LastEditDate="2023-09-28T19:25:48.547" LastActivityDate="2023-09-28T19:25:48.547" Title="Why should I zero-pad a signal before taking the discrete Fourier transform?" Tags="|fft|discrete-signals|dft|zero-padding|" AnswerCount="6" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="742" PostTypeId="2" ParentId="192" CreationDate="2011-11-30T21:34:14.203" Score="2" Body="&lt;p&gt;I just want to chime in since most of the answers focus on DSP issues. If you don't use a block design system like SynthMaker, you are going to spend a lot of development time in dealing with voice management. If you were writing a VSTi instrument plugin from scratch, the learning curve is much longer than for effect plugins.  You will have to manage each note object, decide what happens when there are 20 notes on if your DSP is only fast enough for 16 voices, respond to pitch bend, portamento, modulation, etc. This is no easy task and that's why I highly recommend starting with Buzz or SynthMaker, and rolling your own when you finally come up against a wall.&lt;/p&gt;&#xA;" OwnerUserId="267" LastActivityDate="2011-11-30T21:34:14.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="743" PostTypeId="2" ParentId="741" CreationDate="2011-11-30T21:51:43.920" Score="7" Body="&lt;p&gt;There can be different reasons for this depending on any processes carried out before and after the Fourier transform. The most common reason is to achieve greater frequency resolution in any resulting transform. That is to say that, the larger the number of samples used in your transform, the narrower the binwidth in the resulting power spectrum. Remember: binwidth = sample_frequency/transform_size (often called window size). You can imagine from this, that as you increase your transform size, binwidth reduces (=better frequency resolution). Zero padding is a way of increasing the transform size without introducing new information to the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why not just take a bigger transform without zero padding? Would that not achieve the same effect? Good question. In many cases you may want to analyze a stream of time domain data, for which you may be using a short time Fourier transform (stft). This involves taking a transform every N samples according to the time resolution you need in order to characterize changes in the frequency spectrum. Here in lies the problem. Too big a window and you will lose time resolution, too small a window and you will lose frequency resolution. The solution then is to take small time domain windows giving you good time resolution and then zero pad them to give you good frequency resolution. Hope this is useful for you &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;I did not explain this well. I should have clarified it better. Referring to a windowed transform, indeed you get no 'actual' greater frequency resolution but for visualisation purposes (reading the power spectrum with the eye) it can provide clearer results. Using the critical sampling rate, each side lobe occupies a single bin, which depending on the graphing technique could be misleading. Zero padding provides an interpolated frequency spectrum which may be more revealing. Additionally, if you are using a simple peak picking method for frequency estimation, the spectral interpolation effect of zero padding will give you a spectral sample closer to the true peak of the main lobe. This link provides some useful diagrams: &lt;a href=&quot;http://www.dsprelated.com/dspbooks/sasp/Practical_Zero_Padding.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.dsprelated.com/dspbooks/sasp/Practical_Zero_Padding.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="271" LastEditorUserId="271" LastEditDate="2011-12-05T18:19:23.317" LastActivityDate="2011-12-05T18:19:23.317" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="744" PostTypeId="2" ParentId="734" CreationDate="2011-11-30T22:07:19.520" Score="5" Body="&lt;p&gt;We use peak picking in the power spectrum followed by parabolic interpolation to get the envelope. As you said, you can set your granularity depending on how many peaks per octave you require. We used it to do formant preservation in speech pitch shifting within a phase vocoder framework.... &lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-11-30T22:07:19.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="745" PostTypeId="2" ParentId="741" CreationDate="2011-11-30T22:43:18.663" Score="107" Body="&lt;p&gt;Zero padding allows one to use a longer FFT, which will produce a longer FFT result vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A longer FFT result has more frequency bins that are more closely spaced in frequency.  But they will be essentially providing the same result as a high quality Sinc interpolation of a shorter non-zero-padded FFT of the original data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might result in a smoother looking spectrum when plotted without further interpolation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although this interpolation won't help with resolving or the resolution of and/or between adjacent or nearby frequencies, it might make it easier to visually resolve the peak of a single isolated frequency that does not have any significant adjacent signals or noise in the spectrum.  Statistically, the higher density of FFT result bins will probably make it more likely that the peak magnitude bin is closer to the frequency of a random isolated input frequency sinusoid, and without further interpolation (parabolic, et.al.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, essentially, zero padding before a DFT/FFT is a computationally efficient method of interpolating a large number of points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero-padding for cross-correlation, auto-correlation, or convolution filtering  is used to not mix convolution results (due to circular convolution).  The full result of a linear convolution is longer than either of the two input vectors.  If you don't provide a place to put the end of this longer convolution result, FFT fast convolution will just mix it in with and cruft up your desired result.  Zero-padding provides a bunch zeros into which to mix the longer result.  And it's far far easier to un-mix something that has only been mixed/summed with a vector of zeros.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2019-07-09T04:21:02.610" LastActivityDate="2019-07-09T04:21:02.610" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="746" PostTypeId="1" CreationDate="2011-12-01T14:25:18.067" Score="0" ViewCount="231" Body="&lt;p&gt;I have binary XDR data file representing radar data. What is XDR data formatting? What is useful for? How to visualize this binary file? Is there any kind of software that converts this data format in any other?&lt;/p&gt;&#xA;" OwnerUserId="618" LastActivityDate="2011-12-01T16:21:46.153" Title="XDR data format" Tags="|image-processing|soft-question|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="747" PostTypeId="2" ParentId="746" CreationDate="2011-12-01T16:21:46.153" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/External_Data_Representation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; says that it is a standard format for serializing data so that it can be shared easily across platforms that might have differing numeric formats or endianness. Whether that's the same XDR as the data that you're holding is anyone's guess. Complex systems like radars often use custom, proprietary formats that you won't find documentation for on the Internet. But, it might be worth giving it a look to see if what you have is actually standard XDR.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-12-01T16:21:46.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="748" PostTypeId="1" AcceptedAnswerId="804" CreationDate="2011-12-01T21:00:28.320" Score="11" ViewCount="871" Body="&lt;p&gt;(This question relates to &lt;a href=&quot;https://dsp.stackexchange.com/questions/715/extracting-binary-magnetic-strip-card-data-from-raw-wav&quot;&gt;Extracting Binary Magnetic-Strip Card Data from raw WAV&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am extracting the binary sequence from the magnetic strip on a credit card.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QwnIy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the signal is degraded clearly in one place.   also there is a minor degradation right on the left of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just using IIR (i.e. $X_{\rm out} = 0.9X_{\rm out_{last}} + 0.1X_{\rm in}$) smooths it, but the resulting signal is not mathematically smooth;  if I differentiate the signal a couple of times the noise comes back with a vengeance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k6YD5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: can I remove the noise in such a way that the derivatives come out clean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Here is a close-up of some damaged waves:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bJOcm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT(2):&lt;/strong&gt;&#xA;A couple of approaches I am considering: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Firstly I could make a taylor approximation of the signal either side of the damaged sector, and blend the approximations together. &lt;/li&gt;&#xA;&lt;li&gt;Secondly I could FFT, remove high-frequency components and reverse FFT. I'm going to try that second approach now...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2016-07-05T21:08:36.227" Title="Removing noise from F2F signal" Tags="|fft|noise|" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="749" PostTypeId="1" CreationDate="2011-12-02T03:29:45.020" Score="2" ViewCount="183" Body="&lt;p&gt;I am starting with an audio signal picked up from the microphone jack of my iPhone, generated by running a standard magnetic strip ATM card through a sensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On an old card, there will be a few degenerate bits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rNwNy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now filtering out this damage is one issue, which I have asked here: &lt;a href=&quot;https://dsp.stackexchange.com/questions/748/removing-noise-from-f2f-signal&quot;&gt;Removing noise from F2F signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how to determine the integrity of a particular section of track?   How could I mark a particular area as being damaged?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I basically need some measure of smoothness for any given sample.  My gut feeling is to work with derivatives.  Taking the derivative amplifies noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't see it clearly. Can anyone?&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2011-12-02T14:28:08.727" Title="Identifying Bad Sectors on magnetic stripe, or noise in signal" Tags="|filters|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="750" PostTypeId="5" CreationDate="2011-12-02T04:43:35.953" Score="0" Body="&lt;p&gt;MATLAB is a rich tool used by many researchers in the signal and image processing areas and many others. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your question also references MATLAB code, it is quite advisable that you use this tag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, please note that if the question is really about &lt;em&gt;&quot;How to do X in MATLAB&quot;&lt;/em&gt; it is likely that the question will get &lt;strong&gt;closed&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If you want &quot;to understand an algorithm because your results are not what you theoretically expect&quot;, explain the complete problem and reasoning and attach the matlab code&lt;/em&gt;; this will be welcome.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="7682" LastEditDate="2014-01-26T18:21:29.210" LastActivityDate="2014-01-26T18:21:29.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="751" PostTypeId="4" CreationDate="2011-12-02T04:43:35.953" Score="0" Body="MATLAB (MATrix LABoratory) is a numerical computing environment and a fourth-generation programming language. Use this tag with care.. see excerpt. " OwnerUserId="609" LastEditorUserId="440" LastEditDate="2012-04-17T08:59:41.917" LastActivityDate="2012-04-17T08:59:41.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="752" PostTypeId="5" CreationDate="2011-12-02T04:46:19.660" Score="0" Body="&lt;p&gt;Most image-processing techniques involve treating the image as a two-dimensional signal and applying standard signal-processing techniques to it. The output of image processing may be either an image or, a set of characteristics or parameters related to the image. Image processing usually refers to digital image processing, but optical and analog image processing also are possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_processing&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T15:38:38.440" LastActivityDate="2011-12-03T15:38:38.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="753" PostTypeId="4" CreationDate="2011-12-02T04:46:19.660" Score="0" Body="In general, image processing is any form of signal processing for which the input is an image, such as a photograph or video frame." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T05:27:15.083" LastActivityDate="2011-12-02T05:27:15.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="754" PostTypeId="5" CreationDate="2011-12-02T04:48:37.360" Score="0" Body="&lt;p&gt;Filtering is a class of signal processing, the defining feature of filters being the complete or partial suppression of some aspect of the signal. Most often, this means removing some frequencies and not others in order to suppress interfering signals and reduce background noise. However, filters do not exclusively act in the frequency domain; especially in the field of image processing. Under image processing, filters also exist in other domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Filter_%28signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T15:46:25.707" LastActivityDate="2011-12-03T15:46:25.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="755" PostTypeId="4" CreationDate="2011-12-02T04:48:37.360" Score="0" Body="In signal processing, a filter is a device or process that transforms a signal by selectively choosing specific frequencies and leaving others with appropriate gain or as it is." OwnerUserId="609" LastEditorUserId="440" LastEditDate="2012-04-12T20:17:17.227" LastActivityDate="2012-04-12T20:17:17.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="756" PostTypeId="5" CreationDate="2011-12-02T04:50:40.320" Score="0" Body="&lt;p&gt;Systems with this property are known as IIR systems or, when dealing with filter systems, as IIR filters. IIR systems have an impulse response function that is non-zero over an infinite length of time. This is in contrast to finite impulse response (FIR) filters, which have fixed-duration impulse responses. The simplest analog IIR filter is an RC filter made up of a single resistor (R) feeding into a node shared with a single capacitor (C). This filter has an exponential impulse response characterized by an RC time constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IIR filters may be implemented as either analog or digital filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Infinite_impulse_response&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T15:58:54.307" LastActivityDate="2011-12-03T15:58:54.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="757" PostTypeId="4" CreationDate="2011-12-02T04:50:40.320" Score="0" Body="Infinite impulse response (IIR) is a property of signal processing systems." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T05:27:33.400" LastActivityDate="2011-12-02T05:27:33.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="758" PostTypeId="5" CreationDate="2011-12-02T04:52:19.273" Score="0" Body="&lt;p&gt;A finite impulse response filter is a type of a signal processing filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which have internal feedback and may continue to respond indefinitely (usually decaying). The impulse response of an Nth-order discrete-time FIR filter (i.e. with a Kronecker delta impulse input) lasts for N+1 samples, and then dies to zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FIR filters can be discrete-time or continuous-time, and digital or analog.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T15:56:08.680" LastActivityDate="2011-12-03T15:56:08.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="759" PostTypeId="4" CreationDate="2011-12-02T04:52:19.273" Score="0" Body="A finite impulse response (FIR) filter is a type of a signal processing filter whose impulse response is of finite duration." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T05:26:57.423" LastActivityDate="2011-12-02T05:26:57.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="760" PostTypeId="5" CreationDate="2011-12-02T04:53:28.600" Score="0" Body="&lt;p&gt;Downsampling is usually done to reduce the data rate or the size of the data. The downsampling factor (commonly denoted by M) is usually an integer or a rational fraction greater than unity. This factor multiplies the sampling time or, equivalently, divides the sampling rate. For example, if compact disc audio at 44,100 Hz is downsampled to 22,050 Hz before broadcasting over FM radio, the bit rate is reduced in half, from 1,411,200 bit/s to 705,600 bit/s, assuming that each sample retains its size of 16 bits. The audio was therefore downsampled by a factor of 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Downsampling&quot; rel=&quot;nofollow&quot;&gt;Downsampling&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T15:53:45.393" LastActivityDate="2011-12-03T15:53:45.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="761" PostTypeId="4" CreationDate="2011-12-02T04:53:28.600" Score="0" Body="In signal processing, downsampling (or &quot;subsampling&quot;) is the process of reducing the sampling rate of a signal." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T05:26:02.857" LastActivityDate="2011-12-02T05:26:02.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="762" PostTypeId="5" CreationDate="2011-12-02T04:54:26.040" Score="0" Body="&lt;p&gt;A common example is the conversion of a sound wave (x(t), a continuous-time signal) to a sequence of samples (x[n], a discrete-time signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sample refers to a value or set of values at a point in time and/or space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sampler is a subsystem or operation that extracts samples, x[n]=x(nT), from a continuous-domain signal. A theoretical ideal sampler produces samples equivalent to the instantaneous value of the continuous-domain signal at specified sampling instances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Sampling_%28signal_processing%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="4346" LastEditDate="2017-09-12T00:44:45.400" LastActivityDate="2017-09-12T00:44:45.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="763" PostTypeId="4" CreationDate="2011-12-02T04:54:26.040" Score="0" Body="In signal processing, sampling is the reduction of a continuous-domain signal to a discrete-domain signal." OwnerUserId="609" LastEditorUserId="4346" LastEditDate="2017-09-12T00:44:52.590" LastActivityDate="2017-09-12T00:44:52.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="764" PostTypeId="5" CreationDate="2011-12-02T06:49:09.443" Score="0" Body="&lt;p&gt;Simply put, the Fourier Transform coverts a time-domain signal to a frequency signal. The composite waveform depends on time, and therefore is called the time domain representation. The frequency spectrum is a function of frequency and is called the frequency domain representation. Each value of the function is a complex number (called complex amplitude) that encodes both a magnitude and phase component. The term &quot;Fourier transform&quot; refers to both the transform operation and to the complex-valued function it produces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:07:00.543" LastActivityDate="2011-12-03T16:07:00.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="765" PostTypeId="4" CreationDate="2011-12-02T06:49:09.443" Score="0" Body="The Fourier transform is a mathematical operation that decomposes a function into its constituent frequencies, known as a frequency spectrum." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T13:49:30.240" LastActivityDate="2011-12-02T13:49:30.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="766" PostTypeId="5" CreationDate="2011-12-02T06:52:55.347" Score="0" Body="&lt;p&gt;Edge detection is a fundamental tool in image processing and computer vision, particularly in the areas of feature detection and feature extraction, which aim at identifying points in a digital image at which the image brightness changes sharply or, more formally, has discontinuities. The same problem of finding discontinuities in 1D signals is known as step detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Edge_detection&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:05:45.287" LastActivityDate="2011-12-03T16:05:45.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="767" PostTypeId="4" CreationDate="2011-12-02T06:52:55.347" Score="0" Body="Edge detection is the process of identifying points in an image, where image brightness changes sharply." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T13:49:23.113" LastActivityDate="2011-12-02T13:49:23.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="768" PostTypeId="1" CreationDate="2011-12-02T07:36:59.183" Score="7" ViewCount="250" Body="&lt;p&gt;A problem in computer vision and 3d reconstruction is getting the camera's intrinsics  parameters. A common solution is to use an object in which one knows the measurements of the shape before hand, such as a checker board. The issue with this method is that it must be done every time the camera parameter's change such as focal length and magnification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to implement the camera self-calibration discussed in &lt;a href=&quot;ftp://svr-ftp.eng.cam.ac.uk/pub/reports/mendonca_self-calibration.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Simple Technique for Self-Calibration&lt;/a&gt;. The essential matrix is constrained by its two singular values. This can be used to recover the camera's intrinsics without doing a manual calibration (i.e., with a checkerboard). I am a little confused by how the cost function can be minimized. Here's what I understand so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;essential matrix&#xA;$$E=K_2^TFK_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;intrinsic matrix&#xA;$$K=\begin{bmatrix}\alpha_x &amp;amp; s &amp;amp; u_0 \\ 0 &amp;amp; \epsilon\alpha_x &amp;amp; v_0 \\ 0 &amp;amp; 0 &amp;amp; 1\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\alpha_x$ product of focal length and magnification factor [solve]&lt;/li&gt;&#xA;&lt;li&gt;$\epsilon$ aspect ratio [assume provided, I guess from camera or EXIF data?]&lt;/li&gt;&#xA;&lt;li&gt;$u_0 v_0$ are the coordinates of the principal point [assume 0, 0]&lt;/li&gt;&#xA;&lt;li&gt;$s$ skew [assume 0]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;cost function&#xA;$$C(K_i,i=1..n)=\sum_{ij}^n(\sigma1_{ij}-\sigma2_{ij})/\sigma1_{ij}$$&#xA;the $\sigma$s are the singular values of $K_j^TF_{ij}K_j$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question: How is this cost function being minimized?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NqLFe.jpg&quot; alt=&quot;Summary of algorithm&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="624" LastEditorUserId="7338" LastEditDate="2017-05-30T09:40:37.840" LastActivityDate="2017-05-30T09:40:37.840" Title="Minimization of Essential matrix" Tags="|computer-vision|3d|reconstruction|stereo-vision|geometry|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="769" PostTypeId="5" CreationDate="2011-12-02T08:27:01.137" Score="0" Body="&lt;p&gt;Discrete signal is a type series that is a function over a domain of discrete integral.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike a continuous-time signal, a discrete-time signal is a function of a continuous argument. However, it may have been obtained by sampling a continuous-time signal, and then each value in the sequence is called a sample. When a discrete-time signal obtained by sampling is a sequence corresponding to uniformly spaced times, it has an associated sampling rate; the sampling rate is not apparent in the data sequence, and so needs to be associated as a separate data item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_signal&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:04:40.470" LastActivityDate="2011-12-03T16:04:40.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="770" PostTypeId="4" CreationDate="2011-12-02T08:27:01.137" Score="0" Body="A discrete signal or discrete-time signal is a time series consisting of a sequence of quantities." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T13:49:14.797" LastActivityDate="2011-12-02T13:49:14.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="771" PostTypeId="5" CreationDate="2011-12-02T08:28:18.927" Score="0" Body="&lt;p&gt;The frequency spectrum can be generated via a Fourier transform of the signal, and the resulting values are usually presented as amplitude and phase, both plotted versus frequency.&lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_spectrum&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any signal that can be represented as an amplitude that varies with time has a corresponding frequency spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_spectrum&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:07:48.590" LastActivityDate="2011-12-03T16:07:48.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="772" PostTypeId="4" CreationDate="2011-12-02T08:28:18.927" Score="0" Body="The frequency spectrum of a time-domain signal is a representation of that signal in the frequency domain." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T13:49:33.610" LastActivityDate="2011-12-02T13:49:33.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="773" PostTypeId="5" CreationDate="2011-12-02T08:29:57.770" Score="0" Body="&lt;p&gt;It also refers to the distortion or artifact that results when the signal reconstructed from samples is different from the original continuous signal. When a digital image is viewed, a reconstruction—also known as an interpolation—is performed by a display or printer device, and by the eyes and the brain. If the resolution is too low, the reconstructed image will differ from the original image, and an alias is seen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:03:34.607" LastActivityDate="2011-12-03T16:03:34.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="774" PostTypeId="4" CreationDate="2011-12-02T08:29:57.770" Score="0" Body="In signal processing and related disciplines, aliasing refers to an effect that causes different signals to become indistinguishable (or aliases of one another) when sampled." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T13:48:50.490" LastActivityDate="2011-12-02T13:48:50.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="775" PostTypeId="5" CreationDate="2011-12-02T09:10:57.547" Score="0" Body="&lt;p&gt;A wavelet can typically be visualized as a &quot;brief oscillation&quot; like one might see recorded by a seismograph or heart monitor. Generally, wavelets are purposefully crafted to have specific properties that make them useful for signal processing. Wavelets can be combined, using a &quot;revert, shift, multiply and sum&quot; technique called convolution, with portions of an unknown signal to extract information from the unknown signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://en.wikipedia.org/wiki/Wavelet&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://bookre.org/reader?file=445505&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bultheel A., &quot;Wavelets, with applications in signal and image processing&quot;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://en.bookfi.org/book/1321316&quot; rel=&quot;nofollow noreferrer&quot;&gt;S. Allen Broughton, Kurt Bryan, &quot;Discrete Fourier analysis and wavelets: applications to signal and image processing&quot;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1568810725&quot; rel=&quot;nofollow noreferrer&quot;&gt;Barbara Burke Hubbard, &quot;The World According to Wavelets: The Story of a Mathematical Technique in the Making, Second Edition&quot;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="609" LastEditorUserId="17850" LastEditDate="2017-08-27T16:17:43.047" LastActivityDate="2017-08-27T16:17:43.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="776" PostTypeId="4" CreationDate="2011-12-02T09:10:57.547" Score="0" Body="A wavelet is a wave-like oscillation with an amplitude that starts out at zero, increases, and then decreases back to zero." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T13:49:38.463" LastActivityDate="2011-12-02T13:49:38.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="777" PostTypeId="5" CreationDate="2011-12-02T09:14:16.527" Score="0" Body="&lt;p&gt;The filter design process can be described as an optimization problem where each requirement contributes with a term to an error function which should be minimized. Certain parts of the design process can be automated, but normally an experienced electrical engineer is needed to get a good result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Filter_design&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T15:47:46.330" LastActivityDate="2011-12-03T15:47:46.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="778" PostTypeId="4" CreationDate="2011-12-02T09:14:16.527" Score="0" Body="Fiter design is the process of designing a filter." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T13:49:25.983" LastActivityDate="2011-12-02T13:49:25.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="779" PostTypeId="2" ParentId="749" CreationDate="2011-12-02T14:28:08.727" Score="3" Body="&lt;p&gt;Typically you wouldn't directly use time-domain samples of a signal to declare its integrity (or lack thereof). I'm not familiar with the magnetic-stripe specification, but in most systems, any encoded data is protected by some form of checksum. This checksum is usually located in the same stream of symbols as the data of interest. Many systems also include error-correction coding, to provide tolerance to some number of symbol errors while still being able to recover the encoded information successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the signal has been demodulated and you have recovered the symbol stream, you would calculate the checksum of the recovered data and compare it to the checksum that you read from the medium itself. If they match, then you can assume that the data is correct. If they do not, then you can try re-reading the medium again, or after some number of tries, you might declare it as a bad or damaged region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all begs the question, though: what is your goal of marking these regions as damaged? What will you subsequently do with the damaged areas?&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-12-02T14:28:08.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="781" PostTypeId="5" CreationDate="2011-12-02T15:40:45.743" Score="0" Body="&lt;p&gt;Noise is data that is not being used to transmit a signal, but is simply produced as an unwanted by-product of other activities. &quot;Signal-to-noise ratio&quot; is sometimes used to refer to the ratio of useful to irrelevant information in an exchange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Noise&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:10:46.647" LastActivityDate="2011-12-03T16:10:46.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="782" PostTypeId="4" CreationDate="2011-12-02T15:40:45.743" Score="0" Body="In signal processing noise can be considered random unwanted data without meaning." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T16:13:11.950" LastActivityDate="2011-12-02T16:13:11.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="783" PostTypeId="5" CreationDate="2011-12-02T15:52:30.667" Score="0" Body="&lt;p&gt;Resolution applies to raster digital images, film images, and other types of images. Higher resolution means more image detail. Basically, resolution quantifies how close lines can be to each other and still be visibly resolved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_resolution&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:11:38.893" LastActivityDate="2011-12-03T16:11:38.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="784" PostTypeId="4" CreationDate="2011-12-02T15:52:30.667" Score="0" Body="Resolution is a term used in Image Processing. It is an umbrella term that describes the detail an image holds." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T16:13:15.930" LastActivityDate="2011-12-02T16:13:15.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="785" PostTypeId="5" CreationDate="2011-12-02T16:00:08.400" Score="0" Body="&lt;p&gt;The frequency spectrum of a time-domain signal is a representation of that signal in the frequency domain. The frequency spectrum can be generated via a Fourier transform of the signal, and the resulting values are usually presented as amplitude and phase, both plotted versus frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_spectrum&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:13:37.687" LastActivityDate="2011-12-03T16:13:37.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="786" PostTypeId="4" CreationDate="2011-12-02T16:00:08.400" Score="0" Body="Spectrum is the range of frequencies in terms of signal processing." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T16:13:19.703" LastActivityDate="2011-12-02T16:13:19.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="787" PostTypeId="5" CreationDate="2011-12-02T16:02:04.920" Score="0" Body="&lt;p&gt;An impulse response refers to the reaction of any dynamic system in response to some external change. In either cases, the impulse response describes the reaction of the system as a function of time (or possibly as a function of some other independent variable that parameterizes the dynamic behavior of the system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Impulse_response&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:09:58.927" LastActivityDate="2011-12-03T16:09:58.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="788" PostTypeId="4" CreationDate="2011-12-02T16:02:04.920" Score="0" Body="The impulse response of a dynamic system is its output when presented with a brief input signal, called an impulse." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T16:13:08.597" LastActivityDate="2011-12-02T16:13:08.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="789" PostTypeId="5" CreationDate="2011-12-02T16:04:01.037" Score="0" Body="&lt;p&gt;Informally, it is the similarity between observations as a function of the time separation between them. It is a mathematical tool for finding repeating patterns, such as the presence of a periodic signal which has been buried under noise, or identifying the missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in signal processing for analyzing functions or series of values, such as time domain signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:09:20.067" LastActivityDate="2011-12-03T16:09:20.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="790" PostTypeId="4" CreationDate="2011-12-02T16:04:01.037" Score="0" Body="Autocorrelation is the cross-correlation of a signal with itself." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T16:13:07.037" LastActivityDate="2011-12-02T16:13:07.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="791" PostTypeId="5" CreationDate="2011-12-02T17:48:59.290" Score="0" Body="" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:35:06.183" LastActivityDate="2011-12-03T16:35:06.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="792" PostTypeId="4" CreationDate="2011-12-02T17:48:59.290" Score="0" Body="Preprocessing is a relative term that usually refers to simpler operations applied to improve the operation of a more complex algorithm." OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:40:58.480" LastActivityDate="2011-12-03T16:40:58.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="793" PostTypeId="5" CreationDate="2011-12-02T17:51:06.743" Score="0" Body="&lt;p&gt;The actual amount of attenuation (reduction of amplitude) for each frequency varies from filter to filter. It is sometimes called a high-cut filter, or treble cut filter when used in audio applications. Low-pass filters exist in many different forms, including electronic circuits (such as a hiss filter used in audio), anti-aliasing filters for conditioning signals prior to analog-to-digital conversion, digital filters for smoothing sets of data, acoustic barriers, blurring of images, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Low-pass_filter&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:17:38.927" LastActivityDate="2011-12-03T16:17:38.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="794" PostTypeId="4" CreationDate="2011-12-02T17:51:06.743" Score="0" Body="A low-pass filter is an electronic filter that passes low-frequency signals but attenuates signals with frequencies higher than the cutoff frequency." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T18:50:09.257" LastActivityDate="2011-12-02T18:50:09.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="795" PostTypeId="5" CreationDate="2011-12-02T17:57:18.853" Score="0" Body="&lt;p&gt;Usually, it is required to interpolate (i.e. estimate) the value of that function for an intermediate value of the independent variable. This may be achieved by curve fitting or regression analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Interpolation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:16:31.347" LastActivityDate="2011-12-03T16:16:31.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="796" PostTypeId="4" CreationDate="2011-12-02T17:57:18.853" Score="0" Body="Interpolation is a method of constructing new data points within the range of a discrete set of known data points." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T18:50:05.747" LastActivityDate="2011-12-02T18:50:05.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="797" PostTypeId="5" CreationDate="2011-12-02T18:00:53.540" Score="0" Body="&lt;p&gt;The frequency of a signal is identified by calculating the number of a repeating event (a cycle in case of a signal) is accomplished by counting the number of times that event occurs within a specific time period, then dividing the count by the length of the time period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_domain&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:15:27.637" LastActivityDate="2011-12-03T16:15:27.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="798" PostTypeId="4" CreationDate="2011-12-02T18:00:53.540" Score="0" Body="Frequency in signal processing is the number of cycles (of the signal) per second." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T18:50:02.267" LastActivityDate="2011-12-02T18:50:02.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="799" PostTypeId="5" CreationDate="2011-12-02T18:14:33.717" Score="0" Body="&lt;p&gt;The three key parameters of a periodic waveform are its amplitude (&quot;volume&quot;), its phase (&quot;timing&quot;) and its frequency (&quot;pitch&quot;). Any of these properties can be modified in accordance with a low frequency signal to obtain the modulated signal. Typically a high-frequency sinusoid waveform is used as carrier signal, but a square wave pulse train may also be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Modulation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:18:15.070" LastActivityDate="2011-12-03T16:18:15.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="800" PostTypeId="4" CreationDate="2011-12-02T18:14:33.717" Score="0" Body="Modulation is the process of varying one or more properties of a high-frequency periodic waveform, called the carrier signal, with the amplitude of low-frequence modulating signal which typically contains information to be transmitted." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T18:50:12.733" LastActivityDate="2011-12-02T18:50:12.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="801" PostTypeId="5" CreationDate="2011-12-02T18:15:56.333" Score="0" Body="&lt;p&gt;A demodulator is an electronic circuit (or computer program in a software defined radio) that is used to recover the information content from the modulated carrier wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Demodulation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T16:14:16.657" LastActivityDate="2011-12-03T16:14:16.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="802" PostTypeId="4" CreationDate="2011-12-02T18:15:56.333" Score="0" Body="Demodulation is the act of extracting the original information-bearing signal from a modulated carrier wave." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-02T18:49:58.787" LastActivityDate="2011-12-02T18:49:58.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="803" PostTypeId="1" AcceptedAnswerId="809" CreationDate="2011-12-02T18:17:52.633" Score="11" ViewCount="446" Body="&lt;p&gt;Pretty simple question - I am trying to figure out what exactly is different between 'de-noising' a signal, and simply filtering it (as we commonly know) to remove noise. Is this a case of lexical overlap or is there something fundamentally different? Why is it called 'de-noising'? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Perhaps crucially, when we talk of filtering a signal to maximize its SNR, we usually mean AWGN in the colloquial context. So is the 'noise' being referred to in de-noising also AWGN, and if so, is de-noising simply a different &lt;em&gt;way&lt;/em&gt; of removing it, or is it a different type of noise (non-gaussian, colored, etc) to begin with? &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2011-12-02T18:25:48.700" LastActivityDate="2011-12-04T16:38:56.090" Title="What is the difference between 'de-noising' and what we commonly know as filtering methods to remove noise?" Tags="|noise|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="804" PostTypeId="2" ParentId="748" CreationDate="2011-12-02T18:28:13.810" Score="1" Body="&lt;p&gt;To remove high-frequency &quot;noise&quot; without removing sharp transitions, you might have to try some sort of non-linear filtering process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A random example might be applying (cross fading to) a median filter only when the distance to the nearest N local maxima (or minima, and beyond some noise threshold) goes under some distance threshold (where this distance, N and the median filter width, are calibrated to the period of the suspected &quot;noise&quot;).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-12-02T18:28:13.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="805" PostTypeId="1" CreationDate="2011-12-02T21:02:38.580" Score="14" ViewCount="577" Body="&lt;p&gt;For what types of filter design problems might genetic or evolutionary algorithms be useful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kinds of genetic or evolutionary algorithms are used for DSP problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I expanded the question to include the larger set of evolutionary algorithms, such as differential evolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-12-03T05:06:22.027" LastActivityDate="2011-12-03T05:06:22.027" Title="Genetic or evolutionary algorithms for filter design?" Tags="|filter-design|adaptive-algorithms|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="807" PostTypeId="2" ParentId="107" CreationDate="2011-12-03T00:17:16.867" Score="2" Body="&lt;p&gt;Check out &lt;a href=&quot;http://srand2.blogspot.com/2010/04/model-reconstruction-from-images.html&quot; rel=&quot;nofollow&quot;&gt;Model Reconstruction from Images&lt;/a&gt; which is a little different from what you're doing but I talk about how to go from images to a 3d model. Also check out &lt;a href=&quot;http://meshlab.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;MeshLab&lt;/a&gt;, it has some reconstruction algorithms that you might be able to feed your data into.&lt;/p&gt;&#xA;" OwnerUserId="624" LastActivityDate="2011-12-03T00:17:16.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="808" PostTypeId="1" AcceptedAnswerId="862" CreationDate="2011-12-03T00:50:37.937" Score="3" ViewCount="3100" Body="&lt;p&gt;Could someone point out the core texts or articles most useful on techniques for the removal of noise from scanned text for OCR applications?&lt;/p&gt;&#xA;" OwnerUserId="629" LastEditorUserId="90" LastEditDate="2011-12-03T01:41:18.960" LastActivityDate="2011-12-05T14:10:47.050" Title="Literature on noise removal in OCR applications" Tags="|image-processing|reference-request|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="809" PostTypeId="2" ParentId="803" CreationDate="2011-12-03T02:17:28.053" Score="9" Body="&lt;p&gt;De-noising is about the goal, and filtering is about the technique you employ. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can obviously de-noise via filtering. For example, if you know that your system cannot transmit frequencies above a certain threshold, you can apply a low-pass filter. However, you can de-noise by other techniques as well, such as by averaging multiple recordings of a signal. Similarly, you can apply filters with other goals than (just) noise reduction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &quot;noise&quot; may not necessarily be additive random noise - depending on your context, non-pertinent signals may be lumped with noise as well, such as the sound of vuvuzelas. &lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2011-12-03T02:17:28.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="810" PostTypeId="2" ParentId="805" CreationDate="2011-12-03T03:56:33.310" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/EH.2001.937956&quot; rel=&quot;noreferrer&quot;&gt;Application of a breeder genetic algorithm for system identification in an adaptive finite impulse response filter&lt;/a&gt;: Used a GA to determine the parameters of an adaptive FIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/ICNNSP.2003.1279314&quot; rel=&quot;noreferrer&quot;&gt;Optimizing the design of IIR filter via genetic algorithm&lt;/a&gt;: Used a GA to determine the parameters for an IIR based on $H_2$ and $H_{\infty}$ criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/ACSSC.1998.751556&quot; rel=&quot;noreferrer&quot;&gt;A genetic algorithm for optimisation of linear phase FIR filter coefficients&lt;/a&gt;: (from the abstract) &quot;The algorithm generates a population of genomes that represents the filter coefficients and compares the amplitude response of each genome to that of the desired amplitude response.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on this, it seems like it was a popular way to generate the coefficients for filters in the late 90's early 2000's, but there doesn't seem to be a lot of recent activity on it in the IEEE pubs.  &lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2011-12-03T03:56:33.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="811" PostTypeId="1" AcceptedAnswerId="1187" CreationDate="2011-12-03T05:11:29.650" Score="41" ViewCount="42488" Body="&lt;p&gt;What would be the ideal way to find the mean and standard deviation of a signal for a real time application.  I'd like to be able to trigger a controller when a signal was more than 3 standard deviation off of the mean for a certain amount of time.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming a dedicated DSP would do this pretty readily, but is there any &quot;shortcut&quot; that may not require something so complicated?&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2016-03-14T13:28:12.557" Title="Determining the mean and standard deviation in real time" Tags="|statistics|real-time|measurement|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="812" PostTypeId="1" AcceptedAnswerId="865" CreationDate="2011-12-03T07:28:52.347" Score="12" ViewCount="4914" Body="&lt;p&gt;I have written a program to perform FastICA on a stereo WAV file using the code on &lt;a href=&quot;http://www.endolith.com/wordpress/2009/11/22/a-simple-fastica-example/&quot;&gt;Python MDP FastICA Example&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the &lt;a href=&quot;http://cnx.org/content/m15712/latest/&quot;&gt;audio examples&lt;/a&gt; I get very good results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I try to do real world recording using two computer mono microphones connected to the stereo mic in of my pc by connecting mic 1 to L channel and mic 2 to R channel. I test by playing some music at the background while I am talking in a quiet room.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, running FastICA does not separate the signals at all. Is it possible that the quality of microphones is too poor? Do I need to do anything to the recorded WAV file (16 bits, signed PCM, 44100Hz) before running FastICA?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can download the recording &lt;a href=&quot;http://dl.dropbox.com/u/3090955/record.wav&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="631" LastEditorUserId="306" LastEditDate="2012-04-26T13:37:38.547" LastActivityDate="2015-12-27T09:16:43.713" Title="Fail to separate sound signals by FastICA on real-world recording" Tags="|ica|python|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="813" PostTypeId="1" AcceptedAnswerId="861" CreationDate="2011-12-03T09:06:22.433" Score="2" ViewCount="121" Body="&lt;p&gt;What are the best filtering techniques for a highly volatility price series with jumps. What needs to be considered in designing new filters for practical finance which are adaptive and highly reactive to jumps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I have seen a filter called &lt;a href=&quot;http://www.jurikres.com/catalog/ms_ama.htm#top&quot; rel=&quot;nofollow&quot;&gt;JMA&lt;/a&gt; which is proprietary. If I want to create a similar filter, what direction should I take?&lt;/p&gt;&#xA;" OwnerUserId="598" LastActivityDate="2011-12-05T13:55:09.147" Title="What are the Elements of Filters for Highly Volatility Price Series with Jumps?" Tags="|filters|filter-design|adaptive-filters|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="814" PostTypeId="5" CreationDate="2011-12-03T09:21:31.827" Score="0" Body="&lt;p&gt;BPSK is the simplest form of Phase Shift Keying. It uses two phases, separated by 180°, and so can also be termed 2-PSK.  It does not particularly matter exactly where the constellation points are positioned, and in this figure they are shown on the real axis, at 0° and 180°. This modulation is the most robust of all the PSKs since it takes the highest level of noise or distortion to make the demodulator reach an incorrect decision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-shift_keying&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T22:12:41.430" LastActivityDate="2011-12-03T22:12:41.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="815" PostTypeId="4" CreationDate="2011-12-03T09:21:31.827" Score="0" Body="BPSK, a mechanism of modulation is expanded Binary Phase Shift Keying." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:25:40.643" LastActivityDate="2011-12-03T15:25:40.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="816" PostTypeId="5" CreationDate="2011-12-03T09:30:49.450" Score="0" Body="&lt;p&gt;Echo cancellation involves first recognizing the originally transmitted signal that re-appears, with some delay, in the transmitted or received signal. Once the echo is recognized, it can be removed by 'subtracting' it from the transmitted or received signal. This technique is generally implemented using a digital signal processor (DSP), but can also be implemented in software. Echo cancellation is done using either echo suppressors or echo cancellers, or in some cases both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Echo_cancellation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T22:24:34.427" LastActivityDate="2011-12-03T22:24:34.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="817" PostTypeId="4" CreationDate="2011-12-03T09:30:49.450" Score="0" Body="The term Echo Cancellation (used mostly in telephony) to describe the process of removing echo from a voice communication in order to improve voice quality (usually on a telephone call)." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:27:55.360" LastActivityDate="2011-12-03T15:27:55.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="818" PostTypeId="5" CreationDate="2011-12-03T09:38:13.270" Score="0" Body="&lt;p&gt;For instance, a function that is constant inside the interval and zero elsewhere is called a rectangular window, which describes the shape of its graphical representation. When another function or a signal (data) is multiplied by a window function, the product is also zero-valued outside the interval: all that is left is the part where they overlap; the &quot;view through the window&quot;. Applications of window functions include spectral analysis, filter design, and beamforming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;Window function&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:38:38.580" LastActivityDate="2011-12-03T15:38:38.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="819" PostTypeId="4" CreationDate="2011-12-03T09:38:13.270" Score="0" Body="In signal processing, a window function is a mathematical function that is zero-valued outside of some chosen interval." OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:29:06.150" LastActivityDate="2011-12-03T15:29:06.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="820" PostTypeId="5" CreationDate="2011-12-03T09:42:07.650" Score="0" Body="&lt;p&gt;Under Digital Communication, the data are represented as an electromagnetic signal, such as an electrical voltage, radiowave, microwave, or infrared signal. The messages are either represented by a sequence of pulses by means of a line code (baseband transmission), or by a limited set of continuously varying wave forms (passband transmission), using a digital modulation method. The passband modulation and corresponding demodulation (also known as detection) is carried out by modem equipment, most commonly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Data_transmission&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T22:18:31.947" LastActivityDate="2011-12-03T22:18:31.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="821" PostTypeId="4" CreationDate="2011-12-03T09:42:07.650" Score="0" Body="Digital Communication is the physical transfer of data (a digital bit stream) over a point-to-point or point-to-multipoint communication channel." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:27:37.700" LastActivityDate="2011-12-03T15:27:37.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="822" PostTypeId="5" CreationDate="2011-12-03T09:44:54.717" Score="0" Body="&lt;p&gt;Audio signals may be synthesized directly, or may originate at a transducer such as a microphone, musical instrument pickup, phonograph cartridge, or tape head. Loudspeakers or headphones convert an electrical audio signal into sound. Digital representations of audio signals exist in a variety of formats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Audio_signal&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T15:48:35.080" LastActivityDate="2011-12-03T15:48:35.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="823" PostTypeId="4" CreationDate="2011-12-03T09:44:54.717" Score="0" Body="Audio, or in terms of signal processing, an audio signal is an analog or digital representation of sound, typically as an electrical voltage." OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:25:13.233" LastActivityDate="2011-12-03T15:25:13.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="824" PostTypeId="5" CreationDate="2011-12-03T09:47:06.680" Score="0" Body="&lt;p&gt;Extrapolation is similar to the process of interpolation, which constructs new points between known points, but the results of extrapolations are often less meaningful, and are subject to greater uncertainty. It may also mean extension of a method, assuming similar methods will be applicable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Extrapolation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T22:25:43.833" LastActivityDate="2011-12-03T22:25:43.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="825" PostTypeId="4" CreationDate="2011-12-03T09:47:06.680" Score="0" Body="Extrapolation is the process of constructing new data points or values of amplitude of a signal." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:28:06.797" LastActivityDate="2011-12-03T15:28:06.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="826" PostTypeId="5" CreationDate="2011-12-03T09:54:24.243" Score="0" Body="&lt;p&gt;Starting from an initial state (of signal) and initial input (signal), the instructions describe a method that, when followed, will proceed through a finite number of well-defined successive states, eventually producing output (signal) and terminating at a final ending state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as randomized algorithms, incorporate random input (signals). The algorithms in signal processing are represented by signal flow diagrams, in which each step is represented by a device (usually represented by a box in the diagram).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Algorithm&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:24:09.163" LastActivityDate="2011-12-03T15:24:09.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="827" PostTypeId="4" CreationDate="2011-12-03T09:54:24.243" Score="0" Body="Algorithm is a method expressed in a finite list of steps of well-defined instructions to process a signal." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:22:30.817" LastActivityDate="2011-12-03T15:22:30.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="828" PostTypeId="5" CreationDate="2011-12-03T10:06:56.203" Score="0" Body="&lt;p&gt;For a microcontroller, program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and other embedded systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Microcontroller&quot; rel=&quot;nofollow&quot;&gt;Microcontroller&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:43:57.437" LastActivityDate="2011-12-03T15:43:57.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="829" PostTypeId="4" CreationDate="2011-12-03T10:06:56.203" Score="0" Body="A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:28:23.223" LastActivityDate="2011-12-03T15:28:23.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="830" PostTypeId="5" CreationDate="2011-12-03T10:14:39.163" Score="0" Body="&lt;p&gt;An analogous example of an electronic band-pass filter is an RLC circuit (a resistor–inductor–capacitor circuit). These filters can also be created by combining a low-pass filter with a high-pass filter whose range overlap for passing frequencies. Bandpass is an adjective that describes a type of filter or filtering process; it is frequently confused with passband, which refers to the actual portion of affected spectrum. Hence, one might say &quot;A dual bandpass filter has two passbands.&quot; A bandpass signal is a signal containing a band of frequencies away from zero frequency, such as a signal that comes out of a bandpass filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Band-pass_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="25557" LastEditDate="2020-04-05T12:34:19.417" LastActivityDate="2020-04-05T12:34:19.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="831" PostTypeId="4" CreationDate="2011-12-03T10:14:39.163" Score="0" Body="A band-pass filter is a device that passes frequencies within a certain range and rejects (attenuates) frequencies outside that range." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:25:17.593" LastActivityDate="2011-12-03T15:25:17.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="832" PostTypeId="5" CreationDate="2011-12-03T10:25:18.910" Score="0" Body="&lt;p&gt;It is commonly used to estimate the power transfer between input and output of a linear system. If the signals are ergodic, and the system function linear, it can be used to estimate the causality between the input and output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Coherence_%28signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T22:13:48.027" LastActivityDate="2011-12-03T22:13:48.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="833" PostTypeId="4" CreationDate="2011-12-03T10:25:18.910" Score="0" Body="Coherence is a stastic to examine the relation between two signals." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:25:48.930" LastActivityDate="2011-12-03T15:25:48.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="834" PostTypeId="5" CreationDate="2011-12-03T10:28:16.910" Score="0" Body="&lt;p&gt;Decimation is a two-step process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Low-pass anti-aliasing filter&lt;/li&gt;&#xA;&lt;li&gt;Downsampling&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;An example of decimation: the frequency of a recorded sound can be raised an octave (in other words, doubled in frequency) by eliminating every other sample without changing the sampling rate. This will result in aliasing if the sound contains overtones whose (doubled) frequency will exceed half the sampling rate. Decimation aliasing can be avoided by eliminating those overtones with a lowpass filter before downsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Decimation_%28signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:28:38.960" LastActivityDate="2011-12-03T15:28:38.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="835" PostTypeId="4" CreationDate="2011-12-03T10:28:16.910" Score="0" Body="Decimation is a technique for reducing the number of samples in a discrete-time signal." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:26:53.063" LastActivityDate="2011-12-03T15:26:53.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="836" PostTypeId="5" CreationDate="2011-12-03T10:36:56.487" Score="0" Body="&lt;p&gt;Transfer functions are commonly used in the analysis of systems such as single-input single-output filters, typically within the fields of signal processing, communication theory, and control theory. The term is often used exclusively to refer to linear, time-invariant systems (LTI), as covered in this article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Transfer_function&quot; rel=&quot;nofollow&quot;&gt;Transfer function&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:39:36.427" LastActivityDate="2011-12-03T15:39:36.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="837" PostTypeId="4" CreationDate="2011-12-03T10:36:56.487" Score="0" Body="Transfer function is a mathematical representation of relationship between input and output (signal) of a linear, time-invariant system." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:28:43.363" LastActivityDate="2011-12-03T15:28:43.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="838" PostTypeId="5" CreationDate="2011-12-03T10:38:38.653" Score="0" Body="&lt;p&gt;In case of a continuous signal, the function's domain is an uncountable set. The function itself need not be continuous. To contrast, a discrete time signal has a countable domain, like the natural numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Continuous_signal&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T22:15:05.013" LastActivityDate="2011-12-03T22:15:05.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="839" PostTypeId="4" CreationDate="2011-12-03T10:38:38.653" Score="0" Body="A continuous signal or a continuous-time signal is a varying quantity (a signal) whose domain, which is often time, is a continuum." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:26:00.987" LastActivityDate="2011-12-03T15:26:00.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="840" PostTypeId="5" CreationDate="2011-12-03T10:47:50.380" Score="0" Body="&lt;p&gt;Correlation is also known as a sliding dot product or sliding inner-product. It is commonly used for searching a long-duration signal for a shorter, known feature. It also has applications in pattern recognition, single particle analysis, electron tomographic averaging, cryptanalysis, and neurophysiology.&#xA;Another variant of correlation could be auto-corelation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="35" LastEditDate="2011-12-03T22:16:05.697" LastActivityDate="2011-12-03T22:16:05.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="841" PostTypeId="4" CreationDate="2011-12-03T10:47:50.380" Score="0" Body="Correlation or Cross-Correlation is a measure of similarity of two waveforms as a function of a time-lag applied to one of them." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:26:19.070" LastActivityDate="2011-12-03T15:26:19.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="842" PostTypeId="5" CreationDate="2011-12-03T10:54:34.870" Score="0" Body="&lt;p&gt;The octave relationship is a natural phenomenon that has been referred to as the &quot;basic miracle of music&quot;, the use of which is &quot;common in most musical systems&quot;. It may be derived from the harmonic series as the interval between the first and second harmonics.&#xA;The octave has occasionally been referred to as a diapason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Octave&quot; rel=&quot;nofollow&quot;&gt;Octave&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:42:49.980" LastActivityDate="2011-12-03T15:42:49.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="843" PostTypeId="4" CreationDate="2011-12-03T10:54:34.870" Score="0" Body="An octave is the interval between one musical pitch and another with half or double its frequency." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:28:34.797" LastActivityDate="2011-12-03T15:28:34.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="844" PostTypeId="1" AcceptedAnswerId="848" CreationDate="2011-12-03T11:18:26.570" Score="6" ViewCount="2914" Body="&lt;p&gt;I remember a result about the cross-correlation function of a stationary signal and that same signal, filtered through a linear time-invariant filter. There might have been an assumption that the signal was Gaussian. What is the cross-correlation function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\left\{ x(t) y(t) \right\} = \,\,\,?$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y(t)$ is the output of an LTI filter with the input $x(t)$.&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2011-12-03T14:32:12.817" Title="What is the cross-correlation of a WSS signal and the LTI filtered signal?" Tags="|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="845" PostTypeId="1" AcceptedAnswerId="846" CreationDate="2011-09-17T04:10:31.723" Score="12" ViewCount="2703" Body="&lt;p&gt;There is a postdoc in my lab whose specialty is &quot;statistical signal processing&quot;. He has a PhD in Electrical Engineering and he analyzes the neural data collected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering what &lt;strong&gt;courses&lt;/strong&gt;/topics I should start studying to follow in his footsteps. I'm not exactly looking for things like statistics and signal processing, I've had basic classes in both but still find it hard to understand his work.&lt;/p&gt;&#xA;" OwnerUserId="1106" OwnerDisplayName="Diego" LastEditorUserId="1106" LastEditDate="2016-09-09T19:49:29.667" LastActivityDate="2017-03-24T05:38:34.937" Title="Introduction to Statistical Signal Processing" Tags="|reference-request|soft-question|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="846" PostTypeId="2" ParentId="845" CreationDate="2011-12-03T04:52:33.583" Score="7" Body="&lt;p&gt;Sometimes there are courses entitled 'statistical signal processing', that's a good place to start :-)   If your university doesn't have this, try looking for 'detection and estimation', or 'advanced signal processing'.  If you don't have a university handy, you could try &lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-432-stochastic-processes-detection-and-estimation-spring-2004/&quot;&gt;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-432-stochastic-processes-detection-and-estimation-spring-2004/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Much statistical signal processing is linear, so you should learn as much linear algebra as you can. Stocastic processes is a foundational course.  Control theory shares much with SSP, and would be very useful.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be enough for a start :-)&lt;/p&gt;&#xA;" OwnerDisplayName="user630" LastActivityDate="2011-12-03T04:52:33.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="848" PostTypeId="2" ParentId="844" CreationDate="2011-12-03T14:32:12.817" Score="10" Body="&lt;p&gt;If the linear system (does not have to be time-invariant) is bounded-input bounded-output (BIBO) stable (meaning that if $|x(t)| \leq M$ for all $t$ for some finite positive &#xA;number $M$, then there is another finite positive number $M^\prime$ such that &#xA;$|y(t)| \leq M^\prime$ for all $t$), then when the input is a finite-variance&#xA;random process (a.k.a. second-order proecess), one can interchange the order of&#xA;the expectation operation and the integration/sum for the convolution.  That is, if&#xA;$$Y(t) = \int_{-\infty}^{\infty} h(s)X(t-s)\,\mathrm ds$$&#xA;where $h(t)$ is the impulse response of the LTI system, then &#xA;$$\begin{align*}&#xD;&#xA;E[Y(t)] &amp;amp;= E\left[\int_{-\infty}^{\infty} h(s)X(t-s)\,\mathrm ds\right ]\\&#xD;&#xA;&amp;amp;= \int_{-\infty}^{\infty} E\left[h(s)X(t-s)\,\mathrm ds\right ]\\&#xD;&#xA;&amp;amp;= \int_{-\infty}^{\infty} h(s)E\left[X(t-s)\right ]\,\mathrm ds\\&#xD;&#xA;\end{align*}&#xD;&#xA;$$&#xA;and so if the input is a WSS process with $E[X(t)] = \mu_X$ for all $t$,&#xA;$$E[Y(t)] = \mu_X\int_{-\infty}^{\infty} h(s)\,\mathrm ds = \mu_Y$$&#xA;is also a constant.  In fact, $\{Y(t)\}$ is also a WSS process.  If we define the crosscorrelation &lt;em&gt;function&lt;/em&gt; $R_{X,Y}(\tau)$ as &#xA;$R_{X,Y}(\tau) = E[X(t-\tau)Y(t)]$, then&#xA;$$\begin{align*}&#xD;&#xA;R_{X,Y}(\tau) &amp;amp;= E\left[X(t-\tau)\int_{-\infty}^{\infty} h(s)X(t-s)\,\mathrm ds\right]\\&#xD;&#xA;&amp;amp;= \int_{-\infty}^{\infty} h(s)E[X(t-\tau)X(t-s)]\,\mathrm ds\\&#xD;&#xA;&amp;amp;= \int_{-\infty}^{\infty} h(s)R_X(\tau-s)\,\mathrm ds.&#xD;&#xA;\end{align*}$$&#xA;In short,&#xA;$$R_{X,Y} = h*R_X.$$&#xA;For completeness, &#xA;$$R_Y = \tilde{h}*h*R_X = (\tilde{h}*h)*R_X = R_h*R_X$$&#xA;where $\tilde{h}(t) = h(-t)$ for all $t$ is the &lt;em&gt;time-reversed&lt;/em&gt; impulse response&#xA;and $R_h = \tilde{h}*h$ is the &lt;em&gt;autocorrelation&lt;/em&gt; function of the &#xA;&lt;em&gt;deterministic&lt;/em&gt; signal $h(t)$.  Translated to the frequency domain, this gives the&#xA;power spectral density relationship&#xA;$$S_Y(f) = |H(f)|^2 S_X(f).$$&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2011-12-03T14:32:12.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="849" PostTypeId="5" CreationDate="2011-12-03T15:42:27.933" Score="0" Body="&lt;p&gt;Frequency response is a measure of magnitude and phase of the output as a function of frequency, in comparison to the input. In simplest terms, if a sine wave is injected into a system at a given frequency, a linear system will respond at that same frequency with a certain magnitude and a certain phase angle relative to the input. Also for a linear system, doubling the amplitude of the input will double the amplitude of the output. In addition, if the system is time-invariant, then the frequency response also will not vary with time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_response&quot; rel=&quot;nofollow&quot;&gt;Frequency response&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-03T15:44:49.560" LastActivityDate="2011-12-03T15:44:49.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="850" PostTypeId="4" CreationDate="2011-12-03T15:42:27.933" Score="0" Body="Frequency response is the quantitative measure of the output spectrum of a system or device in response to a stimulus, and is used to characterize the dynamics of the system." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-03T15:44:10.137" LastActivityDate="2011-12-03T15:44:10.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="851" PostTypeId="2" ParentId="812" CreationDate="2011-12-03T21:55:33.923" Score="6" Body="&lt;p&gt;As I say further down the page:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;it turns out that ICA doesn’t actually work well when the signals occur at different delays in the different sensor channels; it assumes instantaneous mixing (that the signals are in perfect sync with each other in all the different recordings).  Delay &lt;em&gt;would&lt;/em&gt; happen in a real-life situation with performers and microphones, since each source is a different distance from each microphone.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'd guess that this delay between channels is the reason.  If you look closely at the two waves, you will probably see that some sounds occur sooner in one channel than the other, and the rest vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prove that it's not the quality of the microphones, you could try recording two different signals using one microphone at different times, and then mix them together so that some of each signal is in each channel, and see if the ICA works in that case.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2011-12-03T21:55:33.923" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="852" PostTypeId="1" CreationDate="2011-12-04T08:49:01.233" Score="4" ViewCount="379" Body="&lt;p&gt;In some telecommunication systems, scrambling of transmitted data is applied to provide some level of security. For example, the communication system might look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data -&gt; Scrambling -&gt; Compression -&gt; Error correction encoding&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could one possibly match the scrambling with the error-correcting code to obtain some benefit? Why is scrambling typically separated from the other blocks of the transmitter?&lt;/p&gt;&#xA;" OwnerUserId="290" LastEditorUserId="90" LastEditDate="2011-12-07T13:27:04.500" LastActivityDate="2011-12-07T13:27:04.500" Title="Why is privacy scrambling a standalone block in a communications transmitter?" Tags="|digital-communications|modulation|channelcoding|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="853" PostTypeId="1" AcceptedAnswerId="8141" CreationDate="2011-12-04T11:58:48.970" Score="14" ViewCount="3239" Body="&lt;p&gt;In its chapter on Kalman filters, my DSP book states, seemingly out of the blue, that the stationary Kalman filter for a system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{cases} x(t+1) &amp;amp;= Ax(t) + w(t) \\&#xD;&#xA;y(t) &amp;amp;= Cx(t) + v(t)&#xD;&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has the predictor&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{x}(t+1|t) = (A-A\bar{K}C)\hat{x}(t|t-1) + A\bar{K}y(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and stationary state vector covariance and Kalman gain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\bar{P} = A\bar{P}A^T - A\bar{P}C^T ( C\bar{P}C^T + R )^{-1}C\bar{P}A^T + Q$$&#xA;$$\bar{K} = \bar{P}C^T(C\bar{P}C^T+R)^{-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Q$ and $R$ denote the covariances of the input noise $w$ and measurement noise $v$, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see how to arrive at this from the minimum variance predictor. Could someone explain it to me, or point me to a resource that derives the expression? This is the time-variant minimum-variance filter, which I &lt;em&gt;can&lt;/em&gt; derive:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{x}(t+1|t) = (A-K(t)C)\hat{x}(t|t-1) + K(t)y(t)$$&#xA;$$P(t+1|t) = A\left(P(t|t-1)-P(t|t-1)C^T(CP(t|t-1)C^T + R)^{-1}CP(t|t-1)\right)A^T+Q$$&#xA;$$K(t) = AP(t|t-1)C^T(CP(t|t-1)C^T+R)^{-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just unsure about how to go from here to the stationary filter above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I can see that substituting $\bar{P} = P(t+1|t) = P(t|t-1)$ and $K(t)=A\bar{K}$ into the time-variant filter results in the stationary filter, but why multiply with $A$? Is this just a symptom of an unfortunate choice of notation, meaning that either $K$ or $\bar{K}$ doesn't really denote the Kalman gain?&lt;/p&gt;&#xA;" OwnerUserId="471" LastEditorUserId="471" LastEditDate="2011-12-05T15:50:39.427" LastActivityDate="2013-03-11T00:24:28.783" Title="How to derive the stationary Kalman filter predictor?" Tags="|kalman-filters|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="854" PostTypeId="2" ParentId="803" CreationDate="2011-12-04T15:35:46.977" Score="9" Body="&lt;p&gt;Just as a for instance, de-clicking might be considered a part of a de-noising system. Removing clicks comes up in digitizing vinyl audio records - dust that cannot be removed without damaging the substrate can cause an audible click in the digitized audio signal. There are systems that can detect and remove these clicks that use model based estimators to predict the samples that are masked by a click. Linear filters are often used in such systems, but are not sufficient to fully accomplish the masking. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithms run along the lines of, high-pass filter, square and low-pass for an energy detector, find places where high frequencies attack and decay very quickly, fill in those samples with some estimator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot;&gt;Median filters&lt;/a&gt; are another example of noise reduction through something other than a traditional linear filter.&lt;/p&gt;&#xA;" OwnerUserId="275" LastEditorUserId="275" LastEditDate="2011-12-04T16:38:56.090" LastActivityDate="2011-12-04T16:38:56.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="855" PostTypeId="5" CreationDate="2011-12-05T09:14:54.617" Score="0" Body="&lt;p&gt;The images that a camera records and stores mey be still images or moving images such as videos. Cameras may work with the light of the visible spectrum or with other portions of the electromagnetic spectrum.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Camera&quot; rel=&quot;nofollow&quot;&gt;Camera&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-05T14:59:29.803" LastActivityDate="2011-12-05T14:59:29.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="856" PostTypeId="4" CreationDate="2011-12-05T09:14:54.617" Score="0" Body="Camera is a device that records and stores images." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-05T14:58:55.747" LastActivityDate="2011-12-05T14:58:55.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="857" PostTypeId="1" AcceptedAnswerId="867" CreationDate="2011-12-03T20:11:30.430" Score="22" ViewCount="7989" Body="&lt;p&gt;I need to find all the contours in an image retrieved from the camera. So I first use the canny edge detector to find the edges and then find the contours. Pretty simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, my contours get &quot;merged&quot;. For example, in the image below, I clearly have 4 different objects. The edges are &lt;em&gt;slightly&lt;/em&gt; touching at some points though, so I get one big contour instead of four separate ones. I tried changing around the thresholds, eroding, morphology operations and similar things but the edges keep slightly touching. Does anyone have any suggestions on how to get separate contours in images similar to the one below? (The image below is obviously just an example, my actual images are much more complex, but have the same basic problem). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yqDyu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user650" LastEditorUserId="77" LastEditDate="2011-12-08T01:47:49.460" LastActivityDate="2013-11-10T16:43:25.147" Title="How do I detect distinct objects when their edges touch each other?" Tags="|image-processing|edge-detection|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="858" PostTypeId="2" ParentId="857" CreationDate="2011-12-03T22:04:53.820" Score="2" Body="&lt;p&gt;Try pre-processing your images with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Morphological_image_processing&quot; rel=&quot;nofollow&quot;&gt;morphological filter&lt;/a&gt; like &lt;a href=&quot;http://en.wikipedia.org/wiki/Erosion_%28morphology%29&quot; rel=&quot;nofollow&quot;&gt;erosion&lt;/a&gt;. This will allow touching contours to be separated. After detecting your contours, you can apply a &lt;a href=&quot;http://en.wikipedia.org/wiki/Dilation_%28morphology%29&quot; rel=&quot;nofollow&quot;&gt;dilation&lt;/a&gt; operation to complete lattices.&lt;/p&gt;&#xA;" OwnerDisplayName="fmorency" LastActivityDate="2011-12-03T22:04:53.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="859" PostTypeId="2" ParentId="857" CreationDate="2011-12-04T19:59:37.747" Score="2" Body="&lt;p&gt;It's not an answer to your question, but contour analysis is error-prone. You cannot do much about it and it works only on very simple scenarios. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have trouble using it, you should look for a completely different algorithm. There are more complex and more robust ways to solve things, but it depends on what you want to achieve (object detection, tracking, etc...)&lt;/p&gt;&#xA;" OwnerDisplayName="vasile" LastActivityDate="2011-12-04T19:59:37.747" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="861" PostTypeId="2" ParentId="813" CreationDate="2011-12-05T13:55:09.147" Score="3" Body="&lt;p&gt;In case you're looking for an edge-preserving low pass filter, you could have a look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilateral_filter&quot; rel=&quot;nofollow&quot;&gt;bilateral filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementation is fairly straightforward.&lt;/p&gt;&#xA;" OwnerUserId="627" LastActivityDate="2011-12-05T13:55:09.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="862" PostTypeId="2" ParentId="808" CreationDate="2011-12-05T14:03:10.750" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://research.google.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google research&lt;/a&gt; has some excellent papers, see for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://research.google.com/pubs/pub33418.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Overview of the Tesseract OCR Engine&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, it seems that stackoverflow has a similar question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/4180629/ocr-and-image-preprocessing-techniques&quot;&gt;https://stackoverflow.com/questions/4180629/ocr-and-image-preprocessing-techniques&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most powerful image filtering techniques that I'm aware are graph-cuts based, &#xA;which run in the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate a (sparse) distance matrix between pixels (based on their intensity)&lt;/li&gt;&#xA;&lt;li&gt;Spectral Clustering, keep only the lowest 3-8 eigenvectors&lt;/li&gt;&#xA;&lt;li&gt;K-means clustering of the eigenvectors&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="627" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2011-12-05T14:10:47.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="863" PostTypeId="1" CreationDate="2011-12-05T16:33:06.810" Score="9" ViewCount="667" Body="&lt;p&gt;Let's say I have a set of 5 markers. I am trying to find the relative distances between each marker using an augmented reality framework such as &lt;a href=&quot;http://www.hitl.washington.edu/artoolkit/&quot;&gt;ARToolkit&lt;/a&gt;. In my camera feed thee first 20 frames show me the first 2 markers only so I can work out the transformation between the 2 markers. The second 20 frames show me the 2nd and 3rd markers only and so on. The last 20 frames show me the 5th and 1st markers. I want to build up a 3D map of the marker positions of all 5 markers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, knowing that there will be inaccuracies with the distances due to low quality of the video feed, how do I minimise the inaccuracies given all the information I have gathered?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My naive approach would be to use the first marker as a base point, from the first 20 frames take the mean of the transformations and place the 2nd marker and so forth for the 3rd and 4th. For the 5th marker place it inbetween the 4th and 1st by placing it in the middle of the mean of the transformations between the 5th and 1st and the 4th and 5th. This approach I feel has a bias towards the first marker placement though and doesn't take into account the camera seeing more than 2 markers per frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately I want my system to be able to work out the map of x number of markers. In any given frame up to x markers can appear and there are non-systemic errors due to the image quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help regarding the correct approach to this problem would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="639" LastEditorUserId="1473" LastEditDate="2012-06-06T08:42:55.917" LastActivityDate="2017-04-18T20:31:17.703" Title="Accurately measuring relative distance between a set of fiducials (Augmented reality application)" Tags="|computer-vision|augmented-reality|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="864" PostTypeId="1" AcceptedAnswerId="869" CreationDate="2011-12-05T17:46:36.337" Score="9" ViewCount="3165" Body="&lt;p&gt;How would one segment large area's of gray (ranging from white to black) from an image ? (If you know this in opencv, you may answer by saying what you would do in opencv). For example given this picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XdnaW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see that this is a large area of gray and it is clearly distinguishable from the rest. How can you segment this if &lt;strong&gt;this area can have any shade of gray&lt;/strong&gt; and it has to work in real-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thx in advance.&lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="569" LastEditDate="2011-12-10T16:25:19.077" LastActivityDate="2011-12-10T16:25:19.077" Title="Surface detection" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="865" PostTypeId="2" ParentId="812" CreationDate="2011-12-05T18:36:25.717" Score="11" Body="&lt;p&gt;ICA in raw form is only suitable for use with phase synchronised observation mixtures. Using microphones as you have described will introduce a phase delay as pointed out by other posters. However this phase delay can be used to great avail. The best known algorithm that deals with stereo separation in the presence of delays is DUET. The links are broken but the references you are looking for are here &gt;http://eleceng.ucd.ie/~srickard/bss.html. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the paper you should look for &gt; &lt;br&gt;&#xA;A. Jourjine, S. Rickard, and O. Yilmaz, Blind Separation of Disjoint Orthogonal Signals: Demixing N Sources from 2 Mixtures, IEEE Conference on Acoustics, Speech, and Signal Processing (ICASSP2000), Volume 5, Pages 2985-2988, Istanbul, Turkey, June 2000&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-12-05T18:36:25.717" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="866" PostTypeId="1" AcceptedAnswerId="7845" CreationDate="2011-12-05T19:07:03.853" Score="11" ViewCount="497" Body="&lt;p&gt;I just simulated an auto-regressive second-order model fueled by white noise and estimated the parameters with normalized least-mean-square filters of orders 1-4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the first-order filter under-models the system, of course the estimations are weird. The second-order filter finds good estimates, although it has a couple of sharp jumps. This is to be expected from the nature of NLMS filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What confuses me is the third- and fourth-order filters. They seem to eliminate the sharp jumps, as seen in the figure below. I can't see what they would add, as the second-order filter is enough to model the system. The redundant parameters hover around $0$ anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone explain this phenomenon for me, qualitatively? What causes it, and is it desirable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used step size $\mu=0.01$, $10^4$ samples, and the AR model $x(t)=e(t)-0.9x(t-1)-0.2x(t-2)$ where $e(t)$ is white noise with variance 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qbYLJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MATLAB code, for reference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% ar_nlms.m&#xA;function th=ar_nlms(y,order,mu)&#xA;N=length(y);&#xA;th=zeros(order,N); % estimated parameters&#xA;for t=na+1:N&#xA;    phi = -y( t-1:-1:t-na, : );&#xA;    residue = phi*( y(t)-phi'*th(:,t-1) );&#xA;    th(:,t) = th(:,t-1) + (mu/(phi'*phi+eps)) * residue;&#xA;end&#xA;&#xA;% main.m&#xA;y = filter( [1], [1 0.9 0.2], randn(1,10000) )';&#xA;plot( ar_nlms( y, 2, 0.01 )' );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="471" LastEditorUserId="471" LastEditDate="2011-12-05T19:24:46.680" LastActivityDate="2013-03-16T02:41:12.623" Title="Why does over-modelling an adaptive AR NLMS filter fix sharp spikes?" Tags="|adaptive-filters|autoregressive-model|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="867" PostTypeId="2" ParentId="857" CreationDate="2011-12-05T20:23:21.413" Score="12" Body="&lt;h3&gt;Detecting different components:&lt;/h3&gt;&#xA;&lt;p&gt;If you're trying to detect the different components, there probably are other approaches to do them than detecting the contours. Here's an example in Mathematica. An erosion followed by dilation is used to close the gap in the second component before detection (if you don't do this, it won't detect it).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;img = Binarize@Import[&amp;quot;https://i.stack.imgur.com/yqDyu.png&amp;quot;];&#xA;Colorize[MorphologicalComponents[Dilation[Erosion[img,1],1]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The figure on the left below, shows imperfect object detection (without closing the gap) and on the right, shows the correct detection (running the above code).&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h0ZNbm.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Zw3NMm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Detecting the different contours:&lt;/h3&gt;&#xA;&lt;p&gt;However, if you indeed want to separate only the contours, here's an example. The erosion and dilation are performed as before to close the gap and the resulting image is run through a Canny edge detector. I've made the default options explicit, so that you can see what's being used.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;img2 = EdgeDetect[Dilation[Erosion[img, 1], 1], Method -&amp;gt; &amp;quot;Canny&amp;quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will give you both the inside and the outside edge (see figure on the left below), since the pixel width is greater than 1 all around. I haven't had much luck trying to get it thinner, as the performance degrades (may be different for your other images). The inner contours are the ones you want, and the outer contour is just the combined contour of all 4 components. Now all we need to do is drop the outermost one with:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SelectComponents[img2, &amp;quot;EnclosingComponentCount&amp;quot;, # &amp;gt; 0 &amp;amp;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which gives you just the inner contours (see bottom right). In other words, it only picks those contours that are enclosed by at least one other contour, which automatically disqualifies the outermost one. I do not know the equivalent of these commands/operations in openCV.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DQRAYm.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7AFvbm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that the apparent breaks in the figure are due to saving to jpeg in a smaller size. It does not look that way on my screen.&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2011-12-05T21:03:04.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="868" PostTypeId="1" CreationDate="2011-12-06T03:18:05.777" Score="8" ViewCount="7830" Body="&lt;p&gt;What are the best solutions to detect line in a point cloud? Comparison being made with and between &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow&quot;&gt;Hough Transform&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Radon_transform&quot; rel=&quot;nofollow&quot;&gt;Radon Transform&lt;/a&gt;, RANSAC (see wikipedia) and Brute-Force Search (see wikipedia).&lt;br&gt;&#xA;Which one is the most robust against the dispersion of points in point cloud?&lt;br&gt;&#xA;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br&gt;&#xA;1- The question is about 3D point cloud not image.&lt;br&gt;&#xA;2- Points in point cloud are randomly dispersed (completely sparse locations).&lt;br&gt;&#xA;3- There is no information about the object (line) being explored in terms of preferred orientation, size, etc.&lt;br&gt;&#xA;4- A tolerance needs to be considered around the candidate line.&lt;br&gt;&#xA;&lt;strong&gt;Updates:&lt;/strong&gt;&lt;br&gt;&#xA;According to my experiments: RANSAC could miss easily some lines. It is good for quick detection of edges however the complexity of point dispersion could produce undesired outputs. Hough and Radon are very similar and I had not chance to try for 3D point cloud however they work well on 2D cases. There is a difficulty in extraction of segments of found lines. BFS is simply impractical for large data set.&lt;/p&gt;&#xA;" OwnerUserId="488" LastEditorUserId="488" LastEditDate="2012-02-19T01:34:13.610" LastActivityDate="2012-02-22T16:28:39.883" Title="Detection of lines in a point cloud" Tags="|edge-detection|correlation|point-cloud|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="869" PostTypeId="2" ParentId="864" CreationDate="2011-12-06T04:39:01.290" Score="9" Body="&lt;p&gt;You will get a reasonable segmentation of the grey area using the &lt;a href=&quot;http://www.seas.upenn.edu/~bensapp/opencvdocs/ref/opencvref_cv.htm&quot;&gt;Watershed Algorithm&lt;/a&gt; or graph cuts. Watershed is available in opencv but graph cuts are not yet.&#xA;(BTW Is this a depth map from Kinect ?)&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2011-12-06T04:39:01.290" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="870" PostTypeId="5" CreationDate="2011-12-06T06:27:14.613" Score="0" Body="&lt;p&gt;Adaptive filters are classified into two main groups: linear, and non linear. Linear adaptive filters compute an estimate of a desired response by using a linear combination of the available set of observables applied to the input of the filter. Otherwise, the adaptive filter is said to be nonlinear. Adaptive filters are required for some applications because some parameters of the desired processing operation (for instance, the locations of reflective surfaces in a reverberant space) are not known in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References: &lt;br&gt;&#xA;1. &lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_filter&quot; rel=&quot;nofollow&quot;&gt;Adaptive filter&lt;/a&gt; &lt;br&gt;&#xA;2. &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.42.6386&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Haykin, S., Adaptive filters&lt;/a&gt; (PDF)&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:41:34.097" LastActivityDate="2011-12-06T14:41:34.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="871" PostTypeId="4" CreationDate="2011-12-06T06:27:14.613" Score="0" Body="An adaptive filter is a filter that self-adjusts its transfer function according to an optimization algorithm driven by an error signal." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T14:44:50.540" LastActivityDate="2011-12-06T14:44:50.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="872" PostTypeId="5" CreationDate="2011-12-06T06:35:29.510" Score="0" Body="&lt;p&gt;The frequency response of the Butterworth filter is maximally flat (has no ripples) in the passband and rolls off towards zero in the stopband. Butterworth filters have a monotonically changing magnitude function with ω, unlike other filter types that have non-monotonic ripple in the passband and/or the stopband. &lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T13:36:29.090" LastActivityDate="2011-12-06T13:36:29.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="873" PostTypeId="4" CreationDate="2011-12-06T06:35:29.510" Score="0" Body="The Butterworth filter is a type of signal processing filter designed to have as flat a frequency response as possible in the passband so that it is also termed a maximally flat magnitude filter." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T13:36:26.187" LastActivityDate="2011-12-06T13:36:26.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="874" PostTypeId="5" CreationDate="2011-12-06T07:14:59.303" Score="0" Body="&lt;p&gt;This process is equivalent to convolving the unknown signal with a conjugated time-reversed version of the template. The matched filter is the optimal linear filter for maximizing the signal to noise ratio (SNR) in the presence of additive stochastic noise. Matched filters are commonly used in radar, in which a known signal is sent out, and the reflected signal is examined for common elements of the out-going signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Source: Wikipedia – &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;Matched filter&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:51:29.130" LastActivityDate="2011-12-06T14:51:29.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="875" PostTypeId="4" CreationDate="2011-12-06T07:14:59.303" Score="0" Body="Matched filter is obtained by correlating a known signal, or template, with an unknown signal to detect the presence of the template in the unknown signal." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T14:47:26.010" LastActivityDate="2011-12-06T14:47:26.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="876" PostTypeId="5" CreationDate="2011-12-06T07:23:17.927" Score="0" Body="&lt;p&gt;Computer vision enables images, or sequences of images, to be processed by a computer using an algorithm.  There are many aspects to computer vision, including mathematics, imaging hardware, imaging software, physics (especially optics), signal processing and artificial intelligence.&lt;/p&gt;&#xA;&lt;p&gt;The problems that computer vision is trying to solve include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Object detection&lt;/li&gt;&#xA;&lt;li&gt;Object recognition&lt;/li&gt;&#xA;&lt;li&gt;Tracking moving objects in video&lt;/li&gt;&#xA;&lt;li&gt;3D reconstruction&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Some basic techniques used in computer vision are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Image acquisition&lt;/li&gt;&#xA;&lt;li&gt;Pre-processing&lt;/li&gt;&#xA;&lt;li&gt;Feature extraction&lt;/li&gt;&#xA;&lt;li&gt;Detection/Segmentation&lt;/li&gt;&#xA;&lt;li&gt;High-Level processing&lt;/li&gt;&#xA;&lt;li&gt;Decision making&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A theme in the development of this field has been to duplicate the abilities of human vision by electronically perceiving and understanding an image. This image understanding can be seen as the disentangling of symbolic information from image data using models constructed with the aid of geometry, physics, statistics, and learning theory.&lt;/p&gt;&#xA;&lt;p&gt;&lt;sub&gt;Source: Wikipedia – &lt;a href=&quot;https://en.wikipedia.org/wiki/Computer_vision&quot; rel=&quot;nofollow noreferrer&quot;&gt;Computer vision&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="26573" LastEditDate="2020-08-24T15:10:47.830" LastActivityDate="2020-08-24T15:10:47.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="877" PostTypeId="4" CreationDate="2011-12-06T07:23:17.927" Score="0" Body="Computer vision includes methods of processing, analyzing, images and high-dimensional data to form high level understanding and recognition of the scene or images." OwnerUserId="609" LastEditorUserId="440" LastEditDate="2012-04-12T17:48:54.273" LastActivityDate="2012-04-12T17:48:54.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="878" PostTypeId="5" CreationDate="2011-12-06T08:30:00.997" Score="0" Body="&lt;p&gt;Statistics deals with all aspects of collection, organization, analysis, and interpretation of data, including the planning of data collection in terms of the design of surveys and experiments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Source: Wikipedia – &lt;a href=&quot;http://en.wikipedia.org/wiki/Statistics&quot; rel=&quot;nofollow&quot;&gt;Statistics&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:59:47.693" LastActivityDate="2011-12-06T14:59:47.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="879" PostTypeId="4" CreationDate="2011-12-06T08:30:00.997" Score="0" Body="Statistics is the study of the collection, organization, analysis, and interpretation of data." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T13:35:11.230" LastActivityDate="2011-12-06T13:35:11.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="880" PostTypeId="5" CreationDate="2011-12-06T08:39:16.110" Score="0" Body="&lt;p&gt;Also known as spectral waterfalls, sonograms, voiceprints, or voicegrams, spectrograms are used to identify phonetic sounds, to analyse the cries of animals; they were also used in many other fields including music, sonar/radar, speech processing, seismology, etc. The instrument that generates a spectrogram is called a spectrograph and is equivalent to a sonograph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Source: Wikipedia – &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;nofollow&quot;&gt;Spectrogram&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:53:51.647" LastActivityDate="2011-12-06T14:53:51.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="881" PostTypeId="4" CreationDate="2011-12-06T08:39:16.110" Score="0" Body="A spectrogram is a time-varying spectral representation (forming an image) that shows how the spectral density of a signal varies with time." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T14:47:54.547" LastActivityDate="2011-12-06T14:47:54.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="882" PostTypeId="5" CreationDate="2011-12-06T08:55:16.227" Score="0" Body="&lt;p&gt;Questions regarding homework assignments are more than welcome, provided that they:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Briefly explain the problem you are trying to solve; do not post your entire assignment verbatim.&lt;/li&gt;&#xA;&lt;li&gt;Explain what you have tried thus far, and where you are stuck (preferably with code examples).&lt;/li&gt;&#xA;&lt;li&gt;Don't ask for 'complete' solutions to the problem; we're not here to do your homework for you.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Questions should only be tagged as homework when either the asker has said it is so, or when it is blindingly obvious. For further guidelines, see the &lt;a href=&quot;https://dsp.stackexchange.com/faq&quot;&gt;FAQ&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="17850" LastEditDate="2017-08-27T16:17:34.140" LastActivityDate="2017-08-27T16:17:34.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="883" PostTypeId="4" CreationDate="2011-12-06T08:55:16.227" Score="0" Body="Homework means the asker is requesting help with school homework. This lets potential answerers know that they should guide the student in solving the problem, rather than simply showing the complete answer." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T13:36:05.080" LastActivityDate="2011-12-06T13:36:05.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="884" PostTypeId="5" CreationDate="2011-12-06T09:00:20.173" Score="0" Body="&lt;p&gt;The bandwidth is typically measured in hertz, and may sometimes refer to passband bandwidth, sometimes to baseband bandwidth, depending on context. Passband bandwidth is the difference between the upper and lower cutoff frequencies of, for example, an electronic filter, a communication channel, or a signal spectrum. In case of a low-pass filter or baseband signal, the bandwidth is equal to its upper cutoff frequency. The term baseband bandwidth always refers to the upper cutoff frequency, regardless of whether the filter is bandpass or low-pass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extracted from Wikipedia:&lt;br&gt;&#xA;1. &lt;a href=&quot;http://en.wikipedia.org/wiki/Bandwidth_%28signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;Bandwidth&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:46:59.203" LastActivityDate="2011-12-06T14:46:59.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="885" PostTypeId="4" CreationDate="2011-12-06T09:00:20.173" Score="0" Body="the difference between the upper and lower frequencies in a contiguous set of frequencies" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T14:45:06.310" LastActivityDate="2011-12-06T14:45:06.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="886" PostTypeId="5" CreationDate="2011-12-06T09:20:14.547" Score="0" Body="&lt;p&gt;A finer sampling of a frequency spectrum (more samples between frequency 0 and 0.5) can be obtained by padding the time domain signal with zeros before taking the DFT. Duality allows this to work in the opposite direction. If we want a finer sampling in the time domain (interpolation), pad the frequency spectrum with zeros before taking the Inverse DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;References:&lt;br&gt;&#xA;1. &lt;a href=&quot;http://books.w3k.org/html/mdft/Zero_Padding.html&quot; rel=&quot;nofollow&quot;&gt;http://books.w3k.org/html/mdft/Zero_Padding.html&lt;/a&gt; &lt;br&gt;&#xA;2. &lt;a href=&quot;http://www.dspguide.com/ch10/4.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch10/4.htm&lt;/a&gt;&#xA;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:58:46.117" LastActivityDate="2011-12-06T14:58:46.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="887" PostTypeId="4" CreationDate="2011-12-06T09:20:14.547" Score="0" Body="Zero padding consists of extending a signal (or spectrum) with zeros to extend its time (or frequency band) limits." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T14:57:54.290" LastActivityDate="2011-12-06T14:57:54.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="888" PostTypeId="5" CreationDate="2011-12-06T09:31:39.660" Score="0" Body="&lt;p&gt;It is a special case of blind source separation. When the independence assumption is correct, blind ICA separation of a mixed signal gives very good results. It is also used for signals that are not supposed to be generated by a mixing for analysis purposes. A simple application of ICA is the &quot;cocktail party problem&quot;, where the underlying speech signals are separated from a sample data consisting of people talking simultaneously in a room. Usually the problem is simplified by assuming no time delays or echoes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Source: Wikipedia – &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow&quot;&gt;Independent component analysis&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:50:33.540" LastActivityDate="2011-12-06T14:50:33.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="889" PostTypeId="4" CreationDate="2011-12-06T09:31:39.660" Score="0" Body="Independent Component Analysis is a computational method for separating a multivariate signal into additive subcomponents supposing the mutual statistical independence of the non-Gaussian source signals." OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:45:53.347" LastActivityDate="2011-12-06T14:45:53.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="890" PostTypeId="5" CreationDate="2011-12-06T09:40:13.493" Score="0" Body="&lt;p&gt;Refers to questions that do not cite references and also do not need highly bibliographic answers; should be expected neither to contain code-snippets nor to be written in the answers.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T14:47:42.813" LastActivityDate="2011-12-06T14:47:42.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="891" PostTypeId="4" CreationDate="2011-12-06T09:40:13.493" Score="0" Body="questions that are soft in nature, generally not related to implementation" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T13:35:33.770" LastActivityDate="2011-12-06T13:35:33.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="892" PostTypeId="2" ParentId="811" CreationDate="2011-12-06T09:41:50.823" Score="16" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What would be the ideal way to find the mean and standard deviation of&#xA;  a signal for a real time application. I'd like to be able to trigger a&#xA;  controller when a signal was more than 3 standard deviation off of the&#xA;  mean for a certain amount of time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The right approach in situations like this is typically to compute an exponentially weighted running average and standard deviation.  In the exponentially weighted average, the estimates of the mean and variance are biased towards the most recent sample giving you estimates of the mean and variance &lt;em&gt;over the last $\tau$ seconds&lt;/em&gt;, which is probably what you want, rather than the usual arithmetic average over all samples ever seen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain, an &quot;exponentially weighted running average&quot; is simply a real pole.  It is simple to implement in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Time domain implementation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;code&gt;mean&lt;/code&gt; and &lt;code&gt;meansq&lt;/code&gt; be the current estimates of the mean and mean of the square of the signal.  On every cycle, update these estimates with the new sample &lt;code&gt;x&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% update the estimate of the mean and the mean square:&#xA;mean = (1-a)*mean + a*x&#xA;meansq = (1-a)*meansq + a*(x^2)&#xA;&#xA;% calculate the estimate of the variance:&#xA;var = meansq - mean^2;&#xA;&#xA;% and, if you want standard deviation:&#xA;std = sqrt(var);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here $0 &amp;lt; a &amp;lt; 1$ is a constant that determines the effective length of the running average.  How to choose $a$ is described below in &quot;analysis&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is expressed above as an imperative program may also be depicted as a signal-flow diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hd3rP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Analysis&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above algorithm computes $y_i = a x_i + (1-a) y_{i-1}$ where $x_i$ is the input at sample $i$, and $y_i$ is the output (i.e. estimate of the mean).  This is a simple, single-pole IIR filter.  Taking the $z$ transform, we find the transfer function $$H(z) = \frac{a}{1-(1-a)z^{-1}}$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Condensing the IIR filters into their own blocks, the diagram now looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Myexo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To go to the continuous domain, we make the substitution $z = e^{s T}$ where $T$ is the sample time and $f_s = 1/T$ is the sample rate.  Solving $1-(1-a)e^{-sT}=0$, we find that the continuous system has a pole at $s = \frac{1}{T} \log (1-a)$.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Choose $a$: $$ a = 1 - \exp \left\{2\pi\frac{T}{\tau}\right\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Simulink diagram source may be downloaded from &lt;a href=&quot;https://gist.github.com/1942771&quot; rel=&quot;noreferrer&quot;&gt;https://gist.github.com/1942771&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-02-29T20:50:21.783" LastActivityDate="2012-02-29T20:50:21.783" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="893" PostTypeId="5" CreationDate="2011-12-06T10:24:39.273" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-06T10:24:39.273" LastActivityDate="2011-12-06T10:24:39.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="894" PostTypeId="4" CreationDate="2011-12-06T10:24:39.273" Score="0" Body="In mathematics, the term ergodic is used to describe a dynamical system which, broadly speaking, has the same behavior averaged over time as averaged over space." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T13:36:18.573" LastActivityDate="2011-12-06T13:36:18.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="895" PostTypeId="5" CreationDate="2011-12-06T11:40:02.343" Score="0" Body="&lt;p&gt;SNR is defined as the ratio of signal power to the noise power. A ratio higher than 1:1 indicates more signal than noise. While SNR is commonly quoted for electrical signals, it can be applied to any form of signal (such as isotope levels in an ice core or biochemical signaling between cells). Signal-to-noise ratio is sometimes used informally to refer to the ratio of useful information to false or irrelevant data in a conversation or exchange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Source: Wikipedia – &lt;a href=&quot;http://en.wikipedia.org/wiki/Signal-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;Signal-to-noise ratio&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="77" LastEditDate="2011-12-06T14:52:10.583" LastActivityDate="2011-12-06T14:52:10.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="896" PostTypeId="4" CreationDate="2011-12-06T11:40:02.343" Score="0" Body="Signal-to-noise ratio (often abbreviated SNR or S/N) is a measure used in science and engineering that compares the level of a desired signal to the level of background noise." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-06T13:35:45.457" LastActivityDate="2011-12-06T13:35:45.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="897" PostTypeId="2" ParentId="811" CreationDate="2011-12-06T13:34:26.643" Score="7" Body="&lt;p&gt;A method I've used before in an embedded processing application is to maintain accumulators of the sum and sum-of-squares of the signal of interest:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;A_{x,i} = \sum_{k=0}^{i}x[k] = A_{x,i-1} + x[i], A_{x,-1} = 0&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;A_{x^2,i} = \sum_{k=0}^{i}x^2[k] = A_{x^2,i-1} + x^2[i], A_{x^2,-1} = 0&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, keep track of the current time instant $i$ in the above equations (that is, note the number of samples that you've added into the accumulators). Then, the sample mean and standard deviation at time $i$ are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\tilde\mu = \frac{A_{x_i}}{i+1}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\tilde\sigma = \sqrt{\frac{A_{x^2_i}}{i+1} - \tilde\mu^2}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or you can use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\tilde\sigma = \sqrt{\frac{A_{x^2_i}}{i} - \tilde\mu^2}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Standard_deviation#Estimation&quot; rel=&quot;nofollow&quot;&gt;depending upon which standard deviation estimation method you prefer&lt;/a&gt;. These equations are based on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Sample_variance#Definition&quot; rel=&quot;nofollow&quot;&gt;definition of the variance&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\sigma^2 = \operatorname{E}(X^2) - (\operatorname{E}(X))^2&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used these successfully in the past (although I was only concerned with variance estimation, not standard deviation), although you do have to be careful about the numeric types you use to hold the accumulators if you're going to be summing over a long period of time; you don't want overflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; In addition to the above comment on overflow, it should be noted that this is not a numerically robust algorithm when implemented in floating-point arithmetic, potentially causing large errors in the estimated statistics. Look at Jason S's answer for a better approach in that case.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-01-20T06:50:42.990" LastActivityDate="2012-01-20T06:50:42.990" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="898" PostTypeId="1" AcceptedAnswerId="913" CreationDate="2011-12-07T01:55:27.677" Score="10" ViewCount="10932" Body="&lt;p&gt;I am trying to use Roberts edge detection to process an image. Do I just apply both of the masks to the image and perform convolution as normal? Could someone give me the breakdown of how to use this edge detection method, as I am trying to program it to process a greyscale image. I convoluted the image using both kernels separately  but the image dent' look right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="643" LastActivityDate="2016-03-10T02:17:49.850" Title="Roberts Edge Detector how to use?" Tags="|edge-detection|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="899" PostTypeId="2" ParentId="852" CreationDate="2011-12-07T02:58:02.370" Score="5" Body="&lt;p&gt;There are two possible scramblers, one meant for security and &#xA;privacy of the information, and the other for making sure that &#xA;the sequence of symbols transmitted over the channel has &#xA;properties that are desirable for digital transmission purposes.&#xA;Either or both might be present in a system, or both could be &#xA;absent too. Furthermore, the scramblers might well be &#xA;&lt;em&gt;non&lt;/em&gt;-interchangeable since the scrambling needed for privacy &#xA;need not be the same as that required for transmission purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question then is, where should these scramblers be placed&#xA;in the transmitter.  The channel scrambler obviously should be &#xA;between the error-correction encoder (whose output is to be&#xA;transmitted) and the modulator that creates the actual signals &#xA;that are broadcast over an antenna or transmitted down a cable&#xA;or twisted pair of wires (or recorded on a magnetic medium or&#xA;CD or DVD or what have you).  The question of where the&#xA;privacy scrambler should be placed is more complicated.&#xA;@JasonR has contended in comments that putting it before &#xA;the data compression unit makes the input to the compressor&#xA;less compressible.  This is certainly something to think&#xA;about, but I am not completely sure about that it is always&#xA;a major concern&#xA;because the scrambler for security and privacy might be doing&#xA;other things than breaking up long sequences of repeated&#xA;symbols.  In any case, the location of the privacy scrambler&#xA;&lt;em&gt;before&lt;/em&gt; the data compression unit may also be dictated by&#xA;privacy and security concerns that may have nothing to do with&#xA;efficient communication.  If I were in charge of privacy and&#xA;security, I would make darn sure that the chain looked like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;data --&gt; ENCRYPTION -- &gt; scrambling --&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in my domain before the dsp and comm people even get to see&#xA;the stream of symbols.  Let &lt;em&gt;them&lt;/em&gt; worry about&#xA;how to transmit the stream I give them as efficiently as&#xA;possible; my job is security and so I make sure that things are&#xA;nailed down tight when they leave my shop!&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2011-12-07T02:58:02.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="900" PostTypeId="1" CreationDate="2011-11-23T16:25:35.313" Score="9" ViewCount="1172" Body="&lt;p&gt;I am using a recording device that seems to shift the colors horizontally and I would like to find the amount of unshifting I have to do on 2/3 of the channels in order to obtain an image with minimal color distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pc73L.png&quot; alt=&quot;captured image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see here that in the original image at least the blue channel was shifted back with ~1.0 pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6fGAv.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is how can I detect the optimal unshift values, I'm sure they are not integers.&lt;/p&gt;&#xA;" OwnerUserId="30252" OwnerDisplayName="sorin" LastActivityDate="2011-12-07T12:16:47.410" Title="How to find the color channel shifting of an RGB image that was supposed to be greyscale?" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="901" PostTypeId="5" CreationDate="2011-12-07T06:06:41.237" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-07T06:06:41.237" LastActivityDate="2011-12-07T06:06:41.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="902" PostTypeId="4" CreationDate="2011-12-07T06:06:41.237" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-07T06:06:41.237" LastActivityDate="2011-12-07T06:06:41.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="903" PostTypeId="5" CreationDate="2011-12-07T06:20:08.203" Score="0" Body="&lt;p&gt;Image registration is an optimization problem consisting of s 3 steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Similarity measures&lt;/li&gt;&#xA;&lt;li&gt;Optimization&lt;/li&gt;&#xA;&lt;li&gt;Rendering.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It is used in different applications such as medical, remote sensing and others.&lt;/p&gt;&#xA;" OwnerUserId="24171" LastEditorUserId="8202" LastEditDate="2016-11-30T14:16:32.973" LastActivityDate="2016-11-30T14:16:32.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="904" PostTypeId="4" CreationDate="2011-12-07T06:20:08.203" Score="0" Body="Image registration is the process of transforming different sets of images to one common coordinate system." OwnerUserId="7560" LastEditorUserId="7560" LastEditDate="2014-01-22T18:57:06.347" LastActivityDate="2014-01-22T18:57:06.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="906" PostTypeId="5" CreationDate="2011-12-07T10:30:55.877" Score="0" Body="&lt;p&gt;Convolution is similar to cross-correlation. The convolution can be defined for functions on groups other than Euclidean space. It has applications that include probability, statistics, computer vision, image and signal processing, electrical engineering, and differential equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Extracted from: &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Convolution&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-07T13:12:22.157" LastActivityDate="2011-12-07T13:12:22.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="907" PostTypeId="4" CreationDate="2011-12-07T10:30:55.877" Score="0" Body="Convolution is a mathematical operation on two functions f and g, producing a third function that is typically viewed as a modified version of one of the original functions." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-07T13:12:23.920" LastActivityDate="2011-12-07T13:12:23.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="908" PostTypeId="5" CreationDate="2011-12-07T10:40:45.823" Score="0" Body="&lt;p&gt;&lt;em&gt;Hardware&lt;/em&gt; tag is for questions pertaining to hardware for used for signal processing. Examples of hardware could be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Digital Signal Processor chips&lt;/li&gt;&#xA;&lt;li&gt;Field Programmable Gate Arrays (FPGAs)&lt;/li&gt;&#xA;&lt;li&gt;Embedded microprocessors or microcontrollers&lt;/li&gt;&#xA;&lt;li&gt;Dedicated application-specific circuitry&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="609" LastEditorUserId="90" LastEditDate="2011-12-07T14:52:00.287" LastActivityDate="2011-12-07T14:52:00.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="909" PostTypeId="4" CreationDate="2011-12-07T10:40:45.823" Score="0" Body="Questions about hardware required used for signal processing." OwnerUserId="609" LastEditorUserId="90" LastEditDate="2011-12-07T14:52:07.057" LastActivityDate="2011-12-07T14:52:07.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="910" PostTypeId="2" ParentId="900" CreationDate="2011-12-07T12:10:20.770" Score="5" Body="&lt;p&gt;It seems like conceptually you're nearly there:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take one of the three colour channels as reference (for example: red)&lt;/li&gt;&#xA;&lt;li&gt;Match the green against the red&lt;/li&gt;&#xA;&lt;li&gt;Match the blue against the red&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem then is the matching with sub-pixel accuracy. To get&#xA;meaningfull numbers is a bit tricky, since the interpolation errors&#xA;any method will make have an impact on the accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two useable image registration methods I can think of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Lucas%E2%80%93Kanade_method&quot; rel=&quot;noreferrer&quot;&gt;Lucas-Kanade&lt;/a&gt; image registration. Using linear interpolation might&#xA;not give you accurate enough results, so consider bicubic or other methods.&#xA;&lt;a href=&quot;http://www.cl.cam.ac.uk/~nad10/pubs/quad.pdf&quot; rel=&quot;noreferrer&quot;&gt;Neil Dodgson&lt;/a&gt; has one made a nice overview. It's important that different&#xA;sub-pixel shifts of the interpolation kernel have a similar frequency transfer.&#xA;For the cubic family, the approximating b-spline is far better than cattmull-rom, in this case.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;First upscale the image, then do pixel-precise image registration using your favorite&#xA;technique. (cross-correlation in the Fourier domain should do).&#xA;This only works if upscaling is done carefully. Bilinear or bicubic will most likely not give you enough accuracy. I can think of three ways:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;a. &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1086325&quot; rel=&quot;noreferrer&quot;&gt;Yen-interpolation&lt;/a&gt;. See equation 11 of his paper. Really slow, but optimal. Although you seem to have some alias in the signal so the 'bandlimited' assumption Yen makes might not hold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b. Calculate FFT of the image, zero pad the high frequencies, inverse FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c. Non-linear upscaling. Since the edges are quite sharp, the image is not properly bandlimited, that might be the main limitation of the previous methods. &lt;a href=&quot;http://www.bmva.org/bmvc/2009/Papers/Paper222/Paper222.pdf&quot; rel=&quot;noreferrer&quot;&gt;Edge Dependent Directional Interpolation&lt;/a&gt; might be better in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the sub-pixel translation between the two, the correction to the green and blue channel is already solved, no matter which method you choose.&lt;/p&gt;&#xA;" OwnerUserId="627" LastEditorUserId="627" LastEditDate="2011-12-07T12:16:47.410" LastActivityDate="2011-12-07T12:16:47.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="911" PostTypeId="2" ParentId="868" CreationDate="2011-12-07T12:43:49.267" Score="1" Body="&lt;p&gt;It really depends, how will you measure the quality of the solutions? what are your requirements, real time, high accuracy? how large is the point cloud?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mentioned valid, yet fancy signal processing based methods to address the problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me add three methods you have not mentioned that are classic and more statistical in nature: least squares, ridge regression and lasso.&lt;/p&gt;&#xA;" OwnerUserId="72" LastActivityDate="2011-12-07T12:43:49.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="912" PostTypeId="1" AcceptedAnswerId="914" CreationDate="2011-12-07T17:33:24.150" Score="58" ViewCount="27844" Body="&lt;p&gt;I understand OpenCV is the de facto library for programming image processing in C/C++; I'm wondering if there is a C or C++ library like that for audio processing. I basically want to filter raw waves from a microphone, and analyze them with some machine learning algorithms. But I may eventually also need:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Multiplatform audio capture and audio playback&lt;/li&gt;&#xA;&lt;li&gt;DSP - Audio filters&lt;/li&gt;&#xA;&lt;li&gt;Tone detection&lt;/li&gt;&#xA;&lt;li&gt;Tonal property analysis&lt;/li&gt;&#xA;&lt;li&gt;Tone synthesis&lt;/li&gt;&#xA;&lt;li&gt;Recognition given some recognition corpus and model &lt;/li&gt;&#xA;&lt;li&gt;Speech / music synthesis&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any advice would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1011" LastEditorUserId="13320" LastEditDate="2018-06-10T10:51:45.950" LastActivityDate="2022-08-14T06:54:58.793" Title="Analogous Library to OpenCV for Audio Processing / Analysis" Tags="|image-processing|audio|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="913" PostTypeId="2" ParentId="898" CreationDate="2011-12-07T18:19:59.657" Score="10" Body="&lt;p&gt;Robert's Cross is a little tricky because it's not an odd size (2x2 rather than 3x3 or 5x5). I've done it using numpy+scipy using a padded 3x3 convolution mask. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import sys&#xA;import numpy as np&#xA;from scipy import ndimage&#xA;import Image&#xA;&#xA;roberts_cross_v = np.array( [[ 0, 0, 0 ],&#xA;                             [ 0, 1, 0 ],&#xA;                             [ 0, 0,-1 ]] )&#xA;&#xA;roberts_cross_h = np.array( [[ 0, 0, 0 ],&#xA;                             [ 0, 0, 1 ],&#xA;                             [ 0,-1, 0 ]] )&#xA;def load_image( infilename ) :&#xA;    img = Image.open( infilename )&#xA;    img.load() &#xA;    # note signed integer&#xA;    return np.asarray( img, dtype=&quot;int32&quot; )&#xA;&#xA;def save_image( data, outfilename ) :&#xA;    img = Image.fromarray( np.asarray( np.clip(data,0,255), dtype=&quot;uint8&quot;), &quot;L&quot; )&#xA;    img.save( outfilename )&#xA;&#xA;def roberts_cross( infilename, outfilename ) :&#xA;    image = load_image( infilename )&#xA;&#xA;    vertical = ndimage.convolve( image, roberts_cross_v )&#xA;    horizontal = ndimage.convolve( image, roberts_cross_h )&#xA;&#xA;    output_image = np.sqrt( np.square(horizontal) + np.square(vertical))&#xA;&#xA;    save_image( output_image, outfilename )&#xA;&#xA;infilename = sys.argv[1]&#xA;outfilename = sys.argv[2]&#xA;roberts_cross( infilename, outfilename )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From the Wikipedia entry on Robert's Cross. &lt;a href=&quot;http://en.wikipedia.org/wiki/Roberts_Cross&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Roberts_Cross&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/3/3f/Bikesgray.jpg&quot; alt=&quot;Image from Robert&amp;#39;s Cross Entry on Wikipedia&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My script's output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jWZDn.png&quot; alt=&quot;My script output&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="340" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.817" LastActivityDate="2011-12-07T18:19:59.657" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="914" PostTypeId="2" ParentId="912" CreationDate="2011-12-07T19:12:47.573" Score="31" Body="&lt;p&gt;Consider the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://clam-project.org&quot;&gt;clam-project.org&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CLAM (C++ Library for Audio and Music) is a full-fledged software framework for research and application development in the Audio and Music Domain. It offers a conceptual model as well as tools for the analysis, synthesis and processing of audio signals.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://MARF.sf.net&quot;&gt;MARF&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;MARF is an open-source research platform and a collection of voice/sound/speech/text and natural language processing (NLP) algorithms written in Java and arranged into a modular and extensible framework facilitating addition of new algorithms. MARF can run distributedly over the network and may act as a library in applications or be used as a source for learning and extension.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://aubio.org&quot;&gt;aubio&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;aubio is a tool designed for the extraction of annotations from audio signals. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="70" LastActivityDate="2011-12-07T19:12:47.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="915" PostTypeId="1" AcceptedAnswerId="939" CreationDate="2011-12-08T00:28:43.913" Score="15" ViewCount="7244" Body="&lt;p&gt;I've been hunting around for an alternative to Matlab's System Identification Toolbox, but the commonality of the terms &quot;system&quot; and &quot;identification&quot; are confounding the search.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any standalone libraries that are written for this purpose?  (in C++, C#, Python, etc.)&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2019-06-18T00:04:15.727" Title="System identification packages" Tags="|software-implementation|system-identification|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="917" PostTypeId="1" AcceptedAnswerId="940" CreationDate="2011-12-08T05:19:20.143" Score="4" ViewCount="157" Body="&lt;p&gt;I am a C# programmer and have a project to create a Mark Reader software. Bubble sheets that have been filled in by students are scanned using a general scanner (as opposed to a special scanner for bubble sheet). The resulting images must be processed using the Mark Reader software in question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a bit knowledge in DSP. Shortly speaking, what is the easiest learning curve to develop the software? Book recommendation is also welcome.&lt;/p&gt;&#xA;" OwnerUserId="588" LastActivityDate="2011-12-09T03:14:51.740" Title="What is the easiest learning curve to develop a Mark Reader software?" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="918" PostTypeId="5" CreationDate="2011-12-08T06:31:00.947" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-08T06:31:00.947" LastActivityDate="2011-12-08T06:31:00.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="919" PostTypeId="4" CreationDate="2011-12-08T06:31:00.947" Score="0" Body="The Z-transform converts a discrete time-domain signal, which is a sequence of real or complex numbers, into a complex frequency-domain representation." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T15:59:15.370" LastActivityDate="2011-12-08T15:59:15.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="920" PostTypeId="5" CreationDate="2011-12-08T06:43:27.757" Score="0" Body="&lt;p&gt;MP3 is a common audio format for consumer audio storage, as well as a de-facto standard of digital audio compression for the transfer and playback of music on digital audio players. &#xA;MP3 is an audio-specific format that was designed by the Moving Picture Experts Group (MPEG) as part of its MPEG-1 standard and later extended in MPEG-2 standard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Extracted from: &lt;a href=&quot;http://en.wikipedia.org/wiki/Mp3&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Mp3&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T13:31:39.930" LastActivityDate="2011-12-08T13:31:39.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="921" PostTypeId="4" CreationDate="2011-12-08T06:43:27.757" Score="0" Body="MP3 is a patented digital audio encoding format using a form of lossy data compression." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T13:31:38.090" LastActivityDate="2011-12-08T13:31:38.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="922" PostTypeId="5" CreationDate="2011-12-08T09:35:05.543" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-08T09:35:05.543" LastActivityDate="2011-12-08T09:35:05.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="923" PostTypeId="4" CreationDate="2011-12-08T09:35:05.543" Score="0" Body="A high-pass filter is a device that passes high frequencies and attenuates frequencies lower than its cutoff frequency." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T15:58:59.940" LastActivityDate="2011-12-08T15:58:59.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="924" PostTypeId="5" CreationDate="2011-12-08T09:43:25.153" Score="0" Body="&lt;p&gt;Radar can be used to detect aircraft, ships, spacecraft, guided missiles, motor vehicles, weather formations, and terrain. The radar dish or antenna transmits pulses of radio waves or microwaves which bounce off any object in their path. The object returns a tiny part of the wave's energy to a dish or antenna which is usually located at the same site as the transmitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Reference: &lt;a href=&quot;http://en.wikipedia.org/wiki/Radar&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Radar&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T13:31:58.167" LastActivityDate="2011-12-08T13:31:58.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="925" PostTypeId="4" CreationDate="2011-12-08T09:43:25.153" Score="0" Body="Radar is an object-detection system which uses radio waves to determine the range, altitude, direction, or speed of objects." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T13:31:56.327" LastActivityDate="2011-12-08T13:31:56.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="926" PostTypeId="5" CreationDate="2011-12-08T09:47:00.407" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-08T09:47:00.407" LastActivityDate="2011-12-08T09:47:00.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="927" PostTypeId="4" CreationDate="2011-12-08T09:47:00.407" Score="0" Body="OpenGL is a graphics standard and API which targets the desktop and workstation markets." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T15:59:03.187" LastActivityDate="2011-12-08T15:59:03.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="928" PostTypeId="5" CreationDate="2011-12-08T10:25:17.823" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-08T10:25:17.823" LastActivityDate="2011-12-08T10:25:17.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="929" PostTypeId="4" CreationDate="2011-12-08T10:25:17.823" Score="0" Body="A cascaded integrator-comb (CIC) is an optimized class of finite impulse response filter combined with an interpolator or decimator." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T15:57:18.630" LastActivityDate="2011-12-08T15:57:18.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="930" PostTypeId="5" CreationDate="2011-12-08T10:44:46.190" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-08T10:44:46.190" LastActivityDate="2011-12-08T10:44:46.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="931" PostTypeId="4" CreationDate="2011-12-08T10:44:46.190" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-08T10:44:46.190" LastActivityDate="2011-12-08T10:44:46.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="932" PostTypeId="5" CreationDate="2011-12-08T10:53:10.260" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-08T10:53:10.260" LastActivityDate="2011-12-08T10:53:10.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="933" PostTypeId="4" CreationDate="2011-12-08T10:53:10.260" Score="0" Body="An oscillator is an electronic circuit that produces a repetitive electronic signal, often a sine wave or a square wave." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T15:59:06.790" LastActivityDate="2011-12-08T15:59:06.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="934" PostTypeId="5" CreationDate="2011-12-08T10:58:24.390" Score="0" Body="&lt;p&gt;Huffman-coding refers to the use of a variable-length code table for encoding a source symbol (such as a character in a file) where the variable-length code table has been derived in a particular way based on the estimated probability of occurrence for each possible value of the source symbol. It was developed by David A. Huffman while he was a Ph.D. student at MIT, and published in the 1952 paper &quot;A Method for the Construction of Minimum-Redundancy Codes&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Reference: &lt;a href=&quot;http://en.wikipedia.org/wiki/Huffman_coding&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Huffman_coding&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T13:31:33.723" LastActivityDate="2011-12-08T13:31:33.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="935" PostTypeId="4" CreationDate="2011-12-08T10:58:24.390" Score="0" Body="Huffman coding is an entropy encoding algorithm used for lossless data compression." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T13:31:28.900" LastActivityDate="2011-12-08T13:31:28.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="936" PostTypeId="5" CreationDate="2011-12-08T11:07:05.743" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2011-12-08T11:07:05.743" LastActivityDate="2011-12-08T11:07:05.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="937" PostTypeId="4" CreationDate="2011-12-08T11:07:05.743" Score="0" Body="Averaging is a signal processing technique applied in the time domain, intended to increase the strength of a signal relative to noise that is obscuring it." OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-08T15:58:54.653" LastActivityDate="2011-12-08T15:58:54.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="938" PostTypeId="2" ParentId="864" CreationDate="2011-12-08T14:36:03.053" Score="4" Body="&lt;p&gt;In Mathematica you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Colorize[MorphologicalComponents[&#xA;  ColorNegate@&#xA;   Erosion[Dilation[&#xA;     DeleteSmallComponents[&#xA;      Erosion[Binarize[&#xA;        GradientFilter[&#xA;         ColorConvert[Import@&quot;https://i.stack.imgur.com/XdnaW.png&quot;, &#xA;          &quot;RGB&quot;], 2], .015], 1], 100], 2], 2]], &#xA; ColorFunction -&amp;gt; &quot;ThermometerColors&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MqlgF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably you can translate this code to any image processing lib.&lt;/p&gt;&#xA;" OwnerUserId="61" LastActivityDate="2011-12-08T14:36:03.053" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="939" PostTypeId="2" ParentId="915" CreationDate="2011-12-09T02:48:59.583" Score="8" Body="&lt;p&gt;The System Identification Toolbox contains facilities for &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Linear system identification and determination of transfer function&lt;/li&gt;&#xA;&lt;li&gt;Non-linear &quot;black-box&quot; models&lt;/li&gt;&#xA;&lt;li&gt;ODE parameter estimation&lt;/li&gt;&#xA;&lt;li&gt;Time series identification&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One of the more promising substitutes for all of this functionality would be to use &lt;a href=&quot;http://cran.r-project.org/&quot; rel=&quot;nofollow&quot;&gt;R&lt;/a&gt;.  Two packages that incorporate some of the time series functionality are the &lt;a href=&quot;http://tsanalysis.r-forge.r-project.org/&quot; rel=&quot;nofollow&quot;&gt;Time Series Utilities and Analysis package&lt;/a&gt; and the &lt;a href=&quot;http://cran.r-project.org/web/packages/FME/index.html&quot; rel=&quot;nofollow&quot;&gt;Flexible Modeling Environment&lt;/a&gt; for  Inverse Modelling, Sensitivity, Identifiability, Monte Carlo Analysis.  Also sharing these functions was the &lt;a href=&quot;http://cran.r-project.org/web/packages/timsac/index.html&quot; rel=&quot;nofollow&quot;&gt;Time Series Analysis and Control package&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An option for the transfer function calculation and manipulation (which attempts to be a substitute for the Matlab Control Systems toolbox, which overlaps with the System ID one significantly) is the &lt;a href=&quot;http://www.cds.caltech.edu/~murray/wiki/index.php/Control_Systems_Library_for_Python&quot; rel=&quot;nofollow&quot;&gt;Control Systems Library for Python&lt;/a&gt;, but the CSL doesn't have any functions for dealing with system identification, just the ability to manipulate transfer functions (thanks to JasonS for pointing this out).  The &lt;a href=&quot;http://www.softintegration.com/products/toolkit/control/&quot; rel=&quot;nofollow&quot;&gt;Ch Control System Toolkit&lt;/a&gt; allows one to model linear systems and determine the transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure there are other examples, but they may take some digging to uncover.  &lt;/p&gt;&#xA;" OwnerUserId="76" LastEditorUserId="76" LastEditDate="2014-06-19T17:03:34.093" LastActivityDate="2014-06-19T17:03:34.093" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="940" PostTypeId="2" ParentId="917" CreationDate="2011-12-09T03:14:51.740" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://www.emgu.com/wiki/index.php/OpenCV&quot; rel=&quot;nofollow&quot;&gt;EMGU&lt;/a&gt; is a .NET wrapper for &lt;a href=&quot;http://opencv.willowgarage.com/wiki/&quot; rel=&quot;nofollow&quot;&gt;OpenCV&lt;/a&gt; which is a powerful library for computer vision applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use something like &lt;a href=&quot;http://www.shervinemami.co.cc/blobs.html&quot; rel=&quot;nofollow&quot;&gt;blob detection&lt;/a&gt; to set up the layout of your grid of answers in space, check the pencil shading against a threshold (to prevent erasures from being detected as answers), check that there's one answer per question, and that it's in the right spot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get some &quot;toy&quot; problems going with the library first (detect a circle or a square in a field) and build up your implementation from there.&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2011-12-09T03:14:51.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="942" PostTypeId="1" AcceptedAnswerId="943" CreationDate="2011-12-10T16:53:21.313" Score="7" ViewCount="700" Body="&lt;p&gt;What should my approach be towards designing a filter that can simultaneously remove salt &amp;amp; pepper noise and improve the resolution?&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="77" LastEditDate="2011-12-11T12:09:16.803" LastActivityDate="2011-12-11T13:36:43.710" Title="Can I simultaneously remove salt and pepper noise and improve the image resolution?" Tags="|image-processing|filters|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="943" PostTypeId="2" ParentId="942" CreationDate="2011-12-11T13:30:24.210" Score="10" Body="&lt;p&gt;If you use two linear filters, they could be combined (because of linearity, the convolution with the convolution of the two filters equals to the consecutive convolution with the two filters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(I*a)*b=I*(a*b)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless the simplest way to deal with salt &amp;amp; pepper noise is median filtering, which is non-linear. If you use linear filters it is possible.&lt;/p&gt;&#xA;" OwnerUserId="215" LastEditorUserId="215" LastEditDate="2011-12-11T13:36:43.710" LastActivityDate="2011-12-11T13:36:43.710" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="944" PostTypeId="2" ParentId="845" CreationDate="2011-12-12T09:41:48.853" Score="5" Body="&lt;p&gt;These classical references are a good start:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;B. Porat, Digital Processing of Random Signals, Prentice-Hall, 1994. Library serial number 2144342.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A. Papoulis, Probability, Random Variables and Stochastic Processes, 3rd Ed. , McGraw-Hill, 1991. Library serial number 21111643.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;S. M. Kay, Fundamentals of Statistical Signal Processing, Volume I: Estimation Theory, Prentice-Hall, 1993. Library serial number 2157997. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You could also try KT Wong's (University of Waterloo) &lt;a href=&quot;https://web.archive.org/web/20100123154403/http://www.ece.uwaterloo.ca/~ece603/index.htm#Lecture%20Notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also find some of &lt;a href=&quot;http://www.youtube.com/playlist?list=PLEE3BA3C8CB606B8C&quot; rel=&quot;nofollow noreferrer&quot;&gt;this lecture series on Adaptive Signal Processing by Prof. M.Chakraborty on YouTube&lt;/a&gt; of use&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="25707" LastEditDate="2017-03-24T05:38:34.937" LastActivityDate="2017-03-24T05:38:34.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="945" PostTypeId="1" CreationDate="2011-12-12T22:19:45.857" Score="16" ViewCount="2002" Body="&lt;p&gt;I want to reconstruct the text from the following image as best as possible. The tricky part is that I want to do it only using morphorogical operations on the image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using erosion, dilation, opening and closing but the result is not very good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this even possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wicpc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="664" OwnerDisplayName="Jackobsen" LastEditorUserId="77" LastEditDate="2011-12-13T00:20:05.280" LastActivityDate="2012-01-16T04:18:03.710" Title="How do I reconstruct text from an image using only morphological operations?" Tags="|image-processing|morphological-operations|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="946" PostTypeId="1" CreationDate="2011-12-13T00:34:54.250" Score="2" ViewCount="733" Body="&lt;p&gt;Applying constant false alarm rate is a critical step for estimation of performance of all detectors. Has anybody experience on practical implementation of this estimator for energy detector? Can anybody explain and introduce a code to me? &lt;/p&gt;&#xA;" OwnerUserId="290" LastActivityDate="2011-12-13T02:55:41.400" Title="How to apply the CA-CFAR methods in practice?" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="947" PostTypeId="2" ParentId="845" CreationDate="2011-12-13T00:47:10.603" Score="2" Body="&lt;p&gt;As &lt;code&gt;tdc&lt;/code&gt; has cited, Papoulis (RIP to one of the leaders of this field) is one of the best books, but you may need to step into it first via something like &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0137549202&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Discrete-Time-Signal-Processing-2nd-Prentice-Hall/dp/0137549202&lt;/a&gt; if you haven't had a good undergraduate/early graduate course in signal processing (I didn't, and it hurt a bit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a more statistical perspective (but still very valid for engineers) is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470248777&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Random-Data-Measurement-Procedures-Probability/dp/0470248777/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1323737134&amp;amp;sr=1-1&lt;/a&gt;.  This is packed to the gills with info, so it's very slow reading.&lt;/p&gt;&#xA;" OwnerUserId="76" LastActivityDate="2011-12-13T00:47:10.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="948" PostTypeId="1" CreationDate="2011-12-13T02:53:22.120" Score="11" ViewCount="2520" Body="&lt;p&gt;(EDIT: This question follows from &lt;a href=&quot;https://dsp.stackexchange.com/questions/715/extracting-binary-magnetic-strip-card-data-from-raw-wav&quot;&gt;Extracting Binary Magnetic-Strip Card Data from raw WAV&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my signal (top line) and a basic IIR filter applied (bottom line)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YU2IF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(EDIT: my task is to break the signal into binary 0 (frequency F) and binary 1 (frequency 2F) -- that's why it is called F2F.  So I need to process it in such a way that guarantees no false peaks.  While the screenshot makes it look trivial, there is a potential problem of getting a double peak, and also of getting false positives in the trough between real peaks.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what methods are available for smoothing this signal?  Is IIR my best bet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see at least three possibilities:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;IIR y[n] = 0.9*y[n-1] + 0.1*x[n]  where y[x] =0 when x &amp;lt; 0 &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Moving / windowed average -- place a Bell curve with area 1.0 over the surrounding say w=10 samples each side and integrate bellSmooth(x) = integral[x-w,x+w] { bell(k).samp(k) }dk&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Determine the expected frequency and FFT / remove higher order bins / reverse FFT&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I may have answered my own question, but probably this is incomplete and I'm sure I am using the wrong terminology.  Also I can't really predict the pros and cons.   The last method is less attractive as it requires knowledge of the basic signal frequency.  But then so does the second method; I need to choose an appropriate window length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other methods?&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-08-13T06:41:54.340" Title="Smoothing signal / detecting bumps in a data stream" Tags="|filters|noise|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="949" PostTypeId="2" ParentId="946" CreationDate="2011-12-13T02:55:41.400" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Constant_false_alarm_rate&quot; rel=&quot;nofollow&quot;&gt;Constant false alarm rate&lt;/a&gt; detection is more of a general technique that underlies a class of approaches; you can't really say that there's &quot;an&quot; implementation of CFAR processing. CFAR techniques are useful when you need to detect the presence of a signal where there is some uncertainty as to what the magnitude of the signal will be, especially relative to any background noise or interference. The general principle of constant false alarm rate detection is that the detector makes some effort to estimate the background level and set a detection threshold adaptively relative to the observed ambient environment. This approach makes the performance of the detector (typically measured quantitatively using the probability of detection $P_d$ and probability of false alarm $P_{fa}$) insensitive to the bulk magnitude of the signal under observation; only relative changes in the statistics of the signal over time (such as a transition from noise only to signal-of-interest plus noise) are important.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-12-13T02:55:41.400" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="953" PostTypeId="1" AcceptedAnswerId="958" CreationDate="2011-12-13T09:22:01.557" Score="14" ViewCount="2090" Body="&lt;p&gt;I have a two vectors of spatial data (each about 2000 elements in length). One is a convolved version of the other. I am trying to determine the kernel that would produce such a convolution. I know that I can do this by finding the inverse Fourier transform of the ratio of the Fourier transforms of the output and input vectors. Indeed, when I do this I get more or less the shape I was expecting. However, my kernel vector has the same dimensionality as the two input vectors when in reality the convolution was only using about one fifth (~300-400) of the points. The fact that I am getting the right shape but the wrong number of points makes me think that I am not using the ifft and fft functions quite correctly. It seems like if I were really doing the right thing this should happen naturally. At the moment I am simply doing;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FTInput = fft(in); &#xA;FtOutput = fft(out);&#xA;kernel = ifft(FtOutput./FTInput).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this correct and it's up to me to interpret the output vector correctly or have I oversimplified the task? I'm sure it's the latter, I'm just not sure where.&lt;/p&gt;&#xA;" OwnerUserId="663" LastEditorUserId="440" LastEditDate="2012-04-17T08:45:13.017" LastActivityDate="2012-04-18T14:27:40.057" Title="How to find the convolution kernel in frequency domain?" Tags="|matlab|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="955" PostTypeId="2" ParentId="912" CreationDate="2011-12-13T12:52:32.170" Score="8" Body="&lt;p&gt;These may be at a different level but worth a look &gt; &lt;a href=&quot;http://the.echonest.com/&quot;&gt;http://the.echonest.com/&lt;/a&gt; and &lt;a href=&quot;http://vamp-plugins.org/&quot;&gt;http://vamp-plugins.org/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2011-12-13T12:52:32.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="956" PostTypeId="2" ParentId="945" CreationDate="2011-12-13T13:38:23.903" Score="6" Body="&lt;p&gt;If you're willing to add/subtract etc. morphologically transformed images, you can count how many signal pixels are in the vicinity of each pixel, and threshold based on that number. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = imread('https://i.stack.imgur.com/wicpc.png');&#xA;&#xA;n = false(3);n(4) = 1;&#xA;s = false(3);s(6) = 1;&#xA;w = false(3);w(2) = 1;&#xA;e = false(3);e(8) = 1;&#xA;&#xA;%# note that you could convolve with a cross instead&#xA;fourNeighbourCount = imerode(img,n) + imerode(img,s) + imerode(img,w) + imerode(img,3) + img;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lsgyZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%# require at least two neighbours&#xA;img = fourNeighbourCount &amp;gt; 1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0MN7g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you then convolve with a 3x3 mask that has a hole in the middle, you can get something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3UURG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2011-12-13T13:38:23.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="958" PostTypeId="2" ParentId="953" CreationDate="2011-12-13T14:49:24.840" Score="6" Body="&lt;p&gt;If you have noise present in your signal, the straightforward Fourier domain division will cause plenty of errors in your result. Some ways to avoid it are by using the so-called dual channel FFT (&lt;a href=&quot;http://www.bksv.com/doc/bv0013.pdf&quot; rel=&quot;nofollow&quot;&gt;Part 1&lt;/a&gt; and &lt;a href=&quot;http://www.bksv.com/doc/bv0014.pdf&quot; rel=&quot;nofollow&quot;&gt;Part 2&lt;/a&gt;). I can also suggest deconvolution via adaptive filters, &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_mean_squares_filter&quot; rel=&quot;nofollow&quot;&gt;LMS or NLMS&lt;/a&gt; ([Normalized] Least Mean Squares) filters in particular are easy to understand are not hugely expensive in terms of CPU cycles in case your signals are long. LMS adaptive filters are very robust to noise.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-04-18T14:27:40.057" LastActivityDate="2012-04-18T14:27:40.057" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="960" PostTypeId="1" CreationDate="2011-12-13T21:40:03.470" Score="6" ViewCount="17871" Body="&lt;p&gt;I am preparing an interview which may require some knowledges on DSP. Is there any questions, fundamental concepts, and theories that I would not want miss? Thanks a lot for the suggestions.&lt;/p&gt;&#xA;" OwnerUserId="670" LastEditorUserId="128" LastEditDate="2021-06-09T16:49:09.477" LastActivityDate="2021-06-09T16:49:09.477" Title="Interview Questions for a DSP Engineer" Tags="|dsp-core|self-study|" AnswerCount="2" CommentCount="4" CommunityOwnedDate="2011-12-13T23:12:58.923" ContentLicense="CC BY-SA 4.0" />
  <row Id="961" PostTypeId="2" ParentId="960" CreationDate="2011-12-14T16:34:29.687" Score="4" Body="&lt;p&gt;I would flip though a couple of your DSP textbooks to see what sub-topics need jogging in your memory.  That helps prevent blank looks while you try to dredge up the words for some filter (etc.) you last used long ago.  Perhaps also brush up on your complex math familiarity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is actually more important in DSP, as many of basic DSP skills are based, not on just the latest coding methodology or language fad, but on much older (more mature?) algorithms and mathematics.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-12-14T19:27:57.360" LastActivityDate="2011-12-14T19:27:57.360" CommentCount="0" CommunityOwnedDate="2011-12-14T16:34:29.687" ContentLicense="CC BY-SA 3.0" />
  <row Id="962" PostTypeId="2" ParentId="960" CreationDate="2011-12-14T19:20:03.280" Score="8" Body="&lt;p&gt;When I interview people, my questions depend a lot on the CV they've submitted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they're fresh from university, I am much more interested in whether they have ever heard of some of the basic image processing concepts: What is their definition of noise and background? What does a Gaussian filter do? And of course, I want to know if they know how to program as opposed to hacking together a last-minute solution for homework. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they claim to be more experienced, I want to know how well they know what they're talking about. What's their opinion on supervised vs. unsupervised segmentation? What are good tracking algorithms, and why? What informs their choice of a filtering algorithm? How do they deal with stochastic data? And of course, do they know how to program?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I'm always happy to find out that they did some research into the topic ahead of time, even if they just read my papers and totally misunderstood them. I can always teach them knowledge, but it is hard to teach effort. &lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2011-12-14T19:20:03.280" CommentCount="4" CommunityOwnedDate="2011-12-14T19:20:03.280" ContentLicense="CC BY-SA 3.0" />
  <row Id="963" PostTypeId="1" AcceptedAnswerId="965" CreationDate="2011-12-15T08:10:00.527" Score="8" ViewCount="314" Body="&lt;p&gt;Given a WSS process with the following Auto Correlation Function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ r\left ( \tau \right ) = {\sigma}^{2} {e}^{-\alpha \left | \tau \right |} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Laplace Transform would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R \left ( s \right ) = \mathfrak{L} \left \{ r \left ( \tau \right ) \right \} = \frac{-2 \alpha {\sigma} ^ {2}}{\left ( s - \alpha \right ) \left ( s + \alpha \right )} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the filter would be of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H \left( s \right) = \frac{c}{s + \alpha} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is about units.&#xA;In the Auto Correlation Function the units of $ \alpha $ are [Hz].&#xA;While in the filter form, assuming $ s = j \omega $ the units are [Rad / Sec].&#xA;How this conflict can be resolved?&#xA;What a I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2022-09-13T19:02:10.063" Title="Unit Problem in Designing a Filter for a Given Auto Correlation Function" Tags="|filters|filter-design|autocorrelation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="965" PostTypeId="2" ParentId="963" CreationDate="2011-12-15T10:05:00.270" Score="8" Body="&lt;p&gt;Radians are considered to be dimensionless.  See &lt;a href=&quot;https://web.archive.org/web/20171224103431/http://mathforum.org/library/drmath/view/64034.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Are angles dimensionless?&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Dimensionless_quantity&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dimensionless quantity&lt;/a&gt;.  They are considered to be pure numbers like &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is in Hz, which is a measure of 1/second, and &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is also considered to be measured per second.&lt;/p&gt;&#xA;" OwnerUserId="76" LastEditorUserId="26573" LastEditDate="2022-09-13T19:02:10.063" LastActivityDate="2022-09-13T19:02:10.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="966" PostTypeId="1" CreationDate="2011-12-15T20:05:46.080" Score="9" ViewCount="662" Body="&lt;p&gt;I'm trying to detect and classify non-speech sounds. Currently, I'm using a series of moving overlapped power spectrums from training sounds as the features I am looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do analysis, I'm just computing the same amount of overlapped spectrums so that the number of features are the same. Right now the performance is not very good, it can only detect silence vs non-silence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What techniques are there for this type of signal detection? One of my concerns is that for sounds of different lengths in the time domain would result in different lengths of feature vectors which so I can't use the same classifier, I'm stuck on this.&lt;/p&gt;&#xA;" OwnerUserId="680" LastEditorUserId="1629" LastEditDate="2016-09-11T08:52:08.343" LastActivityDate="2016-09-11T08:52:08.343" Title="Pattern recognition for temporal data" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="967" PostTypeId="1" AcceptedAnswerId="994" CreationDate="2011-12-15T21:15:48.340" Score="3" ViewCount="154" Body="&lt;p&gt;Due to my work, I just started studying hyperspectral or multispectral image processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I have enough programming background and studied mathematics for my degree - it was long time ago though. Since early this year, I have been exposed to image processing in my development work for manufacturing industry. And I got involved in a research project dealing with the subject above.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if anyone can recommend good references or resources for the subject. Especially, I would like to be familiar with that kind of image data. Any advice would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1011" LastEditorUserId="440" LastEditDate="2012-04-12T10:21:47.297" LastActivityDate="2012-04-12T10:21:47.297" Title="References and resources on hyperspectral (multispectral) image processing" Tags="|image-processing|reference-request|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="968" PostTypeId="1" AcceptedAnswerId="969" CreationDate="2011-12-16T03:49:42.940" Score="3" ViewCount="76" Body="&lt;p&gt;I have an Analog-Digital Converter used for getting digital data from LoadCell scales.&#xA;In order to use this data in my formulas I need to convert that data to the millimeters. &#xA;But how do I do it?&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2011-12-16T09:04:18.547" Title="How to convert A/D data to the needed representation" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="969" PostTypeId="2" ParentId="968" CreationDate="2011-12-16T09:04:18.547" Score="7" Body="&lt;p&gt;Two methods:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) theoretical - get the specs for your load cell, analogue hardware, A-D, etc, and do the math&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) practical - calibrate your system by applying a series of known accurate loads, logging the A-D output and then derive a calibration offset and gain (assuming everything is supposed to be linear)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally you should do both, i.e. do (1) first and then do (2) to calibrate out any offset or gain errors in your system.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2011-12-16T09:04:18.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="970" PostTypeId="1" AcceptedAnswerId="977" CreationDate="2011-12-16T09:27:12.887" Score="8" ViewCount="2097" Body="&lt;p&gt;I would like to apply The Morlet wavelet transform to analyse my EEG signals. I have many short signals each is only 1 min long. and they all recorded in 30Hz.&#xA;I have Two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In the Morlet wavelet,  What is the best scale (alpha) to use in my case ?&lt;/li&gt;&#xA;&lt;li&gt;About the edge effect: How can I know / compute what portion of my data will be corrupted due to the wavelet &quot;edge effect&quot; ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="685" LastEditorUserId="685" LastEditDate="2011-12-16T09:38:26.453" LastActivityDate="2011-12-16T22:29:08.847" Title="Apply wavelet transform to analyse EEG signal" Tags="|discrete-signals|frequency|wavelet|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="971" PostTypeId="1" AcceptedAnswerId="973" CreationDate="2011-12-16T08:10:03.270" Score="34" ViewCount="22377" Body="&lt;p&gt;I am able to write a basic sine wave generator for audio, but I want it to be able to smoothly transition from one frequency to another. If I just stop generating one frequency and immediately switch to another there will be a discontinuity in the signal and a &quot;click&quot; will be heard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what is a good algorithm to generate a wave that starts at, say 250Hz, and then transitions to 300Hz, without introducing any clicks. If the algorithm includes an optional glide/portamento time, then so much the better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of a few possible approaches such as oversampling followed by a low pass filter, or maybe using a wavetable, but I am sure this is a common enough problem that there is a standard way of tackling it.&lt;/p&gt;&#xA;" OwnerUserId="688" OwnerDisplayName="Mark Heath" LastActivityDate="2022-02-11T09:01:50.923" Title="How to create a sine wave generator that can smoothly transition between frequencies" Tags="|audio|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="972" PostTypeId="2" ParentId="971" CreationDate="2011-12-16T08:15:55.640" Score="2" Body="&lt;p&gt;From &lt;a href=&quot;http://zone.ni.com/devzone/cda/epd/p/id/4856&quot; rel=&quot;nofollow&quot;&gt;this site&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In order to create a smooth transition from one frequency to another or one amplitude to another, an incomplete sine wave must be modified with an appended section so that the resulting wave after each iteration of the while loop ends at the x-axis. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sounds like it should work.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Actually, if they are both synchronized at the x-axis upon transition, I suppose a gradual transition isn't necessary.)&lt;/p&gt;&#xA;" OwnerDisplayName="bdares" LastActivityDate="2011-12-16T08:51:03.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="973" PostTypeId="2" ParentId="971" CreationDate="2011-12-16T08:32:43.900" Score="30" Body="&lt;p&gt;One approach that I have used in the past is to maintain a phase accumulator which is used as an index into a waveform lookup table. A phase delta value is added to the accumulator at each sample interval:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;phase_index += phase_delta&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To change frequency you change the phase delta that is added to the phase accumulator at each sample, e.g.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;phase_delta = N * f / Fs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;phase_delta is the number of LUT samples to increment&#xA;freq is the desired output frequency&#xA;Fs is the sample rate&#xA;N is the size of the LUT&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This guarantees that the output waveform is continuous even if you change phase_delta dynamically, e.g. for frequency changes, FM, etc.&lt;/p&gt;&#xA;&lt;p&gt;For smoother changes in frequency (portamento) you can ramp the phase_delta value between its old value and new value over a suitable number of samples intervals rather than just changing it instantaneously.&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;code&gt;phase_index&lt;/code&gt; and &lt;code&gt;phase_delta&lt;/code&gt; both have an integer and a fractional component, i.e. they need to be floating point or fixed point. The integer part of phase_index (modulo table size) is used as an index into the waveform LUT, and the fractional part may optionally be used for interpolation between adjacent LUT values for higher quality output and/or smaller LUT size.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastEditorUserId="39" LastEditDate="2022-02-11T09:01:50.923" LastActivityDate="2022-02-11T09:01:50.923" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="974" PostTypeId="2" ParentId="971" CreationDate="2011-12-16T15:47:48.667" Score="1" Body="&lt;p&gt;1st order, you should adjust the starting phase of the new frequency sinusoid so that it is the same as what would be the phase of the previous sinusoid at the 1st transition sample point.  Compute the first frequency and use its phase for the second frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2nd option might be to ramp d_phase from that of one frequency to the next over several samples.  This will clean up the continuity of the 1st derivative and provide a glide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3rd option might be to use a smoothing window, such as a raised-cosine, on the d_phase ramping rate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-12-16T15:47:48.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="975" PostTypeId="2" ParentId="966" CreationDate="2011-12-16T15:50:48.800" Score="2" Body="&lt;p&gt;I think you're generally looking at a problem of &lt;em&gt;speech detection&lt;/em&gt;, which has been around forever, and there myriads of methods to do this developed by now. It looks like &lt;a href=&quot;http://www.cslu.ogi.edu/~zak/is-icassp03.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;, for example, also uses spectral techniques, so you might want to start there. A good old Google search will return many results with links to papers and articles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally there are two somewhat distinct approaches to speech detection. One allows for the assumption of a good speech-to-noise ratio (voice is louder than ambient noise, music, other irrelevant content), and the other makes no such assumptions and tries to identify speech presence in very noisy signals (speech buried in noise). Depending on which one you're trying to do, you'll end up looking at very different papers. Perhaps if you clarify your question a little and elaborate on the types of speech signals you're working with, this site could be of more help.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2011-12-16T19:25:11.677" LastActivityDate="2011-12-16T19:25:11.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="976" PostTypeId="1" CreationDate="2011-12-16T16:46:40.273" Score="6" ViewCount="1499" Body="&lt;p&gt;I have two sensors that have a cross talk between them. I would like to cancel the cross talk. For this I recorded two tracks, where sensor no.1 (called x1) has some input, and sensor no.2 (called x2) is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was told to make the following operations:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Since your cross talk is small:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1) Simply measure the transfer function $H_{ba}(\omega)$ directly.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2) Subtract it out as follows: &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2.1) Measure the transfer function from signal A to sensor B when signal B is 0. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2.2) Create a filter from this transfer function (FIR or IIR, depending on it's shape). &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2.3) Now you can measure and subtract a filtered version from sensor signal A from sensor signal B: &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$y_b'(t) = y_b(t)-h_{ab}(t)*y_a(t)$. Where $h_{ab}(t)$ is the impulse&#xA;  response of your cross talk filter and $*$ the convolution operator.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is a Matlab code that I wrote for this purpose, but its performance is really bad. If someone has a suggestion what I did wrong, or can suggest a new code I will be grateful. If I may say, a friend helped me to implement this, and I think that we did not implement the filter part, but maybe I am wrong.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% The files designated to measure the transfer function.&#xA;% x1 has some input. x2 is is zero, and affected by the x1.&#xA;&#xA;x1 = wavread(file1); &#xA;x2 = wavread(file2);&#xA;&#xA;%The transfer function. &#xA;&#xA;Hab = fft(x2)./fft(x1);&#xA;&#xA;hab=ifft(Hab);&#xA;&#xA;% Some new tracks, where x3 is recorded from sensor no.1 and x4 from sensor no.2.&#xA;% All the files have the same length.&#xA;&#xA;x3 = wavread(file3); &#xA;x4 = wavread(file4);&#xA;&#xA;c=conv(hab,x3);&#xA;&#xA;% Subtracted signal &#xA;&#xA;x4 = x4 - c(1:length(x4));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following code did not subtract the cross talk on x4.&#xA;Here are some images explaining the problem. For some frequencies the above code actually did a good job and subtracted the cross talk, and for some it did the opposite and increased the energy. &lt;code&gt;plot(abs(fft(x4)))&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good - Frequency energy subtracted:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cdap2.jpg&quot; alt=&quot;Good outcome, the energy of the frequency in this point was subtracted&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bad - Frequency energy increased (!):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zvHSK.jpg&quot; alt=&quot;Bad outcome, the energy increased instead of being subtracted&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="492" LastEditorUserId="6" LastEditDate="2011-12-16T19:31:25.247" LastActivityDate="2015-07-22T04:47:20.403" Title="Implementing a Matlab filter to cancel cross talk between two sensors" Tags="|filter-design|matlab|cross-correlation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="977" PostTypeId="2" ParentId="970" CreationDate="2011-12-16T20:17:58.937" Score="4" Body="&lt;p&gt;I'm not sure whether you're talking about Discrete Wavelet Transform (DWT) or Continuous Wavelet Transform (CWT). Both can be used on discrete signals similarly to DFT and DTFT, I'm not sure if anyone calls it the Discrete Time Wavelet Transform instead. In any case, the &lt;a href=&quot;http://www.ece.rice.edu/~yyue/research/waveDiff/node4.html&quot; rel=&quot;nofollow&quot;&gt;dyadic wavelet transform&lt;/a&gt; is the non-redundant one (number of samples in $=$ number of coefficients out), and that's what we usually assume by talking about DWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like you need to do a bit more reading on the wavelet transform in general, because of your first question. Wavelet transform doesn't work like the Fourier Transform; rather, it's akin to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Short Time Fourier Transform&lt;/a&gt;, which is a function of &lt;em&gt;two&lt;/em&gt; variables: frequency and time. Similarly, the wavelet transform is a function of &lt;em&gt;scale&lt;/em&gt; and time. This means that you don't pick a scale and stick to it. You go through many scales (in dyadic case they increment in powers of two), and calculate the transform for each one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To address your second question, edge effects are usually not that easy to deal with and there's a plethora of papers on the topic. If you simply want to know what portion of the transformed signal will by affected by them, and it looks like that's what you're asking for, &lt;a href=&quot;http://yang.gmu.edu/eos754/paper/bams_79_01_0061_wavelet_highlight.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; has a good discussion. One thing to keep in mind is that the DWT, like the Discrete Fourier Transform, has circular wrapping symmetry, so dealing with edges is undesirable if you're hoping to get a perfect inverse transform as well. You can look at &lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;sqi=2&amp;amp;ved=0CCwQFjAB&amp;amp;url=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.22.695&amp;amp;rep=rep1&amp;amp;type=pdf&amp;amp;ei=26brTqrhAtCTtwfq2t3tCQ&amp;amp;usg=AFQjCNEpgtx3Xrpix9LONfuXk_jble0zPg&amp;amp;sig2=RQsanQAeyOejycDte8JoUA&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; for a discussion of that, and also a way to eliminate edge artifacts.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2011-12-16T22:29:08.847" LastActivityDate="2011-12-16T22:29:08.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="978" PostTypeId="2" ParentId="966" CreationDate="2011-12-17T06:13:08.377" Score="3" Body="&lt;p&gt;Are you trying to detect speech vs non-speech, or are there classes of non-speech sounds you are trying to discriminate from? I'm not clear from your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think a decent first approach would be to block your signal into frames and compute the Mel-Frequency Cepstral Coefficients (MFCCs), as well as the delta-MFCCs (differences between adjacent frames' MFCCs) and delta-delta MFCCs (differences between MFCCs in frames that are two frames apart). This isn't the only way to do it, but without more specific knowledge of the problem domain, this is probably a good place to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just googling should give you some good reference on how to compute the MFCCs if you are not already familiar with them. Basically you take the DFT, take the magnitudes, compute the energies inside triangular windows corresponding to human hearing, take the DCT of these coefficients, essentially as a compression step, and then discard the high order coefficients, usually only taking about the first twelve coefficients. I have an explanation of the meaning of the DCT step in this post: &lt;a href=&quot;https://dsp.stackexchange.com/questions/31/how-do-i-interpret-the-dct-step-in-the-mfcc-extraction-process&quot;&gt;How do I interpret the DCT step in the MFCC extraction process?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then, say, use these coefficients as features for an SVM.&lt;/p&gt;&#xA;" OwnerUserId="392" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2011-12-17T06:13:08.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="979" PostTypeId="1" AcceptedAnswerId="1022" CreationDate="2011-12-17T17:31:18.527" Score="5" ViewCount="1956" Body="&lt;p&gt;I am trying to get a rough estimate of a position of a hand through using backprojection on frames retrieved from a camera. I do not need perfect detection on the hand, but I can't really afford to get many false blobs. At night, my histogram works fine but at day I get a large amount of false blobs. The patch of skin I calculate the hist from is sufficient enough to provide enough information for the hist to work properly. I am using the YCrCb colourspace but have omitted the third plane to help improve detection in varying lighting conditions. I am using 30 bins for Y and 32 bins for Cr. I am also using a range of 0 - 255 for both. I have tried using several morphological operations, but the false blobs are too large to go away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any suggestions on how I can remove false blobs? I can compromise on the detail of the positive detections (it can be a little blobby) but I need to remove most of the negative detections for my program to work. If this is not possible, does anyone have any suggestions other than backprojection on how to get a rough estimate of the position of the hand? (Haar or any other machine learning techniques are not possible). I cannot post code or a sample image. I am using the C++ API in OpenCV so please only suggest solutions that can be implemented in this API.&lt;/p&gt;&#xA;" OwnerDisplayName="user650" LastActivityDate="2012-02-22T12:39:57.803" Title="Histogram Backprojection in OpenCV?" Tags="|image-processing|" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="981" PostTypeId="1" CreationDate="2011-12-17T20:27:50.127" Score="-2" ViewCount="1127" Body="&lt;p&gt;i would like to ask...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is there such a thing such as &quot;Pitch Detection with the Histogram Frequencies Algorithm&quot; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does such a thing exist or is it the harmonic product spectrum algorithm or cepstral algorithm for pitch detection ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also do you have more information on the algorithm and source code in matlab ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you !&lt;/p&gt;&#xA;" OwnerUserId="692" LastActivityDate="2011-12-17T22:05:39.663" Title="Pitch Detection with the Histogram Frequencies Algorithm" Tags="|matlab|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="982" PostTypeId="1" CreationDate="2011-12-17T21:31:33.513" Score="5" ViewCount="2589" Body="&lt;p&gt;Imagine I've got some offline data that I want to smooth. I could use an auto-regressive or moving-average filter of some appropriate order for conducting the smoothing. On which criteria should I base my filter decision?&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2012-06-03T11:55:01.130" Title="How to decide whether to use AR or MA for smoothing data?" Tags="|autoregressive-model|smoothing|moving-average|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="983" PostTypeId="2" ParentId="981" CreationDate="2011-12-17T22:05:39.663" Score="4" Body="&lt;p&gt;A frequency histogram is often used as part of the explanation of the harmonic product spectrum method of pitch estimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A histogram that is a composite of several STFT frames over time may contain more of the harmonics of a note whose spectrum evolves over time (with various overtones appearing and/or disappearing, including even the fundamental), thus allowing a potentially more robust HPS estimation of the pitch.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-12-17T22:05:39.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="984" PostTypeId="1" CreationDate="2011-12-18T13:52:49.633" Score="7" ViewCount="453" Body="&lt;p&gt;A book claims this as a motivation for introducing exponential averaging:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A disadvantage of ensemble averaging is that the resulting estimate cannot track dynamic changes occurring in the observed signal.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;-- L. Sörnmo and P. Laguna, &lt;em&gt;Bioelectrical signal processing in cardiac and neurological applications&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The authors seem to use the term &lt;em&gt;ensemble averaging&lt;/em&gt; to refer to averaging all observations of a stochastic process. Modifying this method to keep a moving average, i.e. averaging only the past $n$ observations instead of all of them, seems very close at hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a moving-average smoother &lt;em&gt;would&lt;/em&gt; be able to track changes in the stochastic process being observed, just like the exponential-average smoother. Is this the difference in dynamic capabilities that the authors are referring to, or have I missed a deeper difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xD;&#xA;Y_{\mathrm{ensemble,}N}(z) &amp;amp;= \frac{1}{N}\left(z^{0}+z^{-1}+z^{-2}+\cdots+z^{-(N-1)}\right)X(z) \\&#xD;&#xA;Y_{\mathrm{exponential},\alpha}(z) &amp;amp;= \frac{\alpha}{1-(1-\alpha) z^{-1}}X(z)&#xD;&#xA;\end{align}$$&lt;/p&gt;&#xA;" OwnerDisplayName="user42" LastEditorDisplayName="user42" LastEditDate="2011-12-19T11:02:36.243" LastActivityDate="2012-01-23T18:41:38.660" Title="&quot;Ensemble averaging ... cannot track dynamic changes&quot;?" Tags="|smoothing|moving-average|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="986" PostTypeId="1" CreationDate="2011-12-18T17:32:27.290" Score="17" ViewCount="11369" Body="&lt;p&gt;In MPEG, there is a process where an image is broken up into macroblocks and a motion vector is computed for each of those macro blocks.  You then transmit these vectors, along with the prediction errors, to reconstruct the next image in the video sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to get a firm grasp on how this works.  Each macroblock has a motion vector associated with it, which (if vector is [1,0]), says &lt;code&gt;all the pixels in this block move 1 in the x direction and 0 in the y direction for the next frame.&lt;/code&gt;  If all the motion vectors don't align correctly, won't this leave areas of the image unaccounted for (like the area where that macroblock was in the first place)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have the following question I found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following image at time t:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;7   7   7   7           &#xA;7   7   5   5        &#xA;7   5   5   8         &#xA;8   8   8   8           &#xA;9   9   9   9       &#xA;9   9   9   9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This image was broken up into 2x2 macroblocks and the following motion vectors were sent along to recreate it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(0,0)  (0,0)  (0,1)  (-1,1)  (0,0)  (0,0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The image at the previous time step, t - 1, looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;7   7   7   7           &#xA;7   7   5   4        &#xA;7   7   7   7         &#xA;7   5   8   8           &#xA;8   9   8   9       &#xA;9   9   9   9   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What were the errors transmitted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you solve this?&lt;/p&gt;&#xA;" OwnerUserId="691" LastEditorUserId="440" LastEditDate="2017-06-21T14:10:56.117" LastActivityDate="2017-06-21T14:10:56.117" Title="How do the motion vectors work in predictive coding for MPEG?" Tags="|image-processing|video-processing|video-compression|motion-estimation|motion-compensation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="987" PostTypeId="1" AcceptedAnswerId="988" CreationDate="2011-12-18T19:23:51.937" Score="11" ViewCount="13837" Body="&lt;p&gt;I have a signal sampled at $\Delta t$: $f_i(t_i=i\Delta t)$ where $i = 0,\ldots,n-1$.&#xA;I want to find the first and second derivative of the signal: $f'(t)$ and $f''(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought was to estimate the derivatives by central differences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;f'(t_{i})&amp;amp;=\frac{f(t_{i+1})-f(t_{i-1})}{2\Delta t}\\&#xA;f''(t_{i})&amp;amp;=\frac{f(t_{i+1})-2f(t_{i})+f(t_{i-1})}{(\Delta t)^2}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the signal may have a lot of high frequency noise that may cause quick fluctuations in $f'$ and $f''$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What would be the best way to find &quot;smoothed&quot; estimates of $f'$ and $f''$?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="1629" LastEditDate="2016-09-11T08:35:14.887" LastActivityDate="2016-09-11T08:35:14.887" Title="How to find smoothed estimates of the derivative and second derivative of a signal?" Tags="|filters|smoothing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="988" PostTypeId="2" ParentId="987" CreationDate="2011-12-18T20:19:17.857" Score="6" Body="&lt;p&gt;It probably depends more on your data. Just know, since differentiation is a linear operation, if you choose any linear filter to smooth f' and f'', it is equivalent to smoothing f using that same filter, then taking its derivatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you post some pictures or more information about the signal you want to differentiate? Probably what you're looking for is some sort of lowpass filter to smooth the signal. A couple really simple options include a single-pole recursive filter like $y(n) = a \cdot x(n) + (1-a) \cdot y(n-1)$, or a Hann filter, which is just convolving the signal with a Hann window. The Hann filter option is nice because it's linear-phase. If you know the frequency range you care about, you can just design a suitable lowpass filter in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="392" LastEditorUserId="440" LastEditDate="2012-04-17T09:20:40.703" LastActivityDate="2012-04-17T09:20:40.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="989" PostTypeId="2" ParentId="986" CreationDate="2011-12-18T22:45:54.127" Score="3" Body="&lt;p&gt;No, it won't leave holes, because the vector is from an &lt;strong&gt;unknown&lt;/strong&gt; frame (P or B), &lt;strong&gt;to a known frame&lt;/strong&gt; (I-frame).&#xA;It reminds a little bit of how ot compute an image transformation - you use a backward transform to avoid holes/&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2011-12-18T22:45:54.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="990" PostTypeId="1" AcceptedAnswerId="992" CreationDate="2011-12-19T10:06:23.750" Score="4" ViewCount="235" Body="&lt;p&gt;Every time I've read &quot;first Fourier transform&quot;, I've assumed it to be a misspelling of the fast Fourier transform. Recently though, I saw the term in both the title and keywords of an article from a seemingly serious, albeit not peer-reviewed, journal, Japanese Circulation Journal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/10614838&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Development of a new analytical method for the electrocardiogram using short-time first Fourier transforms&lt;/em&gt;&lt;/a&gt; doesn't cite any resource or explain the algorithm. (&lt;a href=&quot;http://www.jstage.jst.go.jp/article/jcj/63/12/941/_pdf&quot; rel=&quot;nofollow&quot;&gt;fulltext PDF&lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a &quot;first&quot; Fourier transform?&lt;/p&gt;&#xA;" OwnerDisplayName="user42" LastEditorDisplayName="user42" LastEditDate="2011-12-19T11:29:31.177" LastActivityDate="2011-12-19T14:38:33.833" Title="Is there a &quot;first&quot; Fourier transform?" Tags="|fft|terminology|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="991" PostTypeId="1" AcceptedAnswerId="993" CreationDate="2011-12-19T13:53:46.710" Score="9" ViewCount="1106" Body="&lt;p&gt;I have a signal sampled at $\Delta t: fi(ti=i\Delta t)$ where i = 0..n-1. I want to find the first derivative of the signal: f'(t).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought was to estimate this by a central difference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f&amp;#39;(t_i) =\frac{f(t_{i+1})−f(t_{i−1})}{2\Delta t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the signal may have a lot of high frequency noise that may cause quick fluctuations in f'.&#xA;I guess the proper thing might be to smooth the signal by convolving with a window function e.g., Hann and then find the derivative from the differences. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A colleague suggested a faster way of finding a smoothed estimate of the derivative:&#xA;use a central difference over 2n samples, where n &gt;&gt; 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f&amp;#39;(t_i) =\frac{f(t_{i+n})−f(t_{i−n})}{2n\Delta t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This would of course be computationally faster than first convolving with a window function but is it a good solution?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we form the sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S=2\Delta t[f&amp;#39;(t_{i-n+1})+f&amp;#39;(t_{i-n+2})+..+f&amp;#39;(t_{i+n-1})]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and expand each derivative by the central difference with step $\Delta t$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S=f(t_{i-n+2})-f(t_{i-n})+f(t_{i-n+3})-f(t_{i-n+2})+..+f(t_{i+n})-f(t_{i+n-2})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all terms except two cancels out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S=f(t_{i+n})-f(t_{i-n})=2n\Delta tf&amp;#39;(t_i)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f&amp;#39;(t_i)=\frac{1}{n}[f&amp;#39;(t_{i-n+1})+f&amp;#39;(t_{i-n+2})+..+f&amp;#39;(t_{i+n-1})]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So taking the central difference over 2n samples is equivalent with first convolving by a rectangular window of size 2n - 2 and then taking a central difference over +/- 1 sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How &quot;bad&quot; is it to smooth with a rectangular window?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take the FFT this will cause &quot;ringing&quot;, but we do not need to take the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any answers!&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2011-12-19T15:03:24.247" LastActivityDate="2011-12-19T15:11:57.917" Title="Calculating smoothed derivative of a signal by using difference with larger step=convolving with rectangular window" Tags="|fourier-transform|smoothing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="992" PostTypeId="2" ParentId="990" CreationDate="2011-12-19T14:38:33.833" Score="4" Body="&lt;p&gt;Independently of what they call it, the process described in the paper is &lt;em&gt;precisely&lt;/em&gt; the Fast Fourier Transform. This is made obvious by the FFT algorithm they describe, including the Gold-Rader bit-reversal procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a side note, if one tries Googling &quot;SFFT&quot;, the S in the acronym stands for anything from &lt;em&gt;sliding&lt;/em&gt; to &lt;em&gt;spherical&lt;/em&gt;, but the F's always stand for &lt;em&gt;Fast Fourier&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2011-12-19T14:38:33.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="993" PostTypeId="2" ParentId="991" CreationDate="2011-12-19T15:11:57.917" Score="4" Body="&lt;p&gt;This is a hard question to handle generally. Smoothing with a rectangular window is used all the time (often called a &quot;moving average&quot;), so that's not necessarily a problem. I'm not sure what ringing you're referring to, perhaps the sidelobes of the rectangular window's frequency response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Differentiation is inherently a highpass operation; the ideal continuous-time differentiator has a transfer function of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;H(s) = s&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that its magnitude response is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;|H(j\omega)| = \omega&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gain of a differentiator therefore increases monotonically with frequency. If your signal contains high-frequency noise, then it could be amplified by applying a differentiator. To combat this, two approaches are apparent:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Design a more sophisticated differentiator filter that has the desired linear magnitude response over the portion of the band that covers your signal of interest, then sharply attenuates higher frequencies. You could design such a filter using least-squares methods or the frequency-sampling method, for example.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use a cascaded approach where you first suppress all of the high-frequency noise that you can using a lowpass filter, then follow with the differentiator. The frequency coverage of the differentiator need not be as tight since the lowpass filter will eliminate the out-of-band noise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The methods should be roughly equivalent if you're using linear filters; you could think of the first single-filter approach as just a cascade of a differentiator and a lowpass filter. As you noted, the central-difference approach can be modeled in this way. It's hard for anyone to say that it's &quot;bad&quot; without any knowledge of your application. My main thought would be that it is &quot;bad&quot; if the smoothing operation tangibly attenuates your signal of interest, such that the derivative estimate is no longer useful. However, if the parameters of the signal are such that you can smooth the noise without noticeably distorting the signal (i.e. if the signal is well-oversampled), then it could be a win.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2011-12-19T15:11:57.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="994" PostTypeId="2" ParentId="967" CreationDate="2011-12-19T15:11:58.263" Score="4" Body="&lt;p&gt;What kind of information are you after.  Are you looking for information on how to process the  images from a data processing point of view?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or from a theory point of view? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you looking at satellite images?  if so land or water?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Proprietary software look at ENVI &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.exelisvis.com/language/en-us/productsservices/envi.aspx&quot; rel=&quot;nofollow&quot;&gt;http://www.exelisvis.com/language/en-us/productsservices/envi.aspx&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for free software look at SeaDAS&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://oceancolor.gsfc.nasa.gov/seadas/&quot; rel=&quot;nofollow&quot;&gt;http://oceancolor.gsfc.nasa.gov/seadas/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="702" LastActivityDate="2011-12-19T15:11:58.263" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="995" PostTypeId="1" AcceptedAnswerId="998" CreationDate="2011-12-19T15:18:48.603" Score="9" ViewCount="2486" Body="&lt;p&gt;I have a signal: $f_i(t_i=i\Delta t)$, where $i = 0\ldots n-1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal seems to vary quickly around a slower varying &quot;trend&quot;. I am assuming that the quickly varying part is noise and the slowly varying part is the real signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I estimate the signal-to-noise ratio (SNR) of the signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that if I could decide on a treshold frequency: $\omega_t$ I could use the following expression:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S/N=\frac{\displaystyle\int_0^{\omega_t}|F(\omega)|^2}{\displaystyle\int_{\omega_t}^{\infty}|F(\omega)|^2}$$ &#xA;where $F$ denotes the Fourier transform of $f(t)$.&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="77" LastEditDate="2011-12-20T01:09:20.027" LastActivityDate="2011-12-20T01:09:20.027" Title="How to estimate the signal-to-noise ratio of a waveform?" Tags="|fft|noise|snr|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="996" PostTypeId="2" ParentId="987" CreationDate="2011-12-19T15:22:42.667" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_smoothing_filter&quot; rel=&quot;nofollow&quot;&gt;Savitzky-Golay&lt;/a&gt; filter provides smooth estimates of the signal and first few derivatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A MATLAB implementation can be found &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/4038-savitzky-golay-smoothing-and-differentiation-filter&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="703" LastActivityDate="2011-12-19T15:22:42.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="998" PostTypeId="2" ParentId="995" CreationDate="2011-12-19T18:04:42.670" Score="7" Body="&lt;p&gt;If the spectrum of the signal and the spectrum of the noise do not overlap, you might be able to integrate or sum the energy in each of the two frequency ranges, and take the ratio.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2011-12-19T18:04:42.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="999" PostTypeId="2" ParentId="912" CreationDate="2011-12-19T20:00:42.740" Score="9" Body="&lt;p&gt;If you are into music information retreival you should definitely check out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://marsyas.info/&quot;&gt;MARSYAS&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="680" LastActivityDate="2011-12-19T20:00:42.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1000" PostTypeId="1" CreationDate="2011-12-21T09:54:52.340" Score="9" ViewCount="1498" Body="&lt;p&gt;First, I appologize because I'm a software developper and it's been a very long time I didn't dive into pure mathematics, so my question might seem dumb. I hope not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The context is pitch recognition in music.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take a musical note, and apply a Fourier transform to it, you will have and infinite sum of amplitudes for given frequencies. For example, if I play a note whose fundamental is $F$, on any instrument, after Fourier transform, I will have harmonics at at $F, 2F, 3F,\ldots,nF$. Every frequency will have a given amplitude which defines the timbre of the instrument (piano, voice, trumpet, ... all follow this loaw, but you'll have different amplitudes for every harmonic) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what I'd like to do is from a given audio signal, find $F$. Just that.&#xA;It's more complicated than it seems because you will always have background noise and so on ... Further more, $F$ isn't necessarilly the frequency with the highest amplitude ! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my idea for finding $F$ is to apply a DFT (well actually an FFT for speed) and find a frenquency $F$, so that $F + 2F +3F + \ldots + nF$ is maximal in the FFT output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you think that's possible at all ? &#xA;Do you think that's possible in a very short time (let's say &amp;lt; 5 milliseconds) ?&lt;/p&gt;&#xA;" OwnerUserId="710" OwnerDisplayName="Dinaiz" LastEditorUserId="1629" LastEditDate="2016-09-11T08:44:09.373" LastActivityDate="2016-09-11T08:44:09.373" Title="Discrete Fourier transform - finding the fundamental quickly?" Tags="|audio|fft|pitch|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1001" PostTypeId="2" ParentId="1000" CreationDate="2011-12-21T11:20:49.287" Score="6" Body="&lt;p&gt;What you are describing is very similar the the Harmonic Product Spectrum method of pitch estimation, as listed in this &lt;a href=&quot;https://ccrma.stanford.edu/~pdelac/154/m154paper.htm&quot;&gt;Stanford CCRMA paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FFT does not give you an &quot;infinite sum of amplitudes&quot;, but a finite number of result bins depending on the length of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5 mS is only 1 period of a 200 Hz note, and only a fraction of a period below 200 Hz.  Musical pitch recognition usually requires hearing or analyzing a multiple number of periods of the periodicity of a pitched sound.  And a lot of music uses notes below G2. If you have a sufficient length of data, computing a pitch estimate from that data might take only on the order of microseconds rather than milliseconds on a modern PC or mobile device.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-12-21T11:29:55.490" LastActivityDate="2011-12-21T11:29:55.490" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1002" PostTypeId="2" ParentId="986" CreationDate="2011-12-21T15:05:02.440" Score="3" Body="&lt;p&gt;As is the case with many standard signal processing routines, it's quite straightforward on paper and a little tricky in practice. You separated your image into six blocks $B(i,j)$ with $i = \{0,1,2\}$ and $j = \{0,1\}$. each of this blocks has coordinates at $(2i, 2j)$ (we consider top left corner of each to identify its location). We, therefore, now have six blocks at &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;(0,0) (0,2)&#xA;(2,0) (2,2)&#xA;(4,0) (4,2)&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your calculated motion vectors $M(i,j)$ for each block are&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;(0,0) (0,0)&#xA;(0,1) (-1,1)&#xA;(0,0) (0,0)&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, to calculate the resulting image, we must first know where every block moved. To do that, we simply add the above coordinate matrix to its motion matrix: $B&amp;#39;(i,j)=B(i,j)+M(i,j)$. We get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;(0,0) (0,2)&#xA;(2,1) (1,3)&#xA;(4,0) (4,2)&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to avoid &quot;holes&quot; as you said, we don't simply move blocks of the original frame around to get the new one, we take the &lt;em&gt;original&lt;/em&gt; one as a reference and &lt;em&gt;inject&lt;/em&gt; the newly calculated blocks. To do this, we first make a copy of the original frame. We then take every $B&amp;#39;(i,j)$ and replace it with pixels of corresponding $B(i,j)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; We are not protected from any kind of overlapping of block &quot;in motion&quot; (two blocks are moved to overlapping locations). There are ways to handle that, but it's beyond the scope of this response. For now, we're just going to rewrite any pixels with a block we're moving to their location, so that even if there were blocks moved there previously, they will get overwritten.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, going block by block in the order you had in your question, we replace every $B&amp;#39;(i,j)$ by its corresponding $B(i,j)$. We get the followinf estimated frame $F_e$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;7   7   7   7&#xA;7   7   5   7&#xA;7   7   7   8&#xA;7   5   5   8&#xA;8   9   8   9&#xA;9   9   9   9&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error $E$ is found between estimated frame $F_e$ and the one we're trying to predict $F$ is found by $E=F-F_e$ which we calculate to be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;0   0   0   0           &#xA;0   0   0  -3        &#xA;0   0   0  -1         &#xA;0   0   3   0           &#xA;0   0   0   0       &#xA;0   0   0   0&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="6" LastActivityDate="2011-12-21T15:05:02.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1004" PostTypeId="1" AcceptedAnswerId="1006" CreationDate="2011-12-21T17:42:08.663" Score="12" ViewCount="5249" Body="&lt;p&gt;I am an experienced software engineer and am working on smartphone sensors. I've taken fundamental EE classes in DSP and am trying to apply my knowledge. I believe that I understand convolution, transfer functions, z-transform, etc. I know a little bit about FIR and IIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when reading through software APIs and documentation, I see people are applying a LPF to sensor data in the time domain. I know that you do that through the use of difference equations (e.g. y[i] = y[i-1] + 2*x[i]), but I learned in my EE class that LPF are typically applied through the convolution operation where you convolve the time signal with the coefficients of a sinc wave (for example) and with a specific cut-off frequency. So the colloquial use of &quot;low-pass filter&quot; is not exact enough for me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the Google Android API has this documentation:&#xA;&lt;a href=&quot;http://developer.android.com/reference/android/hardware/SensorEvent.html#values&quot;&gt;http://developer.android.com/reference/android/hardware/SensorEvent.html#values&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; public void onSensorChanged(SensorEvent event)&#xA; {&#xA;      // alpha is calculated as t / (t + dT)&#xA;      // with t, the low-pass filter's time-constant&#xA;      // and dT, the event delivery rate&#xA;&#xA;      final float alpha = 0.8;&#xA;&#xA;      gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];&#xA;      gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];&#xA;      gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];&#xA;&#xA;      linear_acceleration[0] = event.values[0] - gravity[0];&#xA;      linear_acceleration[1] = event.values[1] - gravity[1];&#xA;      linear_acceleration[2] = event.values[2] - gravity[2];&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I interpret that low-pass filter? What is the cut-off frequency? What is the transition bandwidth? Are they using this LPF solely to do averaging?&lt;/p&gt;&#xA;" OwnerUserId="709" LastActivityDate="2014-03-04T07:16:50.207" Title="&quot;Low-pass filter&quot; in non-EE, software API contexts" Tags="|filters|filter-design|software-implementation|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1006" PostTypeId="2" ParentId="1004" CreationDate="2011-12-21T18:31:17.237" Score="11" Body="&lt;p&gt;The filter in your example is a first-order &lt;a href=&quot;http://en.wikipedia.org/wiki/Iir_filter&quot; rel=&quot;noreferrer&quot;&gt;infinite impulse response (IIR)&lt;/a&gt; filter. Its transfer function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = \frac{1 - \alpha}{1 - \alpha z^{-1}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which corresponds to a difference equation of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = \alpha y[n-1] + (1-\alpha) x[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is the filter input and $y[n]$ is the filter output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of filter is often used as a low-complexity lowpass filter and is often called a &lt;a href=&quot;http://www.claysturner.com/dsp/Leaky%20Integrator.pdf&quot; rel=&quot;noreferrer&quot;&gt;leaky integrator&lt;/a&gt;. It is favored because of its simple implementation, low computational complexity, and its tunability: its cutoff frequency depends upon the value of $\alpha$. $\alpha$ can take on values on the interval $[0,1)$. $\alpha = 0$ yields no filtering at all (the output is equal to the input); as $\alpha$ increases, the cutoff frequency of the filter decreases. You can think of $\alpha = 1$ as a boundary case where the cutoff frequency is infinitely low (the filter output is zero for all time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of this intuitively by noticing that the filter input is weighted by $\alpha$, so as the parameter increases, the quantity $1-\alpha$ decreases, so each input sample has a smaller proportional effect on the value of any particular output sample. This has the effect of smearing out the filter's impulse response over a longer period of time. Summing over a longer period of time is similar to computing a long moving average. As the length of a moving average increases, the cutoff frequency of the average decreases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your example, where $\alpha = 0.8$, the frequency response of the filter is as follows:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7gVQ0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the example, I would guess that this filter is being used to smooth high-frequency noise out of a time series of measurements from a sensor, trying to tease out a comparatively low-frequency signal of interest. This would be a very typical application for this sort of filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On your other sub-question, you are correct that filtering is often implemented via convolution of the input signal with the filter's impulse response. In most cases, this is only done with &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response&quot; rel=&quot;noreferrer&quot;&gt;finite impulse response (FIR)&lt;/a&gt; filters. IIR filters such as this one are typically implemented using the filter's difference equation; since an IIR system's impulse response is infinitely long, you must truncate it to some finite length to make convolution with it tractable, at which point the filter is no longer IIR. The difference equation format is almost always cheaper to implement computationally, although the feedback inherent in that structure can lead to numerical issues that must be addressed (such as internal overflow and roundoff error accumulation).&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2011-12-21T19:01:44.033" LastActivityDate="2011-12-21T19:01:44.033" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1007" PostTypeId="2" ParentId="1004" CreationDate="2011-12-21T20:39:02.767" Score="2" Body="&lt;p&gt;To summarize, IIR filters based on simple idealized physical models, such as an RC filter, have a small number of poles and zeros, and thus are usually implemented as a difference equation, as a small number of poles or zeros implies very few arithmetic operations per sample using a difference equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an IIR implies an infinite length impulse response, convolution would either require forever to compute, or the use of an approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FIR filters are usually implemented by convolution with the finite length impulse response (or by FFT fast convolution if the filter is long enough for that to be computationally efficient).  These kinds of filters are more often used when one can approximate a desired frequency response specification with an finite length impulse response, rather than knowing where the Z-plane poles and zeros might be located.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However since a filter with a sharp specification implies a long FIR convolution, the implementation of FIR filters can a lot slower, and the setup may involve many more lines of code, which may be why FIR filters might not be used as often in simple software examples.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-12-21T20:49:09.703" LastActivityDate="2011-12-21T20:49:09.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1008" PostTypeId="1" AcceptedAnswerId="1009" CreationDate="2011-12-22T15:29:42.120" Score="14" ViewCount="3025" Body="&lt;p&gt;I have found that this is a simple, but bad lowpass filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) = x(n) + x(n-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I can't understand why it is a lowpass filter. What is its cutoff frequency?&lt;/p&gt;&#xA;" OwnerUserId="714" LastEditorUserId="77" LastEditDate="2011-12-22T15:45:35.487" LastActivityDate="2011-12-22T16:11:33.393" Title="Why is $y(n) = x(n) + x(n-1)$ a low pass filter?" Tags="|filters|lowpass-filter|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1009" PostTypeId="2" ParentId="1008" CreationDate="2011-12-22T16:11:33.393" Score="17" Body="&lt;p&gt;What you have here is the equivalent of a moving-average filter. Specifically, it is a filter of order 1, whose impuse response is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(n)=\delta(n)+\delta(n-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking its $Z$-transform, we get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=1+z^{-1}=\frac{z+1}{z}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a pole at $z=0$ and a zero at $z=-1$. Plotting the magnitude of the frequency response $H(\omega)\triangleq H(e^{-\imath \omega})=2\vert \cos(\omega/2)\vert$, you get the following curve&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nwjdd.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, this clearly is a low-pass filter. You can easily calculate the cut-off frequency from here on.&lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-12-22T16:11:33.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1010" PostTypeId="1" AcceptedAnswerId="1015" CreationDate="2011-12-22T17:37:47.953" Score="6" ViewCount="874" Body="&lt;p&gt;I have some code based on Jake Janovetz's Parks-McClellan (Remez) filter generating code. How can I estimate the number of taps required to build a lowpass filter given requirements for pass band ripple and stop band attenuation? I already know how to convert from these requirements back to the filter error deviation. &lt;/p&gt;&#xA;" OwnerUserId="693" LastActivityDate="2011-12-22T23:26:44.097" Title="How to estimate taps required for Parks-McClellan filters" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1011" PostTypeId="2" ParentId="984" CreationDate="2011-12-22T18:52:58.950" Score="1" Body="&lt;p&gt;You're misinterpreting ensemble averages.... this is really in &quot;batch&quot; like after recording a few runs. You average functions on a time interval, e.g. that's where those doctor's charts for kids' height/weight mean &amp;amp; spread over time arise. Time-averaging is totally different...&lt;/p&gt;&#xA;" OwnerUserId="715" LastActivityDate="2011-12-22T18:52:58.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1012" PostTypeId="1" AcceptedAnswerId="1024" CreationDate="2011-12-22T20:03:05.630" Score="6" ViewCount="10649" Body="&lt;p&gt;I have the following transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s)=\frac{s}{(s+1)(s+2)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I find the gain and phase response of the above system? I know the first step has something to do with substituting $s = j\omega$ into $H(s)$. How can I find whether the system is stable and whether it is causal?&lt;/p&gt;&#xA;" OwnerUserId="716" LastEditorUserId="90" LastEditDate="2011-12-22T20:20:33.310" LastActivityDate="2012-01-24T06:44:16.220" Title="How to find frequency response, stability, and causality of a linear system?" Tags="|homework|transfer-function|linear-systems|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1013" PostTypeId="1" CreationDate="2011-12-22T22:02:49.657" Score="4" ViewCount="216" Body="&lt;p&gt;Lets say I have two objects very close to each other. There is a colour difference between them, but the difference is small. Therefore when finding contours, both the objects are treated like on object. Is there a way to make the difference in colour more significant? As in exponentially increase the small difference in colour? Or if not possible how would I make these objects stand out from each other?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using OpenCV please suggest solutions possible in that library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You&lt;/p&gt;&#xA;" OwnerDisplayName="user650" LastActivityDate="2011-12-24T17:07:38.227" Title="Making objects stand out?" Tags="|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1014" PostTypeId="2" ParentId="1013" CreationDate="2011-12-22T22:31:37.747" Score="1" Body="&lt;p&gt;Consider converting the image into &lt;a href=&quot;http://en.wikipedia.org/wiki/Lab_color_space&quot; rel=&quot;nofollow&quot;&gt;L*a*b* color space&lt;/a&gt; — colors with subtly-different component values in RGB color space will often have significantly-different a*b* component values in L*a*b* color space.&lt;/p&gt;&#xA;" OwnerUserId="70" LastActivityDate="2011-12-22T22:31:37.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1015" PostTypeId="2" ParentId="1010" CreationDate="2011-12-22T22:51:16.457" Score="4" Body="&lt;p&gt;If you're using MATLAB, the function &lt;code&gt;firpmord&lt;/code&gt; exists to help you with that. Like some other MATLAB functions, it doesn't link to any libraries or mex files, it's simply MATLAB code that runs. The only reason I mention it is that when you open this function (&lt;code&gt;open firpmord&lt;/code&gt;), it has a subfunction &lt;code&gt;remlpord&lt;/code&gt; that was written by (&lt;em&gt;ta-daaaaa&lt;/em&gt;!) J. H. McClellan himself. It's using a matrix of hardcoded numbers and references &lt;em&gt;Rabiner &amp;amp; Gold, Theory and Appications of DSP, pp. 156-7&lt;/em&gt;. The method therefore must be somewhat empirical, though I won't argue one way or the other. In any case, you can study this function (it's very short) and write your own based on it. I failed to find any specific papers that address the problem though, but perhaps there are books.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2011-12-22T23:26:44.097" LastActivityDate="2011-12-22T23:26:44.097" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1017" PostTypeId="2" ParentId="357" CreationDate="2011-12-23T03:30:25.453" Score="1" Body="&lt;p&gt;For ECGs, there is work using the Karhunen Lòeve Transform (KLT) &lt;a href=&quot;http://ecg.mit.edu/george/publications/stkl-cinc-1992.pdf&quot; rel=&quot;nofollow&quot; title=&quot;Jager F, Mark RG, Moody GB, Divjak S. Analysis of transient ST segment changes during ambulatory ECG monitoring using the Karhunen Lòeve transform, Computers in Cardiology, 1992:691–694.&quot;&gt;(Jager, &lt;i&gt;et al.&lt;/i&gt; 1992)&lt;/a&gt;. I've had success with the KLT technique &lt;a href=&quot;http://povinelli.eece.mu.edu/publications/papers/cinc2005a.pdf&quot; rel=&quot;nofollow&quot; title=&quot;Richard J. Povinelli. (2005) &amp;quot;Towards the Prediction of Transient ST Changes,&amp;quot; PhysioNet/Computers in Cardiology Challenge Winning Paper, Computers in Cardiology, Lyon, France, 663-666.&quot;&gt;(Povinelli, 2005)&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="542" LastActivityDate="2011-12-23T03:30:25.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1018" PostTypeId="1" AcceptedAnswerId="1030" CreationDate="2011-12-23T06:22:15.657" Score="5" ViewCount="2402" Body="&lt;p&gt;I want to split signal in multiple bands and process each band. Number of bands is not yet determined, but it would be more then 6 and less then 11 (depending on the collected results)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As demonstrative example, let's consider common linear PCM sound data file &lt;code&gt;input.wav&lt;/code&gt; and I want to calculate RMS per each band. Using a tool such as &lt;code&gt;SoX&lt;/code&gt; I can extract only one band at a time (1000-2000 Hz in this example):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sox input.wav output.wav gain -n sinc 1000-2000&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and pipe output to processor and extract wanted feature.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would appreciate is solution to process all previously determined bands in one pass.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't need to be a ready made program like SoX, but preferably Matlab/Octave script or Python/SciPy/NumPy and similar approach. &lt;/p&gt;&#xA;" OwnerUserId="719" LastEditorUserId="719" LastEditDate="2011-12-24T05:37:55.033" LastActivityDate="2018-01-17T19:40:27.687" Title="Multiband processing in one pass" Tags="|filters|bandwidth|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1019" PostTypeId="1" CreationDate="2011-12-23T09:38:15.127" Score="3" ViewCount="315" Body="&lt;p&gt;I'm doing a project in T-wave extraction from ECG signal. Initially I completed the preprocessing steps like noise removal and baseline drift cancellation. Then I need to extract T wave using discrete wavelet transform. I tried different wavelets for different level in wavelet, but I'm not able to extract the T wave. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help me with MATLAB coding?&lt;/p&gt;&#xA;" OwnerUserId="720" LastEditorUserId="6" LastEditDate="2011-12-23T14:39:49.303" LastActivityDate="2012-01-25T06:44:09.683" Title="T wave analyis and extraction using discrete wavelets" Tags="|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1021" PostTypeId="1" CreationDate="2011-12-23T17:40:52.417" Score="9" ViewCount="2313" Body="&lt;p&gt;Based on what I read, I've made an algorithm for FM sound synthesis. I'm not sure if I did it right. When creating a software synth instrument a function is used to generate an oscillator and a modulator can be used to module the frequency of this oscillator. I don't know if FM synthesis is supposed to only work for modulating sine waves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm takes the instruments wave function and the modulator index and ratio for the frequency modulator. For each note it takes the frequency and stores the phase value for the carrier and modulator oscillators. The modulator always uses a sine wave. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the algorithm in pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function ProduceSample(instrument, notes_playing)&#xA;    for each note in notes_playing&#xA;        if note.isPlaying()&#xA;            # Calculate signal&#xA;            if instrument.FMIndex != 0 # Apply FM&#xA;                FMFrequency = note.frequency*instrument.FMRatio; # FM frequency is factor of note frequency.&#xA;                note.FMPhase = note.FMPhase + FMFrequency / kGraphSampleRate # Phase of modulator.&#xA;                frequencyDeviation = sin(note.FMPhase * PI)*instrument.FMIndex*FMFrequency # Frequency deviation. Max deviation is a factor of the FM frequency. Modulation is done by a sine wave. &#xA;                note.phase = note.phase + (note.frequency + frequencyDeviation) / kGraphSampleRate # Adjust phase with deviation&#xA;                # Reset the phase value to prevent the float from overflowing&#xA;                if note.FMPhase &amp;gt;= 1&#xA;                    note.FMPhase = note.FMPhase - 1&#xA;                end if&#xA;            else # No FM applied&#xA;                note.phase = note.phase + note.frequency / kGraphSampleRate # Adjust phase without deviation&#xA;            end if&#xA;            # Calculate the next sample&#xA;            signal = signal + instrument.waveFunction(note.phase,instrument.waveParameter)*note.amplitude&#xA;            # Reset the phase value to prevent the float from overflowing&#xA;            if note.phase &amp;gt;= 1&#xA;                note.phase = note.phase - 1&#xA;            end if&#xA;        end if&#xA;    end loop&#xA;    return signal&#xA;end function &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if the note's frequency is at 100Hz, the FMRatio is set at 0.5 and the FMIndex is 0.1 it should produce frequencies going between 95Hz and 105Hz in a 50Hz cycle. Is this the correct way of doing it. My tests show that it doesn't always sound right, especially when modulating saw and square waves. Is it OK to modulate saw and square waves like this or is it for sine waves only?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the implementation in C and CoreAudio:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;static OSStatus renderInput(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData){&#xA;    AudioSynthesiser * audioController = (AudioSynthesiser *)inRefCon;&#xA;    // Get a pointer to the dataBuffer of the AudioBufferList&#xA;    AudioSampleType * outA = (AudioSampleType *) ioData-&amp;gt;mBuffers[0].mData;&#xA;    if(!audioController-&amp;gt;playing){&#xA;        for (UInt32 i = 0; i &amp;lt; inNumberFrames; ++i){&#xA;            outA[i] = (SInt16)0;&#xA;        }&#xA;        return noErr;&#xA;    }&#xA;    Track * track = &amp;amp;audioController-&amp;gt;tracks[inBusNumber];&#xA;    SynthInstrument * instrument = (SynthInstrument *)track;&#xA;    float frequency_deviation;&#xA;    float FMFrequency;&#xA;    // Loop through the callback buffer, generating samples&#xA;    for (UInt32 i = 0; i &amp;lt; inNumberFrames; ++i){&#xA;        float signal = 0;&#xA;        for (int x = 0; x &amp;lt; 10; x++) {&#xA;            Note * note = track-&amp;gt;notes_playing[x];&#xA;            if(note){&#xA;                //Envelope code removed&#xA;                //Calculate signal&#xA;                if (instrument-&amp;gt;FMIndex) { //Apply FM&#xA;                    FMFrequency = note-&amp;gt;frequency*instrument-&amp;gt;FMRatio; //FM frequency is factor of note frequency.&#xA;                    note-&amp;gt;FMPhase += FMFrequency / kGraphSampleRate; //Phase of modulator.&#xA;                    frequency_deviation = sinf(note-&amp;gt;FMPhase * M_PI)*instrument-&amp;gt;FMIndex*FMFrequency; //Frequency deviation. Max deviation is a factor of the FM frequency. Modulation is done by a sine wave. &#xA;                    note-&amp;gt;phase += (note-&amp;gt;frequency + frequency_deviation) / kGraphSampleRate; //Adjust phase with deviation&#xA;                    // Reset the phase value to prevent the float from overflowing&#xA;                    if (note-&amp;gt;FMPhase &amp;gt;= 1){&#xA;                        note-&amp;gt;FMPhase--;&#xA;                    }&#xA;                }else{&#xA;                    note-&amp;gt;phase += note-&amp;gt;frequency/ kGraphSampleRate; //Adjust phase without deviation&#xA;                }&#xA;                // Calculate the next sample&#xA;                signal += instrument-&amp;gt;wave_function(note-&amp;gt;phase,instrument-&amp;gt;wave_parameter)*track-&amp;gt;note_amplitude[x];&#xA;                // Reset the phase value to prevent the float from overflowing&#xA;                if (note-&amp;gt;phase &amp;gt;= 1){&#xA;                    note-&amp;gt;phase--;&#xA;                }&#xA;            } //Else nothing added&#xA;        }&#xA;        if(signal &amp;gt; 1.0){&#xA;            signal = 1;&#xA;        }else if(signal &amp;lt; -1.0){&#xA;            signal = -1.0;&#xA;        }&#xA;        audioController-&amp;gt;wave[audioController-&amp;gt;wave_last] = signal;&#xA;        if (audioController-&amp;gt;wave_last == 499) {&#xA;            audioController-&amp;gt;wave_last = 0;&#xA;        }else{&#xA;            audioController-&amp;gt;wave_last++;&#xA;        }&#xA;        outA[i] = (SInt16)(signal * 32767.0f);&#xA;    }&#xA;    return noErr;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Answers are very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="722" LastActivityDate="2013-08-09T09:00:25.373" Title="Frequency Modulation Synthesis Algorithm" Tags="|audio|algorithms|modulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1022" PostTypeId="2" ParentId="979" CreationDate="2011-12-24T11:16:25.450" Score="0" Body="&lt;p&gt;I cannot say much about how can we increase the accuracy of your blob detection by your current method till i exactly understand method and implementation; However, i feel it is quite certain that color (alone) quite often vulnerable to false detection due to the fact that many things in the world corresponds to closer to skin color. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best best, i believe is to use more information - hopefully an independent feature. For example, you can use shape - and apply the classifier who can detect hand/no-hand based on most possible counter shapes. some times the hand shape may have a round blob - but most often the fingers etc would bring the uniqueness necessary for classification. &#xA;you can run across many possible scenarios to create a good model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about it, if you would have given this task to a human being - how would they have guessed it?&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2011-12-24T11:16:25.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1023" PostTypeId="2" ParentId="986" CreationDate="2011-12-24T16:43:33.290" Score="5" Body="&lt;p&gt;To simplify your confusion - there two processes : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Motion estimation&lt;/strong&gt;&lt;br&gt;&#xA;&lt;strong&gt;2. Motion compensation&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before we talk about the estimation, we should talk about the Motion compensation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let say, the $ Image_{t}(x,y) $ is split in block $ Blocks_{t}[k](x',y') $. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The task of Motion compensation is to produce $ Blocks_{t}[k](x',y') $ from any region of &#xA;$ Image_{t-1}(x,y) $. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence another block not necessarily aligned at 16x16 boundary is a best possible match $ Blocks_{t-1}[k](x'+mx,y'+my) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $ mx, my $ is called motion vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can calculate the error between the target and reference as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Err_{t}[k](x,y) = Blocks_{t}[k](x',y') - Blocks_{t-1}[k](x'+mx,y'+my) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now, the encoder basically transmits $Err_{t}[k](x,y)$ (with DCT and quantization) and $ {( mx, my) }[k] $  for each block,. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So encoder has 2 work to do: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Motion Estimation&lt;/strong&gt;&lt;br&gt;&#xA;The process or estimating $ { mx, my }[k] $ for every $ k $ such that $ Err_{t}[k](x,y) $ is minimized is called Motion estimation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Generation of error image after Motion Compensation&lt;/strong&gt;&lt;br&gt;&#xA;The process of constructing $ Blocks_{t}[k](x',y') $ from $I_{t}$ image pixels and $ { (mx, my) }[k] $ is called Motion compensation.&#xA;The error image is what gets transmitted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, decoder can re-do motion compensation on its' own using moiton vectors and the error image to make final re-construction of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now we realize a few points:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Best Motion estimation helps minimize the energy that is required to be transmitted and hence optimizes the bits for a given quality. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;However, even if $ { (mx, my) }[k] $ is not ideal or if the scene has significant change over last picture, the $ Err_{t}[k](x,y) $ is always transmitted to receiver - hence the reconstruction is always perfect (modulo the loss created by the quantization). Hence, even if you have suboptimal motion vector or redundancy is not much, the reconstruction is still always perfect albeit with more bits! &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Every block $ Blocks_{t}[k](x',y') $ is motion compensated on its own right - hence even if the actual motion vectors of any neighboring blocks has no effect in the construction. Hence, it is not necessary to have motion vectors perfectly aligned for perfect reconstruction to be possible.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Albeit algorithm  exists who are smart enough to guess that if $Blocks_{t}[k]$ has motion vector $( mx ,my )[k]$ the guess for $Blocks_{t}[k+1]$ might just be closer to that only. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally suppose the next picture is completely different it is possible that energy for $$ Energy (Err_{t}[k](x,y))  &amp;gt; Energy ( Blocks_{t}[k](x',y') ) $$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In such cases, it might be more advisable to transmit block directly without prediction than to send the difference. This is also possible in the encoder by a provision called INTRA block. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2015-06-13T08:08:14.420" LastActivityDate="2015-06-13T08:08:14.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1024" PostTypeId="2" ParentId="1012" CreationDate="2011-12-24T16:54:40.783" Score="-3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;NOTE: This answer is community wiki: If you feel there is a need for&#xA;  correction -please update the answer right here.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Frequency response:&lt;/strong&gt;&lt;br&gt;&#xA;For any system - the (discrete time or continuous time) Fourier Transform of the impulse response is same as the frequency response of it. You can replace $s$ by $j\omega$ to work on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Stability:&lt;/strong&gt;&lt;br&gt;&#xA;System is stable if, the bounded input produces bounded output. The definition of can be found here in the &lt;a href=&quot;http://en.wikipedia.org/wiki/BIBO_stability&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt; link.  For this, the necessary condition to prove is to see if the impulse response be absolutely integrable, i.e., its L^1 norm exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a rational and continuous-time system, the condition for stability is that the region of convergence (ROC) of the Laplace transform includes the imaginary axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Causality:&lt;/strong&gt;&lt;br&gt;&#xA;Any system who's impulse response at sample $s_i$ doesn't require to know any samples presented $s_{i+1}$ or after wards, than the system is causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;br&gt;&#xA;Now given the above i am trying to put the calculation as per your system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(s)=\frac{s}{(s+1)(s+2)}  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can replace $s$ with $j\omega$ to get the frequency response in terms of magnitude and phase response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(j\omega) =  \frac{j\omega}{(j\omega+1)(j\omega+2)} $$&#xA;$$ H(j\omega) =  \frac{j\omega}{2 - \omega^2 + 3j\omega } $$&#xA;$$ Magnitude =  20 Log_{10} \sqrt { ( H(j\omega) )^2 } $$&#xA;$$ Magnitude =  20 Log_{10}  \sqrt { \frac { (j\omega)^2 }{(2 - \omega^2)^2 + (3j\omega)^2} }  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE: square is applied separately on real terms than on imaginary terms! I got this understanding from this document &lt;a href=&quot;http://www.syscompdesign.com/AppNotes/laplace-cookbook.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replacing $-j^2$ by $-1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Magnitude =  20 Log_{10} \sqrt { \frac{-1\cdot\omega^2}{(2 - \omega^2)^2 - (3\omega)^2} } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Magnitude =  20 Log_{10} \sqrt { \frac{-1\cdot\omega^2}{(4 - 5\omega^2 +\omega^4)} } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Phase = arc tan (real / imaginary)  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Phase = -1 \cdot \tan^{-1}(\frac {-3\omega}{(2-\omega^2)} )   \ $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please correct me if i am wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another &lt;a href=&quot;http://file:///home/vuadmin/Downloads/LAPLACE%20TRANSFORMS1.ppt&quot; rel=&quot;nofollow&quot;&gt;literature&lt;/a&gt; that can help you. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-01-24T06:44:16.220" LastActivityDate="2012-01-24T06:44:16.220" CommentCount="10" CommunityOwnedDate="2012-01-24T06:44:16.220" ContentLicense="CC BY-SA 3.0" />
  <row Id="1025" PostTypeId="2" ParentId="1013" CreationDate="2011-12-24T17:07:38.227" Score="1" Body="&lt;p&gt;In case of many imaging - the native contrast can be lower which is why the effective range of brightness (or color) may not be spread fully over the available range of colors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best (practically viable) solution and also the most simplest in terms of implementation is called &lt;em&gt;Histogram Equalization&lt;/em&gt;. This is useful as an automatic range enhancer and used significantly as a key preprocessing technique across many class of algorithms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For color images one may apply the same technique on RGB separately but that might break the color integrity due to non linearity of this technique. Alternatively you can probably transform the color space to something like HSV and then stretch H and S separately. Since H represents the true color element very closely - that might help. Though, transformations on HSV space might just be prone to some noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this references: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/histeq.htm&quot; rel=&quot;nofollow&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/histeq.htm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://fourier.eng.hmc.edu/e161/lectures/contrast_transform/node2.html&quot; rel=&quot;nofollow&quot;&gt;http://fourier.eng.hmc.edu/e161/lectures/contrast_transform/node2.html&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;(for color) &lt;a href=&quot;http://www.isical.ac.in/~sarif_r/papers/naik12tip12_hue_preserving.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.isical.ac.in/~sarif_r/papers/naik12tip12_hue_preserving.pdf&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;(for color) &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=202045&quot; rel=&quot;nofollow&quot;&gt;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=202045&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastActivityDate="2011-12-24T17:07:38.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1026" PostTypeId="2" ParentId="945" CreationDate="2011-12-24T17:23:58.577" Score="3" Body="&lt;p&gt;This is quite an interesting problem to solve! Try a &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;median filter&lt;/a&gt;. See the reference &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/median.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://fourier.eng.hmc.edu/e161/lectures/smooth_sharpen/node3.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for more details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though I haven't put my hands to simulate your problem, this is a suggestion. My gut feeling says that it might give you great benefit because, it is known to counter salt-n-pepper type of noise. In your case, the images has extra white dots around the border which will either get converted to full white or full black depending on which side of the alphabet it is.  Here is how it looks after median filtering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M5ArM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="77" LastEditDate="2012-01-07T17:05:37.990" LastActivityDate="2012-01-07T17:05:37.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1028" PostTypeId="2" ParentId="982" CreationDate="2011-12-24T19:36:24.777" Score="2" Body="&lt;p&gt;MA (Moving Average) filter is a FIR filter. &#xA;In general it is given in this form - &#xA;$$ Y(n) = \sum { w_i * X(n-i) } $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In inherently it is always stable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;AR (Auto regressive) filter is an IIR filter. &#xA;In general, it is given that AF filter is in the form &#xA;$$ Y(n) = X(n) * w_0 + \sum { w_i * Y(n-i) } $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to design a filter who's frequency response window of a very accurate shape it is more manageable or easier to achieve through FIR filters but might be difficult with IIR filters. For example if you need to do equripple filters or Linear phase filters - FIR (MA) filters could be straight in design. However, if the exact shape is not so crucial, using AR one could always produce similarly effective filter (in terms of how steeply gain drops after required cut off), with relatively lesser number of taps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an excerpt from &lt;a href=&quot;http://books.google.co.in/books/about/Digital_signal_processing.html?id=H_5SAAAAMAAJ&quot; rel=&quot;nofollow&quot;&gt;&quot;Digital Signal Processing&quot; Proakis &amp;amp; Manolakis&lt;/a&gt;; this is about the comparison of FIR vs. IIR filter design. Page: 724.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As a general rule, FIR filters are used in applications where there is&#xA;  a need for a linear-phase filter. This requirement occurs in many&#xA;  applications, especially in telecommunications, where there is a&#xA;  requirement to separate (demultiplex) signals such as data that have&#xA;  been frequency-division multiplexed, without distorting these signals&#xA;  in the process of demultiplexing. of the several methods described for&#xA;  designing FIR filters, the frequency sampling design method and the&#xA;  optimum Chebyshev approximation method yeild the best results. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;IIR filters are generally used in applications where some phase&#xA;  distortion is tolerable. Of the class of IIR filter, elliptic filters&#xA;  are the most efficient to implement in the sense that for a given sent&#xA;  of specifications, an elliptic filter has a lower order or fewer&#xA;  co-efficients than any other IIR filter type. When compared with FIR&#xA;  filters, elliptic filters are also considerably more efficient.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-06-03T11:55:01.130" LastActivityDate="2012-06-03T11:55:01.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1029" PostTypeId="2" ParentId="1019" CreationDate="2011-12-26T06:18:24.050" Score="1" Body="&lt;p&gt;First, this is not an easy task to automate. An algorithm that works great on clean ECGs can fail miserably on noisy ones. That said, I would suggest you look at the approach used to identify the ST segments in the &lt;a href=&quot;http://physionet.org/physiobank/database/ltstdb/lt00/node2.html&quot; rel=&quot;nofollow&quot;&gt;Long Term ST Database&lt;/a&gt;. It is one of, if not the, largest ST segment database publicly available. They describe the approach they used, which includes automatic segmentation followed by expert review.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, take a look at the &lt;a href=&quot;http://physionet.org/physiotools/&quot; rel=&quot;nofollow&quot;&gt;PhysioToolkit&lt;/a&gt; from &lt;a href=&quot;http://physionet.org/&quot; rel=&quot;nofollow&quot;&gt;PhysioNet&lt;/a&gt;. I'm pretty sure the have some automatic ECG annotation tools. I looked, but couldn't find them. Still, I think they are there somewhere.&lt;/p&gt;&#xA;" OwnerUserId="542" LastActivityDate="2011-12-26T06:18:24.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1030" PostTypeId="2" ParentId="1018" CreationDate="2011-12-26T08:32:20.860" Score="2" Body="&lt;p&gt;The most direct way to make these calculations is to design a set of filters to your specifications, then read the data out of the WAV files and run it through the filters. In Python/SciPy, you can use Python's &lt;a href=&quot;http://docs.python.org/library/wave.html&quot; rel=&quot;nofollow&quot;&gt;wave&lt;/a&gt; module to read and write WAV files, SciPy's &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.firwin.html&quot; rel=&quot;nofollow&quot;&gt;firwin&lt;/a&gt; to design a windowed sinc filter like SoX's sinc effect, and SciPy's &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lfilter.html&quot; rel=&quot;nofollow&quot;&gt;lfilter&lt;/a&gt; to apply each filter. You will have to design each filter separately and call &lt;code&gt;lfilter&lt;/code&gt; for each filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple way to approximate the energy in several bands is to first calculate the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Discrete Fourier Transform (DFT)&lt;/a&gt; of consecutive frames, and sum up the energy in the bins corresponding to your bands of interest. The DFT approximates a signal with a sum of harmonically related sinusoids. The advantage of this technique is that it's easy to sum up several arbitrarily spaced bands. A big disadvantage is you have to apply a window to control &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot; rel=&quot;nofollow&quot;&gt;spectral leakage&lt;/a&gt;. This makes the energy calculation an approximation. You can use NumPy's &lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.rfft.html&quot; rel=&quot;nofollow&quot;&gt;rfft&lt;/a&gt; function to calculate the Fourier Transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your bank of filters is related, for instance all the same bandwidth, or centered at harmonically or logarithmically related frequencies, there are some clever techniques that fall under the concept of &lt;a href=&quot;http://en.wikipedia.org/wiki/Filterbank&quot; rel=&quot;nofollow&quot;&gt;filterbanks&lt;/a&gt;. This is more specialized, and I don't know of much pre-packaged code you could use. &lt;/p&gt;&#xA;" OwnerUserId="275" LastActivityDate="2011-12-26T08:32:20.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1032" PostTypeId="1" AcceptedAnswerId="1034" CreationDate="2011-12-26T15:52:47.730" Score="9" ViewCount="4733" Body="&lt;p&gt;In one of other discussions : &lt;a href=&quot;https://dsp.stackexchange.com/questions/1012/how-to-find-frequency-response-stability-and-causality-of-a-linear-system/1024&quot;&gt;How to find frequency response, stability, and causality of a linear system?&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a comment which was quite strong and definitely caught my attention. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An ideal low-pass filter is an example of a system that is not BIBO&#xA;  stable even though its frequency response is bounded for all $f$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am following the definition of stability as per here in wiki &lt;a href=&quot;http://en.wikipedia.org/wiki/BIBO_stability&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/BIBO_stability&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone give me a proof that ideal LPF can indeed be BIBO unstable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, ideal LPF with &lt;em&gt;infinite&lt;/em&gt; gain can produce unbounded output. The question is restricted to LPF when gain is finite.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-01-05T06:03:32.857" Title="Is Ideal LPF BIBO unstable?" Tags="|filters|linear-systems|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1033" PostTypeId="2" ParentId="1032" CreationDate="2011-12-26T16:32:24.837" Score="5" Body="&lt;p&gt;A necessary condition for BIBO stability is the existence of the $L^1$ norm (or $\ell^1$ norm for discrete systems) of the impulse response. From the wiki article you cited,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For a continuous time linear time invariant (LTI) system, the&#xA;  condition for BIBO stability is that the impulse response be&#xA;  absolutely integrable, i.e., its L1 norm exist.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\int_{-\infty}^\infty |h(t)|\ dt=\Vert h(t)\Vert_1&amp;lt;\infty$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The impulse response of an ideal LPF is the $\text{sinc}$ function, which only has the $L^2$ norm and not the $L^1$ norm. In other words, $\text{sinc}(t)$ is &lt;strong&gt;not&lt;/strong&gt; absolutely summable or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^\infty |\text{sinc}(t)|\ dt=\infty$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, an ideal LPF is not BIBO stable despite its frequency response being bounded for all $f$.&lt;/p&gt;&#xA;" OwnerUserId="77" LastActivityDate="2011-12-26T16:32:24.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1034" PostTypeId="2" ParentId="1032" CreationDate="2011-12-27T02:48:14.303" Score="7" Body="&lt;p&gt;This answer is a response to a comment by the OP on on yoda's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that $h(t)$, the impulse response of a continuous-time &#xA;linear time-invariant system, has the property that &#xA;$$\int_{-\infty}^{\infty} |h(t)| \mathrm dt = M$$ for&#xA;some finite number $M$.  Then, for &lt;strong&gt;each and every&lt;/strong&gt; &#xA;bounded input $x(t)$, the output $y(t)$ is bounded also.&#xA;If $|x(t)| \leq \hat{M}$ for all $t$ where $\hat{M}$&#xA;is some finite number, then $|y(t)| \leq \hat{M}M$ for all $t$&#xA;where $\hat{M}M$ is also a finite number.&#xA;The proof is straightforward.&#xA;$$\begin{align*}&#xD;&#xA;|y(t)| &amp;amp;= \left |\int_{-\infty}^\infty h(\tau)x(t - \tau)\mathrm d\tau\right |\\&#xD;&#xA;&amp;amp;\leq \int_{-\infty}^\infty |h(\tau)x(t - \tau)|\mathrm d\tau\\&#xD;&#xA;&amp;amp;\leq \int_{-\infty}^\infty |h(\tau)|\cdot|x(t - \tau)|\mathrm d\tau\\&#xD;&#xA;&amp;amp;\leq \hat{M}\int_{-\infty}^\infty |h(\tau)|\mathrm d\tau\\&#xD;&#xA;&amp;amp;= \hat{M}M.&#xD;&#xA;\end{align*}$$&#xA;In other words, $y(t)$ is bounded whenever $x(t)$ is bounded.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thus, the condition &#xA;  $\displaystyle\int_{-\infty}^{\infty} |h(t)| \mathrm dt &amp;lt; \infty$&#xA;  is sufficient for BIBO-stability.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The condition  $\displaystyle\int_{-\infty}^{\infty} |h(t)| \mathrm dt &amp;lt; \infty$&#xA;  is also necessary for BIBO-stability.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Assume that &lt;em&gt;every&lt;/em&gt; bounded input&#xA;produces a bounded output.  Now consider the input &#xA;$x(t) = \text{sgn}(h(-t)) ~\forall~ t$.  This is clearly bounded,&#xA;($|x(t)| \leq 1$ for all $t$), and at $t=0$, it produces output&#xA;$$\begin{align*}&#xD;&#xA;y(0) &amp;amp;= \int_{-\infty}^\infty h(0-\tau)x(-\tau)\mathrm d\tau\\&#xD;&#xA;&amp;amp;= \int_{-\infty}^\infty h(-\tau)\text{sgn}(h(-\tau))\mathrm d\tau&#xD;&#xA;&amp;amp;= \int_{-\infty}^\infty |h(-\tau)|\mathrm d\tau\\&#xD;&#xA;&amp;amp;= \int_{-\infty}^\infty |h(t)|\mathrm dt.&#xD;&#xA;\end{align*}$$&#xA;Our assumption that the system is BIBO stable means that $y(0)$ is &#xA;necessarily finite, that is,&#xA;$$\int_{-\infty}^{\infty} |h(t)| \mathrm dt &amp;lt; \infty$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proof for discrete-time systems is similar with the obvious &#xA;change that all the integrals are replaced by sums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideal LPFs are not BIBO-stable &#xA;systems because the impulse response is not absolutely integrable,&#xA;as stated in the answer by yoda.  But his answer does not really answer the question&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can anyone give me a proof that ideal LPF can indeed be BIBO unstable?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A specific example of a bounded input signal that produces an unbounded output&#xA;from an ideal LPF (and thus proves that the system is &lt;em&gt;not&lt;/em&gt; BIBO-stable)&#xA;can be constructed as outlined above (see also my comment on the main question).&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2011-12-27T03:03:38.740" LastActivityDate="2011-12-27T03:03:38.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1035" PostTypeId="1" CreationDate="2011-12-27T06:44:17.980" Score="3" ViewCount="2932" Body="&lt;p&gt;What are the different kinds of noise in speech signal? How can I simulate the same in Matlab for adding to a clean speech signal?&lt;/p&gt;&#xA;" OwnerUserId="555" LastEditorUserId="440" LastEditDate="2012-04-17T09:22:30.733" LastActivityDate="2012-04-17T12:18:57.067" Title="How to simulation different kinds of Noises in speech signal?" Tags="|speech-recognition|speech-synthesis|speech|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1036" PostTypeId="1" CreationDate="2011-12-27T07:51:02.383" Score="8" ViewCount="16898" Body="&lt;p&gt;I'm new to signal processing. I'm plotting a signal in the time-domain in matlab. I don't understand which parts of the signal are high frequencies and low frequencies, can someone explain what a high and low frequency is, and how to see high frequencies and low frequencies on a graph?&lt;/p&gt;&#xA;" OwnerUserId="729" LastEditorUserId="542" LastEditDate="2011-12-28T03:53:52.397" LastActivityDate="2016-12-28T14:22:19.920" Title="What are high frequencies and low frequencies in a signal?" Tags="|fft|discrete-signals|matlab|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1037" PostTypeId="2" ParentId="1036" CreationDate="2011-12-27T18:44:59.810" Score="5" Body="&lt;p&gt;The high frequencies contribute to the fast varying parts of the signal(the sharp transitions),&#xA;while the low frequencies contribute to the slow variations of the signal in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to take a look over here:&#xA;&lt;a href=&quot;http://cns-alumni.bu.edu/~slehar/fourier/fourier.html&quot; rel=&quot;noreferrer&quot;&gt;http://cns-alumni.bu.edu/~slehar/fourier/fourier.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you have the time you might want to take a look at this online course:&#xA;&lt;a href=&quot;http://academicearth.org/courses/the-fourier-transform-and-its-applications&quot; rel=&quot;noreferrer&quot;&gt;http://academicearth.org/courses/the-fourier-transform-and-its-applications&lt;/a&gt;&#xA;You won't regret it.&lt;/p&gt;&#xA;" OwnerUserId="731" LastActivityDate="2011-12-27T18:44:59.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1038" PostTypeId="2" ParentId="1036" CreationDate="2011-12-27T18:52:29.453" Score="4" Body="&lt;p&gt;High and low frequencies are dependent on the application. A low frequency for wifi would be 2.4GHz, while a high frequency would be 5GHz. For human speech a low frequency is 300Hz, while a high frequency is 3000Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A graph of a fft (Fast Fourier Transform) allows us to visualize different frequencies. This example is adapted from &lt;a href=&quot;http://www.mathworks.com/help/techdoc/ref/fft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab's fft help&lt;/a&gt;. The following figure shows the first 100 out of $2^{20}$ samples of a time signal with two frequencies. Note how it is difficult to see the 1Hz component in this figure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0MIIu.png&quot; alt=&quot;Time signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see the frequency content we plot the spectrum as show in the following figure. Here we can clearly see the two frequencies - one at 1Hz and the other at 50Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kAqQ3.png&quot; alt=&quot;Spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I used to generate these plots.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 2^10;        %sample frequency in Hz&#xA;T  = 1/fs;        %sample period in s&#xA;L  = 2^20;        %signal length&#xA;t  = (0:L-1) * T; %time vector&#xA;&#xA;A1 = 0.2; %amplitude of x1 (first signal)&#xA;A2 = 1.0; %amplitude of x2 (second signal)&#xA;f1 = 1;   %frequency of x1&#xA;f2 = 50;  %frequency of x2&#xA;&#xA;x1 = A1*sin(2*pi*f1 * t); %sinusoid 1&#xA;x2 = A2*sin(2*pi*f2 * t); %sinusoid 2&#xA;y  = x1 + x2;&#xA;&#xA;%Plot signal&#xA;figure;&#xA;set(gcf,'Color','w'); %Make the figure background white&#xA;plot(fs*t(1:100), y(1:100));&#xA;set(gca,'Box','off'); %Axes on left and bottom only&#xA;str = sprintf('Signal with %dHz and %dHz components',f1,f2);&#xA;title(str);&#xA;xlabel('time (milliseconds)');&#xA;ylabel('Amplitude');&#xA;&#xA;%Calculate spectrum&#xA;Y = fft(y)/L;&#xA;ampY = 2*abs(Y(1:L/2+1));&#xA;f = fs/2*linspace(0,1,L/2+1);&#xA;i = L/fs * (max(f1,f2)) + 1; %show only part of the spectrum&#xA;&#xA;%Plot spectrum.&#xA;figure;&#xA;set(gcf,'Color','w');  %Make the figure background white&#xA;plot(f(1:i), ampY(1:i));&#xA;set(gca,'Box','off');  %Axes on left and bottom only&#xA;title('Single-Sided Amplitude Spectrum of y(t)');&#xA;xlabel('Frequency (Hz)');&#xA;ylabel('|Y(f)|');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="542" LastEditorUserId="542" LastEditDate="2011-12-28T02:13:50.140" LastActivityDate="2011-12-28T02:13:50.140" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1039" PostTypeId="2" ParentId="1035" CreationDate="2011-12-27T18:54:32.197" Score="2" Body="&lt;p&gt;Types of noises which you could try, that come to my mind at this time are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;White noise,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;pink noise,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;impulsive noise,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;babble(multiple persons speaking in the background)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can generate white(awgn)/pink noise(pass the white noise through a filter) in matlab.&#xA;You could record impulsive noises(pen clicks, knocks on the table, etc), and babble(record yourself and or others multiple times and overlap the recordings)&lt;/p&gt;&#xA;" OwnerUserId="731" LastEditorUserId="731" LastEditDate="2011-12-27T19:01:07.457" LastActivityDate="2011-12-27T19:01:07.457" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1040" PostTypeId="2" ParentId="1036" CreationDate="2011-12-28T02:05:18.543" Score="1" Body="&lt;p&gt;It really depends on what kind of time-domain signal at which you are looking, and how you are looking at it.  Sometimes it's easy to see.  Sometimes it is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are plotting something like amplitude (voltage, pressure, height, etc.) against time, and you see lots of up and down action in a relatively short distance, those may be due to higher frequency spectral content.   If you see some up and down trends over a much larger span those may represent some lower frequencies.  The two may be mixed (added or summed) together over the same span. If you see repeated repetitions of a waveform, that may represent it's own kind of frequency.  Of course this all depends on picking a time scale factor relative to the contextual meaning of your &quot;high&quot; and &quot;low&quot;.  You may need to play with the scale factors to see something of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FFT may or may not be useful, and might even be wildly misleading.  The FFT is more about spectral content in a given aperture width than either high or low frequencies in a signal.  For instance it's possible for a sharp-edged low frequency periodic signal to show lot of high frequency content in an FFT, even for a very low frequency of repitition of the actual signal phenomena.  People looking for musical pitch too often mistake the two.  And FFTs of slices of a longer signal which is absolutely not periodic in the FFT aperture width will misleadingly show up as periodic frequencies in a naive interpretation of the FFT results.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2011-12-28T02:16:51.020" LastActivityDate="2011-12-28T02:16:51.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1041" PostTypeId="1" AcceptedAnswerId="1042" CreationDate="2011-12-28T06:50:31.960" Score="3" ViewCount="258" Body="&lt;p&gt;Is there some mechanism to say whether the image is &quot;clean&quot; for the purpose of image processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the following image, the topmost row is the cleanest and the bottom one is the least clean. As a result, the top-image gives accurate output; the bottom-one gives less accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UMUm0m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Examples of noisy and noise-less images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose is to use the image for Optical Character Recognition.&#xA;And, I wanted to check beforehand, if the image is sufficiently clean or not.&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2011-12-29T04:48:45.333" LastActivityDate="2011-12-30T14:41:21.143" Title="Checking the &quot;cleanliness&quot; of an image for Optical Character Recognition" Tags="|image-processing|optical-char-recognition|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1042" PostTypeId="2" ParentId="1041" CreationDate="2011-12-29T08:07:10.350" Score="4" Body="&lt;p&gt;Your images are gray-scaled. In order to perform the OCR you might want to first threshold it to apply OCR on the binary image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effectiveness of the thresholding will definitely affect the performance of the algorithm. A simple way is say &lt;a href=&quot;http://www.labbookpages.co.uk/software/imgProc/otsuThreshold.html&quot; rel=&quot;nofollow&quot;&gt;Otsu's thresholding&lt;/a&gt;. In your case, you can think of this as character vs. non-character pixels. And the measure of the &lt;em&gt;cleanliness&lt;/em&gt; can be treated as the amount of &lt;em&gt;energy&lt;/em&gt; (such as class variance) of the non-character pixels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the measure I described is &lt;em&gt;post&lt;/em&gt; applying your (first step) of OCR. Hence, I am not sure if this helps you.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="77" LastEditDate="2011-12-30T14:41:21.143" LastActivityDate="2011-12-30T14:41:21.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1044" PostTypeId="2" ParentId="971" CreationDate="2011-12-30T20:24:59.257" Score="4" Body="&lt;p&gt;I agree with the previous suggestions of using a phase accumulator.  Essentially the control input is the amount of phase advance per step or per clock period (or per interrupt or whatever), so that changing that value changes the frequency without a discontinuity in the phase.  The wave amplitude is then determined from the accumulated phase value either via a LUT or just computation of sin(theta) or cos(theta).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is essentially what is commonly known as a Numerically Controlled Oscillator (NCO) or a Direct Digital Synthesizer (DDS).  Doing a web search on those terms will probably yield more than you want to know on the theory and practice of making them work well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding an additional accumulator can allow seamless transitions between frequencies, as you suggested, if that's desired as well, by controlling the rate of change of the phase advance value.  This is sometimes called a Digital Differential Analyzer, or DDA.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2011-12-30T20:24:59.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1045" PostTypeId="1" CreationDate="2012-01-01T17:39:59.010" Score="4" ViewCount="1081" Body="&lt;p&gt;I am providing &lt;strong&gt;2 d grey scale&lt;/strong&gt; images to the &lt;strong&gt;anisotropic diffusion function&lt;/strong&gt; in MATLAB but not getting desired outputs. How many iterations are ideal and how should i approach this problem?I am keeping kappa values between 20 to 100. I am carrying out the operations on the standard &lt;strong&gt;lena&lt;/strong&gt; image by adding &lt;strong&gt;salt and pepper noise&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input Image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VzbOr.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expected Output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of 80 iterations of anisotropic diffusion with k=10&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UnbMo.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="873" LastEditorUserId="128" LastEditDate="2018-08-23T09:16:39.157" LastActivityDate="2018-08-23T09:16:39.157" Title="Anisotropic Diffusion Outputs" Tags="|image-processing|anisotropic-diffusion|edge-preserving-filter|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="1046" PostTypeId="2" ParentId="726" CreationDate="2012-01-02T03:29:22.750" Score="1" Body="&lt;p&gt;Here's a simple process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Assign texture measurements to each region in the image. &lt;/li&gt;&#xA;&lt;li&gt;Use a region labeling / connectivity algorithm (or region growing algorithm) to join adjacent regions having the same texture measure.&lt;/li&gt;&#xA;&lt;li&gt;Implement a simple edge-following algorithm to trace the contour of each region.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Law's Texture Measures are an older but still useful technique for determining the texture in an image, and they may be sufficient for you to distinguish texture A from texture B throughout the image. See the section &quot;Laws Texture Energy Measures&quot; in the Wikipedia article:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Image_texture&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Image_texture&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a first step, calculate all texture measures and determine which particular measure (e.g. Edge or Spot) allows you to distinguish one texture from the other most easily. (If you post some pictures I could help you identify a texture measure.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have only two textures, A and B, then you can treat them as foreground and background, and a standard region labeling algorithm will work. To make it easier to see what's happening in the processing, you could generate a new image by assigning A texels (texture elements, little chunks of texture) to the color white, and B texels to the color black. Region labeling and/or contour-following algorithms would then find the connected white and black regions. The findContours() function in OpenCV will work well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Connected-component_labeling&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same Wikipedia article includes both the traditional multipass algorithm as well as a single-pass algorithm. I haven't implemented the single-pass algorithm described there, but I have worked with the single-pass algorithm described in the paper &quot;A Component-Labeling Algorithm Using Contour Tracing Technique&quot; by Chen and Chang. The paper by Chen and Chang also describes a standard contour-following algorithm that can be implemented quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have more than two textures, then you might use a &lt;strong&gt;watershed&lt;/strong&gt; or &lt;strong&gt;mean shift&lt;/strong&gt; algorithm to cluster regions together after you've remapped textures to colors. Although this remapping from texture to color isn't necessary, it does make the process easier to debug and understand.&lt;/p&gt;&#xA;" OwnerUserId="742" LastActivityDate="2012-01-02T03:29:22.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1047" PostTypeId="2" ParentId="6" CreationDate="2012-01-02T03:56:45.880" Score="5" Body="&lt;p&gt;For very fine resolution your best bet is likely a cheap and readily available laser depth gauge from Keyence. They work, they're relatively cheap, and they're an industry standard.&#xA;&lt;a href=&quot;http://www.keyence.com/products/measure/laser/laser.php&quot; rel=&quot;noreferrer&quot;&gt;http://www.keyence.com/products/measure/laser/laser.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cheapest 2D optical technique could be to create a &quot;shadow Moire&quot; system using Ronchi rulings. With the guidance of an optical engineer some years ago, I designed some handheld devices to measure small deformations in matte metal surfaces. We were able to detect depth changes of about 100 microns (0.1 millimeters) fairly readily, and although I don't recall exactly we might have been able to detect depth differences of about 10 - 20 microns. The fringe pattern is easy to interpret, and also provides a convenient height map. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a reasonable explanation of the shadow Moire technique:&#xA;&lt;a href=&quot;http://www.ndt.net/article/wcndt00/papers/idn787/idn787.htm&quot; rel=&quot;noreferrer&quot;&gt;http://www.ndt.net/article/wcndt00/papers/idn787/idn787.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Ronchi ruling can cost about $100:&#xA;&lt;a href=&quot;http://www.edmundoptics.com/products/displayproduct.cfm?productid=1831&quot; rel=&quot;noreferrer&quot;&gt;http://www.edmundoptics.com/products/displayproduct.cfm?productid=1831&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The device itself consists of a Ronchi ruling (which is a slab of glass with precision deposited lines), a light source mounted at a fixed angle to the ruling, and a viewing tube which is also set to a precise angle relative to the ruling. Our device was placed in direct contact with the surface, but you could also create a non-contact device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've cobbled the device together you'll want to calibrate it. Whatever the expected number of fringes per millimeter may be according to the math, you'll still need to calibrate it. For calibration we used thin gauge blocks, the thinnest being a mylar sheet of a known thickness of 1/2 mil (0.0005 inches, about 12.5 microns). You place the device with the ruling on a flat, semi-reflective surface with the gauge block tucked under one edge of the ruling. This generates a series of fringes. You know the height of the gauge block and the length of the ruling, so using a little trigonometry you can calculate the number of fringes per millimeter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Laser triangulation with a single camera is also an option, but is generally much trickier than it first appears. It can take a lot of work to achieve a depth accuracy of about 0.1mm using laser triangulation, and there are quite a few gotchas involved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For high accuracy surface scanning you could spend up to $100k to buy a really nice system based on confocal microscopy. They're wicked cool.&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Confocal_microscopy&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Confocal_microscopy&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="742" LastActivityDate="2012-01-02T03:56:45.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1048" PostTypeId="1" AcceptedAnswerId="1050" CreationDate="2012-01-02T18:01:02.780" Score="1" ViewCount="1078" Body="&lt;p&gt;I build a signal, $x$, which is linear in the frequency domain as (in MATLAB syntax)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = 1:0.1:1e3;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = (ifft(x));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I would like to build a binary signal (zeros and ones) from $y$, but I can't define any threshold value such that &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if y(index) &amp;gt; threshold &#xA;    y(index) = 1&#xA;else y(index) = 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I implement a chirp of zeros and ones in the time domain?  &lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="77" LastEditDate="2012-01-02T19:30:31.850" LastActivityDate="2012-01-04T16:43:33.773" Title="How can I implement a binary chirp signal containing zeros and ones?" Tags="|fft|discrete-signals|matlab|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1049" PostTypeId="1" AcceptedAnswerId="1051" CreationDate="2012-01-02T19:30:59.723" Score="9" ViewCount="2800" Body="&lt;p&gt;Every time I think I have understood the covariance matrix, someone else comes up wih a different formulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently reading this paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://dx.doi.org/10.1121/1.428310&quot; rel=&quot;noreferrer&quot;&gt;J. Benesty, &lt;em&gt;&quot;Adaptive eigenvalue decomposition algorithm for passive acoustic source localization&quot;&lt;/em&gt;, J. Acoust. Soc. Am. Volume &lt;strong&gt;107&lt;/strong&gt;, Issue 1, pp. 384-391 (2000)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and I have come across a formulation I do not quite understand. Here, the author is constructing the covariance matrix between two signals, $x_1$, and $x_2$. Those two signals are from different sensors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the covariance matrix of one signal, I know that we can get it by calculating the regression matrix, and then multiply it by the Hermitian of that same matrix, and dividing by $N$, the length of the original vector. The size of the covariance matrix here can be arbitrary, with maximum size being $N\times N$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the covariance matrix of two spatial signals, if we place the first signal in the first row, and the second signal in the second row of a matrix, then multiply by its Hermitian, and also divide by $N$, then we get a $2\times 2$ covariance matrix of both spatial signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in this paper, the author computes what looks like &lt;em&gt;four&lt;/em&gt; matricies, $R_1{}_1, R_1{}_2, R_2{}_1$, and $R_2{}_2$, and then puts them into a super matrix and calls that the covariance matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this so? Here is an image of the text:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cdsLv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="77" LastEditDate="2012-01-02T20:43:06.020" LastActivityDate="2012-01-06T09:55:59.793" Title="Question on covariance matrix of 2 spatial signals" Tags="|covariance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1050" PostTypeId="2" ParentId="1048" CreationDate="2012-01-02T20:28:46.373" Score="2" Body="&lt;p&gt;Instead of building the chirp signal in frequency domain you could build it in time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could generate a sin signal with an increasing frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your threshold could be 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fmin = 0.001;&#xA;fmax = 50*fmin;&#xA;numOfSamples = 1500;&#xA;f = linspace(fmin,fmax,numOfSamples);&#xA;t = 1 : numOfSamples;&#xA;&#xA;w = 2 * pi * f;&#xA;&#xA;x = sin(w.*t);&#xA;plot(x)&#xA;binaryChirp = floor(1 + x);&#xA;figure,plot(binaryChirp)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: You might be aware of this, but I'd like to point out that the method you described in your question will generate complex samples, so I don't think you can compare them directly to a threshold.&lt;/p&gt;&#xA;" OwnerUserId="731" LastEditorUserId="731" LastEditDate="2012-01-02T20:41:48.427" LastActivityDate="2012-01-02T20:41:48.427" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1051" PostTypeId="2" ParentId="1049" CreationDate="2012-01-02T21:40:19.767" Score="6" Body="&lt;p&gt;If you have two signal vectors $x_1[n]$ and $x_2[n]$ each of $N$ elements, then there are two different things we can consider.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do the quantities $\displaystyle\sum_{n=1}^N x_i[n]x_j[n],~ i, j \in \{1,2\}$ compare?  In particular, when the signals are &lt;em&gt;noisy&lt;/em&gt; and the noises can be considered &#xA;to be &lt;em&gt;jointly&lt;/em&gt; stationary (or jointly wide-sense stationary), these quantities can be used to estimate the noise variances in the two signals as well as the covariance of the noises &lt;em&gt;at any fixed sampling time.&lt;/em&gt;  This is what you get from the $2\times 2$&#xA;covariance matrix&#xA;$$R_{2\times 2} = \left[\begin{matrix} \sigma_1^2 &amp;amp; C\\&#xD;&#xA;C &amp;amp; \sigma_2^2\end{matrix}\right].$$&#xA;The noise in $x_1[n]$ has variance &#xA;$\sigma_1^2 = R_{1,1}$ which might be different&#xA;from $R_{2,2} = \sigma_2^2$, the variance of the noise in $x_2[n]$.  But the noises are&#xA;correlated with covariance $R_{1.2}=R_{2,1} = C$.  Now, if we plan on doing things&#xA;with just what happens at $n$, ignoring whatever might be happening at $n-1$ or $n+1$&#xA;etc., then this is all the information we need.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Unless the noise is known to be (or assumed to be) white noise so that noise&#xA;samples from different sampling instants are independent (and therefore uncorrelated)&#xA;or we simply assume uncorrelated noise samples, there is information that we &#xA;are ignoring by not considering the correlation between $x_1[n]$ and $x_1[m]$,&#xA;samples from the same process at different times or locations, and the correlation between $x_1[n]$ and $x_2[m]$, samples from the two processes at different times&#xA;or locations.  This additional information might lead to a better estimate/solution.&#xA;Now  we have a total of $2N$ noise samples,&#xA;and therefore a $2N \times 2N$ covariance matrix to consider.  If we &#xA;arrange matters the way the authors did, we have&#xA;$R_{\text{full}} = E[XX^T]$ where &#xA;$$X = (x_1[1],x_1[2],\ldots,x_1[N],x_2[1],x_2[2],\ldots,x_2[N])^T &#xD;&#xA;= (\mathbf x_1,\mathbf x_2)^T$$&#xA;and so&#xA;$$R_{\text{full}} = \left[&#xD;&#xA;\begin{matrix}R_{\mathbf x_1,\mathbf x_1} &amp;amp; R_{\mathbf x_1,\mathbf x_2}\\&#xD;&#xA;R_{\mathbf x_2,\mathbf x_1} &amp;amp; R_{\mathbf x_2,\mathbf x_2}\end{matrix}&#xD;&#xA;\right]$$ where $R_{\mathbf x_i,\mathbf x_j} = E[\mathbf x_i\mathbf x_j^T]$.&#xA;Note that $R_{\mathbf x_i,\mathbf x_j}$ is, in essence, the &#xA;&lt;em&gt;cross-correlation&lt;/em&gt; function of $(x_i[1],x_i[2],\ldots,x_i[N])$&#xA;and $(x_j[1],x_j[2],\ldots,x_j[N])$ if $i \neq j$ and the &#xA;&lt;em&gt;autocorrelation&lt;/em&gt; function if $i = j$.  If the noise processes are white and&#xA;uncorrelated except when $n = m$, then &#xA;$$R_{\text{full}} \rightarrow R_{\text{simple}} = \left[ \begin{matrix}\sigma_1^2I &amp;amp; CI\\&#xD;&#xA;CI &amp;amp; \sigma_2^2I \end{matrix}\right]$$&#xA;where $I$ is the $N\times N$ identity matrix, and &#xA;$\sigma_1^2, \sigma_2^2$ and $C$ are as defined in Item 1 above.&#xA;How realistic this noise model might be is something for the end user&#xA;to determine. If the model &lt;em&gt;is&lt;/em&gt; realistic, then nothing is gained&#xA;by looking at the $2N\times 2N$ matrix $R_{\text{full}}$&#xA;since all the information is there&#xA;in the $2\times 2$ matrix $R_{2\times 2}$ of Item 1 above.  Ditto if the model is&#xA;unrealistic but we don't intend to (or are unable to)&#xA;use all the information in the full &#xA;$2N\times 2N$ matrix $R_{\text{full}}$; we will make do&#xA;with just $\sigma_1^2, \sigma_2^2$ and $C$ of Part 1&#xA;for which we don't need $R_{\text{full}}$ or $R_{\text{simple}}$,&#xA;just $R_{2\times 2}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-01-06T09:55:59.793" LastActivityDate="2012-01-06T09:55:59.793" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1052" PostTypeId="2" ParentId="6" CreationDate="2012-01-03T08:04:20.990" Score="2" Body="&lt;p&gt;I've worked in metrology in a past life. Systems l&lt;a href=&quot;http://www.gom.com/metrology-systems/3d-motion-analysis.html&quot; rel=&quot;nofollow&quot;&gt;ike this one&lt;/a&gt; both use the stereoscopy and claim to achieve about 1 microns precision (sub-pixel accuracy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution with a laser scanner and an encoder would be another solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My job was to test those systems. It was not possible to achieve desired precision reliably. In fact, most vendors were artificially boosting their numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest going for a microscope. The automated way is highly dependent on a large number of factors that will restrict you from achieving the precision you need. The aerospace industry uses &lt;a href=&quot;http://en.wikipedia.org/wiki/Coordinate-measuring_machine&quot; rel=&quot;nofollow&quot;&gt;CMMs&lt;/a&gt; for measuring parts, which goes well over 100k$ and are having a hard time achieving such precision in a controlled temperature room with controlled atmospheric pressure and humidity. Also these systems suffer from wear and must be recalibrated all the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But above all, all trade secrets of those systems are in the calibration algorithms. This really makes the secret sauce and this is how software and a few 5k$ cameras can sell for over 100k$&lt;/p&gt;&#xA;" OwnerUserId="747" LastActivityDate="2012-01-03T08:04:20.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1053" PostTypeId="2" ParentId="1048" CreationDate="2012-01-03T14:14:27.533" Score="7" Body="&lt;p&gt;&lt;em&gt;What is a chirp signal?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A chirp signal is a sinusoidal signal of the form $\sin(bt+\frac{1}{2}at^2)$ whose &lt;em&gt;instantaneous radian frequency&lt;/em&gt; (the derivative with respect to time of the argument of the sine, viz. $b+ at$, is a linear function of $t$. If the chirp signal is of&#xA;duration $T$, then the instantaneous frequency at the end is $B=b+aT$.&#xA;If $a &amp;gt; 0$, the frequency increases&#xA;with time from the initial value $b$ to its maximum value $B$ at $t = T$,&#xA;while if $a&amp;lt;0$, the frequency decreases from&#xA;$b$ downwards to the minimum value $B$ at $t = T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Is the Fourier transform of a chirp signal constant over &#xA;the frequency range $[b,B]$  (or $[B,b]$ for pessimists who choose $a &amp;lt; 0$)?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, the Fourier transform is not constant over this&#xA;frequency range.  Nor does the DFT have equal amplitude&#xA;in all bins if we sample the chirp signal and compute its DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What is a fake chirp signal?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fake chirp signal is one whose instantaneous radian frequency&#xA;increases in steps of equal height $\Delta = (B-b)/n$ but decreasing &#xA;durations so that it consists of one full period of $\sin(bt)$ &#xA;followed by one full period of $\sin((b+\Delta)t)$ followed by one &#xA;full period of $\sin((b+2\Delta)t)$, $\ldots$, followed by one full period&#xA;of $\sin((b+(n-1)\Delta)t) = \sin((B-\Delta)t)$.  Note that the total&#xA;duration is&#xA;$$T = 2\pi\left[\frac{1}{b} + \frac{1}{b+\Delta} &#xD;&#xA;+ \cdots + \frac{1}{b+(n-1)\Delta}\right]$$&#xA;To maintain phase continuity, we insist that each full period start &#xA;and end at $0$ amplitude and $0$ phase so that, for example, between &#xA;$t=\frac{2\pi}{b}$ and $t=\frac{2\pi}{b}+\frac{2\pi}{b+\Delta}$ when&#xA;we have a sinusoid of radian frequency $b+\Delta$, &#xA;the exact mathematical expression&#xA;for the signal is $\sin((b+\Delta)t+\theta)$ where $\theta$ is chosen&#xA;so that $(b+\Delta)\frac{2\pi}{b}+\theta$ is an integer multiple of $2\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What is a binary chirp signal?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you create a chirp signal, sample it, and hard-limit it to $\pm 1$ &#xA;(or, as you prefer, shift the dc level so that the signal is $0$s and $1$s) &#xA;then you can &lt;em&gt;call&lt;/em&gt; it a binary chirp signal, but you shouldn't&#xA;expect it to have the properties one expects of a chirp&#xA;signal.  In any case, it is necessary to have $b,B \ll f_s$&#xA;where $f_s$ is the sampling rate to get something reasonable.&#xA;If you don't want to go through the hassle of creating a sampled&#xA;chirp signal, etc. you can get something that can be called&#xA;a &lt;strong&gt;faker&lt;/strong&gt;  binary chirp signal very simply.  Here are&#xA;two examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$111110000011110000111000110010~\text{or}~1111100001110010$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first sequence is effectively one period of a sinusoid with $10$ samples&#xA;per period followed by one period of a sinusoid with $8$ samples&#xA;per period followed by one period of a sinusoid with $6$ samples per period,&#xA;etc.  The second sequence has half periods of sinusoids with decreasing&#xA;numbers of samples per period.  I call this a &lt;strong&gt;faker&lt;/strong&gt; binary chirp&#xA;signal because instead of the &lt;em&gt;frequency&lt;/em&gt; of the sinusoid&#xA;increasing in constant steps, it is the &lt;em&gt;period&lt;/em&gt; of the sinusoid&#xA;that is decreasing in constant steps.  So we don't have the linear&#xA;frequency sweep that characterizes chirp signals.  But the signal is&#xA;trivial to synthesize, and if $b, B \ll f_s$, the difference between&#xA;a fake binary chirp and a faker binary chirp can be small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't read MATLAB but if &lt;code&gt;x = 1:0.1:1e3;&lt;/code&gt; means that it is desired &#xA;that the frequency sweep from $1$ Hz to $1000$ Hz (or by a factor of $1000$&#xA;in general), then the digital sequence (whether sampled from a true chirp&#xA;pr a fake chirp or synthesized as a faker chirp) is going to begin with &#xA;&lt;strong&gt;long&lt;/strong&gt; strings of $1$s followed by &lt;strong&gt;long strings&lt;/strong&gt; of $0$s.  Matters &#xA;will be even worse&#xA;if a frequency resolution or step size $\Delta$ of $0.1$ Hz is required.  &lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-01-04T16:43:33.773" LastActivityDate="2012-01-04T16:43:33.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1054" PostTypeId="1" AcceptedAnswerId="1061" CreationDate="2012-01-03T15:28:52.337" Score="16" ViewCount="4639" Body="&lt;p&gt;In my project, I have to digitize an ECG image taken with a normal camera (jpeg). For example, I have the following camera captured image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/500Kg.jpg&quot; alt=&quot;Before&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I want to get something like this:- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OzmQI.jpg&quot; alt=&quot;After&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then the digitized data (x,y points), like in this video &lt;a href=&quot;http://www.youtube.com/watch?v=yCIeKc__LdM&quot; rel=&quot;noreferrer&quot;&gt;on digitization of ECG&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea how to do it, so I searched and consulted several research papers. The general approach of the algorithms is like:-&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;change to gray level image&lt;/li&gt;&#xA;&lt;li&gt;delete gridlines&lt;/li&gt;&#xA;&lt;li&gt;add missing points&lt;/li&gt;&#xA;&lt;li&gt;convert 2D image to 1D image&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am stuck with the second point, i.e., deleting the gridlines. I looked up some more references to do this and found histogram analysis might be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please guide me on how to do this (I'm using MATLAB 2010)? Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="762" OwnerDisplayName="Deepak" LastEditorUserId="762" LastEditDate="2012-01-08T15:10:32.320" LastActivityDate="2012-12-10T22:34:17.717" Title="How do I recover the signal from an ECG image" Tags="|image-processing|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1055" PostTypeId="2" ParentId="1054" CreationDate="2012-01-03T16:53:09.237" Score="5" Body="&lt;p&gt;You have a colour image where the gridlines are red and the trace is black. so simply ignore any pixels which are red!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't be sure the image is exactly aligned you could use the grid lines to calculate a skew (simply the slope of the image in pixels/pixel as you go right).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then turning the black trace into a 1d value is simple. Start in the first column at the left edge and find the black pixel (or centroid of a small connected group of pixels) - the vertical position is your value.&lt;br&gt;&#xA;Do that for each column in the image.&lt;br&gt;&#xA;Where you have a missing value you will need to interpolate between the known values before and after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For extra points you could set a limit on how much the trace can change from column-column to allow you to spot random dots or noise spikes.&lt;/p&gt;&#xA;" OwnerUserId="1002" OwnerDisplayName="Martin Beckett" LastActivityDate="2012-01-03T16:53:09.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1059" PostTypeId="1" CreationDate="2012-01-02T12:28:58.917" Score="4" ViewCount="7107" Body="&lt;p&gt;I have a set of pressure data at a sampling rate of 262144 Hz for 3 seconds making it 786432 samples of pressure data. I want to plot a curve of the SPL (sound pressure level) vs frequency. I first converted pressure data to SPL using $20\log_{10}(P/P_{ref})$ and performed a 4096 point FFT for the 192 segments of data and averaged them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I couldn't get the required SPL values in decibels. Was the approach correct? If not, could you please point out the mistake in my approach?&lt;/p&gt;&#xA;" OwnerDisplayName="Fayaaz Hussain" LastEditorUserId="77" LastEditDate="2012-01-03T17:24:51.493" LastActivityDate="2012-01-03T17:54:37.033" Title="How do you plot an SPL vs frequency curve for a given set of pressure data?" Tags="|fft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1060" PostTypeId="2" ParentId="1059" CreationDate="2012-01-02T20:01:35.943" Score="6" Body="&lt;p&gt;The steps will be, in this order:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;apply &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;noreferrer&quot;&gt;window function&lt;/a&gt; (e.g. Hann or Hamming)&lt;/li&gt;&#xA;&lt;li&gt;calculate FFT&lt;/li&gt;&#xA;&lt;li&gt;calculate magnitude of FFT (&lt;code&gt;sqrt(re*re+im*im)&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;convert magnitude to dB (&lt;code&gt;20*log10(magnitude)&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;apply combined correction/calibration factors (window function compensation, FFT factor of N scaling if needed, factor of 2 for symmetric FFT, Pref calibration, etc) - this can just be a single dB correction value that you add to the dB magnitude values&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If your Pref calibration data varies with frequency (e.g. microphone with non-flat frequency response) then it's a little more complicated than the above, but the same basic principles apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that if you want weighted dB SPL (e.g. A weighting) then you'll also need to apply the relevant frequency dependent weighting corrections.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastEditorUserId="39" LastEditDate="2012-01-03T17:54:37.033" LastActivityDate="2012-01-03T17:54:37.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1061" PostTypeId="2" ParentId="1054" CreationDate="2012-01-03T17:46:08.143" Score="18" Body="&lt;p&gt;Sorry, I use Mathematica, but it should be really easy to implement the idea into Matlab. I give the code anyway, so when my description is not detailed enough, you can get the rest from the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic idea is: you look at your image column-wise. Process every column of pixels separately. Note, that in the plot, I inverted the gray-values. So black is 1 and white is 0.&lt;br&gt;&#xA;If you plot the (inverted) brightness-pixel-values you have basically only two situations. The first one is, when your column is not on a vertical grid line. The the plot looks like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/f5qJo.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second situation is, where you are directly on a vertical grid line. Then the grid line influences the brightness of the whole column&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3ctgz.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what you see is, that your dark EEG seems to be always the maximum. Therefore, the very complex algorithm is: Go through every column and take the position of the most black pixel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = ColorConvert[&#xA;   ImagePad[&#xA;    Import[&quot;https://i.stack.imgur.com/500Kg.jpg&quot;], {{0, -20}, {0, 0}}],&#xA;    &quot;Grayscale&quot;];&#xA;&#xA;Image[&#xA; Transpose[Function[With[{m = Min[#]},&#xA;     Map[Function[{v}, If[v == m, 1, 0]], #]]] /@ &#xA;   Transpose[ImageData[img, &quot;Real&quot;]]&#xA;  ]&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note, that I croped a bit of the right side of you image, since it was completely white there. The result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g1oHS.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can join the points or interpolate them in every way you like and you get your EEG&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vnasg.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="748" LastEditorUserId="77" LastEditDate="2012-01-03T17:52:27.693" LastActivityDate="2012-01-03T17:52:27.693" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1063" PostTypeId="2" ParentId="912" CreationDate="2012-01-03T21:32:12.773" Score="8" Body="&lt;p&gt;You may want to check out the different code libraries available from the &lt;a href=&quot;http://soundlab.cs.princeton.edu/research/&quot;&gt;Princeton Sound Lab&lt;/a&gt; such as &lt;a href=&quot;https://ccrma.stanford.edu/software/stk/&quot;&gt;STK&lt;/a&gt; (MARSYAS mentioned by cufmo is but one of their projects).  You may be able to achieve the goals for your project by combining the relevant features of the different libraries there.&lt;/p&gt;&#xA;" OwnerUserId="749" LastActivityDate="2012-01-03T21:32:12.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1064" PostTypeId="1" CreationDate="2012-01-04T09:58:01.703" Score="-1" ViewCount="479" Body="&lt;p&gt;I am trying to create a histogram of the depth videos (converted to grayscale first) in order to apply a threshold to keep only highest values, and then do some dilation in order to extract contours. Apparently I am stuck, and &lt;strong&gt;besides that i don't know if what I am thinking is the right way to extract contours from depth videos&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following code I got stuck in the point of applying the threshold. I think that iam applying it in the wrong way. Which is the correct to apply a threshold in this situation in order to obtain a black and white image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions or tutorials would be awesome!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int bins = 256;&#xA;int hsize[] = {bins};&#xA;&#xA;//max and min value of the histogram&#xA;float max_value = 0, min_value = 0;&#xA;&#xA;float value;&#xA;int normalized;&#xA;&#xA;//ranges - grayscale 0 to 256&#xA;float xranges[] = { 0, 256 };&#xA;float* ranges[] = { xranges };&#xA;&#xA;//image is the actual source from input depth video&#xA;gray = cvCreateImage( cvGetSize(image), 8, 1 );&#xA;cvCvtColor( image, gray, CV_BGR2GRAY );&#xA;&#xA;cvNamedWindow(&quot;original&quot;,1);&#xA;cvNamedWindow(&quot;gray&quot;,1);&#xA;cvNamedWindow(&quot;histogram&quot;,1);&#xA;cvNamedWindow(&quot;black &amp;amp; white&quot;,1);&#xA;&#xA;IplImage* planes[] = { gray };&#xA;&#xA;//get the histogram and some info about it&#xA;hist = cvCreateHist( 1, hsize, CV_HIST_ARRAY, ranges,1);&#xA;cvCalcHist( planes, hist, 0, NULL);&#xA;cvGetMinMaxHistValue( hist, &amp;amp;min_value, &amp;amp;max_value);&#xA;printf(&quot;min: %f, max: %f\n&quot;, min_value, max_value);&#xA;&#xA;imgHistogram = cvCreateImage(cvSize(bins, image-&amp;gt;height),8,1);&#xA;cvRectangle(imgHistogram, cvPoint(0,0), cvPoint(256,image-&amp;gt;height), CV_RGB(255,255,255),-1);&#xA;&#xA; //I think that here i have messed up things :( Any suggestions ???&#xA;bw_img = cvCreateImage(cvGetSize(imgHistogram), IPL_DEPTH_8U, 1);&#xA;cvThreshold(imgHistogram, bw_img, 150, 255, CV_THRESH_BINARY);&#xA;&#xA;//draw the histogram&#xA;for(int i=0; i &amp;lt; bins; i++){&#xA;        value = cvQueryHistValue_1D( hist, i);&#xA;        normalized = cvRound(value*image-&amp;gt;height/max_value);&#xA;        cvLine(imgHistogram,cvPoint(i,image-&amp;gt;height), cvPoint(i,image-&amp;gt;height-normalized), CV_RGB(0,0,0));&#xA;}&#xA;&#xA;//show the image results&#xA;cvShowImage( &quot;original&quot;, image );&#xA;cvShowImage( &quot;gray&quot;, gray );&#xA;cvShowImage( &quot;histogram&quot;, imgHistogram );&#xA;cvShowImage( &quot;balck &amp;amp; white&quot;, bw_img);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Images showing the step processes&#xA;1) source video input ( &lt;a href=&quot;http://imageshack.us/photo/my-images/823/sourcevideo.jpg/&quot; rel=&quot;nofollow&quot;&gt;http://imageshack.us/photo/my-images/823/sourcevideo.jpg/&lt;/a&gt; )&#xA;2) gray-scale video ( &lt;a href=&quot;http://imageshack.us/photo/my-images/23/grayscalei.jpg/&quot; rel=&quot;nofollow&quot;&gt;http://imageshack.us/photo/my-images/23/grayscalei.jpg/&lt;/a&gt; )&#xA;3) binary video ( &lt;a href=&quot;http://imageshack.us/photo/my-images/684/binaryi.jpg/&quot; rel=&quot;nofollow&quot;&gt;http://imageshack.us/photo/my-images/684/binaryi.jpg/&lt;/a&gt; )&#xA;4) final contour output ( &lt;a href=&quot;http://imageshack.us/photo/my-images/35/finaloutput.jpg/&quot; rel=&quot;nofollow&quot;&gt;http://imageshack.us/photo/my-images/35/finaloutput.jpg/&lt;/a&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The images show what i would like to accomplish but for depth videos.&#xA;I got problem obtaining the binary video. I have create a histogram and i haven't found a way to apply threshold in order to obtain highest pixel values and to transform the video to black and white.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;First of all, what i am asking is what are right steps to extract contours from depth videos and if my approach is correct or not as described below??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) grayscale an image&#xA;2) create histogram&#xA;3) apply threshold to convert to black and white image and keep only highest pixel values&#xA;4) (dilation/erosion) depends on the black and white image&#xA;5) find contours on the black and white image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second of all, my prolem is how can i create a binary(black and white image) with only the highest values retrived from the histogram of a gray-scale image??? I think that I am applying it the wrong way because i don't get the expected result (black &amp;amp; white image), the only thing i get is a totaly black image and nothing else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third of all, i have put the code to make things more clear and not vaguely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="754" LastEditorUserId="77" LastEditDate="2012-01-06T18:43:26.970" LastActivityDate="2012-01-22T14:53:32.313" Title="Which are the steps to extract contours/shapes from depth videos?" Tags="|image-processing|computer-vision|algorithms|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1065" PostTypeId="2" ParentId="275" CreationDate="2012-01-04T10:12:43.970" Score="2" Body="&lt;p&gt;Your intuition is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you may want to give a shot to a novel tecnique (GUSSS, Guided Underdetermined Source Signal Separation), described in &lt;a href=&quot;http://dx.doi.org/10.1109/ICORR.2011.5975392&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;. The intuition is to extract an already known signal from another one.&#xA;Let's say we have your EEG as $x$ and ECG as $s$: we can see $x$ as a mixture of the signal $s$ plus another mixture $\tilde{s}$ so that $$x=c_ss+\tilde{s}$$ where $c_s$ is the weight of $s$ into $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we sum $$x_s = w_xx+w_ss = w_x(c_ss+\tilde{s})+w_ss = w_x\tilde{s}+ks$$ where $k=(w_xc_s+w_s)$, we can extract how $s$ is into $x$ (as $c_s$) since feeding $\left[\begin{array}{c} x\\ x_s \end{array}\right]$ into ICA gives you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;A=\left[\begin{array}{cc} 1 &amp;amp; c_s\\ w_x &amp;amp; k \end{array}\right], \; S = \left[\begin{array}{c} \tilde{s} \\ s \end{array}\right]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have $c_p$ you can subtract the signal from the EEG, repeating the process for every sensor.&lt;/p&gt;&#xA;" OwnerUserId="752" LastEditorUserId="752" LastEditDate="2012-01-07T15:09:43.277" LastActivityDate="2012-01-07T15:09:43.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1066" PostTypeId="1" AcceptedAnswerId="1069" CreationDate="2011-03-11T04:41:43.503" Score="10" ViewCount="1242" Body="&lt;p&gt;I have discrete time series containing signal with smoothly varied frequency over time (called a &quot;sweep&quot;). How can I design a discrete filter (low-pass or band-pass in my case) of a finite length with linearly varying cut-frequency over time and constant cut-slope?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: the signal is the sampled &lt;code&gt;&quot;trace&quot;&lt;/code&gt; of the seismic source - a seismic vibrator, which sends the vibrations of the slowly varying frequency down the earth. The dependency of the frequency over time (the sweep) is known (let it be linear, $f(t)=f_1*(1-t)+f_2*t)$, but there is a problem that there might be another vibrators that operate on their own, and the task is to &lt;code&gt;&quot;band-guard&quot;&lt;/code&gt; the trace of this vibrator avoiding the unwanted signals from other ones.&lt;/p&gt;&#xA;" OwnerUserId="745" OwnerDisplayName="mbaitoff" LastEditorUserId="1473" LastEditDate="2012-06-06T13:26:00.947" LastActivityDate="2012-06-06T21:56:16.323" Title="How to design a continuously time-variant digital filter?" Tags="|filters|filter-design|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1067" PostTypeId="1" AcceptedAnswerId="1068" CreationDate="2012-01-04T14:58:14.760" Score="9" ViewCount="8006" Body="&lt;p&gt;I am working on &lt;a href=&quot;http://en.wikipedia.org/wiki/Anisotropic_diffusion&quot;&gt;anisotropic diffusion&lt;/a&gt; and the two coefficients proposed by &lt;a href=&quot;http://authors.library.caltech.edu/6498/1/PERieeetpami90.pdf&quot;&gt;Perona &amp;amp; Malik&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to know what is the use of diffusion in image processing? Why is anisotropic diffusion important and in which fields is it commonly used?&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="77" LastEditDate="2012-01-04T16:01:12.657" LastActivityDate="2012-01-04T16:37:44.740" Title="Why is anisotropic diffusion useful in image processing?" Tags="|image-processing|anisotropic-diffusion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1068" PostTypeId="2" ParentId="1067" CreationDate="2012-01-04T15:20:45.677" Score="11" Body="&lt;p&gt;The anisotropic diffusion algorithm by Perona and Malik is the pioneering work in partial derivatives equations (PDE)-based denoising.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It applies the law of diffusion on pixel intensities to smooth textures in an image. A threshold function is used to prevent diffusion to happen across edges, and therefore it preserves edges in the image. (Unlike for instance gaussian blur filter.) This makes it very interesting if you want to remove noise, but do not want to smooth out the edges of your image, for instance if you want to use these edges to segment the image, without being perturbed by the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Numerous efforts have been made that build on it, improving or extending it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for where it is used, I only have a limited culture. I can cite two&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Image analysis in the Life-Science field (where I work): the images that you can get out of a microscope are extremely noisy, and most of the time, it is by construction. Automated image analysis of these data often involve segmentation, for which you sometimes PDE-based algos.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Video games! For instance, try playing Mass Effect (the first one at least).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="756" LastEditorUserId="756" LastEditDate="2012-01-04T16:37:44.740" LastActivityDate="2012-01-04T16:37:44.740" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1069" PostTypeId="2" ParentId="1066" CreationDate="2012-01-04T16:53:09.770" Score="4" Body="&lt;p&gt;One approach would be to try to remove the frequency chirp from the observed data, thus translating all of the echoes to approximately baseband. I find this to be most straightforward by converting the observation to an &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;analytic signal&lt;/a&gt;, then multiplying by a complex exponential whose instantaneous frequency is equal to $-1$ times the frequency chirp profile (while keeping its phase continuous). After dechirping the received data, you could then apply a lowpass filter to suppress any other sources that don't overlap in frequency with your chirp profile. If your followon analysis methods need to see the frequency ramp, you could reapply the chirp again by multiplying with another complex exponential.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The passband width of the lowpass filter defines how tightly around the transmitted tone that you reject other frequency components. The width of the passband would also need to be selected while taking the expected two-way propagation time of the transmitted signal; at time $t$, assuming a low-to-high frequency chirp, you might be transmitting frequency $f_t = f_c + \Delta f$, while the receiver is observing a delayed version of what you transmitted some time ago, for instance $f_r = f_c$. Your lowpass filter must have enough frequency coverage to cover the frequency slew of your chirp profile over the expected range of time delays. At the same time, though, you have an incentive to make the passband width as narrow as possible to reject other signal sources that are nearby your chirp profile in frequency, so as so often occurs in engineering, you have a tradeoff to examine.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-01-04T16:53:09.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1070" PostTypeId="1" CreationDate="2012-01-05T00:20:32.200" Score="10" ViewCount="3842" Body="&lt;p&gt;Say I have measurements of a function $y = y(x)$, sampled at $x_i$ with some noise, that could be approximated by a Taylor series expansion. Is there an accepted way of estimating the coefficients for that expansion from my measurements?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could fit the data to a polynomial, but that's not quite right, because for a Taylor series the approximation should get better the closer you are to a central point, say x = 0. Just fitting a polynomial treats every point equally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could also estimate the various orders of derivatives at my point of expansion, but then I need to make decisions about what differentiating filters to use and how many filter coefficients for each. Would the filters for the different derivatives need to fit together somehow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So does anybody know of established methods for this? Explanations or references to papers would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CLARIFICATION&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In response to the comment below, my sampling is a rectangular window from an infinite function, that isn't necessarily band-limited but does not have strong high-frequency components. To be more specific, I'm measuring the variance of an estimator (measuring displacement in a medical ultrasound signal) as a function of a parameter of the estimator (the level of deformation or strain of the underlying tissue). I have a theoretical Taylor series for the variance as a function of deformation, and would like to compare it to what I get from simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar toy example might be: say you have a function like ln(x), sampled at intervals in x with some noise added. You don't know what function it really is and you want to estimate its Taylor series around x=5. So the function is smooth and slowly varying for a region around the point you're interested in (say 2 &amp;lt; x &amp;lt; 8), but is not necessarily nice outside of the region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answers have been helpful, and some kind of least-squares polynomial fit is probably the route to take. What would make an estimated Taylor series different from a normal polynomial fit, though, is that you should be able to shave off higher-order terms, and have the polynomial still approximate the original function, just within a smaller range about your initial point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So maybe the approach would be to do a linear polynomial fit using only data close to the initial point, followed by a quadratic fit with a little more data, cubic using a little more than that, etc.&lt;/p&gt;&#xA;" OwnerUserId="759" LastEditorUserId="759" LastEditDate="2012-01-09T17:44:22.263" LastActivityDate="2012-01-09T17:44:22.263" Title="Estimate Taylor series coefficients from samples of a function" Tags="|noise|estimators|approximation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1071" PostTypeId="2" ParentId="1070" CreationDate="2012-01-05T14:18:55.753" Score="8" Body="&lt;p&gt;Instead of exact polynomial fitting, you could use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_least_squares&quot;&gt;least-squares fit&lt;/a&gt;, which will find the polynomial of specified order that minimizes the total squared error between the fit and the measured $(x_i,y_i)$ pairs. This can help to mitigate the effects of noise on the fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given measurements $y_i$ of a function $y = f(x)$ at domain values $x_i$ ($i = 0, 1, \ldots , N$), choose a polynomial order $M \le N$ (if $M = N$, then you're down to exact polynomial fitting, as the $N$ points uniquely determine an $M$th order polynomial). Then, set up a system of equations that are linear in the desired polynomial coefficients $p_k$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;y_i = p_Mx_i^M + p_{M-1}x_i^{M-1} + \ldots + p_1x_i + p_0, \;\;\;\;\;i = 0, 1, \ldots , N&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The least-squares problem can be solved by arranging the measurements into matrix-vector form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\mathbf{A} =  \left [ {\begin{array}{cc}&#xD;&#xA; x_0^M &amp;amp; x_0^{M-1} &amp;amp; \cdots &amp;amp; x_0 &amp;amp; 1  \\&#xD;&#xA; x_1^M &amp;amp; x_1^{M-1} &amp;amp; \cdots &amp;amp; x_1 &amp;amp; 1  \\&#xD;&#xA; \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \vdots \\&#xD;&#xA; x_N^M &amp;amp; x_N^{M-1} &amp;amp; \cdots &amp;amp; x_N &amp;amp; 1 \end{array} } \right ], &#xD;&#xA;\;\;\mathbf{y}= \left [ {\begin{array}{cc}&#xD;&#xA; y_0  \\&#xD;&#xA; y_1 \\&#xD;&#xA; \vdots  \\&#xD;&#xA; y_N  \end{array} } \right ]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_least_squares_%28mathematics%29#Computation&quot;&gt;The least-squares solution&lt;/a&gt; generates the vector of polynomial coefficients $\left[p_M, p_{M-1}, \ldots , p_0\right]$ that minimizes the total squared error in the above linear system. The solution can be computed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\mathbf{\tilde p} = (\mathbf{A^TA})^{-1} \mathbf{A^Ty}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is worth noting that the matrix $(\mathbf{A^TA})^{-1} \mathbf{A^T}$ is also known as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse&quot;&gt;pseudoinverse&lt;/a&gt; of the matrix $\mathbf{A}$. You can then use the least-squares polynomial coefficient vector $\mathbf{\tilde p}$ to evaluate the polynomial at any other $x$ values that you wish.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-01-05T14:18:55.753" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1073" PostTypeId="2" ParentId="1070" CreationDate="2012-01-05T14:48:55.143" Score="6" Body="&lt;p&gt;Ignore noise for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given $n+1$ points $(x_i,y_i)$ where the $x_i$ are distinct numbers, you can, as you say, fit a polynomial $f(x)$ of degree at most $n$ through these points.  Lagrange&#xA;interpolation, for example, is a standard method for this.  But, it is believed&#xA;that the points are actually on a curve $y=g(x)$ where $g(x)$ is not necessarily a &#xA;polynomial (e.g., it might be $e^x$ or $(x+a)/(x+b)$ etc.) and you would like to find&#xA;the Taylor series for this function $g(x)$.  Well, developing the Taylor series for&#xA;$g(x)$ in the vicinity of $x=0$, say, requires knowledge of the value of $g(0)$ as&#xA;well as the values of the &lt;em&gt;derivatives&lt;/em&gt; &#xA;$g^{(k)}(x) = \frac{\mathrm d^kg(x)}{\mathrm dx^k}, k=1,2,\ldots$ at $x=0$,&#xA;while all that is known is the values of $g(x)$ at $n+1$ points $x_i$.  Even if &#xA;$x_i = 0$ for some $i$ so that $g(0)$ is known, it is still necessary to &lt;em&gt;estimate&lt;/em&gt;&#xA;$g^{(k)}(0)$ for $k=1, 2, \ldots$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Estimating the value of the derivatives of a function $g(x)$ at $x=0$ from its&#xA;values $g(x_i)$ at selected points is a well-studied problem in&#xA;numerical analysis, and the formulas to be used are readily available.&#xA;What is &lt;em&gt;not&lt;/em&gt; described in detail, or more commonly, not mentioned at all&#xA;in the vicinity of these formulas, is that these formulas are obtained&#xA;by &lt;strong&gt;fitting a polynomial $h(x)=\sum_k h_kx^k$ to the known points and estimating &#xA;$g^{(k)}(0)$ as $h^{(k)}(0) = k!h_k$.&lt;/strong&gt;  Put another way, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;From $n+1$ points $(x_i,g(x_i))$&#xA;  of $g(x)$, we can develop the Taylor series for $g(x)$ only up to the term of&#xA;  degree $n$, and the truncated Taylor series is just $h(x)$, the polynomial&#xA;  that was fitted to the $n+1$ points.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, what does fitting a polynomial mean?  The standard fit is Lagrange&#xA;interpolation which works well when there is no noise, the points $x_i$&#xA;are evenly spaced, and $0$ is the median value of the $x_i$.  If noise&#xA;is present, a least-squares fit of a polynomial of degree $m &amp;lt; n$&#xA;(see the &lt;a href=&quot;https://dsp.stackexchange.com/a/1071/235&quot;&gt;answer by JasonR&lt;/a&gt; &#xA;for details) is often better, and if we want to &#xA;emphasize accuracy in the vicinity of $x=0$, a &lt;em&gt;weighted&lt;/em&gt; least-squares&#xA;fit can be used.  Weighting the error terms from points in&#xA;the vicinity of $0$ more than error terms from far away forces the&#xA;minimization algorithm to produce an even better fit near $0$&#xA;at the expense of poorer accuracy far away from $0$.&#xA;Of course, one also has to defend the choice of weighting function against&#xA;naysayers who prefer a different weighting (or no weighting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Given $3$ points $(-1,y_{-1}), (0,y_0), (1,y_1)$, the Lagrange&#xA;interpolation formula gives&#xA;$$\begin{align*}&#xA;f(x) &amp;amp;= y_{-1}\frac{x(x-1)}{2} -y_0(x^2-1) + y_{1}\frac{x(x+1)}{2}\\&#xA;&amp;amp;= y_0 + \frac{y_1-y_{-1}}{2}x + \frac{y_1-2y_0 + y_{-1}}{2}x^2&#xA;\end{align*}$$&#xA;where the coefficients of $x$ and $x^2$ are the &quot;three-point&quot; formulas&#xA;for the first and second derivative as given in Table 25.2 of&#xA;Abramowitz and Stegun's &lt;em&gt;Handbook of Mathematical Functions,&lt;/em&gt; &#xA;that is, the Lagrange interpolation formula &lt;em&gt;is&lt;/em&gt; the truncated&#xA;Taylor series for a function $g(x)$ such that &#xA;$g(-1) = y_{-1}, g(0) = y_0, g(1)=y_1$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-01-05T15:22:19.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1075" PostTypeId="1" CreationDate="2012-01-05T19:59:19.140" Score="10" ViewCount="1633" Body="&lt;p&gt;I have a simple single pole low pass filter (for parameter smoothing) that can be explained by the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;y[n] = (1-a) y[n-1] + a x[n]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The architecture that I'm using has access to single-instruction, multiple-data (SIMD) instructions that can perform multiple vectorized calculations in parallel. I would like to take advantage of this capability, but I'm not sure how to do that for a recursive filter like this. The problem is that every computation needs a previous result.&lt;/p&gt;&#xA;" OwnerUserId="6968" OwnerDisplayName="user1132968" LastEditorUserId="90" LastEditDate="2012-01-06T16:40:39.987" LastActivityDate="2012-01-13T20:09:13.630" Title="How can I vectorize the computations for a first-order recursive filter?" Tags="|filters|infinite-impulse-response|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1076" PostTypeId="2" ParentId="1075" CreationDate="2012-01-05T21:16:43.590" Score="2" Body="&lt;p&gt;You can only really vectorize this effectively if you have more than one signal to which you wish to apply the same filter, e.g. if it's a stereo audio signal then you can process the left and right channel in parallel. Four or eight channels in parallel would obviously be even better.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastEditorUserId="39" LastEditDate="2012-01-06T17:44:48.830" LastActivityDate="2012-01-06T17:44:48.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1077" PostTypeId="2" ParentId="1075" CreationDate="2012-01-05T22:37:46.580" Score="3" Body="&lt;p&gt;In general, you can only vectorize completely independent sets of computations.  But in your IIR low pass, every output is dependent on another (except the 1st), so vectorization is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your variable &quot;a&quot; is large enough that (1-a)^n quickly decays to below your desired noise floor or allowed error, you could substitute a short FIR filter approximation for your IIR, and vectorize that convolution instead.  But that's not likely to be faster.&lt;/p&gt;&#xA;" OwnerUserId="154" OwnerDisplayName="hotpaw2" LastActivityDate="2012-01-05T22:37:46.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1078" PostTypeId="2" ParentId="1075" CreationDate="2012-01-05T23:16:31.523" Score="0" Body="&lt;p&gt;How about expanding equations to 4 steps and use matrix multiplication? a is constant so one matrix may be precalculated&lt;/p&gt;&#xA;" OwnerDisplayName="Tobby" LastActivityDate="2012-01-05T23:16:31.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1079" PostTypeId="2" ParentId="1075" CreationDate="2012-01-05T23:38:39.957" Score="7" Body="&lt;p&gt;Assuming that you perform vector operations $M$ elements at a time, you can unroll the difference equation by a factor of $M$ pretty easily for the simple single-pole filter. Assume that you have already calculated all outputs up to $y[n]$. Then, you can calculate the subsequent ones as follows:&#xA;$$&#xD;&#xA;\begin{align}&#xD;&#xA;y[n+1] &amp;amp;= (1-a)y[n] + ax[n+1] \\&#xD;&#xA;y[n+2] &amp;amp;= (1-a)y[n+1] + ax[n+2] \\&#xD;&#xA;&amp;amp;= (1-a)((1-a)y[n] + ax[n+1]) + ax[n+2] \\&#xD;&#xA;&amp;amp;= (1-a)^2y[n] + a(1-a)x[n+1] + ax[n+2] \\&#xD;&#xA;&amp;amp;\vdots&#xD;&#xA;\end{align}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, you can write $y[n+k]$ as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;y[n+k] = (1-a)^ky[n] + \sum_{i=1}^k a(1-a)^{k-i}x[n+i]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each sample index $n+k$, this looks like an FIR filter with $k+1$ taps: one tap multiplies the last filter output $y[n]$, and the other $k$ taps multiply the filter inputs $x[n+1], \ldots , x[n+k]$. The nice thing is that the coefficients used for all of these taps can be precalculated, allowing you to unroll the recursive filter into $M$ $M+1$-tap parallel non-recursive filters (these filters compute the output samples $y[n+1], \ldots , y[n+M]$), updating the feedback term every $M$ output samples. So, given an initial condition $y[n]$ (which is assumed to be the last output calculated on the previous &#xA;vectorized iteration), you can calculate the next $M$ outputs in parallel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some caveats to this approach: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If $M$ becomes large, then you end up multiplying a bunch of numbers together in order to get the effective FIR coefficients for the unrolled filters. Depending upon your number format and the value of $a$, this could have numerical precision implications. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, you don't get an $M$-fold speedup with this approach: you end up calculating $y[n+k]$ with what amounts to a $k$-tap FIR filter. Although you're calculating $M$ outputs in parallel, the fact that you have to do $k$ multiply-accumulate (MAC) operations instead of the simple first-order recursive implementation diminishes some of the benefit to vectorization. The non-vectorized approach uses 2 MACs per output, so you need $2M$ operations to calculate $M$ outputs. The vectorized scheme computes the $M$ outputs at once, requiring $M+1$ MACs in the process. So, the reduction in operations can be expressed as a function of $M$ as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;    R = \frac{M+1}{2M} = \frac{1}{2}\left(1 + \frac{1}{M}\right)&#xD;&#xA;    $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, even with $M$ very large, you can get a maximum of a 50% reduction in the amount of computations using this method. For the common values of $M=4$ and $M=8$, the reduction is 37.5% and 43.75%, respectively. However, in addition to pure reduction in the number of operations, you may gain additional performance benefits due to the different memory access pattern employed by the unrolled approach; for the simpler implementation, you may run into delays due to the dependency of each output sample $y[n]$ on the previous sample $y[n-1]$. This effect is obviously very platform-dependent.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" OwnerDisplayName="Jason R" LastEditorUserId="90" LastEditDate="2012-01-06T18:17:25.647" LastActivityDate="2012-01-06T18:17:25.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1080" PostTypeId="1" CreationDate="2012-01-05T21:28:25.953" Score="9" ViewCount="1723" Body="&lt;p&gt;I want to find the line between color blue and color gray in the following picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s4ByP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More exactly, the end points of that line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the Hough transform a choice? If yes how should I set up the picture before using Hough?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way of solving this would be helpful.&lt;/p&gt;&#xA;" OwnerDisplayName="andreea lapusneanu" LastActivityDate="2012-01-16T04:27:17.950" Title="Find a specific line in a picture" Tags="|matlab|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1081" PostTypeId="2" ParentId="1080" CreationDate="2012-01-06T00:13:24.400" Score="10" Body="&lt;p&gt;In general, you want an edge detector, like the Canny edge detector, for this kind of problem. The Hough transform is useful for extracting lines rather than edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in this specific case, you're better off doing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imdata = imread('grayblue.jpg');&#xA;colidx = find(diff(imdata(1,:) ~= 0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;since it's such a simple image.&lt;/p&gt;&#xA;" OwnerUserId="142" OwnerDisplayName="Nzbuu" LastEditorUserId="142" LastEditDate="2012-01-06T13:55:30.477" LastActivityDate="2012-01-06T13:55:30.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1087" PostTypeId="2" ParentId="971" CreationDate="2012-01-06T18:41:54.023" Score="14" Body="&lt;p&gt;One of the best ways to create a sine wave is to use a complex phasor with recursive updating. I.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z[n+1] = z[n]\Omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where z[n] is the phasor, $\Omega = \exp(j\omega)$, with $\omega$ being the angular frequency of the oscillator in radians and $n$ the sample index. Both real and imaginary part of $z[n]$ are sine waves, they are 90 degrees out of phase. Very convenient if you need both sine and cosine. A single sample calculation only requires 4 multiples and 4 adds and is MUCH cheaper than anything containing sin() cos() or lookup tables.&#xA;The potential problem is that the amplitude may drift over time due to numerical precision issues. However there is a fairly straight forward to repair that. Let's say that $z[n] = a + jb$.&#xA;We know that $z[n]$ should have unity magnitude, i.e.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a\cdot a + b\cdot b = 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we can check every once in a while if that is still the case and correct accordingly. The exact correction would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z'[n] = \frac{z[n]}{\sqrt{a\cdot a + b\cdot b}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is an awkward calculation but since $a\cdot a + b\cdot b$ is very close to unity you can approximate the $1/\sqrt{x}$ terms with a Taylor expansion around $x = 1$ and we get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{\sqrt{x}} \cong \frac{3-x}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the correction simplifies to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z'[n] = z[n]\frac{3-a^2-b^2}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying this simple correction every few hundred samples will keep the oscillator stable forever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To vary the frequency continuously the multiplier W needs to be updated accordingly. Even a non-continuous change in the multiplier will maintain a continuous oscillator function. If frequency ramping is required the update can either be broken down into a few steps or you can use the same oscillator algorithm to update the multiplier itself (since it's also a unity gain complex phasor).&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="20947" LastEditDate="2016-05-10T10:31:01.170" LastActivityDate="2016-05-10T10:31:01.170" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1088" PostTypeId="1" AcceptedAnswerId="1090" CreationDate="2012-01-06T14:14:14.700" Score="12" ViewCount="79108" Body="&lt;p&gt;I've read up a lot about this, but haven't been able to piece everything together successfully, so I'm looking for some help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to filter 50 Hz from a signal. It looks like the best options are either a notch filter or a LMS filter, but I don't have a copy of the noise so a notch filter seems to be the best choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't need the frequencies normalised, as I know the sampling frequency (16kHz), and the duration is 30 seconds. The bandwidth can be fairly tight, 49.5Hz ~ 50.5Hz should be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like I need to use a combination of &lt;code&gt;filter&lt;/code&gt; and &lt;code&gt;iirnotch&lt;/code&gt;, but I'm not entirely sure how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone can bring this all together I would greatly appreciate it. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1124" OwnerDisplayName="Dororo" LastActivityDate="2019-10-29T12:57:51.050" Title="Filtering 50Hz using a notch filter in MATLAB" Tags="|matlab|filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1089" PostTypeId="2" ParentId="1088" CreationDate="2012-01-06T14:24:18.490" Score="9" Body="&lt;p&gt;You can just type help iirnotch and then see the following example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Design a filter with a Q-factor of Q=35 to remove a 60 Hz tone from &#xA;% system running at 300 Hz.&#xA;Wo = 60/(300/2);  BW = Wo/35;&#xA;[b,a] = iirnotch(Wo,BW);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you replace the 60 with 50 Hz and then do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = filter(b,a,X)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It should work (with X your data)&lt;/p&gt;&#xA;" OwnerDisplayName="user408041" LastActivityDate="2012-01-06T14:24:18.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1090" PostTypeId="2" ParentId="1088" CreationDate="2012-01-06T14:42:19.680" Score="17" Body="&lt;p&gt;I'm not sure what iirnotch does, but this is how to design the notch filter by hand.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 20000;             % sampling rate&#xA;f0 = 50;                % notch frequency&#xA;fn = fs/2;              % Nyquist frequency&#xA;freqRatio = f0/fn;      % ratio of notch freq. to Nyquist freq.&#xA;&#xA;notchWidth = 0.1;       % width of the notch&#xA;&#xA;% Compute zeros&#xA;notchZeros = [exp( sqrt(-1)*pi*freqRatio ), exp( -sqrt(-1)*pi*freqRatio )];&#xA;&#xA;% Compute poles&#xA;notchPoles = (1-notchWidth) * notchZeros;&#xA;&#xA;figure;&#xA;zplane(notchZeros.', notchPoles.');&#xA;&#xA;b = poly( notchZeros ); %  Get moving average filter coefficients&#xA;a = poly( notchPoles ); %  Get autoregressive filter coefficients&#xA;&#xA;figure;&#xA;freqz(b,a,32000,fs)&#xA;&#xA;% filter signal x&#xA;y = filter(b,a,x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6" OwnerDisplayName="Phonon" LastEditorUserId="38635" LastEditDate="2019-10-29T12:57:51.050" LastActivityDate="2019-10-29T12:57:51.050" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1091" PostTypeId="1" AcceptedAnswerId="1095" CreationDate="2012-01-06T14:23:04.267" Score="12" ViewCount="6538" Body="&lt;p&gt;I am currently involved in a project involving programming an imaging sensor. Our sensor is giving us noise, so we want to correct for it. Someone else on the project came up with the idea to take a &quot;black&quot; image i.e. put the lens cap on and take an image that is meant to be all black. (Obviously it is not due to noise) At this point on subsequent captures he takes the pixel values from the black image and subtracts them from the regularly captured image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image does look better and most of the noise is removed, however I am not convinced that this is the best approach for removing the noise due to the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The range of the fixed image is [-172 194] (366 values), versus the standard range of [0 255]. When it is redrawn it gets ranged back to [0 255], and it does look better, however I believe this is incorrect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should mention that the new image is taken in low light. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this method correct for removing the noise? Why or why not?&lt;/p&gt;&#xA;" OwnerUserId="774" OwnerDisplayName="Gordon Simpson" LastActivityDate="2013-12-24T20:01:41.863" Title="Is this a correct method for fixed pattern noise correction?" Tags="|matlab|image-processing|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1092" PostTypeId="2" ParentId="1091" CreationDate="2012-01-06T14:35:16.920" Score="3" Body="&lt;p&gt;Usually, negative values should be truncated to zero when you subtract the dark frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am surprised that dark frame subtraction gives you values of -172.  It means that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your noise level is high - at least 172 somewhere&lt;/li&gt;&#xA;&lt;li&gt;Your noise varies a lot from frame to frame.  In this case, dark frame subtraction is not very effective.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can you post images of a normal frame, dark frame, and then the subtracted version?&lt;/p&gt;&#xA;" OwnerUserId="47620" OwnerDisplayName="japreiss" LastActivityDate="2012-01-06T14:35:16.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1093" PostTypeId="2" ParentId="1091" CreationDate="2012-01-06T14:50:46.900" Score="7" Body="&lt;p&gt;this approach is valid and is in fact used in some high end cameras: the sensor first shoot a photo with the shutter closed, and substract it to the &quot;true&quot; photo. This has two advantages:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it corrects the fixed pattern noise&lt;/li&gt;&#xA;&lt;li&gt;it makes the image linear&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This method may give different results for different exposure times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The photonic noise is left untouched.&lt;/p&gt;&#xA;" OwnerUserId="436" OwnerDisplayName="Simon" LastActivityDate="2012-01-06T14:50:46.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1094" PostTypeId="2" ParentId="1091" CreationDate="2012-01-06T14:59:43.383" Score="4" Body="&lt;p&gt;I think this depends on the sensor you're using. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could take a series of (e.g. 10000) images with the lens cap on and compare the mean/standard deviation for each pixel. If possible, you could do the same for a uniform &quot;bright&quot; image (no overexposure, just uniform brightness).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are significant differences between the &quot;dark means&quot;, subtracting the dark mean for each pixel is a good idea. If there are significant differences between (bright mean - dark mean) for each pixel, dividing by that &quot;mean white image&quot; might be an improvement, too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you really have to make these statistics to find out what makes sense.&lt;/p&gt;&#xA;" OwnerUserId="291" OwnerDisplayName="nikie" LastActivityDate="2012-01-06T14:59:43.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1095" PostTypeId="2" ParentId="1091" CreationDate="2012-01-06T18:44:50.017" Score="12" Body="&lt;p&gt;The black image is the sum of a fixed pattern and dark noise (which most likely follows a normal distribution since it usually arises from current fluctuations). You want to subtract the fixed pattern, but not the dark noise - subtracting random noise from a signal simply increases the overall noise, and thus decreases signal quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a good estimate for the fixed pattern, you should capture a sizeable number of frames (say 25, though 100 will of course leave you with only half the noise), and average them. Since the dark noise is (should be) uncorrelated in time, it averages out, so that you're left with a low-noise fixed pattern that you can subtract from your future images, and that will not increase the noise in your image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the fixed pattern usually depends on the exposure time (a CCD camera, for example, may accumulate electrons during shift operations), thus you'll have to do a calibration for each exposure time. If you vary exposure times often, and if it's feasible, you can set up your experiment to capture a series of dark frames after each experiment, which means that you get a calibration for each experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you subtract a low-noise (i.e. averaged) dark frame, you will get some negative values (because the dark noise occurring during image acquisition can have negative values), but the range of your image should &lt;em&gt;not&lt;/em&gt; increase significantly. If it does, it is a sign that you have either not averaged enough dark frames, or that the fixed pattern has changed since you're using a different exposure time. &lt;/p&gt;&#xA;" OwnerUserId="59" OwnerDisplayName="Jonas" LastActivityDate="2012-01-06T18:44:50.017" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1096" PostTypeId="1" AcceptedAnswerId="1097" CreationDate="2012-01-07T03:41:16.933" Score="8" ViewCount="1480" Body="&lt;p&gt;There are a number of videos that I'm looking to process of different video games to detect various &quot;states&quot; in them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first game that I am tackling is any edition of &lt;a href=&quot;http://en.wikipedia.org/wiki/Super_Street_Fighter_IV&quot; rel=&quot;noreferrer&quot;&gt;Super Street Fighter 4&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In it, I'd like to detect when the &quot;vs&quot; character screen comes up.  Here's an example of &lt;em&gt;one frame&lt;/em&gt; of the video:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CGkZQ.png&quot; alt=&quot;Akuma vs. Ryu - SSF4&quot;&gt;&lt;br/&gt;&#xA;(taken from &lt;a href=&quot;http://www.youtube.com/watch?v=idyoBEEZimo#t=10&quot; rel=&quot;noreferrer&quot;&gt;~10s mark&lt;/a&gt; of &lt;a href=&quot;http://www.youtube.com/watch?v=idyoBEEZimo&quot; rel=&quot;noreferrer&quot;&gt;this video&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I could detect the &quot;vs&quot;, then I'd be able to detect that frame of video is indeed the &quot;vs&quot; screen, which would allow me to look for other information (for now, let's say I'll use it to detect the timestamp in the video where the match is about to start).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, here is what can be assumed about the frames from the videos that I will be processing (this is not the only video, there are thousands, if not tens or hundreds of thousands of videos, but the issue of scale in processing that many videos is a completely different domain):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'd prefer (but it's not necessary) to process the lowest resolution image possible with reliable results (lower resolutions = faster processing time). The image above is 480 x 270 pixels (taken from a &lt;a href=&quot;http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs&quot; rel=&quot;noreferrer&quot;&gt;YouTube video with a &lt;code&gt;fmt&lt;/code&gt; 18&lt;/a&gt;) but they may come in different sizes (I've gotten YouTube videos with &lt;code&gt;fmt&lt;/code&gt; 18 but with dimensions 640 x 360 pixels).&lt;/li&gt;&#xA;&lt;li&gt;Most videos will be direct-feed&lt;/li&gt;&#xA;&lt;li&gt;Most videos will be 16:9 aspect ratio&lt;/li&gt;&#xA;&lt;li&gt;The reddish background will be animated, but generally be within that orange-red color (it's flames)&lt;/li&gt;&#xA;&lt;li&gt;Sometimes there will be a badge fading in and out over the lower part of the &quot;vs&quot; to indicate a version (that will be important, but not right now), which might obfuscate the &quot;vs&quot;, like so:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1B5WF.png&quot; alt=&quot;Sagat vs. Adon - SSF4:AE 2012&quot;&gt;&lt;br/&gt;&#xA;(taken from &lt;a href=&quot;http://www.youtube.com/watch?v=nUwm-8gKxwM#t=3s&quot; rel=&quot;noreferrer&quot;&gt;~3s mark&lt;/a&gt; from &lt;a href=&quot;http://www.youtube.com/watch?v=nUwm-8gKxwM&quot; rel=&quot;noreferrer&quot;&gt;this video&lt;/a&gt;; also note that the above is a resolution of 640 x 360 pixels)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The size and position of the &quot;vs&quot; is going to be &lt;em&gt;roughly&lt;/em&gt; the same (I haven't verified this yet but I know it doesn't move) in proportion to other direct-feed videos&lt;/li&gt;&#xA;&lt;li&gt;The characters will be chosen from a pool of more than 30 on each side (in other words, those areas of the frame will vary)&lt;/li&gt;&#xA;&lt;li&gt;The videos will generally be anywhere from two to four minutes long, with somewhere between 4,000 and 6,00 frames.  However, there might be longer videos (maybe a two hours) which have various other games and live action cut in.  These videos are not as important, but if a solution tells me where a certain game pops up in the larger overall video, great&lt;/li&gt;&#xA;&lt;li&gt;The native resolution of the captures is 720p, so a baseline image of the &quot;vs&quot; can be taken at what would be considered a &quot;native&quot; size.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Ultimately, I'm looking to code this pipeline in .NET, but that's not &lt;em&gt;super&lt;/em&gt; important, the proof-of-concept is more important here as well as an understanding of the techniques involved so that I can translate and optimize it for .NET as well as for other videos of other games in the same genre (if I can pick out the significant discriminators, and videos of say, &lt;a href=&quot;http://en.wikipedia.org/wiki/Ultimate_Marvel_vs._Capcom_3&quot; rel=&quot;noreferrer&quot;&gt;Ultimate Marvel vs. Capcom 3&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Street_Fighter_X_Tekken&quot; rel=&quot;noreferrer&quot;&gt;Street Fighter x Tekken&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/BlazBlue:_Continuum_Shift&quot; rel=&quot;noreferrer&quot;&gt;BlazBlue: Continuum Shift&lt;/a&gt;, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also &lt;a href=&quot;http://area51.stackexchange.com/users/14120/casperone&quot;&gt;dipping my toes in Mathematica&lt;/a&gt; and have home version 8.0, so a proof-of-concepts in that environment is more than welcome as well.&lt;/p&gt;&#xA;" OwnerUserId="723" LastEditorUserId="723" LastEditDate="2012-01-07T06:40:23.863" LastActivityDate="2012-01-11T02:06:37.483" Title="Detecting a fixed template image out of a semi-constant frame of video" Tags="|image-processing|algorithms|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1097" PostTypeId="2" ParentId="1096" CreationDate="2012-01-07T05:50:54.033" Score="9" Body="&lt;p&gt;If the &quot;VS&quot; is pretty much the same (save for some badge overlays as in the second example), you can use straightforward &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;cross-correlation&lt;/a&gt; to detect the presence of the template in your video frame. I answered a &lt;a href=&quot;https://stackoverflow.com/a/8594330/616736&quot;&gt;similar question&lt;/a&gt; on doing this in MATLAB on Stack Overflow. You can use something like the &quot;magic wand&quot; tool in Photoshop to select the &quot;VS&quot; from the frame to create a template. I've done so and &lt;a href=&quot;http://en.wikipedia.org/wiki/Binary_image&quot; rel=&quot;nofollow noreferrer&quot;&gt;binarized&lt;/a&gt; the image to obtain &lt;a href=&quot;https://i.stack.imgur.com/wRkpX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;this template&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the different color channels (RGB) in your two images, the red channel appears to be the best for detecting your template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gvCjb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now cross-correlate the red channel with your binarized template and you should get a peak at the location of the template. I choose to threshold and binarize the red template too, although you can detect it without doing so. I prefer to use a distance function rather than raw cross-correlation values, as it tends to be a bit more robust against false positives. I don't know C#/.NET, but here's an outline of the approach in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image = Import[&quot;https://i.stack.imgur.com/7RwAh.png&quot;];&#xA;ImageCorrelate[ Binarize[ColorSeparate[image][[1]], 0.1], vsTemplate, &#xA;   NormalizedSquaredEuclideanDistance] // Binarize[#, 0.2] &amp;amp; // ColorNegate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which gives you the following. The white dot marks the region with the minimum distance in each of the two images&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EezWPm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WKZc1m.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then use the above in your next step as desired. Note that typically, cross-correlation will result in an overhang. In other words (using a 1D example) if you're cross-correlating an $N$ point signal with an $M$ point one, you'll get a result that's $N+M-1$ point long. Mathematica's implementation takes care of the overhang for you. However, I don't know what C# does, and you might want to keep this in mind (MATLAB doesn't do it, and I had to account for this in my linked answer above).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also build upon this and implement a more robust thresholding criterion of your own. For now, I shall just highlight the detection for the benefit of others:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0P8nfm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/A2D67m.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can generate the above with a combined function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;detectVS[i_Image] := &#xA; Module[{mask = &#xA;    ImageCorrelate[ Binarize[ColorSeparate[i][[1]], 0.1], vsTemplate, &#xA;       NormalizedSquaredEuclideanDistance] ~Binarize~ 0.2 // &#xA;     ColorNegate},&#xA;&#xA;  ColorConvert[i, &quot;Grayscale&quot;]~ImageAdd~ &#xA;   ImageMultiply[i, Image[mask]~Dilation~ DiskMatrix@100]&#xA;  ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is a lot of potential for improvement here. I'm an armchair hobbyist at image processing, so I don't know what the fastest algorithms are. However, there are a few things you could look into:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the VS is is roughly the same location in every video, you needn't cross-correlate using the entire image – you can just select a box in the middle and work with that.&lt;/li&gt;&#xA;&lt;li&gt;This might be an expensive operation to do for each and every frame. However, looking at your video, you have about a little over 4 seconds worth of frames where you have the VS displayed and the character names. So I would suggest that you analyze a frame every second or at most every 2 seconds, thereby guaranteeing that you will land on one with a VS on it. Once you detect VS, you can then start processing every successive frame to do the next part of your processing.&lt;/li&gt;&#xA;&lt;li&gt;This process should be, to a reasonable extent, robust towards change in size i.e., you could do cross-correlations on small images, but you'll need a suitable template to match. If you know that your images are going to be in certain set/standard sizes, then you could create templates for each of them and select the appropriate template depending on the image size.&lt;/li&gt;&#xA;&lt;li&gt;The thresholds I chose were by trial and error, but they do seem to work for the two images above and from the other related youtube videos, they probably will work for most of them. A more specialized approach would involve dividing it up into blocks and looking at the histogram to infer if it belongs to VS or not – perhaps a Bayesian classifier. However be absolutely sure that you &lt;em&gt;need&lt;/em&gt; to do this before embarking on it. It seems to me that it's simple enough that you won't need it.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-01-07T05:50:54.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1100" PostTypeId="1" CreationDate="2012-01-08T07:44:45.517" Score="4" ViewCount="3380" Body="&lt;p&gt;If I use a generic filter for generating colored noise like pink,brown,white then how do I modify this statement and how do I know what are the coefficients to be used in AR model for different noise.Signal is white gaussian noise and y gives different noise based on the value of a.&lt;/p&gt;&#xA;" OwnerUserId="779" LastEditorUserId="6" LastEditDate="2012-01-09T17:55:17.290" LastActivityDate="2012-01-09T17:55:17.290" Title="Filter coefficients for colored noise Voss Algorithm" Tags="|matlab|lowpass-filter|continuous-signals|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1101" PostTypeId="2" ParentId="1100" CreationDate="2012-01-08T18:20:26.493" Score="5" Body="&lt;p&gt;Here, $a$ is a filter coefficient for a simple single-pole recursive low-pass filter. If you look at the documentation for MATLAB's &lt;code&gt;filter()&lt;/code&gt; function, you'll see this corresponds to the difference equation $y(n) = x(n) - a y(n-1)$`. Let's analyze the filter in the $z$-domain to get its frequency response (just remembering that $z^{-1}$ corresponds to a single sample delay:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) + a y(n-1) = x(n)$$&#xA;$$Y(z)*(1 + a z^{-1}) = X(z)$$&#xA;$$\frac{Y(z)}{X(z)} = \frac{1}{1 + a z^{-1}} = H(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the $z$-domain transfer function. We can substitute $z = e^{j\omega}$ where $\omega$ is the normalized frequency, where 0 is DC and $\pi$ corresponds to the Nyquist frequency of whatever sampling rate you're at. Now you should realize that if you use the same digital coefficients at different sampling rates, you will get filtered noise that varies depending on the sampling rate. If your sampling rate is $F_s$, then $\omega$ corresponds to the frequency $\dfrac{\omega F_s}{2 \pi}$. Let's find the frequency response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G^2(\omega) = |H(e^{j\omega})|^2 = \left| \frac{1}{1 + a e^{-j\omega}} \right|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G^2(\omega) = \frac{1}{|1 + a(\cos(-\omega) + j \sin(-\omega))|^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G^2(\omega) = \frac{1}{|(1 + a \cos(\omega)) - j \sin(\omega))|^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G^2(\omega) = \frac{1}{(1 + a \cos(\omega))^2 + \sin^2(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G^2(\omega) = \frac{1}{1 + 2 a \cos(\omega) + a^2 \cos^2(\omega) + \sin^2(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G^2(\omega) = \frac{1}{1 + 2 a \cos(\omega) + a^2 \cos^2(\omega) + (1 - \cos^2(\omega))}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G^2(\omega) = \frac{1}{2 + 2 a \cos(\omega) + (a^2 - 1) \cos^2(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega) = \frac{1}{\sqrt{2 + 2 a \cos(\omega) + (a^2 - 1) \cos^2(\omega)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's plot the frequency response with $a = -0.9$: &lt;a href=&quot;http://www.wolframalpha.com/input/?i=1%20/%20sqrt%282%20%2b%202%20%28-0.9%29%20cos%28w%29%20%2b%20%28%28-0.9%29%5E2%20-%201%29%20cos%28w%29%5E2%29%20from%200%20to%20pi&quot; rel=&quot;nofollow&quot;&gt;WolframAlpha plot&lt;/a&gt;. We can also take &lt;code&gt;20 Log10()&lt;/code&gt; to get the frequency response in decibels: &lt;a href=&quot;http://www.wolframalpha.com/input/?i=20%20log10%281%20/%20sqrt%282%20%2b%202%20%28-0.9%29%20cos%28w%29%20%2b%20%28%28-0.9%29%5E2%20-%201%29%20cos%28w%29%5E2%29%29%20from%200%20to%20pi&quot; rel=&quot;nofollow&quot;&gt;WolframAlpha plot&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can find out some things about this filter. For example, its gain at DC is greater than unity! $G(0) = \dfrac{1}{\sqrt{1 + 2a + a^2}}$. When $a = -0.9$, the filter increases the DC gain by a factor of 10, or 20 dB. Often filters are characterized in terms of their -3 dB point, which is where their magnitude decreases by $\sqrt{2}$ from their peak. Let's solve for this point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1} { \sqrt{2} \sqrt{1 + 2a + a^2} } = \frac{1}{\sqrt{2 + 2 a \cos(\omega) + (a^2 - 1) \cos^2(\omega)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sqrt{2} \sqrt{1 + 2a + a^2} = \sqrt(2 + 2 a \cos(\omega) + (a^2 - 1) \cos^2(\omega))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2 + 4a + 2 a^2 = 2 + 2 a \cos(\omega) + (a^2 - 1) \cos^2(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now treat this as a quadratic in $\cos(\omega)$, let's substitute $x = \cos(\omega)$ and use the quadratic formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(a^2 - 1) x + 2ax + (-4a - 2 a^2) = 0$$&#xA;$$x = \frac{-2a \pm \sqrt( 4a^2 - 4(a^2-1)(-4a - 2 a^2)) }{2 (a^2 - 1)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we want the solution corresponding to positive frequencies, and it turns out that choosing the result with the minus sign gives us that. So, we can take the inverse cosine, and get our -3 dB frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega = \arccos\left( \frac{-2a - \sqrt{4a^2 - 4(a^2-1)(-4a - 2 a^2)}}{2 (a^2 - 1)} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's plug it in for $a = -0.9$ and verify:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w = 0.0958385$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = 7.07107 = \dfrac{10}{\sqrt{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be useful to go the other way, to design a filter by choosing a value of a to have some desired -3 dB point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2 + 4a + 2 a^2 = 2 + 2 a \cos(\omega) + (a^2 - 1) \cos^2(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2 + 4a + 2 a^2 = 2 + 2 a \cos(\omega) + a^2 cos^2(\omega) - \cos^2(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(2 - \cos^2(\omega)) a^2 + (4 - 2 \cos(\omega)) a + \cos^2(w) = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{ -(4 - 2 \cos(\omega)) +/- \sqrt{ (4 - 2 \cos^2(\omega))^2 - 4(2 - \cos^2(\omega))(\cos^2(\omega)) } }{2 (2 - \cos^2(\omega))}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And again we can verify by plugging in $\omega = 0.0958385$, and we'll see that we get $a = -0.9$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for example, you could use these formulas to pick values of $a$ at different sampling rates, so that you have the same frequency -3 dB point. You can use the formula for gain at DC, for example, to normalize the filter so its gain at DC is unity. You can take the formula for gain, convert it to decibels, and see that it approaches roughly a -6 dB/oct slope, which is why it's being used to shape noise like this.&lt;/p&gt;&#xA;" OwnerUserId="392" LastEditorUserId="6" LastEditDate="2012-01-09T14:13:00.517" LastActivityDate="2012-01-09T14:13:00.517" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1103" PostTypeId="1" AcceptedAnswerId="1111" CreationDate="2012-01-09T07:17:33.293" Score="13" ViewCount="1334" Body="&lt;p&gt;I am currently reading up on and teaching myself ICA from a number of good sources. (Also see this &lt;a href=&quot;https://dsp.stackexchange.com/questions/812/fail-to-separate-sound-signals-by-fastica-on-real-world-recording&quot;&gt;post&lt;/a&gt; for past context). I have the basic jist down, but there is something I am not clear about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a scenario where multiple signals are impinging on multiple spatial sensors, (of course, with number of sensors &gt;= number of signals), it is inevitable that for any one sensor, all the signals arriving to it will have different delays/phase-offsets associated with them, as compared to those arriving at a different sensor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, as far as I know, the signal model for ICA is a simple mixing matrix, where the total energy arriving at any one sensor is modeled as nothing but a simple linear combination of all the other signals of interest. Every sensor has a different array of linear combination coefficients associated with it. So far so good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do not understand, is that &lt;em&gt;inevitably&lt;/em&gt; there &lt;em&gt;are&lt;/em&gt; going to in fact be &lt;em&gt;some&lt;/em&gt; delay/phase-offset among individual signals arriving at individual sensors that differ from one another. That is, $s_1(n)$ might arrive at $sensor_1$ at some time 0s, while that same $s_1(n)$ arrives at $sensor_2$ attenuated, but &lt;em&gt;also&lt;/em&gt; at some delay or phase difference. The way I see it this is physically inevitable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;...How can it be that this is not modeled in the mixing matrix? It seems that delays will make a huge difference. No longer are we talking about simple linear combinations anymore. How does ICA handle this? Have I missed something here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also add as an addendum, if indeed ICA cannot handle delays, then what applications does it find usefulness in? Clearly spatial ones with sensors are out! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-01-10T15:23:59.477" Title="How does ICA handle inevitable delays in signals?" Tags="|ica|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1104" PostTypeId="1" AcceptedAnswerId="1105" CreationDate="2012-01-09T09:01:06.197" Score="9" ViewCount="6678" Body="&lt;p&gt;I have a filter design, and it filters over a 1-2 kHz range.&lt;br&gt;&#xA;What should I do if I want to apply it to data with a different sample rate than the one for which it was designed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say it consists of Bessel and Chebyshev filters. How do I find a function that defines each filter's coefficients at an arbitrary sample rate? Or should I do this by hand?&lt;/p&gt;&#xA;" OwnerUserId="719" LastEditorUserId="39" LastEditDate="2012-01-09T12:58:13.980" LastActivityDate="2012-01-09T15:43:30.017" Title="Applying FIR filter to data with different sample rates" Tags="|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1105" PostTypeId="2" ParentId="1104" CreationDate="2012-01-09T13:44:51.790" Score="9" Body="&lt;p&gt;Since you mention sampling, you are presumably talking of a digital filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cut-off frequency or half-power frequency of a digital filter is&#xA;actually relative to the sampling frequency $f_s$.  If your digital&#xA;filter is passing signals in the $1$ kHz to $2$ kHz range when you&#xA;feed it a signal sampled at $f_s = 20$ kHz, then the pass band is from&#xA;$5\%$ to $10\%$ of $f_s$.  These ratios do not change if&#xA;$f_s$ changes to some other value, say $40$ kHz.  The same digital&#xA;filter will become a filter with passband $2$ kHz to $4$ kHz without&#xA;your having to do anything.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-01-09T13:44:51.790" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1107" PostTypeId="2" ParentId="303" CreationDate="2012-01-09T19:41:15.690" Score="4" Body="&lt;p&gt;I had worked on an array processing problem where I had used diagonal loading of the measurement covariance matrix. But I had used diagonal loading as a solution to what I thought was a numerical issue with my eigen values being too small. Since I had to invert the covariance matrix with small eigen values, I had numerical issues with the result. &#xA;Diagonal loading of the covariance matrix helped me get rid of the issue as the eigen values were now bounded by the diagonal loading value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure, but one place where diagonal loading helps is in numerical stability of inverting the covariance matrix which is most likely encountered in adaptive beamforming.&lt;/p&gt;&#xA;" OwnerUserId="645" LastActivityDate="2012-01-09T19:41:15.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1108" PostTypeId="1" AcceptedAnswerId="1110" CreationDate="2012-01-10T11:19:36.720" Score="9" ViewCount="10585" Body="&lt;p&gt;I load and display an image of some rice in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;g = imread('rice.png');&#xA;imshow(g);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7zZSg.png&quot; alt=&quot;rice&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take the FFT of this image and shift it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;G = fft2(g);&#xA;imshow(log(abs(fftshift(G)) + 1), []);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ucM5j.png&quot; alt=&quot;FFT(rice)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I place a x and y axis trough the center of the image; I find that the image is symmetric g(-x,-y)=g(x,y). For a 1D signal we have that the FFT of a real signal has a symmetrical real part and an asymmetrical imaginary part. I guess that is what we see here in 2 dimensions?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the original image is darker at the bottom than at the top, there is a strong horizontal discontinuity at the periodic boundary causing the vertical line in the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get rid of this boundary effect. A common approach to this seems to be &lt;a href=&quot;http://blogs.mathworks.com/steve/2009/12/04/fourier-transform-visualization-using-windowing/&quot; rel=&quot;noreferrer&quot;&gt;windowing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I want to solve this problem by a technique I found in a paper called &quot;mirroring&quot;.&#xA;The paper was not very specific so I need your help in figuring out this approach :-).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I create a symmetric &quot;tile&quot; from the original image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tile=[flipdim(g,2) g; flipdim(flipdim(g,1),2) flipdim(g,1)];&#xA;imshow(tile);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wzTMn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I take the FFT of this &quot;tile&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Tile=fft2(tile);&#xA;imshow(log(abs(fftshift(Tile)) + 1), []) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vzAZw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The vertical line seems to be (almost) gone: good.&#xA;However the mirroring seem to have introduced more symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the correct result: the FFT of the original image or the FFT of the &quot;mirrored&quot; image?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way I can &quot;mirror&quot; so that I both get rid of boundary effects and get a purely real FFT?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any answers!&lt;/p&gt;&#xA;" OwnerUserId="697" LastActivityDate="2012-01-10T13:36:09.143" Title="FFT of image data: &quot;mirroring&quot; to avoid boundary effects" Tags="|image-processing|fft|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1110" PostTypeId="2" ParentId="1108" CreationDate="2012-01-10T13:36:09.143" Score="14" Body="&lt;p&gt;The FFT of the original image is correct. The artifacts you are seeing are typical for the DFT, because the DFT basis functions have difficulty representing non-periodic signals. Even though the DFT is of finite length, it actually represents a periodic signal that extends to negative and positive infinity. The DFT's basis functions are all sinusoids with periods that are integer divisors of the DFT size, so they all start and end at the same value, and it is hard for it to fit signals that are not periodic in this way. So, imagine tiling your image: there is indeed an abrupt discontinuity at the edges. The edges do not match up well, and that is the reason for the boundary effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In audio signal processing, where the FFT is used often, a very common approach is to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;window function&lt;/a&gt;, as you noted. This tapers the edges off towards 0, and reduces this effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In image processing, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;DCT&lt;/a&gt; is usually used rather than the DFT, because it imposes different symmetry constraints that give better results. In other words, it's used to prevent exactly the issue you're seeing. In contrast to the DFT's basis functions (remember how they all start and end at the same value), the DCT's basis functions are integer divisors or half of integer divisors, so many of them start and end at different values. As a result, the implied boundary conditions are different: the signal is assumed to be symmetric about its edges, which is actually somewhat similar to the &quot;mirroring&quot; you were experimenting with. Here is another post by me with a little more information on the DCT: &lt;a href=&quot;https://dsp.stackexchange.com/a/362/392&quot;&gt;https://dsp.stackexchange.com/a/362/392&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as a short summary, if you are absolutely set on using the FFT, you might want to try windowing. However, the best choice is probably to use the DCT, which implies boundary conditions similar to your &quot;mirroring&quot; idea, and as a result, handles images better.&lt;/p&gt;&#xA;" OwnerUserId="392" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2012-01-10T13:36:09.143" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1111" PostTypeId="2" ParentId="1103" CreationDate="2012-01-10T15:23:59.477" Score="3" Body="&lt;p&gt;One of the most successful uses of ICA has been in the study of electrophysiology (i.e. brain activity), principally EEG (Electroencephalography) and MEG (Magnetoencephalography). They are used to remove artefacts (such as electrical impulses caused by muscle movements (eye blinks etc)) without the need for reference channels. In this application the spatial separations between sensors is minute compared with the propagation speed of the waves, and as such the assumptions of ICA effectively hold. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fMRI, which relies on blood flow in the brain, the temporal delay issue is more significant. One approach, taken in the paper &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/14642476&quot; rel=&quot;nofollow&quot;&gt;Latency (in)sensitive ICA. Group independent component analysis of fMRI data in the temporal frequency domain by Calhoun et al (2003)&lt;/a&gt; attempted to solve this problem by making estimates of the time delay in each voxel, and then using this as prior information in a modified ICA. Maybe something like this could be applied in your domain?&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2012-01-10T15:23:59.477" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1112" PostTypeId="1" AcceptedAnswerId="1113" CreationDate="2012-01-10T15:28:05.853" Score="13" ViewCount="1883" Body="&lt;p&gt;I am looking for algorithm(s) to solve the following problem:&#xA;Given a noisy .wav sound capture (some wind + friction noise on the microphone), how to detect the BPM of a soft drum beat?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attempted googling the subject, but the results are quite poor, due to high amount of mp3 related software for both analysis and fingerprint id generation. None of them supply information about how to actually do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware of algorithms to remove the noise, but that still leaves me with the problem of detecting BPM. And depending on how the BPM problem is solved, it's possible that I don't even need to denoise (since drum tends to be in the lower frequencies and noise in higher, a simple low-pass might be sufficient pre-processing).&lt;/p&gt;&#xA;" OwnerUserId="787" LastActivityDate="2014-03-01T02:58:38.497" Title="Detecting drum bpm in a noisy .wav file" Tags="|audio|algorithms|noise|frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1113" PostTypeId="2" ParentId="1112" CreationDate="2012-01-10T16:07:24.023" Score="14" Body="&lt;p&gt;One method that works if there's a relatively strong drum beat is to take the magnitude of the STFT of the waveform, and then auto-correlate it in only the time dimension.  The peak of the auto-correlation function will be the beat, or a submultiple of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is equivalent to breaking up the signal into a lot of different frequency bands, finding the amplitude envelope of each, autocorrelating each envelope, and then summing them.  The noise and other parts of music are averaged out by the cross-correlation operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because drum beats produce short-lived sound at many frequencies (vertical lines), while other parts of music are long-lived at only a few frequencies (horizontal lines), and noise is long-lived but random at all frequencies.  You can see the beat repetition if you look at an STFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8XUjz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came up with this for a school project to find a single BPM value for entire music files, but it could be adapted to a stream of audio with changing BPM, too.  You'd need to process chunks that are at least twice as long as the period of the BPM you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2014-03-01T02:58:38.497" LastActivityDate="2014-03-01T02:58:38.497" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1114" PostTypeId="1" CreationDate="2012-01-11T10:40:08.107" Score="17" ViewCount="1570" Body="&lt;p&gt;I need to enhance the visibility of veins on dorsal hand vein images in my project. I use two different even-symmetric Gabor filters bank improve vein visibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First bank consists of these gabor functions:&#xA;$$G^\mathit{e}_\mathit{mk}(x,y)=\dfrac{\gamma}{2\pi\sigma^2}\exp\Bigg\{-\frac{1}{2}\left(\dfrac{x_\mathit{\theta}+\gamma^2y_\mathit{\theta}^2}{\sigma^2}\right)\Bigg\}\times \left(\cos(2\pi f_\mathit{0}x_\mathit{\theta})-\exp(-\dfrac{\upsilon^2}{2})\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second bank consists of these ones:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G^\mathit{e}_\mathit{mk}(x,y)=\exp\Bigg\{-\frac{1}{2}\left(\dfrac{x_\mathit{\theta}+\gamma^2y_\mathit{\theta}^2}{\sigma^2}\right)\Bigg\}\times \cos(2\pi f_\mathit{0}x_\mathit{\theta})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $m$ is the scale index, $k$ is the orientation index, $f_\theta$ is the filter center frequency, $\sigma$ is the standard deviation (often called scale), $\gamma$ is the aspect ratio of the elliptical Gaussian envelope, $\upsilon$ is the factor determining DC response, $x_\theta=(x\cos\theta+y\sin\theta)$ and $y_\theta=(-x\sin\theta+y\cos\theta)$ are rotated versions of the $x$ and $y$ coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have coded these filters in MATLAB, I do not have any problem on coding. But I cannot understand the underlying difference between these two gabor functions.       &lt;/p&gt;&#xA;" OwnerUserId="733" LastEditorUserId="15549" LastEditDate="2017-12-12T17:06:52.777" LastActivityDate="2022-02-13T23:51:09.773" Title="What are the differences between these two Gabor filter functions" Tags="|image-processing|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1117" PostTypeId="1" CreationDate="2012-01-12T01:22:39.220" Score="8" ViewCount="4093" Body="&lt;p&gt;I have a problem that I thought was going to be simple, but it has become surprisingly stubborn and I question my method... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the method (described below), but I wanted to confirm that this was the right approach, and see if there was another method I could use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I basically have is two wideband signals, (on the order of 100 Mhz BW), in quadrature. So I have the I and Q of those two signals. What I am trying to find is the phase difference between those two signals as a function of frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I am currently trying is the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I take my quadrature complex signals, and window each of them with a hamming window 3 times over.&lt;/li&gt;&#xA;&lt;li&gt;I take the FFT of the windowed complex signals, at some arbitrary length, say 2048. Call the results $S_1(w)$ and $S_2(w)$.&lt;/li&gt;&#xA;&lt;li&gt;I multiply $S_1(w)$ by the conjugate of $S_2(w)$.&lt;/li&gt;&#xA;&lt;li&gt;I take the argument out of the complex exponential vector from the above step (inverse tangent of imag over real). This gives me the phase differences between the two signals as a function of frequency. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My questions on this method:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this the right approach for this simple type of problem?&lt;/li&gt;&#xA;&lt;li&gt;When I tried this method for a simulation with 1, 2 or a couple tones, I can get good results. I find the index of where my tones exist, (look at the abs of the FFT), I take that index, and look at the $\Delta$phase value from step 4 above. This gives me the right phase. &#xA;&lt;ul&gt;&#xA;&lt;li&gt;However, when I look the $\Delta$phase values for frequency indicies where said those frequencies dont exist, I get wild answers. Why is this? I realize those frequencies dont exist but shouldn't the phases just be 0 - 0 = 0 in that case?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Based on this (with a couple tones), can I readily extend this to a wideband signal and also expect good results?&lt;/li&gt;&#xA;&lt;li&gt;My last question regards the nature of the phase delay here - physically what is happening is that one of the signals (optical) is going through a device that delays different frequencies differently. Of course the delays are manifested as phase offsets between all frequencies... but at the same time there is a &lt;em&gt;time&lt;/em&gt; delay associated with this as well. Even if we were to measure the $\Delta$phase between the two signals properly, wouldnt it still be impossible to measure the &lt;em&gt;time&lt;/em&gt; delay between them at those frequencies? I can have a time delay of 10 wavelenghts, but a phase offset of 0. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT FROM COMMENT FEEDBACKS:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I am clearer now as to what my question really is:  For a case where you have well separated tones and high SNR, my method can work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what to do in the wideband case? In this sense, suppose $s_1[n]$ and $s_2[n]$ both contain two tones that are very close to each other in the frequency space. But your FFT can only give you so much frequency resolution. So instead of applying my method to two peaks, you only have one peak to go on. Now what? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What relation would the $\Delta$phase of that peak have to the actual $\Delta$phase of the  'true' peaks? Is it their average? &lt;/li&gt;&#xA;&lt;li&gt;One method I am thinking of is correlating the two signals in the time domain, and working backwards to get the phase offsets per frequency taking advantage of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Properties_of_the_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;fourier translation property&lt;/a&gt;, although part of me thinks it might not work since there is no new information, just looking at the problem from a different domain.&lt;/li&gt;&#xA;&lt;li&gt;Another thought I had for the wideband case would be to put the whole thing through many narrow band filters, and then apply my original method. Is there a name for something like this?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks again&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-01-12T21:14:25.497" LastActivityDate="2013-10-16T19:09:03.267" Title="Confirmation on how to calculate phase differences at every frequency point between two wideband signals?" Tags="|fft|phase|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1118" PostTypeId="2" ParentId="1117" CreationDate="2012-01-12T05:47:43.537" Score="4" Body="&lt;p&gt;What you seem to want is the phase response of the device that your optical system is passing through. Based on that, your high-level approach makes intuitive sense overall; I'm not sure why you chose a Hamming window and applied it three times. In any event, though, if you have a linear discrete-time system with (complex-valued) frequency response $H(e^{j\omega})$, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;Y(e^{j\omega}) = H(e^{j\omega})X(e^{j\omega})&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $X(e^{j\omega})$ and $Y(e^{j\omega})$ are the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete-time Fourier transforms (DTFTs)&lt;/a&gt; of the input and output signals, respectively. If you express the above in polar format (magnitude and phase), then the phase response of the system is just:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\angle H(e^{j\omega}) = \angle Y(e^{j\omega}) - \angle X(e^{j\omega})&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is, the phase response of the system just expresses the amount of phase shift that the system applies to the input signal as a function of (normalized) frequency $\omega$. Your approach takes advantage of the fact that for two complex numbers $X(e^{j\omega})$ and $Y(e^{j\omega})$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\angle Y(e^{j\omega}) - \angle X(e^{j\omega}) = \angle \left(X^*(e^{j\omega})Y(e^{j\omega})\right)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, given the DTFTs of the system's input and output signals, you can straightforwardly calculate the phase response that you seek. The devil is in the details of how one would obtain the DTFT representations of these signals. The nice part about the DTFT is that it is continuous in frequency; the bad part is that the DTFT sum is infinite in length. So, if you really want to evaluate the phase response at arbitrarily many frequencies, you better be patient, because you'll need to collect an infinite amount of data first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete Fourier transform (DFT)&lt;/a&gt; is often used as an &lt;em&gt;approximation&lt;/em&gt; to the DTFT, which is valid under certain conditions. If the signals $x[n]$ and $y[n]$ are finite in length (which for a practical scenario like yours, they are), then the DFT can be thought of as evaluation of the DTFT on the finitely-spaced frequency grid $\frac{2\pi k}{N}, k = 0, 1, \ldots , N-1$ (where $N$ is the signal length). So, the larger you make $N$, the smaller your sample spacing across the frequency axis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most physical devices will have a frequency response that is smooth to some degree (taken with the caveat that I'm not knowledgeable on optical device physics), so you should be able to find a DFT length that gives a decent approximation to the DTFTs for the input and output signals of your system. You can then apply your approach to estimate the phase response of the device.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You noted in your question that you see incorrect results for the estimated phase response for DFT bins in the output signal that didn't contain any content in the input signal; this is to be expected. Your assumption that you would just get zero phase for those bins is not likely to hold in a practical scenario; noise present in the sampled signals, spectral leakage, or other interference can cause you to observe some small amount of energy at frequencies that you wouldn't expect it. These extraneous sources can introduce distortion between the input and output that is not due to the device's response, and for complex numbers with small magnitude, small amounts of additive noise can drastically affect the number's resulting phase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, you can only consider the phase measurement valid at frequencies where there is significant spectral content in the input. Stated differently, if you want to make a precise phase measurement, you want high signal-to-noise ratio in the complex value that you're using to estimate the phase.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-01-12T05:47:43.537" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1119" PostTypeId="2" ParentId="1117" CreationDate="2012-01-12T07:47:00.720" Score="1" Body="&lt;p&gt;Noise pretty much has a random phase.  So it's usually reasonable to just clamp the phase of any bin with a magnitude below some noise threshold to zero.  Make sure this threshold is above the (unavoidable) numerical noise level.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-01-12T07:47:00.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1120" PostTypeId="2" ParentId="1114" CreationDate="2012-01-12T09:06:18.977" Score="6" Body="&lt;p&gt;Depending on the location of the peak and the scale of the two axes of the Gaussian envelope the filter may have a large DC response. A popular approach to get a zero DC response is to subtract the output of a low-pass Gaussian filter, which is what the first of these two does. In the case of images, if the DC response is not removed, the filter will respond to the absolute intensity of the image.&lt;/p&gt;&#xA;&lt;p&gt;The tutorial, &lt;a href=&quot;https://inc.ucsd.edu/mplab/75/media//gabor.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Javier R. Movellan - Tutorial on Gabor Filters&lt;/a&gt;, gives a bit more detail.&lt;/p&gt;&#xA;" OwnerUserId="584" LastEditorUserId="7092" LastEditDate="2022-02-13T23:51:09.773" LastActivityDate="2022-02-13T23:51:09.773" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1122" PostTypeId="1" AcceptedAnswerId="1123" CreationDate="2012-01-12T16:21:12.987" Score="8" ViewCount="2132" Body="&lt;p&gt;My inputs are several binary images like:&lt;img src=&quot;https://i.stack.imgur.com/Veor6.png&quot; alt=&quot;first binary image to be register&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9RYv3.png&quot; alt=&quot;second binary image to be register&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have globally the same content but may be unregistered as they are produced from a hand camera. What I would like to compute is the 2D displacement vector from the first image to the second. I use OpenCV and my first attempt was to compute feature points (SURF algorithm) and the affine transform between both images. But of course, feature description are kinda poor on a binary image, therefore the matching is difficult and the matching map very inaccurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone has an idea how I could do this?&lt;/p&gt;&#xA;" OwnerUserId="16" LastActivityDate="2012-01-14T16:13:34.820" Title="How to compute 2D displacement vector for binary image registration?" Tags="|image-processing|image-registration|morphological-operations|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1123" PostTypeId="2" ParentId="1122" CreationDate="2012-01-12T18:29:50.810" Score="6" Body="&lt;p&gt;I am somewhat surprised that feature points don't work that well. I have had success registering shapes like yours using either&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Harris points, this is a corner detector, in combination with the RANSAC algorithm. See the &lt;a href=&quot;http://en.wikipedia.org/wiki/Harris_affine_region_detector&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt; or &lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/matlabfns/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peter Kovesi&lt;/a&gt; his site&lt;/li&gt;&#xA;&lt;li&gt;Using a feature detector like SURF or SIFT in combination with an edge map of the image prior to feature detection followed by some form of robust matching. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I gave it a go with matlab and tried some variations on this theme. Currently I use&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SIFT features from the edge map to ascertain rotation and scaling, although they are very small between the images you provided&lt;/li&gt;&#xA;&lt;li&gt;RANSAC for robust matching&lt;/li&gt;&#xA;&lt;li&gt;Cross correlation to ascertain the translation between the two images&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ba3d6.png&quot; alt=&quot;Robust match&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2Bf30.png&quot; alt=&quot;Before registration&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/A150Q.png&quot; alt=&quot;After registration&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source on &lt;a href=&quot;https://github.com/mdiephuis/sandbox/tree/master/so&quot; rel=&quot;nofollow noreferrer&quot;&gt;github&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative for RANSAC could be the Hough transform voting/binning approach that was proposed by the inventor of SIFT, David Lowe. &lt;/p&gt;&#xA;" OwnerUserId="420" LastEditorUserId="420" LastEditDate="2012-01-14T16:13:34.820" LastActivityDate="2012-01-14T16:13:34.820" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1124" PostTypeId="1" AcceptedAnswerId="1126" CreationDate="2012-01-12T23:08:40.207" Score="3" ViewCount="577" Body="&lt;p&gt;It seems that I haven't studied enough about FM Synthesis.&#xA;My current algorithm looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;modulator = sin( 2 * pi * fm_freq * i/sample_rate )&#xA;carrier = sin( 2 * pi * ( freq + modulator ) * i/sample_rate )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of generating one stable waveform, it generates a sound warping from a pure sine wave to something awfully distorted. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="795" LastActivityDate="2012-01-13T08:53:14.287" Title="Strange results from my FM synthesis algorithm" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1125" PostTypeId="2" ParentId="1124" CreationDate="2012-01-13T00:06:45.897" Score="4" Body="&lt;p&gt;What you're doing is actually phase modulation rather than frequency modulation. You mustn't multiply the modulator with the sample index then, though: try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;carrier = sin( 2 * pi * ( freq*i/sample_rate + modulator ) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An actual frequency modulation is not quite as simple, it would be rather something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;phi += 2 * pi * (freq + modulator)/sample_rate&#xA;carrier = sin(phi)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="246" LastEditorUserId="246" LastEditDate="2012-01-13T00:11:47.120" LastActivityDate="2012-01-13T00:11:47.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1126" PostTypeId="2" ParentId="1124" CreationDate="2012-01-13T08:53:14.287" Score="6" Body="&lt;p&gt;It should be more like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;modulator = A_mod * sin(2 * pi * fm_freq * i / sample_rate)&#xA;&#xA;carrier = sin (2 * pi * (freq * (1 + modulator)) * i / sample_rate)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The two main changes are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the modulation signal needs a scale factor (&lt;code&gt;A_mod&lt;/code&gt;) which determines the amplitude of the FM - typically &lt;code&gt;A_mod &amp;lt;&amp;lt; 1&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the carrier frequency needs to be multiplied by &lt;code&gt;(1 + modulator)&lt;/code&gt; rather than just &lt;code&gt;modulator&lt;/code&gt;, since it needs to be centered about &lt;code&gt;freq&lt;/code&gt; with a deviation of &lt;code&gt;+/- A_mod * freq&lt;/code&gt; (in your version the centre frequency is zero and your instantaneous frequency is varying between &lt;code&gt;+/- freq&lt;/code&gt; !).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="39" LastActivityDate="2012-01-13T08:53:14.287" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1127" PostTypeId="1" AcceptedAnswerId="1128" CreationDate="2012-01-13T11:19:49.727" Score="3" ViewCount="157" Body="&lt;p&gt;In a few days I have an exam of image processing. I'm currently having a look at the example exam and I came across this question. &quot;Which transformation of this image is being done here. Explain the components in the quadrants NA (second image).&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qwrq3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NXg2X.png&quot; alt=&quot;enter image description here&quot;&gt;Na&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me with this ? &lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="1059" LastEditDate="2013-01-16T02:25:29.470" LastActivityDate="2013-01-16T02:25:29.470" Title="What transformations have been applied to this image to yield four derivatives?" Tags="|image-processing|homework|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1128" PostTypeId="2" ParentId="1127" CreationDate="2012-01-13T15:51:48.730" Score="5" Body="&lt;p&gt;This to me looks exactly like the two-dimensional &lt;a href=&quot;http://cam.mathlab.stthomas.edu/wavelets/pdffiles/NewOrleans07/HaarTransform.pdf&quot;&gt;Haar wavelet transform&lt;/a&gt;. All four quadrants are a part of the transform, even though different operations have been performed on them. Upper left quadrant is a result of low-pass filtering with a 2x2 two-dimensional rect function (Haar wavelet) and decimation be a factor of 2, upper right is the output of a horizontal high-pass filter, lower left is the output of a vertical high-pass filter, and lower right is the output of a diagonal high-pass filter.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-01-13T15:51:48.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1129" PostTypeId="1" AcceptedAnswerId="1132" CreationDate="2012-01-13T18:25:29.687" Score="8" ViewCount="4142" Body="&lt;p&gt;I would like to implement a fourth order fixed point low-pass IIR filter in C (with Q15 arithmetic), and I will prepare this filter by using two stages cascaded direct form-II bi-quad filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found countless C implementations and example coefficients on the digital signal processing books, but I saw non of them is not reliable during the verification (they create overflows, does not attenuate expected frequency components, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which C implementation is suitable for this problem? And also, is there any sample coefficients to verify this implementation?&lt;/p&gt;&#xA;" OwnerUserId="798" LastActivityDate="2020-06-29T12:08:53.720" Title="Realtime fixed point IIR filter implementation in C" Tags="|biquad|infinite-impulse-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1130" PostTypeId="1" CreationDate="2012-01-13T18:47:38.310" Score="3" ViewCount="853" Body="&lt;p&gt;What are the most used techniques for lip sync (audio/video sync) for conferencing over IP (and related issues with playout buffering)? I could find a lot of paper about audio intrastream synchronization, but only a few dealing with audio and video all together.&lt;/p&gt;&#xA;" OwnerUserId="11" LastEditorUserId="13320" LastEditDate="2016-05-13T10:39:55.270" LastActivityDate="2016-05-13T10:39:55.270" Title="Lip sync over IP" Tags="|audio|video-processing|synchronization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1131" PostTypeId="2" ParentId="1075" CreationDate="2012-01-13T20:09:13.630" Score="0" Body="&lt;p&gt;It is most efficient to vectorise the filtering of several independent streams in parallel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just have a single long stream you could also split the stream into several overlapping sections and filter these as if they were independent streams.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want an overlap because the first few samples of each stream will be incorrect.  The amount of samples you need to discard will depend on the value of a and the desired precision.&#xA;You will want to discard about n samples where (1/a)(1-a)**n &amp;lt; eps in order that the result will be accurate to eps*max(|x[i]|).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if a=0.1, then in 128 samples the error caused by (1/a)(1-a)^n would be less than the LSB in a 16bit integer, while for a=0.9 you would only need to discard about 6 samples. &lt;/p&gt;&#xA;" OwnerUserId="800" LastActivityDate="2012-01-13T20:09:13.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1132" PostTypeId="2" ParentId="1129" CreationDate="2012-01-13T20:57:35.710" Score="11" Body="&lt;p&gt;Although this seems like a remarkably simple questions, it requires a remarkably complicated answer.&lt;/p&gt;&#xA;&lt;p&gt;I don't think there is a &amp;quot;one-size&amp;quot; fits all solution. The best choice of algorithm will depend on what noise you can tolerate and the type of low pass (steepness &amp;amp; frequency). For example at 44.1 KHz sample rate a 4th order Butterworth at 10 kHz is fairly straight forward, whereas a lowpass at a 100Hz is a royal pain. In essence it depends on how close your poles are to the unit circle.&lt;/p&gt;&#xA;&lt;p&gt;Quantization and rounding error of IIR filters are usually transfered to the output weighed by the pole-only transfer function. A 4th order Butterworth 10 kHz low pass filter has a worst case noise amplification of only 5dB, so that is not much of a problem.&lt;/p&gt;&#xA;&lt;p&gt;However at a 100 Hz low pass (again 4th order BW) the noise gets amplified by a whopping 75 dB. If you use Q15 math, your basic noise floor is maybe at -100dB or so. After the filter, your signal to noise ratio will only be 25 dB.&lt;/p&gt;&#xA;&lt;p&gt;That's one of the reasons why fixed point IIR filters are fairly complicated. IF you need low cutoff frequencies and half way decent signal to noise ratio, then the basic algorithms will not work. You need to look into double precision math and/or error spectrum shaping or related methods.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="40918" LastEditDate="2020-06-29T12:08:53.720" LastActivityDate="2020-06-29T12:08:53.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1133" PostTypeId="2" ParentId="1130" CreationDate="2012-01-14T11:35:10.987" Score="6" Body="&lt;p&gt;Before going to IP, I would like to draw your attention to lip synchronization techniques used in broadcast domain. This is also one of the toughest ones because here not only you want to maintain a very accurate lip sync - but require this on an ever running system 24x7x365 for a television networks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get more insight about this i would recommend reading up about packetized compressed Audio/Video is actually MPEG2 -System layer. See this: &lt;a href=&quot;http://downloads.bbc.co.uk/rd/pubs/reports/1996-02.pdf&quot; rel=&quot;nofollow&quot;&gt;http://downloads.bbc.co.uk/rd/pubs/reports/1996-02.pdf&lt;/a&gt;. Section 8 explains the Time synchronization aspect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, every encoder records timestamps and stamps it on the respective Audio video. Later on, when decoder plays it, it does two things - one, ensures that decoer's own clock is &quot;enslaved&quot; with encoder's clock, and two it ensure that every picture is presented on the screen and audio frame presented to speaker exactly when that respective time occurs. This is only and best way that audio remains in synchronization with video. These timestamps are called PTS/DTS values which are of resolution of 90 Khz clock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this is not the end of the solution. Understand that over time clocks skew but since only the exact time is referenced, decoder playout exactly in same time order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the major concern remains is that decoder's clock needs to remain in control/synchronization of encoder's clock. The first thing done in MPEG is using a higher precision at 27 MHz, (300 times higher). Further, this needs to remain consistent during any transmission path in the middle. (this is called clock recovery process).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A detailed paper that explains the time stamping schemes is here: &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.975&quot; rel=&quot;nofollow&quot;&gt;Timestamping Schemes for MPEG-2 Systems Layer and Their Effect on Receiver Clock Recovery (1998) by Christos Tryfonas , Anujan Varma, IEEE Transactions on Multimedia&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is another widely cited paper about this as a general theory. &#xA;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=285155&quot; rel=&quot;nofollow&quot;&gt;R. P. Singh, Sang-Hoon Lee, Chong-Kwoon Kim, “Jitter and Clock Recovery for Periodic&#xA;Traffic in Broadband Packet Networks”, IEEE Trans. on Communications, Vol. 42, No. 5, May&#xA;1994.&lt;/a&gt; or this &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.86.1016&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;A New Method for Clock Recovery in MPEG Decoders&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now coming to IP networks&lt;/strong&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;here there are other aspects to understand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;There is a much higher level of uncertainty of bandwidth (even on a reasonably good networks).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Usually, the system is serving one (in unicast) or fewer (multicast) users simultaneously unlike much broader assumption by broadcast. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The overall system is only a finite duration as opposed to live 24x7 broadcast. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Almost all basic principles remains same. However, few things are done additionally. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Receiver needs to keep a significantly larger buffer. Typically this is in addition to buffers that are described in MPEG2 TS case. The larger the buffer the larger is the delay to start but lesser chance to run out of content. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have followed above, time at which the clock packets arrive are used for decoder's clock synchronization. Actually, Decoder clock synchronization is quite often omitted in case of IP based systems - because even if the clocks diverge if you are running only a 10 minute clip the effect is not quite visible. However, if there is a long VoD session, may be such a clock recovery can apply - but still the jitter of IP network will be way too much. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In such cases, one uses &lt;a href=&quot;http://www.ietf.org/rfc/rfc3550.txt&quot; rel=&quot;nofollow&quot;&gt;RTP protocol&lt;/a&gt; in this case, additional time stamps on the per packet basis is applied which indicates the typical theoretical time of arrival it would have had, if there was no jitter. In addition to this - in order to make local clocks of the  receiver synchronized to that of sender NTP time stamps based packets are used. RTP flows are synchronised by receivers based on information that is contained in RTCP SR packets generated by senders. For details, read section 6 of &lt;a href=&quot;http://www.ietf.org/rfc/rfc3550.txt&quot; rel=&quot;nofollow&quot;&gt;RTP rfc&lt;/a&gt; gives a complete account on how RTCP packets can be used for synchronization.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-05-30T14:47:48.013" LastActivityDate="2012-05-30T14:47:48.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1134" PostTypeId="2" ParentId="1112" CreationDate="2012-01-14T14:48:21.493" Score="4" Body="&lt;p&gt;Auto-correlation is certainly a good basic method for that. There are a few things you can do to potentially enhance this further:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If you know the frequency spectrum of your drum, bandpass filter the&#xA;signal so that only the frequencies relevant to the drum remain.&#xA;Depending on the drum this could be quite narrow and should get rid&#xA;of the vast majority of the noise.&lt;/li&gt;&#xA;&lt;li&gt;Then calculate the time domain envelope of the signal (&quot;lossy peak&quot;&#xA;is the easiest way to do this) with a time constant that's&#xA;roughly matched to the length of the drum beats.&lt;/li&gt;&#xA;&lt;li&gt;Then do the auto-correlation &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-01-14T14:48:21.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1135" PostTypeId="1" AcceptedAnswerId="1140" CreationDate="2012-01-15T02:14:21.093" Score="26" ViewCount="1469" Body="&lt;p&gt;I'm interested in &lt;strong&gt;finding all tennis courts&lt;/strong&gt; (and other similar well defined features like basketball courts) in my county, and I have aerial imagery of good (but varying) resolution, but I'm not sure of the best way to find them. Here are two examples of the imagery:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ADQe9.jpg&quot; alt=&quot;Tennis courts and basketball courts from VBMP 2009&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/naNGW.jpg&quot; alt=&quot;Tennis courts from Bing&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at the various methods, and I think &lt;strong&gt;template matching&lt;/strong&gt; wouldn't work as it would be very slow since there can be &lt;strong&gt;arbitrary scale and rotation&lt;/strong&gt;, and also the color can vary. The &lt;strong&gt;Hough transform&lt;/strong&gt; sounds promising, but once I get all the lines I'm not sure how to find lines that constitute a rectangle with the appropriate ratio (about 36x29 feet), or better yet to account for the other marked lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For background, I'm aiming to add all tennis courts in my county to OpenStreetMap.&lt;/p&gt;&#xA;" OwnerUserId="801" LastActivityDate="2012-12-04T17:23:42.653" Title="How to find tennis courts in aerial imagery" Tags="|computer-vision|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1136" PostTypeId="1" AcceptedAnswerId="1139" CreationDate="2012-01-13T15:28:48.093" Score="6" ViewCount="15985" Body="&lt;p&gt;I need to find the bandwidth the signal $x = 50 \operatorname{sinc}(125(t-10))^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Where $\operatorname{sinc}(x)=\dfrac{\sin (\pi x)}{\pi x}$ [normalized] or $\operatorname{sinc}(x)=\dfrac{\sin x}{x}$ [unnormalized])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about doing this in MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="852" OwnerDisplayName="skipfer0712" LastEditorUserId="440" LastEditDate="2012-04-17T08:32:48.360" LastActivityDate="2012-04-17T08:32:48.360" Title="Bandwidth of a signal using MATLAB" Tags="|matlab|bandwidth|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1137" PostTypeId="1" AcceptedAnswerId="1184" CreationDate="2012-01-15T08:27:10.557" Score="9" ViewCount="558" Body="&lt;p&gt;I am trying to search for image/video compression schemes which offer superior compression performance (holding image quality as constant) when compared to widely adopted industry standards (i.e. JPEG/H.264), but for reasons of them being either too computationally or resource intensive, implementing them on CPU-based workstations is infeasible and therefore unadopted in common standards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could only think of fractal compression as a good example. Does the community know of any more of such examples?&lt;/p&gt;&#xA;" OwnerUserId="803" LastEditorUserId="440" LastEditDate="2017-06-21T11:56:21.617" LastActivityDate="2017-06-21T11:56:21.617" Title="Extremely computationally intensive image/video compression schemes which offer better compression than industry standard JPEG/H.264" Tags="|image-processing|video-processing|video-compression|jpeg|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1138" PostTypeId="1" AcceptedAnswerId="1151" CreationDate="2012-01-15T14:40:17.067" Score="8" ViewCount="415" Body="&lt;p&gt;It may be a very simple question. We would appreciate any comments, guide or complete solution. We prefer however &lt;strong&gt;incomplete&lt;/strong&gt; solutions but novel practical ideas.&lt;br&gt;&#xA; &lt;strong&gt;- How to find the main direction of variation i.e., main diagonal in the following example figure (north-east,south-west)?&lt;/strong&gt;&lt;br&gt;&#xA;Any algorithm and idea for coding or snippet is welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q28aD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updates:&lt;/strong&gt;&lt;br&gt;&#xA;We found that the procedure mentioned in the accepted answer is almost &lt;a href=&quot;http://en.wikipedia.org/wiki/Principal_component_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;PCA (Principal Component Analysis)&lt;/a&gt; in its simplest implementation. PCA worked very well. The resulting direction is perfectly matched with what we could expect, visually.&lt;/p&gt;&#xA;" OwnerUserId="488" LastEditorUserId="488" LastEditDate="2012-01-18T09:04:34.197" LastActivityDate="2012-01-18T09:04:34.197" Title="main direction in 2D map of data" Tags="|image-processing|algorithms|anisotropic-diffusion|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1139" PostTypeId="2" ParentId="1136" CreationDate="2012-01-15T14:44:51.163" Score="16" Body="&lt;p&gt;That actually would be a great interview questions. Let's derive it from scratch:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$\text{sinc}(x)$: The Fourier Transform of a $\text{sinc}(x)$ is a rectangle. The normalized $\text{sinc}()$ function results in a bandwidth of 1 Hz (from -0.5Hz to 0.5Hz)&lt;/li&gt;&#xA;&lt;li&gt;$t-10$: The $(t-10)$ term is irrelevant to the bandwidth: time shift&#xA;is equivalent to multiplying with $e^{-j\omega t_0}$, where $t_0$ is time shift, in&#xA;the frequency domain. That changes the phase but not the amplitude&#xA;or bandwidth&lt;/li&gt;&#xA;&lt;li&gt;$125*t$: that is a time compression which results in frequency&#xA;stretching. Since we compress time by 125 the bandwidth increases by&#xA;125, i.e. to 125 Hz (from -62.5 Hz to 62.5 Hz)&lt;/li&gt;&#xA;&lt;li&gt;$(\cdot)^2$: Squaring is multiplication in the time domain which corresponds to convolution in the frequency domain. The convolution of two equal rectangles is a triangle. The bandwidth doubles to 250 Hz (from -125 Hz to 125Hz). In general the bandwidth of the multiplication of two arbitrary signals is the sum of the individual bandwidths. That's a simple consequence of the multiplication laws for sine and cosine: you get only sum and difference frequencies.&lt;/li&gt;&#xA;&lt;li&gt;$50*(\cdot)$: that's a simple scale factor that doesn't change the shape of phase or amplitude.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So overall we would expect the spectrum to be of triangular shape (on a double linear plot) going from -125 Hz to +125 Hz with a total bandwidth of 250 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing the Matlab code for this is not as simple as it looks. The code itself is trivial, however you have to pick a sample rate and a proper time axis. In order to do this you need to assess the general shape of the signals first. For example the time domain signal technically goes from $-\infty$ to $+\infty$ and is centered around $t$ = 10s. &lt;code&gt;t = 0:.01:5&lt;/code&gt;, really won't do the trick. So in essence you have to do the theoretical analysis before you can write the code (which tends to be a recurring theme in DSP :-))&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% 1000 HZ sample rate, since we now the BW is smaller than 500 Hz&#xA;fs = 1000; &#xA;% pick a good time length. Because of the time shift we need significantly more&#xA;% than 10s. Technically the sinc() has inifite length so we need to extend&#xA;% it far enough to cover the vast part of the energy AND we need to start&#xA;% at negative times, not at t = 0;&#xA;n = 2^16; % that's about 60s. Should be plenty&#xA;t = (-n/2:n/2-1)'/fs;   % time axis in seconds, symmetric around t = 0;&#xA;x = 50*sinc(125*(t-10)).^2;&#xA;% frequency axis:&#xA;f0 = fs/n;  % frequency resoution in Hz&#xA;faxis = (-n/2:n/2-1)'*f0;   % frequency axis in Hz seconds, symmetric around f = 0;&#xA;fx = fft(x);&#xA;plot(faxis,circshift(abs(fx),n/2));&#xA;title('Spectrum of 50*sinc(125*(t-10)).^2');&#xA;xlabel('Frequency in Hz');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2012-01-15T23:52:54.433" LastActivityDate="2012-01-15T23:52:54.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1140" PostTypeId="2" ParentId="1135" CreationDate="2012-01-15T17:36:14.537" Score="15" Body="&lt;p&gt;You have some very strong color and geometry cues you can leverage. I would try the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Extract the Green channel &amp;amp; apply &lt;a href=&quot;http://en.wikipedia.org/wiki/Watershed_%28image_processing%29&quot;&gt;watershed&lt;/a&gt; type algorithm on it, followed by &lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling&quot;&gt;connected components&lt;/a&gt;. Subsequently compute component statistics (area &amp;amp; bounding box) for each component. Retain only the components with area ~= bounding box size. This will be true only for rectangular objects and will eliminate forests/wooded areas etc.&lt;/li&gt;&#xA;&lt;li&gt;Isolate the white channel (R=G=B) and apply hough transform on the output. This will give you the lines. &#xA;Combine 1 &amp;amp; 2 to get your tennis courts.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="632" LastActivityDate="2012-01-15T17:36:14.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1141" PostTypeId="1" CreationDate="2012-01-15T17:54:40.487" Score="3" ViewCount="588" Body="&lt;p&gt;I'm trying to implement a simple demodulator as an evening project (to understand how this works - my background is in physics not engineering) and was wondering if anyone has any advice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make a working demodulator I think I need to implement an:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Equaliser (I was thinking of using a steepest descent algorithm).&lt;/li&gt;&#xA;&lt;li&gt;Channeliser (I don't know how to go about this)&lt;/li&gt;&#xA;&lt;li&gt;A carrier (or phase-locked?) loop&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of any (hopefully free) resources that will help me?&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2012-01-15T18:09:32.157" Title="Implementing a basic demodulator" Tags="|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1142" PostTypeId="2" ParentId="1141" CreationDate="2012-01-15T18:09:32.157" Score="3" Body="&lt;p&gt;What type of signal do you need to demodulate (&lt;a href=&quot;http://en.wikipedia.org/wiki/BPSK#Binary_phase-shift_keying_.28BPSK.29&quot; rel=&quot;nofollow&quot;&gt;BPSK&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency-shift_keying&quot; rel=&quot;nofollow&quot;&gt;FSK&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/OFDM&quot; rel=&quot;nofollow&quot;&gt;OFDM&lt;/a&gt;, etc.)? While a lot of practical systems have them, you don't always need an &lt;a href=&quot;http://en.wikipedia.org/wiki/Equalizer_%28communications%29&quot; rel=&quot;nofollow&quot;&gt;equalizer&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_locked_loop&quot; rel=&quot;nofollow&quot;&gt;phase-locked loop&lt;/a&gt;, especially if you're just making a toy simulation where you control all the conditions. If you've never done this before, I wouldn't recommend jumping in with all of that included. Each of those topics that you brought up is a large area of study in itself, so I can't really cover all of the theory in a single answer. I would operate in the following order:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate a modulated signal with no noise. Build your receiver and show that you can extract the information data out successfully (since there are no real impairments, you should be able to do this perfectly in simulation).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add &lt;a href=&quot;http://en.wikipedia.org/wiki/AWGN&quot; rel=&quot;nofollow&quot;&gt;white Gaussian noise&lt;/a&gt; to the input signal that your receiver operates on. Test the receiver to calculate its &lt;a href=&quot;http://en.wikipedia.org/wiki/Bit_error_rate&quot; rel=&quot;nofollow&quot;&gt;bit error rate&lt;/a&gt; at its output as a function of the signal-to-noise ratio in the receiver input signal. Compare these results to theoretical results found in a digital communications textbook (like &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0072957166&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; or &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0130847887&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;) to verify that you're operating correctly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add a frequency and/or phase offset to the receiver's input signal. Experiment with different techniques for correcting the offset in your receiver (as you noted, a phase-locked loop is one such way). Compare the receiver's bit error rate with and without the phase/frequency synchronizer in place.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add channel effects to your simulation (i.e. &lt;a href=&quot;http://en.wikipedia.org/wiki/Multipath_propagation&quot; rel=&quot;nofollow&quot;&gt;multipath&lt;/a&gt;). This can be simulated by convolving the transmitted signal with a simulated channel impulse response. There are a lot of different channel models out there, depending upon the type of scenario that you want to test. At the receiver, add an equalizer that attempts to correct for the channel effects. The easiest-to-implement adaptive equalizer is probably one based on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_mean_squares_filter&quot; rel=&quot;nofollow&quot;&gt;LMS algorithm&lt;/a&gt;. Compare the bit error rate at the receiver with and without the equalizer in place.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is very high-level and each step is complicated in and of itself, but you're certain to run into trouble if you try to do everything at once with no background.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-01-15T18:09:32.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1143" PostTypeId="1" AcceptedAnswerId="1152" CreationDate="2012-01-15T19:10:59.870" Score="3" ViewCount="303" Body="&lt;p&gt;Whenever we need to find component of one signal along another signal we can do so by the help of dot product. I want to as if this method is valid for all kind of signals. Are there any restrictions upon either of the signals? &lt;/p&gt;&#xA;" OwnerUserId="807" LastEditorUserId="807" LastEditDate="2012-01-16T15:27:13.057" LastActivityDate="2012-01-16T16:10:56.813" Title="Component of one signal along the another" Tags="|correlation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1144" PostTypeId="1" AcceptedAnswerId="1173" CreationDate="2012-01-15T22:56:51.423" Score="17" ViewCount="8568" Body="&lt;p&gt;I was explaining to someone how Fourier series work in context of constructing signals that are not everywhere differentiable, e.g. square waves, sawtooth waves, etc. When I mentioned the Gibbs phenomenon however, I realized that I never really learned of why it happens. In fact, as the story goes, not everyone even realized that it's an actual mathematical property of infinite series of periodic signals and not a computational fluke, and it turns out that most proofs are fairly laborious and elaborate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading several of them, I started realizing why such phenomenon might occur, but I have a background in real and complex analysis, topology and so on. The question is can I fully explain and rigorously prove Gibbs phenomenon mathematically to someone with only the basic undergraduate calculus courses in their arsenal (or any other general prerequisites for an undergraduate signal processing course)? If so, then how?&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2020-02-13T14:39:25.773" Title="A good mathematical explanation of Gibbs phenomenon" Tags="|fourier-series|gibbs-phenomenon|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1145" PostTypeId="5" CreationDate="2012-01-15T23:24:49.177" Score="0" Body="&lt;p&gt;Biquad is a second order filter with transfer function $H(z)=\dfrac{b_0 + b_1z^{-1} + b_2z^{-2}}{1+a_1z^{-1}+a_2z^{-2}}$ for digital systems and $H(s)=\dfrac{b_2s^2 + b_1s + b_0 }{s^2+\frac{\omega}{Q}s+\omega ^2}$ for analog systems.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-01-15T23:24:49.177" LastActivityDate="2012-01-15T23:24:49.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1146" PostTypeId="4" CreationDate="2012-01-15T23:24:49.177" Score="0" Body="Biquad is referred to either analog or digital second order filters" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-01-15T23:24:49.177" LastActivityDate="2012-01-15T23:24:49.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1148" PostTypeId="2" ParentId="1138" CreationDate="2012-01-16T03:48:36.413" Score="4" Body="&lt;p&gt;Here are a few ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the contours are not already in separate data structures, use an edge-following (a.k.a. &quot;contour tracing&quot;) algorithm to follow each one. Once you have the contour, find the two points farthest apart. Once you have the two points farthest apart (Feret's diameter), take the midpoint of those points, project out a perpendicular line, and check what you may be something like a minor axis of a rough elliptical shape. Check the pair of 2nd farthest points and their &quot;minor axis&quot;, the 3rd farthest, etc. &lt;/li&gt;&#xA;&lt;li&gt;From the center of mass of the innermost contour, scan outwards in radial directions. Keep track of the crossing points at each contour. The radial direction (or group of radial directions) with the greatest average contour-to-contour distance will have the gentlest slope and longest distance.&lt;/li&gt;&#xA;&lt;li&gt;Perform a &quot;water drop&quot; test. This requires a little physics. Imagine you have a drop of water or ball at your peak (somewhere inside the innermost contour). Push it in some radial direction theta. Given gravity and a nominally frictionless surface, calculate the speed of your drop/ball when it reaches the bottom horizontal plane.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For any of the above techniques, consider angles from 0 to 179 even though you may use a radial technique (0 to 359 degrees). If there is more than one peak response, find the longest radius (or whatever) that has more neighbors with large responses.&lt;/p&gt;&#xA;" OwnerUserId="742" LastActivityDate="2012-01-16T03:48:36.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1149" PostTypeId="2" ParentId="945" CreationDate="2012-01-16T04:18:03.710" Score="1" Body="&lt;p&gt;If for some reason you're limited to using morphological operations, then you can consider using a &quot;voting scheme&quot; of oriented close operations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One problem with morphological operations is that they don't really take directionality into account. For the center pixel, a neighborhood like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 0 0&#xA;1 1 0&#xA;0 1 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is really no different than a neighborhood like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 1 0&#xA;1 1 0&#xA;1 1 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That can cause problems since dilation and erosion aren't directionally biased when you might like them to be. So one thing you can do is find the most appropriate directionally biased morphological operation using kernels something like these:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 1 0   1 0 0   1 0 0&#xA;0 1 0   1 1 0   1 1 0&#xA;0 1 1   0 1 1   0 1 1 . . .&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would be better with 5 x 5 kernels, but I think the idea is clear enough. Basically, the idea of a corner detection kernel is stretch a bit so that it's a line segment detection kernel. You could also use it to find best-fit curves:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 0 1 1&#xA;0 0 1 1 0&#xA;0 1 1 0 0 &#xA;0 0 1 1 0&#xA;0 0 0 1 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously this leads to a huge number of kernels, but if the basic idea works shows promise for you there's a way to optimize the technique so that the best-fit kernel is found in a single pass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, if you use multiple kernels and some logic, each operation at (x,y) requires more calculations than a traditional morphological step:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;At each pixel (x,y), apply each of several morphological operators. For each operator, calculate both the result of the morphological operation AND the degree to which the input matches the kernel. (&quot;Degree&quot; = number of pixels that match)&lt;/li&gt;&#xA;&lt;li&gt;Choose the morphological result for the kernel that most closely matches the actual on/off pixel configuration.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The size of the kernel must be matched to the size of the input. Rather than using a larger kernel, you could use a &quot;spread&quot; kernel to reduce the number of operations. The following kernel is just a 3 x 3 kernel with a radius larger than 1.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 0 0 0 0 0 0&#xA;0 0 0 0 0 0 0&#xA;1 0 0 1 0 0 0&#xA;0 0 0 0 0 0 0&#xA;1 0 0 0 0 0 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="742" LastActivityDate="2012-01-16T04:18:03.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1150" PostTypeId="2" ParentId="1080" CreationDate="2012-01-16T04:27:17.950" Score="0" Body="&lt;p&gt;For an image this simple a convolution kernel like the following will find edges nicely:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[-1 2 - 1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This yields a single edge pixel at each edge point. No fuss, no muss. Canny is too involved for this problem. If you want to find edge points for lines at any angle, then you can use a simple Laplacian, Laplacian of Gaussian (LoG), or Difference of Gaussian (DoG). Sobel and Prewitt are also simple but inappropriate since they yield a &quot;double thickness&quot; line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a wicked fast implementation of Hough described here:&#xA;&lt;a href=&quot;http://www.ic.uff.br/~laffernandes/projects/kht/index.html&quot; rel=&quot;nofollow&quot;&gt;http://www.ic.uff.br/~laffernandes/projects/kht/index.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also &quot;parameterless Hough&quot; algorithms that are very fast, but a bit tricky to implement and debug.&lt;/p&gt;&#xA;" OwnerUserId="742" LastActivityDate="2012-01-16T04:27:17.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1151" PostTypeId="2" ParentId="1138" CreationDate="2012-01-16T10:19:17.723" Score="7" Body="&lt;p&gt;You could compute the covariance matrix from your elevation data. The eigenvector that belongs to the larger eigenvalue will give you the main direction of variation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Covariance_matrix&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Covariance_matrix&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="6" LastEditDate="2012-01-16T14:21:56.360" LastActivityDate="2012-01-16T14:21:56.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1152" PostTypeId="2" ParentId="1143" CreationDate="2012-01-16T16:04:05.800" Score="5" Body="&lt;p&gt;Generally speaking, about the only restriction that the signals need satisfy is that they have finite energy or power.  Since you mention vectors by which is presumably meant $N$-tuples of real or complex numbers and dot products, the restriction is the trivial one that each component of the $N$-tuple has finite value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically, there are several issues that you need to think about depending &#xA;on what you are trying to do.  Obviously&#xA;$$\langle \mathbf x, \mathbf y \rangle = \sum_{n=1}^N x[n](y[n])^*$$&#xA;is the dot product but how accurate a measure it is of the inner product&#xA;$$\langle x(t), y(t) \rangle = \int_{-\infty}^{\infty} x(t)(y(t))^* \mathrm dt$$ &#xA;of the continuous-time signals $x(t)$ and $y(t)$ from which these samples &#xA;came depends on whether the signals were filtered before sampling, the&#xA;sampling rate, whether the samples span the entire time interval where&#xA;the signals are nonzero, whether windowing was applied to the samples, etc.&#xA;You might be interested in the &lt;em&gt;cross-correlation function&lt;/em&gt; $R_{x,y}(\cdot)$&#xA;instead of just the inner product (which is $R_{x,y}(0)$) in which case&#xA;FFTs might be used and you have to make sure that the signals are properly &#xA;zero-padded so that you get the right answers. Finally, we began with&#xA;the &quot;trivial&quot; restriction that each component is finite which always holds&#xA;in practice, but if the components are large in magnitude, you need to worry&#xA;about  the possibility of overflow in the inner product computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as you can see,&#xA;in theory, theory and practice are the same, but in practice, they are &#xA;different.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-01-16T16:10:56.813" LastActivityDate="2012-01-16T16:10:56.813" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1153" PostTypeId="1" CreationDate="2012-01-16T16:36:49.280" Score="3" ViewCount="235" Body="&lt;p&gt;I'm trying to perform automatic pitch tracking for piano. It's easy to detect the note when there's only a single note pressed. There are &lt;a href=&quot;http://en.wikipedia.org/wiki/Piano_key_frequencies&quot; rel=&quot;nofollow&quot;&gt;88 keys on the piano&lt;/a&gt; and I set the result to one of them. There may be misclassifications due to octave shift. For example, instead of 40, I find 52. They are both C, but 52 is one octave up. I can remove most of these octave shifts by performing median filtering on the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it is confusing when I move to polyphonic pitch tracking. When there are more than a single note pressed together, there can be varying number of pitches detected at time t.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let &lt;code&gt;labels(f,t)&lt;/code&gt; be 1 if note f is detected at time t and let the binary matrix &lt;code&gt;labels&lt;/code&gt; it be as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;labels = 0 0 0 0 1 ...&#xA;         1 1 0 1 0 ...&#xA;         0 1 0 0 1 ...&#xA;         .............&#xA;         0 0 1 0 1 ...&#xA;         .............&#xA;         0 0 0 0 1 ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let the detected notes be as follows correspondingly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;labelsAsNotes = 2; 2 3; 14; 2; 1 3 14 88; ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I do median filtering in this case? Do you have any other recommendations to remove octave shifts?&lt;/p&gt;&#xA;" OwnerUserId="482" LastActivityDate="2012-01-16T21:12:04.957" Title="How to perform median filtering in multi-label prediction" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1154" PostTypeId="1" AcceptedAnswerId="1163" CreationDate="2012-01-16T19:16:05.600" Score="1" ViewCount="3486" Body="&lt;p&gt;I am looking for open source implementation of thinning algorithm in 3D. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thinning algorithm: Convert binary shapes to 1-pixel wide lines, without shortening it or breaking it apart. For example, the thresholded version of hand written or printed alphanumerics can be thinned for better represetation and further processing.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This particular thinning algorithm I am looking for &lt;strong&gt;does not disconnect an object or split an object up into multiple parts. Moreover, it does not shorten the shape.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there such source codes available? If 3D is not available, 2D is fine too. I can take it from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somebody has requested me to elaborate on what am I after. Here:  &lt;a href=&quot;http://www.mip.sdu.dk/ipl98/how_to_use_ipl98/tutorial/node52.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mip.sdu.dk/ipl98/how_to_use_ipl98/tutorial/node52.html&lt;/a&gt; There are several images in the link here on thinning and skeletonization. I can see that thinned algorithm and skeletonization algorithm produce similar yet different result. But what I am after is to have all shapes in a binary image to become thinned without shortening the shape. To clarify things further, here is what I wanted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is original image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BXL13.png&quot; alt=&quot;original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is skeleton image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ViVxT.png&quot; alt=&quot;skel&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is thinned image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0rCEl.png&quot; alt=&quot;thin&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, skeleton image and thinned image have different results. Thinned image has lesser lines and produce an outline that looks more like the thinned original. But these images are in 2D, &lt;strong&gt;I am looking for an algorithm to do thinned binary image in 3D.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="263" LastEditorUserId="263" LastEditDate="2012-01-18T05:45:38.933" LastActivityDate="2012-01-18T05:45:38.933" Title="Open Source Implementation of 3D Thinning algorithm" Tags="|image-processing|algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1155" PostTypeId="1" CreationDate="2012-01-16T20:25:11.447" Score="5" ViewCount="341" Body="&lt;p&gt;I want to amplify regions with a specified color in an image. For this purpose I have defined a simple function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B(x,y)=s_r(x,y) \cdot w_r + s_g(x,y) \cdot w_g + s_b(x,y) \cdot w_b$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which produces a gray scale image B(x,y).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weights I have defined with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w_r \in [-2,2],w_g \in [-2,2], w_b \in [-2,2]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The channels of the images are the functions $s_x$ for each channel.&#xA;I use the result of this amplification for a color thresholding. For example for yellow I have manually defined&#xA;$w_r=1$, $w_g=1$ and $w_b = -2$.&#xA;My Problem now is, to get &quot;good&quot; values for the weights automatically. First I thought taking the maximal values of histograms would be a good way, but the results are not satisfactorily. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I automatically determine the weights for the amplification? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you deal with white and black?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there a better way to amplify the regions with a specific color?&lt;/p&gt;&#xA;" OwnerUserId="812" LastActivityDate="2012-01-17T04:30:00.237" Title="How to amplify regions with specific color in an image?" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1156" PostTypeId="2" ParentId="1153" CreationDate="2012-01-16T21:12:04.957" Score="6" Body="&lt;p&gt;I don't think median filtering is a good approach for this problem. It is definitely used as a smoothing mechanism in single pitch tracking, but I don't think that's necessarily the best way to go. For example, when tracking single pitches, a dynamic programming algorithm can be really powerful. At each frame of audio you have pitch candidates with some strength to them. Dynamic programming lets you find an optimal path between those candidates such that you penalize big jumps in pitch (like a whole octave) while promoting pitch candidates with high weights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I'm aware, though, this doesn't scale well to multiple pitches. I have seen authors use this algorithm to track just two pitches in the case of two concurrent speakers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a really hard problem to solve in general, and I don't think just filtering that binary matrix will be sufficient -- I think you want some sort of weights associated with each pitch candidate, and to make decisions with those weights. You can also take time into account -- if you detect two notes that are an octave (or other integer multiple) apart, and follow the same relative pitch trajectory and onset at exactly the same time, they are probably the same note. You could also try using the weights to inhibit octave errors -- for example, if you detect a note, but there's significant energy at half its frequency, you might be looking at an octave error.&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2012-01-16T21:12:04.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1157" PostTypeId="1" AcceptedAnswerId="1160" CreationDate="2012-01-15T08:08:11.727" Score="11" ViewCount="2179" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k8N5s.png&quot; alt=&quot;orange&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was the image obtained after Gabor filtering... Is there some way of removing the lines inside the image except the bright white rounded defect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did try another orientation of gabor filter go the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DINZb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After thresholding :Which is ok enough but not great&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fALJO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Median filtering: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EUwK0.jpg&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="654" OwnerDisplayName="vini" LastActivityDate="2012-08-27T01:56:26.743" Title="How to remove certain background from image?" Tags="|image-processing|filters|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1158" PostTypeId="2" ParentId="1157" CreationDate="2012-01-15T16:33:32.470" Score="6" Body="&lt;p&gt;A few ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Filter out edges based on density of edge strengths. Using an approximation of a circular kernel, find the mean edge strength (or some other measure). Pass through any edges at or above the threshold value, set to black any edges below the threshold.&lt;/li&gt;&#xA;&lt;li&gt;Use a morphological &quot;close&quot; operation (dilate followed by erosion) to clean up the image, then use a region labeling algorithm (a.k.a. connected component, blobs) to find all blobs. Filter the blob data according to size, ratio of major to minor axes, etc. &lt;/li&gt;&#xA;&lt;li&gt;Try Gaussian blur, find a binarization threshold to segment light from dark, and then filter blobs as described in step 2 above. (For a quick approximation of a Gaussian blur, squeeze your eyelids mostly shut and squint at the image.)&lt;/li&gt;&#xA;&lt;li&gt;Try a few filters in Photoshop or GIMP. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;EDIT: after your median filtering step, you're most of the way there. Good job! Item 2 that I suggested above (close, then region labeling) is one technique to take you the rest of the way.&lt;/p&gt;&#xA;" OwnerUserId="742" OwnerDisplayName="Rethunk" LastActivityDate="2012-01-15T17:46:35.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1160" PostTypeId="2" ParentId="1157" CreationDate="2012-01-16T03:02:31.313" Score="12" Body="&lt;p&gt;If the output of your Gábor-filter is reliable and the variation in your image-data is not so high that the outcome looks completely different, then you can use the following approach (parts of it where already mentioned):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Binarize your second image with any automatic thresholding algorithm. The range of  thresholds which will work is large as you will see.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use a component labeling algorithm to label each connected region of pixel with a unique value.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate for every component of your image a property which describes, how close your object is to a filled circle. For this, you can use for instance the &lt;a href=&quot;http://en.wikipedia.org/wiki/Compactness_measure_of_a_shape&quot; rel=&quot;noreferrer&quot;&gt;compactness&lt;/a&gt;. I used below the fraction of pixels within the &lt;em&gt;equivalent disk radius&lt;/em&gt;. This radius is the radius a disk with the same area as your object would have.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;em&gt;Area&lt;/em&gt; is simply counting the number of pixels of your object&lt;/li&gt;&#xA;&lt;li&gt;Calculating the radius of a circle given its area should be manageable too&lt;/li&gt;&#xA;&lt;li&gt;For the pixel inside this radius, you need the center of each image object, but this is just the mean of all positions of the object-pixels. If you are a physicist then you know the center of mass of several point-masses. This is equivalent.&lt;/li&gt;&#xA;&lt;li&gt;Now you calculate for every pixel of each object the distance from its center and check whether or not it is smaller then the circle radius. Dividing the two numbers and you get the fraction of inside and outside pixel.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;li&gt;Take the object with the highest fraction. Note: objects with only one pixel will get a value of 1. So you should set a size-threshold and take only objects larger, say 10 pixel.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To see, that an automatic binarization should work, here are the results for a very low and a very high threshold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uucz6.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sFN8u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Update Component Labeling&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The choice of the component labeling is not critical for your application. I would suggest, if you have to implement it by yourself, to use a very simple method. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling#One-pass_version&quot; rel=&quot;noreferrer&quot;&gt;one pass version&lt;/a&gt; from the Wikipedia site is very easy. Basically you iterate through your binary image and when you meet a pixel which is white and is not already labeled you use a new label to for this object and start with this pixel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process of labeling this object with a label is basically similar to a flood fill. This is on the Wikipedia-site the inner steps 1-4 in the algorithm. You start with this labeled pixel and put all its neighbors on a stack (they used a &lt;em&gt;vector&lt;/em&gt;). For a pixel on the stack you check whether it is foreground and not already labeled. If you have to label it, you put again all its neighbors on the stack. Do this until your stack is empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you continue your scan through the image. Unlike the description on the Wiki-site, you don't have to remove a pixel from your original image, you just skip when you have a value different from 0 in your label-image.&lt;/p&gt;&#xA;" OwnerUserId="748" OwnerDisplayName="halirutan" LastEditorUserId="581" LastEditDate="2012-02-28T18:15:52.560" LastActivityDate="2012-02-28T18:15:52.560" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1161" PostTypeId="2" ParentId="1155" CreationDate="2012-01-17T04:30:00.237" Score="1" Body="&lt;p&gt;Let us assume you are doing a binary classification with the desired color region set as 1 after applying your algorithm.&#xA;Then you can provide a set of color images (histograms) and desired outputs. The weights can be posed as the unknown quantities for this set of linear equations. Lo you have a overdetermined system &amp;amp; you can apply any method like &lt;a href=&quot;http://mathworld.wolfram.com/Moore-PenroseMatrixInverse.html&quot; rel=&quot;nofollow&quot;&gt;Moore-penrose&lt;/a&gt; inversion to estimate the weights.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2012-01-17T04:30:00.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1162" PostTypeId="2" ParentId="1154" CreationDate="2012-01-17T04:34:23.053" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;http://www.itk.org/ITK/resources/software.html&quot; rel=&quot;nofollow&quot;&gt;Insight Toolkit (ITK)&lt;/a&gt; has an implementation of the euclidean &lt;a href=&quot;http://www.itk.org/Doxygen/html/classitk_1_1SignedMaurerDistanceMapImageFilter.html&quot; rel=&quot;nofollow&quot;&gt;signed distance transform&lt;/a&gt;. It is fairly well know that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Topological_skeleton&quot; rel=&quot;nofollow&quot;&gt;3d skeleton is a level curve of the distance transform&lt;/a&gt; of a binary object.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2012-01-17T04:34:23.053" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1163" PostTypeId="2" ParentId="1154" CreationDate="2012-01-17T07:23:11.723" Score="2" Body="&lt;p&gt;If you would be happy with 3D skeleton and are looking for a Java implementation, there a popular image processing package in Life Science called ImageJ. In a distribution of ImageJ called Fiji, you will find a solid implementation by Ignacio Arganda-Carreras.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check here: &lt;a href=&quot;http://fiji.sc/wiki/index.php/Skeletonize3D&quot; rel=&quot;nofollow&quot;&gt;http://fiji.sc/wiki/index.php/Skeletonize3D&lt;/a&gt;. You will find a link to the source as well as links to tutorials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is video describing how to use it from with the &lt;a href=&quot;http://fiji.sc/wiki/index.php/Fiji&quot; rel=&quot;nofollow&quot; title=&quot;Fiji&quot;&gt;Fiji&lt;/a&gt; software: &lt;a href=&quot;http://fiji.sc/wiki/index.php/Skeleton_analysis_video_tutorial&quot; rel=&quot;nofollow&quot;&gt;http://fiji.sc/wiki/index.php/Skeleton_analysis_video_tutorial&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2012-01-17T07:23:11.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1164" PostTypeId="1" CreationDate="2012-01-17T13:08:32.637" Score="1" ViewCount="2260" Body="&lt;p&gt;Im new to Matlab. I need to split the time dimensions of an audio track into frames of 10mS and for every 10mS frame have to compute the FFT to generate the spectrograph.&#xA;I need help on this.&lt;/p&gt;&#xA;" OwnerDisplayName="Karthik" LastEditorUserId="1473" LastEditDate="2012-06-07T07:39:08.163" LastActivityDate="2012-06-07T07:39:08.163" Title="Audio processing FFT of chunks of audio" Tags="|fft|matlab|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1166" PostTypeId="2" ParentId="1164" CreationDate="2012-01-17T14:14:42.840" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/spectrogram.html&quot;&gt;http://www.mathworks.com/help/toolbox/signal/ref/spectrogram.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This pretty standard fare. For audio I would recommend a hanning() window and an overlap of half a window length so &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = randn(44100,1); % some random noise sample of a second&#xA;S = spectrogram(x,hanning(512),256); % short term FFT&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming a sample rate of 44.1 kHz this gives you frames about 11.6 ms length. You can get to exactly 10ms but that requires FFTs that are not a power of 2.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-01-17T14:14:42.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1167" PostTypeId="1" AcceptedAnswerId="1169" CreationDate="2012-01-17T18:10:08.833" Score="64" ViewCount="68866" Body="&lt;p&gt;I have trouble distinguishing between these two concepts. This is my understanding so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A stationary process is a stochastic process whose statistical properties do not change with time. For a strict-sense stationary process, this means that its joint probability distribution is constant; for a wide-sense stationary process, this means that its 1st and 2nd moments are constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ergodic process is one where its statistical properties, like variance, can be deduced from a sufficiently long sample. E.g., the sample mean converges to the true mean of the signal, if you average long enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, it seems to me that a signal would have to be stationary, in order to be ergodic. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;And what kinds of signals could be stationary, but not ergodic? &lt;/li&gt;&#xA;&lt;li&gt;If a signal has the same variance for all time, for example, how could the time-averaged variance not converge to the true value?&lt;/li&gt;&#xA;&lt;li&gt;So, what is the real distinction between these two concepts? &lt;/li&gt;&#xA;&lt;li&gt;Can you give me an example of a process that is stationary without being ergodic, or ergodic without being stationary?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="759" LastEditorUserId="1629" LastEditDate="2016-06-14T01:27:16.747" LastActivityDate="2021-08-04T18:41:20.167" Title="What is the distinction between ergodic and stationary?" Tags="|random|ergodic|" AnswerCount="6" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1168" PostTypeId="2" ParentId="1167" CreationDate="2012-01-17T18:57:52.987" Score="4" Body="&lt;p&gt;An ergodic process is a process for which you can substitute the ergodic mean for the temporal mean. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real mean, variance, etc... are defined by following a process over time and averaging, etc... For instance, if you want to know the mean of my size, you would have to average it from when I am born to when I die. Obviously the later example is not a stationary process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ergodic mean would be if instead of following my size over time, you would freeze time, and take the mean over a sample of different individual humans. There is no reason for these two means to be the same, so the process of my size is not ergodic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is a bad example, but it get more important if you consider the simple case of a gas at equilibrium. For instance the mean squared velocity is noted $\bar{V^2}$ (mean over time), but is often calculated by taking the ensemble mean $\left&amp;lt; V^2 \right&amp;gt;$: the mean of the square velocity of all molecules of the gas at an instant $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most thermodynamics theorems requires to use  $\bar{V^2}$, but it is more easy to compute and use $\left&amp;lt; V^2 \right&amp;gt;$. The ergodic hypothesis is the hypothesis stating that it is right to substitute one for the other. An ergodic process is a process for which the ergodic hypothesis is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ergodic hypothesis is false in the general case.&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2012-01-17T18:57:52.987" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1169" PostTypeId="2" ParentId="1167" CreationDate="2012-01-17T19:02:42.740" Score="50" Body="&lt;p&gt;A random process is a collection of random variables, one for each time instant under consideration.  Typically this may be continuous time (&lt;span class=&quot;math-container&quot;&gt;$-\infty &amp;lt; t &amp;lt; \infty$&lt;/span&gt;) or discrete time (all integers &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, or all time instants &lt;span class=&quot;math-container&quot;&gt;$nT$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the sample interval).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Stationarity refers to the &lt;em&gt;distributions&lt;/em&gt; of the random variables. Specifically, in a stationary process, &lt;em&gt;all&lt;/em&gt; the random variables have the same distribution function, and more generally, for every positive integer &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; time instants &lt;span class=&quot;math-container&quot;&gt;$t_1, t_2, \ldots, t_n$&lt;/span&gt;, the &lt;em&gt;joint&lt;/em&gt; distribution of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; random variables &lt;span class=&quot;math-container&quot;&gt;$X(t_1), X(t_2), \cdots, X(t_n)$&lt;/span&gt; is the same as the joint distribution of &lt;span class=&quot;math-container&quot;&gt;$X(t_1+\tau), X(t_2+\tau), \cdots, X(t_n+\tau)$&lt;/span&gt;.  That is, if we shift all time instants by &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, the statistical description of the process does not change at all: &lt;em&gt;the process is stationary&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Ergodicity, on the other hand, doesn't look at statistical properties of the random variables but at &lt;em&gt;the sample paths&lt;/em&gt;, i.e. what you observe physically. Referring back to the random variables, recall that random variables are &lt;em&gt;mappings&lt;/em&gt; from a sample space to the real numbers; each outcome is mapped onto a real number, and different random variables will typically map any given outcome to different numbers.  So, imagine that some higher being as performed the experiment which has resulted in an outcome &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; in the sample space, and this outcome has been mapped onto (typically different) real numbers by all the random variables in the process: specifically, the random variable &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; has mapped &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; to a real number we shall denote as &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;. The &lt;em&gt;numbers&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;, regarded as a waveform, are the &lt;em&gt;sample&lt;/em&gt; path corresponding to &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;, and different outcomes will give us different sample paths. Ergodicity then deals with properties of the sample paths and how these properties relate to the properties of the random variables comprising the random process.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Now, for a sample path &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; from a &lt;em&gt;stationary&lt;/em&gt; process, we can compute the &lt;em&gt;time average&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\bar{x} = \frac{1}{2T} \int_{-T}^T x(t) \,\mathrm dt$$&lt;/span&gt;  but, what does &lt;span class=&quot;math-container&quot;&gt;$\bar{x}$&lt;/span&gt; have to do with &lt;span class=&quot;math-container&quot;&gt;$\mu = E[X(t)]$&lt;/span&gt;, the &lt;em&gt;mean&lt;/em&gt; of the random process? (Note that it doesn't matter which value of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; we use; all the random variables have the same distribution and so have the same mean (if the mean exists)).  As the OP says, the average value  or DC component of a sample path converges to the mean value of the process if the sample path is observed long enough, provided the process is &lt;em&gt;ergodic&lt;/em&gt; and stationary, etc.  That is, ergodicity is what enables us to connect the results of the two calculations and to assert that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lim_{T\to \infty}\bar{x} = \lim_{T\to \infty}\frac{1}{2T} \int_{-T}^T x(t) \,\mathrm dt ~~~&#xA;\textbf{equals}  ~~~\mu = E[X(t)] = \int_{-\infty}^\infty uf_X(u) \,\mathrm du.$$&lt;/span&gt;  A process for which such equality holds is said to be &lt;em&gt;mean-ergodic&lt;/em&gt;, and a process is mean-ergodic if its autocovariance function &lt;span class=&quot;math-container&quot;&gt;$C_X(\tau)$&lt;/span&gt; has the property:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lim_{T\to\infty}\frac{1}{2T}\int_{-T}^T C_X(\tau) \mathrm d\tau = 0.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, not all stationary processes need be mean-ergodic. But there are &lt;em&gt;other&lt;/em&gt; forms of ergodicity too. For example, for an &lt;em&gt;autocovariance-ergodic&lt;/em&gt; process, the autocovariance function of a finite segment (say for &lt;span class=&quot;math-container&quot;&gt;$t\in (-T, T)$&lt;/span&gt; of the sample path &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; converges to the autocovariance function &lt;span class=&quot;math-container&quot;&gt;$C_X(\tau)$&lt;/span&gt; of the process as &lt;span class=&quot;math-container&quot;&gt;$T\to \infty$&lt;/span&gt;. A blanket statement that a process is ergodic might mean any of the various forms or it might mean a specific form; one just can't tell,&lt;/p&gt;&#xA;&lt;p&gt;As an example of the difference between the two concepts, suppose that &lt;span class=&quot;math-container&quot;&gt;$X(t) = Y$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; under consideration.  Here &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is a random variable. This &lt;strong&gt;is&lt;/strong&gt; a stationary process: each &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; has the same distribution (namely, the distribution of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;), same mean&#xA;&lt;span class=&quot;math-container&quot;&gt;$E[X(t)] = E[Y]$&lt;/span&gt;, same variance etc.;&#xA;each &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt; have the same&#xA;joint distribution (though it is degenerate) and so on.  But the process is &lt;em&gt;not&lt;/em&gt;&#xA;ergodic &lt;em&gt;because each sample path is a constant&lt;/em&gt;.  Specifically, if a trial&#xA;of the experiment&#xA;(as performed by you, or by a superior being) results in &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; having&#xA;value &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, then the sample path of the random process that corresponds&#xA;to this experimental outcome has value &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, and the DC&#xA;value of the sample path is &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$E[X(t)] = E[Y]$&lt;/span&gt;, no matter how&#xA;long you observe the (rather boring) sample path.  In a parallel universe,&#xA;the trial would result in &lt;span class=&quot;math-container&quot;&gt;$Y = \beta$&lt;/span&gt; and the sample path in that&#xA;universe would have value &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.&#xA;It is not easy to write mathematical specifications to&#xA;exclude such trivialities from the class of stationary processes, and so this is a very minimal example of a stationary random process that is not ergodic.&lt;/p&gt;&#xA;&lt;p&gt;Can there be a random process that is &lt;em&gt;not&lt;/em&gt; stationary but &lt;em&gt;is&lt;/em&gt; ergodic? Well, &lt;strong&gt;NO&lt;/strong&gt;, not if by ergodic we mean ergodic in every possible way one can think of: for example, if we measure the &lt;em&gt;fraction&lt;/em&gt; of time during which a long segment of the sample path &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; has value at most &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, this is a good estimate of &lt;span class=&quot;math-container&quot;&gt;$P(X(t) \leq \alpha) = F_X(\alpha)$&lt;/span&gt;, the value of the (common) CDF &lt;span class=&quot;math-container&quot;&gt;$F_X$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt;'s at &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; if the process is assumed to be ergodic with respect to the distribution  functions.  &lt;strong&gt;But&lt;/strong&gt;, we &lt;em&gt;can&lt;/em&gt; have random processes that are &lt;em&gt;not&lt;/em&gt; stationary but are nonetheless &lt;em&gt;mean&lt;/em&gt;-ergodic and &lt;em&gt;autocovariance&lt;/em&gt;-ergodic.  For example, consider the process&#xA;&lt;span class=&quot;math-container&quot;&gt;$\{X(t)\colon X(t)= \cos (t + \Theta), -\infty &amp;lt; t &amp;lt; \infty\}$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\Theta$&lt;/span&gt; takes on four equally likely values &lt;span class=&quot;math-container&quot;&gt;$0, \pi/2, \pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3\pi/2$&lt;/span&gt;.&#xA;Note that each &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; is a &lt;em&gt;discrete&lt;/em&gt; random variable that, in general, takes on four equally likely values &lt;span class=&quot;math-container&quot;&gt;$\cos(t), \cos(t+\pi/2)=-\sin(t), \cos(t+\pi) = -\cos(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos(t+3\pi/2)=\sin(t)$&lt;/span&gt;,  It is easy to see that in general &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(s)$&lt;/span&gt; have different distributions, and so the process is not even first-order stationary. On the other hand,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E[X(t)] = \frac 14\cos(t)+&#xA;\frac 14(-\sin(t)) + \frac 14(-\cos(t))+\frac 14 \sin(t)  = 0$$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; while&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;E[X(t)X(s)]&amp;amp;= \left.\left.\frac 14\right[\cos(t)\cos(s) +  (-\cos(t))(-\cos(s)) + \sin(t)\sin(s) + (-\sin(t))(-\sin(s))\right]\\&#xA;&amp;amp;= \left.\left.\frac 12\right[\cos(t)\cos(s) + \sin(t)\sin(s)\right]\\&#xA;&amp;amp;= \frac 12 \cos(t-s).&#xA;\end{align}&lt;/span&gt;&#xA;In short, the process has zero mean and its autocorrelation (and autocovariance) function depends only on the time difference &lt;span class=&quot;math-container&quot;&gt;$t-s$&lt;/span&gt;, and so the process &lt;em&gt;is&lt;/em&gt; wide sense stationary. But it is not first-order stationary and so cannot be&#xA;stationary to higher orders either. Now, when the experiment is performed and the value of &lt;span class=&quot;math-container&quot;&gt;$\Theta$&lt;/span&gt; is known, we get the sample function which clearly must be one of &lt;span class=&quot;math-container&quot;&gt;$\pm \cos(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pm \sin(t)$&lt;/span&gt; which have DC value &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; which equals &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and whose autocorrelation function is &lt;span class=&quot;math-container&quot;&gt;$\frac 12 \cos(\tau)$&lt;/span&gt;, same as &lt;span class=&quot;math-container&quot;&gt;$R_X(\tau)$&lt;/span&gt;, and so this process &lt;em&gt;is&lt;/em&gt; mean-ergodic and autocorrelation-ergodic even though it is not stationary at all. In closing, I remark that the process is  not ergodic with respect to the &lt;em&gt;distribution function&lt;/em&gt;, that is, it cannot be said to be ergodic in all respects.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2021-08-04T18:41:20.167" LastActivityDate="2021-08-04T18:41:20.167" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="1170" PostTypeId="1" CreationDate="2012-01-18T10:44:29.747" Score="5" ViewCount="2541" Body="&lt;p&gt;Getting the DCT coefficient based on what I've read, is usually done through a matrix, usually 8x8 or 16x16 using &lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/eqn1210354084.gif&quot; rel=&quot;nofollow&quot;&gt;these formulas&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$B_{pq}=\alpha_p\alpha_q\sum_{m=0}^{M-1}\sum_{n=0}^{N-1}A_{mn}\cos\left(\frac{\pi(2m+1)p}{2M}\right)\cos\left(\frac{\pi(2n+1)q}{2N}\right),\quad &#xD;&#xA;&#xD;&#xA;\begin{align}&#xD;&#xA;&amp;amp;0\leq p\leq M-1\\&#xD;&#xA;&amp;amp;0\leq q\leq N-1&#xD;&#xA;\end{align}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha_p=\left\{&#xD;&#xA;\begin{array}{ll}&#xD;&#xA;1/\sqrt{M},&amp;amp; p=0\\&#xD;&#xA;\sqrt{2/M}, &amp;amp; 1\leq p\leq M-1&#xD;&#xA;\end{array}\right.&#xD;&#xA;\quad&#xD;&#xA;\alpha_q=\left\{&#xD;&#xA;\begin{array}{ll}&#xD;&#xA;1/\sqrt{N},&amp;amp; q=0\\&#xD;&#xA;\sqrt{2/N}, &amp;amp; 1\leq q\leq N-1&#xD;&#xA;\end{array}\right.&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to know if it is possible to determine the corresponding DCT coefficient of a pixel or of the edges of an image? Is there a way to detect edges through DCT coefficients?&lt;/p&gt;&#xA;" OwnerUserId="820" OwnerDisplayName="Frank Smith" LastEditorUserId="77" LastEditDate="2012-01-19T16:52:51.753" LastActivityDate="2017-06-21T11:20:37.500" Title="Do the DCT coefficients correspond to particular pixels?" Tags="|image-processing|edge-detection|dct|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1171" PostTypeId="1" AcceptedAnswerId="1172" CreationDate="2012-01-18T15:15:31.753" Score="7" ViewCount="1869" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5og5Z.jpg&quot; alt=&quot;palm&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am trying to figure out a way to find out the vein pattern in the hand.. Please could someone suggest ways to do the same.? I know first i would need to find the ROI in the image and perform further processing .. &lt;strong&gt;Can gabor filter be used as one of the steps&lt;/strong&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-06-12T09:59:28.220" Title="Detect and isolate veins in the palm?" Tags="|image-processing|filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1172" PostTypeId="2" ParentId="1171" CreationDate="2012-01-18T16:06:07.583" Score="6" Body="&lt;p&gt;Ridge filtering seems like a possible processing. I have not tried to clean up the non-veins ridges; perhaps there would not be need for that step in more constrained acquisition conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = ColorConvert[Import[&quot;https://i.stack.imgur.com/5og5Z.jpg&quot;], &quot;Grayscale&quot;];&#xA;r = RidgeFilter[ColorNegate@img, 3];&#xA;Binarize[ImageAdjust@r, .03] // Thinning&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xyeDM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2012-01-18T16:06:07.583" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1173" PostTypeId="2" ParentId="1144" CreationDate="2012-01-18T19:29:07.333" Score="6" Body="&lt;p&gt;The book &quot;Dr. Euler's Fabulous Formula: Cures Many Mathematical Ills&quot;, by P. Nahin, Princeton University Press, leads up to and contains an explanation of the Gibbs phenomena which might be suitable for someone with a good undergraduate university level math background.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-01-18T19:29:07.333" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1174" PostTypeId="1" AcceptedAnswerId="35518" CreationDate="2012-01-19T01:05:25.350" Score="5" ViewCount="702" Body="&lt;p&gt;Foreword: I'll give some background here because I'm not sure all my premises are correct. I encourage you to IGNORE THE BACKGROUND, unless you're really interested / bored :)&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;The Question&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I want to calculate the eigenvalues of this system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{dM_0}{dt}=k+t_0 M_1 - M_0 (t_1+d)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{dM_1}{dt}=t_1 M_0 - M_1 (t_0+d)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix form, I want the system to look like $m^{'}=Ax$, and I'd compute the eigenvalues from the square matrix A. But here I have $m^{'}=Ax+b$ -an inhomogeneous set of ODEs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My intuition is that eigenvalues don't depend on $k$ ($b$) at all, but I have been unable to confirm this by any means (consulted many ODE/eigenanalysis texts, and the internet). So the question is: can I ignore $k$ when computing the eigenvalues?&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Background&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;In order to construct the steady state probability distribution function (PDF), I run a simulation many times, record the &quot;final&quot; state of the system, and repeat. At the end of N simulations, I have a vector of final states $[X_1 X_2 ... X_N]$, which as $N\rightarrow \infty$ the histogram of which converges to the probability distribution function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that the optimal time $T^*$ to simulate each individual run is when the stochastic system has &quot;relaxed&quot; enough that it no longer &quot;remembers&quot; its starting condition. A good metric for this is autocorrelation: the lag time for which autocorrelation goes to zero (or some arbitrarily small value) seems like the time I should choose for $T^*$. If I choose a time $T&amp;lt;T^*$, every simulation is correlated with the start condition, and not independent observations. Thus, the PDF will never converge on the correct distribution. If I choose a time $T&amp;gt;T^*$ then I do &quot;extra&quot; computation. Since it turns out the simulation is VERY inefficient, even simulating a little past $T^*$ results in significant computational overhead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, how to choose $T^*$? Suffice to say, numerically computing it is out of the question. One idea suggested to me is to calculate the eigenvalues of the system. The inverse of an eigenvalue corresponds to the relaxation time of a system, which is equivalent to the lag-time tau at which autocorrelation = $\frac{1}{e}$. Thus, the time $T^*$ could be chosen instantaneously by selecting the longest relaxation time of the system (smallest eigenvalue)--or some multiple of this time to get the correlation sufficiently small. Bonus points if you weigh in on whether this is a good idea or bad, and why--but not necessary to answer the question.&lt;/p&gt;&#xA;" OwnerUserId="821" LastEditorUserId="24643" LastEditDate="2016-11-14T07:22:21.380" LastActivityDate="2017-11-11T04:27:24.023" Title="Relaxation time in a stationary stochastic process" Tags="|autocorrelation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1175" PostTypeId="1" AcceptedAnswerId="1185" CreationDate="2012-01-19T06:39:05.777" Score="2" ViewCount="229" Body="&lt;p&gt;How identify the presence or absence of regular stripes of different colors, but ranging from very very very very light pink to black inside of a scanned image (bitmap 200x200dpi 24-bit).&#xA;Carry a few examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ee1kE.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 2 (the lines are in all the columns except 7 in the second row of the last column)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9k5YW.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now try to identify (using python language) whether or not there is at least 5-10 pixels for the presence of different color from white to each strip, however, does not always work because the scanned image is not of high quality and the strip changes color very similar to color that surrounds it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="822" LastEditorUserId="6" LastEditDate="2012-01-19T17:09:42.170" LastActivityDate="2012-01-19T19:20:15.263" Title="Identify rectangles of different colors" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1176" PostTypeId="2" ParentId="1135" CreationDate="2012-01-19T11:55:47.547" Score="7" Body="&lt;p&gt;I would first consider only the green channel, or make use in smarter ways of the peculiar colour properties of tennis court.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you´ve done that you can apply an edge detector, using an high threshold since the contrast between line and court is quite high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To further remove outliers you can then apply hough transform at the end of the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know if you get good results!&lt;/p&gt;&#xA;" OwnerUserId="824" LastActivityDate="2012-01-19T11:55:47.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1177" PostTypeId="2" ParentId="1170" CreationDate="2012-01-19T11:58:44.750" Score="2" Body="&lt;p&gt;you can´t. As you can see from the formula you posted, each DCT coefficient is a function of all the pixels in the block you are considering. Same holds for edges: if you extract the edges from an image, and then apply DCT using 8x8 blocks, each DCT coefficient depends on the value of the 64 pixels in the block&lt;/p&gt;&#xA;" OwnerUserId="824" LastActivityDate="2012-01-19T11:58:44.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1178" PostTypeId="1" CreationDate="2012-01-19T13:47:53.247" Score="2" ViewCount="3027" Body="&lt;p&gt;I am trying to identify a sound region of a word from a wav file (44100Hz). My research gave me the idea that I must use &quot;Short-Time Energy&quot; and &quot;zero crossing rate&quot;. But the problem is I am not clear with the formulas to code. So if someone can guide me to a much clear Pseudo code I will greatly appreciate it. And also if someone can tell me the order of using this I will highly appreciate that too. Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="825" LastEditorUserId="825" LastEditDate="2012-01-19T14:40:57.043" LastActivityDate="2012-01-19T18:36:41.850" Title="using Short-Time Energy and zero crossing rate" Tags="|audio|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1179" PostTypeId="1" AcceptedAnswerId="1180" CreationDate="2012-01-19T14:52:33.450" Score="2" ViewCount="302" Body="&lt;p&gt;I want to define some distances to use over an image, which I create.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I need to define two different &quot;distances&quot;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The first distance should be the most robustness preserving in compare to the original image.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The second one should would be the most transparency preserving in compare to the&lt;br&gt;&#xA;original image.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;For example:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Let $I_1, I_2$ and $I_3$ be images, $I_1$ is the original and $I_2, I_3$ are some similar images:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to define a metric or some distance so a and b will holds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. $|I1 -I2| &amp;gt; |I_1 -I_3| &amp;lt;=&amp;gt; I_2 $ is more robustness preserving then $I_3$ in compare to&lt;br&gt;&#xA;the origin $I_1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;b. $|I_1 -I_2| &amp;gt; |I_1 -I_3| &amp;lt;=&amp;gt; I_2$ is more transparency preserving then $I_3$               in compare to the origin $I_1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as I said the distance in a. and b. don't have to be the same at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw this post but it didn't help me alot, it may help you to find a good answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/188/what-distance-metric-can-i-use-for-comparing-images&quot;&gt;What distance metric can I use for comparing images?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-01-20T23:21:35.970" Title="Are there any good &quot;conceptual distances&quot; for comparing two images?" Tags="|image-processing|discrete-signals|distance-metrics|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1180" PostTypeId="2" ParentId="1179" CreationDate="2012-01-19T15:37:43.207" Score="2" Body="&lt;p&gt;Ok, I read the question posted in your link, so forget about MSE or SSIM.&#xA;What you can do is define a specific distance for the particular type of data you are using.&#xA;For example, if you are using video data, depending on what you are most interested in, you can define distance measure based on the average shot length, keyframe colour histogram, average motion in a shot, and so on.&#xA;If you are working on a database of face images, you can use e.g. PCA+eigenfaces to project each image on a N-dimensional space and compute an euclidean distance on that space; if you are working with e.g. flower pictures you can define a distance based on edge + colour information... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here´s my previous answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It´s not really clear to me what you mean for robustness/transparency, to be honest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to check which one of I_2 and I_3 is more similar to I_1 a simple way is to use compute the &lt;a href=&quot;http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;mean square error&lt;/a&gt;, defined as the sum of the squares of all the pixels in the image, normalized for the total # of pixels&lt;/p&gt;&#xA;" OwnerUserId="824" LastEditorUserId="824" LastEditDate="2012-01-19T15:43:34.320" LastActivityDate="2012-01-19T15:43:34.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1181" PostTypeId="2" ParentId="1170" CreationDate="2012-01-19T16:35:37.400" Score="3" Body="&lt;p&gt;Perhaps you can detect the presence of a sharp change in color/brightness by detecting high frequency components in the Y block. If there are non-zero coefficients in the high frequency end of the DCT block, that indicates a sharp edge. You won't know its exact position in the block without doing the transform, but you can know if there is a sharp line/dot.&lt;/p&gt;&#xA;" OwnerUserId="826" LastActivityDate="2012-01-19T16:35:37.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1182" PostTypeId="2" ParentId="1170" CreationDate="2012-01-19T18:05:27.290" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What I'm planning to do is to apply edge detection to obtain the&#xA;  locations/indices of the pixels and then get their corresponding DCT&#xA;  Coefficient&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As others stated in the comment - any pixel in the given block is related to &lt;em&gt;all&lt;/em&gt; co-efficient in the block and vice-versa. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, understand that Edge detection is a process of finding the gradient. Linear convolution essentially does the job. What you &lt;em&gt;can&lt;/em&gt; do is to apply equivalent of that convolution in the DCT domain which will give you an idea about the edge orientation in the DCT block domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While, this is relatively narrow area - there are papers which allows you to find edges in DCT blocks. See the references below: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://cgit.nutn.edu.tw:8080/cgit/PaperDL/GYT_080623210426.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Compressed Domain Scheme for Classifying Block Edge Patterns by Hyun Sung Chang, and Kyeongok Kang IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 14, NO. 2, FEBRUARY 2005 145&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.38.8556&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Direct feature extraction from compressed images by Bo Shen et. al. &#xA;SPIE vol. 2670, Storage &amp;amp; Retrieval for Image and Video Databases IV, 1996&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2017-06-21T11:20:37.500" LastActivityDate="2017-06-21T11:20:37.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1183" PostTypeId="2" ParentId="1178" CreationDate="2012-01-19T18:36:41.850" Score="6" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1164/audio-processing-fft-of-chunks-of-audio&quot;&gt;Audio processing FFT of chunks of audio&lt;/a&gt;&#xA;This will give you the short term energy as a function of time and frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The zero crossing in itself is easy to code (the example is conceptual, but very inefficient)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x0 = x(1); &#xA;for i = 2:length(x)&#xA;  x1 = x(i);&#xA;  if (x0 &amp;gt; 0 &amp;amp;&amp;amp; x1 &amp;lt; 0) || (x0 &amp;lt; 0 &amp;amp;&amp;amp; x1 &amp;gt; 0)&#xA;     % you have a zero crossing&#xA;     doSomethingWithAZeroCrossing(i);&#xA;  end&#xA;  x0 = x1; &#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, zero crossings are fairly sensitive to benign and typically irrelevant changes in the audio signal, so zero crossings have only limited usefulness. In particular&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;even small amounts of noise can generate lots of extra zero&#xA;crossings and &quot;jitter&quot; the existing ones&lt;/li&gt;&#xA;&lt;li&gt;Fluctuations in DC offset or very low frequency noise (like an Air conditioner or a heating fan picked up my a microphone) move the zero crossings all over the place&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-01-19T18:36:41.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1184" PostTypeId="2" ParentId="1137" CreationDate="2012-01-19T19:10:16.120" Score="8" Body="&lt;p&gt;There are various aspects of compression - whether you are referring to image or video. (May be audio is totally different so i am not referring this here). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really look at the history of compression standard, when they were first formed - MPEG1 real time encoders were rare. CPU at that time itself was not enough to make it real time; however, it was not the processing complexity (alone) that stopped more complexity algorithms to be used under codecs. (Probably the primary factor that was responsible for inclusion/exclusion of certain algorithms were a. patents, b. feasibility of implementation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, i would like to re-phrase the question a bit more simpler: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What other research in compression is available which is still to come&#xA;  to market (or didn't come at all but might be worth for some&#xA;  applications)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here are some points to look at: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Better transform?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;DCT by far has been universal transform across all codecs. However, there are many research papers which suggest that Wavelets could be better. Indeed the only JPEG2000 included wavelets - but that standard itself wasn't big hit. Probably it &lt;em&gt;was&lt;/em&gt; better than DCT in some way; specially there are claims that Wavelets outperformce DCT [See: Ref 1] &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think wavelet &lt;em&gt;is&lt;/em&gt; computationally expensive over DCT (partly because 8x8 DCT implementations are highly optimized). But i guess i didn't really flew that much because from the market perspective because DCT by the time was far more wide spread and the difference in improvement was not so substantial for people to switch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Multi hypothesis motion compensation&lt;/strong&gt;&lt;br&gt;&#xA;While MPEG 2 was happy enough with $B$ pictures, extensive research from &lt;a href=&quot;http://www.stanford.edu/~bgirod/&quot;&gt;Bern Girod&lt;/a&gt; [See Ref 2] proved that - the concept can be extended way beyond this. Indeed H.264 actually has made great generalization on multiple target based motion compensaion - basically one can store past 16 pictures (compare to 2 in MPEG2) and indeed the prediction can be extremely high. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While, this is already part of the standard in H.264 - this is still not fully exploited. There is a need to make such extensively large search for motion estimation practically viable. Most H.264 encoder are still nascent in exploiting full potential of this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Scalable Image/Video compression&lt;/strong&gt;&lt;br&gt;&#xA;Scalable Image and video compression is again a holy grail of how multiple description encoding can be done for image and video. Basically the same Image or video can be encoded at multiple Resolution, quantization (quality), or frame rate. These produces different layers of quality vs. bit rate right within the same stream - and the streaming server can actually adapt the bitrate and quality dynamically to best fit the video in the quality. &#xA;See [Ref 3], [Ref 4], [Ref 5] &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of this, only real success is &lt;em&gt;progressive JPEG&lt;/em&gt; which is practically useful for websites and indeed useful. Again while the promise of dynamically adapting bit stream is great but it works only if there are practical systems where estimating such bit rate is possible and type of adaptation can serve some real purpose. However, in video domain, in spite the support of this in the standards (MPEG2, MPEG4 and H.264) - there is hardly any usage of this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4. Object Video&lt;/strong&gt;&lt;br&gt;&#xA;This is perhaps ultimate holy grail of Compression. Object video [Ref 6] as initiated by MPEG standard body itself however, this was also backed by extensive research. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to segment the video in terms of distinct objects and later on each such object can be treated as separate plane. each object and be applied with different bit rate, quantization, frame rate and much efficient prediction can happen. Also, one can manipulate such objects like the way you can do stuff in photoshop/gimp. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as it turns out,  the segmentation of real-world image and video with perceptual relevant objects - is a hard problem! So even if i do have encoder/decoders - i need robus and real time segmentation system to make things possible. This is by far a really open problem as to how do you apply video in the form of such layered video to make it work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5. More dimensions&lt;/strong&gt;&lt;br&gt;&#xA;Apart from this - there are codecs for stereo video (a.k.a multiview) and 3D video (almost similar concept) which additionally try to reduce the redundancy in the additional dimension. While this is still research going on here, H.264 does have a profile for this now. Same is true for the Cinema encoding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many research projects still in the area of this - however, video compression is quite a commodity market by now. And research which doesn't substantially generate new application or if there are feasibility issues in implementation wont survive practically in spite it's ingenuity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;References: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://222.162.105.39:8025/Fulltext/400/180/110/020/010/130/yaqin4/L000000000234135.pdf&quot;&gt;A Comparative Study of DCT- and Wavelet-Based Image Coding by Zixiang Xiong, et. al. IEEE TRANSACTIONS ON CIRCUITS AND SYSTEMS FOR VIDEO TECHNOLOGY, VOL. 9, NO. 5, AUGUST 1999 pp. 692&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://ivms.stanford.edu/~ivmsjc/pubs/open/Girod_Multihyp_Feb2000.pdf&quot;&gt;Efficiency Analysis of Multihypothesis Motion-Compensated Prediction for Video Coding&#xA;Bernd Girod IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 9, NO. 2, FEBRUARY 2000 173&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://spiedigitallibrary.org/proceedings/resource/2/psisdg/2094/1/718_1?isAuthorized=no&quot;&gt;Spatial-domain resolution-scalable video coding by Barry G. Haskell, Hsueh-Ming Hang. Proc. SPIE 2094, Visual Communications and Image Processing November 718 (1993);&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://medianetlab.ee.ucla.edu/papers/004.pdf&quot;&gt;The MPEG-4 Fine-Grained Scalable Video Coding Method for Multimedia Streaming Over IP&#xA;by Hayder M. Radha, et. al. IEEE TRANSACTIONS ON MULTIMEDIA, VOL. 3, NO. 1, MARCH 2001 53&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1369697&quot;&gt;Advances in Scalable Video Coding by Ohm, J.-R.; Proceedings of the IEEE Jan. 2005 Volume: 93 Issue:1 pp. 42 - 56&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.3354&amp;amp;rep=rep1&amp;amp;type=pdf&quot;&gt;Object-Based Texture Coding of Moving Video in MPEG-4, by Andr ́ Kaup, IEEE TRANSACTIONS ON CIRCUITS AND SYSTEMS FOR VIDEO TECHNOLOGY, VOL. 9, NO. 1, FEBRUARY 1999 pp. 5&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-01-19T19:10:16.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1185" PostTypeId="2" ParentId="1175" CreationDate="2012-01-19T19:20:15.263" Score="2" Body="&lt;p&gt;My suggestion would be in following step. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If we know that outer shapes (rectangles) are at regular interval - first we should do some sort of segmentation and/or localization. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Remove portions of background which are of no use and each block is identified and processed separately.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now if you are expecting lines only horizontally, you can traverse vertically and create scan lines from top-to-bottom. If the region has no dark separations - the scan lines will appear straight albeit with noise. If it crosses the dark line the intensity in the scan line will drop. This will tell the position of dark strip in the block. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A set of 4 - 5 scan lines (or more) will provide a good co-relating answer. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-01-19T19:20:15.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1186" PostTypeId="1" CreationDate="2012-01-19T19:16:27.717" Score="10" ViewCount="14166" Body="&lt;p&gt;Does anyone know if there is a simple explanation on the fact that the theoretical bit-error rate (BER) curves of a Quadrature phase-shift keying (QPSK) system are approximately 1 dB shifted from the simulated curves?&lt;/p&gt;&#xA;" OwnerDisplayName="George" LastEditorUserId="440" LastEditDate="2012-04-17T09:01:42.817" LastActivityDate="2013-09-25T11:45:58.727" Title="Matlab plot of QPSK system doesn't agree perfectly with theoretical BER curves" Tags="|matlab|qpsk|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1187" PostTypeId="2" ParentId="811" CreationDate="2012-01-20T00:40:57.757" Score="44" Body="&lt;p&gt;There's a flaw in Jason R's answer, which is discussed in Knuth's &quot;Art of Computer Programming&quot; vol. 2. The problem comes if you have a standard deviation which is a small fraction of the mean: the calculation of E(x^2) - (E(x)^2) suffers from severe sensitivity to floating point rounding errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can even try this yourself in a Python script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ofs = 1e9&#xA;A = [ofs+x for x in [1,-1,2,3,0,4.02,5]] &#xA;A2 = [x*x for x in A]&#xA;(sum(A2)/len(A))-(sum(A)/len(A))**2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get -128.0 as an answer, which clearly isn't computationally valid, since the math predicts that the result should be nonnegative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knuth cites an approach (I don't remember the name of the inventor) for calculating running mean and standard deviation which goes something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; initialize:&#xA;    m = 0;&#xA;    S = 0;&#xA;    n = 0;&#xA;&#xA; for each incoming sample x:&#xA;    prev_mean = m;&#xA;    n = n + 1;&#xA;    m = m + (x-m)/n;&#xA;    S = S + (x-m)*(x-prev_mean);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then after each step, the value of &lt;code&gt;m&lt;/code&gt; is the mean, and the standard deviation can be calculated as &lt;code&gt;sqrt(S/n)&lt;/code&gt; or &lt;code&gt;sqrt(S/n-1)&lt;/code&gt; depending on which is your favorite definition of standard deviation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation I write above is slightly different than the one in Knuth, but it's computationally equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I have a few more minutes, I'll code up the above formula in Python and show that you'll get a nonnegative answer (that hopefully is close to the correct value).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;update: here it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;test1.py:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;&#xA;def stats(x):&#xA;  n = 0&#xA;  S = 0.0&#xA;  m = 0.0&#xA;  for x_i in x:&#xA;    n = n + 1&#xA;    m_prev = m&#xA;    m = m + (x_i - m) / n&#xA;    S = S + (x_i - m) * (x_i - m_prev)&#xA;  return {'mean': m, 'variance': S/n}&#xA;&#xA;def naive_stats(x):&#xA;  S1 = sum(x)&#xA;  n = len(x)&#xA;  S2 = sum([x_i**2 for x_i in x])&#xA;  return {'mean': S1/n, 'variance': (S2/n - (S1/n)**2) }&#xA;&#xA;x1 = [1,-1,2,3,0,4.02,5] &#xA;x2 = [x+1e9 for x in x1]&#xA;&#xA;print &quot;naive_stats:&quot;&#xA;print naive_stats(x1)&#xA;print naive_stats(x2)&#xA;&#xA;print &quot;stats:&quot;&#xA;print stats(x1)&#xA;print stats(x2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;naive_stats:&#xA;{'variance': 4.0114775510204073, 'mean': 2.0028571428571427}&#xA;{'variance': -128.0, 'mean': 1000000002.0028572}&#xA;stats:&#xA;{'variance': 4.0114775510204073, 'mean': 2.0028571428571431}&#xA;{'variance': 4.0114775868357446, 'mean': 1000000002.0028571}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll note that there's still some rounding error, but it's not bad, whereas &lt;code&gt;naive_stats&lt;/code&gt; just pukes.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;edit: Just noticed Belisarius's comment citing &lt;a href=&quot;http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm&quot;&gt;Wikipedia&lt;/a&gt; which does mention the Knuth algorithm. &lt;/p&gt;&#xA;" OwnerUserId="829" LastEditorUserId="829" LastEditDate="2012-01-20T01:55:53.733" LastActivityDate="2012-01-20T01:55:53.733" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1188" PostTypeId="1" CreationDate="2012-01-20T14:35:49.637" Score="4" ViewCount="4192" Body="&lt;p&gt;If Anti-causal systems are defined as those whose output depends solely upon future inputs.(Is this definition correct as I understand)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i see that $y[n] = x[n+2]$ ; is anticausal system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is a time reversing system such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = x(-t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;anticausal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. $y(2) = x(-2)$ it infact depends upon past. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for some explanation.&lt;/p&gt;&#xA;" OwnerUserId="69" LastEditorUserId="6" LastEditDate="2012-01-20T15:23:02.897" LastActivityDate="2018-10-22T13:42:07.907" Title="Anti-causal systems" Tags="|transfer-function|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1189" PostTypeId="2" ParentId="1188" CreationDate="2012-01-20T14:48:16.473" Score="5" Body="&lt;p&gt;$y(t) = x(-t)$ &lt;a href=&quot;http://en.wikipedia.org/wiki/Anticausal_system&quot; rel=&quot;noreferrer&quot;&gt;is not anticausal, but it is acausal&lt;/a&gt;. For negative values of $t$, $y(t)$ is not causal, while for positive $t$, it is causal, since, for example, $y(2) = x(-2)$, but $y(-2) = x(2)$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-01-20T14:48:16.473" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1190" PostTypeId="2" ParentId="1186" CreationDate="2012-01-20T15:15:27.287" Score="11" Body="&lt;p&gt;The simple explanation is that there is an error in your simulation. Here's one that works in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% number of symbols in simulation&#xA;Nsyms = 1e6;&#xA;% energy per symbol&#xA;Es = 1;&#xA;% energy per bit (2 bits/symbol for QPSK)&#xA;Eb = Es / 2;&#xA;% Eb/No values to simulate at, in dB&#xA;EbNo_dB = linspace(0, 10, 11);&#xA;&#xA;% Eb/No values in linear scale&#xA;EbNo_lin = 10.^(EbNo_dB / 10);&#xA;% keep track of bit errors for each Eb/No point&#xA;bit_err = zeros(size(EbNo_lin));&#xA;for i=1:length(EbNo_lin)&#xA;    % generate source symbols&#xA;    syms = (1 - 2 * (randn(Nsyms,1) &amp;gt; 0)) + j * (1 - 2 * (randn(Nsyms, 1) &amp;gt; 0));&#xA;    % add noise&#xA;    syms_noisy = sqrt(Es/2) * syms + sqrt(Eb/(2*EbNo_lin(i))) * (randn(size(syms)) + j * randn(size(syms)));&#xA;    % recover symbols from each component (real and imaginary)&#xA;    syms_rec_r = sign(real(syms_noisy));&#xA;    syms_rec_i = sign(imag(syms_noisy));&#xA;    % count bit errors&#xA;    bit_err(i) = sum((syms_rec_r ~= real(syms)) + (syms_rec_i ~= imag(syms)));&#xA;end&#xA;% convert to bit error rate&#xA;bit_err = bit_err / (2 * Nsyms);&#xA;&#xA;% calculate theoretical bit error rate, functionally equivalent to:&#xA;% bit_err_theo = qfunc(sqrt(2*EbNo_lin));&#xA;bit_err_theo = 0.5*erfc(sqrt(2*EbNo_lin)/sqrt(2));&#xA;figure;&#xA;semilogy(EbNo_dB, bit_err, 'bx', EbNo_dB, bit_err_theo, 'r', 'MarkerSize', 10, 'LineWidth', 2);&#xA;xlabel('Eb/No (dB)');&#xA;ylabel('Bit error rate');&#xA;title('QPSK bit error rate');&#xA;legend('Simulation','Theory');&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PjCgQ.png&quot; alt=&quot;QPSK bit error rate plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the theoretical expression for bit error rate for BPSK/QPSK modulation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P_b = Q\left(\sqrt{\frac{2E_b}{N_0}}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;keeping in mind that $E_b$ is the &lt;strong&gt;energy per information bit&lt;/strong&gt;. The somewhat subtle distinction between $E_b$ and $E_s$, the &lt;em&gt;energy per symbol&lt;/em&gt;, is something that often trips up people new to the subject. This difference also explains why QPSK and BPSK have the same bit error rate when expressed as a function of $\frac{E_b}{N_0}$; you don't get any bit-error performance benefit by moving to QPSK, although you can achieve a given bit rate with less occupied bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-01-20T17:57:28.253" LastActivityDate="2012-01-20T17:57:28.253" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1191" PostTypeId="2" ParentId="1188" CreationDate="2012-01-20T15:48:54.673" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If Anti-causal systems are defined as those whose output depends solely upon future inputs. (Is this definition correct as I understand)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How particular are you about the words &lt;em&gt;solely&lt;/em&gt; and &lt;em&gt;future&lt;/em&gt; in your definition? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;em&gt;causal&lt;/em&gt; system is one with the property that the output $y$ at &lt;em&gt;every&lt;/em&gt; &#xA;time $t$ depends only on the current and past inputs, that is, &#xA;the values of the input $x$ at times in $(-\infty, t]$, or more formally,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each $t$, $-\infty &amp;lt; t &amp;lt; \infty$, &#xA;$y(t)$ is a function of $\{x(\tau) \colon \tau \in (-\infty, t]\}$ only and &#xA;does not depend on any $x(\tau^\prime), \tau^\prime &amp;gt; t$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;em&gt;anticausal&lt;/em&gt; is taken to mean &lt;em&gt;not causal&lt;/em&gt;, then the complement of the&#xA;definition of causal&#xA;is &lt;em&gt;not&lt;/em&gt; what you have written.  In this sense of &quot;non-causal = not causal&quot;, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;a &lt;em&gt;non-causal&lt;/em&gt; system is defined as one for which there is &lt;em&gt;at least one time &#xA;instant&lt;/em&gt; $t_0$ (and a $\tau &gt; t_0$) such that the output $y(t_0)$ depends on the &#xA;value of $x(\tau)$, a future input.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Note that $y(t_0)$ might depend on past inputs as well as on the future&#xA;input $x(\tau)$.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Note that there may be other time instants $t_1$ for which $y(t_1)$ &#xA;depends only on past and curent $\{x(t) \colon t \in (-\infty, t_1]\}$&#xA;and on &lt;em&gt;no&lt;/em&gt; future inputs.  All it takes for a system to be bad-mouthed as&#xA;non-causal is one bad apple time instant $t_0$ for which causality is violated. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the other hand, &lt;em&gt;your&lt;/em&gt; definition of &lt;em&gt;anti-causal&lt;/em&gt; is that for &lt;em&gt;every&lt;/em&gt; instant&#xA;$t$, $y(t)$ depends &lt;em&gt;solely&lt;/em&gt; on &lt;em&gt;future&lt;/em&gt; inputs &#xA;$\{x(\tau) \colon \tau \in (t,\infty)\}$;&#xA;even the current input is excluded.  So, the time-reversal system &#xA;$y(t) = x(-t)$ is &lt;em&gt;not&lt;/em&gt; an anti-causal system by your definition.  Trivially,&#xA;$y(0)$ equals current input $x(0)$, and if you chill a bit and amend your&#xA;definition to say &quot;current and future inputs&quot;, then, as Jason R has already&#xA;pointed out, $y(2)$ depends on a past input $x(-2)$ and so the system is&#xA;not anti-causal as per your amended definition either.  In fact, there&#xA;is a huge class of systems that would be classified as non-causal as per&#xA;the definition of non-causal given here that do not meet your definition&#xA;of anti-causality; the time-reversal system is just one example of&#xA;a system that is not anti-causal.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-01-20T15:48:54.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1193" PostTypeId="1" CreationDate="2012-01-20T20:04:03.323" Score="2" ViewCount="604" Body="&lt;p&gt;I need to compensate a OFDM-16_qam constelation rotation but I could not find out how to implement it with MATLAB&#xA;I have a Matrix [48 x 25] where each colum is a OFDMsymbol without CP , pad and pilots, this matrix was passed through a Multipath channel using the matlab command Ch=rayleigh and filter(CH,OFDMsymbol) and so the pilots modulated in bpsk .&#xA;With this pilots I've constructed a Pilot_matriz with each colum (an OFDM symboll) has an angle to be compensate.&#xA;The OFDMsymboll  is a complex number as  +/-a+/-ib and I have the angles (theta) in rad from the pilot matrix but I'm not find a way to turn bach the theta angle from the complex number +/-a+/-ib.&#xA;any suggestions&#xA;Regards&#xA;Luiz&lt;/p&gt;&#xA;" OwnerUserId="830" LastActivityDate="2012-02-20T14:35:06.723" Title="OFDM Phase compensation" Tags="|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1194" PostTypeId="2" ParentId="1144" CreationDate="2012-01-20T23:25:09.707" Score="2" Body="&lt;p&gt;You can always say that &lt;code&gt;sin&lt;/code&gt; and &lt;code&gt;cos&lt;/code&gt; has curved shape, and you need infinite amount of frequencies to form a sharp edge from a many curved shapes. &lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2020-02-13T14:39:25.773" LastActivityDate="2020-02-13T14:39:25.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1195" PostTypeId="1" CreationDate="2012-01-21T08:56:16.610" Score="9" ViewCount="2585" Body="&lt;p&gt;I have a series of data (single array). If I take this data and plot it, I can see that there are multiple peaks. However If I zoom in to a section of data, I see that there is substantial noise.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to detect how many peaks in the data using little CPU time and energy. I thought of detecting the slopes of these peaks (could be sharp or smooth rising or falling) and look at the number of slopes to determine the number of peaks. (2 slopes positive and negative for every peak)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers how I can calculate the slopes in the presence of noise? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code will go into an embedded system, memory is limited so preferably I like to implement something that doesn't require any significant data copy. &lt;/p&gt;&#xA;" OwnerUserId="831" OwnerDisplayName="user4749" LastEditorUserId="6" LastEditDate="2012-02-21T15:13:19.910" LastActivityDate="2014-09-18T10:27:47.097" Title="Derivative calculation" Tags="|peak-detection|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1196" PostTypeId="2" ParentId="1193" CreationDate="2012-01-21T14:24:50.480" Score="1" Body="&lt;p&gt;It's not completely clear from your question, but I interpret your situation as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You have a set of OFDM symbols that have been passed through a multipath channel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have generated an equalization matrix of phase shifts (in radians) that you want to apply to each subcarrier of each symbol.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You're not sure how to apply the phase shifts to the OFDM symbols.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Being able to implement an equalizer via simple multiplication is one of the benefits of OFDM, since one can assume that fading is flat across each subcarrier's channel. To apply a phase shift of $\theta$ radians to a complex number $x = a + jb$, do the following multiplication:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\tilde x = e^{j\theta}x&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{align*}&#xD;&#xA;\tilde x &amp;amp;= \left(\cos(\theta) + j \sin(\theta)\right) \left (a + jb\right) \\&#xD;&#xA;&amp;amp;= \left(a \cos(\theta) - b \sin(\theta)\right) + j \left(a \sin(\theta) + b \cos(\theta) \right)&#xD;&#xA;\end{align*}&#xD;&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-01-21T14:24:50.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1197" PostTypeId="1" CreationDate="2012-01-21T15:30:34.920" Score="5" ViewCount="4386" Body="&lt;p&gt;Will someone be able to explain short time energy function for me in a simple way explaining all the variables in the formula?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue that I have is in the formula the summation varies m like,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;m=n-(N-1) to n&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from my research what I understood is that n is the center sample of the window, so if the center of the window is, lets say 80 and if the window size is 160. Then there is a situation where “m” get a negative value discontinuing a loop in a programming environment. Is my understanding incorrect or is there a reason? Thanks in advance.      &lt;/p&gt;&#xA;" OwnerUserId="825" LastEditorUserId="39" LastEditDate="2012-01-22T12:05:44.950" LastActivityDate="2012-02-22T14:39:57.813" Title="short time energy function explanation" Tags="|audio|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1198" PostTypeId="1" AcceptedAnswerId="1201" CreationDate="2012-01-13T12:43:21.787" Score="17" ViewCount="5082" Body="&lt;p&gt;I am doing some research on Gabor filters for detecting dents in cars. I know Gabor filters have had widespread use for pattern recognition, fingerprint recognition, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fIbwG.jpg&quot; alt=&quot;Raw image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using some &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/5237&quot; rel=&quot;noreferrer&quot;&gt;code&lt;/a&gt; from the MathWorks File Exchange site, I got the following output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eBCyj.jpg&quot; alt=&quot;Processed image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which somehow isn't the output that one would expect. This isn't a good result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The my script is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('dent.jpg');&#xA;I = rgb2gray(I);&#xA;[G, gabout] = gaborfilter1(I, 2, 4, 16, pi/2);&#xA;figure&#xA;imshow(uint8(gabout));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: Applying a different &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/23253-gabor-filter&quot; rel=&quot;noreferrer&quot;&gt;code&lt;/a&gt; to the following image :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/43VqH.jpg&quot; alt=&quot;input image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output image after different orientations of gabor filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9nHiK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how do i isolate this DENT which is got being detected properly?&lt;/p&gt;&#xA;" OwnerUserId="654" OwnerDisplayName="vini" LastActivityDate="2013-11-09T17:51:23.507" Title="Can Gabor filter be used for detecting dents in cars?" Tags="|matlab|image-processing|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1199" PostTypeId="2" ParentId="1198" CreationDate="2012-01-13T13:39:24.057" Score="9" Body="&lt;p&gt;A Gabor filter is only the first of several steps that you would use for such a defect detection task. Also, note that you've only used a specific orientation and scale of Gabor filter -- you would typically use a whole range of orientations and scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very rough outline of a simple defect detection approach using Gabor filters could be as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply Gabor filter at different orientations and scales&lt;/li&gt;&#xA;&lt;li&gt;Apply a classifier (trained on suitable training data) to classify each pixel as &quot;defect&quot; or &quot;non-defect&quot;&lt;/li&gt;&#xA;&lt;li&gt;Aggregate detections from neighbouring pixels to make sure each defect is detected only once and to eliminate spurious detections&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One point that isn't on this list but is typically very important is image acquisition. The way you light your object and place your cameras has a huge influence on how easy it will be to detect defects in the resulting images. Your sample image seems to use the environmental illumination that happened to be present at the time -- this is very likely not optimal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I say, this is only a &lt;em&gt;very&lt;/em&gt; rough outline. Automatic inspection is a wide field and requires a lot of expertise to do it well.&lt;/p&gt;&#xA;" OwnerDisplayName="Martin B" LastActivityDate="2012-01-13T13:39:24.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1200" PostTypeId="2" ParentId="1198" CreationDate="2012-01-13T22:17:09.593" Score="0" Body="&lt;p&gt;No, it can't. Image processing is not magic, you need to supply more information. Without some idea of how the car is supposed to look, how is the computer supposed to distinguish a dent from the intended body styling?&lt;/p&gt;&#xA;" OwnerUserId="660" OwnerDisplayName="zephyr" LastActivityDate="2012-01-13T22:17:09.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1201" PostTypeId="2" ParentId="1198" CreationDate="2012-01-15T04:28:18.967" Score="22" Body="&lt;p&gt;This is an extremely difficult problem. I was part of a team that worked on it for several years, and having developed and supported other such applications for a long time I can say that dent detection is a particularly tricky problem, and much harder than it looks at first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having an algorithm work under lab conditions or on known images is one thing; developing a system that is accurate and robust for &quot;natural&quot; images such as cars seen on a parking lot would likely require a team working for several years. In addition to the core problem of creating the algorithm, there are numerous other engineering difficulties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sample code you tested isn't a bad start. If you could find the edges around the dark right side of the dent you could compare the edge map of the car with the ding to an edge map of a known good car imaged from the same angle with the same lighting. Controlling the lighting will help quite a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problems to consider include the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Lighting (much more difficult than it would first seem)&lt;/li&gt;&#xA;&lt;li&gt;Expected 3D surface of assembled outer panel (e.g. from CAD data)&lt;/li&gt;&#xA;&lt;li&gt;Criteria characterizing a dent: area, depth, profile, etc.&lt;/li&gt;&#xA;&lt;li&gt;Criteria for false negatives and false positives&lt;/li&gt;&#xA;&lt;li&gt;Means to save dent data and/or map dents onto a model of the car (or butterfly layout)&lt;/li&gt;&#xA;&lt;li&gt;Methodology and device to measure &quot;true&quot; dent characteristics: depth, area, etc.&lt;/li&gt;&#xA;&lt;li&gt;Extensive database of dents from a random sampling of vehicles&lt;/li&gt;&#xA;&lt;li&gt;Dealing with different paint colors and finishes&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Lighting&lt;/strong&gt;&#xA;As Martin B noted correctly above, correct lighting is critical for this problem. Even with good structured lighting, you're going to have great difficulty detecting small dents near feature lines, gaps between panels, handles, and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Wikipedia entry for structured lighting is a bit thin, but it's a start for understanding the principle:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Structured_light&quot;&gt;http://en.wikipedia.org/wiki/Structured_light&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Light stripes can be used to detect in-dings (dents) and out-dings (pimples). To see a ding, you'll need relative motion between the light source and the car. Either the light + camera move together relative to the car, or the car moves past the light + camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although in-dings and out-dings have characteristic appearances when seen at the edge of a light stripe, the detectability of a given dent depends on the size and depth of the dent relative to the width of the light stripe. A car's curvature is complex, so it's quite difficult to present a consistent light stripe to a camera. As the light stripe moves across the car body, the curvature and even the intensity of the light stripe will vary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One partial solution is to ensure that the camera and light stripe always at a consistent angle relative to the normal (the 3D perpendicular) of the portion of the surface being inspected. In practice a robot would be required to move the camera accurately relative to the body surface. Moving the robot accurately requires knowledge of the pose (position and 3D angles) of the car body, which is a nasty problem by itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any inspection for automotive applications, you need to completely control the lighting. That means not only placing lights of your choice at known locations, but also blocking all other light. This will mean a fairly large enclosure. Since the car's panels are curved outward (almost like a spherical surface), they'll reflect light from sources all around them. To greatly simplify this problem, you could use a high frequency flourescent bar inside an enclosure shrouded with black velvet. Quite often it's necessary to go to extremes like that for inspection applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. 3D surface&lt;/strong&gt;&#xA;A car's outer surface is composed of complex curves. In order to know whether a suspicious spot is a ding, you have to compare that spot to known features of the car. That means you would need to match the 2D image from a camera to a 3D model viewed at a certain angle. This is not a problem solved quickly, and it's difficult enough to do well that some companies specialize in it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Defect characterization&lt;/strong&gt;&#xA;For academic research or lab testing it may be sufficient to develop an algorithm that shows promise or improves on an existing method. To properly solve this problem for real commercial or industrial use, you need to have a highly detailed specification for the size dents you'd like to detect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we tackled this problem, there were no reasonable industry or national standards for dents (3D deformations). That is, there was no agreed-upon technique to characterize a dent by its area, depth, and shape. We just had samples that industry experts agreed were bad, not too bad, and marginal in terms of severity. Defining the &quot;depth&quot; of a ding is tricky, too, since a ding is a 3D indentation in (typically) a 3D surface curving outward. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bigger dings are easier to detect, but they're also less common. An experienced auto worker can scan a car body quickly--much more quickly than an untrained observer--and find shallow dings the size of your pinky finger quickly. To justify the cost of an automated system, you would likely have to match an experienced observer's ability. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4. Criteria for detection errors&lt;/strong&gt;&#xA;Early on you should set criteria for acceptable false negatives and false positives. Even if you're just studying this problem as an R &amp;amp; D project and don't intend to develop a product, try to define your detection criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;false negative: dent present, but not detected&#xA;false positive: unblemished area identified as a dent&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's typically a tradeoff: increase sensitivity and you'll find more dings (decrease false negatives), but you'll also find more dings that aren't there (increase false positives). It is quite easy to convince oneself that an algorithm performs better than it actually does: our natural bias is to notice defects detected by the algorithm and explain away those it hasn't detected. Conduct blind, automated tests. If possible, have someone else measure the dings and assign severity so that you don't know what the true measurements are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5. Save data and/or map it&lt;/strong&gt;&#xA;A dent is characterized by its severity and its location on the car body. To know its location, you must solve the 2D-to-3D correspondence problem mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;6. Determining &quot;true&quot; shape of dents&lt;/strong&gt;&#xA;Dents are hard to measure. A sharp dent and a rounded dent of the same surface area and depth will appear different. Measuring dents by mechanical means leads to subjective judgments, and it's also quite tedious to use depth gauges, rulers, etc., when you'll likely have to measures dozens if not more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one of the harder engineering problems to solve for any defect detection project for manufacturing: how does one measure a defect and characterize it? if there is a standard for doing so, does the standard correlate well to something the inspection system measures? if the inspection system doesn't find a ding it &quot;should have&quot; found, who's to blame?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, if an inspection system works well enough for a sample of known defects, then users may eventually come to trust it, and the system itself becomes the standard for defining defect severity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;7. Extensive database of dents&lt;/strong&gt;&#xA;Ideally you would have hundreds if not thousands of sample images of dents of different severities at different locations on vehicles from difficult manufacturers. If you're interested in finding dents caused by accidents during the assembly process, then it could take a long time to collect that kind of data. Dents caused during the assembly process are not common.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're only interested in finding dents caused by accidents or environmental damage, then that's a different matter. The types of dents will be different from those caused by accidental bumps inside an auto assembly plant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;8. Dealing with different paint colors&lt;/strong&gt;&#xA;It's true that edge detectors can be reasonably robust at detecting edges in images of varying levels of contrast, but it can be quite disheartening to see what &quot;varying levels of contrast&quot; really means for different automotive paints and finishes. A light stripe that looks great on a shiny black car could be hardly detectable on a white car with old paint. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most cameras have relatively limited dynamic range, so achieving good contrast for both black shiny surfaces and white dull surfaces is tricky. It's quite likely you'll have to automatically control lighting intensity. That's hard, too.&lt;/p&gt;&#xA;" OwnerUserId="742" OwnerDisplayName="Rethunk" LastActivityDate="2012-01-15T04:28:18.967" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1203" PostTypeId="2" ParentId="1064" CreationDate="2012-01-22T14:53:32.313" Score="1" Body="&lt;p&gt;As a general approach, your steps are okay. However, your results quite a bit depends on the efficacy of thresholding. However, this can be tricky and results may vary from image to image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest best of the threshold algorithm can be otsu's algorithm &lt;a href=&quot;http://www.labbookpages.co.uk/software/imgProc/otsuThreshold.html&quot; rel=&quot;nofollow&quot;&gt;http://www.labbookpages.co.uk/software/imgProc/otsuThreshold.html&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-01-22T14:53:32.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1205" PostTypeId="1" AcceptedAnswerId="1206" CreationDate="2012-01-22T16:22:04.307" Score="3" ViewCount="662" Body="&lt;p&gt;I am implementing an iris recognition system in &lt;strong&gt;matlab&lt;/strong&gt; and have performed the following steps according to an algorithm proposed in a paper&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Initial image &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a9sdR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Median filtering &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each row in the filtered image, assign a value of one to the pixels that have the minimum value in that row and the other pixels to zero&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Again median filtering to remove white spots here and there.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;States that: &lt;strong&gt;Get the row and column that has maximum&#xA;number of ones. Then find the center (xo, yo) and&#xA;the radii (rx, ry) as follows: xo = the index of this&#xA;column, yo = the index of this row, rx = the&#xA;number of ones in this row/2, ry = the number of&#xA;ones in this column/2&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is how do i do &lt;strong&gt;step 5&lt;/strong&gt; in MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="90" LastEditDate="2012-01-22T18:45:29.440" LastActivityDate="2012-01-22T18:50:20.463" Title="Iris recognition using filters?" Tags="|image-processing|filters|algorithms|matlab|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1206" PostTypeId="2" ParentId="1205" CreationDate="2012-01-22T18:50:20.463" Score="4" Body="&lt;p&gt;Given a matrix &lt;code&gt;A&lt;/code&gt; that consists of zeros and ones only (which you should have after step 4 of your algorithm, you could implement step 5 via the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% find column with the maximum number of ones. sum down the rows of the&#xA;% matrix and find the column with the largest sum&#xA;[ry,xo] = max(sum(A));&#xA;% find the corresponding row; do the same thing except sum across the&#xA;% matrix's columns&#xA;[rx,yo] = max(sum(A,2));&#xA;% the values &quot;rx&quot; and &quot;ry&quot; above contain the sums of the row and column&#xA;% (respectively) that have the maximum number of ones. divide them by&#xA;% 2 according to your algorithm in step 5&#xA;rx = rx / 2;&#xA;ry = ry / 2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After the above (which is untested), then &lt;code&gt;xo&lt;/code&gt;, &lt;code&gt;yo&lt;/code&gt;, &lt;code&gt;rx&lt;/code&gt;, and &lt;code&gt;ry&lt;/code&gt; should be populated with the values that your algorithm indicated.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-01-22T18:50:20.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1207" PostTypeId="1" CreationDate="2012-01-22T21:46:40.040" Score="0" ViewCount="789" Body="&lt;p&gt;What kind of edge detection is used Paint.NET program? It allows me to choose the angle of the edge not like the one used by opencv (&lt;a href=&quot;http://opencv.willowgarage.com/documentation/python/imgproc_feature_detection.html?highlight=canny#Canny&quot; rel=&quot;nofollow noreferrer&quot;&gt;Canny&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WkmJa.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JJenQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="822" LastEditorUserId="6" LastEditDate="2012-01-25T15:15:24.387" LastActivityDate="2012-01-25T15:15:24.387" Title="What kind of edge detection use paint.net?" Tags="|edge-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1208" PostTypeId="2" ParentId="1207" CreationDate="2012-01-22T22:27:18.710" Score="1" Body="&lt;p&gt;The edges doesn't have single pixel width, so it's probably not canny (no non-maxima supression). Could be a simple high-pass filter, whose pass-band is masked out in the Fourier domain in specific angles.&lt;/p&gt;&#xA;" OwnerUserId="215" LastEditorUserId="215" LastEditDate="2012-01-22T22:32:43.833" LastActivityDate="2012-01-22T22:32:43.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1210" PostTypeId="2" ParentId="57" CreationDate="2012-01-23T04:40:13.250" Score="6" Body="&lt;p&gt;Some numerical stabs in the dark yielded the following for an iterative approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're looking for the solution y = f(x) where y^y = x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y \ln y = \ln x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = g(x,y) = e^{\frac{\ln x}{y}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value for $y$ is a fixed point of the above equation, and empirically it seems to converge for some values of $x$, but for larger values of $x$ it oscillates or diverges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I tried an approach similar to Newton's iterative square-root:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = \frac{y_{previous} + y_{*}}{2} = \frac{y + e^{\frac{\ln x}{y}}}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where y* is supposed to represent a nonconverging but optimistic answer that maintains accuracy if you happen to guess an accurate initial value (in square root y&lt;sup&gt;2&lt;/sup&gt; = x, it's y* = x/y).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This appears to converge, but very slowly at the low end of $x$ (near $x_{min} = (\frac{1}{e})^{\frac{1}{e}}$ )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also looks like a good initial guess is $y_0 = \ln(x)+1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I figured maybe there's a better-converging solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y = (1-a) \times y + a \times g(x,y)$ for some value of $a$ that is a function of $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I found something interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I get a converging answer $y$ from the above approach for $y^y = x$, and then compute $y_2 = g(x,y+ \epsilon) = e^{\frac{\ln(x)}{y+\epsilon}}$, it &lt;em&gt;appears&lt;/em&gt; as though $y_2-y$ = approximately $\epsilon \times (-\ln(y))$.... e.g. if we had a guess $y_1 = y + \epsilon$ for some unknown $\epsilon$, and computed $y_2 = g(x,y_1)$, then $(y_2 - y) \approx \epsilon \times (-\ln(y)) = (y_1 - y) \times (-\ln(y))$. (Just to clarify, I have no analysis to verify this, but the numbers just popped out of some numerical evaluation I performed.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solve for the linear terms in $y$, and you get $y = \dfrac{y_2 + \ln(y) \times y_1}{1 + \ln(y)}$... use $\ln(y_1)$ in place of $\ln(y)$ and you get this iterative approximation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xD;&#xA;    y[n+1] &amp;amp;= \frac{g(x,y[n]) + \ln(y[n])\times y[n]}{1+\ln(y[n])}\\&#xD;&#xA;           &amp;amp;= \frac{e^{\frac{\ln(x)}{y[n]}} + \ln(y[n])\times y[n]}{1+\ln(y[n])}&#xD;&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This appears to work very well, with the initial guess $y = 1+\ln(x)$, and appears to converge within 4 or 5 iterations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Someone could probably show that this is equivalent to Newton-Raphson in some way, but I think it's beyond my capability.)&lt;/p&gt;&#xA;" OwnerUserId="829" LastEditorUserId="829" LastEditDate="2012-01-29T03:50:10.317" LastActivityDate="2012-01-29T03:50:10.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1212" PostTypeId="2" ParentId="1197" CreationDate="2012-01-23T06:13:34.517" Score="3" Body="&lt;p&gt;If you're trying to identify birds, you should look into the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel-frequency_cepstrum&quot; rel=&quot;nofollow&quot;&gt;Mel-frequency Cepstral Coefficients (MFCCs)&lt;/a&gt;. They are commonly used in speech recognition, and there's actually a fair amount of academic papers on bird song recognition using the MFCCs and various other features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short-term energy is definitely useful to extract areas of bird sound, but it probably won't be sufficient to just take an FFT and look for coefficients. For example, imagine the same two  bird sounds, but one is slightly higher pitch, or there is more/different noise present. The FFT coefficients will be significantly different. The MFCCs basically capture the shape of the spectrum, on a scale that emphasizes regions of the spectrum where more detail is needed, and discard some of the unimportant details.&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2012-01-23T06:13:34.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1214" PostTypeId="2" ParentId="1197" CreationDate="2012-01-23T11:10:17.870" Score="2" Body="&lt;p&gt;Yes, you are correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, &quot;centering&quot; is meaningless in a moving window as long as everything is &quot;centered&quot; it all works out. The point is that you can use centered values but it won't change anything since it's all relative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you will have negative values at the start of the data set. There are various ways to overcome this such as zero-extending the data set in the negative range, periodically extending the data, mirroring the data, using a forward looking window instead of a backwards or centered window(but this can cause problems).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your problem is analogous and overlaps with taking the derivative of a function of a finite interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $f(x) = x$ only on the interval $[0,1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is the derivative at $f(0)$ and $f(1)$? Well, it doesn't exist. But instead we could either continuously extrapolate $f(x)$ to some larger interval then figure out what $f(0)$ and $f(1)$ or use the left and right derivatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll have to figure out how you want to deal with these end cases. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you used a forward looking window through out the data set you'll then end up with issues when you reach the end. You could use a forward window for the first half of the data set then a backwards window for the last half but then you'll have issues in the middle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use a gliding window which starts in a forward looking position and transitions to a backwards position(and it will be a centered window at about the center of the data set).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method is to use a window that expands and contracts. It starts off as a size of 1 for the first data point, 2 for the second, 3 for the third... until it reaches it's maximum... then near the end of the it shrinks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &quot;discontinue&quot; the loop you'll throw away a lot of data for no reason. It's a simple method and works when the data set is large and the window is small. But in some cases you have a window comparable to your data set. In your example, you'll essentially be throwing away the first 80 data points(well, you will have no computation for those data points).&lt;/p&gt;&#xA;" OwnerUserId="839" LastEditorUserId="6" LastEditDate="2012-01-23T14:33:24.580" LastActivityDate="2012-01-23T14:33:24.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1215" PostTypeId="1" AcceptedAnswerId="1239" CreationDate="2012-01-23T14:27:28.527" Score="21" ViewCount="46308" Body="&lt;p&gt;I have an image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/daRNS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way of removing the bright white spots ? &lt;strong&gt;Please help thanks&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After operating with gaussian and then displaying using imagesc get the following output which clearly shows the bright red spots How do i get rid of them&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pbq9e.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Red Channel :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EAzlA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Green channel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bWJ7d.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blue channel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qKY83.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Defect detection using Gabor filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kCVOk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its Histogram :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zLh0j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to calculate its appropriate threshold adaptivily.?&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="128" LastEditDate="2020-01-04T14:42:39.787" LastActivityDate="2020-01-04T14:42:39.787" Title="How to Remove a Glare / Clipped Brightness from an Image?" Tags="|image-processing|matlab|image-restoration|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1216" PostTypeId="1" AcceptedAnswerId="1217" CreationDate="2012-01-17T17:36:20.220" Score="12" ViewCount="1606" Body="&lt;p&gt;I am happy to accept suggestions either in R or Matlab, but the code I present below is R-only.&lt;/p&gt;&#xA;&lt;p&gt;The audio file attached below is a short piece of conversation between two people. My goal is to distort their speech so that the emotional content will becomes unrecognisable. The difficulty is that I need some parametric space for this distortion lets say from 1 to 5, where 1 is 'highly recognisable emotion' and 5 is 'non-recognisable emotion'. There are three ways I thought I can use to achieve that with R.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Download 'happy' audio wave from &lt;a href=&quot;http://dl.dropbox.com/u/2505196/happy.wav&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Download 'angry' audio wave from &lt;a href=&quot;http://dl.dropbox.com/u/2505196/angry.wav&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The first approach was to decrease the overall intelligibility by introducing noise. This solution is presented below (thanks to @carl-witthoft for his suggestions). This will decrease both intelligibility and emotional content of the speech, but it's very 'dirty' approach - it's hard to make it right to get the parametric space, because the only aspect you can control there is an amplitude (volume) of noise.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;require(seewave)&#xA;require(tuneR)&#xA;require(signal)&#xA;h &amp;lt;- readWave(&amp;quot;happy.wav&amp;quot;)&#xA;h &amp;lt;- cutw(h.norm,f=44100,from=0,to=2)#cut down to 2 sec&#xA;n &amp;lt;- noisew(d=2,f=44100)#create 2-second white noise&#xA;h.n &amp;lt;- h + n #combine audio wave with noise&#xA;oscillo(h.n,f=44100)#visualize wave with noise(black)&#xA;par(new=T)&#xA;oscillo(h,f=44100,colwave=2)#visualize original wave(red)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0OBpG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The second approach would be to somehow adjust the noise, to distort the speech only in the specific frequency bands. I thought I could do it by extracting amplitude envelope from the original audio wave, generate noise from this envelope and then re-apply the noise to the audio wave. The code below shows how to do that. It does something different than noise itself,  makes the sound cracking, but it goes back to the same point - that I am only able to change the amplitude of noise here.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n.env &amp;lt;- setenv(n, h,f=44100)#set envelope of noise 'n'&#xA;h.n.env &amp;lt;- h + n.env #combine audio wave with 'envelope noise'&#xA;par(mfrow=c(1,2))&#xA;spectro(h,f=44100,flim=c(0,10),scale=F)#spectrogram of normal wave (left)&#xA;spectro(h.n.env,f=44100,flim=c(0,10),scale=F,flab=&amp;quot;&amp;quot;)#spectrogram of wave with 'envelope noise' (right)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P8wFX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The final approach might be the key to solve this, but it's quite tricky. I found this method in &lt;a href=&quot;http://www.cogsci.msu.edu/DSS/2007-2008/Shannon/temporal_cues.pdf&quot; rel=&quot;noreferrer&quot;&gt;report paper published in &lt;em&gt;Science&lt;/em&gt; by Shannon et al. (1996)&lt;/a&gt;. They used quite tricky pattern of spectral reduction, to achieve something that probably sounds quite robotic. But at the same time, from the description, I assume they might have found the solution that could answer my problem. The important information is in the second paragraph in the text and note number 7 in &lt;em&gt;References and Notes&lt;/em&gt; - the whole method is described there. My attempts to replicate it so far have been unsuccessful but below is the code I managed to find, together with my interpretation of how the procedure should be done. I think that almost all the puzzles are there, but I can't somehow get the whole picture yet.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;###signal was passed through preemphasis filter to whiten the spectrum &#xA;#low-pass below 1200Hz, -6 dB per octave&#xA;h.f &amp;lt;- ffilter(h,to=1200)#low-pass filter up to 1200 Hz (but -6dB?)&#xA;&#xA;###then signal was split into frequency bands (third-order elliptical IIR filters)&#xA;#adjacent filters overlapped at the point at which the output from each filter &#xA;#was 15dB down from the level in the pass-band&#xA;#I have just a bunch of options I've found in 'signal'&#xA;ellip()#generate an Elliptic or Cauer filter&#xA;decimate()#downsample a signal by a factor, using an FIR or IIR filter&#xA;FilterOfOrder()#IIR filter specifications, including order, frequency cutoff, type...&#xA;cutspec()#This function can be used to cut a specific part of a frequency spectrum&#xA;&#xA;###amplitude envelope was extracted from each band by half-wave rectification &#xA;#and low-pass  filtering&#xA;###low-pass filters (elliptical IIR filters) with cut-off frequencies of:&#xA;#16, 50, 160 and 500 Hz (-6 dB per octave) were used to extract the envelope&#xA;&#xA;###envelope signal was then used to modulate white noise, which was then &#xA;#spectrally limited by the same bandpass filter used for the original signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So how should the result sound? It should be something between hoarseness, a noisy cracking, but not so much robotic. It would be good if the dialogue would remain to some extend intelligible. I know - it's all a bit subjective, but don't worry about that - wild suggestions and loose interpretations are very welcome.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Shannon, R. V., Zeng, F. G., Kamath, V., Wygonski, J., &amp;amp; Ekelid, M. (1995). Speech recognition with primarily temporal cues. &lt;em&gt;Science&lt;/em&gt;, 270 (5234), 303. Download from &lt;a href=&quot;http://www.cogsci.msu.edu/DSS/2007-2008/Shannon/temporal_cues.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://www.cogsci.msu.edu/DSS/2007-2008/Shannon/temporal_cues.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="841" OwnerDisplayName="Geek On Acid" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-01-26T16:24:34.910" Title="Parametrically degrade the speech to remove emotional content" Tags="|matlab|audio|noise|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1217" PostTypeId="2" ParentId="1216" CreationDate="2012-01-22T20:08:29.370" Score="11" Body="&lt;p&gt;I read your original question and wasn't quite sure what you were getting at but it's quite a lot clearer now.  The problem you have is that the brain is extremely good at picking out speech and emotion even when the background noise is very high which is your existing attempts have only been of limited success.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the key to getting what you want is to understand the mechanisms that convey the emotional content as they are mostly separate from those that convey the intelligibility.  I've got a some experience around this (in fact my degree dissertation was on a similar subject) so I'll try and offer some ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider your two samples as examples of very emotional speech, then consider what would be an &quot;emotionless&quot; example.  The best I can think of right now is the computer generated &quot;Stephen Hawking&quot; type voice.  So, if I understand right what you want to do is understand the differences between them and figure out how to distort your samples to gradually become like a computer generated emotionless voice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd say that the two main mechanisms to get what you want are via pitch and time distortion as a lot of the emotional content is contained in the intonation and rhythm of the speech.  So, a suggestion of a couple of things that might be worth trying :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A pitch distortion type effect which bends the pitch and reduces the intonation. This could be done the same way that Antares Autotune works where you gradually bend the pitch towards a constant value more and more until it's a complete monotone.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A time-stretch effect which changes the length of some parts of the speech - perhaps the constant voiced phonemes which would break up the rhythm of the speech.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, if you decided to approach either of these methods then I'll be honest - they're not that straightforward to implement in DSP and it's not going to be just a few lines of code.  You're going to need to do some work to understand the signal processing.  If you know somebody with Pro-Tools/Logic/Cubase and a copy of Antares Autotune then it'd probably be worth trying to see if it'll have the effect you want before trying to code something similar yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that gives you some ideas and helps a little. If you need me to explain any of the things I've said any more then let me know.&lt;/p&gt;&#xA;" OwnerUserId="846" OwnerDisplayName="Redeye" LastActivityDate="2012-01-22T20:08:29.370" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1218" PostTypeId="2" ParentId="1216" CreationDate="2012-01-23T17:32:54.870" Score="4" Body="&lt;p&gt;I suggest you get some music production software and play with that to get the effect that you want.  Only then should you worry about programmatically solving this.  (If your music software can be called from a command line, then you can call it from R or MATLAB).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;One other possibility that hasn't been discussed is to completely strip out the emotion by using speech to text software to create a string, then text to speech software to turn that string into a robot voice.  See &#xA;&lt;a href=&quot;https://stackoverflow.com/questions/491578/how-do-i-convert-speech-to-text&quot;&gt;https://stackoverflow.com/questions/491578/how-do-i-convert-speech-to-text&lt;/a&gt;&#xA;and&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/637616/open-source-text-to-speech-library&quot;&gt;https://stackoverflow.com/questions/637616/open-source-text-to-speech-library&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get this working reliably you will probably have to train the first piece of software to recognise the speaker.&lt;/p&gt;&#xA;" OwnerUserId="844" OwnerDisplayName="Richie Cotton" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-01-23T17:32:54.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1220" PostTypeId="1" AcceptedAnswerId="1250" CreationDate="2012-01-24T02:14:55.607" Score="2" ViewCount="256" Body="&lt;p&gt;I have the differential system equation with some unknown parameters (friction coefficients)&#xA;Also I have experimental data. What I want is to determine the friction coefficients which best fit the experimental data. How to do it using the Mathematica, I know there NDSolve and FindFit functions, but they can't be used here? And what are the general approaches of this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 1:&#xA;Here is the model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$k_1 (x_3[t]-x_1[t])+a_1 \left(x_3&amp;#39;[t]-x_1&amp;#39;[t] \right)+M_1 x_1&amp;#39;&amp;#39;[t]=0$$&#xA;$$k_2 (x_3[t]-x_2[t])+a_2 \left(x_3&amp;#39;[t]-x_2&amp;#39;[t]\right)+M_2 x_2&amp;#39;&amp;#39;[t]=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{eqnarray}&#xD;&#xA;&amp;amp; k_3 x_3[t]-k_1 (x_3[t]-x_1[t])-k_2 (x_3[t]-x_2[t])  &#xD;&#xA;\\&amp;amp; + a_3 x_3&amp;#39;[t]-a_1 \left(x_3&amp;#39;[t]-x_1&amp;#39;[t]\right)-a_2 \left(x_3&amp;#39;[t]-x_2&amp;#39;[t]\right)&#xD;&#xA;\\&amp;amp; +C_1 x_3&amp;#39;&amp;#39;[t]=0&#xD;&#xA;\end{eqnarray}$$&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2012-01-27T05:33:13.193" LastActivityDate="2012-01-27T16:41:08.827" Title="Finding the friction coefficient by using experimental data" Tags="|estimators|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1221" PostTypeId="1" CreationDate="2012-01-24T02:15:55.190" Score="-3" ViewCount="302" Body="&lt;p&gt;Can anybody explain how I can implement the Fast Fourier Transform (FFT) of length unequal to a power of two in hardware, e.g. FPGA? What is the algorithm for this implementation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know about the probable chips or hardware that are currently used with the FFT length unequal to a power of two?&lt;/p&gt;&#xA;" OwnerUserId="290" LastEditorUserId="39" LastEditDate="2012-05-15T12:15:17.947" LastActivityDate="2012-05-15T12:15:17.947" Title="How Can I practically implement the FFT with size unequal to a power of two?" Tags="|fft|algorithms|discrete-signals|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1223" PostTypeId="2" ParentId="1221" CreationDate="2012-01-24T09:22:44.163" Score="10" Body="&lt;p&gt;You need to either factor your FFT size into small prime factors if possible (e.g. 2, 3, 5, 7) and then use appropriate FFT butterflies (this is what FFTW does), otherwise look at padding the FFT with zeroes up to the next power of 2.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2012-01-24T09:22:44.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1224" PostTypeId="1" CreationDate="2012-01-24T11:38:50.763" Score="6" ViewCount="1093" Body="&lt;p&gt;For a Face Recognition system which one is better using Neural Network or the Histogram with pattern matching concept ?? which one is more accurate??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to integrate the face recognition engine to a Java project so I think it is hard to integrate a math lab project to a java project. So I need to know about Histograms and pattern matching in OpenCv (C++) and Neural Networks. Which one is better??&lt;/p&gt;&#xA;" OwnerDisplayName="user1166881" LastEditorUserId="-1" LastEditDate="2012-02-01T15:51:05.793" LastActivityDate="2012-08-14T06:59:02.263" Title="Face Recognition / Image Processing" Tags="|image-processing|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1225" PostTypeId="2" ParentId="1224" CreationDate="2012-01-24T11:52:42.687" Score="7" Body="&lt;p&gt;I am not sure about the state of art in Neural Network implementations. However, you might want to try this matlab implementation of Histogram based facial recognition - &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22457-processed-histogram-based-face-recognition&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/22457-processed-histogram-based-face-recognition&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It claims to have 99.75% accuracy on the ORL database&lt;/p&gt;&#xA;" OwnerUserId="847" OwnerDisplayName="mrkulk" LastActivityDate="2012-01-24T11:52:42.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1226" PostTypeId="2" ParentId="1215" CreationDate="2012-01-24T12:13:37.420" Score="2" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R3n7V.jpg&quot; alt=&quot;enter image description here&quot;&gt;Without lighting information, it is difficult. However, if the shape of the object in the image is known, you could setup a shape template of the white glare (gaussian) and do a sliding window to find possible detection of glare (followed by color blending from adjacent area). Perceptually, we infer 3D shape from images using shading. If shape from shading is able to give the surface gradient, we could do a sliding window and check our glare template at each location. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After canny edge detection : -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2zYul.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the overlap ( max overlapping area ) between image #1 and #2 will be the defect.&lt;/p&gt;&#xA;" OwnerUserId="847" LastEditorUserId="847" LastEditDate="2012-01-24T18:54:23.130" LastActivityDate="2012-01-24T18:54:23.130" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1227" PostTypeId="1" CreationDate="2012-01-25T03:56:13.430" Score="19" ViewCount="8945" Body="&lt;p&gt;What is a robust way to fit piecewise linear but noisy data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm measuring a  signal, which consists of several almost linear segments. I'd like to atomatically fit several lines to the data to detect the transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dataset consists of a few thousand points, with 1-10 segments and I know the number of segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example of what I'd like to do automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0RX1I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="851" LastEditorUserId="128" LastEditDate="2024-01-23T19:12:18.217" LastActivityDate="2024-01-23T19:12:18.217" Title="Fit a Piecewise Linear Model to Data with Unknown Knots and Number of Segments" Tags="|algorithms|machine-learning|optimization|data-fitting|" AnswerCount="6" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1228" PostTypeId="1" CreationDate="2012-01-25T05:21:02.560" Score="7" ViewCount="338" Body="&lt;p&gt;I have a stateful black box with four real-valued inputs and one real-valued output.  My problem is to predict the output at each moment in time, given the sequence of inputs seen up to that point.  During a learning phase, I can vary the inputs however I want and observe the output.  There's a little noise, of course, and the black box doesn't appear to be completely deterministic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I'm modeling a hard drive, and I want to predict the access time of the latest request given all previous requests.  I want a more black-box approach, though, because of the complexity of explicit models, and because I want this to work for other similar devices such as SSDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple of people have suggested that signal processing might be appropriate to analyze the sequences of input and output values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any ideas from signal processing that could help me to predict the output, or to characterize the input?&lt;/p&gt;&#xA;" OwnerUserId="853" LastActivityDate="2012-01-27T15:05:45.737" Title="Black box signal prediction" Tags="|discrete-signals|distance-metrics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1230" PostTypeId="2" ParentId="1215" CreationDate="2012-01-25T15:03:59.193" Score="4" Body="&lt;p&gt;This may be a bit of a simplistic answer, but could you just threshold? e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = imread('daRNS.png');&#xA;imflat = img; &#xA;imflat(img&amp;gt;150) = 150; &#xA;imagesc(imflat)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;results in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JPFPK.png&quot; alt=&quot;flattened image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would obviously be better to select the threshold adaptively. For example you could look at the image histogram:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hist(double(img(:)),0:255)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yhcNV.png&quot; alt=&quot;histogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and try to select an appropriate threshold based on that.&lt;/p&gt;&#xA;" OwnerUserId="584" LastActivityDate="2012-01-25T15:03:59.193" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1232" PostTypeId="1" AcceptedAnswerId="2440" CreationDate="2012-01-25T16:26:15.730" Score="11" ViewCount="15144" Body="&lt;p&gt;I'm want to program my own vocoder synthesizer like &lt;a href=&quot;http://www.youtube.com/watch?v=T2aQx9arDqA&amp;amp;feature=endscreen&amp;amp;NR=1&quot;&gt;&quot;Songify&quot;&lt;/a&gt; but I can't find a simple of vocoder algorithm. Maybe you can explain or tell where to look for information on how vocoder works.&lt;/p&gt;&#xA;" OwnerUserId="856" LastActivityDate="2022-07-26T17:30:15.673" Title="Programming a Vocoder" Tags="|audio|algorithms|voice|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1233" PostTypeId="1" AcceptedAnswerId="1247" CreationDate="2012-01-25T16:38:12.737" Score="3" ViewCount="2729" Body="&lt;p&gt;Is it possible to convert a .jpg image to binary using Java?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have asked a similar question on StackOverflow but thought that maybe this may be a good place to ask, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently able to convert an image to negative in Java, but am unable as of yet to figure out a way of converting it into binary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions - and even sample code - would be amazing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="857" LastActivityDate="2012-01-26T22:50:26.190" Title="Java - Convert Image to Binary (Two Colours/Black &amp; White)" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1234" PostTypeId="2" ParentId="1227" CreationDate="2012-01-25T20:09:37.733" Score="12" Body="&lt;p&gt;I tried two approaches, naively (using only 3 segments). Surely there would be fancier methods out there.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt; RANSAC, supposed to be a robust fitting mechanism. It's easy to stop the algorithm after a number of segments. However it may be difficult to enforce continuity between segments--as seems required in your application-- at least with a simple implementation. &#xA;&#xA;As a proof of concept, I created an image from the data points so that I could use the RANSAC engine available in $ImageLines$, the line detection function of Mathematica.&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OPRmM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt; Fit a piecewise linear model using a general purpose minimizer. It's easy to enforce segments continuity. Interestingly, testing for residuals and other properties may provide enough information to determine automatically the number of segments--I've not tried it though. That's how it looks in Mathematica:&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xtnb7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="602" LastEditorUserId="602" LastEditDate="2012-01-25T20:14:39.847" LastActivityDate="2012-01-25T20:14:39.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1235" PostTypeId="2" ParentId="403" CreationDate="2012-01-25T20:36:57.457" Score="2" Body="&lt;p&gt;Your only real chance of recovering a JPEG image beyond the corrupt spot is if it has restart markers. You will otherwise have no way of knowing if the data is missing or corrupt and how that corruption has affected the DC values. Restart markers were designed to fix this situation by resetting the DC values at regular intervals. The lower 3 bits of the restart marker continuously increment so that you can know the quantity of missing data as well. Unfortunately very few JPEG images contain restart markers because they are assumed to be used on error-free channels.&lt;/p&gt;&#xA;" OwnerUserId="859" LastActivityDate="2012-01-25T20:36:57.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1236" PostTypeId="2" ParentId="1232" CreationDate="2012-01-26T01:11:13.130" Score="2" Body="&lt;p&gt;Here's one &lt;a href=&quot;http://www.mathworks.com/products/dsp-system/demos.html?file=/products/demos/shipping/dsp/dspPhaseVocoder.html&quot; rel=&quot;nofollow&quot;&gt;link to pseudo-code at Mathworks.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a &lt;a href=&quot;http://www.dspdimension.com/admin/time-pitch-overview/&quot; rel=&quot;nofollow&quot;&gt;link a description of the algoritm at DSP Dimensions.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FFT bin has a center frequency.  Any sinusoid at that exact bin frequency will have the same phase with reference to 2 reference points offset exactly 1 FFT frame apart, or have a delta phase that can be calculated for 2 reference points or 2 FFT frames some arbitrary distance apart (perhaps overlapping).  The basic idea of a phase vocoder is to slightly adjust each FFT bin frequency to a frequency nearby so that a sinusoid at that frequency will match the detected phase at the reference points of 2 offset FFT frames, if the FFT bin center frequencies do not.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These adjusted frequencies can then be used for a granular resynthesis of a waveform that exhibits more continuity across resynthesized frames, even if the original sequence of spectrums is scaled in the frequency or time domains.  These offset frequencies can also be used for frequency estimation, or as part of a pitch estimation method.  With pitch estimation plus sound resynthesis, one might be able to take a sound at one pitch and push a resynthesis to something that sounds nearly the same, except at another pitch.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-01-27T01:02:28.820" LastActivityDate="2012-01-27T01:02:28.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1237" PostTypeId="2" ParentId="1232" CreationDate="2012-01-26T02:29:22.790" Score="2" Body="&lt;p&gt;Dan Ellis has some very good Matlab example on this page: &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/resources/matlab/pvoc/&quot; rel=&quot;nofollow&quot;&gt;http://www.ee.columbia.edu/~dpwe/resources/matlab/pvoc/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="862" LastActivityDate="2012-01-26T02:29:22.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1238" PostTypeId="2" ParentId="1228" CreationDate="2012-01-26T12:21:48.767" Score="1" Body="&lt;p&gt;If your box is (mostly) linear that is a very simple problem, if it mainly non-linear that it can arbitrarily complicated. &#xA;If we assume linearity, than simple superposition holds. You can measure the transfer function from each input to the output (while the other inputs are zero) and then calculate the output as the sum of the individual input responses. In the frequency domain we would write&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y(w) = X1(w)*H1(w) + X2(w)*H2(w) + X3(w)*H3(w) + X4(w)*H4(w); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where Y(w) is the output spectrum, Xn is the input spectrum for input &quot;n&quot; and Hn the transfer function from input &quot;n&quot; to the output. In the time domain it would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(t) = x1(t)**h1(t) +  ... + x4(t)**h4(t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where '**' is the convolution operator, y(t) is your output signal, xn(t) the input signals, and hn(t) the impulse responses from input n to the output. The two equations are basically the Fourier Transforms of each other.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-01-26T12:21:48.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1239" PostTypeId="2" ParentId="1215" CreationDate="2012-01-26T15:39:15.973" Score="20" Body="&lt;p&gt;Let's assume glare portions are the only saturated areas in the image. &#xA;Detection can be performed by thresholding the intensity (code in Mathematica):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;saturated = Binarize[ColorConvert[img, &quot;Grayscale&quot;], .9]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5c3C0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we need only to replace the portions of the image around the saturation mask (enlarging the mask is done by the morphological function &lt;code&gt;Dilation&lt;/code&gt;). Inpainting using texture synthesis (using the function &lt;code&gt;Inpaint&lt;/code&gt;) seems to work well in this example, though I can not test it as input to your defect-detection algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Inpaint[img, Dilation[saturated, DiskMatrix[20]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O74ED.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="602" LastEditorUserId="602" LastEditDate="2012-01-26T17:10:57.587" LastActivityDate="2012-01-26T17:10:57.587" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="1240" PostTypeId="1" CreationDate="2012-01-26T17:29:21.920" Score="5" ViewCount="294" Body="&lt;p&gt;My question is basically in regards to how to detect when (in time) a signal 'starts', and it might also be called 'transient detection', or, as I have read in some papers regarding music, the 'onset' of a signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motivation here is ultimately a Time-Delay-Of-Arrival (TDOA) estimate between two signals, but suppose you do not have the luxury of doing a cross-correlation because the signals are either way too long, and/or there is so much multi-path corruption that the cross-correlation method doesnt work. In this case my belief is to look for where a signal 'starts' and go from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for more breadth than depth here, as in, a survey of possible/common methods used in doing such a thing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-02-03T19:24:17.630" Title="Coarse summary of various methods for detecting when a signal 'starts'" Tags="|cross-correlation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1241" PostTypeId="2" ParentId="1227" CreationDate="2012-01-26T17:48:09.663" Score="7" Body="&lt;p&gt;I don't claim the following method is robust, but it might work for you.&#xA;With thousands of points $x[n]$ and perhaps ten or so straight-line segments,&#xA;proceed as follows.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Process the points $x[n]$ to create a bit array $y[n]$ as follows.&#xA;$$y[n] = \begin{cases}1, &amp;amp;\text{if} ~ |(x[n+1]-x[n]) - (x[n]-x[n-1])| &amp;lt; \epsilon,\\&#xD;&#xA;0, &amp;amp;\text{otherwise.}\end{cases}$$&#xA;Here $\epsilon$ is a small number chosen to suit your notion of how close to &#xA;a straight line you want points $x[n-1],x[n], x[n+1]$ to hew to. &#xA;The criterion will be recognized by the cognoscenti as demanding that the &#xA;straight line through $(n-1, x[n-1])$ and $(n,x[n])$ has nearly the same slope&#xA;as the straight line through $(n,x[n])$ and $(n+1,x[n+1])$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $y[n]$ is an array of ten or so longish runs of $1$s separated by&#xA;runs of $0$s with occasional stray $1$s here and there to mar the beauty,&#xA;relax, you are on the right track.  Else, if there are too few runs or too&#xA;many runs of $1$s, repeat the previous step with a different $\epsilon$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use linear least-mean-square-error curve-fitting to fit straight lines &#xA;to the points identified by $y[n]$ as belonging to the same straight-line &#xA;segment.  You now have ten straight lines fitting points, say, Line A fits&#xA;points $x[3]$ through $x[88]$; line B fits points $x[94]$ through $x[120]$, &#xA;Line C fits points $x[129]$ through $\cdots$, and so on.  Extend A rightwards&#xA;and B leftwards to find out where they intersect; extend B rightwards and&#xA;C leftwards to find out where they intersect, etc.  Congratulations, you&#xA;now  have a continuous and&#xA;piecewise linear model for your data. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-01-26T17:48:09.663" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1242" PostTypeId="1" CreationDate="2012-01-26T18:12:08.053" Score="22" ViewCount="6349" Body="&lt;p&gt;We always hear about this vector of data VS this other vector of data being independent from each other, or uncorrelated, etc, and while it is easy to come across the math regarding those two concepts, I want to tie them into examples from real-life, and also find ways to measure this relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this stand point, I am looking for examples of two signals that are of the following combinations: (I will start with some):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Two signals that are independent AND (necessarily) uncorrelated:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The noise from a car engine (call it $v_1[n]$) and your voice ($v_2[n]$) as you are talking.&lt;/li&gt;&#xA;&lt;li&gt;A recording of humidity every day ($v_1[n]$) and the dow-jones index ($v_2[n]$). &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Q1) How would you measure/prove that they are independent with those two vectors in hand? We know that independence means that the product of their pdfs equals their joint pdf, and thats great, but with those two vectors in hand, how does one prove their independence?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Two signals that are NOT independent, but still uncorrelated:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Q2) I cant think of any examples here ... what would some examples be? I know we can measure correlatedness by taking the cross-correlation of two such vectors, but how would we prove that they are also NOT independent?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Two signals that are correlated:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A vector measuring an opera singer's voice in the main hall, $v_1[n]$, while someone records her voice from somewhere inside the building, say in the rehearsal room ($v_2[n]$).&lt;/li&gt;&#xA;&lt;li&gt;If you continuously measured your heart rate in your car, ($v_1[n]$), and also measured the intensity of blue lights impinging on your rear windshield ($v_2[n]$)... I am guessing those would be very correlated... :-)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Q3) Related to q2, but in the case of measuring cross-correlation from this empirical stand point, is it enough to look at the dot product of those vectors (since that is the value at the peak of their cross-correlation)? Why would we care about other values in the cross-corr function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks again, the more examples given the better for building of the intuition!  &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2014-04-18T16:44:17.023" Title="Examples of Independent and uncorrelated data in real-life, and ways to measure/detect them" Tags="|cross-correlation|independence|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1243" PostTypeId="1" AcceptedAnswerId="1265" CreationDate="2012-01-26T18:09:54.550" Score="12" ViewCount="24903" Body="&lt;p&gt;I designed a digital filter using fdatool of matlab and obtained the filter coefficients from the tool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that i designed a 4th order filter. This gave me 5 filter values &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h[] = {0.1930,0.2035,0.2071,0.2035,0.1930}&#xA;x[k] = Discrete time input signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now on using the formula&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Output = h[k]*x[n-k];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output represents the final filtered value.Although the results are coming fine, but I am not able to find out how those coefficients are obtained by matlab and how mere multiplication(convolution) gives the final filtered response for any sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any link or explanation will do. I wish to know the complete back-end working of filter coefficient calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please comment if i am unclear in my doubt somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="864" OwnerDisplayName="Prashant Singh" LastEditorUserId="6" LastEditDate="2012-01-26T19:13:26.537" LastActivityDate="2013-11-27T02:15:56.430" Title="What do the filter coefficients in a digital filter represent?" Tags="|filters|matlab|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1244" PostTypeId="2" ParentId="1243" CreationDate="2012-01-26T18:19:10.520" Score="1" Body="&lt;p&gt;wow... that question is the subject of an entire university level course in discrete time signals and systems. In a nutshell, h is called the impulse response and is closely related (through a Fourier transform). It characterizes a system (e.g. a filter) in the time domain. In discrete time systems, this is a &quot;sampled&quot; form and the coefficients represent the samples for a &quot;finite impulse response&quot; or FIR filter. &lt;a href=&quot;http://www.dspguide.com/ch9/2.htm&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a decent article on the topic, but frankly you need a textbook to get a thorough understanding.&lt;/p&gt;&#xA;" OwnerDisplayName="vicatcu" LastActivityDate="2012-01-26T18:19:10.520" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1246" PostTypeId="1" AcceptedAnswerId="1248" CreationDate="2012-01-26T22:03:49.877" Score="5" ViewCount="508" Body="&lt;p&gt;I have a philosophical question of sorts for users familiar with a multi-view stereo setup. Imagine that I need to measure the dimensions of a large building and I take several photos of the building from different viewpoints. After calibrating the camera (intrinsic and extrinsic), I compute matches between points in these images and map them to 3D points. The output of this entire process is a cloud of 3D points. If I specify a scale, origin and co-ordinate axes, then I can perform measurements between points in this cloud which relate to the real-world scene (the building) that I captured. My question is this: how do I determine how accurate was my reconstruction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, this camera apparatus forms a measurement device. To compare a measurement, one typically needs to use another measurement device that is much more accurate that it. How do I measure the accuracy of a such a system?&lt;/p&gt;&#xA;" OwnerUserId="867" LastEditorUserId="26" LastEditDate="2012-01-27T16:18:30.897" LastActivityDate="2012-01-30T20:12:35.093" Title="How do you measure the accuracy of a stereo system?" Tags="|computer-vision|stereo-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1247" PostTypeId="2" ParentId="1233" CreationDate="2012-01-26T22:50:26.190" Score="3" Body="&lt;p&gt;Converting it to &quot;negative&quot; will give you single channel result (0-255). To convert this image to binary, you need thresholding. This threshold value will have a HIGH (0-255) and LOW (0-255). These values are dependent on your application (what you wish to segment). For instance, you could setup an empty image structure and set all values to '0'. Set '1' to channel values that fall between HIGH and LOW. However, remember that performing naive segmentation like this may not give you good results.&lt;/p&gt;&#xA;" OwnerUserId="847" LastActivityDate="2012-01-26T22:50:26.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1248" PostTypeId="2" ParentId="1246" CreationDate="2012-01-26T23:32:22.700" Score="4" Body="&lt;p&gt;From a more pragmatic than philosophical perspective, possibilities include:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing with ground truth data--these data could come from surveying's instruments, or be assumed to be &quot;reliable&quot; (e.g. you could assess the system's accuracy on the Eiffel tower and other well-known buildings for which measurements have been curated);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Verifying physical properties are met (e.g., floors are horizontal, walls are perpendicular, distances between floors or between windows are constant);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Leaving one ore more views out of the 3D estimation process and assessing how far the projections of the estimated 3D points are from the actual 2D positions in these views (ie., jackknifing).&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2012-01-26T23:32:22.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1249" PostTypeId="1" CreationDate="2012-01-27T00:52:37.790" Score="7" ViewCount="432" Body="&lt;p&gt;Aside from Jsteg of Derek Upham, Outguess of Neils Provos, and F5 (improvement of F3 and F4) of Pfitzmann and Westfeld, What other methods can you use in information hiding in JPEG images?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The methods I mentioned above hide the message in the DCT coefficients of the image before it is compressed. Are there other component in jpeg which can be used to perform steganography? Pixel values can be used for PNG and BMP images but they cannot be used for JPEG since they change after being compressed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="820" LastEditorUserId="21075" LastEditDate="2020-05-09T14:53:56.413" LastActivityDate="2020-05-09T14:53:56.413" Title="JPEG steganography" Tags="|image-processing|dct|jpeg|steganography|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1250" PostTypeId="2" ParentId="1220" CreationDate="2012-01-27T07:33:39.150" Score="3" Body="&lt;p&gt;I can only propose a crude starting point based on a more modest work I did. My goal was to determine the bleaching coefficient of a fluorophore when submitted to varying illumination intensity over time. I had the theoretical law for the bleaching over time as a function of intensity (depending on unknown parameters), the amount of fluorophore over time, and the starting intensity and intensity at the end of the experiment. The goal was to retrieve the parameters for the bleaching law and the whole intensity over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway. What I did was to construct (using MATLAB) a function to minimize. In your case, given that you know $x(t)$ experimentally, I suggest to build a function $O(x, y)$ such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ O(x, y) = \sum_t |x(t) - y(t)|^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $x(t)$ being your experimental data and $y(t)$ being the solution of your differential system for some parameters $k, M, a$. Put this function as the objective in a simplex optimizer that will find its minimum, allowing $k, M, a$ to vary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is done through numerical solution. So you have a function to minimize, say $F(k,a,M)$ that returns the value of $O(x,y)$ (which is scalar btw) for the current numerical resolution with the given $k,a,M$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At each step, the whole system will be solved again, and the solution will be matched against the experimental data until they fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found this to be working quite well in my case, as long as you are sure you have the correct model to describe the experimental data. Otherwise, expect some seriously irrelevant results. &lt;/p&gt;&#xA;" OwnerUserId="756" LastEditorUserId="756" LastEditDate="2012-01-27T16:41:08.827" LastActivityDate="2012-01-27T16:41:08.827" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1251" PostTypeId="2" ParentId="1249" CreationDate="2012-01-27T09:08:57.753" Score="5" Body="&lt;p&gt;I am not sure if Jsteg, Outguess or F5 make already use of this, but in theory you could use the APP segment to hide information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the Quantization Table (DQT) could offer some limited space. You will have to study the effects of hiding data in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the DCT coefficients seems to be the most sensible thing to do in my opinion.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2012-01-27T09:08:57.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1252" PostTypeId="1" AcceptedAnswerId="1261" CreationDate="2012-01-27T14:43:30.937" Score="4" ViewCount="385" Body="&lt;p&gt;(This question was already &lt;a href=&quot;https://stackoverflow.com/questions/9034698/anti-aliased-boolean-masks-for-integration-of-ccd-images&quot;&gt;asked on Stack Overflow&lt;/a&gt; under the tags Matlab/Octave/Signal-processing/Image-processing, but I am reposting it here following the advice of one user that this site may be a more appropriate forum for such questions.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it common/useful to generate an anti-aliased boolean mask for CCD image integration purposes ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's imagine that I want to integrate the light that strikes a given area of a CCD sensor. The boundaries of this area correspond to physical coordinates that have no obligation to coincide exactly with the pixels of my CCD sensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab/Octave/(or even Scientific Python), the common algorithm used for integrating such an area is to define a boolean mask using a logical operation on an array, such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mask = R &amp;lt; radius;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(where 'R', and therefore 'mask', are 2D arrays and 'radius' is a float). Such a mask has values of 0 or 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can then integrate the pixels that are comprised within the boundaries of my area by summing the masked image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;integrated_signal = sum(sum(mask.*image));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(where 'image' is the output of the CCD sensor, a 2D array with U16 values for instance).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, mathematically speaking, nothing would prevent me from defining a continuous-valued mask, that is, a mask whose pixels could take any value between 0 and 1. Physically, this means that I could integrate portions of pixels. I could even compute such a mask using an anti-aliasing algorithm in order to create better approximations of non-square-friendly shapes such as circles (for integrating a signal with revolution symmetry, let's say).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question to digital imaging geeks is the following: Is it standard practice to define such anti-aliased mask for integration purposes of imaging sensors ? Is it useful (as I suspect), or does it produce physically irrelevant results ?&lt;/p&gt;&#xA;" OwnerUserId="871" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-01-28T17:45:37.397" Title="Anti-aliased boolean masks for integration of CCD images" Tags="|image-processing|matlab|octave|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1254" PostTypeId="1" AcceptedAnswerId="1412" CreationDate="2012-01-27T15:02:20.500" Score="8" ViewCount="2762" Body="&lt;p&gt;Does anyone know of any image compression techniques with the following characteristics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;lossless&lt;/li&gt;&#xA;&lt;li&gt;streaming - I want to compress on the fly, pixel-by-pixel.&lt;/li&gt;&#xA;&lt;li&gt;low-memory overhead - I can afford to buffer a single line, but ideally not even that.&lt;/li&gt;&#xA;&lt;li&gt;no dynamic dictionaries&lt;/li&gt;&#xA;&lt;li&gt;&quot;real-world&quot; images only, so performance on &quot;nasty cases&quot; like chequerboards is not important&lt;/li&gt;&#xA;&lt;li&gt;2-3x compression (5x-10x would be even better, but that's asking a lot I know)&lt;/li&gt;&#xA;&lt;li&gt;can operate on 10-16 bit pixels (depending on my camera)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My images will be ~1k pixels wide, with pixel rates of ~20Mpix/sec.  The pixel depth will be something between 10 and 16 bits per pixel (depending on the choice of camera). Assume sub-16-bit pixel widths would be represented within a 16-bit word for now, rather than needing to be extracted from a continuous bit-stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some form of delta+arithmetic coding perhaps?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="440" LastEditDate="2012-04-12T09:32:16.030" LastActivityDate="2014-05-22T15:32:51.763" Title="Simple, streaming, lossless image compression" Tags="|image-processing|image-compression|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1255" PostTypeId="2" ParentId="1228" CreationDate="2012-01-27T15:05:45.737" Score="2" Body="&lt;p&gt;Generally, for non-linear systems the aren't any tools that are guaranteed to work. You need to know &lt;em&gt;something&lt;/em&gt; about the nature of the box. If you can model it with a system with unknown parameters, &quot;learning&quot; by observing input-output relationships can help you estimate those parameters, but I doubt that you can blindly &quot;learn&quot; the system model, especially if it has memory/states. Having said that, a more or less generic method of estimating nonlinear systems up to a polynomial degree is using &lt;a href=&quot;http://en.wikipedia.org/wiki/Volterra_series&quot; rel=&quot;nofollow&quot;&gt;Volterra kernels&lt;/a&gt; with some sort of &lt;a href=&quot;http://en.wikipedia.org/wiki/Gradient_descent&quot; rel=&quot;nofollow&quot;&gt;gradient descent&lt;/a&gt; method for recursive &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthogonality_principle&quot; rel=&quot;nofollow&quot;&gt;error minimization&lt;/a&gt;. Methods like &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_mean_squares_filter&quot; rel=&quot;nofollow&quot;&gt;LMS&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Recursive_least_squares&quot; rel=&quot;nofollow&quot;&gt;RLS&lt;/a&gt; are widely used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Volterra kernels help you estimate a system of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = k_0 + \sum_{n=1}^{\infty} \int_{-\infty}^{\infty}\cdots \int_{-\infty}^{\infty}k_n(t_1,t_2,\ldots,t_n)x(t-t_1)x(t-t_2)\cdots x(t-t_n)dt_1dt_2\cdots dt_n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to look at the following system is to notice its similarity to &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;convolution&lt;/a&gt; with addition of non-linear terms in $x$. Note, however, that if non-linearity of your system cannot be modeled with a polynomial (exponential, logarithmic and many other functions) this will require infinity complexity to estimate your system correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There aren't many papers on the topic available online for free, but you can look at &lt;a href=&quot;http://www.eusipco2009.org/papers/1569191518.pdf&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt; and &lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=volterra%20lms%20chaos&amp;amp;source=web&amp;amp;cd=10&amp;amp;ved=0CGUQFjAJ&amp;amp;url=http://www.researchgate.net/profile/Mostafa_Eghtedari/publication/4145595_Adaptive_Hammerstein_filters_for_nonlinear_and_nonminimum_phase_active_noise_control_systems?jtp=false&amp;amp;ei=MLsiT5iLAoKltwefvK2jCw&amp;amp;usg=AFQjCNHHST4nq74xPAIWTggKWZEkZXaDHQ&amp;amp;sig2=WFd1xXaS6ahiTStgJLyTKA&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt; to get an idea of what this is all about.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-01-27T15:05:45.737" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1256" PostTypeId="1" AcceptedAnswerId="1271" CreationDate="2012-01-27T16:06:08.430" Score="8" ViewCount="1325" Body="&lt;p&gt;In our unmanned aerial vehicle grayscale video image stabilization application, we're having difficulty finding the &quot;good&quot; Harris corners in frame N+1 selected from frame N. The source of the difficulty appears to be radical nonuniform pixel contrast changes between frames. Perhaps being airborne and using a slow frame rate (~3 fps) is the root cause of the pixel contrast shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've tried various histogram equalization techniques to try to smooth out the pixel contrasts between frames in order to improve tracking &quot;good&quot; Harris corners in frame N+1. Results continue to be poor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any suggestions on how to improve Harris corner tracking between video frames in a slow frame rate daytime aerial environment? Thank you kindly in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: 30 Jan 2012, added test case (not actual frame size) images&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summary Update: 8 Feb 2012. People suggest Harris corners are not so useful in grayscale video feature tracking. Answers below suggest and provide links to various alternatives. We are evaluating these alternatives and I will report results when we get to that point. Thank you, all, for your comments and answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the previous frame N with 35 &quot;good&quot; 5x5 harris corners selected. The original frame is 8 bpp raw pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Et8M.jpg&quot; alt=&quot;previous frame N&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an excellent 5x5 Harris corner located at row 59 col 266:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4SGEI.png&quot; alt=&quot;previous 5x5 at r59 c266&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current frame N+1 with a few tracked 5x5 Harris corners, only one of which is valid:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r1pbd.jpg&quot; alt=&quot;current frame N+1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The previous frame 5x5 Harris corner appearing in frame N+1 at r47 c145:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sDuS0.png&quot; alt=&quot;previous 5x5 at current 5x5 r47 c145&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note how the pixel intensities in the selected 5x5 have all changed in a nonuniform manner from the previous frame to the current frame. Contrast equalization techniques between frames do not help in detecting previous frame selected 5x5 pixels in the current frame. All suggestions welcome. &lt;/p&gt;&#xA;" OwnerUserId="739" LastEditorUserId="739" LastEditDate="2012-02-08T22:02:53.907" LastActivityDate="2013-10-22T18:34:15.287" Title="Preprocessing to improve Harris corner tracking between video frames?" Tags="|image-processing|preprocessing|local-features|tracking|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1257" PostTypeId="2" ParentId="1240" CreationDate="2012-01-27T18:10:04.073" Score="2" Body="&lt;p&gt;If both signals are audio signals from the same source (just different paths to get there) you can do &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the envelope (various methods for that, depends on the signals and the accuracy you want)&lt;/li&gt;&#xA;&lt;li&gt;Down sample&lt;/li&gt;&#xA;&lt;li&gt;Do a running cross correlation (at the down sampled rate)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-01-27T18:10:04.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1259" PostTypeId="1" CreationDate="2012-01-28T09:40:49.777" Score="14" ViewCount="2614" Body="&lt;p&gt;I am building an optical OOK (On off Key Ring) system without a carrier frequency. [However I have a guard time in between symbols, so a consecutive &quot;1&quot; messages will result in a pulse train as opposed to DC, see image].  Essentially, the presence of signal indicates one and lack of it indicates zero. I have a precise clock that is syncs the receiver with transmitter. The system operates with a low SNR and I like to improve SNR using DSP techniques. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few questions: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do selective sampling in my hardware, in other words, I do not continuously sample the channel but only sample when the probability of seeing the signal is maximum (i.e. this is a light pulse, I time the ADC such that ADC samples at the end of the pulse where I know the whole analog chain is stabilized). See image. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/Nxhr6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naturally, this drawing doesn't show the noise but it is there. This is particularly a  low signal system and primary noise sources are shot noise, johnson noise and amplifiers internal noise. (optical system so there are no other interferer except Sun). My observation of noise indicates, it is similar in all frequencies. (At least what I see in Scope)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now use a simple threshold comparison in software to determine if the data is one or zero.  Is there a better way? I have thought of some options but I like to hear from the experts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have considered the following options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Do continuous ADC and try to integrate during rise time:Not entirely&#xA;sure on the benefit (There may be other benefits, I don't know). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Matched filter in software: Don't really understand the math but&#xA;based on what I read, a possibility&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sample during the guard time and subtract this from the signal ADC&#xA;value (This may    provide some further details but also not so sure,&#xA;guard time would be the noise measurement)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Change hardware to a synchronous decoder, costly, time consuming and&#xA;may not work well    since my data rate is fast and getting a&#xA;synchronous demodulator would mean expensive board since I have to&#xA;built a multi-MHz carrier frequency system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="222" LastEditorUserId="222" LastEditDate="2012-01-30T16:43:56.977" LastActivityDate="2012-02-01T05:09:00.773" Title="Improving SNR using DSP techniques" Tags="|demodulation|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1260" PostTypeId="1" CreationDate="2012-01-28T17:18:57.823" Score="6" ViewCount="555" Body="&lt;p&gt;I am aware of image-independent basis, i.e. DCT, and image-dependent basis, i.e. Karhunen–Loève, which are used in compacting energies for image compression. These bases are orthorgonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any compression basis which are non-orthogonal that delivers better compaction than the optimal KL transformation? They can either be independent or dependent upon the statistics of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I have forgotten to mention that I am looking at block-based transformation coding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motivation of the question is due to the following paper &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.76.7073&quot;&gt;Optimized Nonorthogonal Transforms for Image Compression&lt;/a&gt;. The premise of this paper is that the block based Karhunen–Loève transformation yields compacted coefficients, but the coefficients are still correlated across different blocks as it is often the case where adjacent blocks of a natural image are correlated to one another. To eliminate correlation across blocks, the optimal transformation would involve the use of non-orthogonal basis.&lt;/p&gt;&#xA;" OwnerUserId="803" LastEditorUserId="803" LastEditDate="2012-01-30T04:08:22.647" LastActivityDate="2012-01-30T04:08:22.647" Title="Non-orthogonal basis which offers better energy compaction in image compression" Tags="|image-processing|video-processing|dct|compression|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1261" PostTypeId="2" ParentId="1252" CreationDate="2012-01-28T17:45:37.397" Score="4" Body="&lt;p&gt;You're right: mathematically speaking, nothing would prevent you from defining a grayscale mask. Practically, it is not a good approximation of what is going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A mask value of 0.5 means that you'd count half the pixel value to your signal. First of all, this will require you to exactly estimate and subtract the camera offset, b/c adding half the offset is going to screw up your result. More importantly, this assumes that half of the signal value on your pixel must have come from somewhere else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are three sources for where your other 0.5 of the signal may have come from:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If the source whose signal you're integrating is isolated, &lt;em&gt;all&lt;/em&gt; the signal on that edge pixel will have come from your source of interest. So multiplying that by 0.5 is wrong.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If there is a second source that also might contribute to the pixel, the proper ratio for dividing up the signal depends on the relative strengths of each signal, and on the relative positions of the center. While a grayscale mask makes sense here, you have to calculate it iteratively, since it depends on the signal integral.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If there is noise on the sensor, you'd be claiming that the other 0.5 is noise. That's most likely wrong as well - you want to add the full noise to your signal so it averages out properly (that can be a bit of an issue with #2).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is why I have never encountered grayscale masks except for case #2. In addition to being a bad approximation to reality, grayscale masks are less convenient to handle. With logical masks, you can, for example, conveniently write&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;integrated_signal = sum(image(mask));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="59" LastActivityDate="2012-01-28T17:45:37.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1262" PostTypeId="1" CreationDate="2012-01-28T19:23:55.227" Score="11" ViewCount="5801" Body="&lt;p&gt;I've been trying to work out the logic for this task, and plan to use the KissFFT source package to perform the fast fourier transform.  Please let me know if this looks about right:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Allocate an FFT structure, ie. &lt;code&gt;kiss_fft_alloc(N,0,NULL,NULL)&lt;/code&gt;&#xA;Where &lt;code&gt;N&lt;/code&gt; is the window size I'm using.  The input buffer will be an array of &lt;code&gt;N&lt;/code&gt; elements of type &lt;code&gt;kiss_fft_scalar&lt;/code&gt;.  The output buffer will be an array of &lt;code&gt;N/2 + 1&lt;/code&gt; elements of type &lt;code&gt;kiss_fft_cpx&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Decode &lt;code&gt;N&lt;/code&gt; (window size) number of PCM samples.&lt;/li&gt;&#xA;&lt;li&gt;For each PCM sample, average each channel's amplitude (unsigned samples) and scale from 0 to 2 (divide by 65536.0), storing the result into the input buffer.&lt;/li&gt;&#xA;&lt;li&gt;Perform windowing (ie. Hanning) on the input buffer.&lt;/li&gt;&#xA;&lt;li&gt;Perform fast fourier transform on the input buffer, storing into the output buffer.  Since I am using real values as input, I can use &lt;code&gt;kiss_fftr()&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For the &lt;code&gt;N/2&lt;/code&gt; output values, obtain the squared magnitude of the transformed data and convert the values to the dB scale with the following formula:&#xA;&lt;code&gt;10 * log10 (re * re + im * im)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Plot the &lt;code&gt;N/2&lt;/code&gt; values from step 6.&lt;/li&gt;&#xA;&lt;li&gt;Discard the first half of the input buffer, decoding the next (window size / 2) PCM samples and performing scaling and windowing to the data.  This should effectively slide the input window and avoid having to redo math on processed PCM samples.&lt;/li&gt;&#xA;&lt;li&gt;Loop to step 5, repeating these steps until all samples are processed.&lt;/li&gt;&#xA;&lt;li&gt;Free the used memory from &lt;code&gt;kiss_fft_alloc()&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It was suggested that I subtract a value from the input window before I perform the FFT, so that the resulting DC value has a magnitude of zero.  Should I be subtracting the mean or the average from the input data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what are the things I need to consider when I choose a window size?  Besides that it has to be an even number as per KissFFT's instructions, is there a benefit to using a small window size, ie. will it provide for a better graph?  I assume that a large window size reduces the number of FFTs that must be performed, is that the only benefit to using a large window size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, when I get to the point that the data is ready to plot, how do I go about plotting it?  When I worked on some waveform graph logic in the past, I just plotted 3 values for each pixel along the $x$-axis (min amplitude, max amplitude, RMS amplitude), but I don't know what I'm supposed to do with spectrogram data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for any and all guidance you can provide.&lt;/p&gt;&#xA;" OwnerUserId="875" LastEditorUserId="1629" LastEditDate="2014-11-03T10:26:03.457" LastActivityDate="2014-11-03T10:26:03.457" Title="Creating a spectrogram" Tags="|fft|audio|frequency-spectrum|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1263" PostTypeId="2" ParentId="1260" CreationDate="2012-01-28T22:33:44.510" Score="8" Body="&lt;p&gt;Given a signal $x(t)$ of energy $\mathcal E$, suppose that $x(t)$&#xA;can be expressed as $\sum_i x_i\psi_i(t)$. If the $\psi_i(t)$ are a&#xA;complete set of &lt;em&gt;orthonormal&lt;/em&gt; signals, then &#xA;$$\sum_i |x_i|^2 =\mathcal E$$&#xA;and one measure of energy compaction is the number of $x_i$ whose&#xA;squared magnitude is larger than some fraction of $\mathcal E$,&#xA;say $0.01\mathcal E$.  Another could be the smallest number of &#xA;$x_i$ such that $\sum_i |x_i|^2$ captures $99\%$, say, of the energy.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Some sets of orthonormal signals can&#xA;be much better for representing a specific $x(t)$ than other sets of orthonormal&#xA;signals. For example, sinusoids and complex exponentials are commonly&#xA;used to represent periodic signals, and do a good job with respect to&#xA;energy compaction when used with low pass or bandpass signals.  But they&#xA;require infinitely many components to represent signals such as&#xA;sawtooth waves that can be represented using just one or two coefficients&#xA;using orthonormal Legendre polynomials.&#xA;So why are generations of electrical engineering students forced to&#xA;calculate Fourier series of sawtooth waves at all?  Well, Fourier&#xA;series simplify life&#xA;in other calculations such as what happens when the signal passes through&#xA;a linear time-invariant system while Legendre polynomials do not&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If signal-dependent orthonormal bases are allowed, then if we start &#xA;a Gram-Schmidt orthonormalization procedure beginning &#xA;with taking $\psi_1(t)$ to be the unit energy signal&#xA;$x(t)/\sqrt{\mathcal E}$ as the first member of a&#xA;set of orthonormal signals, then this orthonormal set can be used to represent $x(t)$ with&#xA;$x_1 = \sqrt{\mathcal E}, x_i = 0, i &amp;gt; 1$ for maximal compaction!  In fact,&#xA;we don't even need to bother to find $\psi_i(t)$ for $i &amp;gt; 1$.&#xA;So, how much compaction can be achieved with signal-dependent&#xA;bases depends on the degree of dependence allowed between the&#xA;signal and the basis to be used, etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The representation of $x(t)$ with respect to a set of non-orthonormal signals&#xA;is more complicated to determine.  With orthonormal signals, the coefficient&#xA;$x_i$ of $\psi(t)$ is easily determined since&#xA;$$\langle x(t), \psi_i(t)\rangle = \langle \sum_k x_k\psi_k(t), \psi_i(t)\rangle&#xD;&#xA;= \sum_k x_k \langle \psi_k(t), \psi_i(t)\rangle = x_i,$$&#xA;since &#xA;$$ \langle \psi_k(t), \psi_i(t)\rangle =&#xD;&#xA;\begin{cases}1, &amp;amp; \text{if}~k = i,\\0,  &amp;amp; \text{if}~k \neq i.,\end{cases}$$&#xA;while the simplification obtained via the orthonormality is not available&#xA;for non-orthonormal signals.  The question of how many of the $x_i$ are&#xA;needed to capture most of the energy is also difficult to determine&#xA;since the energy is &lt;em&gt;not&lt;/em&gt; $\sum_i |x_i|^2$; it is necessary to take&#xA;the cross-products $x_ix_k$ into account as well.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, unless there are specific&#xA;reasons why a particular non-orthonormal basis is important to use&#xA;(e.g. it helps with things one needs to do in image processing&#xA;or video processing or audio processing etc), simply using such a &#xA;basis because it provides better energy compaction might well be putting the cart&#xA;before the horse.  But, as always, your mileage may vary, and there may&#xA;be non-orthonormal signal bases that not only achieve better energy&#xA;compaction but also ease your life in other aspects.  It is just that&#xA;it is doubtful that a general theory exists saying that non-orthonormal&#xA;bases achieve better energy compaction than orthonormal bases.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-01-29T17:02:30.317" LastActivityDate="2012-01-29T17:02:30.317" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1264" PostTypeId="2" ParentId="1262" CreationDate="2012-01-29T06:13:17.233" Score="9" Body="&lt;p&gt;Looks pretty good to me. In step 3, though, you actually want to scale the signal from -1 to 1, otherwise you're adding DC. You mentioned subtracting the mean -- I would not recommend doing this for a spectrogram, since that's effectively filtering out DC, which the spectrogram ought to show if it's there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Choosing a window size is all about tradeoffs. A larger window will give you sharper frequency  resolution, but blurrier time resolution. A shorter window will give you the opposite: sharper time resolution but blurrier frequency resolution. The appropriate choice of window size will depend on the data you are trying to analyze. Typically it will be a power of 2 just because FFTs tend to like powers of 2. A decent rule of thumb is that your window should be at least roughly twice as long as the period of the lowest frequency you would like to be able to accurately resolve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might wonder if it is possible to better deal with this tradeoff, and there are techniques for that: they generally involve computing spectrograms with several different FFT sizes at once, and combining them. There's some good visual information on this webpage: &lt;a href=&quot;http://www.izotope.com/tech/aes_adapt/&quot;&gt;http://www.izotope.com/tech/aes_adapt/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your window size is too small, two very close frequencies might be indistinguishable from each other since they both end up in the same FFT bin. If your window size is too large, two  close events in time, might be combined, or a sharp transient might turn into a gradual attack. Check out that webpage I posted for some ways to visualize this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A larger window size doesn't necessarily reduce the number of FFTs. You have chosen to compute a spectrogram using a short-time Fourier transform where there is an overlap of half the FFT size. You could use a higher overlap factor if you wanted. Choosing a window size is much more a matter of making the time/frequency tradeoff than how many FFTs you have to compute. In designing a spectrogram (or any STFT), you can think of choosing your window size, and &lt;em&gt;hop size&lt;/em&gt;, the distance between blocks, as independent parameters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you plot it, time is typically on the x-axis, frequency is on the y-axis (usually a log scale, Mel scale, etc, rather than a linear scale), and then the magnitudes are represented with color intensity, i.e. very dark colors correspond to small magnitudes and very bright colors correspond to large magnitudes.&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2012-01-29T06:13:17.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1265" PostTypeId="2" ParentId="1243" CreationDate="2012-01-29T17:10:27.077" Score="12" Body="&lt;p&gt;We can try a very short introduction:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Every filter represents a Linear Time Invariant System (LTI)&lt;/li&gt;&#xA;&lt;li&gt;Every Linear Time Invariant System can be completely described by it's transfer function or it's impulse response. The two can be converted into each other by the Fourier Transform&lt;/li&gt;&#xA;&lt;li&gt;Filter coefficients are derived from impulse response or transfer function&lt;/li&gt;&#xA;&lt;li&gt;The exact nature of the filter coefficients depends on the algorithm (there are quite a few of those)&lt;/li&gt;&#xA;&lt;li&gt;In the case of the simplest algorithm, the direct convolution FIR (Finite Impulse Response) filter, the filter coefficients are simply the impulse response of the LTI system.&lt;/li&gt;&#xA;&lt;li&gt;In most other algorithms the relationship is much more complicated and text book study is indeed required.&lt;/li&gt;&#xA;&lt;li&gt;The whole subject of LTI systems, transfer functions, Fourier Transforms, amplitude responses, phase responses etc. is probably another text book worth of stuff&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-01-29T17:10:27.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1269" PostTypeId="2" ParentId="1243" CreationDate="2012-01-30T14:58:08.277" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;&quot;The Scientist &amp;amp; Engineer's Guide To DSP&quot;&lt;/a&gt; is an exceptional(imo) introductory read. It gives you all the concepts without overwhelming a beginner with all the math.&lt;/p&gt;&#xA;" OwnerUserId="884" LastEditorUserId="76" LastEditDate="2012-02-01T01:34:40.027" LastActivityDate="2012-02-01T01:34:40.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1271" PostTypeId="2" ParentId="1256" CreationDate="2012-01-30T16:43:19.983" Score="9" Body="&lt;p&gt;Can you try a different feature detector? &lt;a href=&quot;http://www.edwardrosten.com/work/fast.html&quot;&gt;FAST&lt;/a&gt; may be, erm, faster, and a higher frame rate will make matching easier (assuming your features are moving a lot between frames)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Looks like you are trying to use the grayscale region around the identified feature point to match from frame to frame.  This &lt;em&gt;is&lt;/em&gt; likely to be poor, especially if there is lots of movement between frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may get better performance by using what is often called a &quot;descriptor&quot; of the region around the feature point on which to match.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some possible descriptors are used within the &lt;a href=&quot;http://en.wikipedia.org/wiki/SURF&quot;&gt;SURF&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot;&gt;SIFT&lt;/a&gt; algorithms - they &lt;em&gt;also&lt;/em&gt; have techniques for identifying regions to track, but you've bypassed the requirement for that.  A simpler descriptor designed for use in stereo-vision matching is the &lt;a href=&quot;http://www.tyzx.com/PDFs/census.pdf&quot;&gt;Census transform&lt;/a&gt; although that may not work as well for matching from frame to frame, for much the same reason as your current method (which is also widely deployed in stereo-vision)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book to read on this is &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot;&gt;Multiple View Geometry in Computer Vision&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2012-01-31T13:05:25.217" LastActivityDate="2012-01-31T13:05:25.217" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1272" PostTypeId="1" AcceptedAnswerId="1274" CreationDate="2012-01-30T03:22:05.687" Score="14" ViewCount="948" Body="&lt;p&gt;How can I change the formula to detect the barcode in every angle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kJuCa.png&quot; alt=&quot;Formula&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lOqjJ.png&quot; alt=&quot;Original Image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BnPlp.png&quot; alt=&quot;Processed Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; rgb = imread('barcode4.jpg');&#xA;% Resize Image&#xA;rgb = imresize(rgb,0.33);&#xA;figure(),imshow(rgb);&#xA;% Convert from RGB to Gray&#xA;Igray = double(rgb2gray(rgb));&#xA;% Calculate the Gradients&#xA;[dIx, dIy] = gradient(Igray);&#xA;B = abs(dIx) - abs(dIy);&#xA;% Low-Pass Filtering&#xA;H = fspecial('gaussian', 20, 10);&#xA;C = imfilter(B, H);&#xA;C = imclearborder(C);&#xA;figure(),imagesc(C);colorbar&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="889" OwnerDisplayName="Kim" LastEditorUserId="889" LastEditDate="2012-01-31T09:16:05.043" LastActivityDate="2013-07-05T19:20:30.013" Title="How can I change the formula to detect the barcode in every angle? - MATLAB" Tags="|matlab|computer-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1273" PostTypeId="2" ParentId="1272" CreationDate="2012-01-30T10:18:08.267" Score="7" Body="&lt;p&gt;Your equation highlights areas where the magnitude of the gradient in the X direction is consistently higher than it is in the Y direction. To make this work in all directions, then you probably want areas where the magnitude of the gradient in any direction is high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B = double(sqrt(dIx.^2 + dIy.^2) &amp;gt; 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not that this will basically highlight every edge, but the low-pass filter will mean that you need multiple edges close together.&lt;/p&gt;&#xA;" OwnerUserId="142" OwnerDisplayName="Nzbuu" LastEditorUserId="142" LastEditDate="2012-01-30T19:21:43.357" LastActivityDate="2012-01-30T19:21:43.357" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1274" PostTypeId="2" ParentId="1272" CreationDate="2012-01-30T12:47:42.683" Score="8" Body="&lt;p&gt;If the filter you have works well enough for you, you could simply use &lt;code&gt;imrotate&lt;/code&gt; to create several rotated versions of the source image, and use the filter you have on each of them (make sure to use &lt;code&gt;bilinear&lt;/code&gt; to get sensible derivatives)&lt;/p&gt;&#xA;" OwnerUserId="291" OwnerDisplayName="nikie" LastActivityDate="2012-01-30T12:47:42.683" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1275" PostTypeId="2" ParentId="1259" CreationDate="2012-01-30T19:12:50.667" Score="9" Body="&lt;p&gt;Since you indicated that the power spectrum of your background noise is flat, I'll assume it is &lt;a href=&quot;http://en.wikipedia.org/wiki/White_noise&quot;&gt;white&lt;/a&gt;. A major drawback with your current approach is that you are discarding a large amount of the signal power; even with the effect of front-end bandlimiting shown by in your diagram by the exponential-rise step response, a single ADC sample near the end of the rounded pulse provides a snapshot of the receiver input that is rather localized in time. You can take advantage of more of the signal power by sampling at a higher rate and applying a &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot;&gt;matched filter&lt;/a&gt; at the higher sample rate.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Theory:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You can look at this as a relatively simple problem in &lt;a href=&quot;http://en.wikipedia.org/wiki/Detection_theory&quot;&gt;detection theory&lt;/a&gt;. In each symbol interval, your receiver needs to decide between two hypotheses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{eqnarray*}&#xD;&#xA;H_0 &amp;amp;:&amp;amp; signal \ is \ not \ present \\&#xD;&#xA;H_1 &amp;amp;:&amp;amp; signal \ is \ present&#xD;&#xA;\end{eqnarray*}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sort of problem is often solved using &lt;a href=&quot;http://en.wikipedia.org/wiki/Bayesian_decision_theory&quot;&gt;Bayesian decision rules&lt;/a&gt;, which attempt to make the optimum decision according to some specified measure of risk. This provides a framework where one can optimally make detection decisions based on a flexible set of criteria. For example, if there is a large penalty to your system for failing to detect the signal if it is in fact present (i.e. you pick $H_0$ when $H_1$ is true), then you can build that into your decision rule if needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a detection problem such as yours, where you're trying to decide between zeros and ones at the receiver output, the penalty is typically assumed to be equal (outputting a zero when a one was transmitted, and vice versa, &quot;hurt equally&quot;). The Bayesian approach in that case reduces to a &lt;a href=&quot;http://en.wikipedia.org/wiki/Maximum_likelihood&quot;&gt;maximum-likelihood&lt;/a&gt; estimator (also described &lt;a href=&quot;http://www.ipam.ucla.edu/publications/gss2007/gss2007_7200.pdf&quot;&gt;here&lt;/a&gt;): you pick the hypothesis that is most likely, given the observation that your receiver makes. That is, if the quantity that your receiver observes is $x$, then it would generate a decision based on the hypothesis that has the largest &lt;a href=&quot;http://en.wikipedia.org/wiki/Likelihood_function&quot;&gt;likelihood function&lt;/a&gt; value. For the binary decision case, the likelihood ratio can be used instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\Lambda(x) = \frac{P(x\ |\ H_0 \ is \ true)}{P(x\ |\ H_1 \ is \ true)} = \frac{P(x\ |\ signal \ is \ not \ present)}{P(x\ |\ signal \ is \ present)}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the above model, for each observation of the channel $x$, the optimal receiver would decide that the signal was not present (therefore outputting a zero) if the likelihood ratio $\Lambda(x)$ is greater than one (and therefore the signal was most likely to be not present based on the observation), and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What remains is a model for the signal of interest and any other components in the receiver detection statistic $x$ that could affect its decisions. For a digital communications like this, it might be modeled as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{eqnarray*}&#xD;&#xA;H_0 &amp;amp;:&amp;amp; x = N \\&#xD;&#xA;H_1 &amp;amp;:&amp;amp; x = s + N&#xD;&#xA;\end{eqnarray*}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n$ is a random variable taken from some distribution (often assumed to be zero-mean Gaussian) and $s$ is a deterministic component of the observation that is due to the signal that you're looking for. The distribution of the receiver observable $x$, therefore, varies depending upon whether hypothesis $H_0$ or $H_1$ is true. In order to evaluate the likelihood ratio, you need a model for what those distributions are. For the Gaussian case referenced above, the mathematics look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\Lambda(x) = \frac{P(x\ |\ H_0 \ is \ true)}{P(x\ |\ H_1 \ is \ true)} = \frac{P(x\ |\ x = N)}{P(x\ |\ x = s + N)}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\Lambda(x) = \frac{P(x\ |\ H_0 \ is \ true)}{P(x\ |\ H_1 \ is \ true)} = \frac{e^{\frac{-x^2}{2 \sigma^2}}}{e^{\frac{-(x - s)^2}{2 \sigma^2}}}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\sigma^2$ is the variance of the Gaussian noise term. Note that the additive signal component only has the function of shifting the mean of the resulting Gaussian distribution of $x$. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Likelihood_function#Log-likelihood&quot;&gt;log-likelihood ratio&lt;/a&gt; can be used to get rid of the exponentials:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\ln(\Lambda(x)) = \ln\left(\frac{e^{\frac{-x^2}{2 \sigma^2}}}{e^{\frac{-(x - s)^2}{2 \sigma^2}}}\right) = \left(\frac{-x^2}{2 \sigma^2}\right) - \left(\frac{-(x - s)^2}{2 \sigma^2}\right)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that our decision rule picked $H_0$ if the likelihood ratio was greater than one. The equivalent log-likelihood decision rule is to pick $H_0$ if the log-likelihood is greater than zero. Some algebra shows that the decision rule reduces to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{eqnarray*}&#xD;&#xA;x &amp;lt; \frac{s}{2} \rightarrow choose\ H_0 \\&#xD;&#xA;x &amp;gt; \frac{s}{2} \rightarrow choose\ H_1&#xD;&#xA;\end{eqnarray*}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if $x = \frac{s}{2}$, then both hypotheses are equally likely, and you would need to just pick one; this isn't a practical concern for continuously-valued signals, however. So, given a known signal amplitude $s$, we can detect its presence against a background of Gaussian noise optimally by setting a threshold $T = \frac{s}{2}$; if the observed value $x$ is greater than $T$, we declare the signal present and emit a one, and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Practice:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There are a few practical issues that creep into this simple, toy theoretical example. One: just mapping the scenario that you described into a deceptively simple-looking model might not seem straightforward. Secondly, it's very rare that you would know the amplitude $s$ of the signal that you're looking for, so threshold selection requires some thought.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I referenced before, noise is often assumed to be Gaussian because the normal distribution is so easy to work with: the sum of a bunch of independent Gaussians is still Gaussian, and their mean and variances just add also. Also, the first- and second-order statistics of the distribution are enough to completely characterize them (given the mean and variance of a Gaussian distribution, you can write its &lt;a href=&quot;http://en.wikipedia.org/wiki/Probability_density_function&quot;&gt;pdf&lt;/a&gt;). So, hopefully that's a decent approximation at least for your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways to improve the performance of the detector given the model described above: you can increase $s$ (i.e. increase the signal power), making it stand out more against the noise. You could decrease $N$ (i.e. reduce the amount of noise), reducing the amount of interference that makes the presence of $s$ unclear. Or, equivalently, you can think of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Signal-to-noise_ratio&quot;&gt;signal to noise ratio&lt;/a&gt; instead. To see its importance, let's go back to the theory for a second. What is the probability of a bit error given our decision rule?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{eqnarray*}&#xD;&#xA;P_e &amp;amp;=&amp;amp; P(choose \ H_0 \ |\ H_1\ true) P(H_1\ true) + P(choose \ H_1 \ |\ H_0\ true) P(H_0\ true) \\&#xD;&#xA;&amp;amp;=&amp;amp; \frac{1}{2} P(x &amp;lt; \frac{s}{2} \ |\ x = s + N) + \frac{1}{2} P(x &amp;gt; \frac{s}{2} \ |\ x = N) \\&#xD;&#xA;&amp;amp;=&amp;amp; \frac{1}{2} F_{x\ |\ x = s + N}\left(\frac{s}{2}\right) + \frac{1}{2} \left(1 - F_{x\ |\ x = N}\left(\frac{s}{2}\right)\right)&#xD;&#xA;\end{eqnarray*}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $F_{x\ |\ x = s + N}(z)$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cumulative_distribution_function&quot;&gt;cumulative distribution function&lt;/a&gt; of the distribution of the observation $x$, given that $x = s + N$ (and likewise for the other function). Substituting in the cdf for the Gaussian distribution, we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{eqnarray*}&#xD;&#xA;P_e &amp;amp;=&amp;amp; \frac{1}{2} \left(1 - Q\left(\frac{\frac{s}{2} - s}{\sigma}\right)\right) + \frac{1}{2}  Q\left(\frac{\frac{s}{2}}{\sigma}\right) \\&#xD;&#xA;&amp;amp;=&amp;amp; \frac{1}{2}  + \frac{1}{2} \left(-Q\left(\frac{\frac{s}{2} - s}{\sigma}\right) + Q\left(\frac{\frac{s}{2}}{\sigma}\right)\right) \\&#xD;&#xA;&amp;amp;=&amp;amp; \frac{1}{2} + \frac{1}{2} \left(-Q\left(\frac{-s}{2\sigma}\right) + Q\left(\frac{s}{2\sigma}\right)\right) \\&#xD;&#xA;&amp;amp;=&amp;amp; \frac{1}{2} + \frac{1}{2} \left(-Q\left(\frac{-SNR}{2}\right) + Q\left(\frac{SNR}{2}\right)\right) \\&#xD;&#xA;&amp;amp;=&amp;amp; Q\left(\frac{SNR}{2}\right)&#xD;&#xA;\end{eqnarray*}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Q(x)$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Q-function&quot;&gt;Q function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;Q(x) = \frac{1}{\sqrt{2 \pi}} \int_{x}^{\infty} e^{\frac{-z^2}{2}} dz&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i.e. the tail integral of the standard normal distribution's pdf, or $1$ minus the distribution's cdf) and $SNR$ is the signal-to-noise ratio $\frac{s}{\sigma}$. The above function is a strictly decreasing function of $SNR$; as you increase the ratio of the signal amplitude $s$ to the noise standard deviation $\sigma$, the probability of making a bit decision error decreases. So, it behooves you to do whatever you can to increase this ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember our assumption that the noise was white and Gaussian? That can help us now. If the noise is white and Gaussian, then the noise components contained in each observation are jointly independent of one another. An important property of independent random variables is that when you sum them together, their means and variances sum. So, let's consider another simple case, where instead of taking one sample per symbol interval, you take two, then sum them together. I'll assume for simplicity that the pulse shape is rectangular (not an exponential rise), so the signal component $s$ in each observation $x_1$ and $x_2$ is the same. What is the difference in signal to noise ratio between just a single observation $x_1$ and the sum of two independent ones?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;SNR_1 = \frac{s}{\sigma}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;SNR_2 = \frac{2s}{\sqrt{2 \sigma}} = \sqrt{2}SNR_1&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the signal to noise ratio in the combined observation is larger than using only a single sample (under the assumption of equal signal component and equal-variance white Gaussian noise in both samples that we took). This is a basic observation that points out the potential benefits of taking more than one sample per symbol interval and integrating them together (which, for a rectangular pulse, is a matched filter). In general, you want to cover the entire symbol interval with samples so that your receiver &quot;ingests&quot; as much of the transmitted energy for each symbol, thus maximizing the SNR in the combined output. The ratio of symbol energy to the background noise variance $\frac{E_s}{N_0}$ is often used as a figure of merit when evaluating digital communications system performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More rigorously, it can be shown that a matched filter has an impulse response that is identical in shape (that is, &quot;matched&quot;, with the only subtle exception being that the impulse response is reversed in time) to the pulse shape that the receiver sees (so it weights more strongly samples that have larger signal components). That shape is a function of the transmitted pulse shape as well as any effects induced by the channel or receiver front end, such as bandlimiting or &lt;a href=&quot;http://en.wikipedia.org/wiki/Multipath_propagation&quot;&gt;multipath&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement this sort of arrangement in practice, you would &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution#Discrete_convolution&quot;&gt;convolve&lt;/a&gt; the stream of samples taken by your ADC with the time-reversed expected pulse shape. This has the effect of calculating the cross-correlation between the pulse shape and the received signal for all possible time offsets. Your implementation is aided by the precise time synchronization that you have available, so you'll know exactly which matched filter output samples correspond to correct sampling instants. The filter outputs at those times are used as the detection statistic $x$ in the theoretical model above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I referred to threshold selection before, which can be a complicated topic, and there are many different ways that you can choose one, depending upon your system's structure. Selecting a threshold for an on-off-keyed system is complicated by the likely-unknown signal amplitude $s$; other signal constellations, like antipodal signaling (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/BPSK#Binary_phase-shift_keying_.28BPSK.29&quot;&gt;binary phase shift keying, or BPSK&lt;/a&gt;) have a more obvious threshold choice (for BPSK, the best threshold is zero for equally-likely data). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One simple implementation of a threshold selector for OOK might calculate the mean of many observations. Assuming that zeros and ones are equally likely, the expected value of the resulting random variable is half of the signal amplitude, which is the threshold that you seek. Performing this operation over a sliding window can allow you to be somewhat adaptive to varying background conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is only intended to be a high-level introduction to the issues inherent in digital communications with respect to detection theory. It can be a very complicated topic, with a lot of statistics involved; I tried to make it somewhat easy to understand while keeping true to the underlying theory. For a better explanation, go get a good textbook, like &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0130847887&quot;&gt;Sklar's&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-02-01T05:09:00.773" LastActivityDate="2012-02-01T05:09:00.773" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1277" PostTypeId="1" AcceptedAnswerId="1282" CreationDate="2012-01-30T19:33:42.147" Score="13" ViewCount="3525" Body="&lt;p&gt;Three questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What are all the metrics one can use to measure audio interpolation quality, objectively? (but also in terms of psychoacoustics if possible)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By those metrics, what is the current state of the art in audio interpolation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose I were to render two files from a sequence of notes from virtual instruments in two resolutions and then compare an upsampling of one file with the high-frequency rendered version, what software could one use to compare these objectively? - ideally using the before-mentioned metrics&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So far, from I've been able to gather, these resamplers provide some of the best quality&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mega-nerd.com/SRC/&quot; rel=&quot;nofollow&quot;&gt;http://www.mega-nerd.com/SRC/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sox.sourceforge.net/SoX/&quot; rel=&quot;nofollow&quot;&gt;http://sox.sourceforge.net/SoX/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.izotope.com/tech/src/&quot; rel=&quot;nofollow&quot;&gt;http://www.izotope.com/tech/src/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;One of the problems that these resamplers seem to have is pre- and post ringing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should note that of key interest is signal reconstruction (insofar as that term makes sense), so upsampling more than downsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Interpolation time efficiency is irrelevant in this context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards,&#xA;The curious :-)&lt;/p&gt;&#xA;" OwnerUserId="885" LastEditorUserId="1629" LastEditDate="2016-09-09T18:45:42.650" LastActivityDate="2016-09-09T18:45:42.650" Title="The current state of the art in audio signal interpolation" Tags="|audio|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1278" PostTypeId="2" ParentId="1259" CreationDate="2012-01-30T19:45:25.763" Score="0" Body="&lt;p&gt;One possible technique might be to try using periodic training sequences to gather statistics, not only to differentiate between the 1's and 0's, or to calculate a reliability metric for any given threshold, but to analyze how various bit sequences might affect an adaptive bit decision threshold.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-01-30T19:45:25.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1279" PostTypeId="2" ParentId="1249" CreationDate="2012-01-30T20:05:41.953" Score="3" Body="&lt;p&gt;If you are encoding the JPEG image, and know exactly which JPEG decoder or decoding algorithm will be used, any change in the pixel values can be determined.  Thus it might be possible to encode information in sufficiently spaced pixel values by using an iterative approach to modifying their value (which may involve modifying nearby pixels as well).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-01-30T20:05:41.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1280" PostTypeId="2" ParentId="1246" CreationDate="2012-01-30T20:12:35.093" Score="1" Body="&lt;p&gt;To start with, you might try a reconstruction of different object coordinates from each pair (or small subset) of photos.  Then, given a large enough set of reconstructions using different pairs or subsets, look at the statistical distribution and variance of all the different reconstructed coordinates.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-01-30T20:12:35.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1281" PostTypeId="1" CreationDate="2012-01-30T20:25:05.840" Score="3" ViewCount="306" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1403/when-convolving-two-functions-that-are-constants-in-a-region-and-0-everywhere-el&quot;&gt;When convolving two functions that are constants in a region and 0 everywhere else, where does the integration start?&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;I have a function $f(x,y)$ and $h(x,y)$.  $f(x,y)$ has a value of $\frac{1}{3}$ when $x$ is between $\frac{1}{3}$ and $\frac{5}{9}$, and $y$ is between $0$ and $1$.  The function has a value of $0$ everywhere else.  Meanwhile, $h(x,y)$ has a value of 1 when both $x$ and $y$ are between $-\frac{1}{19}$ and $\frac{1}{19}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These two functions are non-zero in completely disjoint regions.  Is there a way to leverage this property to simplify the convolution integral?&lt;/p&gt;&#xA;" OwnerUserId="887" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-03-05T07:09:08.343" Title="Is it possible to simplify the convolution integral if the functions are non-zero in disjoint areas?" Tags="|image-processing|continuous-signals|convolution|" AnswerCount="1" CommentCount="2" ClosedDate="2012-03-23T04:42:45.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="1282" PostTypeId="2" ParentId="1277" CreationDate="2012-01-30T20:38:02.823" Score="6" Body="&lt;p&gt;Regarding the &quot;problem&quot; you note with resamplers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many resampling algorithms use a linear-phase low-pass filter poly-phase interpolation kernel.  A minimum-phase filter interpolation kernel, as opposed to linear-phase interpolation kernel (with the same frequency response), would produce less pre-ringing during resampling to a higher sample rate, which may objectively measure as less accurate, but possibly psycho-acoustically sound &quot;better&quot; to humans.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a note on creating minimum phase filters for filtering with potentially less pre-ringing: &lt;a href=&quot;http://www.music.columbia.edu/pipermail/music-dsp/2004-February/059372.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.music.columbia.edu/pipermail/music-dsp/2004-February/059372.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, a Remez (Parks-McClellan) designed low-pass filter may have a clear periodic ripple in the frequency domain, which might also produce a pre-ring impulse in the time-domain.  So you might want to instead try a windowed Sinc, or a derivation of a classic analog filter, for the low-pass filter design (the latter usually resulting in something closer to minimum phase) for the resampling interpolation kernel.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-01-30T20:46:28.330" LastActivityDate="2012-01-30T20:46:28.330" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1283" PostTypeId="2" ParentId="1281" CreationDate="2012-01-30T22:08:48.920" Score="3" Body="&lt;p&gt;Link to the closed-form solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.wolframalpha.com/input/?i=Convolve[Piecewise[%7B%7B1%2F3%2C+1%2F3+%3C%3D+x+%3C%3D+5%2F9+%26%26+0+%3C%3D+y+%3C%3D+1%7D%7D]%2C+++Piecewise[%7B%7B1%2C+-1%2F19+%3C%3D+x+%3C%3D+1%2F19+%26%26+-1%2F19+%3C%3D+y+%3C%3D+1%2F19%7D%7D]%2C+%7Bx%2C++++y%7D%2C+%7Bu%2C+v%7D]&quot; rel=&quot;nofollow noreferrer&quot;&gt;wolframalpha&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D2hGn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From left to right: $f$, $h$, and $f*h$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0NtUW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="602" LastEditorUserId="180" LastEditDate="2012-03-05T07:09:08.343" LastActivityDate="2012-03-05T07:09:08.343" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1284" PostTypeId="2" ParentId="1256" CreationDate="2012-01-31T00:10:13.137" Score="1" Body="&lt;p&gt;If you're trying to align the two images, you should use a better local feature detector. SIFT is probably the most popular/successful one to use.&lt;/p&gt;&#xA;" OwnerUserId="878" LastActivityDate="2012-01-31T00:10:13.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1285" PostTypeId="2" ParentId="1277" CreationDate="2012-01-31T03:06:20.317" Score="6" Body="&lt;p&gt;There is this pretty thorough comparison of resampling algorithms: &lt;a href=&quot;http://src.infinitewave.ca/&quot;&gt;http://src.infinitewave.ca/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the tests they used there. Aliasing is a big one, and is easy to visualize with a spectrogram of a sine sweep. There's also high frequency response -- SRC can roll off high frequencies in addition to allowing them to cause aliasing. You can visualize phase response with the impulse response graph, or with a plot of the phase response.&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2012-01-31T03:06:20.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1286" PostTypeId="1" CreationDate="2012-01-31T05:56:09.070" Score="10" ViewCount="2700" Body="&lt;p&gt;I have the need to detect two different gestures that occur when looking at accelerometer data. Here's a run down (as brief as I can make it):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say an iPhone is being oscillated back and forth while remaining face-up. The  user can either do one oscillation (once forward or backward, gesture one) or a continuous oscillation for any amount of time (gesture two).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently my code maintains a list of the device's accelerometer data (y-axis) from the last 50 frames . Each frame this data is put through an FFT algorithm (this one &lt;a href=&quot;http://goo.gl/yi3mn&quot; rel=&quot;noreferrer&quot;&gt;http://goo.gl/yi3mn&lt;/a&gt;), and then I try to interpret the frequency domain given. I have noticed a strong relationship between the speed of the oscillations, and the power of the mid to low range of the frequency space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I need to detect (in real-time as the movement animates something on screen) whether the just finished oscillation is a singular one, or one that continues into another oscillation in the opposite direction. Here I should point out that accelerometers work with pressure plates. When an oscillation stops the input data will show the opposite value from when the oscillation was being performed. This makes it difficult to see any obvious difference between a single forwards movement and a double forwards then backwards movement (at the end of the each first oscillation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest how I might make use of an FFT to decipher an accurate magnitude value (or something else useful) that I can use to tell the difference between the gestures described above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have recorded the data I am using to text files. It is the raw data (g-force values) along the y-axis of the accelerometer input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://pastebin.ca/2108123&quot; rel=&quot;noreferrer&quot;&gt;http://pastebin.ca/2108123&lt;/a&gt; shows data for 2 singular oscillations (I hold the device still at the start, end, and between the two oscillations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9qbfH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NOTE: new raw data with 20 oscillations has been uploaded, but not yet plotted.&lt;/em&gt; &#xA;&lt;a href=&quot;http://pastebin.ca/2108387&quot; rel=&quot;noreferrer&quot;&gt;http://pastebin.ca/2108387&lt;/a&gt; shows data for 20 continuous oscillations (I hold the device still at the start and end). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N1Bw2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="890" LastEditorUserId="890" LastEditDate="2012-01-31T23:13:10.420" LastActivityDate="2012-02-01T16:51:35.670" Title="Can I use FFT to interpret accelerometer gestures?" Tags="|fft|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1287" PostTypeId="2" ParentId="1170" CreationDate="2012-01-31T10:26:47.750" Score="4" Body="&lt;p&gt;One can get the presence of an edge in a given DCT block. It is easier to compute the First order and second order moments from the given DCT coefficients. Variance in a small region is an approximation of the gradient at the center (x0,y0) of the block. The Variance in a block can be estimated from the DCT coefficients as summation of squares of the AC coefficients.&#xA;It might not be possible to know the exact coordinates in the block containing the edge.&lt;/p&gt;&#xA;" OwnerUserId="891" LastActivityDate="2012-01-31T10:26:47.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1288" PostTypeId="1" AcceptedAnswerId="1642" CreationDate="2012-01-31T13:40:26.297" Score="77" ViewCount="61103" Body="&lt;p&gt;As far as I understand, both SURF and SIFT are patent protected.&lt;br&gt;&#xA;Are there any alternative methods that can be used in a &lt;strong&gt;commercial&lt;/strong&gt; application freely?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info on the patent check out:&#xA;&lt;a href=&quot;http://opencv-users.1802565.n2.nabble.com/SURF-protected-by-patent-td3458734.html&quot;&gt;http://opencv-users.1802565.n2.nabble.com/SURF-protected-by-patent-td3458734.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="7338" LastEditDate="2017-06-15T15:49:30.407" LastActivityDate="2017-06-15T15:49:30.407" Title="What are some free alternatives to SIFT/ SURF that can be used in commercial applications?" Tags="|image-processing|computer-vision|local-features|sift|" AnswerCount="4" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1290" PostTypeId="1" AcceptedAnswerId="1294" CreationDate="2012-01-31T15:28:42.440" Score="5" ViewCount="398" Body="&lt;p&gt;I want to write code in matlab to find a characteristic scale of an image patch.&#xA;I have an image patch X, I need to maximize function &lt;code&gt;F(X,sigma)&lt;/code&gt; so that sigma is the characteristic sigma.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my experiments, F can be the laplacian of the image, sigma is the &quot;power&quot; of a gaussian filter on the image. &lt;code&gt;F(x,sigma)&lt;/code&gt; should return for each x (image patch) its response over scales of increasing sigmas (i.e. a discrete value for each X and sigma).&#xA;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The laplacian is obtained by convolving laplacian kernel with the image, where&#xA;does the sigma takes place ? (is it by smoothing the image before (the laplace) with &lt;code&gt;G(sigma)&lt;/code&gt;?)&lt;/li&gt;&#xA;&lt;li&gt;How can I define &lt;code&gt;F(X,sigma)&lt;/code&gt; to return discrete value (X is nXm), ? i.e. what does this function do exactly.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Dima and Jean, Thank you for answers, the reason I'm asking this question is because I need to do something similar on 3D data (probably/maybe with some other normalized derivatives), and I first want to see how it works with 2D data (i.e. image).&#xA;I understand now what I need to do for constructing the scale space, there is still one thing I'm not sure of and it is finding the local maxima over F. For each image (x,y) and σ - F is actually the derivative of the image. What does is mean local maxima of F over x,y and σ ? look for local maxima(s) at each scale ? there are several local maxima at each scale, are these local maxima correspond (in position) over all scales? if so, I understand that for each such position I need to find the σ that gives best maxima over all scales..&#xA;Is this is what you meant guys ?&#xA;I'm sorry if I'm going to much into details, I just want to make sure I completely understand,&#xA;THANK YOU !&lt;/p&gt;&#xA;" OwnerUserId="900" OwnerDisplayName="matlabit" LastEditorUserId="6" LastEditDate="2012-02-01T18:09:19.533" LastActivityDate="2012-02-02T07:25:03.440" Title="Function for response over image scales" Tags="|computer-vision|matlab|scale-space|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1291" PostTypeId="1" AcceptedAnswerId="1293" CreationDate="2012-01-31T18:03:38.847" Score="3" ViewCount="2279" Body="&lt;p&gt;Using the DTFT property, find h[n] of a system where:&lt;img src=&quot;https://i.stack.imgur.com/1tn9x.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it an FIR or IIR system?&lt;/p&gt;&#xA;" OwnerUserId="492" LastEditorUserId="76" LastEditDate="2012-02-04T21:37:17.023" LastActivityDate="2012-02-04T21:37:17.023" Title="Find h[n] using DTFT properties" Tags="|fourier-transform|frequency|homework|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1292" PostTypeId="1" CreationDate="2012-01-31T18:42:43.747" Score="8" ViewCount="785" Body="&lt;p&gt;This is a continuation of a &lt;a href=&quot;https://dsp.stackexchange.com/questions/450/how-to-recognize-patterns-in-a-noisy-audio-frequency-spectrum&quot;&gt;previous question&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to analyze breathing and snoring sounds, and while I can fairly well detect snoring now, breathing is a bigger challenge.&lt;/p&gt;&#xA;&lt;p&gt;I've learned that if I break the analyzed frequency range (about 4KHz, sampled at about 8KHz, with a framesize of 1024) into about 5 subranges, very often one of the subranges exhibits a good sensitivity (using spectral difference) that is buried in the noise in the overall range.  The trick is to determine which subrange to &amp;quot;trust&amp;quot; when.&lt;/p&gt;&#xA;&lt;p&gt;Presumably the &amp;quot;trustworthy&amp;quot; subrange would exhibit variability at a rate between about 2Hz and 0.05Hz, while the &amp;quot;bad&amp;quot; subranges would behave more randomly, with most of their variation being at shorter intervals.&lt;/p&gt;&#xA;&lt;p&gt;I could cobble together some sort of algorithm to smooth the values at a sub-second resolution and then calculate the variability over longer intervals, but I wonder if there isn't a &amp;quot;canned&amp;quot; algorithm for this sort of things -- something with maybe a modicum of theory behind it?&lt;/p&gt;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;&lt;p&gt;[Note: I realize that one could, in theory, use an FFT to extract this info, but that seems like using a baseball bat to kill a flea.  Maybe something a little more lightweight?]&lt;/p&gt;&#xA;&lt;h2&gt;Added:&lt;/h2&gt;&#xA;&lt;p&gt;In a sense (to use an analogy) I'm trying to detect a &amp;quot;baseband&amp;quot; signal in an RF transmission (only the &amp;quot;RF&amp;quot; is audio frequencies, and the &amp;quot;baseband&amp;quot; is below 8Hz).  And, in a sense, the &amp;quot;RF&amp;quot; is &amp;quot;spread spectrum&amp;quot; -- the sounds I want to detect tend to generate lots of harmonics and/or have several separate frequency components, so if one band of the spectrum is too noisy I can probably make use of another.  The goal is to basically determine some metric resembling SNR for the various frequency bands, on the assumption that most &amp;quot;noise&amp;quot; is &amp;gt; 2Hz and my signal is less than 2Hz.&lt;/p&gt;&#xA;&lt;p&gt;I have as input to this algorithm the raw amplitudes (sum of FFT amplitudes at all included frequencies) for each band, measured at 8Hz intervals.&lt;/p&gt;&#xA;&lt;p&gt;(It should be noted that, while I have not done any formal SNR measurements, the overall SNR across the processed spectrum appears to frequently be near or below 1.0 -- if you visually observe the sound envelope in a tool like Audacity no modulation of the envelope is noticeable (even though the ear can clearly discern breathing sounds).  This is why it's necessary to analyze bands to find those with decent SNR.)&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-02-09T17:18:25.760" Title="How to determine the &quot;variability&quot; in a frequency range?" Tags="|audio|noise|frequency-spectrum|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1293" PostTypeId="2" ParentId="1291" CreationDate="2012-01-31T19:03:05.437" Score="6" Body="&lt;p&gt;While this is by your admission homework (and fairly basic), I'll bite. Recall the definition of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;DTFT&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(\omega) = \sum_{n=0}^{\infty}x[n] e^{-j\omega n}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And recall the definition of the frequency response $H(\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(\omega) = \frac{Y(\omega)}{X(\omega)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is the input to the system and $y[n]$ is its output. Combine these two equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{eqnarray*}&#xA;H(\omega)X(\omega) &amp;amp;=&amp;amp; Y(\omega) \\&#xA;\frac{1 - a^4 e^{-j 4 \omega}}{1 - a^4 e^{-j \omega}}X(\omega) &amp;amp;=&amp;amp; Y(\omega) \\&#xA;(1 - a^4 e^{-j 4 \omega})X(\omega) &amp;amp;=&amp;amp; (1 - a^4 e^{-j \omega})Y(\omega) \\&#xA;X(\omega) - a^4 e^{-j 4 \omega} X(\omega) &amp;amp;=&amp;amp; Y(\omega) - a^4 e^{-j \omega} Y(\omega)&#xA;\end{eqnarray*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, perform the inverse DTFT on both sides of the equation. By definition, $X(\omega)$ and $x[n]$ are a transform pair; likewise for $Y(\omega)$ and $y[n]$. For the other two terms, recall the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform#Properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;time-shifting property&lt;/a&gt; of the DTFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n-k] \leftrightarrow e^{-jk\omega} X(\omega)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be shown easily from the definition of the DFT. Using this property, the equation inverse transforms to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Difference_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;difference equation&lt;/a&gt; specification for the system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] - a^4 x[n-4] = y[n] - a^4 y[n-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = x[n] - a^4 x[n-4] + a^4 y[n-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the definition of a recursive filter, which are &lt;em&gt;usually&lt;/em&gt; IIR; that is the case for this one. Finding the impulse response is easy; let $x[n] = \delta[n]$ and find that the system output is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = a^{4n}u[n] - a^{4(n-4)+4}u[n-4]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = a^{4n}u[n] - a^{4n-12}u[n-4]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IG1Ig.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is plotted for $a=0.99$. It should be noted that the system is only stable for $|a|\le1$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-02-04T02:25:48.020" LastActivityDate="2012-02-04T02:25:48.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1294" PostTypeId="2" ParentId="1290" CreationDate="2012-01-31T19:07:06.093" Score="4" Body="&lt;p&gt;You probably want to check out the notion of scale-space and the links branching from this: &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale_space&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Scale_space&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming $X$ (sorry the way the question is asked is a bit unclear to me) is the image you want to find the scale: What you probably want to start with for the $F$ function is the Laplacian of Gaussian filter. You can show that it is the optimal detector for gaussian blobs even in the presence of white noise (&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1495509&quot; rel=&quot;nofollow&quot;&gt;Daniel Sage paper&lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scale then appear with the $\sigma$ of the LoG filter. This filter will have its best response when the size of the blob you apply it on matches the filter's $\sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can see with this approach that it is not enough to have a maximum of $F$ at the target scale when $\sigma$ span all possible values. This is due to the fact that when you filter, the integral of the filter comes into play and scales the response. So you want to normalize you LoG filter. You can show that the correct expression for a single blob scale detector is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ L(\sigma) = \sigma^2 \left( \frac{\partial^2 G}{\partial x^2} + \frac{\partial^2 G}{\partial y^2} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $G$ is the gaussian filter of scale $\sigma$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Ok I just saw your edit of the question. I took a slightly different approach than Dima, but in the end, hope fully the results are going to be the same. I need to start over with the notations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that $I(x,y)$ is your image, that $L(\sigma)$ is the laplacian of gaussian filter of scale $\sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply $L(\sigma)$ on $I(x,y)$, you will get a new image F so that:&#xA;$$ F(x,y,\sigma) = L(\sigma) \star I(x,y) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is cool about $F(x,y,\sigma)$? Not much if you are interested in girls, but if you are interested in finding blobs in your image $I$, there is plenty to say. If you look at the local maxima in $(x,y)$ for a given $\sigma$, you will see that they point to the center of blobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even better: let's say now that you sit on one of these local maxima on $(x,y)$ and that you let $\sigma$ vary. Well, if you used the filter $L$ with the normalization factor, you will see that the absolute value of $F(\sigma)$ actually peaks for a $\sigma$ that matches the size of your blob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is how you can get the location the blobs in your image (from the $(x,y)$ local maxima) and the size of these blobs (from the $\sigma$ value at which the value of these maxima peaks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is still a bit to do: the optimal $\sigma$ for a blob of diameter $d$ actually depends in the dimensionality of the problem (2D vs 3D), you can retrieve the relation analytically or experimentally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if you want to go for real 3D images, in most cases (at least mine...) the pixel size in X &amp;amp; Y is not the same in Z. It makes your round blob look like rugby ballons seen from the side. You want to deal with this by using a different sigma in the laplacian filter, accounting from this anisotropic calibration. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For an efficient implementation, that takes advantage of having to compute over multiple $\sigma$s, you want to check DoG filters: &lt;a href=&quot;http://en.wikipedia.org/wiki/Difference_of_Gaussians&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Difference_of_Gaussians&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;(also, it's Jean-Yves (not Jean (which is a girl name (not that I have a problem with that (I love LISP)))))&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="756" LastEditorUserId="756" LastEditDate="2012-02-02T07:25:03.440" LastActivityDate="2012-02-02T07:25:03.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1295" PostTypeId="2" ParentId="1240" CreationDate="2012-01-31T19:37:38.897" Score="2" Body="&lt;p&gt;The application I'm working on (snore detection) uses &quot;spectral difference&quot; (also called &quot;spectral flux&quot;) -- basically the sum of differences between two subsequent FFTs -- to detect snore onset.&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="447" LastEditDate="2012-02-03T19:24:17.630" LastActivityDate="2012-02-03T19:24:17.630" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1296" PostTypeId="2" ParentId="1290" CreationDate="2012-01-31T19:58:58.657" Score="6" Body="&lt;p&gt;Conceptually this works as follows: first you construct a Gaussian scale space by convolving the given image with the Gaussian filters of increasing $\sigma$. This is where the sigma comes from.  Thus you have a 3D scale volume, where each plane is an increasingly blurred version of the original image.  Then you evaluate your function $F$, which in your case would be a Laplacian, over each scale plane, i. e. at each $\sigma$.  Then you find local maxima of $F$ over $x, y$, and $\sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in practice you can use the fact that convolution is a linear operation in various ways.  For example, you can generate each scale plane from the previous plane, rather than from the original image.  This allows you to use the same filter, rather using several filters with increasing $\sigma$.  Or you can generate $F(\sigma)$ directly from the original image by using the Laplacian-of-Gaussian filter of the corresponding $\sigma$&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-01-31T19:58:58.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1297" PostTypeId="1" CreationDate="2012-01-31T21:26:00.560" Score="3" ViewCount="148" Body="&lt;p&gt;I have a question regarding my homework.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let's assume that the transform of $x[n]$ is $X(\omega)$.&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Find $Y(\omega)$ as a function of $X(\omega)$:&#xA;  $$ y[n] =\cases{x[n/2],&amp;amp;\text{if } n \text{ is even}\cr 0,&amp;amp;\text{if } n \text{ is odd}}$$ &lt;/li&gt;&#xA;  &lt;li&gt;Find $Z(\omega)$ as a function of $X(\omega)$:&#xA;  $$ z[n] =\cases{x[n/2],&amp;amp;\text{if } n \text{ is even}\cr x[(n-1)/2],&amp;amp;\text{if } n \text{ is odd}}$$ &lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="895" LastEditorUserId="1629" LastEditDate="2016-08-17T15:37:47.667" LastActivityDate="2016-08-17T15:37:47.667" Title="Find $Y(\omega)$ as a function of $X(\omega)$" Tags="|homework|" AnswerCount="0" CommentCount="4" ClosedDate="2013-01-16T19:49:57.393" ContentLicense="CC BY-SA 3.0" />
  <row Id="1298" PostTypeId="1" AcceptedAnswerId="1300" CreationDate="2012-01-31T22:20:48.473" Score="7" ViewCount="2506" Body="&lt;p&gt;What is the gradient domain? Does it relate to the Laplace Pyramids?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found only articles assuming you know what it is and not define it, can someone please define what is it and what it is used for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reference used is &lt;a href=&quot;https://www.scribd.com/document/414386235&quot; rel=&quot;nofollow noreferrer&quot;&gt;Seamless Image Stitching in the Gradient Domain&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="128" LastEditDate="2019-06-24T18:57:17.730" LastActivityDate="2019-06-24T18:59:41.093" Title="Image Processing - What Is a Gradient Domain?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1299" PostTypeId="2" ParentId="1298" CreationDate="2012-01-31T22:43:11.387" Score="3" Body="&lt;p&gt;By gradient, in this particular paper, they mean a smooth transition function from one image's content to the other inside $\omega$, the stitch region. This region is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Domain_of_a_function&quot; rel=&quot;nofollow&quot;&gt;domain&lt;/a&gt; of such gradient, meaning the region of space on which it is defined. Therefore $\omega$ region in the gradient domain for a specific stitch.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-01-31T22:52:36.000" LastActivityDate="2012-01-31T22:52:36.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1300" PostTypeId="2" ParentId="1298" CreationDate="2012-02-01T01:27:20.947" Score="7" Body="&lt;p&gt;You may want to read this lecture's slides on blending--They also describe Laplace pyramids as another blending tool:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.scribd.com/document/414386326&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Blending and Compositing&lt;/a&gt; (15-463: Computational Photography, Alexei Efros, CMU, Fall 2011)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;gradient domain&quot; is the name often given to a class of processing techniques which operate not on the value of the pixels in images but on differences between the values of neighboring pixels, ie. local spatial transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It means that in the core computations of the algorithm, the image is represented by its first spatial derivatives (horizontal and vertical)--remember the first terms of the Taylor serie of a 1D function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; around a point &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f(x_0) + (x-x_0) * f'(x_0)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example in the following image, for each pixel inside the white mask the image is not represented by an intensity value, but by a vector of a given direction and norm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9TWOa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of the stitching paper you mention, the stitched result in the overlapping region consists of a blend of the two original images which tries to respect (that is, be very close to) the observed spatial derivatives in the two images (and not the observed pixel values). &lt;/p&gt;&#xA;" OwnerUserId="602" LastEditorUserId="128" LastEditDate="2019-06-24T18:59:41.093" LastActivityDate="2019-06-24T18:59:41.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1302" PostTypeId="1" AcceptedAnswerId="1324" CreationDate="2012-02-01T06:17:12.190" Score="24" ViewCount="21019" Body="&lt;p&gt;What are the peak detection algorithms in existence? I have noisy data, and I would like to implement peak detection for this data. Data is in reverse, actually I am trying to determine the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a snapshot of the data in Excel. I like to detect both bottoms. I thought about passing the data through a low-pass filter and subsequently do a moving average where I determine the peaks and within the moving average I do another search. I have zero DSP background; this is just a common sense approach. I would like to hear what the experts recommend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nLA5n.jpg&quot; alt=&quot;Enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="207" LastEditDate="2012-02-05T11:41:31.020" LastActivityDate="2016-05-18T18:47:32.910" Title="Peak detection approach" Tags="|filters|peak-detection|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1303" PostTypeId="1" CreationDate="2012-02-01T06:36:29.213" Score="1" ViewCount="149" Body="&lt;p&gt;I would like to know the relation between the parameters $\{\omega_k,A_k\;|\;k\in\mathbb{Z}\}$ of a series $\sum_kA_ksin(\omega_kx)$ and a related series, for example, $\sum_kA_k^2sin^2(\omega_kx)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to know why a multiplicity of peaks appears in the FT when the components of a series are raised to some power? $N$ mirrored sets of peaks with characteristic spacing on the frequency axis and scaling on the amplitude axis are manifest when taking the FT of $\sum_kA_k^Nsin^N(\omega_kx)$. I am interested to know the relation between the parameters of these $N$-fold multiplicities as well. For instance, the amplitudes and the frequencies appear to scale geometrically (e.g., $10$ Hz, $5$ Hz, $2.5$ Hz, $1.25$ Hz).&lt;/p&gt;&#xA;" OwnerUserId="897" LastEditorUserId="1473" LastEditDate="2012-07-01T19:48:15.127" LastActivityDate="2012-07-01T19:48:15.127" Title="Basic question about trigonometric series and transforms thereof" Tags="|fourier-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1305" PostTypeId="1" AcceptedAnswerId="1315" CreationDate="2012-02-01T08:48:33.227" Score="15" ViewCount="5586" Body="&lt;p&gt;How are the descriptors in the &lt;a href=&quot;http://cvlabwww.epfl.ch/~lepetit/papers/calonder_eccv10.pdf&quot; rel=&quot;nofollow&quot;&gt;BRIEF algorithm&lt;/a&gt; matched to each other?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is the template image found in the another image? How do we compare the descriptors?&#xA;I have read that article but didn't understand how they have done it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They wrote that they compared descriptors by using Hamming distance, but how is invariance to changes in illumination, size, etc. achieved?&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="4433" LastEditDate="2014-03-26T12:39:31.617" LastActivityDate="2014-03-26T12:39:31.617" Title="Binary robust independent elementary features (&quot;BRIEF&quot;) understanding" Tags="|computer-vision|algorithms|local-features|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1306" PostTypeId="1" CreationDate="2012-02-01T10:05:32.323" Score="4" ViewCount="109" Body="&lt;p&gt;I have a system where I sample some data periodically (every 10usec). The shape of the data is triangle, in other words it linearly increases and decreases in time. (Both theory and practice are in agreement, I plot the ADC output and I clearly see linear increase and decrease although there is some non-linearity but let's ignore that for the sake of discussion) However the frequency of the signal is not fixed. It may increase very fast or very slow. (narrow or wide triangle)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to locate the true peak point of the data with 500nsec accuracy, however my ADC samples every 10usec. One item on my favor is that the data values increase and decrease in sequence. I get worst case 50 samples, best case 1000 samples. (in worst case, I will have 25 samples in increasing order and 25 in decreasing order)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I approach this issue using DSP techniques? One idea I had was to calculate peak point from rise and fall angles. (I basically extend the left and right side of the triangle and look at where those lines cross each other). I cannot think of any other way. I welcome suggestions. &lt;/p&gt;&#xA;" OwnerUserId="222" LastActivityDate="2012-02-02T19:57:01.830" Title="Compensating for measurement errors" Tags="|sampling|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1307" PostTypeId="2" ParentId="1256" CreationDate="2012-02-01T10:14:13.073" Score="3" Body="&lt;p&gt;As alternative to SIFT/SURF/Other you can also use FFT phase correlation, if frames transformed by mostly translations (rotation/perspective is small). You can also apply phase correlation to regions of image iteratively for better precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_correlation&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Phase_correlation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2012-02-01T10:14:13.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1308" PostTypeId="2" ParentId="1303" CreationDate="2012-02-01T14:41:23.233" Score="4" Body="&lt;p&gt;There is no general relationship between the Fourier transform of $f$ and that of $g(f)$ where $g$ is an arbitrary function. The Fourier transform does have the linearity property, so if $g$ is something simple like an affine transform, then the same linear relationship applies to their transforms $F$ and $G$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With respect to your second question, where $h = \sum_k \left(A_k \sin(\omega_k x)\right)^N$, the presence of more than $k$ peaks in the Fourier transform of $h$ is easily explained using the &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_trigonometric_identities#Power-reduction_formula&quot; rel=&quot;nofollow&quot;&gt;power-reduction trigonometric identity&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\sin^n(\theta) = &#xD;&#xA;\begin{cases} &#xD;&#xA;\frac{2}{2^n} \sum_{k=0}^{\frac{n-1}{2}} (-1)^{(\frac{n-1}{2}-k)} \binom{n}{k} \sin{((n-2k)\theta)}, &amp;amp; n \text{ is odd} \\&#xD;&#xA;\frac{1}{2^n} \binom{n}{\frac{n}{2}} + \frac{2}{2^n} \sum_{k=0}^{\frac{n}{2}-1} (-1)^{(\frac{n}{2}-k)} \binom{n}{k} \cos{((n-2k)\theta)}, &amp;amp; n \text{ is even}&#xD;&#xA;\end{cases}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(the above is shamelessly borrowed from Wikipedia)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, when you raise a sinusoid to a power, the result can be expressed as a weighted sum of sinusoids at different frequencies, where the number of individual terms is related to the power. That's why you see additional peaks in the spectrum of $h$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can come up with a more general relationship for some cases by taking advantage of the multiplication property of the Fourier transform. That is, if $g = f \cdot e$, then its Fourier transform is $G = F * E$ (where $*$ indicates convolution). You could apply this relationship repeatedly to the sinusoid raised to a power to derive the same result as above.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-02-01T15:19:04.280" LastActivityDate="2012-02-01T15:19:04.280" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1309" PostTypeId="2" ParentId="1224" CreationDate="2012-02-01T16:41:50.067" Score="5" Body="&lt;p&gt;There is no such thing as &lt;em&gt;standard&lt;/em&gt; &quot;neural network&quot; system for face recognition. Any system with this method can vary vastly depending on your feature inputs to the network and how well it is trained to do the job. Some clarity would help to point out a better comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there are systems that can go up to 99.999% accuracy (or so they claim) but it is quite reasonable to think that can NOT be true. (edit)&lt;/p&gt;&#xA;" OwnerUserId="73" LastEditorUserId="73" LastEditDate="2012-02-02T07:39:35.070" LastActivityDate="2012-02-02T07:39:35.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1310" PostTypeId="2" ParentId="1286" CreationDate="2012-02-01T16:51:35.670" Score="2" Body="&lt;p&gt;Looking at the data I can't see why you'd want to use FFT for this purpose (I may be wrong though). Lets say you want to detect single or multiple movements based on this data set (which you've attached) the methods I'd be looking at would be&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Something on the lines of rate of change of absolute values. First derivative would do nicely I guess.&lt;/li&gt;&#xA;&lt;li&gt;Wavelet transform maybe? I can't elaborate more on its utility until I know whether you want to know the the position of the peaks or not.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If the only thing you want to detect is single vs multiple oscillation then FFT is, in my opinion, not a very good choice for analysis. &lt;/p&gt;&#xA;" OwnerUserId="73" LastActivityDate="2012-02-01T16:51:35.670" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1312" PostTypeId="2" ParentId="1224" CreationDate="2012-02-01T17:56:23.813" Score="12" Body="&lt;p&gt;Well, it's important to understand that face recognition (just like object recognition process) is a two-stage process, the first one is the Computer Vision phase, which is to represent the image (face) in feature space that works well (depending on the task you want to do) so for example, the image itself is a set of ordered pixels (let's say 300x300), which makes each image representative by 90000 numbers, this is the dimensionality of your data points (images) and just FYI, 90000 is insanely huge, if you try to use Neural Networks, Support Vector Machines, or any other classification tool using this high dimensions, you will absolutely learn nothing - this is the curse of dimensionality (you will need to provide tremendously larger set for training, in other words, to learn any classifier you will need many more images than 90000, which is hard and unreasonable thing to do). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you will need to represent the images in a different space (called feature space), for face recognition, there is something called eigenfaces (look it up), but the idea is that you find the most discriminate features of the faces then for each image, you convert that image to a set of numbers that will use the discriminant features to describe the image, so each image will be represented as a set of numbers (.3, .1, .1, ...) which will be much smaller than 90000. By the way (.3, .1, .1, ...) will mean something like for example .3 there's a difference between hair and face, .1 there's difference between face and background and so... However, this is a really hard step (feature selection) and it may vary based on the kind of images you have (like the basic eigenfaces only work when your images are aligned, are your images aligned?). Of course using Color Histograms is another approach to represent the image/face (personally (this is only my opinion), I think that color histograms won't be so efficient for face recognition, I might be wrong and would love to know if anyone knows) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second step is the classification step, here you can use Neural Networks (which also needs a lot of parameter tuning), Support Vector Machines (popular), or decision trees (simple and interpretable), adaboost (popular), and some other approaches. - so you will provide your images in the feature space instead of the pixel-representative and hopefully you'll learn a good classifier that will classify with high accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps&lt;/p&gt;&#xA;" OwnerUserId="878" LastActivityDate="2012-02-01T17:56:23.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1313" PostTypeId="2" ParentId="1288" CreationDate="2012-02-01T18:38:35.273" Score="13" Body="&lt;p&gt;Don't trust anyone here, talk to a lawyer. The Legal world is subtly different from ours, if I may say. Depending on what you exactly want to do (and where, etc.), there may be a solution where you could use SURF or SIFT. I have been surprised in the past how seemingly strong licenses can be overcome.&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2012-02-01T18:38:35.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1314" PostTypeId="2" ParentId="1306" CreationDate="2012-02-01T19:32:43.210" Score="0" Body="&lt;p&gt;In a comparable situation where I need to determine the position of the peak with high accuracy I resample the signal at 2MHz (using a sync interpolation) and then search for the highest valued sample.&lt;/p&gt;&#xA;" OwnerUserId="108" LastActivityDate="2012-02-01T19:32:43.210" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1315" PostTypeId="2" ParentId="1305" CreationDate="2012-02-01T22:54:47.590" Score="15" Body="&lt;p&gt;First of all, there's no such thing as 'template' in this paper - the word 'template(s)' has a different meaning in Computer Vision. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method used in this paper is relatively straight-forward. Let me break it down for you. There are three important things that you need to do when doing tasks such as object recognition, image matching, image stitching, and similar others, using &lt;strong&gt;Local Features&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first important thing is &lt;strong&gt;Detection&lt;/strong&gt;; in this step you want to detect points-of-interest or keypoints, and what that means is that you want to choose local points (basically small patches) that you think are interesting in the image, there are many ways to do that; this paper doesn't contribute in this area. However, it seems that they use SURF feature detector and CenSurE keypoints (you can look them up if you want to know more about them, I won't talk about this step except that they use features such as gradients and so, which means that if you have a photo, it's unlikely that a point in the middle of the sky would be chosen as an interest point, that's because the pixels around that point are all same intensities, things that are 'busy' tend to be chosen as interest points (e.g. table/building edges/corners)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After detection is done, &lt;strong&gt;Feature Description&lt;/strong&gt; follows. You know the interesting points in the image and now you want to describe them (basically you want to describe the points/patch around the interesting points). SIFT is one popular feature descriptor. In this paper, they come up with a new one, called BRIEF. BRIEF is based on comparisons, so let's say we have a patch (50 pixels by 50 pixels), we choose two points and compare the intensities of the two points, if the first point is larger than the second point, we assign the value '1', else '0', we do that for a number of pairs and we end up with a string of boolean values. Now the big question is 'how do you pick the pair of points?', in the paper they explained 5 ways, relatively similar, I will describe the first one. What you do is you uniformly (equal probability) choose a point from -S/2 to S/2, in our example we said that the patch size is 50, so we choose a point between -25 to 25. Assuming that the 0,0 coordinate is located at the center of the patch. So here's an example;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to select the first pair, each point consists of (X,Y) coordinates so we uniformly select the X-coordinate of the first point, then the Y-coordinate of the first point, let's assume it's (10,-1), now the second point; we uniformly select the X-coordinate for the second point, and the Y-coordinate for the second point, let's assume it's (-2,20), now we get the intensity values for each point and see which one has the larger intensity values - if first is larger we assign the first boolean value to be '1', if not, we assign '0'. We do that for many pairs, and we end up with a vector of boolean values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*Very important point: I assume for this to work, you will have to specify a seed value before the random generator. What that means is that you want to choose the same values for each patch - this is super important because when you compare/match patches, the whole system will break down if they're not chosen the exact same way. - hopefully this will make sense when you read the matching step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we do that for each interest point that was detected by the detector. For each interest point, we will get a vector of boolean values.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now to match two images (&lt;strong&gt;third step; matching&lt;/strong&gt;), we do the exact same thing for the other image, we detect, then describe using the BRIEF. For example let's say we have 10 interest points in each image (this can always work if we get the 10 most interesting points in each image), we use BRIEF to describe each patch using for example 50 pairs, so each image will be described by 10 vectors of 50 boolean values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compare the two images, we find the nearest neighbor of each vector from the first image to each other vector from the second image. We use Hamming distance which is pretty fast, example of hamming distance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hammingDistance((0, 1, 1), (0, 0, 0)) = 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hammingDistance((0, 1, 1), (0, 1, 1)) = 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hammingDistance((0, 1, 1), (1, 0, 0)) = 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hammingDistance((0, 1, 1), (1, 1, 1)) = 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically how many wrong correspondences&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps&lt;/p&gt;&#xA;" OwnerUserId="878" LastActivityDate="2012-02-01T22:54:47.590" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1316" PostTypeId="2" ParentId="1302" CreationDate="2012-02-02T02:54:29.910" Score="-1" Body="&lt;p&gt;I think one typical peak detection algorithm is like this where &lt;code&gt;ref&lt;/code&gt; is &lt;code&gt;peak(bottom)&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i=1,N   {&#xA;       if i=1   {  ref＝data(i)　｝&#xA;       else ｛ if　data(i)＜＝ref　｛ref ＝data(i) ｝｝&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="903" LastEditorUserId="5633" LastEditDate="2016-05-18T18:47:32.910" LastActivityDate="2016-05-18T18:47:32.910" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1317" PostTypeId="1" AcceptedAnswerId="1321" CreationDate="2012-02-02T04:00:35.523" Score="36" ViewCount="14398" Body="&lt;p&gt;I was looking in the Android app store for a guitar tuner. I found a tuner app that claimed it was faster than other apps. It claimed it could find the frequency without using the DFT (I wish I still had the URL to this specification).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have never heard of this. Can you acquire an audio signal and compute the frequency without using the DFT or FFT algorithm? &lt;/p&gt;&#xA;" OwnerUserId="730" LastEditorUserId="76" LastEditDate="2012-02-04T12:27:38.837" LastActivityDate="2018-10-10T02:30:55.483" Title="Is there an algorithm for finding a frequency without DFT or FFT?" Tags="|audio|fft|frequency|dft|" AnswerCount="9" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1318" PostTypeId="2" ParentId="1317" CreationDate="2012-02-02T04:57:48.313" Score="8" Body="&lt;p&gt;Pitch detection can be done in many versatile and curious ways. One way to do it is by using &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot;&gt;autocorrelation&lt;/a&gt;. This &lt;a href=&quot;http://fivedots.coe.psu.ac.th/~montri/Research/Publications/iscit2003_pda.pdf&quot;&gt;paper&lt;/a&gt; gives an example of how it can be used. Autocorrelation can be made ridiculously simple by using a 1-bit correlator (couldn't find any decent papers on that for some reason). So theoretically, pitch &lt;em&gt;can&lt;/em&gt; be detected faster than with FFT, but I doubt that it will be much more precise without &lt;em&gt;really&lt;/em&gt; clever pre-processing.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-02-02T04:57:48.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1319" PostTypeId="2" ParentId="1302" CreationDate="2012-02-02T12:16:23.830" Score="5" Body="&lt;p&gt;I am far from being an expert, but here is what I would do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You seem to have a slowly varying signal superimposed with fluctuations. The peaks you search are some stronger fluctuations, so I would detect them using that. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Let $X(T)$ be your raw signal. Take a moving average over a suitable number of samples to create $Y(t)$ a smooth carrier. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you succeed $X-Y$ must should have a zero mean. Compute the standard deviation $\sigma$ of $X-Y$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can detect your peaks when $|(X-Y)(t)| &amp;gt; \alpha \times \sigma$, with $\alpha$ being typically 2, 3, 4.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;An overshoot or an undershoot can be specifically detected by removing the absolute value and using proper test. Is that what you are looking for?&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2012-02-02T12:16:23.830" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1320" PostTypeId="2" ParentId="1317" CreationDate="2012-02-02T14:02:06.373" Score="4" Body="&lt;p&gt;If you know exactly which frequency bin you are looking for in a DFT/FFT then you can use the Goertzel algorithm to get the value of that bin only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Goertzel_algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="904" LastActivityDate="2012-02-02T14:02:06.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1321" PostTypeId="2" ParentId="1317" CreationDate="2012-02-02T14:11:07.960" Score="29" Body="&lt;p&gt;FFT is actually not a great way of making a tuner. FFT has inherently a finite frequency resolution and it's not easy to detect very small frequency changes without making the time window extremely long which makes it unwieldy and sluggish. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Better solutions can be based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Phase-locked_loop&quot;&gt;phase-locked loops&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Delay-locked_loop&quot;&gt;delay-locked loops&lt;/a&gt;, auto correlation, zero crossing detection and tracking, max or min detection and tracking and certainly intelligent combination of these methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pre-processing always helps.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="29" LastEditDate="2013-03-26T16:25:29.027" LastActivityDate="2013-03-26T16:25:29.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1322" PostTypeId="2" ParentId="1317" CreationDate="2012-02-02T16:51:27.343" Score="12" Body="&lt;p&gt;An FFT reports spectrum frequency peak or peaks (quantized by FFT bin size), which is different from musical pitch.  It's possible for the perceived pitch frequency to be completely missing from an FFT spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the simplest guitar tuners just used low-pass or band-pass filtering and measured the time between zero-crossings.  The reciprocal gives a frequency estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Autocorrelation is another common pitch estimation method; and sliding correlation or other self-similarity measures have lots of variations, such as sliding ASDF (squared difference), AMDF (mean difference), non-linear pattern matchers, adaptive checking only for a limited range of lags, lag interpolation, windowing and adaptive window selection, various weightings or using decision theory to select among multiple potential lag history sequences, and etc.  One problem with most self-similarity measures is choosing the appropriate octave, as a sub-octave may show nearly the same similarity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other possibilities include using PLLs, filtered quadrature demodulators, filtered Hilbert transforms, and etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But note that some DSP filtering and demodulation methods are computationally nearly equivalent to doing 1-bin of a windowed DFT, which may or may not fit as an answer to your question.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-02-02T19:41:45.600" LastActivityDate="2012-02-02T19:41:45.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1323" PostTypeId="2" ParentId="1317" CreationDate="2012-02-02T17:26:28.587" Score="2" Body="&lt;p&gt;You can actually compute the frequency of a signal using its pseudo-spectrum, which looks at the eigenvectors of its autocorrelation matrix. It basically decomposes your signal into noise and signal subspaces. From there, you can find its spectrum. (You can also limit it and give it a range of frequencies to check). It is also pretty noise immune. Of course, this is a parametric method, not an unparametric one like DFT. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-02-02T17:26:28.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1324" PostTypeId="2" ParentId="1302" CreationDate="2012-02-02T18:14:59.140" Score="13" Body="&lt;p&gt;Ktuncer, there are a number of methods you can use here. One method that I would recommend is to use a Discrete Wavelet Transform, (DWT), and in particular, look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Daubechies_wavelet&quot; rel=&quot;noreferrer&quot;&gt;Daubechies Wavelet&lt;/a&gt;. I would pick, say, Daub-14 / Daub-Tetra. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically what you really need to do is 'trend' your signal, and then from there, do a min or max pick. That will get rid of your outliers. A daub-14/daub-tetra wavelet transform can help you do this, and this helps especially since you do not know the nature of your signal. (Using daub-14, you can accurately represent polynomial signals of degree 14/2 = 7, and it looks like you wont need more than that).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computation of this wavelet transform essentially 'compresses' your energy into a few indicies. Those indicies represent weights on basis vectors. The rest of the weights will (ideally) be near zero. When you have noise in your signal (as you do), those weights that were normally zero have some weights now, but you can simply zero them out and 'denoise' your signal. Once that is complete, you can then do a simple max/min detect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are more details involved, you may send me an email if you like to discuss how to implement it. I have done similar work on this before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: Here are some images illustrating Daub-Tetra Denoiser:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vFIUm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Bk85N.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5ocn4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DYGqX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-02-03T07:30:17.990" LastActivityDate="2012-02-03T07:30:17.990" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1325" PostTypeId="2" ParentId="1306" CreationDate="2012-02-02T19:57:01.830" Score="1" Body="&lt;p&gt;If you can reliably determine which samples are on a rising portion and which are on a falling portion, then perhaps you can do a linear regression on each (near)monotonic segment, and solve for the intersections of the computed regression lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the non-linearity equation, then you can do a regression against that curve instead of using linear regression, and compute or numerically solve for the curve intersections, if needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This regression method might also help with error or robustness estimates, if needed.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-02-02T19:57:01.830" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1326" PostTypeId="2" ParentId="1291" CreationDate="2012-02-02T20:13:15.577" Score="2" Body="&lt;p&gt;$$\begin{align*}&#xD;&#xA;H(\omega) &amp;amp;= \frac{1-a^4\exp(-4j\omega)}{1-a^4\exp(-j\omega)}\\&#xD;&#xA;&amp;amp;= (1-a^4\exp(-4j\omega))\sum_{n=0}^\infty (a^4\exp(-j\omega))^n\\&#xD;&#xA;&amp;amp;= \sum_{n=0}^\infty a^{4n}\exp(-nj\omega)-\sum_{n=0}^\infty a^{4n+4}\exp(-(n+4)j\omega)\\&#xD;&#xA;&amp;amp;= \sum_{n=0}^3 a^{4n}\exp(-nj\omega) + \sum_{n=4}^\infty [a^{4n} - a^{4n-12}]\exp(-nj\omega)\\&#xD;&#xA;h[n] &amp;amp;= \begin{cases}0, &amp;amp;n &amp;lt; 0,\\&#xD;&#xA;a^{4n}, &amp;amp;n = 0, 1, 2, 3,\\&#xD;&#xA;a^{4n} - a^{4n-12}, &amp;amp;n \geq 4.\end{cases}&#xD;&#xA;\end{align*}&#xD;&#xA;$$&#xA;Since the impulse response extends to $\infty$, this is an IIR filter.  JasonR &#xA;states in his answer that the filter is stable &lt;em&gt;only if&lt;/em&gt; $|a| &amp;lt; 1$. &#xA;In fact, the filter is stable when $|a| \leq 1$, and is unstable only for &#xA;$|a| &amp;gt; 1$.  However, when $|a| = 1$, from the geometric series formula&#xA;$1 + r + r^2 + r^3 = \frac{1-r^4}{1-r}$, we get that&#xA;$$H(\omega) = \frac{1-\exp(-4j\omega)}{1-\exp(-j\omega)}&#xD;&#xA;= 1 + \exp(-j\omega)+\exp(-2j\omega)+\exp(-3j\omega)$$&#xA;is the transfer function of a (stable) &lt;strong&gt;FIR&lt;/strong&gt; filter that&#xA;can be described as  a short-term integrator or short-term averager&#xA;(with gain $4$).&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-02-04T14:59:00.053" LastActivityDate="2012-02-04T14:59:00.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1327" PostTypeId="2" ParentId="1292" CreationDate="2012-02-02T21:20:43.573" Score="2" Body="&lt;p&gt;Have you tried out spectral flux. There is MATLAB implementation here: &lt;a href=&quot;http://blog.weisu.org/2009/12/spectral-flux-sf-in-audio.html&quot; rel=&quot;nofollow&quot;&gt;http://blog.weisu.org/2009/12/spectral-flux-sf-in-audio.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="906" LastActivityDate="2012-02-02T21:20:43.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1328" PostTypeId="1" AcceptedAnswerId="1337" CreationDate="2012-02-03T00:53:44.687" Score="3" ViewCount="637" Body="&lt;p&gt;Assume I have an array of floating points that contain the last 8192 samples played. How would I convert that array to 32 frequency bins that are spaced from 0Hz - Nqyst?&lt;/p&gt;&#xA;" OwnerUserId="509" LastActivityDate="2012-02-04T18:03:04.750" Title="From a 44kHz audio signal, how could I extract 32 evenly spaced frequency bands?" Tags="|audio|fft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1329" PostTypeId="2" ParentId="1302" CreationDate="2012-02-03T04:40:12.810" Score="5" Body="&lt;p&gt;Peak detection has quite a few applications, for 1D or multidimensional signals. Here are a few examples showing how varied these signals and their interpretations of a peak can be: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The original poster's 1D data;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hough transform of an image, each peak corresponds to a line in the original image;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Vgbwb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;autocorrelation of an image, each peak corresponds to a frequency revealing a &quot;periodic pattern&quot;;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/v0ovI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;generalized&quot; cross-correlation of an image and a template, each peak corresponds to an occurrence of the template in the image (we may be interested in detecting only the best peak or several peaks);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SMmZl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;result of filtering an image for Harris corners, each peak corresponds to a corner in the original image.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/14U6c.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are definitions and detection techniques of peaks I have encountered--certainly there are others that I either forgot or don't know, and hopefully other answers will cover them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preprocessing techniques includes smoothing and denoising. @Mohammad's answer is about wavelets, and you can see various usages of them in the &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/WaveletThreshold.html&quot; rel=&quot;noreferrer&quot;&gt;documentation of Mathematica's WaveletThreshold&lt;/a&gt; (where I also took my examples from, by the way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you search for maxima. Depending on your application, you need only the global maxima (e.g., image registration), a few local maxima (e.g. line detection), or many local maxima (keypoints detection):&#xA;This can done iteratively, looking for the highest value in the data then erasing a region around the selected peak, etc. until the highest remaining value is below a threshold.&#xA;Alternatively, you can look for the local maxima within a certain neighborhood size, and keep only those local maxima whose values are above a threshold -- some recommend to keep the local maxima based on their distance to the rest of the local maxima (the further the better). &#xA;The arsenal also features morphological operations: Extended maxima and top-hat transform can both be suitable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the results of three of these techniques on an image filtered for Harris corners:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8x2RP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, some applications attempt to find peaks at sub-pixel resolution. Interpolation, which can be application-specific, comes handy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, there is no silver bullet, and the data will tell which techniques work best. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will be really nice to have more answers, esp. coming from other disciplines.&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2012-02-03T04:40:12.810" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1330" PostTypeId="2" ParentId="1292" CreationDate="2012-02-03T06:39:13.720" Score="1" Body="&lt;p&gt;What you need seems far bigger than a flea.  So you may need to go in the opposite direction, and do more than just an FFT.  Perhaps low frequency cepstrum or cepstral analysis to find your &quot;exiter&quot; frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-02-03T06:39:13.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1332" PostTypeId="1" CreationDate="2012-01-30T10:26:49.287" Score="3" ViewCount="5302" Body="&lt;p&gt;Consider this MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mg=imread(........bmp'); &#xA;level=graythresh(mg); &#xA;x=im2bw(mg,level); &#xA;figure,imshow(x); &#xA;BW2 = bwperim(~x); &#xA;figure,imshow(BW2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;operating on this image (&lt;strong&gt;NOTE&lt;/strong&gt; has white margin, see &lt;a href=&quot;http://dc414.2shared.com/download/mJU_uL3u/r1_online.jpg?tsid=20120130-121005-4ba55dea&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fYV5e.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result was (original link &lt;a href=&quot;http://dc187.2shared.com/download/TYtWOYZP/r12.jpg?tsid=20120130-121003-de4e74e8&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9pyii.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I remove the white pixels from the second image and then obtain the first image with everything but the white pixels removed from the second image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, how can I remove the boundaries from the second image and then get the original image without these boundaries?&lt;/p&gt;&#xA;" OwnerUserId="920" OwnerDisplayName="ruaa" LastEditorUserId="76" LastEditDate="2012-02-04T21:38:17.020" LastActivityDate="2012-02-06T20:16:35.853" Title="Removing white pixels from a b/w image in MATLAB?" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1333" PostTypeId="2" ParentId="1332" CreationDate="2012-01-30T12:31:17.247" Score="1" Body="&lt;p&gt;So...you want to remove the fat white borders from around the black region??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try search for the first and last row,column that are 0 in the second image, using (e.g.) &lt;a href=&quot;http://www.mathworks.com.au/help/techdoc/ref/find.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;find&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% assuming BW2 is 2D, one channel.&#xA;% the reason the first has a BW2' and the second is BW&#xA;% is because of Matlab being column-major when it does `find`:&#xA;% have to make sure we actually get the first/last indices.&#xA;[col1,row1] = find(BW2'==0,1,'first'); % top-left corner&#xA;[row2,col2] = find(BW2==0,1,'last'); % bottom-right corner&#xA;BW3 = BW(row1:row2, col1:col2);&#xA;imshow(BW3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does assume that the top-left and bottom-right corner of the image proper won't be part of the outline - this is a very low chance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to be sure however, you could instead look for the first row that is not all 255 and first col that is not all 255, and similarly for the last row/col (ie locate margin by looking for entire rows/cols being 255) and crop like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cols = sum(abs(255-BW2),1); % work out difference from 255&#xA;rows = sum(abs(255-BW2),2);&#xA;col1 = find(cols,1,'first');&#xA;col2 = find(cols,1,'last');&#xA;row1 = find(rows,1,'first');&#xA;row2 = find(rows,1,'last');&#xA;BW3 = BW(row1:row2,col1:col2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note this will fail on your jpeg because of the compression it uses -- the border is not uniquely 255, there are a few 251's in there. But it will work on your code if you don't save &lt;code&gt;BW&lt;/code&gt; out as a jpeg first and then read it back in. If you're going to save images, use a lossless format like TIF or PNG).&lt;/p&gt;&#xA;" OwnerDisplayName="mathematical.coffee" LastActivityDate="2012-01-30T12:31:17.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1334" PostTypeId="1" CreationDate="2012-02-04T01:45:16.780" Score="13" ViewCount="7396" Body="&lt;p&gt;I am a junior high school student who has a general fascination for electronics, programming, and the like. Recently, I have been learning about signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I haven't done much calculus yet (forgive me), so I am a little fuzzy on things. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you were to compute the DTFT of a signal, what would be the difference between a $\sin$ or $\cos$ representation of that signal?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With the DTFT I understand that the signal you input would be discrete in time, but how in the world can you achieve a continuous signal in the frequency domain?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This leads to my second question, which is: how is the DTFT useful? Where has it been used with most applications and why?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any help.&lt;/p&gt;&#xA;" OwnerUserId="796" LastEditorUserId="1629" LastEditDate="2016-09-09T18:47:56.363" LastActivityDate="2016-09-09T18:47:56.363" Title="Discrete-time Fourier transform" Tags="|fourier-transform|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1335" PostTypeId="1" AcceptedAnswerId="7641" CreationDate="2012-02-04T07:12:42.530" Score="3" ViewCount="2765" Body="&lt;p&gt;I have seen this equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Pr({\epsilon})  = Q({\sqrt{2E_b/N_0}}) \,.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where these definitions hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$N_0/2  - the \ spectral \ density \ of \ white \ noise$$ &#xA;$$E_b = PT_b - the \ energy \ per \ transmitted \ bit$$ &#xA;$$P - Power $$&#xA;$$T_b - the \ time\ the \ bit\ transmitted \ in$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q - is (&lt;a href=&quot;http://en.wikipedia.org/wiki/Q-function&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;) function, how do I derive this equation?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2013-07-10T03:53:12.723" LastActivityDate="2013-07-10T03:53:12.723" Title="Why the error probability is given by this expression?" Tags="|digital-communications|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1336" PostTypeId="1" AcceptedAnswerId="1347" CreationDate="2012-02-04T13:31:43.443" Score="16" ViewCount="8544" Body="&lt;p&gt;What image analysis techniques can I use to extract the traffic signs from an image such as the one below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WGFUv.png&quot; alt=&quot;Exterior shot of a metropolitan roadside&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Anisotropic diffusion: The background that i don't want gets cleared a little&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wutQU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Dilation : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bPbJ3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thresholding after Diffusion : Not able to figure out the best thresholding for this purpose&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JhU6C.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However i am not able to figure out how to remove the background?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit : i just want these parts of my image &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SKDPX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking another input image :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xkPXm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying median filtering and edge detection :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PzSml.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Bottom hat filtering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B59zs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do i isolate the road signs please help?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="654" LastEditDate="2012-02-05T08:44:12.547" LastActivityDate="2020-03-31T12:07:39.427" Title="How to extract traffic signs from a photograph?" Tags="|image-processing|filters|" AnswerCount="4" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1337" PostTypeId="2" ParentId="1328" CreationDate="2012-02-04T18:03:04.750" Score="2" Body="&lt;p&gt;Depends on what you want to do with it. Some possibilities:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Short Time Fourier Transform with a 64 FFT length will give you 33 bins as a function of time. These are actually 31 &quot;normal&quot; bins (with amplitude and phase) and 2 &quot;half&quot; bins that only have amplitude (DC and Nyquist) and half the bandwidth. If your input vector is complex, you can use an FFT length of 32 and you get 32 &quot;normal&quot; bins.&lt;/li&gt;&#xA;&lt;li&gt;Do an FFT over the whole sequence, create any bins you want in the frequency domain and simply integrate the energy in each bin. However this will discard all phase information.&lt;/li&gt;&#xA;&lt;li&gt;If you really need 32 bit equally spaced complex frequency bins for&#xA;a real valued input signal you can do &quot;half bin rotation&quot; of the&#xA;frequency sampling grid. You basically multiply your sequence with a&#xA;exp(-jw/N * (n/2)) before the FFT grid. YOur first bin would then go from 0Hz to 1378Hz instead from -689Hz to 689 Hz.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It really depends on how you want to do your frequency binning. Do you care about the location of center frequencies or the band edges? Do you need sharp edges or overlaps? Do you need amplitude and phase? Is the input real or complex? All this factors into the correct binning procedure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at the example of calculating the A-weighted sound pressure level from a time domain microphone signal. Your input is real valued, i.e. you can ignore the negative frequencies. You care about center frequencies but you need a log spaced grid. You want some overlap between the bands so that frequencies that are close to a band edge have some contribution in both bands. However the overlap should conserve energy, so the overall energy is frequency independent. We don't care about phase, so we can simply integrate energy inside a band to get a single number. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this example shows, frequency binning is application dependent on not as trivial as one might initially think. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-02-04T18:03:04.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1338" PostTypeId="2" ParentId="1334" CreationDate="2012-02-04T19:21:21.237" Score="7" Body="&lt;p&gt;It's great that you are interested in signal processing at that early stage of your educational path. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best path to get there is to read some introduction books on the topic. There are a lot of good and free online resources to get you started. [Note to the esteemed editor: good introduction books may a really good topic for a &quot;sticky&quot;].&#xA;I sometimes use &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.dsprelated.com/dspbooks&quot;&gt;http://www.dsprelated.com/dspbooks&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.dspguide.com/pdfbook&quot;&gt;http://www.dspguide.com/pdfbook&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One of the most important mathematical concepts you will need to get your arms around are “complex” numbers”. It’s clearly a misnomer since it’s really not that complicated and clearly makes nearly all engineering math a lot simpler. Another great free resource for all things math related is &lt;a href=&quot;http://www.khanacademy.org&quot;&gt;http://www.khanacademy.org&lt;/a&gt; and in this case specifically &#xA;&lt;a href=&quot;http://www.khanacademy.org/video/complex-numbers--part-1?topic=core-algebra&quot;&gt;http://www.khanacademy.org/video/complex-numbers--part-1?topic=core-algebra&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back to your first question: There are actually four different flavors of the Fourier Transform: Fourier Series (most likely to show up in high school), Fourier Transform, Discrete Fourier Transform and Discrete Fourier Series. All of them of them use a combination of both sine and cosine (or a complex exponential, which is essentially the same thing). You will need both. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let’s say you calculate the sine and cosine Fourier coefficients of an input sine wave. (Under certain conditions) you’ll find that all Fourier coefficients will be zero except for one cosine and one sine coefficient. However, depending on the phase of the input sine wave you these two numbers will move around. You may get [0.707 0.707], or [1 0], or [0 -1], or [-0.866 0.5] etc. You will see that the sum of the squares of those two numbers will always be 1, but the actual values depend on the phase of the input sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to deep dive, try this: &#xA;&lt;a href=&quot;http://www.dsprelated.com/dspbooks/mdft/&quot;&gt;http://www.dsprelated.com/dspbooks/mdft/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-02-04T19:21:21.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1339" PostTypeId="2" ParentId="1334" CreationDate="2012-02-05T00:49:01.247" Score="2" Body="&lt;p&gt;You might want to look at the materials available through&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The INFINITY Project: expanding signal-processing-based engineering education to the high school classroom&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;available &lt;a href=&quot;http://www.mendeley.com/research/the-infinity-project-expanding-signalprocessingbased-engineering-education-to-the-high-school-classroom/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-02-05T00:49:01.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1340" PostTypeId="1" AcceptedAnswerId="1393" CreationDate="2012-02-05T01:55:01.037" Score="5" ViewCount="1175" Body="&lt;p&gt;Hi I am a little confused on what the notation of the following statement means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_{k}(z)= H(W_{4}^{k} z), k = 0,...,3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It comes from a question in which I have designed a FIR low-pass filter $H(z)$ and my goal is to implement a DFT filter bank scheme like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MZMVd.png&quot; alt=&quot;Filter bank showing decimation by M points, application of filters $P_{k}(z)$, application of M-point DFT, output as signals y_{k}[m], and reconstruction in reverse&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exchange $P(z)$ for $H(z)$ and k would correspond to the subscript of P and M in this case is equal to 4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I am confused on how to find $H_{k}(z)$ or what exactly a polyphase filter is&lt;/p&gt;&#xA;" OwnerUserId="852" LastEditorUserId="3191" LastEditDate="2012-10-30T20:05:48.007" LastActivityDate="2013-07-02T09:56:32.700" Title="Polyphase filter notation" Tags="|filter-design|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1341" PostTypeId="1" AcceptedAnswerId="1342" CreationDate="2012-02-03T08:32:25.440" Score="2" ViewCount="1026" Body="&lt;p&gt;In the field of &lt;strong&gt;Gesture Recognition&lt;/strong&gt; and &lt;strong&gt;Speech Recognition&lt;/strong&gt; (using &lt;strong&gt;HMM classifiers&lt;/strong&gt;), do multiple HMM classifiers (one for each class) share common Codebook (i.e common set of symbols) in Vector Quantization? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If that is not the case&lt;/strong&gt;, how does the &lt;strong&gt;test/classification&lt;/strong&gt; stage work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To which Codebook the test input vector belongs to (we need this to determine the symbol, in turn which is fed to the HMM for classification)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some background info:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;One of the &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=223161&quot; rel=&quot;nofollow&quot;&gt;most earliest works&lt;/a&gt; done in &lt;strong&gt;Action Recognition&lt;/strong&gt; used different set of symbols for each of the HMM classifier.&lt;/li&gt;&#xA;&lt;li&gt;This &lt;a href=&quot;http://www.alcatel-lucent.com/bstj/vol62-1983/articles/bstj62-4-1075.pdf&quot; rel=&quot;nofollow&quot;&gt;journal&lt;/a&gt; in &lt;strong&gt;speech recognition&lt;/strong&gt; by Rabiner suggest using common Codebook (with different HMM classifiers) for identifying 10 digits uttered by large number of users (in page 12), &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="914" OwnerDisplayName="rahul" LastActivityDate="2012-02-05T03:28:02.473" Title="Vector Quantization in Hidden Markov Models" Tags="|computer-vision|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1342" PostTypeId="2" ParentId="1341" CreationDate="2012-02-03T20:04:40.563" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;do multiple HMM classifiers (one for each class) share common Codebook&#xA;  (i.e common set of symbols) in Vector Quantization?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, for example in large vocabulary speech recognition there is a big codebook of about 4000-10000 gaussians which are shared across 20-30k HMMs&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To which Codebook the test input vector belongs to (we need this to&#xA;  determine the symbol, in turn which is fed to the HMM for&#xA;  classification)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In modern ASR systems codebook defines a set of GMM probability distributions, not the discrete symbols. So &quot;belongs&quot; doesn't really have sense, it's more a probability value. But during the classification a test vector is usually evaluated for the subset of all codebooks which is active for this stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Active codebooks are tracked across test vectors based on active HMMs and preceeding history. Whole HMM set is pruned in order to get active ones. Usually there are about 10k active HMMs on each step and about 1k codebooks.&lt;/p&gt;&#xA;" OwnerUserId="3453" OwnerDisplayName="Nikolay Shmyrev" LastActivityDate="2012-02-04T20:08:35.727" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1344" PostTypeId="1" CreationDate="2012-02-05T05:15:06.287" Score="3" ViewCount="216" Body="&lt;p&gt;I am trying to produce ideal &lt;a href=&quot;http://en.wikipedia.org/wiki/Anisotropic_diffusion&quot; rel=&quot;nofollow noreferrer&quot;&gt;anisotropic diffusion&lt;/a&gt; outputs using the standard lena image. Using the first coefficient , the output is coming somewhat close to ideal ouput but when I increase the kappa value the bluring increases. When I am using the coefficient that prefers wide area diffusion over small areas,my output comes blurred dominantly.&#xA;I am providing the output images.!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;INPUT:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ooNAG.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DESIRED OUTPUT:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/LvarK.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OUTPUT1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2pAVG.png&quot; alt=&quot;output1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OUTPUT2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rK7sV.png&quot; alt=&quot;out2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GOT A CLOSE OUTPUT:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/wRG4N.png&quot; alt=&quot;I got this output with kappa 10 ,iterations 80 and selecting the wide area coefficient.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do i remove this blurring in images? because its hindering my research &lt;/p&gt;&#xA;" OwnerUserId="873" LastEditorUserId="128" LastEditDate="2023-07-08T11:44:48.563" LastActivityDate="2023-07-08T11:44:48.563" Title="Reducing the Blurriness of Anisotropic Diffusion" Tags="|image-processing|filters|edge-preserving-filter|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="1345" PostTypeId="2" ParentId="1336" CreationDate="2012-02-05T10:33:13.317" Score="5" Body="&lt;p&gt;I'm definitely not an expert here but you can start with edge detection (such as canny), then hough transform to detect circles, rectangles, squares, or triangles (based on the sign ou want to detect), then you can do template matching or histogram matching, if the colors are distinct enough (over the candidates returned by the hough transform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step (detecting the candidates using hough transform) is the harder step. I can think of many ways to try to detect whether that candidate is the sign or not. This is a fun problem. Enjoy solving it :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, I'm sure you can find good research articles that are highly related&lt;/p&gt;&#xA;" OwnerUserId="878" LastEditorUserId="878" LastEditDate="2012-02-05T10:38:23.513" LastActivityDate="2012-02-05T10:38:23.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1346" PostTypeId="1" AcceptedAnswerId="1348" CreationDate="2012-02-05T12:41:23.613" Score="0" ViewCount="1396" Body="&lt;p&gt;The impulse response is $h(t)=e^{-t}u(t)$  and input signal is $x(t)=1 + \frac{1}{2}cos(400πt)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find y(t)..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use $\int^{\infty}_{-\infty} h(τ)x(t-τ)dτ$ ,however i know that   $\int^{\infty}_{-\infty} h(t-τ)x(τ)dτ$  is equal.&lt;br&gt;&#xA;Is this the correct formula? &#xA;I tried to solve it but couldnt find come up to a solution..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;u(t) is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Heaviside_step_function&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Heaviside_step_function&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="714" LastActivityDate="2012-02-05T15:10:59.830" Title="Formula to compute output of a linear system" Tags="|impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1347" PostTypeId="2" ParentId="1336" CreationDate="2012-02-05T14:14:19.230" Score="17" Body="&lt;p&gt;Did you try something simple like correlation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;EDIT&lt;/strong&gt;). The idea behind correlation is to use a template (in your case a trained road sign sample), and compare it to every position in the test image. The comparison operation I've used to generate the images below is called normalized &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation#Normalized_cross-correlation&quot; rel=&quot;noreferrer&quot;&gt;cross-correlation&lt;/a&gt;. Roughly speaking, you standardize (mean=0, standard deviation=1) the pixels in the template and the image part you want to match, multiply them pixel by pixel, and calculate the mean value of the products. This way you get a &quot;match score&quot;, i.e. a measure of similarity between the template and the test image at every position in the test image. The position with the best match (highest correlation) is the most probably candidate for the position of the road sign.  (Actually, I've used the Mathematica function &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/CorrelationDistance.html&quot; rel=&quot;noreferrer&quot;&gt;CorrelationDistance&lt;/a&gt; to generate the image below, which is 1 - (normalized correlation). So the darkest spot in the match image corresponds to the best match). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have any other templates, so I simple cropped the sign from the second picture you posted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mECcU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though the template is rotated slightly, cross correlation still looks usable&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MH9pw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the best match is found at the right position:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z9cq2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You'd need multiple scaled versions of each template to detect signs at any size, of course)&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2012-02-08T07:44:12.673" LastActivityDate="2012-02-08T07:44:12.673" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1348" PostTypeId="2" ParentId="1346" CreationDate="2012-02-05T15:10:59.830" Score="3" Body="&lt;p&gt;It's correct. Here's the &lt;em&gt;general&lt;/em&gt; way how you can solve such a problem – in this specific example it would actually be easier to just solve the integral, but that seems indeed like homework you should be doing yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll call the step function $\Theta$, that's how we always call it in physics – hope it doesn't confuse, and the convolution&#xA;$$&#xD;&#xA;  (f\star g)(a) := \int_{\{(t,t&amp;#39;)\colon t+t&amp;#39;=a\}}\!\!\!\!\!\!\!\mathrm{d}(t,t&amp;#39;)\;f(t)\cdot g(t&amp;#39;) = \int_\mathbb{R}\!\mathrm{d}\tau\; f(\tau)\cdot g(t-\tau)&#xD;&#xA;$$&#xA;which is just the definition that you use. We know the convolution theorem&#xA;$$&#xD;&#xA;  \mathrm{FT}(f\star g)(\omega) = \frac1{\sqrt{2\pi}}\mathrm{FT}(f)(\omega)\cdot\mathrm{FT}(g)(\omega)&#xD;&#xA;$$&#xA;(the factor $\frac1{\sqrt{2\pi}}$ depends on your definition of the Fourier transform). To apply this to your problem first calculate&#xA;$$&#xD;&#xA;  \mathrm{FT}(h)(\omega) = \frac1{\sqrt{2\pi}}\int_\mathbb{R}\!\mathrm{d}t\; e^{-t}\Theta(t)\cdot e^{-i\omega t}&#xD;&#xA; = \frac1{\sqrt{2\pi}}\int\limits_0^\infty\!\mathrm{d}t\; e^{-t}\cdot e^{-i\omega t}&#xD;&#xA;$$&#xA;since the Heaviside function cancels everthing for $t&amp;lt;0$, then this is&#xA;$$&#xD;&#xA; = \frac1{\sqrt{2\pi}}\int\limits_0^\infty\!\mathrm{d}t\; e^{-(1+i\omega) t}&#xD;&#xA; = \frac1{\sqrt{2\pi}}\left.\left[\frac{e^{-(1+i\omega) t}}{-(1+i\omega)}\right]\!\!\right|_{t=0}^{\infty}&#xD;&#xA; = \frac1{\sqrt{2\pi}}\Bigl(\frac{0}1 - \frac{e^0}{-(1+i\omega)}\Bigr)&#xD;&#xA;$$&#xA;which is just $=1/(\sqrt{2\pi}\cdot(1+i\omega))$. Meanwhile,&#xA;$$&#xD;&#xA;  \mathrm{FT}(x)(\omega) = \mathrm{FT}(\lambda t.1)(\omega) + \tfrac12\mathrm{FT}(\lambda t.\cos(400\pi t))(\omega).&#xD;&#xA;$$&#xA;These Fourier transforms only exist in a distributional sense; it is known (can easily be shown by inverse $\mathrm{FT}$) that&#xA;$$&#xD;&#xA;  \mathrm{FT}(\lambda t.1) = \sqrt{2\pi}\;\delta&#xD;&#xA;$$&#xA;and&#xA;$$&#xD;&#xA;  \mathrm{FT}(\cos)(\omega) = \frac{\sqrt{2\pi}}{2}\bigl(\delta(\omega-1)+\delta(\omega+1)\bigr).&#xD;&#xA;$$&#xA;So we have&#xA;$$\begin{aligned}&#xD;&#xA;  \mathrm{FT}(y)(t) =&amp;amp; \frac{\sqrt{2\pi}\bigl(\delta(\omega)+\tfrac14\delta(\omega/400\pi-1)+\tfrac14\delta(\omega/400\pi+1)\bigr)}{\sqrt{2\pi}(1+i\omega)}&#xD;&#xA;  \\=&amp;amp; \frac{\bigl(\delta(\omega)+\tfrac14\delta(\omega/400\pi-1)+\tfrac14\delta(\omega/400\pi+1)\bigr)}{1+i\omega}&#xD;&#xA;\end{aligned}$$&#xA;and therefore&#xA;$$\begin{aligned}&#xD;&#xA;  y(t) =&amp;amp; \mathrm{IFT}(\ldots)(t)&#xD;&#xA;   = \frac1{\sqrt{2\pi}}\int_\mathbb{R}\!\mathrm{d}\omega\; e^{i\omega t}\frac{\bigl(\delta(\omega)+\tfrac14\delta(\omega/400\pi-1)+\tfrac14\delta(\omega/400\pi+1)\bigr)}{1+i\omega}&#xD;&#xA; \\=&amp;amp; \frac{e^0}{\sqrt{2\pi}\cdot 1} + \frac{e^{-400 i\pi t}}{\sqrt{2\pi}(1+\tfrac1{400\pi}i)} + \frac{e^{400 i\pi t}}{\sqrt{2\pi}(1-\tfrac1{400\pi}i)}&#xD;&#xA;\end{aligned}$$&#xA;We could know calculate this as an exact expression of trigonometric functions by writing out the $1\pm\tfrac{i}{400\pi}$ as a polar complex number.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2012-02-05T15:10:59.830" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1349" PostTypeId="2" ParentId="1336" CreationDate="2012-02-06T05:27:47.140" Score="6" Body="&lt;p&gt;Well, googling &lt;a href=&quot;http://bit.ly/XpIZPw&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;road way signs detection&lt;/code&gt;&lt;/a&gt; gives you plenty of good papers on this topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some uses color segmentation due peculiar blue,green,red colors etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some apply Gaussian smoothing first, then canny edge detection and contour finding to extract the sign board.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try following two links : &lt;a href=&quot;http://hassan.shojania.com/pdf/Real-time%20traffic%20sign%20detection-Presentation.pdf&quot; rel=&quot;nofollow&quot;&gt;Link 1&lt;/a&gt;, &lt;a href=&quot;http://www.bartlab.org/Dr.%20Jackrit%27s%20Papers/ney/1.TRAFFIC_SIGN_Lorsakul_ISR.pdf&quot; rel=&quot;nofollow&quot;&gt;Link 2&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="818" LastEditorUserId="80" LastEditDate="2013-04-09T12:11:28.590" LastActivityDate="2013-04-09T12:11:28.590" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1350" PostTypeId="2" ParentId="1334" CreationDate="2012-02-06T07:19:24.180" Score="1" Body="&lt;p&gt;DTFT Discrete Time Fourier Transform  takes a discrete Infinite Signal as its input and its output in frequency domain is continuous and has a period 2*pi.&#xA;Coming to the usage of it,in my experience DFT (Discrete Fourier Transform) is the one that gets used for practical purposes.&#xA;Under Certain conditions, it is easy to show that &#xA;DFT of a finite non-periodic Signal is nothing but equi-spaced samples of DTFT.&#xA;In general, if we zero pad the sequence in time (or space) domain we get more and more samples of the DTFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bottom line is DFT is very useful and DFT can be seen as equally spaced samples of DTFT, to get more samples of DTFT, doing a zero pad of the signal helps.&lt;/p&gt;&#xA;" OwnerUserId="891" LastActivityDate="2012-02-06T07:19:24.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1351" PostTypeId="1" CreationDate="2012-02-06T09:09:56.510" Score="3" ViewCount="330" Body="&lt;p&gt;I have chain contours representation:&#xA;- classic Freeman chain &#xA;- angle chain with distance (first: angle between neighbor points, second: distance between   them)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the best techniques to match them, and If it is possible figure out rotation of element?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now I tested approach with FFT(isn't it overuse for short chains?), shifting and comparing&#xA;For Freeman chains Pairwise Geometrical Histogram, but it figures out rotation only with 45 degree resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any sugestions, codes, references will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="583" LastActivityDate="2012-02-06T21:26:53.617" Title="Contours chains matching techniques" Tags="|image-processing|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1352" PostTypeId="2" ParentId="1340" CreationDate="2012-02-06T19:21:38.543" Score="1" Body="&lt;p&gt;One usage of the term polyphase filter is for a set of related FIR filters designed by sampling an impulse response (finite or windowed).  You can sample a waveform using slightly different starting points or offsets less than the sample rate spacing, or &quot;phases&quot;.  Use of a differently phased set of samples of the impulse response can be used in a FIR filter to create sub-sample delay effects, or as an interpolation method.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-02-06T19:21:38.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1353" PostTypeId="2" ParentId="1340" CreationDate="2012-02-06T19:48:06.663" Score="2" Body="&lt;p&gt;You are going to end up with 4 filters.&#xA;$$&#xD;&#xA;H_0(z), H_1(z), H_2(z), H_3(z)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are constructed by taking your original filter W(z) and dividing it into 1/4ths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe this terminology is telling you to take W(z) and skip every 4th item, starting at the kth item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;H(W_{4}^{k} z), k = 0,...,3&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although I am not certain about the terminology, I do know this is how you would split up a polyphase filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.E.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;H(W_{stride}^{start} z)&#xD;&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="919" LastActivityDate="2012-02-06T19:48:06.663" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1355" PostTypeId="2" ParentId="1351" CreationDate="2012-02-06T21:26:53.617" Score="3" Body="&lt;p&gt;I tried &lt;a href=&quot;http://www.codeproject.com/Articles/196168/Contour-Analysis-for-Image-Recognition-in-C&quot; rel=&quot;nofollow&quot;&gt;http://www.codeproject.com/Articles/196168/Contour-Analysis-for-Image-Recognition-in-C&lt;/a&gt; once. It did not work well for me, but that guy seem to have better results.&lt;/p&gt;&#xA;" OwnerUserId="922" LastActivityDate="2012-02-06T21:26:53.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1356" PostTypeId="1" AcceptedAnswerId="1558" CreationDate="2012-02-06T21:45:30.407" Score="-4" ViewCount="2016" Body="&lt;p&gt;I have this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pHkz8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After many preprocessing operations, I obtained this image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gdpsG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my goal is implementing one to many matching on my images for recognition purpose,i have 250 image for 50 persons (5 image/person) ,they are represented as: 0001hv1,0001hv2,0001hv3,0001hv4,0001hv5,0002hv1,.......  ,  now: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i ask if i can consider the preprocessed image as a feature vector in order to use dimensionality reduction algorithm such as PCA or SIFT or any other that enable me to do matching or not ?if it is not ,what are features may be suitable for creating feature vector?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;finally , i wish that my question is obvious , if it is not, i need only to know ,  which one i need to implement on preprocessed image , feature extraction or dimensionality reduction . sorry but my english language is not very good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards to all&lt;/p&gt;&#xA;" OwnerUserId="920" LastEditorUserId="920" LastEditDate="2012-02-24T16:55:46.950" LastActivityDate="2014-01-05T00:35:13.310" Title="how to extract features from this image ? what are the suitable features to be selected?" Tags="|image-processing|software-implementation|" AnswerCount="2" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="1357" PostTypeId="1" AcceptedAnswerId="1362" CreationDate="2012-02-06T21:47:43.057" Score="5" ViewCount="651" Body="&lt;p&gt;I have a couple of questions regarding windowed FFTs:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why is the noise floor higher with windowed FFTs (according to Wikipedia's spectral leakage page, anyway), when the whole point of windowing is to reduce side lobes?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I realize that different windows are better for different things, but is there a window that is considered to be the best all-around window for spectrum analysis?  Alternatively, is there a better way to do spectrum analysis than windowed FFTs?  It would have to be a DSP approach (i.e. I can't do an array of analog filters), but within that constraint I am game for different solutions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time in reading this.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="1629" LastEditDate="2016-05-18T08:14:06.977" LastActivityDate="2016-05-18T08:14:06.977" Title="Spectrum Analysis using Windowed FFTs" Tags="|fft|frequency-spectrum|window-functions|" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1358" PostTypeId="1" AcceptedAnswerId="1364" CreationDate="2012-02-06T23:00:38.463" Score="11" ViewCount="22063" Body="&lt;p&gt;I have consulted the almighty oracles of google and wiki, but I cannot seem to find a definition for the phrase &quot;the moment of the spectrum&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A legacy work text I am reading uses it in the following manner, defining the number of zero-crossings per unit time as the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ N_0 = \frac1{\pi} \left(\frac{m_2}{m_0}\right)^{1/2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It then goes on to further define the number of extrema per unit time as given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ N_e = \frac{1}{\pi}\left(\frac{m_4}{m_2}\right)^{1/2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where it goes on to finally say, &quot;where &lt;span class=&quot;math-container&quot;&gt;$m_i$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th moment of the spectrum.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone encounter this before? What is the &quot;moment&quot; of a spectrum? I have never heard of it in the DSP literature before. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="15892" LastEditDate="2019-02-23T12:38:19.590" LastActivityDate="2019-02-24T21:24:00.810" Title="What is meant by &quot;spectral moment&quot;?" Tags="|frequency-spectrum|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1359" PostTypeId="1" CreationDate="2012-02-06T23:07:42.167" Score="2" ViewCount="2575" Body="&lt;p&gt;I have the following image &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/krbMs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and after thresholding it, I obtained this result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ylo3B.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I remove all white pixels which do not belong to the original image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The desired output should look like this (I manually edited the image):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rXoub.jpg&quot; alt=&quot;desired output&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="920" LastEditorUserId="77" LastEditDate="2012-02-07T16:21:15.370" LastActivityDate="2012-02-07T16:21:15.370" Title="How do I remove all white pixels in a modified image which are not present in the original?" Tags="|image-processing|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1360" PostTypeId="2" ParentId="1359" CreationDate="2012-02-07T00:30:48.757" Score="4" Body="&lt;p&gt;Welcome to Image processing! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(See edit at the bottom)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understood you well, thresholding the image with a low threshold will provide a mask for the hand that you can use to remove the background pixels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's how it will look in Mathematica (&lt;code&gt;ImagePad&lt;/code&gt; here is just used to remove the extra white border on your images):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = ColorConvert[Import[&quot;https://i.stack.imgur.com/krbMs.jpg&quot;], &quot;Grayscale&quot;];&#xA;border = BorderDimensions[img];&#xA;img = ImagePad[img, -border]&#xA;&#xA;hand = Binarize[img, 0.2]&#xA;&#xA;thresholded = Binarize[ImagePad[Import[&quot;https://i.stack.imgur.com/ylo3B.jpg&quot;], -border], 0.1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sqrYJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to check &lt;a href=&quot;https://dsp.stackexchange.com/questions/1171/detect-and-isolate-veins-in-the-palm/&quot;&gt;this other question&lt;/a&gt; for an alternative segmentation technique based on ridge filtering. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Based on your comment, you would like to only work on the thresholded image and clean it up to leave only the components corresponding to veins. I would look at morphological operations (e.g. Opening, components selection based on shape properties). By the way I feel this is harder than working on a different vein segmentation algorithm (see one proposed above).&lt;/p&gt;&#xA;" OwnerUserId="602" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-02-07T12:13:45.143" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1362" PostTypeId="2" ParentId="1357" CreationDate="2012-02-07T01:19:57.920" Score="5" Body="&lt;p&gt;A non-rectangular window will remove &quot;noise&quot; from distant bins at the cost of adding more &quot;noise&quot; to the immediately adjacent bins to a narrow-band spectrum peak.  The sum of both these spectral leakage effects is greater than zero for a non-rectangular window. So if you count the raising of the level total of all adjacent bins as noise, then the S/N ratio is lowered.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some people don't care about the bins immediately adjacent to a spectrum peak (their spectral peaks are a priori assumed to be widely spaced; and/or they interpret, interpolate, or phase-vocoder adjust the energy out of those adjacent bins back into the central peak bin), so for those purposes, the reduced far-side-lobe energy means less noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another reason for a lower S/N ratio is that windowing of quantized data is an informationally lossy process, and these (re)quantization losses can also be considered a form of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Best&quot; is relative to some weighting of quality metrics, and different users may have very different weightings.  If you don't have a set of prioritized design goals for which to optimize a window, then you may not have a strong reason to not just use a Von Hann window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your data source and your needs, using just some windowed FFTs may not even be a good form of spectrum analysis, much less the best possible.  Or the opposite.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-02-07T22:07:22.570" LastActivityDate="2012-02-07T22:07:22.570" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1363" PostTypeId="2" ParentId="1358" CreationDate="2012-02-07T01:37:06.880" Score="3" Body="&lt;p&gt;I don't know that I've heard that term before, but I would interpret the term &quot;moment&quot; as having an analogous meaning to the physical concepts of center of mass and first and second moments of area:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;m_k=\int_{-\infty}^{\infty} f^kX(f)\ df&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, the content at every frequency in the spectrum is weighted by the $k$-th power of the frequency and the result is summed up across the entire spectrum. Not sure if this is what you want, but it's a concept of a moment for a spectrum (or any function of a single variable, for that matter).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-02-07T01:37:06.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1364" PostTypeId="2" ParentId="1358" CreationDate="2012-02-07T02:48:08.087" Score="9" Body="&lt;p&gt;Assume low-pass signals&#xA;throughout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $X(f)$ is usually complex-valued, using the power spectrum $|X(f)|^2$ &#xA;is probably a better idea, especially if you want to take square roots &#xA;etc. afterwards. Thus, $m_k$ is defined as&#xA;$$m_k = \int_{-\infty}^\infty f^k |X(f)|^2 \mathrm df.$$&#xA;Note in particular that $m_0$ is the power in the signal, and $m_1 = 0$&#xA;Now, the &lt;em&gt;Gabor bandwidth&lt;/em&gt; $G$ of a signal is given by&#xA;$$G = \sqrt{\frac{\displaystyle \int_{-\infty}^\infty f^2 |X(f)|^2 \mathrm df}{\displaystyle\int_{-\infty}^\infty |X(f)|^2 \mathrm df}} = \sqrt{\frac{m_2}{m_0}}.$$&#xA;To put this in a slightly different perspective, $|X(f)|^2$ is a nonnegative function,&#xA;and the &quot;area under the curve $|X(f)|^2$,&quot; viz. $m_0$, is the power in the signal.  Therefore, $|X(f)|^2/m_0$ is effectively a &lt;em&gt;probability density function&lt;/em&gt; of &#xA;a zero-mean random variable whose variance is&#xA;$$\sigma^2 = \int_{-\infty}^\infty f^2 \frac{|X(f)|^2}{m_0} \mathrm df&#xD;&#xA;= \frac{\displaystyle\int_{-\infty}^\infty f^2 |X(f)|^2 \mathrm df}{\displaystyle\int_{-\infty}^\infty |X(f)|^2 \mathrm df} = G^2$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sinusoid of frequency $G$ Hz has $2G = 2\sqrt{\frac{m_2}{m_0}}$ &#xA;zero crossings per second.  Since Mohammad is reading a legacy book,&#xA;it may well be doing all this in radian frequency $\omega$, and thus&#xA;if $G$ is the Gabor bandwidth in radians per second, we need to divide&#xA;by $2\pi$ giving&#xA;$$N_0 = \frac{1}{\pi} \sqrt{\frac{m_2}{m_0}} ~ \text{zero crossings per second.}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning to extrema, the &lt;em&gt;derivative&lt;/em&gt; of $x(t)$ has Fourier transform&#xA;$j2\pi f X(f)$ and power spectrum $|2\pi f X(f)|^2$.  &lt;strong&gt;Its&lt;/strong&gt; Gabor&#xA;bandwidth is &#xA;$$\begin{align*}G^\prime &amp;amp;= \sqrt{\frac{\displaystyle\int_{-\infty}^\infty f^2 |2\pi f X(f)|^2 \mathrm df}{\displaystyle\int_{-\infty}^\infty |2\pi f X(f)|^2 \mathrm df}}\\&#xD;&#xA;&amp;amp;= \sqrt{\frac{\displaystyle\int_{-\infty}^\infty f^4 |X(f)|^2 \mathrm df}{\displaystyle\int_{-\infty}^\infty f^2 |X(f)|^2 \mathrm df}}\\&#xD;&#xA;&amp;amp;= \sqrt{\frac{m_4}{m_2}}.&#xD;&#xA;\end{align*}$$&#xA;Using the same arguments as before (two zero-crossings of the derivative&#xA;per period is the same as two extrema per period), radian versus&#xA;Hertzian frequency, we get&#xA;$$N_e = \frac{1}{\pi} \sqrt{\frac{m_4}{m_2}} ~ \text{extrema per second.}$$&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-02-07T02:58:06.170" LastActivityDate="2012-02-07T02:58:06.170" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1365" PostTypeId="1" CreationDate="2012-02-07T06:27:44.907" Score="17" ViewCount="8151" Body="&lt;p&gt;What is the best filter for removing Gaussian noise without destroying the edges? I am using the standard Lena images with additive Gaussian noise and I want to denoise before applying anisotropic diffusion. I don't want to median filter because edges become blurred. I tried adaptive filtering but results were not satisfactory.&lt;/p&gt;&#xA;" OwnerUserId="873" LastEditorUserId="128" LastEditDate="2019-06-24T17:59:10.777" LastActivityDate="2019-06-24T17:59:10.777" Title="How to Remove Gaussian Noise from an Image without Destroying the Edges?" Tags="|image-processing|filters|noise|" AnswerCount="3" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="1366" PostTypeId="1" AcceptedAnswerId="1398" CreationDate="2012-02-07T09:25:08.520" Score="2" ViewCount="253" Body="&lt;p&gt;I have Analog to Digital converter from which I get data of measurements of 1kg load.&#xA;The aim is to model the simple spring-damper system, so that after entering correct initial data (x[0] = a, x'[0] = b) the model will give almost the same data as the original data from converter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is my first modeling attempt of a such real system. The problem is that the data from converter contains the 50Hz noise (electricity frequency) and if I use FIR filter I am afraid that the initial values needed for modeling the same wave data will be corrupted. How this process is done usually? As for modeling equation I use mx'' = -kx - c x'. And I have made numerical solution for this equation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 1: How about not filtering but modeling the system with taking into account the electrical noise?&lt;/p&gt;&#xA;" OwnerUserId="505" LastEditorUserId="505" LastEditDate="2012-02-10T03:06:19.177" LastActivityDate="2012-02-10T11:34:57.920" Title="Modeling spring oscilliations with electric noise (50 hz)" Tags="|filters|frequency|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1367" PostTypeId="2" ParentId="1366" CreationDate="2012-02-07T13:55:04.970" Score="2" Body="&lt;p&gt;If the interference from line power isn't so large that it is distorting your ADC's output (i.e. the large 50 Hz component isn't driving the dynamic range of the overall sampled signal), then you could design a notch filter to remove the narrowband line frequency component. Choosing the best way to implement such a filter depends upon the computational resources that you have, the type of arithmetic that you will use, other requirements on the filter (how wide can the notch be? how flat does the passband have to be?), etc. &lt;a href=&quot;http://www.dsprelated.com/showmessage/81610/1.php&quot; rel=&quot;nofollow&quot;&gt;Here is a description of how to design a second-order IIR notch filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency drifts over time sufficiently enough that you can't just place a static notch in the spectrum that is wide enough to cover its entire range, then you may need to consider an adaptive approach. This is significantly more complicated, but it is possible to build a periodic interference suppressor using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_mean_squares_filter&quot; rel=&quot;nofollow&quot;&gt;least-mean squares (LMS) filter&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-02-07T13:55:04.970" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1369" PostTypeId="1" CreationDate="2012-02-07T16:22:49.110" Score="7" ViewCount="1139" Body="&lt;p&gt;I'm attempting to use a filter to scale an image and for the most part, I have something that appears to work.  But now I want to be able to generate a filter with an optimal number of taps.  I know in general that the more taps, the better.  But there are diminishing returns in how much each additional tap will increase the quality of the image.  So how would one go about picking a number of taps that makes a good tradeoff between implementation complexity and image quality?  Are there standard measurements that would allow different filters to be evaluated to some &quot;ideal&quot; filter?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Thinking about this more, I think this is really two questions.  One is a matter of deciding which windowed sinc to use (in this case, I've already settled on using lanczos2 or 3) -- that is a more general question that has various tradeoffs depending on the application.  But once that decision is made, the number of taps is easily determined.  For lanczos2, the ideal number of taps is 4 and for lanczos3, the ideal number of taps is 6.  The reason it's not 5 or 7 is that one of those taps will always be zero due to the windowing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the more general case, I think the easy way to state how many taps to have for a given window is to simply say:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;taps = max - min&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the case of lanczos2, the max is 2 and the min is -2.  Therefore, taps = 4.&lt;/p&gt;&#xA;" OwnerUserId="932" LastEditorUserId="77" LastEditDate="2012-02-15T06:58:43.740" LastActivityDate="2017-04-03T09:26:25.107" Title="How do you choose the optimal number of taps in a windowed image scaling filter?" Tags="|image-processing|filters|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1370" PostTypeId="1" CreationDate="2012-02-07T01:43:41.300" Score="16" ViewCount="4854" Body="&lt;p&gt;I have been experimenting some weeks to find a way to match/find similar Songs in a Library containing different Genres of Music.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first try was to Detect Features like Tempo or how much Bass there is in Songs to form groups, but I didnt get far with this approach (Volume Changes Based Beat Detection) since on about 20% of the Songs Beat dont have to be counted always, sometimes 1/2 or 1/3 of them and I couldnt implement that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some weeks of failed trying I got a new idea which is described later in this Post. Simply put it works by taking Spectrum Samples of Files, making something like an &quot;Average Spectrum&quot; of Files to compare them.&#xA;The Idea behind was that for example Hardstyle has a lot more Bass than average Rock Music, I also verified this by looking at some Spectrums in Audacity.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;File 1: Take full File FFT Spectrums (2048 Sample Size atm,Amplitudes Log. scaled)&lt;/li&gt;&#xA;&lt;li&gt;Sum all Spectrum Arrays, take Averages of each Bin&lt;/li&gt;&#xA;&lt;li&gt;Do the same some other Files, store all Results&lt;/li&gt;&#xA;&lt;li&gt;Make List of FFT Values Differencies between File 1 and other Files&lt;/li&gt;&#xA;&lt;li&gt;Make Average of Differencies between File 1 and File X&lt;/li&gt;&#xA;&lt;li&gt;Sort Ascending by these Averages&lt;/li&gt;&#xA;&lt;li&gt;Songs with the Lowest &quot;Difference Value&quot; are considered to be Similar.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can some of you who have good knowledge tell me if this would be the right/good way to implement my Idea?&lt;/p&gt;&#xA;" OwnerUserId="934" OwnerDisplayName="gfg" LastEditorUserId="76" LastEditDate="2012-02-12T15:21:19.090" LastActivityDate="2012-02-12T15:21:19.090" Title="Find similar Music using FFT Spectrums" Tags="|audio|fft|music|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1371" PostTypeId="1" CreationDate="2012-02-07T18:43:24.957" Score="3" ViewCount="395" Body="&lt;p&gt;Is it possible to determine the resulting pixel values and modify them before the compressed jpeg image is actually created?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I'm at the stage where I already have the quantized DCT coefficients of the original image and I want to change all pixels of the resulting image with a &lt;code&gt;(255, 255, 0)&lt;/code&gt; value to &lt;code&gt;(255, 254, 0)&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I was thinking is, if this is possible I would need to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get the equivalent DCT coefficient of original image and do quantization&lt;/li&gt;&#xA;&lt;li&gt;Determine the resulting pixel values and do desired changes&lt;/li&gt;&#xA;&lt;li&gt;Obtain the new DCT coefficients that will result to it&lt;/li&gt;&#xA;&lt;li&gt;Proceed to Huffman encoding&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Can the following be done during Huffman encoding?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get the equivalent DCT coefficient from YCbCr and do quantizations&lt;/li&gt;&#xA;&lt;li&gt;Do Huffman encoding and modify the desired pixel&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="933" LastEditorUserId="8330" LastEditDate="2014-03-26T22:10:41.517" LastActivityDate="2014-03-26T22:10:41.517" Title="Determining the resulting pixel value before creating a compressed JPEG image" Tags="|image-processing|dct|compression|jpeg|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1372" PostTypeId="1" AcceptedAnswerId="1386" CreationDate="2012-02-07T21:37:14.993" Score="5" ViewCount="290" Body="&lt;p&gt;I'm creating an app (I'm a software developer) that for different sounds (interjections from the user) will do different things.&#xA;For example if the user says:&lt;br/&gt;&#xA;&quot;Tiu&quot;, than it will do task A,&lt;br/&gt; &#xA;if it will say &quot;Tou&quot; than it will do task B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In digital sound, what's the difference between sound (user interjection) &quot;Tiu&quot; and &quot;Tou&quot;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a fast way to say when the user said &quot;Tiu&quot; and when it said &quot;Tou&quot;, I don't want to use word/speech recognition because it is too slow for my needs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm mainly interested in the theoretical part of digital sounds. E.g. how can I put in the &quot;Tiu&quot; and &quot;Tou&quot; the following sounds &quot;Ti Tiau Tiuu Tiiiu Too Toou Taou&quot;, what are their common &quot;features&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(1) edit&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading the answers, I must confess that I'm new to speech recognition and any similar domain. I didn't new in what I'm getting myself with this app. But overall the research is fun because I love algorithms and math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Where I am now?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am reading/researching/learning about &#xA;&lt;strong&gt;&lt;em&gt;CMUSphinx Open Source Toolkit For Speech Recognition&lt;/em&gt;&lt;/strong&gt; &lt;a href=&quot;http://cmusphinx.sourceforge.net/wiki/tutorial&quot; rel=&quot;nofollow&quot;&gt;http://cmusphinx.sourceforge.net/wiki/tutorial&lt;/a&gt;. I don't think that I will use this toolkit but it has a good explanation of the basis in Speech Recognition: &lt;strong&gt;&lt;a href=&quot;http://cmusphinx.sourceforge.net/wiki/tutorialconcepts&quot; rel=&quot;nofollow&quot;&gt;Basics of Speech&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also after reading the responses, I ended to the conclusion that a training phase might be quite helpful, anyway I'm investigating more on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;New Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you now any good reading material that might help me in gaining more knowledge in this particular domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can the recording device help me in identifying &quot;tou&quot; and &quot;tiu&quot;? e.g. if the device supports different recording filters - like low frequency filters etc...?&lt;/p&gt;&#xA;" OwnerUserId="935" LastEditorUserId="935" LastEditDate="2012-02-12T12:44:08.730" LastActivityDate="2012-02-12T12:44:08.730" Title="How do the English pronunciations of &quot;tiu&quot; and &quot;tou&quot; differ?" Tags="|audio|speech-recognition|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1374" PostTypeId="1" AcceptedAnswerId="1394" CreationDate="2012-02-08T04:01:24.223" Score="3" ViewCount="7559" Body="&lt;p&gt;I created the lowpass filter &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = firls(100, [0 .2 .25 1], [ 1 1 0 0],[.001 60]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My goal is to get four filters  $H_{k}(z) = H(W_{4}^{k}z)  k =0,1,2,3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my knowledge to get the polyphase components you would do the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{0}(z) = \sum h(4n)z^{-n}$&lt;br&gt;&#xA;$H_{1}(z) = \sum h(4n+1)z^{-n}$&lt;br&gt;&#xA;$H_{2}(z) = \sum h(4n+2)z^{-n}$&lt;br&gt;&#xA;$H_{3}(z) = \sum h(4n+3)z^{-n}$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this in matlab i just did\&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; h0=h(1:4:end);&#xA; h1=h(2:4:end);&#xA; h2=h(3:4:end);&#xA; h3=h(4:4:end);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't seem to produce the right results.... If anyone can clarify how to do polyphase decomposition in mat lab or tell me what I am doing wrong I would appreciate it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal x[n] that is a FDM (frequency Division Multiplex) signal made up of four real valued baseband signals interpolated by a value of of 4 and modulated using the complex carrier $e^{j \frac{2*pi*k}{4}n}$  thefour base band signals are added to make the FDM signal x[n].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to estimate each of the 4 base band signals using the polyphase components of the lowpass filter.  The matlab code I am using is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = firls(100, [0 ,2 ,.25 1], [ 1 1 0 0],[.001 60]);&#xA;h0=h(1:4:end);&#xA;h1=h(2:4:end);&#xA;h2=h(3:4:end);&#xA;h3=h(4:4:end);&#xA;&#xA;%first baseband signal&#xA;y0 = conv(x,h0);  &#xA;y0 = downsample(y0, 4);  &#xA;y0 = abs(fft(y0));  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are the 4 estimated baseband signals I get compared to the actual&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kagE6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The polyphase components don't seem to be changing anything&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried setting up the filters like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Lowpass Filter&#xA;h0 = firls(100, [0 .2 .25 1], [1  1 0  0],[.001 60]);&#xA;h1 = firls(100, [0 .2 .25 1], [1  1 0  0],[.001 60]);&#xA;h2 = firls(100, [0 .2 .25 1], [1  1 0  0],[.001 60]);&#xA;h3 = firls(100, [0 .2 .25 1], [1  1 0  0],[.001 60]);&#xA;figure(1)&#xA;impz(h);&#xA;figure(2);&#xA;freqz(h);&#xA;&#xA;% PolyPhase Componets&#xA;h0(2:4:end)=0;&#xA;h0(3:4:end)=0;&#xA;h0(4:4:end)=0;&#xA;&#xA;h1(1:4:end)=0;&#xA;h1(3:4:end)=0;&#xA;h1(4:4:end)=0;&#xA;&#xA;h2(1:4:end)=0;&#xA;h2(2:4:end)=0;&#xA;h2(4:4:end)=0;&#xA;&#xA;h3(1:4:end)=0;&#xA;h3(2:4:end)=0;&#xA;h3(3:4:end)=0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and ended up with these plots&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O6YFZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;still seems to be something wrong&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(NOTE: Orange is actual signals.  Blue is my estimate.)&lt;/p&gt;&#xA;" OwnerUserId="852" LastEditorUserId="852" LastEditDate="2012-02-08T06:37:55.993" LastActivityDate="2012-04-19T14:33:03.380" Title="Polyphase Decomposition in Matlab" Tags="|filter-design|homework|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1375" PostTypeId="1" AcceptedAnswerId="1377" CreationDate="2012-02-08T07:07:29.810" Score="2" ViewCount="1004" Body="&lt;p&gt;in my program there are stereo cameras. The cameras were stereo calibrated. I have a set of 2D-Points from left image (for example, it could be some Harris Corners from left images). And the task is to estimate 3D position of this points with the reference to left camera. I started first with the estimation of corresponding points in image from right camera. I used &lt;code&gt;OpticalFlow&lt;/code&gt;. Than this points were put in &lt;code&gt;cvTriangulatePoints()&lt;/code&gt; function. But the estimated points in right camera image are not correct. My question is, is there some other method to get 3D position if I just know coordinates 2D points from left camera image?&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="865" LastActivityDate="2012-02-08T12:01:18.887" Title="Triangulation from set of points from left camera" Tags="|computer-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1376" PostTypeId="2" ParentId="1375" CreationDate="2012-02-08T09:56:51.940" Score="2" Body="&lt;p&gt;If you could know the 3D position from only one camera, what would be the use of stereo vision?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to match two points found in both cameras, and then you can use epipolar geometry to approximate the 3D position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example your Harris Corners should have roughly the same features in both images to be a match.&lt;/p&gt;&#xA;" OwnerUserId="809" LastActivityDate="2012-02-08T09:56:51.940" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1377" PostTypeId="2" ParentId="1375" CreationDate="2012-02-08T12:01:18.887" Score="3" Body="&lt;p&gt;You don't need to estimate points in the second image, you need to match them.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way is to take a patch of pixels around the point in one image and see which of the points in the second image has a patch most &quot;alike&quot;.  One very simple way to do this is to take the sum of the squares of the difference between each pixel in the left-patch and the corresponding pixel in the right-patch.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2012-02-08T12:01:18.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1378" PostTypeId="1" AcceptedAnswerId="1384" CreationDate="2012-02-08T13:46:33.853" Score="3" ViewCount="254" Body="&lt;p&gt;The images given below are a result of fruit defect detection algorithm i have made myself...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Just wanted to know is there a way of outlining these defects?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original image 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dqgdq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1st Image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MXgbD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original image 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r4CNG.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;2nd Image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UxRzi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i want to achieve is this :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;img src=&quot;https://i.stack.imgur.com/d6yxs.jpg&quot; alt=&quot;enter image description here&quot;&gt;        =&gt;      2. &lt;img src=&quot;https://i.stack.imgur.com/5Dniu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="654" LastEditorUserId="654" LastEditDate="2012-02-08T17:54:11.033" LastActivityDate="2012-02-09T17:27:38.493" Title="How to outline a defect in an image?" Tags="|image-processing|filters|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1382" PostTypeId="2" ParentId="1372" CreationDate="2012-02-09T01:15:00.770" Score="4" Body="&lt;p&gt;Since the differences are only in the vowels, formant detection should do the trick. A vowel typically has periodic excitation, i.e you have a fundamental and harmonic frequencies. The sound gets generated in your throat by the vocal chords (glottis). &#xA;Your vocal tract (mouth, lips, tongue, upper throat, nasal cavities etc.) create specific resonances that control the relative strength of the harmonics. By moving these parts about you change the acoustic resonance and hence relative harmonic strength. That is then perceived as different vowels. If you stand in front of a mirror and say slowly AAAEEEEIIIIUUUUOOOO you will see exactly what I mean (it's fun to watch:-)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The vocal spectrum has typically two local peaks in it. These are called &quot;formants&quot;. The frequency of the first and second formant defines the vowel. This can be shown in a 2-dimensional graph referred to as formant map. Here is an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.phy.davidson.edu/fachome/dmb/digitalspeech/formantmap.gif&quot;&gt;http://www.phy.davidson.edu/fachome/dmb/digitalspeech/formantmap.gif&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've figured out the frequencies of the two formants you can look up the map and find the vowel (nor no-mans land if you are out of luck). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sounds in your examples have multiple vowels so you need to track the positions of the formants over time and you will get a line on the map (not just a single point). Formant detection is by no means a trivial exercise and many a PhD thesis has been written on the topic. The best approach depends on your application (one speaker vs. multiple speaker, is there a training phase, how big is the vocabulary, how clean is your pickup, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formant maps are also highly language and dialect dependent. In fact that's the of the main differences between for example Irish, British, Scottish, Australian, and various US flavors of English.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-02-09T01:15:00.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1383" PostTypeId="2" ParentId="1370" CreationDate="2012-02-09T02:13:15.097" Score="17" Body="&lt;p&gt;What you are trying to do has been tried over and over by hundreds of researchers and there is quite a large body of work about this. Check the proceedings of the ISMIR conference. Even if it is not up to date, read Elias Pampalk's thesis : &lt;a href=&quot;http://www.ofai.at/~elias.pampalk/publications/pampalk06thesis.pdf&quot;&gt;http://www.ofai.at/~elias.pampalk/publications/pampalk06thesis.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To quickly orient you on the right track:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Music can be similar according to many dimensions: a) timbre/texture/genre ; b) rhythmic pattern ; c) melody/chord progression... and more! From your message it's not clear what you want to measure!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you are interested in a) the features you might want to look at are MFCC (Mel Frequency Cepstrum Coefficients), since they somehow capture the way human hearing works (frequency warping, log scale), since they are decorrelated (making modeling easier), and since they have lower dimensionality (13 coefficients vs 2048).&lt;/li&gt;&#xA;&lt;li&gt;If you are interested in b), look at a feature called &quot;Fluctuation Patterns&quot; (Pampalk, in short autocorrelation of the signal in the 0.1 .. 10 Hz range over a few bands) ; or Whitman's &quot;Penny&quot; features (FFT of the MFCC along the time axis).&lt;/li&gt;&#xA;&lt;li&gt;If you are interested in c), look at chromagrams. Start with Ellis' chromagram code (http://labrosa.ee.columbia.edu/matlab/chroma-ansyn/) then move up to Mauch's implementation if you need something more robust (http://isophonics.net/nnls-chroma).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That's for the features. Now you'll have to think of a better way to compare your songs once they have been represented as a sequence of those features. Computing pairwise differences between sequences is not very smart - eg: comparing a song and the same song offset by some silence will yield a difference while it is exactly the same! You'd rather compare the distribution of those features ; for example compute the mean / standard deviation of the features over song A and the mean / standard deviation of the features over song B and then take a probabilistic distance (KL, Bhattacharyya over those).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last point, but which will matter later: computing the distance between a song and the rest of the corpus to find the nearest matches is quite inefficient. When dealing with large collections, techniques like LSH or Ball trees allow such nearest neighbors queries to be performed without explicit comparison with the whole corpus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an aside, tempo detection is an entirely different matter. If you want to look into it, best performance / accessibility paper on the topic is Ellis' Beat Tracking by Dynamic Programming. &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/pubs/Ellis07-beattrack.pdf&quot;&gt;http://www.ee.columbia.edu/~dpwe/pubs/Ellis07-beattrack.pdf&lt;/a&gt; . It's incredibly simple but is close to state of the art algorithms.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-09T02:28:27.760" LastActivityDate="2012-02-09T02:28:27.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1384" PostTypeId="2" ParentId="1378" CreationDate="2012-02-09T11:30:38.783" Score="4" Body="&lt;p&gt;As far as I understand what you call defects are detcted by changes in color of the fruit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would proceed as follow:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;edge detection algorithm, (as you did), to detect the fruit region in the image.&lt;/li&gt;&#xA;&lt;li&gt;In this region, compute the median color, that is the color that matches the most pixels (for example, it would be some kind of yellow for a banana)&lt;/li&gt;&#xA;&lt;li&gt;For each  pixel in the fruit region, check the distant between the median computed at step 2 and the color of the pixel. If the distance is high, mark the pixel as defect&lt;/li&gt;&#xA;&lt;li&gt;At the end, apply some morphological operator to remove outliers&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="824" LastEditorUserId="26" LastEditDate="2012-02-09T17:27:38.493" LastActivityDate="2012-02-09T17:27:38.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1386" PostTypeId="2" ParentId="1372" CreationDate="2012-02-09T16:26:05.763" Score="5" Body="&lt;p&gt;First of all, don't expect an answer like &quot;Compute such and such well-known function on the data and if the result is above such or such value it's tiuuu otherwise it's tou&quot;. You won't get anything robust or reliable with approaches like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good representations of sound which can be used for this kind of discrimination task are either the Mel Frequency Cepstral Coefficients (MFCC) or the linear prediction coefficients (Compute the first 20 or so autocorrelation coefficients and use the Levinson-Durbin recursion to get the AR coefficients). Both are somehow independent of pitch (good), moderately robust to noise (good but can be better), but are still somewhat speaker and gender dependent. It's still a vast improvement over trying to guess formants from a spectrum and matching that to a per-phoneme table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does your application tolerate a training phase? If so, get your user to record a dozen of utterances of each word ; and use this as a training set for a simple bayesian classifier using a gaussian model. Use this classifier to discriminate new utterances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does your application need realtime processing? If not, you can get by with clustering. Record the whole &quot;sentence&quot;, split it into &quot;words&quot; ; compute average feature vectors over each word ; and run K-means clustering to get 2 class out of it. One class will be &quot;tou&quot; and the other &quot;tiu&quot;. The class whose &quot;words&quot; have the lowest average spectral centroid are likely to be the &quot;tou&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A last word on speech recognition: if you have a vocabulary of two words, the cost of running a decent speech recognition toolchain will be that of:&#xA;* Computing the MFCC features (which you have to do anyway no matter what).&#xA;* Scoring a dozen of gaussians (which you have to do anyway).&#xA;* Finding the lowest cost paths in a FST with less than a dozen states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is quite pedestrian and nowhere near the complexity of natural language speech recognition. Since you have no experience in digital signal processing, doing so will probably be faster than whatever custom code you might write. Thus I very strongly suggest you to collect a small training corpus of utterances from people around you and start looking into &quot;off the shelf&quot; speech recognition toolboxes like &lt;strong&gt;HTK&lt;/strong&gt;. Just using the built-in tools you will be able to train a model evaluate it on your data without writing code.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-09T16:26:05.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1387" PostTypeId="2" ParentId="1292" CreationDate="2012-02-09T16:48:25.813" Score="1" Body="&lt;p&gt;Your input is a low-res spectrogram-like representation $X(m, n)$ where m is the frame index and n the band (subrange index). Right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I suggest:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each n:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Compute the autocorrelation $r_n(l)$ of the sequence $X(:, n)$&lt;/li&gt;&#xA;&lt;li&gt;Compute any peakedness measure of $r_n(l)$ for a lag l in the 0.05 to 2 Hz range (8 to 31 assuming a 50% overlap between frames).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Pick the subband with highest autocorrelation peakedness (= the more &quot;pitchy&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peakedness measures to look at:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;maximum of the normalized autocorrelation over the considered range. $\max_{l \in L} \frac{r_n(l)}{r_n(0)}$&lt;/li&gt;&#xA;&lt;li&gt;kurtosis&lt;/li&gt;&#xA;&lt;li&gt;ratio of geometric to arithmetic mean&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These kind of metrics are eg used to distinguish voiced/unvoiced speech.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-09T16:48:25.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1388" PostTypeId="2" ParentId="1292" CreationDate="2012-02-09T17:18:25.760" Score="4" Body="&lt;p&gt;Daniel, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon re-reading your question, it appears that what I have learned to be known as the 'Gabor Bandwidth&quot; might be useful to you in this case, for you trying to measure 'spectral variability'. (Dilip provided a good answer to my question on &lt;a href=&quot;https://dsp.stackexchange.com/questions/1358/what-is-meant-by-spectral-moment&quot;&gt;Spectral Moments&lt;/a&gt; here). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I studied it further, the Gabor-Bandwidth seems to really just be a measure of how 'spread' the spectrum is from its mean. (Hence the manipulation of moments). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look and see what you think.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-02-09T17:18:25.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1389" PostTypeId="1" CreationDate="2012-02-09T18:25:14.367" Score="6" ViewCount="12502" Body="&lt;p&gt;The properties aren't entirely clear to me, sorry for the basic question.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the Fourier Transform of one function.  Say, $\text{rect}(x,y) \Leftrightarrow \frac{\sin \pi u}{\pi u} \frac{\sin \pi v}{\pi v}$.  Now, I have some related function and I want to easily get the FT based on simple properties. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, now I have something like $\frac{1}{3}\text{rect}(8x - 4, 4y - 2)$.  How does this shift and scale inside the function affect its (continuous) Fourier Transform?&lt;/p&gt;&#xA;" OwnerUserId="946" LastEditorUserId="6" LastEditDate="2012-02-09T19:13:11.417" LastActivityDate="2022-03-03T14:11:16.613" Title="How does shift and scaling inside of a function affect its Fourier Transform?" Tags="|fourier-transform|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1390" PostTypeId="2" ParentId="1389" CreationDate="2012-02-09T20:09:57.137" Score="10" Body="&lt;p&gt;For one-dimensional Fourier transforms,&#xA;$$\begin{align*}&#xD;&#xA;x(t) &amp;amp;\leftrightarrow X(f)\\&#xD;&#xA;x(t-a) &amp;amp;\leftrightarrow X(f)\exp(-j2\pi fa)\\&#xD;&#xA;x(bt) &amp;amp;\leftrightarrow \frac{1}{|b|}X\left(\frac{f}{b}\right)&#xD;&#xA;\end{align*}$$&#xA;all of which are proved by change of variables in the definition of the&#xA;Fourier transform&#xA;$$X(f) = \int_{-\infty}^{\infty} x(t)\exp(-j2\pi ft) \mathrm dt.$$&#xA;It is good exercise to work out the details of each of these results &#xA;at least once in one's life, and once one has done so, the two-dimensional case&#xA;is as easy as rolling off a log.  If you &lt;em&gt;always&lt;/em&gt; look up the answers in a table&#xA;of Fourier transform properties, the right result will never come to mind just when&#xA;you need it most.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, it is a good idea to remember these results in graphic&#xA;terms.  If $x(t)$ is a signal with Fourier transform $X(f)$, and $b &amp;gt; 1$,&#xA;say $b = 2$,&#xA;then $y(t) = x(2t)$ is a &lt;em&gt;time-compressed&lt;/em&gt; form of $x(t)$: while $y(0) = x(0)$,&#xA;$y(3) = x(6)$, that is, $6$ seconds worth of $x(t)$ have been squeezed down &#xA;into $3$ seconds worth of $y(t)$.  Thus, the frequencies have doubled, and so&#xA;$Y(f)$ should be something like $X(f/2)$ (but see below).  More generally,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Compressing the time axis by a factor of $b$ expands &#xA;  the frequency axis by a factor of $b$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But that is not the complete answer.  One of the more boring results in Fourier&#xA;transform that everyone tends to ignore is&#xA;$$y(0) = \int_{-\infty}^{\infty} Y(f) \mathrm df.$$&#xA;But, &#xA;$$y(0) = x(0) = \int_{-\infty}^{\infty} X(f) \mathrm df$$&#xA;and since we have stretched the horizontal axis by a factor of $b$&#xA;in going from $X(f)$ to $X(f/b)$, we better reduce the magnitude of each&#xA;frequency component by a factor of $b$ so that the two integrals (= area&#xA;under the curve) work out to have the same value, that is,&#xA;$$Y(f) = \frac{1}{b}X\left(\frac{f}{b}\right), ~~ b &amp;gt; 0.$$&#xA;The result for $b &amp;lt; 0$ can be worked out similarly.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-02-09T20:40:30.483" LastActivityDate="2012-02-09T20:40:30.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1393" PostTypeId="2" ParentId="1340" CreationDate="2012-02-09T21:25:57.600" Score="3" Body="&lt;p&gt;Hk are modulations of the low pass filter (band pass instead of low pass).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;(W_{4}^{k}) = e^{-2j\pi k /4}.&#xD;&#xA;$$&#xA;For $z = e^{j\omega}$: $$H(W_{4}^{k} z) = H(e^{j(\omega-2\pi k/4)})$$&#xA;This means that the filters $H_k$ are shifted in frequency- these are the band pass filters you want to get using your filter bank.&#xA;For $k=0$ $H_0$ will pass the frequencies $[\frac{-\pi}{4} \frac{\pi}{4}]$, for $k=1,[\frac{\pi}{4} \frac{3\pi}{4}]$ etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the DFT filter bank scheme, &#xA;$y_0[m]$ are the outputs from $H_0$ , $y_1[n]$ are the outputs from $H_1$ and so on.&lt;/p&gt;&#xA;" OwnerUserId="947" LastEditorUserId="6" LastEditDate="2012-02-09T21:45:40.337" LastActivityDate="2012-02-09T21:45:40.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1394" PostTypeId="2" ParentId="1374" CreationDate="2012-02-09T22:19:05.323" Score="2" Body="&lt;p&gt;It seems I was missing the concept all together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phrase $ H_{k}(z)=H(W_{4}^kz) k= 0,1,2,3$ given the lowpass filter H(z) represents the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = h_{0} + h_{1}+h_{2}+h_{3}$$&#xA;$$H_{0}(z) = h_{0} + h_{1}e^{\frac{-j2\pi*0*1}{4}}+h_{2}e^{\frac{-j2\pi*0*2}{4}}+h_{3}e^{\frac{-j2\pi*0*3}{4}}$$&#xA;$$H_{1}(z) = h_{0} + h_{1}e^{\frac{-j2\pi*1*1}{4}}+h_{2}e^{\frac{-j2\pi*1*2}{4}}+h_{3}e^{\frac{-j2\pi*1*3}{4}}$$&#xA;$$H_{2}(z) = h_{0} + h_{1}e^{\frac{-j2\pi*2*1}{4}}+h_{2}e^{\frac{-j2\pi*2*2}{4}}+h_{3}e^{\frac{-j2\pi*2*3}{4}}$$&#xA;$$H_{3}(z) = h_{0} + h_{1}e^{\frac{-j2\pi*3*1}{4}}+h_{2}e^{\frac{-j2\pi*3*2}{4}}+h_{3}e^{\frac{-j2\pi*3*3}{4}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{0},H_{1},H_{2},H_{3}$ represent the polyphase components of filter $H(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get these componets in mat lab i used &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Lowpass Filter&#xA;N = 100;&#xA;h = firls(N, [0 .2 .25 1], [1  1 0  0],[.001 .0001]);&#xA;&#xA;% PolyPhase Componets&#xA;for i=1:length(h),&#xA;h0(i)=h(i);&#xA;end&#xA;&#xA;for i=1:length(h),&#xA;h1(i)=h(i)*exp((-j*2*pi*((i-1)))/4);&#xA;end&#xA;&#xA;for i=1:length(h),&#xA;h2(i)=h(i)*exp((-j*2*pi*(2*(i-1)))/4);&#xA;end&#xA;&#xA;for i=1:length(h),&#xA;h3(i)=h(i)*exp((-j*2*pi*(3*(i-1)))/4);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;using these components I was able to get the right estimations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/spxLA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="852" LastActivityDate="2012-02-09T22:19:05.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1395" PostTypeId="1" AcceptedAnswerId="1396" CreationDate="2012-02-09T22:43:20.583" Score="10" ViewCount="2406" Body="&lt;p&gt;I'm looking for a formula to effectively compress an audio waveform to limit peaks.  This isn't an &quot;automatic volume control&quot; application where one would control amplifier gain to maintain a volume level, but rather I want to limit (&quot;soft&quot; truncate) individual peaks.  (I know this introduces harmonics, but I'm trying to analyze the data, not listen to it.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My (very crude) formula so far is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;factor = (10 * average / level) + exp(-sqrt(0.1 * level / average))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;em&gt;level&lt;/em&gt; is the instantaneous sound level, &lt;em&gt;average&lt;/em&gt; is the historical average sound level, and &lt;em&gt;factor&lt;/em&gt; is a multiplier used to produce the &quot;adjusted&quot; level (&lt;em&gt;factor&lt;/em&gt; times &lt;em&gt;level&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, this multiplier is only applied if it computes to a value less than 1.  Otherwise &lt;em&gt;level&lt;/em&gt; is left unadjusted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intent is to limit the adjusted level to some multiple (about 15x with this formula) of the historical average.  This formula is sorta what I need, but exhibits a &quot;dip&quot; as the numbers get larger.  That is, the adjusted level (ie, &lt;em&gt;factor&lt;/em&gt; times &lt;em&gt;level&lt;/em&gt;) increases up to a point with increasing unadjusted level but then, rather than going asymptotic, begins to actually get smaller.  (In fact, the first factor was added primarily to prevent the formula from going to zero with extremely high values.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The reason for wanting to limit the values this way is primarily so transient noise doesn't seriously upset the running average of the sound level.  But when you're analyzing snores &quot;transient noise&quot; is quite significant, so I can's simply squelch it.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, can anyone suggest something better?  (It seems that asymptotic behavior is easy to produce when you don't want it, but hard when you do.)&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="29" LastEditDate="2016-01-30T03:40:17.433" LastActivityDate="2018-12-29T15:16:44.037" Title="peak limiting/audio compression formula needed" Tags="|noise|dynamic-range-compression|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1396" PostTypeId="2" ParentId="1395" CreationDate="2012-02-10T00:48:27.577" Score="10" Body="&lt;p&gt;Two problems here: how to get a reliable estimate of the level, and how to compress the data.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use robust statistics on the original (not peak-limited) data like median or quantiles instead of a running average to make your &quot;typical level&quot; detection robust to outliers.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$k \times \tanh(\frac{x}{k})$&lt;/span&gt; works nice as a &lt;span class=&quot;math-container&quot;&gt;$C^\infty$&lt;/span&gt; compression formula and it is actually what is happening in some audio circuits (using OTAs). To get adaptive compression that preserves the dynamics of the original signal and just remove transients, make k track the smoothed &quot;average&quot; level.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PpnJu.png&quot; alt=&quot;example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Blue: original signal&lt;/li&gt;&#xA;&lt;li&gt;Green: 2 x median of the absolute value over a sliding window as a &quot;typical level&quot; detection&lt;/li&gt;&#xA;&lt;li&gt;Red: tanh compression (formula given above with k equal to the level plotted in green)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="26573" LastEditDate="2018-12-29T15:16:44.037" LastActivityDate="2018-12-29T15:16:44.037" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1398" PostTypeId="2" ParentId="1366" CreationDate="2012-02-10T10:19:06.547" Score="4" Body="&lt;p&gt;The problem is that just taking the x[0] and x'[0] of your observed data and plugging them into the differential equation will be extremely sensitive to any kind of noise ; not only the 50Hz hum. You are trusting those two samples (rather than the entirety of your observed data) for your estimation, and you will get incorrect results from that, whether the 50Hz noise is present or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to do it right? First, get rid of the 50Hz noise with a notch filter tuned to 50Hz and maybe to a few harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, what you want to do is fit the parameters $A$ and $\phi$ of a $x(n) = A e^{-\delta n} sin(\omega n + \phi)$ model to your data $y(n) = x(n) + noise$. You already know $\delta$ and $\omega$ since they depend on your known system parameter (damping and oscillation frequency). What you really want to know is the best estimate of $A$ and $\phi$ to reconstruct the &quot;theoretical&quot; part (in proper speak: signal subspace projection) of your observation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how you can estimate $A$ and $\phi$ without lame methods involving looking at peaks and zerocrossing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can write your signal model as $x(n) = Re (\alpha z^n) = \frac{1}{2}\alpha z^n - \frac{1}{2} \bar{\alpha} \bar{z}^n$ where $z$ is the known complex pole $z = e^{-\delta + j\omega}$, $\alpha$ is the complex amplitude $\alpha = Ae^{j \phi}$ and $\bar{z}$ denotes the conjugate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lay out a $N\times2$ matrix where N is your number of observation, the first column being $\frac{1}{2} [1, z, \ldots, z^N]$ and the second $-\frac{1}{2} [1, \bar{z}, \ldots, \bar{z}^N]$. Do a least square regression of that matrix (which is a basis of your signal subspace) onto the data matrix $[y(1), \ldots, y(N)]$. This will give you LS estimates of $\alpha$ and $\bar{\alpha}$ as the two solutions. Take the modulus and angle of the first to get $A$ and $\phi$. Plug this back into $A e^{-\delta n} sin(\omega n + \phi)$ to get the best fit theoretical model from your data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Estimate amplitude and phase of an exponentially damped model&#xA;# given observations y and system parameters delta and omega&#xA;n = numpy.arange(y.shape[0])&#xA;z = numpy.exp(-n * delta + n * omega * 1j)&#xA;z_conj = numpy.vstack((0.5 * z, -0.5 * numpy.conj(z))).T&#xA;s, _, _, _ = numpy.linalg.lstsq(z_conj, y)&#xA;print &quot;Estimated amplitude: &quot;, numpy.abs(s[0])&#xA;print &quot;Estimated phase: &quot;, numpy.angle(s[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to also estimate $\delta$ and $\omega$ the procedure is a tad more complex and involves an EVD or SVD of the correlation matrix of your data to get a signal subspace basis, one more EVD to get the estimate of $z$, then the procedure sketched above to retrieve $A$ and $\phi$. You will have a robust estimate of all the parameters of the theoretical model from your data. Search for ESPRIT or MUSIC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this approach can be used to estimate the phase / frequency of a mixture of any number of damped sine waves. So for example, you could use this to retrieve the amplitude and phase of the 50Hz hum itself. Just put two additional columns in the matrix used for the least square procedure, with powers of $e^{j\omega_{noise}}$ and their conjugates. This will give the best fit amplitudes and phases of an exponentially damped sine wave (described by omega and delta) + 50 Hz hum model.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-10T11:34:57.920" LastActivityDate="2012-02-10T11:34:57.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1399" PostTypeId="1" CreationDate="2012-02-10T11:44:46.423" Score="9" ViewCount="4234" Body="&lt;p&gt;How to find &lt;strong&gt;MOD-2 Circular convolution&lt;/strong&gt; for the two sequences $h =[-1,3,-2,1]$ and $x = [1,-1,-2,1,3,2,1,2]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the answer is $7$ $0$ from matlab but I don't know how to find it graphicly or mathematically&lt;/p&gt;&#xA;" OwnerUserId="948" LastEditorUserId="1473" LastEditDate="2012-06-08T07:50:03.413" LastActivityDate="2015-12-07T16:57:09.020" Title="MOD-N Circular Convolution" Tags="|discrete-signals|convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1400" PostTypeId="2" ParentId="1399" CreationDate="2012-02-10T12:53:51.627" Score="5" Body="&lt;p&gt;One approach is to &quot;re-wrap&quot; a full size circular convolution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sum(reshape(ifft(fft(x, 8) .* conj(fft(h, 8))), 2, 8 / 2), 2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another implementation is to directly decimate the FFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 2;&#xA;Xf = fft(x); Xf = Xf(1:length(Xf) / N:end);&#xA;Hf = fft(h); Hf = Hf(1:length(Hf) / N:end);&#xA;ifft(Xf .* conj(Hf))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If what you want to reproduce is the behavior of cconv from matlab it might be best to just look at its source code in the matlab files :)&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-10T12:53:51.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1401" PostTypeId="2" ParentId="1399" CreationDate="2012-02-10T13:22:44.603" Score="8" Body="&lt;p&gt;Write $h(z) = -1 + 3z -2z^2 + z^3$ and compute $h(z) \bmod (z^2 - 1)$, that is,&#xA;divide $h(z)$ by $z^2 - 1$ and take just the remainder.  While this looks&#xA;very complicated, if you think about it a bit you will see that all you&#xA;are doing is dividing $[-1\quad3\ -2\quad 1]$ into $[-1\quad 3]$ and &#xA;$[-2\quad 1]$ and&#xA;adding the shorter vectors to get $[-3\quad 4]$.  Repeat for&#xA;$x = [1 \ -1\ -2\quad 1 \quad 3 \quad 2\quad 1 \quad 2]$ to add &#xA;four vectors of length $2$ to get &#xA;$[3\quad 4]$.  This is presumably not too hard to do in MATLAB though I am &#xA;not familiar enough with the syntax to suggest&#xA;specific commands.  Next, compute the cyclic convolution&#xA;of $[-3\quad 4]$ and $[3\quad 4]$ &lt;strong&gt;preferably without invoking MATLAB functions.&lt;/strong&gt;&#xA;The result is &#xA;$$[\{(-3)\times 3 + 4\times 4\}\quad \{(-3)\times 4 + 4 \times 3\}]&#xD;&#xA;= [7\quad 0]$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, what you are doing is computing $h(z)x(z) \bmod (z^2-1)$&#xA;which can be done fancily by first finding $h(z)x(z)$ using FFTs and what &#xA;have you followed by the $\bmod (z^2-1)$ computation (this effectively&#xA;chops up the long vector into short pieces and adds them), or more simply&#xA;by first computing $\hat{h}(z) = h(z) \bmod (z^2-1)$ and &#xA;$\hat{x}(z) = x(z) \bmod (z^2-1)$ (the chopping up into shorter vectors&#xA;and adding them) and then computing the cyclic convolution &#xA;$\hat{z}(z)\hat{x}(z) \bmod (z^2 - 1)$ which is easy to do.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Chop-add-convolve is easier than convolve-chop-add&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-02-10T13:32:54.573" LastActivityDate="2012-02-10T13:32:54.573" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1402" PostTypeId="1" AcceptedAnswerId="1404" CreationDate="2012-02-10T16:18:15.773" Score="2" ViewCount="138" Body="&lt;p&gt;I have a 3D shape in a 3D binary image. Therefore, I have a list of all of the x,y,z points. If I am to analyze this shape for various identification, such as &quot;sphericity&quot;, volume, surface area, etc., what are some of the choices do I have here?&lt;/p&gt;&#xA;" OwnerUserId="263" LastActivityDate="2012-02-10T22:22:15.053" Title="Tools for 3D shape analysis" Tags="|shape-analysis|3d|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1403" PostTypeId="1" AcceptedAnswerId="1405" CreationDate="2012-02-10T21:59:08.080" Score="5" ViewCount="4357" Body="&lt;p&gt;Heads up, this is for homework.  I never took a signals and systems course, so I'm behind on this stuff.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to compute the convolution of two rectangular regions.  I know the standard equation for convolution, where the integrals are from $-\infty$ to $\infty$, but it is useful to restrict the integration to the areas that matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have one function that has a value of $1/3$ when $-0.5 \le x \le 0.5$ and $0 \le y \le 0.4$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a second function that has a value of $1$ when $-1/50 \le x,y \le 1/50$.  Where would the bounds for integration be for convolving functions like this?&lt;/p&gt;&#xA;" OwnerUserId="954" LastActivityDate="2012-02-11T15:37:09.463" Title="When convolving two functions that are constants in a region and 0 everywhere else, where does the integration start?" Tags="|homework|continuous-signals|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1404" PostTypeId="2" ParentId="1402" CreationDate="2012-02-10T22:22:15.053" Score="2" Body="&lt;p&gt;To approximate the &lt;strong&gt;volume&lt;/strong&gt; ($V_{counted}$) you need to count all the voxels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To roughly approximate the &lt;strong&gt;surface area&lt;/strong&gt; ($A_{approx}$) count all the voxels that have an &quot;empty&quot; voxel as a neighbor. (Have a look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Marching_cubes&quot; rel=&quot;nofollow&quot;&gt;Marching cubes&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Marching_tetrahedrons&quot; rel=&quot;nofollow&quot;&gt;Marching tetrahedrons&lt;/a&gt; for more inspiration and a more detailed discussion on how to determine a surface element).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to determine the &lt;strong&gt;sphericity&lt;/strong&gt; I would calculate the minimal bounding box$^1$, take the largest axis and regard it as the diameter: $V_{calc} = \frac{4}{3}\pi r^3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your features ($f_{vol}$, $f_{area}$, $f_{sphere}$, $\dots$) should be in the interval $[0, 1]$ (or 0% - 100%) you simply need to divide the smaller value by the larger value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{vol}(V_{counted}, V_{ref}) = \frac{\min(V_{counted}, V_{ref})}{\max(V_{counted}, V_{ref})}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{area}(A_{approx}, A_{ref})$ and $f_{sphere}(V_{counted}, V_{calc})$ accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{compactness} \tilde{=} f_{sphere}$, since a sphere is the most compact volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope you can understand, what I am trying to say, and hopefully the answer you are looking for is somewhere in here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$^1$ if your data is not aligned, you may have to align it first (PCA). &lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2012-02-10T22:22:15.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1405" PostTypeId="2" ParentId="1403" CreationDate="2012-02-10T23:04:21.420" Score="8" Body="&lt;p&gt;For simplicity, let's talk about one-dimensional convolutions only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to understand that the result of a convolution is a &lt;strong&gt;function&lt;/strong&gt; and the alleged convolution integral is actually an infinitude of integrals, one for each time instant.  By this I mean that to compute the output $y(t)$ of a system with impulse response &#xA;$h(t)$ to an input signal at time $t = 5$, we write&#xA;$$\begin{align*}&#xD;&#xA;y(5) &amp;amp;= \int_{-\infty}^\infty h(\tau)x(5-\tau)\mathrm d\tau,\\&#xD;&#xA;\end{align*}$$&#xA;and compute $y(5)$.  For $t = 6.5$, we write&#xA;$$\begin{align*}&#xD;&#xA;y(6.5) &amp;amp;= \int_{-\infty}^\infty h(\tau)x(6.5-\tau)\mathrm d\tau,\\&#xD;&#xA;\end{align*}$$&#xA;and compute $y(6)$.  For $t = 10.2$, we write&#xA;$$\begin{align*}&#xD;&#xA;y(10.2) &amp;amp;= \int_{-\infty}^\infty h(\tau)x(10.2-\tau)\mathrm d\tau,\\&#xD;&#xA;\end{align*}$$&#xA;and compute $y(10.2)$.and so on.  After doing this a while, some smart-ass &#xA;said, &quot;Hey Ma, I am beginning to see a pattern here!  Lookit, I can&#xA;write&#xA;$$\begin{align*}&#xD;&#xA;y(t) &amp;amp;= \int_{-\infty}^\infty h(\tau)x(t-\tau)\mathrm d\tau, ~\text{for all} ~t\\&#xD;&#xA;\end{align*}$$&#xA;and the world was never the same again.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that $h(t)$ is $0$ for $t &amp;lt; 0$ or $t &amp;gt; 12$.  Then &lt;em&gt;all&lt;/em&gt; the integrals&#xA;exhibited above simplify in the sense that the limits can be changed to&#xA;$0$ and $12$ since the integrand, being a multiple of $h(\tau)$, is $0$&#xA;when $\tau &amp;lt; 0$ or $\tau &amp;gt; 12$.  Suppose in addition that $x(t)$ is nonzero&#xA;only when $|t| &amp;lt; 3$.  Now look at the first integral (for $y(5)$ with the&#xA;limits changed to $0$ and $12$).  At $\tau = 0$, the integrand is&#xA;$h(0)x(5-0) = 0$ since $x(5) = 0$.  As $\tau$ increases towards $12$, the&#xA;argument of $x$ in the integrand decreases from $5$ downwards till the &#xA;argument hits $-7$ at $\tau = 12$.  Thus, the integrand is nonzero&#xA;&lt;em&gt;only&lt;/em&gt; for $\tau \in (2,8)$, having value $h(2)x(5-2) = h(2)x(3)$&#xA;at one end of the interval and value $h(8)x(5-8) = h(8)x(-3)$ at&#xA;the other.  We conclude that&#xA;$$y(5) = \int_{-\infty}^\infty h(\tau)x(5-\tau)\mathrm d\tau&#xD;&#xA;= \int_{0}^{12} h(\tau)x(5-\tau)\mathrm d\tau&#xD;&#xA;= \int_{2}^{8} h(\tau)x(5-\tau)\mathrm d\tau.$$&#xA;Similarly,&#xA;$$y(6.5) = \int_{-\infty}^\infty h(\tau)x(6.5-\tau)\mathrm d\tau&#xD;&#xA;= \int_{0}^{12} h(\tau)x(6.5-\tau)\mathrm d\tau&#xD;&#xA;= \int_{3.5}^{9.5} h(\tau)x(6.5-\tau)\mathrm d\tau.$$&#xA;However,&#xA;$$y(10.2) = \int_{-\infty}^\infty h(\tau)x(10.2-\tau)\mathrm d\tau&#xD;&#xA;= \int_{0}^{12} h(\tau)x(10.2-\tau)\mathrm d\tau&#xD;&#xA;= \int_{7.2}^{12} h(\tau)x(10.2-\tau)\mathrm d\tau$$&#xA;(can you see why?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, there is not a simple answer to your question about the&#xA;limits of integration; you have to work them out for each &#xA;value of $t$ for which you want to evaluate the convolution&#xA;integral. But you don't have to do an infinite amount of&#xA;work!  There are Look Ma moments here and there.  Can you&#xA;combine two of the results above to write that for each $t$,&#xA;$3 \leq t \leq 9$, we have the useful pattern&#xA;$$y(t) = \int_{t-3}^{t+3} h(\tau)x(t-\tau)\mathrm d\tau$$&#xA;shown above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this will help you gain the understanding that&#xA;you need in order to complete your homework.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-02-11T15:37:09.463" LastActivityDate="2012-02-11T15:37:09.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1406" PostTypeId="1" AcceptedAnswerId="1408" CreationDate="2012-02-10T23:08:04.273" Score="16" ViewCount="15964" Body="&lt;p&gt;I am trying to understand the &lt;a href=&quot;http://www.dspguide.com/ch8/2.htm&quot; rel=&quot;noreferrer&quot;&gt;real DFT&lt;/a&gt; and the DFT and why the distinction exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I know so far the DFT uses $e^{i2\pi kn/N}$ for basis vectors and gives the representation $$x[n]=\sum_{k=0}^{N-1}X[k]e^{i2\pi kn/N}$$ The sum is written from $k=0$ to $N-1$ for historical reasons I think instead of writing it in a way analogous to the Fourier series with the sum going from $k=-N/2$ to $N/2-1$: $$x[n]=\sum_{k=-N/2}^{N/2-1}X[k]e^{i2\pi kn/N}$$&#xA;This relying on a peculiar anomoly of the DFT where high frequencies are the same as negative frequencies: $e^{i2\pi kn/N}=e^{i2\pi (k-N)n/N}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuing the analogy with Fourier Series the real DFT gives the representation&#xA;$$x[n]=\sum_{k=0}^{N/2}\left(X_R[k]\cos\left(\frac{2\pi kn}{N}\right)-X_I[k]\sin\left(\frac{2\pi kn}{N}\right)\right)$$&#xA;This can be viewed as pairing $e^{i2\pi kn/N}$ with $e^{-i2\pi kn/N}$ in the DFT representation where the sum ranges from $k=-N/2$ to $N/2-1$. This is very much like the pairing $c_n e^{in\theta}+c_{-n}e^{-in\theta}=a_n \cos n\theta + b_n \sin n\theta$ which connects the two representations of a Fourier Series:$$\sum_{-\infty}^\infty c_n e^{in\theta}= \frac{a_0}{2} + \sum_1^{\infty}(a_n \cos n\theta + b_n \sin n\theta)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt; then is why is the DFT so much more prevalent than the real DFT? One would expect that since the real DFT is using real valued sines and cosines as the basis and is thus representing the geometric picture better that people would like it more. I can see why the DFT and the continuous Fourier Transform would be preferred in a theoretical sense as the algebra of exponentials is simpler. But ignoring the simpler algebra, from a practical computational applied viewpoint why would the DFT be more useful? Why would representing your signal with complex exponentials be more useful in various physics, speech, image, etc. applications than decomposing your signal into sines and cosines. Also if there is anything subtle I'm missing in my above exposition I would like to know: I'm puzzled that the DFT is seen as more connected to the continuous Fourier Transform than to the Fourier Series.&lt;/p&gt;&#xA;" OwnerUserId="955" LastEditorUserId="1629" LastEditDate="2016-09-08T19:08:05.030" LastActivityDate="2023-11-15T17:01:16.753" Title="Real discrete Fourier transform" Tags="|dft|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1408" PostTypeId="2" ParentId="1406" CreationDate="2012-02-11T03:11:48.540" Score="8" Body="&lt;p&gt;The advantage of the complex DFT or complex Fourier transform or&#xA;complex Fourier series is that &lt;em&gt;linear&lt;/em&gt;&#xA;systems have the nice property that the response to $A\exp(j\omega t)$ is&#xA;$H(\omega)A\exp(j\omega t)$.  (Here $A$ can be a complex constant).&#xA;So the output is just a scalar multiple of the input.&#xA;More importantly, if we have a representation of the input&#xA;as a weighted sum of complex exponentials, the output is&#xA;just &lt;em&gt;another weighted sum&lt;/em&gt; of the &lt;em&gt;same&lt;/em&gt; exponentials.  Different&#xA;weights, but &lt;em&gt;same set of exponentials&lt;/em&gt;. Furthermore, each new weight&#xA;is obtained by multiplying the old weight by an appropriate number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, no physical system has complex-values&#xA;signals going in and coming out; at least, not as of today though&#xA;one can always hope for better things in the future.  In the mean time,&#xA;we take real parts of the complex signals, or get the response to $\cos(\omega t)$ or&#xA;$\sin(\omega t)$ via linearity and superposition and liberal use of&#xA;$$\begin{align*}&#xD;&#xA;\cos(\omega t) &amp;amp;= \frac{\exp(j\omega t) + \exp(-j\omega t)}{2}\\&#xD;&#xA;\sin(\omega t) &amp;amp;= \frac{\exp(j\omega t) - \exp(-j\omega t)}{2j}&#xD;&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, the response to $\cos(\omega t)$ is of the form &#xA;$B(\omega)\cos(\omega t) + C(\omega)\sin(\omega t)$.  So,&#xA;while linearity and superposition etc all work, the output&#xA;might well need the use of &lt;em&gt;different&lt;/em&gt; basis functions than the &#xA;input does.  Very closely related, of course, but still possibly&#xA;different and maybe more  basis functions might be needed. For&#xA;example, input $\cos(\omega t)$ is represented by one basis function,&#xA;output $B(\omega)\cos(\omega t) + C(\omega)\sin(\omega t)$ by&#xA;two basis functions.  It can be argued that complex functions&#xA;require twice as much work as real functions and so any savings&#xA;are purely imaginary (pun intended), but complex representations allow&#xA;&lt;em&gt;uniform treatment&lt;/em&gt; while sin/cos representations do not.  Quick!&#xA;Given the response to $\cos(\omega t)$ is &#xA;$B(\omega)\cos(\omega t) + C(\omega)\sin(\omega t)$, &#xA;what is the response to $\sin(\omega t)$?  You have to work at it&#xA;a bit, you may need to invoke formulas such as &#xA;$$\cos (\alpha + \beta) = \cos(\alpha)\cos(\beta) - \sin(\alpha)\sin(\beta)$$&#xA;and so on.  With complex exponentials, life is a lot easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, as in real life, your mileage may vary, and if you feel&#xA;that sin/cos representations are the way to go and complex&#xA;exponentials should be eschewed, you are free to follow your heart.&#xA;If you have difficulty communicating your ideas to colleagues, &#xA;bosses, clients or consultants, that will be their loss, not yours.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-02-11T03:11:48.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1409" PostTypeId="1" AcceptedAnswerId="1444" CreationDate="2012-02-10T02:14:31.770" Score="7" ViewCount="8089" Body="&lt;p&gt;I am reading &quot;The Scientist and Engineer's Guide to Digital Signal Processing&quot; and trying to understand &lt;a href=&quot;http://www.dspguide.com/ch3/3.htm&quot; rel=&quot;noreferrer&quot;&gt;Figure 3.5&lt;/a&gt; below which is about the sampling theorem and aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand the picture of the frequency domain. The signal can be represented as&#xA;$$f(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty}F(x)e^{ixt}dx$$&#xA;where $F(x)$ is the Fourier transform of $f$. This represents $f$ with the &quot;frequencies&quot; $e^{ixt}$ and these can have $x$ negative. How then am I suppose to understand Figure 3-5 which shows the frequency domain for only greater than zero and moreover real and not complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also why does the frequency domain of the impulse train have the original frequency spectrum appear flipped half the time? My current understanding is that the repetition comes from something like&#xA;$$\mathcal{F^{-1}} \{f(t)\Delta(t)\} = F(x)*\Delta(x)$$&#xA;where $\Delta$ is the dirac comb and probably some kind of constant like $2\pi$ is needed in there somewhere. How does the flipping half the time in the frequency domain arise from $F(x)*\Delta(x)$. The image I think for convolution is that $\Delta$ is flipped and as it is moved to the right by $s$ the &quot;area&quot; of $F(x)\Delta(s-x)$ is the value of the convolution at $s$. This would seem to replicate the original spectrum multiple times but without the flipping half the time as shown in Figure 3.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LjOzr.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="955" OwnerDisplayName="user782220" LastEditorUserId="128" LastEditDate="2019-03-25T08:28:25.003" LastActivityDate="2019-03-25T08:28:25.003" Title="Sampling Theorem and Dirac Comb" Tags="|sampling|convolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1410" PostTypeId="2" ParentId="1409" CreationDate="2012-02-10T03:27:30.743" Score="4" Body="&lt;p&gt;For real-valued signals $f(t)$, the plots of $|\mathcal{F}\{f\}(x)|$ you show are symmetric across the real axis, because $\mathcal{F}\{f\}(-x) = \overline{\mathcal{F}\{f\}(x)}$ (the overbar to the right of the equality indicates complex conjugation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also explains the &quot;flipping&quot; you observe, I think. Imagine the top right subplot in your figure reflected across the x-axis; it's &lt;em&gt;that&lt;/em&gt; spectrum which is being duplicated due to finite sampling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{align*}&#xD;&#xA;\mathcal{F}\{f\}(-x) &amp;amp;= \int_{t=-\infty}^{t=\infty} f(t) e^{-2\pi i t(-x)} dt&#xD;&#xA;\\&#xD;&#xA;&amp;amp;= \int_{t=-\infty}^{t=\infty} f(t) \cos(2\pi t(-x)) dt - i\int_{t=-\infty}^{t=\infty} f(t) \sin(2\pi t(-x)) dt&#xD;&#xA;\\&#xD;&#xA;&amp;amp;= \overline{\int_{t=-\infty}^{t=\infty} f(t) \cos(2\pi t(-x)) dt + i\int_{t=-\infty}^{t=\infty} f(t) \sin(2\pi t(-x)) dt}&#xD;&#xA;\\&#xD;&#xA;&amp;amp;= \overline{\int_{t=-\infty}^{t=\infty} f(t) e^{2\pi i t(-x)} dt}&#xD;&#xA;\\&#xD;&#xA;&amp;amp;= \overline{\int_{t=-\infty}^{t=\infty} f(t) e^{-2\pi i tx} dt}&#xD;&#xA;\\&#xD;&#xA;&amp;amp;= \overline{\mathcal{F}\{f\}(x)}&#xD;&#xA;\end{align*}$&lt;/p&gt;&#xA;" OwnerUserId="964" OwnerDisplayName="sydeulissie" LastEditorUserId="964" LastEditDate="2012-02-13T03:17:03.130" LastActivityDate="2012-02-13T03:17:03.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1411" PostTypeId="1" AcceptedAnswerId="1419" CreationDate="2012-02-11T12:00:22.533" Score="5" ViewCount="4851" Body="&lt;p&gt;I am trying to think how can I program a SW that can recognize Chords on the fly.&#xA;since I know nothing about music, Can I assume that the chords are orthogonal and unique? I guess I can since it is linear combination of sinusoidal signals in different frequencies.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;a. What is the rate I have to sample the song? &#xA;&#xA;b. Are the chords unique?&#xA;&#xA;c. Can I assume I can store and have all the chords? Is it a finite set?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I found &lt;a href=&quot;https://dsp.stackexchange.com/questions/1370/find-similar-music-using-fft-spectrums&quot;&gt;this&lt;/a&gt; question but it doesn't answer my questions&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2021-10-28T21:15:37.523" LastActivityDate="2021-10-28T21:15:37.523" Title="How to build a program that gives you on the fly the chords of the song while listening to it?" Tags="|fft|music|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1412" PostTypeId="2" ParentId="1254" CreationDate="2012-02-11T12:49:08.090" Score="4" Body="&lt;p&gt;You can consider using Huffyuv : &lt;a href=&quot;http://neuron2.net/www.math.berkeley.edu/benrg/huffyuv.html&quot; rel=&quot;nofollow&quot;&gt;http://neuron2.net/www.math.berkeley.edu/benrg/huffyuv.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is no great better than simple zip, but still slightly optimized for images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Image related compression comes from the techniques like Vector quantization or Transform coding. In order to make use of transform such as DCT/Wavelet yet make it lossless you can think of JPEG-LS or JPEG2000 for compression. Only thing is, it is not &lt;em&gt;streaming&lt;/em&gt; in your sense of definition. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-11T12:49:08.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1413" PostTypeId="2" ParentId="1411" CreationDate="2012-02-11T15:04:00.583" Score="5" Body="&lt;p&gt;Quick answers&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a. At least 32 kHz&lt;/li&gt;&#xA;&lt;li&gt;b. no&lt;/li&gt;&#xA;&lt;li&gt;c. finite but large. 1000s. If you factor in inversions and &quot;over&quot;&#xA;notations, tens of 1000s.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is actually a really hard problem. Chords are made of individual notes. However these notes have fundamentals and harmonics. They are not pure sinusoid. Let's say you play  C7/#9 chord (C seven sharp nine) on a guitar which is typically played as C E Bb Eb using four strings. Each of the four strings produces its fundamental and many harmonics. Since you typically get 6-10 significant harmonics per note, the spectrum is quite complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you can reliably extract the notes, the chord detection is also tricky. Chords are certainly not unique. For example C6 (C six) and  am7 (A minor 7) have basically the same notes. So have C_dim, Eb_dim, F#_dim, A_dim. Furthermore the stack up of the notes matters (so called inversions), i.e. which note is the highest and which is the lowest. In many cases it also depends on the musical context. A certain set of notes will form a different chord depending on what happened before and what happens after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chord notation is not super scientific. In each key there are dozens of different chord flavors and people transcribe them in different ways. There is also a whole second set of chord flavors that use the &quot;over&quot; notation. For example B7+/C means &quot;play a B flat major seven chord (Bb D F A) over a C root&quot;. If you are interested to hear how that sounds like: this is actually the chord used in the first 15 seconds of this song &lt;a href=&quot;http://www.youtube.com/watch?v=V7dg8vRDM68&quot; rel=&quot;noreferrer&quot;&gt;http://www.youtube.com/watch?v=V7dg8vRDM68&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-02-11T15:04:00.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1416" PostTypeId="1" CreationDate="2012-02-11T21:40:29.323" Score="3" ViewCount="3095" Body="&lt;p&gt;Could someone please answer me why the simulated performance (using matlab) of a Hamming code over a binary symmetric channel does not fit exacly with the theoretical?&#xA;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;&#xA;n=15;&#xA;k=11;&#xA;I=eye(k);&#xA;&#xA;%define the parity matrix for the hamming code &#xA;P=[1 1 0 0;1 0 1 0;0 1 1 0;1 0 0 1;0 1 0 1;0 0 1 1;1 1 1 0;1 1 0 1;1 0 1 1;0 1 1 1;1 1 1 1];&#xA;&#xA;%The generator matrix combination of parity and identity matrix&#xA;G=[I,P];&#xA;&#xA;%Define parity check matrix&#xA;HI=eye(n-k);&#xA;H=[P',HI];&#xA;&#xA;%verify that rows of H represent the dual space for the rows of G&#xA;%(verification = 0)&#xA;verification=rem(G*H',2);&#xA;&#xA;UoB=1043162;&#xA;&#xA;%convert UoB number to binary&#xA;ci=dec2bin(UoB);&#xA;ci=ci-('0');&#xA;&#xA;%take the 11 rightmost digits&#xA;cw=ci(:,10:20);&#xA;cw=rem(cw*G,2);&#xA;&#xA;%monte carlo simulation index&#xA;mc=10000;&#xA;index=1;&#xA;Pe_matrix=zeros(21,mc);&#xA;Pe_vector=zeros(1,21);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the procedure demonstrated bellow random error patterns &lt;code&gt;error=rand(1,15)&amp;lt;p;&lt;/code&gt; are generated for 21 different crossover probabilities.Consequently these patterns are subtracted from the original codeword &lt;code&gt;c=xor(cw,error);&lt;/code&gt; in order to find the errored codeword (in any place where the error pattern has an 1 the codeword will flip its bit. After that, the probability of error for the current error patern is calculated &lt;code&gt;Pe=(sum(xor(cw,c)))./k;&lt;/code&gt; by summing up the ones returned (the places where the errored codeword and the original differ) from the subtraction of the errored codeword and the original one,&#xA;and by dividing them by the total length of the codeword &lt;code&gt;k=numel(c);&lt;/code&gt;.The &lt;code&gt;Pe_matrix&lt;/code&gt; stores all the Pe values for each of the cross over probabilities and each of the mc iterations.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i=1:mc&#xA;&#xA;    for p=0:0.01:.2   &#xA;        error=rand(1,15)&amp;lt;p;&#xA;        c=xor(cw,error);&#xA;        k=numel(c);&#xA;        Pe=(sum(xor(cw,c)))./k;&#xA;        Pe_matrix(index,i)=Pe;&#xA;        index=index+1;&#xA;    end&#xA;    index=1;&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to obtain smoother results Monte Carlo simulations were performed. In each of the Monte Carlo iterations,each row of the Pe_matrix has the Pe values for the different crossover probabilities.Now by summing up the elements of each row and by dividing them with the total number of the Monte Carlo simulations we acquire a strong estimate of the BER&#xA;for the Binary symmetric channel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for j=1:21&#xA;    Pe_vector(1,j)=sum(Pe_matrix(j,:))/mc;&#xA;end&#xA;&#xA;%In the code demonstrated bellow the theoretical performance of the channel&#xA;%is calculated in order to compare it with the simulated.&#xA;&#xA;for pe=0:0.01:.2&#xA;    index=index+1;&#xA;    Pblkerror=1-(1-pe)^15-15*pe*(1-pe)^14;&#xA;    Pd(1,index)=(3/15)*Pblkerror;&#xA;end&#xA;&#xA;%finally by creating a legend one can compare the theoretical with the&#xA;%simulated performance by the depicted BER graphs.&#xA;semilogy(Pe_vector,'r-o')&#xA;hold on;&#xA;semilogy(Pd,'k-*')&#xA;hold on;&#xA;legend('simulation','theoretical performance');&#xA;ylabel('Probability of error,Pe');&#xA;xlabel('cross over probability');&#xA;title('BsC simulation');&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="959" LastEditorUserId="6" LastEditDate="2012-02-12T19:35:54.413" LastActivityDate="2017-01-08T19:09:37.620" Title="Why does my simulation of the binary symmetric channel disagree with theory?" Tags="|matlab|digital-communications|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1417" PostTypeId="2" ParentId="1411" CreationDate="2012-02-11T22:15:09.400" Score="1" Body="&lt;p&gt;The first issue with your problem description is that each note within each chord within a &quot;song&quot; is not just a sinusoid or sinewave at the pitch frequency of the note, but a far more complicated, likely time varying, possibly only pseudo-periodic waveform, potentially composed of dozens of overtones.  Then you have a unknown number of these harmonically rich waveforms mixed together to form each chord.  Then any sustain pedal or effect will potentially overlap and mix sequential chord sounds together.  These combine to make the search space many orders of magnitude larger than just the table of possible chords, (unless you stick with an extremely restricted electronic synthesizer as the only instrument).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-02-11T22:32:32.447" LastActivityDate="2012-02-11T22:32:32.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1418" PostTypeId="1" CreationDate="2012-02-11T22:33:29.233" Score="10" ViewCount="3603" Body="&lt;p&gt;I would like to implement an algorithm that synchronizes two audio tracks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two tracks are very similar; you can imagine they are two recordings of sound (not necessarily music) from two microphones in the same room. This means they appear as one signal that passed through two different (linear) channels, with different additive noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the first idea might be to look for the peak of their cross-correlation, but I am particularly interesting in finding literature on the topic, but all the papers I could find are either synchronizing two musical tracks (using chroma-based audio features), or synchronizing audio with a score. They also assume there might be time-warping, which is an unnecessary assumption in my case.&lt;/p&gt;&#xA;" OwnerUserId="960" LastEditorUserId="13320" LastEditDate="2016-05-13T10:39:45.677" LastActivityDate="2016-05-13T10:39:45.677" Title="Synchronizing Two Audio Tracks" Tags="|audio|cross-correlation|synchronization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1419" PostTypeId="2" ParentId="1411" CreationDate="2012-02-12T00:02:02.997" Score="12" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;a. What is the rate I have to sample the song?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Chords are usually played by instruments with f0s in the 100 - 1kHz range, so if your algorithm can work with only the fundamental of each note, a sampling rate of 2kHz is enough. You can't go lower. There is &lt;strong&gt;absolutely no point&lt;/strong&gt; sampling above 16kHz for such a recognition task; and pretty much all the literature on chord and key detection uses this sampling rate or lower (Mauch, Papadopoulos : 11kHz. Ellis, Harte : 16kHz). Keep in mind that a large fraction of the adult population has lost their &quot;top octave&quot; and cannot hear much above 10kHz; this doesn't prevent aging musicians from distinguishing chords easily!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;b. Are Chords Unique?&#xA;  c. Can I assume I can store and have all the chords? is it finite set?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not sure what you mean here ; but the same chord (say C) can be played :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;At various octaves,&lt;/li&gt;&#xA;&lt;li&gt;At various inversions (C, E, G ; or E, G, C ; or G, C, E...),&lt;/li&gt;&#xA;&lt;li&gt;With various combination of timbres of instruments,&lt;/li&gt;&#xA;&lt;li&gt;With or without background drums, with or without a singing voice,&lt;/li&gt;&#xA;&lt;li&gt;With all kinds of audio transformations applied during recording, mixing, mastering, and mp3 compression.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This means that there is an extremely wide array of observable signals of a &quot;C&quot; chord.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to look into automatic chord detection, please read &lt;a href=&quot;http://schall-und-mauch.de/artificialmusicality/publications/&quot;&gt;Matthias Mauch's publications&lt;/a&gt;, with his Thesis giving the most complete body of work on the topic. To give you an idea how complex the task is, his &quot;baseline&quot; algorithm consists in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Extracting a STFT of the signal with rather large windows (in the hundreds of ms range).&lt;/li&gt;&#xA;&lt;li&gt;Mapping this to a constant-Q representation by upsampling and projection.&lt;/li&gt;&#xA;&lt;li&gt;Applying several contrast enhancing and whitening operations to the constant-Q spectrogram to compensate for the &quot;horizontal&quot; decay (when a note is played its amplitude decays with time) and &quot;vertical&quot; decay (the spectrum of a musical sound has decreasing energy as frequency increases)&lt;/li&gt;&#xA;&lt;li&gt;Using non-negative least-square to describe each slice of the constant-Q spectrogram as a sum of a small number of positively weighted harmonic combs.&lt;/li&gt;&#xA;&lt;li&gt;Converting the f0 of the extracted combs to a 12-tones scale (so called &quot;chroma vectors&quot;).&lt;/li&gt;&#xA;&lt;li&gt;Matching the chroma vectors to a dictionary of hundreds of manually defined templates corresponding to chords.&lt;/li&gt;&#xA;&lt;li&gt;Using a HMM model to smooth the sequence of detected chords.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The latest bit is important: his approach (reputedly state of the art) is not causal, so it cannot work &quot;on the fly&quot;. Furthermore the processing time needed by the NNLS decomposition and the very large FFT windows make it run 3x slower than real time. 75% accuracy on the Beatles works. Just to make you realize that getting something reliable and realtime will be a very hard task! If you are looking for something simpler, you might start by reading part II of this paper by &lt;a href=&quot;http://perso.telecom-paristech.fr/~oudre/publis/OFG-IEEE-11.pdf&quot;&gt;Laurent Oudre&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-12T00:25:03.920" LastActivityDate="2012-02-12T00:25:03.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1420" PostTypeId="2" ParentId="1418" CreationDate="2012-02-12T00:18:28.610" Score="4" Body="&lt;p&gt;Chroma-based approaches are used when the tracks to align are two performances of the same material with widely different instrumentations - in which case you need to find the &quot;lowest common denominator&quot; which is harmony, melody, chord progression etc. Chroma are good for that - they totally abstract timbre, recording techniques. But you don't need those in your case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you have guessed, cross-correlation of the raw audio would be 1/ not very robust to noise, 2/ not very robust to differences in transducers (the two microphones might have very different responses) 3/ very costly if you have minutes of audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Extract a sequence of MFCC vectors from both signals. This way you'll have something of lower dimensionality and a bit more robust to noise and differences in transducers.&lt;/li&gt;&#xA;&lt;li&gt;Optionally normalize the MFCC (&quot;by design&quot; coefficient 0 has more variance than coefficient 1 and so on...)... Ideally you'd want each row of the MFCC matrix to have variance 1.&lt;/li&gt;&#xA;&lt;li&gt;Compute the cross-correlation of two matrices you get, along the time axis (that is to say, compute the 2D cross-correlation and just keep the data for the time axis).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-12T00:18:28.610" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1421" PostTypeId="2" ParentId="1254" CreationDate="2012-02-12T05:36:00.117" Score="2" Body="&lt;p&gt;This looks like what you would put in a digital camera for a lossless RAW.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1/ Check the source code of dcraw to see what various camera manufacturers are already doing. For example Pentax uses some variable length int scheme (length N coded with a huffman code, then N bits) to code the delta of a pixel wrt the previous pixel of the same color in the Bayer mosaic ; and this routinely achieves 1:1.5 to 1:2 ratios.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2/ DNG files can be compressed too. Check how it is done from the Adobe specs... Not sure if it is based on a similar prediction + variable length int encoding (which is streaming) ; or if it uses the more advanced JPEG-LS based on LOCO (and which unfortunately requires several passes on the data).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-12T05:36:00.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1422" PostTypeId="1" CreationDate="2012-02-10T04:37:03.217" Score="1" ViewCount="3451" Body="&lt;p&gt;I want to identify Egyptian car number plates that look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PhGFL.jpg&quot; alt=&quot;license plate image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this in Java ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plan to do this in Android, as the user will catch the number plate with a camera and the results will be submitted to server.&lt;/p&gt;&#xA;" OwnerUserId="10544" OwnerDisplayName="wahba87" LastEditorUserId="4344" LastEditDate="2013-05-02T17:48:33.430" LastActivityDate="2013-05-02T17:48:33.430" Title="How can I identify Arabic letters in an image using Java?" Tags="|image-processing|optical-char-recognition|java|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1423" PostTypeId="2" ParentId="1422" CreationDate="2012-02-10T04:55:15.430" Score="-1" Body="&lt;p&gt;The link provides an algorithm to detect text from an image in Java... it works for English..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try for something similar for Arabic.&#xA;&lt;a href=&quot;http://code.google.com/p/textdetection/source/browse/trunk/src/com/jpprade/text/detection/MainApp.java?r=7&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/p/textdetection/source/browse/trunk/src/com/jpprade/text/detection/MainApp.java?r=7&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="AurA" LastActivityDate="2012-02-10T04:55:15.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1424" PostTypeId="2" ParentId="1422" CreationDate="2012-02-10T09:36:04.710" Score="8" Body="&lt;p&gt;You have to do following methods:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First step: Number plate extraction&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;http://opencv.willowgarage.com/wiki/&quot;&gt;&lt;code&gt;OpenCV&lt;/code&gt;&lt;/a&gt; for this purpose. It has Java api. Also it is ported to &lt;a href=&quot;http://opencv.willowgarage.com/wiki/Android&quot;&gt;Android&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second step : OCR&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;OCR is used to recognise the letters on notice board.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can train your own OCR for arabic letters and digits using OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can use tesseract-OCR. I think it supports arabic also.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Following paper will be useful for you: &lt;a href=&quot;https://docs.google.com/viewer?a=v&amp;amp;q=cache%3am8SKo4Rg6nMJ%3asajjad.in/content/ALPR_paper.pdf%20number%20plate%20extraction%20in%20opencv&amp;amp;hl=en&amp;amp;gl=in&amp;amp;pid=bl&amp;amp;srcid=ADGEESi7u5_Y_zb1nG7PaeSjZ08DT2Nw7M5qcpqz_TqDVZDSCp0O-pSGBy2EbmkNLrmHoUnfzQeXcBdoH3OtIRG0YeimdcOQyK4JoNJ97CHK0GO5cPLIxskjedt1yY7c0ighaRYMaWF-&amp;amp;sig=AHIEtbShv3SGm7jzHgP8ptNy24nMjHn9Gg&quot;&gt;Paper 1&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, &lt;a href=&quot;http://www.dexmac.com/index.php/software/114-plategatewayqt&quot;&gt;this site&lt;/a&gt; includes complete code for number plate extraction, but in C++. But it will be a good start.&lt;/p&gt;&#xA;" OwnerUserId="818" OwnerDisplayName="arkiaz" LastActivityDate="2012-02-10T09:42:35.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1426" PostTypeId="1" CreationDate="2012-02-12T18:36:35.430" Score="6" ViewCount="814" Body="&lt;p&gt;For full disclosure, this is related to homework.  I have to find the Fourier Transform of a function that I've boiled down to the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a function $f(x,y)$ that I can think of as another function $g(x,y)$ plus a stretch and rotation.  (For example, think of turning a circle into an ellipse).  So, I have a stretch matrix of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\pmatrix{ \frac{1}{A}&amp;amp; 0\\\ 0&amp;amp; \frac{1}{B}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I have the standard rotation matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\pmatrix{ \cos \theta&amp;amp; -\sin \theta\\\ \sin \theta&amp;amp; \cos \theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that for computing the Fourier transform, $f(Ax)$ is the same as $\frac{1}{det A} F(A^{-T}u)$.  So, if I can combine the stretch and rotation into one matrix A, I'm home free.  How can I combine these two matrices?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="962" LastEditorUserId="962" LastEditDate="2012-02-13T00:34:55.820" LastActivityDate="2012-02-13T00:34:55.820" Title="How to combine a rotation matrix and a stretch matrix into a single matrix for easy Fourier Transform" Tags="|fourier-transform|homework|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1427" PostTypeId="1" CreationDate="2012-02-12T19:22:19.340" Score="1" ViewCount="1377" Body="&lt;p&gt;I am designing a High pass Digital filter. I calculated the filter coefficients using fdatool and got some negative filter values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I need to convert them into values from 0 to 255.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of low pass filter , I used &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;value = value*255/sum(value) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have heard that same needs to be done for negative coefficients as well by taking absolute values of all the coefficients, but that seems a little odd to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please tell me how to convert my filter coefficients to values ranging from 0 to 255&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="864" LastActivityDate="2012-02-12T19:22:19.340" Title="Normalizing Negative filter coefficients for Digital filter design" Tags="|filters|filter-design|highpass-filter|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1428" PostTypeId="2" ParentId="1426" CreationDate="2012-02-12T20:04:08.597" Score="3" Body="&lt;p&gt;You combine those by matrix multiplication.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-12T20:04:08.597" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1429" PostTypeId="1" CreationDate="2012-02-13T06:33:03.243" Score="3" ViewCount="459" Body="&lt;p&gt;I use MFCC algorithm for calculation of Mel-frequency coefficient for 2 files and DTW algorithm with Euclidean distance for finding similarity. I have results values around 400-600 on the files with the same word (cut from recorded speech of the same person). Is it right? Or I have a mistake in my implementation? I didn't find an implementation of MFCC in C#, so I edited some files from comirva (java), can it be the problem?&#xA;I have also tried Chi-Square distance, but it gives a negative results.&lt;/p&gt;&#xA;" OwnerUserId="965" LastActivityDate="2012-02-13T06:33:03.243" Title="Finding similar fragment in recorded speech" Tags="|mfcc|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1430" PostTypeId="1" CreationDate="2012-02-13T08:58:01.147" Score="3" ViewCount="1446" Body="&lt;p&gt;I'm trying to write a code The helps me in my biology work.&#xA;Concept of code is to analyze a video file of contracting cells in a tissue&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://youtube.com/watch?v=f9xgDnkkPt0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example 1&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 2: youtube.com/watch?v=uG_WOdGw6Rk&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And plot out the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Count of beats per min.&lt;/li&gt;&#xA;&lt;li&gt;Strenght of Beat&lt;/li&gt;&#xA;&lt;li&gt;Regularity of beating&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And so i wrote a Matlab code that would loop through a video and compare each frame vs the one that follow it, and see if there was any changes in frames and plot these changes on a curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of My code Results&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4eFZz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Core of Current code i wrote:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i=2:totalframes&#xA;        compared=read(vidObj,i);&#xA;        ref=rgb2gray(compared);%% convert to gray&#xA;        level=graythresh(ref);%% calculate threshold&#xA;        compared=im2bw(compared,level);%% convert to binary        &#xA;        differ=sum(sum(imabsdiff(vid,compared))); %% get sum of difference between 2 frames&#xA;        if (differ ~=0) &amp;amp;&amp;amp; (any(amp==differ)==0) %%0 is = no change happened so i dont wana record that !&#xA;            amp(end+1)=differ;  % save difference to array amp wi&#xA;            time(end+1)=i/framerate; %save to time array with sec's, used another array so i can filter both later.&#xA;            vid=compared; %% save current frame as refrence to compare the next frame against.&#xA;        end&#xA;end&#xA;figure,plot(amp,time);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;=====================&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So thats my code, but is there a way i can improve it so i can get better results ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because i get fealing that imabsdiff is not exactly what i should use because my video contain alot of noise and that affect my results alot, and i think all my amp data is actually faked !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also i actually can only extract beating rate out of this, by counting peaks, but how can i improve my code to be able to get all required data out of it ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks also really appreciate your help, this is a small portion of code, if u need more info please let me know.&#xA;thanks&lt;/p&gt;&#xA;" OwnerUserId="967" LastActivityDate="2012-02-13T09:39:25.493" Title="Matlab video processing of Contracting tissues. how to analyze movement?" Tags="|matlab|algorithms|video-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1431" PostTypeId="2" ParentId="1430" CreationDate="2012-02-13T09:39:25.493" Score="6" Body="&lt;p&gt;You could try a simple non-linear denoising filter (3x3 or 5x5 median filter) on your image sequence to make your detection more robust to noise ; but I get the feeling that the moving details on these images or quite thin and that too much filtering would harm your detection. And it looks like you are already thresholding the images before comparison, so the only noise that matters here are pixels moving above and below the threshold at each frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a beating rate you could also compute the auto-correlation of the sequence. It will show a secondary maximum at the beating rate. The autocorrelation is actually an interesting representation for your task because:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A very regular beat will mean a very sharp secondary peak on the AC sequence ; while a more irregular beat will show a flattened, spread out secondary peak in the AC sequence.&lt;/li&gt;&#xA;&lt;li&gt;The ratio of the autocorrelation secondary peak to the first peak ($r_0$) can be used as a good measure of beat strength.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But back in time domain you could also consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The kurtosis of the sequence as a measure of &quot;peakedness&quot; (and thus beat strength). Other measures of peakedness include the ratio of geometric mean to arithmetic mean.&lt;/li&gt;&#xA;&lt;li&gt;The standard deviation of the time intervals between peaks as a measure of beat regularity. The downside is that you will have to detect peaks, which will be a bit imprecise in your case especially given the low temporal resolution of your data (and this is why I thought about doing things from the AC function first!)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-13T09:39:25.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1432" PostTypeId="1" AcceptedAnswerId="1441" CreationDate="2012-02-13T10:24:23.283" Score="1" ViewCount="1185" Body="&lt;p&gt;these are example of my image &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/F4qwX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HTVfd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ct6ua.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IKp7o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have a 245 images similar to it ,i obtained these b/w images after preprocessing stage , i want to use them for recognition persons(not verification) in matlab. can i performe matching algorithm on these image after division into 2 group(one for training and the second for testing) without implementing feature extraction algorithm such as PCA,ICA,.....?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if it is possible , which are the suitable matching algorithms that are preferable for this purpose , especially i need to use matlab ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help please?really i need your opinions and consultations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="920" LastEditorUserId="920" LastEditDate="2012-02-14T13:19:21.280" LastActivityDate="2012-02-15T17:52:59.533" Title="is it possible to matching b / w images without feature extraction steps? if possible which algorithm may be more suitable?" Tags="|image-processing|computer-vision|algorithms|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1433" PostTypeId="1" AcceptedAnswerId="1438" CreationDate="2012-02-13T11:14:55.370" Score="15" ViewCount="5368" Body="&lt;p&gt;I am trying to find a list of possible image features like color, oriented edges and so on for measuring their usability in case of finding same/similar objects in images. Does anyone know such a list or at least some features?&lt;/p&gt;&#xA;" OwnerUserId="969" LastEditorUserId="698" LastEditDate="2012-04-15T13:44:56.567" LastActivityDate="2018-10-13T14:59:34.257" Title="List of possible image features for content based image retrieval" Tags="|image-processing|cbir|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1434" PostTypeId="1" CreationDate="2012-02-13T11:56:44.160" Score="5" ViewCount="138" Body="&lt;p&gt;Question is about  &amp;quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Channel_capacity&quot; rel=&quot;nofollow noreferrer&quot;&gt;channel capacity&lt;/a&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;I guess it is pretty elementary for experts, however I have not seen it discussed in&#xA;e.g. Proakis book or Tse &amp;quot;Fundamentals of Wireless Com&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Question (roughly speaking):  is channel capacity is known for the fading channel with &amp;quot;pilots&amp;quot; ?&#xA;(discrete, memoryless channel).&#xA;&amp;quot;pilots&amp;quot; - means we transmit on certain positions symbols known to receiver and transmitter both. It is common for all modern telecommunication standards GSM, UMTS, LTE to have &amp;quot;pilots&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;What is the literature where it is discussed ?&lt;/p&gt;&#xA;&lt;p&gt;More precisely let us consider the following signal model (&amp;quot;block&amp;quot; fading)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$r_i = h s_i + n_i, $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$i=1...N$&lt;/span&gt; , h - is random, but constant on Block, &lt;span class=&quot;math-container&quot;&gt;$n_i$&lt;/span&gt; is gaussian noise.&#xA;(its variance can be 1) known to us 2) uknown to us)&#xA;Assume we have K-&amp;quot;pilots&amp;quot;  i.e. we send symbols &lt;span class=&quot;math-container&quot;&gt;$s_1=1$&lt;/span&gt; ... &lt;span class=&quot;math-container&quot;&gt;$s_K=1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerDisplayName="user971" LastEditorUserId="80" LastEditDate="2023-03-12T13:25:18.927" LastActivityDate="2023-03-12T13:25:18.927" Title="Capacity of channels with pilots?" Tags="|discrete-signals|digital-communications|fading-channel|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1435" PostTypeId="2" ParentId="1433" CreationDate="2012-02-13T12:35:37.703" Score="8" Body="&lt;p&gt;Ok I think I found a suitable list by just searching a bit more. There is a &lt;a href=&quot;http://thomas.deselaers.de/publications/papers/deselaers_infret08.pdf&quot;&gt;paper by Deselaers etc al.&lt;/a&gt; which seams to be what I was looking for!&lt;/p&gt;&#xA;" OwnerUserId="969" LastActivityDate="2012-02-13T12:35:37.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1436" PostTypeId="1" AcceptedAnswerId="1440" CreationDate="2012-02-13T13:23:54.630" Score="4" ViewCount="3821" Body="&lt;p&gt;i need to perform registration to 2D image using&quot;rigid transformation&quot; in  matlab .i need this for measuring the similarity between my images .any one know how this can be done using matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;an example on my images :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o9DmL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7gtob.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MZC13.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z6LxY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZLZ4H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards&lt;/p&gt;&#xA;" OwnerUserId="920" LastEditorUserId="920" LastEditDate="2012-02-14T12:14:24.837" LastActivityDate="2013-04-26T11:14:50.303" Title="how can i perform a registration to 2D images using ''rigid &quot; transformation in matlab?" Tags="|image-processing|computer-vision|matlab|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1437" PostTypeId="1" CreationDate="2012-02-13T13:40:13.480" Score="2" ViewCount="2384" Body="&lt;p&gt;I have come across TI's C6000/Integra. I want to know is there any other similar or better ARM+DSPs available. Specially for surveillance/vehicle number plate recognition etc. Having camera input at least for VGA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link: &lt;a href=&quot;http://focus.ti.com/paramsearch/docs/parametricsearch.tsp?family=dsp&amp;amp;sectionId=2&amp;amp;tabId=2688&amp;amp;familyId=1985&quot; rel=&quot;nofollow&quot;&gt;TI's-Integra&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="446" LastActivityDate="2012-02-14T11:13:16.403" Title="List of all available ARM+DSP processors for surveillance" Tags="|image-processing|computer-vision|dsp-core|arm|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1438" PostTypeId="2" ParentId="1433" CreationDate="2012-02-13T13:59:58.860" Score="25" Body="&lt;p&gt;The field itself is too vast. So i doubt you can have a fully exhaustive list here. &#xA;However, &lt;a href=&quot;http://www.ee.columbia.edu/~sfchang/course/vis/REF/sikora01.pdf&quot;&gt;MPEG 7&lt;/a&gt; is one of the primary effort in standardizing this area. So what is included here is not universal - but at least the most primary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some key feature set which are identified in MPEG7 ( I can really talk only about Visual Descriptors not others see &lt;a href=&quot;http://mpeg.chiariglione.org/standards/mpeg-7/mpeg-7.htm&quot;&gt;this&lt;/a&gt; for full scope). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 4 catagory of Visual Descriptors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. &lt;a href=&quot;http://erdos.csie.ncnu.edu.tw/~hychen/multimedia/reading/presentation/%28P6%29%20Color%20and%20Texture%20Descriptors.pdf&quot;&gt;Color Descriptors&lt;/a&gt; which includes :&lt;/strong&gt;&lt;br&gt;&#xA;Dominant color,&lt;br&gt;&#xA;Color Layout (essentially Primary color on block-by-block basis)&lt;br&gt;&#xA;Scalable Color (essentially Color histogram),&lt;br&gt;&#xA;&lt;a href=&quot;http://cbvr.ims.tuwien.ac.at/user-documentation/csd-desc-1.pdf&quot;&gt;Color Structure&lt;/a&gt; (essentially local Color histogram),&lt;br&gt;&#xA;and Color spaces to make things interoperable.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. &lt;a href=&quot;http://erdos.csie.ncnu.edu.tw/~hychen/multimedia/reading/presentation/%28P6%29%20Color%20and%20Texture%20Descriptors.pdf&quot;&gt;Texture Descriptors&lt;/a&gt; (see also &lt;a href=&quot;http://www.cs.auckland.ac.nz/compsci708s1c/lectures/Glect-html/topic4c708FSC.htm#browse&quot;&gt;this&lt;/a&gt;) which includes :&lt;/strong&gt;&lt;br&gt;&#xA;Texture Browsing Descriptor - which defines granularity/coarseness, regularity,and direction. &#xA;Homogeneous Texture Descriptor - which is based on Gabor filter bank. &#xA;and&lt;br&gt;&#xA;Edge Histogram &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. &lt;a href=&quot;http://www.uk.mitsubishielectric-rce.eu/pubdocs/VIL01-D063.pdf&quot;&gt;Shape Descriptors&lt;/a&gt; which includes :&lt;/strong&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MORSE/region-props-and-moments.pdf&quot;&gt;Region based descriptors&lt;/a&gt; are scalar attributes of shape under consideration - such as area, ecentricities etc.&lt;br&gt;&#xA;Contour based which captures actual characteristic shape features and&lt;br&gt;&#xA;3D descriptors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4. Motion Descriptors for Video&lt;/strong&gt;&lt;br&gt;&#xA;Camera Motion (3-D camera motion parameters)&lt;br&gt;&#xA;Motion Trajectory (of objects in the scene) [e.g. extracted by tracking algorithms]&#xA;Parametric Motion  (e.g. motion vectors, which allows description of motion of scene. But it can be more complex models on various objects).&lt;br&gt;&#xA;Activity which is more of a semantic descriptor. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;MPEG 7 doesn't define &quot;How these are extracted&quot; - it only defines what they mean and how to represent/store them. So research does exists on how to extract and use them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is another &lt;a href=&quot;http://www.ims.tuwien.ac.at/media/documents/publications/vcip2003-mpeg7.pdf&quot;&gt;good paper&lt;/a&gt; that gives insight in this subject. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But yes, many of these features are rather basic and may be more research will create more sophisticated (and complex) feature set. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-13T13:59:58.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1439" PostTypeId="2" ParentId="1371" CreationDate="2012-02-13T14:44:44.030" Score="5" Body="&lt;p&gt;To give you an upfront answer your question you want to determine the $pixel-values$ from $DCT-Coefficients$ probably there is nothing on earth better than doing IDCT itself! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, leaving aside some vagueness i can re-phrase your question: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i have an algorithm x - that is defined to work on Pixels, here is what i do:&lt;br&gt;&#xA;DCT-Coeffs -&gt; &lt;code&gt; IDCT &lt;/code&gt; -&gt; pixels &lt;code&gt; Algorithm_X &lt;/code&gt; -&gt; pixels &lt;code&gt; DCT &lt;/code&gt; -&gt; DCT-Coeffs&lt;br&gt;&#xA;(ignoring other stuff that is peripheral). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The question is: is there a short cut to this brute force where i am&#xA;  obviously undoing quite some stuff done in first stage?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What you are referring to is what is generally known as &lt;em&gt;Compressed Domain Processing&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;DCT-Coeffs -&gt; &lt;code&gt; Compressed_Domain_Algorithm_X &lt;/code&gt; -&gt; DCT-Coeffs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, all compressed domain algorithm exploits the linearity of DCT. For example &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;Y = \alpha * X_1 + \beta * X_2  &#xD;&#xA;$$&#xA;then,&lt;br&gt;&#xA;$$&#xD;&#xA;DCT(Y) = \alpha * DCT(X_1) + \beta * DCT(X_2) &#xD;&#xA;$$&#xA;where $\alpha$ $\beta$ are scalars. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many things possible, and while many NOT. It is too vast to answer the set of all compressed domain algorithms which are possible, but i would recommend key readings that will set a great stage for you. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.6016&quot;&gt;Compressed Domain Processing of JPEG-encoded images by Brian C. Smith , Lawrence A. Rowe Real-Time Imaging (1996)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.uky.edu/~kiernan/DL/bsmith.html&quot;&gt;A Survey of Compressed Domain Processing Techniques by Brian C. Smith&#xA;Proc. NSF Workshop on Reconnecting Science&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=232097&quot;&gt;Algorithms for Manipulating Compressed Images, Brian C. Smith, Lawrence A. Rowe, &#xA;IEEE Computer Graphics and Applications, Sept. 1993, vol.13, (no.5):34-42.&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.ee.columbia.edu/dvmm/publications/95/chang94c.pdf&quot;&gt;Manipulation and compositing of MC-DCT compressed video by Shih-Fu Chang, David G. Messerschmitt IEEE Journal on Selected Areas in Communications, 1995/1, Volume&#xA;13 Issue 1&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.hpl.hp.com/techreports/2002/HPL-2002-282.pdf&quot;&gt;Compressed-Domain Video Processing by Susie Wee, Bo Shen, John Apostolopoulo&#xA;HP Labs Tech Report 2002.&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Specifics: &#xA;If you are using &lt;a href=&quot;http://www.ijg.org/&quot;&gt;libjpeg&lt;/a&gt; you can actually get quantized DCT co-efficients directly. However, most above literature refers un-quantized DCT co-efficients. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-13T14:44:44.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1440" PostTypeId="2" ParentId="1436" CreationDate="2012-02-13T14:53:36.430" Score="6" Body="&lt;p&gt;A rigid, or isometrie transformation, is a transformation in which the distances between the points that are transformed, are preserved. This means that an object formed by these points will have the same shape and size after transformation. Examples are rotations and translations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 2D column vector can be rotated by $\theta$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left(\begin{array}{c}x' \\ y'\end{array}\right) = \left ( \begin{array}{cc} \cos \theta &amp;amp; - \sin \theta \\ \sin \theta &amp;amp; \cos \theta \end{array} \right ) \left(\begin{array}{c}x \\ y\end{array}\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you will probably be seeking a combination of rotation and translation between two images meaning that the relation between the points of these images can be defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left(\begin{array}{c}x' \\ y' \\ 1\end{array}\right) = \left ( \begin{array}{ccc} \cos \theta &amp;amp; - \sin \theta &amp;amp; t_x\\ \sin \theta &amp;amp; \cos \theta &amp;amp; t_y \\ 0 &amp;amp; 0 &amp;amp; 1 \end{array} \right ) \left(\begin{array}{c}x \\ y \\1\end{array}\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or short:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{x}' = \textbf{A}\textbf{x}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This particular transformation has 3 degrees of freedom, one for rotation and two for translation. This means that you can solve this matrix for 2 point correspondences $\{ \textbf{x}' \leftrightarrow \textbf{x} \}$. That means in your case that you need two points in the original image and two matching points in the distorted image to ascertain the translation and rotation between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimate reference: &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multiple View Geometry&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The deformation between these images is obviously not an isometrie. For one the branches appear and disappear between them. I played a little with a slightly more involved form of feature based registration based on the assumption that the distortion is a similarity transform with 4 degrees of freedom, and the features will make up for the difference in edges. In short:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SIFT feature detection and matching&lt;/li&gt;&#xA;&lt;li&gt;RANSAC estimation to detect inliers&lt;/li&gt;&#xA;&lt;li&gt;Direct Linear Transform (DLT) variant for estimation of scale and rotation&lt;/li&gt;&#xA;&lt;li&gt;Run of the mill cross correlation to detect the translation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Results, not brilliant, but here goes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T85Ku.png&quot; alt=&quot;Inital match&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Jr4bv.png&quot; alt=&quot;Feature match&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/p7wRH.png&quot; alt=&quot;Final match&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All code on &lt;a href=&quot;https://github.com/mdiephuis/sandbox/tree/master/so&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github&lt;/a&gt;, demo file is &lt;code&gt;so_13_02_2012.m&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="420" LastEditorUserId="104" LastEditDate="2013-04-26T11:14:50.303" LastActivityDate="2013-04-26T11:14:50.303" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1441" PostTypeId="2" ParentId="1432" CreationDate="2012-02-13T15:56:10.367" Score="4" Body="&lt;p&gt;&lt;strong&gt;Yes, it is possible!&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you can take pixel by pixel comparison and apply MSE (mean square error). If the error is close to zero, it is the same picture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you will be able to recognize only those images which are picture perfect matching. For example, you won't be able to account for brightness variations, scale variations, minor transformations, compression loss (e.g. JPEG) etc. So while human being might just see them as &lt;em&gt;SAME&lt;/em&gt; image - they are not on every pixel basis. Depending on how much strict or tolerant your application needs to be, do we really need to then look for advanced algorithms that are smart enough to be invariant to these factors. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After your clarification, it does sound like you have more of a special case of matching rather than general purpose recognition problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the following assumptions: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A gray scale (or color) images are first converted to binary through some thresholding process. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Mostly these images are lines (thick or thin) and the key differentiation is how far these edges are from others. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Edges could be of arbitrary shapes and contours -no geometrical assumptions. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given the edge detection limitations (in the presence of noise) and thresholding algorithms, edges might be disjoint &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is what i would suggest to apply: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Edge following algorithms - to make continuous edges where applicable.&lt;br&gt;&#xA;Ref #1. &lt;a href=&quot;http://www.slideshare.net/kiara1011000/edge-following-algorithm-chiara-galdi&quot; rel=&quot;nofollow&quot;&gt;http://www.slideshare.net/kiara1011000/edge-following-algorithm-chiara-galdi&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply Housdourf distances and similar shape/contour matching&lt;br&gt;&#xA;Ref #1. &lt;a href=&quot;http://cgm.cs.mcgill.ca/~godfried/teaching/cg-projects/98/normand/main.html&quot; rel=&quot;nofollow&quot;&gt;Haudorff Distance by Normad&lt;/a&gt;&lt;br&gt;&#xA;Ref #2. &lt;a href=&quot;http://cgm.cs.mcgill.ca/~godfried/teaching/cg-projects/98/normand/main.html&quot; rel=&quot;nofollow&quot;&gt;CV Online: The Hausdorff Distance&lt;/a&gt;&lt;br&gt;&#xA;Ref #3. &lt;a href=&quot;http://www.cs.cornell.edu/vision/hausdorff/hausmatch.html&quot; rel=&quot;nofollow&quot;&gt;Hausorff based Matching&lt;/a&gt;   &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Basic idea is that if all edges are more or less at the same locations and of same length, then the images are same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that large portion of region which contains Black and implies no information- MSE would be an extremely BAD idea. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am only giving you some basic direction toward formulating your problem. As you dig deeper  you can put more specific questions. I would be keen to know what works for you finally. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2: Adding one specific solution&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One simple possible metric i can think of is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say, &lt;code&gt;Ref[i][j]&lt;/code&gt; is the reference image and &lt;code&gt;Test[i][j]&lt;/code&gt; is the test image. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pixel_similarity = 0; &#xA;For each pixel in Ref[i][j]  &#xA;{  &#xA;  if ( Ref[i][j] == Edge_pixel )   &#xA;     (k,l) &amp;lt;- find_nearest_edge_pixel(Ref, Test, i, j, window_size)  &#xA;     pixel_similarity += weighted_similarity (i, j, k, l)   &#xA;}  &#xA;&#xA;image_similarity_metric = error / (total_edge_pixels_in_ref);   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Please Note that this algorithm will be quite limited for heavy scaling and rotation. This is first step. Notify me for any typo or lack of clarity!&lt;/em&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Observations:&lt;/em&gt;   &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If you keep two identical images (pixel by pixel)- you will find that (k,l) will be same as (i,j) and weighted error should be = 1. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By dividing the number of edge pixels by total edge population, you will get similarity metric = 1.0 for perfectly matching images. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When edges are almost similar, but slightly misaligned score will decline gradually. The &lt;code&gt;weighted_similarity&lt;/code&gt; function should be chosen smartly to deal with what you consider as reasonably aligned edge vs. one that should be discarded.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Other extreme is that if total number of edge pixels in Ref is zero - there is no way to compare it with any other one (since we are considering background pixels having no information related to match). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Try to work this out and see what results you get. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy to help you!&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-02-15T17:52:59.533" LastActivityDate="2012-02-15T17:52:59.533" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1442" PostTypeId="2" ParentId="1436" CreationDate="2012-02-13T16:02:43.787" Score="1" Body="&lt;p&gt;For translation only you can use a simple &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_correlation&quot; rel=&quot;nofollow&quot;&gt;phase correlation&lt;/a&gt; technique which is trivial to implement in Matlab.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be extended to include rotation and scaling as well by moving to log-polar coordinates (see the links off of the Wikipedia page).&lt;/p&gt;&#xA;" OwnerUserId="703" LastActivityDate="2012-02-13T16:02:43.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1443" PostTypeId="1" AcceptedAnswerId="1445" CreationDate="2012-02-13T18:29:50.950" Score="1" ViewCount="1423" Body="&lt;p&gt;I am creating a piece of software that detects when speech starts in an audio recording. Before performing onset detection I would like to remove any noise that may cause any false positives. Which would be the best low-pass filter to use for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I went too far in saying that I am performing onset detection. Basically all I am doing is looking for the first time the amplitude goes above a certain value and taking that as a flag for the start of the envelope. It is simple and crude, but I believe if my low-pass filter successfully removes noise then the onset detection should work. Or am I totally off on this?&lt;/p&gt;&#xA;" OwnerUserId="893" LastEditorUserId="893" LastEditDate="2012-02-13T18:47:16.143" LastActivityDate="2012-02-13T21:22:40.370" Title="Low-pass filter for cleaning vocal speech before performing onset detection" Tags="|lowpass-filter|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1444" PostTypeId="2" ParentId="1409" CreationDate="2012-02-13T19:38:04.693" Score="10" Body="&lt;p&gt;Let $X(f)$ denote the Fourier transform of $x(t)$ where&#xA;$$\begin{align*}&#xA;X(f) &amp;amp;= \int_{-\infty}^{\infty} x(t) \exp(-j2\pi ft) \mathrm dt\\&#xA;x(t) &amp;amp;= \int_{-\infty}^{\infty} X(f) \exp(+j2\pi ft) \mathrm df&#xA;\end{align*}$$&#xA;which I will denote via $x(t) \leftrightarrow X(f)$.&#xA;The following transform pairs will be needed in what follows.&#xA;$$\begin{align*}&#xA;\delta(t) &amp;amp;\leftrightarrow 1\\&#xA;\delta(t-t_0) &amp;amp;\leftrightarrow \exp(-j2\pi f \,t_0)\\&#xA;\sum_{n=-\infty}^{\infty}\delta(t-nT) &amp;amp;\leftrightarrow&#xA;\frac{1}{T}\sum_{k=-\infty}^{\infty}\delta\left(f-\frac{k}{T}\right)\\&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a signal $x(t)$, its sampled pulse train (at intervals of $T$ seconds) is &#xA;$$x(t) \sum_{n=-\infty}^{\infty}\delta(t-nT) &#xA;= \sum_{n=-\infty}^{\infty} x(t)\delta(t-nT) &#xA;= \sum_{n=-\infty}^{\infty} x(nT)\delta(t-nT).$$&#xA;Since multiplication in the time domain corresponds to convolution in the&#xA;frequency domain, we have&#xA;$$\begin{align*}&#xA;x(t)\sum_{n=-\infty}^{\infty}\delta(t-nT) &amp;amp;\leftrightarrow&#xA;X(f)\circledast\frac{1}{T}\sum_{k=-\infty}^{\infty}\delta\left(f-\frac{k}{T}\right)\\&#xA;&amp;amp;\leftrightarrow \frac{1}{T}\sum_{k=-\infty}^{\infty}&#xA;X(f)\circledast\delta\left(f-\frac{k}{T}\right)\\&#xA;&amp;amp;\leftrightarrow \frac{1}{T}\sum_{k=-\infty}^{\infty}&#xA;\int_{-\infty}^{\infty} X(f-w)\delta\left(w-\frac{k}{T}\right) \mathrm dw\\&#xA;x(t)\sum_{n=-\infty}^{\infty}\delta(t-nT)&#xA;&amp;amp;\leftrightarrow \frac{1}{T}\sum_{k=-\infty}^{\infty}&#xA;X\left(f-\frac{k}{T}\right) = \hat{X}(f)&#xA;\end{align*}$$&#xA;Thus, the Fourier transform of the impulse train formed by&#xA;sampling $x(t)$ at $T$ second intervals is $\hat{X}(f)$ which&#xA;is obtained by repeating $X(f)$ along the $f$ axis at intervals of &#xA;$T^{-1}$ Hz and summing the result.&#xA;Furthermore, $\hat{X}(f)$ is a &lt;strong&gt;periodic&lt;/strong&gt; function of the frequency&#xA;variable $f$ with period $T^{-1}$ Hz.  That is, for all $f$,&#xA;$$\hat{X}\left(f + \frac{1}{T}\right) = \hat{X}(f).$$  Note that&#xA;all of this holds &lt;strong&gt;regardless of what $X(f)$ is:&lt;/strong&gt; $X(f)$ could be&#xA;nonzero for all $f$, and the result would still be valid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose that $X(f)$ is zero if $f &amp;lt; a$ or $f &amp;gt; b$.  Then,&#xA;$\hat{X}(f)$, obtained by repeating $X(f)$ periodically along&#xA;the $f$ axis,  is nonzero only in the intervals&#xA;$$\ldots, \left[a-\frac{2}{T}, b-\frac{2}{T}\right], &#xA;\left[a-\frac{1}{T}, b-\frac{1}{T}\right],&#xA;[a, b] &#xA;\left[a+\frac{1}{T}, b+\frac{1}{T}\right], &#xA;\left[a+\frac{2}{T}, b+\frac{2}{T}\right], &#xA;\ldots&#xA;$$&#xA;and so if &#xA;$$b -\frac{1}{T} &amp;lt; a \Rightarrow b-a &amp;lt; \frac{1}{T},$$&#xA;that is, the &lt;em&gt;support&lt;/em&gt; $b-a$ of $X(f)$ is smaller than &#xA;the repetition interval $T^{-1}$ Hz, then the repetitions&#xA;of $X(f)$ do not overlap.  Indeed as the OP's figures show, &#xA;for a real-valued signal whose spectrum extends from $a = -f_0$&#xA;to $b = f_0$ (support of $X(f)$ is of length $2f_0$), sampling &#xA;$x(t)$ at intervals of $T = (3f_0)^{-1}$ (and thus repeating $X(f)$ at&#xA;intervals of $3f_0$ Hz on the frequency axis)&#xA;leads to no overlap while sampling $x(t)$ at intervals of&#xA;$T = (1.5f_0)^{-1}$ leads to overlap of the repetitions&#xA;of $X(f)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the OP asks about negative frequencies and the&#xA;interpretation of the pictures which show positive frequencies&#xA;only.  For a &lt;em&gt;real-valued&lt;/em&gt; signal, $X(f)$ has conjugate symmetry,&#xA;meaning that $X(-f) = X^*(f)$, and so specifying $X(f)$ for&#xA;positive values of $f$ suffices.  In any case, the pictures&#xA;he is looking at are of $|X(f)|$ and $|\hat{X}(f)|$ which&#xA;are &lt;em&gt;even&lt;/em&gt; functions of $f$, and so showing only the positive&#xA;axis saves space, though it &lt;em&gt;does&lt;/em&gt; make the pictures look a &#xA;bit lopsided since only half the lobe is shown at low frequencies.&#xA;For &lt;strong&gt;complex-valued&lt;/strong&gt; signals, $X(f)$ does not have conjugate&#xA;symmetry and $|X(f)|$ need not be an even function of $f$&#xA;and so the whole axis would need to be shown.  But, the general&#xA;development above is still applicable, and we still need &#xA;to sample at rate exceeding $b-a$ Hz, and it helps to keep in&#xA;mind that in this general case, each sample is actually two real&#xA;numbers, not one, since we are sampling a complex-valued signal.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="4346" LastEditDate="2017-01-08T04:16:12.773" LastActivityDate="2017-01-08T04:16:12.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1445" PostTypeId="2" ParentId="1443" CreationDate="2012-02-13T21:16:56.107" Score="3" Body="&lt;p&gt;The problem is that for speech, noise and speech may well occupy the same frequency bands, so removing an arbitrary band by simple filtering can remove speech as well, which will prevent your detector from triggering, as well as not removing out-of-band noise, which will produce false positives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what you are looking for might not be just a low pass filter, but a &lt;a href=&quot;http://en.wikipedia.org/wiki/Voice_activity_detection&quot; rel=&quot;nofollow&quot;&gt;Voice Activity Detection&lt;/a&gt; algorithm, which is a more sophisticated bit of DSP technology.  There are many research papers on this topic, so it's not a short answer question.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-02-13T21:22:40.370" LastActivityDate="2012-02-13T21:22:40.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1446" PostTypeId="2" ParentId="13" CreationDate="2012-02-14T03:23:23.860" Score="33" Body="&lt;p&gt;The reason why you see Fourier transformation applied two times in the feature extraction process is that the features are based on a concept called cepstrum. Cepstrum is a play on the word spectrum - essentially the idea is to transform a signal to frequency domain by Fourier transform, and then perform another transform as if the frequency spectrum was a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While frequency spectrum describes the amplitude and phase of each frequency band, cepstrum characterizes variations between the frequency bands. Features derived from cepstrum are found to better describe speech than features taken directly from the frequency spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple of slightly different definitions. Originally cepstrum transform was defined as Fourier transform -&gt; complex logarithm -&gt; Fourier transform [1]. Another definition is Fourier transform -&gt; complex logarithm -&gt; inverse Fourier transform [2]. The motivation for the latter definition is in its ability to separate convolved signals (human speech is often modelled as the convolution of an excitation and a vocal tract).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A popular choice that has been found to perform well in speech recognition systems is to apply a non-linear filter bank in frequency domain (the mel binning you're referring to) [3]. The particular algorithm is defined as Fourier transform -&gt; square of magnitude -&gt; mel filter bank -&gt; real logarithm -&gt; discrete cosine transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here DCT can be selected as the second transform, because for real-valued input, the real part of the DFT is a kind of DCT. The reason why DCT is preferred is that the output is approximately decorrelated. Decorrelated features can be modelled efficiently as a Gaussian distribution with a diagonal covariance matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Bogert, B., Healy, M., and Tukey, J. (1963). The Quefrency Alanysis of Time Series for Echoes: Cepstrum, Pseudo-Autocovariance, Cross-Cepstrum and Saphe Cracking. In Proceedings of the Symposium on Time Series Analysis, p. 209-243.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Oppenheim, A., and Schafer, R. (1968). Homomorphic Analysis of Speech. In IEEE Transactions on Audio and Electroacoustics 16, p. 221-226.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] Davis, S., and Mermelstein, P. (1980). Comparison of Parametric Representations for Monosyllabic Word Recognition in Continuously Spoken Sentences. In IEEE Transactions on Acoustics, Speech and Signal Processing 28, p. 357-366.&lt;/p&gt;&#xA;" OwnerUserId="973" LastEditorUserId="973" LastEditDate="2012-02-14T18:02:50.100" LastActivityDate="2012-02-14T18:02:50.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1448" PostTypeId="2" ParentId="1437" CreationDate="2012-02-14T11:13:16.403" Score="2" Body="&lt;p&gt;As you mention other non-ARM options in the comments, here's a few:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.analog.com/en/processors-dsp/blackfin/processors/index.html&quot; rel=&quot;nofollow&quot;&gt;Blackfin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Xilinx's &lt;a href=&quot;http://www.xilinx.com/products/silicon-devices/epp/zynq-7000/index.htm&quot; rel=&quot;nofollow&quot;&gt;Zynq (ARM+FPGA)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Altera also do a &lt;a href=&quot;http://www.altera.com/devices/processor/arm/cortex-a9/m-arm-cortex-a9.html&quot; rel=&quot;nofollow&quot;&gt;similar ARM+FPGA&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Some of Freescale's &lt;a href=&quot;http://www.freescale.com/webapp/sps/site/taxonomy.jsp?nodeId=018rH3ZrDR633B&quot; rel=&quot;nofollow&quot;&gt;i.MX51&lt;/a&gt; processors might be suitable (ARM+co-processor, not a true DSP) - although I'm not sure if there's out-of-the-box surveillance software&lt;/li&gt;&#xA;&lt;li&gt;And of course, there's always the PC+GPU option, depending on your power, cost, size, weight constraints&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastActivityDate="2012-02-14T11:13:16.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1449" PostTypeId="1" AcceptedAnswerId="1454" CreationDate="2012-02-14T13:07:40.183" Score="7" ViewCount="3402" Body="&lt;p&gt;In the process of trying to estimate whether a ROI contains [Japanese] text, I need to get a rough count of edges, hopefully binned by length and/or orientation... I think this would give me strong-enough features to judge if the ROI is likely to contain text or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I can't seem to figure out an &lt;em&gt;efficient&lt;/em&gt; (this eventually has to work on a video stream) way to get such a histogram (or even just a count of edges for certain length/orientation threshold): Hough transforms will tend to focus on certain shapes (lines etc.) while Canny and Sobel will detect any type, but their output is not particularly useful for counting...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any suggestion or hint at some algorithm I can use, to quickly extract a list of edges from an image...&lt;/p&gt;&#xA;" OwnerUserId="976" LastActivityDate="2012-02-14T16:25:21.190" Title="Get histogram of edge lengths/orientations in an image using OpenCV" Tags="|computer-vision|edge-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1450" PostTypeId="1" AcceptedAnswerId="1451" CreationDate="2012-02-13T21:00:02.150" Score="11" ViewCount="2299" Body="&lt;p&gt;Looking for an open-source system that allows commercial use to do image recognition on a massive and organically growing collection of 2-D images where the only known variations will be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Scaling size of image,&lt;/li&gt;&#xA;&lt;li&gt;The angle the picture-of-the-picture is take,&lt;/li&gt;&#xA;&lt;li&gt;Color-sync offsets, meaning that due to irregularities in the capture and rendering of an source image color varies from instance to instance,&lt;/li&gt;&#xA;&lt;li&gt;Cropping of the photo,&lt;/li&gt;&#xA;&lt;li&gt;Addition of a watermark or text,&lt;/li&gt;&#xA;&lt;li&gt;Possible focus variations, meaning the capture was not in focus, not that an image manipulation filter has been applied.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm okay with having to train the application, as long as the return on doing so will pay-off -- that said, long-term I expect the count of 2-D instances to grow beyond the initial few thousands to the hundred of thousands; but that's long-term, and I'd be happy just to have a solution that works well for know with a training set of 1000 instances and 10 examples per instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; The license needs to be able to be used for commercial internal distribution without release of the source code even internal to all those who have the binary. The code will never be sold, just used internal, but not every user will have access to the source code, just the interface.&lt;/p&gt;&#xA;" OwnerUserId="977" OwnerDisplayName="blunders" LastEditorUserId="977" LastEditDate="2012-02-14T16:46:25.413" LastActivityDate="2014-10-04T06:59:33.607" Title="Image Recognition" Tags="|image-processing|computer-vision|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1451" PostTypeId="2" ParentId="1450" CreationDate="2012-02-13T22:35:07.463" Score="10" Body="&lt;p&gt;It might be a little low-level, but &lt;a href=&quot;http://opencv.willowgarage.com/wiki/&quot;&gt;OpenCV&lt;/a&gt; might provide you with the tools you need to build such image recognition software.  Of course, OpenCV doesn't provide with all you need out of the box (I think, I'm no pro) but it aims to provide what is needed for real-time computer vision.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can start reading on the documentation &lt;a href=&quot;http://opencv.willowgarage.com/wiki/FullOpenCVWiki&quot;&gt;here&lt;/a&gt;.  Some good books are also listed on that page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps, good luck!&lt;/p&gt;&#xA;" OwnerUserId="3951" OwnerDisplayName="pwny" LastActivityDate="2012-02-13T22:35:07.463" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1452" PostTypeId="1" AcceptedAnswerId="1455" CreationDate="2012-02-14T16:09:25.630" Score="4" ViewCount="321" Body="&lt;p&gt;I'm working on a simple FFT implementation and currently running some unit tests. Long floating point numbers in C and assembly become very hard to keep track of, and this whole thing is error prone. I was able to some up (purely experimentally) with a few 4-tap and 8-tap arrays whose DFT is all whole numbers. I'm only testing DFT arrays of length $2^N$, and I could, of course, repeat my shorter signals several times until I achieve desired length, but this would give me a whole bunch of zeros, and that's not a good thing to test for. In summary, I need to come up with signals that satisfy the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Signals are of length $2^N$&lt;/li&gt;&#xA;&lt;li&gt;Coefficients of both the signal and its DFT must be whole numbers&lt;/li&gt;&#xA;&lt;li&gt;Signals are real&lt;/li&gt;&#xA;&lt;li&gt;Signals must not consist mainly of zeros&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Could there be a general way of coming up with such things?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;To explain number 4 above, let me demonstrate what I mean with an example. I don't want a situation in that was produced by repeating something that has a known integer DFT several times.DFT of &lt;code&gt;[1 5 -1 0]&lt;/code&gt; is &lt;code&gt;[5 2-5i -5 2+5i]&lt;/code&gt;. If you simply repeat &lt;code&gt;[1 5 -1 0]&lt;/code&gt; four times to get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[1 5 -1 0 1 5 -1 0 1 5 -1 0 1 5 -1 0]&lt;/code&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;its DFT would be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[20 0 0 0 8-20i 0 0 0 -20 0 0 0 8+20i 0 0 0]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows that repeating something many times does not add any new non-zero integer numbers to the DFT. This procedure simply inserts zeros between existing DFT coefficients (and scales them depending on definition of the transform). This isn't of much help. So zeros &lt;em&gt;are&lt;/em&gt; welcome, but not the zeros achieved this way.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-02-14T16:40:22.223" LastActivityDate="2017-03-22T01:09:00.793" Title="Creating an array whose DFT is all whole numbers" Tags="|fft|dft|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1453" PostTypeId="1" CreationDate="2012-02-14T16:24:47.743" Score="2" ViewCount="934" Body="&lt;p&gt;i have database for 50 person ,it is 250 images (5 images/person) , i need to perform one to many matching between images for recognition persons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so , i divided the image as 2 parts (one for training and one for testing)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example if we say that the first folder contains 100 images(2 images /person),and the second contains 150 images (3 images /person)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is this division correct?&#xA; if it is correct , how can i matching each image in folder1 with all image in folder 2(which will contain 3 similar image) and obtain the better result after (that give max matching percentage)from folder 2 and finally returning the name of this image ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i need to perform this in matlab &lt;/p&gt;&#xA;&#xA;&lt;p&gt;please , i need many advices and consultations with any one has good knowledge in this field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is an example of my images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E6RK5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards&lt;/p&gt;&#xA;" OwnerUserId="920" LastEditorUserId="920" LastEditDate="2012-02-14T16:32:09.950" LastActivityDate="2012-02-17T22:54:50.273" Title="one to many images matching in matlab?" Tags="|image-processing|computer-vision|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1454" PostTypeId="2" ParentId="1449" CreationDate="2012-02-14T16:25:21.190" Score="3" Body="&lt;p&gt;I don't know if OpenCV has some implementation - but i can provide you with a pointer of algorithm for this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mpeg.chiariglione.org/standards/mpeg-7/mpeg-7.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;MPEG 7&lt;/a&gt; provides a fairly well defined (and well thought out) edge histogram descriptor [EHD] which essentially serves your purpose. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can refer to this: &lt;a href=&quot;http://etrij.etri.re.kr/Cyber/servlet/GetFile?fileid=SPF-1041924741673&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient Use of MPEG-7 Edge Histogram Descriptor&lt;/a&gt; which i think is an excellent paper on this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see some implementation of MPEG-7 you can find it on &lt;a href=&quot;http://iiss039.joanneum.at/cms/index.php?id=80&quot; rel=&quot;nofollow noreferrer&quot;&gt;JOANNEUM RESEARCH MPEG 7 page&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on MPEG-7: &lt;a href=&quot;https://dsp.stackexchange.com/questions/1433/list-of-possible-image-features-for-content-based-image-retrieval/1438#1438&quot;&gt;List of possible image features for content based image retrieval&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-02-14T16:25:21.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1455" PostTypeId="2" ParentId="1452" CreationDate="2012-02-14T16:41:23.993" Score="5" Body="&lt;p&gt;The DFT matrix has $e^\frac{-2 \pi j}{2^N}$ as coefficients. For $N &amp;gt;= 3$, these coefficients might have irrational numbers as real/imaginary parts (eg $\frac{\sqrt 2}{2}$ for $N=3$); so all these irrational terms will have to cancel out exactly in the DFT computation. There are ways of achieving that (repeating is one of them) ; but this keeps you away from the general case that your code has to test! For example, this will create symmetries in your data that might make an error in the bit reversal, or in the higher orders (3rd level or above) of butterflies undetected!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to take into account is that due to the pure floating point implementation, even if the expected result should be a whole number, your FFT code, especially on large sizes, might find a result like 0.99999999 (Heck, some whole numbers are not even representable as floats!) ; and this wouldn't be incorrect. Plausible on doubles, very likely of floats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd rather use very generic data (ie: that will yield some irrational numbers) ; and some unit tests that guarantees you that your results are within some tolerance of values computed by a reference implementation such as FFTW. For example in gtest there is EXPECT_FLOAT_EQ or EXPECT_NEAR to check for float equality (up to representation errors) and for float equality given a tolerance.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-14T16:48:16.293" LastActivityDate="2012-02-14T16:48:16.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1456" PostTypeId="1" AcceptedAnswerId="1466" CreationDate="2012-02-14T18:04:28.413" Score="2" ViewCount="1566" Body="&lt;p&gt;I have a real data of 144 points, when I perform a &lt;strong&gt;144-point DFT&lt;/strong&gt; on this data, I get $X$ with real and complex values. I want to calculate harmonics using these $X$'s. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The $X[0]$ and $X[72]$, added together and divided by 144, would give me the DC component? &lt;/li&gt;&#xA;&lt;li&gt;And can I just use the next 71 $X$'s and their conjugates (Euler's identity), to calculate the harmonics? I believe it's $(X[i] + X^*[i])/144 $?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sorry about that, but I have this problem to solve, I'll try and explain it and what I'm supposed to do with it.&#xA;Thanks for being patient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a data set of 144 points. I want to express this in terms of a DC component and it's harmonics. So, I was asked to perform a DFT operation on this and get the harmonics that would represent this data in frequency domain. I performed a 144 point DFT on this data and got 144 $X[k]$'s with real and imaginary parts. As, per my understanding these 144 $X[k]$'s ($X[0]$ being the DC) represent the time domain signal in frequency domain, but I'm still being asked for the DC(apparently ($X[0]+X[72])/2$) and the 71 harmonics, which I'm not sure how to go about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apologize if this still doesn't makes sense, but it's what I'm supposed to do, probably you can give me some reference where I can get such concept or anything related.&lt;/p&gt;&#xA;" OwnerUserId="979" LastEditorUserId="1629" LastEditDate="2016-05-16T10:09:07.583" LastActivityDate="2016-05-16T10:09:07.583" Title="Calculate harmonics using DFT from real points" Tags="|dft|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1457" PostTypeId="1" AcceptedAnswerId="1459" CreationDate="2012-02-14T21:37:00.093" Score="2" ViewCount="604" Body="&lt;h2&gt;The problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I am working on an interesting challenge -- to encode a 32 bit ID blip in an audio stream,  and subsequently retrieve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this: &lt;a href=&quot;http://gizmodo.com/5883215/why-lady-gaga-deploys-a-sound-only-your-smartphone-can-hear&quot; rel=&quot;nofollow&quot;&gt;http://gizmodo.com/5883215/why-lady-gaga-deploys-a-sound-only-your-smartphone-can-hear&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;Thanks for comments pointing out I need to specify the task in more detail.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;bit rate N/A (only a single byte needs to be sent)  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I need to work in the 4-10KHz region so that this works on cheap speakers / sound card / even compressed streaming audio would be nice&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I'm trying to get the pulse time down to a minimum (maybe 1 FFT frame ie 1024 samples or 1/44 sec)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I need this to work on a blip being emitted by a typical laptop internal speaker, received on an iPhone in the same room.  currently it is only working if I put the iPhone right next to the speaker.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Current technique&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The method I'm trying out at the moment is to composite sine waves corresponding to various FFT bins&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my receiver uses a 10 bit (1024 sample) FFT which will generate 512 bins&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using 3 adjacent bins for each bit,  so bit #0 will be bins 99, 100, 101&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would energise bin 99 to 0%,  bin 101 to 100% and bin 100 to either zero or 100% depending on whether the bit is a 0 or a 1&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Sample data output shows problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Problem is I am getting a fair few erroneous bits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BINS: &#xA; bin 0 = { 0.628, 7.798, 6.554 } -&gt; 1.210 --&gt; 1&lt;br&gt;&#xA; bin 1 = { 0.471, 0.624, 7.312 } -&gt; 0.022 --&gt; 0&lt;br&gt;&#xA; bin 2 = { 0.948, 0.374, 14.156 } -&gt; -0.043 --&gt; 0&lt;br&gt;&#xA; bin 3 = { 1.783, 16.634, 16.600 } -&gt; 1.002 --&gt; 1&lt;br&gt;&#xA; bin 4 = { 0.893, 0.697, 13.286 } -&gt; -0.016 --&gt; 0&lt;br&gt;&#xA; bin 5 = { 0.511, 11.385, 9.277 } -&gt; 1.240 --&gt; 1&lt;br&gt;&#xA; bin 6 = { 1.074, 9.621, 15.472 } -&gt; 0.594 --&gt; 1&lt;br&gt;&#xA; bin 7 = { 0.381, 0.580, 14.623 } -&gt; 0.014 --&gt; 0&lt;br&gt;&#xA; bin 8 = { 1.037, 0.554, 17.310 } -&gt; -0.030 --&gt; 0  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the first eight are correct; 1001 1100 is my start sentinel!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;bin 9 = { 0.817, 1.220, 5.544 } -&gt; 0.085 --&gt; 0&lt;br&gt;&#xA; bin 10 = { 1.316, 1.193, 2.589 } -&gt; -0.097 --&gt; 0&lt;br&gt;&#xA; bin 11 = { 2.246, 1.681, 15.257 } -&gt; -0.043 --&gt; 0&lt;br&gt;&#xA; bin 12 = { 1.387, 2.950, 29.683 } -&gt; 0.055 --&gt; 0&lt;br&gt;&#xA; bin 13 = { 1.534, 3.786, 24.015 } -&gt; 0.100 --&gt; 0&lt;br&gt;&#xA; bin 14 = { 1.523, 2.386, 15.959 } -&gt; 0.060 --&gt; 0&lt;br&gt;&#xA; bin 15 = { 2.995, 2.066, 17.060 } -&gt; -0.066 --&gt; 0&lt;br&gt;&#xA; bin 16 = { 1.262, 1.679, 17.068 } -&gt; 0.026 --&gt; 0&lt;br&gt;&#xA; bin 17 = { 1.374, 1.332, 12.165 } -&gt; -0.004 --&gt; 0&lt;br&gt;&#xA; bin 18 = { 1.060, 1.514, 13.036 } -&gt; 0.038 --&gt; 0&lt;br&gt;&#xA; bin 19 = { 1.099, 0.892, 9.148 } -&gt; -0.026 --&gt; 0&lt;br&gt;&#xA; bin 20 = { 0.906, 0.523, 4.556 } -&gt; -0.105 --&gt; 0&lt;br&gt;&#xA; bin 21 = { 0.483, 0.299, 4.575 } -&gt; -0.045 --&gt; 0&lt;br&gt;&#xA; bin 22 = { 0.776, 1.023, 5.269 } -&gt; 0.055 --&gt; 0&lt;br&gt;&#xA; bin 23 = { 0.216, 0.475, 4.232 } -&gt; 0.065 --&gt; 0&lt;br&gt;&#xA; bin 24 = { 0.518, 0.162, 2.393 } -&gt; -0.190 --&gt; 0&lt;br&gt;&#xA; bin 25 = { 0.369, 0.643, 0.737 } -&gt; 0.744 --&gt; 1&lt;br&gt;&#xA; bin 26 = { 0.294, 0.258, 3.712 } -&gt; -0.011 --&gt; 0&lt;br&gt;&#xA; bin 27 = { 0.228, 0.354, 2.114 } -&gt; 0.067 --&gt; 0&lt;br&gt;&#xA; bin 28 = { 0.272, 0.212, 1.836 } -&gt; -0.039 --&gt; 0&lt;br&gt;&#xA; bin 29 = { 0.139, 0.115, 2.036 } -&gt; -0.013 --&gt; 0&lt;br&gt;&#xA; bin 30 = { 0.241, 0.275, 1.532 } -&gt; 0.026 --&gt; 0&lt;br&gt;&#xA; bin 31 = { 0.118, 0.089, 1.509 } -&gt; -0.020 --&gt; 0&lt;br&gt;&#xA; bin 32 = { 0.315, 0.256, 1.339 } -&gt; -0.057 --&gt; 0&lt;br&gt;&#xA; bin 33 = { 0.111, 0.171, 0.222 } -&gt; 0.534 --&gt; 1&lt;br&gt;&#xA; bin 34 = { 0.103, 0.117, 0.351 } -&gt; 0.054 --&gt; 0&lt;br&gt;&#xA; bin 35 = { 0.039, 0.091, 0.637 } -&gt; 0.087 --&gt; 0&lt;br&gt;&#xA; bin 36 = { 0.087, 0.045, 0.404 } -&gt; -0.131 --&gt; 0&lt;br&gt;&#xA; bin 37 = { 0.057, 0.129, 0.586 } -&gt; 0.136 --&gt; 0&lt;br&gt;&#xA; bin 38 = { 0.034, 0.040, 0.771 } -&gt; 0.008 --&gt; 0&lt;br&gt;&#xA; bin 39 = { 0.094, 0.448, 0.791 } -&gt; 0.507 --&gt; 1  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;BITS:&lt;br&gt;&#xA;1 0 0 1 0 1 1 0&lt;br&gt;&#xA;0 0 0 0 0 0 0 0&lt;br&gt;&#xA;0 0 0 0 0 0 0 0&lt;br&gt;&#xA;0 1 0 0 0 0 0 0&lt;br&gt;&#xA;0 1 0 0 0 0 0 1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but only the last bin (39) should be containing a 1.   I'm getting false positives at 25, 33.   and this is from playing the sound straight out of my laptop speaker and picking it up on an iPhone that is a few centimetres away.   if this is failing, it doesn't bode well...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what can I do to get a more reliable reading?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Possible solutions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Possible solutions I am thinking about include:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) parity checking,  maybe an extra eight bits for parity check&lt;br&gt;&#xA;b) building energy in the bins so eg new_bin[17] = 0.9*old_bin[17] + 0.1*in_bin[17] etc&lt;br&gt;&#xA;c) using phase  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also a little bit concerned that some sort of beating effect occurs in the target signal ie amplitude spikes at certain points -- once the waveform is normalised it is very possible that data gets lost this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any established technique for doing this? Are there any more robust options?&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2012-02-15T04:47:24.623" LastActivityDate="2012-02-15T05:17:25.093" Title="Embedding digital ID in audio signal, and retrieving it" Tags="|fft|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1458" PostTypeId="2" ParentId="1453" CreationDate="2012-02-14T22:06:32.013" Score="2" Body="&lt;p&gt;5 images per person is really very few.  In this situation it makes sense to use as much data for the training set as you possibly can.  This means for each person randomly select 4 images for training, and one for testing.  You should use this procedure several times so that you have a number of training set/test set combinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have access to the Statistics Toolbox for Matlab, check out &lt;code&gt;cvpartition&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, then you should have a loop over all persons, and for each person use the &lt;code&gt;randperm&lt;/code&gt; function to generate a randomly shuffled list of indices of the images.  Then you can take the image corresponding to the first index and add it to your test set, and put the rest into your training set. Or you can put 2 images into the test set, or however many you like.  Generally, the training set should be larger than the test set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should generate the training and the test set several times, each time calling &lt;code&gt;rng&lt;/code&gt; with a different value, to reset the seed of the random number generator.  If you generate 10 training/test set pairs, then you evaluate your algorithm 10 times and get 10 accuracy values.  From them you can compute error bars, or you can compare to other algorithms using hypothesis testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to how you actually classify the images, that is very much a separate question, and the answer depends on what's in the images.  What exactly is on that image you've posted?&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2012-02-17T22:54:50.273" LastActivityDate="2012-02-17T22:54:50.273" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1459" PostTypeId="2" ParentId="1457" CreationDate="2012-02-15T02:24:03.150" Score="3" Body="&lt;p&gt;Data communications is a well studied field with 100's of textbooks on the subject.  You seem to be doing a variant of OFDM, with lots and lots of pilot tones, no cyclic prefix, and no redundancy.  There are tons of coding options for adding redundancy (including maybe ECC, RLL group codes, Reed-Solomon, Trellis, &amp;amp; etc).  Your observation that OFDM can have a peak power issue is correct.  There seem to be algorithms for changing the phase of the carriers to help reduce PAPR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added: A longer data frame or the addition of a long enough cyclic prefix may help deal with multipath or reflections when working at a greater distance.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-02-15T05:15:07.073" LastActivityDate="2012-02-15T05:15:07.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1462" PostTypeId="2" ParentId="1457" CreationDate="2012-02-15T05:17:25.093" Score="5" Body="&lt;p&gt;You approached the problem of &lt;em&gt;Embedding the ID&lt;/em&gt; by custom encoding. This is limiting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the URL you send: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A startup called SonicNotify embeds inaudibly high-pitched audio&#xA;  signals within music or any other audio track.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What you are looking for is &lt;em&gt;Watermarking&lt;/em&gt;. Either for the purpose of protection or to trigger appropriate actions, you just add a watermark in the signal and detect it whoever plays it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, any signal can be watermarked with a known pattern. Essentially, this watermark is added with the original signal like a tolerable noise. (Addition is just one of the functions).  This is an interesting problem where in, your watermark (noise) should be strong enough to survive modifications but should be weak enough that doesn't disturb the ear. Unlike Video, audio has an advantage that you can embed tones of higher frequency that are otherwise not audible to ears. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is quite broader subjects, so i am leaving you with some further reading. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://omen.cs.uni-magdeburg.de/cms/upload/lehre/sommer05/audio_watermarking_techniques.pdf&quot;&gt;Audio Watermarking Techniques by Hyoung Joong Kim - Tutorial&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://speech.csie.ntu.edu.tw/previous_version/paper/SP98-5-4.pdf&quot;&gt;Robust audio watermarking using perceptual masking by Mitchell D. Swanson &#xA;Signal Processing 66 (1998) 337-355 Elsevier.&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://omen.cs.uni-magdeburg.de/cms/upload/lehre/sommer05/audio_watermarking_techniques.pdf&quot;&gt;Book: ALGORITHMS FOR AUDIO WATERMARKING AND STEGANOGRAPHY by NEDELJKO CVEJI&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There is an alternative approach to this. Instead of embedding anything in the signal, extract the most critical &lt;em&gt;features&lt;/em&gt; that aids identifying what the content is. This finger print then resides on separate database (without modifying original content). If on a portal if someone uploads the copy, it would receive same finger print which will capture that such a content is not unique. This is equivalent of Digital Signature of the stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the earliest work on this area was by &lt;a href=&quot;http://www.idmt.fraunhofer.de/&quot;&gt;Fraunhofer Institute&lt;/a&gt; called &lt;a href=&quot;http://en.wikipedia.org/wiki/AudioID&quot;&gt;AudioID&lt;/a&gt;. &#xA;YouTube also has similar &lt;a href=&quot;http://www.youtube.com/t/contentid&quot;&gt;ContentID&lt;/a&gt; framework.&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-15T05:17:25.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1463" PostTypeId="1" AcceptedAnswerId="1465" CreationDate="2012-02-15T09:25:06.637" Score="29" ViewCount="19698" Body="&lt;p&gt;I am trying to implement a content based image retrieval system but before I do so I would like to get an overview of some programming languages suitable for this task (having good libs and such).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know some good languages and libs for that kind of task? What about Python or Java?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best&lt;/p&gt;&#xA;" OwnerUserId="969" LastEditorUserId="128" LastEditDate="2020-03-13T09:05:39.347" LastActivityDate="2020-03-13T09:05:39.347" Title="Good Language for Implementing Computer Vision System / Algorithm / Application?" Tags="|image-processing|computer-vision|programming|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1464" PostTypeId="2" ParentId="1463" CreationDate="2012-02-15T10:11:11.407" Score="4" Body="&lt;p&gt;For an image retrieval system. You would have client side and server side code.&#xA;The server side can be either in Python or C/C++. OpenCV is your best choice here. It has both python &amp;amp; C++ interfaces.&#xA;For the client side, I think you're better off using java.&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2012-02-15T10:11:11.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1465" PostTypeId="2" ParentId="1463" CreationDate="2012-02-15T10:51:44.897" Score="36" Body="&lt;p&gt;Maybe you can be more specific about the scope and scale of your work (academic project? Desktop or Mobile commercial product? Web-based commercial project?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some recommendations and comments:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Matlab is common in the academic world, and quite good for sketching/validating ideas. You will have access to a large body of code from other researchers (in CV and machine learning); prototyping and debugging will be very fast and easy, but whatever you will have developed in this environment will be hard to put in production. Depending on what your code is doing, you might have memory/performance problems (there are situations where you can't describe what you want to do in terms of Matlab's primitives and have to start looping on pixels and Matlab's being an interpreted language is not helping in this context). Interaction with databases, web servers etc is not easy, sometimes impossible (you won't get a Matlab program to become a Thrift server called by a web front-end). Costs $$$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;C++ is what is used for many production-grade CV systems (think of something at the scale of Google's image search or Streetview, or many commercial robotics applications). Good libraries like OpenCV, excellent performance, easy to put into a production environment. If you need to do machine learning, there are many libraries out there (LibSVM / SVMlight, Torch). If you have to resort to &quot;loop on all pixels&quot; code it will perform well. Easy to use for coding the systems/storage layers needed in a large scale retrieval system (eg: a very large on-disk hash map for storing an inverted index mapping feature hashes to images). Things like Thrift / Message Pack can turn your retrieval program into a RPC server which can be called by a web front-end. However: not very agile for prototyping, quite terrible for trying out new ideas, slower development time; and put in the hands of inexperienced coders might have hard to track performances and/or instability problems.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Python is somehow a middle ground between both. You can use it for Matlab style numerical computing (with numpy and scipy) + have bindings to libraries like OpenCV. You can do systems / data structure stuff with it and get acceptable performances. There are quite a few machine learning packages out there though less than in Matlab or C++. Unless you have to resort to &quot;loop on all pixels&quot; code, you will be able to code pretty much everything you could have done with C++ with a 1:1.5 to 1:3 ratio of performance and 2:1 to 10:1 ratio of source code size (debatable). But depending on the success of your project there will be a point where performance will be an issue and when rewriting to C++ won't be an option.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-15T10:51:44.897" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1466" PostTypeId="2" ParentId="1456" CreationDate="2012-02-15T13:12:09.700" Score="6" Body="&lt;p&gt;The DFT will express your time sequence as a weighted some of complex exponential (basically a set of orthogonal functions, if that's a helpful concept for you). DC is simply a special case of a complex exponential with the frequency being 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume a sample rate of 1440 Hz (to make the math simple). Then the DFT coefficients mean the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X[0]: amplitude at 0 Hz&#xA;X[1]: amplitude &amp;amp; phase at 10 Hz&#xA;X[2]: amplitude &amp;amp; phase at 20 Hz&#xA;...&#xA;X[71]: amplitude and phase at 710 Hz&#xA;X[72]: amplitude at 720 Hz (Nyquist frequency)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Nyquist is a little bit of an odd-ball. It's a real number so the phase is 0. The value should also be small or close to 0, otherwise you have potentially aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your input is real, you have complex conjugate symmetry as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X[73] = X[71]';&#xA;X[74] = X[70]';&#xA;....&#xA;X[143] = X[1]';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just a quick comment: (X[0] + X[72)/2 is NOT the DC value. X[0] is. &lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2012-02-15T14:12:03.457" LastActivityDate="2012-02-15T14:12:03.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1468" PostTypeId="2" ParentId="1463" CreationDate="2012-02-15T16:21:27.777" Score="5" Body="&lt;p&gt;If this is an academic project, then you should definitely use Matlab, and more specifically the Image Processing Toolbox and the Computer Vision System Toolbox.  It will take you orders of magnitude less time to prototype and evaluate algorithms in Matlab than in C++.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even with the Python interface OpenCV is much harder to use than Matlab, and if you really have to you can call C or C++ code from Matlab through mex.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-02-15T16:21:27.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1469" PostTypeId="2" ParentId="1463" CreationDate="2012-02-15T21:58:19.383" Score="10" Body="&lt;p&gt;Especially since your project is academic, &lt;em&gt;Mathematica&lt;/em&gt; is a very good and appropriate software system. &lt;em&gt;Mathematica&lt;/em&gt; 8 comes with a comprehensive set of features for image processing, linear algebra, numerics, GPU, etc. It is also a symbolic system so many times I can derive closed form solutions for equations---quite handy for computer vision tasks. &lt;em&gt;Mathematica&lt;/em&gt; can also communicate with Python, C, C++, Java, .NET, ..., code.&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2012-02-15T21:58:19.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1471" PostTypeId="1" AcceptedAnswerId="1472" CreationDate="2012-02-14T18:09:36.497" Score="9" ViewCount="12525" Body="&lt;p&gt;I will explain taking as example the GUI of the Calculator app in windows. &#xA;Given this Calculator application open and focused, I need to find a way of detecting all the buttons.I can only use non-intrusive methods, so things like button id are out of the question. This leads me to image recognition. Or better say image detection, because I don't want a specific image, but a set of images that follow a certain pattern. I know how I can click/right-click/dbl-click/etc using a given button image and image recognition [1]. I don't know how I can do the other way round: scan the GUI and find those areas that meet the requirements of being a button (rectangle, text/icon/graphic labeled etc.). A bigger tackle would be to detect items that don't have the rectangle shape (e.g. icons on a windows desktop)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nearest thing to what I need is detecting faces in a picture.[2] But I don't know how to apply this in my case. For human face detection, I saw that hundreds of pictures of the face must be used in the Haar cascade generation (don't know how I would do this with only 10-15 button snapshots). If another kind of object has to be detected like an apple, you need to generate Haar cascade for that object again using a lot of images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did any of you ever tried to detect buttons, items or whatever in a GUI using only pattern detection? I just need something to tell me &quot;this is an icon/button&quot; so I can grab that region in a snapshot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] I use SikuliX with Python to perform actions on given patterns. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] I saw that this is done easily using OpenCV and Haar cascades (in XML format). Creating the Haar cacades requires a little bit of patience and skills.&lt;/p&gt;&#xA;" OwnerUserId="1066" OwnerDisplayName="Radu Enea" LastEditorUserId="306" LastEditDate="2012-04-26T12:37:13.957" LastActivityDate="2018-06-15T17:07:10.300" Title="How can I detect buttons in a GUI of an app with pattern detection using python?" Tags="|image-processing|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1472" PostTypeId="2" ParentId="1471" CreationDate="2012-02-14T20:45:26.017" Score="7" Body="&lt;p&gt;First, have a look at the &lt;a href=&quot;https://github.com/opencv/opencv/blob/master/samples/python/squares.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;squares.py&lt;/a&gt; sample provided by OpenCV. It should handle a fair number of button types with some tweaking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the output I got (with some tweaking) for your Calculator example:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RchhZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made the following tweaks to the squares application:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change this code (starting on line 84):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(result.total == 4 and &#xA;   abs(cv.ContourArea(result)) &amp;gt; 1000 and &#xA;   cv.CheckContourConvexity(result)):&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(result.total == 4 and &#xA;   abs(cv.ContourArea(result)) &amp;lt; 1300 and &#xA;   abs(cv.ContourArea(result)) &amp;gt; 300 and&#xA;   cv.CheckContourConvexity(result)):&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, since you don't have to worry about scale or rotation variations, check out using &lt;a href=&quot;http://opencv.itseez.com/modules/imgproc/doc/object_detection.html?highlight=matchtemplate#cv2.matchTemplate&quot; rel=&quot;nofollow noreferrer&quot;&gt;matchTemplate&lt;/a&gt;. Also, its corresponding tutorial (in C++) is &lt;a href=&quot;http://opencv.itseez.com/doc/tutorials/imgproc/histograms/template_matching/template_matching.html#template-matching&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See my other &lt;a href=&quot;https://stackoverflow.com/questions/8218997/how-to-detect-the-sun-from-the-space-sky-in-opencv/8221251#8221251&quot;&gt;answer&lt;/a&gt; for another example of how template matching works. Also, you might find this &lt;a href=&quot;https://stackoverflow.com/questions/8156405/opencv-max-locations/8162277#8162277&quot;&gt;answer&lt;/a&gt; helpful for detecting the top X matches with &lt;code&gt;matchTemplate&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="1067" OwnerDisplayName="mevatron" LastEditorUserId="36297" LastEditDate="2018-06-15T17:07:10.300" LastActivityDate="2018-06-15T17:07:10.300" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1473" PostTypeId="1" AcceptedAnswerId="1475" CreationDate="2012-02-16T01:06:33.733" Score="15" ViewCount="4843" Body="&lt;p&gt;Given a set of points (2D) i.e., point cloud (PC), the question is about a &lt;code&gt;robust&lt;/code&gt;, &lt;code&gt;accurate&lt;/code&gt; and &lt;code&gt;computing-friendly&lt;/code&gt; method to find circles (or ellipses in advanced version).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intuitive idea is to use Brute-Force Search on all possible points (as center){infinite!} and radii (again infinite!). This is ultra-extremely slow and inefficient.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As demonstrated bellow each fitted circle would be ranked based on the number of points (&lt;code&gt;nn&lt;/code&gt;) positioned on the circle-circumference in a distance shorter than a threshold (&lt;code&gt;t&lt;/code&gt;). So there is &lt;code&gt;derr&lt;/code&gt; to present an average distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In advanced form ellipses are of interest to be fitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas, brain-storming, experiences, comments?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0EGIv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="488" LastEditorUserId="440" LastEditDate="2012-03-26T12:12:11.083" LastActivityDate="2012-03-26T12:12:11.083" Title="Detection of circles (ellipses) in 2D point cloud" Tags="|edge-detection|local-features|point-cloud|hough-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1474" PostTypeId="1" AcceptedAnswerId="1480" CreationDate="2012-02-16T04:57:22.963" Score="5" ViewCount="298" Body="&lt;p&gt;I'm a junior currently pursuing a mathematics degree with aspirations toward medical school. I have a senior project I have my entire last year to devote time to, and I've decided that I want to tackle the challenge of medical signal processing. I'd like to write a program that reconstructs a 3d-model of the object from the cross-sectional images provided to it, very much like a CT scan. However, I have no idea where to start. You can assume that I have a good level of mathematical knowledge or the drive to acquire what is needed, so don't be afraid to throw some academic papers my way! I'd really like to dive in to my research as soon as possible, but I can't quite figure out where to start. What materials would you recommend to someone starting out, such as myself?&lt;/p&gt;&#xA;" OwnerUserId="986" LastEditorUserId="6" LastEditDate="2012-02-16T14:13:48.087" LastActivityDate="2012-02-16T14:58:41.933" Title="I'm looking to do my senior capstone project in the field of medical tomography, what is a good book to get acquainted with the field?" Tags="|image-processing|reference-request|3d|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1475" PostTypeId="2" ParentId="1473" CreationDate="2012-02-16T05:54:38.143" Score="14" Body="&lt;p&gt;The best ideas that &lt;em&gt;exactly&lt;/em&gt; tries to solve this problem is &lt;em&gt;Hough Transform&lt;/em&gt; . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the signal in hough space will be &lt;code&gt;r, x, y&lt;/code&gt; co-ordinates. Here &lt;code&gt;r&lt;/code&gt;&#xA; stands for radius and &lt;code&gt;x,y&lt;/code&gt; stands for center. Every points may belong to one or many circles. So in the &lt;em&gt;Hough plane&lt;/em&gt; go through all possible circles where this point could belong to and just do a +1. This is not a search, just collection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if a real circle exists, so many points will add and the score of such a &lt;code&gt;r, x, y&lt;/code&gt; will be much higher than all others. Selecting such a point will allow you pick the right circles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a classical paper way back in 1971 (before i was born!) that invented this concept. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ai.sri.com/pubs/files/tn036-duda71.pdf&quot;&gt;USE OF THE HOUGH TRASFORMTION  TO DETECT LINES AND CURVES IN PICTURES &#xA;By:  Richard O. Duda, Peter E. Hart &#xA;Tech report Artificial Intelligence Cente April 1971.&lt;/a&gt; &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For Tutorial i would suggest references below:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm&quot;&gt;HIPR2 -Link&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/amos/hough.html&quot;&gt;Amos storkey&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://idlastro.gsfc.nasa.gov/idl_html_help/HOUGH.html&quot;&gt;IDL Reference&lt;/a&gt; &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Specifically for circle detection, you can refer to this below:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.aishack.in/2010/03/circle-hough-transform/&quot;&gt;AI Shack&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://home.uchicago.edu/~borovicka/files/research/bristol/hough-report.pdf&quot;&gt;Tech Report from Chicago Univ.&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cis.rit.edu/class/simg782/lectures/lecture_10/lec782_05_10.pdf&quot;&gt;Lecture Notes from Rochester Institute&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These methods is very efficient, and very computer friendly.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-02-16T06:17:41.000" LastActivityDate="2012-02-16T06:17:41.000" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1476" PostTypeId="1" CreationDate="2012-02-16T00:14:30.347" Score="4" ViewCount="3441" Body="&lt;p&gt;I don't know if I am posting in the correct place. I wanted to ask about dilation and erosion in bitmaps. I have as a homework to implement in a programming language these morphological operations but I fail in understanding how they work. I know that erosion will shrink an object and dilation will enlarge it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I have&#xA;$$A=\matrix{0 &amp;amp;1 &amp;amp;0 &amp;amp;1 &amp;amp; 1\\&#xD;&#xA;0 &amp;amp;1 &amp;amp;0 &amp;amp;1 &amp;amp; 0\\&#xD;&#xA;0 &amp;amp;1 &amp;amp;1 &amp;amp;1 &amp;amp; 0\\&#xD;&#xA;0 &amp;amp;1 &amp;amp;1 &amp;amp;0 &amp;amp; 0\\&#xD;&#xA;0 &amp;amp;1 &amp;amp;1 &amp;amp;1 &amp;amp; 0},\; &#xD;&#xA;se=\matrix{1 &amp;amp;0 &amp;amp;0\\&#xD;&#xA;1 &amp;amp;1 &amp;amp;0\\&#xD;&#xA;0 &amp;amp;0 &amp;amp;1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the eroded and dilated output and how to compute it step by step?&lt;/p&gt;&#xA;" OwnerDisplayName="omg_img" LastEditorUserId="20655" LastEditDate="2018-08-29T12:27:41.587" LastActivityDate="2018-08-29T12:27:41.587" Title="Erosion and dilation in images" Tags="|image-processing|morphological-operations|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1477" PostTypeId="2" ParentId="1476" CreationDate="2012-02-16T09:23:23.067" Score="8" Body="&lt;p&gt;Here's a step-by-step procedure for erosion/dilation by hand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Print out &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;se&lt;/code&gt; on two sheets of paper&lt;/li&gt;&#xA;&lt;li&gt;Place the &lt;code&gt;se&lt;/code&gt; paper on every pixel of the &lt;code&gt;A&lt;/code&gt; sheet in turn&lt;/li&gt;&#xA;&lt;li&gt;At each position: Take the pixel values of &lt;code&gt;A&lt;/code&gt; at the respective positions where &lt;code&gt;se&lt;/code&gt; is 1. For the first top-left position, this would be &lt;code&gt;0,0,1,1&lt;/code&gt; as I have tried to illustrate here:&lt;img src=&quot;https://i.stack.imgur.com/Yapzf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;li&gt;For an erosion, the result for the current pixel is the logical &lt;code&gt;AND&lt;/code&gt; of the values you just wrote down. For dilation it is logical &lt;code&gt;OR&lt;/code&gt;. (Or min/max for grayvalue images)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note: You will either get a result image that is smaller than &lt;code&gt;A&lt;/code&gt; or you have to add &quot;padding&quot; pixels to &lt;code&gt;A&lt;/code&gt; (typically 1 for erosion and 0 for dilation)&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-02-16T09:23:23.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1479" PostTypeId="2" ParentId="1463" CreationDate="2012-02-16T10:50:47.750" Score="3" Body="&lt;p&gt;The best language for computer vision is C++. Although its major drawback is that it is more difficult to achieve what you want. OpenCV is the best library for computer vision out there but you can do the same things using matlab or python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look &lt;a href=&quot;http://simplecv.org/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="987" LastActivityDate="2012-02-16T10:50:47.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1480" PostTypeId="2" ParentId="1474" CreationDate="2012-02-16T13:14:28.370" Score="4" Body="&lt;p&gt;What about for a start:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Buzug, Computed Tomography&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hermann, Fundamentals of Computerized Tomography&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="602" LastActivityDate="2012-02-16T13:14:28.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1481" PostTypeId="2" ParentId="1474" CreationDate="2012-02-16T14:16:23.923" Score="3" Body="&lt;p&gt;An oldie but goodie is Kak and Slaney, Principles of Computerized Tomography which is available on line.&lt;/p&gt;&#xA;" OwnerUserId="991" LastEditorUserId="6" LastEditDate="2012-02-16T14:58:41.933" LastActivityDate="2012-02-16T14:58:41.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1482" PostTypeId="1" AcceptedAnswerId="1485" CreationDate="2012-02-16T16:28:53.057" Score="9" ViewCount="504" Body="&lt;p&gt;I would like to measure the quality of a color image, possibly as a difference to another image, but if possible, on its own too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question comes from the fact that we have a vision application, and improve lighting conditions, calbirations, and similar surrounding conditions. We want to measure the improvement of the quality of the image, such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Amount of detail&lt;/li&gt;&#xA;&lt;li&gt;Contrast&lt;/li&gt;&#xA;&lt;li&gt;Other things that describe the quality of an image or the amount of information in an image&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Do you have ideas for this? Maybe histogram comparisons, or an advanced distance measure on the histogram? I'd love to hear some good ideas!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course the results of the vision application are a measure of the quality of the images. But:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it is not intended as a measurement for the quality, it is a measurement of something else&lt;/li&gt;&#xA;&lt;li&gt;there are more parameters that influence the results of the application (for example the image itself), therefore it is only a rough measure of the quality of the image&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I could use human evaluation, but I really want an objective measure, especially because the human eyes are not objective (our mind plays tricks, the monitor we watch it on influences the image, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FINAL EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a discussion about what quality in an image is, I'll leave this question as is. My own ideas (and of my coworkers) are the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The range of the RGB channels (is it using all the colors possible)&lt;/li&gt;&#xA;&lt;li&gt;The mean of the Sobel amplitude (the amount of detail or a rough measure of focus, also see &lt;a href=&quot;https://dsp.stackexchange.com/questions/102/how-do-you-measure-detail-of-a-signal&quot;&gt;this question about detail&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;The amount of pixels that are clipped or 0 (no information in these pixels)&lt;/li&gt;&#xA;&lt;li&gt;Also the mean of the RGB channels and the YCbCr channels (after conversion), to be able to see if the average color has changed (may lead to investigating light from other sources, or after changing our own lighting)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;By combining these statistics we can get an impression of the quality from a more objective point of view, instead of just looking at the images. It also leads to pointers where the changes might come from.&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-02-22T16:17:42.737" Title="How to measure the quality (or difference in quality) of different images?" Tags="|image-processing|measurement|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1483" PostTypeId="1" CreationDate="2012-02-16T17:36:11.060" Score="12" ViewCount="653" Body="&lt;p&gt;I am trying to research and figure out how best to attack this problem. It straddles music processing, image processing, and signal processing, and so there are a myriad number of ways to look at it. I wanted to inquire as to the best ways to approach it since what might seem complex in the pure sig-proc domain might be simple (and already solved) by people who do image or music processing. Anyway, the problem is as follows: &lt;img src=&quot;https://i.stack.imgur.com/Fk3cj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you forgive my hand drawing of the problem, we can see the following,: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the above figure, I have 3 different 'types' of signals. The first one is a pulse that sort of 'steps' up in frequency from $f_1$ to $f_4$, and then repeats. It has a specific pulse duration, and a specific pulse-repetition time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second one only exists at $f_1$, but has a shorter pulse length and a faster pulse repetition frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally the third one is simply a tone at $f_1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, in what way do I approach this problem, such that I can write a classifier that can discriminate between signal-1, signal-2, and signal-3. That is, if you feed it one of the signals, it should be able to tell you this signal is so and so. What best classifier would give me a diagonal confusion matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some additional context and what I have been thinking of thus far:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said this straddles a number of fields. I wanted to inquire as to what methodologies might already exist before I sit down and go to war with this. I dont want to inadvertently re-invent the wheel. Here are some thoughts I have had looking from different view points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Signal-Processing Standpoint:&lt;/em&gt;  One thing I have looked at was doing a &lt;a href=&quot;http://en.wikipedia.org/wiki/Cepstrum&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cepstral Analysis&lt;/a&gt;, and then possibly using the &lt;a href=&quot;https://dsp.stackexchange.com/questions/1358/what-is-meant-by-spectral-moment&quot;&gt;Gabor Bandwidth&lt;/a&gt; of the cepstrum in discriminating signal-3 from the other 2, and then measuring the highest peak of the cepstrum in discriminating signal-1 from signal-2. That's my current signal-processing working solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Image-Processing Standpoint:&lt;/em&gt; Here I am thinking since I CAN in fact create images vis-a-vis the spectrograms, perhaps I can leverage something from that field? I am not intimately familiar with this part, but what about doing a 'line' detect using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hough Transform&lt;/a&gt;, and then somehow 'counting' the lines (what if they are not lines and blobs though?) and going from there? Of course at any point in time when I take a spectrogram all the pulse s you see might be shifted along the time axis, so would this matter? Not sure...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Music-Processing Standpoint:&lt;/em&gt; A subset of signal processing to be sure, but it occurs to me that signal-1 has a certain, perhaps repetitive (musical?) quality that people in the music-proc see all the time and have already solved in maybe discriminating instruments? Not sure, but the thought did occur to me. Perhaps this stand point is the best way to look at it, taking a chunk of the time domain and teasing out those step-rates? Again, this is not my field, but I heavily suspect this is something that has been seen before... can we look at all 3 signals as different types of musical instruments?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also add that I have a decent amount of training data, so perhaps using some of those methods might just let me do some feature extraction which I can then utilize &lt;a href=&quot;http://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;K-Nearest Neighbor&lt;/a&gt; with, but thats just a thought. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway this is where I stand right now, any help is appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDITS BASED ON COMMENTS:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, $f_1$, $f_2$, $f_3$, $f_4$ are all known in advance. (Some variance but very little. For example, lets say we know that $f_1$ = 400 Khz, but it might come in at 401.32 Khz. However distance to $f_2$ is high, so $f_2$ might be at 500 Khz in comparison.) Signal-1 will ALWAYS step on those 4 known frequencies. Signal-2 will ALWAYS have 1 frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Pulse repetition rates and pulse lengths of all three classes of signals are also all known in advance. (Again some variance but very little). Some caveats though, pulse repetition rates and pulse lengths of signals 1 and 2 are always known, but they are a range. Fortunately though, those ranges dont overlap at all.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The input is a continuous time series coming in at real time, but we can assume that signals 1, 2, and 3 are mutually exclusive, in that, only one of them exists at any point in time. We also have a lot of flexibility on how much of a time chunk you take it to process at any point in time. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The data can be noisy yes, and there might be spurious tones, etc, at bands not in our known $f_1$, $f_2$, $f_3$, $f_4$. This is quite possible. We can assume a med-high SNR just to 'get started' on the problem though.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-02-17T16:09:23.627" Title="What methodology to use for discrimination of different (musical?) tones" Tags="|image-processing|computer-vision|music|classification|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1484" PostTypeId="1" CreationDate="2012-02-16T18:08:24.420" Score="15" ViewCount="25403" Body="&lt;p&gt;Say I use only one calibrated camera. From this camera, I get images A and B. I know the homography between A and B, computed through &lt;a href=&quot;http://code.opencv.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV&lt;/a&gt;'s &lt;a href=&quot;http://opencv.itseez.com/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=findhomography#Mat%20findHomography%28InputArray%20srcPoints,%20InputArray%20dstPoints,%20int%20method,%20double%20ransacReprojThreshold,%20OutputArray%20mask%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;findHomography()&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I know the pose (rotation matrix R and translation vector t) of image A, and I need the pose of image B. Once I get it, I suppose I'll be able to compute every further poses of following images.&lt;/p&gt;&#xA;&lt;p&gt;Do you know an implementation of computing B's pose? I found several articles on the web, but I couldn't find an easily implementable solution...&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I found a nice implementation, using OpenCV: &lt;a href=&quot;http://code.opencv.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://nghiaho.com/?p=1298&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="80" LastEditDate="2020-07-16T18:02:46.673" LastActivityDate="2020-07-16T18:02:46.673" Title="How to compute camera pose from Homography matrix?" Tags="|image-processing|computer-vision|3d|opencv|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1485" PostTypeId="2" ParentId="1482" CreationDate="2012-02-16T18:37:48.467" Score="3" Body="&lt;p&gt;It all depends on what you mean by &quot;quality&quot;.  If it is visual quality as perceived by people, then the best thing to do is to ask multiple people to compare pairs of images to see which ones they like better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you have mentioned a vision application, then it must have some performance metrics for whatever it does, which would be its measure of quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If by quality you mean how blurry or noisy the image is, then you might compute the Fourier transform to see whether the image contains high frequency components to see how blurry it is, or compute its entropy to see how noisy it is.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-02-16T18:37:48.467" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1487" PostTypeId="2" ParentId="1483" CreationDate="2012-02-16T20:41:18.987" Score="7" Body="&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compute the STFT $S(m, k)$ of the signal using a frame size smaller than the pulse duration. I assume that this frame size will still offer sufficient frequency discrimination between f1, f2, f3 and f4. $m$ is the frame index, $k$ is the FFT bin index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each STFT frame, compute the dominant fundamental frequency using something like YIN, along with a &quot;pitch confidence&quot; indicator, such as the depth of the DMF &quot;dip&quot; computed by YIN.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us call $f(m)$ the dominant f0 estimated at frame $m$ and $v(m)$ the pitch confidence detected at frame $m$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if your data is not that noisy, you can get away by using the autocorrelation as a pitch estimator, and the ratio of the larger secondary peak of the autocorrelation to $r_0$ as a pitch confidence indicator. YIN is cheap to implement, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also compute the total signal energy $e(m)$ of FFT frame $m$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a sliding window of $M$ STFT frames. $M$ is chosen to be larger than the pulse repetition time and 5 to 10 times smaller than the typical length of a signal segment (for example if an occurrence of a signal lasts for about 10s, and your STFT frame size is 20ms, you can chose $M = 50$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extract the following features:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\sigma_f(k)$ is the standard deviation of the sequence $(f(m))_{m \in [k - M, k + M], v(m) &amp;gt; \tau}$&lt;/li&gt;&#xA;&lt;li&gt;$\sigma_v(k)$ is the standard deviation of the sequence $(v(m))_{m \in [k - M, k + M]}$&lt;/li&gt;&#xA;&lt;li&gt;$\sigma_e(k)$ is the standard deviation of the sequence $(e(m))_{m \in [k - M, k + M]}$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Intuitively, $\sigma_f$ measure the frequency stability of the main pitched component of the signal, $\sigma_v$ measure the variability of &quot;pitchiness&quot; of the signal, and $\sigma_e$ the variability of the amplitude of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be the features to base your detection upon. Signals of type 1 will have a high $\sigma_f$ (variable pitch) and a moderate $\sigma_v$ and $\sigma_e$ (steady pitched signal strength). Signals of type 2 will have a low $\sigma_f$ (steady pitch) and a high $\sigma_v$  and $\sigma_e$ (variable strength). Signals of type 3 will have a low $\sigma_f$ (steady pitch) and a low $\sigma_v$ and $\sigma_e$ (steady strength).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compute these 3 features on your training data and train a naive bayesian classifier (just a bunch of gaussian distributions). Depending on how good your data is you could even get away with classifiers and use hand-defined thresholds on the features, though I don't recommend this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To process an incoming stream of data, compute the STFT, compute the features, and classify each window of $M$ STFT frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your data and classifier are good, you will see something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This delimits quite well the start and end time, and type of each signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your data is noisy, there must be spurious misclassified frames:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 3, 2, 2, 1, 1, 1, 3, 1, 1, 1, 3, 3, 3, 2, 3, 3, 3 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you see a lot of crap like in the second case, use a mode filter on the data over neighborhoods of 3 or 5 detections ; or use HMMs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Take home message&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want to base your detection upon is not a spectral feature, but aggregated temporal statistics of spectral features over windows which are at the same scale as your signal durations. This problem really calls for a processing on two time scales: the STFT frame on which you compute very local signal properties (amplitude, dominant pitch, pitch strength), and larger windows over which you peek at the temporal variability of those signal properties.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-16T20:46:58.903" LastActivityDate="2012-02-16T20:46:58.903" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1488" PostTypeId="2" ParentId="1482" CreationDate="2012-02-16T20:42:31.867" Score="2" Body="&lt;p&gt;There are very specific metrics for Quality measurement that are used for Image/Video compression. However, i don't think you are looking for that here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quality here is concerned with ability to apply vision algorithms and hence ability to extract key features in the right way.  If this is the case, it all depends on which features you are extracting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tell use something more about your application.&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-16T20:42:31.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1489" PostTypeId="1" AcceptedAnswerId="1491" CreationDate="2012-02-16T23:13:57.927" Score="3" ViewCount="2289" Body="&lt;p&gt;As part of a homework assignment, I had to take the Fourier transform of the kernel I was using to convolve a signal.  The kernel was a constant rectangular function, that was 1 within the square $(-1, -1)$, $(1, 1)$ and 0 everywhere else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering what this result really means.  What have I gotten once I take the Fourier transform of this function?&lt;/p&gt;&#xA;" OwnerUserId="993" LastActivityDate="2012-02-16T23:47:11.537" Title="How to 'interpret' the Fourier Transform (specifically, of a convolution kernel)" Tags="|fourier-transform|homework|continuous-signals|convolution|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1490" PostTypeId="1" CreationDate="2012-02-16T23:31:09.677" Score="5" ViewCount="959" Body="&lt;p&gt;I've written a program to compute the power spectral density of a signal. The problem I'm having is that the computed spectrum is quite a bit more noisy than it should be (comparing to the spectrum computed by Matlab), especially at low frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/U6S07.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/U6S07.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red in this plot shows the spectrum computed by Matlab's &lt;code&gt;cpsd&lt;/code&gt; command (0 overlap, NFFT=window=8192, 200Hz signal), and the green shows my own. There's a constant offset (in the log domain) between them, but that's okay for now. What I'm more concerned about is that my implementation is noisier, especially in the 0-3Hz range. The algorithm I've implemented is&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Zero out a vector of length NFFT/2+1, for averaging.&lt;/li&gt;&#xA;&lt;li&gt;Until there are no more samples:&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Read NFFT samples (0-fill the remainder if there are less than NFFT)&lt;/li&gt;&#xA;&lt;li&gt;Compute the 1-dimensional real NFFT&lt;/li&gt;&#xA;&lt;li&gt;Compute the magnitude of each complex result, and divide by NFFT&lt;/li&gt;&#xA;&lt;li&gt;Add this to the corresponding position in the averaging vector&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;li&gt;Divide each sum by the twice the sampling frequency times the number of windows read&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sizing a window different than NFFT, and overlap, aren't included in the algorithm, but when compared to the Matlab output for window=NFFT and no overlap it shouldn't matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone speak as to why this results in low frequency instability?&lt;/p&gt;&#xA;" OwnerUserId="994" LastEditorUserId="440" LastEditDate="2012-04-17T09:17:38.867" LastActivityDate="2012-04-17T09:17:38.867" Title="Error in power spectral density computation" Tags="|matlab|frequency-spectrum|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1491" PostTypeId="2" ParentId="1489" CreationDate="2012-02-16T23:47:11.537" Score="3" Body="&lt;p&gt;Convolving a signal with a kernel is equivalent to applying a filter to it. The kernel is the impulse response of the filter, and the Fourier transform of the kernel is thus the frequency response of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the filter's impulse response is a rectangular function of width 2 and centered at 0. You can interpret this filter this way: for any $t$, the filter output $y(t)$ will be the average of the input signal $x(t)$ over the interval $[t - 1, t + 1]$. This is an averaging, low-pass filter, and indeed, the Fourier transform of the kernel is a decreasing function, showing that the higher frequencies are attenuated.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-16T23:47:11.537" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1492" PostTypeId="1" CreationDate="2012-02-17T01:15:17.910" Score="6" ViewCount="787" Body="&lt;p&gt;I didn't find a suitable tag for this, but figured it would fit under &quot;Frequency spectrum&quot;.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which of the Spread-spectrum systems listed &lt;a href=&quot;http://en.wikipedia.org/wiki/Spread_spectrum&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; are most resistant to multipath fading? Please, briefly tell me why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Wikipedia article above lists these (or a combination of at least 2?):&lt;br&gt;&lt;br&gt;&#xA;&lt;strong&gt;FHSS&lt;/strong&gt;: Frequency-hopping spread spectrum.&lt;br&gt;&#xA;&lt;strong&gt;DSSS&lt;/strong&gt;: Direct-sequence spread spectrum.&lt;br&gt; &#xA;&lt;strong&gt;THSS&lt;/strong&gt;: Time-hopping spread spectrum.&lt;br&gt;&#xA;&lt;strong&gt;CSS&lt;/strong&gt;:  Chirp spread spectrum.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there other distinct techniques the article doesn't list?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--gv &lt;/p&gt;&#xA;" OwnerUserId="996" LastActivityDate="2021-11-29T23:05:45.500" Title="Spread-spectrum systems and multipath fading" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1493" PostTypeId="1" CreationDate="2012-02-17T03:01:09.193" Score="11" ViewCount="797" Body="&lt;p&gt;This is my snoring detector again.&lt;/p&gt;&#xA;&lt;p&gt;I've gotten pretty good at detecting a signal when there's anything there -- can track from a wall-peeling snore down to breathing you can't even hear in the recording.  The problem is, I can't tell when the signal has dropped below detectable level and the app is just &amp;quot;hearing things&amp;quot;.  And, unfortunately, snoring/breathing is often irregular enough that a simple autocorrelation or similar interval timing scheme is unlikely to help much.  (And it's actually likely that in some cases the noise is more regular than the breathing.)&lt;/p&gt;&#xA;&lt;p&gt;So, are there any tricks I'm missing for figuring out when there is no signal?  It kind of seems that I'm up against a hard place here, given the &amp;quot;signal&amp;quot; is so noise-like to begin with.&lt;/p&gt;&#xA;&lt;p&gt;(And maybe this is related to another problem I'm having:  Strangely, I can't accurately (or even approximately) measure the signal level even when fairly loud.  Since I need to use rolling averages and ratios to detect the signal anyway, the level information kind of gets lost.  I'm looking for some tricks to reconstitute it.)&lt;/p&gt;&#xA;&lt;h2&gt;Basic technique&lt;/h2&gt;&#xA;&lt;p&gt;(For Yoda)&lt;/p&gt;&#xA;&lt;p&gt;The audio signal is sampled (generally at 8000Hz, for various reasons), then FFTed in 1024 blocks.  (In my experiments Hamming filters and overlapping blocks seem to have little effect, though those may be revisited later.)&lt;/p&gt;&#xA;&lt;p&gt;The FFT is divided into &amp;quot;bands&amp;quot; (currently 5, slightly skewed in size to place more detail on the low end) and the &amp;quot;spectral difference&amp;quot; and level of each band is summed.  Long-term averages of the peak-limited values are used as &amp;quot;thresholds&amp;quot;, and further bias adjustments are used to maintain a roughly 20% &amp;quot;over threshold&amp;quot; rate.&lt;/p&gt;&#xA;&lt;p&gt;Each &amp;quot;over threshold&amp;quot; value is given a weight of 1 (under threshold is given a weight of 0), but then that weight is adjusted by the apparent &amp;quot;variability&amp;quot; (at roughly 2Hz) in the band, to give more weight to bands that carry more apparent signal.&lt;/p&gt;&#xA;&lt;p&gt;The weights of the bands are summed and then the summed weights of subsequent blocks are summed over about a second to produce a running &amp;quot;score&amp;quot;.  This is again compared to a running average threshold (plus several heuristics) to detect snore onset/offset.&lt;/p&gt;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&lt;p&gt;It suddenly occurred to me that if my algorithm effectively maintains a constant-level signal (per my signal level problem), the way to effectively gauge SNR is by measuring the noise when there's no signal.&lt;/p&gt;&#xA;&lt;p&gt;Conveniently, snores are intermittent, with lots of &amp;quot;dead air&amp;quot; in-between.  And I'm already detecting the snore envelopes.  So anything outside of the envelope (between the end of one snore and the start of the next) is presumably noise!  This I can (with some modest degree of accuracy/repeatability) measure.  (It took three tries to come up with a halfway decent algorithm, of course -- reality never matches the theory.)&lt;/p&gt;&#xA;&lt;p&gt;So I don't have the full answer yet, but I've made progress.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;(While the above technique gives me a fairly good proxy for SNR, I'm still having trouble estimating actual signal level.  My &amp;quot;relative level&amp;quot; indications can be off the scale for a barely audible breath and so-so for a window rattler.  I need some sort of proxy for absolute level.)&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-02-25T18:33:33.530" Title="How can you tell whether there's a signal (when your signal looks a lot like noise)?" Tags="|noise|snr|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1494" PostTypeId="2" ParentId="1490" CreationDate="2012-02-17T05:13:21.427" Score="3" Body="&lt;p&gt;Matlab splits your signal into 8 overlapping segments (by default). The difference I see between Matlab and your algorithm is that Matlab also multiplies each segment by a Hamming window. You should get pretty close results if you do that.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-02-17T05:13:21.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1495" PostTypeId="2" ParentId="1493" CreationDate="2012-02-17T08:36:37.883" Score="5" Body="&lt;p&gt;So far you seemed to identify snoring through the presence of a strong periodic pattern in the audio. If you tell me that there might be other sources with the same property, it's time to move on and focus on a property of the signal more specific of snoring ; and I would suggest to look more precisely into the timbre of the recorded sound itself. Given that a human listener can tall apart snoring from breathing, you might resort to traditional audio signal classification approach. Compute features like MFCCs and Fluctuation patterns on your audio data, and train a bayesian classifier (or more sophisticated) to discriminate snoring from breathing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be time also to review the literature on the topic... For example I found this: &lt;a href=&quot;http://web.itu.edu.tr/kamasak/pubs/pdf/pm7_8_007.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://web.itu.edu.tr/kamasak/pubs/pdf/pm7_8_007.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-17T08:36:37.883" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1496" PostTypeId="1" CreationDate="2012-02-17T11:07:17.867" Score="2" ViewCount="3693" Body="&lt;p&gt;I have this jpeg image (abc.jpg) and I change some pixel values of this image and store this on hard disk, to later see the changed the pixel values. The name of the output jpeg image is say, xyz.jpg. The problem here is in the image xyz.jpg. The changed pixels does not give me the exact values which I changed them to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In abc.jpg at the pixel position (x,y)=(1,10) the pixel value is (231, 120, 120). Now, I want to change it to (230, 120, 120). Now, I save this output image as xyz.jpg. When I try to retrieve the values from position (1,10) I get the pixel value as (232, 120, 120). Now you see the problem, I can't get the value to which I have changed. I am doing all this in MATLAB. And yes, I have tried to save the output image as .tiff, .bmp, .gif. But the size of these formats is very large as compared to .jpg. Please suggest some solution to this problem.&lt;/p&gt;&#xA;" OwnerUserId="998" LastEditorUserId="440" LastEditDate="2012-04-12T10:03:49.940" LastActivityDate="2012-06-29T10:56:14.520" Title="Retrieve pixel values from the output jpeg image" Tags="|matlab|jpeg|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1497" PostTypeId="2" ParentId="1496" CreationDate="2012-02-17T11:35:57.737" Score="11" Body="&lt;p&gt;Ask yourself: why do you think the TIFF and BMP files are so large while JPEG files are small?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer: JPEG is a lossy compression format and achieves small file size by removing details from your image imperceptible to the human eye. By design, JPEG cannot guarantee that the decompressed image will be pixel-by-pixel identical to the compressed image - it just preserves the overall content the human eye can perceive. You could try increasing the quality parameter, but this probably won't solve the problem in your case. Brightness levels will still be quantized, and color information downsampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some &quot;solutions&quot;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do not use JPEG, use a lossless compression format.&lt;/li&gt;&#xA;&lt;li&gt;Do your image editing/modifications directly in the compressed domain. I doubt there are tools in Matlab to do that, and compressed-domain image modification is not as straightforward as writing into an array of pixels!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-17T12:37:20.173" LastActivityDate="2012-02-17T12:37:20.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1498" PostTypeId="2" ParentId="1483" CreationDate="2012-02-17T16:09:23.627" Score="3" Body="&lt;p&gt;An alternative approach could be four heterodyne detectors: Multiply the input signal with a local oscillators of 4 frequencies and low pass filter the resulting outputs. Each output represents a vertical line in your picture. You get the output at each of the 4 frequencies as a function of time. With the low pass filter you can dial in how much frequency deviation you want to allow for and also how fast you want the outputs to change, i.e. how sharp the edges are. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will work well even if the signal is fairly noisy.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-02-17T16:09:23.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1499" PostTypeId="1" AcceptedAnswerId="1500" CreationDate="2012-02-17T17:01:16.820" Score="16" ViewCount="11724" Body="&lt;p&gt;I'm now processing MP3 file and encounter this problem. My MP3 is stereo encoded. What I want to do is extract vocal part for further processing(whatever mode of output signals, mono or stereo are both OK).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, audio is encoded into different dis-joint sub frequency bands in MP3. I think I can limit the signals to the vocal range through high-pass/low-pass filter with cutting-off frequency proper set. However, result must contain parts of pure music signal in this case.&#xA;Or after googling, I think I may calculate the background signals first(by inverting one channel adding with signals from the other channel assuming vocal part is centered in the stereo audio called phase cancellation). After this transformation, the signal is mono. Then I should merge the original stereo into mono from which extracting the background signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the effectiveness, which one is preferred(or any other solutions:)? If the 2nd one, let two channels A and B, will (B-A) or (A-B) used when compute the background? As with merging two channels, does the arithmetic mean accurate enough? Or I can downsample each channel by a factor of two and interleave the downsampled signals as mono result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and best regards.&lt;/p&gt;&#xA;" OwnerUserId="942" LastActivityDate="2012-04-25T20:41:39.813" Title="How to extract vocal part from stereo audio signal?" Tags="|audio|downsampling|mp3|background-subtraction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1500" PostTypeId="2" ParentId="1499" CreationDate="2012-02-17T17:45:23.000" Score="22" Body="&lt;p&gt;First of all, how the data is encoded in a mp3 file is irrelevant to the question unless you aim at doing compressed-domain processing (which would be quite foolish). So you can assume your algorithm will work with decompressed time-domain data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sum / difference is a very, very basic trick for vocal suppression (not extraction). It is based on the assumption that the vocals are mixed at the center of the stereo field, while other instruments are panned laterally. This is rarely true. L-R and R-L will sound the same (the human ear is insensitive to a global phase shift) and will give you a mono mix without the instruments mixed at the center. The problem is, once you have recovered the background, what will you do with it? Try to suppress it from the center (average) signal? This won't work, you will be doing (L + R) / 2 - (L - R), this is not very interesting... You can try any linear combinations of those (averaged and &quot;center removed&quot;), nothing will come out of it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding filtering approaches: the f0 of the voice rarely exceeds 1000 Hz but its harmonics can go over that. Removing the highest frequency will make consonants (especially sss, chhh) unpleasant. Some male voices go below 100 Hz. You can safely cut whatever is below 50 or 60 Hz (bass, kick), though&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some recent developments in voice separation worth exploring:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Jean Louis Durrieu's &lt;a href=&quot;http://www.durrieu.ch/publis/durrieuDavidRichard_musicallyMotivatedRepresentation_JSTSP2011.pdf&quot;&gt;background NMF + harmonic comb &gt; filter&lt;/a&gt; model. &lt;a href=&quot;http://www.durrieu.ch/research/jstsp2010.html&quot;&gt;Python code here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Rafii's &lt;a href=&quot;http://music.cs.northwestern.edu/publications/Rafii_Pardo_ICASSP_2011_repet.pdf&quot;&gt;background extraction approach&lt;/a&gt;. Straightforward to code and works well on computer-produced music with very repetitive patterns like Electro, Hip-hop...&lt;/li&gt;&#xA;&lt;li&gt;Hsu's approached based on f0 detection, tracking and masking. &quot;A Tandem Algorithm for Singing Pitch Extraction and Voice Separation from Music Accompaniment&quot; (can't find accessible PDF).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-17T17:56:54.000" LastActivityDate="2012-02-17T17:56:54.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1503" PostTypeId="2" ParentId="1496" CreationDate="2012-02-18T02:52:22.140" Score="1" Body="&lt;p&gt;JPEG is a lossy format, which means that noise will be added between compression and decompression.   So, in general, you can't get a noiseless result (same pixels out as in for the entire image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For individual pixels though, you might be able to force a desired value by dithering a region around a single pixel of interest.  You might try many random low level noise patterns around the pixel of interest (it might involve up to the entire macroblock) by trial and error and see if one of the random patterns moves the result in the desired direction by the desired amount, or perhaps a genetic algorithm can converge on an appropriate dither pattern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether or not the above works will likely depend on what quantization or compression level the JPEG compressor is configured for.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-02-18T02:52:22.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1504" PostTypeId="2" ParentId="1493" CreationDate="2012-02-18T02:58:10.213" Score="0" Body="&lt;p&gt;You might need to build a dynamic classifier, that can adapt to the current subject, sleep phase, and audio environment, rather than tune to a fixed training set.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-02-18T02:58:10.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1505" PostTypeId="1" AcceptedAnswerId="1541" CreationDate="2012-02-18T14:26:51.663" Score="4" ViewCount="1391" Body="&lt;p&gt;I understand I can get a color from wavelength but it's not true for the opposite direction.&#xA;In case this picture would help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/A4SoP.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this question simple, let's lighting and calibration aside to an optimized condition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if there is any way to get intensity value of a certain spectral wavelength for given pixel of a common image. That is, Wavelength and rgb of a pixel are both known. Based on that, I want to compute intensity of the wavelength for the pixel.&lt;/p&gt;&#xA;" OwnerUserId="1011" LastEditorUserId="1011" LastEditDate="2012-02-23T01:54:07.997" LastActivityDate="2012-04-07T16:30:29.620" Title="Is there any way to get intensity value of a certain wavelength for given pixel of a normal  image?" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1506" PostTypeId="1" AcceptedAnswerId="1507" CreationDate="2012-02-18T17:12:05.460" Score="4" ViewCount="163" Body="&lt;p&gt;I am attempting to implement the Gabor Descriptor based on the following paper &lt;a href=&quot;http://gr.xjtu.edu.cn:8080/LiferayFCKeditor/UserFiles/File/lsmm9393-li.pdf&quot; rel=&quot;nofollow&quot;&gt;Image Copy Detection Using a Robust Gabor Texture Descriptor&lt;/a&gt;. It is the best paper that I have found on the subject. It is not perfect, as it has some ordering issues with some equations and paragraphs that only make sense after later sections. No biggie, it is only a matter of time consumed to decipher the intent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is stopping me right now, is that one of the parameters is never defined in the paper. It first appears in $(1)$ of Section 2. There we have the following factor: $e^{2\pi jWx}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$W$ is later assumed to be 1 and $x$ is the parameter of the function, but $j$ is never defined (though it is used again in several subsequent equations, especially in section 3.1, of most interest is $(11)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am seeking either a definition of $j$. A nice bonus would be a better paper (or book) defining the Gabor Descriptor.&lt;/p&gt;&#xA;" OwnerUserId="787" LastActivityDate="2012-04-12T10:14:39.160" Title="Struggling to find a good definiton for Gabor-Descriptor" Tags="|image-processing|computer-vision|algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1507" PostTypeId="2" ParentId="1506" CreationDate="2012-02-18T17:39:10.043" Score="5" Body="&lt;p&gt;In this context, $j$ is the imaginary unit: $j = \sqrt{-1}$. The complex exponential function represents what they call an &quot;oriented sinusoidal grating.&quot; The fact that $j$ is the imaginary unit in this case can be verified by noticing the relationship between $(1)$ and $(2)$ in Section 2; this is an example of the frequency-shifting property of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform&quot;&gt;Fourier transform&lt;/a&gt;. That is, multiplying the Gaussian function $h(x,y)$ by the complex exponential function results in a shift in the Fourier transform of the result along the axis that the sinusoid runs across (the $x$ axis in your example).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-02-18T17:39:10.043" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1508" PostTypeId="2" ParentId="1506" CreationDate="2012-02-18T21:23:14.853" Score="5" Body="&lt;p&gt;Electrical Engineers typically use $j$ for the imaginary unit since $i$ is reserved for current. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole terms is a complex exponential, i.e. it's magnitude is always one and the period is W*x. It's only unity if W*x is an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The identity you use only works if W and x are positive integers, see &lt;a href=&quot;http://en.wikipedia.org/wiki/Exponentiation#Failure_of_power_and_logarithm_identities&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Exponentiation#Failure_of_power_and_logarithm_identities&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="440" LastEditDate="2012-04-12T10:14:39.160" LastActivityDate="2012-04-12T10:14:39.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1512" PostTypeId="1" CreationDate="2012-02-19T17:46:53.760" Score="7" ViewCount="479" Body="&lt;p&gt;I have two EEG signals that are very similar. The difference is only in amplitudes. However, they are coming from two different cognitive processes. What are some methods, beside FFT, for distinguishing between two very similar signals in terms of statistical information? Please let me know. Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BSS.&lt;/p&gt;&#xA;" OwnerUserId="1010" LastEditorUserId="6" LastEditDate="2012-02-21T15:12:08.990" LastActivityDate="2013-02-21T10:22:07.463" Title="How can I distinguish between two similar EEG signals?" Tags="|classification|eeg|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1513" PostTypeId="1" CreationDate="2012-02-19T20:00:46.383" Score="3" ViewCount="665" Body="&lt;p&gt;I have come across the following function and I'm trying to figure out what it really is.  I have this function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f[x, y] = \delta [x + 2A, y - A] - \delta [x - A, y + A]$.  The $\delta$ is representative of the dirac delta function.  This function is used as input to some finite impulse response filter.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this function really mean?  Is the first part of the function 0 everywhere except $-2A, A$ and the second part 0 everywhere except $A, -A$ ?&lt;/p&gt;&#xA;" OwnerUserId="993" LastActivityDate="2012-02-22T21:00:15.423" Title="With respect to the dirac delta function, what does $\delta [x + 2A, y - A]$" Tags="|discrete-signals|filter-design|finite-impulse-response|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1515" PostTypeId="2" ParentId="1513" CreationDate="2012-02-20T04:00:31.390" Score="3" Body="&lt;p&gt;A (two-dimensional) finite-impulse-response filter has an impulse response $g(x,y)$ &#xA;that is nonzero only for $(x,y)$ in a region of finite area (continuous parameters) &#xA;of for a finite number of values of $x$ and $y$ (discrete parameter). For example,&#xA;$g(x,y)$ might be nonzero only for points inside a circle of radius $r$.  Specifically,&#xA;consider&#xA;$$g(x,y) = \begin{cases}1, &amp;amp;x^2 + y^2 \leq r^2,\\0, &amp;amp;\text{otherwise}\end{cases}$$&#xA;describes an image filter whose response to a point source (impulse function)&#xA;at the origin is a disc of radius $r$ in the filtered image.  For input $f(x,y) = \delta (x + 2A, y - A) - \delta (x - A, y + A)$, the filter output would be the sum of a positive&#xA;disc centered at $(-2A,A)$ and a negative disc centered at $(A,-A)$ with cancellation&#xA;occurring where the discs overlapped. (Disc ovrlap would be determined by the&#xA;relationship between $A$ and $r$). More formally,&#xA;$$g(x,y)\circledast f(x,y) = \begin{cases}&#xD;&#xA;1, &amp;amp;(x+2A)^2 + (y-A)^2 \leq r^2, (x-A)^2+(y+A)^2 &amp;gt; r^2,\\&#xD;&#xA;-1, &amp;amp;(x+2A)^2 + (y-A)^2 &amp;gt; r^2, (x-A)^2+(y+A)^2 \leq r^2,\\&#xD;&#xA;0, &amp;amp;\text{otherwise.}\end{cases}$$&#xA;where we have combined the outer darkness of $0$ with the $0$ produced&#xA;by the cancellation of the discs in the region of overlap (if any).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar calculations can be done for the discrete case as well.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-02-20T04:00:31.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1516" PostTypeId="1" AcceptedAnswerId="1518" CreationDate="2012-02-20T15:00:21.017" Score="3" ViewCount="279" Body="&lt;p&gt;For developing an application I have to identify a region of sound. But I’m not sure if I have my basic knowledge right. I’m using AMR-NB sound clips to identify a sound region. According to my understanding AMR files have 160 samples for each 20ms (milliseconds) making it 800 sample for 1 minute. I am basing my complete dependence on this concept. Please let me know whether this is correct if not please correct me. Thanks in advance.  &lt;/p&gt;&#xA;" OwnerUserId="825" LastActivityDate="2012-02-21T10:48:03.557" Title="Issue with AMR file structure" Tags="|audio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1518" PostTypeId="2" ParentId="1516" CreationDate="2012-02-20T21:38:26.570" Score="1" Body="&lt;p&gt;Actually, if it's got 160 samples every 20ms, you get a sampling rate of 8000 (you're missing a zero), which is the standard for over-the-phone voice communication. from a Google search, I couldn't find any AMR-NB specification that uses a different sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I found this line &lt;a href=&quot;http://forum.doom9.org/archive/index.php/t-85426.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; pretty useful:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For AMR-NB, only an “8000” sample rate and one of the following&#xA;  bitrates are valid:&#xA;  4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec#Usage&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; also mentions that AMR-NB uses a 8000 Hz sampling rate, you can be pretty sure that this is the case all across the board.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-02-20T21:38:26.570" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1519" PostTypeId="1" CreationDate="2012-02-21T00:08:37.073" Score="10" ViewCount="9843" Body="&lt;p&gt;In a first course in Information Theory, when the operational interpretation of channel capacity is introduced, it is said to be the highest data rate (in bits/channel-use) of reliable communication. While reading a few papers, I came across channel capacity being expressed in units of bits/s/Hz. So I was thinking about the connection between the two units and came up with the following explanation. Please let me know if this is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a bandlimited channel (bandwidth = $W$ Hz), you can transmit at $2W$ symbols/sec by the Nyquist sampling theorem. So the rate &quot;per bandwidth&quot; (spectral efficiency) can be written as 2 symbols/sec/Hz. If each symbol is 1 bit, then you are transmitting 1 bit in each of the samples. So is 1 bit/channel-use equivalent to 2 bits/sec/Hz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is one &quot;channel-use&quot;?&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2018-01-31T16:09:43.407" Title="Information Theory - units of channel capacity" Tags="|digital-communications|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1522" PostTypeId="1" AcceptedAnswerId="1528" CreationDate="2012-02-21T12:58:24.203" Score="48" ViewCount="51548" Body="&lt;p&gt;Below is a signal which represents a recording of someone talking. I would like to create a series of smaller audio signals based on this. The idea being to detect when 'important' sound starts and ends and use those for markers to make new snippet of audio. In other words, I would like to use the silence as indicators as to when an audio 'chunk' has started or stopped and make new audio buffers based on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, if a person records himself saying&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Hi [some silence] My name is Bob [some silence] How are you?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I would like to make three audio clips from this. One that says &lt;code&gt;Hi&lt;/code&gt;, one that says &lt;code&gt;My name is Bob&lt;/code&gt; and one that says &lt;code&gt;How are you?&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial idea is to run through the audio buffer constantly checking where there are areas of low amplitude. Maybe I could do this by taking the first ten samples, average the values and if the result is low then label it as silent. I would proceed down the buffer by checking the next ten samples. Incrementing  along in this way I could detect where envelopes start and stop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has any advice on a good, but &lt;strong&gt;&lt;em&gt;simple&lt;/em&gt;&lt;/strong&gt; way to do this that would be great. For my purposes the solution &lt;strong&gt;&lt;em&gt;can&lt;/em&gt;&lt;/strong&gt; be quite rudimentary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not a pro at DSP, but understand some basic concepts. Also, I would be doing this programmatically so it would be best to talk about algorithms and digital samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for all the help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dc7Tk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great responses so far! Just wanted to clarify that this is not on live audio and I will be writing the algorithms myself in C or Objective-C so any solutions that use libraries aren't really an option.&lt;/p&gt;&#xA;" OwnerUserId="893" LastEditorUserId="893" LastEditDate="2012-02-21T17:09:20.897" LastActivityDate="2014-01-06T19:22:57.600" Title="Simplest way of detecting where audio envelopes start and stop" Tags="|filters|audio|filter-design|" AnswerCount="6" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1523" PostTypeId="1" CreationDate="2012-02-21T13:49:20.623" Score="15" ViewCount="5482" Body="&lt;p&gt;I am currently creating different signals using Matlab, mixing them by multiplying them by a mixing matrix A, and then trying to get back the original signals using &lt;a href=&quot;http://research.ics.tkk.fi/ica/fastica/&quot; rel=&quot;noreferrer&quot; title=&quot;FastICA&quot;&gt;FastICA&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, the recovered signals are really bad when compared to the original ones, which was not what I expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to see whether I'm doing anything wrong. The signals I'm generating are the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s1 = (-x.^2 + 100*x + 500) / 3000; % quadratic&#xA;s2 = exp(-x / 10); % -ve exponential&#xA;s3 = (sin(x)+ 1) * 0.5; % sine&#xA;s4 = 0.5 + 0.1 * randn(size(x, 2), 1); % gaussian&#xA;s5 = (sawtooth(x, 0.75)+ 1) * 0.5; % sawtooth&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WoCMG.png&quot; alt=&quot;Original Signals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One condition for ICA to be successful is that at most one signal is Gaussian, and I've observed this in my signal generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, another condition is that all signals are statistically independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I know is that this means that, given two signals A &amp;amp; B, knowing one signal does not give any information with regards to the other, i.e.: P(A|B) = P(A) &lt;em&gt;where P is the probability&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is this: &lt;strong&gt;Are my signals statistically independent?&lt;/strong&gt; Is there any way I can determine this? Perhaps some property that must be observed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing I've noticed is that when I calculate the eigenvalues of the covariance matrix (calculated for the matrix containing the mixed signals), &lt;strong&gt;the eigenspectrum seems to show that there is only one (main) principal component&lt;/strong&gt;. What does this really mean? Shouldn't there be 5, since I have 5 (supposedly) independent signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when using the following mixing matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A =&#xA;&#xA;0.2000    0.4267    0.2133    0.1067    0.0533&#xA;0.2909    0.2000    0.2909    0.1455    0.0727&#xA;0.1333    0.2667    0.2000    0.2667    0.1333&#xA;0.0727    0.1455    0.2909    0.2000    0.2909&#xA;0.0533    0.1067    0.2133    0.4267    0.2000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The eigenvalues are: &lt;code&gt;0.0000 0.0005 0.0022 0.0042 0.0345&lt;/code&gt; (only 4!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using the identity matrix as the mixing matrix (i.e. the mixed signals are the same as the original ones), the eigenspectrum is: &lt;code&gt;0.0103 0.0199 0.0330 0.0811 0.1762&lt;/code&gt;. There still is one value much larger than the rest..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apologise if the answers to my questions are painfully obvious, but I'm really new to statistics, ICA and Matlab. Thanks again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 500 samples of each signal, in the range [0.2, 100], in steps of 0.2, i.e. x = 0:0.1:100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, given the ICA Model: X = As + n (I'm not adding any noise at the moment), I am referring to the eigenspectrum of the transpose of X, i.e. eig(cov(X')).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As suggested (refer to comments), I tried &lt;a href=&quot;http://research.ics.tkk.fi/ica/fastica/&quot; rel=&quot;noreferrer&quot; title=&quot;FastICA&quot;&gt;FastICA&lt;/a&gt; on only 2 signals. The results were quite good (see pic below). The mixing matrix used was &lt;code&gt;A = [0.75 0.25; 0.25 0.75]&lt;/code&gt;. However, the eigenspectrum  &lt;code&gt;0.1657 0.7732&lt;/code&gt; still showed only one main principal component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question therefore boils down to the following: &lt;strong&gt;What function/equation/property can I use to check whether a number of signal vectors are statistically independent?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mPhHv.png&quot; alt=&quot;Sine &amp;amp; Gaussian - FastICA&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1017" LastEditorUserId="1017" LastEditDate="2012-02-25T11:27:26.967" LastActivityDate="2013-05-10T17:10:01.547" Title="ICA - Statistical Independence &amp; Eigenvalues of Covariance Matrix" Tags="|matlab|ica|statistics|independence|" AnswerCount="4" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="1524" PostTypeId="1" AcceptedAnswerId="1539" CreationDate="2012-02-21T14:48:10.627" Score="3" ViewCount="2051" Body="&lt;p&gt;For college we have to make simple exercise in simulink (matlab). (since my professor is not familiar with simulink, he can't help).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question itself is, &lt;strong&gt;how can I simulate the SNR when uniform quantization is used&lt;/strong&gt;. To illustrate this: &lt;img src=&quot;https://i.stack.imgur.com/8gSZ4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of this quantization there is noise. I need to display this noise. How do i do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional information: 10 bit quantization. The source has to be 40db.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know i can get the quantization error when I subtract the output from the input but i do not know how to get the quantization noise.&lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="440" LastEditDate="2012-04-17T08:36:41.727" LastActivityDate="2012-04-17T08:36:41.727" Title="How to find quantization noise in my simulation?" Tags="|matlab|noise|snr|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1525" PostTypeId="2" ParentId="1522" CreationDate="2012-02-21T16:08:19.437" Score="6" Body="&lt;p&gt;I assume that you are dealing with real, not complex signals- if that is not the case, let me know and I can amend the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Power is defined as the square of the signal (i.e. the signal samples multiplied by themselves).  You can compare the power to some threshold to determine if there is speech present or not.  You would probably need to do some measurements on your recordings to empirically find a good threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your recordings are &quot;clean&quot; (i.e. not much noise), I would probably go as simple as possible by comparing the instantaneous power (i.e. a single sample) to the threshold.  This means that you don't even have to square it if you don't want to, you just need the absolute value and compare it to the square root of the power threshold, which can be precomputed.  When you detect speech grab it and some amount of recording before it, to make sure you get all of the speech (maybe 1/10 of a second?).  Keep going until you find a prolonged period of no samples that exceed the threshold.  Again, the length of the period would need to be determined empirically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rinse and repeat.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-02-21T16:08:19.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1526" PostTypeId="2" ParentId="1522" CreationDate="2012-02-21T16:24:38.207" Score="9" Body="&lt;p&gt;I would totally second Jim Clay on his approach, but slightly vary the flavor using envelope:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that speech mainly occur around 1-2kHz. Your data sampling is likely to be 44kHz (this depend on your recording device). So what I would do first is a moving average of the squared signal in real time across 10 points, to have an envelope of the signal power. That will induce a delay in the detection, so you want to keep this low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I would add a calibration phase on your system: ask the user to remain silent, press a button, and record the background noise for let's say 10 seconds. Take the mean or median amplitude of the envelope, multiply by 2 to have a safety, and that would give you the threshold Jim has been talking about, automatically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is not real-time recording, you may find useful to use 0-phase moving average to diminish the annoyance caused by the delay. Tell us if it works for you as it is.&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2012-02-21T16:24:38.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1527" PostTypeId="2" ParentId="1522" CreationDate="2012-02-21T16:41:34.510" Score="9" Body="&lt;p&gt;Eric, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are truly after something quick and dirty, the first thing you have to get is the envelope, and I would do this simply (in MATLAB) by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; envelope = abs(hilbert(yourSignal));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At that point, I would simply threshold, and 'voice exists' if you are above a certain threshold. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very simple solution btw, but it might work for you.&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-02-21T16:41:34.510" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1528" PostTypeId="2" ParentId="1522" CreationDate="2012-02-21T17:14:22.300" Score="28" Body="&lt;p&gt;This is the classic problem of &lt;em&gt;speech detection&lt;/em&gt;. First thing to do would be to Google the concept. It is widely used in digital communication and there's been a lot of research conducted on the subject and there are good papers out there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, the more background noise you have to deal with the more elaborate your method of speech detection must be. If you're using recordings taken in a quiet room, you can do it very easily (more later). If you have all sorts of noise while someone is talking (trucks passing by, dogs barking, plates smashing, aliens attacking), you'll have to use something much more clever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the waveform you attached, your noise is minimal, so I suggest the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Extract signal envelope&lt;/li&gt;&#xA;&lt;li&gt;Pick a good threshold&lt;/li&gt;&#xA;&lt;li&gt;Detect places where envelope magnitude exceeds threshold&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What does this all mean? An &lt;a href=&quot;http://en.wikipedia.org/wiki/Envelope_detector&quot;&gt;envelope&lt;/a&gt; of a signal is a curve that describes its magnitude over time, independently of how its frequency content makes it oscillate (see image below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fkPSQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Envelope extraction can be done by creating a new signal that contains absolute values of you original signal, e.g. $\{ 1, 45, -6, 2, -43, 2 \ldots \}$ becomes $\{ 1, 45, 6, 2, 43, 2 \ldots \}$, and then &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Simplest_Lowpass_Filter.html&quot;&gt;low-pass filtering&lt;/a&gt; the result. The simplest low-pass filter can be implemented by replacing each sample value by an average of its &lt;em&gt;N&lt;/em&gt; neighbors on both sides. The best value of &lt;em&gt;N&lt;/em&gt; can be found experimentally and can depend on several things such as your sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see from the image that is you don't have much noise present, your signal envelope will always be above a certain threshold (loudness level), and you can consider those regions as &lt;em&gt;speech detected&lt;/em&gt; regions.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-02-21T17:38:44.280" LastActivityDate="2012-02-21T17:38:44.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1529" PostTypeId="2" ParentId="1523" CreationDate="2012-02-21T17:15:31.560" Score="9" Body="&lt;p&gt;Signals 3 and 5 appear to be quite correlated -- they share their first harmonic. If I were given two mixtures of those, I wouldn't be able to separate those, I'd be tempted to put the common harmonic as one signal and the higher harmonics as a second signal. And I would be wrong! This might explain the missing eigenvalue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signals 1 and 2 do not look independent too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick and dirty &quot;sanity-check&quot; for the independence of two series is to do a (x, y) plot of one signal against the other:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot (sig3, sig5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then to do the same (x, y) plot with one signal shuffled:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;indices = randperm(length(sig3))&#xA;plot(sig3(indices), sig5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the two plots have a dissimilar look, your signals are not independent. More generally, if the (x, y) plot of the data shows &quot;features&quot;, disymmetries etc, it's a bad omen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Proper tests for independence (and those are the objective functions used in the ICA optimization loop) include, for example, mutual information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ICA is recovering &lt;em&gt;the most independent signals a linear mixing of which yields your input data&lt;/em&gt;. It will work as a signal separation methods and recover the original signals only if those were maximally independent according to the optimization criterion used in your ICA implementation.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-21T17:15:31.560" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1530" PostTypeId="2" ParentId="1242" CreationDate="2012-02-21T19:14:52.767" Score="10" Body="&lt;p&gt;A few elements... (I know that this is not exhaustive, a more complete answer should probably mention moments)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check whether two distributions are independent, you need to measure how similar their joint distribution $p(x,y)$ is to the product of their marginal distribution $p(x) \times p(y)$. To this purpose, you can use any distance between distributions. If you use the Kullback-Leibler divergence to compare those distributions, you will consider the quantity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\int_x \int_y p(x, y) \log \frac{p(x, y)}{p(x) p(y)} dx dy$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you will have recognized... the Mutual Information! The lower it is, the more independent the variables are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More practically, to compute this quantity from your observations, you can either estimate the densities $p(x)$, $p(y)$, $p(x, y)$ from your data using a Kernel density estimator and do a numerical integration on a fine grid ; or just quantify your data into $N$ bins and use the expression of the Mutual Information for discrete distributions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the Wikipedia page on statistical independence and correlation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bc2Qq.png&quot; alt=&quot;Distribution plots&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the exception of the last example, these 2D distributions $p(x, y)$ have uncorrelated (diagonal covariance matrix), but not independent, marginal distributions $p(x)$ and $p(y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are indeed situations in which you might look at all the values of the cross-correlation functions. They arise, for example, in audio signal processing. Consider two microphones capturing the same source, but distant from a few meters. The cross-correlation of the two signals will have a strong-peak at the lag corresponding to the distance between microphones divided by the speed of sound. If you just look at the cross-correlation at lag 0, you won't see that one signal is a time-shifted version of the other one!&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-21T19:19:55.163" LastActivityDate="2012-02-21T19:19:55.163" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1531" PostTypeId="1" CreationDate="2012-02-21T19:19:04.510" Score="2" ViewCount="1955" Body="&lt;p&gt;I started off with this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x = 5 \cos(200 \times 2 \pi t ) + 10 \cos( 400 \times 2 \pi t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by performing a 1024 point DFT on it. Then I performed IDFT on the complex values obtained through DFT. Now, I want to express the original wave in terms of it's harmonics, so when I combine the DC and first harmonic or upto n harmonics, I get the original wave back. But how do I obtain these harmonics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I actually want to do. I have some real valued data(144 points). I want to express this data as a sum of cosines. For this purpose, I perform a 144 point DFT operation on this data, and bring them to frequency domain. &#xA;Does the Euler's identity, give me these cosine?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k] * e^{\tfrac{j2\pi kn}{144}} + X[144−k] * e^{\tfrac{−j2\pi kn}{144}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me obtain the Amplitude and phases of these harmonics.&lt;/p&gt;&#xA;" OwnerUserId="979" LastEditorUserId="979" LastEditDate="2012-02-21T21:38:09.957" LastActivityDate="2012-02-23T03:46:47.667" Title="Express a wave as a sum of cosine" Tags="|dft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1532" PostTypeId="1" CreationDate="2012-02-21T20:21:00.953" Score="6" ViewCount="410" Body="&lt;p&gt;We are given a set of grayscale image patches obtained from images after edge detection. Each patch is 10x10 pixels with intensity varying between 0 and 255 for each pixel. This set may contain a very few (maybe one or two) or a large number of patches. We want to represent the set by a single 10x10 pixel patch or “feature” such that the feature captures the invariance or common properties of the set. Intuitively speaking, the feature should be the intersection of the edges in the image patches in the set. For example, if all the patches contain a vertical edge at a fixed position and also contain other edges in different orientations and positions, then our feature should contain only the vertical edge at the fixed position and no other edge. Unfortunately, the operation of intersection is not well-defined for images. How can we approach to compute such a feature for a set of image patches?&lt;/p&gt;&#xA;" OwnerUserId="1019" LastActivityDate="2012-02-22T14:30:45.007" Title="image feature extraction" Tags="|image-processing|computer-vision|local-features|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1533" PostTypeId="1" AcceptedAnswerId="1536" CreationDate="2012-02-21T23:26:11.597" Score="6" ViewCount="3967" Body="&lt;p&gt;I am trying to understand the formalism of the projective transform of 2D image.&#xA;it has 9 parameters (a-i) which the 9th is redundant since we use houmogenous coordinates.&#xA;this transformation preserves only straight lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\pmatrix{x'\\ y' \\ w'}$  = $\pmatrix{ a&amp;amp; b&amp;amp; c\\\ d&amp;amp; e&amp;amp; f \\\ g&amp;amp; h&amp;amp; i}$  $\pmatrix{x\\ y \\ w}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have three questions according this formalism:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Since the redundancy (from 8 to 9) of degrees of freedom is $i=1$ ?&lt;/li&gt;&#xA;&lt;li&gt;what is the $w$ and $w'$ ? are they parameters? how do i calculate them?&lt;/li&gt;&#xA;&lt;li&gt;How can I find the parameters so I can transform the image to its original(from the black background image to the square one). &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;what I want to do is build the matrix to transform this image: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DJLah.png&quot; alt=&quot;input image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and find matrix $M$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so I get back this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DTuzX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;All the images  above taken from &lt;a href=&quot;http://moodle.cs.huji.ac.il/cs11/file.php/67829/Tirgul07.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want finally do is to find the &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = [a  b c; &#xA;     d  e f;&#xA;     g  h i];&#xA;&#xA;t_proj = maketform('projective',T);   &#xA;I_projective = imtransform(I,t_proj,'FillValues',.3);&#xA;imshow(I_projective)&#xA;title('unprojective - rectangular carpet')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;taken from &lt;a href=&quot;http://www.mathworks.com/products/demos/image/create_gallery/tform.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2012-03-05T20:20:30.100" LastActivityDate="2015-02-22T13:10:02.433" Title="What is the third coordinate in &quot;Projective Transformation&quot; of an image and how to build the matrix of the inverse transform?" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1534" PostTypeId="1" AcceptedAnswerId="1535" CreationDate="2012-02-22T08:46:52.673" Score="8" ViewCount="327" Body="&lt;p&gt;Does the inverse continuous time Fourier transform exist for a Dirac delta (A single causal/non-causal spike)?&lt;/p&gt;&#xA;" OwnerUserId="941" LastActivityDate="2012-02-23T13:48:19.653" Title="Does the inverse-CTFT exist for a dirac delta?" Tags="|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1535" PostTypeId="2" ParentId="1534" CreationDate="2012-02-22T09:10:24.890" Score="4" Body="&lt;p&gt;Yes, this is a complex exponential $e^{2 \pi i f_0 t}$, at a frequency determined by the delta's &quot;position&quot; $f_0$ (your input being $\delta(f - f_0)$). Write the integral for the inverse Fourier transform, use the definition of $\delta$ and you'll see it &quot;selects&quot; at this particular frequency the complex exponential being integrated.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-02-22T11:22:14.057" LastActivityDate="2012-02-22T11:22:14.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1536" PostTypeId="2" ParentId="1533" CreationDate="2012-02-22T10:28:11.910" Score="6" Body="&lt;p&gt;You have to understand that projective transformation is not linear.&#xA;It's $(x,y) -&amp;gt; (X(x, y)/Z(x,y) , Y(x, y)/Z(x,y))$, where X, Y, Z - linear functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w$ and $w&amp;#39;$ are essential here - they help represent this non-linear transformation as linear - matrix multiplication - and that way this linear representation is a homomorphism (preserve &quot;chaining&quot; of operations).$w$ for input image is usually taken as $1$;&#xA;You get $w&amp;#39;$ from matrix multiplication ($w' = gx + hy + iw$ ) and the end result of transform is $(x&amp;#39;/w&amp;#39;, y&amp;#39;/w&amp;#39;)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking you can't just assign $i=1$, but due to homogeneity you can divide all the matrix by $i$ and get new matrix, representing the same transform with right-left element $1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would advise you to read some textbook on projective geometry for computer vision to better understand this subject. Those questions have some deep implications.&lt;/p&gt;&#xA;" OwnerUserId="198" LastEditorUserId="198" LastEditDate="2012-02-22T14:26:51.177" LastActivityDate="2012-02-22T14:26:51.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1537" PostTypeId="1" AcceptedAnswerId="1588" CreationDate="2012-02-22T13:01:29.843" Score="4" ViewCount="1074" Body="&lt;p&gt;What are the most common and best topological skeleton matching techniques?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have skeletonized object and corresponding 2D model of this object. What are the next steps to match pattern? What are skeleton descriptors? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone could give code examples, reference to some open source projects using skeletonization and matching I would be grateful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want a method that will work also when skeleton is lack of some part of it due to bad object detection, but any suggestions are appreciated.&lt;/p&gt;&#xA;" OwnerUserId="583" LastEditorUserId="809" LastEditDate="2012-02-28T15:34:10.030" LastActivityDate="2012-02-28T15:34:10.030" Title="Topological skeleton matching techniques" Tags="|image-processing|computer-vision|shape-analysis|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1538" PostTypeId="2" ParentId="1532" CreationDate="2012-02-22T14:30:45.007" Score="4" Body="&lt;p&gt;&lt;em&gt;I may be wrong if i have not understood the question! I am trying to give a rather elementary introduction here. I can refine things and be more rigorous as suited.&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What you are looking for is that of 100 (or 1000) patches, which patch is the most &lt;em&gt;representative patch&lt;/em&gt; of all.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity if the size of a patch is 1x1. So it is just a scalar. In this case, you can just find a simple average $RepScalar = Avg = \sum P_i$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also apply median rather than averaging if appropriate. A more generalized way is to treat this as random variable and find expected value as $E(P) = \sum PDF(x) \cdot x $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I don't know if you are really conversent with this: so i am leaving you with a tutorial on this:&lt;/em&gt; &lt;a href=&quot;http://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/Chapter6.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/Chapter6.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in your case the $P$ is a vector instead of scalar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the averaging will become &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;RepPatch[i] = \sum_{k} P_k[i]   &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k$ is a patch number and $i \in { 1, ... 100 }$ for $10x10$ patch size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the &lt;em&gt;PDF&lt;/em&gt; or if you can estimate PDF you can find Expected value of this but for a vector of size of 100 (10x10) it is too complex. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-22T14:30:45.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1539" PostTypeId="2" ParentId="1524" CreationDate="2012-02-22T15:04:21.513" Score="7" Body="&lt;p&gt;The quantization error is the quantization noise. It is two different terms for the same thing.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-02-22T15:04:21.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1540" PostTypeId="2" ParentId="868" CreationDate="2012-02-22T16:28:39.883" Score="0" Body="&lt;p&gt;If you are really concerned about detection lines you can do a simplified approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Project your point cloud - on to at least two surfaces. Let say project them on XY plane and YZ plane. Basically start off with a blank canvas, and project each point based on some geometry criteria. So now you will have a finite 2D canvas which is all blank but &lt;em&gt;white&lt;/em&gt; points which are present. Now you can apply hough transform on this canvases. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on hough, you will get lines $(r,\theta)$ and $(r,\phi)$ for two respective planes. Next step really is to associate these lines to identify single 3D line out of this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as accuracy is concerned, when data is sparse, the score of the hough (i.e. strength) can be less. However, it will work if overall all lines are sparse. It is a problem when you are comparing a very long line against a short line. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-22T16:28:39.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1541" PostTypeId="2" ParentId="1505" CreationDate="2012-02-22T16:57:50.583" Score="1" Body="&lt;p&gt;If I understand correctly - you want to know what wavelength a given RGB value will show?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only some RGB values represent a pure wavelength, those on the edge of CIE diagram (there is no wavelength of brown for example) see &lt;a href=&quot;http://www.fourmilab.ch/documents/specrend/&quot; rel=&quot;nofollow&quot;&gt;http://www.fourmilab.ch/documents/specrend/&lt;/a&gt; for details and code&lt;/p&gt;&#xA;" OwnerUserId="1002" LastEditorUserId="1002" LastEditDate="2012-02-22T20:06:18.133" LastActivityDate="2012-02-22T20:06:18.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1542" PostTypeId="2" ParentId="1513" CreationDate="2012-02-22T18:48:16.823" Score="1" Body="&lt;p&gt;Adding an illustration here about the functions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First i am showing how a 1D function $f(x) = \delta[x+2A] - \delta[x-A]$ looks like. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/jLJcP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now below is the function you mentioned  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zc8dR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-02-22T21:00:15.423" LastActivityDate="2012-02-22T21:00:15.423" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1543" PostTypeId="2" ParentId="1522" CreationDate="2012-02-22T20:12:21.780" Score="29" Body="&lt;p&gt;What you really want to do is essentially called as &lt;a href=&quot;http://en.wikipedia.org/wiki/Voice_activity_detection&quot;&gt;Voice Activity Detection&lt;/a&gt; or speech detection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically any pure speech signal (which contains no music) has three parts. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The voiced sound - which is basically caused by Vowels &lt;/li&gt;&#xA;&lt;li&gt;The unvoiced sound - which contains consonants. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The characteristic of human sound is such that while a lot of energy is used in voiced sound the real information is contained in consonants. Also, voiced sound is usually lower frequency where as unvoiced sounds are higher frequencies. [To be precise all voiced sound are resonated more or less a constant frequency for a given person which is his/her pitch].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, as any system there is noise. The voiced sound is usually quite powerful enough that it can be distinguished visible. When you apply a lower frequency filtering it is possible to collect good magnitude of voiced sounds however, the unvoiced sound (with all the rich information) will get lost. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Coming to the question how to solve it:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick lies in the fact that unvoiced sound still come from a resonating source; and inherently restricted over a certain frequency. Where as, the noise is rather uniform. So a simple measure that distinguish all three is &quot;local power&quot; or alternatively but equivalent is to take the windowed auto-correlation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take at a time say 100 samples - and auto correlate itself, if it contains only noise the results will be pretty much zero (this is the property of white noise) where as for speech signal, this magnitude will be observable because the signal still has better structure.  This has worked for me in the past. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;VAD has been an active research areas- because almost all Mobile phone communications wants to detect non speech part and remove them from encoding. But if they would remove non-voiced speech this would make telephony useless. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The G.729 standard computes VAD based on features like: line spectral frequencies, full-band energy, low-band energy (&amp;lt;1 kHz), and zero-crossing rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The GSM standard works as follows: Option 1 computes the SNR in nine bands and applies a threshold to these values. Option 2 calculates different parameters: channel power, voice metrics, and noise power. It then thresholds the voice metrics using a threshold that varies according to the estimated SNR. (from wikipedia)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more advanced techniques i am listing some references on this subject. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Most sited reference: &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=736233&quot;&gt;Jongseo Sohn;   Nam Soo Kim;   Wonyong Sung;  &quot;A statistical model-based voice activity detection&quot; Signal Processing Letters, IEEE, Jan 1999, Volume: 6 Issue:1 pp:1-3&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Most relevant for you: &lt;a href=&quot;http://medi.uni-oldenburg.de/download/paper/marz_koll_2002_speech-pause.pdf&quot;&gt;Mark Marzinzik and Birger Kollmeier &quot;Speech Pause Detection for Noise Spectrum Estimation by Tracking Power Envelope Dynamics&quot; IEEE TRANSACTIONS ON SPEECH AND AUDIO PROCESSING, VOL. 10, NO. 2, FEBRUARY 2002 pp.109&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://s.i-techonline.com/Book/Robust-Speech-Recognition-and-Understanding/ISBN978-3-902613-08-0sr01.pdf&quot;&gt;Ramírez, J.; J. M. Górriz, J. C. Segura (2007). &quot;Voice Activity Detection. Fundamentals and Speech Recognition System Robustness&quot;. In M. Grimm and K. Kroschel. Robust Speech Recognition and Understanding. pp. 1–22. ISBN 978-3-902613-08-0.&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Introductory : &lt;a href=&quot;http://www.ece.umd.edu/merit/archives/merit2011/merit_fair11_reports/report_Kola.pdf&quot;&gt;Jonathan Kola, Carol Espy-Wilson and Tarun Pruthi &quot;Voice Activity Detection&quot;&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-22T20:12:21.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1544" PostTypeId="1" AcceptedAnswerId="1551" CreationDate="2012-02-22T21:27:24.550" Score="11" ViewCount="4409" Body="&lt;p&gt;I am creating a channelizer that consists of a complex mixer, &lt;a href=&quot;http://en.wikipedia.org/wiki/Cascaded_integrator-comb_filter&quot;&gt;CIC&lt;/a&gt; decimator, and a FIR compensation/decimation filter.  The final FIR filter may, if it matters, be implemented as more than one filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how do I design a filter such that it compensates for the very non-flat frequency response of the CIC filter?  Do you create the frequency response that you want by calculating the reciprocal of the CIC's response and then run it through an inverse FFT to get the impulse response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, though my particular problem pertains to CIC filters, my question is really about how you create any kind of distortion compensation filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="6" LastEditDate="2012-02-22T22:36:35.517" LastActivityDate="2017-02-28T14:43:07.940" Title="How to create a distortion compensation filter" Tags="|filters|fft|filter-design|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1545" PostTypeId="2" ParentId="1519" CreationDate="2012-02-22T21:45:56.137" Score="13" Body="&lt;p&gt;You are talking of capacity of two different types of channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In one case, the channel inputs and outputs are discrete in time.&#xA;At the $i$-th time instant, the received signal is $X_i+N_i$ where &#xA;$X_i$ is the received symbol of average energy $E$ and $N_i$ is the &#xA;noise (typically modeled as a sequence of i.i.d. $\mathcal N(0,\sigma^2)$ &#xA;random variables).  The channel capacity of this &lt;em&gt;discrete-time&#xA;Gaussian channel&lt;/em&gt; $~$is&#xA;$$C = \frac{1}{2}\log_2\left ( 1 + \frac{E}{\sigma^2}\right) ~\text{bits per channel use}$$ &#xA;and so &#xA;&lt;em&gt;bits per channel use&lt;/em&gt; is the natural metric.  If we are told how far&#xA;apart in time the discrete time instants are, e.g. one channel use per&#xA;microsecond, then a capacity $C$ bits per channel use can be stated &#xA;as &lt;em&gt;bits per second&lt;/em&gt;, e.g. $C$ Mbps for our one microsecond&#xA;example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second case, the inputs and outputs are continuous-time signals which occupy bandwidth and so the natural measure is bits per second per Hertz.  There&#xA;are more complications involved in making the transition from the continuous-time&#xA;channel to the discrete model, and in connecting the bandwidth $W$, the received&#xA;signal $P$ and the noise spectral density $N_0$ to $E$ and $\sigma^2$&#xA;(see &lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture14.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;&#xA;for some details), but when all&#xA;this is done we get Shannon's celebrated formula&#xA;$$C = W\cdot \log_2\left ( 1 + \frac{P}{N_0W}\right) ~ \text{bits per second}$$&#xA;for the capacity of the &lt;em&gt;additive white Gaussian noise (AWGN) channel of&#xA;bandwidth $W$&lt;/em&gt;.  This capacity can also be expressed as $C/W$ bits per&#xA;second per Hertz.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2018-01-31T16:09:43.407" LastActivityDate="2018-01-31T16:09:43.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1546" PostTypeId="2" ParentId="1531" CreationDate="2012-02-23T01:51:20.480" Score="1" Body="&lt;p&gt;The Fourier transform converts signals into coefficients of cosines &lt;em&gt;and&lt;/em&gt; sines. This is why the coefficients are complex. Simply adding up those two coefficients won't give you sufficient information about the phase (someone can correct me on this statement, but I believe it's true). In other words, for signal of length &lt;em&gt;N&lt;/em&gt; you're trying to find coefficients $a_k$ and $b_k$ such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \sum_{k=0}^{N/2} a_k \cos(\omega k)+\sum_{k=0}^{N/2} b_k \sin(\omega k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest using &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform&quot; rel=&quot;nofollow&quot;&gt;Discrete Cosine Transform&lt;/a&gt; (DCT) instead. It literally breaks you signal up into a sum of cosines, it gives you back all real coefficients and it takes care of the phase problem completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you must use Fourier Transform, you should realize that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{i \omega t} = \cos (\omega t) + i \sin(\omega t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This tells us that we can recreate the even-symmetric component (cosine) from real coefficients of the Fourier Transform, and odd-symmetric component (sine) from imaginary coefficients of the Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula then befomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given $k$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_k \cos\left( \frac{2 \pi kn}{N} \right) = \frac{1}{N}\left( \Re (X[k]) e^{ \tfrac{i 2 \pi kn}{N}} + \Re (X[N-k]) e^{ \tfrac{i 2 \pi (N-k)n}{N} } \right), $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$b_k \sin\left( \frac{2 \pi kn}{N} \right) = \frac{1}{Ni}\left( \Im (X[k]) e^{ \tfrac{i 2 \pi kn}{N}} + \Im (X[N-k]) e^{ \tfrac{i 2 \pi (N-k)n}{N} } \right), $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\Re(\cdot)$ and $\Im(\cdot)$ represent taking real and imaginary part of a complex number respectively. Note that this is done for &lt;em&gt;each&lt;/em&gt; $n \in \{0 \ldots N-1\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that because of circular symmetry of DFT, $X[N] = X[0]$, so you'll end up adding up the same thing twice according to the formula above. If you do that, then the &lt;em&gt;actual&lt;/em&gt; $a_0$ is half of what you get according to the formula above. If you find this division by 2 confusing, &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_series#Definition&quot; rel=&quot;nofollow&quot;&gt;this section&lt;/a&gt; of Wikipedia article on Fourier Series may provide a better explanation (look for the formula where $a_0$ is divided by 2).&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-02-23T03:46:47.667" LastActivityDate="2012-02-23T03:46:47.667" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1547" PostTypeId="2" ParentId="1356" CreationDate="2012-02-23T10:34:34.223" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You can try using &lt;a href=&quot;http://en.wikipedia.org/wiki/Template_matching&quot; rel=&quot;nofollow&quot;&gt;template matching&lt;/a&gt; on the resulting image of your image processing operations. So you have a database of these images, there comes a new image in, you process it, and you find the best match by laying the new image over all the images in the database (using a certain distance measure between all the white pixels).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can also try to extract lines of your processed image, and represent the image with the starting point of the line, the length and the slope of the line. Using this as a feature vector, you can also compute a distance between a new image and the database.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can also combine the two, by using the second approach as a first selection step, because template matching can be quite computationally expensive.&lt;/p&gt;&#xA;" OwnerUserId="809" LastActivityDate="2012-02-23T10:34:34.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1548" PostTypeId="2" ParentId="1433" CreationDate="2012-02-23T10:47:32.087" Score="6" Body="&lt;p&gt;There is also a book that bundles a set of papers related to this topic. It's called &lt;a href=&quot;http://books.google.nl/books/about/Principles_of_visual_information_retriev.html?id=2SPuMz-BG-4C&amp;amp;redir_esc=y&quot;&gt;Principles of Visual information Retrieval&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="809" LastActivityDate="2012-02-23T10:47:32.087" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1549" PostTypeId="2" ParentId="1534" CreationDate="2012-02-23T13:05:19.860" Score="3" Body="&lt;p&gt;As a side note: forward and inverse Fourier Transform are mostly the same thing. For example a rectangle in one domain corresponds to a sin(x)/x in the other domain (regardless whether it starts in time or frequency). The same goes for a delta: impulse in one domain corresponds to a complex exponential in the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can implement an inverse FFT (based on a forward FFT) as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;take the conjugate&lt;/li&gt;&#xA;&lt;li&gt;forward FFT&lt;/li&gt;&#xA;&lt;li&gt;take the conjugate again&lt;/li&gt;&#xA;&lt;li&gt;divide by length of the sequence&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In Matlab that would look like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 1024;&#xA;x0 = randn(n,1) + j*rand(n,1); % random sequence&#xA;fx = fft(x0);  % take the FFT&#xA;x1 = conj(fft(conj(fx)))/n; % inverse fft based on fw fft&#xA;% print an error metric how close we got to the orginal signal&#xA;fprintf('Error = %6.2f dB\n', 10*log10(sum( (x1-x0).* conj(x1-x0))./sum(x0.*conj(x0))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2012-02-23T13:48:19.653" LastActivityDate="2012-02-23T13:48:19.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1551" PostTypeId="2" ParentId="1544" CreationDate="2012-02-24T05:45:19.130" Score="10" Body="&lt;p&gt;The following addresses the CIC compensation and is not a general &quot;distortion&quot; technique.  But it is a straight-forward method to &quot;compensate&quot; non-varying &quot;distortion&quot;.  If the frequency response is known the inverse of the frequency can be used to compensate.  Examples like the CIC filter, where a poor filter might be used because of reduced complexity, are compensated later the signal chain.  In this example the frequency response is know and the inverse can be used.  Note, with multi-rate filters you only want to use the &quot;usable&quot; spectrum after decimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, to compensate a CIC filter the inverse of the CIC filters response&#xA;can be used to generate the compensation filter.  The CIC has &#xA;a response of (see reference [r2] or [r3])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  H(\omega) = \left| \frac{sin(\omega D/2)}{sin(\omega M/2)} \right|^N&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where D is the differentiate delay, M is the decimation rate, and N is the &#xA;filter order (number of cascaded filters).  The inverse can be specified as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  H(\omega) = \left| \frac{sin(\omega M/2)}{sin(\omega D/2)} \right|^N&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we have the &#xA;frequency response of the compensation filter, we can simply choose the length&#xA;of FIR filter that we desire.  The length of the FIR is application &#xA;specific.  Obviously the longer the FIR filter the better compensation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following are plots of this straight forward compensation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;  &lt;img src=&quot;https://i.stack.imgur.com/bnElP.png&quot; width=&quot;400&quot; height=&quot;300&quot;&gt;&#xA;  &lt;img src=&quot;https://i.stack.imgur.com/piapI.png&quot; width=&quot;400&quot; height=&quot;300&quot;&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is the Python code to create the frequency responses and plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from numpy import sin, abs, pi&#xA;import pylab&#xA;&#xA;D = 1; M = 7; N = 3&#xA;&#xA;Hfunc = lambda w : abs( (sin((w*M)/2)) / (sin((w*D)/2.)) )**N&#xA;HfuncC = lambda w : abs( (sin((w*D)/2.)) / (sin((w*M)/2.)) )**N&#xA;&#xA;w = np.arange(1024) * pi/1024&#xA;&#xA;G = (M*D)**N&#xA;H = np.array(map(Hfunc, w))&#xA;Hc = np.array(map(HfuncC, w))&#xA;# only use the inverse (compensation) roughly to the first null.&#xA;Hc[int(1024*pi/M/2):] = 1e-8&#xA;plot(w, 20*log10(H/G))&#xA;plot(w, 20*log10(Hc*G))&#xA;grid('on')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See [r1] for other approaches and $sinc^{-1}$ approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[r1] &lt;a href=&quot;http://www.altera.com/literature/an/an455.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Altera, &quot;Understanding CIC compensation filters&quot;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[r2] R. Lyons, &quot;Understanding Digital Signal Processing&quot;, &#xA;    2nd ed., Prentice Hall, Upper Saddle River, New Jersey, 2004&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[r3] R. Lyons, &lt;a href=&quot;http://www.embedded.com/design/configurable-systems/4006446/Understanding-cascaded-integrator-comb-filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Understanding Cascaded Integrator Comb Filters&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="306" LastEditorUserId="306" LastEditDate="2015-12-10T18:08:29.037" LastActivityDate="2015-12-10T18:08:29.037" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1552" PostTypeId="2" ParentId="160" CreationDate="2012-02-24T05:54:47.263" Score="4" Body="&lt;p&gt;There was a similar question, &lt;a href=&quot;https://dsp.stackexchange.com/a/1551/306&quot;&gt;https://dsp.stackexchange.com/a/1551/306&lt;/a&gt;, and the following is a subset of the answer from the other post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, to compensate a CIC filter the inverse of the CIC filters response&#xA;can be used to generate the compensation filter.  The CIC has &#xA;a response of &lt;a href=&quot;https://i.stack.imgur.com/piapI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  H(\omega) = \left| \frac{sin(\omega D/2)}{sin(\omega M/2)} \right|^N&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where D is the differentiate delay, M is the decimation rate, and N is the &#xA;filter order (number of cascaded filters).  The inverse can be specified as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  H(\omega) = \left| \frac{sin(\omega M/2)}{sin(\omega D/2)} \right|^N&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we have the &#xA;frequency response of the compensation filter, we can simply choose the length&#xA;of FIR filter that we desire.  The length of the FIR is application &#xA;specific.  Obviously the longer the FIR filter the better compensation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following are plots of this straight forward compensation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/bnElP.png&quot; width=&quot;400&quot; height=&quot;300&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/piapI.png&quot; width=&quot;400&quot; height=&quot;300&quot;&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is the Python code to create the frequency responses and plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;    import numpy as np&#xA;    from numpy import sin, abs, pi&#xA;    import pylab&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D = 1; M = 7; N = 3&#xA;&#xA;Hfunc = lambda w : abs( (sin((w*M)/2)) / (sin((w*D)/2.)) )**N&#xA;HfuncC = lambda w : abs( (sin((w*D)/2.)) / (sin((w*M)/2.)) )**N&#xA;&#xA;w = np.arange(1024) * pi/1024&#xA;&#xA;G = (M*D)**N&#xA;H = np.array(map(Hfunc, w))&#xA;Hc = np.array(map(HfuncC, w))&#xA;# only use the inverse (compensation) roughly to the first null.&#xA;Hc[int(1024*pi/M/2):] = 1e-8&#xA;plot(w, 20*log10(H/G))&#xA;plot(w, 20*log10(Hc*G))&#xA;grid('on')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See, &lt;a href=&quot;http://www.altera.com/literature/an/an455.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Altera, &quot;Understanding CIC compensation filters&quot;&lt;/a&gt;, for other approaches and $sinc^{-1}$ approximation &lt;a href=&quot;https://i.stack.imgur.com/bnElP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bnElP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; &lt;a href=&quot;http://www.altera.com/literature/an/an455.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Altera, &quot;Understanding CIC compensation filters&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/piapI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt; R. Lyons, &quot;Understanding Digital Signal Processing&quot;, &#xA;    2nd ed., Prentice Hall, Upper Saddle River, New Jersey, 2004&lt;/p&gt;&#xA;" OwnerUserId="306" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2012-03-01T13:29:11.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1553" PostTypeId="1" AcceptedAnswerId="1554" CreationDate="2012-02-24T12:48:01.830" Score="7" ViewCount="1097" Body="&lt;p&gt;Can you please suggest some books to get how guitar effects: distortion, overdrive, phaser and so on are achieved ?&lt;/p&gt;&#xA;" OwnerUserId="1028" LastEditorUserId="1650" LastEditDate="2013-01-30T16:12:29.293" LastActivityDate="2013-01-30T16:12:29.293" Title="Guitar effects explanation books" Tags="|audio|reference-request|music|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1554" PostTypeId="2" ParentId="1553" CreationDate="2012-02-24T13:20:22.533" Score="9" Body="&lt;p&gt;&lt;a href=&quot;http://books.google.com/books/about/DAFX.html?id=h90HIV0uwVsC&quot;&gt;DAFX&lt;/a&gt; is a pretty good one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.harmonycentral.com&quot;&gt;Harmony Central&lt;/a&gt; used to have a surprisingly good knowledgeable base for algorithms but that seem to have disappeared since Guitar Center took them over. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of source code can be found at &lt;a href=&quot;http://www.musicdsp.org/&quot;&gt;http://www.musicdsp.org/&lt;/a&gt;, but it's fairly varied in quality.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="6" LastEditDate="2012-02-24T14:50:27.667" LastActivityDate="2012-02-24T14:50:27.667" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1555" PostTypeId="2" ParentId="199" CreationDate="2012-02-24T13:32:05.797" Score="6" Body="&lt;p&gt;Here is a little bit of demo code to show why you are better off cascading 2nd order sections. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc&#xA;&#xA;sr = 44100;&#xA;order = 13;&#xA;&#xA;[b,a] = butter(order,1000/(sr/2),'low');&#xA;[sos] = tf2sos(b,a);&#xA;&#xA;x = [1; zeros(299,1)]; %impulse&#xA;&#xA;&#xA;% all in one&#xA;Y = filter(b,a,x);&#xA;&#xA;% cascaded biquads&#xA;Z = x;&#xA;for nn = 1:size(sos,1);&#xA;    Z = filter(sos(nn,1:3),sos(nn,4:6), Z );&#xA;end&#xA;&#xA;&#xA;cla; plot(Y, 'k'); hold on; plot(Z,':r'); hold off&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the lowpass filter given in the above example, by orders of about about 12 to 13, the numerical errors build up to give a visibly different impulse response for the implementation that does not use cascaded biquads. Depending on the filter, your mileage will vary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ORDER = 10&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hEUqz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ORDER = 13&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gCQcO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-02-24T13:32:05.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1556" PostTypeId="1" CreationDate="2012-02-24T16:31:32.510" Score="2" ViewCount="303" Body="&lt;p&gt;I'm currently plotting high sample rate data by down-sampling by a factor and averaging. Most of the time this is working ok, but I am aware that at very low zoom levels (zoomed right out) the averaging is hiding vast amounts of data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a timestamp for every data point, so are there any algorithms out there which will remove the pointless and 'less useful' points? I've done a bit of Googling and found papers retlated to time-series data compression, but that's not really what I'm after. I'm looking for something which will take advantage of the particular properties of plotting. ie. if you have 10 consecutive points with the same value, the intermediate ones can effectively be removed without losing any detail in the visual representation.&lt;/p&gt;&#xA;" OwnerUserId="454" LastActivityDate="2012-02-25T08:11:49.440" Title="Compressing plotted data with variable sample rate?" Tags="|compression|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1557" PostTypeId="1" AcceptedAnswerId="1600" CreationDate="2012-02-24T16:44:10.847" Score="10" ViewCount="1621" Body="&lt;p&gt;As part of a class in Signal Processing, I am building a 3rd order Chebychev band reject filter. We implement this by using three cascading Bainter circuits. Although not part of the class, I have a question about the gain of the Bainter circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to write a script which will automate the component selection using the corner frequencies and maximum overall gain as design rules, but have some issue with calculating the overall gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate the overall gain of a Bainter stage, would I simply work out the individual gains of the three op-amp sections? The overall gain would then be the product of the three individual gains?&lt;/p&gt;&#xA;" OwnerUserId="1029" LastEditorUserId="90" LastEditDate="2012-02-28T14:06:08.067" LastActivityDate="2012-03-01T15:43:15.853" Title="Understanding a Bainter Circuit (chebychev filter)" Tags="|filters|filter-design|bandpass|analog|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1558" PostTypeId="2" ParentId="1356" CreationDate="2012-02-24T19:23:21.983" Score="8" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;i ask if i can consider the preprocessed image as a feature vector in order to use dimensionality reduction algorithm such as PCA &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You mean applying PCA to this preprocessed image directly? I'm almost certain that can't work. PCA makes sense if you have lots of samples that are linearly dependent. You have few samples that are linearly independent. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;or SIFT &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;SIFT is not a dimensionality reduction algorithm but a feature extraction algorithm. So to apply SIFT, you would usually search for &quot;keypoints&quot; (e.g. line endings, T-junctions) and SIFT would create a feature vector that describes the image in the neighborhood of each keypoint. Problem is, thanks to your preprocessing, there's not much to say about each keypoint besides &quot;it's a line ending&quot; or &quot;it's a t-junction&quot;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;or any other that enable me to do matching or not ?if it is not ,what are features may be suitable for creating feature vector?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Many, but I can't tell you which features will give the same values for the same persons. You'll probably have to implement a few different approaches, test them on a reasonably sized set of test images (e.g. 100-1000 different images of each of your persons), and see how high the recognition rate is. If you only test on the 5 images you have now, you can't know if your algorithm has a 0.1% error rate or a 20% error rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, here are a few ideas you might try:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the line endings and junctions. Then do point cloud matching to compare different skeletons.&lt;/li&gt;&#xA;&lt;li&gt;Use the preprocessed images as features directly. To compare two images, take each point in image A in turn and measure the distance to the closest point in image B. (This can be efficiently calculated by calculating a distance transform on one image.) The mean or median distance might be a good similarity measure. Align both images to minimize this measure.&lt;/li&gt;&#xA;&lt;li&gt;Use a hough transform to find (almost) straight lines, then match those (matching lines is similar to point matching)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But to be honest, I don't think this problem can be solved by a beginner, even with help from Stackexchange. I hope I don't sound patronizing, but my real advice is: start with a simpler problem. Get a few introductory books on image processing/computer vision. Get comfortable with Matlab or Mathematica. Play around with image filters, template matching algorithms, image transformations and so on. Read &lt;a href=&quot;http://norvig.com/21-days.html&quot;&gt;Teach Yourself Programming in Ten Years&lt;/a&gt;. Find more and more advanced problems that you can solve on your own. Unfortunately, that's the only way to get experience, and you need experience to solve problems like these.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-02-24T19:23:21.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1559" PostTypeId="1" AcceptedAnswerId="1561" CreationDate="2012-02-24T19:49:47.930" Score="4" ViewCount="283" Body="&lt;p&gt;I have pairs of 1d digitised waveform signals which are almost identical - except there are sections which are the same in both but one is delayed slightly.&#xA;I need to find sections and the delay with the corresponding section in the other channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can set a maximum delay BUT I need to measure a delay to less than the sample interval - so some sort of convolution/correlation approach rather than a simple feature id.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions where to start?&lt;/p&gt;&#xA;" OwnerUserId="1002" LastEditorUserId="1002" LastEditDate="2012-02-25T02:26:52.677" LastActivityDate="2012-02-25T02:26:52.677" Title="Matching delayed signals" Tags="|correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1560" PostTypeId="2" ParentId="1544" CreationDate="2012-02-24T20:46:56.030" Score="2" Body="&lt;p&gt;I think Christopher's answer is a good one.  I thought that I would add one for us lazy/cheater types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While digging around Matlab's fdatool (Filter Design &amp;amp; Analysis Tool) I discovered that it can design and model both CIC and inverse sinc filters, where the inverse sinc filter is the CIC's distortion compensation filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You generate the CIC filter by going straight to the &quot;Create a multi-rate filter&quot; page (button on the left in version R2011b) and specifying the CIC filter.  You can then set all the parameters that you want on it, such as interpolation/decimation rates, number of cascades (Matlab calls it &quot;sections&quot;), etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You create the inverse sinc filter by going to the &quot;Design filter&quot; page (the page that the tool defaults to when it starts), and specifying &quot;Inverse Sinc Lowpass&quot; from the Lowpass drop down menu.  You can then set the various parameters for it.  It has a couple of unique parameters in the Options part of the dialog, including &quot;p&quot;, which corresponds to the number of cascades (sinc exponent).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse sinc filter design was not completely satisfying, though, since getting it right seemed less an instance of doing the math than figuring out where my pass band was, what the CIC droop was at that point, and then designing a filter that roughly canceled out that droop.  Since my CIC filter had four cascades, I would have thought that I would need to set &quot;p&quot; to four, but it way overcompensated when I did that.  I ended up leaving &quot;p&quot; at 1, the default value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tool really shone when I saved both filters in my session, and then went into the filter manager and cascaded them to see the overall frequency response.  This was very helpful, and easy to do.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-02-24T20:46:56.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1561" PostTypeId="2" ParentId="1559" CreationDate="2012-02-24T21:23:49.373" Score="2" Body="&lt;p&gt;This may be a good candidate for a two step approach: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1 would be a pretty coarse running cross correlation with a threshold detector to identify what parts in the signals are matching. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2 would than determined the actual delay. There are various ways to get sub sample resolution:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Upsample to desired resolution and then cross correlate&lt;/li&gt;&#xA;&lt;li&gt;Short term fourier transform and match a linear phase difference with a weighted least squares approach&lt;/li&gt;&#xA;&lt;li&gt;Delayed lock loop with a fractional delay filter&lt;/li&gt;&#xA;&lt;li&gt;Match the the two signals in with an adaptive filter. Then calculate the fourier transform of the filter impulse response and calculate the delay through a linear phase match&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-02-24T21:23:49.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1562" PostTypeId="2" ParentId="1556" CreationDate="2012-02-24T21:46:05.507" Score="3" Body="&lt;p&gt;Here is what I did. The basic idea is to mimic what you would see if you were plotting every single sample, just do it much faster&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate roughly how many data points will fall in one horizontal pixel. There is no point in plotting more points than the are pixels on the screen. &lt;/li&gt;&#xA;&lt;li&gt;Divvy up the data in blocks so that you roughly get one block per pixel&lt;/li&gt;&#xA;&lt;li&gt;Calculate the min and the max for each block&lt;/li&gt;&#xA;&lt;li&gt;For each block just add the max and the min in the correct order to your plot data&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This way you get a plot array that has about twice the number of data points than there are pixels which is about the highest number that makes sense. You have to recalculate whenever you zoom, change the data range or re-size the window, but that tends to be fairly quick. If you don't want to handle window resizing, you can simply just calculate for the worst case (full screen).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a code snippet that shows that in Matlab (it omits the ordering for brevity). The hi-res and the low-res plot look almost the same.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% reduced sample plot example&#xA;n = 200000; % lots of samples&#xA;fs = 44100;&#xA;% noise with exponential decay&#xA;x = randn(n,1).*exp(-(0:n-1)'/fs/3);&#xA;% block approach&#xA;npix = 2000; % emulate an HD display&#xA;x1 = reshape(x,n/npix,npix); % chop into blocks&#xA;x2 = [min(x1); max(x1)];  % cal min and max&#xA;x2 = x2(:); % interleave&#xA;figure(1); plot(x); % plot with 200000 data points&#xA;figure(2); plot(x2); % plot with 2000 data points&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-02-24T21:46:05.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1563" PostTypeId="2" ParentId="1556" CreationDate="2012-02-25T08:11:49.440" Score="1" Body="&lt;p&gt;&lt;strong&gt;Multi-scale representation is what you are really looking for!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably one of the best example is the Google Earth (and similar class of) data. If you had only one scale to represent all the data the challenge is that when you are doing significant zoom out of extremely detailed data over a large range makes it very cumbersome to handle where as if zoom-in deep enough an extensively sub-sampled data looks all flat. This is a classical problem in signal processing : &quot;multi-scale representation of data&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a very simple and intuitive way, you can just sub-sample them in /2, /4, /8, /16 of sampling rate. Stop at appropriate level. When you are presenting the data, when you zoom out,pick data from coarser resolution; when you zoom in back, you can pull out respective segment from the finer resolution content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also look at &lt;strong&gt;wavelets&lt;/strong&gt; which provides a theoretically most elegant way to do it. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-25T08:11:49.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1564" PostTypeId="1" AcceptedAnswerId="1582" CreationDate="2012-02-26T02:10:32.977" Score="12" ViewCount="1877" Body="&lt;p&gt;I am trying to &quot;match&quot; little square patches in an image. At first glance, it seems reasonable to simply do a Euclidean distance style comparison of two of these arrays to get a &quot;similarity&quot; measure. This works fine in many cases (the &quot;best&quot; patch (lowest value) according to this metric looks very much like the query patch). However, there are many cases in which this produces a very bad match. For example, take these two patch pairs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two patches of a brick wall, score 134 (this is the sum of the components of the average absolute pixel difference):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UJ2Hk.png&quot; alt=&quot;Source Patch&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ChLBo.png&quot; alt=&quot;Target Patch&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One patch of a brick wall, one patch of grass, score 123!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/d7lBZ.png&quot; alt=&quot;https://i.stack.imgur.com/d7lBZ.png&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/d2TBE.png&quot; alt=&quot;https://i.stack.imgur.com/d2TBE.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To a human, &quot;clearly&quot; the grass does not match the brick, but this metric says otherwise. The problem is just in the local statistical variation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use something like a histogram comparison, I completely lose all spatial information - e.g. if a patch is grass on the top and brick on the bottom, it would match exactly to a patch with grass on the bottom and brick on the top (again, another &quot;obviously wrong&quot; match).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a metric which somehow combines both of these ideas into a reasonable value that will evaluate to &quot;similar&quot; for Pair 1 above, but not also be similar for my example of a patch and its vertical mirror?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions are appreciated!&lt;/p&gt;&#xA;" OwnerUserId="1032" LastEditorUserId="26573" LastEditDate="2018-12-30T22:10:24.920" LastActivityDate="2023-03-17T07:37:03.343" Title="Good metric for qualitatively comparing image patches" Tags="|image-processing|distance-metrics|classification|waveform-similarity|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1566" PostTypeId="1" CreationDate="2012-02-26T17:47:54.273" Score="1" ViewCount="276" Body="&lt;p&gt;So I have this system: &#xA;$$&#xA;y(n) = \frac{1}{N+1}\sum_{k=-N}^{N}\left(1-\frac{|k|}{N+1}\right)x(n-k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the impulse response I'm getting: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{cases}\frac{1}{N+1}\left(1-\frac{|k|}{N+1}\right) &amp;amp;\text{for}\quad|n|\leq N\\ 0&amp;amp; \text{otherwise}&#xA;\end{cases}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now I'm supposed to find the frequency response and supposedly a closed form expression can be found for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the frequency response is just the Fourier transform of the impulse response so I have this function: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F(s)=\frac{1}{p(N+1)}\sum_{k=-N}^{N}\left(1-\frac{|k|}{N+1}\right)e^{\frac{-2\pi isn}{p}}$$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here I used Euler's formula and the $isin$ parts cancel themselves and then I was able to use Legendre's summation formulas to find a super messy closed form but I think that can't be right.  I think instead I have set up the frequency response wrong.  Could some one help me?  Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1035" LastEditorUserId="1629" LastEditDate="2016-09-03T12:57:33.597" LastActivityDate="2016-09-03T12:57:33.597" Title="Need help finding the frequency response" Tags="|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1567" PostTypeId="1" AcceptedAnswerId="1570" CreationDate="2012-02-26T19:25:54.823" Score="25" ViewCount="36833" Body="&lt;p&gt;First off, I hope this is the correct Stack Exchange board. My apologies if it is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on something that requires me to calibrate the camera. I have successfully implemented the code to do this in OpenCV (C++). I am using the inbuilt chessboard functions and a chessboard I have printed off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many tutorials on the internet which state to give more than one view of the chessboard and extract the corners from each frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an optimum set of views to give to the function to get the most accurate camera calibration? What affects the accuracy of the calibration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if I give it 5 images of the same view without moving anything it gives some straight results when I try and undistort the webcam feed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FYI to anyone visiting:&lt;/strong&gt; I've recently found out you can get must better camera calibration by using a grid of asymmetric circles and the respective OpenCV function.&lt;/p&gt;&#xA;" OwnerUserId="1036" LastEditorUserId="1036" LastEditDate="2012-03-29T19:22:03.157" LastActivityDate="2024-03-08T15:00:17.180" Title="How do I get the most accurate camera calibration?" Tags="|image-processing|camera|opencv|" AnswerCount="6" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1568" PostTypeId="2" ParentId="1566" CreationDate="2012-02-26T19:48:20.333" Score="1" Body="&lt;p&gt;Is this for homework?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so I won't directly give an answer, just a hint about the general approach that can be used to solve such questions without a single derivation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot the impulse response. How does it look? Try building this by combining or modifying (through addition, dilatation, translation, multiplication, convolution, derivation, integration...) very simple functions the DFT of which is known (complex exponentials, constants, rectangles, diracs, Heaviside step). From then, use identities on the DFT to get the DFT of your impulse response.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-26T19:48:20.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1569" PostTypeId="2" ParentId="1564" CreationDate="2012-02-26T20:18:50.707" Score="2" Body="&lt;p&gt;To start with, 2 images and 3 measurements are not exactly enough to ascertain any kind of statistical model which in terms can be used to define the optimal comparison metric. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you could start to have a look at texture recognition papers for methods and clues. It is an active field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what it is worth, I ran a couple of perceptual hashing functions (DCT and Random Projection based) tests and did a little trial with the so called SIFT descriptor. These functions can separate inter and intra class distances, although from 3 images it is impossible to conclude anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code on &lt;a href=&quot;https://github.com/mdiephuis/sandbox/blob/master/so/so_25_02_2012.m&quot; rel=&quot;nofollow&quot;&gt;github&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2012-02-26T20:18:50.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1570" PostTypeId="2" ParentId="1567" CreationDate="2012-02-27T08:42:32.100" Score="14" Body="&lt;p&gt;You have to take images for calibration from different points of view and angles, with as big difference between angles as possible (all three Euler angles should vary), but so that pattern diameter was still fitting to camera field of view. The more views are you using the better calibration will be. That is needed because during the calibration you detect focal length and  distortion parameters, so to get them by least square method different angles are needed. If you arn't moving camera at all you are not getting new information and calibration is useless.&#xA;Be aware, that you usually need only focal length, distortion parameters are usually negligible even for consumer cameras, web cameras and cell phone cameras. If you already know focal length from the camera specification you may not even need calibration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Distortion coefficient are more present in &quot;special&quot; cameras like wide-angle or 360°.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Wikipedia entry about &lt;a href=&quot;http://en.wikipedia.org/wiki/Camera_resectioning&quot; rel=&quot;noreferrer&quot;&gt;calibration&lt;/a&gt;.&#xA;And here is &lt;a href=&quot;http://en.wikipedia.org/wiki/Distortion_%28optics%29&quot; rel=&quot;noreferrer&quot;&gt;non-linear distortion&lt;/a&gt;, which is negligible for most cameras.&lt;/p&gt;&#xA;" OwnerUserId="198" LastEditorUserId="46403" LastEditDate="2019-11-26T13:58:55.737" LastActivityDate="2019-11-26T13:58:55.737" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1571" PostTypeId="1" AcceptedAnswerId="1580" CreationDate="2012-02-27T08:56:08.493" Score="9" ViewCount="9244" Body="&lt;p&gt;I am new to DSP. Are there good open source ANSI C implementations of DSP algorithms?&lt;/p&gt;&#xA;&lt;p&gt;MATLAB is great at prototyping but once we move to coding in C, it takes time and we end up making too many mistakes. I would guess there must be good repositories of C codes for various implementation of filters, etc. Any pointers would be good.&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="7092" LastEditDate="2023-11-21T22:01:44.360" LastActivityDate="2023-11-21T22:01:44.360" Title="Optimized ANSI C libraries for DSP" Tags="|matlab|algorithms|c|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1572" PostTypeId="1" AcceptedAnswerId="1574" CreationDate="2012-02-27T09:16:39.810" Score="13" ViewCount="8003" Body="&lt;p&gt;I studied a bit about adaptive filter on internet and found that its a special filter which keep on updating its filter value as soon as it proceeds. It finds out the difference between input and output and using the error function and previous coefficients finds out the new filter coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this doesn't make any sense. It always tries to minimize the difference between input and output. So, how is it of any use, if it tries to pass all the signals as it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain me how it is being used in real day applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will also be good if you can help me through some links which could help me in implementation of adaptive digital filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;please comment if I am unclear in expressing my doubt !  &lt;/p&gt;&#xA;" OwnerUserId="864" LastEditorUserId="128" LastEditDate="2020-03-03T13:12:31.027" LastActivityDate="2020-03-03T13:12:31.027" Title="What Does an Adaptive Filter Do?" Tags="|filters|adaptive-filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1574" PostTypeId="2" ParentId="1572" CreationDate="2012-02-27T10:22:30.743" Score="12" Body="&lt;p&gt;The key concept that you are missing is that you are not just minimising the difference between input and output signals. The error is often calculated from a 2nd input. Just look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_filter#Example_application&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia example related to the ECG&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter coefficients in this example are recalculated to change the notch frequency of a notch filter according to the frequency extracted from the mains signal. One could use a static notch filter, but you would have to reject a wider range of frequencies to accommodate the variability in the mains frequency. The adaptive filter follows the mains frequency and so the stop band can be much more narrow, thus retaining more of the useful ECG information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at this again and I think I understand your question a little better. The LMS algorithm needs an error term in order to update the filter coefficients. In the ECG example that I paraphrase above, I give the error term as a second input from a mains voltage. Now I'm guessing that you are thinking, &quot;Why not just subtract the noise from the signal-plus-noise to leave the signal?&quot; This would work fine in a simple &lt;em&gt;linear&lt;/em&gt; system. Even worse, most examples given online tell you (correctly but confusingly) that the error term is calculated from the difference between the desired signal and the output of the adaptive filter. This leaves any reasonable person thinking &quot;If you already have the desired signal, why bother doing any of this!?&quot;. This can leave the reader lacking motivation to read and comprehend the mathematical descriptions of adaptive filters. However, the key is in &lt;a href=&quot;http://www.ece.mcmaster.ca/faculty/reilly/coe4tl4/adaptive%20filters%20Scot%20Douglas.PDF&quot; rel=&quot;noreferrer&quot;&gt;section 18.4 of Digital Signal Processing Handbook&lt;/a&gt;, Ed. Vijay K. Madisetti  and  Douglas B. William. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;x=input signal, &lt;/li&gt;&#xA;&lt;li&gt;y=output from filter, &lt;/li&gt;&#xA;&lt;li&gt;W=the filter coefficients, &lt;/li&gt;&#xA;&lt;li&gt;d=desired output, &lt;/li&gt;&#xA;&lt;li&gt;e=error&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In practice, the quantity of interest is not always d. Our desire may&#xA;  be to represent in y a certain component of d that is contained in x,&#xA;  or it may be to isolate a component of d within the error e that is&#xA;  not contained in x. Alternatively, we may be solely interested in the&#xA;  values of the parameters in W and have no concern about x, y, or d&#xA;  themselves. Practical examples of each of these scenarios are provided&#xA;  later in this chapter.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;There are situations in which d is not available at all times. In such&#xA;  situations, adaptation typically occurs only when d is available. When&#xA;  d is unavailable, we typically use our most-recent parameter estimates&#xA;  to compute y in an attempt to estimate the desired response signal d.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;There are real-world situations in which d is never available. In&#xA;  such cases, one can use additional information about the&#xA;  characteristics of a “hypothetical” d, such as its predicted&#xA;  statistical behavior or amplitude characteristics, to form suitable&#xA;  estimates of d from the signals available to the adaptive ﬁlter. Such&#xA;  methods are collectively called blind adaptation algorithms. The fact&#xA;  that such schemes even work is a tribute both to the ingenuity of the&#xA;  developers of the algorithms and to the technological maturity of the&#xA;  adaptive ﬁltering ﬁeld&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I will keep building on this answer when I get the time, in an attempt to improve the ECG example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this set of lecture notes to be particularly good also: &lt;a href=&quot;http://www.commsp.ee.ic.ac.uk/~mandic/ASP_Slides/ASP_Lecture_7_Adaptive_Filters_2015.pdf&quot; rel=&quot;noreferrer&quot;&gt;Advanced Signal Processing Adaptive Estimation and Adaptive Filters&lt;/a&gt; - Danilo Mandic&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="29" LastEditDate="2016-01-05T01:03:17.453" LastActivityDate="2016-01-05T01:03:17.453" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1575" PostTypeId="2" ParentId="1571" CreationDate="2012-02-27T10:28:44.980" Score="0" Body="&lt;p&gt;You can check put the matlab coder product. This allows you to generate C code directly from your matlab code without having to worry about the introduction of human errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.co.uk/products/matlab-coder/?s_cid=HP_MI_matlabcoder&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.co.uk/products/matlab-coder/?s_cid=HP_MI_matlabcoder&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it only supports a subset of the language and requires a separate licence, but it might be suitable for your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following link is useful to find the supported subset of Functions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.co.uk/help/toolbox/eml/ug/bq1h2z7-11.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.co.uk/help/toolbox/eml/ug/bq1h2z7-11.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-02-27T10:28:44.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1576" PostTypeId="2" ParentId="1553" CreationDate="2012-02-27T10:37:11.537" Score="3" Body="&lt;p&gt;If you want something a bit more simple than the Dafx book then I recommend this dissertation that i stumbled across a while back. Even if you have no idea how to use simulink, the diagrams might help you understand how the various guitar effects are realized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cegt201.bradley.edu/projects/proj2008/gegudps/Czubak_Raheja_Final_Paper.pdf&quot; rel=&quot;nofollow&quot;&gt;http://cegt201.bradley.edu/projects/proj2008/gegudps/Czubak_Raheja_Final_Paper.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-02-27T10:37:11.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1577" PostTypeId="2" ParentId="1571" CreationDate="2012-02-27T13:12:23.900" Score="5" Body="&lt;p&gt;The rub is that ANSI C is not a terribly good language for real time DSP. Many features that a real DSP chip has can't be addressed in ANSI C. These include address generators, bit-reverse addressing, circular addressing, SIMD, memory segments, multiple buses, fractional data types, fractional multiply, certain fixed point math, zero overhead looping etc. Hence most compilers for DSPs have an extensive set of language extensions (#pragma, inline assembler, new keywords, etc). However these are decidedly non-ANSI and not portable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing a simple fixed point FIR filter in ANSI C can easily be 10 times less efficient than using the proper extensions or assembly code.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-02-27T13:12:23.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1579" PostTypeId="1" CreationDate="2012-02-27T14:33:29.913" Score="6" ViewCount="5023" Body="&lt;p&gt;Let us say I have a row vector $X = [x_1, x_2, x_3, \ldots, x_n]$ and another row vector $Y = [y_1, y_2, y_3, \ldots, y_n]$. I want to check whether the two vectors are statistically independent or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now two vectors are said to be statistically independent if $E(X Y) = E(X)  E(Y)$, where $E$ is the expectation operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how would I calculate the expectation value for each of the concerned vectors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your suggestions - I'm really new to statistics.&lt;/p&gt;&#xA;" OwnerUserId="1017" LastEditorUserId="15892" LastEditDate="2015-11-15T15:17:55.807" LastActivityDate="2021-05-02T19:20:54.513" Title="How can I calculate the Expectation for a particular known vector?" Tags="|matlab|discrete-signals|ica|statistics|independence|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1580" PostTypeId="2" ParentId="1571" CreationDate="2012-02-27T15:14:32.000" Score="4" Body="&lt;p&gt;&lt;strong&gt;Part #1: Regarding the comparison:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no great general answer to what is a faster alternative to Matlab. It all depends on the platform you use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Hilmar asnwer indicating features like SIMD - which ARE possible in C. But it would require assembly lanaguage support along with C. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a broader comparision: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are working on a general purpose computing (like x86 or PPC), i guess there is nothing better (and faster) than C. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are working on specialized DSP hardware, (or embedded platform such as ARM) than native assembly will be far ahead and C might just be no match against it. (Though C might be a right balance between making flexible software vs. execution speed. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are comparing C with C++, unlike general perception - C++ can be made just as optimum in most context with some of the better programming features. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For other handy tools - you can look at some other scripting tools like TCL,or Lua. These are definitely better than lower level but might compromise speed. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Part #2: The references&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;I would guess there must be good repositories of C codes for various&#xA;  implementation of filters etc.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://sourceforge.net/projects/opencvlibrary&quot; rel=&quot;nofollow&quot;&gt;OpenCV&lt;/a&gt; - probably best for computer vision applications.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://imlab.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;ImLab 2.3&lt;/a&gt; - is a free open source graphical application for Scientific Image Processing that runs in Windows, Linux and many other UNIX systems. It supports multiple windows, data types including 32 bit integers, 32 bit real numbers and complex numbers. It is implemented in C++ and also in C to provide a very simple way to add new functions. It has many image operations and supports several file formats. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.dip.ee.uct.ac.za/~brendt/srcdist/&quot; rel=&quot;nofollow&quot;&gt;ImageLib&lt;/a&gt;: is a C++ class library providing image processing and related facilities. The main set of classes provides a variety of image and vector types, with additional modules supporting scalar and vector quantisation, wavelet transforms, DCT transforms, and simple histogram operations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://cimg.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;CImage&lt;/a&gt; - C++ Template Image Processing Library  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://camellia.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;Camellia Library&lt;/a&gt; is an open source Image Processing &amp;amp; Computer Vision library. Written in plain C, it is cross-platform (Unix / Linux, Windows) and robust. It already includes a lot of functions for image processing (filtering, morphological mathematics, labelling, warping, drawing, project/backproject, color conversion, loading/saving images, etc.), most of them being highly speed-optimized. It is also doxygen-documented and examples of use are provided.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://vxl.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;VXL&lt;/a&gt; : C++ Libraries for Computer Vision Research and Implementation&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.gnu.org/software/gsl/&quot; rel=&quot;nofollow&quot;&gt;GNU Scientific Library (GSL)&lt;/a&gt; is a numerical library for C and C++ programmers&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://software.intel.com/en-us/articles/intel-mkl/&quot; rel=&quot;nofollow&quot;&gt;Intel® Math Kernel Library (Intel® MKL)&lt;/a&gt; is a computing math library of highly optimized, extensively threaded math routines for applications that require maximum performance. Core math functions include BLAS, LAPACK, ScaLAPACK1, sparse solvers, fast Fourier transforms, vector math, and more.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can refer to the book: &lt;a href=&quot;http://www.nr.com/&quot; rel=&quot;nofollow&quot;&gt;Numerical Recepies in C&lt;/a&gt; - and the example code. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;find lot more from here: &lt;a href=&quot;http://www.cs.cmu.edu/~cil/v-source.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.cmu.edu/~cil/v-source.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-27T15:14:32.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1581" PostTypeId="1" AcceptedAnswerId="1694" CreationDate="2012-02-27T15:34:55.293" Score="7" ViewCount="369" Body="&lt;p&gt;This is a question regarding color transformation in images. I have this color transformation matrix I am using to convert an RGB image to a color space whose name I do not know:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T = [(1/3) (1/3) (1/3); (1/2) 0 (-1/2); (-1/2) 1 (-1/2)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the name of this color transform? I think I once saw somewhere that it is called KL transform because it was close to a KLT computed over a large collection of images, but I am not sure...&lt;/p&gt;&#xA;" OwnerUserId="1037" LastActivityDate="2012-03-12T08:07:49.117" Title="What is the name of this color transformation?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1582" PostTypeId="2" ParentId="1564" CreationDate="2012-02-27T16:00:46.373" Score="2" Body="&lt;p&gt;The essential idea is: &lt;strong&gt;There is nothing wrong with color information- it is just insufficient. So best thing is to combine multiple feature sets.&lt;/strong&gt;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try multiple features to resolve this ambiguity. As far as feature set is concerned you can use following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Color (something like &lt;a href=&quot;http://erdos.csie.ncnu.edu.tw/~hychen/multimedia/reading/presentation/%28P6%29%20Color%20and%20Texture%20Descriptors.pdf&quot; rel=&quot;nofollow&quot;&gt;MPEG7's dominant color&lt;/a&gt;) OR Color Historgram &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cs.auckland.ac.nz/compsci708s1c/lectures/Glect-html/topic4c708FSC.htm#mpeg&quot; rel=&quot;nofollow&quot;&gt;Texture&lt;/a&gt; (either in the form of Filter bank response) OR &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://etrij.etri.re.kr/Cyber/servlet/GetFile?fileid=SPF-1041924741673&quot; rel=&quot;nofollow&quot;&gt;Edge histograms&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As a primary comparison, i would first like to make distinction between pure brick patch vs. pure grass patch. For this, color is definitely the most potential element. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Combining features to make more robust classification&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would use a dominant color ( uses but not the only one) or key color and form the clusters. See where the cluster heads lie;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the cluster heads both are within expected areas, the class is usually easy to detect, if the they fall into gray area, then the class belongs there. If it falls in gray area, another feature is required. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sameway, you can independently classify using &lt;em&gt;Texture matrix&lt;/em&gt; and then combine both the scores to ensure that results makes sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Dealing with spatial problems&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically when you realize that the patches can have parts of it which are half bricks and half grass. I think you don't need any more additional features or different matric. This can be handled in two ways. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;1. Keep multiple membership patch as different classes.&lt;/em&gt; &#xA;For example, apart from &lt;code&gt;birck-only&lt;/code&gt; class and &lt;code&gt;grass-only&lt;/code&gt; class, you can also have &lt;code&gt;half-brick-half-grass-vertical&lt;/code&gt; and &lt;code&gt;half-brick-half-grass-horizontal&lt;/code&gt; as total four classes. This can be easily classified using the clustering method we discussed earlier.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;2. Add multi scale classification&lt;/em&gt; &#xA;For example, given the patch being in a gray area, you can divide the patch two parts i.e. left vs. right. Same way you can also divide top vs. bottom. Now you can apply identical classification for this &quot;half part&quot;. Ideally the above listed feature  should allow you to make it scalable to compare a feature similarity between full part (for example dominant color can be same irrespective of size) or yo might have to resize it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding more classes (as in part 1) or more levels (as in part 2) will be straight forward; the upper limit will come by two factors - either any additional division will no longer add any value to classification or that excessive noise will introduce ambiguity in the classification effectively. This is where you stop. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-02-27T16:00:46.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1583" PostTypeId="2" ParentId="1581" CreationDate="2012-02-27T17:31:58.430" Score="5" Body="&lt;p&gt;I do not know the name of your transformation $T$, but it can't be the Karhunen-Loeve transform: The Karhunen-Loeve transform is image specific and its transformation matrix is a rotation matrix (see for example &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/KarhunenLoeveDecomposition.html&quot;&gt;the KLT in Mathematica&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the values in your matrix, it seems to attempt to separate between intensity (first row) and color (the other two rows, spanning the remaining hyperplane) while being  optimized for speed.&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2012-02-27T17:31:58.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1584" PostTypeId="2" ParentId="1567" CreationDate="2012-02-27T17:59:49.667" Score="4" Body="&lt;p&gt;@Ben - number of views depends the camera and the final accuracy required.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With very high quality, low distortion lenses (high-end 35mm SLR) using lots of chessboard images to map the distortions can be unstable - since the distortions are fractions of a pixel.&lt;br&gt;&#xA;You still need several shots with the board (or camera) rotated since the image centre is normally only within a couple of pixels of the nominal x/2,y/2 and will change with focus. And of course zoom changes everything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have lens-chip centre and focal length(in X and Y) you only need a single chess board in the shot to give you camera position&lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-02-27T17:59:49.667" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1585" PostTypeId="2" ParentId="1579" CreationDate="2012-02-27T19:43:07.157" Score="1" Body="&lt;p&gt;First off, I would read &lt;a href=&quot;https://dsp.stackexchange.com/questions/1242/examples-of-independent-and-uncorrelated-data-in-real-life-and-ways-to-measure&quot;&gt;Examples of Independent and uncorrelated data in real-life, and ways to measure/detect them&lt;/a&gt;.&lt;br /&gt;&#xA;It will likely prove useful to you.&lt;/p&gt;&#xA;&lt;p&gt;If you are looking for something quick, easy, and useful, I would simply &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;cross-correlate&lt;/a&gt; the two vectors and normalize the result.  A small result (less that 0.05?) indicates, but does not prove, independence.  A large result (more than 0.2?) would indicate some amount of dependence.  If the vectors have a non-zero mean, you may need to subtract out the mean before doing the correlation, depending on why they are non-zero mean.&lt;/p&gt;&#xA;&lt;p&gt;You could also go a more academic route and use the method pichenettes outlines (estimate the probability distribution using a kernel density estimator) in the thread that I linked to at the beginning of the post.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="7092" LastEditDate="2021-05-02T19:20:54.513" LastActivityDate="2021-05-02T19:20:54.513" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="1586" PostTypeId="2" ParentId="1523" CreationDate="2012-02-27T20:43:27.270" Score="2" Body="&lt;p&gt;Rachel, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my research I have so far been able to find something called '&lt;a href=&quot;http://en.wikipedia.org/wiki/Pearson%27s_chi-squared_test&quot; rel=&quot;nofollow&quot;&gt;Chi-Squared Test For Independence&lt;/a&gt;', but I am not sure how it works at the moment, but it might be worth a look.&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-02-27T20:43:27.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1587" PostTypeId="2" ParentId="1557" CreationDate="2012-02-28T11:15:49.057" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;To calculating the overall gain of a Bainter stage, would I simply&#xA;  work out the individual gains of the three op-amp sections. The&#xA;  overall gain would then be the product of the three individual gains?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The short answer is:&lt;/em&gt; &lt;strong&gt;Yes, you can (probably) analyze them individually.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When asking what happens when you cascade multiple analog filter stages, the questions to ask are: what is the source impedance of the first stage, and what is the load impedance of the second stage?  If a circuit stage has a large and complicated output impedance, then loading it with another stage can modify its behavior.  When working with passive filters, this is a big problem: unless the load impedance of each stage is significantly greater than the source impedance of the prior stage, cascading passive filter sections will result in complicated changes to the behavior of each stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the attractions of op-amp based circuits is that op-amps generally have a very low output impedance; for the ideal op-amp, there is &lt;em&gt;zero&lt;/em&gt; output impedance.  Moreover, the op-amp inputs themselves generally have very high input impedance, ideally infinite.  This means that circuit sections whose outputs are op-amp driven can generally be cascaded without having one stage change the behavior of another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider this schematic of a Bainter notch (taken from an Analog Devices publication):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BQ2g2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;notch out&quot; is driven by the output of an op-amp.  Thus this circuit will have very small output impedance.  In other words, the voltage at &quot;notch out&quot; will be relatively insensitive to the load that is connected.   This output impedance will almost certainly be much lower than the input impedance.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, in the design phase, you can analyze several cascaded notch circuits separately, and simply multiple their transfer functions together.  After producing a design in such a way, you might want to simulate the entire circuit in SPICE to check for behaviors due to op-amp nonidealities, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;&lt;a href=&quot;http://bainter.org/howto/Active-Notch-Filter-%28Bainter%29.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Active filter has stable notch, and response can be regulated&lt;/a&gt;&quot;, in &lt;strong&gt;Electronics&lt;/strong&gt;, October 2, 1975.  Original article describing the circuit.&lt;/li&gt;&#xA;&lt;li&gt;&quot;&lt;a href=&quot;http://bainter.org/howto/How-to-Write-Node-Equations-for-Active-Circuits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to Write Node Equations for Active Circuits&lt;/a&gt;&quot;, by Mr. Bainter himself.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-02-29T11:08:15.060" LastActivityDate="2012-02-29T11:08:15.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1588" PostTypeId="2" ParentId="1537" CreationDate="2012-02-28T15:13:41.430" Score="4" Body="&lt;p&gt;I think you should look/google in the direction of &lt;strong&gt;graph matching&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because you can represent your skeleton as a graph by creating nodes at endpoints and crossings, and creating edges for the connected endpoints and crossings. There is much more research done in the direction of graph matching than just topological skeleton matching. However for the latter I found &lt;a href=&quot;http://www.cis.temple.edu/~latecki/Papers/PAMIshape08.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;, which you might find interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also look through the references of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Topological_skeleton#References&quot; rel=&quot;nofollow&quot;&gt;Wikipedia page of Topological skeletonization&lt;/a&gt;, there are also some references about matching skeletons.&lt;/p&gt;&#xA;" OwnerUserId="809" LastActivityDate="2012-02-28T15:13:41.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1590" PostTypeId="1" CreationDate="2012-02-28T17:44:43.533" Score="7" ViewCount="845" Body="&lt;p&gt;This question is in the context of time-delay estimation. Say I have a stationary Gaussian stochastic process $g$, and I know its autocorrelation function $R_g(\tau)$. To do time-delay estimation, I'm computing a windowed cross correlation between $g$ and a delayed version of it. In other words,&#xA;$$&#xD;&#xA;g_1 = g(x-D) \\&#xD;&#xA;\phi(\tau) = \int_{-T/2}^{T/2} g(x) g_1(x + \tau)&#xD;&#xA;$$&#xA;and I'm going to determine the delay by finding the maximum of $\phi$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is it possible to get an expression for the probability distribution of $\phi$? &lt;/p&gt;&#xA;" OwnerUserId="759" LastActivityDate="2012-03-27T11:57:59.410" Title="Probability distribution of windowed cross-correlation" Tags="|cross-correlation|estimators|random|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1592" PostTypeId="1" AcceptedAnswerId="1698" CreationDate="2012-02-28T22:24:26.157" Score="7" ViewCount="172" Body="&lt;p&gt;Original image:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aQrcw.png&quot; alt=&quot;original image before transformation and filtering&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;(Images included are .png images, so no additional distortion was added in save/upload for viewing)&lt;/p&gt;&#xA;&lt;p&gt;I have used the D4 transform from page 20 of &lt;a href=&quot;http://books.google.ca/books?id=hMvhjWxb0_MC&amp;amp;printsec=frontcover&amp;amp;source=gbs_ge_summary_r&amp;amp;cad=0#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Ripples in mathematics&amp;quot;&lt;/a&gt;, which is basically these 5 steps:&lt;/p&gt;&#xA;&lt;p&gt;Forward d4:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;c1 = √3 / 4.0 ;&#xA;c2 = (√3 - 2) / 4.0 ;&#xA;s[ IEVEN ] += √3 * s[ IODD ] ;&#xA;s[ IODD ] -= c1*s[ IEVEN ] + c2*s[ IPREVEVEN ] ;&#xA;s[ IEVEN ] -= s[ INEXTODD ] ;&#xA;s[ IEVEN ] *= ( √3 - 1 ) / √2 ;&#xA;s[ IODD ] *= ( √3 + 1 ) / √2 ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The inverse:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;c1 = √3 / 4.0 ;&#xA;c2 = (√3 - 2) / 4.0 ;&#xA;s[ IODD ] *= ( √3 - 1 ) / √2 ;&#xA;s[ IEVEN ] *= ( √3 + 1 ) / √2  ;&#xA;s[ IEVEN ] += s[INEXTODD] ;&#xA;s[ IODD ] += c1*s[ IEVEN ] + c2*s[IPREVEVEN] ;&#xA;s[ IEVEN ] -= √3 * s[ IODD ] ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm compiling and running this using &lt;code&gt;double&lt;/code&gt; precision values from C++.  I run this on the rows of the image, then the columns.  I use a crude filtration algorithm to remove the lowest 90% of the difference coefficients in the image.&lt;/p&gt;&#xA;&lt;p&gt;The filtration algorithm is:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Run through entire transformed image (as a set of numbers)&lt;/li&gt;&#xA;&lt;li&gt;Find the largest difference coefficient (&lt;code&gt;maxVal&lt;/code&gt;) (in &lt;em&gt;entire&lt;/em&gt; 2d image)&lt;/li&gt;&#xA;&lt;li&gt;Choose &lt;code&gt;minValToSurvive&lt;/code&gt; as 1% of &lt;code&gt;maxVal&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If a difference coefficient has a magnitude less than &lt;code&gt;minValToSurvive&lt;/code&gt;, it is zeroed.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Here's my problem is.  When I remove only 83% of the lowest difference coefficients from the image (minValToSurvive=0.01*maxVal), you get this:&lt;/p&gt;&#xA;&lt;h2&gt;normalized&lt;/h2&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/586qp.png&quot; alt=&quot;d4 83% reduction normalized&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;If I &lt;strong&gt;remove&lt;/strong&gt; the normalization steps:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;s[ IEVEN ] *= ( √3 - 1 ) / √2 ; // REMOVE&#xA;s[ IODD ] *= ( √3 + 1 ) / √2 ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;(in both the fwd and reverse transforms), the result after removing 90% of the components is &lt;em&gt;much&lt;/em&gt; better (much less noise)&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oOSTV.png&quot; alt=&quot;90% reduction, not normalized&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;So I can think of 1 of 2 problems:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Normalizing the image by the ( √3 - 1 ) / √2 factors is killing precision&lt;/li&gt;&#xA;&lt;li&gt;I'm not &lt;em&gt;filtering&lt;/em&gt; correctly&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Or am I wrong?  If I'm filtering (removing insignificant components) incorrectly, what is a better way to filter?  If it's the floating point precision, then &lt;em&gt;should I not normalize the transform at every step&lt;/em&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1040" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-03-12T21:02:50.547" Title="&quot;Normalizing&quot; my D4 wavelet transformation at each step reduces final image quality" Tags="|noise|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1593" PostTypeId="1" AcceptedAnswerId="1594" CreationDate="2012-02-29T02:46:29.763" Score="22" ViewCount="26531" Body="&lt;p&gt;I'm using the &lt;code&gt;specgram()&lt;/code&gt; function in &lt;code&gt;matplotlib&lt;/code&gt; to generate spectrograms of speech wave files in Python, but the output is always of vastly inferior quality to what my normal transcription software, Praat, can generate. For example, the following call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;specgram(&#xA;    fromstring(spf.readframes(-1), 'Int16'),&#xA;    Fs=framerate,&#xA;    cmap=cm.gray_r,&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Generates this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KSdcs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While Praat, working on the same audio sample with the following settings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;View range: 0-8000Hz&lt;/li&gt;&#xA;&lt;li&gt;Window length: 0.005s&lt;/li&gt;&#xA;&lt;li&gt;Dynamic range: 70dB&lt;/li&gt;&#xA;&lt;li&gt;Time steps: 1000&lt;/li&gt;&#xA;&lt;li&gt;Frequency steps: 250&lt;/li&gt;&#xA;&lt;li&gt;Window shape: Gaussian&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Generates this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QbcyK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? I've tried fiddling with all the &lt;code&gt;specgram()&lt;/code&gt; parameters, but nothing seems to improve the resolution. I have virtually no experience with FFTs.&lt;/p&gt;&#xA;" OwnerUserId="1042" LastEditorUserId="306" LastEditDate="2012-04-26T11:56:18.220" LastActivityDate="2012-04-26T11:56:18.220" Title="Improving spectrogram resolution in Python?" Tags="|fft|spectrogram|python|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1594" PostTypeId="2" ParentId="1593" CreationDate="2012-02-29T03:38:37.197" Score="12" Body="&lt;p&gt;Here are the matplotlib.specgram parameters&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;matplotlib.mlab.specgram(x, &#xA;                         NFFT=256, &#xA;                         Fs=2, &#xA;                         detrend=&amp;lt;function detrend_none at 0x1dd6410&amp;gt;, &#xA;                         window=&amp;lt;function window_hanning at 0x1e0b1b8&amp;gt;, &#xA;                         noverlap=128, &#xA;                         pad_to=None, &#xA;                         sides='default', &#xA;                         scale_by_freq=None)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The parameters provided in the question description need to be converted to comparable mpl.specgram&#xA;parameters.  The following is an example of the mapping:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;View range: 0-8000Hz            Fs=16000&#xA;Window length: 0.005s           NFFT = int(Fs*0.005) = 80&#xA;                                noverlap = int(Fs*0.0025) = 40&#xA;Dynamic range: 70dB             n/a&#xA;Time steps: 1000                n/a&#xA;Frequency steps: 250            &#xA;Window shape: Gaussian          default window is hanning change to gaussian&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you use 8ms you will get a power of 2 FFT (128).  The following is the description of the Praat settings from their website&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;View range (Hz)&lt;/em&gt; : &#xA;  the range of frequencies to display. The standard is 0 Hz at the bottom and 5000 Hz at&#xA;  the top. If this maximum frequency is higher than the Nyquist frequency of the Sound&#xA;  (which is half its sampling frequency), some values in the spectrogram will be zero, &#xA;  and the higher frequencies will be drawn in white. You can see this if you record a &#xA;  Sound at 44100 Hz and set the view range from 0 Hz to 25000 Hz.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;em&gt;Window length&lt;/em&gt; : &#xA;  the duration of the analysis window. If this is 0.005 seconds (the standard), &#xA;  Praat uses for each frame the part of the sound that lies between 0.0025 seconds &#xA;  before and 0.0025 seconds after the centre of that frame (for Gaussian windows, &#xA;  Praat actually uses a bit more than that). The window length determines the &#xA;  bandwidth of the spectral analysis, i.e. the width of the horizontal line in &#xA;  the spectrogram of a pure sine wave (see below). For a Gaussian window, the -3 dB&#xA;  bandwidth is 2*sqrt(6*ln(2))/(π*Window length), or 1.2982804 / Window length. &#xA;  To get a &lt;code&gt;broad-band' spectrogram (bandwidth 260 Hz), keep the standard window &#xA;  length of 5 ms; to get a&lt;/code&gt;narrow-band' spectrogram (bandwidth 43 Hz), set it to &#xA;  30 ms (0.03 seconds). The other window shapes give slightly different values.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;em&gt;Dynamic range (dB)&lt;/em&gt; : &#xA;  All values that are more than Dynamic range dB below the maximum (perhaps after &#xA;  dynamic compression, see Advanced spectrogram settings...) will be drawn in white. &#xA;  Values in-between have appropriate shades of grey. Thus, if the highest peak in &#xA;  the spectrogram has a height of 30 dB/Hz, and the dynamic range is 50 dB (which &#xA;  is the standard value), then values below -20 dB/Hz will be drawn in white, and &#xA;  values between -20 dB/Hz and 30 dB/Hz will be drawn in various shades of grey.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.fon.hum.uva.nl/praat/manual/Intro_3_2__Configuring_the_spectrogram.html&quot; rel=&quot;noreferrer&quot;&gt;Link to Praat settings&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The OP's question might be concerning the contrast difference between the Praat &#xA;specgram and the mpl (matplotlib) specgram.  Praat has a &lt;em&gt;Dynamic Range&lt;/em&gt; setting &#xA;which affects the contrast.  The mpl function does not have a similar setting/parameter.  The mpl.specgram does return the 2D array of power levels (the spectrogram) the&#xA;dynamic range could be applied to the return array and re-plotted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is a code snippet to create the plots below.  The example is ~1m15s speech with a chirp from 20Hz-8000Hz.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;import pylab&#xA;import wave&#xA;import array&#xA;pylab.close('all')&#xA;w1 = wave.open('example_no_noise.wav')&#xA;w2 = wave.open('example_noise.wav')&#xA;# hmmm, probably a better way to do this, scipy.io function?&#xA;x1 = numpy.array(array.array('h', w1.readframes(w1.getnframes())))&#xA;x2 = numpy.array(array.array('h', w2.readframes(w2.getnframes())))&#xA;x1 = x1 / (2.**(16-1))  # normalize&#xA;x2 = x2 / (2.**(16-1))  # normalize&#xA;Fs = 16000.&#xA;NFFT = int(Fs*0.005)  # 5ms window&#xA;noverlap = int(Fs*0.0025)&#xA;pylab.figure(1)&#xA;pylab.specgram(x1, NFFT=NFFT, Fs=Fs, noverlap=noverlap, &#xA;               cmap=pylab.get_cmap('Greys'))&#xA;pylab.title('Full 1m15s example min noise')&#xA;pylab.figure(2)&#xA;pylab.specgram(x2, NFFT=NFFT, Fs=Fs, noverlap=noverlap, &#xA;               cmap=pylab.get_cmap('Greys'))&#xA;pylab.title('Full 1m15s example more noise')&#xA;pylab.figure(3); n=2100*176;&#xA;pylab.specgram(x2[n:n+256*256], NFFT=NFFT, Fs=Fs, noverlap=noverlap, &#xA;               cmap=pylab.get_cmap('Greys'))&#xA;pylab.title('Full ~4s example min noise')&#xA;pylab.figure(4); pylab.plot(x1[n:n+256*256])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hTcmH.png&quot; width=&quot;600&quot; height=&quot;450&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ggCJj.png&quot; width=&quot;600&quot; height=&quot;450&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/40Lu0.png&quot; width=&quot;600&quot; height=&quot;450&quot;&gt;&#xA;&lt;/p&gt;&#xA;" OwnerUserId="306" LastEditorUserId="306" LastEditDate="2012-03-01T13:39:17.817" LastActivityDate="2012-03-01T13:39:17.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1595" PostTypeId="2" ParentId="1593" CreationDate="2012-02-29T09:30:45.837" Score="6" Body="&lt;p&gt;It seems to be a time/frequency resolution problem. Your Praat plot has a worse frequency resolution (you cannot even clearly see the harmonics) and a better time resolution. Try reducing the window size (NFFT) to 16000 x 0.05 = 80 samples. I'd suggest using a bigger power of 2 in pad_to (128 or 256).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-02-29T09:30:45.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1599" PostTypeId="2" ParentId="811" CreationDate="2012-03-01T13:53:29.420" Score="4" Body="&lt;p&gt;Jason and Nibot's answer differ in one important aspect: Jason's method calculates the std dev and mean for the the whole signal (since  y = 0), while Nibot's is a &quot;running&quot; calculation, i.e. it weighs more recent samples stronger than samples from the distant past. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the application seems to require std dev and mean as a function of time, Nibot's method is probably the more appropriate one (for this specific application). However, the real tricky part will be to get the time weighting part right. Nibot's example uses a simple single pole filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proper way to describe this is to that we get an estimate of $E[x]$ by filtering $x[n]$ and an estimate for $E[x^2]$ by filtering $x[n]^2$. Estimation filters are typically low pass filters. These filters should be scaled to have 0dB gain at 0 Hz. Otherwise there is a constant gain error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The choice of lowpass filter can be guided by what you know about your signal and the time resolution you need for your estimation. Lower cutoff frequencies and higher order will result in better accuracy but slower response time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To complicate things further one filter is applied in the linear domain and another in the squared domain. Squaring significantly changes the spectral content of the signal so you may want to use a different filter in the squared domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example on how to estimate mean, rms and std dev as a function of time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% example&#xA;fs = 44100; n = fs; % 44.1 kHz sample rate, 1 second&#xA;% signal: white noise plus a low frequency drift at 5 Hz)&#xA;x = randn(n,1) + sin(2*pi*(0:n-1)'*5/fs);&#xA;% mean estimation filter: since we are looking for effects in the 5 Hz range we use maybe a&#xA;% 25 Hz filter, 2nd order so it's not too sluggish&#xA;[b,a] = butter(2,25*2/fs);&#xA;xmeanEst = filter(b,a,x);&#xA;% now we estimate x^2, since most frequency double we use twice the bandwidth&#xA;[b,a] = butter(2,50*2/fs);&#xA;x2Est = filter(b,a,x.^2);&#xA;% std deviation estimate&#xA;xstd = sqrt(x2Est)-xmeanEst;&#xA;% and plot it&#xA;h = plot([x, xmeanEst sqrt(x2Est) xstd]);&#xA;grid on;&#xA;legend('x','E&amp;lt;x&amp;gt;','sqrt(E&amp;lt;x^2&amp;gt;)','Std dev');&#xA;set(h(2:4),'Linewidth',2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorUserId="16927" LastEditDate="2016-03-14T13:28:12.557" LastActivityDate="2016-03-14T13:28:12.557" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1600" PostTypeId="2" ParentId="1557" CreationDate="2012-03-01T15:43:15.853" Score="0" Body="&lt;p&gt;Here's what I did in the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When building one stage of the Bainter, I knew the first opamp was a unity inverting buffer. So I could easily check its performance. I knew the next two stages were a high pass and low pass respectively. I did not know exactly what frequency they would break at, but I could roughly check their performance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the Bainter was put together, I was able to calculate the DC gain and step response using Matlab. I measured these two characteristics on the actual Bainter and compared. If they were reasonably close, I moved on to the next Bainter stage and repeat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once all three Bainter stages were built (for a 3rd order filter) I wired them in order of lowest to highest DC gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, I had a fairly accurate Chebyshev filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the input.&lt;/p&gt;&#xA;" OwnerUserId="1029" LastActivityDate="2012-03-01T15:43:15.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1601" PostTypeId="1" AcceptedAnswerId="1604" CreationDate="2012-03-01T19:12:47.550" Score="6" ViewCount="1581" Body="&lt;p&gt;I am wondering if a methodology(ies) exist for essentially 'filtering' out a tone or interference, WITHOUT resorting to classical linear filtering techniques. (band pass filter, etc for example). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this question is because inherent in any classical linear filtering operation, I am at the end of the day linearly combining samples among themselves, and while this might do well to remove a tone of another frequency that I am trying to remove, it also has the effect of 'smearing' my signal in time. This smearing effect causes information such as the 'sharpness' of the signal to be lost, and in this specific case, the 'sharpness' carries information such as start of signal energy, etc, that I use later. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What method(s) exist (do they exist?) for this goal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also add, please assume omnidirectional case, (I only have one sensor), but if assuming a case with multiple sensors lends itself to a solution, feel free to use that assumption as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT#1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I must say that for the tonal case,  I think it might be straight forward as many of you have indicated, vis-a-vis estimating the tonal parameters, reconstructing, and subtracting. The actual problem though, is a little more complicated... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The unwanted signals can range from anything like a group of whales having a 'conversation' to a boat's motor overhead. In such cases no known robust model exists, all I know is that my signal of interest is among all those other energies - they are seperable in frequency, but I need a way to remove them as well, without filtering because that removes my sharpness. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI, I think this falls into the realm of non-linear filtering or other techniques from different areas? I should also add that I have a lot of computing power. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-03-02T05:50:18.227" LastActivityDate="2012-03-02T05:50:18.227" Title="How to remove a tone/interference from a signal, without using classical linear filtering" Tags="|filters|discrete-signals|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1602" PostTypeId="2" ParentId="1601" CreationDate="2012-03-01T22:10:28.523" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;A linear phase filter will leave most of the transients intact&#xA;(unless there is a lot of frequency overlap between interferer and&#xA;signal)&lt;/li&gt;&#xA;&lt;li&gt;Similar to Dilip's comment: if you have access to a signal that's&#xA;linearly related to the interferer, you can estimate the exact&#xA;contribution with an adaptive filter and then simply subtract it out. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-01T22:10:28.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1603" PostTypeId="1" CreationDate="2012-03-02T00:20:58.793" Score="22" ViewCount="31259" Body="&lt;p&gt;I'm doing research on the Gabor filter. When I Googled it, I found very long and complicated articles. Can anyone help me to find a simple explanation about it, or recommend a website or article to read? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to understand this filter in order to use it in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="1047" LastEditorUserId="21075" LastEditDate="2020-04-30T11:39:17.523" LastActivityDate="2021-07-30T09:13:43.340" Title="What is the Gabor filter? And what are its main uses?" Tags="|filters|frequency|gabor|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1604" PostTypeId="2" ParentId="1601" CreationDate="2012-03-02T00:22:00.637" Score="4" Body="&lt;p&gt;A sharp edge or transient may require a very wide-band spectrum to represent it.  Thus any classical or frequency domain filter that completely removes a spectral band could unsharpen or &quot;smear&quot; a sharp transient, by removing a necessary component of that transient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two non-linear methods based on analysis/resynthesis techniques that might work.  Either estimate your tone or interference signal precisely enough to synthesize it and subtract it.  Or characterize your desired signal well enough to resynthesize it without the noise.  You will need a very accurate model for either of these.  Both of these will only remove or add the appropriate fraction of energy in any spectral band, instead off all or none, or some random percentage (relative to the actual S/N) given by a filter response curve.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-03-02T00:22:00.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1605" PostTypeId="1" AcceptedAnswerId="1613" CreationDate="2012-03-01T02:42:58.257" Score="14" ViewCount="21665" Body="&lt;p&gt;I've designed a very simple low-pass Butterworth filter using Matlab. The following code snippet demonstrates what I've done.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 2.1e6;&#xA;flow = 44 * 1000;&#xA;fNorm =  flow / (fs / 2);&#xA;[b,a] = butter(10, fNorm, 'low');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In [b,a] are stored the filter coefficients.  I would like to obtain [b,a] as integers so that I can use an &lt;a href=&quot;http://www.spiral.net/hardware/filter.html&quot; rel=&quot;noreferrer&quot;&gt;online HDL code generator&lt;/a&gt; to generate code in Verilog.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matlab [b,a] values seem to be too small to use with the online code generator (the server-side Perl script refuses to generate code with the coefficients), and I am wondering if it would be possible to obtain [b,a] in a form that can be used as a proper input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The a coefficients that I get in Matlab are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.0000&#xA;-9.1585&#xA;37.7780&#xA;-92.4225&#xA;148.5066&#xA;-163.7596&#xA;125.5009&#xA;-66.0030&#xA;22.7969&#xA;-4.6694&#xA;0.4307&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The b coefficients that I get in Matlab are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.0167e-012&#xA;1.0167e-011&#xA;4.5752e-011&#xA;1.2201e-010&#xA;2.1351e-010&#xA;2.5621e-010&#xA;2.1351e-010&#xA;1.2201e-010&#xA;4.5752e-011&#xA;1.0167e-011&#xA;1.0167e-012&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using the online generator, I would like to design a filter with a 12-bit bitwidth and I or II filter form.  I don't know what is meant by the &quot;fractional bits&quot; at the above link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running the code generator (http://www.spiral.net/hardware/filter.html) with the [b,a] coefficients listed above, with fractional bits set at 20 and a bitwidth of 12, I receive the following run error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Integer A constants: 1048576 -9603383 39613104 -96912015 155720456 -171714386 131597231 -69209161 23904282 -4896220 451621&#xA;Integer B constants: 0 0 0 0 0 0 0 0 0 0 0&#xA;&#xA;Error: constants wider than 26 bits are not allowed, offending constant = -69209161, effective bitwidth = 7 mantissa + 20 fractional = 27 total.&#xA;&#xA;An error has occurred - please revise the input parameters. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How might I change my design so that this error does not occur?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&#xA;Using Matlab to generate a 6th-order Butterworth filter, I get the following coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.0000&#xA;-5.4914&#xA;12.5848&#xA;-15.4051&#xA;10.6225&#xA;-3.9118&#xA;0.6010 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for b:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0064e-005&#xA;0.0382e-005&#xA;0.0954e-005&#xA;0.1272e-005&#xA;0.0954e-005&#xA;0.0382e-005&#xA;0.0064e-005&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Running the online code generator (http://www.spiral.net/hardware/filter.html), I now receive the following error (with fractional bits as 8 and bitwidth of 20):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;./iirGen.pl -A 256  '-1405' '3221' '-3943' '2719' '-1001' '153' -B  '0' '0' '0' '0' '0' '0' '0' -moduleName acm_filter -fractionalBits 8 -bitWidth 20 -inData inData  -inReg   -outReg  -outData outData -clk clk -reset reset -reset_edge negedge -filterForm 1  -debug  -outFile ../outputs/filter_1330617505.v 2&amp;gt;&amp;amp;1 &#xA;At least 1 non-zero-valued constant is required.  Please check the inputs and try again.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Perhaps the b-coefficients are too small, or perhaps the code generator (http://www.spiral.net/hardware/filter.html) wants the [b,a] in another format?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps what I need to do is scale the [b,a] coefficients by the number of fractional bits to obtain the coefficients as integers.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a .* 2^12&#xA;b .* 2^12&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I still think that the b coefficients are extremely small.  What am I doing wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps another type of filter (or filter design method) would be more suitable?  Could anyone make a suggestion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&#xA;As suggested by Jason R and Christopher Felton in the comments below, an SOS filter would be more suitable.  I've now written some Matlab code to obtain an SOS filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 2.1e6;&#xA;flow = 44 * 1000;      &#xA;fNorm =  flow / (fs / 2);&#xA;[A,B,C,D] = butter(10, fNorm, 'low');&#xA;[sos,g] = ss2sos(A,B,C,D);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The SOS matrix that I get is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.0000    3.4724    3.1253    1.0000   -1.7551    0.7705&#xA;1.0000    2.5057    1.9919    1.0000   -1.7751    0.7906&#xA;1.0000    1.6873    1.0267    1.0000   -1.8143    0.8301&#xA;1.0000    1.2550    0.5137    1.0000   -1.8712    0.8875&#xA;1.0000    1.0795    0.3046    1.0000   -1.9428    0.9598&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to still use the Verilog code generation tool (http://www.spiral.net/hardware/filter.html) to implement this SOS filter, or should I simply write the Verilog by hand?  Is a good reference available?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would wonder if an FIR filter would be better to use in this situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MOREOVER:&lt;/strong&gt; Recursive IIR filters can be implemented using integer math by expressing coefficients as fractions. (See Smith's excellent DSP signal processing book for further details: &lt;a href=&quot;http://www.dspguide.com/ch19/5.htm&quot; rel=&quot;noreferrer&quot;&gt;http://www.dspguide.com/ch19/5.htm&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following Matlab program converts Butterworth filter coefficients into fractional parts using the Matlab rat() function.  Then as mentioned in the comments, second order sections can be used to numerically implement the filter (http://en.wikipedia.org/wiki/Digital_biquad_filter).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% variables&#xA;% variables&#xA;fs = 2.1e6;                     % sampling frequency           &#xA;flow = 44 * 1000;               % lowpass filter&#xA;&#xA;&#xA;% pre-calculations&#xA;fNorm =  flow / (fs / 2);       % normalized freq for lowpass filter&#xA;&#xA;% uncomment this to look at the coefficients in fvtool&#xA;% compute [b,a] coefficients&#xA;% [b,a] = butter(7, fNorm, 'low');&#xA;% fvtool(b,a)  &#xA;&#xA;% compute SOS coefficients (7th order filter)&#xA;[z,p,k] = butter(7, fNorm, 'low');&#xA;&#xA;% NOTE that we might have to scale things to make sure&#xA;% that everything works out well (see zp2sos help for 'up' and 'inf' options)&#xA;sos = zp2sos(z,p,k, 'up', 'inf'); &#xA;[n,d] = rat(sos); &#xA;sos_check = n ./ d;  % this should be the same as SOS matrix&#xA;&#xA;% by here, n is the numerator and d is the denominator coefficients&#xA;% as an example, write the the coefficients into a C code header file&#xA;% for prototyping the implementation&#xA;&#xA; % write the numerator and denominator matices into a file&#xA;[rownum, colnum] = size(n);  % d should be the same&#xA;sections = rownum;           % the number of sections is the same as the number of rows&#xA;fid = fopen('IIR_coeff.h', 'w');&#xA;&#xA;fprintf(fid, '#ifndef IIR_COEFF_H\n');&#xA;fprintf(fid, '#define IIR_COEFF_H\n\n\n');&#xA;for i = 1:rownum&#xA;   for j = 1:colnum&#xA;&#xA;       if(j &amp;lt;= 3)  % b coefficients&#xA;            bn = ['b' num2str(j-1) num2str(i) 'n' ' = ' num2str(n(i,j))];&#xA;            bd = ['b' num2str(j-1) num2str(i) 'd' ' = ' num2str(d(i,j))];&#xA;            fprintf(fid, 'const int32_t %s;\n', bn);&#xA;            fprintf(fid, 'const int32_t %s;\n', bd);&#xA;&#xA;       end&#xA;       if(j &amp;gt;= 5)  % a coefficients&#xA;            if(j == 5) &#xA;                colstr = '1'; &#xA;            end&#xA;            if(j == 6) &#xA;                colstr = '2'; &#xA;            end&#xA;            an = ['a' colstr num2str(i) 'n' ' = ' num2str(n(i,j))];&#xA;            ad = ['a' colstr num2str(i) 'd' ' = ' num2str(d(i,j))];&#xA;            fprintf(fid, 'const int32_t %s;\n', an);&#xA;            fprintf(fid, 'const int32_t %s;\n', ad);&#xA;       end&#xA;   end&#xA;end&#xA;&#xA;% write the end of the file&#xA;fprintf(fid, '\n\n\n#endif');&#xA;fclose(fid);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1048" OwnerDisplayName="Nicholas Kinar" LastEditorUserId="1048" LastEditDate="2012-05-16T16:09:46.967" LastActivityDate="2012-05-16T16:09:46.967" Title="Designing Butterworth filter in Matlab and obtaining filter [a.b] coefficients as integers for online Verilog HDL code generator" Tags="|matlab|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1606" PostTypeId="2" ParentId="1605" CreationDate="2012-03-01T14:26:28.030" Score="10" Body="&lt;p&gt;The 'fractional bits' are the number of bits in a bus that you've dedicated to represent the fractional portion of a number (eg, the .75 in 3.75).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you've a digital bus 4 bits wide, what number does &lt;code&gt;1001&lt;/code&gt; represent? It could mean '9' if you treat it as a positive integer (2^3 + 2^0 = 8 + 1 = 9). Or it could mean -7 in two's complement notation: (-2^3 + 2^0 = -8 + 1 = -7). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about numbers with some fractions in them, ie 'real' numbers? Real numbers can be represented in hardware as &quot;fixed-point&quot; or &quot;floating point&quot;. It looks like those filter generators use fixed point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back to our 4 bit bus (&lt;code&gt;1001&lt;/code&gt;). Let's introduce a binary point so we get &lt;code&gt;1.001&lt;/code&gt;. What this means is that were now using the bits on the RHS of the point to build integers, and the bits on the LHS to build a fraction. The number represented by a digital bus set to &lt;code&gt;1.001&lt;/code&gt; is 1.125 (&lt;code&gt;1&lt;/code&gt;*2^0 + &lt;code&gt;0&lt;/code&gt;*2^-1 + &lt;code&gt;0&lt;/code&gt;*2^-2 + &lt;code&gt;1&lt;/code&gt;*2^-3 = 1 + 0.125 = 1.125). In this case, out of the 4 bits in the bus, we are using 3 of them to represent the fractional portion of a number. Or, we have 3 fractional bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you've a list of real numbers like you have above, you now have to decide how many fractional bits you want to represent them. And here's the trade-off: the more fractional bits you use, the closer you can represent the number you want, but the bigger your circuit will need to be. And what's more, the fewer fractional bits you use, the further the actual frequency response of the filter will deviate from the one you designed at the start!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to make matters worse, you're looking to build an Infinite Impulse Response (IIR) filter. These can actually go unstable if you don't have enough fractional and integer bits!&lt;/p&gt;&#xA;" OwnerUserId="132" OwnerDisplayName="Marty" LastActivityDate="2012-03-01T14:26:28.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1607" PostTypeId="2" ParentId="1605" CreationDate="2012-03-01T15:13:50.520" Score="10" Body="&lt;p&gt;So Marty has well taken care of the bits question.  Onto the filter itself, I think you are likely getting a warning or complaint from matlab about poorly scaled coefficients?  When I plot the filter, from scipy not matlab but it's likely very similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IHJtl.png&quot; alt=&quot;Response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is 100 dB down at the passband!  So, you may want to make sure you want a smaller order filter, which will help with you implementation anyway.  When I get to a 6th order filter I stop getting complaints about bad coefficients.  Maybe try reducing the order and see if it still meets your requirements.&lt;/p&gt;&#xA;" OwnerUserId="1058" OwnerDisplayName="macduff" LastActivityDate="2012-03-01T15:13:50.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1608" PostTypeId="1" CreationDate="2012-03-02T01:00:23.730" Score="3" ViewCount="9432" Body="&lt;p&gt;In standard of 3GPP LTE physical layer(3GPP TS 36.211), the FFT size for baseband signal generation for both Dl and UL is 2048 and CP size is also determined. However there is a table in several resources said we have different FFT and CP size. E.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://lteuniversity.com/ask_the_expert/f/59/t/405.aspx&quot; rel=&quot;nofollow&quot;&gt;http://lteuniversity.com/ask_the_expert/f/59/t/405.aspx&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is it possible?&lt;/p&gt;&#xA;" OwnerUserId="290" LastEditorUserId="90" LastEditDate="2012-03-03T02:37:02.417" LastActivityDate="2013-02-15T12:28:56.157" Title="what's the baseband FFT size of LTE?" Tags="|fft|discrete-signals|ofdm|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1609" PostTypeId="1" CreationDate="2012-03-02T06:20:18.190" Score="4" ViewCount="85" Body="&lt;p&gt;For a video stabilization project, a USB webcam (25 fps) and USB acceleration sensors are being used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the sensors gives a speed of approximately 50 samples/second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the derivative of the acceleration aka. 'Jerk' is done in order to localize the start and the end of the shake in the video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the purpose is to compensate the camera movement in real-time, if it were you how would you :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Match the frame (from camera) with the data of the sensor.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the number of pixels to compensate from acceleration sensors data.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1050" LastActivityDate="2012-03-02T07:43:06.350" Title="What would be the best solution to synchronize data from two inputs. (Camera and Acceleration sensors)" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1610" PostTypeId="2" ParentId="1609" CreationDate="2012-03-02T07:43:06.350" Score="3" Body="&lt;p&gt;This is a common problem that most Multimedia systems faces and solves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, closest to the source, there should be one entity (call it &lt;em&gt;originator&lt;/em&gt;) that must collect both the data simultaneously and then stamps the each observation i.e. frames of video and sample of sensor, a time stamp from the local (best suitable clock). After this, originator distributes data in whichever form required. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially a common reference clock for both sources as seen by &lt;em&gt;originator&lt;/em&gt;. Any encoding, processing, and consumption of this data must preserve and interpret these time stamps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This synchronization is of course only as good the source clock itself; there can be jitter and skew in such a clock used by &lt;em&gt;originator&lt;/em&gt;. Either the &lt;em&gt;originator&lt;/em&gt; follow clock of any primary source (data or video whichever reliable) and stamp it on the other, or derive a local clock using either reliable crystal or GPS or NTP etc. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-03-02T07:43:06.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1611" PostTypeId="2" ParentId="1603" CreationDate="2012-03-02T08:08:48.690" Score="9" Body="&lt;p&gt;It is an &lt;strong&gt;edge detector&lt;/strong&gt;. It just applies the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gabor_transform&quot;&gt;Gabor Transform&lt;/a&gt;. The Gabor filter is basically a Gaussian (with variances sx and sy along x and y-axes respectively) modulated by a complex sinusoid (with centre frequencies U and V along x and y-axes respectively). See an example &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/5237&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastActivityDate="2012-03-02T08:08:48.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1613" PostTypeId="2" ParentId="1605" CreationDate="2012-03-02T11:46:07.327" Score="5" Body="&lt;p&gt;As discussed it is best to use the sum of sections, that is break the higher-order filter into a cascaded 2nd order filters.  The updated question has the SOS matrix.  Using &lt;a href=&quot;http://bit.ly/yR5tsL&quot; rel=&quot;nofollow&quot;&gt;this code&lt;/a&gt; and an &lt;a href=&quot;http://bit.ly/w95kOd&quot; rel=&quot;nofollow&quot;&gt;example here&lt;/a&gt; the Python object can be used to generate the individual sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matlab&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;save SOS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Python&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import shutil&#xA;import numpy&#xA;from scipy.io import loadmat&#xA;from siir import SIIR&#xA;&#xA;matfile = loadmat('SOS.mat')  &#xA;SOS = matfile['SOS']&#xA;b = numpy.zeros((3,3))&#xA;a = numpy.zeros((3,3))&#xA;section = [None for ii in range(3)]&#xA;for ii in xrange(3):&#xA;    b[ii] = SOS[ii,0:3]&#xA;    a[ii] = SOS[ii,3:6]&#xA;&#xA;    section[ii] = SIIR(b=b[ii], a=a[ii], W=(24,0))&#xA;    section[ii].Convert()  # Create the Verilog for the section&#xA;    shutil.copyfile('siir_hdl.v', 'iir_sos_section%d.v'%(ii))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Additional information on fixed-point can be found &lt;a href=&quot;http://bit.ly/zuyMwI&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="306" LastEditorUserId="306" LastEditDate="2012-04-02T11:39:17.843" LastActivityDate="2012-04-02T11:39:17.843" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1614" PostTypeId="2" ParentId="1603" CreationDate="2012-03-02T15:18:08.050" Score="17" Body="&lt;p&gt;Gabor filters are &lt;strong&gt;orientation-sensitive&lt;/strong&gt; filters, used for texture analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The typically travel in packs, one for each direction. A gabor filter set with a given direction gives a strong response for locations of the target images that have structures in this given direction. For instance, if your target image is made of a periodic grating in a diagonal direction, a gabor filter set will give you a strong response only if its direction matches the one of the grating.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it is used a lot in character recognition and fingerprint enhancement. I (try to)  use it in bio-medical imaging to characterizes the main orientation in fibril structures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a very good &lt;a href=&quot;http://www.google.fr/url?sa=t&amp;amp;rct=j&amp;amp;q=gabor%20filter%20&amp;amp;source=web&amp;amp;cd=6&amp;amp;ved=0CGAQFjAF&amp;amp;url=http://mplab.ucsd.edu/tutorials/gabor.pdf&amp;amp;ei=d-NQT9eGHcbF0QWvwL3pCw&amp;amp;usg=AFQjCNFl6YBnJ_DT-rP-E_7In0K0cgvRDQ&amp;amp;sig2=mGMxkOOt-CUbrmEFql41EA&amp;amp;cad=rja&quot; title=&quot;tutorial&quot;&gt;tutorial by Javier Movellan, pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you can read french, here is pdf on &lt;a href=&quot;http://www.creatis.insa-lyon.fr/~amarion/fichiers/filtre_gabor.pdf&quot; title=&quot;filter bank&quot;&gt;the creation of filter banks by Adrien Marion&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="756" LastEditorUserId="756" LastEditDate="2012-03-02T15:55:47.100" LastActivityDate="2012-03-02T15:55:47.100" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1615" PostTypeId="2" ParentId="1523" CreationDate="2012-03-02T19:09:22.093" Score="9" Body="&lt;p&gt;I'm not an expert on ICA, but I can tell you a little bit about independence. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As some of the comments have mentioned, statistical independence between two random variables can be roughly interpreted as &quot;the amount of information that observing one variable gives about another&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, because we're talking about &lt;em&gt;statistical&lt;/em&gt; independence, all of this is with respect to a distribution. In particular, if you observe two random variables $X$ and $Y$, independence of $X$ and $Y$ is equivalent to a condition on their joint distribution $p(x,y)$. In particular, $X$ and $Y$ are independent if and only if $p(x,y) = p(x)p(y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This condition is basically what an earlier comment suggested that you use. Plotting a scatter plot of the two variables is a kind of visualization of the joint distribution $p(x,y)$. When two variables are independent, permuting the observations should give the same underlying joint distribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are lots of ways to test for independence. In practice (say, to draw scientific conclusions), you might like a careful hypothesis test that allows you to state your assumptions and the confidence of your conclusions (like the chi-square test). I'll ignore that here, and assume you have perfect information about your distributions. Then, note that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mutual_information&quot; rel=&quot;noreferrer&quot;&gt;mutual information&lt;/a&gt; between $X$ and $Y$ is zero exactly when $X$ and $Y$ are independent. To compute the mutual information, let your joint distribution be $p(X=i, Y=j) = p_{ij}$, and $P(X=i) = p_i$ and $P(Y=j) = p_j$ be your marginals. Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$I(X,Y) = \sum_i \sum_j p_{ij} \log \frac{p_{ij}}{p_i p_j}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some matlab code that will generate two independent signals from a constructed joint distribution, and two from a non-independent joint distribution, and then compute the mutual information of the joints. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function &quot;computeMIplugin.m&quot; is a simple function I wrote that computes the mutual information using the summation formula above. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ndist = 25;&#xA;xx = linspace(-pi, pi, Ndist);&#xA;&#xA;P1 = abs(sin(xx)); P2 = abs(cos(xx)); &#xA;P1 = P1/sum(P1); P2 = P2/sum(P2); % generate marginal distributions&#xA;&#xA;%% Draw independent samples.&#xA;Nsamp = 1e4;&#xA;X = randsample(xx, Nsamp, 'true', P1);&#xA;Y = randsample(xx, Nsamp, 'true', P2);&#xA;&#xA;Pj1 = P1'*P2;&#xA;computeMIplugin(Pj1)&#xA;&#xA;% I get approx 8e-15 ... independent!&#xA;&#xA;% Now Sample the joint distribution &#xA;cnt = {}; cnt{1} = xx; cnt{2} = xx; % bin centers&#xA;Pj1_samp= hist3([X' Y'],cnt); Pj1_samp = Pj1_samp/sum(Pj1_samp(:));&#xA;computeMIplugin(Pj1_samp)&#xA;% I get approx .02; since we've estimated the distribution from&#xA;% samples, we don't know the true value of the MI. This is where&#xA;% a confidence interval would come in handy. We'd like to know &#xA;% whether value of MI is significantly different from 0. &#xA;&#xA;% mean square difference between true and sampled?&#xA;% (this is small for these parameter settings... &#xA;% depends on the sample size and # bins in the distribution).&#xA;mean( (Pj1_samp(:) - Pj1(:)).^2)&#xA;&#xA;%% Draw samples that aren't independent. &#xA;&#xA;tx = linspace(0,30,Nsamp);&#xA;X = pi*sin(tx);&#xA;Y = pi*cos(tx);&#xA;&#xA;% estimate the joint distribution&#xA;cnt = {}; cnt{1} = xx; cnt{2} = xx; % bin centers&#xA;Pj2= hist3([X' Y'],cnt); Pj2 = Pj2/sum(Pj2(:));&#xA;computeMIplugin(Pj2)&#xA;&#xA;% I get 1.9281  - not independent!&#xA;&#xA;%% make figure&#xA;figure(1); &#xA;colormap gray&#xA;subplot(221)&#xA;imagesc(xx,xx,Pj1_samp)&#xA;title('sampled joint distribution 1')&#xA;subplot(222)&#xA;imagesc(xx,xx,Pj2)&#xA;title('sampled joint distribution 2')&#xA;subplot(223)&#xA;imagesc(xx,xx,Pj1)&#xA;title('true joint distribution 1')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again, this assumes you have a good estimate of the joint distribution (along with other blithe assumptions), but it should be useful as a rule of thumb. &lt;/p&gt;&#xA;" OwnerUserId="964" LastEditorUserId="964" LastEditDate="2012-03-11T03:08:02.603" LastActivityDate="2012-03-11T03:08:02.603" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1617" PostTypeId="1" AcceptedAnswerId="1619" CreationDate="2012-03-03T06:58:48.150" Score="11" ViewCount="336" Body="&lt;p&gt;I have an input as &lt;strong&gt;a 3D binary image&lt;/strong&gt; and the preferred output below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dW7NY.png&quot; alt=&quot;INPUT&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preferred Output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1VC6C.png&quot; alt=&quot;OUTPUT&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What image processing methods should I look for if I am to have only the spiky object(s) remain, just like the preferred output above?&lt;/p&gt;&#xA;" OwnerUserId="263" LastActivityDate="2012-03-03T10:23:20.483" Title="Image Processing method for spiky selection" Tags="|image-processing|computer-vision|3d|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1618" PostTypeId="1" AcceptedAnswerId="1621" CreationDate="2012-03-03T07:58:18.247" Score="8" ViewCount="436" Body="&lt;p&gt;I have a sum of periodic signals that I am trying to untangle using time-frequency analysis. I seem to get wildly different results depending on the window length and shape. This is a problem because I want to develop an automated, and hopefully sequential algorithm to do the job.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-03-05T15:07:39.887" Title="How critical is the selection of the window function in STFTs?" Tags="|stft|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1619" PostTypeId="2" ParentId="1617" CreationDate="2012-03-03T10:23:20.483" Score="19" Body="&lt;p&gt;There are more corners on the borders of your &quot;spiky object&quot;, so one approach would be to tune a &lt;a href=&quot;http://en.wikipedia.org/wiki/Corner_detection&quot; rel=&quot;nofollow noreferrer&quot;&gt;corner detector&lt;/a&gt; for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I calculated the determinant of the structure tensor (Mathematica code below) of a distance-transformed image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hzgbr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Binarizing with hysteresis yields this image, which should be a good starting point for the segmentation algorithm of your choice:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0YgtO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematica code (&lt;code&gt;src&lt;/code&gt; is the source image you posted)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first, i calculate a distance transform of the input image. This creates contrasts over the whole object area (instead of just the border), so the whole object can be detected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dist = ImageData[DistanceTransform[src]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next I prepare the components of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Structure_tensor&quot; rel=&quot;nofollow noreferrer&quot;&gt;structure tensor&lt;/a&gt;. The filter size for the gaussian derivatives if 5, the window size is 20. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gx = GaussianFilter[dist, 5, {1, 0}];&#xA;gy = GaussianFilter[dist, 5, {0, 1}];&#xA;gx2 = GaussianFilter[gx^2, 20];&#xA;gxy = GaussianFilter[gx*gy, 20];&#xA;gy2 = GaussianFilter[gy^2, 20];   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To calculate the corner filter at each pixel, I simply plug these into the symbolic determinant of the structure tensor:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;corners = Det[{{dx2, dxy}, {dxy, dy2}}] /. {dx2 -&amp;gt; gx2, dxy -&amp;gt; gxy, dy2 -&amp;gt; gy2};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is basically the same as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;corners = gx2 * gy2 - gxy * gxy;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Converting this to an image and scaling it to 0..1 range yields the corner detector image above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, binarizing it with the right thresholds gives the final, binary image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MorphologicalBinarize[Image[corners], {0.025, 0.1}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-03-03T10:23:20.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1620" PostTypeId="1" CreationDate="2012-03-03T13:27:28.390" Score="12" ViewCount="1383" Body="&lt;p&gt;I am trying to use a MCS (Multi classifier system) to do some better work on limited data i.e become more accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using K-means clustering at the moment but may choose to go with FCM (Fuzzy c-means) with that the data is clustered into groups (clusters) the data could represent anything, colours for example. I first cluster the data after pre-processing and normalization and get some distinct clusters with a lot in between. I then go on to use the clusters as the data for a Bayes classifier, each cluster represents a distinct colour and the Bayes classifier is trained and the data from the clusters is then put through separate Bayes classifiers. Each Bayes classifier is trained only in one colour. If we take the colour spectrum 3 - 10 as being blue 13 - 20 as being red and the spectrum in between 0 - 3 being white up to 1.5 then turning blue gradually through 1.5 - 3 and same for blue to red.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to know is how or what kind of aggregation method (if that is what you would use) could be applied so that the Bayes classifier can become stronger, and how does it work? Does the aggregation method already know the answer or would it be human interaction that corrects the outputs and then those answers go back into the Bayes training data? Or a combination of both? Looking at Bootstrap aggregating it involves having each model in the ensemble vote with equal weight so not quite sure in this particular instance I would use bagging as my aggregation method? Boosting however involves incrementally building an ensemble by training each new model instance to emphasize the training instances that previous models mis-classified, not sure if this would be a better alternative to bagging as im unsure how it incrementally builds upon new instances? And the last one would be Bayesian model averaging which is an ensemble technique that seeks to approximate the Bayes Optimal Classifier by sampling hypotheses from the hypothesis space, and combining them using Bayes' law, however completely unsure how you would sample hypotheses from search space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that usualy you would use a competitive approach to bounce between the two classification algorithms one says yes one says maybe a weighting could be applied and if its correct you get the best of both classifiers but for keep sake I dont want a competitive approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question is using these two methods together in such a way would it be beneficial, i know the example i provided is very primitive and may not apply in that example but can it be beneficial in more complex data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was told this may be a better place to ask this question from Stack overflow, original question: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/9536786/ensemble-learning-multiple-classifier-system&quot;&gt;https://stackoverflow.com/questions/9536786/ensemble-learning-multiple-classifier-system&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1060" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2017-09-04T16:28:51.950" Title="Ensemble learning, multiple classifier system" Tags="|matlab|statistics|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1621" PostTypeId="2" ParentId="1618" CreationDate="2012-03-03T14:24:05.043" Score="4" Body="&lt;p&gt;Window functions have an inherent tradeoff between two of their frequency-domain properties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Main lobe width:&lt;/strong&gt; Any tapered window function will cause some &quot;smearing&quot; in the frequency domain. This is visualized by the width of the center lobe in the window function's frequency response. The wider the main lobe, the more difficult it is to resolve two tones that are close in frequency (if they are closer to one another than the main lobe width, they will tend to smear together). So ideally, you would like to have a window function that has a very narrow main lobe.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Maximum sidelobe height:&lt;/strong&gt; Many window functions have frequency responses that consist of a single main lobe surrounded by repeated sidelobes that decay at some window-specific rate. The height of these sidelobes can make it difficult to resolve two tones that are separated in frequency, but differ greatly in amplitude. So ideally, you would like to have a window function that has very low sidelobes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem: if you decrease the main lobe width of a window function, the sidelobes will grow, and vice versa. So, you need to strike an application-specific balance when choosing a window, based upon the distances in frequency and amplitude that you expect between your signals of interest. Given specific parameters of your system, it's possible to choose a window that (hopefully) meets your requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as choosing the length of your window (which is equivalent to choosing the length of the DFT), you're best served with making your observation as long as possible within the constraints that your application might impose (e.g. latency requirements, how long the signals of interest can be considered stationary, computational resources, etc.). Your ability to resolve in frequency is directly proportional to the observation length (measured in time, not necessarily based on the FFT length, which can be zero-padded with no improvement in frequency resolution).&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-03-03T17:22:43.120" LastActivityDate="2012-03-03T17:22:43.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1622" PostTypeId="2" ParentId="1618" CreationDate="2012-03-03T14:30:05.167" Score="1" Body="&lt;p&gt;The window length should depend on the variation in frequency of your signal. You should adjust a window short enough to appproximately capture a constant spectra of your signal in that window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know until what extent your signal is similar to a shape, you should use a Wavelet Transform (&lt;a href=&quot;http://users.rowan.edu/~polikar/wavelets/wtpart3.html&quot; rel=&quot;nofollow&quot;&gt;CWT&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1051" LastActivityDate="2012-03-03T14:30:05.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1623" PostTypeId="1" CreationDate="2012-03-04T00:23:09.343" Score="4" ViewCount="2627" Body="&lt;p&gt;I am trying to reconstruct an image from gradients in an arbitrary shaped region of an image.  I understand how to implement a discrete 2D poisson solution with Dirchlet boundary conditions. Using &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Poisson_equation#On_a_two-dimensional_rectangular_grid&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Discrete_Poisson_equation#On_a_two-dimensional_rectangular_grid&lt;/a&gt; , you just replace any of the u_i,j that are on the source side of the boundary with the boundary values that you have. However, I don't understand how to implement the Neumann boundary condition. If you want to &quot;match&quot; the external derivative, wouldn't you have to just set the nodes that are on the target side of the boundary to a value that makes the derivative between the source boundary pixel and the target boundary pixel equal the derivative outside the boundary? If you do this, haven't you just simply &quot;filled in&quot; one node around the boundary and provided a slightly smaller version of the Dirchlet problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain this?&lt;/p&gt;&#xA;" OwnerUserId="1032" LastActivityDate="2012-03-07T14:17:58.837" Title="Implementing discrete Poisson equation wtih Neumann boundary condition" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1625" PostTypeId="1" AcceptedAnswerId="1634" CreationDate="2012-03-04T21:47:54.090" Score="14" ViewCount="1661" Body="&lt;p&gt;i hope this is the right place to ask. otherways sorry for my mistake and pleace advice me a better site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i'm trying to implement a super simple skin detector using some range of hsb image. i'm using approach described &lt;a href=&quot;http://www.shervinemami.info/blobs.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.matmidia.mat.puc-rio.br/sibgrapi2009/media/posters/59928.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i'm try to use a video source from my webcam. if i use sun illumination it works quite well (not so good but quite good), but with neon light.. it is a mess. a lot of white region are detected and a lot of noise everywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i'm using the algorithm described in the &lt;a href=&quot;http://www.matmidia.mat.puc-rio.br/sibgrapi2009/media/posters/59928.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;second source&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;convert image ho HSV color space&lt;/li&gt;&#xA;&lt;li&gt;put white on the range 0 &amp;lt; H &amp;lt; 38&lt;/li&gt;&#xA;&lt;li&gt;dilate filter&lt;/li&gt;&#xA;&lt;li&gt;erode filter&lt;/li&gt;&#xA;&lt;li&gt;blur filter&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sFXKx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="1063" LastEditDate="2012-03-04T21:54:37.777" LastActivityDate="2014-10-31T16:12:54.513" Title="basic hsb skin detection, neon illumination" Tags="|image-processing|computer-vision|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1626" PostTypeId="1" AcceptedAnswerId="1632" CreationDate="2012-03-05T05:19:20.817" Score="4" ViewCount="4888" Body="&lt;p&gt;I designed an IIR filter and want to do zero, step and projection initialization.  There is mention in different reference papers but no explicit examples for Matlab.  How do you do IIR initialization, for the previously mentioned types, in Matlab? &lt;/p&gt;&#xA;" OwnerUserId="1046" LastEditorUserId="440" LastEditDate="2012-04-17T08:28:54.100" LastActivityDate="2016-03-10T14:29:56.057" Title="How to initialize an IIR filter in Matlab" Tags="|matlab|filter-design|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1628" PostTypeId="1" AcceptedAnswerId="3513" CreationDate="2012-03-05T08:09:04.243" Score="8" ViewCount="1273" Body="&lt;p&gt;I'm attempting to create a real-time scalogram (from a 1 dimensional signal) in the style of a spectrogram;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking through various papers+books; the Gabor wavelet, or complex Morlet seems to be favoured for keeping a close relation to frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though I was hoping to use a real valued wavelet though due to computational complexity concerns... What wavelet would be recommended?&lt;/p&gt;&#xA;" OwnerUserId="424" LastActivityDate="2012-10-01T21:19:24.653" Title="Which mother wavelet for a scalogram?" Tags="|wavelet|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1629" PostTypeId="2" ParentId="1625" CreationDate="2012-03-05T08:31:21.067" Score="4" Body="&lt;p&gt;Take into account the different values obtained in HSV color when neon light is applied: an example of its deviation is &lt;a href=&quot;http://www.google.es/url?sa=t&amp;amp;rct=j&amp;amp;q=%22neon%20light%22%20hsv%20color%20space&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CDcQFjAB&amp;amp;url=http%3A%2F%2Fwwwmath.uni-muenster.de%2Fu%2Flammers%2FEDU%2Fss03%2FRobotfussball%2FDokumente%2FMayer___02_IROS.pdf&amp;amp;ei=tHZUT_PwEseg8gO5k-TvBQ&amp;amp;usg=AFQjCNGoxn_Is2fzvwtn5R2X-WGkp7t0iQ&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&#xA;Try adapting your algorithm so to it adapt to these values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.google.es/url?sa=t&amp;amp;rct=j&amp;amp;q=adaptive%20technique%20for%20human%20face%20detection%20using%20hsv%20color%20space%20and%20neural%20networks&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CC8QFjAA&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel5%2F5210443%2F5233433%2F05233453.pdf%3Farnumber%3D5233453&amp;amp;ei=BXlUT9GlIISL8gO69onxBQ&amp;amp;usg=AFQjCNEPYYGdNdg8ipoyLmQNBv6k7bHJJA&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; there is another algorithm to detect skin, and for detecting light conditions you can use &lt;a href=&quot;http://www.google.es/url?sa=t&amp;amp;rct=j&amp;amp;q=a%20power%20law%20transformation%20predicting%20lightness%20conditions%20based%20on%20skin%20color%20space%20detection&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCoQFjAA&amp;amp;url=http%3A%2F%2Fsecure3.computer.org%2Fcsdl%2Fproceedings%2Ftrustcom%2F2011%2F4600%2F00%2F4600b472-abs.html&amp;amp;ei=YHlUT4ClDov88QOyk5ybCg&amp;amp;usg=AFQjCNEfmxk7nogdKu7iybnz75XVzEW7nQ&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another algorithm, related to skin detection, but not too much related to neon light effects, is &lt;a href=&quot;http://www.google.es/url?sa=t&amp;amp;rct=j&amp;amp;q=hsv%20color%20space%20and%20face%20detection%20based%20objectionable%20image%20detecting&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCwQFjAA&amp;amp;url=http%3A%2F%2Fdl.acm.org%2Fcitation.cfm%3Fid%3D1524568&amp;amp;ei=jXlUT5KJJYjk8QOg97STDA&amp;amp;usg=AFQjCNHxv7oK-vkEhqulFEjfVBF1670TmQ&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastActivityDate="2012-03-05T08:31:21.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1630" PostTypeId="2" ParentId="1628" CreationDate="2012-03-05T08:37:21.277" Score="3" Body="&lt;p&gt;The mother wavelet of your scalogram should have a similar shape to the usual peak shapes you want to detect (I suppose you use it to detect peaks of your signal).&#xA;However, I would like to ask you what would you like to use wavelets for? I could give you a more specific answer for your question.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastActivityDate="2012-03-05T08:37:21.277" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1631" PostTypeId="1" AcceptedAnswerId="1633" CreationDate="2012-03-05T10:49:47.977" Score="6" ViewCount="1202" Body="&lt;p&gt;I'm looking for a way to estimate instantenous frequency with low time-variation. The following MATLAB function (save as &lt;code&gt;test_fest.m&lt;/code&gt;) does this using the &lt;em&gt;Hilbert&lt;/em&gt; transform on a single 10 Hz sine tone. Sample rate &lt;code&gt;f_s&lt;/code&gt; is 1000 Hz.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function test_fest()&#xA;%TEST_FEST()  Test Frequency Estimation using Various Techniques.&#xA;&#xA;fS = 1000;&#xA;f = [10]';                                  % Sine Wave Frequency&#xA;nFFT = fS;&#xA;x = sin(linspace(zeros(length(f),1), f*2*pi, fS));&#xA;X = hilbert(x,nFFT);&#xA;&#xA;fE = diff(unwrap(angle(X))) * fS / (2*pi); % Frequency Estimate&#xA;eE = mean((fE/f-1).^2); % MSQ Error&#xA;&#xA;plot(fE,'.');&#xA;title(sprintf('Hilbert Transform Instantaneous Frequency Estimation of Sine Wave f=%.2f Hz, f_S=%g Hz, Mean-Square Error:%.2g', f, fS, eE))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output is shown here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xotmh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I, however, get a greater error, &lt;code&gt;2.3e-5&lt;/code&gt;, than I expected. Is there something wrong with my approach?&lt;/p&gt;&#xA;" OwnerUserId="1064" LastActivityDate="2012-03-05T13:18:39.790" Title="Noisy Frequency Estimation using Hilbert Transform" Tags="|frequency|estimators|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1632" PostTypeId="2" ParentId="1626" CreationDate="2012-03-05T13:09:19.583" Score="3" Body="&lt;p&gt;Not easy. The Matlab filter() function implements a general purpose IIR filter and allows you to pass in an initial state. However, they don't publish the exact definition of the state and the algorithm deployed. It seems to be close to a transposed form II filter but with some subtle numerical differences, so the state doesn't quite match. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case it would be better to break this down into second order sections using sosfilter(). However that doesn't allow you to set an initial state. You may have to write your own filter function for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;YOu still can use filter() to some extent. The default is zero initialization. You can also do step initialization by simply running a constant input for a while and collecting the state as an output argument from the filter, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b a] = butter(4,1000*2/44100);&#xA;% create state for a constant input of &quot;1&quot;&#xA;[~,state1] = filter(b,a,ones(1000,1));&#xA;% now filter for a constant of 2 but with a state for &quot;1&quot; input&#xA;ystep = filter(b,a,2*ones(100,1),state1);&#xA;plot(ystep);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not sure about projection initialization, though.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-05T13:09:19.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1633" PostTypeId="2" ParentId="1631" CreationDate="2012-03-05T13:18:39.790" Score="2" Body="&lt;p&gt;Digital Hilbert transform is tricky to do since an ideal Hilbert transformer requires an FIR filter with an impulse response from -infinity to +infinity. Obviously that can't be done, so numerical problems are unavoidable. They tend to be worst at low frequencies so my guess is you'd see a smaller error at, say, 100 Hz. Andrew Duncan's paper &quot;The Analytic Impulse&quot; is thorough analysis of what the digital Hilbert transform can and can't do. See &lt;a href=&quot;http://www.andrewduncan.ws/air/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.andrewduncan.ws/air/index.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some alternative methods of measuring frequency have been discussed here: &lt;a href=&quot;https://dsp.stackexchange.com/questions/1317/is-there-an-algorithm-for-finding-a-frequency-without-dft-or-fft&quot;&gt;Is there an algorithm for finding a frequency without DFT or FFT?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-03-05T13:18:39.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1634" PostTypeId="2" ParentId="1625" CreationDate="2012-03-05T14:40:35.570" Score="10" Body="&lt;p&gt;This actually might work better using a simple generative model in RGB rather than HSV.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get a training image or several training images with some skin.&lt;/li&gt;&#xA;&lt;li&gt;Manually select the skin pixels (e. g. by creating a binary mask)&lt;/li&gt;&#xA;&lt;li&gt;Compute the mean and covariance of the skin tone in RGB (each should be 3-element vectors)&lt;/li&gt;&#xA;&lt;li&gt;For an unknown pixel, compute its Mahalanobis distance from the mean, using the covariance.&lt;/li&gt;&#xA;&lt;li&gt;Classify it as skin if the distance is less than a threshold.&lt;/li&gt;&#xA;&lt;li&gt;Tune the threshold for best performance.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;I don't know if OpenCV has a function to compute covariance, but I can tell you how to do it yourself. Let's say you have $n$ RGB pixels.  You put them into an $n$ x 3 matrix, let's call it $P$.  Then compute $m$, which is the mean RGB vector by calculating the average of the columns.  $m$ will be a 1 x 3 vector. Subtract $m$ from every row of $P$ and call the resulting matrix $Q$.  Now to compute covariance, all you have to do is multiply $Q$ by the transpose of itself: $C = Q&amp;#39;Q$. Make sure that $C$ is 3 x 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit2:&lt;/strong&gt;&#xA;The values you are getting seem to be too large.  To get the maximum covariance create the following matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;255 255 255&#xA; 0   0   0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and compute covariance of that.  You should get a matrix where every value is approximately&#xA;32513.  So make sure that your pixel values range from 0 to 255, and make sure you copy them into floats or doubles correctly.  The Mahalanobis distance is in the units of variance, so for that the numbers should be small.  Your threshold for skin classification should probably be less than 4.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2012-03-22T13:31:11.397" LastActivityDate="2012-03-22T13:31:11.397" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1635" PostTypeId="2" ParentId="1618" CreationDate="2012-03-05T15:07:39.887" Score="1" Body="&lt;p&gt;For what it's worth, from a practical stand point, I found that Kaiser windows are quite useful. There is a single parameter that allows you to dial in the main lobe width vs. side lobe attenuation and in regards to most metrics a properly tweaked Kaiser window is as good or better than any of its cousins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a (very unscientific) rule of thumb you can determine the &quot;beta&quot; parameter as 0.133 times the desired side lobe attenuation in dB. This can be used to get a quick starting point and tweak from there.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-05T15:07:39.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1637" PostTypeId="1" AcceptedAnswerId="1644" CreationDate="2012-03-06T04:16:59.280" Score="131" ViewCount="87577" Body="&lt;p&gt;I was just learning about the frequency domain in images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can understand the frequency spectrum in case of waves. It denotes what frequencies are present in a wave. If we draw the frequency spectrum of $\cos(2\pi f t)$, we get an impulse signal at $-f$ and $+f$. And we can use corresponding filters to extract particular information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what does frequency spectrum means in case of images? When we take the FFT of a image in OpenCV, we get a weird picture. What does this image denote? And what is its application?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read some books, but they give a lot of mathematical equations rather than the physical implication. So can anyone provide a simple explanation of the frequency domain in images with a simple application of it in image processing?&lt;/p&gt;&#xA;" OwnerUserId="818" LastEditorUserId="8202" LastEditDate="2014-06-10T07:23:26.593" LastActivityDate="2018-12-13T07:52:20.463" Title="What does frequency domain denote in case of images?" Tags="|image-processing|frequency-spectrum|dft|" AnswerCount="5" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1640" PostTypeId="1" CreationDate="2012-03-06T08:43:46.697" Score="8" ViewCount="678" Body="&lt;p&gt;Conceptually when we want to represent a peroidic series, for example a pulse train, we find the Fourier coefficients and get a representation in the time domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However what is conceptually wrong with using say an infinite sum of time shifted rect functions to represent it? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Sorry I had a formatting problem, so i am putting this in the bottom post...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My method is as such:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming we have a periodic pulse $x(t)$ such that $x(t) = 1$ for $0 &amp;lt; t&amp;lt; T$ and $0$ for $T &amp;lt; t &amp;lt; T_p$; thus $x(t)$ has a period of $T_p$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding the fourier coefficients Ck via:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Ck = \frac{1}{T_p} \int_{-\infty}^{\infty} x(t) * e^\tfrac{-j2\pi kt}{T_p}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;over 1 period, and thus we can represent x(t) as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum_k C_k e^\tfrac{j2\pi kt}{T_p}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and doing the Fourier transform we will get this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f) = \sum_k C_k \delta(f-kf_p)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is discrete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if we consider $x(t)$ to be of this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum_n \text{rect} \left(\frac{t-nT_p}{T} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying fourier transform of $x(t)$ to get (in the form):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f) = \sum \text{sinc} * e^{-j*W}$$ -- (2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where sinc() is due to the FT of rect and the e^(-j*W) comes out due to the time shifting property of FT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing X(f) in (1) and (2), we see that 1 is discrete and the other continuous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However they come from the same x(t), so isn't this a contradiction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long post.&lt;/p&gt;&#xA;" OwnerUserId="1069" LastEditorUserId="6" LastEditDate="2012-03-30T19:37:46.227" LastActivityDate="2021-11-04T15:58:09.757" Title="Fourier series representation" Tags="|homework|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1641" PostTypeId="2" ParentId="1640" CreationDate="2012-03-06T10:30:52.503" Score="4" Body="&lt;p&gt;&lt;strong&gt;The main reason for that is that series of cosines and sines form an orthogonal basis.&lt;/strong&gt; Then, you can use it to represent it in other &quot;space&quot; (frequency &quot;space&quot;, for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other things, just to understand other things related to Fourier series and Tranform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sine or cosine is just 2 delta functions in frequency representation (Fourier Transform). A rect function, have a sync function representation (that stricly fills all sprectra). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, using Fourier representation in frequency, you can easily interpret what are the frequency components of your signal and filter it accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to better understand the use of Fourier coefficients, is to understand the relation between the Fourier transform and those coefficients (&lt;a href=&quot;http://www.ch.ic.ac.uk/harrison/Teaching/ft.pdf&quot; rel=&quot;nofollow&quot;&gt;Explanation1&lt;/a&gt;, &lt;a href=&quot;http://www.engr.uconn.edu/~lanbo/G377FFTYC.pdf&quot; rel=&quot;nofollow&quot;&gt;Explanation2&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use Fourier series for &lt;strong&gt;periodic&lt;/strong&gt; functions, and Fourier Transform for everything.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastEditorUserId="1051" LastEditDate="2012-03-06T10:51:18.500" LastActivityDate="2012-03-06T10:51:18.500" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1642" PostTypeId="2" ParentId="1288" CreationDate="2012-03-06T11:37:24.777" Score="75" Body="&lt;p&gt;Both SIFT and SURF authors require license fees for usage of their original algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done some research about the situation and here are the possible alternatives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keypoint detector:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Harris corner detector&lt;/li&gt;&#xA;&lt;li&gt;Harris-Laplace - scale-invariant version of Harris detector (an affine invariant version also exists, presented by Mikolajczyk and Schmidt, and I believe is also patent free).&lt;/li&gt;&#xA;&lt;li&gt;Multi-Scale Oriented Patches (MOPs) - athough it is patented, the detector is basically the multi-scale Harris, so there would be no problems with that (the descriptor is 2D wavelet-transformed image patch)&lt;/li&gt;&#xA;&lt;li&gt;LoG filter - since the patented SIFT uses DoG (Difference of Gaussian) approximation of LoG (Laplacian of Gaussian) to localize interest points in scale, LoG alone can be used in modified, patent-free algorithm, tough the implementation could run a little slower&lt;/li&gt;&#xA;&lt;li&gt;FAST&lt;/li&gt;&#xA;&lt;li&gt;BRISK (includes a descriptor)&lt;/li&gt;&#xA;&lt;li&gt;ORB (includes a descriptor)&lt;/li&gt;&#xA;&lt;li&gt;KAZE - free to use, M-SURF descriptor (modified for KAZE's nonlinear scale space), outperforms both SIFT and SURF&lt;/li&gt;&#xA;&lt;li&gt;A-KAZE - accelerated version of KAZE, free to use, M-LDB descriptor (modified fast binary descriptor)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Keypoint descriptor:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Normalized gradient - simple, working solution&lt;/li&gt;&#xA;&lt;li&gt;PCA transformed image patch&lt;/li&gt;&#xA;&lt;li&gt;Wavelet transformed image patch - details are given in MOPs paper, but can be implemented differently to avoid the patent issue (e.g. using different wavelet basis or different indexing scheme)&lt;/li&gt;&#xA;&lt;li&gt;Histogram of oriented gradients&lt;/li&gt;&#xA;&lt;li&gt;GLOH&lt;/li&gt;&#xA;&lt;li&gt;LESH&lt;/li&gt;&#xA;&lt;li&gt;BRISK&lt;/li&gt;&#xA;&lt;li&gt;ORB&lt;/li&gt;&#xA;&lt;li&gt;FREAK&lt;/li&gt;&#xA;&lt;li&gt;LDB&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that if you assign orientation to the interest point and rotate the image patch accordingly, you get rotational invariance for free. Even Harris corners are rotationally invariant and the descriptor may be made so as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more complete solution is done in Hugin, because they also struggled to have a patent-free interest point detector.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2016-08-30T17:16:35.737" LastActivityDate="2016-08-30T17:16:35.737" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1643" PostTypeId="1" AcceptedAnswerId="1649" CreationDate="2012-03-06T11:45:14.783" Score="5" ViewCount="642" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1288/free-alternatives-to-sift-surf-for-commercial-use&quot;&gt;Free alternatives to SIFT/SURF for commercial use&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;There are same very good algorithms for interest point detection/description, like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SIFT (Scale-Invariant Feature Transform)&lt;/li&gt;&#xA;&lt;li&gt;SURF (Speeded-Up Robust Features)&lt;/li&gt;&#xA;&lt;li&gt;MOPs (Multi-Scale Oriented Patches)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Regrettably, at least the first two are patented and cannot be used commercially without paying huge fees to the authors. I am currently negotiating about the third one, which is patented as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a search for patent-free algorithm, I found there is a multitude of patents like &lt;a href=&quot;http://www.faqs.org/patents/app/20080267506#b&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;. Huh?! Is there merely anything usable then?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe at least Harris-Laplace or some basic detector can be used. But how to be sure?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-03-06T14:39:21.557" Title="Patent-free Interest Point Detector?" Tags="|local-features|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ClosedDate="2012-03-23T04:33:35.247" ContentLicense="CC BY-SA 3.0" />
  <row Id="1644" PostTypeId="2" ParentId="1637" CreationDate="2012-03-06T11:47:00.537" Score="108" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;But what does frequency spectrum means in case of images?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &quot;mathematical equations&quot; are important, so don't skip them entirely. But the 2d FFT has an intuitive interpretation, too. For illustration, I've calculated the inverse FFT of a few sample images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BnnvM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, only one pixel is set in the frequency domain. The result in the image domain (I've only displayed the real part) is a &quot;rotated cosine pattern&quot; (the imaginary part would be the corresponding sine).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I set a different pixel in the frequency domain (at the left border):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3NAqj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get a different 2d frequency pattern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I set more than one pixel in the frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4rVHx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you get the sum of two cosines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So like a 1d wave, that can be represented as a sum of sines and cosines, any 2d image can be represented (loosely speaking) as a sum of &quot;rotated sines and cosines&quot;, as shown above. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;when we take fft of a image in opencv, we get weird picture. What does this image denote?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It denotes the amplitudes and frequencies of the sines/cosines that, when added up, will give you the original image.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And what is its application?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are really too many to name them all. Correlation and convolution can be calculated very efficiently using an FFT, but that's more of an optimization, you don't &quot;look&quot; at the FFT result for that. It's used for image compression, because the high frequency components are usually just noise. &lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-03-06T11:47:00.537" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1645" PostTypeId="1" AcceptedAnswerId="1650" CreationDate="2012-03-06T12:42:04.057" Score="13" ViewCount="12252" Body="&lt;p&gt;I am trying an offline LPC analysis and synthesis using the rt_lpc (real-time LPC) implementation as given &lt;a href=&quot;http://soundlab.cs.princeton.edu/software/rt_lpc/&quot;&gt;here&lt;/a&gt;. There are some functions within the program that can be used for an offline LPC analysis and synthesis program. The rt_lpc code is mostly meant for composers etc., which means that it uses a MIDI or glottal pulse input. There is some code in the program that converts a pitch value (obtained from auto-correlation) to the &lt;code&gt;bend&lt;/code&gt; value. The relation is given as follows:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    pitch = (int)( Stk::sampleRate() / midi2pitch[ananya.data[1]] ) /&#xA;                            pow( 1.0653f, bend/64.0f*11.0f );&#xA;                    power *= ananya.data[2] / 64.0f;&#xA;bend = ge.data[1] / 128.0f + ge.data[2] - 64;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some points:&lt;br&gt;&#xA;a. &lt;code&gt;ananya&lt;/code&gt; is an object of type &lt;code&gt;MidiMsg&lt;/code&gt; that seems to be populated on the fly.&lt;br&gt;&#xA;b. &lt;code&gt;ge&lt;/code&gt; is also an object of type &lt;code&gt;MidiMsg&lt;/code&gt; that also seems to be populated on the fly.&lt;br&gt;&#xA;c. These two objects are created when the program is run in real-time (mine is an offline version that runs selective parts of it in a main.cpp of my own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question(s):&lt;br&gt;&#xA;1. What is pitch bend?&lt;br&gt;&#xA;2. How do I convert a pitch value into a bend value? What are the mapping relations?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have googled for solutions but found no clear answer.&lt;/p&gt;&#xA;" OwnerUserId="102" LastActivityDate="2012-03-06T14:46:35.993" Title="Converting a pitch bend (MIDI) value to a &quot;normal&quot; pitch value" Tags="|music|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1646" PostTypeId="2" ParentId="1637" CreationDate="2012-03-06T13:14:00.777" Score="13" Body="&lt;p&gt;The wave $f(t)=cos (ωt)$ is a one-dimensional wave; it depends only on $t$. The wave $f(x,y)=cos(ωx+ψy)$ is a two-dimensional wave. It depends on $x$ and $y$. As you see, you have two frequencies, in either direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the fourier transform (FFT) of $cos(ωx+ψy)$ will give you $ω,ψ$, just like the FFT of $cos(ωx)$ gives you $ω$. And if your input is a function summing 2D cosines, then your 2D FFT will be the sum of the frequencies of those cosines - again a direct analog of the 1D FFT.&lt;/p&gt;&#xA;" OwnerUserId="21" LastEditorUserId="18923" LastEditDate="2016-01-01T15:42:39.147" LastActivityDate="2016-01-01T15:42:39.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1647" PostTypeId="2" ParentId="1640" CreationDate="2012-03-06T13:34:52.530" Score="0" Body="&lt;p&gt;Sorry I had a formatting problem, so I am putting this in the bottom post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My method is as such:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming we have a periodic pulse $x(t)$ such that $x(t) = 1$ for $0 &amp;lt; t&amp;lt; T$ and $0$ for $T &amp;lt; t &amp;lt; Tp$; thus $x(t)$ has a period of $Tp$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding the fourier coefficients $Ck$ via:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Ck = 1/Tp \int^T ( x(t) * e^{(-j*2*pi*k*t/Tp)})$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and thus we can represent $x(t)$ as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum (Ck * e^{(j*2*pi*k*t/Tp)})$$ over all int k&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and doing the fourier transform we will get this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f) = \sum (Ck * \delta(f-kfp))$$ over all int k  -- (1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is discrete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if we consider x(t) to be of this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum(rect[(t-nTp)/T])$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying fourier transform of x(t) to get (in the form):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f) = \sum[ sinc * e^(-j*W) ]$$ -- (2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where sinc() is due to the FT of rect and the $e^{(-j*W)}$ comes out due to the time shifting property of FT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing $X(f)$ in (1) and (2), we see that 1 is discrete and the other continuous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However they come from the same $x(t)$, so isn't this a contradiction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long post.&lt;/p&gt;&#xA;" OwnerUserId="1070" LastEditorUserId="1473" LastEditDate="2012-06-08T07:49:03.943" LastActivityDate="2012-06-08T07:49:03.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1648" PostTypeId="2" ParentId="1645" CreationDate="2012-03-06T13:51:09.960" Score="7" Body="&lt;p&gt;MIDI is a protocol that allows (primarily) synthesizers to control or be controlled by other synthesizers or computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a serial protocol that allows to exchange messages such as &quot;key C1 up&quot; &quot;key D4 down&quot; &quot;key velocity, &quot;sound change&quot;, etc. Many controllers have a &quot;pitch wheel&quot; that's a joystick or am modulation wheel. These allow the player to interactively change the pitch of the current note being played to manually create vibrato or to continuously &quot;slide&quot; from one note to the next. As this frequently done by guitar players by bending the fretted string with their left hand, it's often called pitch bending and hence the name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MIDI pitch bend message is a way to communicate how much pitch shifting is supposed to happen at any given point in time. A synthesizer (software or hardware) receiving a pitch bend message is supposed to change the pitch of all current notes being played by the given amount. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controller message has an argument that goes from -8192 to 8191 and in standard MIDI files this is supposed to cover the range from -200 cent to 200 cent, where 1 cent is 1/100 of semitone, i.e. a ratio of 2^(1/1200) = 1.000577789506555. Example: to create a pitch shift downward to get to 93% of the nominal frequency, the controller value would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = round(log2(.93)*12*8192/2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or -5146 in this case. 0.93 is the ratio you want, 12 the number of semitones per octave, 2 the max pitch bend range (200 cent or 2 semitones in this case), and log2() the logarithm with basis 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in most synthesizers the range is configurable and it's probably not a good idea to assume that all synthesizers behave the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a conversion chart that may help.&#xA;&lt;a href=&quot;http://www.elvenminstrel.com/music/tuning/reference/pitchbends.shtml&quot;&gt;http://www.elvenminstrel.com/music/tuning/reference/pitchbends.shtml&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-06T13:51:09.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1649" PostTypeId="2" ParentId="1643" CreationDate="2012-03-06T14:39:21.557" Score="4" Body="&lt;p&gt;(IANAL...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only want detectors:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Harris is probably OK.&lt;/li&gt;&#xA;&lt;li&gt;According to &lt;a href=&quot;http://users.fmrib.ox.ac.uk/~steve/susan/&quot; rel=&quot;nofollow&quot;&gt;http://users.fmrib.ox.ac.uk/~steve/susan/&lt;/a&gt;, SUSAN is out of patent now.&lt;/li&gt;&#xA;&lt;li&gt;I've not seen any claims that &lt;a href=&quot;http://www.edwardrosten.com/work/fast.html&quot; rel=&quot;nofollow&quot;&gt;FAST&lt;/a&gt; is patented.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Descriptors are harder... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients&quot; rel=&quot;nofollow&quot;&gt;Histograms of Oriented Gradients&lt;/a&gt; might be worth considering - again I've not seen any claims of patent on the original form.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2012-03-06T14:39:21.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1650" PostTypeId="2" ParentId="1645" CreationDate="2012-03-06T14:46:35.993" Score="14" Body="&lt;p&gt;At the core of MIDI is a representation of music as discrete note events, each of those having a static pitch. This is perfect for representing music as played on keyboard instruments. You can convert any frequency corresponding to a note on the tempered scale into a MIDI note number, using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$69 + 12 \times \log_2 \frac{frequency}{440}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under the assumption that the MIDI receiver is calibrated for A4 = 440 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This representation is alright for piano music, but the problem is how to represent pitches which are not mapped to the tempered scale (non-western music, non musical sounds), and how to represent pitch variations over the duration of a note (glissando, vibrato).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is done in MIDI by using &quot;pitch bend messages&quot; which instruct the synthesizer to shift the pitch of the currently played note by a small interval. Most synthesizers are calibrated by default for +/- 2 semitones over the course of the pitch bend message range (0 .. 16383). 8192 corresponds to no pitch bending - the emitted pitch is exactly that of the note value. The mapping between the pitch bend value and the frequency shifting ratio is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{f_{emitted\_note}}{f_{note\_message}} = 2 ^ {\frac{pitchbend - 8192}{4096 \times 12}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can thus get the frequency of a note played by a syntheszier from the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$440 \times 2^{\frac{note - 69}{12.0} + \frac{pitchbend - 8192}{4096 \times 12}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;em&gt;note&lt;/em&gt; is the 7-bits MIDI note number of the last received &lt;em&gt;Note On&lt;/em&gt; message ; and &lt;em&gt;pitchbend&lt;/em&gt; is the 14-bits value of the last received &lt;em&gt;Pitch bend&lt;/em&gt; message. A synthesizer starts with its pitch bend register set to 8192, and this value is also reset during the reception of a &quot;Reset all controllers&quot; message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us take the following example. You want to express a flute trill with the following frequency trajectory: 500 Hz, 510 Hz, 500 Hz, as MIDI messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The base note number is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$round(69 + 12 \times \log_2(500 / 440)) = 71$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you send a &quot;note on&quot; message with note# equal to 71. This is equivalent to a pitch of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$440 \times 2 ^ {(71 - 69) / 12} = 493.88$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the nearest pitch on the tempered scale. You need to send a pitch bend message to raise the pitch by a factor of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{500}{493.88} = 1.0124$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And get your 500 Hz. The corresponding pitch bend value is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$round(8192 + 4096 \times 12 \times log_2 1.0124) = 9065$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get your 510 Hz, the pitch bend value would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$round(8192 + 4096 \times 12 \times log_2 \frac{510}{493.88}) = 10469$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your sequence of MIDI messages for 500, 510, 500 Hz would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;NOTE 71&lt;/li&gt;&#xA;&lt;li&gt;PITCH BEND 9065&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;li&gt;PITCH BEND 10469&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;li&gt;PITCH BEND 9065&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can think of the MIDI note number as the &quot;integral&quot; part of the pitch ; and the pitch bend as a redundant &quot;fractional&quot; part of the pitch.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-03-06T14:46:35.993" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1653" PostTypeId="2" ParentId="1637" CreationDate="2012-03-07T03:14:33.197" Score="8" Body="&lt;p&gt;In images increasing frequency is associated with more abrupt transitions in brightness or color. Furthermore, noise is usually embedded in the high end of the spectrum, so low-pass filtering can be used for noise reduction.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-03-07T03:14:33.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1654" PostTypeId="1" AcceptedAnswerId="1665" CreationDate="2012-03-07T08:29:17.983" Score="6" ViewCount="12252" Body="&lt;p&gt;This question is about SNR in the context of &lt;a href=&quot;http://neurocog.psy.tufts.edu/images/erp.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;EEG&lt;/a&gt;. (a related question &lt;a href=&quot;https://dsp.stackexchange.com/q/515/685&quot;&gt; about SNR&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in calculating The SNR of an &lt;a href=&quot;http://en.wikipedia.org/wiki/Event-related_potential&quot; rel=&quot;nofollow noreferrer&quot;&gt;ERP&lt;/a&gt;. My motivation is: To calculate the &quot;signal-to-noise ratio&quot; and from this to extract the information (how?) on how many trials are needed to construct a stable ERP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;my Main question is:&lt;/strong&gt; how do I calculate and SNR for such scenario  ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;some more explation about EEG and ERP are enclosed:&#xA;EEG:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The on-going electrical activity of the brain measured from scalp electrodes is called the electroencephalogram or EEG.  within the EEG is a signal which is more revealing about information processing in the brain. This signal can be obtained by time-locking the recording of the EEG to the onset of events such as a person reading a word on a computer screen, listening to a musical note played on an instrument, or viewing a picture in a magazine. The resulting activity is called an &quot;event-related potential&quot; (ERP)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;SNR:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The number of trials necessary to obtain an ERP depends on a number of factors, the most important being the &quot;signal-to-noise ratio&quot;, that is, the relative size of the signal (the ERP) relative to the size of the noise (the background EEG). In cognitive experiments 30 to 50 stimulus presentations are typically required to obtain a good clean average ERP.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;from: &lt;a href=&quot;http://neurocog.psy.tufts.edu/images/erp.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://neurocog.psy.tufts.edu/images/erp.htm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="685" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2021-01-27T03:28:00.290" Title="Howto calculate SNR for EEG data?" Tags="|noise|eeg|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1655" PostTypeId="2" ParentId="1623" CreationDate="2012-03-07T13:08:49.807" Score="2" Body="&lt;p&gt;For image in painting and blending a pixel its new value is dependent on its neighboring pixels. These neighbors may or may not lie on a border. The aim is to interpolate and create smooth transitions. It is thus not only dependent on a border condition, nor does a value on the border get replicated exactly to inside pixels.  Should the area between boundaries be exactly 1 pixel wide, this pixel will most likely be the average of the boundary values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple blender algorithm will work like this. Given:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A background image $\textbf{b}$&lt;/li&gt;&#xA;&lt;li&gt;A foreground image $\textbf{f}$&lt;/li&gt;&#xA;&lt;li&gt;A mask $\textbf{m}$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where we will put the foreground image $\textbf{f}$ onto the background $\textbf{g}$, where the mask $\textbf{m}$ is true. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid a visible seam we will make a correction image $\textbf{c}$. The run-of-the-mill patching to form new image $\textbf{g}$ then is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$g(x, y) = \left \{\begin{array}{cc}&#xD;&#xA;		b(x, y) &amp;amp; \textrm{if } m(x, y) = 0 \\&#xD;&#xA;		f(x, y) + c(x, y) &amp;amp; \textrm{if } m(x, y) = 1&#xD;&#xA;	\end{array} \right .$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image $\textbf{c}$ is obviously some form of interpolation, but informally we want two things from $\textbf{c}$:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\textbf{f}$+$\textbf{c}$ and $\textbf{b}$ should match on the edges&lt;/li&gt;&#xA;&lt;li&gt;It should be 'smooth' as to not create disturbances&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Smooth transitions can be attained by simply stipulating that a pixel its new value is the weighted average of its four neighbors (up, down, left and right):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c(x,y) = \frac{c(x-1, y)+c(x+1, y)+c(x, y-1)+c(x-1, y+1)}{4}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for boundary pixels the corresponding values of $\textbf{c}$ are replaced by $\textbf{b}-\textbf{f}$. If for instance for $c(x,y)$ the right neighbour is on de boundary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c(x,y) = \frac{c(x-1, y)+c(x+1, y)+c(x, y-1)+(b(x-1, y+1)-f(x-1, y+1))}{4}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that $\textbf{every}$ pixel of $\textbf{f}$ under mask $\textbf{m}$ gives a linear equation, and each pixel in the patch is also a variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is a square linear system:  $\textbf{A}\textbf{c} = \textbf{d}$, which can be solved for  $\textbf{c}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For boundary pixels, the values of $\textbf{b}$ and $\textbf{f}$ are $\textbf{constants}$ in this system, not variables. They thus go `to the right' of the equals sign.&lt;/li&gt;&#xA;&lt;li&gt;Pixels outside the masked region, as defined by $\textbf{m}$ are not variables.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;See also&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;J. Jia, J. Sun, C.K. Tang, and H.Y. Shum. Drag-and-drop pasting. In ACM&#xA;Transactions on Graphics (TOG), volume 25, pages 631-637. ACM, 2006.&lt;/li&gt;&#xA;&lt;li&gt;P. Perez, M. Gangnet, and A. Blake. Poisson image editing. In ACM&#xA;Transactions on Graphics (TOG), volume 22, pages 313-318. ACM, 2003.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="420" LastEditorUserId="420" LastEditDate="2012-03-07T14:17:58.837" LastActivityDate="2012-03-07T14:17:58.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1656" PostTypeId="1" CreationDate="2012-03-07T15:45:28.703" Score="2" ViewCount="21961" Body="&lt;p&gt;I wish the compute the frequency distribution of a set of images. I basically am keen on finding out how the the frequency varies in the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can use the 'fft2' function to compute the 2-dimensional Fourier Transform. I can do this for each image. But I am not sure how to obtain the isotropic frequency distribution of all the images. I want to find a method to compare the frequency distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to go about this problem? Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="1074" LastActivityDate="2013-05-18T12:40:07.940" Title="Frequency spectrum of a set of images in Matlab" Tags="|image-processing|matlab|fft|frequency-spectrum|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1657" PostTypeId="1" AcceptedAnswerId="1658" CreationDate="2012-03-07T17:07:24.160" Score="9" ViewCount="10926" Body="&lt;p&gt;Given a screenshot of an application, is there any way of finding GUI elements of that application using only opencv? (something like in the image)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cQcZC.png&quot; alt=&quot;Desired Outlook image after element detection&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to play with blending the image and other effects from the coherence.py sample in the opencv installation folder. Did not succeed to get a viable result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone did this? Do you have any idea what I might try? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'm new to opencv and image processing so please don't avoid obvious explanations if possible) :)&lt;/p&gt;&#xA;" OwnerUserId="1066" LastActivityDate="2012-03-07T17:40:46.137" Title="How can I detect elements of GUI using opencv?" Tags="|image-processing|edge-detection|opencv|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1658" PostTypeId="2" ParentId="1657" CreationDate="2012-03-07T17:40:46.137" Score="10" Body="&lt;p&gt;OpenCV's &lt;a href=&quot;http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions&quot;&gt;MSER&lt;/a&gt; extractor (&lt;a href=&quot;http://opencv.willowgarage.com/documentation/cpp/feature_detection.html#mser&quot;&gt;documented here&lt;/a&gt;) might be helpful — the bounding box of local MSER groups would pretty closely match the green rectangles in your mockup.&lt;/p&gt;&#xA;" OwnerUserId="70" LastActivityDate="2012-03-07T17:40:46.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1659" PostTypeId="1" CreationDate="2012-03-07T08:13:07.820" Score="11" ViewCount="25180" Body="&lt;p&gt;I need to segment liver from an abdominal CT image using Adaptive Thresholding. But I get the entire foreground separated from the background alone. I need only the liver part of the foreground separated. &#xA;Check out the pdf file in &lt;a href=&quot;http://www.ijcaonline.org/casct/number1/SPE34T.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://www.ijcaonline.org/casct/number1/SPE34T.pdf&lt;/a&gt;&#xA;I need an output similar to that shown in Figure 6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I attach my coding here. Kindly help me out.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%testadaptivethresh.m&#xA;clear;close all;&#xA;im1=imread('nfliver2.jpg');&#xA;bwim1=adaptivethreshold(im1,11,0.03,0);&#xA;figure,imshow(im1);&#xA;figure,imshow(bwim1);&#xA;imwrite(bwim1,'at2.jpg');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function bw=adaptivethreshold(IM,ws,C,tm)&#xA;%ADAPTIVETHRESHOLD An adaptive thresholding algorithm that seperates the&#xA;%foreground from the background with nonuniform illumination.&#xA;%  bw=adaptivethreshold(IM,ws,C) outputs a binary image bw with the local &#xA;%   threshold mean-C or median-C to the image IM.&#xA;%  ws is the local window size.&#xA;%  tm is 0 or 1, a switch between mean and median. tm=0 mean(default); tm=1 median.&#xA;%&#xA;%  Contributed by Guanglei Xiong (xgl99@mails.tsinghua.edu.cn)&#xA;%  at Tsinghua University, Beijing, China.&#xA;%&#xA;%  For more information, please see&#xA;%  http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm&#xA;&#xA;if (nargin&amp;lt;3)&#xA;    error('You must provide the image IM, the window size ws, and C.');&#xA;elseif (nargin==3)&#xA;    tm=0;&#xA;elseif (tm~=0 &amp;amp;&amp;amp; tm~=1)&#xA;    error('tm must be 0 or 1.');&#xA;end&#xA;&#xA;IM=mat2gray(IM);&#xA;&#xA;if tm==0&#xA;    mIM=imfilter(IM,fspecial('average',ws),'replicate');&#xA;else&#xA;    mIM=medfilt2(IM,[ws ws]);&#xA;end&#xA;sIM=mIM-IM-C;&#xA;bw=im2bw(sIM,0);&#xA;bw=imcomplement(bw);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QbUwc.gif&quot; alt=&quot;Original Image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BS1ST.gif&quot; alt=&quot;After Segmentation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My modified code for testadaptivethresh.m&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear;&#xA;im=imread('nfliver7.gif');&#xA;figure,imshow(im)&#xA;bwim1=adaptivethreshold(im,300,-0.15,0);&#xA;bw=bwareaopen(bwim1,3000);&#xA;se=strel('diamond',4);&#xA;er=imerode(bw,se);&#xA;bw1=bwareaopen(er,3000);&#xA;er1=imerode(bw1,se);&#xA;bw2=bwareaopen(er1,1000);&#xA;fi=imfill(bw2,'holes');&#xA;figure,imshow(fi)&#xA;&#xA;op=uint8(fi);&#xA;seg=im.*op;&#xA;figure,imshow(seg)&#xA;imwrite(seg,'sliver7.jpg');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1094" OwnerDisplayName="Gomathi" LastEditorUserId="1094" LastEditDate="2012-03-13T11:41:10.123" LastActivityDate="2016-10-03T17:16:30.643" Title="Adaptive Thresholding for liver segmentation using Matlab" Tags="|matlab|image-processing|computer-vision|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1660" PostTypeId="1" AcceptedAnswerId="1664" CreationDate="2012-03-08T01:40:42.807" Score="4" ViewCount="4756" Body="&lt;p&gt;I am filtering an audio signal into various sub-bands in C and would like to decimate the signal by 2 in the lower frequency bands to reduce processing overhead. I get that this involves low-pass filtering the signal and then throwing away every other sample, but how do I go about designing the low-pass filter optimally? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I have a signal sampled at 44.1 kHz. Say that for signals in bands limited below 8 kHz, I low-pass filter with a 2nd order butterworth filter with a cutoff of 9 kHz and then decimate. This works fine as I filter well below the new Nyquist limit of 44100/4, but it feels very unscientific. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best filter type for this purpose. Looking at the matlab documentation, the decimate function uses an 8th order Cheby Type 1 filter by default, but I have no idea why. Is there some rule-of-thumb that I'm missing? &lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-03-08T13:35:11.580" Title="Design of the low pass filter when decimating" Tags="|matlab|decimation|c|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1661" PostTypeId="2" ParentId="1660" CreationDate="2012-03-08T07:50:53.127" Score="3" Body="&lt;p&gt;Every type of filter has its characteristics. For instance, Butterworth filter needs a higher order than Chevyshev, which implies that it is likely that it would computationally cost more.  Other characteristics, such as the ripple in the stop filter (which implies different attenuation in those bands), the phase distortions in both stop and pass bands, filter complexity, etc. may influence your choice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I would make it clear what the limits for all of these parameters (prioritized or weighted parameters) would be before I try to choose any kind of filter. Then, I would design several of them (of many kinds) complying with those limits and compare the filters using those parameters. &lt;strong&gt;To choose one of two or more filters like, I assign a weight or priority to each characteristic of the above, weigh each filter by its nature, and see which one wins.&lt;/strong&gt; That is a scientific method.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastActivityDate="2012-03-08T07:50:53.127" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1662" PostTypeId="1" CreationDate="2012-03-08T09:31:50.053" Score="4" ViewCount="799" Body="&lt;p&gt;This &lt;a href=&quot;http://www.youtube.com/watch?v=1M8ciWSgc_k&amp;amp;feature=related&quot; rel=&quot;nofollow&quot;&gt;YouTube video&lt;/a&gt; shows a very interesting effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the underlying science?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have recently started studying Fourier theory and DSP, and and trying to understand what is going on in terms of the material I've been learning.  I would like to understand this from as many angles as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, at 0:39 the signal forms two lines moving against one another,  and shortly before that I can clearly see two sine waves in the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This reminds me of the illustrations at &lt;a href=&quot;http://www.dspguide.com/ch3/2.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch3/2.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS  not quite sure how to tag this&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="6" LastEditDate="2012-03-08T14:19:29.190" LastActivityDate="2012-03-08T15:10:21.347" Title="Mathematics / Signal theory behind billiard ball 'wave pendulum' effect" Tags="|fourier|decomposition|wave|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1663" PostTypeId="2" ParentId="1662" CreationDate="2012-03-08T13:24:00.823" Score="9" Body="&lt;p&gt;As was pointed out in a comment above, this is a simple consequence of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pendulum_%28mathematics%29&quot; rel=&quot;noreferrer&quot;&gt;dynamics of a pendulum&lt;/a&gt;. There's nothing particularly signal-processing-related about this problem, just some simple physics and trigonometry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a pendulum that is displaced from its angular equilibrium point by an angle of $\theta_0$ with an angular velocity of $\omega_0 = 0$ at $t = 0$, for small initial angles, the motion of the pendulum can be approximated by &lt;a href=&quot;http://en.wikipedia.org/wiki/Simple_harmonic_motion&quot; rel=&quot;noreferrer&quot;&gt;simple harmonic motion&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\theta(t) = \theta_0 \cos\left(\sqrt{\frac{g}{l}}t\right)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $g$ is the magnitude of the force of gravity and $l$ is the length of the pendulum. In the video, a number of pendulums of varying lengths are given an approximately equal initial displacement $\theta_0$ and released simultaneously. Once they are released, each pendulum traces out a path whose displacement angle is a sinusoid with frequency related to the pendulum's length. The lengths were carefully chosen to give the interesting visual effect that you see in the video; the frequencies of the sinusoids are multiples of some fundamental frequency, so for particular values of $t$, they line up in interesting ways. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll notice toward the end, all of the balls &quot;line up&quot; again; this is because each of the sinusoids that describe their motion have moved through an integer number of periods, so the balls are back at a common angular displacement. If there were no effects of friction, air resistance, etc., the oscillation would continue, with the same patterns repeating indefinitely.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-03-08T15:10:21.347" LastActivityDate="2012-03-08T15:10:21.347" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1664" PostTypeId="2" ParentId="1660" CreationDate="2012-03-08T13:35:11.580" Score="6" Body="&lt;p&gt;You can determine the &quot;best&quot; filter by analyzing what type of errors is created and how much of each error your specific application can live with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your original content is already perfectly band limited, than you don't need a low pass filter at all and can directly throw away the extra samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The decimation low pass filter typically determines how the band limiting of the content is done. Here are the factors to consider&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Aliasing: since the low pass filter is never perfect, the decimation will&#xA;create some amount of aliasing. The amount depends on the steepness of the filter and the energy content of the signal at the frequencies that need removing.&lt;/li&gt;&#xA;&lt;li&gt;Pass band: The low pass filter isn't perfectly flat in the pass band so there is some amount of ripple you need to live with. The pass band must be below the new Nyquist frequency. The higher the filter order, the closer you can get and the wider the pass band will be.&lt;/li&gt;&#xA;&lt;li&gt;Phase response: Any IIR filter will change the phase response of your signal. The steeper the filter, the higher the maximum group delay. If need to maintain the phase, you need to use a linear phase FIR filter (ideally in a polyphase configuration).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The choice of filter is a trade off between pass band width, pass band amplitude distortion, pass band phase distortion, aliasing noise and computational complexity.If you have a spec for all of these, you can design the &quot;best&quot; filter. An example would be &quot;pass band +-0.5dB up to 90% Nyquist, aliasing at -80dB or below, linear phase&quot;.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-08T13:35:11.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1665" PostTypeId="2" ParentId="1654" CreationDate="2012-03-08T13:43:20.243" Score="8" Body="&lt;p&gt;First you have to clearly define what you mean by &quot;noise&quot;. Is simply the electronic noise in your measurement system or is it also brain activity that's not related to your stimulus. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One easy way to determine SNR is to compare the signal level during a stimulus with the signal level without stimulus. If noise and signal are uncorrelated you can determine the signal level through energy subtraction and thus determine the SNR.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your noise definition, this may not be practical cause you can't easily shut off the brain of the subject :-).&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-08T13:43:20.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1666" PostTypeId="2" ParentId="1637" CreationDate="2012-03-08T14:09:48.540" Score="10" Body="&lt;p&gt;It may be worth noting that Fourier Analysis is a special case of a concept called &lt;em&gt;orthogonal functions&lt;/em&gt;. The basic idea is that you break down a complicated signal into a linear superposition of simpler &quot;basis&quot; functions. You can do your processing or analysis on the basis functions and then sum the results for the basis functions to get the result for the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order for this to work there are certain mathematical requirement for the basis functions, i.e. they ideally form an orthonormal base. In case of the Fourier Transform the basis functions are complex exponentials. However, there are many other functions that can be used for that as well.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="1059" LastEditDate="2012-03-08T22:53:57.410" LastActivityDate="2012-03-08T22:53:57.410" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1667" PostTypeId="1" CreationDate="2012-03-09T01:06:55.353" Score="10" ViewCount="558" Body="&lt;p&gt;I am working with MRI images of the brain that have certain areas marked by hand like &lt;img src=&quot;https://i.stack.imgur.com/NtkWU.png&quot; alt=&quot;this&quot;&gt; and &lt;img src=&quot;https://i.stack.imgur.com/PN0Pn.png&quot; alt=&quot;this&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to come up with an interpolating function that will let me describe such curves so that I can use machine learning techniques to automatically generate such markings on unmarked images like &lt;img src=&quot;https://i.stack.imgur.com/TjC0M.png&quot; alt=&quot;this&quot;&gt; and &lt;img src=&quot;https://i.stack.imgur.com/4cgy7.png&quot; alt=&quot;this&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've considered using cubic spline interpolations to approximate the curve, but as far as I know, I would have to split the curve into multiple parts to interpolate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I on the right track or are there other (better?) ways to do this?&lt;/p&gt;&#xA;" OwnerUserId="1080" LastActivityDate="2012-06-15T12:36:11.377" Title="What interpolation methods can I use to get the tightest fit for these curves?" Tags="|image-processing|interpolation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1671" PostTypeId="1" CreationDate="2012-03-09T10:40:27.280" Score="6" ViewCount="9245" Body="&lt;p&gt;I want to calculate the phase difference between the two channels(signals) of a stereo audio file.(uncompressed data i.e. PCM samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to determine whether whether two signals are in phase or not i.e. kind of digital phase meter ?&#xA;Not the exact phase difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please suggest a algorithm to calculate the phase difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm expected to identify is Phase difference between signals (due to noises , disturbances) recorded separately then feed to left and right channel. &lt;/p&gt;&#xA;" OwnerUserId="1083" LastEditorUserId="1092" LastEditDate="2012-03-12T13:27:54.610" LastActivityDate="2013-09-30T18:20:44.053" Title="Calculate Phase angle between two signals i.e. digital Phase meter" Tags="|audio|discrete-signals|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1672" PostTypeId="2" ParentId="1671" CreationDate="2012-03-09T11:30:58.730" Score="4" Body="&lt;p&gt;Compute the cross-correlation function of the two channels within a time window of interest. Phase spectrum intercept will give the phase difference (which is generally frequency-dependent). To compute the intercept, select a frequency band of interest, and compute a line that fits the phase spectrum within this band. If the line fits well, then the signal excerpts may indeed have the constant phase difference within the taken time window. Crossing of the line with the frequency zero line will give the intercept (which is the phase difference).&lt;/p&gt;&#xA;" OwnerUserId="745" LastEditorUserId="745" LastEditDate="2012-03-10T17:06:57.240" LastActivityDate="2012-03-10T17:06:57.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1673" PostTypeId="2" ParentId="1671" CreationDate="2012-03-09T12:27:54.523" Score="9" Body="&lt;p&gt;A quick and dirty method is to compare the energy of the sum (L+R) to the energy of the difference (L-R). This gives a a crude single-number phase difference and is good at finding things like polarity flips etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Dilip pointed out, the concept of phase difference between uncorrelated signals is meaningless. Even if they are correlated, the phase difference tends to be a function of frequency, so a single number isn't particularly helpful either. Most real world stereo audio signals are partially correlated, which complicates the matter further. In order to really answer the question, you need to properly define what you mean by phase difference and what you are planning to do with it.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-09T12:27:54.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1674" PostTypeId="2" ParentId="1288" CreationDate="2012-03-09T12:30:43.650" Score="29" Body="&lt;p&gt;There is a relatively new method, you might want to look into:&#xA;&lt;a href=&quot;http://savvash.blogspot.com/2011/08/brisk-binary-robust-invariant-scalable.html&quot;&gt;BRISK&lt;/a&gt;, Binary Robust Invariant Scalable Keypoints:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In this paper we propose BRISK, a novel method for keypoint detection, description and matching. A comprehensive evaluation on benchmark datasets reveals BRISK’s adaptive, high quality performance as in state-of-the-art algorithms, albeit at a dramatically lower computational cost (an order of magnitude faster than SURF in cases). The key to speed lies in the application of a novel scale-space FAST-based detector in combination with the assembly of a bit-string descriptor from intensity comparisons retrieved by dedicated sampling of each keypoint neighborhood.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's patent-free and free to use (as was told by the author of the algorithm).&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="809" LastEditDate="2012-03-27T10:04:45.143" LastActivityDate="2012-03-27T10:04:45.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1675" PostTypeId="2" ParentId="1471" CreationDate="2012-03-09T12:36:55.573" Score="0" Body="&lt;p&gt;After rephrasing my question I got the answer that I was looking for. That's another example that you have to know what to ask for in order to receive what you need. Here's the page:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1657/how-can-i-detect-elements-of-gui-using-opencv&quot;&gt;How can I detect elements of GUI using opencv?&lt;/a&gt;&#xA;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="1066" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-03-09T12:36:55.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1676" PostTypeId="1" AcceptedAnswerId="1677" CreationDate="2012-03-09T14:09:21.580" Score="24" ViewCount="19637" Body="&lt;p&gt;I have a signal that is measured at 100Hz and I need to apply the Savitzky-Golay smoothing filter on this signal. However, on closer inspection my signal is not measured at perfectly constant rate, the delta between measurements ranges between 9.7 and 10.3 ms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use the Savitzky-Golay filter on not equally spaced data?&#xA;Are there other methods that I could apply?&lt;/p&gt;&#xA;" OwnerUserId="1084" LastActivityDate="2021-09-25T10:56:58.240" Title="Savitzky-Golay smoothing filter for not equally spaced data" Tags="|filters|smoothing|" AnswerCount="6" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1677" PostTypeId="2" ParentId="1676" CreationDate="2012-03-09T14:23:32.650" Score="5" Body="&lt;p&gt;One method would be to resample your data so that it is equally spaced, then you can do whatever processing you like. Bandlimited resampling using linear filtering isn't going to be a good option since the data isn't uniformly spaced, so you could use some sort of local polynomial interpolation (e.g. cubic splines) to estimate what the underlying signal's values are at &quot;exact&quot; 10-millisecond intervals.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-03-09T14:23:32.650" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1679" PostTypeId="1" CreationDate="2012-03-09T18:46:28.643" Score="11" ViewCount="1747" Body="&lt;p&gt;Given a template, and a signal, the question arises as to how similar the signal is to the template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Traditionally a simple correlation approach is used, whereby the template and a signal are cross-correlated, and then the entire result normalized by the product of both their norms. This gives a cross-correlation function that can range from -1 to 1, and the degree of similarity is given as the score of the peak therein. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How does this compare to taking the value of that peak, and dividing by the mean or average of the cross-correlation function? &lt;/li&gt;&#xA;&lt;li&gt;What am I measuring here instead? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Attached is a diagram as my example. &lt;img src=&quot;https://i.stack.imgur.com/XOvuB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get the best measure of their similarity, I am wondering if I should look at:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Just the peak of the normalized cross-correlation as shown here?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take peak but divide by the average of the cross-correlation plot?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My templates are going to be periodic square waves with some duty cycle as you can see - so should I not also somehow exploit the other two peaks we see here? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What would give the best measure of similarity in this case?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT For Dilip:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plotted the cross-correlation squared VS a cross-correlation that isnt squared, and it certainly does 'sharpen' the main peak over the others, but I am confused as to what calculation I should be using to determine similarity... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am trying to figure out is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Can/Should I use the other secondary peaks in my calculations of similarity? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We have a squared cross-correlation plot now, and it certainly sharpens the main peak, but how does this help in determining final similarity? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks again.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tLRwM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT For Dilip:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The smaller peaks don't really help in similarity calculations; it is the main peak that matters. But the smaller peaks do provide support for the conjecture that the signal is a noisy version of the template. &quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Thanks Dilip, I am a little confused by that statement - if the smaller peaks do in fact provide support that the signal is a noisy version of the template, then doesnt that also aid in a measure of similarity?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What am I confused about is whether I should simply use the peak of the normalized cross-correlation function as my one and final measure of similarity and 'not care' about what the  rest of the cross-corr function does/looks like, OR, should I take the peak value and some_other_metric of the cross-cor into account as well. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If only the peak matters, then how/why would squaring the function help, since it just magnifies the main peak relative to the smaller ones? (More noise immunity?) &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Long and short: Should I care about the peak of the cross-correlation function &lt;em&gt;only&lt;/em&gt; as my final measure of similarity, or should I also take the entire cross-correlation plot into account as well? (Hence my thought about looking at its mean). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks again,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Time delay in this case is not a problem, in that, it is 'not cared' about for this application. &#xA;P.P.S. I do not have control over the template. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="1629" LastEditDate="2016-09-10T07:50:53.227" LastActivityDate="2016-09-10T07:50:53.227" Title="What is the difference between normalized peak of correlation, versus peak of correlation divided by its average?" Tags="|discrete-signals|cross-correlation|waveform-similarity|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1680" PostTypeId="1" CreationDate="2012-03-09T08:59:20.673" Score="1" ViewCount="89" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1671/calculate-phase-angle-between-two-signals-i-e-digital-phase-meter&quot;&gt;Calculate Phase angle between two signals i.e. digital Phase meter&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;I want to calculate the phase difference between the two channels(signals) of a stereo audio file.(uncompressed data i.e. PCM samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to determine whether whether two signals are in phase or not i.e. kind of phase meter ?&#xA;Not the exact phase difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please suggest a algorithm to calculate the phase difference.&lt;/p&gt;&#xA;" OwnerUserId="1092" OwnerDisplayName="user1147663" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-03-09T19:08:56.587" Title="Calculate Phase angle between two signals" Tags="|audio|" AnswerCount="0" CommentCount="0" ClosedDate="2012-03-11T06:41:57.527" ContentLicense="CC BY-SA 3.0" />
  <row Id="1681" PostTypeId="1" CreationDate="2012-03-09T19:20:06.440" Score="2" ViewCount="376" Body="&lt;p&gt;I'm trying to find the output where $h[n]$ is the impulse response of a real stable causal LTI system, and $s_0 \epsilon \mathbb{R}$, and where the input is $x[n] = e^{2\pi i n s_0}$ for $n \epsilon \mathbb{N}$.  Supposedly my answer should be a compact formula with no infinite sums...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So since since my system is causal I obtain, $y[k] = e^{2\pi i ks_0}\sum_{n=0}^{\infty}h[n]e^{-2\pi i ns_0}$.  From here I can conclude that since the system is stable this series converges, but without knowing more information about $h[n]$ I can't see any way to further simplify the expression and rid myself of this infinite sum.  Of course I also know by assumption that $y[k],s_0 \epsilon \mathbb{R}$, but I can't see anyway to use this fact without, again, knowing more about $h[n]$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose my sum is looking a lot like the standard Fourier transform but I don't see how I can use that with out, once again, knowing more about $h[n]$.  Hopefully someone can help me here, thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Could it be that a real system implies that $h[n]$ is real?  Although that's still not enough info to allow me to find a closed form for this series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2: Or could &quot;real&quot; in this context be referring to a system which is actually implemented?&lt;/p&gt;&#xA;" OwnerUserId="1035" LastEditorUserId="1035" LastEditDate="2012-03-09T19:35:36.107" LastActivityDate="2012-03-15T14:06:37.717" Title="Help finding the output for input with conditions" Tags="|impulse-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1683" PostTypeId="1" AcceptedAnswerId="1685" CreationDate="2012-03-09T21:47:21.300" Score="21" ViewCount="8315" Body="&lt;p&gt;I am reading this &lt;a href=&quot;https://web.archive.org/web/20120902075649/http://eetimes.com/design/embedded/4006427/A-DSP-algorithm-for-frequency-analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;, and I am getting a little confused by the author's liberal use of 'frequency resolution' regarding the Goertzel Algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic question: Does using the Goertzel algorithm &lt;em&gt;actually&lt;/em&gt; give you more frequency resolution over a specific band of interest, or does it simply efficiently compute the FFT over only the specified band of interest, but at the same frequency resolution specified by sampling frequency divided by number of samples? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, lets say the &lt;span class=&quot;math-container&quot;&gt;$F_s$&lt;/span&gt; is 100 KHz, (fixed) and the number of data samples &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is 10000. (Also fixed). If I compute a normal FFT, where FFT length is also &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, my frequency resolution is &lt;span class=&quot;math-container&quot;&gt;$\frac{F_s}{N}$&lt;/span&gt; as to be expected, and it will be equal to 10 Hz. This means my bins are separated by 10 Hz, from -50,000 Hz to 50,000 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let us say I want to use the Geortzel Algorithm to only look at frequencies in the range of say, 20,000-21,000 Hz. If I use the same &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; for number of samples, and use the same &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; for my FFT size, then what is my frequency resolution? Still 10 Hz? Or is it &lt;span class=&quot;math-container&quot;&gt;$\frac{21,000-20,000}{10000} = 0.1$&lt;/span&gt;Hz? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a feeling that I am not really increasing my frequency resolution, as much as simply interpolating points on the main lobe, by using the same &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; in to evaluate the frequencies from 21,000 to 20,000 as I did from 0 to 50,000. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a correct understanding?&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="49713" LastEditDate="2020-04-10T15:21:59.967" LastActivityDate="2020-04-10T15:21:59.967" Title="Does using the Goertzel algorithm actually give better frequency resolution?" Tags="|fft|frequency-spectrum|resolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1684" PostTypeId="2" ParentId="1603" CreationDate="2012-03-09T21:58:14.413" Score="10" Body="&lt;p&gt;A Gabor filter is some parametrization of the idea of edges. This combines two somewhat contradictory ideas: an abrupt transition AND some fuzzy idea of where it is localized.&lt;/p&gt;&#xA;&lt;p&gt;It is mathematically a clever idea as it translates well in the Fourier domain: the Fourier transform of a Gabor is a Gaussian in Fourier space, and a Gaussian blob is the most neutral guess of something blurry you can make (think of throwing darts and looking at the patterns of hits).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bH5n9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bH5n9.png&quot; alt=&quot;Multiresolution schemes.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As a consequence, when you use a Gabor, there is no 'right' formula: it all depends on what visual feature you want to detect. In visual neuroscience, a popular choice is to chose a Gabor that corresponds in Fourier space to a blob on the logarithm of frequencies (as from the Weber law, we are sensitive to relative differences of frequencies). These are &lt;a href=&quot;https://laurentperrinet.github.io/publication/fischer-07-cv/&quot; rel=&quot;nofollow noreferrer&quot;&gt;log-Gabor filters&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To understand Gabor filters, check first what filter parameterization would be best for your particular application.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastEditorUserId="1085" LastEditDate="2021-07-30T09:13:43.340" LastActivityDate="2021-07-30T09:13:43.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1685" PostTypeId="2" ParentId="1683" CreationDate="2012-03-10T00:15:37.510" Score="21" Body="&lt;p&gt;Your understanding is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Goertzel algorithms give almost exactly the same result as 1 bin of a DFT or FFT of the same length or number of samples (and where the FFT twiddle factors are generated by a trig recursion), when used for frequencies that are exactly integer periodic in the Goertzel length.  But many forms of the Goertzel algorithm provide only the magnitude, not the complex result or the phase of the FFT 1 bin result.  Also, computationally, a generic Goertzel may be numerically slightly less stable than a generic FFT.  For non-integer-periodic-in-aperture frequencies, the result is equivalent to a sinc interpolation between bins of a DFT or FFT of the same length (which can be slightly more accurate of an interpolation than the more typical parabolic interpolation of FFT results).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interpolation might be said to increase resolution in a graphical sense (more plot points), or making it easier to visually spot the maxima, but not in the information theoretic sense, nor for better separating 2 close spaced spectral lines as 2 separate peaks.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-16T21:59:40.413" LastActivityDate="2016-01-16T21:59:40.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1686" PostTypeId="1" AcceptedAnswerId="1695" CreationDate="2012-03-10T09:40:38.233" Score="11" ViewCount="6996" Body="&lt;p&gt;i've started experimenting with c++ and opencv because of i want to learn image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my first exercise is to create a skin detector with &lt;a href=&quot;http://opencv.willowgarage.com/documentation/cpp/histograms.html#cv-calchist&quot;&gt;calcHist&lt;/a&gt; and &lt;a href=&quot;http://opencv.willowgarage.com/documentation/cpp/histograms.html#cv-calcbackproject&quot;&gt;calcBackProject&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But i don't understand few things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the statistic interpretation of back project, and why it is named &quot;back project&quot;&lt;/li&gt;&#xA;&lt;li&gt;i have quite good comprehension of what ranges parameter is in &lt;code&gt;calcBackProject&lt;/code&gt;. But i'm really stucked with ranges parameter in &lt;code&gt;calcHist&lt;/code&gt; function.&lt;/li&gt;&#xA;&lt;li&gt;For more detection precision i think could be a good thing use backgrojection in more levels: in each channel of r-g-b ans in each channel of h-s-v. But i don't know how i can combine the different results of &lt;code&gt;calcBackProject&lt;/code&gt; of separate channels of rgb and hsv.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And i think that my not-well comprehension is caused by lack in theory of what i'm doing with those 2 methods (see the first point). So please explain me in plain english.&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="6" LastEditDate="2012-03-12T13:41:04.197" LastActivityDate="2012-03-12T22:22:34.940" Title="Opencv calcHist and calcBackProject in plain english" Tags="|image-processing|opencv|histogram|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1688" PostTypeId="1" AcceptedAnswerId="1689" CreationDate="2012-03-11T10:11:52.640" Score="5" ViewCount="842" Body="&lt;p&gt;When processing wav files, I encounter this problem: the what I extract PCM from a 8-bit encoded .wav file, I got a sequence of integers. However, when verifying my implementation with &lt;code&gt;wavread&lt;/code&gt; in Matlab, the PCM code is represented with so-called &lt;code&gt;double-precision normalized samples&lt;/code&gt;. My question is what's the difference between these two format. For example, the hex number is 0x80 0x81, the corresponding &lt;code&gt;double-precision normalized samples&lt;/code&gt; are 0, 0.0078. IIRC, PCM code in .wav file records sound pressure value of audio. Is &lt;code&gt;double-precision normalized samples&lt;/code&gt; sound pressure level? If so the value should be $10log(P_1/P_2)$ (based 10). But $10log(129/128)$is not 0.078 instead $10ln(129/128)$(based $e$) is. Anything wrong with my intuition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and best regards.&lt;/p&gt;&#xA;" OwnerUserId="942" LastActivityDate="2012-03-11T14:01:44.827" Title="WAV encoding problem" Tags="|fourier-transform|dsp-core|wave|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1689" PostTypeId="2" ParentId="1688" CreationDate="2012-03-11T11:12:39.830" Score="7" Body="&lt;p&gt;The PCM values are &lt;strong&gt;proportional&lt;/strong&gt; to the sound pressure. 8-bit PCM is stored with an offset of 128, so PCM coded values from 0 to 255 code for 'pressure values' from -128 to 127.&#xA;These values are often normalized to the range -1.0..+1.0.&#xA;The PCM values are linear representation of the sound pressure, and a log operation is only required if you want to express the sound pressure in decibels.&#xA;To get actual sound pressure levels in Pascal or dB(A) you would need a calibrated .wav signal.  &lt;/p&gt;&#xA;" OwnerUserId="108" LastActivityDate="2012-03-11T11:12:39.830" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1691" PostTypeId="2" ParentId="1688" CreationDate="2012-03-11T14:01:44.827" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/techdoc/ref/wavread.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/techdoc/ref/wavread.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;waveread() has an extra argument that will allow to read data in it's &quot;native&quot; format so you can avoid the output scaling and conversion to double precision. It has also optional output arguments that describe the exact format (sample rate, word width, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data is supposed to be proportional to the linear sound pressure but with an arbitrary scale factor. 8 bit is rather poor resolution for audio, this may not be good enough to do any sound pressure level calculation&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-11T14:01:44.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1692" PostTypeId="1" CreationDate="2012-03-11T21:28:14.283" Score="17" ViewCount="38599" Body="&lt;p&gt;The title asks it all. I have before me a data entry task that I'm not too enthusiastic about:  50-100 pages of handwritten sign out/sign in logs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The format of the logs may help. Pages are partitioned into clearly delineated rows and columns (13r x 6c with an extra typed header row). Further helping me out is that three columns are date/time related (date, time out, time in). Also, the data in two of the columns (resource and name) are more or less enumerated, so that, for example, the name &quot;Smith&quot; might appear time and again in the name column, each time with the same handwriting. The last column, &quot;Notes&quot;, is free form, but if I could automate the previous 6 columns, I wouldn't mind entering Notes by hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions? (Besides 'start typing'.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS If there's a better SE site to ask this, let me know, I'll ask there.&lt;/p&gt;&#xA;" OwnerUserId="1091" LastEditorUserId="1091" LastEditDate="2012-03-11T21:33:18.083" LastActivityDate="2021-09-28T18:29:46.753" Title="Are there any good open-source (well, free) handwriting OCR programs?" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1693" PostTypeId="1" AcceptedAnswerId="7573" CreationDate="2012-03-12T06:33:39.953" Score="24" ViewCount="27355" Body="&lt;p&gt;I am trying to teach myself about the WHT but there dont seem to be many good explanations of it online anywhere. I think I have figured out how to calculate the WHT, but I am really trying to understand why it is considered useful within the image recognition domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is so special about it, and what properties does it bring out in a signal that would not show up on classical Fourier transforms, or other wavelet transforms? Why is it useful for object recognition as pointed out &lt;a href=&quot;http://en.wikipedia.org/wiki/Sum_of_absolute_transformed_differences&quot;&gt;here&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="128" LastEditDate="2021-01-17T12:48:26.570" LastActivityDate="2021-01-17T23:45:25.740" Title="What Is the Walsh Hadamard Transform? How Could One Use It in Image Processing?" Tags="|image-processing|transform|" AnswerCount="6" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1694" PostTypeId="2" ParentId="1581" CreationDate="2012-03-12T08:07:49.117" Score="4" Body="&lt;p&gt;Just found the paper that referred to this transformation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y.I. Ohta, T. Kanade, T. Sakai. Color information for region segmentation, Comput. graphics Image Process. 13 (1980) 222—241.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is indeed called the &lt;strong&gt;&lt;em&gt;K-L space&lt;/em&gt;&lt;/strong&gt; as it is an static approximation of the (dynamic) image specific KLT calculated over a large set of images. The main reason is that the eigenvectors remain approximately the same for a large set of natural color images.&lt;/p&gt;&#xA;" OwnerUserId="1037" LastActivityDate="2012-03-12T08:07:49.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1695" PostTypeId="2" ParentId="1686" CreationDate="2012-03-12T15:24:27.957" Score="3" Body="&lt;p&gt;See What is &lt;a href=&quot;http://opencv.itseez.com/doc/tutorials/imgproc/histograms/back_projection/back_projection.html&quot; rel=&quot;nofollow&quot;&gt;Back Projection&lt;/a&gt; in the openCV tutorials&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An image histogram measures the distribution of colour (and brightness) of the pixels in an image.     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take an image and identify a region of interest eg. a hand, and calculate the histogram of the pixels in that object.       &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then take that histogram and a second image and essentially reverse the process - you pick the pixels in the second image that match the histogram from the first. It's this reverse process that gives it the name back-projection.        &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then make the assumption that areas of the image in the second image that have the same colour distribution as an object in the first image are an image of the same (or similar) object.&lt;/p&gt;&#xA;" OwnerUserId="1002" LastEditorUserId="1002" LastEditDate="2012-03-12T22:22:34.940" LastActivityDate="2012-03-12T22:22:34.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1696" PostTypeId="2" ParentId="1692" CreationDate="2012-03-12T15:31:12.940" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://code.google.com/p/tesseract-ocr/&quot; rel=&quot;noreferrer&quot;&gt;tesseract&lt;/a&gt; is probbaly the best and most widespread OCR library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been tested with handwriting and isn't too bad - although handwriting isn't an easy thing to read. &lt;a href=&quot;http://arxiv.org/ftp/arxiv/papers/1003/1003.5893.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://arxiv.org/ftp/arxiv/papers/1003/1003.5893.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-03-12T15:31:12.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1697" PostTypeId="2" ParentId="1693" CreationDate="2012-03-12T15:36:33.180" Score="8" Body="&lt;p&gt;The coefficients of the Hadamard transform are all +1 or -1. The Fast Hadamard Transform can therefor be reduced to addition and subtraction operations (no division or multiply). This allows the use of simpler hardware to calculate the transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So hardware cost or speed may be the desirable aspect of the Hadamard transform.&lt;/p&gt;&#xA;" OwnerUserId="108" LastActivityDate="2012-03-12T15:36:33.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1698" PostTypeId="2" ParentId="1592" CreationDate="2012-03-12T21:02:50.547" Score="3" Body="&lt;p&gt;The right answer is you have to perform each of the Update/Predict steps on the input signal &lt;strong&gt;completely&lt;/strong&gt; before doing the next Update/Predict.  What I was doing was walking through the signal, and performing each Update/Predict as I go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On page 158 of &quot;Ripples&quot;, there is a reference implementation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// s is the signal&#xA;#define IEVEN (2*j)&#xA;#define IODD (2*j + i)&#xA;for( int i = 1 ; i &amp;lt;= n/2 ; i *= 2 )&#xA;{&#xA;  for( int j = 0 ; j &amp;lt;= n/2 - i ; j += i ) // Must do this Predict step COMPLETLEY&#xA;    s[ IEVEN ] += √3 * s[ IODD ] ;&#xA;&#xA;  for( int j = 0 ; j &amp;lt;= n/2 - i ; j += i ) // Then this one..&#xA;  {&#xA;    int prevEvenIndex = IPREVEVEN ;&#xA;    s[ IODD ] -= d4c1*s[ IEVEN ] + d4c2*SAFE_PREV(s,prevEvenIndex) ;&#xA;  }&#xA;&#xA;  for( int j = 0 ; j &amp;lt;= n/2 - i ; j += i )&#xA;  {&#xA;    int nextOddIndex = INEXTODD ;&#xA;    s[ IEVEN ] -= SAFE_NEXT(s,nextOddIndex) ;&#xA;  }&#xA;&#xA;  for( int j = 0 ; j &amp;lt;= n/2 - i ; j += i )&#xA;  {&#xA;    s[ IEVEN ] *= d4normEvens ;&#xA;    s[ IODD ] *= d4normOdds ;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The 98% 0's D4 transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/saXht.png&quot; alt=&quot;d4 98%&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1040" LastActivityDate="2012-03-12T21:02:50.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1699" PostTypeId="1" CreationDate="2012-03-13T00:16:11.020" Score="17" ViewCount="705" Body="&lt;p&gt;A problem I had originally discussed in &lt;a href=&quot;https://dsp.stackexchange.com/questions/1483&quot;&gt;What methodology to use for discrimination of different (musical?) tones&lt;/a&gt; has evolved, and might have gotten a little simpler as I studied it in some more and attained new information.&lt;/p&gt;&#xA;&lt;p&gt;Bottom line, I would like to be able to detect this pattern shown here, using computer-vision/image-processing techniques. As you can see, the ideal pattern is made up of four 'pings'. The object-recognition should be:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Shift Invariant&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Horizontally, the image will be cyclical. (ie, Push to the right, comes out on the left, and vice-versa).&lt;/li&gt;&#xA;&lt;li&gt;(Fortunately) Vertically, it is not cyclical. (ie,Push to either top or bottom and it will stop).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Scale Invariant (The pings can vary in 'thickness' as you can see.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I could go on and on about it but I have attached images covering what I mean, please see below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/85zEq.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vkrSq.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kPEd0.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/h9DEO.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eacJj.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/HAmYV.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Of course, they can also be at a different 'scale', as can be seen from this family:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hBl17.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rBF4n.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Ylz79.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/szffG.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tqJlx.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;And finally, here are some 'realistic' scenarios of what I might actually receive, where there would be noise, the rows might 'fade' as you go towards the bottom, and of course, the  image will have plenty of spurious lines, artifacts, etc.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KaFpl.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/z9sl3.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iJtei.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qStBK.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;And of course, as a grand finale, there is the distinct possibility of this 'extreme' scenario:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GV3Yw.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;So once again, I would like to ask for some guidance on what computer-machine-vision techniques I should utilize here in order to best &lt;em&gt;detect&lt;/em&gt; the occurance of my pattern, where I need to be shift and scale invariant as you can see, and also be able to get decent results for the realistic scenarios. (Good news is that I DONT need it to be rotationaly invariant). Only idea I have been able to come up with thus far is a 2-D correlation.&lt;/p&gt;&#xA;&lt;p&gt;I should add, that in reality, I do NOT have colored images - I will just get a martix of numbers, so I suppose we are talking about 'greyscale'.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&lt;p&gt;P.S. For what its worth I will probably be using open C V.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT # 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Based on the comments, I have added the details you requested here:&lt;/p&gt;&#xA;&lt;p&gt;For characteristics defining the data, we can assume the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Horizontal length of each ping can vary, but I know the upper and lower bounds of it. YES for anything within this bound, NO for anything outside. (Example, I know the length of the pings can be anywhere between 1 and 3 seconds, for example).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;All pings need to be 'visible' for YES, however, last row can be missing, and still want to say 'YES'. Otherwise NO.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Vertical length, (the 'thickness') of each ping can vary, but again, also know upper and lower bound. (Similar to what you see in those images). YES for anything within that bound. NO for anything outside.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Height between each ping should always be the same for YES. If they are not, then NO. (Example, you can see how all the pings are of the same height relative to each other, ~110 on the vertical axis). So so 110 +/- 5 can be a YES, anything else has to be NO.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I think thats about it - but let me know what else I can add... (Also, everything shown here should register as a YES, btw).&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="128" LastEditDate="2021-06-29T04:58:32.080" LastActivityDate="2021-06-29T04:58:32.080" Title="What image-processing techniques are ideal for this particular shift/scale invariant template matching?" Tags="|image-processing|computer-vision|frequency-spectrum|" AnswerCount="2" CommentCount="17" ContentLicense="CC BY-SA 4.0" />
  <row Id="1702" PostTypeId="1" AcceptedAnswerId="1704" CreationDate="2012-03-13T11:00:43.760" Score="5" ViewCount="8357" Body="&lt;p&gt;I´d like to use some OCR algorithm (Image to Text) into an Android app (Java). I have previously used several algorithms but for a PC (Matlab) app. Which library or algorithm should I use? Computational cost and response time are important issues.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastEditorUserId="1051" LastEditDate="2012-03-13T11:08:40.787" LastActivityDate="2012-03-13T13:11:19.563" Title="Text recognition for Android app" Tags="|image-processing|ocr|text-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1703" PostTypeId="1" AcceptedAnswerId="1710" CreationDate="2012-03-13T11:44:18.277" Score="4" ViewCount="3344" Body="&lt;p&gt;I have this algorithm for Correlation Based Pyramids of images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Create two Gaussian pyramids from the two input&#xA;images&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Compute optical flow using “5×5” regions on&#xA;smallest pyramid level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Smooth optical flow, and use as initial guess for&#xA;higher resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Continue with next level. Search close to guess&#xA;from higher resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the third step asking me to do?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="440" LastEditDate="2012-03-26T10:05:38.593" LastActivityDate="2019-04-15T20:34:43.353" Title="What does the &quot;smoothing optical flow&quot; mean?" Tags="|image-processing|optical-flow|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1704" PostTypeId="2" ParentId="1702" CreationDate="2012-03-13T12:40:31.253" Score="7" Body="&lt;p&gt;As far as i know there are no native opensource Java OCR SDKs. There are Java APIs which wrap calls for native interfaces, for example, for one of the most popular opensource OCR engines - Tesseract (http://groups.google.com/group/tesseract-ocr/) - there are some Java wrappers like tesjeract (http://code.google.com/p/tesjeract/) or Tess4J (http://tess4j.sf.net/). That could work for you, but it's rather hard to set up and will require developing image-preprocessing and font training on your side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more solution could be a cloud service. It requires end-user application to have the internet connection, but it's independent from your programming language choice and resources limitations (which is importatnt on mobile devices, OCR proccess consumes rather big amount of recources). Have a look at &lt;a href=&quot;http://ocrsdk.com/producttour/mobile-devices/&quot; rel=&quot;nofollow&quot;&gt;www.ocrsdk.com for android ocr&lt;/a&gt;, it's a cloud-based OCR SDK that let you upload an image through web API and returns you the OCRed data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This Web API based OCR SDK is not free, which may not be suitable for you, but i still recommend you try it out (it has a free 90 days trial without any upfront charges) as its pricing is really affordable in comparison with enterprise solutions while it provides enterprise-level OCR accuracy which is way better than open source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also find useful this &lt;a href=&quot;https://github.com/abbyysdk/ocrsdk.com/tree/master/Android&quot; rel=&quot;nofollow&quot;&gt;Android codesample&lt;/a&gt; at github (you need to get API key at &lt;a href=&quot;http://ocrsdk.com&quot; rel=&quot;nofollow&quot;&gt;http://ocrsdk.com&lt;/a&gt; to use it). Disclamer: i work @ ABBYY.&lt;/p&gt;&#xA;" OwnerUserId="968" LastEditorUserId="968" LastEditDate="2012-03-13T13:11:19.563" LastActivityDate="2012-03-13T13:11:19.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1705" PostTypeId="1" AcceptedAnswerId="1707" CreationDate="2012-03-11T07:41:35.283" Score="9" ViewCount="667" Body="&lt;p&gt;My current problem: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have an input 3D binary image (a 3D matrix that has only 0 and 1) that consists of random numbers of sphere with radius r. &lt;/li&gt;&#xA;&lt;li&gt;We do not know how many spheres are there in the image.&lt;/li&gt;&#xA;&lt;li&gt;All spheres have the same radius r, but we do not know radius r.&lt;/li&gt;&#xA;&lt;li&gt;Spheres are all over the place in the image and can overlap each other.&lt;/li&gt;&#xA;&lt;li&gt;example image is given below.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My requirement:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;what is the radius r?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Currently, I simply just flatten the image to get rid of the z axis and perform edge detection and I am trying Hough Transform using: &lt;a href=&quot;http://rsbweb.nih.gov/ij/plugins/hough-circles.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://rsbweb.nih.gov/ij/plugins/hough-circles.html&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, with Hough Transform, I see that the variables minimum radius, maximum radius, and number of circles have to be specified. I have tried a few attempts below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Heh8S.png&quot; alt=&quot;known radius&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oiPxz.png&quot; alt=&quot;unknown radius&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the correct parameters, Hough Transform can detect the circles just fine. But in the real application, I do not know how many spheres are there, and making the program attempting to guess minimum and maximum radius seems not feasible. Are there other ways to accomplish this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross-link: &lt;a href=&quot;https://math.stackexchange.com/questions/118815/finding-radius-r-of-the-overlappable-spheres-in-3d-image&quot;&gt;https://math.stackexchange.com/questions/118815/finding-radius-r-of-the-overlappable-spheres-in-3d-image&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="263" OwnerDisplayName="Karl" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2012-03-13T15:05:36.170" Title="Finding radius r of the overlappable sphere(s) in 3D image" Tags="|image-processing|3d|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1706" PostTypeId="2" ParentId="1705" CreationDate="2012-03-11T10:35:18.087" Score="3" Body="&lt;p&gt;The Hough Transform does not, in its general form, require guesses at the radius of the circles you are looking for nor how many there are.  Perhaps you have been misled by your source.  The transform can be computationally expensive in its most general form;  any prior information you have can make the execution of the algorithm more speedy and more accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would expect the Hough Transform, given your input images, to find the radius of the spheres with reasonable accuracy; there are a lot of points in the images representing points on the circumference of circles with the same radius.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that radius, you seem to have the rest of the problem cracked so I won't write any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that Wikipedia's explanation of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow&quot;&gt;Hough Transform&lt;/a&gt; also indicates that it can be used to find 3D objects in 3D images, provided that those objects can be parameterised -- which a sphere certainly could be.&lt;/p&gt;&#xA;" OwnerDisplayName="High Performance Mark" LastActivityDate="2012-03-11T10:35:18.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1707" PostTypeId="2" ParentId="1705" CreationDate="2012-03-11T13:35:11.467" Score="9" Body="&lt;p&gt;A simpler solution and much more computationally efficient when compared to Hough Transform is to use the distance transform:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Find the surface of your spheres (i.e. the pixels that have value 1 and have at least one neighboring 0 pixel);&lt;/li&gt;&#xA;&lt;li&gt;Compute the &lt;a href=&quot;http://en.wikipedia.org/wiki/Distance_transform&quot;&gt;distance transform&lt;/a&gt; with respect to the spheres surface, but constrain the computation only to pixels that are internal to the spheres. The output will be a distance map;&lt;/li&gt;&#xA;&lt;li&gt;The radius will be exactly the maximum value in your distance map.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Another advantage of this solution when compared to Hough transform is that it provides a much more precise value for the radius.&lt;/p&gt;&#xA;" OwnerUserId="1161" OwnerDisplayName="Alceu Costa" LastActivityDate="2012-03-11T17:48:53.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1708" PostTypeId="1" AcceptedAnswerId="1709" CreationDate="2012-03-14T08:21:28.733" Score="19" ViewCount="13774" Body="&lt;p&gt;Broadly a majority of the literature on edge detection algorithms and applications that uses edge detection, references Canny's edge detector.  So much so that it looks like almost &quot;the solution&quot; to edge detection. Certainly, it would do the best job balancing noise and preserving edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as a simple curiosity, is there an area of concern for Canny's edge detector? or are there areas of applications where Canny will not be best? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this context, faster implementation is not really concern. The focus of edge detector being good or bad should be the quality and utility of edges generated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I am really not focusing on implementation specific issues. I am looking for more theoretical limitations or characteristics inherent in the algorithm.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="128" LastEditDate="2019-03-19T17:23:53.063" LastActivityDate="2019-03-19T17:23:53.063" Title="What Are the Limitations of a Canny Edge Detector?" Tags="|image-processing|edge-detection|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1709" PostTypeId="2" ParentId="1708" CreationDate="2012-03-14T09:02:57.543" Score="19" Body="&lt;p&gt;From my experience, the following points are limitations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The result is binary. You sometimes need a measure of 'how much' the edge qualifies as an edge (e.g. intensity image coming from a Sobel amplitude edge detector)&lt;/li&gt;&#xA;&lt;li&gt;The amount of parameters leads to infinitely tweaking for getting just that &lt;em&gt;little&lt;/em&gt; better result. &lt;/li&gt;&#xA;&lt;li&gt;You still need to connect the resulting edges to extract the complete edges that seem so obvious for the human eye+mind.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also due to the gaussian smoothing: the location of the edges might be off, depending on the size of the gaussian kernel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The method has problems with corners and junctions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The gaussian smoothing blurs them out, making them harder to detect (same goes for the edges themself)&lt;/li&gt;&#xA;&lt;li&gt;The corner pixels look in the wrong directions for their neighbors, leaving open ended edges, and missing junctions&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This last problem is addressed by &lt;a href=&quot;http://www.cs.manchester.ac.uk/ugt/COMP37111/papers/smith95susan.pdf&quot; rel=&quot;noreferrer&quot;&gt;the SUSAN method&lt;/a&gt;, which connects edges better and also results in nice junctions, as shown by these example figures as given in the linked paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Test input image: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zQ8vb.png&quot; alt=&quot;Test input image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Results SUSAN:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FgXtr.png&quot; alt=&quot;Results SUSAN&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Results Canny:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q7ekN.png&quot; alt=&quot;Results Canny&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can clearly see SUSAN finds the corners and junctions instead of Canny.&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="809" LastEditDate="2012-03-16T13:20:52.850" LastActivityDate="2012-03-16T13:20:52.850" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1710" PostTypeId="2" ParentId="1703" CreationDate="2012-03-14T11:10:17.663" Score="14" Body="&lt;p&gt;Optical ﬂow is an approximation of the local image motion based upon local derivatives in a given sequence of images. That is, it speciﬁes how much each image pixel moves between adjacent images. (The same concept extends on 3D as well). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The concept of Optical flow derives from the fact that the moving patterns cause temporal varieties of the image brightness. It is assumed that all temporal intensity changes are due to motion only. This is usually true but there are many exceptions (see below). These variations are measured using derivatives. The optical flow methods try to calculate the motion between two image frames which are taken at times $t$ and $\delta t$ at every pixel position. The following constraint equation can be used to derive the optical flow - which is called as Image constraint equation or optical flow equation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;{{\partial I} \over {\partial x} }\Delta x + {{\partial I} \over {\partial y}} \Delta y + {{ \partial I} \over {\partial t}} \Delta t = 0&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Refer to &lt;a href=&quot;http://en.wikipedia.org/wiki/Optical_Flow&quot;&gt;wiki page&lt;/a&gt;, or this &lt;a href=&quot;http://www.umiacs.umd.edu/~ramani/cmsc426/Lecture18_19_motion.pdf&quot;&gt;lecture note&lt;/a&gt; for more details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus the computation of diﬀerential optical ﬂow is, essentially, a two-step procedure:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;measure the spatio-temporal intensity derivatives (which is equivalent to measuring the velocities normal to the local intensity structures) and&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;integrate normal velocities into full velocities, for example, either locally via a least squares calculation or globally via a regularization. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, the above equation alone is not &lt;em&gt;sufficient&lt;/em&gt; for computation since it involves two variables with only one equation/constraint. BKP Horn, introduced another constraint in their seminal paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cs.bgu.ac.il/~tcv102/wiki.files/Horn,%20Shunck,%20Determining%20Optical%20Flow%201980.pdf&quot;&gt;BKP Horn, Brian Schunck &lt;em&gt;&quot;Determining  Optical  Flow&quot;&lt;/em&gt; Artificial Intelligence, Vol. 16, No. 1–3, August 1981, pp. 185–203.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accordingly, in a rigid body motion (with non deformation assumption), neighboring pixels have similar velocity. Based on this they derived another constraint based on velocity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\nabla ^2 u = {{\partial ^2 u} \over {\partial x^2}} + { {\partial ^2 u} \over {\partial y^2}} = 0 &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &#xA;$$&#xD;&#xA;\nabla ^2 v = {{\partial ^2 v} \over {\partial x^2}} + { {\partial ^2 v} \over {\partial y^2}} = 0 &#xD;&#xA;$$&#xA;where &#xA;$$ &#xD;&#xA;u = {{\delta x} \over {\delta t}} \text{ and  } v = {{\delta y} \over {\delta t}} &#xD;&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above two equations are considered as &lt;strong&gt;&lt;em&gt;Smoothing Constraints&lt;/em&gt;&lt;/strong&gt; of optical flow. &#xA;Read this: &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT12/node4.html&quot;&gt;cv-online page&lt;/a&gt; and another reference &lt;a href=&quot;http://www.tina-vision.net/docs/memos/2004-012.pdf&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="77" LastEditDate="2012-03-23T04:37:42.327" LastActivityDate="2012-03-23T04:37:42.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1711" PostTypeId="2" ParentId="1708" CreationDate="2012-03-14T11:43:46.737" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;or are there areas of applications where Canny will not be best? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can think of a few:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if you need closed curves, a detector that can guarantee those might be better (e.g. zero crossings of the laplacian or watershed segmentation)&lt;/li&gt;&#xA;&lt;li&gt;if you're trying to detect a homogeneous object that has low contrast in some areas, a segmentation method that uses global information (like watershed segmentation) can give better results&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-03-14T11:43:46.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1713" PostTypeId="1" AcceptedAnswerId="1717" CreationDate="2012-03-14T13:51:24.643" Score="3" ViewCount="173" Body="&lt;p&gt;I'm now processing PCM codes extracted from .wav file and want render the spectrum myself. First I try to read a spectrum on my foobar2000 player as below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LWgqq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem with this spectrum is: what do x-axis and y-axis represent? IIRC, the x-axis represents different frequency(or angular speed) and the scale should be whole-number times of fundamental, i.e. 50. However, when I divide next by its preceding, e.g. $94\div 69$, the outcome is roughly always 1.37. As to the y-axis, why the scale is negative? What is the calibrated value, i.e. $P_2$ in $10\log_{10}{\frac{P_1}{P_2}}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to render the amplitude spectrum with PCM code, should some normalization be first taken(I know the original 8-bit PCM code ranges from -128 to 127, even normalized range is -1.0 to 1.0. It seems I can't use these values directly to represent amplitude of the signals)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and Best Regards!&lt;/p&gt;&#xA;" OwnerUserId="942" LastActivityDate="2012-03-14T16:41:53.457" Title="Problem reading and rendering Spectrum" Tags="|frequency-spectrum|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1714" PostTypeId="1" AcceptedAnswerId="1735" CreationDate="2012-03-14T14:02:43.800" Score="54" ViewCount="24699" Body="&lt;p&gt;I have done a lot of research and found out methods like adaptive thresholding , watershed etc that can be used of detecting veins in leaves . However thresholding isn't good as it introduces a lot of noise &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All my images are gray image please could anyone suggest what approaches to adopt while considering this problem in urgent need of help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:My original image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I9Pxl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After thresholding&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0dmob.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As suggested by the answer i have tried the following edge detection &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Canny&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Too much noise and unwanted disturbances&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IGpwt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Sobel&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jIGMa.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Roberts&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vycEp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Tried one more operation i get the following result its better than what i tried with canny and adaptive What do you feel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CHO2U.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="7338" LastEditDate="2017-10-09T19:08:11.093" LastActivityDate="2019-12-10T18:55:43.497" Title="Best way of segmenting veins in leaves?" Tags="|image-processing|computer-vision|image-segmentation|thresholding|" AnswerCount="6" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1717" PostTypeId="2" ParentId="1713" CreationDate="2012-03-14T16:41:53.457" Score="3" Body="&lt;p&gt;The x-axis is indeed frequency, but the numbers are quite strange to me. One would expect a scale in powers of 2 (octaves) or of powers of 10 (decades).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The y-axis represents the relative magnitude of the signal at that particular frequency. The 0dB level is what you would get from a sine wave with the maximum amplitude (-1..+1). So your P2 is 1.0. &lt;/p&gt;&#xA;" OwnerUserId="108" LastActivityDate="2012-03-14T16:41:53.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1718" PostTypeId="1" CreationDate="2012-03-14T17:39:49.920" Score="7" ViewCount="1445" Body="&lt;p&gt;As related to the project I am currently involved in, I have come to realize that one thing that might help is for me to 'segment' my image. To that end, I have shown a very simple example below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do segmentation methods work in general, and what class of them would help getting me from the first image: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RZQv7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...to the second:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bsaBC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please ignore the scaling that might seem to have occured here, but you get the general idea. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-03-14T18:42:08.883" Title="What segmentation methods can be used for simple images?" Tags="|image-processing|preprocessing|segmentation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1719" PostTypeId="2" ParentId="1714" CreationDate="2012-03-14T17:46:19.973" Score="3" Body="&lt;p&gt;Instead of thresholding, i have applied simple edge detection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Used &lt;a href=&quot;http://www.gimp.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GIMP&lt;/a&gt; with Difference of Gaussian - Radious Outer:3.0 and Inner:1.0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it is how it looks like. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cDwyv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can further apply a median filter or erosion/dilation so that you can remove some of the grainy noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the &lt;a href=&quot;http://docs.gimp.org/en/plug-in-dog.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;page&lt;/a&gt; that explains gimp's implementation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should refer to different techniques like Laplacian of Gaussian or Difference of Gaussin etc. See this: &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm#7&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm#7&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this answer &lt;a href=&quot;https://dsp.stackexchange.com/questions/701/how-is-the-laplacian-used-for-unsharp-mask/703#703&quot;&gt;How is the Laplacian used for Unsharp Mask?&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-03-14T18:25:54.070" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1720" PostTypeId="2" ParentId="1718" CreationDate="2012-03-14T18:42:08.883" Score="6" Body="&lt;p&gt;One of the simplest method you can use is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Region growing&quot; scheme. Here the algorithm starts with a seed points, and keeps registering the pixel surrounded by it as long as the region as a whole has same property as before and after the inclusion of pixel. This is applied with reasonably good set of seed points recursively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This property can be color variations, statistical properties such as mean and variance of intensity of the regions, or it can be texture. And the criteria for segmentation is homogeneity of the region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same principle but alternative implementation is region split and merge approach. Here a image is first divided into fixed parts - say 4 parts and corresponding scores of above properties is computed. Now the each sub region is split further, and we can check if any region is significantly different from others or same. If homongenety of sub parts is same essentially it is merged back. But if the element is realized to have different properties it now fall in different regions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read this for more details: &lt;a href=&quot;http://vplab.iitm.ac.in/courses/CV_DIP/PDF/lect-Segmen.pdf&quot;&gt;http://vplab.iitm.ac.in/courses/CV_DIP/PDF/lect-Segmen.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-03-14T18:42:08.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1723" PostTypeId="2" ParentId="1693" CreationDate="2012-03-14T21:19:01.090" Score="6" Body="&lt;p&gt;Take a look at this paper if you have access, I've pasted the abstract here&#xA;Pratt, W.K.; Kane, J.; Andrews, H.C.; , &quot;Hadamard transform image coding,&quot; Proceedings of the IEEE , vol.57, no.1, pp. 58- 68, Jan. 1969&#xA;doi: 10.1109/PROC.1969.6869&#xA;URL: &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=1448799&amp;amp;isnumber=31116&quot;&gt;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=1448799&amp;amp;isnumber=31116&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Abstract&#xA;The introduction of the fast Fourier transform algorithm has led to the development of the Fourier transform image coding technique whereby the two-dimensional Fourier transform of an image is transmitted over a channel rather than the image itself. This devlopement has further led to a related image coding technique in which an image is transformed by a Hadamard matrix operator. The Hadamard matrix is a square array of plus and minus ones whose rows and columns are orthogonal to one another. A high-speed computational algorithm, similar to the fast Fourier transform algorithm, which performs the Hadamard transformation has been developed. Since only real number additions and subtractions are required with the Hadamard transform, an order of magnitude speed advantage is possible compared to the complex number Fourier transform. Transmitting the Hadamard transform of an image rather than the spatial representation of the image provides a potential toleration to channel errors and the possibility of reduced bandwidth transmission.&lt;/p&gt;&#xA;" OwnerUserId="1102" LastActivityDate="2012-03-14T21:19:01.090" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1725" PostTypeId="2" ParentId="1656" CreationDate="2012-03-15T01:46:00.757" Score="0" Body="&lt;p&gt;Though I do not have experience using this particular function on images, sometimes in communications we use a spectrogram to see how the frequency distribution of a signal changes over time take a look at this wiki page &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Spectrogram&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially on a one dimensional array of size 2048 we could take a set of smaller FFTs say size 16 of size 128 with out over lap and plot the ffts over time. Other variations include using overlap when taking the fft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be difficult to use in image processing because of the fourth dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, one way you could reduce the dimensionality of something to this effect over time is by taking an FFT of a single row of the image over the entire set of the images and plot these as a three dimensional surface, then do this for each relevant row in the image.&lt;/p&gt;&#xA;" OwnerUserId="1102" LastActivityDate="2012-03-15T01:46:00.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1726" PostTypeId="2" ParentId="1714" CreationDate="2012-03-15T10:28:25.683" Score="6" Body="&lt;p&gt;When using Canny edge detection (in Halcon), with alpha being 1, and the low threshold 8 and the high threshold 13 (on a scale of 1-255), I get the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WyveC.png&quot; alt=&quot;Canny edge detection leaf&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With tweaking of the parameters, the result you got from Canny can be much more improved.&#xA;Using this image, you can skip the short edges to remove the noise, and connect the long edges for the final result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW: a different color indicates a different edge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get a fairly similar result using &lt;a href=&quot;http://matlabserver.cs.rug.nl/cannyedgedetectionweb/web/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this online Canny edge detector&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Choose picture I9Pxl.png&lt;/li&gt;&#xA;&lt;li&gt;Sigma 1.2&lt;/li&gt;&#xA;&lt;li&gt;T-low 0.04&lt;/li&gt;&#xA;&lt;li&gt;T-high 0.07&lt;/li&gt;&#xA;&lt;li&gt;Other settings default&lt;/li&gt;&#xA;&lt;li&gt;Click update view for result&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="809" LastEditorUserId="809" LastEditDate="2012-03-17T10:26:26.920" LastActivityDate="2012-03-17T10:26:26.920" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1727" PostTypeId="1" AcceptedAnswerId="1987" CreationDate="2012-03-15T11:24:37.080" Score="9" ViewCount="13099" Body="&lt;p&gt;I have a camera (iPhone), I have a 3D control object in the image that I know its properties very well. (My control object). There is also a secondary object in motion. The ultimate goal is to establish the 3D trajectory of the moving object for a given period of time. (Tracking) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to ask, could I find out?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Phone's distance to the control object (for sake of discussion, let's assume camera is at certain height and certain distance neither of them is known but camera is perpendicular to the surface which is known)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The secondary object where I can locate the object in each subsequent frame.  My goal is to estimate its 3D trajectory as I have indicated above. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Bonus question, we can make the system such that the phones distance to the control object can be set (although not preferred), would this help me with the second point?&lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2018-02-27T15:04:45.677" Title="3D Position estimation using 2D camera" Tags="|tracking|image-processing|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1728" PostTypeId="1" CreationDate="2012-03-15T09:08:57.677" Score="8" ViewCount="2389" Body="&lt;p&gt;I'm struggling to figure out how the time points of an STFT are calculated, and I can't find a definitive answer.  Let's say I have a 4Hz stationary signal and I'm going to use a 64 second window with 3 second overlap. So that's a 256 point window and a 12 point overlap. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming I start at &lt;code&gt;time=0&lt;/code&gt;, take the first 64 seconds, and perform the FFT/Power Spectrum Density/etc... Can I then say that is the value at &lt;code&gt;t=32&lt;/code&gt;? Is the next window, after the 3 second slide localized at &lt;code&gt;t=35&lt;/code&gt;, and so on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, and I really wanted to start at &lt;code&gt;t=0&lt;/code&gt;, would I then effectively start at &lt;code&gt;t=-32&lt;/code&gt;, fill the first 128 points with zeros and take the first 128 points from my signal, thus centering on &lt;code&gt;t=0&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1105" OwnerDisplayName="Alex Shaykevich" LastEditorUserId="76" LastEditDate="2012-07-23T01:19:46.687" LastActivityDate="2012-07-23T01:19:46.687" Title="Time resolution of the Short Time Fourier Transform (STFT)" Tags="|fft|stft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1729" PostTypeId="1" AcceptedAnswerId="1732" CreationDate="2012-03-14T02:08:31.703" Score="10" ViewCount="29211" Body="&lt;p&gt;How can I apply a window function like Hamming or Lanczos to a signal, using its coefficients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, which method can I use to do this? FFT? Convolution? Which method has the better performance?&lt;/p&gt;&#xA;" OwnerUserId="541" OwnerDisplayName="walteram" LastEditorUserId="77" LastEditDate="2012-03-17T16:28:35.437" LastActivityDate="2012-03-17T16:28:35.437" Title="How do I apply a function window to a signal?" Tags="|window-functions|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1730" PostTypeId="2" ParentId="1681" CreationDate="2012-03-15T12:53:09.327" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So since since my system is causal I obtain, $y[k] = e^{2\pi i ks_0}\sum_{n=0}^{\infty}h[n]e^{-2\pi i ns_0}$.  From here I can conclude that since the system is stable this series converges, but without knowing more information about $h[n]$ I can't see any way to further simplify the expression and rid myself of this infinite sum.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Hint:  The function (of $z$) defined by $\sum_n h[n]z^{-n}$ is given a special&#xA;name and is of some importance in signal-processing circles. Do you know about&#xA;this function?&#xA;What is the value of this function at $z = e^{2 \pi i s_0}$? which by the way&#xA;lies on the unit circle in the complex plane, seeing as how we are talking of circles.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-03-15T14:06:37.717" LastActivityDate="2012-03-15T14:06:37.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1731" PostTypeId="2" ParentId="1728" CreationDate="2012-03-15T14:07:55.613" Score="5" Body="&lt;p&gt;There is no single &quot;time instant&quot; associated with a short-time Fourier transform. As you noted, if you perform a DFT on data collected from $t = 0$ to $t = 64$, then there isn't a single point in time that you can associate with the output from that DFT; it is a function of every sample in its time interval. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this reason, there is no standard convention for how you might denote the time axis associated with successive STFTs, if you were tiling them together into a spectrogram, for example. You'll just need to pick a convention that is meaningful for your application. You've already identified a couple reasonable ones (using the beginning or center of the DFT's window as its &quot;time instant&quot;).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-03-15T14:07:55.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1732" PostTypeId="2" ParentId="1729" CreationDate="2012-03-15T14:08:10.137" Score="4" Body="&lt;p&gt;I wrote this long answer for someone yesterday on stackoverflow.com . . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/9694297/matlab-fft-xaxis-limits-messing-up-and-fftshift/9699983#9699983&quot;&gt;https://stackoverflow.com/questions/9694297/matlab-fft-xaxis-limits-messing-up-and-fftshift/9699983#9699983&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a matlab based example showing how to use the FFT for analysis, but it might give you some ideas About half way through the second code block, I apply a window function to a buffered signal. This is effectively a vector multiplication of the window function with each buffered block of time series data. I just use a sneaky diagonal matrix trick to do it efficiently.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-03-15T14:08:10.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1733" PostTypeId="1" AcceptedAnswerId="1820" CreationDate="2012-03-15T15:07:57.393" Score="10" ViewCount="1863" Body="&lt;p&gt;Last couple of questions touched upon Canny edge detector&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1708/what-are-the-limitations-of-a-canny-edge-detector&quot;&gt;What are the limitations of a Canny edge detector?&lt;/a&gt;  and&lt;br&gt;&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1714/best-way-of-segmenting-veins-in-leaves&quot;&gt;Best way of segmenting veins in leaves?&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic outline of the algorithm is as follows: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. Apply Gaussian Convolution. (Choice of $\sigma$ to be made here)&lt;br&gt;&#xA;b. Apply 2D derivative&lt;br&gt;&#xA;c. Tracking through the ridges of this edges and thresholding (set pixels to zero which are not on the edge) with Hysteresis Lower and Higher T0 and T1 (Choice of $T0$ and $T1$ to be made here).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/canny.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; for more background. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While, it is claimed that Canny is &lt;em&gt;optimal&lt;/em&gt;; when getting practical results matters, tweaking factors  as listed above $\sigma, T0,$ and $T1$ does make a lot of difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does one select these (tweaking) parameters practically? Even if, there is no definite approach or value, what is the general technique to know this?&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-03-24T13:24:38.263" Title="Could you describe the effects for varying different parameters of a canny edge detector?" Tags="|image-processing|edge-detection|canny-edge-detector|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1734" PostTypeId="2" ParentId="1728" CreationDate="2012-03-15T16:14:41.947" Score="5" Body="&lt;p&gt;If you are using a non-rectangular window (Hamming, von Hann, etc.), then the centroid of your window would be offset to the middle of your FFT aperture, and the FFT results would thus more highly correlate with the content of your data near or at the center, and not at the edges where the windowing would reduce influence on the results from the time domain data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want your &quot;time instant&quot; to be a point near probable higher correlation, then it might make sense to put your time instant in the center.  But note that data (say some time-limited frequency bursts) completely before or after this centered &quot;time instant&quot; will still influence the FFT results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, as Jason R posts, other conventions are also possible.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-03-15T16:14:41.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1735" PostTypeId="2" ParentId="1714" CreationDate="2012-03-15T21:05:21.950" Score="64" Body="&lt;p&gt;You're not looking for &lt;em&gt;edges&lt;/em&gt; (=borders between extended areas of high and low gray value), you're looking for &lt;em&gt;ridges&lt;/em&gt; (thin lines darker or brighter than their neighborhood), so edge filters might not be ideal: An edge filter will give you two flanks (one on each side of the line) and a low response in the middle of the line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XACjm.png&quot; alt=&quot;filter samples&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ADD&lt;/strong&gt;: If've been asked to explain the difference between an edge detector and a ridge detector more clearly. I apologize in advance if this answer is getting very long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An edge detector is (usually) a first derivative operator: If you imagine the input image as a 3D landscape, an edge detector measures the steepness of the slope at each point of that landscape:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8qpcg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to detect the border of an extended bright or dark region, this is just fine. But for the veins in the OP's image it will give you just the same: the outlines left and right of each vein:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l0dQq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That also explains the &quot;double line pattern&quot; in the Canny edge detector results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uSUFC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how do you detect these thin lines (i.e. ridges), then? The idea is that the pixel values can be (locally) approximated by a 2nd order polynomial, i.e. if the image function is &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, then for small values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$g(x,y)\approx \frac{1}{2} x^2 \frac{\partial ^2g}{\partial x^2}+x y \frac{\partial ^2g}{\partial x\, \partial y}+\frac{1}{2} y^2 \frac{\partial ^2g}{\partial y\, ^2}+x \frac{\partial g}{\partial x}+y \frac{\partial g}{\partial y}+g(0,0)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or, in matrix form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$g(x,y)\approx \frac{1}{2} \left(&#xA;\begin{array}{c}&#xA; x &amp;amp; y&#xA;\end{array}&#xA;\right).\left(&#xA;\begin{array}{cc}&#xA; \frac{\partial ^2g}{\partial x^2} &amp;amp; \frac{\partial ^2g}{\partial x\, \partial y} \\&#xA; \frac{\partial ^2g}{\partial x\, \partial y} &amp;amp; \frac{\partial ^2g}{\partial y\, ^2}&#xA;\end{array}&#xA;\right).\left(&#xA;\begin{array}{cc}&#xA; x \\&#xA; y&#xA;\end{array}&#xA;\right)+\left(&#xA;\begin{array}{cc}&#xA; \frac{\partial g}{\partial x} &amp;amp; \frac{\partial g}{\partial y}&#xA;\end{array}&#xA;\right).\left(&#xA;\begin{array}{c}&#xA; x \\&#xA; y&#xA;\end{array}&#xA;\right)+g(0,0)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second order derivative matrix &lt;span class=&quot;math-container&quot;&gt;$\left(&#xA;\begin{array}{cc}&#xA; \frac{\partial ^2g}{\partial x^2} &amp;amp; \frac{\partial ^2g}{\partial x\, \partial y} \\&#xA; \frac{\partial ^2g}{\partial x\, \partial y} &amp;amp; \frac{\partial ^2g}{\partial y\, ^2}&#xA;\end{array}&#xA;\right)$&lt;/span&gt; is called the &quot;Hessian matrix&quot;. It describes the 2nd order structure we're interested in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2nd order part of this function can be transformed into the sum of two parabolas &lt;span class=&quot;math-container&quot;&gt;$\lambda _1 x^2 + \lambda _2 y^2$&lt;/span&gt; rotated by some angle, by decomposing the Hessian matrix above to a rotation times a diagonal matrix of it's eigenvalues (&lt;a href=&quot;http://en.wikipedia.org/wiki/Matrix_decomposition#Eigendecomposition&quot; rel=&quot;noreferrer&quot;&gt;Matrix decomposition&lt;/a&gt;). We don't care about the rotation (we want to detect ridges in any orientation), so we're only interested in &lt;span class=&quot;math-container&quot;&gt;$\lambda _1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda _2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of shapes can this function approximation have? Actually, not that many:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NsI2J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To detect ridges, we want to find areas in the image that look like the last of the plots above, so we're looking for areas where the major eigenvalue of the Hessian is large (compared to the minor eigenvalue). The simplest way to detect that is just to calculate the major eigenvalue at each pixel - and that's what the ridge filter below does.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;http://en.wikipedia.org/wiki/Ridge_detection&quot; rel=&quot;noreferrer&quot;&gt;ridge filter&lt;/a&gt; will probably give better results. I've tried Mathematica's built in &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/RidgeFilter.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;RidgeFilter&lt;/code&gt;&lt;/a&gt; (which calculates the major eigenvalue of the Hessian matrix at each pixel) on your image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7hxwO.png&quot; alt=&quot;ridge filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there's only a single peak for every thin dark line. Binarizing and skeletonizing yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/b36mZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After pruning the skeleton and removing small components (noise) from the image, I get this final skeleton: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oLSEw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full Mathematica code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ridges = RidgeFilter[ColorNegate@src];&#xA;skeleton = SkeletonTransform[Binarize[ridges, 0.007]];&#xA;DeleteSmallComponents[Pruning[skeleton, 50], 50]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ADD:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not a Matlab expert, I don't know if it has a built in ridge filter, but I can show you how to implement it &quot;by hand&quot; (again, using Matematica). As I said, the ridge filter is the major eigenvalue of the Hessian matrix. I can calculate that eigenvalue symbolically in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{eigenvalue}=\text{Last}\left[\text{Eigenvalues}\left[\left(&#xA;\begin{array}{cc}&#xA; H_{\text{xx}} &amp;amp; H_{\text{xy}} \\&#xA; H_{\text{xy}} &amp;amp; H_{\text{yy}}&#xA;\end{array}&#xA;\right)\right]\right]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;=&gt; &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} \left(H_{\text{xx}}+H_{\text{yy}}+\sqrt{H_{\text{xx}}^2+4 H_{\text{xy}}^2-2 H_{\text{xx}} H_{\text{yy}}+H_{\text{yy}}^2}\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you have to do is calculate the second derivatives &lt;span class=&quot;math-container&quot;&gt;$H_{\text{xx}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H_{\text{xy}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H_{\text{yy}}$&lt;/span&gt; (using a sobel or derivative of gaussian filter) and insert them into the expression above, and you've got your ridge filter.&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="-1" LastEditDate="2019-12-10T18:55:43.497" LastActivityDate="2019-12-10T18:55:43.497" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="1737" PostTypeId="1" AcceptedAnswerId="1838" CreationDate="2012-03-16T06:17:00.473" Score="8" ViewCount="6154" Body="&lt;p&gt;I'm currently on a project of liver tumor segmentation. I segmented the liver using region growing, and I have to assess how accurate the result is.  I recently learnt that there are certain metrics for assessing the accuracy of the region growing algorithm segmentation, like Tanimoto Coefficient, Correlation, etc. But I don't know how to implement them in Matlab. Check out &lt;a href=&quot;https://stackoverflow.com/questions/9553204/tanimoto-coefficient-using-matlab&quot;&gt;https://stackoverflow.com/questions/9553204/tanimoto-coefficient-using-matlab&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1094" LastEditorUserId="440" LastEditDate="2017-06-21T14:43:24.273" LastActivityDate="2020-03-28T12:22:28.530" Title="How do I evaluate the performance of a segmentation algorithm?" Tags="|image-processing|image-registration|segmentation|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1738" PostTypeId="1" AcceptedAnswerId="1836" CreationDate="2012-03-16T14:42:08.540" Score="10" ViewCount="2021" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tJrEZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this extremely distorted and stained image &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to remove this stain ? Could image inpainting help ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT : Another image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P0aBl.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying anisotropic diffusion and representing image with imagesc(MATLAB)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zbpaP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried inpainting however the result isn't good enough &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Sb5AB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there anyway i could improve this output?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="654" LastEditDate="2012-03-18T08:53:55.237" LastActivityDate="2012-03-29T01:50:02.087" Title="How to remove stains from images?" Tags="|matlab|image-processing|" AnswerCount="1" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="1739" PostTypeId="1" AcceptedAnswerId="1743" CreationDate="2012-03-16T16:42:01.923" Score="14" ViewCount="2889" Body="&lt;p&gt;When you perform the Haar wavelet transform, you take the sums and differences, then at each stage, you multiply the entire signal by $\small\sqrt2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When taking the inverse transform, you multiply the signal by $\frac{1}{\sqrt2}$ for each iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this &quot;normalization&quot; really represent?&lt;/p&gt;&#xA;" OwnerUserId="1040" LastEditorUserId="76" LastEditDate="2012-07-23T01:20:03.737" LastActivityDate="2015-04-02T13:50:25.700" Title="What does the normalization step of the Haar wavelet transform represent?" Tags="|wavelet|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1740" PostTypeId="1" CreationDate="2012-03-16T16:44:48.630" Score="3" ViewCount="13578" Body="&lt;p&gt;I am using matlab to study digital signalling and have come across a problem which i was wondering if anyone with more experience could help me with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to work derive the Fourier series of a triangle wave that i have generated, I just do not know how to actually go about this problem in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am generating a 100hz Triangle signal using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:1/10000:1;&#xA;f=100;&#xA;x1 = sawtooth(2*pi*f*t, 0.5);&#xA;plot(t,x1); &#xA;axis([0 0.10 -1 1]); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now how should i go about deriving the Fourier series of this signal, i am completely lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1107" LastActivityDate="2014-11-04T07:18:06.697" Title="The Fourier Series Of This Triangle Wave" Tags="|matlab|fourier-series|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1741" PostTypeId="1" AcceptedAnswerId="1745" CreationDate="2012-03-16T16:57:48.520" Score="2" ViewCount="1826" Body="&lt;p&gt;I have an image source emitting yellow light. Of course, when taking a picture with the light, the image has yellowness overall. How can I remove that color of light from the image? I have another picture of only background with the yellow light. Is there any way to subtract the image from the former one? Thanks &lt;/p&gt;&#xA;" OwnerUserId="1011" LastActivityDate="2012-03-16T17:40:41.080" Title="how to remove color of light source?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1742" PostTypeId="2" ParentId="1740" CreationDate="2012-03-16T17:17:37.793" Score="-1" Body="&lt;p&gt;I assume you want to calculate the FFT of this signal in MATLAB? This would be like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N_fft = 2^15; %Just an FFT size&#xA;x1_fft = fft(x1, N_fft); %Take the FFT.&#xA;plot(abs(x1_fft));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-03-16T19:18:10.473" LastActivityDate="2012-03-16T19:18:10.473" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1743" PostTypeId="2" ParentId="1739" CreationDate="2012-03-16T17:21:42.677" Score="13" Body="&lt;p&gt;As I understand it, the normalization is because the Haar wavelet conserves energy of the signal. In that, when you take signal from one domain to another, you aren't supposed to &lt;em&gt;add&lt;/em&gt; energy to it, (although conceivably you might lose energy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The normalization is just a way to ensure that the energy of your Haar-transformed signal in the Haar-domain has the exact same energy as your signal in the original domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively speaking, Haar, Fourier, etc, are all just basis transformations, which intuitively just mean that you are looking at the signal in a different way, (technically, through a different set of bases). Therefore, if all you are doing is looking at a signal differently, its energy cannot/should not change.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="29" LastEditDate="2015-04-02T13:50:25.700" LastActivityDate="2015-04-02T13:50:25.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1744" PostTypeId="2" ParentId="1659" CreationDate="2012-03-16T17:23:04.940" Score="6" Body="&lt;p&gt;I saw the link of the paper (of SS Kumar) you referred and the link where you got the code (HIPR) are two different algorithms - even though both sounds like &lt;em&gt;Adaptive Thresholding&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First i would like to tell you the difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the HIPR method,&lt;/strong&gt; a general assumption is essentially 2 class level image - i.e. foreground and background. In any 2 class thresholding, one expects 2 peaks or regions within the image histogram, specifically background vs. forground, text vs. white paper. If you &lt;em&gt;somehow&lt;/em&gt; found an optimal valley point in the histogram - you get cleanest division. Here is how the histogram may look like :&lt;br&gt;&#xA; &lt;img src=&quot;https://i.stack.imgur.com/UIlrP.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this valley point may be slightly shifting around the locally. There are good examples of lighting variations given there. Hence, this optimal valley point exists everywhere but slightly varies spatially, hence a universal threshold would fail. Hence, the valley point (threshold) is computed on every local region. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SS Kumar's paper's method&lt;/strong&gt; and more specifically the class of images you are dealing with, is &lt;em&gt;multi-class&lt;/em&gt; (multiple objects each with different intensity band and spread). In this cases, histograms are multi-modal, i.e. it has many peaks and valleys and presumably each peak correspond to different object, yet it may be even more complex. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The histogram might just look like this: (this is the same image as in paper). &#xA;&lt;img src=&quot;https://i.stack.imgur.com/xQF4n.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the above 2 class approach will simply fail because there is no one good valley. Which is why your first image you posted looks like black/white dots all around. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The meaning of &lt;em&gt;Adaptive Thresholding&lt;/em&gt; here, implies that you need to identify the correct peak and the band of gray scale which covers most intensities of the lever and other objects are in stark contrasts which allows &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What should you do?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of, if it is compulsory to use Adaptive thresholding, find the histogram and see what intensity range and then for a threshold of left or to the right are the intensity boundaries which pixels should be discarded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you can use Region Growing or split and merge algorithm. Refer to this question for some information: &lt;a href=&quot;https://dsp.stackexchange.com/questions/1718/what-segmentation-methods-can-be-used-for-simple-images/1720#1720&quot;&gt;What segmentation methods can be used for simple images?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-03-16T17:23:04.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1745" PostTypeId="2" ParentId="1741" CreationDate="2012-03-16T17:40:09.317" Score="4" Body="&lt;p&gt;Do you want to remove the Yellow backgorund or make the Yellow light white?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to color correct the image so that Yellow appears white then simply measure the R,G,B values of 'yellow', calculate the ratio between them. Then scale all the pixels in your image by that ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically you would assume that green = brightness and just calculate red/green and blue/green then scale the red/blue pixels and just scale green to leave the overall brightness unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_balance&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Color_balance&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-03-16T17:40:09.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1746" PostTypeId="2" ParentId="1741" CreationDate="2012-03-16T17:40:41.080" Score="3" Body="&lt;p&gt;The operation you need to perform is called &lt;strong&gt;white balance&lt;/strong&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_balance&quot; rel=&quot;nofollow&quot;&gt;color balance&lt;/a&gt;. &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_balance#Mathematics_of_color_balance&quot; rel=&quot;nofollow&quot;&gt;Several algorithms are described in the article&lt;/a&gt;. An important proviso is that the light source be approximately white, not merely have a low color temperature. If it really is off-white you might need a more sophisticated solution.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-03-16T17:40:41.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1747" PostTypeId="2" ParentId="1740" CreationDate="2012-03-16T18:10:25.397" Score="2" Body="&lt;p&gt;Check out Wikipedia's &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow&quot;&gt;Fourier Series&lt;/a&gt; page.  Their &quot;Example 1&quot; shows how to derive the Fourier series of a sawtooth wave.  All you have to do is normalize the results for your particular time and amplitude values.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-03-16T18:10:25.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1748" PostTypeId="1" AcceptedAnswerId="1819" CreationDate="2012-03-16T18:24:33.460" Score="10" ViewCount="12187" Body="&lt;p&gt;I am having a hard time understanding how to calculate the data rate when leveraging chroma-subsampling in e.g. a Y'UV image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following examples for a calculation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image resolution: &lt;code&gt;352*288&lt;/code&gt; &#xA;Frequency: 25 fps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;strong&gt;(4:4:4)&lt;/strong&gt; the example calculation goes as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;(352px * 288px) * 3 color channels * 25 fps * 8 bit = 60 825 600 bit/s&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now comes &lt;strong&gt;(4:2:0)&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;(352px*288px) * 1.5 color channels * 25 * 8 = 30 412 800 bit/s&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, trying to transfer this example to e.g. &lt;strong&gt;(4:1:1)&lt;/strong&gt; I realized I am not sure whether I have a correct understanding how the ratio of &lt;strong&gt;1.5 color channels&lt;/strong&gt; is being calculated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first guess for the calculation was in case of (4:2:0): &#xA;&lt;code&gt;2/4*3=1.5 color channels&lt;/code&gt;&lt;br&gt;&#xA;Likewise for (4:1:1) I would calculate the ratio for the color channels as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1/4*3=0.75 color channels&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am simply not sure whether this would be the correct way to go.&lt;br&gt;&#xA;As an alternative, I was thinking along following lines: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;color channels (4:1:1): &lt;code&gt;1 Y' + 1/4 UV = 1.25 color channels&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now which would be the correct way of doing this properly?&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2016-02-25T12:35:13.067" LastActivityDate="2018-12-19T12:25:21.890" Title="Chroma-Subsampling: How to properly calculate the data-rate" Tags="|image-processing|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1750" PostTypeId="2" ParentId="1729" CreationDate="2012-03-16T21:24:41.093" Score="17" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I apply a window function like Hamming or Lanczos to a signal, using its coefficients?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Just multiply, point-by-point.&lt;/p&gt;&#xA;" OwnerUserId="64" LastActivityDate="2012-03-16T21:24:41.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1751" PostTypeId="1" CreationDate="2012-03-16T23:43:28.720" Score="4" ViewCount="2300" Body="&lt;p&gt;I am currently working on learning DSP and for my course we use Matlab. I have been tasked with designing a low-pass filter using SPTool with the following specification:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A Low-Pass Kaiser Window FIR filter with a cut-off at 200hz.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now, when i open the SPTool and choose &quot;new&quot; i get the filter design and analysis window. I use the following settings&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Response Type = &quot;Lowpass&quot;&lt;/li&gt;&#xA;&lt;li&gt;Design Method = &quot;FIR&quot; and &quot;Window&quot;&lt;/li&gt;&#xA;&lt;li&gt;Window = &quot;Kaiser&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would like to know which values i should put into the &quot;Fs&quot; and &quot;FPass&quot; fields. The signal i am applying this filter to is a periodic 100hz wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any feedback.&lt;/p&gt;&#xA;" OwnerUserId="1111" LastActivityDate="2012-03-19T21:15:10.847" Title="Designing A Filter Using SPTool In Matlab" Tags="|filters|matlab|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1752" PostTypeId="2" ParentId="1751" CreationDate="2012-03-16T23:53:14.237" Score="2" Body="&lt;p&gt;John Smith, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are designing a low pass filter, which means that your filter will be applied, (convolved) against a signal, whereby it will attenuate certain frequencies, and leave other frequencies more or less untouched. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in a low pass filter, generally that means that you will filter out (heavily attenuate) frequencies that are 'high'. Your $f_{pass}$ just quantifies this for you. How high is high? Well, if you want a 'cutoff' at 200 Hz, then that generally means you want to keep frequencies at roughly 200 Hz and below, so pick $f_{pass}$ to be 200 Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But bear in mind, you usually have a specification about transition bandwidth. If your filter is infinitely sharp, you can say that you accept all frequencies less than 200, and attenuate all frequencies above 200. Realistically however you might want to accept all frequencies less than say, 130, and then from 130 to 200 you are transitioning, and then heavily attentuate all frequencies greater than 200. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the sampling rate, that is really dependent on your simulation. If you pick 10,000 Hz as your sampling rate, then you should make sure that when you use your filter on a signal, that it too was sampled at 10,000 Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is good that you are using MATLAB. It is a very powerful tool in understanding DSP concepts.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-03-19T21:15:10.847" LastActivityDate="2012-03-19T21:15:10.847" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1753" PostTypeId="2" ParentId="1751" CreationDate="2012-03-17T02:04:22.603" Score="2" Body="&lt;p&gt;&quot;Fs&quot; should be set to the sample rate of your input signal.  Hopefully you know what the sample rate is.  If you don't, say something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need the cutoff frequency, &quot;Fc&quot;, to be 200 Hz.  That means all signal content at 200 Hz and above will be heavily attenuated.  You need to keep the signal at 100 Hz, so 100 Hz needs to be inside the pass band (the frequency range that the filter doesn't attenuate).  You could make &quot;Fpass&quot; (the highest frequency that your filter will &quot;pass&quot; through) 100 Hz, but I would put a little margin in and make it 120 Hz, or something like that.  I'm not familiar with SPTool, but you'll probably need to tell it how much to attenuate the stop band frequencies.  You can put anything, but usually 50 dB or more is good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency range in between your pass band and the stop band is the &quot;transition band&quot;.  The bigger you make the transition band (relative to the pass band), the easier it is for your filter to do a good job of attenuating the stop band without introducing distortions in your pass band.  So that would be an argument for setting your pass band limit, Fpass, to 100 Hz, which would make your transition band 100 Hz wide.  As you are hopefully starting to see, designing a filter involves a lot of tradeoffs.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-03-17T20:41:58.850" LastActivityDate="2012-03-17T20:41:58.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1754" PostTypeId="1" AcceptedAnswerId="1755" CreationDate="2012-03-17T06:27:31.427" Score="3" ViewCount="1027" Body="&lt;p&gt;I'm trying to implement a simple steganography algorithm (similar to JSteg algorithm) for hiding data in LSB of DCT coefficients in Matlab, and I ran into a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;a.&lt;/strong&gt; I apply DCT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;b.&lt;/strong&gt; modify LSB of coefficients different than 1 and 0 except the first&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;c.&lt;/strong&gt; apply inverse dct&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have to save the result block to the output image file, and in the rounding process from double to int some coefficients are lost  and I don't obtain the exact coefficients at extraction phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked at the C sources of JSteg and its DCT implementation is based on an algorithm described by  C. Loeffler, A. Ligtenberg and G. Moschytz, &lt;code&gt;&quot;Practical Fast 1-D DCT Algorithms with 11 Multiplications&quot;&lt;/code&gt;. This program works correctly, so I'm wondering if implementing this will also solve my problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if there's another way to deal with the rounding problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="1112" LastEditorUserId="21075" LastEditDate="2020-05-09T16:22:22.493" LastActivityDate="2020-05-09T16:22:22.493" Title="DCT Steganograhy" Tags="|image-processing|dct|steganography|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1755" PostTypeId="2" ParentId="1754" CreationDate="2012-03-17T09:38:08.370" Score="4" Body="&lt;p&gt;Whenever you do the inverse DCT transform to get back to the image you are going to have a floating point result.  That is unavoidable.  Assuming the image format you are using requires integer values (not an image guy, so I'm not sure if there are any formats that allow floating point values- probably not) then rounding is unavoidable.  Rounding means losing information, which means that it is impossible to avoid the possibility of the DCT LSBs being affected, using the method that you describe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could recover meaningful information by making larger changes in the DCT values, but that also means that the change to the image would be greater.  You could perhaps recover useful information through the use of &lt;a href=&quot;http://en.wikipedia.org/wiki/Forward_error_correction&quot; rel=&quot;nofollow&quot;&gt;forward error correction (FEC) codes&lt;/a&gt;, but you would need to have a better understanding of the error characteristics before you could answer that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I did a little research on &lt;a href=&quot;http://en.wikipedia.org/wiki/JPEG&quot; rel=&quot;nofollow&quot;&gt;JPEG&lt;/a&gt; and &lt;a href=&quot;http://www.guillermito2.net/stegano/jsteg/index.html&quot; rel=&quot;nofollow&quot;&gt;JSTEG&lt;/a&gt; and I think (though I could be mistaken) that you misunderstand what is going on.  JSTEG works on JPEG files.  In order to do its compression, JPEG encoders DCT transform the image (starting with the luminance/chroma model, rather than RGB) and keep all the luminance information while essentially tossing all but the low-frequency chroma information.  &lt;em&gt;This works as compression because the file stores the DCT values, not the direct image values&lt;/em&gt; (it's a little more complex than that, but close enough to the truth for this discussion).  Thus, the fact that the inverse transform wipes out your LSBs doesn't matter.  In fact, it is probably a plus.  For the purposes of steganography, you get the steganography bits from the file itself, not the decoded image.  Thus, the recipient of the hidden bits has access to the DCT values with their LSB payload.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-03-17T09:58:34.630" LastActivityDate="2012-03-17T09:58:34.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1756" PostTypeId="2" ParentId="1667" CreationDate="2012-03-17T11:56:01.493" Score="1" Body="&lt;p&gt;If you have a time series of images, I recommend the &lt;a href=&quot;http://www.robots.ox.ac.uk/~misard/condensation.html&quot; rel=&quot;nofollow&quot;&gt;CONDENSATION algorithm&lt;/a&gt; for the interpolation of curves (see also the &lt;a href=&quot;http://en.wikipedia.org/wiki/Condensation_algorithm&quot; rel=&quot;nofollow&quot;&gt;wikipedia page&lt;/a&gt;). There are a number of implementation available, notably in &lt;a href=&quot;http://opencv.willowgarage.com/documentation/c/motion_analysis_and_object_tracking.html#cvcondensation&quot; rel=&quot;nofollow&quot;&gt;opencv&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2012-03-17T11:56:01.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1757" PostTypeId="2" ParentId="1679" CreationDate="2012-03-17T12:03:08.660" Score="2" Body="&lt;p&gt;To add some perspective, you could go back to the probabilistic interpretation of correlation.&#xA;Remember that the correlation is used because it measures the degree of similarity under some linear generative model of the signal knowing the template (additive gaussian noise). The autocorrelation gives a measure of the log-Probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To go back to your question, there are a number of free parameters, notably the variance of noise, and this relates to your choice of normalisation.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2012-03-17T12:03:08.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1758" PostTypeId="1" AcceptedAnswerId="1760" CreationDate="2012-03-17T17:59:18.120" Score="9" ViewCount="7158" Body="&lt;p&gt;I have started with Matlab and Digital Image Processing. I am trying to do Fingerprint recognition. I found many research papers regarding this but I am unsure where to start. Concisely, what is the most basic approach/algorithm for doing fingerprint recognition ?&lt;/p&gt;&#xA;" OwnerUserId="1115" LastEditorUserId="440" LastEditDate="2012-04-09T08:13:22.177" LastActivityDate="2019-11-01T22:10:58.810" Title="How to get started with fingerprint recognition?" Tags="|matlab|algorithms|fingerprint-recognition|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1759" PostTypeId="1" CreationDate="2012-03-17T18:24:35.703" Score="10" ViewCount="6633" Body="&lt;p&gt;So I'm trying to decide whether the cosine part is intended to be plugged in for $z$ or whether it is strictly part of $h[n]$. (the number a lies in the open unit disk) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean I was pretty sure it was all part of $h[n]$ but then upon performing the z-transform I get this rational function &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1 - a\cos(2\pi\frac{f_0}{F_s})z^{-1}}{1-2a\cos(2\pi\frac{f_0}{F_s})z^{-1} + a^2z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is then I'm supposed to evaluate the poles and zeros and if you just ignore the cosine parts you get this really nice rational expression which factors and simplifies down to $\displaystyle\frac{z}{z-a}$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that has gotten me thinking that maybe I'm not understanding things correctly and the cosine portion is supposed to be plugged in for $z$ or something.  Can anyone clarify this for me? &lt;/p&gt;&#xA;" OwnerUserId="1035" LastEditorUserId="80" LastEditDate="2013-05-03T11:46:17.167" LastActivityDate="2019-08-21T09:07:13.593" Title="Finding the z-transform of $h[n] = a^n\cos(2\pi \frac{n}{F_s}f_0)$ for $n ≥ 0$ and zero for $n &lt; 0$" Tags="|z-transform|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1760" PostTypeId="2" ParentId="1758" CreationDate="2012-03-17T20:07:57.863" Score="5" Body="&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/4239-fingerprint-recognition-system&quot;&gt;This&lt;/a&gt;  may help you.&#xA;Also, everything related to fingerprinting in &lt;a href=&quot;http://www.comp.hkbu.edu.hk/~vincent/resPaper.htm&quot;&gt;here&lt;/a&gt;.&#xA;I think is a good documentation to start with and view some source code. Nevertheless, you should learn some other algorithms before you start coding.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastActivityDate="2012-03-17T20:07:57.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1761" PostTypeId="1" CreationDate="2012-03-17T20:27:16.263" Score="10" ViewCount="306" Body="&lt;p&gt;On &lt;a href=&quot;http://books.google.ca/books?id=hMvhjWxb0_MC&amp;amp;printsec=frontcover&amp;amp;source=gbs_atb#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;pages 57-60&lt;/a&gt; (preview was available last I checked, &lt;a href=&quot;https://i.stack.imgur.com/Tyfq8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;images here&lt;/a&gt; in case), there is a quincunx lattice transform described.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lattice:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;o • o • o • o •&#xA;• o • o • o • o&#xA;o • o • o • o •&#xA;• o • o • o • o&#xA;o • o • o • o •&#xA;• o • o • o • o&#xA;o • o • o • o •&#xA;• o • o • o • o&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically you do these Predict operations on the black points:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x[ m][n ] -= 1/4 * ( LEFT + RIGHT + DOWN + UP )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where $LEFT = x[ m ][ n-1 ]$, $RIGHT= x[m][n+1]$, $DOWN=x[m+1][n]$, $UP=x[m-1][n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then do updates on the white points:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x[ m][n] += 1/8 * ( LEFT + RIGHT + DOWN + UP )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you will never touch the black values again, so you effectively have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;o x o x o x o x&#xA;x o x o x o x o&#xA;o x o x o x o x&#xA;x o x o x o x o&#xA;o x o x o x o x&#xA;x o x o x o x o&#xA;o x o x o x o x&#xA;x o x o x o x o&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You turn your head 45 degrees to see this is just another rectangular lattice, and you label them odd/even again:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;o   o   o   o &#xA;  •   •   •   •&#xA;o   o   o   o &#xA;  •   •   •   •&#xA;o   o   o   o &#xA;  •   •   •   •&#xA;o   o   o   o &#xA;  •   •   •   •&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You repeat this again and again, until you have 1 &quot;average&quot; left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in the Haar wavelet transform, there is a &lt;a href=&quot;https://dsp.stackexchange.com/q/1739/1040&quot;&gt;power loss in each level that we correct with a normalization factor of √2&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, there is a computed power loss factor of about 1.4629 after the first step of the first level (found by running 5,000,000 transforms on random data and finding the ratio of powerBefore/powerAfter and averaging).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to show/compute how this power loss is found, and where the 1.46 number comes from.&lt;/p&gt;&#xA;" OwnerUserId="1040" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2020-07-16T11:43:00.323" Title="What is the normalization factor for the quincunx lattice wavelet transform, and how do you find it?" Tags="|wavelet|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1762" PostTypeId="1" AcceptedAnswerId="1769" CreationDate="2012-03-17T22:21:26.547" Score="4" ViewCount="1875" Body="&lt;p&gt;Tables of common Discrete-Time Fourier Transform pairs list the transform of a sine wave:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \sin(\omega_0\ n) $ and its transform:&#xA;$ -j\pi\ [d( \omega\ - \omega_0\ ) - d( \omega\ + \omega_0\ )] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the cosine: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \cos(\omega_0\ n) $ and its transform: $ \pi\ [d( \omega\ - \omega_0\ ) + d( \omega\ + \omega_0\ )] $&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;How might the results differ if the sin or cosine is causal? That is, I would like to determine the Fourier Transform of the following (sin or cosine multiplied by the unit step):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \sin(\omega_0\ n) u[n] $ or  $ \cos(\omega_0\ n) u[n] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So regarding the DTFT of the signals above, is the only method to realize that multiplication in the time domain is convolution in the frequency domain? Or is there a more simple rule-of-thumb, or property, of the Fourier Transform that I am missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is not homework, but it is for studying, so it would be helpful to include resources along with answers.) &lt;/p&gt;&#xA;" OwnerUserId="38" LastEditorUserId="6" LastEditDate="2012-03-18T17:44:29.537" LastActivityDate="2012-03-19T17:31:47.080" Title="How does causality (i.e. unit step) affect the DTFT of a sine or cosine wave?" Tags="|discrete-signals|fourier-transform|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1763" PostTypeId="1" CreationDate="2012-03-19T07:30:24.493" Score="1" ViewCount="444" Body="&lt;p&gt;&lt;strong&gt;Statement :&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;BY 1D Discrete Fourier transform, obtaining its spectrum and  using first few components of  spectrum to describe $g(r)$ , where $g(r)$ is probably of pixel values $r$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question :&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does spectrum get effect by increasing or decreasing of fourier co-efficient ? &#xA;I understand the Fourier Co-efficient helps to generate different shapes of one object depending on the number of fourier co-efficient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be effect on spectrum with different Fourier co-efficient ?&#xA;I think our spectrum will get change depending on fourier -coefficient . &#xA;like if you describe a shape with 4 fourier co-effcient then the spectrum will be drawn by considering only 4 components . AS you increase the fourier co-efficent I think spectrum shape  will also  increase . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am wrong in understanding then please clear it to me , thanks &lt;/p&gt;&#xA;" OwnerUserId="1096" LastEditorUserId="1473" LastEditDate="2012-06-29T11:04:10.690" LastActivityDate="2012-06-29T11:04:10.690" Title="Fourier descriptor" Tags="|fourier-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1764" PostTypeId="2" ParentId="1763" CreationDate="2012-03-19T14:22:04.567" Score="1" Body="&lt;p&gt;You should think that Fourier coefficients are just weights of each of the components of its Fourier Series. That is, a periodic function can be decomposed in a weighted sum of sines and cosines. Those weights are the Fourier coefficients you are taking about. If you remove some of them, some frequencial components won´t be shown (you should take into account that each sine/cosine is a pair of deltas in the frequential spectrum).&lt;/p&gt;&#xA;" OwnerUserId="1051" LastActivityDate="2012-03-19T14:22:04.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1765" PostTypeId="1" AcceptedAnswerId="29928" CreationDate="2012-03-19T15:22:01.000" Score="5" ViewCount="635" Body="&lt;p&gt;I would like to obtain a good reference (or references) on the implementation of a wideband beamformer for a small planar (rectangular) array comprised of 4 rows by 6 columns, for 24 elements in total.  This is a passive acoustic array with air-coupled microphones; the array does not transmit.  Each element in the array has the same spacing distance.  Given discrete input signals from each element, I would like to compute the beamformer/beamsteering output for a beam at a particular azimuth and elevation.  I need to be able to compute multiple beams to electronically steer the array. Is it possible to compute multiple beams all at the same time?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose that I might need to use Fourier-domain techniques involving the FFT.  Are these techniques justified for my small array?  I've found an IEEE conference paper (http://www.curtistech.co.uk/papers/wideband.pdf or &lt;a href=&quot;http://dx.doi.org/10.1049/ic:19980121&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1049/ic:19980121&lt;/a&gt;) that may deal with this technique, but how would I apply this to a 2D planar rectangular array?  I am interested in the mathematics operating on discrete signals rather than  descriptions of the process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is an acoustic array, the elements are evenly spaced on a 4 rows by 6 columns grid.  The spacing between the elements is less than $\lambda/2$, where $\lambda$ is the minimum wavelength of the sound wave.  The wavelength range is between 3.31 cm and 331 cm.  This is a receiving array.  The target area should be in the far field of the array, but I am also wondering if it is possible to resolve signals in the near-field as well.&lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-03-20T15:50:14.423" LastActivityDate="2016-04-05T17:20:55.167" Title="Implementation of wideband beamformer for planar array" Tags="|discrete-signals|fourier-transform|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1766" PostTypeId="1" AcceptedAnswerId="1767" CreationDate="2012-03-18T04:32:58.117" Score="7" ViewCount="29377" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eXCST.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to segment this image using watershed to retrieve only the people in the image ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done the following so far :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculated a gradient&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZSuDs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Calculated the watershed transform &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0YH9G.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  clear;&#xA;I=imread('inpaint.jpg');&#xA;I=rgb2gray(I);&#xA;&#xA;hy = fspecial('sobel');&#xA;hx = hy';&#xA;Iy = imfilter(double(I), hy, 'replicate');&#xA;Ix = imfilter(double(I), hx, 'replicate');&#xA;gradmag = sqrt(Ix.^2 + Iy.^2);&#xA;&#xA;&#xA;figure, imshow(gradmag,[]), title('Gradient magnitude (gradmag)')&#xA;L = watershed(gradmag);&#xA;% Lrgb = label2rgb(L);&#xA; figure, imshow(L), title('Watershed transform of gradient magnitude (Lrgb)')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have been successful in apply the watershed &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6YOop.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Wanted to know can i outline my objects in the original image so that it appears segmented ?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="654" OwnerDisplayName="vini" LastEditorUserId="654" LastEditDate="2012-04-15T18:34:33.723" LastActivityDate="2012-10-20T23:34:39.407" Title="How to apply watershed to segment images using matlab?" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1767" PostTypeId="2" ParentId="1766" CreationDate="2012-03-18T12:49:48.457" Score="8" Body="&lt;p&gt;Recall that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Watershed_%28image_processing%29&quot;&gt;Watershed transform&lt;/a&gt; treats its input as a topographic map, and simulates flooding that topography with water. The &quot;catchment basins&quot; or &quot;Watershed regions&quot; are then the parts of the map which &quot;hold water&quot; without spilling into other regions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gradient magnitude is a poor segmentation function as-is; the noise and open contours lead to an extreme oversegmentation of the image. We can try a series of morphological operations with the intent of creating approximate foreground and background markers, and use these to remove the spurious parts of the gradient.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%# Normalize.&#xA;g = gradmag - min(gradmag(:));&#xA;g = g / max(g(:));&#xA;&#xA;th = graythresh(g); %# Otsu's method.&#xA;a = imhmax(g,th/2); %# Conservatively remove local maxima.&#xA;th = graythresh(a);&#xA;b = a &amp;gt; th/4; %# Conservative global threshold.&#xA;c = imclose(b,ones(6)); %# Try to close contours.&#xA;d = imfill(c,'holes'); %# Not a bad segmentation by itself.&#xA;%# Use the rough segmentation to define markers.&#xA;g2 = imimposemin(g, ~ imdilate( bwperim(a), ones(3) );&#xA;L = watershed(g2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works OK. You get both groups of people and their shadows as regions, with a little bit of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you elaborate on your goals? That is, will you be segmenting many different images or just images highly similar to this example? Do you need to ignore the shadows and separate the two overlapping people?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will try to update the answer if you respond to these questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Segmentation Overlay&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You asked how to overlay a segmentation. One way is to use the watershed lines to specify pixels in the original and set them to a bright color.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;boundaries = L == 0;&#xA;I(boundaries) = 255;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1119" OwnerDisplayName="reve_etrange" LastActivityDate="2012-03-18T13:02:48.600" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1768" PostTypeId="2" ParentId="1763" CreationDate="2012-03-19T17:15:43.263" Score="1" Body="&lt;p&gt;The higher Fourier coefficients are usually correlated with higher resolution detail in an image (more closely spaced contrasting pixels).  Removing the higher coefficients and using only low coefficients will thus describe an image with this kind of detail reduced, partially or completely removed (depending on the exact shape of the details), usually blurring the image somewhat.  Adding these coefficients may return this detail, depending on the coefficients returned, and how much of the removed detail is represented by the frequency bins of these coefficients.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-03-19T17:15:43.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1769" PostTypeId="2" ParentId="1762" CreationDate="2012-03-19T17:31:47.080" Score="0" Body="&lt;p&gt;Multiplication in the time domain is convolution in the frequency domain. The frequency response of a unit step has 1/frequency shape and it's pretty messy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you will see is that the overall frequency response is not a delta impulse anymore but that the lines widens and that the get &quot;skirts&quot;. These will bigger and more &quot;wiggly&quot; for the cosine than for the sine as the step function slices right through the maximum of the cosine. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-19T17:31:47.080" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1770" PostTypeId="2" ParentId="1765" CreationDate="2012-03-19T17:44:23.400" Score="3" Body="&lt;p&gt;You need the polar response of each individual array element. That is the transfer function of each element as a function of azimuth and elevation (and potentially distance if you want to operate in the near field). For many arrays the polar function will be the same for all elements, but it doesn't hurt to check.&#xA;To calculate the polar response of the whole array you need to do the following&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a spatial grid on which to calculate the polar response (azimuth and elevation) for the array&lt;/li&gt;&#xA;&lt;li&gt;For each point on the grid calculate distance, azimuth and elevation of this point AS SEEN BY THE INDIVIDUAL ELEMENT. This is in essence a transformation between two different spherical coordinate systems. &lt;/li&gt;&#xA;&lt;li&gt;Look up the single element transfer function for this direction in the single-element polar data. This may require interpolation between measured directions&lt;/li&gt;&#xA;&lt;li&gt;Apply this transfer function to the input signal of this individual element&lt;/li&gt;&#xA;&lt;li&gt;Make sure to properly account for the distances. That's typically done by a factor exp(-j*w*(r-r0)), where r is the distance between grid point and element and r0 and convenient normalization distance. A good choice is the distance at which the single element polar was measured.&lt;/li&gt;&#xA;&lt;li&gt;Some results over all elements&lt;/li&gt;&#xA;&lt;li&gt;Repeat for all points on the target polar grid&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-19T17:44:23.400" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1771" PostTypeId="1" CreationDate="2012-03-20T02:32:13.657" Score="3" ViewCount="176" Body="&lt;p&gt;So I think I have the answer I just want to make sure I'm doing things correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let a be in the open unit disk, $F_s &amp;gt; 0$, and $0&amp;lt;f_0 &amp;lt; \frac{F_s}{2}$.  Let $h[n]=0$ for $n &amp;lt; 0$ and $h[n] = a^n\cos(2\pi\frac{n}{F_s}f_0)$ for $n \geq 0$ be the impulse response of an LTI system. What is the output for the input sequence $x[n]=0$ for $n &amp;lt; 0$ and $x[n]=\cos(\frac{2\pi f_1 n}{F_s})$ for $n \geq 0$.  Assume that $0&amp;lt;f_1 &amp;lt; \frac{F_s}{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically I form the convolution sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[k] = \sum_{n=0}^{\infty}a^n \cos(2\pi\frac{n}{F_s}f_0) \cos(\frac{2\pi f_1 (n-k)}{F_s})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would take far too long to type it all up and latex but basically I split the cosines out into their exponential forms, FOIL them, pull the exponential functions which only depend on k outside of the infinite series, and then split up the series and perform the z-transform for each one to obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[k] = \frac{1}{4}e^{\tfrac{2\pi ikf_1}{F_s}}\left[ H \left(\frac{1}{a}e^{\tfrac{-2\pi ik(f_1-f_0)}{F_s}}\right) + H\left(\frac{1}{a}e^{\tfrac{-2\pi ik(f_0+f_1)}{F_s}}\right)\right] + \\ \frac{1}{4}e^{\tfrac{-2\pi ikf_1}{F_s}}\left[ H\left(\frac{1}{a}e^{\tfrac{-2\pi ik(f_0+f_1)}{F_s}}\right) + H\left(\frac{1}{a}e^{\tfrac{-2\pi ik(f_0-f_1)}{F_s}}\right)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct?  Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1035" LastEditorUserId="6" LastEditDate="2012-03-21T22:06:27.917" LastActivityDate="2012-03-21T22:06:27.917" Title="Finding the output for an input sequence" Tags="|discrete-signals|homework|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1772" PostTypeId="1" CreationDate="2012-03-20T08:07:30.837" Score="6" ViewCount="5469" Body="&lt;p&gt;I have a 3D binary image that I must fill all of the holes in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Fill holes 3D&quot; in this case, is basically a &lt;strong&gt;3D version&lt;/strong&gt; of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;BW2 = imfill(BW,'holes')&lt;/code&gt; from &lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/ref/imfill.html&quot; rel=&quot;nofollow&quot;&gt;MatLab&lt;/a&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I am not focusing on Matlab here. I am focusing on the algorithm in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I simply perform a &quot;flood fill 3D&quot; algorithm on all voxels at the border area of the 3D matrix. Anything not filled are holes so take this as a mask and remove all voxels on the real image with this mask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure, the algorithm works, but somehow, I feel this is inefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the fastest way to &quot;fill holes&quot; in 3D in this case?&lt;/p&gt;&#xA;" OwnerUserId="263" LastEditorUserId="263" LastEditDate="2012-03-20T15:46:11.453" LastActivityDate="2018-08-06T11:48:23.020" Title="The fastest way to &quot;fill holes&quot; in 3D?" Tags="|algorithms|3d|" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1774" PostTypeId="1" AcceptedAnswerId="1873" CreationDate="2012-03-20T12:08:47.777" Score="12" ViewCount="4560" Body="&lt;p&gt;I want to find a convolution matrix for a certain 2D kernel &lt;span class=&quot;math-container&quot;&gt;$ H $&lt;/span&gt;.&lt;br&gt;&#xA;For example, for image &lt;code&gt;Img&lt;/code&gt; of size &lt;span class=&quot;math-container&quot;&gt;$ m \times n $&lt;/span&gt; , I want (in MATALB):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T * Img = reshape(conv2(Img, H, 'same'), [], 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;T&lt;/code&gt; is the convolution matrix and &lt;code&gt;same&lt;/code&gt; means the Convolution Shape (Output Size) matched the input size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theoretically, H should be converted to a toeplitz matrix, I'm using the MATLAB function &lt;code&gt;convmtx2()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T = convmtx2(H, m, n);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yet &lt;code&gt;T&lt;/code&gt; is of size &lt;span class=&quot;math-container&quot;&gt;$ (m+2) (n+2) \times (mn) $&lt;/span&gt; as MATLAB's &lt;code&gt;convmtx2&lt;/code&gt; generates a convolution matrix which matches Convolution Shape of &lt;code&gt;full&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to generate the Convolution Matrix which matches using &lt;code&gt;conv2()&lt;/code&gt; with the &lt;code&gt;same&lt;/code&gt; convolution shape parameter?&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="128" LastEditDate="2019-01-17T09:03:28.843" LastActivityDate="2022-04-15T09:52:56.283" Title="Generate the Convolution Matrix of 2D Kernel for Convolution Shape of `same`" Tags="|image-processing|matlab|computer-vision|convolution|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1775" PostTypeId="1" AcceptedAnswerId="1781" CreationDate="2012-03-20T14:07:42.563" Score="10" ViewCount="3446" Body="&lt;p&gt;I am having trouble grasping some of the fundamental concepts of multirate filtering. I see from various sources that the basic building blocks of a multirate filter are the dyadic analysis and synthesis blocks. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Question 1&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The analysis block structure looks like the following, where the wide band signal is split into lowpass and highpass bands, each with a cutoff of FS/4 (Nyquist/2). Each band is then decimated by a factor of 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vimzH.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can you accurately represent the signal in the high frequency band when it contains frequency information above the Nyquist limit of the new decimated sample rate?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Question 2&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The analysis block structure looks like the following, where the sub-band signal is interpolated, re-filtered and then summed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/STTqu.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the purpose of the second filtering?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="1629" LastEditDate="2016-09-09T18:52:21.140" LastActivityDate="2016-09-09T18:52:21.140" Title="Understanding multirate filtering fundamentals" Tags="|filter-bank|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1776" PostTypeId="2" ParentId="1765" CreationDate="2012-03-20T15:57:49.193" Score="0" Body="&lt;p&gt;The following books/references seem to provide much of the mathematics associated with narrowband and wideband beamforming, particularly with applications in acoustics, radar, and signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Liu, W., and Weiss, S. 2010. &lt;em&gt;Wideband Beamforming: Concepts and Techniques&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Van Trees, H. &lt;em&gt;Detection, Estimation, and Modulation Theory, Part I, II, III&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Johnson, D., and Dudgeon, D. &lt;em&gt;Array Signal Processing: Concepts and Techniques&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Brandstein, M. &lt;em&gt;Microphone Arrays: Signal Processing Techniques and Applications&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) &lt;a href=&quot;http://cdn.intechweb.org/pdfs/18871.pdf&quot; rel=&quot;nofollow&quot;&gt;http://cdn.intechweb.org/pdfs/18871.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-03-20T16:45:04.190" LastActivityDate="2012-03-20T16:45:04.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1777" PostTypeId="1" CreationDate="2011-09-08T02:04:13.500" Score="4" ViewCount="3064" Body="&lt;p&gt;For exponential signals (sine or cosine), if the sampling frequency $f_s$ is equal to the length of signal, $N$, the magnitude of psd for each sine signal is proportional to amplitude in time domain, while if $f_s$ is not equal to length of signal $N$, for example here, $f_s=1000 \text{Hz}$, the magnitude of sine signals in psd (frequency domain) is not proportional to their original signal. The MATLAB code is provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you tell me the reason? Is this something related with leakage?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=256;&#xA;x0=zeros(N,1);&#xA;fs=1000;&#xA;idx = (0:(N-1))'; % Indices&#xA;f=20*[1 2 3 4];&#xA;A=[1 2 3 4];&#xA;K=4;&#xA;for ii=1:K&#xA;    x0=x0+A(ii)*exp(sqrt(-1)*2*pi*f(ii)*idx/fs);&#xA;end&#xA;X=fft(x0);&#xA;&#xA;figure;&#xA;plot(abs(X).^2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="Mike" LastEditorUserId="4682" LastEditDate="2013-07-06T01:58:53.773" LastActivityDate="2013-07-06T01:58:53.773" Title="Magnitude of Power Spectral Density with Different Sampling Frequency" Tags="|matlab|power-spectral-density|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1778" PostTypeId="2" ParentId="1777" CreationDate="2012-03-20T14:52:18.593" Score="4" Body="&lt;p&gt;I am not sure I understand your question, nevertheless, I would like to point out that matlab computes fft considering this expression:&#xA;$$&#xD;&#xA;D_{n}=\sum_{k=0}^{K-1}x(k)\cdot e^{-j\cdot n\cdot2\cdot\pi\cdot\frac{k}{K}} &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which as you know it misses a factor of $$\frac{1}{K} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is:&#xA;$$&#xD;&#xA;D_{n}=\frac{1}{K}\sum_{k=0}^{K-1}x(k)\cdot e^{-j\cdot n\cdot2\cdot\pi\cdot\frac{k}{K}} &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in your matlab code you should call:&#xA; X=fft(x0)/N;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0195110099&quot; rel=&quot;nofollow&quot;&gt;This&lt;/a&gt; book is great addressing this topic. Go to section 2.10 (Numerical Computation of D_n) on page 60, you will also find there some useful matlab code.&lt;/p&gt;&#xA;" OwnerUserId="1125" OwnerDisplayName="gmagno" LastActivityDate="2012-03-20T15:35:24.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1779" PostTypeId="1" CreationDate="2012-03-20T16:20:38.320" Score="9" ViewCount="519" Body="&lt;p&gt;What is the $\mathcal Z$-transform of the sequence $J_0(\alpha n)$ for $n \in \mathbb{Z}$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of zero$^{\rm th}$ order Bessel function $J_0(\alpha x)$ is known to be $\frac{2}{\sqrt{\alpha^2 - \omega^2}}$ for $|\omega| &amp;lt; \alpha$.  This has a pole at $\omega = \alpha$. Does this imply that the $\mathcal Z$-transform will also have a pole on the unit circle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I'm looking at involves discrete samples of Bessel function i.e. $J_0(n)$. How should I proceed to determine its $\mathcal Z$-transform? &lt;/p&gt;&#xA;" OwnerUserId="645" LastEditorUserId="1629" LastEditDate="2016-05-10T10:30:47.653" LastActivityDate="2016-05-10T10:31:11.670" Title="What is the $\mathcal Z$-transform of Bessel function $J_0(\alpha n)$ sequence" Tags="|fourier-transform|z-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1780" PostTypeId="1" AcceptedAnswerId="1788" CreationDate="2012-03-20T16:37:54.447" Score="9" ViewCount="2228" Body="&lt;p&gt;I have a question concerning object recognition, especially recognizing car-models! I am at the beginning of a work about identifying the same car-model in different images. At the moment I think one of the best algorithm for 3D object recognition is SIFT but after playing around a bit with a demo implementation I have the strange feeling this algorithm has some problems with shiny metal objects like cars, especially if they have different colors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know some work on this area in general some suitable algorithm for the task of finding the same car-model in different images?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help!&lt;/p&gt;&#xA;" OwnerUserId="969" LastEditorUserId="29" LastEditDate="2012-03-20T21:16:25.143" LastActivityDate="2012-03-21T09:38:59.373" Title="Good features / algorithms for recognizing car-models in images" Tags="|computer-vision|local-features|object-recognition|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1781" PostTypeId="2" ParentId="1775" CreationDate="2012-03-20T16:51:11.980" Score="8" Body="&lt;p&gt;I will answer question 2 first, and hopefully that will help explain what is going on with question 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you sample a baseband signal there are implicit aliases of the baseband signal at all integer multiples of the sampling frequency, as shown in the picture below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VwQ2j.png&quot; alt=&quot;Assymetric baseband signal w/ aliases&quot;&gt;&#xA;The solid image is the original baseband signal, and the aliases are represented by the dashed images.  I chose an assymetric (i.e. complex) signal to help demonstrate the inversion that happens at odd multiples of the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might ask, &quot;Do the aliases really exist?&quot;  It's a bit of a philosophical question.  Yes, in a mathematical sense they do exist, because all of the aliases (including the baseband signal) are indistinguishable from each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you upsample by inserting zeros in between the original samples, you are effectively increasing the sampling rate by the upsample rate.  So if you upsample by a factor of two (putting one zero in between each sample), you increase your sampling rate and the Nyquist rate by a factor of 2, resulting in the picture below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cRU0l.png&quot; alt=&quot;Upsampled assymetric baseband signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, one of the implicit aliases in the earlier image has now become explicit.  If you FFT the samples it will show up.  A non-rigorous proof that the DFT transform does not fundamentally change is given below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that you have the two explicit aliases, if you just want the baseband alias then you have to low-pass filter to get rid of the other alias.  Sometimes, though, people use the other aliases to do their modulating for them.  In that case you would high-pass filter to get rid of the baseband signal.  I hope that answers question 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 1 is basically the inverse of question 2.  Suppose that you are already in the situation shown in the second picture.  There are two ways to get the baseband signal that you want.  The first way is to low-pass filter (thereby getting rid of the higher alias) and then decimating by a factor of two.  That gets you to picture #1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second way is to high-pass filter (getting rid of the baseband alias) and then decimating by a factor of two.  The reason that this works is that you are intentionally aliasing the signal into the baseband, thus, once again, getting you to picture #1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why would you want to do it that way?  Because in most situations the signals will not be the same, so you can choose which signal you want, or do them both separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are studying multi-rate processing, I highly recommend getting &quot;Multirate Signal Processing for Communication Systems&quot; by Frederic Harris.  He does a really good job of explaining the theory without neglecting the math, and giving a lot of practical advice too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Intentionally sampling a signal at less than the Nyquist rate is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;noreferrer&quot;&gt;undersampling&lt;/a&gt;.  The following is my attempt at explaining mathematically why the FFT does not change when you upsample.  &quot;x[n]&quot; is the original set of samples, &quot;u&quot; is the upsampling factor, and &quot;x'[n]&quot; is the upsampled set of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{eqnarray*}&#xA;X[k] &amp;amp;=&amp;amp; \sum_{n=0}^{N-1} x[n]e^{-i2\pi kn/N}\\&#xA;X'[k] &amp;amp;=&amp;amp; \sum_{n=0}^{uN-1} x'[n]e^{-i2\pi kn/uN} , \{ &amp;amp;x&amp;amp;'[n] = 0, n \neq mu, m \in (0..N-1)\\&#xA;&amp;amp;x&amp;amp;'[n] = x[n/u], n = mu\\&#xA;&amp;amp;=&amp;amp; \sum_{n=0}^{N-1} x'[un]e^{-i2\pi kun/uN}\\&#xA;&amp;amp;=&amp;amp; \sum_{n=0}^{N-1} x[n]e^{-i2\pi kn/N}\\&#xA;&amp;amp;=&amp;amp;X[k]&#xA;\end{eqnarray*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apologies for the ugly formatting.  I am a LaTex noob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: I should have pointed out that the DFT's of x[n] and x'[n] are not truly identical.  The sample rate is higher, which as I explained in the earlier part of the answer, causes aliases to be &quot;exposed&quot;.  I was trying to point out in my non-mathematician way that the DFT's are, aside from the sample rate, the same.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-03-22T10:04:19.630" LastActivityDate="2012-03-22T10:04:19.630" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1782" PostTypeId="1" AcceptedAnswerId="1786" CreationDate="2012-03-20T19:44:17.023" Score="7" ViewCount="13950" Body="&lt;p&gt;I have a signal in a 1d vector X, and I need to remove 50Hz and its resonant frequencies. I've looked into using &lt;code&gt;fdesign.comb&lt;/code&gt; but I'm not sure how to apply that filter on my data (after building it using &lt;code&gt;design&lt;/code&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, I think I can also do this using &lt;code&gt;iircomb&lt;/code&gt; but again, I'm not sure how to exactly. If someone could step me through this (and how to then apply it to a signal X) it would be  appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1124" LastActivityDate="2012-04-17T19:28:07.673" Title="Creating a 50hz comb filter in MATLAB" Tags="|filters|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1783" PostTypeId="2" ParentId="1763" CreationDate="2012-03-20T20:10:11.200" Score="1" Body="&lt;p&gt;The Fourier transform is linear so it is not the absolute values of the co-efficients that determine the spectrum but their relatives values. Multiplying them all by a constant will merely change the amplitude, while zeroing one or more coefficients will have an effect --- suppressing those frequencies.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-03-20T20:10:11.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1784" PostTypeId="2" ParentId="1779" CreationDate="2012-03-20T20:25:32.250" Score="1" Body="&lt;p&gt;You can apply the definition of the $\mathcal Z$-transform to an equivalent expression of the Bessel function, or to an approximation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;equivalent&lt;/strong&gt; function can be:&#xA;\begin{align}&#xA;J_0(x) &amp;amp;= \frac 1\pi\cos\left(x\cos\phi\right)d\phi\\&#xA;&amp;amp;=\frac 1\pi\int_0^\pi\left(1-\frac{x^2\cos^2\phi}{2!}+\frac{x^4\cos^4\phi}{4!}-\frac{x^6\cos^6\phi}{6!}+\cdots\right)d\phi &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information about equivalent expressions is &lt;a href=&quot;http://www.efunda.com/math/bessel/bessel.cfm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastEditorUserId="1629" LastEditDate="2016-05-10T10:31:11.670" LastActivityDate="2016-05-10T10:31:11.670" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1785" PostTypeId="2" ParentId="1782" CreationDate="2012-03-20T21:34:41.820" Score="2" Body="&lt;p&gt;I needed to do something like this just recently! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some example Matlab code that you might like to use as a starting point . . .&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; &#xA;%% // Make a harmonic signal and add it to another sine&#xA;sr = 44100; &#xA;dt = 1/sr;&#xA;tAxis = dt:dt:2;&#xA;&#xA;freq = 50;&#xA;x = mean(sin (2*pi*freq*(1:10)'*tAxis))'; %Harmonic noise&#xA;x = x+ sin(2*pi*440*tAxis)';&#xA;&#xA;&#xA;%% // Fractional delay comb filter&#xA;rho = 0.95; %This sets how narrow the rejection is. Must be between 0 and 1&#xA;&#xA;delay = (sr/2)/freq - 1;&#xA;N = 2*floor(delay);&#xA;&#xA;&#xA;&#xA;%// LAGRANGE  h=lagrange(N,delay) returns order N FIR &#xA;%//          filter h which implements given delay &#xA;%//          (in samples).  For best results, &#xA;%//          delay should be near N/2 +/- 1.&#xA;n = 0:N;&#xA;h = ones(1,N+1);&#xA;for k = 0:N&#xA;    index = find(n ~= k);&#xA;    h(index) = h(index) *  (delay-k)./ (n(index)-k);&#xA;end&#xA;&#xA;&#xA;b = [1 -h];&#xA;a = [1 -rho*h];&#xA;&#xA;nfft = 2^14;&#xA;figure; freqz(b, a, nfft, 'half', sr)&#xA;&#xA;xf = filter(b,a,x);&#xA;&#xA;soundsc([x; xf],sr);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The script makes a 440 Hz sinusoid and adds 50 Hz harmonic noise. A 50 Hz comb filter is created using a fractional delay filter. THe signal is then filtered with the filter and the output is played as a sound before and after the filtering process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more detail try looking here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=951433&quot; rel=&quot;nofollow&quot;&gt;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=951433&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that this helps.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-03-20T21:34:41.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1786" PostTypeId="2" ParentId="1782" CreationDate="2012-03-20T21:52:15.617" Score="4" Body="&lt;p&gt;In order to use &lt;code&gt;fdesign.comb&lt;/code&gt; you have to do something like the following to specify the parameters of the filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D = fdesign.comb('notch','N,BW',8,.01); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but then you must generate the filter as you mentioned in your question.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H = design(D); % H is a DFILT&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you can then view the filter like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fvtool(H)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One way to apply the filter to your data is to use the &lt;code&gt;filter&lt;/code&gt; function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=filter(H.Numerator,H.Denominator,inArray)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My favorite way to design a filter I've never used is with &lt;code&gt;fdatool&lt;/code&gt; because you can play around with all of your parameters. Here is how I would do it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type fdatool at the command prompt and a window pops up&lt;/li&gt;&#xA;&lt;li&gt;Specify Notching in the dropdown that initially says Differentiator&lt;/li&gt;&#xA;&lt;li&gt;Inder IIR choose comb&lt;/li&gt;&#xA;&lt;li&gt;Input your parameters&lt;/li&gt;&#xA;&lt;li&gt;click Design Filter&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once you play around and it looks as you wish, you can either export the coefficients or generate the code that would create this filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To export coefficients&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;go to file and click export&lt;/li&gt;&#xA;&lt;li&gt;make note of the variable names and click export&lt;/li&gt;&#xA;&lt;li&gt;now you can use the filter command with &lt;code&gt;y = filter(num,den,data)&lt;/code&gt;;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To generate code&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;go to file and click generate MATLAB code&lt;/li&gt;&#xA;&lt;li&gt;save the file&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You see in this file something like the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 48000;  % Sampling Frequency&#xA;&#xA;N     = 10;    % Order&#xA;BW    = 1200;  % Bandwidth&#xA;Apass = 1;     % Bandwidth Attenuation&#xA;&#xA;[b, a] = iircomb(N, BW/(Fs/2), Apass);&#xA;Hd     = dfilt.df2(b, a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the line with &lt;code&gt;iircomb&lt;/code&gt; is what generates the filter coefficients, you can now use &lt;code&gt;y=filter(b,a,data)&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1102" LastEditorUserId="77" LastEditDate="2012-04-17T19:28:07.673" LastActivityDate="2012-04-17T19:28:07.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1787" PostTypeId="2" ParentId="1772" CreationDate="2012-03-21T03:18:16.640" Score="3" Body="&lt;p&gt;I don't have the privilege to comment, so I'm going write my comment as an answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing your function, as well as imfill in Matlab, performs the &quot;filling&quot; iteratively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two basic improvements to speed these kind of iterative functions up would be to 1. increase the seed points, i.e. using other possible locations in addition to the border area, maybe base on image intensity before the binerization process, or whatever characteristics the images have, and 2. try to parallelize your function (see Dirk-Jan Kroon's &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/19084-region-growing/content/regiongrowing.m&quot; rel=&quot;nofollow&quot;&gt;Region Growing function&lt;/a&gt; for an example).  If this doesn't speed things up, or you just have too many seed points, then I would suggest you start implementing a function that uses your GPU for parallel processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now there may be &quot;non-iterative&quot; functions that fill 3d holes... so I'll leave that to the experts here on dsp.se.  It would also be nice if you can show us a slice of your 3D image for a better understanding of what you are dealing with.&lt;/p&gt;&#xA;" OwnerUserId="274" LastEditorUserId="274" LastEditDate="2012-03-21T03:23:24.713" LastActivityDate="2012-03-21T03:23:24.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1788" PostTypeId="2" ParentId="1780" CreationDate="2012-03-21T09:38:59.373" Score="7" Body="&lt;p&gt;I would have a look at the so called &quot;bag of words&quot; or &quot;visual words&quot; approach. It is increasingly used for image categorization and identification. This algorithm usually starts by detecting robust points, such as SIFT points, in an image. The region around these found points (the 128 bit SIFT descriptor in your case) is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the most simple form, one can collect all data from all descriptors from all images and cluster them, for example using k-means. Every original image then has descriptors that contribute to a number of clusters. The centroids of these clusters, i.e. the visual words, can be used as a new descriptor for the image.  Basically you hope that the clusters an image its descriptors contribute to, is indicative of the image category. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, in the most simple case, you have a list of clusters, and per image, you count which of these clusters contained descriptors from that image and how many. This is similar to the Term Frequency/ Inverse Document Frequency (TD/IFD) method used in text retrieval. See this quick and dirty &lt;a href=&quot;http://dl.dropbox.com/u/24263410/visualwords_demo.m&quot;&gt;Matlab&lt;/a&gt; script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach is actively researched and there are many much more advanced algorithms around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The VLfeat website contains a nice more advanced &lt;a href=&quot;http://www.vlfeat.org/applications/apps.html#apps.caltech-101&quot;&gt;demo&lt;/a&gt; of this approach, classifying the caltech 101 dataset.  Also noteworthy, are results and software from &lt;a href=&quot;http://www.vision.caltech.edu/malaa/software/research/image-search/&quot;&gt;Caltech&lt;/a&gt; itself. &lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2012-03-21T09:38:59.373" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1789" PostTypeId="1" AcceptedAnswerId="1796" CreationDate="2012-03-21T10:38:17.490" Score="10" ViewCount="4301" Body="&lt;p&gt;I have $n$ discrete samples of a seismic signal $y[n]$:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/wFTiq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find local maxima in the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A naive test for if $y[n]$ is a maximum would be:&#xA;$$y[n]: maxima \textbf{ if } y[n] &amp;gt; y[n-1] \textbf{ and } y[n] &amp;gt; y[n+1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the maxima are probably located in between samples, e.g. there may be a maximum at $i=4.25$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to find maxima in between samples I believe that I need to interpolate $y[n]$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How do I find maxima using interpolation ?&lt;/li&gt;&#xA;&lt;li&gt;What form of interpolation should I use ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As you can see my signal is not very noisy, however it would be good if the method also did a bit of filtering so that the maxima exceed a treshold and have a certain width (no spikes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My biggest problem however is just to find peaks in between samples.&#xA;Any suggestions for a good way to do this ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any answers! &lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="1629" LastEditDate="2016-02-04T01:13:54.587" LastActivityDate="2021-09-23T01:09:27.617" Title="Finding local peaks in-between samples" Tags="|smoothing|interpolation|peak-detection|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1790" PostTypeId="2" ParentId="1777" CreationDate="2012-03-21T13:17:12.753" Score="5" Body="&lt;p&gt;The issue (beside the scaling) here is that your selected frequencies do not align with your FFT grid and that the energy of each complex exponential is smeared out over multiple FFT bins. Your frequency resolution is given by sample rate divide by FFT length. In your case that's 3.906 Hz. Only for frequencies that are an integer multiple of this will all energy fall into a single FFT bin. An easy way to achieve this is to bump the sample rate up to 1024 Hz. Then your frequency resolution is exactly 4 Hz and all your frequencies are an integer multiple of that. Once you fix the scaling as well, it works fine like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=256;&#xA;x0=zeros(N,1);&#xA;fs=1024; % Fix 1: get to exactly 4Hz frequency resolution&#xA;idx = (0:(N-1))'; % Indices&#xA;f=20*[1 2 3 4];&#xA;A=[1 2 3 4];&#xA;K=4;&#xA;for ii=1:K&#xA;    x0=x0+A(ii)*exp(sqrt(-1)*2*pi*f(ii)*idx/fs);&#xA;end&#xA;X=fft(x0);&#xA;&#xA;figure;&#xA;plot(abs(X)/N); % Fix 2: absolute value only, rescaled&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-21T13:17:12.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1791" PostTypeId="2" ParentId="1789" CreationDate="2012-03-21T13:27:38.653" Score="4" Body="&lt;p&gt;Try a lossy peak detector: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[n] = max(abs(x[n]),a*y[n-1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &quot;a&quot; is a number smaller than 1 that controls how fast the detector decays. It determines how close neighboring peaks can be without smooshing into a single one. Then do a threshold detection.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2012-03-22T00:27:02.307" LastActivityDate="2012-03-22T00:27:02.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1792" PostTypeId="1" CreationDate="2012-03-21T14:50:10.523" Score="0" ViewCount="157" Body="&lt;p&gt;I inherited the following FFT code to get the magnitude frequency response of a sample window. I understand what fft() does. What I don't understand are the lines marked with a &quot;???&quot;. What do they do? In particular the &quot;real[i]/real.length/2&quot; portion and the multiplication and division by 1000 portion.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double[] real = new double[_FFTSize];&#xA;double[] imaginary = new double[_FFTSize];&#xA;&#xA;loadDataIntoReal(real);&#xA;&#xA;fft(real, imaginary); // in-place FFT&#xA;&#xA;for (int i = 0; i &amp;lt; spectrum.length; i++)&#xA;{&#xA;    double reValue =((int)((real[i]/(real.length/2))*1000)/1000.0); // ???&#xA;    double imValue =((int)((imaginary[i]/(real.length/2))*1000)/1000.0); // ???&#xA;    double value = Math.sqrt(reValue * reValue + imValue * imValue);&#xA;    spectrum[i] = value;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each line seems to have a redundant multiplication and division by 1000. However, if I change the code to be the following, then I get slightly different floating-point results, so I guess they must provide some sort of precision.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    double reValue =(real[i]/(real.length/2));&#xA;    double imValue =(imaginary[i]/(real.length/2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="709" LastActivityDate="2012-03-22T19:25:02.983" Title="Help me understand this simple code snippet to get the magnitude frequency response" Tags="|fft|frequency-spectrum|frequency-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1793" PostTypeId="1" CreationDate="2012-03-21T13:58:44.413" Score="4" ViewCount="3898" Body="&lt;p&gt;I wrote a simple MFCC routine, using all the steps usually suggested in the literature with the exception of the pre-emphasis stage. How important is this stage?&#xA; Also, some authors suggest that using rectangular windows instead of triangular doesn't degrade MFCC performance (as long as the windows are overlapping) so any ideas regarding this particular subject are welcome.&lt;/p&gt;&#xA;" OwnerUserId="29648" OwnerDisplayName="dsp_user" LastEditorUserId="809" LastEditDate="2012-03-23T12:06:27.990" LastActivityDate="2012-03-23T12:21:03.417" Title="how important is the pre-emphasis stage in MFCC?" Tags="|audio|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1794" PostTypeId="2" ParentId="1792" CreationDate="2012-03-21T16:14:36.317" Score="1" Body="&lt;p&gt;It's probably a quantizer. It multiplies by 1000, converts to integer (hence the quantization), and then divides by 1000 again (in floating point). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this feels like awkwardly written code as it depends on operator precedence. I think typecast has precedence 3 with right-to-left associativity and division has precedence 5 with left-to-right associativity, and it's not entirely clear to me what comes first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the type cast happens before the division than it's quantizer (to 1/1000). If the division comes first, than it simply truncates the result to the nearest smaller whole number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be much cleaner if the last bracket would move in front of the division sign like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double reValue =((int)((real[i]/(real.length/2))*1000))/1000.0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If one was worried about efficiency and readability, one could also do something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// outside the loop&#xA;double scale = 1000/(realLength/2);&#xA;// inside the loop&#xA;double reValue =((int)(real[i]*scale))*.001;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2012-03-21T16:22:59.817" LastActivityDate="2012-03-21T16:22:59.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1795" PostTypeId="1" CreationDate="2012-03-21T20:46:25.477" Score="2" ViewCount="301" Body="&lt;p&gt;I'd like to apply a Kalman filter, using Octave, to financial data but due to the nature of the data it will be difficult to impossible to specific the process error in advance of applying the filter. Can anyone suggest a way to specify the process error online from the incoming data simultaneously with the calculation of the filter itself? I'm trying to adapt the code from &lt;a href=&quot;http://www.lce.hut.fi/research/mm/ekfukf/&quot; rel=&quot;nofollow&quot;&gt;this website&lt;/a&gt; to suit my purposes.&lt;/p&gt;&#xA;" OwnerUserId="260" LastActivityDate="2012-03-21T20:46:25.477" Title="Estimate process error for Kalman filter on financial data" Tags="|kalman-filters|online-processing|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1796" PostTypeId="2" ParentId="1789" CreationDate="2012-03-21T20:53:44.573" Score="7" Body="&lt;p&gt;&lt;em&gt;Getting a sub-sample resolution&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very cheap (in terms of code size) solution is just to upsample your signal. In matlab, this can be done with &lt;code&gt;interp(y ,ratio)&lt;/code&gt;. A slightly more complicated solution consists in naively detecting peaks ; and for each peak, fitting a parabola through y[peak - 1], y[peak], y[peak + 1] ; then using the point at which this parabola is maximal as the true peak position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Regarding peak detection&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bunch of techniques which help:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;As suggested by Hilmar, convolving the signal by a Gaussian or Hann window, the width of which is roughly equal to half the minimum interval you want to see between detected peaks. Since temporal accuracy seems essential to your application, make sure that you take into account the time delay introduced by the filtering, though!&lt;/li&gt;&#xA;&lt;li&gt;Subtract to your signal a median filtered version of itself (with a fairly large observation window) ; and divide the result by a standard-deviation filtered version of itself. This gets rid of trends and allows the thresholds to be expressed in units of standard deviations.&lt;/li&gt;&#xA;&lt;li&gt;For peak-picking, I formulate that using a &quot;top-hat&quot; filter. Define the top-hat filtered version of your signal as yt[n] = max(y[n - W], y[n - W + 1], ..., y[n + W - 1], y[n + W]) ; and use as peaks the points where y[n] == yt[n] and y[n] &gt; threshold.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All this can be very efficiently implemented in Matlab with a few passes of nlfilter.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-03-21T20:53:44.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1797" PostTypeId="2" ParentId="1793" CreationDate="2012-03-21T21:12:39.213" Score="5" Body="&lt;p&gt;Pre-emphasis is a way of compensating for the rapid decaying spectrum of speech. The experiment is worth trying on real data - you will find that the DCT basis is better at extracting a set of decorrelated coefficients when the spectrum has been whitened by the pre-emphasis filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This justification does not really apply in the case of music where the spectrum is more slowly decaying - it is not uncommon in MIR papers to see MFCC computed without the pre-emphasis filter. In the case of music, an argument for pre-emphasis is that it provides a very crude approximation of the outer ear filtering. Some feature extraction modules are indeed using MFCC-like features with a proper outer ear filter (response given by Terhard's formula) in place of pre-emphasis - For example, it looks like this is what is used by the Echo Nest analyzer.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-03-23T12:21:03.417" LastActivityDate="2012-03-23T12:21:03.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1798" PostTypeId="1" AcceptedAnswerId="1800" CreationDate="2012-03-21T23:18:28.187" Score="11" ViewCount="1327" Body="&lt;p&gt;I'm trying to write a C++ function that will return Gaussian random values, given their means and variances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a library function &lt;code&gt;rand()&lt;/code&gt;, which returns random numbers between &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;RAND_MAX&lt;/code&gt;. &lt;code&gt;RAND_MAX&lt;/code&gt; does not have a fixed value, but it is guarantied that it will be at least $2^{15}-1$. Its PDF is uniform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Central Limit Theorem to transform this &lt;code&gt;rand()&lt;/code&gt;into a Gaussian variable. What I'm exactly doing is a to call &lt;code&gt;rand()&lt;/code&gt; for a user specified times, then add up their return values, then shift its mean to the user specified mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6bCKT.png&quot; alt=&quot;Gaussian PDF&quot;&gt;&lt;br&gt;&#xA;In the plotting above, I called my Gaussian random generator for $10^7$ times, and plotted frequencies of its return values. As you see, its variance is huge, since it is created by sum of a lot of other random values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It successfully returns a Gaussian variable with a Gaussian PDF and with the specified mean value. However, the problem is its variance. I'm stuck at this point, because I don't know how to change its variance to the user specified value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code (incomplete for now; the parameter &quot;Variance&quot; is ignored):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;template &amp;lt;class T&amp;gt;&#xA;T Random::GetGaussian(T Mean /*= 0*/, T Variance /*= 1*/)&#xA;{&#xA;    T MeanOfSum = NUM_GAUSSIAN_SUMS / static_cast&amp;lt;T&amp;gt;(2);&#xA;    T Rand = 0;&#xA;    for (uint64_t i=0; i&amp;lt;NUM_GAUSSIAN_SUMS; i++)&#xA;    {&#xA;        Rand += static_cast&amp;lt;T&amp;gt;(rand()) / RAND_MAX;&#xA;    }&#xA;    return Rand - (MeanOfSum - Mean);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assume that &lt;code&gt;NUM_GAUSSIAN_SUMS&lt;/code&gt; is 100, and &lt;code&gt;RAND_MAX&lt;/code&gt; is 32767.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to change variance of the random variable according to the parameter of the function. My question is, how can I change variance of this random variable? How can I do it?&lt;/p&gt;&#xA;" OwnerUserId="1095" LastActivityDate="2016-05-18T11:10:07.110" Title="Implementing Gaussian random variable by using a uniform random variable" Tags="|random|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1799" PostTypeId="2" ParentId="1798" CreationDate="2012-03-21T23:53:06.467" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;how can I change variance of this random variable?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;By multiplication, of course. The variance of $c X$, where $c$ is the multiplicative constant and $X$ is your random variable, is $c^2$ the variance of $X$.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-03-21T23:53:06.467" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1800" PostTypeId="2" ParentId="1798" CreationDate="2012-03-22T01:30:14.927" Score="6" Body="&lt;p&gt;Your initial algorithm creates a random variable that's uniformly distributed between 0 and 1. The variance of that is 1/12. If you sum &lt;code&gt;NUM_GAUSSIAN_SUMS&lt;/code&gt; instances of that the variance will be &lt;code&gt;NUM_GAUSSIAN_SUMS/12&lt;/code&gt;. In order to get to a target variance, &lt;code&gt;V&lt;/code&gt;, you need to multiply the summed random variable with &lt;code&gt;sqrt(V*12/NUM_GAUSSIAN_SUMS)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side note, a template will work reasonable well for floats and doubles but there will be significant numerical problems with any fixed point type. &lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="1629" LastEditDate="2016-05-18T11:10:07.110" LastActivityDate="2016-05-18T11:10:07.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1802" PostTypeId="5" CreationDate="2012-03-22T09:47:33.413" Score="0" Body="&lt;h3&gt;What is OpenCV ?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;OpenCV is a library of optimized functions which are useful for Image processing, Computer Vision, etc. applications. Officially launched by Intel in 1999 and now supported by Willow Garage. Uses include: Human-Computer Interaction; Object Identification, Segmentation and Recognition; Face Recognition; Gesture Recognition; Motion Tracking, Motion Understanding; Stereo and Multi-Camera Calibration and Depth Computation; Mobile Robotics. More information may be found at &lt;a href=&quot;http://en.wikipedia.org/wiki/OpenCV&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;, &lt;a href=&quot;http://opencv.willowgarage.com/wiki/&quot; rel=&quot;nofollow&quot;&gt;on the project's wiki&lt;/a&gt; and &lt;a href=&quot;http://code.opencv.org/&quot; rel=&quot;nofollow&quot;&gt;on the project's developer site&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;What Questions should have this tag ?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Questions related to usage of OpenCV libraries can bear this tag. See also what have already been asked in &lt;a href=&quot;http://stackoverflow.com/questions/tagged/opencv&quot;&gt;StackOverflow&lt;/a&gt; for this tag.&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2012-03-22T12:37:09.327" LastActivityDate="2012-03-22T12:37:09.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1803" PostTypeId="4" CreationDate="2012-03-22T09:47:33.413" Score="0" Body="OpenCV (Open Source Computer Vision) is a cross-platform library of programming functions for real time computer vision." OwnerUserId="16" LastEditorUserId="16" LastEditDate="2012-03-22T12:37:11.870" LastActivityDate="2012-03-22T12:37:11.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1804" PostTypeId="1" CreationDate="2012-03-22T10:19:24.927" Score="12" ViewCount="17364" Body="&lt;p&gt;I'm on a project of liver tumor segmentation and classification. I used Region Growing and FCM for liver and tumor segmentation respectively. Then, I used Gray Level Co-occurence matrix for texture feature extraction. I have to use Support Vector Machine for Classification. But I don't know how to normalize the feature vectors so that I can give it as an input to the SVM. Can anyone tell how to program it in Matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To the GLCM program, I gave the tumor segmented image as input. Was I correct? If so, I think, then, my output will also be correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My glcm coding, as far as I have tried is,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('fzliver3.jpg');&#xA;GLCM = graycomatrix(I,'Offset',[2 0;0 2]);&#xA;stats = graycoprops(GLCM,'all')&#xA;t1= struct2array(stats)&#xA;&#xA;&#xA;I2 = imread('fzliver4.jpg');&#xA;GLCM2 = graycomatrix(I2,'Offset',[2 0;0 2]);&#xA;stats2 = graycoprops(GLCM2,'all')&#xA;t2= struct2array(stats2)&#xA;&#xA;I3 = imread('fzliver5.jpg');&#xA;GLCM3 = graycomatrix(I3,'Offset',[2 0;0 2]);&#xA;stats3 = graycoprops(GLCM3,'all')&#xA;t3= struct2array(stats3)&#xA;&#xA;t=[t1,t2,t3]&#xA;xmin = min(t); xmax = max(t);&#xA;scale = xmax-xmin;&#xA;tf=(x-xmin)/scale&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Was this a correct implementation? Also, I get an error at the last line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;stats = &#xA;&#xA;   Contrast: [0.0510 0.0503]&#xA;Correlation: [0.9513 0.9519]&#xA;     Energy: [0.8988 0.8988]&#xA;Homogeneity: [0.9930 0.9935]&#xA;t1 =&#xA;&#xA;Columns 1 through 6&#xA;&#xA;0.0510    0.0503    0.9513    0.9519    0.8988    0.8988&#xA;Columns 7 through 8&#xA;&#xA;0.9930    0.9935&#xA;stats2 = &#xA;&#xA;   Contrast: [0.0345 0.0339]&#xA;Correlation: [0.8223 0.8255]&#xA;     Energy: [0.9616 0.9617]&#xA;Homogeneity: [0.9957 0.9957]&#xA;t2 =&#xA;&#xA;Columns 1 through 6&#xA;&#xA;0.0345    0.0339    0.8223    0.8255    0.9616    0.9617&#xA;Columns 7 through 8&#xA;&#xA;0.9957    0.9957&#xA;stats3 = &#xA;&#xA;   Contrast: [0.0230 0.0246]&#xA;Correlation: [0.7450 0.7270]&#xA;     Energy: [0.9815 0.9813]&#xA;Homogeneity: [0.9971 0.9970]&#xA;t3 =&#xA;&#xA;Columns 1 through 6&#xA;&#xA;0.0230    0.0246    0.7450    0.7270    0.9815    0.9813&#xA;Columns 7 through 8&#xA;&#xA;0.9971    0.9970&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;t =&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Columns 1 through 6&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0510    0.0503    0.9513    0.9519    0.8988    0.8988&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Columns 7 through 12&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.9930    0.9935    0.0345    0.0339    0.8223    0.8255&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Columns 13 through 18&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.9616    0.9617    0.9957    0.9957    0.0230    0.0246&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Columns 19 through 24&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.7450    0.7270    0.9815    0.9813    0.9971    0.9970&#xA;&#xA;??? Error using ==&amp;gt; minus&#xA;    Matrix dimensions must agree.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The input images are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vqTCh.jpg&quot; alt=&quot;fzliver1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OuJVs.jpg&quot; alt=&quot;fzliver2&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2OWkd.jpg&quot; alt=&quot;fzliver3&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1094" LastEditorUserId="1094" LastEditDate="2012-03-27T10:15:36.657" LastActivityDate="2015-11-17T01:03:49.897" Title="How do I retrieve texture using GLCM and classify using SVM Classifier?" Tags="|image-processing|computer-vision|classification|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1805" PostTypeId="2" ParentId="1779" CreationDate="2012-03-22T11:19:10.103" Score="2" Body="&lt;p&gt;The Taylor expansion for the Bessel function of the first kind and 0th order is &#xA;$$&#xD;&#xA;J_{0}\left ( x \right )= \sum_{m=0}^{\infty }\frac{(-1)^{m}}{(m!)^{^{2}}}\left ( \frac{1}{2}x \right )^{2m}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(see &lt;a href=&quot;http://en.wikipedia.org/wiki/Bessel_function&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Bessel_function&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can basically approximate this as the Z-transform of a polynomial.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-22T11:19:10.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1806" PostTypeId="2" ParentId="1804" CreationDate="2012-03-22T13:35:33.107" Score="8" Body="&lt;p&gt;Are you using Matlab?  If so then you would either need the Bioinformatics Toolbox, that includes an SVM classifier, or you can download libsvm, which has Matlab wrappers for training and testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you are going to need some labeled data. Are you classifying liver tummors as opposed to healthy liver?  Then you would need images of liver tumors and healthy livers, each labeled as such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you need to compute some features. What those are, depends on the nature of the problem.  Texture features seem like a good start.  Consider using co-occurrence matrices or local binary patterns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;As of the R2014a release there is a &lt;a href=&quot;http://www.mathworks.com/help/stats/fitcsvm.html&quot; rel=&quot;nofollow&quot;&gt;fitcsvm&lt;/a&gt; function in the Statistics and Machine Learning Toolbox for training a binary SVM classifier. There is also &lt;a href=&quot;http://www.mathworks.com/help/stats/fitcecoc.html&quot; rel=&quot;nofollow&quot;&gt;fitcecoc&lt;/a&gt; for training a multi-class SVM.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2015-11-17T01:03:49.897" LastActivityDate="2015-11-17T01:03:49.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1808" PostTypeId="2" ParentId="1792" CreationDate="2012-03-22T19:25:02.983" Score="2" Body="&lt;p&gt;It looks like this mul-floor-div is an incorrect attempt to limit some numeric print-out to 3 or 6 decimal places.  Better to do that during the print formatting.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-03-22T19:25:02.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1809" PostTypeId="1" AcceptedAnswerId="1810" CreationDate="2012-03-22T19:54:06.453" Score="6" ViewCount="1564" Body="&lt;p&gt;Let us assume that we have a narrowband signal $s[n]$, at frequency $f_1$, and let us further assume that this $f_1$ is just below $\frac{f_s}{2}$, where $f_s$ is the sampling rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, let us also assume that we have a fixed number of time-domain samples of this signal, $N$, and that our FFT length is also $N$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The objective is to detect this signal $s[n]$'s presence in the frequency domain. (Further assume that we know to expect this signal in or around that frequency $f_1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is simple: With all things being equal, which is better from a detection perspective:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Simply do the FFT of this signal and look at the peak at that frequency bin&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Or&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;BPF a band of where we expect the signals' frequency $f_1$ to be, (eg, BPF this band $f_1 - \epsilon \text{ to} f_1 + \epsilon$). Then, mix this band down such that $f_1 + \epsilon$ is guaranteed to be just above DC, and LPF that entire band. Now, take the FFT, and detect energy. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Would the second method be better from a detection point of view because we have more samples per cycle, whereas the first one has just over 2 samples per cycle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TLDR: Is it better from a detection standpoint to FFT a signal or down-mix it and then FFT it (with appropriate filtering)?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-03-23T18:28:03.110" Title="Does down-mixing a signal before taking the fourier transform aid in signal detection?" Tags="|fft|frequency|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1810" PostTypeId="2" ParentId="1809" CreationDate="2012-03-22T23:21:16.727" Score="2" Body="&lt;p&gt;There is no difference in performance of the optimum detector in either case. Translating a signal in frequency before performing an FFT cannot improve the optimum probability of detection due to the principle of reversibility in detection theory; since shifting a signal in frequency is a reversible operation, then the detection performance of optimum detectors cannot vary based upon the signal's center frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stated differently, the number of samples per cycle of a particular DFT bin frequency has no bearing whatsoever upon the &quot;quality&quot; of its corresponding output.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-03-22T23:21:16.727" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1811" PostTypeId="1" CreationDate="2012-03-23T02:57:44.087" Score="2" ViewCount="76" Body="&lt;p&gt;I am new to Signal processing and want to implement for the measured curve from my experiment.&#xA;I have a measured curve (like skewed gaussian).&#xA;I like to change that measured curve to be as close as possible to the target curve (gaussian) (statistically and visually). Visually means, the target curve's width is abit longer than the measured curve when we the two curves are overlapped. Which signal processing should I use?&#xA;I like to attach a picture, but it is not allowed for the new person.&#xA;Thanks&#xA;thomas&lt;/p&gt;&#xA;" OwnerUserId="1135" LastActivityDate="2012-03-23T22:09:46.823" Title="How to change the measured curve to be close to the target curve" Tags="|algorithms|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1812" PostTypeId="2" ParentId="1608" CreationDate="2012-03-23T06:53:29.033" Score="6" Body="&lt;p&gt;Read the book 4G Lte Advanced by Stefan Parkvall and Eric Dahlman. According to the book,&#xA;FFT size of 2048, with a corresponding sampling rate of 30.72 MHz, is suitable for the wider LTE carrier bandwidths, such as bandwidths of the order of 15 MHz and above. However, for smaller carrier bandwidths, a smaller FFT size and a correspondingly lower sampling rate can very well be used.(Lowering the sample rate simplifies the implementation in dual-mode HSPA/LTE terminals)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also,nothing forbids the implementation of an OFDM modulator as a set of parallel modulators, &#xA;Also, nothing prevents the use of a larger IFFT size, for example a size-2048 IFFT size, even in the case of a smaller number of OFDM subcarriers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tcp= 160·Ts and Tcpe=512.Ts. Change in CP induces change in the total number of REs(6X12, instead of 7X12). Note that #sub carriers remain 12 in both cases and FFT size is dependent on BW allocated which is expressed in #sub carriers.&lt;/p&gt;&#xA;" OwnerUserId="1122" LastActivityDate="2012-03-23T06:53:29.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1814" PostTypeId="2" ParentId="1811" CreationDate="2012-03-23T14:37:54.230" Score="3" Body="&lt;p&gt;It is unclear what is your application from your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you aim at &quot;gaussianizing&quot; your data -- for example to make better use of statistical modeling, regression, or machine learning methods which work better under a gaussian assumption -- you can use the Box-Cox transform. It consist in applying the following transformation to your data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = \frac{x^\lambda - 1}{\lambda}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lambda$ is chosen as to maximize the log-likelihood of a gaussian model given the transformed data - this is a maximization problem usually solved using Levenberg–Marquardt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also strongly suggest posting this to the stats SE.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-03-23T22:09:46.823" LastActivityDate="2012-03-23T22:09:46.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1815" PostTypeId="2" ParentId="1748" CreationDate="2012-03-23T15:13:03.113" Score="1" Body="&lt;p&gt;The 4:4:4 scheme is confusing.   For example Yuv420 video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 1st digit specifies the number of 'Y' luminosity values - '4' means full resolution &#xA;The 2nd digit is the horizontal spacing for U and V (chroma) values - 2 means every alternate horizontal pixel has a colour value.&#xA;The 3rd digit it the vertical stepping between values, 0 means none are missed to every row had Y,U and V values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In 4:1:1 both vertical and horizontal directions there is only a U and V value for every 4th pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://blogs.adobe.com/VideoRoad/2010/06/color_subsampling_or_what_is_4.html&quot; rel=&quot;nofollow&quot;&gt;http://blogs.adobe.com/VideoRoad/2010/06/color_subsampling_or_what_is_4.html&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-03-23T15:13:03.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1816" PostTypeId="2" ParentId="1809" CreationDate="2012-03-23T18:28:03.110" Score="3" Body="&lt;p&gt;If you are doing are doing this in both the analog and digital domain, then there may be significant differences due to trade-offs between the noise sources in the analog stage(s) in the filters and the mixer oscillator frequency, and the corresponding sampling jitter and quantization noise in converting to digital.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even strictly in the digital domain, the bandpass and lowpass filter responses may have different effects on how potential stop-band noise might affect your detection accuracy, compared to how windowing (rectangular or otherwise) affects the continuous frequency response of each FFT bin.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-03-23T18:28:03.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1817" PostTypeId="1" AcceptedAnswerId="1818" CreationDate="2012-03-24T00:33:06.757" Score="8" ViewCount="5481" Body="&lt;p&gt;I'm looking at the definition of signal energy (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Energy_%28signal_processing%29&quot;&gt;Wikipedia&lt;/a&gt;, &lt;a href=&quot;http://cnx.org/content/m11526/latest/&quot;&gt;cnx.org&lt;/a&gt;). For discrete signals, it's defined like the following, where $x(n)$ holds the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xD;&#xA;Energy = \sum_{n=-\infty}^{\infty} |x(n)|^2&#xD;&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For a windowed, finite signal like &lt;code&gt;double signal[256]&lt;/code&gt;, the sum is from 1 to 256 (or 0 to 255 in a program) rather than $-\infty$ to $\infty$, right? (I don't even know how I would sum over infinity.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why does the energy formula have the absolute-value operator $|...|$? The result of taking the absolute value is squared anyways to produce a positive value, so taking the absolute value seems to be pointless. Is it because the $x(n)$ can be complex, so the &lt;a href=&quot;http://en.wikipedia.org/wiki/Complex_number#Absolute_value_and_argument&quot;&gt;absolute value of a complex number&lt;/a&gt; would be the scalar from Pythagoras' theorem?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="709" LastActivityDate="2012-03-27T01:52:43.533" Title="Questions about discrete signal energy calculation" Tags="|discrete-signals|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1818" PostTypeId="2" ParentId="1817" CreationDate="2012-03-24T01:10:07.730" Score="8" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes. No need to sum up an infinite number of zeros.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, it is because &lt;code&gt;x(n)&lt;/code&gt; could be complex. If we didn't take the absolute values of the complex numbers (&lt;a href=&quot;http://en.wikipedia.org/wiki/Norm_%28mathematics%29#Euclidean_norm_of_a_complex_number&quot; rel=&quot;nofollow&quot;&gt;Euclidean norm&lt;/a&gt;), a signal containing&#xA;$[\dots,0,0,a+ia, a-ia,0,0,\dots]$&#xA;would have an energy of zero (instead of $4a^2$) although it contains non-zero samples. For real numbers however $|a|^2 = a^2$ and the absolute value doesn't matter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="444" LastEditorUserId="1106" LastEditDate="2012-03-27T01:52:43.533" LastActivityDate="2012-03-27T01:52:43.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1819" PostTypeId="2" ParentId="1748" CreationDate="2012-03-24T08:20:48.010" Score="2" Body="&lt;p&gt;Here is a &lt;a href=&quot;http://lea.hamradio.si/~s51kq/V-BAS.HTM&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference&lt;/a&gt; to know the difference. I am adding the essential diagram as well: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7ezDa.gif&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;what you realize is that 4:1:1 has full vertical resolution but 1/4 of Horizontal resolution, where as 4:2:0 has half of vertical as well half horizontal resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, overall, 4:2:0 and 4:1:1 will have the same number of samples and hence the same bit rate.&lt;/p&gt;&#xA;" OwnerUserId="1140" LastEditorUserId="440" LastEditDate="2012-03-24T17:55:01.863" LastActivityDate="2012-03-24T17:55:01.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1820" PostTypeId="2" ParentId="1733" CreationDate="2012-03-24T09:45:39.947" Score="5" Body="&lt;p&gt;Following &lt;a href=&quot;http://www.kerrywong.com/2009/05/07/canny-edge-detection-auto-thresholding/&quot;&gt;http://www.kerrywong.com/2009/05/07/canny-edge-detection-auto-thresholding/&lt;/a&gt; is one of the few resources that shows how to choose thresholds Tlow and Thigh &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to this, for a picture which is sufficiently spread in historgram, one can choose T_low = 0.66 * mean value of image and T_high = 1.33 * mean value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when the image is not sufficiently spread, one should use median as opposed to mean value of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the gap between T_low and T_high is very small, the resultant edges will be smaller in continuity and hence there will be more fractions. As the gap increases, you will have more single line edges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As regards to sigma, as the sigma increases, the smoothing increases and noisy edges will go away, but at the same time, the location of edges may also move little. See this document, &lt;a href=&quot;http://www.cse.unr.edu/~bebis/CS791E/Notes/EdgeDetection.pdf&quot;&gt;http://www.cse.unr.edu/~bebis/CS791E/Notes/EdgeDetection.pdf&lt;/a&gt; and results at page 29 shows this effect. &lt;/p&gt;&#xA;" OwnerUserId="1140" LastEditorUserId="1140" LastEditDate="2012-03-24T13:24:38.263" LastActivityDate="2012-03-24T13:24:38.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1821" PostTypeId="1" AcceptedAnswerId="1822" CreationDate="2012-03-24T11:33:20.833" Score="2" ViewCount="276" Body="&lt;p&gt;I'm trying to plot the phase of this signal $s(f)=A^2T^2sinc^2(Tf)e^{-(j\pi Tf)}$&#xA;How can I plot manually this signal?I have to follow some particular rules?I have problems with the delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After calculation I found that the phase for this signal is: $\phi(s(f))=-\pi Tf$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it should be this the plot. Right or not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plot it for $T =3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/czq6s.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1141" LastEditorUserId="1141" LastEditDate="2012-03-24T12:17:04.943" LastActivityDate="2012-03-24T13:28:53.557" Title="plotting phase of a signal adding delay" Tags="|fourier-transform|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1822" PostTypeId="2" ParentId="1821" CreationDate="2012-03-24T13:28:53.557" Score="5" Body="&lt;p&gt;This is indeed correct. There is a few things you could do to make it a better graph:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Label the X-axis&lt;/li&gt;&#xA;&lt;li&gt;Label the Y-axis&lt;/li&gt;&#xA;&lt;li&gt;Use real physical units if it's applicable. Phase is measured either in radians or in degrees. These are VERY different things, so proper labeling with units helps to clarify what you are using. Similar if f is a frequency in Hz (or kHz or MHz) and T is a time (in nanoseconds or fortnights), it should be stated.&lt;/li&gt;&#xA;&lt;li&gt;You could consider changing the Y-grid so that the grid lines match with meaningful phase values such as 2*pi (or an integer multiple thereof).&lt;/li&gt;&#xA;&lt;li&gt;Along the same lines, you could alternatively normalize the phase to a meaningful value (like 2*pi) and keep the integer grid.&lt;/li&gt;&#xA;&lt;li&gt;If the result was obtained by Fourier transform of a real valued time domain signal and the context is clear, consider omitting the left half (f&amp;lt;0) of the plot. The convention is to only plot positive frequencies and the complex conjugate symmetry is implied. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This may sound nit-picky, but making a good graph is typically time well spend. It really helps to clarify what's going on, simplifies communication and will help you to remember what you did when you look at it in 3 months from now.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-24T13:28:53.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1823" PostTypeId="1" AcceptedAnswerId="1829" CreationDate="2012-03-24T14:22:13.150" Score="7" ViewCount="352" Body="&lt;p&gt;Let's say I have the very same signal stored in 2 &lt;code&gt;.wav&lt;/code&gt; files. And lets say I process each file using a function, and it is established that one file is 20 &lt;a href=&quot;http://en.wikipedia.org/wiki/Phon&quot; rel=&quot;nofollow&quot;&gt;phons&lt;/a&gt; larger than the other. Lets ignore how that function calculates this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean that one file is approximately 4 times louder than the other? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What formula can I use to relate the difference in phons for two signal to the difference in their loudness?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-10 phons = 0.5 &#xA;0 phons = 1&#xA;10 phons = 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1142" LastEditorUserId="35" LastEditDate="2012-07-23T02:01:47.797" LastActivityDate="2012-07-23T02:01:47.797" Title="How do Phons relate to loudness?" Tags="|audio|music|acoustics|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1824" PostTypeId="1" AcceptedAnswerId="1825" CreationDate="2012-03-21T12:46:54.413" Score="2" ViewCount="705" Body="&lt;p&gt;I'm looking for an image-processing algorithm that uses interpolation (polynomial, spline, doesn't matter). I have to implement such algorithm to process a bitmap for my labs. It can't be image resizing, it must be something else. Could you give me some proposals? &#xA;I've tried on wikipedia and google, but it's hard to filter algorithms that make use of interpolation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. Sorry for the tags, I can't create new ones and couldn't find existing ones that would be suitable for my question.&lt;/p&gt;&#xA;" OwnerUserId="1303" OwnerDisplayName="Wojtek" LastEditorUserId="64" LastEditDate="2012-03-24T18:21:30.990" LastActivityDate="2012-03-24T18:45:29.320" Title="Interpolation algorithms in computer graphics" Tags="|image-processing|homework|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1825" PostTypeId="2" ParentId="1824" CreationDate="2012-03-24T18:24:29.627" Score="3" Body="&lt;p&gt;Some ideas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;rotate the image in 2D&lt;/li&gt;&#xA;&lt;li&gt;compute the &lt;a href=&quot;http://www.ocf.berkeley.edu/~fricke/projects/israel/paeth/rotation_by_shearing.html&quot; rel=&quot;nofollow&quot;&gt;Radon transform&lt;/a&gt;.  This is used in tomography applications.&lt;/li&gt;&#xA;&lt;li&gt;Other 2D effects, like swirling or adding ripples&lt;/li&gt;&#xA;&lt;li&gt;Map the 2D image onto the surface a 3D shape, such as a sphere&lt;/li&gt;&#xA;&lt;li&gt;Simulate the effect of a lens, or refraction by some other transparent 3D object in front of your bitmap&lt;/li&gt;&#xA;&lt;li&gt;Simulate &lt;a href=&quot;http://en.wikipedia.org/wiki/File%3aBlack_hole_lensing_web.gif&quot; rel=&quot;nofollow&quot;&gt;gravitational lensing&lt;/a&gt; by a black hole&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;2D image rotation is what comes to mind first as the simplest application of 2D interpolation after rescaling.  The obvious approach is to simply apply the well-known coordinate transformation; an alternative &lt;a href=&quot;http://www.ocf.berkeley.edu/~fricke/projects/israel/paeth/rotation_by_shearing.html&quot; rel=&quot;nofollow&quot;&gt;trick&lt;/a&gt; is to decompose the rotation into a sequence of three sheers so that only 1D interpolation is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3D examples are more involved, since they will probably require implementation of raytracing.&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-03-24T18:45:29.320" LastActivityDate="2012-03-24T18:45:29.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1826" PostTypeId="2" ParentId="1699" CreationDate="2012-03-24T19:35:31.083" Score="6" Body="&lt;p&gt;Broadly speaking there are two primary approaches to solving this problem: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. template matching or&lt;br&gt;&#xA;b. matching with a parameterized model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, given the simplicity of the model, i would prefer the second approach for this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 1: Identify the ping blobs&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a first step, extract the &quot;Boxes&quot; - essentially the yellow/blue squares. A simplest method here could be to just threshold the image. There doesn't seem to be much variations in the background except that as the noise increases it tends to be quite similar to the pings. Hence, the threshold can be global across the image - and i think you will be able to get a decent threshold that would work across the images. The threshold, however, should be smart so you can use something like Otsu's method. See &lt;a href=&quot;http://www.labbookpages.co.uk/software/imgProc/otsuThreshold.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MORSE/threshold.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; for more reference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Improvement of the blocks&lt;/em&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the good thing you can do to remove spurious points which looks similar to ping foreground where as some pixels inside the pings are also blue. You need here a morphological operation called &quot;Opening&quot;. Here is one of the reference from &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/open.htm&quot; rel=&quot;nofollow&quot;&gt;HIPR&lt;/a&gt;. These type of operations requires smart shape that helps preserving similar shapes and removing others. In your case you can choose horizontal lines.  By the end of this, you have background and foreground pixels neatly separating the pings without touching each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2: Mark/Register blocks&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that you have got the &lt;em&gt;cleanest&lt;/em&gt; possible blobs, time to mark them as 1,2,3,4 or A,B,C,D etc. This is usually accomplished by what is called some simple algorithm. Run through each pixel and if it is touching with any marked region, and is also foreground then assign it to that segment else create a new one. If you happen to find more than 4 important segments you need to choose the most relevant ones. Apply some heuristic here rather than any theoretical algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3: Modeling of parameters&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, once we get most likely top 4 candidates of the 4 corresponding pings, you can identify the bounding boxes - essentially the top left and bottom right corners (or left and right most pixels, as well as top and bottom rows of the blob). Find the bounding box, you can fined centroid the of each ping box.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence you can have four centroids $C_i \text{ where } i \in \{1,2,3,4\}$&#xA;Based on the description, the absolute location of $C_1$ can be arbitrary. However, following to $C_1$, the other centroids should be within certain range, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;hence inter centroid distances can now be calculated: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;&#xD;&#xA;C_{1i}[x,y] = \{ C_1[x] - C_i[x],  C_1[y] - C_i[y] \}&#xD;&#xA; &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other critical parameter is the length of the pings - which is $L_i \text{ where } i \in \{1,2,3,4\}$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially you have 8 parameter vecoter: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;1.    \{ C_1[x],C_1[y] \}  \\  &#xD;&#xA;2..4  C_{1i}[x,y]  \\&#xD;&#xA;5..8  L_i  \\&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 4: Classification&lt;/strong&gt;&lt;br&gt;&#xA;In the last step, now we need to have classification whether there is a ping-pattern yes or no. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For something like this, you can have a nice Bayesian classifier framework. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two Hypothesis you have &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;H0 : The ping pattern exist.&lt;br&gt;&#xA;  H1 : The ping pattern doesn't exist&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now, i am putting only 1 parameter $C_{1,i}[x]$ case here but you can extend this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of you study a lot of images where you &lt;em&gt;know&lt;/em&gt; they belong to the image. Now, you can plot various histograms or apply some method of density estimation method. Read Pattern Classification by Duda Hart.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity you found that in cases where pings are present, the density function of parameter $C_{1,i}[x]$ is Gaussian with $ \mu = 20, \sigma = .1$ The sigma being small here could imply that there cannot be so much variations from the original. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is actually conditional probability of $C_{1,i}$ given $H0$ is true. So you have values $P[ C_{1,i}[x] | H0 ]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, from the test data &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P[ H0 | C_{1,i}[x] =x_1]$ is = given the reading of $C_1[x]$ being $x_1$, what is the probability of $H0$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, you can compute &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;&#xD;&#xA;P[ H0 \space | C_{1,i}[x] ] = { P[ C_{1,i}[x] | H0 ] * P[H0] \over {P[ C_{1,i}[x]]  } }&#xD;&#xA;&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to combine this expression for the vector expression and need to fill in a lot of effort for exactly putting the parameter estimation to be done. But i am leaving you with basic approach here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Please do your own math, this will be lengthy, but should be still quite intuitive.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once, you combine expression, if $P[H0 | \text{all parameters}] &amp;gt; 1/2 $ then the ping pattern exists. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;br&gt;&#xA;Since you are already defining the specific criteria of 110 +/- 5 pixels, the last step can be simpler. You probably don't quite need to calculate all these probabilities if your classification criteria is fixed. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-03-26T10:48:04.693" LastActivityDate="2012-03-26T10:48:04.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1828" PostTypeId="1" CreationDate="2012-03-24T22:12:52.710" Score="22" ViewCount="6527" Body="&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;  I'm working on an iPhone application (alluded to &lt;a href=&quot;https://dsp.stackexchange.com/questions/1493/how-can-you-tell-whether-theres-a-signal-when-your-signal-looks-a-lot-like-noi&quot;&gt;in&lt;/a&gt; &lt;a href=&quot;https://dsp.stackexchange.com/questions/1292/how-to-determine-the-variability-in-a-frequency-range&quot;&gt;several&lt;/a&gt; &lt;a href=&quot;https://dsp.stackexchange.com/questions/450/how-to-recognize-patterns-in-a-noisy-audio-frequency-spectrum&quot;&gt;other&lt;/a&gt; &lt;a href=&quot;https://dsp.stackexchange.com/questions/1395/peak-limiting-audio-compression-formula-needed&quot;&gt;posts&lt;/a&gt;) that &quot;listens to&quot; snoring/breathing while one is asleep and determines if there are signs of sleep apnea (as a pre-screen for &quot;sleep lab&quot; testing).  The application principally employs &quot;spectral difference&quot; to detect snores/breaths, and it works quite well (ca 0.85--0.90 correlation) when tested against sleep lab recordings (which are actually quite noisy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;  Most &quot;bedroom&quot; noise (fans, etc) I can filter out through several techniques, and often reliably detect breathing at S/N levels where the human ear cannot detect it.  The problem is voice noise.  It's not unusual to have a television or radio running in the background (or to simply have someone talking in the distance), and the rhythm of voice closely matches breathing/snoring.  In fact, I ran a recording of the late author/storyteller Bill Holm through the app and it was essentially indistinguishable from snoring in rhythm, level variability, and several other measures.  (Though I can say that apparently he didn't have sleep apnea, at least not while awake.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is a bit of a long shot (and probably a stretch of forum rules), but I'm looking for some ideas on how to distinguish voice.  We don't need to filter the snores out somehow (thought that would be nice), but rather we just need a way to reject as &quot;too noisy&quot; sound that is overly polluted with voice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Files published:&lt;/strong&gt; I've placed some files on dropbox.com:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/72976325/Epica_Storm_the_Noisy_Sorrow_minus_10dB_wav.dat&quot; rel=&quot;noreferrer&quot;&gt;Epica_Storm_the_Noisy_Sorrow_minus_10dB_wav.dat&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/72976325/Holm_5db_noisy_wav.dat&quot; rel=&quot;noreferrer&quot;&gt;Holm_5db_noisy_wav.dat&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/72976325/recordedFile20120408010300_first_ten_wav.dat&quot; rel=&quot;noreferrer&quot;&gt;recordedFile20120408010300_first_ten_wav.dat&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The first is a rather random piece of rock (I guess) music, and the second is a recording of the late Bill Holm speaking.  Both (which I use as my samples of &quot;noise&quot; be differentiated from snoring) have been mixed with noise to sort of obfuscate the signal.  (This makes the task of identifying them significantly more difficult.)  The third file is ten minutes of a recording of yours truly where the first third is mostly breathing, middle third is mixed breathing/snoring, and the final third is fairly steady snoring.  (You get a cough for a bonus.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All three files have been renamed from &quot;.wav&quot; to &quot;_wav.dat&quot;, since many browsers make it maddeningly difficult to download wav files.  Just rename them back to &quot;.wav&quot; after downloading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I thought entropy was &quot;doing the trick&quot; for me, but it turned out to mostly be peculiarities of the test cases I was using, plus an algorithm that wasn't too well designed.  In the general case entropy is doing very little for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I subsequently tried a technique where I compute the FFT (using several different window function) of the overall signal magnitude (I tried power, spectral flux, and several other measures) sampled about 8 times a second (taking the stats from the main FFT cycle which is every 1024/8000 seconds).  With 1024 samples this covers a time range of about two minutes.  I was hoping that I would be able to see patterns in this due to the slow rhythm of snoring/breathing vs voice/music (and that it might also be a better way to address the &quot;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1292/how-to-determine-the-variability-in-a-frequency-range&quot;&gt;variability&lt;/a&gt;&quot; issue), but while there are hints of a pattern here and there, there's nothing I can really latch onto.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;Further info:&lt;/strong&gt; For some cases the FFT of signal magnitude produces a very distinct pattern with a strong peak at about 0.2Hz and stairstep harmonics.  But the pattern is not nearly so distinct most of the time, and voice and music can generate less distinct versions of a similar pattern.  There might be some way to calculate a correlation value for a figure of merit, but it seems that would require curve fitting to about a 4th order polynomial, and doing that once a second in a phone seems impractical.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also attempted to do the same FFT of average amplitude for the 5 individual &quot;bands&quot; I've divided the spectrum into.  The bands are 4000-2000, 2000-1000, 1000-500, and 500-0.  The pattern for the first 4 bands was generally similar to the overall pattern (though there was no real &quot;stand-out&quot; band, and often vanishingly small signal in the higher frequency bands), but the 500-0 band generally was just random.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bounty:&lt;/strong&gt;  I'm going to give Nathan the bounty, even though he's not offered anything new, given that his was the most productive suggestion to date.  I still have a few points I'd be willing to award to someone else, though, if they came through with some good ideas.&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-04-30T22:31:58.643" Title="How to distinguish voice from snoring?" Tags="|fft|noise|frequency-spectrum|voice|" AnswerCount="4" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="1829" PostTypeId="2" ParentId="1823" CreationDate="2012-03-24T22:46:54.167" Score="7" Body="&lt;p&gt;Your equations are correct (as a first order approximation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phon is an attempt to establish a perceptual loudness measurement. Perceived loudness is rather complicated since it needs to take into account what happens in the human auditory system and in the human brain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is is how it works: First you measure the sound energy at the listener's position. The relevant physical quantity is the variation in air pressure, called &quot;sound pressure&quot; and measured in Pascal or Pa like any other pressure. This is then referenced to 20 micro Pascal and turned into dB like this&#xA;$$ x = 20\cdot log_{10}\frac{p}{20\mu Pa} $$&#xA;where p is the measured sound pressure and x is the sound pressure level in dBSPL. This is a direct measurement of the physical sound energy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The human auditory system has different sensitivity at different frequencies. It's most sensitive around 2kHz-4kHz, a lot less sensitive at 100 Hz and at 30 kHz you don't hear anything at all, regardless of how much sound energy is there. The &quot;phon&quot; takes this into account. It's based on measurements that compare the perceived loudness of sine waves at different frequencies. The results are often referred to as &quot;equal loudness contours&quot; (see for example &lt;a href=&quot;http://en.wikipedia.org/wiki/Equal-loudness_contour&quot;&gt;http://en.wikipedia.org/wiki/Equal-loudness_contour&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A loudness of X phons means &quot;as loud as a 1 kHz sine wave at X dBSPL&quot;. For a 1 kHz sine waves phons and dBSPL are the same thing. For sine waves of other frequencies phons and dBSPL are related through the equal loudness contours. For more complicated signals calculating phons is a bit more tricky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phon is not a direct loudness measurement. Perceived loudness, as most human modalities, follows roughly the Weber-Fechner law (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Weber%E2%80%93Fechner_law&quot;&gt;http://en.wikipedia.org/wiki/Weber%E2%80%93Fechner_law&lt;/a&gt;). As a first order approximation it takes ten times the energy to double the perceived loudness (all other things being equal). An increase in 10 phone doubles the loudness and an increase in 20 phone does, indeed, increase the perceived loudness by a factor of 4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate phon (relative or absolute) from a wav file, the file MUST be calibrated in units of Pascal (sound pressure) since the equal loudness contours are non linear and change with absolute level.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-24T22:46:54.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1830" PostTypeId="2" ParentId="1828" CreationDate="2012-03-24T22:58:21.797" Score="3" Body="&lt;p&gt;Time domain statistics perhaps? Snoring seem to have relatively long periods of steady state whereas speech energy changes quite a bit over short time periods. This could be combined with spectral analysis as well. Vowels have more low frequency content and consonants more high frequencies. During speech the spectrum may quickly bounce back and forth between those states while storing may stay in one state for longer periods of time.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-24T22:58:21.797" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1831" PostTypeId="2" ParentId="1828" CreationDate="2012-03-25T00:39:26.907" Score="11" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;According to papers below, snoring is characterized by a peak at about 130Hz, and is wholly concentrated below 12kHz:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cinc.org/archives/2010/pdf/0045.pdf&quot; rel=&quot;noreferrer&quot;&gt;Non-invasive Sensors based Human State in Nightlong Sleep Analysis for Home-Care&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://etd.lib.metu.edu.tr/upload/12608236/index.pdf&quot; rel=&quot;noreferrer&quot;&gt;An efficient fast method of snore detection for sleep disorder investigation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www3.itu.edu.tr/~kamasak/pubs/pdf/pm7_8_007.pdf&quot; rel=&quot;noreferrer&quot;&gt;An efficient method for snore/nonsnore classification of sleep sounds&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Let's see if we can leverage this.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;MATLAB Example&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We have &lt;a href=&quot;http://dl.dropbox.com/u/72976325/recordedFile20120408010300_first_ten_wav.dat&quot; rel=&quot;noreferrer&quot;&gt;a poor recording of a child snoring&lt;/a&gt;; a 10-minute, 8-bit mono WAV file. The sampling rate is 8KHz, which means the bandwidth of the audio signal is 4KHz. The level is very low so I will &lt;em&gt;compand&lt;/em&gt; it first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[snd,fs]=wavread('recordedFile20120408010300_first_ten_minutes');&#xA;cmp=compand(snd,255,1);&#xA;wavwrite(cmp,'companded'); % used for listening purposes&#xA;[s,f,t,p]=spectrogram(snd,hann(8192));&#xA;surf(linspace(0,600,length(t)),f/pi,10*log10(p),'edgecolor','none'); &#xA;axis tight; view(0,90);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/58BH6.png&quot; alt=&quot;Full spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The y axis is normalized to the bandwidth, 4KHz, so that notch you see at 0.1 corresponds to a frequency of 400Hz. There is a spike corresponding to a cough at ~186s; ignore that. We can vaguely see the notches during each snore. Not only that, but they seem concentrated below 0.2 x 4KHz=800Hz. Let's take a closer look.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;idx_max_freq=round(0.2*length(f));&#xA;surf(linspace(0,600,length(t)),fs*f(1:,idx_max_freq:)/(2*pi),10*log10(p(1:idx_max_freq,:)),'edgecolor','none');&#xA;axis tight; view(0,90);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p26zb.jpg&quot; alt=&quot;Zoom of the spectrogram to 0-800Hz.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time the frequency axis was labeled in Hertz. Now the notches are quite clear. We can even see the overtones of the power line noise starting at 60Hz (180Hz, 300Hz, 420Hz). Now comes the essence of the algorithm: let's classify the signal based on the energy in this subband, with the line noise removed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freq_list=round([1:57 63:177 183:297 303:417 423:800]*idx_max_freq/800);&#xA;y=10*log10(sum(p(freq_list,:)));&#xA;plot(linspace(0,600,length(y)),y-median(y))&#xA;stem(linspace(0,600,length(y)),y-median(y)&amp;gt;.5*std(y))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If we want to get fancy, we can discard oversized spikes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;stem(linspace(0,600,length(y)),(y-median(y)&amp;gt;.5*std(y)).*(y-median(y)&amp;lt;5*std(y)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SP33P.png&quot; alt=&quot;Plot of the energy in the notched subband 0-800Hz&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ndSgh.png&quot; alt=&quot;The final result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The low SNR, manifest in the difficulty in discerning the signal in the first plot, means we have leeway of only half a standard deviation (the value of which was 4.1). The stems mark the snores.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2012-05-24T12:17:03.877" LastActivityDate="2012-05-24T12:17:03.877" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1832" PostTypeId="2" ParentId="1798" CreationDate="2012-03-25T14:48:01.517" Score="1" Body="&lt;p&gt;There is yet another way! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of it, what if you wanted some other distribution as opposed to Gaussian? In that case you couldn't really use Central Limit theorem; how do you then solve it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a way to convert uniform random variable into arbitrary PDF. &#xA;This method is called &lt;strong&gt;&lt;em&gt;Inverse Transform Method&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If  $U[0-1]$ is uniformly distributed over the interval (0, 1), then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;&#xD;&#xA;X =  F_X^{-1} (U) &#xD;&#xA;&#xD;&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;has c.d.f. $F_X (x)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, all you need to do is, apply the inverse CDF function to the variable you have retrieved from the uniform rv's sample.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, unlike the earlier methods - this will not require any iteration and won't depend on how many iterations will be taken to make results closers to Gaussian. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is one of the &lt;a href=&quot;http://www.cs.bgu.ac.il/~mps042/invtransnote.htm&quot; rel=&quot;nofollow&quot;&gt;references&lt;/a&gt; that gives a proof of this. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-03-25T14:48:01.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1833" PostTypeId="2" ParentId="1699" CreationDate="2012-03-25T14:48:20.920" Score="3" Body="&lt;p&gt;This problem &lt;em&gt;seems&lt;/em&gt; to me like the pulse repetition interval detection + estimation problem.  I'll need to develop this answer over time, but the sort of algorithms that work well in &lt;strong&gt;that&lt;/strong&gt; problem are &lt;a href=&quot;http://itee.uq.edu.au/~vaughan/Publications/dasp-06.pdf&quot; rel=&quot;nofollow&quot;&gt;maximum likelihood on a lattice&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2012-03-25T14:48:20.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1834" PostTypeId="2" ParentId="1828" CreationDate="2012-03-25T21:24:24.743" Score="1" Body="&lt;p&gt;Spectral complexity over time.  I'll hypothesize that human speech probably uses more phonemes, and with much greater statistical complexity in their sequencing than the phoneme sequences of snoring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an probably a much easier problem than continuous speech recognition, as you won't need to actually recognize any particular phoneme or sentence correctly, only the number of phoneme sounding spectral segments, and some statistical complexity measure of their sequences (an entropy or compressibility test might work).  Then see if you can determine a reliable threshold for these measures.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-03-25T21:24:24.743" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1835" PostTypeId="2" ParentId="1828" CreationDate="2012-03-25T23:19:12.030" Score="9" Body="&lt;p&gt;Just throwing this in here to cover all the possibilities, you might be able to use entropy, I don't known what the entropy level of snoring vs speech is but if it is different enough that may work.&#xA;&lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/ShenHL98-endpoint.pdf&quot;&gt;http://www.ee.columbia.edu/~dpwe/papers/ShenHL98-endpoint.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1144" LastActivityDate="2012-03-25T23:19:12.030" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1836" PostTypeId="2" ParentId="1738" CreationDate="2012-03-26T06:37:55.780" Score="8" Body="&lt;p&gt;This is not a complete and crisp answer however, i am leaving you with at least some approach for you to fight with. (I would be very glad to know if you have results).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at these questions: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/419/removing-glare-from-image&quot;&gt;Removing Glare from Image&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1215/how-to-remove-the-glare-and-brightness-in-an-image-image-preprocessing&quot;&gt;How to remove the glare and brightness in an image (Image preprocessing)?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are essentially trying to solve the same problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two parts of the problem, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. Identifying the spot/stain &#xA;b. Replacing the stain with what would have been in the place of occlusion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nature of the question is trying to solve exact problem (in some sense). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not trivial thing. However, in both questions there are some unique pattern that you can exploit. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In all cases, the superimposing element which is required to be removed called here as  (stain, glare, bright spot), overlay has a unique and distinct hue/color which distinguishes itself from regular objects/scene.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In most cases, this hue/color of the overlay fades away into the regular scene. The actual resultant color does change - however, it is better to model overlay as single intensity and color with successively reducing transperency Hence you can say resultant pixel &#xA;$$P[x,y]  = (1-\alpha[x,y])*S[x,y] + \alpha[x,y] * OverlayHue $$&#xA;$$\tilde S[x,y] = (P[x,y] - OverlayHue * \tilde \alpha[x,y])/(1-\tilde \alpha[x,y]) $$ &#xA;where $P[x,y]$ is observed image, and $S[x,y]$ is desired occlusion free image. &#xA;Note, that alpha can be arbitrarily varied over pixels, but $OverlayHue$ of overlay is considered almost constant. $\tilde S[x,y]$ and $\tilde \alpha[x,y]$ are estimated values by your algorithm for the respective quantities. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;em&gt;OverlayHue&lt;/em&gt; value can be independently estimated by manually segmenting pixel regions where Stain or Flash is clearly dominating. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can assume that \alpha[x,y] is consistent across all channels (i.e. R,G,B) . Hence you can identify individual components as follows: &#xA;$$\tilde S_R[x,y] = (P_R[x,y] - OverlayHue_R * \tilde \alpha[x,y])/(1-\tilde \alpha[x,y]) $$ &#xA;$$\tilde S_G[x,y] = (P_G[x,y] - OverlayHue_G * \tilde \alpha[x,y])/(1-\tilde \alpha[x,y]) $$ &#xA;$$\tilde S_B[x,y] = (P_B[x,y] - OverlayHue_B * \tilde \alpha[x,y])/(1-\tilde \alpha[x,y]) $$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can see that when $\alpha$ is close to 1 implies that overlay is completely occluding the scene and hence no estimate of $\tilde S$ can be good, you should avoid that and keep some reference value to iterate it over time. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You still have more variables than equation unfortunately, and that is due to the physical nature of pixels. A given color could have resulted either due to the pixel's own property or due to stain/glare. Best bet is that you start with identified pixels where you know that $\alpha$ is 1 and then gradually decay down guess for $\alpha$ reducing successively. Over some iteration you can find the patterns. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, in order to finally estimate pure black spots, You can also apply smoothing constraint over neighborhood pixels (i.e. $\tilde S[x,y]$ as well as $\tilde \alpha[x,y]$). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This may not be perfect solution, but may be better than most obvious than pixel level clipping or playing around with saturation etc. I sincerely request you do try this in your end and show us results (my workbench is currently in a mess so i couldn't do it!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-03-26T12:14:06.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1838" PostTypeId="2" ParentId="1737" CreationDate="2012-03-26T10:29:42.357" Score="4" Body="&lt;p&gt;Given that you are working only on Tanimoto Coefficient, i am trying to be more specific rather than giving generic answer with various different approaches. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic notation of Tanimoto Coefficient is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;T(A,B) = { N_{AB} \over N_A + N_B - N_{AB} } &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is the desired result, over $A$ and $B$ images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this measure, we identify pixels either as belonging to a given segment i.e. it is segment pixel or it is background.&lt;br&gt;&#xA;$N$ refers to number of pixels that are classified as segment pixel in the respective image. And $N_{AB}$ refers to the number of pixels which are classified as segment pixel in both images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this measure all pixels which qualifies as neither in A nor B is not calculated; only the pixels.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, both image must have same resolution and must have identical locations to for the segmented objects else even if the segmentation shape is right, the resultant overlap may not be right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not getting into your MATLAB code, but here is the pseudo code that looks like. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Initialize N_A, N_B, N_AB;&#xA;for( all pixels @ x,y) &#xA;{&#xA;   if(image_A[x][y] == SEGMENT_CLASS_PIXEL) &#xA;    N_A += 1;&#xA;&#xA;   if(image_B[x][y] == SEGMENT_CLASS_PIXEL) &#xA;    N_A += 1;&#xA;&#xA;   if(image_A[x][y] == SEGMENT_CLASS_PIXEL &#xA;      &amp;amp;&amp;amp; image_B[x][y] == SEGMENT_CLASS_PIXEL) &#xA;    N_AB += 1;&#xA;&#xA;}&#xA;&#xA;T = N_AB / (N_A + N_B - N_AB); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-03-26T10:29:42.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1839" PostTypeId="1" AcceptedAnswerId="1840" CreationDate="2012-03-26T12:57:19.690" Score="9" ViewCount="4164" Body="&lt;p&gt;I have a seismic signal y(i):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tUpvl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I have found one maximum: i=152.54, y=222.29 manually and plotted it in red.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find all maxima automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read that the Savitzky Golay Filter (SGF) can be used to find smoothed estimates of both a signal and its derivatives, and that one of the benefits of the SGF is that it preserves minima and maxima much better than other filters. This sounds great for my use.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/4038-savitzky-golay-smoothing-and-differentiation-filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;I found a Matlab script that generates SGF coefficients.&lt;/a&gt;&#xA;And used this to find that the 4th order SGF coefficients for the derivative.&#xA;I coded a small Matlab script that &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;finds the derivative of the signal by convolving the signal with the&#xA;4th order SGF coefficients for the derivative &lt;/li&gt;&#xA;&lt;li&gt;finds pair of samples (i,i+1) where the derivative changes sign&lt;/li&gt;&#xA;&lt;li&gt;finds zero crossing of derivative by linear interpolation between i and i+1&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [maxX,maxY] = findLocalMax(y)&#xA;% Kernel for 4th order Savitzky-Golay filter for finding derivative:&#xA;d4 = [0.0724 -0.1195 -0.1625 -0.1061 0 0.1061 0.1625 0.1195 -0.0724];&#xA;&#xA;dy = conv(y,d4,'same'); % derivative&#xA;&#xA;[m n] = size(dy);&#xA;maxX = [];&#xA;maxY = [];&#xA;for i = 1 : n - 1&#xA;  if dy(i) &amp;lt; 0 &amp;amp;&amp;amp; dy(i+1) &amp;gt; 0 % max somewhere between i and i+1&#xA;    a = dy(i)/(dy(i) - dy(i+1)); % linear interpolation&#xA;    mx = i + a;&#xA;    maxX = [maxX mx];&#xA;    my = y(i)*(1-a) + y(i+1)*a; % linear interpolation&#xA;    maxY = [maxY my];&#xA;  end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Im my script I had to test for if the derivative changes from negative to positive to get the function to give the desired result, however this confuses me.&#xA;&lt;strong&gt;Should not the derivative for a maximum go from positive to negative?&lt;/strong&gt;&#xA;Is there some better way to distinguish between maxima and minima?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the result of using this function to find the maxima on my signal:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UF8Z5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results look good, but I notice that some maxima are not found:&#xA;i= 143.13, 190.88, 256.97.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this because they are to close to other maxima?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I control the nearest two maxima may be?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any answers!&lt;/p&gt;&#xA;" OwnerUserId="697" LastActivityDate="2012-03-26T13:02:08.697" Title="How do I use a Savitzky Golay filter to find local maxima (in between samples) in a discretely sampled 1D signal?" Tags="|smoothing|interpolation|peak-detection|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1840" PostTypeId="2" ParentId="1839" CreationDate="2012-03-26T13:02:08.697" Score="5" Body="&lt;p&gt;While I'm not familiar with this specific type of filter, based on the plot you've shown, I would guess that the maxima that aren't found by your process are just butting up against the time resolution inherent in the process. Any kind of &quot;smoothing&quot; implies that there is some time-local smearing of the signal of interest, such that if there are two nearby peaks, it's possible that they will be coalesced into one. It's possible that a lower-order filter might present less of this behavior, likely at the expense of the amount of smoothing that you get.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-03-26T13:02:08.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1841" PostTypeId="1" AcceptedAnswerId="1846" CreationDate="2012-03-26T14:22:12.920" Score="8" ViewCount="6217" Body="&lt;p&gt;The easiest way to smooth a signal is by moving window average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more advanced way is to use a Savitzky-Golay filter. &#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_smoothing_filter&quot;&gt;From wikipedia:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The main advantage of this approach is that it tends to preserve&#xA;  features of the distribution such as relative maxima, minima and&#xA;  width, which are usually 'flattened' by other adjacent averaging&#xA;  techniques (like moving averages, for example).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is also a whole range of &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot;&gt;window functions&lt;/a&gt;.&#xA;As I understand this: any finite filter wil cause spectral leakage,&#xA;but the moving window average is the worst. E.g. a Gaussian window is better in this respect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is flattening and spectral leakage the same?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;When should one use Savitzky-Golay and when should one use Gauss, Hann, Hamming etc?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any answers!   &lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="6" LastEditDate="2012-03-26T14:49:02.310" LastActivityDate="2012-03-27T02:15:49.013" Title="How to smooth a signal?" Tags="|lowpass-filter|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1842" PostTypeId="1" AcceptedAnswerId="1854" CreationDate="2012-03-26T16:05:20.170" Score="10" ViewCount="6236" Body="&lt;p&gt;With &lt;a href=&quot;http://opencv.willowgarage.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV&lt;/a&gt;, I compute the homography between, say, these two images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zuntQ.jpg&quot; alt=&quot;first image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m11CK.jpg&quot; alt=&quot;second image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't worry about the strange white form on the right side, it is due to the smartphone holder I use. The homography, given by &lt;a href=&quot;http://opencv.itseez.com/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=findhomography#Mat%20findHomography%28InputArray%20srcPoints,%20InputArray%20dstPoints,%20int%20method,%20double%20ransacReprojThreshold,%20OutputArray%20mask%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;findHomography()&lt;/a&gt; function (using points detected with the &lt;a href=&quot;http://opencv.itseez.com/modules/features2d/doc/common_interfaces_of_feature_detectors.html?highlight=fast#FastFeatureDetector&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast feature detector&lt;/a&gt; and the HammingLUT descriptor &lt;a href=&quot;http://opencv.itseez.com/modules/features2d/doc/common_interfaces_of_descriptor_matchers.html?highlight=knnmatch#void%20DescriptorMatcher::knnMatch%28const%20Mat&amp;amp;%20queryDescriptors,%20vector%3Cvector%3CDMatch%3E%20%3E&amp;amp;%20matches,%20int%20k,%20const%20vector%3CMat%3E&amp;amp;%20masks,%20bool%20compactResult%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;matcher&lt;/a&gt;), is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = [ 1.412817430564191,  0.0684947165270289,  -517.7751355800591;&#xA;     -0.002927297251810,  1.210310757993256,     39.56631316477566;&#xA;      0.000290600259844, -9.348301989015293e-05,  1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, I use the same process to compute the homography between the same images that have been rotated by 180 degrees (upside down), using &lt;a href=&quot;http://www.imagemagick.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;imagemagick&lt;/a&gt; (as a matter of fact, I would be equally interested to know the relation for rotation of 90 or 270 degrees...). Here they are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p4g5d.jpg&quot; alt=&quot;first image upside down&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5IrVT.jpg&quot; alt=&quot;second image upside down&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With these images, the homography becomes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B = [ 0.7148688519736168,  0.01978048500375845,  325.8330631554814;&#xA;     -0.1706219498833541,  0.8666521745094313,    64.72944905752504;&#xA;     -0.0002078857275647, -5.080048486810413e-05,  1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, the question is &lt;strong&gt;how do you relate A and B?&lt;/strong&gt; The two first diagonal values of A are close to the inverse of the same in B, but it's not &lt;em&gt;very&lt;/em&gt; precise (.707805537 instead of 0.71486885). My ultimate purpose would to use the wanted relation to transform final matrix, avoiding to compute a costly image rotation. &lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="1473" LastEditDate="2012-06-06T13:24:47.267" LastActivityDate="2012-06-06T13:24:47.267" Title="What is the link between the homography computed over 2 images and the homography computed over the same images upside down?" Tags="|image-processing|computer-vision|homography|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1843" PostTypeId="1" AcceptedAnswerId="1845" CreationDate="2012-03-24T04:48:19.147" Score="17" ViewCount="1640" Body="&lt;p&gt;The traditional Discrete Fourier Transform (DFT) and its cousin, the FFT, produce bins that are spaced equally. In other words, you get something like the first 10 hertz in the first bin, 10.1 through 20 in the second, etc. However, I need something a little different. I want the range of frequency covered by each bin to increase geometrically. Suppose I select a multiplier of 1.5. Then we have 0 through 10 in the first bin, I want 11 through 25 in the second bin, 26 through 48 in the third, etc. Is it possible to modify the DFT algorithm to behave in this fashion?&lt;/p&gt;&#xA;" OwnerUserId="1192" OwnerDisplayName="Brannon" LastEditorUserId="1059" LastEditDate="2012-03-26T21:57:57.870" LastActivityDate="2017-03-21T01:16:22.730" Title="DFT with geometrically-spaced bins?" Tags="|fft|dft|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1845" PostTypeId="2" ParentId="1843" CreationDate="2012-03-24T15:02:13.287" Score="18" Body="&lt;p&gt;To quote my dissertation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A collection of transforms are given the name constant Q and are&#xA;  similar to the Fourier transform.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Computation of the discrete Fourier transform can be very efficient&#xA;  when employing the use of the fast Fourier transform. However we&#xA;  notice that energy of a signal is divided into uniformly sized&#xA;  frequency buckets across the spectrum. While in many cases this is&#xA;  useful, we notice situations where this uniform distribution is&#xA;  sub-optimal. An important example of such a case is observed with the&#xA;  analysis of musical frequencies. In Western music, the frequencies&#xA;  that make up the musical scales are geometrically spaced. We therefore&#xA;  see that the map between frequency bins of the discrete Fourier&#xA;  transform and the frequencies of musical scales is insufficient in the&#xA;  sense that the bins match poorly. The constant Q transform addresses&#xA;  this issue. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The aim of the constant Q is to produce a set of logarithmically&#xA;  spaced frequency bins in which the width of the frequency bin is a&#xA;  product of the previous. As a result we may produce an identical&#xA;  number of bins per musical note across the audible spectrum, thus&#xA;  maintaining a constant level of accuracy for each musical note. The&#xA;  frequency bins become wider towards the higher frequencies and&#xA;  narrower towards the lower frequencies. This spread in the accuracy of&#xA;  frequency detection closely imitates the manner in which the&#xA;  human-auditory system responds to frequencies. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Additionally, the close matching of notes in western scales renders&#xA;  the constant-Q particularly useful in note detection; identifying a&#xA;  musical note value rather than an explicit frequency value.&#xA;  Furthermore the constant Q simplifies the process of timbre analysis.&#xA;  The frequencies of a musical note played by an instrument are often&#xA;  comprised of harmonically related partials. The timbre of the&#xA;  instrument can be characterised by the ratios of the harmonics. With&#xA;  the constant Q transform, the harmonics are equally spaced across the&#xA;  bins regardless of the fundamental frequency. This greatly simplifies&#xA;  the process of identifying an instrument playing a note anywhere in&#xA;  the scale simply by shifting the characterisation across the bins. A&#xA;  potential downside to using the constant Q transform is that it&#xA;  demands more computation than the Fourier transform.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;An efficient algorithm for transforming a discrete Fourier transform&#xA;  (which may be computed with the FFT) into a Constant Q transform is&#xA;  detailed in &lt;a href=&quot;http://www.wellesley.edu/Physics/brown/pubs/effalgV92P2698-P2701.pdf&quot;&gt;Brown and Puckette (1992).&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1152" OwnerDisplayName="Matt Esch" LastEditorUserId="6" LastEditDate="2012-03-26T20:37:22.670" LastActivityDate="2012-03-26T20:37:22.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1846" PostTypeId="2" ParentId="1841" CreationDate="2012-03-26T18:00:28.553" Score="5" Body="&lt;p&gt;When using a moving average filter, or rectangular convolution in the time domain, the time domain smoothing and so-called spectral leakage are nearly opposing effects.  The smoothing is due to removing high frequency content, and the leakage is the name given for portions of this frequency content that end up not being removed.  Since sharp peaks and transients can be partially composed of high frequency content, smoothing by this kind of convolution can diminish them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time-domain convolution windows other than rectangular may remove less of the very nearby frequencies, but better remove more of the far away frequency content (relative to some transition frequency, which is related approximately to the window width).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An adaptive polynomial regression will remove different spectral characteristics from a signal at different points in time, which could either expose or hide &quot;important&quot; elements of the signal, depending on the signal, and what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-03-26T18:08:12.960" LastActivityDate="2012-03-26T18:08:12.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1847" PostTypeId="1" AcceptedAnswerId="1848" CreationDate="2012-03-26T18:57:39.387" Score="11" ViewCount="3910" Body="&lt;p&gt;I'm trying to implement a singing game that will analise raw mic input and tell the player how good is he singing. That needs to be done in real-time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've come across a lot of threads asking the same question but I'm still quite not done with it, probably due to my lack of experience in the field and shallow math background. I've implemented an algorithm based on the DSPDimension website pitch shift's article: &lt;a href=&quot;http://www.dspdimension.com/admin/pitch-shifting-using-the-ft/&quot;&gt;http://www.dspdimension.com/admin/pitch-shifting-using-the-ft/&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I extract the true frequency and magnitude just like the article explains, but I don't know find the fundamental frequency with this. I've tried to get the bin with greatest magnitude but that only give me right results for higher pitch signals, it doesn't matter which oversampling factor I use I still get bad data for low freq signals. Is this approach completely wrong or am I in the right track but just missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in Advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I forgot to mention that I'm only interested in the pitch class, so it is ok if the fundamental is missing but I have a strong overtone in the sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT2: Thanks to everyone, I just finished a version of the algorithm that's working like a charm. The low pitch estimation problem was due to my input test. When I sung the note it matched correctly. Also, I'm considering all harmonics now, not just the highest peak. &lt;/p&gt;&#xA;" OwnerUserId="1145" LastEditorUserId="1145" LastEditDate="2012-03-27T20:22:42.590" LastActivityDate="2012-04-03T21:02:28.243" Title="Real-Time Human Pitch Detection" Tags="|fourier-transform|pitch|peak-detection|stft|singing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1848" PostTypeId="2" ParentId="1847" CreationDate="2012-03-26T21:09:55.770" Score="9" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I've tried to get the bin with greatest magnitude but that only give me right results for higher pitch signals, it doesn't matter which oversampling factor I use I still get bad data for low freq signals.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's because the harmonics &lt;em&gt;are&lt;/em&gt; larger than the fundamental.  Plot your spectrum and you'll see.  A better method to find the true fundamental is autocorrelation.  Then you're &quot;sliding&quot; the waveform past itself and finding delays at which the wave shape lines up with itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html&quot;&gt;http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you really want them to sing the exact note, or is it ok if they sing an octave above or below depending on their voice register?&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2012-03-26T21:09:55.770" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="1849" PostTypeId="2" ParentId="1847" CreationDate="2012-03-27T00:12:04.653" Score="6" Body="&lt;p&gt;Yes, using a peak frequency estimator for pitch is wrong. Pitch is a psychoacoustic phenomena, so pitch detection or estimation is different from frequency estimation.  There have been plenty of pitch estimation methods given in previous answers to similar questions here.  There's more than 1 to choose from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's one: &lt;a href=&quot;https://stackoverflow.com/questions/4227420/matlab-missing-fundamental-from-an-fft/4231322#4231322&quot;&gt;https://stackoverflow.com/questions/4227420/matlab-missing-fundamental-from-an-fft/4231322#4231322&lt;/a&gt; , and another: &lt;a href=&quot;https://dsp.stackexchange.com/questions/411/tips-for-improving-pitch-detection&quot;&gt;Tips for improving pitch detection&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDED #1: Questions similar to this get asked so often that I wrote up a longer blog post on the topic: &lt;a href=&quot;http://www.musingpaw.com/2012/04/musical-pitch-is-not-just-fft-frequency.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.musingpaw.com/2012/04/musical-pitch-is-not-just-fft-frequency.html&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2012-04-03T21:02:28.243" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1850" PostTypeId="2" ParentId="1841" CreationDate="2012-03-27T02:15:49.013" Score="2" Body="&lt;p&gt;When using a window you are essentially giving more or less importance to some aspect of the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you have a speech synthesis model that generates words by taking sounds of letters and pasting them together,end to end, with out any modification this would be the equivalent of a rectangular window in the time domain. Now this might not sound as it should when played back, very choppy I would assume... But what if we knew how much of one letter we wanted to flow into another and used a shaped window before overlapping the tails of each letter, such as a gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please note this example is for illustration only, audio processing is not my specialty but it is something that can be understood easily)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windows can be applied in the frequency or time domain, and in it really needs to be known what property of the signal you wish to enhance or remove before you know which to use but there are some guidelines and some trade offs for different types of windows. The link you provided to the windowing functions describes more in depth the trade-offs you face for choosing certain windows.&lt;/p&gt;&#xA;" OwnerUserId="1102" LastActivityDate="2012-03-27T02:15:49.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1851" PostTypeId="2" ParentId="1590" CreationDate="2012-03-27T02:49:41.683" Score="3" Body="&lt;p&gt;I do not know the answer to your question, but perhaps this paper can help. I realize that you are not using single bit random waveforms, but the formulation on the distribution they calculated is fairly through. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Probability distribution of the crosscorrelation function of finite-duration single-bit random waveforms&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Abstract&#xA;The detection errors of a digital crosscorrelator, utilizing severely clipped, bandlimited Gaussian waveforms are investigated, and the probability distribution of the correlator output due to finite-duration waveforms and distortion by wideband Gaussian noise is derived and compared with experimental results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4235873&quot; rel=&quot;nofollow&quot;&gt;http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4235873&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1102" LastActivityDate="2012-03-27T02:49:41.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1853" PostTypeId="2" ParentId="1703" CreationDate="2012-03-27T06:52:08.497" Score="2" Body="&lt;p&gt;Smoothing can mean applying a median filter of some size (recommended [5X5]) on the optical flow vecotr you computed at each iteration. This smoothing suppose to improve (significantly) the accuracy.&#xA;in matlab: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;u = medfilt2(u,[5 5]);&#xA;v = medfilt2(v,[5 5]);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where u,v are the optical flow vectors you computed.&#xA;Then (u,v) are the input u,v for the next iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have in mind that at each pyramid level the size of the image is different, andn &#xA;therefore the size of u,v, this means that you have to upsample the previous u,v to size size of the currend pyramid level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Goodluck.&lt;/p&gt;&#xA;" OwnerUserId="900" LastActivityDate="2012-03-27T06:52:08.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1854" PostTypeId="2" ParentId="1842" CreationDate="2012-03-27T11:25:50.143" Score="5" Body="&lt;p&gt;I think when looking at the formula for the homography matrix:&#xA;$$&#xD;&#xA; H_{ba} = R - \frac{tn^T}{d}&#xD;&#xA;$$&#xA;where $R$ is the rotation matrix by which $b$ is rotated in relation to $a$; $t$ is the translation vector from $a$ to $b$; $n$ and $d$ are the normal vector of the plane and the distance to the plane respectively (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Homography#3D_plane_to_plane_equation&quot; rel=&quot;nofollow&quot;&gt;Homography-3D plane to plane equation&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relation between the two matrices lies in the normal vector of the plane. So you need to get the normal vector of the plane (out of the homography matrix), and apply the rotation to it, and then compute the homography matrix using the formula above. For the correct decomposing of the homography matrix, you can look at &lt;a href=&quot;https://gist.github.com/740979&quot; rel=&quot;nofollow&quot;&gt;these code samples&lt;/a&gt; and &lt;a href=&quot;http://hal.inria.fr/docs/00/17/47/39/PDF/RR-6303.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="809" LastEditDate="2012-03-28T09:13:49.563" LastActivityDate="2012-03-28T09:13:49.563" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1855" PostTypeId="2" ParentId="1590" CreationDate="2012-03-27T11:57:59.410" Score="4" Body="&lt;p&gt;Expanding on my comment, $\{\phi(\tau)\}$ is a &lt;strong&gt;non-stationary nonGaussian&lt;/strong&gt; random process, and I doubt that there is any simple answer (or even a rather complicated one) for the probability density function of the &lt;em&gt;random variable&lt;/em&gt;&#xA;$\phi(\tau)$ for an arbitrary value of $\tau$.  But, the (time-varying) mean&#xA;function of the process is easy to calculate.  We have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xD;&#xA;E[\phi(\tau)] &amp;amp;= E\left[\int_{-T/2}^{T/2} g(t)g(t-D+\tau)\, \mathrm dt\right]\\&#xD;&#xA;&amp;amp;= \int_{-T/2}^{T/2} E[g(t)g(t-D+\tau)]\, \mathrm dt\\&#xD;&#xA;&amp;amp;= \int_{-T/2}^{T/2} R_g(\tau-D)\, \mathrm dt\\&#xD;&#xA;&amp;amp;= T\cdot R_g(\tau-D)&#xD;&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $R_g(\cdot)$ is the &lt;em&gt;autocorrelation function&lt;/em&gt; of the input process&#xA;$\{g(t)\}$.  Note that it is not necessary that the input process &#xA;be Gaussian for this to hold; wide-sense-stationarity is enough.&#xA;Since autocorrelation functions have a peak at the origin,&#xA;we see that $\phi(D)$ has&#xA;the largest mean value.  Also, the mean value decays away symmetrically&#xA;about $D$:  that is, $E[\phi(D+\epsilon)] = E[\phi(D-\epsilon)]$ &#xA;and &#xA;$$|E[\phi(\tau)]| \leq E[\phi(D)] = T\cdot R_g(0).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding the variance of $\phi(\tau)$ is a much messier calculation&#xA;that may or may not be included in the paper cited by&#xA;Charna (which is behind a paywall).&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-03-27T11:57:59.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1856" PostTypeId="1" AcceptedAnswerId="1857" CreationDate="2012-03-27T14:30:08.190" Score="4" ViewCount="305" Body="&lt;p&gt;sorry for the long post but I want to try and get all the details in here in hopes it will help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been working on building a procedural audio system for use in XNA projects. First this is general structure of the procedural system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;WaveFragments:&lt;/strong&gt; generate the actual wave forms for a specified duration, based on frequency using a phase accumulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Waves:&lt;/strong&gt; complete wave forms, generated by joining wave fragments together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DynamicWaves:&lt;/strong&gt; use a wave fragment to generate small buffers of waveform data, which are pushed into a DynamicSoundEffectInstance to be played.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is (I think) with my wave generation. At first it seems to work OK, but then after a certain time the sounds frequency alters slightly, and then back again later. &#xA;for example a tone of C3 (130.81f) will increase frequency slightly (but noticeably) at around 20 seconds and then back again later on at 77 seconds. (I've not yet had the patience to see if it shifts again later, I've gone as far as 3 minutes without it shifting up again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to assume its a issue with the way I'm generating the wave data with my phase accumulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my generation of the PhaseDelta based on provided frequency.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; _PhaseDelta = (float)((Math.PI * 2 * _Frequency) / (float)samplesPerSecond);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and here is the calculation I use for the generation of the wave.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int i = 0; i &amp;lt; numSamples; i++)&#xA;{&#xA;     _PhaseAccumulator = MathHelper.Lerp(_PhaseAccumulator, _PhaseAccumulator+_PhaseDelta, _PhaseSmoothness);&#xA;     data[i] = (float)Math.Sin(_PhaseAccumulator) * _Amplitude;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any input that anyone might have. It may be the most glaringly obvious fix, but at this point after hours of dull single tones my brain is two melted to be getting anywhere with fixing this now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I've tried it without lerping the accumulator (obviously produces the clicks at the start) but still produces the shift. I've also tried lerping the phase delta gradually to its new value, again to no avail.&#xA; (&lt;strong&gt;EDIT&lt;/strong&gt;: i have also tried throwing lerp out of the window and just adding the phase delta each sample, again no dice).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is, any ideas on why this weird pitch shift is happening? In practicality it isn't a huge issue, the system was only ever intended for short notes to be stacked together for old video game style music, or a tone that would likely change frequency often. But I'd feel more comfortable knowing that the wave generation is accurate and wasn't accumulating some error somewhere sending it way of track.&lt;/p&gt;&#xA;" OwnerUserId="1149" LastEditorUserId="1149" LastEditDate="2012-03-27T14:39:46.540" LastActivityDate="2012-03-27T15:10:50.500" Title="Procedural wave generation, frequency shift issue" Tags="|frequency|wave|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1857" PostTypeId="2" ParentId="1856" CreationDate="2012-03-27T15:10:50.500" Score="7" Body="&lt;p&gt;I suspect that the accumulator value is growing very large, which causes the float's resolution to degrade.  To avoid this you need to occasionally reduce the accumulator to manageable levels.  One way to do that is to subtract by 2*pi whenever you exceed 2*pi.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-03-27T15:10:50.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1858" PostTypeId="1" AcceptedAnswerId="1861" CreationDate="2012-03-27T17:10:50.233" Score="5" ViewCount="821" Body="&lt;p&gt;At work we were smoothing a signal by convolving with either&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f1=[0.2000 0.2000 0.2000 0.2000 0.2000]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f2=[0.1111 0.2222 0.3333 0.2222 0.1111].&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A colleague noticed that f1 smoothed &quot;stronger&quot; than f2 and suggested a new filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f3=[0.2727 0.1818 0.0909 0.1818 0.2727] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;His reasoning was that this should smooth even &quot;stronger&quot; than f1, and therefore be better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My answer to this was that &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;if he wanted &quot;stronger&quot; smoothing he should instead increase the&#xA;size of the filter &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a good smoothing filter should always approach zero at the start and beginning&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My motivation for 2. was Gaussian filters which are often used for noise reduction in image analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is 2. correct?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also because of the periodic nature of DFT does not f3 have the same frequency response as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f4=[0.0909 0.1818 0.2727 0.2727 0.1818],&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which in turn should have a very similar frequency response as f2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: I followed Jim Clay's suggestion and zero padded and the result shows that f3 has terrible stop band ripple while f2 is quite OK in  this respect:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/oU16K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any answers!&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-03-28T06:46:27.533" LastActivityDate="2012-03-28T06:46:27.533" Title="What are the characteristics of a &quot;good&quot; smoothing convolution kernel?" Tags="|lowpass-filter|convolution|smoothing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1859" PostTypeId="2" ParentId="1858" CreationDate="2012-03-27T17:24:23.487" Score="6" Body="&lt;p&gt;Yes, in general, your #2 is correct.  That being said, both of the filters stink (with your triangle filter being a little better).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, f3 does not have the same frequency response as f4.  To get an idea of why that is so, you generally have to zero-pad the impulse response before DFT'ing it to get a reasonable idea of what its frequency response looks like.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-03-27T17:24:23.487" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1860" PostTypeId="1" CreationDate="2012-03-27T18:23:48.260" Score="3" ViewCount="209" Body="&lt;p&gt;I'm working with data that looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sec Hz amp&#xA;0.0 2630 0.001&#xA;0.1 2340 0.1&#xA;0.2 2220 1.0&#xA;0.3 2200 0.7&#xA;0.4 2200 0.2&#xA;0.5 2200 0.01&#xA;&#xA;sec Hz amp&#xA;1.0 463 0.001&#xA;1.1 534 0.1&#xA;1.2 440 0.4&#xA;1.3 440 0.7&#xA;1.4 440 0.2&#xA;1.5 440 0.01&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This data is for two separate harmonics. You can see that the frequency drifts a little with the attack of the note and that the amplitude beings to fade out towards the end of each harmonics. I'm not showing all the samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I'm doing to establish the relative loudness of these harmonic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Harmonic 1 has a maximum amplitude in the frequency domain of 1.0.&#xA;Harmonic 2 has a maximum amplitude in the frequency domain of 0.7.&#xA;So there amplitude ratio is equivalent to 3.1 dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now take into account that loudness is dependent on frequency and do so via the following table:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(freq,dbs)&#xA;(0, -50)&#xA;(20, -43)&#xA;(30, -33)&#xA;(40, -27)&#xA;(50, -23)&#xA;(60, -21)&#xA;(70, -19)&#xA;(80, -17)&#xA;(90, -16)&#xA;(100, -15)&#xA;(200, -8)&#xA;(300, -6)&#xA;(400, -6)&#xA;(600, -6)&#xA;(700, -7)&#xA;(800, -8)&#xA;(1500, -9)&#xA;(2000, -7)&#xA;(2200, -6)&#xA;(2500, -4)&#xA;(3000, -1.5)&#xA;(3700, 0)&#xA;(4000, -0.5)&#xA;(5000, -4)&#xA;(6000, -9)&#xA;(7000, -14)&#xA;(9000, -16)&#xA;(10000, -15)&#xA;(12000, -25)&#xA;(15000, -40)&#xA;(20000, -55)&#xA;(30000, -70)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Harmonic 1 has a frequency of 2200 Hz, which gives a value of -5 dB in the look up table.&#xA;Harmonic 2 has a frequency of 440 Hz, which gives a value of -6 dB in the look up table.&#xA;So that's a difference of 1 dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The total difference is then 3.1 dB + 1 dB = 4.1 dB. Right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a difference of 10 dB is equivalent to a doubling of loudness:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2^(dB/10)=increase in loudness, with &#xA;2^(4.1/10) = 1.33&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the first harmonic is approximately 33% louder than the second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I on the right track with regard to estimating the difference in loudness? Any obvious mistakes. Any obvious improvements?&lt;/p&gt;&#xA;" OwnerUserId="1142" LastEditorUserId="90" LastEditDate="2012-03-28T12:32:59.673" LastActivityDate="2012-03-28T15:21:18.983" Title="Estimating harmonic loudness" Tags="|audio|frequency-spectrum|music|acoustics|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1861" PostTypeId="2" ParentId="1858" CreationDate="2012-03-27T18:55:16.673" Score="4" Body="&lt;p&gt;As to your point 1, F1 appears to smooth more because it is wider, in terms of its 2nd moment width, an thus has a slightly lower and sharper transition.  But a rectangular filter will have terrible stop-band ripple in exchange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low stop band ripple does require a filter not to have any sharp transitions, at the ends especially as the 2nd derivative gets really large which puts all kinds of high frequency stuff in the frequency response.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-03-27T18:55:16.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1862" PostTypeId="1" CreationDate="2012-03-28T00:15:08.750" Score="2" ViewCount="69" Body="&lt;p&gt;Heads up, this is homework.  Just a little stumped :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some arbitrary primaries, &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt;, &lt;code&gt;C&lt;/code&gt;, which I want to express in terms of the standard &lt;code&gt;XYZ&lt;/code&gt; primaries.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have that the tristimulus values with respect to the &lt;code&gt;ABC&lt;/code&gt; primaries for some random colour &lt;code&gt;R&lt;/code&gt; is defined by some linear matrix equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{bmatrix} R_a \\&#xD;&#xA;R_b \\&#xD;&#xA;R_ c \\&#xD;&#xA;\end{bmatrix}&#xD;&#xA;%&#xD;&#xA;= &#xD;&#xA;%&#xD;&#xA;\begin{bmatrix}&#xD;&#xA;a_{00} &amp;amp; a_{01} &amp;amp; a_{02} \\&#xD;&#xA;a_{10} &amp;amp; a_{11} &amp;amp; a_{12} \\&#xD;&#xA;a_{20} &amp;amp; a_{21} &amp;amp; a_{22}&#xD;&#xA;\end{bmatrix}&#xD;&#xA;%&#xD;&#xA;\begin{bmatrix}&#xD;&#xA;R_x \\&#xD;&#xA;R_y \\&#xD;&#xA;R_z&#xD;&#xA;\end{bmatrix}&#xD;&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can the primaries be computed from this information?&lt;/p&gt;&#xA;" OwnerUserId="1151" LastActivityDate="2012-03-28T16:05:58.680" Title="Conversion between primary colours" Tags="|image-processing|homework|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1863" PostTypeId="1" AcceptedAnswerId="1879" CreationDate="2012-03-28T09:51:53.803" Score="0" ViewCount="1525" Body="&lt;p&gt;my poblem is that i have a database for human dorsal hand veins ,but with intra-class variations , so this problem have a large effect on my results when i need to do matching between my samples for recognition purpose(testing phase after finishing trainning phase ) .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;therefore , i need to know what are the possible solutions that may be suitable here.&#xA;are there any function in matlab can overcome this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;examples of my images(5 images for the same person):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;class 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZULwk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YoIqQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2k7gk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/giVpG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/38ZCG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;class 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PWmoK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/umMYV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bklte.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8cCWm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JcsIe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;class 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AF9TG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GfW6e.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mG7YI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HgKSO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U3fTg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the code that i wrote to obtain the above images was as below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    in_dir = 'E:\master_matlab\HandVein_DataSet';&#xA;    out_dir = 'E:\master_matlab\final resultant images';  &#xA;    for px = 1 : 50,     &#xA;        for hx = 1 : 5,     &#xA;            fname = sprintf('%04dhv%d.bmp', px, hx); &#xA;            current_image = imread(fullfile(in_dir, fname));    &#xA;&#xA;            % do processing       &#xA;&#xA;    level=graythresh(current_image);&#xA;    x=im2bw(current_image,level);&#xA;    % figure,imshow(x);&#xA;    nnew=current_image.*cast(x,class(current_image));&#xA;    medimage=medfilt2(nnew,[5 5]);%median Filtering image&#xA;    % figure,imshow(medimage);&#xA;    z=adapthisteq(medimage);&#xA;    % figure,imshow(z);&#xA;    H = fspecial('unsharp');&#xA;    y=imfilter(z,H);&#xA;    % figure,imshow(y);&#xA;    mIm=imfilter(y,fspecial('average',15),'symmetric');%%%%%%here mask is 15*15 and method is symmetric(not replicate)&#xA;    sIm=y-mIm;&#xA;    bw=im2bw(sIm,0);                          % Convert to binary image&#xA;    ALT_img=imcomplement(bw);                 % Complement binary image&#xA;    % figure,imshow(ALT_img);&#xA;%%%%%% morphological on binary images.&#xA;&#xA;open_img =bwmorph(ALT_img,'open'  ,Inf);&#xA;% figure,imshow(open_img);title('open_img');&#xA;major_img =bwmorph(open_img,'majority' ,Inf);&#xA;ske_img = bwmorph(major_img,'skel',100);&#xA;&#xA;&#xA;%removal outer boundary&#xA;without_border=ske_img.*x;&#xA;% figure,imshow(without_border);&#xA;&#xA;   %%%%spurs removal can be added  or removed&#xA;spur_img=bwmorph(without_border,'spur',1);%8 spurs&#xA;% figure,imshow(spur_img);&#xA;&#xA;% centering the resultant spur_image&#xA;measurements = regionprops(im2double(spur_img), 'Centroid');&#xA;    [rows columns] = size(spur_img);&#xA;    rowsToShift = round(rows/2- measurements.Centroid(2));&#xA;    columnsToShift = round(columns/2 - measurements.Centroid(1));&#xA;    shiftedImage = circshift(spur_img, [rowsToShift columnsToShift]);&#xA;&#xA;    %%%%%cropping to remove the below white lines&#xA;&#xA;rect=[26 ,37 ,255 ,138];&#xA;ssdc=imcrop(shiftedImage, rect);&#xA;q12=imresize((ssdc),1.25);&#xA;% figure,imshow(q12); &#xA;%        &#xA;        % save output     &#xA;        imwrite(q12, fullfile(out_dir, fname));   &#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;regards for all&lt;/p&gt;&#xA;" OwnerUserId="920" LastEditorUserId="920" LastEditDate="2012-04-04T08:07:23.140" LastActivityDate="2012-04-04T08:07:23.140" Title="what is the possible solution for the Intra-class variations poblems?" Tags="|image-processing|computer-vision|matlab|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1864" PostTypeId="1" AcceptedAnswerId="1865" CreationDate="2012-03-28T13:17:51.207" Score="4" ViewCount="3564" Body="&lt;p&gt;I am new to OpenCV and DSP. I want to code a filter which act like a real optical filter. When you filter the image, the output looks like shotted with a $550nm$ optical filter lens. Like a Bandpass filter for image. I wanna filter all lights below $550nm $ wavelength.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible with OpenCV? How can Ii do that? Filter2D or Gabor Filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for my English and sorry if the question is irrevelent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1153" LastEditorUserId="1473" LastEditDate="2012-06-08T07:48:49.887" LastActivityDate="2018-09-17T07:52:02.100" Title="Wavelength filter with OpenCV" Tags="|image-processing|filters|computer-vision|opencv|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1865" PostTypeId="2" ParentId="1864" CreationDate="2012-03-28T14:43:42.053" Score="9" Body="&lt;p&gt;In general this is not possible, since you do not have full spectral information for each pixel, but only coordinates in some low-dimensional color space (i.e. RGB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your image data is in RGB, then the best you can do is to simply take the green color channel (which will be most responsive to 550 nm) and throw away the red and blue.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the actual response of your RGB channels, you might be able to better estimate the 550nm contribution via a linear combination of red and green (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_sensitivity&quot;&gt;Spectral Sensitivity&lt;/a&gt;).   &lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-03-28T15:19:01.227" LastActivityDate="2012-03-28T15:19:01.227" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="1866" PostTypeId="2" ParentId="1860" CreationDate="2012-03-28T15:21:18.983" Score="1" Body="&lt;p&gt;It would help if you could state what exactly you are trying to do. &#xA;The &quot;relative loudness of the harmonics&quot; is normally a function of time because of the different decay rates and/or temporal envelope of the harmonics. There are different ways to condense this into a single number: initial amplitude, peak amplitude, total energy, 250ms into the decay, etc. The most suitable method would depend on your specific goal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The look up table looks questionable to me. None of the loudness curves that I'm aware of (A-weighting, C-weighting, Fletcher Munson, Robinson Dadson, ISO 226) look like that. -9dB at 1500 Hz seems just plain wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The shape of the loudness curves is a function of absolute level. So whatever curve you pick it can only be correct at one level (or a small range of levels). In order to get this really right, you would need measurements that are calibrated in Pascal or dBSPL. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-28T15:21:18.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1867" PostTypeId="1" CreationDate="2010-02-21T13:56:28.897" Score="13" ViewCount="26820" Body="&lt;p&gt;Is there a way to compare 2 audio files, whereby a percentage of difference will be returned?&#xA;I am using &lt;strong&gt;C# VS08&lt;/strong&gt;, .net framework 3.5. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edited: difference in the sound (like for eg. Audio 1: &lt;code&gt;&quot;HELP&quot;&lt;/code&gt;, Audio 2:&lt;code&gt;&quot;HELP ME PLEASE&quot;&lt;/code&gt;, it will return the difference in percentage between this 2 audio.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently saving recorded files in wav format, and its bit rate and quality will also be the same as what will be recorded and compared against. I wish to ask if there is a way to compare the sound (not just the binaries) in 2 audio files of the same properties and same format (WAV), and show the percentage difference between the 2 sounds in the 2 audio files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help will be greatly appreciated.&lt;/p&gt;&#xA;" OwnerDisplayName="Daniel" LastEditorUserId="1473" LastEditDate="2012-06-06T13:25:55.177" LastActivityDate="2015-11-17T16:29:45.640" Title="How do I compare 2 audio files, returning a percentage of difference" Tags="|audio|c#|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1868" PostTypeId="1" AcceptedAnswerId="1880" CreationDate="2012-03-28T15:58:39.173" Score="22" ViewCount="4981" Body="&lt;p&gt;I would like to be able to quickly determine whether a given 2D kernel of integer coefficients is separable into two 1D kernels with integer coefficients. E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 2   3   2&#xA; 4   6   4&#xA; 2   3   2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is separable into&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 2   3   2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 1&#xA; 2&#xA; 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The actual test for separability seems to be fairly straightforward using integer arithmetic, but the decomposition into 1D filters with integer coefficients is proving to be a more difficult problem. The difficulty seems to lie in the fact that ratios between rows or columns may be non-integer (rational fractions), e.g. in the above example we have ratios of 2, 1/2, 3/2 and 2/3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really want to use a heavy duty approach like SVD because (a) it's relatively computationally expensive for my needs and (b) it still doesn't necessarily help to determine &lt;em&gt;integer&lt;/em&gt; coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas ?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FURTHER INFORMATION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coefficients may be positive, negative or zero, and there may be pathological cases where the sum of either or both 1D vectors is zero, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-1   2  -1&#xA; 0   0   0&#xA; 1  -2   1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is separable into&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 1  -2   1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-1&#xA; 0&#xA; 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="39" LastEditorUserId="128" LastEditDate="2020-04-07T05:06:55.243" LastActivityDate="2020-04-07T05:06:55.243" Title="Fast / Efficient Way to Decompose a Separable integer 2D Filter Coefficients without the SVD" Tags="|filters|separability|1d|2d|" AnswerCount="4" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="1869" PostTypeId="2" ParentId="1862" CreationDate="2012-03-28T16:05:58.680" Score="1" Body="&lt;p&gt;Hint: I think you want to determine the [Rx,Ry,Rz] required to make the left side of your equation look like [1 0 0], [0 1 0], and [0 0 1]. This will get you A,B,C expressed in terms of X,Y,Z.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-28T16:05:58.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1870" PostTypeId="2" ParentId="1868" CreationDate="2012-03-28T16:41:43.403" Score="7" Body="&lt;p&gt;Maybe I'm trivializing the problem, but it seems like you could:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Break the $N$-by-$M$ matrix $\mathbf{A}$ into rows $\mathbf{a_i}$, $i = 0, 1, \ldots , N-1$.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each row index $j &amp;gt; 0$:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Elementwise divide $\mathbf{a_j}$ by $\mathbf{a_0}$ to yield the ratio of each element in row $j$ to its counterpart in row zero $\mathbf{r_j}$. This would need to be done using floating-point or some other fractional arithmetic.&lt;/li&gt;&#xA;&lt;li&gt;Inspect the elements in $\mathbf{r_j}$ to determine if they are constant. You'll need to allow for some tolerance in this comparison to allow for floating-point rounding.&lt;/li&gt;&#xA;&lt;li&gt;If the values in $\mathbf{r_j}$ are constant, then row $\mathbf{a_j}$ is a scalar multiple of row $\mathbf{a_0}$. Store the ratio of row $j$ to row $0$ in a list $\mathbf{x}$.&lt;/li&gt;&#xA;&lt;li&gt;If the ratio vector is not constant, then row $\mathbf{a_j}$ is a scalar multiple of row $\mathbf{a_0}$, so you will not be able to decompose the matrix in this way. Stop checking.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If all of the rows were deemed to be constant multiples of row 0 in the tests above, then take the list of row ratio scalars $\mathbf{x}$ and normalize it by the smallest ratio:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;x_{k,norm} = \frac{x_k}{\min_{i=0}^{N-1} x_i}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;After doing so, the normalized list of ratios $\mathbf{x_{norm}}$ will contain a value of 1 for the row that has the smallest norm. You want to see if you can scale this list in some way to yield a list that contains all integer coefficients. A brute-force approach could just do a linear search, that is, calculate:&#xA;$$&#xD;&#xA;\mathbf{x_{scaled}} = K\mathbf{x_{norm}}, K = 1, 2, \ldots, M&#xD;&#xA;$$&#xA;For each value of $K$, after calculating the scaled list of ratios, you would need to check each to see if they are integer-valued (again, with some tolerance). Set $M$ equal to the largest denominator that you're willing to look for in the inter-row ratios.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Not the most elegant method, and it's likely that there's a better way, but it should work, is pretty simple to implement, and should be relatively speedy for modestly-sized matrices.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-03-28T16:41:43.403" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1871" PostTypeId="1" CreationDate="2012-03-28T19:52:33.973" Score="10" ViewCount="1033" Body="&lt;p&gt;I'm finding in trouble trying to resolve this exercise. I have to calculate the convolution of this signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y(t)=e^{-kt}u(t)\frac{\sin\left(\dfrac{{\pi}t}{10}\right)}{({\pi}t)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$u(t)$&lt;/span&gt; is Heavyside function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;well I applied the formula that says that the convolution of these two signal is equal to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y(f)=X(f)\cdot W(f)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X(f)$&lt;/span&gt; is the Fourier transform of the first signal and &lt;span class=&quot;math-container&quot;&gt;$W(f)$&lt;/span&gt; is the Fourier transform of the second signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;well Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$e^{-kt}u(t)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$$X(f)=\dfrac{1}{k+j2{\pi}f}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to make second signal as equals as possible to &lt;span class=&quot;math-container&quot;&gt;$\text{sinc}\left(\dfrac{t}{10}\right)$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so I do this operation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\dfrac{\sin\left(\dfrac{{\pi}t}{10}\right)}{\left(\dfrac{{\pi}t}{10}\right)}{\left(\dfrac{1}{10}\right)}$$&lt;/span&gt; this is equal &lt;span class=&quot;math-container&quot;&gt;$${\left(\dfrac{1}{10}\right)}\text{sinc}\left(\dfrac{t}{10}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;right or not?&lt;/p&gt;&#xA;" OwnerUserId="1141" LastEditorUserId="8202" LastEditDate="2020-02-03T10:44:15.290" LastActivityDate="2020-02-03T10:44:15.290" Title="Solving a Convolution Problem of a 1D Signal" Tags="|fourier-transform|convolution|homework|1d|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1872" PostTypeId="2" ParentId="1867" CreationDate="2012-03-28T19:55:24.997" Score="8" Body="&lt;p&gt;Could you please define the &quot;percentage of difference&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, please tell us which value do you expect to get:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Between two versions of the same file encoded with different settings?&lt;/li&gt;&#xA;&lt;li&gt;Between two versions of the same file, except that one is slightly faster than the other?&lt;/li&gt;&#xA;&lt;li&gt;Between two recordings of the same audio input, but through different microphone/recording equipment?&lt;/li&gt;&#xA;&lt;li&gt;Between two recordings of the same person saying the same word?&lt;/li&gt;&#xA;&lt;li&gt;Between two recordings of the same person saying the same word, with a different prosody (rhythm/melody)?&lt;/li&gt;&#xA;&lt;li&gt;Between two recordings of different persons saying the same word?&lt;/li&gt;&#xA;&lt;li&gt;Between two recordings of the same person saying the same sentence except for a few words?&lt;/li&gt;&#xA;&lt;li&gt;Between a recording of a person and that of a cow?&lt;/li&gt;&#xA;&lt;li&gt;Between a recording of an airplane and music?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What do you want to measure? The speech contents (words)? The melody, rhythm? The overall audio similarity? Encoding/recording equipment differences?&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-03-28T19:55:24.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1873" PostTypeId="2" ParentId="1774" CreationDate="2012-03-28T20:26:49.203" Score="5" Body="&lt;p&gt;I cannot test this on my computer because I do not have the convtmx2 function, here is what the MATLAB help says:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/ref/convmtx2.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.mathworks.com/help/toolbox/images/ref/convmtx2.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;T = convmtx2(H,m,n)&lt;/code&gt; returns the convolution matrix &lt;code&gt;T&lt;/code&gt; for the matrix &lt;code&gt;H&lt;/code&gt;. If &lt;code&gt;X&lt;/code&gt; is an m-by-n matrix, then &lt;code&gt;reshape(T*X(:),size(H)+[m n]-1)&lt;/code&gt; is the same as &lt;code&gt;conv2(X,H)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would get the same resulting convolution of &lt;code&gt;conv2(X,H)&lt;/code&gt; but then you would still have to pull out the correct piece of the convolution.&lt;/p&gt;&#xA;" OwnerUserId="1102" LastEditorUserId="6" LastEditDate="2012-03-29T02:36:14.230" LastActivityDate="2012-03-29T02:36:14.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1874" PostTypeId="2" ParentId="1868" CreationDate="2012-03-28T22:15:26.173" Score="10" Body="&lt;p&gt;Got it! Posting MATLAB code, will post an explanation tonight or tomorrow&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Two original arrays&#xA;N = 3;&#xA;range = 800;&#xA;a = round( range*(rand(N,1)-0.5) )&#xA;b = round( range*(rand(1,N)-0.5) )&#xA;&#xA;% Create a matrix;&#xA;M = a*b;&#xA;N = size(M,1);&#xA;&#xA;% Sanity check&#xA;disp([num2str(rank(M)) ' &amp;lt;- this should be 1!']);&#xA;&#xA;% Sum across rows and columns&#xA;Sa = M * ones(N,1);&#xA;Sb = ones(1,N) * M;&#xA;&#xA;% Get rid of zeros&#xA;SSa = Sa( Sa~=0 );&#xA;SSb = Sb( Sb~=0 );&#xA;&#xA;if isempty(SSa) | isempty(SSb)&#xA;    break;&#xA;end&#xA;&#xA;% Sizes of array without zeros&#xA;Na = numel(SSa);&#xA;Nb = numel(SSb);&#xA;&#xA;% Find Greatest Common Divisor of Sa and Sb.&#xA;Ga = SSa(1);&#xA;Gb = SSb(1);&#xA;&#xA;for l=2:Na&#xA;    Ga = gcd(Ga,SSa(l));&#xA;end&#xA;&#xA;for l=2:Nb&#xA;    Gb = gcd(Gb,SSb(l));&#xA;end&#xA;&#xA;%Divide by the greatest common divisor&#xA;Sa = Sa / Ga;&#xA;Sb = Sb / Gb;&#xA;&#xA;%Scale one of the vectors&#xA;MM = Sa * Sb;&#xA;Sa = Sa * (MM(1) / M(1));&#xA;&#xA;disp('Two arrays found:')&#xA;Sa&#xA;Sb&#xA;disp('Sa * Sb = ');&#xA;Sa*Sb&#xA;disp('Original = ');&#xA;M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-03-28T22:15:26.173" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1875" PostTypeId="1" AcceptedAnswerId="1878" CreationDate="2012-03-29T07:37:38.553" Score="7" ViewCount="1070" Body="&lt;p&gt;I need to apply low-pass filter to PCM files. There are several methods such as FIR filters, IIR (butterworth-chebyshev..) filters but it seems to me applying Fast Fourier transform and eliminating higher frequencies is the closest way to an ideal filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the fastest and closest to ideal filtering method?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is required for anti-aliasing before changing the sampling rate of sound.(Fcutoff=Fs/2) And will be applied every block of 1 sec. data. The main requirement is, after changing the sample rate, the new audio quality must be close as possible to original audio quality. (Not noisy.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1157" LastEditorUserId="1059" LastEditDate="2012-03-29T18:23:19.993" LastActivityDate="2012-03-29T19:46:01.630" Title="Designing a lowpass filter to minimize aliasing in pre-decimated streaming audio" Tags="|filters|audio|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1878" PostTypeId="2" ParentId="1875" CreationDate="2012-03-29T13:36:29.960" Score="8" Body="&lt;p&gt;The best choice of filter depends on your specific application requirements. There are two basic choices: FIR and IIR. IIR will be much more efficient however, it will results in phase distortions. The phase distortions are completely inaudible (unless it's a bizarre outlier case) but clearly measurable. So it depends whether you can tolerate this our not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In either case you need to decide how close you need to get to the new Nyquist frequency and how much aliasing noise you can tolerate. A typical example would be that you want the passband to extend to 90% of the new Nyquist frequency and that you would like your aliasing products to be below -80dB. Based on these specifications you can then design the appropriate filter. Other considerations include how much pass band ripple you can accept and if you have any constraints on maximum group delay and/or latency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example: Let's say you want to downsample from 44.1 kHz to 32 kHz and the new Nyquist frequency is 16kHz. Going to 90% Nyquist (14400 Hz), with 0.1dB pass band ripple and 80 dB of attenuation at 16 kHz could be done with an elliptical filter of 9th order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As nibot has pointed out, zeroing FFT bins is a poor choice for a low pass filter since the resulting low pass has very big side lobes and aliasing rejection will be quite poor. It would also require a proper implementation of an overlap-add or overlap-save algorithm to deal with a continuous signal.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-29T13:36:29.960" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1879" PostTypeId="2" ParentId="1863" CreationDate="2012-03-29T14:45:59.307" Score="3" Body="&lt;p&gt;It boils down to the features.  You have shown some images of the same class. You also need to look at images of the other class(s), and find a set of features that maximize inter-class variance and minimize intra-class variance. What features those might be depends on your data. You need to look at the types of variation that exists within each class, and try to find features, transformations, or distance measures that account for it. It is very hard to tell you anything more specific based on the information you have provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;One thing you can do is post some images of a different class.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, are the images aligned? Maybe before you compute the features you should translate all your images so that the white pixels coincide as much as possible.  Then you can define a distance measure between two images as the percentage of white pixels that co-locate, and then use a k-nearest-neighbor classifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some other random thoughts:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Shape_context&quot; rel=&quot;nofollow&quot;&gt;Shape context&lt;/a&gt; features may be suitable for your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also might want to search the literature on recognizing hand-written characters.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2012-03-29T19:44:58.200" LastActivityDate="2012-03-29T19:44:58.200" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1880" PostTypeId="2" ParentId="1868" CreationDate="2012-03-29T14:49:41.920" Score="11" Body="&lt;p&gt;I have taken &lt;code&gt;@Phonon&lt;/code&gt;'s answer and modified it somewhat so that it uses the GCD approach on just the top row and left column, rather than on row/column sums. This seems to handle pathological cases a little better. It can still fail if the top row or left column are all zeroes, but these cases can be checked for prior to applying this method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [X, Y, valid] = separate(M)    % separate 2D kernel M into X and Y vectors &#xA;  X = M(1, :);                          % init X = top row of M&#xA;  Y = M(:, 1);                          % init Y = left column of M&#xA;  nx = numel(X);                        % nx = no of columns in M&#xA;  ny = numel(Y);                        % ny = no of rows in M&#xA;  gx = X(1);                            % gx = GCD of top row&#xA;  for i = 2:nx&#xA;    gx = gcd(gx, X(i));&#xA;  end&#xA;  gy = Y(1);                            % gy = GCD of left column&#xA;  for i = 2:ny&#xA;    gy = gcd(gy, Y(i));&#xA;  end&#xA;  X = X / gx;                           % scale X by GCD of X&#xA;  Y = Y / gy;                           % scale Y by GCD of Y&#xA;  scale = M(1, 1) / (X(1) * Y(1));      % calculate scale factor&#xA;  X = X * scale;                        % apply scale factor to X&#xA;  valid = all(all((M == Y * X)));       % result valid if we get back our original M&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks to &lt;code&gt;@Phonon&lt;/code&gt; and &lt;code&gt;@Jason R&lt;/code&gt; for the original ideas for this.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2012-03-29T15:00:22.510" LastActivityDate="2012-03-29T15:00:22.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1881" PostTypeId="1" CreationDate="2012-03-29T19:17:24.520" Score="10" ViewCount="3438" Body="&lt;p&gt;I have a calibrated camera and have the intrinsic parameters. I also have the extrinsic parameters relative to a point (the world origin) on a planar surface in the real world. This point I have set as the origin in the real world coordinates [0,0,0] with a normal of [0,0,1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From these extrinsic parameters I can work out the camera position and rotation in the world plane 3d coordinates using this here: &lt;a href=&quot;http://en.wikipedia.org/wiki/Camera_resectioning&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Camera_resectioning&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have a second point which I have extracted the image coordinates for [x, y]. How do I now get the 3d position of this point in the world coordinate system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the intuition here is that I have to trace a ray that goes from the optical center of the camera (which I now have the 3D position for as described above), through the image plane [x,y] of the camera and then through my real world plane which I defined at the top.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can intersect a world coordinate 3d ray with a plane as I know normal and point on that plane. What I don't get is how I find out the 3d position and direction when it leaves the image plane through a pixel. It's the transformation through different coordinate systems that is confusing me.&lt;/p&gt;&#xA;" OwnerUserId="1036" LastEditorUserId="90" LastEditDate="2012-03-30T13:26:28.737" LastActivityDate="2012-06-07T13:30:10.350" Title="Camera calibration/pin hole camera model and working out 3d position" Tags="|computer-vision|3d|camera|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1882" PostTypeId="2" ParentId="1875" CreationDate="2012-03-29T19:46:01.630" Score="0" Body="&lt;p&gt;There is no simple &quot;best&quot; or &quot;ideal&quot;.  There are only trade-offs better matching your specific requirements or priorities (and thus being a worse match for others.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of anti-aliasing, the requirements might include max ripple, transition width, phase linearity, allowance for pre-ringing, max latency, compute cycle or energy requirements or limitations, memory limitations, specific notch frequencies, and etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zeroing FFT bins is excellent at providing steep transitions and sharp notches, and one of the worse possible solutions for meeting any stop-band ripple specification (plus it might ring in the pass-band).  What do you want?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-03-29T19:46:01.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1883" PostTypeId="1" CreationDate="2012-03-29T20:26:32.983" Score="9" ViewCount="3132" Body="&lt;p&gt;I'm working with code found at &lt;a href=&quot;http://rosettacode.org/wiki/Hough_transform#MATLAB&quot; rel=&quot;noreferrer&quot;&gt;Rosetta Code&lt;/a&gt; for creating a Hough transform. I now want to find all the lines in an image. To do so I need the ρ and θ values of each of the peaks in the Hough space. A sample output for a pentagon looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iBsM8.png&quot; alt=&quot;Hough Space&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I find a single [θ,ρ] coordinate for each of the 'hot spots' visible in the Hough space?&lt;/p&gt;&#xA;" OwnerUserId="1156" LastEditorUserId="590" LastEditDate="2012-06-11T11:29:36.457" LastActivityDate="2013-02-27T23:01:57.287" Title="How to do De-Houghing of a Hough transform'ed Image?" Tags="|image-processing|matlab|thresholding|hough-transform|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1884" PostTypeId="1" AcceptedAnswerId="1887" CreationDate="2012-03-29T20:37:27.477" Score="12" ViewCount="253" Body="&lt;p&gt;In the image shown below, I have a 2D data set where I have identified four clusters labeled &lt;code&gt;[0,1,2,3]&lt;/code&gt;. I'm looking for an algorithm to place the labels in a &lt;em&gt;natural*&lt;/em&gt; way for each shape. My first guess was to place them in the &quot;center-of-mass&quot; of the cluster, which is shown below. For contiguous clusters this works fine. For clusters that take a shape as in cluster &lt;code&gt;0&lt;/code&gt; however, the approach fails. Without using a legend, what would be a better method to place the labels on this image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;* &lt;em&gt;natural&lt;/em&gt; here is subjective to some extent, but the point of the labels is to help the viewer associate a certain region in the x-y plane with a number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UICtA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1159" LastActivityDate="2012-03-30T13:39:30.110" Title="Identify the correct spot to place a label" Tags="|image-processing|edge-detection|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1885" PostTypeId="2" ParentId="1883" CreationDate="2012-03-29T22:05:16.307" Score="9" Body="&lt;p&gt;You are  finding the coordinates of the peaks and then uses the axis to scale those into  [θ,ρ] coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how noisy the data, how many false peaks you expect and how much time you have, there are a few ways of doing it. Easiest is to pick some level that is a a real peak, cut of all data below that and then do a center of gravity on each peak to get it's center.      &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also erode/dialte the image until each peak is a single pixel.&lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-03-29T22:05:16.307" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1886" PostTypeId="2" ParentId="1884" CreationDate="2012-03-29T23:41:05.683" Score="8" Body="&lt;p&gt;I submit that the ideal place to place the label should meet two objectives:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;proximity to the center, say $d$.&lt;/li&gt;&#xA;&lt;li&gt;legibility, say $l$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Ergo, we can determine the ideal point by minimizing a holistic metric such as $l \times d^\alpha$ or $l+\alpha d$, where $\alpha$ is the trade-off parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determining $d$ is straightforward. $l$ can be set to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_variation&quot;&gt;total variation&lt;/a&gt; (or some other measure of the level of detail) under the area taken up by the label. You can set this to a high number in regions outside the segment to avoid the problem in your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest is numerical optimization.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2012-03-30T04:10:44.303" LastActivityDate="2012-03-30T04:10:44.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1887" PostTypeId="2" ParentId="1884" CreationDate="2012-03-30T04:21:15.353" Score="11" Body="&lt;p&gt;What about putting the label at the innermost point of the segment? Let's define innermost by the maximum of the distance transform of the segment's mask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With software systems like Mathematica and the sort, it is straightforward to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mask for one segment, and its distance transform:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5wJG6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After repeating for each segment and positioning labels where the individual distance transforms are maximum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qN2ni.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="602" LastEditorUserId="602" LastEditDate="2012-03-30T13:39:30.110" LastActivityDate="2012-03-30T13:39:30.110" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1889" PostTypeId="2" ParentId="1881" CreationDate="2012-03-30T08:36:34.527" Score="2" Body="&lt;p&gt;You can't know the 3d position of the second point. It can be any of the points on the ray from your center of the camera until infinity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a predefined 3d space which resembles the real life scene&lt;/li&gt;&#xA;&lt;li&gt;Get more points of images from a different angle, using the intersection of the rays from different angles, you can get an approximation of the 3d point.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="809" LastActivityDate="2012-03-30T08:36:34.527" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1890" PostTypeId="1" AcceptedAnswerId="1912" CreationDate="2012-03-30T15:14:30.820" Score="3" ViewCount="91" Body="&lt;p&gt;I detect points in images with an algorithm. The only parameter is a threshold &lt;code&gt;T&lt;/code&gt; that I can modify at each image. Such images are from a continuous video, so each one is only slightly different from the previous one. I don't know a priori how many points I get for a determined threshold, as it also depends on the content of the processed image. The whole system needs at least 20 points to continue running, but the more points I have, the more complex the process is, therefore the slower the application. I have made a scheme to represent this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NTFOK.png&quot; alt=&quot;problem visual representation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to maintain &lt;code&gt;nb&lt;/code&gt; over 20 and if possible under 50 to avoid over-computation. I determined an &quot;ideal&quot; value at 40. I begin with &lt;code&gt;T = 30&lt;/code&gt;, but it's only empirical. Usually, &lt;code&gt;T = 10&lt;/code&gt; gets too many points and &lt;code&gt;T = 60&lt;/code&gt; too little.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: &lt;strong&gt;How do I filter &lt;code&gt;T&lt;/code&gt; depending on past values &lt;code&gt;nb&lt;/code&gt;, in order to keep &lt;code&gt;nb&lt;/code&gt; around 40 for each new image?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I precise I'm really not an expert in filtering, as you may have guessed. I'm not even sure it's a filter I need here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: as requested in comments, here is a plot of nb for five different thresholds. Content is always the same (fixed camera), therefore variations are mostly due to camera noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tSABH.png&quot; alt=&quot;evolution of nb on different images, for five different thresholds&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16" LastEditorUserId="16" LastEditDate="2012-04-02T13:01:37.623" LastActivityDate="2012-04-03T13:14:51.680" Title="How do I keep a value between known bounds in an open system?" Tags="|image-processing|filter-design|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1891" PostTypeId="2" ParentId="1640" CreationDate="2012-03-30T17:02:49.630" Score="6" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;However what is conceptually wrong with using say an infinite sum of time shifted rect functions to represent it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There is nothing conceptually wrong with it.  Fourier transforms decompose a signal into a sum of complex sinusoids, but you can also decompose a signal into many other things, which may be more useful in certain applications.  The Haar wavelet transform, for instance, breaks up a signal into a sum of rectangular pulses:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EpVKi.jpg&quot; alt=&quot;enter image description here&quot; /&gt; &lt;a href=&quot;http://classics.understars.org/whats.fractal/&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;We use sinusoids in lots of applications because it makes the most sense in those applications.  For instance, why do we almost always decompose audio signals into sinusoids?  Because our cochleas do the same thing:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YM8Hl.gif&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2021-11-04T15:58:09.757" LastActivityDate="2021-11-04T15:58:09.757" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1892" PostTypeId="1" AcceptedAnswerId="1900" CreationDate="2012-03-30T19:56:01.637" Score="9" ViewCount="1253" Body="&lt;p&gt;I need to detect how fast a camera is panning (either horizontal/vertical) to give a warning to the operator to slow down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entire image is moving as a block, I don't need an actual direction (although H or V would be a bonus) and I only need an approximate magnitude - ie. trigger if more than 'N' pixels shift between frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images are large and generally uniform low contrast scenes, I don't have any obvious highlights to track. I need to do it in realtime (60fps) and without using all of the CPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Niave solution is pick an RoI in the center, find edges, calculate similarity between pairs of frames, shift one of frames left/right/up/down by a pixel, repeat - find minima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wondered if there was a smarter solution?&lt;/p&gt;&#xA;" OwnerUserId="1002" LastEditorUserId="440" LastEditDate="2012-03-31T14:16:50.337" LastActivityDate="2012-03-31T14:16:50.337" Title="Fast approximate optical flow / image shift" Tags="|image-processing|optical-flow|motion-detection|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1893" PostTypeId="2" ParentId="1892" CreationDate="2012-03-30T21:36:16.913" Score="3" Body="&lt;p&gt;This might be a slow terrible solution, but you could do a FFT-based cross-correlation of subsequent frames and then find the peak to identify the offset between frames.  Maybe only do it on a small subset of the image to save processor cycles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would not work with rotation or drastic scene changes from one frame to the next, and there are probably better methods.  This is kind of a &quot;I have a hammer so everything looks like a nail&quot; solution.  I guess this is just like your naive solution, except there's no need for edge detection and the FFT makes it a lot faster than explicitly shifting one pixel at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question is similar, and no one's suggesting anything other than cross-correlation, so maybe it's not so bad: &lt;a href=&quot;https://stackoverflow.com/q/5123991/125507&quot;&gt;Using MATLAB to calculate offset between successive images&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2012-03-30T21:42:56.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1894" PostTypeId="1" AcceptedAnswerId="1946" CreationDate="2012-03-30T23:41:57.023" Score="7" ViewCount="1197" Body="&lt;p&gt;I read a paper about a brain-computer interface. In this paper the authors reported &quot;each signal has been filtered with an 8-order band-pass Chebishev Type I filter which cut-off frequencies are 0.1 and 10 Hz and has been decimated according to the high cut-off frequency&quot;. I tried to design this filter with scipy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import scipy.signal as signal&#xA;signal.cheby1(8,0.05,[0.1,10.0],btype='band',analog=0,output='ba')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Warning: invalid value encountered in sqrt&#xA;(array([ nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,&#xA;    nan,  nan,  nan,  nan,  nan,  nan]), array([ nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,&#xA;    nan,  nan,  nan,  nan,  nan,  nan]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have no background in signal processing, so I actually don't know what I am doing. I don't know whether they used a IIR or FIR filter or whether I have to scale the cut-off frequencies or whether I'm using the wrong ripple. I hope you can help me.&lt;/p&gt;&#xA;" OwnerUserId="1165" LastEditorUserId="1165" LastEditDate="2012-04-05T21:07:06.370" LastActivityDate="2012-04-06T03:14:11.427" Title="How do I apply a Chebishev filter?" Tags="|filters|software-implementation|bandpass|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1895" PostTypeId="1" AcceptedAnswerId="1901" CreationDate="2012-03-31T07:31:42.587" Score="10" ViewCount="836" Body="&lt;p&gt;I have a scanned PDF material to which I want to add hidden text layer, so I could index the document. I used ghostscript black and white tiff output device (tiffg4) to extract pages as tiff images, and here is example of what they look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l65gq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Processing this image with tesseract, does not give good results.&lt;br&gt;&#xA;Changing ghostscript output DPI (600, 300, 150, 96) shows that image at 96 DPI gives best result from tesseract but it's still not satisfactory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I thought to ask for advice which filter would enhance this image for OCR processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use imagemagick, or numpy/scipy/ndimage &lt;/p&gt;&#xA;" OwnerUserId="719" LastActivityDate="2018-05-25T17:57:21.637" Title="Filtering kinda &quot;half-toned&quot; image for OCR processing" Tags="|image-processing|ocr|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1896" PostTypeId="2" ParentId="1892" CreationDate="2012-03-31T08:55:55.257" Score="0" Body="&lt;p&gt;I think cross-correlation is a good approach to find the offset, but if you want to do it real fast then you could try to restrict it to only a single vertical and a single horizontal scanline (i.e. through the center of the image.) Computing the cross-correlation between the scanlines in both frames should give you an approximation of the horizontal and vertical offset.&lt;/p&gt;&#xA;" OwnerUserId="1167" LastActivityDate="2012-03-31T08:55:55.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1897" PostTypeId="1" AcceptedAnswerId="1904" CreationDate="2012-03-31T09:04:45.217" Score="3" ViewCount="37950" Body="&lt;p&gt;Which is the maximum frequency of a speaker of any common mobile phone? I would like to use sound to repel some animals, so I need playback sampling rate to be above 44100 Hz.&lt;/p&gt;&#xA;" OwnerUserId="1051" LastEditorUserId="6" LastEditDate="2012-04-01T06:39:47.263" LastActivityDate="2020-10-05T21:22:35.453" Title="Maximum frequency of any mobile phone speaker" Tags="|sound|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1898" PostTypeId="2" ParentId="1892" CreationDate="2012-03-31T09:19:22.530" Score="3" Body="&lt;p&gt;One way you could estimate the velocity and the direction would be to make a &quot;local&quot; flow estimation of e.g. four windows in the center of image. The Lucas–Kanade differential method assumes the displacement is approximately constant and it is therefore possible to solve as an equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my step-by-step guide would be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get a window of pixels in the center of the image, e.g. 20x20&lt;/li&gt;&#xA;&lt;li&gt;Calculate the gradients Ix and Iy.&lt;/li&gt;&#xA;&lt;li&gt;Split the gradient window into four pieces, e.g. 4x10x10.&lt;/li&gt;&#xA;&lt;li&gt;Solve the four linear least squares equations with next frame.&lt;/li&gt;&#xA;&lt;li&gt;Average the four velocity vectors.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This determines the direction and velocity, however you could use a weighted window to make it more robust. Look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Lucas%E2%80%93Kanade_method&quot; rel=&quot;nofollow&quot;&gt;the Lucas-Kanade method&lt;/a&gt; for its extensions.&lt;/p&gt;&#xA;" OwnerUserId="814" LastEditorUserId="814" LastEditDate="2012-03-31T09:57:54.057" LastActivityDate="2012-03-31T09:57:54.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1899" PostTypeId="1" CreationDate="2012-03-31T13:18:43.923" Score="-3" ViewCount="229" Body="&lt;p&gt;I have to represent a low-pass filter in the Fourier domain having a cut-off frequency of $f_c={3}\ kHz$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could &lt;strong&gt;all&lt;/strong&gt; low-pass filters could be represented with this function: $H(f)=\frac{1}{1+j\left(\frac{f}{f_c}\right)}$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, my filter could be represented with this function: $H(f)=\frac{1}{1+j\left(\frac{f}{3*10^3}\right)}$. Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="1141" LastEditorUserId="76" LastEditDate="2012-12-22T23:50:51.763" LastActivityDate="2012-12-22T23:50:51.763" Title="Function in the Fourier domain of a low-pass filter" Tags="|lowpass-filter|frequency-response|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1900" PostTypeId="2" ParentId="1892" CreationDate="2012-03-31T14:01:29.717" Score="3" Body="&lt;p&gt;Probably if you are looking for a &lt;em&gt;simple&lt;/em&gt; method, it is to apply the standard Motion Estimation algorithms which are very much matured in MPEG class of compression codecs. They are easy to understand and i guess you will get a lot of ready to use codes. This algorithm produces motion vector on block by block basis - and then you can find the most prominent cluster and take the average motion vector direction and magnitude. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;MPEG4 - has another key concept called &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Global_motion_compensation&quot; rel=&quot;nofollow&quot;&gt;Global Motion compensation&lt;/a&gt;&quot;, a technique which makes attempts to first estimate and compensate camera motion and panning. The beauty is that such methods can be simpler or exhaustive depending on complexity. Here is one &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.52.5948&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;example paper&lt;/a&gt; and another &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.63.609&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; for the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, camera panning and motion estimation is quite an established research domain. here is a reference: &lt;a href=&quot;http://yosi-keller.narod.ru/publications/pdf/warpfreeopf_mpeg4_published.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; and &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.7.7636&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;another paper&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On this subject. You will find both rigor and accurate algorithm as well as simple and fast ones. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-03-31T14:01:29.717" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1901" PostTypeId="2" ParentId="1895" CreationDate="2012-03-31T14:09:21.657" Score="9" Body="&lt;p&gt;What you really require is probably some morphological operation like dilation followed by erosion. This is called as &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/close.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Closing operation&lt;/a&gt;. May be in your case- just dilation itself might be good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was a similar question asked previously - which can help with other aspects. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/686/monochrome-1-bit-black-and-white-image-conversion/690#690&quot;&gt;monochrome (1-bit black-and-white) image conversion&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/945/how-do-i-reconstruct-text-from-an-image-using-only-morphological-operations/1026#1026&quot;&gt;How do I reconstruct text from an image using only morphological operations?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-03-31T14:09:21.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1902" PostTypeId="2" ParentId="1899" CreationDate="2012-03-31T16:43:04.383" Score="6" Body="&lt;p&gt;Not right. Your basic assumption that &lt;strong&gt;all&lt;/strong&gt; lowpass filters can be represent through your formula is wrong. What you have is a first order IIR low pass but there are many more options for a low pass filter, such as higher order IIR filter of different types (butterworth, bessel, chebycheff 1+2, elliptic) and plus various FIR filters as well. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-31T16:43:04.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1903" PostTypeId="2" ParentId="1894" CreationDate="2012-03-31T16:55:50.687" Score="2" Body="&lt;p&gt;Two cutoff frequencies typically means it's a bandpass filter with the highpass at 0.1Hz and the low pass at 10 Hz. &#xA;The low pass cutoff (which is the higher of the two frequencies) determines by how much you can down sample. If your lowpass filter was infinitely steep, you could get away with a new sample rate of 20 Hz (twice the cutoff). Since it has limited steepness, you need to leave a guard band between the cutoff frequency and the new Nyquist frequency. How much you need depends on the order of the filter and how much aliasing noise you can tolerate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this specific example it seems they have down-sampled by a factor of 12 or thereabouts, which seems too aggressive to me and will likely result in a lot of aliasing noise.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-03-31T16:55:50.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1904" PostTypeId="2" ParentId="1897" CreationDate="2012-03-31T20:36:44.570" Score="5" Body="&lt;p&gt;The native sampling frequency of iOS devices is 44100 Hz, while Android devices can operate at either 8, 16, 24, 44.1 or 48 kHz. Support of all of these depends on Android device manufacturer, however most Android support all of them.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-04-01T06:40:12.520" LastActivityDate="2012-04-01T06:40:12.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1905" PostTypeId="1" AcceptedAnswerId="1907" CreationDate="2012-04-02T03:59:42.873" Score="5" ViewCount="73" Body="&lt;p&gt;Doing time domain processing of incoming audio. I sample the power level every 0.25s and keeping a running average of intensity over 5 samples. When the power level of the current sample is 10dB greater than the moving average, we start recording.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the correct names for these numbers? I also use the same method to trigger recording stop. Is this the same terminology?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the code and will use your suggestion to name the variables correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1171" LastActivityDate="2012-04-02T05:51:32.330" Title="I trigger recording when power of current sample is X dB greater than last Y samples, what is the terminology here?" Tags="|audio|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1906" PostTypeId="1" CreationDate="2012-04-02T05:12:30.647" Score="2" ViewCount="4558" Body="&lt;p&gt;I want to write a MATLAB program for simple object recognition using bag of features. In short, I want to first extract the features from an image, create a visual library using those features, then cluster up the features belonging to one part together, hence creating different parts. now use these parts for matching. i have the basic idea but i don't know much math behind this, also i don't know how i can go about implementing it. can anyone help me with the matlab code for this? &lt;/p&gt;&#xA;" OwnerUserId="1172" LastEditorUserId="53" LastEditDate="2015-01-13T18:11:02.200" LastActivityDate="2015-01-13T18:11:02.200" Title="Object Recognition using bag of features using matlab" Tags="|image-processing|matlab|computer-vision|object-recognition|matlab-cvst|" AnswerCount="2" CommentCount="4" ClosedDate="2012-05-18T17:51:52.203" ContentLicense="CC BY-SA 3.0" />
  <row Id="1907" PostTypeId="2" ParentId="1905" CreationDate="2012-04-02T05:51:32.330" Score="6" Body="&lt;p&gt;&quot;Running average&quot; is fine. You can also call it the &lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average&quot;&gt;moving average&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose you could call the variable associated with the 10dB number the &lt;em&gt;signal detection threshold&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-04-02T05:51:32.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1908" PostTypeId="2" ParentId="1906" CreationDate="2012-04-02T07:40:04.607" Score="1" Body="&lt;p&gt;The, for now free available &lt;a href=&quot;http://szeliski.org/Book/&quot; rel=&quot;nofollow noreferrer&quot;&gt;computer vision book&lt;/a&gt;, by Richard Szeliski contains an excellent introduction to this algorithm. Page 612. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I answered a similar question &lt;a href=&quot;https://dsp.stackexchange.com/a/1788/420&quot;&gt;here&lt;/a&gt; on DSP with some example code. &lt;/p&gt;&#xA;" OwnerUserId="420" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-04-05T18:38:09.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1909" PostTypeId="2" ParentId="1906" CreationDate="2012-04-02T09:48:46.907" Score="1" Body="&lt;p&gt;I'm not sure stackexchange is the platform to just give you the code, what I reccomend you to start with is the feature extraction, download vl_sift package for matlab and get the features from each of your images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next step,is quantize the features: You can get hundred of features for each image, you need to decide how many are enough for your task and then cluster them, and these are your final features. (You need to quantize them because 2 features - even if describe the same object, might be slightly different. You want two very close features to be represented by the same descriptor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, after you have feaures, you need to represent your image by its features, for bag of words the common representation is usually histograms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can compare 2 images representations to decide if they are the same. This stage can be done in many ways, an easy option is an SVM classifier, download lib_svm package, it is very easy to use. Please note that SVM can decide between 2 classes, if your task is &quot;recognition&quot; then you might need to use multi class SVM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, start with vl_sift, that will give you a good sense of what you need to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Goodluck.&lt;/p&gt;&#xA;" OwnerUserId="900" LastActivityDate="2012-04-02T09:48:46.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1911" PostTypeId="1" CreationDate="2012-04-02T14:23:43.563" Score="15" ViewCount="14310" Body="&lt;p&gt;I am writing an algorithm that process 3D images based on the local moment of inertia. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a 3x3 real symmetric matrix, from which I need to find the eigenvalues. I have found a variety of generic algorithm for the diagonalization of matrices out there, but I could not get to know if there exists an analytical expression for the 3 eigenvctors of such a matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would someone proficient in maths know that? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the record here is what I have found on the question myself.&#xA;As Matthias Odisio said, you can't get down to a &lt;strong&gt;simple&lt;/strong&gt; analytical expression as soon as you have a 3x3 matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found however a dedicated paper for the special case a 3x3 hermitian matrices, where various numerical specialized approaches are compared:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://arxiv.org/abs/physics/0610206&quot; rel=&quot;noreferrer&quot;&gt;http://arxiv.org/abs/physics/0610206&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the C and Fortran code of the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mpi-hd.mpg.de/personalhomes/globes/3x3/index.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.mpi-hd.mpg.de/personalhomes/globes/3x3/index.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="756" LastEditorUserId="756" LastEditDate="2012-04-17T12:32:40.340" LastActivityDate="2020-10-27T23:07:59.790" Title="Analytical expression for the eigenvectors of a 3x3 real, symmetric matrix?" Tags="|3d|matrix|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1912" PostTypeId="2" ParentId="1890" CreationDate="2012-04-02T14:58:10.400" Score="2" Body="&lt;p&gt;In your plot of nb vs. image it appears that there is some high-frequency &quot;noise&quot; (no surprise there), and that the windowed mean is surprisingly stable.  For the purposes of this answer I am going to assume that the high-frequency noise is fairly representative of the general case, but that there will also be some slow-to-medium trends as well.  It seems like there would have to be if the images are changing.  The frame rate should generally be faster than the changes, though, so the trends should be relatively slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally I would suggest a low-frequency filter to get rid of the high-frequency &quot;noise&quot;, but in this case I don't think that would be wise.  For any given image the next image is very likely to be highly correlated, so I think it makes sense to adjust somewhat if an image has a large change in nb.  I suggest two different solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Use a simple &lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average&quot; rel=&quot;nofollow&quot;&gt;moving average&lt;/a&gt; of the past &lt;em&gt;n&lt;/em&gt; nb values.  Performance is obviously important in this application, and a moving average is computationally cheap.  A moving average gives some stability, which is important given the high-frequency noise, but also is responsive to changes in the data.  You can trade responsiveness for stability by decreasing or increasing &lt;em&gt;n&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the nb moving average you use that to produce the &quot;error&quot; which is your target nb minus the moving average nb.  Thus, if the average nb is too low, the error is positive, if the average nb is too high, the error is negative.  You use the error to adjust the threshold.  Typically the new threshold would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$threshold = threshold - \alpha * error$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\alpha$ needs to be determined either by analysis of your problem or by empirically testing.  You substract the error result from the threshold because a positive error means you need nb to go up, which means that you need the threshold to go down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Use a &lt;a href=&quot;http://en.wikipedia.org/wiki/PID_controller&quot; rel=&quot;nofollow&quot;&gt;PID controller&lt;/a&gt;.  The PID controller would produce a threshold value for every image, and use the target nb vs. actual nb error (similar to the moving average error except it's an instantaneous error, not an average) to update its threshold for the next image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;integral&quot; portion of the controller will give you stability, while the proportional/derivative part will give you responsiveness.  You would need to make sure that the loop itself is stable, and test the constants on different videos, but this would be a very powerful way of adjusting the threshold.  It also offers the possibility of making your app smarter by changing the loop constants dynamically, if needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution 1 is easier to implement and is a little cheaper computationally, solution 2 is more powerful but also more complicated.  I would see if the moving average is good enough.  If it is, great, if not, implement the PID controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Tried to make the two solutions a little clearer.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-04-03T13:14:51.680" LastActivityDate="2012-04-03T13:14:51.680" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1914" PostTypeId="2" ParentId="1911" CreationDate="2012-04-02T16:25:02.647" Score="9" Body="&lt;p&gt;&lt;a href=&quot;http://www.wolframalpha.com/input/?i=eigenvectors%20of%20%7B%7Ba,b,c%7D,%7Bb,d,e%7D,%7Bc,e,f%7D%7D&quot; rel=&quot;noreferrer&quot;&gt;Wolfram|Alpha has made such things easy&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iHeXV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2012-04-02T16:25:02.647" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1919" PostTypeId="1" AcceptedAnswerId="1923" CreationDate="2012-04-03T08:41:57.040" Score="13" ViewCount="29901" Body="&lt;p&gt;I'm trying to calculate an autocorrelation on a platform where the only accelerated primitive I have available is the (I)FFT. I'm having a problem though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I prototyped it in &lt;a href=&quot;http://en.wikipedia.org/wiki/MATLAB&quot;&gt;MATLAB&lt;/a&gt;. I am, however, slightly confused. I assumed that it works simply as follows (this is from memory so apologies if I've got it slightly wrong).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; autocorr = ifft( complex( abs( fft( inputData ) ), 0 ) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I get a different result than I get from using the &lt;code&gt;xcorr&lt;/code&gt; function.  Now I'm fully expecting not to get the left hand side of the auto correlation (as it's a reflection of the right hand side and thus not needed anyway). However, the problem is my right hand side appears to be, itself, reflected around the halfway point. Which effectively means that I get about half the amount of data that I'm expecting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm sure I must be doing something very simple wrong, but I just can't figure out what.&lt;/p&gt;&#xA;" OwnerUserId="333" LastEditorUserId="207" LastEditDate="2012-04-03T23:21:51.580" LastActivityDate="2013-12-11T05:01:00.917" Title="Efficiently calculating autocorrelation using FFTs" Tags="|matlab|audio|fft|autocorrelation|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1920" PostTypeId="1" AcceptedAnswerId="1921" CreationDate="2012-04-03T08:49:42.990" Score="9" ViewCount="6269" Body="&lt;p&gt;I am writing software for processing audio given as 16-bit PCM samples. The first stage of the processing involves calculating the energy (or total variation) in a certain frequency range (above a certain cut-off frequency). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am currently doing is subtracting the energy of the low-pass filtered signal from the energy of the original signal. I found out that a lot of the processing is dedicated to converting the integer sampels to a floating point representation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, is there a technnique for filtering the integer samples without converting them to floating point?&lt;/p&gt;&#xA;" OwnerUserId="1037" LastActivityDate="2012-04-03T17:49:38.283" Title="Low pass filtering on short int (16 bit PCM) samples" Tags="|filters|audio|lowpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1921" PostTypeId="2" ParentId="1920" CreationDate="2012-04-03T09:31:08.590" Score="6" Body="&lt;p&gt;Yes of course, you can apply the filter directly to the integer samples, using &lt;a href=&quot;http://en.wikipedia.org/wiki/Fixed-point_arithmetic&quot; rel=&quot;nofollow&quot;&gt;fixed point arithmetic&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you use a FIR filter with coefficients [1 / 3, 1, 1 / 2], and an 8-bit resolution for coefficients, your output will be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;out[n] = (85 * sample[n] + 256 * sample[n - 1] + 128 * sample[n - 2]) &amp;gt;&amp;gt; 8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Two things to take be careful about:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Coefficients quantization might cause at best slight changes of filter responses, at worst cause filter instabilities. What is your filter type and the value of its coefficients?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Overflow / Data types / Truncation problems. In the example above, out can exceed the range of a 16-bit integer, so you will have to do some clipping.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-04-03T14:31:05.377" LastActivityDate="2012-04-03T14:31:05.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1922" PostTypeId="2" ParentId="1919" CreationDate="2012-04-03T09:42:58.900" Score="10" Body="&lt;p&gt;Matlab's xcorr computes a $2N - 1$ FFT, where $N$ is the length of the input data (ie, the input is padded with $N - 1$ zeros). This avoids the circularity problem.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-04-03T09:42:58.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1923" PostTypeId="2" ParentId="1919" CreationDate="2012-04-03T11:17:13.617" Score="20" Body="&lt;p&gt;pichenettes is right, of course. The FFT implements a circular convolution while the xcorr() is based on a linear convolution. In addition you need to square the absolute value in the frequency domain as well. Here is a code snippet that handles all the zero padding, shifting &amp;amp; truncating.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Cross correlation through a FFT&#xA;n = 1024;&#xA;x = randn(n,1);&#xA;% cross correlation reference&#xA;xref = xcorr(x,x);&#xA;&#xA;%FFT method based on zero padding&#xA;fx = fft([x; zeros(n,1)]); % zero pad and FFT&#xA;x2 = ifft(fx.*conj(fx)); % abs()^2 and IFFT&#xA;% circulate to get the peak in the middle and drop one&#xA;% excess zero to get to 2*n-1 samples&#xA;x2 = [x2(n+2:end); x2(1:n)];&#xA;% calculate the error&#xA;d = x2-xref; % difference, this is actually zero&#xA;fprintf('Max error = %6.2f\n',max(abs(d)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorUserId="235" LastEditDate="2012-04-26T23:31:39.657" LastActivityDate="2012-04-26T23:31:39.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1924" PostTypeId="1" AcceptedAnswerId="1969" CreationDate="2012-04-03T12:37:17.827" Score="5" ViewCount="5627" Body="&lt;p&gt;I have a binarized image to which i add noise and then try to filter out the noise using various thresholding algorithms such as otsu and niblack.How can i compare the resultant image with the original image so as to find the percentage error that exists between the two??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the original image is as such:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Fzo9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and the resultant image is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eLqnf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I need a way to find the percentage error that is present.&lt;/p&gt;&#xA;" OwnerUserId="1173" LastEditorUserId="440" LastEditDate="2012-04-09T07:23:35.687" LastActivityDate="2013-10-03T05:28:23.777" Title="How do I compare two resultant images from different binarization algorithms?" Tags="|image-processing|matlab|thresholding|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1925" PostTypeId="2" ParentId="1924" CreationDate="2012-04-03T13:14:49.123" Score="2" Body="&lt;p&gt;Count the number of black pixels in the original image (P). Count the number of pixels that are black in the original image, but white in the new image (FN). Your percentage of false negatives is FN / P * 100.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Count the number of white pixels in the original image (N).  Count the number of pixels that are white in the original image, but black in the new image (FP).&#xA;Your percentage of false positives is FP / N * 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there are more white pixels than black pixels, you may want to weigh the false negative error and the false positive error differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, if your image is already binary, why are using thresholding? I would think morphological operations might be a better option for this problem.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2012-04-03T13:38:13.883" LastActivityDate="2012-04-03T13:38:13.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1929" PostTypeId="2" ParentId="1920" CreationDate="2012-04-03T17:49:38.283" Score="3" Body="&lt;p&gt;One some processors, converting a large (but in cache) block of integers to floats before processing them might be faster, due to the elimination of pipeline hazards.  You might want to benchmark this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use scaled integer or fixed point arithmetic, the amount of added integer precision you will need in the coefficients and intermediate values is roughly proportional to the ratio between your sample rate and your desired cut-off frequency.  You may need to use 24,32,48-bit or more precision integer arithmetic on your 16-bit samples to get down to your desired numerical noise floor level.  Some processor instruction sets (ARM, MIPS, etc.) may include 64 bit accumulating arithmetic for just this purpose.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-04-03T17:49:38.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1930" PostTypeId="1" CreationDate="2012-04-03T22:03:00.070" Score="1" ViewCount="352" Body="&lt;p&gt;In &lt;a href=&quot;http://www.statsoft.com/textbook/time-series-analysis/#cross&quot; rel=&quot;nofollow&quot;&gt;Statistica&lt;/a&gt; gain is defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Gain. The gain value is computed by dividing the cross-amplitude value&#xA;  by the spectrum density estimates for one of the two series in the&#xA;  analysis. Consequently, two gain values are computed, which can be&#xA;  interpreted as the standard least squares regression coefficients for&#xA;  the respective frequencies.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, spec.pgram (the engine behind spectrum) in R does not return the cross-amplitude value (as far as I can tell).  How can I calculate gain for these signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;makewave &amp;lt;- function(freq,phase,amp,Nsamples=length*samplerate,samplerate,time=Nsamples/samplerate,as.time.series=TRUE) {&#xA;  time &amp;lt;- Nsamples/samplerate&#xA;  phase &amp;lt;- phase*(2*pi)/180&#xA;  wavetimes &amp;lt;- seq(0+phase,time*freq*pi*2+phase,length.out=Nsamples)&#xA;  #plot(1:samples/samplerate,amp*sin(wavetimes),type=&quot;l&quot;,xlab=&quot;Time&quot;)&#xA;  if (as.time.series) {res &amp;lt;- ts(amp*sin(wavetimes),deltat=1/samplerate)} else {res &amp;lt;- amp*sin(wavetimes)}&#xA;  return(res)&#xA;}&#xA;signal1 &amp;lt;- makewave(15,30,1,180,60)&#xA;signal2 &amp;lt;- makewave(15.01,60,1,180,60)&#xA;signal.union &amp;lt;- ts.union(signal1,signal2)&#xA;sp &amp;lt;- spectrum(signal.union,span=c(3),taper=0)&#xA;plot(sp)&#xA;plot(sp,plot.type=&quot;phase&quot;)&#xA;plot(sp,plot.type=&quot;coh&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1178" LastActivityDate="2012-07-09T17:42:10.347" Title="How to calculate the gain in a bivariate fft in R?" Tags="|fft|fourier-transform|software-implementation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1932" PostTypeId="1" CreationDate="2012-04-04T08:19:28.063" Score="34" ViewCount="20977" Body="&lt;p&gt;I'm trying to implement various binarization algorithms to the image shown: &lt;img src=&quot;https://i.stack.imgur.com/jUElt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;clear;&#xA;x=imread('n2.jpg');     %load original image&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;%   Now we resize the images so that computational work&#xA;  becomes easier later onwards for us.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;size(x);&#xA;x=imresize(x,[500 800]);&#xA;figure;&#xA;imshow(x);&#xA;title('original image');&#xA;&#xA;z=rgb2hsv(x);       %extract the value part of hsv plane&#xA;v=z(:,:,3);&#xA;v=imadjust(v);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;%now we find the mean and standard deviation required for niblack and&#xA;%sauvola algorithms&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m = mean(v(:))&#xA;s=std(v(:))&#xA;k=-.4;&#xA;value=m+ k*s;&#xA;temp=v;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;%   implementing niblack thresholding algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for p=1:1:500&#xA;    for q=1:1:800&#xA;        pixel=temp(p,q);&#xA;        if(pixel&amp;gt;value)&#xA;            temp(p,q)=1;&#xA;        else&#xA;            temp(p,q)=0;&#xA;        end&#xA;    end&#xA;end&#xA;figure;&#xA;imshow(temp);&#xA;title('result by niblack');&#xA;k=kittlerMet(g);&#xA;figure;&#xA;imshow(k);&#xA;title('result by kittlerMet');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;%   implementing sauvola thresholding algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;val2=m*(1+.1*((s/128)-1));&#xA;t2=v;&#xA;for p=1:1:500&#xA;for q=1:1:800&#xA;    pixel=t2(p,q);&#xA;    if(pixel&amp;gt;value)&#xA;        t2(p,q)=1;&#xA;    else&#xA;        t2(p,q)=0;&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;end&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure;&#xA;imshow(t2);&#xA;title('result by sauvola');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results I obtained are as shown:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BJmUK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/M7lBy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xBM91.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the resultant images are degraded at the darker spots.Could someone please suggest how to optimize my result??&lt;/p&gt;&#xA;" OwnerUserId="1173" LastEditorUserId="128" LastEditDate="2020-12-13T13:24:33.713" LastActivityDate="2020-12-13T13:24:33.713" Title="What Are the Best Algorithms for Document Image Thresholding (Example Inside)?" Tags="|image-processing|matlab|thresholding|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1933" PostTypeId="1" CreationDate="2012-04-04T08:26:41.830" Score="4" ViewCount="14882" Body="&lt;p&gt;I have made a python code to smoothen a given signal using the Weierstrass transform, which is basically the convolution of a normalised gaussian with a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is as follows:  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#Importing relevant libraries  &#xA;from __future__ import division  &#xA;from scipy.signal import fftconvolve   &#xA;import numpy as np &#xA;&#xA;def smooth_func(sig, x, t= 0.002):   &#xA;    '''&#xA;    x is an 1-D array, &#xA;    sig is the input signal and a function of x.&#xA;    '''&#xA;    N = len(x)   &#xA;    x1 = x[-1]   &#xA;    x0 = x[0]    &#xA;&#xA;&#xA;# defining a new array y which is symmetric around zero, to make the gaussian symmetric.  &#xA;    y = np.linspace(-(x1-x0)/2, (x1-x0)/2, N)   &#xA;    #gaussian centered around zero.  &#xA;    gaus = np.exp(-y**(2)/t)     &#xA;&#xA;#using fftconvolve to speed up the convolution; gaus.sum() is the normalization constant.  &#xA;    return fftconvolve(sig, gaus/gaus.sum(), mode='same')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If I run this code for say a step function, it smoothens the corner, but at the boundary it interprets another corner and smoothens that too, as a result giving unnecessary behaviour at the boundary. I explain this with a figure shown in the link below.&lt;br&gt;&#xA;&lt;a href=&quot;http://www.flickr.com/photos/78641431@N05/7042325231/in/photostream/&quot; rel=&quot;nofollow&quot;&gt;Boundary effects&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem does not arise if we directly integrate to find convolution. Hence the problem is not in Weierstrass transform, and hence the problem is in the fftconvolve function of scipy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand why this problem arises we first need to understand the working of fftconvolve in scipy.&lt;br&gt;&#xA;The fftconvolve function basically uses the convolution theorem to speed up the computation.&lt;br&gt;&#xA;In short it says:&lt;br&gt;&#xA;convolution(int1,int2)=ifft(fft(int1)*fft(int2))&lt;br&gt;&#xA;If we directly apply this theorem we dont get the desired result. To get the desired result we need to take the fft on a array double the size of max(int1,int2). But this leads to the undesired boundary effects. This is because in the fft code, if size(int) is greater than the size(over which to take fft) it zero pads the input and then takes the fft. This zero padding is exactly what is responsible for the undesired boundary effects.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Can you suggest a way to remove this boundary effects?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to remove it by a simple trick. After smoothening the function I am compairing the value of the smoothened signal with the original signal near the boundaries and if they dont match I replace the value of the smoothened func with the input signal at that point.&lt;br&gt;&#xA;It is as follows:  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;i = 0 &#xA;eps=1e-3&#xA;while abs(smooth[i]-sig[i])&amp;gt; eps: #compairing the signals on the left boundary&#xA;    smooth[i] = sig[i]&#xA;    i = i + 1&#xA;j = -1&#xA;&#xA;while abs(smooth[j]-sig[j])&amp;gt; eps: # compairing on the right boundary.&#xA;    smooth[j] = sig[j]&#xA;    j = j - 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There is a problem with this method, because of using an epsilon there are small jumps in the smoothened function, as shown below:&lt;br&gt;&#xA;&lt;a href=&quot;http://www.flickr.com/photos/78641431@N05/7042328861/in/photostream/&quot; rel=&quot;nofollow&quot;&gt;jumps in the smooth func&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Can there be any changes made in the above method to solve this boundary problem?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I tried removing the zero padding in the fft source code and replaced it with a constant value, but it gave undesired results.&lt;br&gt;&#xA;&lt;strong&gt;&lt;em&gt;Can you suggest a way of removing this zero padding in the scipy fft source code?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1179" LastEditorUserId="306" LastEditDate="2012-04-26T13:40:25.970" LastActivityDate="2013-04-17T19:09:29.610" Title="How to remove the boundary effects arising due to zero padding in scipy/numpy fft?" Tags="|convolution|smoothing|python|zero-padding|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1934" PostTypeId="2" ParentId="1932" CreationDate="2012-04-04T08:54:01.707" Score="52" Body="&lt;p&gt;Your image doesn't have uniform brightness,so you shouldn't work with a uniform threshold. You need an adaptive threshold. This can be implemented by preprocessing the image to make the brightness more uniform across the image (code written in Mathematica, you'll have to implement the Matlab version for yourself):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple way to make the brightness uniform is to remove the actual text from the image using a closing filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;white = Closing[src, DiskMatrix[5]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IhaP5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter size should be chosen larger than the font stroke width and smaller than the size of the stains you're trying to remove.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;I was asked in the comments to explain what a closing operation does. It's a &lt;a href=&quot;http://en.wikipedia.org/wiki/Dilation_%28morphology%29&quot;&gt;morphological dilation&lt;/a&gt; followed by a &lt;a href=&quot;http://en.wikipedia.org/wiki/Erosion_%28morphology%29&quot;&gt;morphological erosion&lt;/a&gt;. The dilation essentially moves the structuring element at every position in the image, and picks the brightest pixel under the mask, thus :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;removing dark structures smaller than the structuring element&lt;/li&gt;&#xA;&lt;li&gt;shrinking larger dark structures by the size of the structuring element&lt;/li&gt;&#xA;&lt;li&gt;enlarging bright structures&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The erosion operation does the opposite (it picks the darkest pixel under inside the structuring element), so if you apply it on the dilated image:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the dark structures that were removed because they're smaller than the structuring element are still gone&lt;/li&gt;&#xA;&lt;li&gt;the darker structures that were shrunk are enlarged again to their original size (though their shape will be smoother)&lt;/li&gt;&#xA;&lt;li&gt;the bright structures are reduced to their original size&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So the closing operation removes small dark objects with only minor changes to larger dark objects and bright objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example with different structuring element sizes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yk64h.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the size of the structuring element increases, more and more of the characters is removed. At radius=5, all of the characters are removed. If the radius is increased further, the smaller stains are removed, too:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6zwMN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you just divide the original image by this &quot;white image&quot; to get an image of (nearly) uniform brightness:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;whiteAdjusted = Image[ImageData[src]/ImageData[white]*0.85]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SDPUG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image can now be binarized with a constant threshold:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Binarize[whiteAdjusted , 0.6]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zPSxo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2012-04-04T20:24:03.970" LastActivityDate="2012-04-04T20:24:03.970" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="1935" PostTypeId="2" ParentId="1933" CreationDate="2012-04-04T10:15:30.290" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Can there be any changes made in the above method to solve this&#xA;  boundary problem?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes there can be, but it all depends what you want to occur at the boundary. If you don't want it to be smoothed then simply replace the edge with the original signal for a sensible number of samples, depending on the width of your gaussian. You gaussian might be &gt; 0 for say 10 samples, so replace the 5 samples at the start and end of the signal with the original samples.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can you suggest a way of removing this zero padding in the scipy fft&#xA;  source code?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. Pad it yourself. If you want to consider the wrap around, as if your signal is truly periodic, then fabricate the wraparound effect for a power of 2 in size by carefully padding your own signal. Just as a simple idea, multiply your window by 2 and find the nearest power of 2, then fill the middle of the copy with zeros to pad it out&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1234567890] [12345] - zero pad here - [67890]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when you apply the convolution, you should get the same effect for the first window's worth of the result as if the convolution kernel had wrapped around the original signal. To illustrate, take your gaussian and zero pad it at the end, and slide through the convolution to see for yourself that it yields the same thing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; original   left    padding    right&#xA;[1234567890 12345 000000000000 67890]&#xA;[xgaussianx 00000 000000000000 00000]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so the value for the right most sample comes from this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; original   left    padding    right&#xA;[1234567890 12345 000000000000 67890]&#xA;[sianx00000 00000 000000000000 xgaus]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is equivalent to what we actually want&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1234567890]&#xA;[xsianxgaus] (gaussian shifted by 5 samples and wrapped around)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the value for the left most sample comes from&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; original   left    padding    right&#xA;[1234567890 12345 000000000000 67890]&#xA;[00000xgaus sianx 000000000000 00000]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is also equivalent to what we actually want&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1234567890]&#xA;[sianxxgaus] (gaussian shifted by -5 samples and wrapped around)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All this relies on deciding what it is you actually want to happen. If you understand the mathematical process of convolution, and you understand exactly what it is you want to calculate, you can fabricate the conditions under power of 2 scenarios to ensure you get fast computation. Generally speaking most people just opt for the replace because their signal windows are not periodic and have sharp discontinuities at the edges.&lt;/p&gt;&#xA;" OwnerUserId="1152" LastEditorUserId="1152" LastEditDate="2012-04-04T18:56:42.503" LastActivityDate="2012-04-04T18:56:42.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1936" PostTypeId="2" ParentId="1671" CreationDate="2012-04-04T19:42:37.283" Score="2" Body="&lt;p&gt;It sounds like the OP is looking to align two signals. &#xA;One simple way of caluclating this is to do something similar to the cross Corr:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Mark the left or right channel as the Reference channel &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Take the Left channel (lets say you called the right channel the reference) and compute the mean squared error &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) shift the left channel a small time distance foward &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) go to step 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) when you've computed enough steps (say you took 1 second and split it into 1000 increments)  the smallest Mean Squared Error will be the &quot;phase&quot; difference between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Alternate method&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measure the phase difference between two signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) use the FFT algorithm of both channels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) calculate the Phase for each frequency bin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) for each frequency compute the Phase &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) take the mean absolute, or squared difference between the L and R channel phase components (i.e., for each frequency bin, take the difference between the phase between the L and R channels) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many more algorithms that will complete this for you look into Onset Detection Algorithms for beat synchronisation or look into Music Information Retrieval, this is one of many topics the area covers. &lt;/p&gt;&#xA;" OwnerUserId="1183" LastEditorUserId="1183" LastEditDate="2012-04-05T14:49:31.287" LastActivityDate="2012-04-05T14:49:31.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1937" PostTypeId="2" ParentId="741" CreationDate="2012-04-04T23:06:07.637" Score="12" Body="&lt;p&gt;In general zero-padding prior to DFT is equivalent to interpolation, or sampling more often, in the transformed domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a quick visualization of how the opposite works. If you sample a bandlimited signal in time at higher rate, you get a more 'squashed' spectrum, i.e. a spectrum with more zeros at both ends. In other words, you can obtain more samples in time by simply zero-padding in frequency after DFT'ing, and then IDFT'ing the zero-padded result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same effect holds in reverse when zero-padding occurs in time. This is all because the perfect signal reconstruction is possible as long as a signal is bandlimited and sampled at least at the Nyquist rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term 'resolution' depends on how you define it. For me, it means how well the two adjacent points of observation in time or frequency can be reliably (statistically) discriminated. In this case the resolution actually depends on the DFT size due to spectral leakage. That is, smaller the window size, more blurry or smeared the transformed signal, and vice versa. It is different from how often you sample, or what I term 'definition'. For example, you can have a very blurry image sampled at high rate (high definition), yet you still cannot obtain more information than sampling at lower rate. So in summary, zero-padding does not improve resolution at all since you do not gain any more information than before.&lt;/p&gt;&#xA;" OwnerUserId="1184" LastEditorUserId="23859" LastEditDate="2017-09-03T01:33:02.587" LastActivityDate="2017-09-03T01:33:02.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1939" PostTypeId="1" CreationDate="2012-04-05T11:41:20.137" Score="4" ViewCount="4288" Body="&lt;p&gt;I'm writing an algorithm that analyzes results of &lt;strong&gt;discrete Fourier transform (DFT)&lt;/strong&gt;. The algorithm should detect amplitude peaks in predefined ranges of frequencies. This is an example of such a peak:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qfhSh.png&quot; alt=&quot;Peak&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Vertical red lines are range boundaries (left and right) and range center (middle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are the best criteria for determining the absence of this peak in a specified range?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now I'm using standard deviation and comparing it to some calibration value. But it can be easily confused with some high amplitude noise like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cOn6c.png&quot; alt=&quot;Noise&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1180" LastEditorUserId="39" LastEditDate="2012-04-06T01:31:13.490" LastActivityDate="2012-04-11T22:06:20.447" Title="What's the best criterion for determining a frequency peak?" Tags="|fft|frequency|frequency-spectrum|dft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1940" PostTypeId="2" ParentId="1939" CreationDate="2012-04-05T12:36:59.490" Score="6" Body="&lt;p&gt;First convolve the FFT sequence in the given range by a fairly wide gaussian window. In case there is only one peak, this will just widen it. In case there are many peaks (as in the second example), this will merge them into a uniform and less spiky mass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can use one of the following peakedness metrics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Kurtosis.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;noreferrer&quot;&gt;Ratio of geometric to arithmetic mean&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-04-05T12:36:59.490" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1941" PostTypeId="1" AcceptedAnswerId="1945" CreationDate="2012-04-05T16:07:44.293" Score="3" ViewCount="1959" Body="&lt;p&gt;I'm trying to figure out how exactly an auto correlation corresponds to a time domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying to find pitch periods in an audio file and 99% of the time I'm getting it spot on.  Unfortunately however that 1% of the time is throwing me some annoying issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now at present I scan through my window for the highest peak (ie the highest abs( sample value )).  This seems to match up really nicely in most cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when I auto correlate I would expect the central peak to be this peak that I have identified (It will always have a positive number if i read it right).  Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, A peak that is n samples away from the central peak of the auto correlation will be n samples away from the peak I've identified in time domain, ok?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sooo, if this is correct then I'm having a strange problem.  I'm finding a peak in the auto correlation 91 samples from the center of my auto correlation.  Unfortunately when I look at the signal in the time domain (inside an audio editing app) then my central peak corresponds perfectly to a negative peak in the audio.  However, there are no peaks 91 samples away from that peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I look forward the next real peak is 142 samples away and the previous peak to it is 75 samples away.  I do notice a very tiny peak 91 samples or so in front of my peak but the sample never even goes negative.  So why does this end up showing up as by far the strongest peak in the auto correlation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help with this would be hugely appreciated!&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2012-04-06T21:56:18.877" Title="Auto correlation correspondence to original time domain window" Tags="|autocorrelation|peak-detection|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1942" PostTypeId="2" ParentId="1939" CreationDate="2012-04-05T16:27:32.997" Score="3" Body="&lt;p&gt;This answer assumes that the signal you are trying to detect is either not changing frequency with time or is changing slowly compared to your DFT window period (number of samples * sample period).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your problem is that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Signal-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;SNR&lt;/a&gt; in your second picture is terrible, which makes it impossible to know with any confidence what is noise and what is a legitimate signal peak.  You need to improve the SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to do that is by averaging multiple DFT's.  You are already doing the most difficult part of the process- sampling the data, DFT'ing it, and calculating the magnitude.  All you have to do is do that multiple times and average the results in each bin.  So, if you were doing DFT's that are 512 samples long and you did four DFT's, you would calculate the bins for the average DFT by averaging the bins of the four DFT's.  So for bin 0, you would average the bin 0 magnitude of all four DFT's, for bin 1 you would average all four bin 1's, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically it looks like this-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ X&amp;#39;[k] = \frac{1}{n} \sum_{i=1}^{n} X_i[k] $, for all k&#xA;where $X&amp;#39;[k]$ is the averaged DFT, and $n$ is the number of DFT's, and $k$ is the bin index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should get about 3 dB of SNR improvement each time you double the number of DFT's.  Thus, going from 1 to 2 DFT's gets you 3 dB, 2 to 4 gets you another 3, 4 to 8 gets you another 3 dB, etc.  Unfortunately, before long you run into diminishing returns.  Also, the number of DFT's you can average is constrained by how quickly the signal is changing frequency.  Once the &quot;length&quot; of the averaged DFT (sample period * number of samples per DFT * number of DFT's) gets to the point where the signal's peak is changing bins the signal will start to get smeared.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-04-06T13:08:17.443" LastActivityDate="2012-04-06T13:08:17.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1943" PostTypeId="2" ParentId="1941" CreationDate="2012-04-05T16:36:45.147" Score="8" Body="&lt;p&gt;Autocorrelation is not about finding the distance between individual peaks.  It is more about finding those lag distances that minimize the averaged squared delta between everything, all the peaks, all the valleys, all the flat spots, all in combination, and etc.  Because of this averaging over the entire window, the lag distance may not correspond to the distance between any single pair of point phenomena.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-04-05T16:36:45.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1945" PostTypeId="2" ParentId="1941" CreationDate="2012-04-05T22:25:06.093" Score="5" Body="&lt;p&gt;One useful way of thinking about how autocorrelation relates to the original time domain signal is to consider that autocorrelation is equivalent to the inverse FFT of the power spectrum of the original signal. In physical terms this can be thought of as breaking down the time domain signal into its constituent sinusoids, stripping any phase information from each of these (i.e. make each component a cosine wave) and then combine them again. In effect you've taken away all the phase information from the signal. So this is why you get a big peak at T = 0, since all the cosine components &quot;line up&quot; at this point. The other positive peaks in the autocorrelation occur where you get one or more cosine components with coincident positive peaks, e.g. at values of T which correspond to the periods of the fundamental and harmonics of a periodic signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this hand-waving non-mathematical description helps to make the concept of autocorrelation have a little more physical significance. (If not then feel free to ignore it!)&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2012-04-05T22:25:06.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1946" PostTypeId="2" ParentId="1894" CreationDate="2012-04-06T03:14:11.427" Score="5" Body="&lt;p&gt;The main issue with the example you gave is that the filter design function &lt;code&gt;cheby1&lt;/code&gt; is returning all &lt;code&gt;NaN&lt;/code&gt;s, which isn't going to be a very good filter. The problem is how you're specifying the passband/stopband edge frequencies. This particular function is meant to emulate MATLAB's &lt;code&gt;cheby1&lt;/code&gt; function; the frequencies that you give it should be normalized, such that a value of &lt;code&gt;1&lt;/code&gt; corresponds to half of the sample rate.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import scipy.signal as signal&#xA;fs = whatever_the_sample_rate_of_the_filter_input_is_going_to_be&#xA;signal.cheby1(8,0.05,[0.1/(fs/2),10.0/(fs/2)],btype='band',analog=0,output='ba')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't have SciPy handy, but that should at least correctly design the filter you want.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-06T03:14:11.427" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1947" PostTypeId="1" CreationDate="2012-04-06T09:23:48.270" Score="0" ViewCount="4943" Body="&lt;p&gt;I have images for 99 person for each person i have 5 images .&#xA;i have this function &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[similarity] = ssim(img1, img2, K, window, L);where K,window ,L are previously determined with their values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now , i need to use this function to measure intra-class similarities and inter-class similarities .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i mean i need to measure the similaity within and outside the class and put the results in 2 matrices , one contains the results of similarities within the same classes , and the other contains the results of similarities among the determined class and all other classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i wrote this in matlab :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%%%%for intraclass &#xA;&#xA;K = [0.05 0.05];&#xA;window = ones(8);&#xA;L = 100;&#xA;img1=imread('E:\matlab\images\0001hv1.bmp');&#xA;img2=imread('E:\matlab\images\0001hv2.bmp');&#xA;img3=imread('E:\matlab\images\0001hv3.bmp');&#xA;img4=imread('E:\matlab\images\0001hv4.bmp');&#xA;img5=imread('E:\matlab\images\0001hv5.bmp');&#xA;[s1] = ssim(img1, img2, K, window, L);&#xA;[s2] = ssim(img1, img3, K, window, L);&#xA;[s2] = ssim(img1, img4, K, window, L);&#xA;[s3] = ssim(img1, img4, K, window, L);&#xA;[s4] = ssim(img1, img5, K, window, L);&#xA;intra_class=[s1 s2 s3 s4];&#xA;histintra_class=hist(intra_class);&#xA;plot(histintra_class);title('intra_class');&#xA;&#xA;&#xA;&#xA;%%%%for interclass &#xA;&#xA;&#xA;K = [0.05 0.05];&#xA;window = ones(8);&#xA;L = 100;&#xA;img1=imread('E:\matlab\images\0001hv1.bmp');&#xA;img2=imread('E:\matlab\images\0002hv1.bmp');&#xA;img3=imread('E:\matlab\images\0003hv1.bmp');&#xA;img4=imread('E:\matlab\images\0004hv1.bmp');&#xA;img5=imread('E:\matlab\images\0005hv1.bmp');&#xA;[s1] = ssim(img1, img2, K, window, L);&#xA;[s2] = ssim(img1, img3, K, window, L);&#xA;[s3] = ssim(img1, img4, K, window, L);&#xA;[s4] = ssim(img1, img5, K, window, L);&#xA;inter_class=[s1 s2 s3 s4];&#xA;histinter_class=hist(inter_class);&#xA;plot(histinter_class);title)'interclass');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;now how can i implement this on all my images automatically , i mean how can i read all images and finding intra and inter class similarities and get automatically the 2 matrices which are inter class and intra class&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards&lt;/p&gt;&#xA;" OwnerUserId="920" LastEditorUserId="920" LastEditDate="2012-04-06T14:40:14.020" LastActivityDate="2016-10-12T15:19:08.500" Title="calculating similarity scores between similar and different classes?" Tags="|image-processing|matlab|computer-vision|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1948" PostTypeId="2" ParentId="1941" CreationDate="2012-04-06T11:24:04.197" Score="2" Body="&lt;p&gt;Large off-center peaks in an audio auto-correlation are typically caused by&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Acoustic Reflections or echos&lt;/li&gt;&#xA;&lt;li&gt;Strong harmonic components in the signal&lt;/li&gt;&#xA;&lt;li&gt;Any combination thereof&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can think about the auto-correlation as follows: Make a copy of the original signal, shift it in time and then measure how similar the time shifted and the original signals are. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's do this with a sine wave: Every time the time lag is an integer multiple of the sine period the two signals line up perfectly and the auto-correlation has a maximum. If the time lag is half of a period, the two signals line up perfectly but out of phase. In this case the auto-correlation negative and has a negative peak. For a perfect sine wave, the auto-correlation is a sine wave as well. For a more complex tone with fundamentals and harmonics the auto-correlation tends to have multiple peaks which are evenly spaced. During speech this wall happen mostly during vowels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the case where the speech is recorded with a microphone and the microphone is sitting on a little stand on the desk (which any good recording engineer would avoid like the plague). The mic picks up the voice directly, but the voice also bounces of the desk and gets to the microphone a little later. If you do an auto-correlation of that you will see a strong peak as soon as time lag lines up the reflection lines with the original speech. So reflections create a single off-center auto-correlation peak. The time position of that corresponds to the difference in travel paths of the original sound and the reflection. If the reflection path is, for example, 70cm longer you would see the auto-correlation peak at 2ms or 91 samples @44.1kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things get a lot more complicated if you have multiple reflections and multiple harmonics in the same signal.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-06T11:24:04.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1949" PostTypeId="1" AcceptedAnswerId="2025" CreationDate="2012-04-06T17:47:31.607" Score="15" ViewCount="15034" Body="&lt;p&gt;I have recorded 2 signals from an oscope. They look like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/36DPS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to measure the time delay between them in Matlab. &#xA;Each signal has 2000 samples with a sampling frequency of 2001000.5.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data is in a csv file. This is what I have so far.&lt;br&gt;&#xA;I erased the time data out of the csv file so that only the voltage levels are in the csv file.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x1 = csvread('C://scope1.csv');&#xA;x2 = csvread('C://scope2.csv');  &#xA;cc = xcorr(x1,x2);&#xA;plot(cc);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives this result:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/HXLD3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I've read I need to take the cross correlation of these signals and this should give me a peak relating to the time delay. However when I take the cross correlation of these signals I get a peak at 2000 which I know is not correct. What should I do to these signals before I cross correlate them? Just looking for some direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: after removing the DC offset this is the result I am now getting:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/3x3ae.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to clean this up to get a more defined time delay?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: Here are the files:&lt;br&gt;&#xA;&lt;a href=&quot;http://dl.dropbox.com/u/10147354/scope1col.csv&quot; rel=&quot;noreferrer&quot;&gt;http://dl.dropbox.com/u/10147354/scope1col.csv&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://dl.dropbox.com/u/10147354/scope2col.csv&quot; rel=&quot;noreferrer&quot;&gt;http://dl.dropbox.com/u/10147354/scope2col.csv&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1190" LastEditorUserId="1190" LastEditDate="2012-04-06T20:38:48.667" LastActivityDate="2016-02-04T15:47:04.203" Title="Time delay estimation of oscilloscope signals using cross correlation" Tags="|matlab|cross-correlation|" AnswerCount="5" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1950" PostTypeId="1" AcceptedAnswerId="1953" CreationDate="2011-11-10T10:54:59.967" Score="5" ViewCount="176" Body="&lt;p&gt;For illustrating the effects of shot noise (more precisely, emitter failure in fluorescence imaging) I am looking for a good example image. The image should ideally be easily misinterpreted, especially by non-aided human analysts, when a fair amount of shot noise is applied to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of such an image?&lt;/p&gt;&#xA;" OwnerUserId="3792" OwnerDisplayName="thiton" LastActivityDate="2012-05-06T18:15:15.427" Title="Example image that is degraded by shot noise and easily misinterpreted?" Tags="|image-processing|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1951" PostTypeId="2" ParentId="1950" CreationDate="2012-03-06T16:57:13.520" Score="1" Body="&lt;p&gt;You can expect small-size type printed in color with low intensity contrast (say, orange letters on blue background of similar brightness) to become illegible with a lot of shot noise. Something like &lt;a href=&quot;http://img.ctrlv.in/4f5641aede8eb.jpg&quot; rel=&quot;nofollow&quot;&gt;http://img.ctrlv.in/4f5641aede8eb.jpg&lt;/a&gt; but with much more noise.&lt;/p&gt;&#xA;" OwnerUserId="786" OwnerDisplayName="AVB" LastActivityDate="2012-03-06T16:57:13.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1952" PostTypeId="2" ParentId="1950" CreationDate="2012-03-07T06:44:51.953" Score="1" Body="&lt;p&gt;Many &lt;a href=&quot;http://en.wikipedia.org/wiki/CAPTCHA&quot; rel=&quot;nofollow&quot;&gt;captcha&lt;/a&gt;s,&#xA;especially those mixing text and lines,&#xA;are difficult to read and would become worse&#xA;with added noise.&lt;/p&gt;&#xA;" OwnerDisplayName="Vincent Zoonekynd" LastActivityDate="2012-03-07T06:44:51.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1953" PostTypeId="2" ParentId="1950" CreationDate="2012-04-06T07:12:48.543" Score="2" Body="&lt;p&gt;Would something like Figure 4 in this paper by Dumitriu, Rodriguez, and Morrison (2011) work? They imaged the spines on a neuron using six different gain settings, which produce different amounts of shot noise. One can see how the putative shape of the spine changes based on the amount of noise present. This example might be a little esoteric for a general audience, but it does sound like you're doing some kind of microscopy, so perhaps it's a good fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dumitriu, D, Rodriguez A, and Morrison JH. High-throughput, detailed, cell-specific neuroanatomy of dendritic spines using microinjection and confocal microscopy. Nat Protoc. 2011 Aug 25;6(9):1391-411. doi: 10.1038/nprot.2011.389.&#xA;&lt;a href=&quot;http://www.nature.com/nprot/journal/v6/n9/full/nprot.2011.389.html&quot; rel=&quot;nofollow&quot;&gt;Article at Nature Protocols&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="Matt Krause" LastActivityDate="2012-04-06T07:12:48.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1954" PostTypeId="1" AcceptedAnswerId="1961" CreationDate="2012-04-06T18:39:21.870" Score="7" ViewCount="2227" Body="&lt;p&gt;Let's say that my receiver will be receiving known data signals that range from the very simple (tone) to the complex (known data sequence that is modulated (PSK/QAM/OFDM/etc.)).  What are the most computationally efficient ways to get a reasonably accurate estimate of the frequency offset?&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2020-09-30T23:39:46.503" Title="Efficient frequency offset estimation of known signals" Tags="|frequency|signal-detection|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1955" PostTypeId="2" ParentId="1949" CreationDate="2012-04-06T19:07:51.890" Score="4" Body="&lt;p&gt;As pichenettes indicated, in this case a peak at the middle of the output indicates 0 lag.  The peak's offset from the middle point is your time lag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: It concerns me that the correlation is so nearly a perfect triangle.  That indicates to me that the cross-correlation is doing no power normalization.  That gives an unfair bias to smaller lags over larger lags.  I would modify your xcorr call to &quot;cc = xcorr(x1,x2,'unbiased');&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is not, mind you, a perfect solution because the large-lag results are now more unstable than the low-lag results because they are based on less data.  A large peak at the extremities can be bogus for the same reason that you can get 100% heads and no tails on just a few coin tosses, while it is extremely unlikely to happen on many tosses.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-04-06T19:18:30.707" LastActivityDate="2012-04-06T19:18:30.707" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1956" PostTypeId="2" ParentId="1941" CreationDate="2012-04-06T21:56:18.877" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Now when I auto correlate I would expect the central peak to be this&#xA;  peak that I have identified (It will always have a positive number if&#xA;  i read it right). Is this correct?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No this is not correct. An autocorrelation is an averaging across an entire window's worth of data. Just look at the definition of correlation, you see that a point n in the correlation function is the &lt;strong&gt;average sample value of the signal when multiplied with itself at circular shift n&lt;/strong&gt;. So the largest peak is going to affect this the correlation, but it is averaged away across the entire signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why might a peak in the signal correspond with a peak in the correlation? Let's consider a signal where every even sample is 1 and every odd sample is 0. Then you would say that the first largest peak is at 0, and second at 2. We also notice peaks in our autocorrelation function at these indices. The point is that the reason you are seeing a peak in these positions is because &lt;strong&gt;these very strong peaks are a periodic feature of the signal&lt;/strong&gt;. It's not because there is 1 sharp peak at that index, but because many sharp peaks correlate for that value of circular shift. This is likely to be the case for very pure signals, but not the case when involving less simplistic signals with multiple harmonics. Your analysis breaks down very quickly.&lt;/p&gt;&#xA;" OwnerUserId="1152" LastActivityDate="2012-04-06T21:56:18.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1957" PostTypeId="2" ParentId="1949" CreationDate="2012-04-07T13:14:57.247" Score="6" Body="&lt;p&gt;There are a few problems doing this with autocorrelation&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Huge DC offset (fixed already)&lt;/li&gt;&#xA;&lt;li&gt;Time window: Matlab's xcorr() has the annoying convention to essentially &quot;zero pad&quot; the signal at both ends as you slide the time lag. I.e. the data window is a function of time lag. This will create a triangular shape for any stationary signal (including sine waves). Better choices are to choose a correlation window so that window size plus max time lag fit into your total data window, or to normalize the cross correlation by the number of non-padded samples.&lt;/li&gt;&#xA;&lt;li&gt;The two signals do not look particularly correlated to me. The shape is somewhat similar but the specific spacing of peaks and dips is quite different, so I doubt that even a proper auto-correlation would yield a lot of insight here.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A much simpler approach would be to use a threshold detector to find the starting points and simply use the difference between these points as the delay.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-07T13:14:57.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1958" PostTypeId="1" AcceptedAnswerId="2006" CreationDate="2012-04-07T13:33:24.370" Score="19" ViewCount="17540" Body="&lt;p&gt;I'm trying to get a Hough transform to work in MATLAB, but I'm having problems. I have a really bad way of detecting peaks that needs to be fixed, but before that I need to be able to reverse the hough transform to create the lines again properly. This is the type of stuff I'm getting right now:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/00UWN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;looks like its rotated by 90 degrees, but I'm not sure why. I'm not sure if it's my Hough space that's wrong, or if it's the way I de-Hough and draw the lines. Also could someone help improve my peak detection? The images used in the code are &lt;a href=&quot;https://i.stack.imgur.com/iaBqJ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% load a sample image; convert to grayscale; convert to binary&#xA;&#xA;%create 'x' image (works well)&#xA;a = eye(255);&#xA;b = flipud(eye(255));&#xA;x = a + b;&#xA;x(128,128) = 1;&#xA;&#xA;%image = rgb2gray(imread('up.png')) &amp;lt; 255;&#xA;%image = rgb2gray(imread('hexagon.png')) &amp;lt; 255;&#xA;%image = rgb2gray(imread('traingle.png')) &amp;lt; 255;&#xA;%%% these work&#xA;%image = x;&#xA;%image = a;&#xA;image = b;    &#xA;&#xA;%% set up variables for hough transform&#xA;theta_sample_frequency = 0.01;                                             &#xA;[x, y] = size(image);&#xA;rho_limit = norm([x y]);                                                &#xA;rho = (-rho_limit:1:rho_limit);&#xA;theta = (0:theta_sample_frequency:pi);&#xA;num_thetas = numel(theta);&#xA;num_rhos = numel(rho);&#xA;hough_space = zeros(num_rhos, num_thetas);&#xA;&#xA;%% perform hough transform&#xA;for xi = 1:x&#xA;    for yj = 1:y&#xA;        if image(xi, yj) == 1 &#xA;            for theta_index = 1:num_thetas&#xA;                th = theta(theta_index);&#xA;                r  = xi * cos(th) + yj * sin(th);&#xA;                rho_index = round(r + num_rhos/2);                      &#xA;                hough_space(rho_index, theta_index) = ...&#xA;                     hough_space(rho_index, theta_index) + 1;&#xA;            end&#xA;        end&#xA;    end&#xA;end  &#xA;&#xA;%% show hough transform&#xA;subplot(1,2,1);&#xA;imagesc(theta, rho, hough_space);&#xA;title('Hough Transform');&#xA;xlabel('Theta (radians)');&#xA;ylabel('Rho (pixels)');&#xA;colormap('gray');&#xA;&#xA;%% detect peaks in hough transform&#xA;r = [];&#xA;c = [];&#xA;[max_in_col, row_number] = max(hough_space);&#xA;[rows, cols] = size(image);&#xA;difference = 25;&#xA;thresh = max(max(hough_space)) - difference;&#xA;for i = 1:size(max_in_col, 2)&#xA;   if max_in_col(i) &amp;gt; thresh&#xA;       c(end + 1) = i;&#xA;       r(end + 1) = row_number(i);&#xA;   end&#xA;end&#xA;&#xA;%% plot all the detected peaks on hough transform image&#xA;hold on;&#xA;plot(theta(c), rho(r),'rx');&#xA;hold off;&#xA;&#xA;&#xA;%% plot the detected line superimposed on the original image&#xA;subplot(1,2,2)&#xA;imagesc(image);&#xA;colormap(gray);&#xA;hold on;&#xA;&#xA;for i = 1:size(c,2)&#xA;    th = theta(c(i));&#xA;    rh = rho(r(i));&#xA;    m = -(cos(th)/sin(th));&#xA;    b = rh/sin(th);&#xA;    x = 1:cols;&#xA;    plot(x, m*x+b);&#xA;    hold on;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Linked:&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1883/how-to-do-de-houghing-of-a-hough-transformed-image&quot;&gt;How to do De-Houghing of a Hough transform&amp;#39;ed Image?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1156" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-05-30T10:15:55.213" Title="Help understanding Hough transform" Tags="|matlab|hough-transform|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1959" PostTypeId="1" CreationDate="2012-04-07T13:42:30.800" Score="8" ViewCount="2268" Body="&lt;p&gt;I've been playing around with making images better and removing all the unwanted disturbances from it. I found out a major concern would be removing the unwanted reflections that might come. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've gone through a &lt;a href=&quot;http://dspace.mit.edu/bitstream/handle/1721.1/6675/AIM-1647.pdf?sequence=2&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; that uses &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;ICA&lt;/a&gt; to get rid of these reflections. What other methods would work? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have an image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3YlLB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DLAKk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Converted it into CMYK&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RNDr4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should i remove this semi black portion?&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="32990" LastEditDate="2019-05-19T16:29:25.290" LastActivityDate="2019-05-19T16:29:25.290" Title="How to remove reflections from images?" Tags="|matlab|computer-vision|ica|image-processing|" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="1960" PostTypeId="1" CreationDate="2012-04-07T14:29:04.960" Score="8" ViewCount="1218" Body="&lt;p&gt;Given only observations of a binary signal perturbed by Gaussian noise with unknown prior information, how can I estimate the optimal decision threshold?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;( No, this is not a homework question)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I am think about the following model: $Y$ is a two-state $(H_0,H_1)$ Random variable :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$P(Y|H_0) \sim \mathcal N(\mu_0,\sigma)$&lt;/li&gt;&#xA;&lt;li&gt;$P(Y|H_1) \sim \mathcal N(\mu_1,\sigma),\quad \mu_0 &amp;lt; \mu_1$&lt;/li&gt;&#xA;&lt;li&gt;$P(H_0) = \pi_0$&lt;/li&gt;&#xA;&lt;li&gt;$P(H_1) = 1-\pi_0$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;with &lt;em&gt;unknown&lt;/em&gt; parameters: $\mu_0, \mu_1, \sigma, \pi_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Maximum a Posteriori Log-likelihood threshold could be computed from those parameters if I knew them. I was originally thinking about how to estimate the parameters first in order to get to the threshold $Y_t$. But I'm thinking it may be more robust to directly estimate $Y_t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thoughts:&#xA;Normalizing the observations (subtracting the sample mean and dividing by standard deviation) reduces the parameter space into 2 dimensions: $\pi_0$ and $\frac \sigma{\mu_1-\mu_0}$.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="128" LastEditDate="2017-09-27T10:31:02.100" LastActivityDate="2017-09-27T10:31:02.100" Title="Determining optimal binary decision rule threshold from observations with unknown priors?" Tags="|signal-detection|estimation|thresholding|maximum-a-posteriori-estimation|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1961" PostTypeId="2" ParentId="1954" CreationDate="2012-04-07T14:41:23.587" Score="8" Body="&lt;h2&gt;Time aligned&lt;/h2&gt;&#xA;&lt;p&gt;If the signals are time aligned, you can conjugate-multiply the received signal with the reference signal and look for the dominant frequency.&lt;/p&gt;&#xA;&lt;h1&gt;Max-Likelihood estimation of the frequency shift and complex gain of a known signal in Gaussian Noise&lt;/h1&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\vec r$&lt;/span&gt; be the noisy observation of a frequency translated version of a sent &lt;span class=&quot;math-container&quot;&gt;$\vec x$&lt;/span&gt; with unknown gain.&#xA;Here, let us consider the channel &lt;span class=&quot;math-container&quot;&gt;$\mathbf A \in \Gamma$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vec r = \mathbf A \vec x + \vec w  \in \mathbf C^N \\&#xA;[\mathbf A]_{nn} = \rho \exp(\omega n) , \rho \in \mathbf C^N , \omega \in \mathbf R \\&#xA;[\mathbf A]_{mn} = 0, \forall m \ne n  \\&#xA;p(\vec w|\tau) \propto \exp\left( \frac {-\| \vec w \|^2} {\tau}  \right) &#xA;\\&#xA;\mathbf A^* \triangleq &#xA;\operatorname*{argmax}_{\mathbf A}&#xA;\max_{\tau}&#xA;\underbrace{p(\vec r| \mathbf A,\vec x ,\tau)}_{  \propto \exp \left( \frac {-\| \mathbf A \vec x - \vec r \|^2} {\tau}  \right) }&#xA;\\&#xA;\mathbf A^* =&#xA;\operatorname*{argmax}_{\mathbf A}&#xA;\underbrace{&#xA;-\| \mathbf A \vec x - \vec r \|^2&#xA;}_{&#xA;\triangleq f(\mathbf A)&#xA;}&#xA;\\&#xA;f(\mathbf A)&#xA;=&#xA;- (\mathbf A \vec x - \vec r )^H&#xA;(\mathbf A \vec x - \vec r )&#xA;\\&#xA;= - \vec x^H &#xA;\underbrace {\mathbf A^H\mathbf A }_{|\rho|^2 \mathbf I&#xA;}&#xA;\vec x&#xA;+ 2\mathop{re}&#xA;(\mathbf A \vec x)^H \vec r &#xA;-&#xA;\underbrace&#xA;{\vec r^H \vec r}_{&#xA;\|\vec r\|^2}&#xA;$$&lt;/span&gt;&#xA;Notice the first and third terms have no dependence on frequency &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; nor the phase of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.  So we simply need to find the frequency that best aligns &lt;span class=&quot;math-container&quot;&gt;$\vec x,\vec r$&lt;/span&gt;.  That will imply the phase.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\omega^* = \operatorname*{argmax} \sum_n |\exp(-j\omega n) \bar {x_n} r_n|^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;One can use an FFT or some such frequency estimator to recover the dominant frequency&lt;/p&gt;&#xA;&lt;h2&gt;Not Time-Aligned&lt;/h2&gt;&#xA;&lt;p&gt;If the signals are not time-aligned, then you've got a time &lt;em&gt;and&lt;/em&gt; frequency search problem on your hand.  With low SNR, this is essentially the problem solved by the cross-ambiguity function (CAF).  If you've got several dB of margin you can take a shortcut.&lt;/p&gt;&#xA;&lt;p&gt;If you have a reference signal with some AM variation; you can time-align first by AM detecting both signals and then correlating your input by the reference AM.  If your  reference signal doesn't have much amplitude variation, but its spectrum is &amp;quot;spikey&amp;quot; you might be able to correlate the magnitude spectra of the received and reference.  This is the same trick applied in the frequency domain, rather than time domain.&lt;/p&gt;&#xA;&lt;p&gt;With the exception of the CAF, these are all fairly cheap operations.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2020-09-30T23:39:46.503" LastActivityDate="2020-09-30T23:39:46.503" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="1963" PostTypeId="2" ParentId="1960" CreationDate="2012-04-07T17:41:17.613" Score="6" Body="&lt;p&gt;My intuition is that it would be difficult to derive the right decision threshold you expect to find:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau = \frac{1}{2}\left(\mu_0 + \mu_1\right) - \frac{\sigma^2}{\lVert\mu_0 - \mu_1\rVert^2} \log \frac{\pi}{1 - \pi}\left(\mu_0 - \mu_1\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the global statistics you are considering (sample mean: $\pi \mu_0 + (1 - \pi) \mu_1$ ; standard deviation: more complex expression but I doubt it would involve a log).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would approach the problem this way:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;If the assumption that $\sigma$ is small can be made&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm mentioning that, because keep in mind that the decision threshold is affected by $\pi$ only if $\sigma$ is sufficiently high to allow both classes to overlap. If the $\mu$s are distant by more than a few $\sigma$, class prior probabilities have nothing to say in the decision process!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Run k-means on your observations ($\sigma$ is small and is shared by both classes, so k-means &lt;em&gt;is&lt;/em&gt; in this case EM for the mixture model). If you just want to binarize these observations and no other data, you can stop here.&lt;/li&gt;&#xA;&lt;li&gt;If you have new observations to binarize, and you know they are generated by the same process, you can use the class centroids found by k-means on your training data as estimates of $\mu$, and use the middle as a decision threshold. &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;If no assumption about $\sigma$ can be made&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Run the EM algorithm (with pooled, diagonal covariance) on your training data. Use the inferred &quot;soft class membership&quot; variables to binarize your observations.&lt;/li&gt;&#xA;&lt;li&gt;Compute the decision threshold $\tau$ from the parameters given by EM to binarize new data generated by the same process.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="943" LastEditorUserId="1629" LastEditDate="2016-09-11T08:31:23.363" LastActivityDate="2016-09-11T08:31:23.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1965" PostTypeId="2" ParentId="1959" CreationDate="2012-04-07T19:17:19.147" Score="6" Body="&lt;p&gt;I am not a specialist in image processing but I highly doubt this is feasible with your requirements (single image, no prior information). The challenges is twofold:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Detect which area of the image is a reflection. This looks like a quite complex scene understanding problem. In your example, I know that the right side is a reflection because I can infer from the image that a person is depicted here, and I have prior knowledge about what the back of a person looks like.&lt;/li&gt;&#xA;&lt;li&gt;Reconstruct the background in the identified region. While it would be possible to just inpaint the area detected as a reflection with textures from the surrounding, the result would hide many details! Whatever I've seen in the field of &lt;em&gt;single input&lt;/em&gt; image separation was relying on very simple image models (stationary textures), not real world images. The more traditional image separation setups (multiple channels, recto/verso of translucent pages, multiple polarization) do not apply to your case.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-04-07T19:17:19.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1966" PostTypeId="1" AcceptedAnswerId="1970" CreationDate="2012-04-07T19:54:12.423" Score="5" ViewCount="3806" Body="&lt;p&gt;This is a follow-up question of &lt;a href=&quot;https://dsp.stackexchange.com/questions/1894/how-do-i-apply-a-chebishev-filter&quot;&gt;How do I apply a Chebishev filter?&lt;/a&gt; I designed a filter in Scipy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import scipy.signal as signal&#xA;fs = 240&#xA;signal.cheby1(8, 0.05, [0.1/(fs/2), 10.0/(fs/2)],btype='band', analog=0, output='ba')&#xA;/usr/lib/python2.7/dist-packages/scipy/signal/filter_design.py:268: BadCoefficients: Badly conditioned filter coefficients (numerator): the results may be meaningless&#xA;  &quot;results may be meaningless&quot;, BadCoefficients)&#xA;(array([ -3.64482771e-08,  -3.98755170e-23,   1.27568970e-07,&#xA;     3.98755170e-23,  -2.55137939e-07,  -2.09346464e-22,&#xA;     3.18922424e-07,   1.48536301e-21,  -2.55137939e-07,&#xA;    -2.79128619e-22,   1.27568970e-07,  -3.98755170e-23,&#xA;    -3.64482771e-08,   0.00000000e+00,   4.55603463e-09]),&#xA;array([  1.00000000e+00,  -1.53699059e+01,   1.10865293e+02,&#xA;    -4.98175837e+02,   1.56087517e+03,  -3.61582779e+03,&#xA;     6.40630344e+03,  -8.85525782e+03,   9.65121227e+03,&#xA;    -8.32140081e+03,   5.65721533e+03,  -3.00062986e+03,&#xA;     1.21729735e+03,  -3.65135628e+02,   7.63720484e+01,&#xA;    -9.95191544e+00,   6.08648759e-01]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first array should contain the b coefficients, the second array should contain the b coefficients of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of this filter is oscillating and seems to be wrong. &lt;a href=&quot;https://dsp.stackexchange.com/users/224/hilmar&quot;&gt;Hilmar&lt;/a&gt; wrote that this filter &quot;is a numerically challenging filter, since you have poles very very close to the unit circle&quot; and I must &quot;break the filter down into second order sections and apply those sequentially&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I have no background in signal processing and found nothing about that anywhere I wanted to ask here how I can do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit:&lt;/strong&gt; The zero-pole-gain ('zpk') representation is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal.cheby1(8, 0.05, [0.1/(fs/2), 10.0/(fs/2)],btype='band', analog=0, output='zpk')&#xA;/usr/lib/python2.7/dist-packages/scipy/signal/filter_design.py:268: BadCoefficients: Badly conditioned filter coefficients (numerator): the results may be meaningless&#xA;&quot;results may be meaningless&quot;, BadCoefficients)&#xA;(array([ 0.95041122+0.63504447j,  0.95041122-0.63504447j,&#xA;    0.77688699+0.32179713j,  0.77688699-0.32179713j,&#xA;    0.72152481+0.14352021j,  0.72152481-0.14352021j,&#xA;    0.70710678+0.j        , -0.95041122+0.63504447j,&#xA;   -0.95041122-0.63504447j, -0.77688699+0.32179713j,&#xA;   -0.77688699-0.32179713j, -0.72152481+0.14352021j,&#xA;   -0.72152481-0.14352021j, -0.70710678+0.j        ]), array([ 1.19049737+0.j        ,  1.16303520+0.1084667j ,&#xA;    1.16303520-0.1084667j ,  1.08874047+0.19530989j,&#xA;    1.08874047-0.19530989j,  0.99220878+0.25677213j,&#xA;    0.99220878-0.25677213j,  0.93226615+0.2765259j ,&#xA;    0.93226615-0.2765259j ,  0.87852354+0.22994371j,&#xA;    0.87852354-0.22994371j,  0.83333317+0.15993377j,&#xA;    0.83333317-0.15993377j,  0.80434290+0.08130729j,&#xA;    0.80434290-0.08130729j,  0.79450811+0.j        ]), -3.6448277062436296e-08)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1165" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-04-11T21:43:51.380" Title="How can I break a filter down into second order sections?" Tags="|filters|software-implementation|bandpass|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1967" PostTypeId="2" ParentId="1949" CreationDate="2012-04-08T02:47:51.323" Score="4" Body="&lt;p&gt;As the others have pointed out, and it seems you have realized based on your last edit to the question, it doesn't appear that cross-correlation is going to give you a good estimate of time delay for the datasets shown. Correlation measures similarity in shape between two time series by sliding one across the other for a range of time lags and computing an inner product between the two series at each lag. The result will have a large magnitude when the two series are qualitatively similar, or they are &quot;correlated&quot; with one another. This is similar to how an inner product of two vectors is largest when the two vectors are pointed in the same direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with the data you showed is that (at least for the snippets we can see) there does not seem to be much similarity in shape. There is no delay that you can apply to one of the signals to make it look like the other, which is exactly what you're doing by calculating their cross-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are instances where cross-correlation is useful, however. Say that your second signal was really a time-shifted version of the original, even with some additional noise added:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = csvread('scope1col.csv');&#xA;a = a - mean(a);               % to remove DC offset&#xA;b = a(200:end) + sqrt(0.05)*randn(1801,1);&#xA;figure; subplot(211); plot(a); subplot(212); plot(b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C5zk0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's now not immediately clear that the two signals are related by a time delay. However, if we take the cross-correlation, we get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[c,lags] = xcorr(a,b);&#xA;igure; plot(lags,c); grid on; xlabel('Lag'); ylabel('Cross-correlation');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U3dxd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which shows a peak at the correct lag of 200 samples. Correlation can be a useful tool for determining time delay, when applied to datasets that contain the right type of similarity.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-08T02:47:51.323" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1968" PostTypeId="2" ParentId="1496" CreationDate="2012-04-08T04:42:52.693" Score="0" Body="&lt;p&gt;What I think JPG format file is one of the richest image file. When you change pixel values in PNG format file, the value is exactly being changed for that pixel, but the thing is when you try doing samething with jpg file it does not do so. You would better know by performing a simple experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make an image of $150*100$ in &lt;strong&gt;MSpaint&lt;/strong&gt;.&#xA;Put red color on first 50 rows, green on next 50 rows and blue from 100th to 150th row and make the last 50 rows half white and half black in color. like (1,150) to (50,175) white color, and (51,175) to (100,200) black color. then save this file in jpg format. and then open the saved image. You would notice something very interestng at the borders of the colors. You would get your answer.&lt;/p&gt;&#xA;" OwnerUserId="1194" LastEditorUserId="1473" LastEditDate="2012-06-29T10:56:14.520" LastActivityDate="2012-06-29T10:56:14.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1969" PostTypeId="2" ParentId="1924" CreationDate="2012-04-08T06:57:33.790" Score="7" Body="&lt;p&gt;Well i think you need to compare the effectiveness of various methods of noise removal that you would be using to get back the original image :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest to take the following parameters for measure&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Mean Square Error (MSE)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Peak Signal to Noise Ratio (PSNR in dB)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Structural Content (SC)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;and many others &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oysIF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the MATLAB codes out &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/25005-image-quality-measures&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="654" LastActivityDate="2012-04-08T06:57:33.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1970" PostTypeId="2" ParentId="1966" CreationDate="2012-04-08T12:50:35.907" Score="7" Body="&lt;p&gt;Below the results as sos matrix and gain. Every row in the matrix is a single second order section in the coefficient order of b0, b1, b2, a0, a1, a2. Obviously we need a0=1, and the sections are normalized so that b0=1 as well. The overall gain accumulated is in the single number &quot;gain&quot;. The fact that this gain is actually in the order of 10^-9 shows that this is a numerically tricky beast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how this works.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Design the filter in poles and zeros (zp or zpk), NOT in polynomial form (ba). I imagine that the cheby1() function has an output option for that. If not, you can't use it.&lt;/li&gt;&#xA;&lt;li&gt;The poles come in conjugate complex pairs, the zeros in this case are real, but you can think of them as a conjugate complex pair with a phase of 0.&lt;/li&gt;&#xA;&lt;li&gt;Group one pole pair each with one zero pair. Start with the pole pair that has the highest magnitude and find that zero pair that's closest to it. &lt;strong&gt;This step is really important!!&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Turn the poles and zeros into polynomial in 1/z of the shape (1-p/z)*(1-p'/z). Let's say the complex zero/pole is x+j*y. Then b0/a0 coefficients are always 1, the b1/a1 coefficients are -2*x and the b2/a2 coefficients are x^2+y^2.&lt;/li&gt;&#xA;&lt;li&gt;Repeat over all poles. Each conjugate pole pair results in one second order section.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A word of caution, if I may: If none of things that I have listed above mean anything to you, than you probably should not be doing this. This is not trivial and many things can go wrong in non-obvious ways. Depending on what you are planning to do with the results, you really want to make sure that your code is fully vetted and properly tested. Unless you have a good idea on how to test this, I would not base anything mission critical on the results.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;    sos =&#xA;   1.000000000000000   2.000000000000000   1.000000000000000   1.000000000000000  -1.824520683146258   0.835012167790563&#xA;   1.000000000000000   2.000000000000000   1.000000000000000   1.000000000000000  -1.825351261746257   0.854128332434601&#xA;   1.000000000000000   2.000000000000000   1.000000000000000   1.000000000000000  -1.845749373866514   0.899792317177862&#xA;   1.000000000000000   2.000000000000000   1.000000000000000   1.000000000000000  -1.890243419701735   0.963689345198141&#xA;   1.000000000000000  -2.000000000000000   1.000000000000000   1.000000000000000  -1.989176997083584   0.989218209927750&#xA;   1.000000000000000  -2.000000000000000   1.000000000000000   1.000000000000000  -1.996496707908275   0.996511870590091&#xA;   1.000000000000000  -2.000000000000000   1.000000000000000   1.000000000000000  -1.998714416931744   0.998722644911976&#xA;   1.000000000000000  -2.000000000000000   1.000000000000000   1.000000000000000  -1.999653030269727   0.999659262704001&#xA;gain =&#xA;    4.556034632804534e-009&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2012-04-08T13:31:08.040" LastActivityDate="2012-04-08T13:31:08.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1973" PostTypeId="1" CreationDate="2012-04-08T20:20:18.213" Score="3" ViewCount="382" Body="&lt;p&gt;Define a 1-periodic function on $\mathbb{R}$ by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(x) :=$ &#xA;$\left\{\begin{matrix}&#xD;&#xA;1 &amp;amp; if &amp;amp; 0&amp;lt;x&amp;lt;\frac{1}{10}\\ &#xD;&#xA;0 &amp;amp; if &amp;amp; \frac{1}{10}&amp;lt;x&amp;lt;1&#xD;&#xA;\end{matrix}\right.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with Fourier series $f(x) = \sum_{-\infty}^{\infty}c_k e^{2\pi ikx}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to find the graphs of the following two Fourier series:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{-\infty}^{\infty}(c_k)^2 e^{2\pi ikx}$ and $\sum_{-\infty}^{\infty}c_{3k} e^{2\pi ikx}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically my strategy with the others has been to find a way to get these Fourier series into the form $a\sum_{-\infty}^{\infty}c_k e^{2\pi ik(bx)}$ for $a,b\in\mathbb{C}$.  But I haven't been able to do it with these, hopefully someone can help, thanks.&lt;/p&gt;&#xA;" OwnerUserId="1035" LastActivityDate="2012-04-09T17:35:28.193" Title="Given the Graph of a Fourier Series $\sum c_k e^{2\pi ikx}$ Find the Graphs of $\sum c_{3k} e^{2\pi ikx}$ and $\sum (c_k)^2 e^{2\pi ikx}$" Tags="|homework|fourier-series|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1974" PostTypeId="1" CreationDate="2012-04-08T20:42:01.073" Score="9" ViewCount="2422" Body="&lt;p&gt;How intuitively to understand why eigenvectors of the autocorrelation matrix are used, but eigenvectors of the matrix constructed from temporal samples have no sense and aren't used? For example, in detection of a harmonious signal in additive noise.&lt;/p&gt;&#xA;" OwnerUserId="1199" LastEditorUserId="1059" LastEditDate="2012-05-17T02:14:08.210" LastActivityDate="2012-05-17T02:14:08.210" Title="Why do we deal with the eigenvectors of the autocorrelation instead of the data itself?" Tags="|autocorrelation|matrix|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1975" PostTypeId="2" ParentId="1973" CreationDate="2012-04-08T20:49:02.240" Score="2" Body="&lt;p&gt;Is it cheating to inverse the Fourier transform to obtain an expression for the $c_k$? &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the graph of the inverse function (compute the inverse Fourier transform)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Transform the inverse function according to the transformation of the $c_k$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the Fourier transform of this result, yielding the same expression.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So, if you could find the graph of $c_{3k}$ and $(c_k)^2$, you could find the graph of those expressions by taking the Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My immediate instinct was to identify the time-domain transformation and to analytically work out how this changes the frequencies and the amplitudes. Clearly the $c_{3k}$ option is going to see a shift in the frequencies, and no change in amplitude where $(c_k)^2$ is going to see a shift in the amplitude but no shift in the frequencies.&lt;/p&gt;&#xA;" OwnerUserId="1152" LastEditorUserId="1152" LastEditDate="2012-04-09T15:08:35.217" LastActivityDate="2012-04-09T15:08:35.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1976" PostTypeId="2" ParentId="1974" CreationDate="2012-04-08T21:09:28.167" Score="3" Body="&lt;p&gt;Firstly, eigenvectors and eigenvalues are defined for operators. Correlation is an operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, the eigenvectors of the autocorrelation are particularly interesting because they most efficiently explain the signal's variance in a linear regression. In other words, for a fixed number of vectors, selecting the eigenvectors minimizes the mean squared error where the signal is modeled as a linear sum of the vectors. This technique is referred to as &lt;a href=&quot;http://en.wikipedia.org/wiki/Principal_component_analysis&quot; rel=&quot;nofollow&quot;&gt;principal component analysis&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can expand your notion of a &quot;harmonious&quot; signal, perhaps I can comment further.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-04-08T21:09:28.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1977" PostTypeId="2" ParentId="1974" CreationDate="2012-04-08T22:04:58.130" Score="7" Body="&lt;p&gt;Some &quot;gut-level&quot; reasons why it is better to work with the autocorrelation matrix instead of a matrix with your observations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you want to take into account all your observations and you have a lot of data, you'll end up manipulating (inverting, multiplying) fairly large matrices. If you work with the autocorrelation matrix, you &quot;summarize&quot; your data once (in a fairly efficient step requiring just a FFT and an inverse FFT), and from then, you just manipulate your autocorrelation matrix of size $P&amp;#160;\times P$ where $P$ is your model order (for example for AR modeling or sinusoidal modeling).&lt;/li&gt;&#xA;&lt;li&gt;With some data it just doesn't work numerically to use the raw observations because you encounter situations in which you have to deal with matrices which are not guaranteed to be positive-definite.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For example, let us consider two approaches to AR model fitting.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Direct usage of the data matrix&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The empirical quadratic reconstruction error on your data is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\epsilon = \mathbf{x}^T\mathbf{x} + \mathbf{x}^T\Gamma \mathbf{a} + \mathbf{a}^T\Gamma^T\mathbf{x} + \mathbf{a}^T\Gamma^T \Gamma \mathbf{a} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{a}$ is the vector of AR-coefficients, $\mathbf{x}$ is your observations vector, and $\Gamma$ the matrix with your delayed observations. You need to find the value of $\mathbf{a}$ that minimizes this. After derivation and a bit of shuffling, your solution looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{a} = - (\Gamma^T \Gamma)^{-1} \Gamma^T \mathbf{x}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you are screwed because you have absolutely no guarantee that $\Gamma^T \Gamma$ can be inverted. In the process, numerically speaking, you had to deal with fairly large matrix products if you have a long sequence of observations.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Random process view&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;if you adapt a &quot;random process&quot; angle to the problem, the quantity you have to minimize (the expected value of the error) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\epsilon = r_x(0) + 2 \mathbf{r} \mathbf{a} + \mathbf{a}^T \mathbf{R} \mathbf{a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you end up with the more palatable solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{a} = - \mathbf{R}^{-1} \mathbf{r}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a solid guarantee that this will be computable because $\mathbf{R}$ is positive definite!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like your problem is that of sinusoidal modeling (rather than AR modeling). There's a lot of hand-waving here, but what I have said about AR modeling and the hurdles of using the raw data matrix ; also applies to sinusoidal modeling - with eigenvalue decomposition being the problematic operation instead of matrix inversion.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-04-08T22:13:44.373" LastActivityDate="2012-04-08T22:13:44.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1978" PostTypeId="2" ParentId="1973" CreationDate="2012-04-08T22:37:54.297" Score="4" Body="&lt;p&gt;This doesn't require any complicated computations! Look up some tables of identities about the Fourier Series. Which operation would you have to apply to $f$ so that its Fourier series would become $\sum_{-\infty}^{\infty}(c_k)^2 e^{2\pi ikx}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we know that derivating in the time domain is equivalent to multiplying the Fourier series coefficients by $i k$ ; so we know that the graph of the Fourier series $\sum_{-\infty}^{\infty} ik (c_k) e^{2\pi ikx}$ is the graph of the derivative of $f$.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-04-08T22:37:54.297" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1979" PostTypeId="2" ParentId="1924" CreationDate="2012-04-09T07:21:44.707" Score="4" Body="&lt;p&gt;Thresholding can be treated as one of the basic methods segmentation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, to evaluate the segmentation method, one needs to compare it with a ground truth image and identify number of pixels that are correctly classified as foreground as foreground and vice-versa. In general, number of background pixels even if classified correctly shouldn't really matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the possible metric to evaluate is &quot;Tanimoto Coefficient&quot; - which is explained here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1737/how-do-i-evaluate-the-performance-of-a-segmentation-algorithm&quot;&gt;How do I evaluate the performance of a segmentation algorithm?&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is another reference &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://web.cs.wpi.edu/~trascrizione/MethSurvey.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mehmet Sezgin, Bulent Sankur &lt;strong&gt;Survey over image thresholding techniques and quantitative performance evaluation&lt;/strong&gt; &lt;em&gt;Journal of Electronic Imaging 13(1), 146 – 165 (January 2004).&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which provides a much broader framework specifically for the thresholding. This method provides a mechanism which is not dependent on ground truth and hence it is quite useful for document image processing as dicussed in the paper. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-04-09T07:21:44.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1980" PostTypeId="2" ParentId="1932" CreationDate="2012-04-09T08:33:04.133" Score="7" Body="&lt;p&gt;Nikie's answer seems best and also seems to be working and producing results. So it's a clear winner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, just to documentation i adding one more reference, that could just be very fast. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This technique is called Adaptive thresholding which doesn't require to &lt;em&gt;learn&lt;/em&gt; the background explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, instead of finding the most suitable &lt;em&gt;global threshold&lt;/em&gt; - we can partition the image in a local window (say about 7x7 or appropriate) and find thresholds that changes as the window traverses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reference below details the exact method.&#xA;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method would be relatively computationally faster. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-04-09T08:33:04.133" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1981" PostTypeId="2" ParentId="1947" CreationDate="2012-04-09T09:03:04.517" Score="1" Body="&lt;p&gt;From a general perspective, you are trying to take SSIM - which is image difference measure. But it is probably a bad idea if you are looking for measure the intraclass, distance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look at distance measures like &lt;a href=&quot;http://en.wikipedia.org/wiki/Euclidean_distance&quot; rel=&quot;nofollow&quot;&gt;Euclidean distance&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Mahalanobis_distance&quot; rel=&quot;nofollow&quot;&gt;Mahalonbis distance&lt;/a&gt; (if you have co-variance metrics) or others. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a very simple example : To compute Euclidean distance $L_2$, which is computed between the centroid of the Clusters - as $ Distance = \sqrt{(x_a- x_b)^2 + (y_a- y_b)^2 }$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE: here the dimension are NOT image dimension but are rather the dimension of the feature vector. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I WILL EXPAND THIS ANSWER WITH YOUR SPECIFIC NEEDS.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-04-09T09:03:04.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1983" PostTypeId="1" AcceptedAnswerId="2026" CreationDate="2012-04-09T10:23:06.883" Score="7" ViewCount="2706" Body="&lt;p&gt;I am looking for a low MIPS, low compression video encoder. This is for a 10fps, VGA type quality compression. What are my options? I need to be able to do this compression using a 150MHz ARM M4 CPU with Floating point support. (STM32F4)..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is to push this compressed data out of the CPU with a parallel bus, there will be no processing done on the data. Compression rate wise, as much as possible, I just want to see the boundaries. This is for a low cost CCTV application, I like to see what I can achieve with a 5USD cpu and lots of transmission band with vs. a 30USD encoder with low data trasnmission bw.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;10fps, VGA will generate roughly 25Mbit/sec data. This is fairly high data rate for anything out there. If I can bring this down to 5Mbit/sec, I think I can build a very low cost CCTV system. Once I get the data to the base, I can re-encode the data, therefore it doesn't matter what the compression mechanism is, as long as it is not very lossy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Monochromatic video is what is necessary at moment over color. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This CPU has 120MHz allocated to this task. &lt;/li&gt;&#xA;&lt;li&gt;Memory interface is 16 bit, therefore external memory write/read is slower compared to internal memory. &lt;/li&gt;&#xA;&lt;li&gt;Internal memory is 120KByte and it has 32 bit access fast access. Both cases the memory is accessed via AHB bus which we should assume 60MHz as the clock frequency. &lt;/li&gt;&#xA;&lt;li&gt;Following data flow is expected: &#xA;&lt;ol&gt;&#xA;&lt;li&gt;Camera -&gt;DMA -&gt;External Memory (no cpu involvement)&lt;/li&gt;&#xA;&lt;li&gt;External Memory -&gt; CPU -&gt;Compression -&gt;Internal Memory&lt;/li&gt;&#xA;&lt;li&gt;Internal Memory -&gt; DMA -&gt; Data Bus -&gt; External Device&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;CPU will only read a chunk of data compress and write to its internal memory (the compressed data), later start a DMA transfer. &lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="440" LastEditDate="2012-04-12T09:29:00.607" LastActivityDate="2012-04-22T06:59:50.847" Title="Low MIPS Video Encoder" Tags="|video-compression|hardware-implementation|" AnswerCount="2" CommentCount="8" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1984" PostTypeId="2" ParentId="555" CreationDate="2012-04-09T15:04:08.917" Score="4" Body="&lt;p&gt;That is a nasty signal environment.  I would do a little DSP judo and make the multi-path work for you by using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Rake_receiver&quot; rel=&quot;nofollow&quot;&gt;rake receiver&lt;/a&gt;, which should make the multi-path signals increase your SNR rather than diminish it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rake receivers have only been used (as far as I know, anyway) in CDMA systems, but that is not because they can only be used in CDMA systems.  The issue is the symbol period.  The following quote is from a &lt;a href=&quot;http://www.comlab.hut.fi/opetus/333/2004_2005_slides/RAKE_text.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; on rake receivers:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;RAKE receiver attempts to&#xA;  collect the time-shifted versions of the original signal by&#xA;  providing a separate correlation receiver for each of the&#xA;  multipath signals. This can be done due to multipath&#xA;  components are practically uncorrelated from another when&#xA;  their relative propagation delay exceeds a chip period.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thus, the reason that they were used in CDMA systems and not, say, GSM, was because the chip speed was so much faster, and thus the multipath signals would not arrive in the same chip/symbol.  That was not true for GSM and other &quot;narrowband&quot; signals.  Even though your bit rate is very low, the multipath signals still seem to have delays greater than one symbol, so this constraint should not be a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other problem is detecting the multipath.  This could, I would think, be accomplished with known data sequences, such as a preamble, but I confess that I am not an expert on rake receivers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the rake receiver does not work out, you could still use a long equalizer to handle the multipath.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the other elements of the system, if there is no feedback I would do a QPSK signal with &lt;a href=&quot;http://en.wikipedia.org/wiki/Forward_error_correction&quot; rel=&quot;nofollow&quot;&gt;FEC&lt;/a&gt; (probably turbo codes).  If you do have feedback I would do the same but also dynamically change the modulation type from QPSK up to 16-QAM or something, depending on how well the signal is coming through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: After thinking about it a bit I realized why rake receivers and CDMA systems go hand-in-hand.  The problem is that even if you detect a multi-path signal it doesn't do you a lot of good unless it has a positive &lt;a href=&quot;http://en.wikipedia.org/wiki/SINR&quot; rel=&quot;nofollow&quot;&gt;SINR&lt;/a&gt;.  By definition at most one multi-path signal can have a positive SINR, because for all the other multi-path signals the strongest overwhelms them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is where despreading comes in.  Once the multi-path signal is despread it will have a positive SINR, assuming the spreading factor is large enough to overcome the initial negative SINR.  Given this I think the right solution is to relax the 500 Hz limit, use a fairly large spreading factor and a rake receiver to combine the various multi-path signals.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-04-25T20:40:32.903" LastActivityDate="2012-04-25T20:40:32.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1985" PostTypeId="2" ParentId="1881" CreationDate="2012-04-09T16:58:24.837" Score="4" Body="&lt;p&gt;You have two options, use back projection or projection between two planes (homography).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With back projection you take a pseudo inverse of you camera matrix $P$ and multiply the result with your homogenous presentation of image point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;P = K\begin{bmatrix}R &amp;amp; -R\textbf{C}\end{bmatrix}&#xD;&#xA;\\&#xD;&#xA;\textbf{X}_{reprojected} = P^+\textbf{x}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have a 3D line which travels trough the camera center $\textbf{C}$ and point $\textbf{X}$. If you want, you can convert this to some more easily dealt with presentation. For example with one point and direction vector (remember to normalize the homogenous coordinates $\textbf{V} = \omega\begin{bmatrix}X &amp;amp; Y &amp;amp; Z &amp;amp; 1\end{bmatrix}^T$ such that scale factor $\omega=1$ before the actual calculations):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\textbf{u} = \textbf{X}_{reprojected}-\textbf{C} \\&#xD;&#xA;\textbf{v} = \frac{ \textbf{u} }{\|\textbf{u}\|} \\&#xD;&#xA;\textbf{L}(t) = \textbf{C} + t\textbf{v}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have plane $\Pi = \begin{bmatrix}\pi_1 &amp;amp; \pi_2 &amp;amp; \pi_3 &amp;amp; \pi_4\end{bmatrix}^T, \pi_1X + \pi_2Y + \pi_3Z + \pi_4 = 0$  you can solve the equation $\textbf{L}(t) = \Pi$ for $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you decide to use homography, you need to compute the $3\times3$ homography matrix $H$ which is defined as projection between the imaged plane and the plane of camera sensor:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\textbf{X}_{plane} = \begin{bmatrix}X &amp;amp; Y &amp;amp; 0 &amp;amp; 1\end{bmatrix}^T \\&#xD;&#xA;\textbf{x} = P\textbf{X}_{plane}&#xD;&#xA;= H\begin{bmatrix}X &amp;amp; Y &amp;amp; 1\end{bmatrix}^T&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you know $\textbf{x}$:&#xA;$$&#xD;&#xA;\textbf{X}_{plane} = H^{-1}\textbf{x}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you did not compute the $H$ while calibrating the camera (probably using direct linear transformation, DLT), you can use following formulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;H = R + \frac{1}{d}\textbf{T}\textbf{N}^T&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $d$ is the dinstance of the camera from the plane and $\textbf{T} = -R\textbf{C}$. (Ma, Soatto, Kosecká, Sastry - An invitation to 3-D Vision From Images to Geometric Models, p. 132)&lt;/p&gt;&#xA;" OwnerUserId="1203" LastActivityDate="2012-04-09T16:58:24.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1987" PostTypeId="2" ParentId="1727" CreationDate="2012-04-09T18:00:50.827" Score="17" Body="&lt;p&gt;If you object has 6 known points (known 3D coordinates, $X, Y$ and $Z$) you can compute the location of the camera related to the objects coordinate system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First some basics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Homogenous coordinate is vector presentation of euclidean coordinate $(X,Y,Z)$ in which we have appended so called scale factor $\omega$ such that the homogenous coordinate is $\textbf{X} = \omega \begin{bmatrix}X &amp;amp; Y &amp;amp; Z &amp;amp; 1\end{bmatrix}^T$. In your own calculations try to keep $\omega=1$ as often as possible (meaning that you &quot;normalize&quot; the homogenous coordinate by dividing it with its last element: $\textbf{X} \leftarrow \frac{\textbf{X}}{\omega}$). We can also use homogenous presentation for 2D points such that $\textbf{x} = \omega\begin{bmatrix}X &amp;amp; Y &amp;amp; 1\end{bmatrix}$ (remeber that these $\omega, X,Y$ and $Z$ are different for each point, be it 2D or 3D point). Homogenous coordinate presentation makes the math easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Camera matrix is $3\times4$ projection matrix from the 3D world to the image sensor:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\textbf{x} = P\textbf{X}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\textbf{x}$ is the point on image sensor (with pixels units) and $\textbf{X}$ is the projected 3D point (lets say that it has millimeters as its units).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We remember that cross product between two 3-vectors can be defined as matrix-vector-multiplication such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\textbf{v} \times \textbf{u} = \\&#xD;&#xA; ( \textbf{v} )_x \textbf{u} = \\&#xD;&#xA;\begin{bmatrix}&#xD;&#xA;        0 &amp;amp; -v_3&amp;amp; v_2 \\&#xD;&#xA;        v_3 &amp;amp; 0 &amp;amp; -v_1 \\&#xD;&#xA;        -v_2 &amp;amp; v_1 &amp;amp; 0&#xD;&#xA;\end{bmatrix}&#xD;&#xA;\textbf{u}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also useful to note that cross production $\textbf{v} \times \textbf{v} = \textbf{0}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now lets try to solve the projection matrix $P$ from the previous equations. Lets multiply the projection equation from the left side with $\textbf{x}$s cross product matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;(\textbf{x})_x\textbf{x} = (\textbf{x})_xP\textbf{X} = \textbf{0}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aha! The result must be zero vector. If we now open the equation we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;    \begin{bmatrix}&#xD;&#xA;        0 &amp;amp; -w&amp;amp; y \\&#xD;&#xA;        w &amp;amp; 0 &amp;amp; -x \\&#xD;&#xA;        -y &amp;amp; x &amp;amp; 0&#xD;&#xA;    \end{bmatrix}&#xD;&#xA;    \begin{bmatrix}&#xD;&#xA;            P_{1,1} &amp;amp; P_{1,2} &amp;amp; P_{1,3} &amp;amp; P_{1,4} \\&#xD;&#xA;            P_{2,1} &amp;amp; P_{2,2} &amp;amp; P_{2,3} &amp;amp; P_{2,4} \\&#xD;&#xA;            P_{3,1} &amp;amp; P_{3,2} &amp;amp; P_{3,3} &amp;amp; P_{3,4}&#xD;&#xA;    \end{bmatrix}&#xD;&#xA;    \textbf{X}&#xD;&#xA;\\&#xD;&#xA;=&#xD;&#xA;&#xD;&#xA;\begin{bmatrix}&#xD;&#xA; P_{3,4} W y - P_{2,1} X w - P_{2,2} Y w - P_{2,4} W w + P_{3,1} X y - P_{2,3} Z w + P_{3,2} Y y + P_{3,3} Z y \\&#xD;&#xA; P_{1,4} W w + P_{1,1} X w - P_{3,4} W x + P_{1,2} Y w - P_{3,1} X x + P_{1,3} Z w - P_{3,2} Y x - P_{3,3} Z x \\&#xD;&#xA; P_{2,4} W x + P_{2,1} X x - P_{1,4} W y - P_{1,1} X y + P_{2,2} Y x - P_{1,2} Y y + P_{2,3} Z x - P_{1,3} Z y&#xD;&#xA;\end{bmatrix} = \textbf{0}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With little bit of refactoring we can get the projection matrix $P$ outside of the matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\tiny&#xD;&#xA;\begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; - X\, w &amp;amp; - Y\, w &amp;amp; - Z\, w &amp;amp; - W\, w &amp;amp; X\, y &amp;amp; Y\, y &amp;amp; Z\, y &amp;amp; W\, y\\ X\, w &amp;amp; Y\, w &amp;amp; Z\, w &amp;amp; W\, w &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; - X\, x &amp;amp; - Y\, x &amp;amp; - Z\, x &amp;amp; - W\, x\\ - X\, y &amp;amp; - Y\, y &amp;amp; - Z\, y &amp;amp; - W\, y &amp;amp; X\, x &amp;amp; Y\, x &amp;amp; Z\, x &amp;amp; W\, x &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}&#xD;&#xA;\begin{bmatrix}&#xD;&#xA;    \textbf{P}_1 \\&#xD;&#xA;    \textbf{P}_2 \\&#xD;&#xA;    \textbf{P}_3 \\&#xD;&#xA;\end{bmatrix}&#xD;&#xA;= &#xD;&#xA;\textbf{0}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\textbf{P}_n$ is the transpose of $n$:th row of the camera matrix $P$. Last row of the previous (big) matrix equation is linear combination of the first two rows, so it does not bring any additional information and it can be left out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Small pause so we can gather our toughs. Note that the previous matrix equation has to be formed for each known 3D-&gt;2D correspondence (there must be at least 6 of them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for each point correspondence, calculate the first two rows of the matrix above, stack the $2\times12$ matrices on top of each other and you get new matrix $A$ for which&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;A\begin{bmatrix}&#xD;&#xA;    \textbf{P}_1 \\&#xD;&#xA;    \textbf{P}_2 \\&#xD;&#xA;    \textbf{P}_3 \\&#xD;&#xA;\end{bmatrix}&#xD;&#xA;= &#xD;&#xA;\textbf{0}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we have 12 unknowns and (at least) 12 equations this can be solved. Only problem is that we don't want to have the trivial answer where &#xA;$$&#xD;&#xA;\begin{bmatrix}&#xD;&#xA;    \textbf{P}_1 \\&#xD;&#xA;    \textbf{P}_2 \\&#xD;&#xA;    \textbf{P}_3 \\&#xD;&#xA;\end{bmatrix} = \textbf{0}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately we can use singular value decomposition (SVD) to force &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\|&#xD;&#xA;\begin{bmatrix}&#xD;&#xA;    \textbf{P}_1 \\&#xD;&#xA;    \textbf{P}_2 \\&#xD;&#xA;    \textbf{P}_3 \\&#xD;&#xA;\end{bmatrix}&#xD;&#xA;\|=1&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to solve the the equations, calculate SVD of matrix $A$ and pick the singular vector corresponding to the smallest eigen value. This vector is the null vector of matrix A and also the solution for the camera matrix $P$. Just unstack the $\begin{bmatrix} \textbf{P}_1 &amp;amp; \textbf{P}_2 &amp;amp; \textbf{P}_3 \end{bmatrix}^T$ and form $P$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you wanted to know the distance to the object. $P$ is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;P = K\begin{bmatrix}R &amp;amp; -R\textbf{C}\end{bmatrix}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\textbf{C}$ is the camera location relative to the objects origin. It can be solved from the $P$ by calculating $P$s null vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Hartley, Zisserman - Multiple View Geometry in Computer Vision)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, when you calculate the cameras location for two frames, you can calculate the unknown objects locations (or locations of some of the points of the object) by solving two equations for $X$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\textbf{x}_1 = P_1 \textbf{X} \\&#xD;&#xA;\textbf{x}_2 = P_2 \textbf{X} \\&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which goes pretty much the same way as how we solved the camera matrices:&#xA;$$&#xD;&#xA;(\textbf{x}_1)_xP_1\textbf{X} = \textbf{0} \\&#xD;&#xA;(\textbf{x}_2)_xP_2\textbf{X} = \textbf{0} \\&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so on.&lt;/p&gt;&#xA;" OwnerUserId="1203" LastEditorUserId="1203" LastEditDate="2012-04-09T18:05:58.543" LastActivityDate="2012-04-09T18:05:58.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1988" PostTypeId="2" ParentId="1932" CreationDate="2012-04-09T22:31:09.020" Score="5" Body="&lt;p&gt;This is a good Matlab code for adaptive thresholding: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/8647-local-adaptive-thresholding&quot; rel=&quot;noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/8647-local-adaptive-thresholding&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1205" LastActivityDate="2012-04-09T22:31:09.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1990" PostTypeId="1" AcceptedAnswerId="9301" CreationDate="2012-04-10T03:11:00.310" Score="10" ViewCount="3900" Body="&lt;p&gt;I am using &lt;a href=&quot;http://en.wikipedia.org/wiki/RANSAC&quot; rel=&quot;nofollow noreferrer&quot;&gt;RANSAC&lt;/a&gt; algorithm for homography estimation between pairs of images taken with cameras which do not have any translation between them (pure rotation and change of scale/zoom). It works well in half of the cases. The correct output looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kBhwl.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red lines are filtered correspondences and the quadrilaterals illustrate how the homography distorts perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes, however, many bad cases happen, like these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1wkR7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9jIsO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cTdHy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already have a simple test in the RANSAC loop. It makes a simple quadrilateral (a unit square) and transforms it with sample transform. Then it looks whether the transform kept its convexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, however, bunches of concave quadrilaterals come out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea how to properly test the homography, if it behaves &quot;nicely&quot; and filter out the incorrect solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some code where they test that none of the three transformed points are colinear. But this does not seem sufficient as it will not filter out deltoids and other &quot;invalid&quot; quadrilaterals...&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1203" LastEditDate="2012-04-11T05:22:06.387" LastActivityDate="2013-05-27T16:03:57.377" Title="Filtering RANSAC Estimated Homographies" Tags="|homography|estimation|transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1991" PostTypeId="1" AcceptedAnswerId="1993" CreationDate="2012-04-10T08:16:09.000" Score="9" ViewCount="25151" Body="&lt;p&gt;Lets say we have a spectrum ranging from -X MHz to +X MHz. I would need to correct the frequency error in the spectrum by shifting the zero component to the middle (0 Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the output (the frequency spectrum) is calculated via FFT, as far as I know I can move the spectrum by adjusting the 'twiddle factors' (or coefficients, for complex data sine and cosine waves). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a size 1024 FFT (bin indexes from 0 to 1023), 0 Hz component should exist in bin number 511. However, due to possible frequency error the 0 hz component may actually be in bin 510 for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot seem to find much information on this. Any help appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Mistake in the question.&lt;/p&gt;&#xA;" OwnerUserId="1208" LastEditorUserId="1208" LastEditDate="2012-04-10T08:33:04.207" LastActivityDate="2012-10-02T21:18:43.977" Title="How to shift the frequency spectrum?" Tags="|fft|frequency|frequency-spectrum|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1992" PostTypeId="2" ParentId="1983" CreationDate="2012-04-10T11:10:16.657" Score="4" Body="&lt;p&gt;Your first problem is memory - even the largest version of that processor doesn't have that much internal SRAM (in video terms - it's a stonking embedded processor compared to many though!) - a VGA frame is 300kB, vs the 100ishkB in the processor.  That means you'll have to process it as it comes in - say in 8 or 16 line chunks, which makes it much more of a &quot;hard-realtime&quot; problem as the deadlines have less slack in them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not clear how you'll be capturing data, but I assume that you'll have some sort of DMA from either the ADC or some digital port, otherwise you'll be spending half your time shuffling data around! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aiming for lowish compression ratios, you might just want to look at encoding the deltas between pixels along a line or a 3x3 square and then arithmetic code them.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://dsp.stackexchange.com/questions/1254/simple-streaming-lossless-image-compression&quot;&gt;Simple, streaming, lossless image compression&lt;/a&gt; - although I was asking for explicitly lossless compression, there may be some ideas for you there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a datapoint, one of my colleagues implemented a 320x240 8-bit mono JPG compression in a 60MHz 32-bit micro with floating point unit and a small cache.  He used some reference code (ie optimised for readability, not performance) and got 5 fps fairly easily.  Compression ratios were of the order of 10x IIRC. The image capture was done by external hardware bus-mastering the data into the micro's external RAM.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-04-10T11:10:16.657" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1993" PostTypeId="2" ParentId="1991" CreationDate="2012-04-10T12:47:06.370" Score="9" Body="&lt;p&gt;If the frequency shift that you want is a multiple of the bin spacing, as in your example, then you can easily effect the shift that you want by just rotating the FFT outputs by the number of bins that you need. In the more common case that the frequency offset is not an integer multiple of the bin spacing, then you can multiply the signal by a complex exponential function before doing the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you determine that the center frequency component that you speak of is actually located at frequency $f_{offset}$ Hz in your data, and the data is sampled at rate $f_s$ Hz, then to shift the spectrum such that the component of interest is at zero frequency in the FFT output, you would do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_{\text{shifted}}[n] = x[n] e^{-\frac{j 2 \pi f_{\text{offset}} n}{f_s}}, \ \ n = 0, 1, \ldots , N-1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y_{\text{shifted}}[k] = FFT\left[x_{\text{shifted}}[n]\right]&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="6" LastEditDate="2012-10-02T21:18:43.977" LastActivityDate="2012-10-02T21:18:43.977" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1994" PostTypeId="1" AcceptedAnswerId="1998" CreationDate="2012-04-10T10:31:23.417" Score="9" ViewCount="1254" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1135/how-to-find-tennis-courts-in-aerial-imagery&quot;&gt;How to find tennis courts in aerial imagery&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;I am trying to detect tennis courts that are present in aerial images ..&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I have the following image:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gv8CI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I tried color image segmentation on it but no success it gives a bad&#xA;  result :&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B4Ymh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What techniques should i apply for the same please suggest i think Hough transform or watershed could be used however watershed causes over segmentation and the results i get are not satisfactory&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried using adaptive thresholding:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NqxLd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more things that i tried Connected components :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qnEYR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="654" OwnerDisplayName="vini" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2012-04-10T14:23:59.690" Title="Detecting tennis courts in aerial images?" Tags="|image-processing|matlab|" AnswerCount="5" CommentCount="8" ClosedDate="2012-04-10T14:10:41.053" ContentLicense="CC BY-SA 3.0" />
  <row Id="1995" PostTypeId="2" ParentId="1994" CreationDate="2012-04-10T10:37:08.097" Score="3" Body="&lt;p&gt;I think that I would do this in at least 2 steps.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, look for sets of lines which match the lines along the length of a tennis court.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, within the boundary of those sets of lines, look for lines across the width of the court.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can assume that all tennis courts have white lines on green backgrounds if you wish, though I'm not sure it's a good assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, I'd suggest 3 steps.  First one would be to binarise the image, I don't think I've ever seen a tennis court with dark lines on a light background so you can probably constrain the problem to looking for white lines.&lt;/p&gt;&#xA;" OwnerDisplayName="High Performance Mark" LastActivityDate="2012-04-10T11:09:10.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1996" PostTypeId="2" ParentId="1994" CreationDate="2012-04-10T10:50:09.320" Score="4" Body="&lt;p&gt;Do you want to detect (find out their existence) them or segment them (find out their precise contours)? Those are two very different problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only want to do detection, I'd look into using image features such as SIFT. You can try these methods very easily with OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Segmentation is a completely different topic. Supposing you have detected the court roughly with SIFT, you could use a simple registration based method to find out more precisely where the court lies (by registering a template tennis court image to your image). Then you could use any local refinement technique to improve your segmentation.&lt;/p&gt;&#xA;" OwnerUserId="1210" OwnerDisplayName="static_rtti" LastActivityDate="2012-04-10T10:50:09.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1997" PostTypeId="2" ParentId="1994" CreationDate="2012-04-10T10:58:46.453" Score="2" Body="&lt;p&gt;I would suggest the following&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a template or templates of the Tennis courts. Make these in gray scale. Match these templates one by one to the image above and see which one fits bets. This is not the best approach. Worst approach.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Again , create a template or templates. Compute the SURF features of the template and match them against the image above. This is more robust. Is pretty tolerant to skew, rotation, perspective cuts of image. Matching will occur to the court area in the image.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a bank of Gabor Filters. Match the response of each filter applied to the image above. there WILL be a specific response to where the courts exists in the image. That is your court area.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Work a little more and your will nail it :)&lt;/p&gt;&#xA;" OwnerUserId="1215" OwnerDisplayName="Wajih" LastActivityDate="2012-04-10T10:58:46.453" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1998" PostTypeId="2" ParentId="1994" CreationDate="2012-04-10T11:21:58.500" Score="13" Body="&lt;p&gt;Since you are trying to discover structure in the images it's better to work in grayscale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very nice case where the court appears to be a nice rectangle, but in general, courts might come in different sizes and orientations. Also, white lines on green background is not a general rule, consider for example &lt;a href=&quot;http://www.flickr.com/photos/54761048@N08/5086443162/&quot; rel=&quot;noreferrer&quot;&gt;Roland Garos&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said this, you can try thresholding your image (you might have to use adaptive thresholding for this) to get something like this: &lt;img src=&quot;https://i.stack.imgur.com/JyQXD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then go through the image creating chains of pixels that are &lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling&quot; rel=&quot;noreferrer&quot;&gt;4 or 8 connected&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are looking for lines, you can get each of the chains and &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_regression&quot; rel=&quot;noreferrer&quot;&gt;fit a line&lt;/a&gt; to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, the &quot;interesting pixels&quot; in your image have been transformed to a set of line models and some of them will be intersecting. You can now apply simple rules to discover which sets of lines are intersecting (here is &lt;a href=&quot;http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/&quot; rel=&quot;noreferrer&quot;&gt;a good example&lt;/a&gt; ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To discover the set of intersecting lines that make up a tennis court you would search for (this is an example) &quot;A set of 9 lines where 4 are intersecting at right angles, two more parallel to the long lines intersecting them at 1/8 of the width of the field, two more parallel to the short sides and lying about 1/5 from the beginning of the court and a third running in the middle of the court and intersecting the two shorter ones&quot;...In other words, you will have to express the tennis court as a set of intersecting lines with relative positioning to each other (so that your expression is free of the absolute dimensions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a very good application of the above technique you can have a look at this paper that outlines &lt;a href=&quot;http://paginaspersonales.deusto.es/dipina/cambridge/PUC/PUCpaper.pdf&quot; rel=&quot;noreferrer&quot;&gt;the recognition of shotcodes&lt;/a&gt; in an image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the theoretical background and more information about these techniques you can refer to the excellent &lt;a href=&quot;http://www.imageprocessingplace.com/DIPUM-2E/dipum2e_main_page.htm&quot; rel=&quot;noreferrer&quot;&gt;&quot;Digital Image Processing With Matlab&quot;&lt;/a&gt; and specifically, chapters 10-13 &lt;a href=&quot;http://www.imageprocessingplace.com/downloads_V3/dipum2e_downloads/dipum2e_sample_book_material_downloads/DIPUM2E_Table_of_Contents.pdf&quot; rel=&quot;noreferrer&quot;&gt;which are the most relevant to your problem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" OwnerDisplayName="A_A" LastActivityDate="2012-04-10T11:21:58.500" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1999" PostTypeId="2" ParentId="1994" CreationDate="2012-04-10T13:06:59.573" Score="3" Body="&lt;p&gt;I think the Hough transform is the way to go here, if you can assume that the courts will always have the same type of line markings. First run an edge detector on the image.  Then run the Hough transform to detect straight lines.  Then see which of the lines are parallel or perpendicular to each other, and see which ones form rectangles of the right aspect ratio.  For that you may want to sort the parallel and perpendicular lines by their spatial proximity in the image.  Then check for the appropriate lines within the rectangles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you may have problems if the camera is not looking straight down, because then you will not get the right angles.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-04-10T13:06:59.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2000" PostTypeId="1" AcceptedAnswerId="2001" CreationDate="2012-04-10T14:14:38.693" Score="10" ViewCount="1427" Body="&lt;p&gt;I was wondering about super simple applications of linear or logistic regression to signal processing (image processing specifically)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a math guy that's been asked to explain some mathematical methods to signal/image processing people, and I'd like to be able to use a couple simple examples that are related to their field, but I know little about image processing. So, I'm not looking for anything complicated (I don't know the subject, so the simpler the better; I'm just hoping to find something to demonstrate the applicability of these algorithms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help!&lt;/p&gt;&#xA;" OwnerUserId="1211" LastActivityDate="2012-04-11T14:50:46.160" Title="Examples of linear/logistic regression applications" Tags="|image-processing|algorithms|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2001" PostTypeId="2" ParentId="2000" CreationDate="2012-04-10T14:50:45.817" Score="2" Body="&lt;p&gt;In image processing all I can think of is using linear regression to fit a plane to the intensity surface of an image, and using logistic regression for some  kind of supervised thresholding...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be better off using an example from computer vision instead. For example texture classification or object recognition.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-04-10T14:50:45.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2002" PostTypeId="2" ParentId="1990" CreationDate="2012-04-10T16:00:00.517" Score="4" Body="&lt;p&gt;There is a problem in checking whether the homography is OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm for checking correct homographies may interest someone, so I will write it down here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Create a quadrilateral $ABDC$ with vertex coordinates (in homogenous coordinates):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{eqnarray} A:&amp;amp; (-w/2,-h/2, 1.0) \\ B:&amp;amp; (w/2,-h/2, 1.0) \\ C:&amp;amp; (-w/2,h/2, 1.0) \\ D: &amp;amp;(w/2,h/2, 1.0) \end{eqnarray}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w,h$ are width and height of the image, respectively. If the whole image frame (a rectangle) is transformed to convex quadrilateral, than any convex quadrilateral within it will also be transformed &quot;neatly&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Create transformed quadrilateral $A'B'D'C'$ in which every vertex is transformed using the computed homgraphy (e.g. $C'=HC$ ). From now on, all points will be converted to non-homogenous coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Compute vectors $\vec{u}$, $\vec{v}$ for parametric representation of diagonals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{eqnarray}d_{1} :&amp;amp; A+(D-A)s =A+ \vec{u}s \\ d_{2} :&amp;amp; B + (C-B)t=B+\vec{v}t \end{eqnarray}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intersection of diagonal comes from $d_{1}=d_{2}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$t=\frac{1}{d}\left[(B_{y}-A_{y})\vec{u}_{x} - (B_{x}-A_{x})\vec{u}_{y}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s=\frac{1}{d}\left[(A_{x}-B_{x})\vec{v}_{y} - (A_{y}-B_{y})\vec{v}_{x}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the convex quadrilateral satisfies $s,t \in (0,1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, one can introduce a &lt;em&gt;fudge factor&lt;/em&gt; to avoid not only non-convex and degenerate quadrilaterals, but also near-degenerate ones, like when three points are near colinear. So the test can be modified such that $s,t \in (\lambda, 1.0-\lambda)$, where lambda is a small number (e.g. $\lambda=0.01$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Older problem, fixed in the above algorith:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the problem here - having a certain homography, the test can pass for a smaller quadrilateral, but not for the larger one. This is why some &quot;ill&quot; homographies passed through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The green square represents a source image, the orange is a transformed one. As you can see, the left hand one is convex, but starts deforming as the source is larger:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QCPeG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally even larger source yield non conver quadrilateral:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8F10l.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a mistake with scaling. The points in homogenous coordinates $(x,y,w)$ were scaled in $x$ and $y$ direction, but in $w$. This is why the same transform produced different quadrilaterals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have corrected the algorithm accordingly.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-04-10T20:28:24.647" LastActivityDate="2012-04-10T20:28:24.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2003" PostTypeId="2" ParentId="1758" CreationDate="2012-04-10T16:27:59.453" Score="5" Body="&lt;p&gt;The following are the basics of image processing for finger prints&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Make sure you understand what a finger print is. It is basically a signature for every human being. Every finger on each hand on every person (even twins) have unique patterns. These patterns are of interest to you. &lt;/li&gt;&#xA;&lt;li&gt;These patterns are classified into categories. Deltas, circles etc.&lt;/li&gt;&#xA;&lt;li&gt;You must understand what valleys,ridges, bifurcations, etc are. &lt;/li&gt;&#xA;&lt;li&gt;Once you understand the two above and a bit more, you go onto fingerprint acquisition.&lt;/li&gt;&#xA;&lt;li&gt;Once you have an image. The interesting and difficult part begins. Such as segmentation, enhancement of certain patterns, noise reduction, finally encoding.&lt;/li&gt;&#xA;&lt;li&gt;The encoding part is the penultimate part. When you have an filter/processed image, you create a digital signature which is called encoding. This signature is what the whole fingerprint ended up in. &lt;/li&gt;&#xA;&lt;li&gt;You then create more digital signatures for other images.&lt;/li&gt;&#xA;&lt;li&gt;You make comparisons of these images, trying to figure out matches.&lt;/li&gt;&#xA;&lt;li&gt;Matching itself is another story. Where you will try to see false matches and true matches.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Still there are plenty of other things you need to do. But these are the basics. Lengthy but you can do it if you have interest in it  :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;List item&lt;/p&gt;&#xA;" OwnerUserId="1215" LastActivityDate="2012-04-10T16:27:59.453" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2004" PostTypeId="2" ParentId="1990" CreationDate="2012-04-10T16:39:30.423" Score="1" Body="&lt;p&gt;If you have estimated the homography as $x_i \sim Hx_i^&amp;#39;$ and you calculate the model error as $\sum_{j=1\dots n}\|x_j - Hx_j^&amp;#39;\|$ you may face problems when the estimated planes are almost perpendicular. You can increase the robustness by estimating another homography $H^&amp;#39;$ such that $x^&amp;#39; = H^&amp;#39;x$ and calculating the model error as $\sum_{j=1\dots n}\|x_j - Hx_j^&amp;#39;\| + \|x_j^&amp;#39; - H^&amp;#39;x\|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Hartley and Zisserman - Multiple View Geometry on Computer Vision chapter 4.2 and especially 4.2.3 and equation (4.8).&lt;/p&gt;&#xA;" OwnerUserId="1203" LastEditorUserId="1203" LastEditDate="2012-04-10T18:02:41.253" LastActivityDate="2012-04-10T18:02:41.253" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2005" PostTypeId="2" ParentId="1930" CreationDate="2012-04-10T16:55:28.687" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I am/was shaky on the correct terminology. I have two signals, and I want to compare them to see how much the 2nd matches the first (coh), how much the 2nd lags behind the 1st (phase)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Normalized &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;cross-correlations&lt;/a&gt; are good at that.  I don't know what the relevant command would be in Statistica, but in Matlab you would use the command &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/xcorr.html&quot; rel=&quot;nofollow&quot;&gt;xcorr&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;and the extent to which the 2nd is under/overshooting the peak amplitudes of the 1st.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To answer that in a useful way it would help a great deal to see the signals that you are talking about.  Are you just interested in the peaks, or the signal in general?  If you are talking about the signal in general then you could time-align the signals using the information from your cross-correlation, and then divide one of the signals by the other.  If you are just interested in the peaks you could do the same and then just extract the results at the peak locations.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-04-10T16:55:28.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2006" PostTypeId="2" ParentId="1958" CreationDate="2012-04-10T17:37:06.120" Score="11" Body="&lt;p&gt;Firstly, Matlab has a &lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/ref/hough.html&quot;&gt;Built in Hough Transform&lt;/a&gt;: no need to reinvent the wheel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[H,T,R] = hough(BW,'RhoResolution',0.5,'Theta',-90:0.5:89.5);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although your image doesn't necessarily require edge detection you could improve the processing time and effectiveness of the algorithm my using it. Your triangle has fat regions of white and black. Ideally, the triangle would be 1px thick marking the edges of the triangle. Use Canny Edge Detection&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BW = edge(Image,'canny');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the result is \theta is in the range $-90 &amp;lt; \theta &amp;lt; 90$ degrees while your plot is $0 &amp;lt; \theta &amp;lt; 180$ (or $0 &amp;lt; \theta &amp;lt; \pi$) so subtract $90$ degrees ($\pi/2$) .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is the potential for you to choose the wrong peak because there are neighboring peaks that may be larger in the accumulator matrix. While there are many algorithms here is one that I've seen used in Hough Transforms in the past:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Define a region shape (typically its square) &#xA;2) Define an accumulator threshold  &#xA;3) Select one pixel in the accumulator matrix&#xA;4) If it is a peak (i.e., larger than neighboring values above a threshold)&#xA;       a) look at the points within the region shape.&#xA;       b) If there is a larger value&#xA;              this is not a peak&#xA;          Else&#xA;              this is a peak&#xA; 5) Move to next pixel in accumulator matrix.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Look into HoughLines for displaying the hough transform lines, results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/ref/houghlines.html&quot;&gt;http://www.mathworks.com/help/toolbox/images/ref/houghlines.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Effects of Using Canny Edge Detector&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edge Detection can potentially turn each side of the triangle into two lines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of canny edge detection is to produce maximally thin/narrow edges by using &lt;strong&gt;nonmaximal supression&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Canny Edge Detection in a Nutshell (Source: Digital Image Processing, Gonazalez) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Smooth input Image using a Gaussian Filter&#xA;2) Compute the Gradient magnitude and angle (Sobel, Perwitt or robert cross filters)&#xA;3) Apply Nonmaxima suppression (this is where the thinning happens) &#xA;   a) Figure out which direction the edge is&#xA;   b) If the edge's magnitude is smaller than one of its two neighbors in the direction of the edge&#xA;          set the edge point to zero&#xA;      Else&#xA;          leave it alone&#xA;4) Use double thresholding and connectivity analysis to detect and link edges&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1183" LastEditorUserId="1183" LastEditDate="2012-06-22T12:47:58.177" LastActivityDate="2012-06-22T12:47:58.177" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2007" PostTypeId="2" ParentId="1958" CreationDate="2012-04-10T18:28:37.620" Score="3" Body="&lt;pre&gt;&lt;code&gt;    if image(xi, yj) == 1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;needs to be changed to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if image(yj, xi) == 1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for the lines to work out in the dehough&lt;/p&gt;&#xA;" OwnerUserId="1156" LastActivityDate="2012-04-10T18:28:37.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2008" PostTypeId="1" CreationDate="2012-04-11T00:48:20.470" Score="4" ViewCount="136" Body="&lt;p&gt;I have a project on my university. I have to localize from video where are shoulders of person in movie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do have any advise how to get to this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about corner detection or some kind of shape detection. But I'm still not sure what next. We can treat video like image sequence (I wrote this, but I think is obvious)&lt;/p&gt;&#xA;" OwnerUserId="1218" LastActivityDate="2012-04-11T15:41:01.907" Title="How to get to shoulders localization on image photo?" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="1" ClosedDate="2012-06-04T16:09:29.783" ContentLicense="CC BY-SA 3.0" />
  <row Id="2010" PostTypeId="1" CreationDate="2012-04-11T10:40:48.833" Score="51" ViewCount="17795" Body="&lt;p&gt;I am trying to design a cloth that, from the point of view of a camera, is very difficult to compress with JPG, resulting in big-size files (or leading to low image quality if file size is fixed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It must work even if the cloth is far away from the camera, or rotated (let's say the scale can vary from 1x to 10x).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://theory.uchicago.edu/~ejm/pix/20d/tests/noise/1000thsec-nopatrnsubtr-altcrop.gif&quot; rel=&quot;noreferrer&quot;&gt;Noise&lt;/a&gt;&lt;/b&gt; is quite good (hard to compress), but it becomes grey when looking from far, becoming easy to compress. A good pattern would be kind of &lt;a href=&quot;http://en.wikipedia.org/wiki/Fractal&quot; rel=&quot;noreferrer&quot;&gt;fractal&lt;/a&gt;, looking similar at all scales.&lt;br&gt;&#xA;&lt;b&gt;&lt;a href=&quot;http://taojoe.com/blog/wp-content/uploads/2010/09/Foliage51.jpg&quot; rel=&quot;noreferrer&quot;&gt;Foliage&lt;/a&gt;&lt;/b&gt; is better (leaves, tiny branches, small branches, big branches), but it uses too few colors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a first try:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JZkIR.jpg&quot; alt=&quot;Most uncompressible&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure there are more optimum patterns.&lt;br&gt;&#xA;Maybe hexagon or triangle &lt;a href=&quot;http://en.wikipedia.org/wiki/Tessellation&quot; rel=&quot;noreferrer&quot;&gt;tessellations&lt;/a&gt; would perform better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;JPG uses the &lt;a href=&quot;http://en.wikipedia.org/wiki/YCbCr&quot; rel=&quot;noreferrer&quot;&gt;Y′ Cb Cr color space&lt;/a&gt;, I think Cb Cr can be generated in a similar way, but I guess it's better to not use uniformly the full scope of Y' (brightness) since camera will saturate the bright or dark areas (lighting is never perfect).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;QUESTION:&lt;/b&gt; What is the optimum cloth pattern for this problem?&lt;/p&gt;&#xA;" OwnerUserId="1220" LastEditorUserId="1220" LastEditDate="2015-09-24T11:35:59.987" LastActivityDate="2018-11-10T04:31:34.660" Title="What is the least JPG-compressible pattern? (camera shooting piece of cloth, scale/angle/lighting may vary)" Tags="|image-compression|jpeg|" AnswerCount="10" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2011" PostTypeId="2" ParentId="2010" CreationDate="2012-04-11T11:12:37.687" Score="5" Body="&lt;p&gt;My guess is that the worst compressible pattern would be white noise (with uniform distribution). It needs to look noisy on different resolutions, so you may create the noisy images in scale space and than put them together:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I=\sum_{i}^{n}N_{i}*G_{i}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $I$ is the final cloth image, $N_{i}$ is the image filled with white noise (different for every $i$) and $G_{i}$ is gaussian kernel of size $i\sigma$. The $*$ denotes convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a better way to construct such image would be to work directly in frequency domain, thus:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create an image filled with white noise.&lt;/li&gt;&#xA;&lt;li&gt;Perform 8x8 block IDCT (Inverse Discrete Cosine Transform) on the image.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The result would be worst compressible pattern for JPEG, as it has highest entropy in the DCT domain. But I am not sure how this will behave under varying resolutions.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-04-11T11:12:37.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2012" PostTypeId="2" ParentId="2010" CreationDate="2012-04-11T11:25:00.853" Score="11" Body="&lt;p&gt;There is a difference between JPEG exploitable and Transform Compressible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the white grainy noise of TV set for example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A general white noise is spread maximum in the frequency and hence there is no better example than white noise that any transform domain coding technique cannot compress. If you take such noise and take DCT (or DFT if required) we shall find that the frequency domain is also wide spread and all co-efficients will have importance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, still no one stops you from being aggressive from quantization. This way, you can still discard heavy amount from the high frequency regions. The result will have heavy Mean-Square-error. However, perceptually it would still be noise. It might be heavily blurred though. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, now take images where there are sharp edges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sharp edges will also have spread in the higher frequency (but may be it might just be little less than the former case). However, in trying to compress it and dropping of high frequency, now there will be sever impediments visually. It will introduce blurring of edges, ringing effect etc. While the bandwidth spread for such images is not the highest possible, For JPEG or any such equivalent compression, keeping such images perceptually equal quality will be tough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any lossy compression, tough and simple depends on how much and what type of distortion is tolerated.&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-04-11T11:25:00.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2013" PostTypeId="1" AcceptedAnswerId="2019" CreationDate="2012-04-11T13:18:32.237" Score="9" ViewCount="1077" Body="&lt;p&gt;I am developing a vision application that is using the color chart below and camera to extract color of each patch in the chart. In order to do that, I have to first detect the chart area in an image and match the area with existing template which contains locations of patches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: I need to detect the color patch area by recognizing four corners of the chart. You can see the corners that the small inset rectangles indicate in the image below. I know one way to go about it is to let user to select those corners by clicking it. But is there any way to automatically detect four corners from the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ieWKd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1011" LastEditorUserId="440" LastEditDate="2012-04-12T10:02:16.507" LastActivityDate="2012-04-12T10:02:16.507" Title="How to recognize colors from the color chart?" Tags="|image-processing|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2014" PostTypeId="2" ParentId="2010" CreationDate="2012-04-11T14:29:12.090" Score="16" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Noise is quite good (hard to compress), but it becomes grey when looking from far, becoming easy to compress. A good pattern would be kind of fractal, looking similar at all scales.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, there is &lt;a href=&quot;https://www.google.com/search?tbm=isch&amp;amp;hl=en&amp;amp;source=hp&amp;amp;biw=1020&amp;amp;bih=573&amp;amp;q=fractal+noise&amp;amp;gbv=2&amp;amp;oq=fractal+noise&amp;amp;aq=f&quot; rel=&quot;noreferrer&quot;&gt;fractal noise&lt;/a&gt;.  I think &lt;a href=&quot;https://en.wikipedia.org/wiki/Brownian_noise&quot; rel=&quot;noreferrer&quot;&gt;Brownian noise&lt;/a&gt; is fractal, looking the same as you zoom into it.  Wikipedia talks about adding &lt;a href=&quot;https://en.wikipedia.org/wiki/Perlin_noise&quot; rel=&quot;noreferrer&quot;&gt;Perlin noise&lt;/a&gt; to itself at different scales to produce fractal noise, which is maybe identical, I'm not sure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vLC31.png&quot; alt=&quot;Perlin fractal noise&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think this would be hard to compress, though.  Noise &lt;em&gt;is&lt;/em&gt; hard for lossless compression, but JPEG is lossy, so it's just going to throw away the detail instead of struggling with it.  I'm not sure if it's possible to make something &quot;hard for JPEG to compress&quot; since it will just ignore anything that's too hard to compress at that quality level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something with hard edges at any scale would probably be better, like the infinite checkerboard plane:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cQDY7.png&quot; alt=&quot;infinite checkerboard plane&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also something with lots of colors.  Maybe look at actual fractals instead of fractal noise.  Maybe a &lt;a href=&quot;http://www.algorithmic-worlds.net/blog/blog.php?Post=20110201&quot; rel=&quot;noreferrer&quot;&gt;Mondrian fractal&lt;/a&gt;?  :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YG0o3.jpg&quot; alt=&quot;Mondrian fractal&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-04-11T14:37:34.077" LastActivityDate="2012-04-11T14:37:34.077" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2015" PostTypeId="2" ParentId="2010" CreationDate="2012-04-11T14:33:26.407" Score="13" Body="&lt;p&gt;If we were talking about computer-generated images, noise would be the right approach. But here, there is the camera capture step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;fractal&lt;/em&gt; bit is very important because of the scale invariance issue. It doesn't have to be truly fractal, though, if you consider there's a limited distance range at which the person is going to be photographed. I mean, if the person wearing the cloth is in the background of a picture, it won't have much impact anyway...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the best way to trick the JPEG encoder would be to have blocks with very high high-frequency coefficients that will survive quantization = a lot of details and sharp edges ; so the whole coefficient sequence has to be explicitly written (instead of an EOB at the 15th coefficient or so). Checkerboard pattern are a good way of achieving that. The only downside I see is that the low-resolution of the lens + the camera antialiasing filters have a good chance of blurring that! Everything should happen within 8x8 blocks (or 16x16 blocks chroma-wise) because JPEG doesn't do much at the macro scale. You have to make your 8x8 blocks as messy as possible, no matter how blurry the lens is going to make them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a suggestion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/47JeY.jpg&quot; alt=&quot;scale-invariant, hard to JPEG-compress pattern&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might wonder what the less contrasted blocks are doing here, but they are helping keeping contrasted zone when the thing is zoomed out. The challenge here is to have something with a contrasted pattern no matter the viewing scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not formally evaluated this. The best way would be to have a script that takes the image, applies a dozen of crop/resize/blurs with various parameters, and spits the total size of the JPEGs.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-04-11T14:33:26.407" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2016" PostTypeId="2" ParentId="2000" CreationDate="2012-04-11T14:50:46.160" Score="3" Body="&lt;p&gt;In Hyperspectral imaging linear regression is often used for target identification.&lt;/p&gt;&#xA;" OwnerUserId="703" LastActivityDate="2012-04-11T14:50:46.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2017" PostTypeId="2" ParentId="2013" CreationDate="2012-04-11T15:38:46.213" Score="0" Body="&lt;p&gt;Why not look for the boundaries of the chart, instead of corners?  You can try using an edge detector and then finding straight lines using the Hough Transform. &lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-04-11T15:38:46.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2018" PostTypeId="2" ParentId="2008" CreationDate="2012-04-11T15:41:01.907" Score="3" Body="&lt;p&gt;Are there just shoulders in the video, or is there a head attached to them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is the latter, then you can use vision.CascadeObjectDetector from the Computer Vision System Toolbox for Matlab.  It has the &quot;upper body&quot; mode, which effectively detects head and shoulders.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-04-11T15:41:01.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2019" PostTypeId="2" ParentId="2013" CreationDate="2012-04-11T16:52:34.687" Score="4" Body="&lt;p&gt;You can house hough lines to detect the color area&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First detect all lines&lt;/li&gt;&#xA;&lt;li&gt;Lines with longest length would be the outer most ones&lt;/li&gt;&#xA;&lt;li&gt;Pick the top horizontal line and do template match for the squares.&lt;/li&gt;&#xA;&lt;li&gt;Once you find the squares, traverse downwards toll you reach the other set of squares.&lt;/li&gt;&#xA;&lt;li&gt;Mark all points where the squares were found&lt;/li&gt;&#xA;&lt;li&gt;You now have an enclosing area for the color chart.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1215" LastActivityDate="2012-04-11T16:52:34.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2020" PostTypeId="2" ParentId="2013" CreationDate="2012-04-11T19:16:01.540" Score="2" Body="&lt;p&gt;Each 2D array of a color component (RGB, et.al.) is fairly high contrast and distinctive.  So I might try using a complex 2D FFT of each color component to determine the scale and offset of the photo image versus that of a reference image.  Then use those to adjust the measured/known coordinates of the corners and/or patches in the reference image to produce coordinates in the photo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might have to first hand measure some coordinates on a reference image using a bitmap editor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-04-11T19:16:01.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2021" PostTypeId="2" ParentId="948" CreationDate="2012-04-11T20:00:04.997" Score="6" Body="&lt;p&gt;&lt;strong&gt;Effects of Averaging&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a moving average filter will smooth out the irregularities in the signal. The noise becomes E/N where N is the length of the moving average filter. The side effect of using a MA is that the signal peaks become wider and shallower. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, the frequency content of the signal will change. A moving average filter in the time domain is the same thing as convolving the frequency domain signal by a sinc function everything gets smudged out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Peak Detection Algorithm&lt;/strong&gt;&#xA;Peak detection is a common problem in 9/10 engineering problems. (not really, but a TON depend on them)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically this is what is done:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Median Thresholding&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Look for all peaks in your signal. (i.e., a point that is larger than the two&#xA;   adjacent points&#xA;2) take this list of points and for each one of them compute:&#xA;   med_threshold = median(Peak,Width) + constantThresholmedian   where median is the&#xA;   median value of the data centered at &quot;Peak&quot; with Width being the number of &#xA;   points to look at.&#xA;       a) The Width(usually written as Lambda in literature) and constantThreshold&#xA;          (usually written as C) are determined by trial and error and using the ROC&#xA;          curve (Acronym below)&#xA;3) if the peak's magnitude is above this threshold accept it as a true peak. &#xA;   Else: Discard it, its a false peak&#xA;4) Generate a Receiver Operating Characteristic Curve(ROC) to how well the algorithm&#xA;   is performing.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;suppose we have the signal X = [ 0 0 0 0 1 3 **9** 2 1 1 **2** 1 1 ] &#xA;1) 9 and 2 are both potential peaks &#xA;2) Lets use a window of 5 and  a threshold =2&#xA;so at 9 we have [1 3 9 1 2] -&amp;gt; [1 1 2 3 9]  so Median(9,5) = 2&#xA;9 &amp;gt; 2 +2, therefor its a peak&#xA;Lets take a look at 2: [ 1 1 2 1 1] -&amp;gt; [1 1 1 1 2 ] Median(2,5) = 1&#xA;2 &amp;lt; 1+2, therefor it is NOT a peak. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Determining Frequency&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that You've effectively found the time localization of the peak try to find their frequency:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Use the locations of the peaks to generate a pulse train&#xA;      a) this means create sum(Dirac_delta[t-L(n)]) where L(n) is the nth time that &#xA;      you've localized through median thresholding&#xA;2) Apply FFT Algorithm&#xA;3) Look for largest peak. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Alternate Frequency Estimation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Think of this like a beat in a piece of music (I learned about thresholding by&#xA;   researching Onset Detection.&#xA;2) Compute the average time distance between detected peaks.&#xA;3) now call your results BPM or PPM (pulses per minute) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Additional Avenues of Research&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you may be satisfied by the peaked signal as is, there are algorithms that are applied to a whole different beast of problems called Onset Detection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Onset Detection is a big area in Music Information Retrieval Research. Its used to determine when a note is being played. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MpxbI.png&quot; alt=&quot;Music Sample of an Onset&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think of your tape head signal as a highly sampled signal, you can apply many of the algorithms that you would find in this paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.elec.qmul.ac.uk/people/juan/Documents/Bello-TSAP-2005.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.elec.qmul.ac.uk/people/juan/Documents/Bello-TSAP-2005.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1183" LastEditorUserId="1183" LastEditDate="2012-04-13T12:53:42.443" LastActivityDate="2012-04-13T12:53:42.443" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2022" PostTypeId="2" ParentId="1966" CreationDate="2012-04-11T21:26:51.357" Score="2" Body="&lt;p&gt;If you do not care about how to arrive at the answer, do not need to update the filter coefficients continuously, and have access to Matlab, then you can use the tf2sos command.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[sos,gain] = tf2sos(b,a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...will give you the output in Hilmar's answer.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="1024" LastEditDate="2012-04-11T21:43:51.380" LastActivityDate="2012-04-11T21:43:51.380" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2023" PostTypeId="2" ParentId="1939" CreationDate="2012-04-11T21:38:23.930" Score="0" Body="&lt;p&gt;I am a big fan of Canny edge detectors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Canny_edge_detector&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Canny_edge_detector&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have a lot of nice features, are easy to implement and are also easy to parameterise to perform how you want them to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, convolve your frequncy domain signall with the first order differential of a gaussian to transform your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matlab, this would be as simple as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = filtfilt(   diff( gausswin(69) ), 1, x  )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...if x is your input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may find the output from this process easier to work with, particularly if you are interested in identifying a localised peak in noise. Not only is the output a smoothed version of the input, but large peaks supress surrounding peaks in a way that may improve the contrast between your signal and noise, possibly allowing your classifier to make a more robust descision as to whethere a peak is present or not.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="1024" LastEditDate="2012-04-11T22:06:20.447" LastActivityDate="2012-04-11T22:06:20.447" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2024" PostTypeId="2" ParentId="2010" CreationDate="2012-04-11T21:50:26.880" Score="5" Body="&lt;p&gt;IIRC, the JPEG decompression algorithm is specified, however the exact compression algorithm is not.  Different algorithms can produce a legal JPEG file.  So you will need to test this on your chosen image compressor(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything can be compressed by the same amount by a lossy compressor, such as JPEG.  It's just that, at any fixed compression level, the quality of the compression might vary (the noise or error in the decompressed result will increase) depending on the image .  So you want something that adds a maximum amount of noise to the decompressed result.  For this, you want the maximum error for removing high frequency macroblock coefficients and for quantizing any coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which probably mean varying and high frequency pickets, as well as varying grey and color scales that happen to be between possible quantization levels of the given compressor at some given setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you want this to work at any distance in any lighting, you will need to vary the frequency of the pickets (perhaps fractal, or perhaps just ramped with random frequency modulation) and the color and gray levels (non-coherently, e.g. vary the colors and the levels independantly).  The hues variance will less depend on the distance, so those just need to be picked to be worse case for your selected quantizer(s).  The average size of the color patterns can be twice the size of the luminance patterns to match the 4:1:1(area) YUV macroblock composition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would start with a bunch of highly colored &lt;a href=&quot;http://en.wikipedia.org/wiki/Moir%C3%A9_pattern&quot;&gt;Moire patterns&lt;/a&gt; at wildly varying scales overlayed and/or patched together fractally.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="1220" LastEditDate="2012-04-12T00:37:55.360" LastActivityDate="2012-04-12T00:37:55.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2025" PostTypeId="2" ParentId="1949" CreationDate="2012-04-12T03:14:28.897" Score="14" Body="&lt;p&gt;@NickS&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is far from certain that the second signal in the plots is in fact a &lt;em&gt;solely&lt;/em&gt; delayed version of the first, other methods besides the classical cross-correlation have to be attempted. This is because the cross-correlation (CC) is merely a maximum likelihood estimator if your signal(s) are delayed versions of each other. In this case, they are clearly not, to say nothing about the non-stationarity of them either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, I believe what may work is a time-estimation of the &lt;em&gt;significant energy&lt;/em&gt; of the signals. Granted, 'significant' can or cant be somewhat subjective, but I believe that by looking at your signals from a statistical point of view, we will be able to quantify 'significant' and go from there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To this end, I did the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STEP 1: Compute the signal envelopes: &lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This step is simple, as the absolute value of output of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;noreferrer&quot;&gt;Hilbert-Transform&lt;/a&gt; of each of your signals is computed. There are other methods to compute envelopes, but this is pretty straight forward. This method essentially computes the analytical form of your signal, in other words, the phasor representation. When you take the absolute value, you are destroying phase and only after energy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore since we are pursuing a time-delay-estimate of the energy of your signals, this approach is warranted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0XSRZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STEP 2: De-noise with edge-preserving non-linear Medial Filters: &lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an important step. The objective here is to smooth out your energy envelopes, but &lt;em&gt;without&lt;/em&gt; destruction or smoothing out your edges and fast rise times. There is actually an entire field devoted to this, but for our purposes here, we can simply use an easy to implement non-linear &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;noreferrer&quot;&gt;Medial filter&lt;/a&gt;. (Median Filtering). This is a powerful technique because unlike &lt;em&gt;mean&lt;/em&gt; filtering, &lt;em&gt;medial&lt;/em&gt; filtering will not null out your edges, but at the same time 'smooth' out your signal without significant degradation of the important edges, since at no time is any arithmetic being performed on your signal (provided the window length is odd). For our case here, I selected a medial filter of window size 25 samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rynY3.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STEP 3: Remove Time: Construct Gaussian Kernel Density Estimation Functions: &lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would occur if you looked at the above plot sideways instead of the normal way? Mathematically speaking, that means, what would you get if you projected every sample of our denoised signals onto the y-amplitude-axis? In doing this we will manage to remove time so to speak, and be able to study the signal statistics solely. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively what pops out of the figure above? While noise energy is low, it has the advantage that it is more 'popular'. In contrast, while the signal envelope that has energy is more energetic than the noise, it is fragmented across thresholds. What if we considered the 'popularity' as a measure of energy? This is what we will do with (my crude) implementation of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_density_estimation&quot; rel=&quot;noreferrer&quot;&gt;Kernel Density Function&lt;/a&gt;, (KDE), with a Gaussian Kernel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, every sample is taken and a gaussian function constructed using its value as a mean, and a pre-set bandwidth (variance) selected a-priori. Setting the variance of your gaussian is an important parameter, but you can set it based on noise statistics based on your application and typical signals. (I only have your 2 files to go off on). If we then construct the KDE Estimation, we get the following plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D8bYI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of the KDE as a continuous form of a histogram so to speak, and the variance as your bin-width. However it has the advantage of guaranteeing a smooth PDF that we can then perform first and second derivitave calculus on. Now that we have the Gaussian KDEs, we can see where the noise samples peak in popularity. Remember that the x-axis here represents  the projections of our data onto the amplitude space. Thus, we can see which thresholds the noise is the most 'energetic' in, and those tell us which thresholds to avoid. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second plot, the first-derivative of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Normal_distribution&quot; rel=&quot;noreferrer&quot;&gt;Gaussian&lt;/a&gt; KDEs is taken, and we pick the abscissa of the first sample after first-derivative &lt;em&gt;after&lt;/em&gt; the peak of the mixture of Gaussians to attain a certain value close to zero. (Or first zero-crossing). We can use this method and be 'safe' because our KDE was constructed of smooth Gaussians of reasonable bandwidth, and the first derivative of this smooth and noise-less function was taken. (Typically first-derivatives can be problematic in anything but high SNR signals since they magnify noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The black lines show then at what thresholds we would be wise to 'segment' the image at, such that we avoid the entire noise floor. If we then apply to our original signals, we attain the following plots, with the black lines indicating the start of energy of our signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yUhs5.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This thus yields a $\delta{t} = 241$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helped.&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-04-12T03:14:28.897" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2026" PostTypeId="2" ParentId="1983" CreationDate="2012-04-12T04:01:34.587" Score="2" Body="&lt;p&gt;&lt;strong&gt;1. Classify whether you need low MIPS or low complexity overall&lt;/strong&gt;&lt;br&gt;&#xA;Let me take a small liberty to split this problem in two parts. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Low complexity encoding - which allows lower resources (specially in memory) to make it quick responding encoding in the given system. &lt;/li&gt;&#xA;&lt;li&gt;Low explicit in computation (MIPS). - which only concerned with minimum possible CPU cycles. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There is third criteria - where in people talk about &quot;Low latency&quot; - for application like Video conferencing where computational resource might not be of concern -but overall delay introduced by coded &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is important to note that in lower complexity systems - access to memory (memory bus speed and width) and sometimes IO are generally extremely slower which is why MPEG class of algorithms suffer even though the computationally algorithm could be simple. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before you make judgement about the requirement for codec - you should try to make budget in terms of -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. CPU cycles per second.&lt;br&gt;&#xA;b. Maximum memory through put.&lt;br&gt;&#xA;c. IO latency  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. You should customize MPEG rather than re-invent&lt;/strong&gt;&lt;br&gt;&#xA;In general - MPEG class of codecs gives you a very flexible mechanisms to do this. In that sense, you don't quite have to re-invent the codec as much as you would rather &lt;em&gt;customize&lt;/em&gt; MPEG 2 or MPEG 4 to get your work done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, let's say what all elements make compression possible and arrange them in the order of complexity:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Motion Estimation and Motion Compensation.&#xA;1.a. Forward prediction (P frames) &#xA;1.b. Double prediction (B frames)&#xA;1.c. high resolution motion vectors&lt;/li&gt;&#xA;&lt;li&gt;Intra coding - DCT (+ IDCT) &lt;/li&gt;&#xA;&lt;li&gt;Qunatization - and encoder mode selection &lt;/li&gt;&#xA;&lt;li&gt;VLC - variable length coding. (CABAC in H.264)&lt;/li&gt;&#xA;&lt;li&gt;Co-efficient prediction [ In mpeg2 only DC prediction- MPEG4 has more] &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In MPEG class of algorithms, the DCT based encoding and VLC becomes pretty much compulsory without much choice - but rest of all mechanisms are very essential &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, Motion estimation and motion compensation is one of the highest MIPS consuming element. If you don't have resources to do this - you can simply encode all frames as I frames (which makes it pretty much like MJPEG - but standard MPEG decoder can decode this). If you can afford slightly more resources - you can make trivial motion compensation using Frame difference - instead of sending every frame as Intra, you can subtract every blcok from it's previous frame block; if the difference is higher than original signal send it as Intra. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course - all this would mean that you will loose some efficiency promised by above encoder - but i think you are willing to give up that! &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;br&gt;&#xA;You can look at the following codecs as good reference points:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;MSSG: &lt;a href=&quot;http://www.mpeg.org/MPEG/video/mssg-free-mpeg-software.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mpeg.org/MPEG/video/mssg-free-mpeg-software.html&lt;/a&gt;&lt;br&gt;&#xA;Good for understanding but might be next to slowest in the world.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;FFMPEG: &lt;a href=&quot;http://ffmpeg.org/&quot; rel=&quot;nofollow&quot;&gt;http://ffmpeg.org/&lt;/a&gt;&#xA;Probably the fastest on the earth. Good to start as black box but don't try to change the code from inside. Might give you good options to control stuff when you use library API. It is already ported in many platforms - but doing it on a new one might be some task. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;FAME: &lt;a href=&quot;http://fame.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;http://fame.sourceforge.net/&lt;/a&gt;&#xA;This was originally started with purpose same you described. Though, i am a bit out of touch of this - but you can try this.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Xvid: &lt;a href=&quot;http://www.xvid.org/&quot; rel=&quot;nofollow&quot;&gt;http://www.xvid.org/&lt;/a&gt;&#xA;This is MPEG-4. This is one of the best balance between clean code and reasonable speed. Should be easiest to work with if you endup dwelling inside of the encoder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;JPEG: &lt;a href=&quot;http://www.ijg.org/&quot; rel=&quot;nofollow&quot;&gt;http://www.ijg.org/&lt;/a&gt;&#xA;This is JPEG. This is one of the best libraries to port it across platforms. Also, JPEG is inherently simpler than some aspects of MPEG - so may be you should try this first. Most camera's in the world has probably used this library as is - rather than creating something its own!  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;May be i am wrong in using MPEG! But that's a kind of risk worth taking. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably best measure to check if that will work or not is - just try to take a standard 8x8 DCT with quantization on your image; optimize just this. If you are able to reach close to your real time requirement, than i think you are good to do about all All JPEG frames or all I frame MPEG codec. If you are way off the target - than it is not worth it. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-04-12T09:23:51.097" LastActivityDate="2012-04-12T09:23:51.097" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2027" PostTypeId="2" ParentId="1654" CreationDate="2012-04-12T06:14:04.713" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://oops.uni-oldenburg.de/1195/1/viotow11.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; [PDF] is a doctoral thesis that explains how to do it (go to section 5.3.7. (AEP quality))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from the paper: &quot;Traditionally the SNR is defined as the power of the signal at a peak latency of interest divided by the mean power of the activity in the baseline period&quot;&lt;/p&gt;&#xA;" OwnerUserId="1224" LastEditorUserId="27537" LastEditDate="2017-03-27T10:59:13.093" LastActivityDate="2017-03-27T10:59:13.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2028" PostTypeId="2" ParentId="2013" CreationDate="2012-04-12T10:01:26.853" Score="1" Body="&lt;p&gt;As a first step - i would remove all the clutter with gray and text. Starting from all four sides i will stop till majority of the pixels are of uniquely known &quot;gray&quot; color. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will leave you with only the checker board consisting of different colors. You expect about 22x12 - about 264 colors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simplest method would be to apply simpler palatalization algorithm. If you would have to translate this in a GIF image - it applies color quantization with each cluster of color represented as the centroid color. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be specifically easy in your case because the source is already a palate of some kind and you can make a good decent guess to start. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check this out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NeuQuant: &lt;a href=&quot;http://members.ozemail.com.au/~dekker/NEUQUANT.HTML&quot; rel=&quot;nofollow&quot;&gt;http://members.ozemail.com.au/~dekker/NEUQUANT.HTML&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Octree Color Quantization: &lt;a href=&quot;http://www.cubic.org/docs/octree.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.cubic.org/docs/octree.htm&lt;/a&gt;. See &lt;a href=&quot;http://www.drdobbs.com/article/print?articleId=184409805&amp;amp;siteSectionName=&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are only some references; but you will find ready to use code in most libraries that use such image formats. (BMP, PNG, and GIF supports such representations). Also check out &lt;a href=&quot;http://www.libpng.org/pub/png/libpng.html&quot; rel=&quot;nofollow&quot;&gt;libpng&lt;/a&gt; and &lt;a href=&quot;http://www.ijg.org/&quot; rel=&quot;nofollow&quot;&gt;libjpeg&lt;/a&gt; for some quick implementations. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-04-12T10:01:26.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2031" PostTypeId="1" CreationDate="2012-04-12T16:32:41.950" Score="5" ViewCount="102" Body="&lt;p&gt;I have a question concerning the deformation of objects in photos. Which deformations can an object depicted on a photo undergo through viewpoint and condition changes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some deformations I have in mind are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;rotation&lt;/li&gt;&#xA;&lt;li&gt;scale&lt;/li&gt;&#xA;&lt;li&gt;shearing&lt;/li&gt;&#xA;&lt;li&gt;translation&lt;/li&gt;&#xA;&lt;li&gt;illumination&lt;/li&gt;&#xA;&lt;li&gt;occlusion&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Which deformations did I forget?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best!&lt;/p&gt;&#xA;" OwnerUserId="969" LastActivityDate="2012-04-13T10:14:23.830" Title="Viewpoint dependant deformation of objects in photos" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2032" PostTypeId="5" CreationDate="2012-04-12T17:55:29.293" Score="0" Body="&lt;p&gt;Video processing techniques are used in television sets, VCRs, DVDs, video codecs, video players, video scalers and other devices. Many video processing algorithms include filtering and enhancements, color conversion, motion analysis, video stabilization, video mosaicking, and processing related to compression of video. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-04-12T17:56:30.990" LastActivityDate="2012-04-12T17:56:30.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2033" PostTypeId="4" CreationDate="2012-04-12T17:55:29.293" Score="0" Body="Algorithms for processing video signals i.e. sequence of images either for enhancements, conversions or analysis of objects within it." OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-04-12T17:56:33.860" LastActivityDate="2012-04-12T17:56:33.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2034" PostTypeId="5" CreationDate="2012-04-12T18:20:21.807" Score="0" Body="&lt;p&gt;Questions related to design, implementation and numerical optimization of various algorithms including audio, image processing, filtering, computer vision, statistics. &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-04-12T20:17:21.187" LastActivityDate="2012-04-12T20:17:21.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2035" PostTypeId="4" CreationDate="2012-04-12T18:20:21.807" Score="0" Body="Questions related to implementation of various algorithms under software environments and programming languages. " OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-04-12T20:17:23.810" LastActivityDate="2012-04-12T20:17:23.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2036" PostTypeId="2" ParentId="2031" CreationDate="2012-04-12T18:46:18.980" Score="5" Body="&lt;p&gt;Since you have listed &quot;illumination&quot;, I am assuming that &quot;condition changes&quot; include changes in lighting.  So I would add cast shadows, which will change if you move the light source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, all the geometric transformations you have listed are affine. But if you move the camera perspective changes as well. So you may want to consider the projective transformation.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-04-12T18:46:18.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2037" PostTypeId="1" AcceptedAnswerId="2044" CreationDate="2012-04-12T19:49:21.613" Score="13" ViewCount="1687" Body="&lt;p&gt;Well, this may show I didn't take image processing class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this template to match an object in images. But real object in images, for example, does not look like that but the second image. What operations do I need to take for the images like the second one to be ready for template matching? FYI, the third image shows a ideal matching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In another idea, I fit the template to the image. That is, I give four corner coordinates on the image to match those in the template. Then it will compute a way to fit the template to the area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE: Problem solved.&lt;/strong&gt; Thanks to the answer I selected below. I successfully managed to apply my template on the image. The last image shows the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FUDRR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sCdNU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QniYl.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/N4JM9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1011" LastEditorUserId="1011" LastEditDate="2012-04-13T20:23:06.600" LastActivityDate="2012-04-13T20:23:06.600" Title="Necessary image processing operations before template matching" Tags="|image-processing|template-matching|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2038" PostTypeId="2" ParentId="2031" CreationDate="2012-04-13T10:14:23.830" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Noise, Filtering or any processing? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Cropping &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Color conversions and brightness &amp;amp; contrast changes (inline with illumination but these are linear transformation). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;smearing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Flip or mirroring (not sure if this is possible)  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Gamma corrections, if related to devices? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any thing you can do with GIMP or Photoshop?! &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-04-13T10:14:23.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2039" PostTypeId="2" ParentId="2037" CreationDate="2012-04-13T13:09:37.107" Score="1" Body="&lt;p&gt;Start with edge detection.  Then use Hough transform to detect straight lines.  Then figure out which lines are parallel and  which ones should be perpendicular.  Then estimate the projective transformation so that the lines that should be perpendicular actually are perpendicular.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-04-13T13:09:37.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2041" PostTypeId="1" CreationDate="2012-04-13T14:18:42.320" Score="6" ViewCount="317" Body="&lt;p&gt;Suppose I have a real (physical) dynamical system with some sensors and actuators, and I also have an idealized state-space model of this same system.  How, in general, can I adjust the model to match the real system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My experience is with frequency-domain analysis.  My first reaction would be to measure swept-sine transfer functions, and to calculate parameters of my system from the location of resonances or poles in the measured data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better, more general technique for system identification in the state-space representation?&lt;/p&gt;&#xA;" OwnerUserId="64" LastActivityDate="2012-08-11T00:16:26.520" Title="State space system identification" Tags="|state-space|system-identification|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2042" PostTypeId="1" CreationDate="2012-04-13T14:41:48.797" Score="1" ViewCount="1057" Body="&lt;p&gt;I'm looking for an open source library to detect Human speech from an audio clip, such as a wav file. &lt;/p&gt;&#xA;" OwnerUserId="1233" LastEditorUserId="1324" LastEditDate="2013-02-26T15:19:44.963" LastActivityDate="2013-02-26T15:19:44.963" Title="How to Filter Human Speech from an Audio clip?" Tags="|algorithms|speech-recognition|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2044" PostTypeId="2" ParentId="2037" CreationDate="2012-04-13T17:57:53.737" Score="8" Body="&lt;p&gt;The sample image you posted has relatively strong perspective (it is not imaged straight from the direction of surface normal) which can cause problems with template matching techniques witch use block processing. I assume that you have to take the image with strong perspective so first thing we want to do is estimate image transformation which will remove the perspective projection and will result rectified image (&quot;straight image&quot;).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Correcting perspective projection when shape is known&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The ultimate goal of the preprocessing is to find corners of that gray rectangle which is the background the color chart. I started by simply thresholding with constant value. Literature/web has lots of information on how to do thresholding when the image has uneven lighting, but if you can, try to correct the imaging setup such that the lighting is relatively even.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UW503.png&quot; alt=&quot;Thresholded with constant value&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assumed that the color chart takes quite large portion of the screen, so the it is probably biggest continuous region of the image. There exist many black and white labeling functions (MATLABs bwlabel, IPPs LabelMarkers, OpenCV has external library cvblob) which will give each distinct connected region its own index. After the labeling you can calculate the areas of the connected components using a histogram and then choose the component with largest area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TF1P9.png&quot; alt=&quot;Find largest blob&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is usually good idea to fill the components such that component does not have holes, this reduces the number of edge pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hvo92.png&quot; alt=&quot;Fill the blob&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can use edge finding operators (I used gradient based method, but you can also trace the edge by following white pixels that are connected to black pixels) to get pixels belonging to the boarder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OXO2f.png&quot; alt=&quot;Find edges&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the object we are interested is rectangle, I fitted four lines to the edge pixels using robust line fitting (RANSAC). After finding new line, I removed all the points that were close to the found line, this forces subsequent fitting operations to return other edges of the object. Finally when all the edges were found, I computed all possible intersections between the set of lines. From the set of resulting points I removed all points outside of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we have the corners of the color chart and as we know the dimensions of the chart, we can calculate the transformation matrix $H$ (homography, projection between two planes. use direct linear transformation (DLT) to solve $H$) between the millimeter coordinates and the pixel coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{x} = H\textbf{X}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This transformation matrix can be then used to transform the original image such that color chart is imaged straight from the direction of the surface normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uBYxB.png&quot; alt=&quot;Fit lines to the edges&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As can be seen only radial distortion is left. When we used transformation $H$ for image transformation (2D interpolation), we chose the interpolation coordinates such, that the we know the precise resolution of the image, meaning that we now know for example the size of the letters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we still want to do some template matching, we can use any decent template matching method. The method does not have to be rotation/scale invariant as the image is already rectified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q1Qky.png&quot; alt=&quot;Correct perspective&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1203" LastActivityDate="2012-04-13T17:57:53.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2045" PostTypeId="1" AcceptedAnswerId="51118" CreationDate="2012-04-13T18:16:26.883" Score="20" ViewCount="12033" Body="&lt;p&gt;Ok, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;noreferrer&quot;&gt;spectral flatness&lt;/a&gt; (also called Wiener entropy) is defined as the ratio of the geometric mean of a spectrum to its arithmetic mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia and other references say the &lt;em&gt;power&lt;/em&gt; spectrum.  Isn't that the square of the Fourier transform?  The FFT produces an &quot;amplitude spectrum&quot; and then you square that to get a &quot;power spectrum&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically what I want to know is, if &lt;code&gt;spectrum = abs(fft(signal))&lt;/code&gt;, which of these is correct?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;spectral_flatness = gmean(spectrum)/mean(spectrum)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;spectral_flatness = gmean(spectrum^2)/mean(spectrum^2)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Wikipedia's definition seems to use the magnitude directly:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$&#xA;\mathrm{Flatness} = \frac{\sqrt[N]{\prod_{n=0}^{N-1}x(n)}}{\frac{\sum_{n=0}^{N-1}x(n)}{N}} = \frac{\exp\left(\frac{1}{N}\sum_{n=0}^{N-1} \ln x(n)\right)}{\frac{1}{N} \sum_{n=0}^{N-1}x(n)} &#xA;$$&#xA;  where $x(n)$ represents the magnitude of &lt;a href=&quot;/wiki/Histogram&quot; title=&quot;Histogram&quot;&gt;bin number $n$&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/routines.fft.html#implementation-details&quot; rel=&quot;noreferrer&quot;&gt;SciPy docs&lt;/a&gt; define power spectrum as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When the input a is a time-domain signal and &lt;code&gt;A = fft(a)&lt;/code&gt;, &lt;code&gt;np.abs(A)&lt;/code&gt; is its amplitude spectrum and &lt;code&gt;np.abs(A)**2&lt;/code&gt; is its power spectrum.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://crca.ucsd.edu/~syadegar/MasterThesis/node41.html&quot; rel=&quot;noreferrer&quot;&gt;This source&lt;/a&gt; agrees about the definition of &quot;power spectrum&quot; and calls it $S_{f}(\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We can define $F_{T}(\omega) $ which is the fourier transform of the signal in period T, and define the power spectrum as the following:&#xA;  $\displaystyle S_{f}(\omega) = \lim_{T \rightarrow \infty} \frac{1}{T}{\mid F_{T}(\omega)\mid}^2.$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://soundanalysispro.com/manual-1/chapter-4-the-song-features-of-sap2/wiener-entropy&quot; rel=&quot;noreferrer&quot;&gt;This source&lt;/a&gt; defines Wiener entropy in terms of $S(f)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't see the squaring in equations &lt;a href=&quot;http://yaafe.sourceforge.net/features.html#yaafefeatures.SpectralFlatness&quot; rel=&quot;noreferrer&quot;&gt;like this&lt;/a&gt;, which seems to be based on the &lt;a href=&quot;http://yaafe.sourceforge.net/features.html#yaafefeatures.MagnitudeSpectrum&quot; rel=&quot;noreferrer&quot;&gt;magnitude spectrum&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$&#xA;S_{flatness} = \frac{\exp\left(\frac{1}{N} \sum_k \log (a_k)\right)}{\frac{1}{N} \sum_k a_k}&#xA;$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Likewise, &lt;a href=&quot;http://books.google.com/books?id=qIMDvu3gJCQC&amp;amp;pg=PA169&amp;amp;dq=%22spectral%20flatness%22%20magnitude&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=tpOIT9CBDYnZiQLt5JHtBw&amp;amp;ved=0CGAQ6AEwCA#v=onepage&amp;amp;q=%22spectral%20flatness%22%20magnitude&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;another source&lt;/a&gt; defines the spectral flatness in terms of the power spectrum, but then uses the magnitude of the FFT bins directly, which would seem to conflict with the above definition of &quot;power spectrum&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does &quot;power spectrum&quot; mean different things to different people?&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="1629" LastEditDate="2016-06-14T01:15:18.387" LastActivityDate="2018-08-08T17:07:58.953" Title="How do you calculate spectral flatness from an FFT?" Tags="|fft|frequency-spectrum|power-spectral-density|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2046" PostTypeId="2" ParentId="729" CreationDate="2012-04-13T18:43:17.970" Score="5" Body="&lt;p&gt;Here are a few things that aren't right:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Regardless of the Carrier Synchronization:&#xA; You are using 0 and 90 degrees for your signaling. You would need an I and Q channel in order to decode the signal if that were the case. For BPSK (Binary) you should be using 0 and 180 degrees. Only if you are using QPSK should you use 90 and 270 degrees, then again its just mimicking using an I and Q channels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a system block diagram below that will make this more apparent. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) DPSK does not require any phase carrier synchronization. You pay for it by halving your SNR. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Encoding DQPSK&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(for BPSK, eliminate Q and sqrt(2)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I-inphase channel Bit values&#xA;Q-quadrature bit values&#xA;C = (I + J*Q)/sqrt(2); // recombined I and Q channels&#xA;for n = 0 to length( C )&#xA;    x_diff = x_diff(n-1) *C(n);  //where X(n) &amp;lt;0 == 0 &#xA;//X_diff is the differentially encoded channels&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Decoding DQPSK&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I - retrieved I channel &#xA;Q - retrieved Q channel &#xA;C =I + j*Q;&#xA;for n = 0 to length( C )&#xA;    decoded(n) =C(n)/decoded(n-1);  //where X(n) &amp;lt;0 == 0 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;4) &lt;strong&gt;You should never see a phase value because of thresholding at the sampler block&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transmitter Block Diagram&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4wfmG.png&quot; alt=&quot;Transmitter Block Diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Receiver Block Diagram&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2ZBFk.png&quot; alt=&quot;Receiver Block Diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Remember you can ignore anything with the Q channel path if you are using BPSK, ignore the Convolutional encoding block and the input string block this whole thing will be easier to understand) .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Sampler block acts like a Analog to Digital Converter. It samples the output of the I and Q channels at the bitrate your transmitting at (100bits/s, 200bits/s etc) it will give you the AMPLITUDE of the signal recovered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because, hopefully, you've used NRZ encoding, (-1, +1) to signal 0 and 1, you must threshold your signal. All values below Zero are 0's and all values above zero are 1's.  If you've used RZ encoding that is (0, 1) instead of (-1, +1) for your signaling you should threshold at 0.5. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore you should NEVER work with a phase value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Additional Block Diagram Information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is purely to be thorough and give readers a better idea about what is going on. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 1) The Users inputs a string (&quot;Hello World&quot; for example) this gets converted into its &#xA;    Ascii binary value. &#xA;3)This then gets put through a convolutional encoder, this is for feedfoward error &#xA;  correction. This is to reduce the transmission errors due to noise in the &#xA;  communication channel. Like power-lines or someone talking. &#xA;4)The binary values are converted into Non-return to Zero Encoding (NRZ) this means &#xA;  that 0's are converted to -1's and 1's are converted to +1's. &#xA;5) differential encoding is applied to eliminate the need for carrier (discussed above)&#xA;    synchronization. &#xA;6)The Signal is split into the I and Q channels (all even bits go to Q. All odd bits &#xA;   go to the I channel) &#xA;7) They are then shaped into pulses by the wave generator. &#xA;8) An Inter-Symbol Interference filter is applied (root raised cosine filter).&#xA;9)The I and Q channels are multipled by cosine and sine (same frequency, just shifted&#xA;    90 degrees) then recombined and transmitted. &#xA;10)The Receiver process is the same thing as the transmitter in reverse except:&#xA;   Convolutional Decoder: Use the Viterbi algorithm. &#xA;   Detector Block - this is where the NRZ thresholding takes place, values greater &#xA;   than Zero  are 1's values less than Zero are 0's&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;6) &lt;strong&gt;Working with M-ary (like Bin-ary, or trin-ary)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to work with more data points in QPSK, you need to generate your constellation diagram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that all points on a QPSK system should lie on a circle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of each point as a combination of the I and Q channels and not as purely a Phase value used for signaling. &lt;/p&gt;&#xA;" OwnerUserId="1183" LastEditorUserId="1183" LastEditDate="2012-04-16T14:33:39.830" LastActivityDate="2012-04-16T14:33:39.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2047" PostTypeId="2" ParentId="2045" CreationDate="2012-04-13T19:20:08.050" Score="7" Body="&lt;p&gt;If the definition of the flatness dictates that you use a power spectrum, then yes, you should square the magnitudes as the reference from the SciPy documentation indicates. In the equation that you referenced where you didn't see a squaring, I don't think you can read much into it; it says that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;S_{flatness} = \frac{\exp\left(\frac{1}{N} \sum_k \log (a_k)\right)}{\frac{1}{N} \sum_k a_k}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I don't see a definition for $a_k$ anywhere. If you want the spectrum to be proportional to the power in each bin, you need to square.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-13T19:20:08.050" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2048" PostTypeId="1" CreationDate="2012-04-13T20:03:35.063" Score="8" ViewCount="1776" Body="&lt;p&gt;I have to estimate the number of signals present in a measurement contaminated by additive noise given $n$-dimensional snapshot vectors $\bf x$, modeled as $ \bf x = \bf A \bf s + \bf z $ where $\bf s$ is a $k \times 1$ vector representing $k$ different signals. $\bf A$ is an $n \times k$ non-random matrix and $\bf z$ is an $n \times 1$ noise vector. (This model is common in array processing  problems.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I define the SNR—per signal, averaged or otherwise?&lt;/p&gt;&#xA;" OwnerUserId="645" LastEditorUserId="77" LastEditDate="2012-04-15T03:09:04.097" LastActivityDate="2012-04-15T03:09:04.097" Title="How to define SNR for multiple signals in noise?" Tags="|snr|signal-detection|estimation|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2049" PostTypeId="2" ParentId="2045" CreationDate="2012-04-13T21:05:16.710" Score="5" Body="&lt;p&gt;Definitions vary, don't they? The first thing that has to be settled is whether we agree that the &lt;em&gt;power spectral density&lt;/em&gt; is equivalent to the &lt;em&gt;power spectrum&lt;/em&gt;, or else define what we mean by both. Proakis and Salehi &lt;a href=&quot;http://books.google.com/books?id=UZiJzjv9UUgC&amp;amp;pg=PA60&amp;amp;dq=%22power+spectrum%22+%22power+spectral+density%22+proakis&amp;amp;hl=en&amp;amp;ei=-iS0T_-HMOinsAL8mrGKAQ&amp;amp;sa=X&amp;amp;oi=book_result&amp;amp;ct=book-thumbnail&amp;amp;resnum=2&amp;amp;ved=0CEMQ6wEwAQ#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;use them synonymously&lt;/a&gt;. Moving on, I think the discrepancies are due to differing definitions, for signals that have one, of the power spectrum. The usual definition of that is the magnitude &lt;strong&gt;squared&lt;/strong&gt; of the Fourier transformed data. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiener-Khinchin theorem&lt;/a&gt; provides another route to the power spectrum for WSS signals through the Fourier transform of the autocorrelation. Depending on whether or not you define the power spectrum with a square, you get a square in the spectral flatness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Others &lt;a href=&quot;http://books.google.com/books?id=qIMDvu3gJCQC&amp;amp;pg=PA169&amp;amp;dq=%22spectral+flatness%22+magnitude&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=tpOIT9CBDYnZiQLt5JHtBw&amp;amp;ved=0CGAQ6AEwCA#v=onepage&amp;amp;q=%22spectral%20flatness%22%20magnitude&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;use the magnitude of the Fourier transform&lt;/a&gt;. &lt;a href=&quot;http://www.google.com/search?q=&amp;quot;The+power+density+spectrum+is+the+derivative+of+the+power+spectrum&amp;quot;&quot; rel=&quot;nofollow noreferrer&quot;&gt;Some call this&lt;/a&gt; the &quot;power spectrum&quot;, and reserve the name &quot;power spectrum &lt;em&gt;density&lt;/em&gt;&quot; for the &lt;em&gt;derivative&lt;/em&gt; of the &quot;power spectrum&quot; while others reserve the term &quot;power spectrum&quot; for &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_density#Properties_of_the_power_spectral_density&quot; rel=&quot;nofollow noreferrer&quot;&gt;the integral of the Fourier transform of the autocorrelation&lt;/a&gt; (what others call the power spectrum). As you can see, definitions abound; feel free to invent you own :) Or stick to the Wiener-Khinchin standard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Related question&lt;/strong&gt;: &lt;a href=&quot;https://dsp.stackexchange.com/questions/2341/difference-between-power-spectral-density-spectral-power-and-power-ratios&quot;&gt;Difference between Power spectral density, spectral power and power ratios?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-05-16T23:49:08.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2050" PostTypeId="2" ParentId="2048" CreationDate="2012-04-13T21:28:35.970" Score="6" Body="&lt;p&gt;The measurement that is important to you will depend on the application. If you are looking for an over all measurement of all signal power to noise power then you define signal to be the power in all signal bands and the noise all of the powers in the noise bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you are trying to use an sub-band adaptive filter to correct for some sort of distortion then the SNR in the particular band that you care about would be important not an overall SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same application both measurements could be important at different stages of the system. If you are working in wireless communications and the frequency range that is being digitized contains multiple signals then the over all SNR into the receiver needs to be high enough to limit the noise introduced by amplifiers before digitization. But if after I digitize the band it is then split into multiple sub sections for demodulating the signals I would only care about the SNR of the signal currently being demodulated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your application it sounds like an over all measure is important because you are treating the range of frequencies as a whole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the application of mismatch correction algorithms for time-interleaved ADCs (my topic) we sometimes use multiple sinusoids input to the interleaved converters to measure the performance increase the correction algorithms. This makes it easier to calculate and visualize things like SNR and SFDR when the desired signal locations are known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Charna&lt;/p&gt;&#xA;" OwnerUserId="1102" LastActivityDate="2012-04-13T21:28:35.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2051" PostTypeId="1" AcceptedAnswerId="2054" CreationDate="2012-04-13T21:32:06.527" Score="8" ViewCount="1495" Body="&lt;p&gt;I'm trying to programmatically generate a wave (sine or square) with a continuously decreasing frequency.&#xA;To do so, I simply multiply the starting frequency for a decreasing value, that linearly goes from 1 to 0, at intermediate steps throughout a given time span.&#xA;I was puzzled to see (and hear) that, exactly at the half of the time span, the frequency started to increase again.&#xA;I checked the frequency value but everything is ok.&#xA;I can use only the first 'half' of the wave, but it would be great to understand what I'm experiencing.&#xA;Any help appreciated !&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1235" LastActivityDate="2018-12-24T09:12:26.443" Title="Why does a wave continuously decreasing in frequency start increasing its frequency past the half of its length?" Tags="|frequency|wave|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2052" PostTypeId="2" ParentId="2045" CreationDate="2012-04-13T21:33:33.953" Score="0" Body="&lt;p&gt;Its a good question, one that I was wondering myself as well. The spectral flatness (also known as Weiner Entropy) is simply a measure of the 'peakiness' of a vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://www.mp3-tech.org/programmer/docs/SPL.pdf&quot; rel=&quot;nofollow&quot;&gt;source&lt;/a&gt; seems to indicate that the vector under consideration is the power spectral density, in which case you have to square. If you square the magnitude spectrum, you are accentuating peaks over the case where you don't square obviously, and I think this also makes more intuitive sense. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-04-13T21:33:33.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2053" PostTypeId="2" ParentId="1317" CreationDate="2012-04-13T22:12:08.023" Score="7" Body="&lt;p&gt;Also take a look at the relatively new algorithmically defined &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert%E2%80%93Huang_transform&quot; rel=&quot;noreferrer&quot;&gt;Hilbert-Huang Transform&lt;/a&gt; (HHT). It can handle non-stationary-non-linear signals which may be relevant for your application.&lt;/p&gt;&#xA;" OwnerUserId="1064" LastActivityDate="2012-04-13T22:12:08.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2054" PostTypeId="2" ParentId="2051" CreationDate="2012-04-13T22:37:35.310" Score="11" Body="&lt;p&gt;Make sure that your frequency doesn't reach values below 0 or above the half of your sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please post more information/code about how you generate your waveform! Chances are you are not doing it correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you want to generate a sine wave with a time-varying frequency $f(t)$ (for example to implement frequency modulation), generating something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = \sin (2 \pi t f(t))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is wrong, because your instantaneous frequency is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i(t) = \frac{1}{2 \pi}\frac{d \phi(t)}{dt}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2 \pi}\frac{d 2 \pi t f(t)}{dt} \neq f(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Except in the specific case where $f(t)$ is a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct way to generate a sine wave with time-varying frequency $f(t)$ is thus with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = \sin (2 \pi \int_{0}^{t} f(\tau) d\tau)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In synthesizer-speak the register/variable accumulating the instantaneous frequency to evaluate the $\int_{0}^{t} f(\tau) d\tau$ quantity is called a phase accumulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_modulation&quot;&gt;http://en.wikipedia.org/wiki/Frequency_modulation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Instantaneous_phase&quot;&gt;http://en.wikipedia.org/wiki/Instantaneous_phase&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-04-14T15:32:35.383" LastActivityDate="2012-04-14T15:32:35.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2056" PostTypeId="1" CreationDate="2012-04-14T09:08:25.010" Score="3" ViewCount="398" Body="&lt;p&gt;I'm developing an application for PC that records microphone data in real-time, and plays it back after applying some effects. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to apply these effects only when a single known speaker is talking. The environment might include other people's voice and indoor noise (for example, a classroom or a restaurant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since that single speaker is also holding the microphone, I tried to simply filter input data based on a (configurable) volume level. This method is working but not very well, since sometimes the environmental noise might go above the threshold, or the speaker's voice might go below it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to recognize a single speaker? I've read about speaker identification using feature extraction and HMM/GMM, but I'm not sure whether it is an overkill for my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apologize if this it too vague. I'm new to DSP so I'm not really sure what additional information is needed to answer this.&#xA;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Speakers usually speak one after another, but background chatter is possible.&lt;/li&gt;&#xA;&lt;li&gt;In addition, although the speaker is known, I do need some kind of an initial setup procedure (to adjust the application to that speaker).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1236" LastEditorUserId="1236" LastEditDate="2012-04-15T12:05:56.063" LastActivityDate="2012-04-15T12:05:56.063" Title="Real-time single speaker recognition" Tags="|audio|real-time|speech|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2057" PostTypeId="1" CreationDate="2012-04-14T09:18:27.560" Score="1" ViewCount="2675" Body="&lt;p&gt;it could be a donkey question but I'm a little confused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this signal $w(t)=sin({\pi}0.1f)$. I have to calculate the period of this signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w(t)=sin(2{\pi}\frac{1}{20}f)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the period of this signal is: $20s$ while the frequency is $\frac{1}{20}Hz$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is it correct?&lt;/p&gt;&#xA;" OwnerUserId="1141" LastActivityDate="2012-04-14T14:53:31.157" Title="period of this signal" Tags="|frequency|homework|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2058" PostTypeId="2" ParentId="2056" CreationDate="2012-04-14T09:50:40.623" Score="2" Body="&lt;p&gt;I was going to suggest the machine learning route but a quick search turned up OSS so you might not have to re-invent the wheel: &lt;a href=&quot;http://www.ibm.com/developerworks/opensource/library/os-sndpeek/index.html&quot; rel=&quot;nofollow&quot;&gt;Identify speakers with sndpeek&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do the speakers talk over each other (which complicates things) or is it mostly one after another?&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-04-14T09:50:40.623" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2059" PostTypeId="2" ParentId="2057" CreationDate="2012-04-14T12:43:16.953" Score="5" Body="&lt;p&gt;You are mostly correct.  The equation should be $w(t) = sin(2\pi\frac{1}{20}t)$.  The variable in the sin should be $t$, not $f$.  The frequency is determined by the $\frac{1}{20}$, not by the variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that you are correct.  The period is 20s, which makes it a $\frac{1}{20}$ Hz sin wave.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-04-14T12:43:16.953" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2060" PostTypeId="2" ParentId="2048" CreationDate="2012-04-14T12:57:52.147" Score="0" Body="&lt;p&gt;As Charna said, it depends on what you are trying to do, but usually when you are interested in multiple signals you have to deal with those signals individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if I were creating a W-CDMA phone I would always have to deal with multiple signals at the same frequencies in the presence of noise.  It does not matter, in this situation, what the total signal power is.  To recover any useful information I need to recover individual signals, so I need to have each individual SNR be high enough to demodulate the signal.  In fact, when dealing with each signal the other signals act as interferers, which is why they use &lt;a href=&quot;http://en.wikipedia.org/wiki/SINR&quot; rel=&quot;nofollow&quot;&gt;SINR&lt;/a&gt; to measure how recoverable the signal is, not SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, long story short, it depends on what you are trying to do, but normally you only care about the SNR for individual signals, and in that case the other signals might even be interferers.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-04-14T12:57:52.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2061" PostTypeId="1" AcceptedAnswerId="2063" CreationDate="2012-04-12T06:18:05.823" Score="12" ViewCount="255" Body="&lt;p&gt;I need to build a Quran app and I want to read out the verses when a user touches it. The problem I'm facing is that some verses may expand to one and half lines (highlighted red verse) or just fit in a quarter of a line (highlighted green verse). So adding each verse to textview or some other view wont work it seems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to detect verses like the red ones in the second image. I have audio files for the verses so no need of text to speech conversion &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PXEesm.jpg&quot; alt=&quot;&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/lIJq3.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1251" OwnerDisplayName="Aswin Anand" LastEditorUserId="77" LastEditDate="2012-04-14T16:32:33.220" LastActivityDate="2012-04-25T08:43:28.253" Title="Detecting Arabic verses spanning multiple lines" Tags="|image-processing|text-recognition|" AnswerCount="1" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="2062" PostTypeId="2" ParentId="2057" CreationDate="2012-04-14T14:53:31.157" Score="3" Body="&lt;p&gt;It's very important to write the equation properly. The way your equation is written originally there is no period at all. Your left side function of the variable &quot;t&quot;. Since t doesn't show in the right side, the right side is a independent of t. Hence it's a constant and therefore the period is infinity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jim Clay already fixed that in his response. The other potential pitfall are units. If you write the equation as sin(2*pi*(1/20)*t), then t is a unit-less quantity since you cannot take the sin() of a quantity that has units. So the answer would be that the period is 20 (and not 20s). If you write the equation as sin(2*pi*(1/20s)*t), then the t is a time and the units of t cancel with the units in the term (1/20s). In this case the period would be 20s. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-14T14:53:31.157" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2063" PostTypeId="2" ParentId="2061" CreationDate="2012-04-14T17:12:39.180" Score="9" Body="&lt;p&gt;This can be solved fairly straightforwardly with simple template matching. I don't know exactly how you have it set up, so I'll just describe the algorithm generally and use illustrations.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Observe that the verse numbers have a distinctive border that can easily be used to detect the start and end of a verse. So create a binarized template for that pattern and store it. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SC1VA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since the number of lines in a screen are known in advance (you're formatting the page) and each verse has a constant height, you can easily infer (algorithmically) where the Y coordinates for the centerlines of the verses should be on the screen. This demonstrates the idea:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DHMTR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When the user touches a verse, get the X-Y coordinates and snap the Y coordinate to the nearest verse center.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then starting with the X coordinate, perform a simple template matching (cross-correlation) across that row. The first match (peak in the cross-correlation) in the forward direction (to the left), will be the end point for the verse. If there are no matches in the reverse direction (to the right), then move up one verse (which you can do, because you know the Y coordinate of the centerline) and repeat. The first match from the left end will be the start point of the verse. Similarly, if there is no forward match on the line, move down one line and repeat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a short illustration of the idea. The yellow box is where the user touches the verse. You then do the cross-correlation with your template and the blue circles will be the match. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q1eUc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also use template matching in &lt;a href=&quot;https://dsp.stackexchange.com/a/1097/77&quot;&gt;this answer&lt;/a&gt;, if you're interested in seeing it in action.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Once you've determined the start point for the verse, then use an Arabic text recognizer to infer the verse number inside that border and play the corresponding audio file.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Simpler solution:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;A simpler solution, if you don't want to go through this is to store the X-Y coordinates of the verse starting points (keep it simple and use the center points) and once you get the coordinates of the user input, you can again snap it to the centerline and then walk backwards to see where the verse starts. This might have the advantage of being faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't put this forward as the first solution because you seemed to reject a similar idea in the comments. In the end, it depends on your constraints — would you rather do computational work (template matching — which, by the way, also requires you to store the template) or using memory (storing coordinates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were you, I'd probably go with this one, but the image processing solution can be fun to try.&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-04-14T17:12:39.180" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2064" PostTypeId="1" AcceptedAnswerId="2065" CreationDate="2012-04-11T13:00:37.820" Score="16" ViewCount="679" Body="&lt;p&gt;Is there anyway of segmenting objects based on how far they are from the viewer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can color values assess this sort of a thing for us?&#xA;How will intensity levels help in determining how far the object is from the viewer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mKROC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S4mUZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="654" OwnerDisplayName="vini" LastEditorUserId="654" LastEditDate="2012-04-19T13:04:43.740" LastActivityDate="2022-05-24T16:52:31.640" Title="3D reconstruction of an image based on depth of intensity levels?" Tags="|computer-vision|image-processing|image-segmentation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2065" PostTypeId="2" ParentId="2064" CreationDate="2012-04-11T13:24:56.343" Score="11" Body="&lt;p&gt;This is an extremely difficult task, one which is a very active line of research. I've managed to find a &lt;a href=&quot;https://link.springer.com/article/10.1007/s11263-007-0071-y&quot; rel=&quot;nofollow noreferrer&quot;&gt;semi-recent paper&lt;/a&gt; on the subject entitled &amp;quot;&#xA;3-D Depth Reconstruction from a Single Still Image&amp;quot;. I won't go into the details, but here's a few things that this paper found that can be used.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Textures: If you see a given texture, they can help you figure out how far something is away. The wood texture here would be quite ideal for this.&lt;/li&gt;&#xA;&lt;li&gt;Fixed object sizes: Identify common objects, see how large they are, and use them to help with depth analysis. The phone book, soda bottle, etc should work well with this.&lt;/li&gt;&#xA;&lt;li&gt;Focus: If you know how the picture was take, focus can help you identify ranges.&lt;/li&gt;&#xA;&lt;li&gt;Shadows- If you know where the light was coming from, shadows can help you identify how tall objects are, and thus how far they are away.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="88" OwnerDisplayName="Pearsonartphoto" LastEditorUserId="88" LastEditDate="2022-05-24T16:52:31.640" LastActivityDate="2022-05-24T16:52:31.640" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2066" PostTypeId="1" AcceptedAnswerId="2090" CreationDate="2012-04-15T01:27:24.840" Score="17" ViewCount="9919" Body="&lt;p&gt;I would much appreciate an intuitive explanation for (visual) tracking with Kalman filters.&#xA;what I know:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prediction step:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Dynamic system state $\mathbf x_t$: target location at time $t$&lt;/li&gt;&#xA;&lt;li&gt;Measurement $\mathbf z_t$: the image at time index $t$ (??)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Based on images/measurements $1\rightarrow(t-1)$ I want to predict state $\mathbf x_t$? (using dynamic equation) Is that correct ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I interpret the correction step into those terms (image, target location) ?&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="1629" LastEditDate="2016-05-31T10:13:34.613" LastActivityDate="2016-05-31T10:13:34.613" Title="Intuitive explanation of tracking with Kalman filters" Tags="|computer-vision|kalman-filters|tracking|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2067" PostTypeId="1" CreationDate="2012-04-15T05:05:33.717" Score="1" ViewCount="850" Body="&lt;p&gt;I'm currently studying FIR filter and am having trouble understand how the following equation works, and it's implication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = h[n] * z^n = H(z) \cdot z^n $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really understand how this works given that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = h[n] * x[n] $$&#xA;$$ Y(z) = H(z) \cdot X(z) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that $ x[n] = X(z) = z^n $.  What's going on here?  What domain is $ z^n $ in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that convolution is done on two functions in the n-domain; however, in the equation $ y[n] = h[n] * z^n $, $ z^n $ does not appear to me to be in the n-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is in the n-domain, then I don't understand how the other part works, $ y[n] =  H(z) \cdot z^n $, because I thought that then it should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = Z^{-1}(\,H(z) \cdot Z(z^n)\,) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Here's the page from the book with the equation.  It does seem to me that $z^n$ is used in both the time and frequency domain.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/C3vI1.png&quot; alt=&quot;Page From Book&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1146" LastEditorUserId="1146" LastEditDate="2012-04-16T13:01:32.190" LastActivityDate="2012-04-16T13:01:32.190" Title="Understanding the transfer function of an FIR filter" Tags="|filters|convolution|z-transform|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2068" PostTypeId="2" ParentId="2066" CreationDate="2012-04-15T08:11:39.697" Score="5" Body="&lt;p&gt;The Kalman filter recursively provides the optimal linear estimate of a signal perturbed by AWGN. In your case, the state (what you want to estimate) will be given by the target location. The measurements will be determined by your algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've read the Wikipedia article, you might like to view &lt;a href=&quot;http://www.nada.kth.se/~danik/VSpapers/Jurie.pdf&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; presentation on visual tracking. Do you have any books?&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-04-15T08:11:39.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2071" PostTypeId="2" ParentId="2067" CreationDate="2012-04-15T22:37:50.027" Score="1" Body="&lt;p&gt;Looks like a notation or transcription error. The &quot;z&quot; that's used as the transform variable to calculate the Z-Transform can not show up as an independent variable in the time domain as well. One of them needs a different name.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-15T22:37:50.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2072" PostTypeId="2" ParentId="1766" CreationDate="2012-04-15T22:51:03.597" Score="0" Body="&lt;p&gt;You can use the function bwperim&#xA;Some good examples here&#xA;&lt;a href=&quot;http://blogs.mathworks.com/steve/2006/06/02/cell-segmentation/&quot; rel=&quot;nofollow&quot;&gt;http://blogs.mathworks.com/steve/2006/06/02/cell-segmentation/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1205" LastActivityDate="2012-04-15T22:51:03.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2073" PostTypeId="2" ParentId="2067" CreationDate="2012-04-16T01:08:38.877" Score="1" Body="&lt;p&gt;I suspect it should be something like the following:&#xA;$$&#xD;&#xA;y[n] = h[n] * \delta[n + N] \Rightarrow H(z)\cdot z^N&#xD;&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-04-16T12:16:12.720" LastActivityDate="2012-04-16T12:16:12.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2074" PostTypeId="1" CreationDate="2012-04-16T08:26:43.253" Score="12" ViewCount="3517" Body="&lt;p&gt;I recently stumbled across some notes on the &lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-245-multivariable-control-systems-spring-2004/lecture-notes/lec5_6245_2004.pdf&quot;&gt;&quot;Waterbed effect&quot;&lt;/a&gt; in some notes by A. Megretski for an MIT course on &quot;multivariate control systems&quot;. Here's an excerpt:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A common effect, usually associated with unstable zeroes and poles of the open loop plant, makes it theoretically impossible to make certain closed loop transfer functions “small” simultaneously at all frequencies: if amplitude of the frequency response is reduced in one part of the spectrum, it may have to get larger in the other part. This effect, sometimes called the &lt;em&gt;waterbed effect&lt;/em&gt;, can be explained mathematically in terms of integral inequalities imposed on the closed loop transfer functions. In the basis of such results is the affine characterization of all possible closed loop responses, as well as the Cauchy integral relation for analytical functions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't think I've ever heard of this before. Could someone explain the effect in more practical terms?  When am I likely to encounter this effect in practice?&lt;/p&gt;&#xA;" OwnerUserId="64" LastActivityDate="2012-04-19T19:26:43.597" Title="What is the &quot;waterbed effect&quot; in control system design?" Tags="|feedback|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2085" PostTypeId="1" AcceptedAnswerId="2086" CreationDate="2012-04-15T18:59:17.783" Score="12" ViewCount="1107" Body="&lt;p&gt;I have the input image :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nsy9e.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the output of vein detection for the leaf using a Gabor filter, but the output is really noisy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aNmxC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using Total variation denoising however the results are not good:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rXo0S.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I don't want to loose the fine details in the leaf's veins, so a median filter won't suit my problem&lt;/p&gt;&#xA;" OwnerUserId="654" OwnerDisplayName="vini" LastEditorUserId="128" LastEditDate="2018-05-12T09:23:24.380" LastActivityDate="2018-05-12T09:23:24.380" Title="Image Denoising with Better Edge Preservation" Tags="|computer-vision|image-processing|image-segmentation|total-variation|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2086" PostTypeId="2" ParentId="2085" CreationDate="2012-04-16T03:26:39.060" Score="7" Body="&lt;p&gt;Sounds like you want to denoise and preserve edges. Have you considered nonlocal means? There's some GPL'd C++ code along with a brief writeup of the algorithm by the original authors here: &lt;a href=&quot;http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/&quot;&gt;http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One caveat, nonlocal means is very slow and the output can be sensitive to the implementation you have. You may also consider ROF minimzation as it's fast and does a good job of preserving edges. Here's some matlab code that does it: &lt;a href=&quot;http://www.stanford.edu/~tagoldst/Tom_Goldstein/Split_Bregman.html&quot;&gt;http://www.stanford.edu/~tagoldst/Tom_Goldstein/Split_Bregman.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1363" OwnerDisplayName="rcompton" LastActivityDate="2012-04-16T03:26:39.060" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2087" PostTypeId="2" ParentId="424" CreationDate="2012-04-16T18:45:14.700" Score="4" Body="&lt;p&gt;I am aware of at least two separate ways to retrieve the amplitude envelope from a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key equation is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;E(t)^2 = S(t)^2 + Q(S(t))^2&#xA;&#xA;Where Q represents a π/2 phase shift (also known as quadrature signal).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Simplest way I am aware of is to get Q would be to decompose S(t) into a bunch of sinusoidal components using FFT,  rotate each component a quarter turn anticlockwise ( remember each component is going to be a complex number so a particular component x + iy  -&gt;  -y + ix ) and then recombine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach works pretty well, although requires a bit of tuning (I don't yet understand the maths well enough to explain this in any better way)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple of key terms here, namely ' Hilbert transform ' and ' analytic signal '&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm avoiding using these terms because I'm pretty sure I have witnessed considerable ambiguity in their use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One document describes the (complex) analytic signal of an original real signal f(t) as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Analytic(f(t)) = f(t) + i.H(f(t))&#xA;&#xA;where H(f(t)) represents the 'π/2 phase shift' of f(t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in which case the amplitude envelope is simply |Analytic(f(t))|,  which brings us back to the original Pythagorean equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NB: I have recently come across a more advanced technique involving frequency shifting and a lowpass digital filter.  The theory is that we can construct the analytic signal by different means;  we decompose f(t) into positive and negative sinusoidal frequency components and then simply remove the negative components and double the positive components.   and it is possible to do this ' negative frequency component removal ' by a combination of frequency shifting and lowpass filtering.   this can be done extremely fast using digital filters.   I haven't yet explored this approach, so this is as much as I can say at the moment.&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2012-04-16T18:45:14.700" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2088" PostTypeId="2" ParentId="1035" CreationDate="2012-04-17T10:01:51.277" Score="2" Body="&lt;p&gt;Here are a bunch of noise samples used by a military speech research unit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://spib.rice.edu/spib/select_noise.html&quot; rel=&quot;nofollow&quot;&gt;http://spib.rice.edu/spib/select_noise.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are free to download, and are available in both wav and Matlab binary format. If your speech material is not recorded at the same sample rate as the noise samples, it is important to resample either the speech, or noise, or both before summing the signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: pink, white, and babble noise samples are included as well as some military specific types of noise that will probably be of less interest.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="1024" LastEditDate="2012-04-17T10:06:52.817" LastActivityDate="2012-04-17T10:06:52.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2089" PostTypeId="2" ParentId="1035" CreationDate="2012-04-17T12:18:57.067" Score="0" Body="&lt;p&gt;That depends a bit if you are dealing with a carefully made studio recording or someon yelling into a cell phone mic while walking down a New York street 5pm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It typically is a good idea to follow the signal path and see what you may incur. There is &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Acoustical noise: Heating or air conditions, traffic noise, competing sound sources like music, babble, machine or work noises, birds, plane in the air, car cabinnoise and many, many, many more. It really depends on where you are and what's happening&lt;/li&gt;&#xA;&lt;li&gt;Microphone related noise: microphone handling, wind or DC air flow, proximity effect,&quot;pop&quot; noise. These are often a function of the type of microphone (electret vs. dynamic, omni vs. cardoid etc.).&lt;/li&gt;&#xA;&lt;li&gt;Electrical noise: Self noise of the microphone capsule, Pre-amp noise, Pre-amp distortion or clipping, electromagnetically induced or radiated noise, power supply cross talk, hum, the dreaded &quot;ground loop&quot;, etc.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Not all these noises are applicable in all cases so an application specific analysis would be useful. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-17T12:18:57.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2090" PostTypeId="2" ParentId="2066" CreationDate="2012-04-17T13:29:17.663" Score="14" Body="&lt;p&gt;First you have to assume a motion model.  Let's say you wish to track a ball flying through the air.  The ball has a downward acceleration due to gravity of 9.8m/s^2.  So in this case the constant acceleration motion model is appropriate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under this model, your state is position, velocity, and acceleration.  Given the previous state you can easily predict the next state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also have a notion of detection. You have a video of the ball moving, and you somehow have to detect the ball in each video frame (e. g. by using background subtraction).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your detections are noisy.  Also, the motion of the ball does not exactly fit the constant acceleration model because of air resistance, wind, cosmic rays, etc.  The Kalman filter needs two matrices describing this: one is the covariance of the measurement noise (your detection inaccuracy), and one for the covariance of the process noise (how the motion of the ball deviates from the model you have specified).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are tracking a single object, then the Kalman filter lets you smooth out some of the noise, and also predict where the object is when a detection is missing (e. g. if the object is occluded). Here is an &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/using-kalman-filter-for-object-tracking.html&quot; rel=&quot;noreferrer&quot;&gt;example of tracking a single object with a Kalman filter&lt;/a&gt; using the Computer Vision System Toolbox for MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are tracking multiple objects, then the Kalman filter predictions let you decide which detection goes with which object.  A good way to do that is to use the log likelihood of the detection given the error covariance of the prediction. Here is an &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/motion-based-multiple-object-tracking.html&quot; rel=&quot;noreferrer&quot;&gt;example of tracking multiple objects with a Kalman filter&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2013-07-07T01:25:36.767" LastActivityDate="2013-07-07T01:25:36.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2091" PostTypeId="1" AcceptedAnswerId="2093" CreationDate="2012-04-17T14:57:18.710" Score="4" ViewCount="804" Body="&lt;p&gt;I want to &lt;em&gt;downsample&lt;/em&gt; images to arbitrary sizes using supersampling to avoid aliasing effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only two good explanations I found were on &lt;a href=&quot;http://en.wikipedia.org/wiki/Supersampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; and &lt;a href=&quot;http://www.everything2.com/index.pl?node_id=1028947&quot; rel=&quot;nofollow noreferrer&quot;&gt;everything2.com&lt;/a&gt;, but there are still gaps. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The image should be upsampled before supersampling. But how much? Is there any special filter to be used for upsampling prior to supersampling? Is just taking interpolated color values on sub-pixel positions in source image sufficient?&lt;/li&gt;&#xA;&lt;li&gt;What if I want to resize image to e.g. 80% of its size with supersampling? How much I have to upsample it and how to treat non-integral size ratio (e.g. downsampling from 379 pixels to 377 pixels)?&lt;/li&gt;&#xA;&lt;li&gt;Are the multiple samples taken from the single pixel, multiple pixels or around sample point (both cases can occur)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tested the &quot;Super Sampling&quot; method in Paint.NET with &lt;a href=&quot;http://bvdwolf.home.xs4all.nl/main/foto/down_sample/down_sample.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;test target on this page&lt;/a&gt;. Suprisingly, the result looked just like &quot;Photoshop Bicubic&quot; filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pZGJ8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only advantage can been achieved by pre-blurring input image and than using some conventional method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented and tried ordinary &quot;Box&quot; and &quot;Cubic&quot; convolution filters with excellent results!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1KwfE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OdlKT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now I don't see any benefit of using supersampling over the convolution-based filters. Or is there any?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-04-18T14:43:36.937" LastActivityDate="2012-04-18T14:43:36.937" Title="Reference for Supersampling" Tags="|sampling|downsampling|supersampling|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2092" PostTypeId="2" ParentId="2042" CreationDate="2012-04-17T15:01:18.097" Score="4" Body="&lt;p&gt;This is not a complete answer, but detection of words from the speech itself is almost always dictionary based - hence one needs to know what &lt;em&gt;words&lt;/em&gt; would &lt;em&gt;sound like&lt;/em&gt;. If you don't know language, you don't quite know the relation to the sounds. Hence, speech/audio recognition don't quite work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There can be many primary features to classify:&lt;br&gt;&#xA;Reference: &#xA;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=317925&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Automatic Language Identification: A Review/Tutorial&lt;/strong&gt;  by &lt;em&gt;Yeshwant K. Muthusamy , Etienne Barnard , Ronald A. Cole&lt;/em&gt; Signal Processing Magazine, IEEE Oct. 1994 Volume: 11,   Issue: 4 pp. 33 - 41&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or related &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.56.7425&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; of same author.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Phonetics:&lt;br&gt;&#xA;Here you should try to look for is that you should try to collect and identify sounds based on primary phonetics. For example - you can use something like &lt;a href=&quot;http://en.wikipedia.org/wiki/International_Phonetic_Alphabet&quot; rel=&quot;nofollow&quot;&gt;International Phonetic Alphabet&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Prosodic:&lt;br&gt;&#xA;Languages like English, French, German might have very close phonetics. In such case, you can also use Prosodic information which is essentially duration of sound, emphasis or accentuations, pitch and pitch variations. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Phonotactics:&lt;br&gt;&#xA;Phonotactics refers to the rules that govern the combinations of the di erent&#xA;phones in a language. There is a wide variance in phonotactic rules across languages. For example, the phone cluster /sr/ is very common in the Dravidian language Tamil, whereas it is not a legal cluster in English.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Vocabulary:&lt;br&gt;&#xA;If you are successful at this, you can probably make another classification of which phonetic alphabet orders are most likely in particular language. You probably don't have to recognize each word. But based on most likely phonetic symbol sequences, you can probably do language detection. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastEditorUserId="440" LastEditDate="2012-04-17T15:28:24.817" LastActivityDate="2012-04-17T15:28:24.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2093" PostTypeId="2" ParentId="2091" CreationDate="2012-04-17T15:28:19.303" Score="3" Body="&lt;p&gt;EDIT: I took this answer down for a time because I realized a lot depends on whether there are any idiosyncrasies in how images are mapped to pixels by actual devices, and, not being an image guy, I don't know a lot about that.  I decided to bring it back, with the caveat that the answer may be insufficient given said idiosyncrasies.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The image should be upsampled before supersampling. But how much?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are just trying to soften quantization (pixel resolution) error by collecting information from neighboring pixels.  Thus, oversampling by a factor of 2 should be plenty.  In other words, once you oversample until your sample resolution is twice that of the pixel resolution, nothing can be gained by oversampling more.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any special filter to be used for upsampling prior to supersampling?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I might be misunderstanding the terms, but it appears to me that upsampling is part of supersampling.  No, you don't need to use any special filters.  Insert 0's in between your samples and then low-pass filter.  You'll probably need to adjust the gain of your low-pass filter by your upsampling rate to get the pixel intensity to come out right.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What if I want to resize image to e.g. 80% of its size with supersampling?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then factor that into your upsample/decimation calculations.  After you upsample you have to decimate down to the pixel resolution.  By resizing the image you are, in effect, changing the pixel resolution.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How much I have to upsample it and how to treat non-integral size ratio?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How much you have to upsample it depends on the details of the image, pixel resolution, etc.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How much I have to upsample it and how to treat non-integral size ratio?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can deal with non-integral ratios with fractional resampling.  Essentially you upsample by an integer and decimate by another integer, giving you a fractional sample change.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-04-17T18:52:51.747" LastActivityDate="2012-04-17T18:52:51.747" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2094" PostTypeId="2" ParentId="534" CreationDate="2012-04-17T17:28:33.420" Score="4" Body="&lt;p&gt;This is a no brainer for anyone who's studied signal processing (Im wondering why its been so long since its been answered) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier Transform itself is a function that tells you what sinusoid do you need to add together to create this continuous signal. (Its like the Fourier series for more complex signals) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the FFT algorithm gives you COMPLEX coefficients (a+bj) (where j is the imaginary number... it looks like and i but backwards....) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;calculate the magnitude of each coefficient A(n) = sqrt(a(n)^2 + b(n)^2) &#xA;calculate the phase of each coefficient phi(n) = inverse_tan(b(n)/a(n)); (remember to use atan2 so that it results in the correct quadrant) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;now remember based on your sampling rate each coeff represents a &quot;bin&quot; of frequencies, however you should think of them as evenly distributed frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you have N bins each frequency_bin they represent is f = Fs/(2*N)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then your signal becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;f(x) = \Sigma^N_0 A(n)*cos(2*\pi*f(n) + \phi(n))&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;also: Predicting function: Impossible. that would be asking for a non-causal system. &lt;/p&gt;&#xA;" OwnerUserId="1183" LastEditorUserId="1183" LastEditDate="2012-04-17T18:25:01.903" LastActivityDate="2012-04-17T18:25:01.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2095" PostTypeId="1" CreationDate="2012-04-18T05:06:43.937" Score="10" ViewCount="422" Body="&lt;p&gt;there are n derivative filters: $f_i$, and denote $f_i^r$ as $f_i$'s reverse filter such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i(x,y)=f_i^r(-x, -y)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r_i, f_i$ given, to find $r$ from the equations:&#xA;$$f_i * r = r_i, (1 \leq i \leq n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Professor Weiss recovers $r$ using the following method:&#xA;$$r = g * \left(\sum_{i=1}^n f_i^r*r_i\right)$$ and $g$ satisfies:&#xA;$$\delta = g * \left(\sum_{i=1}^n f_i^r*f_i\right)$$&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why can the method solve the equation? What books should I refer to?&lt;/li&gt;&#xA;&lt;li&gt;I want to know how to find the $g$?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Professor Weiss uses these two derivative filters: $[0\ 1 -1]$ and $[0; 1; -1]$.&#xA;and in his code the function &lt;code&gt;invDel()&lt;/code&gt; returns $g$, which I could not understand. Article &lt;a href=&quot;http://www.ai.mit.edu/courses/6.899/papers/13_02.PDF&quot; rel=&quot;noreferrer&quot;&gt;link&lt;/a&gt;, implementation &lt;a href=&quot;http://www.cs.huji.ac.il/~yweiss/intrinsic.tar&quot; rel=&quot;noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Professor Weiss's MATLAB code for getting $g$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [invK]=invDel2(isize)    % isize is 2 * max(imgWidth, imgHeight)&#xA;    K=zeros(isize);&#xA;    K(isize/2,isize/2)=-4;&#xA;    K(isize/2+1,isize/2)=1;&#xA;    K(isize/2,isize/2+1)=1;&#xA;    K(isize/2-1,isize/2)=1;&#xA;    K(isize/2,isize/2-1)=1;&#xA;&#xA;    Khat=fft2(K);&#xA;    I=find(Khat==0);&#xA;    Khat(I)=1;&#xA;    invKhat=1./Khat;&#xA;    invKhat(I)=0;&#xA;    invK=ifft2(invKhat);&#xA;    invK=-real(invK);&#xA;    invK=conv2(invK,[1 0 0;0 0 0;0 0 0],'same');% shift by one&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1227" LastEditorUserId="128" LastEditDate="2018-06-19T04:00:50.723" LastActivityDate="2020-09-03T10:01:30.150" Title="Deconvolution Question on Article &quot;Deriving Intrinsic Images from Image Sequences&quot; by Yair Weiss" Tags="|image-processing|convolution|deconvolution|blind-deconvolution|inverse-problem|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2096" PostTypeId="1" AcceptedAnswerId="2148" CreationDate="2012-04-18T10:09:20.330" Score="69" ViewCount="35555" Body="&lt;p&gt;Welch's method has been my go-to algorithm for computing power spectral density (PSD) of evenly-sampled timeseries.  I noticed that there are many other methods for computing PSD.  For example, in Matlab I see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;PSD using Burg method&lt;/li&gt;&#xA;&lt;li&gt;PSD using covariance method&lt;/li&gt;&#xA;&lt;li&gt;PSD using periodogram&lt;/li&gt;&#xA;&lt;li&gt;PSD using modified covariance method&lt;/li&gt;&#xA;&lt;li&gt;PSD using multitaper method (MTM)&lt;/li&gt;&#xA;&lt;li&gt;PSD using Welch's method&lt;/li&gt;&#xA;&lt;li&gt;PSD using Yule-Walker AR method&lt;/li&gt;&#xA;&lt;li&gt;Spectrogram using short-time Fourier transform&lt;/li&gt;&#xA;&lt;li&gt;Spectral estimation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What are the advantages of these various methods?  As a practical question, when would I want to use something other than Welch's method?&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="1024" LastEditDate="2012-10-16T13:08:46.210" LastActivityDate="2022-10-11T23:03:47.587" Title="Why so many methods of computing PSD?" Tags="|frequency-spectrum|power-spectral-density|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2097" PostTypeId="1" CreationDate="2012-04-18T11:06:48.370" Score="4" ViewCount="1933" Body="&lt;p&gt;I am trying to learn about inverse filtering of images and am trying it out on a test image in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The test image is an 8x8 checkerboard, with 64x64 pixels, generated by the MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;g = checkerboard(8);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am using a 3x3 averaging filter, h, and convolving it with the test image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not adding noise and I want to see the results of direct inverse filtering the distorted image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am applying the deconvolution function in the frequency domain by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Padding the 3x3 averaging mask h to generate a 64x64 mask hp. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Centering the coefficients (0.111...) of hp to maintain symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Multiplying hp by (-1)^x+y (since I want the fft of the mask to give me a centered Fourier transform, hpc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Taking the FFt of the padded, centered mask and multiplying (-1)^(u+v) (since I centered the mask in the spatial domain in step 2) to give me H.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Taking the distorted, and frequency shifted test image and dividing it by H, (ie. Y = G./H). (Note: I am not padding the image since the mask was padded, and wraparound is not a huge concern here)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) Obtaining the inverse filtered image inv = (-1)^x+y * real(ifft2(Y)) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: Why can't I obtain the original (or something very close to it)?&lt;/p&gt;&#xA;" OwnerUserId="1252" LastEditorUserId="6" LastEditDate="2012-04-18T14:13:40.773" LastActivityDate="2012-06-18T09:36:17.320" Title="Direct Inverse Filtering an image, spatially convolved with a blurring function without any noise, doees not give my original image back?" Tags="|filters|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2098" PostTypeId="2" ParentId="129" CreationDate="2012-04-18T12:18:50.043" Score="11" Body="&lt;p&gt;I found a paper that addresses this question directly:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Michael Tröbs and Gerhard Heinzel, &quot;&lt;a href=&quot;http://dx.doi.org/10.1016/j.measurement.2005.10.010&quot;&gt;Improved spectrum estimation&#xA; from digitized time series on a logarithmic frequency axis&lt;/a&gt;,&quot; in&#xA; &lt;em&gt;Measurement&lt;/em&gt;, vol &lt;strong&gt;39&lt;/strong&gt; (2006), pp 120-129. (Or &lt;a href=&quot;http://pubman.mpdl.mpg.de/pubman/item/escidoc:150688:1&quot;&gt;free pre-print&lt;/a&gt;.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The first few figures in the paper nicely illustrate the problem that this algorithm solves, and the references contain a useful bibliography of other approaches (constant-Q transform, tempered Fourier transform, a survey article, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their approach is not to re-bin the output of an existing FFT-based power spectrum estimation, but to only compute the discrete Fourier transform at the (logarithmically-spaced) frequencies of interest.  For each frequency to be estimated, they basically implement Welch's algorithm, but with a transform length (and hence also, number of averages) specifically chosen for each frequency. The computation of each frequency bin uses the entire time series, but segmented differently. The results have the desirable property that the resolution (bin width) is a smooth function of frequency, and the results can be calibrated as either a power spectral density or a power spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab implementation here: &lt;a href=&quot;https://github.com/tobin/lpsd&quot;&gt;https://github.com/tobin/lpsd&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DGDJ3.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Disclosure: The authors of this paper are at the same institution as me.&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-04-18T14:23:27.877" LastActivityDate="2012-04-18T14:23:27.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2099" PostTypeId="1" AcceptedAnswerId="9544" CreationDate="2012-04-18T15:17:25.267" Score="11" ViewCount="350" Body="&lt;p&gt;Background: I'm trying to make a system that tracks a number of bubbles in a video&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm implementing the bubble detection in the single image case using the Circular Hough Transform. Due to occlusion, blur and other factors, this detection will never be 100% accurate. I am tuning the detection procedure for high recall, possibly at the expense of precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once this is done and applied to a sequence of frames from a video, I will have a number of detections that can be characterised as points in 4D space - x-position, y-position, radius and frame index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a procedure that can recover curves from this 4D point cloud?&lt;/p&gt;&#xA;" OwnerUserId="1253" LastEditorUserId="128" LastEditDate="2017-09-27T10:30:18.740" LastActivityDate="2017-09-27T10:30:18.740" Title="Recover curves from noisy collection of points" Tags="|image-processing|noise|computer-vision|opencv|maximum-a-posteriori-estimation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2100" PostTypeId="2" ParentId="1365" CreationDate="2012-04-18T15:34:15.470" Score="1" Body="&lt;p&gt;While every signal processing challenge there is no one fits all solution here is an idea:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;since you are trying to preserve the edges find out where they are&#xA;in the image. Use a canny edge detector to find edges within your&#xA;image.    &lt;/li&gt;&#xA;&lt;li&gt;Dilate/Fatten the boundaries of the edges outputted from the image (maybe&#xA;2-5 pixels wide for each edge) lets call this the &quot;mask&quot;&lt;/li&gt;&#xA;&lt;li&gt;invert the mask.&lt;/li&gt;&#xA;&lt;li&gt;Apply the mask to your image, i.e., only let items that are NOT edges through.&lt;/li&gt;&#xA;&lt;li&gt;apply de-gaussing technique&lt;/li&gt;&#xA;&lt;li&gt;use the original edge mask to get the image pixel values where there ARE edges&lt;/li&gt;&#xA;&lt;li&gt;Place them back into the de-gaussed image&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;alternatively, you can apply your De-gaussing technique to the image as a whole and then just reintroduce the un-de-gaussed pixels back into the image. &lt;/p&gt;&#xA;" OwnerUserId="1183" LastEditorUserId="1183" LastEditDate="2012-04-18T19:31:42.757" LastActivityDate="2012-04-18T19:31:42.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2101" PostTypeId="1" CreationDate="2012-04-18T15:57:31.930" Score="15" ViewCount="1516" Body="&lt;p&gt;So while answering how to design a PI controller for a first order time delayed system  &lt;a href=&quot;https://electronics.stackexchange.com/questions/25635/design-of-a-pi-controller&quot;&gt; (Question Here &lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the closed loop equation to a control system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G_C(s) = \frac{\frac{K}{T}(1-sT)(s)} { s^3 + (\frac{1}{T} + a - KK_p)s^2 + (\frac{a}{T} + \frac{KK_P}{T} +K_I)s+\frac{KK_I}{T}} &#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; How do you deal with normalizing the numerator in your closed loop transfer function when the filter is unstable? (Pole on RH of plane) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically you introduce a filter before your controller that does:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1} {\frac{K}{T} (1-sT)(s)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to normalize the numerator &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the filter itself is unstable because of the term:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1}{(1-sT)}$$ is unstable for a step response which would create an issue realizing the system at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way I've thought about dealing with this is multiplying it by its complex conjugate &#xA;$$&#xA;\frac{(1+sT)} {(1+sT)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but im not really sure about the merits of it. &lt;/p&gt;&#xA;" OwnerUserId="1183" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2016-06-25T10:14:03.943" Title="How to deal with a negative pole (unstable) in the pre-filter of a control system?" Tags="|filters|filter-design|transfer-function|analog|control-systems|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2102" PostTypeId="2" ParentId="1365" CreationDate="2012-04-18T19:48:46.800" Score="10" Body="&lt;p&gt;You might need to consider more advanced techniques. Here are two recent papers on edge-preserving denoising:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/TIP.2006.877409&quot;&gt;Edge-Preserving Image Denoising via Optimal Color Space Projection&lt;/a&gt; &lt;a href=&quot;http://web.mysites.ntu.edu.sg/zvitali/publications/.../colordenoisefinal.pdf&quot;&gt;[in color]&lt;/a&gt; This paper preserves edges by decomposing the image into an &quot;optimal&quot; color space and performing wavelet shrinkage. The optimal color space belongs to the luminance/color-difference family (think L*a*b*, or YCrCb).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://dx.doi.org/10.1016/j.sigpro.2010.04.009&quot;&gt;Edge Structure Preserving Image Denoising&lt;/a&gt; From the paper:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Our method is based on [jump regression analysis], and consists of three major steps, outlined below. First, edge pixels are detected in the whole design-space by an edge detector. Second, in a neighborhood of a given pixel, a piecewise-linear curve is estimated from the detected edge pixels by a simple but efficient algorithm, to approximate the underlying edge segment in that neighborhood. Finally, observed image intensities on the same side of the&#xA;  estimated edge segment, as the given pixel, are averaged by the local linear kernel smoothing procedure (cf., [35]), for estimating the true image intensity at the given pixel.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(&lt;em&gt;Jump regression models&lt;/em&gt; incorporate discontinuities using step functions. The primary author &lt;a href=&quot;http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471420999,subjectCd-EEC0.html&quot;&gt;has a book on this subject&lt;/a&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-04-18T19:48:46.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2103" PostTypeId="1" CreationDate="2012-04-19T00:07:31.130" Score="10" ViewCount="470" Body="&lt;p&gt;I understand (mostly) how independent component analysis (ICA) works on a set of signals from one population, but I am failing to make it work if my observations (X matrix) includes signals from two different populations (having different means) and I am wondering if it is an inherent limitation of ICA or if I can resolve this.  My signals are different than the common type being analyzed in that my source vectors are very short (e.g. 3 values long), but I have many (e.g. 1000's) of observations.  Specifically, I am measuring fluorescence in 3 colors where the broad fluorescence signals can &quot;spillover&quot; into other detectors. I have 3 detectors and using 3 different fluorophores on particles. One could think of this as a very poor resolution spectroscopy.  Any fluorescent particle could have an arbitrary amount of any of the 3 different fluorophors.  However, I have a mixed set of particles which tend to have quite distinct concentrations of fluorophores. For example, one set may generally have lots of fluorophore #1 and little fluorophore #2, while the other set has little of #1 and lots of #2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I want to deconvolve the spillover effect to estimate the actual amount of each fluorophore on each particle, rather than having a fraction of signal from one fluorophore add to the signal of another.  It seemed like this would be possible for ICA, but after some significant failures (the matrix transform seems to prioritize separating the populations rather than rotating to optimize signal independence), I am wondering if ICA isn't the right solution or if I need to pre-process my data in some other manner to address this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wvVCO.png&quot; alt=&quot;Results of FastICA algorithm with 2 populations in 1 data set&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The graphs show my synthetic data used to demonstrate the problem.  Starting with &quot;true&quot; sources (panel A) consisting of a mixture of 2 populations, I created a &quot;true&quot; mixing (A) matrix and calculated the observation (X) matrix (panel B).  FastICA estimates the S matrix (shown in panel C) and instead of finding my true sources, it seems to me that it rotates the data to minimize the covariance between the 2 populations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for any suggestions or insight.&lt;/p&gt;&#xA;" OwnerUserId="1254" LastEditorUserId="1254" LastEditDate="2012-04-19T17:18:47.680" LastActivityDate="2013-09-12T19:00:45.003" Title="Can I use independent component analysis if I have two discrete populations of signal sources mixed together?" Tags="|ica|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2104" PostTypeId="1" AcceptedAnswerId="2105" CreationDate="2012-04-19T01:08:10.557" Score="12" ViewCount="3748" Body="&lt;p&gt;This is a detector problem I believe: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am being stumped by what appears to be a simple problem. Basically, I have a band of interest. If signal energies exist within this band of interest, then I perform operation X on my signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I am not sure exactly how to go about 'deciding' if a signal exists or not. In that, after I perform an FFT, I can look for peaks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now what?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is the statistic used usually comparing this peak to the surrounding mean of the spectrum? Or is it some other statistic? &lt;/li&gt;&#xA;&lt;li&gt;What statistical measure do I use to simply determine if a signal is present, and go from there? &lt;/li&gt;&#xA;&lt;li&gt;How do I set this value? Simple thresholding?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT Based on feedback:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this simple case, I am assuming a tone, in white gaussian noise. What I am trying to get  a handle on are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How exactly does one generated a ROC &lt;em&gt;curve&lt;/em&gt;. Does one have to go and &lt;em&gt;label&lt;/em&gt; all the data first, and &lt;em&gt;then&lt;/em&gt; get the true-positive and false-positive rates for a multitude of thresholds?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How does decreasing SNR affect the ROC curve? Move it towards the diagonal?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is adaptive thesholding doing to a given ROC curve that was otherwise generated without an adaptive threshold? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3a. What are some common adaptive threshold techniques I can look at that are common?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="293" LastEditorUserId="1629" LastEditDate="2016-05-31T12:00:06.397" LastActivityDate="2016-05-31T12:00:06.397" Title="What statistic is used to determine presence of a signal in noise?" Tags="|fft|signal-detection|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2105" PostTypeId="2" ParentId="2104" CreationDate="2012-04-19T05:28:30.970" Score="10" Body="&lt;p&gt;This is one of the oldest signal processing problems, and a simple form is likely to be encountered in an introduction to detection theory. There are theoretical and practical approaches to solving such a problem, which may or may not overlap depending upon the specific application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A first step toward understanding the approaches to the problem is understanding how you would measure the performance of your signal presence detector. There are two important and related metrics used to quantitatively measure how good a detector is: its &lt;strong&gt;probability of detection&lt;/strong&gt; $P_d$ and its &lt;strong&gt;probability of false alarm&lt;/strong&gt; $P_{fa}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_d$ is specified as the probability that your detector will indicate the presence of the signal of interest, given that the signal is actually there. Conversely, $P_{fa}$ is the probability that your detector will indicate the presence of the signal of interest, given that the signal is &lt;em&gt;not&lt;/em&gt; there. As you might expect, then, in a perfect world, we would design a system that yields $P_d = 1$ and $P_{fa} = 0$ and call it a day. As you might also expect, it's not that easy. There is an inherent tradeoff between the two metrics; typically if you do something that improves one, you will observe some degradation in the other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example: if you are looking for the presence of a pulse against a background of noise, you might decide to set a threshold somewhere above the &quot;typical&quot; noise level and decide to indicate presence of the signal of interest if your detection statistic breaks above threshold. Want a really low false-alarm probability? Set the threshold high. But then, the probability of detection might decrease significantly if the elevated threshold is at or above the expected signal power level!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To visualize the $P_d$ / $P_{fa}$ relationship, the two quantities are often plotted against one another on a &lt;strong&gt;receiver operating characteristic&lt;/strong&gt; curve. Here's an example from &lt;a href=&quot;http://en.wikipedia.org/wiki/Receiver_operating_characteristic&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S7qZe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ideal detector would have a ROC curve that hugs the top of the plot; that is, it could provide guaranteed detection for any false alarm rate. In reality, a detector will have a characteristic that looks like those plotted above; increasing the probability of detection will also increase the false alarm rate, and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a theoretical perspective, therefore, these types of problems boil down to selecting some balance between detection performance and false-alarm probability. How that balance is described mathematically depends upon your statistical model for the random process that the detector observes. The model will typically have two states, or hypotheses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H_0: \text{no signal is present}&#xA;$$&#xA;$$&#xA;H_1: \text{signal is present}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, the statistic that the detector observes would have one of two distributions, according to which hypothesis is true. The detector then applies some sort of test that is used to determine the true hypothesis and therefore whether the signal is present or not. The distributions of the detection statistic is a function of the signal model that you choose as appropriate for your application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Common signal models are the detection of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Pulse_amplitude_modulation&quot; rel=&quot;noreferrer&quot;&gt;pulse-amplitude-modulated signal&lt;/a&gt; against a background of &lt;a href=&quot;http://en.wikipedia.org/wiki/AWGN&quot; rel=&quot;noreferrer&quot;&gt;additive white Gaussian noise (AWGN)&lt;/a&gt;. While that description is somewhat specific to digital communications, many problems can be mapped to that or a similar model. Specifically, if you are looking for a constant-valued tone localized in time against a background of AWGN, and the detector observes the signal magnitude, that statistic will have a Rayleigh distribution if no tone is present and a Rician distribution if one is present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once a statistical model has been developed, the detector's decision rule must be specified. This can be as complicated as you desire, based on what makes sense for your application. Ideally, you would want to make a decision that is optimal in some sense, based on your knowledge of the distribution of the detection statistic under both hypotheses, the probability of each hypothesis being true, and the relative cost of being wrong about either hypothesis (which I'll talk more about in a bit). &lt;a href=&quot;http://en.wikipedia.org/wiki/Bayesian_decision_theory&quot; rel=&quot;noreferrer&quot;&gt;Bayesian decision theory&lt;/a&gt; can be used as a framework for approaching this aspect of the problem from a theoretical perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the simplest practical case, the detector might trigger a detection if the detection statistic exceeds a fixed threshold $T$. In a more complicated and practical case, the detector might have some criteria for setting an adaptive threshold $T(t)$ and trigger a detection at time $t$ if the detection statistic breaks the threshold value at that instant. In your description of your problem, you hit on one common method for setting such an adaptive threshold: calculate the neighborhood mean to estimate the &quot;background level&quot;, then set a detection threshold some amount above that mean. This can work for some applications, and there are many other ways to arrive at such a threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a statistical model for the detector's input and the decision rule used to map that statistic to detection conclusions, one can then calculate the detector's theoretical performance metrics. In the design phase, you would typically calculate these metrics as functions of the free design parameters that you have (for instance, the threshold $T$ above). You can then evaluate the inherent tradeoffs: &quot;if I set $T=5$, then I get $P_d = 0.9999$, but $P_{fa} = 0.01$. That's too high of a false alarm rate, so I better increase the threshold.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where you eventually decide to sit on the performance curve is up to you, and is an important design parameter. The right performance point to choose depends upon the relative cost of the two types of possible failures: is it worse for your detector to miss an occurrence of the signal when it happens or to register an occurrence of the signal when it hasn't happened? An example: a fictitious ballistic-missile-detector-with-automatic-strikeback-capability would be best served to have a very false alarm rate; starting a world war because of a spurious detection would be unfortunate. An example of the converse situation would be a communication receiver used for safety-of-life applications; if you want to have maximum confidence that it doesn't fail to receive any distress messages, it should have a very high probability of detection of the transmitted signal.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-19T05:28:30.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2108" PostTypeId="2" ParentId="2097" CreationDate="2012-04-19T09:11:41.100" Score="1" Body="&lt;p&gt;I think I found out the answer to my own question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I'm using an averaging filter mask (some constant multiplied by a matrix of ones), the Fourier Transform of such a filter is an impulse at zero frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I pad the mask filter in step 1 to make the dimensions of the mask equal to the image, I am 'truncating' the filter, ie. windowing the mask, which is akin to multiplying the Fourier Transform of the mask with a sinc function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, the Frequency Domain filter I use in step 5, ie. H, is not an impulse but a sinc function. That's the reason why my results are not ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if I were to use an impulse in step 5, only the zero-frequency value would remain, and my result would be a constant image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, it's a lose-lose situation.&lt;/p&gt;&#xA;" OwnerUserId="1252" LastActivityDate="2012-04-19T09:11:41.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2109" PostTypeId="1" AcceptedAnswerId="2116" CreationDate="2012-04-19T09:24:15.093" Score="3" ViewCount="1586" Body="&lt;p&gt;Let's say that the point spread function, h, is known for a blurred image B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to apply an inverse filtering method (eg. Direct Inverse Filtering for noiseless images, Wiener Filter, Constrained Least Squares, etc.), can/do we pad the blurred image B in order to divide H (DFT of h)? (The dimensions of H would equal those of the padded B)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have noticed that using zero-padding does not yield good results, whereas applying the inverse without padding gives much better results  &lt;/p&gt;&#xA;" OwnerUserId="1252" LastActivityDate="2012-04-20T09:25:33.073" Title="Padding Images To Solve Inverse Filtering Problem?" Tags="|image-processing|zero-padding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2111" PostTypeId="1" CreationDate="2012-04-19T13:38:42.623" Score="4" ViewCount="13534" Body="&lt;p&gt;I want to compare a bunch of depth images coming from Kinect and eliminate the similar ones. Those images present posture of a single user sitting on the chair (depicted in).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VoTgY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is to create a function which will return the difference in range [0,1] between two postures. This means, I want to compare only a posture for given two images (a grey region). For example, if I pass &lt;a href=&quot;https://lh4.googleusercontent.com/-9ZvXx6KMw-U/T5APMXqWT_I/AAAAAAAAAfE/jXZnQK04TVw/s940/image1_image2.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;images&lt;/a&gt; to my function, the result will be 0 (because postures are the same, but not at the same position on the picture). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, I need to modify the following code (and find something to replace &quot;correlation&quot;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = imread('image_user_depth_000041.jpg');  %first img&#xA;b = imread('image_user_depth_000042.jpg');  %second img&#xA;a = RGB2IND(a,16);&#xA;b = RGB2IND(b,16);&#xA;&#xA;c = corr2(a,b);           %finding the correlation &#xA;if c==1&#xA; disp('The images are same') % display&#xA;else&#xA; disp('the images are not same')&#xA;end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you have any suggestions? &#xA;My regards and thanks!&lt;/p&gt;&#xA;" OwnerUserId="1259" LastEditorUserId="1059" LastEditDate="2012-04-19T16:34:53.147" LastActivityDate="2014-03-02T09:16:00.823" Title="Image comparison using MATLAB" Tags="|computer-vision|matlab|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2113" PostTypeId="2" ParentId="1374" CreationDate="2012-04-19T14:33:03.380" Score="3" Body="&lt;p&gt;@skipfer0712&#xA;Firstly, I owe you thanks as I am currently working with MDFT polyphase filters and found your query quite useful. Although you mentioned that you happened to solve the problem, I would like to add something. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;Hk(z)&lt;/strong&gt; in your formula gives the complex modulated and time shifted versions of the low pass prototype filter &lt;strong&gt;H(z)&lt;/strong&gt; and not the polyphase components. It is more common to use the symbol &lt;strong&gt;E&lt;/strong&gt; or &lt;strong&gt;G&lt;/strong&gt; to denote the polyphase decomposiotion of the prototype filters. I do not know your entire MATLAB code, but please recheck it. Your intital method should work. The equation you used to solve your decompositions are nothing but summation of M impulse responses of your k &lt;em&gt;th&lt;/em&gt; filter branch, which would mean that you have a uniform filter bank but not one with polyphase decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I have tried to not include formulas as I am relatively new to this site and as such lack the knowledge of using the proper syntax for exponents, sigmas and so on. I apologize for the confusing description.  &lt;/p&gt;&#xA;" OwnerUserId="1261" LastActivityDate="2012-04-19T14:33:03.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2114" PostTypeId="1" AcceptedAnswerId="2118" CreationDate="2011-06-03T20:01:41.447" Score="22" ViewCount="6948" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The Gabor wavelet is a kind of the Gaussian modulated sinusoidal wave (&lt;a href=&quot;http://spie.org/x648.html?product_id=447272&quot; rel=&quot;noreferrer&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Gabor wavelets are formed from two components, a complex sinusoidal carrier and a Gaussian envelope.  (&lt;a href=&quot;http://cnx.org/content/m12493/latest/&quot; rel=&quot;noreferrer&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lEQ3k.png&quot; alt=&quot;Figure 3: 1D Gabor Wavelet&quot;&gt;        &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In fact, the wavelet shown in Figure 2a (called the Morlet wavelet) is nothing more than a Sine wave (green curve in Figure 2b) multiplied by a Gaussian envelope (red curve). (&lt;a href=&quot;http://paos.colorado.edu/research/wavelets/wavelet2.html&quot; rel=&quot;noreferrer&quot;&gt;source&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HSvax.gif&quot; alt=&quot;Morlet wavelet&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are these just different names for the same thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not to be confused with the &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Gabor_transform&quot; rel=&quot;noreferrer&quot;&gt;Gabor transform&lt;/a&gt;&quot;, which seems to be just another name for &quot;STFT with a Gaussian window&quot;.  There's also the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gabor_atom&quot; rel=&quot;noreferrer&quot;&gt;Gabor atom&lt;/a&gt;, which I guess is the same as the Gabor wavelet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since asking this on math.SE, I've also found terms like &quot;&lt;a href=&quot;http://web.archive.org/web/20100317160411/http://dxjones.com/matlab/timefreq/&quot; rel=&quot;noreferrer&quot;&gt;Gabor/Morlet wavelet&lt;/a&gt;&quot; and &lt;a href=&quot;http://rocksolidimages.com/pdf/gabor.pdf&quot; rel=&quot;noreferrer&quot;&gt;&quot;Gabor-Morlet transform&quot;&lt;/a&gt;, implying that they are the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also this has been asked before: &lt;a href=&quot;http://www.dsprelated.com/showmessage/122107/1.php&quot; rel=&quot;noreferrer&quot;&gt;Gabor transform/wavelet vs. Morlet wavelet&lt;/a&gt; but the answers are not clear to me.&lt;/p&gt;&#xA;" OwnerUserId="29" OwnerDisplayName="endolith" LastEditorUserId="29" LastEditDate="2012-04-19T19:39:45.310" LastActivityDate="2022-03-16T23:57:50.593" Title="What's the difference between the Gabor and Morlet wavelets?" Tags="|wavelet|terminology|time-frequency|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2116" PostTypeId="2" ParentId="2109" CreationDate="2012-04-19T19:23:54.940" Score="7" Body="&lt;p&gt;The thing to understand here is exactly what all your transforms and data fiddling do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll consider a 1D discrete-time signal which is rather easier to explain and think about. The arguments extend easily to higher dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By taking the DFT of that signal, which has been windowed to a finite number of samples, N, to create a frame, one implicitly assumes that the N-length windowed signal is repeated infinitely in the time-domain, such that the zeroth sample is adjacent to the (N-1)th sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect of this tiling on what happens when you perform any filtering is two-fold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) If there is a big step between the 0th (which is also the Nth) sample and the (N-1)th (which is also the -1th) sample, this is going to introduce lots of high frequency components into the signal which probably don't correspond to anything physical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Filtering by windowing in the Fourier domain is equivalent to convolving with the inverse DFT of that window in the time-domain. Since there is an implicit repeating of the signal in the time domain, the lower samples of the frame &quot;leak&quot; energy into the upper samples of the frame, and vice-versa (alternatively: the ends of the frame are wrapped around and smeared together).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't escape these effects, it's the nature of doing discrete Fourier domain filtering. The question is, can one do anything sensible to alleviate them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer depends on knowledge about the signal. You mention zero sampling. Simple zero padding (with no edge roll-off) has the effect of &lt;em&gt;artifically&lt;/em&gt; introducing a big edge discontinuity. It's equivalent to convolving the Fourier domain signal with a Sinc function, which is likely going to complicate the required inverse filter. On the other hand, it may alleviate the second of the issues above because now there is a gap between the low samples and the wrapped-around high samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal naturally decays to zero at the edge of the frame, then zero padding is sensible and generally safe to separate the tiled versions of the frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are various alternative techniques to simply adding zero samples. One might be to time reverse the frame and concatenate it to the original, making a double length frame. This then guarantees that the signal has no big discontinuities. You can chop the frame in half at the end of the processing to get back what you actually need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another technique is to roll off the edges of the time domain signal to zero, typically with something like a raised cosine. This is far less harsh than than simply adding zeros to the time domain. Once the signal has reached zero, you can merrily add more zeros to pad it out if you wish. The length of the roll off is a design parameter, but a good starting point is something like the length of the blurring filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a case of understanding the signal and the effect of a given tweak as to whether it improves the result or not. I would generally expect to have to do something to alleviate the so called &lt;em&gt;edge effects&lt;/em&gt; that you're ostensibly trying to do with zero padding, but I'd try to be a bit more sophisticated about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One quick point, of which I'm sure you're aware (so for other people reading this). Simply dividing through by H without any form of regularisation is generally a &quot;bad&quot; thing to do. You need to make sure the signal doesn't become dominated by the very small values of H. That's another post though!&lt;/p&gt;&#xA;" OwnerUserId="1263" LastEditorUserId="1263" LastEditDate="2012-04-20T09:25:33.073" LastActivityDate="2012-04-20T09:25:33.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2117" PostTypeId="2" ParentId="2074" CreationDate="2012-04-19T19:26:43.597" Score="2" Body="&lt;p&gt;If I am understanding this paper please correct me if I am wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A common effect, usually associated with unstable zeroes and poles of the open&#xA;loop plant, makes it theoretically impossible to make certain closed loop transfer &#xA;functions “small” simultaneously at all frequencies:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is talking about Pole Zero Cancellation in realizable control systems. Essentially:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{s-\alpha}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;is unstable for a step response however:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{s-\alpha_1}{s-\alpha_2} = 1$$ where $$\alpha_1 = \alpha_2$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is stable; however, due to paramter variation (resistor/capacitor tolerance)  it is impossible to cancle out an unstable pole. alpha_1 and alpha_2 may never perfectly align to cancel each other out. (maybe through digital controls) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if amplitude of the frequency &#xA;response is reduced in one part of the spectrum, it may have to get larger in the other &#xA;part. This effect, sometimes called the waterbed effect, can be explained mathematically&#xA; in terms of integral inequalities imposed on the closed loop transfer functions. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Basically, if alpha_1 increses then this &quot;water bed effect&quot; is caused by alpha_2 draging down the frequency response longer becofre alpha_1 zero kicks in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;essentially the Frequency repsonse would look like this if they werent matched:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;--------\&#xA;         \&#xA;          \-------------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of this when they are matched exactly which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;----------------------------------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(That is, a flat response) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the opposit happens (alpha_2 is made larger, you should see the opposit effect of this response)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             -----------------&#xA;             /&#xA;            /&#xA;      -----/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In the basis of such results is the affine characterization of all possible &#xA;closed loop responses, as well as the Cauchy integral relation for analytical     &#xA;functions.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is answered by &lt;a href=&quot;http://www.myoops.org/twocw/mit/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-245Spring2004/FDA57FC1-D2D7-4064-86C7-18887162EF73/0/lec5_6245_2004.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; paper:&lt;/p&gt;&#xA;" OwnerUserId="1183" LastActivityDate="2012-04-19T19:26:43.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2118" PostTypeId="2" ParentId="2114" CreationDate="2012-04-19T21:53:13.787" Score="13" Body="&lt;p&gt;The Gabor wavelet is basically the same thing.  It's apparently another name for the Modified Morlet wavelet. Quoting from &lt;a href=&quot;http://books.google.com/books?id=Xyw5JA6bCe4C&amp;amp;lpg=PA3&amp;amp;dq=wavelets%20and%20signal%20processing&amp;amp;pg=PA12#v=onepage&amp;amp;q&amp;amp;f=false&quot;&gt;Wavelets and Signal Processing&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[The Modified Morlet wavelet] does not satisfy the admissibility&#xA;  condition but is nonetheless commonly used.  Sometimes this wavelet is&#xA;  called the &quot;Gabor wavelet,&quot; but that term is improper because Gabor&#xA;  had nothing to do with wavelets.  He was ... one of the founders of&#xA;  time-frequency analysis.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That book is a collection of papers, and that paper (&quot;The Wavelet Transform and Time-Frequency Analysis&quot;) is by Leon Cohen (of time-frequency distribution &quot;Cohen class&quot; fame), so I think it's reasonably authoritative.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the very least, it sounds like the confusion is just a naming disagreement.  According to &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0817637117&quot;&gt;A Friendly Guide to Wavelets&lt;/a&gt; (pg. 114), Gabor was the first person to propose the use of Gaussian windows for time-frequency localizations, so his name tends to get attached anytime they're involved.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2012-04-19T21:53:13.787" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2119" PostTypeId="1" AcceptedAnswerId="2127" CreationDate="2012-04-19T21:58:01.520" Score="5" ViewCount="466" Body="&lt;p&gt;I have an auto-correlation function that was generated from a signal, and I am trying to extract its 'repetition rate' in order to calculate the dominant frequency of the pulse, but I am not exactly clear how to do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two cases, labelled 'good' and 'bad' to mark best/worst case scenarios. What methodologies exist that I can use here? Since the repetitions are not sinusoidal, the spectrum does not seem to yield good information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the original 'good' case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yQPxR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;followed by its auto-correlation.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SUzfn.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, here is the original 'bad' case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n4QZf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;again followed by its auto-correlation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l70Z9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: Raw data files as requested:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/4724281/raw1.mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;Raw1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/4724281/raw2.mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;Raw2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT On Feedback:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectral analysis was suggested, however I did not have too much luck with it as the spectrum does not look too sharp around the region where you would expect it to. I think this may to due to the fact that the signal is not a repetitive sinusoid and so projecting it on sinusoidal bases does not do too well.  &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-04-20T03:42:14.480" LastActivityDate="2012-04-22T10:03:05.597" Title="Extraction of non-sinusiodal repetition rates" Tags="|frequency|autocorrelation|pitch|" AnswerCount="3" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2120" PostTypeId="1" AcceptedAnswerId="2125" CreationDate="2012-04-19T22:54:51.870" Score="2" ViewCount="707" Body="&lt;p&gt;I've got a sliding DFT implementation that appears to be working (judging from an output plot). I would like to be able to invert this implementation using the standard tricks of swapping the real and imaginary components or conjugating my data. However, when I attempt this my output looks nothing like the original. I also end up with a strong imaginary component where that was not expected. (I'm not entirely sure on the proper range of output for each pass through this filter.) Can you see anything obviously wrong with this code? Thanks for your time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    [TestMethod]&#xA;    public void TestInverseDft()&#xA;    {&#xA;        var rand = new Random(42);&#xA;        var dataSize = 50000;&#xA;        var data = new List&amp;lt;Complex&amp;gt;(dataSize);&#xA;        for(int i = 0; i &amp;lt; dataSize; i++)&#xA;            data.Add(new Complex(rand.NextDouble() * 2.0 - 1.0, 0.0));&#xA;&#xA;        var clone = new List&amp;lt;Complex&amp;gt;(data);&#xA;&#xA;        var n = SlidingDFT(data, 44100, 12, 55, 13);&#xA;&#xA;        Swap(data);&#xA;        SlidingDFT(data, 44100, 12, 55, 13);&#xA;        Swap(data);&#xA;&#xA;        for(int i = 15000; i &amp;lt; dataSize - 15000; i++)&#xA;            Assert.AreEqual(clone[i].Real, data[i].Real / n, 0.00001);&#xA;    }&#xA;&#xA;    public static int SlidingDFT(IList&amp;lt;Complex&amp;gt; data, int sampleRate, int binsPerOctave, double minFrequency, int stepsFromMin)&#xA;    {&#xA;        var Q = 1.0 / (Math.Pow(2.0, 1.0 / binsPerOctave) - 1.0); // denominator * Fk gives size of bin &#xA;        var k = (int)(Q + 0.5);&#xA;&#xA;        // frequency at k:&#xA;        var Fk = minFrequency * Math.Pow(2.0, (double)stepsFromMin / binsPerOctave);&#xA;        var Nk = (int)(Q * sampleRate / Fk + 0.5);&#xA;        Complex exp = Complex.Exp(new Complex(0.0, 2.0 * Math.PI * k / Nk));&#xA;        var current = data[0];&#xA;        for(int x = 0; x &amp;lt; data.Count - 1; x++)&#xA;        {&#xA;            var lookahead = x + Nk &amp;gt;= data.Count ? new Complex() : data[x + Nk];&#xA;            var fx = (lookahead - current) + data[x]; //  * 0.9999999 if unstable?&#xA;            current = data[x + 1];&#xA;            data[x + 1] = fx * exp;&#xA;        }&#xA;        return Nk;&#xA;    }&#xA;&#xA;    public static void Conjugate(IList&amp;lt;Complex&amp;gt; data)&#xA;    {&#xA;        for(int i = 0; i &amp;lt; data.Count; i++)&#xA;            data[i] = Complex.Conjugate(data[i]);&#xA;    }&#xA;&#xA;    public static void Swap(IList&amp;lt;Complex&amp;gt; data)&#xA;    {&#xA;        for(int i = 0; i &amp;lt; data.Count; i++)&#xA;            data[i] = new Complex(data[i].Imaginary, data[i].Real);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1192" LastActivityDate="2012-04-20T03:38:11.023" Title="Sliding DFT: I think my results are accurate, but I can't buy a swap-swap IDFT" Tags="|dft|infinite-impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2121" PostTypeId="1" AcceptedAnswerId="2128" CreationDate="2012-04-20T00:01:13.623" Score="5" ViewCount="4444" Body="&lt;p&gt;I just need some clarification of some very basic aspects of creating a frequency analyzer.  I am writing a c++ program, so far it is just a media player, with a custom explorer.  You can make playlists, shuffle, repeat etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my goal is to continue to add functionality.  So far, I just have a signal level meter, and I am now trying to add a frequency analyzer.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using fftReal.  So I am at the stage where I have the output, and I am scaling to dbfs like so which I think is correct, but not exactly sure.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int i=0; i &amp;lt; fftsize/2; ++i)&#xA;    db[i]=20*log(sqrt(imaginary[i]*imaginary[i]+real[i]*real[i]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I know I should apply a window function somewhere, and I'm trying to understand how to do that.  But I am wondering this as well.  If I want to display the data as rectangles popping up and down rather than plotting points and connecting with lines, and I want to limit the amount of rectangles to about 50 or so.  Do I take the average db of a range.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice that in many applications, the frequency scale is skewed, where the higher frequency, the small distance between units.  What kind of scale is used, and how can I break up the spectrum so that I have a nice visual?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sorry if this has all been discussed before, I have been googling for a while now, and overall I am overwhelmed with information, but there are a just a few key thing which I need to understand first.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1255" LastEditorUserId="1255" LastEditDate="2012-04-20T00:13:56.547" LastActivityDate="2012-04-20T14:57:43.163" Title="I need advice about how to make an audio frequency analyzer" Tags="|fft|frequency|window-functions|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2122" PostTypeId="2" ParentId="2121" CreationDate="2012-04-20T00:24:08.683" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So I know I should apply a window function somewhere, and I'm trying to understand how to do that.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Multiply the chunk of signal by the window function &lt;em&gt;before&lt;/em&gt; doing the FFT.  The FFT operates on the signal as if it were wrapping around and repeating forever, so if the beginning and end don't line up (and they almost never do), it produces a discontinuity, which produces big &quot;skirts&quot; on the frequency peaks.  The window function tapers the signal off the beginning and end (fades in and out) so that there are no discontinuities.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;and I want to limit the amount of rectangles to about 50 or so. Do I take the average db of a range.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Don't take the average of the dB.  Probably the maximum bin in the range is what you want.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I notice that in many applications, the frequency scale is skewed, where the higher frequency, the small distance between units. What kind of scale is used, and how can I break up the spectrum so that I have a nice visual?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is just a logarithmic frequency axis.  Since dB is logarithmic, the combination is actually a &lt;a href=&quot;https://en.wikipedia.org/wiki/Log-log_plot&quot; rel=&quot;nofollow&quot;&gt;log-log plot&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you going to do a log freq axis and then divide it up into equally-spaced bins?  So they'll actually be logarithmically-spaced bins?  The FFT bins are linearly-spaced, so each logarithmically-spaced bin would contain different numbers of FFT bins.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-04-20T00:29:34.133" LastActivityDate="2012-04-20T00:29:34.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2123" PostTypeId="2" ParentId="2111" CreationDate="2012-04-20T00:45:37.507" Score="6" Body="&lt;p&gt;You can borrow from techniques used by the image stitching community, where they have to deal with &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_registration&quot; rel=&quot;nofollow&quot;&gt;registering&lt;/a&gt; translated and rotated images. Your mistake was that you calculated the correlation before finding the optimal translation. &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_registration&quot; rel=&quot;nofollow&quot;&gt;The Wikipedia article&lt;/a&gt; should give you enough information to help yourself.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Mathematica Example&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;First, I split the picture above into &lt;code&gt;frame1.png&lt;/code&gt; and &lt;code&gt;frame2.png&lt;/code&gt;. Then I shifted the second one to align with the first, and trimmed both to retain their intersection. Finally, I compute the correlation coefficient by flattening the matrix into a vector.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img1 = ColorConvert[Import[&quot;frame1.png&quot;], &quot;Grayscale&quot;]&#xA;img2 = ColorConvert[Import[&quot;frame2.png&quot;], &quot;Grayscale&quot;]&#xA;im2t = ImageAlign[img1, img2, &quot;Transformation&quot; -&amp;gt; &quot;Translation&quot;]&#xA;imgtr = FindGeometricTransform[img1, img2, &quot;Transformation&quot; -&amp;gt; &quot;Translation&quot;]&#xA;{trx, try} = Part[TransformationMatrix@Last@imgtr, {1, 2}, 3]&#xA;{trim1, trim2} = ImageTake[#, {1, Floor@try}, {1, Floor@trx}] &amp;amp; /@ {img1, im2t}&#xA;{cimg1, cimg2} = Flatten@First@ImageData[#, &quot;Interleaving&quot; -&amp;gt; False] &amp;amp; /@ {trim1, trim2};&#xA;Correlation[cimg1, cimg2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result I got was &lt;strong&gt;0.967834&lt;/strong&gt;, indicating a close match. If necessary I would have considered scaling and rotation to better align the images but it was not necessary here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://thilinasameera.wordpress.com/2012/03/24/translation-invariant-image-registration-using-phase-correlation-panorama-imaging-on-matlab/&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a MATLAB example.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2012-05-18T23:43:13.773" LastActivityDate="2012-05-18T23:43:13.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2124" PostTypeId="2" ParentId="2121" CreationDate="2012-04-20T01:12:37.987" Score="5" Body="&lt;p&gt;As endolith said, you want to use log-scale bins.  The easiest way to do that is to combine multiple bins at the higher frequencies.  To do it right you need to add the energy in the different bins, not average them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you are calculating dB incorrectly.  &quot;log&quot; does the natural logarithm.  You want &quot;log10&quot;.  Also, you don't need to do sqrt.  You can get rid of the sqrt and change the 20 multiplier to 10.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;db[i]=10*log10(imaginary[i]*imaginary[i]+real[i]*real[i]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: When adding the energy in the various bins together, add them as linear values, not dB.  Once you have finished adding them, then convert to dB.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-04-20T14:57:43.163" LastActivityDate="2012-04-20T14:57:43.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2125" PostTypeId="2" ParentId="2120" CreationDate="2012-04-20T03:38:11.023" Score="3" Body="&lt;p&gt;I haven't tried to run your code (is that C#?) or looked at it in great detail, but &lt;code&gt;SlidingDFT()&lt;/code&gt; looks more like a &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow&quot;&gt;Goertzel algorithm&lt;/a&gt; implementation to me. It should be a red flag to you that you're able to perform the calculations in place. If you were truly doing a sliding DFT, then you would have a data rate expansion by a factor of $N$, the length of the transform; for each input time-domain sample, you generate a full DFT's worth of outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Goertzel algorithm is an efficient, recursive structure for implementing a single DFT bin at an arbitrary center frequency, which can be useful for applications like &lt;a href=&quot;http://en.wikipedia.org/wiki/Dtmf&quot; rel=&quot;nofollow&quot;&gt;DTMF&lt;/a&gt; decoding. However, you can't &quot;invert&quot; it in the sense that you're trying to; it is more of a filtering operation, not a reversible transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't seem to make sense to me to even try to invert a sliding DFT in the way you've shown; the outputs of a sliding DFT don't &quot;slide&quot; sample-by-sample the same way as the time-domain inputs do. I'd read up some more on how the DFT and its sliding version works.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-20T03:38:11.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2126" PostTypeId="2" ParentId="2119" CreationDate="2012-04-20T03:51:02.707" Score="6" Body="&lt;p&gt;One would expect such a sequence to have a spectrum consisting of lines, as it is almost periodic (if it was periodic, it would have a &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fourier series&lt;/a&gt; representation, even though it is not sinusoidal).  As a quick example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;load raw1.mat&#xA;% calculate &quot;unbiased&quot; normalized cross-correlation; adjusted for&#xA;% regions where there isn't full overlap&#xA;corr = xcorr(raw1,'unbiased');&#xA;% calculate oversampled FFT to help in illustration&#xA;C = fft(corr, 65536);&#xA;% plot FFT to see peaks&#xA;figure; plot((-32768:32767)/65536, abs(fftshift(F))); grid on;&#xA;% zoom in to interesting area (X-axis is in normalized frequency)&#xA;set(gca,'XLim',[0 0.01]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zuPlO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first peak is at zero frequency, due to the nonzero mean of the autocorrelation signal. The next, fundamental frequency peak is at approximately $0.00141$, which compares favorably to the previously-determined estimate of $\frac{1}{650} = 0.00153$. This implies that the overall period of the autocorrelation sequence is approximately $\frac{1}{0.00141} = 709$ samples.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-20T03:51:02.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2127" PostTypeId="2" ParentId="2119" CreationDate="2012-04-20T03:58:34.550" Score="9" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;You are right that the repetition is around 650 by how exactly do I compute that automatically? Seems like a peak-picking problem to me? Or is there some other methods that can be used?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, it's just peak-picking.  Your period is the x value of the first strong peak:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q9VVL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your peaks are all similar in height, probably because you're doing the autocorrelation using the FFT?  So it's a circular autocorrelation.  You can &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;make it non-circular by zero-padding before doing the FFT, or &lt;/li&gt;&#xA;&lt;li&gt;could skew the plot you currently have by adding a linear function that emphasizes the peaks close to 0 and reduce the height of the farther ones.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It depends on what you're specifically looking for.  In either case you then have to pick the highest peak that's not at 0 lag.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I adapted my script from &lt;a href=&quot;https://gist.github.com/255291&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and it (surprisingly) worked without any tweaking:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r8EV9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;raw1 x = 709.23&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0DGSu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;raw2 x = 710.77&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pylab import *&#xA;&#xA;# Import matlab files&#xA;import scipy.io&#xA;#sig = scipy.io.loadmat('raw1.mat')['raw1'][0]&#xA;sig = scipy.io.loadmat('raw2.mat')['raw2'][0]&#xA;&#xA;# Calculate autocorrelation (same thing as convolution, but with&#xA;# one input reversed in time)&#xA;corr = fftconvolve(sig, sig[::-1], mode='full')&#xA;&#xA;# throw away the negative lags, so x = 0 means 0 lag&#xA;corr = corr[len(corr)/2:]&#xA;&#xA;# Find the first low point from derivative&#xA;d = diff(corr)&#xA;start = find(d &amp;gt; 0)[0]&#xA;&#xA;# Starting at the first low point, find the highest peak&#xA;peak = argmax(corr[start:]) + start&#xA;&#xA;# Fit parabola to estimate more precise location of peak&#xA;px, py = parabolic(corr, peak)&#xA;&#xA;plot(corr)&#xA;axvline(px, color='r')&#xA;&#xA;print px&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The variable &lt;code&gt;peak&lt;/code&gt; is the integer x value at the peak (709).  Then the &lt;a href=&quot;https://gist.github.com/255291#file_parabolic.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;parabolic function&lt;/a&gt; fits a parabola to the peak and tries to get a more precise estimate (709.232...), which may or may not be relevant to what you're doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The python &lt;code&gt;fftconvolve()&lt;/code&gt; function does zero-padding internally to produce a linear convolution, &lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.convolve.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;like &lt;code&gt;convolve()&lt;/code&gt; does&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-04-20T04:50:32.053" LastActivityDate="2012-04-20T04:50:32.053" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2128" PostTypeId="2" ParentId="2121" CreationDate="2012-04-20T11:45:56.253" Score="8" Body="&lt;p&gt;This really depends on how fancy you want to get. A &quot;good&quot; analyzer will typically do the following things.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Split the input into frames. The frames typically overlap and are windowed. Good choices are an overlap of 50% and a Hanning window.&lt;/li&gt;&#xA;&lt;li&gt;Do an FFT&lt;/li&gt;&#xA;&lt;li&gt;Select the center frequencies of bands. For audio good choices are octaves or third octaves (see &lt;a href=&quot;http://www.engineeringtoolbox.com/octave-bands-frequency-limits-d_1602.html&quot;&gt;http://www.engineeringtoolbox.com/octave-bands-frequency-limits-d_1602.html&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;For each integrate the FFT energy around the center frequency. There are different choices for the integration windows. Good choices are trapezoids or butterworth windows. A really good window choice will make sure that all the energy is accounted for, i.e. that the sum of the band energies equals the sum of all FFT bins.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If the number of frequency bands is relatively small, it is more efficient and easier to simply use a bank of parallel bandpass filters and an RMS detector. This also allows to dial in the temporal behavior of the display nicely. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-20T11:45:56.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2130" PostTypeId="1" AcceptedAnswerId="2131" CreationDate="2012-04-20T12:57:29.867" Score="8" ViewCount="796" Body="&lt;p&gt;I need to do a FFT on an image for noise reduction, but the problem is that I do not need the complete image, but only a circle in the middle. The borders are a fixed rig, thus I am not interested in what it displays, but it has an impact on the result of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to just cut out a circular part and use that for the FFT? Note that if I use black background, the edge between background, and image data will have quite an impact.&lt;/p&gt;&#xA;" OwnerUserId="1269" LastActivityDate="2012-04-22T17:10:58.120" Title="FFT on non-rectangular part of image" Tags="|fft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2131" PostTypeId="2" ParentId="2130" CreationDate="2012-04-20T13:22:03.760" Score="7" Body="&lt;p&gt;Instead of having a hard edge between the image data of interest and the background, you could use a two-dimensional tapered &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot;&gt;window function&lt;/a&gt;, as is often done in spectral analysis. You might start by trying a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function#Gaussian_windows&quot;&gt;Gaussian window&lt;/a&gt;, which for a two-dimensional case would look something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;w[x,y] = e^{-\frac{\left(x-\frac{N_x-1}{2}\right)^2}{2\left(\sigma_x \frac{N_x-1}{2}\right)^2}} e^{-\frac{\left(y-\frac{N_y-1}{2}\right)^2}{2\left(\sigma_y \frac{N_y-1}{2}\right)^2}}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N_x$ and $N_y$ are the dimensions of the desired transform in the $x$ and $y$ directions, respectively, and $\sigma_x$ and $\sigma_y$ are parameters that allow you to control the shape of the window; for small $\sigma$ values, most of the energy in the window function will be concentrated toward the center, with that effect decreasing as you increase $\sigma$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-20T13:22:03.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2132" PostTypeId="1" AcceptedAnswerId="2136" CreationDate="2012-04-20T14:27:48.390" Score="10" ViewCount="313" Body="&lt;p&gt;I'm trying to automatically detect some medical defined anatomical landmarks in a CT reconstructed volume. Medical doctors use these landmarks to measure some patient specific parameters.&#xA;I have attempted to use the SIFT feature descriptor, since these anatomical landmarks are kind of &quot;keypoints&quot;. This did not work very well since the landmarks are points (or tiny regions) that are in general not &quot;interest points&quot; as defined by SIFT.&#xA;I have been looking many pattern/template matching algorithms but, when I do not have rotation/translation/scale problems, I find that the extracted features do not differentiate each landmark enough (from the rest of the landmarks and from the rest of the non landmark patches) to train a classifier that performs well enough (at least an 80% of detection accuracy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if I'm not stating the problem clearly enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate any advise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JJaek.png&quot; alt=&quot;The small x crosses are the landmarks I want to detect. The lines represent the measures taken. These are some slices of different cases (of course, I cannot post the full 3D volume)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The small x crosses and little squares are over the landmarks I want to detect (I forgot to mention that I have a training set, with the labeled landmarks). The white lines represent the measures taken. These are some slices of different cases (of course, I cannot post the full 3D volume).&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="205" LastEditDate="2012-04-20T15:11:14.483" LastActivityDate="2012-04-20T16:13:24.347" Title="Advise on detecting anatomical landmarks in a CT reconstructed volume" Tags="|image-processing|3d|template-matching|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2133" PostTypeId="1" AcceptedAnswerId="2135" CreationDate="2012-04-16T04:39:35.913" Score="10" ViewCount="2424" Body="&lt;p&gt;I've been looking into marker detection algorithms to use with a kinect based application, and the majority of the work I've been able to find is obviously focused on feature detection in 'normal' images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the kinect hardware provides (essentially, once you've adjusted) an 11-bit depth value per pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This depth image also has various visual artifacts in it from the shadows cast around the edges of objects (see for example the strong black border in this video &lt;a href=&quot;http://www.youtube.com/watch?v=-q8rRk8Iqww&amp;amp;feature=related&quot;&gt;http://www.youtube.com/watch?v=-q8rRk8Iqww&amp;amp;feature=related&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While some traditional machine vision techniques (eg. edge detection) work well with this, others don't, and it seems like there's little information on the net discussing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a simple example, using the depth value makes it trivial to detect the orientation of a marker block once you've located it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, has anyone seen any discussions / papers / etc. that cover processing a depth image for feature detection?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone recommend a good algorithm for detecting &quot;depth&quot; markers (effectively origami blocks instead of printed b/w markers)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've done so far has been adhoc experimentation using opencv to process the images, but  that's no where near stable or fast enough.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you link to a commercial machine vision product without some kind of trial, please mention in your answer why you think it's appropriate. &lt;/p&gt;&#xA;" OwnerUserId="1277" OwnerDisplayName="Doug" LastActivityDate="2012-04-20T15:41:32.487" Title="Are there any computer vision algorithms specifically targeting depth images?" Tags="|computer-vision|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2134" PostTypeId="2" ParentId="2133" CreationDate="2012-04-19T08:31:10.780" Score="7" Body="&lt;p&gt;You got all the key words right, I'm surprised that you really didn't find any related articles while looking for material.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, I have access to IEEE Xplore digital library. I din't need any of these particular algorithms before, but it looks very interesting so here are some results from a quick search that I think might be relevant (don't judge them by their titles, look at their abstracts):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=6130300&amp;amp;contentType=Conference+Publications&amp;amp;searchField%3DSearch_All%26queryText%3Dkinect+features&quot;&gt;Kinezaki, A., Harada, T., Kuniyoshi, Y.: Scale and rotation invariant color features for weakly-supervised object Learning in 3D space&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=6095119&amp;amp;contentType=Conference+Publications&amp;amp;searchField%3DSearch_All%26queryText%3Dkinect+features&quot;&gt;Bo, L., Ren, X., Fox, D.: Depth kernel descriptors for object recognition&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=4379404&amp;amp;contentType=Conference+Publications&amp;amp;searchField%3DSearch_All%26queryText%3Ddepth+image+processing&quot;&gt;Ji-Ho Cho, In-Yeop Chang, Seung-man Kim, Lee, K.H.:Depth Image Processing Technique for Representing Human Actors in 3DTV using Single Depth Camera&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=5463157&amp;amp;contentType=Conference+Publications&amp;amp;searchField%3DSearch_All%26queryText%3Ddepth+image&quot;&gt;Pei-Jun Lee, Effendi: Adaptive edge-oriented depth image smoothing approach for depth image based rendering&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=4803479&amp;amp;contentType=Conference+Publications&amp;amp;searchField%3DSearch_All%26queryText%3D3d+images&quot;&gt;Pedersen, P.C., Quartararo, J.D., Szabo, T.L.: Segmentation of speckle-reduced 3D medical ultrasound images&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=5639645&amp;amp;contentType=Conference+Publications&amp;amp;searchField%3DSearch_All%26queryText%3D3d+images&quot;&gt;Liuhang Cheng, Lisheng Wang, Yu Ma: A new strategy for boundary surface detection in 3D biomedical image&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I don't think you can access any of these papers for free, at least not via the IEEE Xplore library. If you don't have access, you can probably get by with &lt;em&gt;Google scholar&lt;/em&gt;, and there are some free paper databases out there (I used &lt;a href=&quot;http://www.mendeley.com/&quot;&gt;Mendeley database&lt;/a&gt; back when I didn't have IEEE access yet). Also, just Googling parts of the abstract or random parts of the paper sometimes yields some results (you might stumble across a almost finished pre-published versions of the article).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The search queries I used to find the mentioned papers were: &lt;em&gt;3D image&lt;/em&gt;, &lt;em&gt;depth image&lt;/em&gt;, &lt;em&gt;kinect&lt;/em&gt;. You might also want to throw in &lt;em&gt;processing&lt;/em&gt; when looking up the first two queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps some! I feel sorry I can not get in to the subject more, sounds really interesting.&lt;/p&gt;&#xA;" OwnerUserId="1273" OwnerDisplayName="penelope" LastActivityDate="2012-04-19T08:31:10.780" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2135" PostTypeId="2" ParentId="2133" CreationDate="2012-04-20T15:25:20.250" Score="8" Body="&lt;p&gt;My favourite 2.5D/3D feature descriptor for registration and recognition is the &lt;a href=&quot;http://www.ri.cmu.edu/pub_files/pub2/johnson_andrew_1999_1/johnson_andrew_1999_1.pdf&quot;&gt;spin image&lt;/a&gt; (original paper + more details in &lt;a href=&quot;http://www.ri.cmu.edu/publication_view.html?pub_id=559&quot;&gt;Ph.D. thesis&lt;/a&gt; and &lt;a href=&quot;http://www.cs.cmu.edu/~vmr/software/meshtoolbox/executables.html&quot;&gt;software&lt;/a&gt; available from CMU).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other recent advances (all searchable on-line for suitable algorithims) include: 3D-Sift, Fast Point Feature Histogram,  Normal Aligned Radial Features (NARF), Depth Kernel Descriptors. Older methods simply used surface properties such as curvature and edges to identify region patches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is best? Depends on what you want to find, viewpoint invariance, additional clutter, etc.&lt;/p&gt;&#xA;" OwnerUserId="1271" OwnerDisplayName="Tim Lukins" LastActivityDate="2012-04-20T15:25:20.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2136" PostTypeId="2" ParentId="2132" CreationDate="2012-04-20T16:13:24.347" Score="5" Body="&lt;p&gt;I hesitate to write this as an answer, but given that you're asking only for advice, I will do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest investigating techniques based on the Dual-Tree Complex Wavelet Transform (DTCWT). These have shown to be useful for generating descriptors that have good tolerance to shift, scale and rotation of the source images. It's not the classic problem in that you're not allowing the points to be assigned for you, but I suspect with some thought you can adapt the techniques to predefined landmarks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, the landmarks have some interest from the perspective of a clinician, so there is something of interest about them - it's simply a case of modelling that in the descriptor. Wavelet techniques (in particular the DTCWT) tend to be good at modelling features that the eye picks up on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A starting point would probably be &lt;a href=&quot;http://www-sigproc.eng.cam.ac.uk/%7Engk/publications/Nelson_shiftscaletol_TrIP_2010.pdf&quot;&gt;this fairly recent paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1263" LastActivityDate="2012-04-20T16:13:24.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2137" PostTypeId="2" ParentId="2119" CreationDate="2012-04-20T17:01:53.147" Score="1" Body="&lt;p&gt;If you can model your noise and signal then a good technique might well be bayesian inference for a general linear model. &lt;a href=&quot;http://www.amazon.co.uk/Numerical-Bayesian-Processing-Statistics-Computing/dp/0387946292/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1334940430&amp;amp;sr=1-1#reader_0387946292&quot; rel=&quot;nofollow&quot;&gt;This book&lt;/a&gt; has an excellent introduction to the techniques and demonstrates them applied to inferring the frequency of a single sinusoid in (lots of) noise. Although this is not really my area, I &lt;em&gt;think&lt;/em&gt; it will apply to a more complex model such as yours (as long as you can formulate it as a GLM). It might even work on the single sinusoid model. The link is to Amazon's page where they kindly provide a partial preview up to the chapter of interest (chapter 2). Another link by the same author which is more complete compared to the amazon page is on a &lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=8&amp;amp;ved=0CGIQFjAH&amp;amp;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.30.8249%26rep%3Drep1%26type%3Dpdf&amp;amp;ei=NqORT-HCH6Gm0QWLr5jOAQ&amp;amp;usg=AFQjCNGi59_RxuSrTIaGh15jK1SzzOCvPQ&quot; rel=&quot;nofollow&quot;&gt;change point detector&lt;/a&gt; using a GLM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should prefix the following by reiterating that this is not my area, so I hope there are no errors, but I don't guarantee it. For a &lt;em&gt;proper&lt;/em&gt; treatment, see the references.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can represent your signal as a general linear model if you can represent it as follows:&#xA;$$&#xD;&#xA;\mathbf{d} = \text{G}\mathbf{b} + \mathbf{e}&#xD;&#xA;$$&#xA;where $\mathbf{d}$ is the Nx1 vector of measured noisy data points, $\mathbf{e}$ is the Nx1 vector of noise samples. $\text{G}$ is the NxQ matrix of basis vectors describing the signal. This is parameterised as you see fit (ideally with as few parameters as possible). Think of this as the function that can you can use to create your measured signal in the absence of noise. You get one $\text{G}$ for each parameter you choose, and you need to compute the probability at that point, so too many parameters makes the problem intractable. $\mathbf{b}$ is the Qx1 weighting vector of the basis functions given by the columns of $\text{G}$. Imagine you signal is some sinusoid, then the basis functions are a cosine and a sine wave (of the same frequency). If it was a pure cosine, then the weighting for the sine basis would be zero. If it was a pure sine wave, then the weighting for the cosine basis would be zero. Anything else and you'd need to sum a bit of each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under some basic assumptions about the noise being Gaussian and the priors on the other parameters (discussed in the reference book), one can come up with a marginal posterior distribution on the basis parameters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;p\left(\mathbf{w}_m|\mathbf{d},M\right) \propto \frac{\left[\mathbf{d}^{\text{T}}\mathbf{d} - \mathbf{d}^{\text{T}}\text{G}\left(\text{G}^{\text{T}}\text{G}\right)^{-1}\text{G}^{\text{T}}\mathbf{d}\right]^{\frac{-\left(N-Q\right)}{2}}&#xD;&#xA;}{\sqrt{\text{det}\left(\text{G}^{\mathbf{T}}\text{G}\right)}}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a bit flakey as to what $M$ represents, but I &lt;em&gt;think&lt;/em&gt; it's a placeholder for &quot;what we know and assumed&quot;. $\mathbf{w}_m$ denotes the parameters of the basis functions (which essentially define $\text{G}$). By calculating the above for lots of $\mathbf{w}_m$ vectors, you get something akin to a probability distribution over the space of little $m$ (albeit, unnormalised).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially what you yield with these techniques is a probability distribution over the parameter that you care about (in this case, frequency), from which you can pick the &quot;most likely&quot; value. The point is that you factor knowledge about what to expect into the inference, this means you're massively restricting your search space.&lt;/p&gt;&#xA;" OwnerUserId="1263" LastEditorUserId="1263" LastEditDate="2012-04-22T10:03:05.597" LastActivityDate="2012-04-22T10:03:05.597" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2138" PostTypeId="2" ParentId="2130" CreationDate="2012-04-20T18:15:20.993" Score="3" Body="&lt;p&gt;Use a &lt;strike&gt;tapered flat-top&lt;/strike&gt; window function with a flat top and edge taper, such as a tapered cosine window or Tukey window (spin it around a polar axis to make it a circular 2D template), and zero-pad as needed for any fast-convolution filtering.  The window going to zero at the edges will reduce the effect of the edge discontinuities from the circle on the FFT.  After your filtering or other processing, blend the result back in using the subtractive inverse of your window function on the existing image data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-04-21T06:55:11.470" LastActivityDate="2012-04-21T06:55:11.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2139" PostTypeId="2" ParentId="1365" CreationDate="2012-04-20T19:17:23.163" Score="3" Body="&lt;p&gt;As a starting point I would use a non-linear shrinkage technique with a some kind of wavelet transform (though they are not specific to wavelet transforms). Shrinkage rules are conceptually simple, fast and easy to implement, whilst yielding excellent results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The premise is that your desired signal can be represented in some domain such that most of the energy is concentrated in to a small number of coefficients. Conversely, the noise is still spread out over all the coefficients (which it likely is for AWGN). You can then &quot;shrink&quot; the coefficients - reducing their values according to some non-linear rule - such that the impact on the signal is small compared to the impact on the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelet transforms are a good transform to use because they are good at compressing the energy into small number of coefficients. I personally recommend the Dual-tree complex wavelet transform (DTCWT) for its additional nice properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 very good papers on the topic are &lt;a href=&quot;http://eeweb.poly.edu/iselesni/pubs/BiShrinkSPL.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://eeweb.poly.edu/iselesni/pubs/BiShrinkTSP.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; (both from the same authors). The papers are a real treat in terms of their readability and clarity of explanation. (also there are nice pictures of Lenna being denoised :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are certainly more recent papers, but they typically don't add much quantitative improvement over the very simple techniques described in those papers.&lt;/p&gt;&#xA;" OwnerUserId="1263" LastActivityDate="2012-04-20T19:17:23.163" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2140" PostTypeId="1" CreationDate="2012-04-20T20:42:40.690" Score="9" ViewCount="2297" Body="&lt;p&gt;(I'm just learning a little about system identification so apologies in advance if this question is badly worded)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you go about choosing drive signals for system identification? I've seen PRBS signals used but it seems like that's going to work well for frequencies around the chip rate but not really low frequencies; I've also seen frequency sweeps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a SISO system that I know is close to a 2nd order linear system with poles in a certain range, and I can drive it with an arbitrary signal up to some amplitude A for up to some time length T, how do I pick a signal that would give me the best responses for determining the accuracy of the transfer function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried googling for &quot;system identification drive signals&quot; but I don't see anything that pertains to my question.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;edit: one particular type of SISO system I've dealt with is an (input=power dissipation, output=temperature) system for power semiconductor thermal behavior, and it seems very hard to model because there's usually a dominant pole at very low frequencies (&amp;lt;1Hz) and the next one might be 100 times higher, so any high-frequency drive signals just get very heavily attenuated.&lt;/p&gt;&#xA;" OwnerUserId="829" LastEditorUserId="128" LastEditDate="2020-03-01T11:58:52.307" LastActivityDate="2020-03-01T11:58:52.307" Title="Choosing Drive Signals for System Identification?" Tags="|system-identification|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2141" PostTypeId="2" ParentId="2140" CreationDate="2012-04-20T21:24:04.740" Score="4" Body="&lt;p&gt;For linear systems, you can completely characterize the transfer function using its frequency response, so a frequency sweep would be one possible choice. However, you would need to ensure that at each test frequency, you allow time for the system's transient response to die out before measuring its steady-state amplitude/phase response.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-20T21:24:04.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2142" PostTypeId="2" ParentId="2140" CreationDate="2012-04-20T21:27:27.867" Score="4" Body="&lt;p&gt;If by system identification you mean determining the impulse response of a &lt;em&gt;linearized model&lt;/em&gt; of your actual system, then pseudorandom binary sequence&#xA;(PRBS) signals are a good way to go. With chipping rate $T^{-1}$ and &#xA;$N$ chips in each period of the PRBS, the PRBS signal has period $NT$ &#xA;seconds, and it is important to choose $N$ and $T$ so that &#xA;period of the PRBS signal is quite a bit longer than what you believe &#xA;is the duration of the&#xA;impulse response. Then, the periodic (or circular or cyclic)&#xA;cross-correlation function of the periodic input signal and &#xA;the periodic output signal  &lt;em&gt;computed over a full period&lt;/em&gt;  is&#xA;exactly equal to the response of the &lt;em&gt;linearized model&lt;/em&gt; to the periodic autocorrelation function of the PRBS signal which is essentially&#xA;a periodic &quot;impulse train&quot; with one &quot;impulse&quot; every $NT$ seconds.&#xA;Of course, it is not a true impulse, but if the PRBS signal has&#xA;levels $\pm A$ where $A$ is necessarily chosen to be small so&#xA;as to not drive the system into nonlinearity, the &quot;impulse&quot; has&#xA;peak value $ANT$ (and floor or off-peak value $-AT$).  So&#xA;you effectively have a &quot;processing gain&quot; of $N$. If the &#xA;&quot;impulse response&quot; dies out before the  next &quot;impulse&quot;,&#xA;that cross-correlation is essentially the impulse response&#xA;or something close enough to it for gummint purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have computed the impulse response, you can get&#xA;the transfer function from the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More bells and whistles: if you complement alternate chips&#xA;of the PRBS to get a sequence of period $2N$ chips, the&#xA;autocorrelation function is again a periodic &quot;impulse&#xA;train&quot; of twice the period, but the impulses still occur&#xA;every $NT$ seconds with alternate signs.  This allows&#xA;the testing of the system with both positive and negative&#xA;impulses since the actual nonlinear system being modeled&#xA;might not be perfectly linear around the operating&#xA;point, and the gain for positive signals might be slightly&#xA;different from negative signals.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-04-21T15:53:37.783" LastActivityDate="2012-04-21T15:53:37.783" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2143" PostTypeId="2" ParentId="2104" CreationDate="2012-04-21T20:50:11.090" Score="1" Body="&lt;p&gt;The statistic is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Likelihood_function&quot; rel=&quot;nofollow&quot;&gt;likelihood&lt;/a&gt; ratio (LR), and the &lt;a href=&quot;http://en.wikipedia.org/wiki/Likelihood-ratio_test&quot; rel=&quot;nofollow&quot;&gt;test&lt;/a&gt; is comparison of the LR against a threshold. If you follow the tradition of placing the likelihood of the null hypothesis in the denominator, you decide in favor of the &lt;em&gt;alternative&lt;/em&gt; hypothesis (&lt;em&gt;against&lt;/em&gt; the &lt;a href=&quot;http://en.wikipedia.org/wiki/Null_hypothesis&quot; rel=&quot;nofollow&quot;&gt;null hypothesis&lt;/a&gt;) if the LR is sufficiently high. The higher the ratio, the greater your confidence. This is the test you would perform if you have already collected the data. If you want to decide as the data arrives piece-meal, you can use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Sequential_analysis&quot; rel=&quot;nofollow&quot;&gt;sequential test&lt;/a&gt;, like &lt;a href=&quot;http://en.wikipedia.org/wiki/Sequential_probability_ratio_test&quot; rel=&quot;nofollow&quot;&gt;SPRT&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this stage you might benefit from a book on &lt;a href=&quot;http://en.wikipedia.org/wiki/Statistical_hypothesis_testing&quot; rel=&quot;nofollow&quot;&gt;hypothesis testing&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Decision_theory&quot; rel=&quot;nofollow&quot;&gt;decision theory&lt;/a&gt; (more general).&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-04-21T20:50:11.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2145" PostTypeId="2" ParentId="2130" CreationDate="2012-04-22T17:10:58.120" Score="0" Body="&lt;p&gt;A simple solution could be to spread the boundary conditions of your non-rectangular region of interest into the rectangle around it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can perform this with a nearest neighbor algorithm.&lt;/p&gt;&#xA;" OwnerUserId="806" LastActivityDate="2012-04-22T17:10:58.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2146" PostTypeId="2" ParentId="2066" CreationDate="2012-04-22T19:42:45.960" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://www.udacity.com/view#Course/cs373/CourseRev/apr2012&quot;&gt;This online course&lt;/a&gt; is very easy and straightforward to understand and to me it explained Kalman filters really well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's called &quot;Programming a Robotic Car&quot;, and it talks about three methods of localiczation: Monte Carlo localization, Kalman filters and particle filters. It does focus on sonar information as an example, but the explanation is simple enough that you could simply replace &quot;sonar&quot; with &quot;visual information&quot; and it would all still make sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The course is completely free (it's finished now so you can't actively participate but you can still watch the lectures I presume), taught by a Stanford professor.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2012-04-22T19:42:45.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2147" PostTypeId="1" CreationDate="2012-04-22T21:59:08.023" Score="4" ViewCount="4409" Body="&lt;p&gt;I am trying to implement the generalized Hough transform in matlab. The algorithm requires the gradient direction at each point in the shape. How can I measure $ \phi $ as shown in the figure below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2Omxv.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1156" LastActivityDate="2012-04-25T19:28:04.030" Title="find the gradient direction at a point in a shape" Tags="|matlab|hough-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2148" PostTypeId="2" ParentId="2096" CreationDate="2012-04-23T00:49:08.270" Score="90" Body="&lt;p&gt;I have no familiarity with the Multitaper method. That said, you've asked quite a question. In pursuit of my MSEE degree, I took an entire course that covered PSD estimation. The course covered all of what you listed (with exception to the Multitaper method), and also subspace methods. Even this only covers some of the main ideas, and there are many methods stemming from these concepts.&lt;/p&gt;&#xA;&lt;p&gt;For starters, there are two main methods of power spectral density estimation: non-parametric and parametric.&lt;/p&gt;&#xA;&lt;p&gt;Non-parametric methods are used when little is known about the signal ahead of time. They typically have less computational complexity than parametric models. Methods in this group are further divided into two categories: periodograms and correlograms. Periodograms are also sometimes referred to as direct methods, as they result in a direct transformation of the data. These include the sample spectrum, Bartlett's method, Welch's method, and the Daniell Periodogram. Correlograms are sometimes referred to as indirect methods, as they exploit the Wiener-Khinchin theorem. Therefore these methods are based on taking the Fourier transform of some sort of estimate of the autocorrelation sequence. Because of the high amount of variance associated with higher order lags (due to a small amount of data samples used in the correlations), windowing is used. The Blackman-Tukey method generalizes the correlogram methods.&lt;/p&gt;&#xA;&lt;p&gt;Parametric methods typically assume some sort of signal model prior to calculation of the PSD estimate. Therefore, it is assumed that some knowledge of the signal is known ahead of time. There are two main parametric method categories: autoregressive methods and subspace methods.&lt;/p&gt;&#xA;&lt;p&gt;Autoregressive methods assume that the signal can be modeled as the output of an autoregressive filter (such as an IIR filter) driven by a white noise sequence. Therefore all of these methods attempt to solve for the IIR coefficients, whereby the resulting power spectral density is easily calculated. The model order (or number of taps), however, must be determined. If the model order is too small, the spectrum will be highly smoothed, and lack resolution. If the model order is too high, false peaks from an abundant amount of poles begin to appear. If the signal may be modeled by an AR process of model 'p', then the output of the filter of order &amp;gt;= p driven by the signal will produce white noise. There are hundreds of metrics for model order selection. Note that these methods are excellent for high-to-moderate SNR, narrowband signals. The former is because the model breaks down in significant noise, and is better modeled as an ARMA process. The latter is due to the impulsive nature of the resulting spectrum from the poles in the Fourier transform of the resulting model. AR methods are based on linear prediction, which is what's used to extrapolate the signal outside of its known values. As a result, they do not suffer from sidelobes and require no windowing.&lt;/p&gt;&#xA;&lt;p&gt;Subspace methods decompose the signal into a signal subspace and noise subspace. Exploiting orthogonality between the two subspaces allows a pseudospectrum to be formed where large peaks at narrowband components can appear. These methods work very well in low SNR environments, but are computationally very expensive. They can be grouped into two categories: noise subspace methods and signal subspace methods.&lt;/p&gt;&#xA;&lt;p&gt;Both categories can be utilized in one of two ways: eigenvalue decomposition of the autocorrelation matrix or singular value decomposition of the data matrix.&lt;/p&gt;&#xA;&lt;p&gt;Noise subspace methods attempt to solve for 1 or more of the noise subspace eigenvectors. Then, the orthogonality between the noise subspace and the signal subspace produces zeros in the denominator of the resulting spectrum estimates, resulting in large values or spikes at true signal components. The number of discrete sinusoids, or the rank of the signal subspace, must be determined/estimated, or known ahead of time.&lt;/p&gt;&#xA;&lt;p&gt;Signal subspace methods attempt to discard the noise subspace prior to spectral estimation, improving the SNR. A reduced rank autocorrelation matrix is formed with only the eigenvectors determined to belong to the signal subspace (again, a model order problem), and the reduced rank matrix is used in any one of the other methods.&lt;/p&gt;&#xA;&lt;p&gt;Now, I'll try to quickly cover your list:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;PSD using Burg method&lt;/strong&gt;: The Burg method leverages the Levinson recursion slightly differently than the Yule-Walker method, in that it estimates the reflection coefficients by minimizing the average of the forward and backward linear prediction error. This results in a harmonic mean of the partial correlation coefficients of the forward and backward linear prediction error. It produces very high resolution estimates, like all autoregressive methods, because it uses linear prediction to extrapolate the signal outside of its known data record. This effectively removes all sidelobe phenomena. It is superior to the YW method for short data records, and also removes the tradeoff between utilizing the biased and unbiased autocorrelation estimates, as the weighting factors divide out. One disadvantage is that it can exhibit spectral line splitting. In addition, it suffers from the same problems all AR methods have. That is, low to moderate SNR severely degrades the performance, as it is no longer properly modeled by an AR process, but rather an ARMA process. ARMA methods are rarely used as they generally result in a nonlinear set of equations with respect to the moving average parameters.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;PSD using covariance method&lt;/strong&gt;: The covariance method is a special case of the least-squares method, whereby the windowed portion of the linear prediction errors is discarded. This has superior performance to the Burg method, but unlike the YW method, the matrix inverse to be solved for is not Hermitian Toeplitz in general, but rather the product of two Toeplitz matrices. Therefore, the Levinson recursion cannot be used to solve for the coefficients. In addition, the filter generated by this method is not guaranteed to be stable. However, for spectral estimation this is a good thing, resulting in very large peaks for sinusoidal content.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;PSD using periodogram&lt;/strong&gt;: This is one of the worst estimators, and is a special case of Welch's method with a single segment, rectangular or triangular windowing (depending on which autocorrelation estimate is used, biased or unbiased), and no overlap. However, it's one of the &amp;quot;cheapest&amp;quot; computationally speaking. The resulting variance can be quite high.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;PSD using modified covariance method&lt;/strong&gt;: This improves on both the covariance method and the Burg method. It can be compared to the Burg method, whereby the Burg method only minimizes the average forward/backward linear prediction error with respect to the reflection coefficient, the MC method minimizes it with respect to ALL of the AR coefficients. In addition, it does not suffer from spectral line splitting, and provides much less distortion than the previously listed methods. In addition, while it does not guarantee a stable IIR filter, it's lattice filter realization is stable. It is more computationally demanding than the other two methods as well.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;PSD using Welch's method&lt;/strong&gt;: Welch's method improves upon the periodogram by addressing the lack of the ensemble averaging which is present in the true PSD formula. It generalizes Barlett's method by using overlap and windowing to provide more PSD &amp;quot;samples&amp;quot; for the pseudo-ensemble average. It can be a cheap, effective method depending on the application. However, if you have a situation with closely spaced sinusoids, AR methods may be better suited. However, it does not require estimating the model order like AR methods, so if little is known about your spectrum a priori, it can be an excellent starting point.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;PSD using Yule-Walker AR method&lt;/strong&gt;: This is a special case of the least squares method where the complete error residuals are utilized. This results in diminished performance compared to the covariance methods, but may be efficiently solved using the Levinson recursion. It's also known as the autocorrelation method.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Spectrogram using short-time Fourier transform&lt;/strong&gt;: Now you're crossing into a different domain. This is used for time-varying spectra. That is, one whose spectrum changes with time. This opens up a whole other can of worms, and there are just as many methods as you have listed for time-frequency analysis. This is certainly the cheapest, which is why its so frequently used.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Spectral estimation&lt;/strong&gt;: This is not a method, but a blanket term for the rest of your post. Sometimes the Periodogram is referred to as the &amp;quot;sample spectrum&amp;quot; or the &amp;quot;Schuster Periodogram&amp;quot;, the former of which may be what you're referring to.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you are interested, you may also look into subspace methods such as MUSIC and Pisarenko Harmonic Decomposition. These decompose the signal into signal and noise subspace, and exploits the orthogonality between the noise subspace and the signal subspace eigenvectors to produce a pseudospectrum. Much like the AR methods, you may not get a &amp;quot;true&amp;quot; PSD estimate, in that power most likely is not conserved, and the amplitudes between spectral components is relative. However, it all depends on your application.&lt;/p&gt;&#xA;" OwnerUserId="1279" LastEditorUserId="7092" LastEditDate="2022-10-11T23:03:47.587" LastActivityDate="2022-10-11T23:03:47.587" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2149" PostTypeId="1" CreationDate="2012-04-22T05:52:54.577" Score="11" ViewCount="5912" Body="&lt;p&gt;I want to perform 2D haar discrete wavelet transform and inverse DWT on an image.&lt;strong&gt;Will you please explain 2D haar discrete wavelet transform and inverse DWT in a simple language and an algorithm using which I can write the code for 2D haar dwt&lt;/strong&gt;?The information given in google was too technical.I understood the basic things like dividing the image into 4 sub-bands:LL,LH,HL,HH but I can't really understand how to write a program to perform DWT and IDWT on an image.I also read that DWT is better than DCT as it is performed on the image as a whole and then there was some explanation which went over the top of my head.I might be wrong here but I think DWT and DCT compression techniques because the image size reduces when DWT or DCT is performed on them.Hoping you guys share a part of your knowledge and enhance my knowledge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Re:&#xA;Does it have anything to do with the image format.What is &quot;value of pixel&quot; that is used in DWT?I have assumed it to be the rgb value of the image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import java.awt.event.*;&#xA;import javax.swing.*;&#xA;import java.awt.image.BufferedImage;&#xA;import javax.swing.JFrame;&#xA;import javax.swing.SwingUtilities;&#xA;import java.io.*;&#xA;import javax.swing.JFileChooser;&#xA;import javax.swing.filechooser.FileFilter;&#xA;import javax.swing.filechooser.FileNameExtensionFilter;&#xA;import javax.imageio.ImageIO;&#xA;import java.awt.*;&#xA;import java.lang.*;&#xA;import java.util.*;&#xA;&#xA;class DiscreteWaveletTransform&#xA;&#xA;{&#xA;&#xA;    public static void main(String arg[])&#xA;    { DiscreteWaveletTransform dwt=new DiscreteWaveletTransform();&#xA;      dwt.initial();&#xA;    }&#xA;&#xA;&#xA;    static final int TYPE=BufferedImage.TYPE_INT_RGB;&#xA;    public void initial()&#xA;    {&#xA;    try{&#xA;&#xA;        BufferedImage buf=ImageIO.read(new File(&quot;lena.bmp&quot;));&#xA;        int w=buf.getWidth();&#xA;        int h=buf.getHeight();&#xA;        BufferedImage dwtimage=new BufferedImage(h,w,TYPE);&#xA;        int[][] pixel=new int[h][w];&#xA;        for (int x=0;x&amp;lt;h;x++)&#xA;        {&#xA;            for(int y=0;y&amp;lt;w;y++)&#xA;            {&#xA;                pixel[x][y]=buf.getRGB(x,y);&#xA;&#xA;&#xA;            }&#xA;        }&#xA;        int[][] mat =  new int[h][w];&#xA;        int[][] mat2 =  new int[h][w];&#xA;&#xA;        for(int a=0;a&amp;lt;h;a++)&#xA;        {&#xA;            for(int b=0,c=0;b&amp;lt;w;b+=2,c++)&#xA;            {&#xA;                mat[a][c]    = (pixel[a][b]+pixel[a][b+1])/2;&#xA;                mat[a][c+(w/2)]  = Math.abs(pixel[a][b]-pixel[a][b+1]);&#xA;            }&#xA;        }&#xA;        for(int p=0;p&amp;lt;w;p++)&#xA;        {&#xA;            for(int q=0,r =0 ;q&amp;lt;h;q+=2)&#xA;            {&#xA;                mat2[r][p]   = (mat[q][p]+mat[q+1][p])/2;&#xA;                mat2[r+(h/2)][p] = Math.abs(mat[q][p]-mat[q+1][p]);&#xA;            }&#xA;        }&#xA;        for (int x=0;x&amp;lt;h;x++)&#xA;        {&#xA;            for(int y=0;y&amp;lt;w;y++)&#xA;            {&#xA;                dwtimage.setRGB(x,y,mat2[x][y]);&#xA;            }&#xA;        }&#xA;        String format=&quot;bmp&quot;;&#xA;        ImageIO.write(dwtimage,format, new File(&quot;DWTIMAGE.bmp&quot;));&#xA;        }&#xA;&#xA;        catch(Exception e)&#xA;        {&#xA;            e.printStackTrace();&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is a black image with a thin line in between,in short nowhere near the actual output.I think I have interpreted the logic wrongly.Please point out the mistakes.&#xA;Regards&lt;/p&gt;&#xA;" OwnerUserId="1282" OwnerDisplayName="user1320483" LastEditorUserId="1282" LastEditDate="2012-04-23T10:40:45.597" LastActivityDate="2015-01-24T05:11:03.600" Title="Wavelet Transform" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2151" PostTypeId="2" ParentId="2149" CreationDate="2012-04-23T10:04:43.317" Score="16" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Will you please explain 2D haar discrete wavelet transform and inverse&#xA;  DWT in a simple language&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is useful to think of the wavelet transform in terms of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot;&gt;Discrete Fourier Transform&lt;/a&gt; (for a number of reasons, please see below). In the Fourier Transform, you decompose a signal into a series of orthogonal trigonometric functions (cos and sin). It is essential for them to be orthogonal so that it is possible to decompose your signals in a series of coefficients (of two functions that are essentially INDEPENDENT of each other) and recompose it back again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthonormality&quot;&gt;criterion of orthogonality&lt;/a&gt; in mind, is it possible to find two other functions that are orthogonal besides the cos and sin? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, it is possible to come up with such functions with the additional useful characteristic that they do not extend to infinity (like the cos and the sin do). One example of such pair of functions is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Haar_wavelet&quot;&gt;Haar Wavelet&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in terms of DSP, it is perhaps more practical to think about these two &quot;orthogonal functions&quot; as two Finite Impulse Response (FIR) filters and the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_wavelet_transform&quot;&gt;Discrete Wavelet Transform&lt;/a&gt; as a series of Convolutions (or in other words, applying these filters successively over some time series). You can verify this by comparing and contrasting the formulas of the 1-D DWT and &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot;&gt;that of convolution&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, if you notice the Haar functions closely you will see the two most elementary low pass and high pass filters. Here is a very simple low pass filter h=[0.5,0.5] (don't worry about the scaling for the moment) also known as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average&quot;&gt;moving average filter&lt;/a&gt; because it essentially returns the average of every two adjacent samples. Here is a very simple high pass filter h=[1, -1] also known as a &lt;a href=&quot;http://en.wikipedia.org/wiki/High_pass_filter&quot;&gt;differentiator&lt;/a&gt; because it returns the difference between any two adjacent samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To perform DWT-IDWT on an image, it is simply a case of using the two dimensional versions of convolution (to apply your Haar filters successively).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps now you can begin to see where the LowLow,LowHigh,HighLow,HighHigh parts of an image that has undergone DWT come from. HOWEVER, please note that an image is already TWO DIMENSIONAL (maybe this is confusing some times). In other words, you must derive the Low-High Spatial frequencies for the X axis and the same ranges for the Y axis (this is why there are two Lows and two Highs per axis)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;and an algorithm using which I can write the code for 2D haar dwt?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You must really give it a try to code this on your own from first principles so that you get an understanding of the whole process. It is very easy to find a ready made piece of code that will do what you are looking for but i am not sure that this would really help you in the long term.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I might be wrong here but I think DWT and DCT compression techniques&#xA;  because the image size reduces when DWT or DCT is performed on them&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is where it really &quot;pays&quot; to think of the DWT in terms of the Fourier Transform. For the following reason:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Fourier Transform (and of course the DCT as well), you transform MANY SAMPLES (in the time domain) to ONE (complex) coefficient (in the frequency domain). This is because, you construct different sinusoids and cosinusoids and then you multiply them with your signal and obtain the average of that product. So, you know that a single coefficient Ak represents a scaled version of a sinusoid of some frequency (k) in your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you look at some of the wavelet functions you will notice that they are a bit more complex than the simple sinusoids. For example, consider the Fourier Transform of the High Pass Haar Filter...The high pass Haar filter looks like a square wave, i.e. it has sharp edges (sharp transitions)...What does it take to create SHARP EDGES?.....Many, many different sinusoids and co-sinusoids (!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, representing your signal / image using wavelets saves you more space than representing it with the sinusoids of a DCT because ONE set of wavelet coefficients represents MORE DCT COEFFICIENTS. (A slightly more advanced but related topic that might be of help to you to understand why this works this way is &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot;&gt;Matched Filtering&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two good online links (in my opinion at least :-) ) are:&#xA;&lt;a href=&quot;http://faculty.gvsu.edu/aboufade/web/wavelets/tutorials.htm&quot;&gt;http://faculty.gvsu.edu/aboufade/web/wavelets/tutorials.htm&lt;/a&gt;&#xA;and;&#xA;&lt;a href=&quot;http://disp.ee.ntu.edu.tw/tutorial/WaveletTutorial.pdf&quot;&gt;http://disp.ee.ntu.edu.tw/tutorial/WaveletTutorial.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, i have found very helpful, the following books:&#xA;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0124666051&quot;&gt;http://www.amazon.com/A-Wavelet-Tour-Signal-Processing/dp/0124666051&lt;/a&gt; (By Mallat)&#xA;and;&#xA;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0961408871&quot;&gt;http://www.amazon.com/Wavelets-Filter-Banks-Gilbert-Strang/dp/0961408871/ref=pd_sim_sbs_b_3&lt;/a&gt; (By Gilbert Strang)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these are absolutely brilliant books on the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(sorry, i just noticed that this answer may be running a bit too long :-/ )&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-04-23T10:04:43.317" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="2152" PostTypeId="1" CreationDate="2012-04-23T12:55:02.810" Score="3" ViewCount="454" Body="&lt;p&gt;Consider the wireless channel. It is mult-path - means that signal is sum of sent signals with some delay and fadings.&#xA;The standard models for &quot;impulse response&quot; for multi-path channel in wireless is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ h(t) = c_1 \delta(t - t_1) + c_2 \delta(t - t_2) + ... + c_N \delta(t - t_N) $,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $t_i$ are path-delays and $c_i$ are fadings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt; I wonder is this model realistic  ? Is it really reasonable to assume &quot;delta&quot;-functions for each path or may be it we need to assume something more smooth ? &#xA;What is good reference, where the results of real measurements can be found ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT] in response to comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in cellur telephone links. I know that the standard e.g. channel 3GPP models assume 6-9 paths with delta-functions. I am  suspicious about this assumption. So I want to see results of real measurements which support this model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT 2] More details. &#xA;I am interested in channel estimation for OFDM system cellur system. Assume carrier frequency is something like 1GHz - 2GHz.&#xA;One user typically may have ~100 OFDM elements. Each  element is about 15kHz.&#xA;So the user bandwidth 1.5MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What am suspicious about&lt;/strong&gt; is that if we have 9 paths and we have about 100 pilot symbols, then  our channel estimation would be quite good , and BER will be close to ideal ch.est. Because we need to estimate ~9*2 unknowns from 100 of data - so we get good quality of estimation. This is in theory, but I am afraid if will test such system in practice &#xA;we mail fail, cause in practice it might be not 9 paths but 90 paths ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let me stress the following part of the question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Where to find&lt;/strong&gt; results of real measurements in urban requirement for  channel response ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that should be old stuff may be from 60-ies ? Cause many modern literature concern MIMO channels and pay attention to angular spread and so on - while I need more simple information.&lt;/p&gt;&#xA;" OwnerUserId="1005" LastEditorUserId="1005" LastEditDate="2012-04-26T07:27:15.147" LastActivityDate="2016-03-25T08:35:03.683" Title="modelling wireless multi-path channel - is channel response sum of delta(t-path_delay) or &quot;delta&quot; should be smoothed somehow?" Tags="|impulse-response|multipath|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2153" PostTypeId="2" ParentId="2149" CreationDate="2012-04-23T13:22:16.100" Score="8" Body="&lt;p&gt;I started writing this before the answer from &lt;a href=&quot;https://dsp.stackexchange.com/a/2151/1263&quot;&gt;@A_A&lt;/a&gt;, but that answer is excellent. Still I hope the following might add a little to your understanding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discussion about wavelets and so on falls into the general discussion about basis decomposition of signals. By this, we mean that we can represent our signal $\mathbf{x}$ as the product of some basis matrix, $\text{H}$, and the vector representing our signal in the alternative basis (the basis decomposition), $\tilde{\mathbf{x}}$. That is:&#xA;$$&#xA;\mathbf{x} = \text{H}\tilde{\mathbf{x}}&#xA;$$&#xA;The basis matrix $\text{H}$ is typically an orthonormal matrix (e.g. the discrete Fourier matrix, Haar wavelet matrix), but need not be - there are whole fields of research looking at decomposing signals into over-complete dictionaries, meaning an $\text{H}$ wider than it is tall (e.g. through minimum L1-norm algorithms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea behind basis decomposition of signal is that the signal can be represent in some &lt;em&gt;better&lt;/em&gt; way in an alternative basis. By &lt;em&gt;better&lt;/em&gt;, we mean that the signal is somehow more amenable to processing, or understanding, or &lt;em&gt;whatever&lt;/em&gt; - it doesn't really matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A point to note is that, particularly with orthonormal transforms, your signal is still your signal whatever basis it is in. You shouldn't think of one basis as somehow being the &lt;em&gt;correct&lt;/em&gt; domain (I use domain to mean basis in the general sense).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, different bases have different properties. I'm sure you're well aware of the convolution theorem describing the useful relationship between the Fourier domain and the time domain. This makes the Fourier domain useful for performing time domain convolution operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general the time (or pixel) domain can be considered as having excellent time (or spatial) resolution and bad frequency resolution. Conversely, the Fourier domain can be considered as having excellent frequency resolution and bad time (or spatial) resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wavelet bases fit somewhere in the middle of the above two. They tend to have good frequency resolution &lt;em&gt;and&lt;/em&gt; good time or spatial resolution. One property of the wavelet transform is the good sparsification of natural images. By this, I mean the energy from the image is compressed into a few large coefficients, and many small coefficients. This means most of the salient information of the signal is represented by a relatively small set of values. This is the essence of compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Different wavelets have different properties. In addition to the references from @A_A, I also recommend &lt;a href=&quot;http://www-sigproc.eng.cam.ac.uk/%7Engk/publications/ngk_SPmag_nov05.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this IEEE tutorial&lt;/a&gt; on the DTCWT. The focus of the tutorial is not on the wavelet transform &lt;em&gt;per se&lt;/em&gt;, but the reason I recommend it is because of the fantastic insight it presents on the problems associated the DWT and how they might be alleviated (i'd say it requires a basic understanding first though). It really ties together an understanding of wavelets with an understanding of the Fourier transform and why the latter has the nice properties it does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like some more reference code on the Haar transform, my former supervisor has some matlab examples on &lt;a href=&quot;http://www-sigproc.eng.cam.ac.uk/~ngk/&quot; rel=&quot;nofollow noreferrer&quot;&gt;his web page&lt;/a&gt; (the zip file under &quot;4F8 Image Coding Course&quot;, HAAR2D.M and IHAAR2D.M). These are very much teaching examples though.&lt;/p&gt;&#xA;" OwnerUserId="1263" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-04-24T08:27:22.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2154" PostTypeId="2" ParentId="2147" CreationDate="2012-04-23T16:28:04.510" Score="2" Body="&lt;p&gt;Assuming you are using discrete inputs and that s(0..n-1) (or s(1...n) in Matlab) is an array of x,y points along the boundary of a 2d shape ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Gradient(i) = (s(i).x, s(i).y) - (s(i-1).x, s(i-1).y)&#xA;Amplitude(i) = sqrt(Gradient(i).x^2 + Gradient(i).y^2)&#xA;Angle(i) = atan(Gradient(i).y / Gradient(i).x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To make you calculations relative to (Xc,Yc) substract (Xc,Yc) from each point in s prior to calculations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your calculations are continuous, replace the above s(i)-s(i-1) with limit(s)/limit(sigma) and use the symbolic toolkit.&lt;/p&gt;&#xA;" OwnerUserId="806" LastActivityDate="2012-04-23T16:28:04.510" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2159" PostTypeId="1" AcceptedAnswerId="2160" CreationDate="2012-04-24T12:02:51.403" Score="14" ViewCount="1008" Body="&lt;p&gt;In image processing, what does it mean when a filter is called non-linear?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it mean the equation of the filter contains derivatives and if it didn't, it would have been called linear?&lt;/p&gt;&#xA;" OwnerUserId="1289" LastEditorUserId="207" LastEditDate="2012-04-24T18:56:37.653" LastActivityDate="2012-04-25T19:16:06.960" Title="What does it mean in image processing when a filter is called non-linear?" Tags="|filters|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2160" PostTypeId="2" ParentId="2159" CreationDate="2012-04-24T12:29:30.047" Score="23" Body="&lt;p&gt;A filter F is called &quot;linear&quot;, iff for any scalars $c_1$, $c_2$ and any images $I_1$ and $I_2$: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F\left(c_1\cdot I_1+c_2\cdot I_2\right)=c_1\cdot F\left(I_1\right)+c_2\cdot F\left(I_2\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This includes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Derivatives&lt;/li&gt;&#xA;&lt;li&gt;Integrals&lt;/li&gt;&#xA;&lt;li&gt;Fourier transform&lt;/li&gt;&#xA;&lt;li&gt;Z-Transform&lt;/li&gt;&#xA;&lt;li&gt;Geometric transformations (rotate, translate, scale, warp)&lt;/li&gt;&#xA;&lt;li&gt;Convolution and Correlation&lt;/li&gt;&#xA;&lt;li&gt;the composition of any tuple of linear filters (i.e. applying some linear filter to the output of another linear filter $F(G(I))$)&lt;/li&gt;&#xA;&lt;li&gt;the sum of the result of any two linear filters (i.e. the output of one filter, added pixel by pixel to the output of another filter $F(I) + G(I)$)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and many others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples of non-linear filters are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the square, absolute, square root, exp or logarithm of the result of any linear filter&lt;/li&gt;&#xA;&lt;li&gt;the product of the result of any two linear filters (i.e. the output of one filter, multiplied pixel by pixel with the output of another filter $F(I)\cdot G(I)$)&lt;/li&gt;&#xA;&lt;li&gt;morphological filters&lt;/li&gt;&#xA;&lt;li&gt;median filter&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2012-04-24T15:01:21.793" LastActivityDate="2012-04-24T15:01:21.793" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2161" PostTypeId="2" ParentId="2159" CreationDate="2012-04-24T12:49:28.870" Score="1" Body="&lt;p&gt;Let us say that you have two filters, one linear and one non linear (for filtering out some noise corrupted images). i.e you have some bad pixels with really high or low values that look sort of 'the odd one out' in a small rectangular region on an image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, a linear filter (like 'average') works like this: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Place a window over element&lt;/li&gt;&#xA;&lt;li&gt;Take an average — sum up elements and divide the sum by the number of elements. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You will notice that if you expand the area of the filter window you will stretch it over more elements (i.e more elements make up the average automatically contributing to the filtered pixel value). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand for a non-linear filter such as the median (which replaces the pixel to be filtered with the median value inside the square window), increasing the window does not necessarily bring a contribution to the median of the window and hence does not result in a direct impact on the filtered pixel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a numerical example : say you have a i,j (i.e. 3x3 window) with the anchor (center pixel in the middle at position (2,2) and the values are (brightness level) 40, 60, 80, 89, 90, 100, 101, 105, 185. you will notice that the median is 90 so the anchor pixel will become 90. now lets say you increase the window size and you add more values to those nine, namely to have a 5x5 window. There is a chance that even after that the median would still be 90. So a change in input does not necessarily give a proportional change in the output, hence the non-linearity.&lt;/p&gt;&#xA;" OwnerUserId="1290" LastEditorUserId="26" LastEditDate="2012-04-25T14:09:05.173" LastActivityDate="2012-04-25T14:09:05.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2166" PostTypeId="1" AcceptedAnswerId="2167" CreationDate="2012-04-25T13:30:00.813" Score="4" ViewCount="160" Body="&lt;p&gt;I've been told that the point spread function of a pixel is its distribution of intensity, while the sampling aperture of a pixel is its distribution of sensitivity. I'm a little unsure of what the difference between intensity and sensitivity is. It sounds like the former deals with how a pixel is displayed, while the latter deals with how it is captured. Is that correct?&lt;/p&gt;&#xA;" OwnerUserId="1297" LastActivityDate="2012-04-25T13:37:58.567" Title="What is the difference between the Point Spread Function and Sampling Aperture?" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2167" PostTypeId="2" ParentId="2166" CreationDate="2012-04-25T13:37:58.567" Score="3" Body="&lt;p&gt;Sounds correct to me. The point-spread function indicates how the intensity of a point source is spread among multiple pixels in an image. In an imaging sensor, the sampling aperture of a particular pixel indicates how it responds to intensity from points in space as a function of the spatial offset from the pixel's center.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-25T13:37:58.567" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2168" PostTypeId="1" CreationDate="2012-04-25T14:01:57.337" Score="2" ViewCount="112" Body="&lt;p&gt;Can someone point me towards a good book or survey article on adaptive/self-tuning of PI controllers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I can find online are articles which are either vague or heavy on theory.&lt;/p&gt;&#xA;" OwnerUserId="829" LastEditorUserId="90" LastEditDate="2012-05-03T15:44:26.350" LastActivityDate="2012-05-03T15:44:26.350" Title="survey/book on adaptive/self-tuning of PI controllers?" Tags="|reference-request|control-systems|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2169" PostTypeId="2" ParentId="2152" CreationDate="2012-04-25T14:22:11.680" Score="3" Body="&lt;p&gt;Depends on the physics of the situation. The model is reasonably good if you have secular reflections and it is not very good if you have diffuse reflections. If the size and geometry details of the reflectors are large as compared to the wavelength, than its mostly specular. If the surfaces are uneven are very non flat, then its more diffuse. This is all measured in units of wavelengths. For a 5GHz link that's about 6cm. For an FM radio link that's about 3m. &#xA;It also depends on the relative bandwidth of the signal. For most wireless links that's pretty narrow, i.e the behavior at the carrier frequency is a good model for the behavior of the overall system. Most natural physical transfer functions such as a reflection of a wall do not change very rapidly with frequency so that's why the singe impulse is a good starting point.&#xA;Of course there are always exceptions to the rules so it depends on your specific problem.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2012-04-25T15:32:13.360" LastActivityDate="2012-04-25T15:32:13.360" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2170" PostTypeId="1" AcceptedAnswerId="2173" CreationDate="2012-04-25T14:43:37.350" Score="12" ViewCount="9527" Body="&lt;p&gt;I am doing some 'extreme' eq for spectral mangling type effects with audio. Im using brick wall filters, and very narrow band pass and reject filters (vst plugins), and I'd like to know if there's anything I can do about the pre/post 'ring' with the linear phase /minimal phase filters Im using.  Unfortunately I must use steep eq slopes . Im prepared to use minimum phase as it avoids pre-ring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, Im wondering:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What exactly causes the oscilliations in the impulse response just after the input, in a a minimum phase filter?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Are these osccilations what causes the audible pre and post 'ringing' sound which is added to the passband with with steep slope filtering?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Are the oscilliations, and thus the ringing frequency always the same frequency, or does the ringing frequency depend in some way on the input signal?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks very much for your expertise. I look forward to any responses.&#xA;Dale.&lt;/p&gt;&#xA;" OwnerUserId="1304" LastEditorUserId="1629" LastEditDate="2016-09-08T19:13:23.853" LastActivityDate="2016-09-08T19:13:23.853" Title="Why do I see ringing in the output of a digital filter with a narrow transition band?" Tags="|filters|noise|gibbs-phenomenon|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2171" PostTypeId="2" ParentId="2170" CreationDate="2012-04-25T14:57:32.260" Score="9" Body="&lt;p&gt;Your observations are an example of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gibbs_phenomenon&quot;&gt;Gibbs phenomenon&lt;/a&gt;. When you apply a filter with a very sharp transition band, you will observe oscillations in the filter output (or &quot;ringing&quot;) near any sharp transitions in the input signal (e.g. boundaries of pulsed waveforms). The apparent &quot;frequency&quot; of the oscillations is dependent upon the bandwidth of the filter; as you increase the filter's cutoff frequency, the oscillations will become more localized in time (i.e. &quot;higher in frequency&quot;), but the peak overshoot does &lt;em&gt;not&lt;/em&gt; change. The Wikipedia article linked above has a good explanation &lt;a href=&quot;http://en.wikipedia.org/wiki/Gibbs_phenomenon#Signal_processing_explanation&quot;&gt;halfway through or so&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-25T14:57:32.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2172" PostTypeId="2" ParentId="2170" CreationDate="2012-04-25T15:42:55.030" Score="8" Body="&lt;ol&gt;&#xA;&lt;li&gt;As Jason pointed out there a basic &quot;uncertainty principle&quot;: everything that's very narrow in frequency is wide in time and vice versa.&lt;/li&gt;&#xA;&lt;li&gt;If you use minimum filters, there should be no pre-ringing, only post ringing. Pre-ringing only happens for linear phase filters. Pre-ringing is much more audible than post-ringing, so minimum filters tend to be the better choice here. It may look bad on a measurement but unless it's extreme, post ringing is not very audible because of some masking properties of the human auditory system&lt;/li&gt;&#xA;&lt;li&gt;They ringing is typically exactly at the corner frequencies of your filter. I.e. a 2 kHz lowpass filter will produce 2 kHz ringing, so the frequency is a function of the filter, not the content. The content will excite it differently though. If the content as little or no 2 kHz it won't excite the ringing very much.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-25T15:42:55.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2173" PostTypeId="2" ParentId="2170" CreationDate="2012-04-25T16:17:26.127" Score="9" Body="&lt;p&gt;&lt;strong&gt;Edited in response to revised question and additional comments by the OP.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I disagree with @JasonR's assertion that filter ringing is due to &lt;em&gt;Gibbs phenomenon&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As described in the Wikipedia article linked to in Jason's answer,&#xA;the Gibbs phenomenon is an observation about the asymptotic behavior&#xA;of the &lt;strong&gt;truncated&lt;/strong&gt; sum (first&#xA;$n$ terms) of the Fourier series of a periodic but discontinuous &#xA;signal such as a square wave or sawtooth wave.  The Wikipedia article&#xA;illustrates an example of the square wave, showing that as more and more &#xA;terms are taken ($n$ gets large), the truncated Fourier sum becomes&#xA;closer and closer to the square wave.  There are oscillations that &#xA;occur around the switching instants where the square wave transitions&#xA;from &lt;em&gt;high&lt;/em&gt; to &lt;em&gt;low&lt;/em&gt; or vice versa, but these become smaller and smaller&#xA;as $n$ gets large.  As Jason correctly points out, the amplitude of&#xA;the oscillations becomes smaller, the frequency increases, and the&#xA;(observed) duration also becomes smaller.  Overall, it looks like &#xA;the truncated Fourier&#xA;sum is &lt;strong&gt;converging&lt;/strong&gt; to the square wave in the limit as $n \to \infty$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Gibbs phenomenon is the observation that &lt;strong&gt;even in the limit&#xA;  as $n$ goes to $\infty$,&lt;/strong&gt; the Fourier series sum &lt;strong&gt;does not&#xA;  converge&lt;/strong&gt; to the high value or the low value at the switching&#xA;  instants where the square wave changes value abruptly. (Convergence&#xA;  &lt;em&gt;does&lt;/em&gt; occur at all other time instants). This has&#xA;  &lt;strong&gt;nothing&lt;/strong&gt; to do with filtering per se, except in the sense&#xA;  that the truncated Fourier sum can be thought of as the output &#xA;  of an ideal brick &#xA;  wall low-pass filter with square wave input. If the&#xA;  filter cut-off is such that the first $n$ harmonics are&#xA;  passed through unchanged  and higher harmonics are blocked,&#xA;  the output is the truncated Fourier sum of the first $n$&#xA;  terms.  But in the limit, which is when the Gibbs phenomenon &#xA;  occurs, there is no filter: &lt;em&gt;all&lt;/em&gt; the harmonics are passed through &#xA;  to the output without any change.  For this reason, I do not&#xA;  agree that filter ringing is due to the Gibbs phenomenon.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So why does ringing occur? &#xA;&lt;strong&gt;All&lt;/strong&gt; (nontrivial) filters ring, regardless of whether they&#xA;are brick-wall or not, regardless of the shape of the input&#xA;signal, and regardless of whether the input is continuous&#xA;or has sharp transitions. The reason is that if the input &#xA;has energy in the frequency bands that are stopped (whether&#xA;wholly or in substantial part), that energy is effectively&#xA;stored internally in the filter and released slowly as &#xA;in-band energy as time progresses.&#xA;Most of the time this release is not noticed very much &#xA;because it is drowned out by the response to the in-band&#xA;signal that is present.  However, if the in-band&#xA;signal changes (or ceases) relatively suddenly, that energy stored &#xA;from previous times still has to be released, and this is the ringing&#xA;that is observed after the in-band signal has disappeared.&#xA;In DSP terms, the FIR filter buffer continues to empty out&#xA;even after the&#xA;signal has ended, and so the output continues even after the signal ends.&#xA;Since sharp-cutoff filters have long buffers&#xA;(many biquad sections if you will), this emptying takes a long time&#xA;and is much more noticeable than with a more easy-going filter&#xA;which empties out quite quickly.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-04-26T14:14:18.553" LastActivityDate="2012-04-26T14:14:18.553" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2174" PostTypeId="2" ParentId="2168" CreationDate="2012-04-25T17:52:05.463" Score="3" Body="&lt;p&gt;This is definitively not a satisfying answer, but what you call &quot;adaptive&quot; in combination with a pi-controller is commonly called &lt;code&gt;gain-scheduling&lt;/code&gt; or &lt;code&gt;lpv-gain-scheduling&lt;/code&gt; (lpv = linear parameter varying). Maybe that helps you find a book.&lt;/p&gt;&#xA;" OwnerUserId="1300" LastActivityDate="2012-04-25T17:52:05.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2175" PostTypeId="2" ParentId="2159" CreationDate="2012-04-25T19:16:06.960" Score="0" Body="&lt;p&gt;This reminds me: many years ago (15?), I read in a non-academic but quite kwnown magazine for developers (cof,cofdr,cof,cofdobbs...) an explanation about LPC=Linear Predictive Coding... It gave as an example the prediction of signal $x[t+1]$ based on the values of $x[t]$ and $x[t-1]$ and explained that for a typical (smooth) signal that could be done by drawing a straight line that passed through those two given values... and because of that the prediction was called 'linear'. I couldn't believe my eyes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, that 'linearity' has nothing to do with a filter being linear. Suppose that I want to predict the value of a signal using three previous values, and I decide to fit them via a second-degree polynomial, and extrapolate. The extrapolation then would fit a &lt;em&gt;parabola&lt;/em&gt;, but my filter would still be a &lt;em&gt;linear filter&lt;/em&gt;, because the extrapolated value is a linear combination of the input.&lt;/p&gt;&#xA;" OwnerUserId="358" LastActivityDate="2012-04-25T19:16:06.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2176" PostTypeId="2" ParentId="2147" CreationDate="2012-04-25T19:28:04.030" Score="1" Body="&lt;p&gt;If the points are sorted or can be, by means of some contour-following, than the approach suggested above is fine. However, depending on noise and outliers, it may well be advisable to use a larger support-region, i.e. N points&quot;left&quot;/&quot;right&quot; of the point, and fit a line to those points using linear regression possibly with preceding outlier-rejection using RANSAC/MSAC. The resulting line-normal presents the estimated/approximated gradient-direction. Off course, higher order polynomials, i.e. quadratic or cubic, can be used for the fitting as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the points are unsorted, the above approach could still be used by finding the nearest neighbors either by brute-force-search or by means of a suitable data-structure like, for example, kd-trees. The search-radius depends on the data, but can also be dynamically adjusted. Depending on the actual nature (distribution, constellation) of the points, the nearest-neighbor search might also allow to perform the contour-following, i.e. sorting of the points along the contour (sequence of points), see below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, with unsorted points, there's always the chance for ambiguity whenever the shape/contour comes close to itself - in particular, closer than the distance between neighbors on the contour. Clearly, nearest-neighbor-search picks up those points, which are not actual neighbors with respect to the shape/contour. Even worse are contour-crossings that would have to be accounted for in addition to all of the above. The gradient-direction at the crossing-point is undefined. Robust fitting using RANSAC/MSAC as suggested above could help with such ambiguities and crossing-detection by taking the outliers, if there are &quot;plenty&quot;, and repeating the robust fitting step, then decide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a suggestion along the lines of the above:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute the approximate gradient-direction using the nearest neighbors and polynomial fitting for all points, keep the standard-deviation of the fit for each point.&lt;/li&gt;&#xA;&lt;li&gt;Find the point on the contour with the smallest standard-deviation. Hoping/Assuming that this means that all it's nearest neighbors are actual neighbors along the shape (?).&lt;/li&gt;&#xA;&lt;li&gt;Follow the contour using the nearest neighbors, gradient-directions and/or tangential directions making adjustments/corrections to the gradient-directions as necessary. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Essentially, the purpose of the last step is to enforce local smoothness for the gradient-directions, where applicable, i.e. not at crossings etc. Also, the last step effectively performs contour-following. Finally, depending on the range of the point-coordinates, it may be possible to simply render them into a binary image with appropriate resolution and use image-based contour-following directly. This might require to scale the points appropriately and keep a mapping between the original and image points. Also the contour-following might have to account for significant gaps, depending on the data. However, afterwards the connectivity of the points is known, and the neighbor-based approximation becomes relatively straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps, kind regards, Derik.&lt;/p&gt;&#xA;" OwnerUserId="1302" LastActivityDate="2012-04-25T19:28:04.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2177" PostTypeId="2" ParentId="1499" CreationDate="2012-04-25T20:41:39.813" Score="5" Body="&lt;p&gt;Thanks for the reference! You forgot to mention your work on &lt;a href=&quot;http://biblio.telecom-paristech.fr/cgi-bin/selectresult.cgi?tmpl=enst&amp;amp;searchtype=1&amp;amp;authortosearch=gillet&amp;amp;wordtosearch=drum&amp;amp;year=&amp;amp;order=date&amp;amp;page=1&amp;amp;html=Display%20the%20selection&quot; rel=&quot;noreferrer&quot;&gt;drums enhancement&lt;/a&gt;, which may also be of interest for Summer_More_More_Tea's application. Well, that all really depends on what you want to do with it. Do you have a specific &quot;end application&quot; in mind?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I completely agree with pichenettes's above statements. To be complete, I should however say that the vocal enhancement you mentioned has also been used in some works by Matti Ryynänen, on Karaoke track generation, to enhance the results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your questions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given the effectiveness, which one is preferred(or any other solutions:)? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As pichenettes said, neither seems to suit your need: low-pass/high-pass filtering is bound to fail because of the harmonic structure of the human voice (and more generally of any &quot;interesting&quot; sound - i.e. anything beyond sinusoids...). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the 2nd one, let two channels A and B, will (B-A) or (A-B) used when compute the background? As with merging two channels, does the arithmetic mean accurate enough? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again, the second method you mention won't do because you can only remove the signal which is in the center, not retrieve it. In other words, even the vocals are in the &quot;center&quot;, there is no simple maths to get a vocals only signal.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Or I can downsample each channel by a factor of two and interleave the downsampled signals as mono result?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;er... averaging the channels to obtain a mono-channel signal, as suggested above, makes sense, and won't break the spectral characteristics of your signal (assuming the stereo signal is not degenerated). So you obtain a mono signal in which you have, basically, the same musical content as before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correctly downsampling each channel means you first apply a low-pass filter (with cut-off frequency of sampling_rate/4 in your case), and then you can safely take every 2 samples. There not much to say however about interleaving the channels thus downsampled: in most general cases, this is breaking the spectral characteristics of your signal. You probably do not want that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the operation of low-pass filtering followed by setting to 0 every 2 samples, and keeping these 0's leads, in the Fourier domain, to &quot;mirroring&quot; the low frequency components that were kept onto the high frequency ones. Remember you signal processing lessons on sampling theory: multiplying by a sequence of impulses (or diracs) results in a convolution with another sequence of diracs in the Fourier domain, i.e., in that case, the frequency spectrum of the signal is repeated (periodized) along the frequency axis, with a period equal to the sampling rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, when downsampling, you remove the 0's (because you assume a new sampling rate). But here, keeping them results in very annoying additional high frequency components. Interleaving these signals is not going to correct this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, all in all, the short answer: &lt;em&gt;don't do that&lt;/em&gt;. :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At last, I might also suggest you to use the GUI I developed for the LVAICA 2012 conference: there is a &lt;a href=&quot;https://github.com/wslihgt/sepLeadPySide&quot; rel=&quot;noreferrer&quot;&gt;git repo&lt;/a&gt; for it. I am still debugging and improving it, so comments are welcome :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="1301" LastActivityDate="2012-04-25T20:41:39.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2179" PostTypeId="2" ParentId="2170" CreationDate="2012-04-25T21:15:51.620" Score="3" Body="&lt;p&gt;A bandpass filter with steep transitions and a flat passband approaches a rectangular shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A rectangle in one FT domain is a Sinc function in the other domain.  This is true for a rectangular window in the time domain creating spectral &quot;leakage&quot; in the frequency domain.  Or for a rectangular window in the frequency domain creating a spiral packet in the time domain.  The narrower the rectangle (bandwidth) the wider the Sinc.  (And a Sinc function &quot;rings&quot; on both sides).  For a given width in one domain, the only way to get something narrower in energy extent than a Sinc in the other domain is to use something that looks closer to a Gaussian than a rectangle, e.g. no steep edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider shifting that rectangle in one domain (e.g. changing the passband frequency of the bandpass filter).  A circular shift in one DFT domain is a linear phase rotation in the other domain.  Sum with a complex conjugate to get a real response, and two oppositely and rapidly rotating complex exponential spiral packets become a ringing time domain response.  The rapidity of the ringing will be related to the bandpass center frequency and the length of the ringing will be related to the narrowness of bandwidth and transition steepness.  If the spiral rotates more than one half turn before the envelope dies out, there will be ringing.  The way to make that envelope die out faster in one domain is to use a wider rounder function in the other domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using Remez or Parks-McClellen tool to design your filters, you will end up with an equi-ripple response.  A sinusoid in one FT domain is an impulse in the other.  Therefore equi-ripple in the frequency domain will be an impulse, or &quot;tick&quot; in the time domain.  That &quot;tick&quot; will be displaced from the center of the impulse response by the &quot;frequency&quot; of the ripple in the frequency domain.  The flatter the Remez-designed filter, the faster the ripple gets, the more the &quot;tick&quot; is displaced from the impulse response.  That's part of the pre-ring.  Use a less agressive filter design methodology to avoid it.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-04-25T21:47:20.580" LastActivityDate="2012-04-25T21:47:20.580" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2180" PostTypeId="2" ParentId="227" CreationDate="2012-04-25T21:24:53.730" Score="10" Body="&lt;p&gt;Here is a C# code for 1D squared euclidean distance transform according to the &lt;a href=&quot;http://www.cs.brown.edu/~pff/dt/&quot; rel=&quot;noreferrer&quot;&gt;Felzenszwald &amp;amp; Huttenlocher's paper&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private static void DistanceTransform(double[] dataInput, ref double[] dataOutput)&#xA;{&#xA;    int n = dataInput.Length;&#xA;&#xA;    int k = 0;&#xA;    int[] v = new int[n];&#xA;    double[] z = new double[n + 1];&#xA;&#xA;    v[0] = 0;&#xA;    z[0] = Double.NegativeInfinity;&#xA;    z[1] = Double.PositiveInfinity;&#xA;&#xA;    double s;&#xA;&#xA;    for (int q = 1; q &amp;lt; n; q++)&#xA;    {&#xA;        while (true)&#xA;        {&#xA;            s = (((dataInput[q] + q * q) - (dataInput[v[k]] + v[k] * v[k])) / (2.0 * q - 2.0 * v[k]));&#xA;&#xA;            if (s &amp;lt;= z[k])&#xA;            {&#xA;                k--;&#xA;            }&#xA;            else&#xA;            {&#xA;                break;&#xA;            }&#xA;        }&#xA;&#xA;        k++;&#xA;&#xA;        v[k] = q;&#xA;        z[k] = s;&#xA;        z[k + 1] = Double.PositiveInfinity;&#xA;    }&#xA;&#xA;    k = 0;&#xA;&#xA;    for (int q = 0; q &amp;lt; n; q++)&#xA;    {&#xA;        while (z[k + 1] &amp;lt; q)&#xA;        {&#xA;            k++;&#xA;        }&#xA;&#xA;        dataOutput[q] = ((q - v[k]) * (q - v[k]) + dataInput[v[k]]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This can be readily used for binary and grayscale images by applying it first on image columns and then rows (or vice versa, of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transform is indeed very fast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the source and output images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HsTbD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VgsIg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The black pixels have value 0 and the white have some large value (have to be larger than largest possible squared distance in the images but not infinity) so that the transform returns distance from the black pixels and the white ones are ommited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get true euclidean distance transform, simply take a square root of each pixel from the output image.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-04-25T21:24:53.730" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2182" PostTypeId="1" AcceptedAnswerId="2188" CreationDate="2012-04-25T23:24:36.977" Score="5" ViewCount="3418" Body="&lt;p&gt;I'm using digital filters to apply spectral mangling-type special effects to audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using a digital filter (vsts/standalone DSP programs/outboard digital filter, etc.), especially when using narrow transition bands/brickwall filters, are there any effective ways to remove ringing artifacts introduced by the filter?  Please bear in mind I am new to DSP and my level of understanding is very basic.&lt;/p&gt;&#xA;" OwnerUserId="1304" LastEditorUserId="76" LastEditDate="2012-07-15T19:01:18.133" LastActivityDate="2012-07-15T19:01:18.133" Title="What methods can be used to remove ringing artifacts in the output of a digital filter?" Tags="|filters|noise|equalization|gibbs-phenomenon|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="2183" PostTypeId="1" AcceptedAnswerId="2186" CreationDate="2012-04-26T01:15:55.977" Score="3" ViewCount="374" Body="&lt;p&gt;In my foray into detections, I am trying to understand how best to generate &lt;a href=&quot;http://en.wikipedia.org/wiki/Receiver_operating_characteristic&quot; rel=&quot;nofollow&quot;&gt;receiver operating characteristic&lt;/a&gt; (ROC) curves, and some questions have come up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my studies, I have found out that ROC curve generation is simply the plot of true-positive rate (TPR) versus false-positive rate (FPR). Naturally one wants TPR to be 1 and FPR to be 0. I also understand that each point on the ROC curve, (a point with one TPR and FPR coordinate) corresponds to one set of detector 'settings' (threshold(s)). With one setting fixed, we will compare all positive 'detects' to all actual number of true positives, and true negatives, and thus yield TPR and FPR. My questions are as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It seems to me that we &lt;strong&gt;must&lt;/strong&gt; have a labelled data set(s) in order to do this to begin with. That is, we have to manually or otherwise, go through all the data we have, and label them as 'yes' or 'no'. (I realize this might seem obvious but I want to confirm). Is this true?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Somewhat related to the above - if in order to generate a true ROC curve that properly captures the detector performance we have to have 'no' data, then it seems to me that we have to have 'no' data that captures &lt;strong&gt;almost every possibility that exists in the universe&lt;/strong&gt;. Clearly this is not feasible, but then &lt;strong&gt;how can one claim with any good faith that a detector truly has a certain false alarm rate?&lt;/strong&gt; This is what confuses me the most.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it unheard of for detectors to have ROC curves that almost never false alarm, but that have normal looking variance on the y-axis? Put another way: Is it unheard of for detectors to have very little variance on the false-positive axis (x-axis) but a lot more variance on the true-positive axis (y-axis), for a fixed SNR? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think that just about summarizes my questions, thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT Number 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not think I understand the feedback. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Theoretical aspect:&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I statistically 'model' every single possibility in order for me to theoretically characterize it to begin with? For example, lets say that I have a detector that detects the presence of a signal of 10 Hz. The input can be anything under the sun. Maybe its 10Hz in noise. Maybe its 11Hz and no noise. Maybe its 10.5Hz on top of a linear chirp, or a bird song. Maybe its brown noise overlayed with human voice, overlayed with a 60Hz power supply. How does one model that, or &lt;em&gt;any&lt;/em&gt; of the myriad combinations therein? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know if I can get the theoretical performance of my detector, because quite simply I do not see how thats possible for realistic scenarios where &lt;em&gt;anything&lt;/em&gt; can be your input! This goes back to Point#2, whereby, how can one possibly know of every possible input into the detector? I could be wrong on this so please show me how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Practical aspect:&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore in this sense, I suppose my question is: I already have a detector in place. It takes an input vector, and spits out a decision, 'yes' or 'no'. I understand that I have to &lt;em&gt;label&lt;/em&gt; my data sets in order to come up with true positive and false positive rates. In this case it seems to me that the only possibility is to come up with a data set that represents just about anything possible under the sun, and test that against your detector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I not getting here? &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-04-26T21:20:29.343" LastActivityDate="2012-04-26T21:58:02.463" Title="Questions on the generation of R.O.C. curves" Tags="|noise|snr|signal-detection|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2184" PostTypeId="5" CreationDate="2012-04-26T12:02:34.913" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2012-04-26T12:02:34.913" LastActivityDate="2012-04-26T12:02:34.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2185" PostTypeId="4" CreationDate="2012-04-26T12:02:34.913" Score="0" Body="Python is a high-level interpreted general programming language.  Python has popular numerical and scientific libraries/packages, most notably numpy and scipy.  The scipy.signal package is a powerful signal processing software collection.  This tag covers the use of numpy, scipy, and other Python packages often used for SP computations. " OwnerUserId="306" LastEditorUserId="306" LastEditDate="2012-04-26T13:29:18.837" LastActivityDate="2012-04-26T13:29:18.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2186" PostTypeId="2" ParentId="2183" CreationDate="2012-04-26T15:32:49.260" Score="4" Body="&lt;p&gt;Question 1) Yes, you must know what the right answer is before-hand in order to judge the receiver's performance.  I am doing this right now on a project.  I generate data, scramble it, modulate it, add noise and carrier offset, etc., then I give it to the receiver.  The bits I started out with are my &quot;yes/no&quot; labels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2) All such measurements are statistical in nature.  Noise is statistical.  Jitter is statistical.  A priori channel conditions are statistical.  Of course the ROC curve is also statistical.  How could it be otherwise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 3) I don't quite understand this question.  A picture would help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Receivers are not tested in every set of conditions under the sun.  First, the designers rely on everyone obeying the FCC requirements for a given band, so in a cellular band they assume that there won't be any TV stations, or radar chirps, and that all other cellular signals will be at specified frequencies and power levels, with specified maximum carrier offsets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The designers then model &quot;typical&quot; environments (i.e. channels).  That implies certain transmission losses due to free-space path loss, antenna gains, multi-path, etc.  They then put together various typical and worst-case scenarios and test it under those conditions.  For example, a worst case interference scenario would be having adjacent signals at the maximum allowed power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the performance is as expected for those selected conditions, the designers assume, through &quot;interpolation&quot;, that it will perform acceptably in the other non-tested environments.  Conditions can always be worse than the worst-case test scenario of course.  That is when the phone drops the call. :-)&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-04-26T21:58:02.463" LastActivityDate="2012-04-26T21:58:02.463" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2187" PostTypeId="2" ParentId="1919" CreationDate="2012-04-26T23:13:03.983" Score="4" Body="&lt;p&gt;To elaborate a bit more on the previous answers, computing the auto-correlation of a signal of length $N$ results in a (sampled) auto-correlation of size $2N-1$. Well, actually, it should be infinite, but the auto-correlation outside $[-(N-1), N-1]$ equals $0$ anyway. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you desire to use the discrete Fourier transform (DFT) to compute it, and the formula is indeed the inverse DFT of the squared magnitude of the DFT of your signal. But think about it: if we take it the other way around and compute the DFT of the auto-correlation, you end up with a spectrum of size $2N-1$, if you don't want to lose samples in the way! That spectrum therefore has to be of size $2N-1$, and that's the reason why you need to zero-pad your time-domain signal up to $2N-1$, compute the DFT (on $2N-1$ points), and proceed with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way of seeing this is to analyze what happens if you compute the DFT on $N$ points: this is equivalent to downsampling your (continuous frequency) discrete time Fourier transform (DTFT). Retrieving the auto-correlation, which should be of size $2N-1$, with an under-sampled spectrum of size $N$ therefore leads to time aliasing (the circularity pichenettes was talking about), which explains why you have this symmetrical pattern in the &quot;right hand side&quot; if your output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, the code provided by Hilmar also works, because as long as you zero-pad up to more than a size of $N-1$ (in his case, he computes an FT of size $N$), you &quot;over-sample&quot; your FT, and you still get your $2N-1$ &quot;useful&quot; samples (the other ones should be $0$s). So, for efficiency, just zero-pad to $2N-1$, that's all what you need (well, perhaps you'd better zero-pad up to the next power of 2 of $2N-1$, if you use FFTs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short: you should have done this (to be adapted to your programming language):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;autocorr = ifft( complex( abs(fft(inputData, n=2*N-1))**2, 0 ) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;autocorr = ifft(abs(fft(inputData, 2*N-1)).^2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1301" LastActivityDate="2012-04-26T23:13:03.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2188" PostTypeId="2" ParentId="2182" CreationDate="2012-04-27T00:12:07.077" Score="7" Body="&lt;p&gt;Sticking with linear systems, removing the ringing is nearly the same as adding back some of the spectral content that your really steep transition filters removed.  Why use some crazy scheme to add back the stuff in the &quot;softer&quot; transitions that your hard-edged filters cut out?  Just use a more reasonable total filter response in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going to non-linear systems, you could use some sort of AI pattern matching to determine what kind of sound waveforms would be perceived by a human a ringing, and just gate those waveforms out.  But that might just add weird sounding artifacts of its own (as well as also spreading spectral content outside of your really steep filters).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-07-15T18:04:24.663" LastActivityDate="2012-07-15T18:04:24.663" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2189" PostTypeId="1" AcceptedAnswerId="2190" CreationDate="2012-04-27T11:39:34.783" Score="1" ViewCount="1195" Body="&lt;p&gt;I have a stochastic process completely uncorrelated. Why the autocorrelation function has a delta of dirac in the origin?&#xA;Which is the reason of that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R_{XX}({\tau})=A{\delta(\tau)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $R_{XX}$ is the autocorrelation function of $X$ process and $A$ is a constant dependent by process spectrum&lt;/p&gt;&#xA;" OwnerUserId="1141" LastActivityDate="2012-04-27T14:28:25.410" Title="signal uncorrelated with delta in the origin" Tags="|autocorrelation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2190" PostTypeId="2" ParentId="2189" CreationDate="2012-04-27T12:52:43.717" Score="3" Body="&lt;p&gt;It has a delta at the origin because you are multiplying your time series with itself (i.e. there is no time delay).  Any non-zero time series correlated with itself will give a positive value.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-04-27T12:52:43.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2191" PostTypeId="1" CreationDate="2012-04-27T13:01:44.007" Score="8" ViewCount="479" Body="&lt;p&gt;The Fourier transform takes a signal and splits it into a series of sine and cosine waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am &lt;em&gt;told&lt;/em&gt; that it's supposed to be possible to split a signal into some other set of functions. My question is: How do you do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm presuming that the set of functions you use would have to have certain properties for this to work. (E.g., you have to have &quot;enough&quot; different functions to capture all the information of the original signal.) How do you figure out whether your set of functions is suitable? And then how do you do the actual splitting?&lt;/p&gt;&#xA;" OwnerUserId="1309" LastActivityDate="2012-05-01T10:13:29.013" Title="How to generalise the Fourier transform?" Tags="|fourier-transform|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2192" PostTypeId="2" ParentId="2191" CreationDate="2012-04-27T14:01:16.073" Score="7" Body="&lt;p&gt;The Fourier Transform is just one of so many different transforms that alter the representation of (usually) a time-series from the time domain, to another domain (usually a frequency domain but other representations exist for other transforms such as time / frequency, time / scale and others).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find much more information about transforms in general from &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_transforms&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Wikipedia list of articles&lt;/a&gt; that lists some popular and often used transforms. (You might want to focus on the Discrete and Integral Transforms at first)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can check out &lt;a href=&quot;https://dsp.stackexchange.com/questions/2149/wavelet-transform&quot;&gt;this recent discussion&lt;/a&gt; on how the Wavelet transform, achieves a decomposition similar to that of the Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, when you have the luxury to have acquired simultaneously many different time series from the same phenomenon you can even employ techniques such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Principal_component_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Principal Component Analysis (PCA)&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Independent Component Analysis (ICA)&lt;/a&gt; which go to the point of transforming a signal to a sum of elementary waveforms that are actually extracted from the signal itself (rather than being pre-set as it is done in the Fourier (and related transforms) or Wavelets).&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-04-27T14:01:16.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2193" PostTypeId="2" ParentId="2189" CreationDate="2012-04-27T14:28:25.410" Score="1" Body="&lt;p&gt;As you noted, the wide-sense stationary stochastic process $X(t)$ is uncorrelated with itself for all nonzero time lags $\tau$. For $\tau=0$, it's impossible for a process to be uncorrelated with itself (unless $X(t)$ is the trivial process $X(t)=0$). Look at the definition for $R_{XX}(\tau)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;R_{XX}(\tau) = E(X(t)X^*(t+\tau)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;R_{XX}(0) = E(|X(t)|^2)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By definition, $|X(t)|^2$ must be $\ge 0$, so its expectation must also satisfy that condition.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-27T14:28:25.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2194" PostTypeId="1" AcceptedAnswerId="2195" CreationDate="2012-04-27T15:54:07.377" Score="1" ViewCount="732" Body="&lt;p&gt;why if I lose 80% power in the output of a system, Does it mean that I had lost &lt;code&gt;10×log10(0.2) = -7dB&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2015-07-30T14:21:46.100" LastActivityDate="2015-07-30T14:21:46.100" Title="How to calculate dB of a transmitted power" Tags="|digital-communications|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2195" PostTypeId="2" ParentId="2194" CreationDate="2012-04-27T16:12:19.693" Score="9" Body="&lt;p&gt;If you have a system that causes 80% of its input power to be lost, then 20% of the input power will remain at the output. The power gain of the network is therefore:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;G = \frac{P_{out}}{P_{in}} =0.2&#xD;&#xA;$$&#xA;$$&#xD;&#xA;G|_{dB} = 10 \log_{10}(G) = 10 \log_{10}(0.2) \approx -7 \text{ dB}&#xD;&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-27T16:12:19.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2196" PostTypeId="1" AcceptedAnswerId="2198" CreationDate="2012-04-27T16:31:10.543" Score="2" ViewCount="874" Body="&lt;p&gt;I'm experimenting with applying unusual 'spectral mangling' type special effects to audio.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)  What DSP techniques can be used to change the timbre of a complex tone, such as that produced by the voice, or a musical instrument?    &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are there any ways to manipulate the level of specific frequencies in the spectral profile of a complex tone. E.g. Assuming a tone with a fundamental frequency of 440 hz, use some DSP method to augment, for example the 2nd harmonic overtone at 1320Hz Khz, or remove another peak at say, 3Khz).   &lt;/li&gt;&#xA;&lt;li&gt;What's the best way to remove specific frequencies, or as narrow bands of frequencies as possible using DSP?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I use mixing/mastering, offline, and real time DSP VSTs, standalone programs, outboard effects units, but am interested in any methods which could work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What alternatives (if any), are there to using techniques which introduce significant ringing or other artifacts which degrade the sound?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Are there any ways to 'clean up' audio after processing, removing artefacts which have been introduced?&lt;/p&gt;&#xA;" OwnerUserId="1304" LastEditorUserId="76" LastEditDate="2012-07-15T19:01:28.257" LastActivityDate="2012-07-15T19:01:28.257" Title="What DSP techniques can be used to change the timbre of complex tone?" Tags="|filters|noise|frequency-spectrum|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2197" PostTypeId="1" CreationDate="2012-04-27T17:34:49.873" Score="9" ViewCount="6333" Body="&lt;p&gt;I see that there are different ways to write an AR model into a state-space representation, so that we can apply Kalman filter to estimate the signal. See Example 1, 2 and 3 &lt;a href=&quot;http://faculty.washington.edu/ezivot/econ584/notes/statespacemodels.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder what differences are between the different state-space representations on the estimation by Kalman filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="203" LastActivityDate="2013-03-11T02:40:27.590" Title="Different state-space representations for Auto-Regression and Kalman filter" Tags="|kalman-filters|autoregressive-model|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2198" PostTypeId="2" ParentId="2196" CreationDate="2012-04-27T18:04:10.367" Score="2" Body="&lt;p&gt;Phase vocoders with custom resynthesizers can be used for this, as in time pitch stretching code that attempts to preserve the spectral formant envelope.  But phase vocoder analysis/resynthesis is not artifact-free.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-04-27T18:04:10.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2199" PostTypeId="1" AcceptedAnswerId="2200" CreationDate="2012-04-27T18:07:30.500" Score="13" ViewCount="7175" Body="&lt;p&gt;I am developing software that calculates the response of a system by comparing the FFT of input and output signals.  The input and output signals are divided into windows and, for each window, the signals are median-subtracted and multiplied by a Hann function.  The instrument response for that window is then the ratio of the FFTs of the processed data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the above is standard procedure, although I may be describing it poorly.  My problem comes in how to combine the responses from the multiple windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can see, the correct approach is to average the complex values, across all windows.  The amplitude and phase response are then the amplitude and phase of the average, complex value at each frequency:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;av_response = sum_windows(response) / n&#xA;av_amplitude = sqrt(real(av_response)**2 + imag(av_response)**2)&#xA;av_phase = atan2(imag(av_response), real(av_response))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with implicit loops over frequency bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have been asked to change this to calculate amplitude and phase in each window &lt;em&gt;first&lt;/em&gt;, and then average the amplitudes and phases across all windows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;amplitude = sqrt(real(response)**2 + imag(response)**2)&#xA;av_amplitude = sum_windows(amplitude) / n&#xA;phase = atan2(imag(response), real(response))&#xA;av_phase = sum_windows(phase) / n&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have argued that this is incorrect because averaging angles is &quot;just wrong&quot; - the average of 0 and 360 degrees is 180, for example, but the people I am working with responded by saying &quot;OK, we will only display amplitude&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Am I correct in thinking that the second approach is generally incorrect&#xA;for amplitudes too?&lt;/li&gt;&#xA;&lt;li&gt;If so, are there any exceptions that may be relevant, and which may explain&#xA;why the people I am working with prefer the second method?  For example,&#xA;it looks like the two approaches will agree as the noise becomes small, so perhaps this&#xA;is an accepted approximation for low noise?&lt;/li&gt;&#xA;&lt;li&gt;If the second approach is incorrect, are there any convincing, authoritative references that I can use &#xA;to show this?&lt;/li&gt;&#xA;&lt;li&gt;If the second approach is incorrect, are there any good, easy to understand examples that show this for amplitude&#xA;(as the average of 0 and 360 degrees does for phase)?&lt;/li&gt;&#xA;&lt;li&gt;Alternatively, if &lt;em&gt;I&lt;/em&gt; am incorrect, what would be a good book for me to educate&#xA;myself better?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have tried to argue that the average of -1 1 1 -1 1 -1 -1 should be zero rather than 1, but that was unconvincing.  And while I think I could, with time, construct an argument based on max likelihood estimation given a particular noise model, it is not the kind of reasoning that the people I am working with will listen to.  So, if I am not wrong, I need either a powerful argument from authority or an &quot;obvious&quot; demonstration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[I tried to add more tags, but can't find relevant ones and can't define new ones as a new user - sorry]&lt;/p&gt;&#xA;" OwnerUserId="1310" LastEditorUserId="1310" LastEditDate="2012-04-27T19:54:53.440" LastActivityDate="2019-07-17T11:30:43.530" Title="How to Average Complex Responses (and Justification)?" Tags="|fft|statistics|frequency-response|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2200" PostTypeId="2" ParentId="2199" CreationDate="2012-04-27T19:24:44.417" Score="14" Body="&lt;p&gt;Transfer function estimation is usually implemented slightly differently than the method you describe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your method computes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left\langle \frac{\mathcal{F}[y]}{\mathcal{F}[x]} \right\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\langle$angle brackets$\rangle$ represent averages taken over data segments, and a windowing function is applied to each data segment before taking the Fourier transform ($\mathcal{F}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more typical implementation will compute the &lt;em&gt;cross spectral density&lt;/em&gt; of x and y divided by the &lt;em&gt;power spectral density&lt;/em&gt; of x:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\langle \mathcal{F}[y] \cdot \mathcal{F}[x]^* \rangle}{\langle|\mathcal{F}[x]|^2\rangle} = \frac{\langle \mathcal{F}[y] \cdot \mathcal{F}[x]^* \rangle}{\langle\mathcal{F}[x]\cdot\mathcal{F}[x]^*\rangle}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\cdot$ represents a pointwise product, and $*$ the complex conjugate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe this is to reduce the effect of data segments where bins of $\mathcal{F}[x]$ are excessively small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Incoherent estimation&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your employer has suggested that you estimate the transfer function using &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{|\langle \mathcal{F}[y]|\rangle}{\langle |\mathcal{F}[x]|\rangle}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;em&gt;will work&lt;/em&gt;, but has two big disadvantages:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You don't get any phase information.&lt;/li&gt;&#xA;&lt;li&gt;If your measurements of the input $x$ and output $y$ have any additional noise, then the transfer function estimation will not be correct.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Your method and the method I described circumvent these problems by using &lt;em&gt;coherent averaging&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general idea of using overlapped, averaged segments to compute power spectral densities is known as &lt;em&gt;Welch's method&lt;/em&gt;.  I believe the extension to using this to estimate &lt;em&gt;transfer functions&lt;/em&gt; is also often known as Welch's method, although I'm not sure if it is mentioned in Welch's paper.  Looking up Welch's paper might be a valuable resource.  A useful monograph on the subject is Bendat and Piersol's book, &lt;a href=&quot;http://www.amazon.de/Random-Data-Measurement-Procedures-Probability/dp/0470248777&quot;&gt;&lt;em&gt;Random Data: Analysis and Measurement Procedures&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Validation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To validate your software, I suggest applying several test cases, where you generate Gaussian white noise and feed it through a digital filter with a known transfer function.  Feed the inputs and outputs into your transfer function estimation routine and verify that the estimate converges to the known value of the transfer function.&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-04-27T20:22:39.510" LastActivityDate="2012-04-27T20:22:39.510" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2201" PostTypeId="2" ParentId="2199" CreationDate="2012-04-27T19:55:43.457" Score="13" Body="&lt;p&gt;Welcome to Signal Processing!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're absolutely right. You cannot simply average DFT magnitudes and phases separately, especially phases. Here's a simple demonstration:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$z = a+bi$&lt;/span&gt;. By definition, magnitude &lt;span class=&quot;math-container&quot;&gt;$|z|$&lt;/span&gt; and phase &lt;span class=&quot;math-container&quot;&gt;$\angle z$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|z| = \sqrt{a^2 + b^2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\angle z = \tan ^{-1} \left( \frac{b}{a} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Average &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; of two complex values &lt;span class=&quot;math-container&quot;&gt;$z_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z_2$&lt;/span&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$z = \frac{ z_1 + z_2 } {2} = \frac{ a_1+b_1i + a_2 + b_2i } {2}  = \frac{ (a_1+a_2) + (b_1 + b_2)i } {2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|z| = \sqrt{\frac{(a_1+a_2)^2}{4} + \frac{(b_1+b_2)^2}{4}} = \frac{1}{2}\sqrt{(a_1+a_2)^2 + (b_1+b_2)^2}\neq \frac{\sqrt{a_1^2 + b_1^2}+\sqrt{a_2^2 + b_2^2}}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\angle z = \frac{\tan ^{-1} \left( \frac{b_1}{a_1} \right) + \tan ^{-1} \left( \frac{b_2}{a_2} \right)}{2} \neq \tan ^{-1} \left( \frac{2(b_1+b_2)}{2(a_1+a_2)} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you compare the degree to which these inequalities hold, you can say that the approximation for &lt;span class=&quot;math-container&quot;&gt;$|z|$&lt;/span&gt; is off by a quadratic term, while approximation for &lt;span class=&quot;math-container&quot;&gt;$\angle z$&lt;/span&gt; in &lt;strong&gt;&lt;em&gt;completely&lt;/em&gt;&lt;/strong&gt; meaningless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in order to do what you're trying to do I suggest the following. Theoretically, you can find an impulse response of a system by dividing DFT of the output by DFT of the input. However, in presence of noise you're going to get very strange results. A slightly better way to do it would be to use dual-channel FFT impulse response estimation, which goes as follows (derivation not provided here, but you can find it online).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$G_i(f) = \dfrac{ F^1_i(f) + F^2_i(f) + \cdots + F^N_i(f) }{N}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$F^k_i(f)$&lt;/span&gt; is the DFT of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th (hence superscript &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;) windowed chunk of input signal (hence subscript &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; for &lt;em&gt;input&lt;/em&gt;). Similarly, for &lt;em&gt;output&lt;/em&gt; signal, let &lt;span class=&quot;math-container&quot;&gt;$G_o(f) = \dfrac{ F^1_o(f) + F^2_o(f) + \cdots + F^N_o(f) }{N}$&lt;/span&gt;. You can see that the &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; signals are simply the averages of the windowed DFTs. Then the statistical dual-channel FFT approximation &lt;span class=&quot;math-container&quot;&gt;$\hat{H}(f)$&lt;/span&gt; for the impulse response &lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{H}(f) = \frac{G_o(f)G_i^*(f)}{|G_i(f)|^2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the &lt;span class=&quot;math-container&quot;&gt;$(\cdot)^*$&lt;/span&gt; stands for complex conjugation (flip the sign of all your imaginary parts).&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="44195" LastEditDate="2019-07-17T11:30:43.530" LastActivityDate="2019-07-17T11:30:43.530" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="2202" PostTypeId="2" ParentId="2199" CreationDate="2012-04-27T20:04:45.507" Score="3" Body="&lt;p&gt;This is a difference between coherent and incoherent averaging of FFT spectra.  Coherent averaging is more likely to reject random noise in the analysis.  Incoherent is more likely to accentuate random noise magnitudes.  Which of these is more important to your result report?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-04-27T20:04:45.507" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2203" PostTypeId="1" CreationDate="2012-04-28T05:09:41.893" Score="4" ViewCount="709" Body="&lt;p&gt;I do work with computer graphics and am dipping my toes into ray tracing.  That field involves a good number of the subjects covered in DSP (Fourier transform, time vs frequency space, etc) but I was hoping to find a book in the realm that didn't also deal with, say, digital devices or electrical engineering-- not that I have anything against those subjects, but they're not germane to what I'm doing and I'd prefer not to wade through them on my way to DSP understanding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone recommend some books for someone in my position?  I've taken calculus and differential equations &amp;amp; linear algebra in the past and so am reasonably proficient as far as the mathematics involved.  Thanks much.&lt;/p&gt;&#xA;" OwnerUserId="1312" LastEditorUserId="6" LastEditDate="2012-04-30T16:22:58.147" LastActivityDate="2012-04-30T16:22:58.147" Title="Books that explain DSP well to those not directly in engineering?" Tags="|fourier-transform|frequency|reference-request|" AnswerCount="6" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2204" PostTypeId="1" CreationDate="2012-04-28T05:10:44.577" Score="8" ViewCount="656" Body="&lt;p&gt;Let's have an image (gray-scale or even binary) as shown on the following figure at the left hand side, the goal is to generate a list of points i.e., coordinates in the form of (x,y) for each pack of the dark pixels in the image.&lt;br&gt;&#xA;&lt;strong&gt;What are the proper image processing tools to do this and where are they available?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E7pc2.jpg&quot; alt=&quot;pixel packs to point coordinates&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Updates:&lt;/strong&gt;&lt;br&gt;&#xA;&lt;strong&gt;1)&lt;/strong&gt;&#xA;Here you may find some more details about the problem. (Note the variation in the size of packs)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aUnRi.jpg&quot; alt=&quot;details&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may suggest having packs detected to compute the convex-hull boundary for each and then find the representative centroid &lt;a href=&quot;https://gis.stackexchange.com/questions/22739/how-to-find-the-center-of-geometry-of-an-object&quot;&gt;&lt;strong&gt;{see this for details}&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rREES.jpg&quot; alt=&quot;pixel pack to convex-hull to center point&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt;&lt;br&gt;&#xA;Here is the result produced by application of Distance Transform (suggested by &quot;Libor&quot;). Note my annotations on the figure. The method does not work as it was promising!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c2ka4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt;&lt;br&gt;&#xA;Erosion eliminates small packs!  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from __future__ import division&#xA;from scipy import zeros, ndimage as dsp&#xA;from pylab import subplot,plot,matshow,show&#xA;&#xA;img = zeros((30,30))&#xA;img[10:14,10:14] = 1&#xA;img[16:17,16:17] = 1&#xA;img[19:23,19] = 1&#xA;img[19,19:23] = 1&#xA;&#xA;subplot(221)&#xA;matshow(img,0)&#xA;&#xA;subplot(222)&#xA;y = dsp.binary_erosion(img,[[1,1],[1,1]])&#xA;matshow(y,0)&#xA;&#xA;subplot(223)&#xA;y = dsp.binary_erosion(img,[[0,1,0],[1,1,1],[0,1,0]])&#xA;matshow(y,0)&#xA;&#xA;subplot(224)&#xA;y = dsp.binary_erosion(img,[[1,1,1],[1,1,1],[1,1,1]])&#xA;matshow(y,0)&#xA;&#xA;show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/syGMZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt;&lt;br&gt;&#xA;Well here is a &lt;strong&gt;Python&lt;/strong&gt; (i.e., the language of love :) ) implementation of the labeling idea (also proposed by &quot;Jean-Yves&quot; below):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subplot(221)&#xA;l,n = dsp.label(img)&#xA;sl = dsp.find_objects(l)&#xA;for s in sl:&#xA;    x = (s[1].start+s[1].stop-1)/2&#xA;    y = (s[0].start+s[0].stop-1)/2&#xA;    plot(x,y,'wo')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the result:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1dLrc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that although it is done in &lt;strong&gt;Python&lt;/strong&gt; so quick due to Scipy performance, the background procedure in &lt;code&gt;label&lt;/code&gt; function should be an exhausting iteration. This may be considered as a trade-off. So for a while I keep being eager to seek more efficient algorithms. And also note that in the given code above I found the center of geometry so simply while for complex or asymmetric shapes this may cause positioning to be biased. That is it is a work in progress ;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5)&lt;/strong&gt;&lt;br&gt;&#xA;Here is a complex case (a real image) captured from &lt;a href=&quot;http://www.calvin.edu/academic/phys/observatory/images/Astr110.Fall2005/DeFrain.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; on which the labelling proposal applied and you see the results. Note that it took only 0.015 s for whole procedure including labelling and finding the objects. &lt;a href=&quot;http://www.scipy.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Scipy&lt;/strong&gt;&lt;/a&gt; guys, did very well job, I think. Wow! {right-click on image, click on view image for full resolution}  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IY6rM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="488" LastEditorUserId="-1" LastEditDate="2017-04-13T12:34:15.513" LastActivityDate="2012-05-01T03:44:16.150" Title="How to: pixel packs in an image to representative point coordinates (x,y)" Tags="|point-cloud|morphological-operations|digitize|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2205" PostTypeId="2" ParentId="2204" CreationDate="2012-04-28T05:35:05.230" Score="2" Body="&lt;p&gt;One option would be to apply repeated &lt;a href=&quot;http://en.wikipedia.org/wiki/Erosion_%28morphology%29&quot; rel=&quot;nofollow&quot;&gt;morphological erosion&lt;/a&gt; to the image until it is fully eroded. At that point, each of the blobs shown above would be reduced down to a single pixel; you could take the locations of those pixels to be the list of points that you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-04-28T05:35:05.230" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="2206" PostTypeId="1" CreationDate="2012-04-28T07:19:28.217" Score="6" ViewCount="395" Body="&lt;p&gt;Is there a known technique for estimating how close a human speaker is to a single microphone? I'm hoping that there is a known technique that can analyze an incoming audio signal that contains a human voice with typical ambient room noise, and give a rough estimate of how close the speaker is to the microphone. Is there an algorithm/formula that can analyze such a signal and look for early reflections/reverb and then give a quality measurement back? Note, I am not looking for an estimate in units of distance (3 feet, etc.), just something that would tell me if the speaker is right on top of the mic, near the mic, far from the mic, or really far from the mic. Also, if it simplifies things, I can safely make the assumption that the speaker's voice will be significantly louder than any other human voice in the room.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any papers or especially open source libraries would be fantastic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PREREQUISITE: I would assume that an algorithm/formula that can detect if there is a human voice of significant volume present in an audio source would be a prerequisite for making the above quality measurement. Any information or resources along those lines would also be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1313" LastActivityDate="2012-09-21T19:57:05.210" Title="Rough estimate of how close a human speaker is to a microphone?" Tags="|impulse-response|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2208" PostTypeId="2" ParentId="2203" CreationDate="2012-04-28T15:34:20.467" Score="1" Body="&lt;p&gt;The first chapters of a large number of books on audiology, auditory neurology, computer music and the physics of music seem to cover these basics of the DSP subject area from a non-EE point of view.&#xA;For instance &quot;Music, a Mathematical Offering&quot; by Benson.  Also, Julius O. Smith seems to have published some of his Stanford CCRMA lecture material on the math behind computer music in book form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a general science non-textbook on frequency analysis in sonar and radar &quot;Blip, Ping, and Buzz&quot; by Mark Denny, and some recreational math books on various aspects of the Fourier series as well, including &quot;Dr. Euler's Fabulous Formula&quot; by Paul Nahin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an almost-textbook, I like the Dover reprint of &quot;Digital Filters&quot; by R. Hamming.  &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-04-28T18:46:14.313" LastActivityDate="2012-04-28T18:46:14.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2209" PostTypeId="2" ParentId="2203" CreationDate="2012-04-28T16:24:39.953" Score="3" Body="&lt;p&gt;There is a classic book of &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/013168728X&quot; rel=&quot;nofollow&quot;&gt;Gonzales &amp;amp; Woods: Digital Image Processing&lt;/a&gt;. You may find it as a good introductory material.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-04-28T16:24:39.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2211" PostTypeId="1" AcceptedAnswerId="2212" CreationDate="2012-04-28T21:57:52.497" Score="5" ViewCount="1860" Body="&lt;p&gt;I am trying to understand the mechanism of finding the transfer function for a Wiener function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|Rxx(0)   Rxx(-1) ...... Rxx(1-N)| | h(0) |   | Ryx(0) |&#xA;|Rxx(1)   Rxx(0)  ...... Rxx(2-N)| | h(1) | = | Ryx(1) | &#xA;|......   ......  ......  ...... | | .....|   |....... |&#xA;|Rxx(N-1) Rxx(N-2) ...... Rxx(0) | |h(N-1)|   |Ryx(N-1)|&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rxx is the autocorrelation of my input signal h is filter transfer function and Ryx is crosscorrelation of the input and output signal. My question is how to come up with the h. I mean i have two unknowns in this equation cause i dont know h and I dont know the y output signal therefore i cant calculate the crosscorelation Ryx.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something that I need to assume in order to get the h??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help. &lt;/p&gt;&#xA;" OwnerUserId="1311" LastEditorUserId="1279" LastEditDate="2012-04-29T02:53:45.657" LastActivityDate="2012-04-29T02:53:45.657" Title="Finding the Wiener filter transfer function" Tags="|filters|cross-correlation|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2212" PostTypeId="2" ParentId="2211" CreationDate="2012-04-28T22:22:40.310" Score="5" Body="&lt;p&gt;What you've listed is a classical set of linear equations known as the Wiener-Hopf Equations. There are many methods to solve this set of equations. These equations generalize the Yule-Walker equations for Autoregressive (AR) modeling. In fact, if the Wiener-Hopf equations are used to solve for a linear predictor of your signal, the equations are identical to the Yule-Walker equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in reality, there are many ways to solve these equations depending on how you're modeling your signal. This is where the concepts of Wiener filtering, Wiener smoothing, Wiener deconvolution arise. In each of these, they can be segmented further into causal/anti-causal realizations, FIR/IIR, etc. I recommend searching for the Wiener-Hopf equations and understand what they &lt;em&gt;mean&lt;/em&gt;, then solving them comes secondary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, consider if you assume that you have a signal with additive noise that is uncorrelated with the signal. Then the cross-correlation terms have no dependence on the signal. Then you need to model your noise and plug in the resulting autocorrelation sequence on the right hand side of the equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="1279" LastEditorUserId="1279" LastEditDate="2012-04-28T22:51:34.753" LastActivityDate="2012-04-28T22:51:34.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2213" PostTypeId="2" ParentId="2204" CreationDate="2012-04-28T23:35:23.360" Score="3" Body="&lt;p&gt;You can also run a &lt;a href=&quot;http://en.wikipedia.org/wiki/Distance_transform&quot; rel=&quot;nofollow&quot;&gt;distance transform&lt;/a&gt; on the image, then detect local maxima (searching for pixels with highest/lowest value of all pixels in 3x3 pixel patch - can be larger depending on expected minimum distance between the original blobs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for detecting features of size 1-3 pixels, you need to double your sampling frequency (either upscale the source image or perform distance transform/erosion with sub-pixel accuracy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both distance transform and erosion approaches assumes that the features you are detecting are convex. Something with U shape, for example, may fire in your detector several times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;https://computation.llnl.gov/casc/sapphire/levelsets/levelsets.html&quot; rel=&quot;nofollow&quot;&gt;more elaborate method&lt;/a&gt; for such segmentation is based on &lt;em&gt;level sets&lt;/em&gt; and &lt;em&gt;active contours&lt;/em&gt;. It starts with a large closed curve which is iteratively adapted to your features. This method has been used on my university for counting cells and detecting chromosomes in microscope images.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-04-29T20:09:55.393" LastActivityDate="2012-04-29T20:09:55.393" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2214" PostTypeId="2" ParentId="2206" CreationDate="2012-04-28T23:41:56.113" Score="5" Body="&lt;p&gt;Here is one possible suggestion: use a second order microphone (e.g. cardioid microphone). The human voice is a point source and has strong reactive velocity near-field component which velocity mics are sensitive too. In plain English this means you get substantially more relative bass when the speaker is close by. You could leverage to compare the energy in the 500-1kHz Band to the energy in the 100-200Hz band. With some reasonable calibration you ought be to able to tell whether the speaker is close or far.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-28T23:41:56.113" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2216" PostTypeId="2" ParentId="2203" CreationDate="2012-04-29T04:09:16.217" Score="1" Body="&lt;p&gt;I have found Signal Analysis: Time, Frequency, Scale and Structure by Allen &amp;amp; Mills quite good.&#xA;Numerical Recipes by Press is also useful for a bit more of a grounding in the math behind processing techniques.&lt;/p&gt;&#xA;" OwnerUserId="1013" LastActivityDate="2012-04-29T04:09:16.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2217" PostTypeId="2" ParentId="2196" CreationDate="2012-04-29T04:45:44.833" Score="2" Body="&lt;p&gt;Looks like a regular equalizer should do the trick. In your particular example you could simply boost 1320Hz and cut 3kHz with parametric EQ. The &quot;Q&quot; control of the parametric determines the frequency selectivity and will also affect any ringing. However, unless the Q is ridiculously high, there will be no significant ringing at all.&#xA;There are many more DSP methods do achieve this but a parametric EQ is simple and I'm sure their VST plugins for that already. No need to re-invent the wheel.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-04-29T04:45:44.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2219" PostTypeId="2" ParentId="2191" CreationDate="2012-04-29T21:05:41.263" Score="5" Body="&lt;p&gt;In addition to the answers given here, I should add that there are situations in which uniqueness of decomposition or even completeness are not the most sought-after properties. Instead, a &quot;compact&quot; description with as little coefficients as possible is sought, and to this effect, it is useful to have a decomposition basis not bound to one single &quot;family&quot; of elements (say sine waves). In such situations, you can really put whatever you want in the basis you'll use for your decomposition, and the decomposition itself is performed using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Matching_pursuit&quot;&gt;Matching Pursuit algorithm&lt;/a&gt;. This proves to be well suitable for audio signals, which can exhibit both very steady, sustained segments (the long, decaying, almost pure sound of a vibraphone note), but also transient part (the very wide-band burst of energy at the beginning of the note).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-04-29T21:05:41.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2220" PostTypeId="2" ParentId="2203" CreationDate="2012-04-30T00:04:08.363" Score="0" Body="&lt;p&gt;Though it is a little dated, I am pretty sure &lt;a href=&quot;http://en.wikipedia.org/wiki/Computer_Graphics%3a_Principles_and_Practice&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Computer Graphics: Principles and Practice&lt;/em&gt; &lt;/a&gt; covers DSP from an image processing point of view.  I would borrow / interloan this before purchasing to see if it would help.&lt;/p&gt;&#xA;" OwnerUserId="1222" LastActivityDate="2012-04-30T00:04:08.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2221" PostTypeId="2" ParentId="2204" CreationDate="2012-04-30T06:36:04.453" Score="4" Body="&lt;p&gt;Just a naive suggestion: do you know about &lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling&quot; rel=&quot;nofollow&quot;&gt;component labeling&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The technique is about finding chunks of &quot;touching&quot; pixels and assigning them a label, &lt;em&gt;e.g.&lt;/em&gt; an integer number. You can then interrogate each chink separately, looking for the pixel that share the same label.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, here is the function that does it trivially: &lt;a href=&quot;http://www.mathworks.fr/help/toolbox/images/ref/bwlabel.html&quot; rel=&quot;nofollow&quot;&gt;bwlabel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2012-04-30T06:36:04.453" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2222" PostTypeId="2" ParentId="2204" CreationDate="2012-04-30T09:07:51.160" Score="3" Body="&lt;p&gt;I am afraid that whatever way you pick to do this, it is not going to be straightforward because to assign the targets to clusters you are going to have to go through the image (at least once).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose that getting the points is the easier problem of the two (you are probably already applying some form of thresholding for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To recover the clusters that points are grouped into and do it fast, you could create a &lt;a href=&quot;http://en.wikipedia.org/wiki/Quadtree&quot; rel=&quot;nofollow&quot;&gt;quad-tree structure&lt;/a&gt; that holds &quot;chains of connected pixels&quot; that are somewhere around the area of the quad-tree cell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way, you could iterate through the image and once you come across a pixel that is a target, &quot;push&quot; it in your quad-tree structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &quot;push&quot; operation would start an iterative process which would return the cell (in other words the specific area of the image) where the particular pixel lies in. You could then iterate through all the pixel chains that are assigned to that cell and try to &quot;push&quot; (again) the pixel to the pixel chain. A pixel chain accepts a new pixel if it is at least 1-pixel near to any of its already assigned pixels. If no pixel chain &quot;accepts&quot; the new pixel, then create a new pixel chain into this cell and assign the new pixel to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quad-tree here is a way to limit your search for the nearest pixel-chain and it would be required if your image is big and the targets numerous so that the pixel-chain push operations are done fast. If you know that you are not going to be dealing with a large number of targets then you could even skip the quad-tree and maintain a simple &quot;list of pixel chains&quot;. Every time you come across a &quot;target&quot; you could iterate through the lists and try &quot;pushing&quot; the pixel on them. If no list &quot;admits&quot; the pixel then create a new list and assign the pixel in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whichever way you choose to do it, at the end of this process you are going to have a set of connected &quot;pixel-chains&quot; (your clusters) which you can then pass to another part of your program that will be dealing with estimating their location. This can be convex-hull, model fitting (for example ellipsoid or other) or simply the mean / median of the x,y coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-04-30T09:07:51.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2223" PostTypeId="2" ParentId="2206" CreationDate="2012-04-30T10:02:32.387" Score="5" Body="&lt;p&gt;In general, this would be an &lt;a href=&quot;http://en.wikipedia.org/wiki/Automatic_gain_control&quot; rel=&quot;noreferrer&quot;&gt;Automatic Gain Control&lt;/a&gt; problem. For example, an AGC stage is found in many RF receivers to try and maintain a constant level of reception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The AGC is a simple feedback system that is monitoring the amplitude (or power) of a signal at its input, compares it with a reference level and uses this &quot;error&quot; signal to drive an amplifier that compensates for variations in the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, in very simple terms and as far as this question is concerned, the &quot;error&quot; signal contains this information of how far away is a source from the microphone that records it. Actually, in the audio world, there is already a device that deals with this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A variation of the AGC is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_range_compression&quot; rel=&quot;noreferrer&quot;&gt;&quot;compressor&quot;&lt;/a&gt;. The compressor, monitors a signal at its input and passes it, unchanged, in the output as long as its level is below a certain threshold. Once the signal goes above a certain threshold, the compressor reduces the amplification by a set amount. The key difference of the compressor is that this reduction in amplification is not kicking in and out instantly. Rather, there is the so called &quot;Attack&quot; and &quot;Decay&quot; times that determine how &quot;softly&quot; the compressor limits the signal or returns back to the original amplification over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A properly tuned compressor can be used to compensate for various performance styles or speakers (for example in the studio room of a radio station). People speaking passionately might come close to the microphone and also raise their voice. That's when the compressor politely kicks in and limits the signal from that microphone to avoid distortion and allow other speakers to be heard as well (otherwise you would have to lower the gain of that microphone manually and that's not practical for many microphones)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, a compressor with just one threshold would answer the simple question &quot;Speaker is close or away&quot; from the microphone. More thresholds would give more fine grained control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of libraries or toolboxes to achieve compression you could perhaps use &lt;a href=&quot;http://www.csounds.com/manual/html/compress.html&quot; rel=&quot;noreferrer&quot;&gt;CSound's relevant module&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for this application you might want to focus on the bandwidth of &lt;a href=&quot;http://en.wikipedia.org/wiki/Voice_frequency&quot; rel=&quot;noreferrer&quot;&gt;the fundamental frequency&lt;/a&gt; of voice (as a better indicator of what the speaker is doing, how many speakers are there, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, you can take your input signal, filter it with a simple band-pass filter (with a 85Hz-255Hz bandwidth), rectify the filtered signal (to get a measure of its level) and then pass it through an integrator with a high enough time constant (something like 100ms-300ms for example). This will return a slow varying smooth signal that you can use as an indicator of how far a &quot;human voice&quot; is from a microphone based on the amplitude of the signal. The integrator will smooth your signal enough to avoid sudden &quot;jumps&quot; in amplitude (in any case the speaker is not going to go from &quot;far&quot; to &quot;close&quot; in 2ms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a lot of relevant research, elements of which you can use in your application if you search for &lt;a href=&quot;http://scholar.google.co.uk/scholar?hl=en&amp;amp;q=sound%20gender%20identification&amp;amp;btnG=Search&amp;amp;as_sdt=0,5&amp;amp;as_ylo=&amp;amp;as_vis=1&quot; rel=&quot;noreferrer&quot;&gt;&quot;Gender Identification&quot;&lt;/a&gt; (from audio recordings) or &lt;a href=&quot;http://en.wikipedia.org/wiki/Computational_auditory_scene_analysis&quot; rel=&quot;noreferrer&quot;&gt;&quot;Audio scene analysis&quot;&lt;/a&gt;. (These are mostly falling in the field of classification of course)&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-04-30T10:02:32.387" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2224" PostTypeId="2" ParentId="2203" CreationDate="2012-04-30T15:54:55.063" Score="0" Body="&lt;p&gt;Steven W. Smith &lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;Digital Signal Processing&lt;/a&gt; is pretty good and is available for free on the website.&lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-04-30T15:54:55.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2225" PostTypeId="2" ParentId="2203" CreationDate="2012-04-30T16:11:00.970" Score="5" Body="&lt;p&gt;I am surprised no one has mentioned &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0137027419&quot;&gt;Richard Lyon's&lt;/a&gt; book - by far one of the BEST books out there on understanding digital signal processing in a &lt;em&gt;very&lt;/em&gt; clear, concise, and methodological way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its excellence comes from that fact that he explains concepts to you in a very easy way to grasp, &lt;em&gt;without&lt;/em&gt; loss of rigor or detail needed to get to the heart of various DSP concepts. He does not shy away from math, (which is good), but you are guaranteed to understand all of it. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-04-30T16:11:00.970" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2226" PostTypeId="2" ParentId="2191" CreationDate="2012-05-01T10:13:29.013" Score="2" Body="&lt;p&gt;The Fourier transform is one of the many ways to express a function as a weighted sum of some other functions, often called basis functions. This can be done for two reasons&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The basis function can have physical meaning and/or give some insight into the nature of the original function. The basis function can be viewed as the &quot;constituent components&quot; of the function.&lt;/li&gt;&#xA;&lt;li&gt;It can make the math easier. Instead of doing some operation on the function, you can split it into basis functions, operate on the basis functions and then out it back together again. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The Fourier Transform is popular as it does both: the basis functions are sine wave with the parameter &quot;frequency&quot; have well defined physical meaning and they are also invariant to linear time invariant systems. I.e. sine wave in gives sine wave out. Both properties are quite useful.&#xA;The Fourier Transform is my no means the only way of doing this. Any set of linear independent functions can be used. Popular are orthonormal bases as it makes the actual transforms real easy. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-05-01T10:13:29.013" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2227" PostTypeId="1" AcceptedAnswerId="2228" CreationDate="2012-05-01T14:10:09.603" Score="16" ViewCount="325" Body="&lt;p&gt;I'm trying to replicate the ideas from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Eigenface&quot;&gt;Eigenface page&lt;/a&gt; on wikipedia. From a hundred sample images represented by a data matrix $\bf X$ (where each image flattened to a vector of length $n$, thus $\bf X$ is a $100$ by $n$ matrix), I've computed a SVD decomposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\bf X = U \Sigma V^{T}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hence:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\bf X X^{T} = U \Sigma^2 U^{T}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By taking a subset of the largest $q$ eigenmodes, I can approximate the matrix (let $\sigma_1 \ge \sigma_2 \ge \cdots$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;{\bf X} \approx \sigma_1 u_1 v_1^{T} + \sigma_2 u_2 v_2^{T} + \cdots + \sigma_q u_q v_q^{T}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now given a new vector $y$, which represents an image not in $\bf X$, how do I determine the weighting of the $q$ eigenvectors $\bf U$ to best represent my new image $y$? Except for pathological cases, is this representation unique? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, what I'd like to do is this (from the wiki page):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;These eigenfaces can now be used to represent both existing and &lt;strong&gt;new faces&lt;/strong&gt;: we can &lt;strong&gt;project&lt;/strong&gt; a new (mean-subtracted) image on the eigenfaces and thereby record how that new face differs from the mean face.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do I do that projection?&lt;/p&gt;&#xA;" OwnerUserId="1159" LastEditorUserId="90" LastEditDate="2012-05-02T01:53:37.157" LastActivityDate="2012-05-02T01:53:37.157" Title="Fitting new images from a SVD/PCA calculation" Tags="|computer-vision|linear-systems|linear-algebra|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2228" PostTypeId="2" ParentId="2227" CreationDate="2012-05-01T15:34:59.950" Score="11" Body="&lt;p&gt;The &quot;projection&quot; that is referred to is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Vector_projection&quot;&gt;vector projection&lt;/a&gt;. To calculate the projection of vector $\mathbf{a}$ onto vector $\mathbf{b}$, you use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Inner_product&quot;&gt;inner product&lt;/a&gt; of the two vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\mathbf{a_{proj}} = \langle \mathbf{a}, \mathbf{b} \rangle \mathbf{b}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{a_{proj}}$ in this case is the vector component of $\mathbf{a}$ that lies in the same direction of $\mathbf{b}$. In Euclidean space, the inner product operator is defined as their &lt;a href=&quot;http://en.wikipedia.org/wiki/Dot_product&quot;&gt;dot product&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\langle \mathbf{a}, \mathbf{b} \rangle = \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^{n}a_ib_i&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n$ is the number of components in the vectors $\mathbf{a}$ and $\mathbf{b}$ and $a_i$ and $b_i$ are the $i$-th component of vectors $\mathbf{a}$ and $\mathbf{b}$, respectively. Intuitively, by calculating the inner product of the two vectors, you find &quot;how much of&quot; vector $\mathbf{a}$ goes in the direction of vector $\mathbf{b}$. Note that this is a signed quantity, so a negative value would mean that the angle between the two vectors is greater than 90 degrees, as illustrated by an alternative definition for the projection operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\mathbf{a_{proj}} = |\mathbf{a}| \cos(\theta) \mathbf{b}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta$ is the angle between the two vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, given a vector $\mathbf{a}$ and a bunch of basis vectors $\mathbf{b_i}$, one can find &quot;how much of $\mathbf{a}$&quot; goes in each of the directions of each of the basis vectors. Typically, those basis vectors will all be mutually orthogonal. In your case, the SVD is an orthogonal decomposition, so this condition should be satisfied. So, to accomplish what you describe, you would take the matrix of eigenvectors $\mathbf{U}$ and calculate the inner product of the candidate vector $\mathbf{y}$ with each of the matrix's columns:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;p_i = \mathbf{y} \cdot \mathbf{u_i}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scalar value $p_i$ that you get from each inner product represents how well the vector $\mathbf{y}$ &quot;lined up&quot; with the $i$-th eigenvector. Since the eigenvectors are &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthonormal&quot;&gt;orthonormal&lt;/a&gt;, you could then reconstruct the original vector $\mathbf{y}$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\mathbf{y} = \sum_{i=1}^n p_i \mathbf{u_i}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You asked whether this representation is unique; I'm not sure exactly what you mean, but it is not unique in the sense that a given vector $\mathbf{y}$ could be decomposed by projection onto any number of orthonormal bases. The eigenvectors contained in the matrix $\mathbf{U}$ are one such example, but you could use any number of others. For instance, calculating the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot;&gt;discrete Fourier transform&lt;/a&gt; of $\mathbf{y}$ can be viewed as projecting it onto an orthonormal basis of complex exponential vectors of varying frequency.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-05-01T15:34:59.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2229" PostTypeId="1" AcceptedAnswerId="2235" CreationDate="2012-05-01T16:58:05.400" Score="5" ViewCount="175" Body="&lt;p&gt;I am trying to formalize my understanding of how best to measure the performance of a binary detector. (See previous question &lt;a href=&quot;https://dsp.stackexchange.com/questions/2183/questions-on-the-generation-of-r-o-c-curves&quot;&gt;here&lt;/a&gt;). I had looked into ROC curves for doing this however based on previous research and feedback here I think ROC curves are too simplistic. Here is the problem I face:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Context:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a microphone that is setup in a park. The mic takes in inputs and an algorithm runs in the background that is supposed to detect the rustle of leaves. (Animal approaching, something in the bushes, etc). It does this by &lt;em&gt;insert time-frequency-detection-scheme here&lt;/em&gt;, but that is not the issue. The end result of course is a 'Yes' or 'No', (So a binary detector), indicating whether or not leaves are indeed rustling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Main Question(s):&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How can/should I characterize this detector's performance, vis-a-vis true positive and false positive rates? (If that is the wrong way to go about it, then what is the right way?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I understand that to generate a false-positive analysis, requires a false-positive model. In this case, the false-positive model is not something simple like white noise, but spans almost any signal possibility. Therefore, &lt;em&gt;how&lt;/em&gt; can we model all those possibilities?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thoughts:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current solution/thought is to measure a true-positive rate and false-positive rate to characterize detector performance. (For given settings/thresholds).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, for given and fixed detector settings, I test its true-positive rate by rustling leaves (within a specified range), and see if it detects the incidents. This will give me a true-positive rate. (A consistent 'Yes').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am stumped as to how to measure the false-positive rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand how to do this, because the mic is outside and subject to &lt;em&gt;anything&lt;/em&gt; - cars, people, animals, thunder storms, just life. In other words, just about any combination or permutation of signals imaginable is possible. How then does one test its false positive rate? &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-05-02T01:58:12.550" Title="How to measure a detector's performance under extremely complex real-world environment?" Tags="|algorithms|frequency-spectrum|signal-detection|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2230" PostTypeId="2" ParentId="2229" CreationDate="2012-05-01T17:37:40.627" Score="1" Body="&lt;p&gt;I stated this as a comment in your previous thread, but perhaps it will register better as a full-blown response. A binary hypothesis problem of &quot;Yes&quot; and &quot;No&quot; is a gross oversimplification. A true binary hypothesis problem is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hypothesis 0 (H0) : Noise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hypothesis 1 (H1) : Noise + Signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how you model your noise is entirely up to you and your application. If you're looking for a single audio tone, you may be fair in saying that &quot;Noise&quot; would be white Gaussian noise with an unknown variance. Your signal is well defined as a deterministic sinusoid with unknown phase and amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this model, you can do a lot of analysis. That is, develop optimal detectors (if they exist), and easily determine Type I and Type II error probabilities etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it may not be appropriate for what's going on in real life. It's seems as if you're tackling a problem beyond your current scope of understanding. If you don't know even the basics, you're going to be &quot;stepping back&quot; quite a bit. As before, I recommend getting a good book on detection, one that covers through non-White noise, and starting with the basics before getting into something too advanced.&lt;/p&gt;&#xA;" OwnerUserId="1279" LastActivityDate="2012-05-01T17:37:40.627" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2231" PostTypeId="2" ParentId="2229" CreationDate="2012-05-01T18:48:11.307" Score="3" Body="&lt;p&gt;A false positive analysis requires you to create some kind of model of your system.  If a false positive has any sort of measurable effect (method under test says &quot;it's a tree&quot;, human says &quot;no, it's a crying baby&quot;), then gather those events in as unbiased a method as possible until your model says they add up to be as statistically significant as your task requires.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your model is off (whether by complexity, stupidity or criminal intent), then you can end up with stuff like yet another financial melt-down.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-02T01:58:12.550" LastActivityDate="2012-05-02T01:58:12.550" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2232" PostTypeId="1" AcceptedAnswerId="2260" CreationDate="2012-05-01T19:11:26.413" Score="2" ViewCount="12305" Body="&lt;p&gt;As we know there are two kinds of signals: analog signals and digital signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there are two common techniques for multiplexing the signals: Time Division Multiplexing (TDM) and Frequency Division Multiplexing (FDM).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand it, FDM is commonly used to multiples analog signals, while TDM is commonly used to multiplex digital signals.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is:  Why do we not (commonly, at least) use FDM to multiplex digital signals or TDM to multiplex analog signals?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="447" LastEditDate="2012-05-02T02:09:42.223" LastActivityDate="2012-05-09T18:56:34.580" Title="If Digital Signal has frequency components then why we don't use it" Tags="|discrete-signals|frequency|analog|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2233" PostTypeId="2" ParentId="2229" CreationDate="2012-05-01T19:19:29.020" Score="5" Body="&lt;p&gt;on an ROC curve your plotting FP(x-axis) vs TP(y-axis) They are calculated by:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;True-positives = # of correctly detected positives/# of actual positives &lt;/p&gt;&#xA;&#xA;&lt;p&gt;False-Positives = # of positives that are not true-positives/ number of positives &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now on your ROC curve, because you did not mention incuding this into your question above, you most likely did not include the &quot;coin-flip&quot; line. That is the line y = x (from x = 0-1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This line represents how well your algorithm performs by just guessing randomly (Yes, No) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your algorithm is a decent detector, the ROC curve will it will be above the coin-flip line, if it is below this line it is better at being an anti-detector, i.e., when there is no event and would be a poor detector for your application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've worked extensively on this for my master's thesis on onset detection. Below is an example of ROC curves plotted against the coin-flip line. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/Kv0BJ.png&quot; alt=&quot;Receiver Operating Characteristic Curves for Various Music Onset Detection Algorithms&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1183" LastActivityDate="2012-05-01T19:19:29.020" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2234" PostTypeId="2" ParentId="2232" CreationDate="2012-05-01T19:25:55.033" Score="2" Body="&lt;p&gt;The spectrum of a baseband digital stream can be extremely wideband (e.g. the spectrum can cover a huge range of &quot;frequencies&quot; depending on the edge rate and distribution of ones and zeros, all the way down to DC, not just at the bit rate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FDM systems usually have various spectrum limitations (FCC regulations, properties of the transducers or transmission cables, interference, etc.), so the signal is usually modulated to convert the wideband spectrum into one better suited for the chosen transmission environment.  Also, focusing the spectrum into a narrower band may improve the signal-to-noise ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside the box, the transmission medium (traces between gates/chips, etc.) is usually capable of a wider bandwidth, sometimes down to DC, as well as shielded from noise and creating RFI.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-01T19:25:55.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2235" PostTypeId="2" ParentId="2229" CreationDate="2012-05-01T20:34:28.710" Score="3" Body="&lt;p&gt;The best test of a detector would be subjecting it to the environment within which it will be &quot;detecting&quot;. If I understand correctly, you're asking about synthesizing or otherwise intentionally constructing content for testing for false-positives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you real-world model is highly complex, it's not at all easy to synthesize. I would assume that your true and false positive testing involves listening to leaves shuffling and detecting that characteristic sound, but if I understand correctly you're doing that in a controlled environment without much external interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My advice would be to do all testing in a real-world environment with cars, people, and all the things you listed above, and literally spending the time to classify events and non-events yourself. You're essentially collecting training labels for your data, and someone with capability of distinguishing true/false positives/negatives must generate that data, i.e. a human observer. The reason to perform &lt;em&gt;all&lt;/em&gt; testing (and not just searching for false-positives) is such environment is that it would affect your true-positive rate, too. Presence of other sounds can actually prevent your detector from discerning between background and desired signal when the desired signal is indeed present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This procedure may seem lengthy, tedious and time-consuming, but from my experience ti saves you more time as apposed to trying to come up with a complex model with the noise you will experience. I'm not sure that the latter is at all feasible.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-05-01T20:34:28.710" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2236" PostTypeId="1" AcceptedAnswerId="2238" CreationDate="2012-05-01T20:58:05.340" Score="6" ViewCount="627" Body="&lt;p&gt;Is there something like an anti-filter in image processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say for instance, I am filtering an image using the following 13 tap symmetric filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{0, 0, 5, -6, -10, 37, 76, 37, -10, -6, 5, 0, 0} / 128&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each pixel is changed by this filtering process. My question is can we get back the original image by doing some mathematical operation on the filtered image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously such mathematical operations exists for trivial filters, like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{1, 1} / 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we generalize this to complex filters like the one I mentioned at the beginning?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, Anil.&lt;/p&gt;&#xA;" OwnerUserId="1326" LastActivityDate="2012-05-01T23:38:51.100" Title="Anti-Filter in Image Processing?" Tags="|image-processing|filters|algorithms|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2237" PostTypeId="2" ParentId="401" CreationDate="2012-05-01T20:59:10.160" Score="16" Body="&lt;p&gt;I just happened to be implementing something like this on OpenGL ES 2.0 using Harris corner detection, and while I'm not completely finished, I thought I'd share the shader-based implementation I have so far. I've done this as part of an &lt;a href=&quot;https://github.com/BradLarson/GPUImage&quot; rel=&quot;nofollow noreferrer&quot;&gt;iOS-based open source framework&lt;/a&gt;, so you can check out the code if you're curious as to how some particular step works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, I use the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reduce the image to its luminance values using a dot product of the RGB values with the vector (0.2125, 0.7154, 0.0721).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the X and Y derivatives by subtracting the red channel values from the pixels left and right and above and below the current pixel. I then store the x derivative squared in the red channel, the Y derivative squared in the green channel, and the product of X and Y derivatives in the blue channel. The fragment shader for this looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;precision highp float;&#xA;&#xA;varying vec2 textureCoordinate;&#xA;varying vec2 leftTextureCoordinate;&#xA;varying vec2 rightTextureCoordinate;&#xA;&#xA;varying vec2 topTextureCoordinate; &#xA;varying vec2 bottomTextureCoordinate;&#xA;&#xA;uniform sampler2D inputImageTexture;&#xA;&#xA;void main()&#xA;{&#xA; float topIntensity = texture2D(inputImageTexture, topTextureCoordinate).r;&#xA; float bottomIntensity = texture2D(inputImageTexture, bottomTextureCoordinate).r;&#xA; float leftIntensity = texture2D(inputImageTexture, leftTextureCoordinate).r;&#xA; float rightIntensity = texture2D(inputImageTexture, rightTextureCoordinate).r;&#xA;&#xA; float verticalDerivative = abs(-topIntensity + bottomIntensity);&#xA; float horizontalDerivative = abs(-leftIntensity + rightIntensity);&#xA;&#xA; gl_FragColor = vec4(horizontalDerivative * horizontalDerivative, verticalDerivative * verticalDerivative, verticalDerivative * horizontalDerivative, 1.0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the varyings are just the offset texture coordinates in each direction. I precalculate these in the vertex shader to eliminate dependent texture reads, which are notoriously slow on these mobile GPUs.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a Gaussian blur to this derivative image. I used a separated horizontal and vertical blur, and take advantage of hardware texture filtering to do a nine-hit blur with only five texture reads on each pass. I describe this shader in &lt;a href=&quot;https://stackoverflow.com/a/9592454/19679&quot;&gt;this Stack Overflow answer&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Run the actual Harris corner detection calculation using the blurred input derivative values. In this case, I'm actually using the calculation described by Alison Noble in her Ph.D. dissertation &quot;Descriptions of Image Surfaces&quot;. The shader that handles this looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;varying highp vec2 textureCoordinate;&#xA;&#xA;uniform sampler2D inputImageTexture;&#xA;&#xA;const mediump float harrisConstant = 0.04;&#xA;&#xA;void main()&#xA;{&#xA; mediump vec3 derivativeElements = texture2D(inputImageTexture, textureCoordinate).rgb;&#xA;&#xA; mediump float derivativeSum = derivativeElements.x + derivativeElements.y;&#xA;&#xA; // This is the Noble variant on the Harris detector, from &#xA; // Alison Noble, &quot;Descriptions of Image Surfaces&quot;, PhD thesis, Department of Engineering Science, Oxford University 1989, p45.     &#xA; mediump float harrisIntensity = (derivativeElements.x * derivativeElements.y - (derivativeElements.z * derivativeElements.z)) / (derivativeSum);&#xA;&#xA; // Original Harris detector&#xA; //     highp float harrisIntensity = derivativeElements.x * derivativeElements.y - (derivativeElements.z * derivativeElements.z) - harrisConstant * derivativeSum * derivativeSum;&#xA;&#xA; gl_FragColor = vec4(vec3(harrisIntensity * 10.0), 1.0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform local non-maximum suppression and apply a threshold to highlight the pixels that pass. I use the following fragment shader to sample the eight pixels in the neighborhood of a central pixel and identify whether or not it is the maximum in that grouping:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;uniform sampler2D inputImageTexture;&#xA;&#xA;varying highp vec2 textureCoordinate;&#xA;varying highp vec2 leftTextureCoordinate;&#xA;varying highp vec2 rightTextureCoordinate;&#xA;&#xA;varying highp vec2 topTextureCoordinate;&#xA;varying highp vec2 topLeftTextureCoordinate;&#xA;varying highp vec2 topRightTextureCoordinate;&#xA;&#xA;varying highp vec2 bottomTextureCoordinate;&#xA;varying highp vec2 bottomLeftTextureCoordinate;&#xA;varying highp vec2 bottomRightTextureCoordinate;&#xA;&#xA;void main()&#xA;{&#xA;    lowp float bottomColor = texture2D(inputImageTexture, bottomTextureCoordinate).r;&#xA;    lowp float bottomLeftColor = texture2D(inputImageTexture, bottomLeftTextureCoordinate).r;&#xA;    lowp float bottomRightColor = texture2D(inputImageTexture, bottomRightTextureCoordinate).r;&#xA;    lowp vec4 centerColor = texture2D(inputImageTexture, textureCoordinate);&#xA;    lowp float leftColor = texture2D(inputImageTexture, leftTextureCoordinate).r;&#xA;    lowp float rightColor = texture2D(inputImageTexture, rightTextureCoordinate).r;&#xA;    lowp float topColor = texture2D(inputImageTexture, topTextureCoordinate).r;&#xA;    lowp float topRightColor = texture2D(inputImageTexture, topRightTextureCoordinate).r;&#xA;    lowp float topLeftColor = texture2D(inputImageTexture, topLeftTextureCoordinate).r;&#xA;&#xA;    // Use a tiebreaker for pixels to the left and immediately above this one&#xA;    lowp float multiplier = 1.0 - step(centerColor.r, topColor);&#xA;    multiplier = multiplier * 1.0 - step(centerColor.r, topLeftColor);&#xA;    multiplier = multiplier * 1.0 - step(centerColor.r, leftColor);&#xA;    multiplier = multiplier * 1.0 - step(centerColor.r, bottomLeftColor);&#xA;&#xA;    lowp float maxValue = max(centerColor.r, bottomColor);&#xA;    maxValue = max(maxValue, bottomRightColor);&#xA;    maxValue = max(maxValue, rightColor);&#xA;    maxValue = max(maxValue, topRightColor);&#xA;&#xA;    gl_FragColor = vec4((centerColor.rgb * step(maxValue, centerColor.r) * multiplier), 1.0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This process generates a cornerness map from your objects that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kcCI4.png&quot; alt=&quot;Cornerness map&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following points are identified as corners based on the non-maximum suppression and thresholding:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xpjex.png&quot; alt=&quot;Identified corners&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With proper thresholds set for this filter, it can identify all 16 corners in this image, although it does tend to place the corners a pixel or so inside the actual edges of the object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On an iPhone 4, this corner detection can be run at 20 FPS on 640x480 frames of video coming from the camera, and an iPhone 4S can easily process video of that size at 60+ FPS. This should be a good deal faster than CPU-bound processing for a task like this, although right now the process of reading back the points is CPU-bound and a little slower than it should be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see this in action you can &lt;a href=&quot;https://github.com/BradLarson/GPUImage&quot; rel=&quot;nofollow noreferrer&quot;&gt;grab the code for my framework&lt;/a&gt; and run the FilterShowcase example that comes with it. The Harris corner detection example there runs on live video from the device camera, although as I mentioned the reading back of corner points currently occurs on the CPU, which is really slowing this down. I'm moving to a GPU-based process for this, as well.&lt;/p&gt;&#xA;" OwnerUserId="1325" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-05-16T03:58:38.123" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2238" PostTypeId="2" ParentId="2236" CreationDate="2012-05-01T21:17:05.007" Score="12" Body="&lt;p&gt;What you're describing is call &lt;em&gt;deconvolution&lt;/em&gt;. It's a concept frequently used for distorted images and for equalization in communications. As such you should be able to find a number of resources for your specific application. In general, the original image may not be recoverable exactly (it often isn't).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can do a pretty good job depending on how severe the image has been undesirably filtered. In addition, many methods will attempt deconvolution by estimating the filter which it appears the signal has been affected by. If the assumption that the signal was convolved with a linear filter is a poor one, your performance may be severely inhibited. &lt;/p&gt;&#xA;" OwnerUserId="1279" LastActivityDate="2012-05-01T21:17:05.007" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2239" PostTypeId="2" ParentId="2236" CreationDate="2012-05-01T21:54:11.403" Score="7" Body="&lt;p&gt;Consider the frequency response of the filter.  If the source image contains data with spectrum exactly at the frequency of a notch in the filter, this data will be lost after convolution.  There is no operator that can reasonably recover non-zero data from an image filtered into a bunch of zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There can also be arithmetic quantization issues, thus making the filter convolution potentially informationally lossy.  These two effects can combine, making merely low spots in the filter response curve also lossy.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-01T21:54:11.403" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2240" PostTypeId="2" ParentId="2236" CreationDate="2012-05-01T23:38:51.100" Score="8" Body="&lt;p&gt;In this particular case, this would be quite difficult. The filter is a low pass with 30 dB of attenuation (mostly) but it has also two zeros on the unit circle. You can design an approximation for the inverse filter but it won't be perfect&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The filter is linear phase, so the inverse filter is also linear phase but non-causal. In practice this means you'll loose some pixels around the edges&lt;/li&gt;&#xA;&lt;li&gt;You cannot recover any content around the frequencies where the zeros are on the unit circle. This would require infinite gain&lt;/li&gt;&#xA;&lt;li&gt;You will need to apply a fair amount of boost (30dB to 40dB) at a sizable frequency range which will add some unintended noise to the picture&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-05-01T23:38:51.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2241" PostTypeId="1" AcceptedAnswerId="2244" CreationDate="2012-05-02T02:21:47.340" Score="36" ViewCount="38650" Body="&lt;p&gt;What is the true meaning of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Minimum_phase&quot;&gt;minimum phase&lt;/a&gt; system? Reading the Wikipedia article and &lt;a href=&quot;http://en.wikipedia.org/wiki/Alan_V._Oppenheim#Publications&quot;&gt;Oppenheim&lt;/a&gt; is some help, in that, we understand that for an &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory&quot;&gt;LTI&lt;/a&gt; system, minimum phase means the inverse is causal and stable. (So that means zeros and poles are inside the unit circle), but what does &quot;phase&quot; and &quot;minimum&quot; have to do with it? Can we tell a system is minimum phase by looking at the phase response of the DFT somehow?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="21075" LastEditDate="2020-04-30T11:39:19.970" LastActivityDate="2023-05-21T12:19:44.347" Title="What is the true meaning of a minimum phase system?" Tags="|filters|filter-design|minimum-phase|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2242" PostTypeId="2" ParentId="2241" CreationDate="2012-05-02T02:37:34.623" Score="11" Body="&lt;p&gt;As you've already seen, the minimum phase has many physical meanings and implications. Where the phase comes from is that, for a given magnitude of frequency response, it corresponds to the filter that has the least amount of group delay. That is, you can have several filters with the same magnitude of frequency response, but one of them can be realized with the smallest amount of filter delay. In this sense, it's highly desired in control systems where filtering delay can be critical to stability. I'm abusing some notation here, as the phase &quot;delay&quot; can have many meanings, but the gist is there (and for group delay, it's a fact).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other realms, if a system is a minimum phase, its inverse will have all of its poles inside the unit circle and be causal. So a minimum phase system has a stable inverse. This is important in many other applications for obvious reasons. If you must solve a linear system of equations, knowing the system is minimum phase guarantees its inverse will be minimum phase, and so stability is guaranteed (outside of any quantization effects).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may not be obvious if a system is a minimum phase by looking at the DFT. There is a relationship between the magnitude of a minimum phase system and its phase, but it may not be visually obvious. However, adaptive lattice filters have the neat feature in that minimum phase filters are easily identified if all of the reflection coefficients are less than or equal to one in magnitude. That way, filters adaptively calculated can be determined if they're stable on the fly with little logic.&lt;/p&gt;&#xA;" OwnerUserId="1279" LastEditorUserId="8202" LastEditDate="2018-03-07T12:51:42.530" LastActivityDate="2018-03-07T12:51:42.530" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2243" PostTypeId="2" ParentId="2241" CreationDate="2012-05-02T02:54:43.653" Score="3" Body="&lt;p&gt;One of the most useful properties of minimum phase system is that they have an impulse response that is the most compact in time as is possible for any given amplitude function. Technically this can be expressed as $$\sum_{i=0}^{k}h[i]^2 = min, k\epsilon \mathbb{N}$$&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-05-02T02:54:43.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2244" PostTypeId="2" ParentId="2241" CreationDate="2012-05-02T05:42:34.820" Score="23" Body="&lt;p&gt;The relation of &quot;minimum&quot; to &quot;phase&quot; in a minimum phase system or filter can be seen if you plot the unwrapped phase against frequency.  You can use a pole zero diagram of the system response to help do a incremental graphical plot of the frequency response and phase angle.  This method helps in doing a phase plot without phase wrapping discontinuities.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put all the zeros inside the unit circle (or in left half plane in the continuous-time case), where all the poles have to be as well for system stability.  Add up the angles from all the poles, and the negative of the angles from all the zeros, to calculate total phase to a point on the unit circle, as that frequency response reference point moves around the unit circle.  Plot phase vs. frequency.  Now compare this plot with a similar plot for a pole-zero diagram with any of the zeros swapped outside the unit circle (non-minimum phase).  The overall average slope of the line with all the zeros inside will be lower than the average slope of any other line representing the same LTI system response (e.g. with a zero reflected outside the unit circle).  This is because the &quot;wind ups&quot; in phase angle are all mostly cancelled by the &quot;wind downs&quot; in phase angle only when both the poles and zeros are on the same side of the unit circle line.  Otherwise, for each zero outside, there will be an extra &quot;wind up&quot; of increasing phase angle that will remain mostly uncancelled as the plot reference point &quot;winds&quot; around the unit circle from 0 to PI.  (...or up the vertical axis in the continuous-time case.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This arrangement, all the zeros inside the unit circle, thus corresponds to the minimum total increase in phase, which corresponds to minimum average total phase delay, which corresponds to maximum compactness in time, for any given (stable) set of poles and zeros with the exact same frequency magnitude response.  Thus the relationship between &quot;minimum&quot; and &quot;phase&quot; for this particular arrangement of poles and zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see my old word picture with strange crank handles in the ancient usenet comp.dsp archives: &lt;a href=&quot;https://groups.google.com/d/msg/comp.dsp/ulAX0_Tn65c/Fgqph7gqd3kJ&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://groups.google.com/d/msg/comp.dsp/ulAX0_Tn65c/Fgqph7gqd3kJ&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2019-10-29T19:14:24.693" LastActivityDate="2019-10-29T19:14:24.693" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2245" PostTypeId="1" CreationDate="2012-05-02T09:34:54.623" Score="5" ViewCount="145" Body="&lt;p&gt;Can you suggest any good introductory resources on ridgelets and/or curvelets for image processing purposes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm considering &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0521119138&quot; rel=&quot;nofollow&quot;&gt;buying&lt;/a&gt; &lt;a href=&quot;http://www.cambridge.org/gb/knowledge/isbn/item2703288/&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Sparse Image and Signal Processing: Wavelets, Curvelets, Morphological Diversity&lt;/em&gt;&lt;/a&gt; (&lt;a href=&quot;http://thames.cs.rhul.ac.uk/~fionn/Sparse_Signal_Recipes/&quot; rel=&quot;nofollow&quot;&gt;more&lt;/a&gt;). Is there anyone who can recommend for or against it?&lt;/p&gt;&#xA;" OwnerUserId="1331" LastEditorUserId="1059" LastEditDate="2012-05-02T21:09:04.117" LastActivityDate="2012-05-03T13:31:48.987" Title="Resources on ridgelets/curvelets" Tags="|image-processing|reference-request|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2246" PostTypeId="2" ParentId="2241" CreationDate="2012-05-02T13:13:22.870" Score="3" Body="&lt;p&gt;&lt;strong&gt;Reading&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;This paper seems to have some wisdom on the subject of minimum phase systems:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;John Bechhoefer, &amp;quot;&lt;a href=&quot;https://www.sfu.ca/chaos/assets/papers/2011/KK-Bode-MeaningZero.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kramers-Kronig, Bode, and the meaning of zero&lt;/a&gt;&amp;quot;, American Journal of Physics &lt;strong&gt;79&lt;/strong&gt;, 10 (2011).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="64" LastEditorUserId="4298" LastEditDate="2023-01-03T11:38:53.347" LastActivityDate="2023-01-03T11:38:53.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2247" PostTypeId="1" AcceptedAnswerId="2335" CreationDate="2012-05-02T14:31:11.443" Score="17" ViewCount="23151" Body="&lt;p&gt;I have this image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Tjt3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to remove the shadow from the image. I know a lot of different methods like certain morphological operations have been used to remove shadows: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created this mask for the same image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VRi2F.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there some other methods I could try using this mask that I have created?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;input image and mask of same size as requested :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ImVIH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s2sMG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: i generated a 1D invariant image however its not perfect&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  I = imread('shadow.jpg');&#xA;       J = im2double(I);&#xA;&#xA;      R = J(:,:,1);&#xA;      G = J(:,:,2);&#xA;      B = J(:,:,3);&#xA;&#xA;     [len,wid] = size(R);&#xA;&#xA;     % Generation of 2-D Log Chromaticity Image.&#xA;     for i = 1:len&#xA;        for j = 1:wid&#xA;           if ((R(i,j)*G(i,j)*B(i,j))~= 0)&#xA;              c1(i,j) = R(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));&#xA;              c2(i,j) = G(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));&#xA;              c3(i,j) = B(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));&#xA;           else&#xA;              c1(i,j) = 1;&#xA;              c2(i,j) = 1;&#xA;              c3(i,j) = 1;&#xA;        end&#xA;    end&#xA;end&#xA;&#xA;rho1 = mat2gray(log(c1));&#xA;rho2 = mat2gray(log(c2));&#xA;rho3 = mat2gray(log(c3));&#xA;&#xA;X1 = mat2gray(rho1*1/(sqrt(2)) - rho2*1/(sqrt(2)));                                         %(1/sqrt(2); -1/sqrt(2); 0)&#xA;X2 = mat2gray(rho1*1/(sqrt(6)) + rho2*1/(sqrt(6)) - rho3*2/(sqrt(6)));   %(1/sqrt(6); 1/sqrt(6); -2/sqrt(6))&#xA;&#xA;theta = 120;&#xA;&#xA;InvariantImage = cos(theta*pi/180)*X1 + sin(theta*pi/180)*X2;&#xA;imagesc(InvariantImage); colormap(gray)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YM0wU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cannot understand what i am doing wrong out here please help?&lt;/p&gt;&#xA;" OwnerUserId="654" LastEditorUserId="654" LastEditDate="2012-05-06T16:55:57.933" LastActivityDate="2015-04-09T13:48:13.400" Title="How can I remove shadows from an image?" Tags="|image-processing|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2248" PostTypeId="2" ParentId="2232" CreationDate="2012-05-02T14:54:17.223" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Answer to &quot;Why do we not (commonly, at least) use .... TDM to multiplex analog signals?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you have $N$ analog (meaning continuous-time) signals to&#xA;transmit over a common channel, then with TDM, each signal&#xA;is transmitted for $(1/N)$-th of the time, e.g. $1000$ signals&#xA;are transmitted for one millisecond each in non-overlapping&#xA;time slots during a $1$-second interval. So what ends up&#xA;at the receiver is $1$-millisecond clips, spaced $1$ second &#xA;apart, of each of the $1000$ signals. This is probably not&#xA;what is desired for any of the signals, but YMMV.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Answer to &quot;Why do we not (commonly, at least) use FDM to &#xA;  multiplex digital signals ....?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Digital signals are transmitted using analog (meaning&#xA;continuous-time) signals using a process called&#xA;digital modulation. For example, analog frequency modulation&#xA;(FM) is used for commercial broadcasting of speech and music&#xA;signals. A digital signal input would result in a signal&#xA;more commonly referred to as frequency shift keying&#xA;(FSK), and it is quite easy, if not common, to transmit&#xA;these FSK signals via FDM.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="77" LastEditDate="2012-05-03T04:00:14.373" LastActivityDate="2012-05-03T04:00:14.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2250" PostTypeId="1" AcceptedAnswerId="2252" CreationDate="2012-05-02T17:34:59.673" Score="4" ViewCount="1164" Body="&lt;p&gt;The literature on this method seems scarce, but I know that it has been used on radar systems to 'get away with' not having to sample nearly as fast as Nyquist would otherwise dictate, (at the cost of additional time). Or so I think. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how does &quot;Equivalent Time Sampling&quot; work, and where can it be used? How does it square with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;noreferrer&quot;&gt;Nyquist Criterion&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-05-02T17:42:46.120" LastActivityDate="2012-05-04T06:30:01.043" Title="What is &quot;Equivalent Time Sampling&quot; and what is it good/used for?" Tags="|sampling|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2251" PostTypeId="1" AcceptedAnswerId="2253" CreationDate="2012-05-02T18:56:20.820" Score="0" ViewCount="102" Body="&lt;p&gt;How do I digitize an analog telephone recording and filter it with a Chebyshev filter?&lt;/p&gt;&#xA;" OwnerDisplayName="user258" LastEditorUserId="1183" LastEditDate="2012-05-03T14:20:59.540" LastActivityDate="2012-05-03T14:20:59.540" Title="How best to digitize a noisy phone recording for filtering?" Tags="|filters|equalization|speech|digitize|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2252" PostTypeId="2" ParentId="2250" CreationDate="2012-05-02T19:17:32.310" Score="6" Body="&lt;p&gt;Note that the Nyquist criterion applies to bandlimited signals; but the so-limited band does not need to be baseband, or even contiguous, just not overlapping (aliased) with any other sub-bands after folding.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Periodic sampling fan-folds an infinite spectrum in to &quot;fans&quot; with a width of half the sampling rate.  Any frequency bands, after this fan-folding, that do not overlap with any other frequency bands in the spectrum when so folded can be reconstructed, according to one form of Nyquist theorem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, any random phase jitter in undersampling will cause the bands too far above Fs/2 to become more phase noise than signal.  If the phase noise is mostly white and uncorrelated with the signal, then sampling for a much longer time frame may allow averaging out this phase noise sufficient to reconstruct a repetitive narrow-band signal, with some probability of accuracy for a given extended sampling time window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, some oscilloscopes have a mode where they undersample a bandpass-filtered narrowband input, then store and composite a much longer sampling time by folding the samples down to baseband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, signal reconstruction of a bandlimited signal may be possible with non-periodic sampling of known sample times, as long as the local density of samples is high enough.  This is numerically much less stable, as estimating a reconstruction of the spectrum or waveform from a minimum number randomly spaced samples becomes more of a sensitive linear optimization problem, rather than a closed form transform or convolution.  However some oscilloscopes might use a pseudo-random non-periodic undersampling, but averaged over a long time period, and let the user determine when the density of samples &quot;looks good enough&quot; when reconstructing an image of an undersampled repetitive waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Randomized sampling can avoid certain aliasing problems, such as perfectly periodic sampling not allowing reconstruction of an arbitrary phase sinusoid with a frequency exactly at Fs/2 (it's smooshed at the creases in the fan-fold).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-04T06:30:01.043" LastActivityDate="2012-05-04T06:30:01.043" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2253" PostTypeId="2" ParentId="2251" CreationDate="2012-05-02T20:43:30.413" Score="7" Body="&lt;p&gt;Unless you have tight space constraints, I would stick to lossless formats like good old &lt;strong&gt;WAV&lt;/strong&gt;. Phones do not pass much high-frequency content so you should be fine with a 8KHz Mono WAVE file. You will however want to keep the &lt;a href=&quot;http://en.wikipedia.org/wiki/Audio_bit_depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;bit depth&lt;/a&gt; high, say to 24 bits, since you want to process the audio. Once you are finished with your processing you can compress with a lossy codec, such as OGG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All &lt;em&gt;codecs&lt;/em&gt; (coders/decoders) may be classified as &lt;em&gt;lossy&lt;/em&gt; or &lt;em&gt;lossless&lt;/em&gt;. Lossless codecs, as their name implies, allow for perfect reconstruction of the original signal. Lossy codecs, by contrast, merely approximate the source. By forgoing perfect fidelity, lossy codecs enable higher compression ratios, commensurate with the amount of degradation one is prepared to accept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Perhaps related&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2256/a-non-lossy-aka-lossless-codec-without-patent-restrictions-for-audio&quot;&gt;A non-lossy aka lossless codec without patent-restrictions for audio?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="-1" LastEditorDisplayName="user258" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-05-02T23:53:01.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2255" PostTypeId="1" AcceptedAnswerId="2364" CreationDate="2012-05-02T23:14:34.013" Score="6" ViewCount="5154" Body="&lt;p&gt;I have a function that performs gaussian blur on image for some specific $\sigma$ (the standard deviation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It first computes kernel of size $\lceil 3\sigma \rceil$ and then performs convolution with that kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to specify blurring radius in pixels rather than $\sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose that the blur radius (in pixels) is just $\sigma^{2}$ as this denotes variance of a random variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that right? Can the same thought be extended to 2D?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I need to do things like building a gaussian pyramid (successively blurred and downsampled image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the image gets downsampled to 1/2 of its width, I suppose I need a gaussian blur of radius 2 pixels ($\sigma=\sqrt{2}$ ?). And for 1/4 subsampling, I would need blur of 4 pixels ($\sigma=2 ?)$... But I am not sure about that...&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-05-02T23:41:06.473" LastActivityDate="2012-05-15T02:37:21.880" Title="Standard Deviation in Gaussian Blur" Tags="|image-processing|convolution|2d|gaussian|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2256" PostTypeId="1" AcceptedAnswerId="2257" CreationDate="2012-05-02T23:21:07.517" Score="3" ViewCount="184" Body="&lt;p&gt;The term &lt;code&gt;non-lossy codec&lt;/code&gt; means the coding thing having no compression lost, more &lt;a href=&quot;http://en.wikipedia.org/wiki/Lossless_data_compression&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. I need such format to process the audio, without destroying the quality. &lt;a href=&quot;http://en.wikipedia.org/wiki/Lossy_compression&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; mentions in the context of lossy compression:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ogg Vorbis (noted for its lack of patent restrictions)&#xA;Speex (noted for its lack of patent restrictions)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the other wikipedia site for lossless things is open-ended, it mentions some patents and some expirations but not whether some codec has no patent-restrictions. Does there exist a lossless (non-lossy) codec without patent-restrictions or some sort of lists/matrix summing up the patent -things?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Perhaps related&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Xiph.Org, the organization behind the multimedia formats and software tools &lt;a href=&quot;http://en.wikipedia.org/wiki/Xiph.Org_Foundation&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerDisplayName="user258" LastEditorDisplayName="user258" LastEditDate="2012-05-02T23:43:08.143" LastActivityDate="2012-06-29T21:47:39.347" Title="A non-lossy aka lossless codec without patent-restrictions for audio?" Tags="|compression|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2257" PostTypeId="2" ParentId="2256" CreationDate="2012-05-02T23:29:20.610" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/FLAC&quot;&gt;FLAC&lt;/a&gt; is the de facto standard, particularly, notice from the latter link:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The specification of the stream format can be implemented by anyone&#xA;  without prior permission (Xiph.org reserves the right to set the FLAC&#xA;  specification and certify compliance), and that &lt;strong&gt;neither the FLAC&#xA;  format nor any of the implemented encoding / decoding methods are&#xA;  covered by any patent. It also means that the reference implementation&#xA;  is free software.&lt;/strong&gt; The source code for libFLAC and libFLAC++ is&#xA;  available under the BSD license, and the sources for flac, metaflac,&#xA;  and the plugins are available under the GNU General Public License. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In&#xA;  its stated goals, the FLAC project encourages its developers not to&#xA;  implement copy prevention features of any kind.[5]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1059" LastEditorDisplayName="user258" LastEditDate="2012-05-02T23:52:51.763" LastActivityDate="2012-05-02T23:52:51.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2258" PostTypeId="2" ParentId="2247" CreationDate="2012-05-02T23:34:15.953" Score="2" Body="&lt;p&gt;You may take a histogram of the masked area (the shadow) and apply linear color transform so that the histogram of masked area and rest of the image is matched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose that scale factor in the transform would be negligible, only shifing of the brightness would be necessary, so you may just take average brightness of the two segments (shadow, sorroundings) and apply the difference.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-05-03T01:28:33.860" LastActivityDate="2012-05-03T01:28:33.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2259" PostTypeId="2" ParentId="2255" CreationDate="2012-05-02T23:36:43.827" Score="5" Body="&lt;p&gt;Yes, you can always use pixel units for $\sigma$. In 2-D you will have $\sigma_X$ and $\sigma_Y$.&lt;/p&gt;&#xA;" OwnerUserId="1334" LastActivityDate="2012-05-02T23:36:43.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2260" PostTypeId="2" ParentId="2232" CreationDate="2012-05-03T01:35:17.347" Score="17" Body="&lt;h2&gt;Analog and digital&lt;/h2&gt;&#xA;&lt;p&gt;First off, you need to understand what an &amp;quot;analog&amp;quot; signal is, and what a &amp;quot;digital&amp;quot; signal is, how they are different, and how they are similar.&lt;/p&gt;&#xA;&lt;p&gt;The term &amp;quot;&lt;strong&gt;analog&lt;/strong&gt;&amp;quot; comes from the old distinction between &amp;quot;analog&amp;quot; and &amp;quot;digital&amp;quot; computers.  A &amp;quot;digital computer&amp;quot;, even a very primitive one of decades ago, has always been more or less what we know now -- a box that manipulates &amp;quot;bits&amp;quot; (or, in very old systems, decimal digits), where the information is represented by numbers encoded in the bits.&lt;/p&gt;&#xA;&lt;p&gt;An &amp;quot;analog computer&amp;quot;, on the other hand, used voltage values in the computer to represent numeric quantities.  Ie, where the digital computer might represent the value &amp;quot;6&amp;quot; as the binary bits 110, the analog computer might represent the value &amp;quot;6&amp;quot; as a voltage of 6 volts.&lt;/p&gt;&#xA;&lt;p&gt;(I could go on here for several paragraphs explaining more about how an analog computer works, but it suffices to say that, except in very limited applications, analog computers are no longer used -- where needed their function can be simulated with digital computers more cheaply and accurately.)&lt;/p&gt;&#xA;&lt;p&gt;But the point is that an &amp;quot;analog signal&amp;quot; is called that because the voltage levels in the signal are analogies (&amp;quot;analogs&amp;quot;) for some &amp;quot;real-life&amp;quot; phenomenon.  Eg, in an analog audio signal the voltage level is an analog for the sound pressure that would create the sound -- a higher voltage level means more sound pressure, etc.  Further (and it will be important later), the &amp;quot;X-axis&amp;quot; -- the time dimension -- is also &amp;quot;analog&amp;quot;.  That is, in most cases (except where, eg, a recording has been sped up or slowed down) one second of time in the analog signal corresponds to one second in &amp;quot;real life&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;In the image below, peaks in the signal represent higher air pressure (and valleys represent lower air pressure).&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qEDw9.gif&quot; alt=&quot;(Credit docstore.mik.ua/orelly/web2/audio/ch02_01.htm)&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, the ups and downs of a &lt;strong&gt;digital&lt;/strong&gt; signal have no direct relationship to &amp;quot;real life&amp;quot;.  Rather, they represent binary digits (hence &amp;quot;digital&amp;quot;) in a numeric code used to represent whatever &amp;quot;real life&amp;quot; phenomenon the signal corresponds to.  In the diagram below, the bits (each line represents a separate bit stream) might represent characters of ASCII text, or they might represent readings from a heart rate monitor.  Looking at the data you can't even tell if it might be a pleasant sound (like the guitar), or a discordant sound (like the cymbal).&lt;/p&gt;&#xA;&lt;p&gt;Also note that the X dimension is not an analog for anything -- an entire symphony might be transmitted as a digital signal in ten seconds, or a high-resolution photograph that was snapped in an instant may be transmitted, bit-by-bit, over a period of seconds or minutes.  (The old Mariner space probe would take hours to transmit a single high-resolution image, because the bit rate was so slow at that distance.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z2gmu.gif&quot; alt=&quot;(Credit zone.ni.com/reference/en-XX/help/370520K-01/hsdio/usedwa/)&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;But note that both types of signals can be represented by a fluctuating voltage on a wire, and, in fact, you can hook a digital signal (if the data rate is slow enough) directly up to an (&amp;quot;analog&amp;quot;) audio amplifier and listen to it.  (It will come through as a noisy squeal).  &lt;em&gt;So at this fundamental level -- a voltage that fluctuates over time -- analog and digital signals are basically the same.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;(It also needs to be noted that, from the standpoint of &amp;quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Information_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;information theory&lt;/a&gt;&amp;quot;, the maximum amount of information that can be encoded into a signal occupying a given bandwidth is the essentially the same, regardless of whether it's digital or analog, or how it may be multiplexed.  However, while one could spend days discussing information theory and entropy I won't go into it further, because it's for the theoreticians, and because it makes my head hurt to think about it.)&lt;/p&gt;&#xA;&lt;h2&gt;Multiplexing&lt;/h2&gt;&#xA;&lt;p&gt;Next we need to understand &amp;quot;&lt;strong&gt;multiplexing&lt;/strong&gt;&amp;quot;.  In the US, at least, a &amp;quot;theatre multiplex&amp;quot; is a group of motion picture theatres in a single building.  Similarly, when you &amp;quot;multiplex&amp;quot; signals you combine several signals into one all-encompassing signal.  But just as you wouldn't want to go to a motion picture theatre and see 6 movies all projected onto a single screen simultaneously, when we multiplex signals we do so in a way that the receiving station can separate the combined signals back into the individual ones.&lt;/p&gt;&#xA;&lt;p&gt;The earliest form of signal multiplexing(*) was common radio.  Several radio stations in the same area can all broadcast their signals into the same &amp;quot;ether&amp;quot;, but each uses a different assigned frequency, so that, by tuning your radio receiver to a specific frequency (actually a frequency &lt;em&gt;band&lt;/em&gt;) you can receive the &amp;quot;hard rock&amp;quot; station you want to hear, and not have to simultaneously hear the &amp;quot;easy listening&amp;quot; station your parents listen to.&lt;/p&gt;&#xA;&lt;p&gt;This, in essence, is &lt;strong&gt;Frequency Division Multiplexing (FDM)&lt;/strong&gt; -- the available spectrum is divided into frequency bands and each signal is combined with a &amp;quot;carrier&amp;quot; frequency to occupy the appropriate frequency band.  (The original signal, before multiplexing, is referred to as a &amp;quot;baseband&amp;quot; signal, because it has not been combined with a carrier.  This sort of contrasts with &amp;quot;broadband&amp;quot;, where multiple signals have been multiplexed, but unfortunately the term &amp;quot;broadband&amp;quot; has multiple confusing definitions.)&lt;/p&gt;&#xA;&lt;p&gt;FDM used to be used extensively in the phone system, for long-distance lines.  A single pair of wires (and associated amplifiers), which might have a frequency response from 20Hz to 100KHz, carried a dozen or so audio signals, each at an assigned frequency just like broadcast radio or TV.  Later coaxial cables were used, increasing the available bandwidth to several MHz and allowing several hundred audio signals per cable.&lt;/p&gt;&#xA;&lt;p&gt;(A significant drawback of this scheme was that many amplifiers were required -- one every ten miles at least, and one every mile for some schemes.)&lt;/p&gt;&#xA;&lt;p&gt;Now, it should be clear that, given that there's no fundamental difference (electrically) between an analog signal and a digital signal, digital signals can indeed be broadcast using FDM.  In fact, if you have a cable modem, the cable, with over a hundred analog channels, is frequency multiplexed (just as over-the-air TV is).  Your cable modem signal occupies (sharing with your neighbors) one of those &amp;quot;analog&amp;quot; channels.  So your cable modem signal is being transmitted via FDM (though with several added twists).&lt;/p&gt;&#xA;&lt;p&gt;Now for &lt;strong&gt;Time Division Multiplexing (TDM)&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Time division multiplexing involves what it name implies -- the time axis of the combined signal is divided into discrete segments, and different individual signals are transmitted in the different segments.&lt;/p&gt;&#xA;&lt;p&gt;TDM actually goes back to before regular digital data.  The Bell Telephone company in the US experimented in the 50s with chopping up analog signals into lots of thin slices and interleaving the slices from several different analog signals together, allowing the several signals to be sent over a single pair of wires without having to resort to FDM.  So in this case analog signals were transmitted via TDM.&lt;/p&gt;&#xA;&lt;p&gt;But doing this was quite complicated.  The analog signal needed to be &amp;quot;sampled&amp;quot; rapidly enough that the signal didn't change much between samples.  For an audio signal with a maximum frequency of about 3.5KHz (the range for common telephone lines) sampling must be done at at least twice that frequency (so about 7 thousand &amp;quot;slices&amp;quot; per second) and then those slices must be interleaved with others (maybe five or ten).  (This was known as &amp;quot;pulse amplitude modulation&amp;quot;.)  At the other end the slices need to be separated, and the missing space between slices filled in by &amp;quot;smoothing&amp;quot; the signal.  And all this needs to be done without seriously changing the amplitude (sound volume) of individual slices.&lt;/p&gt;&#xA;&lt;p&gt;Of course, the above scheme was very difficult to get right and didn't really provide much advantage relative to FDM over the same wires, so when true digital capabilities came around they dropped it like a hot rock.&lt;/p&gt;&#xA;&lt;h2&gt;Why digital is different&lt;/h2&gt;&#xA;&lt;p&gt;So far I've been showing how there's really no difference between analog and digital.  Now I'll reverse course -- digital is &lt;em&gt;really&lt;/em&gt; different in some very important ways.&lt;/p&gt;&#xA;&lt;p&gt;First off, digital signals don't degrade like analog signals.  Old analog telephone networks introduced a lot of distortion into the sound as it was transmitted cross-country and reamplified many times (as often as once every mile).  A digital signal does develop distortion in transmission, but since it's digital it can be &amp;quot;regenerated&amp;quot; at the end of each hop.  This alone made TDM much more practical for digital, since there was no longer a need to maintain accurate signal amplitude, and the cables and amplifiers become simpler and less expensive (and farther apart).&lt;/p&gt;&#xA;&lt;p&gt;But that's not all.&lt;/p&gt;&#xA;&lt;p&gt;Consider, for instance, if you use Skype to talk to someone on the Internet.  Your voice is first converted to an analog signal by the microphone in your computer.  But it's then immediately digitized, and the digitized bits are &amp;quot;buffered&amp;quot; -- stored up awaiting transmission.  Algorithms in Skype will examine the digitized sound and discard periods of silence (since there's no need to transmit silence), and they'll otherwise process the sound to minimize the number of bits needed to represent it.&lt;/p&gt;&#xA;&lt;p&gt;Eventually (after a seeming eternity of computer instructions, but in an instant from your ear's point of view) a group of sound bits will be formed into a block, have the appropriate internet headers appended to the front, and be queued for transmission over your Internet connection.  But, since you happen to be simultaneously using your web browser, the sound data may have to wait a few more milliseconds for your web request to be transmitted.&lt;/p&gt;&#xA;&lt;p&gt;On the receiving end, Skype accepts the packet of transmitted data from the receiving computer's Internet connection and sticks it back in a queue, taking care to insert it in the right order in the queue based on a &amp;quot;timestamp&amp;quot; in the data packet.  (This extra care is necessary because data packets may be delivered out of order in some cases.)  Then another part of the Skype program removes packets from the front of the queue and &amp;quot;schedules&amp;quot; them to play back the recorded sound at the appropriate time based on the timestamps.  So the received data is not played immediately, but instead waits (perhaps a few more milliseconds) until &amp;quot;the time is right&amp;quot; to be played, so that the time dimension of the original data (and hence the fiction of continuous voiced transmission) is maintained.&lt;/p&gt;&#xA;&lt;p&gt;So what happened here?  The voice data from Skype was time-division multiplexed with your web browser requests, and, once out on the Internet trunk lines, both were time-division multiplexed with thousands of other messages.  But, critically, the multiplexing was not based on a fixed schedule (eg, dividing the time dimension into 10 millisecond slices and &amp;quot;dedicating&amp;quot; the channel to transmitting each signal for 10 milliseconds), but instead an &amp;quot;adaptive&amp;quot; algorithm was used, where each signal only occupied the channel for as long as it needed.  Even though this technique requires that each data packet contain an address to identify it's destination (whereas with a fixed multiplexing scheme the destination would be defined by the slice location), it's still far, far more efficient than a scheme that relies on fixed slices, either in time (primitive TDM) or frequency (FDM).&lt;/p&gt;&#xA;&lt;h2&gt;Summary&lt;/h2&gt;&#xA;&lt;p&gt;Now note the differences between TDM (as used in networking systems) and FDM.  FDM has the advantage of being relatively simple (witness standard AM radio).  It can carry analog or digital signals equally well, but, because it does either equally well, it offers no great advantages to digital.&lt;/p&gt;&#xA;&lt;p&gt;TDM is only marginally practical for (undigitized) analog signals -- the complexity and potential loss of signal quality are major negatives.  But digital, it seems, was &amp;quot;made for&amp;quot; TDM -- the data is already &amp;quot;sliced&amp;quot;, and accurately maintaining amplitude or time reference is not required.  And since &amp;quot;dead air&amp;quot; is represented by a complete absence of data packets, not by simple silence on a phone line, &amp;quot;adaptive&amp;quot; multiplexing, where only &amp;quot;useful&amp;quot; data is transmitted, and not on a rigid schedule, is much more practical.  For these reasons much more digital data can be transmitted in a given bandwidth using (adaptive) TDM vs FDM.&lt;/p&gt;&#xA;&lt;p&gt;So it's not that digital &lt;em&gt;CAN'T&lt;/em&gt; be transmitted using FDM and analog &lt;em&gt;CAN'T&lt;/em&gt; be transmitted using TDM, but rather there are practical reasons why doing so would be more expensive, less efficient, and less reliable.&lt;/p&gt;&#xA;&lt;p&gt;(I need to add that even given all the above FDM is used for digital data in some circumstances.  For instance, the link to/from communications satellites is very &amp;quot;broadband&amp;quot;, and no single data stream could practically use the entire bandwidth.  So the overall channel width is sliced into frequency bands, with each occupied by a separate data stream.  In this case, since the digital data stream is already time-division multiplexed and there is very little &amp;quot;dead air&amp;quot;, the advantage of further TDM would be slight.)&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;(*) There were some crude TDM schemes used for telegraph signals as far back as the 1850s, but that's mostly lost in the mists of history.&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-05-09T18:56:34.580" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2262" PostTypeId="1" AcceptedAnswerId="2263" CreationDate="2012-05-03T11:51:34.157" Score="3" ViewCount="42620" Body="&lt;p&gt;Not sure if this is the right place to ask, feel free to move it if any other site suits this better.&lt;br&gt;&#xA;Anyway I am referring to QAM modulation used in US Cable TV. I know it comes under Annex B which is related to FEC.&lt;br&gt;&#xA;I know that 64 QAM has a symbol rate ~= 5057000 Symbols/s and 256 QAM 5360000Symbols/s &#xA;I would like to know how this is calculated, also what symbol rate will, say 128 QAM have for example?&lt;/p&gt;&#xA;" OwnerUserId="1336" LastEditorUserId="1336" LastEditDate="2012-05-10T06:39:56.060" LastActivityDate="2015-07-30T18:52:00.617" Title="Calculate symbol rate for QAM modulation" Tags="|modulation|channelcoding|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2263" PostTypeId="2" ParentId="2262" CreationDate="2012-05-03T12:39:45.997" Score="7" Body="&lt;p&gt;There is no inherent symbol rate for any modulation type.  64 QAM symbols transmit 6 bits per symbol, and 256 QAM symbols transmit 8 bits per symbol.  If the bit rate were to stay constant, then the 256 QAM symbol rate would be 6/8 of the 64 QAM symbol rate, but it appears that that is not the case (assuming your numbers are correct).  That may be because they are using more forward error correction (FEC) to mitigate the higher power requirements of 256 QAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that the bit rates are not the same, we can't guess what the 128 QAM symbol rate would be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general equation for a given modulation type and its symbol rate is:&#xA;$symbols/s = \frac{bits/s}{bits/symbol}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determining the bits per symbol is usually pretty easy.  It's log2 of the number of possible symbol points.  Thus, the bits per symbol of 256QAM (which has 256 possible points) is 8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is finding the bits per second.  Wireless transmitters often have the following blocks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data source =&gt; Compression =&gt; Scrambling =&gt; FEC Encoding =&gt; Pulse Shaping =&gt; Modulation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To know the final bit rate you need to know the bit rate of the data source, how much the compression reduces the data rate (if there is compression), and how much the FEC encoding increases the data rate.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-05-03T13:44:39.033" LastActivityDate="2012-05-03T13:44:39.033" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2264" PostTypeId="2" ParentId="2245" CreationDate="2012-05-03T13:31:48.987" Score="1" Body="&lt;p&gt;From what I found online, this paper is a pretty good intro to curvelets:&#xA;&lt;a href=&quot;http://jstarck.free.fr/curvencyclop09.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Curvelets A Surprisingly Effective Nonadaptive Representation For Objects with Edges&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another decent one I found was &lt;a href=&quot;https://scicomp.stackexchange.com/questions/1957/recover-curves-from-noisy-collection-of-points&quot;&gt;Curvelets and Ridgelets&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick Google search can lead you to a lot of good resources, and provided sufficient background, you can learn most of these things on your own. I'm sure there's more literature freely available out there.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="-1" LastEditDate="2017-04-13T12:53:54.087" LastActivityDate="2012-05-03T13:31:48.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2266" PostTypeId="2" ParentId="2168" CreationDate="2012-05-03T15:38:52.100" Score="2" Body="&lt;p&gt;Typically Self tuning controllers are done in the digital domain. You may want to look into Least Squares Method for controller tuning. &lt;/p&gt;&#xA;" OwnerUserId="1183" LastActivityDate="2012-05-03T15:38:52.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2268" PostTypeId="1" AcceptedAnswerId="2269" CreationDate="2012-05-03T19:19:51.110" Score="5" ViewCount="902" Body="&lt;p&gt;According to CIE color space and relation of RGB with XYZ, we can express &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R = \int_0^\infty I(\lambda)r(\lambda)d\lambda&#xA;$$$$&#xA;G = \int_0^\infty I(\lambda)g(\lambda)d\lambda&#xA;$$$$&#xA;B = \int_0^\infty I(\lambda)b(\lambda)d\lambda&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $r(\lambda),g(\lambda),$ and $b(\lambda)$ are the corresponding color matching functions and $I(\lambda)$ is spectral intensity function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am trying to calculate RGB values of hyperspectral image captured by hyperspectral camera. And from the hyperspectral image, I can get spectral intensity values between 0 - 65535. But I am not sure about unit or range of the intensity function $I(\lambda)$ above. Is it values between 0 - 1?&lt;/p&gt;&#xA;" OwnerUserId="1011" LastActivityDate="2022-04-27T02:01:40.247" Title="What's the unit of spectral intensity in calculation of RGB tristimulus?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2269" PostTypeId="2" ParentId="2268" CreationDate="2012-05-03T20:02:08.283" Score="6" Body="&lt;p&gt;You are probably working not with CIE RGB, but CIE XYZ, so these are properly denoted the &lt;a href=&quot;http://en.wikipedia.org/wiki/CIE_XYZ#Color_matching_functions&quot; rel=&quot;noreferrer&quot;&gt;XYZ tristimulus values&lt;/a&gt;, not RGB. Their absolute values do not matter if you want to determine the &lt;a href=&quot;http://en.wikipedia.org/wiki/Chromaticity&quot; rel=&quot;noreferrer&quot;&gt;chromatacities&lt;/a&gt; (&quot;color&quot;, as we commonly understand it), because &lt;a href=&quot;http://en.wikipedia.org/wiki/CIE_XYZ#The_CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space&quot; rel=&quot;noreferrer&quot;&gt;you take the ratio of the components to their sum&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the XYZ tristimulus values or xy chromaticities, you can &lt;a href=&quot;http://en.wikipedia.org/wiki/SRGB#Specification_of_the_transformation&quot; rel=&quot;noreferrer&quot;&gt;convert to something like sRGB&lt;/a&gt; to yield usable RGB values. You might need to scale the result to 0-255.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2012-05-03T20:10:11.690" LastActivityDate="2012-05-03T20:10:11.690" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2270" PostTypeId="1" CreationDate="2012-05-03T20:04:10.910" Score="3" ViewCount="10673" Body="&lt;p&gt;What does the expression 'combine signals coherently' imply?&lt;/p&gt;&#xA;" OwnerUserId="645" LastActivityDate="2012-05-03T21:10:47.257" Title="What does it mean to combine signals coherently?" Tags="|continuous-signals|time-frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2271" PostTypeId="2" ParentId="2270" CreationDate="2012-05-03T20:09:27.650" Score="5" Body="&lt;p&gt;It means that they are &lt;em&gt;in phase&lt;/em&gt;---think of the signals as waves. Adding noncoherent signals results in &lt;em&gt;cancellation&lt;/em&gt;, or &lt;em&gt;fading&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-05-03T20:09:27.650" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2272" PostTypeId="1" AcceptedAnswerId="2274" CreationDate="2012-05-03T20:57:40.550" Score="10" ViewCount="6034" Body="&lt;p&gt;I'm using an FFT to analyze what is essentially the power envelope of a signal (see &lt;a href=&quot;https://dsp.stackexchange.com/questions/1828/how-to-distinguish-voice-from-snoring&quot;&gt;here&lt;/a&gt; for info on the containing project), and, since power numbers are always positive, to eliminate the DC component I'd like to use a window function that is 50/50 positive and negative, vs the usual all-positive function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've taken the &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function#Flat_top_window&quot; rel=&quot;nofollow noreferrer&quot;&gt;flat top&lt;/a&gt;&quot; function, removed the &lt;code&gt;a0&lt;/code&gt; bias and converted it from cosines to sines, but I'm not sure that's optimal (or even meaningful).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion?&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-05-15T12:26:07.800" Title="What is a good FFT window function to reject DC?" Tags="|fft|window-functions|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2273" PostTypeId="2" ParentId="2270" CreationDate="2012-05-03T21:05:34.723" Score="3" Body="&lt;p&gt;It means to combine signals taking phase into account (with respect to some mutually related reference point).  Taking phase into account allows signals to sum when in phase, or cancel when out of phase (with respect to that related reference point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, when summing the result vectors of successive FFT frames together, you can just add the magnitudes, which would be an incoherent combination, or sum the complex vectors, which would give you a coherent sum.  With the coherent combination, any stationary sinusoids with a frequency exactly between 2 FFT bins across 2 successive FFT frames would cancel out instead of summing its spectrum, thus better rejecting that spectrum if it is undesired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the time domain, it might mean adjusting the phase of a PLL to match that of an estimate of some carrier's phase, so that a signal combination maintains some coherent relative phase relationship, instead of the relative phase being yet another unknown into some modulation, demodulation or detection process.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-03T21:10:47.257" LastActivityDate="2012-05-03T21:10:47.257" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2274" PostTypeId="2" ParentId="2272" CreationDate="2012-05-03T21:29:23.723" Score="1" Body="&lt;p&gt;The 1st derivative of most common continuous window functions (von Hann, etc.) will reject DC, yet will still have a magnitude frequency response similar to that of the original window function; so you can still use your original &quot;goodness&quot; criteria for window selection, if it is not related to phase.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-04T01:15:43.537" LastActivityDate="2012-05-04T01:15:43.537" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2275" PostTypeId="1" CreationDate="2012-05-04T01:01:09.337" Score="11" ViewCount="268" Body="&lt;p&gt;I am wondering what techniques might be available for '&lt;a href=&quot;http://en.wikipedia.org/wiki/Image_denoising&quot; rel=&quot;nofollow noreferrer&quot;&gt;de-noising&lt;/a&gt;' the following example time-frequency image that was created using &lt;a href=&quot;http://en.wikipedia.org/wiki/Welch_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;Welch's method&lt;/a&gt;. The following plot was created from a robotic sensor. (This is &lt;strong&gt;NOT&lt;/strong&gt; a color image - it is a greyscale image - colors added for visual purposes only). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PaDFm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal ultimately is to estimate the pulse-spacings that you see here, should such pulses exist. This might be somewhat of a chicken and egg, so to this end, I ask myself, &quot;Do pulses of this rep-rate +/- 10% exist?&quot;, and go about detecting them. What you are seeing here is the signal (pulses), but along with other un-wanted interference. However as Emre has suggested, they have structure, albeit in the Time-Frequency space. Do time-frequency filters as such exist? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would &lt;em&gt;strongly&lt;/em&gt; like to see image processing solutions applied here, but am open to any solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus: The goal is to remove all the high intensity signals &lt;em&gt;except&lt;/em&gt; the repetitive pulses (found near index 300 on the y-axis) as can be seen. All the other high intensity signals can be regarded as 'interference'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Assumptions you may make:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You may assume that you &lt;em&gt;roughly&lt;/em&gt; know the pulse lengths that you are seeing here. (Let us say, within +/- 10%). Put another way, you have decided to look for pulses of this length. (+/-)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You may assume that you also &lt;em&gt;roughly&lt;/em&gt; know the rep rates of the pulses, (again, let us say +/- 10%).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Unfortunately you do not know their frequency any more accurately. That is to say, in this image the pulses are at 300, but they could have just as easily been at 100, or 50, or 489, or whatever. However, the good news is that those frequencies shown here are very close to one another, on the order of say, 10's of Hz).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some thoughts of mine: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Image processing POV:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Morphological operations have occurred to me, however I am not too familiar with those to know if they might work or not. I suppose the idea might be to 'close' and hence remove the 'bigger' stains?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Row-wize &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;DFT&lt;/a&gt; operations might indicate which rows to null out, based on the rows of interest having the highest repetitive pattern, however it might not be a viable solution if the pulses are few and far between, or if image is more noisy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Just by looking at the image, you almost want to 'reward' isolation, and 'punish' connectivity. Is there an image processing method(s) that accomplish this sort of operation? (Morphological in nature again).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What methods might help here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Signal processing POV:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The frequency range shown here is already extremely tight so I am not sure &lt;a href=&quot;http://en.wikipedia.org/wiki/Band-stop_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;notch filtering&lt;/a&gt; operations will help. Moreover, the exact frequency of the pulses shown within this tight range is not known a-priori. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By making educated guesses on the pulses of interest here, (their lengths, and repetition times) might I be able to compute the &lt;a href=&quot;https://dsp.stackexchange.com/questions/1637/what-does-frequency-domain-denote-in-case-of-images&quot;&gt;2-dimensional DFT&lt;/a&gt; of my 'template', and utilize this as a 2-D &lt;a href=&quot;http://en.wikipedia.org/wiki/Cepstrum&quot; rel=&quot;nofollow noreferrer&quot;&gt;cepstral-temporal filter&lt;/a&gt; to which I simply multiply the Welch image shown above by, and then perform an inverse 2-D DFT? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;OTOH perhaps would &lt;a href=&quot;https://dsp.stackexchange.com/questions/1603/what-is-the-gabor-filter-and-what-are-its-main-uses&quot;&gt;Gabor filters&lt;/a&gt; be a good match here? After all, they are orientation sensitive filters, similar to our own built in &lt;a href=&quot;http://en.wikipedia.org/wiki/Visual_cortex&quot; rel=&quot;nofollow noreferrer&quot;&gt;V1 visual processors&lt;/a&gt;. How might they be exploited here?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What methods might help in this domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-05-04T18:53:55.507" Title="On the de-noising of time-frequency images" Tags="|image-processing|filters|frequency-spectrum|morphological-operations|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2276" PostTypeId="2" ParentId="2275" CreationDate="2012-05-04T01:46:30.093" Score="1" Body="&lt;p&gt;I don't have experience in this area but I see that it has been studied: &lt;a href=&quot;http://spie.org/x648.html?product_id=448690&quot; rel=&quot;nofollow&quot;&gt;Minimum entropy approach to denoising time-frequency distributions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In this paper, we introduce an entropy based approach to denoising time-frequency distributions. This new approach uses the spectrogram decomposition of time-frequency kernels proposed by Cunningham and Williams. In order to denoise the time-frequency distribution, we combine those spectrograms with smallest entropy values, thus ensuring that each spectrogram is well concentrated on the time-frequency plane and contains as little noise as possible. Renyi entropy is used as the measure to quantify the complexity of each spectrogram. The threshold for the number of spectrograms to combine is chosen adaptively based on the tradeoff between entropy and variance.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Essentially your problem is one of &lt;strong&gt;signal/source separation&lt;/strong&gt;; the additive unmixing of a bunch of structured signals. In order to proceed you need to model your signals. Obviously the one of interest is periodic and is centered about some frequency, so you need to estimate the period (along the x axis) and the center frequency (on the y axis). Then you can characterize the others (noise). For starters, it seems that they come in nice curves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a model in hand I would consult a book like &lt;a href=&quot;http://store.elsevier.com/Handbook-of-Blind-Source-Separation/isbn-9780123747266/&quot; rel=&quot;nofollow&quot;&gt;Handbook of Blind Source Separation: Independent Component Analysis and Applications&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-05-04T01:46:30.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2277" PostTypeId="1" AcceptedAnswerId="2278" CreationDate="2012-05-04T02:30:19.403" Score="1" ViewCount="167" Body="&lt;p&gt;I'm trying to decipher what exactly this statement means.  So if I have a signal which has no pure sinusoidal components, does that mean I can't decompose my signal completely into sine-waves which may be amplitude/phase/period shifted?  And so I would conclude that there is also like a saw-tooth component or a square-function component mixed up in the signal as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saying that the signal contains NO pure sinusoidal component makes me feel like its decomposition should not include ANY amplitude/phase/period shifted sine-waves.. but that seems a little extreme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone clarify this for me?  Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1035" LastActivityDate="2012-05-04T05:02:44.430" Title="A signal containing no pure sinusoidal components" Tags="|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2278" PostTypeId="2" ParentId="2277" CreationDate="2012-05-04T02:31:10.320" Score="4" Body="&lt;p&gt;It contains no spikes in its frequency spectrum. (What is the Fourier transform of a sinusoid?)&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2012-05-04T03:01:29.603" LastActivityDate="2012-05-04T03:01:29.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2279" PostTypeId="2" ParentId="2277" CreationDate="2012-05-04T05:02:44.430" Score="3" Body="&lt;p&gt;As Emre said, what they probably mean that there are no &lt;em&gt;individual&lt;/em&gt; (as in, stand alone), sinusoidal components. (Spikes in the spectrum), in the example they are using. (Perhaps it is a sum of many sinusouds).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you would be hard pressed to come across a signal that is not composed of complex exponentials (sines and cosines) at all. (I cannot imagine such a signal). Any realistic signal imagined can be decomposed into a summation of sines and cosines.&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-05-04T05:02:44.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2280" PostTypeId="2" ParentId="2262" CreationDate="2012-05-04T05:12:56.457" Score="1" Body="&lt;p&gt;For anyone interested in the figures used to obtain the values I mentioned, Annex A of the &lt;a href=&quot;http://www.scte.org/documents/pdf/Standards/ANSISCTE072006.pdf&quot; rel=&quot;nofollow&quot;&gt;SCTE Cable Specification&lt;/a&gt; is a good reference. The basic formula is the same as in @Jim's answer. So I have accepted his answer, and leaving this as a reference point for any RF engineeers out there :-)&lt;/p&gt;&#xA;" OwnerUserId="1336" LastActivityDate="2012-05-04T05:12:56.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2282" PostTypeId="2" ParentId="2247" CreationDate="2012-05-04T09:33:01.613" Score="9" Body="&lt;p&gt;I've seen this very image before. In fact &lt;a href=&quot;http://www.cs.sfu.ca/~mark/ftp/Eccv02/shadowless.pdf&quot;&gt;here it is&lt;/a&gt; in the very paper on the topic of which you are looking to solve. Followed up with &lt;a href=&quot;http://www2.cs.sfu.ca/research/groups/VML/lighting/&quot;&gt;another paper&lt;/a&gt; from the same research group at Simon Fraser University. Both these will give you a good introduction to the problem of solving colour for lighting invariance.&lt;/p&gt;&#xA;" OwnerUserId="1271" LastActivityDate="2012-05-04T09:33:01.613" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2284" PostTypeId="1" AcceptedAnswerId="2286" CreationDate="2012-05-04T17:37:43.643" Score="11" ViewCount="22430" Body="&lt;p&gt;When the signal is modulated onto the carrier in the electromagnetic spectrum, &#xA;that signal occupies the small portion of the spectrum surrounding the carrier frequency. It also cause sidebands to be generated at frequencies above and below the carrier frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how and why are those sidebands generated in AM and FM and why are there so many sidebands generated in FM while just two are generated in AM ? Please provide a practical example, as I already know how they are generated mathematically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I know is, in the time domain, when the original signal is put into the carrier signal, it is actually multiplied with the carrier signal which means that in frequency-domain the original signal is convolved with the carrier signal. Those two Sidebands in AM are actually the Fourier transform of the carrier signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="76" LastEditDate="2012-07-18T17:22:30.433" LastActivityDate="2019-10-30T20:15:46.767" Title="Why are sidebands generated in AM and FM?" Tags="|frequency|frequency-spectrum|modulation|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2285" PostTypeId="2" ParentId="2275" CreationDate="2012-05-04T18:17:20.697" Score="2" Body="&lt;p&gt;From a purely engineering POV, the obvious solution to &quot;locking on&quot; to that pulse would be a Phase Locked Loop (PLL).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A PLL is just a free-running oscillator whose frequency can be adjusted based on the perceived phase relationship to another signal. If the other signal is pure noise or pulses at an entirely different frequency then the phase relationship will be random and the oscillator will not be adjusted much either direction (and will continue to &quot;free run&quot;). However, if there is a signal, even a relatively noisy one, that is running at about the same frequency as the oscillator, the PLL's phase sensor will detect this and adjust the oscillator frequency to match the other signal. Of course, this assumes the match is halfway close to start with.  (One problem -- though also a useful feature -- of PLLs is that they will happily latch on to harmonics or subharmonics of the target signal, if the initial frequency mismatch is too large.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've never used PLLs in my own work, but the term's been around for about 40 years (the concept since the 30s, at least), and there are pre-built PLLs available as individual ICs or single-card modules.  There are also &quot;digital PLLs&quot; that mimic the analog concept using digital components.  (This is about the extent of my knowledge, but there are easily 100 references found by Google.)&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-05-04T18:17:20.697" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2286" PostTypeId="2" ParentId="2284" CreationDate="2012-05-04T19:57:24.083" Score="9" Body="&lt;p&gt;Carrying information requires bandwidth.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given S/N ratio, modulating a signal to carry more information will thus expand its bandwidth.  Call the addition bandwidth &quot;side bands&quot;.  If you don't add side bands to a fixed frequency carrier, you can't expand its bandwidth, and thus you can't transmit any information (other than the presence of a constant carrier).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For AM, AM is not PM (phase modulation).  Any additional bandwidth (as required to carry information in the modulating signal) on one side of the carrier will usually have a different phase (change of phase with respect to time from any reference point) from the carrier.  To neutralize this phase difference, AM modulation has to add some additional matching bandwidth on the opposite side of the carrier to carry a signal that will exactly cancel any phase shift of the spectrum the first side, so that AM doesn't become PM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With FM, modulating a carrier changes the signal frequency to new frequencies.  You can also call those additional new frequencies so generated &quot;side bands&quot;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2019-10-30T20:15:46.767" LastActivityDate="2019-10-30T20:15:46.767" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2287" PostTypeId="1" AcceptedAnswerId="2290" CreationDate="2012-05-04T20:09:40.257" Score="7" ViewCount="5178" Body="&lt;p&gt;I'd like to find the &quot;best&quot; fit of an ellipse to contiguous, possibly concave shapes such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eN58D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What have I tried?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that one could assign the direction of the major and minor axes $\vec a, \vec b$ of the ellipse by mapping the pixel values to coordinates, mean subtracting, and saving the largest two eigenvectors from a PCA. The seems to work rather well in finding the direction:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/As9zc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is determining the length of these two vectors. For now, I've used $\sqrt \lambda_1$ $\sqrt \lambda_2$, from the eigenvalues of the PCA. This seems to underestimate the length. How can I determine $|\vec a|$, and $|\vec b|$ or alternatively, best fit an ellipse to these shapes?&lt;/p&gt;&#xA;" OwnerUserId="1159" LastActivityDate="2012-05-04T22:49:23.177" Title="How to fit an ellipse to 2D data" Tags="|computer-vision|shape-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2288" PostTypeId="2" ParentId="2287" CreationDate="2012-05-04T20:54:52.773" Score="3" Body="&lt;p&gt;Check &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/awf/ellipse/&quot; rel=&quot;nofollow&quot;&gt;Direct Least Squares Fitting of Ellipses&lt;/a&gt; by Fitzgibbon et al. It's a simple eigenvalue problem, the size of which is not proportional to the number of pixels in your sample! The only step dependent on the number of pixels you throw at it is the computation of a scatter matrix, which is still $O(n)$.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-05-04T21:03:02.763" LastActivityDate="2012-05-04T21:03:02.763" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2290" PostTypeId="2" ParentId="2287" CreationDate="2012-05-04T22:31:02.107" Score="6" Body="&lt;p&gt;Following up on my deleted answer... If you take a filled ellipse and project all the points onto the $x$ axis, more points will be projected near the origin than on the extremes, in a circular-shaped distribution. Not a gaussian distribution, and not the uniform distribution I mentioned in the 1-D analogy in my deleted answer. The resulting distribution actually has pdf $p(x) = \sqrt{(1 - (\frac{x}{r})^2)}$, and from there you can compute that the standard deviation is $\frac{r}{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if data is uniformly distributed in the interior of an ellipse of radii $a, b$ (whose axes are the $x$ and $y$ axes), the standard deviation of the $x$ coordinate is $\frac{a}{2}$ and of the $y$ coordinate is $\frac{b}{2}$. So the correction factor you need to use is simply 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a worked example in python recovering the center (translation matrix), rotation matrix, and radii of an ellipse from points randomly sampled from its interior:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;&#xA;# Generate some points distributed uniformely along an ellipse&#xA;x = 2 * (numpy.random.rand(10000, 1) - 0.5)&#xA;y = 2 * (numpy.random.rand(10000, 1) - 0.5)&#xA;d = (x / 0.5) ** 2 + (y / 0.25) ** 2&#xA;inside = numpy.where(d &amp;lt; 1)[0]&#xA;x = x[inside]&#xA;y = y[inside]&#xA;data = numpy.hstack((x, y)).T&#xA;&#xA;# Now rotate by 0.5 rad and translate it to (4, -8)&#xA;angle = 0.5&#xA;rotation = numpy.array([&#xA;    [numpy.cos(0.4), -numpy.sin(0.4)],&#xA;    [numpy.sin(0.4), numpy.cos(0.4)]])&#xA;&#xA;data = numpy.dot(rotation, data)&#xA;data[0, :] += 4&#xA;data[1, :] -= 8&#xA;&#xA;# Step 1: center the data to get the translation vector.&#xA;print 'Translation', data.mean(axis=1)&#xA;data -= numpy.reshape(data.mean(axis=1), (2, 1))&#xA;&#xA;# Step 2: perform PCA to find rotation matrix.&#xA;scatter = numpy.dot(data, data.T)&#xA;eigenvalues, transform = numpy.linalg.eig(scatter)&#xA;print 'Rotation matrix', transform&#xA;&#xA;# Step 3: Rotate back the data and compute radii.&#xA;# You can also get the radii from smaller to bigger&#xA;# with 2 / numpy.sqrt(eigenvalues)&#xA;rotated = numpy.dot(numpy.linalg.inv(transform), data)&#xA;print 'Radii', 2 * rotated.std(axis=1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-05-04T22:49:23.177" LastActivityDate="2012-05-04T22:49:23.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2291" PostTypeId="1" AcceptedAnswerId="2292" CreationDate="2012-05-04T23:54:44.030" Score="4" ViewCount="776" Body="&lt;p&gt;I'm applying Matlab's median filter to a data sequence and I'm trying to figure out what filter co-efficients of a linear filter this corresponds to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the normal time-frequency relationship that exists for linear filters maintain itself for the median filter?&lt;/p&gt;&#xA;" OwnerUserId="1035" LastEditorUserId="293" LastEditDate="2012-05-07T16:40:02.387" LastActivityDate="2012-05-07T16:40:02.387" Title="On the time-frequency relationships of median filters" Tags="|matlab|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2292" PostTypeId="2" ParentId="2291" CreationDate="2012-05-05T00:10:51.427" Score="11" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot;&gt;median filter&lt;/a&gt; is actually an example of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Nonlinear_filter&quot;&gt;non-linear filtering&lt;/a&gt; operation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This stands in contrast to &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_filter&quot;&gt;linear filtering&lt;/a&gt; operations (the 'classical' way that involve the convolution of a filter's co-efficients with a signal). Since convolution in time is the same as multiplication in the frequency domain, you can go back and forth between the domains to figure out co-efficients of your filter in either basis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since medial filtering is a non-linear operation, you cannot do this. There is nothing you can convolve your signal with (ie, no linear operation you can do on your signal) such that you would get the same result as you see by using the non-linear medial filter. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-05-05T00:29:32.137" LastActivityDate="2012-05-05T00:29:32.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2293" PostTypeId="2" ParentId="2291" CreationDate="2012-05-05T00:23:45.437" Score="3" Body="&lt;p&gt;Besides being non-linear, a median filter is also an informationally lossy filter.  It gives you a potentially smoother waveform with less extrema by throwing information away.  Thus, the original waveform can't be recovered. (e.g. multiple input signals can produce the exact identical output.  There's no information left in the output to determine which possible input the inverse could be.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to look at an N-tap median filter is the multiplexing of the outputs of N different linear filters.  There's no single linear filter that can represent mixing up the results of N different filters.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-05T00:55:00.343" LastActivityDate="2012-05-05T00:55:00.343" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2294" PostTypeId="1" CreationDate="2012-05-05T02:09:31.837" Score="-2" ViewCount="326" Body="&lt;p&gt;So let's say I'm given a sequence of samples of a continuous time signal and I take the $FFT$ of that at 64 points.  And so I have my frequency graph which is interpolated along those 64 points.  So basically that's a vector $X$ of length 64, and so applying a linear filter to that is essentially performing coordinate-wise multiplication of $X$ with my specially designed filter vector $H$ of length 64, to produce my new filtered vector $Y$ of length 64, is that correct?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so then I take the $Inverse FFT$ of $Y$ to get my filtered signal in the time domain, and my filter coefficients will be given by the $InverseFFT$ of $H$, so there will be 64 of them, is that correct?&lt;/p&gt;&#xA;" OwnerUserId="1035" LastEditorUserId="1035" LastEditDate="2012-05-05T03:21:26.270" LastActivityDate="2012-05-05T05:45:46.423" Title="Understanding the Filter Coefficients" Tags="|filters|matlab|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2295" PostTypeId="2" ParentId="2294" CreationDate="2012-05-05T05:45:46.423" Score="3" Body="&lt;p&gt;One detail that is rendering your statements incorrect is that vector multiplication in one domain isn't linear convolution in the other domain.  It's circular convolution in the other domain.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-05T05:45:46.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2296" PostTypeId="1" CreationDate="2012-05-05T10:31:36.023" Score="5" ViewCount="465" Body="&lt;p&gt;Given a desired filter magnitude response, plus acceptable linear phase and minimum phase FIR filter approximations, how can one design a filter with the given response and a delay specification of some value between minimum phase and linear phase?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="29" LastEditDate="2013-02-22T17:25:51.153" LastActivityDate="2013-02-22T17:25:51.153" Title="Filter design with a phase delay specification?" Tags="|filters|filter-design|phase|linear-phase|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2297" PostTypeId="2" ParentId="2296" CreationDate="2012-05-05T10:43:00.757" Score="4" Body="&lt;p&gt;Least square errors works well with FIR filters. General IIR filters are more difficult and typically require an iterative search algorithm. One specific type of IIR, named warped FIR filters, can also match arbitrary amplitude and phase response with a least square errors approach.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-05-05T10:43:00.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2299" PostTypeId="1" AcceptedAnswerId="2300" CreationDate="2012-05-05T20:21:44.560" Score="12" ViewCount="2842" Body="&lt;p&gt;Here is my code for a two-toned signal, where I use a stop-band to remove the higher tone and then plotted the before (in blue) and after (in red) in the frequency domain after convolving my signal with the filter coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you put this code into Matlab you can clearly see that the higher frequency has been successfully removed by the filter, yet for some reason the amplitude of the lower frequency has been cut in half, and the more I increase the # of filter coefficients, the more it just flattens my whole curve, why does this occur?  And how can I prevent it so that the stop-band does not propagate outwards? Here is the image and the code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Uy2d1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;fSampling = 8000;&#xA;tSampling = 1/fSampling;&#xA;&#xA;t = 0:tSampling:0.005;&#xA;F0 = 1000;&#xA;F1 = 3000;&#xA;&#xA;xt = sin(2*pi*F0*t) + sin(2*pi*F1*t);&#xA;ht = fir1(40,.25,'stop');&#xA;yt = conv(xt,ht);&#xA;&#xA;fAxis = -4000:125:4000-125;&#xA;&#xA;xF = fft(xt,64);&#xA;MagXF = fftshift(abs(xF));&#xA;&#xA;plot(fAxis,MagXF);&#xA;hold on&#xA;&#xA;yF = fft(yt,64);&#xA;MagYF = fftshift(abs(yF));&#xA;&#xA;plot(fAxis,MagYF,'r')&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="1035" LastEditorUserId="1035" LastEditDate="2012-05-05T20:40:50.357" LastActivityDate="2012-05-08T22:42:00.433" Title="Why does my stop-band filter attenuate other frequencies?" Tags="|filters|matlab|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2300" PostTypeId="2" ParentId="2299" CreationDate="2012-05-05T21:18:44.873" Score="12" Body="&lt;p&gt;Filters always have an inherent &quot;roll-off&quot; in their frequency response, because you can't practically realize a pass-band that's a perfect rectangular function. For a low-pass filter, the point where the magnitude of your frequency response drops to -3dB is called the pass-band and everything beyond is called the stop-band (technically, everything beyond the corner frequency, but we'll take the corner frequency to be the -3dB level). How fast your frequency response attenuates beyond the pass-band is dependent on the filter length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at the frequency response of your filter, &lt;code&gt;ht&lt;/code&gt;, you'll see that it drops to -6dB at 1000 Hz:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WzeMO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it makes sense that the power drops by 6dB after filtering, which you see in your figure as a halving in amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you had looked at the documentation for the &lt;code&gt;fir1&lt;/code&gt; function that you used, you would've realized this too (emphasis mine):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;B = fir1(N,Wn)&lt;/code&gt; designs an &lt;code&gt;N&lt;/code&gt;'th order lowpass FIR digital filter&#xA;      and returns the filter coefficients in length &lt;code&gt;N+1&lt;/code&gt; vector &lt;code&gt;B&lt;/code&gt;.&#xA;      The cut-off frequency Wn must be between &lt;code&gt;0 &amp;lt; Wn &amp;lt; 1.0&lt;/code&gt;, with &lt;code&gt;1.0&lt;/code&gt; &#xA;      corresponding to half the sample rate.  The filter &lt;code&gt;B&lt;/code&gt; is real and&#xA;      has linear phase.  &lt;strong&gt;The normalized gain of the filter at Wn is&#xA;      -6 dB.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now to create sharper filters, with responses that get pretty close to a rectangle, you'll have to use IIR filters, which come with their own host of problems with stability, etc., but definitely an option. You can see &lt;a href=&quot;https://stackoverflow.com/a/5597572/616736&quot;&gt;my answer here&lt;/a&gt; for some ideas on implementing a discrete-form 2, second-order section IIR filter that gives very sharp corners. The example there is for a band-pass filter, but you can read up the docs for the functions used there and implement a low-pass version yourself.&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-05-05T21:18:44.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2302" PostTypeId="1" CreationDate="2012-05-05T22:33:15.023" Score="4" ViewCount="320" Body="&lt;p&gt;When using a phase vocoder to alter the spectral envelope of a signal, the input signal is split up into many (often hundreds of) bands. With many phase vocoders, the output levels these individual bands are often controllable by the user.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What artifacts are caused by filtering these individual bands in a phase vocoder?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If and why, phase vocoders are better suited (and cause less artifacts) than FIR filters (or other methods) for surgical changes to such narrow frequency bands.  For example, are phase vocoders going to cause the same, or less, pass band ´ringing´ than using an FIR filter for the same task?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I understand phase vocoders only up to the point that they use an inverse DFT to resynthesise the sound, though Im not sure exactly how the individual bands are resynthesized, so I dont know what the problems/artifacts will be.&lt;/p&gt;&#xA;" OwnerUserId="1304" LastEditorUserId="154" LastEditDate="2013-11-28T23:02:23.827" LastActivityDate="2013-11-28T23:02:23.827" Title="What sonic artifacts are caused by phase vocoders?" Tags="|filters|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2303" PostTypeId="2" ParentId="2302" CreationDate="2012-05-05T23:11:29.637" Score="8" Body="&lt;p&gt;The term &quot;phase vocoder&quot; may encompass more than one resynthesis method.  One method uses a pruned frequency reassignment of the DFT basis vectors, and thus resynthesizes sound using a sparser set of basis vectors with slightly different frequencies than were present in the original DFT analysis windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sparse basis may not be able to recreate a full spectrum wide-band signal, such as produced by a transient, as well as the original non-reassigned full DFT basis.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase vocoder analysis also makes the assumption that the spectrum is fairly stationary between FFT frames, an assumption that can also be violated by transients.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One term for the artifacts produced by this type of analysis/resynthesis is transient smearing.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-06T00:20:23.887" LastActivityDate="2012-05-06T00:20:23.887" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2304" PostTypeId="1" AcceptedAnswerId="2305" CreationDate="2012-05-06T19:12:15.020" Score="12" ViewCount="1597" Body="&lt;p&gt;What kind of analysis might be used on sets of 2D monochrome image matrices or bitmaps to estimate or compare their relative quality of being &quot;in focus&quot;?  Is there an efficient way of computing a scalar metric on something like overall contrast, luminance sparsity, or other artifacts produced from out-of-focus blurring?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-06T23:11:20.120" Title="Auto-focus estimation?" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2305" PostTypeId="2" ParentId="2304" CreationDate="2012-05-06T20:27:20.317" Score="13" Body="&lt;p&gt;Images in focus have sharper edges, so applying an edge detector and measuring the energy of the output puts you on the right track.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple technique is to compute the sum of the laplacian over the images, possibly center-weighted if you deal with everyday photographs (people tend to put the object of interest in the center, so it's better to have the center in focus than the borders)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This criterion is for example what is used in many &quot;Stack focusing&quot; applications for macro photography.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other approaches used in de-hazing or tone-mapping... Search for &quot;Local contrast measures&quot;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-05-06T20:27:20.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2306" PostTypeId="2" ParentId="2304" CreationDate="2012-05-06T23:11:20.120" Score="5" Body="&lt;p&gt;In general a lens can be modelled as &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_optics#Lens_as_a_low-pass_filter&quot;&gt;a low pass filter&lt;/a&gt;. When an object is out of focus, &lt;a href=&quot;http://en.wikipedia.org/wiki/Circle_of_confusion&quot;&gt;the smoothing effect of the low pass filter is more intense&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, you could use a simple metric such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Standard_deviation&quot;&gt;Standard Deviation&lt;/a&gt; either applied globally (over the full image) or applied locally through a suitable size moving window over the image to preserve the spatial information if in addition you would also be interested in which areas are in or out of focus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In either case and assuming that the scene has not changed much between takes, the Standard Deviation of the image IN focus will be higher than the Standard Deviation of the image OUT of focus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an application of the Standard Deviation as a &quot;focus estimator&quot; you could have a look at &lt;a href=&quot;http://nvlpubs.nist.gov/nistpubs/jres/105/4/j54tan.pdf&quot;&gt;this publication&lt;/a&gt;, while a review of a number of measures (including Standard Deviation) is available &lt;a href=&quot;http://onlinelibrary.wiley.com/doi/10.1002/cyto.990060202/pdf&quot;&gt;from this one&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-05-06T23:11:20.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2307" PostTypeId="2" ParentId="2103" CreationDate="2012-05-07T01:15:16.080" Score="1" Body="&lt;p&gt;Conceptually, for ICA to work, it requires N observations of the SAME phenomenon and it will attempt to decompose these signals (the mixtures) to &amp;lt; N components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your description each detector is counting a different energy particle. That is, the &quot;Mixtures&quot; are actually already three different signals. Consider the example where you use the recordings of 4 different microphones to try and distinguish between 2 different (mutually independent) sound sources. In this case each microphone is recording a (different) sum of BOTH sound sources. In your case, because of the phenomenon you are observing, each &quot;microphone&quot; (detector) is NOT recording a (different) sum of BOTH sources, but rather it records each source separately (most of the times).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you describe, sometimes, the SAME event might be recorded by more than one detectors (spill-over). In this case, if you insist with ICA then it would attempt to decompose THAT sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, perhaps you should consider something simpler, like obtaining the cross correlation between the events recorded by each one of the three different detectors as an indicator of the amount of spill-over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in this case, instead of examining 1000 &quot;triplets&quot; of observations, you create three different time series. One time series per detector describing the events (in time) of each detector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your detectors and aparatus are fast enough, this signal will look like a series of exponentially decaying pulses. If not, your signal will look like a train of pulses convolved with the impulse response of the system (a smoothed version). In either case, if the same event has been detected by more than one detectors then the output of these detectors will simultaneously rise in level (and increase the cross - correlation or some other form of correlation metric). It will be easier to detect that rise in the first case (fast system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the problem now becomes one where you have to decide which detector to assign that event to for it to be counted correctly. There is a number of ways that you can do this (not using ICA) but you will have to know the spectral response of your detector (Pulse amplitude VS energy or Voltage output VS energy). You would then be able to create a weighted sum of the counted particles by looking up the &quot;weight&quot; for each pulse on your detector's response. Or you could apply a &quot;window&quot; to the pulses. That is, consider a sharp threshold around the peak response of the detector and only count events that generate such (usually high) pulses. Considering a short region around the peak performance of the detector will reject the (lower) pulses created by spill-over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps. I hope to have understood your configuration correctly.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2012-05-07T01:23:21.903" LastActivityDate="2012-05-07T01:23:21.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2311" PostTypeId="2" ParentId="2299" CreationDate="2012-05-07T14:36:40.863" Score="1" Body="&lt;p&gt;It takes time for a filter to &quot;decide&quot; if a signal is just inside or just outside a filter transition.  One solution is to just move the filter transition away from any signal of interest, such as halfway between your two test signals, where, in you test case, there is very little signal to distort by an imperfect decision.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-07T14:36:40.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2312" PostTypeId="1" AcceptedAnswerId="2318" CreationDate="2012-05-07T16:02:54.203" Score="15" ViewCount="7025" Body="&lt;p&gt;What are the differences between classical low-pass filtering (with an IIR or FIR), and &quot;smoothing&quot; by localized Nth degree polynomial regression and/or interpolation (in the case of upsampling), specifically in the case where N is greater than 1 but less than the local number of points used in the regression fit.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-06-07T05:53:19.427" Title="Differences between filtering and polynomial regression smoothing?" Tags="|lowpass-filter|interpolation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2313" PostTypeId="1" CreationDate="2012-05-07T20:23:40.280" Score="3" ViewCount="697" Body="&lt;p&gt;I have numerous photos from a still image camera that I would like to merge into one photo to allow for easy spotting of motion or new objects. There is a bit of noise across the photos but not very much movement (Cameras are focused on areas that do not expect much to change).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were to merge these photos into one image, what would you use to do it provided the tool or library had to be relatively easy to call from a python script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe this technique is called Image stacking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTES from comments&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have snapshots taken over time from an IP camera. The jpeg compression can be sett to 100% quality to prevent the noise from overwhelming the information in each picture&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The camera never moves and the scene is typcially static. I can mark images that have movement or new objects. I would like to stack the images to provide a single glance report of what happend at this site&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There are multiple challanges. What tool to use with python bindings, how to overcome noise in the jpeg compression, and methods for detecting big changes in the scene (objects)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="266" LastEditorUserId="440" LastEditDate="2012-05-18T11:01:38.343" LastActivityDate="2012-05-18T11:01:38.343" Title="What is the best method for merging time lapsed photos? Accessable from python(PIL)" Tags="|image-processing|python|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2314" PostTypeId="2" ParentId="2313" CreationDate="2012-05-07T20:44:56.023" Score="1" Body="&lt;p&gt;You can &lt;a href=&quot;http://www.imagemagick.org/script/composite.php&quot; rel=&quot;nofollow&quot;&gt;composite&lt;/a&gt; (&lt;a href=&quot;http://www.imagemagick.org/Usage/layers/#composite&quot; rel=&quot;nofollow&quot;&gt;more&lt;/a&gt;) with the well-known and free &lt;a href=&quot;http://en.wikipedia.org/wiki/ImageMagick&quot; rel=&quot;nofollow&quot;&gt;imagemagick&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option, which I have no experience with, is &lt;a href=&quot;http://code.google.com/p/imagestack/&quot; rel=&quot;nofollow&quot;&gt;imagestack&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2012-05-07T20:51:09.043" LastActivityDate="2012-05-07T20:51:09.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2316" PostTypeId="2" ParentId="69" CreationDate="2012-05-08T04:37:57.863" Score="19" Body="&lt;p&gt;Another reason:&lt;/p&gt;&#xA;&lt;p&gt;It's &lt;strong&gt;fast&lt;/strong&gt; (e.g. useful for convolution), due to its &lt;a href=&quot;http://en.wikipedia.org/wiki/Time_complexity#Linearithmic.2Fquasilinear_time&quot; rel=&quot;noreferrer&quot;&gt;linearithmic time complexity&lt;/a&gt; (specifically, that of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;FFT&lt;/a&gt;).&lt;br /&gt;&#xA;I would argue that, if this were not the case, we would probably be doing a lot more in the time domain, and a lot less in the Fourier domain.&lt;/p&gt;&#xA;&lt;h3&gt;Edit: Since people asked me to write why the FFT is fast...&lt;/h3&gt;&#xA;&lt;p&gt;It's because it cleverly avoids doing extra work.&lt;/p&gt;&#xA;&lt;p&gt;To give an concrete example of how it works, suppose you were multiplying two polynomials, &lt;span class=&quot;math-container&quot;&gt;$a_0 x^0 + a_1 x^1 + \ldots + a_nx^n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_0 x^0 + b_1 x^1 + \ldots + b_nx^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you were to do this naively (using the &lt;a href=&quot;http://en.wikipedia.org/wiki/FOIL_method&quot; rel=&quot;noreferrer&quot;&gt;FOIL method&lt;/a&gt;), you would need approximately &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; arithmetic operations (give or take a constant factor).&lt;/p&gt;&#xA;&lt;p&gt;However, we can make a seemingly mundane observation: in order to multiply two polynomials, &lt;em&gt;we don't need to FOIL the coefficients&lt;/em&gt;. Instead, we can simply &lt;em&gt;evaluate&lt;/em&gt; the polynomials at a (sufficient) number of points, do a &lt;em&gt;pointwise&lt;/em&gt; multiplication of the evaluated values, and then &lt;em&gt;interpolate&lt;/em&gt; to get back the result.&lt;/p&gt;&#xA;&lt;p&gt;Why is that useful? After all, each polynomial has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; terms, and if we were to evaluate each one at &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; points, that would still result in &lt;span class=&quot;math-container&quot;&gt;$\approx n^2$&lt;/span&gt; operations, so it doesn't seem to help.&lt;/p&gt;&#xA;&lt;p&gt;But it does, if we do it correctly! Evaluating a single polynomial at &lt;em&gt;many&lt;/em&gt; points at once is &lt;em&gt;faster&lt;/em&gt; than evaluating it at those points individually, &lt;em&gt;if we evaluate at the &amp;quot;right&amp;quot; points&lt;/em&gt;. What are the &amp;quot;right&amp;quot; points?&lt;/p&gt;&#xA;&lt;p&gt;It turns out those are the roots of unity (i.e. all complex numbers &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$z^n = 1$&lt;/span&gt;). If we choose to evaluate the polynomial at the roots of unity, then a lot of expressions will turn out the same (because a lot of monomials will turn out to be the same). This means we can do their arithmetic &lt;em&gt;once&lt;/em&gt;, and re-use it thereafter for evaluating the polynomial at all the other points.&lt;/p&gt;&#xA;&lt;p&gt;We can do a very similar process for interpolating through the points to get back the polynomial coefficients of the result, just by using the &lt;em&gt;inverse&lt;/em&gt; roots of unity.&lt;/p&gt;&#xA;&lt;p&gt;There's obviously a lot of math I'm skipping here, but effectively, the FFT is basically the algorithm I just described, to evaluate and interpolate the polynomials.&lt;br /&gt;&#xA;One of its uses, as I showed, was to multiply polynomials in a lot less time than normal.&#xA;It turns out that this saves a tremendous amount of work, bringing down the running time to being proportional to &lt;span class=&quot;math-container&quot;&gt;$n \log n$&lt;/span&gt; (i.e. linearithmic) instead of &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; (quadratic).&lt;/p&gt;&#xA;&lt;p&gt;Thus the ability to use the FFT to perform a typical operation (such as polynomial multiplication) much faster is what makes it useful, and that is also why people are now excited by MIT's new discovery of the &lt;a href=&quot;https://dsp.stackexchange.com/questions/2317/what-is-the-sparse-fourier-transform&quot;&gt;Sparse FFT&lt;/a&gt; algorithm.&lt;/p&gt;&#xA;" OwnerUserId="310" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-10-24T07:53:09.093" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2317" PostTypeId="1" CreationDate="2012-05-08T10:08:32.480" Score="55" ViewCount="21966" Body="&lt;p&gt;MIT has been making a bit of noise lately about a new algorithm that is touted as a faster Fourier transform that works on particular kinds of signals, for instance: &amp;quot;&lt;a href=&quot;http://web.mit.edu/newsoffice/2012/faster-fourier-transform-named-one-of-worlds-most-important-emerging-technologies.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Faster Fourier transform named one of world’s most important emerging technologies&lt;/em&gt;&lt;/a&gt;&amp;quot;. The MIT Technology Review magazine &lt;a href=&quot;http://www.technologyreview.com/article/40245/&quot; rel=&quot;nofollow noreferrer&quot;&gt;says&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;With the new algorithm, called the sparse Fourier transform (SFT), streams of data can be processed 10 to 100 times faster than was possible with the FFT. The speedup can occur because the information we care about most has a great deal of structure: music is not random noise. These meaningful signals typically have only a fraction of the possible values that a signal could take; the technical term for this is that the information is &amp;quot;sparse.&amp;quot; Because the SFT algorithm isn't intended to work with all possible streams of data, it can take certain shortcuts not otherwise available. In theory, an algorithm that can handle only sparse signals is much more limited than the FFT. But &amp;quot;sparsity is everywhere,&amp;quot; points out coinventor Katabi, a professor of electrical engineering and computer science. &amp;quot;It's in nature; it's in video signals; it's in audio signals.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Could someone here provide a more technical explanation of what the algorithm actually is, and where it might be applicable?&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Some links:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The paper: &amp;quot;&lt;a href=&quot;http://arxiv.org/abs/1201.2501v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nearly Optimal Sparse Fourier Transform&lt;/a&gt;&amp;quot; (arXiv) by Haitham Hassanieh, Piotr Indyk, Dina Katabi, Eric Price.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://groups.csail.mit.edu/netmit/sFFT/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Project website&lt;/a&gt; - includes sample implementation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="64" LastEditorUserId="7092" LastEditDate="2023-11-21T16:41:42.047" LastActivityDate="2023-11-21T16:41:42.047" Title="What is the sparse Fourier transform?" Tags="|fourier-transform|sparsity|sparse-fourier-transform|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2318" PostTypeId="2" ParentId="2312" CreationDate="2012-05-08T12:18:31.437" Score="11" Body="&lt;p&gt;Both low pass filtering and polynomial regression smoothing could be seen as &lt;a href=&quot;http://en.wikipedia.org/wiki/Approximation_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;approximations&lt;/a&gt; of a function. However, the means of doing this are different. The key question to ask here is &quot;Can you do one in terms of the other?&quot; and the short answer is &quot;not always&quot;, for reasons that are explained below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When smoothing by filtering the key operation is convolution where $y(n)=x(n)*h(n)$, which in the frequency domain translates to $y=F^{-1}(F(x)F(h))$ where $F$ denotes the Discrete Fourier Transform (and $F^{-1}$ the inverse). The Discrete Fourier Transform (e.g. $F(x)$) offers an approximation of $x$ as a sum of trigonometric functions. When $h$ is a low pass filter, a smaller number of low frequency components are retained and the abrupt changes in $x$ are smoothed out. This sets low-pass filtering in the context of function approximation by using trigonometric functions as &lt;a href=&quot;http://en.wikipedia.org/wiki/Basis_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;the basis functions&lt;/a&gt;, but it is worth revisiting the convolution formula to note that when filtering, y(n) (the output of the filter) depends on $x(n)$ as well as a weighted sum of past samples of $x$ (the weighting here determined by the &quot;shape&quot; of $h$). (similar considerations hold for IIR filters of course with the addition of past values of $y(n)$ as well)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When smoothing by &lt;a href=&quot;http://en.wikipedia.org/wiki/Polynomial_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;some n-degree polynomial&lt;/a&gt; though, the output of the interpolant depends only on $x(n)$ and a mixture of (different) basis functions (also called &lt;a href=&quot;http://en.wikipedia.org/wiki/Monomial&quot; rel=&quot;nofollow noreferrer&quot;&gt;monomials&lt;/a&gt;). What are these different basis functions? It's a constant ($a_0x^0$), a line ($a_1x$), a parabola ($a_2x^2$) and so on (please refer &lt;a href=&quot;http://en.wikipedia.org/wiki/Curve_fitting&quot; rel=&quot;nofollow noreferrer&quot;&gt;to this&lt;/a&gt; for a nice illustration). Usually though, when dealing with equi-distant samples in time and for reasons to do with accuracy, what is used is &lt;a href=&quot;http://en.wikipedia.org/wiki/Newton_polynomial&quot; rel=&quot;nofollow noreferrer&quot;&gt;Newton's form of the polynomial&lt;/a&gt;. The reason i am citing this is because through that it is easy to see that when performing linear interpolation you could construct a filter kernel that returns a linearly weighted sum of available samples, just as a low order interpolation polynomial would use &quot;lines&quot; to interpolate between two samples. But at higher degrees, the two approximation methods would return different results (due to the differences in the basis functions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As i wrote above, not taking into account past values of $x(n)$ is not strict. This is a subtle point. Because usually, when building a polynomial the values outside the given interval (&quot;past&quot; and &quot;future&quot; of a signal) are not considered. It is however possible to include these by fixing the derivatives at the edges of the interval. And if this is done repeatedly (like a non-overlapping sliding window) then effectively, the &quot;past samples&quot; of x(n) would be taken into account. (This is the trick that splines use and in-fact there is a convolution expression for &lt;a href=&quot;http://en.wikipedia.org/wiki/Bicubic_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;bicubic interpolation&lt;/a&gt;. However, please note here that the interpretation of $x$ is different when talking about &lt;a href=&quot;http://en.wikipedia.org/wiki/Cubic_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;splines&lt;/a&gt; -note the point about normalisation-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for using filtering as interpolation some times, say for instance in the case of &quot;Sinc Interpolation&quot;, is because it also makes sense from a physical point of view. The idealised representation of a band-limited system (e.g. a (linear) amplifier or &lt;a href=&quot;https://dsp.stackexchange.com/questions/2304/auto-focus-estimation&quot;&gt;lens in an optical system&lt;/a&gt;) in time domain is the sinc pulse. The frequency domain representation of a sinc pulse is &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;a rectangle &quot;pulse&quot;&lt;/a&gt;. Therefore, with very few assumptions we expect a missing value to be more or less near its neighbours (of course, within limits). If this was performed with some n-order polynomial (for higher n) then in a way we &quot;fix&quot; the way that a missing value is related to its neighbours which might not always be realistic (why should the sound-pressure values of a wave-front hitting a microphone be fixed to have the shape of a $x^3$ for example? It puts an assumption on how the sound-source behaves which might not always be true. Please note that i do not imply any suitability of an interpolation scheme from a &lt;a href=&quot;http://en.wikipedia.org/wiki/Psychophysics&quot; rel=&quot;nofollow noreferrer&quot;&gt;psychophysics&lt;/a&gt; point of view here, which involves the processing of the brain (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Lanczos_resampling#In_visual_processing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lanczos resampling&lt;/a&gt; for example). I am strictly speaking about constraints imposed by interpolation when one tries to &quot;guess&quot; objectively missing values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no universal &quot;best method&quot;, it pretty much depends on the interpolation problem you are faced with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. (The artifacts generated by each of the two approximation methods are different as well, see for example the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gibbs_phenomenon&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gibbs Phenomenon&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Overfitting&quot; rel=&quot;nofollow noreferrer&quot;&gt;overfitting&lt;/a&gt;, although overfitting is &quot;at the other side&quot; of your question.)&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-05-08T12:18:31.437" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2319" PostTypeId="2" ParentId="2317" CreationDate="2012-05-08T12:57:37.873" Score="43" Body="&lt;p&gt;The idea of the algorithm is this: assume you have a length $N$ signal that is sparse in the frequency domain. This means that if you were to calculate its &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;discrete Fourier transform&lt;/a&gt;, there would be a small number of outputs $k \ll N$ that are nonzero; the other $N-k$ are negligible. One way of getting at the $k$ outputs that you want is to use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;FFT&lt;/a&gt; on the entire sequence, then select the $k$ nonzero values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sparse Fourier transform algorithm presented here is a technique for calculating those $k$ outputs with lower complexity than the FFT-based method. Essentially, because $N-k$ outputs are zero, you can save some effort by taking shortcuts inside the algorithm to not even generate those result values. While the FFT has a complexity of $O(n \log n)$, the sparse algorithm has a potentially-lower complexity of $O(k \log n)$ for the sparse-spectrum case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the more general case, where the spectrum is &quot;kind of sparse&quot; but there are more than $k$ nonzero values (e.g. for a number of tones embedded in noise), they present a variation of the algorithm that &lt;em&gt;estimates&lt;/em&gt; the $k$ largest outputs, with a time complexity of $O(k \log n \log \frac{n}{k})$, which could also be less complex than the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to one graph of &lt;a href=&quot;http://groups.csail.mit.edu/netmit/sFFT/results.html&quot; rel=&quot;noreferrer&quot;&gt;their results&lt;/a&gt; (reproduced in the image below), the crossover point for improved performance with respect to FFTW (an optimized FFT library, made by some other guys at MIT) is around the point where only $\frac{1}{2^{11}}$-th to $\frac{1}{2^{10}}$-th of the output transform coefficients are nonzero. Also, &lt;a href=&quot;http://groups.csail.mit.edu/netmit/sFFT/soda_slides.pdf&quot; rel=&quot;noreferrer&quot;&gt;in this presentation&lt;/a&gt; they indicate that the sparse algorithm provides better performance when $\frac{N}{k} \in [2000, 10^6]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JE7BR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These conditions do limit the applicability of the algorithm to cases where you know there are likely to be few significantly-large peaks in a signal's spectrum. One example that they cite &lt;a href=&quot;http://groups.csail.mit.edu/netmit/sFFT/index.html&quot; rel=&quot;noreferrer&quot;&gt;on their Web site&lt;/a&gt; is that on average, 8-by-8 blocks of pixels often used in image and video compression  are almost 90% sparse in the frequency domain and thus could benefit from an algorithm that exploited that property. That level of sparsity doesn't seem to square with the application space for this particular algorithm, so it may just be an illustrative example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to read through the literature a bit more to get a better feel for how practical such a technique is for use on real-world problems, but for certain classes of applications, it could be a fit.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-05-08T12:57:37.873" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2320" PostTypeId="2" ParentId="2197" CreationDate="2012-05-08T15:47:33.150" Score="7" Body="&lt;p&gt;I unfortunately don't know a whole lot about Kalman filters, but I think I can help you out with the state space stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Example 1, the AR model is exactly your good old DSP recursive definition of output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y_t = \alpha + \phi_1y_{t-1} + \phi_2y_{t-2} + \eta_t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case we write down the state-space model with direct correspondence with the above equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{pmatrix}y_t \\ y_{t-1}\end{pmatrix} = \begin{pmatrix}\phi_1 &amp;amp; \phi_2 \\ 1 &amp;amp; 0\end{pmatrix}\begin{pmatrix}y_{t-1} \\ y_{t-2} \end{pmatrix} + \begin{pmatrix}\alpha \\ 0 \end{pmatrix} + \begin{pmatrix}1 \\ 0 \end{pmatrix}\eta_t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in this case, the &lt;em&gt;states&lt;/em&gt; of the system are current and previous values of the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second example, you're separating your states $c$ from your output values. This means that the states can now be anything, even though they still directly map onto output values. This way we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_t = \mu + c_t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ c_t = \phi_1c_{t-1} + \phi_2c_{t-2} + \eta_t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And therefore&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{pmatrix}c_t \\ c_{t-1}\end{pmatrix} = \begin{pmatrix}\phi_1 &amp;amp; \phi_2 \\ 1 &amp;amp; 0\end{pmatrix}\begin{pmatrix}c_{t-1} \\ c_{t-2} \end{pmatrix} +  \begin{pmatrix}1 \\ 0 \end{pmatrix}\eta_t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also recognize this as the standard state-space representation of a linear system, because you equations for state evolution and state-dependent output are &lt;em&gt;two different equation&lt;/em&gt;. This separation is trivial in case of an AR model, but this latter notation is how we think of all linear state-space models in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third example is a curious one. If you multiply out all the coefficients you will realize that it is actually equivalent to the first and the second examples. So why do it? I turns out that example 2 (being the proper state-space representation of the system) is called the &lt;em&gt;Controllable Canonical Form&lt;/em&gt; of this system. If you do some reading or simply analyze the system carefully, you will realize that we can put this system into &lt;em&gt;any state we like&lt;/em&gt; provided well-behaved values for $\phi_1$ and $\phi_2$ with the single input $\alpha$. Therefore we call such systems &lt;em&gt;controllable&lt;/em&gt;, and it's very easy to see from this form of the state-space equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should notice that two linear systems can be identical up to a change of basis. This means that we can pick a different basis to represent the same linear system. You can convince yourself that that's exactly what we've done to go from second to third example. Particularly, we like this linear transformation to transpose the state transition matrix, so that we would get for some unknown state $\boldsymbol{s}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_t = \begin{pmatrix}1 &amp;amp; 0\end{pmatrix} \boldsymbol{\alpha_t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\boldsymbol{\alpha_t} = \begin{pmatrix}s_t \\ s_{t-1}\end{pmatrix} = \begin{pmatrix}\phi_1 &amp;amp; \phi_2 \\ 1 &amp;amp; 0\end{pmatrix}\begin{pmatrix}s_{t-1} \\ s_{t-2} \end{pmatrix} + \begin{pmatrix}\alpha \\ 0 \end{pmatrix} + \begin{pmatrix}1 \\ 0 \end{pmatrix}\eta_t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can use the change of basis to find out what this state $\boldsymbol{s}$ has to be with respect to state $\boldsymbol{y}$. And we can calculate it to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{pmatrix}s_t \\ s_{t-1}\end{pmatrix} = \begin{pmatrix}y_t \\ \phi_2 y_{t-1}\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This form (transpose of Controllability Canonical Form) is called the &lt;em&gt;Observability Canonical Form&lt;/em&gt; because if we can put a system in this form, we can easily deduce which states of the system can be &lt;em&gt;observed&lt;/em&gt; by simply looking at the output. For some description of the canonical forms, you can read &lt;a href=&quot;http://www.engr.mun.ca/~millan/6825/canonicals.pdf&quot;&gt;this document&lt;/a&gt;, and of course look around on the web. Note that in the document the states are flipped upside down, which does not change anything about the system representation, simply reordering the rows / columns of the matrices.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-05-08T15:47:33.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2321" PostTypeId="1" AcceptedAnswerId="2322" CreationDate="2012-05-08T18:03:24.630" Score="15" ViewCount="8151" Body="&lt;p&gt;Consider a simple case where two signals from two different sensors are cross-correlated, and the time-delay-of-arrival computed from the absissa of the peak of their cross-correlation function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let us further assume that due to the dimensionality constraints of both antennas and the constraints on maximum possible sampling rate, the maximum attainable delay possible is $D$, corresponding to 10 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of those constraints, your computed delay may vary from any &lt;em&gt;integer&lt;/em&gt; value between 0 and 10 samples, that is: $0 \le D \le 10$. This is problematic because what I really want is fractional-delay discrimination of the delay between the two signals impinging on my antennas, and changing the dimensions or the sampling rate are not an option. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some thoughts:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Naturally, the first thing I think of for this case is upsampling the signals before performing a cross-correlation. However I think this is 'cheating' somehow, because I am not really adding any new information into the system. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I do not understand how upsampling is not 'cheating' in a sense. Yes, we are reconstructing our signal based on its currently observed frequency information, but how does this give one knowledge of where a signal truly started between, say, $D=7$ and $D=8$? &lt;em&gt;Where&lt;/em&gt; was this information contained in the original signal that determined that the true fractional-delay start of the signal was actually at $D=7.751$? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The question(s):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Is this truly 'cheating'?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If not, then where is this new 'information' coming from?&lt;/li&gt;&#xA;&lt;li&gt;If yes, then what other options are available for estimating fractional-delay times?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I am aware of upsampling the &lt;em&gt;result&lt;/em&gt; of the cross-correlation, in an attempt to garner sub-sample answers to the delay, but is this too not also a form of 'cheating'? Why is it different from upsampling prior to the cross-correlation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If indeed it is the case that the upsampling is not 'cheating', then why would we ever need to increase our sampling rate? (Isnt having a higher sampling rate always better in a sense than interpolating a low sampled signal?) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would seem then that we could just sample at a very low rate and interpolate as much as we want. Would this then not make increasing the sample rate 'useless' in light of simply interpolating a signal to our heart's desire? I realize that interpolation takes computational time and simply starting with a higher sample rate would not, but is that then the only reason?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-05-08T19:26:43.547" LastActivityDate="2015-04-07T05:06:59.560" Title="Is up-sampling prior to cross-correlation useless?" Tags="|filters|cross-correlation|peak-detection|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2322" PostTypeId="2" ParentId="2321" CreationDate="2012-05-08T18:21:40.070" Score="14" Body="&lt;p&gt;It's not cheating, and it's also not adding any new information.  What you are doing is the same thing that any upsampling LPF is doing- adding zeros and then reconstructing the waveform with the already known frequency information.  Thus, there is no new information, but there is still finer time resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upsampling the result is similar- no new information but finer time resolution.  You can do something very similar through &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html&quot; rel=&quot;noreferrer&quot;&gt;quadratic interpolation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these methods- upsampling and polynomial interpolation- get their information on where the fractional peak is from both the peak itself and its neighbors.  A quick pictorial example.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JtqG0.png&quot; alt=&quot;Balanced Peak&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blue line in the picture above is my simulated cross-correlation data (though it could be any result, not just a cross-correlation).  It is what I call a &quot;balanced&quot; peak because the neighbors are symmetric.  As you might expect, the resulting quadratic interpolation (red line) indicates that the true peak is at zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image below, on the other hand, shows an unbalanced peak.  Please note that nothing has changed in the result except for the values of the two nearest neighbors.  This causes the interpolator, though, to shift its estimate of the fractional peak.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/z4FkD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A nifty side benefit of these methods (polynomial interpolation and upsampling) is that it also gives you an estimate of the true peak value, though we are usually more interested in the location.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If indeed it is the case that the upsampling is not 'cheating', then&#xA;  why would we ever need to increase our sampling rate?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To satisfy the Nyquist criterion.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Isn't having a higher sampling rate always better in a sense than&#xA;  interpolating a low sampled signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No.  From a theoretical standpoint, as long as the Nyquist criterion is satisfied it doesn't matter what the sample rate is.  From a practical standpoint you generally go with as low a sample rate as you can get away with to reduce the storage requirements and computational load, which in turn reduces the resources that are needed and power consumption.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-05-08T19:45:39.997" LastActivityDate="2012-05-08T19:45:39.997" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2323" PostTypeId="2" ParentId="2299" CreationDate="2012-05-08T22:42:00.433" Score="0" Body="&lt;p&gt;Use  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ht = fir1(40,.5,'stop');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead, and you will have very low attenuation at F0, and very high attenuation at F1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8dBhH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1216" LastActivityDate="2012-05-08T22:42:00.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2324" PostTypeId="2" ParentId="2321" CreationDate="2012-05-08T22:42:38.607" Score="8" Body="&lt;p&gt;Any bandlimited signal can be interpolated.  The additional information &quot;between the samples&quot; is contained in the adjacent samples plus the fact that the signal was bandlimited before sampling (which tends to spread information among adjacent samples).  If two signals are bandlimited, than so will be the cross-correlation, so the cross-correlation can be interpolated as well.  Upsampling is just another form of interpolation, a very accurate form of interpolation for bandlimited signals; but you could use Sinc interpolation as well (both of which can be more accurate than quadratic or parabolic interpolation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interpolation may show a peak between samples. Thus perhaps not useless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a signal containing a wider spectrum, then it can contain more information.  Sampling it at a higher rate will thus provide more information, but only up to just below half the new band limit frequency, and only if the signal contained actual useful spectral frequency content above the old band limit, and if you can now obtain this additional spectrum by using a new more wide-band band-limiting process or filter, instead of the old more lossy one.  Sampling data at a much higher frequency of a signal that was already bandlimited to a much lower frequency below Fs/2 will only buy you interpolation, not any more information content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the sampling is quantized, then sampling at a higher rate might buy you a fraction of an LSB more information, due to dithering or noise shaping of the quantization error.  But this depends on the S/N ratio and accuracy of the sampler and the exact quantization process used in sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If two signals are not properly bandlimited prior to sampling and cross-correlation, than not only might both upsampling or interpolation buy you a garbage result, but so might be the original non-interpolated cross-correlation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-09T07:33:54.393" LastActivityDate="2012-05-09T07:33:54.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2325" PostTypeId="2" ParentId="2317" CreationDate="2012-05-09T06:24:02.530" Score="6" Body="&lt;p&gt;I have looked through the paper and I think I got the general idea of the method. The &quot;secret souse&quot; of the method is how to get sparse representation of input signal in frequency domain. The previous algorithms used kind of brute force for location of dominant sparse coefficient. This method use instead technique which called &quot;space recovery&quot; or &quot;compressed sensing&quot;&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Compressed_sensing&quot;&gt;wiki article is here&lt;/a&gt;&#xA;The exact method of sparse recovery used here looks similar to 'hard thresholding&quot; - one of the dominant sparse recovery methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS technique of sparse recovery/compressed sensing and connected to it L1 minimization used a lot in modern signal processing and especially in connection with Fourier transform. In fact it's a must to know for modern signal processing. But before Fourier transform was used as one of the methods for solution of sparse recovery problem. Here we see opposite -  sparse recovery &lt;em&gt;for&lt;/em&gt; Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good site for overview compressed sensing:&#xA;&lt;a href=&quot;http://sites.google.com/site/igorcarron2/cs&quot;&gt;nuit-blanche.blogspot.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PPS answer to previous comment - if input signal is not exactly sparse it's lossy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to correct me if I got method wrong.&lt;/p&gt;&#xA;" OwnerUserId="198" LastActivityDate="2012-05-09T06:24:02.530" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2326" PostTypeId="1" AcceptedAnswerId="2329" CreationDate="2012-05-09T13:58:21.957" Score="7" ViewCount="8612" Body="&lt;p&gt;How does the signal look when we don't use the Nyquist rate to remove aliasing from a signal during sampling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's suppose the signal is sinusoidal, with a frequency of 500&amp;nbsp;Hz and an amplitude of 2.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal = 2*cos(2*pi*500*t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I sample it, (replacing t=nTs , Ts = sampling period and n represent number of samples) and plotting the sampled signals with a different sampling period using the subplot command in MATLAB, how could I identify the aliasing in a sampled signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the example code that plotted two signals, one at the Nyquist rate while the other less than the Nyquist rate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = 2;&#xA;Fmax = 10;&#xA;Fs = 2*Fmax;&#xA;n = 0:1/Fs:1;&#xA;Cont = A*sin(2*pi*(Fmax/Fs)*n);&#xA;Cont1 = A*sin(2*pi*(Fmax/18)*n);&#xA;subplot(2,1,1)&#xA;stem(n,Cont)&#xA;hold on&#xA;stem(n,Cont1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and here is the waveform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a99t1.png&quot; alt=&quot;Enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wasn't able to identify the aliasing. How did it affect the signal when Nyquist rate didn't use?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="207" LastEditDate="2012-05-09T19:44:37.727" LastActivityDate="2012-05-09T19:44:37.727" Title="Demonstrating the effect of aliasing" Tags="|matlab|discrete-signals|sampling|aliasing|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2327" PostTypeId="2" ParentId="2326" CreationDate="2012-05-09T14:38:06.230" Score="0" Body="&lt;p&gt;I think you need to increase frequency of the size or use far larger steps in the sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aliasing does not appears if you have a very smooth function. For example, a constant function does not yield aliasing whatever sampling you use.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-05-09T14:38:06.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2328" PostTypeId="2" ParentId="2326" CreationDate="2012-05-09T14:38:32.197" Score="6" Body="&lt;p&gt;You have the right idea, but a key mistake was messing up your results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=0:1/Fs:1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By making the time increments 1/Fs you are implicitly making the time units seconds.  In other words, &quot;0&quot; is 0 seconds, and &quot;1&quot; is 1 second.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Cont = A*sin(2*pi*(Fmax/Fs)*n);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By normalizing the sinusoid frequency by Fs you are implicitly assuming that the sample unit is 1/Fs seconds.  That is why you were getting lots of samples for a single sinusoid cycle when you intended to just have two samples per cycle (the Nyquist rate).  By the way, either sample unit is fine (1 second or 1/Fs second), you just need to be consistent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my attempt at what I think you intended.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = 2;&#xA;Fmax = 10;&#xA;Fs = 2*Fmax;&#xA;n=0:1/Fs:1;&#xA;Cont = A*cos(2*pi*Fmax*n);&#xA;Cont1 = A*cos(2*pi*Fmax*(20/18)*n);&#xA;subplot(2,1,1)&#xA;stem(n,Cont)&#xA;subplot(2,1,2)&#xA;stem(n,Cont1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I changed the &quot;sin&quot; to &quot;cos&quot; because it was hitting all the sinusoid zero points instead of the peaks.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ejtEx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-05-09T14:38:32.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2329" PostTypeId="2" ParentId="2326" CreationDate="2012-05-09T14:46:15.980" Score="8" Body="&lt;p&gt;You can't identify aliasing with a simple sinusoid at a specific frequency and that in a way is the whole point about trying to avoid it. You can't know if the sinusoid you are &quot;looking at&quot; is $Q$ Hz or $2Fs-Q$Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A single aliased sinusoidal component looks just like a non-aliased sinusoid. If you want to experience aliasing, you have to attempt it with either a more complex waveform or a sinusoid that is changing in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to &quot;experience aliasing&quot; is to undersample a &lt;a href=&quot;http://en.wikipedia.org/wiki/Chirp&quot;&gt;chirp&lt;/a&gt; in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 8000;t=0:(1./Fs):(5-1./Fs);p=2.*pi.*t; %Sampling Frequency, Time Vector, Phase Vector&#xA;y1 = chirp(t,0,5,Fs/2.0); %Create a chirp that goes from DC to Fs/2.0&#xA;spectrogram(y1); %Have a look at it through spectrogram, please pay attention at the axis labels. This is basically going to be a &quot;line&quot; increasing with time.&#xA;soundsc(y1,Fs); %Listen to it...It clearly &quot;goes up&quot; in frequency&#xA;y2 = chirp(t,0,5,Fs); %Now create a chirp that goes from DC to Fs&#xA;spectrogram(y2); %Have a look at it through spectrogram&#xA;soundsc(y2,Fs); %Listen to it...Do you &quot;get&quot; the folding of the spectrum?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In general, you can think of Sampling as &lt;a href=&quot;http://en.wikipedia.org/wiki/Modulation&quot;&gt;Modulation&lt;/a&gt; because this is what is effectively happening at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Sample_and_hold&quot;&gt;sample and hold&lt;/a&gt; element of an ADC converter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will enable you to understand more easily concepts like &lt;a href=&quot;http://en.wikipedia.org/wiki/Undersampling&quot;&gt;undersampling&lt;/a&gt; for example (and applications where it is perfectly OK to sample at lower than the Nyquist rates). But also, you can load a WAV file in MATLAB (with 'wavread') containing some more complex signal and prior to listening to it with 'soundsc', simply multiply it with a &quot;square&quot; wave* (you might want to lookup function 'square') at some frequency lower than the WAV file's $F_s$. This will effectively introduce the key (unwanted) characteristic of aliasing which is this &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing#Folding&quot;&gt;folding of the spectrum&lt;/a&gt;. The result is not very pleasant so you might want to keep your speakers volume down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*EDIT: Obviously, &quot;square&quot; returns a square with an amplitude in the interval [-1,1] so prior to multiplying it with your signal it would be better to rescale it as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;aSquareWave = (square(100.*p)+1.0)/2.0 % Where p is the phase vector and here we are producing a square wave at 100Hz (given an Fs of 8kHz as above). aSquareWave's amplitude is now in the interval [0,1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2012-05-09T14:52:57.297" LastActivityDate="2012-05-09T14:52:57.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2331" PostTypeId="2" ParentId="2321" CreationDate="2012-05-09T20:56:11.527" Score="3" Body="&lt;p&gt;I think that the best answer I can give you is: you have all the means to find out by yourself. Build an example &quot;backwards&quot;. Using Matlab, start with two signals sampled with very small sampling periods (so that they are almost continuous-time signals). Compute the cross-correlation, and find the peak (if that's what you want), which you will be able to do with high precision. Then, downsample both signals and repeat the process. Compare the second peak's location and height with the first one. I'm sure the second will be worse. The improvement from the second to the first one is what you gain, if you upsample before cross-correlating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To upsample the right way, both signals need to be band limited, and you need to know those bandwidths. The &quot;new&quot; information that you mention in your question comes from the adjacent samples, and the fact that the signals are band limited.&lt;/p&gt;&#xA;" OwnerUserId="1216" LastActivityDate="2012-05-09T20:56:11.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2333" PostTypeId="1" CreationDate="2012-05-10T16:03:05.693" Score="5" ViewCount="767" Body="&lt;p&gt;I am wondering what would be the right approach to extract top and bottom fields from a YUV 4:2:0 frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the YUV 4:2:0 representation, Luma and Chroma samples are located as shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y Y Y Y Y Y Y Y&lt;br&gt;&#xA;c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c&lt;br&gt;&#xA;Y Y Y Y Y Y Y Y&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y Y Y Y Y Y Y Y&lt;br&gt;&#xA;c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c&lt;br&gt;&#xA;Y Y Y Y Y Y Y Y&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, one needs to be careful while extracting chroma top and bottom fields (due to the chroma offset problem). I have tried a few methods (using asymmetric filters and such), but none have been satisfactory.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there some good resources (papers) on this problem?&lt;/p&gt;&#xA;" OwnerUserId="1326" LastEditorUserId="76" LastEditDate="2012-05-11T02:58:15.230" LastActivityDate="2012-05-13T13:44:37.280" Title="Extracting top &amp; bottom fields from a YUV 4:2:0 Frame" Tags="|image-processing|video-compression|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2334" PostTypeId="2" ParentId="2333" CreationDate="2012-05-10T17:24:38.383" Score="2" Body="&lt;p&gt;Assuming the encoder properly low-pass filtered the chroma before sampling (which may not always be true), chroma samples from the adjacent macroblocks might need to be used to properly reconstruct (interpolate) any per pixel color.  Those samples may exist due to motion compensation from previous fields, or might need to be inferred by reflecting, duplicating or extrapolating edge data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-10T17:32:18.407" LastActivityDate="2012-05-10T17:32:18.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2335" PostTypeId="2" ParentId="2247" CreationDate="2012-05-10T20:44:04.920" Score="11" Body="&lt;p&gt;There are dozens of publications dealing with shadow-detection, generating shadow-masks, and indeed some that actually remove shadows - such as the ones mentioned in the previous posts. I could add some to the list, if needed. The problem, however, is IMHO far from being solved. For a quick-start, given a shadow-mask, I suggest (and have tried in the past) the two following approaches. They definitely reduce shadows - just not always seamless, and I'm sure there are publications (not by me) dealing with shadow-removal in similar ways.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Gradient Domain Manipulation Techniques as described here (C and Matlab Codes provided):&#xA;&lt;a href=&quot;http://www.umiacs.umd.edu/~aagrawal/ICCV2007Course/index.html&quot;&gt;http://www.umiacs.umd.edu/~aagrawal/ICCV2007Course/index.html&lt;/a&gt;&#xA;The gradient-integration approach can be used for a number of image-processing problems, see the slides/presentation for further examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general idea:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute the spatial derivatives (gradient-images) for all color-channels.&lt;/li&gt;&#xA;&lt;li&gt;Use the shadow-boundaries from the shadow-mask to generate a weight-mask that is close to zero on shadow-boundaries and increases to one within a specified neighborhood along the shadow-edge, i.e. orthogonal to a given edge-point.&lt;/li&gt;&#xA;&lt;li&gt;Multiply the weight-mask from (2.) with all the gradient-images to reduce/damp the shadow-boundaries/edges.&lt;/li&gt;&#xA;&lt;li&gt;Integrate the gradient-images using the code from the above link.&lt;/li&gt;&#xA;&lt;li&gt;For RGB-images, from my experience, compute the average of the separate channels of the original images, and scale the integrated images to match these values to prevent &quot;funny&quot; color-artifacts.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Brightness manipulation in the original image-domain.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use the shadow-mask to generate a weight-mask that is one outside shadow regions, has a smooth transition (upwards) across the shadow-boundary and a larger than one scale-factor inside shadow-regions. As suggested in a previous post, the scale-factor can be estimated from the area immediately surrounding a shadow-area using the average-brightness together with the average-brightness of the shadow-region.&lt;/li&gt;&#xA;&lt;li&gt;Multiply the original images (per channel) with the weight-mask, subject to clipping.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have also tried using different color-models, e.g. HSV, that present luminance or brightness directly, which can then be modified independent of color (hue/saturation). This works essentially like the brightness-manipulation, i.e. generate a smooth weight-mask and multiply it with the luminance-channel. Maybe the two approaches, i.e. gradient-integration and brightness-manipulation, can be combined in a clever way, but someone has probably tried that before too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps, kind regards, Derik.&lt;/p&gt;&#xA;" OwnerUserId="1302" LastActivityDate="2012-05-10T20:44:04.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2336" PostTypeId="2" ParentId="2321" CreationDate="2012-05-11T11:51:30.787" Score="4" Body="&lt;p&gt;To add a bit to the previous answers, you can get the equivalent of an upsampled band-limited cross-correlation by making your correlation variable a non-integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following (python) code computes $\tau$, where&#xA;$$&#xD;&#xA;\tau = \arg \max_{\tau}\sum_{n=0}^{N-1}f\left(n\right)g\left(n+\tau\right)&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, it finds the maximum of the cross correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input variables &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; describe $f\left(n\right)$ and $g\left(n\right)$ for $n = \{0, 1, ... , N-1\}$ and are both assumed to be band limited and periodic with period $N$ (the shift is implemented in the discrete Fourier domain). $\tau$ is in range $[-N+1, N-1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intention is to show how the cross-correlation can be performed for non-integer $\tau$, which is defined by the closure &lt;code&gt;correlate_point&lt;/code&gt;. This uses the &lt;code&gt;omega&lt;/code&gt; array, which describes the rotation of the complex phasor at each discrete frequency corresponding to a time-shift $\tau=1$. $\tau$ then scales this for each shift. It should be apparent that to maintain a real time signal, the rotations of the negative frequencies are just $-1$ times the rotations of the positive frequencies (for corresponding frequency pairs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one subtlety is in how you treat the $\frac{N}{2}$ sample (the nyquist frequency), as this is shared between the positive and negative bands. The solution used here is to interpolate between the positive rotation phasor and the negative rotation phasor (which are reflections on the real axis), which is to project either unit rotation phasor onto the real axis, which is a cos function (the &lt;code&gt;pi&lt;/code&gt; is because that is value of &lt;code&gt;omega&lt;/code&gt; corresponding to the nyquist frequency). Clearly this value needs to be real to maintain a real time domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use this to compute the cross-correlation for any arbitrarily precise value of $\tau$. Just call the closure (which can be returned as a callable) with whatever value of $\tau$ you fancy.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;from numpy import fft&#xA;from scipy import optimize&#xA;&#xA;def arg_max_corr(a, b):&#xA;&#xA;    if len(a.shape) &amp;gt; 1:&#xA;        raise ValueError('Needs a 1-dimensional array.')&#xA;&#xA;    length = len(a)&#xA;    if not length % 2 == 0:&#xA;        raise ValueError('Needs an even length array.')&#xA;&#xA;    if not a.shape == b.shape:&#xA;        raise ValueError('The 2 arrays need to be the same shape')&#xA;&#xA;    # Start by finding the coarse discretised arg_max&#xA;    coarse_max = numpy.argmax(numpy.correlate(a, b, mode='full')) - length+1&#xA;&#xA;    omega = numpy.zeros(length)&#xA;    omega[0:length/2] = (2*numpy.pi*numpy.arange(length/2))/length&#xA;    omega[length/2+1:] = (2*numpy.pi*&#xA;            (numpy.arange(length/2+1, length)-length))/length&#xA;&#xA;    fft_a = fft.fft(a)&#xA;&#xA;    def correlate_point(tau):&#xA;        rotate_vec = numpy.exp(1j*tau*omega)&#xA;        rotate_vec[length/2] = numpy.cos(numpy.pi*tau)&#xA;&#xA;        return numpy.sum((fft.ifft(fft_a*rotate_vec)).real*b)&#xA;&#xA;    start_arg, end_arg = (float(coarse_max)-1, float(coarse_max)+1)&#xA;&#xA;    max_arg = optimize.fminbound(lambda tau: -correlate_point(tau), &#xA;            start_arg, end_arg)&#xA;&#xA;    return max_arg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1263" LastEditorUserId="1263" LastEditDate="2012-05-11T15:45:40.347" LastActivityDate="2012-05-11T15:45:40.347" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2337" PostTypeId="1" CreationDate="2012-05-11T18:48:05.780" Score="20" ViewCount="6686" Body="&lt;p&gt;Common non-rectangular window functions all seem to be symmetric.  Is there ever a case when one would want to use a non-symmetric window function before an FFT?  (Say if the data on one side of the FFT aperture were considered a bit more important than data on the other, or less noisy, etc.)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, what kinds of asymmetric window functions have been studied, and how would they affect the frequency response compared to a (more lossy?) offset symmetric window?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2018-11-21T08:00:04.850" Title="FFT with asymmetric windowing?" Tags="|fft|fourier-transform|window-functions|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2338" PostTypeId="2" ParentId="2337" CreationDate="2012-05-11T19:19:38.230" Score="1" Body="&lt;p&gt;The original point of windowing is to make sure that the (assumed periodic by the DFT) signal has no sharp transients at the beginning compared to the end. The cost is that frequencies towards the center of the (symmetric) window will be more weighted and represented in the subsequent DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With all that in the background, I can imagine that one would want to use an asymmetric window to accentuate local &lt;em&gt;temporal&lt;/em&gt; features in the signal being analyzed via the DFT. However this might come at the cost of a wider lobe width during DFT, if the end points of your signal are not roughly the same amplitude after windowing. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-05-11T19:19:38.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2339" PostTypeId="2" ParentId="2337" CreationDate="2012-05-11T22:42:42.737" Score="4" Body="&lt;p&gt;It depends on the context of windowing. Windowing, as it was traditionally developed, was intended for the Blackman-Tukey method of power spectral density of estimation. This is the general form of the correlogram methods, whereby the discrete-time Wiener-Khinchin theorem is exploited. Recall this relates the autocorrelation sequence to the power spectral density through the discrete time Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, windows were designed with several criteria in mind. First, they had to have unity gain at the origin. This was to preserve power in the signal's autocorrelation sequence, as rxx[0] can be thought of as the sample power. Next, the window should taper from the origin. This is for a number of reasons. First, in order to be a valid autocorrelation sequence, all other lags must be less than or equal to the origin. Second, this allowed for higher weighting of the lower lags, which have been computed with great confidence using most of the samples, and small or zero weighting of the higher lags, which have increasing variance due to the decreasing amount of data samples available for their calculation. This ultimately results in a wider main lobe and subsequently decreased resolution in the PSD estimate, but a significant reduction in the side lobes that can bias your main lobe of sinusoidal components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, it's also highly desired if the windows have a nonnegative spectrum. This is because with the Blackman-Tukey method, you can think of the bias of the final estimate as the true power spectral density convolved with the window spectrum. If this window spectrum has negative regions, its possible to have negative regions in your power spectral density estimate. This obviously is undesired, as it has little physical meaning in this context. In addition, you'll note there's no magnitude squared operation in the Blackman-Tukey method. This is because, with a real and even autocorrelation sequence multiplied by a real and even window, the discrete Fourier transform will also be real and even. In practice, you'll find very small negative components that usually are quantized out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For these reasons, windows are also of odd length because all valid autocorrelation sequences are as well. Now, what can still be done (and is done) is windowing in the context of the periodogram methods. That is, window the data, and then take the magnitude squared of the windowed data. This is not equivalent to the Blackman-Tukey method. You can find, through some statistical derivations, that they behave similarly &lt;em&gt;on average&lt;/em&gt;, but not in general. For example, it's quite common to use windowing for each segment in Welch's or Bartlett's method to decrease the variance of the estimates. So in essence, with these methods, the motivation is in part the same, but different. Power is normalized in these methods by dividing out the window energy for example, instead of careful weighting of the window lags.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, hopefully this contextualizes windows and their origins, and why they are symmetric. If you're curious as to why one may chose an asymmetric window, consider the implications of the duality property of the Fourier transform, and what convolving your power spectral density estimate means for your application. Cheers.&lt;/p&gt;&#xA;" OwnerUserId="1279" LastActivityDate="2012-05-11T22:42:42.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2340" PostTypeId="1" AcceptedAnswerId="2344" CreationDate="2012-05-12T04:44:49.923" Score="10" ViewCount="6737" Body="&lt;p&gt;I have an $n \times n$ asymmetric convolution kernel, $k(t_1,t_2)$. $k$ is zero everywhere except for in small regions near the corners.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have an $n \times n$ image, $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $*$ denote circular convolution so that the convolution operator, $K(f) = k*f$, returns an $n \times n$ image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is a formula for the transpose of $K$? That is, the operator $K^T$ such that $\langle K(f) ,g \rangle = \langle f, K^T(g) \rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I worked it out to be $K^T(f) = k(-t_1,-t_2)*f$ but that is not holding up to my checks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%test how to make convolution transpose&#xA;&#xA;clear all;close all;clc;&#xA;&#xA;n = 1024;&#xA;&#xA;%my kernel, it is complex.&#xA;[t1 t2] = meshgrid(1:n,1:n);&#xA;k = fft2(exp(-t1/50).*exp(-t2/75));&#xA;&#xA;%convolution functions&#xA;convk = @(u) ifftn(fftn(k).*fftn(u));&#xA;rk = rot90(k);&#xA;convkt = @(u) ifftn(fftn(rk).*fftn(u));&#xA;&#xA;%my images&#xA;f = rand(n);&#xA;g = rand(n);&#xA;&#xA;trapz(trapz(convk(f).*g)) %&amp;lt;Kf,g&amp;gt;&#xA;trapz(trapz(f.*convkt(g))) %&amp;lt;f,Kg&amp;gt;, not the same as the above line...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;edit:&#xA;$$&#xD;&#xA;\langle k*f,g \rangle = \int_{x,y}g(x,y) \int_{t_1,t_2} k(x - t_1, y-t_2)f(t_1,t_2) dt_1dt_2dxdy&#xD;&#xA;$$&#xA;$$&#xD;&#xA;= \int_{t_1,t_2}f(t_1,t_2) \int_{x,y} k(x - t_1, y-t_2)g(x,y) dxdydt_1t_2&#xD;&#xA;$$&#xA;$$&#xD;&#xA;= \langle f, k(-1)*g \rangle&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit:&#xA;Ok I got it now. There was an off-by-one error. You can see this by examining the (square) circular convolution matrix. This 1D example explains how to do it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 256;&#xA;&#xA;%convolution kernel&#xA;k = randn(n,1) + 1j*rand(n,1);&#xA;&#xA;%circular convolution matrix&#xA;K = zeros(n);&#xA;for j=1:n&#xA;    K(:,j) = circshift(k,j-1);&#xA;end&#xA;&#xA;%circular convolution fft-based function&#xA;convk = @(u) ifft(fft(k).*fft(u));&#xA;&#xA;%the transpose of circular convolution, time-reversed complex-conjugated&#xA;%shifted-by-one kernel.&#xA;kt = circshift(flipud(k),1);&#xA;convkt = @(u) ifft(conj(fft(k)).*fft(u));&#xA;&#xA;%test that they are the same thing&#xA;x = randi(100,[n 1]) + 1j*randn(n,1);&#xA;y = randn(n,1) + 1j*rand(n,1);&#xA;fprintf('The right matrix for K? : %d \n', norm(K*x - convk(x)));&#xA;fprintf('The right matrix for Kt? : %d \n', norm(K'*x - convkt(x)));&#xA;fprintf('The dot product test : %d \n', dot(convk(x),y) - dot(x,convkt(y)));&#xA;fprintf('The dot product test : %d \n', dot(x,convk(y)) - dot(convkt(x),y));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The right matrix for K? : 5.246206e-11 &#xA;The right matrix for Kt? : 3.582131e-11 &#xA;The dot product test : 3.492460e-10 &#xA;The dot product test : 9.313226e-10 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;edit: For 2D, I think I've got it right but I'm seeing errors around $10^{-8}$. I want to just blame round-off since if anything changes in the below code I get gigantic errors.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;close all;clc;&#xA;&#xA;%nxn array&#xA;n = 256;&#xA;&#xA;%make convolution kernel&#xA;[t1 t2] = meshgrid(1:n,1:n);&#xA;k = fft2(exp(-t1/50).*exp(-t2/75));&#xA;&#xA;%circular convolution fft-based function&#xA;convk = @(u) ifftn(fftn(k).*fftn(u));&#xA;&#xA;%the transpose of circular convolution, time-reversed complex-conjugated&#xA;%shifted-by-one kernel.&#xA;kt = rot90(k,2);&#xA;kt = conj(kt);&#xA;kt = circshift(kt,[1 1]);&#xA;convkt = @(u) ifftn(fftn(kt).*fftn(u));&#xA;&#xA;%test that they are the same thing&#xA;x = rand(size(k)) + 1j*randn(size(k));&#xA;y = randn(size(k)) + 1j*rand(size(k));&#xA;&#xA;%check the output error&#xA;fprintf('The dot product test : %d \n', sum(sum(conj(convk(x)).*y)) - sum(sum(conj(x).*convkt(y))) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;edit: Oops, I should be looking at relative error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;abs(sum(sum(conj(convk(x)).*y)) - sum(sum(conj(x).*convkt(y))))/sum(sum(conj(convk(x)).*y))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is close to machine precision.&lt;/p&gt;&#xA;" OwnerUserId="1363" LastEditorUserId="37293" LastEditDate="2020-09-15T10:33:54.630" LastActivityDate="2020-09-15T10:33:54.630" Title="Meaning of the Transpose of Convolution" Tags="|image-processing|discrete-signals|convolution|cross-correlation|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2341" PostTypeId="1" AcceptedAnswerId="2342" CreationDate="2012-05-12T19:02:02.287" Score="12" ViewCount="16150" Body="&lt;p&gt;What 'exactly' is power spectral density for discrete signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was always under the assumption that taking the Fourier transform of the signal, and then the ratio of desired frequency range magnitude over the entire frequency range gives the power ratio for that frequency range which is the same as power spectral density. Is that wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading a student paper got me confused as it says to compute PSD and then 'absolute and relative spectral powers in desired bands' as well. Are they different? If yes, how does one compute it?&lt;/p&gt;&#xA;" OwnerUserId="73" LastEditorUserId="207" LastEditDate="2020-04-01T18:09:38.167" LastActivityDate="2020-04-01T18:09:38.167" Title="Difference between power spectral density, spectral power and power ratios" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2342" PostTypeId="2" ParentId="2341" CreationDate="2012-05-12T22:49:03.290" Score="12" Body="&lt;p&gt;I have no idea what your calculation of power spectral density gives since&#xA;I cannot understand it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a signal $x(t)$ has Fourier transform $X(f)$, its power spectral density&#xA;is $|X(f)|^2 = S_X(f)$.  The absolute spectral power in the band of frequencies from $f_0$ Hz to $f_1$ Hz is &#xA;the total power in that band of frequencies, that is, the total power &#xA;delivered at the output of an &lt;em&gt;ideal&lt;/em&gt; (unit gain) bandpass filter&#xA;that passes all frequencies from $f_0$ Hz to $f_1$ Hz and stops everything&#xA;else.  Thus,&#xA;$$\text{Absolute Spectral Power in Band} &#xD;&#xA;= \int_{-f_1}^{-f_0} S_X(f)\,\mathrm df + \int_{f_0}^{f_1} S_X(f)\,\mathrm df.$$&#xA;The relative spectral power measures the ratio of the total power in the band &#xA;(i.e., absolute spectral power)&#xA;to the total power in the signal.  Thus,&#xA;$$\text{Relative Spectral Power in Band} &#xD;&#xA;=  \frac{\displaystyle\int_{-f_1}^{-f_0} S_X(f)\,\mathrm df &#xD;&#xA;+ \int_{f_0}^{f_1} S_X(f)\,\mathrm df}{\displaystyle\int_{-\infty}^{\infty} S_X(f)\,\mathrm df}.$$&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-05-13T01:41:37.380" LastActivityDate="2012-05-13T01:41:37.380" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2343" PostTypeId="2" ParentId="2272" CreationDate="2012-05-13T00:36:47.023" Score="4" Body="&lt;p&gt;I don't think using a window function is a good way to remove DC. As endolith mentioned, a common method is just to subtract the mean before windowing. Another option would be to apply a high-pass filter to your signal prior to analysis, say, with a cutoff frequency of around 10 Hz.&lt;/p&gt;&#xA;" OwnerUserId="392" LastActivityDate="2012-05-13T00:36:47.023" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2344" PostTypeId="2" ParentId="2340" CreationDate="2012-05-13T12:35:26.893" Score="14" Body="&lt;p&gt;The transpose (or more generally, the Hermitian or conjugate transpose) of a filter is simply the &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;matched filter&lt;/em&gt;&lt;/a&gt;. This is found by time reversing the kernel and taking the conjugate of all the values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sepwww.stanford.edu/sep/prof/pvi.pdf#page=119&quot; rel=&quot;noreferrer&quot;&gt;Chapter 5 of Jon F. Claerbout - Earth Soundings Analysis: Processing versus Inversion&lt;/a&gt; has a great discussion of the topic of Adjoint operators (or transpose, or back projection, or matched filtering). It's in the context of Seismic imaging, but it really gets to the heart of what you're &lt;em&gt;actually&lt;/em&gt; trying to do (in general) with these techniques.&lt;/p&gt;&#xA;" OwnerUserId="1263" LastEditorUserId="128" LastEditDate="2020-03-14T09:54:40.067" LastActivityDate="2020-03-14T09:54:40.067" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2345" PostTypeId="2" ParentId="2247" CreationDate="2012-05-13T13:07:42.227" Score="4" Body="&lt;p&gt;There are several methods that talk about Shadow detection essentially work against known background. There is no absolute notion of what is &lt;em&gt;shadow&lt;/em&gt; just by looking at a pixel color. However, you need to identify shadow without reference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this problem is hard, here is a trivial solution - though readily this might not be the best one, but nevertheless it might help you gain some perspective. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's examine the image components in HSL domain &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JbiPm.jpg&quot; alt=&quot;Hue&quot;&gt; is Hue Component,&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8HFsW.jpg&quot; alt=&quot;Saturation&quot;&gt; is Saturation Component, and &#xA;&lt;img src=&quot;https://i.stack.imgur.com/gdFNG.jpg&quot; alt=&quot;Lightness&quot;&gt; is Lightness Component&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is well known that Lightness closely corresponds to the gray equivalent of the image and also that Shadow is essentially &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a semi-transparent region in which the scene reﬂectance undergoes a&#xA;  local attenuation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;http://users.cs.cf.ac.uk/Paul.Rosin/resources/papers/shadows.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, it is an overlay which decreases the reflectance said darkness &#xA;you can identify the same in the gray part of the image - but you will find it's interplay much less in the color parts (Hue and in saturation to somewhat). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, here, i am able to produce two images - where &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In this first image we have removed Lightness component (replaced with a fixed average value)&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/F59dI.jpg&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the second image we have removed Saturation component in the same way&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sGQUX.jpg&quot; alt=&quot;Saturation Removed&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We can see that even if lightness is preserved but saturation is removed, the critical information about shadow is intact - where as when we removed lightness the shadow information is significantly dropped. Though this is not perfect, it makes a key feature that allows you to distinguish what is truly a shadow is from the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on this, you can treat the &quot;Lightness removed&quot; image as a background and other one as the incident image and segment the image based on this two information; So in the regions where shadow is not playing a major role, the difference could be much less, where as when shadow exists that segment will show high error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you can just apply independent segmentation (such as region growing) on both image. The saturation-removed image will have additional segment which won't exist in the lightness-removed image which is nothing but a shadow segment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: You can you can distinguish HSL-lightness-removed image with original itself. Also try the similar things with HSV color space as well as YCbCr. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-05-13T13:07:42.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2346" PostTypeId="2" ParentId="2333" CreationDate="2012-05-13T13:44:37.280" Score="0" Body="&lt;p&gt;Here is a &lt;a href=&quot;http://computer.yourdictionary.com/chroma-subsampling&quot; rel=&quot;nofollow&quot;&gt;quick reference&lt;/a&gt; that shows difference between various chroma formats - 4:2:0, 4:2:2 etc. As can be seen that in both cases, chroma samples are not &lt;em&gt;aligned&lt;/em&gt; with the luma samples. Hence, for proper pixels reproduction filtering is required before the display can be applied. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably one of the best source to look at is the &lt;a href=&quot;http://www.mpeg.org/MPEG/video/mssg-free-mpeg-software.html&quot; rel=&quot;nofollow&quot;&gt;MSSG (MPEG software simulation group)&lt;/a&gt; which is an official reference code base for MPEG 1 &amp;amp; 2 encoding and decoding. If you look at the code, you will realize the conversion from the 4:2:0 to 4:4:4 is done in two steps i.e. 4:2:0 to 4:2:2 and then 4:2:2 to 4:4:4 (horizontal). It uses 5 stage poly phase FIR filter which you can sneak into the code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the standard doesn't really specify which filter should be applied.&#xA;&lt;a href=&quot;http://www.glennchan.info/articles/technical/chroma/chroma1.htm&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is one of the best reference that describes the effect of different filtering and provides further references as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accordingly, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In practice, chroma subsampling artifacts for 4:2:2 and progressive&#xA;  4:2:0 formats are rarely noticed even where it is poorly implemented&#xA;  (e.g. with nearest neighbour or box resampling). In particular, 4:2:2&#xA;  is commonly referred to (and sometimes marketed) as “visually&#xA;  lossless”, even though it is not actually visually lossless in all&#xA;  circumstances (e.g. red text on a black background) [6]. But while&#xA;  chroma subsampling is not entirely visually lossless, it seems to be&#xA;  good enough that many people do not notice otherwise.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;... &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;On the other hand, 4:1:1 and interlaced 4:2:0 formats can be&#xA;  problematic as they effectively subsample the chroma by 4X in one&#xA;  direction (interlaced 4:2:0 effectively subsamples 4X vertically since&#xA;  each interlaced field is subsampled individually). &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-05-13T13:44:37.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2347" PostTypeId="1" CreationDate="2012-05-13T15:00:58.177" Score="33" ViewCount="46211" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#The_Kalman_filter&quot;&gt;Kalman filter algorithm&lt;/a&gt; works as follows&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Initialize $ \hat{\textbf{x}}_{0|0}$ and $\textbf{P}_{0|0}$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;At each iteration $k=1,\dots,n$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Predict&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Predicted (a priori) state estimate    $$ \hat{\textbf{x}}_{k|k-1} =&#xD;&#xA; \textbf{F}_{k}\hat{\textbf{x}}_{k-1|k-1} + \textbf{B}_{k}&#xD;&#xA; \textbf{u}_{k} $$ &#xA;    Predicted (a priori) estimate covariance $$	&#xD;&#xA; \textbf{P}_{k|k-1} = \textbf{F}_{k} \textbf{P}_{k-1|k-1}&#xD;&#xA; \textbf{F}_{k}^{\text{T}} + \textbf{Q}_{k}$$&#xA;  &lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Innovation or measurement residual     $$ \tilde{\textbf{y}}_k =&#xD;&#xA; \textbf{z}_k - \textbf{H}_k\hat{\textbf{x}}_{k|k-1}$$ Innovation (or&#xA;  residual) covariance   $$\textbf{S}_k = \textbf{H}_k&#xD;&#xA; \textbf{P}_{k|k-1} \textbf{H}_k^\text{T} + \textbf{R}_k$$ Optimal&#xA;  &lt;strong&gt;&lt;em&gt;Kalman gain&lt;/em&gt;&lt;/strong&gt;      $$\textbf{K}_k =&#xD;&#xA; \textbf{P}_{k|k-1}\textbf{H}_k^\text{T}\textbf{S}_k^{-1}$$ &#xA;    Updated (a posteriori) state estimate      $$\hat{\textbf{x}}_{k|k} =&#xD;&#xA; \hat{\textbf{x}}_{k|k-1} + \textbf{K}_k\tilde{\textbf{y}}_k$$ &#xA;    Updated (a posteriori) estimate covariance     $$\textbf{P}_{k|k} = (I -&#xD;&#xA; \textbf{K}_k \textbf{H}_k) \textbf{P}_{k|k-1}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Kalman gain $K_k$ represents the relative importance of the error $\tilde{\textbf{y}}_k$ with respect to the prior estimate $\hat{\textbf{x}}_{k|k-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder how to understand the formula for the Kalman gain $K_k$ &lt;em&gt;intuitively&lt;/em&gt;? Consider the case when the states and outputs being scalar, why is the gain bigger, when&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$\textbf{P}_{k|k-1}$ is bigger&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\textbf{H}_k$ is bigger&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\textbf{S}_k$ is smaller? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks and regards!&lt;/p&gt;&#xA;" OwnerUserId="203" LastActivityDate="2021-05-08T02:27:33.320" Title="How to understand Kalman gain intuitively?" Tags="|kalman-filters|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2348" PostTypeId="1" AcceptedAnswerId="2398" CreationDate="2012-05-13T15:46:07.340" Score="61" ViewCount="22432" Body="&lt;p&gt;What is the relationship, if any, between Kalman filtering and (repeated, if necessary) least squares polynomial regression?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="128" LastEditDate="2019-10-26T12:30:50.910" LastActivityDate="2021-02-23T06:03:54.710" Title="What Is the Relationship Between a Kalman Filter and Polynomial Regression?" Tags="|kalman-filters|least-squares|bayesian-estimation|" AnswerCount="6" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2349" PostTypeId="1" CreationDate="2012-05-13T19:42:42.257" Score="8" ViewCount="1757" Body="&lt;p&gt;I am developing a software emulation of an analog synthesizer.  I am trying to modulate the pitch of an oscillator using an LFO.  For each sample fed to the computer's sound system, I am calculating the frequency to be input into the main oscillator like this (pseudocode):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;osc_frequency = note_frequency * (1 + tuning) * (1 + lfo_y * lfo_mod_depth)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The variables in this statement are described as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;note_frequency = frequency of note to be played in Hz&lt;/li&gt;&#xA;&lt;li&gt;tuning = oscillator fine-tuning in percent of played pitch (ex: -0.02 = detune by 2%)&lt;/li&gt;&#xA;&lt;li&gt;lfo_y = current y value of lfo waveform (ranges from -1 to 1)&lt;/li&gt;&#xA;&lt;li&gt;lfo_mod_depth = depth/intensity of effect to apply to oscillator in percent&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, this computation does not yield the desired result.  I expect to hear the pitch modulate up and down, locked around the center frequency (note being played).  What I am getting is a modulation effect that causes the pitch to &quot;run away&quot;;  I can't tell exactly what is happening, but it sounds like one of these:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The modulation intensity increases over time (the high/low frequency mark reached by the modulation grows higher/lower the longer the note is held)&lt;/li&gt;&#xA;&lt;li&gt;While the modulation intensity remains constant over time, the center frequency increases while the modulation oscillates around it&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Am I using the correct approach or not?  If not, what should the correct approach be?  Any help with this is much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1367" LastActivityDate="2012-05-14T01:33:31.310" Title="Help with algorithm for modulating oscillator pitch using LFO" Tags="|audio|algorithms|software-implementation|modulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2350" PostTypeId="2" ParentId="2272" CreationDate="2012-05-13T20:07:58.010" Score="8" Body="&lt;p&gt;If you're concerned with doing spectral analysis on a signal with a large DC component, and you want to suppress that DC peak, then a window function is not what you want. As some other answers noted, a highpass filter (or, viewed differently, a notch filter with the notch at zero frequency) is an appropriate solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand why, you need to think about what applying a window function does to the frequency response of each DFT output. The DFT is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;X[k] = \sum_{n=0}^{N-1} x[n] e^{\frac{-j2 \pi n k}{N}}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One interpretation of how the DFT works is as a bank of filters at $N$ equally-spaced frequencies between $-\frac{f_s}{2}$ and $\frac{f_s}{2}$. Recast the sum above as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;X[k] = \sum_{n=0}^{N-1} x_k[n]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;x_k[n] = x[n] e^{\frac{-j2 \pi n k}{N}}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the $k$-th DFT output is generated by first taking the input signal $x[n]$ and multiplying it by a complex exponential at frequency $\frac{-2\pi k}{N}$ to yield a downconverted signal $x_k[n]$. The resulting signal is then summed over the $N$-sample window to yield the DFT output $X[k]$. This is effectively a moving average filter (sometimes called a boxcar filter), whose impulse response can be described as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;b[n] = &#xD;&#xA;\begin{cases} &#xD;&#xA;1,\ x = 0, 1, \ldots , N-1 \\&#xD;&#xA;0,\ \text{otherwise}&#xD;&#xA;\end{cases}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitude response of the boxcar filter can be found by taking the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_time_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;discrete-time Fourier transform (DTFT)&lt;/a&gt; of that impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;|H(f)| = \left|\frac{\sin\left(N \pi\frac{f}{f_s}\right)}{\sin\left(\pi\frac{f}{f_s}\right)}\right|&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirichlet_kernel&quot; rel=&quot;noreferrer&quot;&gt;Dirichlet kernel&lt;/a&gt;, and is sometimes referred to as a &quot;periodic sinc&quot; since it looks a bit like a sinc function but repeats periodically, which a sinc does not. This expression gives the magnitude response of each DFT output, where $f$ is measured as the frequency offset from the center frequency of the respective output bin. This illustrates the &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot; rel=&quot;noreferrer&quot;&gt;spectral leakage&lt;/a&gt; effect; each DFT output has a frequency response that covers some continuous swath of the input signal's spectrum, not just the discrete center frequency of each output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider how things change if you apply a window function to the input signal $x[n]$ before performing the DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\begin{align*}&#xD;&#xA;X[k] &amp;amp;= \sum_{n=0}^{N-1} w[n] x[n] e^{\frac{-j2 \pi n k}{N}} \\&#xD;&#xA;&amp;amp;= \sum_{n=0}^{N-1} w[n] x_k[n]&#xD;&#xA;\end{align*}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the window function in place, the downconverted $x_k[n]$ is effectively passing through an FIR filter with an impulse response described by the window function. So, the per-output magnitude response of the DFT is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;|H(f)| = |W(f)|&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $W(f)$ the DTFT of the window function $w[n]$. Now note that if you chose a window function that had a zero at DC and used it to premultiply $x[n]$ before the DFT, you would actually cause the unintended effect of nulling out not only DC in the resulting spectrum, but the center frequencies of every one of the DFT outputs. &lt;strong&gt;This is probably not what you want.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you truly just want to cancel the signal's DC component, removing it via some other type of pre-processing, not time-domain windowing, is the way to go. You could use a linear highpass filter with a very low cutoff frequency or subtract the estimated mean from the signal first, for example. Choosing between these methods should be based upon what other constraints your system has.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-05-15T12:26:07.800" LastActivityDate="2012-05-15T12:26:07.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2351" PostTypeId="2" ParentId="2349" CreationDate="2012-05-14T01:33:31.310" Score="7" Body="&lt;p&gt;As said by Jason, this might simply be that you are not implementing your oscillator correctly - for example by multiplying the frequency by time instead of integrating it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also - and this is unrelated to your topic but really worth observing - that your formula for frequency modulation implements a behavior very different to that of most synthesizers, and will sound uncanny to a musician.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;strong&gt;lfo_y&lt;/strong&gt; oscillates between -1 and 1 ; &lt;strong&gt;lfo_mod_depth&lt;/strong&gt; is 0.5 ; and if &lt;strong&gt;note_frequency&lt;/strong&gt; is equal to 220 Hz, &lt;strong&gt;osc_frequency&lt;/strong&gt; will sweep between 110 and 330 - that is to say between -1 octave and +1 fifth around the note. So the pitch modulation will appear to be centered in the hertz scale, but will not be centered in the perceptual musical scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct behaviour is to have something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;osc_frequency = note_frequency * 2 ** (tuning / 1200.0 + lfo_y * lfo_mod_depth)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;tuning is expressed in &lt;strong&gt;cents&lt;/strong&gt;, a musically relevant unit (100&#xA;cents = 1 semitone).&lt;/li&gt;&#xA;&lt;li&gt;your pitch modulation is &quot;musically centered&quot;,&#xA;and lfo_mod_depth is expressed in &lt;strong&gt;octaves&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is called &quot;exponential FM&quot;, and this is the norm on synthesizers. On analog synthesizers, this is implemented by summing the LFO signal to the CV that hits the exponential converter of the VCO. On digital synthesizers, this is implemented by applying the modulations on a high-resolution internal representation of pitch which is still on a musical scale - before converting to a frequency or a phase increment.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-05-14T01:33:31.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2352" PostTypeId="1" CreationDate="2012-05-14T03:45:29.947" Score="9" ViewCount="1974" Body="&lt;p&gt;I have two spectra of the same astronomical object. The essential question is this: How can I calculate the relative shift between these spectra and get an accurate error on that shift?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more details if you are still with me. Each spectrum will be an array with an x value (wavelength), y value (flux), and error. &lt;strong&gt;The wavelength shift is going to be sub-pixel.&lt;/strong&gt; Assume that the pixels are regularly spaced and that there is only going to be a single wavelength shift applied to the entire spectrum. So the end answer will be something like: 0.35 +/- 0.25 pixels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two spectra are going to be a lot of featureless continuum punctuated by some rather complicated absorption features (dips) that do not model easily (and are not periodic). I'd like to find a method that directly compares the two spectra. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everyone's first instinct is to do a cross-correlation, but with subpixel shifts, you're going to have to interpolate between the spectra (by smoothing first?) -- also, errors seem nasty to get right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current approach is to smooth the data by convolving with a gaussian kernel, then to spline the smoothed result, and compare the two splined spectra -- but I don't trust it (especially the errors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a way to do this properly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a short python program that will produce two toy spectra that are shifted by 0.4 pixels (written out in toy1.ascii and toy2.ascii) that you can play with. Even though this toy model uses a simple gaussian feature, assume that the actual data cannot be fit with a simple model. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import random as ra&#xA;import scipy.signal as ss&#xA;arraysize = 1000&#xA;fluxlevel = 100.0&#xA;noise = 2.0&#xA;signal_std = 15.0&#xA;signal_depth = 40.0&#xA;gaussian = lambda x: np.exp(-(mu-x)**2/ (2 * signal_std))&#xA;mu = 500.1&#xA;np.savetxt('toy1.ascii', zip(np.arange(arraysize), np.array([ra.normalvariate(fluxlevel, noise) for x in range(arraysize)] - gaussian(np.arange(arraysize)) * signal_depth), np.ones(arraysize) * noise))&#xA;mu = 500.5&#xA;np.savetxt('toy2.ascii', zip(np.arange(arraysize), np.array([ra.normalvariate(fluxlevel, noise) for x in range(arraysize)] - gaussian(np.arange(arraysize)) * signal_depth), np.ones(arraysize) * noise))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1366" LastActivityDate="2012-08-29T20:34:27.227" Title="Directly compare subpixel shifts between two spectra — and get believable errors" Tags="|sampling|cross-correlation|smoothing|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2353" PostTypeId="2" ParentId="2348" CreationDate="2012-05-14T05:53:16.657" Score="6" Body="&lt;p&gt;Not an expert on kalman filters, however I believe traditional &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot; rel=&quot;noreferrer&quot;&gt;Kalman&lt;/a&gt; filtering presumes a linear relationship between the observable data, and data you wish to infer, in contrast to more intricate ones like the &lt;a href=&quot;http://en.wikipedia.org/wiki/Extended_Kalman_filter&quot; rel=&quot;noreferrer&quot;&gt;Extended Kalman filters&lt;/a&gt; that can assume non-linear relationships.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that in mind, I believe that for a &lt;em&gt;traditional&lt;/em&gt; Kalman filter, on-line &lt;em&gt;linear&lt;/em&gt; regression, would be similar to Kalman in performance. However, a polynomial regression can also be used that would assume a non-linear relationship that a traditional Kalman might not be able to capture. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-05-14T05:53:16.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2354" PostTypeId="2" ParentId="2348" CreationDate="2012-05-14T07:00:40.397" Score="5" Body="&lt;p&gt;Kalman filtering gives multiple predictions for the next state, where an extrapolation of a regression would not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Kalman filters are also focused on including noise factors (based on Gaussian distributions).&lt;/p&gt;&#xA;" OwnerUserId="809" LastActivityDate="2012-05-14T07:00:40.397" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2356" PostTypeId="1" CreationDate="2012-05-14T17:00:10.907" Score="19" ViewCount="1604" Body="&lt;p&gt;I am currently learning about &lt;a href=&quot;http://en.wikipedia.org/wiki/Simple_linear_regression&quot;&gt;least-squares&lt;/a&gt; (and other) estimations for regression, and from what I am also reading in some adaptive algorithm literatures, often times the phrase &quot;... and since the error surface is convex...&quot; appears and any depth as to why it is convex to begin with is no where to be found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...So what exactly makes it &lt;a href=&quot;http://en.wikipedia.org/wiki/Convex_optimization&quot;&gt;convex&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find this repeated omission mildly annoying because I want to be able to design my own adaptive algorithms, with my own cost functions, but if I cannot tell whether or not my cost function yields a convex error surface or not, I wont be able to get too far in applying something like gradient descent because there wont be a global minimum. Maybe I want to get creative - maybe I do not want to use least-squares as my error criteria for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon digging deeper, (and my questions begin here), I found that in order to be able to tell if you have a convex error surface, you must make sure that your &lt;a href=&quot;http://en.wikipedia.org/wiki/Hessian_matrix&quot;&gt;Hessian matrix&lt;/a&gt; is positive semi-definite. For symmetric matricies, this test is simple - simply make sure all the eigenvalues of the Hessian matrix are non-negative. (If your matrix is not symmetric, you can make it symmetric by adding it to its own transpose and performing the same eigenvalue test, by virtue of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gram_matrix&quot;&gt;Gramian&lt;/a&gt;, but thats not important here). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is a Hessian matrix? The Hessian matrix codifies all the possible combination of the partials of your cost function. How many partials are there? As many as the number of features in your feature vector. How to compute the partials? Take the partial derivatives 'by hand' from the original cost function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that is exactly what I did: I assume that we have an $m$ x $n$ data matrix, denoted by the matrix $X$, where, $m$ denotes the number of examples, and $n$ denotes the number of features per example. (which will also be the number of partials). I suppose we can say that we have $m$ time samples and $n$ spatial samples from sensors, but the physical application is not too important here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, we also have a vector $y$ of size $m$ x $1$. (This is your 'label' vector, or your 'answer' corresponding to every row of $X$). For simplicity, I have assumed $m=n=2$ for this particular example. So 2 'examples' and 2 'features'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now suppose that you want to ascertain the 'line' or polynomial of best fit here. That is, you project your input data features against your polynomial co-efficient vector $\boldsymbol{\theta}$ such that your cost function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;J(\theta) = \frac{1}{2m} \sum_{i=1}^{m} \bigg[\theta_{0}x_{0}[i] + \theta_{1}x_{1}[i] - y[i]\bigg]^{2} &#xD;&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let us take the first partial derivative w.r.t $\theta_{0}$, (feature 0) Thus:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{\delta J(\theta)}{\delta\theta_0} = \frac{1}{m}\sum_{i=1}^{m} \bigg[\theta_{0}x_{0}[i] + \theta_{1}x_{1}[i] - y[i]\bigg] x_{0}[i]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{\delta J(\theta)}{\delta\theta_0} = \frac{1}{m}\sum_{i=1}^{m} \bigg[\theta_{0}x_{0}^{2}[i] + \theta_{1}x_{1}[i]x_{0}[i] - y[i]x_{0}[i]\bigg]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let us compute all the second partials, so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{\delta^{2} J(\theta)}{\delta\theta_0^{2}} = \frac{1}{m}\sum_{i=1}^{m} x_{0}^{2}[i] &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{\delta^{2} J(\theta)}{\delta\theta_0\theta_{1}} = \frac{1}{m}\sum_{i=1}^{m} x_{0}[i]x_{1}[i] &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{\delta^{2} J(\theta)}{\delta\theta_1\theta_{0}} = \frac{1}{m}\sum_{i=1}^{m} x_{1}[i]x_{0}[i] &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;\frac{\delta^{2} J(\theta)}{\delta\theta_1^{2}} = \frac{1}{m}\sum_{i=1}^{m} x_{1}^{2}[i] &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that the Hessian is nothing but:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;H(J(\theta)) = \begin{bmatrix} \frac{\delta^{2} J(\theta)}{\delta\theta_0^{2}} &amp;amp; \frac{\delta^{2} J(\theta)}{\delta\theta_0\theta_{1}} \\ \frac{\delta^{2} J(\theta)}{\delta\theta_1\theta_{0}} &amp;amp; \frac{\delta^{2} J(\theta)}{\delta\theta_1^{2}}\end{bmatrix} &#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;H(J(\theta)) = \begin{bmatrix} \frac{1}{m}\sum_{i=1}^{m} x_{0}^{2}[i] &amp;amp; \frac{1}{m}\sum_{i=1}^{m} x_{0}[i]x_{1}[i] \\ \frac{1}{m}\sum_{i=1}^{m} x_{1}[i]x_{0}[i] &amp;amp; \frac{1}{m}\sum_{i=1}^{m} x_{1}^{2}[i]  \end{bmatrix}&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, based on how I have constructed the data matrix $X$, (my 'features' go by columns, and my examples go by rows), the Hessian &lt;em&gt;appears&lt;/em&gt; to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;H(J(\theta)) = X^{T}X = \Sigma&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...which is nothing but the &lt;a href=&quot;http://en.wikipedia.org/wiki/Sample_mean_and_covariance&quot;&gt;sample covariance matrix&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am not quite sure how to interpret - or I should say, I am not quite sure how generalizing I should be here. But I think I can say that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Always true:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Hessian matrix always controls whether or not your error/cost surface is convex. &lt;/li&gt;&#xA;&lt;li&gt;If you Hessian matrix is pos-semi-def, you are convex, (and can happily use algorithms   like gradient descent to converge to the optimal solution).&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;True for LSE only:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Hessian matrix for the LSE cost criterion is nothing but the original covariance matrix. (!). &lt;/li&gt;&#xA;&lt;li&gt;To me this means that, if I use LSE criterion, the &lt;em&gt;data itself&lt;/em&gt; determines whether or not I have a convex surface? ... Which would then mean that the eigenvectors of my covariance matrix somehow have the capability to 'shape' the cost surface? Is this always true? Or did it just work out for the LSE criteria? It just doesnt sit right with me that the convexity of an error surface should be dependent on the data. &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So putting it back in the context of the original question, how does one determine whether or not an error surfance (based on some cost function you select) is convex or not? Is this determination based on the data, or the Hessian? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TLDR:&lt;/strong&gt; How, &lt;em&gt;exactly, and practically&lt;/em&gt; do I go about determining whether my cost-function and/or data-set yield a convex or non-convex error surface?&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="128" LastEditDate="2018-07-07T22:28:34.970" LastActivityDate="2022-05-08T20:41:15.773" Title="What Does Make an Error Surface Convex? Is It Determined by the Covarinace Matrix or the Hessian?" Tags="|autocorrelation|covariance|least-squares|optimization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2357" PostTypeId="2" ParentId="2352" CreationDate="2012-05-14T18:10:07.440" Score="5" Body="&lt;p&gt;I think using cross-correlation and interpolating the peak would work fine.  As described in &lt;a href=&quot;https://dsp.stackexchange.com/q/2321/29&quot;&gt;Is up-sampling prior to cross-correlation useless?&lt;/a&gt;, interpolating or upsampling before the cross-correlation doesn't actually get you any more information.  The information about the sub-sample peak is contained in the samples around it. You just need to extract it with minimal error.  I gathered some notes &lt;a href=&quot;https://gist.github.com/255291#file_parabolic.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest method is quadratic/parabolic interpolation, which I have a Python example of &lt;a href=&quot;https://gist.github.com/255291#file_parabolic.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.  It's supposedly exact &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;if your spectrum is based on a Gaussian window&lt;/a&gt;, or if the peak happens to fall exactly on the midpoint between samples, but &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Bias_Parabolic_Peak_Interpolation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;otherwise has some error&lt;/a&gt;.  So in your case you probably want to use something better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dspguru.com/dsp/howtos/how-to-interpolate-fft-peak&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here is a list&lt;/a&gt; of more complicated, but more accurate estimators.  &quot;Of the above methods, Quinn's second estimator has the least RMS error.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know the math, but &lt;a href=&quot;http://ems.music.uiuc.edu/beaucham/papers/JASA.04.94.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; says that their parabolic interpolation has theoretical accuracy of 5% of the width of an FFT bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using FFT interpolation on the cross-correlation output &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Bias_Parabolic_Peak_Interpolation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;does not have any bias error&lt;/a&gt;, so that's the best if you want really good accuracy.  If you need to balance accuracy and computation speed, it's recommended to do some FFT interpolation and then follow it with one of the other estimators to get a &quot;good enough&quot; result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This just uses the parabolic fit, but it outputs the right value for the offset if the noise is low:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def parabolic_polyfit(f, x, n):&#xA;    a, b, c = polyfit(arange(x-n//2, x+n//2+1), f[x-n//2:x+n//2+1], 2)&#xA;    xv = -0.5 * b/a&#xA;    yv = a * xv**2 + b * xv + c&#xA;&#xA;    return (xv, yv)&#xA;&#xA;arraysize = 1001&#xA;fluxlevel = 100.0&#xA;noise = 0.3 # 2.0 is too noisy for sub-sample accuracy&#xA;signal_std = 15.0&#xA;signal_depth = 40.0&#xA;gaussian = lambda x: np.exp(-(mu-x)**2/ (2 * signal_std))&#xA;mu = 500.1&#xA;a_flux = np.array([ra.normalvariate(fluxlevel, noise) for x in range(arraysize)] - gaussian(np.arange(arraysize)) * signal_depth)&#xA;mu = 500.8&#xA;b_flux = np.array([ra.normalvariate(fluxlevel, noise) for x in range(arraysize)] - gaussian(np.arange(arraysize)) * signal_depth)&#xA;&#xA;a_flux -= np.mean(a_flux)&#xA;b_flux -= np.mean(b_flux)&#xA;&#xA;corr = ss.fftconvolve(b_flux, a_flux[::-1])&#xA;&#xA;peak = np.argmax(corr)&#xA;px, py = parabolic_polyfit(corr, peak, 13)&#xA;&#xA;px = px - (len(a_flux) - 1)&#xA;print px&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kOMjP.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/w9yZ2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The noise in your sample produces results that vary by more than a whole sample, so I reduced it.  Fitting the curve using more of the points of the peak helps tighten the estimate somewhat, but I'm not sure if that's statistically valid, and it actually makes the estimate worse for the lower-noise situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With noise = 0.2 and 3-point fit, it gives values like 0.398 and 0.402 for offset = 0.4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With noise = 2.0 and 13-point fit, it gives values like 0.156 and 0.595 for offset = 0.4.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-08-29T20:34:27.227" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2358" PostTypeId="2" ParentId="2356" CreationDate="2012-05-14T19:00:52.337" Score="8" Body="&lt;p&gt;You can think of linear-least squares in single dimension. The cost function is something like $a^{2}$. The first derivative (Jacobian) is then $2a$, hence linear in $a$. The second derivative (Hessian) is $2$ - a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the second derivative is positive, you are dealing with convex cost function. This is eqivalent to positive definite Hessian matrix in multivariate calculus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You deal with just two variables ($\theta_{1}$, $\theta_{2}$) thus the Hessian is particularly simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, however, there are often many variables involved, so it is impractical to build and inspect Hessian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More efficient method is to work directly on the Jacobian matrix $J$ in the least-squares problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Jx=b$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$J$ can be rank-deficient, singular or near-singular. In such cases, the quadratic surface of the cost function is almost flat and/or wildly stretched in some direction. You can also find that your matrix is theoretically solvable, but the solution is numerically unstable. A method of &lt;em&gt;preconditioning&lt;/em&gt; can be used to cope with such cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some algorithms simple run a &lt;strong&gt;Cholesky decomposition&lt;/strong&gt; of $J$. If the algorithm fails, it means that $J$ is singular (or ill-conditioned).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Numerically more stable, but more expensive is a &lt;strong&gt;QR decomposition&lt;/strong&gt;, which also exists only if $J$ is regular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the state-of-the art method is a &lt;strong&gt;Singular Value Decomposition (SVD)&lt;/strong&gt;, which is most expensive, can be done on every matrix, reveals numerical rank of $J$ and allows you to treat rank-deficient cases separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote an article about linear and non-linear least squares solutions that covers these topics in detail:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://libca.cz/pub/libor/ls/ls.html&quot; rel=&quot;noreferrer&quot;&gt;Linear and Nonlinear Least-Squares with Math.NET&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also references to great books that deal with advanced topics related to least-squares (covariance in parameters/data points, preconditioning, scaling, orthogonal distance regression - total least-squares, determining precision and accuracy of the least-squares estimator etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have made a sample project for the article, which is open source:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://libca.cz/pub/libor/ls/ls-binary.zip&quot; rel=&quot;noreferrer&quot;&gt;LeastSquaresDemo - binary&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://libca.cz/pub/libor/ls/ls-source.zip&quot; rel=&quot;noreferrer&quot;&gt;LeastSquaresDemo - source (C#)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-05-15T21:16:51.660" LastActivityDate="2012-05-15T21:16:51.660" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2359" PostTypeId="1" CreationDate="2012-05-14T21:00:12.833" Score="10" ViewCount="934" Body="&lt;p&gt;I'm using a version of &quot;KISS FFT&quot; by Mark Borgerding.  It accepts an array of 16-bit fixed-point input values and produces a 32-bit float result array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've discovered that if the input amplitudes are low many of the float result values come out zero, but if I simply scale the inputs (by, say, the factor 16) then fewer output values are zero and therefore the output seems to contain more detail.  (Not that it matters much for my purposes, but for consistency I then divide the resulting float values by the same scaling factor.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, this seems to work, in terms of producing a result when previously I'd have just gotten a buffer of virtually all zeros, but I'm wondering if there's some reason it might not be a valid approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that this approach means that there's a lot more &quot;coarsness&quot;/granularity to the data, and, in particular, the low-level noise that would normally be present is not.  I'm almost wondering if it would be wise to inject some low-level noise to replace the zero values in the input.)&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-05-15T10:36:26.407" Title="Is it valid to increase amplitude (and presumably FFT quality) by simply scaling the data?" Tags="|fft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2360" PostTypeId="1" CreationDate="2012-05-14T21:48:31.910" Score="3" ViewCount="136" Body="&lt;p&gt;So lets say I have a transfer function for an FIR filter $H(z) = (z-a)...(z-n)$ where $a,...,n$ are points along the unit circle.  But what about other points along the unit circle that correspond to frequencies we want to leave alone?  Won't we end up multiplying these frequencies by random complex numbers? when we would really like them all to just be multiplied by one?&lt;/p&gt;&#xA;" OwnerUserId="1371" LastActivityDate="2012-05-15T13:06:19.677" Title="What do we know about the transfer function away from its zeros?" Tags="|transfer-function|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2361" PostTypeId="1" CreationDate="2012-05-15T00:01:28.983" Score="17" ViewCount="311" Body="&lt;p&gt;I'm trying to wrap my head around the proper use of a Wiener or error-prediction filter for filtering data. It seems to me that it is only a whitening filter, so how is it used when the data you want to recover isn't an AWGN signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, I have a signal that has several distint interfering signals - I can see them on a PSD, but I don't know that they are a) stationary and b) what properties they have. I can use a method like Yule-Walker equations to recover the AR model for the &lt;em&gt;whole&lt;/em&gt; signal, but in this case I only want to recover the model of the interfering signals, &lt;em&gt;not&lt;/em&gt; the portion I want to recover. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried implementing an adaptive LMS notch filter, with the reference signal being a single sinewave, but this turned out to me much too narrow and didn't track frequency changes in the signal very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess basically my question is this, if I'm using an error prediction filter to filter real data, then how do I separate the data portion from the noise portion? In other words, I don't want to whiten the whole signal, only the noise portion. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="461" LastActivityDate="2014-10-08T16:58:28.033" Title="Using an error prediction filter for filtering a semi-known signal" Tags="|adaptive-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2362" PostTypeId="2" ParentId="2360" CreationDate="2012-05-15T01:12:31.980" Score="5" Body="&lt;p&gt;The response of the filter at any frequency $\omega \in [-\pi, \pi)$ can be found by substituting $z = e^{-j\omega}$ (i.e. a position on the unit circle at an angle of $\omega$) into the transfer function. The resultant $H(e^{j\omega})$ is often referred to as a discrete-time system's frequency response. Most of the time, you're primarily concerned about the magnitude response of the system, so you will often see $|H(e^{j\omega)}|$ specifically considered in a system design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When designing a filter, there will often be a region of frequencies that you would like &quot;left alone;&quot; this is called the filter &lt;em&gt;passband&lt;/em&gt;. I wouldn't say that the presence of zeros elsewhere in the $z$-plane results in multiplying these frequencies by &lt;em&gt;random&lt;/em&gt; complex numbers; indeed, the response at any frequency is well-defined. Design methods for digital filters that have flat passbands will yield a transfer function whose zeros are carefully placed such that the filter response is approximately unity in those regions (assuming no filter gain). The amount of allowed deviation from this ideal response is a design parameter that you often have at your disposal to control the required complexity of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to more pointedly answer your question, if you know all of the zeros of an FIR filter, then you know &lt;strong&gt;everything&lt;/strong&gt; about its transfer function, at every point in the $z$-plane (and therefore everywhere on the unit circle).&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-05-15T13:06:19.677" LastActivityDate="2012-05-15T13:06:19.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2363" PostTypeId="2" ParentId="2359" CreationDate="2012-05-15T01:30:58.173" Score="7" Body="&lt;p&gt;This can be a valid approach. You're observing a very practical issue that arises often when using fixed-point (i.e. integer) arithmetic (although it can happen in floating-point also). When the numeric format that you're using to perform calculations doesn't have enough precision to express the full range of values that can arise from your calculations, some form of rounding is required (e.g. truncation, round-to-nearest, and so on). This is often modeled as an additive &lt;em&gt;quantization error&lt;/em&gt; to your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for some combinations of algorithm and rounding scheme, when the magnitude of the input signal is very low, it's possible to get what you observed: a large number of zero outputs. Basically, somewhere in the sequence of operations, the intermediate results are becoming small enough to not break the threshold required to quantize to a nonzero level. The value is then rounded to zero, which can often propagate forward to the output. The result is, as you noted, an algorithm that generates a lot of output zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can you get around this by scaling the data up? Sometimes (there are very few techniques that work all the time!). If your input signal is bounded in magnitude to a value below full-scale of the numeric format (16-bit signed integers run from -32768 to +32767), then you could scale the input signal up to more fully use the range available to it. This can help to mitigate the effects of roundoff error, as the magnitude of any roundoff error becomes smaller in comparison to the signal of interest. So, in the case where all of your outputs are getting rounded to zeros internally to the algorithm, this may help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When can such a technique hurt you? Depending upon the structure of the algorithm's calculations, scaling the input signal up might expose you to numeric overflows. Also, if the signal contains background noise or interference that is larger in magnitude than the algorithm's roundoff error, then the quality of what you get at the output is going to be typically limited by the environment, not error introduced in the computation.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-05-15T01:30:58.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2364" PostTypeId="2" ParentId="2255" CreationDate="2012-05-15T02:37:21.880" Score="2" Body="&lt;p&gt;The standard deviation $\sigma$ is itself the appropriate &lt;em&gt;linear&lt;/em&gt; scale for a Gaussian. For example, in 1D the Gaussian is $f[x,\sigma] = f[x/\sigma] \propto e^{-(x/\sigma)^2}$, i.e. $\sigma$ has the same units as $x$. As Arrigo notes, these units can be pixel-units. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2 in the exponent of $\sigma^2$ does not have anything to do with the dimensionality: it's the same in 1D or 2D (or nD).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use of a $t=\sigma^2$ to index the &quot;scale&quot; in &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale_space&quot; rel=&quot;nofollow&quot;&gt;scale-space&lt;/a&gt; is more for 1) mathematical convenience, and 2) connection to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale_space#Alternative_definition&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;time&lt;/em&gt;-scale of diffusion&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1187" LastActivityDate="2012-05-15T02:37:21.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2365" PostTypeId="2" ParentId="2360" CreationDate="2012-05-15T02:38:55.577" Score="1" Body="&lt;p&gt;It's an existence problem.  There exists no non-trivial linear time-invariant filter or transfer function that will &quot;leave alone&quot; any non-zero-size band of frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So either one deals with that characteristic of a linear system, or jumps into trying some non-linear or time-variable system which may be far less tractable and/or produce some really surprising weirdness for some inputs.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-15T05:33:54.017" LastActivityDate="2012-05-15T05:33:54.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2366" PostTypeId="2" ParentId="2359" CreationDate="2012-05-15T10:36:26.407" Score="1" Body="&lt;p&gt;The easiest and most fool proof way to deal with this is to convert the data to floating point BEFORE the FFT and use a floating point FFT. The only downside to this approach would be that you may consume more processor and memory. Since your output is floating point anyway, there is probably little practical difference.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-05-15T10:36:26.407" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2367" PostTypeId="1" CreationDate="2012-05-15T08:56:00.227" Score="14" ViewCount="1928" Body="&lt;p&gt;I have a little karaoke-style app where a user sings 4 lines of a song, with a one second gap between each line.  There is no backing music, so it's voice only, hopefully making the problem easier to solve.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for the most robust way to detect exactly where in my recording the user starts and ends singing line 1, starts and ends singing line 2, etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have cobbled together a simple-minded algorithm that works when there is very little background noise in the recording (like when does that happen?), but it falls to pieces in the presence of the smallest noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody point me towards something more robust?&lt;/p&gt;&#xA;" OwnerUserId="1374" OwnerDisplayName="Mike Hogan" LastEditorUserId="13320" LastEditDate="2018-06-10T10:51:30.740" LastActivityDate="2018-06-10T10:51:30.740" Title="Identify Where Singing Starts in a Voice Only Recording" Tags="|audio|signal-detection|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2368" PostTypeId="2" ParentId="2367" CreationDate="2012-05-15T09:07:11.597" Score="2" Body="&lt;p&gt;From my experience I would try looking into &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel-frequency_cepstrum&quot; rel=&quot;nofollow&quot;&gt;Mel-Frequency-Cepstrum-Coefficients (MFCCs)&lt;/a&gt;. MFCCs are fairly easy to implement if you have an FFT available and are used quite commonly in voice processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With MFCCs, you should be able to distinguish actual voice data from noise.&lt;/p&gt;&#xA;" OwnerDisplayName="LiKao" LastEditorUserId="29" LastEditDate="2012-05-15T14:01:04.637" LastActivityDate="2012-05-15T14:01:04.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2369" PostTypeId="1" AcceptedAnswerId="2372" CreationDate="2012-05-15T13:28:51.217" Score="9" ViewCount="5007" Body="&lt;p&gt;Beyond the raw equation for calculating mutual information, what does it mean in physical terms?&#xA;For example:&#xA;From Information Theory, we know that entropy is the smallest loss-less compression scheme that we can use on a alphabet with a specific probability distribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would that mean in terms of Mutual Information? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background: &#xA;I'm trying to calculate the mutual information of uni-gram words and determine which of two books did they come from. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;essential $$ I(book; word)$$&lt;/p&gt;&#xA;" OwnerUserId="1183" LastActivityDate="2012-05-17T14:44:05.430" Title="What is the meaning of Mutual Information beyond the numerical calculation?" Tags="|information-theory|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2370" PostTypeId="2" ParentId="2367" CreationDate="2012-05-15T14:00:25.650" Score="4" Body="&lt;p&gt;If the background noise is white-ish, you could measure &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;nofollow&quot;&gt;spectral flatness&lt;/a&gt; and consider it to be voice when the amplitude is above some threshold and the spectral flatness is below some threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you just take an FFT of a chunk of the signal, then divide the geometric mean of the magnitude of the spectrum by the arithmetic mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also use a band-pass filter to emphasize only the frequency regions where the human voice usually sits (as simple as setting the unwanted regions of the FFT to 0 before measuring the spectral flatness)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2012-05-15T14:00:25.650" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2371" PostTypeId="2" ParentId="2367" CreationDate="2012-05-15T14:53:37.097" Score="3" Body="&lt;p&gt;I have used spectral-flux in the past and it seems to work nicely. The basic idea is, create a spectrogram of your signal, across the bands you care about. Let us assume that your frequency is on the y-axis, and your time is on the x-axis, &lt;a href=&quot;http://en.wikipedia.org/wiki/File%3aDolphin1.jpg&quot; rel=&quot;nofollow&quot;&gt;like so&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that your spectrogram is a matrix. Each column represents the absolute value of the FFT of one snap-shot in time of your signal, and each row represents how energy from one band changes over time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, simply take the difference of columns. That is, take a column, and subtract from itself the column before it, and do for all columns. (Leaving the start columns alone obviously). Then sum across all the bands. That is, just sum all the rows together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will end up with a 1-D signal that codifies your signal &lt;em&gt;onsets&lt;/em&gt;. This will tell you where your voice starts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that you have detected onsets, if you want to detect the opposite, (that is, when a signal goes from having activity to none), the spectral flux actually gives you that information. Wherever you have an onset, you will have a positive peak, and wherever you have a 'deset' (for lack of a better word), you will have a negative peak. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would simply take the first positive peak, and the last negative peak, to mark the total start and stop times of my signal. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-05-29T16:19:03.250" LastActivityDate="2012-05-29T16:19:03.250" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="2372" PostTypeId="2" ParentId="2369" CreationDate="2012-05-15T14:57:55.283" Score="6" Body="&lt;p&gt;Mutual Information by definition relates two random variables (RV) and it measures the dependence between the two RVs from the information content perspective i.e. the measure of amount of information contained by one RV about the other RV. And Mutual information is a symmetric quantity, i.e., $I(X;Y) = I(Y; X)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of a communication channel, the maximum achievable capacity for the channel is the maximum of the mutual information between the channel input and the output $C = \max_{p(x)} I(X; Y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the two RVs $X$ and $Y$ would correspond to books and words. The mutual information would measure the amount of information common between a (book, word) pair. Obviously you'd associate the word to the book with which you have the maximum mutual information. This is the maximum mutual information approach.&lt;/p&gt;&#xA;" OwnerUserId="645" LastEditorUserId="645" LastEditDate="2012-05-15T16:04:03.200" LastActivityDate="2012-05-15T16:04:03.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2373" PostTypeId="1" CreationDate="2012-05-15T03:35:43.923" Score="9" ViewCount="2634" Body="&lt;p&gt;I am trying use the FFT in a different way then most people ask about. I want to be able to take a picture of a graph with regular repeating vertical lines, and to process the image to determine how far in pixels the lines are apart on average. I have tried canny edge detection and hough line detection and I don't think I can optimize the images enough to accurately detect only the lines I am interested in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my attempt is to scan 10 lines of the picture and to accumulate the pixel values into bins corresponding to the pixel column. What results when you graph it is a very nicely appearing waveform. When I perform a DFT or FFT on this, I can find a peak that I believe should be the frequency of the line repetition. (This may be a faulty assumption)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what does this number correspond to? i.e. I think I am confused with what my sampling rate would be because it is in pixels. I do think that this is a valid use of the FFT, but am falling right here at the point when i think I should be successful. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example. I created a picture that is 300 pixels in width. There are 1 pixel width lines drawn at exactly 30 pixel intervals. I found 2 peaks, one at 75 and one at 225 (which seem symmetrical) for the real component. (I do not believe that the imaginary component should play in??) I know the lines are 30 pixels apart. How does the 75 and or 225 relate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying really hard to get this, and I am grateful for any help you could recommend. At this point, I am giving up on edge detection, and want to try this approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance. &lt;/p&gt;&#xA;" OwnerDisplayName="justagruvn" LastActivityDate="2012-06-08T07:49:29.840" Title="FFT for line detection" Tags="|image-processing|opencv|fft|dft|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2374" PostTypeId="2" ParentId="2373" CreationDate="2012-05-15T16:12:08.853" Score="7" Body="&lt;p&gt;You might look at trying &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Autocorrelation&lt;/a&gt; for this. &lt;a href=&quot;https://stackoverflow.com/questions/3949324/calculate-autocorrelation-using-fft-in-matlab&quot;&gt;Here&lt;/a&gt; is an SO answer describing how to perform autocorrelation with Matlab using FFTs. This could be extended for two dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I implemented your test case in numpy as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = np.zeros(300)&#xA;a[::30] = 1&#xA;plt.acorr(a, maxlags=50)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives the following plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lahe4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the peaks pop up at +/- 30.&lt;/p&gt;&#xA;" OwnerUserId="1067" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-05-15T16:12:08.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2375" PostTypeId="2" ParentId="2367" CreationDate="2012-05-15T16:24:58.487" Score="2" Body="&lt;p&gt;&quot;&lt;a href=&quot;http://www.badlogicgames.com/wordpress/?p=161&quot; rel=&quot;nofollow&quot;&gt;Spectral flux&lt;/a&gt;&quot; (also referred to as &quot;spectral difference&quot;) is a common method for &quot;onset detection&quot;.  Basically you take sequential FFTs of the signal and sum the magnitudes of the differences of the FFT buckets from one sample to the next.  &quot;Onset&quot; will generally be represented by a substantial &quot;jump&quot; in this value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google &quot;onset detection&quot; for other ideas.&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-05-15T16:24:58.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2376" PostTypeId="1" AcceptedAnswerId="2380" CreationDate="2012-05-15T17:41:04.827" Score="8" ViewCount="3921" Body="&lt;p&gt;I'm trying to implement a modified version of the otsu binarization algorithm. I'm trying to binarize document images. But in the binarization procedure I want the object (in this case the text) to retain its original grayscale value while the background takes the value of 255; that is, white. I'm posting a sample image version that I found in a paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the original image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0fU4s.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the resultant image I want to obtain:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gyaFN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please tell me how to do it in Matlab? &lt;/p&gt;&#xA;" OwnerUserId="1173" LastEditorUserId="1059" LastEditDate="2012-05-15T20:13:10.823" LastActivityDate="2015-03-06T10:05:43.480" Title="Otsu binarization with value preservation" Tags="|image-processing|matlab|thresholding|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2377" PostTypeId="2" ParentId="2369" CreationDate="2012-05-15T17:51:12.317" Score="7" Body="&lt;p&gt;Two additional intuitive takes on mutual information:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;When two random variables are independent the joint distribution $p(x, y)$ and the product of the marginal distributions $p(x)$ and $p(y)$ are identical. One could thus assess the degree of independent between two random variables by computing a probabilistic distance between $p(x) \times p(y)$ and $p(x, y)$ - this distance being 0 when the two variables are independent. A common probabilistic distance between variable is the Kullback-Leibler divergence. If you take the Kullback-Leibler divergence between the joint distribution and the product of the marginals of two random variables, you end up with... mutual information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;From a compression / coding perspective, imagine you are given a sequence of $N$ pairs of observations $(x, y)$. You want to compress them into a file. Two strategies: storing all the (x) in one compressed file then independently all the (y) in another compressed file ; vs compressing the pairs. Using an optimal coder, the file size in the first case is $N \times H(X) + N \times H(Y)$, while in the second case the file size is $N \times H(X, Y)$. The second approach is more efficient if there's a relationship between the two observed variables! How many bits have we saved per observation? $\frac{N \times H(X) + N \times H(Y) - N \times H(X, Y)}{N} = I(X,Y)$! So mutual information tells us how many bit per observation do we save by coding two data streams jointly rather than independently.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am not sure about your example, though... Mutual information is computed between two random variables (distributions). I can see how &quot;book&quot; can represent the distribution of words in a book ; but I am not sure what &quot;word&quot; means here. Mutual information also requires &quot;paired&quot; observations to be computed.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-05-17T14:44:05.430" LastActivityDate="2012-05-17T14:44:05.430" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2378" PostTypeId="2" ParentId="2367" CreationDate="2012-05-15T18:18:21.700" Score="2" Body="&lt;p&gt;Using spectral flux alone may produce false positives for certain noises as well as detect a singing voice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Singing usually implies a signal content containing a pitch, so you could use a pitch detector or estimator (cepstrum, etc.).  You could sanity check the fraction of energy that is detected as pitched versus the total signal energy, and that the estimated pitch is within the human voice range.  That would reduce the false positive rate for unpitched noise as well as musical sounds outside the normal vocal range.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-17T22:14:45.800" LastActivityDate="2012-05-17T22:14:45.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2379" PostTypeId="2" ParentId="2373" CreationDate="2012-05-15T18:32:36.360" Score="4" Body="&lt;p&gt;If there are 10 vertical lines in your image, then an FFT of a full horizontal scan line (300 pix) should show some magnitude content around bin 10 or bin 11.  Bin 75 out of 300 would indicate something is happening every 4th pixel, or so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You really need to look at the magnitude of the FFT result, not just the &quot;real&quot; component (really the even component) because, if  your grid lines are off-centered, the spectral content could show up as odd (thus &quot;imaginary&quot; in the FFT result).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given real input to an FFT, the result bins above N/2 (above 150 in your case) just contain repeats of the same data except complex conjugated.  So you can ignore them.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-15T18:32:36.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2380" PostTypeId="2" ParentId="2376" CreationDate="2012-05-15T19:55:14.717" Score="8" Body="&lt;p&gt;I don't have Matlab handy, but here is how you do it in &lt;a href=&quot;http://opencv.willowgarage.com/wiki/&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV&lt;/a&gt;. The example below uses the python interface via &lt;a href=&quot;http://code.google.com/p/pythonxy/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python (x, y)&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;test = cv2.imread(&quot;test.jpg&quot;, 0)&#xA;(_, otsu) = cv2.threshold(test, 0.0, 255.0, cv2.THRESH_TOZERO_INV + cv2.THRESH_OTSU)&#xA;cv2.imshow('otsu', otsu)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in your required output:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Etad4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT :&lt;/strong&gt; I don't have a copy of Matlab, but I think this is how you would do it (assuming you have the Image Processing Toolbox):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use &lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/ref/graythresh.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;graythresh&lt;/a&gt; to get the Otsu level, then set anything above that level to white (or 255).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('doc.jpg');&#xA;I = rgb2gray(I);&#xA;otsuLevel = graythresh(I);&#xA;I(I &amp;gt; otsuLevel) = 255;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="1067" LastEditorUserId="1067" LastEditDate="2012-05-16T13:43:00.487" LastActivityDate="2012-05-16T13:43:00.487" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2381" PostTypeId="2" ParentId="2376" CreationDate="2012-05-15T20:10:29.033" Score="6" Body="&lt;p&gt;You can easily do it with Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = ColorNegate@ColorConvert[Import[&quot;../Desktop/sample.jpg&quot;], &quot;Grayscale&quot;]&#xA;ColorNegate@ImageMultiply[Binarize[img], img]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The negation and multiplication business is to ensure the preservation of the original grayscale value. You can easily translate this to any language, I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FJlUh.gif&quot; alt=&quot;Filtered result&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2012-05-15T20:21:57.723" LastActivityDate="2012-05-15T20:21:57.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2382" PostTypeId="1" CreationDate="2012-05-16T02:12:18.490" Score="10" ViewCount="2986" Body="&lt;p&gt;I have an RGB image with various signs. My main goal is to count the signs that are in contact with the image borders.&lt;/p&gt;&#xA;&lt;h2&gt;Approach and problem&lt;/h2&gt;&#xA;&lt;p&gt;I started by loading the image [Fig. 1], then converted it to grayscale and applied a median filter to get rid of some noise [Fig. 2]. Then I binarized it with a threshold of 0.2, which resulted in Figure 3. At this time I got my binarized image, but the problem is that some parts that belong to the same sign are appearing in various regions, instead of only one. Now my goal is to merge the regions that belong to the same object , so then I could use &lt;code&gt;bwlabel&lt;/code&gt; to count how many signs are in the image, and use &lt;code&gt;imclearborder&lt;/code&gt; to get rid of the ones in the border, and use &lt;code&gt;bwlabel&lt;/code&gt; again to get the difference between the two.&lt;/p&gt;&#xA;&lt;p&gt;My approach was to use &lt;code&gt;bwmorph&lt;/code&gt;, &lt;code&gt;Dilate&lt;/code&gt; to dilate the objects and then try to fill them with &lt;code&gt;imfill&lt;/code&gt;, &lt;code&gt;holes&lt;/code&gt;. But the problem is that if I dilate them in a small amount[Fig. 4], the &lt;code&gt;imfill&lt;/code&gt; doesn't seem to fill them, if I dilate them by a big amount[Fig 5] all the objects start to merge :(&lt;/p&gt;&#xA;&lt;h1&gt;Code&lt;/h1&gt;&#xA;&lt;pre&gt;&lt;code&gt;img=im2double(imread('image.png')); figure, imshow(img) &#xA;img_gray=rgb2gray(img); imshow(img_gray);                                 &#xA;img_mediana=medfilt2(img_gray, [3 3]); figure, imshow(img_mediana);       &#xA;img_bin=im2bw(img_mediana, 0.2); imshow(img_bin)&#xA;img_dilate=bwmorph(img_bin, 'Dilate', 10); imshow(img_dilate)&#xA;img_fill=imfill(img_dilate, 'Holes'); figure, imshow(img_fill)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1&gt;Figures&lt;/h1&gt;&#xA;&lt;p&gt;&lt;strong&gt;Fig 1&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/5272012/1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fig 1 http://dl.dropbox.com/u/5272012/1.png&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Fig 2&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/5272012/2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;fig 2 http://dl.dropbox.com/u/5272012/2.png&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Fig 3&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/5272012/3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;fig 3 http://dl.dropbox.com/u/5272012/3.png&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Fig 4&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/5272012/4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;fig 4 http://dl.dropbox.com/u/5272012/4.png&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Fig 5&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/5272012/5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;fig 5 http://dl.dropbox.com/u/5272012/5.png&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1375" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-06-07T20:48:00.643" Title="Counting the number of objects intersected by the image border in MATLAB" Tags="|matlab|image-segmentation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2384" PostTypeId="1" AcceptedAnswerId="2388" CreationDate="2012-05-16T04:19:57.100" Score="2" ViewCount="4365" Body="&lt;p&gt;Can anyone please help me understand the 2D equation of DCT?I find it hard to understand it in terms of how to apply the equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if I have an 8x8 image and I will apply 2D-DCT to every block of that image where will I start the application from left to right, top to bottom, or after left to right, top to bottom next.???  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help would be appreciated&lt;/p&gt;&#xA;" OwnerUserId="1377" LastActivityDate="2012-05-16T13:41:59.817" Title="How to compute Discrete Cosine Transform" Tags="|image-processing|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2386" PostTypeId="1" AcceptedAnswerId="2390" CreationDate="2012-05-16T09:32:05.903" Score="21" ViewCount="29566" Body="&lt;p&gt;As follow up to my &lt;a href=&quot;https://dsp.stackexchange.com/questions/1522/simplest-way-of-detecting-where-audio-envelopes-start-and-stop&quot;&gt;previous question&lt;/a&gt; I was wondering if there are any speech detection libraries in existence. By speech detection I mean passing in an audio buffer and getting back an index of where speech starts and stops. So if I have 10 seconds of audio sampling at 44kHz, I would expect an array of numbers such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;44000&#xA;88000&#xA;123000&#xA;190334&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would indicate for example that speech starts one second in and then finishes at the two second point, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm &lt;strong&gt;not&lt;/strong&gt; looking for is speech recognition which writes out text from spoken word. This unfortunately is what I see a lot of when I google 'speech detection'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be great if the library was in C, C++ or even Objective-C as I'm writing an app for the iPhone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="893" LastEditorUserId="13320" LastEditDate="2018-06-10T10:51:21.337" LastActivityDate="2019-08-27T16:29:31.990" Title="Libraries for Voice Activity Detection (Not Speech Recognition)" Tags="|audio|speech|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2387" PostTypeId="2" ParentId="2386" CreationDate="2012-05-16T11:23:20.693" Score="6" Body="&lt;p&gt;There are open source implementations in the Sphinx and Freeswitch projects. I think they are all energy based detectors do won't need any kind model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cmusphinx.svn.sourceforge.net/viewvc/cmusphinx/trunk/sphinx4/src/sphinx4/edu/cmu/sphinx/frontend/endpoint/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sphinx 4&lt;/a&gt; (Java but it should be easy to port to C/C++)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cmusphinx.svn.sourceforge.net/viewvc/cmusphinx/trunk/pocketsphinx/src/gst-plugin/gstvader.c?revision=10817&amp;amp;view=markup&quot; rel=&quot;nofollow noreferrer&quot;&gt;PocketSphinx&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://wiki.freeswitch.org/wiki/VAD_and_CNG&quot; rel=&quot;nofollow noreferrer&quot;&gt;Freeswitch&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Answer taken from &lt;a href=&quot;https://stackoverflow.com/questions/5367214/any-simple-vad-implementation&quot;&gt;Stackoverflow question&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-05-16T11:23:20.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2388" PostTypeId="2" ParentId="2384" CreationDate="2012-05-16T12:02:06.527" Score="6" Body="&lt;p&gt;You don't need to split image into blocks. The DCT equation can be applied to the whole image. The block division has been chosen for JPEG standard partly because DCT was costly to compute in the past (but that's not the only reason).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can choose any size of block (including the single block, which is the image itself), then split image into the blocks and apply DCT for every block separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying DCT on, say 8x8 block (matrix), you get another 8x8 block, but with DCT coefficients (not pixel values). You normalize them, quantize them and then encode. The coefficients in the bottom right corner of the block (I think) can be stripped off to achieve compression (the &lt;a href=&quot;http://en.wikipedia.org/wiki/JPEG&quot;&gt;article about JPEG&lt;/a&gt; describes this well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is very similar to DFT, which uses sine and cosine bases. The DCT uses cosine bases only. The DC component is located in the top-left corner of transformed image/block and in DFT the DC component is in the middle of the image/block.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-05-16T13:41:59.817" LastActivityDate="2012-05-16T13:41:59.817" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2389" PostTypeId="2" ParentId="2382" CreationDate="2012-05-16T12:34:04.430" Score="3" Body="&lt;p&gt;In my opinion, dilation erosion are very basic tools. You have a very strong information base and quite a decent input image to make such decisions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my view: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Given a reasonable success you have shown to go from Fig 1 to 3, you can identify and segment individual signs. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assuming that you have known signs a prior, you can apply a decent fast algorithms to do pattern matching. In case if the exact patterns are not known- you can just identify the outer shape of the pattern. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Based on the classification, you can always define the centroid of each matched pattern and its respective width and height. If the centroid X,Y position is too close to the border - i.e. $centroid(x) &amp;lt; 0$ or $centroid(x) &amp;gt; imagewidth - shapewidth $ it is outside the edge, similarly you can apply for Y axis as well. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given that you are only concerned about what falls on the edge - you should start with each edge only and start pattern matching there. Start matching the partial pattern/shape and if the partial pattern/shape does match that object &lt;em&gt;IS&lt;/em&gt; being cut on the edge. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here are some references that might help you formulate the problem well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper is a very good to understand lot of basics about Signs/tokens you are dealing with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.57.1078&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Anil K. Jain and Aditya Vailaya&lt;/em&gt; &lt;strong&gt;Shape-Based Retrieval: A Case Study with Trademark Image Databases&lt;/strong&gt;  Pattern recognition 1998, vol. 31, no9, pp. 1369-1390&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many research elements which deals with partial or occluded shape/pattern matching. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://people.rit.edu/esseee/docs/02.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Eli Saber,Yaowu Xu, A. Murat Tekalp&lt;/em&gt; &lt;strong&gt;Partial shape recognition by sub-matrix matching for partial matching guided image labeling&lt;/strong&gt; Pattern Recognition 38 (2005) 1560 – 1573&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will expand this answer for more specific queries if you take this approach. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-05-16T12:34:04.430" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2390" PostTypeId="2" ParentId="2386" CreationDate="2012-05-16T12:52:36.013" Score="14" Body="&lt;p&gt;In my &lt;a href=&quot;https://dsp.stackexchange.com/a/1543/440&quot;&gt;answer&lt;/a&gt; to your that question, I had mentioned that Voice Activity Detection is a standard feature for codecs like G.729 and such others.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should look for reference encoders and decoders for algorithms that applies this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One such example is - &lt;a href=&quot;http://www.voiceage.com/openinit_g729.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.voiceage.com/openinit_g729.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possible source is Speex codec. Which implements &lt;a href=&quot;https://speex.org/docs/manual/speex-manual/node4.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;VAD&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW: You should google &quot;Voice Activity Detection&quot; or &quot;Talk Spurt&quot; rather than &quot;Speech Detection&quot;.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2017-01-09T06:19:55.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2391" PostTypeId="1" AcceptedAnswerId="2403" CreationDate="2012-05-16T16:47:03.363" Score="5" ViewCount="3655" Body="&lt;p&gt;Equation (4) of a recent paper (&lt;a href=&quot;http://www.seg.org/documents/10161/997244/1218.pdf&quot; rel=&quot;nofollow&quot;&gt;An improved peak-frequency-shift method for Q estimation&lt;/a&gt;) shows how to generate a wavelet using a zero-phase Ricker wavelet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|B_1(f)| = |B_0(f)|\exp(-\pi t f / Q)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, $|B_1(f)|$ is the amplitude spectra of the wavelet that I want to calculate, $|B_0(f)|$ is the amplitude spectra of the reference (Ricker wavelet), $\pi$ is the ubiquitous constant, $t$ is the time separation between wavelets, $f$ is the frequency, and $Q$ is a number (the Quality factor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to calculate the zero-phase Ricker wavelet in the time domain as $B_0(t)$, and I know how to calculate $|B_0(f)|$ as the square root of the sum of the real and imaginary parts squared of the frequency-domain reference Ricker wavelet.  The real and imaginary parts are found using the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, now that I've calculated $|B_1(f)|$, how do I transform $|B_1(f)|$ back into the &#xA;time domain?  I know $|B_1(f)|$, but can I find the real and imaginary parts of $|B_1(f)|$ so that I can use the IFFT to compute $B_1(t)$ in the time domain, or is some other information missing and required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the &quot;without phase changes&quot; words in the recent paper (http://www.seg.org/documents/10161/997244/1218.pdf) a clue that might help with the numerical implementation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how did the authors generate the wavelets in Figure 1 of the paper?  Is something other than Equation (4) being used here? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps there is nothing more happening here than an issue with notation. Looking at another paper (&lt;a href=&quot;http://www.eos.ubc.ca/research/cdsst/Tad_home/GPY001542.pdf&quot; rel=&quot;nofollow&quot;&gt;Estimation of quality factors from CMP records&lt;/a&gt;), the frequency spectrum of a Ricker wavelet is computed using Equation (1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B(f) = \frac{2}{{\sqrt \pi  }}\frac{{{f^2}}}{{f_m^2}}{e^{\frac{{ - {f^2}}}{{f_m^2}}}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, $f_m$ is the dominant frequency.  However, there doesn't seem to be any complex part of this expression.  Does this imply that the complex part is comprised of all zeros?  To numerically evaluate this equation, how do I compute the $f$ variable?  For example, using Matlab, $f$ can be computed using the colon operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = fmin:deltaf:fmax&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what is fmin and fmax?  Now $B(f)$ can be computed and taken back into the time domain using the IDFT (or the IFFT), but what if I want a real time-domain discrete signal for the $B(t)$ function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (5) of the same paper gives an expression that I think can be used to calculate the Q factor wavelet (note that this looks the same as the equation at the very top of this post):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B(f,t) = B(f){e^{\frac{{ - \pi ft}}{Q}}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what is meant here by the &quot;amplitude spectrum&quot;?  How do I get the real and complex parts of this spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A time domain version equation of the Ricker wavelet can be found here: &lt;a href=&quot;http://en.wikipedia.org/wiki/Mexican_hat_wavelet&quot; rel=&quot;nofollow&quot;&gt;Wikipedia link&lt;/a&gt;, but then what is the time domain expression used to calculate the Q factor wavelet?  As an aside, it would have been easier to have the time domain version of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B(f,t) = B(f){e^{\frac{{ - \pi ft}}{Q}}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what is the &quot;amplitude spectrum&quot; in this context, and how can I compute the wavelet in the time domain? &lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-05-17T18:52:41.827" LastActivityDate="2012-05-18T03:01:57.683" Title="Generating wavelet using amplitude spectra" Tags="|matlab|fft|frequency-spectrum|wavelet|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2392" PostTypeId="1" AcceptedAnswerId="2393" CreationDate="2012-05-16T18:16:03.073" Score="10" ViewCount="371" Body="&lt;p&gt;Let $Y$ be a measured (noisy) image $Y= X+ noise$, where $X$ is an image contains $0$(Background) and $200$(object). I need to create a decision rule that determines whether the true pixel value was $0$ or $200$ given the image $Y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the noise is Gaussian with mean=0 and standard deviation=sigma&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I_true = [zeros(50,140);zeros(60,40),(ones(60,60)*200),zeros(60,40);zeros(50,140)];&#xA;[nrows ncolumns] = size(I_true);&#xA;sigma = 63.246;&#xA;gaussian_noise = sigma*randn(size(I_true));&#xA;I_noisy = I_true + gaussian_noise;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After adding the Gaussian noise to the true image the PDF of the intensity of a background pixel will be Gaussian with mean = $0$ and variance= $63.2462^2$ and the PDF of the intensity of an object pixel will be Gaussian with mean = $200$ and variance= $63.2462^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used MAP rule and assumed that $P(Y=0)=P(Y=200)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likelihood ratio&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(P(Y=j|X=200))/(P(Y=j|X=0))≥P(X=0)/(P(X=200))=1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$exp((400Y−(200)^2)/(2σ^2))≥1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y≥100$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if $Y≥100$ the pixel will be considered as object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my questions are :.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) is my solution is right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) in the case of two objects with gray levels $150$ and $200$ what will be the steps of Map decision rule?&lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="7092" LastEditDate="2014-11-18T17:55:22.327" LastActivityDate="2014-11-18T17:55:22.327" Title="decision rule for image segmentation" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2393" PostTypeId="2" ParentId="2392" CreationDate="2012-05-16T19:36:53.967" Score="10" Body="&lt;p&gt;1) Yes, your solution is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If you assume that all a priori probabilities are equal, then the boundaries for AWGN is always the middle points between the possible values of X.  In this case, then, the decision boundaries are at 75 and 175.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that this rule (decision boundary at the middle points) can be generalised to applying to any noise probability distribution that is symmetric and monotonically decreases as the distance from zero increases.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-05-16T19:36:53.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2394" PostTypeId="2" ParentId="2391" CreationDate="2012-05-17T00:23:00.993" Score="3" Body="&lt;p&gt;The complex result of a DFT of a signal codifies amplitude and phase information. When you take a magnitude of the resulting complex vector, you automatically throw away any phase information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In so many words, the DFT result is informing you of what amplitudes &lt;em&gt;and&lt;/em&gt; phases of all its frequency components are required to reconstruct your signal. If you strip away phase information you are lining up all your complex sinusoids and then adding them up coherently. If you lose phase how can you reconstruct your signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, what you can get in this case is the autocorrelation function of $b_1(t)$, by taking the IDFT of $|B_1(f)|^2$, but you need phase information to completely reconstruct the original signal. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-05-17T04:44:04.273" LastActivityDate="2012-05-17T04:44:04.273" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2395" PostTypeId="2" ParentId="2348" CreationDate="2012-05-17T07:39:10.003" Score="8" Body="&lt;p&gt;The difference is quite huge, since they are two completely different models which can be used to tackle the same problem. Let's do a quick recap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Polynomial regression is a way of function approximation. We have a data set of the form $\lbrace x_i, z_i \rbrace$ and wish to determine the functional relationship, which is often expressed by estimating the probability density $p(z|x)$. Under the assumption that this $p$ is a Gaussian, we get the least squares solution as a maximum likelihood estimator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kalman filtering is a special way of inference in a linear dynamical system. LDSs are a special case of state space models, in which we assume that the data we observe is generated by a the application of a linear transform to the subsequent steps of a Markov chain over Gaussian random variables. Thus what we actually do is to model $p(x_{1:T})$, which is the probability of a time series. The process of Kalman Filtering is then to predict the next value of a time series, e.g. maximize $p(x_{t+1}|x_{1:t})$. But the same model can be used to do inference on smoothing, interpolation and many more things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus: polynomial regression does function approximation, Kalman filtering does time series prediction. Two totally different things, but time series prediction is a special case of function approximation.&#xA;Also, both models base quite different assumptions on the data they observe.&lt;/p&gt;&#xA;" OwnerUserId="1382" LastActivityDate="2012-05-17T07:39:10.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2396" PostTypeId="1" AcceptedAnswerId="2397" CreationDate="2012-05-17T14:51:24.683" Score="5" ViewCount="3675" Body="&lt;p&gt;I know that you can calculate the gain of a low-pass filter by summing the filter coefficients.  I don't know how to calculate the gain of an arbitrary matched filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, I have created a matched filter for an 802.11a long training symbol (for the purposes of this question that detail doesn't matter- just thought some of you might be curious).  My MATLAB code for creating the filter is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;longSymFreq = [0 1 -1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 ...&#xA;           1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1];&#xA;longSymTime = ifft(longSymFreq);&#xA;intentionalTimeOffset = 4;&#xA;% Barrel shift by intentionalTimeOffset to avoid the corruption of the early data samples.  Due to the&#xA;% cyclic prefix doing this is not a problem.&#xA;longSymTime = [longSymTime(end-(intentionalTimeOffset-1):end) longSymTime(1:end-intentionalTimeOffset)];&#xA;longSymFilter = conj(fliplr(longSymTime));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The sum of this filter is &lt;code&gt;6.938893903907228e-018 +3.122502256758253e-017i&lt;/code&gt;. The average of the absolute value of the taps, though, is  &lt;code&gt;0.107538417337840&lt;/code&gt;, so clearly the sum is not giving me any information on what kind of gain I will get when the filter gets the matched signal.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I calculate that gain?  The reason I care is because my final filter will be fixed-point, and I can't have an overflow when I get the signal that I'm looking for.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the gain the energy of the filter?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="923" LastEditorUserId="1629" LastEditDate="2016-06-02T09:13:32.560" LastActivityDate="2016-06-02T09:13:32.560" Title="How do you calculate the gain of a matched filter?" Tags="|filters|filter-design|matched-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2397" PostTypeId="2" ParentId="2396" CreationDate="2012-05-17T15:11:25.443" Score="8" Body="&lt;p&gt;There is no single &quot;gain&quot; value for any filter. The value that you're referencing as the sum of the taps is its DC gain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;H(0) = \sum_{n=0}^{N-1} h[n] e^0 = \sum_{n=0}^{N-1} h[n]&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(\omega)$ is the frequency response of the filter at angular frequency $\omega \in [-\pi, \pi)$. What you are concerned about is how large the peak can possibly be when your matched filter lines up perfectly with your signal of interest. That's easy to calculate for a constant-envelope signal like yours:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xD;&#xA;P = G \sum_{n=0}^{N-1} |h[n]|^2&#xD;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the matched filter lines up perfectly with the signal you're looking for (both in time and in phase, which is the worst case for this analysis), you're effectively calculating the squared magnitude of each sample and summing them all up. Now, in any practical system, there will be some gain or loss factor $G$ that is not known &lt;em&gt;a priori&lt;/em&gt;; this reflects the fact that you won't know the exact power level of the input signal as it hits your ADC. If you have an automatic-gain-control (AGC) loop, you could use its nominal output level to decide what $G$ is and therefore calculate the maximum peak $P$. Otherwise, you can design for worst-case values of $G$ to ensure that you don't overflow with the resulting value of $P$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-05-17T15:11:25.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2398" PostTypeId="2" ParentId="2348" CreationDate="2012-05-17T18:32:28.793" Score="57" Body="&lt;p&gt;&lt;strong&gt;1. There is a Difference in terms of optimality criteria&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kalman filter&lt;/a&gt;&lt;/strong&gt; is a Linear estimator. It is a &lt;em&gt;linear optimal estimator&lt;/em&gt; - i.e. infers model parameters of interest from indirect, inaccurate and uncertain observations.&lt;/p&gt;&#xA;&lt;p&gt;But optimal in what sense? If all noise is Gaussian, the Kalman filter minimizes the &lt;em&gt;mean square error&lt;/em&gt; of the estimated parameters. This means, that when underlying noise is &lt;em&gt;NOT&lt;/em&gt; Gaussian the promise no longer holds. In case of nonlinear dynamics, it is well-known that the problem of state estimation becomes difficult. In this context, no filtering scheme clearly outperforms all other strategies. In such case, Non-linear estimators may be better if they can better model the system with additional information. [See Ref 1-2]&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Polynomial_regression&quot; rel=&quot;nofollow noreferrer&quot;&gt;Polynomial regression&lt;/a&gt;&lt;/strong&gt; is a form of linear regression in which the relationship between the independent variable x and the dependent variable y is modeled as an nth order polynomial.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Y = a_0 + a_1x + a_2x^2 + \epsilon $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that, while polynomial regression fits a nonlinear model to the data, these models are all linear from the point of view of estimation, since the regression function is linear in terms of the unknown parameters &lt;span class=&quot;math-container&quot;&gt;$a_0, a_1, a_2$&lt;/span&gt;. If we treat &lt;span class=&quot;math-container&quot;&gt;$x, x^2$&lt;/span&gt; as different variables, polynomial regression can also be treated as &lt;a href=&quot;http://ordination.okstate.edu/MULTIPLE.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;multiple linear regression&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Polynomial regression models are usually fit using the method of least squares. In the least squares method also, we minimize the mean squared error. The least-squares method minimizes the variance of the unbiased estimators of the coefficients, under the conditions of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gauss%E2%80%93Markov_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gauss–Markov theorem&lt;/a&gt;. This theorem, states that &lt;a href=&quot;http://en.wikipedia.org/wiki/Ordinary_least_squares&quot; rel=&quot;nofollow noreferrer&quot;&gt;ordinary least squares&lt;/a&gt; (OLS) or linear least squares is the Best Linear Unbaised Estimator (BLUE) under following conditions:&lt;/p&gt;&#xA;&lt;p&gt;a. when errors have expectation  zero i.e. &lt;span class=&quot;math-container&quot;&gt;$E(e_i) = 0 $&lt;/span&gt;&lt;br /&gt;&#xA;b. have equal variances i.e.  &lt;span class=&quot;math-container&quot;&gt;$ Variance(e_i) = \sigma^2 &amp;lt; \infty $&lt;/span&gt;&lt;br /&gt;&#xA;c. and errors are uncorrelated i.e. &lt;span class=&quot;math-container&quot;&gt;$ cov(e_i,e_j) = 0 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;NOTE: that here, errors don't have to be Gaussian nor need to be&#xA;IID. It only needs to be uncorrelated.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. Kalman Filter is an evolution of estimators from least square&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In 1970, H. W. Sorenson published an IEEE Spectrum article titled &lt;a href=&quot;http://www.cs.unc.edu/%7Ewelch/kalman/media/pdf/Sorenson1970.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Least-squares estimation: from Gauss to Kalman.&lt;/a&gt;&amp;quot; [See Ref 3.] This is a seminal paper that provides great insight about how Gauss' original idea of least squares to today's modern estimators like Kalman.&lt;/p&gt;&#xA;&lt;p&gt;Gauss' work not only introduced the least square framework but it was actually one of the earliest work that used a probabilistic view. While least squares evolved in the form of various regression methods, there was another critical work that brought filter theory to be used as an estimator.&lt;/p&gt;&#xA;&lt;p&gt;The theory of ﬁltering to be used for stationary time series estimation was constructed by Norbert Wiener during 1940s (during WW-II) and published in 1949 which is now known as Wiener filter. The work was done much earlier, but was classiﬁed until well after World War II). The discrete-time equivalent of Wiener's work was derived independently by Kolmogorov and published in 1941. Hence the theory is often called the &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiener-Kolmogorov filtering theory&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Traditionally filters are designed for the desired frequency response. However, in case of Wiener filter, it reduces the amount of noise present in a signal by comparison with an estimation of the desired noiseless signal. Weiner filter is actually an estimator. In an important paper, however, Levinson (1947) [See Ref 6] showed that in discrete time, the entire theory could be reduced to least squares and so was mathematically very simple. &lt;a href=&quot;http://ocw.mit.edu/courses/earth-atmospheric-and-planetary-sciences/12-864-inference-from-data-and-models-spring-2005/lecture-notes/tsamsfmt2_6.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;See Ref 4&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, we can see that Weiner's work gave a new approach for estimation problem;  an evolution from using least squares to another well-established filter theory.&#xA;However, the critical limitation is that Wiener filter assumes the inputs are stationary.  We can say that Kalman filter is a next step in the evolution which drops the stationary criteria. In Kalman filter, state space model can dynamically be adapted to deal with non-stationary nature of signal or system.&lt;/p&gt;&#xA;&lt;p&gt;The Kalman filters are based on linear dynamic systems in discrete time domain. Hence it is capable of dealing with potentially time varying signal as opposed to Wiener. As the &lt;a href=&quot;http://www.cs.unc.edu/%7Ewelch/kalman/media/pdf/Sorenson1970.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sorenson's paper&lt;/a&gt; draws parallel between Gauss' least squares and Kalman filter as&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;...therefore, one sees that the basic assumption of Gauss and Kalman&#xA;are identical except that later allows the state to change from one&#xA;time to next. The difference introduces a non-trivial modification to&#xA;Gauss' problem but one that can be treated within the least squares&#xA;framework.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;3. They are same as far as causality direction of prediction is concerned; besides implementation efficiency&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Sometimes it is perceived that Kalman filter is used for prediction of future events based on past data where as regression or least squares does smoothing &lt;em&gt;within&lt;/em&gt; end to end points. This is not really true. Readers should note that both the estimators (and almost all estimators you can think of) can do either job. You can apply Kalman filter to apply &lt;a href=&quot;http://automation.berkeley.edu/resources/KalmanSmoothing.ppt&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kalman smoothing&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Similarly, regression based models can also be used for prediction. Given the training vector, &lt;span class=&quot;math-container&quot;&gt;$X_t$&lt;/span&gt; and you applied &lt;span class=&quot;math-container&quot;&gt;$Y_t$&lt;/span&gt; and discovered the model parameters &lt;span class=&quot;math-container&quot;&gt;$α_0 ... a_K$&lt;/span&gt; now for another sample &lt;span class=&quot;math-container&quot;&gt;$X_k$&lt;/span&gt; we can extrapolate &lt;span class=&quot;math-container&quot;&gt;$Y_K$&lt;/span&gt; based on the model.&lt;/p&gt;&#xA;&lt;p&gt;Hence, both methods can be used in the form of smoothing or fitting (non-causal) as well as for future predictions (causal case). However, the critical difference is the implementation which is significant. In case of polynomial regression - with entire process needs to get repeated and hence, while it may be possible to implement causal estimation but it might be computationally expensive. [While, I am sure there must be some research by now to make things iterative].&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, Kalman filter is inherently recursive. Hence, using it for prediction for future only using on past data will be very efficient.&lt;/p&gt;&#xA;&lt;p&gt;Here is another good presentation that compares several methods: &lt;a href=&quot;http://www.lce.hut.fi/%7Essarkka/course_k2009/slides_2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ref 5&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Best Introduction to Kalman Filter - &lt;a href=&quot;http://academic.csuohio.edu/simond/courses/eec644/kalman.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Dan Simon&lt;/em&gt; &lt;strong&gt;Kalman Filtering&lt;/strong&gt; Embedded Systems Programming JUNE 2001 page 72&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Presentation: &lt;a href=&quot;http://www.cs.cmu.edu/%7Emotionplanning/papers/sbp_papers/integrated3/kleeman_kalman_basics.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Lindsay Kleeman&lt;/em&gt; &lt;strong&gt;Understanding and Applying Kalman Filtering&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.cs.unc.edu/%7Ewelch/kalman/media/pdf/Sorenson1970.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;H. W. Sorenson&lt;/em&gt; &lt;strong&gt;Least-squares estimation: from Gauss to Kalman&lt;/strong&gt; IEEE Spectrum, July 1970. pp 63-68.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://ocw.mit.edu/courses/earth-atmospheric-and-planetary-sciences/12-864-inference-from-data-and-models-spring-2005/lecture-notes/tsamsfmt2_6.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture Note MIT Course ware - Inference from Data and Models (12.864) - Wiener and Kalman Filters&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Presentation &lt;a href=&quot;http://www.lce.hut.fi/%7Essarkka/course_k2009/slides_2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Simo Särkkä&lt;/em&gt; &lt;strong&gt;From Linear Regression to Kalman&#xA;Filter and Beyond&lt;/strong&gt; Helsinki University of Technology&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Levinson, N. (1947). &amp;quot;The Wiener RMS error criterion in filter design and prediction.&amp;quot; J. Math. Phys., v. 25, pp. 261–278.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastEditorUserId="7092" LastEditDate="2021-02-23T06:03:54.710" LastActivityDate="2021-02-23T06:03:54.710" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2399" PostTypeId="2" ParentId="2313" CreationDate="2012-05-17T19:05:29.797" Score="1" Body="&lt;p&gt;Given that &lt;code&gt;The camera never moves and the scene is typcially static.&lt;/code&gt; you can apply a very simple technique of Temporal averaging. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume an image sequence $I_t[x][y]$ where $t$ denotes the time of image I and x,y are the pixel indices. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can generate a pretty nice Temporal composition by averaging or filtering the Image &lt;em&gt;NOT&lt;/em&gt; in $x,y$ co-ordination but in $t$ co-ordinate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ I_{stacked}[x][y] =  {1 \over N } \sum I_t[x][y]*w_t[x][y]  $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $w$ is the filter weigh. As a simplistic case we can keep $w =1 $ which will result in an ordinary averaging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; unlike spatial filtering where image tends to get blurred, this operation will keep the image sharpness intact and will also reduce the Noise significantly. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-05-17T19:05:29.797" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2400" PostTypeId="1" CreationDate="2012-05-17T20:23:50.670" Score="7" ViewCount="2167" Body="&lt;p&gt;Assume you have a signal, and within it, some pulses are present. A pulse is a simple tone. You know the pulses' duration and shape. (Let us assume that a pulse is made of a couple of cycles, and then to which all those cycles are multiplied by a hamming window. So the final pulse may look like the blue plot below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/d/d7/Analytic.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/d/d7/Analytic.svg&quot; alt=&quot;something like this&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we do not know are its frequency. (You know its frequency to within $\pm 100\textrm{ Hz}$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does performing a match-filtering of a signals' absolute magnitude spectrogram with a 2-D version of your pulse in the &lt;em&gt;time-frequency domain&lt;/em&gt;, confer upon you any advantages, versus performing a match-filtering of the signals' (shown in red as an example), against the known &lt;em&gt;envelope&lt;/em&gt; of the pulse, in the time-domain? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/d/d7/Analytic.svg&quot; alt=&quot;[envelope&quot;&gt;]&lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/d/d7/Analytic.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;* &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the TF-domain method, assume:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;STFT analysis. &lt;/li&gt;&#xA;&lt;li&gt;I am using an analysis window equal to the expected pulse length.&lt;/li&gt;&#xA;&lt;li&gt;Percent Overlap: Whatever you want, I do not think it matters for this case. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am really on the fence on this one because on the one hand, you cannot create information out of nothing, so taking your problem to the time-frequency space seems redundant, while on the other hand, going into the time-frequency space allows you to, perhaps, create 2-D filters  that better match your pulse, and/or, ignore noise from other bands which are (perhaps?) not ignored in the time-domain match-filtering case? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My biggest point of confusion is that, inherent to going into the TF domain, we now have both time and frequency localization ambiguity, (based on our choice of the analysis window we use). In contrast, in the time domain, we are $100\%$ sure of our time localization. How - or why - would trading in $100\%$ time-locatlization unambiguity for some joint time-frequency ambiguity help? I am not seeing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to look at the problem is with this rephrase: &lt;strong&gt;&lt;em&gt;When&lt;/em&gt; would one want to do match filtering in &lt;em&gt;only&lt;/em&gt; the time-domain ($0\%$ time ambiguity, $100\%$ frequency ambiguity), vs doing it in the joint TF-domain, (x% time ambiguity, (1-x)% frequency ambiguity).&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a broader question but broke it down into this one first.  &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="1629" LastEditDate="2017-05-19T21:44:56.563" LastActivityDate="2017-05-19T21:44:56.563" Title="Match Filter in Time-Frequency domain instead of just Time domain. Redundant, or better?" Tags="|frequency-spectrum|signal-detection|time-frequency|matched-filter|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="2401" PostTypeId="1" CreationDate="2012-05-17T21:58:20.703" Score="11" ViewCount="4984" Body="&lt;p&gt;Both linear regression and Kalman filtering can be used to estimate and then predict from a time domain sequence of data (given some assumptions about the model behind the data).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What methods, if any, might be applicable to do prediction using frequency domain data?  (e.g. predict a future step, using the output from suitable FFT(s) of previous data, without just going back to the time domain for the estimation.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What assumptions about the data, or the model behind the data, might be required for what, if any, quality or optimality of prediction in the frequency domain?  (But assume it is not apriori known whether the data source is strictly periodic in the FFT aperture width.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="440" LastEditDate="2012-05-18T12:14:57.933" LastActivityDate="2012-05-18T10:43:06.500" Title="How to do prediction using frequency domain data?" Tags="|fft|control-systems|estimation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2402" PostTypeId="2" ParentId="2401" CreationDate="2012-05-17T22:24:59.717" Score="1" Body="&lt;p&gt;Using the frequency and time domains to make near-term predictions about one another is problematic due to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Uncertainty_principle#Signal_processing&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncertainty principle&lt;/a&gt;. This means that the better you want to know the spectrum, the more samples you have to collect. This delays your prediction, reducing its usefulness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first question I would ask is &quot;how predictable is my time series to begin with?&quot; in order to know how well my forecasting algorithm is performing and decide when to stop. This question can be answered by estimating the &lt;a href=&quot;http://en.wikipedia.org/wiki/Entropy_rate&quot; rel=&quot;nofollow noreferrer&quot;&gt;entropy rate&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to remember is that a time series is fully characterized by its joint distribution; transformations can not improve this, but can help when you are working with crude models (e.g., that neglect high-order dependencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://stackoverflow.com/questions/4479463/using-fourier-analysis-for-time-series-prediction&quot;&gt;Using fourier analysis for time series prediction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-05-17T22:24:59.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2403" PostTypeId="2" ParentId="2391" CreationDate="2012-05-18T02:36:28.480" Score="1" Body="&lt;p&gt;The issue with calculating the wavelet appears to be nothing more than an issue with notation and terminology.  Starting with the second paper mentioned in my original post (&lt;a href=&quot;http://www.eos.ubc.ca/research/cdsst/Tad_home/GPY001542.pdf&quot; rel=&quot;nofollow&quot;&gt;Estimation of quality factors from CMP records&lt;/a&gt;), the magnitude (real part) of the Ricker wavelet in the frequency domain is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B(f) = \frac{2}{{\sqrt \pi  }}\frac{{{f^2}}}{{f_m^2}}{e^{\frac{{ - {f^2}}}{{f_m^2}}}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, $\pi$ is the ubiquitous constant (3.1415...), whereas $f$ is a frequency vector ranging between two frequencies (0 Hz and 400 Hz for example), and $f_m$ is the center frequency of the wavelet.  The phase (imaginary part) in the frequency domain is a vector comprised of zeros.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Ricker wavelet at a time difference $t$ and a known $Q$ is calculated using: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B(f,t) = B(f){e^{\frac{{ - \pi ft}}{Q}}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These equations are used to generate a filter kernel in the frequency domain.  After taking the IDFT (or IFFT), the discrete time domain signal needs to be shifted (see &lt;a href=&quot;http://www.dspguide.com/ch17/1.htm&quot; rel=&quot;nofollow&quot;&gt;Chapter 17 of Smith&lt;/a&gt;), but I don't think that I need to truncate and window the kernel, since this will change the frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that vector Bf2 in the code below needs to be symmetric to preserve the symmetry of the FFT, and I've calculated deltat from fmax.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A paper that discusses Q estimation can be found here (&lt;a href=&quot;http://www.cseg.ca/conventions/abstracts/2004/2004abstracts/127S0223-Elapavuluri_P_Estimation_of_Q.pdf&quot; rel=&quot;nofollow&quot;&gt;Estimation of Q using crosscorrelation&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following Matlab code snippet demonstrates what I've done:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% inputs&#xA;fm = 50;            % dominant frequency of wavelet (Hz)&#xA;deltaf = 0.1;       % frequency step (Hz)&#xA;fmax = 400;         % maximum frequency (Hz)&#xA;tdiff = 0.5;        % time propagation distance of wavlet (s)&#xA;Q = 40;             % Q value of wavelet&#xA;&#xA;deltat = 1 / (2 * fmax);&#xA;f = 0:deltaf:fmax;&#xA;term = (f.^2) ./ (fm^2);&#xA;term1 = pi .* tdiff .* f ./ Q;&#xA;Bf = (2 / sqrt(pi)) .* (term) .* exp(-term) .* exp(-term1);&#xA;&#xA;figure; plot(f, Bf);&#xA;title('Frequency spectrum of Ricker wavelet')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('Amplitude')&#xA;&#xA;% We could convert the magnitude and phase (all zero) into rectangular&#xA;% coordinates from polar coordinates&#xA;% This doesn't really do anything in this case, since the phase&#xA;% is just a zero vector&#xA;% mag = real(Bf);&#xA;% phase = imag(Bf);&#xA;% Rp = mag .*  cos(phase);&#xA;% Ip = mag .* sin(phase);&#xA;&#xA;%  prepare the array for taking back into the time domain&#xA;%  this should be symmetric around the N/2 + 1 point&#xA;Bf2 = [Bf fliplr(Bf(1:end-1))];&#xA;&#xA;% take back into time domain &#xA;Bt =  ifft(Bf2, 'symmetric');&#xA;&#xA;% rotate&#xA;N = length(Bt);&#xA;Btr = zeros(N,1);&#xA;for i = 0:N-1&#xA;   index = floor(i + N/2);&#xA;   if (index &amp;gt; N-1)&#xA;    index = index - N; &#xA;   end&#xA;   Btr(index+1) =  Bt(i+1); &#xA;end&#xA;&#xA;% determine the time axis&#xA;t = deltat:deltat:deltat*(N/2);&#xA;tt = [-fliplr(t) 0 t]; &#xA;&#xA;figure; plot(tt, Btr);&#xA;title('Time spectrum of Ricker wavelet')&#xA;xlabel('Time (s))')&#xA;ylabel('Amplitude')&#xA;xlim([-0.08 0.08])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-05-18T03:01:57.683" LastActivityDate="2012-05-18T03:01:57.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2404" PostTypeId="1" CreationDate="2012-05-18T08:39:14.500" Score="19" ViewCount="986" Body="&lt;p&gt;From what I have heard, compressed sensing can only be utilized for a sparse signal. Is this correct?&lt;/p&gt;&#xA;&lt;p&gt;If that is the case, how can a sparse signal be distinguished from any bandlimited signal? Every signal can be expanded to include a sparse or zero-coefficient signal part.  Does it become a sparse signal in that case?&lt;/p&gt;&#xA;&lt;p&gt;Does compressed sensing all the time retrieve information or signal perfectly?&lt;/p&gt;&#xA;&lt;p&gt;Added: by the way, I just started to learn these things, so the purpose of this question is to taste a bit of what these things are.&lt;/p&gt;&#xA;" OwnerUserId="1384" LastEditorUserId="10650" LastEditDate="2021-09-27T06:22:21.880" LastActivityDate="2021-09-27T06:22:21.880" Title="Applicability of compressed sensing / compressive sensing" Tags="|image-processing|image-compression|transform|compressive-sensing|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2405" PostTypeId="2" ParentId="2401" CreationDate="2012-05-18T10:43:06.500" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;An important NOTE:&lt;/strong&gt; Since you are talking about frequency&#xA;  domain, it is implied that entire DFT spectrum is available and hence&#xA;  estimation is used for smoothing rather than future prediction.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If the signal is stationary, you can apply &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow&quot;&gt;wiener filter&lt;/a&gt; and the model produced is an FIR filter; in this case, the signal estimation in the time domain will be identical to that of frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt;:&#xA;&lt;em&gt;Wiener's main accomplishment was solving the case where the causality requirement is in effect, and in an appendix of Wiener's book Levinson gave the FIR solution.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing noise using wiener filter using deconvolution is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;nofollow&quot;&gt;Wiener deconvolution&lt;/a&gt;. This works in frequency domain. And is quite well used in Image deconvolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if there is a formulation possible for Kalman filter to be used for given Frequency domain data (assuming DFT) because usual implementations are actually iterative sample by sample.  But kalman smoothing approaches probably can do similar thing.&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-05-18T10:43:06.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2406" PostTypeId="1" AcceptedAnswerId="2409" CreationDate="2012-05-16T23:44:19.533" Score="45" ViewCount="17801" Body="&lt;p&gt;I'd like to take pictures of labels on a jar of food, and be able to transform them so the label is flat, with the right and left side resized to be even with the center of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I'd like to use the contrast between the label and the background in order to find the edges and apply the correction.  Otherwise, I can ask the user to somehow identify the corners and sides of the image.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm looking for general techniques and algorithms to take an image that is skewed spherically (cylindrically in my case) and can flatten the image.  Currently the image of a label that is wrapped around a jar or bottle, will have features and text that shrinks as it recedes to the right or left of the image.  Also the lines that denote the edge of the label, will only be parallel in the center of the image, and will skew towards each-other on the right and left extreme of the label.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After manipulating the image, I would like to be left with an almost perfect rectangle where the text and features are uniformly sized, as if I took a picture of the label when it was not on the jar or bottle.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I would like it if the technique could automatically detect the edges of the label, in order to apply the suitable correction.  Otherwise I would have to ask my user to indicate the label boundaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already Googled and found articles like this one:  &lt;a href=&quot;http://www.sciweavers.org/publications/flattening-curved-documents-images&quot;&gt;flattening curved documents&lt;/a&gt;, but I am looking for something a bit simpler, as my needs are for labels with a simple curve.&lt;/p&gt;&#xA;" OwnerUserId="1400" OwnerDisplayName="mahboudz" LastActivityDate="2020-05-11T18:53:13.017" Title="How to flatten the image of a label on a food jar?" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2408" PostTypeId="2" ParentId="2404" CreationDate="2012-05-18T13:50:52.837" Score="2" Body="&lt;p&gt;I am not an expert on compressed sensing, but I have some familiarity with it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I heard somewhere that compressed sensing can only be utilized for a sparse signal.  Is this right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, it can be used anywhere, but as Dilip said, it only makes sense for sparse signals.  If the signal isn't sparse then there is no reason to not do standard Nyquist sampling since that will be efficient.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And how can you distinguish a sparse signal from any bandlimited signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Although I am sure that there are formal definitions of &quot;sparsity&quot; out there (and they are probably not the same, either), I am not aware of a formal definition.  What people mean by sparsity tends to change depending on the context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say that a sparse signal is any signal that has much lower information (using the information theory definition of the word) content than it potentially could have if it was continuous and fully utilized its frequency range.  What are some examples of sparse signals?  Frequency hopping signals.  Bursty signals.  A walkie-talkie AM signal that is transmitted continuously even if no one is talking.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Every signal can be expanded to include a sparse or zero-coefficient signal part.......&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What, like saying the signal is 100 MHz wide even if it's only 1 MHz wide?  You can define things to be whatever you want, just like old-time astronomers were able to get the math of the sun orbiting the Earth to work.  That doesn't mean that their equations were useful.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And does compressed sensing all the time retrieve information or signal perfectly?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Compressed sensing is a technique.  Like any technique (including Nyquist sampling) it has conditions.  If you satisfy the conditions- use good feature extractors for the signal that you are trying to sense- it will work well.  If you don't, it won't.  No technique extracts signals perfectly in anything outside of a theoretical model.  Yes, I'm sure that there are theoretical signals that compressed sensing can extract perfectly.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="1464" LastEditDate="2017-06-20T12:52:50.800" LastActivityDate="2017-06-20T12:52:50.800" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2409" PostTypeId="2" ParentId="2406" CreationDate="2012-05-18T14:20:24.237" Score="64" Body="&lt;p&gt;A &lt;a href=&quot;https://mathematica.stackexchange.com/q/5676/242&quot;&gt;similar question was asked on Mathematica.Stackexchange&lt;/a&gt;. My answer over there evolved and got quite long in the end, so I'll summarize the algorithm here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Abstract&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the label. &lt;/li&gt;&#xA;&lt;li&gt;Find the borders of the label&lt;/li&gt;&#xA;&lt;li&gt;Find a mapping that maps image coordinates to cylinder coordinates so that it maps the pixels along the top border of the label to ([anything] / 0), the pixels along the right border to (1 / [anything]) and so on. &lt;/li&gt;&#xA;&lt;li&gt;Transform the image using this mapping&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The algorithm only works for images where:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the label is brighter than the background (this is needed for the label detection)&lt;/li&gt;&#xA;&lt;li&gt;the label is rectangular (this is used to measure the quality of a mapping)&lt;/li&gt;&#xA;&lt;li&gt;the jar is (almost) vertical (this is used to keep the mapping function simple)&lt;/li&gt;&#xA;&lt;li&gt;the jar is cylindrical (this is used to keep the mapping function simple)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, the algorithm is modular. At least in principle, you could write your own label detection that does not require a dark background, or you could write your own quality measurement function that can cope with elliptical or octagonal labels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Results&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These images were processed fully automatically, i.e. the algorithm takes the source image, works for a few seconds, then shows the mapping (left) and the un-distorted image (right):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/40CXM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SYyjZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W5OSP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/foD23.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wmA3N.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vXDvN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oJONO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next images were processed with a modified version of the algorithm, were the user selects the left and right borders of the jar (not the label), because the curvature of the label cannot be estimated from the image in a frontal shot (i.e. the fully automatic algorithm would return images that are slightly distorted):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mbA79.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bRaKM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Implementation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;1. Find the label&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The label is bright in front of a dark background, so I can find it easily using binarization:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;src = Import[&quot;https://i.stack.imgur.com/rfNu7.png&quot;];&#xA;binary = FillingTransform[DeleteBorderComponents[Binarize[src]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WewbZ.png&quot; alt=&quot;binarized image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I simply pick the largest connected component and assume that's the label:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;labelMask = Image[SortBy[ComponentMeasurements[binary, {&quot;Area&quot;, &quot;Mask&quot;}][[All, 2]], First][[-1, 2]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9G1fQ.png&quot; alt=&quot;largest component&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;2. Find the borders of the label&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next step: find the top/bottom/left/right borders using simple derivative convolution masks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;topBorder = DeleteSmallComponents[ImageConvolve[labelMask, {{1}, {-1}}]];&#xA;bottomBorder = DeleteSmallComponents[ImageConvolve[labelMask, {{-1}, {1}}]];&#xA;leftBorder = DeleteSmallComponents[ImageConvolve[labelMask, {{1, -1}}]];&#xA;rightBorder = DeleteSmallComponents[ImageConvolve[labelMask, {{-1, 1}}]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JQQXs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a little helper function that finds all white pixels in one of these four images and converts the indices to coordinates (&lt;code&gt;Position&lt;/code&gt; returns indices, and indices are 1-based {y,x}-tuples, where y=1 is at the top of the image. But all the image processing functions expect coordinates, which are 0-based {x,y}-tuples, where y=0 is the bottom of the image):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{w, h} = ImageDimensions[topBorder];&#xA;maskToPoints = Function[mask, {#[[2]]-1, h - #[[1]]+1} &amp;amp; /@ Position[ImageData[mask], 1.]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;3. Find a mapping from image to cylinder coordinates&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have four separate lists of coordinates of the top, bottom, left, right borders of the label. I define a mapping from image coordinates to cylinder coordinates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;arcSinSeries = Normal[Series[ArcSin[\[Alpha]], {\[Alpha], 0, 10}]]&#xA;Clear[mapping];&#xA;mapping[{x_, y_}] := &#xA;   {&#xA;    c1 + c2*(arcSinSeries /. \[Alpha] -&amp;gt; (x - cx)/r) + c3*y + c4*x*y, &#xA;    top + y*height + tilt1*Sqrt[Clip[r^2 - (x - cx)^2, {0.01, \[Infinity]}]] + tilt2*y*Sqrt[Clip[r^2 - (x - cx)^2, {0.01, \[Infinity]}]]&#xA;   }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is a cylindrical mapping, that maps X/Y-coordinates in the source image to cylindrical coordinates. The mapping has 10 degrees of freedom for height/radius/center/perspective/tilt. I used the Taylor series to approximate the arc sine, because I couldn't get the optimization working with ArcSin directly. The &lt;code&gt;Clip&lt;/code&gt; calls are my ad-hoc attempt to prevent complex numbers during the optimization. There's a trade-off here: On the one hand, the function should be as close to an exact cylindrical mapping as possible, to give the lowest possible distortion. On the other hand, if it's to complicated, it gets much harder to find optimal values for the degrees of freedom automatically. (The nice thing about doing image processing with Mathematica is that you can play around with mathematical models like this very easily, introduce additional terms for different distortions and use the same optimization functions to get final results. I've never been able to do anything like that using OpenCV or Matlab. But I never tried the symbolic toolbox for Matlab, maybe that makes it more useful.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I define an &quot;error function&quot; that measures the quality of a image -&gt; cylinder coordinate mapping. It's just the sum of squared errors for the border pixels:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;errorFunction =&#xA;  Flatten[{&#xA;    (mapping[#][[1]])^2 &amp;amp; /@ maskToPoints[leftBorder],&#xA;    (mapping[#][[1]] - 1)^2 &amp;amp; /@ maskToPoints[rightBorder],&#xA;    (mapping[#][[2]] - 1)^2 &amp;amp; /@ maskToPoints[topBorder],&#xA;    (mapping[#][[2]])^2 &amp;amp; /@ maskToPoints[bottomBorder]&#xA;    }];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This error function measures the &quot;quality&quot; of a mapping: It's lowest if the points on the left border are mapped to (0 / [anything]), pixels on the top border are mapped to ([anything] / 0) and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I can tell Mathematica to find coefficients that minimize this error function. I can make &quot;educated guesses&quot; about some of the coefficients (e.g. the radius and center of the jar in the image). I use these as starting points of the optimization:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;leftMean = Mean[maskToPoints[leftBorder]][[1]];&#xA;rightMean = Mean[maskToPoints[rightBorder]][[1]];&#xA;topMean = Mean[maskToPoints[topBorder]][[2]];&#xA;bottomMean = Mean[maskToPoints[bottomBorder]][[2]];&#xA;solution = &#xA; FindMinimum[&#xA;   Total[errorFunction], &#xA;    {{c1, 0}, {c2, rightMean - leftMean}, {c3, 0}, {c4, 0}, &#xA;     {cx, (leftMean + rightMean)/2}, &#xA;     {top, topMean}, &#xA;     {r, rightMean - leftMean}, &#xA;     {height, bottomMean - topMean}, &#xA;     {tilt1, 0}, {tilt2, 0}}][[2]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;FindMinimum&lt;/code&gt; finds values for the 10 degrees of freedom of my mapping function that minimize the error function. Combine the generic mapping and this solution and I get a mapping from X/Y image coordinates, that fits the label area. I can visualize this mapping using Mathematica's &lt;code&gt;ContourPlot&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Show[src,&#xA; ContourPlot[mapping[{x, y}][[1]] /. solution, {x, 0, w}, {y, 0, h}, &#xA;  ContourShading -&amp;gt; None, ContourStyle -&amp;gt; Red, &#xA;  Contours -&amp;gt; Range[0, 1, 0.1], &#xA;  RegionFunction -&amp;gt; Function[{x, y}, 0 &amp;lt;= (mapping[{x, y}][[2]] /. solution) &amp;lt;= 1]],&#xA; ContourPlot[mapping[{x, y}][[2]] /. solution, {x, 0, w}, {y, 0, h}, &#xA;  ContourShading -&amp;gt; None, ContourStyle -&amp;gt; Red, &#xA;  Contours -&amp;gt; Range[0, 1, 0.2],&#xA;  RegionFunction -&amp;gt; Function[{x, y}, 0 &amp;lt;= (mapping[{x, y}][[1]] /. solution) &amp;lt;= 1]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qORsT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;4. Transform the image&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I use Mathematica's &lt;code&gt;ImageForwardTransform&lt;/code&gt; function to distort the image according to this mapping:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ImageForwardTransformation[src, mapping[#] /. solution &amp;amp;, {400, 300}, DataRange -&amp;gt; Full, PlotRange -&amp;gt; {{0, 1}, {0, 1}}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gives the results as shown above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Manually assisted version&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm above is full-automatic. No adjustments required. It works reasonably well as long as the picture is taken from above or below. But if it's a frontal shot, the radius of the jar can not be estimated from the shape of the label. In these cases, I get much better results if I let the user enter the left/right borders of the jar manually, and set the corresponding degrees of freedom in the mapping explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code lets the user select the left/right borders:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;LocatorPane[Dynamic[{{xLeft, y1}, {xRight, y2}}], &#xA; Dynamic[Show[src, &#xA;   Graphics[{Red, Line[{{xLeft, 0}, {xLeft, h}}], &#xA;     Line[{{xRight, 0}, {xRight, h}}]}]]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SBEOW.png&quot; alt=&quot;LocatorPane&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the alternative optimization code, where the center&amp;amp;radius are given explicitly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;manualAdjustments = {cx -&amp;gt; (xLeft + xRight)/2, r -&amp;gt; (xRight - xLeft)/2};&#xA;solution = &#xA;  FindMinimum[&#xA;   Total[minimize /. manualAdjustments], &#xA;    {{c1, 0}, {c2, rightMean - leftMean}, {c3, 0}, {c4, 0}, &#xA;     {top, topMean}, &#xA;     {height, bottomMean - topMean}, &#xA;     {tilt1, 0}, {tilt2, 0}}][[2]]&#xA;solution = Join[solution, manualAdjustments]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="291" LastEditorUserId="-1" LastEditDate="2017-04-13T12:55:35.443" LastActivityDate="2012-05-18T14:38:01.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2410" PostTypeId="1" AcceptedAnswerId="2444" CreationDate="2012-05-18T14:39:08.923" Score="9" ViewCount="937" Body="&lt;p&gt;I am looking at a hardware based platform for surveillance class of applications. I want to identify faces of people as they appear in the scene. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't intend to really apply face recognition (then or later). Also orientation of faces can be assumed straight for practical purposes. Face detected once needs no further processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there is a &lt;em&gt;fast&lt;/em&gt; (efficient) algorithm to detect faces from the live video source?&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-05-26T06:12:06.733" Title="What are some face detection (not recognition) algorithms suitable for limited (embedded) processors?" Tags="|hardware-implementation|face-detection|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2411" PostTypeId="1" AcceptedAnswerId="2504" CreationDate="2012-05-18T14:47:54.343" Score="39" ViewCount="53013" Body="&lt;p&gt;Adaptive thresholding has been discussed in a few questions earlier:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1659/adaptive-thresholding-for-liver-segmentation-using-matlab&quot;&gt;Adaptive Thresholding for liver segmentation using Matlab&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1932/what-are-the-best-algorithms-for-document-image-thresholding-in-this-example&quot;&gt;What are the best algorithms for document image thresholding in this example?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, there are many algorithms for Adaptive thresholding. I want to know which ones you have found most effective and useful. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which Adaptive algorithms you have used the most and for which application; how do you come to choose this algorithm?&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-05-13T13:56:42.690" Title="What are the most common algorithms for adaptive thresholding?" Tags="|image-processing|thresholding|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2412" PostTypeId="1" CreationDate="2012-05-18T16:06:27.870" Score="9" ViewCount="1828" Body="&lt;p&gt;This is a side-trip from my &lt;a href=&quot;https://dsp.stackexchange.com/questions/1828/how-to-distinguish-voice-from-snoring&quot;&gt;snoring app&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a crack at producing an autocorrelation of the audio signal, to see if that &quot;correlates&quot; with snoring/breathing very well.  I have a simple algorithm going (produces 1.0 as the zeroth element, which is a good sign), but I'm wondering how to evaluate the result to determine if the autocorrelation is strong, and, perhaps further, how to use it to separate various possible sound sources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question #1:  Is the RMS of the autocorrelation (skipping element zero) as good a &quot;quality&quot; metric as any, or is there something better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To elaborate:&lt;/strong&gt;  I simply want a numerical way (vs &quot;looking&quot; at a chart) to distinguish a highly autocorrelated signal from a less well autocorrelated one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I don't really know enough to know what other questions to ask.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some early results:&lt;/strong&gt;  In some cases autocorrelation (either RMS or peak) shows a dramatic jump on a snore -- precisely the response I'd like to see.  In other cases there is no apparent movement at all in these measures (and this can be two successive snores with the two responses), and in high-noise situations the measurements actually dip (slightly) during a snore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update -- 22 May:&lt;/strong&gt;  I finally got some time to work on this some more.  (I was pulled off on another app that is &lt;em&gt;literally&lt;/em&gt; a pain.)  I fed the output of the autocorrelation into an FFT and the output is somewhat interesting -- it shows a fairly dramatic peak near the origin when a snore starts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now I'm faced with the problem of quantizing this peak somehow.  Oddly, the highest peaks, in terms of absolute magnitude, occur at other times, but I tried the ratio of peak to arithmetic mean and that tracks pretty well.  So what are some good ways to measure the &quot;peakedness&quot; of the FFT.  (And &lt;em&gt;please&lt;/em&gt; don't say that I need to take an FFT of it -- this thing is already close to swallowing its own tail. :) )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, it occurred to me that the quality of the FFT might be improved somewhat if I mirror-reflected the autocorrelation results being fed in, with zero (which is by definition 1.0 magnitude) in the middle.  This would put the &quot;tails&quot; on both ends.  Is this (possibly) a good idea?  Should the mirror image be upright or inverted?  (Of course, I'll try it regardless of what you say, but I thought maybe I might get some hints on the details.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Tried flatness--&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My test cases can be divided roughly into the &quot;well-behaved&quot; category and the &quot;problem children&quot; category.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &quot;well-behaved&quot; test cases the flatness of the FFT of the autocorrelation dips dramatically and the ratio of peak to average autocorrelation climbs during a snore.  The ratio of those two number (peak ratio divided by flatness) is particularly sensitive, exhibiting a 5-10x climb during a breath/snore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &quot;problem children&quot;, however, the numbers head in exactly the opposite direction.  The peak/average ratio dips slightly while the flatness actually increases by 50-100%&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference between these two categories are (mostly) threefold:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Noise levels are (usually) higher in the &quot;problem children&quot;&lt;/li&gt;&#xA;&lt;li&gt;Audio levels are (pretty much always) lower in the &quot;problem children&quot;&lt;/li&gt;&#xA;&lt;li&gt;The &quot;problem children&quot; tend to consist of more breathing and less actual snoring (and I need to detect both)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update -- 5/25/2012:&lt;/strong&gt;  It's a little premature to have a victory dance, but when I reflected the autocorrelation about a point, took the FFT of that, and then did spectral flatness, my combined ratio scheme showed a good jump in several different environments.  Reflecting the autocorrelation seems to improve the quality of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One minor point, though, is that, since the &quot;DC component&quot; of the reflected &quot;signal&quot; is zero, the zeroth FFT result is always zero, and this kinda breaks a geometric mean that includes zero.  But skipping the zeroth element seems to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result I'm getting is far from sufficient to identify snores/breaths by itself, but it seems to be a fairly sensitive &quot;confirmation&quot; -- if I don't get the &quot;jump&quot; then it's probably not a snore/breath.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't analyzed it closely, but I suspect that what's happening is that a whistling sound occurs somewhere during the breath/snore, and that whistle is what's being detected.&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-05-25T17:55:37.187" Title="Best way to evaluate &quot;quality&quot; of autocorrelation?" Tags="|autocorrelation|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="2413" PostTypeId="2" ParentId="2412" CreationDate="2012-05-18T17:31:24.827" Score="1" Body="&lt;p&gt;The autocorrelation is directly related to the to inverse DFT of the power spectral density of your signal. In that sense, whatever information contained in the magnitude squared of your DFT is also contained in the autocorrelation function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said however, the one thing that autocorrelation can tell you is the presence of harmonics. (The distance from the center peak to the next highest one). Perhaps snoring VS breathing have different fundamental harmonics, and if so, the 'autocorrelation method' would certainly be a good starting point so that features, (in this case harmonics), can be extracted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the autocorrelation of white noise, will be a delta function, and will not have any secondary peaks (or any other peaks for that matter) off its center peak. In contrast, if the signal does have harmonics, then its autocorrelation function will contain secondary and tertiary peaks, commensurate with the fundamental harmonic present. The distance from the main (center) peak to the secondary peak the period of your fundamental frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what you are after is a measure - a number - codifying how similar an autocorrelation function is to a delta, VS an autocorrelation function looking like it has many peaks in it. To that end, the measure of &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;nofollow&quot;&gt;spectral-flatness&lt;/a&gt; might be applicable, or in a more general case, the measurement of your geometric mean to arithmetic mean. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-05-18T18:00:03.543" LastActivityDate="2012-05-18T18:00:03.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2416" PostTypeId="2" ParentId="2404" CreationDate="2012-05-19T12:55:52.080" Score="7" Body="&lt;p&gt;There are two things here: &lt;strong&gt;sparsity&lt;/strong&gt; and &lt;strong&gt;compressed sensing&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sparsity is a general hypothesis, just claiming that most of the energy of a signal is stored in a small number of coefficients in the good basis. This is quite intuitive, looking at Fourier transforms or wavelet transforms. It is true for probably any signal of interest (image, sound...) and explains why jpeg or mp3 compression work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quoting &lt;a href=&quot;http://jstarck.free.fr/jstarck/Home.html&quot;&gt;J-L Starck&lt;/a&gt; at &lt;a href=&quot;http://www.icip2011.org/&quot;&gt;ICIP'11&lt;/a&gt; (during the questions after his plenary talk):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Compressed sensing is a theorem.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What he means is that compressed sensing is a set of results that guarantees you that a sparse signal can be exactly recovered with very few measurements, provided you have the good sensing matrix, i.e. your measurements have some nice properties (someone  explained that to me as a kind of &lt;strong&gt;multiplexed sensing&lt;/strong&gt;). Reconstruction algorithms use the sparsity of the signal as additional information during the reconstruction process, usually by minimizing the L1 norm of the signal in some wavelet basis (recall that the L0-norm-constrained recovery problem is usually not solvable, because it is NP-hard).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2012-05-19T12:55:52.080" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2418" PostTypeId="1" AcceptedAnswerId="2431" CreationDate="2012-05-20T20:12:31.630" Score="4" ViewCount="561" Body="&lt;p&gt;Is there a more optimal peak location estimator specifically for triangle waves in AGWN, compared with peak estimation for generic waveforms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a &quot;smooth&quot; waveform in noise, a common peak locator method might involve a linear-phase low-pass filter or an overdetermined polynomial curve fit (by regression, et.al.), followed by a maxima/minima search.  But if the signal is known to be a sharp triangle wave (which may imply that any sampling included/aliased some non-filtered frequency content above Fs/2, if that is relevant), or portion thereof, and not a low order polynomial or other smooth waveform, can this information be used to improve the triangle peak location estimation?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added: Less than 1 period of the triangle wave may be available.  But assume at least one extrema is in the data window.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-21T01:24:39.340" LastActivityDate="2012-05-22T11:39:40.397" Title="Peak location estimation for a triangle wave in AGWN?" Tags="|peak-detection|estimation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2419" PostTypeId="2" ParentId="2418" CreationDate="2012-05-20T23:39:22.507" Score="0" Body="&lt;p&gt;My first guess would be to fit a sine wave + noise model to the data (using something like ESPRIT or MUSIC) ; use the estimated amplitude as the peak value, and $\frac{2 \pi k + \frac{\pi}{2} - \phi}{\omega}$ as peak locations. My intuition is that approximating a triangle wave by a sine wave isn't such a bad assumption - given how fast the spectrum of a triangle wave decays (only odd harmonics, with a $\frac{1}{n ^ 2}$ decay).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, works only if the amplitude and frequency of the triangle wave you want to monitor is stationary over a sufficiently large amount of samples.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-05-20T23:39:22.507" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2420" PostTypeId="1" AcceptedAnswerId="2421" CreationDate="2012-05-21T09:21:22.983" Score="17" ViewCount="8412" Body="&lt;p&gt;I have an image which is composed of multiple 'angles' which form a grid shape:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vq4Ch.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some searching, Hough seemed like a good fit, because it isn't troubled by breaks in lines. However, the problem I have is that my lines are 'fat', and any edge detection I run (Canny in this case), picks out the edges of the line, and not the middle:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LM63k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that the Hough transform ends up picking out one (or both) of the 'sides' of my grid lines, and not the middle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/taCS7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that I know what I'm looking for (this grid-like shape, always in roughly the same orientation), is there a better way to perform the 'edge detection' part to give me the centre lines, or should I be looking at a totally different method?&lt;/p&gt;&#xA;" OwnerUserId="1381" LastActivityDate="2012-05-25T07:01:55.480" Title="Alternatives to Hough transform for detecting a grid-like structure" Tags="|image-processing|hough-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2421" PostTypeId="2" ParentId="2420" CreationDate="2012-05-21T11:22:58.400" Score="10" Body="&lt;p&gt;The Hough Transform would indeed help in picking up the Grid in this case. To &quot;thin&quot; the lines, you might want to consider the operation of &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/skeleton.htm&quot; rel=&quot;noreferrer&quot;&gt;Skeletonization&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That would produce an image like this one:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2cwQk.jpg&quot; alt=&quot;Skeletonization Output&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the way that skeletonization works, it will still produce some lines that will seem irrelevant to the grid but these lines towards &quot;erroneous&quot; directions are not that many (at least in the given image) to confuse the line detection of the Hough Transform too much and it will clearly pick the two main sets of lines at distinct directions.&#xA;(Here is how the HT output looks like: )&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OQLRc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using MATLAB, you might want to check &lt;a href=&quot;http://www.mathworks.co.uk/help/toolbox/images/ref/bwmorph.html&quot; rel=&quot;noreferrer&quot;&gt;this help page&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2012-05-21T11:32:19.730" LastActivityDate="2012-05-21T11:32:19.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2422" PostTypeId="1" AcceptedAnswerId="2423" CreationDate="2012-05-21T16:03:42.887" Score="13" ViewCount="4568" Body="&lt;p&gt;I am trying to extract features from an image, but I have failed to get the points that I want to extract, and hence my image fails to match with the template.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any checkpoints that I have to go through before applying SIFT to my image so that I get good results? For example the template image is;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OJJAw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;targeted image;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VRH6l.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1399" OwnerDisplayName="KT Harris" LastEditorUserId="1399" LastEditDate="2012-05-23T13:13:35.193" LastActivityDate="2014-07-14T09:13:16.097" Title="Is sift a good way to extract features from an image?" Tags="|matlab|image-processing|sift|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2423" PostTypeId="2" ParentId="2422" CreationDate="2012-05-21T16:14:33.903" Score="14" Body="&lt;p&gt;What you are supposed to do when matching a template to an image using sift is to run sift against your template and then look for those sift features in that arrangement in your scene.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rule of thumb: Compare like to like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sift(Template) Contained Within Sift(Image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You cannot tune Sift to extract the &quot;features you want&quot; Sift *uses invariant measures to find features that it believes are most salient. (*Chris A)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want it to find particular features from your template make smaller templates of those features and search for them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a suggestion. I do not know exactly what type of template you are trying to fit to what type of scene or image.&lt;/p&gt;&#xA;" OwnerUserId="1397" OwnerDisplayName="Totero" LastEditorUserId="1397" LastEditDate="2012-05-21T21:56:31.123" LastActivityDate="2012-05-21T21:56:31.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2424" PostTypeId="1" AcceptedAnswerId="2425" CreationDate="2012-05-21T21:46:21.857" Score="10" ViewCount="3209" Body="&lt;p&gt;&lt;em&gt;Disclaimer&lt;/em&gt;: I &lt;a href=&quot;https://stackoverflow.com/questions/10661521/idea-needed-about-vehicle-counting-by-analysing-the-white-pixels-of-the-binary-f&quot;&gt;posted this question on StackOverFlow&lt;/a&gt; but learned that it is better suited here.&lt;/p&gt;&#xA;&lt;p&gt;I am a bit new to image processing so I'd like to ask you about finding the optimal solution for my problem, not help for code.&#xA;I couldn't think of a good idea yet so wanted to ask your advice.&lt;/p&gt;&#xA;&lt;p&gt;I'm working on a project using OpenCV on counting the vehicles from a video file or a live camera. Other people working on such a project generally track the moving objects then count them but instead of that, I wanted to work with a different viewpoint; asking user to set a ROI (Region of interest) on the video window and work only for this region (for some reasons, like to not deal with the whole frame and some performance increase), as seen below. (The user can set more than one ROI and the user is asked to set the height of the ROI about two times of a normal car by sense of proportion.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aWwlz.png&quot; alt=&quot;picture1&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've done some basic progress so far, like background updating, morphological filters, thresholding and getting the moving object as a binary image something like below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/29ZgS.png&quot; alt=&quot;picture2&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;After doing them, I tried to count the white pixels of the final thresholded foreground frame and estimate whether it was a car or not by checking the total white pixels number (I set a lower bound by a static calculation by knowing the height of ROI). To illustrate, I drew a sample graphic:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MgvZe.jpg&quot; alt=&quot;picture3&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, it was easy to calculate the white pixels and check if it draws a curve by the time and determining whether a car or something like noise.&lt;/p&gt;&#xA;&lt;h1&gt;Problem&lt;/h1&gt;&#xA;&lt;p&gt;I was quite successful until two cars passed through my ROI together at the same time. My algorithm incorrectly counted them as one car. I tried different approaches for this problem and similar to this like long vehicles but I haven't found a satisfactory solution.&lt;/p&gt;&#xA;&lt;h1&gt;Question&lt;/h1&gt;&#xA;&lt;p&gt;Is it possible to handle this task by this approach of pixel value counting? If not, what do you suggest?&lt;/p&gt;&#xA;" OwnerUserId="1396" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-05-21T23:43:49.447" Title="Vehicle counting from a video" Tags="|computer-vision|opencv|motion-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2425" PostTypeId="2" ParentId="2424" CreationDate="2012-05-21T23:43:49.447" Score="5" Body="&lt;p&gt;You can keep track of the last 10-15 frames and count the number of white pixel of these frames. You can differentiate if it is a vehicle or not, since the graph will be high for 10-15 frames you will be able to say that it is a vehicle otherwise it is noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To count multiple cars in multiple side by side lanes you can check the pixels column wise, I mean vertically. For the time being you must be checking the pixels horizontally for white pixels. &lt;/p&gt;&#xA;" OwnerUserId="1398" LastActivityDate="2012-05-21T23:43:49.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2426" PostTypeId="1" AcceptedAnswerId="2427" CreationDate="2012-05-22T01:30:55.740" Score="19" ViewCount="22206" Body="&lt;p&gt;In term of proper or accepted naming conventions of DSP graphics or instrumentation output, what is the difference between the words spectrum, spectrogram, spectrograph, and similar terms, and what type of chart, graph, CRT display, or etc. does each best describe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDED: Also I found the term sonogram used in a couple books for spectrum-vs-time graphics.  When might thus be appropriate in preference to one of the above terms, or vice versa?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-09-26T19:43:45.237" LastActivityDate="2021-07-14T10:54:44.673" Title="Terminology: spectrum, spectrogram, spectrograph, sonogram, etc" Tags="|frequency-spectrum|terminology|visualization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2427" PostTypeId="2" ParentId="2426" CreationDate="2012-05-22T02:20:09.267" Score="24" Body="&lt;p&gt;It depends on context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In signal processing, a &lt;a href=&quot;https://en.wikipedia.org/wiki/Frequency_spectrum&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;spectrum&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; (plural is &lt;strong&gt;&lt;em&gt;spectra&lt;/em&gt;&lt;/strong&gt;) shows the frequency content of an entire signal.  It's a 1-dimensional function of amplitude (vertical axis) vs frequency (horizontal axis):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7n8Uw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectra are often shown with a logarithmic amplitude axis (such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Decibel&quot; rel=&quot;noreferrer&quot;&gt;dB&lt;/a&gt;), but this isn't necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A machine that produces a spectrum is usually called a &lt;strong&gt;&lt;em&gt;spectrum analyzer&lt;/em&gt;&lt;/strong&gt;.  In other fields, the machine is called a &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectrograph&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;spectrograph&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectrometer&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;spectrometer&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;spectrogram&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; shows how the frequency content of a signal changes over time. It's a 2-dimensional function of amplitude (brightness or color) vs frequency (vertical axis) vs time (horizontal axis):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JU8rP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes this is called a &lt;a href=&quot;http://www.wavemetrics.com/products/igorpro/dataanalysis/signalprocessing/timefrequency.htm&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;sonogram&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.  The time and frequency axes are sometimes swapped.  If amplitude is shown as a 3D surface rather than using color, it's called a &lt;strong&gt;&lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Waterfall_plot&quot; rel=&quot;noreferrer&quot;&gt;waterfall plot&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Confusingly, a machine that produces a spectrogram is &lt;em&gt;also&lt;/em&gt; called a &lt;em&gt;spectrograph&lt;/em&gt;, or &lt;em&gt;spectrograph&lt;/em&gt; is used as a synonym for &lt;em&gt;spectrogram&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the line is kind of blurred, because if you view the spectrum of a live signal on a spectrum analyzer, it's displaying the spectrum of small chunks of the signal and you're seeing how it changes over time, which is essentially the same thing as a spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the important distinction is just the way they're displayed:  A spectrum is a 1D plot and a spectrogram is a 2D plot.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-12-27T20:44:22.287" LastActivityDate="2013-12-27T20:44:22.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2430" PostTypeId="2" ParentId="2404" CreationDate="2012-05-22T11:34:57.403" Score="11" Body="&lt;p&gt;Like @sansuiso said, compressed sensing is a way of acquiring signals that happens to be efficient if the signals are sparse or compressible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compressed Sensing is efficient because signals are multiplexed, hence the number of multiplexed samples (called measurements) is smaller than the number of samples required by Shannon-Nyquist where there are no strong assumptions on the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the noiseless case, it can be shown that compressive sensing reconstruction solver can recover an exact solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the compressible case, as opposed to the strictly sparse case, it can be shown that the reconstruction error is bounded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yes most signals, including ultrasounds are somehow either sparse or compressible. It generally comes down to figuring out the dictionary where the signal is sparse. Domain experts generally know these things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interesting question you have is: Imagine you have a non sparse signal and then add zeros to make it sparse and then use compressed sensing to sample that signal, wouldn't it better than directly sampling the full signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that the sampling requirements for which CS work require more infromation than just performing a full sampling of the original (full/non-zero) signal. In other words, the number of CS measurements required would be higher than the number of non-zero elements in the signals. By sparsifying the signal, you are &quot;losing&quot; on purpose the information about where the signal is supported (i.e. non-zero). The hard part of Compressive Sensing and attendant reconstruction solvers is to find that location where those non zero elements of the signal live: If you know beforehand the locations of those non zero elements, then there is no need to go to a less efficient method of sampling that signal. Indeed, finding the location of the non-zero elements of a signal is the reason we talk about compressive sensing being NP-Hard, BPP and so forth..... Up until 2004, we thought it was hard to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me put it some other way: Let us assume a signal has K non zero components. If you know the location of these K elements, then you need only K information to know your signal. If you add zeros anywhere in the signal and make that signal of size N, you now need to sample the signal N times through traditional sampling or  O(Klog(K/N)) times with a compressive sensing approach. Since O(Klog(K/N) &gt; K, losing the information about the location of the non zeros elements has yielded a larger set of samples/measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be interested in reading my small blog on the subject: &#xA;&lt;a href=&quot;http://nuit-blanche.blogspot.com/search/label/CS&quot; rel=&quot;noreferrer&quot;&gt;http://nuit-blanche.blogspot.com/search/label/CS&lt;/a&gt;&#xA;And the following resource:&#xA;&lt;a href=&quot;http://nuit-blanche.blogspot.com/p/teaching-compressed-sensing.html&quot; rel=&quot;noreferrer&quot;&gt;http://nuit-blanche.blogspot.com/p/teaching-compressed-sensing.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="717" LastEditorUserId="717" LastEditDate="2012-07-04T09:16:06.530" LastActivityDate="2012-07-04T09:16:06.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2431" PostTypeId="2" ParentId="2418" CreationDate="2012-05-22T11:39:40.397" Score="3" Body="&lt;p&gt;You may be able to determine this in the frequency domain. The noise signal is broad band and has low spectral density at any one frequency. The triangle, however, has all energy concentrated in just a few frequencies, so these should stick out in a short term Fourier spectrum. You can match against your expected spectrum (odd harmonics, amplitude proportional to 1/n^2). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The harmonics of a triangle are all in phase. Since your triangle wave is arbitrarily located inside your analysis window, the harmonics will appear to have a linear phase. You can probably model your measured phase (after proper unwrapping) as a linear phase using a simple least squares error approach. This should give you the exact position of the peak of the triangular wave with respect to the beginning for your analysis window.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-05-22T11:39:40.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2432" PostTypeId="1" CreationDate="2012-05-22T13:46:46.623" Score="4" ViewCount="561" Body="&lt;p&gt;I was wondering if any one with experience with both sensors can give some insight on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've heard there can be problems with alignment of the different signals using a 3CCD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when using the Bayer filter, you need to convert, and you have problems of lower resolution, introducing colors that are not there in reality, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is one of the two best usable? Or is it application specific?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Maybe I can add some extra questions to make the question more clear. For the record, I'm not asking this question for a specific project, I'm just interested in the differences between 3CCD or Bayer in general. I know the basic (hardware) differences between 3CCD and Bayer, but I'm looking for general &lt;em&gt;details&lt;/em&gt; about the differences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These type of questions come to my mind:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In an application that is based on color will it always add &lt;strong&gt;significant&lt;/strong&gt; color information when using 3CCD instead of Bayer?&lt;/li&gt;&#xA;&lt;li&gt;Are there other solutions instead of 3CCD to overcome the problems with Bayer? (thanks Ktuncer)&lt;/li&gt;&#xA;&lt;li&gt;What exactly are the significant differences between 3CCD and Bayer (not application specific, and if application specific, in what kind of applications could it be significant)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="809" LastEditorUserId="809" LastEditDate="2012-07-09T06:53:37.440" LastActivityDate="2012-07-09T10:31:07.650" Title="3CCD or monochrome with Bayer filter?" Tags="|camera|hardware|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2433" PostTypeId="1" AcceptedAnswerId="2434" CreationDate="2012-05-18T13:58:44.400" Score="6" ViewCount="6980" Body="&lt;p&gt;My team is working on a program that can read nutrition facts labels using OCR, much like &lt;a href=&quot;http://www.nutriscanner.com/index.html&quot; rel=&quot;noreferrer&quot;&gt;NutriScanner&lt;/a&gt; (though &lt;a href=&quot;http://itunes.apple.com/us/app/nutriscanner-nutrition-facts/id458063765?ls=1&amp;amp;mt=8&quot; rel=&quot;noreferrer&quot;&gt;by its reviews&lt;/a&gt; it doesn't seem like it works particularly well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen other questions noting that it'd be a good idea to straighten out the image prior to running OCR on it. Is there a good image library that can automatically do that? I've looked around and found numerous Photoshop tutorials on how to do it manually, but that's not what I'm looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know OCR engines like ABBYY have some pre-processing features built-in, but I'd prefer to piece together a solution using Tesseract and a free library for the pre-processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't found much in the way of leveraging the positioning of the items on the label to improve scanning accuracy, but any suggestions would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1404" OwnerDisplayName="ikim" LastActivityDate="2012-05-22T14:17:31.690" Title="Nutrition facts label OCR" Tags="|image-processing|ocr|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2434" PostTypeId="2" ParentId="2433" CreationDate="2012-05-19T00:33:27.333" Score="8" Body="&lt;p&gt;Been there, done that.  One of our on-going projects is to create a process for processing nutrition labels from iPhone camera for a health-tracking app.  My company decided to develop a solution for this particular application - extracting data from US nutrition labels.  This solution will be used for this client, but we decided to pre-package a few other flexible capabilities along the way, to be used by a wider audience.  The solution will be available to general public in about 3 weeks.  (I'll come back here and post an update.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Main goal that will make or break the entire idea is to get usable images.  Curved images, heavy shading, low resolution, and blur will all substantially decrease OCR quality, often to no quality.  In apps, we found that user training and guidance is the most helpful method.  Then there are some technical tools such as quickly detecting quality of image and suggesting to re-take it if needed.  In general, if you can achieve &quot;high quality fuel&quot; (images) you can expect high performance from your &quot;machine&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, the OCR.  Tesseract can do good job reading clear and simple test such as pages from books.  Commercial products such as ABBYY distinguish themselves by working well on tough images - shading, distortions, small prints, etc.  And unfortunately if mobile images are used, they are more often on bad side than good quality side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, pick your approach to locating and extracting data.  Please see my answer on text parsing vs specialized test extraction tools:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/3070732/processing-ocred-text&quot;&gt;https://stackoverflow.com/questions/3070732/processing-ocred-text&lt;/a&gt;&#xA;For our project we'll be using &lt;a href=&quot;http://www.wisetrend.com/abbyy_flexicapture.shtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;ABBYY FlexiCapture&lt;/a&gt; for targeted nutrition data.  It has special tools even when OCR makes mistakes to still find appropriate data (sort of controlled fuzzy search), and that was an important factor in selecting it for the task.&lt;/p&gt;&#xA;" OwnerDisplayName="Ilya Evdokimov" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-05-19T00:33:27.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2435" PostTypeId="1" CreationDate="2012-05-23T01:25:40.747" Score="9" ViewCount="1652" Body="&lt;ul&gt;&#xA;&lt;li&gt;What is the theory behind LPC?  &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why are(were) certain implementations of LPC said to be more tolerant of transmission or encoding &lt;strike&gt;errors&lt;/strike&gt; quantization than other compressed voice encoding schemes?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can LPC methods also be used for smoothing or short term &quot;prediction&quot; similar to the use of Kalman filter methods?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Under what conditions or constraints is the use of LPC valid?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="154" LastEditorUserId="1629" LastEditDate="2016-09-09T18:42:19.967" LastActivityDate="2016-09-09T18:42:19.967" Title="Theory behind Linear Predictive Coding (LPC)" Tags="|linear-systems|voice|compression|linear-prediction|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2436" PostTypeId="2" ParentId="2435" CreationDate="2012-05-23T02:32:32.173" Score="15" Body="&lt;p&gt;First, to say linear predictive coding (LPC) is &quot;more tolerant of transmission or encoding errors&quot; isn't entirely true. The form in which the coefficients is transmitted makes a big difference. For example, if the linear prediction coefficients are solved for, they can be very sensitive to quantization, much like high order IIR filter coefficients (this is because the synthesis filter will be IIR, but more on that later). However, if they are transmitted in some other form, this problem can be mitigated easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way is to transfer the reflection coefficients. If you recursively solve for a k-th order linear prediction filter, the highest order coefficient at each stage is called the reflection coefficient. These can be used together to completely characterize the system (which can easily be seen from the Levinson recursion). In fact, you can use all of them together to form a lattice filter. These filters are often used when quantization is a concern, as they're much more robust to low bit counts. In addition, if the magnitude of these reflection coefficients are bounded by unity, you're guaranteed a BIBO stable filter which is critical for LPC where the filter is used to synthesize your signal. There are other methods such as line spectral pairs which are frequently used, but aren't as intuitively defined as the reflection coefficients in relation to AR modeling for LPC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to address the first question, the theory of LPC revolves around vocal tract modeling. Essentially, we're modeling speech as air vibrating as an input to a tube of some structure. You can look for some resources that go into much more detail to flesh out this model (length of tubes, intensity of air, structure etc). These resources relate these structures directly to IIR filters responding to various stimuli, white noise for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when we solve for the linear prediction coefficients, we're looking for the coefficients such that if we input our signal (voice for example) into an FIR filter created from the coefficients, we get white noise as an output. So think about what that means. We're inputting a &lt;em&gt;highly&lt;/em&gt; correlated signal, and outputting a white noise sequence. So in effect, we're removing all linear dependence of that signal. Another way to look at this, is that all of the meaningful information is contained in the coefficients that remove this linear dependence. Therefore, we can transfer these coefficients (or some form of them as above), and the receiving end can recreate the signal. This is done by inverting the linear predictive FIR filter to create an IIR filter, and inputting white noise. So the compression comes in from removing this linear dependence, and transferring the coefficients. This is why the Burg method is also sometimes referred to as the maximum entropy method, as it aims to maximize the &quot;randomness&quot; or whiteness of the output noise in the linear prediction filter. Another way to look at this, outside of physical modeling, is that vocal spectrum (with exception to unvoiced sounds such as hissing) tend to be very impulsive, making them excellent candidates for AR modeling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your final question, I'm not sure what you're asking entirely. LPC, or linear predictive coding is meant to &quot;compress&quot; the signal assuming that it can be efficiently modeled as previously discussed. You can certainly use linear prediction to do &quot;shortterm prediction&quot; as you've mentioned. This is the implicit basis behind the high resolution AR methods used for power spectral density estimation. The autocorrelation sequence may be recursively extended from it's finite form from the limited data record to infinity as the theoretical autocorrelation sequence of the unwindowed sequence. This is also why AR methods of PSD estimation don't exhibit sidelobe phenomena. &lt;/p&gt;&#xA;" OwnerUserId="1279" LastActivityDate="2012-05-23T02:32:32.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2437" PostTypeId="1" CreationDate="2012-05-23T05:21:33.217" Score="4" ViewCount="823" Body="&lt;p&gt;An accelerometer is used on a high vibration environment (a bicycle) to measure  gravity. The signal clips, so data higher than a clipping value is clamped to that value. &#xA;So, simply filtering the signal gives the wrong &lt;del&gt;median&lt;/del&gt; mean value when the vibration is high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the mean value over a time much longer than the vibration frequency, so a few second filter is fine. I do not care about the vibration waveform itself. Just want the average value. How to remove the error caused by the clipping?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bad idea one:&lt;br&gt;&#xA;I had suggested that the signal's noise distribution be modeled, the amount of clipping predicted based on measured vibration amplitude, and that used to correct the data. Maybe the distribution is Rayliegh, maybe Gaussian, maybe... So maybe that first idea is not a good one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly brilliant idea two:&lt;br&gt;&#xA;But how about just measuring the distribution on the spot? Make a histogram with several bins, accumulating a count in a bin each time the sampled data is in a bin's range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, fit a curve over the top 3 or 5 highest bins, and the position of the peak is &lt;del&gt;the signal median&lt;/del&gt; the modal mean, where the signal mean value would be, if it were not clipped. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this crazy? Good? Done before and has a name?&lt;/p&gt;&#xA;" OwnerUserId="1406" LastEditorUserId="90" LastEditDate="2012-05-23T14:52:29.560" LastActivityDate="2012-05-23T15:28:57.280" Title="How to estimate the mean of a clipped signal?" Tags="|noise|statistics|estimation|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2438" PostTypeId="2" ParentId="2437" CreationDate="2012-05-23T09:38:59.493" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this crazy? Good? Done before and has a name?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I wouldn't say that it is &quot;Good&quot; because clipping is not noise that can be modeled as an additive component with some distribution.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;fit a curve over the top 3 or 5 highest bins, and the position of the&#xA;  peak is the signal median&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The position of that peak would be the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mode_%28statistics%29&quot; rel=&quot;noreferrer&quot;&gt;modal mean&lt;/a&gt;, not &lt;a href=&quot;http://en.wikipedia.org/wiki/Median&quot; rel=&quot;noreferrer&quot;&gt;the median&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect of clipping on the signal's distribution would be to a) truncate the real distribution (whatever that is) at the maximum (which depends on the sensor &amp;amp; measurement (or &quot;environment&quot; as you put it) and b) distort the distribution towards this maximum depending on how much clipping was present in the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) means that whatever you do, your median / mean will be biased by the amount of clipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, you would have to change the sensor to one that can respond to higher accelerations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you absolutely must use the current sensor and deal with the clipping then prior to any further processing of its output you could try removing the clipped values (with a simple thresholding operation) and fitting a curve to the data. If you were to fit &lt;a href=&quot;http://en.wikipedia.org/wiki/Spline_%28mathematics%29&quot; rel=&quot;noreferrer&quot;&gt;an spline&lt;/a&gt; for example, then the curve would depart at the beginning of the clipped part with the slope of the usable signal prior the clipping and arrive at the end of the clipped part with a slope of the usable signal after the clipping. In this way, all clipped parts will be converted to some &quot;soft&quot; peak (because of the splines &quot;smoothing&quot; effect). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this is a compromise. It could well be that the clipping is so much that very little &quot;usable&quot; signal remains on either side to fit a &quot;good&quot; spline. Furthermore, depending on your sampling frequency ($Fs$), the signal might be full of impulse-like data which would lead to &quot;very tall&quot; splines as the algorithm would try to fit the sharp slopes. More information would be needed to take a decision on that but in general a higher $Fs$ would help.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-05-23T09:38:59.493" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2439" PostTypeId="2" ParentId="1232" CreationDate="2012-05-23T10:03:33.040" Score="2" Body="&lt;p&gt;The following article describes a short-time Fourier transform (STFT) based phase vocoder, as well as a pitch synchronous overlap-add (PSOLA) technique to tackle time and pitch modifications of audio signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moulines, E. &amp;amp; Laroche, J.&lt;br&gt;&#xA;&quot;&lt;em&gt;Non-parametric techniques for pitch-scale and time-scale modification of speech&lt;/em&gt;&quot;,&lt;br&gt;&#xA;Speech Communication, 1995.&lt;br&gt;&#xA;(some PDF versions available in links from &lt;a href=&quot;http://scholar.google.ch/scholar?cluster=4275913442942949973&amp;amp;hl=de&amp;amp;as_sdt=0,5&quot; rel=&quot;nofollow&quot;&gt;google scholar&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="1301" LastActivityDate="2012-05-23T10:03:33.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2440" PostTypeId="2" ParentId="1232" CreationDate="2012-05-23T11:19:37.707" Score="22" Body="&lt;p&gt;I fear that all answers here are irrelevant to the question.&#xA;What is called a &lt;em&gt;vocoder&lt;/em&gt; in the music production world has little to do with the &lt;em&gt;phase vocoder&lt;/em&gt; used in signal processing. To make matters worse the &lt;em&gt;Songify&lt;/em&gt; app referenced by the original post is not an example of vocoder. Let us sort this out!&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;1. Phase vocoder&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;em&gt;phase vocoder&lt;/em&gt; referenced by the other answers is a signal processing technique that can be used to perform time/pitch modification of signals (time-stretching, pitch-shifting), by computing a time-frequency representation of the signal (short term Fourier Transform, or STFT) and then inserting/removing signal frames and then maintaining the coherence of the phase information. Its relationship to voice is only historical, and it is currently used for pitch-shifting and time-stretching in lower-end audio hardware/software. &lt;a href=&quot;http://breakfastquay.com/rubberband/&quot; rel=&quot;nofollow noreferrer&quot;&gt;RubberBand&lt;/a&gt; is an example of open-source C++ time/pitch alteration library based on a phase-vocoder.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. Vocoder&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;When people in the field of music production refer to a Vocoder, they refer to a device extracting the spectral envelope of a signal (usually voice, called the modulator), and filtering an other signal (usually a rich synth texture, called the carrier) with a filter whose response is the extracted spectral envelope. For an example of resulting sound, listen to 0:23 in Kraftwerk &lt;a href=&quot;https://www.youtube.com/watch?v=PHiN26vn2ec&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trans Europe Express&lt;/a&gt;, or Alan Parsons' Project &lt;a href=&quot;https://www.youtube.com/watch?v=N3fHbjOsSaE&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Raven&lt;/a&gt; from the few first seconds. The resulting effect is a vocal-like timbre applied to the melody or chords played by the carrier signal, giving the feeling that a voice is spoken through a synthesizer.&lt;/p&gt;&#xA;&lt;p&gt;The vocoder being originally an analog device, it was implemented with two banks of a dozen or more bandpass filters with high Q. The modulator signal is sent through the first filter bank, and the amplitude of all the sub-band signals is tracked with an array of envelope followers. In parallel, the carrier signal is sent through another filter bank. Each sub-band is amplified (with a VCA) with the gains given by the envelope followers. If you read analog, you can have a look at the schematics of a &lt;a href=&quot;http://web.archive.org/web/20111218063103/http://www.jhaible.de/vocoder/schematics/channel_4.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;vocoder channel here&lt;/a&gt;, from Jurgen Haible's &lt;a href=&quot;http://web.archive.org/web/20100924141535/http://www.jhaible.de/vocoder/living_vocoder.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;living Vocoder&lt;/a&gt; - on top the modulator signal filter, at the bottom the carrier filter and the VCA. Software implementations of vocoders stay close to this, simply because music producers expect vocoders to sound like the classic analog devices! But if you don't want fidelity to the &amp;quot;vintage&amp;quot; devices, and want something cheaper than 40 biquads, another way to achieve the same result is to estimate an all-pole filter (of order 8 to 20 depending on how close you want to get to the original voice) from the modulator signal (AR-modeling) ; and then apply this filter to the carrier. The typical problem here is that you'll need to update your filter coefficients every 20ms frame or so ; so you need a representation of the all-pole filter which handles well abrupt coefficient updates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;3. Auto-tune and pitch-remapping&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;What Songify does is the following: extract the prosody (pitch contour) of the recorded voice, and alter it so that the resulting pitch contour matches a target melody. This is a bit similar to what auto-tune does, with the difference that auto-tune &amp;quot;rounds&amp;quot; the pitch toward the nearest musically accurate semitone, while Songify just pushes it a target value.&lt;/p&gt;&#xA;&lt;p&gt;The algorithms at work here are very different from traditional pitch-shifting time-stretching, because the voice signal is monophonic and fits well the source-filter model. Approaches like Time-Domain Pitch-Synchronous-Overlap-Add (TD-PSOLA) are much more efficient, both computationally and in terms of quality, for transparently altering the pitch of voice than generic time-stretch algorithms (usually done with phase-vocoders). These are used for example in speech synthesis to alter the prosody of a synthesized sentence - not unlike Songify indeed! Auto-tune is also based on such time-domain methods (detecting full cycles of the input waveform and resampling them).&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5OfqR.gif&quot; alt=&quot;PSOLA illustration&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="7092" LastEditDate="2022-07-26T17:30:15.673" LastActivityDate="2022-07-26T17:30:15.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2441" PostTypeId="1" CreationDate="2012-05-23T12:39:05.250" Score="3" ViewCount="66" Body="&lt;p&gt;I'm a sleep researcher and since last december I've been collecting data on mydreaming and awakening in the middle of the night. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dreaming occurs within a well-known 80-120 minute &quot;cycles&quot;, with about 5-6 cycles within a typical night. Each cycle is defined by 4 stages, from light sleep to deep sleep to dreaming. I'm lucky enough that most of the time I wake up after or close to the dreaming sleep stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The start of the sleep cycles depends on the choice of bedtime, which in turn is governed by a larger, ~24.5 hour circadian rhythm, which is entrained by the light/dark cycle. &#xA;The circadian rhythm is exhibited by all cells within a body as well as major organ systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I'm trying to do is better understand the circadian rhythm by analyzing discrete awakening events that I experience over night.&lt;/strong&gt; On the attached screenshots;&#xA;Each row represents one day of data. The events are plotted in real time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each discrete awakening from a  dream is marked in &lt;strong&gt;green&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each non-dream awakening is marked in &lt;strong&gt;red&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each lucid - conscious dream is marked in &lt;strong&gt;cyan&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each morning &quot;get out of bed&quot; time is marked in &lt;strong&gt;Orange&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The onset of the first sleep cycle is marked in &lt;strong&gt;black&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each row has 2 rulers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;purple ruler&lt;/strong&gt;'s ticks are 90 minutes apart - the approximate sleep cycle length&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;cyan ruler&lt;/strong&gt; represents real time starting with 0 midnight, going to noon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Together, the markers form vertical patterns, with dream awakenings happening at approximately the same times on subsequent days, with the pattern sloping one way or the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I analyze hundreds of discrete data points like that to see if they do form some kind of a waveform that persists from day to day?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be grateful for the keywords related to the transforms or algorithms that can help make more sense of such data, as well as any engineering articles dealing with a similar problem, or any other input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://luciddreamingapp.com/my-90-day-sleep-history/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Full 90 day sleep history&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VvQJM.png&quot; alt=&quot;Sleep Data 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ESttF.png&quot; alt=&quot;Sleep Data 2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="480" LastActivityDate="2012-05-23T12:39:05.250" Title="How to analyze a pattern of discrete events belonging to a 24 hour and ~90 minute cycle?" Tags="|discrete-signals|real-time|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2442" PostTypeId="2" ParentId="2437" CreationDate="2012-05-23T12:39:14.403" Score="1" Body="&lt;p&gt;Just to clarify (or perhaps muddy) the issue, I can see that you might have this problem if you were attempting something along the lines of using the accelerometer to calculate speed/distance over a relatively long period (&quot;relatively long&quot; here being seconds to hours, depending).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want the average (and I'd have to sit and think about it a couple of hours to say &lt;em&gt;which&lt;/em&gt; average) acceleration over time to determine speed and distance, but short clipped transients can disrupt that average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the problem is &lt;em&gt;interpolating&lt;/em&gt; the missing data.  This involves first recognizing that the data is missing (possibly simple in this case since the value returned is at/near the maximum for the sensor) and then somehow figuring out what's missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may be aided to an extent by the fact that, with an accelerometer, a positive transient is very likely to be closely followed by a corresponding negative transient, though the negative will probably be more spread out and less &quot;spikey&quot;.  (So it occurs to me that one solution may be to simply ignore both the positive and accompanying negative transients, on the assumption that they cancel out.)  At the very least, analyzing the negative transient may give you insight into the magnitude of the positive transient -- the area-under-the-curve thing, etc.&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-05-23T12:39:14.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2443" PostTypeId="2" ParentId="2437" CreationDate="2012-05-23T15:21:45.620" Score="1" Body="&lt;p&gt;If clipping occurred for any finite span of time and the vibration peak is unbounded, then the actual mean value could be anything (large). However the peak might actually be bounded, under the assumption that you were not killed by the peak acceleration, nor the bike destroyed.  That assumption about the maxima of the peaks would limit the possible range of the mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If data is missing, then one possibility is to model the data or data distribution, then do a best fit of the model parameters to the valid portion of the data, and take the mean of the model.  For instance you could try fitting the the data to suspected statistical distributions (a clipped Gaussian, etc.) with a known mean.  However, whether this works depends on whether the model describes the actual accelerations before clipping.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-23T15:28:57.280" LastActivityDate="2012-05-23T15:28:57.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2444" PostTypeId="2" ParentId="2410" CreationDate="2012-05-23T18:53:48.287" Score="3" Body="&lt;p&gt;We know that the problem is solved because our cell phones and digital cameras can do it. You might be able to find out what algorithm they use by trawling the patent databases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computer vision libraries like OpenCV and SimpleCV offer face detection as a standard feature. See for example &lt;a href=&quot;http://www.morethantechnical.com/2009/08/09/near-realtime-face-detection-on-the-iphone-w-opencv-port-wcodevideo/&quot; rel=&quot;nofollow&quot;&gt;Near realtime face detection on the iPhone w/ OpenCV port&lt;/a&gt;. If you want to DIY see &lt;a href=&quot;http://cat.hfu.edu.tw/~b8403009/TD-006386.pdf&quot; rel=&quot;nofollow&quot;&gt;Simple Face-detection Algorithm Based on Minimum Facial Features&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-05-23T18:53:48.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2445" PostTypeId="1" CreationDate="2012-05-23T20:35:50.470" Score="12" ViewCount="9776" Body="&lt;p&gt;Given an arbitrary frequency response, what signal processing methods might exist that could guess, estimate or determine a transfer function (pole and zero constellation) which gives a &quot;reasonably good&quot; approximation (for some given estimation quality criteria) to that given frequency response?  What means exist to estimate the number of poles and zeros required for a given transfer function plus a given approximation error allowance?  Or how could one determine these constraints can't be met, if possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the given frequency response was actually produced by a known transfer function, will any of these methods converge on that original transfer function?  How about if the given frequency response were subject to (assumed Gaussian) measurement errors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume working in the Z-plane with sampled spectrum, although continuous domain answers might also be interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added: Are the solution methods any different if only the magnitude of the frequency response is given (e.g. a solution with any phase response is allowed)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added: The latter problem is what I'm most interested in, given a known magnitude response around the unit circle, but unknown/unmeasured phase response, can the measured system be estimated, and if so under what conditions?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-03-12T16:05:49.217" LastActivityDate="2022-05-24T11:47:48.883" Title="How to estimate a transfer function from a magnitude-only frequency response?" Tags="|transfer-function|frequency-response|zeros|" AnswerCount="3" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2446" PostTypeId="1" AcceptedAnswerId="2447" CreationDate="2012-05-23T23:24:43.113" Score="6" ViewCount="1358" Body="&lt;p&gt;I want to observe how the signal's phase changes over time and I know Hilbert transform can be used here to get the analytic signal, from which I can extract the amplitude and phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that to get the analytic signal $x_a(t)$ from a continuous-time signal $x(t)$ I need to calculate this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_a(t) = x(t) * \mathcal F^{-1}\left\{2\cdot u(w)\right\},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $*$ is the convolution operation, $\mathcal F^{-1}\left\{\cdot\right\}$is the inverse Fourier transform, and $u(w)$ is the Heaviside/unit step function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal F^{-1}\left\{2 \cdot u(w)\right\} = c_1\cdot \frac{j}{t} + c_2\cdot\delta(t),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $c_1$ and $c_2$ are some constants, $j$ is the square root of $-1$, and $\delta(t) $ is the Dirac delta function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I want to do this convolution with a discrete-time (sampled) signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While implementing the code for this I've discovered that the $\mathcal F^{-1}\left\{u[w]\right\}$ doesn't look at all like $c_1\cdot\frac{j}{t}$ and vice versa $\mathcal F\left\{\frac 1k\right\}$ doesn't look at all like $-j\cdot\operatorname{sign}[w]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, if I calculate $\displaystyle h[k]_{0 \leq k \leq 63}= \frac {2}{\pi\cdot (k-32)}$ for odd $k$, $0$ for even $k$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 0] +0.000000,+0.000000 abs=+0.000000&#xA;[ 1] -0.020536,+0.000000 abs=+0.020536&#xA;[ 2] +0.000000,+0.000000 abs=+0.000000&#xA;[ 3] -0.021952,+0.000000 abs=+0.021952&#xA;[ 4] +0.000000,+0.000000 abs=+0.000000&#xA;[ 5] -0.023579,+0.000000 abs=+0.023579&#xA;[ 6] +0.000000,+0.000000 abs=+0.000000&#xA;[ 7] -0.025465,+0.000000 abs=+0.025465&#xA;[ 8] +0.000000,+0.000000 abs=+0.000000&#xA;[ 9] -0.027679,+0.000000 abs=+0.027679&#xA;[10] +0.000000,+0.000000 abs=+0.000000&#xA;[11] -0.030315,+0.000000 abs=+0.030315&#xA;[12] +0.000000,+0.000000 abs=+0.000000&#xA;[13] -0.033506,+0.000000 abs=+0.033506&#xA;[14] +0.000000,+0.000000 abs=+0.000000&#xA;[15] -0.037448,+0.000000 abs=+0.037448&#xA;[16] +0.000000,+0.000000 abs=+0.000000&#xA;[17] -0.042441,+0.000000 abs=+0.042441&#xA;[18] +0.000000,+0.000000 abs=+0.000000&#xA;[19] -0.048971,+0.000000 abs=+0.048971&#xA;[20] +0.000000,+0.000000 abs=+0.000000&#xA;[21] -0.057875,+0.000000 abs=+0.057875&#xA;[22] +0.000000,+0.000000 abs=+0.000000&#xA;[23] -0.070736,+0.000000 abs=+0.070736&#xA;[24] +0.000000,+0.000000 abs=+0.000000&#xA;[25] -0.090946,+0.000000 abs=+0.090946&#xA;[26] +0.000000,+0.000000 abs=+0.000000&#xA;[27] -0.127324,+0.000000 abs=+0.127324&#xA;[28] +0.000000,+0.000000 abs=+0.000000&#xA;[29] -0.212207,+0.000000 abs=+0.212207&#xA;[30] +0.000000,+0.000000 abs=+0.000000&#xA;[31] -0.636620,+0.000000 abs=+0.636620&#xA;[32] +0.000000,+0.000000 abs=+0.000000&#xA;[33] +0.636620,+0.000000 abs=+0.636620&#xA;[34] +0.000000,+0.000000 abs=+0.000000&#xA;[35] +0.212207,+0.000000 abs=+0.212207&#xA;[36] +0.000000,+0.000000 abs=+0.000000&#xA;[37] +0.127324,+0.000000 abs=+0.127324&#xA;[38] +0.000000,+0.000000 abs=+0.000000&#xA;[39] +0.090946,+0.000000 abs=+0.090946&#xA;[40] +0.000000,+0.000000 abs=+0.000000&#xA;[41] +0.070736,+0.000000 abs=+0.070736&#xA;[42] +0.000000,+0.000000 abs=+0.000000&#xA;[43] +0.057875,+0.000000 abs=+0.057875&#xA;[44] +0.000000,+0.000000 abs=+0.000000&#xA;[45] +0.048971,+0.000000 abs=+0.048971&#xA;[46] +0.000000,+0.000000 abs=+0.000000&#xA;[47] +0.042441,+0.000000 abs=+0.042441&#xA;[48] +0.000000,+0.000000 abs=+0.000000&#xA;[49] +0.037448,+0.000000 abs=+0.037448&#xA;[50] +0.000000,+0.000000 abs=+0.000000&#xA;[51] +0.033506,+0.000000 abs=+0.033506&#xA;[52] +0.000000,+0.000000 abs=+0.000000&#xA;[53] +0.030315,+0.000000 abs=+0.030315&#xA;[54] +0.000000,+0.000000 abs=+0.000000&#xA;[55] +0.027679,+0.000000 abs=+0.027679&#xA;[56] +0.000000,+0.000000 abs=+0.000000&#xA;[57] +0.025465,+0.000000 abs=+0.025465&#xA;[58] +0.000000,+0.000000 abs=+0.000000&#xA;[59] +0.023579,+0.000000 abs=+0.023579&#xA;[60] +0.000000,+0.000000 abs=+0.000000&#xA;[61] +0.021952,+0.000000 abs=+0.021952&#xA;[62] +0.000000,+0.000000 abs=+0.000000&#xA;[63] +0.020536,+0.000000 abs=+0.020536&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the FFT of this $h[k]$ gives me this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 0] +0.000000,+0.000000 abs=+0.000000&#xA;[ 1] +0.000000,+1.179305 abs=+1.179305&#xA;[ 2] +0.000000,-0.902170 abs=+0.902170&#xA;[ 3] +0.000000,+1.067172 abs=+1.067172&#xA;[ 4] +0.000000,-0.948614 abs=+0.948614&#xA;[ 5] +0.000000,+1.041888 abs=+1.041888&#xA;[ 6] +0.000000,-0.964377 abs=+0.964377&#xA;[ 7] +0.000000,+1.031241 abs=+1.031241&#xA;[ 8] +0.000000,-0.971946 abs=+0.971946&#xA;[ 9] +0.000000,+1.025678 abs=+1.025678&#xA;[10] +0.000000,-0.976117 abs=+0.976117&#xA;[11] +0.000000,+1.022524 abs=+1.022524&#xA;[12] +0.000000,-0.978495 abs=+0.978495&#xA;[13] +0.000000,+1.020766 abs=+1.020766&#xA;[14] +0.000000,-0.979737 abs=+0.979737&#xA;[15] +0.000000,+1.019971 abs=+1.019971&#xA;[16] +0.000000,-0.980125 abs=+0.980125&#xA;[17] +0.000000,+1.019971 abs=+1.019971&#xA;[18] +0.000000,-0.979737 abs=+0.979737&#xA;[19] +0.000000,+1.020766 abs=+1.020766&#xA;[20] +0.000000,-0.978495 abs=+0.978495&#xA;[21] +0.000000,+1.022524 abs=+1.022524&#xA;[22] +0.000000,-0.976117 abs=+0.976117&#xA;[23] +0.000000,+1.025678 abs=+1.025678&#xA;[24] +0.000000,-0.971946 abs=+0.971946&#xA;[25] +0.000000,+1.031241 abs=+1.031241&#xA;[26] +0.000000,-0.964377 abs=+0.964377&#xA;[27] +0.000000,+1.041888 abs=+1.041888&#xA;[28] +0.000000,-0.948614 abs=+0.948614&#xA;[29] +0.000000,+1.067172 abs=+1.067172&#xA;[30] +0.000000,-0.902170 abs=+0.902170&#xA;[31] +0.000000,+1.179305 abs=+1.179305&#xA;[32] +0.000000,+0.000000 abs=+0.000000&#xA;[33] +0.000000,-1.179305 abs=+1.179305&#xA;[34] +0.000000,+0.902170 abs=+0.902170&#xA;[35] +0.000000,-1.067172 abs=+1.067172&#xA;[36] +0.000000,+0.948614 abs=+0.948614&#xA;[37] +0.000000,-1.041888 abs=+1.041888&#xA;[38] +0.000000,+0.964377 abs=+0.964377&#xA;[39] +0.000000,-1.031241 abs=+1.031241&#xA;[40] +0.000000,+0.971946 abs=+0.971946&#xA;[41] +0.000000,-1.025678 abs=+1.025678&#xA;[42] +0.000000,+0.976117 abs=+0.976117&#xA;[43] +0.000000,-1.022524 abs=+1.022524&#xA;[44] +0.000000,+0.978495 abs=+0.978495&#xA;[45] +0.000000,-1.020766 abs=+1.020766&#xA;[46] +0.000000,+0.979737 abs=+0.979737&#xA;[47] +0.000000,-1.019971 abs=+1.019971&#xA;[48] +0.000000,+0.980125 abs=+0.980125&#xA;[49] +0.000000,-1.019971 abs=+1.019971&#xA;[50] +0.000000,+0.979737 abs=+0.979737&#xA;[51] +0.000000,-1.020766 abs=+1.020766&#xA;[52] +0.000000,+0.978495 abs=+0.978495&#xA;[53] +0.000000,-1.022524 abs=+1.022524&#xA;[54] +0.000000,+0.976117 abs=+0.976117&#xA;[55] +0.000000,-1.025678 abs=+1.025678&#xA;[56] +0.000000,+0.971946 abs=+0.971946&#xA;[57] +0.000000,-1.031241 abs=+1.031241&#xA;[58] +0.000000,+0.964377 abs=+0.964377&#xA;[59] +0.000000,-1.041888 abs=+1.041888&#xA;[60] +0.000000,+0.948614 abs=+0.948614&#xA;[61] +0.000000,-1.067172 abs=+1.067172&#xA;[62] +0.000000,+0.902170 abs=+0.902170&#xA;[63] +0.000000,-1.179305 abs=+1.179305&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I must be missing some important detail as my math goes against my FFT. What is it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to correctly calculate $x_a[k]$ from $x[k]$, what's the proper filter to convolve $x[k]$ with?&lt;/p&gt;&#xA;" OwnerUserId="1408" LastEditorUserId="1629" LastEditDate="2016-03-31T14:24:32.593" LastActivityDate="2016-03-31T14:24:32.593" Title="Hilbert transform: analytic signal" Tags="|analytic-signal|hilbert-transform|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2447" PostTypeId="2" ParentId="2446" CreationDate="2012-05-24T01:41:29.483" Score="6" Body="&lt;p&gt;It looks like you have are taking the FFT of a &lt;em&gt;shifted&lt;/em&gt; version of $\mathbf h$, not the correct $\mathbf h$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try something using &lt;a href=&quot;http://www.mathworks.com/help/techdoc/ref/fftshift.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fftshift&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H = fft(fftshift(h));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in Matlab / Octave.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="1629" LastEditDate="2016-03-31T11:30:44.180" LastActivityDate="2016-03-31T11:30:44.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2448" PostTypeId="1" AcceptedAnswerId="2453" CreationDate="2012-05-24T03:02:44.707" Score="3" ViewCount="453" Body="&lt;p&gt;Suppose we are tracking a computer mouse on the screen, if we increase the frequency of the sampling rate(to very high values) then would that increase the error in getting the exact position of the mouse or decrease it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would we get lots of outliers and we would have to average out? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am trying to ask will it get smooth lines or every little flicker in movement will be noted?&lt;/p&gt;&#xA;" OwnerUserId="1289" LastActivityDate="2012-05-27T05:44:37.787" Title="If sampling rate is high does that increase the error or decrease the error?" Tags="|sampling|supersampling|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2449" PostTypeId="2" ParentId="2445" CreationDate="2012-05-24T05:44:32.383" Score="17" Body="&lt;p&gt;One approach would be to use the &lt;a href=&quot;https://ieeexplore.ieee.org/document/4049924&quot; rel=&quot;nofollow noreferrer&quot;&gt;frequency-domain least-squares (FDLS) method&lt;/a&gt;. Given a set of (complex) samples of a discrete-time system's frequency response, and a filter order chosen by the designer, the FDLS method uses &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_least_squares_(mathematics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear least-squares&lt;/a&gt; optimization to solve for the set of coefficients (which map directly to sets of poles and zeros) for the system whose frequency response matches the desired response with minimum total squared error.&lt;/p&gt;&#xA;&lt;p&gt;The frequency response of an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-th order linear discrete-time system can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(\omega) = H(z)|_{z=e^{j\omega}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt; is the system's transfer function in the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; domain. This is typically written in the rational format that follows directly from the system's difference equation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(z) = \frac{\displaystyle\sum_{k=0}^{N}b_kz^{-k}}{1 + \displaystyle\sum_{k=1}^{N}a_kz^{-k}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The frequency response is therefore:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(\omega) = \frac{\displaystyle\sum_{k=0}^{N}b_ke^{-jk\omega}}{1 + \displaystyle\sum_{k=1}^{N}a_ke^{-jk\omega}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Rearrange the above to get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{k=0}^{N}b_ke^{-jk\omega} - H(\omega) \left(1 + \sum_{k=1}^{N}a_ke^{-jk\omega}\right) = 0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This equation is linear in the &lt;span class=&quot;math-container&quot;&gt;$2N+1$&lt;/span&gt; unknown system difference equation coefficients &lt;span class=&quot;math-container&quot;&gt;$b_k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt;. Given a desired frequency response &lt;span class=&quot;math-container&quot;&gt;$H(\omega)$&lt;/span&gt;, we would like to find coefficients that meet the above equation exactly for all values of &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;. For the general case, that's hard. So instead, we will search for a set of coefficients for a system whose frequency response approximates the desired response at a discrete set of frequencies.&lt;/p&gt;&#xA;&lt;p&gt;In order to solve for an appropriate set of coefficients using the linear least squares method, we generate an overdetermined system of equations in those unknowns. To generate those equations, choose a collection of frequencies &lt;span class=&quot;math-container&quot;&gt;$\omega_m \in [0, 2\pi), m = 0, 1, \ldots , M-1$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$M &amp;gt; 2N+1$&lt;/span&gt;, and often &lt;span class=&quot;math-container&quot;&gt;$M \gg 2N+1)$&lt;/span&gt;. For each frequency, substitute the corresponding value of &lt;span class=&quot;math-container&quot;&gt;$\omega_k$&lt;/span&gt; into the above equation to yield:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{k=0}^{N}b_ke^{-jk\omega_k} - H(\omega_k) \left(1 + \sum_{k=1}^{N}a_ke^{-jk\omega_k}\right) = 0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The values &lt;span class=&quot;math-container&quot;&gt;$H(\omega_k)$&lt;/span&gt; are obtained by sampling the desired frequency response at the chosen frequencies &lt;span class=&quot;math-container&quot;&gt;$\omega_k$&lt;/span&gt;. After generating the system of linear equations, the least-squares solution for the system's coefficients &lt;span class=&quot;math-container&quot;&gt;$b_k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt; (and therefore its poles and zeros) is easily obtained. If you substitute those coefficients back into the equation for &lt;span class=&quot;math-container&quot;&gt;$H(\omega)$&lt;/span&gt; shown above, it should (hopefully) yield a function that is close to the template frequency response that you started with.&lt;/p&gt;&#xA;&lt;p&gt;This technique has a few advantages:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Any arbitrary complex (magnitude and phase) frequency response can be used as the template. If you only have a magnitude constraint, you could just pick a phase response, such as linear phase.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It can be used to design both FIR and IIR filters; for an FIR realization, just remove the &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt; coefficients from the above.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The technique is very simple to implement and is easily parametrizable based upon the desired system order.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;While there may not be a good way to estimate &lt;em&gt;a priori&lt;/em&gt; what the required system order is to meet your design constraints, it is simple to iteratively increase the order &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; until some selected error metric is met (such as peak error, total squared error, or deviation within a specific band).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You could extend this method a bit to use weighted least-squares optimization if needed; this would allow you to specify regions of the frequency response whose approximation error is weighted more than others. This allows you to more tightly control passband/stopband areas while allowing more slop in &amp;quot;don't-care&amp;quot; areas.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="80" LastEditDate="2022-05-24T11:47:48.883" LastActivityDate="2022-05-24T11:47:48.883" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2450" PostTypeId="2" ParentId="2420" CreationDate="2012-05-24T07:23:34.740" Score="11" Body="&lt;p&gt;An alternative to the Hough Transform would be the Radon Transform (&lt;a href=&quot;http://cogsys.imm.dtu.dk/staff/ptoft/Radon/Radon.html&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;http://takinginitiative.net/2007/11/07/radon-transform/&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;). A rough description of an algorithm to detect a grid-like structure could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1. Perform Radon Transform from 0 to 180 degrees.&#xA;2. Find the two highest maxima in the angle bins.&#xA;3. For the two angles with maximal amplitude find the local maxima within the bin.&#xA;4. You can use the constraint that the maxima should have even spacing to deal with outliers.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a small matlab snippet to illustrate step 1-3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = imread('grid.png');&#xA;[R, xp] = radon(im, 0:180);&#xA;imagesc(0:180, xp, R)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tY2v7.png&quot; alt=&quot;Result of the Radon Transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(max(R)) % the two maxima are at 65 &amp;amp; 117 degrees&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TBSWM.png&quot; alt=&quot;Maxima over all angles&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(R(:, 65))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U5HJm.png&quot; alt=&quot;Maxima at 65 degrees&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(R(:,117))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/igvwv.png&quot; alt=&quot;Maxima at 117 degrees&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;To answer your question from the comments:&lt;/em&gt; It appears to me from the one example image that you provided, that this method is more robust against small defects in the detected grid. Skeletons will rarely yield straight lines which might be a disadvantage for the subsequent Hough Transform.&lt;/p&gt;&#xA;" OwnerUserId="101" LastEditorUserId="101" LastEditDate="2012-05-25T07:01:55.480" LastActivityDate="2012-05-25T07:01:55.480" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2451" PostTypeId="1" AcceptedAnswerId="2643" CreationDate="2012-05-24T08:33:03.153" Score="12" ViewCount="3124" Body="&lt;p&gt;For some denoising and deconvolution experiments, I'd like to apply a &lt;strong&gt;2nd generation wavelet transform&lt;/strong&gt; (using &lt;strong&gt;lifting&lt;/strong&gt; steps) to images.&lt;/p&gt;&#xA;&lt;p&gt;I know that there are several implementations available, but most of them use Matlab, while I want to work in &lt;strong&gt;C++&lt;/strong&gt; with &lt;strong&gt;OpenCV&lt;/strong&gt;.&#xA;Since there is no built-in wavelet transform implementation in OpenCV 2.x, I plan to implement it myself (plus, it will make a good exercise for me).&#xA;After some research, I've been able to find the original articles about the 2nd generation transform, but I'm still a bit confused about the exact way the algorithm works.&lt;/p&gt;&#xA;&lt;p&gt;Taking for main reference the paper [1] by Sweldens: &lt;em&gt;The Lifting scheme: a construction of second generation wavelets&lt;/em&gt;, I'm still confused by the definition of the index sets &lt;span class=&quot;math-container&quot;&gt;$\mathcal{K}(j)$&lt;/span&gt; : what is their size ? how are they built ? ...&lt;/p&gt;&#xA;&lt;p&gt;Hence my question : does anyone know about some &lt;strong&gt;resources&lt;/strong&gt; about the 2nd generation wavelet transform (papers, tutorials, slides...) that are either in a &lt;strong&gt;tutorial-like&lt;/strong&gt; form, or that provide a more &lt;strong&gt;algorithmic view&lt;/strong&gt; (rather than a mathematical one), which would help me designing my own implementation ?&lt;/p&gt;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;My main reference is:&lt;/p&gt;&#xA;&lt;p&gt;[1] Sweldens, W. (1998). The lifting scheme: A construction of second generation wavelets. SIAM Journal on Mathematical Analysis, 29(2), 511.&lt;/p&gt;&#xA;&lt;p&gt;And I am also learning from:&lt;/p&gt;&#xA;&lt;p&gt;[2] Daubechies, I., &amp;amp; Sweldens, W. (1998). Factoring wavelet transforms into lifting steps. Journal of Fourier analysis and applications, 4(3), 247–269.&lt;/p&gt;&#xA;&lt;p&gt;[3] Kovacevic, J., &amp;amp; Sweldens, W. (2000). Wavelet families of increasing order in arbitrary dimensions. Image Processing, 9(3), 480–496. doi:10.1109/83.826784&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="7092" LastEditDate="2021-10-04T16:53:15.670" LastActivityDate="2021-10-04T16:53:15.670" Title="Tutorial on 2nd generation wavelets (with lifting)?" Tags="|image-processing|matlab|wavelet|denoising|deconvolution|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2452" PostTypeId="2" ParentId="2445" CreationDate="2012-05-24T09:14:52.937" Score="7" Body="&lt;p&gt;My colleagues have had great results with &lt;a href=&quot;http://www.energy.sintef.no/Produkt/VECTFIT/&quot;&gt;vector fitting&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Vector Fitting is a robust numerical method for rational approximation in the frequency domain. It permits to identify state space models directly from measured or computed frequency responses, both for single or multiple input/output systems. The resulting approximation has guaranteed stable poles that are real or come in complex conjugate pairs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We use it for FIR to IIR conversion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For less demanding applications, you can just use nonlinear least squares fitting for a fixed number of poles and zeros.  This is implemented in Matlab as &lt;a href=&quot;http://www.mathworks.de/help/toolbox/signal/ref/invfreqs.html&quot;&gt;&lt;code&gt;invfreqs&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://www.mathworks.de/help/toolbox/signal/ref/invfreqz.html&quot;&gt;&lt;code&gt;invfreqz&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="64" LastActivityDate="2012-05-24T09:14:52.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2453" PostTypeId="2" ParentId="2448" CreationDate="2012-05-24T09:42:02.003" Score="5" Body="&lt;p&gt;Well, i don't see how is that related to DSP or DIP, except of course the issue of sampling, but here is what is going on:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are tracking the mouse by latching on an OS' provided &quot;onMouseMove&quot; signal then you are already enjoying (almost) the maximum sampling resolution offered by the combination of your (hardware + OS). That would be the absolute max in Fs accessible by other programs running on the system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that enough? It is, if you are free drawing with small movements trying to get the contour of an object in some photo editing software (for example). But if you click on the mouse and go crazy with it you might start to notice the trick behind the &quot;smooth lines&quot; which is to compose them of linear segments. Therefore, because of the large actual movement compared to the Fs you will start noticing some long lines appearing as the linear segments connect points that are far appart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can this Fs be changed? (Increased / Decreased) Yes, it probably can but that would depend on your hardware + software combination. For example, &lt;a href=&quot;http://www.win.tue.nl/~aeb/linux/kbd/scancodes-13.html&quot;&gt;here are a few pieces of information regarding the PS2 mice&lt;/a&gt; where you can see a specific command that can be sent to it to change the sampling resolution (search for &quot;set mouse sample rate&quot;). How you actually get to send this command to the mouse so that the sample rate is changed across the system, depends on your OS). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will higher Fs lead to improved tracking of the actual mouse movement (smaller error)? Yes, that is the point of increasing the Fs, you can track the continuous physical phenomenon much better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why don't we crank the Fs up all the way then? Because depending on your Hardware + OS there will be a limit that you can increase the Fs before it starts becoming &quot;noticable&quot; by your system. What you want to avoid is having the OS triggering the &quot;onMouseMove&quot; signal / message so fast that it floods the message queue and at the extremes the system ends up absorbed to serving just this kind of requests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, if you are tracking the mouse position with any other means (a camera looking at the screen for &quot;an arrow that points up left&quot; for example, or the same thing by screen grabbing) and possibly with another $Fs_{Track} &amp;lt; Fs_{Sys}$ then the same thing applies. However, in this case, MAYBE you can somehow increase $Fs_{Track}$ by improving the scanning process...but the best case scenario is that you will be approaching $Fs_{Sys}$ not exceeding it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Regarding &quot;every flicker&quot;, modern mice will report a resolution in DPI (Older mice had mechanical rotary encoders and just good enough resolution). Therefore, you can consider your mouse reporting its position over a very fine canvas. In general, mice are good in discriminating movement and will report robust positions over this fine canvas. There are exceptions however where an optical mouse, at rest, will report changes in the position depending on the surface it rests on. In this case, the mouse gets &quot;tricked&quot; and you can avoid this flicker by changing the mat it rests on. For any other means of tracking, the &quot;flicker&quot; will depend on the tracker and Signal to Noise Ratio (SNR).&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-05-24T09:42:02.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2454" PostTypeId="2" ParentId="2412" CreationDate="2012-05-24T10:42:56.837" Score="3" Body="&lt;h2&gt;Preliminaries&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This demonstration is easier with the MATLAB package &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/32894-audioread-unified-audio-file-input-function&quot; rel=&quot;nofollow noreferrer&quot;&gt;audioread&lt;/a&gt;, which enables reading/writing MP3 files. Alternatively, you can convert the MP3 file in the example to WAV manually.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Easy case&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Before we examine your problematic file, let's head over to SoundCloud and grab &lt;a href=&quot;http://soundcloud.com/brobar/snoring&quot; rel=&quot;nofollow noreferrer&quot;&gt;a decent snore&lt;/a&gt; so we know what to expect when the SNR is high. This is a 52s stereo 44.1KHz MP3. &lt;a href=&quot;http://offliberty.com/#http://soundcloud.com/brobar/snoring&quot; rel=&quot;nofollow noreferrer&quot;&gt;Download it&lt;/a&gt; to a folder in MATLAB's path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's calculate the spectrogram (I chose a 8192-sample Hann window) and the spectral flatness:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[snd1,fs1]=mp3read('snoring - brobar.mp3'); % use wavread if you converted manually&#xA;[s1,f,t,p1]=spectrogram(mean(snd1,2),hann(8192));&#xA;sf1=10*log10(geomean(p1)./mean(p1)); % spectral flatness&#xA;plot(linspace(0,length(snd1)/fs1,length(sf1)),sf1); axis tight&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e2Fg1.png&quot; alt=&quot;Spectral flatness of brobar&amp;#39;s snore&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The huge dips in the spectral flatness (i.e., deviation from white noise) scream &quot;I am snoring&quot;. We can easily classify it by looking at the deviation from the baseline (median):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;stem(linspace(0,length(snd1)/fs1,length(sf1)),median(sf1)-sf1&amp;gt;2*std(sf1)); axis tight&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WhKPZ.png&quot; alt=&quot;The classified spectral flatness of brobar&amp;#39;s snore&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We had more than two standard deviations of headroom. The standard variation itself, for reference, is &lt;strong&gt;6.8487&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Hard case&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Now let's take a look at &lt;a href=&quot;http://dl.dropbox.com/u/72976325/recordedFile20120408010300_first_ten_wav.dat&quot; rel=&quot;nofollow noreferrer&quot;&gt;your file&lt;/a&gt;. It's a 10 minute, 8KHz WAV file. Since the level is so low, it helps to &lt;em&gt;compand&lt;/em&gt; the signal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[snd,fs]=wavread('recordedFile20120408010300_first_ten_minutes');&#xA;cmp=compand(snd,255,1);&#xA;wavwrite(cmp,'companded'); % used for listening purposes&#xA;[s,f,t,p]=spectrogram(snd,hann(8192));&#xA;sf=10*log10(geomean(p)./mean(p));&#xA;plot(linspace(0,600,length(sf)),sf);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nF8ac.png&quot; alt=&quot;Spectral flatness of the noisy file&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See those nice dips accompanying each snore? Neither do I. How about the nice peaks? They're not snoring, but the sound of the subject moving. The standard deviation is a paltry &lt;strong&gt;0.9388&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Conclusion&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;You need to acquire a cleaner signal if you want to rely on the spectral flatness! I had compand it just to hear anything. If a low SNR is detected, prod the user to place the phone closer or use a microphone like the phone that comes with the headset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good news is that it &lt;strong&gt;is&lt;/strong&gt; possible to detect snoring in even the problematic case. However, since this question was not just about snore detection I will stop here, and &lt;a href=&quot;https://dsp.stackexchange.com/a/1831/1059&quot;&gt;explain how to do that&lt;/a&gt; in &lt;a href=&quot;https://dsp.stackexchange.com/questions/1828/how-to-distinguish-voice-from-snoring&quot;&gt;your other question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-05-24T10:42:56.837" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2455" PostTypeId="2" ParentId="1867" CreationDate="2012-05-24T12:48:35.027" Score="-3" Body="&lt;p&gt;I am using one javascript function for compare tow audio file. By using the same logic you are able to compare any file in any language. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function compireAudio(){ &#xA;var audio1 = &quot;http://soundjax.com/reddo/86502%5Ealarm.mp3&quot;; &#xA;var audio2 = &quot;http://soundjax.com/reddo/44368%5EALARME.mp3&quot;;&#xA;var i,j,d;&#xA;var matching = 0;&#xA;var t = 0;var i,j,d;&#xA;var matching = 0;&#xA;var t = 0;&#xA;var audio1Arr = Array();&#xA;var audio1Len = audio1.length;&#xA;for (i = 1; i&amp;lt;=audio1Len; i++)&#xA;{&#xA;    //reverse so its like a stack&#xA;    d = audio1.charCodeAt(audio1Len-i);&#xA;    for (j = 0; j &amp;lt; 8; j++) &#xA;    {&#xA;        audio1Arr.push(d%2);&#xA;        d = Math.floor(d/2);&#xA;    }&#xA;}&#xA;var audio2Len = audio2.length;&#xA;for (i = 1; i&amp;lt;=audio2Len; i++)&#xA;{&#xA;    //reverse so its like a stack&#xA;    d = audio2.charCodeAt(audio2Len-i);&#xA;    for (j = 0; j &amp;lt; 8; j++) &#xA;    {&#xA;        if(d%2 == audio1Arr[t])&#xA;        {&#xA;            matching++;&#xA;        }&#xA;        d = Math.floor(d/2);&#xA;        t++;&#xA;    }&#xA;}&#xA;var avarage = Number(matching)/((Number(t)+Number(audio1Arr.length))/Number(2))*Number(100);&#xA;alert('The Matching with the two audio is '+avarage+' %.');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;} &lt;/p&gt;&#xA;" OwnerUserId="1412" LastActivityDate="2012-05-24T12:48:35.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2456" PostTypeId="1" AcceptedAnswerId="2459" CreationDate="2012-05-24T15:03:31.527" Score="10" ViewCount="37845" Body="&lt;p&gt;I'm taking a multimedia systems class in my MSc Computer Science, and I'm having some trouble understanding the formula for the alias frequency - this could stem from my misunderstanding of the alias signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of an alias signal is that if you undersample your input signal (i.e. sample at a rate which is less than twice the maximum frequency) then we can get aliasing because we're not sampling frequently enough to capture the high frequency details.  The aliasing signal is the result of taking these sample values and joining them with a smooth curve.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the resulting signal has a frequency of half the sampling frequency, since a pure sinusoid will need two samples per oscillation (1 for each turning point) - this would mean that the alias frequency should just be a function of the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula for the alias frequency is the absolute difference of the signal frequency and the closest integer multiple of the sampling frequency - can someone explain this to me?  Thanks in advance! &lt;/p&gt;&#xA;" OwnerUserId="1413" LastActivityDate="2022-09-29T14:49:50.230" Title="Alias frequency Formula" Tags="|audio|sampling|continuous-signals|aliasing|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2457" PostTypeId="2" ParentId="2456" CreationDate="2012-05-24T17:45:38.123" Score="1" Body="&lt;p&gt;If you sample a signal at too low a sampling rate, you won't necessarily get alternating samples.  You could end up sampling only near the tops (for awhile), or only bottoms, or only zero crossings, etc., which would look like samples of a &quot;smooth&quot; waveform of a much lower frequency than at some fixed value such as half the sampling frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-24T20:04:41.397" LastActivityDate="2012-05-24T20:04:41.397" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2459" PostTypeId="2" ParentId="2456" CreationDate="2012-05-24T19:11:25.473" Score="13" Body="&lt;p&gt;Suppose that the sampling is done at a rate of $1000$ Hz, one sample every millisecond. Suppose also that the signal being sampled is at $3200$ Hz,&#xA;the first sample is at the peak of the sinusoid. The next sample,&#xA;will be taken one millisecond later during which time the sinusoid will &#xA;have gone through $3.2$ periods, and so the next sample will have the &#xA;same value as if the sinusoid had gone through $0.2$ periods, not $3.2$ &#xA;periods. The one after that will be $0.4$ periods away from the peak, and&#xA;so on.  &lt;strong&gt;This is exactly the same set of samples that we would gave gotten&#xA;if we had been sampling a $200$ Hz sinusoid.&lt;/strong&gt;  In one millisecond it would have&#xA;progressed through $0.2$ of its period of $5$ milliseconds and so on.&#xA;In other word, &lt;strong&gt;just by looking at the samples alone&lt;/strong&gt; we cannot tell whether&#xA;the samples came from a $3200$ HZ signal or from a $200$ Hz signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal being sampled was at $2800$ Hz, then we would get samples&#xA;corresponding to $0$, $-0.2$ of the period, $-0.4$ of the period and&#xA;so on.  But because sinusoids look the same in either direction in time,&#xA;these samples &lt;strong&gt;also&lt;/strong&gt; look like they are the result of sampling a $200$&#xA;Hz signal.  This is the reason why the formula you are given, viz.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Aliased frequency is the absolute difference between the actual signal frequency&#xA;  and the nearest integer multiple of the sampling frequency.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;works to give you the right answer.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2017-11-22T21:16:59.667" LastActivityDate="2017-11-22T21:16:59.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2461" PostTypeId="1" AcceptedAnswerId="2462" CreationDate="2012-05-24T23:31:12.013" Score="5" ViewCount="11972" Body="&lt;p&gt;i am making a smart home automation software and i would like to know if there is any software that can recognize noises such as speech ,playing music,phone ringing etc&#xA;The exact software i am looking for has already been made by mitsubishi but i cant find the source.&#xA;A video by mitsubishi explaining what i need&#xA;&lt;a href=&quot;http://www.merl.com/areas/SoundRecognition/classifier-on-pda.mpeg&quot; rel=&quot;noreferrer&quot;&gt;http://www.merl.com/areas/SoundRecognition/classifier-on-pda.mpeg&lt;/a&gt;&#xA;also the project's site &lt;a href=&quot;http://www.merl.com/areas/SoundRecognition/&quot; rel=&quot;noreferrer&quot;&gt;http://www.merl.com/areas/SoundRecognition/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1415" LastActivityDate="2014-12-18T17:35:03.280" Title="Is there any free software that can recognize and classify sounds?" Tags="|audio|speech-recognition|sound|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2462" PostTypeId="2" ParentId="2461" CreationDate="2012-05-25T00:10:34.963" Score="1" Body="&lt;p&gt;I don't have any practical experience but I found numerous libraries:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://jmir.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;http://jmir.sourceforge.net/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://libxtract.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;http://libxtract.sourceforge.net/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://yaafe.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;http://yaafe.sourceforge.net/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://feapi.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;http://feapi.sourceforge.net/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sites.google.com/site/pdescriptors/&quot; rel=&quot;nofollow&quot;&gt;https://sites.google.com/site/pdescriptors/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://clam-project.org/&quot; rel=&quot;nofollow&quot;&gt;http://clam-project.org/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://taps.cs.princeton.edu/&quot; rel=&quot;nofollow&quot;&gt;http://taps.cs.princeton.edu/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://aubio.org/&quot; rel=&quot;nofollow&quot;&gt;http://aubio.org/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You might need to be familiar with classification algorithms to use make good use of them.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-05-25T00:10:34.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2463" PostTypeId="2" ParentId="2461" CreationDate="2012-05-25T00:30:16.493" Score="6" Body="&lt;p&gt;The audio feature extraction libraries given above could be a good start, with some caveats:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The features you need for this task are plain MFCCs, so most of those libraries are totally overkill since they also extract features which are more meaningful in a musical context. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Some of those libraries have been designed for offline analysis (processing a pre-recorded file rather than an ongoing stream of audio buffers). Your application in home-automation suggests that you want something capable of producing on-the-fly results as ambient audio is recorded.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;None of those libraries actually address the very problem of recognizing sounds ; they just extract audio features upon which classification can be performed, so you need to post-process their output with machine learning software - using a model previously trained on examples of each class of signals you want to discriminate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You'll end up having less plumbing to do if you use a speech recognition toolbox like HTK or Sphinx. HTK is generic enough for your task - it offers you both feature extraction and recognition/classification with HMM (a very common machine learning technique not only used for speech recognition but also for audio categorization in video analysis), and has extensions for on the fly recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I remember, the MERL system you mention, and pretty much every work they did on audio for multimedia document analysis, is based on HMMs on the MPEG-7 audio descriptors.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-05-25T00:35:28.047" LastActivityDate="2012-05-25T00:35:28.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2465" PostTypeId="1" AcceptedAnswerId="2471" CreationDate="2012-05-25T07:41:05.993" Score="2" ViewCount="295" Body="&lt;p&gt;I like to listen to instrumental music while trying to sleep. So, I've selected 20 songs from my music archive to listen to when I go to bed. The problem is that the loudness levels of the songs differ. Therefore, I have difficulty listening to some songs while the others disturb me for a specific volume level. I want to normalize the loudness of them and set it to a common value programmatically (e.g. using MATLAB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n &amp;lt;- number of songs&#xA;a &amp;lt;- an array of values initially 0 (length n)&#xA;for i = 1 to n&#xA;    partition song i into overlapping windows (e.g. window length of 1024, shift of 512)&#xA;    let s_j's involve the values in j'th window where j = 1 to #windows&#xA;    a(i) &amp;lt;- max_j sum(abs(s_j))&#xA;end for&#xA;m &amp;lt;- mean(a)&#xA;for i = 1 to n&#xA;    rescale all the amplitude values of song i by m/a(i)&#xA;end for&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What should I take into consideration to normalize the songs' loudness levels? What strategy do you recommend? I can write the MATLAB code easily from a pseudocode.&lt;/p&gt;&#xA;" OwnerUserId="482" LastActivityDate="2012-05-25T17:15:30.123" Title="Normalizing loudness level of a set of songs" Tags="|music|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2466" PostTypeId="2" ParentId="2422" CreationDate="2012-05-25T08:36:01.340" Score="7" Body="&lt;p&gt;I'm not sure if you just want to match two images (e.g. find the common points), or you want to attempt something like CBIR (Content-based image retrieval -- searching a database with a template image to find all that contain the object).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently doing CBIR research, so I am pretty up-to-date with current methods. &lt;a href=&quot;https://stackoverflow.com/a/10482256/884412&quot;&gt;Here&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/a/10041801/884412&quot;&gt;here&lt;/a&gt; are the links to my answers to problems similar to yours from stackoverflow, you should take a look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to talk about SIFT a little bit. When if was &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=790410&amp;amp;contentType=Conference+Publications&amp;amp;refinements%3D4294883649%26sortType%3Dasc_p_Publication_Year%26searchField%3DSearch_All%26queryText%3Dlowe&quot; rel=&quot;nofollow noreferrer&quot;&gt;first introduced&lt;/a&gt; by Lowe, the term SIFT applied both to the process of feature &lt;em&gt;detection&lt;/em&gt; and to the &lt;em&gt;feature descriptors&lt;/em&gt; calculated on those detected interest points. Up to this day, the SIFT &lt;em&gt;descriptors&lt;/em&gt; have proven to be unbelievably awesome. The descriptors have some cool properties that @Totero already mentioned. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;SIFT &lt;em&gt;detection method&lt;/em&gt;, on the other hand, which is nowadays more and more referred to as DoG (Difference of Gaussians), is not state-of-the-art any more. It is still widely used, but for the process of feature detection, there are more methods today, some of which are better or nicely complement the types of invariant keypoints DoG process extracts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most current papers (look at the links in the linked stackoverflow questions) have one more nice practice: &lt;strong&gt;they combine multiple ways of detecting features, and then use SIFT descriptors&lt;/strong&gt; (which still rock as descriptors) to calculate the invariant vector representations. &lt;em&gt;I am currently working with a combination of DoG&lt;/em&gt; (they focus on corner-like parts of images) &lt;em&gt;and MSER regions&lt;/em&gt; (they focus on blob-like distinguished points through multiple scales). You might want to try and experiment and throw even more type of feature detectors in there, if you find this combination not satisfactory on your particular image database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you are interested, &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=5955377&amp;amp;contentType=Conference+Publications&amp;amp;searchField%3DSearch_All%26queryText%3DFinding+the+Best+Feature+Detector-Descriptor+Combination&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; is a paper that evaluates the preformances of different detection and descriptor combinations. I have not read it since &lt;em&gt;DoG&amp;amp;MSER + SIFT&lt;/em&gt; works fine for me, but I've skimmed it and the paper is quite good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: use google scholar if you do not have access to the IEEEXplore database I linked to.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2012-05-29T07:22:01.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2467" PostTypeId="1" CreationDate="2012-05-25T04:38:28.677" Score="16" ViewCount="4609" Body="&lt;p&gt;There are a few excellent &lt;a href=&quot;https://electronics.stackexchange.com/questions/13591/what-is-the-function-of-a-fourier-series&quot;&gt;discussion threads&lt;/a&gt; and &lt;a href=&quot;https://electronics.stackexchange.com/a/32453/8963&quot;&gt;answers&lt;/a&gt; on this site (eletronics.se) on the theory of Fourier transforms. I tried implementing the same in a simulation tool (MS Excel :)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few interpretation and implementation issues regarding the same. I am trying to analyse an voltage waveform of 50 Hz. However, the data below is just generated dummy data trying to establish a conceptual framework for implementation on a a memory and processing power constrained 16 bit embedded low cost processor.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ETA (May 30,2012)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TL;DR version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It went without saying on electronics.se but I am using a memory and processing power constrained embedded processor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few questions here that are still unanswered:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How is windowing performed on the samples that I have without significantly increasing the memory footprint of the algorithm? I would like these to be a basic step by step description, as I am pretty new to DSP.&lt;/li&gt;&#xA;&lt;li&gt;Why were the magnitudes halved when I interpolated 41 samples to derive 32, but remained as they were (except for some noise) when I interpolated them to derive 64?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am declaring a bounty on the question with the hope that I get some excellent answers which are actionable for a novice in DSP.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Time Domain input&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generated a sine wave using $ \sin(2n \pi /64) $ to generate 64 samples. I then added &#xA;30% $3rd$ harmonics,  20% $5th$ harmonics, 15% $7th$ harmonics, 10 % $ 9th $ harmonic, and 20% $ 11th $ harmonics. This led to these samples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, 0.628226182, 0.939545557, 0.881049194, 0.678981464, 0.602991986, 0.719974543, &#xA;0.873221372, 0.883883476, 0.749800373, 0.636575155, 0.685547957, 0.855268479, &#xA;0.967780108, 0.904799909, 0.737695292, 0.65, 0.737695292, 0.904799909, 0.967780108, &#xA;0.855268479, 0.685547957, 0.636575155, 0.749800373, 0.883883476, 0.873221372, &#xA;0.719974543, 0.602991986, 0.678981464, 0.881049194, 0.939545557, 0.628226182, 0, &#xA;-0.628226182, -0.939545557, -0.881049194, -0.678981464, -0.602991986, -0.719974543, &#xA;-0.873221372, -0.883883476, -0.749800373, -0.636575155, -0.685547957, -0.855268479, &#xA;-0.967780108, -0.904799909, -0.737695292, -0.65, -0.737695292, -0.904799909, &#xA;-0.967780108, -0.855268479, -0.685547957, -0.636575155, -0.749800373, -0.883883476, &#xA;-0.873221372, -0.719974543, -0.602991986, -0.678981464, -0.881049194, -0.939545557,&#xA;-0.628226182&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this waveform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s8FwQ.png&quot; alt=&quot;Time domain Waveform 64 samples period 64&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took a DFT of these samples based on a Radix 2 algorithm and got these values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, -32i, 0, -9.59999999999999i, 0, -6.4i, 0, -4.79999999999999i, 0, -3.20000000000001i,&#xA;0, -6.4i, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,&#xA;0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6.4i, 0, 3.19999999999999i, 0, 4.8i, 0,&#xA;6.4i, 0, 9.60000000000001i, 0, 32i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Taking the absolute values of the complex numbers above as the ratio to the fundamental(2nd value) and ignoring phase information(if there was any), I got the magnitudes of the injected harmonic components exactly as injected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency Domain Representation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qMPqO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Time Domain input&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generated a sine wave again using $ \sin(2n \pi /41) $ to generate 64 samples. Why 41? Because in actual implementation, my microcontrollers ADC samples at a multiple of the external oscillator, and I have only a few types of crystals available. I then added 30% $ 3rd $ harmonics, 20% $ 5th $ harmonics, 15% $ 7th $ harmonics, 10 % $ 9th $ harmonic, and 20% $ 11th $ harmonics. This led to these samples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, 0.853079823, 0.857877516, 0.603896038, 0.762429734, 0.896260999, 0.695656841, &#xA;0.676188057, 0.928419527, 0.897723205, 0.664562475, 0.765676034, 0.968738879, &#xA;0.802820512, 0.632264626, 0.814329015, 0.875637458, 0.639141079, 0.696479632, &#xA;0.954031849, 0.50925641, -0.50925641, -0.954031849, -0.696479632, -0.639141079, &#xA;-0.875637458, -0.814329015, -0.632264626, -0.802820512, -0.968738879, -0.765676034, &#xA;-0.664562475, -0.897723205, -0.928419527, -0.676188057, -0.695656841, -0.896260999, &#xA;-0.762429734, -0.603896038, -0.857877516, -0.853079823, -6.87889E-15, 0.853079823, &#xA;0.857877516, 0.603896038, 0.762429734, 0.896260999, 0.695656841, 0.676188057, &#xA;0.928419527, 0.897723205, 0.664562475, 0.765676034, 0.968738879, 0.802820512, &#xA;0.632264626, 0.814329015, 0.875637458, 0.639141079, 0.696479632, 0.954031849, &#xA;0.50925641, -0.50925641, -0.954031849 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this waveform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2fZrt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took a DFT of these samples based on a Radix 2 algorithm and got these values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;14.03118145099, 22.8331789450432+2.81923657448236i, -17.9313890484703-4.4853739490832i, &#xA;-2.54294462900052-0.971245447370764i, 1.74202662319821+0.944780377248239i, &#xA;-7.2622766435314-5.09627264287862i, -1.5480700475686-1.37872970296476i, &#xA;-0.136588568631116-0.126111953353714i, -3.99554928315394-5.93646306363598i, &#xA;-0.840633449276516-1.60987487366169i, -0.373838501691708-0.955596009389976i, &#xA;-1.326751987645-5.7574455633693i, -0.168983464443025-1.34797078005724i, &#xA;-9.49818315071085E-003-1.20377723286595i, 0.571706242298176-4.14055455367115i,  &#xA;0.192891008647316-0.865793520825366i, 0.457088076063747-1.22893647561869i, &#xA;3.15565897700047-5.67394957744733i, -0.573520124828716+0.682717512668197i, &#xA;-0.20041207669728+0.127925509089274i, -7.95516670999013E-002-1.22174958722397E-002i, &#xA;-1.57510358481328E-002-6.44533006507588E-002i, 2.50067192003906E-002-8.46645685508359E-&#xA;002i, 5.3665806842526E-002-9.01867018999554E-002i, 7.49143167927897E-002-&#xA;8.80550417489663E-002i, 9.11355142202819E-002-8.16075816185574E-002i, &#xA;0.103685444073525-7.25978085593222E-002i, 0.11339684328631-6.20147712757682E-002i, &#xA;0.120807189654211-5.04466357453455E-002i, 0.126272708495893-3.82586162066316E-002i, &#xA;0.130029552904267-2.56872914345987E-002i, 0.132228055573542-1.28943815159261E-002i, &#xA;0.1329519244939, 0.132228055573544+1.28943815159441E-002i, &#xA;0.130029552904267+2.56872914345769E-002i, 0.126272708495892+3.82586162066264E-002i, &#xA;0.12080718965421+5.04466357453468E-002i, 0.113396843286315+6.20147712757588E-002i, &#xA;0.103685444073529+7.25978085593135E-002i, 9.11355142202805E-002+8.16075816185583E-002i, &#xA;7.4914316792795E-002+8.80550417489592E-002i, 5.36658068425271E-002+9.01867018999563E-&#xA;002i, 2.50067192003947E-002+8.46645685508275E-002i, -1.57510358481296E-&#xA;002+6.44533006507526E-002i, -7.95516670999005E-002+1.22174958722402E-002i, &#xA;-0.20041207669728-0.127925509089278i, -0.573520124828709-0.682717512668206i, &#xA;3.15565897700049+5.67394957744733i, 0.45708807606375+1.22893647561869i, &#xA;0.192891008647318+0.865793520825373i, 0.571706242298199+4.14055455367114i, &#xA;-9.49818315070294E-003+1.20377723286595i, -0.168983464443023+1.34797078005724i, &#xA;-1.32675198764498+5.75744556336931i, -0.373838501691692+0.955596009389972i, &#xA;-0.840633449276515+1.6098748736617i, -3.99554928315393+5.93646306363599i, &#xA;-0.136588568631125+0.126111953353722i, -1.54807004756858+1.37872970296476i, &#xA;-7.26227664353139+5.09627264287866i, 1.7420266231982-0.944780377248243i, &#xA;-2.54294462900053+0.971245447370785i, -17.9313890484703+4.48537394908326i, &#xA;22.8331789450432-2.81923657448243i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Frequency Domain representation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ODfPr.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitudes of the complex numbers above do not reveal &lt;strong&gt;&lt;em&gt;anything&lt;/em&gt;&lt;/strong&gt; that I can infer back to the injected values in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Time Domain Input:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now took the same waveform and zero padded it i.e. set all samples beyond 41 to zero. So the following is the time domain input:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, 0.853079823, 0.857877516, 0.603896038, 0.762429734, 0.896260999, 0.695656841,  &#xA;0.676188057, 0.928419527, 0.897723205, 0.664562475, 0.765676034, 0.968738879, &#xA;0.802820512, 0.632264626, 0.814329015, 0.875637458, 0.639141079, 0.696479632, &#xA;0.954031849, 0.50925641, -0.50925641, -0.954031849, -0.696479632, -0.639141079, &#xA;-0.875637458, -0.814329015, -0.632264626, -0.802820512, -0.968738879, -0.765676034, &#xA;-0.664562475, -0.897723205, -0.928419527, -0.676188057, -0.695656841, -0.896260999, &#xA;-0.762429734, -0.603896038, -0.857877516, -0.853079823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &#xA;0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the waveform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ahPqK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took a DFT of these samples based on a Radix 2 algorithm and got these values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, 20.0329458083285-9.47487772467906i, -10.5723252177717-8.67648307596821i, &#xA;-8.88751906208901E-002+0.354809649783859i, 3.59322342970171-0.714736578926027i, &#xA;-3.28379151210465-4.42768029850565i, -0.232297876050463+0.434598758428557i, &#xA;1.68672762980862+8.28636148716246E-002i, -1.54927040705738-3.7402696285012i, &#xA;-0.551413356435698+0.608390885175318i, 0.616809338622588+0.187107067289195i, &#xA;-0.458965526924983-3.09409425549091i, -0.966784216252588+0.645984560777537i, &#xA;7.03082277241579E-003+4.21411299459407E-003i, 0.196179960454289-1.99184856512683i, &#xA;-0.919089774378072+0.328855579674163i, 0.222736292145887+0.222736292145884i, &#xA;1.23799833509466-3.45997355924453i, -3.29198268057418+0.324231994037239i, &#xA;-0.495840326552116-0.827259606915814i, -0.434268223171498+0.649928325340974i, &#xA;-1.13740282784196-0.168717771696843i, -8.50255402020411E-002-0.280291642522456i, &#xA;-0.495871287837938+0.449431537929797i, -0.705190861543966-0.292099618913078i, &#xA;-1.8498657760867E-003-3.76548829156425E-002i, -0.56327531746565+0.301076929791613i, &#xA;-0.445444858519027-0.330364422654705i, -2.53084763487132E-002+0.12723430263342i, &#xA;-0.608135034699087+0.152329896227613i, -0.254967975468-0.31067937701979i, &#xA;-0.114451748984804+0.241987891739128i, -0.623647028694518, -0.114451748984793-&#xA;0.241987891739111i, -0.254967975467992+0.310679377019776i, -0.608135034699088-&#xA;0.152329896227612i, -2.53084763487126E-002-0.127234302633416i, &#xA;-0.445444858519022+0.330364422654704i, -0.563275317465649-0.301076929791616i, &#xA;-1.84986577609081E-003+3.76548829156447E-002i, -0.705190861543962+0.292099618913075i, &#xA;-0.495871287837939-0.449431537929793i, -8.50255402020378E-002+0.280291642522452i, &#xA;-1.13740282784196+0.168717771696845i, -0.434268223171501-0.649928325340972i, &#xA;-0.495840326552115+0.827259606915815i, -3.29198268057417-0.324231994037237i, &#xA;1.23799833509466+3.45997355924453i, 0.222736292145887-0.222736292145884i, &#xA;-0.919089774378077-0.328855579674149i, 0.1961799604543+1.99184856512683i, &#xA;7.03082277241257E-003-4.21411299459534E-003i, -0.966784216252593-0.645984560777534i, &#xA;-0.458965526924974+3.09409425549092i, 0.616809338622592-0.187107067289204i, &#xA;-0.551413356435713-0.608390885175314i, -1.54927040705737+3.74026962850121i, &#xA;1.68672762980861-8.28636148716247E-002i, -0.232297876050455-0.434598758428559i, &#xA;-3.28379151210465+4.42768029850566i, 3.59322342970171+0.714736578926018i, &#xA;-8.88751906209093E-002-0.354809649783852i, -10.5723252177717+8.67648307596825i, &#xA;20.0329458083285+9.47487772467899i &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Frequency Domain Representation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wcl5Z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, The magnitudes of the complex numbers above do not reveal &lt;strong&gt;&lt;em&gt;anything&lt;/em&gt;&lt;/strong&gt; that I can infer back to the injected values in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;ETA&lt;/em&gt;&lt;/strong&gt;&#xA;Since the answers here pointed me to windowing, I did another experiment and got the following results after a lot of false starts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment 4&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Time domain representation&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.853079823, 0.857877516, 0.603896038,&#xA;0.762429734, 0.896260999, 0.695656841, 0.676188057, 0.928419527, 0.897723205, &#xA;0.664562475, 0.765676034, 0.968738879, 0.802820512, 0.632264626, 0.814329015, &#xA;0.875637458, 0.639141079, 0.696479632, 0.954031849, 0.50925641, -0.50925641, &#xA;-0.954031849, -0.696479632, -0.639141079, -0.875637458, -0.814329015, -0.632264626, &#xA;-0.802820512, -0.968738879, -0.765676034, -0.664562475, -0.897723205, -0.928419527, &#xA;-0.676188057, -0.695656841, -0.896260999, -0.762429734, -0.603896038, -0.857877516, &#xA;-0.853079823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nLAAR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Hamming Window Coefficients&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.08, 0.082285843, 0.089120656, 0.100436509, 0.116120943, 0.136018076, 0.159930164, &#xA;0.187619556, 0.218811064, 0.253194691, 0.290428719, 0.330143098, 0.371943129, &#xA;0.415413385, 0.460121838, 0.505624157, 0.551468118, 0.597198104, 0.64235963, &#xA;0.686503859, 0.729192067, 0.77, 0.808522089, 0.844375485, 0.877203861, 0.906680953, &#xA;0.932513806, 0.954445679, 0.972258606, 0.985775552, 0.99486218, 0.999428184, &#xA;0.999428184, 0.99486218, 0.985775552, 0.972258606, 0.954445679, 0.932513806, &#xA;0.906680953, 0.877203861, 0.844375485, 0.808522089, 0.77, 0.729192067, 0.686503859, &#xA;0.64235963, 0.597198104, 0.551468118, 0.505624157, 0.460121838, 0.415413385, &#xA;0.371943129, 0.330143098, 0.290428719, 0.253194691, 0.218811064, 0.187619556, &#xA;0.159930164, 0.136018076, 0.116120943, 0.100436509, 0.089120656, 0.082285843, 0.080.08, &#xA;0.082285843, 0.089120656, 0.100436509, 0.116120943, 0.136018076, 0.159930164, &#xA;0.187619556, 0.218811064, 0.253194691, 0.290428719, 0.330143098, 0.371943129, &#xA;0.415413385, 0.460121838, 0.505624157, 0.551468118, 0.597198104, 0.64235963, &#xA;0.686503859, 0.729192067, 0.77, 0.808522089, 0.844375485, 0.877203861, 0.906680953, &#xA;0.932513806, 0.954445679, 0.972258606, 0.985775552, 0.99486218, 0.999428184, &#xA;0.999428184, 0.99486218, 0.985775552, 0.972258606, 0.954445679, 0.932513806, &#xA;0.906680953, 0.877203861, 0.844375485, 0.808522089, 0.77, 0.729192067, 0.686503859, &#xA;0.64235963, 0.597198104, 0.551468118, 0.505624157, 0.460121838, 0.415413385, &#xA;0.371943129, 0.330143098, 0.290428719, 0.253194691, 0.218811064, 0.187619556, &#xA;0.159930164, 0.136018076, 0.116120943, 0.100436509, 0.089120656, 0.082285843, 0.08&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Look like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nnjEU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Their Product&lt;/em&gt; &lt;strong&gt;(Would it be a simple product only?)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.354380777, 0.394728179, 0.305344425, &#xA;0.420455691, 0.53524537, 0.446861871, 0.464205711, 0.676996154, 0.691246868, &#xA;0.537313441, 0.646518073, 0.849781485, 0.727902068, 0.589595493, 0.77723281, &#xA;0.851346054, 0.63004965, 0.692901245, 0.953486318, 0.508965209, -0.506639943, &#xA;-0.940461272, -0.677158316, -0.610025441, -0.816544018, -0.738336608, -0.554624971, &#xA;-0.67788196, -0.783246782, -0.589570546, -0.484593685, -0.616290445, -0.596379223, &#xA;-0.403818226, -0.383632569, -0.453171212, -0.350810571, -0.250866497, -0.319081647, &#xA;-0.281638415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Look Like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xt9ZB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Frequency Domain Representation&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.01978454171002, -1.04956742046721-14.885596686908i, &#xA;0.729587297164687+12.4883097743251i, -0.393281811348907-4.24261013057826i, &#xA;0.761581725234628+3.2398820477072i, -0.876737136684714-3.79393194973719i, &#xA;0.480276094694696+1.88418789653125i, -0.735142602781246-1.8175563772351i, &#xA;1.02811278581892+2.5331069394699i, -0.584707361656586-1.41705783059227i, &#xA;0.642189640425863+1.09157435002371i, -1.08027274688044-1.77950446999262i, &#xA;0.690373934734768+1.16057125940753i, -0.45786262480057-0.586349217392973i, &#xA;0.837117486838485+0.985681387258948i, -0.684335876271999-0.810862267851556i, &#xA;0.930190039748881+0.842491953501215i, -2.11497450796919-1.82531206712061i, &#xA;1.77660184883125+1.59539043421572i, -8.20687157856373E-003-0.123202767234891i, &#xA;-0.280149317662962-0.244195928734504i, -0.313777442633104-0.174757927010731i, &#xA;-5.83069102281942E-002+1.54514819958589E-002i, 0.211135948552966+0.12606544182717i, &#xA;0.227409826380236+7.86489707052085E-002i, 2.49029866186928E-003-3.26908578232317E-002i, &#xA;-0.204885728671642-7.60371335974082E-002i, -0.174609549526536-2.58285031988847E-002i, &#xA;4.55943100777029E-002+3.62216126377679E-002i, 0.205437067084294+3.66474457853982E-002i, &#xA;0.130866115437055-7.39089659931302E-003i, -8.90307098969982E-002-2.75195665163235E-&#xA;002i, -0.206016142964952, -8.90307098969848E-002+2.75195665163199E-002i, &#xA;0.130866115437044+7.39089659931835E-003i, 0.205437067084297-3.66474457854036E-002i, &#xA;4.55943100777004E-002-3.62216126377661E-002i, -0.174609549526531+2.58285031988801E-&#xA;002i, -0.204885728671643+7.60371335974132E-002i, 2.49029866187001E-&#xA;003+3.26908578232264E-002i, 0.227409826380234-7.86489707052067E-002i, 0.21113594855297-&#xA;0.126065441827174i, -5.83069102281978E-002-1.54514819958551E-002i, &#xA;-0.313777442633101+0.174757927010727i, -0.280149317662962+0.244195928734507i, &#xA;-8.20687157856043E-003+0.123202767234886i, 1.77660184883125-1.59539043421572i, &#xA;-2.11497450796919+1.82531206712061i, 0.930190039748879-0.842491953501215i, &#xA;-0.684335876271989+0.810862267851559i, 0.837117486838478-0.985681387258952i, &#xA;-0.457862624800567+0.586349217392971i, 0.690373934734765-1.16057125940753i, &#xA;-1.08027274688043+1.77950446999263i, 0.642189640425861-1.09157435002371i, &#xA;-0.584707361656583+1.41705783059227i, 1.02811278581891-2.5331069394699i, &#xA;-0.735142602781236+1.81755637723511i, 0.480276094694689-1.88418789653125i, &#xA;-0.876737136684699+3.79393194973719i, 0.76158172523462-3.2398820477072i, &#xA;-0.393281811348889+4.24261013057827i, 0.729587297164646-12.4883097743252i, &#xA;-1.04956742046715+14.885596686908i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Look Like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HbeK5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Are these valid results?&lt;/strong&gt; Because I still do not seem to be getting anywhere whatsoever!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I did two more experiments and seem to be tantalizingly close to the intended results, but it the solution has the feel of a hack to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment 5&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at this point, I have 41 time domain samples representing fundamental + 30% $3rd$ harmonics,  20% $5th$ harmonics, 15% $7th$ harmonics, 10 % $ 9th $ harmonic, and 20% $ 11th $ harmonics.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0, 0.853079823, 0.857877516, 0.603896038, 0.762429734, 0.896260999, 0.695656841, &#xA;0.676188057, 0.928419527, 0.897723205, 0.664562475, 0.765676034, 0.968738879, &#xA;0.802820512, 0.632264626, 0.814329015, 0.875637458, 0.639141079, 0.696479632, &#xA;0.954031849, 0.50925641, -0.50925641, -0.954031849, -0.696479632, -0.639141079, &#xA;-0.875637458, -0.814329015, -0.632264626, -0.802820512, -0.968738879, -0.765676034, &#xA;-0.664562475, -0.897723205, -0.928419527, -0.676188057, -0.695656841, -0.896260999, &#xA;-0.762429734, -0.603896038, -0.857877516, -0.853079823.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did a linear interpolation and derived 64 samples from the same. They looked like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6biIY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency domain representation compared to the desired ideal output (First experiment) is as under:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BavDW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have stripped off the second half of the sample space as the components fold after the Nyquist limit. There is a little attenuation at the frequencies of interest, but a noise floor is added across the spectrum. &lt;strong&gt;Explanations?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment 6&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same as &lt;em&gt;Experiment 5&lt;/em&gt;, but 32 interpolated samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kbMfx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency domain comparison:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XIxOn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ratios are correct but magnitudes are &lt;strong&gt;&lt;em&gt;halved ! Why?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So I may infer, and I may be wrong(I hope I am), that if the number of samples in a complete waveform period are not a power of 2, the FFT of the same does not reveal anything without some kind of an operation, that eludes me at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I have very little control over the sampling frequency, What are the options open to me so as to get back the values that I injected in the time domain?&lt;/p&gt;&#xA;" OwnerUserId="1420" OwnerDisplayName="Vaibhav Garg" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2012-05-30T03:56:35.087" Title="Fast Fourier transform- non-integer number of cycles in the FFT aperture " Tags="|fourier|fft|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2468" PostTypeId="2" ParentId="2467" CreationDate="2012-05-25T04:50:08.593" Score="7" Body="&lt;p&gt;The FFT results actually do reveal everything about the original injected frequencies.  But because the injected frequencies were not exactly periodic in the FFT aperture length, the frequencies have been convolved into Sinc waveforms due to this non-periodic-related windowing, and then resampled.  To get the original frequencies back, you may need to deconvolve, interpolate and rescale based on the length of the FFT.&lt;/p&gt;&#xA;" OwnerUserId="154" OwnerDisplayName="hotpaw2" LastActivityDate="2012-05-25T04:56:12.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2469" PostTypeId="2" ParentId="2467" CreationDate="2012-05-25T05:28:01.970" Score="12" Body="&lt;p&gt;Welcome to windowing. Nothing to do with William G.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest cure which works by brute force burying the errors in noise by using averaging is to sample a large number of cycles so that the boundary conditions do not predominate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not looked at your numerical results, but: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at your second and third graphs.&lt;br&gt;&#xA; The waveforms that you displayed are the waveforms that are being analysed.&lt;br&gt;&#xA; The first example has 2 positive half cycles and one negative one.&lt;br&gt;&#xA; I'd expect it to be very strong in 3rd harmonic and reasonablyt so in other odd harmonics and probably with far lower even ones. That's an intuitive guesstimate.&lt;br&gt;&#xA; Whatever the result, the transform is (done properly) describing what it sees and what you see. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd expect that the second example would be immensely hard to represent well and would need a large number of high frequency components. It is 1/3 +ve, 1/3 -ve and 1/3 zero. It's shard to say how you'd easily get the totally zero right hand output without a large number of nearly equal high frequency terms of about opposite phase cancelling each other out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SO&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT or FFT tells what it sees. You need to feed it integral waveforms of the signal of interest or take special account of the end points. There is a whole artform dedicated to the latter task. Terms like windowing, raised cosine, hamming window (and many more) will start you on your journey.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot;&gt;Wikipedia - windowing&lt;/a&gt; Cooley Hann Lanczos Hamming Blackman Kaiser Nutttall and many friends :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.bores.com/courses/advanced/windows/files/windows.pdf&quot;&gt;Probably useful&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ni.com/white-paper/4844/en&quot;&gt;National Instruments&lt;/a&gt; and again &lt;a href=&quot;http://forums.ni.com/t5/DIAdem/FFT-windowing-correction-function/td-p/1980813&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cnx.org/content/m12032/latest/&quot;&gt;DFT spectrum analysis&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="47816" OwnerDisplayName="Russell McMahon" LastActivityDate="2012-05-25T05:28:01.970" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2470" PostTypeId="2" ParentId="2467" CreationDate="2012-05-25T14:16:45.597" Score="6" Body="&lt;p&gt;This is not a complete answer by any means, and I don't expect it to be accepted, but I also think there's significant educational value in this response.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So I may infer, and I may be wrong(I hope I am), that if the number of samples in a complete waveform period are not a power of 2, the FFT of the same does not reveal anything without some kind of an operation, that eludes me at the moment.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are mostly right. The FFT takes advantage of symmetry of frequency samples along the unit circle in the z-plane:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/1/18/Figura_2.png&quot; alt=&quot;Generic Unit Circle&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your number of samples is a power of 2, as shown above, you can see symmetry across both the real axis and the imaginary axis. Essentially what the FFT does is use this symmetry to collapse the samples down to 1 quadrant (or less? not sure the details of this symmetry) of the unit circle. This means the FFT only has to do a small number of computations, relative to the entire frequency range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do with zero-padding is increase the resolution of the FFT by adding zeros to produce a higher power of 2 samples. The symmetry is still there, there's just more samples packed in the unit circle now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you DON'T have a power of 2, less robust FFT's won't zero-pad for you, and you can run into aliasing in your output.&lt;/p&gt;&#xA;" OwnerUserId="1417" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.857" LastActivityDate="2012-05-25T14:16:45.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2471" PostTypeId="2" ParentId="2465" CreationDate="2012-05-25T17:15:30.123" Score="2" Body="&lt;p&gt;You can spare yourself time by using off-the-shelf software such as &lt;a href=&quot;http://mp3gain.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;http://mp3gain.sourceforge.net/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-05-25T17:15:30.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2473" PostTypeId="2" ParentId="2432" CreationDate="2012-05-25T21:32:53.093" Score="3" Body="&lt;p&gt;Generally Bayer mask (also known as CFA = color filter array) imagers are the most popular. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3Chip cameras cost considerably more - you are not only paying for 3x as many chips but the alignment in manufacturing is expensive and the range of cameras is much more limited. The largest are HD (1920x1080) although a lot of cameras actually have much smaller chips and rely on a deliberate half-pixel misalignment to interpolate each colour into a higher resolution - as with a CFA. Since most are aimed at the TV market they are usually video output (so you need a grabber card) and are a fixed TV frame rate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are potentially aliasing issues with CFA cameras if you have a very small point image which may hit only one of the colour cells, this can be fixed with an anti-alliasing filter which blurs the image slightly, or by software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One area in which 3chip wins is in low light where you need high colour quality. A 3chip camera detects essentially all the light in the scene in each colour. A CFA will detect only 25% of the Red and Blue and 50% of the green since the other photons are blocked by filters.&lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-05-25T21:32:53.093" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2474" PostTypeId="2" ParentId="2410" CreationDate="2012-05-25T22:07:31.930" Score="1" Body="&lt;p&gt;I'd suggest Viola-Jones Face detector. Easy to implement and efficient in computation time. I did some face recognition project circa 2009 and this method was the most computation efficient method back then. &#xA;Original Paper: &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_IJCV.pdf&quot; rel=&quot;nofollow&quot;&gt;research.microsoft.com/~viola/Pubs/Detect/violaJones_IJCV.pdf&lt;/a&gt;&lt;br&gt;&#xA;Basic Knowledge:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="175" LastEditorUserId="440" LastEditDate="2012-05-26T06:12:06.733" LastActivityDate="2012-05-26T06:12:06.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2475" PostTypeId="1" AcceptedAnswerId="2478" CreationDate="2012-05-25T23:51:05.090" Score="12" ViewCount="742" Body="&lt;p&gt;I don't know if this question will make sense as I'm very new to dsp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my limited foray into audio dsp I've come across:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Frequency Modulation&lt;/li&gt;&#xA;&lt;li&gt;Amplitude Modulation&lt;/li&gt;&#xA;&lt;li&gt;Additive Synthesis&lt;/li&gt;&#xA;&lt;li&gt;Subtractive Synthesis&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is: are these the main fundamental categories of signal manipulation (specifically for audio)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words can all the effects and fancy things that FL Studio with a full suite of plugins can do, be broken down into a series and combination of the above 4 operations? Or are there a whole bunch more? Can a modern DAW with plugins theoretically be broken down into any categories in this manner? Do the above 4 categories even make sense in themselves?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit of background: Essentially I'm trying to make a very basic (but very flexible) audio synthesizer/editor as a project to learn both programming and audio dsp. Using java I started by mimicking basic real world synthersizer-ish classes, calling things like Oscillator and LFO and the like, but every time I learn something new, I find myself having to rewrite everything to fit the new concept into the program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to start again now and come up with the basic objects and structure of the program. In order to that properly I need to know how I should allow these objects to interact etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT*&lt;em&gt;*&lt;/em&gt;*&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the useful comments and answers. I realise I've probably been underestimating the dsp side of stuff and I won't be able to just create a basic template &amp;amp; structure for a simple synthesizer and then just expand it/build on it. I will probably have to repeatedly rebuild again &amp;amp; again as I learn new stuff &amp;amp; the &quot;proper&quot; way to do things... It will take longer, but maybe I'll learn more? Also sorry I don't seem to have enough rep to upvote anyone yet... as soon as I can, I will.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT*EDIT***&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should add that a bit of googling revealed &lt;a href=&quot;http://www.sonicspot.com/guide/synthesistypes.html&quot;&gt;this basic guide to &quot;types of synthesis&quot;&lt;/a&gt; which I found relevant and interesting.&lt;/p&gt;&#xA;" OwnerUserId="1419" LastEditorUserId="1419" LastEditDate="2012-05-26T20:25:31.600" LastActivityDate="2012-05-26T20:25:31.600" Title="What are the basic categories of operations performed on audio signals to create interesting sounds?" Tags="|audio|music|modulation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2476" PostTypeId="1" CreationDate="2012-04-29T12:57:30.133" Score="14" ViewCount="376" Body="&lt;p&gt;I have a database of Chinese character stroke animations. Each entry is basically a set of points which shows how and in which order a character should be drawn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make lookup easier, I would like to allow the user to manually draw a character with the mouse, then my software would propose some possible matches (like it's done on the iPhone).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I searched on Google but didn't find anything relevant. I'd like to know what algorithms or research paper I need to look at. I guess it has something to do with shape recognition, except that the order in which the shape (Chinese character) is drawn is also relevant. Any suggestion?&lt;/p&gt;&#xA;" OwnerUserId="1421" OwnerDisplayName="Laurent" LastEditorUserId="590" LastEditDate="2012-06-25T15:15:14.850" LastActivityDate="2012-06-26T08:45:04.910" Title="How to match a drawn Chinese character to a database of stroke animations" Tags="|image-processing|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2477" PostTypeId="2" ParentId="2476" CreationDate="2012-05-24T14:26:34.300" Score="0" Body="&lt;p&gt;You should use a neural network, that's what is used for optical character recognition, I'm sure you can find a lot of ressources about it on Google. To take into account the order of the lines, you can use not just the final image but also the intermediate images after each stroke.&lt;/p&gt;&#xA;" OwnerDisplayName="Thomash" LastActivityDate="2012-05-24T14:26:34.300" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2478" PostTypeId="2" ParentId="2475" CreationDate="2012-05-26T09:54:18.500" Score="10" Body="&lt;p&gt;The AM / FM category is a bit strange for effects - true, you can get some interesting effects by modulating the amplitude of an input signal ; but what does &quot;frequency modulation&quot; mean for a complex input signal for which you don't even have an accurate frequency representation? You could very well say that every effect is an amplitude modulation, by the $\frac{out(t)}{in(t)}$ signal, but this is not going to help you implement it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no magic single-purpose engine at the heart of all the audio effects provided by music production software. But if you look at the source code of a large suite of audio effects from a DSP developer, here are some &quot;building blocks&quot; that will have been factored out in their own classes and which are shared by many different effects. I don't imply that this forms a good basis to categorize effects ; but from an implementation point of view, those blocks are essential:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Biquad filters.&lt;/li&gt;&#xA;&lt;li&gt;Fractional delay lines.&lt;/li&gt;&#xA;&lt;li&gt;Convolution engine, for fast convolution of an input signal with arbitrary-sized impulse responses.&lt;/li&gt;&#xA;&lt;li&gt;Waveshaper (application of a non-linear function to the input signal in the time-domaine).&lt;/li&gt;&#xA;&lt;li&gt;Synthesizer building blocks: oscillators, LFOs, ADSR envelopes.&lt;/li&gt;&#xA;&lt;li&gt;Signal detectors: envelope follower, f0 extractor.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With those blocks you could build:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Synth-like filters or wah-wah: one or two biquads&lt;/li&gt;&#xA;&lt;li&gt;Auto-wah: envelope follower + envelope + biquad&lt;/li&gt;&#xA;&lt;li&gt;Flanger / Phaser: LFO + delay line&lt;/li&gt;&#xA;&lt;li&gt;Chorus: LFO + delay lines&lt;/li&gt;&#xA;&lt;li&gt;Algorithmic reverb: delay lines (array of parallel and serial comb filters)&lt;/li&gt;&#xA;&lt;li&gt;Convolution reverb: convolution&lt;/li&gt;&#xA;&lt;li&gt;Spatializer: convolution (with HRTFs impulse responses)&lt;/li&gt;&#xA;&lt;li&gt;Guitar amp simulation: convolution, waveshappers&lt;/li&gt;&#xA;&lt;li&gt;Distortion, Fuzz: gain + waveshapper&lt;/li&gt;&#xA;&lt;li&gt;Bitcrusher (quantizer): a particular case of waveshapper&lt;/li&gt;&#xA;&lt;li&gt;Ring modulator with a sine carrier: oscillator&lt;/li&gt;&#xA;&lt;li&gt;Noise Gate and other dynamics effects: envelope follower&lt;/li&gt;&#xA;&lt;li&gt;Tape simulation: convolution, waveshapper, envelope follower (for the dynamics processing)&lt;/li&gt;&#xA;&lt;li&gt;EQ: biquads&lt;/li&gt;&#xA;&lt;li&gt;Tremolo: LFO&lt;/li&gt;&#xA;&lt;li&gt;Leslie emulation: convolution + LFO&lt;/li&gt;&#xA;&lt;li&gt;Vocoder: biquads + envelope follower&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;While some of these effects are just a matter of patching the different blocks (a flanger truly is a LFO modulating a delay line), some other effects need more complex glue between the parts, that is specific enough not to be factored into a building block of its own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is, overall, an interesting set of effects that will cover a lot of ground for music production, but it's not exhaustive and there are indeed some effects which do not fit this framework... Some examples:&#xA;* Dirty sample rate reducer (in a bitcrusher): true, it's a multiplication by a dirac comb and then a convolution by a rectangular window... but it's easier to write it as something that duplicate the value of one sample over the N following samples instead of patching an amplitude modulation and a convolution!&#xA;* Pitch alteration effects (pitch-shifting, auto-tune) do not fit this framework well. They need a more complex representation of the audio signal to be performed (phase vocoder for frequency-domain methods ; pitch detection and pitch marks for time-domain methods).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to play with &quot;modular style&quot; software tools like Pd, Reaktor, Plogue, SyntheEdit... - and try implement effects from the basic building blocks they provide you.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-05-26T10:07:48.297" LastActivityDate="2012-05-26T10:07:48.297" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2479" PostTypeId="1" CreationDate="2012-05-26T17:45:51.463" Score="1" ViewCount="346" Body="&lt;p&gt;I do not quite understand the difference between the CDM and FFCDM.&#xA;How can I implement CDM in a program?&lt;/p&gt;&#xA;" OwnerUserId="1135" LastEditorUserId="1650" LastEditDate="2013-01-27T14:42:47.690" LastActivityDate="2013-01-27T14:42:47.690" Title="Complex Demodulation (CDM) and Fixed Frequency Complex Demodulation (FFCDM)" Tags="|algorithms|discrete-signals|frequency-spectrum|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2480" PostTypeId="1" AcceptedAnswerId="2526" CreationDate="2012-05-26T23:39:06.903" Score="14" ViewCount="1566" Body="&lt;p&gt;&lt;strong&gt;Context:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Disclaimer: This is NOT a comm problem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to estimate the fundamental frequency of a real, periodic signal. This signal, was constructed by match filtering a raw signal, to that of a pulse. (the matched filter). The resultant signal has the following characteristics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It is periodic. (Fundamental is 1/period), and this is what I am trying to estimate. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is non-stationary in time. Specifically, the amplitudes of the periodic pulses can vary in amplitude. (e.g, one pulse can be low, while another is high, and the next low again, and one after that medium, etc).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I believe it is stationary in frequency, (in so much as you accept changing amplitudes, but not changing bands). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It has harmonic distortion. What I mean here is that, (and correct me if I am wrong), but that the individual pulses within the signal are not sinusoids, but are 'funky' shapes like a gaussian, triangle-ish, half-a-parabola, etc. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am trying to estimate the fundamental frequency of this signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, sometimes the raw signal is nothing but noise, but it still goes through the path and gets matched filtered anyway. (More on that later).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I have tried:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am aware of a multitude of fundamental frequency estimators such as &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The auto-correlation method&lt;/li&gt;&#xA;&lt;li&gt;YIN, and all its dependencies&lt;/li&gt;&#xA;&lt;li&gt;FFT method.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;etc, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;YIN: I have not tried YIN yet. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;FFT Method: The FFT method will give you all the harmonics and the fundamental, but I have noticed that it can be finicky especially with this non-stationary business, as the fundamental is not always the highest peak. Very quickly, you find yourself trying to ascertain which of the many peaks is the fundamental, and it becomes a hard problem.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Autocorrelation: The autocorrelation method seems to do better than the FFT method, but it is still sensitive to the amplitude irregularities of the time-domain signal. The auto-correlation method measures the distance between the center lobe, to the next highest lobe. That distance corresponds to the fundamental. However in non-stationary cases, this secondary lobe can be way too low, and you might miss it in some thresholding scheme. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It then occurred to me that maybe I can use a subspace method like MUSIC to estimate the fundamental. Upon testing this, I found that it really does give some very nice results - it peaks - robustly - and even in non-stationary cases - at frequencies corresponding to the fundamental of your signal. (Set the number of signals you are looking for to 2, and it will retrieve the fundamental - i.e, pick the 2 highest eigenvectors (corresponding to the highest values of the eigenvalues) of the signals' covariance matrix, discard them, and construct the noise subspace from the remaining, project your hypothesis complex sinusoids against them, take the reciprocal, and voila, a nice pseudo-spectrum). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions &amp;amp; Problems:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;That being said, I would still like to understand why this works better. &lt;/li&gt;&#xA;&lt;li&gt;In MUSIC we discard the signal subspace and use the noise subspace. It seems to me that the eigenvectors of the signal subspace actually are some sort of 'best fit' - they are in fact optimal matched filters. So: Why not simply use the signal subspace eigenvectors directly? (I know its not MUSIC anymore but why is using noise subspace better then?)&lt;/li&gt;&#xA;&lt;li&gt;Lastly, the final problem is that although this method seems to work much more robustly for non-stationary signals (as defined above), the problem is that now I am ALWAYS getting an answer - even when there is nothing but noise in the system! (I mentioned above that the raw pre-matched filtered signal can be just white noise sometimes, when you do not have a periodic signal present). &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What ways might exist to counteract this? I have tried looking at the eigenvalues and there is some more 'curvature' in their decay in cases where there is just noise VS cases where there is a signal, but I fear it might not be robust enough. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus:&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;When are the eigenvectors of a covariance matrix sinusouds VS something else? What determines whether or not they are sinusoids or not? Why arent they square waves? Or insert-other-shape-here signals? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="293" LastEditorUserId="1629" LastEditDate="2016-03-26T16:52:36.880" LastActivityDate="2016-03-26T16:52:36.880" Title="On using eigenvectors to estimate a signals' fundamental frequency, via MUSIC" Tags="|frequency|frequency-spectrum|autocorrelation|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2481" PostTypeId="2" ParentId="2448" CreationDate="2012-05-27T05:44:37.787" Score="1" Body="&lt;p&gt;Both, depending on how you measure error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the average error of each sample was, say +-1, then more and more samples will give you more and more of these off-by-one points in total.  The sum of the absolute unweighted errors would increase.  However, the law of large numbers suggests that an average of all these errors might get closer and closer to zero.  So if you smooth the plotted line by some kind of averaging or regression fit, more points might get you a closer estimate to the actual position.  But if, instead of averaging, you plot each individual point, then the fractal length of the plot line could head off to infinity as you add more and more plot points, each with their own individual errors.  The estimate of the distance that the mouse travels could get worse with more points or less points per unit time than some optimal value.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-27T05:44:37.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2482" PostTypeId="1" AcceptedAnswerId="2483" CreationDate="2012-05-27T08:14:34.707" Score="9" ViewCount="3687" Body="&lt;p&gt;Hi I'm taking a multimedia systems course and I'm preparing for my exam on tuesday.  I'm trying to get my head around LPC compression on a general level, but I'm having trouble with what is going on with the linear predictive filter part.  This is my understanding so far:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;LPC works by digitising the analog signal and splitting it into segments.  For each of the segments we determine the key features of the signal and try to encode these as accurately as possible.  The key features are the pitch of the signal (i.e. the basic formant frequency), the loudness of the signal and whether the sound is voiced or unvoiced.  Parameters called vocal tract excitation parameters are also determined which are used in the vocal tract model to better model the state of the vocal tract which generated the sound.  This data is passed over the network and decoded at the receiver.  The pitch of the signal is used as input to either a voiced or unvoiced synthesiser, and the loudness data is used to boost the amplitude of this resulting signal.  Finally the vocal cord model filters this sound by applying the LPC coefficients which were sent over the network.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;In my notes it says that the vocal tract model uses a linear predictive filter and that the nth sample is a linear combination of the previous p samples plus an error term, which comes from the synthesiser.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;does this mean that we keep a running average of last p samples at both the encoder and decoder?  So that at the encoder we only transmit data that corresponds to the difference between this average and actual signal?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why is it an a linear combination of these previous samples?  My understanding is that we extract the loudness, frequency and voiced/unvoiced nature of the sound and then generate these vocal tract excitation parameters by choosing them so that the difference between the actual signal and the predicted signal is as small as possible.  Surely an AVERAGE of these previous samples would be a better indication of the next sample?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If there are any holes in my understanding if you could point them out that would be great!  Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="1413" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-06-25T21:01:40.190" Title="Speech Compression - In LPC how does the linear predictive filter work on a general level?" Tags="|audio|speech|voice|compression|linear-prediction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2483" PostTypeId="2" ParentId="2482" CreationDate="2012-05-27T10:23:34.287" Score="15" Body="&lt;p&gt;LPC voice coders (starting with the old LPC10 standard, which seems to be the one you refer to here) are based on the source-filter model of speech production. Speech can be characterized by the following properties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The raw sound emitted by the larynx (through vibration of the vocal folds, or just air flowing through it, the vocal folds being opened).&lt;/li&gt;&#xA;&lt;li&gt;The transfer function of the filter achieved by the articulatory system, further filtering this raw sound.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Early LPC coders (LPC10) adopt the following model of those two steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The larynx emits either white noise, characterized by an amplitude $\sigma$ ; or a periodic impulsion train, characterized by an amplitude $\sigma$ and a frequency $f_0$&lt;/li&gt;&#xA;&lt;li&gt;The transfer function of the articulatory system is of the form $\frac{1}{1 - \sum_k a_k z^{-k}}$, and is thus entirely characterized by the coefficients $a_k$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The principle of early LPC coders (such as LPC10) is thus to estimate these parameters from chunks of the incoming audio signal ; transmit these over the network ; and have a sound generator reproduce a sound from these parameters on the receiver. Observe that in this process, nothing of the original audio samples is actually transmitted. To make a musical analogy, it's like listening to a piano performance, transcribing it, sending over the score, and getting someone to play it on the other end... The result on the other end will be close to the original performance, but only a representation has been sent over.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;does this mean that we keep a running average of last p samples at&#xA;  both the encoder and decoder?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, this is not how it works. On the encoder side, we run a process known as AR (autoregressive) estimation, to estimate the set of coefficients of the AR filter that matches best the spectral envelope of the input signal. This is an attempt at recovering the coefficients of the filtering that has been performed by the articulatory system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These coefficients are sent over the network (along with pitch, the voice/unvoiced flag, and loudness). The decoder uses those coefficients to filter a synthetic excitation signal, which can be either white noise (unvoiced frame) or a comb of periodic impulsions (voiced frame). These coefficients are used in the following way on the decoder to recover the output signal $y(n)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) = excitation(n) - \sum_k a_k y(n - k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe that since this is an all-pole, IIR filter, the samples linearly combined are previous samples produced by the filter.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So that at the encoder we only transmit&#xA;  data that corresponds to the difference between this average and&#xA;  actual signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is no &quot;averaging&quot; and there is no transmission of a difference signal. The decoder is a sound synthesizer with some parameters ; and the encoder searches for the set of parameters for this synthesizer that most closely matches the input signal.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is it an a linear combination of these previous samples?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Other options would be possible indeed here, but the advantage of using an auto-regressive model are the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In this model we use an all-pole IIR filter to simulate the articulatory system. This is a good model, since it can capture strong spectral dips and peaks with a small number of coefficients ; and the articulatory system is indeed capable of emphasizing / attenuating narrow bands of frequencies (See &lt;a href=&quot;http://en.wikipedia.org/wiki/Formant&quot;&gt;formants&lt;/a&gt;). If we had used an all-zeros FIR filter, we would have needed many more coefficients to accurately capture the kind of filter responses that the articulatory system can achieve.&lt;/li&gt;&#xA;&lt;li&gt;On the encoder end, the problem of of estimating the filter coefficients is computationally efficient - it can be done using the Levinson-Durbin recursion on the first few samples of the autocorrelation. More complex linear models (ARMA) or non-linear models are more computationally expensive or intractable.&lt;/li&gt;&#xA;&lt;li&gt;On the decoder end, the synthesis is very simple indeed - we just need enough memory to keep track of the n previous samples emitted by the decoder.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Surely an AVERAGE of these previous samples would be a better indication of the next sample?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is not true. For example, assume the input signal is a sine wave. The prediction $\hat{y}(n) = (2-\omega^2) y(n - 1) - y(n - 2)$ has zero error, while $\hat{y}(n) = \frac{y(n - 1) + y(n - 2)}{2}$ is wrong most of the time (in particular, it does not capture the fact that the sine wave is strictly increasing half of the time, strictly decreasing the rest of the time, so $y(n)$ shouldn't be &quot;between&quot; the previous values). Speech signals are not sinewaves of course - but you can squeeze much more modelling power out of a model with $p$ parameters (order p AR), than out of a model with zero (averaging).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, it's worth keeping in mind that there's a mathematical definition of &quot;better&quot; (minimizing the expected value of the squared of the error), which yields a procedure for finding the optimal value of the coefficients.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-05-27T10:23:34.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2484" PostTypeId="1" AcceptedAnswerId="2485" CreationDate="2012-05-27T12:31:37.423" Score="6" ViewCount="6828" Body="&lt;p&gt;Hi I'm doing a past exam question about converting from stereo to mono.  The scenario is below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NSL72.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first question is:  Explain why would this result in a noisy encoding.  How is the noise introduced and what does it sound like?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second Question:  What would you do to prevent such noise being introduced?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I could think of on this is that the two channels could be slightly out of phase and therefore interfere destructively when summed.  I'm not sure what this would sound like but I guess the amplitude and frequency are being changed by this so I know it wouldn't sound right!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would have to do something to remove the phase difference, right?&lt;/p&gt;&#xA;" OwnerUserId="1413" LastActivityDate="2012-05-27T13:04:07.457" Title="Converting from stereo to mono by averaging" Tags="|discrete-signals|downsampling|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2485" PostTypeId="2" ParentId="2484" CreationDate="2012-05-27T12:58:20.757" Score="27" Body="&lt;p&gt;There are indeed rare instances of recordings in which the L&amp;amp;R channels are in opposite phase. This was done in the late 70s and early 80s to create a cheap &quot;spatial sound&quot; effect (like the &quot;surround&quot; button on low-end hi-fi systems of the time), and on such recordings, computing the average of the left and right channels gives a null output. Some stereo effects (like chorus or reverb) would also make a recording sound less lively or flatter after a mono conversion, but this doesn't really qualify as noise. All these are rare problems, and averaging the L&amp;amp;R channels is the standard way of converting from stereo to mono. In the past I've worked on a system that handled large catalogues of audio files, and my approach was to check whether the energy of the average of the channels was below a certain fraction of the energy of the individual channels ; and if so, used the difference instead of the sum as a mono conversion. Ideally you could compute the cross-correlation between the left and right channels to find the lag at which they are maximally correlated, and delay one channel by the lag before the mixing so they are maximally in-phase with each other, but this is overkill for just handling the 15 or so tracks out of 100,000 that had a massive phase inversion problem - to give you an idea of the rarity of the problem...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most obvious error is converting from 44kHz to 22kHz by skipping every second sample. This will alias all frequencies in the 11kHz - 22kHz range, and will make the downsampled recording sound &quot;metallic&quot;, &quot;crunchy&quot; or &quot;gritty&quot;. A proper way of downsampling a recording is to first apply a low-pass filter to remove all frequencies above half the target sample rate ; then decimate (skip every second sample).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-05-27T13:04:07.457" LastActivityDate="2012-05-27T13:04:07.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2486" PostTypeId="1" AcceptedAnswerId="2506" CreationDate="2012-05-27T19:51:29.110" Score="3" ViewCount="524" Body="&lt;p&gt;I'm doing practice exam questions for my multimedia systems exam one tuesday and a topic which seems to come up frequently is the appropriate use of encoding B-frames based on:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)  the previous I or P frame&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)  the next I or P frame&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3)  an average of the previous I or P frame&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having a bit of trouble thinking up decent examples of these, and I'm not entirely sure when an average would be most appropriate.  Would someone mind checking my examples or maybe helping me think of some more concise or realistic ones?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;1)  A dropped ball about to hit the floor.  The previous frame the ball is the same shape but in the next frame it gets deformed because of the impact of hitting the ground, so the previous frame is better.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;2)  A man running along the pavement and a car moves between him and the camera temporarily in the previous frame.  Due to object occlusion the image of the man in the previous frame is not complete so is not a good predictive frame, but the next frame the image of the man is complete so it is better to predict from this.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;3)  I'm not sure at all what to put on this one.  I was thinking about a car moving with constant velocity across the screen because then it's position in the target would be the average of the previous and next -  but this seems quite contrived!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, any help would be appreciated so if you have ANY thoughts let me know!     &lt;/p&gt;&#xA;" OwnerUserId="1413" LastActivityDate="2012-06-07T21:44:52.610" Title="Video Compression - When would an average of the previous and next I or P frame be useful" Tags="|video-compression|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2489" PostTypeId="2" ParentId="2373" CreationDate="2012-05-28T07:17:45.320" Score="1" Body="&lt;p&gt;I don't have a lot of idea, but to make the $FFT$ visually intuitive, you could try centering the $FFT$ (multiplying each value in the $FFT$ by $(-1)^{(x+y)})$. Once you've done this, your DC component appears at the center, with the whole $FFT$ being symmetric around it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not very sure about this, but something tells me that the distance (in pixels) between the peak and the center would then indicate the periodicity. Once you have the periodicity, you can easily arrive at the distance between each object.&lt;/p&gt;&#xA;" OwnerUserId="1426" LastEditorUserId="1473" LastEditDate="2012-06-08T07:49:29.840" LastActivityDate="2012-06-08T07:49:29.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2490" PostTypeId="1" CreationDate="2012-05-28T11:30:40.143" Score="4" ViewCount="368" Body="&lt;p&gt;Hi I'm preparing for my exam tomorrow and I've come across a 17 Mark question which seems trivially easy, so I think I'm missing a key point giving the rest of this exam is fairly difficult.  The question is below and my attempt is below that.&lt;/p&gt;&#xA;&lt;p&gt;Question&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gVD7M.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The frame sizes are below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wdlel.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;My attempt:&lt;/p&gt;&#xA;&lt;p&gt;I looked up video capture on wikipedia and it defined it as the process of converting an analog signal to digital - so I took the point at which frames were captured as being after they were digitised.  We are told to ignore the time taken for compression and decompression, so the next part is just to send the data.  The total amount of data in the frame sequence is 54KB (I'm not sure why the frame sequence starts and ends with an I-frame to be honest - doesn't seem to make sense).  So to transfer 1s of video will take 0.27s.&lt;/p&gt;&#xA;&lt;p&gt;To be play a second of frames smoothly the the playout buffer must contain 25 frames minimum.  The sequence of frames is IBBPBBI which has a total size of 54 KB.  In one second the playout is 54 x 25 = 0.432 MB/s.&lt;/p&gt;&#xA;&lt;p&gt;I'm pretty sure that we would need to make some estimations to solve the rest of this.&lt;/p&gt;&#xA;&lt;p&gt;As always I'm open to any suggestions!  Thanks for reading :D&lt;/p&gt;&#xA;" OwnerUserId="1413" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-05-30T13:34:38.213" Title="Exam Question - end-to-end delay from video capture to video playout" Tags="|compression|video-compression|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2491" PostTypeId="2" ParentId="2490" CreationDate="2012-05-28T16:08:01.810" Score="2" Body="&lt;p&gt;You can't start playing any B frame until the next following I or P frame has been scanned, compressed, transmitted, received, and decompressed.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-05-28T16:13:11.790" LastActivityDate="2012-05-28T16:13:11.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2492" PostTypeId="1" CreationDate="2012-05-28T17:11:56.097" Score="3" ViewCount="261" Body="&lt;p&gt;In all video coding standards, motion estimation is always done in pixel domain using block matching. I wonder why it cannot be estimated in DCT(Discrete cosine transform) domain using block matching directly? If two blocks are similar in value in DCT domain, doesn't it mean that they are similar to each other in pixel domain as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the comments and suggestions are welcome!!!&#xA;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="1427" LastActivityDate="2014-02-03T08:13:07.517" Title="Why motion cannot be estimated in DCT domain using block match?" Tags="|image-processing|dct|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2493" PostTypeId="1" AcceptedAnswerId="2497" CreationDate="2012-05-28T17:38:28.437" Score="8" ViewCount="66641" Body="&lt;p&gt;I know that why we use Carrier of high frequency to send message signal over a long distance, when the frequency is low , energy will be obviously low. To increase the energy of the signal we need to increase the frequency. This is achieved by multiplying the message signal with the carrier signal (with high frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;suppose,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Carrier signal frequency = 2800KHz&#xA;message signal frequency = 3KHz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the two generated sidebands will be ,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2800 + 3 = 2803 KHz&#xA;2800 - 3 = 2797 KHz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and eventually, the &lt;code&gt;bandwidth&lt;/code&gt; of the signal is,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BW = 2803 - 2797 = 6KHz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is when the carrier frequency is higher , and we noticed that bandwidth is just twice of the highest frequency of modulating signal.&#xA;and the signal will be easily demodulated at the receiver end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but what will happen if it is reversed ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Message signal frequency = 2800KHz&#xA;Carrie signal frequency = 3KHz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;please explain would happen here ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2014-12-27T13:22:33.640" LastActivityDate="2014-12-27T13:22:33.640" Title="Why Carrier signal can't have frequency less than Message signal" Tags="|frequency|modulation|" AnswerCount="6" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2494" PostTypeId="2" ParentId="2492" CreationDate="2012-05-28T18:21:06.310" Score="3" Body="&lt;p&gt;Block matching will only work well if the pixel offset is (close to) a multiple of the block size, in both dimensional axises.  Odds against that might be (8*8-1):1 or (16*16-1):1.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-28T18:21:06.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2495" PostTypeId="2" ParentId="2493" CreationDate="2012-05-28T18:24:36.070" Score="1" Body="&lt;p&gt;What is the bandwidth of the message signal?  If the bandwidth is narrow enough and the center frequency is high enough and suitable for the channel to be used, then you don't even need a carrier (it could be 0 Hz for some modulation schemes).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-28T18:24:36.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2497" PostTypeId="2" ParentId="2493" CreationDate="2012-05-29T13:25:31.743" Score="14" Body="&lt;pre&gt;&lt;code&gt;suppose, Carrier signal frequency = 2800KHz message signal frequency = 3KHz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you will get a signal that looks like this in the frequency plane.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qJP5Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this is not to scale, but you get the idea.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;but what will happen if it is reversed ?&#xA;&#xA;i.e Message signal frequency = 2800KHz Carrie signal frequency = 3KHz&#xA;&#xA;please explain would happen here ?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you will get the following.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/QfmBs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The positive and negative sides of the signal will almost completely overlap, and thus distort each other to the point that they likely cannot be recovered.  Due to the +/- 3 kHz carrier frequency there will be 6 kHz that is non-overlapping (though they will still be distorted by the other signal's roll-off), but the rest will overlap.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;To increase the energy of the signal we need to increase the frequency.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Signal power has nothing to do with increasing the signal frequency.  I think that you are thinking of light &lt;a href=&quot;http://en.wikipedia.org/wiki/Photon&quot; rel=&quot;noreferrer&quot;&gt;photons&lt;/a&gt;, which do increase in energy as their frequency goes up.  Communication signals, though they are (at a really, really, low-level) composed of photons, it is a non-issue because adding power just means adding more photons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, suffice to say that you don't need to increase the frequency to increase the signal power.  We increase the carrier frequency for the following reasons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Spectrum Availability.  You send your signal where the FCC (or whatever governing body applies) says you can send it.&lt;/li&gt;&#xA;&lt;li&gt;Increased bandwidth.  As the answer to your question demonstrated, to send wide-band signals you need higher carrier frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Practicalities of antennas.  It is difficult (impossible?) to make a good wide-band antenna.  An antenna's bandwidth, though, is proportional to its center frequency, so increasing the carrier frequency makes it much easier to make good antennas with wide passbands.&lt;/li&gt;&#xA;&lt;li&gt;Channel characteristics.  Different frequencies behave in different ways.  Some frequencies get absorbed by rain and some resist that.  Some frequencies bounce off the ionosphere and so can travel farther than &quot;line of sight&quot;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-05-29T13:44:37.407" LastActivityDate="2012-05-29T13:44:37.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2498" PostTypeId="1" CreationDate="2012-05-29T13:44:23.173" Score="5" ViewCount="174" Body="&lt;p&gt;&lt;strong&gt;Background information&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Cover's text book on information theory  Mutual Information is calculated as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(1)  I(W;C) = \Sigma_k\Sigma_i P(C_k,W_i)log(\frac{P(C_k,W_i)}{P(C_k)P(W_i)})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if we were interested in a single Word W_i we would just calculate this with one sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(2)   I(W_i;C) = \Sigma_k P(C_k,W_i)log(\frac{P(C_k,W_i)}{P(C_k)P(W_i)})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR we can rewrite this as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ (3)   I(W_i;C) = \Sigma_k P(C_k,W_i)log(\frac{P(W_i|C_k)}{P(W_i)})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because &#xA;$$ (4)  P(W_i|C_k) = \frac{P(W_i,C_k)}{P(C_k)}$$ (unless i am incorrect)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&#xA;While &lt;a href=&quot;http://staff.utia.cas.cz/novovic/files/1483.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;reading a paper on feature selection using information theory measurements&lt;/a&gt; I came across A segment of the text: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rbYKH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should the equation be more like (3), and I should contact the Author, or have I mis-understood/interpreted mutual information?&lt;/p&gt;&#xA;" OwnerUserId="1183" LastActivityDate="2013-10-24T17:13:18.407" Title="Mutual Information, is this calculation correct or should I contact the author about fixing it?" Tags="|discrete-signals|information-theory|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2499" PostTypeId="2" ParentId="2493" CreationDate="2012-05-29T13:49:36.693" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;...to send message signal over a long distance, when the frequency is&#xA;  low , energy will be obviously low.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, for the case of &lt;a href=&quot;http://en.wikipedia.org/wiki/Electromagnetic_radiation#Particle_model_and_quantum_theory&quot; rel=&quot;nofollow&quot;&gt;electromagnetic radiation&lt;/a&gt; . If you were to apply the exact same comms techniques (modulation for example) in &lt;a href=&quot;http://en.wikipedia.org/wiki/Underwater_acoustics#Underwater_communication&quot; rel=&quot;nofollow&quot;&gt;the case of an underwater channel&lt;/a&gt; you would be dealing with mechanical waves where you can &quot;jump&quot; from one frequency to the next without having to spend more energy to produce it. &#xA;(Effectively though, high frequency waves do not propagate as far as low frequency waves and you would have to &quot;boost them&quot; but that's something to do with the characteristics of the propagation of the wave in that medium (not the physics of producing a mechanical wave at some frequency as it happens with producing an electromagnetic wave).) &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To increase the energy of the signal we need to increase the&#xA;  frequency. This is achieved by multiplying the message signal with the&#xA;  carrier signal (with high frequency).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not necessarily (for the first part...as above). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for modulation is to match a given baseband signal as best as possible to the characteristics of a channel. &lt;a href=&quot;http://en.wikipedia.org/wiki/Amplitude_modulation#Spectrum&quot; rel=&quot;nofollow&quot;&gt;Amplitude modulation&lt;/a&gt; (which is what you describe in your question) is not the only form of modulation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what will happen if it is reversed ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Modulation, is &lt;a href=&quot;http://en.wikipedia.org/wiki/Commutative_property&quot; rel=&quot;nofollow&quot;&gt;a commutative operation&lt;/a&gt;. It doesn't matter if it is carried out A*B or B*A. Therefore, it doesn't matter if the frequency of signal A is higher than the frequency of signal B. The end-result will be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are wondering what happens in the case of $F_A-F_B&amp;lt;0$: You will be getting &lt;a href=&quot;http://en.wikipedia.org/wiki/Negative_frequency&quot; rel=&quot;nofollow&quot;&gt;&quot;negative frequencies&quot;&lt;/a&gt;. Frequency is the rate of phase change. Negative frequency would result in a reversal of this phase change which would result to something similar to aliasing. (This is hinted to but not exactly clarified in the Wikipedia page about AM. You might want to first read through &lt;a href=&quot;http://en.wikipedia.org/wiki/Amplitude_modulation#Spectrum&quot; rel=&quot;nofollow&quot;&gt;Spectrum&lt;/a&gt; and then &lt;a href=&quot;http://en.wikipedia.org/wiki/Amplitude_modulation#Modulation_index&quot; rel=&quot;nofollow&quot;&gt;Mod. Index&lt;/a&gt; for this effect)&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-05-29T13:49:36.693" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2500" PostTypeId="2" ParentId="2493" CreationDate="2012-05-29T15:39:15.953" Score="2" Body="&lt;p&gt;I suppose it should be noted that there are a few applications where a &quot;carrier&quot; may be &quot;beat&quot; against a higher-frequency signal to lower it's frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, a sensor may return a signal that is a frequency varying between, say, 999KHz and 1.001MHz.  Even though the bandwidth (2KHz) isn't particularly broad, this is an awkward signal to transmit any distance -- requiring coax cable.  So one might &quot;beat&quot; it against, say, a 998KHz signal to produce a 1-3KHz signal than can easily be transmitted over ordinary audio/phone channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The net of this is that &quot;beating&quot; signals together is done for various reasons, and you must understand those reasons to know why some combos are more &quot;popular&quot; than others.)&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-05-29T15:39:15.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2503" PostTypeId="2" ParentId="741" CreationDate="2012-05-29T18:07:07.413" Score="10" Body="&lt;p&gt;If one has any interest in the spectrum of the windowing function used to isolate the time-domain sample, then zero-padding WILL increase the frequency resolution of the windowing function.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the time signal is $x(t)w(t)$, where $w(t)$ is the windowing function, then the overall spectrum is $X(f) * W(f)$, where $*$ inidicates convolution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your windowing function is a simple rectangle (an extraction of some set of values from $x(t)$.  Then $X(f)$ is the sync function.  So, for example, if &lt;em&gt;Nfft&lt;/em&gt; is the same as the width of your rectangle, and you had a sinusoid at precisely one of the bin frequencies, then the samples of the sync function that would appear centered on that bin happen to fall exactly at the off-peak zero crossings, and you don't see the shape of the sync in the spectrum at all.  If you now zero pad your data going into the &lt;em&gt;FFT&lt;/em&gt;, you'll see some samples at places other than the peak and the zero crossings, revealing the shape of the sync function in the resulting spectrum.  So of what use is zero-padding?  It is certainly of educational use in revealing the nature of the discrete transform of windowed signals, which is the usual case.  In a practical sense, it could be useful in any case where you are interested in the spectral shape of an isolated envelope riding on a carrier wave.&lt;/p&gt;&#xA;" OwnerUserId="1437" LastEditorUserId="1473" LastEditDate="2012-06-08T12:02:59.087" LastActivityDate="2012-06-08T12:02:59.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2504" PostTypeId="2" ParentId="2411" CreationDate="2012-05-30T08:45:36.630" Score="25" Body="&lt;p&gt;I do not think mine will be a complete answer, but I'll offer what I know and since this is a community edited site, I hope somebody will give a complimentary answer soon :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adaptive thresholding methods are those that &lt;em&gt;do not use the same threshold throughout the whole image&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, for some simpler usages, it is sometimes enough to just pick a threshold with a method smarter than the most simple &lt;a href=&quot;http://en.wikipedia.org/wiki/Thresholding_(image_processing)#Threshold_selection&quot; rel=&quot;noreferrer&quot;&gt;iterative method&lt;/a&gt;. &lt;strong&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Otsu&amp;#39;s_method&quot; rel=&quot;noreferrer&quot;&gt;Otsu's method&lt;/a&gt;&lt;/strong&gt; is a popular thresholding method that assumes the image contains two classes of pixels - &lt;em&gt;foreground&lt;/em&gt; and &lt;em&gt;background&lt;/em&gt;, and has a &lt;em&gt;bi-modal histogram&lt;/em&gt;. It then attempts to minimize their combined spread (intra-class variance).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest algorithms that can be considered truly adaptive thresholding methods would be the ones that &lt;em&gt;split the image into a &lt;strong&gt;grid of cells&lt;/strong&gt;&lt;/em&gt; and then apply a simple thresholding method (e.g. iterative or Otsu's method) on each cell treating it as a separate image (and presuming a bi-modal histogram). If a sub-image can not be thresholded good the threshold from one of the neighboring cells can be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternative approach to finding the local threshold is to &lt;strong&gt;statistically examine the intensity values of the local neighborhood of each pixel&lt;/strong&gt;. The threshold is different for each pixel and calculated from it's local neighborhood (a &lt;em&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm&quot; rel=&quot;noreferrer&quot;&gt;median, average, and other&lt;/a&gt;&lt;/em&gt; choices are possible). There is an implementation of this kind of methods included in &lt;a href=&quot;http://opencv.willowgarage.com/documentation/cpp/miscellaneous_image_transformations.html&quot; rel=&quot;noreferrer&quot;&gt;OpenCV library&lt;/a&gt; in the &lt;code&gt;cv::adaptiveThresholding&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found another similar method called &lt;a href=&quot;http://www.aforgenet.com/framework/docs/html/0ad5b988-5613-d62a-22a9-cf41e39c139f.htm&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Bradley&lt;/strong&gt; Local Thresholding&lt;/a&gt;. It also examines the neighborhood of each pixel, setting the brightnes to black if the pixels brightness is &lt;em&gt;t percent lower&lt;/em&gt; than the average brightness of surrounding pixels. The corresponding paper can be found &lt;a href=&quot;https://www.google.com/url?url=http://scholar.google.com/scholar_url%3Fhl%3Den%26q%3Dhttp://people.scs.carleton.ca:8008/~roth/iit-publications-iti/docs/gerh-50002.pdf%26sa%3DX%26scisig%3DAAGBfm3OMHJeXYHZWkBYVnodPQchEflvxQ%26oi%3Dscholarr&amp;amp;rct=j&amp;amp;sa=X&amp;amp;ei=ZNzFT4eBA423hAe7nazKBQ&amp;amp;ved=0CAoQgAMoADAA&amp;amp;q=Adaptive+Thresholding+Using+the+Integral+Imag&amp;amp;usg=AFQjCNFZfG7ueGD0iFnYBrSHr5noTA20qQ&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/a/9851056/884412&quot;&gt;This stackoverflow answer&lt;/a&gt; mentiones a local (adaptive) thresholding method called &lt;strong&gt;Niblack&lt;/strong&gt; but I have not heard of it before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, there is a method I have used in one of my previous smaller projects, called &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=2CB60307341127953FEE6E84A4E5CCFD?doi=10.1.1.130.8869&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Image Thresholding by Variational Minimax Optimization&lt;/strong&gt;&lt;/a&gt;. It is an iterative method, based on optimizing an energy function that is a nonlinear combination of two components. One component aims to calculate the threshold based on the position of strongest intensity changes in the image. The other component aims to smooth the threshold at the (object)border areas. It has proven fairly good on images of analog instruments (various shading and reflection from glass/plastic present), but required a careful choice of the number of iterations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Late edit&lt;/strong&gt;:&#xA;Inspired by the comment to &lt;a href=&quot;https://dsp.stackexchange.com/a/6035/1273&quot;&gt;this answer&lt;/a&gt;. There is one more way I know of to work around uneven lighting conditions. I will write here about bright objects on a dark background, but the same reasoning can be applied if the situation is reverse. &lt;strong&gt;Threshold the white top-hat transform of the image with a constant threshold&lt;/strong&gt; &lt;em&gt;instead of the original image&lt;/em&gt;. A white top hat of an image is nothing but a difference between the image $f$ and it's opening $\gamma(f)$. As further explanation let me offer a quote from &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=773286&quot; rel=&quot;noreferrer&quot;&gt;P. Soille: Morphological Image Analysis&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An opening of the original image with a large square SE removes all relevant image structures but preserves the illumination function. The white top-hat of the original image or subtraction of the illumination function from the original image outputs an image with a homogeneous illumination. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-11-20T19:33:47.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2505" PostTypeId="2" ParentId="2490" CreationDate="2012-05-30T13:34:38.213" Score="2" Body="&lt;p&gt;The total delay is directly related to minimum delay that needs processing at encoder and decoder before which the first frame is ready to render at the receiver.&lt;/p&gt;&#xA;&lt;p&gt;The process of the transmission and decoding will happen as follows: The IBBPBBI with index (0,1,2,3,4,5,6) will be compressed and transmitted in the patterns - as IPBBIBB (0,3,1,2,6,4,5). Given this respective pictures needs to get acquired first and at the same time needs to get decoded first before the first frame can be rendered before.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Total elements in the system delay&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Capturing delay ~ they have said assume zero.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Encoding delay (time to compress actually zero, but encoder needs to buffer frames before producing output).&lt;/p&gt;&#xA;&lt;p&gt;Since the two B pictures (pic 1,2) needs to wait before the P picture (pic 3) is available from capture and needs to get encoded before. Hence the delay introduced is - 3 / fps = 3 * 40 ms = 120 ms.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Latency of transmission.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Minimum data needs to be buffered till which the decoding can start&lt;/p&gt;&#xA;&lt;p&gt;In this case pictures I,P, and start of the First bytes B frames needs to be read and decoded by the receiver and decoder. Total number of bytes that must be submitted to decoder before first ever picture will come out&lt;br /&gt;&#xA;= (18k + 6k)*8 / 1600k&lt;br /&gt;&#xA;= 120 ms.&lt;br /&gt;&#xA;&lt;em&gt;NOTE: there is an catch here, there is usually audio and other metadata transmitted along with video in the same way, in that case, the figure 1600k should be reduced to effective available video bandwidth.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Decompression and rendering time (assumed zero here).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Hence from the key elements, we have total end-to-end delay &lt;strong&gt;= 120 ms + 120ms = 240 ms.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;But all this is &lt;em&gt;too idealistic&lt;/em&gt;. In general, there is always and appreciable jitter in the transmission. There is always some amount of buffering done by the receiver (before giving away to decoder) to minimize the situations of underflow and overflow.&lt;/p&gt;&#xA;&lt;p&gt;Second important point is that it is never really possible that all I frames have same size, though in above case, you can take that as a max frame size as above.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-05-30T13:34:38.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2506" PostTypeId="2" ParentId="2486" CreationDate="2012-05-30T14:23:03.817" Score="3" Body="&lt;p&gt;&lt;em&gt;Before elaborating anything, i would urge you to go through &lt;a href=&quot;https://dsp.stackexchange.com/a/1023/440&quot;&gt;my answer&lt;/a&gt; here that simplifies some of the common confusions prevailing about motion vectors and estimations.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Your essential question is - when or how does encoder decides to put B frame or bidirectional motion vectors. I will break your questions into few as follows: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. When does encoder decides to use B frames?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Almost always the number of B frames between I or P is always fixed. This is usually 2 or 3 pictures. The distance between I frame (called GoP size) may keep varying, but number of B frames will always remain fixed. From the point of view of MPEG, this is not really a restriction, but as one of your &lt;a href=&quot;https://dsp.stackexchange.com/questions/2490/exam-question-end-to-end-delay-from-video-capture-to-video-playout&quot;&gt;other question&lt;/a&gt; discusses, if you keep changing B frames, there will be serious problems of rhythms between the transmission and receptions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, even before estimating whether a given frame will be a good choice to act as a B frame or a new I or P frame, you have to actually decide the forward reference and past reference for from where the prediction. Iterating over whether given frame will be perfect to work as P against frame already gone or should you choose some distance frame as P and current as B is too much overhead to get encoding done, and in the process you are fluctuating delay heavily. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in essence, typically encoders decides number of B frames as 1,2 or maximum 3 and corresponding pictures are always fixed to be B frames. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. So then what if i have a huge black/uncorrelated picture between last I and future P?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok - now that you have chosen to see that given frame is B, but almost nothing matches of that frame between either past or future; or sometimes only either side of the frame? This doesn't really put encoder in trouble though. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MPEG, every frame is divided in terms of macro blocks. Each macroblcok has motion prediction from forward or reference blocks from respective past or future pictures. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I frame can &lt;em&gt;ONLY&lt;/em&gt; have Intra blocks - which has no motion compensation, so it doesn't need any other frame ready for decoding itself. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;P frame can have &lt;em&gt;INTRA&lt;/em&gt; as well as &lt;em&gt;FORWARD-PREDICTED&lt;/em&gt; macro-blocks. So even in case of P frame, when current block doesn't match with anyone in the past frame, P frame can simply use &lt;em&gt;INTRA&lt;/em&gt; block. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;B frame allows all type of macroblock including &lt;em&gt;INTRA&lt;/em&gt; (as in I), &lt;em&gt;FORWARD-PREDICTED&lt;/em&gt; mb (where motion vector depends only on past picture) , &lt;em&gt;BACKWARD-PREDICTED&lt;/em&gt; mb (where motion vector depends only on future picture) and &lt;em&gt;BIDIRECTIONAL&lt;/em&gt; macroblock which has two motion vectors from past and future and they are averaged out to form current block.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hence, in case, the B picture or part of it happens to be very independent it is quite possible to put INTRA blocks for those MBs, and if it matches only either side of the picture encoder can use only FORWARD or BACKWARD prediction either way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. So does all MB's of a given frame have to be of same type?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not at all, suppose a new &lt;em&gt;small&lt;/em&gt; object just entered in a frame which is encoded as B frames, only part of the frame needs INTRA Macroblocks but majority of others can predict their motion from other blocks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Understand, that all MPEG cares about is, &lt;em&gt;if&lt;/em&gt; encoder can find a block which is almost as good as a current one, use to minimize the error, if not bad luck and encode this as a fresh new information. Even this ability to find itself varies from encoder to encoder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4. So how does encoder make so many choices?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, for the B pictures, encoder starts a usual business by searching the most appropriate blocks from past and followed by future picture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. if both frame produce some reasonable motion vector, this is most preferred to minimize the energy and book the block as BIDIRECTIONAL MB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;b. if either past frame or future frame doesn't produce motion vector - i.e. the minimum energy (SAD) is higher than a useful number, then correspondingly only 1 motion vector is encoded making MB FORWARD or BACKWARD prediction only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;c. if none of the reference frames have good enough motion vector - the MB is encoded as INTRA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5. So why don't I simply encode everything as INTRA block and save from all the hassel?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can absolutely do that. It will still be perfectly legal MPEG stream. Just that INTRA coding will take more symbols to encode and hence it will have to be quantized badly to fit under a given bit budget. Putting everything as INTRA has significant loss of efficiency because typically video always has huge temporal redundancy that INTRA blocks don't exploit; but they do give random access freedom.&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-05-30T14:23:03.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2507" PostTypeId="1" AcceptedAnswerId="2524" CreationDate="2012-05-30T15:30:48.350" Score="10" ViewCount="16155" Body="&lt;p&gt;I realize the two are derived using different algorithms, and the units are different, but from a conceptual standpoint of the information they provide how do they differ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking here about the more or less specific (yet general) case of a &quot;representative&quot; block of samples from a time series, where the gross statistics of the data are assumed to vary slowly relative to the block size.  (I gather that's roughly what's defined as a WSS process.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I've got an intuitive understanding of Fourier transform (at least the simple 1-dimensional real version) as a &quot;spectrum&quot;.  I haven't developed an intuitive concept for autocorrelation -- that's what I'm groping for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;Rather than scatter things about, I'll put this here, since it's related to my desire to understand what an autocorrelation is doing...  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following (primitive) chart is of a brute-force autocorrelation of one of my signals.  (The units are largely meaningless, and 256 bins are jammed into 150 print position.)  The curious thing is the bifurcated tail.  What would cause this?  (It so happens that I see this twin tail at the peak of a snore -- otherwise the tail is kind of fuzzy, and the peak and slope are not nearly as pronounced.)  Checking the numeric data shows that every other value is about 10x different from it's immediate neighbors.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose it's some sort of artifact of the sampling, but it's not obvious to me what specifically that might be.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;16893892.00 :           *                                                                                                                                           &#xA;12668632.00 :             *                                                                                                                                         &#xA;9500134.00 :                                                                                                                                                       &#xA;7124095.00 :            *                                                                                                                                          &#xA;5342317.50 :                                                                                                                                                       &#xA;4006173.25 :               *                                                                                                                                       &#xA;3004206.00 :                                                                                                                                                       &#xA;2252836.75 :                *                                                                                                                                      &#xA;1689389.25 :          *                                                                                                                                            &#xA;1266863.12 :                                                                                                                                                       &#xA;950013.38 :                 *                                                                                                                                     &#xA;712409.50 :         *               *                                                                                                                             &#xA;534231.75 :              *   *    **                                                                                                                              &#xA;400617.31 :        *                 *                                                                                                                            &#xA;300420.59 :          *        *  *  * *                                                                                                                           &#xA;225283.67 :      *                      *                                                                                                                         &#xA;168938.92 :             *                **                                                                                                                       &#xA;126686.32 :               **               **  **                                                                                                                 &#xA; 95001.34 :     *   *            *           *   * *                                                                                                              &#xA; 71240.95 :                     *    *            *  * * **                                                                                                       &#xA; 53423.18 :                                           * *   *  *                                                                                                  &#xA; 40061.73 :       *                   **                     ** ** * **                                                                                           &#xA; 30042.06 :  *                *                                     *  ** ***                                                                                     &#xA; 22528.37 :                             *      *                             *** ** **  *                                                                         &#xA; 16893.89 :        *        *  *         * *               *                       *   * **** ** **                                                               &#xA; 12668.63 :   *                              *                                                  *  * ****** ****                                                  &#xA;  9500.13 :   *                             * * * *                                                             ** ****** *****  **                               &#xA;  7124.10 :      *                                    *     *    *                                                              *  *** ****** *****  **  *        &#xA;  5342.32 :                                        **           * *                                                                                *   ** * ***** &#xA;  4006.17 :                                          *       **    ** ***                                                                                         &#xA;  3004.21 : *   *              *                         **              *** ***        *                                                                         &#xA;  2252.84 :                                            *                        *** ***  *  *                                                                     &#xA;  1689.39 :                                                                            *   * **** ** *                                                            &#xA;  1266.86 :                                                                                         * ** ****  * ***   **                                         &#xA;   950.01 :  *                                                                                               *  *   * *  *   **  ** *                   *         &#xA;   712.41 :                                                                                                               **   **    ****  ***** *****    *  *   *&#xA;   534.23 :                                                                                                                              *            *  * *   *  &#xA;   400.62 :                                                                                                                                                 *   * &#xA;   300.42 :                                                                                                                                                       &#xA;   225.28 : *  *                  *                                                                                                                               &#xA;========= : ======================================================================================================================================================&#xA;          :  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4&#xA;          :  0 0 1 2 2 3 4 4 5 5 6 7 7 8 9 9 0 0 1 2 2 3 4 4 5 5 6 7 7 8 9 9 0 0 1 2 2 3 4 4 5 5 6 7 7 8 9 9 0 0 1 2 2 3 4 4 5 5 6 7 7 8 9 9 0 0 1 2 2 3 4 4 5 5 6&#xA;          :  3 9 5 1 8 4 0 6 3 9 5 1 8 4 0 6 3 9 5 1 8 4 0 6 3 9 5 1 8 4 0 6 3 9 5 1 8 4 0 6 3 9 5 1 8 4 0 6 3 9 5 1 8 4 0 6 3 9 5 1 8 4 0 6 3 9 5 1 8 4 0 6 3 9 5&#xA;          :  1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6 9 1 4 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="447" LastEditorUserId="447" LastEditDate="2012-06-01T22:02:32.433" LastActivityDate="2012-08-26T18:43:19.130" Title="Conceptually, how does a Fourier transform differ from an autocorrelation?" Tags="|fourier-transform|autocorrelation|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2508" PostTypeId="1" AcceptedAnswerId="2514" CreationDate="2012-05-30T18:09:58.527" Score="5" ViewCount="178" Body="&lt;p&gt;I have taken a series of images of a fringe pattern at regular time intervals. This fringes are generated by shining a laser beam onto the CCD camera. The laser goes through a lot of optics, which is why it creates these fringes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Gb1u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is some vibration in the laser system setup which causes these fringes to move around although not by much, couple of pixels at most. I want to analyze how much these fringes are moving around. Is there an easy way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One idea that I had, and I don't know if it's right, is to take the FFT of the image, and discard the DC (constant) components. I could analyze just one frequency component. Now, if the fringe pattern is moving about, then that should change the phase of that frequency component. Does that make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;As suggested by A_A, I took one frame as a reference and subtracted it from the rest: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AU3ps.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Out of the mess of fringes, I can clearly identify one pattern which is moving about. I particular, the diagonal fringes do not seem to be changing from frame to frame. In the end, I just want to identify if there's any one particular optic which is responsible for this vibration, so I could just set up my live camera feed to display the difference between consecutive images and play around with the optics to see if I can reduce the fringes.&lt;/p&gt;&#xA;" OwnerUserId="1444" LastEditorUserId="1444" LastEditDate="2012-05-31T17:49:27.497" LastActivityDate="2012-05-31T17:49:27.497" Title="Analyzing movement of fringes" Tags="|image-processing|highpass-filter|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2509" PostTypeId="2" ParentId="2507" CreationDate="2012-05-30T18:43:10.290" Score="7" Body="&lt;p&gt;For starters, autocorrelation is a function of the relative time only for WSS processes, otherwise it depends on the absolute times: $\mathrm R_X(t_1,t_2) \equiv \mathbb E[X(t_1)^* X(t_2)]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, it is wrong to say &quot;time is just inverse frequency&quot; because frequency is a characteristic of periodic processes. The autocorrelation is not generally a periodic process, however one may find a periodic approximation (extension) of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, a great many functions besides the autocorrelation have a Fourier transform; why identify it with the autocorrelation, which is merely a particular function? Note that the Fourier transform is not inherently associated with stochasticity; any nice, absolutely integrable function has a Fourier transform. In the case of periodic functions, you can consider the Fourier series.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I haven't developed an intuitive concept for autocorrelation -- that's what I'm groping for.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The autocorrelation is a measure of how similar a signal at different lags is to itself. This is useful in investigating potential periodic behavior. If your signal &lt;em&gt;is&lt;/em&gt; periodic, shifting it by multiples of the period will yield a perfect match. If it is not but has periodic or quasi-periodic &lt;em&gt;components&lt;/em&gt;, the autocorrelation will determine their energy.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2012-06-02T18:42:43.390" LastActivityDate="2012-06-02T18:42:43.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2510" PostTypeId="2" ParentId="2507" CreationDate="2012-05-30T19:01:51.127" Score="5" Body="&lt;p&gt;For a time limited window of sampled data, you can derive the autocorrelation from the DFT, but not vice-versa.  Therefore the DFT contains more information about that time window of data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-30T19:01:51.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2511" PostTypeId="1" AcceptedAnswerId="2512" CreationDate="2012-05-30T20:56:00.810" Score="1" ViewCount="377" Body="&lt;p&gt;My question is about edge descriptors produced from an edge detection method applied on an &lt;em&gt;object image&lt;/em&gt;. As we know, an edge has four descriptors &lt;strong&gt;edge normal&lt;/strong&gt;, &lt;strong&gt;edge direction&lt;/strong&gt;, &lt;strong&gt;edge position&lt;/strong&gt;, and &lt;strong&gt;edge strength&lt;/strong&gt;.  These descriptors are used for differentiating between the detected edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are all of this descriptors are necessary? When can I dismiss any of these descriptors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking about assumptions based on the properties of the input image, e.g., if the input image has no noise, can I neglect the &lt;strong&gt;edge strength&lt;/strong&gt; and assume that all resulting edge points are true edges?&lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="76" LastEditDate="2012-06-01T14:54:12.447" LastActivityDate="2012-07-31T15:52:48.240" Title="Are all of the edge descriptors necessary to differentiate edges?" Tags="|computer-vision|edge-detection|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2512" PostTypeId="2" ParentId="2511" CreationDate="2012-05-31T05:43:46.870" Score="2" Body="&lt;p&gt;You can calculate the edge direction from the edge normal by atan2(y,x)&lt;a href=&quot;http://en.wikipedia.org/wiki/Atan2&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;.&#xA;The other descriptors are independent of each other and thus only the problem itself can tell if they are necessary or not.&lt;/p&gt;&#xA;" OwnerUserId="905" LastEditorUserId="905" LastEditDate="2012-05-31T05:59:48.960" LastActivityDate="2012-05-31T05:59:48.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2513" PostTypeId="2" ParentId="2508" CreationDate="2012-05-31T06:37:59.133" Score="0" Body="&lt;p&gt;It should be okay to remove the DC part in the FFT to remove the translations&#xA;Under the assumption that: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The images are superpositions of the responses from laser beams (only one laser beam and no interference between timesteps).  &lt;/li&gt;&#xA;&lt;li&gt;Given a small translation of one laser, the image response from that beam will be translated linearly by the optics.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But then again this is a real-world problem, but it should work in theory, so it ``make sense''.&lt;/p&gt;&#xA;" OwnerUserId="905" LastActivityDate="2012-05-31T06:37:59.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2514" PostTypeId="2" ParentId="2508" CreationDate="2012-05-31T09:29:58.600" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;...take the FFT of the image, and discard the DC (constant) components. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That would result in removing the mean brightness from an image. Due to the fact that grayscale images have positive numbers between 0-255, what would be returned from that &quot;high pass&quot; filter (that only &quot;cuts&quot; the DC) would be the image with the same grayscale variance but now centered around 0 (instead of its original mean level).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I want to analyze how much these fringes are moving around. Is there an easy way to do this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You could obtain the absolute difference between two successive frames and then the sum of all values of that quantitty as a simple metric of how much movement was there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would also like to be able to estimate how much displacement was there between two successive frames then the simplest thing would be to use cross correlation (on successive frames) and track the position of its maximum.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-05-31T09:29:58.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2515" PostTypeId="2" ParentId="2508" CreationDate="2012-05-31T11:18:27.090" Score="2" Body="&lt;p&gt;if you want to track the motion of each pixel in the image , there is an algorithm called &lt;strong&gt;horn-schunk method&lt;/strong&gt; that determines the &lt;a href=&quot;http://en.wikipedia.org/wiki/Optical_flow&quot; rel=&quot;nofollow&quot;&gt;optical flow&lt;/a&gt; between two successive images , and the algorithm is simple and based on iterations,implemented here &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22756-horn-schunck-optical-flow-method&quot; rel=&quot;nofollow&quot;&gt;math Works&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="1380" LastEditDate="2012-05-31T11:25:59.187" LastActivityDate="2012-05-31T11:25:59.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2516" PostTypeId="1" AcceptedAnswerId="2520" CreationDate="2012-05-31T08:54:06.793" Score="18" ViewCount="11289" Body="&lt;p&gt;I am right now dealing with some image processing in Python via PIL (Python Image Library). My main aim is counting the number of colored cells in an immunohistochemistry image. I know that there are relevant programs, libraries, functions and tutorials about it, and I checked almost all of them. My major aim is writing the code manually from scratch, as much as possible. Hence I am trying to avoid using lots of exterior libraries and functions. I have written the most of the program. So here is what's going on step by step:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Program takes in the image file:&lt;img src=&quot;https://i.stack.imgur.com/Wdr5K.jpg&quot; alt=&quot;example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And processes it for the red cells (basically, it turns off the RGB values below a certain threshold for red):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/EeDzx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And creates the boolean map of it, (gonna paste a part of it since it is big) which  basically just puts 1 wherever it encounters with a red pixel in the processed second image above. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;22222222222222222222222222222222222222222&#xA;20000000111111110000000000000000000000002&#xA;20000000111111110000000000000000000000002&#xA;20000000111111110000000000000000000000002&#xA;20000000011111100000000000000000001100002&#xA;20000000001111100000000000000000011111002&#xA;20000000000110000000000000000000011111002&#xA;20000000000000000000000000000000111111002&#xA;20000000000000000000000000000000111111102&#xA;20000000000000000000000000000001111111102&#xA;20000000000000000000000000000001111111102&#xA;20000000000000000000000000000000111111002&#xA;20000000000000000000000000000000010000002&#xA;20000000000000000000000000000000000000002&#xA;22222222222222222222222222222222222222222&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I intentionally generated that frame like thing on the borders with 2s to help me with counting the number of groups of 1s in that boolean map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question to you guys is, how come I can efficiently count the number of cells (groups of 1s) in that kind of boolean map? I have found &lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Connected-component_labeling&lt;/a&gt; which look extremely related and similar, but as far as I see, it is at the pixel level. Mine is at the boolean level. Just 1s and 0s. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="1450" OwnerDisplayName="Ibrahim C. Kurt" LastEditorUserId="1450" LastEditDate="2012-05-31T13:52:11.760" LastActivityDate="2018-03-23T19:59:49.537" Title="Counting the number of groups of 1s in a boolean map of numpy.array" Tags="|python|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2517" PostTypeId="2" ParentId="2516" CreationDate="2012-05-31T09:28:53.657" Score="6" Body="&lt;p&gt;Here is an algorithm that's O(total number of pixel + number of cell pixels).  We simply scan the picture for cell pixels, and when we find one, we flood-fill the cell to erase it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementation in Common Lisp, but you'll be able to translate it to Python trivially.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(defun flood-fill (picture i j target-color replacement-color)&#xA;  ;; http://en.wikipedia.org/wiki/Flood_fill&#xA;  (when (= (aref picture i j) target-color)&#xA;    (setf (aref picture i j) replacement-color)&#xA;    (when (plusp i)&#xA;      (flood-fill picture (1- i) j target-color replacement-color))&#xA;    (when (&amp;lt; (1+ i) (array-dimension picture 0))&#xA;      (flood-fill picture (1+ i) j target-color replacement-color))&#xA;    (when (plusp j)&#xA;      (flood-fill picture i (1- j) target-color replacement-color))&#xA;    (when (&amp;lt; (1+ j) (array-dimension picture 1))&#xA;      (flood-fill picture i (1+ j) target-color replacement-color)))&#xA;  picture)&#xA;&#xA;&#xA;(defun count-cells (picture)&#xA;  (loop&#xA;    :with cell-count = 0&#xA;    :for i :from 0 :below (array-dimension picture 0)&#xA;    :do (loop&#xA;          :for j :from 0 :below (array-dimension picture 1)&#xA;          :unless (zerop (aref picture i j))&#xA;          :do (progn (incf cell-count)&#xA;                     (flood-fill picture i j 1 0)))&#xA;    :finally (return cell-count)))&#xA;&#xA;&#xA;&#xA;&#xA;(count-cells&#xA;  (make-array '(128 171) :element-type 'bit&#xA;              :initial-contents&#xA;              #(#171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000001110000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000000000011111100&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000011111100&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111100&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111110&#xA;                #171*000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110&#xA;                #171*000000000011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110&#xA;                #171*000000000011111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100&#xA;                #171*000000000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&#xA;                #171*000000000001111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&#xA;                #171*000000000001111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011&#xA;                #171*000000000000011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011&#xA;                #171*000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111000000000000000000011&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111100000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111100000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111110000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111000000000000000000000111111110000000000000000000&#xA;                #171*000000000000000000111111000000000000000000000000000000000000000000000000000000111110000000000000000000000000000000000001111111100001111000000000011111110000000000000000000&#xA;                #171*000000000000000000111111100000000000000000000000000000000000000000000000000011111110000000000000000000000000000000000111111111100011111100000000011111100000000000000000000&#xA;                #171*000000000000000000111111100000000000000000000000000000000000000000000000000011111110000000000000000000000000000000000111111111110111111110000000000100000000000000000000000&#xA;                #171*000000000000000000111111100000000000000000000000000000000000000000000000000011111100000000000000000000000000000000000111111111110111111110000000000000000000000000000000000&#xA;                #171*000000000000000000111111100000000000000000000000000000000000000000000000000011111100000000000000000000000000000000000011111111100111111110000000000000000000000000000000000&#xA;                #171*000000000000000000111111100000000000000000000000000000000000000000000000000011111100000000000000000000000000000000000001111111100111111110000000000000000000000000000000000&#xA;                #171*000000000000000000011111100000000000000000000000000000000000000000000000000011111001110000000000000000000000000000000000011111000011111110000000000000000000000000000000000&#xA;                #171*000000000000000000010110000000000000000000000000000000000000000000000000000000000011111000000000000000000000000000000000000000000000111010000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111000000000000000000000000000000000000000000000000000000111100000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000111100000000000000000000000000000000000111100000000000000000000000000000000000000000000000000000011111111100000000000000000000&#xA;                #171*100000000000000000000000000000000000000000001111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100000000000000000000&#xA;                #171*111100000000000000000000000000000000000000011111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100000000000000000000&#xA;                #171*111100000000000000000000000000000000000000011111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100000000000000000000&#xA;                #171*111100000000000000000000000000000000000000111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100000000000000000011&#xA;                #171*111100000000000000000000000000000000000000111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011110000000000000000000111&#xA;                #171*111100000000000000000000000000000000000000011111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111&#xA;                #171*000000000000000000000000000000000000000000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011&#xA;                #171*000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111100000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000001111111100000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111100000000000000000000000000000000000000000111111000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111100000000000000000000000000000000000000111110000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111100000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000011000000000000000000000000000000000000000000000000000001111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000001111100000000000000000000000000000000000000000000000000000111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000111111110000000000000000000000000000000000000000011111100000000000000000000000000000000000000000000000000111111000000000000000000000000000000000000000000000&#xA;                #171*000000000000000111111111000000000000000000000000000000000000000011111100000000000000000000000000000000000000000000000001111111100000000000000000000000000000000000000000000&#xA;                #171*000000000000000111111110000000000000000000000000000000000000000111111110000000000000000000000000000000000000000000000001111111100000000000000000000000000000000000000000000&#xA;                #171*000000000000000111111110000000000000000000000000000000000000001111111110000000000000000000000000000000000000000000000001111111110000000000000000001111111000000000000000000&#xA;                #171*000000000000000011111110000000000000000000000000000000000000001111111110000000000000000000000000000000000000000000000001111111110000000000000000011111111100000000000000000&#xA;                #171*000000000000000001110000000000000000000000000000000000000000000111111110000000000000000000000000000000000000000000000000011111100000000000000000011111111100000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000111111100000000000000000000000000000000000000000000000000001111000000000000000000011111111100000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000011111000000000000000000000000000000000000000000000000000000000000000000000000000011111111100000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111100000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000001111111000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111100000000000000000000000000000000000000000000100010000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000001111100000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000011111111110000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000011111111110000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000011111111110000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111111000000000000011111111110000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000011111111100000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000001111100000000000000010111111100000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000001111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000011111111110000000000000000000000000000000000000011111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000011111111110000000000000000000000000000000000000111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000011111111110000000000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000001111111110000000000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000001111111000000000000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000000000000000000000000000000000011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000011111100000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000001111111110000000000000110000000000000000000000001111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000001111111110000000000001111100000000000000000000011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000001111111110000000000111111111000000000000000000011111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000111111110000000000111111111000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000111111111000000000111111111100000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000011111100001111000111111111100000000000000000111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000111111100111111111100000000000000000011111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000000111111100011111111100000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&#xA;                #171*000000000000000000000000001111111100011111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)))&#xA;--&amp;gt; 30&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="Pascal Bourguignon" LastActivityDate="2012-05-31T09:28:53.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2518" PostTypeId="2" ParentId="2516" CreationDate="2012-05-31T09:37:38.137" Score="3" Body="&lt;p&gt;More of an extended comment than an answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @interjay has hinted, in a binary image, ie one in which only 2 colours are present, the pixels take the value either 1 or 0.  This may or may not be true in the image representation format you are using but it is true in the 'conceptual' representation of your image; don't let implementation details confuse you on this issue.  One of those implementation details is your use of 2s around the border of the image -- a perfectly sensible way of identifying the dead zone around the image, but not qualitatively affecting the binary-ness of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to the examination of the N, NE, NW and W pixels: this is to do with the connectivity of pixels in the formation of the component.  Each pixel (bar the border special cases) has 8 neighbours (N,S,E,W,NE,NW,SE,SW) but which ones are candidates for inclusion in the same component ?  Sometimes components which meet only at corners (NE,NW,SE,SW) are not regarded as connected, sometimes they are.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to decide what is appropriate for your application.  I suggest you work out, by hand, a few operations of the sequential algorithm, checking different neighbours for each pixel, to get a feel for what is going on.&lt;/p&gt;&#xA;" OwnerDisplayName="High Performance Mark" LastActivityDate="2012-05-31T09:37:38.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2519" PostTypeId="2" ParentId="2516" CreationDate="2012-05-31T10:11:22.503" Score="14" Body="&lt;p&gt;You can use &lt;a href=&quot;https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.label.html#scipy.ndimage.label&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ndimage.label&lt;/code&gt;&lt;/a&gt;, which is a nice way to do this. It returns a new array, with every feature having a unique value, and the number of features. You can also specify a connection element.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import scipy&#xA;from scipy import ndimage&#xA;import matplotlib.pyplot as plt&#xA;&#xA;#flatten to make greyscale, using your second red-black image as input.&#xA;im = scipy.misc.imread('blobs.jpg',flatten=1)&#xA;#smooth and threshold as image has compression artifacts (jpg)&#xA;im = ndimage.gaussian_filter(im, 2)&#xA;im[im&amp;lt;10]=0&#xA;blobs, number_of_blobs = ndimage.label(im)&#xA;print 'Number of blobls:', number_of_blobs&#xA;&#xA;plt.imshow(blobs)&#xA;plt.show()&#xA;&#xA;#Output is:&#xA;Number of blobls: 30&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6qDFa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="fraxel" LastEditorUserId="34640" LastEditDate="2018-03-23T19:59:49.537" LastActivityDate="2018-03-23T19:59:49.537" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2520" PostTypeId="2" ParentId="2516" CreationDate="2012-05-31T10:23:33.550" Score="6" Body="&lt;p&gt;Something of a brute force approach, but done by inverting the problem to index over collections of pixels to find regions, instead of rasterizing over the array.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data = &quot;&quot;&quot;\&#xA;000000011111111000000000000000000000000&#xA;000000011111111000000000000000000000000&#xA;000000011111111000000000000000000000000&#xA;000000001111110000000001000000000110000&#xA;000000000111110000000011000000001111100&#xA;000000000011100000000000100000011111100&#xA;000000000000000000000000000000011111100&#xA;000000000000000000000000000000011111110&#xA;000000000000000000000000000000111111110&#xA;000000000000000000000000000000111111110&#xA;000000000000000000000000000000011111100&#xA;000000000000000000000000000000001000000&#xA;000000000000000000000000000000000000000&quot;&quot;&quot;&#xA;&#xA;from collections import namedtuple&#xA;Point = namedtuple('Point', 'x y')&#xA;&#xA;def points_adjoin(p1, p2):&#xA;    # to accept diagonal adjacency, use this form&#xA;    #return -1 &amp;lt;= p1.x-p2.x &amp;lt;= 1 and -1 &amp;lt;= p1.y-p2.y &amp;lt;= 1&#xA;    return (-1 &amp;lt;= p1.x-p2.x &amp;lt;= 1 and p1.y == p2.y or&#xA;             p1.x == p2.x and -1 &amp;lt;= p1.y-p2.y &amp;lt;= 1)&#xA;&#xA;def adjoins(pts, pt):&#xA;    return any(points_adjoin(p,pt) for p in pts)&#xA;&#xA;def locate_regions(datastring):&#xA;    data = map(list, datastring.splitlines())&#xA;    regions = []&#xA;    datapts = [Point(x,y) &#xA;                for y,row in enumerate(data) &#xA;                    for x,value in enumerate(row) if value=='1']&#xA;    for dp in datapts:&#xA;        # find all adjoining regions&#xA;        adjregs = [r for r in regions if adjoins(r,dp)]&#xA;        if adjregs:&#xA;            adjregs[0].add(dp)&#xA;            if len(adjregs) &amp;gt; 1:&#xA;                # joining more than one reg, merge&#xA;                regions[:] = [r for r in regions if r not in adjregs]&#xA;                regions.append(reduce(set.union, adjregs))&#xA;        else:&#xA;            # not adjoining any, start a new region&#xA;            regions.append(set([dp]))&#xA;    return regions&#xA;&#xA;def region_index(regs, p):&#xA;    return next((i for i,reg in enumerate(regs) if p in reg), -1)&#xA;&#xA;def print_regions(regs):&#xA;    maxx = max(p.x for r in regs for p in r)&#xA;    maxy = max(p.y for r in regs for p in r)&#xA;    allregionpts = reduce(set.union, regs)&#xA;    for y in range(-1,maxy+2):&#xA;        line = []&#xA;        for x in range(-1,maxx+2):&#xA;            p = Point(x, y)&#xA;            if p in allregionpts:&#xA;                line.append(str(region_index(regs, p)))&#xA;            else:&#xA;                line.append('.')&#xA;        print ''.join(line)&#xA;    print&#xA;&#xA;&#xA;# test against data set&#xA;regs = locate_regions(data)&#xA;print len(regs)&#xA;print_regions(regs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Prints:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;4&#xA;........................................&#xA;........00000000........................&#xA;........00000000........................&#xA;........00000000........................&#xA;.........000000.........1.........33....&#xA;..........00000........11........33333..&#xA;...........000...........2......333333..&#xA;................................333333..&#xA;................................3333333.&#xA;...............................33333333.&#xA;...............................33333333.&#xA;................................333333..&#xA;.................................3......&#xA;........................................&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="Paul McGuire" LastActivityDate="2012-05-31T11:37:16.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2521" PostTypeId="1" CreationDate="2012-05-31T13:13:32.270" Score="2" ViewCount="117" Body="&lt;p&gt;Given a periodic impulse train and it's impulse response, how is an auto-regressive model of this system computed or estimated?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-05-31T13:13:32.270" Title="How to estimate an auto-regressive model?" Tags="|estimation|autoregressive-model|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2522" PostTypeId="1" AcceptedAnswerId="2538" CreationDate="2012-05-31T13:52:49.250" Score="14" ViewCount="1516" Body="&lt;p&gt;Designing a simple 2nd order IIR bandpass Buterworth filter with a centre frequency of 500 Hz and a 1 octave bandwidth gives me the following frequency response ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dltGT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if I take the impulse response and normalise it and convert it to dB, we can observe the &lt;em&gt;decay&lt;/em&gt; of the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KuKFv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The decay of the impulse response is approximately linear with time when plotted on this scale, allowing us to define a decay time statistic (just like in room acoustics where you can define reverb time). For the impulse response of this filter to drop below 30 dB, it takes about 11 ms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are trying to minimize this decay time keeping the following constant:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;-3 dB bandwidth&lt;/li&gt;&#xA;&lt;li&gt;Filter order&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am happy to accept (within limits) passband and stopband ripple, and/or a compromise on the steepness of the transition band to achieve this. Can anyone suggest a method for filtering with the shortest possible impulse response duration as defined above?&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="29" LastEditDate="2014-04-28T14:24:22.283" LastActivityDate="2014-04-28T14:24:22.283" Title="What bandpass filter design will yield the shortest impulse response?" Tags="|filters|audio|infinite-impulse-response|impulse-response|bandpass|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2523" PostTypeId="1" CreationDate="2012-05-31T14:17:11.520" Score="15" ViewCount="8705" Body="&lt;p&gt;I have a binary image obtained from a canny edge detector. The edges are not nicely detected in the center and I need to join them. The connection of edges is orientation and neighborhood dependent. I need to connect the vertices if they are below a threshold (say less than 5 pixel distance). If my almost linear features are nicely oriented, this threshold should be relaxed. (This is the best case.)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Dlpq8.jpg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the Hough transform, but it didn't work for me because I don't have straight lines. Dilation and erosion are also not good; they make the images messier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach I am trying is to first detect vertices and nodes (in MATLAB with &lt;code&gt;bwmorph&lt;/code&gt;) and then make leaves as a separate feature. This is done as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Scanning in a 3x3 window, look for neighbors.&lt;/li&gt;&#xA;&lt;li&gt;Traverse the complete connected object. &lt;/li&gt;&#xA;&lt;li&gt;Try to fit a line (or maybe a quadratic polynomial). &lt;/li&gt;&#xA;&lt;li&gt;Check feature-by-feature if it's worth a connection or not. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The implementation is not straightforward since the decision-making part where vertices need to be connected is tricky.&lt;/p&gt;&#xA;" OwnerUserId="1451" LastEditorUserId="77" LastEditDate="2012-06-01T04:53:08.943" LastActivityDate="2012-06-01T11:34:37.167" Title="Connecting edges detected by an edge detector" Tags="|computer-vision|edge-detection|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2524" PostTypeId="2" ParentId="2507" CreationDate="2012-05-31T14:36:00.057" Score="8" Body="&lt;p&gt;Ok, in the context of one specific application: If you're trying to &lt;a href=&quot;https://gist.github.com/255291&quot; rel=&quot;nofollow&quot;&gt;find the frequency of a waveform&lt;/a&gt;, you can calculate it similarly from the position of the peak in a Fourier transform or the peak of an autocorrelation.  (And the autocorrelation &lt;a href=&quot;https://en.wikipedia.org/wiki/Autocorrelation#Efficient_computation&quot; rel=&quot;nofollow&quot;&gt;can be calculated efficiently using the Fourier transform&lt;/a&gt;, so I don't know why everyone is naysaying &quot;they're totally different and unrelated&quot;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform shows you all the individual frequency components of the signal.  If the fundamental frequency happens to be the biggest, you can just pick it out of the spectrum and the position of that peak will be the fundamental frequency of the waveform.  If the peaks are harmonically related, but &lt;a href=&quot;https://en.wikipedia.org/wiki/Missing_fundamental&quot; rel=&quot;nofollow&quot;&gt;missing the fundamental&lt;/a&gt;, there won't be a peak at the fundamental, and you'll have to use some special processing of the positions of the harmonics to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The autocorrelation shows you periodicities of the entire waveform.  The position of the peak will be the fundamental period of the waveform, which can easily be converted to frequency.  If the fundamental is missing, the autocorrelation will still find it (GCD of the harmonics).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: If the waveform is not perfectly repetitive, the autocorrelation peak will be shifted and inaccurate.  The sound of the human voice and bowed string instruments will work fine, for instance, while plucked string instruments will be slightly high, due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Inharmonicity&quot; rel=&quot;nofollow&quot;&gt;inharmonicity&lt;/a&gt; making the harmonics slightly high.  On the other hand, the human-perceived pitch is slightly higher than the true fundamental, too, so one or the other method might be more appropriate, depending on what kind of signal you're processing and what you want to get out of it.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-08-26T18:43:19.130" LastActivityDate="2012-08-26T18:43:19.130" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2525" PostTypeId="2" ParentId="2522" CreationDate="2012-05-31T17:49:48.157" Score="6" Body="&lt;p&gt;There is no magic bullet, I'm afraid. You can use an elliptic filter to independently control pass band ripple and stop band attenuation, however you will find that the decay rate is closely related to the steepness and overall bandwidth of the filter. &#xA;You can make the filter decay drastically faster by reducing the filter order to 1, but then again the filter will be a lot less steep.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-05-31T17:49:48.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2526" PostTypeId="2" ParentId="2480" CreationDate="2012-05-31T18:59:22.807" Score="9" Body="&lt;p&gt;The autocorrelation matrix is diagonalized by sinusoids when the process is stationary, this follows from the fact that the covariance operator is a convolution for a stationary process.  A more rigorous proof is that &#xA;$$f(t,s)=Cov(X(t),X(s))=Cov(X(t-u),X(s-u))=f(t-u,s-u)$$ which in particular means that $f(t,s)=f(t-s,0)$ which is also a positive seimidefinite function of $t-s$, hence by &lt;a href=&quot;http://en.wikipedia.org/wiki/Bochner%27s_theorem&quot;&gt;Bochner's Theorem&lt;/a&gt; we have $$Cov(X(s),X(t))=\int_{-\infty}^{\infty}e^{i(s-t)x}d\mu(x)$$ which proves the claim.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intuition is that an autocorrelation matrix estimated for some finite set of observations in a signal asymptotically behaves likes a circulant matrix because the correlation depends only on the time differences not the absolute positions and circulant matrices have discrete sinusoids as their eigenvectors (since they are convolution operators).  There are plenty of proofs of this and this is a sketchy intuition.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The set of autocorrelation functions that are diagonalized by sinusoids are exactly those that correspond to stationary processes, but many other processes's autocorrelation functions will be approximately diagonalized by sinusoids over some interval. These processes correspond to those that can approximated by stationary processes over an interval.  More details are &lt;a href=&quot;http://www.cmap.polytechnique.fr/~mallat/papiers/LocStatMPZ.ps&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;General non-stationary processes can have autocorrelation functions that need not be diagonalized by sinusoids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Locally stationary processes will either have a slowly changing spectrum and/or a small number of well-spaced abrupt changes in the spectrum.  Speech, animal noises, music, and many other natural sounds fit this description.  The reason why subspace identification algorithms work, as I understand it, is that some form local stationarity (not rigorous) generally holds for the types of signals we analyze.&lt;/p&gt;&#xA;" OwnerUserId="1449" LastEditorUserId="1449" LastEditDate="2012-05-31T19:40:44.877" LastActivityDate="2012-05-31T19:40:44.877" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2527" PostTypeId="1" AcceptedAnswerId="2528" CreationDate="2012-05-31T20:35:31.050" Score="1" ViewCount="531" Body="&lt;ul&gt;&#xA;&lt;li&gt;Is it possible to use voice recognition algorithms to reduce/remove the noise in financial time-series? &lt;/li&gt;&#xA;&lt;li&gt;Does such an approach even make sense?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If &quot;yes&quot;, how could that be done technically?&lt;/p&gt;&#xA;" OwnerUserId="1407" LastActivityDate="2012-05-31T23:12:34.003" Title="Using voice recognition algorithms to reduce noise in financial time-series?" Tags="|noise|" AnswerCount="1" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2528" PostTypeId="2" ParentId="2527" CreationDate="2012-05-31T21:03:24.697" Score="6" Body="&lt;p&gt;First, could you please explain what you mean by &quot;noise&quot; in financial time series? Are you talking about extracting a trend from time series?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In itself, speech recognition consists in converting a signal into a higher-level semantic, symbolic representation of this signal. It does not achieve any denoising, so it would be surprising to use speech recognition techniques to perform any modification of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you have something else in mind?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, a speech recognition system is made of the following layers:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A feature extraction module, converting chunks of audio signal into a vector of features capturing a representation of sound which is somewhat noise-robust and very roughly pitch invariant.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;An acoustic model (usually, GMMs) computing the match (a likelihood score) between the audio feature vector and a very large set of phone models.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Optionally, an adaptation module &quot;closing the loop&quot; between the first two steps - learning a better parametrization that makes the extracted features conform more to the known model.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then a hierarchy of HMM-like models (phones models, word pronunciation models, language model) - all combined into a single giant finite state transducer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The first step doesn't make sense at all for financial data, since the parametrization used for speech recognition is deeply rooted into the way speech sounds are produced, and perceived by the human ear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There could be financial applications of the kind of tools (Hidden Markov Models and their variants) used for the following steps... But then, it's a very well known artillery that is not specific to speech recognition and they are indeed widely used in time series analysis - for segmentation, change detection, detection of outliers, or automatic labeling of time series with the kind of &quot;patterns&quot; used by technical analysts.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-05-31T23:12:34.003" LastActivityDate="2012-05-31T23:12:34.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2529" PostTypeId="1" CreationDate="2012-05-31T22:01:58.307" Score="14" ViewCount="10622" Body="&lt;p&gt;I understand that a Laplacian-of-Gaussian filter can be approximated by a Difference-of-Gaussians filter, and that the ratio of the two sigmas for the latter should be 1:1.6 for the best approximation. However, I'm not sure how the two sigmas in the Difference of Gaussians relates to the sigma for the Laplacian of Gaussian. Is the smaller sigma in the former equal to the sigma of the latter? Is the larger sigma? Or is the relationship something else?&lt;/p&gt;&#xA;" OwnerUserId="1458" LastActivityDate="2015-07-29T11:03:26.977" Title="What is the relationship between the sigma in the Laplacian of Gaussian and the two sigmas in the Difference of Gaussians?" Tags="|image-processing|gaussian|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2530" PostTypeId="2" ParentId="2529" CreationDate="2012-06-01T02:31:14.170" Score="3" Body="&lt;p&gt;Maybe the &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplacian_of_Gaussian#The_difference_of_Gaussians_approach&quot; rel=&quot;nofollow&quot;&gt;formulas here&lt;/a&gt; can help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the scale space representation satisfies diffusion equation, the LoG can be computed as difference between two slices of scale space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therfore, when deriving DoG formula, we first approximate the LoG with finite differencing. I think the specific ratio for sigma comes from the fact a unit step in scale is taken to approximate LoG in the first place.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-06-01T02:31:14.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2532" PostTypeId="2" ParentId="2523" CreationDate="2012-06-01T05:40:22.207" Score="5" Body="&lt;p&gt;This might not be complete solution, but will give you good direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, what is the key criteria of to say that edges match? That &quot;locally&quot; the gradient of the edge matches and to some extent the distances are reasonable against how long the edge is continuous. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have geometric edges, like long straight lines, Hough will do very seamless job right away. But this doesn't work when edges are arbitrary curve. In this case, you can still think of curve as roughly piece wise constant segments (good enough in your case), hence, you should take Hough locally. i.e. you can take a small portion of image (say a block) compute the Hough and identify some peaks. Based on this, you can identify that de-houghing is creating meaningful gap, if so, keep it or move on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once smaller gaps are filled up, you can extend the same to take up on a larger size. the peaks will be more, but you may select fewer from it.&lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-06-01T05:40:22.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2533" PostTypeId="1" AcceptedAnswerId="2536" CreationDate="2012-06-01T08:26:04.267" Score="15" ViewCount="512" Body="&lt;p&gt;I have $n$ surfaces: $z_i(x,y)$ with a measured attribute (variable) on each surface: $a_i(x,y)$. Most of the surfaces will have a random distribution of the attribute across the surface, but some surfaces (the interesting ones) will show a meandering river pattern: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3GAob.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need your help in coming up with a measure that will tell us which of the $n$ surfaces are most likely to have such a pattern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many possible maps with the same histogram as shown below; so the measure needs to &quot;reward&quot; spatial continuity.&#xA;To illustrate this I have created a random image with nearly the same histogram as the river image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Smn2H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So image statistics ala entropy may only be part of the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of an image without a meandering river pattern:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WaGo5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My images are synthetic (made in Matlab). In real life the image without the pattern may have somewhat more spatial continuity in the form of small blobs of similar value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the images in grayscale:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GlMaw.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rfwSV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-06-01T11:22:22.550" LastActivityDate="2012-06-01T11:49:42.297" Title="Detecting meandering rivers in images" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2534" PostTypeId="2" ParentId="2533" CreationDate="2012-06-01T09:55:55.217" Score="4" Body="&lt;p&gt;You seem to be on the right track with that histogram. If this is a representative image from your sample then that histogram shows that the images where the meandering pattern is present could be detected just by examining if they contain values above a certain threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than this, you can try obtaining the &lt;a href=&quot;http://en.wikipedia.org/wiki/Entropy_%28information_theory%29&quot; rel=&quot;nofollow&quot;&gt;entropy&lt;/a&gt; of each image. That will give you one number per image that characterises its randomness. After that you can obtain a histogram of the entropies of your images. If you are sure that the images are distinctly divided into &quot;totally-random&quot; and &quot;random-with-a-meander&quot; (i.e. less random), then the histogram of the entropies will be bimodal. The left mode will correspond to images with lower entropy and therefore less randomness (more likely to contain a meandering pattern) and vice versa for the right mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(BTW MATLAB includes &lt;a href=&quot;http://www.mathworks.co.uk/help/toolbox/images/ref/entropy.html&quot; rel=&quot;nofollow&quot;&gt;a relevant function&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: As a response to the OP comments and subsequent uploading of more information about the problem, here is an additional point to this answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entropy would still work but not the plain simple memory-less case described by Shannon's formula (where each sample of a time series is assumed to be independent of the previous ones). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a simpler alternative then you could try examining features of the image's &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow&quot;&gt;autocorrelation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2012-06-01T11:49:42.297" LastActivityDate="2012-06-01T11:49:42.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2536" PostTypeId="2" ParentId="2533" CreationDate="2012-06-01T10:02:38.503" Score="13" Body="&lt;p&gt;A very simple measure would be to compare each row in the image with the row above it, allowing some horizontal shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've hacked together this simple algorithm in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mean[MapThread[&#xA;  Function[{line1, line2},&#xA;   Min[Table[Norm[line1 - RotateLeft[line2, shift]], {shift, -5, 5}]]&#xA;   ], {s[[2 ;;]], s[[;; -2]]}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It simply takes each pair of adjacent rows, rotates one of the rows by -5..5 pixels, and takes the smallest euclidean distance. This yields one euclidean distance for each row pair. I simply take the mean (but depending on your actual data, a truncated mean or median might be more robust).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the results I get for artificially generated samples (Formula: Normalize(random noise * (1-factor) + signal * factor))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7gOLX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I plot the result against the signal strength, the algorithm seems to measure the &quot;meandering river signal strength&quot; quite well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WsIFv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: I forgot to normalize the input samples. Fixed that an uploaded new result images&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2012-06-01T11:41:12.997" LastActivityDate="2012-06-01T11:41:12.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2537" PostTypeId="1" AcceptedAnswerId="2540" CreationDate="2012-06-01T10:36:10.097" Score="8" ViewCount="2362" Body="&lt;p&gt;In a current audio processing application, I am working entirely in the time domain using IIR filters. This is so I can use an audio buffer of just 3 or 4 samples and can guarantee that there will be some form of audio output within that frame. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were to switch to FIR based filters (to reduce filter ringing time as outlined in &lt;a href=&quot;https://dsp.stackexchange.com/questions/2522/what-bandpass-filter-design-will-yield-the-shortest-impulse-response&quot;&gt;this question&lt;/a&gt;), I would probably need to use an FFT-based overlap-add technique to maintain processing efficiency. As I see it, I would have to fill an FFT frame buffer with samples before I would be able to do the transforms. This would add an intrinsic latency to the algorithm proportional to the number of samples used to calculate the FFT. Am I missing a trick?&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-06-01T13:05:11.253" Title="Do FFT-based filtering methods add intrinsic latency to a real time algorithm?" Tags="|fft|infinite-impulse-response|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2538" PostTypeId="2" ParentId="2522" CreationDate="2012-06-01T10:40:01.807" Score="8" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter&quot;&gt;Butterworth filter's frequency response&lt;/a&gt; is the result of specific formulas and its characteristic is the flat passband frequency response. Consequently, if the coefficients of the IIR filter are modified in any way, the filter might not maintain the &quot;Butterworth&quot; characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to the responses by &quot;Hilmar&quot; and &quot;Jason R&quot;, maybe you could treat this as an optimisation problem of a fitness function that captures your specifications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could for example start with some design (e.g. a Butterworth filter) and then use an optimisation technique to move the zeros and poles about their locations (or modifying the design by adding / removing poles and zeros) trying to achieve your specifications (a sharper time-domain roll-off maintaining bandwidth and filter order). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Along this line, a large amount of work has been performed on designing filters with &lt;a href=&quot;https://www.google.co.uk/#hl=en&amp;amp;output=search&amp;amp;sclient=psy-ab&amp;amp;q=Genetic+Algorithms+digital+filter+design&amp;amp;oq=Genetic+Algorithms+digital+filter+design&amp;amp;fp=cf57736626366afb&quot;&gt;Genetic Algorithms&lt;/a&gt; (and &lt;a href=&quot;http://en.wikipedia.org/wiki/Genetic_algorithm&quot;&gt;here&lt;/a&gt;) and &lt;a href=&quot;https://www.google.co.uk/#hl=en&amp;amp;gs_nf=1&amp;amp;cp=41&amp;amp;gs_id=6&amp;amp;xhr=t&amp;amp;q=simulated+annealing+digital+filter+design&amp;amp;fp=cf57736626366afb&quot;&gt;Simulated Annealing&lt;/a&gt; (and &lt;a href=&quot;http://en.wikipedia.org/wiki/Simulated_annealing&quot;&gt;here&lt;/a&gt;) which you might find useful.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-06-01T10:40:01.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2539" PostTypeId="2" ParentId="2523" CreationDate="2012-06-01T11:34:37.167" Score="4" Body="&lt;p&gt;That's not going to be straightforward indeed... You could try working entirely with a Graph structure. First extract all the connected pixels from the image and insert them in a Graph where neighboring nodes are connected with an edge.  You could discard Graphs that are smaller than some M number of nodes (to exclude little spots that are not relevant to the image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of this process you will have a set of disconnected Graphs. (Judging from your image, these are not exactly Trees because there are cycles in there)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the extremal points of each Graph (the extremal pixels in the periphery of each Graph) by starting from some random node and doing a &lt;a href=&quot;http://en.wikipedia.org/wiki/Depth-first_search&quot; rel=&quot;nofollow&quot;&gt;DFS&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of this process you will have a set of pixel coordinates for each Graph corresponding to the extremal points where connections are more likely to form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now try to connect the nearest extremal point neighbors (with a distance &amp;lt;=5) simply with a straight line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, if you want to take into account the slope of the line segment that leads to that extremal pixel you could try to &quot;fit a line&quot; to N pixels PRIOR to reaching that extremal pixel. So if N = 5, then the last 5 pixels of a branch would be used in estimating a line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, for each nearest neighbor pair you now also have another thing to use as a criterion to judge if two segments should be connected (i.e. Extremal Point Distance &amp;lt;=5 pixels AND approximately equal line slope).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To minimise the impact of noise that may make your lines appear jagged near the branch's tips (and therefore distort your slope estimation) you could try applying a simplification step to your Graph (this is another point (besides the DFS above) where it pays to work with a Graph structure). You could for example remove subsequent nodes of the Graph that would make the line &quot;bend&quot; at angles greater than some cut-off (for something more complex, please see &lt;a href=&quot;http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;). In this way you will be fitting &quot;simpler&quot; lines, roughly to the direction of a larger part of the segment formed by the image pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That will probably result in decent connections for the majority of cases (judging by the image you have posted) but it would still leave you with some challenging ones. For example how would a &quot;Y&quot; shaped interrupted pattern where one of the branches is interrupted near the connection point be connected? (i.e., you have a &quot;continuous&quot; bend that must be connected with a line segment that &quot;blends&quot; with it). Perhaps you could review how common such cases are and revise your connection criteria later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, maybe it would be worth examining how you could improve your image acquisition (increase the resolution for example).&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-06-01T11:34:37.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2540" PostTypeId="2" ParentId="2537" CreationDate="2012-06-01T13:05:11.253" Score="11" Body="&lt;p&gt;You are correct. FFT based processing adds inherent latency to your system. However there are ways to tweak this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume you have an FIR filter of length &quot;N&quot;. This can be implement FFT-based using the standard overlap add or overlap save method, where the FFT length would be 2*N. Overall system latency will also be roughly 2*N: you need to accumulate a frame of N samples and then while you are accumulating the next input frame, do the math on the current frame. By the time the second frame has been accumulated (time offset 2*N), the first frame is ready to go out. If you have a fast CPU you can speed this up somewhat by using different alignment for input and output frames but that's typically more bother than it's worth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also break down the filter into K smaller blocks of length M, i.e. N = K*M. The FFT only needs to be done over M input samples and the delay and accumulation over the multiple filter sections is done in the frequency domain. Bill Gardner described a few flavors of that here: &lt;a href=&quot;http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF&quot;&gt;http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF&lt;/a&gt;&#xA;It's often referred to as a &quot;Block Convolver&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows to basically trade-off latency against efficiency and it provides a continuum between the direct FIR and the full-sized overlap add method. A nice side-effect of the Block Convolver is that the total filter length doesn't have to be a power of 2. For example you can implement a filter of 768 tabs as 6 blocks of 128 without any significant loss of efficiency.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-06-01T13:05:11.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2542" PostTypeId="2" ParentId="2507" CreationDate="2012-06-01T21:54:50.640" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I realize the two are derived using different algorithms&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, you can also get to the autocorrelated signal by taking the Fourier transform of the power spectrum, so I geuss you can say that the 2 are related by by doing 1 algorithm twice with some squaring in the middle :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think more deeply about what that means, you realise that if you have a harmonic signal, its frequency spectrum will have 'periodic' spikes. Taking the fourier transform once more will summarise this information into a potentially more useful form for further computation. Hope that adds another angle of thought for you.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-06-01T21:54:50.640" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2543" PostTypeId="1" AcceptedAnswerId="2544" CreationDate="2012-06-02T18:36:02.940" Score="13" ViewCount="7587" Body="&lt;p&gt;I'm gathering temperature data from a refrigerator.  The data looks like a wave.  I would like to determine the period and frequency of the wave (so that I can measure if modifications to the refrigerator have any effect).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using R, and I think I need to use an FFT on the data, but I'm not sure where to go from there.  I'm very new to R and signal analysis, so any help would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the wave I'm producing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1xXp3.png&quot; alt=&quot;My wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my R code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require(graphics)&#xA;library(DBI)&#xA;library(RSQLite)&#xA;&#xA;drv &amp;lt;- dbDriver(&quot;SQLite&quot;)&#xA;conn &amp;lt;- dbConnect(drv, dbname = &quot;s.sqlite3&quot;)&#xA;&#xA;query &amp;lt;- function(con, query) {&#xA;  rs &amp;lt;- dbSendQuery(con, query)&#xA;  data &amp;lt;- fetch(rs, n = -1)&#xA;  dbClearResult(rs)&#xA;  data&#xA;}&#xA;&#xA;box &amp;lt;- query(conn, &quot;&#xA;SELECT id,&#xA;       humidity / 10.0 as humidity,&#xA;       temp / 10.0 as temp,&#xA;       ambient_temp / 10.0 as ambient_temp,&#xA;       ambient_humidity / 10.0 as ambient_humidity,&#xA;       created_at&#xA;FROM measurements ORDER BY id DESC LIMIT 3600&#xA;&quot;)&#xA;&#xA;box$x &amp;lt;- as.POSIXct(box$created_at, tz = &quot;UTC&quot;)&#xA;&#xA;box$x_n &amp;lt;- box$temp - mean(box$temp)&#xA;png(filename = &quot;normalized.png&quot;, height = 750, width = 1000, bg = &quot;white&quot;)&#xA;plot(box$x, box$x_n, type=&quot;l&quot;)&#xA;&#xA;# Pad the de-meaned signal so the length is 10 * 3600&#xA;N_fft  &amp;lt;- 3600 * 10&#xA;padded &amp;lt;- c(box$x_n, seq(0, 0, length= (N_fft - length(box$x_n))))&#xA;X_f    &amp;lt;- fft(padded)&#xA;PSD    &amp;lt;- 10 * log10(abs(X_f) ** 2)&#xA;&#xA;png(filename = &quot;PSD.png&quot;, height = 750, width = 1000, bg = &quot;white&quot;)&#xA;plot(PSD, type=&quot;line&quot;)&#xA;&#xA;zoom &amp;lt;- PSD[1:300]&#xA;&#xA;png(filename = &quot;zoom.png&quot;, height = 750, width = 1000, bg = &quot;white&quot;)&#xA;plot(zoom, type=&quot;l&quot;)&#xA;&#xA;# Find the index with the highest point on the left half&#xA;index &amp;lt;- which(PSD == max(PSD[1:length(PSD) / 2]))&#xA;&#xA;# Mark it in green on the zoomed in graph&#xA;abline(v = index, col=&quot;green&quot;)&#xA;&#xA;f_s     &amp;lt;- 0.5 # sample rate in Hz&#xA;wave_hz &amp;lt;- index * (f_s / N_fft)&#xA;print(1 / (wave_hz * 60))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've posted the R code along with the SQLite database &lt;a href=&quot;https://github.com/tenderlove/rsausage&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot of the normalized graph (with the mean removed):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2Y27r.png&quot; alt=&quot;normalized graph&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, so good.  Here is the spectral density plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/94sMM.png&quot; alt=&quot;spectral density&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we zoom in on the left side of the plot and mark the highest index (which is 70) with a green line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tKKiB.png&quot; alt=&quot;zoom in on spectral plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally we calculate the frequency of the wave.  This wave is very slow, so we convert it to minutes per cycle, and print out that value which is 17.14286.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is &lt;a href=&quot;http://dl.dropbox.com/u/582984/data.txt&quot; rel=&quot;noreferrer&quot;&gt;my data in tab delimited format&lt;/a&gt; if anyone else wants to try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!  This problem was hard (for me) but I had a great time!&lt;/p&gt;&#xA;" OwnerUserId="1461" LastEditorUserId="1461" LastEditDate="2012-06-03T06:35:16.720" LastActivityDate="2012-06-03T06:35:16.720" Title="Determining Frequency and Period of a wave" Tags="|frequency|wave|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2544" PostTypeId="2" ParentId="2543" CreationDate="2012-06-02T18:44:06.270" Score="8" Body="&lt;p&gt;Interesting project you have going on there! :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a signal analysis POV, this is actually a simple question - and yes, you are right that you would utilize the FFT for this frequency estimation problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not familiar with R, but what you essentially want to do is take the FFT of your temperature signal. Since your signal is real, you will get a complex result as the output of your FFT. You can now take the absolute magnitude squared of your complex FFT result, (since we dont care about phase). That is, $real^2 + imag^2$. This is your power spectral density. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, very simply, find the max of where your PSD sits. The abscissa of that max will correspond to your frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveat Emptor, I am giving you a general outlook, and I suspect the result of the FFT in R will be normalized frequency, in which case you would have to know your sample rate, (which you do), in order to convert it back into Hz. There are many other important details that I am leaving out, such as your frequency resolution, FFT size, and the fact that you probably want to de-mean your signal first, but it will be good to see a plot first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us take your signal into account. After I de-mean it, it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RUbPr.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to de-mean because the DC bias is a frequency of 0 Hz technically, and you do not want it to drown out other frequencies of interest. Let us call this de-meaned signal $x[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when you take the FFT, you must take heed of some details. I use an FFT length of 10 times the length of the signal, so we can say that $N_{fft} = 10 * 3600 = 36000.$ Any FFT size set greater than the size of the original signal has the effect of interpolating your FFT result in the frequency domain. While this doesnt add any information for you from an information theory POV, it does help you better discern where exactly your true peak lies, especially in cases where it lies between two frequency bins. To get &lt;em&gt;true&lt;/em&gt; better frequency resolution, you want to get more data. (i.e, let the sensor run for a longer period of time). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving along, from the text file, I see that your sensor is taking temperature readings every 2 seconds. This means that your &lt;em&gt;sampling rate&lt;/em&gt;, or $f_s = 0.5 Hz$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, let us take an FFT of $x[n]$, and call that result $X(f)$. This result will be complex, and in fact, it is conjugate symmetric, but thats not important here. (It just means for your purposes, half of it is redundant). Now if we take $10log_{10}(|X(f)|^{2})$, this is the power spectral density (in log scale). The result looks like so: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fZILj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see how it is symmetric. If you ignore the last half, and just look at the first half and zoom in you, can see this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/29u1i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have a peak at index 70! But what is index 70 in real frequency terms? Here is where you want your frequency resolution. To compute that, we simply take $\frac{F_s}{N_{fft}} = 1.3889e-005 Hz$. This simply means that every index represents a frequency that is a multiple of this number. Index 0 is $0 * 1.3889e-005 = 0 Hz$. Index 1 is $1 * 1.3889e-005 = 1.3889e-005 Hz$. Index 70 is $70 * 1.3889e-005 = 9.7222e-004 Hz$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are almost done. Now that you have this figure, we can convert it to something more palatable. This figure is just saying that your signal completes 9.7222e-004 cycles every second. So we can ask, how many minutes does it take to compute one cycle? Thus, $\frac{1}{(9.7222e-004)*60} = 17.14$ minutes per cycle.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-06-03T02:43:10.680" LastActivityDate="2012-06-03T02:43:10.680" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="2545" PostTypeId="2" ParentId="2543" CreationDate="2012-06-02T19:50:31.627" Score="4" Body="&lt;p&gt;There is no need to do anything complicated: just measure the duration between peaks of the waveform.  This is the period.  The frequency is just 1 divided by the period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With about 8 cycles over 2 hours, the frequency is 4 cycles per hour, or about 1 mHz.&lt;/p&gt;&#xA;" OwnerUserId="64" LastActivityDate="2012-06-02T19:50:31.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2546" PostTypeId="2" ParentId="2543" CreationDate="2012-06-02T21:11:10.643" Score="4" Body="&lt;p&gt;For a waveform this smooth and stationary, counting sample points between positive going crossings of some average threshold value will give you a period estimate.  Look at several threshold crossing periods to get a more average estimate or detect any trend.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-06-02T21:11:10.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2550" PostTypeId="1" CreationDate="2012-06-04T13:26:54.673" Score="7" ViewCount="2908" Body="&lt;p&gt;I am interested in implementations of the Haar transform, and its inverse, such that when composed always result in the identity operation.  My inputs are discrete ordinals within a given range - and I need the output of the Haar transform to be similarly discrete ordinal (or fixed-point) numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've worked on the basis that if my input signal consists uniformly distributed samples on the range $0..(2^n-1)$ and, so does my transformed signal, then in principle, my original signal should be reproduced perfectly by the inverse haar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've dabbled with this (Matlab) implementation using GNU Octave:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://people.sc.fsu.edu/~jburkardt/m_src/haar/haar.html&quot;&gt;http://people.sc.fsu.edu/~jburkardt/m_src/haar/haar.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which uses double precision values... forcing me to use round() to establish a discrete representation of the transformed data so as to fit the transformed representation into the same state-space as the original.  Unsurprisingly, I found I needed to use round() again to the output from the inverse transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will probably come as no surprise that round(haar_2d_inverse(round(haar_2d(signal)))) is not quite the identity function for most values of signal... Anecdotally, there are typically a few out-by-one errors in the reconstructed signal - which seem roughly symmetric (+1 or -1 on a small number of the reconstructed samples) and this seems almost independent on the choice of n.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like to know is if there are 'better' implementations of haar_2d and haar_2d_inverse that work on ordinal samples?  Are the anomalies the consequence of the Haar implementation itself or the way I've applied round() at the intermediate stage?  If the latter, can I rectify this by scaling before rounding?&lt;/p&gt;&#xA;" OwnerUserId="1466" LastActivityDate="2014-06-22T06:09:58.410" Title="Discrete (Inverse) Haar (2D) transform implementations" Tags="|image-processing|matlab|discrete-signals|wavelet|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2552" PostTypeId="1" AcceptedAnswerId="2554" CreationDate="2012-06-04T20:20:14.467" Score="12" ViewCount="79610" Body="&lt;p&gt;I'm reading a paper in which a discrete signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n) = s(n) + w(n)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;is considered. $s(n)$ is a known, deterministic series, and $w(n)$ is white noise with zero mean. The authors write that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;signals were generated with an SNR of 20 dB &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does this mean?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What does signal energy mean? There seems to be several ways of defining this, but no attempt to do so is done in this paper.&lt;/li&gt;&#xA;&lt;li&gt;What does 20 dB SNR mean? I suppose that either $20=10\log{E_s/E_w}$, or $20=20\log{E_s/E_w}$, but am not familiar enough with these concepts to be sure.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1440" LastActivityDate="2018-05-30T17:25:51.093" Title="What is meant by 20 dB signal-to-noise ratio?" Tags="|discrete-signals|snr|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2553" PostTypeId="2" ParentId="2552" CreationDate="2012-06-04T20:59:30.067" Score="9" Body="&lt;p&gt;SNR is the ratio of the (mean) power of two independent signals, one called &quot;signal&quot; and the other &quot;noise&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the deterministic signal is periodic, then its power is defined as energy per period $E_s / T_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SNR is normally expressed in dB: $SNR_{dB} = 10 \log P_s/P_w$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your particular example, 20 dB means that the signal has 100 times the power of the (interfering) noise.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-06-04T20:59:30.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2554" PostTypeId="2" ParentId="2552" CreationDate="2012-06-04T21:02:29.207" Score="10" Body="&lt;p&gt;A discrete signal is often interpreted as an analog voltage signal. The signal &lt;code&gt;x(n)&lt;/code&gt; should be considered as a sampled version of &lt;code&gt;x(t)&lt;/code&gt; with a unknown sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Q1&lt;/em&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when we're talking about the energy of the signal, it is presumed that the voltage signal is obtained in a circuit with an 1Ω resistor in series, so that &lt;code&gt;v(t)^2/R = P&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Q2&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal-to-noise ratio is used in many areas and is defined as the logarithmic power ratio of the signal and noise, i.e. &lt;code&gt;SNR = 10*log(Ps/Pw)&lt;/code&gt;. The other &lt;code&gt;SNR = 20*log(Ps/Pw)&lt;/code&gt; is &lt;strong&gt;not&lt;/strong&gt; true, because the &lt;code&gt;Ps&lt;/code&gt; and &lt;code&gt;Pw&lt;/code&gt; are power values. The latter is used when the signals are represented as &quot;voltage&quot; signals, i.e. &lt;code&gt;SNR = 20*log(s(n)/w(n)) = 10*log(s(n)^2/w(n)^2)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="814" LastEditorUserId="814" LastEditDate="2012-06-05T07:48:08.073" LastActivityDate="2012-06-05T07:48:08.073" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2555" PostTypeId="1" CreationDate="2012-06-04T21:45:03.270" Score="13" ViewCount="11762" Body="&lt;p&gt;With application code, I have implemented a linear ADSR envelope for shaping the amplitude of an oscillator's output.  The parameters for attack, decay and release duration as well as sustain level can be set on the envelope and everything works as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to tweak the ramp shapes of the envelope to something that resembles what most synthesizers use for a more natural response: inverse exponential for the attack and exponential for the decay and release.  I am having trouble getting my formulas right for calculating the envelope output values for these types of ramp shapes.  To calculate the linear ramps, I am using the two-point form, plugging in the start/end $x$/$y$ values which are derived from the attack/decay/sustain/release input parameter values.  I cannot seem to work out the correct formula for exponential (standard and inverse) ramps using the same start/end $x$/$y$ point values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have saved &lt;a href=&quot;https://www.desmos.com/calculator/xuxwmr8yte&quot; rel=&quot;noreferrer&quot;&gt;a Desmos Graphing Calculator session&lt;/a&gt; that demonstrates the approach for linear ramps that I described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can help point me in the right direction, it would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1367" LastEditorUserId="1629" LastEditDate="2016-07-22T18:47:48.287" LastActivityDate="2023-01-12T00:28:39.877" Title="Help with equations for exponential ADSR envelope" Tags="|audio|software-implementation|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2556" PostTypeId="1" CreationDate="2012-06-05T08:09:30.257" Score="0" ViewCount="2464" Body="&lt;p&gt;I am trying to compare audio waveform from input waveform (A) to preset waveform (B)from in the device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to lookup everywhere. Most likely someone give such a source code as follow :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    function compireAudio(){  &#xA;    var audio1 =    &quot;http://soundjax.com/reddo/86502%5Ealarm.mp3&quot;;  &#xA;    var audio2 =    &quot;http://soundjax.com/reddo/44368%5EALARME.mp3&quot;; &#xA;    var i,j,d; &#xA;    var matching = 0; &#xA;    var t = 0;&#xA;    var i,j,d; &#xA;    var matching = 0; &#xA;    var t = 0; &#xA;    var audio1Arr = Array(); &#xA;    var audio1Len = audio1.length; &#xA;    for (i = 1; i&amp;lt;=audio1Len; i++) {&#xA;        //reverse so its like a stack&#xA;        d = audio1.charCodeAt(audio1Len-i);&#xA;        for (j = 0; j &amp;lt; 8; j++) &#xA;        {&#xA;            audio1Arr.push(d%2);&#xA;            d = Math.floor(d/2);&#xA;        } &#xA;     }&#xA;     var audio2Len = audio2.length; &#xA;     for (i = 1; i&amp;lt;=audio2Len; i++) {&#xA;       //reverse so its like a stack&#xA;       d = audio2.charCodeAt(audio2Len-i);&#xA;       for (j = 0; j &amp;lt; 8; j++) &#xA;       {&#xA;         if(d%2 == audio1Arr[t])&#xA;         {&#xA;             matching++;&#xA;         }&#xA;         d = Math.floor(d/2);&#xA;         t++;&#xA;       }  &#xA;     }&#xA;   var avarage = Number(matching)/((Number(t)+Number(audio1Arr.length))/Number(2))*Number(100);&#xA;    alert('The Matching with the two audio is '+avarage+' %.');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And most people said this is not correct because it compare the stream instead of the audio content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, I have think of compare every samples after normalization (ensure that amplitude is not a factor here). However, a phase is another problem here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have solution is cross-correlation between A and B and find the biggest convolution as output. In this case, they should be in same phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short.&#xA;&lt;strong&gt;WAS&lt;/strong&gt; &lt;em&gt;Question is What are the common methods for two waveform comparison ?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; Maybe I should ask What are the common characteristic of a audio waveform for comparing audio waveform ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I read &lt;a href=&quot;https://dsp.stackexchange.com/questions/1671/calculate-phase-angle-between-two-signals-i-e-digital-phase-meter&quot;&gt;this Question and answer&lt;/a&gt;. The bottom method seems work, but the comment said No.&lt;/p&gt;&#xA;" OwnerUserId="1469" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-06-06T12:22:27.687" Title="Audio signal comparison for automatic singing evaluation" Tags="|audio|waveform-similarity|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2557" PostTypeId="2" ParentId="2555" CreationDate="2012-06-05T10:47:06.877" Score="10" Body="&lt;p&gt;I think that what confuses you is that a decreasing exponential ($e^{-x}$) does never reach 0, so an ADSR generator with truly exponential segments would stay stuck ; because it would never reach the target value. For example, if the generator is at the height of the attack phase (say $y = 1$) and has to land to a sustain value at $y = 0.5$, it can't go there with a true exponential, because the true exponential won't decay to 0.5, it'll only asymptotically go to 0.5!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at an analog envelope generator (for example the &lt;a href=&quot;http://yusynth.net/archives/Electronics/J-Jacky-ADSR-1980.pdf&quot; rel=&quot;noreferrer&quot;&gt;7555 based circuit everybody seems to use&lt;/a&gt;), you can see that during the attack phase, when the capacitor is charging, it is &quot;aiming higher&quot; than the threshold used to indicate the end of the attack phase. On a (7)555 based circuit powered by +15V, During the attack stage, the capacitor is charged with a +15V step, but the attack stage ends when a threshold of +10V has been reached. This is a design choice, though &lt;a href=&quot;http://en.wikipedia.org/wiki/555_timer_IC&quot; rel=&quot;noreferrer&quot;&gt;2/3 is the &quot;magic number&quot;&lt;/a&gt; found in many classic envelope generator, and this might be the one musicians are familiar with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z9Fre.png&quot; alt=&quot;Some ADSR shapes resulting from different &amp;quot;aim ratio&amp;quot; during capacitor charge&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the functions you might want to deal with are not exponentials, but shifted/truncated/scales versions of it, and you'll have to make some choices as to how &quot;squashed&quot; you want them to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious anyway as to why you are trying to get such formulas - maybe it's because of the limits of the tool you are using for synthesis ; but if you are trying to implement those using a general purpose programming language (C, java, python) with some code running for each sample of the envelope, and a notion of &quot;state&quot;, read on... Because it's always easier to express things as &quot;such segment will go from whatever value it has just reached to 0&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My two pieces of advice on implementing envelopes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first one is &lt;em&gt;not&lt;/em&gt; to try to scale all the slopes/increments so that the envelope exactly reach start and end values. For example you want an envelope that goes from 0.8 to 0.2 in 2 seconds, so you might be tempted to compute an increment of -0.3 / second. Don't do that. Instead, break it down into two steps: getting a ramp that goes from 0 to 1.0 in 2 seconds ; and then applying a linear transform that maps 0 to 0.8 and 1.0 to 0.2. There are two advantages to work this way - the first is that it simplifies any computation you'll have relative to envelope times to a ramp from 0 to 1 ; the second is that if you change the envelope parameters (increments and start/end times) midway everything will remain well-behaved. Good if you're working on a synth, since people will ask to have envelope time parameters as modulation destinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second is to use pre-computed lookup table with envelope shapes. It is computationally lighter, it takes out many dirty details (for example you don't have to bother with an exponential not reaching 0 exactly - truncate it at your whim and rescale it so that it is mapped to [0, 1]), and it's dead easy to provide an option to alter envelope shapes, for each stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the pseudo-code for the approach I describe.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;render:&#xA;  counter += increment[stage]&#xA;  if counter &amp;gt; 1.0:&#xA;    stage = stage + 1&#xA;    start_value = value&#xA;    counter = 0&#xA;  position = interpolated_lookup(envelope_shape[stage], counter)&#xA;  value = start_value + (target_level[stage] - start_value) * position&#xA;&#xA;trigger(state):&#xA;  if state = ON:&#xA;    stage = ATTACK&#xA;    value = 0  # for mono-style envelopes that are reset to 0 on new notes&#xA;    counter = 0&#xA;  else:&#xA;    counter = 0&#xA;    stage = RELEASE&#xA;&#xA;initialization:&#xA;  target_level[ATTACK] = 1.0&#xA;  target_level[RELEASE] = 0.0&#xA;  target_level[END_OF_RELEASE] = 0.0&#xA;  increment[SUSTAIN] = 0.0&#xA;  increment[END_OF_RELEASE] = 0.0&#xA;&#xA;configuration:&#xA;  increment[ATTACK] = ...&#xA;  increment[DECAY] = ...&#xA;  target_level[DECAY] = target_level[SUSTAIN] = ...&#xA;  increment[RELEASE] = ...&#xA;  envelope_shape[ATTACK] = lookup_table_exponential&#xA;  envelope_shape[DECAY] = lookup_table_exponential&#xA;  envelope_shape[RELEASE] = lookup_table_exponential&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-06-05T12:09:57.143" LastActivityDate="2012-06-05T12:09:57.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2559" PostTypeId="2" ParentId="2556" CreationDate="2012-06-05T10:59:36.907" Score="6" Body="&lt;p&gt;Please update your question to mention which kind of comparison you want to perform. You seem to want your comparison to be robust to amplitude changes and time delays, but what about:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Audio coding. Should a signal and a MP3 version of itself be considered as similar or different?&lt;/li&gt;&#xA;&lt;li&gt;EQ and filtering. Should a signal and the same signal with the high frequencies shifted by 10° be considered similar or different?&lt;/li&gt;&#xA;&lt;li&gt;Dynamics change. Does applying a time-varying gain factor to one signal make it different from the original?&lt;/li&gt;&#xA;&lt;li&gt;Time and pitch shifting. Should a signal and a slightly accelerated version of itself be considered as similar or different?&lt;/li&gt;&#xA;&lt;li&gt;Noise and recording conditions. Should two versions of the same signal recorded on different equipment, microphone type, etc. be considered as similar or different?&lt;/li&gt;&#xA;&lt;li&gt;Timbre. Should two versions of the same melody played by two different instruments be considered as similar or different?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Depending on your application (assessing degradations through a signal processing chain, identifying copyrighted work in an audio stream, shazam-like song identification, plagiarism detection on music...), you might want your comparison to be robust to some of these transformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your approach consisting in normalizing the signals is not very robust. If you have two identical signals $x$ and $y(t)$, and if you change $x(0) = 2 \max_t y(t)$, the normalized version of $x$ is twice smaller than the normalized version $y$ and the comparison will fail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using cross-correlation to look for a time delay is a sound approach.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-06-05T10:59:36.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2560" PostTypeId="1" AcceptedAnswerId="2562" CreationDate="2012-06-05T11:35:53.177" Score="12" ViewCount="28414" Body="&lt;p&gt;I was reading the chapter on discrete Fourier transforms in Lyons' book -- Understanding Digital Signal Processing -- and could not understand the last paragraph about symmetry.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There’s an additional symmetry property of the DFT that deserves mention at this point. In practice, we’re occasionally required to determine the DFT of real input functions where the input index $n$ is defined over both positive and negative values. If that real input function is even, then $X(m)$ is always real and even; that is, if the real $x(n) = x(−n)$, then, $X_{\textrm{real}}(m)$ is in general nonzero and $X_{\textrm{imag}}(m)$ is zero. Conversely, if the real input function is odd, $x(n) = −x(−n)$, then $X_{\textrm{real}}(m)$ is always zero and $X_{\textrm{imag}}(m)$ is, in general, nonzero.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Note: $X(m) = X_{\textrm{real}}(m) + jX_{\textrm{imag}}(m)$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Firstly, what is meant by &quot;odd&quot; and &quot;even&quot;? I suspect it's the number of samples in the input signal, but that leads me to my second question,&lt;/li&gt;&#xA;&lt;li&gt;Why is $X_{\textrm{imag}}(m)$ zero with real input functions that are even, and why, with real input functions that are odd, is $X_{\textrm{real}}(m)$ zero and $X_{\textrm{imag}}(m)$ generally non-zero?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1297" LastEditorUserId="1629" LastEditDate="2016-04-06T11:50:50.837" LastActivityDate="2016-04-06T11:50:50.837" Title="Discrete Fourier transform symmetry" Tags="|discrete-signals|dft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2562" PostTypeId="2" ParentId="2560" CreationDate="2012-06-05T11:55:24.413" Score="10" Body="&lt;p&gt;Even &amp;amp; odd refer to the symmetry around $n = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even means $x[n] = x[-n]$; you can get the part for $n &amp;lt; 0$ by simply mirroring the part for $n &amp;gt; 0$ at the $n=0$ line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Odd means $x[n] = -x[-n]$; you can get the part for $n &amp;lt; 0$ by simply mirroring the part for $n &amp;gt; 0$ at the $n=0$ line and multiplying it by $-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A cosine wave is even, sine wave is odd. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are all just special cases of the general symmetry that says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;if it's real in one domain, it's conjugate symmetric in the other.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Conjugate symmetric means that the real part is even and the imaginary part is odd. Most people know that a real time domain signal as a conjugate symmetric spectrum, but it also goers the other way around: a conjugate symmetric time domain signal has a real valued spectrum.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="1629" LastEditDate="2016-04-06T11:50:40.430" LastActivityDate="2016-04-06T11:50:40.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2563" PostTypeId="1" CreationDate="2012-06-05T12:02:16.820" Score="2" ViewCount="1382" Body="&lt;p&gt;I have to detect my elbow. I'm able to produce an image in which I'm facing the camera, standing before it and my arms are in my body plane(body plane is plane containing my head,chest,and legs)(i.e. to say that my arms don't stick out of this plane though they may be placed on my chest parallel to the body plane). Then using skin detection I'm getting my both arm, hand and palm.(I'm wearing half shirt so little portion of my arm is detected between elbow and shoulder). Then using convex hull defect method the point giving the largest defect should be my elbow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This thing is fine theoretically but does not work practically. Before using the convex hull and defects method my hand and arm contour is a bit wavy (and if the waves become a bit more high then that point is detected as my elbow than the real one). Or if i use polynomial approximation method then also it is not detecting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Skeletonization of image takes considerable time and I'm doing this real time.(My image has two contours of my both hands, that's it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm doing this in opencv c++. Any Help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1471" LastActivityDate="2012-06-05T12:02:16.820" Title="OpenCV detecting elbow" Tags="|image-processing|computer-vision|opencv|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2564" PostTypeId="1" AcceptedAnswerId="2889" CreationDate="2012-06-05T12:41:29.490" Score="21" ViewCount="75953" Body="&lt;p&gt;I have to connect nearby contours in an image based on the distance between them which specifies if the contours are to be connected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now there's a question already on the same problem here &lt;a href=&quot;https://stackoverflow.com/questions/8973017/opencv-c-obj-c-connect-nearby-contours&quot;&gt;https://stackoverflow.com/questions/8973017/opencv-c-obj-c-connect-nearby-contours&lt;/a&gt; but here he merges all contours into a single one. This I don't want. I don't think that there is some function in opencv for this but you can suggest an algorithm for that. My application goes like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm detecting hands, so I used a skin detection algorithm to determine them but since my skin ain't white and maybe because of lightening conditions sometime the contour breaks of at elbow. So i want the nearby contours to be connected but not all of them (because both both my hands will be there in contours.) (By hands I mean from shoulder to palm.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover I think that by using some edge detection I will get my hands boundaries and detect if some of this patch inside this boundary is detected as skin then whole region within this boundary will be detected as skin but i'm not sure how to do this part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Help will be appreciated. Thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RoKEh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this Image I wanna connect points (8 connectivity) which are less than say 40 pixels of distance so that I'll get my left hand as a single contour&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to only get hand's contour (I don't care about any other region)&lt;/p&gt;&#xA;" OwnerUserId="1471" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2020-01-15T18:16:20.683" Title="OpenCV/C++ connect nearby contours based on distance between them" Tags="|image-processing|computer-vision|opencv|morphological-operations|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2565" PostTypeId="1" CreationDate="2012-06-05T12:56:40.077" Score="8" ViewCount="7276" Body="&lt;p&gt;I have to capture skin colour independent of illumination.&#xA;I used the following criteria(using hsv and rgb) but it ain't working:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int h = get_hue(...);&#xA;int s = get_saturation(...);&#xA;int r = get_red_component(...);&#xA;int g = get_green_component(...);&#xA;int b = get_blue_component(...);&#xA;&#xA;if ((h&amp;lt;38)&amp;amp;&amp;amp;(h&amp;gt;6)&amp;amp;&amp;amp;(s&amp;gt;0.23)&amp;amp;&amp;amp;(s&amp;lt;0.68)){&#xA;    // skin color&#xA;}&#xA;else if ((r&amp;gt;95) &amp;amp;&amp;amp; (g&amp;gt;40) &amp;amp;&amp;amp; (b&amp;gt;20) &amp;amp;&amp;amp; &#xA;         ((maximum(r,g,b)-minimum(r,g,b))&amp;gt;15) &amp;amp;&amp;amp; &#xA;         (abs(r-g)&amp;gt;15)&amp;amp;&amp;amp;(r&amp;gt;g)&amp;amp;&amp;amp;(r&amp;gt;b)){&#xA;   // also skin color&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works in the morning when my skin is illuminated but by evening it does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Help will be appreciated. Thanks in Advance.&#xA;(PS -my skin ain't white.)&lt;/p&gt;&#xA;" OwnerUserId="1471" LastEditorUserId="1471" LastEditDate="2012-06-06T03:07:41.147" LastActivityDate="2013-11-14T17:55:53.383" Title="OpenCV detectin skin colour invariant with illumination changes" Tags="|image-processing|opencv|object-recognition|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2566" PostTypeId="1" CreationDate="2012-06-05T13:41:54.063" Score="5" ViewCount="6149" Body="&lt;p&gt;I think I must have misunderstood something regarding the relation between impulse and frequency responses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have calculated the Impulse Response Function, IRF, from the Frequency Response Function, FRF, by FFT and then I find some strange things, among these that my assumption that the IRF will always be real is not correct. I have in my code used only the real part of the result from FFT when defining the IRF. Then the amplitude response (and phase) are not correct when I convolve my signal with a sine wave. I expect no phase lag and a slight amplification of a sine wave with period 10 seconds, but get a signal with the wrong amplitude and a slight phase mismatch instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should I do with the imaginary part of the IRF i get back from FFT?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Details for those with a lot of time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Python and NumPy to try to work out the response of a LTI system to an arbitrary response. I guess the same would apply to Matlab or any other numerical tool implementing DFT. I know a priori the frequency response function, FTR (called a Response Amplitude Operator, RAO, in my field, naval hydrodynamics). As a test case I define my FRF as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Define RAO&#xA;omegas = 2*pi / numpy.array([5, 9, 10, 11, 30])&#xA;rao = numpy.array([0, 0, 1.1, 0, 0], dtype=complex) # Fake &quot;ship roll&quot; RAO&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The frequency response for my fake ship roll RAO is 1.1 for a wave period of 10 seconds and zero when you get more than one second in wave period away from the peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using numpy.fft to find the impulse response function, IRF. I interpolate my RAO and apply FFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def make_double(x):&#xA;    &quot;&quot;&quot;&#xA;    Make a double spectrum by copying the input reversed&#xA;    Does not divide the results by two after the mirroring &#xA;    &quot;&quot;&quot;&#xA;    return numpy.concatenate((x, x[::-1]))&#xA;&#xA;def rao_to_irf(omegas, rao, tmax, dt):&#xA;    &quot;&quot;&quot;&#xA;    Take an RAO defined for a set of (increasing) frequencies and &#xA;    compute the corresponding impulse response function by FFT.&#xA;&#xA;    The RAO is inter-/extrapolated to the necessary delta omega&#xA;    required to obtain the wanted time step, delta t&#xA;&#xA;    The RAO is assumed to be a complex array&#xA;    &quot;&quot;&quot;&#xA;    assert omegas[0] &amp;lt; omegas[-1], &quot;The RAO frequencies, omegas, must be given in increasing order&quot;&#xA;&#xA;    N = numpy.ceil(tmax/dt)&#xA;    dw = pi/N/dt&#xA;&#xA;    omegas_long = numpy.arange(N, dtype=float)*dw&#xA;    rao_long = interpolate_complex_1d(omegas, rao, fill=0)(omegas_long)&#xA;&#xA;    irf = ifft(make_double(rao_long))[:N]*N/tmax&#xA;    t = numpy.arange(N)*dt&#xA;&#xA;    return t, irf.real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I have an IRF (?). To check the response I also implemented the inverse and see that the RAO/FRF calculated from the IRF looks similar to the input RAO (when interpolated to constant frequency spacing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can now combine my RAO/FRF with a wave spectrum and perform a time realization using FFT. I also make a realization of the spectrum to get the unmodified input wave signal. This signal I convolve with the IRF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the expected result if my RAO/FRF is 1 for all frequencies (meaning I get the wave signal back). However the response to the peaked RAO defined above is not as I expect. The time realization from the wave spectrum multiplied by the RAO^2 is not the same as the result of the convolution. Should not these match. I am pretty sure our code to make realizations of response spectra works as it should and I have tested with wave spectra consisting of one pure sine wave and the response is as expected with an FFT of the response spectrum, but not when using convolution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/23dbV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/HgNBD.png&quot; alt=&quot;enter image description here&quot;&gt;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the convoluted question&lt;/p&gt;&#xA;" OwnerUserId="1472" LastEditorUserId="29" LastEditDate="2012-06-05T14:20:17.150" LastActivityDate="2013-02-25T19:47:31.347" Title="Complex impulse response functions?" Tags="|fft|impulse-response|python|frequency-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2567" PostTypeId="2" ParentId="2066" CreationDate="2012-06-05T13:43:01.887" Score="5" Body="&lt;p&gt;When you are doing visual tracking you need a &lt;strong&gt;model&lt;/strong&gt;, which is a mathematical representation of a real-world process. This model will give sense to any data obtained from measurements, will connect the numbers we put into and we get out of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But a model is a simplification of reality because you will use a reduced number of parameters. What you don't know about the system is called &lt;strong&gt;noise&lt;/strong&gt; or uncertainty. It is as important as what you know. As we cannot describe a system perfectly, we need measurements from the real world to tell us what is happening to the system we are modelling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kalman is a tool for combining what we estimate, with our model, and what we measure from the world, by combining both in a weighted sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will calculate a &lt;strong&gt;state&lt;/strong&gt; every step. That's what you currently know about the system. The state is influenced by the &lt;strong&gt;process equation&lt;/strong&gt; and the &lt;strong&gt;measurement equation&lt;/strong&gt;. Both equations have different noise covariances. Kalman will decide which of both has more influence each step by adjusting the Kalman gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the way I think about this when I don't wan't to get deep into formulas.&lt;/p&gt;&#xA;" OwnerUserId="1473" LastActivityDate="2012-06-05T13:43:01.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2568" PostTypeId="1" CreationDate="2012-06-05T13:54:12.947" Score="3" ViewCount="888" Body="&lt;p&gt;I am developing an augmented reality SDK that uses Kalman for tracking a planar marker. My state is composed of 3D position, a quaternion, velocity and angular velocity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{bmatrix}{\vec{p}}\\{\vec{q}}\\{\vec{v}}\\{\vec{\omega }}\end{bmatrix}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason Kalman is not tracking properly. I think that the problem is our measurement model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4CUL1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use points (we tried 4 and 8) detected in the &lt;strong&gt;&lt;em&gt;real-world marker&lt;/em&gt;&lt;/strong&gt; (proyected points) as measurements $ z_k$. Kalman predicted measurements $h(x_k^-)$ are the matches of those points in the &lt;strong&gt;&lt;em&gt;trained-marker&lt;/em&gt;&lt;/strong&gt;, and proyected with the homography predicted by Kalman.&#xA; Kalman doesn't predict homography directly, but can be extracted from position and quaternion. Homography from Kalman should proyect the matched pairs close to the measured pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a good measurement model? Does anybody have a better idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a &lt;a href=&quot;http://www.youtube.com/watch?v=3JpzM-Un32I&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; of the expected result of project of this type with Kalman softening the tracking. In our project the 3D projections are shaking, it is not precise.&lt;/p&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="1473" LastEditDate="2012-06-06T08:01:52.007" LastActivityDate="2012-06-06T08:01:52.007" Title="Optimal measurement model for Kalman in Augmented Reality" Tags="|opencv|kalman-filters|augmented-reality|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2569" PostTypeId="2" ParentId="2566" CreationDate="2012-06-05T14:08:05.920" Score="2" Body="&lt;p&gt;Filters are usually real, not complex, but occasionally they are complex.  What do you do with the complex impulse response?  Convolve it with your data, just like you would with a real impulse response.  This will likely result in a complex output.  What you do with the imaginary part at that point depends on the situation.  Sometimes it makes sense to leave the data complex, sometimes it makes sense to get rid of the imaginary part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imaginary part of the filter would particularly affect the output phase, so the fact that the output phase is not what you expected when you only used the real part of the impulse response makes sense.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-06-05T14:28:02.330" LastActivityDate="2012-06-05T14:28:02.330" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2570" PostTypeId="1" CreationDate="2012-06-05T14:59:07.803" Score="3" ViewCount="5638" Body="&lt;p&gt;I'm receiving PCM data trough socket connection in packets containing 320 samples. Sample rate of sound is 8000 samples per second. I am doing with it something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int size = 160 * 2;//160;&#xA;int isinverse = 1;&#xA;kiss_fft_scalar zero;&#xA;memset(&amp;amp;zero,0,sizeof(zero));&#xA;kiss_fft_cpx fft_in[size];&#xA;kiss_fft_cpx fft_out[size];&#xA;kiss_fft_cpx fft_reconstructed[size];&#xA;&#xA;kiss_fftr_cfg fft = kiss_fftr_alloc(size*2 ,0 ,0,0);&#xA;kiss_fftr_cfg ifft = kiss_fftr_alloc(size*2,isinverse,0,0);&#xA;&#xA;for (int i = 0; i &amp;lt; size; i++) {&#xA;    fft_in[i].r = zero;&#xA;    fft_in[i].i = zero;&#xA;    fft_out[i].r = zero;&#xA;    fft_out[i].i = zero;&#xA;    fft_reconstructed[i].r = zero;&#xA;    fft_reconstructed[i].i = zero;&#xA;}&#xA;&#xA;// got my data through socket connection&#xA;&#xA;for (int i = 0; i &amp;lt; size; i++) {&#xA;     // samples are type of short&#xA;     fft_in[i].r = samples[i];&#xA;     fft_in[i].i = zero;&#xA;     fft_out[i].r = zero;&#xA;     fft_out[i].i = zero;&#xA; }&#xA;&#xA; kiss_fftr(fft, (kiss_fft_scalar*) fft_in, fft_out);&#xA; kiss_fftri(ifft, fft_out, (kiss_fft_scalar*)fft_reconstructed);&#xA;&#xA; // lets normalize samples&#xA; for (int i = 0; i &amp;lt; size; i++) {&#xA;     samples[i] = rint(fft_reconstructed[i].r/(size*2));&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that I fill OpenAL buffers and play them. Everything works just fine but I would like to do some filtering of audio between &lt;code&gt;kiss_fftr&lt;/code&gt; and &lt;code&gt;kiss_fftri&lt;/code&gt;. Starting point as I think for this is to convert sound from time domain to frequency domain, but I don't really understand what kind of data I'm receiving from &lt;code&gt;kiss_fftr&lt;/code&gt; function. What information is stored in each of those complex number, what its real and imaginary part can tell me about frequency. And I don't know which frequencies are covered (what frequency span) in &lt;code&gt;fft_out&lt;/code&gt; - which indexes corresponds to which frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am total newbie in signal processing and Fourier transform topics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help?&lt;/p&gt;&#xA;" OwnerUserId="1474" LastActivityDate="2016-04-22T11:33:06.667" Title="Output of KISS FFT interpretation" Tags="|filters|audio|fft|c|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2571" PostTypeId="2" ParentId="1484" CreationDate="2012-06-05T15:12:35.190" Score="8" Body="&lt;p&gt;Even if my answer comes too late for you, maybe other people find this useful. I have the codes for an openCV Pose from Homography. I found the method at this really useful website, &lt;a href=&quot;http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm&quot; rel=&quot;nofollow&quot;&gt;euclideanspace&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void cameraPoseFromHomography(const Mat&amp;amp; H, Mat&amp;amp; pose)&#xA;{&#xA;    pose = Mat::eye(3, 4, CV_64FC1); //3x4 matrix&#xA;    float norm1 = (float)norm(H.col(0)); &#xA;    float norm2 = (float)norm(H.col(1));&#xA;    float tnorm = (norm1 + norm2) / 2.0f;&#xA;&#xA;    Mat v1 = H.col(0);&#xA;    Mat v2 = pose.col(0);&#xA;&#xA;    cv::normalize(v1, v2); // Normalize the rotation&#xA;&#xA;    v1 = H.col(1);&#xA;    v2 = pose.col(1);&#xA;&#xA;    cv::normalize(v1, v2);&#xA;&#xA;    v1 = pose.col(0);&#xA;    v2 = pose.col(1);&#xA;&#xA;    Mat v3 = v1.cross(v2);  //Computes the cross-product of v1 and v2&#xA;    Mat c2 = pose.col(2);&#xA;    v3.copyTo(c2);      &#xA;&#xA;    pose.col(3) = H.col(2) / tnorm; //vector t [R|t]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;////&lt;/p&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="19424" LastEditDate="2016-02-05T19:54:55.330" LastActivityDate="2016-02-05T19:54:55.330" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2572" PostTypeId="2" ParentId="2570" CreationDate="2012-06-05T16:08:55.487" Score="2" Body="&lt;p&gt;What you might want to investigate is FFT fast convolution using overlap-add or overlap-save methods. You will need to expand the length of each FFT by the length of the impulse of your desired filter. This is because (1) FFT/IFFT convolution is circular, and (2) each index in the FFT array result corresponds to almost all frequencies (a Sinc shaped response), not just one (even if mostly concentrated near one), so any single bin modification will leak throughout the entire frequency response (except certain exact periodic frequencies).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-06-05T16:08:55.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2573" PostTypeId="2" ParentId="2570" CreationDate="2012-06-05T17:00:01.303" Score="0" Body="&lt;p&gt;Each output &quot;bucket&quot; from the FFT represents a frequency band.  The left-most bucket represents DC, the next up very low frequencies, the next up a little higher, etc.  Each step is a fixed number of Hertz.  If &lt;code&gt;f&lt;/code&gt; is the sampling frequency and &lt;code&gt;N&lt;/code&gt; (which should normally be a power of 2) is the number of FFT &lt;em&gt;input&lt;/em&gt; buckets, there will be &lt;code&gt;N/2&lt;/code&gt; output buckets (each with both real and imaginary parts), and the highest output bucket will correspond to a frequency of &lt;code&gt;f/2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the output of kiss_fftr is your &quot;frequency domain&quot; information.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the real vs imaginary parts, that has to do with the phase/timing of that frequency vs all the others.  If you think about a nice smooth sinusoid waveform, and look at it at some instant in time, the vertical line denoting the current time will hit the wave at the peak, at the valley, near midway, or somewhere in-between.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we define the peak as 1.0 real &amp;amp; 0.0 imaginary, the valley would -1.0 real and 0.0 imaginary, and midway would be 0.0 real and +/- 1.0 imaginary (with the +/- depending on whether your on the falling slope or the rising one).  (Actually, I suspect that the &quot;official&quot; version would have 1.0 real be midway on the rising slope, but it's harder to explain that way, and the reference point is somewhat arbitrary anyway.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you appear to be using an &lt;code&gt;N&lt;/code&gt; of 320 -- not a power of 2.  I'm no expert on this, but my impression is that, while in concept you can do FFT on a non-power-of-2 buffer, in practice many FFT algorithms do not handle it well.  (And I would not expect kiss_fft, being a fairly primitive algorithm, to &quot;handle it well&quot;.)  But as I said, I'm no expert, so maybe someone else has some input on this point.&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-06-05T17:00:01.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2574" PostTypeId="1" AcceptedAnswerId="2575" CreationDate="2012-06-05T18:16:28.980" Score="13" ViewCount="1229" Body="&lt;p&gt;I´m currently working on an accordion synthesizer and I would like to make it sound as natural as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really like how the following wave sounds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dl.dropbox.com/u/20437903/onda%20acordeon.wav&quot;&gt;https://dl.dropbox.com/u/20437903/onda%20acordeon.wav&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wave looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://dl.dropbox.com/u/20437903/wave%20img.png&quot; alt=&quot;example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the wave it looks like it had harmonics added and substracted. Am I wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I´m a bit new to sound synthesis and would be very grateful if anyone could please help me identifying the effects applied to the wave and some guidance to apply them. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1476" LastEditorUserId="1059" LastEditDate="2012-06-05T18:34:07.450" LastActivityDate="2012-12-15T21:08:45.240" Title="Sound synthesis effects for natural sounds" Tags="|music|sound|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2575" PostTypeId="2" ParentId="2574" CreationDate="2012-06-05T20:17:08.330" Score="13" Body="&lt;p&gt;First, grab &lt;a href=&quot;http://www.sonicvisualiser.org/&quot;&gt;Sonic Visualizer&lt;/a&gt;, it is much better than Audacity for looking at sounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you see here is probably the result of the sum of two simple and stationary sounds at fundamental frequencies close to each other. This causes &lt;a href=&quot;http://en.wikipedia.org/wiki/Beat_%28acoustics%29&quot;&gt;beating&lt;/a&gt; of their fundamental, causing the amplitude modulation (tremolo) you observe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two important factors make a synthetic sound &quot;feel&quot; natural:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Whether it accurately reproduce the sound of the original instrument over time. Some criteria to look at: timbre (distribution of harmonics), timbre modulations over time, amplitude modulation over time (presence of tremolo, overall amplitude envelope), pitch modulations (presence of vibrato, does the instrument instantly reaches the target note or is there a short transition like on brass instruments...).&lt;/li&gt;&#xA;&lt;li&gt;How it responds to control by the performer. You have to list which parameters, along with note data, will be available to your system (will it synthesize sounds from a bare MIDI file? From a MIDI keyboard sensitive to velocity and aftertouch? From a dedicated hardware device emulating an accordion, with accelerometers and pressure sensors?), and understand how to map these inputs to synthesis parameters. You also have to list which controls the performer will have over the system (for example, is there an option for the user to switch on/off the different registers?).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I will mention 3 synthesis approaches you can follow for this problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Sampling. Record, one by one, all the notes of an accordion, under different performance parameters (how hard the below is moved for example, all different combinations of registers). Play back from this exhaustive database of sounds, with loops to make them last as long as you want. Advantages: a note taken in isolation sounds indistinguishable from the real thing. Drawbacks: might sound &quot;fake&quot;, and will not respond to performer input (not &quot;expressive&quot;) unless you start doing some signal manipulation on the recorded sample - at which point they won't sound as natural as they were recorded. A lot of disk/memory used by the samples. Warning: it's quite an involved job to exhaustively sample an instrument and organize all the data, and there are already companies very good at doing this kind of stuff - it'll be hard to beat them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Classic subtractive synthesis. You could start with two square or pulse waves, slightly detuned to get beating, a tad of high-pass filtering to give it a &quot;nasal&quot; quality, and an EQ to color this... Then stack several of those to get different registers. Check in the patch libraries of classic &quot;old&quot; synths (JX8p, D50, M1)... they all have decent accordion sounds which are totally sample-free. Advantages: can be made very expressive - since you have control over the whole production of the sound, you can easily map input parameters on sound parameters. You won't have to reinvent the wheel and can base yourself on existing sound synthesis code. Inconvenient: will sound &quot;synthetic&quot; (but &quot;lively &amp;amp; synthetic&quot; is sometimes better than &quot;realistic &amp;amp; dead&quot;!).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Physical modeling. You could get something more realistic than vanilla subtractive synthesis by using physical modeling - try cobbling together (for example in csound, Max/MSP or supercollider) a few reed models (the 3 mentioned programs have basic primitive for physical modeling - but I'm not sure they have free reeds), add EQ or a simple resonator. Ideally, you could get something both realistic sounding and controllable, though it's not the easiest path!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-06-05T20:17:08.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2576" PostTypeId="2" ParentId="2574" CreationDate="2012-06-05T20:51:09.167" Score="5" Body="&lt;p&gt;Some accordions have multiple reeds per note, with the reeds not precisely in tune with other.  So you see beats.  You also see some odd harmonics unhidden during lower frequency beat cancellation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-06-05T20:51:09.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2577" PostTypeId="1" AcceptedAnswerId="4792" CreationDate="2012-06-05T21:05:50.863" Score="10" ViewCount="1437" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/endolith/scipy/compare/master...patch-1&quot; rel=&quot;nofollow&quot;&gt;I'm trying to add documentation&lt;/a&gt; for all the window functions in scipy.signal, and I'm stuck on the &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.slepian.html&quot; rel=&quot;nofollow&quot;&gt;Slepian&lt;/a&gt; (same as DPSS?) and &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.general_gaussian.html&quot; rel=&quot;nofollow&quot;&gt;Generalized Gaussian&lt;/a&gt; windows, which I'd never heard of before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two variables that are shape parameters of some type, &lt;code&gt;p&lt;/code&gt; in the generalized Gaussian, and &lt;code&gt;width&lt;/code&gt; in the Slepian.  (&lt;code&gt;sig&lt;/code&gt; appears to be sigma, the standard deviation.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Instead of me reverse-engineering and guessing, can anyone explain what these variables are called and what they do?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can you explain what these windows are useful for or where they are used?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def general_gaussian(M, p, sig, sym=True):&#xA;    &quot;&quot;&quot;Return a window with a generalized Gaussian shape.&#xA;&#xA;    The Gaussian shape is defined as ``exp(-0.5*(x/sig)**(2*p))``, the&#xA;    half-power point is at ``(2*log(2)))**(1/(2*p)) * sig``.&#xA;&#xA;    &quot;&quot;&quot;&#xA;    if M &amp;lt; 1:&#xA;        return np.array([])&#xA;    if M == 1:&#xA;        return np.ones(1, 'd')&#xA;    odd = M % 2&#xA;    if not sym and not odd:&#xA;        M = M + 1&#xA;    n = np.arange(0, M) - (M - 1.0) / 2.0&#xA;    w = np.exp(-0.5 * (n / sig) ** (2 * p))&#xA;    if not sym and not odd:&#xA;        w = w[:-1]&#xA;    return w&#xA;&#xA;def slepian(M, width, sym=True):&#xA;    &quot;&quot;&quot;Return the M-point slepian window.&#xA;&#xA;    &quot;&quot;&quot;&#xA;    if (M * width &amp;gt; 27.38):&#xA;        raise ValueError(&quot;Cannot reliably obtain slepian sequences for&quot;&#xA;              &quot; M*width &amp;gt; 27.38.&quot;)&#xA;    if M &amp;lt; 1:&#xA;        return np.array([])&#xA;    if M == 1:&#xA;        return np.ones(1, 'd')&#xA;    odd = M % 2&#xA;    if not sym and not odd:&#xA;        M = M + 1&#xA;&#xA;    twoF = width / 2.0&#xA;    alpha = (M - 1) / 2.0&#xA;    m = np.arange(0, M) - alpha&#xA;    n = m[:, np.newaxis]&#xA;    k = m[np.newaxis, :]&#xA;    AF = twoF * special.sinc(twoF * (n - k))&#xA;    [lam, vec] = linalg.eig(AF)&#xA;    ind = np.argmax(abs(lam), axis=-1)&#xA;    w = np.abs(vec[:, ind])&#xA;    w = w / max(w)&#xA;&#xA;    if not sym and not odd:&#xA;        w = w[:-1]&#xA;    return w&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Possible matches:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/endolith/nitime/blob/master/nitime/algorithms/spectral.py#L381&quot; rel=&quot;nofollow&quot;&gt;nipy's dpss_windows function&lt;/a&gt; uses &lt;code&gt;NW&lt;/code&gt;, the &quot;standardized half bandwidth corresponding to 2NW = BW*f0 = BW*N/dt but with dt taken as 1&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/dpss.html&quot; rel=&quot;nofollow&quot;&gt;Matlab's dpss&lt;/a&gt; uses &lt;code&gt;time_halfbandwidth&lt;/code&gt; Is this the same window?  Is &lt;code&gt;time_halfbandwidth&lt;/code&gt; the same thing as &lt;code&gt;width&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Slepian_DPSS_Window.html&quot; rel=&quot;nofollow&quot;&gt;This DPSS definition&lt;/a&gt; has $ \omega_c$ &quot;the desired main-lobe cut-off frequency in radians per second&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Generalized_normal_distribution&quot; rel=&quot;nofollow&quot;&gt;Generalized normal distribution&lt;/a&gt; has β (equal to twice &lt;code&gt;p&lt;/code&gt;?) which is just called a shape parameter, with normal distribution for β = 1 and Laplace distribution for β = 2.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-10-07T15:33:01.317" LastActivityDate="2013-10-31T05:19:48.713" Title="A few questions about Slepian and generalized gaussian windows" Tags="|window-functions|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2578" PostTypeId="1" CreationDate="2012-06-06T00:15:20.033" Score="9" ViewCount="286" Body="&lt;p&gt;For a linear state-space model with independent Gaussian state and output noises and perfect guess for initial state, do &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#The_Kalman_filter&quot;&gt;Kalman estimates&lt;/a&gt; have the following properties:&#xA;$$&#xA;E(\hat{x}_{k|k} - x_k) = 0&#xA;$$&#xA;$$&#xA;P_{k|k} = Var(\hat{x}_{k|k} - x_k),\text{ or }Var(\hat{x}_{k|k}),\text{ or }Var(x_k) ?&#xA;$$&#xA;where &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$x_k$ is the state at time $k$, which is random&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\hat{x}_{k|k}$ and $P_{k|k}$ are Kalman esitmates, i.e. outputs of Kalman filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Are there references mentioning these?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="203" LastActivityDate="2013-06-11T12:33:21.330" Title="Statistical properties of the Kalman estimates under Gaussian noise" Tags="|kalman-filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2581" PostTypeId="2" ParentId="2347" CreationDate="2012-06-06T08:43:33.063" Score="24" Body="&lt;p&gt;I found a good way of thinking intuitively of Kalman Gain $K$. If you write $K$ this way&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\ \bf{K_k} = \bf{P_k^-\, H_k^{\rm T} (H_k P_k^-\, H_k^{\rm T} + R_k)^{-1}}&#xA;  = \bf{\frac {P_k^-\, H_k^{\rm T}}{H_k P_k^-\, H_k^{\rm T} + R_k}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you will realize that the relative magnitudes of matrices ($R_k$) and ($P_k$) control a relation between the filter's use of predicted state estimate ($x_{k}⁻$) and measurement ($ỹ_k$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;  \lim\limits_{\bf{R_k \to 0}} \bf{{P_k^-\, H_k^{\rm T}} \over\&#xA;  {H_k P_k^-\, H_k^{\rm T} + R_k}}\&#xA;    = \bf{H_k^{-1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;  \lim\limits_{\bf{P_k \to 0}} \bf{{P_k^-\, H_k^{\rm T}} \over\&#xA;  {H_k P_k^-\, H_k^{\rm T} + R_k}}\&#xA;   = \bf 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting the first limit into the measurement update equation &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;  \bf{\hat x_k} = \bf{x_k^-} + \bf{K_k}(\bf{\tilde y_k}-\bf{H_k}\bf{x_k^-})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;suggests that when the magnitude of $R$ is small, meaning that the measurements are accurate, the state estimate depends mostly on the measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the state is known accurately, then $H P^⁻ H^T$ is small compared to $R$, and the filter mostly ignores the measurements relying instead on the prediction derived from the previous state ($x_k⁻$).&lt;/p&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="1473" LastEditDate="2012-06-06T10:00:20.083" LastActivityDate="2012-06-06T10:00:20.083" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2582" PostTypeId="2" ParentId="2556" CreationDate="2012-06-06T12:21:45.363" Score="2" Body="&lt;p&gt;The target application is automatic singing evaluation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you want this to recognize that the lyrics are sung correctly? If not (you don't mind if the people is singing meaningless words, humming, whistling), the only thing that is worth being compared is the pitch contour - you can extract that and ditch all the other information from the waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple system would at least do the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Break down your signal into short frames (20 or 50 ms), use a pitch extractor such as YIN to extract the pitch of the reference signal (good singing), and of the recorded signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Look for the optimal shift in pitch to account for the fact that people might sing one octave above or below the original, and shift the recorded pitch sequence by this. You don't want to penalize a female singer for singing one octave above the original song.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Align the two sequences using DTW. How much the DTW path deviates from a straight line give you the rhythmic accuracy ; the total DTW distance after alignment gives you the overall pitch accuracy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can also get an objective quality metric, which doesn't require an original recording, by measuring the average distance between the pitch contour and the nearest pitch on the tempered scale.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can also give &quot;stylistic&quot; bonus points by detecting vibrato (is there a steady sinusoidal modulation of the pitch contour on held notes)...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These techniques are well-known in the MIR community - and companies like BMAT or Voxler already have commercial SDKs for doing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For recognizing lyrics, the most basic solution would consist in extracting a sequence of MFCC from the original ; a sequence of MFCC from the recorded performance, then finding the MFCC transform matrix that minimizes the DTW distance between the two sequences (to account for voice timbre difference - aka &lt;a href=&quot;http://www.ee.ucla.edu/~spapl/paper/panchap_ltfw.pdf&quot; rel=&quot;nofollow&quot;&gt;Vocal Tract Length Normalization&lt;/a&gt;) ; and use this minimal DTW distance as a &quot;lyrics similarity&quot; score.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-06-06T12:21:45.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2583" PostTypeId="2" ParentId="2560" CreationDate="2012-06-06T13:30:01.020" Score="9" Body="&lt;p&gt;Hilmar's answer is of course perfectly correct, but I think there there are several points that Lyons did not address in the statement quoted by the OP (or maybe he talked about them previously and chose not to repeat himself in the paragraph quoted by the OP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Discrete Fourier Transform (DFT) is commonly described as a transformation of &#xA;a sequence $(x[0], x[1], \ldots, x[N-1])$ of finite length $N$&#xA;into another sequence $(X[0], X[1], \ldots, X[N-1])$ of length&#xA;$N$ where&#xA;$$\begin{align*}&#xA;X[m] &amp;amp;= \sum_{k=0}^{N-1} x[k]\exp\left(\frac{-j2\pi mk}{N}\right), &#xA;~ m = 0, 1, \ldots, N-1,\\&#xA;x[n] &amp;amp;= \frac{1}{N}\sum_{m=0}^{N-1} X[m]\exp\left(\frac{j2\pi nm}{N}\right), &#xA;~ n = 0, 1, \ldots, N-1.&#xA;\end{align*}$$&#xA;But these formulas can also be used when $m, n$ are outside the range &#xA;$[0, N-1]$ and if we do so, we come to the conclusion that the length-$N$&#xA;DFT can be viewed as a  transformation from a &lt;em&gt;periodic&lt;/em&gt; sequence $x[\cdot]$&#xA;to another &lt;em&gt;periodic&lt;/em&gt; sequence $X[\cdot]$, both extending to infinity&#xA;in both directions, and that $(x[0], x[1], \ldots, x[N-1])$ and $(X[0], X[1], \ldots, X[N-1])$ are just &lt;em&gt;one period&lt;/em&gt; of these infinitely long sequences.&#xA;Note that we are insisting that $x[n+iN] = x[n]$ and $X[m+iN] = X[m]$ for&#xA;all $m, n,$ and $i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is, of course, not how data are often handled in practice. We may have&#xA;a very long sequence of samples, and we break them up into blocks&#xA;of suitable length $N$.  We calculate the DFT of $(x[0], x[1], \ldots, x[N-1])$  as&#xA;$$X^{(0)}[m] = \sum_{k=0}^{N-1} x[k]\exp\left(\frac{-j2\pi mk}{N}\right), &#xA;~ m = 0, 1, \ldots, N-1,$$&#xA;the DFT of the next chunk $(x[N], x[N+1], \ldots, x[2N-1])$  as&#xA;$$X^{(1)}[m] = \sum_{k=0}^{N-1} x[k+N]\exp\left(\frac{-j2\pi mk}{N}\right), &#xA;~ m = 0, 1, \ldots, N-1,$$&#xA;the  DFT of the previous chunk $(x[-N], x[-N+1], \ldots, x[-1])$  as&#xA;$$X^{(-1)}[m] = \sum_{k=0}^{N-1} x[k-N]\exp\left(\frac{-j2\pi mk}{N}\right), &#xA;~ m = 0, 1, \ldots, N-1,$$&#xA;etc. and then we play with these various DFTs of the various chunks&#xA;into which we have subdivided our data.  Of course, if the data &#xA;are in fact periodic with period $N$, all these DFTs will be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when Lyons&#xA;talks of &lt;em&gt;...where the input index n is defined over both positive and negative values...&lt;/em&gt; he is talking of the &lt;em&gt;periodic&lt;/em&gt; case, and when he says that&#xA;a (real) even function has the property &#xA;$x[n] = x[-n]$, this property must hold for &lt;strong&gt;all&lt;/strong&gt; integers $n$.&#xA;Since periodicity also applies, we have not only that $x[-1] = x[1]$&#xA;but $x[-1] = x[-1+N] = x[N-1]$, and similarly, $x[-n] = x[n] = x[N-n]$.&#xA;In other words, the &lt;em&gt;real even sequence&lt;/em&gt; $(x[0], x[1], \ldots, x[N-1])$ whose&#xA;DFT is a real even sequence (as stated by Lyons and explained very&#xA;nicely by Hilmar) is &lt;em&gt;necessarily&lt;/em&gt; of the form&#xA;$$(x[0], x[1], \ldots, x[N-1])&#xA;= (x[0], x[1], x[2], x[3], \ldots, x[3], x[2], x[1])$$&#xA;which is (apart from the leading $x[0]$) a &lt;em&gt;palindromic&lt;/em&gt; sequence.&#xA;If you are partitioning your data into blocks of length $N$&#xA;and computing the DFT of each block separately, then these&#xA;separate DFTs will &lt;em&gt;not&lt;/em&gt; have the symmetry properties&#xA;described above unless the DFT is of a block with this&#xA;palindromic property.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-06-06T13:30:01.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2584" PostTypeId="1" CreationDate="2012-06-06T14:02:34.817" Score="1" ViewCount="348" Body="&lt;p&gt;I've been using a program for identifying harmonics for a wave after doing a fourier analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.phon.ucl.ac.uk/resource/sfs/esynth.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.phon.ucl.ac.uk/resource/sfs/esynth.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to be able to tweak some of the harmonics involed in a wave and also to add harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The program mentioned above permits this kind of operations but it isn't precise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a good tool for harmonic analysis and synthesis like the one mentioned above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps:It's important that the program exports the harmonics to a file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks.&lt;/p&gt;&#xA;" OwnerUserId="1476" LastEditorUserId="1476" LastEditDate="2012-06-06T14:17:08.997" LastActivityDate="2014-09-11T07:19:41.993" Title="Tool for Harmonic Analysis &amp; Synthesis" Tags="|frequency-spectrum|music|peak-detection|sound|" AnswerCount="1" CommentCount="5" ClosedDate="2014-09-11T19:15:31.120" ContentLicense="CC BY-SA 3.0" />
  <row Id="2585" PostTypeId="1" CreationDate="2012-06-06T09:23:32.337" Score="6" ViewCount="906" Body="&lt;p&gt;I have an image of 480x360 px that contains eye portion only i.e., sclera iris, pupil, eyebrows  etc. Now I have to find the lower eyelid in the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've done till now is that cut the image in 2 parts upper and lower half. Now apply edge detector (Canny) on lower part and then parabola fitting on the resultant image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting ok results but eyelid is not parabola so sometimes  the parabola goes into the sclera region also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking to doing curve fitting but a better idea looks like funding a curved line in the edge map. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help in finding the curved line in the edge map ?&lt;/p&gt;&#xA;" OwnerUserId="1504" OwnerDisplayName="t0mkaka" LastActivityDate="2015-10-14T16:29:24.267" Title="How to find the lower eyelid in an image?" Tags="|matlab|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2586" PostTypeId="2" ParentId="1066" CreationDate="2012-06-06T21:56:16.323" Score="0" Body="&lt;p&gt;A similar (or that same ?) technique that Jason describes is known as Time Delay Spectrometry, based on the original work of Richard Heyser. It was also the rage in acoustic measurements for a while and the AES published actually an anthology on it: &lt;a href=&quot;http://www.aes.org/publications/anthologies/&quot; rel=&quot;nofollow&quot;&gt;http://www.aes.org/publications/anthologies/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to measure by exciting with a complex sweep and use matching tracking filters (downmix and lowpass) to get the real and imaginary parts of the transfer function. Under certain circumstances this can be replaced with a single sweep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the relationships between frequency resolution, time resolution, sweep rate, low pass filter bandwidth, steepness, and phase response are very complicated and it's quite easy to end up with time domain or frequency domain aliasing or simply smearing.&#xA;It's also quite sensitive to small non-linearites and to small time variances, especially if they are sinusoidal (e.g. a microphone vibrating on a mic stand). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are definitely more robust methods to measure transfer functions.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-06-06T21:56:16.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2588" PostTypeId="1" CreationDate="2012-06-07T06:21:40.180" Score="4" ViewCount="2334" Body="&lt;p&gt;i have to distinguish between palm and elbow in my contour(I'm using cvconvexitydefect for that purpose). Here's the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0dfZQ.jpg&quot; alt=&quot;http://imageshack.us/content_round.php?page=done&amp;amp;l=img194/5232/capture12a.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm taking contour of left image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the 2 topmost points in right image are shoulder(detected by other method)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;bottom left 2 are darker than bottom right 2 (to distinguish between left and right hand)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using the code defect.start is darker than defect.end(but for left hand defect.start is palm while for right hand defect.start is elbow)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 2 questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;So how does cvconvexity defect get it's defect.start?&lt;/li&gt;&#xA;&lt;li&gt;In any case how to differentiate palm from elbow?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To be clear i thought that i could make out the palm from elbow just by thinking that start might be upper most point of a contour or leftmost point of that but it ain't so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here's the relevant part of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cvFindContours( HeadLess1, mem, &amp;amp;contours, sizeof(CvContour), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0));&#xA;&#xA;for(ptr=contours;ptr!=0;ptr=ptr-&amp;gt;h_next){&#xA;    tem=cvConvexHull2(ptr,0,1,0);&#xA;    tem=cvConvexityDefects(ptr,tem,mem);&#xA;    CvConvexityDefect defect,cd;&#xA;    defect.depth=0;&#xA;&#xA;    for(int l=0;l&amp;lt;tem-&amp;gt;total;l++){&#xA;        cd=*(CvConvexityDefect*)cvGetSeqElem(tem,l);&#xA;        if(cd.depth&amp;gt;defect.depth)defect=cd;&#xA;    }&#xA;&#xA;    if((*(defect.start)).y&amp;gt;(*(defect.end)).y){&#xA;        elbow=(*(defect.start));palm=(*(defect.end));&#xA;        //a bad inference for the case when palm is above elbow&#xA;    } else { &#xA;        elbow=(*(defect.end));palm=(*(defect.start));&#xA;        //a bad inference same case&#xA;    }&#xA;&#xA;    if(elbow.x&amp;lt;320)&#xA;    {&#xA;        q=100;&#xA;    }&#xA;    else&#xA;    {&#xA;        q=200;&#xA;    }&#xA;&#xA;    cvCircle(HeadLess1,*(defect.start),10,cvScalarAll(q),CV_FILLED);&#xA;    cvCircle(HeadLess1, *(defect.end), 10, cvScalarAll(q+50), CV_FILLED);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Headless1 one is my image. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="1471" LastEditorUserId="590" LastEditDate="2012-06-07T16:14:49.327" LastActivityDate="2012-06-07T16:14:49.327" Title="what is the starting point of a contour as given by cvConvexityDefect() function in OpenCV" Tags="|image-processing|computer-vision|opencv|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2589" PostTypeId="1" CreationDate="2012-06-07T09:08:37.797" Score="3" ViewCount="395" Body="&lt;p&gt;I'm trying to make a channel vocoder that takes two inputs, one a frequency rich carrier (a musical sound) and the other a modulator (vocals). Applying operations involved in the channel vocoder generates an output that makes the vocals sing in the tone of the carrier. (Think Songify.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presently I'm splitting both the signals into windows of a specified size and also overlapping two consecutive windows by a certain factor. FFTs of the windows of the carrier and modulator are then computed. The fft is further split into bands of equal length. The average of magnitudes of modulator's fft in that particular &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for band_no = 0 to band_count:&#xA;        for i = 0 to band_length:&#xA;                avg+=magnitudeOfModulatorFFT[band_no*band_length + i];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am then multiplying &quot;avg&quot; to each of carrierFFT's frequency value lying within the band, and then taking the inverse FFT. Although this produces the desired output, it also includes a clicking sound. Even after multiplying both the signals by a window function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way I could solve this?&lt;/p&gt;&#xA;" OwnerUserId="1426" LastEditorUserId="1426" LastEditDate="2012-06-07T13:42:37.630" LastActivityDate="2012-10-26T02:06:46.560" Title="Channel Vocoder producing output with &quot;click&quot; sounds" Tags="|fft|fourier-transform|frequency-spectrum|window-functions|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2590" PostTypeId="2" ParentId="2560" CreationDate="2012-06-07T09:11:50.647" Score="1" Body="&lt;p&gt;Just for even and odd function clarification, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even : symmetric with respect to y axis&#xA;Odd:   symmetric with respect to origin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And without going into mathematical details, DFT of real valued function is symmetric, i.e. resultant  Fourier function has both real and imaginary parts which are mirror images with respect to 0 frequency component. This doesn't happen in case where you take DFT of a complex function.&lt;/p&gt;&#xA;" OwnerUserId="1451" LastActivityDate="2012-06-07T09:11:50.647" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2591" PostTypeId="2" ParentId="1433" CreationDate="2012-06-07T09:27:02.843" Score="3" Body="&lt;p&gt;@Dipan Mehta covered the &lt;em&gt;feature descriptors&lt;/em&gt; that can be used. Let me now try and cover the other side of the coin by mentioning some &lt;strong&gt;feature detection methods&lt;/strong&gt; that extract features good for &lt;em&gt;CBIR&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My reference for my &lt;em&gt;CBIR&lt;/em&gt; research were the papers by &lt;a href=&quot;http://web.cs.swarthmore.edu/~turnbull/cs97/f08/paper/sivic03.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sivic, Zisserman&lt;/a&gt; and &lt;a href=&quot;http://www.wisdom.weizmann.ac.il/~bagon/CVspring07/files/scalable.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nister, Stewenius&lt;/a&gt;. There are more current papers from these authors, but these present all of the relevant ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They argue that to implement an efficient &lt;em&gt;CBIR&lt;/em&gt; methods, features of &lt;em&gt;complementary properties&lt;/em&gt; should be used:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Shape Adapted&lt;/strong&gt; regions&lt;/em&gt; - tend to be centered at &lt;em&gt;corner-like&lt;/em&gt; features &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;examples:&lt;/em&gt;&#xA;Harris corners, multi-scale Harris, DoG (Difference of Gaussians - but also responds to edges!)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Maximally Stable&lt;/strong&gt; regions&lt;/em&gt; - tend to be centered at &lt;em&gt;blob-like&lt;/em&gt; features&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;examples:&lt;/em&gt;&#xA;MSER  (Maximally Stable Extermal Regions), DoG&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Suprisingly, &lt;a href=&quot;http://en.wikipedia.org/wiki/Feature_detection_(computer_vision)#Types_of_image_features&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; also offers a good classification of feature (detector) types, stating the type of interest regions they detect for most of the current widely used features:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;edge detectors&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;corner detectors&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;blob detectors&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;ridge detectors&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Most current articles I have read swear that &lt;strong&gt;SIFT (Scale-invariant feature transform)&lt;/strong&gt; descriptors rock and are sufficiently robust to use in the combination with chosen feature detectors. References include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;already provided links&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.google.com/url?url=http://scholar.google.com/scholar_url%3Fhl%3Den%26q%3Dhttp://hal.inria.fr/docs/00/54/85/29/PDF/mikolajczyk_pami05.pdf%26sa%3DX%26scisig%3DAAGBfm0CGD2Q6h56CLizidvviKXVkbeYzw%26oi%3Dscholarr&amp;amp;rct=j&amp;amp;sa=X&amp;amp;ei=2nDQT6PSM8aN0wX3qfzJCw&amp;amp;ved=0CAcQgAMoADAA&amp;amp;q=a+performance+evaluation+of+local+descriptors&amp;amp;usg=AFQjCNF7n98KIXc3pKJqYhyZtfHLeL2H3A&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mikolajczyk, Schmid&lt;/a&gt; deals with comparison of &lt;em&gt;local descriptors&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=5955377&amp;amp;contentType=Conference+Publications&amp;amp;searchField%3DSearch_All%26queryText%3DFinding+the+Best+Feature+Detector-Descriptor+Combination&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dahl&lt;/a&gt; evaluates &lt;em&gt;detector-descriptor&lt;/em&gt; combinations&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note!&lt;/em&gt; that these papers do not deal strictly with &lt;em&gt;CBIR&lt;/em&gt; but are used as references in &lt;em&gt;CBIR&lt;/em&gt;-related works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, it is wort mentioning that successful &lt;em&gt;CBIR&lt;/em&gt; methods do not depend only on &lt;em&gt;feature detectors&lt;/em&gt; and &lt;em&gt;descriptors&lt;/em&gt; used, but also:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;an efficient search structure (quantisation of visual features)&lt;/li&gt;&#xA;&lt;li&gt;way for constructing &lt;strong&gt;image descriptors&lt;/strong&gt; -- either based on the common visual features (local descriptors), or by comparing global image descriptors (this is a very new idea, so no references currently)&lt;/li&gt;&#xA;&lt;li&gt;distance measure between image descriptors&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, I have already answered some questions concerning &lt;em&gt;CBIR&lt;/em&gt; on &lt;em&gt;DSP&lt;/em&gt; and &lt;em&gt;stackoverflow&lt;/em&gt;, both are accompanied with references and explanation and I think they might be relevant, so you might want to take a look:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;DSP: &lt;a href=&quot;https://dsp.stackexchange.com/q/2422/1273&quot;&gt;1&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;stackoverflow: &lt;a href=&quot;https://stackoverflow.com/a/10482256/884412&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://stackoverflow.com/a/10041801/884412&quot;&gt;2&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-06-07T09:27:02.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2592" PostTypeId="2" ParentId="1881" CreationDate="2012-06-07T13:30:10.350" Score="6" Body="&lt;p&gt;If you have the extrinsics then it is very easy. Having extrinsics is the same as having &quot;camera pose&quot; and the same as having the homography. Check this &lt;a href=&quot;https://stackoverflow.com/a/10750648/744859&quot;&gt;post&lt;/a&gt; in stackoverflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have extrinsics, also called camera pose, which is described as a translation and a rotation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle Pose =\begin{bmatrix}R|t \end{bmatrix} = \begin{bmatrix}R_{11} &amp;amp;R_{12}&amp;amp;R_{13}&amp;amp;t_x\\R_{21}&amp;amp;R_{22}&amp;amp;R_{23}&amp;amp;t_y\\R_{31}&amp;amp;R_{32}&amp;amp;R_{33}&amp;amp;t_z \end{bmatrix} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get &lt;strong&gt;Homography&lt;/strong&gt; from &lt;strong&gt;Pose&lt;/strong&gt; this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle   H = \frac{1}{t_z}\begin{bmatrix}{R_{1x}}&amp;amp;{R_{2x}}&amp;amp;{t_x}\\{R_{1y}}&amp;amp;{R_{2y}}&amp;amp;{t_y}\\{R_{1z}}&amp;amp;{R_{2z}}&amp;amp;{t_z}\end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can project your 2D points into the corresponding 3D points by multiplying the Homography by the points:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_{2D}=\begin{bmatrix}x &amp;amp;y &amp;amp;1\end{bmatrix}\quad$ add $\quad z=1\quad$ to make them homogeneous&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_{3D}=H*p_{2D}  $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p= p / p(z)\quad$   Normalize the points&lt;/p&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-06-07T13:30:10.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2593" PostTypeId="2" ParentId="2588" CreationDate="2012-06-07T15:32:19.887" Score="2" Body="&lt;p&gt;If you can obtain coordinates for the points you show in the right hand image, and you know the points relating to the shoulders, could you presume that the palms were further from the shoulder than the elbow is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you assume this to be true, then you simply need to find the distance from the shoulder to the elbow &amp;amp; palm and call the point with the larger distance the palm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you could bend your arm in such a way that the palm would be closer to the elbow, so perhaps this isn't an ideal method...&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2012-06-07T15:32:19.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2594" PostTypeId="2" ParentId="1883" CreationDate="2012-06-07T16:11:13.887" Score="2" Body="&lt;p&gt;This code on the File Exchange will help you find all the local maxima.&#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/14498-local-maxima-minima&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/14498-local-maxima-minima&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have some knowledge about how many lines you want to find (in this case five), you simply select the five local maxima with the highest Hough scores.&lt;/p&gt;&#xA;" OwnerUserId="1481" LastActivityDate="2012-06-07T16:11:13.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2596" PostTypeId="2" ParentId="2382" CreationDate="2012-06-07T20:42:44.590" Score="2" Body="&lt;p&gt;Here is a little inspiration showing the opposite of what you are seeking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start with fig3.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Find background&#xA;labels = bwlabel(~fig3);&#xA;[n,idx] = hist(labels(:),0:max(labels(:)));&#xA;[bgrSize bgrLableIdx] = max(n);&#xA;bgr = (labels == idx(bgrLableIdx));&#xA;bgr = imopen(bgr,strel('disk',3));&#xA;&#xA;% Remove border objects and cleanup&#xA;borderCleared = imclearborder(~bgr);&#xA;borderCleared = imopen(borderCleared,strel('disk',3));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LEJES.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1481" LastEditorUserId="1481" LastEditDate="2012-06-07T20:48:00.643" LastActivityDate="2012-06-07T20:48:00.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2597" PostTypeId="2" ParentId="2486" CreationDate="2012-06-07T21:44:52.610" Score="0" Body="&lt;p&gt;I'm assuming what you want to know is something like&#xA;&quot;Hey, I hear that H.264/AVC/MPEG-4 Part 10 allows each B macroblocks to either copy from a single past I or P frames, copy from a single future I or P frame, code as an INTRA block without reference to the past or future, or &quot;&lt;a href=&quot;http://books.google.com/books?id=k7nOAiIUo9IC&amp;amp;pg=SA5-PA37&amp;amp;lpg=SA5-PA37&amp;amp;dq=two%20motion%20vectors%20per%20partition&amp;amp;source=bl&amp;amp;ots=rCUninJEEH&amp;amp;sig=NbUsScTP5Ufclk9gup_g0iT9sHA&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=fBfRT7S-Bcq02gXL8uGjDw&amp;amp;ved=0CEUQ6AEwAQ#v=onepage&amp;amp;q=two%20motion%20vectors%20per%20partition&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;bipredict&lt;/a&gt;&quot; and copy from some kind of average of two different I or P frames. Why would an encoder ever choose &lt;a href=&quot;http://books.google.com/books?id=od1PLzHJbJYC&amp;amp;pg=PA703&amp;amp;lpg=PA703&amp;amp;dq=two%20motion%20vectors%20per%20partition&amp;amp;source=bl&amp;amp;ots=uPW7XwpojB&amp;amp;sig=40Wi5EIWBG6u66qbwXGte_QoGDk&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=fBfRT7S-Bcq02gXL8uGjDw&amp;amp;ved=0CFAQ6AEwBA#v=onepage&amp;amp;q=two%20motion%20vectors%20per%20partition&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;biprediction&lt;/a&gt;?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two examples I like to use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A gradual sunset&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A gradual sunset, where the sun-lit objects slowly dim to black, but in the gaps between the leaves you start to notice a campfire and other lights.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Say you have a large macroblock in the current B frame that includes part of a foreground leaf that is dimming from sun-lit bright green to black, a background dim campfire that is more-or-less constant brightness, and the ragged edge between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The encoder could try to estimate that macroblock from &lt;em&gt;only&lt;/em&gt; the past or &lt;em&gt;only&lt;/em&gt; the future I or P frame. We'll end up with an estimate where the leaf is too bright or too dim, or else (if we use weighted prediction) the campfire is too bright or too dim. In any of those four cases, the ragged edge makes it take a lot of bits to describe exactly &lt;em&gt;which&lt;/em&gt; pixels need to be fixed-up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, averaging the corresponding location in the past I or P frame with the &quot;next&quot; &quot;future&quot; I or P frame, we get an estimate that the leaf will be some intermediate brightness, the campfire will be the same constant brightness, and the ragged edge between them is the same.&#xA;If the encoder chooses that &quot;biprediction&quot; approach, then in this case the estimate is closer to the actual snapshot we're trying to encode as a B frame. So &lt;strong&gt;biprediction&lt;/strong&gt; lets us get better quality or use fewer bits or both (in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A big van&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A big van moving across the screen, partially blocking some highly detailed unchanging background&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As the van moves forward, some highly-detailed background behind its back edge becomes exposed. That information cannot be found in the previous I or P frame (it's still blocked by the van), but it can be found in the &quot;next&quot; &quot;future&quot; I or P frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the van moves forward, the region in front of the van will soon be occluded.&#xA;That highly-detailed background immediately in front of the van in the current B frame cannot be found in the &quot;future&quot; I or P frame (where it is blocked by the van), but it can be copied from the previous I or P frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing any sort of biprediction &quot;averaging&quot; in these two cases would only make things worse.&lt;/p&gt;&#xA;" OwnerUserId="484" LastActivityDate="2012-06-07T21:44:52.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2598" PostTypeId="1" AcceptedAnswerId="2601" CreationDate="2012-06-08T19:14:09.337" Score="3" ViewCount="1910" Body="&lt;p&gt;I'm preparing for my exams I stumbled across this exercise. Now I can't seem to figure it out. Anybody can help me ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The exercise:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the 8bit data word: &lt;strong&gt;00111001&lt;/strong&gt; the check bits are: &lt;strong&gt;0111&lt;/strong&gt;. Now if the word is read from the memory and the check bits are 1101, what is the dataword?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The text is translated from another language to English. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I started by doing a check :&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entire word is the dataword (8 bits) combined with the check (4 bits). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case: 0 0 1 1 &lt;strong&gt;0&lt;/strong&gt; 1 0 0 &lt;strong&gt;1&lt;/strong&gt; 1 &lt;strong&gt;1&lt;/strong&gt;  &lt;strong&gt;1&lt;/strong&gt; (the check bits on position &lt;strong&gt;1, 2, 4&lt;/strong&gt; and &lt;strong&gt;8&lt;/strong&gt;, with the right bit being the least significant bit)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the check itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The check consists of searching for all the bit that have the value one from the dataword in the combined word. It can be seen that position &lt;strong&gt;3 7 9&lt;/strong&gt; and &lt;strong&gt;10&lt;/strong&gt; have the value one and didn't come from the check. These 4 values are written binary and added up. When this is done. the check is found again. (To confirm that this method works)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;3:  0 0 1 1&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;7:  0 1 1 1&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;9:  1 0 0 1&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;10: 1 0 1 0&lt;/p&gt;&#xA;  &#xA;  &lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 1 1 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So this is correct (Just to see if this method is correct)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I have another check (1101), but how can I find the data word ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thx in advance&lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="569" LastEditDate="2012-06-09T08:47:56.627" LastActivityDate="2012-07-09T11:42:07.903" Title="Hamming code exercise" Tags="|channelcoding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2601" PostTypeId="2" ParentId="2598" CreationDate="2012-06-09T11:18:22.373" Score="1" Body="&lt;p&gt;How I did it was: Use the original data word and fill in the new check bits. : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;001111001101&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then again get the positions where the 1s are and convert that number to binary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 : 0 0 0 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 : 0 0 1 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 : 0 1 0 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;7 : 0 1 1 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;8 : 1 0 0 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;9 : 1 0 0 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;10: 1 0 1 0&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 0 1 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this means that the 10th bit is wrong&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I don't have the actual  solution, i do not know if this is correct, bit it fits the way I learned how to do this.&lt;/p&gt;&#xA;" OwnerUserId="569" LastActivityDate="2012-06-09T11:18:22.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2602" PostTypeId="2" ParentId="1883" CreationDate="2012-06-09T21:10:50.160" Score="2" Body="&lt;p&gt;You can locate the local maxima for a given radius. For example, you scan the Hough image taking peaks as maxima only when they are maximal in a $3\times 3$ window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second step could be refining the peak position to sub-pixel accuracy. This can be done by parabola fitting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose the value in Hough image is $f(x)$ where $x$ is the 2D position. Now you would like to find a correcting vector $p$ that maximizes $f(x + p)$. This can be written using Taylor expansion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x+p)\approx f(x)+p^{\mathbb{T}}f'(x)+\frac{1}{2}p^{\mathbb{T}}f''(x)+p$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correcting vector is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p=-f''(x)^{-1}f'(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The derivatives can be computed from the Hough image by &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_difference&quot; rel=&quot;nofollow&quot;&gt;finite differencing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $f''(x)$ is a $2\times2$ Hessian matrix and $f'(x)$ is a 2-vector (horizontal and vertical gradient), hence the $p$ is also a 2-vector specifying a sub-pixel shift to get accurate position of the local maximizer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above equation may occasionally yield shifts of more than 1 pixel. In such case, the maximizer neighborhood does not have a parabolic shape and you may not want to do the correction or should even drop the candidate maximizer.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-06-09T21:10:50.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2603" PostTypeId="1" AcceptedAnswerId="2609" CreationDate="2012-06-10T12:42:02.010" Score="11" ViewCount="791" Body="&lt;p&gt;I have microphones measuring sound over time at many different positions in space. &#xA;The sounds being recorded all originate from the same position in space but due to the different paths from the source point to each microphone; the signal will be (time) shifted&#xA;and distorted. A priori knowledge has been used to compensate for the time shifts as good as possible but still some time shift exist in the data.&#xA;The closer the measurement positions are the more similar the signals are. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in automatically classifying the peaks. By this I mean that I am seeking an algorithm that &quot;looks&quot; at the two microphone signals in the plot below and &quot;recognize&quot; from position and waveform that there are two main sounds and report their time positions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sound 1: sample 17 upper plot, sample 19 lower plot,&#xA;sound 2: sample 40 upper plot, sample 38 lower plot&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to do this I was planning to do a Chebyshev expansion around each peak and use the vector of Chebyshev coefficients as input to a cluster algorithm (k-means?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example here are parts of the time signals measured at two nearby positions (blue) approximated by 5 term Chebyshev series over 9 samples (red) around two peaks (blue circles): &#xA;&lt;img src=&quot;https://i.stack.imgur.com/rQb5K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approximations are quite good :-).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However; the Chebyshev coefficients for the upper plot are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Clu = -1.1834   85.4318  -39.1155  -33.6420   31.0028&#xA;Cru =-43.0547  -22.7024 -143.3113   11.1709    0.5416&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the Chebyshev coefficients for the lower plot are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Cll = 13.0926   16.6208  -75.6980  -28.9003    0.0337&#xA;Crl =-12.7664   59.0644  -73.2201  -50.2910   11.6775&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to have seen Clu ~= Cll and Cru ~= Crl,&#xA;but this does not seem to be the case :-(.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe there is another orthogonal basis that is more suited in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice on how to proceede (I am using Matlab) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank in advance for any answers!&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-06-10T16:55:27.810" LastActivityDate="2012-06-11T16:16:27.827" Title="How can I automatically classify peaks of signals measured at different positions?" Tags="|matlab|discrete-signals|interpolation|classification|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2604" PostTypeId="1" CreationDate="2012-06-10T18:39:39.270" Score="5" ViewCount="1157" Body="&lt;p&gt;I'm developing correlation filters based image recognition.&lt;br/&gt;&#xA;I implemented MACE correlation filter in matlab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;training code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D = diag(mean(abs(X),2));&#xA;% inv(A) * B = A \ B&#xA;XDX = ctranspose(X) * (D \ X);&#xA;h = (D \ X) * (XDX \ u);&#xA;H = reshape(h, size(I));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where X is the d.^2xN matrix of vectorized FFT2 transformed training images (images FFT2 transform spectra are vectorized by concatenating columns), u is the vector of image membership (1 for images to recognize and 0 for the rest of the samples), I is the dxd sample training image to reshape correlation filter h to H matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;testing code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R = ifftshift(ifft2(I.*conj(H)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where I is the dxd test image zero mean and unit variance normalized and H is the trained correlation filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I trained one correlation filter on 61 training images from which there is just 1 image to recognize with 1 in vector u and remaining images with 0's in vector u.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However despite reported results in the papers on correlation filters where correlation plane output is in range 0 ... 1 my results are up to 10e-4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pK0GA.png&quot; alt=&quot;correlation plane surfaces for recognized and unrecognized images&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any normalization typically applied to scale correlation plane output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides I found that without &lt;code&gt;conj(H)&lt;/code&gt; in the testing code there is no correlation peak for images to be recognized. I was unable to find in the papers that missing operator in the formula which I found at &lt;a href=&quot;http://www.mathworks.it/matlabcentral/newsreader/view_thread/171224&quot; rel=&quot;nofollow noreferrer&quot;&gt;mathworks forum&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="390" LastActivityDate="2012-10-24T13:15:58.370" Title="Correlation filter output range normalization" Tags="|fourier-transform|filter-design|correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2605" PostTypeId="1" CreationDate="2012-06-11T06:37:07.630" Score="9" ViewCount="15006" Body="&lt;p&gt;I'm a chemical engineer, not an EE, so this is a bit difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to figure out how to take amplitude vs time data and transform it into frequency vs time.  My first instinct is to slice my data into chunks, perform the FFT on each chunk, and then plot that.  Unfortunately, as the time duration of each slice approaches zero, there is no longer enough information to get accurate frequency information (low frequencies require more than a very small time slice).  So... how do I do this?  I'm sure this is some sort of famous problem that someone's already solved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the kind of transform I'm looking for, illustrated with a sound wave (piano note G).  As you can see, this graph as three axes, with the third one being represented by color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yE5se.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1495" LastActivityDate="2012-06-21T05:45:26.457" Title="How do I create a frequency vs time plot?" Tags="|fourier-transform|frequency|transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2606" PostTypeId="2" ParentId="2605" CreationDate="2012-06-11T07:51:45.977" Score="5" Body="&lt;p&gt;The time vs frequency resolution is a well-known problem, and there are indeed approaches to overcome it. For audio signals, some of the commonly used techniques include: parametric methods ; adaptive resolution (analyze with various time/frequency configurations and patch the results together - Wen X. and M. Sandler, &quot;Composite spectrogram using multiple fourier transforms&quot;) ; wavelets/decompositions on overcomplete bases ; and use of phase information to extract the precise location of frequency peaks (IFgram).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it appears that the graph you have shown does not use some of these techniques ; so I suspect this is not what you might be looking for. There appears to be some &quot;smearing&quot; on the horizontal axis (for example at t=1.2s) and this is a sure sign that the analysis has been done with a high overlap between chunks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the chunk duration and the number of analysis frames per second do not have to be linked to each other if you allow frames to overlap. So if you want to use 40ms long analysis frame, your grid does not have to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;frame 1: t=0..t=40ms ; frame 2: t=40ms..t=80ms&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It could very well be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;frame 1: t=0..t=40ms ; frame 2: t=10ms..t=50ms&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This overlapping can give the illusion of a higher temporal resolution without reducing too much the FFT window size. Note that this can only help in accurately locating an event on the time axis - it will not help resolving two events close in time... Just like increasing the FFT size might help with identifying the location of a frequency peak, but not with the resolution of two adjacent frequency peaks.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-06-11T07:51:45.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2607" PostTypeId="1" CreationDate="2012-06-11T14:42:59.347" Score="10" ViewCount="422" Body="&lt;p&gt;Consider the 4 following waveform signals:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal1 = [4.1880   11.5270   55.8612  110.6730  146.2967  145.4113  104.1815   60.1679   14.3949  -53.7558  -72.6384  -88.0250  -98.4607]&#xA;&#xA;signal2 = [ -39.6966   44.8127   95.0896  145.4097  144.5878   95.5007   61.0545   47.2886   28.1277  -40.9720  -53.6246  -63.4821  -72.3029  -74.8313  -77.8124]&#xA;&#xA;signal3 = [-225.5691 -192.8458 -145.6628  151.0867  172.0412  172.5784  164.2109  160.3817  164.5383  171.8134  178.3905  180.8994  172.1375  149.2719  -51.9629 -148.1348 -150.4799 -149.6639]&#xA;&#xA;signal4 = [ -218.5187 -211.5729 -181.9739 -144.8084  127.3846  162.9755  162.6934  150.8078  145.8774  156.9846  175.2362  188.0448  189.4951  175.9540  147.4631  -89.9513 -154.1579 -151.0851]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DmEzC.png&quot; alt=&quot;Signals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We notice that signal 1 and 2 look similar and that signal 3 and 4 look similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for an algorithm that take as input n signals and divide them into m groups, where the signals within each group are similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First step in such an algorithm would usually be to calculate a &lt;em&gt;feature vector&lt;/em&gt; for each signal: $ \mathbf{F}_i $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example we might define the feature vector to be: [width, max, max-min].&#xA;In which case we would get the following feature vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \mathbf{F}_1 = [13,146,245] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \mathbf{F}_2 = [15,145,223] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \mathbf{F}_3 = [18,181,406] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \mathbf{F}_4 = [18,189,408] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important thing when deciding on a feature vector is that similar signals get feature vectors that are close to each other and dissimilar signals gets feature vectors that are far apart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example above we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$| \mathbf{F}_2 - \mathbf{F}_1 | = 22.1, |\mathbf{F}_3 - \mathbf{F}_1 | = 164.8 $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could therefore conclude that signal 2 is much more similar to signal 1 than signal 3 is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As feature vector I might also use the terms from the discrete cosine transform of the signal. The figure below shows the signals along with approximation of the signals by the first 5 terms from the discrete cosine transform:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/x9sMN.png&quot; alt=&quot;Cosine transforms&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete cosine coefficients in this case are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F1 = [94.2496  192.7706 -211.4520  -82.8782   11.2105]&#xA;&#xA;F2 = [61.7481  230.3206 -114.1549 -129.2138  -65.9035]&#xA;&#xA;F3 = [182.2051   18.6785 -595.3893  -46.9929 -236.3459]&#xA;&#xA;F4 = [148.6924 -171.0035 -593.7428   16.8965 -223.8754]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$| \mathbf{F}_2 - \mathbf{F}_1 | = 141.5, |\mathbf{F}_3 - \mathbf{F}_1 | = 498.0 $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ratio is not quite as large as for the simpler feature vector above.&#xA;Does this mean that the simpler feature vector is better? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have only shown 2 waveforms. The plot below show some other waveforms that would be the input to such an algorithm. One signal would be extracted from each peak in this plot, starting at the nearest min to the left of the peak and stopping at the nearest min to the right of the peak:&lt;img src=&quot;https://i.stack.imgur.com/AMVCT.png&quot; alt=&quot;Trace&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance signal3 was extracted from this plot between sample 217 and 234. Signal4 was extracted from another plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you are curious; each such plot corresponds to sound measurements by microphones at different positions in space. Each microphone receive the same signals but the signals are slightly shifted in time and distorted from microphone to microphone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The feature vectors could be sent to a clustering algorithm such as k-means that would group together the signals with feature vectors close to each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do any of you have any experience/advice on designing a feature vector that would be good at discriminating waveform signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also which clustering algorithm would you use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank in advance for any answers!&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-06-11T18:43:05.170" LastActivityDate="2012-12-11T21:59:10.950" Title="Designing a feature vector for discriminating between different sonic waveforms" Tags="|computer-vision|frequency-spectrum|autocorrelation|speech-recognition|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="2608" PostTypeId="1" AcceptedAnswerId="28781" CreationDate="2012-06-11T14:45:52.697" Score="16" ViewCount="3147" Body="&lt;p&gt;So if you generate a square wave by just switching a signal between two values, at sample boundaries, it produces an infinite series of harmonics, which alias and produce tones below your fundamental, which is very audible.  The solution is &lt;a href=&quot;http://www.slack.net/~ant/bl-synth/&quot; rel=&quot;noreferrer&quot;&gt;Band-Limited Synthesis&lt;/a&gt;, either using additive synthesis or band-limited steps to produce waveforms that are the same as if you had band-limited the ideal mathematical square wave before sampling it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://flic.kr/p/83JMjT&quot; rel=&quot;noreferrer&quot;&gt;http://flic.kr/p/83JMjT&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OmHrZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I just realized that if you apply large amplification to a digital sine wave and then clip it digitally, it will produce the same square wave shape, without the Gibbs phenomenon ripples.  So it's then also producing aliased distortion products, right?  So &lt;em&gt;any&lt;/em&gt; non-linear distortion in the digital domain that produces harmonics outside of the Nyquist limits will produce aliased distortion products?  (Edit: I've done some tests and confirmed that this part is true.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there such a thing as band-limited distortion, to simulate (in the digital domain) the effects of distorting (in the analog domain) &lt;em&gt;before&lt;/em&gt; band-limiting and sampling?  If so, how do you do it?  If I search for &quot;bandlimited distortion&quot; I find some references to Chebyshev polynomials, but I don't know how to use them or if they only work for sine waves or what:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This instrument does not attempt to generate band-limited distortion. Those interested in band-limited distortion should investigate the use of Chebyshev polynomials to generate the effect. &lt;a href=&quot;http://www.csounds.com/ezine/winter1999/processing/&quot; rel=&quot;noreferrer&quot;&gt;Hyperbolic Tangent Distortion&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Chebyshev polynomial&quot; -- shaping functions with the important property that they are intrinsically band-limited i.e. they do not introduce spurious spectral harmonics due to overlapping etc. &lt;a href=&quot;http://www.soundslogical.com/support/wavewarp/documentation/english/documentparts/Wave_Shaper.html&quot; rel=&quot;noreferrer&quot;&gt;Wave Shaper&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-06-12T21:31:28.887" LastActivityDate="2016-02-10T13:13:38.817" Title="Is there such a thing as band-limited non-linear distortion?" Tags="|sampling|aliasing|nyquist|distortion|" AnswerCount="4" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2609" PostTypeId="2" ParentId="2603" CreationDate="2012-06-11T16:16:27.827" Score="2" Body="&lt;p&gt;It looks like you have a single source, x[n], and multiple microphone signals $y_{i}[n]$. Assuming that your propagation path from the source to the microphones is reasonably linear and time invariant, you and simply model the path as a transfer function. So basically you have &#xA;$$ y_{i}[n] = h_{i}[n]\ast x[n] $$&#xA;where $h_{i}[n]$ is the impulse response of the transfer function from the source to microphone &quot;i&quot;. These transfer functions have different amplitude and phase responses. If they are different enough, the individual microphone signals will be quite different as well and there is no reason to believe that the peaks will actually show up at the same spot. In most acoustic environments, they will be &quot;different&quot; if the microphones are more than a quarter wavelength apart for the frequencies of interest (or where there is non-trivial energy in the spectrum).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can measure the transfer functions, you can filter each mic signal with the inverse of that transfer function. This should make the mic signals much more similar and reduce the effect of the filtering. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative would be to combine all mic signals into a beamformer that optimizes pickup from the source but rejects everything else. This should also provide a fairly &quot;clean&quot; version of the source signal.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-06-11T16:16:27.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2610" PostTypeId="1" CreationDate="2012-06-12T07:40:53.863" Score="17" ViewCount="17598" Body="&lt;p&gt;I am looking for good tools for Audio signal processing. e.g Speech &amp;amp; music analysis, automatic language identification, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the Scipy library provide functions for audio processing? Does it have a good tool for Audio Signal processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please suggest a tool for this?&lt;/p&gt;&#xA;" OwnerUserId="1092" LastEditorUserId="13320" LastEditDate="2018-06-10T10:51:12.387" LastActivityDate="2018-06-10T10:51:12.387" Title="Scipy - Audio Processing" Tags="|audio|python|signal-detection|" AnswerCount="4" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2611" PostTypeId="2" ParentId="2608" CreationDate="2012-06-12T16:22:58.910" Score="9" Body="&lt;p&gt;Applying a non-linear function will always introduce harmonics, and mixing non-linear functions with sampled versions of continuous signals does add the wrinkle you note above (where high-frequency harmonics are aliased to low frequencies.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of a few ways to proceed:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You can use an oversampling factor high enough to capture the extra harmonics (up to some arbitrary precision, e.g. your noise floor),&lt;/li&gt;&#xA;&lt;li&gt;You can use a &quot;softer&quot; clipping function (see, for example, &lt;a href=&quot;https://ccrma.stanford.edu/~jos/NonlinearElements/NonlinearElements_4up.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;) that has harmonics that die out sooner than the hard clipper. This is easier to model, but introduces its own distortion at low frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Building on the approach you suggested above, interpolate your sampled signal (e.g. using a Lagrange or Chebyshev interpolator) to construct a continuous-time model. Then, apply the hard clipper and low-pass in a simulated continuous-time domain. Sample the result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can combine (1) and (2). The third approach is complex, but gives you the best control over how much distortion to admit, and will probably scale better to very high fidelity requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For non-linear functions that admit a series expansion (e.g. Taylor/Maclaurin), you can get a decent intuition for how fast the harmonics decay. The Maclaurin expansion of a function $f(x)$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x)=\sum_{n=0}^\infty \left[ \frac{f^{(n)}(0)}{n!} x^n\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, $f(x)$ is the clipping function. (You can't do this with a hard clipper, at least not naively!) If you consider the substitution $x=g(t)$, where $g(t)$ is your input signal, the $x^n$ becomes $g(t)^n$, which you can consider to be the convolution of your input signal with itself $n$ times. Thus, for low-pass signals, the $n$th term of the infinite summation has a bandwidth $n$ times that of your signal. To complete the picture, you need to figure out the amplitude associated with each term and decide how many terms in the summation are relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(With a little thought, you might also be able to use this form directly to approximate the filtered non-linearity. That would require a good series representation for the clipper.)&lt;/p&gt;&#xA;" OwnerUserId="1499" LastActivityDate="2012-06-12T16:22:58.910" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2612" PostTypeId="1" CreationDate="2012-06-12T16:36:58.537" Score="7" ViewCount="2828" Body="&lt;p&gt;I use a &lt;a href=&quot;http://gnuradio.org/doc/doxygen/classgr__quadrature__demod__cf.html&quot; rel=&quot;noreferrer&quot;&gt;Quadrature Demodulator&lt;/a&gt; in my SDR application, which is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\angle (S_n, S_{n+1})=arctan(S_{n+1}*\overline{S_{n}})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So practically its amplitude is the angle between two Samples $S_n$ and $S_{n+1}$ where $n$ refers to a position in a sequence of complex values of I and Q. $\overline{S}$ be the complex conjugate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that for Quadrature based modulation the phase-changes contain the information. But why can I demodulate frequency-modulated Signals with a Quadrature Demodulator. This modulator is often referred to as FM Demod. Can somebody explain me why that is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best,&#xA;Marius&lt;/p&gt;&#xA;" OwnerUserId="1500" LastActivityDate="2012-06-12T20:15:33.243" Title="Why can Quadrature Demodulation demod a Frequency Modulated Signal?" Tags="|frequency|software-implementation|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2613" PostTypeId="2" ParentId="2612" CreationDate="2012-06-12T18:49:28.233" Score="6" Body="&lt;p&gt;I don't think your formula is quite right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two complex samples are the locations (at two successive sampling instants)&#xA;of the tip of the rotating phasor that represents the analog signal.  The information that you need is the &lt;em&gt;angle&lt;/em&gt; between phasor positions at these&#xA;two successive time instants.  If $S_{n+1} = r_{n+1}e^{j\theta_{n+1}}$ and&#xA;$S_n = r_ne^{j\theta_n}$, then you want the value of $\theta_{n+1}-\theta_n$.&#xA;Now, $S_{n+1}S_n^* = r_{n+1}r_ne^{j(\theta_{n+1}-\theta_n)}$ and if you&#xA;express these complex numbers in rectangular coordinates, then you can&#xA;get the desired angle as&#xA;$$\theta_{n+1}-\theta_n &#xA;= \arctan\left(\frac{\text{Im}(S_{n+1}S_n^*)}{\text{Re}(S_{n+1}S_n^*)}\right)&#xA;= \arctan\left(\frac{\text{Re}(S_{n})\text{Im}(S_{n+1})&#xA;- \text{Im}(S_n)\text{Re}(S_{n+1})}{\text{Re}(S_{n})\text{Re}(S_{n+1})&#xA;+ \text{Im}(S_{n})\text{Im}(S_{n+1})}\right)$$&#xA;though usually the four-quadrant arctangent function &lt;code&gt;atan2(y,x)&lt;/code&gt; is used&#xA;instead of &lt;code&gt;atan&lt;/code&gt; which returns an answer between $-\pi/2$ and $\pi/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In digital communications applications such as DQPSK demodulation,&#xA;the real interest is not in the actual value of the angle, but in which&#xA;of the four intervals $(-\pi/4,\pi/4)$, $(\pi/4, 3\pi/4)$, $(3\pi/4, 5\pi/4)$,&#xA;and $(5\pi/4, 7\pi/4)$ the angle belongs -- in other words,&#xA;did the phase not change at all, or change by $\pi/2$, or by $\pi$, or&#xA;by $3\pi/2$ -- and this can be readily determined&#xA;by &lt;em&gt;comparing&lt;/em&gt; the values of the numerator and denominator in&#xA;the argument of the arctangent above, thus saving computational&#xA;effort and speeding up the demodulation process. But the&#xA;more general formula gives the actual angle, and thus can be&#xA;used to demodulate a general FM signal as well.  The output&#xA;will be a sequence of samples of the original continuous-time&#xA;signal that modulated the carrier and thus formed the signal&#xA;that was transmitted.  D/A conversion will give the reconstructed&#xA;signal.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-06-12T20:15:33.243" LastActivityDate="2012-06-12T20:15:33.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2615" PostTypeId="1" CreationDate="2012-06-13T08:24:33.863" Score="4" ViewCount="933" Body="&lt;p&gt;I am developping a program, that extracts very expressive frames from a video (meaning: frames, which could summarize a video) for a university seminar. One of my ideas was, to analyze the audio data (e.g.: if it's very loud, there must be sth. happening and so on). I'm using Praat for this analysis. Now, I stumbled upon the pitch, which is supposed to be the fundamental frequency (formant f0). Can anyone tell me what usually happens to the pitch, when somebody talks or when you can hear only music? And do you have any other ideas what the audio data of a film might be able to tell me?&lt;/p&gt;&#xA;" OwnerUserId="1505" LastActivityDate="2012-06-27T13:32:59.550" Title="differences in fundamental frequency/pitch between music and speech" Tags="|audio|frequency|pitch|video-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2616" PostTypeId="2" ParentId="2615" CreationDate="2012-06-13T09:01:18.057" Score="7" Body="&lt;p&gt;I don't think pitch information is relevant for what you want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variation of pitch during speech is known as intonation, and can convey emotions, indicate if a sentence is a question etc. However, there is no universal rule as to how pitch variation patterns are mapped to meaning - this is quite language dependent ; and some languages sound &quot;flatter&quot; in terms of pitch contour than others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While there are some exceptions (say a solo flute performance), music is polyphonic in that several instruments are playing at the same time - and to make things worse some of those instruments might be playing several notes at the same time. As a result, at a given point in time, music is unlikely to contain just a single fundamental frequency ; and when applied to music, Praat's f0 estimator is very likely to yield a noisy and unreliable pitch contour, sometimes jumping from one instrument to the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding automatically annotating movies from the audio, here are a few ideas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Looking for sharp increases in loudness to detect important events as you suggested.&lt;/li&gt;&#xA;&lt;li&gt;Use speech/music discrimination to help detect scene boundaries.&lt;/li&gt;&#xA;&lt;li&gt;Train classifiers for common sound effects (explosions, gunshots, punches), and use this to detect action/violence scenes.&lt;/li&gt;&#xA;&lt;li&gt;Use speaker diarization techniques (along with some face recognition) to detect all lines spoken by a particular actor.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-06-13T09:01:18.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2618" PostTypeId="2" ParentId="2564" CreationDate="2012-06-13T11:46:51.197" Score="6" Body="&lt;p&gt;To fix the connectivity issue, you can try a close operation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::Mat structuringElement = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(40, 40));&#xA;cv::morphologyEx( inputImage, outputImage, cv::MORPH_CLOSE, structuringElement );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I doubt that this will produce the results that you want, but you can give it a try.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2012-06-13T11:46:51.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2619" PostTypeId="1" CreationDate="2012-06-14T10:05:10.697" Score="0" ViewCount="362" Body="&lt;p&gt;I have to do an exercise. Given this signal: $H(f)=\frac{\frac{T}{2}}{1+(\pi f\frac{T}{2})^2}$  calculate the frequency at $-6 db$. How can I resolve this exercise? I tried this: $\frac{\frac{T}{2}}{1+(\pi f\frac{T}{2})^2}=10^{-0.6}$ but I don't know if it is correct&lt;/p&gt;&#xA;" OwnerUserId="1141" LastActivityDate="2012-06-14T10:05:10.697" Title="calculate frequency at -6 db" Tags="|homework|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2620" PostTypeId="1" CreationDate="2012-06-15T01:20:10.203" Score="3" ViewCount="821" Body="&lt;p&gt;I have hue, saturation and value of a color (HSV color-space). The color has to be set on a device that displays them incorrectly. If I specify white it displays light magenta. However, if you specify some green it displays the best white it can (let's say: gray). How do I remove this color cast? Actually: How do I create a color cast in the HSV numbers to compensate for the wrong display?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach was the following. But it lead to a skip of some magenta colors, when I ran through the whole rainbow with a saturation of, say, 0.8 (interval 0 to 1):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Shift magenta to the beginning of the hue scale (60 degrees forward) and thus the hue of the current color&lt;/li&gt;&#xA;&lt;li&gt;Calculate the distance to move in the direction of green. With a saturation of 1 that means to move completely to green (180 degrees).&lt;/li&gt;&#xA;&lt;li&gt;This is the formula: distance = (180 / 360 - shifted_hue) * (1 - saturation)&lt;/li&gt;&#xA;&lt;li&gt;Then add the distance to the shifted hue (possibly resulting in a subtraction).&lt;/li&gt;&#xA;&lt;li&gt;Shift the hue scale back by 60 degrees.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As said, this is leading to an ugly skip of some magenta colors, because the lower the saturation the bigger the gap at magenta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know of a better algorithm?&lt;/p&gt;&#xA;" OwnerUserId="1510" LastEditorUserId="1510" LastEditDate="2012-06-15T01:32:18.270" LastActivityDate="2012-06-15T11:54:02.743" Title="How to remove color cast from HSV information" Tags="|filters|algorithms|filter-design|python|soft-question|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2621" PostTypeId="1" AcceptedAnswerId="2622" CreationDate="2012-06-15T02:41:33.717" Score="9" ViewCount="819" Body="&lt;p&gt;I didn't take any class on image processing but I studied the subject based on lecture notes and important books for last three months. So at this point, I would like to sharp my image processing skills. Of course, I am practicing a lot of image processing work but the work seems to be very similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a programmer, I learned a lot from top coder or similar where you can compete each other for better programming. Is there any web site I can compete for difficult image processing problems?&lt;/p&gt;&#xA;" OwnerUserId="1011" LastEditorUserId="1273" LastEditDate="2012-07-02T15:15:18.940" LastActivityDate="2012-07-02T17:18:01.750" Title="How to expand on and deepen a basic skill set for image/video processing?" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2622" PostTypeId="2" ParentId="2621" CreationDate="2012-06-15T10:09:23.153" Score="14" Body="&lt;p&gt;I hope you realize (from the form of your question, I think you do) that three months of &lt;em&gt;reading up about it&lt;/em&gt; doesn't really make you an image processing expert.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am familiar with &lt;em&gt;topcoder&lt;/em&gt;, but while the difficulty of the problems and approaches that you needed to use there might be similar to those of image processing problems, to design a usable image processing application: do problem specific research, implement your findings and new ideas, test it to get reliable results, you need much more than a couple of hours (or even a week as for the topcoder marathon match).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to just learn more about the basic image processing tools I suggest you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;take all your literature, random-open a page and study and implement the concept explained there&lt;/li&gt;&#xA;&lt;li&gt;take a computer vision library such as &lt;em&gt;OpenCV&lt;/em&gt;, or work in &lt;em&gt;matlab&lt;/em&gt;, take some images, and try using and displaying various image processing methods on them (from simple morphology to more complicated things like Hough line detection). Try and predict results, graphically display them, and understand what you get.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you are interested in specific problem in image processing (e.g. I am doing &lt;em&gt;Content based image retrieval - CBIR&lt;/em&gt; right now -- and by that I mean, almost for the last 5 months), and want to get better in this specific topic, then my advice would be something like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;search google scholar, Mendeley article database, IEEEXplore for relevant works on the subject&lt;/li&gt;&#xA;&lt;li&gt;download way too many papers, maybe 3-5 as many as you are prepared to read. Skim &lt;em&gt;abstract&lt;/em&gt;, &lt;em&gt;intruduction&lt;/em&gt; and &lt;em&gt;conclusion&lt;/em&gt; sections and filter out the articles that sound relevant and interesting. Give priority to current (recent) articles, as well as articles with current references.&lt;/li&gt;&#xA;&lt;li&gt;read all of that. Read the most important ones more than once. The one that will be the basis of your work is expected to have margins filled with your scribblings and to look at least a little bit scrappy by the time you finish your 5th read-through.&lt;/li&gt;&#xA;&lt;li&gt;implement that. Go from simple, straightforward implementation to the optimized implementation.&lt;/li&gt;&#xA;&lt;li&gt;before you start doing this, ensure that you have a dataset for testing. Testing is not relevant if it is not done on a large enough dataset. Some works mention the datasets they are using, or their datasets can be found on affiliated university websites.&lt;/li&gt;&#xA;&lt;li&gt;there are public datasets (e.g. this one for &lt;a href=&quot;http://pascallin.ecs.soton.ac.uk/challenges/VOC/&quot; rel=&quot;noreferrer&quot;&gt;object classification&lt;/a&gt;) that also &lt;strong&gt;organize annual challenges&lt;/strong&gt; where you can test your new ideas against many peoples new ideas (but that's way bigger than topcoder :D)&lt;/li&gt;&#xA;&lt;li&gt;if you get decent results, that's good. If you get better results than state-of-the art using some of your new ideas, double check them. Then triple check them. And then publish a fancy article ;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm sure you can find a middle between just learning something about image processing just for fun and doing real time-consuming research from what I wrote... Actually, here's an idea: &lt;em&gt;hang around here and try to understand and help to solve other people's problems!&lt;/em&gt; All of them need research-think-apply steps, they just vary with the depth of the steps they require ;) In any case, I hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="1297" LastEditDate="2012-07-02T17:18:01.750" LastActivityDate="2012-07-02T17:18:01.750" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2623" PostTypeId="2" ParentId="2620" CreationDate="2012-06-15T11:54:02.743" Score="3" Body="&lt;p&gt;It is not necessary that your device's color mismatch can be corrected with a simple shifting of the Hue component (except of course if you are absolutely sure that this is the case with your equipment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, to correct the response of the device you somehow need to &lt;a href=&quot;http://en.wikipedia.org/wiki/ICC_profile&quot; rel=&quot;nofollow&quot;&gt;recover the mapping&lt;/a&gt; that it already performs between reference and observed colors and then see how &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_calibration&quot; rel=&quot;nofollow&quot;&gt;it can be corrected&lt;/a&gt; by some curve (monotonic or not). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this purpose you will need &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_chart&quot; rel=&quot;nofollow&quot;&gt;a colour chart&lt;/a&gt; (and ideally, an instrument &lt;a href=&quot;http://spyder.datacolor.com/portfolio-view/spyder4elite/&quot; rel=&quot;nofollow&quot;&gt;such as this one&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please note that it is best that this correction is applied at the system level, i.e. your application will still be sending some &quot;color demand&quot; normally, without correcting it but that demand would undergo some correction prior to display automatically by the system.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the very basic level, you can send a simple reference image to your display and then try to adjust its R,G,B settings (if there are any) so that the colours seem to display properly (according to your eyes that is)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a system that is not capable of applying such profiles but you still must apply some color-correction you could try matching the relative distances of the colours with a known target (or image in your case) and then (if required) try to correct towards absolute colours by shifting (with trial and error). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take an evenly lit image of the colour chart with a good digital camera, color correct it (to reduce any effects of the lighting or sensor used to acquire your &quot;reference&quot; image) and feed it to your display. Take an image of the display (ideally in the same lighting conditions), apply the same color correction with the profile from the first step (and for the same reasons) and then examine the relative color correspondence between any two colors from the color chart image and two colors from the color chart display image to recover the mapping. (A piece of software that might be of help in this process is &lt;a href=&quot;http://lprof.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;LPROF&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2012-06-15T11:54:02.743" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2624" PostTypeId="1" CreationDate="2012-06-12T07:03:49.897" Score="3" ViewCount="1964" Body="&lt;p&gt;I am trying to understand the bode plot result I have obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KX0KP.png&quot; alt=&quot;bode&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blue, green, and red plots are $a$, $ b$, and $a+b$ respectively.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm having a hard time understanding is how a+b is formed.  Looking at the magnitude of $a$, it is in the range of $500 dB$ or $$10^{25}$$.  Whereas, looking at $b$, it is a negative dB gain, so a number of small magnitude.  Although I do expect to see the gain of $a+b$ to be lower than that of $a$, I can't explain why the drop is so significant.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something fundamentally important here? or is this fishy to anyone else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it makes any difference, I directly got this plots in matlab using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bode(a,b,a+b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;TIA&lt;/p&gt;&#xA;" OwnerDisplayName="suzu" LastEditorUserId="1473" LastEditDate="2012-06-29T11:03:54.230" LastActivityDate="2020-05-03T08:40:26.493" Title="adding bode plots together?" Tags="|matlab|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="2625" PostTypeId="1" AcceptedAnswerId="2626" CreationDate="2012-06-15T16:04:07.813" Score="22" ViewCount="12930" Body="&lt;p&gt;This question is on dsp.SE as I'm mostly interested in the signal processing part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an Indian movie &lt;a href=&quot;http://en.wikipedia.org/wiki/Mughal-e-Azam&quot; rel=&quot;noreferrer&quot;&gt;Mughal-e-Azam&lt;/a&gt; which was released in 1960 in black &amp;amp; white which has been reproduced in color in 2004.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How did they color each pixel perfectly?&lt;/li&gt;&#xA;&lt;li&gt;What technique have they&#xA;used to identify the color placement on each pixel?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Look at one of the screenshots from the movie:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BiVxp.jpg&quot; alt=&quot;Movie Screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got an Einstein black-and-white photo which I want to colorize. How is it possible to do so  without knowing what he was wearing back then and what was the actual color of his clothes, background etc.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="235" LastEditDate="2012-06-18T13:20:50.770" LastActivityDate="2013-12-09T21:00:14.073" Title="How did they color old black and white movies?" Tags="|matlab|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2626" PostTypeId="2" ParentId="2625" CreationDate="2012-06-15T18:12:33.637" Score="26" Body="&lt;p&gt;There is no way of recovering the original color information from a black and white photo, so whether Einstein (resp. Waheeda Rehman) was wearing a pink or green sweater (resp. Dupatta) is up to your imagination.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Historically, &lt;a href=&quot;http://en.wikipedia.org/wiki/Film_colorization&quot;&gt;this has been done by hand&lt;/a&gt;, by painting over the film. The first digital techniques to automate the process consisted in &quot;painting&quot; a few dots of color on each frame, at the center of each uniformly colored region, and using something like a voronoi partition + some blurring to get a color map for each frame (see for example US patent 4606625).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today, this can be done relatively easily (though manually) with video editing software, by using vector masks to indicate regions of uniform color on a few keyframes, and interpolating between them. Then a color transform is applied to each mask. See it in action &lt;a href=&quot;http://www.youtube.com/watch?v=btxd7oqI5No&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard image segmentation and region tracking techniques can be used to automate the task of segmentation and the marking of regions on each keyframe - for example by &lt;a href=&quot;http://www.cs.huji.ac.il/~yweiss/Colorization/&quot;&gt;propagating manual annotations to similar/adjacent pixels in space/time&lt;/a&gt;, or by &lt;a href=&quot;http://www.mva-org.jp/Proceedings/2011CD/papers/06-03.pdf&quot;&gt;detecting uniformly textured regions&lt;/a&gt;. Texture and gray level similarity can be used to &lt;a href=&quot;http://www-sop.inria.fr/members/Guillaume.Charpiat/colorisation.pdf&quot;&gt;propagate color cues from a color image to a greyscale image depicting a similar subject&lt;/a&gt; - in this case the manual process only consists in finding a template color image - this later task can be itself automated using &lt;a href=&quot;http://laplace.dcc.ufmg.br/npdi/uploads/c8962ba1-9193-7f2f.pdf&quot;&gt;content-based image retrieval techniques&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-06-15T18:12:33.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2627" PostTypeId="2" ParentId="2605" CreationDate="2012-06-15T18:37:22.063" Score="5" Body="&lt;p&gt;Yes, many people have worked on time-frequency analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach of &quot;slice my data into chunks, perform the FFT on each chunk&quot; is a good idea.&#xA;Applying a &quot;window function&quot; on each chunk, just before performing the FFT,&#xA;helps avoid many artifacts.&#xA;Allowing chunks to overlap also helps.&#xA;After those tweaks, you end up with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gabor_transform&quot; rel=&quot;noreferrer&quot;&gt;Gabor transform&lt;/a&gt;, which seems to be the most popular short-time Fourier transform (STFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you've already pointed out, and as the Wikipedia article points out, all &lt;a href=&quot;http://en.wikipedia.org/wiki/short-time_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;short-time Fourier transform&lt;/a&gt; techniques have a tradeoff:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;when you cut the time-series into very short pieces, you get highly precise time information as to exactly &lt;em&gt;when&lt;/em&gt; a tone starts and stops, but the frequency information is very blurry.&lt;/li&gt;&#xA;&lt;li&gt;When you cut the time-series into very long pieces, you get highly precise frequency information as to the exact frequency of a tone, but the exact time it starts and stops is blurry.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is a famous problem, but alas, not only has it not been solved, it's been proven that the uncertainty between the two is inevitable -- the Gabor limit, the Heisenberg–Gabor limit, the &lt;a href=&quot;http://en.wikipedia.org/wiki/uncertainty_principle&quot; rel=&quot;noreferrer&quot;&gt;uncertainty principle&lt;/a&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were you, I would start with one of the many off-the-shelf libraries to calculate the Gabor transform,&#xA;and experiment with cutting the time series into various lengths.&#xA;There's a pretty good chance you'll be lucky and you will end up with&#xA;some length that gives &lt;em&gt;adequate&lt;/em&gt; time localization and &lt;em&gt;adequate&lt;/em&gt; frequency discrimination.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work for this application, then I would move on to other approaches to &lt;a href=&quot;http://en.wikipedia.org/wiki/time-frequency_representation&quot; rel=&quot;noreferrer&quot;&gt;time–frequency representation&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/time-frequency_analysis&quot; rel=&quot;noreferrer&quot;&gt;time-frequency analysis&lt;/a&gt; --&#xA;wavelet transforms, &lt;a href=&quot;http://en.wikipedia.org/wiki/chirplet_transform&quot; rel=&quot;noreferrer&quot;&gt;chirplet transforms&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/fractional_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;fractional Fourier transform&lt;/a&gt; (FRFT), etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Some source code to generate &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;noreferrer&quot;&gt;spectrograms&lt;/a&gt; / &lt;a href=&quot;http://en.wikipedia.org/wiki/Waterfall_plot&quot; rel=&quot;noreferrer&quot;&gt;waterfall plots&lt;/a&gt; from audio data:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://sox.sourceforge.net/&quot; rel=&quot;noreferrer&quot;&gt;SoX - Sound eXchange&lt;/a&gt; includes &lt;a href=&quot;http://sox.git.sourceforge.net/git/gitweb.cgi?p=sox/sox;a=blob;f=src/spectrogram.c;h=962199a7007dc42ecd8d2d4f6d60741d96687a53;hb=HEAD&quot; rel=&quot;noreferrer&quot;&gt;spectrogram source code&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://audacity.sourceforge.net/&quot; rel=&quot;noreferrer&quot;&gt;Audacity&lt;/a&gt; includes &lt;a href=&quot;https://code.google.com/p/audacity/source/browse/audacity-src/trunk/src/Spectrum.cpp&quot; rel=&quot;noreferrer&quot;&gt;spectrogram source code&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.qsl.net/in3otd/glfer.html&quot; rel=&quot;noreferrer&quot;&gt;glfer&lt;/a&gt; includes waterfall spectrum display spectrum source code&lt;/li&gt;&#xA;&lt;li&gt;source code that uses fftw to compute the &lt;a href=&quot;http://ofdsp.blogspot.com/2011/08/short-time-fourier-transform-with-fftw3.html&quot; rel=&quot;noreferrer&quot;&gt;spectrogram&lt;/a&gt; of an audio stream&lt;/li&gt;&#xA;&lt;li&gt;more source code that uses OpenAL and fftw to compute the &lt;a href=&quot;http://home.engineering.iastate.edu/~alexs/classes/2010_Spring_575/HW/HW5/OpenAL/alsgram.c&quot; rel=&quot;noreferrer&quot;&gt;spectrogram&lt;/a&gt; for an audio stream&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/22951/Sound-Activated-Recorder-with-Spectrogram-in-C&quot; rel=&quot;noreferrer&quot;&gt;&quot;Sound Activated Recorder with Spectrogram in C#&quot;&lt;/a&gt; by Jeff Morton&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://topographica.org/&quot; rel=&quot;noreferrer&quot;&gt;Topographica&lt;/a&gt; seems to include &lt;a href=&quot;http://topographica.org/Reference_Manual/topo.pattern.basic.Spectrogram-class.html&quot; rel=&quot;noreferrer&quot;&gt;spectrogram source code&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.dr-lex.be/software/spectrograph.html&quot; rel=&quot;noreferrer&quot;&gt;SpectroGraph for iTunes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://devrand.org/view/imageSpectrogram&quot; rel=&quot;noreferrer&quot;&gt;Image to Spectrogram&lt;/a&gt; goes in the reverse direction from the above utilities.&lt;/p&gt;&#xA;" OwnerUserId="484" LastEditorUserId="484" LastEditDate="2012-06-21T05:45:26.457" LastActivityDate="2012-06-21T05:45:26.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2628" PostTypeId="1" AcceptedAnswerId="2629" CreationDate="2012-06-16T02:31:52.640" Score="12" ViewCount="1490" Body="&lt;p&gt;While looking for an answer to this problem, I found this board so decided to cross post &lt;a href=&quot;https://stackoverflow.com/questions/11059701&quot;&gt;this question of mine&lt;/a&gt; from Stack Overflow.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am searching for a method of determining the similarity between an audio segment and a human voice, which is expressed numerically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've searched quite a bit, but what I've found so far (detailed below) doesn't really fit what I need:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;One method is to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Speech_recognition&quot; rel=&quot;nofollow noreferrer&quot;&gt;speech recognition&lt;/a&gt; software to obtain words from an audio segment. However, this method is unable to come up with how &quot;similar&quot; audio is to human speech; it can often tell whether or not there are words in the audio, but if there are no definite words, it can't tell close the audio is to having such words.&lt;br /&gt;&lt;em&gt;Examples: &lt;a href=&quot;http://cmusphinx.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CMU Sphinx&lt;/a&gt;, &lt;a href=&quot;https://code.google.com/p/dragonfly/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dragonfly&lt;/a&gt;, &lt;a href=&quot;http://shout-toolkit.sourceforge.net/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;SHoUT&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The more promising method is referred to as &lt;a href=&quot;http://en.wikipedia.org/wiki/Voice_activity_detection&quot; rel=&quot;nofollow noreferrer&quot;&gt;Voice Activity Detection&lt;/a&gt; (VAD). However, this tends to have the same problems: the algorithms / programs using VAD tend to just return whether or not the activity threshold has been reached, and no &quot;similarity&quot; value before or after such threshold. Alternatively, many just look for volume, not similarity to human speech.&lt;br /&gt;&lt;em&gt;Examples: &lt;a href=&quot;http://www.speex.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Speex&lt;/a&gt;, &lt;a href=&quot;http://shriphani.com/blog/listener/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Listener&lt;/a&gt;, &lt;a href=&quot;http://wiki.freeswitch.org/wiki/VAD_and_CNG&quot; rel=&quot;nofollow noreferrer&quot;&gt;FreeSWITCH&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="1515" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-06-16T14:22:25.940" Title="Determining how similar audio is to human speech" Tags="|audio|algorithms|speech-recognition|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2629" PostTypeId="2" ParentId="2628" CreationDate="2012-06-16T14:22:25.940" Score="6" Body="&lt;p&gt;This kind of problem is usually solved using machine learning techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Break down the signal into a sequence of 20ms or 50ms frames. Extract features on each frame. MFCC are generally good for this kind of application, though there are feature more specific to voice detection (4 Hz modulation energy - which is roughly the rate at which people speak ; zero-crossing rate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, using a training set of audio you have manually labelled as being speech / not speech, train a classifier (Gaussian mixture models, SVM...) on the frames features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will allow you to classify unlabelled frames into speech/non-speech classes. The last step consists in smoothing the decisions (a frame classified as non-speech surrounded by hundreds of speech frame is likely to be classification error), for example using HMMs, or just a median filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few references:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://jlrouas.free.fr/Articles/Pinquier_ICSLP2002.pdf&quot;&gt;Robust speech / music classification in audio documents (Pinquier &amp;amp; al)&lt;/a&gt;&#xA;&lt;a href=&quot;http://teacher.buet.ac.bd/shihab/CSE474/Papers/10.1.1.93.3453.pdf&quot;&gt;Speech / music discrimination for multimedia applications (El-Maleh &amp;amp; al)&lt;/a&gt;&#xA;&lt;a href=&quot;http://sipi.usc.edu/~ortega/WaveletPapers/speech_music1.pdf&quot;&gt;A comparison of features for speech / music discrimination (Carey &amp;amp; al)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the features and classification techniques they describe are also relevant for the 1-class problem of detecting speech (instead of discriminating speech vs something else). In this case, you can use 1-class modeling techniques such as 1-class SVM, or just take the likelihood score out of a GMM trained on a speech data as a &quot;speechiness&quot; measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, on the other hand, your problem is really discriminating speech vs something else (say music), you could also very well use &lt;a href=&quot;http://www.mathieuramona.com/uploads/Main/bibA01.pdf&quot;&gt;unsupervised approaches&lt;/a&gt; which are focused on detecting the boundaries between similar audio content - rather than identifying this content itself.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-06-16T14:22:25.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2630" PostTypeId="2" ParentId="2625" CreationDate="2012-06-16T20:26:22.457" Score="6" Body="&lt;p&gt;I've only read about this, and it's been at least 15 years since I saw anything in print, but I understand there are a number of algorithms used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, as stated, some films have been colorized by painstakingly tinting each frame by hand.  (The first few minutes of &lt;em&gt;Gone with the Wind&lt;/em&gt; were done this way, after the decision was made to film the rest in color.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, several techniques are used, all based on computer image processing.  The simplest approach is to break the film into individual scenes, each where the camera doesn't change, and then have a computer algorithm recognize regions of differing intensity.  Someone on a computer monitor looks at the first few frames of the scene and sets the color of each region, then the computer carries that coloring through the rest of the scene, assuming that the identified regions will not morph so rapidly that the connection with their assigned colors will be lost.  This technique is usually limited to colorizing the main actors and the basic background, since scenes change so rapidly in most movies,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More sophisticated techniques use image recognition algorithms to recognize (eg) a person, separate the background from the foreground, etc.  Then colors can be assigned on a more global basis and some degree of shading can be accomplished as actors move from shadow to light, etc.  And, since this scheme can work beyond a single scene, more effort can be put into having a human initially set the colors, so a more varied and vivid palette can be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would guess (though I've never read) that technique resembling computer animation can now be used, based on techniques used for animating action movies.  A sort of motion capture could be used on the original film, and then a computer animation of the action would be produced.  With some careful &quot;blending&quot; the original film's detail could be retained while using the colors generated by the animation.&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-06-16T20:26:22.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2632" PostTypeId="1" AcceptedAnswerId="2635" CreationDate="2012-06-17T17:20:41.460" Score="7" ViewCount="1398" Body="&lt;p&gt;I have the task related to Radon transform which contains a subtask which uses resampling by means of DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider the non-periodical discretized signal (Fig.1) (for example the string of pixels) having 515 pixels length. In my implementation for resampling contains following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Cyclic left shift (Fig.2).&lt;/li&gt;&#xA;&lt;li&gt;Add zeros to the center in order to the length of signal became 2^n (in our case 1024-515 = 509 zeros we must have add) (Fig. 3).&lt;/li&gt;&#xA;&lt;li&gt;Get DFT from this signal (Fig. 4).&lt;/li&gt;&#xA;&lt;li&gt;Cyclic right shift. (for shifting low frequencies to the center) (Fig.5)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Fig.1&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hEZY9.png&quot; alt=&quot;Original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fig.2&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DsUKh.png&quot; alt=&quot;Cyclic left shift&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fig.3&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Ojt40.png&quot; alt=&quot;Zeropadded&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fig.4&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2CpTK.png&quot; alt=&quot;DFT Spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fig.5&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xeqMY.png&quot; alt=&quot;DFT back shifted&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The main question:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Why we must perform cyclic shift of the signal and add zeros exactly in the center? (I assumed what this made the signal periodic)&#xA;Zeropadding makes interpolation DFT spectrum, is it correct? (I asked and someone says what it is not quite so)&#xA;Maybe someone can explain in simple way what happens with signal after zeropadding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have made some experiments in a Matlab and found out that any other sequence of actions can not give required result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's consider two cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) (THIS CORRECT VARIANT) We has the non-periodical discretized signal (for example the string of pixels) which will be cyclic shifted to left and filled zeros in the center after that will be obtained DFT from this and to shift it back.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GbwHO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) We has the non-periodical discretized signal (for example the set strings of pixels) which will be filled zeros from left and right  after that will be obtained DFT from this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PUCAs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the difference these DFT spectrums?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read some books but not found the answer of this zeropadding's case. It seems this can be found only by own experience.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Answer in book:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;A. C. Kak and Malcolm Slaney, Principles of Computerized Tomographic Imaging, Society of Industrial and Applied Mathematics, 2001 on page 25&lt;/p&gt;&#xA;" OwnerUserId="1519" LastEditorUserId="1519" LastEditDate="2013-04-12T09:08:38.750" LastActivityDate="2020-01-22T08:13:13.560" Title="Sense of zeropadding in a time domain" Tags="|fft|fourier-transform|frequency-spectrum|interpolation|zero-padding|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2634" PostTypeId="2" ParentId="2632" CreationDate="2012-06-17T20:22:55.667" Score="1" Body="&lt;p&gt;@Roman: from my experience whether we do in time domain or frequency domain, interpolation (let us say by factor 2) results in higher sampling frequency (upsampled signal,(2*Fs)).&#xA;For time domain interpolation we insert zeros in alternate samples, in the same way we insert zeros because we are converting the signal to higher sampling frequency by leaving the signal bandwidth untouched. The exact reason for &quot;center filling&quot; is to do with FFT index vs. base band (BB) index. e.g., signal BW fm and sampling frequency Fs, in the frequency domain we have the signal fm centered at +NFs and -NFs where N is integer (0,1,2...). The signal around DC (base band signal) occupies from -fm/2 to fm/2 and signal at Fs occupies from Fs-fm/2 to Fs+fm/2 and so on, all these replicas carry same information. Instead of considering -fm/2 to DC, we are considering Fs-fm/2 (both are same) only difference is positive or negative side. Finally the signal we consider is {[DC to fm/2] [Fs-fm/2 to Fs]} for this reason we fill extra zeros (depends on upsampling factor) between [fm/2 to Fs-fm/2] by keeping the original signal fm intact.&lt;/p&gt;&#xA;" OwnerUserId="1520" LastActivityDate="2012-06-17T20:22:55.667" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2635" PostTypeId="2" ParentId="2632" CreationDate="2012-06-17T21:21:23.487" Score="3" Body="&lt;p&gt;Shifting the data points (fftshift) and zero-padding the exact center of the FFT aperture has the property that all the even (symmetric) components with reference to the center of the original data set end up in the real part of the complex FFT result, and all the odd components end up in the imaginary part. e.g. the evenness to oddness ratio is preserved, which allows phase (with reference to the center of the window) to be easily interpolated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being able to interpolate phase is important in the case of a zero-padded FFT because the zero-padding interpolates the spectral magnitude as well.  Since zero-padding results in an interpolated FFT result, that means that any original non-interpolated FFT result points will need to be interpolated from the zero-padded result.  Without an FFT shift of both the non-padded and zero-padded data, these interpolated results will be different from the non-interpolated FFT results (in phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This technique is a simple (homework or quiz level) result of the FT property that a shift in one domain is a complex frequency modulation in the other domain.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-06-18T13:54:42.633" LastActivityDate="2012-06-18T13:54:42.633" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2636" PostTypeId="1" AcceptedAnswerId="2647" CreationDate="2012-06-18T06:08:24.620" Score="28" ViewCount="20193" Body="&lt;p&gt;What differences or other criteria can be used to help decide between using overlap-add and overlap-save for filtering?  Both overlap-add and overlap-save are described as algorithms for doing FFT based fast convolution of data streams with FIR filter kernels.  What are the latency, computational efficiency or caching locality (etc.) differences, if any?  Or are they the same?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="4346" LastEditDate="2017-01-05T03:54:13.077" LastActivityDate="2020-09-11T13:55:27.893" Title="Overlap-Add versus Overlap-Save" Tags="|fft|filters|convolution|fast-convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2637" PostTypeId="1" CreationDate="2012-06-18T06:28:11.507" Score="9" ViewCount="336" Body="&lt;p&gt;Assume some unknown but small and finite number of poles and zeros in the complex Z plane, all with complex conjugates, producing some response.  Strictly from the absolute value of a set of equally spaced points around the unit circle, say greater than 2X the number of poles and zeros, of that response, is it possible to estimate or compute the number of poles and zeros which produced that sampled magnitude response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added:  Are more than 2X sample points required to determine the number of poles and zeros? (when given that the total is less than X).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added:  If there is more than one solution, can a minimum solution (as in the minimum number of total poles and zeros) be found or estimated?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-06-19T22:01:20.023" LastActivityDate="2012-06-23T12:30:08.540" Title="Filter order estimation" Tags="|filters|estimation|z-transform|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2638" PostTypeId="1" CreationDate="2012-05-09T09:26:27.713" Score="10" ViewCount="1954" Body="&lt;p&gt;I am currently working with and comparing the performance of several feature detectors provided by OpenCV as basis for visual feature matching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;em&gt;SIFT&lt;/em&gt; descriptors. I have accomplished satisfactory matching (after rejecting bad matches) when detecting &lt;em&gt;MSER&lt;/em&gt; and &lt;em&gt;DoG (SIFT)&lt;/em&gt; features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I am testing my code with &lt;em&gt;GFTT (Good Features to Track - Harris corners)&lt;/em&gt; to get a comparison, and also because in the final aplication, a set of GFTT features will be available from visual feature tracking process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;a href=&quot;http://opencv.willowgarage.com/documentation/cpp/features2d_common_interfaces_of_feature_detectors.html#cv-featuredetector-detect&quot;&gt;&lt;code&gt;cv::FeatureDetector::detect(...)&lt;/code&gt;&lt;/a&gt; which provides me with a &lt;code&gt;std::vector&amp;lt;cv::KeyPoint&amp;gt;&lt;/code&gt; filled with &lt;em&gt;detected features / keypoints / regions of interest&lt;/em&gt;. The structure &lt;code&gt;cv::KeyPoint&lt;/code&gt; contains basic information about feature's location, as well as information about &lt;code&gt;size&lt;/code&gt; and &lt;code&gt;octave&lt;/code&gt; in which the keypoint has been detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first results with &lt;em&gt;GFTT&lt;/em&gt; were terrible until I compared the typical &lt;code&gt;size&lt;/code&gt; and &lt;code&gt;octave&lt;/code&gt; parameters in different types of features:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;MSER&lt;/em&gt; sets the &lt;em&gt;size&lt;/em&gt; (between 10 and 40px) and leaves the &lt;em&gt;octave&lt;/em&gt; to 0&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;DoG (SIFT)&lt;/em&gt; sets both the &lt;em&gt;size&lt;/em&gt; and the &lt;em&gt;octave&lt;/em&gt; (&lt;em&gt;size/octave&lt;/em&gt; ratio between 20 and 40)&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;GFTT&lt;/em&gt; the parameters are &lt;em&gt;always&lt;/em&gt;: &lt;em&gt;size = 3&lt;/em&gt;, &lt;em&gt;octave = 0&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I presume that is because the primary purpose of &lt;em&gt;GFTT&lt;/em&gt; features was not to be used in matching but only in tracking. This explains the low quality of matching results, since the &lt;em&gt;descriptors extracted from such tiny features stop being discriminatory and invariant to many things&lt;/em&gt;, including small, 1-pixel shifts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I manually set the &lt;code&gt;size&lt;/code&gt; of &lt;em&gt;GFTT&lt;/em&gt; to &lt;em&gt;10 - 12&lt;/em&gt;, I get good results, very similar to when using &lt;em&gt;MSER&lt;/em&gt; or &lt;em&gt;DoG (SIFT)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; is there a better way to determine how much to increase the &lt;code&gt;size&lt;/code&gt; (and/or &lt;code&gt;octave&lt;/code&gt;) than &lt;em&gt;just-go-with-10-see-if-it-works&lt;/em&gt;? I want to avoid hardcoding the &lt;code&gt;size&lt;/code&gt; increase if possible and determine it programmatically, but &lt;em&gt;hardcoding is okay&lt;/em&gt; as long as I have some solid arguments backing up my choices of the new &lt;em&gt;&lt;code&gt;size&lt;/code&gt;&lt;/em&gt; / &lt;em&gt;&lt;code&gt;size&lt;/code&gt; increase&lt;/em&gt; / &lt;em&gt;&lt;code&gt;size&lt;/code&gt; estimation algorithm&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1273" OwnerDisplayName="penelope" LastActivityDate="2012-06-18T17:07:44.180" Title="How to estimate octave and size for visual features positioned at Harris corners" Tags="|image-processing|opencv|computer-vision|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2639" PostTypeId="2" ParentId="2638" CreationDate="2012-05-09T09:36:40.407" Score="4" Body="&lt;p&gt;I'm not sure there is actually a good response to your precise question : the scale-space thing of SIFT and SURF was actually developed to automatically estimate the &quot;good&quot; relevant neighborhood size around a corner-like keypoint (which is what good features to track are).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, more positive answers would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;build a database of keypoints and good matches (e.g. using square calibration patterns) and create an automated performance assessment on this database to find the correct size. This task can actually really be automated (see the work by Mikolajczyk and Schmid about point matching evaluation)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;embed your good features in an image pyramid to also have some kind of scale associated with them. You can look for references on multi-scale FAST and Harris interest points, that do something very similar to this procedure.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To heuristically find the maximum block size, you can compute estimates of your images with a box blur (which is more or less what the blockSize operator does) and see when the corner disappears. Note however that more blur takes the corner away from its true location. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're really looking for some quick-and-dirty fix, try sizes between 5x5 and 11x11 (typical sizes used in stereo block matching). If you're looking for an intellectually satisfying criterion, then try to maximize the likelihood of good matching of two feature points under your noise level.&lt;/p&gt;&#xA;" OwnerUserId="1355" OwnerDisplayName="sansuiso" LastActivityDate="2012-05-09T10:18:02.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2640" PostTypeId="2" ParentId="2638" CreationDate="2012-06-13T19:45:00.930" Score="0" Body="&lt;p&gt;To help you determine the best parameters for the detectors, OpenCV has the &lt;a href=&quot;http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html#adjusteradapter&quot; rel=&quot;nofollow&quot;&gt;AjusterAdapter&lt;/a&gt; for that purpose. I never used it myself but it is probably the standard way to programatically determine the parameters.&#xA;Also be aware that although Keypoints have several properties, not all make sense to all algorithms. Because the Keypoint structure is used for diferent algorithms, it has all those fields but sometimes they are not used, that's why you get those octave = 0; IMO.&lt;/p&gt;&#xA;" OwnerUserId="1975" OwnerDisplayName="Rui Marques" LastActivityDate="2012-06-13T19:45:00.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2641" PostTypeId="1" CreationDate="2012-06-18T17:36:25.157" Score="10" ViewCount="441" Body="&lt;p&gt;I am just wondering how does camera auto focus work. What kind of processing does it do on images in order to adjust the focus? Is there freely available code that detects the focus level of an image or video?&lt;/p&gt;&#xA;" OwnerUserId="1522" LastActivityDate="2012-09-07T14:15:07.267" Title="How does auto focus in cameras work?" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2642" PostTypeId="2" ParentId="2529" CreationDate="2012-06-19T09:30:59.330" Score="12" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I understand that a Laplacian-of-Gaussian filter can be approximated by a Difference-of-Gaussians filter, and that the ratio of the two sigmas for the latter should be 1:1.6 for the best approximation&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In theory, the smaller the ratio between two sigmas, the better the approximation. In practice, you'll get numerical errors at some point, but as long as you're using floating point numbers, smaller values than 1.6 will give you a better approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate, I've plotted a cross-section of the LoG and DoG for a few values of k in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4Dw2T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, k=1.6 is not an ideal approximation. For example, k=1.1 would give a much closer approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you usually want to calculate LoG approximations for a range of sigmas. (Otherwise, why bother with the DoG approximation at all? Calculating a single LoG filtered image isn't more expensive than calculating a single DoG filtered image.) So the value of k is usually chosen so that you can calculate a series of gaussian filtered images with sigmas s, s&lt;em&gt;k, s&lt;/em&gt;k^2, s*k^3..., and then calculate the differences between adjacent gaussians. So if you choose a smaller k, you'd have to calculate more &quot;layers&quot; of gaussians for the same sigma-range. k=1.6 is a trade-off between wanting a close approximation and not wanting to calculate too many different gaussians.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, I'm not sure how the two sigmas in the Difference of Gaussians relates to the sigma for the Laplacian of Gaussian. Is the smaller sigma in the former equal to the sigma of the latter? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From the formulas on the wiki page @Libor linked to, you can see that $t=\sigma ^2$, so the approximate a LoG for some sigma, you need two gaussians with sigmas $\sqrt{\sigma ^2+\text{$\Delta $t}}$ and $\sqrt{\sigma ^2-\text{$\Delta $t}}$ (at least in the limit $\text{$\Delta $t}\to 0$). Or, in terms of k:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sigma _{\text{Laplace}}=\sigma \sqrt{\frac{1+k^2}{2}}$&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-06-19T09:30:59.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2643" PostTypeId="2" ParentId="2451" CreationDate="2012-06-19T11:17:45.823" Score="3" Body="&lt;p&gt;I've bought finally a copy of [Ripples in Mathematics&#xA;The Discrete Wavelet Transform][1], and I'm very pleased by this book. The authors explain the DWT with alternating point of views (lifting schemes, filter banks approach, multi-resolution analysis), where each of these viewpoints has its own advantages. Furthermore, the book is implementation oriented, with chapters about boundaries handling and matlab/C implementations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm still looking on a proper way to handle odd-sized signals, but Ripples gave me a good start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: &lt;a href=&quot;http://www.control.auc.dk/~alc/ripples.html&quot; rel=&quot;nofollow&quot;&gt;http://www.control.auc.dk/~alc/ripples.html&lt;/a&gt; &quot;Ripples in Mathematics The Discrete Wavelet Transform&quot;, by Arne Jensen and Anders la Cour-Harbo&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2012-06-19T11:17:45.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2644" PostTypeId="1" AcceptedAnswerId="2645" CreationDate="2012-06-18T02:01:05.170" Score="9" ViewCount="2467" Body="&lt;p&gt;I got a tracked robot toy and I'm controlling it with an iPhone. The robot outputs a live camera feed of a known frame size and I'm displaying it on UIImage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added a laser pointer to the robot and fixed it alongside the axis of the robot. I'm trying to detect the laser pointer dot on the image and thus try to calculate the proximity of the object. If the laser dot is far away from the center, I know that the robot is stuck against the wall and needs to back up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I go about detecting a dot of bright white-red pixels on a screen?&lt;/strong&gt; One solution would be to sample the color of pixels within a certain radius of the center and detect a blob bright color. Can anyone suggest an algorithm for this activity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to keep track of the average position of the dot over the last few frames, thus reducing the guesstimate radius. If there's no dot within a pre-defined region, the search region may be expanded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I want to be able to teach the robot to detect carpet around it. Carpet reflects a laser pointer in a certain way, and I want to understand how many frames around the robot have similar properties. If I know where the laser pointer is at a screen, I can clip a small rectangle from that image and compare them one to another. Is there an efficient way of comparing multiple small images to one another to understand if their silhouettes match? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed that the laser is reflected off glossy surfaces, and the direction of this reflection may tell me something about the orientation of the surface in space, in accordance with the laws of refraction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ds22L.png&quot; alt=&quot;Laser Pointer close&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lolOi.png&quot; alt=&quot;Laser pointer 1&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="480" OwnerDisplayName="Alex Stone" LastActivityDate="2018-11-13T10:38:02.203" Title="iPhone iOS UIImage how to detect a &quot;laser pointer&quot; dot on a camera feed?" Tags="|computer-vision|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2645" PostTypeId="2" ParentId="2644" CreationDate="2012-06-18T07:12:56.047" Score="10" Body="&lt;p&gt;&lt;a href=&quot;http://www.eosgarden.com/en/opensource/opencv-ios/overview/&quot;&gt;OpenCV&lt;/a&gt; is compilable for iOS. While it may not be the most efficient it gives you the option of porting the algorithm. I have done a similar marker tracking problem using the ConDensation algorithm. Look up marker tracking with OpenCV. It is a VERY large research area and the exact algorithm you want depends completely on your application. If I remember correctly there are around 3000 reported image processing techniques - to pick a good one is a real art!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One solution would be to sample the color of pixels within a certain&#xA;  radius of the center and detect a blob bright color. Can anyone&#xA;  suggest an algorithm for this activity?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;By the way, this is the basic idea behind what is called a particle filter (of which Condensation is one method). Well done you figured out the basic idea by your self!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Another approach would be to keep track of the average position of the&#xA;  dot over the last few frames, thus reducing the guesstimate radius. If&#xA;  there's no dot within a pre-defined region, the search region may be&#xA;  expanded.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is called state persistance and can be modelled in various ways. The condensation algorithm uses a stochastic approach not dissimilar to a plain old Kalman filter. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there an efficient way of comparing multiple small images to one&#xA;  another to understand if their silhouettes match?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This one is a little more difficult. You could try template matching but I don't know how well it will perform on iOS (very heavy calculation and iOS camera is not well suited to it).&lt;/p&gt;&#xA;" OwnerUserId="1548" OwnerDisplayName="Paul de Lange" LastActivityDate="2012-06-18T07:18:23.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2646" PostTypeId="1" AcceptedAnswerId="2653" CreationDate="2012-06-19T08:11:18.033" Score="4" ViewCount="301" Body="&lt;p&gt;I am attempting to implement a basic bandpass filter but the center frequency of my filter seems to be irrelevant as I can change it all I want but it has no effect on the filter.&#xA;where am I going wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have given my calculations here in the hope that someone will be able to point out where I'm making a mistake.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Filter specs:&#xA;supression of DC and Fs/2 (zeroes at +1 and -1)&#xA;center frequency at pi/4&#xA;bandwith of pi/16&#xA;&#xA;2(1-R)=pi/2&#xA;1-R=pi/32&#xA;R=(pi/32)-1&#xA;R=-0.9018252296&#xA;&#xA; K*(z-1)*(z+1)&#xA;---------------&#xA;z-R*cos(pi/4)+R&#xA;&#xA;     K*(z^2 -1)&#xA;-------------------&#xA;z^2-R^2*cos(pi/4)+R&#xA;&#xA;all leading to a difference equation of&#xA;&#xA;Y[n]=R^2*cos(pi/4)*Y[n-1]-R*Y[n-2]+K*(X[n]-X[n-2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1538" OwnerDisplayName="Gurba" LastEditorUserId="26573" LastEditDate="2018-09-24T22:46:06.127" LastActivityDate="2018-09-24T22:46:06.127" Title="basic bandpass filter" Tags="|filters|bandpass|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2647" PostTypeId="2" ParentId="2636" CreationDate="2012-06-19T13:05:28.667" Score="29" Body="&lt;p&gt;Essentially, OS is slightly more efficient since it does not require the addition of the overlapping transients.  However, you may want to use OA if you need to reuse the FFTs with zero-padding rather than repeated samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a quick overview from &lt;a href=&quot;https://www.iro.umontreal.ca/~mignotte/IFT3205/Documents/TipsAndTricks/MultibandFilterbank.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;an article&lt;/a&gt; I wrote a while ago&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fast convolution refers to the blockwise use of circular convolution&#xA;  to accomplish linear convolution. Fast convolution can be accomplished&#xA;  by OA or OS methods. OS is also known as “overlap- scrap” . In OA&#xA;  filtering, each signal data block contains only as many samples as&#xA;  allows circular convolution to be equivalent to linear convolution.&#xA;  The signal data block is zero-padded prior to the FFT to prevent the&#xA;  filter impulse response from “wrapping around” the end of the&#xA;  sequence. OA filtering adds the input-on transient from one block with&#xA;  the input-off transient from the previous block. In OS filtering,&#xA;  shown in Figure 1, no zero-padding is performed on the input data,&#xA;  thus the circular convolution is not equivalent to linear convolution.&#xA;  The portions that “wrap around” are useless and discarded. To&#xA;  compensate for this, the last part of the previous input block is used&#xA;  as the beginning of the next block. OS requires no addition of&#xA;  transients, making it faster than OA. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="25" LastEditorUserId="4298" LastEditDate="2020-01-27T12:54:42.393" LastActivityDate="2020-01-27T12:54:42.393" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2648" PostTypeId="1" AcceptedAnswerId="2649" CreationDate="2012-06-19T14:05:23.403" Score="4" ViewCount="1570" Body="&lt;p&gt;I am currently reading the paper &lt;a href=&quot;http://ismir2002.ismir.net/proceedings/02-fp04-2.pdf&quot; rel=&quot;nofollow&quot;&gt;A Highly Robust Audio Fingerprinting System&lt;/a&gt; and on page 4 one can read about the technical parameters they use: Sampling rate of 5000 Hz, frames of 2048 samples as input to the FFT and with these settings they analyse frequencies from 300 Hz to 2000 Hz. Here are the respective quotes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Since  the  algorithm  only  takes  into  account  frequencies &#xA;  below 2kHz the received audio is first down sampled to a mono &#xA;  audio stream with a sampling rate of 5kHz.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The most computationally demanding operation is &#xA;  the Fourier transform of every audio frame. In the down sampled &#xA;  audio signal a frame has a length of 2048 samples. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;These bands lie &#xA;  in  the  range  from  300Hz  to  2000Hz &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I don't understand: How can one analyse frequencies up to 2000 Hz using 2048 samples as input to the FFT?&lt;/strong&gt; As far as I know the FFT output is mirrored, therefore with 2048 samples as input I get an output vector of length 2048, however what I can effectively really use are the first 1024 values (2048/2 due to mirroring). So I would have only 1024 values for 2500 different frequencies? (sample rate is 5000 Hz and according to Nyquist maximum possible frequency therefore 2500 Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any hint!&lt;/p&gt;&#xA;" OwnerUserId="1525" LastActivityDate="2012-06-19T14:36:46.223" Title="Analysing 2500 frequencies using FFT with an input vector of 2048 samples?" Tags="|fft|fourier-transform|fingerprint-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2649" PostTypeId="2" ParentId="2648" CreationDate="2012-06-19T14:36:46.223" Score="11" Body="&lt;p&gt;The first 1024 output bins of the FFT represent frequencies from 0 Hz to Fs / 2 = 2.5 kHz. So each bin is 2500 / 1024 = 2.44 Hz wide. In other words you have a &lt;em&gt;resolution&lt;/em&gt; of 2.44 Hz in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2012-06-19T14:36:46.223" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2650" PostTypeId="1" CreationDate="2012-06-19T15:34:11.310" Score="5" ViewCount="380" Body="&lt;p&gt;I have fairly good understanding of DSP theory and algorithm design (and also MATLAB and C). What are the best books or what other advice could be given for learning how to actually implement DSP algorithms i.e. DSP programming (e.g. fixed-point/floating-point considerations etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also considered getting a DSP evaluation board for learning purposes but am lost as to which one to get, any advice?&lt;/p&gt;&#xA;" OwnerUserId="1526" LastEditorUserId="39" LastEditDate="2012-06-20T10:31:00.783" LastActivityDate="2012-06-20T15:51:40.910" Title="Jumping from DSP concepts to practice...recommend books?" Tags="|reference-request|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2651" PostTypeId="2" ParentId="2650" CreationDate="2012-06-19T16:58:18.600" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://www.ettus.com/product&quot; rel=&quot;nofollow&quot;&gt;USRP&lt;/a&gt; with &lt;a href=&quot;http://gnuradio.org/redmine/projects/gnuradio/wiki&quot; rel=&quot;nofollow&quot;&gt;Gnu Radio&lt;/a&gt; software is a good and relatively inexpensive (not that cheap, but much cheaper than almost anything else out there) DSP platform.  Gnu Radio is also open source, so if you develop something good you can submit it to the project.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-06-19T16:58:18.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2652" PostTypeId="2" ParentId="1958" CreationDate="2012-06-19T18:35:50.147" Score="1" Body="&lt;p&gt;The answer using the 3 loops is less then optimal and could be improved, here is more of an intuitive approach/point of view: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every pair of valid points sets a unique a &amp;amp; b of &lt;code&gt;y = ax + b&lt;/code&gt;. A line will have lots of pairs with the same a &amp;amp; b value, so a long line will have be present as a peak. This is also true for polar r &amp;amp; teta coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of treating each point separately, use pairs of dots. If you can store all (usually sparse) points in a separate list its better, but it is not a must.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take each pair &amp;amp; compute its a &amp;amp; b. (rounded to discrete values)&lt;/li&gt;&#xA;&lt;li&gt;Go to the specific place in the array and add 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Long line --&gt; lots of pairs with the same a,b.&lt;br&gt;&#xA;Sporadic points --&gt; small counting in specific cells --&gt; more like clutter.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another way to look at it is from a Radon/projective point of view.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A line will project strongly to a perpendicular &quot;collecting line&quot; so having high score. &lt;/li&gt;&#xA;&lt;li&gt;If the angle between the line and the &quot;collecting line&quot; is not 90 deg or the collecting line does not collect all the line points projected into this &quot;collecting line&quot;, there will be lower score.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1528" LastEditorUserId="590" LastEditDate="2012-06-20T14:10:50.970" LastActivityDate="2012-06-20T14:10:50.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2653" PostTypeId="2" ParentId="2646" CreationDate="2012-06-19T20:30:41.780" Score="3" Body="&lt;p&gt;Your denominator is wrong. It should be on this form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;(1-z_0z^{-1})(1-z_0^*z^{-1}) = 1-2R\cos(\phi)z^{-1}+R^2z^{-2}&#xA;$$&#xA;where $z_0 = Re^{j\phi}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your goal is to block DC and create an anti-aliasing filter in a simple way, I would recommend not to use complex poles. Instead use the procedure described in detail here: &lt;a href=&quot;http://www.dsprelated.com/showmessage/172787/1.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showmessage/172787/1.php&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It even provides a C implementation.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2012-06-19T20:30:41.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2654" PostTypeId="1" AcceptedAnswerId="2655" CreationDate="2012-06-19T21:07:32.373" Score="55" ViewCount="54168" Body="&lt;p&gt;I've found on multiple sites that convolution and cross-correlation are similar (including the tag wiki for convolution), but I didn't find anywhere how they differ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the difference between the two? Can you say that autocorrelation is also a kind of a convolution?&lt;/p&gt;&#xA;" OwnerUserId="1524" LastActivityDate="2023-02-21T20:27:14.320" Title="What is the difference between convolution and cross-correlation?" Tags="|convolution|autocorrelation|cross-correlation|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2655" PostTypeId="2" ParentId="2654" CreationDate="2012-06-19T21:37:49.323" Score="47" Body="&lt;p&gt;The only difference between cross-correlation and convolution is a time reversal on one of the inputs. Discrete convolution and cross-correlation are defined as follows (for real signals; I neglected the conjugates needed when the signals are complex):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] * h[n] = \sum_{k=0}^{\infty}h[k] x[n-k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;corr(x[n],h[n]) = \sum_{k=0}^{\infty}h[k] x[n+k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This implies that you can use fast convolution algorithms like &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap_save&quot;&gt;overlap-save&lt;/a&gt; to implement cross-correlation efficiently; just time reverse one of the input signals first. Autocorrelation is identical to the above, except $h[n] = x[n]$, so you can view it as related to convolution in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Since someone else just asked a duplicate question, I've been inspired to add one more piece of information: if you implement correlation in the frequency domain using a fast convolution algorithm like overlap-save, you can avoid the hassle of time-reversing one of the signals first by instead conjugating one of the signals in the frequency domain. It can be shown that conjugation in the frequency domain is equivalent to reversal in the time domain.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-12-14T15:52:43.177" LastActivityDate="2012-12-14T15:52:43.177" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2656" PostTypeId="1" CreationDate="2012-06-20T05:08:16.400" Score="4" ViewCount="1185" Body="&lt;p&gt;I have a continuous signal x(t) such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)=12cos(6\pi t)+6cos(24\pi t)+3cos(30 \pi t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and is asked to sketch a 1-sided Amplitude Spectrum of the signal x(t) if sampled above the minimum sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $w=2\pi$, i worked out that the three signals are 3Hz, 12Hz and 15 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just wondering, when I plot the Amplitude Spectrum should the Amplitude just be the corresponding coefficients? ie. 12 for 3Hz, 6 for 12Hz and 3 for 15Hz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Additionally, what's the difference between 1-sided Amplitude Spectrum and 2-sided Amplitude Spectrum? Does one offer any more benefit over the other?&lt;/p&gt;&#xA;" OwnerUserId="1535" LastEditorUserId="1535" LastEditDate="2012-06-20T05:57:25.420" LastActivityDate="2012-06-20T13:39:22.737" Title="What should the amplitude be when plotting 1-sided Amplitude Spectrum?" Tags="|fourier-transform|discrete-signals|frequency-spectrum|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2657" PostTypeId="2" ParentId="2656" CreationDate="2012-06-20T13:36:19.947" Score="1" Body="&lt;p&gt;For 2-sided spectrum, the amplitude will be halved since there is a negative and positive component for each frequency. Since the components are symmetrical about 0 Hz when sampled above Nyquist, sometimes the 1-sided spectrum is used (which is still half amplitude I think?). In this case there isn't really much benefit other than clarity of seeing the mirrored frequency deltas.&lt;/p&gt;&#xA;" OwnerUserId="1530" LastActivityDate="2012-06-20T13:36:19.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2658" PostTypeId="2" ParentId="2656" CreationDate="2012-06-20T13:39:22.737" Score="2" Body="&lt;p&gt;To complement @wrapperapps answer, you can express sinusoids as sum of exponentials: $\cos(2 \pi f_0 t) = (e^{j 2 \pi f_0 t} + e^{-j 2 \pi f_0 t})/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the fourier transform yields $\delta(f+f_0)/2 + \delta(f-f_0)/2$: each frequency delta has amplitude $1/2$.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-06-20T13:39:22.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2659" PostTypeId="1" CreationDate="2012-06-20T13:49:14.877" Score="2" ViewCount="568" Body="&lt;p&gt;I am doing a final year project which involves finding the position and orientation of a screw which has to be opened by a robot hand having a screw driver as an end effector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have developed a program in matlab that detects the screw and returns its centroid, I have also gone ahead to calibrate the camera and I have obtained both the intrinsic and the extrinsic parameters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I obtain the rotation and translation matrix to enable me extract the eulers angles of a screw?&lt;/p&gt;&#xA;" OwnerUserId="1537" LastEditorUserId="35" LastEditDate="2012-06-29T11:01:20.613" LastActivityDate="2012-06-29T11:01:20.613" Title="pose estimation" Tags="|computer-vision|camera-pose|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2661" PostTypeId="2" ParentId="2650" CreationDate="2012-06-20T15:51:40.910" Score="2" Body="&lt;p&gt;For implementing DSP algorithms in matlab I found this &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1402064098&quot; rel=&quot;nofollow&quot;&gt;book&lt;/a&gt; to be very useful. For practice you can start contributing to a Open Source project like &lt;a href=&quot;http://www.gnu.org/software/octave/&quot; rel=&quot;nofollow&quot;&gt;Octave&lt;/a&gt; by implementing dsp algorithms or optimizing existing ones.&lt;/p&gt;&#xA;" OwnerUserId="1488" LastActivityDate="2012-06-20T15:51:40.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2662" PostTypeId="2" ParentId="2659" CreationDate="2012-06-20T22:07:58.660" Score="5" Body="&lt;p&gt;I am trying to imagine how the detected screw is represented. Even if you have the centroid point and some representation of the shape, you need to estimate plane in which the screw lays. Such estimation would be very inaccurate given just the elliptic shape of the screw, which is usually small and its perspective and even affine deformation would be negligible in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, a small ambiguity came to my mind, see the picture (red dots are the centroids):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XxDxZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although both screws may be represented by the same ellipses (up to centroid position), their rotations about vertical axis are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you are aware of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information about detected screw representation and the scene would be helpful for a constructive answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think pose estimation problems are covered in Hartley &amp;amp; Zisserman: &quot;Multiple View Geometry&quot;. Of course it is much more accurate to estimate object pose when you have more views (e.g. stereo cameras).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-06-20T22:07:58.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2663" PostTypeId="1" AcceptedAnswerId="2670" CreationDate="2012-06-21T03:26:52.623" Score="3" ViewCount="671" Body="&lt;p&gt;I am trying to figure out if there is anything more to the phrase 'complex band shifting' than just, a simple band shift. Disclaimer, this is NOT a communications problem, and I only say this so that some answers do get carried away with bit rates, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, let us say that I am interested in a signal, that exists in the passband, from frequencies $f_1$ through $f_2$. Let us further assume that I band pass filter this signal with a brick wall BPF. Then, I multiply it with a sine wave of frequency $f_1$. This operation shifts my signal 'down to baseband', and at base band, it now has a (single-sided) bandwidth of $f_2$ - $f_1$, (as it did before). (I can now LPF to get rid of the double frequency component). That is, my signal now exists from $0$ to $f_2$-$f_1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me, this is all there is to band shifting. That is, the key component is a multiplication with a &lt;em&gt;real&lt;/em&gt; sinusoid. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why then, and what does, the phrase 'complex band shift' entail exactly? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that a multiplication with a complex sinusoid is done in comm systems because we then try to decipher phase from the I and Q, so I get that, but if I simply want to shift bands of a signal, (even to an arbitrary frequency), what is 'complex band shifting' and is that always necessary? Cant I just use a real sinusoid for general band shifting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-06-21T16:12:38.923" LastActivityDate="2012-06-21T16:12:38.923" Title="Terminology question on band-shifting" Tags="|filters|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2664" PostTypeId="1" CreationDate="2012-06-21T04:55:53.843" Score="5" ViewCount="652" Body="&lt;p&gt;This &lt;a href=&quot;http://wiki.hydrogenaudio.org/index.php?title=EAQUAL&quot;&gt;wiki post&lt;/a&gt; on wiki.hydrogenaudio.org says that it is very similar to PEAQ and also a part of ITU-R BS.1387 recommendation ? How reliable it is for determining audio quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other open implementations of PEAQ that are good.&lt;/p&gt;&#xA;" OwnerUserId="1488" LastActivityDate="2012-06-21T04:55:53.843" Title="What is EAQUAL ? How does it relate to PEAQ?" Tags="|audio|software-implementation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2665" PostTypeId="1" AcceptedAnswerId="2692" CreationDate="2012-06-21T10:27:47.580" Score="18" ViewCount="2884" Body="&lt;p&gt;I have been working in and learning about both Computer vision and Image processing for a few years now, and I believe that I am not a complete beginner any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, after all these years, it is hard for me to tell for any particular part of my work &lt;strong&gt;whether it is mostly Computer vision related, or if it is Image processing&lt;/strong&gt;. I just can't see the line -- when I work, study and research, I read reference materials with both keywords.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I am interested in &lt;strong&gt;the definition of the Computer vision and Image processing fields, with focus on the comparison (differences as well as overlaps) of the fields&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, I think it would be valuable to have an example of a (conceptual or existing) practical applications, projects and works dealing with/utilizing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;solely (or mostly) Computer vision tools and ideas&lt;/li&gt;&#xA;&lt;li&gt;solely (or mostly) Image processing tools and ideas&lt;/li&gt;&#xA;&lt;li&gt;a combination of tools and ideas from both fields&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;with special attention paid to what makes it &lt;em&gt;one and not the other&lt;/em&gt;, or what makes it &lt;em&gt;both&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that these fields are highly related and that the &quot;line&quot; might not be as clear as this question is asking for, but I hope you understand that the point of this question was not to design a simple decision rule for classifying (my) work, but rather a better understanding of the focus and goals of these fields. Also, any additional information that seems on-topic with my question tone is welcome, even if I did not specifically ask for it.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="128" LastEditDate="2018-07-12T14:08:46.100" LastActivityDate="2021-11-10T12:31:52.250" Title="A (Clear) Line Between Computer Vision and Image Processing" Tags="|image-processing|computer-vision|soft-question|theory|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2666" PostTypeId="1" CreationDate="2012-06-21T11:48:38.193" Score="8" ViewCount="2426" Body="&lt;p&gt;The values that one can find in a wave file, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    0.0036&#xA;    0.0026&#xA;    0.0174&#xA;    0.0050&#xA;    0.0026&#xA;    0.0108&#xA;    0.0154&#xA;   -0.0114&#xA;   -0.0006&#xA;    0.0115&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;are - as I assume - relative values between -1 and 1, the range you normally see when watching a waveform in some audio editing program. Now, how are these relative values mapped when you playback a file? E.g. if there is a value of 0.5, does it mean playback at half of the maximal possible loudness? Is there some kind of reference value stored in the WAVE file to which the relative values refer to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing: In the example above there are 7 positive values follow by 2 negative values. So the membran vibrating in a speaker to create the sound is pressed longer in one direction than in the other direction, or how does one has to interpret this? Positive values are one direction of the vibration and negative ones are vibrations into another direction or am I wrong about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much :-)&lt;/p&gt;&#xA;" OwnerUserId="1525" LastActivityDate="2012-06-23T06:20:53.447" Title="Understanding values saved in WAVE file" Tags="|audio|wave|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2667" PostTypeId="2" ParentId="2665" CreationDate="2012-06-21T12:22:38.947" Score="11" Body="&lt;p&gt;The way I understand it, the objective of image processing is to get a (somehow transformed) image. The objective of computer vision is to find out something about the things &lt;em&gt;in&lt;/em&gt; the image (like is the guy on the picture happy or sad, how many cars are there in the image and which way are they driving).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;solely (or mostly) Computer vision tools and ideas&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't think that's possible, not the way I understand the terms.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;solely (or mostly) Image processing tools and ideas&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Take for example, Adobe Photoshop: It can take an image and transform it into an image of a slimmer person with better skin. But it doesn't &quot;know&quot; anything about the objects depicted in the image. &lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-06-21T12:22:38.947" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2668" PostTypeId="1" CreationDate="2012-06-21T13:10:47.280" Score="4" ViewCount="240" Body="&lt;p&gt;I read in a paper &lt;a href=&quot;http://tcts.fpms.ac.be/publications/regpapers/2011/nrmmbgtd_icvs_LNCS.pdf&quot; rel=&quot;nofollow&quot;&gt;http://tcts.fpms.ac.be/publications/regpapers/2011/nrmmbgtd_icvs_LNCS.pdf&lt;/a&gt; about spatio-temporal filters, which is applied to frames of the videos. I could not understand these terms in the paper if anyone can help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3D Low Pass Filtering&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Temporal Neighborhood&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spatio Temporal Filters&lt;/p&gt;&#xA;" OwnerUserId="1289" LastActivityDate="2012-06-21T18:39:25.200" Title="What is temporal neighborhood?" Tags="|lowpass-filter|3d|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2669" PostTypeId="1" CreationDate="2012-06-20T19:05:29.253" Score="1" ViewCount="705" Body="&lt;p&gt;I'm a beginner in radio demodulation, and several days can't solve my problem. The problem is to get bit stream from known frequency.&#xA;I made I C# application that gets the data in real time from FunCube dongle and applies FFT. But what to do next - it is a puzzle for me. &#xA;The final goal is to detect narrow-band signal on a known frequency and get the bit stream from it.&#xA;I've already read different books on DSP but I'm at an impasse.&#xA;So, the question is what to read, where to go, maybe any algorithms.&lt;/p&gt;&#xA;" OwnerUserId="1541" OwnerDisplayName="Valeriy" LastActivityDate="2012-06-21T14:02:52.713" Title="Get bit stream from known radio frequency" Tags="|c#|fft|" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="2670" PostTypeId="2" ParentId="2663" CreationDate="2012-06-21T14:09:12.580" Score="3" Body="&lt;p&gt;Complex band shifting is a little more flexible than real band shifting and filtering, and may be a little more efficient too, though if you change the sample rates when moving a signal to baseband that may not be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are correct that you can move your signal to 0 to $f_2-f_1$ Hz in the method that you describe.  You could do the same thing in one step by multiplying the pass band signal by a complex sinusoid with a frequency of $-f_1 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, when you band shift with a real sinusoid you have to watch out for aliasing.  Band shifting with a complex sinusoid never causes aliasing (unless you reduce the sample rate at the same time, of course).&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-06-21T14:09:12.580" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2671" PostTypeId="2" ParentId="2668" CreationDate="2012-06-21T14:19:23.420" Score="3" Body="&lt;p&gt;&lt;strong&gt;The temporal neighborhood&lt;/strong&gt; refers to data nearby in time. That is; data located in the frames just before and just after the current frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The spatial neighborhood&lt;/strong&gt; on the other side refers to the data nearby in space. In this case this is the pixels nearby in the same frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Spatio-temporal filters (which is 3D filters)&lt;/strong&gt; takes both nearby pixels in the current frame and nearby pixels in nearby frames into account. In this way you can take advantage of information from more than one frame, which is often a good idea since most video sequences does not change much from frame to frame.&lt;/p&gt;&#xA;" OwnerUserId="1481" LastEditorUserId="1481" LastEditDate="2012-06-21T16:15:53.113" LastActivityDate="2012-06-21T16:15:53.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2672" PostTypeId="2" ParentId="2668" CreationDate="2012-06-21T14:22:02.903" Score="3" Body="&lt;p&gt;In the context of a video the terms mean the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3D Low Pass Filtering&lt;/strong&gt;:&#xA;The three dimensions (3D) are x (horizontal), y (vertical), and time.  Hopefully you know what a &lt;a href=&quot;http://en.wikipedia.org/wiki/Low-pass_filter&quot; rel=&quot;nofollow&quot;&gt;low pass filter&lt;/a&gt; is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Temporal Neighborhood&lt;/strong&gt;:&#xA;I did not find this term in the paper.  Given the context, though, I would guess that they mean for a video frame at time $t$, the temporal (time) neighborhood would be all data (i.e. frames) at nearby times.  Thus, if the length your spatio-temporal filter along the time dimension was $T$, then the time neighborhood would be all frames from time $t-T/2$ to $t+T/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Spatio-Temporal Filters&lt;/strong&gt;:&#xA;Filters that filter in both space and time.  In this case you have two dimensions of space- x and y.  Think of your data as being a three-dimensional matrix, where one dimension of the matrix is the x index, one dimension is the y index, and one dimension is the time index.  The time index would be the frame numbers.  The x and y indices would be the pixel positions.  The spatio-temporal filter would simply be a three-dimensional filter that would operate on your data.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-06-21T14:22:02.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2673" PostTypeId="2" ParentId="2666" CreationDate="2012-06-21T14:58:37.153" Score="8" Body="&lt;p&gt;What you see are time-domain samples that correspond to the displacement of a speaker from some rest position as a function of time. For example, the first sample corresponds to the membrane's position at $t=0$, the next represents its position at $t=T$, and so on, assuming that there are $T$ seconds between samples. Common sampling intervals for audio include $T = \frac{1}{8000}$ sec and $T = \frac{1}{44100}$ sec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to turn a stream of samples into real audio, a &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital-to-analog_converter&quot;&gt;digital-to-analog converter (DAC)&lt;/a&gt; is used first to generate a time-varying analog voltage that corresponds to the samples. This analog voltage would be applied to the input of a power amplifier that drives the speaker. The speaker is designed in such a way that the position of its membrane varies proportionally to the speaker's input voltage. At the end of this chain, then, you have a speaker membrane that moves in accordance with the original audio samples, producing the desired audio via its vibrations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, the sample values are normalized to a range of $\pm1$. The resulting loudness of the audio can be affected by many non-digital factors, such as the gain of the amplifier driving the speaker or the DAC's output voltage range. The peak sample values $\pm1$ just correspond to &quot;maximum membrane displacement that the hardware can generate.&quot; Therefore, there is no way to encode absolute loudness of the audio in such a stream of samples, hence the use of such a normalization scheme.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-06-21T14:58:37.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2674" PostTypeId="1" AcceptedAnswerId="2676" CreationDate="2012-06-21T15:53:06.067" Score="2" ViewCount="118" Body="&lt;p&gt;The target is to get a color of selected area from taken photo on a mobile device.&#xA;So I've needed to make some image processing programmatically.&#xA;Is it exist any algorithm to approximate color to it's natural value?&lt;/p&gt;&#xA;" OwnerUserId="1540" LastActivityDate="2012-06-21T22:32:21.603" Title="Colors on photo to real-life values" Tags="|image-processing|camera|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2675" PostTypeId="2" ParentId="2666" CreationDate="2012-06-21T18:33:36.890" Score="2" Body="&lt;p&gt;When you play an audio file, the device normally has some sort of volume control.  So 0.5 would be relative to some max volume allowed by the current setting of that volume control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the path from the samples to the speaker has a frequency response (that likely won't be flat from DC to light) which will modify the actual speaker displacement from the values of the scaled wave samples.  Since the frequency response of most audio systems does not pass DC, the speaker response will likely remove any DC offset and balance out the actual physical positive and negative displacements over sufficiently long time periods.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-06-23T06:20:53.447" LastActivityDate="2012-06-23T06:20:53.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2676" PostTypeId="2" ParentId="2674" CreationDate="2012-06-21T18:36:25.287" Score="7" Body="&lt;p&gt;In general case, no, you cannot approximate color of an object from digital image with good accuracy.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Human vision system&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;What you see is light reflected from the surface of the object. First the object needs to be illuminated with light. This light has some sort of &lt;a href=&quot;http://en.wikipedia.org/wiki/Visible_spectrum&quot;&gt;spectrum&lt;/a&gt; (probability density function of photon energy). When the light hits the object, the object absorbs some of the light. How much each wavelength of light is absorbed depends on material of the object. Light which is not absorbed, is reflected. Due to the absorption of certain wavelengths, this reflected light has different spectrum than the one which illuminated the object. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You sense the reflected light with four types of light sensitive cells. Each type of cell has its own &lt;a href=&quot;http://en.wikipedia.org/wiki/Rod_cell&quot;&gt;responsiveness&lt;/a&gt; (note the &lt;a href=&quot;http://en.wikipedia.org/wiki/File%3aCone-response.svg&quot;&gt;image&lt;/a&gt;) for different wavelengths of light. Finally brain combines the data from the light sensitive cells and produces information which you observe as color.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What is color?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;So what is the natural value of color? It depends on the reflection and absorption properties of the object, as well as the illumination of the scene, but you probably could describe it as the distribution of observed wavelengths of the light reflected from the object in certain illumination. So if we could reconstruct the wavelength distribution of the observed light, we could describe the natural value of the light color.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How digital cameras capture color?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In digital cameras light sensitive cells are commonly replaced with &lt;a href=&quot;http://en.wikipedia.org/wiki/Bayer_filter&quot;&gt;filter patterns&lt;/a&gt; which usually try to capture red, green and blue wavelengths of light. Each filter+light sensitive sensor has certain responsiveness for different wavelengths of light. The responsiveness can vary greatly between different sensor, but they usually try to mimic responsiveness of human vision system (for example see MT9P031 quantum efficiency curves on page 39 of &lt;a href=&quot;http://www.aptina.com/assets/downloadDocument.do?id=865&quot;&gt;this&lt;/a&gt; document).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RGB image processed by the computer has usually three integer values, red, green and blue. These are weighted integrals of the light spectrum captured by the filtered sensors of the camera.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How to approximate the light spectrum from digital image?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You cannot reconstruct the spectrum from three integrals as there is infinite number of possibilities of light spectrum which would have produced the integrals when weighted with the quantum efficiency of the camera systems.&lt;/p&gt;&#xA;" OwnerUserId="1203" LastActivityDate="2012-06-21T18:36:25.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2677" PostTypeId="2" ParentId="2668" CreationDate="2012-06-21T18:39:25.200" Score="0" Body="&lt;p&gt;The temporal neighborhood might include points at the same X,Y coordinate, but in the preceding or subsequent video frame.  The spatial neighborhood might include points in the same frame, but offset a small displacement from an X,Y coordinate.  The spatio-temporal neighborhood might include points a small displacement in terms of (X,Y,T) coordinates (where T is some scaled delta frame time).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-06-21T18:39:25.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2678" PostTypeId="2" ParentId="2659" CreationDate="2012-06-21T19:24:55.947" Score="2" Body="&lt;p&gt;My understanding is that you can not calculate homography from a single conic (conic is projection of a circle, in this case edge of the round screw). When camera calibration and homography between sensor and another plane (in you case the plane of the head of the screw) are known, you can calculate the orientation and location of the camera compared to the plane (or vice versa).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, you can estimate homography from four known points. If you have &lt;a href=&quot;http://en.wikipedia.org/wiki/Slot_drive#Slot&quot; rel=&quot;nofollow&quot;&gt;slot/flat head screw&lt;/a&gt;, accurate estimation of the screw position and orientation can be very hard as the measurement error for the the corners of the slot will be relatively big compared to distance of the points. If you have &lt;a href=&quot;http://en.wikipedia.org/wiki/Phillips_drive#Cross&quot; rel=&quot;nofollow&quot;&gt;cross&lt;/a&gt; type head, the four known points can be more spread apart and the homography estimation and therefore location/orientation estimation will be more accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can most likely combine the knowledge about the points of the slot corners and the edge of the screw (conic) to form even better estimation of the homography. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is quite recent &lt;a href=&quot;http://iic.cs.arizona.edu/static/resources/2010/07/01/planar_homography.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; on the topic of estimating homography with different techniques. Note that there are many cases in which particular method of homography estimation does not work. For example the &lt;a href=&quot;http://iic.cs.arizona.edu/static/resources/2010/07/01/planar_homography.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; describes a method for computing homography from a point and a line, but it does not warn you that the point can not lie on the same line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have always recommended &lt;a href=&quot;http://www.40noll.com/ar/exjobb.pdf&quot; rel=&quot;nofollow&quot;&gt;master thesis of Liljequist&lt;/a&gt; as good introduction paper about how to estimate camera location when camera calibration and homography are known. As Libor suggested, Multiple View Geometry by Hartley and Zisserman is good book about the camera geometry and algorithms related to it, but is also quite heavy compared to what you need for basic algorithms.&lt;/p&gt;&#xA;" OwnerUserId="1203" LastActivityDate="2012-06-21T19:24:55.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2679" PostTypeId="1" AcceptedAnswerId="2682" CreationDate="2012-06-21T21:14:52.460" Score="7" ViewCount="866" Body="&lt;p&gt;I'm studying about the analysis of (mainly) fMRI and EEG data. Multiple times it's mentioned that to reduce noise, you can use averaging, but nothing more detailed than that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There never is literally stated that you can use this or that technique to average.&#xA;So, what exactly is averaging? What techniques can be used to achieve it?&lt;/p&gt;&#xA;" OwnerUserId="1524" LastActivityDate="2017-01-07T18:32:06.083" Title="What is averaging and how can it be done?" Tags="|noise|signal-detection|eeg|averaging|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2680" PostTypeId="2" ParentId="2674" CreationDate="2012-06-21T22:32:21.603" Score="3" Body="&lt;p&gt;The most you can do is to capture a color table with reference colors (e.g. GretagMacbeth) and then calibrate the device (e.g. your camera) using software that generates an ICC profile to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows you to represent RGB colors from camera sensor in device-independent model (CIE XYZ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have calibrated monitor, you can map colors between devices keeping the colors looking similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this can only approximate color constancy between devices through gamut mapping. It &lt;strong&gt;will not tell you anything about natural color values&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore the captured colors always depend on illumination (this applies to calibrated cameras as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To measure colors in a physical point of view, you would need a photospectrometer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The color represented by any model like RGB, XYZ, ABCD... is just a simplification (summations over some wavelength ranges) of intensity histogram in visible color spectrum.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-06-21T22:32:21.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2681" PostTypeId="1" AcceptedAnswerId="2701" CreationDate="2012-06-21T23:10:19.670" Score="8" ViewCount="1344" Body="&lt;p&gt;I would like a pair of complementary IIR filters (lowpass/highpass). By complementary, I mean, when the output from the two filters is summed, the original signal is recovered. I thought I could build such pairs with butterworth filters but using a little math, I discovered only 1st order filters were complementary. I thought I'd done this before, but I'm forgetting how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is something wrong with my math? Is there an easy solution I'm forgetting about?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-06-23T11:36:03.413" Title="complementary IIR filters" Tags="|lowpass-filter|infinite-impulse-response|highpass-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2682" PostTypeId="2" ParentId="2679" CreationDate="2012-06-22T00:19:02.663" Score="6" Body="&lt;p&gt;In general, EEG, fMRI (and also &lt;a href=&quot;http://en.wikipedia.org/wiki/Magnetoencephalography&quot; rel=&quot;nofollow noreferrer&quot;&gt;MEG&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/SPECT&quot; rel=&quot;nofollow noreferrer&quot;&gt;SPECT&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Positron_emission_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;PET&lt;/a&gt; datasets -the so called &quot;functional modalities&quot;) are obtained from a subject (e.g. a human being) while it is engaged in one or more &quot;activities&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &quot;activity&quot; could even be &quot;Stay at rest with your eyes closed&quot; or &quot;try to solve this equation&quot; or &quot;simply look at the images on this screen&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, more than one subjects will be engaged in a study and these subjects may be divided into groups according to some criterion to compare and contrast their responses (e.g. &quot;Controls&quot; (subjects that are &quot;normal&quot; or do not suffer from a disease) and &quot;Diseased&quot; (subjects that have been verified to suffer from some disease)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these modalities, in addition to sampling time they also sample space AND each fMRI / EEG dataset is itself a sample from a population of subjects mentioned above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having described this, you can almost see the dimensions across which you would apply averaging and why:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You can do (the common) temporal averaging (like a moving average or median filter) over each channel (for the EEG) or voxel time series (for fMRI) to reduce the effect of noise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can do Spatial averaging in a number of different ways and for different purposes but all that spatial averaging entails is summing together the responses from $N$ individual channels ($N$ individual vectors) and diving them by $N$ to get a mean response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, perhaps you would like to obtain the average response corresponding to some brain region (occipital, parietal, frontal, other). Then you can select the $N$ vectors (channels) corresponding to those regions and obtain ONE vector by averaging them (for example, if your channels are in &lt;code&gt;X(channelN, timeSampleM)&lt;/code&gt; you can obtain ONE average by doing &lt;code&gt;mean(X)&lt;/code&gt; which will return one vector of size &lt;code&gt;1 x timeSampleM&lt;/code&gt; with the mean of each column (that corresponds to the sample taken by each channel at some time instant $M$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing you might want to do, is obtain the average response of ONE subject depending on the activity they were carrying out. For example, you would like to see the differences in the average response of a subject's brain between the conditions of REST and LISTENINGTOMUSIC. In this case, you need to know which datasets correspond to which activity and you simply obtain the average of those $X_{k,l}$ (where $k$ denotes the dataset and $l$ denotes the activity). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can do spatial averaging over a population (and / or &quot;activity&quot; they were carrying out). So for example, you might want to see what is the average response of the brain at condition REST between two subject groups (Group A, Group B). In this case you select all datasets from all subjects in Group A and obtain an average dataset and similarly for Group B. You can do the same (but changing the membership) to obtain the average response of ONE group between different conditions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(And of course, you could apply any combination of spatial / temporal / group / condition averaging depending on what you are trying to observe)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, another area where averaging is inherent to the data processing is that of &lt;a href=&quot;http://en.wikipedia.org/wiki/Evoked_potential&quot; rel=&quot;nofollow noreferrer&quot;&gt;Evoked Potentials&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, imagine that you would like to examine the response of the brain to a burst of audible noise. In this case, you provide a stimulus to the subject and record its response for a number of times. After that, you average all recordings (alligned at the stimulus instance) and produce ONE signal that represents the response of the brain. A famous such signal is the &lt;a href=&quot;http://en.wikipedia.org/wiki/P300_%28neuroscience%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;P300&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, although the operation of averaging is the same (from a mathematical point of view) there are many different ways to apply it depending on the objective. Therefore, I would recommend going over a specific paper carefully to understand &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a) why they apply averaging &lt;/li&gt;&#xA;&lt;li&gt;and b) how is averaging applied. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Furthermore, i would like to recommend to you the following resources that you might find useful and which cotain far more detailed information about EEG and fMRI analysis (incudling averaging) in general:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/Electroencephalography-Principles-Clinical-Applications-Related/dp/0781751268&quot; rel=&quot;nofollow noreferrer&quot;&gt;Electroencephalograhy by Lopes Da Silva&lt;/a&gt; (obviously for EEG, key&#xA;chapters to focus on are 2,4,14,53,58,59)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/Statistical-Parametric-Mapping-Analysis-Functional/dp/0123725607&quot; rel=&quot;nofollow noreferrer&quot;&gt;Statistical Parametric Mapping by Friston et al&lt;/a&gt; (for a very&#xA;thorough treatment of the analysis of fMRI images. Earlier versions&#xA;of that book (and of the also excellent &quot;Human Brain Function&quot; are&#xA;available for free from &lt;a href=&quot;http://www.fil.ion.ucl.ac.uk/spm/doc/intro/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (you need to have a close look at&#xA;chapters 3-5 and especially 5 to understand the experimental side))&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.scholarpedia.org/article/Category:Neuroimaging&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scholarpedia articles on Neuroimaging&lt;/a&gt; (This is a very good&#xA;resource in general)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1629" LastEditDate="2017-01-07T18:32:06.083" LastActivityDate="2017-01-07T18:32:06.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2683" PostTypeId="2" ParentId="386" CreationDate="2012-06-22T00:41:47.090" Score="5" Body="&lt;p&gt;Sounds like you want to use autocorrelation to do beat detection. You can do this, but I suggest you massively downsample your audio. You're looking for a signal between 1 and 3 Hz (60 bpm to 180 bpm) so you don't need or want 44100 hz resolution.&#xA; A properly computed and normalized autocorrelation is 1.0 at lag 0 (the signal perfectly correlates with itself). For a periodic signal, the ac drops below zero, then comes back up in a peak at the lag corresponding to the fundamental frequency, with smaller peaks at harmonics. You must pick a reasonable range in which to search for this peak. For noise, the autocorrelation drops and basically flatlines in squiggles around zero. As a rule of thumb, if you have a peak &gt; 0.5 in the normalized ac, you have a periodic signal.&lt;/p&gt;&#xA;" OwnerUserId="1544" LastActivityDate="2012-06-22T00:41:47.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2684" PostTypeId="2" ParentId="2681" CreationDate="2012-06-22T04:42:24.730" Score="6" Body="&lt;p&gt;The frequency response of the two complementary filters are $H_2(e^{j\theta}) = 1 - H_1(e^{j\theta})$, or the impulse responses $h_2[n] = \delta[n] - h_1[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an IIR filter, $H_1(z)$ can be written as $\frac{b_0 + b_1 z^{-1} + \ldots}{a_0 + a_1 z^{-1} + \ldots}$. Then $H_2(z)$ should be something like $\frac{(a_0 - b_0) + (a_1 - b_1) z^{-1} + \ldots}{a_0 + a_1 z^{-1} + \ldots}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the non-recursive coefficients for $H_2$ are now $(a_0-b_0)$, $(a_1 - b_1)$, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The recursive coefficients are the same for both filters.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-06-22T04:42:24.730" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2685" PostTypeId="1" CreationDate="2012-06-22T04:49:17.657" Score="4" ViewCount="109" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have created a database (DB) of amplitde vs time delay of UWB pulses originating from various (known) points in a certain (known) &quot;region&quot; in a space. This DB also stores region name, since there are several regions . This is &quot;training phase&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the folowup part is called &quot;localization phase&quot; -- I assume that there is a signal coming from one of the regions ..I don't know which, I changed parameters of simulation and now know this new comer's amplitude vs delay profile. I will cross-correlate this new signal with the ones stored in my DB in #1 above. If any of the signals matches, I can then say that the signal was from region 1 or 2 or 3 .. etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My problem: How do I evaluate this system? That it fared better or worse? If I had resources, I could probably buy or borrow a network analyzer, antenna, etc, and measure the delay profile and that would give me something to compare against.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now without that option, what are my (other) options?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gurus, please advise. &#xA;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1545" LastActivityDate="2012-06-22T04:49:17.657" Title="How to evaluate performance of a simulated system" Tags="|matlab|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2686" PostTypeId="1" CreationDate="2012-06-22T13:02:43.137" Score="2" ViewCount="1375" Body="&lt;p&gt;Anyone have an idea of how I can implement autocorrelation of power spectrum of one image? I tried using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; autocorrel = ifft( | fft(power spectrum) | ^ 2 );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it's not working. Do you have any idea why or some other way?&lt;/p&gt;&#xA;" OwnerUserId="1550" LastEditorUserId="1530" LastEditDate="2012-06-22T13:09:11.150" LastActivityDate="2012-06-22T14:01:39.660" Title="Autocorrelation of power spectrum" Tags="|image-processing|fourier-transform|autocorrelation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2687" PostTypeId="1" CreationDate="2012-06-22T13:41:40.963" Score="78" ViewCount="108318" Body="&lt;p&gt;I see the HSV colour space used all over the place: for tracking, human detection, etc...  I'm wondering, why?  What is it about this colour space that makes it better than using RGB?&lt;/p&gt;&#xA;" OwnerUserId="1551" LastActivityDate="2022-02-17T01:26:27.287" Title="Why do we use the HSV colour space so often in vision and image processing?" Tags="|image-processing|computer-vision|" AnswerCount="9" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2688" PostTypeId="2" ParentId="2686" CreationDate="2012-06-22T14:01:39.660" Score="6" Body="&lt;p&gt;The autocorrelation function is the inverse Fourier Transform &#xA;of the power spectrum. I have no idea where you got your formula&#xA;from or what your calculation is &#xA;meant to be doing. Are you sure that you are reading the &#xA;book/journal article/application note/website/Wikipedia or whatever&#xA;correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, if you want to compute an autocorrelation&#xA;as an &lt;code&gt;ifft&lt;/code&gt;, you should be careful about making sure that&#xA;the power spectrum vector is set up right. If the &#xA;autocorrelation function that you compute as the iffy&#xA;does not have a peak at the origin (or as the first&#xA;entry in the vector for MATLABi folks) and have the&#xA;symmetry property $R[i] = R[-i]$ in real life and&#xA;the appropriately translated version in MATLAB, something&#xA;is awry.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-06-22T14:01:39.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2689" PostTypeId="2" ParentId="2687" CreationDate="2012-06-22T15:02:24.937" Score="49" Body="&lt;p&gt;&lt;em&gt;The color information is usually much more noisy than the HSV information.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let me give you an example: Me and some friends were involved in a project dealing with the recognition of traffic signs in real scene videos (noise, shadows and sometimes occlusion present). It was a part of a bigger project, so that allowed us time to try out different approaches to this particular problem (and re-use older approaches). I did not try color-based approach myself, but I remember an interesting information: _The dominant RGB component in a STOP sign was often &lt;strong&gt;not&lt;/strong&gt; red! (mostly due to shadows)&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;You can frequently get better information from a HSV colorspace&lt;/em&gt;. Let me try and give a personal experience example again: Try imagining you have an image of a single-color plane with a shadow on it. In RGB colorspace, the shadow part will most likely have very different characteristics than the part without shadows. In HSV colorspace, the &lt;em&gt;hue&lt;/em&gt; component of both patches is more likely to be similar: the shadow will primarily influence the &lt;em&gt;value&lt;/em&gt;, or maybe &lt;em&gt;saturation&lt;/em&gt; component, while the &lt;em&gt;hue&lt;/em&gt;, indicating the primary &amp;quot;color&amp;quot; (without it's brightness and diluted-ness by white/black) should not change so much.&lt;/p&gt;&#xA;&lt;p&gt;If this explanations do not sound intuitive to you, I suggest:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;try and better understand components used to represent a color in HSV colorspace, and renew your knowledge of RGB&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;try and see the &lt;em&gt;reasons&lt;/em&gt; why these kinds of color representation were developed: it is always in some way, based on some view of human interpretation of color&lt;/p&gt;&#xA;&lt;p&gt;e.g. children do not actually like highly &lt;em&gt;colored&lt;/em&gt; == &lt;em&gt;valued&lt;/em&gt; objects, they prefer highly &lt;em&gt;saturated&lt;/em&gt; objects, objects in which the color is intense and non-diluted&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;after you get this and develop some intuition, you should play with images: try decomposing various images in their R-G-B and H-S-V components&lt;/p&gt;&#xA;&lt;p&gt;Your goal would be to see &lt;em&gt;and understand&lt;/em&gt; a difference in these decompositions for images that contain shadows, strong illumination, light reflection.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if you have a particular type of images you like to play with, try decomposing them: who knows, maybe RGB is really more suited for your needs than HSV :)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="7092" LastEditDate="2022-02-17T01:26:27.287" LastActivityDate="2022-02-17T01:26:27.287" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2690" PostTypeId="2" ParentId="2687" CreationDate="2012-06-22T15:33:22.947" Score="10" Body="&lt;p&gt;Using only the Hue component makes the algorithm less sensitive (if not invariant) to lighting variations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another popular option is LAB color space, where the AB channels represent the color and euclidean distances in AB space better match the human perception of color. Again, ignoring the L channel (Luminance) makes the algorithm more robust to lighting differences.&lt;/p&gt;&#xA;" OwnerUserId="1082" LastActivityDate="2012-06-22T15:33:22.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2691" PostTypeId="2" ParentId="2687" CreationDate="2012-06-22T15:38:09.877" Score="71" Body="&lt;p&gt;The simple answer is that unlike &lt;a href=&quot;http://en.wikipedia.org/wiki/RGB_color_space&quot;&gt;RGB&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/HSL_and_HSV&quot;&gt;HSV&lt;/a&gt; separates &lt;em&gt;luma&lt;/em&gt;, or the image intensity, from &lt;em&gt;chroma&lt;/em&gt; or the color information.  This is very useful in many applications.  For example, if you want to do histogram equalization of a color image, you probably want to do that only on the intensity component, and leave the color components alone.  Otherwise you will get very strange colors.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In computer vision you often want to separate color components from intensity for various reasons, such as robustness to lighting changes, or removing shadows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, however, that HSV is one of many color spaces that separate color from intensity (See YCbCr, Lab, etc.).  HSV is often used simply because the code for converting between RGB and HSV is widely available and can also be easily implemented.  For example, the Image Processing Toolbox for MATLAB includes functions &lt;code&gt;rgb2hsv&lt;/code&gt; and &lt;code&gt;hsv2rgb&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2014-02-15T20:27:12.207" LastActivityDate="2014-02-15T20:27:12.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2692" PostTypeId="2" ParentId="2665" CreationDate="2012-06-22T15:45:40.787" Score="16" Body="&lt;p&gt;I believe &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/013168728X&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gonzalez and Woods's book - Digital Image Processing&lt;/a&gt; are competent enough to rely on their opinion:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;There is no general agreement among authors regarding where image processing stops and other related areas, such as image analysis and computer vision, start. Sometimes a distinction is made by defining &lt;strong&gt;image processing as a&#xA;discipline in which both the input and output of a process are images&lt;/strong&gt;.We believe &lt;strong&gt;this to be a limiting&lt;/strong&gt; and somewhat &lt;strong&gt;artificial boundary&lt;/strong&gt;. For example, under this definition, even the trivial task of computing the average intensity of an image (which yields a single number) would not be considered an image processing operation. On the other hand, there are fields such as &lt;strong&gt;computer vision&lt;/strong&gt; whose ultimate goal is to use computers to emulate &lt;strong&gt;human vision&lt;/strong&gt;, including learning and being able to make inferences and take actions based on visual inputs. This area itself is a branch of artificial intelligence (AI) whose objective is to emulate human intelligence. The field of AI is in its earliest stages of infancy in terms of development, with progress having been much slower than originally anticipated. The area of &lt;strong&gt;image analysis&lt;/strong&gt; (also called image understanding) is in &lt;strong&gt;between image processing and computer vision&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So I would say, that primary difference is in goals, not methods. For example, if the goal is to &lt;em&gt;enhance image&lt;/em&gt; for later use by humans, then this may be called image processing. And if the goal is to &lt;em&gt;emulate human vision&lt;/em&gt; (be it object recognition, defect detection or automatic driving), then it is closer to computer vision. Note, however, that emulating human vision by definition may also require image enhancement, so in most real cases &lt;em&gt;computer vision relies on image processing&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Image understanding (feature extraction) may be equally used in both - pure image processing and computer vision.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="7092" LastEditDate="2021-11-10T12:31:52.250" LastActivityDate="2021-11-10T12:31:52.250" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2693" PostTypeId="2" ParentId="1656" CreationDate="2012-06-22T19:29:14.070" Score="2" Body="&lt;p&gt;If I'm interpreting the question correctly, you're looking for a way to find a distribution of the frequencies in each images. It sounds like you might need some sort of 3D scatterplot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h2WyX.gif&quot; alt=&quot;I have no idea what this is a plot of, but I&amp;#39;m just demonstrating the idea&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have 20 images that are 256x256, how I imagine this working is,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take your 2D FFT or 2D DCT (or blockwise FFT/DCT) for each image&lt;/li&gt;&#xA;&lt;li&gt;Normalize all the values so you can have a good comparison between each image&lt;/li&gt;&#xA;&lt;li&gt;Concatenate all the frequency domain images into a 256 x 256 x 20 matrix&lt;/li&gt;&#xA;&lt;li&gt;Filter out the values that are below a certain threshold because they do not represent a significant component of your image. For example, if the magnitude of the values in the corners that represent high frequency information are very low, then removing them won't make a huge difference to your image because most of the information is elsewhere. But removing those data points create holes in your 3D plot so you can see the information that you're interested in&lt;/li&gt;&#xA;&lt;li&gt;Plot the data in 3D. If you're using Matlab, you can use &lt;a href=&quot;http://www.mathworks.com/help/techdoc/ref/scatter3.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;scatter3()&lt;/a&gt;. The plot will be easier to read if you apply a heatmap.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Otherwise, if you're looking for the frequency information of a single image, there's several ways to represent the data depending on your problem. If you clarify the question you have and it's application, I can edit this answer.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/YUV&quot; rel=&quot;nofollow noreferrer&quot;&gt;Histogram&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you take the histogram of a grayscale image, you'll see a distribution of the intensity values of each pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This easiest way to see this is to open up the image in a photo-editing software, like Photoshop, GIMP, Picasa and select histogram from the menu.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use Matlab, the &lt;a href=&quot;http://www.mathworks.com/help/techdoc/ref/hist.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;hist()&lt;/a&gt; function plots a histogram similar to the one below. You can directly pass your image variable into the hist() function. But it's important to pick a good bin size, because different bin sizes can dramatically change the representation of the data. There are ways to &lt;a href=&quot;https://stats.stackexchange.com/questions/798/calculating-optimal-number-of-bins-in-a-histogram-for-n-where-n-ranges-from-30&quot;&gt;calculate optimal bin sizes&lt;/a&gt;, but you can always guess and check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X6Fos.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;http://www.cs.unm.edu/~brayer/vision/fourier.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;2D FFT&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c2ppj.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Follow the Wikipedia article for the theoretical explanation, but basically the 2D FFT gives you an image of the intensity of low frequency to high frequency information. The center of the image is low frequency information (such as flat surface, sky, skin, walls) and the corners are high frequency information (edges, grainy noise, intricate patterns). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using Matlab, you need to shift the 2D FFT to put the low frequency information in the center of the image. It's also a good idea to normalize the 2D FFT so you can see the details better; it's similar to contrast enhancing a photograph to see the details.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;http://www.cs.cf.ac.uk/Dave/Multimedia/node231.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;2D DCT&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BpC0g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Follow the Wikipedia article for the theoretical explanation. The 2D DCT is very similar to the 2D FFT; It also gives you an image of the intensity of low frequency to high frequency information, but the &lt;strong&gt;low frequency information is in the top-left corner&lt;/strong&gt; and the &lt;strong&gt;high frequency information is in the bottom-right corner&lt;/strong&gt;. This makes the information easier to manipulate (at least for me). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, the 2D DCT is used on blocks of an image (8x8 pixels). This gives you frequency information that is still related to its location in the spatial image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2D DCT is useful for encoding images. A variant of &lt;a href=&quot;http://en.wikipedia.org/wiki/JPEG#JPEG_codec_example&quot; rel=&quot;nofollow noreferrer&quot;&gt;JPEG encoding&lt;/a&gt; uses the 2D DCT transform.&lt;/p&gt;&#xA;" OwnerUserId="1509" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2012-06-22T19:29:14.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2694" PostTypeId="1" CreationDate="2012-06-22T20:02:32.810" Score="13" ViewCount="10008" Body="&lt;p&gt;I am trying to parallelize the computation of an FFT on terabyte-sized signal files. Right now such an FFT using an open-source library takes many hours, even running through CUDA on the fastest GPU I have. The framework I am trying to adapt to this process is Hadoop. In very basic terms, Hadoop distributes a problem over any number of server nodes in the following manner:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;• You split your input file into (key, value) pairs.&lt;br&gt;&#xA;  •   These pairs&#xA;  are fed into a “Map” algorithm, which transforms your (key, value)&#xA;  pairs into some other (key, value) pairs based on what you put inside&#xA;  the Map.&lt;br&gt;&#xA;  •   The framework then collects all the (key, value)&#xA;  outputs from the Maps and sorts them by key, as well as aggregating&#xA;  values with the same key to a single pair,  so you end up with (key, &#xA;  list(value1, value2, ..)) pairs&lt;br&gt;&#xA;   •  These  pairs are then&#xA;  fed into a “Reduce” algorithm, which in turn outputs more (key, value)&#xA;  pairs as your final result (written to a file).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are many applications for this model in practical stuff like processing server logs, but I am having a hard time applying the framework to chopping up an FFT into “map” and “reduce” tasks, especially since I am not really familiar with DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will not bother you with the programming mumbo jumbo, as this is a DSP Q&amp;amp;A. I am, however,  confused on what algorithms exist for computing FFTs in parallel; Map and Reduce tasks can’t (technically) talk to each other, so the FFT must be split into independent problems from which the results can somehow be recombined at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have programmed a simple implementation of Cooley-Tukey Radix 2 DIT that works on small examples, but using it for recursively calculating odd/even index DFTs for a billion bytes will not work.  I have spent a few weeks on reading many papers, including one on a MapReduce FFT algorithm (written by Tsz-Wo Sze as part of his paper on SSA multiplication, I cannot link more than 2 hyperlinks) and the “four-step FFT” (&lt;a href=&quot;http://images.apple.com/acg/pdf/FFTapps_20090909.pdf&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://crd-legacy.lbl.gov/~dhbailey/dhbpapers/fftq.pdf&quot;&gt;here&lt;/a&gt;), which seem similar to each other and to what I am trying to accomplish. However, I am hopelessly bad at mathematics, and applying any of those methods by hand to a simple set of something like {1,2, 3, 4, 5, 6, 7, 8} (with all imaginary components being 0) gives me wildly incorrect results. Can anyone explain an efficient parallel FFT algorithm to me in plain English (one that  I linked or any other) so that I may try and program it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Jim Clay and anyone else who may be confused by my explanation, I am trying to do a single FFT of the terabyte file. But I want to able to do it concurrently on multiple servers in order to speed up the process.&lt;/p&gt;&#xA;" OwnerUserId="1554" LastEditorUserId="-1" LastEditDate="2012-06-23T01:06:41.250" LastActivityDate="2013-10-02T20:42:32.330" Title="Algorithms for computing FFT in parallel" Tags="|fft|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2695" PostTypeId="1" AcceptedAnswerId="2852" CreationDate="2012-06-22T20:26:48.177" Score="2" ViewCount="935" Body="&lt;p&gt;If I wanted to apply a 100Hz frequency shift to a QAM signal with a 500MHz carrier frequency, I would&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Demodulate it at the carrier frequency&lt;/li&gt;&#xA;&lt;li&gt;Apply a frequency shift to the original signal&lt;/li&gt;&#xA;&lt;li&gt;Modulate it again at the new carrier frequency&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there a way to apply a frequency shift to the IQ values of a QAM signal without demodulating it?&lt;/p&gt;&#xA;" OwnerUserId="1509" LastActivityDate="2012-07-10T18:56:39.637" Title="How to Shift Carrier Frequency in QAM Signal?" Tags="|frequency|modulation|demodulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2696" PostTypeId="1" CreationDate="2012-06-22T16:17:08.887" Score="5" ViewCount="48863" Body="&lt;p&gt;I am dabbing a little bit into signal processing on MATLAB. And I have the following question that I would like to know the answer to.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What has to be done : Plot the Spectrogram of an audio file.&lt;/li&gt;&#xA;&lt;li&gt;What I know : Since its an audio file, I use &lt;code&gt;wavread&lt;/code&gt; to read it and use the array returned to plot any of the graphs that I would like to. Only recently, I found that wav files store data on multiple channels. All the files that I have, have two channels. I know that the Spectrogram is supposed to give you an idea of the fundamental frequencies present in your audio file. &lt;/li&gt;&#xA;&lt;li&gt;What I would like to know : What does the Spectrogram exactly do? What do the parameters mean? This is the structure of the Spectrogram function call : &lt;code&gt;S=spectrogram(x,window,noverlap,nfft,fs)&lt;/code&gt;. What do the &lt;code&gt;window&lt;/code&gt; and &lt;code&gt;noverlap&lt;/code&gt; parameters mean? How do I set these parameters? Are they input file dependent? After all this, how do I plot the Spectrogram of the audio file since it contains two channels? The function returns an error when I try to pass the two dimensional(since there are two channels) array returned by &lt;code&gt;wavread&lt;/code&gt;. It says that I can pass only a row or a column at a time. How do I go about plotting the Spectrogram of my wav file?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks a million, in advance! : )&lt;/p&gt;&#xA;" OwnerUserId="1568" OwnerDisplayName="hRob" LastEditorUserId="1629" LastEditDate="2016-01-11T19:47:40.120" LastActivityDate="2016-01-11T19:47:40.120" Title="How do I plot the spectrogram of a wav file?" Tags="|matlab|spectrogram|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2697" PostTypeId="2" ParentId="2696" CreationDate="2012-06-22T21:42:39.897" Score="12" Body="&lt;p&gt;This isn't a great question, but I'll try to answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;All the files that I have, have two channels. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A spectrogram can only show one channel at a time.  Either make one spectrogram for each channel, or average your channels together into one.  Here's an example of the syntax I found with a quick google search:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y, fs]=wavread(fileName); % Read wave file&#xA;left=y(:,1); % Left channel &#xA;right=y(:,2); % Right channel&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then you can do &lt;code&gt;spectrogram(left)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I know that the Spectrogram is supposed to give you an idea of the fundamental frequencies present in your audio file.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not quite.  The term &quot;fundamental frequency&quot; means something different.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What does the Spectrogram exactly do? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It shows the frequency spectrum of the signal and how it changes over time.  If the beginning of the signal is white noise (flat spectrum), and the end of the signal is a tone (spikey spectrum), the spectrogram will show how it changed from one spectrum to the other over time.  It does this by dividing the signal up into small chunks and calculating the spectrum of each chunk.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What do the parameters mean? This is the structure of the Spectrogram function call : S=spectrogram(x,window,noverlap,nfft,fs). What do the window and noverlap parameters mean? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Did you read &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/spectrogram.html&quot;&gt;the documentation&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;window&lt;/code&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function&quot;&gt;window function&lt;/a&gt; that is applied to each chunk of the file before the frequency transform.  If you didn't use a window function, there would be abrupt changes at the beginning and end of each chunk, which produce wide frequency components that you don't want.  The window function is like a &quot;fade-in, fade-out&quot; envelope, so that you only see the spectrum of the middle of the chunk, and not the artifacts caused by chopping the chunk abruptly at the endpoints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;noverlap&lt;/code&gt; is the number of samples that each chunk overlaps the next.  The windowing function attenuates the signal to near 0 at the boundaries of each chunk, so if you didn't overlap the chunks at all, you would be emphasizing parts of the signal and ignoring other parts.  The overlap lets you measure the same part of the signal twice, once in the middle of the chunk where it's important, and once at the ends where it's mostly ignored.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I set these parameters?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically you try different ones and see which is best at showing you what you want to see.  Different window functions are designed to do different things, so read about them and what they are meant to do.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are they input file dependent? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Only if you're looking for different types of things in different files.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2012-06-22T21:42:39.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2698" PostTypeId="2" ParentId="2687" CreationDate="2012-06-23T01:22:02.290" Score="8" Body="&lt;p&gt;The best answer I can figure is: RGB has to do with &quot;implementation details&quot; regarding the way RGB displays color, and HSV has to do with the &quot;actual color&quot; components. Another way to say this would be RGB is the way computers treats color, and HSV try to capture the components of the way we humans &lt;em&gt;perceive&lt;/em&gt; color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll elaborate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Color is a perception based on electromagnetic waves. Natural properties of these waves are,for example intensity and frequency. If we sweep the frequency of a lightwave from infra-red to ultra-violet, we would visually perceive a color variation along the rainbow colors. Rainbow colors could be considered &quot;pure colors&quot; because they are represented by single-frequency waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the human eye can only respond, or &quot;resonate&quot; to three main light frequencies, not surprisingly red, green and blue. The fact is that this response is non-linear, so the retina can distinguish a given pure color (and implicitly its &quot;frequency&quot;) by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Young-Helmholtz_theory&quot;&gt;combined response of the three color components&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RGB color space exists as such only to mimic the internal workings of our retina, so that a vast majority of colors can be represented on computer displays by means of a convenient (from a computer point of view) 24 bits-per-pixel color coding. The RGB color space has no intrinsic relation to the natural color properties, neither to human interpretation of color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, any arithmetical operation performed channel-wise in RGB space (for example, generation of color gradients) gives very crude or even plainly &quot;wrong&quot; results. That's why it is advised to create colormaps by converting the color stops from RGB to other color spaces (HLS, Lab, etc.), performing the interpolations, then converting the interpolated values back to RGB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-06-23T01:22:02.290" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2699" PostTypeId="2" ParentId="2694" CreationDate="2012-06-23T10:13:30.807" Score="2" Body="&lt;p&gt;Let us assume that your data size is $2^N$. Pad with zeros otherwise. In your case, since you mention &quot;Terabyte-scale&quot; sizes, we'll take N = 40.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $2^{N / 2}$ is a big -- but absolutely reasonable for a single machine -- FFT size, I suggest you to do just &lt;strong&gt;one single Cooley-Tukey iteration of radix $N / 2$&lt;/strong&gt;, and then let a proper FFT library (like FFTW) do the job on each machine for the smaller size $2 ^{N / 2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more explicit, there's no need to use MR along the whole recursion, this will be quite inefficient indeed. Your problem can be broken down into a million of megabyte size inner and outer FFTs, and those megabyte FFTs can perfectly be computed using FFTW or the like. MR will just be responsible for supervising the data shuffling and recombination, not the actual FFT computation...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My very first idea would be the following, but I suspect this can be done in one single MR with smarter data representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $s$ be your input signal, $R = 2^{N / 2}$&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;First MR: inner FFT&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Map: perform decimation in time, group samples in blocks for inner FFT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;input: $(k, v)$ where $k$ is the sample index in $0 .. 2^N - 1$ ; $v$ the value taken by $s[k]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;emit: $(k \% R, (k / R, v))$ - where % represents modulo and / integer division.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reduce: compute inner FFT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;input: $(k, vs)$ where $k$ is the block index ; and $vs$ is a list of $(i, v)$ pairs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;populate a vector $in$ of size $R$ such that $in[i] = v$ for all values in the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;perform a size $R$ FFT on $in$ to get a vector $out$ of size $R$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $i$ in $0 .. R - 1$, emit $(k, (i, out[i]))$&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Second MR: outer FFT&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Map: group samples for outer fft and apply twiddle factors&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;input: $(k, (i, v))$ where $k$ is a block index, $(i, v)$ a sample of the inner FFT for this block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;emit $(i, (k, v \times \exp \frac{-2 \pi j i k}{2 ^ N}))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reduce: perform outer FFT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;input: $(k, vs)$ where $k$ is the block index ; and $vs$ is a list of $(i, v)$ pairs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;populate a vector $in$ of size $R$ such that $in[i] = v$ for all values in the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;perform a size $R$ FFT on $in$ to get a vector $out$ of size $R$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $i$ in $0 .. R - 1$, emit $(i \times R + k, out[i]))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/2977796&quot; rel=&quot;nofollow&quot;&gt;Proof of concept python code here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the Mappers are only shuffling the order of data, so under the following assumptions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;decimation in time (Mapper 1) can be done in a previous step (for example by the program that converts the data into the right input format).&lt;/li&gt;&#xA;&lt;li&gt;your MR framework supports Reducers writing to a key different from their input key (In Google's implementation reducers can only output data to the same key as they received it, I think it's due to SSTable being used as an output format).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All this can be done in one single MR, the inner FFT in the mapper, the outer FFT in the reducer. &lt;a href=&quot;https://gist.github.com/2977916&quot; rel=&quot;nofollow&quot;&gt;Proof of concept here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-06-25T15:08:40.677" LastActivityDate="2012-06-25T15:08:40.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2700" PostTypeId="2" ParentId="2694" CreationDate="2012-06-23T10:29:43.943" Score="4" Body="&lt;p&gt;Instead of trying to re-write the FFT you could try using an existing FFT implementation (such as &lt;a href=&quot;http://www.fftw.org/&quot; rel=&quot;nofollow&quot;&gt;the FFTW&lt;/a&gt; for example) and apply it repetitively along your signal's length (no matter how big it is) through either the &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;overlap-add&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;nofollow&quot;&gt;overlap-save&lt;/a&gt; methods. This is possible by &lt;a href=&quot;http://www.engineeringproductivitytools.com/stuff/T0001/PT11.HTM&quot; rel=&quot;nofollow&quot;&gt;expressing the FFT as a convolution&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These shorter length FFTs do not need to communicate with each other and the whole scheme matches the map-reduce steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, what you would aim to do is to have your signal X split into smaller segments that also could be overlapping (for example X[0:10],X[5:15],X[10:20]....). Perform the FFT on these small segments and recombine them in the end to produce the final one. This fits very well with the map-reduce operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During &quot;map&quot; you can generate (key,value) pairs with the &quot;key&quot; being some sequential ID of each segment (0,1,2,3,4,5,....) and the &quot;value&quot; being the INDEX (or file position) of the first value of a segment in your signal's file. So, for instance, if your file is full of INT32s then the index of the second segment (above) is at 5*sizeof(INT32). (Or if it's in any other format you might have a lib for it)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, each worker receives a (key,value) opens a file, seeks to the right point, reads M samples from it (where M is 10 above), performs the FFT and saves it to a file with some name, for example &quot;RES_[INKEY].dat&quot; and returns a (key,value) pair. In this case, &quot;key&quot; would be the INDEX (the &quot;value&quot; of the incoming (key,value) tuple) and &quot;value&quot; would be the name of the file that contains the FFT results. (we'll get back to this)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within &quot;reduce&quot; you can now implement either overlap-add or overlap-save by accepting a (key,value) from the &quot;map&quot; step, openning that file, loading the FFT results, doing either o-a or o-s and then saving them to the right INDEX in your output file. (See pseudocode &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method#The_algorithm&quot; rel=&quot;nofollow&quot;&gt;in this&lt;/a&gt; (or &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap_save#Pseudocode&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;), the &quot;map&quot; step handles the &quot;yt=...&quot; in parallel and the &quot;reduce&quot; step handles the &quot;y(i,k)=...&quot; part.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some file juggling might be needed here to reduce the traffic on the network or the load of a server that might contain your actual data file.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2012-06-23T10:59:34.057" LastActivityDate="2012-06-23T10:59:34.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2701" PostTypeId="2" ParentId="2681" CreationDate="2012-06-23T11:36:03.413" Score="3" Body="&lt;p&gt;Juancho's answer is sort of right, however there is one problem: The complimentary filter of a low pass is generally NOT a high pass filter, at least not in the sense that you are looking for. For example the one's compliment of a 4th order Butterworth low pass does not look like a 4th order high pass filter at all. It has about only half the steepness, reaches a maximum gain of ca. +6 dB below the crossover frequency and than slowly approaches unity gain above the cross over frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only matching high and low pass filters that sum to unity are first order filters. You can however find matching higher order filters that sum to unity gain so that the overall transfer function of the sum is an all pass filter. These are odd order Butterworth filters and even order Linkwitz Riley filters.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-06-23T11:36:03.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2702" PostTypeId="2" ParentId="2637" CreationDate="2012-06-23T12:30:08.540" Score="2" Body="&lt;p&gt;Theoretically it's possible to do this, although it will often not be practical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider this in polynomial space. For a filter of order N you have 2*N+1 independent variables (N for the denominator and N+1 for the numerator). Let's look an arbitrary point $z_{k}$ in the z-plane and let's say the value of the transfer function at this point is H($z_{k}$). The relationship between the transfer function and all the filter coefficients can be written as equation that's linear in all filter coefficients as follows: &#xA;$$\sum_{n=0}^{2*N}b_{n}\cdot z_{k}^{-n} - H(z_{k})\cdot \sum_{n=1}^{2*N}a_{n}\cdot z_{k}^{-n}=H(z_{k})$$&#xA;So if you pick M different frequencies $z_{k}$ you'll end up with a set of M complex linear equations or 2*M real equations. Since your number of unknowns is odd (2*N+1) you probably always want to pick one frequency where z is real, i.e z = 1 or $\omega$ = 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If M is larger than N than the system of equations is linearly dependent. You can find the filter order by starting at N=1 and increase N until the equation system becomes linearly dependent. The largest N at which the system is linearly independent is the actual filter order. For this approach, it doesn't even matter what frequencies you pick. As long as they are different, any set of frequencies will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this a numerically very tricky problem. Polynomial representation for larger filter orders is numerically very fragile and the smallest amount of noise or uncertainty leads to very large numerical errors. For example, if you determine the values of the sampled transfer function through measurement, the required measurement accuracy will be prohibitive unless it's very benign low order filter.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-06-23T12:30:08.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2705" PostTypeId="1" AcceptedAnswerId="2706" CreationDate="2012-06-23T19:02:18.990" Score="14" ViewCount="323" Body="&lt;p&gt;I'm preforming a system identification measurement, and would like to deconvolve the measurement system's response from the measured response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The set up of the system is as follows; the signal is generated on a PC, the signal is then sent to the sound card, which in turn forwards the signal to the power amplifier, this drives a loudspeaker.  The loudspeaker propagates the sound energy which is captured by a microphone, and back into the sound card.  The recorded signal is then processed by the computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal from the sound card is also fed straight back to itself, which allows me to measure the response of the pc -&gt; DAC -&gt; ADC -&gt; pc response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to deconvolve this 'measurement chain' from the overall 'system chain'.  What methods could I use for this task?&lt;/p&gt;&#xA;" OwnerUserId="1561" LastActivityDate="2012-06-26T17:35:51.007" Title="Deconvolving the measurement system from the system response" Tags="|system-identification|measurement|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2706" PostTypeId="2" ParentId="2705" CreationDate="2012-06-24T01:06:57.080" Score="13" Body="&lt;p&gt;Sorry for the long winded answer, but making a good acoustic measurement is hard. Here are some of the steps involved (and at some point, we'll actually get to the direct answer of your question).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you have to make sure that the system you are measuring is actual linear and time invariant (otherwise you can't deconvolve). This can be tricky on a PC if you use regular sound card drivers. These will route any signals through the Windows Kernel Mixer which frequently applies sample rate conversion and yanks buffers around in time in non- deterministic ways.I strongly recommend bypassing the Kernel mixer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you need to determine the length of the impulse of your system. A good estimate is the reverb time of the room that you are measuring. It's most convenient to choose a power of 2; for most rooms this will 16384 or 32768 at 44.1kHz or 48 kHz sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third, create a periodic excitation of that length. This could either be a log sweep or (better) a pseudo random noise. The spectrum of the noise should be chosen so you get roughly constant signal to noise ratio in the frequency range of interest. That depends on the transfer function and on the background noise spectrum. If you don't know either of those yet, pink is a good start. Let's call one period of this signal x[n].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourth, wire up your system so that the left channel from your D/A goes into the loudspeaker AND into the left channel of your A/D. Wire the microphone into the right channel of the A/D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fifth, start the excitation (loop it or create a wave file with many repetitions of your noise signal). Carefully monitor all levels: make sure that the A/D sits at about 10 dB below clipping. Make sure the microphone pre-amp sits at about 10 dB below clipping. Make sure the power amp is not clipping and that the loudspeaker is not over driven.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sixth, make sure that the room is as quiet as it can be. Close doors and windows. Shut off most things with a fan including any HVAC system. Evict all other people from the premises. If there are any ground loops, use isolation transformers and ground lifts as necessary. A good way of checking noise is to hook up a headphone amp to the mic output and listen to it through headsets. Any noise, hum, or other artifact that you can hear will also show up in the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seventh, do the actual acquisition. Collect 12 periods with the excitation signal running. Visually inspect the results for something unusual (gaps, parts missing, drop outs, etc.)  Throw the first two periods away. Calculate the average over the other 10. Let's call the left channel y[n] (sound card) and the right channel m[n] (microphone).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eighth, calculate the Fourier Transform of y[n]. This should be fairly flat with no zeros or areas of very low energy. This may not be the case as most sound cards have AC coupled inputs, i.e. there is some high pass filter and the value at DC might be very low.  Similarly there may also likely be an anti aliasing filter, so again you may have low energy or just noise at very high frequencies. If can you manually fix that (by adding a small amount of broadband energy), then do. If the spectrum is very flat in the frequency area of interest, you can simply replace it with a properly delayed unit impulse. If none of these will work, things get more complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ninth: deconvolute. Your transfer function can simply be calculated as $$H(\omega) = \frac{\Im \left \{ m(t) \right \}}{\Im \left \{ y(t) \right \}}$$&#xA;where $\Im \{ \}$ denotes the Fourier transform. This is direct spectral division without any zero padding or windowing. Since we are doing circular coherent acquisition we are also doing circular deconvolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation shows the problem discussed in step 8. We are dividing by a measured spectrum. Any zeros or areas of low energy or high noise in the divisor spectrum will result in garbage in the resulting transfer function. The results at the &quot;good&quot; frequencies will still be okay but you could not use it to, for example, calculate an impulse response. A simplified version would be to just divide by the excitation signal, i.e. &#xA;$$H(\omega) = \frac{\Im \left \{ m(t) \right \}}{\Im \left \{ x(t) \right \}}$$ and choose the excitation so that there are no zeros in the spectrum. However this will not allow you to deconvolve the D/A and A/D system response and it will also lose any absolute delay information. In many cases this is actually acceptable and many commercial measurement system do just that, so it depends on your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tenth: verify that your measurement is good. Various tests should be performed:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Measure a few times and make sure that the result is the same.&lt;/li&gt;&#xA;&lt;li&gt;Measure with the loudspeaker muted. This will give you a good estimate of the background noise spectrum. As a rule of thumb, you need at least 10 dB signal to noise ratio at all frequencies of interest.&lt;/li&gt;&#xA;&lt;li&gt;Linearity test: measure with half the excitation gain and confirm that the resulting transfer function is the same.&lt;/li&gt;&#xA;&lt;li&gt;A useful inline noise test is the following: Take your 10 periods and average 5 times over 2 periods each, then do a Fourier transform over 2*N samples. If your signal is noise free then all the odd bins should be zero. You can directly estimate the signal to noise ratio at any frequency as X{2*N+1}/X{2*N}&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastEditorUserId="1530" LastEditDate="2012-06-26T17:35:51.007" LastActivityDate="2012-06-26T17:35:51.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2707" PostTypeId="2" ParentId="2694" CreationDate="2012-06-24T01:31:41.963" Score="13" Body="&lt;p&gt;I think your main problem isn't how to parallel the algorithm (which actually can be done) but it's numeric precision. &#xA;FFTs of a size that large are numerically quite tricky. The FFT coefficients are of the form&#xA;$e^{-j\cdot 2\cdot \pi \cdot \frac{k }{N}}$ and if N is very large the coefficient calculation gets noisy. Lets say you have $N = 2^{40}$ and you use 64 bit double precision arithmetic. The first 1000 coefficients have a real part that's exactly unity (although it shouldn't be that way) so you will need higher precision math, which is very inefficient and cumbersome to use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will also amass lots of rounding and truncation errors as the sheer number of operations that go into a single output number is very large too. Due to the &quot;every output depends on every input&quot; nature of the FFT, error propagation is rampant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of an easy way to work around that. Your request is an unusual one. Most applications that do spectral analysis of large data sets do a running analysis where you don't have that problem. Perhaps if you can describe your application and it's constraints a but more, we can point you to a more suitable solution.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-06-24T01:31:41.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2708" PostTypeId="1" AcceptedAnswerId="2710" CreationDate="2012-06-24T09:57:34.340" Score="11" ViewCount="11216" Body="&lt;p&gt;I'm writing a program that averages the user's weight across different days. I'm planning to use a 5-point moving-average (current day, two before and two after). Sometimes, a data point is missing for 1-2 days. How are these cases usually handled?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(if there's a better low-pass filter I could use, I'd love suggestions)&lt;/p&gt;&#xA;" OwnerUserId="1440" LastActivityDate="2020-12-26T21:31:23.257" Title="How should a moving average handle missing data points?" Tags="|lowpass-filter|moving-average|" AnswerCount="5" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2709" PostTypeId="2" ParentId="1960" CreationDate="2012-06-24T17:44:26.593" Score="2" Body="&lt;p&gt;To summarize you have two distributions with unknown parameters and a measurement which may have originated from either stochastic process.  This is typically referred to as a data association problem and it is very common, and widely studied, within the tracking community.  You might consider using a Probability Data Association Filter (PDAF) or Multi-Hypothesis Tracking (MHT) algorithm.  This should provide you with estimates of the mean and variance for each distribution.&lt;br&gt;&#xA;   Alternatively, since your noise is white and Gaussian, the ML, MAP and MMSE are all equivalent and can be found by minimizing the mean squared error (cost function), as is effectively described by the previous response.  I would use a dynamic programming approach to find the minimum of the cost function.  This should be less complex (computationally) than the previously described EM/clustering methods.&#xA;   One more comment: the PDAF is recursive.  Given the simple signal model it should work very effectively and at what I expect is a fraction of the computational complexity of the EM algorithm.&#xA;Good luck, &#xA;-B&lt;/p&gt;&#xA;" OwnerUserId="1566" LastActivityDate="2012-06-24T17:44:26.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2710" PostTypeId="2" ParentId="2708" CreationDate="2012-06-24T18:08:45.817" Score="4" Body="&lt;p&gt;As a general impression, regression would work better in automatically fitting the missing points rather than a moving average filter you have chosen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use an AR (auto regressive filter) or ARMA filter - you can have a predicted value of a sample output based on past inputs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat X[i] = \sum { \omega_{k}*x[i-1-k]} + \eta&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\hat X[i]$ is the predicted value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically in your case, say you know the weight of the person has a specific range $X_{max}, X_{min}$. Now if you don't have $x[i-1]$ value - apply two different substitutions - one with Min and one with Max and based on the available model you will have two extreme case results for $\hat X[i]$ and you can choose something between them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are various other alternatives - you can keep &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat X[i] = X[i-1]$$ or&#xA;$$\hat X[i] = \text {Long term sample average of X }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially it is a game of prediction of that said value and continue using it as a signal. Of course, prediction won't be same as an original sample but that't the price you pay for not having data. &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2012-06-24T18:08:45.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2711" PostTypeId="1" CreationDate="2012-06-24T21:58:23.177" Score="9" ViewCount="12199" Body="&lt;p&gt;In my slides about signal processing, there is one that mentions the same thing as the beginning of &lt;a href=&quot;https://dsp.stackexchange.com/a/2342/1524&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/a/2688/1524&quot;&gt;this&lt;/a&gt; answer, namely that the Fourier transform of a signal, squared is the power spectrum density of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;http://videolectures.net/mda07_schloegl_eegc/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; talk, it is mentioned that coherence is calculated by dividing the squared cross-spectrum by the product of the two auto-spectra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the formula in my slides divides the squared cross-spectrum by the product of the formula of our previously seen PSD and another PSD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, is autospectrum the same as PSD? I can find a lot of information about PSD, but not on autospectrum.&lt;/p&gt;&#xA;" OwnerUserId="1524" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-06-25T23:40:24.523" Title="Is autospectrum the same as power spectrum density?" Tags="|coherence|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2712" PostTypeId="2" ParentId="2615" CreationDate="2012-06-25T00:53:37.493" Score="1" Body="&lt;p&gt;If the problem that you are actually addresing is audio/speech signal segmentation and distinguishing between the speech and music, see:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.sersc.org/journals/IJSIP/vol5_no1/4.pdf&quot; rel=&quot;nofollow&quot;&gt;Theodorou T., Mporas I. and Fakotakis N., &quot;Automatic Sound Classification of Radio Broadcast News&quot;, Int. J. Sig. Proc., Image Proc. Pattern Recognition, 5(1), 2012&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could be wrong on this but Praat seems to be not so usefull for polyphonic music analysis, except if augmented with some additional pre-filtering for the purpose of segmentation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4579953&amp;amp;isnumber=4579840&quot; rel=&quot;nofollow&quot;&gt;Makarand Ramesh, V.; Sahasrabuddhe, H.V.; , &quot;Exploring Data Analysis in Music Using Tool Praat,&quot; Emerging Trends in Engineering and Technology, 2008. First International Conference on, pp.508-509&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1567" LastEditorUserId="590" LastEditDate="2012-06-27T13:32:59.550" LastActivityDate="2012-06-27T13:32:59.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2713" PostTypeId="1" AcceptedAnswerId="2714" CreationDate="2012-06-25T16:50:57.960" Score="2" ViewCount="75" Body="&lt;p&gt;So I have groups of (x,y) coordinates that I'm using to draw lines.  The lines aren't perfectly straight but they are connected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a Cartesian plane the middle would be called the origin, &lt;em&gt;but&lt;/em&gt; I'm working with a digital image processing program, so the coordinate (0,0) is at the top left of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I'm trying to do is translate all of the coordinates in each line (group of coordinates) the same distance, so that the first point in each line starts at the &lt;em&gt;middle&lt;/em&gt; of the image.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of what I want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jAM92.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k9EVU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1569" LastEditorUserId="1569" LastEditDate="2012-06-25T19:47:14.407" LastActivityDate="2012-06-25T19:56:40.747" Title="Path Center Correction" Tags="|image-processing|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2714" PostTypeId="2" ParentId="2713" CreationDate="2012-06-25T17:47:55.237" Score="2" Body="&lt;p&gt;1) Group of points: $\{ (x_{i},y_{i})\}_{i=1..n}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Centroid of the group of points: $\left(\frac{1}{n} \sum^{n}_{i=1}x_{i},\frac{1}{n}\sum^{n}_{i=1}y_{i} \right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Center of the image: $(x_{c},y_{c})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Translation of arbitrary point $(x,y)$ to the center $(x_{c},y_{c})$: $t(x,y)=(x_{c}-x,y_{c}-y)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that $(x,y)+t(x,y) = (x_{c},y_{c})$ ...&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now just substitute 2) in 4) and you have your formula to translate the centroid to the image center.&lt;/strong&gt; Right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure that I am missing something here - the translation distance obviously cannot be kept the same for all points. Didn't you mean another type of transform (maybe scaling have to be included as well) ?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-06-25T19:56:40.747" LastActivityDate="2012-06-25T19:56:40.747" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2715" PostTypeId="1" CreationDate="2012-06-25T18:23:11.180" Score="8" ViewCount="1235" Body="&lt;p&gt;In my never-ending quest to identify snores, I've found that &quot;spectral flatness&quot; seems to be a fair measure of signal &quot;quality&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm computing spectral flatness as the geometric mean of the FFT power $(R*2 + I*2)$ data points divided by the arithmetic mean of the same points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then (a little twist here) am computing the running (over 50 frames) arithmetic mean and standard deviation of the spectral flatness and computing a &quot;normalized&quot; standard deviation as the running standard deviation divided by the running mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my samples I find that this metric is greater than about $0.2$ (ranging up to $0.5$ or so) when audio is &quot;good&quot; (ie, I have reliable tracking of the breathing/snoring sounds of a sleeping subject) and it generally slips down below $0.2$ when audio is &quot;in the mud&quot;.  (I can improve on this discrimination somewhat by using a threshold that moves with other factors, but that's presumably a different topic.)  I also observe that the measure goes over $1.0$ when there's substantial background noise (eg, someone enters the room and rustles about).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my basic question is:  Is there a name (beyond &quot;normalized standard deviation of spectral flatness&quot;) for what I'm measuring, and can anyone offer a conceptual explanation of what the metric &quot;means&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I've tried a dozen other metrics for signal &quot;quality&quot;, and this one seems to be the best to date.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Added:&lt;/strong&gt;  I probably should admit that I don't have a particularly good conceptual handle on what simple spectral flatness is measuring (just the &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;nofollow&quot;&gt;Wikipedia article&lt;/a&gt;), so any further explanation of that would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="1629" LastEditDate="2016-09-11T08:36:33.333" LastActivityDate="2016-09-11T08:36:33.333" Title="Standard deviation of spectral flatness -- so what am I measuring, conceptually?" Tags="|fft|frequency-spectrum|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2716" PostTypeId="2" ParentId="2711" CreationDate="2012-06-25T23:40:24.523" Score="3" Body="&lt;p&gt;This may be just a matter of semantics. Indeed it is true that &quot;The Fourier Transform of the auto correlation x[n] is identical to the magnitude squared of the Fourier Transform of x[n]&quot;. This is just a mathematical identity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could call that the power spectrum density (PSD) but in most practical applications any actual PSD computation will involve some sort of framing and windowing. The choice of framing and windowing will impact the result (and it's a complicated trade off), so there isn't really one clear and unambiguous definition of PSD. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can still use the mathematical identity but it needs to be properly adjust with respect to framing, windowing and circular vs. linear convolution.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-06-25T23:40:24.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2717" PostTypeId="2" ParentId="2476" CreationDate="2012-06-26T08:45:04.910" Score="5" Body="&lt;p&gt;You were looking for scholarly articles, I am surprised you did not find anything. Here's what a quick search through Google Scholar with keywords &lt;code&gt;path stroke recognition&lt;/code&gt; and &lt;code&gt;handwriting stroke recognition&lt;/code&gt; got me:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=824821&quot; rel=&quot;noreferrer&quot;&gt;Plamondon, R.: Online and off-line handwriting recognition: a comprehensive survey&lt;/a&gt;&lt;/strong&gt;: Looks like a good place to start. An explanation of digital handwriting representation, and handwriting recognition techniques (with and without the trajectory data of the stroke)&lt;/p&gt;&#xA;&lt;p&gt;Does not deal specifically with Chinese characters, but I think it might be applicable.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/0031320382900322&quot; rel=&quot;noreferrer&quot;&gt;Hideo Ogawa, Keiji Taniguchi: Thinning and stroke segmentation for handwritten Chinese character recognition&lt;/a&gt;&lt;/strong&gt;: It looks quite old, but is dealing with stroke segmentation, or to quote &lt;em&gt;&amp;quot;a way of breaking down a character to a set of consecutive partial strokes&amp;quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It is the reverse of what you want (you said you already have info about strokes), but maybe understanding the stroke representation might help you get on the right way.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=479986&amp;amp;tag=1&quot; rel=&quot;noreferrer&quot;&gt;Koschinski, M.: Segmentation and recognition of symbols within handwritten mathematical expressions&lt;/a&gt;&lt;/strong&gt;: Again, not Chinese characters, but mathematical (which is still more &amp;quot;exotic&amp;quot; than regular text). Nice because it proposed a technique based on probabilities.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0031320300001655&quot; rel=&quot;noreferrer&quot;&gt;Cheng-Lin Liu, In-Jung Kim, Jin H. Kim: Model-based stroke extraction and matching for handwritten Chinese character recognition&lt;/a&gt;&lt;/strong&gt;: I think the title says it all. Looks like exactly what you want, and promises promising results.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;One more thing to add: The most recent reference in the above bunch is &lt;em&gt;as old as 2000&lt;/em&gt;. That indicates that what you want to do is probably a well-researched area, with tried out state-of-the-art techniques. It should not have been hard to look for reference material.&lt;/p&gt;&#xA;&lt;p&gt;Just to clarify, I did not actually &lt;em&gt;read&lt;/em&gt; any of these articles. I just did my usual preliminary research step: go to article databases (google scholar, mendeley, ieeexplore...), type in a few keywords. Open the ones with promising titles, close one with completely uninteresting abstracts. Read the remaining abstracts more carefully, and select the ones that seem relevant. Having said this, not all the articles I proposed might be relevant, but judging from experience, they most probably are.&lt;/p&gt;&#xA;&lt;p&gt;I hope this helps. Also, &lt;em&gt;if you have done any research in the meantime, please edit it in your question and share with the community&lt;/em&gt;. It looks like an interesting topic.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-06-26T08:45:04.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2718" PostTypeId="1" AcceptedAnswerId="2724" CreationDate="2012-06-26T13:44:02.337" Score="4" ViewCount="294" Body="&lt;p&gt;I have a warping grid, that has to be applied to an image. When I apply the grid, I get the results I expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I want to apply the same grid to the same image, but the image is modified in the following way: it is rotated 270 degrees counterclockwise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The grid is stored in memory as an array of points. It is [-1, -1] - [1, 1] normalized. I am trying to rotate the whole thing around the origin, that is [0, 0] id est the center of the image. Also, I am trying to rotate in discrete steps of 90 degrees.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;P1 P2 P3 &#xA;&#xA;P4 P5 P6&#xA;&#xA;P7 P8 P9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These are destination coordinates of the points in the image. For example, the lower right corner of the input image has coordinates of [1,1]. In the output image, this point is moved to [P9.x, P9.y] (a.k.a. forward mapping).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I transpose the matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;P1 P4 P7&#xA;&#xA;P2 P5 P8&#xA;&#xA;P3 P6 P9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I apply to every point the transformation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = y'&#xA;&#xA;y = -x',&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where ' denotes old coordinate and lack of prime denotes new coordinate. I apply the derived grid to the rotate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I do not get the expected warp. This task seemed incredibly simple to me, but I find myself struggling with the strange behaviour for a third day. Could someone point out my mistake or a procedure to get things right?&lt;/p&gt;&#xA;" OwnerUserId="1575" LastEditorUserId="1575" LastEditDate="2012-06-27T12:49:40.310" LastActivityDate="2012-06-28T07:32:47.343" Title="How do I rotate a warping grid without changing the warped image's orientation?" Tags="|image-processing|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2719" PostTypeId="1" CreationDate="2012-06-26T14:35:08.393" Score="1" ViewCount="434" Body="&lt;p&gt;This questions is in conjugation with this one &lt;a href=&quot;https://dsp.stackexchange.com/questions/2523/connecting-edges-detected-by-an-edge-detector/&quot;&gt;here&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Canny edge detector gives ids of pixels in an image. Not the locations of the edges. To be specific, after all it should be an edge between two pixels. Any implementation that actually gives arcs not pixels?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One solution i can make is that if i have a pixel, i can simply take the bottom edge and right edge for consistency but it might disconnect my feature. &#xA;Edit: Edge is referred to an arc between 2 pixels. &#xA;Something smarter?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1451" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-07-02T08:30:33.747" Title="Edge detection gives pixel ids, why?" Tags="|matlab|edge-detection|canny-edge-detector|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2720" PostTypeId="2" ParentId="2715" CreationDate="2012-06-26T18:48:21.757" Score="3" Body="&lt;p&gt;Any reliable consistent  difference in the statistics of your signal (or some function of your signal, such as its spectrum) and the noise in which it your signal is embedded can be used to estimate a probability of one versus the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You seem to have randomly found (stumbled upon) one of a likely infinite number of ways to characterize signal spectrum shape which differentiate your desired signal from stuff more like white noise or impulse spikes.  Stumbling upon a random possible solution dies not invalidate it (that's one basis of evolutionary/genetic programming).  But how robust a measure you've found is left as an experimental exercise.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-06-26T18:48:21.757" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2721" PostTypeId="1" AcceptedAnswerId="2742" CreationDate="2012-06-26T19:47:21.760" Score="3" ViewCount="1180" Body="&lt;p&gt;Consider the simple first-order low pass filter, described by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\tau \frac{d \mathcal{O}}{dt} + \mathcal{O}(t)=\mathcal{I}(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considered as a linear system (ie $\mathcal{L} \mathcal{O} = \mathcal{I}$), $\mathcal{L}$ has transfer function $\frac{1}{1 + i \omega \tau}$ (up to maybe some constants, minus signs etc etc depending on convention). By transfer function, I mean $\tilde{R}(k)$ such that if $\tilde{\mathcal{I}}$ denotes the Fourier/Laplace transform of the input, then $\tilde{\mathcal{O}}(t) = \tilde{R}(t)\tilde{\mathcal{I}}(t)$. Questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is the transfer function the 'same thing' as the frequency response? The reference textbook I have (Signals and Systems by Oppenheim &amp;amp; Willsky) talks of the frequency response of the 1st order LPF $H(i\omega) = \frac{1}{1 +i \omega \tau}$ which as far as I can tell amounts to something very similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If we solve the LPF ODE for a sinusoidal input $sin(\omega t)$, then we get an expression for the output amplitude $A(\omega) = \frac{1}{\sqrt{1+\omega^2 \tau^2}}$. How is this related to the transfer function/frequency response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supplementary information/question: I'm actually a mathematics student in the situation of having to learn a lot of signals processing very quickly this summer. Are there any textbooks written out there which explain signals and systems in the perspective of a maths student? As far as I can tell, most books seem to pitched towards engineers (and also use $j$ instead of $i$), and are a little different to what I'm used to - I don't want to learn lots of things twice from two different perspectives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for you time.&lt;/p&gt;&#xA;" OwnerUserId="1576" LastActivityDate="2012-06-29T14:48:58.010" Title="Amplitude vs Frequency Response" Tags="|transfer-function|frequency-response|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2722" PostTypeId="1" AcceptedAnswerId="2749" CreationDate="2012-06-27T07:19:00.363" Score="1" ViewCount="1565" Body="&lt;p&gt;I need help understanding how/what does it mean to &quot;turn&quot; a transformation parameters into a vote.&#xA;I know how to recover the transformation parameters (in my case: 6 DOF), but how this turns into a vote in 6D (??) space ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You !&lt;/p&gt;&#xA;" OwnerUserId="900" LastActivityDate="2012-06-30T19:33:24.700" Title="hough voting, turning transformation into a vote" Tags="|computer-vision|hough-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2723" PostTypeId="2" ParentId="2718" CreationDate="2012-06-27T11:34:44.150" Score="1" Body="&lt;p&gt;After three and a half days of cursing, a couple of beers with a friend helped solve the problem. My mistake was that the reordering of points needed to be not exactly transpose, but close. So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To rotate a grid 90 degrees counter-clockwise:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;transpose the grid and reflect it along the horizontal central line&lt;/li&gt;&#xA;&lt;li&gt;apply the transformation &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;x = y'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y = -x',&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where primes denote old coordinates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To rotate a grid 180 degrees&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;reflect the grid around its horizontal and around it's vertical axis&lt;/li&gt;&#xA;&lt;li&gt;apply the transformation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;x = - x'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y = - y'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To rotate a grid 270 degrees&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;transpose the grid and reflect it along the vertical central line&lt;/li&gt;&#xA;&lt;li&gt;apply the transformation &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;x = - y'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y = x'&lt;/p&gt;&#xA;" OwnerUserId="1575" LastActivityDate="2012-06-27T11:34:44.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2724" PostTypeId="2" ParentId="2718" CreationDate="2012-06-27T12:36:53.010" Score="1" Body="&lt;p&gt;In two dimensions, to rotate a point by a certain angle you need to multiply that point by a rotation matrix of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;\left[\begin{array}{c}x' \\y' \end{array}\right]&#xA;= &#xA;\left[\begin{array}{cc}\cos\theta &amp;amp; -\sin\theta \\\sin\theta &amp;amp; \cos\theta\end{array}\right]&#xA;\left[\begin{array}{c}x \\y \end{array}\right]&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $(x, y)$ is the old coordinate, $(x', y')$ is the new coordinate, and $\theta$ is the angle of (counterclockwise) rotation you want to apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, for a rotation of 270 degrees, the matrix you apply is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;\left[\begin{array}{c}x' \\y' \end{array}\right]&#xA;= &#xA;\left[\begin{array}{cc}\cos(270)&amp;amp; -\sin(270) \\\sin(270) &amp;amp; \cos(270)\end{array}\right]\left[\begin{array}{c}x \\y \end{array}\right]&#xA;= \left[\begin{array}{cc}0&amp;amp; 1 \\-1 &amp;amp; 0\end{array}\right]\left[\begin{array}{c}x \\y \end{array}\right]&#xA;= \left[\begin{array}{c}y \\-x \end{array}\right]&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a comprehensive &lt;a href=&quot;http://en.wikipedia.org/wiki/Rotation_matrix#In_two_dimensions&quot; rel=&quot;nofollow&quot;&gt;wikipedia page on rotation matrices&lt;/a&gt;, explaining them in more detail, extending them to 3D, and sumarising some of their properties.&lt;/p&gt;&#xA;" OwnerUserId="590" LastEditorUserId="590" LastEditDate="2012-06-28T07:32:47.343" LastActivityDate="2012-06-28T07:32:47.343" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2725" PostTypeId="1" AcceptedAnswerId="30723" CreationDate="2012-06-27T14:33:01.197" Score="10" ViewCount="7191" Body="&lt;p&gt;I basicaly understood how the Rubberband/Baseline-correction works.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The given spectrum is divided into (N) ranges.&lt;/li&gt;&#xA;&lt;li&gt;The lowest points in every range are determined.&lt;/li&gt;&#xA;&lt;li&gt;The initial baseline is built out of those points.&lt;/li&gt;&#xA;&lt;li&gt;Now all the points on the spectrum are drawn down by the difference between the lowest point in the current range and the lowest point on the baseline.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are some nuances, though, that I do not know how to handle. E.g., what if one of the points is exactly on the border between two ranges, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus, I have to be able to prove that the algorithm that I am writing is a solid one and can be referenced by other works or scientific papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could give me some reference I would be very pleased.&lt;/p&gt;&#xA;" OwnerUserId="1580" LastEditorUserId="19728" LastEditDate="2020-07-28T16:41:43.327" LastActivityDate="2020-10-07T05:30:13.270" Title="How to perform a Rubberband-Correction on spectroscopic data?" Tags="|frequency-spectrum|python|preprocessing|r|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2727" PostTypeId="2" ParentId="2722" CreationDate="2012-06-27T23:46:03.607" Score="1" Body="&lt;p&gt;A vote is just an increment in an array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0, 0, 0, 0, 0, 0;&#xA; 0, 0, 1, 0, 0, 0;&#xA; 0, 0, 0, 0, 0, 0;&#xA; 0, 0, 0, 0, 0, 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would be a vote for (2,3). You can extend that to however many dimensions you need&lt;/p&gt;&#xA;" OwnerUserId="1156" LastActivityDate="2012-06-27T23:46:03.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2728" PostTypeId="1" CreationDate="2012-06-28T00:16:37.513" Score="4" ViewCount="326" Body="&lt;p&gt;Again, my &lt;a href=&quot;https://dsp.stackexchange.com/q/1828/447&quot;&gt;snoring detector&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I look at the rhythm of snoring vs the rhythm of talking in terms of peaks/events (which would represent snores) per hour, there's not much difference -- they range from roughly 500 to 900 per hour.  But it occurred to me that perhaps there's a significant difference in the &lt;em&gt;regularity&lt;/em&gt; of the rhythm.  In particular, I suspect that talking would have a more irregular rhythm than snoring, and I was wondering what might be some ways to characterize that difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is a bit different from tempo/beat detection in music in that there is no master clock, and individual &quot;beats&quot; are not &quot;skipped&quot; but elongated, so, eg, an autocorrelation would likely not reveal much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest approach would be to measure standard deviation of the event intervals, but I'm unsure to what extent that would discriminate between apneic breathing (snore, snore, snore, pause, snore) vs simply irregular intervals.  And, as you know, my statistics background is weak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other suggestions?  (Take as a given that I have already discriminated the &quot;events&quot; and can produce a train of intervals, vs deriving rhythm from raw data.)&lt;/p&gt;&#xA;" OwnerUserId="447" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-06-28T17:08:44.630" Title="How to characterize the regularity of rhythm?" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2730" PostTypeId="1" CreationDate="2012-06-28T10:11:23.290" Score="4" ViewCount="1722" Body="&lt;p&gt;I am reading a book for image processing algorithms (&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470147083&quot; rel=&quot;nofollow&quot;&gt;Andreas Koschan, Mongi Abidi: Digital Color Image Processing&lt;/a&gt;) and for the contrast algorithm it says that I can either go &lt;code&gt;RGB-&amp;gt;HSL or RGB-&amp;gt;HSI&lt;/code&gt; first and than apply a contrast technique for grayscale images, on the lightness component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it gives this formula only, not other formulas for color conversion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$L(x,y) = 0.299*R(x,y) + 0.587*G(x,y) + 0.114*B(x,y)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This formula is neither for the L in HSL, neither for the I in HSI and that is what confuses me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you explain what this formula stands for, and maybe help with the appropriate conversion formulas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1587" LastEditorUserId="1473" LastEditDate="2012-06-29T10:57:25.923" LastActivityDate="2012-06-29T10:57:25.923" Title="Confused about HSI and HSL color spaces" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2731" PostTypeId="2" ParentId="2730" CreationDate="2012-06-28T16:51:44.497" Score="5" Body="&lt;p&gt;L(x,y) here is a function for luma, a non-linear approximation of luminance. As you can see, it's the weighted sum of the R'G'B' values. The prime symbol (') indicates that they have been &lt;a href=&quot;http://en.wikipedia.org/wiki/Gamma_correction&quot; rel=&quot;noreferrer&quot;&gt;gamma-corrected&lt;/a&gt; for perceptual uniformity. The coefficients used in this case are standardized by ITU-R Recommendation BT.601. Other standards, such as BT.709 (which may be preferred for its higher accuracy), exist as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;http://en.wikipedia.org/wiki/HSL_and_HSV#Lightness&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/HSL_and_HSV#Lightness&lt;/a&gt;. I can't answer whether you can use luma and still say that it's a component of HSL or HSI. If the author of the book gave you that formula, I suspect you can assume so, at least for that text.&lt;/p&gt;&#xA;" OwnerUserId="1297" LastActivityDate="2012-06-28T16:51:44.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2732" PostTypeId="2" ParentId="2730" CreationDate="2012-06-28T16:57:09.227" Score="2" Body="&lt;p&gt;There are many ways of RGB to Grayscale conversion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The HSL/HSB/HSI/HSV models can be used, but you need only the intensity component, so the color conversion is not necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a &lt;a href=&quot;http://en.wikipedia.org/wiki/HSL_and_HSV&quot; rel=&quot;nofollow&quot;&gt;Wikipedia article&lt;/a&gt; that explains the intensity component in HSL and HSV models. It is basically the axis connecting vertices of RGB cube corresponding to black and white colors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weighted average formula you wrote provides gray values that better correspond to human vision response (you can see that green has greatest weight, then red and then blue - the values correspond to human sensitivity to the RGB primaries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need extra accuracy, be careful about which RGB you use. &lt;a href=&quot;http://en.wikipedia.org/wiki/SRGB&quot; rel=&quot;nofollow&quot;&gt;sRGB&lt;/a&gt; is used mostly and it have a gamma value of 2.2, so the intensities are non-linear. When with &quot;advanced&quot; model such as Lab, the L component comes from CIE XYZ model, where the XYZ is linearized RGB. So the conversion to XYZ or Lab, extracting luminance and then converting back to non-linear sRGB is the most accurate way, but computationally most expensive. (My description is maybe not much accurate, please see corresponding articles about color models for more information).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-06-28T16:57:09.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2733" PostTypeId="2" ParentId="2728" CreationDate="2012-06-28T17:08:44.630" Score="1" Body="&lt;p&gt;You have already found train of intervals between the events. What you are interested in is a respresentation of that in time. I would suggest, from my experience, to run a sliding window differential filter, with some low pass averaging filter at the output, that will give you the rate of changes in time. In this way you will get the rate of changes as they progress in time, which is most likely what you actually need. Yes, standard deviation may be done, but that is just one number, as you said, and that is not sufficient.&#xA;One simpler method will be to use just a sliding average window that averages train of intervals and gives that as a result.&#xA;With this, youy may, at the end, postprocess obtained result, by finding max. min. and average values, as the informative, yet simple measurements of the signal that has been analyzed. &#xA;If needed, you may get more complex solutions, involving cyclostationary data analysis. In a nutshell, finding some statistics functions, (sorry it cannot be avoided if you decide to go this way): for example mean, variance, cyclic correlation function, cyclic power spectral density etc. This will lead to a rate detector, with various outputs that characterize the signal rate changes (and much much more). I hope that this helps.&lt;/p&gt;&#xA;" OwnerUserId="1567" LastActivityDate="2012-06-28T17:08:44.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2735" PostTypeId="2" ParentId="2659" CreationDate="2012-06-29T07:05:58.050" Score="4" Body="&lt;p&gt;You say that you have the &lt;strong&gt;extrinsic parameters&lt;/strong&gt;. If that is true, then you already have the &lt;strong&gt;pose&lt;/strong&gt;, thus, the &lt;strong&gt;position&lt;/strong&gt; and &lt;strong&gt;rotation&lt;/strong&gt; (There is usually some confusion on the topic, so check this &lt;a href=&quot;https://dsp.stackexchange.com/a/2737/1473&quot;&gt;answer&lt;/a&gt; to clarify things.). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extrinsic parameters matrix is the same as pose matrix, a $3x4$ matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Pose = Extrinsics = \begin{bmatrix} R_{11}&amp;amp;R_{12}&amp;amp;R_{13}&amp;amp;T_x\\R_{21}&amp;amp;R_{22}&amp;amp;R_{23}&amp;amp;T_y\\R_{31}&amp;amp;R_{32}&amp;amp;R_{33}&amp;amp;T_z \end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Geting translation is trivial, if you want Euler angles from the rotation matrix then you just need a conversion. Have a look at this &lt;a href=&quot;http://gregslabaugh.name/publications/euler.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;page&lt;/a&gt; for conversions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is very common the use of quaternions too. Converting a matrix to a quaterion is easy, and then getting angles from a quaternion is easy too. I use &lt;a href=&quot;http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;euaclideanspace&lt;/a&gt; for this kind of mathematical issues with 3D transformations.&lt;/p&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-06-29T09:53:51.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2736" PostTypeId="1" CreationDate="2012-06-29T07:31:42.737" Score="25" ViewCount="54132" Body="&lt;p&gt;I have been working on the topic of &lt;strong&gt;camera pose estimation&lt;/strong&gt; for augmented reality and visual tracking applications for a while and I think that although there is a lot of detailed information on the task, there are still a lot of confussions and missunderstandings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think next questions deserve a detailed step by step answer.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What are camera intrinsics?&lt;/li&gt;&#xA;&lt;li&gt;What are camera extrinsics?&lt;/li&gt;&#xA;&lt;li&gt;How do I compute homography from a planar marker?&lt;/li&gt;&#xA;&lt;li&gt;If I have homography how can I get the camera pose?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="1473" LastEditDate="2012-06-29T16:48:04.053" LastActivityDate="2017-06-23T08:33:16.517" Title="Step by Step Camera Pose Estimation for Visual Tracking and Planar Markers" Tags="|computer-vision|homography|camera-pose|visual-tracking|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2737" PostTypeId="2" ParentId="2736" CreationDate="2012-06-29T07:43:59.000" Score="22" Body="&lt;p&gt;It is important to understand that the only problem here is to obtain the extrinsic parameters. Camera intrinsics can be measured off-line and there are lots of applications for that purpose.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What are camera intrinsics?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Camera intrinsic parameters is usually called the camera calibration matrix, &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. We can write&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$K = \begin{bmatrix}\alpha_u&amp;amp;s&amp;amp;u_0\\0&amp;amp;\alpha_v&amp;amp;v_0\\0&amp;amp;0&amp;amp;1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha_u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha_v$&lt;/span&gt;  are the scale factor in the &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; coordinate directions, and are proportional to the focal length &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; of the camera: &lt;span class=&quot;math-container&quot;&gt;$\alpha_u = k_u f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha_v = k_v f$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$k_u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k_v$&lt;/span&gt; are the number of pixels per unit distance in &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; directions.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$c=[u_0,v_0]^T$&lt;/span&gt; is called the principal point, usually the coordinates of the image center.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is the skew, only non-zero if &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; are non-perpendicular.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A camera is calibrated when intrinsics are known. This can be done easily so it is not consider a goal in computer-vision, but an off-line trivial step.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Some links:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;ftp://svr-ftp.eng.cam.ac.uk/pub/reports/mendonca_self-calibration.pdf&quot; rel=&quot;noreferrer&quot;&gt;ftp://svr-ftp.eng.cam.ac.uk/pub/reports/mendonca_self-calibration.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;What are camera extrinsics?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Camera extrinsics or External Parameters &lt;span class=&quot;math-container&quot;&gt;$[R|t]$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$3\times4$&lt;/span&gt; matrix  that corresponds to the euclidean transformation from a world coordinate system to the camera coordinate system. &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;  represents a &lt;span class=&quot;math-container&quot;&gt;$3\times3$&lt;/span&gt; rotation matrix and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; a translation.&lt;/p&gt;&#xA;&lt;p&gt;Computer-vision applications focus on estimating this matrix.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[R|t] = \begin{bmatrix} R_{11}&amp;amp;R_{12}&amp;amp;R_{13}&amp;amp;T_x\\R_{21}&amp;amp;R_{22}&amp;amp;R_{23}&amp;amp;T_y\\R_{31}&amp;amp;R_{32}&amp;amp;R_{33}&amp;amp;T_z \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How do I compute homography from a planar marker?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Homography is an homogeneaous &lt;span class=&quot;math-container&quot;&gt;$3\times3$&lt;/span&gt; matrix that relates a 3D plane and its image projection. If we have a plane &lt;span class=&quot;math-container&quot;&gt;$Z=0$&lt;/span&gt; the homography &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; that maps a point &lt;span class=&quot;math-container&quot;&gt;$M=(X,Y,0)^T$&lt;/span&gt; on to this plane and its corresponding 2D point &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; under the projection &lt;span class=&quot;math-container&quot;&gt;$P=K[R|t]$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tilde m = K \begin{bmatrix} R^1 &amp;amp; R^2 &amp;amp; R^3 &amp;amp; t \end{bmatrix} \begin{bmatrix} X \\ Y \\ 0 \\ 1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= K \begin{bmatrix}R^1&amp;amp;R^2&amp;amp;t\end{bmatrix} \begin{bmatrix} X \\ Y \\ 1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = K \begin{bmatrix}R^1 &amp;amp; R^2 &amp;amp; t \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In order to compute homography we need point pairs world-camera. If we have a planar marker, we can process an image of it to extract features and then detect those features in the scene to obtain matches.&lt;/p&gt;&#xA;&lt;p&gt;We just need 4 pairs to compute homography using Direct Linear Transform.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;If I have homography how can I get the camera pose?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The homography &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and the camera pose &lt;span class=&quot;math-container&quot;&gt;$K[R|t]$&lt;/span&gt; contain the same information and it is easy to pass from one to another. The last column of both is the translation vector. Column one &lt;span class=&quot;math-container&quot;&gt;$H^1$&lt;/span&gt; and two &lt;span class=&quot;math-container&quot;&gt;$H^2$&lt;/span&gt; of homography are also column one &lt;span class=&quot;math-container&quot;&gt;$R^1$&lt;/span&gt; and two &lt;span class=&quot;math-container&quot;&gt;$R^2$&lt;/span&gt; of camera pose matrix. It is only left column three &lt;span class=&quot;math-container&quot;&gt;$R^3$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$[R|t]$&lt;/span&gt;, and as it has to be orthogonal it can be computed as the crossproduct of columns one and two:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R^3 = R^1 \otimes R^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Due to redundancy it is necessary to normalize &lt;span class=&quot;math-container&quot;&gt;$[R|t]$&lt;/span&gt; dividing by, for example, element [3,4] of the matrix.&lt;/p&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-07-06T07:32:24.183" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2738" PostTypeId="1" CreationDate="2012-06-29T07:48:14.980" Score="10" ViewCount="1613" Body="&lt;p&gt;Can anyone suggest methods for removing the noise (indicated inside the red square) from every where in the following image, while keeping the white lines?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EW7ED.png&quot; alt=&quot;A segmented Medical Image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1613" OwnerDisplayName="crack_addict" LastEditorUserId="590" LastEditDate="2012-07-02T10:03:36.190" LastActivityDate="2013-11-07T00:52:03.307" Title="Noise removal in medical segmented image" Tags="|matlab|image-processing|opencv|" AnswerCount="4" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2739" PostTypeId="1" AcceptedAnswerId="2741" CreationDate="2012-06-29T13:02:23.677" Score="8" ViewCount="3104" Body="&lt;p&gt;I'm doing some measurements with my sound card, I have one output channel connected to one input channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then send the sound card a unit impulse, i.e. a signal 1 value followed by zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The recorded response is shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the Fourier transform of a Rect function, or LPF, will result in a Sinc function - which is what the response below seems to be.  But I'm not quite sure as to the reason for the pre-ringing in the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nHbyr.png&quot; alt=&quot;captured unit impuse&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1561" LastEditorUserId="90" LastEditDate="2012-06-29T14:46:16.230" LastActivityDate="2018-07-17T11:57:41.670" Title="Does this lowpass filter have a noncausal impulse response?" Tags="|impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2740" PostTypeId="2" ParentId="2715" CreationDate="2012-06-29T13:03:13.343" Score="4" Body="&lt;p&gt;Since you are interested in the &quot;flatness&quot; of your spectrum, in fact, you are interested in how close your signal is to a white noise (that by definition has a flat spectrum + random phases). If you step back, &lt;strong&gt;one measure would be the &quot;distance&quot; of your observation to the white noise reference&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious measure in terms of information theory is &lt;a href=&quot;http://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence&quot; rel=&quot;nofollow&quot;&gt;Kullback-Leibler divergence&lt;/a&gt;. You do not &lt;em&gt;need&lt;/em&gt; to understand every part of it, but it measures in bits (if you use log base 2) the distance between both distributions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good thing in your case is that your reference is flat, so that what remains is the &lt;strong&gt;entropy of your spectrum&lt;/strong&gt;. There are many existing implementation (for instance in &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_discrete.entropy.html&quot; rel=&quot;nofollow&quot;&gt;scipy&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you are still on the safe side: if your distribution is approximately gaussian, both measures (entropy and std) will be proportional. The entropy is however more general and more principled. As an extension, you will be able to generalize to other types of noises (1/f for instance).&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2012-06-29T13:03:13.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2741" PostTypeId="2" ParentId="2739" CreationDate="2012-06-29T13:57:51.250" Score="11" Body="&lt;p&gt;Somewhere in the chain between the sound card analog input and the samples that you're plotting, there is certainly a lowpass filter. There is likely an analog anti-aliasing filter before the ADC; in addition, there are likely one or more lowpass filters applied during resampling processes either on the card or in the operating system's audio driver stack (resulting in a stream of samples at the sample rate that you requested). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, lowpass filters often have an impulse response that resembles a $\text{sinc}$ function. When you excite a linear system with an impulse, the resulting output is just a copy of the system's impulse response (due to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution#Discrete_convolution&quot; rel=&quot;nofollow noreferrer&quot;&gt;convolution theorem&lt;/a&gt;). So, the fact that the observed signal looks like a $\text{sinc}$ function is to be expected. It doesn't sound like this surprised you, either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;: you did not observe noncausal behavior. If you had, then you should have run immediately to your local patent office. Noncausal systems are &lt;strong&gt;not&lt;/strong&gt; realizable in the real world. Remember the definition: in order for a system's response to be noncausal, its output must lead the input in time. Stated differently, the filter would start outputting its response to the input before you put the input in. Obviously, that's not going to happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's with the pre-ringing? Simple: the large spike in the middle corresponds to the center of the filter's impulse response. However, that spike does not correspond to $t=0$, the time at which the impulse was inserted into the filter. Consider the following MATLAB example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% generate a 250th order lowpass filter&#xA;b = fir1(250, 0.5);&#xA;% plot its impulse response&#xA;plot(0:250, b); grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting plot looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hIsoh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the peak in the plot is not at sample index zero. The filter has an overall delay of 125 samples (indeed, all linear-phase FIR filters have a bulk delay of $\frac{N}{2}$ samples, where $N$ is the filter order), and the pre- and post-ringing are centered about that delay. So, when you insert the impulse, you initially see very little response. As the impulse makes its way through the filter taps, the ringing ramps up to a peak at the impulse response's center, then ramps back down to zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The takeaway:&lt;/strong&gt; There is no noncausal behavior in the example you gave. It is possible to simulate noncausal filters in practice by adding enough delay, similar to the delay shown in the lowpass filter's impulse response above.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2018-07-17T11:57:41.670" LastActivityDate="2018-07-17T11:57:41.670" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2742" PostTypeId="2" ParentId="2721" CreationDate="2012-06-29T14:48:58.010" Score="1" Body="&lt;p&gt;The answer to your suplemental question: watch Openheim's free youtube digital signal processing MIT lectures, especially the lectures number 2,3,4, and you will get answers on the first question as well. The lectures are well grounded in math, and I am sure that this is the most efficient way to learn DSP on your own, from the point of view of a mathematician.&lt;/p&gt;&#xA;" OwnerUserId="1567" LastActivityDate="2012-06-29T14:48:58.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2743" PostTypeId="2" ParentId="2140" CreationDate="2012-06-29T16:13:37.313" Score="1" Body="&lt;p&gt;&lt;em&gt;The below thoughts are to be regarded as very unreliable: my knowledge of control theory is meagre at best!&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, if the system is insensitive to your test input around 100Hz will it be sensitive to control signals of that frequency when in normal operation? &lt;strong&gt;If not - model it as a first order system.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;how do I pick a signal that would give me the best responses for determining the accuracy of the transfer function?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They use impulses, steps, sines - I have no idea which of the how accurate is, though I guess that depends on the bottleneck in your experiment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For example&lt;/strong&gt;, with the slow chip heating, you can measure time with high relative precision, but you are limited by your ADC when measuring magnitudes. I would pass in a high amplitude 100Hz sin in for less than a second (the system's dominant time constant) and determine a first order model gain (time constant is already defined as 1/100 s). If the gain is small, I would neglect this pole, if it is of significant size for the problem at hand, look for a second order model (as you are doing in this question ;P)&lt;/p&gt;&#xA;" OwnerUserId="1575" LastActivityDate="2012-06-29T16:13:37.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2744" PostTypeId="1" CreationDate="2012-06-29T20:32:38.510" Score="4" ViewCount="1634" Body="&lt;p&gt;Original Question: &lt;a href=&quot;https://ux.stackexchange.com/q/23040/16006&quot;&gt;https://ux.stackexchange.com/q/23040/16006&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've only taken some basic signal analysis courses, so I might be missing some things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Purely theoretical question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What methods exist for representing audio?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What methods could be made for representing audio, more specifically &lt;em&gt;musical audio&lt;/em&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I'm aware of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Viewing the waveform (Soundcloud does this), mostly useless except for seeing &quot;loudness&quot;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Spectral analysis (&lt;a href=&quot;http://www.youtube.com/watch?v=62_0KIuoqK8&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Example&quot;&gt;Example&lt;/a&gt;), good for seeing frequency and &quot;loudness&quot;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Essentially I'm wondering if there is a way one could &quot;see&quot; the notes, beats, and so on of a song, visually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right off the top of my head I can think of displaying 3 differently colored waves over time representing treble, mid, bass in a soundcloud-like container with the section playing (or moused-over) being magnified, with the surrounding waveforms being compressed into the corners (like a wide-angle lens effect).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I don't know where this could be used, this was just born out of my frustration with current audio visualizing technology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine having a 3d graph of a spectral analysis over time (&lt;strong&gt;Ninja Edit:&lt;/strong&gt; apparently known as spectrogram) would be the &quot;best&quot; solution since you see everything but it might not be the most elegant and it might not be portable to places like soundcloud.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even current spectrum analysis is hard to decipher (Too low level for images):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rgPeD.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;FL Studio wave editor&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm essentially wondering what might work for casual users, and for people wondering ahead of time how the song will play out.&lt;/p&gt;&#xA;" OwnerUserId="1595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:32:23.990" LastActivityDate="2021-02-20T22:44:29.917" Title="What is the best way to represent audio visually? (x-post from UX)" Tags="|audio|frequency-spectrum|spectrogram|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2745" PostTypeId="2" ParentId="2256" CreationDate="2012-06-29T21:47:39.347" Score="1" Body="&lt;p&gt;As of 2012 Apple released their ALAC lossless codec to open source. Qaac has a '-A' command line option to use it.&lt;/p&gt;&#xA;" OwnerUserId="1596" LastActivityDate="2012-06-29T21:47:39.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2746" PostTypeId="2" ParentId="2744" CreationDate="2012-06-30T01:32:46.083" Score="1" Body="&lt;p&gt;What a human (or their ear-brain) perceives in sound is a psychoacoustic phenomena, and may or may not be exactly related to the actual audio as recorded.  e.g. the exact notes, beats and instruments that a human &quot;hears&quot; may be influenced by visual cues, memory of other similar music, and the musical context around the actual sound of the note in question.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-06-30T01:32:46.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2747" PostTypeId="5" CreationDate="2012-06-30T07:28:20.080" Score="0" Body="&lt;p&gt;There are many ways of tracking, like sensors, electromagnetic signals and visual tracking. Visual tracking relies on real-time images captured from a camera for detecting and tracking objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Visual tracking is widely used in augmented-reality field for natural feature tracking, fiducials and SLAM applications.&lt;/p&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="1473" LastEditDate="2012-06-30T08:23:00.030" LastActivityDate="2012-06-30T08:23:00.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2748" PostTypeId="4" CreationDate="2012-06-30T07:28:20.080" Score="0" Body="Visual-tracking is a computer-vision task that consists of detecting and tracking objects with a camera." OwnerUserId="1473" LastEditorUserId="35" LastEditDate="2012-06-30T08:23:23.773" LastActivityDate="2012-06-30T08:23:23.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2749" PostTypeId="2" ParentId="2722" CreationDate="2012-06-30T19:24:27.440" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Determine the &lt;em&gt;accuracy&lt;/em&gt; you will need for each of your six DOF. Don't use larger accuracy than you actually need, since it will get you in trouble later, when you have to find maxima in the Hough Space.&lt;/li&gt;&#xA;&lt;li&gt;Determine the &lt;em&gt;range&lt;/em&gt; of possible transformation parameters for you six DOF.&lt;/li&gt;&#xA;&lt;li&gt;Now create a six dimensional array &lt;code&gt;A&lt;/code&gt; (one dimension for each DOF) where each dimension has the size &lt;em&gt;range/accuracy&lt;/em&gt; for the current DOF. This array is your Hough Space.&lt;/li&gt;&#xA;&lt;li&gt;Now, for any given vector &lt;code&gt;v = [DOF1, DOF2, DOF3, DOF4, DOF5, DOF6]&lt;/code&gt; increment the bin in &lt;code&gt;A&lt;/code&gt; in which &lt;code&gt;v&lt;/code&gt; falls. You have now turned this single vector of transformation parameters onto a vote in the Hough Space,&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2D example&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;x&lt;/code&gt; is in the range [1;6] and &lt;code&gt;y&lt;/code&gt; also in the range [1;6]. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;x&lt;/code&gt; should be found with an accuracy of one whereas &lt;code&gt;y&lt;/code&gt; only needs an accuracy of two.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;A(x,y)&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0;0;0&lt;br&gt;&#xA;0;0;0&lt;br&gt;&#xA;&lt;strong&gt;0&lt;/strong&gt;;0;0&lt;br&gt;&#xA;0;0;0&lt;br&gt;&#xA;0;0;0&lt;br&gt;&#xA;0;0;0  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;where the bold bin corresponds to &lt;code&gt;x=[3]&lt;/code&gt; and &lt;code&gt;y=[1;2]&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you would like to cast a vote for a vector &lt;code&gt;v(x,y)=[3,1]&lt;/code&gt; you would simply increment the bold zero by one. Votes for &lt;code&gt;v(x,y)=[3,2]&lt;/code&gt; would in this case fall in the same bin, because of the reduced accuracy needed for &lt;code&gt;y&lt;/code&gt;, whereas votes for &lt;code&gt;v(x,y)=[3,3]&lt;/code&gt; would go into the bin to the right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this was helpful, and did not just confuse you more. ;)&lt;/p&gt;&#xA;" OwnerUserId="1481" LastEditorUserId="1481" LastEditDate="2012-06-30T19:33:24.700" LastActivityDate="2012-06-30T19:33:24.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2750" PostTypeId="1" AcceptedAnswerId="2751" CreationDate="2012-06-30T20:46:09.753" Score="13" ViewCount="23203" Body="&lt;p&gt;I would like to know how to go about calculating the bandwidth of: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A constant (real) sinusoidal tone&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A (real) sinusoidal pulse.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The question is as simple as that, but I am having a hard time with the concept of what exactly the bandwidth of a constant tone should be to begin with, and from there, what the bandwidth of a pulse should be. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the frequency domain, a constant real tone of frequency $f$ exists as two delta functions, located at $f$ and $-f$, but how does one go about calculating its bandwidth? &lt;/li&gt;&#xA;&lt;li&gt;Furthermore, in regards to the pulse, this is rectangular function in time, and thus a sinc in frequency domain, so would not its bandwidth simply be $\frac{1}{T}$, where $T$ is the duration of the pulse?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="293" LastEditorUserId="1629" LastEditDate="2016-05-18T15:04:18.507" LastActivityDate="2016-05-18T15:04:18.507" Title="What is the bandwidth of a (real) sinusoidal tone, and pulse?" Tags="|frequency-spectrum|frequency|bandwidth|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2751" PostTypeId="2" ParentId="2750" CreationDate="2012-06-30T22:54:22.837" Score="18" Body="&lt;p&gt;The spectrum of a continuous tone is, as you said, of the form $\delta(f-f_0) + \delta(f+f_0)$: 2 impulses at frequencies $f_0$ and $-f_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a lowpass signal, this is said to have bandwidth $f_0$ (the one-sided spectrum has components up to $f_0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a bandpass signal, it has zero bandwidth (there's nothing around the carrier frequency $f_0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you multiply the sine wave by a pulse, this makes it time-limited, and therefore frequency-unlimited. Infinite bandwidth in theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, you must define some criteria for estimating your bandwidth. Examples are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;3 dB drop (of the sinc function around $f_0$)&lt;/li&gt;&#xA;&lt;li&gt;10 dB drop&lt;/li&gt;&#xA;&lt;li&gt;drop below the noise level&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-06-30T22:54:22.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2752" PostTypeId="2" ParentId="2750" CreationDate="2012-06-30T23:27:07.183" Score="9" Body="&lt;p&gt;The bandwidth of a theoretical infinite length sinusoid of a perfectly constant frequency is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bandwidth of a time-limited sinusoidal pulse is the transform of the pulse envelope.  For a rectangular time window, that transform is a Sinc function.  The main lobe of that Sinc is about 2/t in bandwidth, but that contains only a portion of that Sinc's total energy.  Since a Sinc has infinite extent, so does the total bandwidth.  In a more realistic situation, the Sinc will fall below some noise floor at some width from the main lobe.  Pick your noise floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For CW modulation, usually one shapes the pulse window less sharply (less clicky) so that less of the energy is spread out far from the main lobe in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-06-30T23:32:49.033" LastActivityDate="2012-06-30T23:32:49.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2753" PostTypeId="1" AcceptedAnswerId="2767" CreationDate="2012-07-01T02:17:46.923" Score="4" ViewCount="1363" Body="&lt;p&gt;Does anyone have any suggestions on good resources or sites for learning about computer vision?&lt;/p&gt;&#xA;" OwnerUserId="1211" LastEditorUserId="1211" LastEditDate="2012-07-04T07:16:40.243" LastActivityDate="2012-07-07T10:49:31.327" Title="Resources for an introduction to computer vision" Tags="|image-processing|computer-vision|" AnswerCount="3" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="2755" PostTypeId="1" CreationDate="2012-07-01T18:02:07.027" Score="1" ViewCount="232" Body="&lt;p&gt;How wavelet analysis works as a dimension reduction techniques?&#xA;The approximations coefficients at higher level of decomposition are the fewer retained coefficients from the originial ?Is it correct?&lt;/p&gt;&#xA;" OwnerUserId="1611" LastActivityDate="2012-07-01T22:05:21.930" Title="wavelet analysis/ dimension reduction" Tags="|frequency-spectrum|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2756" PostTypeId="2" ParentId="2755" CreationDate="2012-07-01T22:05:21.930" Score="2" Body="&lt;p&gt;Well, not really. The wavelet transform (the discrete to be precise) ist just a base transformation of a signal. However, it can be used to compress signals (dimension reduction in some sense), due to the fact that the energy of most natural signals is compactified under the wavelet transform.&#xA;The continuous wavelet transform does even the opposite. It blows up your signal and introduces a lot of redundancy.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2012-07-01T22:05:21.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2757" PostTypeId="1" AcceptedAnswerId="2758" CreationDate="2012-07-02T01:49:45.193" Score="22" ViewCount="11382" Body="&lt;p&gt;I'm trying to conceptually understand what is happening when the forward and inverse Short Time Fourier Transforms (STFT) are applied to a discrete time-domain signal.  I've found the classic paper by Allen and Rabiner (&lt;a href=&quot;http://cronos.rutgers.edu/~lrr/lrr%20papers/122_unified_approach_to_STFT.pdf&quot; rel=&quot;noreferrer&quot;&gt;1977&lt;/a&gt;), as well as a Wikipedia article (&lt;a href=&quot;http://en.wikipedia.org/wiki/Short_Time_Fourier_Transform&quot; rel=&quot;noreferrer&quot;&gt;link&lt;/a&gt;).  I believe that there is also another good article to be found &lt;a href=&quot;http://www.dsprelated.com/dspbooks/sasp/Overlap_Add_OLA_STFT_Processing.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in computing the Gabor transform, which is nothing more than the STFT with a Gaussian window. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I understand about the &lt;strong&gt;forward&lt;/strong&gt; STFT: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A sub-sequence is selected from the signal, comprised of time domain elements.&lt;/li&gt;&#xA;&lt;li&gt;The sub-sequence is multiplied by a window function using point-by-point multiplication in the time domain.&lt;/li&gt;&#xA;&lt;li&gt;The multiplied sub-sequence is taken into the frequency domain using the FFT.&lt;/li&gt;&#xA;&lt;li&gt;By selecting successive overlapping sub-sequences, and repeating the procedure above, we get a matrix with &lt;em&gt;m&lt;/em&gt; rows and &lt;em&gt;n&lt;/em&gt; columns.  Each column is the sub-sequence computed at a given time. This can be used to compute a spectrogram.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, for the &lt;strong&gt;inverse&lt;/strong&gt; STFT, the papers talk about a summation over the overlapping analysis sections.  I am finding it very challenging to visualize what is really going on here.  What do I have to do to be able to compute the &lt;strong&gt;inverse&lt;/strong&gt; STFT (in step by step order as above)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Forward STFT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created a drawing showing what I think is going on for the forward STFT.  What I don't understand is how to assemble each of the sub-sequences so that I get back the original time sequence.  Could someone either modify this drawing or give an equation showing how the sub-sequences are added? &lt;img src=&quot;https://i.stack.imgur.com/pXQUS.png&quot; alt=&quot;Forward transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Inverse Transform&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I understand about the inverse transform.  Each successive window is taken back into the time domain using the IFFT.  Then each window is shifted by the step size, and added to the result of the previous shift.  The following diagram shows this process.  The summed output is the time domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lMjJ5.png&quot; alt=&quot;Inverse transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following Matlab code generates a synthetic time domain signal, and then tests the STFT process, demonstrating that the inverse is the &lt;em&gt;dual&lt;/em&gt; of the forward transform, within numerical round-off error. The beginning and end of the signal is zero-padded to ensure that the center of the window can be situated at the first and last elements of the time-domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE that according to Allen and Rabiner (1977), if a multiplication happens in the frequency domain to change the frequency response, the length of the analysis window must be equal or greater than $N + N_0 - 1$ points, where $N_0$ is the filter response.  The length is extended by zero-padding.  The test code simply shows that the inverse is the dual of the forward transform.  The length must be extended to prevent a circular convolution.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% The code computes the STFT (Gabor transform) with step size = 1&#xA;% This is most useful when modifications of the signal is required in&#xA;% the frequency domain&#xA;&#xA;% The Gabor transform is a STFT with a Gaussian window (w_t in the code)&#xA;&#xA;% written by Nicholas Kinar&#xA;&#xA;% Reference:&#xA;% [1] J. B. Allen and L. R. Rabiner, &#xA;% “A unified approach to short-time Fourier analysis and synthesis,” &#xA;% Proceedings of the IEEE, vol. 65, no. 11, pp. 1558 – 1564, Nov. 1977.&#xA;&#xA;% generate the signal&#xA;mm = 8192;                  % signal points&#xA;t = linspace(0,1,mm);       % time axis&#xA;&#xA;dt = t(2) - t(1);           % timestep t&#xA;wSize = 101;                % window size&#xA;&#xA;&#xA;% generate time-domain test function&#xA;% See pg. 156&#xA;% J. S. Walker, A Primer on Wavelets and Their Scientific Applications, &#xA;% 2nd ed., Updated and fully rev. Boca Raton: Chapman &amp;amp; Hall/CRC, 2008.&#xA;% http://www.uwec.edu/walkerjs/primer/Ch5extract.pdf&#xA;term1 = exp(-400 .* (t - 0.2).^2);&#xA;term2 = sin(1024 .* pi .* t);&#xA;term3 = exp(-400.*(t- 0.5).^2);&#xA;term4 = cos(2048 .* pi .* t);&#xA;term5 = exp(-400 .* (t-0.7).^2);&#xA;term6 = sin(512.*pi.*t) - cos(3072.*pi.*t);&#xA;u = term1.*term2  + term3.*term4 + term5.*term6; % time domain signal&#xA;u = u';&#xA;&#xA;figure;&#xA;plot(u)&#xA;&#xA;Nmid = (wSize - 1) / 2 + 1;    % midway point in the window&#xA;hN = Nmid - 1;                 % number on each side of center point       &#xA;&#xA;&#xA;% stores the output of the Gabor transform in the frequency domain&#xA;% each column is the FFT output&#xA;Umat = zeros(wSize, mm);     &#xA;&#xA;&#xA;% generate the Gaussian window &#xA;% [1] Y. Wang, Seismic inverse Q filtering. Blackwell Pub., 2008.&#xA;% pg. 123.&#xA;T = dt * hN;                    % half-width&#xA;sp = linspace(dt, T, hN); &#xA;targ = [-sp(end:-1:1) 0 sp];    % this is t - tau&#xA;term1 = -((2 .* targ) ./ T).^2;&#xA;term2 = exp(term1);&#xA;term3 = 2 / (T * sqrt(pi));&#xA;w_t = term3 .* term2;&#xA;wt_sum = sum ( w_t ); % sum of the wavelet&#xA;&#xA;&#xA;% sliding window code&#xA;% NOTE that the beginning and end of the sequence&#xA;% are padded with zeros &#xA;for Ntau = 1:mm&#xA;&#xA;    % case #1: pad the beginning with zeros&#xA;    if( Ntau &amp;lt;= Nmid )&#xA;        diff = Nmid - Ntau;&#xA;        u_sub = [zeros(diff,1); u(1:hN+Ntau)];&#xA;    end&#xA;&#xA;    % case #2: simply extract the window in the middle&#xA;    if (Ntau &amp;lt; mm-hN+1 &amp;amp;&amp;amp; Ntau &amp;gt; Nmid)&#xA;        u_sub = u(Ntau-hN:Ntau+hN);&#xA;    end&#xA;&#xA;    % case #3: less than the end&#xA;    if(Ntau &amp;gt;= mm-hN+1)&#xA;        diff = mm - Ntau;&#xA;        adiff = hN - diff;&#xA;        u_sub = [ u(Ntau-hN:Ntau+diff);  zeros(adiff,1)]; &#xA;    end   &#xA;&#xA;    % windowed trace segment&#xA;    % multiplication in time domain with&#xA;    % Gaussian window  function&#xA;    u_tau_omega = u_sub .* w_t';&#xA;&#xA;    % segment in Fourier domain&#xA;    % NOTE that this must be padded to prevent&#xA;    % circular convolution if some sort of multiplication&#xA;    % occurs in the frequency domain&#xA;    U = fft( u_tau_omega );&#xA;&#xA;    % make an assignment to each trace&#xA;    % in the output matrix&#xA;    Umat(:,Ntau) = U;&#xA;&#xA;end&#xA;&#xA;% By here, Umat contains the STFT (Gabor transform)&#xA;&#xA;% Notice how the Fourier transform is symmetrical &#xA;% (we only need the first N/2+1&#xA;% points, but I've plotted the full transform here&#xA;figure;&#xA;imagesc( (abs(Umat)).^2 )&#xA;&#xA;&#xA;% now let's try to get back the original signal from the transformed&#xA;% signal&#xA;&#xA;% use IFFT on matrix along the cols&#xA;us = zeros(wSize,mm);&#xA;for i = 1:mm &#xA;    us(:,i) = ifft(Umat(:,i));&#xA;end&#xA;&#xA;figure;&#xA;imagesc( us );&#xA;&#xA;% create a vector that is the same size as the original signal,&#xA;% but allows for the zero padding at the beginning and the end of the time&#xA;% domain sequence&#xA;Nuu = hN + mm + hN;&#xA;uu = zeros(1, Nuu);&#xA;&#xA;% add each one of the windows to each other, progressively shifting the&#xA;% sequence forward &#xA;cc = 1; &#xA;for i = 1:mm&#xA;   uu(cc:cc+wSize-1) = us(:,i) + uu(cc:cc+wSize-1)';&#xA;   cc = cc + 1;&#xA;end&#xA;&#xA;% trim the beginning and end of uu &#xA;% NOTE that this could probably be done in a more efficient manner&#xA;% but it is easiest to do here&#xA;&#xA;% Divide by the sum of the window &#xA;% see Equation 4.4 of paper by Allen and Rabiner (1977)&#xA;% We don't need to divide by L, the FFT transform size since &#xA;% Matlab has already taken care of it &#xA;uu2 = uu(hN+1:end-hN) ./ (wt_sum); &#xA;&#xA;figure;&#xA;plot(uu2)&#xA;&#xA;% Compare the differences bewteen the original and the reconstructed&#xA;% signals.  There will be some small difference due to round-off error&#xA;% since floating point numbers are not exact&#xA;dd = u - uu2';&#xA;&#xA;figure;&#xA;plot(dd);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-07-03T01:19:32.950" LastActivityDate="2019-11-18T02:20:35.767" Title="Inverse Short Time Fourier Transform algorithm described in words" Tags="|fourier-transform|algorithms|stft|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="2758" PostTypeId="2" ParentId="2757" CreationDate="2012-07-02T02:24:28.087" Score="12" Body="&lt;p&gt;The STFT transform pair can be characterized by 4 different parameters:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;FFT size (N)&lt;/li&gt;&#xA;&lt;li&gt;Step size (M)&lt;/li&gt;&#xA;&lt;li&gt;Analysis window (size N)&lt;/li&gt;&#xA;&lt;li&gt;Synthesis window (size N)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The process is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Grab N (fft size) samples from the current input location&lt;/li&gt;&#xA;&lt;li&gt;Apply analysis window&lt;/li&gt;&#xA;&lt;li&gt;Do the FFT&lt;/li&gt;&#xA;&lt;li&gt;Do whatever you want to do in the frequency domain&lt;/li&gt;&#xA;&lt;li&gt;Inverse FFT&lt;/li&gt;&#xA;&lt;li&gt;Apply synthesis window&lt;/li&gt;&#xA;&lt;li&gt;Add to the output at the current output location&lt;/li&gt;&#xA;&lt;li&gt;Advance input and output location by M (step size) samples&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The overlap add algorithm is a good example for that. In this case the step size is N, the FFT size is 2*N, the analysis window is rectangular with N ones followed by N zeros and the synthesis windows is simply all ones. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are lot of other choices for that and under certain conditions the forward/inverse transfer is fully reconstructing (i.e. you can get the original signal back).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key point here is that each output sample typically receives additive contributions from more than one inverse FFT. The output needs to be accumulated over multiple frames. The number of contributing frames is simply given by the FFT size divided by the step size (rounded up, if necessary).&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-02T02:24:28.087" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2759" PostTypeId="2" ParentId="2738" CreationDate="2012-07-02T08:39:25.703" Score="3" Body="&lt;p&gt;One solution I have found is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Thresholded on grayscale value.&lt;/li&gt;&#xA;&lt;li&gt;Remove objects on the basis of size.&lt;/li&gt;&#xA;&lt;li&gt;Some more morphological operations.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SG4Qv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1613" LastEditorUserId="590" LastEditDate="2012-07-02T10:04:06.657" LastActivityDate="2012-07-02T10:04:06.657" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2760" PostTypeId="1" CreationDate="2012-07-02T10:45:08.153" Score="1" ViewCount="152" Body="&lt;p&gt;I want to design a digital filter for pulse shaping. Pulses are of 100us Fall time. and the sampling rate is 100MegaSamples/sec. and the Shaping time is 5us. What should my coefficients be??? And how to obtain them using matlab or any other related software.&lt;/p&gt;&#xA;" OwnerUserId="1614" LastActivityDate="2012-07-02T10:45:08.153" Title="Finding The Coefficients of the digital filter?" Tags="|filter-design|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2762" PostTypeId="1" CreationDate="2012-07-02T14:42:54.543" Score="3" ViewCount="3980" Body="&lt;p&gt;An image is corrupted by Gaussian noise,then salt &amp;amp; pepper noise. How can you eliminate it and why?&lt;/p&gt;&#xA;" OwnerUserId="1616" LastEditorUserId="35" LastEditDate="2012-07-02T14:59:22.533" LastActivityDate="2017-02-17T13:24:53.663" Title="How can both Gaussian and salt &amp; pepper noise be removed from an image?" Tags="|image-processing|filters|noise|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2763" PostTypeId="2" ParentId="2739" CreationDate="2012-07-02T16:56:55.003" Score="1" Body="&lt;p&gt;The Sinc function represents the transform of a linear phase &quot;brick-wall&quot; low pass filter, with the peak centered at time 0.  Most physical low pass filters have a closer resemblance to a minimum phase response with a magnitude response that has less perfect/sharp transitions than a Sinc, and with the peak in the minimum phase response offset in time by some physical propagation delay.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-07-02T16:56:55.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2764" PostTypeId="1" AcceptedAnswerId="2819" CreationDate="2012-07-03T00:27:20.503" Score="5" ViewCount="2446" Body="&lt;p&gt;While reading some DSP literature, I've noticed integrals of the following form.  An example integral (Equation 7.17) is given on pg. 124 of a book that I've found very challenging to read (&lt;a href=&quot;http://www.scribd.com/doc/45448335/SEISMIC-INVERSE-q-FILTERING&quot; rel=&quot;nofollow&quot;&gt;Seismic Inverse Q filtering&lt;/a&gt;): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u(t) = h(t)\int\limits_{ - \infty }^\infty  {u(\tau ,t)d} \tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is exactly how the author has written the equation.  Gauging the author's intent, I think that $u(\tau ,t)$ is really another function, so in the above, let's re-write the equation as the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u(t) = h(t)\int\limits_{ - \infty }^\infty  {p(\tau ,t)d} \tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, $u(t) \neq p(\tau ,t)$, so I think that this clears up some of the notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This appears to be notation associated with a continuous signal $p(\tau, t)$ that is of infinite length.  For a discrete signal $p[\tau, t]$ with a finite length $N$, how do I evaluate the integral?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Case #1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the integration treated as a summation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u[t] = h[t]\sum\limits_{i = 1}^N {p[i,t]}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Case #2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the integration treated as a &quot;classical&quot; integration using the trapezoidal rule?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I know which of these cases apply for the discrete signal case?  Is this really an issue of notation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Another Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example can be found on pg. 128 of the same book (Equation 7.21):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\tilde U(\tau ,\omega ) = U(\tau ,\omega )\frac{1}{{\Lambda (\tau ,\omega )}}\exp \left[ {i\int\limits_0^\tau  {\left( {{{\left( {\frac{\omega }{{{\omega _h}}}} \right)}^{\gamma (\tau ')}} - 1} \right)} \omega d\tau '} \right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the integration is being done over $\tau'$, is this integration a summation or a &quot;classical&quot; integration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Yet another example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On pg. 9 of  &quot;R. Wang, Introduction to Orthogonal Transforms: With Applications in Data Processing and Analysis. Cambridge University Press, 2012&quot;, the author states that the energy in a continuous signal $x(t)$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E = \int\limits_{ - \infty }^\infty  {{{\left| {x(t)} \right|}^2}} dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The energy in a discrete signal $x[n]$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E = \sum\limits_{n =  - \infty }^\infty  {{{\left| {x[n]} \right|}^2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But shouldn't a discrete signal have finite lower and upper bounds of summation?  What is really meant here using &lt;em&gt;infinite&lt;/em&gt; lower and upper bounds?  Shouldn't the trapezoidal rule be used here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So here is the gist of my question: Using this notation, is integration done using the trapezoidal rule for discrete signals, or is it simply a form of summation?  What is the general use of this type of notation in DSP?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Given an equation for a continuous function integration, how does this relate to integration in the context of a discrete function?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-07-03T14:29:39.167" LastActivityDate="2012-07-06T16:49:06.523" Title="Integration with infinite/finite limits as a form of summation in DSP notation for discrete signals" Tags="|discrete-signals|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2765" PostTypeId="1" AcceptedAnswerId="2771" CreationDate="2012-07-03T02:18:53.173" Score="9" ViewCount="4171" Body="&lt;p&gt;I am wondering about the correlation between input size and number of coefficients given by a discrete wavelet transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Daubechies wavelets to describe a 1D function and I'm using PyWavelets to implement it (which is analogous to the MATLAB toolbox).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started by implementing it using Haar wavelets, which gave correct results and I understand exactly how it works. Let's say my input function has 16 datapoints, if I use Haar, what I get from a multilevel decomposition (&lt;code&gt;wavedec&lt;/code&gt;) is something like this (the number of shifts in brackets):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;V1[1], W1[1], W2[2], W3[4], W4[8]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is all well and good. The V1 gives me the scaling function and the W1-W5 wavelets of different scale and dilation. My problem is when I use the next Daubechies (referred to as &lt;code&gt;'db2'&lt;/code&gt; in the toolbox, which is called the &lt;strong&gt;D4&lt;/strong&gt;), and I get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;V1[6], W1[6], W2[9]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I lose all my intuition. I have no idea where 6, 6 and 9 come from, and they change depending on the level I specify (not even sure what it means to specify a level) and of course the input size. How can I predict the number of coefficients, and what are some good resources for gaining better understanding of why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: Clarification on V and W:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$V_n$ usually denotes the span of a certain scaling function, $\phi$, i.e. $\{\phi_{n,k}\}$, where $k$ is the shift and $n$ the scaling. $W_n$ is the same except for the wavelet function, $\psi$. I might have abused the notation a bit by referring to the vectors of coefficients by V and W though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT2: Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the MATLAB code to produce the above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; [C, L] = wavedec(1:16, 4, 'db1'); L&#xA;L = &#xA;     1     1     2     4     8    16&#xA;&amp;gt;&amp;gt; [C, L] = wavedec(1:16, 2, 'db2'); L&#xA;L =&#xA;     6     6     9    16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I actually used PyWavelets, where it looked like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import pywt&#xA;&amp;gt;&amp;gt;&amp;gt; map(len, pywt.wavedec(range(16), 'db1')) # defaults to level = 4&#xA;[1, 1, 2, 4, 8]&#xA;&amp;gt;&amp;gt;&amp;gt; map(len, pywt.wavedec(range(16), 'db2')) # defaults to level = 2&#xA;[6, 6, 9]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1609" LastEditorUserId="1609" LastEditDate="2012-07-03T15:31:48.240" LastActivityDate="2016-02-23T18:55:41.827" Title="Number of Daubechies coefficients" Tags="|matlab|wavelet|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2766" PostTypeId="2" ParentId="2762" CreationDate="2012-07-03T06:20:06.137" Score="8" Body="&lt;p&gt;The easiest approach: First apply &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot;&gt;Median filter&lt;/a&gt; for salt and pepper noise, and then use &lt;a href=&quot;http://en.wikipedia.org/wiki/Gaussian_blur&quot;&gt;Gaussian blur&lt;/a&gt; to eliminate Gaussian noise.&lt;/p&gt;&#xA;" OwnerUserId="1555" LastActivityDate="2012-07-03T06:20:06.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2767" PostTypeId="2" ParentId="2753" CreationDate="2012-07-03T09:25:49.587" Score="6" Body="&lt;p&gt;If (from the comments) you are interested in an introduction to computer vision (for the difference, see &lt;a href=&quot;https://dsp.stackexchange.com/questions/2665/a-clear-line-between-computer-vision-and-image-processing&quot;&gt;Question on difference between CV and IP&lt;/a&gt;), you could take a look at the &lt;a href=&quot;https://www.coursera.org/course/vision&quot; rel=&quot;nofollow noreferrer&quot;&gt;introductory course of Coursera on Computer Vision.&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also currently enrolled, but have not had much time to look into it, but it seems to me as a decent course (with the knowledge of computer vision I already have) to get an overview of the different subjects in computer vision, and the techniques that are used to overcome problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next to this, there is a &lt;a href=&quot;http://szeliski.org/Book/&quot; rel=&quot;nofollow noreferrer&quot;&gt;free download&lt;/a&gt; of the book Computer Vision by Richard Szeliski, which is also a great source for the basic principles of computer vision, accompanied with a lot of examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this basic understanding and feeling with the subjects of computer vision, you will most likely understand more complicated things easier, because you can place things in perspective.&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-07-04T07:19:04.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2768" PostTypeId="2" ParentId="2762" CreationDate="2012-07-03T10:39:06.343" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot;&gt;Median filter&lt;/a&gt; is very effective to remove salt &amp;amp; pepper noise. After median filtering you need to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_denoising&quot;&gt;Image Denoising&lt;/a&gt; method to remove Gaussian Noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many image denoising methods(for more see &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_denoising&quot;&gt;wikipedia&lt;/a&gt;). Some of them are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://decsai.ugr.es/~javier/denoise/&quot;&gt;Gaussian Scale Mixture&lt;/a&gt; algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Non Local Means method proposed by Buades et al.(&lt;a href=&quot;http://bengal.missouri.edu/~kes25c/nl2.pdf&quot;&gt;pdf&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="1488" LastActivityDate="2012-07-03T10:39:06.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2769" PostTypeId="1" CreationDate="2012-07-03T14:45:56.440" Score="0" ViewCount="2095" Body="&lt;p&gt;I'm able to read wav files and its values. I need to find peaks and pits positions and their values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First time, I tried to smooth it by $\frac{(i-1 + i + i + 1)}{3} $&#xA;formula, then searching on array as &lt;code&gt;array[i-1] &amp;gt; array[i] &amp;amp; direction == 'up'&lt;/code&gt; --&gt; pits style solution. But because of noise and other reasons of future calculations of project, I'm trying to find a better working area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since couple days, I'm researching FFT. As my understanding, FFT translates the audio files to series of sines and cosines. After FFT operation the given values is a0's and a1's for $a_0 + a_k * cos(k*x) + b_k * sin(k*x)$ which k++ and x++ as this picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pv31M.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, does FFT helps to me find peaks and pits on audio? Does anybody has a experience for this kind of problems?&lt;/p&gt;&#xA;" OwnerUserId="1621" LastEditorUserId="809" LastEditDate="2012-07-04T11:58:31.000" LastActivityDate="2012-07-04T21:22:13.090" Title="Can FFT be used to find peaks and pits on audio files" Tags="|audio|fft|sound|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2771" PostTypeId="2" ParentId="2765" CreationDate="2012-07-03T16:46:41.260" Score="6" Body="&lt;p&gt;According to MATLAB &lt;a href=&quot;http://www.mathworks.com/help/toolbox/wavelet/ref/wavedec.html&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; on &lt;code&gt;wavedec&lt;/code&gt;,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The length of each filter is equal to $2N$. If &lt;code&gt;n = length(s)&lt;/code&gt;, the&#xA;  signals $F$ and $G$ are of length $n + 2N −1$ and the coefficients&#xA;  $cA_1$ and $cD_1$ are of length&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\text{floor}\left( \frac{n-1}{2} \right) + N$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here, $n=16$ is the length of your signal, and $N=2$ is the Daubechies number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting all that together, your detail coefficients at the second level should be of length&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{floor}\left( \frac{16-1}{2} \right) + 2 = 7+2 = 9.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the second level, you coefficients should be of length&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{floor}\left( \frac{9-1}{2} \right) + 2 = 4+2 = 6.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're wondering why this must be the case, imagine the filtering-decimation procedure. Scaling and wavelet function for $\text{db}m$ wavelets are of length $2m$. When you convolve length $n$ signal with length $2m$ signal, you get back a signal of length $l_0=n+2m-1$. If you take every second sample of this resulting signal, you get back something of length $l_1 = \frac{n+2m-1}{2} = \frac{l_0}{2}$. Of course, if $l_0$ is odd ($n$ is even), then we cannot split the signal &lt;em&gt;exactly into two parts&lt;/em&gt;. With clever mathematics that I will not go into here, you can show that this last non-paired coefficient is redundant anyway (carries no information that we don't yet know), so you can just omit it. Therefore, we will always have the resulting decimated signal of length&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$l_1 = \text{floor}\left( \frac{l_0}{2} \right) = \text{floor}\left( \frac{n+2N-1}{2} \right) = \text{floor}\left( \frac{n-1}{2} \right)+N.$$&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-07-03T17:55:28.330" LastActivityDate="2012-07-03T17:55:28.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2772" PostTypeId="1" CreationDate="2012-07-03T17:19:26.363" Score="2" ViewCount="2208" Body="&lt;p&gt;I have two waves, and I would like to quantify the difference between them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are exponential sine waves where the frequency decreases with time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in the difference in decay constant between the signals. I thought maybe I could use some kind of FFT method to get the envelope, but I don't know what to do with the varying frequency.&lt;/p&gt;&#xA;" OwnerUserId="1539" LastEditorUserId="76" LastEditDate="2012-07-04T12:38:50.590" LastActivityDate="2012-07-04T12:38:50.590" Title="Signal matching: How to quantify the difference between two signals of varying frequency" Tags="|frequency|wavelet|waveform-similarity|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2773" PostTypeId="2" ParentId="2772" CreationDate="2012-07-03T19:28:40.160" Score="2" Body="&lt;p&gt;For a relatively easy answer you can use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;short-time Fourier transform&lt;/a&gt; and use the largest value as the estimate of your sinusoid frequency.  The basic idea is that you do short Fourier transforms at different points in time to see how it changes.  The problem with that is that you have a tradeoff between time resolution and frequency resolution.  Shortening the Fourier transform improves the time resolution at the expense of the frequency resolution.  Conversely, making the Fourier transform longer improves the frequency resolution at the expense of the time resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency resolution can be improved by using &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Quadratic_Interpolation_Spectral_Peaks.html&quot; rel=&quot;nofollow&quot;&gt;quadratic interpolation&lt;/a&gt; to get a finer estimate of the true sinusoid peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to go that can get you very good frequency estimation at every point in time is with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-locked_loop&quot; rel=&quot;nofollow&quot;&gt;phase-locked loop&lt;/a&gt;.  Phase-locked loops are a little trickier to set up though, because you have to get the feedback gains right.  There is also a tradeoff in regards to responsiveness (akin to time resolution) and resistance to noise.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-07-03T19:28:40.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2774" PostTypeId="1" AcceptedAnswerId="2777" CreationDate="2012-07-03T21:02:24.057" Score="7" ViewCount="1981" Body="&lt;p&gt;I don't know whether this is the right place to post this, but I suppose it is.&lt;/p&gt;&#xA;&lt;p&gt;I know that frequency multiplication = circular convolution in time space for discrete signals (vectors).&lt;/p&gt;&#xA;&lt;p&gt;I also know that &amp;quot;the convolution theorem yields the desired linear convolution result only if &lt;span class=&quot;math-container&quot;&gt;$x(n)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$h(n)$&lt;/span&gt; are padded with zeros prior to the DFT such that their respective lengths are &lt;span class=&quot;math-container&quot;&gt;$N_x+N_h-1$&lt;/span&gt;, essentially zeroing out all circular artifacts.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;and everything works with vectors.. but my goal is circular convolution with matrices as in this paper:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://developer.download.nvidia.com/compute/cuda/2_2/sdk/website/projects/convolutionFFT2D/doc/convolutionFFT2D.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Victor Podlozhnyuk (nVidia) - FFT Based 2D Convolution&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you watch the first two figures (figure 1 and 2) you'll see that the kernel is padded in a weird way I've never seen before, what's this?&lt;/p&gt;&#xA;" OwnerUserId="1627" LastEditorUserId="7092" LastEditDate="2021-05-19T17:03:57.217" LastActivityDate="2022-03-14T17:35:16.290" Title="Kernel Convolution in Frequency Domain - Cyclic Padding" Tags="|image-processing|filters|fourier-transform|algorithms|convolution|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2775" PostTypeId="1" AcceptedAnswerId="2778" CreationDate="2012-07-03T21:22:04.217" Score="7" ViewCount="24333" Body="&lt;p&gt;This came from a homework question, which I've solved. Just need some clarification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am asked to determine the bandwidth in a given amount of spectrum at a given wavelength. To find this, I know that;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\delta_f = \frac{c\cdot \delta_\lambda}{\lambda^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta_f$ is the bandwidth, $\delta_\lambda$ is the amount of spectrum, $\lambda$ is the given carrier wavelength, and $c$ the speed of light.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's all well and good, but I can not find any reason for why this formula works, or where it comes from. Where does this formula come from, or what is it called, or how is it derived?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question reads as follows;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How much bandwidth is there in $0.1 \textrm{ micron}$ of spectrum at a wavelength of $1 \textrm{ micron}$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1029" LastEditorUserId="1629" LastEditDate="2016-05-18T15:10:31.547" LastActivityDate="2018-10-02T05:39:01.513" Title="Relating bandwidth and wavelength of a carrier" Tags="|frequency-spectrum|bandwidth|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2777" PostTypeId="2" ParentId="2774" CreationDate="2012-07-04T01:15:12.683" Score="1" Body="&lt;p&gt;Figures 1 and 2 are not showing any padding whatsoever.  The larger matrix is the data (probably image) matrix, not a padded kernel matrix.  The figures are simply showing how the circular aspect of the convolution works in 2 dimensions.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-07-04T01:15:12.683" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2778" PostTypeId="2" ParentId="2775" CreationDate="2012-07-04T02:44:19.093" Score="7" Body="&lt;p&gt;I will try to derive your formula.  The formula you were given is technically not correct, but on a practical level it is.  I will try to explain below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula for the frequency of any wave (sound, water, light, etc.) is $f = \frac{\nu}{\lambda}$, where $\lambda$ is the wavelength and $\nu$ is the wave's velocity.  This makes intuitive sense if you think about it because you will see more peaks the faster the wave travels, and you will see fewer peaks the longer the wavelength is.  In your case, of course, the wave velocity is $c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bandwidth is the highest frequency minus the lowest frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align} &#xA;B &amp;amp;= f_h - f_l \\&#xA;&amp;amp;= \frac{c}{\lambda_l} - \frac{c}{\lambda_h} \\&#xA;&amp;amp;= \frac{c}{\lambda - \frac{\Delta\lambda}{2}} - \frac{c}{\lambda + \frac{\Delta\lambda}{2}}&#xA;\end{align}&#xA;$$&#xA;At this point to make the typing a little easier I will call $\frac{\Delta\lambda}{2}$ &quot;$d$&quot;.&#xA;$$&#xA;\begin{align} &#xA;B &amp;amp;= \frac{c}{\lambda - d} - \frac{c}{\lambda + d} \\&#xA;&amp;amp;= \frac{c(\lambda + d) - c(\lambda - d)}{(\lambda - d)(\lambda + d)} \\&#xA;&amp;amp;= \frac{2cd}{\lambda^2 - d^2} \\&#xA;&amp;amp;= \frac{c\Delta\lambda}{\lambda^2 - \frac{\Delta\lambda^2}{4}}&#xA;\end{align}&#xA;$$&#xA;The formula you were given is, as a practical matter, correct, because usually $\Delta\lambda$ is much smaller than $\lambda$.  In your case $\Delta\lambda$ is 1/10 of $\lambda$, which is actually much bigger than any normal situation.  Usually $\Delta\lambda$ is orders of magnitude smaller than $\lambda$.  Even at 1/10, though, $\frac{\Delta\lambda^2}{4}$ is $\frac{\lambda^2}{400}$, which is negligible.  Thus, it is dropped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-07-04T02:44:19.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2781" PostTypeId="1" AcceptedAnswerId="3225" CreationDate="2012-07-04T08:35:29.927" Score="9" ViewCount="5355" Body="&lt;p&gt;I have implemented a simple V.23-like FSK modem in C &lt;a href=&quot;https://stackoverflow.com/a/11026006/968261&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The peculiarity of the chosen modulation is such that 0's and 1's are sent as tones of two different frequencies (2100 Hz and 1300 Hz respectively) and the duration of each symbol is 1/1200th of a second, which is between one and two full periods of the symbol tone frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The band-pass filter that I used in the receiver is from about 875 Hz to about 2350 Hz. This range was determined empirically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, how do you calculate this frequency range for a signal like that from the tone frequencies and symbol duration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: A similarity with amplitude modulation has been suggested, where the modulated signal falls into the band from &lt;strong&gt;F&lt;sub&gt;carrier&lt;/sub&gt; - Message Bandwidth&lt;/strong&gt; to &lt;strong&gt;F&lt;sub&gt;carrier&lt;/sub&gt; + Message Bandwidth&lt;/strong&gt; Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to apply this logic directly to my case, then I should expect the bandwidth of my FSK signal to be the union of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;F1&lt;/strong&gt; - &lt;strong&gt;bit rate&lt;/strong&gt; to &lt;strong&gt;F1&lt;/strong&gt; + &lt;strong&gt;bit rate&lt;/strong&gt;&lt;br&gt;&#xA;&lt;strong&gt;F0&lt;/strong&gt; - &lt;strong&gt;bit rate&lt;/strong&gt; to &lt;strong&gt;F0&lt;/strong&gt; + &lt;strong&gt;bit rate&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, if I plug in the numbers, the union of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1300-1200=&lt;strong&gt;100&lt;/strong&gt; to 1300+1200=&lt;strong&gt;2500&lt;/strong&gt;&lt;br&gt;&#xA;2100-1200=&lt;strong&gt;900&lt;/strong&gt; to 2100+1200=&lt;strong&gt;3300&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, simply, from &lt;strong&gt;100&lt;/strong&gt; to &lt;strong&gt;3300&lt;/strong&gt; Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I look at the spectrum of my FSK signal, however, it looks like it's roughly contained in the band from 2100-1200=&lt;strong&gt;900&lt;/strong&gt; to 1300+1200=&lt;strong&gt;2500&lt;/strong&gt; Hz instead of from 1300-1200=&lt;strong&gt;100&lt;/strong&gt; to 2100+1200=&lt;strong&gt;3300&lt;/strong&gt; Hz. Can this empirical result be explained and proven?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT2:&lt;/strong&gt; Here's the spectrum as I'm seeing it in Audacity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kgub1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1408" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-08-26T08:00:04.597" Title="Spectrum of FSK signal" Tags="|frequency-spectrum|modulation|fsk|" AnswerCount="2" CommentCount="23" ContentLicense="CC BY-SA 3.0" />
  <row Id="2782" PostTypeId="1" AcceptedAnswerId="2784" CreationDate="2012-07-03T11:45:42.243" Score="3" ViewCount="1933" Body="&lt;p&gt;I am trying to understand how to interpolate discrete sinusoidal data that I (for now) generate myself, and I get problems that I don't understand. I'm a newbie in this field so do not hesitate to point out even the most basic errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried two approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is to take (Python's/numpy's) fft(), get amplitudes with abs() and phases with &#xA;$$&#xA;\frac{\text{angle} - \pi/2}{2 \pi} * \text{signal_length}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, for each sampling point $p$ I do a sine series, &#xA;$$&#xA;\sum_i \text{amplitude}_i * \sin(2 \pi i * \frac{p - \text{phase}_i}{\text{signal_length}})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For artificial data where the (only) sine lambda is signal_length the fit is perfect regardless of the artificial data phase. However, if I generate the data with sine that has lambda of half the signal length, the fit is far from good for most phase offsets. Obviously, the fit is also not good when I generate a signal from several added sines of different lambdas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1:&lt;/strong&gt; Note that I can artificially correct the phases of different lambdas by dividing them by n, where n is signal_length / lambda of the generating function, but this doesn't help when I don't know the lambda of the generating function and/or when the signal is a mix of several sines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second approach was to get separate sine and cosine amplitudes from fft() output by real() and -1 * imag() and then do a summation similar to above for both sine and cosine terms. This works well whenever the phase offset of the generated data is n*2*pi but unwell when it's anything else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually I'd like to be able to interpolate data generated by a superposition of several sinusoidal functions of various lambdas and phases, but so far it's not looking good. I think there is something that I don't understand about Fourier/DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I can't/don't want to use any built-in ifft functions but I need to do some kind of a sine/cosine summation manually. I tried to write the definition of inverse DFT, but the built-in functions don't understand correctly things such as e^i. Ideally I would want to sum just the sine or the cosine terms, but not both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2&lt;/strong&gt; LaTeXed some math&lt;/p&gt;&#xA;" OwnerUserId="1633" OwnerDisplayName="DohnJoe" LastEditorUserId="6" LastEditDate="2012-07-05T03:14:13.387" LastActivityDate="2012-07-05T03:14:13.387" Title="FFT, interpolation and phases" Tags="|interpolation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2783" PostTypeId="1" AcceptedAnswerId="2787" CreationDate="2012-07-04T12:08:30.133" Score="4" ViewCount="8570" Body="&lt;p&gt;If I understood correctly (and this page should confirm: &lt;a href=&quot;http://www.cs.ioc.ee/~khoros2/linear/convolution-teo/front-page.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.ioc.ee/~khoros2/linear/convolution-teo/front-page.html&lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if I convolve linearly (the usual point-to-point multiplication and addition without tricks for each element of the image matrix) an image with a kernel I obtain RESULT1&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if I calculate the DFT of the image and of the padded kernel (to have same size as the image) and perform their multiplication in frequency and then the inverse DFT, the result is RESULT2 and should be like applying the circular convolution in time space&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;RESULT1 slightly differs from RESULT2 as in the example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="1627" LastEditorUserId="128" LastEditDate="2019-03-15T22:50:17.157" LastActivityDate="2019-03-15T22:50:17.157" Title="Difference Between Linear Convolution and Circular Convolution" Tags="|image-processing|filters|fft|dft|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2784" PostTypeId="2" ParentId="2782" CreationDate="2012-07-04T13:20:52.240" Score="2" Body="&lt;p&gt;I resolved this problem by myself. Using approach 1, I replaced $$phase_i$$ with $$\frac{phase_i}{i+1}$$ in the summation formula, and suddenly everything worked perfectly.&lt;/p&gt;&#xA;" OwnerUserId="1633" LastActivityDate="2012-07-04T13:20:52.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2785" PostTypeId="1" CreationDate="2012-07-04T13:36:47.187" Score="8" ViewCount="19231" Body="&lt;p&gt;I have a 1-by-10000 matrix of double`s stored in a file named &quot;fecg.mat&quot;. The matrix represents the magnitude of a recorded FECG signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've plotted it against time (from 0 to 9999): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J9r4f.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For removing the baseline I wonder if I can use a high-pass filter. How do I design a proper filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;P.S &#xA;Signal processing isn't my field of study. I have no idea how to filter a discrete time-domain signal.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1635" LastEditorUserId="1635" LastEditDate="2012-07-05T05:01:56.357" LastActivityDate="2012-08-27T15:52:19.353" Title="MATLAB, How to filter a discrete signal?" Tags="|filters|matlab|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2786" PostTypeId="2" ParentId="2785" CreationDate="2012-07-04T14:22:08.053" Score="6" Body="&lt;p&gt;Easiest way to remove baseline is to remove the average:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filtered = original - mean(original);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Actually, the average is the first coefficient of the Fourier transform, so it is actually a very sharp filtering: you are eliminating the DC coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want more classic filtering, then check functions like &lt;code&gt;butter&lt;/code&gt; and friends, which will synthesize an IIR filter, then use &lt;code&gt;filter&lt;/code&gt; to filter out your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab also includes a filter design tool.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-07-04T14:22:08.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2787" PostTypeId="2" ParentId="2783" CreationDate="2012-07-04T14:30:53.443" Score="10" Body="&lt;p&gt;The difference applies only to the borders of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the linear convolution you assume the values of pixels beyond the border (examples being mirror of the image pixels, or 50% grey).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the circular convolution (or DFT, product, IDFT), the pixels beyond the border &lt;em&gt;are&lt;/em&gt; the pixels on the other side of the image, just as if you had a repeated tiling of the image.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-07-04T14:30:53.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2788" PostTypeId="2" ParentId="2785" CreationDate="2012-07-04T14:52:56.153" Score="3" Body="&lt;p&gt;MATLAB has a filter design tool called fdatool.&#xA;Run the fdatool in MATLAB, it gives you a visual GUI, in which you can change the filter parameters.&#xA;Choose a high-pass filter from there and choose a cut0ff frequency. when you are satisfied with the filter shape, export it to the MATLAB workspace.&#xA;Let's say your filter name is myFilter and your signal name is mySignal. Then to filter the signal in MATLAB type:&#xA;filteredSignal = conv(mySignal,myFilter).&lt;/p&gt;&#xA;" OwnerUserId="1636" LastActivityDate="2012-07-04T14:52:56.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2789" PostTypeId="2" ParentId="2781" CreationDate="2012-07-04T14:58:45.947" Score="1" Body="&lt;p&gt;You design and use bandpass filter to filterout noise and unwanted signal out of band.&#xA;Since your signal has two components: 1300 Hz and 2100 Hz, your bandpass filter has to pass these frequencies. However since your actual signal has some side lobes, you can not practically generate signal that has only these two frequency components, then you need some gaurd band on both sides of these frequencies. It ooks the gaurd band you have chosen in non symmetric, you could choose a filter with pass band frequency of 1000 Hz to 2400 Hz for example. &lt;/p&gt;&#xA;" OwnerUserId="1636" LastActivityDate="2012-07-04T14:58:45.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2790" PostTypeId="2" ParentId="2769" CreationDate="2012-07-04T15:03:39.670" Score="1" Body="&lt;p&gt;FFT is a tool to look at your signal content in frequency domain. So if you want to find peaks of your time domain signal, FFT cannot help you. However if you want to see what frequency component in the signal is the largest then you can use FFT.&#xA;To find peaks of your time domain signal you can load it into MATLAB and use command &quot;max&quot; for example if your signal is called &quot;mySignal&quot; in MATLAB type: max(mySignal) and it will give you the location of value of the peak.&lt;/p&gt;&#xA;" OwnerUserId="1636" LastActivityDate="2012-07-04T15:03:39.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2792" PostTypeId="1" CreationDate="2012-07-04T16:44:10.847" Score="12" ViewCount="25184" Body="&lt;p&gt;I did a bit of searching on this site but surprisingly, I didn't find much relevant information, and my knowledge of DSP is very very limited. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is quite simple : I want to program an algorithmic reverb in C++ which sounds really good. Or more exactly, the best option would be to let the end user choose the trade-off between quality and cpu-usage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I found out so far is that, to create a reverb, you must feed the dry signal into a early reflections algorithm, then to a late reflections algo. Is this correct ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I found an extensive article on the late reflections part, using Feedback Delay Network (&lt;a href=&quot;http://www.music.miami.edu/programs/mue/mue2003/research/jfrenette/chapter_1/chapter_1.html&quot;&gt;REDUCING ARTIFICIAL REVERBERATION REQUIREMENTS &#xA;USING TIME-VARIANT FEEDBACK DELAY NETWORKS&lt;/a&gt;). From what I've read, FDN is a high quality, not too expansive (cpu wise) way of simulating the late reflexions. Furthermore, I guess you can control the quality/cpu charge trade-off by changing the number of delay lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I have absolutely no idea of how to program the early reflections algo (remember ? I'm  really ignorant in the DSP domain). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would sound logical to me to use a kind of multi delay, which has the advantage to be easy to program and computationally inexpensive. But that sounds too simple to be true. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, my instinct tells me that one or several filters must be included somewhere in the signal path. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could some one please clarify this topic a bit for me ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two notes : &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'm not after a convolution reverb at all. I don't really care about the realism of the reverb, but instead I want a good sounding, tweakable, not to cpu-hungry reverb.&lt;/li&gt;&#xA;&lt;li&gt;Also, the coding part isn't what worries me, I'd ask on stackoverflow otherwise. It's really the DSP part, and just that part, which I'm after :) &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="710" LastActivityDate="2014-04-08T13:24:12.317" Title="High quality reverb algorithm" Tags="|algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2793" PostTypeId="2" ParentId="2785" CreationDate="2012-07-04T17:54:28.813" Score="1" Body="&lt;p&gt;Which filter to use really depends on the specific application. - Too rough a filter could remove the information you are looking for!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The widely used &lt;a href=&quot;http://mirel.xmu.edu.cn/mirel/public/Teaching/QRSdetection.pdf&quot; rel=&quot;nofollow&quot;&gt;Pan-Tompkins algorithm&lt;/a&gt; (for QRS detection) specifies a filter for baseline removal in ECG data. But it is hard to determine whether this filter is suitable for your application from the limited information you supplied. Please elaborate for a more precise answer.&lt;/p&gt;&#xA;" OwnerUserId="1481" LastEditorUserId="1481" LastEditDate="2012-07-05T06:59:34.200" LastActivityDate="2012-07-05T06:59:34.200" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2794" PostTypeId="2" ParentId="2769" CreationDate="2012-07-04T19:01:06.063" Score="1" Body="&lt;p&gt;Note that if your signal is periodic, you can find the &quot;peaks and pits&quot;, in spite of a moderate amount of noise and distortion, with an appropriately designed phase-locked loop.&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-07-04T19:01:06.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2795" PostTypeId="2" ParentId="2792" CreationDate="2012-07-04T20:29:00.613" Score="11" Body="&lt;p&gt;You need to generate early reflections with a few taps of delays (= convolution with the sum of a handful of diracs) ; and the &quot;tail&quot; with what is usually implemented with a network of all-pass (AP) and comb filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first part is trivial to implement but difficult to get to sound right. It might help to look at the positioning of peaks at the head of pre-recorded impulse responses to get an idea of what kind of responses are &quot;natural&quot;. It's hard to make it easily parametrizable by a few settings, though you could get away with it by offering a bunch of presets for this part to get an &quot;hybrid&quot; reverb à la Virsyn Reflect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tail is where algorithmic reverbs shine (no pun intended), since it is easy to parametrize. The grandfather of algorithmic reverbs is &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Schroeder_Reverberator_called_JCRev.html&quot;&gt;Schroeder's&lt;/a&gt; algorithm. Note that it only generates a &quot;tail&quot;, not early reflections - you could augment it with a few taps of delays to give it a head. It does not sound very good (very &quot;grainy&quot;) but it's a decent start - with that you have something to mess with and it helps understanding the impact of each parameter. Many praised algorithmic reverbs, especially those from the 80s (Lexicon, Eventide, Publison) are just finely tuned topologies of all-pass filters and comb filters. I suspect this involved a lot of trial and error by trained ears who got very good at figuring out how changes in parameters or topology would sound, rather than any scientific approach. Here is another &lt;a href=&quot;http://www.spinsemi.com/knowledge_base/effects.html&quot;&gt;interesting read&lt;/a&gt; - showing Keith Barr's favorite reverb topology. The original midiverb might not be your definition of &quot;high quality algorithmic reverb&quot;, but it sounded sweet, and it puts thing in perspective to know it was made with a &quot;dsp&quot; only capable of MACs with coefficients of 0.5...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Valhalla room is my favorite software algorithmic reverb - take some time to read its developer's &lt;a href=&quot;http://valhalladsp.wordpress.com/&quot;&gt;blog&lt;/a&gt; to find inspiration about the kind of things that help getting it right.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-04T20:29:00.613" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2796" PostTypeId="2" ParentId="2792" CreationDate="2012-07-04T21:03:09.570" Score="8" Body="&lt;p&gt;Making a good sounding reverb is NOT easy. Feedback delay networks are definitely the way to go. The original Schroeder algorithms with all passes and comb filters suffers from &quot;spectral thinning&quot; which makes it metallic sounding. You need to dial in frequency dependent attenuation on the different delay lines that's representative of the reverb time (as a function of frequency). Early reflections can be done through a tapped delay line also with some frequency dependent attenuation and a few diffusers to de-correlate them. Doing stereo also requires some means of de-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a fairly good open source implementation floating around, it's called GVerb and it's used in, for example, Audacity. A google search should get you to a (legal) copy of the source code.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-04T21:03:09.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2797" PostTypeId="2" ParentId="2785" CreationDate="2012-07-04T21:09:32.747" Score="2" Body="&lt;p&gt;If you know the frequency content of the desired signal you can high pass somewhat below that frequency. Let's say that you are only interest in signal above 2 Hz and you sample rate is 100 Hz, then you can do this as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = butter(3,2/(100/2),'high');&#xA;outputData = filter(b,a,inputData);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is specific example uses a 3rd order butterworth highpass.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-04T21:09:32.747" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2798" PostTypeId="2" ParentId="2769" CreationDate="2012-07-04T21:20:01.723" Score="1" Body="&lt;p&gt;Unless you clearly define what you mean by &quot;peaks&quot; and &quot;pits&quot;, this is an unanswerable question. Do you mean&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Local minima and maxima in the time domain waveform?&lt;/li&gt;&#xA;&lt;li&gt;Local maxima and minima of the envelope? If so, what is your time scale for enevelope detection&lt;/li&gt;&#xA;&lt;li&gt;Areas that are perceived as &quot;louder&quot; or &quot;softer&quot; as the average track.&lt;/li&gt;&#xA;&lt;li&gt;Something else&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These are all very different things that require very different algorithms.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-04T21:20:01.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2799" PostTypeId="2" ParentId="2769" CreationDate="2012-07-04T21:22:13.090" Score="1" Body="&lt;p&gt;If your intention is to detect sections with high and low level (for example for &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_range_compression&quot; rel=&quot;nofollow&quot;&gt;dynamic compression&lt;/a&gt;) at the scale of tenths of seconds or seconds, you don't need the FFT. A common way to extract an envelope from an audio signal is to compute the maximum sample over a small window of a few ms ; then low-pass filter the result. The averaging you do over 3 successive sample is not capable of tracking long term level changes in the signal - I assume these are the ones relevant to you. More sophisticated level detectors include filters which have different coefficients depending on whether successive samples are increasing or decreasing (allowing a fast response to positive change, and a slower decay after a peak to prevent &quot;pumping&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let us know what is your target application!&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-04T21:22:13.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2800" PostTypeId="1" CreationDate="2012-07-04T23:13:27.757" Score="1" ViewCount="2015" Body="&lt;p&gt;I am trying to do my own blob detection.  My program will receive a real time video, and try to detect a white paper sheet, even if something is written on the paper. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to detect the paper and its corner, because what I really want is to draw a opengl polygon over the paper, such that each corner of the paper will be a corner of the polygon. Then, I need the coordinates of the paper to do other operations. &#xA;So, I need to: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;detect a square white blob &lt;/li&gt;&#xA;&lt;li&gt;get the coordinates of the corners &lt;/li&gt;&#xA;&lt;li&gt;draw a polygon over the white sheet&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how can I do that?&lt;/p&gt;&#xA;" OwnerUserId="1640" LastEditorUserId="76" LastEditDate="2012-07-05T00:03:27.070" LastActivityDate="2013-03-30T01:59:37.197" Title="Blob detection in C" Tags="|image-processing|computer-vision|c|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2802" PostTypeId="2" ParentId="2687" CreationDate="2012-07-05T03:22:56.647" Score="1" Body="&lt;p&gt;I will give you an example to understand.&#xA;Like our hand has many parts palm, back palm, and below that. we can see different color variation in these areas, but the hue for all these regions don't vary much, so hue value  can be useful in hand segmentation.&lt;/p&gt;&#xA;" OwnerUserId="1613" LastActivityDate="2012-07-05T03:22:56.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2803" PostTypeId="1" CreationDate="2012-07-05T05:05:09.363" Score="2" ViewCount="2730" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LkDIX.jpg&quot; alt=&quot;Gray Scale Image with Empty Black area&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to fill the black areas with the value of neighboring pixels. Kind of interpolation. Can any one suggest me how Can I do in matlab.&lt;/p&gt;&#xA;" OwnerUserId="1613" LastEditorUserId="1650" LastEditDate="2013-02-23T14:48:41.520" LastActivityDate="2013-02-23T14:48:41.520" Title="Interpolation of a gray scale image in matlab" Tags="|image-processing|matlab|interpolation|" AnswerCount="1" CommentCount="2" ClosedDate="2012-07-05T13:29:16.757" ContentLicense="CC BY-SA 3.0" />
  <row Id="2804" PostTypeId="2" ParentId="2803" CreationDate="2012-07-05T05:20:03.800" Score="0" Body="&lt;p&gt;Try the &lt;code&gt;imfill&lt;/code&gt; function, see &lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/ref/imfill.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/toolbox/images/ref/imfill.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1641" LastActivityDate="2012-07-05T05:20:03.800" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2805" PostTypeId="1" AcceptedAnswerId="2806" CreationDate="2012-07-05T06:46:37.027" Score="11" ViewCount="23482" Body="&lt;p&gt;What are the internal workings of the OpenCV function &lt;a href=&quot;http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#findchessboardcorners&quot;&gt;findChessboardCorners&lt;/a&gt;? &lt;/p&gt;&#xA;" OwnerUserId="809" LastActivityDate="2018-04-13T15:41:53.640" Title="How does OpenCV find chessboard corners?" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2806" PostTypeId="2" ParentId="2805" CreationDate="2012-07-05T08:07:14.727" Score="13" Body="&lt;p&gt;The source code of OpenCV is available, so I'd recommend just taking some time going through the code. The relevant file for this particular function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Itseez/opencv/blob/master/modules/calib3d/src/calibinit.cpp&quot; rel=&quot;noreferrer&quot;&gt;calib3d/src/calibinit.cpp&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've not looked into it in detail, but it looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CV_IMPL&#xA;int cvFindChessboardCorners( const void* arr, CvSize pattern_size,&#xA;                             CvPoint2D32f* out_corners, int* out_corner_count,&#xA;                             int flags )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is the main implementation of this method. In here they&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use &lt;code&gt;cvCheckChessboard&lt;/code&gt; to determine if a chessboard is in the image&lt;/li&gt;&#xA;&lt;li&gt;Convert to binary (B&amp;amp;W) and dilate to split the corners apart&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;icvGenerateQuads&lt;/code&gt; to find the squares.  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The code then seems to go though a set of checks to condense these &lt;code&gt;quads&lt;/code&gt; to chessboard corners, including &lt;code&gt;icvFindConnectedQuads&lt;/code&gt;, &lt;code&gt;icvCleanFoundConnectedQuads&lt;/code&gt; to remove extra corners, &lt;code&gt;icvCheckQuadGroup&lt;/code&gt;, and &lt;code&gt;icvCheckBoardMonotony&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these functions are implemented in the same file, apart from &lt;code&gt;cvCheckChessboard&lt;/code&gt; which is in &lt;a href=&quot;https://github.com/Itseez/opencv/blob/master/modules/calib3d/src/checkchessboard.cpp&quot; rel=&quot;noreferrer&quot;&gt;calib3d/src/checkchessboard.cpp&lt;/a&gt;. Depending how well you wanted to understand the code, there seem to be a number of debugging lines, which can be included if you &lt;code&gt;#define DEBUG_CHESSBOARD&lt;/code&gt;, that may help you see what's going on.&lt;/p&gt;&#xA;" OwnerUserId="590" LastEditorUserId="13601" LastEditDate="2015-02-03T17:08:06.117" LastActivityDate="2015-02-03T17:08:06.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2807" PostTypeId="1" CreationDate="2012-07-05T10:07:38.500" Score="22" ViewCount="27861" Body="&lt;p&gt;I want to implement the Fast Cosine Transform. I read on &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_cosine_transform#Computation&quot;&gt;wikipedia&lt;/a&gt;, that there is a fast version of the DCT which is similarly computed to the FFT. I tried to read the cited &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1163351&quot;&gt;Makhoul&lt;/a&gt;* paper, for the FTPACK and FFTW implementations that are also used in &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.fftpack.dct.html&quot;&gt;Scipy&lt;/a&gt;, but I were not able to extract the actually algorithm. This is what I have so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def fft(x):&#xA;    if x.size ==1:&#xA;        return x&#xA;    N = x.size&#xA;    x0 = my_fft(x[0:N:2])&#xA;    x1 = my_fft(x[0+1:N:2])&#xA;    k = numpy.arange(N/2)&#xA;    e = numpy.exp(-2j*numpy.pi*k/N)&#xA;    l = x0 + x1 * e&#xA;    r = x0 - x1 * e  &#xA;    return numpy.hstack([l,r])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;DCT code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def dct(x):&#xA;    k = 0&#xA;    N = x.size&#xA;    xk = numpy.zeros(N)&#xA;    for k in range(N):     &#xA;        for n in range(N):&#xA;            xn = x[n]&#xA;            xk[k] += xn*numpy.cos(numpy.pi/N*(n+1/2.0)*k)&#xA;    return xk &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;FCT trial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def my_fct(x):&#xA;    if x.size ==1:&#xA;        return x&#xA;    N = x.size&#xA;    x0 = my_fct(x[0:N:2]) # have to be set to zero?&#xA;    x1 = my_fct(x[0+1:N:2])&#xA;    k = numpy.arange(N/2)&#xA;    n = # ???&#xA;    c = numpy.cos(numpy.pi/N*(n+1/2.0)*k)&#xA;    l = x0 #???&#xA;    r = x0 #???&#xA;    return numpy.hstack([l,r])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;*J. Makhoul, &quot;A fast cosine transform in one and two dimensions,&quot; IEEE Trans. Acoust. Speech Sig. Proc. 28 (1), 27-34 (1980).&lt;/p&gt;&#xA;" OwnerUserId="1642" LastEditorUserId="8202" LastEditDate="2022-08-23T16:58:58.327" LastActivityDate="2022-08-26T08:49:53.997" Title="Fast Cosine Transform via FFT" Tags="|fft|python|dct|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2808" PostTypeId="2" ParentId="2807" CreationDate="2012-07-05T14:42:24.810" Score="10" Body="&lt;p&gt;I'm not sure what method the paper you referenced uses, but I have derived this before and here is what I ended up with: (Assuming $x(n)$ is the input)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n) = \Bigl\lbrace &#xA;\begin{array}{ll}&#xA;x(n), &amp;amp; n=0,1,...,N-1\\&#xA;x(2N - 1 - n), &amp;amp; n=N,N+1,...,2N-1&#xA;\end{array}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DCT is then given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C(k) = \mathrm{Re}\Bigl\lbrace e^{-j\pi \frac{k}{2N}} FFT\lbrace y(n)\rbrace\Bigr\rbrace$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you basically create the $2N$ length sequence $y(n)$ where the first half is $x(n)$ and the second half is $x(n)$ reversed.  Then just take the FFT and multiply that vector by a phase ramp.  Finally take only the real part and you have the DCT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function C = fdct(x)&#xA;    N = length(x);&#xA;    y = zeros(1,2*N);&#xA;    y(1:N) = x;&#xA;    y(N+1:2*N) = fliplr(x);&#xA;    Y = fft(y);&#xA;    k=0:N-1;&#xA;    C = real(exp(-j.* pi.*k./(2*N)).*Y(1:N));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The DCT formula this is using is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C(k) = 2\sum_{n=0}^{N-1} x(n) \cos\left(\frac{\pi k}{2N}(2n+1) \right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several ways of scaling the summation so it may not match up exactly with other implementations.  For instance, MATLAB uses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C(k) = w(k)\sum_{n=0}^{N-1} x(n) \cos\left(\frac{\pi k}{2N}(2n+1) \right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w(0) = \sqrt\frac{1}{N}$ and $w(1...N-1) = \sqrt{\frac{2}{N}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can account for this by properly scaling the output.&lt;/p&gt;&#xA;" OwnerUserId="52" LastEditorUserId="52" LastEditDate="2012-07-05T15:07:53.413" LastActivityDate="2012-07-05T15:07:53.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2809" PostTypeId="1" AcceptedAnswerId="2811" CreationDate="2012-07-04T06:33:43.447" Score="2" ViewCount="274" Body="&lt;p&gt;I have a file that is composed of &lt;em&gt;n&lt;/em&gt; data records with a sample rate &lt;em&gt;s&lt;/em&gt;. Each of these records has a duration &lt;em&gt;d&lt;/em&gt;. Now due to postprocessing I have to change the duration to &lt;em&gt;d=d/3&lt;/em&gt;, thus afterwards I'll have &lt;em&gt;3*n&lt;/em&gt; data records stored in the file. &#xA;I'm now wondering if there is some signal processing rule that says that I also have to change the sampling rate as well (e.g. if the duration changes by &lt;em&gt;1/3&lt;/em&gt; then the new sampling rate is &lt;em&gt;s=s/3&lt;/em&gt;?). I don't want to up/down sample the signal, just change the duration of each record.&lt;/p&gt;&#xA;" OwnerDisplayName="Durin" LastEditorUserId="26573" LastEditDate="2018-09-11T00:52:27.783" LastActivityDate="2018-09-11T00:52:27.783" Title="Resampling necessary?" Tags="|resampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2810" PostTypeId="2" ParentId="2809" CreationDate="2012-07-04T06:39:29.780" Score="1" Body="&lt;p&gt;there is a misconception in your question: sampling consists in taking a &lt;strong&gt;snapshot&lt;/strong&gt; of a signal at regular interval in time. &lt;strong&gt;each sample represents an instant in time&lt;/strong&gt;, thus it has no concept of duration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if you have a signal sampled at a given rate s, if after processing you have generated n*3 samples, then you effectively resampled the signal at rate s*3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; &lt;em&gt;(reading the comment, i do better understand the problem)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the sample rate is defined by &lt;strong&gt;the number of samples per amount of time&lt;/strong&gt;. so the duration and the number of samples are linked: if you decrease the duration by a factor &lt;code&gt;x&lt;/code&gt; and decrease the number of sample by the same factor, the sample rate is the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, in your specific case, the sample rate does not change if and only if you have &lt;code&gt;m/3&lt;/code&gt; samples in each data record of duration &lt;code&gt;d/3&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerDisplayName="Adrien Plisson" LastActivityDate="2012-07-04T07:59:43.097" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2811" PostTypeId="2" ParentId="2809" CreationDate="2012-07-04T06:58:05.453" Score="4" Body="&lt;p&gt;Resampling won't change the signal duration. It will change the sample rate and the number of samples. And, if you're lowering the sample rate, it will change the frequency components of the signal (if done right, with a proper filter, it will reduce the maximum possible frequency to half the new sample rate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to make your signal &quot;faster&quot; or &quot;slower&quot; you need to use a different technique, time compression/expansion or simply time stretching. The basic idea there is to split the signal into blocks, estimate the frequency components in every block and then replace each block with a block of shorter or longer duration containing synthesized sinewaves of the same frequencies and phase shifts. It appears that currently there's no high quality method for time stretching signals by more than 30%. All cheap methods distort audio signals noticeably to the ear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the problem that you are trying to solve? What's the nature of the sampled signal? Can you expand your question?&lt;/p&gt;&#xA;" OwnerUserId="1408" OwnerDisplayName="Alex" LastActivityDate="2012-07-04T06:58:05.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2812" PostTypeId="1" AcceptedAnswerId="2813" CreationDate="2012-07-05T16:05:01.440" Score="3" ViewCount="1832" Body="&lt;p&gt;Say I have 5 measurements of a signal as a column vector: x. &#xA;I can smooth the signal by multiplying it with a smoothing matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \mathbf{xs=S*x} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance I might use [1 2 1] as a smoothing kernel in which case I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;S =&#xA;     2     1     0     0     0&#xA;     1     2     1     0     0&#xA;     0     1     2     1     0&#xA;     0     0     1     2     1&#xA;     0     0     0     1     2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far I have been using the function sparse() to build the matrix diagonal by diagonal,&#xA;but this quickly becomes tedious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I quickly create a mxm smoothing matrix from a 1xn convolution kernel in Matlab?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="697" LastActivityDate="2012-07-06T13:27:06.803" Title="In Matlab: how do I quickly create smoothing matrices?" Tags="|matlab|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2813" PostTypeId="2" ParentId="2812" CreationDate="2012-07-05T16:32:51.617" Score="5" Body="&lt;p&gt;You could do the following-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;kernel = [1 2 1];&#xA;s = conv2(eye(numMeasurements), kernel, 'same')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-07-05T20:22:30.880" LastActivityDate="2012-07-05T20:22:30.880" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2816" PostTypeId="2" ParentId="2750" CreationDate="2012-07-06T14:09:30.103" Score="3" Body="&lt;p&gt;By definition, the bandwidth in a spectrogram is a measure of how many components you will need to describe your signal. Let's look on the positive side of the frequency range: you are using a real signal and the other half is just a reflexion of what you see on the positive frequencies scale (and certainly more intuitive).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a discrete setting (as usual on computers) an infinite sinusoid is described by one component, all other components up the Nyquist frequency are null. As you move to a continuous formulation -and as you mentioned- the spectogram is a pulse and the bandwidth gets to zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is interesting is that if your sinusoid is included in a pulse (that is modulated for instance by a gaussian bump), then the bandwidth gets broader, proportionally to the inverse of the length of the temporal bump. Note that at the extreme, a very narrow pulse (a click) will cover the whole spectrum.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2012-07-06T14:09:30.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2817" PostTypeId="2" ParentId="2764" CreationDate="2012-07-06T15:37:05.450" Score="1" Body="&lt;p&gt;In the absence of any further information, we must assume that tradition plays a role in the numerical implementation.  The language of mathematics implies that an &lt;em&gt;integration is an integration&lt;/em&gt;, so we can assume that the trapezoidal rule holds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\int_a^b f (x){\mkern 1mu} dx \approx \frac{1}{2}\sum\limits_{k = 1}^{N} {\left( {{x_{k + 1}} - {x_k}} \right)} \left( {f({x_{k + 1}}) + f({x_k})} \right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the intent of the author is another mitigating factor, so careful reading is required.  There are often some pathological issues of notation, but these are strange.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some numerical experimentation, I've found that in general, &lt;em&gt;an integration is an integration&lt;/em&gt;, no matter which field of inquiry.  The language of mathematics is universal.&lt;/p&gt;&#xA;" OwnerUserId="1048" LastActivityDate="2012-07-06T15:37:05.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2818" PostTypeId="1" CreationDate="2012-07-06T16:37:44.387" Score="16" ViewCount="27146" Body="&lt;p&gt;I performed 512 point FFT on a signal. I got another set of  512 Numbers. I understand that those numbers represent amplitude of the various sine and cosine waves having different frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my understanding is correct can somebody tell me how to know the frequencies of those sine and cosine waves from the knowledge of those 512-numbers (i.e amplitudes) ? &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2014-04-25T21:15:20.110" Title="Extracting frequencies from FFT" Tags="|fft|fourier-transform|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2819" PostTypeId="2" ParentId="2764" CreationDate="2012-07-06T16:49:06.523" Score="1" Body="&lt;p&gt;First of all, I apologize for all the hand-waving, but it might be helpful in this case...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Discrete signals are sequences&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really understand why you are complicating things with the trapezoidal rule. A discrete signal is not a map from $\mathbb{R}$ to $\mathbb{R}$ (function), but a map form $\mathbb{N}$ to $\mathbb{R}$ (sequence) so there is &lt;em&gt;nothing&lt;/em&gt; between samples, and it is not a good idea to try to making up stuff between samples when reasoning about them. Let's blame it on the many pop science articles in which discrete signals are shown with &quot;steps&quot; - but a correct graphical representation of a discrete signal uses &quot;stems&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you stumble at bridging the continuous and discrete world, it might help to consider a &quot;continuous equivalent&quot; of discrete signal $x(n)$ as a sum of diracs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t) = \sum_{n = -\infty}^{\infty} \delta(t - n) x(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in this case, $x(t)$ is no longer a function - it is a distribution and your usual insights about the integral of functions no longer apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use this to compute the energy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{eqnarray}E &amp;amp;=&amp;amp; \int_{-\infty}^{\infty} |x(t)^2| dt \\&#xA;&amp;amp;=&amp;amp; \int_{-\infty}^{\infty} \left|\sum_{n = -\infty}^{\infty} \delta(t - n) x(n)\right|^2 dt \\&#xA;&amp;amp;=&amp;amp; \sum_{n = -\infty}^{\infty} \int_{-\infty}^{\infty} \delta(t - n) |x(n)|^2 dt \\&#xA;&amp;amp;=&amp;amp; \sum_{n = -\infty}^{\infty} |x(n)|^2 \\&#xA;\end{eqnarray}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When dealing with continuous signals (indexed by $\mathbb{R}$), use integration. When dealing with discrete signals (indexed by $\mathbb{N}$), use summation. If for some reason you need to work with both domains, it might help to represent the discrete signal as a sum of $\delta$ and use $\int$ notation, but then remember that you are integrating/derivating distributions instead of functions and that special rules might apply...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Discrete signals are mathematical objects and do not have to be physically realizable&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the integration bounds: discrete signals don't need to have a finite support. There's nothing that states that discrete signals should be physically &quot;realizable&quot;. Thus there is nothing wrong in defining, for example, the discrete signal $s(n) = \sin (2 \pi \frac{440}{48000} n)$. It has an infinite support and infinite energy. $s(n) = e^{-n^2}$ is another example of discrete signal with infinite support but this time finite energy.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-06T16:49:06.523" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2820" PostTypeId="2" ParentId="2818" CreationDate="2012-07-06T16:52:47.123" Score="7" Body="&lt;p&gt;It always makes my head hurt, but first understand that you have only 256 frequencies.  Depending on the algorithm used, the second 256 are just a mirror of the first or they represent the imaginary components corresponding to the real components in the first 256.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also understand that frequency resolution of an FFT only goes up to half the sampling frequency, so if you were sampling at 10,000 samples per second, the highest frequency resolved will be 5,000 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there you can kind of figure it out.  Say you've got 256 buckets, the highest representing 5000Hz and the lowest representing DC.  Each bucket is 5000/256 Hz of spectrum width, so the zeroeth starts at DC, the first starts at 19.5Hz, the second at 39Hz, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, that's the way I've always figured it out.&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-07-06T16:52:47.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2821" PostTypeId="2" ParentId="2818" CreationDate="2012-07-06T17:03:09.330" Score="7" Body="&lt;p&gt;First, the FFT coefficients you get are not broken down into 256 sine and 256 cosine coefficients. These are the coefficients of the complex exponentials your signal is made of. If your input signal is real, only 257 of those coefficients are carrying useful information (DC component ; 255 components ; nyquist frequency component ; then the conjugate of the 255 components, the only information they carry is that your signal has a null imaginary part). The modulus of the coefficient carry amplitude information, the angle carry phase information, the real part cosine amplitude and the imaginary part sine amplitude ; and a component at index $i$ contain information about frequency $\frac{i}{N}{s_r}$ where $N$ is the FFT size and $s_r$ your sample rate.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-06T17:03:09.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2822" PostTypeId="2" ParentId="2818" CreationDate="2012-07-06T17:06:31.113" Score="20" Body="&lt;p&gt;Assuming your 512 samples of the signal are taken at a sampling freqeuncy $f_s$, then the resulting 512 FFT coefficients correspond to frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0, $f_s/512$, $2 f_s/512$, $\ldots$, $511 f_s/512$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are dealing with discrete-time signals, Fourier transforms are periodic, and FFT is no exception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore you can think of your last coefficient as corresponding also to frequency $511 f_s/512 = (511-512) f_s/512 = -1 f_s/512$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same applies to the second to last coefficient, and so on. This is the mirroring commented by Daniel Hicks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you are transforming a real signal, then all your information is contained in the first 256 FFT coefficients. The rest are simply complex conjugates of the first coefficients.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-07-06T17:06:31.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2823" PostTypeId="2" ParentId="328" CreationDate="2012-07-06T18:02:33.807" Score="30" Body="&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The short answer is that they have the maximum number of &lt;code&gt;vanishing moments&lt;/code&gt; for a given &lt;code&gt;support&lt;/code&gt; (i.e number of filter coefficients). That's the &quot;extremal&quot; property which distinguishes &lt;a href=&quot;http://en.wikipedia.org/wiki/Daubechies_wavelet&quot;&gt;Daubechies wavelets&lt;/a&gt; in general. Loosely speaking, more vanishing moments implies better compression, and smaller support implies less computation. In fact, the tradeoff between vanishing moments and filter size is so important that it dominates the way that wavelets are named.  For example, you'll often see the &lt;code&gt;D4&lt;/code&gt; wavelet referred to either as &lt;code&gt;D4&lt;/code&gt; or &lt;code&gt;db2&lt;/code&gt;.  The &lt;code&gt;4&lt;/code&gt; refers to the number of coefficients, and the &lt;code&gt;2&lt;/code&gt; refers to the number of vanishing moments. Both refer to the same mathematical object. Below, I'll explain more about what moments are (and why we want to make them disappear), but for now, just understand that it relates to how well we can &quot;fold up&quot; most of the information in the signal into a smaller number of values. Lossy compression is achieved by keeping those values, and throwing away the others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you may have noticed that &lt;code&gt;CDF 9/7&lt;/code&gt;, which is used in &lt;code&gt;JPEG 2000&lt;/code&gt;, has two numbers in the name, rather than one. In fact, it's also referred to as &lt;code&gt;bior 4.4&lt;/code&gt;. That's because it's not a &quot;standard&quot; discrete wavelet at all. In fact, it doesn't even technically preserve the energy in the signal, and that property is the entire reason people got so excited about the DWT in the first place! The numbers, &lt;code&gt;9/7&lt;/code&gt; and &lt;code&gt;4.4&lt;/code&gt;, still refer to the supports and vanishing moments respectively, but now there are two sets of coefficients that define the wavelet. The technical term is that rather than being &lt;code&gt;orthogonal&lt;/code&gt;, they are &lt;code&gt;biorthogonal&lt;/code&gt;. Rather than getting too deep into what that means mathematically, I'll just review the factors which led to using non-energy-preserving biorthogonal wavelets in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;JPEG 2000&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A much more detailed discussion of the design decisions surrounding the CDF 9/7 wavelet can be found in the following paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Usevitch, Bryan E. &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.6.7887&quot;&gt;A Tutorial on Modern Lossy Wavelet Image&#xA;  Compression: Foundations of JPEG 2000&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'll just review the main points here.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Quite often, the orthogonal Daubechies wavelets can actually result in increasing the number of values required to represent the signal. The effect is called &lt;code&gt;coefficient expansion&lt;/code&gt;. If we're doing lossy compression that may or may not matter (since we're throwing away values at the end anyway), but it definitely seems counterproductive in the context of compression. One way to solve the problem is to treat the input signal as periodic.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Just treating the input as periodic results in discontinuities at the edges, which are harder to compress, and are just artifacts of the transform. For example, consider the jumps from 3 to 0 in the following periodic extension: $[0,1,2,3] \rightarrow  [...0,1,2,3,0,1,2,3,...]$.  To solve that problem, we can use a symmetric periodic extension of the signal, as follows: $[0,1,2,3] \rightarrow [...,0,1,2,3,3,2,1,0,0,1...]$. Eliminating jumps at the edges is one of the reasons the Discrete Cosine Transform (DCT) is used instead of the DFT in JPEG. Representing a signal with cosines implicitly assumes &quot;front to back looping&quot; of the input signal, so we want wavelets which have the same symmetry property.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Unfortunately, the only orthogonal wavelet which has the required characteristics is the Haar (or D2, db1) wavelet, which only as one vanishing moment. Ugh. That leads us to biorthogonal wavelets, which are actually redundant representations, and therefore don't preserve energy. The reason CDF 9/7 wavelets are used in practice is because they were designed to come &lt;em&gt;very close&lt;/em&gt; to being energy preserving. They have also tested well in practice.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are other ways to solve the various problems (mentioned briefly in the paper), but these are the broad strokes of the factors involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Vanishing Moments&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what are moments, and why do we care about them? Smooth signals can be well approximated by polynomials, i.e. functions of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a + bx + cx^2 + dx^3 + ...$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The moments of a function (i.e. signal) are a measure of how similar it is to a given power of x.  Mathematically, this is expressed as an &lt;a href=&quot;http://en.wikipedia.org/wiki/Inner_product&quot;&gt;inner product&lt;/a&gt; between the function and the power of x.  A vanishing moment means the inner product is zero, and therefore the function doesn't &quot;resemble&quot; that power of x, as follows (for the continuous case):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int{x^n f(x) dx = 0 }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now each discrete, orthogonal wavelet has two &lt;a href=&quot;http://en.wikipedia.org/wiki/FIR_filter&quot;&gt;FIR filters&lt;/a&gt; associated with it, which are used in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_wavelet_transform&quot;&gt;DWT&lt;/a&gt;. One is a lowpass (or scaling) filter $\phi$, and the other is a highpass (or wavelet) filter $\psi$. That terminology seems to vary somewhat, but it's what I'll use here. At each stage of the DWT, the highpass filter is used to &quot;peel off&quot; a layer of detail, and the lowpass filter yields a smoothed version of the signal without that detail. If the highpass filter has vanishing moments, those moments (i.e. low order polynomial features) will get stuffed into the complementary smoothed signal, rather than the detail signal. In the case of lossy compression, hopefully the detail signal won't have much information in it, and therefore we can throw most of it away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a simple example using the Haar (D2) wavelet. There's typically a scaling factor of $1/\sqrt{2}$ involved, but I'm omitting it here to illustrate the concept. The two filters are as follows:&#xA;$$ \phi = [1,1] \\  \psi = [1,-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The highpass filter vanishes for the zero'th moment, i.e. $x^0 = 1$, therefore it has one vanishing moment. To see this, consider this constant signal: $[2,2,2,2]$.  Now intuitively, it should be obvious that there's not much information there (or in any constant signal).  We could describe the same thing by saying &quot;four twos&quot;. The DWT gives us a way to describe that intuition explicitly. Here's what happens during a single pass of the DWT using the Haar wavelet:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;[2,2,2,2] \rightarrow_{\psi}^{\phi} \left\{ \begin{array}{rr}&#xA;\left[2 + 2, 2 + 2\right] = \left[4,4\right] \\ &#xA;\left[2-2,2-2\right] = \left[0,0\right]&#xA;\end{array}\right.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what happens on the second pass, which operates on just the smoothed signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;[4,4] \rightarrow_{\psi}^{\phi} \left\{ \begin{array}{rr}&#xA;\left[4 + 4\right] = \left[8\right] \\ &#xA;\left[4-4\right] = \left[0\right] &#xA;\end{array}\right.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how the constant signal is completely invisible to the detail passes (which all come out to be 0).  Also notice how four values of $2$ have been reduced to a single value of $8$.  Now if we wanted to transmit the original signal, we could just send the $8$, and the Inverse DWT could reconstruct the original signal by assuming that all the detail coefficients are zero. Wavelets with higher-order vanishing moments allow similar results with signals that are well approximated by lines, parabolas, cubics, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Further Reading&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm glossing over a LOT of detail to keep the above treatment accessible. The following paper has a much deeper analysis:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;M. Unser, and T. Blu, &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.173.5622&quot;&gt;Mathematical properties of the JPEG2000 wavelet&#xA;  filters&lt;/a&gt;, IEEE Trans. Image Proc., vol. 12, no. 9, Sept. 2003,&#xA;  pg.1080-1090.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Footnote&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above paper seems to suggest that the JPEG2000 wavelet is called Daubechies 9/7, and is different from the CDF 9/7 wavelet. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We have derived the exact form of the JPEG2000 Daubechies 9/7 scaling&#xA;  filters... These filters result from the factorization of the same&#xA;  polynomial as $Daubechies_{8}$ [10]. The main difference is that the&#xA;  9/7 filters are symmetric. Moreover, unlike the biorthogonal splines&#xA;  of Cohen-Daubechies-Feauveau [11], the nonregular part of the&#xA;  polynomial has been divided among both sides, and as evenly as&#xA;  possible.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[11] A. Cohen, I. Daubechies, and J. C. Feauveau, “Biorthogonal bases&#xA;  of compactly supported wavelets,” Comm. Pure Appl. Math., vol. 45, no.&#xA;  5, pp. 485–560, 1992.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The draft of the JPEG2000 standard (&lt;a href=&quot;http://www.jpeg.org/public/fcd15444-1.pdf&quot;&gt;pdf link&lt;/a&gt;) that I've browsed also calls the official filter Daubechies 9/7. It references this paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;M. Antonini, M. Barlaud, P. Mathieu, and I. Daubechies, “Image coding&#xA;  using the wavelet transform,” IEEE Trans. Image Proc. 1, pp. 205-220,&#xA;  April 1992.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I haven't read either of those sources, so I can't say for sure why Wikipedia calls the JPEG2000 wavelet CDF 9/7. It seems like there may be a difference between the two, but people call the official JPEG2000 wavelet CDF 9/7 anyway (because it's based on the same foundation?).  Regardless of the name, the paper by Usevitch describes the one that's used in the standard.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2012-07-06T18:02:33.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2824" PostTypeId="2" ParentId="2753" CreationDate="2012-07-06T23:06:28.323" Score="2" Body="&lt;p&gt;I think the course:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Image Based Recognition and Classification @KTH&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;was great for starting with CV &amp;lt;&lt;a href=&quot;http://www.csc.kth.se/utbildning/kth/kurser/DD2427/bik12/&quot; rel=&quot;nofollow&quot;&gt;course_webpage&lt;/a&gt;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checkout the literature (ex. &amp;lt;&lt;a href=&quot;http://www.computervisionmodels.com/&quot; rel=&quot;nofollow&quot;&gt;book&lt;/a&gt;&gt;) and &#xA;some of the exercises (under &quot;Schedule&quot;). &#xA;It touches the most important concepts on CV and the exercises in MATLAB help alot in the learning. &lt;/p&gt;&#xA;" OwnerUserId="905" LastEditorUserId="905" LastEditDate="2012-07-06T23:14:08.203" LastActivityDate="2012-07-06T23:14:08.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2825" PostTypeId="1" AcceptedAnswerId="2827" CreationDate="2012-07-07T08:01:14.267" Score="9" ViewCount="9312" Body="&lt;p&gt;I have a signal that I sample at 500khz. I am trying to detect a rise, fall and the peak in the incoming data. The base of the peak could be  for 250 usec or 2.5msec, amplitude could be 6db or 15db above the noise floor. I don't have good snr unfortunately.  The dc level of the signal is not constant but move much more slower  than the ac component.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the decision point, I need to know the slope of the rise and fall. This is a hard realtime system and I really need to make a decision in the 100usec after the downward slope reach to dc level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for suggestions how can I efficiently implement an algorithm that is decent.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I do a running average (past 25 data points added together) and try to detect the trend. Once I detect the trend up I start seeking trend down and once I do that I collect perhaps another 50 samples and start calculating. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise now easily screws this algorithm, hence the question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPdate&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the benefit of others, I have end up implementing a Moving Average followed by integrator. Moving average of past 64 data smoothed enough but lost rise to a degree, integrating last 8 values gained back the rise and I simply seek for rise and fall, later I did a linear regression for the slope. Works ok, not great but ok. &lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2012-08-25T16:23:26.557" LastActivityDate="2012-08-25T16:23:26.557" Title="Real time slope and peak detection and calculation" Tags="|peak-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2826" PostTypeId="2" ParentId="2753" CreationDate="2012-07-07T10:49:31.327" Score="4" Body="&lt;p&gt;As @Geerten correctly pointed out, there is a difference between Computer Vision and Image Processing. Still, I think you should learn some basic Image Processing techniques as a first step (a script language like Matlab or python might be helpful in playing with these:)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Thresholding of grayscale images (&lt;a href=&quot;http://en.wikipedia.org/wiki/Thresholding_(image_processing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, &lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=thresholding&amp;amp;source=web&amp;amp;cd=4&amp;amp;ved=0CFwQFjAD&amp;amp;url=http%3A%2F%2Fweb.cs.wpi.edu%2F~trascrizione%2FMethSurvey.pdf&amp;amp;ei=jQr4T7P7Ls7ntQbdtNQ4&amp;amp;usg=AFQjCNHK5GSuHZ9UA-1ZhUtw1GnTEO5G2g&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sezgin, M. and Sankur, B.:Survey over image thresholding techniques and quantitative performance evaluation&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/2411/what-are-the-most-common-algorithms-for-adaptive-thresholding&quot;&gt;here on DSP&lt;/a&gt; - not complete yet, but someday it might be :))&lt;/li&gt;&#xA;&lt;li&gt;Colorspaces (for conversion to grayscale, and for many other things): (&lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=color%20spaces&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CFUQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FColor_space&amp;amp;ei=3Qr4T6X_IJHHswaoqsXsBQ&amp;amp;usg=AFQjCNG-ZP5Qq5bPxXKJq10QjhRF7NBX7g&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, &lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=color%20spaces&amp;amp;source=web&amp;amp;cd=11&amp;amp;ved=0CHcQFjAK&amp;amp;url=http%3A%2F%2Fwww.poynton.com%2FPDFs%2Fcoloureq.pdf&amp;amp;ei=3Qr4T6X_IJHHswaoqsXsBQ&amp;amp;usg=AFQjCNHDwyTS-S33zEsS4Pyxt85TBEreuw&quot; rel=&quot;nofollow noreferrer&quot;&gt;very nice introduction with references&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/2687/why-do-we-use-the-hsv-colour-space-so-often-in-vision-and-image-processing&quot;&gt;here on DSP&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Image segmentation (&lt;a href=&quot;http://en.wikipedia.org/wiki/Segmentation_(image_processing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, ...), Edge detection, Line/Circle detection (Hough transform: Great DSP links: &lt;a href=&quot;https://dsp.stackexchange.com/q/2420/1273&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/q/470/1273&quot;&gt;2&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/q/1883/1273&quot;&gt;3&lt;/a&gt;), Line interpolation, I'm sure you can find many introductory classes - if only outlines, you can further search on the topics mentioned in the outline&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After this, you'll be playing with images for a while and still won't feel like you can do anything useful :) But, all this should make reading the &quot;serious&quot; Computer Vision books easier. You can focus on any parts you want, or try and do a whole book (I did perspective transformations and camera calibration at the time). Here are some book suggestions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=ramesh%20jain%2C%20rangachar%20kasturi%2C%20i%20brian%20g.%20schunck.%20machine%20vision.&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CFAQFjAB&amp;amp;url=http%3A%2F%2Fwww.cse.usf.edu%2F~r1k%2FMachineVisionBook%2FMachineVision.pdf&amp;amp;ei=nRH4T7qVDs7GtAb-892GBQ&amp;amp;usg=AFQjCNGKYN1tF4vDccSzQYmAYnK3OQYthA&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ramesh Jain, Rangachar Kasturi and Brian G. Schunck: Machine Vision&#xA;&lt;/a&gt; - title page and contents&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://dl.acm.org/citation.cfm?id=971144&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yi Ma, Stefano Soatto, Jana Košecká and S. Shankar Sastry An Invitation to 3-D Vision&lt;/a&gt; - reference page&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hartley, R., Zisserman, A.: Multilpe View Geometry in computer vision&lt;/a&gt; - sample chapters, official page - it's a very, very good book&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, this is not introductory material any more. This is what you do after a long while of learning the basics above: pick your poison :)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;object detection, object recognition, object reconstruction, visual tracking, visual servoing, ... I'm not going to provide links here, these are &lt;em&gt;fields&lt;/em&gt;. And there are many more of them. At this point, you should be reading articles from the field.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-07-07T10:49:31.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2827" PostTypeId="2" ParentId="2825" CreationDate="2012-07-07T14:25:36.117" Score="5" Body="&lt;p&gt;You should start with a bandlimited differentiator (equivalent to a differentiator followed by a low-pass filter). The differentiator will remove the low frequency trend and will respond sharply to your peaks and slopes. The low-pass component will remove noise beyond the cutoff frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should design your cutoff frequency so that you get clean pulses for your slopes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Positive slopes will slow as positive pulses; negative slopes as negative pulses, and the peak will correspond to the zero-crossing between positive and negative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of filter is normally implemented as a FIR filter. The number of samples for your filter will then depend on your real-time constraints, the sharpness at the cutoff frequency, and the cutoff frequency itself.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-07-07T14:25:36.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2828" PostTypeId="1" AcceptedAnswerId="2943" CreationDate="2012-07-07T20:24:25.850" Score="7" ViewCount="841" Body="&lt;p&gt;Sanger DNA &lt;a href=&quot;http://en.wikipedia.org/wiki/DNA_sequencing&quot; rel=&quot;nofollow noreferrer&quot;&gt;sequencing&lt;/a&gt; produces a chromatogram &lt;a href=&quot;http://en.wikipedia.org/wiki/File:Sanger_sequencing_read_display.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;trace&lt;/a&gt; which can be visualized with a number of programs, including FinchTV or ChromasLite. The raw data consists of co-ordinates for each of the four DNA bases (A, C, G and T). However, plots are displayed as smoothed peaks, as shown in the image previously. Many programs allow the x- and y-axis of the plot to be scaled larger or smaller to change the shape of the plot. What mathematical method is used to plot smooth curves such as these from a (small) number of raw data points?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m24qM.png&quot; alt=&quot;Chromatogram Trace Example&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1648" LastEditorUserId="35" LastEditDate="2012-07-25T06:08:50.547" LastActivityDate="2012-07-25T06:08:50.547" Title="Plotting DNA chromatogram trace data" Tags="|image-processing|discrete-signals|interpolation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2829" PostTypeId="1" CreationDate="2012-07-07T23:18:41.367" Score="10" ViewCount="1641" Body="&lt;p&gt;If I have an  image and I find the DCT and then apply hard thresholding on the coefficients and then IDCT then I have attenuated the noise.&lt;/p&gt;&#xA;&lt;p&gt;Can someone please explain in detail or point me to the answer as to why this works?&lt;/p&gt;&#xA;&lt;p&gt;I understand why a filter blocking high frequency will work in denoising (because we assume that noise consists of high frequency components,) but why does magnitude thresholding work?&lt;/p&gt;&#xA;" OwnerUserId="1652" LastEditorUserId="10650" LastEditDate="2021-08-16T07:35:16.043" LastActivityDate="2021-08-16T07:35:16.043" Title="Denoising by DCT and hard thresholding" Tags="|image-processing|denoising|dct|thresholding|sparse-model|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2830" PostTypeId="1" AcceptedAnswerId="2835" CreationDate="2012-07-08T11:31:13.447" Score="12" ViewCount="10413" Body="&lt;p&gt;Can we take advantage of the fact that high frequency components in the FFT of an image generally correspond to edges, to implement an edge detection algorithm in the fourier domain? &#xA;I did try multiplying a high pass filter with the FFT of an image. Although the resultant image sort of corresponded to edges, it wasn't exactly the edge detection established using convolution matrices.&#xA;So is there any way you could do edge detection in the fourier domain, or it's not possible at all?&lt;/p&gt;&#xA;" OwnerUserId="1426" LastActivityDate="2012-07-09T15:43:00.590" Title="Can edge detection be done in the frequency domain?" Tags="|image-processing|fft|fourier-transform|edge-detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2831" PostTypeId="2" ParentId="2829" CreationDate="2012-07-08T12:03:11.283" Score="4" Body="&lt;p&gt;Low-pass filtering is based on the assumption that &quot;natural&quot; images have more energy in the low-frequency coefficients than in the high frequency coefficients ; while noise will affect equally all coefficients. Thus, removing the high frequency coefficients will comparatively eliminate more noise than signal. The problem is that there are &quot;legit&quot; high-frequency coefficients in images, such as edges. Denoising by low-pass filtering will attenuate those coefficients and cause edge blurring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The property used in magnitude thresholding is &lt;strong&gt;sparsity&lt;/strong&gt; - &quot;natural&quot; images are very likely to have only a small set of high non-zero coefficients in the frequency domain. Adding uniform (and independent from pixel to pixel) noise is equivalent to adding a small random value to all the frequency coefficients. The result is that all the coefficients that were 0 in the original image now have a small value ; while the coefficients that were high in the original image are comparatively untouched. Thresholding the small magnitude coefficients will cancel the contribution on noise on those coefficients - though it will not recover the effect of noise on the high coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you replace edges by transients/attacks, the same thing applies to sounds by the way.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-07-08T13:41:11.007" LastActivityDate="2012-07-08T13:41:11.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2832" PostTypeId="2" ParentId="2830" CreationDate="2012-07-08T15:44:30.423" Score="5" Body="&lt;p&gt;Usually the edge detection is done by a convolution of a 2-D filter/kernel like &lt;a href=&quot;http://en.wikipedia.org/wiki/Roberts_Cross&quot;&gt;Roberts Cross&lt;/a&gt; or a &lt;a href=&quot;http://en.wikipedia.org/wiki/Sobel_operator&quot;&gt;Sobel&lt;/a&gt; formulation. Since those are convolutions, LTI rules apply, like being able to equivalently apply them in the frequency domain. That is, take both the kernel and the image into the frequency domain via DFT, multiply them together, and then IDFT the result back into the spatial domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also add that the kernels in the spatial domain, do in fact try to exploit the high spatial frequency characteristics of the edges. For example, if you look at Roberts, you can see how it is doing a differentiation across the diagonal points - ie, a high pass filtering operation.&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-07-08T15:44:30.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2833" PostTypeId="1" CreationDate="2012-07-08T15:05:27.960" Score="12" ViewCount="844" Body="&lt;p&gt;I am a novice user in image processing and working on a project to determine number of yarns in a fabric image i.e. warps and wefts (Perpendicular and parallel yarns to x-axis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jlhgw.jpg&quot; alt=&quot;sample image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to detect the yarns by taking the sum of columns and rows for warps and weft respectively but it doesn't seem working because the image is not very well focused and sharp. Also the method is much sensitive to the alignment of yarns in the fabric. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please propose a better algorithm if possible for detection of yarns. Also if there is any possibility to make yarns straight for every captured image. I have tried IMROTATE but it creates the black regions in image which disturbs the sum of rows and algorithm gets failed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help in this regard will be of much worth to me. Thanks. &lt;/p&gt;&#xA;" OwnerDisplayName="user1509018" LastActivityDate="2012-07-16T03:44:04.820" Title="Detection of number of yarns in the fabric image" Tags="|matlab|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2834" PostTypeId="2" ParentId="2833" CreationDate="2012-07-08T15:35:35.650" Score="9" Body="&lt;p&gt;A fourier transform will give you the period of any periodic features in the image - eg it will tell you there is structure event 3pixels horizontally and 5 pixels vertically, from this and the pixel scale you can calculate the number of yarns&lt;/p&gt;&#xA;" OwnerUserId="1002" OwnerDisplayName="Martin Beckett" LastActivityDate="2012-07-08T15:35:35.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2835" PostTypeId="2" ParentId="2830" CreationDate="2012-07-08T22:46:21.903" Score="6" Body="&lt;p&gt;Since convolution in spatial domain is multiplication in the Fourier (frequency) domain, you can perform edge detection in Fourier domain by multiplying the spectra of image and the edge detection kernel and then perform IFFT on the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the high-pass filter alone is not appropriate for edge detection since it keeps all high-frequency features (e.g. sharp peaks and corners) which are usually not classified as edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More advanced edge detection methods would be tricky in frequency domain since edges are best described in spatial domain (in my opinion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is why to do edge detection using FFT in the first place? Is it because performance considerations? If so, maybe the high-pass filtered image (produced quickly by FFT) can be quickly filtered again to remove non-edge parts.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-07-09T10:21:40.203" LastActivityDate="2012-07-09T10:21:40.203" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2837" PostTypeId="2" ParentId="471" CreationDate="2012-07-09T10:01:52.820" Score="2" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://machinevision4users.blogspot.nl/&quot; rel=&quot;nofollow&quot;&gt;Machine Vision 4 Users&lt;/a&gt; is a very practical blog on machine vision. Regular posts on camera's, lenses, software, lighting and the wole package that is necessary when developing machine vision setups.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cvpapers.com/index.html&quot; rel=&quot;nofollow&quot;&gt;CVPapers&lt;/a&gt; is a site with free downloadable papers about the latest computer vision conferences, which can be useful if you do not have access to very expensive paper databases.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://blog.teledynedalsa.com/&quot; rel=&quot;nofollow&quot;&gt;Blog of Teledyne Dalsa&lt;/a&gt; has very wide subjects, but sometimes has posts that are very detailed about image processing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="809" LastActivityDate="2012-07-09T10:01:52.820" CommentCount="0" CommunityOwnedDate="2012-07-09T10:01:52.820" ContentLicense="CC BY-SA 3.0" />
  <row Id="2838" PostTypeId="2" ParentId="2432" CreationDate="2012-07-09T10:31:07.650" Score="1" Body="&lt;p&gt;Since you are asking for other approaches, there's the Foveon X3 sensor used on some Sigma cameras. It uses three stacked layers of sensors, just like color film used 3 layers of emulsion - so you don't have the alignment problems of 3CCD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.foveon.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.foveon.com/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-09T10:31:07.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2839" PostTypeId="1" AcceptedAnswerId="2840" CreationDate="2012-07-09T11:07:55.807" Score="3" ViewCount="135" Body="&lt;p&gt;In the article &lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=matas%20robust%20wide-baseline%20stereo%20from%20maximally%20stable%20extremal%20regions&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CFYQFjAA&amp;amp;url=http%3A%2F%2Fcmp.felk.cvut.cz%2F~matas%2Fpapers%2Fmatas-bmvc02.pdf&amp;amp;ei=vbr6T8_EK8HBhAet8NHoBg&amp;amp;usg=AFQjCNGXv1k27m9V0t21Q89ogVqZLvtvYQ&quot; rel=&quot;nofollow&quot;&gt;J. Matas, O. Chum, M. Urban, T. Pajdla: Robust Wide Baseline Stereo from Maximally Stable Extremal Regions&lt;/a&gt; it is stated that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The set (of extremal regions) is closed under continuous (and thus perspective) transformation of image coordinates, ...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know what perspective transformations (and consequently, affine transformations) are, but could anyone give examples of other transformations that fall under the category of &lt;em&gt;continuous transformations of image coordinates&lt;/em&gt;? How would such transformations be characterized?&lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2012-07-14T07:50:02.770" Title="Which image transformations are considered continuous transformations?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2840" PostTypeId="2" ParentId="2839" CreationDate="2012-07-09T11:34:37.883" Score="4" Body="&lt;p&gt;I think &quot;continuous&quot; is meant in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Continuous_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;strict mathematical sense&lt;/a&gt; here, i.e. no abrupt changes in the coordinate mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most non-rigid image alignment algorithms (try to) produce continuous mappings. Distortion filters in popular photo-editing applications (like &lt;a href=&quot;http://csscreme.com/tutorials/photoshop-tutorials/warp_tool_effect_photoshop_tutorial&quot; rel=&quot;nofollow noreferrer&quot;&gt;Photoshop's Warp effect&lt;/a&gt;) are usually continuous mappings, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ADD:&lt;/strong&gt; Here are two examples of transformations that are continuous but not affine or perspective:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2406/how-to-flatten-the-image-of-a-label-on-a-food-jar/2409#2409&quot;&gt;How to flatten image label on a food jar&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/10196198/how-to-remove-convexity-defects-in-sudoku-square/10226971#10226971&quot;&gt;Flatten a sudoku grid&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-07-14T07:50:02.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2841" PostTypeId="1" CreationDate="2012-07-09T12:56:13.327" Score="7" ViewCount="318" Body="&lt;p&gt;So the exercise is basically a signal $f(t)$ that is going to modulate the carrier $A\cos(\omega_ct)$ using a modulation index of $m=1$. I have to find $A$ and the power of the modulated signal:&#xA;$$&#xA;f(t)=\cos(\omega_mt)+2\cos(2\omega_mt)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The minimum amplitude of $f(t)$ is $-2$. Then $A = 2$. The power of the signal is, assuming that $R = 1 \ \Omega$:&#xA;$$&#xA;P = P_c+P_s=\frac{A^2}{2}+\frac{\overline{f^2(t)}}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having in mind that:&#xA;$$&#xA;\overline{f^2(t)}=\frac{1^2}{2}+\frac{2^2}{2}=\frac{5}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The power is:&#xA;$$&#xA;P =\frac{A^2}{2}+\frac{\overline{f^2(t)}}{2}=\frac{2^2}{2}+\frac{5}{4}=3.25&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the book the author uses an effective modulation index that is defined as $m_t = \sqrt{m_1^2+m_2^2}$ where $m_1=1/2$ and $m_2 = 2/2$. So the power is:&#xA;$$&#xA;P = P_c\left(1+\frac{m_t^2}{2}\right)=2\left(1+\frac{1.12^2}{2}\right)=3.25&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, why would I want to define a modulation index for each tone? What do I get from that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing that I don't understand is that according to &lt;a href=&quot;http://www.edaboard.com/thread49249.html#post223155&quot; rel=&quot;nofollow noreferrer&quot;&gt;this guy&lt;/a&gt; the condition that ensures that there's no overmodulation, regardless of the tone frequencies, is $m_1+m_2\leq1$. Obviously in this case the condition is not met &lt;strong&gt;but&lt;/strong&gt; I'm pretty sure there's no overmodulation with $A=2$.&lt;/p&gt;&#xA;" OwnerUserId="1623" LastEditorUserId="1629" LastEditDate="2017-12-12T00:02:00.890" LastActivityDate="2017-12-12T00:02:00.890" Title="Why would I want to define a modulation index for each tone (DSB-FC)?" Tags="|digital-communications|modulation|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2842" PostTypeId="2" ParentId="2841" CreationDate="2012-07-09T13:28:45.770" Score="2" Body="&lt;p&gt;I'm no expert on this, but until the big guys give an answer, here's my take:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $f(t) = \cos(100t)+2\cos(2\cdot 100t)$, so $\omega_m = 100\ \rm Hz$ for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0C3Tg.gif&quot; alt=&quot;f(t) = cos(100*t)+2*cos(2*100*t)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude's peak value$\ =3$ exceeds $A=2$, so there is overmodulation. This answer only addresses your last point of &quot;I'm pretty sure there's no overmodulation&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1530" LastEditorUserId="1629" LastEditDate="2017-12-11T22:06:07.950" LastActivityDate="2017-12-11T22:06:07.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2843" PostTypeId="2" ParentId="2830" CreationDate="2012-07-09T15:43:00.590" Score="1" Body="&lt;p&gt;Both a single step and a single sawtooth produce a nice linear relationship between frequency and phase in the frequency domain, with the slope of the unwrapped phase depending on the location of the edge in the FFT window.  For detecting or estimating the location of an assumed single edge, you could try to unwrap phase in the frequency domain and see if the result has sufficient linear correlation to pass some detection threshold.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-07-09T15:43:00.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2844" PostTypeId="1" AcceptedAnswerId="2846" CreationDate="2012-07-09T20:20:14.470" Score="5" ViewCount="3282" Body="&lt;p&gt;With regard to DSSS and CDMA(DS), what does it mean to spread a signal over a spectrum of frequencies in terms of individual frequencies? Is it about sending the same signal redundantly on multiple frequencies, or is the data stream actually divided and sent as multiple discreet signals over various frequencies? I've read explanations claiming either.&lt;/p&gt;&#xA;" OwnerUserId="1657" LastEditorUserId="23301" LastEditDate="2017-07-29T17:21:32.087" LastActivityDate="2017-07-29T17:21:32.087" Title="What exactly happens with Spread Spectrum Modulation" Tags="|modulation|spread-spectrum|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2845" PostTypeId="2" ParentId="2844" CreationDate="2012-07-09T20:52:29.043" Score="3" Body="&lt;p&gt;CDMA means that multiple signals are spread and &quot;stacked&quot; on top of the same wide-band channel (each signal takes the entire bandwidth). Each original signal can be obtained because the spreading sequences are orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;http://en.wikipedia.org/wiki/Code_division_multiple_access#Steps_in_CDMA_Modulation&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Code_division_multiple_access#Steps_in_CDMA_Modulation&lt;/a&gt; for a good example of how this signal &quot;stacking&quot; works.&lt;/p&gt;&#xA;" OwnerUserId="1530" LastActivityDate="2012-07-09T20:52:29.043" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2846" PostTypeId="2" ParentId="2844" CreationDate="2012-07-10T02:42:52.600" Score="9" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Direct-sequence_spread_spectrum&quot; rel=&quot;nofollow noreferrer&quot;&gt;Direct-sequence spread spectrum (DSSS)&lt;/a&gt; is a technique that is used to generate a modulated signal that occupies more bandwidth than would be implied by its information content alone. A DSSS signal is generated via multiplication of a (typically digitally-modulated) baseband signal by another &lt;em&gt;spreading code&lt;/em&gt; waveform. The spreading code waveform is constructed such that it is modulated at a higher rate than the baseband signal; this yields the &quot;spreading&quot; of the resulting signal's spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this, recall the multiplication property of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fourier transform&lt;/a&gt;. Let the baseband signal $x(t)$ be multiplied by a spreading waveform $s(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t)s(t)\Longleftrightarrow X(f) * S(f)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the $*$ denotes &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow noreferrer&quot;&gt;convolution&lt;/a&gt;. If $S(f)$ is broadband when compared to $X(f)$, then the result of convolving $X(f)$ with $S(f)$ is that $X(f)$'s spectral content is &quot;smeared&quot; or &quot;spread&quot; across a wider region of the spectrum. The amount of spreading is dependent upon $S(f)$ and therefore the choice of the spreading sequence $s(t)$. So, for example, you could take a 1 kbps &lt;a href=&quot;http://en.wikipedia.org/wiki/BPSK#Binary_phase-shift_keying_.28BPSK.29&quot; rel=&quot;nofollow noreferrer&quot;&gt;BPSK&lt;/a&gt; signal, which would normally have a null-to-null bandwidth of 2 kHz, and spread it to instead have a null-to-null bandwidth of your choice: say, 1 MHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your most pointed question, you're not really sending a single signal redundantly on multiple carrier frequencies, nor are you dividing the input signal into pieces that get transmitted at multiple carriers. In lieu of a discrete multi-carrier approach, DSSS instead is more of a continuous smearing of the input signal over a large region of spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the receiver is also cognizant of the spreading sequence $s(t)$, then it is capable of &lt;em&gt;despreading&lt;/em&gt; its observation of the transmission and therefore recovering the original baseband signal. As long as the spreading sequence $s(t)$ does equal zero for any $t$, then in principle, the spreading process is perfectly reversible. In practice, this isn't exactly the case, as there will be some distortion between what is transmitted and what the receiver sees, but it leads to an important point that is often misunderstood about DSSS:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;No benefit in bit error performance, measured in $\frac{E_b}{N_0}$ (the typical metric used for digital modulation performance evaluation) is offered by using direct-sequence spread spectrum. Since the spreading process is reversible, then the principle of reversibility states that there can be no improvement in performance of the optimal receiver for the spread signal when compared to the performance of the optimal receiver for the original, unspread signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So if there's no direct bit-error performance benefit, why would you want to do this? There are a few common reasons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multiple access&lt;/strong&gt;: &lt;a href=&quot;http://en.wikipedia.org/wiki/CDMA&quot; rel=&quot;nofollow noreferrer&quot;&gt;Code division multiple access&lt;/a&gt; schemes work using DSSS techniques. CDMA allows multiple transmitted signals to occupy the same bandwidth over the same time period. Transmitters are associated with separate carefully-selected spreading codes; these are also known by the receiver, which uses them to separate the previously-intermingled-in-time-and-frequency signals. CDMA can be made to seem like the greatest thing since sliced bread, but there are some practical issues (most notably the &lt;a href=&quot;http://en.wikipedia.org/wiki/Near-far_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;near-far problem&lt;/a&gt;) that limit its usefulness. It is, however, used in some cellular networks around the world, for one example.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interference mitigation&lt;/strong&gt;: Signals with high bandwidth are resistant to narrowband interferers on the &lt;a href=&quot;http://en.wikipedia.org/wiki/AWGN&quot; rel=&quot;nofollow noreferrer&quot;&gt;AWGN&lt;/a&gt; channel. A hand-waving time-domain explanation: a wideband signal in the frequency domain will have a narrow autocorrelation function in the time domain, and vice versa. The optimal receiver will use a correlator (often implemented with a matched filter) matched to the transmitted spread-spectrum waveform, so its output (which ideally will contain copies of the signal's autocorrelation function at symbol-spaced intervals) will contain narrow, sharp peaks that will be easy to identify against the oppositely-characterized background interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A hand-waving frequency-domain explanation: the spreading process takes the original baseband signal's power and spreads it across a wide region of the spectrum. In the communication channel, narrowband interference finds its way into the signal that eventually is observed. During the despreading process, the DSSS signal is compressed back to the original baseband signal's bandwidth. However, at the same time, the &lt;em&gt;despreading&lt;/em&gt; process actually &lt;em&gt;spreads&lt;/em&gt; the narrowband interference across the same bandwidth as the original DSSS signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So effectively, the narrowband interferer has been transformed into a wideband interferer across the entire DSSS signal bandwidth, which as you recall, is much larger than the baseband (information-carrying) signal's bandwidth. Therefore, much of the interference power is pushed out of band with respect to the signal of interest, which yields a higher signal-to-interference power ratio (and better performance).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&quot;Discreetness&quot;&lt;/strong&gt;: No, not &lt;em&gt;discrete&lt;/em&gt;, &lt;em&gt;discreet&lt;/em&gt;. DSSS is often spoken of as being able to &quot;pull signal out of the noise floor.&quot; This refers to the ability of a spread-spectrum receiver to transform a wideband DSSS signal back to the original, much narrower waveform. For a given transmitter power, as the transmitted spread signal bandwidth increases, the average power spectral density over the DSSS bandwidth will decrease, perhaps to the point where it is difficult to observe using spectral analysis at the receiver. This property can be useful for a number of reasons. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One aim might be to decrease the probability of the emitter being detected (and possibly intercepted) by an adversary. Another might be to mitigate interference with other, narrowerband systems that operate in the same region of spectrum. An example of this approach is in &lt;a href=&quot;http://en.wikipedia.org/wiki/Ultra-wideband&quot; rel=&quot;nofollow noreferrer&quot;&gt;ultra wideband&lt;/a&gt; communications systems, which have increased in popularity in recent years.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2017-07-29T15:49:53.530" LastActivityDate="2017-07-29T15:49:53.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2847" PostTypeId="1" AcceptedAnswerId="11303" CreationDate="2012-07-10T03:28:52.980" Score="5" ViewCount="486" Body="&lt;p&gt;The Gabor transform (Short-Time Fourier Transform with Gaussian window) is represented as $U(t,\omega)$, where $t$ is the time, and $\omega$ is the frequency.  The author of a monograph (&lt;a href=&quot;http://www.scribd.com/doc/45448335/SEISMIC-INVERSE-q-FILTERING&quot; rel=&quot;nofollow noreferrer&quot;&gt;Seismic Inverse Q filtering&lt;/a&gt;, pg. 190) is asking for the Gabor spectrum to be transformed from 2D to 1D in the following fashion.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Define $\chi = \omega t$ &lt;/li&gt;&#xA;&lt;li&gt;Take the 2D amplitude spectrum $|U(t,\omega)|$ into a 1D amplitude spectrum as $|U(\chi)|$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The issue that I am struggling with is that $\chi$ is the product of $\omega$ and $t$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following Matlab code demonstrates that $\chi$ does not continue to increase monotonically.  Note the &quot;sawtooth&quot; appearance of $\chi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I take the 2D signal as a 1D signal?  For each $\chi$, there should be exactly one $|U(\chi)|$.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N0 = 51;&#xA;N1 = 1604;&#xA;fs = 1.0e3;&#xA;f = (fs/2) * linspace(0,1,N0);&#xA;omega = 2 * pi .* f;&#xA;dt = 1 / fs;&#xA;T = (N1-1) * dt;&#xA;t = linspace(0,T,N1);&#xA;&#xA;chi = [];&#xA;cnt = 1;&#xA;for i = 1:length(omega)&#xA;   for j = 1:length(t)&#xA;        chi(cnt) = omega(i) * t(j);&#xA;        cnt = cnt + 1;&#xA;   end &#xA;end&#xA;&#xA;figure;&#xA;plot(chi);&#xA;xlabel('\chi')&#xA;ylabel('Value')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MuPXi.png&quot; alt=&quot;Chi image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the Gabor spectrum is a 2D matrix, similar to this example, where $\omega$ is on one axis, and $t$ is on the other axis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6yabj.png&quot; alt=&quot;Gabor transform&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-07-10T14:06:06.553" LastActivityDate="2013-10-26T05:43:38.123" Title="Expressing 2D Gabor transform as 1D spectrum" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2848" PostTypeId="1" AcceptedAnswerId="2851" CreationDate="2012-07-10T07:58:03.003" Score="4" ViewCount="1925" Body="&lt;p&gt;I have a three-dimensional binary image of a collection of discrete, individual voxels (&quot;seeds&quot;) contained in a connected 3-dimensional surface (&quot;skin&quot;).&#xA;(Like a small fruit, with a surface delineated by a one-pixel boundary, that contains seeds.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The binary matrix was derived from a three-dimensional intensity image of the same size (grayscale).&#xA;(It's easy to label the surface voxels &quot;2&quot;, the seed voxels &quot;1&quot;, and the background &quot;0&quot; using MATLAB's label function).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB,&#xA;&lt;b&gt; How do I compute the shortest geometric distance between each individual &quot;seed&quot; and the surface? &lt;/b&gt; &#xA;In the (crude) 2-dimensional diagram in the link below, each desired distance is represented by the magnitudes of the red lines (in number of voxels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qcGwa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1459" LastEditorUserId="76" LastEditDate="2012-07-11T09:25:43.800" LastActivityDate="2012-07-11T09:25:43.800" Title="Shortest geometric distance from surface in 3d dataset?" Tags="|image-processing|matlab|3d|matrix|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2849" PostTypeId="1" CreationDate="2012-07-10T09:12:58.063" Score="3" ViewCount="2138" Body="&lt;p&gt;I am not very familiar with DSP techniques, and I am currently working on my research project to develop the firmware of a DSP processor, using C/Linux. It involves the modulation and demodulation of a dataset using Binary FSK and frequency hopping Tx and Rx algorithms. I am able to modulate the signals and have verified the output using MATLAB. However I an a little stuck at demodulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The technique that I am using for demodulation is to compare the amplitude of the FFT of the signal received at every hopping sequence and based on that, determine whether the bit received is 1 or 0. I have a predefined function which is used calculate the FFT of the signals. The function is as follows: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void fft(complex_float* in, complex_float* out, int N, int inv)&#xA;{&#xA;int i, j;&#xA;float a, f;&#xA;complex_float s, w;&#xA;f = inv ? 1.0/N : 1.0;&#xA;for (i = 0; i &amp;lt; N; i++) {&#xA;s.re = 0;&#xA;s.im = 0;&#xA;for (j = 0; j &amp;lt; N; j++) {&#xA;  a = -2*PI*i*j/N;&#xA;  if (inv) a = -a;&#xA;  w.re = cos(a);&#xA;  w.im = sin(a);&#xA;  s.re += in[j].re * w.re - in[j].im * w.im;&#xA;  s.im += in[j].im * w.re + in[j].re * w.im;&#xA;}&#xA;out[i].re = s.re*f;&#xA;out[i].im = s.im*f;&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;complex_float&lt;/code&gt; is a predefined struct :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;typedef struct {&#xA;float re;&#xA;float im;&#xA;}complex_float;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the function &lt;code&gt;fft()&lt;/code&gt; &lt;code&gt;N&lt;/code&gt; defines the number of FFT points. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem that I am facing is how to determine the frequency points of the individual elements in the array returned by &lt;code&gt;fft()&lt;/code&gt; function. In MATLAB, this was very easy to do the FFT function in MATLAB took the sampling frequency in account and plotted the power spectrum accordingly. However, In the &lt;code&gt;fft()&lt;/code&gt; function defined above there is no frequency involved and hence I am confused as to how to find the power of the signal at any particular frequency, or how to determine the frequency point of any element of the retuned array.&lt;/p&gt;&#xA;" OwnerUserId="1659" LastEditorUserId="76" LastEditDate="2012-07-11T09:26:10.397" LastActivityDate="2012-07-13T15:16:05.103" Title="Demodulation of a BFSK frequency hopping signal using FFT" Tags="|fft|software-implementation|demodulation|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2850" PostTypeId="2" ParentId="2849" CreationDate="2012-07-10T13:05:20.800" Score="2" Body="&lt;p&gt;At some point, before the fft() function is called, the sampling frequency must be known (from ADC? or other resampling functions?)... use that to find the frequencies of the bins as you would in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="1530" LastActivityDate="2012-07-10T13:05:20.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2851" PostTypeId="2" ParentId="2848" CreationDate="2012-07-10T13:07:09.010" Score="3" Body="&lt;p&gt;Do you just need the distance, or do you need the closest point?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the closest point, the &lt;a href=&quot;http://mloss.org/software/view/143/&quot; rel=&quot;nofollow&quot;&gt;FLANN library&lt;/a&gt; can help, and it has Matlab bindings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only need the distance, you can also use a distance transform. Try googling for &quot;&lt;a href=&quot;http://www.google.de/search?q=distance%20transform%203d%20matlab&quot; rel=&quot;nofollow&quot;&gt;distance transform 3d matlab&lt;/a&gt;&quot; for implementations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one is faster depends on the number of &quot;seeds&quot; and &quot;skin voxels&quot;.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-07-10T13:07:09.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2852" PostTypeId="2" ParentId="2695" CreationDate="2012-07-10T14:05:24.203" Score="4" Body="&lt;p&gt;Perhaps I reply too late but never the less ..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure how this problem is actually intended to be understood and the info on electronics.SE does not help much. Of questions some could be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why demodulate at the carrier? Should it be understood in the way that you want to convert the information at the carrier to baseband in-phase ($I$) and quadrature-phase ($Q$) signals?&lt;/li&gt;&#xA;&lt;li&gt;What do you mean by the original signal? Is that an RF signal or the $I$/$Q$ signal components?&lt;/li&gt;&#xA;&lt;li&gt;Why do you want to modulate (I assume you just mean frequency translate) the signal to the new carrier frequency?&lt;/li&gt;&#xA;&lt;li&gt;What is actually the objective of the question?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Without this information I am forced to guess a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand it you have a QAM (for the following, the modulation is not relevant) signal at a carrier frequency $f_c=$500$\:$MHz which can be expressed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = I(t)\cdot \cos(2\pi f_c t) - Q(t)\cdot \sin(2\pi f_c t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the in-phase signal $I(t)$ occupies the frequency band $-B \leq f \leq B$ and the quadrature-phase signal $Q(t)$ also occupies the frequency band $-B \leq f \leq B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To simplify things I have omitted an initial constant phase in $\cos()$/$\sin()$ - this can easily be included though and in fact any constant phase can be included in $I$ and $Q$ without loss of generality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me it seems as if you want to force an offset by saying that the carrier is $f_c=f_0+f_\Delta$ and then you would like to know how &quot;new&quot; $I$/$Q$ signals referred to just the carrier frequency $f_0$ looks like. This means that we can rewrite the original signal as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = I(t)\cdot \cos(2\pi (f_0+f_\Delta) t) - Q(t)\cdot \sin(2\pi (f_0+f_\Delta) t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which we need to rewrite as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = I_\mathrm{new}(t)\cdot \cos(2\pi f_0 t) - Q_\mathrm{new}(t)\cdot \sin(2\pi f_0 t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This modification be done by applying standard trigonometric identities (see &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_trigonometric_identities&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;).  What we need is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\cos(\alpha + \beta) = \cos(\alpha)\cdot\cos(\beta) - \sin(\alpha)\cdot\sin(\beta)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sin(\alpha + \beta) = \sin(\alpha)\cdot\cos(\beta) + \cos(\alpha)\cdot\sin(\beta)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using these identities we can then determine the &quot;new&quot; in-phase and quadrature-phase signal components as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;I_\mathrm{new}(t) = I(t) \cdot \cos(2\pi f_\Delta t) - Q(t) \cdot \sin(2\pi f_\Delta t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Q_\mathrm{new}(t) = I(t) \cdot \sin(2\pi f_\Delta t) + Q(t) \cdot \cos(2\pi f_\Delta t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;new&quot; in-phase and quadrature-phase baseband signals occupy the frequency band $-B + \vert f_\Delta \vert \leq f \leq B + \vert f_\Delta \vert$.  The bandwidth increases no matter if we change $f_\Delta$ in the positive or negative direction.  Should it be needed the opposite transformation can also be done such that move from known &quot;new&quot; signals $I_\mathrm{new}$/$Q_\mathrm{new}$ to the $I$/$Q$ signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By use of this approach you can receive the signal at the carrier frequency $f_c+f_\Delta = 500\:$MHz, perform quadrature down-conversion as normal, and the apply the above technique to modify the effective carrier frequency by using e.g. $f_\Delta = 100\:$Hz or whatever.  As shown above you do not need to demodulate the signal and the conversion can be applied to any signal and be handled at baseband.  Depending on the actual application, which is not known from the question, it may not be allowed to use the above. You can extract the original $I$/$Q$ signals directly from $x(t)$ if this signal is quadrature down-converted with the carrier frequency $f_c$.  If you quadrature down-convert $x(t)$ with a locally generated frequency of $f_0$ you extract $I_\mathrm{new}(t)$/$Q_\mathrm{new}(t)$.  If you have $I_\mathrm{new}(t)$/$Q_\mathrm{new}(t)$ you can reconstruct $I(t)$/$Q/t)$ from the above equations (solving two equations with two unknowns).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to remember, though, is that the requirement to sampling frequency increases as the bandwidth of the &quot;new&quot; signal is wider than the original signal.  In case of a $100\:$Hz offset this is likely not a big issue but it obviously depends on the bandwidth $B$ of the original baseband signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the problem is more in the direction of RX a signal at one carrier and relaying to TX the same signal at another frequency then some other technique should be applied.  An obvious technique is to quadrature down-convert and then just quadrature up-convert to the desired offset carrier.  Also a translational loop combined with amplitude information can be applied. The translational loop filters the phase part of the signal.  If further filtering is needed depends entirely on the required spec.&lt;/p&gt;&#xA;" OwnerUserId="1592" LastEditorUserId="1592" LastEditDate="2012-07-10T18:56:39.637" LastActivityDate="2012-07-10T18:56:39.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2853" PostTypeId="2" ParentId="2844" CreationDate="2012-07-10T18:48:36.557" Score="1" Body="&lt;p&gt;Consider an FFT with N bins covering your entire spectrum, and a signal modulated by a constant, say a '0'.  Temporarily ignore the splatter caused by the non-constant modulation required to actually send information.  AM and PM might take up one bin out of N in the FFT result.  An interfering signal in that one bin might take out your signal.  FM might take up 1 out of 2 possible bins, using a different bin for communicating a '1'.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider sending your '0', not in 1 bin, but as an N-dimensional vector using possibly all N bins (and with a '1' as a different mutually orthogonal N dimensional vector).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might call this &quot;spread&quot; because the total transmission energy is spread out in N dimensions instead of all packed into just 1 bin, making your signal less likely to be found.  You might also call this spread because you still might be able to decompose the sum of more than one N-dimensional vector into some orthogonal components, thereby digging your signal out from among other senders using the same N bins within the same spectrum as you (but hopefully using an orthogonal encoding).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or in the case of OFDM, you might be using a large portion of all the possible combinations of orthogonal N-dimensional vectors to send some fraction of N bits of information in one fat chunk, and with a much lower modulation rate than required for the same data rate with per-bit AM, PM or FM (which greatly helps with splatter and multi-path issues).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above thought experiment is, of course, a gross oversimplification, but might provide some insight into why the use of multiple frequency bins might not be just a redundant repeating of the data, but a useful encoding of the data into more than just one or two frequencies.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-07-12T19:09:07.930" LastActivityDate="2012-07-12T19:09:07.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2854" PostTypeId="2" ParentId="2848" CreationDate="2012-07-10T20:43:12.773" Score="3" Body="&lt;p&gt;I'm going to answer assuming that you are searching for the conceptual answer.&#xA;First find all the seed voxels. You can do this in MATLAB using find(labels==1). Also have a corresponding structure containing all the surface voxels. You can get this similarly using find(labels==2). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then loop over each seed voxel which has an array index (i,j,k) and calculate its distance from every point (x,y,z) in the surface voxel structure. The distance can be a simple Euclidean distance given by $d=\sqrt{(x-i)^2 + (y-j)^2 + (z-k)^2}$. So for each seed point you will calculate its distance from EVERY surface point and record the minimum as the distance to the surface. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can imagine, if you have even a moderate amount of seed and surface points, this procedure is highly inefficient. As nikie pointed out, you can use FLANN to find the nearest neighbor in a fast and efficient manner. For further pointers, look into an octree data structure which can let you do nearest neighbor searches in a more efficient manner when using voxel like data.&lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2012-07-10T20:43:12.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2855" PostTypeId="1" AcceptedAnswerId="2856" CreationDate="2012-07-10T22:29:24.350" Score="8" ViewCount="1275" Body="&lt;p&gt;Suppose I have 2 signals from function $f_1(x)$ and $f_2(x)$, respectively, and assume the sampling rate is above Nyquist frequency, so we can restore the underlying functions $f_1(x)$ and $f_2(x)$. But my question is, from the 2 signals, how to tell if the underlying functions $f_2(x)$ is scaled from $f_1(x)$, i.e. to determine if $f_2(x)=f_1(ax)$, where $a$ is a non-zero real number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1641" LastActivityDate="2012-10-25T01:24:58.510" Title="determine two signals with a scale factor" Tags="|discrete-signals|sampling|continuous-signals|signal-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2856" PostTypeId="2" ParentId="2855" CreationDate="2012-07-11T00:01:40.997" Score="8" Body="&lt;p&gt;A necessary (but not sufficient) conditions for $f_2$ to be a temporally scaled version of $f_1$ is that a spectral representation with a logarithmic frequency scale (such as the constant-Q transform) of $f_1$ is a translation of a log-frequency spectral representation of $f_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically, given two signals, you can perform the test and evaluate $a$ by computing the CQT of $f_1$ and $f_2$, cross-correlating them and looking at the location of the peak. The strength of the peak might give you an idea of the spectral similarity of the two signals irrespectively of their temporal scale; and the position of the peak will give you the temporal scaling factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O0vrj.png&quot; alt=&quot;Example of scaled signals with CQT and their correlation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of representation robust to temporal scaling is useful in music signal modeling, where the different notes produced by a music instrument are - in a very rough approximation - temporally scaled versions of themselves.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-11T00:01:40.997" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2857" PostTypeId="1" CreationDate="2012-07-11T04:48:00.917" Score="4" ViewCount="16627" Body="&lt;p&gt;Assuming a signal is sampled adequately, what is the minimum size of an FFT window that would allow detecting a specific frequency?  Is it necessary to have samples for at least one complete period at that frequency?&lt;/p&gt;&#xA;" OwnerUserId="1281" LastEditorUserId="29" LastEditDate="2012-07-13T15:05:40.603" LastActivityDate="2018-12-12T16:18:12.327" Title="Fourier Transform minimum sample requirement" Tags="|fourier|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2858" PostTypeId="2" ParentId="2857" CreationDate="2012-07-11T05:01:58.037" Score="1" Body="&lt;p&gt;You can conduct Fourier transform at any sampling rate. It's just that you won't be able to restore the original signal if your sampling rate is not greater than Nyquist frequency. There will be alias.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastActivityDate="2012-07-11T05:01:58.037" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2859" PostTypeId="1" CreationDate="2012-07-11T07:59:57.510" Score="8" ViewCount="578" Body="&lt;p&gt;I have the model $\ s(x,y)=x^2+y^2, 0 \leq x \leq 1, 0 \leq y \leq 1 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of observing the model directly I am observing the derivatives of the model + some noise (e):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ p(x,y)=s_x+e, q(x,y)=s_y+e$   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From measurements of p(x,y and q(x,y) I want to estimate s(x). Say I know that s(0,0)=0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the gradient theorem:&#xA;$\ s(x,y) = \int_{(0,0)}^{(x,y)} [s_x,s_y]d\vec{r}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regardless along which path we integrate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a small experiment (in Matlab) I added normal distributed noise, N(0,1), to p=2x and q=2y. Then I integrated first along x followed by along y: SXY. Next I integrated first along y followed by along x: SYX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results show that the gradient theorem do not hold in this case (because of the noise):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r0Pgh.png&quot; alt=&quot;S&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8HSRI.png&quot; alt=&quot;SXY&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cMEwz.png&quot; alt=&quot;SYX&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Root Mean Square Errors relative to the model are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ErmsXY =&#xA;    0.1125&#xA;ErmsYX =&#xA;    0.0920&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I find a better (less RMS error and smoother) estimate of s from p and q?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I read; using the curve integral is referred to as local integration.&#xA;There are also global integration methods where one instead tries to choose a S(x,y) that minimizes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \int_0^1\int_0^1 [|S_x - P|^2  + |S_y - Q|^2] dxdy$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Global integration methods are supposed to give better results when the gradient is noisy,&#xA;but how do I do this in practice?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach that I have used is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;first we introduce linear derivation operators: $\ s_x = D_x*s,s_y = D_y*s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is the following linear equation system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ D_x*s=p, D_y*s=q$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next find a Least Square Error solution to these equations.&#xA;A LSE solution to these equations is supposed to be equivalent to minimizing the integral from above.&#xA;&lt;strong&gt;How can this be shown?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results are good:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xtfpW.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RMS error is about 1/5 of that of SXY and SYX and the solution is also smoother. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However there are some drawbacks to this approach:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;it is difficult to implement; must use central differences and &quot;flatten&quot; 2D s matrix into vector etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The derivation matrices are very large and sparse so they may consume a lot of RAM.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Another approach that seems potentially both simpler to code, less RAM consuming and faster is to use FFT. In the Fourier space these pdes become an algebraic equation.&#xA;This is known as the Frankot-Chellappa algorithm, but unfortunately I have not got it to work on my example data.  &lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-07-12T08:58:14.253" LastActivityDate="2012-07-12T08:58:14.253" Title="How do I numerically calculate a function from its noisy gradient?" Tags="|computer-vision|noise|interpolation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2860" PostTypeId="2" ParentId="2857" CreationDate="2012-07-11T08:19:18.553" Score="0" Body="&lt;p&gt;The Fourier transform of a sine signal is a Dirac impulse in frequency domain. But for the sampled sine signal you won't get the expected Dirac impulse in most cases (1) - even if you don't violate the sampling theorem. This is because your sampled time sequence must be finite in length, which means that the original sine signal is implicitly multiplicated with a rectangular impulse in time domain. This corresponds to a convolution with a $sin(x)/x$ function in frequency domain and is referred to as windowing effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This observation is reflected in the constraint to the sampling theorem: the original signal can be reconstructed perfectly from its sampled version if the sampling frequency is higher than double the highest frequency in the band-limited analog signal &lt;strong&gt;and&lt;/strong&gt; if an inifinite number of samples is drawn from the analog signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Let $x(n) = sin(\alpha n)$ be the sampled sine signal. The discrete Fourier transform will be a Dirac impulse if $\alpha = k \Delta \omega$, where $\Delta \omega = \frac{2\pi}{N}$ and $N$ is the number of samples. This is because in this case it happens that you sample the $sin(x)/x$ shaped frequency spectrum at its zero crossings (except for the fundamental frequency). If you use the discrete time Fourier transform, however, you will always see the $sin(x)/x$ spectrum.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2012-07-11T08:30:57.343" LastActivityDate="2012-07-11T08:30:57.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2861" PostTypeId="1" CreationDate="2012-07-11T11:02:34.140" Score="3" ViewCount="2072" Body="&lt;p&gt;I have two sensors which are placed around 30  to 40 cm apart , both of them measure the same   signal say 'lambda signal'. so there is a delay in the measurement of the signal from the second sensor. During the travel there is some noise added to the signal. What are the procedure that I can use to calculate the time delay between them. &#xA;According to my knowledge if I cross correlate both signals, the peak gives me the delay value of the second, but this is not working. Is there any other methods to find the time delay between eachother. Please guide me as I am new to signal processing.![Part of the signals][1]![Another part signal][2] &lt;/p&gt;&#xA;&#xA;&lt;p&gt;link: &lt;a href=&quot;https://docs.google.com/open?id=0BzT9Q3HfpmDKZERPSGJoTEFyTzA&quot; rel=&quot;nofollow&quot;&gt;https://docs.google.com/open?id=0BzT9Q3HfpmDKZERPSGJoTEFyTzA&lt;/a&gt;&#xA;link : &lt;a href=&quot;https://docs.google.com/open?id=0BzT9Q3HfpmDKeVhMSnZLa3BfMjQ&quot; rel=&quot;nofollow&quot;&gt;https://docs.google.com/open?id=0BzT9Q3HfpmDKeVhMSnZLa3BfMjQ&lt;/a&gt;&#xA;Thanks in advance.&#xA;Naveen&lt;/p&gt;&#xA;" OwnerUserId="1335" LastEditorUserId="1335" LastEditDate="2012-07-11T13:51:30.083" LastActivityDate="2012-07-11T13:51:30.083" Title="Time delay estimation of two sensor signals" Tags="|matlab|cross-correlation|" AnswerCount="1" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="2862" PostTypeId="2" ParentId="2861" CreationDate="2012-07-11T11:57:38.337" Score="1" Body="&lt;p&gt;Comment: As a new user I am not allowed to add a comment to your question - hence this approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention that you do get a peak from the cross-correlation but that the lag estimation is incorrect.  This implies that you know the correct result - is from a calibration signal or ..? And what is the lag roughly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you explain what the signals look like (sinusoidals for example)?  Also what is the SNR, sequence length, sampling frequency? Have you filtered the signals before sampling - if so how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the offset is incorrect it might be related to insufficient time resolution. Using a sampling frequency $f_s$ means that your time resolution is $T_\mathrm{s}=\frac{1}{f_\mathrm{s}}$.  If this time resolution is not sufficiently small you may get an estimate that does not agree with your expectations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may be other techniques but this depends on the signals you have - and also if you for example know that the lag is always a fraction of a period time of a periodic signal. Some more details could help with this.&lt;/p&gt;&#xA;" OwnerUserId="1592" LastActivityDate="2012-07-11T11:57:38.337" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2863" PostTypeId="2" ParentId="2859" CreationDate="2012-07-11T12:30:51.050" Score="1" Body="&lt;p&gt;You can filter either the gradient itself or the result, $s$.  You would need to know the characteristics of the true gradients fairly well to know what the frequency bandwidth is.  At that point you could design a &lt;a href=&quot;http://en.wikipedia.org/wiki/Low-pass_filter&quot; rel=&quot;nofollow&quot;&gt;low-pass filter&lt;/a&gt; that would preserve the signal but get rid of higher frequency noise.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-07-11T12:30:51.050" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2864" PostTypeId="1" CreationDate="2012-07-11T14:44:09.760" Score="16" ViewCount="55459" Body="&lt;p&gt;I have some signal that sampled each 1 ns (1e-9 sec) and have, let say, 1e4 points. I need to filter high frequencies from this signal. Let say I need to filter frequencies higher than 10 MHz. I want that for frequencies lower than cutoff frequency signal will be passed unchanged. It means gain of the filter will be 1 for frequencies lower than cutoff frequency. I would like to be able to specify filter order. I mean, first order filter have 20 db/decade slope (power roll off) after cutoff frequency, second order filter have 40 db/dec slope after cutoff frequency and so on. High performance of code is important.&lt;/p&gt;&#xA;" OwnerUserId="1664" LastEditorUserId="7565" LastEditDate="2017-02-14T09:32:01.323" LastActivityDate="2017-02-14T09:32:01.323" Title="How to write lowpass filter for sampled signal in Python?" Tags="|filter-design|lowpass-filter|python|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2865" PostTypeId="2" ParentId="2864" CreationDate="2012-07-11T14:52:54.587" Score="1" Body="&lt;p&gt;Not sure what your application is, but you may want to check out Gnuradio: &lt;a href=&quot;http://gnuradio.org/doc/doxygen/classgr__firdes.html&quot; rel=&quot;nofollow&quot;&gt;http://gnuradio.org/doc/doxygen/classgr__firdes.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal processing blocks are written in C++ (although the Gnuradio flow graphs are in Python), but you did say high performance is important.&lt;/p&gt;&#xA;" OwnerUserId="1530" LastActivityDate="2012-07-11T14:52:54.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2866" PostTypeId="2" ParentId="2857" CreationDate="2012-07-11T14:59:17.933" Score="0" Body="&lt;p&gt;The number of samples required depends on the signal-to-noise ratio, all the way down to just 3 or 4 non-aliased samples for a single pure sinusoid in zero noise, up to many periods if the sinusoid is way below a noise floor of white noise (with either more than 2 samples per period, or wide flat empty spots in the spectrum at all possible alias frequencies.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-07-11T14:59:17.933" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2867" PostTypeId="2" ParentId="2864" CreationDate="2012-07-11T15:54:06.490" Score="5" Body="&lt;p&gt;Does this work?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from __future__ import division&#xA;from scipy.signal import butter, lfilter&#xA;&#xA;fs = 1E9 # 1 ns -&amp;gt; 1 GHz&#xA;cutoff = 10E6 # 10 MHz&#xA;B, A = butter(1, cutoff / (fs / 2), btype='low') # 1st order Butterworth low-pass&#xA;filtered_signal = lfilter(B, A, signal, axis=0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You're right, though, &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html&quot; rel=&quot;nofollow&quot;&gt;the documentation&lt;/a&gt; is not very complete.  It looks like &lt;code&gt;butter&lt;/code&gt; is a wrapper for &lt;code&gt;iirfilter&lt;/code&gt;, which &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.iirfilter.html&quot; rel=&quot;nofollow&quot;&gt;is better documented&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;N : int&#xA;     The order of the filter.&#xA;  Wn : array_like&#xA;      A scalar or length-2 sequence giving the critical frequencies.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Most of this stuff is cloned from matlab, though, so you can look at &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/butter.html;jsessionid=6c3d0daeb1680606cfe3b566de0e&quot; rel=&quot;nofollow&quot;&gt;their documentation&lt;/a&gt; too:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the normalized cutoff frequency Wn must be a number between 0 and 1, where 1 corresponds to the Nyquist frequency, π radians per sample.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added &lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.signal.butter.html&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; for these functions. :)  &lt;a href=&quot;https://github.com/scipy/scipy/pull/298&quot; rel=&quot;nofollow&quot;&gt;Github makes it easy.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-12-12T03:13:28.150" LastActivityDate="2012-12-12T03:13:28.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2868" PostTypeId="2" ParentId="2864" CreationDate="2012-07-11T18:04:01.090" Score="1" Body="&lt;p&gt;I'm having good results with this FIR filter. Notices it applies the filter twice, going &quot;forward&quot; and &quot;reverse&quot;, so as to compensate for signal offset (&lt;code&gt;filtfilt&lt;/code&gt; function didn't work, don't know why):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def firfilt(interval, freq, sampling_rate):&#xA;    nfreq = freq/(0.5*sampling_rate)&#xA;    taps =  sampling_rate + 1&#xA;    a = 1&#xA;    b = scipy.signal.firwin(taps, cutoff=nfreq)&#xA;    firstpass = scipy.signal.lfilter(b, a, interval)&#xA;    secondpass = scipy.signal.lfilter(b, a, firstpass[::-1])[::-1]&#xA;    return secondpass&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A great resource to filter design and use, from where I took this code, and from where band-pass and hi-pass filter examples can be taken, is &lt;a href=&quot;http://mpastell.com/2010/01/18/fir-with-scipy/&quot; rel=&quot;nofollow&quot;&gt;THIS&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-07-11T18:04:01.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2869" PostTypeId="2" ParentId="2864" CreationDate="2012-07-11T19:01:49.333" Score="1" Body="&lt;p&gt;I do not have comment rights ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@endolith: I use the same as you except using the &lt;strong&gt;scipy.signal.filtfilt(B, A, x)&lt;/strong&gt; where &lt;strong&gt;x&lt;/strong&gt; is the input vector to be filtered - e.g. &lt;strong&gt;numpy.random.normal(size=(N))&lt;/strong&gt;.  &lt;strong&gt;filtfilt&lt;/strong&gt; makes a forward and reverse pass of the signal.  For the sake of completeness (most being the same as @endolith):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import scipy.signal as sps&#xA;&#xA;input = np.random.normal(size=(N)) # Random signal as example&#xA;bz, az = sps.butter(FiltOrder, Bandwidth/(SamplingFreq/2)) # Gives you lowpass Butterworth as default&#xA;output = sps.filtfilt(bz, az, input) # Makes forward/reverse filtering (linear phase filter)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;filtfilt&lt;/strong&gt; as also suggested by @heltonbiker requires arrays of coefficients I believe.  In case you need to perform bandpass filtering at complex baseband a more involved config is needed but this does not appear to be a problem here.&lt;/p&gt;&#xA;" OwnerUserId="1592" LastActivityDate="2012-07-11T19:01:49.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2870" PostTypeId="1" AcceptedAnswerId="2871" CreationDate="2012-07-11T20:22:51.097" Score="8" ViewCount="4730" Body="&lt;p&gt;I have a recording in pcm format and I want to do some simple analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some questions about what is normalization.&#xA;As far I understand it is to get all the amplitudes between a range i.e. [-1, 1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious way to do that is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max_amplitude = max(array_of_amplitudes)&#xA;for amplitude in array_of_amplitudes:&#xA;   amplitude = amplitude / max_amplitude&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I read about RMS normalization. Can somebody explain how it is done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover could you please explain what is the benefit of normalization? &lt;/p&gt;&#xA;" OwnerUserId="1667" LastActivityDate="2012-07-11T21:57:22.040" Title="Audio normalization" Tags="|audio|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2871" PostTypeId="2" ParentId="2870" CreationDate="2012-07-11T21:57:22.040" Score="10" Body="&lt;p&gt;Your normalization code is incorrect. If the input signal has a big dip (say a negative value at -5.0), your code won't detect it, and you will still have values outside [-1, 1]. Use max(abs(array_of_amplitudes)) instead. Prior to normalization, it is also recommended to remove any DC offset the signal might have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;RMS normalization consists in computing the RMS (root-mean-square) level over short-term windows, taking the maximum of those values, and dividing the signal by the maximum. This won't guarantee that the result will lie within [-1, 1] - you will have to clip values outside of this. The benefit is that it is more robust to outliers in the signal. Let's say you have a relatively quiet recording, with just a short peak at 1.0 somewhere due to a soundcard driver glitch or a temporary &quot;pop&quot; on the microphone. Normalization won't affect the level of the signal (it is already normalized since the maximum is 1.0) ; while RMS normalization will still boost its level (and the &quot;pop&quot; will cause clipping).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding applications:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In audio recording/reproduction, normalization is important because it ensures that the full dynamic range of the output converters is used. If you play a signal peaking at 0.25 through a 16-bit DAC you are not making use of the 2 upper bits of your converter (which will always be 0) and thus increase your quantization noise by 12dB.&lt;/li&gt;&#xA;&lt;li&gt;In some audio classification tasks (such as emotion recognition; music genre classification; or even speech recognition), amplitude/loudness might be used as a feature. Thus, you really want all input files to be similarly &quot;calibrated&quot; in term of level.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-11T21:57:22.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2872" PostTypeId="2" ParentId="2849" CreationDate="2012-07-11T23:50:10.020" Score="1" Body="&lt;p&gt;The FFT is very inefficient for demodulating BFSK, because you are only using 2 of N bin values, and all the math for the rest is wasted. The Goertzel algorithm is a commonly-used alternative. &lt;/p&gt;&#xA;" OwnerUserId="1668" LastActivityDate="2012-07-11T23:50:10.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2873" PostTypeId="2" ParentId="2849" CreationDate="2012-07-12T02:28:35.597" Score="3" Body="&lt;p&gt;There are two different kinds of frequency-hopped BFSK systems. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;em&gt;slow&lt;/em&gt; frequency-hopping, the center frequency or carrier frequency $f_c$ changes periodically at a fraction of the data rate. Thus, the carrier frequency &lt;em&gt;hops&lt;/em&gt; to a particular value, say $f_1$ and stays there for some time (say $nT$&#xA;seconds, where the bit duration is $T$ seconds.  During this epoch of duration&#xA;$nT$ seconds, $n$ data bits are transmitted successively using BFSK. That is, &#xA;one of two tones at frequencies $f_1 + \Delta f$ and $f_1 - \Delta f$ is transmitted for a duration of $T$ seconds depending on whether a $0$ or a $1$ is being transmitted. Usually, $\Delta f$ is chosen so that $(2\Delta f)T$ is an&#xA;integer.  Then, the next bit is transmitted over the next $T$ seconds, and so on till a total of $n$ bits have been transmitted.  After $n$ bits have been transmitted, the carrier frequency hops to some other choice $f_2$, and tones &#xA;at frequencies $f_2 + \Delta f$ and $f_2 - \Delta f$ are used.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;em&gt;fast&lt;/em&gt; frequency-hopping systems, a single bis is transmitted over&#xA;multiple hops, say $m$ hops.  To transmit a $1$, a succession of tones&#xA;of duration $T/m$ are transmitted &#xA;at frequencies $f_1 - \Delta f$, $f_2 - \Delta f$, $f_3 - \Delta f$, and so on. Of course, if $0$ were to be transmitted, the tones would be at&#xA;frequencies $f_1 + \Delta f$, $f_2 + \Delta f$, $f_3 + \Delta f$.&#xA;Fast frequency hopping systems thus automatically&#xA;provide both frequency diversity and time diversity.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is easiest to demodulate a frequency-hopped BFSK signa;&#xA;by first  &lt;em&gt;heterodyning&lt;/em&gt; it (see, for example, &#xA;&lt;a href=&quot;https://electronics.stackexchange.com/a/34351/8157&quot;&gt;this answer&lt;/a&gt; &#xA;on another stackexchange site) down to a fixed intermediate frequency $f_i$&#xA;(so that the tones are at $f_i + \Delta f$ and  $f_i - \Delta f$&#xA;regardless of the original frequency of transmission.  This&#xA;requires a local tunable oscillator synchronized to the hopping&#xA;pattern and offset from the carrier frequencies in the&#xA;pattern by frequency $f_i$. After heterodyning, a standard&#xA;BFSK receiver can be used, and as David Rick says in another&#xA;answer, using a FFT is &lt;em&gt;not&lt;/em&gt; a particularly good solution&#xA;to the problem.  A standard coherent or noncoherent FSK&#xA;receiver will be much better to use.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2012-07-13T15:16:05.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2874" PostTypeId="2" ParentId="2864" CreationDate="2012-07-12T05:06:16.153" Score="19" Body="&lt;p&gt;The frequency response for the filter designed using the &lt;em&gt;butter&lt;/em&gt;&#xA;function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oHhFd.png&quot; alt=&quot;Butterworth Filter Response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there is no reason to limit the filter to a constant monotonic&#xA;filter design.  If you desire a higher attenuation in the stopband&#xA;and steeper transition band, other options exist.  For more information&#xA;on specifying a filter using &lt;em&gt;iirdesing&lt;/em&gt; see &lt;a href=&quot;http://bit.ly/JPS4Zs&quot;&gt;this&lt;/a&gt;.  As shown by&#xA;the frequency response plots for the &lt;em&gt;butter&lt;/em&gt; design the cutoff &#xA;frequency (-3dB point) is far from the goal.  This can be alleviated&#xA;by down-sampling before filtering (the design&#xA;functions will have a difficult time with such a narrow filter, 2% of &#xA;the bandwidth).  Lets look at filtering the original sample &#xA;rate with the cutoff specified.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy import signal&#xA;from matplotlib import pyplot as plt&#xA;&#xA;from scipy.signal import fir_filter_design as ffd&#xA;from scipy.signal import filter_design as ifd&#xA;&#xA;# setup some of the required parameters&#xA;Fs = 1e9           # sample-rate defined in the question, down-sampled&#xA;&#xA;# remez (fir) design arguements&#xA;Fpass = 10e6       # passband edge&#xA;Fstop = 11.1e6     # stopband edge, transition band 100kHz&#xA;Wp = Fpass/(Fs)    # pass normalized frequency&#xA;Ws = Fstop/(Fs)    # stop normalized frequency&#xA;&#xA;# iirdesign agruements&#xA;Wip = (Fpass)/(Fs/2)&#xA;Wis = (Fstop+1e6)/(Fs/2)&#xA;Rp = 1             # passband ripple&#xA;As = 42            # stopband attenuation&#xA;&#xA;# Create a FIR filter, the remez function takes a list of &#xA;# &quot;bands&quot; and the amplitude for each band.&#xA;taps = 4096&#xA;br = ffd.remez(taps, [0, Wp, Ws, .5], [1,0], maxiter=10000) &#xA;&#xA;# The iirdesign takes passband, stopband, passband ripple, &#xA;# and stop attenuation.&#xA;bc, ac = ifd.iirdesign(Wip, Wis, Rp, As, ftype='ellip')  &#xA;bb, ab = ifd.iirdesign(Wip, Wis, Rp, As, ftype='cheby2') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xgThH.png&quot; alt=&quot;Original Sample Rate Filters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned, because we are trying to filter such a small percent&#xA;of the bandwidth the filter will not have a sharp cutoff.  In this&#xA;case, lowpass filter, we can reduce the bandwidth to get a better&#xA;looking filter.  The python/scipy.signal resample function can &#xA;be used to reduce the bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the resample function will perform filtering to prevent &#xA;aliasing.  Prefiltering can also be perfomed (to reduce aliasing)&#xA;and in this case we could simply resample by 100 and be &lt;em&gt;done&lt;/em&gt;, but&#xA;the question asked about creating filters.  For this example &#xA;we will downsample by 25 and create a new filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R = 25;            # how much to down sample by&#xA;Fsr = Fs/25.       # down-sampled sample rate&#xA;xs = signal.resample(x, len(x)/25.)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If we update the design parameters for the FIR filter the &#xA;new response is.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Down sampled version, create new filter and plot spectrum&#xA;R = 25.             # how much to down sample by&#xA;Fsr = Fs/R          # down-sampled sample rate&#xA;Fstop = 11.1e6      # modified stopband&#xA;Wp = Fpass/(Fsr)    # pass normalized frequency&#xA;Ws = Fstop/(Fsr)    # stop normalized frequency&#xA;taps = 256&#xA;br = ffd.remez(taps, [0, Wp, Ws, .5], [1,0], maxiter=10000) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r2Wah.png&quot; alt=&quot;Downsampled Filter Response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter operating on the downsampled data has a better&#xA;response.  Another benefit of using a FIR filter is that you &#xA;will have linear phase response.&lt;/p&gt;&#xA;" OwnerUserId="306" LastEditorUserId="306" LastEditDate="2012-09-27T03:24:19.637" LastActivityDate="2012-09-27T03:24:19.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2875" PostTypeId="1" CreationDate="2012-07-13T08:11:19.177" Score="4" ViewCount="1029" Body="&lt;p&gt;Thanks to the Realtek 2832U I'm just discovering the world of Software Defined Radio.  There are a lot of signals I'm able to pick up with this device, but identifying them is not always easy and cannot be done automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When scanning for radio transmissions, I can look at a waterfall plot and see whether a broadcast is AM, FM or a handful of digital modes I have learnt to identify, but this is slow and error prone.  I am wondering whether there is a way to automate this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am after is an algorithm to examine the block of RF spectrum that has been digitised, to identify any signals along with their transmission modes.  For example, in a particular part of the spectrum it might identify three broadcasts, two that are FM and one that is a POCSAG data stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking that for this you would need to generate some sort of signature for each detected signal, and then compare that to a list of known modulation types.  Is it possible to generate a signature like this, taking into account the different amplitudes (signal strength) that result from varying distances to the transmitter?  The signature (i.e. an identifying number) would need to be the same for all instances of that signal - for instance, each consumer FM radio station would have the same signature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not really sure where to start, or how to deal with the bandwidth ranges involved (some signals are narrow and close together, others are very wide.)  I'm also unsure whether you would have to pick out strong signals first and only process those (losing weaker ones) or whether you would examine the spectrum uniformly regardless of the power level at that particular frequency, discarding any frequencies that matched the signature for &quot;no signal present.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I am asking is that I would like to write a program that can tune the radio to a given frequency and then display all the transmissions it picks up, decoding them all automatically where possible.  In order to do this, it must be able to identify signals in enough detail to demodulate them.&lt;/p&gt;&#xA;" OwnerUserId="1673" LastActivityDate="2013-07-13T09:47:46.457" Title="Generating a signature to identify RF modulation types" Tags="|signal-detection|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2876" PostTypeId="1" AcceptedAnswerId="50231" CreationDate="2012-07-13T09:23:10.560" Score="1" ViewCount="1221" Body="&lt;p&gt;Given a set of a $ 3 $ by $ 3 $ matrices $ {H}_{i} $.&lt;br&gt;&#xA;Each matrix is an &lt;a href=&quot;http://en.wikipedia.org/wiki/Homography&quot; rel=&quot;noreferrer&quot;&gt;Homography&lt;/a&gt; matrix.&lt;br&gt;&#xA;They are used to stabilize Video Stream.&lt;br&gt;&#xA;Yet some of them are outliers which creates &quot;Jumps&quot; in the &quot;Stabilized Video Stream&quot;.&lt;br&gt;&#xA;I would like to apply Low Pass filter on matrices in a manner which &quot;Low Pass&quot; the homography (Meaning, the Mapping).&lt;br&gt;&#xA;Moreover, I'd like to reject Outliers, Matrices which compared to other rotates / scales the frame in a completely different way.&lt;br&gt;&#xA;The problem I don't know any metrics which deals with that property of a $ 3 $ by $ 3 $ matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea?&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="25" LastEditDate="2012-07-19T15:53:10.463" LastActivityDate="2021-07-17T08:35:53.023" Title="Apply Low Pass (Smoothing) Filter on a Set of Matrices and Reject Outliers" Tags="|filters|lowpass-filter|matrix|homography|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2877" PostTypeId="1" CreationDate="2012-07-13T09:56:27.560" Score="6" ViewCount="2306" Body="&lt;p&gt;In the context of visual tracking and video processing I need to estimate variations of the orientation related to the angular velocity. I am trying to calculate the Jacobian matrix of a quaternion $\vec{q}_k$ respect to its (supposed to be constant) angular velocity $\vec{\omega}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial \vec{q}_k}{\partial \vec{\omega}}(\vec q_{k-1})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a method that uses the chains rule:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial \vec{q}_k}{\partial \vec{\omega}} = \frac{\partial \vec{q}_k}{\partial \vec{qwt}}(\vec q_{k-1}) \frac{\partial \vec{qwt}}{\partial \vec{\omega}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\vec{qwt}$ is the quaternion form of the angular velocity. The first matrix is calculated with a matrix like this, where $q$ components are from $\vec q_{k-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial \vec{q}_k}{\partial \vec{qwt}}(\vec q_{k-1})=\begin{pmatrix} q_w&amp;amp;-q_z &amp;amp;q_y &amp;amp;q_x \\q_z&amp;amp;q_w &amp;amp;-q_x &amp;amp;q_y\\-q_y&amp;amp;q_x &amp;amp;q_w &amp;amp;q_z\\-q_x&amp;amp;-q_y &amp;amp;-q_z &amp;amp;q_w \end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't find how to calculate the secon partial. It looks more tricky. Any ideas about how to start?&lt;/p&gt;&#xA;" OwnerUserId="1473" LastEditorUserId="1473" LastEditDate="2012-07-13T15:33:01.363" LastActivityDate="2012-07-13T15:33:01.363" Title="Jacobian Matrix of a Quaternion $q$ respect to Angular Velocity $\omega$" Tags="|computer-vision|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2878" PostTypeId="1" AcceptedAnswerId="2879" CreationDate="2012-07-13T12:52:57.683" Score="4" ViewCount="1663" Body="&lt;p&gt;Using an inexpensive SDR (such as the USRP or Per Vices Phi), I want to process two or more communication protocols at the same time (e.g. WiFi and GSM). Is it possible to Tx (or Rx) both at the same time, like FDMA, or would they need to do some fast switching between modulations and frequencies, like TDMA? I'm not sure if the receiver would be able to accept it though since it is not expecting TDMA. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think FDMA would be the best approach, but like I said the question is whether or not it's possible to construct a waveform that can transmit both protocols simultaneously. I think it may also depend on frequency separation, combined bandwidths, mutual sample rate, etc.&lt;/p&gt;&#xA;" OwnerUserId="1530" LastEditorUserId="1530" LastEditDate="2017-07-28T15:28:39.697" LastActivityDate="2017-07-28T15:28:39.697" Title="Is it possible to transmit and/or receive multiple types of signals at the same time?" Tags="|frequency-spectrum|digital-communications|modulation|software-implementation|software-defined-radio|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="2879" PostTypeId="2" ParentId="2878" CreationDate="2012-07-13T14:16:00.893" Score="4" Body="&lt;p&gt;Theoretically it's possible to do a frequency multiplex of two different protocols with one SDR transmitter. However, the practical main limitation is the speed of the digital-to-analog converter (DAC). E.g. for a WLAN and GSM band the channels that are closest on the frequency axis are at 1800 MHz and 2412 MHz, respectively. For generating such a signal you'd need a sampling rate of over 1200 MSa/s. Even if you find an SDR device that is equipped with an DAC that fast, it will be very challenging to filter the aliasing spectra generated by the DAC in order to avoid out-of-band radiation. So your sampling rate has to be even higher in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to transmit two independent data streams at bands very close to another, OFDM can be advantageous because of it's narrow-band characteristic. If the modulation is synchronized, the bands can even overlap. The latter is an case without practical relevance, though.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2012-07-13T14:29:15.407" LastActivityDate="2012-07-13T14:29:15.407" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2880" PostTypeId="1" CreationDate="2012-07-13T18:22:31.080" Score="10" ViewCount="371" Body="&lt;p&gt;I am working on a project in Python to detect and classify some bird song, and I have found myself in a position where I need to convert a wave file into frequency vs. time data. This hasn't been too much of a problem, but to be able to classify the different syllables into groups, I need to write something that will detect when the data clusters into a certain shape. To give you an idea of what the data looks like, here is an image of how the data looks when plotted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DkdHr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need some way to get each individual syllable (each shape with a separation on either side) and save them either to a variable or to their own files so that I can run Pearson correlation between them using SciPy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I prefer Python, but I am open to coding in other languages if you have another way to do it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1677" LastEditorUserId="6" LastEditDate="2012-07-13T20:48:14.590" LastActivityDate="2012-07-14T14:15:09.230" Title="Recognizing data clustered into shapes" Tags="|audio|python|wave|classification|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2881" PostTypeId="2" ParentId="2878" CreationDate="2012-07-14T00:02:07.567" Score="1" Body="&lt;p&gt;Given sufficient input bandwidth to cover all your signals, this depends strictly on how much processor performance each filter, demodulator and/or modulator takes.  If you can run 20 filters and demodulators simultaneously in 20 threads in real-time on your processor(s), and the modulation and power of each signal provides a sufficient S/N ratio, you should be able to receive 20 signals at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not that much different from running 20 radios, each tuned to a completely different station, but all attached to the same antenna.  Just the digital equivalent (or simulation), given sufficient processor performance and input bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-07-14T00:02:07.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2882" PostTypeId="1" AcceptedAnswerId="2883" CreationDate="2012-07-14T00:22:37.137" Score="2" ViewCount="436" Body="&lt;p&gt;I am looking for a pitch detection algorithm that uses the least number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't care about the processing time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope to use this on audio signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using the one at the end of &lt;a href=&quot;http://online.physics.uiuc.edu/courses/phys193/NSF_REU_Reports/2005_reu/Real-Time_Time-Domain_Pitch_Tracking_Using_Wavelets.pdf&quot; rel=&quot;nofollow&quot;&gt;http://online.physics.uiuc.edu/courses/phys193/NSF_REU_Reports/2005_reu/Real-Time_Time-Domain_Pitch_Tracking_Using_Wavelets.pdf&lt;/a&gt; but the sample size to get a decent estimate is very high (maybe 4096 to lock a 440hz A note which is worse then my FFT)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming super resolution I hope be predicting within +/- 2hz. So that a 440hz tone can register as no worse then 438hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edited: super resolution range. &lt;/p&gt;&#xA;" OwnerUserId="941" LastEditorUserId="941" LastEditDate="2012-07-15T06:07:05.220" LastActivityDate="2012-07-17T19:36:02.543" Title="Pitch detection algorithm for minsample size" Tags="|wavelet|music|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2883" PostTypeId="2" ParentId="2882" CreationDate="2012-07-14T03:42:56.870" Score="4" Body="&lt;p&gt;Consider trying an upsampled or interpolated ASDF, AMDF, autocorrelation or other similar periodicity estimation algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There in an information theoretic time versus frequency resolution versus noise trade-off.  At a sample rate of 44100, estimating 440 Hz +-2 Hz might require somewhere in the range of 2 to 6 times 44100/440 samples (to determine the existance of periodicity or pitch) up to 2.5 to 4 times 44100/2 samples (to separate 2 spectral lobes), depending on the S/N ratio, and whether that noise environment requires windowing, or allows sub-sample or sub-bin interpolation in your periodicity estimator and/or FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, &quot;super resolution&quot; for tuners is usually considered to be +-1 cent or better, even though this is below normal human audibility except for beating.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-07-17T19:36:02.543" LastActivityDate="2012-07-17T19:36:02.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2884" PostTypeId="2" ParentId="2875" CreationDate="2012-07-14T04:48:38.997" Score="3" Body="&lt;p&gt;Yes, this is quite a studied problem in certain fields. I co-own a patent on it and we used one out of many approaches. We broke the problem into a feature extraction step and then a classification step. Some features can be the bandwidth, the continuity of the phase, the amount of phase clusters for digital modulation, etc. Then we used a Mahalanobis distance comparison to known modulations. I've also seen linear discriminants and neural networks used to process the features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Certain modulations also exhibit certain shapes once you square them, cube them, etc. and then compute the power spectral density. Often if you do an FM or AM demodulation you can see spectral lines for digital modulations. Cyclostationary computations can also be helpful in digital modulation detection. The post above is right in regards to the search topic: &quot;modulation classification&quot;&lt;/p&gt;&#xA;" OwnerUserId="1678" LastActivityDate="2012-07-14T04:48:38.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2885" PostTypeId="1" CreationDate="2012-07-14T06:34:36.223" Score="7" ViewCount="16526" Body="&lt;p&gt;I've tried looking around for information on this, but I'm really out of my league here. I'm a guy who likes to fool around with Python, and I wanted to make a program that would filter an audio file. I'm using Python and NumPy, with the scipy.io.wavfile module for importing and exporting Wave files. I've gotten it messing around with volume, but not filtering. Here's what I have so far.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rate, data = wavfile.read('./TriLeftChannel.wav') &#xA;&#xA;filtereddata = numpy.fft.rfft(data) # FFT Filtered data&#xA;freqdata = numpy.fft.fftfreq(data.size) #Frequency data&#xA;filtereddata = AudioFunctions.Filter(filtereddata, freqdata, data, rate) # Filter the data&#xA;&#xA;def Filter(filtereddata, freqdata, data, rate):&#xA;&#xA;    #fftchunks = (rate / 2)# + 1&#xA;&#xA;    x = freqdata[:len(data) / 2]&#xA;&#xA;    for f in range(len(x)):&#xA;&#xA;        if x[f] &amp;gt; 0.1:&#xA;            filtereddata[f] = 0.0&#xA;            filtereddata[len(data) / 2 + f] = 0.0       &#xA;&#xA;    return filtereddata&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In that function, filtereddata is the FFT'd data, freqdata is the frequency data that I got with fftfreq(), and data is the wave file itself, 'bare'. Rate is the sampling rate (though I don't use it). This function doesn't actually filter the frequencies (although I know it's a hard filter and no filter should really be this harsh). After I'm done, I output the file with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filteredwrite = numpy.fft.irfft(filtereddata)&#xA;&#xA;filteredwrite = numpy.round(filteredwrite).astype('int16') # Round off the numbers, and get ready to save it as 16-bit depth file (?)&#xA;&#xA;wavfile.write('TestFiltered.wav', rate, filteredwrite)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since I'm kind of struggling even just to have gotten this far, I was wondering if anyone could give me any pointers or a kind of beginners' tutorial for FFT? Of course, any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Fixed indentation issues.&lt;/p&gt;&#xA;" OwnerUserId="1679" LastEditorUserId="4346" LastEditDate="2017-01-05T04:14:48.303" LastActivityDate="2017-01-05T04:14:48.303" Title="Beginner Attempting FFT Signal Filtering With Numpy" Tags="|fft|filters|python|fast-convolution|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2886" PostTypeId="2" ParentId="2885" CreationDate="2012-07-14T14:00:47.827" Score="6" Body="&lt;p&gt;I have had good time implementing what this guy says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://mpastell.com/2010/01/18/fir-with-scipy/&quot;&gt;http://mpastell.com/2010/01/18/fir-with-scipy/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A typical low pass filter I use, got from the given link, is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def firfilt(interval, freq, sampling_rate):&#xA;    nfreq = freq/(0.5*sampling_rate)&#xA;    taps =  sampling_rate + 1&#xA;    a = 1&#xA;    b = scipy.signal.firwin(taps, cutoff=nfreq)&#xA;    return scipy.signal.lfilter(b, a, interval)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-07-14T14:00:47.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2887" PostTypeId="2" ParentId="2880" CreationDate="2012-07-14T14:09:16.897" Score="2" Body="&lt;p&gt;Two questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1/ Near 8s, we can observe a stable pitch for 100ms or so, then a sudden increase dropping until 8.5s. Does this whole sequence (8s to 8.5s) form a single entity, or do you consider the two stages (stable then decrease) to be two entities?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2/ Do you want to work with or without supervision. Do you know in advance the &quot;patterns&quot; to look for?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you want to work without supervision (say you have gathered recordings and aim at extracting a &quot;structured representation&quot; from it), your problem is akin, in a first step, to voice activity detection. Just use signal intensity, maybe in conjunction with a &quot;pitchiness&quot; metric (say the ratio of the maximum of the autocorrelation in the brid range, 1kHz - 5kHz here) to detect segments where there is an active strong pitched tone. Median-filter the resulting sequence to smooth it, and then threshold it to get the different segments. Once you have broken down your signal into segments, you can do interesting things with them. For example, you could extract for each of them a pitch trajectory (a sequence with the strongest frequency peak for each FFT frame, or something more robust extracted with a true pitch estimator), use DTW to compute a matrix of pairwise distances between each block, and use a clustering algorithm (k-means, agglomerative clustering) to identify groups of similar pitch patterns (the 8:8.5 and 10:10.5 segments). It is likely that an unsupervised approach will over-segment - for example 7.6:8.5 and 9.6:10.5 will be recognized as the repetition of the two same blocks, while to you they could fundamentally be one single pattern, but you could use something like &lt;a href=&quot;http://sequitur.info/&quot; rel=&quot;nofollow&quot;&gt;Sequitur&lt;/a&gt; to have one level of structure higher.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have a predefined dictionary of &quot;patterns&quot; you want to label your signal with, you'd better follow the kind of approaches used for speech recognition, with the only major difference that speech recognition does not take pitch into account, while in your case pitch is the sole information to be considered! A speech recognition system tackles both the segmentation and recognition tasks in one single FST decoding operation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-07-14T14:15:09.230" LastActivityDate="2012-07-14T14:15:09.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2888" PostTypeId="2" ParentId="2885" CreationDate="2012-07-14T15:08:51.553" Score="6" Body="&lt;p&gt;Linear FIR filters are applied to a signal (like your audio file) using &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution#Discrete_convolution&quot;&gt;discrete convolution&lt;/a&gt;. Convolution can be implemented efficiently using the FFT. Two separate schemes for doing this are called the &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot;&gt;overlap-save&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot;&gt;overlap-add&lt;/a&gt; methods. I personally prefer overlap-save, as it's a bit simpler to implement. It's not clear from your question exactly what you're getting hung up on. You should have all the high-level tools with NumPy that allow you to readily put together the OLS or OLA algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the techniques are pretty simple, it pays to try to get a basic understanding of what's happening under the hood and why they work. For a good introductory DSP book, I would recommend &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0137027419&quot;&gt;Lyons' DSP book&lt;/a&gt;. Alternatively, there is an online book called &lt;a href=&quot;http://www.dspguide.com/&quot;&gt;&quot;The Scientist and Engineer's Guide to Digital Signal Processing&quot;&lt;/a&gt; that I've heard good things about (you can't beat the price).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-07-14T15:08:51.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2889" PostTypeId="2" ParentId="2564" CreationDate="2012-07-14T15:34:04.483" Score="14" Body="&lt;p&gt;If you are not worried about the speed or exact contour of hand, below is a simple solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method is like this : You take each contour and find distance to other contours. If distance is less than 50, they are nearby and you put them together. If not, they are put as different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So checking distance to each contour is a time consuming process. Takes a few seconds. So no way you can do it real time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, to join contours, I put them in a single set and drew a convex hull for that set. So the result you are getting is actually a convex hull of hand, not real hand. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my piece of code in OpenCV-Python. I haven't gone for any optimization, just wanted it to work, that's all. If it solves your problem, go for optimization.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cv2&#xA;import numpy as np&#xA;&#xA;def find_if_close(cnt1,cnt2):&#xA;    row1,row2 = cnt1.shape[0],cnt2.shape[0]&#xA;    for i in xrange(row1):&#xA;        for j in xrange(row2):&#xA;            dist = np.linalg.norm(cnt1[i]-cnt2[j])&#xA;            if abs(dist) &amp;lt; 50 :&#xA;                return True&#xA;            elif i==row1-1 and j==row2-1:&#xA;                return False&#xA;&#xA;img = cv2.imread('dspcnt.jpg')&#xA;gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)&#xA;ret,thresh = cv2.threshold(gray,127,255,0)&#xA;contours,hier = cv2.findContours(thresh,cv2.RETR_EXTERNAL,2)&#xA;&#xA;LENGTH = len(contours)&#xA;status = np.zeros((LENGTH,1))&#xA;&#xA;for i,cnt1 in enumerate(contours):&#xA;    x = i    &#xA;    if i != LENGTH-1:&#xA;        for j,cnt2 in enumerate(contours[i+1:]):&#xA;            x = x+1&#xA;            dist = find_if_close(cnt1,cnt2)&#xA;            if dist == True:&#xA;                val = min(status[i],status[x])&#xA;                status[x] = status[i] = val&#xA;            else:&#xA;                if status[x]==status[i]:&#xA;                    status[x] = i+1&#xA;&#xA;unified = []&#xA;maximum = int(status.max())+1&#xA;for i in xrange(maximum):&#xA;    pos = np.where(status==i)[0]&#xA;    if pos.size != 0:&#xA;        cont = np.vstack(contours[i] for i in pos)&#xA;        hull = cv2.convexHull(cont)&#xA;        unified.append(hull)&#xA;&#xA;cv2.drawContours(img,unified,-1,(0,255,0),2)&#xA;cv2.drawContours(thresh,unified,-1,255,-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Below are the results i got :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xhvJk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wShmM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="818" LastEditorUserId="26407" LastEditDate="2020-01-15T18:16:20.683" LastActivityDate="2020-01-15T18:16:20.683" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2890" PostTypeId="2" ParentId="2885" CreationDate="2012-07-14T15:54:07.483" Score="8" Body="&lt;p&gt;Two potential problems with your approach:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You are computing the FFT on your whole signal, which will be terribly inefficient if your input data gets too large, and prevents you from using windowing. If you want to do frequency-domain modifications of your signal, consider using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot;&gt;Short-Term Fourier Transform&lt;/a&gt;, processing the resulting FFT frames, and resynthesizing a time-domain signal using overlap-add.&lt;/li&gt;&#xA;&lt;li&gt;FFT -&gt; zeroing FFT coefficients -&gt; IFFT, especially without windowing of the input data, is seldom used for filtering as it will yield a filter with many unwanted characteristics (side-lobes + non-causal).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A potential problem in your code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why you zero the &lt;code&gt;filtereddata[len(data) / 2 + f]&lt;/code&gt; coefficients. I assume it's intended to zero the &quot;negative frequencies&quot; but then the array index is wrong, and you are using &lt;code&gt;numpy.fft.rfft&lt;/code&gt; which has a different output layout from &lt;code&gt;numpy.fft.fft&lt;/code&gt; (FFT coefficients for negative frequencies are not returned). I'm surprised this runs at all, your code should actually cause an index out of bounds error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My suggestion would be for you to learn about FIR / IIR filters, design a suitable filter matching your constraints, and apply it to your data. There is a well-established body of work, software tools and practices on FIR / IIR filters and their design. Once you have the coefficients, for small sequences and/or if complexity is not an issue, there's &lt;code&gt;scipy.signal.lfilter&lt;/code&gt; to do the job. As suggested by Jason R, applying a long FIR can be made very efficient computationally with FFTs + overlap-add.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-14T15:54:07.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2891" PostTypeId="1" AcceptedAnswerId="2892" CreationDate="2012-07-15T01:36:07.853" Score="2" ViewCount="516" Body="&lt;p&gt;I'm interested in learning how telephones work, so I did a little bit of reading about signal processing. When I came up with the word convolution, I quickly realized the importance of this term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To begin with, I want to know how classic analog telephones worked. The apparent simplicity of their design appeals to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of circuit was responsible for convoluting the microphone impulses in a classic telephone receiver, so that this signal could be transmitted over wires?.&lt;/p&gt;&#xA;" OwnerUserId="200" LastActivityDate="2012-07-19T17:05:22.383" Title="What type of circuit is responsible for convolution in the classic analog telephone?" Tags="|convolution|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2892" PostTypeId="2" ParentId="2891" CreationDate="2012-07-15T02:40:56.243" Score="12" Body="&lt;p&gt;Convolution is a mathematical abstraction describing how a linear, time-invariant system affects a signal going through it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes one explicitly designs a system to convolve a signal by a predefined impulse response (for example when building a digital filter); but more often than not, convolution is used to &lt;em&gt;model&lt;/em&gt; various physical processes involved in a system. These physical processes can be transmission delays or dispersions, the limited bandwidth of an amplifier, transmission medium or electro-mechanical system, the explicit use of passive R, L, C network to achieve some filtering, etc... Thus, it might not be out of place to find convolution used in the description of some elements of a telephone system, but it's a modeling tool, not an actual process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an analogy: the trajectory of a cannonball is a parabola, but it makes little sense to ask which mechanical device in a cannon is responsible for computing $y = ax^2 + b$.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-15T02:40:56.243" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2893" PostTypeId="1" CreationDate="2012-07-15T06:25:46.570" Score="10" ViewCount="2941" Body="&lt;p&gt;Can you give me some advices on what could be the best algorithm(s) to use for detection of fingertips/nails in image. First thing that crossed my mind was &lt;a href=&quot;http://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework&quot; rel=&quot;noreferrer&quot;&gt;Viola - Jones&lt;/a&gt;. After rethinking I concluded that maybe it would be possible to use just Hugh transformation after applying edge detection. But I'd like some more advices. Also, as this is going to be a student's project with a purpose of learning, I'am not allowed to use OpenCV or similar frameworks. Below is typical image that will be processed. (note it's not top-down view). There is no need for thumb detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.deviantpics.com/images/BwgPX.jpg&quot; rel=&quot;noreferrer&quot;&gt;typical image http://www.deviantpics.com/images/BwgPX.jpg&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="Srđan" LastActivityDate="2012-07-15T14:36:52.617" Title="Algorithms for detection of fingertips or nails" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2894" PostTypeId="2" ParentId="2893" CreationDate="2012-07-15T08:32:53.923" Score="3" Body="&lt;p&gt;I would consider using neural network or SVM to fit the model. The difficulty with this approach is that you must collect a lot of data - both positive and negative examples. But you can generate a lot of artificial data(by scaling or rotating images you have already collected). After you collect data you can use &quot;moving window&quot; of few sizes to detect nails on images not present in training set.&#xA;I don't know how much time you want to spend doing the project. But implementing efficient learning algorithm yourself is difficult. However there is already &lt;a href=&quot;http://www.csie.ntu.edu.tw/~cjlin/libsvm/&quot; rel=&quot;nofollow&quot;&gt;library for SVM&lt;/a&gt; which I would use for this purpose. &lt;/p&gt;&#xA;" OwnerUserId="1682" OwnerDisplayName="Michał Szczygieł" LastActivityDate="2012-07-15T08:32:53.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2895" PostTypeId="2" ParentId="2893" CreationDate="2012-07-15T12:52:25.127" Score="2" Body="&lt;p&gt;I have used Viola-Jones in OpenCV which was Haar. It is really powerful, based on wavelet, more than what I expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is this the typical image you are targeting? What if the fingers out-stretched or straightened? or tilted? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to clearly define your domain.&lt;/p&gt;&#xA;" OwnerDisplayName="Aliostad" LastActivityDate="2012-07-15T12:52:25.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2896" PostTypeId="1" AcceptedAnswerId="3101" CreationDate="2012-07-15T17:38:19.630" Score="6" ViewCount="1185" Body="&lt;p&gt;I am implementing a Flanger using a fractional delay line.  I am modulating the length of the delay line using a sin function.  The delay line already uses linear interpolation to compute the delay output for the fractional sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the delay length is decreasing (and pitch is increasing), the modulated length sounds just about perfect, with no artifacts.  However, when the delay length is increasing (and pitch is decreasing), I am getting a kind of &quot;zipper&quot; effect, with intermittent clicks, that one would expect from a non-interpolated delay line, as if sharp edges are being produced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that I need to do additional interpolation beyond the simple fractional interpolation, but I have some questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, why would I only hear artifacts during the period where my modulated delay length is decreasing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, what is the best method to reduce these artifacts?  My first instinct is an all-pass filter, but is it typical to use an all-pass filter as well as an interpolation over a fractional delay length?  I just want to make sure I'm getting it right, and not wasting unnecessary cpu cycles :).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some code will help.  In this code, config holds all delay line info, and delaySamples is the current working length of the delay line.  There are two read pointers, two write pointers, and two feedback values - one for each channel.  Thanks for taking a look!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void delayconfig_setDelayTime(DelayConfig *config, float delay) {&#xA;    config-&amp;gt;delayTime = delay &amp;gt; 0 ? (delay &amp;lt;= 1 ? delay : 1) : 0;&#xA;    if (config-&amp;gt;delayTime &amp;lt; 0.0001) config-&amp;gt;delayTime = 0.0001;&#xA;    config-&amp;gt;delaySamples = config-&amp;gt;delayTime*SAMPLE_RATE;&#xA;    int channel;&#xA;    float *rp, *wp;&#xA;    pthread_mutex_lock( &amp;amp;delayMutex);&#xA;    for (channel = 0; channel &amp;lt; 2; channel++) {&#xA;        rp = &amp;amp;(config-&amp;gt;rp[channel]);&#xA;        wp = &amp;amp;(config-&amp;gt;wp[channel]);&#xA;        *rp = *wp - config-&amp;gt;delaySamples;&#xA;        while (*rp &amp;lt; config-&amp;gt;delaySamples) {&#xA;            *rp += config-&amp;gt;delaySamples;&#xA;        }&#xA;     }&#xA;     pthread_mutex_unlock( &amp;amp;delayMutex);&#xA;}&#xA;&#xA;float interp(float *delayBuffer, float delaySamples, float position) {&#xA;    position = fmod(position, delaySamples);&#xA;    int prev = floorf(position);&#xA;    int next = fmod(ceilf(position), delaySamples);&#xA;    float frac = position - prev;&#xA;    return delayBuffer[prev] + frac*(delayBuffer[next] - delayBuffer[prev]);&#xA;}&#xA;&#xA;void delay_process(void *p, float **buffers, int size) {&#xA;    DelayConfig *config = (DelayConfig *)p;&#xA;    float out;  &#xA;    int channel, samp;&#xA;    float *wp, *rp;&#xA;    for (channel = 0; channel &amp;lt; 2; channel++) {&#xA;        rp = &amp;amp;(config-&amp;gt;rp[channel]);&#xA;        wp = &amp;amp;(config-&amp;gt;wp[channel]);&#xA;        for (samp = 0; samp &amp;lt; size; samp++) {&#xA;            // here is where I'm changing my delay length.  The values are tentative while I'm figuring this out, and aren't really improtant.&#xA;            // The important thing is thing is that it's a sin function&#xA;            delayconfig_setDelayTime(config, 0.0061f + 0.006f*sin(M_PI*config-&amp;gt;count++*INV_SAMPLE_RATE));&#xA;            pthread_mutex_lock(&amp;amp;delayMutex);&#xA;            if (*rp &amp;gt;= config-&amp;gt;delaySamples) (*rp) -= config-&amp;gt;delaySamples;&#xA;            if (*wp &amp;gt;= config-&amp;gt;delaySamples) (*wp) -= config-&amp;gt;delaySamples;&#xA;            float interpolated = interp(config-&amp;gt;delayBuffer[channel], config-&amp;gt;delaySamples, (*rp)++);&#xA;            int wpi = floorf((*wp)++);&#xA;            pthread_mutex_unlock(&amp;amp;delayMutex);&#xA;            out = interpolated*config-&amp;gt;wet + buffers[channel][samp]*(1 - config-&amp;gt;wet);&#xA;            if (out &amp;gt; 1) out = 1;&#xA;            config-&amp;gt;delayBuffer[channel][wpi] = buffers[channel][samp] + out*config-&amp;gt;feedback[channel];         &#xA;            buffers[channel][samp] = out;&#xA;        }&#xA;    }&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1683" LastEditorUserId="1683" LastEditDate="2012-07-15T18:09:42.493" LastActivityDate="2015-02-19T17:00:10.807" Title="How to prevent &quot;zipping&quot; effect on a modulated fractional audio delay line? (Flanger)" Tags="|filters|audio|interpolation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2897" PostTypeId="1" AcceptedAnswerId="2901" CreationDate="2012-07-15T19:29:51.810" Score="12" ViewCount="2761" Body="&lt;p&gt;I'm learning about sampling and DSP on my own. I have a hard time to understand how the quantization error results in noise. I think I miss a fundamental understanding but can't tell what it is. So how does the quantization error generate noise?&lt;/p&gt;&#xA;" OwnerUserId="1684" LastActivityDate="2017-03-17T12:27:10.557" Title="How does the quantization error generate noise?" Tags="|noise|sampling|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2898" PostTypeId="2" ParentId="2897" CreationDate="2012-07-15T19:54:27.777" Score="10" Body="&lt;p&gt;&quot;Noise&quot; in this context refers to anything unwanted added to the signal, it doesn't necessarily mean it is gaussian noise, white noise, or any random well-described process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of quantization, it is a purely algebraic argument. One can view quantization as the addition of an unwanted signal (&quot;noise&quot;) equal to... the difference between the original signal and the quantized signal. Note that this quantification noise is not random, and is correlated with the input signal. For example, if a signal is periodic, the quantization noise introduced when quantizing it will be periodic too.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-15T19:54:27.777" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2899" PostTypeId="2" ParentId="2897" CreationDate="2012-07-15T20:14:31.957" Score="4" Body="&lt;p&gt;To expand on what pichenettes said, consider if you have an audio signal that is being digitized by a D-to-A converter that only has a resolution of 0.01 volt.  If, at some particular instant in time, the audio signal is at 7.3269 volts, that will be either rounded to 7.33 volts or truncated to 7.32 volts (depending on the design of the converter).  In the first case you've added &quot;noise&quot; of 7.33-7.3269 volts, or 0.0031 volt.  In the second case you've added &quot;noise&quot; of 7.32-7.3269 volts, or -0.0069 volt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, there is additional noise added due to the fact that the converter is most certainly not infinitely accurate, and probably has an accuracy on par with its precision.&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-07-15T20:14:31.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2900" PostTypeId="2" ParentId="2833" CreationDate="2012-07-16T00:16:47.553" Score="3" Body="&lt;p&gt;Some code in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;i = ColorNegate@Import@&quot;https://i.stack.imgur.com/Jlhgw.jpg&quot;;&#xA;i3 = DeleteSmallComponents[Binarize[i, .4], 10];&#xA;lines = ImageLines[i3, .6];&#xA;Show[i, Graphics[{Thick, Orange, Line /@ lines}]]&#xA;(*y coord mean increments at x=0 *)&#xA;b = Mean@Differences@ Sort[(#[[2, 1]] #[[1, 2]] - #[[1, 1]] #[[2, 2]])/(#[[1,1]] - #[[2, 1]]) &amp;amp; /@ lines];&#xA;(*mean slope*)&#xA;a = Mean[-(-#[[1, 2]] + #[[2, 2]])/(#[[1, 1]] - #[[2, 1]]) &amp;amp; /@ lines];&#xA;(*Threads*)&#xA;- a ImageDimensions[i3][[1]]/b &#xA;(*yarns*)&#xA;2 ImageDimensions[i3][[2]]/b&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OuA8H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;34.5541&lt;br&gt;&#xA;  27.2259&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="61" LastEditorUserId="61" LastEditDate="2012-07-16T03:44:04.820" LastActivityDate="2012-07-16T03:44:04.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2901" PostTypeId="2" ParentId="2897" CreationDate="2012-07-16T08:48:06.630" Score="6" Body="&lt;p&gt;Suppose I have a multitone signal (six carriers, at ±1/1000, ±2/1000 and ±7/1000 of sampling frequency)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = (1:1000);&#xA;wave = sin(x/1000*2*pi) + sin(x/1000*2*pi*2) + sin(x/1000*2*pi*7);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is quantized using a 14-bit ADC&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wave_quant = round(wave * 16384) / 16384;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The difference &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wave_qnoise = wave_quant - wave;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives the quantization error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zJJIs.png&quot; alt=&quot;Quantization Noise by Time&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding spectrum&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wave_qnoise_freq = mag(fftshift(fft(wave_qnoise)) / sqrt(1000));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bJJBL.png&quot; alt=&quot;Quantization Noise by Frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;shows the generated noise floor across the entire spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumes that the quantization error does not introduce a bias. If the ADC always chooses the lower value&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wave_quant_biased = floor(wave * 16384) / 16384;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we get a quantization error that is no longer centered around zero&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wave_qnoise_biased = wave_quant_biased - wave;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YdAtq.png&quot; alt=&quot;Quantization Error with Bias by Time&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has a definite spike in the FFT in the DC bin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wave_qnoise_biased_freq = mag(fftshift(fft(wave_qnoise_biased)) / sqrt(1000));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/G7LAv.png&quot; alt=&quot;Quantization Error with Bias by Frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This becomes a real problem with e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Quadrature_amplitude_modulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quadrature Amplitude Modulation&lt;/a&gt;, where a DC offset in the demodulated signal corresponds to a sine wave at the demodulation frequency.&lt;/p&gt;&#xA;" OwnerUserId="1687" LastActivityDate="2012-07-16T08:48:06.630" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2902" PostTypeId="1" AcceptedAnswerId="2904" CreationDate="2012-07-17T06:12:40.660" Score="9" ViewCount="3023" Body="&lt;p&gt;I recently started playing with the Fourier transform (after spending a few weeks learning about the mathematics behind it). I decided to try hacking together a low-pass filter on the following sound bite: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;div class=&quot;soundcloud-embed&quot;&gt;&#xD;&#xA;            &lt;iframe src=&quot;https://w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/53115373?show_artwork=false&quot; width=&quot;640&quot; height=&quot;116&quot; scrolling=&quot;no&quot; frameborder=&quot;no&quot;&gt;&lt;/iframe&gt;&#xD;&#xA;            &lt;/div&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, I took the Fourier transform, zeroed out the highest 1/2 of the frequencies, and then took the inverse Fourier transform. This is what I got&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;div class=&quot;soundcloud-embed&quot;&gt;&#xD;&#xA;            &lt;iframe src=&quot;https://w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/53117797?show_artwork=false&quot; width=&quot;640&quot; height=&quot;116&quot; scrolling=&quot;no&quot; frameborder=&quot;no&quot;&gt;&lt;/iframe&gt;&#xD;&#xA;            &lt;/div&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is there that crackling noise?&lt;/p&gt;&#xA;" OwnerUserId="1658" LastEditorUserId="1658" LastEditDate="2012-07-17T06:23:38.823" LastActivityDate="2012-08-26T07:44:36.287" Title="Why Do I Get This Crackling Noise on Zeroing out the High Frequencies?" Tags="|fourier-transform|discrete-signals|sound|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2903" PostTypeId="2" ParentId="2902" CreationDate="2012-07-17T07:16:05.723" Score="7" Body="&lt;p&gt;First just a note, fourier transforms are not ideal for low/high pass filters. Butterworth filters are a good place to start and following that Chebyshev/Elliptical filters if you get more ambitious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like your are trying to implement an ideal filter. There is no way we can implement these 'brick-wall' filters where we cut off all frequencies above/below a given value. All well developed filters will taper from 1 to 0 around our cut-off frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideal filters are only possible theoretical and if you had a Continuous Fourier Transform your method above would work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we're doing Discrete Fourier Transforms so there is more to worry about.&#xA;Since I'm not sure the method of your implementation, I'll guess that you are doing windowing since just pulling out frequencies is a sure way to get crackling in a windowed DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When windowing in a DFT, one &lt;em&gt;might&lt;/em&gt; think that the frequency amplitudes between windows are relatively continuous. e.g. if the 400Hz frequency has an amplitude of 0.5 in the current window that in the next window the amplitude will be near 0.5.&#xA;This unfortunately is not true, so if we were to simply remove the 400Hz frequency from our DFT, we may hear loud pops or cracks between windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A small example:&#xA;Cut off rate is 600Hz&#xA;Window 1 is playing a sine of 800Hz&#xA;Window 2 connects 'continuously' with window 1 and plays 400Hz.&#xA;Then we will hear a pop between the window because window 1 will be silent and window 2 will turn on immediately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to keep in mind is that we can only represent a finite amount of frequencies with a DFT. If we have an audio file with a sine wave of a frequency between two of our discrete frequencies in our DFT, then we actually represent it with a lot of our discrete frequencies.&#xA;So even though an example audio file may contain a sine wave lower than our cutoff, if its frequency is inbetween our DFT frequencies than we might cut part of it out and distort it with the method above, since higher frequencies are necessary to represent the audio file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps&lt;/p&gt;&#xA;" OwnerUserId="1690" LastActivityDate="2012-07-17T07:16:05.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2904" PostTypeId="2" ParentId="2902" CreationDate="2012-07-17T12:28:14.097" Score="12" Body="&lt;p&gt;Two potential issues:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Doing filtering in the frequency domain (using an FFT) requires overlap-add, overlap-save, or a related algorithm. This is caused by the difference between linear and circular convolution. Otherwise you get time-domain aliasing&lt;/li&gt;&#xA;&lt;li&gt;Some of the noise sounds like simple clipping. Filtering can actually increase the time domain amplitude for some samples and if that exceeds the available range it either clips or wraps around.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-17T12:28:14.097" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2905" PostTypeId="1" AcceptedAnswerId="2906" CreationDate="2012-07-17T17:23:07.870" Score="7" ViewCount="2512" Body="&lt;p&gt;I'm reading &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/tutorials.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;opencv tutorials&lt;/a&gt; and I'm diving into histogram equalization. i have looked in &lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_equalization&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt;, there is a nice example that sums up exactly the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;original:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RvhgL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;equalized:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/17vjd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but for getting this result i would take a different approach: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;find the minimum and maximum in the original&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;normalize (remap) everything upon it. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;no histogram, no  cumulative distribution function. for sure a more stupid approach but i can't see the difference.. why use histogram equalization? can someone can help me in make the reason out?&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="80" LastEditDate="2016-05-02T14:07:26.670" LastActivityDate="2016-05-02T14:07:26.670" Title="importance of using histogram equalization" Tags="|equalization|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2906" PostTypeId="2" ParentId="2905" CreationDate="2012-07-17T17:25:03.990" Score="12" Body="&lt;p&gt;The difference is that with your method, if you imagine the histogram, you're simply going to stretch it to span from 0 to 255, but its shape will be preserved. Histogram equalization not only stretches your histogram, but also tries to make it flat, so that you get an approximately even distribution of pixels of every shade of gray.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of why one is better for certain applications than others, that's application specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some examples from &lt;a href=&quot;http://www.bruzed.com/2009/10/contrast-stretching-and-histogram-equalization/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bruzed&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Contrast stretching (your method):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VRfdF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Histogram equalization:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1AboU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the bulk of the pixels in the original image was gray, represented by a large peak in the middle. When you do contrast stretching, the peak is still there, even though your darkest pixel is now black and you brightest pixel is now white. By contrast (pun intended), using histogram stretching you get a much flatter histogram response. This actually increases the overall contrast of the image.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2012-07-17T17:57:47.583" LastActivityDate="2012-07-17T17:57:47.583" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2907" PostTypeId="1" CreationDate="2012-07-17T17:57:12.497" Score="4" ViewCount="1983" Body="&lt;p&gt;I have some time series datasets which are periodic, and I'd like to pick out the fundamental frequency of the data and take the average over a fundamental period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Would something simple like taking the FFT of the time series data and looking for the strongest peak frequency do the trick, or are there more complicated period detection algorithms out there? For what it's worth, I'm trying to do all this in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) There are some edge effects, particularly at the beginning of each data set. Would I have to take this into account?&lt;/p&gt;&#xA;" OwnerUserId="1576" LastEditorUserId="76" LastEditDate="2012-07-17T21:40:46.263" LastActivityDate="2012-07-18T02:40:40.780" Title="Periodicity and fundamental frequency detection algorithms" Tags="|frequency-spectrum|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2908" PostTypeId="2" ParentId="2902" CreationDate="2012-07-17T18:35:41.843" Score="4" Body="&lt;p&gt;It is indeed possible to do as you suggest but not without some side effects. Say we form a simple test signal $s(t) = s_\mathrm{low}(t) + s_\mathrm{high}(t)$ where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s_\mathrm{low}(t) = \cos(2\pi f_0 t) + \cos(2\pi f_1 t + \frac{\pi}{3})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s_\mathrm{high}(t) = \frac{1}{2} \cdot \cos(2\pi f_2 t + 0.2)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we say that both $f_0,f_1$ are below a chosen lowpass cut-off frequency $f_\mathrm{cut}$ such that $f_0 &amp;lt; f_1 &amp;lt; f_\mathrm{cut}$, and we choose $f_2 &amp;gt; f_\mathrm{cut}$.   We can of course choose the amplitudes as we wish and I have just chosen the ones above to keep things simple. By having two frequency contributions below the cut-off frequency and one above makes it easy to follow and compare the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following I assume that we have $N$ samples taken with the frequency $f_\mathrm{s} &amp;gt; 2\cdot f_2$.  In reality we choose $f_\mathrm{s} \gg 2\cdot f_2$ to make the observed signal smooth. It is also assumed that we only consider one bunch of data samples.  If you need to handle several time frames check the paper by Fred Harris named &quot;On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform&quot; from Proc. IEEE in 1978.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have combined a small Python program to illustrate some of the concepts - the code is pretty awful but I just took some old code that I had for similar problems.  Although there are hardly any comments it should be fairly easy to follow due to the small modules. The are two &lt;strong&gt;dft&lt;/strong&gt; / &lt;strong&gt;idft&lt;/strong&gt; functions; two functions &lt;strong&gt;fshiftn&lt;/strong&gt; / &lt;strong&gt;fshiftp&lt;/strong&gt; to frequency shift the signal i DFT domain for filtering; a function &lt;strong&gt;dftlpass&lt;/strong&gt; to perform the filtering in DFT domain; a function &lt;strong&gt;zpblpass&lt;/strong&gt; to do the filtering by use of a Butterworth filter; a function &lt;strong&gt;bbdftsig&lt;/strong&gt; to form the test signal and perform the filtering; and finally a small function &lt;strong&gt;plotsigs&lt;/strong&gt; to plot the signals.  At the end of the script, the different parameters are set and the different figures are made.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;&quot;&quot;&#xA;   Test of DFT versus scipy.signal.butter filtering with respect to&#xA;   signal reconstruction.&#xA;&#xA;&quot;&quot;&quot;&#xA;&#xA;# import ############################################################ import #&#xA;import matplotlib as mpl;   mpl.rcParams['backend'] = 'Agg'&#xA;import matplotlib.pyplot as mplpp&#xA;import matplotlib.mlab as mplml&#xA;import numpy as np&#xA;import scipy.signal as sps&#xA;&#xA;&#xA;# initialize #################################################### initialize #&#xA;try:&#xA;    mpl.rc('text', usetex=False)&#xA;    mpl.rc('font', family='serif')&#xA;    mpl.rc('font', serif='STIXGeneral')&#xA;    mpl.rc('font', size=8)&#xA;except AttributeError:&#xA;    None&#xA;&#xA;&#xA;# dft ################################################################## dft #&#xA;def dft(xt, fs, t0):&#xA;    N, d = len(xt), -2j*np.pi/len(xt)&#xA;    w = np.arange(N, dtype=np.float).reshape((N,1))&#xA;    c = np.exp(d*t0*fs*w)&#xA;    W = np.exp(d*np.dot(w,np.transpose(w)))&#xA;    xf = np.multiply(c,np.dot(W,xt)) / float(N)&#xA;    f = w*fs/float(N)&#xA;    return xf, f&#xA;&#xA;&#xA;# idft ################################################################ idft #&#xA;def idft( X, FS, T0 ):&#xA;    N, d = len(X), 2j*np.pi/len(X)&#xA;    w = np.arange(N, dtype=float).reshape((N,1))&#xA;    cc = np.exp(d*T0*FS*w)&#xA;    Wc = np.exp(d*np.dot(w, np.transpose(w)))&#xA;    Y = np.dot(Wc, np.multiply(cc, X))&#xA;    return Y&#xA;&#xA;&#xA;&#xA;# fshiftn ########################################################## fshiftn #&#xA;def fshiftn( xf, f ):&#xA;    assert type(f) == np.ndarray, &quot;f must be a np.ndarray&quot;&#xA;    assert f.shape[1] == 1, &quot;f must be a column array&quot;&#xA;    assert xf.shape[1] == 1, &quot;xf must be a column array&quot;&#xA;    assert sum(f&amp;lt;0) == 0, &quot;All frequency components must be 0 or positive&quot;&#xA;&#xA;    # Determine sampling rate, tolerance, and allocate output array&#xA;    fs, tol = len(f)*(np.abs(f[1,0]-f[0,0])), 1.E-2&#xA;    fshift = np.zeros((len(f),1), dtype=float)&#xA;    xfshift = np.zeros((len(f),1), dtype=complex)&#xA;&#xA;    # Determine index where f &amp;gt; fs/2&#xA;    Nm = np.floor(len(f)/2.0)&#xA;    Np = np.floor((len(f)-1.0)/2.0)&#xA;&#xA;    # Compute output frequency array such that -fs/2 &amp;lt;= f &amp;lt; fs/2 and the&#xA;    # corresponding Fourier coefficients&#xA;    fshift[:Nm,0] = f[Np+1:,0] - fs&#xA;    fshift[Nm,0] = f[0,0]&#xA;    fshift[Nm+1:,0] = f[1:Np+1,0]&#xA;&#xA;    xfshift[:Nm,0] = xf[Np+1:,0]&#xA;    xfshift[Nm,0] = xf[0,0]&#xA;    xfshift[Nm+1:,0] = xf[1:Np+1,0]&#xA;&#xA;    return xfshift, fshift&#xA;&#xA;&#xA;# fshiftp ########################################################## fshiftp #&#xA;def fshiftp(xf, f):&#xA;    assert type(f) == np.ndarray, &quot;f must be a np.ndarray&quot;&#xA;    assert f.shape[1] == 1, &quot;f must be a column array&quot;&#xA;    assert xf.shape[1] == 1, &quot;xf must be a column array&quot;&#xA;    assert sum(f&amp;lt;0) &amp;gt; 0, &quot;Some input frequencies must be negative&quot;&#xA;&#xA;    # Determine sampling rate, tolerance, and allocate output array&#xA;    fs, tol = len(f)*(np.abs(f[1,0]-f[0,0])), 1.E-2&#xA;    fshift = np.zeros((len(f),1), dtype=float)&#xA;    xfshift = np.zeros((len(f),1), dtype=complex)&#xA;&#xA;    # Determine index where f &amp;gt; fs/2&#xA;    #Nx = np.floor((len(f)+1+tol)/2)&#xA;    Nm = np.floor(len(f)/2.0)&#xA;    Np = np.floor((len(f)-1.0)/2.0)&#xA;&#xA;    # Compute output frequency array such that -fs/2 &amp;lt;= f &amp;lt; fs/2 and the&#xA;    # corresponding Fourier coefficients&#xA;    fshift[Np+1:,0] = f[:Nm:,0] + fs&#xA;    fshift[0,0] = f[Nm,0]&#xA;    fshift[1:Np+1:,0] = f[Nm+1:,0]&#xA;&#xA;    xfshift[Np+1:,0] = xf[:Nm:,0]&#xA;    xfshift[0,0] = xf[Nm,0]&#xA;    xfshift[1:Np+1:,0] = xf[Nm+1:,0]&#xA;&#xA;    return xfshift, fshift&#xA;&#xA;&#xA;# dftlpass ######################################################## dftlpass #&#xA;def dftlpass(xt, fs, fcut):&#xA;    # Perform Discrete Fourier Transform&#xA;    xf, f = dft(xt, fs, 0.0)&#xA;&#xA;    # Shift frequencies to -fs/2 &amp;lt;= f &amp;lt; fs/2 ... and coefficients&#xA;    xfshift, fshift = fshiftn(xf, f)&#xA;&#xA;    # Perform filtration&#xA;    xfshift = xfshift * (np.abs(fshift) &amp;lt;= fcut)&#xA;&#xA;    # Re-shift frequencies to 0 &amp;lt;= f &amp;lt; fs ... and coefficients&#xA;    xfrecon, frecon = fshiftp(xfshift, fshift)&#xA;&#xA;    # Perform inverse Discrete Fourier Transform&#xA;    yt = idft(xfrecon, fs, 0.0)&#xA;    return yt.real&#xA;&#xA;&#xA;# zpblpass ######################################################## zpblpass #&#xA;def zpblpass(xn, fcal, fs, fcut):&#xA;    bz, az = sps.butter(5, fcut/(fs/2))&#xA;&#xA;    # Gain calibration&#xA;    Ncal = np.max([np.int(20*fs/fcal), 30000])&#xA;    Nguard = np.int(0.1*Ncal)    &#xA;    t = np.arange(Ncal) / fs&#xA;    x0_cal = 1.0 * np.cos(2*np.pi*fcal*t)&#xA;    yi_cal = sps.filtfilt(bz, az, 2.0*x0_cal*np.cos(2*np.pi*fcal*t))&#xA;    k = 1.0/np.mean(yi_cal[Nguard:Ncal-Nguard])&#xA;&#xA;    # Scaled output&#xA;    yn = k * sps.filtfilt(bz, az, xn)&#xA;    return yn&#xA;&#xA;&#xA;# bbdftsig ######################################################## bbdftsig #&#xA;def bbdftsig(f0, f1, f2, fcut, fs, N):&#xA;    t = np.arange(N).reshape((N,1)) / fs&#xA;    s0 = np.sin(2*np.pi*f0*t)&#xA;    s1 = np.sin(2*np.pi*f1*t + 0.2)&#xA;    s2 = 0.7 * np.sin(2*np.pi*f2*t + np.pi/3.0)&#xA;    slow = s0 + s1&#xA;    s = slow + s2&#xA;&#xA;    sf = dftlpass(s, fs, fcut)&#xA;    sfdftv = sf.reshape((N))&#xA;    sv = s.reshape((N))&#xA;    slowv = slow.reshape((N))&#xA;&#xA;    sv = s.reshape((N))&#xA;    sfzpbv = zpblpass(sv, f1, fs, fcut)&#xA;    #sfzpbv = sfzpb.reshape((N))&#xA;    return sv, slowv, sfdftv, sfzpbv&#xA;&#xA;&#xA;# plotsigs ######################################################## plotsigs #&#xA;def plotsigs(s, slow, sfdft, sfzpb, Nstart, Nstop, fname):&#xA;    n = np.arange(s.shape[0])&#xA;&#xA;    # Plot results&#xA;    mplpp.figure(1, (5.0,2.25))&#xA;    mplpp.clf()&#xA;    mplpp.plot(n[Nstart:Nstop], s[Nstart:Nstop], 'm-',&#xA;               n[Nstart:Nstop:4], s[Nstart:Nstop:4], 'mx',&#xA;               n[Nstart:Nstop], slow[Nstart:Nstop], 'g-',&#xA;               n[Nstart:Nstop:10], slow[Nstart:Nstop:10], 'gx',&#xA;               n[Nstart:Nstop], sfdft[Nstart:Nstop], 'r-',&#xA;               n[Nstart:Nstop:15], sfdft[Nstart:Nstop:15], 'rx',&#xA;               n[Nstart:Nstop], sfzpb[Nstart:Nstop], 'b-',&#xA;               linewidth=1.5)&#xA;    mplpp.legend([r'$s$', r'$s$', r'$s_{\rm low}$', r'$s_{\rm low}$',&#xA;                  r'DFT', r'DFT', r'ZPB'], loc='upper right')&#xA;    mplpp.ylabel(r'Signal')&#xA;    mplpp.xlabel(r'$n$')&#xA;    #mplpp.axis([-10.0, 10.0, 1.0E-2, 1.0E2])&#xA;    mplpp.grid(True)&#xA;    mplpp.savefig(fname, dpi=600,&#xA;                bbox_inches='tight', pad_inches=0.05)&#xA;    mplpp.close()&#xA;&#xA;&#xA;# __main__ ######################################################## __main__ #&#xA;if __name__ == '__main__':&#xA;    # Initialize&#xA;    f0 = 3.0&#xA;    f1 = 11.5&#xA;    f2 = 20.0&#xA;    fcut = 15.0&#xA;    fs = 1000.0&#xA;    N = 5000&#xA;&#xA;    s, slow, sfdft, sfzpb = bbdftsig(f0, f1, f2, fcut, fs, N)&#xA;    n = np.arange(s.shape[0])&#xA;&#xA;    # Fig. 1: full data set&#xA;    Nstart = 0&#xA;    Nstop = N&#xA;    fname = 'full.pdf'&#xA;    plotsigs(s, slow, sfdft, sfzpb, Nstart, Nstop, fname)&#xA;&#xA;    # Fig. 2: beginning&#xA;    Nstart = 0&#xA;    Nstop = 150&#xA;    fname = 'beginning.pdf'&#xA;    plotsigs(s, slow, sfdft, sfzpb, Nstart, Nstop, fname)&#xA;&#xA;    # Fig. 3: middle&#xA;    Nstart = np.floor(N/2.0) - 75&#xA;    Nstop = Nstart + 100&#xA;    fname = 'middle.pdf'&#xA;    plotsigs(s, slow, sfdft, sfzpb, Nstart, Nstop, fname)&#xA;&#xA;    # Fig. 4: ending&#xA;    Nstart = N - 150&#xA;    Nstop = N&#xA;    fname = 'ending.pdf'&#xA;    plotsigs(s, slow, sfdft, sfzpb, Nstart, Nstop, fname)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Choosing $N=5000$ and $f_\mathrm{s} = 1000$ gives us a frequency resolution of $f_\mathrm{s}/N = 0.2\:$Hz. If we choose $f_0,f_1,f_2$ according to this we can get perfect agreement by choosing the frequencies as shown above.  If we first choose frequencies which are on the grid as $f_0=3$, $f_1=11$, $f_2=21$ and we have $f_\mathrm{cut}=15$ we get the first set of results. The first, middle and last parts of the relevant signals are shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wq03N.png&quot; alt=&quot;Beginning of signals - on-grid&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/29Ucn.png&quot; alt=&quot;Middle of signals - on-grid&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/D002l.png&quot; alt=&quot;Ending of signals - on-grid&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As seen from the figure we have the combined input $s$ as the magenta signal; the green signal as we can only see from the 'x' markings is $s_\mathrm{low}$ (the raw input signal when we simply only include the input signal below the cut-off frequency); the red signal is the one we get when using the DFT filtering; and the blue signal is the one we get from the Butterworth filter. As seen above we obtain perfect agreement between $s_\mathrm{low}$ and the DFT filtered signal - but the Butterworth filter has some impact on the in-band signal (in particular the component at $f_1$.  As is quite typical for this type of processing we have some differences at the beginning and end of the sequence due to edge effects and reasonably good agreement between both types of filtering in the middle section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we change the frequency $f_1$ to $f_1=11.5$ which is not on the frequency grid (and further it is quite close to the cut-off frequency) we see some different results as shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bnLiU.png&quot; alt=&quot;Beginning of signals - off-grid&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/efgLu.png&quot; alt=&quot;Middle of signals - off-grid&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/NixCe.png&quot; alt=&quot;Ending of signals - off-grid&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we see substantial differences between green, blue and red signals which in the ideal situation should be identical.  In the middle of the signal they all agree fairly well - the DFT and the reference $s_\mathrm{low}$ agree best though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in conclusion it is possible to use direct filtering by forcing Fourier coefficients to zero which is also done sometimes in compressive sensing to reduce the support of a signal to force sparsity on a signal.  However, there are consequences of this as increased errors in particular at the edges of the signal.  Further, the above is a best case where the entire signal is treated as one sequence.  If the signal must be split in time frames it gets complicated as we then need to consider some windowing or other technique to ensure continuity of the signal between frames.  So my advice is similar to some of the other posts in recommending to normally use a Butterworth / Elliptic / .. or whatever filter.&lt;/p&gt;&#xA;" OwnerUserId="1592" LastActivityDate="2012-07-17T18:35:41.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2909" PostTypeId="2" ParentId="2907" CreationDate="2012-07-17T18:42:54.190" Score="3" Body="&lt;p&gt;This is essentially the problem of &lt;a href=&quot;http://en.wikipedia.org/wiki/Pitch_detection_algorithm&quot; rel=&quot;nofollow&quot;&gt;Pitch Detection&lt;/a&gt;.  A fairly simple approach is to compute the autocorrelation (FFTs can be used to do this quickly),  and look for the peak with T &gt; T_min &lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2012-07-17T18:42:54.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2910" PostTypeId="2" ParentId="2876" CreationDate="2012-07-17T19:25:58.927" Score="1" Body="&lt;p&gt;You are trying to detect and reject abrupt changes in the 3x3 matrix, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of the 3x3 matrix as a 9 element vector space.  Apply smoothing on each of the 9 dimensions.  If the original 9 elements are not similar to the smoothed vector, then reject it and use the smoothed estimate (minus the contribution from the rejected one?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as how to judge similarity, I suppose the max distance would be appropriate if you expect individual elements to get corrupted. The Euclidean distance would be better if the entire 3x3 matrix gets corrupted.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2012-07-17T19:25:58.927" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2911" PostTypeId="2" ParentId="2902" CreationDate="2012-07-17T19:46:27.510" Score="0" Body="&lt;p&gt;Zeroing bins in an FFT can actually increase the amplitude of other frequencies near but not centered at the zero-ed bin or its adjacent bins.  This increase can cause clipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, if you are doing the FFT using un-zero-padded (and not overlap-added) blocks (as opposed to the entire song in one big FFT), any FFT data modifications will wrap around from the back to the front of the time domain sequence in each block, thus adding other weird discontinuities in the wrong places.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-07-17T19:46:27.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2912" PostTypeId="2" ParentId="2907" CreationDate="2012-07-17T19:56:33.057" Score="1" Body="&lt;p&gt;The strongest peak of an FFT is only good at periodicity estimation if you can absolutely guarantee that the fundamental frequency has more power than any overtone or harmonic.  This is not true for many types of phenomena that are periodic.  But if it is true, then windowing can help reduce edge effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, an FFT can be used as part of a more sophisticated periodicity or pitch detection/estimation method, such autocorrelation by fast convolution, or a cepstrum, or a harmonic product spectrum.  etc.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-07-18T02:40:40.780" LastActivityDate="2012-07-18T02:40:40.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2913" PostTypeId="1" CreationDate="2012-07-17T20:44:24.627" Score="2" ViewCount="69" Body="&lt;p&gt;In my computer-vision problem, a blob can move either forward or backwards (with a slight chance of moving sideways) along its directional axis. I am seeking a bivariate model because I need to determine whether a blob's new position (with respect to its old one) is &quot;feasible,&quot; or &quot;likely.&quot; However, the blob can not move extreme distances very quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, there is a high probability that the blob will not move very far if it does move (but still a sufficient amount such that the probability distribution will be elongated along one axis [not the orthogonal]).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am searching for a model that has high probability values within a smaller region, but has a larger encompassing region with small (and distinctly different) probability values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help!&lt;/p&gt;&#xA;" OwnerUserId="1695" LastEditorUserId="6" LastEditDate="2012-07-17T20:46:08.867" LastActivityDate="2012-07-17T20:46:08.867" Title="Predicting Positional Displacement with a Bivariate Gaussian Distribution" Tags="|computer-vision|statistics|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2914" PostTypeId="1" CreationDate="2012-07-18T02:08:33.733" Score="7" ViewCount="9593" Body="&lt;p&gt;I want to extract the envelope of music signals with a sample rate of 44.1kHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the MATLAB command:  &lt;code&gt;abs(hilbert(mysignals))&lt;/code&gt;, but the resulting signal is similar to the original signal, not the envelope. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does taking the Hilbert transform extract the envelope of an audio signal? Or is my calculation incorrect?&lt;/p&gt;&#xA;" OwnerUserId="1697" LastEditorUserId="76" LastEditDate="2012-07-18T02:40:03.563" LastActivityDate="2013-10-01T09:42:12.690" Title="Does taking the Hilbert transform extract the envelope of audio signals?" Tags="|music|transform|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2915" PostTypeId="1" CreationDate="2012-07-18T03:19:41.090" Score="14" ViewCount="7040" Body="&lt;p&gt;I am looking for a proof for sinusoidal fidelity. In DSP we study a lot about linear systems. Linear systems are homogenous and additive. One more condition it satisifies is that if a signal is a sine or cos wave then the output only changes the phase or amplitude. Why? Why cant the output be a totally different output when a sine wave is given as an input?&lt;/p&gt;&#xA;" OwnerUserId="1698" LastActivityDate="2012-07-25T16:11:59.857" Title="Why do linear systems show sinusoidal fidelity?" Tags="|convolution|continuous-signals|impulse-response|linear-systems|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2916" PostTypeId="2" ParentId="2915" CreationDate="2012-07-18T06:40:08.000" Score="5" Body="&lt;p&gt;Here's the idea of the proof. Let's assume we can describe the output of a system by a convolution, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = \int k_t(t-\tau) f(\tau) d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the function (aka &quot;kernel&quot;) $k_t(t)$ as I've written it here may &lt;em&gt;change&lt;/em&gt; as $t$ varies. However, we usually make an important assumption about $k_t(t)$ - that it doesn't change with time. This is called &quot;linear time-invariance&quot; (also check out the Wikipedia page on &lt;a href=&quot;http://en.wikipedia.org/wiki/Toeplitz_matrix&quot; rel=&quot;nofollow&quot;&gt;Toeplitz matrices&lt;/a&gt;). If our system is linear time-invariant, $k_t$ is the same for &lt;em&gt;any&lt;/em&gt; $t$, and so we'll just ignore the subscript and write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = \int k(t-\tau) f(\tau) d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's say $f(t)$ is a sinusoid, say $f(t) = e^{i\omega t}$. So, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = \int k(t-\tau) e^{i\omega \tau} d\tau = \int k(\tau) e^{i\omega (t-\tau)} d\tau = e^{i\omega t} \int k(\tau) e^{-i\omega \tau}d\tau&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the last equation has &lt;em&gt;no dependence on $t$&lt;/em&gt;! As a result, let's define $K(\omega) := \int k(\tau) e^{-i\omega \tau}d\tau$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, we've discovered that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = K(\omega) e^{i\omega t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or, in other words, $y(t)$ is a sinusoid oscillating &lt;em&gt;at the same frequency&lt;/em&gt; as the input, but weighted by a complex number $K(\omega)$ which is constant with respect to $t$ (and thus may shift the amplitude and phase of the output with respect to the input). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;EDIT: The comments noted this answer was pretty loose. My goal was to&#xA;  avoid details like different forms of the Fourier transform, but I&#xA;  ended up &lt;em&gt;conflating&lt;/em&gt; the Fourier and Laplace transforms. What I&#xA;  called Fourier transform previously was only the Fourier transform if&#xA;  $s$ was purely imaginary. I decided that clarifying this route would&#xA;  necessarily add too much notation, so I'm relegating it to italics.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;i&gt;&#xA;Now, take the Laplace transform, to end up with (since Laplace transform takes convolution to multiplication),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(s) = K(s) F(s)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if $f$ is a sinusoid, say $f(t)=e^{i\omega t}$, its Laplace transform is a delta function at that $\omega$. That is,  $F(s) = \delta_{w}(s)$. So, the Laplace transform of the output is also a delta function at that frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y(s) = K(s)\delta_\omega (s) = K(\omega) \delta_\omega(s)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $K(\omega)$ is just some complex number that depends on the input frequency, the output $y(t)$ will be a sinusoid with the same frequency as the input, but with potentially different amplitude and phase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, I just noticed you can find the same idea written &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory#Exponentials_as_eigenfunctions&quot; rel=&quot;nofollow&quot;&gt;out in the time domain at Wikipedia&lt;/a&gt;. A higher-level explanation (which you can ignore if it's too mathy) is that linear systems theory is defined through the convolution operation, which is diagonalized by the Fourier transform. Thus, a system whose input is an eigenvector of the Fourier transform operator will output only a scaled version of its input. &#xA;&lt;/i&gt;&lt;/p&gt;&#xA;" OwnerUserId="964" LastEditorUserId="964" LastEditDate="2012-07-19T01:35:15.583" LastActivityDate="2012-07-19T01:35:15.583" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2917" PostTypeId="2" ParentId="2915" CreationDate="2012-07-18T07:44:56.767" Score="2" Body="&lt;p&gt;Say we have a system with input $x_1(t)$ which generates the output $y_1(t) = {\cal G}(x_1(t))$, and with an input $x_2(t)$ we get the output $y_2(t) = {\cal G}(x_1(t))$. The system is linear if:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a\cdot x_1(t) + b\cdot x_2(t) \rightarrow y(t) = {\cal G}(a\cdot x_1(t) + b\cdot x_2(t)) = a\cdot {\cal G}(x_1(t)) + b\cdot {\cal G}(x_2(t)) = a\cdot y_1(t) + b\cdot y_2(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ and $b$ are (real or complex) constants. If the equations above are not fulfilled the system is nonlinear. The equation can be used for real and complex signals in time and frequency domains. This is the same as the superposition principle must be valid. As Sarwate illustrates in a comment this does not prevent the system from generating new frequencies. We are probably often just used to indirectly assume time invariance. The reason is likely that it is often possible to map a time varying system to a time invariant system by applying one or more external controlling signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the definition of linearity and further requiring a time invariant system we can directly see that two (or more signals) can not interfere and generate new frequency components while still complying with the linearity requirement. The principle of superposition also follows directly from the linearity definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also from the linearity definition the concept of convolution for linear time invariant systems follow. For nonlinear systems we for example have Volterra series which is a multi-dimensional convolution integral - the 1-dimensional convolution integral is a special case of the Volterra series. This is way more complicated than linear techniques though. But based on the convolution integral for a linear system the derivation follows the one shown by @sydeulissie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To demonstrate a simple counter example of a nonlinear relation where new frequencies are generated we could use ${\cal G}: y(t) = x^2(t)$. Let us first show that this is indeed nonlinear. If we apply the input $x_1(t)$ we get the output $y_1(t) = x_1^2(t)$ and if we apply the input $x_2(t)$ we get the output $y_2(t) = x_2^2(t)$. The output $y(t)$ is then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = \left\{ a\cdot x_1(t) + b\cdot x_2(t) \right\}^2 = a^2\cdot x_1^2(t) + b^2\cdot x_2^2(t) + 2\cdot a\cdot b \cdot x_1(t) \cdot x_2(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = a^2 \cdot y_1(t) + b^2 \cdot y_2(t) \pm 2\cdot a \cdot b \cdot \sqrt{y_1(t) \cdot y_2(t)} \neq a\cdot y_1(t) + b\cdot y_2(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we have thus proved $x^2$ to be nonlinear (which can hardly be surprising).  If we apply a single sinusoidal signal $x(t) = A\cdot \cos(2\pi f_0 t + \phi_0)$ to the system ${\cal G}$ we have the output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = x^2(t) = A^2 \cdot \cos^2(2\pi f_0 t + \phi_0) = \frac{A^2}{2} + \frac{A^2}{2}\cdot \cos(2\pi 2 f_0 t + 2\phi_0)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output here contains a DC component and another component at the frequency $2f_0$. The nonlinear function $x^2$ thus generates new frequency components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion it can be observed that a linear system may generate frequency components not present in the input (if the system is time variant). If the system is linear time invariant the output can not include frequency components not present in the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to @Sarwate for the most relevant comment.&lt;/p&gt;&#xA;" OwnerUserId="1592" LastEditorUserId="1592" LastEditDate="2012-07-18T17:41:06.527" LastActivityDate="2012-07-18T17:41:06.527" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2918" PostTypeId="1" AcceptedAnswerId="2920" CreationDate="2012-07-18T07:53:32.527" Score="8" ViewCount="207" Body="&lt;p&gt;I have long been faced with the confusion regarding entropy and would be obliged if the following are answered in less technical jargon. Following the link &lt;a href=&quot;https://stats.stackexchange.com/questions/322/good-introduction-into-different-kinds-of-entropy&quot;&gt;Different kinds of entropy&lt;/a&gt; raises the following questions&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Entropy- It is desired that the entropy of the system be maximized. Maximizing entropy means no symbol is better than the others or we do not know what the next symbol / outcome would be. However, the formula states a negative sign before the summation of the probability logarithms. Thus, it means we are maximizing a negative value!! Then if an original raw signal is quantized and the quantized information's entropy is calculated and found to be lesser than the original entropy would imply loss of information. So,why do we want to maximise entropy since it would mean that we are maximizing the uncertainty of the next symbol whereas we want to be certain about waht the next occurence of the symbol would be.&lt;/li&gt;&#xA;&lt;li&gt;What are the differences between Shannon's entropy, topological entropy and source entropy?&lt;/li&gt;&#xA;&lt;li&gt;What exactly is the significane of Kolgomorov complexity or Kolgomorov entropy. How is it related to Shannon's entropy?&lt;/li&gt;&#xA;&lt;li&gt;What information does mutual information between two vectors convey?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1699" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2012-07-18T15:51:19.050" Title="Issues related to entropy" Tags="|reference-request|information-theory|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2919" PostTypeId="2" ParentId="2914" CreationDate="2012-07-18T10:50:56.573" Score="17" Body="&lt;p&gt;That really depends on your definition of &quot;enevelope&quot; and what you need it for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform calculates the &quot;analytic&quot; signal, i.e. it calculates a matching imaginary part to a real signal by shifting the phase by 90 degrees in the frequency domain. It's reputation of calculating the &quot;envelope&quot; comes mainly from communication technology. It works very well with a narrow band signals, like amplitude or frequency or phase modulated signals. It's based on the simple fact that the analytic signal of a sine wave is a complex exponentional, the magnitude of which is 1. So the hilbert transform (or to be precise calculating the magnitude of the analytic signal) will eliminate the carrier quite well and leaves you with the modulation signal, or &quot;envelope&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For broad band music, this is mostly not the case and the analytic signal isn't particularly helpful. A cymbal crash is basically a noise burst. The hilbert transform of this is just another noise burst and so is the magnitude of the analytic signal. You can't eliminate a carrier, if there isn't one to start with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IF you are looking for something that roughly gives you &quot;perceived loudness as a function of time&quot;, there many different ways to do this from simple lossy peak detectors all the way to sophisticated perceptual algorithms including cochlea models, binaural &amp;amp; temporal masking, nerve excitation models etc. It really depends on your application.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-18T10:50:56.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2920" PostTypeId="2" ParentId="2918" CreationDate="2012-07-18T13:12:31.087" Score="8" Body="&lt;p&gt;I will try to tackle questions 1 and 4.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Entropy- It is desired that the entropy of the system be maximized. Maximizing entropy means no symbol is better than the others or we do not know what the next symbol / outcome would be. However, the formula states a negative sign before the summation of the probability logarithms. Thus, it means we are maximizing a negative value!!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, the values of the logarithms themselves are negative, so the negative sign makes them positive.  All probabilities are a real number from 0 to 1, inclusive.  The log of 1 is zero, and the log of anything less than 1 is negative.  This may seem problematic since the log of 0 is $-\infty$, but we are really trying to maximize the expected value of these logs, so when we multiply by the probability itself the entire value approaches 0, not $\infty$.  Entropy peaks when the probability is $1/2$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So,why do we want to maximise entropy since it would mean that we are maximizing the uncertainty of the next symbol whereas we want to be certain about waht the next occurence of the symbol would be.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, in communicating information we absolutely do NOT want to be certain about what the next symbol will be.  If we are certain, what information is gained by receiving it?  None.  It is only through uncertainty about what the transmitter will send that we can receive any information.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;4) What information does mutual information between two vectors convey?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When there is mutual information between two vectors knowing something about one tells you something about the other.  Mathematically this equates to the following- knowledge of one vector affects the probabilities of the other vector.  If they were independent, this would not be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of mutual information is digital walkie-talkies.  One vector is the bit stream that the first walkie-talkie sends.  The second vector is the signal that the second walkie-talkie receives.  The two are obviously related, but due to noise and unknown channel conditions the second walkie-talkie cannot know for certain what the first one sent.  It can make some really good guesses based on the signal, but it cannot know for sure.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-07-18T15:51:19.050" LastActivityDate="2012-07-18T15:51:19.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2921" PostTypeId="2" ParentId="2914" CreationDate="2012-07-18T18:53:37.863" Score="2" Body="&lt;p&gt;Not sure about the theory, but here's something that seems to work in practice:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you divide your audio signal into sub-bands of much less than one octave width (which obviously requires a low frequency limit for a finite number of bands), then the weighted sum of the instantaneous amplitudes from all the complex signal plus Hilbert transforms of all the sub-bands seems to approach something that looks like an instantaneous amplitude of the envelope of the whole audio signal (depending on the lowest sub-band used compared to the lowest frequency present in the audio signal, and the sub-band width(s) in fractions of an octave).  You will also have to disregard the start-up transient of the longest Hilbert transform filter used (which again requires some high-pass cut-off with a long enough audio snippet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDED:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could the issue be a psycho-perceptual one, not a complex analytic one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the sum of 2 audio frequency pure sinusoids of the same magnitude but a couple Hz apart.  A human will hear a &quot;beat&quot; in the audio, and the Hilbert transform magnitude will also show the beating as the two analytic exponential spirals go in and out of phase.  Now make the 2 sinusoids 20 Hz or more apart, and the Hilbert magnitude will still show a beating in the envelope of the sum, but a human might hear a 2 tone interval with a constant envelope instead, depending on the separation in Hz and semitones.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-08-13T01:21:36.223" LastActivityDate="2012-08-13T01:21:36.223" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2922" PostTypeId="2" ParentId="2915" CreationDate="2012-07-19T02:40:57.937" Score="11" Body="&lt;p&gt;&lt;strong&gt;A somewhat visual complement to the other answers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are talking about systems that are linear and time invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exponential functions have one peculiar property (and can be actually defined by it): doing a time translation results in the same function multiplied by a constant. So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ e^{t-t_0}=e^{-t_0}e^t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vwSl2.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red exponential could as well be the blue one divided by $e$ or moved 1 second to the right&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, this also holds for complex exponentials&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you picture in your mind the plot of an complex harmonic such as $x(t)=e^{j2\pi t}$?&#xA;If so, you will see it's like a spring: it rotates along the complex plane as time goes by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/slkL9.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rotating that spring (multiplying by a complex number in the unit circle) is the same as translating it. You probably have come into this visual effect some time in your life&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PX5WW.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's the principle of any standard screw too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume we input this in a linear time-invariant system. You get an output $y$&#xA;Now, input a rotated version of this spring. Because of linearity, the output should be $y$ rotated by the same amount. &#xA;But since a rotation is equivalent to a time-translation, and the system is time-invariant, the output also has to be $y$ time-translated by the same amount.&#xA;So, $y$ has to satisfy the same property as the input: rotating it has to be equivalent to a particular time translation. This only happens when the output is a multiple of the original spring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How much translation? Well, it's directly proportional to the rotation just like it would happen with a spring. The tighter the loops of the spring (the faster it rotates), the less it time-translates for a certain rotation. The tighter the loops of a screw, the more rounds you have to make it do for it to fit completely. And, when half of the rounds are done, the screw will be half it's way in... The output has to satisfy the same relation so, the output spring $y$ rotates at the same frequency as the input. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At last, a reminder&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos(t)=\frac{e^{j t}+e^{-j t}}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(t)=\frac{e^{j t}-e^{-j t}}{2 j}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, that thing that happens with exponentials actually doesn't need to happen with cosines and sines in the most general case. But if the system is also real it's a different story...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, by this same reasoning, any exponential is an &quot;eigenfunction&quot; (output is proportional to input) of linear time invariant systems. That's why for these systems Z-transforms and Laplace transforms are so useful&lt;/p&gt;&#xA;" OwnerUserId="1206" LastEditorUserId="77" LastEditDate="2012-07-19T21:47:17.537" LastActivityDate="2012-07-19T21:47:17.537" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2923" PostTypeId="1" CreationDate="2012-07-19T14:05:26.617" Score="5" ViewCount="242" Body="&lt;p&gt;I have a small question that I am confused.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=16;&#xA;x=[-pi:2*pi/N:pi-2*pi/N];&#xA;y=1.5*cos(x)&#xA;z=fft(y)/N&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we will get negtive Fourier coefficients, however when we do it in this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=16;&#xA;x=[0:2*pi/N:2*pi-2*pi/N];&#xA;y=1.5*cos(x);&#xA;z=fft(y)/N&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we get positive ones.&#xA;How to explain this?&#xA;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="1704" LastActivityDate="2012-07-19T19:50:15.023" Title="Why this two ways of FFT are different?" Tags="|fft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2924" PostTypeId="2" ParentId="2923" CreationDate="2012-07-19T14:43:26.687" Score="6" Body="&lt;p&gt;In both cases, you are creating a sinusoid (y) that goes through exactly one cycle during the observation window of the FFT.  The only difference is the phase at which the sinusoids begin.  The latter starts at zero, while the former starts exactly one half cycle offset (-pi/2). The phase of an FFT coefficient reflects the cyclical timing offset of the sinusoid that coefficient represents.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2012-07-19T14:43:26.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2925" PostTypeId="2" ParentId="2923" CreationDate="2012-07-19T15:19:10.333" Score="3" Body="&lt;p&gt;A standard FFT (not using fftshift) references the phase of any sinusoid to the start of the window.  Your two examples start the FFT window at two different points, where a cosine has a different value or phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your input data is a cosine referenced to time 0.&#xA;And a phase of 0 will show up as a positive real result in common FFT implementations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shift the window 180 degrees, and an out of phase with respect to the window start will show up as a negative real result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shifts by 90 degrees will show up in the imaginary component of the complex result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above examples are for strictly periodic in FFT aperture sinusoids only.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-07-19T17:05:22.883" LastActivityDate="2012-07-19T17:05:22.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2926" PostTypeId="1" CreationDate="2012-07-19T15:23:43.297" Score="11" ViewCount="2497" Body="&lt;p&gt;I have got the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rehML.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are curvs on the picture. i would like to find center of the circles containing curves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i tried opencv and hough circle transform but had no results.&lt;/p&gt;&#xA;" OwnerUserId="1705" LastEditorUserId="420" LastEditDate="2012-07-19T16:18:14.137" LastActivityDate="2012-07-20T07:38:07.273" Title="how to detect center of a blurry circle with opencv" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2927" PostTypeId="2" ParentId="2891" CreationDate="2012-07-19T17:05:22.383" Score="-1" Body="&lt;p&gt;In a conventional 20th Century telephone, the &quot;transmitter&quot; (microphone) consisted of a small vial containing graphite powder, with two electrical contacts poking through the otherwise insulated vial wall.  Vibrations from sound would push the graphite particles closer together or pull them farther apart, creating a variable resistance (as &quot;seen&quot; between the two contacts).  Applying a voltage to the receiver would thus result in a variable current that was the &quot;signal&quot;.&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-07-19T17:05:22.383" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2928" PostTypeId="2" ParentId="1625" CreationDate="2012-07-19T18:20:56.883" Score="2" Body="&lt;p&gt;The answers you've gotten so far point to good alternative methods, but if you're interested in using something like your initial algorithm, it's probably not hard to fix.  You just need to adjust for OpenCV's HSV peculiarities.  Given the wacky results, I assume you probably used one of the more common numeric representations of HSV in choosing your thresholds and/or in converting pixels?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;OpenCV represents HSV differently than most other sources you might have found:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The biggest difference for you would be w/r/t hue: OpenCV&#xA;represents hue as ranging from 0 to 179, when almost everything else&#xA;takes advantage of the hanging bit to preserve more information, w/ 0-255.&lt;/li&gt;&#xA;&lt;li&gt;The other difference: measurement of saturation is inverted&#xA;compared to the norm.  So 255 saturation means bright in opencv,&#xA;instead of white (notice, we're back to 255 - only the hue is 0-180,&#xA;perhaps because of the 'wheel' representation?)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Probably too late to help you, but it was an interesting question, and someone else might run into the same issue.&lt;/p&gt;&#xA;" OwnerUserId="1702" LastActivityDate="2012-07-19T18:20:56.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2929" PostTypeId="2" ParentId="2564" CreationDate="2012-07-19T18:32:52.860" Score="2" Body="&lt;p&gt;It looks like you're &quot;oversegmenting&quot; your image.  Morphological operations, as bjnoernz has suggested, would help.  In particular, a watershedding approach should get closer to what you want than just checking distance (as in python example above).  See &lt;a href=&quot;http://cmm.ensmp.fr/~beucher/wtshed.html&quot; rel=&quot;nofollow&quot;&gt;http://cmm.ensmp.fr/~beucher/wtshed.html&lt;/a&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="1702" LastActivityDate="2012-07-19T18:32:52.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2931" PostTypeId="1" AcceptedAnswerId="2942" CreationDate="2012-07-20T01:15:14.210" Score="10" ViewCount="922" Body="&lt;p&gt;I'm trying to calibrate an ultrasonic speaker with the aim of emitting predictable signals, but alas I keep running into trouble, probably due to my lack of DSP-fu.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;A little background&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I want to be able to playback sounds as close as possible to a calibrated recording I have. As far as I understand the theory, I need to find the speakers transfer function and deconvolve the signals I want to emit with it. Something like this (in the frequency domain):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X -&amp;gt; H -&amp;gt; XH&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;X&lt;/code&gt; is the emitted signal &lt;code&gt;H&lt;/code&gt; is the speakers transfer function and &lt;code&gt;XH&lt;/code&gt; is &lt;code&gt;X&lt;/code&gt; times &lt;code&gt;H&lt;/code&gt;. A division (&lt;code&gt;./&lt;/code&gt;) should now give me &lt;code&gt;H&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in order to emit a calibrated signal, it should be divided by &lt;code&gt;H&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X/H -&amp;gt; H -&amp;gt; X&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;What's been done&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Placed speaker and a calibrated microphone 1 m apart on tripods.&lt;/li&gt;&#xA;&lt;li&gt;Recorded 30+ linear sweeps 150KHz-20KHz, 20ms long, and recorded @ 500 KS/s.&lt;/li&gt;&#xA;&lt;li&gt;Aligned and averaged signals with the Matlab/Octave script below, under the script the resulting signal can be seen.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;files = dir('Mandag*');&#xA;&#xA;rng = [1.5e6, 1.52e6];&#xA;&#xA;[X, fs] = wavread(files(1).name, rng);&#xA;X = X(:,1);&#xA;&#xA;for i=2:length(files)&#xA;    [Y, fs] = wavread(files(i).name, rng);&#xA;    sig = Y(:,1);&#xA;    [x, off] = max(xcorr(X', sig'));&#xA;    off = length(X) - off;&#xA;    if(off &amp;lt; 0)&#xA;        sig = [zeros(1, -off), sig(1:end+off)'];&#xA;    elseif (off &amp;gt; 0)&#xA;        sig = [sig(off:end)', zeros(1, off-1)];&#xA;    end&#xA;    X = X + sig';&#xA;end&#xA;X = X/length(files);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C6cma.png&quot; alt=&quot;Aligned and averaged signals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Fourier transformed &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;XH&lt;/code&gt; and did the  calculations mentioned above, the result looks plausible. Below is a normalized plot of &lt;code&gt;H&lt;/code&gt; (purple) and &lt;code&gt;X/H&lt;/code&gt; (green).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zFBy4.png&quot; alt=&quot;Frequency plot of H and X/H&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The plot has been truncated to the relevant frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if I'm going about this the wrong way.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;My question&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;After calculating &lt;code&gt;X/H&lt;/code&gt; I need to transform it back to the time domain, I assumed this would be a simple &lt;code&gt;ifft(X./H)&lt;/code&gt; and &lt;code&gt;wavwrite&lt;/code&gt;, but all my attempts so far have failed to get any plausible answer. A frequency vector &lt;code&gt;Hf&lt;/code&gt;, &lt;code&gt;H&lt;/code&gt;, and &lt;code&gt;X&lt;/code&gt; can be found &lt;a href=&quot;https://dl.dropbox.com/u/17110900/Hf_H_X.mat&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; in mat7-binary format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I'm just tired and there is a simple solution here, but at the moment I can't see it. Any help/advice is much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1706" LastActivityDate="2012-10-30T14:55:46.313" Title="Ultrasonic speaker calibration and emitting calibrated signals" Tags="|matlab|audio|frequency-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2932" PostTypeId="2" ParentId="2926" CreationDate="2012-07-20T07:38:07.273" Score="3" Body="&lt;p&gt;You'll need to improve the contrast of the image first, then filter it strongly to remove the noise. since the circles are 'thick' (blurry), you can filter quite a bit without destroying the circles structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would then apply some edge detection algorithm to get a binary edge image that can be processed by the Circular Hough Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following edge image from your image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6C7rB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the following MATLAB commands:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; % x is the input grayscale image. First we adaptively improve the contrast over the image&#xA; y= adapthisteq(x);&#xA;&#xA; % next we use the Canny edge detector with a strong Gaussian lowpass filter&#xA; ee=edge(y, 'canny', [], 5);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1082" LastActivityDate="2012-07-20T07:38:07.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2933" PostTypeId="1" AcceptedAnswerId="2936" CreationDate="2012-07-20T09:50:40.010" Score="2" ViewCount="2121" Body="&lt;p&gt;I am trying to make a method in my simple application which is like &lt;code&gt;SetSilence();&lt;/code&gt; Now If I have audio (mono) PCM 16 bit Signed - should I fill all data with 0 values? And for PCM 16 Unsigned with 32768 values?&lt;/p&gt;&#xA;" OwnerUserId="1708" LastEditorUserId="1708" LastEditDate="2019-06-18T14:20:18.383" LastActivityDate="2019-06-18T14:20:18.383" Title="How to make a silence?" Tags="|audio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2934" PostTypeId="1" CreationDate="2012-07-20T09:57:18.443" Score="7" ViewCount="2717" Body="&lt;p&gt;If a time-domain signal has sharp corners, its frequency spectrum will contain high-frequency components. Truncating the spectrum results in Gibbs' phenomenon. So if you're trying to design an FIR, you really want the target frequency response to be nice and smooth so that windowing the impulse response down to a finite length doesn't distort the frequency response too much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm contemplating trying to design a very strange filter: One that has unit gain at all frequencies, but &lt;em&gt;non-zero&lt;/em&gt; phase. I'm wondering whether or not a similar phenomenon occurs: If the filter has unit gain at all frequencies, then what does truncating the impulse response do to the phase alignment?&lt;/p&gt;&#xA;" OwnerUserId="1309" LastActivityDate="2012-07-20T22:22:56.647" Title="Phase-shift filter design" Tags="|filter-design|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2935" PostTypeId="2" ParentId="2934" CreationDate="2012-07-20T11:21:16.657" Score="3" Body="&lt;p&gt;It has the same effect: windowing with a rectangular window in one domain (time or frequency) is equivalent to convolving with an infinitely long Sinc function in the other domain (i.e. Gibb's phenomenon).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want specific phase changes at N frequency points of your all-pass filter, you will generally end up with a FIR several times longer than N taps.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2012-07-20T11:21:16.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2936" PostTypeId="2" ParentId="2933" CreationDate="2012-07-20T12:22:07.197" Score="8" Body="&lt;p&gt;Yes, this is correct. Other values would cause a DC offset.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-20T12:22:07.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2937" PostTypeId="1" CreationDate="2012-07-20T12:23:33.607" Score="2" ViewCount="5530" Body="&lt;p&gt;I am implementing BFSK frequency hopping communication system on a DSP processor. It was suggested by some of the forum members to use Goertzel algorithm for the demodulation of frequency hopping at specific frequncies. I have tried implementing  the goertzel alorithm in C. the code is follows :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float goertzel(int numSamples,int TARGET_FREQUENCY,int SAMPLING_RATE, float* data)&#xA;{&#xA;int k,i;&#xA;float   floatnumSamples;&#xA;float   omega,sine,cosine,coeff,q0,q1,q2,result,real,imag;&#xA;&#xA;floatnumSamples = (float) numSamples;&#xA;k = (int) (0.5 + ((floatnumSamples * TARGET_FREQUENCY) / SAMPLING_RATE));&#xA;omega = (2.0 * M_PI * k) / floatnumSamples;&#xA;sine = sin(omega);&#xA;cosine = cos(omega);&#xA;coeff = 2.0 * cosine;&#xA;q0=0;&#xA;q1=0;&#xA;q2=0;&#xA;&#xA;for(i=0; i&amp;lt;numSamples; i++)&#xA;{&#xA;    q0 = coeff * q1 - q2 + data[i];&#xA;    q2 = q1;&#xA;    q1 = q0;&#xA;}&#xA;real = (q1 - q2 * cosine);&#xA;imag = (q2 * sine);&#xA;result = sqrtf(real*real + imag*imag);&#xA;return result;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I use the function to calculate the result at specific frequencies for a given dataset, I am not getting the correct results. However, if I use the same dataset and calculate the goertzel result using MATLAB, then I get the results perfectly. I am implemented the algorithm using C, with the help of some online tutorials that I found over the internet. I just want to get the view of you guys if the function is implmenting the goertzel algorithm correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Anshu&lt;/p&gt;&#xA;" OwnerUserId="1659" LastActivityDate="2014-01-03T13:53:19.997" Title="Implementation of goertzel algorithm in C" Tags="|fft|dsp-core|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2938" PostTypeId="2" ParentId="2915" CreationDate="2012-07-20T15:04:24.070" Score="4" Body="&lt;p&gt;Consider a system with input $x(t)$ and output $y(t)$.  Borrowing&#xA;notation from Lars1's answer, we denote this &#xA;relationship  $x(t) \to y(t)$.  The system is said to be a linear &lt;strong&gt;time-invariant&lt;/strong&gt; (LTI) system if it satisfies the following properties:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;H.&lt;/strong&gt; If $x(t) \to y(t)$, then $\alpha x(t) \to \alpha y(t)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A.&lt;/strong&gt; If&#xA;$x_1(t) \to y_1(t)$ and $x_2(t) \to y_2(t)$, then &#xA;$x_1(t) + x_2(t) \to y_1(t) + y_2(t).$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;T.&lt;/strong&gt; If&#xA;$x(t) \to y(t)$, then $x(t-\tau) \to y(t-\tau)$ for any real number $\tau$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Properties &lt;strong&gt;H&lt;/strong&gt; and &lt;strong&gt;A&lt;/strong&gt; together are equivalent to Property &lt;strong&gt;L&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;L.&lt;/strong&gt; If&#xA;$x_1(t) \to y_1(t)$ and $x_2(t) \to y_2(t)$, then &#xA;$\alpha x_1(t) + \beta x_2(t) \to \alpha y_1(t) + \beta y_2(t)$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Periodic input to a time-invariant system produces periodic output&lt;/strong&gt;&lt;br&gt;&#xA;Suppose that $x(t)$ is a &lt;em&gt;periodic&lt;/em&gt; signal with period $T$,&#xA;that is, $x(t-nT) = x(t)$ for all integers $n$.  Then, from&#xA;Property &lt;strong&gt;T&lt;/strong&gt;, it follows immediately that $y(t)$ is also &#xA;a periodic signal with period $T$.  Thus, we can express&#xA;$y(t)$ as a Fourier series:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = \frac{a_0}{2} + \sum_{n=1}^{\infty} a_n \cos(n\omega t)&#xA;+ b_n \sin(n\omega t)$$&#xA;where $\omega = 2\pi/T$ is the fundamental frequency.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Since $\cos(\omega t)$ and $\sin(\omega t)$ are periodic&#xA;signals, we have that for any time-invariant system, whether&#xA;linear or not,&#xA;$$\begin{align*}&#xA;\cos(\omega t) &amp;amp;\to \frac{p_0}{2} + \sum_{n=1}^{\infty} p_n \cos(n\omega t)&#xA;+ q_n \sin(n\omega t)\\&#xA;\sin(\omega t) &amp;amp;\to \frac{r_0}{2} + \sum_{n=1}^{\infty} r_n \cos(n\omega t)&#xA;+ s_n \sin(n\omega t)\\&#xA;\end{align*}.$$&#xA;In fact, for &lt;strong&gt;linear&lt;/strong&gt; time-invariant (LTI)&#xA;systems, &lt;em&gt;all&lt;/em&gt; the $p_n, q_n, r_n,$ and $s_n$ are zero &lt;em&gt;except&lt;/em&gt;&#xA;for $p_1, q_1, r_1, s_1$.  To see why this is so, let us compute&#xA;the LTI system's response to $\cos(\omega t - \theta)$ in two different&#xA;ways and compare the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $\cos(\omega t - \theta) = \cos(\theta)\cos(\omega t) +&#xA;\sin(\theta)\sin(\omega t)$, we get from Property &lt;strong&gt;L&lt;/strong&gt; and the&#xA;above equations that&#xA;$$\begin{align*}&#xA;\cos(\omega t - \theta) &amp;amp;\to&#xA;\frac{p_0\cos(\theta) + q_0\sin(\theta)}{2}\\&#xA;&amp;amp;\qquad + \sum_{n=1}^{\infty} (p_n\cos(\theta) + r_n\sin(\theta))\cos(n\omega t)\\&#xA;&amp;amp;\qquad + \sum_{n=1}^{\infty} (q_n\cos(\theta) + s_n\sin(\theta))\sin(n\omega t).&#xA;\end{align*}$$&#xA;On the other hand, since $\cos(\omega t - \theta) = \cos(\omega (t-\theta/\omega))$&#xA;is just a delayed version of $\cos(\omega t)$, from Property &lt;strong&gt;T&lt;/strong&gt;&#xA;we get that&#xA;$$\begin{align*}&#xA;\cos(\omega t - \theta) &amp;amp;\to&#xA;\frac{p_0}{2} + \sum_{n=1}^{\infty} p_n \cos(n\omega t -n\theta)&#xA;+ q_n \sin(n\omega t - n\theta)\\&#xA;&amp;amp;= \frac{p_0}{2} \\&#xA;&amp;amp;\qquad + \sum_{n=1}^{\infty} (p_n\cos(n\theta) - q_n\sin(n\theta))\cos(n\omega t)\\&#xA;&amp;amp;\qquad + \sum_{n=1}^{\infty} (q_n\cos(n\theta) + p_n\sin(n\theta))\sin(n\omega t)&#xA;\end{align*}.$$&#xA;These two Fourier series must be the same no matter what value&#xA;of $\theta$ we choose. Comparing coefficients, we see that&#xA;$p_0/2$ cannot equal $(p_0\cos(\theta) + r_0\cos(\theta))/2$ for all&#xA;$\theta$ unless $p_0 = r_0 = 0$.  Similarly, for any $n &amp;gt; 1$,&#xA;$p_n\cos(n\theta) - q_n\sin(n\theta)$ cannot equal&#xA;$p_n \cos(\theta) + r_n\sin(\theta)$ etc. for all $\theta$&#xA;unless $p_n = q_n = r_n = s_n = 0$. However, for $n=1$,&#xA;$p_1\cos(\theta) - q_1\sin(\theta) = p_1\cos(\theta) + r_1\sin(\theta)$&#xA;implies that $r_1 = -q_1$, and similarly, $s_1 = p_1$.  In other words,&#xA;for an LTI system,&#xA;$$\begin{align*}&#xA;\cos(\omega t) &amp;amp;\to p_1 \cos(\omega t) + q_1\sin(\omega t)\\&#xA;\sin(\omega t) &amp;amp;\to -q_1 \cos(\omega t)+ p_1 \sin(\omega t)\\&#xA; \end{align*}.$$&#xA;Now, $p_1 \cos(\omega t) + q_1\sin(\omega t) = B\cos(\omega t - \phi)$&#xA;where $B = \sqrt{p_1^2+q_1^2}$ and $\phi = \arctan(q_1/p_1)$. Therefore,&#xA;Properties &lt;strong&gt;T&lt;/strong&gt; and &lt;strong&gt;H&lt;/strong&gt; give us that&#xA;$$A\cos(\omega t - \theta) \to AB\cos(\omega t - \phi - \theta).$$&#xA;&lt;em&gt;Any&lt;/em&gt; sinusoid of frequency $\omega$ rad/s can be expressed&#xA;as $A\cos(\omega t - \theta)$ for appropriate choice of $A$ and&#xA;$\theta$, and so the above result is what we need.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;SISO property of linear time-invariant systems:&lt;/strong&gt; If the input &#xA;  to an LTI system is a sinusoid, the output is&#xA;  a sinusoid of the same frequency but possibly different amplitude and phase.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is not quite the result that the OP wanted -- he wanted&#xA;a proof that a linear system (one in which Properties &lt;strong&gt;H&lt;/strong&gt; and&#xA;&lt;strong&gt;A&lt;/strong&gt; (equivalently, Property &lt;strong&gt;L&lt;/strong&gt;) hold but not necessarily&#xA;Property &lt;strong&gt;T&lt;/strong&gt;) has the SISO property, but as the&#xA;development above shows, Property &lt;strong&gt;T&lt;/strong&gt; must hold in order to&#xA;prove even the weaker result that periodic input results in&#xA;periodic output.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As a final comment, note that it is not necessary to&#xA;use complex numbers or convolution theorems or Fourier&#xA;or LaPlace transforms, impulses, eigenfunctions etc to &#xA;prove the SISO property. It follows from Properties&#xA;&lt;strong&gt;L&lt;/strong&gt; and &lt;strong&gt;*T&lt;/strong&gt; and the trigonometric identity&#xA;$$ \cos(\alpha - \beta) = \cos(\alpha)\cos(\beta)&#xA;+ \sin(\alpha)\sin(\beta).$$&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-07-23T19:48:03.513" LastActivityDate="2012-07-23T19:48:03.513" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2939" PostTypeId="1" CreationDate="2012-07-20T15:57:23.563" Score="0" ViewCount="1890" Body="&lt;p&gt;Hello fellow investigators&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two question about optical illusions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A photo mosaic is something like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tMQsG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the signal processing principles behind our eye merging the many tiny images into a large coherent one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Are there etiological explanations of optical illusions in general - by this I mean can it be explained why image inputs get parsed in 'wrong' ways by the eye/brain, why does the human parser get confused; what transfer function is in play?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time&lt;/p&gt;&#xA;" OwnerUserId="1710" LastEditorUserId="6" LastEditDate="2012-07-20T15:58:42.500" LastActivityDate="2012-07-24T12:25:22.637" Title="How do optical illusions work (photo mosaic) from a signal processing perspective?" Tags="|frequency|transfer-function|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2940" PostTypeId="2" ParentId="2939" CreationDate="2012-07-20T16:34:22.593" Score="2" Body="&lt;p&gt;I don't have an answer for part 2. I hope this answers part of your question, I am interested in seeing answers for the second part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image mosaics are traditionally made up of many images and then printed so that each image can bee seen up close, but when the viewer is far enough away to see the whole image they blend together. In this case the effect is less the human brain but the image resolution delivered to the brain. In the provided example each image is represented by about an 8 pixel square. The precived effect is that this copy of the Mona Lisa has a lot of noise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have processed the provided example with an 8x8 pixelize filter to show how each image has the correct average color:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lTXmI.png&quot; alt=&quot;Pixelized Mona Lisa mosaic.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I processed the provided example with a 15 px Gaussian blur to simulate noise reduction and shape coalescing. Humans are quite good at sensing a signal through noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0c97Z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1693" LastActivityDate="2012-07-20T16:34:22.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2941" PostTypeId="2" ParentId="2934" CreationDate="2012-07-20T22:22:56.647" Score="4" Body="&lt;p&gt;This would be an allpass filter. Except for the trivial case of unity and integer-sample delays, these can't be done as FIR filters and in general an IIR filter is required. However, they are easy to make. The zeroes of an allpass are simply the inverse of the poles (and vice versa). If you have the poles in polynomial form, you can simply flip them to get the zero polynomials. For example a second order allpass looks like this &#xA;$$H(z)=\frac{a_{2}\cdot z^{0} + a_{1}\cdot z^{-1} + a_{0}\cdot z^{-2}}{a_{0}\cdot z^{0} + a_{1}\cdot z^{-1} + a_{2}\cdot z^{-2}}$$&#xA;Strict allpass filter have $\left \|H(e^{j\cdot \omega })\right \|=1 $ for all frequencies. You can certainly design approximation using FIR filters if you only need this property for a limited frequency range and if the magnitude doesn't have to be exactly unity.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-20T22:22:56.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2942" PostTypeId="2" ParentId="2931" CreationDate="2012-07-20T23:53:17.397" Score="3" Body="&lt;p&gt;Found the answer after looking at the references that Jim Clay mentioned in the comments, thank you Jim.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made the mistake of only considering the magnitude which results in zero-phased signal and can not sensibly be used for emission, at least not in this setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I finally ended up using can be seen below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The script adheres to the naming convention of keeping time domain signals in lower-case and frequency domain signals in upper-case.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Align and sum all files called Mandag*&#xA;files = dir('Mandag*');&#xA;&#xA;% Where in the recordings the signal is&#xA;rng = [1.5e6, 1.52e6];&#xA;&#xA;% Initialize the xh vector&#xA;[xh, fs] = wavread(files(1).name, rng);&#xA;xh = xh(:,1);&#xA;&#xA;for i=2:length(files)&#xA;    y = wavread(files(i).name, rng);&#xA;    y = y(:,1);&#xA;    % Determine offset between xh and y&#xA;    [~, off] = max(xcorr(xh', y'));&#xA;    off = length(xh) - off;&#xA;    % Shift signal appropriately&#xA;    if(off &amp;lt; 0)&#xA;        y = [zeros(1, -off), y(1:end+off)'];&#xA;    elseif (off &amp;gt; 0)&#xA;        y = [y(off:end)', zeros(1, off-1)];&#xA;    end&#xA;    xh = xh + y';&#xA;end&#xA;&#xA;% Average&#xA;xh = xh/length(files);&#xA;&#xA;% Location of the 20ms signal&#xA;xh = xh(2306:12306-1);&#xA;&#xA;% Normalize&#xA;xh = xh / max(xh);&#xA;&#xA;% Apply a moving average filter on xh to reduce noise. Window size of 4 was&#xA;% experimentally determined to give the best results&#xA;n = 4;&#xA;B = zeros(n, 1);&#xA;for i=1:n&#xA;  B(i) = 1/n;&#xA;end&#xA;xh = filter(B, 1, xh);&#xA;xh = xh / max(xh);&#xA;&#xA;x = wavread('sweep.wav');&#xA;x = x(1:2:end);            % Sweep generated @ 1MHz, decimate&#xA;                           % to have same length as xh&#xA;&#xA;% Transform x into frequency domain and determine H&#xA;X = fft(x);&#xA;H = fft(xh) ./ X;&#xA;&#xA;% Vector indices to choose only frequencies of interest&#xA;starti =  20e3 / 50;&#xA;endi   = 100e3 / 50;&#xA;rng    = starti:endi;&#xA;irng   = (length(x) - endi) : (length(x) - starti);&#xA;&#xA;% Zero out unwanted frequencies&#xA;X = [zeros(1,      starti - 1   ), X( rng)', zeros(1, length(X)/2 - endi) ...&#xA;     zeros(1, length(X)/2 - endi), X(irng)', zeros(1,      starti - 1   )]';&#xA;&#xA;% Deconvolve x with h&#xA;X_deconv_H = X ./ H;&#xA;&#xA;% Transform X/H to time domain and normalise&#xA;x_deconv_h = real(ifft(X_deconv_H));&#xA;x_deconv_h = x_deconv_h / max(x_deconv_h);&#xA;&#xA;% Save the deconvolved sweep&#xA;wavwrite(x_deconv_h, fs, 'deconvolved_sweep.wav');&#xA;&#xA;% Generate  spectrograms of xh and x_deconv_h&#xA;winsize = 512;&#xA;overlap = round(.99 * winsize);&#xA;figure(1)&#xA;specgram(xh, winsize, fs, hann(winsize), overlap)&#xA;colorbar&#xA;figure(2)&#xA;specgram(x_deconv_h, winsize, fs, hann(winsize), overlap)&#xA;colorbar&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The spectrograms of &lt;code&gt;x conv h&lt;/code&gt; and &lt;code&gt;x deconv h&lt;/code&gt; can be seen below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dpt66.png&quot; alt=&quot;spectrogram of x conv h&quot;&gt;&#xA;  &lt;img src=&quot;https://i.stack.imgur.com/5TaLf.png&quot; alt=&quot;spectrogram of x deconv h&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These seem plausible to me although there is some noise in the deconvolved signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next test will be to see if emitting &lt;code&gt;x_deconv_y&lt;/code&gt; gives something resembling &lt;code&gt;x&lt;/code&gt; barring those frequencies that the speaker cannot emit.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Update with test results&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;We redid the measurements described above using a logarithmic down-sweep. These results seem to suggest that the method works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The verification test consisted of emitting &lt;code&gt;X / H&lt;/code&gt; and expecting to get &lt;code&gt;X&lt;/code&gt; back, i.e. equal energy in all frequencies.&#xA;As the worst output frequency is about 20dB weaker than the best, the highest output level is expected to be that much lower.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal that was emitted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VHwe9.png&quot; alt=&quot;Time series of emitted signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The time series and spectrogram of the recorded signal look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bvyUG.png&quot; alt=&quot;Time series of emitted signal&quot;&gt;&#xA; &lt;img src=&quot;https://i.stack.imgur.com/9LNnb.png&quot; alt=&quot;Time series of emitted signal&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1706" LastEditorUserId="1706" LastEditDate="2012-10-30T14:55:46.313" LastActivityDate="2012-10-30T14:55:46.313" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2943" PostTypeId="2" ParentId="2828" CreationDate="2012-07-21T13:16:20.123" Score="5" Body="&lt;p&gt;&lt;strong&gt;Implementation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you already have a line drawing routine, you just need to supplement that with some kind of interpolation. The curves are created by drawing enough interpolated short lines to make the result look smooth. A good starting point would be to use an existing interpolation routine, like the ones given by Paul Bourke &lt;a href=&quot;http://paulbourke.net/miscellaneous/interpolation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll illustrate this using the cubic routines he supplies, since those are some of the simplest that will still give reasonable results. Here's the first one (translated to python) for reference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def cubic(mu,y0,y1,y2,y3):&#xA;    mu2 = mu*mu&#xA;    a0 = y3 - y2 - y0 + y1&#xA;    a1 = y0 - y1 - a0&#xA;    a2 = y2 - y0&#xA;    a3 = y1&#xA;    return a0*mu*mu2 + a1*mu2 + a2*mu + a3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each routine has a parameter &lt;code&gt;mu&lt;/code&gt; which represents the fractional part of the index you want to interpolate. Depending on the routine, the other parameters will be some number of samples surrounding the index in question. In the cubic case, you'll need four samples. For example, if your data is &lt;code&gt;y[n]&lt;/code&gt;, and you want the value at &lt;code&gt;10.3&lt;/code&gt;, &lt;code&gt;mu&lt;/code&gt; would be &lt;code&gt;.3&lt;/code&gt;, and you'd pass in &lt;code&gt;y[9]&lt;/code&gt;, &lt;code&gt;y[10]&lt;/code&gt;, &lt;code&gt;y[11]&lt;/code&gt;, and &lt;code&gt;y[12]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then instead of drawing a single line with endpoints, say, $(10,y_{10}) \rightarrow (11,y_{11})$, you'd draw a bunch of shorter ones using the interpolated values (e.g. $(10,y_{10}) \rightarrow (10.1,\text{cubic}(.1,y_9,y_{10},y_{11},y_{12})) \dots $). Obviously those points would need to be scaled to the $x$ and $y$ dimensions of the image to be rendered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Theory&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since the page/routine I referenced doesn't cite any sources, it's worth explaining where those cubic routines come from (and how they work). Both the one I reproduced above, and the very similar Catmull-Rom spline he mentions just below it, are two specific cases of using the following cubic convolution kernel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\psi(x) =&#xA;\begin{cases}&#xA;(\alpha + 2)|x|^3 - (\alpha + 3)|x|^2 + 1,  &amp;amp; \text{ if } 0 \le |x| \lt 1 \\&#xA;\alpha|x|^3 - 5\alpha|x|^2 + 8\alpha|x| - 4\alpha,  &amp;amp; \text{ if } 1 \le |x| \lt 2  \\&#xA;0, &amp;amp; \text{ if } 2 \le |x|&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The routine listed above corresponds to a value of $\alpha = -1$, and the Catmull-Rom spline corresponds to $\alpha = -1/2$.  I won't go into too much detail about how the general form of the kernel is derived, but it involves various constraints like making sure that $\psi(x)$ is one at zero, and zero at all other integers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what it looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lJVa8.png&quot; alt=&quot;Cubic Convolution Kernel&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two choices for the value of $\alpha$ come from attempts to match various aspects of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;sinc function&lt;/a&gt;, the ideal reconstruction kernel. Setting $\alpha = -1$ makes the derivative of $\psi$ match the derivative of the sinc function at $x = 1$, and making it equal to $-1/2$ provides the best low-frequency approximation instead. By all accounts, a value of $\alpha = -1/2$ has much better properties overall, so it's probably the best value to use in practice. A much more extensive discussion can be found in the following paper, starting on page 328:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Meijering, Erik.  &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.120.7048&quot; rel=&quot;nofollow noreferrer&quot;&gt;“A Chronology of Interpolation: From Ancient&#xA;  Astronomy to Modern Signal and Image Processing.”&lt;/a&gt;  Proceedings of the&#xA;  IEEE. vol. 90, no. 3, pp. 319-42.  March 2002. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Insight&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, just looking at that kernel in relation to the actual implementation of the interpolation code, it may not be clear how the two are related. Basically, the interpolation process can be thought of as adding together shifted copies of the kernel, which are scaled by the samples of the data, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tJLX3.png&quot; alt=&quot;Kernel-Based Reconstruction&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, if you have an implementation of the kernel, you can use it directly to do the interpolation, as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def kernel(x, a=-1.0):&#xA;    x = abs(x)&#xA;    if x &amp;gt;= 0.0 and x &amp;lt; 1.0:&#xA;        return (a + 2.0)*x**3.0 - (a + 3.0)*x**2.0 + 1&#xA;    elif x &amp;gt;= 1.0 and x &amp;lt; 2.0:&#xA;        return a*x**3.0 - 5.0*a*x**2.0 + 8.0*a*x - 4.0*a&#xA;    else:&#xA;        return 0.0&#xA;&#xA;def cubic(mu,y0,y1,y2,y3):&#xA;    a = -1.0        &#xA;    result  = y0 * kernel(mu + 1, a)&#xA;    result += y1 * kernel(mu, a)     &#xA;    result += y2 * kernel(mu - 1, a)&#xA;    result += y3 * kernel(mu - 2, a)&#xA;    return result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, it's much less computationally efficient to do it that way. As a bridge from the direct kernel approach to the more streamlined one above, consider that with a little bit of algebraic manipulation, the first implementation can be put in the following form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def cubic(mu,y0,y1,y2,y3):&#xA;    mu2 = mu*mu&#xA;    mu3 = mu*mu2&#xA;    c0 = -mu3 + 2*mu2 - mu&#xA;    c1 =  mu3 - 2*mu2 + 1&#xA;    c2 = -mu3 + mu2 + mu&#xA;    c3 =  mu3 - mu2    &#xA;    return c0*y0 + c1*y1 + c2*y2 + c3*y3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this formulation, the &lt;code&gt;c0...c3&lt;/code&gt; values can be thought of as the coefficients of an &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response&quot; rel=&quot;nofollow noreferrer&quot;&gt;FIR filter&lt;/a&gt; which is applied to the sample values. Now it's much easier to see how to derive the routine from the kernel.  Consider the kernel with $\alpha = -1$, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\psi(x) =&#xA;\begin{cases}&#xA;|x|^3 - 2|x|^2 + 1,  &amp;amp; \text{ if } 0 \le |x| \lt 1 \\&#xA;-|x|^3 + 5|x|^2 - 8|x| + 4,  &amp;amp; \text{ if } 1 \le |x| \lt 2 \\&#xA;0, &amp;amp; \text{ if } 2 \le |x|&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now evaluate that kernel symbolically at various shifted offsets, keeping in mind that &lt;code&gt;mu&lt;/code&gt; ($\mu$) ranges from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{eqnarray}&#xA;\psi(\mu + 1) &amp;amp;=&amp;amp; -(\mu + 1)^3 + 5(\mu + 1)^2 - 8(\mu + 1) + 4 &amp;amp;=&amp;amp; −\mu^3 + 2\mu^2 - \mu &amp;amp; &amp;amp; (c_0) \\&#xA;\psi(\mu) &amp;amp;=&amp;amp; \mu^3 - 2\mu^2 + 1 &amp;amp;=&amp;amp; \mu^3 - 2\mu^2 + 1 &amp;amp; &amp;amp; (c_1)\\&#xA;\psi(\mu - 1) &amp;amp;=&amp;amp; (1 - \mu)^3 - 2(1 - \mu)^2 + 1 &amp;amp;=&amp;amp; -\mu^3 + \mu^2 + \mu &amp;amp; &amp;amp; (c_2)\\&#xA;\psi(\mu - 2) &amp;amp;=&amp;amp; -(2 - \mu)^3 + 5(2 - \mu)^2 - 8(2 - \mu) + 4 &amp;amp;=&amp;amp; \mu^3 - \mu^2 &amp;amp; &amp;amp; (c_3)\\&#xA;\end{eqnarray}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $\mu - 1, \mu - 2$ get &quot;flipped&quot; to $1 - \mu, 2 - \mu$ respectively because of the absolute value on $x$ in the kernel definition.  Now we have the exact polynomials that are used in the &quot;FIR version&quot; of the interpolation routine. The evaluation of those polynomials can then be made more efficient through standard techniques (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Horner%27s_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horner's method&lt;/a&gt;). Similar things can be done with other kernels, and there are other ways of constructing efficient implementations as well (cf. &lt;a href=&quot;https://ccrma.stanford.edu/~jos/resample/resample.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Audio Resampling Home Page&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="35" LastEditDate="2012-07-23T09:54:35.913" LastActivityDate="2012-07-23T09:54:35.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2944" PostTypeId="1" CreationDate="2012-07-21T17:20:15.570" Score="4" ViewCount="157" Body="&lt;p&gt;I have a series of measurements of a signal source, which emits a periodic signal at an unknown interval time of &lt;code&gt;p&lt;/code&gt; seconds. Detecting the signal is not easy so I am missing quite a few signals in the data. Data is also noisy so there are errors in the data of up to +/- 10% per signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example measurements &lt;code&gt;x&lt;/code&gt; might look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;72.3, 185.1, 364.2, 570.2, 679.2, 1060.7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result I am looking for, is the period hidden in the measurments, &lt;code&gt;p = ~100&lt;/code&gt; in this example case and possibly the best offset &lt;code&gt;c = ~70&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically I have 4-7 measurements in a series I would like to analyse, so it seems an analytic answer is more appropriate than a sound analysis (FFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideas I have considered:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Non-linear optimization such that we optimize for &lt;code&gt;x = n * p + c&lt;/code&gt;. Levenberg-Marquart should do the trick.&lt;/li&gt;&#xA;&lt;li&gt;Building a histogram of difference between consecutive measurements and picking the average of the fullest bin.&lt;/li&gt;&#xA;&lt;li&gt;Floating point GCD &lt;a href=&quot;https://stackoverflow.com/questions/445113/approximate-greatest-common-divisor&quot;&gt;https://stackoverflow.com/questions/445113/approximate-greatest-common-divisor&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But I am very unsure whether I might have missed an obvious solution from the sound analysis camp (autocorrelation, Harmonic Spectrum Product, DFT, e.g. &lt;a href=&quot;https://stackoverflow.com/questions/4716620/algorithm-to-determine-fundamental-frequency-from-potential-harmonics&quot;&gt;https://stackoverflow.com/questions/4716620/algorithm-to-determine-fundamental-frequency-from-potential-harmonics&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am turning to the wisdom of SO. How would you go about solving this problem most elegantly? Library suggestions are fine (C++). &lt;/p&gt;&#xA;" OwnerUserId="1717" OwnerDisplayName="Christopher Oezbek" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-07-22T16:11:57.980" Title="Finding length of period in time domain data" Tags="|optimization|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2945" PostTypeId="1" CreationDate="2012-07-22T15:40:07.657" Score="4" ViewCount="1065" Body="&lt;p&gt;I am working on OpenCV2.4.2 C++ interface for face recognition functionality. The face recognition feature seems to be working fine on standard databases. (AT&amp;amp;T, Face Recognition Data, University of Essex, UK)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am more interested in negative testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is what I did -&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Identify clear front face images from the Internet. (single image/person, &#xA;different  image sizes)&lt;/li&gt;&#xA;&lt;li&gt;Detect and extract faces using LBP cascade, convert to grayscale and normalize &#xA;the   histogram. Then, train the database with these images using LBP face recognizer.&lt;/li&gt;&#xA;&lt;li&gt;Find a face which is &lt;strong&gt;not part of the database&lt;/strong&gt; from the internet. Preprocess this &#xA;face image and give it as an input to face recognizer.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I expect&lt;/strong&gt; - The application should return the ID of similar looking face.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Results&lt;/strong&gt; - But I am receiving absolutely ridiculous results. When given white male face as an input, I get the ID of black woman. I have tested this with multiple images but everytime the match bizarre. Gender, skin tone nothing matches. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I want to do is when given an random image as an input (which is not part of the database), the application should at least return the ID of an image which has similar skin tone and gender. I am clueless where and how to get started on this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be greatly appreciated.  &lt;/p&gt;&#xA;" OwnerUserId="1713" LastActivityDate="2018-11-21T16:57:15.560" Title="OpenCV face recognition: Finding a best match" Tags="|opencv|face-detection|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2946" PostTypeId="2" ParentId="2944" CreationDate="2012-07-22T16:04:11.810" Score="3" Body="&lt;p&gt;This really reminds me of the problem of beat induction in music signals, in which you have to infer a latent periodic grid from note onset measurements. The grid is &quot;latent&quot; - it's not because a track is at 120 BPM that it strictly has a quarter note every 500ms - the composer can choose to phrase the melody with half notes, then eighth notes... And then there's accentuation (which would change the intensity of pulses) and swing (which would shuffle them a bit temporally)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to work from what you describe in your question - the list of timestamps - you need to compute a histogram of time deltas, convolve it by a gaussian window to smooth it (to consolidate together deltas which are close to each other), and then evaluate as possible period candidates integer divisors of the histogram peak. This is described in section 4.3 of &lt;a href=&quot;http://www.elec.qmul.ac.uk/dafx03/proceedings/pdfs/dafx46.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it might work well in your case, I strongly encourage you &lt;em&gt;not&lt;/em&gt; to detect events, but rather try to estimate the period from your underlying raw signals. The reason is that the detection process is discarding some valuable information which might help the period estimation process. For example, you record &quot;spikes&quot; at 72.3, 185.1, 364.2, 570.2, 679.2, 1060.7... But what is there at 270? It will be useful for the periodicity detection system to be informed that there might be a little spike at 270 just below your event detection threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My own experience with beat tracking / induction is that it works much better &quot;pre-detection&quot; (with a continuous onset detection function keeping &quot;weak&quot; source of informations such as ghost notes) than &quot;post-detection&quot; (where all &quot;weak&quot; events have been thresholded).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-07-22T16:11:57.980" LastActivityDate="2012-07-22T16:11:57.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2948" PostTypeId="1" CreationDate="2012-07-22T21:39:10.037" Score="12" ViewCount="5103" Body="&lt;p&gt;I've been reading some papers in signal proccesing and I'm very confused about the issue in the title of my question. Consider a continuous function of time $t$, $f(t)$, that I sample at uneven times $t_k$, where $k=1,2,...,N$. To me, it makes sense that the sampled function is:&#xA;$$f_s(t)=\sum_{k=1}^N\delta_{t,t_k}f(t),\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (1)$$&#xA;where $\delta_{t,t_k}$ is &lt;strong&gt;Kronecker's&lt;/strong&gt; delta (equals $1$ when $t=t_k$, zero elsewhere). However, &lt;a href=&quot;http://adsabs.harvard.edu/abs/1987AJ.....93..968R&quot;&gt;in this paper&lt;/a&gt;, the author defines the sampled signal as:&#xA;$$f_s(t)=\frac{1}{N}\sum_{k=1}^{N}f(t)\delta(t-t_k),\ \ \ (2)$$&#xA;where $\delta(t-t_k)$ is Dirac's delta function and I really don't get why the $1/N$ appears here (the author claims that the sampling function is actually a weighted sum of delta functions&#xA;$$s(t)=C\frac{\sum_{k=1}^{N}w_k\delta(t-t_k)}{\sum_{k=1}^{N}w_k},$$&#xA;and here he choose $C=w_k=1$. I really didn't understand why). This last statement doesn't make much sense to me: the sampled signal would have infinite amplitude at $t=t_k$! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Despite of all this, it is much easier to define the Fourier Transform of $f_s(t)$ in the second case (equation $(2)$), because it is just the convolution of the window function (the FT of the Dirac comb) and the FT of the continuous signal $f(t)$, while on equation $(1)$ the FT is a bit more complicated because we have an integer function (Kronecker's delta) multiplied by a continuous function ($f(t)$). Any highlights on this?&lt;/p&gt;&#xA;" OwnerUserId="1716" LastActivityDate="2012-07-25T01:49:37.250" Title="Sampling of a continuous function: Kronecker's or Dirac's delta?" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2949" PostTypeId="2" ParentId="2948" CreationDate="2012-07-23T00:04:32.957" Score="9" Body="&lt;p&gt;Modeling of the sampling process via multiplication of a continuous-time signal by a train of Dirac impulses is the most common interpretation in my experience. If you dig into it deeply enough, you'll find some disagreement about the mathematical precision of this approach*, but I wouldn't worry about it; it's just a convenient model for the process. There are no impulse generators inside your cell phone's ADC generating periodic bolts of lightning that multiply their analog inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, you can't calculate the continuous-time Fourier transform of the Kronecker delta function, as its domain isn't continuous (it is limited to the integers). The Dirac delta function, in contrast, has a simple Fourier transform, and the effect of multiplying a signal by a train of Dirac impulses is easy to show due to its sifting property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*: As an example, if you're going to be mathematically precise, you would say that the Dirac delta isn't a function at all, but a &lt;em&gt;distribution&lt;/em&gt; instead. But at an engineering level, these issues are really just semantics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I'll address the comment below. You gave your mental model of the sampling process as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_s(t) = \sum_{k=1}^N \int_{t_k-\epsilon_k}^{t_k+\epsilon_k} f(t) \delta(t-t_k) dt.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with this interpretation is that the typical ideal sampling model does not have that integration built in. Instead, it's a pure multiplication of the input signal by a Dirac impulse train. If you look more closely at the equation you showed for $f_s(t)$, you'll see that the right hand side actually has no independent variable; $t$ is the dummy variable of integration. For any $\epsilon_k &amp;gt; 0$ in the above, according to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirac_delta_function#Translation&quot; rel=&quot;nofollow&quot;&gt;Dirac impulse's sifting property&lt;/a&gt;, you would get: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_s(t)=\sum_{k=1}^N f(t_k),&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which isn't correct. Instead, the model for the sampled signal is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_s(t)=\sum_{k=-\infty}^{\infty} f(t) \delta(t-kT)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is very similar to the above, except generalizing for an infinitely long impulse train along the time axis and assuming that the data is uniformly sampled at time instants $t_k = kT$. The Fourier transform of the resulting signal is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;F_s(\omega) &amp;amp;= \int_{-\infty}^{\infty}f_s(t) e^{-j \omega t} dt \\&#xA;&amp;amp;= \int_{-\infty}^{\infty} \sum_{k=-\infty}^{\infty} f(t) \delta(t-kT) e^{-j \omega t} dt \\&#xA;&amp;amp;= \sum_{k=-\infty}^{\infty} \int_{-\infty}^{\infty} f(t) \delta(t-kT) e^{-j \omega t} dt \\&#xA;&amp;amp;= \sum_{k=-\infty}^{\infty} f(kT) e^{-j \omega kT}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we define the discrete, sampled version of the signal $f(t)$ to be $x[n] = f(nT)$, then you are left with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F_s(\omega) = \sum_{n=-\infty}^{\infty} x[n] e^{-j \omega n}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is exactly the definition of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete-time Fourier transform&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-07-25T01:49:37.250" LastActivityDate="2012-07-25T01:49:37.250" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2950" PostTypeId="2" ParentId="2915" CreationDate="2012-07-23T18:26:53.907" Score="2" Body="&lt;p&gt;As  Dilip Sarwate pointed out, only linear shift-invariant (LSIV) systems have the SISO (sinusoid in- sinusoid out) property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The short answer to your question is that the complex exponentials $ e^{\jmath \omega t}$ are are the &lt;strong&gt;eigenfunctions&lt;/strong&gt; of a LSIV system. By the definition of eigenfunction, if the input is eigenfunction (sine/cos can be represented by complex exponential according to Euler's formula), the output is just the product of the input and the corresponding eigenvalue, which could be a complex number, and that's where changes the phase/amplitude come from.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastEditorUserId="1641" LastEditDate="2012-07-25T16:11:59.857" LastActivityDate="2012-07-25T16:11:59.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2951" PostTypeId="1" CreationDate="2012-07-23T20:27:10.550" Score="8" ViewCount="8281" Body="&lt;p&gt;I'm receiving PCM samples through stream which is one channel, 8000 samples per second. I figured out way of finding out loudness by calculating 'force' of signal by adding abs value of every next 1000 samples and then dividing by samples count which is 1000. It works somewhat good but sometimes my calculations are going crazy, my sum of absolute values of samples seems to constantly build up and reach ridiculous values... so I think that I'm doing something wrong there. Funny thing is that when calculations are going crazy everything will go back to normal when I hit 'sound input device' with my hand ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway. My question is: how to properly calculate loudness of set of PCM samples?&lt;/p&gt;&#xA;" OwnerUserId="1474" LastActivityDate="2012-07-23T23:58:24.610" Title="Loudness of PCM stream" Tags="|audio|sound|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2952" PostTypeId="2" ParentId="2951" CreationDate="2012-07-23T23:08:40.190" Score="1" Body="&lt;p&gt;I'm no expert and not sure what you are trying to achieve, but it sounds like you've made a programming error somewhere, could you show us the code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you say loudness do mean it as defined &lt;a href=&quot;http://en.wikipedia.org/wiki/Loudness&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;? In that case you need to account for the listener.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just interested in energy, maybe RMS is a better choice, or averaged squares.&lt;/p&gt;&#xA;" OwnerUserId="1706" LastActivityDate="2012-07-23T23:08:40.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2953" PostTypeId="2" ParentId="2951" CreationDate="2012-07-23T23:58:24.610" Score="9" Body="&lt;p&gt;To measure the energy (which is closely related to, but not the same as, &quot;loudness&quot;), calculate the RMS (Root-Mean-Square).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ E = \sqrt{\frac{\displaystyle\sum\limits_{n=0}^{N-1} s[n]^2}{N}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N$ is the number of samples and $s[n]$ is the sample at time $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this in any block size of samples.  You can do it on all the samples at once to get an average energy, or you can break your sample set into chunks to see how the energy changes with time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also more sophisticated methods that take into account the body and brain's quirks.  You can find more information about that &lt;a href=&quot;https://dsp.stackexchange.com/questions/290/getting-loudness-of-a-track-with-rms&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-07-23T23:58:24.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2954" PostTypeId="1" CreationDate="2012-07-24T01:58:13.427" Score="7" ViewCount="1352" Body="&lt;p&gt;I've got some data sampled at 32 Hz. The only interesting stuff is happening between about 0-8 Hz and I've got to do real time batch processing and detect events with a delay of no more than a second. So that means I can only perform FFTs with 32 bins or less, to remedy the lack of resolution I'm using a Chirp $\mathcal Z$-transform (&lt;code&gt;czt&lt;/code&gt; in Matlab).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there were special considerations to be made when you choose a windowing function on the original time data before when performing a CZT instead of an FFT?&lt;/p&gt;&#xA;" OwnerUserId="1719" LastEditorUserId="1629" LastEditDate="2016-03-25T16:46:18.173" LastActivityDate="2022-04-17T02:02:30.227" Title="How to choose a windowing function when performing a Chirp $\mathcal Z$-transform?" Tags="|fft|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2956" PostTypeId="1" AcceptedAnswerId="2981" CreationDate="2012-07-24T06:27:51.677" Score="1" ViewCount="146" Body="&lt;p&gt;In the documentation for the [XAudio2 filter parameters] it mentions&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Filter radian frequency calculated as (2*sin(pi*(desired filter cutoff frequency)/sampleRate))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where does this formual come from? What is &quot;Filter radian frequency&quot; and &quot;filter cutoff frequency&quot; and what is the difference. Can someone translate this terminology to mathematics of DFT?&lt;/p&gt;&#xA;" OwnerUserId="955" LastActivityDate="2012-07-27T06:00:04.450" Title="XAudio2 filter radian frequency" Tags="|filters|frequency|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2957" PostTypeId="1" CreationDate="2012-07-24T10:37:32.290" Score="1" ViewCount="602" Body="&lt;p&gt;I am relatively new to time delay estimation. I am working on a project where I am estimating the time-delay from the phase of the cross-correlation function (CCF), since it is more reliable in compensation for the inaccuracy than merely using the absolute value of the CCF in estimating the time delay. I am also looking for how to calculate the phase error if my sampling frequency is three times my center frequency (I am using an LFM signal), and I'm taking time delays which range between -0.5Ts and 0.5Ts. Finally, FFT interpolation can help to limit phase jumps or wraps, by increasing the sampling rate. How is the resulting phase of the signal going to be affected? Here is a portion of my code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;close all&#xA;BW=48*10^3; %bandwidth&#xA;fs = 64*10^3;&#xA;T=1/fs; %pulse width&#xA;fc=200*10^3; %zero centered frequency&#xA;N=512; %sampling points&#xA;n = 0:N/2-1;&#xA;times =1;&#xA;Nrand = 1:100;&#xA;randn('state',0)&#xA;Noise = randn(1,N);&#xA;sampling_interval = T / N; %sampling interval&#xA;h = 0.01*T;&#xA;range =-0.5*T:h:0.5*T;&#xA;&#xA;for w = 1:length(range)&#xA;for u = 1:length(Nrand)&#xA;tau = range(w);&#xA;freqlimit = 0.5 / sampling_interval;&#xA;alpha=BW/(T); %chirp rate&#xA;t=linspace(-T/2,T/2,N); %time interval&#xA;ichannel1=cos(2*pi*fc*t+alpha*pi*t.^2); %real part&#xA;qchannel2=sin(2*pi*fc*t+alpha*pi*t.^2); %imaginary part&#xA;LFMD=(ichannel1+(1i.*qchannel2)); %Complex Base band time domain signal&#xA;LFMD(2:1:10)=0;&#xA;LFMD(504:1:511)=0;&#xA;freq = linspace(-freqlimit/2,freqlimit/2,N);&#xA;FLFMD=(fft(LFMD,N)); %Frequency domain of Base band signal&#xA;[b,a] = butter(2,0.2);&#xA;&#xA;%Fourier Transform of Random Signal&#xA;shift(w) =  range(w);&#xA;x = filter(b,a,LFMD);&#xA;EXP =(exp(-1i*2*pi.*n*(tau)./(N*sampling_interval)));&#xA;EXP = [EXP 1 conj(EXP(N/2:-1:2))];&#xA;% Delayed Signal&#xA;&#xA;Fdelay = FLFMD.*EXP;&#xA;invFdelay = ifft(Fdelay,N);&#xA;&#xA;Modified = (invFdelay);&#xA;y = filter(b,a,Modified);&#xA;&#xA;bx = linspace(-N +1,N-1,1023);&#xA;delay =xcorr(y,x, 'coeff');&#xA;q =(abs(delay));&#xA;[l k] = max (abs(delay));&#xA;&#xA;p=512;&#xA;XP = q((k-32):(k+31));&#xA;ns = length(XP); np = ceil((ns-1)/2);&#xA;Interpoll  = fft(XP);&#xA;padinter = (p/ns)*[Interpoll(1:np+1),zeros(1,p-ns),Interpoll((np+2):length(Interpoll))];&#xA;rsult = (ifft(padinter));&#xA;[lp kp] = max (rsult);&#xA;&#xA;[lmax(w,:) kmax(u,:)] = max(delay);&#xA; theata(w,:) = angle(lmax(w,:));&#xA;theta2(w,:) = atan2(imag(lmax(w,:)),real(lmax(w,:)));&#xA;%timed(w) = (theta2(w) + 2*pi)/(2*pi*fc);&#xA;timed1(w,:) = (theta2(w,:))/(2*pi);&#xA;Kmult(w,:) =abs(theta2(w,:)- 2*pi*fc*(timed1(w,:)))/(2*pi);&#xA;[l2 k2] = max ((delay)); &#xA;end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1721" LastEditorUserId="1530" LastEditDate="2012-07-24T16:34:50.643" LastActivityDate="2012-07-24T16:34:50.643" Title="Estimating The Time-delay using the Phase of the Cross- Correlation function" Tags="|zero-padding|phase|time-frequency|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2958" PostTypeId="2" ParentId="2284" CreationDate="2012-07-24T11:56:51.570" Score="6" Body="&lt;p&gt;I interpret the question as follows:  If we modulate a carrier with a pure tone using AM, we get a single set of sidebands, but if we modulate with phase modulation, we get an infinite number of sidebands, spaced at the modulation frequency.  Why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy to see why amplitude modulation at a single frequency gives exactly two sidebands.  Simply multiply out the expression for AM:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(t) = (1 + m cos(Ω t)) exp(i ω t)&#xA;&#xA;y(t) = (1 + (m/2) ( exp(i Ω t) + exp(-i Ω t) )) exp(i ω t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here we see that we get sidebands offset by the modulation frequency Ω from the carrier frequency ω.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, phase modulation.  I refer you to &lt;a href=&quot;http://nibot-lab.livejournal.com/114405.html&quot; rel=&quot;noreferrer&quot;&gt;this animation&lt;/a&gt; (generated by &lt;a href=&quot;https://gist.github.com/1015769&quot; rel=&quot;noreferrer&quot;&gt;this matlab script&lt;/a&gt;) of the phasor diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CJ6og.gif&quot; alt=&quot;Phasor animation of phase modulation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As seen in the animation, the higher order sidebands are necessary to keep the amplitude of the resultant phasor (in red) constant and thus produce pure phase modulation.  You can see how each pair of higher order sidebands is needed to correct the deviation from a circular arc introduced by the lower order sidebands.&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-07-24T12:04:36.773" LastActivityDate="2012-07-24T12:04:36.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2959" PostTypeId="2" ParentId="2939" CreationDate="2012-07-24T12:25:22.637" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What are the signal processing principles behind our eye merging the many tiny images into a large coherent one?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From what I've read (&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1402015070&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source 1: Front-End Vision and Multi-Scale Image Analysis&lt;/a&gt;, &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0123814642&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source 2: Information Visualization&lt;/a&gt;), our eyes apply something very similar to a set of &lt;a href=&quot;http://en.wikipedia.org/wiki/Gabor_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;gabor filters&lt;/a&gt; to the visual inputs we get. So if you, i.e. focus on Mona Lisa's eye, your brain processes gabor filters at the scale roughly the size of the eye, and such a filter removes details at smaller scales.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there etiological explanations of optical illusions in general - by this I mean can it be explained why image inputs get parsed in 'wrong' ways by the eye/brain, why does the human parser get confused; what transfer function is in play?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Regarding optical illusions in general: There is tons of research. The two books I've mentioned above quote some of it, but I don't know enough about it to compress it into a good answer here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But regarding this special case, there's actually a very elegant explanation in &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1402015070&quot; rel=&quot;nofollow noreferrer&quot;&gt;Front-End Vision and Multi-Scale Image Analysis, p208&lt;/a&gt;, which I'll try to repeat here: Take a &quot;natural&quot; sample image. Split the image into small blocks. Multiply each block with a window function (e.g. a gaussian).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I'll take the &quot;Lena&quot; image in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sample = ColorConvert[ExampleData[{&quot;TestImage&quot;, &quot;Lena&quot;}], &quot;Grayscale&quot;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;split it into 16x16 pixel blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;blocks = Flatten[Partition[ImageData[sample], {16, 16}, {5, 5}], 1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;multiply each block with a gaussian window:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;window = Table[Exp[-(x^2 + y^2)/25], {x, -7.5, 7.5}, {y, -7.5, 7.5}];&#xA;blockTimesWindow = Map[window * # &amp;amp;, blocks];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the blocks look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/veM77.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I'll use SVD to find the principal components of these blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{u, s, v} = SingularValueDecomposition[Flatten /@ blockTimesWindow, 10];&#xA;Image[0.5 + Partition[#, 16], ImageSize -&amp;gt; 100] &amp;amp; /@ Transpose[v]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and visualize them:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rWskH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the principal components of small parts of my test image. Or in other words: any small part of my test image is (approximately) a weighted sum of these principal components, plus noise. And it's not just this test image. Take any photograph of a natural scene, the result will look very similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the principal components look suspiciously like gabor filter kernels or gaussian derivatives. That explains why filters like these are a good choice to analyze natural images: in a natural image, any small part is (almost) the weighted sum of a few gabor filter kernels plus noise. And it explains why evolution would choose this kind of low-level processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now your image is &lt;em&gt;not&lt;/em&gt; a natural image: Neighboring pixels are not correlated the way they would be in a natural image. But our eyes still use processes that were optimized for natural scenes, where differences at smaller scales don't carry as much important information, so they are filtered out. That explains why the illusion works.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-07-24T12:25:22.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2960" PostTypeId="2" ParentId="2961" CreationDate="2012-07-24T15:16:50.417" Score="3" Body="&lt;p&gt;Since this is a comparison of a template image, to a spatially, (and circularly) &lt;em&gt;translated&lt;/em&gt; variant of it, then the power spectra of both will remain the same, but the phase spectra will be different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe in your example, the approach of a simple circular convolution between your image, and the template will be what you want. The result is also an image, and once you have that, you search for a peak. How much off in the vertical/horizontal direction that peak is from the a peak that you would have normally got had you circularly convolved the template with itself, will give you the spatial delay you have in both horizontal and vertical space respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can implement that by taking the (same size as images) Fourier transform of your template image, (first one), and multiplying it with the Fourier transform of your image, (second one), and then inverse Fourier transforming the result back into the spatial domain. Once there, you can look for the peak as mentioned in the first paragraph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is assuming your images are the same size, as you stated.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-07-24T20:22:06.500" LastActivityDate="2012-07-24T20:22:06.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2961" PostTypeId="1" CreationDate="2011-07-12T01:12:44.073" Score="7" ViewCount="224" Body="&lt;p&gt;I'm not quite sure of the mathematical terminology here but...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a variant (or post-processing) of a Discrete Fourier Transform that separates the shape of a signal from any phase shift applied to the whole signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example this image:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qNJA0.png&quot; alt=&quot;unrotated letter &amp;quot;A&amp;quot;&quot;&gt;&lt;br&gt;&#xA;and this one:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yFXRX.png&quot; alt=&quot;letter &amp;quot;A&amp;quot; rotated 8 pixels right/3 pixels down&quot;&gt;&lt;br&gt;&#xA;should differ in at most 2 coefficients (one for each dimension in which it is shifted) in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively is there a way to index images so that any image can be found in a database given a translated copy as a key?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;My images are all 1D or 2D with power-of-two sizes (but not necessarily square.)&lt;/li&gt;&#xA;&lt;li&gt;This project has nothing to do with OCR (even though I used a character glyph in the example.)  Please do not suggest OCR-specific algorithms/libraries!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="272" OwnerDisplayName="finnw" LastEditorUserId="4682" LastEditDate="2013-07-06T02:00:54.687" LastActivityDate="2013-07-06T02:00:54.687" Title="Variant of discrete fourier transform that isolates phase delay?" Tags="|dft|phase|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2962" PostTypeId="1" CreationDate="2012-07-21T22:27:37.623" Score="19" ViewCount="18164" Body="&lt;p&gt;I'm down sampling voice audio by first performing an FFT, then only taking the parts of the result that I need, and then performing an inverse FFT. However, it's only working properly when I'm using frequencies that are both power of two, say down-sampling from 32768 to 8192. I perform an FFT on the 32k data, discard the top 3/4 of the data and then perform an inverse FFT on the remaining 1/4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, whenever I try to do this with data that doesn't line up properly one of two things happen: The math library I'm (Aforge.Math) using throws a fit, because my samples are not a power of two. If I try to zero-pad the samples so they become power of twos, it get gibberish out on the other end. I also tried to use a DFT instead, but it ends up being insanely slow (this needs to be done in real time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about to zero pad the FFT data properly, both on the initial FFT and the inverse FFT at the end? Assuming I have a sample at 44.1khz that needs to get to 16khz, I currently try something like this, the sample being 1000 in size.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Pad input data to 1024 at the end&lt;/li&gt;&#xA;&lt;li&gt;Perform FFT &lt;/li&gt;&#xA;&lt;li&gt;Read the first 512 items into an array (I only need the first 362, but need ^2)&lt;/li&gt;&#xA;&lt;li&gt;Perform inverse FFT&lt;/li&gt;&#xA;&lt;li&gt;Read the first 362 items into the audio play buffer&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From this, i get garbage out at the end. Doing the same thing but without having to pad at step 1 and 3 due to the samples already being ^2, gives a correct result.&lt;/p&gt;&#xA;" OwnerDisplayName="thr" LastEditorUserId="128" LastEditDate="2021-05-29T10:46:33.543" LastActivityDate="2021-05-29T10:46:33.543" Title="How to Resample Audio Using FFT or DFT" Tags="|audio|interpolation|resampling|c#|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2963" PostTypeId="1" AcceptedAnswerId="2964" CreationDate="2012-07-24T20:17:15.133" Score="5" ViewCount="8393" Body="&lt;p&gt;I am trying to figure out the details on how to implement the structure tensor in Matlab and need some advice!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an image $\ I(x,y) $ the structure tensor S is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S=\begin{pmatrix}&#xA;W \ast I_x^2 &amp;amp; W \ast (I_xI_y)\\&#xA;W \ast (I_xI_y) &amp;amp; W \ast I_y^2  &#xA;\end{pmatrix}$$&#xA;where W is a smoothing kernel, $\ \ast $ denotes convolution and subscript denotes partial derivative with respect to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use a Gaussian as smoothing kernel. This is separable:&#xA;$$ W = G_{\sigma}*(G_{\sigma})^T$$&#xA;The constant $\ \sigma $ controls the outer/integration scale.&#xA;E.g. if I truncate it at $\ +/- 2\sigma$ and use  $\ \sigma = 1$ I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ G_{\sigma} = [0.0103,0.2076,0.5642,0.2076,0.0103] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the input to the Gaussian might have a mean different from 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I compensate for this?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking substracting the mean first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use central differences to estimate the partial derivatives:&#xA;$$ I_x \approx [-0.5 \hspace{2 pt} 0 \hspace{2 pt} 0.5]*I $$ &#xA;However since the image is noisy it is probably better to use a more robust differentian operator.&#xA;The Sobel operator is such an operator. However according to &lt;a href=&quot;http://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;noreferrer&quot;&gt;wikipedia&lt;/a&gt; it is not perfectly rotational symmetric. The Scharr operators are supposed to be perfectly rotational symmetric and robust approximations of the partial derivatives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ I_x \approx \frac{1}{32}\begin{pmatrix}&#xA;-3 &amp;amp; 0 &amp;amp; 3\\&#xA;-10 &amp;amp; 0 &amp;amp; 10\\&#xA;-3 &amp;amp; 0 &amp;amp; 3&#xA;\end{pmatrix} * I$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ I_y \approx \frac{1}{32}\begin{pmatrix}&#xA;-3 &amp;amp; -10 &amp;amp; -3\\&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;3 &amp;amp; 10 &amp;amp; 3&#xA;\end{pmatrix} * I$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Scharr operators are separable:&#xA;$$ \begin{pmatrix}&#xA;-3 &amp;amp; 0 &amp;amp; 3\\&#xA;-10 &amp;amp; 0 &amp;amp; 10\\&#xA;-3 &amp;amp; 0 &amp;amp; 3&#xA;\end{pmatrix} = [-1,0,1]*[3,10,3]^T $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{pmatrix}&#xA;-3 &amp;amp; -10 &amp;amp; -3\\&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;3 &amp;amp; 10 &amp;amp; 3&#xA;\end{pmatrix} = [3,10,3]*[-1,0,1]^T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The elements of the structure tensor now becomes series of consecutive horizontal and vertical convolutions with the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Another option (thanks to nikie!) is the Gaussian derivative.&#xA;Introducing &#xA;$$ GD_{\sigma}=\frac{-x}{\sigma}G{\sigma}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this then correct?&lt;/strong&gt;&#xA;$$ Ix = G{\sigma}^T*(GD_{\sigma}*I) $$&#xA;$$ Iy = G{\sigma}*(GD_{\sigma}^T*I) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I Implement this easily in Matlab?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How about in C++?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Any comments regarding choice of smoothing kernel and differentiation operator?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: My Matlab code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% I: image&#xA;% si: inner (differetiation) scale,&#xA;% so: outer (integration) scale&#xA;function [Sxx, Sxy, Syy] = structureTensor(I,si,so)&#xA;[m n] = size(I);&#xA;&#xA;Sxx = NaN(m,n);&#xA;Sxy = NaN(m,n);&#xA;Syy = NaN(m,n);&#xA;&#xA;% Robust differentiation by convolution with derivative of Gaussian:&#xA;x  = -2*si:2*si;&#xA;g  = exp(-0.5*(x/si).^2);&#xA;g  = g/sum(g);&#xA;gd = -x.*g/si; % is this normalized?&#xA;&#xA;Ix = conv2( g',conv2(gd,I) );&#xA;Iy = conv2( g,conv2(gd',I) );&#xA;&#xA;Ixx = Ix.^2;&#xA;Ixy = Ix.*Iy;&#xA;Iyy = Iy.^2;&#xA;&#xA;&#xA;% Smoothing:&#xA;x  = -2*so:2*so;&#xA;g  = exp(-0.5*(x/so).^2);&#xA;Sxx = conv2( g',conv2(g,Ixx) ); &#xA;Sxy = conv2( g',conv2(g,Ixy) );&#xA;Syy = conv2( g',conv2(g,Iyy) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I normalize the Gaussian derivative?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-07-24T22:45:19.460" LastActivityDate="2012-07-25T07:06:50.117" Title="How do I implement the Structure tensor (in Matlab)?" Tags="|image-processing|matlab|software-implementation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2964" PostTypeId="2" ParentId="2963" CreationDate="2012-07-24T21:48:51.743" Score="8" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;However the input to the Gaussian might have a mean different from 0.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Unless your image is completely constant, $I_x^2$ and $I_y^2$ are guaranteed to have a mean &gt; 0 (assuming the input pixels are all reals, of course).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I compensate for this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why would you want to do that?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I was thinking substracting the mean first. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Subtracting the mean before applying a derivative operator like Sobel or Scharr? That shouldn't make any difference.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Scharr operators are supposed to be perfectly rotational symmetric &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Perfect rotational symmetry? Is that even possible with a finite kernel? I think the Scharr operator is just optimal (in a least-squares sense) for that filter size. With larger filter sizes, you get better rotational symmetry.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I Implement this easily in Matlab?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;code&gt;imfilter&lt;/code&gt; to apply the Sobel or Scharr filters, then &lt;code&gt;.*&lt;/code&gt; to multiply/square the results pixelwise, then &lt;code&gt;imfilter&lt;/code&gt; again to apply the gaussian smoothing kernel.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How about in C++?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any decent image processing library should contain functions for linear filters and pixel-wise multiplication. e.g. for the IPP, the functions would be called &lt;code&gt;ippiFilterRow/Column...&lt;/code&gt;, &lt;code&gt;ippiMul...&lt;/code&gt; and &lt;code&gt;ippiSqr...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Any comments regarding choice of smoothing kernel and differentiation operator?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think the gaussian smoothing kernel is pretty standard. Sobel and Scharr are both common choices for the differentiation operator. Another good choice would be a gaussian derivative filter. Which one's best depends on your application: how noisy are your images? How sharp are the contrasts you're looking for? (If there's lots of noise, and the contrasts are sharp, a derivative filter with a larger aperture like the gaussian derivative might be better). How important is rotational symmetry? &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I normalize the Gaussian derivative?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The gaussian is: $\frac{1}{2 \pi  \sigma ^2}e^{-\frac{x^2+y^2}{2 \sigma ^2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Deriving by x yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\partial _x\left(\frac{1}{2 \pi  \sigma ^2}e^{-\frac{x^2+y^2}{2 \sigma ^2}}\right) = -\frac{e^{-\frac{x^2+y^2}{2 \sigma ^2}} x}{2 \pi  \sigma ^4}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think you should divide by &lt;code&gt;gd = -x.*g/(si^2);&lt;/code&gt; because &lt;code&gt;sum(g)=2*pi*(si^2)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2012-07-25T07:06:50.117" LastActivityDate="2012-07-25T07:06:50.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2965" PostTypeId="1" CreationDate="2012-07-24T14:43:35.280" Score="8" ViewCount="610" Body="&lt;p&gt;I'm essentially a math student working on algorithms for a chemistry problem involving rotational spectra, and I keep coming across references to Wang transformations but have been unable to track down what the Wang basis is. You can assume I have the analysis background to understand what a basis of a function space is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was developed by S. C. Wang, as referenced by King, Hainer and Cross in Journal of Chemical Physics 11, pg 27 and S. C. Wang in Physical Review 34, p.243, 1929 (where I think it's defined) It doesn't show up in any of the math texts I have (up to Rudin's Functional Analysis) or any of the classical mech or quantum texts I have (which are more the undergrad level).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best I can make out is that it transforms the wave functions from a symmetric rotor basis to something that is characterized by representations of the Klien Four group.  It's used because it eases the computation of the eigenvalues of the Hamiltonians, used to compute transitions of the rotational spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in short, what is the Wang basis? &lt;/p&gt;&#xA;" OwnerUserId="1725" OwnerDisplayName="Michael Conlen" LastEditorUserId="76" LastEditDate="2012-07-26T12:52:56.373" LastActivityDate="2013-08-19T07:09:55.447" Title="Wang Transformation" Tags="|transform|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="2967" PostTypeId="1" CreationDate="2012-07-25T03:13:00.983" Score="4" ViewCount="149" Body="&lt;p&gt;I have an application with two separated GPS receivers giving live positions and I'm deriving a heading/displacement from the vector between them.  Each set of position measurements is noisy and has dropouts but I do have a quality estimate. So far it's classic Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relation between the two antennas isn't fixed, both are moving independently and generally one is moving at higher rate than the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But obviously some of the error is correlated between the two receivers, so do I filter each antennae location separately or the filter the displacement? &#xA;Or is there a cleverer alternative?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;: As an example suppose you have a GPS on a boat and on a towed sonar array - and you are trying to track the relative position of the sonar receiver. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general uncertainties on each antennae position are similar. But some errors will correlate between them - eg. if an atmospheric effect moves both readings 10m North this has zero effect on the difference but would effect any filter/average of each position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Arguing against simply averaging/filtering on the displacement vector is that the motion of each receiver is different, the boat is relatively steady - the sonar bounces around in the waves. So the statistics of each if you have any sort of averaging filter are different.&lt;/p&gt;&#xA;" OwnerUserId="1002" LastEditorUserId="1002" LastEditDate="2012-07-25T15:47:10.230" LastActivityDate="2012-08-09T03:48:46.953" Title="Filtering difference of correlated measurements" Tags="|filters|kalman-filters|position|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="2969" PostTypeId="1" CreationDate="2012-07-25T14:45:40.537" Score="16" ViewCount="37184" Body="&lt;p&gt;I have convolved a random signal with a a Gaussian and added noise (Poisson noise in this case) to generate a noisy signal. Now I would like to deconvolve this noisy signal to extract the original signal using the same Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I need a code which does the job of deconvolution in 1D. (I have already found some in 2D but my main aim is 1D).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please suggest me some packages or programs that are able to do so? (Preferably in MATLAB)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help.&lt;/p&gt;&#xA;" OwnerUserId="1724" LastEditorUserId="128" LastEditDate="2019-11-28T06:09:38.590" LastActivityDate="2022-03-13T11:41:55.753" Title="Deconvolution of 1D Signals Blurred by a Gaussian Kernel" Tags="|matlab|convolution|continuous-signals|deconvolution|1d|" AnswerCount="13" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2970" PostTypeId="1" AcceptedAnswerId="2974" CreationDate="2012-07-25T16:00:04.233" Score="14" ViewCount="18784" Body="&lt;p&gt;Can I get help on how to make frequency axis going from negative frequency to positive frequency, (in Hertz), that will be the x-axis in an FFT result, but given either an even length FFT, or odd length FFT. I am having some troubles making it in MATLAB. (Assume you know the sampling frequency f_s).&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2014-07-10T14:04:00.027" Title="How to make frequency axis for even and odd FFT length?" Tags="|frequency-spectrum|frequency|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2971" PostTypeId="2" ParentId="2970" CreationDate="2012-07-25T18:32:10.427" Score="9" Body="&lt;p&gt;You can make a positive frequency spectrum quite simply (where &lt;code&gt;fs&lt;/code&gt; is the sampling rate and &lt;code&gt;NFFT&lt;/code&gt; is the number of fft bins). In the Matlab implementation of the FFT algorithm, the first element is always the DC component, hence why the array starts from zero. THis is true for odd and even values of NFFT.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%//Calculate frequency axis&#xA;df = fs/NFFT;&#xA;fAxis = 0:df:(fs-df);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to wrap the frequency spectrum, you need to take into account whether you have an odd numbered NFFT. There always &lt;strong&gt;needs to be a DC component&lt;/strong&gt;, so . . &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;df = fs/NFFT;&#xA;fAxis = (0:df:(fs-df)) - (fs-mod(NFFT,2)*df)/2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice how the calculation of the positive frequency axis is identical to above, but the FFT-shifted term changes to accomodate even or odd FFT lengths. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These code snippets were taken from a long answer posted on SO (that you might find interesting) found here:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/9694297/matlab-fft-xaxis-limits-messing-up-and-fftshift/9699983#9699983&quot;&gt;https://stackoverflow.com/questions/9694297/matlab-fft-xaxis-limits-messing-up-and-fftshift/9699983#9699983&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-07-25T20:08:16.847" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2974" PostTypeId="2" ParentId="2970" CreationDate="2012-07-26T05:08:52.250" Score="6" Body="&lt;p&gt;One approach is simply to calculate the frequency vector for the unshifted DFT output (i.e. what you would get directly from MATLAB's &lt;code&gt;fft()&lt;/code&gt; function, without doing an &lt;code&gt;fftshift()&lt;/code&gt;), then remap the frequencies that correspond to locations on the negative side of the axis. Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% assume input signal &quot;x&quot;, sampling frequency &quot;fs&quot;&#xA;% calculate FFT&#xA;X = fft(x,Nfft);&#xA;% calculate frequency spacing&#xA;df = fs / Nfft;&#xA;% calculate unshifted frequency vector&#xA;f = (0:(Nfft-1))*df;&#xA;% move all frequencies that are greater than fs/2 to the negative side of the axis&#xA;f(f &amp;gt;= fs/2) = f(f &amp;gt;= fs/2) - fs;&#xA;% now, X and f are aligned with one another; if you want frequencies in strictly&#xA;% increasing order, fftshift() them&#xA;X_normal_order = fftshift(X);&#xA;f_normal_order = fftshift(f);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The answer provided by learnvst should work also; this is just another way of thinking about it that doesn't require any special casing for even/odd DFT sizes.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-07-27T02:16:57.313" LastActivityDate="2012-07-27T02:16:57.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2975" PostTypeId="1" CreationDate="2010-06-11T07:31:16.117" Score="15" ViewCount="6226" Body="&lt;p&gt;How can I detect a quadrilateral signboard from an image captured using a mobile phone?&#xA;How can i detect shapes like rectangle? rounded rectangle (rounded corners instead of shape corners)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using opencv.wrapper  but i am new to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the sample:&#xA;&lt;a href=&quot;http://www.freeimagehosting.net/uploads/b03442fd36.png&quot; rel=&quot;noreferrer&quot;&gt;alt text http://www.freeimagehosting.net/uploads/b03442fd36.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.freeimagehosting.net/uploads/e6b36040e8.png&quot; rel=&quot;noreferrer&quot;&gt;alt text http://www.freeimagehosting.net/uploads/e6b36040e8.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the noise and many lines there, i am not able to determine which is the boundary line of the signboard. Sometimes I can find the boundary of the lines after hough transform. I am trapped....in this kind of scenario...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the 2 raw pictures taken from mobile phone camera&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.freeimagehosting.net/uploads/6dbd613edf.jpg&quot; rel=&quot;noreferrer&quot;&gt;alt text http://www.freeimagehosting.net/uploads/6dbd613edf.jpg&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.freeimagehosting.net/uploads/720da20080.jpg&quot; rel=&quot;noreferrer&quot;&gt;alt text http://www.freeimagehosting.net/uploads/720da20080.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need ya advice to see how i can process the image to get the signboard out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much &lt;/p&gt;&#xA;" OwnerDisplayName="user364295" LastActivityDate="2012-07-30T10:16:17.237" Title="Image Processing: How to detect a quadrialteral signboard in image?" Tags="|c#|image-processing|" AnswerCount="3" CommentCount="17" ContentLicense="CC BY-SA 2.5" />
  <row Id="2976" PostTypeId="2" ParentId="2975" CreationDate="2010-06-20T01:53:54.550" Score="0" Body="&lt;p&gt;Another approach that you can take that is more robust to noises in this situation is to generate a curve of the mean gray-level of the image along the x-axis and along the y-axis. That is, compute the mean gray level for each line/column in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, for example, the signboard (or its borders) is lighter than its surroundings (which is the case for all the examples shown in the question) you will have two peaks in your x-axis curve (for the left and right and borders) and two peaks in you y-axis curve (for the top and bottom borders). Using a border detection technique for a 1-dimension signal (maybe a high-pass filter) you can deduce the corners coordinates of the signboard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen this approach being used to to detect license plates and also for face recognition (the nose tends to be the brighter part of the face, so it generates a peak in the x-axis and y-axis curves).&lt;/p&gt;&#xA;" OwnerUserId="1161" OwnerDisplayName="Alceu Costa" LastActivityDate="2010-06-20T01:53:54.550" CommentCount="1" ContentLicense="CC BY-SA 2.5" />
  <row Id="2977" PostTypeId="1" CreationDate="2012-07-26T17:57:06.150" Score="2" ViewCount="154" Body="&lt;p&gt;&lt;a href=&quot;http://pdf.aminer.org/000/301/315/discovering_similar_multidimensional_trajectories.pdf&quot; rel=&quot;nofollow&quot;&gt;Paper&lt;/a&gt; describes that a 2D signal(say video) can be projected to 1D for time series analysis by using a transformation function &lt;code&gt;fx=Ax+constant&lt;/code&gt; and &lt;code&gt;fy=Ay+constant&lt;/code&gt; where &lt;code&gt;Ax , Ay&lt;/code&gt; represents the &lt;code&gt;(x,y)&lt;/code&gt; coordinates of a single &lt;code&gt;trajectory A&lt;/code&gt;. Then,these &lt;code&gt;fx vs t&lt;/code&gt; can be plotted and various analysis can be performed. Going by their justification,is it logical to think that a coordinate position of an object can only be described by a single coordinate when doing time series analysis and signal compression?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also,they mention about taking cartesian product.Why is that?&lt;/p&gt;&#xA;" OwnerUserId="1728" LastActivityDate="2012-07-26T21:05:19.700" Title="Projection of 2D signal" Tags="|discrete-signals|reference-request|video-processing|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2978" PostTypeId="2" ParentId="2975" CreationDate="2012-07-26T19:55:40.710" Score="7" Body="&lt;p&gt;Both your images contain many lines that have nothing to do with the sign you're looking for. And some of those lines are longer/have higher contrast than the lines you actually want, so I think detecting the edge lines (e.g. using a hough transform or by summing up contrasts horizontally/vertically) will not work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But: The sign you're looking for has other characteristics that should be easier to detect:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There sign background has (almost) constant brightness&lt;/li&gt;&#xA;&lt;li&gt;It takes up a relatively large area of the image&lt;/li&gt;&#xA;&lt;li&gt;It's near the center of the image&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So you're looking for a large connected area with low contrast. I've hacked a proof-of-concept algorithm in Mathematica. (I'm not an OpenCV expert, but I'll mention the respective OpenCV function when I know them.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I use gaussian derivative filters to detect the gradient magnitude at each pixel. The gaussian derivative filter has a wide aperture (11x11 pixels in this case), so it is very noise-insensitive. I then normalize the gradient image to mean=1, so I can use the same thresholds for both samples.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;src = Import[&quot;http://www.freeimagehosting.net/uploads/720da20080.jpg&quot;];&#xA;pixels = ImageData[ColorConvert[src, &quot;Grayscale&quot;]];&#xA;gradient = Sqrt[GaussianFilter[pixels, 5, {1, 0}]^2 + GaussianFilter[pixels, 5, {0, 1}]^2];&#xA;gradient = gradient/Mean[Flatten[gradient]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OpenCV implementation: You can use &lt;code&gt;sepFilter2D&lt;/code&gt; for the actual filtering, but &lt;a href=&quot;https://stackoverflow.com/questions/9676302/converting-matlab-gaussian-derivatives-to-opencv&quot;&gt;apparently, you'll have to calculate the filter kernel values yourself&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ipjs2.png&quot; alt=&quot;gradient magnitude&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this image, the sign background is dark and the sign borders are bright. So I can binarize this image and look for dark connected components.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;binaryBorders = Binarize[Image[gradient], 0.2];&#xA;sign = DeleteBorderComponents@ColorNegate[binaryBorders];&#xA;largestComponent = SortBy[ComponentMeasurements[sign, {&quot;Area&quot;, &quot;ConvexVertices&quot;}][[All, 2]], First][[-1, 2]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OpenCV implementation: Thresholding should be straightforward, but I think OpenCV doesn't contain connected component analysis - you can either use flood fill or &lt;a href=&quot;http://opencv.willowgarage.com/wiki/cvBlobsLib/&quot; rel=&quot;nofollow noreferrer&quot;&gt;cvBlobsLib&lt;/a&gt; for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, just find the largest blob near the center of the image and find the convex hull (I've simply used the largest blob that's not connected to the background, but that might not be enough for every image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Results:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9K1Km.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/30TWq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2012-07-26T19:55:40.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2979" PostTypeId="2" ParentId="2977" CreationDate="2012-07-26T21:05:19.700" Score="1" Body="&lt;p&gt;Yes you can re-represent the 2d signal as a 1-d signal and use signal processing algorithms on it. In doing this you can lose some of benefits of representing the data this way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg. If you were looking at compression of a mostly continuous 2-d dataset you may get benefits by treating the data as 2-dimensional and compressing in each dimension. Representing the data as concatenated rows or columns introduces discontinuities that the compression won't handle as well.&lt;/p&gt;&#xA;" OwnerUserId="178" LastActivityDate="2012-07-26T21:05:19.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2980" PostTypeId="1" AcceptedAnswerId="2982" CreationDate="2012-07-26T23:18:53.643" Score="5" ViewCount="912" Body="&lt;p&gt;I'm writing a program to emulate a vocoder and it obviously works, but any speech that comes through is very difficult to understand. I'm going to explain exactly how my implementation works and then maybe somebody with experience with vocoders or DSP can help me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;128 samples of the voice signal go through a Fast Fourier Transform every audio frame. I then take the absolute value of the complex outputs to get the formant of the voice. I chose this rather than multiple band pass filters and envelope followers because it's faster just to do an FFT. I am 100% sure that this is all done correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My carrier wave is run through several band pass filters centered around frequencies corresponding to the FFT output frequencies. To construct the output I multiply the output of these filters by the corresponding amplitudes in the voice formant obtained from the FFT and add all of these products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a few things that I suspect may be causing issues.&#xA;The algorithm I used to implement the band pass filters is probably not the best. I feed the output of a low pass filter into a high pass filter. I got the algorithms for the filters under the &quot;Algorithmic Implementation&quot; section of the low pass and high pass filter articles on Wikipedia. I have a strong feeling that these simple filters may not be attenuating unwanted frequencies very well but I can't find a better way to make my band pass filter.&#xA;I also suspect that my carrier wave might not be very good. As I understand it, you need a carrier wave rich in lots of different frequency content (so obviously not a sine wave). I've listened to a lot of vocoders and the carrier wave usually sounds like it's got some dissonant notes in it. I've tried additive synthesis and FM synthesis but I just can't get a carrier wave that doesn't sound too &quot;clean&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If somebody could give me a better band pass algorithm (if that's what I need), a good formula for a carrier wave, or point out some other likely problem I would be very grateful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ALSO, &quot;vocoder&quot; is not an available tag. Maybe somebody with enough permissions could kindly add this tag? Also, there's a tag for signal-processing but not digital-signal-processing or DSP, I'm not sure if it would be appropriate to add one of these tags or not.&lt;/p&gt;&#xA;" OwnerUserId="1737" OwnerDisplayName="Big Endian" LastEditorUserId="1737" LastEditDate="2012-07-27T04:51:03.243" LastActivityDate="2012-07-27T09:54:58.337" Title="My vocoder sounds bad" Tags="|filters|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2981" PostTypeId="2" ParentId="2956" CreationDate="2012-07-27T06:00:04.450" Score="0" Body="&lt;p&gt;That is simply converting analog frequency into digital frequency. For example, if you want a cutoff of 1kHz at a sample rate of 44.1kHz, the corresponding digital frequency is 2*pi*1000/44100 = 0.142... radiants.&#xA;In terms of DFT the digital frequency is the $ \omega $ in the $e^{^-j\cdot \omega }$ term of the DFT&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-27T06:00:04.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2982" PostTypeId="2" ParentId="2980" CreationDate="2012-07-27T07:45:52.380" Score="7" Body="&lt;p&gt;First, it seems to me that you are doing the analysis incorrectly. 128 linearly spaced channels is both too high (it won't capture a smoothed spectral envelope - vocoders usually have at most ~30 channels) and too small (it has a very poor resolution in the lowest frequencies and won't discriminate different formants). You really need to replace that by a bank of constant-Q band-pass filters, 2 or 3 bands / octave to get something that is coarse enough to capture the spectral envelope without picking individual frequency peaks, yet discriminates the frequencies of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your analysis and synthesis filters can be implemented with &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot;&gt;biquads&lt;/a&gt;. Running a dozen of those in parallel is not cost-prohibitive compared to a FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the carrier wave, you can start with a sawtooth or narrow pulse - avoid waveforms like triangle, square, or sine whose spectrum have &quot;gaps&quot;. Then stack a few of them to play a chord. You can thicken the carrier by adding slightly detuned version of each component or octaves. Note that in order to achieve the best sounding results, band-limited synthesis (for example with &lt;a href=&quot;http://www.cs.cmu.edu/~eli/papers/icmc01-hardsync.pdf&quot;&gt;minBLEPs&lt;/a&gt;) has to be used to synthesize the square or sawtooth waves.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-07-27T09:54:58.337" LastActivityDate="2012-07-27T09:54:58.337" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2983" PostTypeId="2" ParentId="2969" CreationDate="2012-07-28T12:26:58.077" Score="3" Body="&lt;p&gt;Convolution is the multiplication and summation of two signals one on to the other. I am talking about two deterministic signals. If you want to deconvolve one from the other then this corresponds to the solution of system of equations. As you might know system of equations are not always solvable. The system of equations can be overdetermined, underdetermined or exactly solvable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you add some noise, then you loose some information and you can not get this information back. What you can do is again to solve the linear system of equations considering the fact that each coefficient is added a noise term. Or as you can see in another answer to your question, you might want to first estimate the original signal from the noisy signal and then try to solve the system of equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important to note that the noise is added to the multiplied and summed up coefficients. Therefore it might even be the case that your system of equation is eventually not uniquly solvable. To be sure that it is uniquely solvable your coefficient matrix should be square and of full rank.&lt;/p&gt;&#xA;" OwnerUserId="1741" LastEditorUserId="1741" LastEditDate="2012-08-02T21:53:00.080" LastActivityDate="2012-08-02T21:53:00.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2984" PostTypeId="1" CreationDate="2012-07-29T01:31:31.910" Score="10" ViewCount="1318" Body="&lt;p&gt;Given something like 103 data points ($N=103$), a DFT will give back 103 frequency values. Then to do something like filtering the high frequencies involves setting the high frequency values from the DFT to zero, and doing the inverse DFT to get back 103 data points that represent the original signal without the high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes sense to me given all 103 data points all at once. But what about streaming an audio WAV file that is rather large (say for example $N=10^5$). If one wanted to filter the high frequencies then the approach i just described on the entire data of $10^5$ points logically makes sense. But that is not reasonable when streaming a WAV file for playback. What is done to high frequency filter a streaming playback of an audio file?&lt;/p&gt;&#xA;" OwnerUserId="955" LastActivityDate="2012-07-29T10:35:32.523" Title="Filtering of streaming audio" Tags="|filters|audio|lowpass-filter|highpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2985" PostTypeId="2" ParentId="2984" CreationDate="2012-07-29T02:57:27.310" Score="8" Body="&lt;p&gt;The best way to apply frequency domain filtering for signal streams is overlap add (or related flavors overlap save, or block convolvers, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You basically take in one frame at a time (say 1024 samples). Zero pad to twice the length (2048), do an FFT, multiply with  (also zero padded) transfer function of the filter, do an inverse FFT. Save the last 1024 samples as overlap for the next frame, add the overlap from the previous frame the the first 1024 samples and this is your output. For every 1024 input samples you get 1024 output samples and you simply repeat this for the next frames until the stream is done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole business with zero padding and overlap is required since multiplication in the frequency domain implements circular convolution and you really want linear convolution in most applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are variants to these methods using different window functions and overlaps but it's all the same principle: cut it up into small chunks and process one chunk at a time.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-07-29T02:57:27.310" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2986" PostTypeId="2" ParentId="2984" CreationDate="2012-07-29T08:58:21.710" Score="14" Body="&lt;p&gt;FFT -&gt; zeroing coefficients -&gt; IFFT is not the correct way of doing filtering - the actual filter realized by doing so has poor characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct way of filtering signals is to compute the coefficients of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_filter&quot;&gt;digital filter&lt;/a&gt;, a process known as filter design and for which a large body of software tools/documentation is available, and apply it to your input sequence. In short, this consists in evaluating for each sample a linear combination of the past input samples, and the past output samples. Depending on the requirements of your filter in terms of stop-band rejection / ripple, only a few coefficients could be necessary, making it way more efficient than FFT. Since the only information required to compute an output sample is the few past input/output samples, there is no problem to apply it to streaming audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to use FFT only if you decide to go with FIR filters, and if your filter requirements cause them to have an insanely large number of coefficients. In this particular case, it will be efficient to apply the filter to successive blocks of your input data through FFT and &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Example_Overlap_Add_Convolution.html&quot;&gt;overlap-add&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-07-29T10:35:32.523" LastActivityDate="2012-07-29T10:35:32.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2987" PostTypeId="1" CreationDate="2012-07-30T04:14:09.683" Score="8" ViewCount="7769" Body="&lt;p&gt;The Fourier transform of $f(ax)$ is $\frac{1}{|a|}F(\frac{u}{|a|})$. So the frequencies are scaled horizontally but the magnitudes are also scaled when the graph of $f$ is scaled horizontally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand the fourier series of $f(\theta)$ on $[-\pi,\pi]$ is $\sum_{-\infty}^{\infty} c_n e^{in\theta}$ whereas the fourier series of $f(a\theta)$ on $[\frac{-\pi}{a},\frac{\pi}{a}]$ is $\sum_{-\infty}^{\infty} c_n e^{ina\theta}$ so that the frequencies are  scaled horizontally but the magnitudes are left unchanged at $c_n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now these are easy to show mathematically, but I'm left feeling uneasy conceptually. Is there same intuition geometrical view to leave my intuition satisfied that explains why there is this lack of symmetry?&lt;/p&gt;&#xA;" OwnerUserId="955" LastActivityDate="2019-05-23T19:54:02.367" Title="Intuition behind the scaling property of Fourier Transforms" Tags="|fourier-transform|fourier-series|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="2988" PostTypeId="2" ParentId="2975" CreationDate="2012-07-30T10:16:17.237" Score="0" Body="&lt;p&gt;This might be a little upside-down idea, but might be worth trying out. Instead of trying to detect the rectange and thinking of the text like &lt;em&gt;noise&lt;/em&gt;, maybe you can treat the text like &lt;em&gt;information&lt;/em&gt; and use it to detect the rectange easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the outline of the idea:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;detect the text in the image&lt;/strong&gt;. It does not need to be a robust implementation (you should be able to google some small library that does that, or maybe OpenCV has it), just a rough estimate of the text in the image&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;find the cener of all the text detections&lt;/strong&gt;. Even with noisy images it should be around the real place&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;do Hough rectangle decetion&lt;/strong&gt; on the area &lt;strong&gt;around the text detections&lt;/strong&gt;. Maybe use the median distance from the center of the text detections, or something similar. Do different diameters and &lt;strong&gt;take the strongest recall&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The explanations and advantages:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the area around the text is homogenous usually -- the real rectangle should be the first strong recall&lt;/li&gt;&#xA;&lt;li&gt;this way you do not have to do hough transform on the whole image, so you can do it more thurally (maybe multiple times on the same area but with different bucket sizes...)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2012-07-30T10:16:17.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2989" PostTypeId="2" ParentId="2987" CreationDate="2012-07-30T14:41:16.070" Score="6" Body="&lt;p&gt;Let $g(x) = f(ax)$.  Then, using a change of variables $y = ax$,&#xA;$$\begin{align*}&#xA;G(u) &amp;amp;= \int_{-\infty}^{\infty} g(x)\exp(-j u x)\,\mathrm dx\\&#xA;&amp;amp;= \int_{-\infty}^{\infty} f(ax)\exp(-j u x)\,\mathrm dx\\&#xA;&amp;amp;= \frac{1}{|a|}\int_{-\infty}^{\infty} f(y)\exp(- j (u/a) y)\,\mathrm dy\\&#xA;&amp;amp;= \frac{1}{|a|}F\left(\frac{u}{a}\right)&#xA;\end{align*}$$&#xA;&lt;em&gt;not&lt;/em&gt; $\displaystyle \frac{1}{|a|}F\left(\frac{u}{|a|}\right)$ as you say (cf. Henry Gomersall's&#xA;comment on your question).&#xA;Now, if $f(x)$ is a periodic function with period $2\pi$, then its &#xA;Fourier transform exists only in a generalized sense (involves impulses).&#xA;The Fourier series&#xA;representation $\displaystyle \sum_n c_n \exp(j nx)$ of $f(x)$&#xA;has Fourier coefficients&#xA;$$\displaystyle c_n = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(x)\exp(-j n x)\,\mathrm dx,&#xA; ~ -\infty &amp;lt; n &amp;lt; \infty$$ &#xA;and these also show up in its Fourier transform &#xA;which is given by&#xA;$\displaystyle F(u) = \sum_n c_n \delta(u -n)$. Note that&#xA;the inverse Fourier transform is&#xA;$$\int_{-\infty}^\infty F(u)\exp(jux)\,\mathrm du&#xA;= \sum_n \int_{-\infty}^\infty c_n \delta(u-n)\exp(jux)\,\mathrm du&#xA;= \sum_n c_n \exp(j nx) = f(x).$$&#xA;The function $g(x) = f(ax)$ of period $2\pi/a$ thus has &lt;em&gt;Fourier transform&lt;/em&gt;&#xA;$$G(u) = \frac{1}{|a|}\sum_{n=-\infty}^{\infty} c_n \delta(u/a -n) &#xA;= \frac{1}{|a|}\sum_{n=-\infty}^{\infty} c_n \delta\left(\frac{u-an}{a}\right).$$&#xA;But, $\delta(\alpha x) = \frac{1}{|\alpha|}\delta(x)$, and so with &#xA;$\alpha = a^{-1}$, we have&#xA;$$G(u) = \sum_n c_n \delta(u - an)$$&#xA;whose inverse Fourier transform is&#xA;$$\int_{-\infty}^\infty G(u)\exp(jux)\,\mathrm du&#xA;= \sum_n \int_{-\infty}^\infty c_n \delta(u-an)\exp(jux)\,\mathrm du&#xA;= \sum_n c_n \exp(j nax) = g(x) = f(ax).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you are not missing anything. Scaling an ordinary&#xA;function scales both&#xA;the magnitude and the frequency axis of the Fourier transform, &#xA;but when impulses are involved, scaling the argument of the&#xA;impulse leads to a magnitude scaling that exactly compensates&#xA;for the magnitude scaling imposed on the Fourier transform,&#xA;and leaves the Fourier coefficients unchanged.&#xA;frequency scaling also scales the amplitude&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-07-30T14:41:16.070" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="2990" PostTypeId="1" AcceptedAnswerId="2996" CreationDate="2012-07-30T14:58:40.503" Score="7" ViewCount="10632" Body="&lt;p&gt;I know I can multiply samples, then clip but perceived volume is non-linear for humans.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please help with a formula.&lt;/p&gt;&#xA;" OwnerUserId="1708" LastEditorUserId="1603" LastEditDate="2012-10-08T12:19:27.277" LastActivityDate="2017-10-04T18:20:22.077" Title="How to change volume of a PCM 16 bit signed audio?" Tags="|audio|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="2991" PostTypeId="1" CreationDate="2012-07-30T18:30:57.110" Score="1" ViewCount="39" Body="&lt;p&gt;My problem: create a device that can take a scan of a target via a camera and a shooting rig (that I am building).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The camera is connected to a motor that &lt;strong&gt;rotates&lt;/strong&gt; the camera, and this is connected to a belt that &lt;strong&gt;translates&lt;/strong&gt; left/right on a rail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Diagram: &lt;img src=&quot;https://i.stack.imgur.com/bxXUu.png&quot; alt=&quot;http://imgur.com/Eq3Sn&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I leave the translation motor's speed alone and let it go fully from start to finish without giving it any other commands. However for the rotation motor I compare the desired position with the actual position and give it an error value via an error function (negative means its too slow and positive means its too fast). Depending on the magnitude of the error value I either speed up or slow down the rotation motor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am not getting much success as the tracking of the target is quite inaccurate. And I made up the error function - I have been trying to tweak it using trial and error but it isn't providing satisfying results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody have tips on how to solve this either than tweaking my error function? Is there any resources (books, internet guideS) for such a Tracking Acquisition project?&lt;/p&gt;&#xA;" OwnerUserId="1747" LastEditorUserId="29" LastEditDate="2012-07-30T19:20:05.453" LastActivityDate="2012-07-30T19:20:05.453" Title="Tracking Acquisition for Directed Scan" Tags="|tracking|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="2993" PostTypeId="1" AcceptedAnswerId="2997" CreationDate="2012-07-30T16:43:17.893" Score="20" ViewCount="21368" Body="&lt;p&gt;Does anyone know of a filter to attenuate non-speech? I am writing speech recognition software and would like to filter out everything but human speech. This would include background noise, noise produced by a crappy microphone, or even background music. I have already implemented a first order filter that compensates for the 6 dB roll-off of the power spectrum, but I'm still hearing noise (though the speech sounds a lot clearer). I have thought to use a low-pass filter, but I am iffy about doing that for two reasons: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I don't know whether or not a low-pass pre-filter will interfere with the rest of the speech processing. Even though the human ear can only detect sounds lower than 20 kHz, I don't want to risk eliminating any higher order harmonics that might be necessary to process the speech (though I don't know if this is the case or not. But I don't want to take any chances).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I understand that the excitation of certain consonants (such as f, h, and s) are almost entirely white noise. I don't want to implement a noise filter that will eliminate &lt;b&gt;good&lt;/b&gt; noise, so to speak.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Ideally, I would like to be left with only the speech of the person speaking into the microphone. If you have any ideas, or there is something that I'm missing, please let me know. Much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="1746" OwnerDisplayName="phoenixheart6" LastEditorUserId="1746" LastEditDate="2012-07-30T19:15:59.107" LastActivityDate="2016-06-14T08:16:26.997" Title="human speech noise filter" Tags="|filters|audio|noise|speech-recognition|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="2994" PostTypeId="1" AcceptedAnswerId="2995" CreationDate="2012-07-30T20:44:48.057" Score="2" ViewCount="1240" Body="&lt;p&gt;Suppose that ${X_n; Y_n}$ is a random process with a discrete alphabet, that is, taking on values in a discrete set for $n$ data length. They correspond to the input and output of a communication process. Assuming Y to be the discretized output, what is meant by Shannon's source entropy for a given discretization bin $k$ : $H_{source} = lim_{k \rightarrow \infty} \frac{1}{k} H_k$ where&#xA; $H_k$ stands for Shannons entropy. I found this in the &lt;a href=&quot;http://www.evropskiuniverzitet.edu.mk/fileadmin/user_upload/Faculty_of_informatics/Articles/TS/ChaosSynchronization.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;. Now, &lt;a href=&quot;http://www.ece.mcmaster.ca/~junchen/probIII.pdf&quot; rel=&quot;nofollow&quot;&gt;problem_Set&lt;/a&gt; also mentions about source entropy but the formula is very different! Its the same as Shannon's entropy. So,what exactly is Source entropy? Is it the entropy of X or Y or is it the same as Shannon's entropy&lt;/p&gt;&#xA;" OwnerUserId="1699" LastActivityDate="2012-07-31T02:12:06.453" Title="What is Shannon's source entropy" Tags="|discrete-signals|reference-request|information-theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="2995" PostTypeId="2" ParentId="2994" CreationDate="2012-07-31T02:12:06.453" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So,what exactly is Source entropy?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When the paper talks about &quot;source entropy&quot; all they mean is the entropy of the information source.  You can see that from the following passage in the paper- &quot;Shannon showed that there must exist at least one encoding of the sequence generated by an information source which allows error-free transmission of the sequence when the channel capacity is larger than the source entropy.&quot;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Now, problem_Set also mentions about source entropy but the formula is very different!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, and no.  The formulas appear different, but they are not really.  The first formula is&#xA;$H_{source} = lim_{k→∞}\frac{1}{k}H_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{source}$ is the total entropy of the source, and $H_k$ is the entropy of each possible discrete value that the random variables in $H$ can be.  Thus, it is almost a trivial statement that the total entropy is the sum of the individual value entropies, while the number of discrete values can go to $\infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem set equation is-&#xA;$H(s) = \sum_i p_ilog_2\frac{1}{p_i}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is really the same equation, it just replaces the generic &quot;$H_k$&quot; with the implied $log_2\frac{1}{p_i}$.  The $\frac{1}{k}$ in the first equation is equivalent to the $p_i$ in the second equation- i.e. they are assuming that all of the discrete values of H are equally likely.  This is not generally true, but is true when the entropy is maximized.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-07-31T02:12:06.453" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2996" PostTypeId="2" ParentId="2990" CreationDate="2012-07-31T02:36:56.630" Score="12" Body="&lt;p&gt;Changing the volume of an audio signal must be done by applying a gain (multiplication) - and optionally clipping if your system has a limited dynamic range. This is as simple as that. Applying a non-linear function to an audio signal will cause distortion and add harmonics, and you don't want this to happen - you want to modify the loudness of the signal, not its timbre. [To be fair, there are non-linear processings designed to change the perceived loudness of the signal without affecting the timbre, within a given dynamic range constraint (eg. multiband compression), but it doesn't look like this is what you need.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where non-linearity and fancy response curves come to play is when designing a user interface - when deciding on the relationship between the position of the control (knob or slider, whether on a GUI or as physical hardware) and the gain applied to the signal. This is where perception matters, because the users will expect a mapping between the position of the slider and their perception of loudness. Please note that even if the relationship between the position of the volume control and the gain applied to the signal is non-linear, the process of applying the gain to the signal is linear, and non-linearity would be unwanted there!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to physical volume controls, eg in hifi systems or personal audio players, the relationship between the knob position and the attenuation is closer to an exponential curve, though its shape has been tweaked and is constrained by the manufacturing process - sometimes it's just two or three linear segments. You can find those curves in the &lt;a href=&quot;http://www.alphapotentiometers.net/html/taper_curves.html&quot;&gt;datasheets from manufacturers&lt;/a&gt; (&quot;A&quot; taper). Mixing console faders usually have their response compressed so that the upper half of their travel covers the useful range of -20 dB..+6dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the software world - at least for music production - it is most common to have volume/gain knobs calibrated in dB. For example, if you have a 100 pixels long volume slider graduated from -48dB to +6dB, the gain applied to the signal would be $10^{\frac{-48 + 54 \frac{x}{100}}{20}}$.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-07-31T02:36:56.630" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="2997" PostTypeId="2" ParentId="2993" CreationDate="2012-07-31T10:15:14.190" Score="10" Body="&lt;p&gt;A speech communication channel as used in telephony typically has a frequency response of 300 Hz to 3 kHz. Although this rejects a lot of the energy in normal speech, intelligibility is still quite good - the main problem seems to be that certain &lt;a href=&quot;http://en.wikipedia.org/wiki/Stop_consonant&quot; rel=&quot;noreferrer&quot;&gt;plosive consonants&lt;/a&gt;, e.g. &quot;p&quot; and &quot;t&quot;, can be a little hard to discriminate without the higher frequency components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you're probably looking for a &quot;sweet spot&quot; somewhere between using the full 20 Hz - 20 kHz bandwidth typically found in consumer audio and the most aggressive filtering used for voice comms (see above). I would suggest starting with a bandpass filter from say 50 Hz to 8 kHz. It will probably only improve SNR by a few dB at best, but it may help, particularly if you have a lot of high frequency background noise.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2012-07-31T13:44:14.477" LastActivityDate="2012-07-31T13:44:14.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3000" PostTypeId="1" CreationDate="2012-07-31T15:16:18.783" Score="2" ViewCount="1652" Body="&lt;p&gt;I'm curious about the algorithm and basic principles behind &lt;a href=&quot;http://en.wikipedia.org/wiki/Optical_character_recognition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optical Character Recognition&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The most basic OCR algorithm that can be fairly easily implemented from scratch? Or the common denominator between different OCR algorithms?&lt;/li&gt;&#xA;&lt;li&gt;Extensions/changes made to tailor the algorithm for application specific goals?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also see my &lt;a href=&quot;https://dsp.stackexchange.com/questions/3006/what-are-the-pros-and-cons-of-different-ocr-methods&quot;&gt;follow up question&lt;/a&gt; on OCR.&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-08-01T06:54:42.973" Title="What is the algorithm behind OCR?" Tags="|ocr|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3001" PostTypeId="2" ParentId="3000" CreationDate="2012-07-31T16:21:23.663" Score="1" Body="&lt;p&gt;Probably the simplest OCR algorithm would be the case where the characters are from a known font, in perfect rows with no distortion or rotation, and then you can find occurrences of each character in the text by doing cross-correlation with the known characters from the known font.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or even simpler if you can create the font before it's used, with cheaper ways to recognize characters, like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Magnetic_ink_character_recognition&quot; rel=&quot;nofollow&quot;&gt;MICR fonts&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/OCR-A_font&quot; rel=&quot;nofollow&quot;&gt;OCR fonts&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2012-07-31T16:21:23.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3002" PostTypeId="1" AcceptedAnswerId="3004" CreationDate="2012-07-31T19:22:02.817" Score="38" ViewCount="48096" Body="&lt;p&gt;In 1d signal processing, many types of low pass filters are used. Gaussian filters are almost never used, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are they so popular in image processing applications? Are these filters a result of optimizing any criterion or are just ad hoc solution since image 'bandwidth' is usually not well defined.&lt;/p&gt;&#xA;" OwnerUserId="1082" LastActivityDate="2013-12-13T08:34:02.527" Title="Why are Gaussian filters used as low pass filters in image processing?" Tags="|image-processing|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3003" PostTypeId="2" ParentId="3002" CreationDate="2012-07-31T20:01:38.703" Score="25" Body="&lt;p&gt;Gaussian filters are used in image processing because they have a property that their support in the time domain, is equal to their support in the frequency domain. This comes about from the Gaussian being its own Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the implications of this? Well, if the support of the filter is the same in either domain, that means that the ratio of both supports is 1. As it turns out, this means that Gaussian filters have the 'minimum time-bandwidth product'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you might say? Well, in image processing, one very important task is to remove white noise, all the while maintaining salient edges. This can be a contradictory task - white noise exists at all frequencies equally, while edges exist in the high frequency range. (Sudden changes in spatial signals). In traditional noise removal via filtering, a signal is low pass filtered, which means that high frequency components in your signal are completely removed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if images have edges as high frequency components, traditional LPF'ing will also remove them, and visually, this manifests itself as the edges becoming more 'smudged'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How then, to remove noise, but also preserve high frequency edges? Enter the Gaussian kernel. Since the Fourier Transform of a Gaussian is also a Gaussian, the Gaussian filter does not have a sharp cutoff at some pass band frequency beyond which all higher frequencies are removed. Instead, it has a graceful and natural tail that becomes ever lower as the frequency increases. This means that it will act as a low pass filter, but also allow in higher frequency components commensurate with how quickly its tail decays. (On the other hand, a LPF will have a higher time bandwidth product, because its support in the F-domain is not nearly as big as that of a Gaussians').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This then allows one to attain the best of both worlds - noise removal, plus edge preservation. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-07-31T20:01:38.703" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3004" PostTypeId="2" ParentId="3002" CreationDate="2012-07-31T22:00:00.097" Score="32" Body="&lt;p&gt;Image processing applications are different from say audio processing applications, because many of them are tuned for the eye. Gaussian masks nearly perfectly simulate optical blur (see also &lt;a href=&quot;http://en.wikipedia.org/wiki/Point_spread_function&quot;&gt;point spread functions&lt;/a&gt;). In any image processing application oriented at artistic production, Gaussian filters are used for blurring by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another important quantitative property of Gaussian filters is that they're &lt;em&gt;everywhere non-negative&lt;/em&gt;. This is important because most 1D signals vary about 0 ($x \in  \mathbb{R}$) and can have either positive or negative values. Images are different in the sense that all values of an image are non-negative ($x \in  \mathbb{R}^+$). Convolution with a Gaussian kernel (filter) guarantees a non-negative result, so such function maps non-negative values to other non-negative values ($f: \mathbb{R}^+ \rightarrow \mathbb{R}^+$). The result is therefore always another valid image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, frequency rejection in Image processing in not as crucial as in 1D signals. For example, in modulation schemes your filters need to be very precise to reject other channels transmitted on different carrier frequencies, and so on. I can't think of anything just as constraining for image processing problems.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="29" LastEditDate="2013-06-22T14:45:10.860" LastActivityDate="2013-06-22T14:45:10.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3005" PostTypeId="2" ParentId="2962" CreationDate="2012-08-01T01:01:11.283" Score="21" Body="&lt;p&gt;The first step is to verify that both your starting sample rate and your target sample rate are &lt;a href=&quot;http://en.wikipedia.org/wiki/Rational_number&quot; rel=&quot;noreferrer&quot;&gt;rational numbers&lt;/a&gt;.  Since they are integers they are automatically rational numbers.  If one of them wasn't a rational number it would still be possible to make the sample rate change, but it is a much different process and more difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step is to factor the two sample rates.  The starting sample rate, in this case, is 44100, which factors to $2^2*3^2*5^2*7^2$.  The target sample rate, 16000, factors to $2^7*5^3$.  Thus, to convert from the starting sample rate to the target rate we must decimate by $3^2*7^2$ and interpolate by $2^5*5$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The previous steps have to be done no matter how you want to resample the data.  Now let's talk about how to do it with FFT's.  The trick to resampling with FFT's is to pick FFT lengths that make everything work out nicely.  That means picking an FFT length that is a multiple of the decimation rate (441, in this case).  For the sake of the example, let's pick an FFT length of 441, though we could have picked 882, or 1323, or any other positive multiple of 441.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand how this works it helps to visualize it.  You start out with an audio signal that looks, in the frequency domain, something like the figure below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MbJEa.png&quot; alt=&quot;44.1 kHz sample rate&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're done with your processing you want to decrease the sample rate to 16 kHz, but you want as little distortion as possible.  In other words, you simply want to keep everything from the picture above from -8 kHz to +8 kHz and drop everything else.  That results in the picture below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/oi8Sj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that the sample rates are not to scale, they are just there to illustrate the concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The beauty of picking an FFT length that is a multiple of the decimation factor is that you can resample simply by dropping portions of the FFT result, and then inverse FFT what is left.  In the case of our example you FFT 441 samples of data, which gets you 441 complex samples in the frequency domain.  We want to decimate by 441 and interpolate by 160 ($2^5*5$), so we keep the 160 samples that represent the frequencies from -8 kHz to +8 kHz.  We then inverse FFT those samples and presto!  You have 160 time domain samples that are sampled at 16 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you might suspect, there are a couple of potential problems.  I will go through each one and explain how you can overcome them.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What do you do if your data is not a nice multiple of the decimation factor?  You can easily overcome this by padding the end of your data with enough zeros to make it a multiple of the decimation factor.  The data is padded BEFORE it is FFT'ed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Even though the method I explained is very simple, it is also non-ideal in that it can introduce ringing and other nasty artifacts in the time domain.  You can avoid that by filtering the frequency domain data before dropping the high frequency data.  You do this by FFT'ing your filter of length $l$, padding your data (before FFT'ing it) with at least $l-1$ zeros (please note that the number of data samples and the number of padding samples must BOTH be a positive multiple of the decimation factor- you can increase the padding length to meet this constraint), FFT'ing the padded data, multiplying the frequency domain data and filter, and then aliasing the high frequency (&gt; 8 kHz) results down into the low frequency (&amp;lt; 8 kHz) results before dropping the high frequency results.  Unfortunately, since filtering in the frequency domain is a big topic in its own right, I won't be able to go into more detail in this answer.  I will say, though, that if you filter and are processing the data in more than one chunk, you will need to implement &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;noreferrer&quot;&gt;Overlap-and-Add&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;noreferrer&quot;&gt;Overlap-and-Save&lt;/a&gt; to make the filtering continuous.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:  The difference between the starting number of frequency domain samples and the target number of frequency domain samples needs to be even so that you can remove the same number of samples from the positive side of the results as the negative side of the results.  In the case of our example, the starting number of samples was the decimation rate, or 441, and the target number of samples was the interpolation rate, or 160.  The difference is 279, which is not even.  The solution is to double the FFT length to 882, which causes the target number of samples to also double to 320.  Now the difference is even, and you can drop the appropriate frequency domain samples with no problems.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-08-01T14:43:59.870" LastActivityDate="2012-08-01T14:43:59.870" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3007" PostTypeId="1" AcceptedAnswerId="3010" CreationDate="2012-08-01T06:58:38.313" Score="7" ViewCount="1537" Body="&lt;p&gt;Is an image a random variable, where each pixel is a realization of the same random variable? Or is an image a collection of random variables (if an image is of size mxn, there are mxn distinct random variables)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the latter case, are the RVs (pixels) considered i.i.d. (even though they are not)?&lt;/p&gt;&#xA;" OwnerUserId="1252" LastActivityDate="2012-08-01T08:40:52.483" Title="Is an image a random variable or a random process?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3008" PostTypeId="2" ParentId="3002" CreationDate="2012-08-01T07:16:32.037" Score="16" Body="&lt;p&gt;You have good answers already, but I'll just add one further useful property of 2D Gaussian filters, which is that they are &lt;em&gt;separable&lt;/em&gt;, i.e. the 2D filter can be decomposed into two 1D filters. This can be an important performance consideration for larger kernel sizes, since an MxN separable filter can be implemented with &lt;code&gt;M+N&lt;/code&gt; multiply-adds whereas a non-separable MxN filter requires &lt;code&gt;M*N&lt;/code&gt; multiply-adds.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2012-08-01T07:16:32.037" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3009" PostTypeId="1" AcceptedAnswerId="3021" CreationDate="2012-08-01T07:37:30.403" Score="5" ViewCount="755" Body="&lt;p&gt;In case of Weighted Thresholded Histogram Equalization we use:-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;calculate, the Weighted Probablity Density Function for Image using,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_{wt}(k) = \left( \frac{P(k)-P_l}{P_u-P_l} \right)^r P_u$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $P_u$ is the highest probability of a intensity in a Image. &#xA;      $P_l$ is the lowest probability of a intensity in a Image.&#xA;      $P(k)$ is the Probability Density Function for the Image,i.e. the number of pixels having the intensity $k$ in a image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then perform Histogram Equalization on the image using,&#xA;calculating Cumulative Distribution Function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C_{wt}(k) = \sum_{m=0}^k P_{wt}(m)$$&#xA;$$Im(i,j) = W_{out} C_{wt}\left(F(i,j)\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $r&amp;lt;1$ the Power Law Transformation function will give a higher weight to the low probabilities in the PDF than the high probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this procedure conceptually different from the Gamma Correction technique, explain if similar how much similarity is there or if something is different, Explain where does it deviate from Gamma Correction method for Single Image Enhancement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this Procedure Passes for Being Called as Gamma Correction in some Aspect OR Do some Changes are Required.&lt;/p&gt;&#xA;" OwnerUserId="1757" LastEditorUserId="6" LastEditDate="2012-08-01T14:09:03.380" LastActivityDate="2012-08-02T09:14:20.367" Title="How is Weighted Thresholded Histogram Equalization different from Gamma Correction Image enhancement" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3010" PostTypeId="2" ParentId="3007" CreationDate="2012-08-01T08:40:52.483" Score="10" Body="&lt;p&gt;While there are some obvious exception to it (&quot;static&quot; pattern on a television screen, the &quot;dark frame&quot; noise pattern of a camera), images are rarely generated by random processes. Declaring that an image is drawn from such or such distribution or generated by such or such random process is just a post-hoc modeling decision, and there is no &quot;ground truth&quot; to validate or invalidate this choice; other than the performance of the machine vision / image enhancement etc. method derived from the modeling decision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can view a $m \times n$ image as a single random matrix (I assume this is what you mean by your first alternative - the image as a whole being considered as a single multidimensional random variable); or you can view it as a random field (a collection of random variables indexed by $|[1, M]| \times |[1, N]|$). I've encountered the random field view more often than the random matrix view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using a random-field approach, you can view each pixel as i.i.d ; or you can introduce dependencies between pixel values through the use of a Markov Random Field model. These are not the only option - you could very well consider a two-layer model where one first random process assigns a region index to each pixel of the image, and then where the value of each pixel is drawn from a distribution indexed by the region id! No approach is &quot;better&quot; than another. The more complex the model, the more &quot;plausible&quot; the images it will generate, but the more intractable the computations might become. It often helps, when using this kind of statistical approaches, to draw a few sample images from the chosen distribution/random process, and look at them to have a good grasp of what kind of assumptions you have built into your model.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-01T08:40:52.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3011" PostTypeId="2" ParentId="2969" CreationDate="2012-08-01T12:03:34.287" Score="5" Body="&lt;p&gt;If you have added random noise you cannot get the original signal...&#xA;You can try to separate the signals in the frequency domain (if the noise and the signal are of different frequencies). But it seems that what you are searching for is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;noreferrer&quot;&gt;Wiener&lt;/a&gt; filter.&lt;/p&gt;&#xA;" OwnerUserId="1759" LastActivityDate="2012-08-01T12:03:34.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3012" PostTypeId="2" ParentId="2969" CreationDate="2012-08-01T12:59:21.023" Score="5" Body="&lt;p&gt;I think this is still an open problem.&lt;/p&gt;&#xA;&lt;p&gt;There are numerous research papers that tried to recover the original signal the best they can.&lt;/p&gt;&#xA;&lt;p&gt;One classic approach is through &lt;a href=&quot;http://cnx.org/content/m18931/1.2/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Signal Denoising using Wavelet-based Methods&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There are also dictionary approaches like &lt;a href=&quot;http://www.cs.technion.ac.il/%7Eelad/publications/journals/2005/KSVD_Denoising_IEEE_TIP.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;K-SVD&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can get a more in-depth view of the problem by following the research done by  David L. Donho, Michael Elad, Alfred M. Bruckstein etc.&lt;/p&gt;&#xA;" OwnerUserId="1749" LastEditorUserId="7092" LastEditDate="2021-10-01T05:05:19.173" LastActivityDate="2021-10-01T05:05:19.173" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3013" PostTypeId="2" ParentId="2993" CreationDate="2012-08-01T13:05:56.533" Score="2" Body="&lt;p&gt;You should probably look at doing Independent Component Analysis (ICA) as your problem is very similar to the &quot;cocktail party&quot; problem that's often used to describe ICA. In short ICA finds the components of your signal that are independent from each other. This presumes that other noise in the environment (dishwasher, white noise, fan whirr) will be independent from the signal source of the voice and can be separated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ICA is similar to PCA (principle component analysis) but instead of maximizing the variance on the principle axes, it maximizes the independence. There are many implementations of ICA that should plug into whatever coding environment you're using.&lt;/p&gt;&#xA;" OwnerUserId="461" LastActivityDate="2012-08-01T13:05:56.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3014" PostTypeId="2" ParentId="2993" CreationDate="2012-08-01T15:00:18.580" Score="5" Body="&lt;p&gt;Using a pass band filter matching the bandwidth of speech will help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have several microphones (as is now the case on cellphones), there is a trove of ICA-like methods which can take advantage of that - but your question hints me that you have only one input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want to do is &quot;one-microphone source separation&quot; (name taken from Roweis' groundbreaking paper), also called &quot;single-sensor&quot;. Warning: this is far from being a solved problem, and all research in this field is very recent, with no algorithm or approach being a &quot;clear winner&quot; (unlike gaussian mixture models + FST have been for speech recognition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good framework to do that is through Wiener filtering. See Benaroya et al. &quot;Single Sensor Source separation based on Wiener filtering and multiple window STFT&quot; (Read section 1 &amp;amp; 2, don't bother with the multiresolution thing unless you really need it). In short, you compute the STFT of your signal, and for each STFT frame, you try to get estimates of the voice spectrum and of the noise spectrum, and you use Wiener filtering to recover the best estimate of the voice spectrum from that (this is akin to &quot;soft-masking&quot; the spectrum).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your problem is now the following: given a STFT frame, estimate the speech and the noise component from it. The simpler approach described in the paper by Benaroya is through Vector-quantization - take several hours of speech by many speakers, compute the STFT, run LBG on it to find a codebook of 512 or 1024 typical speech frames ; do the same thing for noise. Now, given a frame of your input signal, project it non-negatively (a multiplicative gradient update procedure is described in the paper) onto the speech and noise bases, and you get your speech and noise estimates. If you don't want to deal with the non-negative projection thing, just use the nearest neighbor.  This is really the simplest thing that could possibly work in the &quot;single-sensor source separation&quot; department.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a speech recognition system could indeed provide some input for a separation system. Do a first pass of decoding using your speech recognition system. For each frame, take the mean MFCC vector from the gaussian that got the best score. Invert that back into a spectrum. Boom, you have a mask giving you the most likely spectral location of the speech-like bits, and you can use it as an input for Wiener filtering. This sounds a bit like hand-waving, but the geist is that to separate a source you need a good model for it, and a speech recognition system taken backwards is a hell of a good generative model for speech signals.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-01T15:00:18.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3015" PostTypeId="1" CreationDate="2012-08-01T15:07:26.333" Score="5" ViewCount="363" Body="&lt;p&gt;Let $s_{\rm out}[n]$ be the 1D output signal of a system, $s[n]$ be the input, and $k[n,q]$ be the filter kernel for an element $n$ and for fixed value $q$.  Then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s_{\rm out}[n] = s[n] \ast k[n,q]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I know $q$ as a real number, then I can compute the filter kernel $k[n,q]$ and determine $s[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The values for $q$ normally range between $q = 30$ and $q = 500$.  The signal $s[n]$ is discrete data that is bounded between two values.  Moreover, $s[n]$ is minimum-phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain, the filter kernel $k[n,q]$ modifies both the magnitude and phase of the input $s[n]$ to cause attenuation.  This is a &quot;lossy&quot; transmission channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I do not know $q$ and $s[n]$, and so I am looking for a well-known, &quot;classic&quot; reference that details how to estimate $s[n]$ with some knowledge of $k[n,q]$.  I know the mathematical form of $k[n,q]$, but I just don't know $q$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for an algorithm that works fairly well and is reasonably well-understood and applied.  In this case, $s[n]$ could be contaminated by noise (as are all real signals), but the main goal is to remove $k[n,q]$ to estimate $s[n]$. &lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-08-02T03:00:10.273" LastActivityDate="2012-08-02T03:00:10.273" Title="Blind 1D equalization/deconvolution with some knowledge of filter kernel" Tags="|convolution|1d|blind-deconvolution|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3016" PostTypeId="1" CreationDate="2012-08-01T18:08:30.060" Score="18" ViewCount="9146" Body="&lt;p&gt;I want to be able to find points in images that are the centre of a radial gradient like the one shown in the left picture below. Any ideas on how I could use a Hough transform or some other computer vision method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zRaIN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;example search image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/urRWo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1156" LastEditorUserId="128" LastEditDate="2019-06-24T08:49:45.990" LastActivityDate="2019-06-24T08:49:45.990" Title="How to Detect Gradients and Edges in Images?" Tags="|image-processing|computer-vision|gradient|" AnswerCount="3" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="3017" PostTypeId="1" CreationDate="2012-08-01T20:06:13.707" Score="5" ViewCount="365" Body="&lt;p&gt;I'm thinking about ways to automatically identify and analyze lots of musical instrument samples, and would like to find the part of the sample that's the most stable in frequency, without any accidental vibrato or anything.  My first thought was to do a sliding FFT and find the &quot;width&quot; of the peaks (maybe fitting a parabola to many of the neighboring points?), since a constant frequency chunk will produce a narrow peak (green) and one wavering in frequency should produce a wider peak (red):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Af81D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a spectrogram the red is a slightly wiggly line, and the green is a more straight line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time domain is ok, too.  Some kind of &quot;slide the signal past itself and look for sections that interfere with each other in a constant way instead of phasing in and out&quot;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure how easy or reliable this method would actually be.  Any other ideas?&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-08-03T13:49:15.720" LastActivityDate="2012-08-03T13:49:15.720" Title="Measuring the &quot;frequency stability&quot; of a signal" Tags="|audio|frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3018" PostTypeId="2" ParentId="3017" CreationDate="2012-08-01T21:47:34.953" Score="4" Body="&lt;p&gt;Your technique might work, provided you window and so on correctly, but it does not really strike me as the right approach for pitch vibrato for a lot of reasons, mostly that the change in pitch is very small compared to other things which could change the &quot;width&quot; of your spectrum (eg, timbre).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you'd be better off actually tracking the fundamental pitch in the time domain using a technique like YIN and seeing how much it varies over time.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-08-01T21:47:34.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3019" PostTypeId="1" CreationDate="2012-08-01T21:54:44.950" Score="8" ViewCount="327" Body="&lt;p&gt;I have been trying to understand what super-resolution is, in the context of DSP/DIP. What criteria is being maximized/minimized, and why? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of my online searches yield super-res techniques from the optical physics stand point, however I know anecdotally that they have been used in image processing, and in some doppler-radar processing as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One particular instance of Super-Res I remember seeing was in the design of a windowing function, where the main lobe was the same width as that of a boxcar, while simultaneously having very low and fast degrading side lobes, similar to a hamming window. In this sense, the 'super-res' came from the fact that frequencies very close to one another were able to be resolved due to the low main lobe width, and a very high dynamic range. Is this what super-res really amounts to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an explanation that, (perhaps), likens it to a form of de-noising, or sparsity pursuit? Or is it a different animal altogether?&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="128" LastEditDate="2018-07-12T11:33:02.003" LastActivityDate="2021-04-09T16:29:16.147" Title="What is Super Resolution in the Context of Windowing?" Tags="|image-processing|frequency-spectrum|superresolution|denoising|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3021" PostTypeId="2" ParentId="3009" CreationDate="2012-08-02T09:14:20.367" Score="2" Body="&lt;p&gt;This Method can very well pass for being Gamma Correction Technique as We are Increasing the Weight of the Less probable Intensities in the Image  by the Exponential Factor r So that the Less Clear Details may be Visible upon the increase in their Weight thus Providing a Enhanced Image , On the Similiar Note the Gamma Correction Function Does this by using Power Law Transformation.&lt;/p&gt;&#xA;" OwnerUserId="1757" LastActivityDate="2012-08-02T09:14:20.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3022" PostTypeId="2" ParentId="3016" CreationDate="2012-08-02T10:18:17.330" Score="1" Body="&lt;p&gt;Run a &lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_of_oriented_gradients&quot; rel=&quot;nofollow&quot;&gt;Histogram of Oriented Gradients&lt;/a&gt;  over patches of the image - the peak in each of those histograms will give you the dominant direction of that patch (like the arrows you show).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find where all those arrows intersect - if that point is inside the object it could be the centre of a radial gradient.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2012-08-02T10:18:17.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3023" PostTypeId="1" CreationDate="2012-07-31T19:28:33.083" Score="1" ViewCount="27" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/3009/how-is-weighted-thresholded-histogram-equalization-different-from-gamma-correcti&quot;&gt;How is Weighted Thresholded Histogram Equalization different from Gamma Correction Image enhancement&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;In case of Weighted Thresholded Histogram Equalization we use:-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;calculate, the Weighted Probablity Density Function for Image using,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Pwt(k) = ((P(k)-Pl)/(Pu-Pl))^r* Pu,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;Pu&lt;/code&gt; is the highest probablity of a intensity in a Image. &#xA;      &lt;code&gt;Pl&lt;/code&gt; is the lowest probablity of a intensity in a Image.&#xA;      &lt;code&gt;P(k)&lt;/code&gt; is the Probablity Density Function for the Image,ie the no of pixels having the   intensity &lt;code&gt;k&lt;/code&gt; in a image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then perform Histogram Equalization on the image using,&#xA;calculating Cumulative Distribution Function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Cwt(k) = m=0∑k Pwt(m);&#xA;Im(i,j) = Wout*Cwt(F(i,j));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For &lt;code&gt;r&amp;lt;1&lt;/code&gt; the Power Law Transformation function will give a higher weight to the low probablities in the PDF than the high probablities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this procedure conceptually different from the Gamma Correction technique , explain if similiar how much similiarity is there or if something is different , Explain where does it deviate from Gamma Correction method for Single Image Enhancement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this Procedure Passes for Being Called as Gamma Correction in some Aspect OR Do some Changes are Required.&lt;/p&gt;&#xA;" OwnerUserId="1757" OwnerDisplayName="Deepak kumar Jha" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-08-02T12:50:00.990" Title="How is Weighted Thresholded Histogram Equalization different from Gamma Correction Image enhancement" Tags="|matlab|image-processing|" AnswerCount="0" CommentCount="2" ClosedDate="2012-08-03T17:13:51.247" ContentLicense="CC BY-SA 3.0" />
  <row Id="3024" PostTypeId="5" CreationDate="2012-08-02T12:59:37.273" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2012-08-02T12:59:37.273" LastActivityDate="2012-08-02T12:59:37.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3025" PostTypeId="4" CreationDate="2012-08-02T12:59:37.273" Score="0" Body="The recording of voltages along the scalp for the purpose of monitoring brain wave activity and localizing sources of ionic currents" OwnerUserId="76" LastEditorUserId="76" LastEditDate="2012-08-02T13:16:27.060" LastActivityDate="2012-08-02T13:16:27.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3026" PostTypeId="1" AcceptedAnswerId="3080" CreationDate="2012-08-02T14:00:12.303" Score="34" ViewCount="46064" Body="&lt;p&gt;I am fairly new to DSP, and have done some research on possible filters for smoothing accelerometer data in python. An example of the type of data Ill be experiencing can be seen in the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4fA1L.png&quot; alt=&quot;Accelerometer data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, I am looking for advice as to smooth this data to eventually convert it into velocity and displacement. I understand that accelerometers from mobile phones are extremely noisy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I dont think I can use a Kalman filter at the moment because I cant get hold of the device to reference the noise produced by the data (I read that its essential to place the device flat and find the amount of noise from those readings?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT has produced some interesting results. One of my attempts was to FFT the acceleration signal, then render low frequencies to have a absolute FFT value of 0. Then I used omega arithmetic and inverse FFT to gain a plot for velocity. The results were as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z2Nrb.png&quot; alt=&quot;Filtered signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a good way to go about things? I am trying to remove the overall noisy nature of the signal but obvious peaks such as at around 80 seconds need to be identified. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tired using a low pass filter on the original accelerometer data, which has done a great job of smoothing it, but I'm not really sure where to go from here. &#xA;Any guidance on where to go from here would be really helpful!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: A little bit of code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i in range(len(fz)): &#xA;    testing = (abs(Sz[i]))/Nz&#xA;&#xA;    if fz[i] &amp;lt; 0.05:&#xA;        Sz[i]=0&#xA;&#xA;Velfreq = []&#xA;Velfreqa = array(Velfreq)&#xA;Velfreqa = Sz/(2*pi*fz*1j)&#xA;Veltimed = ifft(Velfreqa)&#xA;real = Veltimed.real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So essentially, ive performed a FFT on my accelerometer data, giving Sz, filtered high frequencies out using a simple brick wall filter (I know its not ideal). Then ive use omega arithmetic on the FFT of the data.&#xA;Also thanks very much to datageist for adding my images into my post :) &lt;/p&gt;&#xA;" OwnerUserId="1762" LastEditorUserId="1762" LastEditDate="2012-08-04T10:54:28.397" LastActivityDate="2019-10-19T20:54:29.303" Title="Picking the correct filter for accelerometer data" Tags="|fft|python|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="3027" PostTypeId="2" ParentId="1334" CreationDate="2012-08-02T16:17:59.410" Score="1" Body="&lt;p&gt;First of all, it helps to get the terminology sorted out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A function in time-domain is known as a &lt;b&gt;signal&lt;/b&gt;.&lt;br&gt;A function in frequency-domain is known as a &lt;b&gt;spectrum&lt;/b&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Hilmar said, there are four different flavors of &quot;Fourier&quot;, which convert a signal to a spectrum. The Fourier series is the best to start with to truly understand the frequency domain. The basic premise is this: any periodic signal can be represented as an infinite sum of sines and cosines. In this equation, s(x) is a &lt;b&gt;signal&lt;/b&gt;:&#xA;$$&#xA;a_n=\frac{1}\pi\int^Ts(x){\cos{nx}}\mkern3mudx&#xA;$$&#xA;$$&#xA;b_n=\frac{1}\pi\int^Ts(x){\sin{nx}}\mkern3mudx&#xA;$$&#xA;$$&#xA;s_f(x)=\frac{a_n}2+\sum_{n=1}^\infty{a_n\cos(nx)+b_nsin(nx)}&#xA;$$&#xA;$$&#xA;s_f(x)=s(x)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this equation, a&lt;sub&gt;n&lt;/sub&gt; and b&lt;sub&gt;n&lt;/sub&gt; are the real and imaginary parts of the discrete spectrum, respectively. Therefore as you can see, the Fourier transform of a cosine will be a real number, and for a sine, it will be an imaginary number. The &lt;i&gt;T&lt;/i&gt; on the integral means that we are integrating over a full period of the signal. This is primarily used in what's called harmonic analysis, which I've mostly used when analyzing analog circuits with non-sinusoidal signals (square waves, triangular waves, etc.) But what if the signal isn't periodic? This doesn't work, and we have to turn to the Fourier transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform converts a continuous signal to a continuous spectrum. Unlike the Fourier series, the Fourier transform allows for non-period function to be converted to a spectrum. A non-periodic function always results in a continuous spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete-time Fourier transform achieves the same result as the Fourier transform, but works on a discrete (digital) signal rather than an continuous (analog) one. The DTFT can generate a continuous &lt;b&gt;spectrum&lt;/b&gt; because because as before, a non-periodic signal will always produce a continuous spectrum--even if the signal itself is not continuous. An infinite number of frequencies will still be present in the signal, even though it is discrete. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to answer your question, the DTFT is arguably the most useful one, as it operates on digital signals, and therefore allows us to design digital filters. Digital filters are &lt;b&gt;far&lt;/b&gt; more efficient than analog ones. They're much cheaper, much more reliable, and much easier to design. The DTFT is used in several applications. Off the top of my head: synthesizers, sound cards, recording equipment, voice and speech recognition programs, biomedical devices, and several others. The DTFT in its pure form is mostly used for analysis, but the DFT which takes a discrete signal and yields a discrete spectrum is programmed into most of the above applications, and is an integral part of signal processing in computer science. The most common implementation of the DFT is the Fast Fourier Transform. It's a simple recursive algorithm which can be found &lt;a href=&quot;http://rosettacode.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. I hope this helps! Feel free to comment if you have any questions.&lt;/p&gt;&#xA;" OwnerUserId="1746" LastActivityDate="2012-08-02T16:17:59.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3028" PostTypeId="1" AcceptedAnswerId="3029" CreationDate="2012-08-02T20:44:26.920" Score="2" ViewCount="2368" Body="&lt;p&gt;I'm relatively new to signal processing, so please excuse me if this is a trivial question. Why is the spectrum of a frame of speech samples periodic? What is the meaning of a periodic spectrum? And if a spectrum is periodic, doesn't that mean that it is not band-limited (i.e. it goes on to infinity)? How is the spectrum of a speech frame affected by the windowing function (does it change the amplitude or period of the periodic spectrum)? This is mostly out of curiosity, and to help me get a better qualitative understanding of cepstral analysis. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="1746" LastActivityDate="2012-08-02T21:44:24.683" Title="periodic spectrum?" Tags="|fourier-transform|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3029" PostTypeId="2" ParentId="3028" CreationDate="2012-08-02T21:23:11.970" Score="3" Body="&lt;p&gt;The spectrum of a vowel sound typically contains many harmonics. These harmonics are of course evenly spaced in the frequency domain (i.e. you see peaks at f0, 2*f0, 3*f0, 4*f0, etc). The spectrum can therefore be considered to be &quot;periodic&quot;, with a &quot;period&quot; equal to f0. (This is usually called &lt;em&gt;quefrency&lt;/em&gt; in the cepstral analysis literature).&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2012-08-02T21:23:11.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3030" PostTypeId="2" ParentId="3028" CreationDate="2012-08-02T21:26:50.320" Score="1" Body="&lt;p&gt;Discrete functions and periodic functions are Fourier transform pair, i.e. if one domain is periodic, the other is discrete, and vice versa. Applying the windowing function to the signal will always change the spectrum, i.e. the amplitude and period could both change.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastEditorUserId="1641" LastEditDate="2012-08-02T21:44:24.683" LastActivityDate="2012-08-02T21:44:24.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3031" PostTypeId="2" ParentId="3016" CreationDate="2012-08-02T23:02:46.220" Score="5" Body="&lt;p&gt;Here is what I have so far. The way I'm populating my Hough space is far from optimal. I'm pretty sure there's some vectorization I can do to make it faster. I'm using Matlab R2011a. &lt;a href=&quot;https://i.stack.imgur.com/QgVbJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Original Image&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggestions are appreciated, Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gp9jR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; clc; close all;&#xA;&#xA;%% read in image and find gradient information&#xA;img = rgb2gray(imread('123.png'));&#xA;[rows, columns] = size(img);&#xA;[dx, dy] = gradient(double(img));&#xA;[x y] = meshgrid(1:columns, 1:rows);&#xA;u = dx;&#xA;v = dy;&#xA;imshow(img);&#xA;hold on&#xA;quiver(x, y, u, v)&#xA;&#xA;&#xA;%% create Hough space and populate&#xA;hough_space = zeros(size(img));&#xA;&#xA;for i = 1:columns&#xA;  for j = 1:rows&#xA;&#xA;    X1 = i;&#xA;    Y1 = j;&#xA;    X2 = round(i + dx(j,i));&#xA;    Y2 = round(j + dy(j,i));&#xA;    increment = 1;&#xA;&#xA;    slope = (Y2 - Y1) / (X2 - X1);&#xA;    y_intercept = Y1 - slope * X1;&#xA;&#xA;    X3 = X1 + 5;&#xA;&#xA;    if X3 &amp;lt; columns &amp;amp;&amp;amp; X3 &amp;gt; 1&#xA;      Y3 = slope * X3 + y_intercept;&#xA;      if Y3 &amp;lt; rows &amp;amp;&amp;amp; Y3 &amp;gt; 1&#xA;        hough_space = func_Drawline(hough_space, Y1, X1, floor(Y3), floor(X3), increment);&#xA;      end&#xA;    end&#xA;  end&#xA;end&#xA;&#xA;imtool(hough_space)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I modified a draw line function I found on matlab central to increment by a pixel by a value instead of setting a pixel to a value&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function Img = func_DrawLine(Img, X0, Y0, X1, Y1, nG)&#xA;% Connect two pixels in an image with the desired graylevel&#xA;%&#xA;% Command line&#xA;% ------------&#xA;% result = func_DrawLine(Img, X1, Y1, X2, Y2)&#xA;% input:    Img : the original image.&#xA;%           (X1, Y1), (X2, Y2) : points to connect.&#xA;%           nG : the gray level of the line.&#xA;% output:   result&#xA;%&#xA;% Note&#xA;% ----&#xA;%   Img can be anything&#xA;%   (X1, Y1), (X2, Y2) should be NOT be OUT of the Img&#xA;%&#xA;%   The computation cost of this program is around half as Cubas's [1]&#xA;%   [1] As for Cubas's code, please refer  &#xA;%   http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4177  &#xA;%&#xA;% Example&#xA;% -------&#xA;% result = func_DrawLine(zeros(5, 10), 2, 1, 5, 10, 1)&#xA;% result =&#xA;%      0     0     0     0     0     0     0     0     0     0&#xA;%      1     1     1     0     0     0     0     0     0     0&#xA;%      0     0     0     1     1     1     0     0     0     0&#xA;%      0     0     0     0     0     0     1     1     1     0&#xA;%      0     0     0     0     0     0     0     0     0     1&#xA;%&#xA;%&#xA;% Jing Tian Oct. 31 2000&#xA;% scuteejtian@hotmail.com&#xA;% This program is written in Oct.2000 during my postgraduate in &#xA;% GuangZhou, P. R. China.&#xA;% Version 1.0&#xA;&#xA;Img(X0, Y0) = Img(X0, Y0) + nG;&#xA;Img(X1, Y1) = Img(X1, Y1) + nG;&#xA;if abs(X1 - X0) &amp;lt;= abs(Y1 - Y0)&#xA;   if Y1 &amp;lt; Y0&#xA;      k = X1; X1 = X0; X0 = k;&#xA;      k = Y1; Y1 = Y0; Y0 = k;&#xA;   end&#xA;   if (X1 &amp;gt;= X0) &amp;amp; (Y1 &amp;gt;= Y0)&#xA;      dy = Y1-Y0; dx = X1-X0;&#xA;      p = 2*dx; n = 2*dy - 2*dx; tn = dy;&#xA;      while (Y0 &amp;lt; Y1)&#xA;         if tn &amp;gt;= 0&#xA;            tn = tn - p;&#xA;         else&#xA;            tn = tn + n; X0 = X0 + 1;&#xA;         end&#xA;         Y0 = Y0 + 1; Img(X0, Y0) = Img(X0, Y0) + nG;&#xA;      end&#xA;   else&#xA;      dy = Y1 - Y0; dx = X1 - X0;&#xA;      p = -2*dx; n = 2*dy + 2*dx; tn = dy;&#xA;      while (Y0 &amp;lt;= Y1)&#xA;         if tn &amp;gt;= 0&#xA;            tn = tn - p;&#xA;         else&#xA;            tn = tn + n; X0 = X0 - 1;&#xA;         end&#xA;         Y0 = Y0 + 1; Img(X0, Y0) = Img(X0, Y0) + nG;&#xA;      end&#xA;   end&#xA;else if X1 &amp;lt; X0&#xA;      k = X1; X1 = X0; X0 = k;&#xA;      k = Y1; Y1 = Y0; Y0 = k;&#xA;   end&#xA;   if (X1 &amp;gt;= X0) &amp;amp; (Y1 &amp;gt;= Y0)&#xA;      dy = Y1 - Y0; dx = X1 - X0;&#xA;      p = 2*dy; n = 2*dx-2*dy; tn = dx;&#xA;      while (X0 &amp;lt; X1)&#xA;         if tn &amp;gt;= 0&#xA;            tn = tn - p;&#xA;         else&#xA;            tn = tn + n; Y0 = Y0 + 1;&#xA;         end&#xA;         X0 = X0 + 1; Img(X0, Y0) = Img(X0, Y0) + nG;&#xA;      end&#xA;   else&#xA;      dy = Y1 - Y0; dx = X1 - X0;&#xA;      p = -2*dy; n = 2*dy + 2*dx; tn = dx;&#xA;      while (X0 &amp;lt; X1)&#xA;         if tn &amp;gt;= 0&#xA;            tn = tn - p;&#xA;         else&#xA;            tn = tn + n; Y0 = Y0 - 1;&#xA;         end&#xA;         X0 = X0 + 1; Img(X0, Y0) = Img(X0, Y0) + nG;&#xA;      end&#xA;   end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1156" LastEditorUserId="14865" LastEditDate="2015-11-09T23:11:49.127" LastActivityDate="2015-11-09T23:11:49.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3032" PostTypeId="1" CreationDate="2012-08-03T02:21:24.273" Score="3" ViewCount="1017" Body="&lt;p&gt;I am working on an audio dynamic range compressor using Matlab.&#xA;After calculating the FFT of the audio file, I use several bandpass filters to amplify specific bands separately.&#xA;What I want to do then is remove components of a band and put them in another band.&#xA;for example, remove the components of the band 8khz-10khz and put them in the band 6khz-8khz.&#xA;would you please give me the general picture.&lt;/p&gt;&#xA;" OwnerUserId="1050" LastActivityDate="2012-08-03T12:41:41.310" Title="change the frequency component of a spectrum in an audio file" Tags="|audio|fft|compression|bandpass|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3033" PostTypeId="2" ParentId="3016" CreationDate="2012-08-03T07:50:44.687" Score="7" Body="&lt;p&gt;I was working in opencv and trying to find the peak of a gradient generated by distance transform. I realised that using morphologic operations (erosion/dilatation) in grey-scsale images was very useful in this case.&#xA;If you erode dilate a grey-scale image, any pixel is going to take the value of the lower/highest neighbour. You can therefore find peaks of intensity in gradients by subtracting grey-scale image from the same dilated/eroded image. Here is my result:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WBA7z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a way to do it in OpenCV/Cpp:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;opencv2/imgproc/imgproc.hpp&quot;&#xA;#include &quot;opencv2/highgui/highgui.hpp&quot;&#xA;&#xA;int main( int argc, char** argv ){&#xA;&#xA;    cv::Mat objects, img ,peaks,BGR;&#xA;    std::vector&amp;lt;std::vector&amp;lt;cv::Point&amp;gt; &amp;gt; contours;&#xA;    /* Reads the image*/&#xA;    BGR=cv::imread(argv[1]);&#xA;    /* Converts it to Grayscale*/&#xA;    cv::cvtColor(BGR,img,CV_BGR2GRAY);&#xA;    /* Devine where are the objects*/&#xA;    cv::threshold(img,objects,0,255,cv::THRESH_BINARY);&#xA;    /* In order to find the local maxima, &quot;distance&quot;&#xA;     * is subtracted from the result of the dilatation of&#xA;     * &quot;distance&quot;. All the peaks keep the save value */&#xA;    cv::dilate(img,peaks,cv::Mat(),cv::Point(-1,-1),3);&#xA;    cv::dilate(objects,objects,cv::Mat(),cv::Point(-1,-1),3);&#xA;&#xA;    /* Now all the peaks should be exactely 0*/&#xA;    peaks=peaks-img;&#xA;&#xA;    /* And the non-peaks 255*/&#xA;    cv::threshold(peaks,peaks,0,255,cv::THRESH_BINARY);&#xA;    peaks.convertTo(peaks,CV_8U);&#xA;&#xA;    /* Only the zero values of &quot;peaks&quot; that are non-zero&#xA;     * in &quot;objects&quot; are the real peaks*/&#xA;    cv::bitwise_xor(peaks,objects,peaks);&#xA;&#xA;    /* The peaks that are distant from less than&#xA;     * 2 pixels are merged by dilatation */&#xA;    cv::dilate(peaks,peaks,cv::Mat(),cv::Point(-1,-1),1);&#xA;&#xA;    /* In order to map the peaks, findContours() is used.&#xA;     * The results are stored in &quot;contours&quot; */&#xA;    cv::findContours(peaks, contours, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);&#xA;    /* just draw them and save the image */&#xA;    cv::drawContours(BGR,contours,-1,cv::Scalar(255,0,0),-1);&#xA;    cv::imwrite(&quot;result.png&quot;,BGR);&#xA;&#xA;    return 1;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1608" LastActivityDate="2012-08-03T07:50:44.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3034" PostTypeId="2" ParentId="3032" CreationDate="2012-08-03T09:19:52.383" Score="1" Body="&lt;p&gt;Judging by your question, it sounds like you are developing hearing aid solutions. Given that you are calculating an FFT and are now in the frequency domain, the easiest route forward is to use phase vocoder techniques to shift spectral peaks. Here is the original paper on this technique &gt; &lt;a href=&quot;http://505606.pbworks.com/f/LaroD99-pvoc.pdf&quot; rel=&quot;nofollow&quot;&gt;http://505606.pbworks.com/f/LaroD99-pvoc.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2012-08-03T09:19:52.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3035" PostTypeId="2" ParentId="3017" CreationDate="2012-08-03T09:34:50.407" Score="0" Body="&lt;p&gt;If for some reason you do want to remain in the frequency domain (using a sliding FFT as you are), the peak width would not be a robust method to track vibrato. A better approach is to look at the phase of the neighbouring bins (bins to the left and right of the fundamental frequency peak). If the phase &lt;strong&gt;difference&lt;/strong&gt; between the peak and neighbouring bins remains reasonabley constant over a number of frames, the component can be considered as stable.&lt;/p&gt;&#xA;" OwnerUserId="271" LastActivityDate="2012-08-03T09:34:50.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3036" PostTypeId="1" CreationDate="2012-08-03T12:22:59.497" Score="6" ViewCount="1290" Body="&lt;p&gt;Hexagonal shaped Modulator is designed to get better BER than Square Modulator. The constellation diagram is like the figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HFLlk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is supposed to give better BER measurement than Square as it has wider decision boundary. I have designed the modulator in this way.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Modulator for hexagonal&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a2=[-2 -2 0 0 2 2 4 4];&#xA;a2=a2(:);&#xA;d=[1 -3 1 -3 1 -3 1 -3];&#xA;z1=a2+j*d(:);&#xA;z=[z;z1];&#xA;%plot(z,'O')&#xA;&#xA;for i=1:length(s)&#xA;lodd=s(i);&#xA;ModDat(i)=z(lodd+1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Demodulator for Hexagonal&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a=[-3:2:3];&#xA;b=[3 -1 3 -1 3 -1 3 -1];&#xA;a=[a;-a];&#xA;a=a(:);&#xA;z=a+j*b(:);&#xA;%a2=[a2;-a2];&#xA;&#xA;a2=[-2 -2 0 0 2 2 4 4];&#xA;a2=a2(:);&#xA;d=[1 -3 1 -3 1 -3 1 -3];&#xA;z1=a2+j*d(:);&#xA;z=[z;z1];&#xA;for fd=1:length(s)&#xA;&#xA;for l=1:16; tes(l)=z(l)-s(fd); end&#xA;abs_dat_c=((abs(tes)).^2)';&#xA;min_dat=min(abs_dat_c);&#xA;&#xA;for ds=1:16; if min_dat==abs_dat_c(ds); demoddat(fd)=ds-1;&#xA;    end; &#xA;end&#xA;demoddat=demoddat(:);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;BER Measurement&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=170000;                       % No Of Symbols&#xA;M=16; &#xA;Sr=randint(N,1,[0,(M-1)]);      % random data form 0-15&#xA;s1=hexmod(Sr,M);  s1=s1(:);             % generate 16-qam data  &#xA;% s2=qammod(Sr,M,0,'gray');s2=s2(:);&#xA;s2=qammod(Sr,M);s2=s2(:);&#xA;&#xA;SNR=1:1:15&#xA;for k=1:length(SNR)&#xA;%% add noise---&amp;gt; LPN; CD; AWGN for ASE %%&#xA;Square_AWGN_Theory=awgn(s2,(SNR(k)+(10*log10(log2(M)))),'measured'); % Square Modulation&#xA;Hexagonal_AWGN_Theory= awgn(s1,(SNR(ppn)+(10*log10(log2(M)))),'measured'); % Hexagonal modulation&#xA;&#xA;%% Demodulation Hexagonal&#xA;y1_Theory_hex=hexdemod(Hexagonal_AWGN_Theory,M);&#xA;y1_Theory_hex=y1_Theory_hex(:);&#xA;% [no_of_error_Theory_hex(ppn)                     &#xA;&#xA;BER_Theory_hex(ppn)]=biterr(Sr(20000:length(y1_Theory_hex)-100),y1_Theory_hex(20000:&#xA;(length(y1_Theory_hex)-100)))&#xA;[no_of_error_Theory_hex(ppn)&#xA;BER_Theory_hex(ppn)]=symerr(Sr(20000:length(y1_Theory_hex)-100),&#xA;y1_Theory_hex(20000:(length(y1_Theory_hex)-100)))&#xA;&#xA;%% Square Demodulation&#xA;y1_Theory_sq=qamdemod(Square_AWGN_Theory,M);&#xA;y1_Theory_sq=y1_Theory_sq(:);&#xA;% [no_of_error_Theory_sq(ppn) &#xA;BER_Theory_sq(ppn)]=biterr(Sr(20000:length(y1_Theory_sq)-100),&#xA;y1_Theory_sq(20000:(length(y1_Theory_sq)-100)))&#xA;[no_of_error_Theory_sq(ppn)&#xA;&#xA;BER_Theory_sq(ppn)]=symerr(Sr(20000:length(y1_Theory_sq)-100),&#xA;y1_Theory_sq(20000:(length(y1_Theory_sq)-100)))&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Output BER Comparison&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vRN4a.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Symbol error Rate Measurement&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qys7G.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;My Questions/Query&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;It is supposed that Hexagonal must give better result but i am not getting. although SER (symbol error rate is almost same ) but BER is not perfect. so please give me some suggestion by which i can get better result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to make differential coding for this Hexagonal Modulator ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to make the theoretical calculation to get a proper equation for this hexagonal modulator ?&lt;/p&gt;&#xA;" OwnerUserId="1766" LastEditorUserId="39" LastEditDate="2012-08-03T13:11:59.323" LastActivityDate="2013-11-07T09:27:43.673" Title="Hexagonal Modulator Comparison with Square Modulator" Tags="|matlab|discrete-signals|modulation|dsp-core|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3037" PostTypeId="2" ParentId="3032" CreationDate="2012-08-03T12:41:41.310" Score="1" Body="&lt;p&gt;Here is another solution:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Assuming these are flat bands, calculate the center frequency of the band you would like to move to. &lt;/li&gt;&#xA;&lt;li&gt;multiply the band you would like to move down by cos(2*pi*centerFreq + phaseOfComponentsOfMovedBand)  If you are moving the band down, apply a High pass filter to the signal. If you are moving the band up, apply a low pass filter to the signal. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;this is the modulation property of FTs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is:&#xA;Cos(f)*x(t)=&gt; (Frequency Domain) X(w-f) + X(w+f)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see &#xA;&lt;a href=&quot;http://www.ws.binghamton.edu/fowler/fowler%20personal%20page/EE301_files/FT%20Tables_rev3.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ws.binghamton.edu/fowler/fowler%20personal%20page/EE301_files/FT%20Tables_rev3.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for details. &lt;/p&gt;&#xA;" OwnerUserId="1183" LastActivityDate="2012-08-03T12:41:41.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3038" PostTypeId="2" ParentId="2962" CreationDate="2012-08-03T12:50:44.857" Score="5" Body="&lt;p&gt;While the above answer is really complete:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the gist of it:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;to downsample a signal it needs to be a whole number. Before the down sampling of a signal, you need to FILTER the signal. &lt;/li&gt;&#xA;&lt;li&gt;you can acheive rational number downsampling by Up-sampling/interpolating the&#xA;signal first.&lt;/li&gt;&#xA;&lt;li&gt;Upsampling is simply inserting zeros and then FILTERING the signal. &lt;/li&gt;&#xA;&lt;li&gt;so to achieve 3/4 sample rate. upsample the signal by inserting 4 zeros between every signal sample. Apply a filter. Then FILTER the signal and delete every 3 out of every 4 signal samples. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Details on this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ws.binghamton.edu/fowler/fowler%20personal%20page/EE523_files/Ch_14_1%20Subband%20Intro%20&amp;amp;%20Multirate%20(PPT).pdf&quot; rel=&quot;noreferrer&quot;&gt;http://www.ws.binghamton.edu/fowler/fowler%20personal%20page/EE523_files/Ch_14_1%20Subband%20Intro%20&amp;amp;%20Multirate%20(PPT).pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also: unless it is absolutely necessary DO NOT computer the FFT to then compute the IFFT. Its an incredibly slow process and its considered inappropriate for most signal processing tasks. the FFT is usually used for analyzing a problem or applying signal processing only in the frequency domain. &lt;/p&gt;&#xA;" OwnerUserId="1183" LastActivityDate="2012-08-03T12:50:44.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3039" PostTypeId="1" CreationDate="2012-08-03T14:04:39.597" Score="12" ViewCount="7041" Body="&lt;p&gt;First of all, this is the first time I try to make a Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I earlier posted the follwoing question &lt;a href=&quot;https://stackoverflow.com/questions/11758498&quot;&gt;Filter out noise and variations from speed values&lt;/a&gt; on StackOverflow which describes the background for this post. This is a typical sample of values I'm trying to filter. They don't necessarily have to decrease which is the case here. But the rate of change is typically like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;X&lt;/strong&gt;------- &lt;strong&gt;Y&lt;/strong&gt;&lt;br&gt;&#xA;16 ---233.75&lt;br&gt;&#xA;24 ---234.01&lt;br&gt;&#xA;26 ---234.33&lt;br&gt;&#xA;32 ---234.12&lt;br&gt;&#xA;36 ---233.85&lt;br&gt;&#xA;39 ---233.42&lt;br&gt;&#xA;47 ---233.69&lt;br&gt;&#xA;52 ---233.68&lt;br&gt;&#xA;55 ---233.76&lt;br&gt;&#xA;60 ---232.97&lt;br&gt;&#xA;66 ---233.31&lt;br&gt;&#xA;72 ---233.99  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have implemented my Kalman Filter according to this tutorial: &lt;a href=&quot;http://bilgin.esme.org/BitsBytes/KalmanFilterforDummies.aspx&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kalman Filter for Dummies&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My implementation looks like this (pseudocode).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Standard deviation is 0.05. Used in calculation of Kalman gain&#xA;&#xA;void updateAngle(double lastAngle){&#xA;  if(firsTimeRunning==true)&#xA;     priorEstimate = 0;               //estimate is the old one here&#xA;     priorErrorVariance = 1.2;        //errorCovariance is the old one&#xA;  else&#xA;     priorEstimate = estimate;              //estimate is the old one here&#xA;     priorErrorVariance = errorCovariance;  //errorCovariance is the old one&#xA;  rawValue = lastAngle;          //lastAngle is the newest Y-value recieved&#xA;  kalmanGain = priorErrorVariance / (priorErrVariance + 0.05);&#xA;  estimate = priorEstimate + (kalmanGain * (rawValue - priorEstimate));&#xA;  errorCovariance = (1 - kalmanGain) * priorErrVariance;&#xA;  angle = estimate;              //angle is the variable I want to update&#xA;}                                //which will be lastAngle next time&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I start out with a prior estimate of 0. This seems to work fine. But what i notice is that the kalmanGain will decrease each time this update is run, which means that I trust my new values less the longer my filter is running (?).&#xA;I don't want that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went from just using a moving average (simple and exponential weighted) to using this. Right now I can't even get as good results as that did.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is if this is the right implementation and if my prior error variance and standard deviation looks good according to the sample values I have posted? My parameters are actually just picked randomly to see if I could get some good results. I have tried several different ranges but with poor results. If you have any suggestions to changes I can do, it would be really appreciated. I'm sorry if there is some obvious things missing. First time posting here too.&lt;/p&gt;&#xA;" OwnerUserId="1768" LastEditorUserId="128" LastEditDate="2019-10-19T20:56:37.240" LastActivityDate="2022-06-19T21:03:03.097" Title="Kalman Filter - Implementation, Parameters and Tuning" Tags="|filters|algorithms|kalman-filters|bayesian-estimation|dynamic-system|" AnswerCount="6" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3040" PostTypeId="1" CreationDate="2012-08-03T18:17:09.150" Score="2" ViewCount="176" Body="&lt;p&gt;I am quite interested to know the significance of using kalman filter,unscented kalman filter and extended kalman filter in chaos synchronization when infact the very basics of chaos synchronization(physics perspective) never mentions about using kalman filter!However, these papers &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1712607&quot; rel=&quot;nofollow&quot;&gt;KF1&lt;/a&gt; and alike use kalman filter for synchronization. There are various methods of chaos synchronization viz generalized, phase, projective, adaptive &lt;a href=&quot;http://ifts.zju.edu.cn/~xingangwang/Course2010/download/chaossynchronization-2002.pdf&quot; rel=&quot;nofollow&quot;&gt;Boccaletti_Kurths et al&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Synchronization_of_chaos&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt; considered to be the bible in thi field, do not mention about using kalman filtering and alike methods. Would be obliged if the role of this technique is explained since I think I am missing on important theory. Thank you&lt;/p&gt;&#xA;" OwnerUserId="1699" LastActivityDate="2012-08-05T13:36:48.303" Title="Role of Kalman filter in nonlinear dynamics" Tags="|discrete-signals|continuous-signals|reference-request|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3041" PostTypeId="2" ParentId="3039" CreationDate="2012-08-03T20:57:45.663" Score="2" Body="&lt;p&gt;I think you could use some ideas from classical control theory, e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/PID_controller&quot; rel=&quot;nofollow noreferrer&quot;&gt;PID controller&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Your signal Y can be the setpoint of the controller u(t). The process plant is just 1 and y(t) will be filtered output. All you'll have to do is to set the parameters (tune) P,I and D to get what you want.&lt;/p&gt;&#xA;&lt;p&gt;The output y(t) will try to &amp;quot;follow&amp;quot; the input u(t), but the parameters control how this tracking will be.&lt;/p&gt;&#xA;&lt;p&gt;The differential gain D will make your response sensitive to rapid error changes. In your case, I think D should be small. You don't want y(t) to change if u(t) abruptly changes.&lt;/p&gt;&#xA;&lt;p&gt;The integral gain 'I' will make your response sensitive to accumulated error. You should put a high value there. If u(t) changes level and keeps it there, the error will build up and then you want y(t) to do the same.&lt;/p&gt;&#xA;&lt;p&gt;The P gain can give a fine tune. Anyway, try to play with the parameters and see what you get.&lt;/p&gt;&#xA;&lt;p&gt;There are complicated tuning methods, though, but I don't believe you'll need it.&lt;/p&gt;&#xA;&lt;p&gt;Good luck.&lt;/p&gt;&#xA;" OwnerUserId="1769" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-08-03T20:57:45.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3042" PostTypeId="2" ParentId="3019" CreationDate="2012-08-03T21:13:19.813" Score="5" Body="&lt;p&gt;The term super-resolution is used very loosely nowadays. But I think the following problem was the original idea, or at least, the one that made the term famous.&lt;/p&gt;&#xA;&lt;p&gt;Suppose you have a scene and several observations of that scene, i.e. several frames of a video with slight camera motion between them. Super-resolution algorithms combine those several observation into one highly resolved image. This is possible because each observation might contain unique information not present in the others.&lt;/p&gt;&#xA;&lt;p&gt;If you consider a certain frame as the key frame, this process can be interpreted as a MAP estimation since a priori (or extra) information is present in others frames.&lt;/p&gt;&#xA;&lt;p&gt;Additionally, we can use natural image statistics as extra information to regularize the solution. Total variation regularization is a broadly used technique.&lt;/p&gt;&#xA;&lt;p&gt;I suggest the paper &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1203207&amp;amp;tag=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sung Cheol Park - Super Resolution Image Reconstruction: A Technical Overview&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1769" LastEditorUserId="7092" LastEditDate="2021-04-09T16:29:16.147" LastActivityDate="2021-04-09T16:29:16.147" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3043" PostTypeId="2" ParentId="3036" CreationDate="2012-08-04T02:32:58.643" Score="4" Body="&lt;p&gt;For a rectangular QAM constellation, calculation of the symbol error rate is straightforward.&#xA;&lt;em&gt;Exact&lt;/em&gt; calculation of the bit error rate is somewhat more complicated, but approximations&#xA;are more easily calculated based on the following assumptions.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Each signal point has four nearest neighbors (interior point)&#xA;or three nearest neighbors (edge points), or two nearest neighbors (corner points),&#xA;Note that 16-QAM has 4 interior points, 8 edge points, and 4 corner points.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The probability that a transmitted signal point is demodulated into &#xA;a nearest neighbor is orders of magnitude than the probability that it is&#xA;demodulated into a more distant point&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A syymbol error results in exactly one bit error (that is, data bits&#xA;are assigned to signal points in Gray code order) so that the data bits assigned&#xA;to a signal point differ from the data bits assigned to a nearest neighbor&#xA;in just one bit position.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For the 16-ary hexagonal constellation with regular equiangular hexagons&#xA;(similar to but not quite the same as the constellation shown in the question), &#xA;the 4 interior points have 6 nearest&#xA;neighbors instead of 4 while the edge points have 4 nearest neighbors on average (some &#xA;have 3 and some have 5, others have 4 exactly), and two corner points have &#xA;3 nearest neighbors.  This has two effects. First, for a given spacing&#xA;between signal points, a symbol error is more likely since there are more&#xA;neighbors. Second, a symbol error can result in more than one bit error.&#xA;Thus, it is necessary to adjust the spacing between nearest neighbors&#xA;to compensate for this if one wants to have the same BER, and this will&#xA;typically increase the signal power needed. &#xA;In short, it is not immediately obvious that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is supposed to give better BER measurement than Square as it has &#xA;  wider decision boundary&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;is a believable claim.  In any case, the &lt;em&gt;width&lt;/em&gt; of the decision&#xA;boundary is not quite as relevant to the BER calculation as the&#xA;&lt;em&gt;distance&lt;/em&gt; of the constellation points from the decision boundaries,&#xA;and the number of nearest neighbors that each signal point has.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I don't decipher MATLAB very well, but if the picture with the&#xA;16 blobs was created by the MATLAB program included, then I &#xA;don't think that the constellation that has been created is&#xA;a (regular) hexagonal constellation at all. It looks for all&#xA;the world like you began with a rectangular 16-QAM signal constellation&#xA;(which has points at $(\pm m, \pm n)$ for $m, n \in \{1, 3\}$)&#xA;and moved the second and fourth rows by $1$ to the right, so&#xA;that the $x$ coordinate is $-2, 0, 2, 4$ instead of $-3, -1, 1, 3$.&#xA;Note that this increases the maximum signal amplitude in&#xA;one branch (I in this case) from $3$ to $4$ so that &#xA;the amplifiers have to have greater dynamic range and&#xA;the energy per bit also has increased. Any comparison&#xA;of the BER performance must take into account the fact&#xA;that the hexagonal constellation shown is operating at&#xA;a larger SNR than the standard rectangular 16-QAM constellation.&#xA;In a regular hexagonal constellation (which is what my remarks&#xA;above apply to), the points are at the&#xA;vertices (and centers) of regular (equiangular) hexagons and&#xA;are equidistant from their nearest neighbors, while&#xA;your distances are $2$ and $\sqrt{5}$ respectively.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-08-04T12:32:53.303" LastActivityDate="2012-08-04T12:32:53.303" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3044" PostTypeId="1" AcceptedAnswerId="25360" CreationDate="2012-08-04T04:31:59.960" Score="0" ViewCount="138" Body="&lt;p&gt;I made a terrible vocoder earlier and got some help on it here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2980/my-vocoder-sounds-bad&quot;&gt;My vocoder sounds bad&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My new implementation is much better. I'm using the band pass filter described in the document suggested on the old question. It seems to work much better, but the carrier wave is bleeding heavily into the output signal to the point where I can faintly hear some good vocoder sound effects behind the sound of the carrier wave. This bleed gets louder when the input volume is higher. Is this a common and easily fixed problem or should I give more info for you guys to help me debug this?&lt;/p&gt;&#xA;" OwnerUserId="1737" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-08-21T07:50:51.547" Title="Vocoder carrier wave bleed" Tags="|bandpass|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3045" PostTypeId="1" AcceptedAnswerId="3046" CreationDate="2012-08-04T19:17:02.660" Score="3" ViewCount="2739" Body="&lt;p&gt;I saw a video where this guy used a program to do a frequency analysis on a voice signal and a sawtooth wave (I'm assuming this was FFT). Then he saved the plots as images and combined them pixel by pixel through multiplication using photoshop. He then put this picture back into the program and it did the inverse transform, turning it back into a sound. He said that this was an implementation of a vocoder but the low quality made it hard for me to tell if he was correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, then couldn't one simply implement a vocoder as a convolution operation? You would just have your two signals then select a window from each of these of the same width at the same position, then perform the convolution operation on these two windows (and probably use a window function as well, such as Hanning). You would, of course, have to do this for every sample, so you would be doing this as many times as you have samples in your tracks (and the windows would sometimes lie partially outside of a track, so they would have to be zero padded). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like it might work because the convolution theorem says convolution in the time domain is itemwise multiplication in the frequency domain, so if it doesn't implement a vocoder, it at least implements exactly what the man in the video was doing (at higher quality). And, I'm not just asking this question blindly, I actually tried it. I get a very cool voice effect but I'm not sure it's the same as a vocoder. In fact, it sounds nothing like a vocoder. If some kind individual could tell me exactly what is happening here, I would be very grateful.&lt;/p&gt;&#xA;" OwnerUserId="1737" LastEditorUserId="90" LastEditDate="2012-08-06T13:13:50.730" LastActivityDate="2012-08-06T13:14:13.260" Title="Convolving two signals" Tags="|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3046" PostTypeId="2" ParentId="3045" CreationDate="2012-08-04T21:28:37.550" Score="6" Body="&lt;p&gt;From your description, here is what is happening in the video:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The short-term Fourier transform (aka spectrogram) of the signals is computed. The output of this operation is a matrix of complex values, which cannot be represented as images. Thus, the magnitude or the square of the magnitude is extracted to yield a single positive real value converted into a pixel intensity.&lt;/li&gt;&#xA;&lt;li&gt;The magnitudes (pixel intensities) are multiplied.&lt;/li&gt;&#xA;&lt;li&gt;The inverse short-term Fourier transform of the product is synthesized, presumably with made-up phases (or with the original phase of the carrier).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are so many reasons why this has nothing to do with a convolution. I'm sure other members will point a few more:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is multiplied are magnitudes or their squares; but not the actual complex values produced by the Fourier analysis.&lt;/li&gt;&#xA;&lt;li&gt;Even if the quantities that were multiplied were the actual complex values, keep in mind that when dealing with discrete signals of finite length, the inverse discrete Fourier transform of the product of the discrete Fourier transforms is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Circular_convolution&quot; rel=&quot;nofollow&quot;&gt;Circular Convolution&lt;/a&gt;, not the convolution.&lt;/li&gt;&#xA;&lt;li&gt;And still... If you split two signals $x$ and $y$ into blocks of length N, and compute the pair-wise circular-convolution of length N of these blocks, you'll get something very different from $x * y$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Convolving two audio-signals is a rather meaningless operations. One usually convolve an audio signal with the impulse response of a system; and when convolution is performed in the frequency-domain, the details are trickier than just pair-wise multiplications of FFTs (there's some blocking issues; + necessary overlap add or save).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you saw would be more accurately described as spectral cross-synthesis. And there is one major reason why this is a very different beast from a vocoder. The goal of a vocoder is to apply the &lt;em&gt;spectral envelope&lt;/em&gt; of the modulator onto the carrier. I emphasize on spectral envelope, because when you use a vocoder to make a stack of sawtooth waves say &quot;hello&quot;, you apply the formants and overall loudness envelope of the original speech signal to the saw waves, but the last thing you want is the pitch information of the speech signal to get involved. The analysis filter bank of the vocoder should be designed to make abstraction of the individual spectral peaks in the modular signal - what matters is the rough spectral envelope - the location of the bumps (formants). This is why a vocoder doesn't need more than 12-30 channels - too few channels and it doesn't capture the formants, too many channels and it starts capturing pitch-dependent fine spectral peaks. Just like the features used in speech recognition...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me give you an example. Let us say you have a modulator speech signal with a 200 Hz f0 ; and formants at 1kHz and 1.5kHz - its spectrum is a sequence of narrow peaks at 200 Hz, 400 Hz, 600Hz, 800 Hz, 1000 Hz, 1200 Hz, 1400 Hz, 1600 Hz, 1800 Hz ; with the peaks at 1000 Hz and 1400 / 1600 Hz emphasized (formants). Let's say your carrier signal is a 140 Hz sawtooth - the spectrum is made of narrow peaks at 140 Hz, 280 Hz, 420 Hz... with a decreasing $1/n$ amplitude. If you go with what you described in your question (product of STFTs), you wouldn't have much left because the two spectra have very little overlap - the first common frequency in the sequence would be at 1400 Hz! What you want to do is somehow capture that the modulator spectrum has a bump at 1kHz and 1.5kHz, and use this information to boost the carrier spectrum in this frequency area. That's how vocoders work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do so, and if you really want to go the STFT route, an option would be to smooth the modulator spectrum with a rather wide kernel before doing the multiplication - so that what you are really doing is applying the spectral envelope of one signal onto the other one. This would be akin to applying a motion-blur on the Y axis in Photoshop using this silly image manipulation presentation...&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="90" LastEditDate="2012-08-06T13:14:13.260" LastActivityDate="2012-08-06T13:14:13.260" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3047" PostTypeId="1" AcceptedAnswerId="3048" CreationDate="2012-08-04T21:51:28.707" Score="4" ViewCount="1083" Body="&lt;p&gt;This question is regarding application of polyphase decimation filter in symbol time correction. How does choosing a perticular &quot;polyphase branch&quot; in a polyphase decimation filter result in timing adjustment ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a 256:1 decimation filter with a sampling frequency of $256\textrm{ kHz}$ with total of $256\cdot 8$ taps (or $256$ filter banks with $8$ tap each). These are linear phase FIR filters, each filter bank having a data rate of $1\textrm{ kHz}$. Consider following two scenario:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I start with polyphase filter bank index $1$ and carry on convolving input data and roll over polyphase bank index at $256$.&lt;/li&gt;&#xA;&lt;li&gt;I start with polyphase filter bank index $2$ and roll over polyphase bank index at $256$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How does this result in timing adjustment ?&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="1629" LastEditDate="2017-01-11T19:26:37.237" LastActivityDate="2017-01-11T19:26:42.087" Title="Timing syncronisation using polyphase decimation filter" Tags="|filters|decimation|synchronization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3048" PostTypeId="2" ParentId="3047" CreationDate="2012-08-04T23:23:22.273" Score="5" Body="&lt;p&gt;The phases of a  polyphase filter can be interpreted as a fractional delays. Consider your filter with $8\cdot 256$ taps in the up-sampled domain. In order to avoid aliasing the filter needs to be a low pass that doesn't allow any content above $1/256$ of the sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there is no energy above $1/256\cdot f_s$ in the transfer function you can actually down-sample the impulse response by a factor of $256$ without aliasing. That means that all phases have the same magnitude response in the down-sampled domain. The only difference between the phases is a linear phase that corresponds to a fractional delay. If phase $0$ has a delay of &quot;$0$&quot; samples, then phase $1$ will have a delay of $1/256$ samples etc. in the down sampled domain.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="1629" LastEditDate="2017-01-11T19:26:42.087" LastActivityDate="2017-01-11T19:26:42.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3049" PostTypeId="1" CreationDate="2012-08-05T09:50:13.930" Score="4" ViewCount="1083" Body="&lt;p&gt;I am designing some Downsampling filters using the remez exchange algorithm (Matlab FDAtool). I see that some times i get a spike at the first and last coefficients. does anybody knows why is that? my intuition seems to be that this can introduce some artifacts to the signal..&#xA;What will be the consequance of multiplying the filter by a window (hamming and so on) to reduce this edge effects?&lt;/p&gt;&#xA;" OwnerUserId="1775" LastActivityDate="2013-05-27T11:04:07.403" Title="Downsample Equiripple FIR filter" Tags="|filters|filter-design|lowpass-filter|downsampling|finite-impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3050" PostTypeId="2" ParentId="3040" CreationDate="2012-08-05T13:36:48.303" Score="3" Body="&lt;p&gt;Kalman filters are useful if one is dealing with noisy systems, when one either has no knowledge about the source of the noise or the noise is created by a high-dimensional nonlinear system with many positive Lyapunov exponents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chaos synchronization is dealing with small low-dimensional systems which usually posses only one or two positive Lyapunov exponents. Applying a Kalman filter does not make much sense, since many better suited methods exist to deal with such systems, as one knows, that the system is not a stochastic one.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2012-08-05T13:36:48.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3051" PostTypeId="2" ParentId="3049" CreationDate="2012-08-05T16:43:52.610" Score="5" Body="&lt;p&gt;The &quot;spikes&quot; (they are quite small in magnitude, but large compared to the nearby filter taps) at the beginning and end are part of how the equiripple property is achieved.  In his book &quot;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0131465112&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multirate Signal Processing for Communication Systems&lt;/a&gt;&quot; (a book that I recommend quite highly), fredric harris indicates that it is sometimes advantageous to eliminate the spikes because it causes the frequency response to continue to decrease after the cut-off frequency instead of staying constant.  The price you pay is that the filter is no longer equiripple which appears to cause (see example below and comments by JasonR) the transition band to be not as sharp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;I created a low-pass filter in Octave using remez.  I intentionally made the transition-band very small to get it to create a decent spike.  The filter taps are plotted below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fGcOe.png&quot; alt=&quot;Filter with spikes on ends&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the frequency response of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4rxDk.png&quot; alt=&quot;Frequency response of &amp;quot;spiked&amp;quot; filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the frequency response is pretty poor due to the short transition-band, but the point is that it is an equiripple filter.  Below I plot the exact same filter, only I have zeroed out the two spike taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZWCmm.png&quot; alt=&quot;Filter with no spikes&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the frequency response of the &quot;no spikes&quot; version of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BntHa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response shows the continued drop beyond the cutoff frequency.  It also clearly shows the non-equiripple response in the pass-band.  This is entirely expected.  The one thing that is unexpected is that the &quot;no spike&quot; filter appears to be better than the &quot;spike&quot; filter at every point.  I assume that this is because of some flaw in Octave's remez algorithm.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-08-07T14:17:53.613" LastActivityDate="2012-08-07T14:17:53.613" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3052" PostTypeId="1" AcceptedAnswerId="3055" CreationDate="2012-08-05T17:51:29.637" Score="5" ViewCount="1206" Body="&lt;p&gt;I need help on understanding the linkage between Object Recognition and Content-based Image Retrieval. Does OR use CBIR to find similar objects with the help of algorithms like SIFT etc or does CBIR use OR to improve its results on finding images showing the same object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CBIR could use color histograms to find similar images but that has not too much in common with or so CBIR can stand alone i guess. OR needs to retrieve information which could come from learned images thus I suppose OR needs CBIR in some way. That would lead to the conclusion that OR is dependent and builds on CBIR, is that correct?&lt;/p&gt;&#xA;" OwnerUserId="969" LastEditorUserId="53" LastEditDate="2012-08-06T19:51:20.013" LastActivityDate="2012-08-06T19:51:20.013" Title="How are Object Recognition and Content-based Image Retrieval interlinked?" Tags="|computer-vision|object-recognition|cbir|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3053" PostTypeId="1" AcceptedAnswerId="3054" CreationDate="2012-08-06T11:46:10.297" Score="8" ViewCount="13366" Body="&lt;p&gt;I've been thinking of an algorithm for object recognition but it would relies heavily on straight non-noisy lines and as far as I know this is hard to obtain with edge detection algorithms. What's the best edge detection algorithm to obtain lines as straight as possible?&lt;/p&gt;&#xA;" OwnerUserId="1778" LastActivityDate="2018-02-26T19:09:11.573" Title="Straight lines with an edge detection algorithm" Tags="|image-processing|noise|edge-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3054" PostTypeId="2" ParentId="3053" CreationDate="2012-08-06T13:47:45.693" Score="10" Body="&lt;p&gt;You're probably looking for the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Hough transform&lt;/strong&gt;&lt;/a&gt; or one of it's extensions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest version of this transform is linear and appropriate for detecting straight lines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the transformed space (&lt;em&gt;Hough space&lt;/em&gt;), angles and distances are found as points where curves intersect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Libraries for calculating the Hough transform exist in &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;C++ - &lt;a href=&quot;http://www.opencv.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV&lt;/a&gt; (Has Python bindings)&lt;/li&gt;&#xA;&lt;li&gt;Matlab - &lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/ref/hough.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;hough&lt;/code&gt; in the image processing toolbox&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Python - &lt;a href=&quot;http://scikit-image.org/docs/dev/auto_examples/edges/plot_line_hough_transform.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scikits-image&lt;/a&gt; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Related Questions and Answers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this previous answer for more &lt;a href=&quot;https://dsp.stackexchange.com/questions/1958/help-understanding-hough-transform&quot;&gt;help on understanding the Hough transform&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1718" LastEditorUserId="1718" LastEditDate="2018-02-26T19:09:11.573" LastActivityDate="2018-02-26T19:09:11.573" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3055" PostTypeId="2" ParentId="3052" CreationDate="2012-08-06T19:44:54.543" Score="8" Body="&lt;p&gt;The difference is not so much in the algorithms used, but in the objectives.  Object recognition is a problem of naming an object or objects depicted in an image.  Content-based Image Retrieval is the problem of finding images in a database which match a user's query, which may be in the form of an image or in form of text. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say that CBIR is a more general problem than object recognition.  If anything, it is CBIR that builds on object recognition, and not the other way around.  If you have an image retrieval system, and the query is an image of a cat, then your system would need to recognize that this is an image of a cat (object recognition), and then find other images of cats in its database.  Presumably to be able to do that it would have to have performed object recognition on all of its images in advance, and tagged the ones that depict cats accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, that you can also have a query that may not require object recognition.  For example you may ask the system for images of urban landscapes, or images of indoor scenes.  This is a problem of &quot;scene recognition&quot; and it is typically approached  by using  some sort of a global image descriptor (e. g. &lt;a href=&quot;http://cvcl.mit.edu/papers/olivatorralbapbr2006.pdf&quot;&gt;scene gist&lt;/a&gt;), rather than trying to find all the object in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that an object recognition system must give you a single answer, i. e. the name of the object in the given image, and that answer is either right or wrong.  On the other hand, an image retrieval system gives you multiple possible matches for your query, and you would consider it successful even if only some of the top matches are good.  So there is a big difference in how you might evaluate an object recognition system vs. an image retrieval system.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2012-08-06T19:50:38.203" LastActivityDate="2012-08-06T19:50:38.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3056" PostTypeId="2" ParentId="3026" CreationDate="2012-08-06T21:42:21.430" Score="8" Body="&lt;p&gt;The problem is that your noise has a flat spectrum. If you assume &lt;a href=&quot;http://en.wikipedia.org/wiki/White_noise&quot;&gt;white Gaussian noise&lt;/a&gt; (which turns out to be a good assumption) its power spectrum density is constant. Roughly speaking, it means that your noise contains all frequencies. That's why any frequency approach, e.g. DFT or low-pass filters, is not a good one. What would be your cut-off frequencies since your noise is all over the spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One answer to this question is the Wiener filter, which requires knowledge of the statistics of your noise and your desired signal. Basically, the noisy signal (signal + noise) is attenuated over the frequencies where the noise is expected to be grater than your signal, and it is amplified where your signal is expected be grater than your noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would suggest more modern approaches that use non-linear processing, for example wavelet denoising. These methods provide excellent results. Basically, the noisy signal is first decomposed into wavelets and then small coefficients are zeroed. This approach works (and DFT doesn't) because of the multi-resolution nature of wavelets. That is, the signal is processed separately in frequency bands defined by the wavelet transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, type 'wavemenu' and then 'SWT denoising 1-D'. Then 'File', 'Example Analysis', 'Noisy signals', 'with Haar at level 5, Noisy blocks'. This example uses Haar wavelet, which should work fine for your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not good at Python, but I believe you can find some NumPy packages which perform Haar wavelet denoising.&lt;/p&gt;&#xA;" OwnerUserId="1769" LastActivityDate="2012-08-06T21:42:21.430" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3057" PostTypeId="1" CreationDate="2012-08-07T00:34:10.417" Score="7" ViewCount="191" Body="&lt;p&gt;I checked the literature for recent algorithms used to design a digital filter that is a minimax approximation of a desired frequency response. All the articles I found work out examples where all the poles have magnitude less than 0.92, or less that 0.89, etc. I havn't seen a published example with a pole having magnitude 0.95 and certainly not 0.9995. If a filter is implemented with double precision machine arithmetic, how close to the unit circle can a pole get to get a useful filter? Would it be a bad idea to have a pole with magnitude 0.95?&lt;/p&gt;&#xA;" OwnerUserId="1780" LastActivityDate="2014-05-23T03:29:20.913" Title="Abs(poles) &lt; 1 by what margin for a stable filter?" Tags="|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3058" PostTypeId="2" ParentId="3057" CreationDate="2012-08-07T00:50:26.350" Score="4" Body="&lt;p&gt;It would most likely depend upon the order of the filter, but having a pole at position $z_p$ where $|z_p| = 0.95$ shouldn't pose a stability problem if you're using double-precision floating-point arithmetic with a filter of reasonable length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I don't know anything about your specific application, one other effect of the pole magnitude that might be relevant is the resulting filter's impulse response. Recall that poles in a system's transfer function correspond to decaying exponential terms in the system's impulse response. &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Table_of_common_Z-transform_pairs&quot; rel=&quot;nofollow&quot;&gt;As Wikipedia notes:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a^nu[n] \Leftrightarrow \frac{1}{1-az^{-1}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u[n]$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Heaviside_step#Discrete_form&quot; rel=&quot;nofollow&quot;&gt;discrete unit step function&lt;/a&gt;, used here to express that the impulse response is causal ($0\ \forall\ n &amp;lt; 0$). Therefore, if your filter has a pole at $z = a$, then there will be a corresponding $a^n$ term in the filter's impulse response. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For small $|a|$, this term will decay out in a relatively small number of samples. As $|a| \rightarrow 1$, the amount of time (measured in samples) required for the exponential function to decay increases. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When you reach the &quot;critically stable&quot; point of $|a| = 1$, the exponential never decays and the system impulse response does not decay to zero. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $|a| &amp;gt; 1$ (i.e. the pole lies outside the unit circle), then the exponential function diverges and the impulse response blows up to infinity; this is why a discrete-time system is not &lt;a href=&quot;http://en.wikipedia.org/wiki/Bibo_stability&quot; rel=&quot;nofollow&quot;&gt;BIBO stable&lt;/a&gt; if it contains poles outside the unit circle.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Given the above, the other concern that you might have is the overall effective time duration of the filter's impulse response. Although, as its name would suggest, an &lt;a href=&quot;http://en.wikipedia.org/wiki/Iir_filter&quot; rel=&quot;nofollow&quot;&gt;IIR filter&lt;/a&gt; theoretically has an impulse response of infinite length, in practice the response will usually decay to a negligible level after a finite time period. If your application is sensitive to this characteristic, then it makes sense to choose pole locations that are further from the unit circle. There will be corresponding tradeoffs in frequency-domain characteristics, as placing poles near the unit circle can help to make transition regions sharper and more narrow, as is often desirable.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2014-05-23T03:29:20.913" LastActivityDate="2014-05-23T03:29:20.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3059" PostTypeId="2" ParentId="3039" CreationDate="2012-08-07T01:33:41.663" Score="6" Body="&lt;p&gt;Kalman filters are useful when your input signal consists of noisy observations of some linear dynamical system's state. Given a series of observations of the system state, the Kalman filter aims to recursively provide better and better estimates of the underlying system's state. In order to apply it successfully, you need to have a model for the dynamics of the system whose state you're estimating. &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#Underlying_dynamic_system_model&quot; rel=&quot;noreferrer&quot;&gt;As described in detail at Wikipedia&lt;/a&gt;, this model describes how the state underlying system is expected to change over one time step, given its previous state, any inputs to the system, and a Gaussian-distributed stochastic component called process noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, it's not clear from your question whether you have any such underlying model. The linked post indicated that you're consuming speed values from a sensor. These can be modeled as direct observations of a system's state (where the state is its speed), or indirect observations of its state (where the state is its position, for example). But, in order to use the Kalman framework, you need to choose a model for how that state is expected to evolve as time goes on; this additional information is used in order to generate the optimal estimate. A Kalman filter isn't a magic black box that will just &quot;clean up&quot; a signal that is applied to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, the phenomenon that you alluded to, where the Kalman filter will become increasingly confident in its own output to the point where input observations become progressively ignored, does happen in practice. This can be mitigated by manually increasing the values in the process noise covariance matrix. Then, qualitatively, the model for the system's state transition contains a larger stochastic component, so the ability for the estimator to accurately predict the next state given the current state is diminished. This will reduce its reliance on its current estimate of the system state and increase its reliance upon subsequent observations, preventing the &quot;ignoring the input&quot; effect.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-08-07T01:33:41.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3060" PostTypeId="1" AcceptedAnswerId="13768" CreationDate="2012-08-07T08:22:05.377" Score="4" ViewCount="128" Body="&lt;p&gt;Is there some learnable segmentation or learnable edge detection algorithm exist?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I mark N fotos by hands and than program &quot;learns&quot; how to do it best way and can do it on similar images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there are some papers on this subject or source code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&#xA;I found some inforamtion supervised edge detection \ supervised segmentation&#xA;&lt;a href=&quot;http://www.loni.ucla.edu/~ztu/Download.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.loni.ucla.edu/~ztu/Download.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but still looking for code.&lt;/p&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="1781" LastEditDate="2012-08-07T08:39:03.913" LastActivityDate="2014-01-14T10:03:34.923" Title="learnable segmentation or learnable edge detection" Tags="|edge-detection|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3062" PostTypeId="1" CreationDate="2012-08-07T17:41:50.540" Score="2" ViewCount="578" Body="&lt;p&gt;I've been attempting to work on signal transformation and filtering for the past few months. It's a bit difficult, but I've been making progress. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if anyone had any simple examples to show loading in a wave file, editing the volume and frequencies of that file, and re-outputting it to a file? I've already gotten up to volume, but I just can't edit the frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that by using FFT, I would gain direct access to the frequencies of the sound file. Was that incorrect? I recall looking at frequency bins and such, but I don't see how that ties into wave files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it might sound really complex, and I don't want to ask for a lot,  but could someone post or link to an example? It would really help me out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Python, with Windows 64-bit. I'm already using Scipy and NumPy for FFT and wave file input / output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to basically be able to low-pass or high-pass filter a sound by code, as well as be able to read the frequency data in each sample (i.e. see how high- or low-pitched the sample is).&lt;/p&gt;&#xA;" OwnerUserId="1679" LastEditorUserId="1679" LastEditDate="2012-08-09T06:54:37.497" LastActivityDate="2012-10-09T17:05:51.883" Title="A Working Signal Frequency Example?" Tags="|fft|" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="3063" PostTypeId="1" CreationDate="2012-08-08T08:27:25.343" Score="7" ViewCount="4490" Body="&lt;p&gt;How to count blood cells in opencv? The problem is that they stick together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example picture :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s58Hl.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe pairwise geometric histogram (&lt;a href=&quot;http://www.bmva.org/bmvc/1993/bmvc-93-043.pdf&quot; rel=&quot;noreferrer&quot;&gt;Geometric Histograms&lt;/a&gt;) suitable  for matching partial circle shape?&lt;/p&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="6" LastEditDate="2012-08-08T18:16:24.547" LastActivityDate="2014-04-28T21:06:38.860" Title="count blood cells" Tags="|image-processing|computer-vision|opencv|image-segmentation|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3064" PostTypeId="2" ParentId="3063" CreationDate="2012-08-08T10:29:48.383" Score="5" Body="&lt;p&gt;Just an idea with no guarantee of success:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;isolate the red blobs (e.g. mark them as white, the rest of the image as black)&lt;/li&gt;&#xA;&lt;li&gt;perform a distance transform for the white blobs (every pixel indicates the distance to the nearest black pixel)&lt;/li&gt;&#xA;&lt;li&gt;perform a non-maxima-suppression (ideally only the centers of the circles remain)&lt;/li&gt;&#xA;&lt;li&gt;deal with non ideal conditions (filter out small peaks from artifacts)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="101" LastActivityDate="2012-08-08T10:29:48.383" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3066" PostTypeId="1" AcceptedAnswerId="3067" CreationDate="2012-08-07T21:48:57.200" Score="25" ViewCount="5380" Body="&lt;p&gt;I know this is signal dependent, but when facing a new noisy signal what is your bag of tricks for trying to denoise a signal while maintaining sharp transitions (e.g. so any sort of simple averaging, i.e. convolving with a gaussian, is out). I often find myself facing this question and don't feel like I know what I ought to be trying (besides splines, but they can seriously knock down the right kind of sharp transition as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. As a side note, if you know some good methods using wavelets, let me know what it is. Seems like they have a lot of potential in this area, but while there are some papers in the 90s with enough citations to suggest the paper's method turned out well, I can't find anything about what methods ended up winning out as top candidates in the intervening years. Surely some methods turned out to be generally &quot;first things to try&quot; since then.&lt;/p&gt;&#xA;" OwnerUserId="566" OwnerDisplayName="John Robertson" LastEditorUserId="128" LastEditDate="2018-05-12T09:28:06.577" LastActivityDate="2018-05-12T09:28:06.577" Title="Bag of Tricks for Denoising Signals While Maintaining Sharp Transitions" Tags="|noise|wavelet|denoising|smoothing|total-variation|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3067" PostTypeId="2" ParentId="3066" CreationDate="2012-08-08T04:15:10.867" Score="14" Body="&lt;p&gt;L1 norm minimization (compressed sensing) can do a relative better job than conventional Fourier denoising in terms of preserving edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The procedure is to minimize an objective function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    |x-y|^2 + b|f(y)|&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x$ is the noisy signal, $y$ is the denoised signal, $b$ is the regularziation parameter, and $|f(y)|$ is some L1 norm penalty. Denoising is accomplished by finding the solution $y$ to this optimization problem, and $b$ depends on the noise level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To preserve edges, depending on the signal $y$, you can choose different penalties such that $f(y)$ is sparse (the spirit of compressed sensing):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if $y$ is piece-wise, $f(y)$ can be &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_variation&quot; rel=&quot;nofollow&quot;&gt;total variation&lt;/a&gt; (TV) penalty;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if $y$ is curve-like (e.g. Sinogram), $f(y)$ can be the expansion coefficients of $y$ with respect to &lt;a href=&quot;http://en.wikipedia.org/wiki/Curvelet&quot; rel=&quot;nofollow&quot;&gt;curvelets&lt;/a&gt;. (This is for 2D/3D signals, not 1D);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if $y$ has isotropic singularities (edges), $f(y)$ can be the expansion coefficients of $y$ with respect to &lt;a href=&quot;http://en.wikipedia.org/wiki/Wavelet&quot; rel=&quot;nofollow&quot;&gt;wavelets&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When $f(y)$ is the the expansion coefficients with respect to some basis functions (like curvelet/wavelet above), solving the optimization problem is equivalent to thresholding the expansion coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note this approach can also be applied to deconvolution in which the objective function becomes to $|x-Hy|+ b|f(y)|$, where $H$ is the convolution operator.&lt;/p&gt;&#xA;" OwnerUserId="1641" OwnerDisplayName="chaohuang" LastEditorUserId="1641" LastEditDate="2013-08-30T18:30:48.447" LastActivityDate="2013-08-30T18:30:48.447" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3068" PostTypeId="2" ParentId="3053" CreationDate="2012-08-08T12:48:45.507" Score="1" Body="&lt;p&gt;you can use LSD line detector &lt;a href=&quot;http://www.ipol.im/pub/algo/gjmr_line_segment_detector/&quot; rel=&quot;nofollow&quot;&gt;http://www.ipol.im/pub/algo/gjmr_line_segment_detector/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1781" LastActivityDate="2012-08-08T12:48:45.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3070" PostTypeId="2" ParentId="3066" CreationDate="2012-08-08T13:52:24.287" Score="7" Body="&lt;p&gt;Chaohuang has a good answer, but I will also add that one other method that you can use would be via the Haar Wavelet Transform, followed by wavelet co-efficient shrinkage, and an Inverse Haar Transform back to the time-domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Haar wavelet transform decomposes your signal into co-efficients of square and difference functions, albeit at different scales.  The idea here is that you 'force' the new square signal representation to best match your original signal, and thus one that best represents where your edges lie. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you perform a co-efficient shrinkage, all that means is that you are setting specific co-efficients of the Haar transformed function to zero. (There are other more involved methods, but that is the simplest). The Haar transformed wavelet co-efficients are scores associated with different square/difference functions at different scales. The RHS of the Haar transformed signal represents square/difference bases at the lowest scale, and thus, can be interpreted, at the 'highest frequency'. Most of the noise energy will thus lie here, VS most of the signal's energy that would lie on the LHS. Is is those bases co-efficients that are nulled out and the result then inverse transformed back to the time-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attached is an example of a sinusoid corrupted by heavy AWGN noise. The objective is to figure out where the 'start' and 'stop' of the pulse lie. Traditional filtering will smear the high-frequency (and highly localized in time) edges, since at its heart, filtering is an L-2 technique. In contrast, the following iterative process will denoise as well as preserve edges:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I thought one could attach movies here, but I do not seem to be able to. You can download movie I made of the process &lt;a href=&quot;https://dl.dropbox.com/u/4724281/HaarInMotion1.mpg&quot;&gt;here&lt;/a&gt;). (Right click and 'save link as'). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote the process 'by hand' in MATLAB, and it goes like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a sinusoid pulse corrupted by heavy AWGN.&lt;/li&gt;&#xA;&lt;li&gt;Compute the envelope of the above. (The 'signal').&lt;/li&gt;&#xA;&lt;li&gt;Calculate the Haar Wavelet Transform of your signal at all scales.&lt;/li&gt;&#xA;&lt;li&gt;Denoise by iterative co-efficient thresholding.&lt;/li&gt;&#xA;&lt;li&gt;Inverse Haar Transform the shrunk co-efficient vector. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can clearly see how the co-efficients are being shrunk, and the resulting Inverse Haar Transform resulting from it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One drawback of this method however, is that the edges need to lie in or around the square/difference bases at a given scale. If not, the transform is forced to jump to the next higher level, and thus one loses an exact placement for the edge. There are multi-resolution methods used to counter act this, but they are more involved. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-08-08T14:10:01.573" LastActivityDate="2012-08-08T14:10:01.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3071" PostTypeId="1" AcceptedAnswerId="3073" CreationDate="2012-08-08T18:18:29.840" Score="13" ViewCount="18197" Body="&lt;p&gt;I'm experimenting with decimating a signal, in this case a unit impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Python, with pylab.  First, I create a unit impulse, and decimate it by 5.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = r_[zeros(0), 1, zeros(100)]&#xA;N = 2 ** 14&#xA;q = 5&#xA;&#xA;y = decimate(x, q, ftype=&quot;fir&quot;)&#xA;subplot(211)&#xA;title(&quot;Original&quot;)&#xA;stem(range(len(x)), x)&#xA;subplot(212)&#xA;title(&quot;Decimated - FIR&quot;)&#xA;stem(range(len(y)), y)&#xA;&#xA;figure()&#xA;subplot(211)&#xA;semilogx(log(abs(fft(x, N))))&#xA;subplot(212)&#xA;y = decimate(x, q, ftype=&quot;fir&quot;)&#xA;semilogx(log(abs(fft(y, N))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results with the following plots&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7dIlc.png&quot; alt=&quot;Unit impulse with zero delay, and the resulting decimated signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then add a few samples of delay before the impulse, by changing x to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = r_[zeros(3), 1, zeros(100)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in the following plots&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C4Bq8.png&quot; alt=&quot;Unit impulse with 3 samples delay, and the resulting decimated signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second set of plots, the resulting decimated signal is no longer a single sample, but has been distorted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I delay the signal with 5 - and any multiple of q - samples, I get the first set of plots again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source code for the decimate function is, &lt;a href=&quot;https://github.com/scipy/scipy/blob/master/scipy/signal/signaltools.py#L1570&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/scipy/scipy/blob/master/scipy/signal/signaltools.py#L1570&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def decimate(x, q, n=None, ftype='iir', axis=-1):&#xA;    if not isinstance(q, int):&#xA;        raise TypeError(&quot;q must be an integer&quot;)&#xA;&#xA;    if n is None:&#xA;        if ftype == 'fir':&#xA;            n = 30&#xA;        else:&#xA;            n = 8&#xA;&#xA;    if ftype == 'fir':&#xA;        b = firwin(n + 1, 1. / q, window='hamming')&#xA;        a = 1.&#xA;    else:&#xA;        b, a = cheby1(n, 0.05, 0.8 / q)&#xA;&#xA;    y = lfilter(b, a, x, axis=axis)&#xA;&#xA;    sl = [slice(None)] * y.ndim&#xA;    sl[axis] = slice(None, None, q)&#xA;    return y[sl]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using a fir low pass filter before decimating, the impulse response of the filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zQem0.png&quot; alt=&quot;impulse response of low pass filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This explains why the impulse is distorted when there is a delay, the decimation is selecting parts of the impulse response, when the delay is a multiple of the decimation, it only selects the zero's of the impulse response, and one non-zero sample at the peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to decimate a unit sample with an arbitrary delay, which results in a scaled unit sample output?&lt;/p&gt;&#xA;" OwnerUserId="1561" LastActivityDate="2012-08-08T18:44:36.077" Title="Downsampling a signal with decimate" Tags="|decimation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3072" PostTypeId="1" AcceptedAnswerId="3359" CreationDate="2012-08-08T11:20:30.170" Score="9" ViewCount="2493" Body="&lt;p&gt;In this question, I would like to focus on intensity value of the CT Scan. First, take a look at the image below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TyQNZ.png&quot; alt=&quot;lung nodule measurement&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upper image is the original image, while the lower image is the thresholded version. In order to measure volume of any shape, theoretically, it is possible to simply just count the number of voxels in the image. However, the outermost layer of the object (ex. nodule) shows darker intensity, while all voxels inside the object have very high intensity. If I simply count the voxels in the thresholded version, I will highly likely to get a result volume larger than the actual volume for the lung nodule. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also see that there are variables such as window center (level) and window width, which can be used to adjust the DICOM image's intensity information. Different intensity can alter the result volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is the question: if I am to measure any given lung nodule, what should I do in order to achieve the best possible precision? When should we ignore the lower intensity voxels? Or must I do this in some other ways?&lt;/p&gt;&#xA;" OwnerUserId="263" OwnerDisplayName="Karl" LastActivityDate="2012-09-17T17:48:50.550" Title="How to measure a lung nodule in a CT Scan DICOM image?" Tags="|image-processing|3d|computer-vision|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3073" PostTypeId="2" ParentId="3071" CreationDate="2012-08-08T18:44:36.077" Score="11" Body="&lt;p&gt;You seem to understand correctly what is going on. However, I'm not sure what you expect to get. Take your initial example. Let your input signal be $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = \delta[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step in the decimation process is that the input signal is convolved with the anti-aliasing filter's impulse response $h[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;x_f[n] &amp;amp;= x[n] * h[n] \\&#xA;&amp;amp;= \delta[n] * h[n] \\&#xA;&amp;amp;= h[n]&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, the filtered signal is downsampled by a factor of $q$ ($5$ in your example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_d[n] = x_f[qn] = h[qn]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, for FIR filters whose orders are a multiple of $q$ (actually, since the filter is linear-phase, the order need only be a multiple of $\frac{q}{2}$), the taps at time delays $qn$ are zero for all $q \ne 0$. Therefore, $x_d[n]$ is nonzero only at $n=0$, as you found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you apply a time delay to the input impulse $x[n]$, then the filtered output is just delayed by the same amount, since the filter is &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system&quot;&gt;linear and time invariant (LTI)&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_f[n] = h[n-D]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_d[n] = x_f[qn] = h[qn-D]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, as you noted, this has the effect of plucking out a different set of taps from the filter's response, such that the decimated output signal is no longer zero for all but one sample (i.e. it doesn't look like an impulse any more). This is to be expected. Why? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot;&gt;discrete-time Fourier transform (DTFT)&lt;/a&gt; of a discrete impulse is flat (in magnitude) in the frequency domain. If $x_d[n]$ is to be equivalent to a delayed impulse, it must also have flat magnitude in the frequency domain. However, its DTFT just a scaled copy of the filter's frequency response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_d[n] = h[qn-D] \Leftrightarrow e^{-j\omega D} H\left(\frac{\omega}{q}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(\omega)$ is the filter's frequency response. In order for the decimated output $x_d[n]$ to be equal to a delayed impulse, the filter must have a brick-wall response that is perfectly flat across its passband (up to the post-decimation Nyquist frequency) and zero everywhere else (so no aliasing leaks back in after downsampling, making the result non-flat). This isn't realizable unless you have an infinite amount of time and resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the filter is the source of the &quot;distortion&quot; that you don't want, you might consider trying the process again without a filter. But, consider what you would get then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_f[n] = x[n] = \delta[n-D]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_d[n] = x_f[qn] = \delta[qn-D]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $q$ is not a multiple of $D$, then $x_d[n] = 0\ \forall\ n$, which is probably not what you would want either.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-08-08T18:44:36.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3074" PostTypeId="1" AcceptedAnswerId="33946" CreationDate="2012-08-08T21:36:17.267" Score="5" ViewCount="1359" Body="&lt;p&gt;I am trying to figure out the details on how to implement the 3D structure tensor in C/C++ in an easy but efficient way and need some advice!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a discrete function $ I(x_i,y_j,z_k)$ the 3D structure tensor is given by:&#xA;$$ S=\begin{pmatrix}&#xA;W \ast I_x^2 &amp;amp; W \ast (I_xI_y) &amp;amp; W \ast (I_xI_z)\\&#xA;W \ast (I_xI_y) &amp;amp; W \ast I_y^2 &amp;amp; W \ast I_yI_z \\ &#xA;W \ast (I_xI_z) &amp;amp; W \ast I_yI_z &amp;amp; W \ast I_z^2 \\ &#xA;\end{pmatrix}$$&#xA;where W is a smoothing kernel, $\ \ast $ denotes convolution and subscript denotes partial derivative with respect to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The calculation of the structure tensor have two main steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;calculate the partial derivatives of the function in a way that is&#xA;robust to noise over a window. &lt;/li&gt;&#xA;&lt;li&gt;smooth products of the partial&#xA;derivatives over another larger window.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I start by looking at step 2.&#xA;I want to use a Gaussian as smoothing kernel. The normal distribution in 3 dimensions is separable:&#xA;$$ g(x,y,z) = g(x)g(y)g(z) $$&#xA;where&#xA;$$ g(x) = \frac{1}{\sqrt{2\pi}\sigma}exp(-\frac{1}{2}(x/\sigma)^2) $$&#xA;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of the normal distribution in 3 dimensions is given by:&#xA;$$ G(kx,ky,kz) = G(kx)G(ky)G(kz) $$&#xA;where&#xA;$$ G(kx) = \frac{\sigma}{\sqrt{2\pi}}exp(-\frac{1}{2}(kx\sigma)^2) $$&#xA;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I implement the Gaussian smoothing?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest way to implement the Gaussian smoothing would be to loop over a 3D Gaussian kernel for each point in I.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the Gaussian is separable however it should be more efficent to perform a convolution with a 1D Gaussian in the x direction followed by the y direction and z direction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another even more efficient approach (?) would be to do the convolution in the Fourier space (where it becomes a multiplication):&#xA;$$ g*a=\mathcal{F}^{-1}[GA] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I look at step 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The derivative of the Gaussian is given by:&#xA;$$ G_x(x) = -x/\sigma^2G(x)G(y)G(z)$$&#xA;etc., where subscript denotes partial derivative with respect to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Gaussian derivative can be used to estimate the partial derivatives of I in a way that is robust to noise:&#xA;$$ I_x=-x/\sigma^2G(x)*G(y)*G(z)*I $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I am faced with the same decision:&#xA;implement it without using separability,&#xA;implement it using separability or implement it in Fourier space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Any advice or comments?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="128" LastEditDate="2019-06-24T16:41:56.330" LastActivityDate="2019-06-24T16:41:56.330" Title="Implement the 3D Structure Tensor in C/C++?" Tags="|image-processing|computer-vision|convolution|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3075" PostTypeId="1" CreationDate="2012-08-08T22:44:53.640" Score="3" ViewCount="606" Body="&lt;p&gt;I'm making a &lt;a href=&quot;https://en.wikipedia.org/wiki/Laser_harp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laser Harp&lt;/a&gt;.&#xA;The application needs the position of the hand along each of the laser beams to modulate a sound synthesis or modify the properties of a sampled instrument.&#xA;I'm wondering if doing a Color Tracking with OpenCV will do.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Make the beam visible with fog machine.&lt;/li&gt;&#xA;&lt;li&gt;Segmenting the image for each beam.&lt;/li&gt;&#xA;&lt;li&gt;Measure the height of the beam.&lt;/li&gt;&#xA;&lt;li&gt;PROFIT.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Other way can be using an infra-red light sensor like &lt;a href=&quot;http://infusionsystems.com/catalog/product_info.php/products_id/136&quot; rel=&quot;nofollow noreferrer&quot;&gt;Infusion Systems - ReachClose v3.1&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;What method is more accurate and fail-proof?&#xA;Any other ideas?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mediafire.com/?rl279yt3s1nwc11&quot; rel=&quot;nofollow noreferrer&quot;&gt;Diagram&lt;/a&gt;&lt;a href=&quot;http://www.mediafire.com/?rl279yt3s1nwc11&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1788" LastEditorUserId="7092" LastEditDate="2021-02-20T14:25:23.553" LastActivityDate="2021-02-20T14:25:23.553" Title="Color Tracking a Red Laser Height" Tags="|computer-vision|opencv|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="3076" PostTypeId="2" ParentId="2967" CreationDate="2012-08-09T03:48:46.953" Score="1" Body="&lt;p&gt;I have a couple thoughts on your problem:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Regarding the handling of atmospherically-induced biases to the GPS receivers' reported positions, I don't think you need to do anything at all. If there is a truly common bias inherent in both positions, then it will simply cancel when you take the difference of the two positions. Thus, I would just treat each platform independently and subtract the time-aligned positions to yield your displacement vector estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is essentially the technique of &lt;a href=&quot;http://en.wikipedia.org/wiki/Differential_GPS&quot; rel=&quot;nofollow&quot;&gt;differential GPS (DGPS)&lt;/a&gt;, which was used successfully to combat the effects of the US government's policy of &lt;a href=&quot;http://en.wikipedia.org/wiki/Selective_Availability#Selective_availability&quot; rel=&quot;nofollow&quot;&gt;selective availability (SA)&lt;/a&gt; on the publically-available GPS carrier. SA was implemented by pseudorandomly dithering the timebase of the spacecraft; this would result in small position errors reported by GPS receivers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of implementation meant that the SA error was highly correlated with the receiver position, such that two receivers in close proximity would experience approximately the same SA error. In the typical DGPS case, if one receiver's position is known precisely, one can solve for the SA error and resolve the second receiver's absolute position accurately, cancelling out the effects of SA. In 2000, the US government ended the use of selective availability, so this isn't much of an issue any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your case is similar but slightly different, in that you don't know the absolute position of either receiver, but that doesn't seem to be what you care most about. Instead, you only care about the differential displacement between the two. Therefore, you can apply a similar technique; if there is a constant position bias inherent in both, then calculating the difference of the two positions will cancel it out, just as DGPS systems did for SA error.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It's not likely that you can improve the performance of the GPS receivers' reported positions by filtering them further. Dynamics tracking systems are a key part of any GPS receiver, and a lot of work has gone into their development. Especially if the receivers that you are using are of a recent vintage, I would hazard that any additional filtering that you would apply would be superfluous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's not to say that you would never want to process the reported positions further. There are some exceptions to my above statement:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have data from other instruments to fuse with the GPS readings, that can yield a gain. Sensors used for dead reckoning (e.g. gyroscopes or accelerometers) can yield measurements that can help to improve tracking of platform dynamics in periods where the GPS receiver outputs are unreliable or inaccurate. However, in time periods where the receiver measurements are assumed to be accurate, an optimal tracker would rely proportionally more upon the GPS measurements in lieu of the higher-variance dead reckoning sensors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have some specific knowledge of your platform's dynamics that you know the GPS receiver isn't taking into account, then you may be able to obtain some gains. If you can specifically configure your receiver for maritime operation, you may be able to obtain better performance, as its tracker can make certain assumptions about your platform's position (e.g. zero altitude relative to sea level, no vertical velocity or acceleration). Failing that, it's possible that you could take the receivers' position outputs and apply some filtering to improve things, but your results will be very specific to the equipment that you use and whatever processing is applied by their internal trackers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-08-09T03:48:46.953" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3077" PostTypeId="1" AcceptedAnswerId="3078" CreationDate="2012-08-09T04:09:43.303" Score="3" ViewCount="835" Body="&lt;p&gt;I am implementing a BFSK algorithm with frequency hopping on an embedded system and I am using the Goertezel algorithm in my demodulation approach. Basically, I use the goertzel alorithm to determine the powers of the signal at the next expected frequencies for both both bits 0 and 1  and whichever gives a higher power (generally in order of 10000) is the bit received. My implementation of the algorithm in C is as follows : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float goertzel(int numSamples,int TARGET_FREQUENCY,int SAMPLING_RATE, int* modData)&#xA;{&#xA;int k,i;&#xA;float   floatnumSamples;&#xA;float   omega,sine,cosine,coeff,q0,q1,q2,result;&#xA;&#xA;floatnumSamples = (float) numSamples;&#xA;k = (int) (0.5 + ((floatnumSamples * TARGET_FREQUENCY) / SAMPLING_RATE));&#xA;omega = (2.0 * 3.1416 * k) / floatnumSamples;&#xA;sine = sin(omega);&#xA;cosine = cos(omega);&#xA;coeff = 2.0 * cosine;&#xA;&#xA;q0=0;&#xA;q1=0;&#xA;q2=0;&#xA;result=0;&#xA;&#xA;for(i=0; i&amp;lt;numSamples; i++)&#xA;{&#xA;    q0 = coeff * q1 - q2 + modData[i];&#xA;    q2 = q1;&#xA;    q1 = q0;&#xA;}&#xA;&#xA;result = sqrtf(q1 * q1 + q2 * q2 - q1 * q2 * coeff);&#xA;return result;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The data at the receiver end is always in the form of a 32-bit integer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that my received signal is a baseband signal and the band width is spread from -2KHz to 2KHz. Hence half of the hopping frequencies are in the negative side of the spectrum and goertzel algorithm is not working correctly for the negative frequencies. So I tried to use the frequency bins in the next set i.e. at (sampling frequency + hopping frequency), just as in fft. However, my algorithm gives the same output power for both the frequencies, current hopping frequency and (sampling frequency + hopping frequency). &#xA;for example, my sampling frequency is 18000 and the current hopping is -2000. So the power should be higher at -2000Hz and 16000Hz than at 2000Hz, but in my case the power is the same at 2000 and 16000Hz, which defeats the demodulation purpose.&#xA;This is not the case when I use the goertzel algorithm defined in Matlab. The Matlab function gives the powers distinctly for both current hopping frequency and (sampling frequency + hopping frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something that I am missing from my C implementation which can solve this issue? Is there any other method (other than using DFT, I have already tried it) that I can use for the demodulation procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--Anshu&lt;/p&gt;&#xA;" OwnerUserId="1659" LastActivityDate="2012-08-09T06:26:55.370" Title="Demodulation of BFSK signal with frequency hopping using Goertzel Algorithm" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3078" PostTypeId="2" ParentId="3077" CreationDate="2012-08-09T06:26:55.370" Score="4" Body="&lt;p&gt;Guys I am really sorry about this stupid question. Just shifting the center frequency of the spectrum from 0Hz to some higher value ( I used 3000Hz as the center frequency) and then calculating the power using goertzel algorithm at the shifted frequencies, solved the problem. I forgot about the 2-sided nature of the frequency spectrum. &lt;/p&gt;&#xA;" OwnerUserId="1659" LastActivityDate="2012-08-09T06:26:55.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3080" PostTypeId="2" ParentId="3026" CreationDate="2012-08-09T20:43:03.163" Score="16" Body="&lt;p&gt;As pointed out by @JohnRobertson in &lt;a href=&quot;https://dsp.stackexchange.com/questions/3066/bag-of-tricks-for-denoising-signals-while-maintaining-sharp-transitions&quot;&gt;Bag of Tricks for Denoising Signals While Maintaining Sharp Transitions&lt;/a&gt;, Total Variaton (TV) denoising is another good alternative if your signal is piece-wise constant. This may be the case for the accelerometer data, if your signal keeps varying between different plateaux.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a Matlab code that performs TV denoising in such a signal. The code is based on the paper &lt;a href=&quot;http://www.ccom.ucsd.edu/~peg/papers/ALvideopaper.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Augmented Lagrangian Method for Total Variation Video Restoration&lt;/a&gt;. The parameters &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; have to be adjusted according to the noise level and signal characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is the noisy signal and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the signal to be estimated, the function to be minimized is &lt;span class=&quot;math-container&quot;&gt;$\mu\|{x-y}\|^2+\|{Dx}\|_1$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is the finite differences operator.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function denoise()&#xA;&#xA;f = [-1*ones(1000,1);3*ones(100,1);1*ones(500,1);-2*ones(800,1);0*ones(900,1)];&#xA;plot(f);&#xA;axis([1 length(f) -4 4]);&#xA;title('Original');&#xA;g = f + .25*randn(length(f),1);&#xA;figure;&#xA;plot(g,'r');&#xA;title('Noisy');&#xA;axis([1 length(f) -4 4]);&#xA;fc = denoisetv(g,.5);&#xA;figure;&#xA;plot(fc,'g');&#xA;title('De-noised');&#xA;axis([1 length(f) -4 4]);&#xA;&#xA;function f = denoisetv(g,mu)&#xA;I = length(g);&#xA;u = zeros(I,1);&#xA;y = zeros(I,1);&#xA;rho = 10;&#xA;&#xA;eigD = abs(fftn([-1;1],[I 1])).^2;&#xA;for k=1:100&#xA;    f = real(ifft(fft(mu*g+rho*Dt(u)-Dt(y))./(mu+rho*eigD)));&#xA;    v = D(f)+(1/rho)*y;&#xA;    u = max(abs(v)-1/rho,0).*sign(v);&#xA;    y = y - rho*(u-D(f));&#xA;end&#xA;&#xA;function y = D(x)&#xA;y = [diff(x);x(1)-x(end)];&#xA;&#xA;function y = Dt(x)&#xA;y = [x(end)-x(1);-diff(x)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hJMKA.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/NAPSC.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0Pr13.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1769" LastEditorUserId="128" LastEditDate="2019-10-19T20:54:29.303" LastActivityDate="2019-10-19T20:54:29.303" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3081" PostTypeId="2" ParentId="3075" CreationDate="2012-08-09T21:06:08.147" Score="3" Body="&lt;p&gt;I can only say something about the computer vision part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your doing color tracking you have to take different lighting conditions into consideration, although it will be easier with a laser (compared to other things) since it at least have the same color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are to use this device professionally you should have a delay about 20ms else it will be noticeable. This forces you to use a high speed camera of at least 100fps (10ms per frame) to have time for processing and sending the sound through the amplifiers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are only tracking straight lines I would recommend to first filter out everything but the laser-color and then hough transform it to find all straight laser lines. And as a final step implement an ad-hoc method to find where the laser ends shouldn't be that hard. &lt;/p&gt;&#xA;" OwnerUserId="905" LastActivityDate="2012-08-09T21:06:08.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3082" PostTypeId="1" AcceptedAnswerId="3090" CreationDate="2012-08-10T11:49:20.373" Score="6" ViewCount="3489" Body="&lt;p&gt;I am working on a photo stitching application that uses multi-band blending. I need to get rid of unpleasant edges appearing at some places:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/doCqp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the area of overlap (left - new image added to the mosaic, right - current mosaic contaning pixels of new image on background pixels to improve blending, middle - blending mask):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UBeP1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I just compute weighted average between left and right image according to mask, the result is of course OK. However, this would leave a visible seam as two images have usually slightly different exposure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all three images need to be successively blurred to build a Gaussian pyramid - here is how one level of the pyramid looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LW5kx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that the top part of blending mask &quot;touches&quot; the border. The Gaussian blurring filter reflects on image borders and this causes inaccuracy in lower band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I colored the images to make the problem more visible:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ng3mK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure about how to blur the mask so that it would deal with overlap area edges nicely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Few suggestions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;change behavior of the blurring filter (how?)&lt;/li&gt;&#xA;&lt;li&gt;extend area of blending mask so that one part never &quot;touches&quot; the border&lt;/li&gt;&#xA;&lt;li&gt;update weighting masks so that resulting blend mask is more &quot;edge-aware&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any other suggestions/hints?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-08-10T12:59:33.067" LastActivityDate="2015-02-12T16:27:12.073" Title="Blending Artifacts in Photo Stitching" Tags="|image-processing|stitching|photo|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3083" PostTypeId="1" AcceptedAnswerId="3086" CreationDate="2012-08-10T12:26:41.033" Score="4" ViewCount="2764" Body="&lt;p&gt;I am woking on an sound processing application where I have limited processing resources. I need to be able to detect acoustic feedback and then signal that such an event occurred. I am not concerned with the more complex task of feedback cancellation, in which the detection circuit would (presumably) need to output accurate information about the frequency and intensity of the detected feedback. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just need to reliably detect feedback, while rejecting false positives that might come about from 'genuine' harmonic input to the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A time domain solution would be preferable. Can anyone suggest such a solution?&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-08-10T16:42:31.843" Title="Acoustic feedback detection algorithm" Tags="|audio|signal-detection|acoustics|feedback|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3085" PostTypeId="2" ParentId="3062" CreationDate="2012-08-10T16:06:26.630" Score="2" Body="&lt;p&gt;As you have observed, instantaneous signal amplitude is an easy to understand, one-dimensional quantity, whose averaged absolute value is loosely associated with perceived loudness, and which can be easily altered by multiplying your signal by a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency is a very different affair. If we lived in a world where the audio signals were made of sustained pure tones, it would make sense to ask &quot;what is the frequency of this sound?&quot;. But things are more complicated:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Stationary speech or music signals can be described as a sum of pure tones. Thus, it makes more sense to ask &quot;what is the signal amplitude at this particular frequency?&quot;. This is why we look at spectra - graphs showing signal amplitude as a function of frequency. Note that frequency is not the plotted  quantity, it is the $x$ axis!&lt;/li&gt;&#xA;&lt;li&gt;Speech or music signals are not stationary: some components of the signal decay over time or are modulated, some appears... Thus, it makes even more sense to ask &quot;what is the signal amplitude at this particular frequency and particular time frame?&quot;. This is why we commonly see for audio analysis a representation called &quot;spectrogram&quot; - showing the measured signal energy as a function of time and frequency (again, note that frequency is the axis, not the measured quantity).&lt;/li&gt;&#xA;&lt;li&gt;In one of your comments you say &quot;as well as be able to read the frequency data in each sample&quot;. Frequency is a rate of change, and to observe a change, we need a collection of samples - it makes no sense at all to do any frequency analysis on a single sample, and if you use Fourier analysis (which is just one of the ways of estimating a sum of sine waves from a signal), you'll need more and more samples to get a more and more precise resolution on the frequency axis. But remember that sounds change over time, and that performing a Fourier Transform discards timing information (the magnitude spectrum of two simultaneous 100 Hz and 300 Hz tones is the same as the spectrum of a 100 Hz tone followed in time by a 300 Hz tone). Thus, if you care about the temporal position of events, you will need to perform your analysis on slices of the signal, computing a FFT on overlapping blocks of the input signal - this is called the short-term Fourier transform (STFT). You'll have to deal with resolution problems here - the smaller your windows, the more accuracy you have on the time axis, the less accuracy you have on the frequency axis. The bigger the analysis windows, the less accuracy you have on the time axis, the more accuracy you have on the frequency axis. Again, and again, note that frequency is not what you estimate - your STFT is just answering the question &quot;What is the signal energy in this particular frequency range and this particular time frame?&quot;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I hope these will make you realize that there's no such thing as &quot;the frequency&quot; of an audio signal. Frequency is an axis, &quot;where we look at things&quot;, not a measured quantity, &quot;what we measure&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there are some one-dimensional quantities homogeneous to frequencies (and thus expressed in Hz), that can be used to characterize stationary (stable) sounds. For generic audio or music, these quantities will vary over time:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fundamental frequency, is the inverse of the period of the sound. It relates to the perceived musical pitch (note) of the sound. This quantity is undefined for aperiodic sounds. Pitch-shifting algorithms will alter this quantity, to make a recording sound as if it was played/sung higher or lower on the musical scale.&lt;/li&gt;&#xA;&lt;li&gt;Roll-off frequency, is the frequency under which a given fraction (say 95%) of the energy of a sound is contained. This quantity can be affected by low-pass / high-pass filtering, to make a recording sound &quot;brighter&quot; or &quot;duller&quot;. It is one of the many dimensions of the perceived timbre of sound.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Maybe some of these are the quantities you really care about?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One final word about the FFT - it is the hammer in a signal processing version of &quot;if all you have is a hammer, everything looks like a nail&quot;. It is an extremely useful tool, but it is not the best fit for many audio signal processing/analysis problems, and more often than not it is used only as an intermediary processing or computational step. In particular, for some of the questions you might be interested in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Estimating the fundamental frequency might an involve a FFT, but the spectrum is not the right thing to look at, because of the &quot;missing f0&quot; phenomenon (a signal might be perceived as being a 263Hz C3 note, without having energy at this frequency). Don't make the mistake of trying to estimate the musical pitch of a signal by looking at the peak in its spectrum.&lt;/li&gt;&#xA;&lt;li&gt;Computing a FFT, messing with the numbers, and performing the inverse FFT is a poor way of filtering a signal. This should be done with &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_filter&quot; rel=&quot;nofollow&quot;&gt;digital filters&lt;/a&gt;, available in &lt;code&gt;scipy.signal.lfilter&lt;/code&gt;. You'll find formulae to compute IIR filter coefficients for a variety of musically useful second-order filters &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-10T16:06:26.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3086" PostTypeId="2" ParentId="3083" CreationDate="2012-08-10T16:28:39.147" Score="6" Body="&lt;p&gt;I assume here that your device is not in the feedback chain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't afford a FFT or filter-bank decomposition (and then detect over successive frames the FFT bins in which the amplitude gets almost exactly multiplied by the same complex number over successive frames), I would suggest looking at these few parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fit a line to the log of the RMS envelope (computed on 50 or 100ms windows) over the past 2 seconds. Compute the slope, compute the coefficient of correlation. First should be positive, the second should be close to 1 for a feedback build-up, which is exponential.&lt;/li&gt;&#xA;&lt;li&gt;Compute the standard deviation of the zero-crossing intervals. This is a cheap harmonicity measure, and it should go close to zero as a pure tone settles in and overwhelms the signal.&lt;/li&gt;&#xA;&lt;li&gt;% of clipped samples. Seeing clipping is a bad omen - but maybe it's too late for you?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You should get by with a few decision rules based on these criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if your device is in the feedback loop (eg: audio DSP box, hearing aid), things are easier because you can &quot;challenge&quot; what you think is a feedback frequency by inducing a delay in the processing chain, or more subtly an all-pass filter (to delay only the suspicious frequency), and if you notice a change in the frequency of the suspect peak, you get a confirmation that it was induced by feedback rather than coming from the input signal.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-08-10T16:42:31.843" LastActivityDate="2012-08-10T16:42:31.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3087" PostTypeId="2" ParentId="2041" CreationDate="2012-08-11T00:16:26.520" Score="1" Body="&lt;p&gt;The experimental frequency domain data gives you information on the input-output behavior of the system. If the system is assumed to be linear and time-invariant (LTI), this information will be in the form of a transfer function. Given a transfer function, there are infinitely many state-space realizations that yield the same input-output behavior and, thus, are I/O-equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, you may want to take a look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_control&quot; rel=&quot;nofollow&quot;&gt;Adaptive Control&lt;/a&gt; literature.&lt;/p&gt;&#xA;" OwnerUserId="924" LastActivityDate="2012-08-11T00:16:26.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3088" PostTypeId="1" AcceptedAnswerId="3089" CreationDate="2012-08-11T11:04:31.533" Score="7" ViewCount="316" Body="&lt;p&gt;In order to correct gradual changes of intensities in the background of grey-scales images, I have been blurring them and then subtracting the original images from the convolved one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases, I have seen improvement using median blur instead of blur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was therefore wondering if I could go further and use a &lt;strong&gt;filter that convolves a grey-scale image so that each pixel will take the value of the most represented pixel value in the histogram of a rectangular neighbourhood&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know the name of this convolution ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you aware of any implementation in OpenCV ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much,&lt;/p&gt;&#xA;" OwnerUserId="1608" LastActivityDate="2012-08-11T11:44:46.303" Title="Convolution involving turning each pixel value to the most represented pixel value of the neighbourhood" Tags="|image-processing|convolution|software-implementation|opencv|adaptive-algorithms|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3089" PostTypeId="2" ParentId="3088" CreationDate="2012-08-11T11:44:46.303" Score="10" Body="&lt;p&gt;This is a &lt;strong&gt;non-linear filter&lt;/strong&gt;, the operation being performed is not a convolution and cannot be represented by a filter kernel. It is sometimes called a &lt;em&gt;mode filter&lt;/em&gt;, by analogy to the median filter, since the value taken by a pixel is the mode of the distribution of the neighboring values. OpenCV does median filtering (cvSmooth with CV_MEDIAN parameter), I don't think it does mode filtering though.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-11T11:44:46.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3090" PostTypeId="2" ParentId="3082" CreationDate="2012-08-11T23:43:17.657" Score="4" Body="&lt;p&gt;I have solved this problem by adding certain padding to overlap area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are pixels belonging to image1, image2, background and overlap. A pixels in overlap are successively relabeled to either image1 or image2 depending on neighborhood.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This padding will make some space for the blurring so that sharp edges of the overlap have no change of appearing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another treat is photometric calibration, i.e. gain compensation and vignetting removal. This minimizes or even eliminates the differences in low frequency band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the blurring have to avoid background pixels (usually black) from &lt;em&gt;bleeding&lt;/em&gt; into the image. This can be done by alpha blending or using binary mask as &lt;a href=&quot;https://dsp.stackexchange.com/questions/6362/blurring-non-uniform-areas&quot;&gt;described here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also possible to reduce amount of blurring near edges and corners of the overlap. This, unfortunately, reduces performance of the blending algorithm and the results are somewhat uncontrolled (as the blurring is non-uniform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, a gradient domain blending improves the quality near edges as it does not rely on Gaussian blurs of fixed sizes.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-02-12T16:27:12.073" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3091" PostTypeId="1" AcceptedAnswerId="3095" CreationDate="2012-08-11T23:44:32.763" Score="9" ViewCount="7291" Body="&lt;p&gt;I've put together a multi-band audio EQ using biquad filters.  I'm getting the coefficients using the methods from &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the RBJ cookbook&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now I want to plot the curve showing the magnitude response.  I'm using an equation from &lt;a href=&quot;http://rs-met.com/documents/dsp/BasicDigitalFilters.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this source&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is my function to get the coefficients and get the magnitude response at points of interest.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;void GetCoefficients (double samplerate = 44100.0) {&#xA;&#xA;    //from the rbj biquad coefficient cookbook by Robert Bristow-Johnson&#xA;    long double SR = (long double)samplerate;&#xA;    long double A = powl(10.0L, dBGain/40.0L);&#xA;    long double W0 = 2.0L * PI * Center / SR;&#xA;    long double alpha = sinl(W0)*sinhl( LN2/2.0L * WidthInOctaves * W0/sinl(W0));&#xA;&#xA;    if (Type == &amp;quot;peaking&amp;quot;) {&#xA;        b0 = 1.0L + alpha * A;&#xA;        b1 = -2.0L * cosl(W0);&#xA;        b2 = 1.0L - alpha * A;&#xA;        a0 = 1.0L + alpha / A;&#xA;        a1 = -2.0L * cosl(W0);&#xA;        a2 = 1.0L - alpha / A;&#xA;    }&#xA;    &#xA;    long double w;&#xA;    long double numerator;&#xA;    long double denominator;&#xA;    long double magnitude;&#xA;&#xA;    for (int i = 0; i &amp;lt; 59; ++ i) {&#xA;        w = 2.0L*PI*FreqPoints[i] / SR;  &#xA;        numerator = b0*b0 + b1*b1 + b2*b2 + 2.0L*(b0*b1 + b1*b2)*cosl(w) + 2.0L*b0*b2*cosl(2.0L*w);&#xA;        denominator = 1.0L + a1*a1 + a2*a2 + 2.0L*(a1 + a1*a2)*cosl(w) + 2.0L*a2*cosl(2.0L*w);&#xA;        magnitude = sqrtl(numerator / denominator);&#xA;        FrequencyResponse[i] = magnitude;   &#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My filters sound correct, but my plot seams way wrong.  For example, when I have calculated the coefficients for a peaking filter with a width of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; octaves, centered at &lt;span class=&quot;math-container&quot;&gt;$4398\textrm{ Hz}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$3\textrm{ dB}$&lt;/span&gt; gain; my magnitude response using those coefficients at &lt;span class=&quot;math-container&quot;&gt;$349\textrm{ Hz}$&lt;/span&gt; is about &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I must be doing something wrong, but I can't quite figure it out.&lt;/p&gt;&#xA;" OwnerUserId="1255" LastEditorUserId="4346" LastEditDate="2021-11-27T22:56:50.903" LastActivityDate="2022-05-31T19:25:22.987" Title="Plotting the magnitude response of a biquad filter" Tags="|filters|audio|frequency-response|biquad|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3092" PostTypeId="2" ParentId="3049" CreationDate="2012-08-12T15:43:13.683" Score="1" Body="&lt;p&gt;This was an interesting thread.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's interesting to note that if you use an FIR filter, having the spikes at the beginning and end of its impulse response, to filter an audio signal, there will be a faint (low-level) 'click' at the beginning and end of your filtered audio signal.  Some people can hear, and are bothered by, those clicks. &lt;/p&gt;&#xA;" OwnerUserId="1800" LastActivityDate="2012-08-12T15:43:13.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3094" PostTypeId="2" ParentId="2914" CreationDate="2012-08-12T16:49:30.087" Score="10" Body="&lt;p&gt;The Hilbert transform does &lt;em&gt;NOT&lt;/em&gt; calculate an analytic signal.  If we have a real-valued sequence $x(n)$, and the Hilbert transform of $x(n)$ is $x_H(n)$, the analytic signal, $a(n)$, associated with $x(n)$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(n) = x(n) + jx_H(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computing the magnitude of $a(n)$ will give you the instantaneous envelope of the original $x(n)$ sequence.  This works great for AM demodulation.  If you compute the instantaneous phase of $a(n)$ to get $\phi(n)$, and compute the time derivative of $\phi(n)$, you have FM demodulation. &lt;/p&gt;&#xA;" OwnerUserId="1800" LastEditorUserId="293" LastEditDate="2012-08-13T13:36:27.810" LastActivityDate="2012-08-13T13:36:27.810" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3095" PostTypeId="2" ParentId="3091" CreationDate="2012-08-12T19:13:24.500" Score="5" Body="&lt;p&gt;Someone over at the KRV forum pointed out that I need to normalize my coefficients so that a0 = 1.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;b0 /= a0;&#xA;b1 /= a0;&#xA;b2 /= a0;&#xA;a1 /= a0;&#xA;a2 /= a0;&#xA;a0 = 1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1255" LastEditorUserId="1255" LastEditDate="2022-05-31T19:25:22.987" LastActivityDate="2022-05-31T19:25:22.987" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3097" PostTypeId="1" CreationDate="2012-08-13T15:58:43.900" Score="2" ViewCount="563" Body="&lt;p&gt;I am measuring position and velocity, both have some noise in them. Velocity is defined as derivative of position. The system is apparently non-linear so I need to use EKF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Model:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;X&amp;amp;=\begin{bmatrix}p\\v\end{bmatrix}\\&#xA;p_{k+1}&amp;amp;=A_0\sin\left(b_0k\right)+A_1\sin\left(b_1k\right)+A_2\sin\left(b_2k\right)\\&#xA;v_{k+1}&amp;amp;=A_0b_0\cos\left(b_0k\right)+A_1b_1\cos\left(b_1k\right)+A_2b_2\cos\left(b_2k\right)\\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I suppose this is a non-linear system. Am I right?&lt;/li&gt;&#xA;&lt;li&gt;If yes, I should use Extended Kalman filter. But how do I get $f$ and $h$ functions for my case (below)? The current state doesn't depend on previous state; except the $k$ (step) variable.&#xA;\begin{align}&#xA;x_k&amp;amp;=f\left(x_{k-1}\right)+w_k\\&#xA;z_k&amp;amp;=h\left(x_k\right)+v_k&#xA;\end{align}&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1798" LastEditorUserId="1629" LastEditDate="2016-05-31T10:22:05.583" LastActivityDate="2016-05-31T10:22:05.583" Title="Extended Kalman Filter - how do I get transition functions" Tags="|kalman-filters|tracking|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3098" PostTypeId="1" CreationDate="2012-08-13T16:55:40.633" Score="10" ViewCount="196" Body="&lt;p&gt;[ Cross-posted from: &lt;a href=&quot;https://math.stackexchange.com/questions/164169/estimating-the-input-to-a-system-from-a-system-state&quot;&gt;https://math.stackexchange.com/questions/164169/estimating-the-input-to-a-system-from-a-system-state&lt;/a&gt; ]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a system for which I have obtained a non-linear time-varying state-space representation. For this system I am able to measure one of the states. I would like to estimate the input from this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my parameter estimation notes I have found a scribbled aside &quot;[the extended Kalman Filter] can be used to estimate the system input if the output is known&quot;. So far I've not found any references or sections in my notes that describe the use of the EKF in this way. Can anyone please suggest a reference (or provide) an explanation of how to perform this task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system is:&#xA;$$x(t)=&#xA;\begin{bmatrix}&#xA;x_1(t)\\&#xA;x_2(t)&#xA;\end{bmatrix}; \quad \dot{x}(t)=&#xA;\begin{bmatrix}&#xA;x_2(t) \\&#xA;\alpha(t) x^2_2(t) + \beta(t) + \gamma(t) u_1(t)&#xA;\end{bmatrix}; \quad y=x_2(t)&#xA;$$&#xA;Where: $\alpha(t)$ and $\gamma(t)$ are constant parameters; $\beta(t)$ is a time-varying parameter; $y=x_2(t)$ is a known (measured) time-varying state; and $u(t)$ is the unknown system input. I have made a simplifying assumption that $\beta(t)$ is constant &lt;strong&gt;initially&lt;/strong&gt;. After proving against this simplified system I want to move to a system where:&#xA;$$x(t)=&#xA;\begin{bmatrix}&#xA;x_1(t)\\&#xA;x_2(t)&#xA;\end{bmatrix}; \quad u(t)=&#xA;\begin{bmatrix}&#xA;u_1(t)\\&#xA;u_2(t)&#xA;\end{bmatrix}; &#xA;\quad y=x_2(t)\\&#xA;\quad \dot{x}(t)=&#xA;\begin{bmatrix}&#xA;x_2(t) \\&#xA;\alpha(t) x^2_2(t) + \beta(t) + \gamma(t) u_1(t)&#xA;\end{bmatrix}; \quad \beta(t) = f(u_2(t))&#xA;$$&#xA;Where: $u_1(t)$ is the unknown system input ($u(t)$ in part 1); $u_2(t)$ and $f(u_2(t))$ are a known input and a known function.  If someone can point me at a reference for the first part (constant $\beta(t)$) or give a brief explanation of how to approach this then I hope to be able to work to a solution for the second part.&lt;/p&gt;&#xA;" OwnerUserId="1809" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2012-08-13T16:55:40.633" Title="Estimating the input to a system from a system state using EKF" Tags="|kalman-filters|system-identification|control-systems|state-space|" AnswerCount="0" CommentCount="4" ClosedDate="2015-12-03T16:26:57.600" ContentLicense="CC BY-SA 3.0" />
  <row Id="3099" PostTypeId="1" CreationDate="2012-08-14T01:14:53.757" Score="2" ViewCount="1867" Body="&lt;p&gt;I asked this at Stack Overflow, they told me to come here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, please excuse my ignorance in this field, I'm a programmer by trade but have been stuck in a situation a little beyond my expertise (in math and signals processing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Matlab script that I need to port to a C++ program (without compiling the matlab code into a DLL). It uses the hilbert() function with one argument. I'm trying to find a way to implement the same thing in C++ (i.e. have a function that also takes only one argument, and returns the same values).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read up on ways of using FFT and IFFT to build it, but can't seem to get anything as simple as the Matlab version. The main thing is that I need it to work on a 128*2000 matrix, and nothing I've found in my search has showed me how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be OK with either a complex value returned, or just the absolute value. The simpler it is to integrate into the code, the better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1811" LastActivityDate="2016-07-23T20:16:11.477" Title="Matlab Hilbert Transform in C++" Tags="|matlab|hilbert-transform|" AnswerCount="1" CommentCount="0" ClosedDate="2016-07-23T20:57:23.810" ContentLicense="CC BY-SA 3.0" />
  <row Id="3100" PostTypeId="2" ParentId="1021" CreationDate="2012-08-14T05:09:50.720" Score="2" Body="&lt;p&gt;What you are doing here is phase modulation. This is how 'FM' synths like the Yamaha DX-7 operate. Often synth oscillators are tuned on a musical scale, not a straight linear Hz scale. So modulating the pitch directly results in an unwanted pitch shift, that's why phase modulation is more suitable.&#xA; You can modulate any wave shape, however the more complex shapes will alias more readily. Even a modulated sin can alias though, so it's not forbidden.&lt;/p&gt;&#xA;" OwnerUserId="1812" LastActivityDate="2012-08-14T05:09:50.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3101" PostTypeId="2" ParentId="2896" CreationDate="2012-08-14T05:19:24.910" Score="5" Body="&lt;p&gt;It's a bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;M_PI*config-&gt;count++&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are processing 2 channels, but incrementing your modulation in the inner loop. So at the end of processing 1 channel, you &lt;em&gt;continue&lt;/em&gt; to increment the modulation as you process the second channel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c1 [ 1,2,3,4]         [9,10,11,12]...&#xA;c2           [5,6,7,8]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The modulation has a discontinuity, i.e in my simplifies example - c1 modulation jumps from '4' to '9'. resulting in zipper noise. Hope that makes sense.&lt;/p&gt;&#xA;" OwnerUserId="1812" LastEditorUserId="1812" LastEditDate="2012-08-14T05:24:28.040" LastActivityDate="2012-08-14T05:24:28.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3103" PostTypeId="1" CreationDate="2012-08-14T06:50:08.527" Score="6" ViewCount="160" Body="&lt;p&gt;I need some face similarity metric.&#xA;I know about PCA,LDA approaches that uses raw pixels data, but they are not scale invariant(I know that I can resize image but I think that's not good solution).&#xA;Maybe I need to use AAM,ASM aproaches?&#xA;But I'm interested in metric that gives me the greatest separability of faces.&#xA;At first I don't need automatic detection of metric features, for example imagine that I can mark all faces by hand.&lt;/p&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="26" LastEditDate="2012-08-14T08:55:26.513" LastActivityDate="2012-08-14T19:56:09.320" Title="scale invariant face similarity metric" Tags="|image-processing|computer-vision|face-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3106" PostTypeId="1" AcceptedAnswerId="3129" CreationDate="2012-08-14T09:53:22.907" Score="0" ViewCount="3414" Body="&lt;p&gt;I'm playing with the built in OpenNI access within OpenCV 2.4.0 and I'm trying to measure the distance between two points in the depth map. I've tried this so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;opencv2/core/core.hpp&quot;&#xA;#include &quot;opencv2/highgui/highgui.hpp&quot;&#xA;#include &quot;opencv2/imgproc/imgproc.hpp&quot;&#xA;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;&#xA;using namespace cv;&#xA;using namespace std;&#xA;&#xA;Point startPt(0,0);&#xA;Point endPt(0,0);&#xA;&#xA;void onMouse( int event, int x, int y, int flags, void* )&#xA;{&#xA;    if( event == CV_EVENT_LBUTTONUP) startPt = Point(x,y);&#xA;    if( event == CV_EVENT_RBUTTONUP) endPt   = Point(x,y);&#xA;}&#xA;&#xA;int main( int argc, char* argv[] ){&#xA;    VideoCapture capture;&#xA;    capture.open(CV_CAP_OPENNI);&#xA;    //capture.set( CV_CAP_PROP_OPENNI_REGISTRATION , 0);&#xA;    unsigned t0=clock();&#xA;    if( !capture.isOpened() ){&#xA;        cout &amp;lt;&amp;lt; &quot;Can not open a capture object.&quot; &amp;lt;&amp;lt; endl;&#xA;        return -1;&#xA;    }&#xA;    unsigned elapsed=clock()-t0;&#xA;    cout &amp;lt;&amp;lt; &quot;initialized in &quot;&amp;lt;&amp;lt; elapsed &amp;lt;&amp;lt;&quot; s. ready!&quot; &amp;lt;&amp;lt; endl;&#xA;    namedWindow( &quot;depth&quot;, 1 );&#xA;    setMouseCallback( &quot;depth&quot;, onMouse, 0 );&#xA;    for(;;){&#xA;        Mat depthMap;&#xA;        if( !capture.grab() ){&#xA;            cout &amp;lt;&amp;lt; &quot;Can not grab images.&quot; &amp;lt;&amp;lt; endl;&#xA;            return -1;&#xA;        }else{&#xA;            Mat show,real,valid;&#xA;            if( capture.retrieve( depthMap, CV_CAP_OPENNI_DEPTH_MAP ) ){&#xA;                depthMap.convertTo( show, CV_8UC1, 0.05f);&#xA;            }&#xA;            capture.retrieve(valid,CV_CAP_OPENNI_VALID_DEPTH_MASK);&#xA;            if( capture.retrieve(real, CV_CAP_OPENNI_POINT_CLOUD_MAP)){&#xA;                unsigned int sp = valid.at&amp;lt;unsigned char&amp;gt;(startPt.x, startPt.y);&#xA;                unsigned int ep = valid.at&amp;lt;unsigned char&amp;gt;(endPt.x, endPt.y);&#xA;                if(sp == 255 &amp;amp;&amp;amp; ep == 255){&#xA;                    Vec3f s = real.at&amp;lt;Vec3f&amp;gt;(startPt.x, startPt.y);&#xA;                    Vec3f e = real.at&amp;lt;Vec3f&amp;gt;(endPt.x, endPt.y);&#xA;                    float dx = e[0]-s[0];&#xA;                    float dy = e[1]-s[1];&#xA;                    float dz = e[2]-s[2];&#xA;                    float dist = sqrt(dx*dx + dy*dy + dz*dz);&#xA;                    putText(show,format(&quot;distance: %f m\n&quot;,dist),Point(10,10),FONT_HERSHEY_PLAIN,1,Scalar(255));&#xA;                }&#xA;            }&#xA;            circle(show,startPt,3,Scalar(255),3);&#xA;            circle(show,endPt,3,Scalar(192),3);&#xA;            line(show,startPt,endPt,Scalar(128));&#xA;            imshow(&quot;depth&quot;,show);&#xA;        }&#xA;        if( waitKey( 30 ) &amp;gt;= 0 )    break;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I have a few issues:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Unless I check for values in the valid depth mask first the program&#xA;crashes sometimes (I imagine due to bad data)&lt;/li&gt;&#xA;&lt;li&gt;As far as I understand the point cloud map returns XYZ data in meters (CV_32FC3), but the numbers I see on screen look wrong.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Am I retrieving the xyz values and doing the distance calculations correctly ? What am I missing out ?&lt;/p&gt;&#xA;" OwnerUserId="640" LastActivityDate="2014-05-10T23:27:51.323" Title="Measuring with OpenCV and OpenNI" Tags="|opencv|distance-metrics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3107" PostTypeId="1" AcceptedAnswerId="3110" CreationDate="2012-08-14T09:54:51.237" Score="-1" ViewCount="335" Body="&lt;p&gt;I want to detect textures on images, for example after proccessing on image must be shown areas of each texture and area where is no texture.And I want to compute &quot;mean&quot; texture of selected area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;how can I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;yes, I know that I can use some corelation technic with some small patches or just split whole image in some small areas(for example with superpixel) and computes some descriptor of area and then cluster them.But I think problem is that texture patch may be different in size.And task seems computional huge,maybe there is some faster FFT approach? And is there any method to determine is area texture or not?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://masters.donntu.edu.ua/2006/kita/varshavskaya/library/art07.htm&quot; rel=&quot;nofollow&quot;&gt;http://masters.donntu.edu.ua/2006/kita/varshavskaya/library/art07.htm&lt;/a&gt;&#xA;I found an article about.But still loking for more examples.&lt;/p&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="1781" LastEditDate="2012-08-16T12:41:56.593" LastActivityDate="2012-08-16T12:41:56.593" Title="finding textures on images" Tags="|computer-vision|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3108" PostTypeId="1" CreationDate="2012-08-14T12:28:38.713" Score="2" ViewCount="1755" Body="&lt;p&gt;I am implementing a BFSK frequency hopping system with TX and Rx modules. I am using Goertzel Algorithm at the receiver end to demodulate the data i.e. to determine the carrier frequency of the recevied signal data. Following is the implementation of the goertzel implementation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float goertzel(int numSamples,int TARGET_FREQUENCY,int SAMPLING_RATE, float* modData)&#xA;{&#xA;int k,i;&#xA;float   floatnumSamples;&#xA;float   omega,sine,cosine,coeff,q0,q1,q2,result;&#xA;&#xA;floatnumSamples = (float) numSamples;&#xA;k = (int) (0.5 + ((floatnumSamples * TARGET_FREQUENCY) / SAMPLING_RATE));&#xA;omega = (2.0 * 3.1416 * k) / floatnumSamples;&#xA;sine = sin(omega);&#xA;cosine = cos(omega);&#xA;coeff = 2.0 * cosine;&#xA;&#xA;q0=0;&#xA;q1=0;&#xA;q2=0;&#xA;result=0;&#xA;&#xA;for(i=0; i&amp;lt;numSamples; i++)&#xA;{&#xA;    q0 = coeff * q1 - q2 + modData[i];&#xA;    q2 = q1;&#xA;    q1 = q0;&#xA;}&#xA;&#xA;result = sqrtf(q1 * q1 + q2 * q2 - q1 * q2 * coeff);&#xA;return result;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The implementation works well for a signal where the received signal is a real signal ( a set of float values). Would this algorithm still work for complex signals. The complex signal would be typically be represented by a set of float values, with each alternate element representing a real and imaginary value. In this case, how should the above goertzel function be used, should it be used to calculate the output for the real and imaginary components separately, or should it read the entire complex signal array elements in a sequence (both real and imaginary array elements) and then  calculate the magnitude at the end of it. If not, can some please point me to how to get the goertzel output for a complex signal samples. I tried googling it but could not find anything concrete about how to use goertzel algorithm on complex signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I wanted to ask one more thing. If my signal has carrier frequencies at both 4000 and -4000 Hz and a sampling frequency of 18000 Hz, then for a real signal as input, the goertzel output is the same for input frequency of 4000 Hz and 14000Hz (this is what should be). But since 4000 Hz and -4000Hz are one of my carrier frequencies, I am not able to determine whether the received signal is at 4000 Hz or -4000 Hz. Is there any method to do this without doing a frequency shift. I am able to differentiate using frequency shifting (multiplying the received signal with a sine wave before demodulating). But I am looking for a method to do this without using the frequency shift technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--Anshu  &lt;/p&gt;&#xA;" OwnerUserId="1659" LastActivityDate="2012-08-16T12:31:20.207" Title="DFT of complex signal using Goertzel algorithm in C" Tags="|frequency-spectrum|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3109" PostTypeId="1" AcceptedAnswerId="3142" CreationDate="2012-08-14T12:27:30.653" Score="0" ViewCount="460" Body="&lt;p&gt;I tried to use bessel filter from &lt;a href=&quot;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;,&#xA;but in the case of a large dataset, I have overshoot.  Since I know a bessel filter shouldn't have overshoot, is this code wrong or am I doing something else wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Sample rate : 1e9&#xA;// Cut off Frequency : 50e6&#xA;&#xA;int s=50000;&#xA;double[] sample = new double[s];&#xA;&#xA;for(int i=s/2; i&amp;lt;s; i++) {&#xA;  sample[i] = 1.0;&#xA;}&#xA;&#xA;for (int i = 0; i&amp;lt;sample.length; i++) {&#xA;    xv[0] = xv[1];&#xA;    xv[1] = xv[2];&#xA;    xv[2] = xv[3]; &#xA;    xv[3] = sample[i] / GAIN;&#xA;    yv[0] = yv[1]; &#xA;    yv[1] = yv[2]; &#xA;    yv[2] = yv[3]; &#xA;    yv[3] = (xv[0] + xv[3]) + 3 * (xv[1] + xv[2])&#xA;          + (  0.3402988787 * yv[0]) &#xA;          + ( -1.4152725242 * yv[1])&#xA;          + (  2.0223552191 * yv[2]);&#xA;    filteredValue[i] = yv[3];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All coefficients have been calculated based on source on given website, it might been messy because its used for chebyshev and butterworth filters as well.&lt;/p&gt;&#xA;" OwnerUserId="1818" OwnerDisplayName="user902383" LastEditorUserId="25707" LastEditDate="2017-02-13T10:29:33.607" LastActivityDate="2017-02-13T10:29:33.607" Title="Is possible to get overshoot on bessel filter?" Tags="|filters|software-implementation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3110" PostTypeId="2" ParentId="3107" CreationDate="2012-08-14T15:30:59.470" Score="2" Body="&lt;p&gt;One way to do that is to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Template_matching&quot; rel=&quot;nofollow&quot;&gt;template matching&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The template matching can work based on image data - i.e. compute correlation between sample texture patch and the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way is to use feature-based method, which is useful in case the texture is geometrically distorted. This method requires extracting features from sample texture patch and from image and assign a descriptor vector to each feature. The two sets of features are then matched using their descriptors in a nearest-neighbor fashion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet another approach can be active contours or graphcut based methods, but I am afraid these require some initialization, like marking of the texture areas to fill them up.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-08-14T15:30:59.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3112" PostTypeId="1" AcceptedAnswerId="3116" CreationDate="2012-08-14T17:59:19.163" Score="3" ViewCount="5893" Body="&lt;p&gt;Wondering if someone could offer me any advice or help. Sorry if this question is too broad or anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wanting to complete an algorithm in basic Speech analysis. The algorithm will detect whether an inputted sample is either saying yes, or, saying no. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that this has already been done, and I got my inspiration for this project from someone who has completed it using Zero-Crossing and in MatLab. His algorithm was as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Divide the sound wave into evenly spaced blocks&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Process each block for important characteristics, such as strength across various frequency ranges, number of zero crossings, and total energy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using this charateristic vector, attempt to associate each block with a phone, which is the most basic unit of speech, producing a string of phones.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the word whose model is the most likely match to the string of phones which was produced.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now this algorithm / approach seems idealistic. But, the first point kind of confuses me. Ok, if my data sample is 4410 then how could I possibly split that into equal size blocks? For example, if the data size was 262144 then I know that multiples of 2 goes into it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second question is I want to use a FFT/linear predictive coding over zero-crossing but the FFT algorithm is really complicated to implement, so, would it be better to use a already built library? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My last question is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you think this project is possible, and, in under a year? I'm not completing it in MatLab, but, in C++. Also, will the above algorithm produce the results that I need? Any help would be really appreciated. &lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2012-08-14T21:24:54.210" Title="Speech Recognition - Project Idea" Tags="|fft|algorithms|speech|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3113" PostTypeId="2" ParentId="3112" CreationDate="2012-08-14T18:45:28.560" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Ok, if my data sample is 4410 then how could I possibly split that into equal size blocks?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I wouldn't get too fixated on that.  You could just break it up into chunks of size $N$, and then have an odd-sized block at the end that is whatever is left over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not a speech processing expert by any means, but this doesn't seem like the best way to go about it.  Like you said, the core of the speech recognition is the phones, and it doesn't seem likely to me that breaking the signal into fixed blocks is a particularly good way to recognize the phones.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The second question is I want to use a FFT/linear predictive coding over zero-crossing but the FFT algorithm is really complicated to implement, so, would it be better to use a already built library?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.  Do NOT build your own FFT routines.  There are some very good libraries out there already.  &lt;a href=&quot;http://www.fftw.org/&quot; rel=&quot;nofollow&quot;&gt;FFTW&lt;/a&gt; is a very good and fast library.  There are others that you can find if you google.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Do you think this project is possible, and, in under a year?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You haven't made it very clear what you are trying to accomplish, so that's hard to say.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I can say is that voice recognition is a very hard problem, which is why they have only gotten decent at it fairly recently.  Even now voice recognition software is far from perfect.  Given the questions that you are asking I would say that you do not have the background that you need to succeed at something like this.  I would either use a commercial tool or open-source software for the voice recognition, or study a lot more if you really want to do it yourself.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-08-14T18:45:28.560" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3114" PostTypeId="2" ParentId="3112" CreationDate="2012-08-14T19:50:20.167" Score="3" Body="&lt;p&gt;I completely agree with Jim Clay's answer; Speech Recognition is &lt;em&gt;hard&lt;/em&gt;, and typically requires years of study to do with any kind of accuracy. To guide you toward a more modern approach than that webpage you have listed in your comments, however, the typical method of doing something like this is to transform the chunks of size &lt;code&gt;N&lt;/code&gt; to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel-frequency_cepstrum&quot; rel=&quot;nofollow&quot;&gt;Mel-frequency cepstrum domain&lt;/a&gt; and save the first &lt;code&gt;K&lt;/code&gt; coefficients of the new vector, where &lt;code&gt;K &amp;lt;&amp;lt; N&lt;/code&gt;.  (Example values: &lt;code&gt;N = 512&lt;/code&gt;, &lt;code&gt;K = 14&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then compare the euclidean distance of an &quot;unknown&quot; chunk (Input from a user speaking into a microphone) against your &quot;known&quot; chunks (preprocessed chunks that you know are either &quot;yes&quot; or &quot;no&quot; that you compare against).  This is an example of the &lt;a href=&quot;http://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm&quot; rel=&quot;nofollow&quot;&gt;K-nearest-neighbors algorithm&lt;/a&gt;, however there are many other machine-learning techniques used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you understand everything that has been said in this answer and Jim Clays, I would say that building and implementing a system like this should take less than 3 months. (I taught a class on Signal Processing where my students had to do projects very similar to this, but they were Signal Processing Seniors, and it took them 10 weeks to build systems comparable to this one) If you do not understand everything, you need to read up before tackling something like this.&lt;/p&gt;&#xA;" OwnerUserId="1814" LastActivityDate="2012-08-14T19:50:20.167" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3115" PostTypeId="2" ParentId="3103" CreationDate="2012-08-14T19:56:09.320" Score="4" Body="&lt;p&gt;Haven't used them first hand but I'm pretty sure that [&lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;nofollow&quot;&gt;SIFT&lt;/a&gt;] &quot;Scale Invariant Feature Transform&quot; is scale invariant. And I know that they are used, with great success, in face recognition.&lt;/p&gt;&#xA;" OwnerUserId="905" LastActivityDate="2012-08-14T19:56:09.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3116" PostTypeId="2" ParentId="3112" CreationDate="2012-08-14T21:19:00.863" Score="7" Body="&lt;p&gt;A few notes regarding your approach and detailed questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, it is very common in audio analysis to split the signal to be analyzed into short overlapping windows, because audio signals are not stationary (their characteristics change over time), so they need to be processed on short segments over which they can be considered stationary (many analyses assume stationarity). Typical segment size is in the 5 .. 20 ms range. You'll be left with an odd-size segment at the end, just pad it with zeros and that's it.&lt;/li&gt;&#xA;&lt;li&gt;In speech recognition the most widely features are MFCC. AR coefficients are quite common in older literature too. Zero crossing rate or energy are unlikely to discriminate phonemes in a robust way.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, regarding your project...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, it is not clear if the goal of your project is to arrive at a working system even if you have to reuse existing code for that, or to do it yourself to learn on the road...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to reach the goal without learning anything, there are ready to use speech recognition packages like Sphinx or HTK - the catch is that to understand these tools one actually has to know a lot about speech recognition tech. The setup time (training plans, model topology, grammar) and the concepts can be daunting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An intermediate level would be to use third party code for signal analysis and feature extraction, and then focus on the recognition itself. You'll find C/C++ MFCC or AR modeling code in audio feature extraction packages like &lt;a href=&quot;http://yaafe.sourceforge.net/&quot;&gt;YAAFE&lt;/a&gt; or &lt;a href=&quot;http://aubio.org/&quot;&gt;Aubio&lt;/a&gt;. You can also use the feature extraction command line utility of HTK (HCopy with the right config file for extraction + HList to get a clear text file).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When designing a speech recognition system, you have to ask yourself these questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the vocabulary size (from discriminating 2 words to recognizing natural language)?&lt;/li&gt;&#xA;&lt;li&gt;What is the speaker variability (will I have to recognize from the same speaker again and again, or will I have to deal with many different speakers)?&lt;/li&gt;&#xA;&lt;li&gt;What kind of training data will I have, in particular, is it possible to collect labelled speech samples from the same voice as the one you'll have to recognize?&lt;/li&gt;&#xA;&lt;li&gt;What are the conditions (clear recordings... or voice through a glitchy mobile phone with background street noises)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You have only answered the first question. If the answer to the other ones are these ideal conditions: the system will only deal with one speaker + will have a corpus of a few recordings of yes/no uttered by this same speaker + there will be no background noise ; the problem is not that hard. And these ideals conditions are not that unrealistic - there are some voice control PC applications which require this kind of prior training, the user needs to pronounce a few occurrences of each command word.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In these ideal conditions, a rustic approach (early 80s tech), but which will work, is &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_time_warping&quot;&gt;DTW&lt;/a&gt;. Extract from each utterance in the training corpus (which will be labelled either &quot;yes&quot; or &quot;no&quot;) a sequence of feature vectors, and compute the DTW distance between the utterance you need to recognize and those in the training corpus. Use this distance metric and a &quot;k-nearest neighbour&quot; scheme to decide on the label. DTW is archaic compared to a proper acoustic model + word model + language model graph, but for a very simple vocabulary (just a handful of words) it does the job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you want something speaker independent (which will work for many speakers, including those for which we don't have a template), you'll have three plans. One is to stay with the same approach and record utterances from a very diverse set of speakers in terms of gender, accent, hoping that it will cover enough ground. But DTW scales very poorly! Another is to use an adaptation scheme - find the transform of your feature vectors that minimize the sum of DTW distance (or the minimum DTW distance) between your utterance and the database (paradoxically, I'm sure you'll find more literature about adaptation in the context of classic HMM-based recognition instead of DTW). The last approach is to forego DTW and do the real thing (phone-level GMM + word + language model).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I won't be as negative as the other members. I used to give a very similar project (digit recognition) to students which had no prior experience with audio (but a semester of signal processing and prior experience with Matlab + some background literature before starting the project), and they completed it in Matlab in two or three 3 hours lab sessions (roughly one for MFCC computation, one for DTW, one for the whole corpus management and k-NN + evaluation routines) with about 100 lines of code in total - so this is not an unimaginable engineering feat requiring a full team of PhDs...&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-08-14T21:24:54.210" LastActivityDate="2012-08-14T21:24:54.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3117" PostTypeId="2" ParentId="3066" CreationDate="2012-08-14T21:23:42.103" Score="7" Body="&lt;p&gt;You can consider anisotropic diffusion. There are many methods based on this technique. Generally spoken, it is for images. It is an adaptive denoising method which aims to smooth non-edge parts of an image, and preserve edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, for Total variation minimization, you can use &lt;a href=&quot;http://eeweb.poly.edu/iselesni/teaching/lecture_notes/TV_filtering.pdf&quot;&gt;this tutorial&lt;/a&gt;. Authors provide MATLAB code also. They recognize the problem as an analysis prior problem, it is somehow similar to using a linear mapping (such as time-frequency representations). But, they use a difference matrix rather than a transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just another interesting approach is provided by Boyd, appears as &lt;a href=&quot;http://www.stanford.edu/~boyd/l1_tf/&quot;&gt;Trend Filtering&lt;/a&gt;. This is also very similar to the TV regularization, but I guess Boyd use a different $D$ matrix in the problem formulation.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2012-08-14T21:40:26.403" LastActivityDate="2012-08-14T21:40:26.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3118" PostTypeId="1" CreationDate="2012-08-15T02:21:45.743" Score="6" ViewCount="1230" Body="&lt;p&gt;I am looking for an algorithm to measure attenuation of a discrete signal $s[t]$.  Starting at the beginning of the signal sequence, is it possible to compute either sliding DFT or Gabor transform windows and use the amplitude and phase information to compute an attenuation coefficient?  Is a reference available for such an algorithm?  I am wondering if similar algorithms have been applied in music DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a separate attenuation coefficient computed for both the real and complex parts of the frequency-domain signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some further details:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For each window, I want to compute attenuation of the signal.  So for every $\tau$, where $\tau$ is the center of the window, I get an estimate of attenuation over the width of the window.  As the window moves over the signal $s[t]$, I get an estimate of attenuation $\alpha[\tau]$ as a function of the window center.&lt;/li&gt;&#xA;&lt;li&gt;Sliding DFT is used for computational efficiency (&lt;a href=&quot;http://www.comm.utoronto.ca/~dimitris/ece431/slidingdft.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;), and I think that there may also be other benefits to using the sliding DFT as well. Should I apply a Blackman/Hanning window in the time domain?  Or perhaps the Gabor transform would suffice.&lt;/li&gt;&#xA;&lt;li&gt;$s[t]$ is considered to contain a single signal of interest.&lt;/li&gt;&#xA;&lt;li&gt;The attenuation coefficient can be expressed with a real part and a complex part, and can be reported in units of dB.  Here is an equation:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$A = A_0 \exp[\frac{{ - \omega \tau }}{{2\alpha }}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A$ is the amplitude and phase at a time $\tau_k$, and $A_0$ is some reference amplitude and phase, $\alpha$ is the attenuation coefficient, $\tau$ is the time at the window center, and $\omega$ is angular frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I define the reference amplitude and phase $A_0$?  Maybe $A_0$ would be defined at the beginning of the signal.  Or maybe $A_0$ would be defined at the beginning of each window?   In addition, how do I deal with spikes in the signal spectrum?  Maybe some sort of smoothing algorithm would be beneficial here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, maybe the attenuation could be determined using a signal envelope detector?  How might I set this up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this problem might be associated with separating two signals that have been added together.  We don't know the reference amplitude $A_0$ and it might change over time.  Take:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A[\tau, \omega] = A_0[\tau, \omega]\exp[\frac{{ - \omega \tau }}{{2\alpha }}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\log(A[\tau, \omega]) = \log(A_0[\tau, \omega]) + [\frac{{ - \omega \tau }}{{2\alpha }}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some assumptions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$A_0[\tau, \omega]$ is unknown, but it can be assumed as being&#xA;uncorrelated with $[\frac{{ - \omega \tau }}{{2\alpha }}]$.  The bandwidth of $A_0[\tau, \omega]$ is different than the bandwidth of  $[\frac{{ - \omega \tau }}{{2\alpha }}]$.  (I think this is reasonable.)  The bandwidth of the $[\frac{{ - \omega \tau }}{{2\alpha }}]$ expression is known. &lt;/li&gt;&#xA;&lt;li&gt;$\alpha$ is constant for each $\tau$. &lt;/li&gt;&#xA;&lt;li&gt;$A[\tau, \omega]$ is computed using the Short Time Fourier Transform or Gabor transform.&lt;/li&gt;&#xA;&lt;li&gt;The envelopes of $A[\tau, \omega]$ and $A_0[\tau, \omega]$ are not constant.  However, $\exp[\frac{{ - \omega \tau }}{{2\alpha }}]$ is just an equation. So can I treat $A_0$ as simply being &quot;noise&quot; or something else? &lt;/li&gt;&#xA;&lt;li&gt;$A_0[\tau, \omega]$ and $A[\tau, \omega]$ are complex. The attenuation $\alpha$ is a real number.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Can someone help me set up the math (i.e. matrix equation?) or point me in the right direction to a class of algorithms?  &lt;em&gt;I think this problem is very similar to separation of two signals.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Perhaps this can be done using a Kalman filter, where $\log(A_0[\tau, \omega])$ is treated as &quot;noise&quot; and  the $[\frac{{ - \omega \tau }}{{2\alpha }}]$ term is treated as the signal.  Is this reasonable, and is there a good reference available on the implementation of this filter?  Perhaps another filter would be more appropriate?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the operation would be a graph of attenuation with respect to time, as I have drawn below.  I also show the Gabor transform operation with the addition of two signals.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/pVN4Z.png&quot; alt=&quot;Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To explore this problem more, I've selected a test signal and written a program to forward filter the test signal using a kernel that simulates the attenuation I want to determine.  I work with sonar and acoustic sensing systems, so selecting this signal demonstrates what I am working with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot of the test signal in the time domain.  This is a signal with &lt;strong&gt;no attenuation&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dDCRY.png&quot; alt=&quot;Test signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Gabor transform (spectrogram) of the signal with &lt;strong&gt;no attenuation&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CYPVg.png&quot; alt=&quot;No attenuation spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot of the test signal after I've applied a filter to simulate attenuation.  This is a signal &lt;strong&gt;with constant attenuation, such that $\alpha(\tau) = 55$&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pYtAb.png&quot; alt=&quot;Signal with attenuation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Gabor transform (spectrogram) of the signal &lt;strong&gt;with attenuation&lt;/strong&gt;.  Notice how there is an exponential decay in the spectrogram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/io3oq.png&quot; alt=&quot;Signal with attenuation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the absolute value of the forward filter kernel, the exponential decay is very apparent.  Notice how some frequencies are decayed more than others.  The forward filter kernel has a real and a complex part. The plot below is simply the absolute value of the forward filter kernel.  The higher the numerical value of the filter kernel (approaching 1.0), the less attenuation.  The lower the numerical value of the filter kernel (approaching 0), the more attenuation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xfWOF.png&quot; alt=&quot;Forward filter kernel&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the mathematical form of the filter kernel $k(\tau, \omega)$ that has been applied by multiplication with the original Gabor-transformed signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$k(\tau ,\omega ) = \frac{1}{{\Lambda (\tau ,\omega )}}\exp \left[ {i\int\limits_0^\tau  {{{\left( {\frac{\omega }{{{\omega _h}}}} \right)}^{\frac{1}{{\pi \alpha (\tau ')}}}}\omega d\tau '} } \right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Lambda (\tau ,\omega ) = \frac{{\beta (\tau ,\omega ) + {\sigma ^2}}}{{{\beta ^2}(\tau ,\omega ) + {\sigma ^2}}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\beta (\tau ,\omega ) = \exp \left[ { - \int\limits_0^\tau  {\frac{\omega }{{2\alpha (\tau ')}}{{\left( {\frac{\omega }{{{\omega _h}}}} \right)}^{\frac{{ - 1}}{{\pi \alpha (\tau ')}}}}d\tau '} } \right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, $\omega, \omega_h, \sigma, \tau$ are all known, and for simplicity I have set the attenuation $\alpha(\tau) = 55$ across the entire signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I would like to find the attenuation $\alpha(\tau)$ as a function of time $\tau$, but $\alpha(\tau)$ does not have to be constant, and can change over $\tau$.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I think that the filter kernel is &quot;smooth,&quot; whereas the original signal is not.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to determine attenuation $\alpha(\tau)$, even in a non-exact way?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I repeat the same experiment for an $\alpha(\tau)$ that changes over time. This is a model of what I would expect $\alpha(\tau, \omega)$ to be (but the curve could also be linear with a negative slope, or something else entirely):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vyaVO.png&quot; alt=&quot;Alpha changes&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sake of exposition, here is the original (non-filtered) trace again.   This is a signal with &lt;strong&gt;no attenuation&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OEQ91.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/85gmV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a signal &lt;strong&gt;with attenuation&lt;/strong&gt;, where $\alpha(\tau)$ changes over time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EGdr5.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iRK9u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the absolute value of the filter kernel where $\alpha(\tau)$ changes over time.  Note that the exponential decay is still present here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Mxotp.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Another perspective&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I realize that the forward filter in the Gabor transform domain is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A(\tau, \omega) = A_0(\tau, \omega)k(\tau, \omega)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the attenuated trace is  $A(\tau, \omega)$, and $A_0(\tau, \omega)$ is the non-attenuated trace, and $k(\tau, \omega)$ is the filter kernel.  Given $A(\tau, \omega)$, but not $A_0(\tau, \omega)$, I would like to estimate $\alpha(\tau)$, the attenuation function over time.  In this case, I know the numerical form of the filter kernel $k(\tau, \omega)$, but I do not know $\alpha(\tau)$.  This is why I wonder if Kalman filtering would be beneficial to use in this type of problem.  Perhaps $A_0(\tau, \omega)$ could be treated as noise uncorrelated with the kernel $k(\tau, \omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the attenuated spectrograms, I am reminded of image &quot;de-blurring&quot; algorithms.  Since the kernel is &quot;smooth&quot; and the original signal $A_0(\tau, \omega)$ is not, it might be possible to somehow separate the $A_0(\tau, \omega)$ from the kernel $k(\tau,\omega)$ using some sort of algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I can separate the $A_0(\tau, \omega)$ from the kernel $k(\tau,\omega)$, then I think that can estimate $\alpha(\tau)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a spectrogram of actual data.  The datasets above were synthetic, whereas this spectrogram was collected from an actual experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZMEk2.png&quot; alt=&quot;Actual data&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-08-17T01:17:25.080" LastActivityDate="2012-08-17T01:17:25.080" Title="Estimating attenuation using sliding windows" Tags="|algorithms|attenuation|" AnswerCount="1" CommentCount="6" CommunityOwnedDate="2012-08-16T18:39:28.153" ContentLicense="CC BY-SA 3.0" />
  <row Id="3119" PostTypeId="1" AcceptedAnswerId="3120" CreationDate="2012-08-15T09:07:44.963" Score="7" ViewCount="5014" Body="&lt;p&gt;Say there are 3 people in the room. Each of them have a unique voice timbre. I want to recognize people by their timbre and know who's speaking.&lt;/p&gt;&#xA;" OwnerUserId="1817" LastActivityDate="2012-08-15T09:28:37.143" Title="Library to differentiate people by their voice timbre" Tags="|audio|voice|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3120" PostTypeId="2" ParentId="3119" CreationDate="2012-08-15T09:28:37.143" Score="12" Body="&lt;p&gt;The task of taking a long contiguous audio recording and splitting it up in chunks in which only one speaker is speaking - without any prior knowledge about the voice characteristics of each speaker - is called &quot;Speaker diarization&quot;. You can find links to research code on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Speaker_diarisation&quot;&gt;wikipedia page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have prior recordings of each voice, and would rather do classification, this is a slightly different problem (Speaker recognition or Speaker identification). Software tools for that are available &lt;a href=&quot;http://mistral.univ-avignon.fr/&quot;&gt;here&lt;/a&gt; (note that general purposes speech recognition packages like Sphinx or HTK are flexible enough to be coaxed into doing that).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-15T09:28:37.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3123" PostTypeId="1" CreationDate="2012-08-15T12:33:15.100" Score="2" ViewCount="6216" Body="&lt;p&gt;I've posted the same question on stackoverflow.com with little success, so I thought I would try here!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using C++/C to perform forwards and reverse FFT on some data which is supposed to be the pulsed output of a laser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to take the output, use a forward FFT to convert to the frequency domain, apply a linear best fit to the phase ( first unwrapping it) and then subtracting this best fit from the phase information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting phase and amplitude are then converted back to the time domain, with the ultimate aim being the compression of the pulses through phase compensation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've attempted to do this in MATLAB unsuccesfully, and have turned to C++ as a result. The forwards FFT is working fine, I took the basic recipe from Numerical recipes in C++, and used a function to modify it for complex inputs as following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void fft(Complex* DataIn, Complex* DataOut, int fftSize, int InverseTransform, int fftShift)&#xA;{&#xA;&#xA;        double* Data  = new double[2*fftSize+3];&#xA;        Data[0] == 0.0;&#xA;&#xA;&#xA;        for(int i=0; i&amp;lt;fftSize; i++)&#xA;        {&#xA;                Data[i*2+1]  = real(DataIn[i]);&#xA;                Data[i*2+2]  = imag(DataIn[i]);&#xA;        }&#xA;&#xA;        fft_basic(Data, fftSize, InverseTransform);&#xA;&#xA;        for(int i=0; i&amp;lt;fftSize; i++)&#xA;        {&#xA;                DataOut[i] = Complex(Data[2*i+1], Data[2*i+2]);&#xA;        }&#xA;&#xA;        //Swap the fft halfes&#xA;        if(fftShift==1)&#xA;        {&#xA;                Complex* temp = new Complex[fftSize];&#xA;                for(int i=0; i&amp;lt;fftSize/2; i++)&#xA;                {&#xA;                        temp[i+fftSize/2] = DataOut[i];&#xA;                }&#xA;                for(int i=fftSize/2; i&amp;lt;fftSize; i++)&#xA;                {&#xA;                        temp[i-fftSize/2] = DataOut[i];&#xA;                }&#xA;                for(int i=0; i&amp;lt;fftSize; i++)&#xA;                {&#xA;                        DataOut[i] = temp[i];&#xA;                }&#xA;                delete[] temp;&#xA;        }&#xA;        delete[] Data;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with the function &lt;code&gt;ftt_basic()&lt;/code&gt; taken from 'Numerical recipes C++'. The input variable &lt;code&gt;InverseTransform&lt;/code&gt; is simply the direction of the FFT: forward or reverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is that the form of input seems to affect the output of the Reverse FFT. This could be a precision issue, but I've looked around and it doesn't seem to have affected anyone else before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feeding the output of the forwards FFT directly back into the reverse FFT yields pulses identical to the intput.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However taking the power output taken as&lt;code&gt;real^2+imag^2&lt;/code&gt; of the forwards FFT and copying it to an array such that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Reverse_fft_input[i]=complex(real(forwardsoutput[i]),imag(forwardsoutput[i]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then using this as the input for the reverse FFT yields regular coupled pulses, with the wrong amplitude and periodicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally, taking the output of the forwards FFT and copying such that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Reverse_fft_input[i]=complex( Amplitude[i]*cos(phase[i]), Amplitude[i]*sin(phase[i]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the &lt;code&gt;Amplitude[i]=(real^2+imag^2)^0.5&lt;/code&gt; and &lt;code&gt;phase[i]=atan(imag/real)&lt;/code&gt; yields a really mess output in the time domain, with a peak towards the middle, resembling the power spectrum in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is it the precision of the cos and sin functions which cause the output of the reverse fft to become like this? All variables are stored as type 'double'. Why is it that there is such a massive a difference between the different methods of inputting the complex data, and why is it that only when the data is directly fed back into the reverse FFT that the data in the time domain is identical to the original input into the forwads FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;( I would have posted pictures but unfortunately I can't do that yet...)&lt;/p&gt;&#xA;" OwnerUserId="1813" LastActivityDate="2019-12-06T20:51:03.577" Title="Using FFT to convert to frequency domain, then IFFT back to time domain C++" Tags="|fft|c|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3125" PostTypeId="1" CreationDate="2012-08-15T22:01:35.537" Score="0" ViewCount="1245" Body="&lt;p&gt;Basically, (I know I've asked a simular question, but I have been away and really thought about it this time)!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me try and explain this in the best way possible:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I'm attempting to create an algorithm that takes a voice sample (.wav)&#xA;of someone saying either &quot;Yes&quot;, or &quot;No&quot;.  Now, in order to do this I am attempting to split the sample into equal blocks in order to get the Phones. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I have thought about this.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't need to technically analise all of Phones, I can identify if the the sample is either &quot;Yes&quot; or &quot;No&quot; by just looking for a &quot;Y&quot; Phone. Because if a &quot;Y&quot; doesn't exist then the sample is &quot;No&quot;. So, I can handle this by implementing a decision tree. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so to my question. I know that this can be achieved using Zero-Crossing, but, I don't have any experience in this (Ok, people are going to tell me to stop doing it then) but, we all had to learn somewhere, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone could possibly link me to a website or a book where I can learn about the Zero-crossing method? Then it would be great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main thing I don't understand about it is, how can Zero-crossing determine whether the Phone is a &quot;Y&quot;? Or, will I need to have some samples of &quot;Y&quot; in order to match through Correlation?, or something. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope someone can advise me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2018-01-29T00:02:20.537" Title="Speech Analysis - Zero-Crossing" Tags="|speech|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3126" PostTypeId="1" AcceptedAnswerId="3131" CreationDate="2012-08-16T06:43:41.910" Score="13" ViewCount="21645" Body="&lt;p&gt;I'm learning Kalman Filter for a week now. I just discovered that EKF (extended Kalman Filter) might be more appropriate for my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Le't suppose I'm applying KF/EKF for variometer (the device that tells planes and parachuters what's their vertical position and velocity). In my case I've generated some sample data: the first few seconds he (the parachuter for e.g.) is falling (the velocity is positive) then he is rising (velocity is negative).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell this system is linear. So should I use KF or EKF? &lt;/p&gt;&#xA;" OwnerUserId="1798" LastActivityDate="2015-12-16T05:30:29.563" Title="When to use EKF and when Kalman Filter?" Tags="|kalman-filters|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3127" PostTypeId="2" ParentId="3125" CreationDate="2012-08-16T07:51:43.393" Score="4" Body="&lt;p&gt;Zero-crossing rate (ZCR) might be useful for voiced/unvoiced frame discrimination, speech/music discrimination, but it is of much lesser importance in speech recognition. One reason is that it is pitch-dependent and not robust to background noise or hum. It is not difficult to craft very different signals (say a female voice saying a phone and a male voice saying another phone) that have the exact same ZCR; or to add some noise to a signal in a way that will half or double its ZCR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using zero-crossing rate might work in the single-speaker + prior training case. Collect a handful of samples of each words, compute the zero crossing rate, and train a naive bayesian classifier for this two-class problem. Be prepared to poor performances, and don't expect your system to generalize to other speakers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only plausible reason one would use such a feature would be on embedded systems with very limited computational power. Otherwise, there's no reason not to use &quot;proven&quot; features like MFCC or AR coefficients.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-16T07:51:43.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3128" PostTypeId="2" ParentId="3118" CreationDate="2012-08-16T08:11:36.037" Score="3" Body="&lt;p&gt;From your question and comments, it looks like what you want to extract is the envelope of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few things are still not clear:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do you have any prior knowledge about the shape of this envelope (looks like it might be an exponential in your case)?&lt;/li&gt;&#xA;&lt;li&gt;What is the signal &quot;attenuated&quot; by this envelope. Something complex like music? A pure sine-wave?&lt;/li&gt;&#xA;&lt;li&gt;What are the relative &quot;scale&quot; of the signals. Is the carrier period several orders of magnitude lower than the constant time of the envelope? Or just one order of magnitude lower?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some leads:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;As @JasonR recommended, Compute signal power (or maximum absolute value) over sliding, overlapping, windows of N samples, where N is an order of magnitude greater than the period of your signal. If necessary, low-pass filter. If your goal is to get a single time constant (assuming exponential decay), take the log of the values and fit to a straight line.&lt;/li&gt;&#xA;&lt;li&gt;Demodulation techniques. Take the absolute value of your signal and low-pass filter - optionally after band-pass filtering to select a frequency band of interest. Exactly how AM radio works! This works well when the envelope is relatively slow (several orders of magnitudes) compared with the carrier.&lt;/li&gt;&#xA;&lt;li&gt;Parametric techniques. If your signal takes the form $\Re (\alpha z^n)$ (exponential damped sine wave) or $\Re(\sum_p \alpha_p z_p^n)$ (sum of exponentially damped sine waves) plus some white noise, where $\alpha$ is a complex number carrying the phase/amplitude information and $z$ a complex number carrying the sine wave period/exponential decay constant information, there are parametric techniques (ESPRIT, MUSIC) to get least square estimates of $z$. These techniques are particularly efficient when it comes to discriminating components in sums of signals. If you have a 100 Hz tone with a 1s exponential decay, and a 101 Hz tone with a 1.5s exponential decay added together, you'll recover these parameters provided noise is low-enough (while a naive DFT would have a hard time discriminating the two nearby sine waves). The downside is that your signal must conform to the chosen model for this to work.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-08-16T08:17:49.697" LastActivityDate="2012-08-16T08:17:49.697" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="3129" PostTypeId="2" ParentId="3106" CreationDate="2012-08-16T09:20:21.370" Score="1" Body="&lt;p&gt;Coordinates should be passed in y,x order, not x,y.&#xA;Full updated code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;opencv2/core/core.hpp&quot;&#xA;#include &quot;opencv2/highgui/highgui.hpp&quot;&#xA;#include &quot;opencv2/imgproc/imgproc.hpp&quot;&#xA;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;&#xA;using namespace cv;&#xA;using namespace std;&#xA;&#xA;Mat world;&#xA;Point startPt(0,0);&#xA;Point endPt(0,0);&#xA;float dist;&#xA;&#xA;void onMouse( int event, int x, int y, int flags, void* )&#xA;{&#xA;    if( event == CV_EVENT_LBUTTONUP) startPt = Point(x,y);&#xA;    if( event == CV_EVENT_RBUTTONUP) {&#xA;        endPt   = Point(x,y);&#xA;        Vec3f s = world.at&amp;lt;Vec3f&amp;gt;(startPt.y, startPt.x);&#xA;        Vec3f e = world.at&amp;lt;Vec3f&amp;gt;(endPt.y, endPt.x);&#xA;        float dx = e[0]-s[0];&#xA;        float dy = e[1]-s[1];&#xA;        float dz = e[2]-s[2];&#xA;        dist = sqrt(dx*dx + dy*dy + dz*dz);&#xA;    }&#xA;}&#xA;&#xA;int main( /*int argc, char* argv[]*/ ){&#xA;    VideoCapture capture;&#xA;    capture.open(CV_CAP_OPENNI);&#xA;    capture.set( CV_CAP_PROP_OPENNI_REGISTRATION , 0);&#xA;    unsigned t0=clock();&#xA;    if( !capture.isOpened() ){&#xA;        cout &amp;lt;&amp;lt; &quot;Can not open a capture object.&quot; &amp;lt;&amp;lt; endl;&#xA;        return -1;&#xA;    }&#xA;    unsigned elapsed=clock()-t0;&#xA;    cout &amp;lt;&amp;lt; &quot;initialized in &quot;&amp;lt;&amp;lt; elapsed &amp;lt;&amp;lt;&quot; s. ready!&quot; &amp;lt;&amp;lt; endl;&#xA;    namedWindow( &quot;depth&quot;, 1 );&#xA;    setMouseCallback( &quot;depth&quot;, onMouse, 0 );&#xA;    for(;;){&#xA;        if( !capture.grab() ){&#xA;            cout &amp;lt;&amp;lt; &quot;Can not grab images.&quot; &amp;lt;&amp;lt; endl;&#xA;            return -1;&#xA;        }else{&#xA;            Mat depthMap,show;&#xA;            capture.retrieve(world, CV_CAP_OPENNI_POINT_CLOUD_MAP);&#xA;            if( capture.retrieve( depthMap, CV_CAP_OPENNI_DEPTH_MAP ) ) depthMap.convertTo( show, CV_8UC1, 0.05f);&#xA;            line(show,startPt,endPt,Scalar(255));&#xA;            putText(show,format(&quot;distance: %f m&quot;,dist),Point(5,15),FONT_HERSHEY_PLAIN,1,Scalar(255));&#xA;            imshow(&quot;depth&quot;,show);&#xA;        }&#xA;        if( waitKey( 30 ) &amp;gt;= 0 )    break;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="640" LastActivityDate="2012-08-16T09:20:21.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3131" PostTypeId="2" ParentId="3126" CreationDate="2012-08-16T12:30:23.250" Score="16" Body="&lt;p&gt;The answer is simple: if your system is linear, then a (regular) &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot;&gt;Kalman filter&lt;/a&gt; will do just fine. A very brief summary of the differences between the two:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Extended_Kalman_Filter&quot;&gt;extended Kalman filter (EKF)&lt;/a&gt; is an extension that can be applied to nonlinear systems. The requirement of linear equations for the measurement and state-transition models is relaxed; instead, the models can be nonlinear and need only be differentiable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The EKF works by transforming the nonlinear models at each time step into linearized systems of equations. In a single-variable model, you would do this using the current model value and its derivative; the generalization for multiple variables and equations is the Jacobian matrix. The linearized equations are then used in a similar manner to the standard Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As in many cases where you approximate a nonlinear system with a linear model, there are cases where the EKF will not perform well. If you have a bad initial guess of the underlying system's state, then you could get garbage out. In contrast to the standard Kalman filter for linear systems, the EKF is not proven to be optimal in any sense; it's merely an extension of the linear-system technique to a wider class of problems.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-08-16T12:30:23.250" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3132" PostTypeId="2" ParentId="3108" CreationDate="2012-08-16T12:31:20.207" Score="4" Body="&lt;p&gt;The Goertzel algorithm (which is really just an efficient way of calculating what amounts to a single DFT bin at an arbitrary location) is defined for complex input, just like the DFT. A real input signal is really just a special case where the imaginary part is equal to zero. As far as your last question is concerned, if your input signal is real, then its spectrum is conjugate symmetric. That means that the spectrum value at -4000 Hz is the conjugate of the value at +4000 Hz. If you want to differentiate between the two frequencies, you'll need a complex input signal.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-08-16T12:31:20.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3134" PostTypeId="5" CreationDate="2012-08-16T13:31:37.067" Score="0" Body="&lt;p&gt;This tag covers signal processing where input is an image, such as a photograph or video frame and the output could be an improved or altered image, parameters related to the image or information about features within the image.&lt;/p&gt;&#xA;" OwnerUserId="1822" LastEditorUserId="1822" LastEditDate="2012-08-16T14:23:19.753" LastActivityDate="2012-08-16T14:23:19.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3135" PostTypeId="4" CreationDate="2012-08-16T13:31:37.067" Score="0" Body="This tag covers signal processing where input is an image, such as a photograph or video frame and the output could be an improved or altered image, parameters related to the image or information about features within the image." OwnerUserId="1822" LastEditorUserId="1822" LastEditDate="2012-08-16T14:23:59.253" LastActivityDate="2012-08-16T14:23:59.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3136" PostTypeId="2" ParentId="3126" CreationDate="2012-08-16T18:07:08.553" Score="5" Body="&lt;p&gt;A quick literature survey tells me that the EKF is commonly used in GPS, location/navigation systems and also in unmanned aerial vehicles.&#xA;[See for instance ``Application of Extended Kalman Filter Towards UAV Identification,'' Abhijit G. Kallapur, Shaaban S. Ali and Sreenatha G. Anavatti, Springer (2007)].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have reason to believe that a linear approximation to the nonlinearity in your system is not too detrimental then EKF may give better results than a KF. But there are no theoretical guarantees of optimality.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastActivityDate="2012-08-16T18:07:08.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3137" PostTypeId="5" CreationDate="2012-08-16T18:31:14.557" Score="0" Body="&lt;p&gt;C is a high level (i.e. not assembler) programming language often used to program DSPs and other embedded microprocessors as well as being used for systems programming. Features of the language make it especially suitable for programming hardware and writing device drivers.&lt;/p&gt;&#xA;" OwnerUserId="1822" LastEditorUserId="1822" LastEditDate="2012-08-16T20:16:20.607" LastActivityDate="2012-08-16T20:16:20.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3138" PostTypeId="4" CreationDate="2012-08-16T18:31:14.557" Score="0" Body="C is a high level (i.e. not assembler) programming language often used to program DSPs and other embedded microprocessors as well as being used for systems programming. Features of the language make it especially suitable for programming hardware and writing device drivers." OwnerUserId="1822" LastEditorUserId="1822" LastEditDate="2012-08-16T20:16:30.140" LastActivityDate="2012-08-16T20:16:30.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3141" PostTypeId="1" AcceptedAnswerId="3148" CreationDate="2012-08-17T08:17:55.407" Score="5" ViewCount="1336" Body="&lt;p&gt;I have large database of pictures, about a few million.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need an algorithm to find pictures which are similar to those in the database, up to a scale factor or a crop and shift (I have only these types of variations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know about &lt;a href=&quot;http://www.sccs.swarthmore.edu/users/01/xianglan/e27/lab2/method1.html&quot; rel=&quot;nofollow&quot;&gt;histogram matching&lt;/a&gt; and &lt;a href=&quot;http://www.phash.org/&quot; rel=&quot;nofollow&quot;&gt;perceptual hash&lt;/a&gt;, but is there a faster algorithm that exist for these purposes?&lt;/p&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="76" LastEditDate="2012-08-21T09:06:41.883" LastActivityDate="2020-09-24T09:17:27.313" Title="Finding similar pictures in a database" Tags="|computer-vision|image-processing|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3142" PostTypeId="2" ParentId="3109" CreationDate="2012-08-17T14:37:14.457" Score="5" Body="&lt;p&gt;It's not exactly clear what you mean by overshoot. Let's define it as &quot;when filtering a square wave, the max of of the the output should not exceed the steady state of max of the square wave&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case your statement &quot;as i know bessel filter shouldnt have overshoot&quot; is wrong. A bessel filter will indeed overshoot. A few first order filters will not overshoot (butterworth, chebychev, ...) but any filter of order &gt; 1 will overshoot.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-08-17T14:37:14.457" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3143" PostTypeId="2" ParentId="3141" CreationDate="2012-08-17T15:47:56.387" Score="1" Body="&lt;p&gt;For this you can use local features like SIFT, SURF, FREAK, etc.  &lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-08-17T15:47:56.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3144" PostTypeId="1" CreationDate="2012-08-17T18:56:59.363" Score="1" ViewCount="92" Body="&lt;p&gt;I was wondering if anyone knew anywhere I can obtain benchmark comparison of various algorithms used for similarity recognition. In my research I found one study from 2008 or so, but misplaced the URL.&lt;/p&gt;&#xA;" OwnerUserId="1827" LastActivityDate="2012-08-17T18:56:59.363" Title="Image Recognition Benchmarks" Tags="|algorithms|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3145" PostTypeId="2" ParentId="3072" CreationDate="2012-08-17T19:21:51.120" Score="1" Body="&lt;p&gt;Assuming this is due to the &quot;&lt;a href=&quot;http://www.cs.sfu.ca/~stella/papers/blairthesis/main/node13.html&quot; rel=&quot;nofollow&quot;&gt;partial volume effect&lt;/a&gt;&quot; (and not because the outer layer of the nodule really is some different material):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you consider a voxel (1mm^3, say) with a bright value of say 200 to be all nodule material, and a voxel with a value of say 100 to be definitely normal tissue, then it seems reasonable to assume that a voxel with a value of 160 is 60% nodule and 40% normal tissue (and so it should contribute 0.6mm^3 to your total).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that assumption is correct (and that's a big if), then it should get you a better measurement of volume than just counting voxels &gt;=200 or &gt;100.&lt;/p&gt;&#xA;" OwnerUserId="1828" LastActivityDate="2012-08-17T19:21:51.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3146" PostTypeId="1" AcceptedAnswerId="3147" CreationDate="2012-08-17T21:43:20.730" Score="2" ViewCount="1544" Body="&lt;p&gt;I have a basic understanding of the acoustic preprocessing involved in speech recognition: divide the speech into frames, find the mel frequency cepstral coefficients of each frame, construct a feature vector from the MFCC's and signal energy, and compare the speech to several &quot;prototype&quot; speech samples to find the closest match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When doing voice recognition (i.e. recognizing &lt;strong&gt;who&lt;/strong&gt; said it, as opposed to &lt;strong&gt;what&lt;/strong&gt; was said), I'm thinking that perhaps a different windowing function is used, or maybe a different type of filter bank is used to transform the spectrum to the mel scale, but I'm not entirely sure--perhaps it is a different process altogether. Does anyone know MFC analysis for speaker recognition differs from the analysis for speech recognition?&lt;/p&gt;&#xA;" OwnerUserId="1746" LastActivityDate="2012-08-17T22:53:45.640" Title="voice recognition vs speech recognition MFCC" Tags="|audio|preprocessing|cepstral-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3147" PostTypeId="2" ParentId="3146" CreationDate="2012-08-17T22:53:45.640" Score="4" Body="&lt;p&gt;This is the exact same extraction procedure. Parameters such as frame rate, number of filter banks, band spacing etc. might vary a bit from one system to another, but this is just a consequence of the tuning procedure (the parameters yielding the best performance are selected), more than a fundamental difference. The &quot;sweet spot&quot; for some parameters such as frame duration is the same for both tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to keep in mind that MFCCs capture an overall timbre parameter which measures both what is said (phones) and the specifics of the speaker voice &amp;amp; gender, and it is hard to factor these two dimensions apart. The MFCC vector of Alice saying &quot;o&quot;, Bob saying &quot;o&quot;, Alice saying &quot;a&quot; and Bob saying &quot;a&quot; are all different - which would make it look that this feature would be hard to use for speech recognition (due to speaker variability) and for voice identification (due to phone variability). There are workarounds, though...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In voice recognition systems, you have to make sure that the training data contains enough occurrences of all phones for each speaker. If you train your Bob voice model on Bob's &quot;o&quot;'s, it won't work when you feed it Bob's &quot;a&quot;'s. Because of that, the training set of MFCC data for a given speaker will have to be by design quite heterogenous - and this is why gaussian mixture models have been so successful at this task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reverse problem appears in speech recognition system: if you train a recognition system trained on Bob's voice, and try to feed it with MFCC data computed on Alice's voice, it will not work. One solution to this problem (vocal tract length normalization) is to find a linear transform of the MFCC vector such that, when applied to Alice's MFCC data, make it similar to what the model has captured.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-17T22:53:45.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3148" PostTypeId="2" ParentId="3141" CreationDate="2012-08-18T01:17:03.413" Score="1" Body="&lt;p&gt;Take a look at &lt;a href=&quot;http://www-i6.informatik.rwth-aachen.de/publications/download/10/DeselaersThomas--FeaturesforImageRetrieval--2003.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;Features for Image Retrieval&quot;&lt;/a&gt; text.&lt;/p&gt;&#xA;" OwnerUserId="1484" LastActivityDate="2012-08-18T01:17:03.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3149" PostTypeId="1" AcceptedAnswerId="3157" CreationDate="2012-08-18T08:05:42.813" Score="5" ViewCount="512" Body="&lt;p&gt;I want to implement an on-the-fly training process for face detection.  I'm not sure but it seems it's called online boosting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Вefore, I have used OpenCV face detection with my own cascades, but I'm interested in technique which can &quot;learn in process&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, If I train a boost classifer with 1000 marked images and then I look at the results on my test set, if I'm satisfied, the algorithm will finish. Otherwise, I will add 100 images more but then not retrain all 1100 images, just add 100 images to existing cascade, is it possible? It's also usefull for training in which can participate many people or computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if I have big in-class difference, for example, frontal faces and rotated faces.  Do I need to train 2 separate classifiers?&lt;/p&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="1781" LastEditDate="2012-08-21T10:08:11.933" LastActivityDate="2012-08-21T10:08:11.933" Title="Online boosting (training on the fly) for face detection" Tags="|computer-vision|opencv|image-processing|face-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3152" PostTypeId="1" AcceptedAnswerId="3155" CreationDate="2012-08-18T09:16:19.863" Score="6" ViewCount="4183" Body="&lt;p&gt;What techniques/algorithms can I use to remove noise from a raw recording of sound (voice)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose is to get a smoother graph (removing the &quot;jaggedness&quot;). What I have tried was to average-out small deviations by using the surrounding two values to either side, but ended up with distorted sound. What better way is there to &quot;smooth-out&quot; the graph?&lt;/p&gt;&#xA;" OwnerUserId="1829" OwnerDisplayName="slashmais" LastEditorUserId="1835" LastEditDate="2012-08-20T01:03:19.637" LastActivityDate="2012-08-20T01:03:19.637" Title="How to de-noise raw sound data" Tags="|noise|sound|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3153" PostTypeId="2" ParentId="3152" CreationDate="2012-08-18T09:49:01.830" Score="2" Body="&lt;p&gt;You should apply a low-pass filter on your signal. Look for such an algorithm. Hope this helps...&#xA;Voice is low frequencies and usually noise is high frequencies. &lt;/p&gt;&#xA;" OwnerDisplayName="Sun Wukong" LastActivityDate="2012-08-18T09:49:01.830" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3155" PostTypeId="2" ParentId="3152" CreationDate="2012-08-18T15:11:04.050" Score="7" Body="&lt;p&gt;For what you intend to do, a low-pass filter is the way to go. Your statement about filtering frequencies vs filtering amplitudes is incorrect. Your signal contains many components at many frequencies, the amplitude of which varies in time, and the high frequency components are those causing the &quot;jaggedness&quot; and you want to get rid of them. Not sure why you say your signal is &quot;constant frequency&quot; - maybe you are getting confused by the sample rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have tried (averaging) is indeed a special case of low-pass filtering, but one with a frequency response far from being ideal. You should try a properly designed IIR or FIR filter. In particular, the FIR filter is not very different from what you tried - this is just a weighted combination of the samples neighboring each sample. But the choice of the coefficients is important and ensures that only unwanted components are eliminated. Note that an FFT is not the way to go. This question crops up here quite frequently under different forms, but in short - FFT, messing with coefficients, IFFT - &lt;a href=&quot;https://dsp.stackexchange.com/questions/724/low-pass-filter-and-fft-for-beginners-with-python&quot;&gt;is a bad idea&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By design, the output of a moving average filter (what you implemented) has less energy than the input. It is thus impossible for a moving average filter to cause distortion. If the input signal is in the [-1, 1] range, there is no way for an averaging filter to yield values outside this range. The &quot;distorted sound&quot; you observed was probably due to an implementation error on your side (overflow / clipping of integer values, signed values treated as unsigned value, or maybe incorrect in-place processing)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: one thing worth mentioning is that there are situations in which a speech signal actually has high frequency components (appears &quot;jagged&quot;, is noisy) - for example during a sss or shhh ; and removing those with a low-pass filter will affect its brilliance. Ideally, you'll want your low-pass filter to be active only when you detect that your speech signal is voiced - and inhibit it when you detect an unvoiced, noisy consonant.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-08-18T15:26:48.250" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3156" PostTypeId="2" ParentId="3152" CreationDate="2012-08-18T20:37:41.957" Score="7" Body="&lt;p&gt;Another interesting audio denoising technique exploits the fact that many sound recordings contain silent time intervals that contain only noise. Such sections can be chopped out of the recording to obtain a noise spectrum and then spectral gating can be applied to suppress noise. Take a look at the following links for detailed discussion on this technique:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise gate: &lt;a href=&quot;http://en.wikipedia.org/wiki/Noise_gate&quot;&gt;http://en.wikipedia.org/wiki/Noise_gate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise removal in Audacity (an open source audio editing tool): &lt;a href=&quot;http://wiki.audacityteam.org/wiki/Noise_Removal&quot;&gt;http://wiki.audacityteam.org/wiki/Noise_Removal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this method rests on the assumption that the ``same noise source'' persists throughout the duration of the audio.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastActivityDate="2012-08-18T20:37:41.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3157" PostTypeId="2" ParentId="3149" CreationDate="2012-08-19T00:24:33.670" Score="4" Body="&lt;p&gt;If you are asking about online learning &lt;strong&gt;using OpenCV's Cascade Classifier&lt;/strong&gt;, I'm pretty sure it is not possible. The reason is that Cascade Classifier consists of number of simpler classifiers which are decision trees in case of OpenCV's face detection system. I don't know exactly, what decision tree algorithm is used, but as far as I know there are no algorithms supporting online learning (such an algorithm would incorporate tree restructuring which is quite inefficient). So, if the base &quot;bricks&quot; do not support online learning, the whole &quot;building&quot; will not support it either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On other hand, if you ask whether it &lt;strong&gt;is possible in general&lt;/strong&gt;, then the answer is &quot;yes&quot;. All you need is to find algorithm that supports online learning (such as artificial neural networks) and adapt the whole face recognition system to support it. You may still use cascade structure and haar-like (or even newer local binary pattern) features, but base classifiers should be replaced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in practise I would say &quot;don't do it&quot;. Or at least search for simpler options. It is quite a lot of work, both - research and development. &lt;/p&gt;&#xA;" OwnerUserId="1351" LastActivityDate="2012-08-19T00:24:33.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3158" PostTypeId="1" AcceptedAnswerId="3159" CreationDate="2012-08-19T16:25:23.610" Score="15" ViewCount="16180" Body="&lt;p&gt;I am trying to transmit binary data from one device to another over an audio channel (speaker/mic). I use AFSK (Audio Frequency Shift Keying) as in Packet Radio, with $1200 \text{ Baud}$ and two frequencies $f_{mark} = 1200 \text{ Hz}$ and $f_{space} = 2200 \text{ Hz}$. I played around a bit in Ruby and my first implementation simply imitates a classic incoherent demodulator, which works fine, so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, i am trying to port this to a mobile platform where performance is a concern and my current solution is too slow. I have found numerous ways to demodulate AFSK in software:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sliding DFT (FFT)&lt;/li&gt;&#xA;&lt;li&gt;Sliding Görtzel Filter&lt;/li&gt;&#xA;&lt;li&gt;Phase Locked Loop&lt;/li&gt;&#xA;&lt;li&gt;Zero Crossing&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What would be the way to go? There are just too many options to choose from. I am sure there are even more options available. Perhaps there exist even better solutions than the ones i named above? Does someone even have a code examples for me? I am concerned with&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Performance (should run on mobile Platform, say an iOS or Android device)&lt;/li&gt;&#xA;&lt;li&gt;Stability (should be able to handle some noise)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any suggestions and hints are greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="1834" LastActivityDate="2012-08-26T06:56:54.373" Title="How to demodulate an AFSK signal in software" Tags="|dft|demodulation|fsk|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3159" PostTypeId="2" ParentId="3158" CreationDate="2012-08-19T20:23:53.757" Score="9" Body="&lt;p&gt;I think that you could get the best performance in terms of demodulator bit-error rate (BER) with a phase-locked loop.  You need it to be fast, though.  I think your best bet for a fast algorithm that still performs reasonably well is zero crossing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a side note, I would like to suggest that you change the 2200 Hz to 2400 Hz.  A naive implementation of the 1200/2200 Hz scheme would yield discontinuities, as seen about two thirds into the plot below, where the 2200 Hz transitions to 1200 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2jVC9.png&quot; alt=&quot;1200 Hz and 2200 Hz&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to minimize the bandwidth that you're using and avoid discontinuities that will distort the signal you'll need to make the phase continuous.  Even if you make the transmitter phase continuous, though, there will still be the issue that the 2200 Hz symbols will not always have the same number of zero crossings due to the different phases.   Usually they will have four zero crossings, but sometimes they will have three.  The 1200 Hz symbols on the other hand, will always have two zero crossings because the baud rate divides evenly into the FSK frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can solve both of these problems by changing the 2200 Hz to 2400 Hz.  Then the symbols will always start and end at 0 degrees (thus automatically making them phase continuous), and they will always have the same number of zero crossings- two and four.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2qiKt.png&quot; alt=&quot;1200 Hz and 2400 Hz&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-08-19T20:23:53.757" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3160" PostTypeId="2" ParentId="3158" CreationDate="2012-08-19T23:12:44.570" Score="5" Body="&lt;p&gt;I made a decoder for AFSK (Bell 202 standard) using correlation receivers for 1200 Hz and 2200 Hz, with very good results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the phase of the signal during a symbol is unknown, a solution is to work in the complex domain: instead of multiplying by real sinusoids, multiply by complex exponentials. This means multiplying by $\sin$ and $\cos$ independently, then integrating each, and calculating the absolute (square) value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting amplitude is quite independent from the signal phase, and the output SNR is very good.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-08-19T23:12:44.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3161" PostTypeId="2" ParentId="3123" CreationDate="2012-08-20T12:56:10.093" Score="4" Body="&lt;p&gt;A couple of things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your Data[] array seems to start at on offset of &quot;1&quot;. That's unusual for C++, where &quot;0&quot; is the first index. Matlab starts at 1. This may be part of the calling convention for fft_basic, but it's a bit strange&lt;/li&gt;&#xA;&lt;li&gt;Doing the inverse Fourier transform of the Power Spectrum (magnitude squared of the forward transform) gives you the auto correlation. That has nothing to do with phase compensation at all. Wrong algorithm.&lt;/li&gt;&#xA;&lt;li&gt;You cannot calculate the phase as atan(imag/real) since you'll get half of the quadrants wrong. The correct functions is atan2(imag, real) which takes into account the relative signs of real and imaginary part.&lt;/li&gt;&#xA;&lt;li&gt;Just adding to the choir: solve it in Matlab first and then port to C++&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-08-20T12:56:10.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3162" PostTypeId="1" AcceptedAnswerId="3163" CreationDate="2012-08-20T19:36:29.753" Score="3" ViewCount="372" Body="&lt;p&gt;I'm trying to determine frequency of a repeating pattern in a time series. The sampling rate 100Hz and the pattern repeats itself with periods between 0.5 second and 1.25 second. This corresponds to a frequency range between 0.8Hz and 2Hz. &lt;strong&gt;At each second&lt;/strong&gt;, I want to find the period of the pattern with &lt;strong&gt;10msec precision&lt;/strong&gt;, i.e. I want to differentiate 0.7sec(1.4Hz) and 0.6sec(1.6Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can attain this goal using &lt;strong&gt;correlation&lt;/strong&gt;: For possible windows lengths (periods) I calculate correlation between two successive windows with same length. The &lt;strong&gt;window length with highest correlation&lt;/strong&gt; gives the period of pattern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I obtain the same results by using FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I see if I use 128-point FFT with this 100Hz series, then it will give me 100/128=0.8Hz (1.25sec), 1.6 Hz (0.62sec), 2.4Hz (0.42 sec),... components which obviously won't meet my requirement of 10msec period precision. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can increase precision by using 256-point FFT but this corresponds to 2.5-second window for 100Hz and I want to determine pattern frequency for each window of ~1second.&lt;/p&gt;&#xA;" OwnerUserId="1837" OwnerDisplayName="paritybit" LastActivityDate="2012-08-20T20:52:53.663" Title="Can FFT Substitute Correlation for This Case?" Tags="|fft|correlation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3163" PostTypeId="2" ParentId="3162" CreationDate="2012-08-20T20:37:47.540" Score="6" Body="&lt;p&gt;How did you plan to use the FFT in the first place?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is to naively look for peaks in the magnitude spectrum and deduce the frequency from it, this is a bad idea. As you have seen, this has a limited resolution in the lowest frequencies. Resolution limitations aside, looking for a peak in the FFT is a poor way of estimating periodicity since the true fundamental frequency might not be the one with the most salient amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can use FFT as an intermediate step to efficiently compute the autocorrelation function (FFT with zero-padding of the input to avoid wrapping -&gt; square of magnitude of coefficients -&gt; IFFT). Looking for peaks in the autocorrelation function is a more reliable period estimator than FFT peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, given your requirements, you could use sliding windows of 256 samples, with a 61% overlap, compute the autocorrelation through the FFT, look for the autocorrelation peak in the [50, 125] samples range and use this as an estimate of the period. Because of the 61% overlap, this will give you one period value per second. Observe here that it is possible to use large analysis windows (256 samples, or more) and make them overlap so that we can still get a detection for every 100 sample. The downside is that if the period of the signal rapidly change, your detection will be &quot;smudged&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see a few other approaches for your problem that do not suffer from any resolution compromise on the temporal axis:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the waveform of your input signal is known (square, sawtooth, sine...), you could try locking an oscillator of similar waveform to it through a PLL, and use the PLL frequency as your estimator.&lt;/li&gt;&#xA;&lt;li&gt;If your signal is purely sinusoidal, you can fit a complex exponential to it (through eigenanalysis of the autocorrelation matrix).&lt;/li&gt;&#xA;&lt;li&gt;An approach that would give a very high resolution (one decision &lt;strong&gt;per sample&lt;/strong&gt;) would be to run your signal through a bank of 75 comb filters in parallel, with delays of 0.5, 0.51, 0.52 .. 1.25 seconds. Compute the energy of the output for each of these 75 signals ; the one with the highest energy gives you the period.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that your problem has very similar requirements to that of tempo detection (onset detection yields an envelope signal at 100 Hz or the likes, we aim to get a tempo map in the 60 BPM - 180 BPM, ie 0.33 - 1Hz range, with a temporal resolution of 1s). Historically, the comb filterbank approach was used ; while most recent solutions are based on autocorrelation or similar autocorrelation-based pitch estimators (yin) ; with analysis windows in the 5 - 10s range.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-08-20T20:52:53.663" LastActivityDate="2012-08-20T20:52:53.663" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3164" PostTypeId="1" AcceptedAnswerId="3186" CreationDate="2012-08-20T21:00:22.773" Score="9" ViewCount="1262" Body="&lt;p&gt;I have implemented a feature detector based on &lt;a href=&quot;http://en.wikipedia.org/wiki/Corner_detection#The_Harris_.26_Stephens_.2F_Plessey_.2F_Shi-Tomasi_corner_detection_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Harris corners&lt;/a&gt;. It works fine most times, but there are cases where it performs poorly. I need to make it work on many different images without configuring it individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is with the detector threshold value. If set too low, the detector fires too many times resulting in huge number of features. If set too high, there are too less features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have partially resolved this by &lt;a href=&quot;http://www.cs.brown.edu/courses/csci1950-g/results/proj6/steveg/theory.html&quot; rel=&quot;noreferrer&quot;&gt;ANMS&lt;/a&gt; (Adaptive Non-Maximal Suppression) to reduce number of features before assigning a descriptor vectors to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, images like this one are the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/trvD6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have low contrast and I cannot &quot;afford&quot; setting threshold too low for all images. It would cause detector to work on these images, but other images would contain hundreths of thousands of features, which will be slow to filter with ANMS and this will harm overall performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking of adjusting the image before feature detection. Maybe histogram equalization would do the job. This may be a valid operation since global change of contrast have no effect on feature descriptors (they are invariant to change in brightness and contrast).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe working with adaptive threshold or some heuristic would work better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other suggestions?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="590" LastEditDate="2012-08-23T12:09:40.760" LastActivityDate="2022-05-30T14:11:49.383" Title="Image Processing Prior to Feature Detection" Tags="|image-processing|local-features|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3165" PostTypeId="2" ParentId="530" CreationDate="2012-08-20T23:54:00.220" Score="4" Body="&lt;p&gt;Photoshop's Bevel and Emboss works predictably:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Compute a distance transform in a temporary 8-bit single channel image&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Chisel uses the Euclidean Distance Transform with a Chamfer metric (3x3, 5x5, or 7x7 depending on size). You can use an exact euclidean distance transform if you'd like, I prefer the one from Meijster since it can be made anti-aliased (&quot;A General Algorithm for Computing Distance Transforms in Linear Time&quot;, MEIJSTER).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Smooth Bevel uses a Chamfer 5-7-11 distance transform followed by two applications of a box blur, to produce the bump map.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;2) Apply bump mapping to the intermediate distance transform image. Blinn's original technique is suitable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) For softening you can perform a convolution on the surface normals or you can filter them using a kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Using the bump map the surface normals are combined with the global light source to compute the lighting intensity as a value from -1 to 1 where negative values are shadows, positive values are highlights, and the absolute value is the magnitude of the light source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Two 8-bit single channel temporary images are calculated, one from the highlight intensities and the other from the shadows. From there it is is trivial matter to use each masks to tint the layer using a colour, blend mode, and opacity - one mask for the highlights and the other for the shadows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Visual Basic source code for implementing some of this can be found here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=51640&amp;amp;lngWId=1&quot; rel=&quot;nofollow&quot;&gt;http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=51640&amp;amp;lngWId=1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please visit my open source LayerEffects project to learn more:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vinniefalco/LayerEffects.git&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vinniefalco/LayerEffects.git&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps someone.&lt;/p&gt;&#xA;" OwnerUserId="1838" LastEditorUserId="1838" LastEditDate="2012-12-26T14:57:24.090" LastActivityDate="2012-12-26T14:57:24.090" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3166" PostTypeId="2" ParentId="227" CreationDate="2012-08-21T13:44:28.053" Score="11" Body="&lt;p&gt;This paper discusses all of the modern exact distance transforms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;2D Euclidean distance transforms: a comparative survey&quot;, ACM Computing Surveys, Vol 40, Issue 1, Feb 2008&#xA;&lt;a href=&quot;http://www.lems.brown.edu/~rfabbri/stuff/fabbri-EDT-survey-ACMCSurvFeb2008.pdf&quot;&gt;http://www.lems.brown.edu/~rfabbri/stuff/fabbri-EDT-survey-ACMCSurvFeb2008.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper cites the technique from Meijster, et. al. as the fastest general purpose, exact transform. This technique is detailed here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;A General Algorithm for Computing Distance Transforms in Linear Time&quot;, A. Meijster, J. B. T. M. Roerdink and W. H. Hesselink.&#xA;&lt;a href=&quot;http://fab.cba.mit.edu/classes/S62.12/docs/Meijster_distance.pdf&quot;&gt;http://fab.cba.mit.edu/classes/S62.12/docs/Meijster_distance.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Meijster algorithm is used in my open source effects library:&#xA;&lt;a href=&quot;https://github.com/vinniefalco/LayerEffects&quot;&gt;https://github.com/vinniefalco/LayerEffects&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps someone.&lt;/p&gt;&#xA;" OwnerUserId="1838" LastActivityDate="2012-08-21T13:44:28.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3167" PostTypeId="1" AcceptedAnswerId="3168" CreationDate="2012-08-21T15:28:09.487" Score="1" ViewCount="569" Body="&lt;p&gt;I am very new to signal processing and my background is in physics.  I would like to know if it is possible to determine the number of parity bits needs to theoretically get 100% transmission from a transmission channel with known percent error.  Over a given transmission 25-30% of the transmission is incorrect.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to know with say a reed-Solomon technique how many paity bits I would need to add to each block to move in the neighborhoos of 100%?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am processing my signal using MATLAB right now...&lt;/p&gt;&#xA;" OwnerUserId="1842" LastActivityDate="2012-08-21T16:29:58.703" Title="determining FEC or parity bits from percent error" Tags="|matlab|noise|channelcoding|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3168" PostTypeId="2" ParentId="3167" CreationDate="2012-08-21T16:19:53.203" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible to know with say a reed-Solomon technique how many paity bits I would need to add to each block to move in the neighborhoos of 100%?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Normally yes, if you know that you will never have more than $e$ bit errors in a block of length $N$, then you could design a RS code that would fix them all.  The problem in your case is that 30% bit errors is a LOT of errors.  Assuming the errors are randomly distributed, no RS code will be able to fix that many errors.  The number of parity symbols you would need would exceed $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The analysis goes as follows- RS codes work on symbols, not bits.  All of the RS codes that I have seen have symbol widths of 6 to 9 bits, with the most common symbol width being 8 (CD's use an 8-bit wide RS code).  At 30% bit errors, well over half of the symbols will have errors.  You need two parity symbols for each error that you want to correct, so when over half of the symbols have errors it is impossible to correct them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may think &quot;why not make the symbols narrower, reducing the chance that they will contain a bit error?&quot;  The problem is that the block length, $N$, is $2^m-1$, where $m$ is the RS symbol width.  If you reduce the symbol width to 1, then your block length is 1 and you can't correct any data.  Thus, no RS code can correct your errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say that your best bet is a low-rate Turbo code, though turbo codes cannot guarantee that they will fix your errors.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-08-21T16:29:58.703" LastActivityDate="2012-08-21T16:29:58.703" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="3169" PostTypeId="2" ParentId="513" CreationDate="2012-08-21T17:37:02.253" Score="4" Body="&lt;p&gt;The Euclidean Distance Transform can produce dilations and erosions with suitable parameters and filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm that Photoshop uses, and the one that is best suited for stroking, is to calculate the Euclidean Distance Transform in integers and without taking the square root (i.e. calculate distance squared). This can be made extremely fast using the technique from Meijster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get anti-aliasing, just use the fractional part of the number after taking the square root.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (distanceSquared &amp;lt; radius * radius)&#xA;{&#xA;  (fill solid pixel)&#xA;}&#xA;else&#xA;{&#xA;   distance = sqrt (distanceSquared);&#xA;&#xA;   if (distance &amp;lt; radius + 1)&#xA;   {&#xA;     alpha = 1 - (distance - radius);&#xA;&#xA;     (blend pixel at alpha)&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This techinque is used in my open source library:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vinniefalco/LayerEffects.git&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vinniefalco/LayerEffects.git&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1838" LastActivityDate="2012-08-21T17:37:02.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3171" PostTypeId="1" AcceptedAnswerId="3173" CreationDate="2012-08-21T20:33:17.833" Score="9" ViewCount="1700" Body="&lt;p&gt;What kind of bit error rate do they get from deep space communications (Pioneer, Voyager, et.al.), and what kind of modulation and FEC allows them to recover messages with that microscopic level of received signal power?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there more modern modulation methods and encoding schemes for similar channel conditions?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-12-22T09:16:01.303" Title="Deep space communications BER and FEC?" Tags="|modulation|forward-error-correction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3172" PostTypeId="2" ParentId="3099" CreationDate="2012-08-21T20:54:13.240" Score="1" Body="&lt;p&gt;If your application can use LGPL open-source code, you could reuse the code for the Remez exchange algorithm in the GNU Octave source.  I've got a standalone library that does that at www.ke5fx.com/dsplib.zip .  See if the function DSP_FIR_PM_Hilbert_transformer_design() does what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FIR filters implemented by my library are one-dimensional affairs, so if you actually need to do a 2D transform, that would be left as an exercise, so to speak.  Contributions back to dsplib are welcome!&lt;/p&gt;&#xA;" OwnerUserId="572" LastActivityDate="2012-08-21T20:54:13.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3173" PostTypeId="2" ParentId="3171" CreationDate="2012-08-21T20:54:59.853" Score="17" Body="&lt;p&gt;For many years the state of the art was to use a convolutional &quot;inner code&quot; and a block &quot;outer code&quot;.  The &quot;inner&quot; and &quot;outer&quot; terminology come from the following block diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\boxed{\scriptstyle \rm Payload}{\longrightarrow}\boxed{\scriptstyle\textrm{Outer Encode}}{\longrightarrow}\boxed{\scriptstyle\textrm{Inner Encode}}{\longrightarrow}\boxed{\scriptstyle\rm Channel}{\longrightarrow}\boxed{\scriptstyle\textrm{Inner Decode}}{\longrightarrow}\boxed{\scriptstyle\textrm{Outer Decode}}{\longrightarrow}\boxed{\scriptstyle\rm Payload}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolutional codes were used as the inner code because they are very powerful and can correct a large number of bit errors.  They have a weakness, though- when there are lots of errors that are close together they can break down and spit out errors in a burst at that location.  The outer code is used to correct those bursts of errors.  Block codes are not as powerful as convolutional codes (do not use as many parity bits/symbols either), but they are good at dealing with bursts of errors.  Also, there was usually a deinterleaver in between the inner and outer codes that spread the bursts of errors among many blocks, making it even easier for the block code to correct them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;http://en.wikipedia.org/wiki/Error_detection_and_correction#Deep-space_telecommunications&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia's Deep Space Telecommunications&lt;/a&gt; section says, early on the inner/outer codes were Viterbi (convolutional) and Reed-Muller codes.  Later they were Viterbi and Reed-Solomon codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the early 90's &lt;a href=&quot;http://en.wikipedia.org/wiki/Turbo_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Turbo codes&lt;/a&gt; were discovered and took the FEC world by storm.  In the 2000's &lt;a href=&quot;http://en.wikipedia.org/wiki/Low-density_parity-check_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;low-density parity check codes&lt;/a&gt; have grown in popularity.  They were discovered in 1960 by Gallagher, but were not feasible to implement until recently because of the computational load that they require.  Both Turbo and LDPC codes are near optimal in the sense that they get very close to the Shannon limit of what it is possible to achieve with FEC.  Presently NASA uses both Turbo and LDPC codes, as far as I'm aware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like designing any reliable communications system, designing reliable deep space communications requires more than just adding powerful FEC.  Signal power, free-space path loss, receiver noise, etc., must be taken into consideration.  Deep space communications actually have a lot of advantages and two enormous disadvantages.  The disadvantages are the enormous distance and the limited transmitter power.  The advantages are the really high-gain directional antennas, the low noise that the earth dishes get from looking into empty space, the even lower noise they get by cooling their receivers with liquid nitrogen, etc.  They can also slow down their data rate while keeping the transmitted power constant to give each bit more energy.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="1629" LastEditDate="2016-12-22T09:16:01.303" LastActivityDate="2016-12-22T09:16:01.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3174" PostTypeId="1" AcceptedAnswerId="3227" CreationDate="2012-08-21T19:28:10.473" Score="2" ViewCount="1391" Body="&lt;p&gt;I have a mixture of Gaussians and I want to look at their power power spectrum. The spatial distribution looks like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QpdQL.jpg&quot; alt=&quot;http://i.imgur.com/kFRKZ.jpg?1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's already been convolved with a Gaussian window function. I subtract the mean over all values and run an FFT in matlab.&#xA;For the power spectrum I used $|\mathcal{F}|^2 $ and the image under is a section through the middle of the 2D phase space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NaF6H.jpg&quot; alt=&quot;http://i.imgur.com/TuimV.jpg?1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The zero phase component is orders of magnitude bigger than the rest of the spectra; given the nature of the problem I expected the power spectral density to look like a combination of Gaussians. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;The data is initially given as a bivariate poisson process, defined on $ \mathbb{R}^2$. The weights are assumed to be equal and the Gaussians are equally spaced on a hexagonal grid. Now, I'm supposed to estimate the variance of the Gaussians, and wanted to do it using the empirical characteristic function,because the modified EM doesn't work well with data (I guess it's because sample is relatively small ~300 points in total). Following supervisor's suggestion, I estimated a density using Gaussian kernels, and then ran the FFT.&#xA;Concerning the Matlab implementation:&#xA;The 2D spatial density matrix is 'x'&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nfft= 2^(nextpow2(max(size(x))));&#xA;fftx = fft2(x,nfft,nfft);&#xA;mx = abs(fftx)/length(x);&#xA;mx = mx.^2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I selcted arbitrarily a section and plotted plot(ffshift(mx(2048,:)))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit2: I added a link to the data.&#xA;&lt;a href=&quot;https://www.dropbox.com/s/y5sgz0ataxe9z3s/FFT_problem_DataSet.mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/y5sgz0ataxe9z3s/FFT_problem_DataSet.mat&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1845" OwnerDisplayName="Peter" LastEditorUserId="1845" LastEditDate="2012-08-22T09:42:54.930" LastActivityDate="2012-08-26T17:04:28.917" Title="FFT has unexpected DC component" Tags="|fourier-series|matlab|" AnswerCount="1" CommentCount="33" ContentLicense="CC BY-SA 3.0" />
  <row Id="3175" PostTypeId="1" CreationDate="2012-08-21T23:17:06.313" Score="2" ViewCount="364" Body="&lt;p&gt;What algorithms are available for optimizing estimated bit clock recovery of an audio FSK modulated signal over an extremely low S/N ratio channel? (e.g. barely audible due to high ambient noise and low max available signal power)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the audio signal is very long in duration and the payload is suitably pseudo-randomly pre-scrambled.  Even if the data cannot be recovered (or perhaps without massive super-redundant FEC), can the clock be recovered accurately?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-08-21T23:17:06.313" Title="AFSK clock recovery in noise" Tags="|demodulation|fsk|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3176" PostTypeId="1" AcceptedAnswerId="3177" CreationDate="2012-08-22T01:49:11.150" Score="6" ViewCount="1853" Body="&lt;p&gt;I am developing an application that requires audio fingerprints. I have been reading a lot of articles and PDFs, now i think i have gotten myself confused. Based on my present understanding, I have some questions &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;After decoding the audio to its raw format, resampling and extracting the mono channel. Do i convert the bytes to integers or floats?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is convolution and why is it necessary to convolve the audio samples&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is a window and its length&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;FFT transforms a signal from time domain to frequency domain. Am i correct? If yes, does the frequency components of an audio determine the contents/sound/noise/volume? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What operation can be carried out  on two audios of same content but different bitrate to normalize the bitrate and get the data that they share&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What are low pass and high pass filters and how are the derived. What are their uses in relation to audio fingerprint operations&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the text Computer vision for music identification. After convolving the signals with a low pass filter and extracting every 8th sample. Then, a short term fourier transform with a window size of 2048 samples with successive windows offset by 64 samples. Also divide the power between 300Hz and 2000Hz in 33 logarithmically spaced bands.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Will these operations be applied to each of the samples retrieved after the convolution process? Can i get a simpler explanation?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;32 learned filters and thresholds are applied to get a 32-bit descriptor for every time step (11.6 ms) of signal. This series of signals are known as the signature. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;what are these learned filters and thresholds?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Wow :), that's a lot of questions. I am sure a lot of beginners will find the answers helpful.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1846" LastActivityDate="2013-01-31T22:06:28.953" Title="Audio fingerprint questions" Tags="|fft|audio|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3177" PostTypeId="2" ParentId="3176" CreationDate="2012-08-22T10:02:35.693" Score="9" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;There are rare situations when processing is done with integers (embedded systems with no floating point units), but usually, audio signal processing is done with floats.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(Handwaving) Convolution is the operation through which a filter is applied to a signal. If the authors of the paper you're looking at found that applying a specific filter to the data (for example to remove noise, any information not processed by the human auditory system, etc.) yielded good results, then you have to trust them on this!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since audio signals are not stationary, they are processed in short blocks, referred to as &quot;windows&quot; or &quot;frames&quot;. The analysis/processing is thus done on short overlapping segments. For example you will process segment 0.00s:0.02s ; then segment 0.01s:0.03s ; then 0.02s:0.04s etc. In this example, the window size is 20ms and the overlap 50%. There is no &quot;universal&quot; window size for audio applications, look at what is used in the paper describing the technique you're implementing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Not really, but going from the time domain to frequency domain is &quot;one step closer&quot; to what is ultimately happening in the human auditory system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;No operation could do that. If there was one, we would send all our files with the lowest quality and apply this magical operation to recover the highest quality. What this means is that the features used for fingerprinting must be robust enough to capture only the overall &quot;shape&quot; of the sound rather than focus on details - which would be lost by an increased amount of MP3 encoding.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Look at a signal processing textbook. These are very basic signal processing operations and can be used for many things inside or outside the context of a fingerprinting system - reducing sample rate, smoothing temporal sequences, emphasizing details, removing noise...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's say you have 800000 samples. You apply the convolution, you get 800000 samples out of it. Now you extract every 8th sample, you get 100000 samples. Then you apply your FFT on samples 0..2047 to get your 33 coefficients ; then on samples 64..2111 etc... so in the end you have a list of roughly 100000 / 64 = 1562 vectors of 33 coefficients.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(Handwaving). I am assuming you are referring to the Ke et al system (later refined in the works of Baluja et al), which is itself inspired by the Viola-Jones face detector. Once you have converted the signal into a sequence of vectors of 33 coefficients, you compute weighted sums of the coefficients in adjacent bins or along the time axis (a filter), and you compare the result to a threshold. This gives you a binary &quot;feature&quot;. There are 32 such binary features, each of them computed with a different filter and a different threshold. They are &quot;learned&quot;, because they were obtained the following ways: the authors built a database with millions of pairs of songs, some of them identical (but maybe at difference bitrate, volume, noise level etc.), some of them different. Using machine learning techniques (boosting on decision stumps), they evaluated which filters were the best at binning together identical content and separating unrelated content, and which threshold were being used for that. You can find the list of those filters/thresholds in the source code of an open-source implementation of lastfm's &lt;a href=&quot;https://github.com/lastfm/Fingerprinter&quot;&gt;Ke-style audio fingerprinter&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-22T10:02:35.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3179" PostTypeId="1" AcceptedAnswerId="3181" CreationDate="2012-08-22T19:51:44.470" Score="12" ViewCount="20536" Body="&lt;p&gt;The equation governing a leaky integrator (according to Wikipedia at least) is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{d\mathcal{O}}{dt} + A\mathcal{O}(t) = \mathcal{I}(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a continuous-time leaky integrator thus the same thing as a low pass filter with time-constant $A$, up to some scaling of the input?&lt;/p&gt;&#xA;" OwnerUserId="1576" LastEditorUserId="1576" LastEditDate="2012-08-22T21:16:31.797" LastActivityDate="2016-09-15T14:21:33.157" Title="Is a leaky integrator the same thing as a low pass filter?" Tags="|filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3180" PostTypeId="1" CreationDate="2012-08-22T21:51:40.517" Score="1" ViewCount="77" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/845/introduction-to-statistical-signal-processing&quot;&gt;Introduction to Statistical Signal Processing&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;Currently I am doing an (undergrad) class on statistical signal analysis, but I find the reader at hand (no book, buh) very hard to read and understand. The bad thing is, my professor did not include a read list of any kind, and this is not really a topic I have favourite authors in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any books that you can recommend me to read, to finally understand this subject? I have looked at the MIT opencourseware link, and there is a list of books there, but any of these seems to cover only a single chapter in my reader. If there is a single book that covers all of them it would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The chapters in my reader are: Modeling of deterministic signals and systems, Modelling of Stochastic Signals, Linear filtering of stochastic processes, Estimation, Optimal Filtering and Estimation of correlation functions and power spectra.&lt;/p&gt;&#xA;" OwnerUserId="1851" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-08-22T21:56:42.373" Title="Statistical Signal Analysis - what to read" Tags="|reference-request|statistics|estimation|" AnswerCount="0" CommentCount="4" ClosedDate="2012-08-22T22:23:06.173" ContentLicense="CC BY-SA 3.0" />
  <row Id="3181" PostTypeId="2" ParentId="3179" CreationDate="2012-08-22T23:13:47.957" Score="11" Body="&lt;p&gt;A so-called leaky integrator is a first-order filter with feedback. Let's find its transfer function, assuming that the input is $x(t)$ and the output $y(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{dy(t)}{dt} + Ay(t) = x(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{L}\left\{\frac{dy(t)}{dt} + Ay(t)\right\} = \mathcal{L}\left\{x(t)\right\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathcal{L}$ denotes application of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_transform&quot;&gt;Laplace transform&lt;/a&gt;. Moving forward:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;sY(s) + AY(s) = X(s)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s) = \frac{Y(s)}{X(s)} = \frac{1}{s + A}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(taking advantage of the Laplace transform's property that $\frac{dy(t)}{dt} \Leftrightarrow sY(s)$, assuming that $y(0) = 0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This system, with transfer function $H(s)$, has a single pole at $s = -A$. Remember that its frequency response at frequency $\omega$ can be found by letting $s=j\omega$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(j\omega) = \frac{1}{j\omega + A}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a rough view of this response, first let $\omega \to 0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\lim_{\omega \to 0} H(\omega) = \frac{1}{A}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the system's DC gain is inversely proportional to the feedback factor $A$. Next, let $w \to \infty$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\lim_{\omega \to \infty} H(\omega) = 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system's frequency response therefore goes to zero for high frequencies. &lt;strong&gt;This follows the rough prototype of a lowpass filter.&lt;/strong&gt; To answer your other question with respect to its time constant, it's worth checking out the system's time-domain response. Its impulse response can be found by inverse-transforming the transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s) = \frac{1}{s+A} \Leftrightarrow e^{-At}u(t) = h(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u(t)$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Heaviside_step_function&quot;&gt;Heaviside step function&lt;/a&gt;. This is a very common transform that can often be found in &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_transform#Table_of_selected_Laplace_transforms&quot;&gt;tables of Laplace transforms&lt;/a&gt;. This impulse response is an &lt;a href=&quot;http://en.wikipedia.org/wiki/Exponential_decay&quot;&gt;exponential decay&lt;/a&gt; function, which is usually written in the following format:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(t) = e^{-\frac{t}{\tau}}u(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\tau$ is defined to be the function's time constant. &lt;strong&gt;So, in your example, the system's time constant is $\tau = \frac{1}{A}$.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-08-22T23:13:47.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3182" PostTypeId="1" AcceptedAnswerId="3183" CreationDate="2012-08-23T00:27:29.573" Score="10" ViewCount="6952" Body="&lt;p&gt;I am having a hard time trying to find documentation to implement band-pass or high-pass filter with python/scipy/numpy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can easily create and apply a low-pass filter, though, so I ask:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be conceptually correct to low-pass-filter a signal, then subtract the result from the original signal, in order to get just the high-frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if anyone has a simple example of a naive bandpass filter in Python (preferrably using the numpy and scipy libraries), I'd be very thankful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I look for is something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filtered_signal = band_pass(original_signal, rate, low=20, high=500)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: with scipy, I'm using this as low-pass, with good results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy, scipy.signal&#xA;&#xA;def firfilt(interval, freq, sampling_rate):&#xA;    nfreq = freq/(0.5*sampling_rate)&#xA;    taps =  sampling_rate + 1&#xA;    a = 1&#xA;    b = scipy.signal.firwin(taps, cutoff=nfreq)&#xA;    firstpass = scipy.signal.lfilter(b, a, interval)&#xA;    ## second pass to compensate phase delay&#xA;    secondpass = scipy.signal.lfilter(b, a, firstpass[::-1])[::-1]&#xA;    return secondpass&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1558" LastEditorUserId="1558" LastEditDate="2012-08-23T12:27:08.377" LastActivityDate="2016-05-02T09:11:30.123" Title="Is it correct to subtract a low-pass filtered signal from the original signal and use the result as a &quot;high-pass&quot;?" Tags="|python|bandpass|highpass-filter|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3183" PostTypeId="2" ParentId="3182" CreationDate="2012-08-23T00:51:20.060" Score="9" Body="&lt;p&gt;In theory you can do this, but in practice it is difficult to do because the time and phase alignment must be pretty good for it to work.  If the alignment is good you will get the destructive &lt;a href=&quot;http://en.wikipedia.org/wiki/Interference_%28wave_propagation%29&quot;&gt;interference&lt;/a&gt; that you are seeking.  If they aren't, you will get some constructive interference.  Even worse, whether they are destructively or constructively interfering will depend on the frequency- i.e. you can get both constructive and destructive interference at the same time.  It can work, though, if you are only filtering out fairly low frequencies, since their timing requirements are the loosest because they change so slowly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short story- it's possible to do but is difficult enough that it generally makes sense to just do a high-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A relatively straightforward way to create a bandpass filter is to create a low-pass filter, and then modulate it to the center frequency you want by multiplying it with a sinusoid of that frequency.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-08-23T01:00:26.363" LastActivityDate="2012-08-23T01:00:26.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3184" PostTypeId="2" ParentId="3182" CreationDate="2012-08-23T01:23:48.663" Score="4" Body="&lt;p&gt;You indicated that you're having trouble figuring out how to design a suitable highpass filter. One method is to first design a lowpass filter prototype, then apply a transform that warps the filter's response into a filter of another type (such as a highpass or bandpass filter). This is done by substituting an expression for $z^{-1}$ into the transfer function of the prototype lowpass filter. Here are some links to information on the topic:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/toolbox/dsp/ug/bsva1v1.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/toolbox/dsp/ug/bsva1v1.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.ingelec.uns.edu.ar/pds2803/Materiales/Articulos/Constantinides.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ingelec.uns.edu.ar/pds2803/Materiales/Articulos/Constantinides.pdf&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://cnx.org/content/m12759/latest/&quot; rel=&quot;nofollow&quot;&gt;http://cnx.org/content/m12759/latest/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Specifically, for a lowpass-to-highpass transformation, you can apply the following substitution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;z^{-1}=\frac{\alpha + z^{-1}}{1+\alpha z^{-1}},&#xA;$$&#xA;$$&#xA;\alpha = \frac{\cos\left(\frac{1}{2}\left(\omega_c - \omega_c'\right)\right)}&#xA;{\cos\left(\frac{1}{2}\left(\omega_c + \omega_c'\right)\right)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_c$ is the cutoff frequency of the lowpass filter prototype and $\omega_c'$ is the resulting cutoff frequency in the transformed highpass filter. There are some examples given in the MATLAB documentation shown in the first link.; there may be similar functions available in SciPy. With that said, much of the filter design functions in that library follow MATLAB's example closely, and they are capable of designing filters of all of the major types (lowpass, highpass, etc.) with very little effort.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="8825" LastEditDate="2016-05-02T09:11:30.123" LastActivityDate="2016-05-02T09:11:30.123" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3185" PostTypeId="1" AcceptedAnswerId="3191" CreationDate="2012-08-23T09:48:27.027" Score="2" ViewCount="1697" Body="&lt;p&gt;In a typical Digital cable environment in the US, the spectrum is divided into 6MHz bands. When a tuner locks to a signal at say 800MHz, I would assume that the band for that signal is 797 - 803 MHz. The signal is QAM modulated. I would like to know why is that 6 MHz band required? If I can lock to a signal at 800MHz wont that be sufficient to reconstruct the original transmitted signal? From what I remember of my dsp course a few years back, I know that we need the band, but can't for the life of me remember why. Pointers to the theory will be appreciated&lt;/p&gt;&#xA;" OwnerUserId="1336" LastActivityDate="2012-08-23T16:15:44.303" Title="How bandwidth is used in modulation" Tags="|demodulation|bandwidth|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3186" PostTypeId="2" ParentId="3164" CreationDate="2012-08-23T10:54:42.053" Score="1" Body="&lt;p&gt;A possibility would be to do a simple edge detection (such as Laplace), and use the mean intensity of the result as a basis for the threshold for the Harris corners. When you have low contrast, you will get less edges and with lower intensity, with high contrast you get more edges and with higher intensities.&lt;/p&gt;&#xA;&lt;p&gt;You are not the only one struggling with this problem. If you have access to paper databases, this might be interesting:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/5638297&quot; rel=&quot;nofollow noreferrer&quot;&gt;Auto-adaptive harris corner detection algorithm based on block processing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;It might be worth to search for (auto) adaptive harris corner detection more.&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="26573" LastEditDate="2022-05-30T14:11:49.383" LastActivityDate="2022-05-30T14:11:49.383" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3187" PostTypeId="1" CreationDate="2012-08-23T06:18:18.947" Score="0" ViewCount="384" Body="&lt;p&gt;I use a combination of Visual Basic Programming interfaced with FAMOS which is a DSP software like MATLAB but much easier. I am trying to separate signals from a group, which requires filtering each signal. I used FFT and then IFFT on a 600s signal but the IFFT was longer than the original.&#xA;I don't understand if this changes the originality of the signal in terms of shape,which might affect the further processing of the signal.&#xA;After re-sampling the original 10min signal according to Shannon-Niquist theorem and using rectangular windowing, I detect the frequency using FFT.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;After I apply IFFT to the signal, does this change the phase or amplitude even slightly that might vary from the original signal?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I filter one particular freq before IFFT after detecting it from FFT (Maybe I use peak detection)? Is there a general method of doing it?&#xA;DSP is totally new to me,and I am still attempting to learn.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerDisplayName="chatterbox madcity" LastEditorUserId="4298" LastEditDate="2018-09-06T07:47:07.240" LastActivityDate="2018-09-06T07:47:07.240" Title="How do I implement IFFT to filter low frequencies from a group,after Freq detection by FFT?" Tags="|fft|filters|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3188" PostTypeId="5" CreationDate="2012-08-23T12:28:27.177" Score="0" Body="&lt;p&gt;Augmented reality (AR) is a term for a live direct or an indirect view of a physical, real-world environment whose elements are augmented by computer-generated sensory input, such as sound or graphics. It is related to a more general concept called mediated reality, in which a view of reality is modified (possibly even diminished rather than augmented) by a computer. As a result, the technology functions by enhancing one’s current perception of reality. By contrast, virtual reality replaces the real world with a simulated one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(copied from stackoverflow)&lt;/p&gt;&#xA;" OwnerUserId="1706" LastEditorUserId="1706" LastEditDate="2012-08-23T12:44:34.203" LastActivityDate="2012-08-23T12:44:34.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3189" PostTypeId="4" CreationDate="2012-08-23T12:28:27.177" Score="0" Body="Supplemental sensory input" OwnerUserId="1706" LastEditorUserId="1706" LastEditDate="2012-08-23T12:44:43.550" LastActivityDate="2012-08-23T12:44:43.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3191" PostTypeId="2" ParentId="3185" CreationDate="2012-08-23T15:18:16.000" Score="8" Body="&lt;p&gt;An ideal sinusoid does indeed have zero bandwidth, but it is not useful to transmit one because it also imparts zero information to the receiver.  Once the receiver knows what the sinusoid phase is it can perfectly predict the rest of the signal- thus, no more information is received.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For information to be transmitted there has to be an element of &quot;not knowing&quot;.  For digital communications that generally means not knowing if the next bit will be a 1 or 0.  I will try to illustrate where the bandwidth comes from using BPSK, but the exact same principles apply to QAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5DrVn.png&quot; alt=&quot;Square comm wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The BPSK example above is ideal in the sense that it is very easy for the receiver to recover.  The receiver can sample the waveform anywhere within a symbol (&quot;symbol&quot; being the waveform representation of a digital bit) and get the full symbol power.  You can model the example BPSK waveform above as a bunch of individual square waves of varying widths and locations (in time) added together.  If you recall your Fourier theory, the Fourier transform of a square is the sinc function.  Thus, in the frequency domain, the total signal is a bunch of sinc functions of varying widths added together.  That makes the resulting waveform's frequency spectrum look a lot like a sinc function (note that this is not 100% true since there is some destructive interference that occurs, but for the sake of this discussion let's ignore that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sinc functions, unfortunately, aren't too great in terms of bandwidth.  The figure below shows the absolute value of a sinc function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hC1W4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't look too bad until you look at the log scale of the energy, which is shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X2eas.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from the plot above, at the location of the signal's potential nearest neighbor, the sinc function is only about 13 dB down.  The rolloff from there is quite slow, with it only being about 21 dB down at the fifth side lobe.  This introduces a lot of interference into neighboring signals, and when your receiver filters out the neighboring signals it is also filtering out a lot of your transmitted power, so that power is wasted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transmitters employ pulse shaping that rounds out the harsh transitions of the square waves and makes the BPSK waveform look more like a sinusoid.  The following is the same BPSK waveform but using raised-cosine pulse shaping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ahTW6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is the energy vs. frequency view of the raised-cosine pulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kb8BH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main lobe of the raised-cosine and the square wave are essentially the same.  The difference is in the rolloff of the side lobes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So long story short (too late!) the bandwidth comes from the &quot;random&quot; transmission of ones and zeros.  The minimum bandwidth is determined by the symbol period (shorter period is faster, thus wider bandwidth), and the sidelobes outside of that main bandwidth are minimized via pulse shaping.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-08-23T16:15:44.303" LastActivityDate="2012-08-23T16:15:44.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3192" PostTypeId="1" AcceptedAnswerId="16543" CreationDate="2012-08-23T16:04:20.907" Score="12" ViewCount="7608" Body="&lt;p&gt;In &lt;a href=&quot;http://home.eng.iastate.edu/~julied/classes/ee524/articles/multirate_article.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; or multirate filtering, the author establishes the following mathematical relationship. Let $y_D$ be the output of a downsampler such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_D[n] = x[Mn]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $M$ is the downsampling factor. In other words, we keep every $M$-th sample of the original signal. The author then goes on to state the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...the z-transform of $y_D[n]$ is given by&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$Y_D[z]=\frac{1}{M}\sum_{k=0}^{M-1}X[z^{1/M}W^k]$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where $W^k$ is the $M$-point Discrete Fourier Transform kernel, namely&#xA;  $e^{(-j2\pi k)/M}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can we go from the former expression to the latter? What is the relationship between DFT and the Z-transform that allows for such transition?&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="17559" LastEditDate="2015-09-28T05:16:05.617" LastActivityDate="2020-12-24T14:57:15.003" Title="Z-transform of a downsampler" Tags="|dft|downsampling|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3193" PostTypeId="2" ParentId="845" CreationDate="2012-08-23T16:14:22.147" Score="5" Body="&lt;p&gt;Hi, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you are interested in doing research in the field, I will advice following a path built on a strong foundations in mathematics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this, beacuse I just have finished teaching a course in Estimation &amp; Detection and I can assure you that there is a strong correlation between the quality and novelty of the work and your knowledge of math. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of math?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&lt;li&gt; &lt;p&gt;Linear Algebra:&lt;/p&gt;&#xA;&lt;p&gt;You need to know about vector spaces and matrix algebra because; as someone else posted before, there is a lot of theory and algorithms that delve with this type of models. Some results that are often used are the Inverse Matrix Lemma, all that have to do with matrix decompositions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Probability Theory and Stochastic Processes&lt;/p&gt;&#xA;&lt;p&gt;This is also key. Statistical signal processing is about methods for detecting and estimating information (inference) using faulty observations (noisy) of phenomena that could also be random. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you need to know how to handle this kind of object. A basic course in probability can give you a good starting point (one that covers random variables and random vectors, and hopefully talks a little bit about random sequences and processes), but it is desirable to take a second course, focused on random processes. You need to have some confidence with these ideas since it will allow you to understand many applications and practical implementations used in research and technology.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;On a second tier I will also consider taking a course in Optimization, since the computation of estimators is mostly based in solving problems of maximization and minimization (maximum likelihood estimators, minimum mean square error estimator, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, there is also the &quot;algorithmic&quot; point of view, where you concentrate more on statistical signal processing procedures for fast computation, convergence, low complexity, etc., but in the end the development os new ideas requires a good foundation in mathematics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that your knowledge of the inner workings of a given phenomena is also key for producing the models you plan to use in a given setup. In that sense, the practical experience that you can obtain from a course in digital communications, digital signal processing, and even electronic circuits can be invaluable to give you an edge as a researcher. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have more questions, do not hesitate to contact me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Patricio&lt;/p&gt;&#xA;" OwnerUserId="1853" LastActivityDate="2012-08-23T16:14:22.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3194" PostTypeId="2" ParentId="3192" CreationDate="2012-08-23T16:41:26.367" Score="5" Body="&lt;p&gt;I've not seen this notation before. However, it does seem to make sense. The $M$-downsampler is defined by the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y_D[n] = x[Mn]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its $z$ transform is defined by the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;Y_D(z) &amp;amp;= \sum_{n=-\infty}^\infty y_D[n]z^{-n} \\&#xA;&amp;amp;= \sum_{n=-\infty}^\infty x[Mn] z^{-n}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply a change of variable, letting $n' = Mn$. The ranges of the summation are unaffected by the change of variable since they extend to infinity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y_D(z) = \sum_{n'=-\infty}^\infty x[n']z^{-n'/M}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks similar to the $z$ transform of $x[n]$ itself. Recall that it is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(z) = \sum_{n=-\infty}^\infty x[n]z^{-n}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By inspection, we can therefore conclude the following relationship between the $z$ transforms of $x[n]$ and $y_D[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y_D(z) = X\left(z^{1/M}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the $z$ transform of the downsampler output is closely related to the $z$ transform of the input signal, which is to be expected. In the frequency domain, this results in an $M$-fold stretching of the signal's frequency content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how do you go from the above equation to the one you referenced in the paper? It gives a definition of $Y_D(z)$ in terms of $z$ only, while the expression we derived is a function of $z^{1/M}$. So for a particular value of $z$ that you would like to evaluate $Y_D(z)$ at, you would first calculate $z^{1/M}$ (i.e. take the $M$-th root of $z$) and then substitute that into $X(z)$. However, &lt;a href=&quot;http://en.wikipedia.org/wiki/Nth_root#nth_roots&quot; rel=&quot;nofollow&quot;&gt;all nonzero $z \in \mathbb{C}$ have $M$ distinct $M$-th roots&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left\{ r_p,\ r_p e^{\frac{j2\pi}{M}},\ r_p e^{\frac{j2\pi2}{M}},\ \ldots\ ,\ r_p e^{\frac{j2\pi(M-1)}{M}} \right\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;= \left\{ r_p,\ r_p W,\ r_p W^{2},\ \ldots\ ,\ r_p W^{M-1} \right\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $W_k$ is the DFT kernel value $e^{j2\pi k / M}$ referenced in your question, and $r_p$ is what I define to be the principal $M$-th root of the complex value $z$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;r_p = \sqrt[M]{|z|} e^{\frac{j\angle{z}}{M}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, $z$'s principal $M$-th root $r_p$ is obtained by converting $z$ to polar form, taking the $M$-th root of $z$'s magnitude (which is a real number), and dividing $z$'s angle by $M$. The resulting values express $r_p$ in polar form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why go to all of this trouble? Because, as I noted before, the mapping from $Y_D(z)$'s domain to the domain of $X(z^{1/M})$ is not one-to-one. I'll now begin some handwaving. For any particular value of $z$ that you would like to evaluate $Y_D(z)$ for, there are $M$ corresponding points in $X(z^{1/M})$ that you could map to. Therefore, each of those $M$ points in $X(z^{1/M})$ contribute to the corresponding value of $Y_D(z)$. You then end up with a sum like that shown in the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y_D(z) = \frac{1}{M} \sum_{k=0}^{M-1} X(r_p(z)W^k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $r_p(z)$ refers to the principal $M$-th root calculation I showed earlier. In reality, you could pick any of $z$'s $M$-th roots as the principal one; I picked this definition because it's the most straightforward. If you were to properly and rigorously derive this relationship, I believe the factor of $\frac{1}{M}$ comes in because of a derivative of $z^{1/M}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In mathematician-speak, I believe this would be referred to as a composition of functions; $Y_D(z) = f(g(z))$, where $f(z) = X(z)$ and $g(z) = z^{1/M}$. In order to unroll the function composition and write $Y_D(z)$ as a function of $z$ only, you would chop the domain of $Y_D(z)$ into chunks that are one-to-one, invert the function over those intervals, and then sum the results with appropriate scaling factors. I've used this technique before to calculate the probability distribution function of a function of a random variable given the original random variable's pdf (e.g. to derive the pdf of $\sqrt{X}$ given $X$'s pdf), but the name of the technique escapes me.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-08-24T03:35:17.007" LastActivityDate="2012-08-24T03:35:17.007" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3196" PostTypeId="1" AcceptedAnswerId="3199" CreationDate="2012-08-23T20:02:51.670" Score="1" ViewCount="425" Body="&lt;p&gt;I need a little bit more explanation on technical details regarding Fourier Transform in Image Processing, mainly on the frequency aspect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that we can use Discrete Fourier Transform to change an image into a signal. From spatial domain to frequency. But from this definition, suppose I want to manipulate, let's say, for example, overall intensity of an image, once my image is in frequency domain, how can I know which frequency is what in the spatial domain? How could I know which frequency belongs to what part of an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is anything seems incorrect, please correct me.&lt;/p&gt;&#xA;" OwnerUserId="263" OwnerDisplayName="Karl" LastActivityDate="2012-08-24T04:46:04.100" Title="How does Fourier Transform manipulates image technically?" Tags="|image-processing|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3198" PostTypeId="2" ParentId="3196" CreationDate="2012-08-23T20:09:06.463" Score="1" Body="&lt;p&gt;Spatial information is lost.  You'd have to do the inverse transform to get it back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can increase the amplitude for a given frequency, but that effect would be spread out when transforming back into the spatial domain.&lt;/p&gt;&#xA;" OwnerUserId="7445" OwnerDisplayName="duffymo" LastActivityDate="2012-08-23T20:09:06.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3199" PostTypeId="2" ParentId="3196" CreationDate="2012-08-24T04:46:04.100" Score="6" Body="&lt;p&gt;An &lt;a href=&quot;https://dsp.stackexchange.com/questions/1637/what-does-frequency-domain-denote-in-case-of-images/1644#1644&quot;&gt;answer&lt;/a&gt; to another question here provides a great explanation (with pictures) of what a single frequency looks like in the spatial domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a single sample in the frequency domain affects all pixels in the spatial domain.  That frequency produces a sinusoid with one frequency in the x dimension and another in the y dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to change the overall intensity of the image, you can do so by manipulating the DC value in the frequency domain.  This is the value at zero frequency in x and y (upper left sample in the frequency domain).  The DC value represents a wave with zero frequency in the spatial domain, so it is just a constant offset over the entire spatial image, which is basically the overall intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a single frequency affects the entire spatial image, how do you manipulate the frequency samples to do meaningful things in the spatial domain?  Well, one way to think about it is that hard edges and quick intensity changes in the spatial domain correspond with higher frequencies while smooth changes in intensity in the spatial domain correspond with low frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you want to emphasize edges in the image (sharpen), increase the magnitudes of higher frequencies.  Similarly, if you want to smooth the edges (blur), decrease the magnitudes of higher frequencies.&lt;/p&gt;&#xA;" OwnerUserId="52" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-08-24T04:46:04.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3200" PostTypeId="1" CreationDate="2012-08-24T09:13:34.633" Score="2" ViewCount="1795" Body="&lt;p&gt;As stated in &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.54.3239&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;gagnon1997speckle&lt;/a&gt; in paragraph 2.2, under the unit-mean noise assumption one can say that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;ENL = \left(\frac{\bar{y}}{\sigma_{y}} \right)^2 = \frac{1}{\sigma_{n}^2}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&#xA;\begin{equation}&#xA;y = nx, \qquad \bar{y} = E[y]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help me to understand that assertion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your attention.&lt;/p&gt;&#xA;" OwnerUserId="1858" LastActivityDate="2012-08-25T03:20:25.030" Title="Equivalent number of looks (ENL) calculation" Tags="|filters|noise|estimation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3202" PostTypeId="1" AcceptedAnswerId="3207" CreationDate="2012-08-24T14:22:47.273" Score="3" ViewCount="2316" Body="&lt;p&gt;If a signal undergoes repeated averaging (n times) with a filter (h) of size m. Is it possible to achieve the same averaging result with an averaging filter(H) of a larger size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;h = {1/m, 1/m... m times}&lt;/p&gt;&#xA;" OwnerUserId="1860" LastActivityDate="2012-08-24T20:08:52.273" Title="Averaging filters" Tags="|moving-average|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3203" PostTypeId="2" ParentId="3202" CreationDate="2012-08-24T14:35:53.057" Score="0" Body="&lt;p&gt;It depends on what you mean by &lt;em&gt;the same results&lt;/em&gt;. If you're looking to get exactly the same numerical answer, you cannot generally do that. More precisely, filtering a signal with averaging filters of lengths $M$ and $N$ will always give you different results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many cases, practically speaking, it may not matter which filter you use if $M$ and $N$ are not much different. It also depends on the flexibility you have with the filters. If you're only constrained by the filter length, you can simply set the first $M$ coefficients to $\frac{1}{M}$, and the rest to zero. this will yield the same result as the original averager of length $M$.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-08-24T14:35:53.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3204" PostTypeId="2" ParentId="3202" CreationDate="2012-08-24T14:45:50.060" Score="4" Body="&lt;p&gt;I think you can only approximate the result made with filter of different size, but not to get exactly the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you use box filter two times. This is same as convolving the box kernel with itself - that yields a &quot;triangle&quot; filter - and then using the &quot;triangle&quot; filter on the image just once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using box filter three times is the same as using quadratic filter one. The quadratic kernel is built by convolving a &quot;triangle&quot; with &quot;box&quot;. These convolutions eventually lead to a Gaussian filter kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you perform filtering more times with smaller filter or less times with larger filter, the filter is therefore of &lt;strong&gt;different order&lt;/strong&gt;, hence you can only approximate the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approximation may be sufficient, but the accuracy can be proven by computing multiple convolutions of smaller and larger filters with themselves and then comparing the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may be interested in approximating Gaussian blur with fast box filters - the formulas are given in &lt;a href=&quot;http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement&quot; rel=&quot;nofollow&quot;&gt;SVG 1.1 Specs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-08-24T14:45:50.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3205" PostTypeId="2" ParentId="85" CreationDate="2012-08-24T19:00:54.953" Score="2" Body="&lt;p&gt;Yes there are standard implementation forms for Butterworth, and almost every other filter response. They are all fully implemented in my open source IIR filter library. Here's a snippet of code that produces the pole/zero pairs for a Butterworth filter of arbitrary degree:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void AnalogLowPass::design (int numPoles)&#xA;{&#xA;  if (m_numPoles != numPoles)&#xA;  {&#xA;    m_numPoles = numPoles;&#xA;&#xA;    reset ();&#xA;&#xA;    const double n2 = 2 * numPoles;&#xA;    const int pairs = numPoles / 2;&#xA;    for (int i = 0; i &amp;lt; pairs; ++i)&#xA;    {&#xA;      complex_t c = std::polar (1., doublePi_2 + (2 * i + 1) * doublePi / n2);&#xA;      addPoleZeroConjugatePairs (c, infinity());&#xA;    }&#xA;&#xA;    if (numPoles &amp;amp; 1)&#xA;      add (-1, infinity());&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, the position of the poles are calculated by subdividing the s-plane into &quot;pairs&quot; equal segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suitable code is provided for all common types of filter responses: Chebyshev, Elliptic, Legendre, including the shelf versions of each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vinniefalco/DSPFiltersDemo.git&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vinniefalco/DSPFiltersDemo.git&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vinniefalco/DSPFilters.git&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vinniefalco/DSPFilters.git&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://github.com/vinniefalco/DSPFilters/raw/gh-pages/images/DSPFiltersScreenshot.png&quot; alt=&quot;Screenshot&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1838" LastEditorUserId="1838" LastEditDate="2012-08-24T23:29:21.477" LastActivityDate="2012-08-24T23:29:21.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3206" PostTypeId="2" ParentId="51" CreationDate="2012-08-24T19:02:50.987" Score="1" Body="&lt;p&gt;Aside from the technical differences such as numerical accuracy, there is also the issue of stability. When digital filters have pole/zero pairs close to each other, the frequency response can become unstable at various locations (usually approaching Nyquist or approaching zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When IIR filters are used for musical applications, the choice of realization can have a profound effect on filter stability when filter parameters are modulated in real time (for example, varying the cut-off frequency on a low pass filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an open source application that lets you listen to the differences, while time-varying parameters such as cutoff frequency or peak gain, of each of the following realizations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Direct Form I&lt;/li&gt;&#xA;&lt;li&gt;Direct Form II&lt;/li&gt;&#xA;&lt;li&gt;Transposed Direct Form I&lt;/li&gt;&#xA;&lt;li&gt;Transposed Direct Form II&lt;/li&gt;&#xA;&lt;li&gt;Lattice Form&lt;/li&gt;&#xA;&lt;li&gt;State Variable&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The project is here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vinniefalco/DSPFiltersDemo.git&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vinniefalco/DSPFiltersDemo.git&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vinniefalco/DSPFilters.git&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vinniefalco/DSPFilters.git&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://github.com/vinniefalco/DSPFilters/raw/gh-pages/images/DSPFiltersScreenshot.png&quot; alt=&quot;Screenshot&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1838" LastEditorUserId="1838" LastEditDate="2012-08-24T23:33:28.600" LastActivityDate="2012-08-24T23:33:28.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3207" PostTypeId="2" ParentId="3202" CreationDate="2012-08-24T20:08:52.273" Score="3" Body="&lt;p&gt;No, it is not possible to achieve the same result with a larger averaging filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is a linear process, so it obeys the law of associativity.  Thus if your signal is $s(t)$ and your filter is $f(t)$ (and we'll set $n$ to 3 just to make the display easier), then we could mathematically describe the filtering as follows-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;a(t) &amp;amp;= ((s(t) * f(t)) * f(t)) * f(t) \\&#xA;&amp;amp;= s(t) * (f(t) * f(t) * f(t))&#xA;\end{align}&#xA;$$&#xA;In other words convolving the signal with an averaging filter multiple times is the same as convolving it once with the averaging filter convolved with itself.  So what does that look like?  See below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C389g.png&quot; alt=&quot;Averaging filter convolutions&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the filter does get wider, but it also changes form as you convolve it more times.  As Libor mentioned, as $n$ gets large it starts to approximate a &lt;a href=&quot;http://en.wikipedia.org/wiki/Binomial_distribution#Normal_approximation&quot; rel=&quot;nofollow noreferrer&quot;&gt;gaussian filter&lt;/a&gt; according to the central limit theorem.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-08-24T20:08:52.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3210" PostTypeId="1" CreationDate="2012-08-25T07:07:42.930" Score="2" ViewCount="108" Body="&lt;p&gt;For a machine vision application, we take short duration (50uSec) monochrome pictures with IR flash. The images we get are decent quality however the light color subjects (light blue, light green, yellow) are all lost or become less visible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We convert these 10 bit images to 8 bit and look at them that way which already contributes to the problem. This is something we can probably solve with a non-linear 10-8 bit companding, so I am not worried about this part. If I look at the images on a display that supports 10 bit I still see them very very weak. My objective is to boost them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the raw data when I look at them, assuming surface average is 800 (pretty white), these light color subjects are 760-780 range, so the info is there but not visible. (A side note, if I take a picture of the same object under normal light with very long exposure time, 1msec, I see all details, so flash is also contributing to the problem). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to gain these lost info back? We still have access to the 10 bit raw image data, what type of algorithm I can use to gain them back.  &lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="13320" LastEditDate="2016-11-21T13:03:21.833" LastActivityDate="2016-11-21T13:03:21.833" Title="Contrast Enhancement for subjects under Flash" Tags="|image-processing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3211" PostTypeId="1" CreationDate="2012-08-25T12:11:56.150" Score="6" ViewCount="23802" Body="&lt;p&gt;I'm working on a project which ranked some images based on quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this project, I want to figure out the noise and the sharpness from a image.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;To calculate the  &lt;strong&gt;noise (from a CCD-Sensor)&lt;/strong&gt; I think I can calculate the average noise from a image. How could I do this? I've read something about MSE, PSNR and SSIM.  However, all these require a second image. Or is there a modification, so as I can use these algorithms for one image?&lt;/li&gt;&#xA;&lt;li&gt;To calculate a value which represent the &lt;strong&gt;sharpness&lt;/strong&gt; I have no idea. Maybe I can calculate the peak with the sharpest point of the image (because there are different kinds like out-of-focus or motion-blur)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there an available reference paper or an implementation in any language?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA; Can I use (slanted-edge) MTF to measure sharpness? I need some normalized metric to compare sharpness between images. Or is there a better solution?  A stand alone Laplacian is not normalized, I think.&lt;/p&gt;&#xA;" OwnerUserId="1854" LastEditorUserId="76" LastEditDate="2012-09-23T15:33:51.927" LastActivityDate="2019-05-16T20:56:49.907" Title="How can I measure noise and sharpness of an image?" Tags="|image-processing|noise|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3212" PostTypeId="2" ParentId="845" CreationDate="2012-08-25T12:16:00.383" Score="1" Body="&lt;p&gt;I've read&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Van Den Bos, Adriaan: &quot;Parameter Estimation for Scientists and Engineers&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It explains parameter estimation (maximum likelihood, least squares), properties of estimators (precision, accuracy) and how to estimate these properties as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book contains explanations of some numerical methods used for estimation.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-08-25T12:16:00.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3216" PostTypeId="1" AcceptedAnswerId="3218" CreationDate="2012-08-25T23:23:34.540" Score="2" ViewCount="143" Body="&lt;p&gt;I am trying to detect a pitch in a narrow range of the audio spectrum with minimal samples. This corresponds to the rattling of certain mechanical systems. For example, the hum of an engine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, I am hoping to identify if there is a frequency at at a certain range such as 550hz-555hz.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I spoke with a learned fellow about this problem and he mentioned that there is a variation of the FFT that only targets the desired frequency range. What is this called?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I was hoping to avoid an amplitude (volume) training period by distinguishing peaks from white-noise in the frequency domain. Can anybody point me to a tunable parameter that will enable me to identify if a certain range has a peak? I was thinking of comparing the max height to the average.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I was wondering if anybody knew of a good method to do this.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="941" LastActivityDate="2012-08-26T01:41:51.707" Title="Binary classifier for a small range of the audio spectrum" Tags="|pitch|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3217" PostTypeId="2" ParentId="3216" CreationDate="2012-08-26T00:13:22.920" Score="4" Body="&lt;p&gt;It could have been &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow&quot;&gt;Goertzel's algorithm&lt;/a&gt;, though it looks at a single frequency rather than a specific band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach is to apply modulation techniques to shift the central frequency of your range of interest into the baseband, aka &lt;a href=&quot;http://www.arc.id.au/ZoomFFT.html&quot; rel=&quot;nofollow&quot;&gt;&quot;zoom FFT&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your intuition about the max to average ratio is good. Another &quot;peakedness&quot; metric is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;nofollow&quot;&gt;ratio of geometric mean to arithmetic mean&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-26T00:13:22.920" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3218" PostTypeId="2" ParentId="3216" CreationDate="2012-08-26T00:58:50.573" Score="3" Body="&lt;p&gt;A few points &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I'd carefully verify the underlying assumptions: most engine noises,&#xA;hums or buzzes, have lots of harmonics and are therefore a very wide&#xA;spectrum. The fundamental is rarely the strongest component in&#xA;there.&lt;/li&gt;&#xA;&lt;li&gt;5 Hz seems like an awfully narrow bandwidth. You can only get 10&#xA;independents samples per second out of a signal that narrow. So if&#xA;you need 50 samples to make a decision, it'll take you 5 seconds.&lt;/li&gt;&#xA;&lt;li&gt;You may be more interested in the &quot;transient event&quot;, i.e. the hum&#xA;starting or stopping. The transient has a much higher bandwidth (and&#xA;is probably easier to detect) than the steady state noise.&lt;/li&gt;&#xA;&lt;li&gt;One way to do this is &quot;down-mixing&quot;. Multiply the signal sine wave&#xA;of, say, 550 Hz and then lowpass filter with the desired bandwidth,&#xA;5 Hz, for example. You can then downsample if you want&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;One suggestion for an algorithm&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Multiply signal with 550Hz&lt;/li&gt;&#xA;&lt;li&gt;Form x[n] by low pass filtering with 5 Hz, measure energy&lt;/li&gt;&#xA;&lt;li&gt;Form y[n] by low pass filter with 50 Hz, measure energy&lt;/li&gt;&#xA;&lt;li&gt;If the energies of x[n] and y[n] are about the same, then your engine is on, otherwise it's off&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is how it works: You look at the spectrum of your signal with a bandwidth of 10Hz and 100Hz around the center frequency. If the spectrum is mostly white (or pink as audio typically is), than the energy in the 100Hz band should be about 10 times larger than the energy in the 10Hz band. Now if you have a very narrow but strong spectral component in the 10 Hz band, than this dominates the energy in the 100 Hz band as well and therefore the energies in both bands will be roughly the same.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-08-26T00:58:50.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3219" PostTypeId="2" ParentId="3187" CreationDate="2012-08-26T01:04:42.390" Score="2" Body="&lt;p&gt;Frequency domain processing (i.e FFT, manipulating signal, IFFT) is actually pretty complicated and requires careful choice and a thorough understanding of things like framing, step size, windowing, overlap, wrap-around, circular vs. linear etc. Simple examples for these type of algorithms are overlap-add or overlap-save for linear time invariant filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the only thing you want to do is getting rid of the low frequencies in your signal, filtering with a high pass filter is much easier and quicker.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-08-26T01:04:42.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3220" PostTypeId="2" ParentId="3216" CreationDate="2012-08-26T01:27:43.727" Score="1" Body="&lt;p&gt;If you are looking for &quot;pitch&quot; e.g. vibration periodicity, and not spectral frequency (which are 2 different things), then forget using either the FFT or the Goertzel algorithm, as these only work if the fundamental frequency of the periodic signal is clearly and always the strongest spectral element (as opposed to all the possible harmonics). For some types of system &quot;rattles&quot;, the system response might transmit one or multiple harmonics out of the system more strongly than the vibration impulse frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For vibration pitch, try autocorrelation (or the related AMDF or ASDF methods) and look for a peak at a time lag within the range of periodicity for the frequencies which you are hoping to identify (e.g. 1.802 to 1.818 mS for your example).  The window size required to find a peak with this accuracy will depend on your signal to noise ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have characterized the background noise, you can set a threshold for the peak above the background based on the statistics of that noise, and depending on your desired error rates.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-08-26T01:41:51.707" LastActivityDate="2012-08-26T01:41:51.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3222" PostTypeId="2" ParentId="3211" CreationDate="2012-08-26T03:30:08.707" Score="1" Body="&lt;p&gt;Simply denoise an observed image and you'll get a second image for those algorithms requiring two images and they shall give you rough scores. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sharpness, you can take a look at &lt;a href=&quot;http://www.cambridgeincolour.com/tutorials/sharpness.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.cambridgeincolour.com/tutorials/image-sharpening.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2012-08-26T03:30:08.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3223" PostTypeId="2" ParentId="3158" CreationDate="2012-08-26T06:56:54.373" Score="0" Body="&lt;p&gt;In the case of RTTY 45.45 baud, you will also have symbols that aren't an integer number of samples, so you need a function that can be called each sample and then signal in its return value when that symbol has ended. And you need a phase accumulator, which keeps a running tally on where the phase of the sine wave is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To send symbols whose length isn't an integer multiple of the sample rate you need this function...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int millisecondTimer(double milliseconds, double samplerate, int resettime)&#xA;{&#xA;&#xA;    static int fracsample=0;&#xA;    static int counter=0;&#xA;    static int retvalue=0;&#xA;    static int first=1;&#xA;    static double oldmilliseconds=1.0;&#xA;    static int whole_samples=0;&#xA;    static int samerror=32768;&#xA;    if(resettime==1)&#xA;    {&#xA;        samerror=0;&#xA;        counter=0;&#xA;        retvalue=1;&#xA;        first=1;&#xA;    }&#xA;    if(first==1 || milliseconds !=oldmilliseconds)&#xA;    {&#xA;        double samplesneeded=1;&#xA;        double wholesamples=0;&#xA;        samplesneeded=(samplerate) * (milliseconds /1000.0);&#xA;        samerror=(modf(samplesneeded, &amp;amp;wholesamples)) * 32768.0;&#xA;        whole_samples=wholesamples;&#xA;        first=0;&#xA;    }&#xA;&#xA;    if(counter&amp;lt;=whole_samples)&#xA;    {&#xA;        retvalue=2;&#xA;        counter++;&#xA;    }&#xA;    else&#xA;    {&#xA;        counter-=whole_samples;&#xA;        retvalue=1;&#xA;        fracsample+=samerror;&#xA;        oldmilliseconds=milliseconds;&#xA;        if(fracsample&amp;gt;=32768)&#xA;        {&#xA;            fracsample-=32768;&#xA;            counter--;&#xA;        }&#xA;&#xA;    }&#xA;    return retvalue;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To use it, generate the next sample of sine wave and call this function, then check if the return value is NOT equal to two. If it's not equal to two, advance to the next symbol and decide whether you are sending a mark of space, then call this function again inside the block of code which executes when you found out that the return value is not equal to two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's the phase accumulator from the Rockbox firmware, with a change to allow changes in amplitude (full volume is 32767, 180 degrees out of phase full volume is -32768).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signed short lerpsin(float frequency,signed short amplitude,unsigned long samplerate)&#xA;{&#xA;    /* 128 sixteen bit sine samples + guard point */&#xA;    static unsigned long phase=0;&#xA;    unsigned int pos =0;&#xA;    unsigned short frac=0;&#xA;    static unsigned long step=0;&#xA;    static float old_frequency=0;&#xA;    signed short diff=0;&#xA;    static const signed short sinetab[129] =&#xA;    {&#xA;        0,   1607,   3211,   4807,   6392,   7961,   9511,  11038,&#xA;        12539,  14009,  15446,  16845,  18204,  19519,  20787,  22004,&#xA;        23169,  24278,  25329,  26318,  27244,  28105,  28897,  29621,&#xA;        30272,  30851,  31356,  31785,  32137,  32412,  32609,  32727,&#xA;        32767,  32727,  32609,  32412,  32137,  31785,  31356,  30851,&#xA;        30272,  29621,  28897,  28105,  27244,  26318,  25329,  24278,&#xA;        23169,  22004,  20787,  19519,  18204,  16845,  15446,  14009,&#xA;        12539,  11038,   9511,   7961,   6392,   4807,   3211,   1607,&#xA;        0,  -1607,  -3211,  -4807,  -6392,  -7961,  -9511, -11038,&#xA;        -12539, -14009, -15446, -16845, -18204, -19519, -20787, -22004,&#xA;        -23169, -24278, -25329, -26318, -27244, -28105, -28897, -29621,&#xA;        -30272, -30851, -31356, -31785, -32137, -32412, -32609, -32727,&#xA;        -32767, -32727, -32609, -32412, -32137, -31785, -31356, -30851,&#xA;        -30272, -29621, -28897, -28105, -27244, -26318, -25329, -24278,&#xA;        -23169, -22004, -20787, -19519, -18204, -16845, -15446, -14009,&#xA;        -12539, -11038, -9511,   -7961,  -6392,  -4807,  -3211,  -1607,&#xA;        0,&#xA;    };&#xA;    if(frequency!=old_frequency)&#xA;    {&#xA;        step = 0x100000000ull*frequency / samplerate;&#xA;    }&#xA;    phase+=step;&#xA;    pos = phase &amp;gt;&amp;gt; 25;&#xA;    frac = (phase &amp;amp; 0x01ffffff) &amp;gt;&amp;gt; 9;&#xA;    diff = sinetab[pos + 1] - sinetab[pos];&#xA;    old_frequency=frequency;&#xA;    return ((-((sinetab[pos] + (frac*diff &amp;gt;&amp;gt; 16)))) * amplitude) &amp;gt;&amp;gt; 15;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1868" LastActivityDate="2012-08-26T06:56:54.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3224" PostTypeId="2" ParentId="2902" CreationDate="2012-08-26T07:38:15.250" Score="0" Body="&lt;p&gt;Here's a quick-and-dirty bin-zeroing FFT bandpass filter, with the FFT code as well.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void FFT(int n, int inverse, double *gRe, double *gIm, double *GRe, double *GIm)&#xA;{&#xA;&#xA;    int m = 0;&#xA;    int p = 1;&#xA;    int j = 0;&#xA;    int i1=0;&#xA;    int k=0;&#xA;    double ca=0;&#xA;    double sa=0;&#xA;    int l1,l2,l3;&#xA;    double u1,u2;&#xA;    double t1 = 0;&#xA;    double t2 = 0;&#xA;    int i2=0;&#xA;    double z;&#xA;    /* Calculate m=log_2(n) */&#xA;    while(p &amp;lt; n)&#xA;    {&#xA;        p *= 2;&#xA;        m++;&#xA;    }&#xA;    /* Bit reversal */&#xA;    GRe[n - 1] = gRe[n - 1];&#xA;    GIm[n - 1] = gIm[n - 1];&#xA;    for(i1 = 0; i1 &amp;lt; n - 1; i1++)&#xA;    {&#xA;        GRe[i1] = gRe[j];&#xA;        GIm[i1] = gIm[j];&#xA;        k = n / 2;&#xA;        while(k &amp;lt;= j)&#xA;        {&#xA;            j -= k;&#xA;            k /= 2;&#xA;        }&#xA;        j += k;&#xA;    }&#xA;    /* Calculate the FFT */&#xA;    ca = -1.0;&#xA;    sa = 0.0;&#xA;    l1 = 1;&#xA;    l2 = 1;&#xA;    l3=0;&#xA;    for(l3 = 0; l3 &amp;lt; m; l3++)&#xA;    {&#xA;        l1 = l2;&#xA;        l2 *= 2;&#xA;        u1 = 1.0;&#xA;        u2 = 0.0;       &#xA;    for(j = 0; j &amp;lt; l1; j++)&#xA;        {&#xA;            i2=j;&#xA;            for(i2 = j; i2 &amp;lt; n; i2 += l2)&#xA;            {&#xA;                i1 = i2 + l1;&#xA;                t1 = u1 * GRe[i1] - u2 * GIm[i1];&#xA;                t2 = u1 * GIm[i1] + u2 * GRe[i1];&#xA;                GRe[i1] = GRe[i2] - t1;&#xA;                GIm[i1] = GIm[i2] - t2;&#xA;                GRe[i2] += t1;&#xA;                GIm[i2] += t2;&#xA;            }&#xA;            z =  u1 * ca - u2 * sa;&#xA;            u2 = u1 * sa + u2 * ca;&#xA;            u1 = z;&#xA;        }&#xA;        sa = sqrt((1.0 - ca) / 2.0);&#xA;        if(!inverse) sa =- sa;&#xA;        ca = sqrt((1.0 + ca) / 2.0);&#xA;&#xA;    }&#xA;    /* Divide through n if it isn't the IDFT */&#xA;    if(!inverse)&#xA;    {&#xA;        int i3=0;&#xA;        for(i3 = 0; i3 &amp;lt; n; i3++)&#xA;        {&#xA;            GRe[i3] /= n;&#xA;            GIm[i3] /= n;&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;&#xA;void mainfftBandPass(double *insamples, double *outsamples, unsigned long fftsize, long lowfreq, long highfreq, long srate)&#xA;{&#xA;    static double *inbuf=NULL;&#xA;    static double *realn=NULL;&#xA;    static double *imags=NULL;&#xA;    static double *spectr=NULL;&#xA;    static double *zer0=NULL;&#xA;    static double *olds=NULL;&#xA;    static double *infader=NULL;&#xA;    static double *outfader=NULL;&#xA;    int notched=(highfreq&amp;lt;lowfreq) ? 1 : 0;&#xA;    long incounter=0;&#xA;    /* treble is the highest baseband frequency */&#xA;    /* bass the the lowest baseband frequency */&#xA;    /* this function is called twice per FFT block */&#xA;    long midcounter=0;&#xA;    long outcounter=0;&#xA;    long bass=lowfreq*(fftsize/(double)srate);&#xA;    long treble=(highfreq)*(fftsize/(double)srate);&#xA;    static long halffft=2;&#xA;    static long old_fftsize=0;&#xA;    static short first=1;&#xA;    if(first==1 || fftsize!=old_fftsize)&#xA;    {&#xA;        if(inbuf)&#xA;             free(inbuf);&#xA;        if(realn)&#xA;            free(realn);&#xA;        if(imags)&#xA;            free(imags);&#xA;        if(spectr)&#xA;            free(spectr);&#xA;        if(zer0)&#xA;            free(zer0);&#xA;        if(olds)&#xA;            free(olds);&#xA;        if(infader)&#xA;            free(infader);&#xA;        if(outfader)&#xA;            free(outfader);&#xA;        infader=(double*)malloc(fftsize*sizeof(double));&#xA;        outfader=(double*)malloc(fftsize*sizeof(double));&#xA;        inbuf=(double*)malloc(fftsize*sizeof(double));&#xA;        realn=(double*)malloc(fftsize*sizeof(double));&#xA;        imags=(double*)malloc(fftsize*sizeof(double));&#xA;        spectr=(double*)malloc(fftsize*sizeof(double));&#xA;        zer0=(double*)malloc(fftsize*sizeof(double));&#xA;        olds=(double*)malloc(fftsize*sizeof(double));&#xA;        if((!inbuf) || (!realn) ||(!imags) ||(!spectr)||(!zer0)||(!ol   ds))&#xA;        {&#xA;            printf(&quot;Not enough memory for FFT!\n&quot;);&#xA;                    exit(1);&#xA;        }&#xA;        halffft=fftsize/2;&#xA;        long infade=0;&#xA;        long outfade=halffft;&#xA;        for(infade=0;infade&amp;lt;halffft;infade++)&#xA;        {&#xA;            outfade--;&#xA;            outfader[infade]=(0.5 * cos((infade) *  M_PI/(double)(halffft))+0.5);&#xA;            infader[outfade]=outfader[infade];&#xA;        }&#xA;        first=0;&#xA;    }&#xA;    memset(realn,0,sizeof(double)*fftsize);&#xA;    for(incounter=0;incounter&amp;lt;halffft;incounter++)&#xA;    {&#xA;        inbuf[incounter]=inbuf[incounter+halffft];&#xA;    }&#xA;    for(incounter=0;incounter&amp;lt;halffft;incounter++)&#xA;    {&#xA;        inbuf[incounter+halffft]=insamples[incounter];&#xA;    }&#xA;    for(incounter=0;incounter&amp;lt;fftsize;incounter++)&#xA;    {&#xA;        realn[incounter]=inbuf[incounter];&#xA;    }   &#xA;    memset(imags,0,sizeof(double)*fftsize);&#xA;    FFT(fftsize, 0, realn,imags, spectr,zer0);&#xA;    memset(realn,0,sizeof(double)*fftsize);&#xA;    memset(imags,0,sizeof(double)*fftsize);&#xA;    if(notched==0)&#xA;    {&#xA;        for(midcounter=bass;midcounter&amp;lt;treble;midcounter++)&#xA;        {&#xA;            realn[midcounter]=spectr[midcounter] * 2.0;&#xA;            imags[midcounter]= zer0[midcounter] * 2.0;&#xA;        }&#xA;        if(bass==0)&#xA;            realn[0]=spectr[0];&#xA;&#xA;    }&#xA;    else if(notched==1)&#xA;    {&#xA;        for(midcounter=0;midcounter&amp;lt;halffft;midcounter++)&#xA;        {&#xA;            if((midcounter&amp;lt;treble) ||(midcounter&amp;gt;bass))&#xA;            {&#xA;                realn[midcounter]=spectr[midcounter] * 2.0;&#xA;                imags[midcounter]= zer0[midcounter] * 2.0;&#xA;            }&#xA;        }&#xA;        if(bass==0)&#xA;        {&#xA;            realn[0]=0;&#xA;        }&#xA;        else&#xA;        {&#xA;            realn[0]=spectr[0];&#xA;        }&#xA;    }&#xA;    FFT(fftsize, 1, realn, imags,spectr,zer0);&#xA;    for(outcounter=0;outcounter&amp;lt;halffft;outcounter++)&#xA;    {&#xA;        outsamples[outcounter]=(((spectr[outcounter] )*infader[outcounter])+(olds[outcounter+halffft]*outfader[outcounter])) ;&#xA;    }&#xA;    for(outcounter=0;outcounter&amp;lt;fftsize;outcounter++)&#xA;    {&#xA;        olds[outcounter]=spectr[outcounter];&#xA;    }&#xA;    memset(spectr,0,fftsize*sizeof(double));&#xA;    memset(zer0,0,fftsize*sizeof(double));&#xA;    old_fftsize=fftsize;&#xA;}&#xA;&#xA;signed short mainbandpass(signed short input, double lowcut, double highcut,long rate,long fftsize)&#xA;{&#xA;    double retvalue=0;&#xA;    static double *insamp=NULL;&#xA;    static double *outsamp=NULL;&#xA;    static int first=1;&#xA;    static int q=0;&#xA;    if(first==1)&#xA;    {&#xA;            insamp=(double*)malloc(fftsize * sizeof(double));&#xA;            outsamp=(double*)malloc(fftsize * sizeof(double));&#xA;            if(insamp==NULL || outsamp==NULL)&#xA;            {&#xA;                   printf(&quot;Not enough memory for FFT buffers.\n&quot;);&#xA;                   exit(1);&#xA;            }&#xA;        memset(insamp,0,fftsize * sizeof(double));&#xA;        memset(outsamp,0,fftsize * sizeof(double));&#xA;        first=0;&#xA;    }&#xA;&#xA;    insamp[q]=input;&#xA;    retvalue=outsamp[q];&#xA;    if(retvalue&amp;gt; 32767)&#xA;        retvalue=32767;&#xA;    if(retvalue &amp;lt;-32768)&#xA;        retvalue=-32768;&#xA;    q++;&#xA;    if(q&amp;gt;(fftsize/2)-1)&#xA;    {&#xA;        mainfftBandPass(insamp,outsamp, fftsize, lowcut,highcut,rate);&#xA;        q=0;&#xA;    }&#xA;    return (signed short)retvalue;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for each sample of the input audio, call mainbandpass with the input sample and the range of frequencies you want to keep in lowcut and highcut. If lowcut is greater than highcut the result will be a band-reject filter. There is circular convolution going on, but there will be no out of band emissions which is good for modems.&lt;/p&gt;&#xA;" OwnerUserId="1868" LastEditorUserId="1868" LastEditDate="2012-08-26T07:44:36.287" LastActivityDate="2012-08-26T07:44:36.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3225" PostTypeId="2" ParentId="2781" CreationDate="2012-08-26T08:00:04.597" Score="3" Body="&lt;p&gt;With Frequency Shift Keying, the modulation (digital data) takes up bandwidth, so you can't just keep only the frequencies of the mark and space tones. A firm lower bound on how little bandwidth you can use is the distance between the mark and space frequencies, plus half the baud rate on either side. So for 1200 baud with frequencies of 1300 hertz and 2100 hertz, the absolute minimum bandwidth is (1300-(1200/2)) [700 hertz] to (2100+(1200/2)) [2700 hertz] which is a bandwidth of 2 kHz. People have tried to filter it tighter but if the reception still provides the correct data, it is only because of chance. Usually there is also some pulse shaping in the FSK signal before modulation to make the filter's job easier.&lt;/p&gt;&#xA;" OwnerUserId="1868" LastActivityDate="2012-08-26T08:00:04.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3226" PostTypeId="2" ParentId="3210" CreationDate="2012-08-26T10:47:50.343" Score="1" Body="&lt;p&gt;You can perform tone mapping on the source image and then convert the result to 8 bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Global tone mapping&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depends just on pixel values, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H[x,y] = G(I[x,y])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output image pixel H[x,y] is just processed input pixel value using tone mapping operator G. This allows making lookup table holding all possible values (i.e. 0 - 1023 in 10-bit images).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Local tone mapping&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works on pixel values and their neighborhood, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H[x,y] = G(I, x, y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These operators are more complex in nature, but yield more details in the resulting image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conversion&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying tone mapping, the image can be converted to 8-bits easily:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;O[x,y] = H[x,y] &amp;gt;&amp;gt; 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where (&gt;&gt; 2) is shift by two bits, or division by 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conversion can be incorporated in tone mapping step, for example and entry for the look-up table in global tone mapping can be defined this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;g[i] = (log2(i + 1) * 102.3) &amp;gt;&amp;gt; 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the operator is a log curve adjusted for range of input values to 0-1023. The operator also contains conversion to 8-bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Samples&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Tone_mapping&quot; rel=&quot;nofollow&quot;&gt;More info on Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-08-26T10:47:50.343" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3227" PostTypeId="2" ParentId="3174" CreationDate="2012-08-26T17:04:28.917" Score="0" Body="&lt;p&gt;The first and the obvious algorithm for the solution of this problem is the &lt;strong&gt;EM&lt;/strong&gt; algorithm. This algoritm is getting worse in the number of parameters. It is also too much dependent on the initial conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The drawbacks of this algorithm can be circumvented by parallel computing. This means you have $N$ &lt;strong&gt;EM&lt;/strong&gt; algorithms run simultaneously which have different initialization points. The final algoritm takes all parameters estimated by &lt;strong&gt;N&lt;/strong&gt; processors and based on the wellness of the fit gives the final decicion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method is to use the central moments until &lt;strong&gt;Mth&lt;/strong&gt; order. When written in a parametric form each &lt;strong&gt;xth&lt;/strong&gt; order moment gives a linear/non-linear combination of parameters which are to be estimated. From here one can construct a test. Of course the moments should also be estimated from the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method would be to employ a better search algorithn. That is called particle swarm optimization. It will run similar to &lt;strong&gt;EM&lt;/strong&gt;. However it is a stochastic algorithm have different characteristics than &lt;strong&gt;EM&lt;/strong&gt; such as to be able to deal with more number of parameters. It is a kind of team optimization algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thats all in my mind at the moment. Good luck with the experiments.&lt;/p&gt;&#xA;" OwnerUserId="1850" LastActivityDate="2012-08-26T17:04:28.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3228" PostTypeId="1" AcceptedAnswerId="3229" CreationDate="2012-08-26T17:19:45.830" Score="3" ViewCount="11853" Body="&lt;p&gt;I'm a complete novice to digital signal processing, and I've started reading a few books on it.  In particular, I've run across the concept of upsampling and downsampling. As I understand it, given a discrete time signal $x(n)$, upsampling transforms the signal by (essentially) inserting $L-1$ zeros between each sample.  Similarly, one can downsample by omiting ever $L-1$ samples.  I'm not sure I understand why one would want to do so.  Why insert 'data' into the signal that wasn't there originally (upsampling)?  Wouldn't removing data (downsampling) remove features that are essential to its analysis?  I'm curious to know under what circumstances is this particularly useful?  &lt;/p&gt;&#xA;" OwnerUserId="1330" LastActivityDate="2015-03-17T00:31:46.627" Title="Practical Applications of upsampling and downsampling" Tags="|downsampling|supersampling|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3229" PostTypeId="2" ParentId="3228" CreationDate="2012-08-26T17:29:42.870" Score="5" Body="&lt;p&gt;Simplest reason for downsampling is simply to reduce the amount of data you have. Say you have a audio raw stream sampled at 44.1 kHz. You may simply want to reduce your data rate to 22.05 kHz because your algorithm can work with that sampling rate. Apply the same principle anywhere else. Just because you have more data does not mean you always need it. It may sound untrue but it is like saying do I need something upto 10 decimal points of accuracy or will 2 decimal points do? [Not exactly the same but you get the idea]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple reason to upsample to to interpolate. You have data which is sampled at a particular rate. You want to upsample it to get intermediate points between the actual data.  [Think of curve fitting. you want more points on the curve.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are implications to downsampling and upsampling. Not every downsampling is the same and not every upsampling give accurate interpolation. You will learn more as you go along. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Thought I'd give another simpler real life example&#xA;Image scaling: if you have a small image. You upscale it. This is upsampling.&#xA;If you want a smaller version you resize to a smaller size. This is downsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ofcourse practical scalers will not just add 0's and upsample and downsample. [You could do that too, but the output will not look good]. But it should give you another idea of where upsampling and downsampling is done.&lt;/p&gt;&#xA;" OwnerUserId="1870" LastEditorUserId="1870" LastEditDate="2012-08-26T17:56:46.253" LastActivityDate="2012-08-26T17:56:46.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3230" PostTypeId="2" ParentId="3228" CreationDate="2012-08-26T20:11:56.053" Score="4" Body="&lt;p&gt;A common reason for upsampling is rate matching, for instance mixing two signals with different sample rates, or sending different lesser rates of audio to a player that only plays at 44.1kHz.  And you are correct that downsampling does potentially destroy information in a signal (assuming there was spectral energy in the portion that has to be low-pass filtered out before downsampling).  But if you have a big item and a small box (channel bandwidth, disk size, etc.), something needs to get thrown out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both upsampling and downsampling can be done by (potentially filtered) interpolation, such as with a Sinc kernel.  Inserting an integer numbers of zeros is not required.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-08-26T20:11:56.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3231" PostTypeId="1" AcceptedAnswerId="3233" CreationDate="2012-08-26T21:04:35.233" Score="1" ViewCount="2060" Body="&lt;p&gt;I'm working from an example posted &lt;a href=&quot;http://www.mathworks.com/help/techdoc/math/brentm1-1.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.  I understand the steps to acquire the fourier transform and can clearly see the spikes at normalized frequencies at 15 and 40 Hz from the 0-centered periodogram.  Knowing this, I believe that I can reconstruct a smoother version of the signal as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_{\text{reconstructed}}(t)=\alpha_1 sin(30\pi t)+\alpha_2 sin(80\pi t)$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions related to this reconstruction:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How do I obtain the coefficients $\alpha_1$ and $\alpha_2$ without an inverse fourier transform of the entire frequency domain data set?  Is there a more efficient way?  &lt;/li&gt;&#xA;&lt;li&gt;How could I have obtained the 15 &amp;amp; 40 Hz frequencies from the transformed data?  I know I can sort the transformed data to determine that these two frequencies had the highest two powers.  But if the data set were very large, this might be unfeasible.  Is there another way to determine the important frequencies?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1330" LastEditorUserId="6" LastEditDate="2012-08-27T18:33:16.470" LastActivityDate="2012-08-27T18:33:16.470" Title="Signal Reconstruction after fourier transform" Tags="|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3232" PostTypeId="2" ParentId="3228" CreationDate="2012-08-26T21:13:10.713" Score="2" Body="&lt;p&gt;You should go to see &lt;strong&gt;wavelet transform&lt;/strong&gt;, which uses the filter-bank structure to process signals. In a forward wavelet transform, it decompose a signal using &lt;strong&gt;down-sampling&lt;/strong&gt; techniques; and in a inverse wavelet transform, it reconstructs a signal using &lt;strong&gt;up-sampling&lt;/strong&gt; techniques. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a quick explanation, here is an example. Suppose you have a signal $S$ with a bandwidth of 1000Hz. Say there are a high-pass filter $f_h$ and a low-pass filter $f_l$ and they are carefully designed so that each of them allows a half of bandwidth of the signal $s$ to pass. As a result, after passing $f_h$, the original signal $S$ will have a filtered version $S_h$ with a band-width of 500Hz. Similarly, it will have $S_l$ with a band-width of 500Hz. This is an example of &lt;strong&gt;down-sampling&lt;/strong&gt;. Why we want to do this down-sampling? Because we can now treat signal components differently. For example, say there is noise in the low frequency. By using this technique, you can filter only low-frequency components but leave all high-frequency component in safe. Once you finish, you can &lt;strong&gt;up-sampling&lt;/strong&gt; $S_h$ and a filtered $S_l'$, and reconstruct a denoised signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an image signal, up-sampling/down-sampling can be considered as one way to resize an image. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2012-08-26T21:13:10.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3233" PostTypeId="2" ParentId="3231" CreationDate="2012-08-26T22:00:39.747" Score="2" Body="&lt;p&gt;Suppose you want to perform &lt;code&gt;N&lt;/code&gt; points FFT, then the evenly spaced frequency vector is given by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  f= (0:NumUniquePts-1)*Fs/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;NumUniquePts = ceil((N+1)/2)&lt;/code&gt; is the number of unique points in &lt;code&gt;f&lt;/code&gt;, and &lt;code&gt;Fs&lt;/code&gt; is the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if &lt;code&gt;fftx=fft(x,N)&lt;/code&gt;, then $\alpha_1$ = fftx[15/(Fs/N)+1] and $\alpha_2$ = fftx[40/(Fs/N)+1] (provided 15 and 40 can be divided by &lt;code&gt;Fs/N&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://www.mathworks.com/support/tech-notes/1700/1702.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for more.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastActivityDate="2012-08-26T22:00:39.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3234" PostTypeId="2" ParentId="2589" CreationDate="2012-08-27T01:13:49.537" Score="1" Body="&lt;p&gt;I think it could be one of two issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is your frame overlap? if the frame overlap is something less than 40% or so you will begin to get undesired artefacts when you perform overlap add synthesis at the end. Try an overlap of 50-80% (although more computationally expensive, it provides greater frequency resolution). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second consideration which goes hand in hand with the above suggestion. Are you using any kind of analysis window on your framed signal? Perhaps try using a tapered window such has hamming, Blackmann or Hanning. This will help minimise spectral leakage between frames. Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1871" LastActivityDate="2012-08-27T01:13:49.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3235" PostTypeId="2" ParentId="1157" CreationDate="2012-08-27T01:56:26.743" Score="1" Body="&lt;p&gt;You can try active contours. Although it maybe slow, it can handle complicate case like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can use some prior knowledge to process this image. For example, you know that blob thing is 'big' and 'connected'. Thus when you count the number of each connected region, you can find it. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2012-08-27T01:56:26.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3236" PostTypeId="2" ParentId="2785" CreationDate="2012-08-27T15:39:47.427" Score="1" Body="&lt;p&gt;I would suggest you to use an adaptive filter for removing the 50Hz baseline noise. &#xA;an lms adaptive filter would do just fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xk = sin(2*pi*50*t1);&#xA;dk = ecg1; &#xA;bk = [0 0 0];                       %Gewichteter Vektor (FIR Koefizienten mit Anfangswert 0)&#xA;                                    %Die Werte ändern sich ständig bis sich&#xA;                                    %das System adaptiert hat&#xA;&#xA;mu = .1;                            %Konvergenzgeschwindigkeit des Algorithmes.&#xA;                                    %( 0 &amp;lt; mu &amp;lt; 1/(20*(L+1)*Potenz_xk); L Filterorder)                                &#xA;Pot_x=mean(xk.*xk);&#xA;%mu=1/(100*(L+1)*Pot_x);            % Konvergenzgeschwindigkeit des Algorithmus.&#xA;                                    % Bei den Prädiktiven Adaptiven filter&#xA;                                    % gilt die Potenz nicht&#xA;&#xA;&#xA;&#xA;&#xA;yk=zeros(size(xk));                 % Ausgangssignal zum Zeitpunkt t=0 von der FIR.&#xA;ek=zeros(size(xk));                 % Fehlersignal zum ZEitpunkt t=0.&#xA;&#xA;%Algorithmus für FIR Adaptiven Filter:&#xA;for n = 3:(punkte - 1)                          %Arranca en 3 porque tiene que almacenar las dos muestras anteriores y la actual (FIR de 2 coeficientes)&#xA;    xkn = [xk( n ) xk( n - 1 ) xk( n - 2 )];    %Vector niésimo (2 posiciones porque son dos coeficientes).&#xA;    yk(n) = xkn * bk';                          %Resultado parcial de la salida por el vector bk traspuesto.&#xA;    ek(n) = dk(n) - yk(n);                      %Señal de error parcial.&#xA;    bk = bk + 2*mu*ek(n)*xkn;                   %Actualización instante a instante del vector de pesos.  &#xA;end                                             %Ende des adaptiven Algorithmes.&#xA;&#xA;Eje1 = figure(1);&#xA;set(Eje1,'name','Übung 1: FIR Adaptive Filter','position',[10 10 900 650]);&#xA;subplot( 2, 1, 1 );&#xA;plot( t1, xk, 'r');&#xA;xlabel('n');&#xA;ylabel('EKG mit Rauschen');&#xA;title('Eingangssignal: Bewegungsartifakt zu filtern');&#xA;subplot( 2, 1, 2 );&#xA;plot( t1, ek, '-k');&#xA;xlabel('n');&#xA;ylabel('d[k] - y[k]');&#xA;title('Ausgangssignal: EKG ohne Rauschen');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1872" LastEditorUserId="90" LastEditDate="2012-08-27T15:52:19.353" LastActivityDate="2012-08-27T15:52:19.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3237" PostTypeId="1" CreationDate="2012-08-27T15:58:48.727" Score="2" ViewCount="64" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/3238/breaking-the-input-signal-into-segments-while-calculating-dft&quot;&gt;breaking the input signal into segments while calculating DFT&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;Im reading a book about DSP and there is an example about investigating the sound that travel through the ocean. The sound was recorded as the time-domain signal and they tried to analyze it in frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input signal was broke up into 256 point segments. Each of these segments is multiplied by the Hamming window, then run through a 256 point DFT. The resulting frequency spectra are then averaged to form a single 129 point frequency spectrum. Please take a look at the figure &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a7HFI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please help me to clarify these questions or show me materials with which I can read to understand (I'm a student and brandnew to DSP): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How they break up the input signal into 256 segments?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How each segment was multiplied with the Hamming window?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How they calculate 256 DFT points?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How the frequency spectra was averaged?&lt;/p&gt;&#xA;" OwnerUserId="1864" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-08-27T16:15:38.950" Title="how to break the input signal into segments while calculating DFT" Tags="|fft|discrete-signals|dft|" AnswerCount="0" CommentCount="1" ClosedDate="2012-08-27T17:40:33.717" ContentLicense="CC BY-SA 3.0" />
  <row Id="3238" PostTypeId="1" AcceptedAnswerId="3239" CreationDate="2012-08-27T13:36:16.313" Score="6" ViewCount="6772" Body="&lt;p&gt;Im reading a book about DSP and there is an example about investigating the sound that travel through the ocean. The sound was recorded as the time-domain signal and they tried to analyze it in frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input signal was broke up into 256 point segments. Each of these segments is multiplied by the Hamming window, then run through a 256 point DFT. The resulting frequency spectra are then averaged to form a single 129 point frequency spectrum. Please take a look at the figure  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/j5nF6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How they break up the input signal into 256 segments?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How each segment was multiplied with the Hamming window?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How they calculate 256 DFT points?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How the frequency spectra was averaged?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1864" OwnerDisplayName="Mai" LastActivityDate="2012-08-27T16:20:54.343" Title="breaking the input signal into segments while calculating DFT" Tags="|matlab|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3239" PostTypeId="2" ParentId="3238" CreationDate="2012-08-27T13:50:28.200" Score="9" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How they break up the input signal into 256 segments?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is usually done by a sliding a window of a given width (here 256). Depending on the step-size this results in overlapping (if smaller than 256) or non-overlapping (if equal or larger than 256) data segments.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How each segment was multiplied with the Hamming window?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Usually, by an element-wise multiplication.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How they calculate 256 DFT points?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The number of DFT points is, if I am not mistaken, determined by the length of the input signal.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How the frequency spectra was averaged?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All resulting spectra were summed up and divided by the number of spectra. &lt;/p&gt;&#xA;" OwnerUserId="1874" OwnerDisplayName="H.Muster" LastActivityDate="2012-08-27T13:50:28.200" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3240" PostTypeId="2" ParentId="3238" CreationDate="2012-08-27T14:13:47.543" Score="3" Body="&lt;p&gt;The code for this could look something like this (assuming you're only interested in magnitude informations of the spectrum):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;clc;&#xA;&#xA;input_signal = sin(2*pi*.2*[1:256*1024]).'; %sine at frequency .2 (n=51.2)'&#xA;&#xA;for idx = 1:length(input_signal)/256&#xA;     %take a slice from the input vector&#xA;    slice = input_signal(1+(idx-1)*256:idx*256);&#xA;    %multiply it with the window and transform it into frequency domain&#xA;    spectrum = fft(slice.*hamming(256));&#xA;    %get the spectrum magnitude at each of the 256 frequency points and store it&#xA;    mag_spectrum(:,idx) = abs(spectrum).^2;&#xA;end&#xA;&#xA;%for each frequency, take the mean value of the magnitude (mean along rows, thus the .')&#xA;mean_spectrum = mean(mag_spectrum.');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that, the vector mean_spectrum contains positive and negative frequencies (positive frequencies at indexes 2..128, negative frequencies (-fs/2 first!) at indexes 129..256, DC at index 1). Thus, I assume the output vector of length 128 averages positive and negative frequencies. You could obtain this by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output_vec(1) = mag_spectrum(1);&#xA;output_vec(2:128) = 1/2*(mag_spectrum(2:128)+mag_spectrum(256:-1:130));&#xA;output_vec(129) = mag_spectrum(129);&#xA;plot(output_vec);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in a peak in the spectrum at approx. n = 52, as expected. If you want to track the frequency components of the signal over time, you might use a Short-Time-Fourier-Transformation instead.&lt;/p&gt;&#xA;" OwnerUserId="1877" OwnerDisplayName="Christian Reimer" LastActivityDate="2012-08-27T14:13:47.543" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="3241" PostTypeId="1" CreationDate="2012-08-28T01:10:29.163" Score="6" ViewCount="2400" Body="&lt;p&gt;This post also contributes to the post at &lt;a href=&quot;https://dsp.stackexchange.com/questions/2736/step-by-step-camera-pose-estimation-for-visual-tracking-and-planar-markers&quot;&gt;Step by Step Camera Pose Estimation for Visual Tracking and Planar Markers&lt;/a&gt; by Jav_Rock (since I cannot add any comment there and I don't know why)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It can be seen that the translation vector 1x3 and rotation matrix 3x3 can be derived from homography matrix.&lt;/li&gt;&#xA;&lt;li&gt;However, the following question is:  &lt;strong&gt;Where are the camera coordinate system and object coordinate system and how are they attached to the camera (or object) ?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;There is the relative transformation between the two but the computation from homography or transformation matrix implies nothing about these coordinate systems' location &amp;amp; direction&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, how to solve the pose estimation problem ?&lt;/p&gt;&#xA;" OwnerUserId="1875" LastEditorUserId="46891" LastEditDate="2020-03-28T13:04:23.420" LastActivityDate="2020-03-28T13:04:23.420" Title="Pose from Homography matrix - Zhang method" Tags="|computer-vision|estimation|camera-pose|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3242" PostTypeId="2" ParentId="3241" CreationDate="2012-08-28T07:53:26.553" Score="2" Body="&lt;p&gt;The coordinate system you choose is completely arbitrary, as no information about real-world coordinates can be inferred. From an image of a table there is no reason to know that one leg is located at any particular $(X, Y, Z)$, or that it is any particular size (you can't tell if it's a doll's table or a giant's table).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally you would choose one of your cameras to be located at the origin, looking down the $z$ axis, defined by the matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[R|t] = \begin{bmatrix} 1&amp;amp;0&amp;amp;0&amp;amp;0 \\ 0&amp;amp;1&amp;amp;0&amp;amp;0 \\ 0&amp;amp;0&amp;amp;1&amp;amp;0 \end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then due to the scale ambiguity you would have to choose an arbitrary scale, for example if you are using a stereo camera you could set the distance between the cameras to be one unit distance.&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2012-08-28T07:53:26.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3243" PostTypeId="1" AcceptedAnswerId="3244" CreationDate="2012-08-28T08:10:48.420" Score="4" ViewCount="555" Body="&lt;p&gt;For which filters, does the resulting signal have the same integral (/average) as the original? Obviously this is true for a moving average, but is it also mathematically true for e.g. a Butterworth filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to build a lowpass filter for a signal of measurement samples. While there is a lot of noise, the average (over a sizable number of samples) is correct. I need to filter it retaining that property, regardless of the input frequency spectrum.&lt;/p&gt;&#xA;" OwnerUserId="1879" LastActivityDate="2012-08-28T09:33:17.663" Title="Do lowpass filters affect the integral over the signal?" Tags="|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3244" PostTypeId="2" ParentId="3243" CreationDate="2012-08-28T09:33:17.663" Score="9" Body="&lt;p&gt;You need a filter whose transfer function evaluated at 0 (DC component) is 1, or equivalently, whose impulse response sums to 1.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-28T09:33:17.663" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3245" PostTypeId="1" CreationDate="2012-08-28T09:23:39.227" Score="2" ViewCount="1074" Body="&lt;p&gt;Consider a linear chirp signal, i.e. $f(t) = f_0 + kt$, where $f_0$ is the starting frequency, and $k$ is the chirp rate. After applying an FFT, how would I find the starting frequency and chirp rate?&lt;/p&gt;&#xA;" OwnerDisplayName="Saira Bashir" LastEditorUserId="35" LastEditDate="2012-08-28T16:10:12.160" LastActivityDate="2014-11-21T17:49:20.197" Title="How can the FFT be used for estimating linear chirp parameters?" Tags="|fft|linear-chirp|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3246" PostTypeId="1" CreationDate="2012-08-28T10:57:56.323" Score="2" ViewCount="1026" Body="&lt;p&gt;I know very little DSP beyond an intro undergrad course. I was looking to write a C algorithm that takes ADC samples and determines if a specific frequency is present (in the range of 100KHz); not caring about any other components of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure where to start. I looked at Goertzel algorithm; would this be a recommendable approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if it is feasible to analyse a signal at 100KHz with a ARM micro controller, or will I need a special DSP breed?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I even be tackling this with a PLL or something similar? If so, does anyone have some design references?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1880" LastEditorUserId="6" LastEditDate="2012-09-04T16:12:21.623" LastActivityDate="2012-09-04T16:12:21.623" Title="Detect presence of a specific frequency (or lack thereof)" Tags="|filters|algorithms|frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3247" PostTypeId="2" ParentId="3246" CreationDate="2012-08-28T11:17:50.317" Score="0" Body="&lt;p&gt;If you are familiar with discrete fourier transform, it is basically a correlation with sine waves and cosine waves for every possible frequency. So if you are interested in only one specific frequency you could perform a correlation with a sine and cosine of the frequencies you are interested in. Another method is to use a band pass filter, using an IIR filter you can get some really efficient algorithms, this will let you get frequencies which are close to you target frequency if that is what you want.&lt;/p&gt;&#xA;" OwnerUserId="1144" LastActivityDate="2012-08-28T11:17:50.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3248" PostTypeId="2" ParentId="3246" CreationDate="2012-08-28T11:42:01.463" Score="5" Body="&lt;p&gt;Regarding the implementation question, maybe you could tell us more about your hardware: ARM family (cortex M3 or M4?), clock rate...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fixed-point implementation of the Goertzel algorithm is a dozen instructions, so this would indeed be doable with a sample rate of 1 MHz on a low-end ARM micro (say STM32F1 or LPC1343) clocked at 72 MHz (assuming you don't have much overhead for reading your ADC, eg. by letting the DMA subsystem handle this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You might hit the upper range of your ADC sample rate, and/or will have little margin to design your anti-aliasing filter (say 105kHz is the upper frequency of interest... You can sample at 210kHz but will need the steepest anti-aliasing filter... Or at 800kHz and have more margin for the transition band of your anti-aliasing filter).&lt;/li&gt;&#xA;&lt;li&gt;This still looks like a waste of CPU cycles, especially if you are only interested in a narrow band of the signal. Keep in mind that if the only thing that interests you is the 99kHz to 101kHz band, you actually need a sample rate of just 4kHz to capture all the useful information - provided you have a mean of modulating the input signal by a 100kHz sine wave.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In such situations, and if you control the target hardware, a bit of pre-processing in the analog domain could be handy, such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Frequency shifting your signal by 100kHz so the band of interest becomes the base-band and so that you can sample it at a low sample-rate (requires a sine oscillator, a multiplier, and a low-pass filter).&lt;/li&gt;&#xA;&lt;li&gt;Applying a narrow band-pass filter in the area of interest + rectifier + low-pass filter - this would measure the energy of the frequency band of interest.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-28T11:42:01.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3249" PostTypeId="1" CreationDate="2012-08-28T15:44:42.173" Score="4" ViewCount="2709" Body="&lt;p&gt;I'm trying to implement a software audio modem with FSK to transmit and receive short digital data between two devices (e.g. a PC and an iPhone) so I'm simulating simple cases study using Scilab/MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I can reconstruct the original signal when no noise nor background sound is present, problems arise when playing the afsk in presence of normal ambient background sounds: trying to reconstruct the digital data reading from the PC microphone is extremely difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To generate the AFSK signal I use this simple script below, then I save the wav file to disk for the next steps.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function s = fsk (bit, f1, f2, fs, T)&#xA;% bit : Array of bit&#xA;% f1: Frequency 1&#xA;% f2: Frequency 2&#xA;% fs: Sampling frequency&#xA;% T : Tramsision period for 1 bit&#xA;    t=0:1/fs:T-1/fs;&#xA;    s=[];&#xA;    for i=1:length(x)&#xA;        s=[s (bit(i)==0)*sin(2*pi*t*f1)+(bit(i)==1)*sin(2*pi*t*f2)];&#xA;    end    &#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The frequency &lt;code&gt;f1&lt;/code&gt;, &lt;code&gt;f2&lt;/code&gt; I choose can vary: $3000\textrm{ Hz}$ and $4000\textrm{ Hz}$ or $3000\textrm{ Hz}$ and $5000\textrm{ Hz}$. &lt;/li&gt;&#xA;&lt;li&gt;The frequency sampling is $44100\textrm{ Hz}$ and the period of transmission is $0.01\textrm{ sec}$ (for the moment I don't bother with higher trasmission rate). &lt;/li&gt;&#xA;&lt;li&gt;The bit array is a very simple $[\textrm{0 1 0 1 0...}]$ sequence.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I read-back the wav file I decode it using a simply coherent demodulation in these 3 step scheme:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Pass-band the signal with a FIR filter around $5000\textrm{ Hz}$ created using the command &lt;code&gt;fir1(91,[2*4900/fs 2*5100/fs])&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiply the filtered signal by the &lt;code&gt;f2&lt;/code&gt; (mark) carrier &lt;code&gt;sin(2*pi*f2*t)&lt;/code&gt; (or multiply the signal with a 1 sample-delayed version of itself)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Low-pass the multiplied signal obtained in step 2 to isolate the low frequency component of the original digital signal using LP FIR filter generated with &lt;code&gt;fir1(61, 2*500/fs)&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The original sequence of bit is now almost perfectly reconstructed. I've played a bit around with the filters parameters to obtain a good recontruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KoIub.png&quot; alt=&quot;Reconstructed bit stream&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I decided to play the wav file on my stereo with normal background noise present (actually very low), I recorded it with the pc microphone and saved with Audacity, read it back with MATLAB/scilab and I tried to reconstruct the original bit sequence with the 3 steps above but the signal is a bit different from what I expected and I can't see the original pattern and I don't know I to recontruct the bit sequence using any treshold value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Qg4S.png&quot; alt=&quot;Noisy bit-stream&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose the cause is the SNR is awesome but I don't know where I'm wrong and I don't understand why the results are so different than the previous case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I reconstruct the correct bit stream sequence in presence of background noise ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&#xA;Do I have to low-pass filter the modulated signal before send it to the receiver ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion will be very appreciated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Well...it seems that my recording system was buggy ,as Jim pointed out !&#xA;I played and recorded the sound using the speakers and mic on the same PC so this introduced some indesiderable feedback or filtering or something else I suppose.&#xA;Now I'm using an external device to play the sound (a smartphone) and the recorded signal is much better. This is the signal transmitted&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KoIub.png&quot; alt=&quot;Hello world !&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this is the decoded signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Qg4S.png&quot; alt=&quot;fsk decoded&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a bandpass filter centered around the mark and space frequency before transmit it. The decoding steps are the same as before but in step 2 I'm using the slicing method correlating the signal with the delayed version of itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reconstructed FSK signal has now a much better SNR than before. Now should be easy to recover the exact bit sequence....&lt;/p&gt;&#xA;" OwnerUserId="1884" LastEditorUserId="1629" LastEditDate="2016-06-14T03:13:17.347" LastActivityDate="2016-06-14T03:13:17.347" Title="Demodulation of noisy AFSK signal" Tags="|demodulation|fsk|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3250" PostTypeId="2" ParentId="3182" CreationDate="2012-08-28T16:45:47.740" Score="5" Body="&lt;p&gt;You can design the different filter types directly with the scipy.signal functions.&#xA;There are three main functions for creating &#xA;finite impulse response filters with the scipy.signal&#xA;package.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;signal.remez&lt;/li&gt;&#xA;&lt;li&gt;signal.firwin&lt;/li&gt;&#xA;&lt;li&gt;signal.firwin2&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;remez&lt;/em&gt; function, as arguments, takes the number of taps &#xA;(order+1), the &quot;bands&quot;, and the &quot;desired&quot; gain.  The &#xA;&quot;bands&quot; is in Hz.  This funciton is a little odd that the &#xA;&quot;Hz&quot; parameter defines the sample rate in Hz.  An example&#xA;would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy import signal&#xA;b = signal.remez(64, [0, 80, 100, 200, 220, 500], [0, 1, 0], Hz=1000)&#xA;plot(20*log10(abs(fft.fft(b, 4096).)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nsC8k.png&quot; alt=&quot;Frequency Response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I cheated a little bit and used a higher order FFT to &#xA;make the plot look a little nicer (interpolated the points&#xA;for visualization only).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lowpass and highpass examples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bl = signal.remez(64, [0, 248, 252, 500], [1, 0], Hz=1000) #lowpass&#xA;bh = signal.remez(64, [0, 248, 252, 500], [0, 1], Hz=1000) #highpass&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;firwin&lt;/em&gt; function takes the number of taps again and the cutoff&#xA;as arguments.  The cutoff can be multiple values as a list to define bandpass and &#xA;stopband filters.  The default units for the cutoff is normalized&#xA;frequency where the nyquist cutoff is 1 and the sample rate would &#xA;be 2.  This can be modified by setting /nyq/.  Using the examples &#xA;above the firwin would be called as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = signal.firwin(64, [100, 200], pass_zero=False, nyq=500)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;firwin2&lt;/em&gt; is closer to the remez funcion.  But instead of &#xA;passing gains for the bands you pass gains at the cutoffs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = signal.firwin2(64, [0, 100, 200, 500], [0, 1, 1, 0], nyq=500)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More examples available &lt;a href=&quot;http://bit.ly/yqUCLe&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="306" LastActivityDate="2012-08-28T16:45:47.740" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3251" PostTypeId="1" CreationDate="2012-08-28T21:52:10.260" Score="7" ViewCount="1103" Body="&lt;p&gt;I'm trying to process an 1D signal containing a waveform of 100000 pixel.&#xA;As it was acquired with a laser scanning system, and therefore it is corrupted by some annoying speckle noise.&#xA;I tried to prefilter it with a well-known type of non-linear image processing filter such as Lee and Kuan filters, obviously modified for the 1D nature of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2784081/&quot; rel=&quot;noreferrer&quot;&gt;http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2784081/&lt;/a&gt; (see citation 5,7)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the resulting signal is identical to the result of a &quot;naive&quot; mean filter with the same support size (e.g. 15 px).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it an &quot;expected&quot; behaviour due to the 1D processing or am I probably writing wrong code?&#xA;Can you link me some working code for these algorithms or some other speckle reducing ones?&#xA;I found some source code on codeforge, but I think the Lee and Kuan algorithm are not correctly implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;added some images of the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) original&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nTn9e.jpg&quot; alt=&quot;original&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) mean 1x15&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RupaG.jpg&quot; alt=&quot;mean 1x15&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) mean 1x15 with superimposed kuan filter 1x15 with input parameters  nm = 1.0 and nv = 0.1&#xA;&lt;img src=&quot;https://i.stack.imgur.com/l4jfh.jpg&quot; alt=&quot;kuan filter 1x15 with nm = 1.0 and nv = 0.1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) mean 1x15 with superimposed kuan filter 1x15 with input parameters  nm = 1.0 and nv = 0.2&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Px1vO.jpg&quot; alt=&quot;kuan filter 1x15 with nm = 1.0 and nv = 0.2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) mean 1x15 with superimposed kuan filter 1x15 with input parameters  nm = 1.0 and nv = 0.3&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PobsP.jpg&quot; alt=&quot;kuan filter 1x15 with nm = 1.0 and nv = 0.3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see in 3,4,5 that there're no differences by mean and kuan: the mean signal is exactly coinciding with the kuan filter one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that at the pixel 50569, where there is an exampe of the speckle I want to reduce, the local mean is 121.666 and local variance is 16.755. Therefore it can be found that an estimation of the noise variance is 0.13771, then I tried the parameters according to said observation.&#xA;Further, note that at pixel 50652 the signal is lower and therefore de speckle effect is lower too. There, the local mean is 40.933 and local variance is 4.195 and the ratio is 0.102, therefore in the order of the ratio on an high peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you again for your attention&lt;/p&gt;&#xA;" OwnerUserId="1858" LastEditorUserId="35" LastEditDate="2012-08-29T14:19:27.790" LastActivityDate="2012-10-30T14:55:33.263" Title="laser speckle noise reduction" Tags="|image-processing|filters|discrete-signals|noise|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3252" PostTypeId="1" AcceptedAnswerId="3253" CreationDate="2012-08-28T21:54:57.793" Score="4" ViewCount="1899" Body="&lt;p&gt;I've got a 1D signal (position of a servo motor over time) and I've extracted 'peaks'/'key' positions picking running average &quot;local extrema&quot; points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is are 2 plots from 2 servos and the white markers indicate key positions I'd like to interpolate between:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tTG7F.png&quot; alt=&quot;Servo ZeroX&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've played with linear interpolation, but the motion looks robotic. I'd like to get a more natural/smoother motion and I imagine it's posible by using bezier interpolation between two key points. These two points would be the start and end point of the bezier I imagine, but I need to solve/find out the 'anchor' points as well. Since I have all the points I can get the velocities as well I imagine, but not sure how to plug them into the equation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea on how I can find the other two members of a bezier equation for easing/smooth interpolation ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, since I'm new to this: is my approach ok ?  Is there a simpler solution I'm missing ?&lt;/p&gt;&#xA;" OwnerUserId="640" LastActivityDate="2012-08-28T23:16:18.023" Title="How can I smoothly interpolate between 2 position?" Tags="|interpolation|smoothing|moving-average|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3253" PostTypeId="2" ParentId="3252" CreationDate="2012-08-28T23:16:18.023" Score="4" Body="&lt;p&gt;When you talk about bezier curves, it sounds like you think about them from an &quot;illustrator&quot; point of view, which is not totally right when it comes to spline interpolation (most probably what you are looking for).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Splines are piecewise curves that pass thrhough points. Bezier curves are third degrees splines between two points, and a series of them can form what &quot;looks like&quot; a single curve in a drawing aplication, but are actually lots of individual curves tied together (it counts as if the intermediate knots are doubled).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Illustration concepts aside, I think you could choose any 1-D spline interpolator from some popular library. I use Python, so I'd go with Scipy, take a look:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/interpolate.html#d-splines&quot; rel=&quot;nofollow&quot;&gt;http://docs.scipy.org/doc/scipy/reference/interpolate.html#d-splines&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-08-28T23:16:18.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3254" PostTypeId="2" ParentId="1708" CreationDate="2012-08-29T02:38:16.937" Score="2" Body="&lt;p&gt;in my experience the process of edge detection with canny edge detector smoothens the edges before being able to detect them and the timing and the length of the filter has to be a perfect match to detect all the edges without error.&lt;/p&gt;&#xA;" OwnerUserId="1888" LastActivityDate="2012-08-29T02:38:16.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3255" PostTypeId="1" AcceptedAnswerId="3286" CreationDate="2012-08-29T08:13:52.227" Score="19" ViewCount="8030" Body="&lt;p&gt;I have read the description of the Kalman filter, but I am not clear on how it comes together in practice. It appears to be primarily targeted at mechanical or electrical systems since it wants linear state transitions and that it is not useful for anomaly detection or locating state transitions for the same reason (it wants linear state transitions), is that correct? In practice, &lt;strong&gt;how&lt;/strong&gt; does one typically find the components that are expected to be known in advance to use a Kalman filter. I have listed the components, please correct me if my understanding of what needs to be known in advance is incorrect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I believe these do not need to be known &quot;in advance&quot;:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Process noise $\mathbf w$ &lt;/li&gt;&#xA;&lt;li&gt;Observation noise $\mathbf v$ &lt;/li&gt;&#xA;&lt;li&gt;Actual state $\mathbf x$ (this is what the Kalman filter tries to estimate)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I believe these need to be known &quot;in advance&quot; to use a Kalman filter:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The linear state transition model which we apply to $\mathbf x$ (we need to know this in advance, so our states must be governed by known laws, i.e. the Kalman filter is useful for correcting measurements when the transition from one state to another is well understood and deterministic up to a bit of noise - it is not an anomaly finder or a tool to find random state changes) &lt;/li&gt;&#xA;&lt;li&gt;Control vector $\mathbf u$ &lt;/li&gt;&#xA;&lt;li&gt;Control input model which is applied to control vector $\mathbf u$ (we need to know this in advance, so to use a Kalman filter we also need to know in advance how our controls values affect the model, up to at most some gaussian noise, and the effect needs to be linear)&lt;/li&gt;&#xA;&lt;li&gt;Covariance $\mathbf Q$ of the process noise (which appears to be time dependent in the wikipedia article, i.e. it depends on the time $k$) - it appears we need to know this in advance and over time, I assume in practice it is taken as being constant?&lt;/li&gt;&#xA;&lt;li&gt;A (linear) observation model $\mathbf H$ &lt;/li&gt;&#xA;&lt;li&gt;Covariance $\mathbf R$ (which appears to also be time dependent in the wikipedia article) - similar issues to $\mathbf Q$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;P.S. And yes I know many of these depend on time, I just dropped all the subscript clutter. Feel free to imagine small letter $k$ to the right and down from each variable name if you would like to.&lt;/p&gt;&#xA;" OwnerUserId="566" LastEditorUserId="15892" LastEditDate="2016-01-22T17:54:53.403" LastActivityDate="2016-01-22T17:54:53.403" Title="Kalman filter in practice" Tags="|kalman-filters|adaptive-algorithms|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3257" PostTypeId="1" AcceptedAnswerId="3260" CreationDate="2012-08-29T16:06:12.750" Score="1" ViewCount="386" Body="&lt;p&gt;Sorry if this question seems to trivial, but I am a bit of a novice when it comes to signal and image processing and I need some guidance.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a 3D stack of about 256 grey scale images, each with pixel resolution 256x256, coming from an x-ray tomography scan of a rock sample.  I want to segment the data to isolate the void space from the solid space.  Typically I use ImageJ software to segment it using its 'auto' feature based upon a histogram of the grey-scale color values.  I am wondering if using fourier transform of the grey-scale data can somehow help me in the process.  What can the FT tell me about the image data that I can use for segmentation purposes?  &lt;/p&gt;&#xA;" OwnerUserId="1330" LastActivityDate="2012-08-30T12:50:51.000" Title="How can I use the fourier transform of a sequence of x-ray scan images to segment it?" Tags="|image-processing|fourier-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3258" PostTypeId="1" AcceptedAnswerId="3262" CreationDate="2012-08-29T16:17:43.610" Score="0" ViewCount="2655" Body="&lt;p&gt;When we plot FFT in a matlab it doesn't ask for Frequency , all we need to input the sequence and it simply shows the output using stem command.&#xA;If i want to compute two different signal using FFT, one with High and the other with Low frequency what should i suppose to do ?&#xA;and what will be the difference between the two of them ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is simple code for the FFT calculation ,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=[1 2 1 0]&#xA;n=0:3&#xA;y=fft(x)&#xA;subplot(2,2,1)&#xA;stem(n,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2012-08-30T01:51:56.340" Title="FFT of High Frequency and Low Frequency?" Tags="|fft|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3259" PostTypeId="2" ParentId="3258" CreationDate="2012-08-29T16:36:13.313" Score="0" Body="&lt;p&gt;&lt;code&gt;FFT&lt;/code&gt; is just the implementation of the mathematical formula of DFT, if you want to know something like frequency, try &lt;a href=&quot;http://www.mathworks.com/help/toolbox/signal/ref/periodogram.html&quot; rel=&quot;nofollow&quot;&gt;periodogram&lt;/a&gt; or see &lt;a href=&quot;http://www.mathworks.com/support/tech-notes/1700/1702.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1641" LastActivityDate="2012-08-29T16:36:13.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3260" PostTypeId="2" ParentId="3257" CreationDate="2012-08-29T16:44:48.637" Score="5" Body="&lt;p&gt;Cited from wiki:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;a function (of time) is a representation of a signal with perfect time resolution, but no frequency information, while the Fourier transform has perfect frequency resolution, but no time information.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the Fourier transform has no spatial information. So for segmentation, you'd better try &lt;a href=&quot;http://en.wikipedia.org/wiki/Time-frequency_analysis&quot; rel=&quot;noreferrer&quot;&gt;time-frequency analysis&lt;/a&gt;, such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Wavelet&quot; rel=&quot;noreferrer&quot;&gt;wavelet transform&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1641" LastActivityDate="2012-08-29T16:44:48.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3261" PostTypeId="1" CreationDate="2012-08-29T23:35:38.730" Score="0" ViewCount="1466" Body="&lt;p&gt;I am trying to implement a &lt;a href=&quot;http://en.wikipedia.org/wiki/Binary_offset_carrier&quot; rel=&quot;nofollow&quot;&gt;binary offset carrier&lt;/a&gt; (BOC) &lt;a href=&quot;http://en.wikipedia.org/wiki/Direct-sequence_spread_spectrum&quot; rel=&quot;nofollow&quot;&gt;direct sequence spread spectrum&lt;/a&gt; scheme in MATLAB. In that scheme, a code $c(t)$ (a binary vector which repeats after a certain number of zeros and ones) should be calculated by an other square (sub) carrier of the following form sign(sin(1*pi*fs*t) where fs is the subcarrier frequency and finally should be calculated by a carrier frequency having the usual form of a cosine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have generated the code needed (a vector of 1023 elements). These 1023 chips (vector’s elements) should be repeated every 1 ms in order for the chipping frequency to be achieved (10Mchips/s). After, that vector (code) should be multiplied by a square subcarrier of 1023 Mhz and finally by the ‘actual’ carrier (a co sinusoidal signal) of 4092 Mhz. All these should be demonstrated via plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first problem is that in order to demonstrate the spectrum of the codes, spectral nulls should be represented at frequencies multiples of 1.023 Mhz. The only way that I could somehow think how to do this is to use massive vectors where are not really supported by my laptop's memory (RAM). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I say &quot;somehow&quot;, because the sampling rate should change (for example wherever I have one ‘1’ I should add some more and the same applies to zeros). This procedure ruins the whole purpose of the code because the code has some particular autocorrelation properties which I don’t know if will continue to exist after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, if that should reach the 10Mchips how will this could be done by using the particular vector. While I understand that it is easily done by using a random vector of 10*10^6 elements. Should I repeat the 1023 chips 1000 times?&lt;/p&gt;&#xA;" OwnerUserId="959" LastEditorUserId="35" LastEditDate="2012-08-30T14:53:18.830" LastActivityDate="2013-09-21T01:02:46.307" Title="Matlab BOC (binary offset carrier)" Tags="|matlab|frequency-spectrum|sampling|matrix|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3262" PostTypeId="2" ParentId="3258" CreationDate="2012-08-30T01:51:56.340" Score="1" Body="&lt;p&gt;The frequency span of an FFT is determined by the number of samples fed into it and the sample rate of those samples.  Basically, the maximum frequency analyzed by the FFT will be half the sample rate.  The lowest frequency will be DC, and the remaining output &quot;buckets&quot; will be evenly spaced in frequency up to the (last) max frequency bucket.  The number of output &quot;buckets&quot;, in the standard implementation, is half the number of input samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Actually, the total number of outputs is equal to the number of input samples, but half the outputs are the imaginary half of complex numbers ... and at about this point my head starts to hurt.)&lt;/p&gt;&#xA;" OwnerUserId="447" LastActivityDate="2012-08-30T01:51:56.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3263" PostTypeId="2" ParentId="3261" CreationDate="2012-08-30T12:26:09.687" Score="1" Body="&lt;p&gt;First off- I know you are doing you're best (which is why I am answering) but your question is very hard to read.  Regardless of your English skills, it would be easier to read if you would break it up into paragraphs and throw in some pictures to help show what you're talking about.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;These 1023 chips (vector’s elements) should be repeated every 1 ms in order for the chipping frequency to be achieved (10Mchips/s).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;1023 chips repeated every 1 ms means you have $\frac{1023}{.001 s} = $1 Mchips/s, not 10 Mchips/s.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My first problem is that in the first place in order to demonstrate the spectrum of the codes,spectrul nulls should be represented at frequencies multiples of 1.023 Mhz.The only way that I could somehow think how to do this is to use massive vectors where are not really supported by my laptops memory (RAM).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You should not need a &quot;massive&quot; vector to demonstrate this.  Increasing the number of samples that you FFT just gets you better frequency resolution- it doesn't change the frequency range.  I think that you should be able to see the nulls just fine with several repetitions of the spreading code.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I say somehow because the sampling rate should change (for example wherever I have one ‘1’ I should add some more and the same applies to zeros).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have no idea why you say that the sampling rate should change, unless you're talking about going from the unspread rate to the spread rate.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-08-30T12:26:09.687" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3264" PostTypeId="2" ParentId="3257" CreationDate="2012-08-30T12:45:06.733" Score="1" Body="&lt;p&gt;If I am understanding what you're asking for, you're looking for an algorithm that uses the FT for image segmentation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) the FT will tell you where in your image is there a high&#xA;    frequency component. High frequency components represent points&#xA;    where there are large jumps in pixel values, i.e., segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Segmentation is not done in the FT domain, but rather the image&#xA;    domain.  Typically because of 1) above, you will almost always use a high pass filter (such as roberts cross or sobel filter) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Given 2), The best thing you can do is look into Canny Edge Detection, it's a major algorithm used in image processing for segmentation. (&lt;a href=&quot;http://www.tomgibara.com/computer-vision/canny-edge-detector&quot; rel=&quot;nofollow&quot;&gt;here is a java implementation of the algorithm&lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can find more information in Digital Image Processing By Gonzalez &amp;amp; Woods&lt;/p&gt;&#xA;" OwnerUserId="1183" LastEditorUserId="1183" LastEditDate="2012-08-30T12:50:51.000" LastActivityDate="2012-08-30T12:50:51.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3265" PostTypeId="1" AcceptedAnswerId="3266" CreationDate="2012-08-30T13:14:11.290" Score="1" ViewCount="4199" Body="&lt;p&gt;I'm trying to test the &lt;code&gt;specgram&lt;/code&gt; function located in the signal package in octave but I'm a little confused at the variables in &lt;code&gt;specgram&lt;/code&gt;.  What I would like to do is be able to get the &lt;code&gt;specgram&lt;/code&gt; data into an array that will show the frequency and the length of time when the frequency starts and stops. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See example code below: I was trying to get the array to show that for the length of &lt;code&gt;t1&lt;/code&gt; will be $7 \textrm{ Hz}$, &lt;code&gt;t2&lt;/code&gt; will be $12\textrm{ Hz}$ and for &lt;code&gt;t3&lt;/code&gt; will be $2\textrm{ Hz}$.  How can I go about doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using ubuntu 12.04 and octave 3.2.4 and the signal pacakage 1.0.11&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% combines sig with spectra plot&#xA;clear all,clc,tic;&#xA;fs=1000;&#xA;t1=linspace(0,2*pi,fs/0.1); %need to round off no decimals&#xA;t2=linspace(0,2*pi,fs/0.3); %need to round off no decimals&#xA;t3=linspace(0,2*pi,fs/0.6); %need to round off no decimals&#xA;&#xA;%Create signal in different arrays&#xA;y1=sin(7*t1);&#xA;y2=sin(12*t2);&#xA;y3=sin(2*t3);&#xA;&#xA;%append arrays to test specgram&#xA;yt = [y1 y2 y3];&#xA;&#xA;&#xA;%plot(yt) %will show combined plot&#xA;&#xA;%Spectrum section&#xA;yts=specgram(yt',20,500, 2,1);&#xA;plot(yts)&#xA;fprintf('\nfinally Done-elapsed time -%4.4fsec- or -%4.4fmins- or -%4.4fhours-\n',toc,toc/60,toc/3600);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1894" LastEditorUserId="1629" LastEditDate="2016-05-13T07:58:37.253" LastActivityDate="2016-05-13T07:58:37.253" Title="Spectrogram for created signal in Octave" Tags="|fft|matlab|spectrogram|stft|octave|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3266" PostTypeId="2" ParentId="3265" CreationDate="2012-08-30T14:25:12.543" Score="1" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 100;&#xA;t = 0:1/fs:10;&#xA;x = [sin(2*pi*7*t), sin(2*pi*12*t), sin(2*pi*2*t)];&#xA;specgram(x,256,1000, [],200);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have reduced the sampling frequency because the three frequencies in your signal are quite low. In the specgram() function, I have increased the FFT size to 256 and used the default hanning(256) window with 200/256 $\approx$ 80% overlap.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GXT9G.jpg&quot; alt=&quot;You can see three horizontal lines at the three frequencies of interest.&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1825" LastActivityDate="2012-08-30T14:25:12.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3267" PostTypeId="1" AcceptedAnswerId="3269" CreationDate="2012-08-30T15:34:48.903" Score="3" ViewCount="477" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1637/what-does-frequency-domain-denote-in-case-of-images&quot;&gt;What does frequency domain denote in case of images?&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;If we look deeply into Digital Images they are purely generated by the pixels distributed in rows and coloumn and the pixel consists of number of certain bits which define the complete Image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then what is the role of Frequency in generating Digital Images ? like many people says that in Digital Image processing and Image Compression, Wavelets is much more efficient than Discrete Cosine Transform as Wavelets gives the information of both time and Frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know what role does frequency and time plays in producing a Digital image, does it has to do something with pixels?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-08-30T16:13:45.950" Title="What is the role of Freqency in Digital Images" Tags="|frequency|image-processing|time-frequency|" AnswerCount="1" CommentCount="1" ClosedDate="2012-10-13T17:58:02.700" ContentLicense="CC BY-SA 3.0" />
  <row Id="3268" PostTypeId="1" CreationDate="2012-08-30T15:34:49.600" Score="3" ViewCount="830" Body="&lt;p&gt;I am new to Digital Signal Processing, and am reading a paper. I don't know how they can extract some features from signal, like root mean square (RMS), Constant False Alarm Rate - CFAR, Mean Value Dispersion Statistic – MVD, Ratio of Power – ROP, and Autocorrelation from a signal, as shown in the following figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aXRp3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please help explain to me how, and, if it is possible, could you please show me some code to get them? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to write some codes to calculate these parameters. Could you please take a look:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;RMS&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i= 1:floor(time(end)/tPeriod)  &#xA;    tBegin = (i-1)*tPeriod;  &#xA;    tEnd = i*tPeriod;  &#xA;    index = find((time&amp;gt;=tBegin)&amp;amp;(time&amp;lt;tEnd));  &#xA;    RMS(i) = sqrt(mean(data(index).^2));    %equation 1  &#xA;    tPlot = [tPlot tEnd];  &#xA;end  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;CFRA&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i= 1:floor(time(end)/tPeriod)  &#xA;    tBegin = (i-1)*tPeriod;  &#xA;    tEnd = i*tPeriod;  &#xA;    indexTime = find((time&amp;gt;=tBegin)&amp;amp;(time&amp;lt;tEnd));  &#xA;    y = fft(data(indexTime),M)/M;   % M is the number of fft points  &#xA;    y = 2*abs(y);  &#xA;    df = fMax/M;  &#xA;    f = [0:M-1]*df;  &#xA;    indexF = find((f&amp;gt;=n1)&amp;amp;(f&amp;lt;n2));  &#xA;    CFAR(i) = sum(y(1:M/2)).^v;  &#xA;    tPlot = [tPlot tEnd];  &#xA;end  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;ROP&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i= 1:floor(time(end)/tPeriod)  &#xA;    tBegin = (i-1)*tPeriod;  &#xA;    tEnd = i*tPeriod;  &#xA;    indexTime = find((time&amp;gt;=tBegin)&amp;amp;(time&amp;lt;tEnd));  &#xA;    y = fft(data(indexTime),M)/M;  &#xA;    y = 2*abs(y);  &#xA;    df = fMax/M;  &#xA;    f = [0:M-1]*df;  &#xA;    indexF = find((f&amp;gt;=n1)&amp;amp;(f&amp;lt;n2));  &#xA;    ROP(i) = sum(y(indexF).^2)/sum(y.^2);  &#xA;   tPlot = [tPlot tEnd];  &#xA;end  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1873" LastEditorUserId="29" LastEditDate="2012-08-31T14:09:51.590" LastActivityDate="2012-08-31T14:09:51.590" Title="calculate root mean square, ratio of power, constant false alarm, ... of a signal" Tags="|fft|matlab|discrete-signals|signal-detection|analytic-signal|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3269" PostTypeId="2" ParentId="3267" CreationDate="2012-08-30T16:05:59.847" Score="5" Body="&lt;p&gt;You can take images as 2D &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_signal&quot;&gt;discrete signals&lt;/a&gt;. The &quot;time&quot; in 1D signals is actually two spatial dimensions in images (2D signals).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can measure &quot;frequency&quot; as well - imagine a line of white pixels with regular spacing. The spacing represents period $p$, and frequency is given by $1/p$. Hence the maximum frequency the discrete signal can contain is limited by the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating a digital image, sampling can cause new frequencies to appear due to aliasing. See &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist_frequency&quot;&gt;Nyquist frequency&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier and wavelet transforms have discrete variants to work with discrete signals - very simply said: integrals are replaced by sums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelets are more efficient in image compression, because they can deal with localized redundancies. Simply look of DFT of a grey square on black background and then on DWT of that square.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DWT will exploit transitions of the square shape in high fequency layer, and other layers will be almost clear. The sharp 1px transition would be best described with Haar wavelet without any remainder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, DFT or DCT will result in many cosine functions which summed together form the edge without visible ringing artifacts (Gibbs effect).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelet have its artifacts too, but these are better localized, hence does not corrupt rest of the image (or rest of the macroblock in case of JPEG/DCT compression).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-08-30T16:13:45.950" LastActivityDate="2012-08-30T16:13:45.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3271" PostTypeId="1" AcceptedAnswerId="3273" CreationDate="2012-08-30T20:19:47.493" Score="0" ViewCount="588" Body="&lt;p&gt;What would happen if you took the STFT of a signal, discarded the phase information, and re-synthesized it? For example, just modulate oscillators tuned to each frequency bin by the amplitudes for those bins and add all of the results together for the output. Could human ears detect much of a difference? Would it make a difference depending on what kind of signal I pass through (say, a saw wave, a sound sample of a stringed instrument, and a voice)?&lt;/p&gt;&#xA;" OwnerUserId="1737" LastActivityDate="2012-08-31T20:20:43.197" Title="Discarding phase" Tags="|stft|phase|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3272" PostTypeId="1" AcceptedAnswerId="3275" CreationDate="2012-08-30T20:52:25.903" Score="6" ViewCount="9819" Body="&lt;p&gt;When i looked in to the algorithm of Salt n Pepper noise in a Matlab i've found this,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;case 'salt &amp;amp; pepper' % Salt &amp;amp; pepper noise&#xA;    b = a;&#xA;    x = rand(sizeA);&#xA;    d = find(x &amp;lt; p3/2);&#xA;    b(d) = 0; % Minimum value&#xA;    d = find(x &amp;gt;= p3/2 &amp;amp; x &amp;lt; p3);&#xA;    b(d) = 1; % Maximum (saturated) value&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which i simplified as this,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% [a, code, classIn, classChanged, p3, p4]&#xA;% p3 = density&#xA;% p4 = variance&#xA;% a = Image&#xA;% code = noise Type &#xA;% classIn = Image Class i.e unit8 , unit16, double&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;% -------- ALGORITHM ----------%&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%     b = a;   &amp;lt;-- Assign b to the input image&#xA;%     x = rand(sizeA); &amp;lt;--- Generate random pixels from the image pixels&#xA;%     d = find(x &amp;lt; p3/2); &amp;lt;--- Find the pixels whose values are less than half of the mean value  &#xA;%     b(d) = 0 &amp;lt;-- Implement minimum noise to them&#xA;%     d = find(x &amp;gt;= p3/2 &amp;amp; x &amp;lt; p3) &amp;lt;--- Find the pixels whose values are&#xA;%                                        greater than half of the mean&#xA;%                                        value &amp;amp; less than mean value&#xA;%     b(d) = 1;     &amp;lt;-- Implement maximum noise to them&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of using imnoise, I am trying to add Salt n Pepper noise manually into the image using the above algorithm,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('2.jpg');&#xA;J = rgb2gray(I);&#xA;p3=0.05 %default&#xA;b = J;&#xA;x = rand(size(b));&#xA;d = find(x &amp;lt; p3/2);&#xA;b(d) = 0; % Minimum value&#xA;d = find(x &amp;gt;= p3/2 &amp;amp; x &amp;lt; p3);&#xA;b(d) = 1; % Maximum (saturated) value&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know where the final image is stored as when i use imshow for b it show a simple image without salt n pepper noise.&#xA;Where the final image is stored ? how can i see the it ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: What does it mean by image class ? that is unit8 , unit16 ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2012-08-30T21:17:28.613" LastActivityDate="2013-06-17T18:17:32.627" Title="Adding Salt n Pepper noise into an Image manually" Tags="|image-processing|matlab|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3273" PostTypeId="2" ParentId="3271" CreationDate="2012-08-30T23:21:51.153" Score="7" Body="&lt;p&gt;Your question is tricky because it is hard to define what &quot;discarding the phase information&quot; means without specifying a practical way of doing it; but then we encounter problems/artifacts which are specific to this particular method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you mentioned STFT, let us assume phase information is suppressed by doing a STFT, keeping the magnitudes, setting to 0 or to a random number the angle, and doing the overlap-add resynthesis. You can actually hear something similar to that by using &lt;a href=&quot;http://hypermammut.sourceforge.net/paulstretch/&quot;&gt;Paul's extreme sound stretch&lt;/a&gt; with a stretch factor of 1 (be sure to grab the python code to continue your experiments).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two important observations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Pure tones get &quot;phasey&quot;, &quot;mushy&quot;, or appear modulated in amplitude. The reason is that if a signal contains a pure tone at frequency $f$, the relationship between the phase at $X(t, f)$ and $X(t + \Delta_t, f)$, where $X$ is the STFT and $\Delta_t$ the hop-size is certainly not arbitrary. Destroying this relationship will cause unwanted destructive interferences at the crossfade point of adjacent windows (giving the effect of a modulation at the analysis frame rate). Pure tones cannot exist without a coherent phase advance between successive frames.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Within an analysis window, one effect of removing the phase information is that events localized in time will be smeared all over the window during resynthesis. The perceptual effect is very dependent on the window size. When large window sizes are used, percussive events lose their definition and sharpness and sound reverberated (imagine clapping your hands in an empty room, you don't have the impression of a single &quot;hit&quot;, but of something spread in time).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All these are quite specific to the STFT implementation, and indeed highlight the challenges faced by the developers of STFT-based time-stretching algorithms - preserve the vertical phase relationships (to avoid transient smearing) and preserve the horizontal phase relationships (to keep pure tones sounding like pure tones).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're probably asking this question because you have heard the ear is not sensitive to phase - it is true in the sense that it won't tell $sin (\frac{2 \pi t}{440})$ apart from $cos (\frac{2 \pi t}{440})$). But we are sensitive to &lt;em&gt;phase coherence&lt;/em&gt; - the network of phase relationships the different elements in a time-frequency plot have between them. Any treatment breaking these relationships will be perceptible.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-08-30T23:21:51.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3274" PostTypeId="2" ParentId="3271" CreationDate="2012-08-31T01:57:41.523" Score="3" Body="&lt;p&gt;At least 2 effects: transients will be smeared and any frequency content that is between FFT bin centers (not periodic in the STFT aperture length) will be distorted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just happened to pick a note that was exactly periodic in the STFT window, then the latter effect might or might not not occur, depending on any slight inharmonicities in the overtone series, such as string instruments sometimes produce.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-08-31T20:20:43.197" LastActivityDate="2012-08-31T20:20:43.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3275" PostTypeId="2" ParentId="3272" CreationDate="2012-08-31T08:47:33.723" Score="5" Body="&lt;p&gt;It seems that the final image is in the variable &quot;b&quot;. Observe that the max (salt) and min (pepper) values are respectively 1 and 0. This indicates that your original image needs to be an intensity image with graylevels normalized to [0,1]. This may be the reason why you don't see a sensible result when you display &quot;b&quot; as an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case your image is grayscale {0,...,255} i.e. 8-bit unsigned integer format (unit8), you can change your code to assign 0 and 255 instead of 0 and 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you read the documentation on various image storage types here: &lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/f14-13543.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.mathworks.com/help/toolbox/images/f14-13543.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can get pretty confusing at times, mainly because there are so many names (intensity image, grayscale image, RGB, HSV, binary image, indexed image, etc.)&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="1825" LastEditDate="2012-08-31T09:15:55.553" LastActivityDate="2012-08-31T09:15:55.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3280" PostTypeId="2" ParentId="3211" CreationDate="2012-08-31T23:51:51.770" Score="2" Body="&lt;p&gt;I would recommend ImageJ as a start. There is a built in function to remove noise, and you can plot the before and after noise graphs by using ctrl-k. The graph clearly becomes much smoother and one should be able to derive a score by comparing either graphs&lt;/p&gt;&#xA;" OwnerUserId="1902" LastActivityDate="2012-08-31T23:51:51.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3283" PostTypeId="2" ParentId="3211" CreationDate="2012-09-01T16:23:27.440" Score="7" Body="&lt;p&gt;Simply, you can not 'calculate' the noise from single observation. Rather, you can estimate the target signal (denoised form), and then by using this estimation, you can determine the noise level. If the observation $y = x + n$ where the $x$ is target and $n$ is noise, after estimation of $x$ (via standart denoising methods), you can calculate the MSE, the SNR or other measures for noise level by using estimation $x$ and observation $y$. Of course these values will depend on the denoising method you use to estimate $x$, which can critically change the result.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2012-09-04T22:56:26.027" LastActivityDate="2012-09-04T22:56:26.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3284" PostTypeId="1" AcceptedAnswerId="14341" CreationDate="2012-09-01T19:31:48.277" Score="2" ViewCount="1272" Body="&lt;p&gt;I have the measurements of a filter’s Group delay and S-parameters.&#xA;The S-parameters are of the following form, presented in a touchstone file.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;!Agilent Technologies,N5242A,MY49421489,A.09.33.09&lt;br&gt;&#xA;  !Agilent N5242A: A.09.33.09&lt;br&gt;&#xA;  Date: Thursday, March 22, 2012 19:50:06&lt;br&gt;&#xA;  !Correction: S11(Full 2 Port(1,2)) &lt;br&gt;&#xA;  !S21(Full 2 Port(1,2)) &lt;br&gt;&#xA;  !S12(Full 2 Port(1,2)) &lt;br&gt;&#xA;  !S22(Full 2 Port(1,2)) &lt;br&gt;&#xA;  !S2P File: Measurements: S11, S21, S12, S22:&#xA;   Hz S  dB   R 50&lt;br&gt;&#xA;  1450000000 -0.44925556 132.79056 -43.664959 42.970737 -43.609634 45.291161 -0.41757283 131.60133&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The filter’s Group delay data are like those demonstrated below:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;!CSV A.01.01&#xA;  !Date: Thursday  March 22&lt;br&gt;&#xA;  !Source: Standard&lt;br&gt;&#xA;  BEGIN CH1_DATA&lt;br&gt;&#xA;  Freq(Hz)    S21 Delay(s)&lt;br&gt;&#xA;  1.45E+09    -2.02E-08&lt;br&gt;&#xA;  1.45E+09    -1.32E-08&lt;br&gt;&#xA;  1.45E+09    -1.77E-08&lt;br&gt;&#xA;  1.45E+09    -1.70E-08&lt;br&gt;&#xA;  1.45E+09    -1.56E-08&lt;br&gt;&#xA;  1.45E+09    -1.36E-08&lt;br&gt;&#xA;  1.45E+09    -1.20E-08   &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What I want to do is simulate the impact that the group delay will have on a particular waveform using MATLAB. I tried to use the fdesign.arbgrpdelay in order to insert my group delay data and somehow observe how that would impact on a waveform but I am getting the following errors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error using fdesign.abstracttype/superdesign (line 96)&#xA;Design options must be specified as a structure or as parameter-value&#xA;pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Error in fdesign.abstracttype/design (line 11)&#xA;    varargout{1} = superdesign(this, varargin{:});&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Error in allpassfilterarbitrarygrpdly (line 413)&#xA; Hgd = design(hgd,'iirlpnorm','Weights','MaxPoleRadius',0.95);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to use fdatool but I couldn't find a way of designing a filter by changing its group delay. The group delay was flat in all the available designs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone knows how I can use the Group delay measurements in matlab to simulate a filter through its group delay?&lt;/p&gt;&#xA;" OwnerUserId="959" LastEditorUserId="80" LastEditDate="2013-04-17T18:44:06.487" LastActivityDate="2015-12-05T03:17:00.630" Title="Matlab filter design,through group delay" Tags="|matlab|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3285" PostTypeId="2" ParentId="2969" CreationDate="2012-09-02T00:52:40.293" Score="4" Body="&lt;p&gt;If I understood the problem properly, we can formalize the problem as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a signal model,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y = Hx + \eta$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y$ is the observation, $H$ is the convolution operator, and $\eta$ is the noise. We want to estimate $x$ by using observation and the knowledge of characteristics of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, $\eta$ is simulated from a Poisson distribution. However, the above mentioned dictionary approaches underlie a Gaussian noise assumption. In this case, Gaussian is the convolution operator, not the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not work on signal recovery under the Poisson noise, but I googled and found &lt;a href=&quot;http://www.ljll.math.upmc.fr/~plc/jstsp1.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; may be useful. Similar approaches in that context can be useful for this problem.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastActivityDate="2012-09-02T00:52:40.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3286" PostTypeId="2" ParentId="3255" CreationDate="2012-09-02T11:53:21.993" Score="19" Body="&lt;p&gt;For some context, let's go back to the Kalman Filter equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{x}(k+1) = \mathbf{F}(k) \mathbf{x}(k) + \mathbf{G}(k) \mathbf{u}(k) + \mathbf{w}(k) \\&#xA; \mathbf{z}(k) = \mathbf{H}(k) \mathbf{x}(k) + \mathbf{v}(k)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, for a plain vanilla KF:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{F}(k)$ must be fully defined. This comes straight from the differential equations of the system. If not, you have a &lt;a href=&quot;http://www.cslu.ogi.edu/nsel/ukf/node9.html&quot;&gt;dual estimation problem&lt;/a&gt; (i.e. estimate both the state and the system model).  If you don't have differential equations of the system, then a KF isn't for you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{x}(k)$ is, by definition, unknowable. After all, if you knew it, it wouldn't be an estimation problem!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The control vector $\mathbf{u}(k)$ must be fully defined. Without additional system modelling, the only uncertainty on the control vector may be &lt;a href=&quot;http://en.wikipedia.org/wiki/Additive_white_Gaussian_noise&quot;&gt;AWGN&lt;/a&gt;, which may be incorporated into the process noise.   Known matrix $\mathbf{G}(k)$ relates the control input to the states - for example, how aileron movement affects the roll of an aircraft. This is mathematically modelled as part of the KF development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system process noise $\mathbf{w}(k)$ is also, by definition, unknowable (since it is random noise!). However, the &lt;em&gt;statistics&lt;/em&gt; of the noise must be known which, for a plain vanilla KF, must be zero mean AWGN with known covariance $\mathbf{Q}(k)$.  Sometimes, the covariance of the noise may change between samples, but in many cases it is fixed and therefore $\mathbf{Q}$ is a constant.  In some instances, this will be known, but in many instances, this will be &quot;tuned&quot; during system development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observations are a similar story. The matrix that relates your measurements to the states $\mathbf{H}(k)$ must be fully defined. Your measurements $\mathbf{z}(k)$ are also known because that's the reading from your sensors!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sensor measurements, however, are corrupted by AWGN  $\mathbf{v}(k)$, which, being random noise, is by definition unknown. The statistics of the noise must be known, which is zero mean with covariance $\mathbf{R}(k)$. Once again, the covariance may change with time, but for many applications, it is a fixed value.   Often, your sensors will have known noise characteristics from the datasheet.  Otherwise, it's not too hard to determine the mean and variance of your sensors that you need to use.  Yes, this can also be &quot;tuned&quot; empirically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a huge number of &quot;tricks&quot; that can be done to work around the restrictions in a plain vanilla KF, but these are far beyond the scope of this question.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Afterthought:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whilst googling for &quot;Kalman Filter&quot; results in a million hits, there are a couple of things that I think are worth looking at.  The &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot;&gt;wikipedia page&lt;/a&gt; is a too cluttered to learn from effectively :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On &lt;a href=&quot;http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;amp;file=viewtopic&amp;amp;t=84846&quot;&gt;AVR Freaks&lt;/a&gt;, there is an &quot;equation free&quot; intro to the Kalman Filter that I wrote some time ago to try to introduce where it is used for real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not afraid of maths, there are several books worth reading that are at the senior undergraduate/early postgraduate level. Try either &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0471128392&quot;&gt;Brown and Hwang&lt;/a&gt; which includes all the theory and plenty of example systems. The other that comes highly recommended but I have not read is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0262570483&quot;&gt;Gelb&lt;/a&gt;, which has the distinct advantage of being cheap!&lt;/p&gt;&#xA;" OwnerUserId="1904" LastEditorUserId="1904" LastEditDate="2012-09-03T10:13:16.950" LastActivityDate="2012-09-03T10:13:16.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3287" PostTypeId="2" ParentId="3211" CreationDate="2012-09-02T20:10:55.390" Score="4" Body="&lt;p&gt;In a CCD the noise is dominated by a common output amplifier (or often a separate amplifier for each quadrant) so if you take a dark frame with no photon signal the variation in the data is due only to the amplifier noise - and so you can simply take a standard deviation of all the pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a commercial, rather than scientific, camera you might not be able to get a low enough signal that shot noise isn't significant. &lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-09-02T20:10:55.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3288" PostTypeId="1" CreationDate="2012-09-02T16:24:08.933" Score="1" ViewCount="202" Body="&lt;p&gt;I have two processes, one is normal and the other with some cracks of material. And I have the acoustic signals got from the materials by a sensor. I want to compare these signals to see if this signal can be used to detect cracks. I think two different processes (with and without cracks) will create two different signals. Based on that, I want to compare these signals, but I'm new to DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please give me some suggestions what I should do, step by step to process these signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I will of course read books to get knowledge about DSP, but it's really huge. I therefore hope that someone can tell me what I should do, step by step to process those signals. By doing so, I can save some time)&lt;/p&gt;&#xA;" OwnerUserId="1897" OwnerDisplayName="John" LastEditorUserId="35" LastEditDate="2012-09-03T17:25:24.927" LastActivityDate="2012-09-03T17:25:24.927" Title="How to get started analyzing audio signals for detecting cracks in a material?" Tags="|audio|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="3289" PostTypeId="2" ParentId="3288" CreationDate="2012-09-02T22:06:56.390" Score="1" Body="&lt;p&gt;Not really a programming question!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case if you need to read books to understand DSP and are trying to compare two non stationary processes I suggest you start reading right away because most steps I tell you won't make sense and you need to answer a host of questions even before anyone can answer this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal processing deals with lot of statistical phenomena and you have to work with it emperically many a times. Not to say there are no fixed rules but the step-by-step to process this signals is hard enough when data is stationary. Given that you have non stationary data, get reading and once you have a hang of it ask some pointed questions on dsp.stackexchange.com&lt;/p&gt;&#xA;" OwnerUserId="1870" OwnerDisplayName="user1559108" LastActivityDate="2012-09-02T22:06:56.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3290" PostTypeId="1" AcceptedAnswerId="3473" CreationDate="2012-09-03T08:28:19.163" Score="3" ViewCount="664" Body="&lt;p&gt;I'm trying to use Morlet wavelet to reduce noise in my signal. &#xA;I found formula for Morlet wavelet &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Psi(x) = \frac{1}{\sqrt{\pi\cdot \textrm{bandwidth}}} \cdot \exp\left(i \cdot 2\pi \cdot \textrm{centerFreq} \cdot x\right)\cdot\exp\left(\frac{x^2}{\textrm{bandwidth}}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(sb told me I shoud use formula for complex Morlet wavelet)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also got CWT formula &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C = \int f(t) \cdot \frac{1}{\sqrt{\textrm{scale}}} \cdot \Psi\left(\frac{t-\textrm{shift}}{\textrm{scale}}\right)dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I convert both formulas to java code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public double morletRe(double x)&#xA;{&#xA;return (1/Math.sqrt(Math.PI*fb))*Math.cos(2*Math.PI*fc*x)* Math.exp(x*x/fb); &#xA;}&#xA;&#xA;public double[] cwt(double[] data,double scale, double position)&#xA;{&#xA;double[] newData = new double[data.length];&#xA;    for (int t = 0; t&amp;lt;data.length; t++ )&#xA;    {&#xA;    newData[t] = data[t]*(morletRe(t-position)/scale)[0])/Math.sqrt(scale);&#xA;    }&#xA;return newData;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But in the results I get a strange chart which is completely not related to my data,&#xA;is anyone can point me what I'm doing wrong?&#xA;regards.&lt;/p&gt;&#xA;" OwnerUserId="1818" LastEditorUserId="1629" LastEditDate="2016-05-09T10:10:05.203" LastActivityDate="2016-05-09T10:10:05.203" Title="How to remove/reduce noise by using the Morlet wavelet?" Tags="|noise|wavelet|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="3291" PostTypeId="1" AcceptedAnswerId="3294" CreationDate="2012-09-03T09:21:48.577" Score="4" ViewCount="9727" Body="&lt;p&gt;I'm new to FFT and DSP and I want to ask you some questions about calculating FFT in Matlab. The following code is from Matlab help, I just removed the noise.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What happens if I choose the length of signal L &gt; NFFT? and what's about choosing L different form NFFT?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the following code, I'm not sure if I used window correctly. But when I use window (hanning in the following code), I can't get the exact values of amplitudes?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When L and NFFT get different values (I mean when I change L and NFFT,) then the values of amplitudes were different too. How can I get the exact value of amplitude of input signal? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I thank you very much and look forward to hearing from you :)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;                    % Sampling frequency&#xA;T = 1/Fs;                     % Sample time&#xA;L = 512;                     % Length of signal&#xA;NFFT=1024;                   % number of fft points&#xA;t = (0:L-1)*T;                % Time vector&#xA;x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);    input signal&#xA;X = fft(hann(L).*x', NFFT)/L;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;plot(f,2*abs(X(1:NFFT/2+1)))     % Plot single-sided amplitude spectrum.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1864" LastEditorUserId="1864" LastEditDate="2012-09-03T10:28:27.300" LastActivityDate="2012-10-12T09:31:27.743" Title="Window function and length of signal" Tags="|fft|matlab|discrete-signals|frequency-spectrum|signal-detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3292" PostTypeId="1" AcceptedAnswerId="3298" CreationDate="2012-09-03T10:14:20.053" Score="9" ViewCount="12650" Body="&lt;p&gt;I am stuck at modeling a system model, i.e. getting my state vector and input vector. My guess is that position and velocity are state vector and acceleration is input vector. My 2nd guess is that all three quantities are in state vector and none in input vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So... what is state vector and what is input vector in my case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Additional info:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get measurements from position sensor and acceleration sensor. Everything is happening in 1D, for example on a straight line. I want to merge these readings (and remove the noise) to get an estimation of velocity for each timestep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These equations describe the system; I am not sure if they're modeled right though. If I understand correctly it's safe to predict that acceleration is constant (even though in reality it changes) - because process covariance matrix fixes this assumption (right?). &#xA;&lt;img src=&quot;https://i.stack.imgur.com/dtcDJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also some sample data to work with (input values aren't noised here for simplicity):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; time    pos     acc      what I should get as output (velocity)&#xA;[0.0s]  0.000, -0.000  | 18.850&#xA;[0.1s]  1.885, -0.113  | 18.850&#xA;[0.2s]  3.768, -0.227  | 18.839&#xA;[0.3s]  5.650, -0.340  | 18.816&#xA;[0.4s]  7.528, -0.452  | 18.782&#xA;[0.5s]  9.401, -0.565  | 18.737&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ADDITION 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For better communication I'm creating a new answer but should be treated as a comment to the first answer. Jason you've already helped me tremendously and I really am grateful for your time. I still have problems with this though - the results from Kalman Filter are not as expected. May you find the time please review the following, thanks. I already owe you a beer or two (or coffies if you like) - if you have paypal contact me on primoz[a t]codehunter.eu :)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I've implemented the model Jason had proposed in first answer. I added the &lt;em&gt;jerk&lt;/em&gt; as 4th state variable. After hours of reviewing I decided to come back here for help. The values I get out of KF aren't as expected. Table below represents the data from first 10 iterations of algorithm. Notice how &lt;em&gt;jerk&lt;/em&gt; is increasing each time step thus making other estimates wrong. After one second the difference between real acceleration and estimated is more than 1m/s² (see table, last row)!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;           real           measured                   estimated                    real &#xA;time   pos     acc       pos    acc        pos      acc    jerk    vel[!]       velocity &#xA;0.0   0.000  -0.000    -0.040  0.030  |  -0.300   -0.060   0.000   18.850  &amp;lt;--&amp;gt;  18.850&#xA;0.1   1.885  -0.113     1.965 -0.153  |   1.585   -0.061  -0.006   18.844  &amp;lt;--&amp;gt;  18.844&#xA;0.2   3.768  -0.227     3.778 -0.247  |   3.469   -0.066  -0.035   18.835  &amp;lt;--&amp;gt;  18.827&#xA;0.3   5.650  -0.340     5.750 -0.370  |   5.351   -0.090  -0.122   18.815  &amp;lt;--&amp;gt;  18.799&#xA;0.4   7.528  -0.452     7.358 -0.452  |   7.228   -0.152  -0.291   18.769  &amp;lt;--&amp;gt;  18.759&#xA;0.5   9.401  -0.565     9.251 -0.555  |   9.094   -0.282  -0.574   18.673  &amp;lt;--&amp;gt;  18.708&#xA;0.6   11.269 -0.677    11.309 -0.717  |   10.938  -0.518  -1.006   18.494  &amp;lt;--&amp;gt;  18.646&#xA;0.7   13.130 -0.788    13.260 -0.758  |   12.752  -0.840  -1.490   18.233  &amp;lt;--&amp;gt;  18.573&#xA;0.8   14.983 -0.899    15.043 -0.949  |   14.520  -1.286  -2.096   17.854  &amp;lt;--&amp;gt;  18.488&#xA;0.9   16.827 -1.009    16.977 -1.089  |   16.235  -1.838  -2.770   17.362  &amp;lt;--&amp;gt;  18.393&#xA;1.0   18.661 -1.118    18.831 -1.168  |   17.890  -2.477  -3.476   16.762  &amp;lt;--&amp;gt;  18.287&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My matrices are here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZEhwK.png&quot; alt=&quot;&quot;&gt;   &lt;img src=&quot;https://i.stack.imgur.com/urYYS.png&quot; alt=&quot;&quot;&gt;  &lt;img src=&quot;https://i.stack.imgur.com/ms5Vf.png&quot; alt=&quot;&quot;&gt;  &lt;img src=&quot;https://i.stack.imgur.com/Zslaz.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/1U1vs.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is causing this addition in each timestep for &lt;em&gt;jerk&lt;/em&gt;? Is any of my matrices wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same goes with the first solution (only 3 state model) - the acceleration isn't changing as it should.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;LAST EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've finally managed to make it work. I am not sure if there was an implementation error or wrong P&amp;amp;Q matrices.&lt;/p&gt;&#xA;" OwnerUserId="1798" LastEditorUserId="1798" LastEditDate="2012-09-06T12:32:09.507" LastActivityDate="2021-07-17T13:56:31.117" Title="Estimating velocity from known position and acceleration" Tags="|kalman-filters|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="3293" PostTypeId="1" AcceptedAnswerId="3296" CreationDate="2012-09-03T10:32:24.220" Score="8" ViewCount="1895" Body="&lt;p&gt;I have a sensor producing (more or less) bandlimited data with a cut-off of about 45Hz, with a roll-off and &lt;a href=&quot;http://en.wikipedia.org/wiki/Additive_white_Gaussian_noise&quot; rel=&quot;noreferrer&quot;&gt;AWGN&lt;/a&gt;. I have an ADC that samples said signal at 800Hz, with a single-pole anti-aliasing filter at about 200Hz. The problem is, I only have enough communication bandwidth to send samples at 100Hz and therefore some decimation is necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I simply have an 8-sample moving average filter and send every 8th sample. This feels dirty and suboptimal. Surely there must be a better way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an accepted &quot;best&quot; thing to do in this instance?  Should I, for example, do a low-pass FIR filter to squeeze out as close to 50Hz of signal bandwidth as possible?  Or, is there some sort of optimal estimation scheme will do better? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aim is to implement several channels (9 channels) on a smallish microcontroller (ARM Cortex M4, for example), so the computationally cheaper the better!  &lt;/p&gt;&#xA;" OwnerUserId="1904" LastEditorUserId="1904" LastEditDate="2012-09-03T22:41:34.170" LastActivityDate="2012-09-03T22:41:34.170" Title="Oversampling and decimation: What filter to use?" Tags="|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3294" PostTypeId="2" ParentId="3291" CreationDate="2012-09-03T13:26:01.097" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;What happens if I choose the length of signal L &gt; NFFT? and what's about choosing L different form NFFT?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Did you read the documentation? &lt;a href=&quot;http://www.mathworks.com/help/techdoc/ref/fft.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.mathworks.com/help/techdoc/ref/fft.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Y = fft(X,n) returns the n-point DFT. fft(X) is equivalent to fft(X, n) where n is the size of X in the first nonsingleton dimension. If the length of X is less than n, X is padded with trailing zeros to length n. &lt;strong&gt;If the length of X is greater than n, the sequence X is truncated.&lt;/strong&gt; When X is a matrix, the length of the columns are adjusted in the same manner.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So it just ignores the signal after n samples.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2 In the following code, I'm not sure if I used window correctly.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yep.  You just multiply the window by the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O1vF9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But when I use window (hanning in the following code), I can't get the exact values of amplitudes?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, It attenuates anything at the ends of the window, so the amplitude varies depending on when the window hits the signal.  If there's a huge peak in the signal, but it happens at the end of the window, it gets multiplied by 0.  If it happens in the middle of the window, it gets multiplied by 1.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For signals that are stationary across the window, then it doesn't matter when the window is applied to the signal, right? So you can just multiply by a constant (2 for a Hann window, I think, because the area under the window is 0.5) to get the true amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you use overlapped windows and certain windows (constant-overlap-add (COLA) constraint), I believe you can combine them to get the true amplitude for any waveform, even non-stationary ones.  &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Overlap_Add_Decomposition.html&quot; rel=&quot;noreferrer&quot;&gt;https://ccrma.stanford.edu/~jos/sasp/Overlap_Add_Decomposition.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;3 When L and NFFT get different values (I mean when I change L and NFFT,) then the values of amplitudes were different too. How can I get the exact value of amplitude of input signal? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The signal is stationary, so it shouldn't really matter how much of it you measure.  To get the true amplitude you probably need to divide by N, depending on matlab's implementation. &lt;a href=&quot;https://gist.github.com/236567&quot; rel=&quot;noreferrer&quot;&gt;https://gist.github.com/236567&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-09-03T13:40:25.970" LastActivityDate="2012-09-03T13:40:25.970" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3295" PostTypeId="2" ParentId="3291" CreationDate="2012-09-03T13:31:30.137" Score="6" Body="&lt;p&gt;When L&gt;NFFT, the signal will be cropped before FFT; when NFFT&gt;L, the signal will be zero padded before FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the window is used to surpress noise, and it will changes the spectrum of the signal so you cannot get the 'exact' amplitude spectrum. Actually, exact spectra can only be computed from infinte samples. Since the signal always has finite length, you can never get the exact spectrum. It's called &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot;&gt;spectral leakage&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastActivityDate="2012-09-03T13:31:30.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3296" PostTypeId="2" ParentId="3293" CreationDate="2012-09-03T15:06:31.527" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Should I, for example, do a low-pass FIR filter to squeeze out as close to 50Hz of signal bandwidth as possible?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, that is exactly what you should do.  That is an extremely low data rate, so even with a wimpy processor I would think that should be able to do a pretty good filter.  Especially since you only need to calculate $\frac{1}{8}$ of the filter outputs.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-09-03T15:06:31.527" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3297" PostTypeId="2" ParentId="3291" CreationDate="2012-09-03T15:35:30.973" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I get the exact value of amplitude of input signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If your signal is stationary and perfectly periodic, then you can get the amplitude by using a data and FFT length that are exactly an integer multiple of the signal's period, and using no window function.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A non-rectangular window function and an FFT length longer than the data length are useful if you don't know the period or S/N ratio, and want only an estimate of the spectra rather than any &quot;exact&quot; values.  An FFT length longer than the data length also helps interpolate a &quot;smoother looking&quot; spectrum from a given number of data samples, potential providing a higher resolution frequency of isolated spectral peaks well above the noise floor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-09-03T15:35:30.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3298" PostTypeId="2" ParentId="3292" CreationDate="2012-09-04T03:48:34.960" Score="10" Body="&lt;p&gt;You would not make a constant-acceleration assumption in this case. You would typically do that if you had no means of measuring the system's acceleration, but you say that it is observable for your case. The most obvious way to model this system would be using the state vector&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{x_k} = \left [ &#xA;\begin{array}{c}x_k \\&#xA;\dot{x}_k \\&#xA;\ddot{x}_k&#xA;\end{array} \right ] = \left [ &#xA;\begin{array}{c}x_k \\&#xA;v_k \\&#xA;a_k&#xA;\end{array} \right ]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_k$ is the position, $v_k$ is the velocity, and $a_k$ is the acceleration of the system at time instant $k$. Since you say that you can measure the position and acceleration of the system, the measurement vector $\mathbf{z_k}$ would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{z_k} = \mathbf{Hx_k} + \mathbf{v_k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{H} = \left[ &#xA;\begin{array}{cc} &#xA;1 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; 0 \\&#xA;0 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; 1&#xA;\end{array}&#xA;\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;resulting in the measurement model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{z_k} = \left[&#xA;\begin{array}{c}&#xA;x_k \\&#xA;a_k&#xA;\end{array}&#xA;\right] + \mathbf{v_k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{v_k}$ is the (Gaussian) noise inherent in the measurement. Now, unless you are adding some known force to the system that would affect its dynamics, then the input vector $\mathbf{u_k} = \mathbf{0}$. &lt;a href=&quot;https://dsp.stackexchange.com/questions/3255/kalman-filter-in-practice&quot;&gt;See this recent question for more detailed discussion of the various terms in the Kalman model, which you need to know, and which you don't&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Regarding the below comment on how to handle the state transition matrix for the acceleration term: there are a couple different ways to handle that. You could assume a zero-jerk (jerk is the time derivative of acceleration) model; this is equivalent to assuming that $a_{k+1}=a_k$. Or, you could add a fourth element to your state vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{x_k} = \left [ &#xA;\begin{array}{c}x_k \\&#xA;\dot{x}_k \\&#xA;\ddot{x}_k \\&#xA;\dddot{x_k}&#xA;\end{array} \right ] = \left [ &#xA;\begin{array}{c}x_k \\&#xA;v_k \\&#xA;a_k \\&#xA;j_k&#xA;\end{array} \right ]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $j_k$ is the system's jerk, or time rate of change of acceleration, at time instant $k$. Since you aren't measuring jerk directly, you would have a measurement matrix of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{H} = \left[ &#xA;\begin{array}{cc} &#xA;1 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; 0\\&#xA;0 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; 1 &amp;amp;&amp;amp; 0&#xA;\end{array}&#xA;\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the state transition matrix would become:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{F} = \left[ &#xA;\begin{array}{cccc} &#xA;1 &amp;amp;&amp;amp; dt &amp;amp;&amp;amp; \frac{1}{2}dt^2 &amp;amp;&amp;amp; \frac{1}{6} dt^3 \\&#xA;0 &amp;amp;&amp;amp; 1 &amp;amp;&amp;amp; dt &amp;amp;&amp;amp; \frac{1}{2}dt^2 \\&#xA;0 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; 1 &amp;amp;&amp;amp; dt \\&#xA;0 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; 1&#xA;\end{array}&#xA;\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a &quot;constant-jerk&quot; model (similar to constant-velocity or constant-acceleration models you might see in simple examples); your state transition matrix makes an implicit assumption that the jerk is constant for all values of k. This is not likely to be true. To handle that aspect of the problem, you would introduce a process noise term in the jerk component of the state transition equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qualitatively, this allows you to express that you aren't sure how the jerk term is going to change from time step to time step, but that you expect the changes to be random with some Gaussian distribution. This is a tool often used to &quot;tune&quot; adaptive filter models like this one until you find a set of parameters that works well for your application.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2012-09-05T12:16:08.607" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3299" PostTypeId="2" ParentId="3245" CreationDate="2012-09-04T08:12:10.947" Score="1" Body="&lt;p&gt;Why use an FFT for this? I think there are better simpler ways to do this. For example, you can simply measure the distance between zero crossings to get a first order estimate for frequency vs time and then refine with reconstructing the sweep and looking at the difference of the original and the reconstructed signal.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-09-04T08:12:10.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3300" PostTypeId="1" CreationDate="2012-09-05T00:37:44.153" Score="9" ViewCount="1485" Body="&lt;p&gt;I just recently started out with Image processing and taken up a course related to it in Grad school. But I already have a project to do without too much information about the subject, however I've made some steady progress. I am trying to segment the pills from their respective backgrounds. For images with contrasting backgrounds, I've been able to segment the pills using Otsu's method. With regards to images with similar backgrounds, Otsu's method doesn't quite work. I've been reading quite a few papers with regards to segmenting, but most of the papers that I've read use a manual thresholding value depending upon the kind of image. Is it possible to detect the correct thresholding value and automatically threshold an image and use techniques such as seed-growing or clustering to segment the image ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The color space I've been using is L&lt;em&gt;a&lt;/em&gt;b*, so I'd appreciate it if you could recommend the appropriate color space that I should be using too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The images in question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;original 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/24cr0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;result 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/daMTl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;original 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bS7gO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;result 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iw7Nr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;original 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FnbBN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;result 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cpBd6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1911" LastEditorUserId="420" LastEditDate="2012-09-10T10:29:12.860" LastActivityDate="2019-08-21T23:10:42.677" Title="Segmenting pills from the background" Tags="|image-segmentation|thresholding|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="3301" PostTypeId="1" AcceptedAnswerId="3329" CreationDate="2012-09-05T03:20:24.030" Score="20" ViewCount="7082" Body="&lt;p&gt;If you have a function $f(t)=A \cdot \sin(\omega t+\phi)$, and reference sin wave $\sin(\omega x)$ what would be a fast algorithm to compute $\phi$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was looking at &lt;em&gt;Goertzel&lt;/em&gt; algorithm, but it doesn't seem to deal with phase?&lt;/p&gt;&#xA;" OwnerUserId="1912" LastEditorUserId="50076" LastEditDate="2023-07-22T22:03:47.033" LastActivityDate="2023-07-22T22:03:54.250" Title="Is there an algorithm to compute the phase for a single frequecy?" Tags="|fft|discrete-signals|dft|algorithms|parameter-estimation|" AnswerCount="9" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3302" PostTypeId="2" ParentId="3301" CreationDate="2012-09-05T11:49:19.973" Score="6" Body="&lt;p&gt;If your signals are noise-free, you can identify zero crossings in both and determine frequency and relative phase.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-09-05T11:49:19.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3303" PostTypeId="2" ParentId="3301" CreationDate="2012-09-05T12:45:25.687" Score="5" Body="&lt;p&gt;That depends on what your definition of &quot;fast&quot; is, how accurate you want your estimate, whether you want $\phi$ or the phase relative to your samplings, and how  much noise there is on your function and reference sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Sinusoidal_Amplitude_Phase_Estimation.html&quot; rel=&quot;noreferrer&quot;&gt;One way to do this is to just take the FFT of $f(t)$ and just look at the bin closest to $\omega$.&lt;/a&gt;  However, this will depend on $\omega$ being close to the bin center frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What do you mean by &quot;fast&quot;?&lt;/li&gt;&#xA;&lt;li&gt;How accurate do you need the estimate?&lt;/li&gt;&#xA;&lt;li&gt;Do you want $\phi$ (phase relative to reference) or phase relative to the start of sampling? Does it matter?&lt;/li&gt;&#xA;&lt;li&gt;What is the noise level on each signal?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;PS: I'm assuming you meant $f(t)=A\sin(ωt+ϕ)$, rather than $f({\Huge t})=A\sin(ω{\Huge x}+ϕ)$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2012-09-05T12:45:25.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3304" PostTypeId="1" CreationDate="2012-09-04T05:53:06.080" Score="1" ViewCount="670" Body="&lt;p&gt;I was wondering if the spectrogram can be used as a MATLAB tool to check whether or not aliasing will occur when the signal is downsampled from let's say, 44.1kHz to 8kHz? And if yes, how do I go about it? &lt;/p&gt;&#xA;" OwnerUserId="1920" OwnerDisplayName="sakuragurl" LastActivityDate="2012-09-05T16:17:30.563" Title="Using Spectrogram to check whether aliasing will occur" Tags="|matlab|aliasing|spectrogram|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3305" PostTypeId="2" ParentId="3301" CreationDate="2012-09-05T15:33:11.557" Score="7" Body="&lt;p&gt;There are several different formulations of the Goertzel algorithm.  The ones that provide 2 state variables (orthogonal or close to), or a complex state variable, as possible outputs often can be used to calculate or estimate phase with reference to some point in the Goertzel window, such as the middle.  The ones that provide a single scalar output alone usually cannot.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will also need to know where your Goertzel window is in relation to your time axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is not exactly integer periodic in your Goertzel window, the phase estimate around a reference point in middle of the window may be more accurate then referencing phase to the beginning or end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A full FFT is overkill if you know the frequency of your signal.  Plus a Goertzel can be tuned to a frequency not periodic in the FFT length, whereas an FFT will need additional interpolation or zero padding for non-periodic-in-window frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A complex Goertzel is equivalent to 1 bin of a DFT that uses a recurrence for the cosine and sine basis vectors or FFT twiddle factors.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2019-01-08T13:28:04.803" LastActivityDate="2019-01-08T13:28:04.803" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="3306" PostTypeId="2" ParentId="3304" CreationDate="2012-09-05T16:17:30.563" Score="2" Body="&lt;p&gt;If the spectrogram displayed is sensitive enough to show spectral energy from half the old sample rate to half the new sample rate (e.g. anything at or between 4 kHz to 22.05 kHz), that energy will be aliased unless low-pass filtered out before or during downsampling (to 8KHz).  If there is nothing there, then there is nothing that will be aliased by properly interpolated (Sinc kernel, et.al) downsampling without any further low-pass filtering (such as a wider windowed Sinc FIR kernel, etc.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-09-05T16:17:30.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3307" PostTypeId="2" ParentId="3301" CreationDate="2012-09-05T16:24:54.283" Score="12" Body="&lt;p&gt;The problem can be formulated as (nonlinear) least-squares problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\phi) = \frac{1}{2}\sum^{n}_{i=1}\left[ A \cdot \sin(\omega i+\phi) - f_{i}(\omega) \right]^{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $F(\phi)$ is the objective function to minimize with respect to $\phi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The derivative is very simple:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F'(\phi)=\sum^{n}_{i=1} A\cdot \cos(\omega i+\phi)  \left[A \cdot \sin(\omega i+\phi) - f_{i}(\omega)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above objective function can be minimized iteratively using &lt;strong&gt;Gradient descent method&lt;/strong&gt; (first order approximation), &lt;strong&gt;Newton method&lt;/strong&gt;, &lt;strong&gt;Gauss-Newton method&lt;/strong&gt; or &lt;strong&gt;Levenberg-Marquardt method&lt;/strong&gt; (second order approximation - $F''(\phi)$ need to be provided in these).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the above objective function has multiple minima because of periodicity, hence some penalty term can be added to discriminate other minima (for example, adding $\phi^{2}$ to the model equation). But I think the optimization will just converge to the nearest minima and you can update the result subtracting $2\pi k, k\in N  $.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="29141" LastEditDate="2017-06-13T19:22:26.810" LastActivityDate="2017-06-13T19:22:26.810" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3308" PostTypeId="2" ParentId="3292" CreationDate="2012-09-05T21:17:05.907" Score="5" Body="&lt;p&gt;I'm assuming that your state variables are as per Jason's answer. If that's the case, then I believe your problem might be your $Q$ matrix (process noise): because it is zero everywhere except for the jerk update, the only terms updating the values of the position, velocity and acceleration are the deterministic parts of the update equations (except where the stochastic nature of the jerk feeds through).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try using a $Q$ matrix like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Q = \left [&#xA;\begin{array}{cccc}&#xA;0.00001 &amp;amp; 0&amp;amp; 0&amp;amp; 0\\&#xA;0 &amp;amp; 0.00001 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0.00001 &amp;amp; 0 \\&#xA;0 &amp;amp; 0&amp;amp; 0&amp;amp; 0.001&#xA;\end{array}&#xA;\right ]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If those diagonal elements are zero, the model is saying &quot;I don't expect the position, velocity or acceleration to change (other than by the update equations)&quot; --- which is clearly not the case.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2012-09-05T23:46:57.737" LastActivityDate="2012-09-05T23:46:57.737" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3309" PostTypeId="1" CreationDate="2012-09-05T23:50:30.680" Score="8" ViewCount="17725" Body="&lt;p&gt;For a project, I want to measure the contrast of a global image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to compare different images to get the image with the best contrast.&#xA;I know about the Weber contrast, but I need a normalized contrast value (in the range between 0-1 or other).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a simple method to do this in openCV?&lt;/p&gt;&#xA;" OwnerUserId="1854" LastEditorUserId="76" LastEditDate="2012-09-06T02:21:45.300" LastActivityDate="2019-11-12T14:53:23.070" Title="Measuring the contrast of an image" Tags="|opencv|image-processing|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3312" PostTypeId="1" CreationDate="2012-09-06T15:40:40.727" Score="1" ViewCount="1072" Body="&lt;p&gt;I have a really noisy ECG Signal which contain, motion artifacts,muscle noise, a very high amplitude noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am beginner to DSP. Can someone tell me in a simple language,how do i interpret the signals feature when i get this kind of image.&#xA;samping frequency is 1000hz. i used psd.welch in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why it is plotting against only 500hz and what information i can get on this&lt;/p&gt;&#xA;" OwnerUserId="1922" LastActivityDate="2012-11-26T12:11:02.137" Title="I have a noisy ECG Signal. want to use PSD to analyse the Signal to noise ratio" Tags="|matlab|discrete-signals|frequency-spectrum|snr|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3313" PostTypeId="1" AcceptedAnswerId="3318" CreationDate="2012-09-06T15:53:45.043" Score="3" ViewCount="623" Body="&lt;p&gt;I'm reading this material but I don't understand this example:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;An example of a 94% overlap transform processing could be demonstrated by a 279 sample frame with 262 samples overlapped from each frame into the next. At 12.5 MHz sample rate, each spectrum frame would occupy 23.76 µs. Each spectrum would start 1.36µs after the previous one and could show a 10 MHz span.&quot; &#xA;Could anybody please help to explain what is 10 MHz span and why why each spectrum could show a 10 MHz span?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The same problem with the following picture (I don't understand the example):&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mkaol.png&quot; alt=&quot;Spectrogram Comparisons&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1897" LastEditorUserId="35" LastEditDate="2012-09-06T22:58:22.063" LastActivityDate="2012-09-08T13:21:18.230" Title="Spectrum and Spectrogram explanation" Tags="|frequency-spectrum|signal-detection|analytic-signal|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3314" PostTypeId="1" AcceptedAnswerId="3317" CreationDate="2010-10-28T11:33:58.847" Score="11" ViewCount="4216" Body="&lt;p&gt;I have been given an audio file (sine wave) 1000Hz as an input to my FFT algorithm.&#xA;I have got 8192 power spectrum samples in a array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best and easiest way to check whether my output is right or wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I give a silent audio file then the output is zero for all samples.&#xA;In a sine wav the o/p increases from 20 (0th sample) to 26059811 (743rd sample) and decreases gradually to 40.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I get an idea of the output range then I can prove technically whether the FFT is working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas would be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Refer to &lt;a href=&quot;https://stackoverflow.com/questions/4040918/how-to-check-the-fft-results-in-iphone&quot;&gt;this link&lt;/a&gt; for any technical doubts.&lt;/p&gt;&#xA;" OwnerDisplayName="Warrior" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2013-07-06T02:00:22.903" Title="How to check the FFT results of a sine wave?" Tags="|fft|audio|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 2.5" />
  <row Id="3315" PostTypeId="2" ParentId="3314" CreationDate="2010-10-28T13:25:43.430" Score="1" Body="&lt;p&gt;I have used the Fourier analysis tool within the Excel Analysis Toolpak to do a quick check on the data and results.&lt;/p&gt;&#xA;" OwnerUserId="193" OwnerDisplayName="Ian" LastActivityDate="2010-10-28T13:25:43.430" CommentCount="2" ContentLicense="CC BY-SA 2.5" />
  <row Id="3316" PostTypeId="2" ParentId="3314" CreationDate="2010-10-28T13:57:34.167" Score="11" Body="&lt;p&gt;You need to plot the magnitude of the output of the FFT.  I'm not familiar with your programming language, but in Python you would use something like &lt;code&gt;plot(abs(fft(a)))&lt;/code&gt;.  For a silent input, the output should be all zeros.  For a sine wave input, you should see two spikes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zNMf1.png&quot; alt=&quot;alt text&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a real signal, the spikes will be symmetrical from left to right.  If you're doing a &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform#FFT_algorithms_specialized_for_real_and.2For_symmetric_data&quot; rel=&quot;noreferrer&quot;&gt;real FFT&lt;/a&gt;, though (which is more computationally efficient) you'll only get the left half of the plot as your output, since it ignores the redundant mirror image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency is higher, the spikes will be closer to the center.  If &lt;a href=&quot;http://gist.github.com/236567&quot; rel=&quot;noreferrer&quot;&gt;the frequency is perfectly in sync with the chunk size&lt;/a&gt;, the spike will only be one point wide and everything else will be exactly 0.  Otherwise it will have a tapering &quot;skirt&quot; like above.&lt;/p&gt;&#xA;" OwnerUserId="29" OwnerDisplayName="endolith" LastActivityDate="2010-10-28T16:23:06.173" CommentCount="9" ContentLicense="CC BY-SA 2.5" />
  <row Id="3317" PostTypeId="2" ParentId="3314" CreationDate="2010-10-29T05:55:56.097" Score="5" Body="&lt;p&gt;It seems you're calculating the spectrum by averaging 10 windows (non-overlapping?) to get the magnitude squared at 8192 or 8193 frequencies (from 0 to Nyquist, but some algorithms might drop the Nyquist frequency at bin 8192).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing to check is that the peak is in the right bin. You didn't say what the sampling rate is, but bin 743 would be 743/16384 times the sampling rate. If the signal really is at 800 Hz, that puts Fs at approximately 17640 samples/second. That seems wrong. Your test signal would probably be at a standard rate such as 8000, 16000, 22050, 32000, 44100, or 48000. For Fs = 22050, the peak would be sharply in bin 800/22050*16384 = 594.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another criteria to check is that the total energy in the signal is approximately the same in both the time and frequency domains. Here's an example in Python:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In [1]: NFFT = 2048; N = 10*NFFT; n = arange(N); Fs = 22050&#xA;In [2]: x = 0.4*cos(2*pi*400/Fs*n) + 0.6*cos(2*pi*800/Fs*n)&#xA;&#xA;In [3]: y,freqs = psd(x, NFFT=NFFT, Fs=Fs, pad_to=16384)  # PSD by Welch's Method&#xA;&#xA;In [4]: sum(x**2)/Fs           # time-domain energy&#xA;Out[4]: 0.24149869319296949&#xA;In [5]: sum(y) * N/16384       # frequency-domain energy&#xA;Out[5]: 0.24148752834391252&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The input signal x, which consists of two sinusoids sampled at Fs = 22050 samples/second, is segmented into 10 non-overlapping windows of size NFFT = 2048 samples. The call to psd (power spectral density) computes the spectrum y as the average of the magnitude squared of ten 16384-point DFTs (actually it's 8193 points since x is real-valued). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computed frequency-domain energy has a scaling factor of N/16384 because the psd function scaled y to the DFT size instead of to the total signal length. Whether or not this is an issue depends on how your system handles normalizing the PSD. Another optional normalization is scaling by 1/Fs. This matches the energy to the original analog signal. The default normalizations should be well documented in the library.&lt;/p&gt;&#xA;" OwnerUserId="159" OwnerDisplayName="eryksun" LastActivityDate="2010-10-29T05:55:56.097" CommentCount="1" ContentLicense="CC BY-SA 2.5" />
  <row Id="3318" PostTypeId="2" ParentId="3313" CreationDate="2012-09-07T03:15:12.587" Score="5" Body="&lt;p&gt;Here's an attempt to answer your first question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;An example of a 94% overlap transform processing could be demonstrated by a 279 sample frame with 262 samples overlapped from each frame into the next. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A spectrogram is really just a &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;nofollow&quot;&gt;sequence of spectra&lt;/a&gt;.  In this case, each individual spectrum is taken of 279 time samples (which I will call a frame).  Each subsequent frame consists of the &lt;em&gt;last&lt;/em&gt; 262 samples of the previous frame, plus the next 17 time samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means percentage of common samples between subsequent frames is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{262}{279} = 93.9068 \%&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;At 12.5 MHz sample rate, each spectrum frame would occupy 23.76 µs. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We have 279 samples in each frame.  The distance between time samples is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Delta t = \frac{1}{12.5 \times 10^6} = 80 {\rm ns}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add 279 of those together and we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;279 \times 80 {\rm ns} = 22.32 {\rm \mu s}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like someone can't multiply:  the number 23.76 µs is actually $297 \times 80 {\rm ns}$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Each spectrum would start 1.36µs after the previous one...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Each frame starts 17 samples after the last.  This is $17 \times 80 {\rm ns} = 1.36 {\rm \mu s}$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... and could show a 10 MHz span.&quot; Could anybody please help to explain what is 10 MHz span and why why each spectrum could show a 10 MHz span?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's not clear what they are meaning by this.  If you sample at 12.5MHz, then the total possible frequency span is 12.5MHz (if you include positive and negative frequencies).  There may be some allowance for guard bands that reduces the usable bandwidth from the ideal.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2012-09-08T13:21:18.230" LastActivityDate="2012-09-08T13:21:18.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3320" PostTypeId="1" AcceptedAnswerId="4793" CreationDate="2012-09-07T13:04:08.027" Score="7" ViewCount="4935" Body="&lt;p&gt;I have been reading chapter 13.4. (&quot;Power Spectrum Estimation Using the FFT&quot;) of the &lt;a href=&quot;http://www.nr.com/oldverswitcher.html&quot; rel=&quot;noreferrer&quot;&gt;Numerical Recipies Book&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some things related to the expectation value of the &quot;periodogram estimate of the power spectrum&quot; became not clear to me though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have an equally-spaced $N$-point sample  $ c_0 ... c_{N-1} $ of the  discrete signal $ c(t)  $ and its Fourier transform $$ C_k = \sum_{j=0}^{N−1} =&#xA;c_j \exp{&#xA;2πijk/N} &#xA; $$ $$k = 0, . . . , N − 1 $$&#xA;Then we can define the &quot;periodogram estimate of the power spectrum&quot; $P(f_k)$ as&#xA;$$ P(f_k) = \frac{1}{N^2}&#xA;[{|C_k|^2 + |C_{N−k}|^2]}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $k = 1, 2, . . . , \frac{N}{2}− 1$ and $f_k = \frac{k}{N\Delta}$ for $k = 0, 1, . . . ,\frac{N}{2}$ ($\Delta$ is the sampling interval).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far everything is clear. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now the book says&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;... the variance of the periodogram estimate at a frequency $f_k$ is&#xA;  always equal to the square of its expectation value at that frequency.&#xA;  In other words, the standard deviation is always 100 percent of the&#xA;  value, independent of N!&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the expectation value of the periodogram estimate at a frequency $f_k$? Why (can you show me how to derive it)?&lt;/li&gt;&#xA;&lt;li&gt;The expectation value doesn't change with $N$, so changing the length of the input doesn't improve the power spectrum estimation. But if I have a non-integral number of periods in my sample, more samples (longer sampling time) means less weight on the end of the signal (where there is a disconnect) so less smearing of frequency components measured due to the disconnect between the beginning and the end of the signal. So in this case a higher $N$ means a better estimation? Where am I wrong?&lt;/li&gt;&#xA;&lt;li&gt;If the SD is always 100 percent of the expectation value, doesn't that make this simple periodogram estimation (using just a single DFT of $N$ samples) pretty much useless? Should one always opt for Welch's or Bartlett's method e.g.?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance!&lt;/p&gt;&#xA;" OwnerUserId="1578" LastActivityDate="2018-05-12T14:44:41.470" Title="Variance of periodogram estimate of the power spectrum" Tags="|discrete-signals|fourier-transform|power-spectral-density|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3321" PostTypeId="1" AcceptedAnswerId="3325" CreationDate="2012-09-07T13:12:26.263" Score="7" ViewCount="25221" Body="&lt;p&gt;I'm trying to transforming an already know signal from time domain to frequency domain using &lt;code&gt;fft&lt;/code&gt; function in MATLAB. And I got different values of amplitude when I change the value of length of signal $L$. I'm therefore wondering if there is a rule to choose the length of signal when calculating FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an acoustic signal got from a sensor and need to analyze it (I have no idea about its frequency range, amplitude, and so on.) I want to transform it into frequency domain using &lt;code&gt;fft&lt;/code&gt; function in MATLAB. And I don't know how can I choose the length of signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could somebody please help?&lt;/p&gt;&#xA;" OwnerUserId="1864" LastEditorUserId="1629" LastEditDate="2016-05-13T08:02:54.363" LastActivityDate="2020-01-14T01:13:17.583" Title="Choosing the length of a signal when calculating the FFT" Tags="|fft|matlab|discrete-signals|signal-detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3322" PostTypeId="2" ParentId="3321" CreationDate="2012-09-07T13:48:06.830" Score="0" Body="&lt;p&gt;You can choose whatever length you like. As long as it covers all the signals, they are the same spectrum with different &quot;resolutions&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastEditorUserId="1641" LastEditDate="2012-09-12T20:26:47.433" LastActivityDate="2012-09-12T20:26:47.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3323" PostTypeId="2" ParentId="2641" CreationDate="2012-09-07T14:15:07.267" Score="2" Body="&lt;p&gt;This answer actually provides free code to perform the focus detection. &#xA;&lt;a href=&quot;https://stackoverflow.com/a/3795151/600736&quot;&gt;https://stackoverflow.com/a/3795151/600736&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1924" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-09-07T14:15:07.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3324" PostTypeId="1" CreationDate="2012-09-07T12:40:48.410" Score="14" ViewCount="21243" Body="&lt;p&gt;I try to detect rectangles in images. The background of the images is&#xA;one color (most of the time). I tried two methods to get an binary image (1 = background, 0 = edges), to do an Hough Transformation later on...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Sobel or Canny Filter&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Smooth image A, Create difference image A - gauss,&#xA;Create binary image with threshold (Create Histogram, highest bin should be    background...)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The result is a binary image with edges. I don't really now which method works better &#xA;for a variety of different images. Any ideas?&lt;/p&gt;&#xA;" OwnerDisplayName="patr" LastEditorUserId="26" LastEditDate="2012-09-11T14:04:51.250" LastActivityDate="2022-11-18T12:43:20.713" Title="How to detect edges and rectangles" Tags="|image-processing|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3325" PostTypeId="2" ParentId="3321" CreationDate="2012-09-07T15:21:58.010" Score="11" Body="&lt;p&gt;Mai, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The length of the FFT depends on what application you are doing. A very course summary follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Same size FFT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Analysis: This just means you want to 'analyse' the signal - look and see what type of spectrum it has, maybe patterns in the spectrums, etc. The 'usual' default is to simply use the FFT length equal to the length of your signal. &lt;em&gt;Example: &quot;What is the frequency content of my signal look like?&quot;&lt;/em&gt;&lt;pre&gt;z = abs(fft(x));&lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Circular convolution: In circular convolution, you want to convolve two signals circularly, as opposed to 'normal' linear convolution. So if you have a signal $x$ of length $L$, and you want to circularly convolve with signal $y$ of length $L$ also, you can multiply their same length FFTs with each other, and then take the IFFT. &lt;em&gt;Example: &quot;What is the circular convolution of $x$ and $y$?&quot;&lt;/em&gt; &lt;pre&gt;&#xA;z = ifft(fft(x).*fft(y))&lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Different Length FFT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Analysis: You can also use different (bigger) size FFTs for analysis as well. For example, if your signal $x$ was of length $L$, you can still analyze its frequency content choosing an FFT size of length, say, $10*L$. If you do this, you are actually interpolating the frequency spectrum. This just means that the spectrum looks more 'smooth', and in some cases you are able to better see where peaks might exist. Importantly though, this is &lt;em&gt;not&lt;/em&gt; the same as increasing your frequency &lt;em&gt;resolution&lt;/em&gt;. If someone tells you to &quot;increase frequency resolution by taking a bigger size FFT&quot;, tell them they are wrong, and that this just &lt;em&gt;interpolates&lt;/em&gt; the frequency domain. (Unless of course that person is your boss in which case you have to solve the non-linear optimization problem of telling them they are wrong without actually telling them they are wrong :-) ). (To actually increase frequency resolution, you need to have more samples of your original time domain signal). Anyway, the example motivation for this might be: &lt;em&gt;&quot;We analyzed our time domain signal using same size FFT, but we want to make sure the peaks we see are in the correct positions, let us increase the size of the FFT by 5 times&quot;.&lt;/em&gt; &lt;pre&gt;&#xA;z = abs(fft(x,5*length(x)));&lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Linear convolution: In this case, you have to use a different size FFT. In linear convolution, a signal $x$ is convolved with a signal $y$. You might have heard that &quot;Convolution in time is the same as multiplication in the frequency domain&quot;. This is true, but with the very important and often under-stated caveat that to do linear convolutions in the frequency domain, you have to make sure the FFT sizes are correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct size of the FFT lengths for a linear convolution, is $N_{\text{fft}} = L_x + L_y - 1$, where obviously those lengths correspond to the length of your signals $x$ and $y$. Why is this the case? Because in linear convolution, the result of convolving two signals is always equal to the sum of their lengths, minus 1. Do it on paper and you will see. Convolve a signal of length 3, and another of length 2. The result will be of length 4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so, as an example, one might say: &lt;em&gt;&quot;I want to &lt;strong&gt;linearly&lt;/strong&gt; convolve two signals in the time domain, but I want to do this operation in the frequency-domain.&quot;&lt;/em&gt; They might do it like this: &lt;pre&gt;&#xA;Lx = length(x);&lt;br&gt;&#xA;Ly = length(y);&lt;br&gt;&#xA;Nfft = Lx + Ly - 1;&lt;br&gt;&#xA;z = ifft ( fft(x,Nfft) .* fft(x,Nfft), Pfft);&#xA;&lt;/pre&gt;&#xA;Hope this helps. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="293" LastEditorUserId="1629" LastEditDate="2016-08-02T15:22:36.227" LastActivityDate="2016-08-02T15:22:36.227" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3326" PostTypeId="2" ParentId="3324" CreationDate="2012-09-07T17:15:37.787" Score="5" Body="&lt;p&gt;You might find that the Laplacian of Gaussian edge detector is a better choice.  It should give you closed contours more often than the Canny edge detector.  I believe that is what you want since your next step is to apply the Hough transform.&lt;/p&gt;&#xA;" OwnerUserId="1925" LastActivityDate="2012-09-07T17:15:37.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3327" PostTypeId="2" ParentId="3324" CreationDate="2012-09-07T22:27:00.167" Score="10" Body="&lt;p&gt;I once wrote an application for rectangle detection. It used Sobel edge detection and line Hough transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of looking for single peaks in Hough image (lines), the program searched 4 peaks with distance of 90 degrees between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each column in Hough image (corresponding to some angle), three other columns were searched for local maxima. When satifactory peak was found in each of the four columns, the rectangle have been detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The program constructed the rectangle and made additional checks for color consistency within and outside the rectangle to discriminate false positives. The program was for detecting paper placement in scanned sheets of papers.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-09-07T22:27:00.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3328" PostTypeId="2" ParentId="3321" CreationDate="2012-09-08T02:09:38.160" Score="3" Body="&lt;p&gt;A longer FFT will divide up the frequency range into more &quot;bins&quot; between DC (0 Hz) and Fs/2.  So the result bin of a particular frequency may be in a different bin number for different lengths of FFT.  Depending on the FFT implementation, you may also need to divide by the length of the FFT or the square root of the length, or do plot interpolation (rescale) to get the FFT results of different lengths of a stationary signal to appear more similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT length to choose depends on your signal (whether it is stationary or how fast it is changing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is changing with time, then you will need to make a trade-off between locality in time, by choosing a shorter length so as not to mix together multiple time events in one FFT frame, or by choosing more frequency resolution (or frequency estimation accuracy), by using a longer length FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is stationary (not changing over time), then you can increase the length to get the frequency resolution you require, or until the computational costs become too great.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2020-01-14T01:13:17.583" LastActivityDate="2020-01-14T01:13:17.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3329" PostTypeId="2" ParentId="3301" CreationDate="2012-09-09T09:11:28.613" Score="7" Body="&lt;p&gt;Use a DFT at the specific frequency. Then compute amplitude and phase from the real/imag parts.  It gives you the phase referenced to the start of the sampling time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a 'normal' FFT (or a DFT computed for all N harmonics), you typically compute frequency with f = k*(sample_rate)/N, where k is an integer.  Although it may seem sacrilegious (especially to members of the Church of the Wholly Integer), you can actually use non-integer values of k when doing a single DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, suppose you've generated (or obtained) N = 256 points of a sine wave of 27 Hz. (let's say, sample_rate = 200).  Your 'normal' frequencies for a 256 point FFT (or N point DFT) would correspond to: f = k*(sample_rate)/N = k*(200)/256, where k is an integer.  But a non-integer 'k' of 34.56 would correspond to a frequency of 27 Hz., using the parameters listed above.  It's like creating a DFT 'bin' that is exactly centered at the frequency of interest (27 Hz.).  Some C++ code (DevC++ compiler) might look as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;cstdio&amp;gt;&#xA;#include &amp;lt;cstdlib&amp;gt;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;#include &amp;lt;cmath&amp;gt;&#xA;using namespace std;&#xA;&#xA;// arguments in main needed for Dev-C++ I/O&#xA;int main (int nNumberofArgs, char* pszArgs[ ] ) {&#xA;const long N = 256 ;&#xA;double sample_rate = 200., amp, phase, t, C, S, twopi = 6.2831853071795865; &#xA;double  r[N] = {0.}, i[N] = {0.}, R = 0., I = 0. ;&#xA;long n ;&#xA;&#xA;// k need not be integer&#xA;double k = 34.56;&#xA;&#xA;// generate real points&#xA;for (n = 0; n &amp;lt; N; n++) {&#xA;    t =  n/sample_rate;&#xA;    r[n] = 10.*cos(twopi*27.*t - twopi/4.);&#xA;}  // end for&#xA;&#xA;// compute one DFT&#xA;for (n = 0; n &amp;lt; N; n++) {&#xA;    C = cos(twopi*n*k/N); S = sin(twopi*n*k/N);&#xA;    R = R + r[n]*C + i[n]*S;&#xA;    I = I + i[n]*C - r[n]*S;&#xA;} // end for&#xA;&#xA;cout&amp;lt;&amp;lt;&quot;\n\ndft results for N = &quot; &amp;lt;&amp;lt; N &amp;lt;&amp;lt; &quot;\n&quot;;&#xA;cout&amp;lt;&amp;lt;&quot;\nindex k     real          imaginary       amplitude         phase\n&quot;;&#xA;&#xA;amp = 2*sqrt( (R/N)*(R/N) + (I/N)*(I/N) ) ;&#xA;phase = atan2( I, R ) ;&#xA;// printed R and I are scaled&#xA;printf(&quot;%4.2f\t%11.8f\t%11.8f\t%11.8f\t%11.8f\n&quot;,k,R/N,I/N,amp,phase);&#xA;&#xA;cout &amp;lt;&amp;lt; &quot;\n\n&quot;;&#xA;system (&quot;PAUSE&quot;);&#xA;return 0;&#xA;} // end main&#xA;&#xA;//**** end program&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(PS: I hope the above above translates well to stackoverflow – some of it might wrap around)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of the above is a phase of -twopi/4, as shown in the generated real points (and amp is doubled to reflect the pos/neg frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few things to note – I use cosine to generate the test waveform and interpret results – you have to be careful about that –  phase is referenced to time = 0, which is when you started sampling (ie: when you collected r[0]), and cosine is the correct interpretation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above code is neither elegant nor efficient (eg: use a look-up tables for the sin/cos values, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your results will get more accurate as you use larger N, and there's a little bit of error due to the fact that the sample rate and N above are not multiples of each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, if you want to change your sample rate, N, or f, you'd have to change the code and the value of k.  You can plunk down a DFT bin anywhere on the continuous frequency line – just make sure that you're using a value of k that corresponds to the frequency of interest.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2012-09-09T09:11:28.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3330" PostTypeId="1" AcceptedAnswerId="3331" CreationDate="2012-09-09T18:40:06.130" Score="2" ViewCount="3478" Body="&lt;p&gt;I'm working on an audio based application for android platform , I'm trying to use a low pass filter to a fixed or variable max frequency &quot;depends on the cost of development&quot;.&#xA;first I've been playing around with FFT and I believe I can get results out of it &quot;by muting the frequencies above the required frequency and then do inverse FFT&quot;.&#xA;but the processing time seems high so I've searched again and found that a real time LPF can be implemented and applied to PCM data &quot;IIR , Butterworth&quot;.&#xA;any suggestions on the best approach keeping in mind low processing speed &quot;CPU&quot; and small available memory &quot;around 20MB for dalvik virtual machine&quot;&lt;/p&gt;&#xA;" OwnerUserId="1931" LastActivityDate="2021-11-27T23:02:46.287" Title="Filtering PCM data in java" Tags="|filters|fft|audio|lowpass-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3331" PostTypeId="2" ParentId="3330" CreationDate="2012-09-10T01:39:02.320" Score="2" Body="&lt;p&gt;Audio EQ in by FFT?!? Please don't do that. CPU usage will be the least of your worries. &lt;a href=&quot;http://blog.bjornroche.com/2012/08/why-eq-is-done-in-time-domain.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://blog.bjornroche.com/2012/08/why-eq-is-done-in-time-domain.html&lt;/a&gt; There was also a related discussion recently on the &lt;a href=&quot;http://www.linkedin.com/groupItem?view=&amp;amp;gid=144812&amp;amp;type=member&amp;amp;item=153309949&amp;amp;qid=9e434c02-ad90-47e8-9315-9fecafc9c7d9&amp;amp;trk=group_most_recent_rich-0-b-ttl&amp;amp;goback=.gmr_144812&quot; rel=&quot;nofollow noreferrer&quot;&gt;linkedin dsp group&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This post covers how to do a bell filter in the time domain, but it's extremely similar to create a low pass (actually a low pass is easier), and will be MUCH easier than trying to do an FFT (which won't do what you want anyway): &lt;a href=&quot;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You won't have to worry at all about memory (it only needs 2 memory slots) and CPU usage is very low. Plus latency is minimal. The final implementation is like 10 lines of code.&lt;/p&gt;&#xA;&lt;p&gt;The original &amp;quot;cookbook&amp;quot; reference is here: &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.w3.org/TR/audio-eq-cookbook/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, that said, this filter may not do for your purpose, but you haven't really made it clear what that is, so please feel free to clarify.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastEditorUserId="4346" LastEditDate="2021-11-27T23:02:46.287" LastActivityDate="2021-11-27T23:02:46.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3332" PostTypeId="2" ParentId="3301" CreationDate="2012-09-10T05:25:21.857" Score="4" Body="&lt;p&gt;Start point:&lt;br&gt;&#xA;1) multiply your signal and reference sin wave:&lt;br&gt;&#xA;$F(t) $= A⋅sin(ωt+ϕ)⋅sin(ωt) = 0.5⋅A⋅(cos(ϕ) - cos(2⋅ωt+ϕ))&lt;br&gt;&#xA;2) find integral on period $T= \pi /\omega$:&lt;br&gt;&#xA;$ I(\phi) = \int_0^T F(t)dt\ =  0.5⋅A⋅cos(ϕ) \cdot T$&lt;br&gt;&#xA;3) you can calculate $\phi$:&lt;br&gt;&#xA;$cos(\phi) = I(t)/(0.5 \cdot A \cdot T)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about:&lt;br&gt;&#xA;how to measure A?&lt;br&gt;&#xA;how to determine $\phi$ in $0..(2 \cdot \pi)$ interval? (think about &quot; reference &lt;strong&gt;cos&lt;/strong&gt; wave&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For discrete signal change the integral to sum and carefully choose T!&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2012-09-11T01:46:45.480" LastActivityDate="2012-09-11T01:46:45.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3334" PostTypeId="1" AcceptedAnswerId="3335" CreationDate="2012-09-10T15:50:45.860" Score="1" ViewCount="127" Body="&lt;p&gt;I have a basic understanding of HMM's and as a final year project at school wanted to expand my knowledge further. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My basic idea was to create an algorithm that determines if someone is saying either Yes or No. As interesting as this sounds, it's relatively easy and I want something that challenges me even more and wanted to know if my idea was possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm will be able to answer certain questions (given samples).. E.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q: Is this person saying either Yes no No?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A: Yes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q: Is this person male or female?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A: Male&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q: Is this animal a bat?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A: No&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, my data-set will be massive, but is this possible using HMM's? So, in theory, instead of handling whether someone is saying yes or no, the algorithm becomes universal and I can determine many many things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope someone can help me.&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2012-09-10T16:55:24.830" Title="HMM's - Possibility?" Tags="|signal-detection|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3335" PostTypeId="2" ParentId="3334" CreationDate="2012-09-10T16:55:24.830" Score="5" Body="&lt;p&gt;HMM are useful for &lt;strong&gt;sequence&lt;/strong&gt; modeling and classification - problems for which your observations unfold on a 1-D axis in time or space. Hence their usefulness for speech recognition, because a word is a sequence of heterogeneous states corresponding to its various phones. But the problem of recognizing whether a speaker is male or female doesn't really have this &lt;strong&gt;sequential&lt;/strong&gt; aspect, so HMM would be indeed an odd approach for it. One good way of finding out whether HMM are a good fit for a problem is the following: would you still be able to perform the classification if the data is shuffled? If you take a speech recording, break it into segments and shuffle them, you won't be able to recognize the words spoken, but you will still be able to recognize whether the speaker is male or female, and indeed identify this speaker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure about the bat question - are you talking about recognizing animals from the sound they emit? Or else, from what kind of data? Does this data have a sequential structure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that what you want to do is, from a broad point of view, &lt;strong&gt;machine learning&lt;/strong&gt; or &lt;strong&gt;pattern classification&lt;/strong&gt;. HMM is a very specific solution to machine learning problems (those related to classifying processes unfolding along a 1-D axis), but this is by far not the only tool! Maybe you should learn more about the other approaches (bayesian methods, support vector machines, neural networks, decision trees...), and the specifics of each data types (features for image, audio, text...).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-10T16:55:24.830" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3336" PostTypeId="1" AcceptedAnswerId="3339" CreationDate="2012-09-10T17:27:12.587" Score="28" ViewCount="4544" Body="&lt;p&gt;This is the mathematical expression for Harris corner detection:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/umFEw.jpg&quot; alt=&quot;This is the mathematical expression for Harris corner detection...&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have the following doubts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the physical significance of $u$ and $v$? Many references say it is the magnitude by which the window $w$ shifted. So how much is the window shifted? One pixel or two pixels?&lt;/li&gt;&#xA;&lt;li&gt;Is the summation over the pixel positions covered by the window?&lt;/li&gt;&#xA;&lt;li&gt;Assuming simply $w(x,y) = 1$ , $I(x,y)$ is intensity of the single pixel at $(x,y)$ or the summation of the intensities inside the window with center at $(x,y)$?&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Corner_detection&quot; rel=&quot;noreferrer&quot;&gt;According to wiki&lt;/a&gt; they say the image is 2D , denoted by I and then asks to consider an image patch over the area $(x,y)$, then uses the notation $I(x,y)$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am finding it confusing to grasp the mathematical explanation. Anyone has an idea?&lt;/p&gt;&#xA;" OwnerUserId="1942" OwnerDisplayName="rotating_image" LastEditorUserId="698" LastEditDate="2012-11-18T12:24:38.027" LastActivityDate="2013-09-26T04:20:27.903" Title="Mathematics of Harris corner point detection" Tags="|image-processing|opencv|linear-algebra|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3337" PostTypeId="1" AcceptedAnswerId="3338" CreationDate="2012-09-10T21:34:40.723" Score="3" ViewCount="3226" Body="&lt;p&gt;I'm trying to find the period of a signal. I've used FFT to compute the autocorrelation of the signal. As can be seen from the autocorrelation function (plotted below) I obtained, there are 70 sample between peaks which actually indicates the period of my signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to extract the indices of these peaks from such a data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ha9b7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ha9b7.png&quot; alt=&quot;autocorrelation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" OwnerDisplayName="paritybit" LastActivityDate="2012-09-11T01:36:15.720" Title="Finding Peaks in an Autocorrelation Function" Tags="|fft|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3338" PostTypeId="2" ParentId="3337" CreationDate="2012-09-10T22:46:01.470" Score="2" Body="&lt;p&gt;Removing the DC offset from your signal will get rid of the triangular &quot;trend&quot; seen here. Another way to detrend data (which is not specific to autocorrelation functions) is to subtract from your function a median-filtered version of itself (the median-filtered version corresponding to the trend).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then detect peak by detecting local maxima - if $X(n) = \max_{k \in [k-W, k+W]} X(k)$, then $n$ is a peak. $W$ is a scale factor which indicates how narrow and close to each other you allow your peaks to be.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-09-11T01:36:15.720" LastActivityDate="2012-09-11T01:36:15.720" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3339" PostTypeId="2" ParentId="3336" CreationDate="2012-09-10T22:48:04.697" Score="41" Body="&lt;p&gt;The meaning of that formula is really quite simple. Imagine you take two same-sized small areas of an image, the blue one and the red one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tTmzD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The window function equals 0 outside the red rectangle (for simplicity, we can assume the window is simply constant within the red rectangle). So the window function selects which pixels you want to look at and assigns relative weights to each pixel. (Most common is the Gaussian window, because it's rotationally symmetric, efficient to calculate and emphasizes the pixels near the center of the window.) The blue rectangle is shifted by (u,v). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next you calculate the sum of squared difference between the image parts marked red and blue, i.e. you subtract them pixel by pixel, square the difference and sum up the result (assuming, for simplicity that the window = 1 in the area we're looking at). This gives you one number for every possible (u,v) -&gt; E(u,v).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's see what happens if we calculate that for different values of u/v:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First keep v=0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ozIA1.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be no surprise: The difference between the image parts is lowest when the offset (u,v) between them is 0. As you increase the distance between the two patches, the sum of squared differences also increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keeping u=0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QhPc4.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot looks similar, but the sum of squared differences between the two image parts is a lot smaller when you shift the blue rectangle in the direction of the edge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A full plot of E(u,v) looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Uwv2s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot looks a bit like a &quot;canyon&quot;: There's only a small difference if you shift the image in the direction of the canyon. That's because this image patch has a dominant (vertical) orientation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can do the same for a different image patch:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r3z3Q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the plot of E(u,v) looks different:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XJEVi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No matter which way you shift the patch, it always looks different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the shape of the function E(u,v) tells us something about the image patch&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if E(u,v) is near 0 everywhere, there is no texture in the image patch you're looking at&lt;/li&gt;&#xA;&lt;li&gt;if E(u,v) is &quot;canyon-shaped&quot;, the patch has a dominant orientation (this could be an edge or a texture)&lt;/li&gt;&#xA;&lt;li&gt;if E(u,v) is &quot;cone-shaped&quot;, the patch has texture, but no dominant orientation. That's the kind of patch a corner-detector is looking for.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Many references say it is the magnitude by which the window 'w' shifted...so how much is the window shifted?one pixel...two pixels?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Normally, you don't calculate E(u,v) at all. You're only interested in the shape of it in the neighborhood of (u,v)=(0,0). So you just want the Taylor expansion of E(u,v) near (0,0), which completely describes the &quot;shape&quot; of it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is the summation over the pixel positions covered by the window?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Mathematically speaking, it's more elegant to let the summation range over all pixels. Practically speaking there's no point in summing pixels where the window is 0.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-09-10T22:48:04.697" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3340" PostTypeId="2" ParentId="3300" CreationDate="2012-09-11T13:04:42.230" Score="2" Body="&lt;p&gt;If you want to use the thresholding approach, you should use an adaptive thresholding method if there are big lighting variations like in the 3rd example image (&lt;a href=&quot;https://dsp.stackexchange.com/q/2411/1273&quot;&gt;dsp question here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you should experiment with colorspaces, it's easy: the script to decompose the image into different colorspaces should be no more than a few lines long, and a lot of image viewers have that option available. The best one should be easy to determine just visually. If you want to read up on colorspaces, there's anothrt good &lt;a href=&quot;https://dsp.stackexchange.com/q/2687/1273&quot;&gt;dsp question here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you might want to try a diffrent approach. One idea would be to do a not-perfect segmentation, then an &lt;a href=&quot;https://dsp.stackexchange.com/q/74/1273&quot;&gt;edge detection&lt;/a&gt;, and finally using something like Hough transform for circles which also works fine on (incomplete) circle arches. (this idea is ofcourse only applicable to round pills)&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-09-11T13:04:42.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3341" PostTypeId="1" CreationDate="2012-09-11T15:55:07.557" Score="3" ViewCount="9769" Body="&lt;p&gt;I am having a VERY hard time capturing when the ball comes into frame in this video&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=x1V6_OHrXIo&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=x1V6_OHrXIo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea what to set the parameters too, and trying random values doesn't seem to help at all, I can't see the pattern to know what effect the numbers are having.  This is what I'm attempting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background subtraction, or color detection won't work, as they could easily change.  I need a more generalized solution.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var laneSixBedRect = new Rectangle(new Point(240, 185), new Size(240, 150));&#xA;var laneSixBed = imgSource.GetSubRect(laneSixBedRect);&#xA;&#xA;TrackShot(laneSixBed);&#xA;&#xA;private static void TrackShot(Image&amp;lt;Bgr, byte&amp;gt; laneBed)&#xA;{&#xA;    var laneBedGray = laneBed.Convert&amp;lt;Gray, byte&amp;gt;();&#xA;&#xA;    var circles = laneBedGray.HoughCircles(&#xA;        new Gray(150),  //cannyThreshold&#xA;        new Gray(75),   //circleAccumulatorThreshold&#xA;        2.0,            //Resolution of the accumulator used to detect centers of the circles&#xA;        20.0,           //min distance &#xA;        5,              //min radius&#xA;        50              //max radius&#xA;        )[0];           //Get the circles from the first channel&#xA;&#xA;    foreach (CircleF circle in circles)&#xA;        laneBed.Draw(circle, new Bgr(Color.Brown), 2);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; This is my currentTrackShot method, it's running about 70% as far as accuracy, still some false positives, and some missed positives.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    private static void TrackShot(Rectangle laneRect, Image&amp;lt;Bgr, byte&amp;gt; prevImage, Image&amp;lt;Bgr, byte&amp;gt; currImage, Image&amp;lt;Bgr, byte&amp;gt; background)&#xA;    {&#xA;        var laneBedBack = background.GetSubRect(laneRect);&#xA;        var laneBedPrev = prevImage.GetSubRect(laneRect);&#xA;        var laneBedCurr = currImage.GetSubRect(laneRect);&#xA;&#xA;        var laneBedBackGray = laneBedBack.Convert&amp;lt;Gray, byte&amp;gt;();&#xA;        //TODO: Should these be Smoothed?&#xA;        var laneBedPrevGray = laneBedPrev.Convert&amp;lt;Gray, byte&amp;gt;().SmoothGaussian(5);&#xA;        var laneBedCurrGray = laneBedCurr.Convert&amp;lt;Gray, byte&amp;gt;().SmoothGaussian(5);&#xA;&#xA;        //TODO: Uncomment to see difference between frames, nearly black when no motion&#xA;        //var diff = laneBedPrevGray.AbsDiff(laneBedCurrGray);&#xA;        //diff.Convert&amp;lt;Bgr, byte&amp;gt;().CopyTo(laneBedCurr);&#xA;&#xA;        //TODO: Improve these values&#xA;        var prevFeatures = laneBedPrevGray.GoodFeaturesToTrack(100, .01, .1, 3)[0];&#xA;&#xA;        var returnFeatures = new PointF[1];&#xA;        byte[] status;&#xA;        float[] trackError;&#xA;        OpticalFlow.PyrLK(laneBedPrevGray, laneBedCurrGray, prevFeatures, new Size(15, 15), 5, new MCvTermCriteria(5), out returnFeatures, out status, out trackError);&#xA;&#xA;        //TODO: Now how do I refine this???&#xA;        for (var i = 0; i &amp;lt; returnFeatures.Length; i++)&#xA;        {&#xA;            var prevPoint = prevFeatures[i];&#xA;            var currPoint = returnFeatures[i];&#xA;            var state = status[i];&#xA;            var error = trackError[i];&#xA;&#xA;            var line = new LineSegment2D(new Point((int)prevPoint.X, (int)prevPoint.Y), new Point((int)currPoint.X, (int)currPoint.Y));&#xA;            if (state == 1 &amp;amp;&amp;amp; line.Length &amp;gt; 15 &amp;amp;&amp;amp; error &amp;lt; 10)&#xA;            {&#xA;                laneBedCurr.Draw(line, new Bgr(Color.Green), 3);&#xA;                Console.WriteLine(&quot;E: {0}&quot;, error);&#xA;                Console.WriteLine(&quot;L: {0}&quot;, line.Length);&#xA;            }&#xA;        }&#xA;&#xA;        viewerModified.Image = currImage;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT2:&lt;/strong&gt; My ulimate goal is to be able to draw a line along the trajectory the ball took and store that trajectory in some fashion that can be compared to others.&lt;/p&gt;&#xA;" OwnerUserId="704" LastEditorUserId="704" LastEditDate="2012-09-12T20:39:17.587" LastActivityDate="2012-09-12T20:39:17.587" Title="EmguCV: Detect a ball in the frame" Tags="|computer-vision|opencv|edge-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3342" PostTypeId="2" ParentId="3341" CreationDate="2012-09-11T18:56:47.533" Score="4" Body="&lt;h2&gt;Remove things you don't want&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Since the camera is static, you might want to use a background remover first. I found that the standard one provided with OpenCV works pretty well. I create it like this in the Android OpenCV SDK (you can play with the parameters) :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backgroundSubtractor = new BackgroundSubtractorMOG(3, 4, 0.8);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, apply it to each image in your video (no need to re-instantiate it unless you move the camera, it will learn from the sequence of images).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Computing the motion&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;First, using the Hough Transform for fast-moving shapes isn't very useful. The Hough transform requires you to be able to detect the shape's boundary with some accuracy, which obviously you can't, thanks to the motion blur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest looking into algorithms for computing the optical flow. I don't know how close EmguCV is to the original OpenCV, but you could try &lt;code&gt;calcOpticalFlowPyrLK&lt;/code&gt; (computes the flow for a set of points in the image, usually obtained using the &lt;code&gt;goodFeaturesToTrack&lt;/code&gt; method) or &lt;code&gt;calcOpticalFlowFarneback&lt;/code&gt; (computes a dense flow for the whole image, but more CPU-hungry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, there have been some people working on CUDA/GLSL versions of Lucas-Kanade (the first one) if you really want to have a fast, dense flow algorithm, but I haven't seen a lot of useful implementations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the OpenCV documentation here : &lt;a href=&quot;http://opencv.willowgarage.com/documentation/cpp/motion_analysis_and_object_tracking.html#calcOpticalFlowPyrLK&quot; rel=&quot;nofollow&quot;&gt;http://opencv.willowgarage.com/documentation/cpp/motion_analysis_and_object_tracking.html#calcOpticalFlowPyrLK&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1945" LastEditorUserId="1945" LastEditDate="2012-09-11T21:00:49.470" LastActivityDate="2012-09-11T21:00:49.470" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="3343" PostTypeId="1" AcceptedAnswerId="3345" CreationDate="2012-09-11T23:30:55.177" Score="14" ViewCount="30528" Body="&lt;p&gt;I have used Hidden Markov Model algorithm for automated speech recognition in a signal processing class. Now going through Machine learning literature i see that  algorithms are classified as &quot;Classification&quot; , &quot;Clustering&quot; or &quot;Regression&quot;.&#xA;Which bucket does HMM fall into? I did not come across hidden markov models listed in the literature.&lt;/p&gt;&#xA;" OwnerUserId="1531" LastEditorUserId="1531" LastEditDate="2012-09-12T11:16:55.907" LastActivityDate="2012-09-12T19:35:26.133" Title="Which kind of machine learning algorithm is Hidden Markov Model?" Tags="|algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3344" PostTypeId="2" ParentId="3343" CreationDate="2012-09-11T23:45:54.837" Score="2" Body="&lt;p&gt;First, let's look at the three options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Statistical_classification&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classification&lt;/a&gt; : Identifying which class of a set of pre-defined classes the data belongs to.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Cluster_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Clustering&lt;/a&gt; : Learning the set of classes the data belongs to. &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Regression_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Regression&lt;/a&gt; : Finding a relationship between on variable and one or more others.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Hidden_Markov_model#General_description&quot; rel=&quot;nofollow noreferrer&quot;&gt;The description of the HMM on Wikipedia&lt;/a&gt; has the following table:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g056i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the number of states (classes) is fixed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that the algorithm does not try to figure out the number of classes (states) are --- so it's not open-ended clustering (where the number of states is unknown).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as @nikie points out, the HMM will do clustering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is not really an independent variable (as exists in the regression context) --- so it's not regression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my answer is that the HMM is a &lt;strong&gt;classification&lt;/strong&gt; and a &lt;strong&gt;clustering&lt;/strong&gt; algorithm, I do not believe it is a regression.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2012-09-12T17:22:23.007" LastActivityDate="2012-09-12T17:22:23.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3345" PostTypeId="2" ParentId="3343" CreationDate="2012-09-12T08:49:14.880" Score="14" Body="&lt;p&gt;I would be tempted to reply &quot;none&quot;, or &quot;both classification and clustering&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why &quot;none&quot;? Because HMMs are not in the same bag as support vector machines or k-means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Support vector machines or k-means are specifically designed to solve a problem (classification in the first case, clustering in the second), and are indeed just an optimization procedure to maximize an &quot;expected goodness of classification&quot; or &quot;goodness of clustering&quot; criterion. The beauty lies in the choice of the criterion and optimization procedure. HMM are not an algorithm per se. They are a specific kind of probability distribution over sequences of vectors - for which we know good parameter estimation and marginal distribution computation algorithms. But asking whether they are in the &quot;clustering&quot; or &quot;classification&quot; family is as ridiculous as asking whether the Gaussian distribution is supervised or unsupervised learning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why &quot;both classification and clustering&quot;? Because of the following: Being probability distributions, HMM can be used for classification in a bayesian framework; and being model with hidden states, some latent clustering of the training data can be recovered from their parameters. More precisely:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HMM can be used for classification. This is a straightforward application of the bayesian classification framework, with the HMM being used as the probabilistic model describing your data. For example, you have a large database of utterances of digits (&quot;one&quot;, &quot;two&quot;, etc) and want to build a system capable of classifying an unknown utterance. For each class in your training data (&quot;one&quot;, &quot;two&quot;, you estimate the parameters of a HMM model describing the training sequences in this class - and you end up with 10 models. Then, to perform recognition, you compute the 10 likelihood scores (which indicate how likely the sequence you want to recognize has been generated by the model), and the model with the highest score gives you the digit. In the &lt;a href=&quot;http://www.cs.cornell.edu/Courses/cs4758/2012sp/materials/hmm_paper_rabiner.pdf&quot;&gt;Rabiner tutorial on HMMs&lt;/a&gt;, the training stage is &quot;Problem 3&quot;, the classification stage is &quot;Problem 2&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HMM can be used in an unsupervised fashion too, to achieve something akin to clustering. Given a sequence, you can train a $k$-state HMM on it, and at the end of the training process, run the Viterbi algorithm on your sequence to get the most likely state associated with each input vector (or just pull this from the $\gamma$ during the training process). This gives you a clustering of your input sequence into $k$ classes, but unlike what you would have obtained by running your data through k-means, your clustering is homogeneous on the time axis. For example, you can extract the color histograms of each frame of a video sequence, run this process on this sequence, and you'll end up with a break-down of the video into homogeneous temporal segments corresponding to scenes (the unpractical bit is that you have to set up the number of scenes $k$ in advance). This technique is commonly used in automatic, unsupervised, structure analysis of video or &lt;a href=&quot;http://users.cis.fiu.edu/~lli003/Music/ms/5.pdf&quot;&gt;music&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-09-12T19:35:26.133" LastActivityDate="2012-09-12T19:35:26.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3347" PostTypeId="2" ParentId="3324" CreationDate="2012-09-13T17:31:53.837" Score="0" Body="&lt;p&gt;If your image is relatively clean, you have obvious rectangles without a lot of breaks the alternative to a Hough transform is to create contours and reduce them until they form a 4 sided contour = your rectangle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are opencv samples to do this&lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-09-13T17:31:53.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3348" PostTypeId="1" AcceptedAnswerId="8123" CreationDate="2012-09-14T07:15:49.777" Score="12" ViewCount="4632" Body="&lt;p&gt;Currently I am developing a pedestrian counter project (using OpenCV+QT on Linux). My idea about the approach is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Capture Frames&lt;/li&gt;&#xA;&lt;li&gt;Do Background Subtraction&lt;/li&gt;&#xA;&lt;li&gt;clear noises (erode, dilate)&lt;/li&gt;&#xA;&lt;li&gt;find blobs (cvBlobslib) - foreground objects&lt;/li&gt;&#xA;&lt;li&gt;For each blob, set ROI and search for pedestrians (LBP with detectMultiScale) in these blobs (for better performance)&lt;/li&gt;&#xA;&lt;li&gt;For each found pedestrian do a nested upper body search(Not sure) (better reliability)&lt;/li&gt;&#xA;&lt;li&gt;If same pedestrian is found on continuing frames (3-4 frames maybe) - add that area to camshift and track - mark as pedestrian&lt;/li&gt;&#xA;&lt;li&gt;Exclude camshift tracked areas from blob detection for next frames&lt;/li&gt;&#xA;&lt;li&gt;If a pedestrian crosses a line increment number&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I want to check if I am on the right track. Do you have any suggestions on how to improve my approach? If somebody worked on something similar, I would appreciate any useful tips, resources (and criticisms) on this problem. &lt;/p&gt;&#xA;" OwnerUserId="1953" LastEditorUserId="1273" LastEditDate="2012-10-27T17:28:11.933" LastActivityDate="2013-03-08T13:55:58.207" Title="Pedestrian counting algorithm" Tags="|computer-vision|opencv|object-recognition|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3349" PostTypeId="1" AcceptedAnswerId="3350" CreationDate="2012-09-14T07:48:10.760" Score="3" ViewCount="157" Body="&lt;p&gt;I have a signal which is sampled in real-time. At every time interval I receive a value. I need to characterize this signal as active or inactive (to take priority in the control actions). By active it means that we observe big changes over a specific time-window.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to do it as I consider, is to keep a history of N samples and calculate the mean value and the standard deviation with an update algorithm. Based on the std I can say if it is inactive or not. The problem is that I have tens of thousands of signals and the sampling period is not the same on all of them. So, keeping a variable length sample history for all the signals will be difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the mean value I can use averaging with forgetting factor. The forgetting factor can be connected to the sampling period of each signal to have a similar observation window on all signals.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Now the question:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Is there any metric similar to averaging with forgetting factor that can give me the same information as std? It has to be low on memory usage and computationally light (since it's a real-time operation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any papers, books or references are welcome!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="1954" LastActivityDate="2012-09-14T08:38:40.053" Title="Characterizing real-time sampled signal" Tags="|filter-design|statistics|real-time|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3350" PostTypeId="2" ParentId="3349" CreationDate="2012-09-14T08:38:40.053" Score="6" Body="&lt;p&gt;Try something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{eqnarray}&#xA;\mu(n) &amp;amp;=&amp;amp; (1 - \alpha_1) \mu(n) + \alpha_1 x(n) \\&#xA;\bar{x}(n) &amp;amp;=&amp;amp; x(n) - \mu(n) \\&#xA;s(n) &amp;amp;=&amp;amp; (1 - \alpha_2) s(n) + \alpha_2 \bar{x}(n)^2 \\&#xA;\sigma(n) &amp;amp;=&amp;amp; \sqrt{s(n)} \\&#xA;\end{eqnarray}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is equivalent to sending your input signal to a 1-pole DC blocking high-pass filter with a pole at $\alpha_1$, then sending the result to a RMS detector whose response time is set by $\alpha_2$ - to measure how much the signal is wiggling once its central trend has been removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe that $\sigma(n)$ is consistent with the definition of the standard deviation.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-14T08:38:40.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3351" PostTypeId="1" AcceptedAnswerId="15639" CreationDate="2012-09-12T22:49:45.780" Score="15" ViewCount="1338" Body="&lt;p&gt;Ie, if you have as state variables position (&lt;strong&gt;p&lt;/strong&gt;) and velocity (&lt;strong&gt;v&lt;/strong&gt;), and I make low-frequency measurements of &lt;strong&gt;p&lt;/strong&gt;, this also indirectly gives me information about &lt;strong&gt;v&lt;/strong&gt; (since it's the derivative of &lt;strong&gt;p&lt;/strong&gt;). What is the best way to to handle such a relationship?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A) At the update step, should I only say I've measured &lt;strong&gt;p&lt;/strong&gt;, and rely on the filtering process, and my accumulated state-covariance matrix (&lt;strong&gt;P&lt;/strong&gt;), to correct &lt;strong&gt;v&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B) Should I create an &quot;extra&quot; prediction step, either after or before my update step for the measurement of &lt;strong&gt;p&lt;/strong&gt;, that uses my measured &lt;strong&gt;p&lt;/strong&gt; and (relatively large) delta-time to make a high-variance prediction of &lt;strong&gt;v&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;C) In my update/measurement step, should I say I've made a measurement of both &lt;strong&gt;p&lt;/strong&gt; and &#xA;&lt;strong&gt;v&lt;/strong&gt;, and then somehow encode information about their interdependence into the measurement co-variance matrix (&lt;strong&gt;R&lt;/strong&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For a little more background, here's the specific situation in which I've run into the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with a system where I want to estimate the position (&lt;strong&gt;p&lt;/strong&gt;) of an object, and I make frequent measurements of acceleration (&lt;strong&gt;a&lt;/strong&gt;) and infrequent, high-noise measurements of &lt;strong&gt;p&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently working with a codebase that does this with an Extended Kalman Filter, where it keeps as state variables &lt;strong&gt;p&lt;/strong&gt; and &lt;strong&gt;v&lt;/strong&gt;. It runs a &quot;prediction&quot; step after every acceleration measurement, in which it uses the measured &lt;strong&gt;a&lt;/strong&gt; and delta-time to integrate and predict new &lt;strong&gt;p&lt;/strong&gt; and &lt;strong&gt;v&lt;/strong&gt;.  It then runs an &quot;update&quot;/&quot;measurement&quot; step for every (infrequent) &lt;strong&gt;p&lt;/strong&gt; measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is this - I get occasional high-error measurements of &lt;strong&gt;a&lt;/strong&gt;, which result in highly-erroneous &lt;strong&gt;v&lt;/strong&gt;.  Obviously, further measurements of &lt;strong&gt;a&lt;/strong&gt; will never correct this, but measurements of &lt;strong&gt;p&lt;/strong&gt; should get rid of this.  And, in fact, this does seem to happen... but VERY slowly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking that this may be partially because the only way &lt;strong&gt;p&lt;/strong&gt; affects &lt;strong&gt;v&lt;/strong&gt; in this system is through the covariance matrix &lt;strong&gt;P&lt;/strong&gt; - ie, method A) from above - which seems fairly indirect.  I was wondering if there would be a better way to incorporate our knowledge of this relationship between &lt;strong&gt;p&lt;/strong&gt; and &lt;strong&gt;v&lt;/strong&gt; into the model, so that measurements of &lt;strong&gt;p&lt;/strong&gt; would correct &lt;strong&gt;v&lt;/strong&gt; faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="16411" OwnerDisplayName="Paul Molodowitch" LastEditorUserId="37293" LastEditDate="2018-09-09T15:37:54.107" LastActivityDate="2021-02-23T05:46:05.847" Title="Kalman Filter - Optimal Way to Handle &quot;Derived&quot; Measurements?" Tags="|filters|kalman-filters|estimation|measurement|bayesian-estimation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3356" PostTypeId="2" ParentId="3300" CreationDate="2012-09-15T21:21:09.247" Score="2" Body="&lt;p&gt;Circle hough transforms from the OpenCV library are well-suited for this application. You will have to run a number of radii but the best hough response will give you the pills' boundaries and centers. Note that you would have to use generalized hough transforms to find non-circular pills. It will work even if the pills have occluded or missing edge points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thresholding might be a bad solution to this because in the field you might fall into situations where no threshold will separate the pill from the background, which is why an algorithm that depends on relative positions of groups of edges is superior.&lt;/p&gt;&#xA;" OwnerUserId="1965" LastEditorUserId="1965" LastEditDate="2019-08-21T23:10:42.677" LastActivityDate="2019-08-21T23:10:42.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3358" PostTypeId="1" CreationDate="2012-09-16T15:18:01.650" Score="13" ViewCount="8880" Body="&lt;p&gt;I am totally new to the Kalman filter. I've had some basic courses on conditional probability and linear algebra. Can someone suggest a good book or any resource on the web which can help me can understand Kalman Filter operation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most websites start directly with the formula and what they mean, but I am more interested in its derivation, or if not detail derivation then at least the physical significance of each operation and parameter.&lt;/p&gt;&#xA;" OwnerUserId="1942" LastEditorUserId="6" LastEditDate="2012-09-17T12:46:09.797" LastActivityDate="2022-09-20T02:19:29.773" Title="Good book or reference to learn Kalman Filter" Tags="|kalman-filters|statistics|linear-algebra|" AnswerCount="8" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3359" PostTypeId="2" ParentId="3072" CreationDate="2012-09-17T08:58:34.563" Score="2" Body="&lt;p&gt;Aside from the whole discussion of pure signal processing: &#xA;What exactly do you define as &quot;the nodule&quot;. This is usually a biological entity with difficult to define borders. The nature of the nodule is sometimes invasive growth and therefore even in histological sections poorly defined. The CT itself has therefore a threshold higher than histology and therefore the true border of a nodule cannot defined easily. On the other hand, healthy tissue around the nodule might be compressed and appear dense in CT. This might be depending on the respiration phase the scan was triggert on (best results in midinspiration, according to newer data). Or inflammation might obscure the true border of the nodule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another aspect is interpolation of the images. The technique is usually a spiral-CT, so you don´t miss any lesions. The sections are therefore calculated. This results less defined borders of objects. If the focus would be on border detection or near histology resolution, high-resolution scans are usually required. This is what you do for interstitial lung disease. &#xA;Unfortunately, they slice through the lung with a pretty large distance in between. Radiation dose would be extremely high, if you try to get a &quot;full volume scan&quot;. But in this type of scan, you have to be aware, that You´s miss lesions between slices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To come back to the initial question: I think you will have to validate your technique - whatever it is - with the gold standard. Which is histology sections. (Unfortunately, the lung isn´t easily sectioned...). Another option is an additional technique: like PET-CT (combining positron emission tomography with computer tomography), but the alignment algorithms are sometimes tricky.&lt;/p&gt;&#xA;" OwnerUserId="1970" LastEditorUserId="6" LastEditDate="2012-09-17T17:48:50.550" LastActivityDate="2012-09-17T17:48:50.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3361" PostTypeId="2" ParentId="3211" CreationDate="2012-09-17T10:48:32.227" Score="2" Body="&lt;p&gt;One approach to estimating the noise level is simply to measure the standard deviation of the grey-level histogram of continuous regions of the image (those regions close to uniformity in the scene).  Whilst some variability is expected in any image, a large component of this distribution will be due to image noise. The utility of this measure will depend a lot on the construction of the scene and what you need to know but it may help rank the quality of images of the same scene for example.&lt;/p&gt;&#xA;" OwnerUserId="1240" LastActivityDate="2012-09-17T10:48:32.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3362" PostTypeId="2" ParentId="3358" CreationDate="2012-09-17T10:51:12.427" Score="17" Body="&lt;p&gt;Many years ago I wrote the tutorial &lt;a href=&quot;https://web.archive.org/web/20190713124725/http://www.tina-vision.net/docs/memos/1996-002.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;N. A. Thacker, A. J. Lacey - The Likelihood Interpretation of the Kalman Filter&lt;/a&gt; (Also &lt;a href=&quot;https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.599.7601&quot; rel=&quot;nofollow noreferrer&quot;&gt;on CiteSeerX&lt;/a&gt;) on the Kalman filter.  It derives the filter using both the conventional matrix approach as well as showing it's statistical assumptions as an 'optimal' least squares filter.&lt;/p&gt;&#xA;" OwnerUserId="1240" LastEditorUserId="128" LastEditDate="2021-12-01T22:03:16.413" LastActivityDate="2021-12-01T22:03:16.413" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3363" PostTypeId="1" AcceptedAnswerId="3366" CreationDate="2012-09-17T13:20:45.327" Score="1" ViewCount="242" Body="&lt;p&gt;Could the experts point me towards the best motion de blur algorithm? My images are blurred where I know the motion information with good precision(direction and angle)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are so many deconvolution algorithms however I was not able to figure out which one would be best. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2012-09-17T17:30:38.773" Title="State of the art motion blur recovery" Tags="|motion|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3364" PostTypeId="1" CreationDate="2012-09-17T14:07:49.027" Score="7" ViewCount="819" Body="&lt;p&gt;I have this confusion related to Laplacian filter. It states that it uses second derivative and finds the point of zero crossing(where the second derivative is zero) for which the first derivative has the high peak. I have seen them using kernels like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 1 0&#xA;1 -4 1&#xA;0 1  0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not sure how this kernel finds the point of zero crossing. I mean definitely this kernel is equivalent to the second derivative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have points something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 255 255&#xA;0 255 255&#xA;0 255 255&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Definitely, it has an edge at the middle. But if I convolve the kernel with this image for example. I won't get zero result. So how come its called zero crossing&lt;/p&gt;&#xA;" OwnerUserId="4717" OwnerDisplayName="user34790" LastEditorUserId="128" LastEditDate="2019-03-24T06:00:20.270" LastActivityDate="2019-03-24T06:00:20.270" Title="Confusion Related to the Laplacian Filter" Tags="|image-processing|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3365" PostTypeId="2" ParentId="3364" CreationDate="2012-09-17T14:19:20.170" Score="9" Body="&lt;p&gt;The Laplace filter is the sum of the differences of neighbourhood pixels compared to the central pixel. Its output will be zero in regions where the intensity is constant, and non-zero when there is a transition in intensity (i.e. an edge).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity's sake, consider what happens in one axis only, where the filter kernel would be &lt;code&gt;[1 -2 1]&lt;/code&gt;. If we have a sequence of values with a step transition then the input and output will look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;input:  10   10   10   10   10  100  100  100  100  100&#xA;&#xA;output:       0    0    0   90  -90    0    0    0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastActivityDate="2012-09-17T14:24:50.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3366" PostTypeId="2" ParentId="3363" CreationDate="2012-09-17T15:54:58.650" Score="4" Body="&lt;p&gt;It's really hard to say which one is the best unless we define more precisely what we mean by &quot;best.&quot; Some algorithms measure performance using MSE, others use more fancy metrics like entropy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you know the angle and direction of blur, it seems you have a good idea about the blurring function (point spread function). I would start off with a minimum mean squared error type filter (Wiener filter).&lt;/p&gt;&#xA;" OwnerUserId="1825" LastActivityDate="2012-09-17T15:54:58.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3367" PostTypeId="2" ParentId="3363" CreationDate="2012-09-17T17:30:38.773" Score="0" Body="&lt;p&gt;It is a good step to start with the PSF, and use it in the form of a deconvolving function. I think, last year Adobe showed the results of their algorithm to remove the motion blur. They had blurred the test image using a known blurring function, and removed the blur blindly, and I think it is now included in Photoshop. Since you already know the blurring kernel, any error minimization based deconvolution will be a good starting point. You can refer to the Image Reconstruction section in &lt;a href=&quot;http://cs.nyu.edu/~fergus/papers/deblur_fergus.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="1959" LastActivityDate="2012-09-17T17:30:38.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3368" PostTypeId="2" ParentId="3358" CreationDate="2012-09-17T18:25:46.730" Score="4" Body="&lt;p&gt;This seems to be a nice write-up of the Kalman filter: &lt;a href=&quot;http://bilgin.esme.org/BitsBytes/KalmanFilterforDummies.aspx&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bilgin Esm - Kalman Filter For Dummies&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="128" LastEditDate="2021-12-01T21:02:28.817" LastActivityDate="2021-12-01T21:02:28.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3369" PostTypeId="1" CreationDate="2012-09-18T04:29:03.587" Score="3" ViewCount="161" Body="&lt;p&gt;Are there general techniques to derive DTFTs? Given a bandlimited function $x(t)$, how do I find&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\sum_{n=-\infty}^\infty x[n]e^{-i\omega n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, it is easier to derive the continuous transform (never mind the constants):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f)=\int_{-\infty}^{\infty}x(t)e^{-i \omega t}\, dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because we have a wealth of integration theory to fall back on. Ok, one can also calculate $X(\omega)$ from $X(f)$ by &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform#Relationship_to_sampling&quot; rel=&quot;nofollow&quot;&gt;adding shifted copies&lt;/a&gt;, but we're again back to summing an infinite sequence. Any ideas on how to approach DTFT derivations in a smarter way? Or is sweating out the tiring summation the only way? I don't have any particular function in mind, but if one has to be chosen as an example, I'd pick $x(t) = \text{sech}(a t)$. The continuous FT of this is known and can be found in the table on Wikipedia (#208).&lt;/p&gt;&#xA;" OwnerUserId="1973" LastActivityDate="2012-09-18T11:37:32.767" Title="Techniques to deriving DTFTs" Tags="|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3370" PostTypeId="1" CreationDate="2012-09-18T05:54:26.503" Score="0" ViewCount="263" Body="&lt;p&gt;I am doing the project in audio fingerprinting, in that after I convert the signal into mono, I have to apply the hanning window, the size of the window is 370ms, and I have to overlap the signal with a factor of P=28/32. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i do that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is meant by 28/32?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I overlap this signal with this overlapping factor?&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="1706" LastEditDate="2012-09-18T09:32:12.723" LastActivityDate="2012-09-18T14:13:29.953" Title="Audio Fingerprinting" Tags="|audio|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3371" PostTypeId="2" ParentId="3369" CreationDate="2012-09-18T08:56:45.100" Score="3" Body="&lt;p&gt;As an example, the rules of series can work. A typical example is the $x[n] = a^n u[n]$ where $|a| &amp;lt; 1$. For instance, say we want to find the DTFT of the signal $x[n] = 0.9^n u[n]$. Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\omega}) = \sum_{n = -\infty}^{\infty} 0.9^n u[n] e^{-j\omega n} \\&#xA;= \sum_{n = 0}^{\infty} (0.9 e^{-j\omega})^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where the series work (geometric power series):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n = 0}^{\infty} a^n = \frac{1}{1-a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then our DTFT is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\omega}) = \frac{1}{1 - 0.9 e^{-j\omega}}$$&lt;/p&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2012-09-18T11:37:32.767" LastActivityDate="2012-09-18T11:37:32.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3372" PostTypeId="1" AcceptedAnswerId="3373" CreationDate="2012-09-18T12:20:22.570" Score="3" ViewCount="1367" Body="&lt;p&gt;I need to enhance an image using only global linear adjustment of intensity, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I'=aI+b,\qquad a,b\in \mathbb{R}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $I$ and $I'$ are input and output (enhanced) image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already know how to determine best values of $a,b$ through histogram stretching given the minimum and maximum intensity within image. However, this will not work on the following image. I have added black and white pixel (in red circle):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yiOyQ.jpg&quot; alt=&quot;auto levels - input&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image already contains values 0 and MAX, further histogram stretching is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I tried &quot;Auto Levels&quot; feature in Paint.NET software  with the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T6uOG.jpg&quot; alt=&quot;auto levels - output&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking on the dialog window, there is some extra factor that affects overall histogram shape (number in the middle right part):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hM8mt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this an additional scaling factor? Or it is some parameter of non-linear transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is is determined? &lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-09-18T13:01:13.010" Title="Relation between histogram equalization and 'Auto Levels'" Tags="|image-processing|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3373" PostTypeId="2" ParentId="3372" CreationDate="2012-09-18T13:01:13.010" Score="3" Body="&lt;p&gt;From the paint.NET manual, the parameter in the middle is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Gamma_correction&quot; rel=&quot;nofollow&quot;&gt;gamma correction&lt;/a&gt;, which can be used to enhance the contrast in the dark tones or high tones. The gamma-curve is the simplest non-linear level transfer curve. A more sophisticated non-linear technique for automatic level adjustment is &lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_equalization&quot; rel=&quot;nofollow&quot;&gt;histogram equalization&lt;/a&gt;, which consists in applying a monotonic, non-linear map to the image, so that the CDF of the resulting image is linear.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-18T13:01:13.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3375" PostTypeId="2" ParentId="3370" CreationDate="2012-09-18T14:13:29.953" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How can i do that?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generate a 370 ms long Hann window, take a 370 ms chunk of your audio, then multiply them together, sample-by-sample.  You're just taking a chunk of audio and fading it in and out at the ends to get rid of any glitches at the start and stop of the chunk.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is meant by 28/32?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure.  I'd guess it means that the waveforms overlap by 28/32 = 87.5%.  This just means that the chunks of audio you read should overlap with chunks you've already read.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presumably your sample rate is 44100 Hz, and the window length is 2&lt;sup&gt;14&lt;/sup&gt; = 16384 samples = 371.5 ms?  So &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Generate a 16384-point Hann window and store it in memory&lt;/li&gt;&#xA;&lt;li&gt;Read audio from sample 0 to sample 16383&lt;/li&gt;&#xA;&lt;li&gt;Multiply them together to get a windowed chunk&lt;/li&gt;&#xA;&lt;li&gt;Do FFT or whatever other processing on the windowed chunk&lt;/li&gt;&#xA;&lt;li&gt;Read audio from sample ~2048 to 2048 + 16384 (87.% overlap with previous chunk)&lt;/li&gt;&#xA;&lt;li&gt;Multiply with window to get a windowed chunk&lt;/li&gt;&#xA;&lt;li&gt;Do FFT or whatever&lt;/li&gt;&#xA;&lt;li&gt;Read audio from sample ~4096 to 4096 + 16384&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The numbers are probably off-by-one, but you get the idea.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2012-09-18T14:13:29.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3376" PostTypeId="2" ParentId="1135" CreationDate="2012-09-18T22:17:50.320" Score="3" Body="&lt;p&gt;Aha there it is wrote a &lt;a href=&quot;http://ahathereitis.blogspot.com/&quot; rel=&quot;nofollow&quot;&gt;blog post&lt;/a&gt; on exactly this topic!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In their post they convert an image of a tennis court down to gray scale. Where they find the first and second derivatives of each horizontal and vertical line. Using this information they're able to determine where bright lines(possible court boundaries) are in the photo. From there they reduce the image to a black and white presentation of only the bright lines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is when they begin to search the image for the tennis courts. They use what they call a &quot;model shape&quot;. A model shape is essentially a description of the object you're looking for &quot;eg: 11 lines for a tennis court&quot;. The author finds all parallel line segments and compares the parallel line segments to the model shape. If there is a high enough match between the line segments and model shape then you have found a tennis court. &lt;/p&gt;&#xA;" OwnerUserId="1979" LastEditorUserId="1979" LastEditDate="2012-12-04T17:23:42.653" LastActivityDate="2012-12-04T17:23:42.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3377" PostTypeId="1" AcceptedAnswerId="3378" CreationDate="2012-09-19T00:10:42.930" Score="3" ViewCount="12565" Body="&lt;p&gt;I have a vector of signals and need to calculate the total energy. I have read somewhere that you can do this by summing up the entire vector and then finding the absolute value of the result. Is this correct? Could anyone suggest any tutorials, or, equations if this is the wrong method, thanks. &lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2012-09-19T00:56:00.887" Title="Calculating the total energy of a signal" Tags="|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3378" PostTypeId="2" ParentId="3377" CreationDate="2012-09-19T00:56:00.887" Score="9" Body="&lt;p&gt;The energy of a discrete-time signal is the sum of the squares:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E_x = \sum_n |x[n]|^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need the average power of your signal, divide the energy by the number of samples in your vector. Power is the average energy per sample of your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal vector is a sample of a stationary process (i.e. a recording clip of someone talking), then average power probably has more meaning than energy (which will grow with the sample length).&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-09-19T00:56:00.887" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3379" PostTypeId="1" CreationDate="2012-09-19T02:03:07.870" Score="4" ViewCount="210" Body="&lt;p&gt;I've heard this from a few different researchers but I can't find a definitive value.  Given the &quot;scale&quot; extracted by David Lowe's SIFT detector, we need to extract a descriptor at a specific scale.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it 6 times the detector &quot;scale&quot;?  3?  1?  I've heard conflicting values.  What is known about this?&lt;/p&gt;&#xA;" OwnerUserId="1981" LastActivityDate="2012-09-19T08:34:59.810" Title="What scale should a detected SIFT point be extracted at?" Tags="|computer-vision|local-features|sift|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3381" PostTypeId="2" ParentId="3379" CreationDate="2012-09-19T08:06:31.257" Score="3" Body="&lt;p&gt;If I understand correctly what you are asking --&#xA;In general, the feature is found at the same scale as the SIFT detector says, but&#xA;in David Lowe's SIFT, the image is pre-smoothed with sigma: 0.5, so, you need to &quot;subtract&quot; this amount of smoothing from the sigma, so the &quot;real&quot; scale could be: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;sqrt(sigma^2 - 0.5^2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where sigma is the scale the feature was found at.&#xA;you have an excellent implementation of SIFT detector and descriptor at: www.vlfeat.org&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="900" LastEditDate="2012-09-19T08:34:59.810" LastActivityDate="2012-09-19T08:34:59.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3382" PostTypeId="1" AcceptedAnswerId="3386" CreationDate="2012-09-19T08:17:16.770" Score="2" ViewCount="765" Body="&lt;p&gt;I'm implementing a scale-space with o octaves and s scale levels in each octave.&#xA;Each octave is half the size the previous. &#xA;I have keypoints found in each octave, I need to approximate the real location of the keypoint to their location in the original image (before the reduction). I need it to be more accurate then just doubling the coordinates.&#xA;I know how to approximate sub-pixel in each octave, but I need &quot;between&quot; the octaves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;matlabit&lt;/p&gt;&#xA;" OwnerUserId="900" LastActivityDate="2012-09-19T13:13:27.197" Title="Approximating pixel location in scale space" Tags="|computer-vision|approximation|scale-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3383" PostTypeId="1" AcceptedAnswerId="3388" CreationDate="2012-09-19T09:08:56.520" Score="0" ViewCount="446" Body="&lt;p&gt;I am looking to find out how accents could/would be detected by a programme, I haven’t as of yet undergone an experiment into detecting or observing anything noticeable about recorded accents. I am not sure a frequency/harmonic analyses will reveal anything. Trying to find any literature review on the subject is sadly lacking, so I was hoping to find out from the community where one might start or what would you look for in any given accent. Something quantifiable could or should surely be observed dependant on an accent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance say I have 10 people from town A and 10 people from town B, all males with roughly the same age Town A and Town B both speak English but have different accents. If I ask each of them to repeat the same word, we should notice a difference in the frequency/harmonic analysis of Town B folk from Town A folk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is your best guess at where this could be found? Is frequency or harmonic analysis going to reveal anything between the two groups?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance if we take specific vowels we could possibly see a certain threshold reached in amplitude level and frequency (pitch) and could then work out the resonance frequencies of the vocal tract for certain accents based on key vowels? In speech science and phonetics the use of formant is used to mean an acoustic resonance of the human vocal tract. It is often measured as an amplitude peak in the frequency spectrum of the sound, using a spectrogram or a spectrum analyzer, though in vowels spoken with a high fundamental frequency, as in a female or child voice, the frequency of the resonance may lie between the widely-spread harmonics and hence no peak is visible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you notice that using a formant table you can construct vowels with a vocal formant filter, could this be reverse engineered to essentially &quot;detect&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My worst fear however is that any given vowel is going to have either a lack of accent specific information, or the analysis done will have too much sporadic information between individuals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone point me in the right direction here im quite stuck?&lt;/p&gt;&#xA;" OwnerUserId="1060" LastActivityDate="2012-09-19T13:40:26.793" Title="Frequency/harmonic analysis of accents" Tags="|frequency-spectrum|frequency|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3384" PostTypeId="1" CreationDate="2012-09-19T09:31:33.773" Score="4" ViewCount="108" Body="&lt;p&gt;I am interested in reovering images affected by blur of known orientation and known span. &#xA;Camera movement during capture is very small, blur span is of about 0-4px.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the most accurate way to model the blur PSF? For example, how would you model the blur PSF in these cases?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;blur span: 0.6 pixels, blur orientation: 0°&lt;/li&gt;&#xA;&lt;li&gt;blur span: 2 pixels, blur orientation: 0°&lt;/li&gt;&#xA;&lt;li&gt;blur span: 3 pixels, blur orientation: 25°&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am actually interested in recovering as accurately as possible the details of the images down to single pixel resolution, so blur PSFs such as [.5 .5] and [.25 .5 .25] are significally different for my pourpose. &lt;/p&gt;&#xA;" OwnerUserId="1852" LastEditorUserId="1852" LastEditDate="2012-09-19T10:50:39.693" LastActivityDate="2024-04-03T12:04:10.493" Title="blur PSF modeling for small stright camera movement" Tags="|image-processing|blind-deconvolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3385" PostTypeId="1" AcceptedAnswerId="3498" CreationDate="2012-09-19T10:57:36.183" Score="1" ViewCount="702" Body="&lt;p&gt;I was reading a paper and came across this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/klGpP.png&quot; alt=&quot;Gabor magnitude pictures&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to implement this in matlab, therefore I initially searched for a premade implementation. I stumbled upon this: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/5237-2d-gabor-filterver123&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/5237-2d-gabor-filterver123&lt;/a&gt; .&#xA;Though they use a different equation. My question now is: what is the difference between this equation and the one from the paper I read ? &lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="29" LastEditDate="2012-09-19T13:52:06.513" LastActivityDate="2012-09-28T21:47:00.270" Title="Difference between Gabor filter implementations" Tags="|image-processing|gabor|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3386" PostTypeId="2" ParentId="3382" CreationDate="2012-09-19T13:07:28.653" Score="5" Body="&lt;p&gt;First, you need to ensure that the pixel has minimal value in its 8-neighborhood. SIFT, SURF and other keypoint detectors filter these pixels in step called &quot;non-maximal suppression&quot;. This is basically a necessary condition for second-order approximation we will use to determine sub-pixel location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you imagine the scale space slice $I$ as a 3D surface, the pixel lays in a valley sorrounded by pixels with higer value. The shape can be well approximated by a parabola surface and the corrected pixel position is at its minimum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pixel value $I(p)$ at location $p=(x,y)^{\textbf{T}}$ can be approximated by second order Taylor expansion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I(p+\delta)\approx I(p) + \delta^{\textbf{T}}g+\frac{1}{2}\delta^{\textbf{T}}H\delta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $g$ and $H$ are gradient (2-vector of first order derivatives) and Hessian ($2\times 2$ matrix of second-order derivatives) at $(x,y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\delta$ is a sub-pixel correction factor we want to compute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the parabola has minimum at point where its derivatives are equal to zero, we obtain derivative of right-hand side of the above Taylor expansion (with respect to $\delta$) and place it equal to zero:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g+H\delta=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this we can compute the correction vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\delta=-H^{-1}g$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the desired sub-pixel location is given by $p + \delta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gradient and Hessian are obtained using &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_difference_method&quot;&gt;finite differencing&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g_{1}=\left( I(x+1,y)-I(x-1,y) \right)\cdot 1/2$$&#xA;$$g_{2}=\left( I(x,y+1)-I(x,y-1) \right)\cdot 1/2$$&#xA;$$H_{1,1}=I(x+1,y)+I(x-1,y)-2I(x,y)$$&#xA;$$H_{1,2}=H_{2,1}=\\ \left(I(x+1,y+1)+I(x-1,y-1)+I(x+1,y-1)+I(x-1,y+1)\right)\cdot 1/4$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the algorithm is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check if the pixel is a local minimum (sorrounded by pixels with higher value).&lt;/li&gt;&#xA;&lt;li&gt;Compute $g$ and $H$ using finite differencing formulas above.&lt;/li&gt;&#xA;&lt;li&gt;Compute $\delta$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can repeat steps 2. and 3. for extra accuracy, but just one step is fine for our needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value at sub-pixel location $I(p+\delta)$ can be obtained by well known &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_interpolation&quot;&gt;bilinear&lt;/a&gt; or bicubic interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We did the interpolation with respect to $x,y$, but you can perform this interpolation with respect to scale as well. This will lead to 3-vector gradient and $3\times 3$ Hessian, but the Taylor expansion formula holds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can take a look on &lt;a href=&quot;http://www.chrisevansdev.com/computer-vision-opensurf.html&quot;&gt;OpenSURF&lt;/a&gt; implementation in C++ or C# which has this implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above derivation is actually a Newton's Method used in multivariate optimization.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-09-19T13:13:27.197" LastActivityDate="2012-09-19T13:13:27.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3387" PostTypeId="1" CreationDate="2012-09-19T13:34:44.433" Score="7" ViewCount="4010" Body="&lt;p&gt;Adobe's Photoshop has an excelent filter called &quot;Shadow/Highlight&quot; used to correct, in one step, dark areas AND overexposed areas of a photo. By simple analysis, I suppose it uses some radius-dependent adaptive contrast algorithm (halo effect is typical), possibly combined with interpolation (even extra-dark or extra/white, clipped areas get very improved with this filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameters used can be seen in the dialog box below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RNs3Z.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would be looking for is a way to start exclusively with the parameter values given in the dialog box, apply a sequence of parameterized operations &quot;blindly&quot;, and get back the result non-interactively (well, perhaps previewing the image while adjusting parameter sliders in some GUI environment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion about how to perform this with standard, well-known image-processing algorithms?&lt;/p&gt;&#xA;" OwnerUserId="1558" LastEditorUserId="128" LastEditDate="2018-05-25T16:19:49.803" LastActivityDate="2020-12-22T17:13:34.733" Title="Applying Photoshop's &quot;Shadow / Highlight&quot; Correction Using Standard Image Processing Algorithms" Tags="|image-processing|adaptive-algorithms|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3388" PostTypeId="2" ParentId="3383" CreationDate="2012-09-19T13:40:26.793" Score="3" Body="&lt;p&gt;I would guess that the most prevalent difference between accents (of the same language) is how the vowels are pronounced. Humans distinguish vowels mainly by the frequency of the formant, i.e. regions of high energy in the harmonic spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good way to display this is the &quot;formant map&quot; which plots the frequency region of the second formant against the frequency region of the first. See for example: &lt;a href=&quot;http://www.phy.davidson.edu/fachome/dmb/digitalspeech/formantmap.gif&quot; rel=&quot;nofollow&quot;&gt;http://www.phy.davidson.edu/fachome/dmb/digitalspeech/formantmap.gif&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this 2D map every map has a specific region. For different accent the centroids of this regions probably shift around. That is certainly true for different languages. An interesting approach would be to measure this map for, say, an Australian vs. an American English speaker and look for systematic differences.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-09-19T13:40:26.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3389" PostTypeId="2" ParentId="3387" CreationDate="2012-09-19T14:42:25.533" Score="2" Body="&lt;p&gt;I think this can be achieved through histogram stretching. Input pixel values (levels) are mapped using linear transform from $&amp;lt;\textbf{min}_{in},\textbf{max}_{in}&amp;gt;$ to $&amp;lt;\textbf{min}_{out},\textbf{max}_{out}&amp;gt;$. The intensity transform for input and output pixel values look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I_{out}=\frac{I_{in}-\textbf{min}_{in}}{\textbf{max}_{in}-\textbf{min}_{in}}\cdot(\textbf{max}_{out}-\textbf{min}_{out})+\textbf{min}_{out}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula can be simpler, but this one is more clear, at is transform input values from one interval to the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, $\textbf{min}$ is 0 and $\textbf{max}$ is 255 (depending on bit depth). Increasing value of $\textbf{min}_{in}$ emphasizes shadows, while decreasing $\textbf{max}$ emphasizes lights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also &quot;radius&quot; track bars, so I suppose the histogram operation can be done adaptively / locally, i.e. histogram is computed for a window at every pixel instead of whole image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gaussian blur on work image prior to histogram computation may be convenient when the window is small to avoid sharp transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, you can compute difference map which you smooth and then apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The adjustment will likely disturb color balance, so applying to luma channel only or computing adjustment of gray value and applying to R,G and B channels should suffice.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-09-19T14:42:25.533" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3390" PostTypeId="1" CreationDate="2012-09-19T14:46:51.830" Score="12" ViewCount="7237" Body="&lt;p&gt;I'm working on a project where we measure the solderability of components. The measured signal is noisy. We need to process the signal in real time so that we are able to recognize the change that begins at the time of 5000 milliseconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My system takes sample of real value every 10 miliseconds - but it can be adjusted to slower sampling.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can I detect this drop at 5000 milliseconds?&lt;/li&gt;&#xA;&lt;li&gt;What do you think about signal/noise ratio? Should we focus and try to get better signal?&lt;/li&gt;&#xA;&lt;li&gt;There is a problem that every measure has different results, and sometimes the drop is even smaller than this example.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p4r9d.png&quot; alt=&quot;Sample Signal&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1ovKa.png&quot; alt=&quot;Sample signal 2&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TCziW.png&quot; alt=&quot;Sample signal 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link to data files (they are not same with ones used for plots, but they show latest system status)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.google.com/open?id=0B3wRYK5WB4afV0NEMlZNRHJzVkk&quot; rel=&quot;noreferrer&quot;&gt;https://docs.google.com/open?id=0B3wRYK5WB4afV0NEMlZNRHJzVkk&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.google.com/open?id=0B3wRYK5WB4afZ3lIVzhubl9iV0E&quot; rel=&quot;noreferrer&quot;&gt;https://docs.google.com/open?id=0B3wRYK5WB4afZ3lIVzhubl9iV0E&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.google.com/open?id=0B3wRYK5WB4afUktnMmxfNHJsQmc&quot; rel=&quot;noreferrer&quot;&gt;https://docs.google.com/open?id=0B3wRYK5WB4afUktnMmxfNHJsQmc&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.google.com/open?id=0B3wRYK5WB4afRmxVYjItQ09PbE0&quot; rel=&quot;noreferrer&quot;&gt;https://docs.google.com/open?id=0B3wRYK5WB4afRmxVYjItQ09PbE0&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.google.com/open?id=0B3wRYK5WB4afU3RhYUxBQzNzVDQ&quot; rel=&quot;noreferrer&quot;&gt;https://docs.google.com/open?id=0B3wRYK5WB4afU3RhYUxBQzNzVDQ&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1984" LastEditorUserId="2058" LastEditDate="2012-10-04T12:29:28.057" LastActivityDate="2017-01-30T17:52:08.037" Title="How to detect &quot;fast&quot; changes in signal processing" Tags="|filters|discrete-signals|real-time|measurement|" AnswerCount="3" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="3392" PostTypeId="2" ParentId="3390" CreationDate="2012-09-19T18:07:31.693" Score="4" Body="&lt;p&gt;I usually frame this problem as one of slope detection.  If you compute a linear regression over a moving window, the illustrated drop will be visible as a significant change in slope sign and/or magnitude.  This approach offers are a number of factors that will require &quot;tuning&quot;: for example, the sampling frequency, the window size, etc, will affect the robustness (noise resistance) of the slope sign detector.  This is where some of the above comments may be applied.  Any filtering or noise suppression that can be applied prior to line fitting will improve your results.&lt;/p&gt;&#xA;" OwnerUserId="457" LastEditorUserId="457" LastEditDate="2012-09-20T05:21:47.510" LastActivityDate="2012-09-20T05:21:47.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3393" PostTypeId="1" AcceptedAnswerId="3394" CreationDate="2012-09-19T22:46:31.420" Score="4" ViewCount="2124" Body="&lt;p&gt;I'm completely new to this field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps I'm calling it by a wrong name, but I want to analyze an audio track and retrieve a &lt;strong&gt;timestamp to beat&lt;/strong&gt; mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an open source 3rd party library that can perform this, or could/should I do it myself?&lt;/p&gt;&#xA;" OwnerUserId="1987" LastEditorUserId="1606" LastEditDate="2012-11-26T10:10:30.943" LastActivityDate="2014-12-18T17:29:55.620" Title="Extracting audio track to determine the song beat" Tags="|audio|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3394" PostTypeId="2" ParentId="3393" CreationDate="2012-09-20T08:56:36.967" Score="9" Body="&lt;p&gt;&lt;a href=&quot;http://www.omras2.org/SonicAnnotator&quot;&gt;Sonic Annotator&lt;/a&gt;. Good: their beat tracking algorithm is the most sophisticated. Bad: this is not easy to integrate and interface into your own application (you need to load their own flavor of plug-ins called &quot;VAMP&quot;); and the beat tracker is closed source - available as a pre-compiled binary lib.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://aubio.org/&quot;&gt;Aubio&lt;/a&gt;. Good: very easy to integrate, plain C with few dependencies. Bad: the quality of the beat-tracking is so-so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://marsyas.info/&quot;&gt;Marsyas&lt;/a&gt;. Good: beat-tracking accuracy is OK (but not as good as Sonic Annotator's). Bad: many dependencies, very complex framework.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on what is your target application (is the audio to analyze a recording of a well-known/distributed song, and does your system have internet access), you could also use the &lt;a href=&quot;http://developer.echonest.com/docs/v4/track.html#analyze&quot;&gt;Echo Nest APIs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to roll your own, I suggest you &lt;a href=&quot;http://labrosa.ee.columbia.edu/projects/beattrack/&quot;&gt;this&lt;/a&gt; as a starting point - start porting this rather simple matlab implementation to your language of choice, and you'll be at 80% or 90% of the accuracy of the most sophisticated solution.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-20T08:56:36.967" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3395" PostTypeId="1" CreationDate="2012-09-20T08:57:46.567" Score="1" ViewCount="738" Body="&lt;p&gt;If I use Goertzel algorithm for calculate the magnitude of current or voltage, use for measure current harmonic or voltage harmonic or fundamental component. I not use for detect harmonic. Do you know the accuracy for measure harmonics is good or not?,How much about relative error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another one question is The Accuracy relative with number of data sample?&#xA;Ex. If I have measure voltage harmonic,&#xA; I measure waveform of current by use sample rate = 4000 Hz, target frequency for measure fundamental harmonic is 50Hz, so if I use number of sample (bin width) for Goertzel algorithm is 80 sample this is minimum, If I use more then 80 samples like 4000 sample the accuracy will more accurate right? how much better?&lt;/p&gt;&#xA;" OwnerUserId="1989" LastEditorUserId="1989" LastEditDate="2012-09-20T09:30:41.507" LastActivityDate="2012-09-20T20:27:48.253" Title="Accuracy of Goertzel algorithm for measure harmonic" Tags="|measurement|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3396" PostTypeId="1" AcceptedAnswerId="3440" CreationDate="2012-09-20T10:24:36.443" Score="1" ViewCount="178" Body="&lt;p&gt;Could you please help me to answer this question ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a Shannon formula for Capacity as&#xA;\begin{align}&#xA;   C=B\log_2(1+\frac{h*P}{B*N_0})&#xA;\end{align}&#xA;where h is a random variable which denotes the channel gain with channel mean power &#xA;\begin{align}&#xA;   \Omega=E[h]&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do the simulation such as for Rayleigh fading. I have to set a value for $\Omega$. But I don't know if $\Omega &amp;gt; 1$ or it must be smaller than 1. I have read many papers from IEEE. Some of papers set value of $\Omega &amp;gt; 1$, some of them is smaller than 1. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Could you please explain for me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- When it is greater than 1 and when it is smaller than 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- In practice, how the range of $\Omega$ is ? &lt;/p&gt;&#xA;" OwnerUserId="1990" LastEditorUserId="1990" LastEditDate="2012-09-20T16:24:57.617" LastActivityDate="2012-10-25T12:06:46.263" Title="Question about fading" Tags="|frequency-spectrum|multipath|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3399" PostTypeId="2" ParentId="3395" CreationDate="2012-09-20T18:17:29.400" Score="2" Body="&lt;p&gt;The most common Goertzel algorithms are identical to calculating the magnitude of 1 bin of an FFT/DFT using a rectangular window.  As such, there will be rectangular window artifacts (so called &quot;leakage&quot;) for any spectral content, such as harmonics, that are not exactly periodic in the DFT length, or Goertzel length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus the accuracy of using just 1 bin may not be more accurate if you increase the length from one where all the spectral content is periodic to one where it isn't.  With a complete FFT, one can somewhat mitigate this effect by using high quality interpolation in the complex domain before taking the magnitude.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-09-20T20:27:48.253" LastActivityDate="2012-09-20T20:27:48.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3400" PostTypeId="1" AcceptedAnswerId="3401" CreationDate="2012-09-20T20:43:28.093" Score="6" ViewCount="17562" Body="&lt;p&gt;Which method provides better noise immunity? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you can transmit more data via psk, but what about which method is less susceptible to noise?&lt;/p&gt;&#xA;" OwnerUserId="1912" LastActivityDate="2020-11-26T14:04:46.757" Title="PSK vs FSK for noise immunity?" Tags="|noise|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3401" PostTypeId="2" ParentId="3400" CreationDate="2012-09-21T13:54:50.363" Score="5" Body="&lt;p&gt;As you say in your comment, PSK signals are more bandwidth efficient, but FSK signals have good noise rejection for their data rates.  It is thus difficult to compare them on even terms.&lt;/p&gt;&#xA;&lt;p&gt;The traditional way of measuring noise immunity is measuring/calculating the probability of a bit error given the bit energy vs. noise energy (Eb/No).  This is a good way of making everything fair&lt;/p&gt;&#xA;&lt;p&gt;The following plot uses &lt;a href=&quot;https://web.archive.org/web/20120526172429/https://users.tricity.wsu.edu/%7Eee432/Text/21-fsk.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for the FSK analysis, and &lt;a href=&quot;http://www.dsplog.com/2007/08/05/bit-error-probability-for-bpsk-modulation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt; for the BPSK analysis.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e1JDh.png&quot; alt=&quot;FSK and BPSK BER Curve&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, BPSK wins quite handily.  I won't attempt to prove it, but QPSK has the exact same BER curve as BPSK.  You can intuitively see that if you think about how the real and imaginary portions of the symbol are orthogonal to each other, so you are essentially just sending two orthogonal BPSK signals at the same time.  The BER curves of the higher PSK types (e.g. 8-PSK), though, do get worse because the symbols are closer together, so more energy is needed to distinguish them in the presence of noise.&lt;/p&gt;&#xA;&lt;p&gt;So why does anyone use FSK?  Mostly because it's pretty simple to implement, particularly the non-coherent receivers.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="54313" LastEditDate="2020-11-26T14:04:46.757" LastActivityDate="2020-11-26T14:04:46.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3402" PostTypeId="2" ParentId="2206" CreationDate="2012-09-21T19:57:05.210" Score="1" Body="&lt;p&gt;One possible approach would be to use an echo cancellation algorithm to do the heavy lifting of telling you where the echos were coming in. Just make sure the code you use is able to give you that information, since it's intermediate. This assumes some reflective surfaces and so on, but since you just looking at a rough estimate, it may work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Off the top of my head, I don't know how these algorithms find the delay-time. If you want to do it yourself, you could try autocorrelation, but given the time delays you are likely to be dealing with, I suspect this won't be as efficient as whatever the echo cancellation experts have figured out.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-09-21T19:57:05.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3403" PostTypeId="1" CreationDate="2012-09-21T20:00:11.960" Score="3" ViewCount="1733" Body="&lt;p&gt;I am tasked with designing the logic for an automatic gain control. It won't be a traditional AGC in that it has to run on a computer and continuously modifying the volume is not possible in the same way as it is in hardware. It will be more of a &quot;roughly set the input gain for me automatically if it's way off&quot; than an AGC per se. However, I plan to approach the design in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be used primarily for voice/speech, so what I want to do is prevent incoming silence (when the speaker is not speaking) from causing the gain to be set too high. I would like to avoid anything as complex as voice activity detection as well as complex ad-hoc methods that involve deriving more than a few simple parameters -- at least for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any simple tricks I can use to to help with this problem, or is the best approach to use full-fledged voice activity detection?&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-10-26T21:06:46.927" Title="Automatic Gain Control for voice" Tags="|audio|speech-recognition|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3405" PostTypeId="1" AcceptedAnswerId="3409" CreationDate="2012-09-22T21:42:43.597" Score="8" ViewCount="862" Body="&lt;p&gt;Let's say the task is to determine element position on image.&#xA;First very important thing is correct detection of object then some algorithms of calculating position are used (for examble blob analysis). Everything depends on multiple things (detection correctness, used algorithms etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets assume we have callibrated image and know error given by callibration.&#xA;What are the methods to calculate reliably precision of computer (and machine) vision algorithms?&#xA;Can it be done analiticaly or only by experiments and tests?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question addres cases when we detect element position and also other computer vision problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I want to get references to problems which are related to computer/machine vision especially element position detection and present some correctness computations either analyticaly or experimental approach to show this precission.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also suggestions how to improve this question are welcomed.&lt;/p&gt;&#xA;" OwnerUserId="583" LastActivityDate="2012-10-03T20:08:17.847" Title="Precision of Computer Vision algorithms" Tags="|image-processing|computer-vision|reference-request|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3406" PostTypeId="1" AcceptedAnswerId="3407" CreationDate="2012-09-23T07:59:34.457" Score="5" ViewCount="7211" Body="&lt;p&gt;I have the absolute Spectrogram of an audio signals.&lt;br&gt;&#xA;I lost the phase data of the Spectogram because of various processing applied on the original spectrogram of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to reconstruct the audio signal in a meaningful (Audibly) manner from teh absolute value only of the Spectrogram.&lt;br&gt;&#xA;The obvious inverse won't work (The DFT inverse of the absolute, Since the Phase is significant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Spectrogram is a result of fusion of few audio signals as I'm trying to create a smooth transition between audio signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone has experience with the problem?  Anyone has experience with this procedure?&#xA;Could anyone refer me to a code, article, etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2012-09-23T11:52:14.650" LastActivityDate="2012-09-23T16:14:30.423" Title="Reconstruction of Audio Signal from its Absolute Spectrogram" Tags="|audio|spectrogram|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3407" PostTypeId="2" ParentId="3406" CreationDate="2012-09-23T10:24:37.243" Score="7" Body="&lt;p&gt;One thing commonly done (for example in the source separation community) is to use the phase data of the original signal (before transformation where applied to it) - the result is much better than null or random phase, and not so far from algorithms aiming at reconstructing the phase information from scratch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A classic reconstruction algorithm is Griﬃn&amp;amp;Lim's, described in the paper &quot;Signal estimation from modiﬁed short-time Fourier transform&quot;. This is an iterative algorithm, each iteration requires a full STFT / inverse STFT, which makes it quite costly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem is indeed an active area of research, a search for STFT + reconstruction + magnitude will yield plenty of papers aiming at improving on Griffin&amp;amp;Lim in terms of signal quality and/or computational efficiency.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-23T10:24:37.243" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3408" PostTypeId="1" CreationDate="2012-09-23T10:34:08.120" Score="2" ViewCount="3289" Body="&lt;p&gt;I need to compute FFT components and autocorrelation of a discrete signal. When I do not use any window function before taking FFT of the signal I get a reasonable AC function from FFT that includes some information about period of the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/USfjf.png&quot; alt=&quot;AC-1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I apply a window function (Hanning) before applying FFT I got an AC function that seems to be distorted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M9g1l.png&quot; alt=&quot;AC-2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the effect of window function on an AC function that is computed from FFT?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2012-09-24T12:47:25.343" Title="Effect of Windowing Function on Autocorrelation Function" Tags="|fft|autocorrelation|window-functions|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3409" PostTypeId="2" ParentId="3405" CreationDate="2012-09-23T10:56:39.463" Score="5" Body="&lt;p&gt;For example, &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot; rel=&quot;noreferrer&quot;&gt;Hartley &amp;amp; Zisserman&lt;/a&gt; suggest using preconditioning prior to homography estimation, because taking direct matrix inverse can lead to huge errors or instabilities.&#xA;This applies to any numerical method working with matrix inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feature detection algorithms often use sub-pixel approximation of interest point location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most books discussing numerical methods also deal with their stability analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes you need to do some statistics to analyze precision and accuracy of your estimator (be it a least-squares estimator or maximum likelihood estimator). This is useful in algorithms like &lt;a href=&quot;http://en.wikipedia.org/wiki/Ransac&quot; rel=&quot;noreferrer&quot;&gt;RANSAC&lt;/a&gt;, which deal with outliers. You would also like to know, how well the estimated transform fit your data and possibly discard results that are too inaccurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When working with finite differencing or doing some filtering, a slight Gaussian blurring is done to remove noise, which would otherwise cause huge errors in second derivatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some problems in computer vision are ill-posed. A method of regularization (such a Tikchonov regularization) is necessary in order to solve them. Examples where this is necessary include computing anisotropic diffusion.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-09-23T10:56:39.463" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="3410" PostTypeId="2" ParentId="3406" CreationDate="2012-09-23T13:09:05.463" Score="7" Body="&lt;p&gt;To make it clear, I can summarise the reconstruction from magnitude coefficients algorithm as follows, I took the algorithm from this &lt;a href=&quot;http://web.itu.edu.tr/~ibayram/AnDwt.pdf&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt;. (See Experiment 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a random input signal $x$, it can be noise. And denote your magnitude of the STFT as $|Y|$. Denote $S$ as the STFT operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Iteratively, you have to perform following steps,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Perform $X = S(x)$&lt;/li&gt;&#xA;&lt;li&gt;Compute $Z = |Y| \exp(i \angle X)$&lt;/li&gt;&#xA;&lt;li&gt;$x = S^{-1}(Z)$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2012-09-23T13:22:22.763" LastActivityDate="2012-09-23T13:22:22.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3411" PostTypeId="2" ParentId="3406" CreationDate="2012-09-23T16:14:30.423" Score="4" Body="&lt;p&gt;To (re)create a signal containing more information content than what one has, one has to make some assumptions.  The construction process will only be as good as the correctness of the assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you assume the original signal was spectrally sparse and the spectrogram was created from frames with a known constant offset, then peak interpolation and minimization of transients produced by those interpolated spectral peaks between adjacent frames can be used as a &quot;reverse phase vocoder&quot; estimator of the change in phase between frames.  You will need a starting phase; but arbitrary might work.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-09-23T16:14:30.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3412" PostTypeId="1" AcceptedAnswerId="3413" CreationDate="2012-09-23T18:44:02.173" Score="5" ViewCount="569" Body="&lt;p&gt;I'm a little confused... I always thought the DFT of a convolution was equal to a product of DFTs, but when I tried this in Python:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy import *&#xA;&#xA;a = [1+0j, 2+0j]&#xA;b = [4+0j, 5+0j]&#xA;&#xA;print list(ifft(fft(a) * fft(b)))&#xA;print list(convolve(a, b))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I got back:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[(14+0j), (13+0j)]&#xA;[(4+0j), (13+0j), (10+0j)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why are they not the same thing?&lt;/p&gt;&#xA;" OwnerUserId="310" LastActivityDate="2012-09-23T19:56:14.070" Title="Why idft(dft(a) * dft(b)) not equal to convolve(a, b)?" Tags="|fourier-transform|convolution|dft|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3413" PostTypeId="2" ParentId="3412" CreationDate="2012-09-23T19:56:14.070" Score="16" Body="&lt;p&gt;&lt;code&gt;ifft(fft(a) * fft(b))&lt;/code&gt; performs a cyclic convolution, &lt;code&gt;convolve&lt;/code&gt; apparently zero-pads the inputs. If you pad both arrays with zeros, the result should be the same:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = [0,0,0,1+0j, 2+0j,0,0,0]&#xA;b = [0,0,0,4+0j, 5+0j,0,0,0]&#xA;&#xA;print list(ifft(fft(a) * fft(b)))&#xA;print list(convolve(a, b))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-09-23T19:56:14.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3415" PostTypeId="1" AcceptedAnswerId="3416" CreationDate="2012-09-23T12:52:26.773" Score="0" ViewCount="94" Body="&lt;p&gt;I'm after some advice on a problem that I am facing regarding signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am processing a voice clip (.wav) and this voice clip contains noise, and I need to remove the noise and just concentrate on the Phones so I can analise them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have thought about, and, what I have researched is, if I use zero-crossing as well as the total energy I can remove the blocks that do not contain sufficient energy or frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem at the minute is that I have a 1D vector, acting as a 2D vector and let's assume the following data is used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v1 = {128, 128, 128, 127}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now my current algorithm squares each of these numbers and then sums the entire vector up. This, would therefore not be able to give me an accurate identification of noisy signals. So should I therefore split the signal into blocks (In that I get a 2D vector)? e.g. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B1 = {128, 128};&#xA;B2 = {128, 127};&#xA;&#xA;e1 = {sum( (128^2) (128^2) )};&#xA;e2 = {sum( (128*2) (127^2) )};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Therefore, this would mean I am given 2 (In this example) energies which I can then check to see if they match the threshold. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last question, do you think the methods of zero-crossing AND energy are good an accurate way of determining noise and removing it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope someone can help me, thanks :)!&lt;/p&gt;&#xA;" OwnerUserId="1810" OwnerDisplayName="user1582478" LastEditorUserId="13320" LastEditDate="2018-06-10T10:51:00.183" LastActivityDate="2018-06-10T10:51:00.183" Title="Signals - Removing Blocks" Tags="|audio|speech-recognition|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3416" PostTypeId="2" ParentId="3415" CreationDate="2012-09-24T00:38:33.673" Score="1" Body="&lt;p&gt;An energy or zero-crossing criterion might help in detecting segments containing no voice, but it won't help in removing the noise superimposed with speech. Since you are mentioning removing noise for improving speech analysis, this doesn't look like the right technique to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you compute your energy using small windows, down to summing a few adjacent coefficient, you will see fluctuation in energy which are just due to the periodic variation of the waveform itself! As a rule of thumb, the window size on which you compute an energy feature must be at least one magnitude bigger than the period of the signal to analyze. Assuming a f0 of 200 Hz, this gives you a minimal integration window of 50ms, or 400 samples at 8kHz.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-24T00:38:33.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3419" PostTypeId="1" CreationDate="2012-09-24T10:44:50.080" Score="1" ViewCount="549" Body="&lt;p&gt;I have computed the heart rate from two pleth signals (from two fingers -both are acquisition-ed from two different devices) heart rate pattern looks similar with some delay in it i could manually see the delay and add those offsets to the original pleth ...Is there any automated method to find the delay and to add those offsets  to the original  pleth signals in Matlab( both the pleth signals are  downsampled to same 10 Hz)&lt;/p&gt;&#xA;" OwnerUserId="2006" OwnerDisplayName="sivanesan" LastActivityDate="2012-09-24T12:12:23.207" Title="automatic methods to find the delay and to sync the original pleth signals" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3420" PostTypeId="2" ParentId="3419" CreationDate="2012-09-24T12:12:23.207" Score="4" Body="&lt;p&gt;Compute the cross-correlation of the two signals and look at the lag at which the cross-correlation takes its maximum value - this will give you the time offset providing the best alignment of the two signals.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-24T12:12:23.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3421" PostTypeId="2" ParentId="3408" CreationDate="2012-09-24T12:47:25.343" Score="3" Body="&lt;p&gt;When you are using the FFT to get a measurement of the frequency content of a signal it is appropriate to window the data first to avoid distortions due to a rectangular cutoff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is not what you are doing with the FFT, though.  You are using the FFT and inverse FFT to efficiently calculate a correlation (an autocorrelation is just a special case of correlation).  Done properly with padding and such, the FFT will get you the exact same results that you would get by calculating the correlation in the time domain.  If you window, though, you will not get the same results.  In short, you should not window when you are using the FFT to calculate correlations or convolutions.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-09-24T12:47:25.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3425" PostTypeId="1" AcceptedAnswerId="3426" CreationDate="2012-09-24T14:44:56.680" Score="3" ViewCount="873" Body="&lt;p&gt;I recorded sounds with a microphone and I try to distinguish them in my Java program. The frequency works quite good, but if I look at the fourier transforms it seems like there should be more features to distinguish sounds. I don´t know very much about signal processing, maybe you can help me. Here is a picture of two fourier transformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8DMvb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/8DMvb.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the frequency is determined by the index of the maximum magnitude (hope that is the right term). In the first fourier transform curve, its at 100, in the second at 12 (frequencies are 1102.5 and 132.3). But the two sounds look so differently when they are transformed, what else could I use to distinguish them?&lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2012-09-24T15:45:33.230" Title="What features describe audio signals? (Besides frequency and amplitude)" Tags="|audio|fourier-transform|frequency|sound|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3426" PostTypeId="2" ParentId="3425" CreationDate="2012-09-24T15:06:43.887" Score="12" Body="&lt;p&gt;Two remarks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I am assuming you are plotting the real (or imaginary) part of the Fourier transform. It is much more common to work with the magnitude or squared magnitude (power spectrum).&lt;/li&gt;&#xA;&lt;li&gt;The peak in the spectrum is a very poor measure of fundamental frequency (pitch). Take a piano note at 440 Hz, apply a notch filter to it to remove the 440 Hz component. Even if the peak in the spectrum is now at 880 Hz (roughly), it will still sound like a 440 Hz note - yes, at a frequency totally absent from the spectrum!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To answer your question, timbre is the property that distinguish sounds of same loudness and pitch. However, it is not an unidimensional characteristic with a well-defined unit. What you can extract are features such that things that &quot;sound similar&quot; have similar features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Common features used for characterizing timbre include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Spectral centroid, which indicate how &quot;dark&quot; or &quot;bright&quot; a sound will be perceived, spectral spread (a measure of bandwidth, tonality vs noisiness), and moments of order 3 and 4 (kurtosis and skewness).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Energy in each Bark band, or ratio of energies between consecutive Bark bands.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Any low-dimensionality descriptors of spectral envelope, including autoregressive coefficients, or Mel-Frequency cepstral coefficients.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;See section 6 of &lt;a href=&quot;http://recherche.ircam.fr/anasyn/peeters/ARTICLES/Peeters_2003_cuidadoaudiofeatures.pdf&quot;&gt;this document&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-09-24T15:45:33.230" LastActivityDate="2012-09-24T15:45:33.230" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3428" PostTypeId="1" AcceptedAnswerId="3429" CreationDate="2012-09-24T20:03:23.000" Score="3" ViewCount="76212" Body="&lt;p&gt;According to Wikipedia,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The sine wave or sinusoid is a mathematical function that describes a&#xA;  smooth repetitive oscillation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The formula for the Sine wave is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CyoSw.png&quot; alt=&quot;Sine Wave Equation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A = Amplitude of the Wave&#xA;ω = the angular frequency, specifies how many oscillations occur in a unit time interval, in radians per second&#xA;φ, the phase,&#xA;t = ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here ω, is the angular frequency i.e ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m9Psv.png&quot; alt=&quot;Angular Frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It defines how many cycles of the oscillations are there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let see the frequency,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Frequency is the number of occurrences of a repeating event per unit&#xA;  time&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For example, if 100 events occur within 15 seconds the frequency is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Events = 100;&#xA;Time = 15;&#xA;FREQ = Events/Time;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which means there is total 100 cycles of wave in 15 seconds , am i correct ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Events = 71;&#xA;Time = 15;&#xA;FREQ = Events/Time;&#xA;W = 2*PI*FREQ;   % 2*PI for circular path&#xA;A = 2 ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now what is the use of small 't' ? in the Sine wave equation , what time is it ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2020-05-13T08:24:56.033" Title="time in Sine Wave equation" Tags="|frequency|wave|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3429" PostTypeId="2" ParentId="3428" CreationDate="2012-09-24T20:15:07.680" Score="5" Body="&lt;p&gt;In the context that you described, $t$ is a variable indicating &lt;em&gt;time&lt;/em&gt;. That is, the wave will take on a value of $y(t)$ at the time instant $t$. If this is measured in seconds, then $\omega$ specifies the number of radians that the wave passes through in one second. And, as you noted, if the wave has a frequency of $\frac{100}{15}\ \text{Hz}$, then it will pass through 100 periods in 15 seconds.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-09-24T20:15:07.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3431" PostTypeId="1" AcceptedAnswerId="3432" CreationDate="2012-09-25T06:18:18.710" Score="2" ViewCount="224" Body="&lt;p&gt;I'm doing a rigid body between point clouds using SVD.&lt;br&gt;&#xA;Sometimes the routine produces an incorrect rotation matrix with a Determinant=-1, ie a reflection matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea why ?&lt;br&gt;&#xA;Is there a valid way of converting the result into a correct matrix? &lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-09-25T07:02:51.447" Title="Reflection Rotation matrix" Tags="|matrix|geometry|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3432" PostTypeId="2" ParentId="3431" CreationDate="2012-09-25T07:02:51.447" Score="3" Body="&lt;p&gt;Take a look on &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthogonal_Procrustes_problem#Generalized.2Fconstrained_Procrustes_problems&quot; rel=&quot;nofollow&quot;&gt;Generalized/constrained Procrustes Problems&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be sufficient to update singular values in $\Sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\det(SVD)=-1$ case is discussed in more detail in 1987 paper of Arun, Huang and Blostein: &lt;em&gt;&quot;Least-squares fitting of two 3-D point sets&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-09-25T07:02:51.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3433" PostTypeId="1" AcceptedAnswerId="3452" CreationDate="2012-09-25T07:13:37.330" Score="7" ViewCount="512" Body="&lt;p&gt;I am reading bishop book on pattern recognition and machine learning. Going through the introduction section, I am not sure if I get the differences between the two widely used term &quot;test data&quot; and &quot;training data&quot;. Is training data the data you will have after the pre-processing stage which is also called feature extraction? Where test data is the original input. Am I right?&lt;/p&gt;&#xA;" OwnerUserId="89" LastActivityDate="2015-06-14T20:34:47.923" Title="Test data vs. training data" Tags="|soft-question|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3434" PostTypeId="1" CreationDate="2012-09-25T08:57:53.627" Score="-2" ViewCount="2450" Body="&lt;p&gt;I'm looking for a formula to calculate the bit error rate of a wifi communication 802.11a/b/g according to the distance between transmitter and receiver.&lt;/p&gt;&#xA;" OwnerUserId="1141" LastActivityDate="2012-09-25T11:18:53.123" Title="formula to calculate ber in wireless 802.11 according to distance from tx and rx" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3435" PostTypeId="2" ParentId="3433" CreationDate="2012-09-25T09:02:14.133" Score="6" Body="&lt;p&gt;When you use machine learning algorithms on data sets, you use one part of the data (the training set) to train your algorithm (i.e., feature extraction). Once the training is completed, you'll need to evaluate the performance of the trained algorithm and you do this by applying it to new data, that is, the second part of your original data (the test data). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this strategy you will be able to evaluate whether your trained algorithm indeed extracts valid features of your data (i.e., it works well on the training data and on the test data), or if it was &quot;overlearned&quot; or &quot;overfitted&quot; (i.e., it performs only well on the training data and bad on the test data). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further information see wikipedia on &lt;a href=&quot;http://en.wikipedia.org/wiki/Training_set&quot; rel=&quot;nofollow&quot;&gt;training set&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Test_set&quot; rel=&quot;nofollow&quot;&gt;test set&lt;/a&gt;, and &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-validation&quot; rel=&quot;nofollow&quot;&gt;cross validation &lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="1874" LastEditDate="2012-09-25T11:08:17.923" LastActivityDate="2012-09-25T11:08:17.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3436" PostTypeId="1" CreationDate="2012-09-25T09:11:18.287" Score="3" ViewCount="315" Body="&lt;p&gt;Whenever we listen stereo songs, one part of the audio like voice hear at the center of the head, and other parts are nearby left ear and right ear. If I represent center part by C, and other parts by L' and R', We may model our original left and right channel as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PxflZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;L' + C = L    and,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;R' + C = R. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As, common part of L and R channel comes in C vector, L' and R' are uncorrelated. Now we can say, (alpha + beta = pi/2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this modelling correct as per the listening scenario for stereo sound? &lt;/p&gt;&#xA;" OwnerUserId="1281" LastEditorUserId="1281" LastEditDate="2012-09-25T09:32:27.083" LastActivityDate="2012-10-16T00:06:08.387" Title="Stereo sound separation into three sources" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3437" PostTypeId="2" ParentId="3436" CreationDate="2012-09-25T09:30:35.557" Score="5" Body="&lt;p&gt;Partially correct. Human auditory spatial perception is rather complicated. A good book on the topic would be &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0262024136&quot; rel=&quot;nofollow&quot;&gt;Spatial Hearing&lt;/a&gt;.  How and where we localize things depends on a great many factors. For left/right localization the main effects are interaural time difference and interaural level difference. Time differences is the strongest queue. Whatever comes earlier on the left ear will be solidly localized on the left unless even if the sound is louder on the right (within reason). &#xA;If left &amp;amp; right signals are perfectly time aligned than your model is simplified model.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="2032" LastEditDate="2012-10-16T00:06:08.387" LastActivityDate="2012-10-16T00:06:08.387" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3439" PostTypeId="2" ParentId="3434" CreationDate="2012-09-25T11:18:53.123" Score="5" Body="&lt;p&gt;There is no one-line &quot;formula&quot;, if that is what you are looking for. Traditionally, BER is captured at link-level, meaning it considers the effect of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Modulation (BPSK, QPSK, etc.)&lt;/li&gt;&#xA;&lt;li&gt;Channel coding rate&lt;/li&gt;&#xA;&lt;li&gt;Multipath fading and channel conditions (eg. AWGN, Rayleigh fading, etc.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, once you talk about distance between TX-RX, we are talking about propagation effects, shadowing, which are part of system-level simulations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moereover, your question is ambiguous: you simply state 802.11a/b/g without mentioning whether you are talking of OFDM or DSSS, what channel bandwidth, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the scenario, there are lots of IEEE papers, ex: &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4633563&quot;&gt;BER simulation for WLAN networks in realistic environment&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="239" LastActivityDate="2012-09-25T11:18:53.123" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="3440" PostTypeId="2" ParentId="3396" CreationDate="2012-09-25T11:57:47.257" Score="0" Body="&lt;p&gt;Consider two random variables $x \sim N(0, \sigma^2)$  and $ y \sim N(0, \sigma^2)$. &#xA;Then $h = \sqrt{x^2 + y^2}$ is Raylegh-distributed with parameter $\sigma$, whose p.d.f is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f(h) = \frac{h}{\sigma^2} \exp(-h^2/2\sigma^2)&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;http://en.wikipedia.org/wiki/Rayleigh_distribution&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Omega = E[h] = \sigma \sqrt{\frac{\pi}{2}}  \implies  \Omega \propto \sigma&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the range of $\Omega$ depends on the variance of your input signals $x$ and $y$. If you think of $x$ and $y$ as &quot;signal + AWGN&quot;, then $\sigma$ is essentially the signal-to-noise ratio. So, whether $\Omega &amp;lt; 1$ or $\Omega &amp;gt; 1$ depends on whether you are modelling low SNR conditions or high SNR conditions, respectively.&lt;/p&gt;&#xA;" OwnerUserId="239" LastActivityDate="2012-09-25T11:57:47.257" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3441" PostTypeId="1" AcceptedAnswerId="3442" CreationDate="2012-09-25T12:04:42.153" Score="3" ViewCount="9993" Body="&lt;p&gt;I am trying to understand what happen when we take FFT2 of a matrix in a matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;first have a look at this simple example,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a=ones(8); %8x8 Matrix of Ones&#xA;fft2(a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it will generate the following output,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    64     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0     0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in above matrix , 64 is the sum of all the matrix values and it is the DC coefficient.&#xA;Does that mean the 64 is calculated as &lt;code&gt;8*8 = 64 ?&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the actual question,&#xA;i generated a matrix of 4,4,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   a = [zeros(4,2) ones(4,2)]&#xA;&#xA;% 0     0     1     1&#xA;% 0     0     1     1&#xA;% 0     0     1     1&#xA;% 0     0     1     1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First 4 rows and Two columns are zeros while the remaining are ones as shows above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if i take its FFT2,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    fft2(a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It generates the following output,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  8.0000            -4.0000 + 4.0000i         0            -4.0000 - 4.0000i&#xA;        0                  0                  0                  0          &#xA;        0                  0                  0                  0          &#xA;        0                  0                  0                  0          &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to the book, the values shown in the output are the DC coefficient and it is indeed the sum of all the matrix values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In previous example it was easy to calculate the DC coefficient but in this example how these values are generated ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  8.0000            -4.0000 + 4.0000i         0            -4.0000 - 4.0000i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If i calculate the &lt;code&gt;fft&lt;/code&gt; instead of &lt;code&gt;fft2&lt;/code&gt; it will give the following output&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%FFT -&amp;gt; DFT of Vector&#xA;%FFT2 -&amp;gt; DFT of Matrix&#xA; 0     0     4     4&#xA; 0     0     0     0&#xA; 0     0     0     0&#xA; 0     0     0     0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2012-09-25T12:12:33.637" LastActivityDate="2012-09-25T13:07:47.370" Title="understanding FFT2 function of Matlab" Tags="|fft|matlab|matrix|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3442" PostTypeId="2" ParentId="3441" CreationDate="2012-09-25T12:48:25.143" Score="6" Body="&lt;p&gt;The &lt;code&gt;fft()&lt;/code&gt; function calculates the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot;&gt;one-dimensional FFT&lt;/a&gt; of its input argument. If the input argument is a vector, then the operation is pretty simple to understand; the output is just the result of efficiently calculating a discrete Fourier transform on the input. If the input is a matrix, then, as many MATLAB functions do, each column is treated as a separate one-dimensional signal and are transformed separately. Therefore, the $n$-th column of the output matrix corresponds to the DFT of the $n$-th column of the input matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;fft2()&lt;/code&gt; function calculates the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform#Multidimensional_FFTs&quot;&gt;two-dimensional FFT&lt;/a&gt; of a matrix. One way of envisioning this operation is to take standard one-dimensional FFTs down each column of the input matrix $A$ to yield a temporary result $B$. Then, take one-dimensional FFTs across each row of $B$ to yield the result $C$. The matrix $C$ would then be the result of the two-dimensional FFT of A. 2-D transforms (although not typically the FFT) are often used in image and video compression algorithms.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-09-25T12:48:25.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3444" PostTypeId="1" AcceptedAnswerId="3446" CreationDate="2012-09-25T13:19:46.023" Score="9" ViewCount="23587" Body="&lt;p&gt;In image processing books , we are told that Images need to be padded while doing filtering in the frequency domain. Why we need that zero padding ?&lt;/p&gt;&#xA;" OwnerUserId="864" LastActivityDate="2016-02-22T12:32:51.320" Title="Why images need to be padded before filtering in frequency domain" Tags="|image-processing|filters|frequency-spectrum|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3446" PostTypeId="2" ParentId="3444" CreationDate="2012-09-25T14:15:02.770" Score="15" Body="&lt;p&gt;Multiplication in the frequency domain corresponds with &lt;a href=&quot;http://en.wikipedia.org/wiki/Circular_convolution&quot;&gt;circular convolution&lt;/a&gt; in the spatial domain.  This means that without padding the image properly, results from one side of the image will wrap around to the other side of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of 2D filtering as a sliding window that is centered over each pixel in the image and the center output pixel is a weighted sum of the pixels in the window.  With circular convolution, when the window hangs over the right edge of the image, it is actually wrapping back around to the left side of the image.  This means that output pixels on the right edge of the image will be affected by pixels on the left edge, which is almost never what is actually desired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero-padding allows space for this wrap-around to occur without contaminating actual output pixels. &lt;/p&gt;&#xA;" OwnerUserId="52" LastActivityDate="2012-09-25T14:15:02.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3447" PostTypeId="1" AcceptedAnswerId="3450" CreationDate="2012-09-25T15:09:22.083" Score="5" ViewCount="3687" Body="&lt;p&gt;I am having trouble identifying the frequency components of an image,&lt;/p&gt;&#xA;&lt;p&gt;Here I simply generated, 256x256 binary-image.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;a = [zeros(256,128) ones(256,128)];&#xA;imshow(a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jBLsv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Taking the image FFT and shifting the Zero-frequency to the center,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;f = fft2(a)&#xA;shft = fftshift(f);&#xA;imshow(log(shft)) %stretching&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;will result,&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0xlHp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do I identify how many frequency components are there and what are those frequencies?&lt;/p&gt;&#xA;&lt;p&gt;Also if I calculate FFT of any 1-D sequence and plot that sequence there are certain values on negative, what does that mean? How could there be negative frequencies?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="7092" LastEditDate="2021-01-18T17:22:35.240" LastActivityDate="2021-01-18T17:22:35.240" Title="Understanding FFT of an Image" Tags="|image-processing|fft|matlab|frequency|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3448" PostTypeId="2" ParentId="3405" CreationDate="2012-09-25T16:34:59.587" Score="4" Body="&lt;p&gt;This doesn't answer the whole question, but it addresses part of what the OP asks about. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can only be done experimentally. To do it analytically would require information about what the algorithm &lt;em&gt;should&lt;/em&gt; have returned. But to know that, you need a known always correct computer vision algorithm to compare against (as well as detailed analytical descriptions of the image being tested against). Analytical solutions require knowledge of a ground truth which is analytical rather than hand generated on a case by case basis. But we don't have an analytical way to generate a ground truth -- that is what we are trying to develop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that it can only be done experimentally, you may want to look at google scholar. If you are after people location there will be a lot of papers dedicated to locating a person, or parts of a person like a head or hands. Car location will also have a lot of speciallized attention. Other objects will just want generic algorithms.&lt;/p&gt;&#xA;" OwnerUserId="566" LastEditorUserId="566" LastEditDate="2012-10-03T20:08:17.847" LastActivityDate="2012-10-03T20:08:17.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3449" PostTypeId="2" ParentId="3447" CreationDate="2012-09-25T17:01:51.903" Score="1" Body="&lt;p&gt;My first suggestion is that you understand FFT in 1 dimension before trying to interpret results in 2D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Discrete Fourier Transform (FFT is an implementation of DFT) is a complex transform: it transforms between 2 vectors complex vectors of size N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the 1D case, you will get not only negative values, but complex values in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same applies in 2D. The imshow function is probably taking the real part of the complex matrix (it is not clear in the imshow documentation).&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-09-25T17:01:51.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3450" PostTypeId="2" ParentId="3447" CreationDate="2012-09-25T17:53:12.710" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;how there could be negative frequencies ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The FFT coefficients are not frequencies, but complex amplitudes. The modulus of the coefficient indicates the amplitude, the argument of the coefficient indicates the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you should be getting a warning or error message from Matlab for computing &lt;code&gt;log(shft)&lt;/code&gt;, since shft is a complex matrix, the result is not a real and cannot be plotted as an image.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-25T17:53:12.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3451" PostTypeId="1" AcceptedAnswerId="3455" CreationDate="2012-09-25T19:24:53.533" Score="3" ViewCount="515" Body="&lt;p&gt;My main reference for machine learning and pattern recognition is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0387310738&quot; rel=&quot;nofollow&quot;&gt;Pattern Recognition and Machine Learning by Bishop&lt;/a&gt;. But I want a complementary reference to this which has more exercises and explains the mathematical stuff in more details, e.g. formulas and proofs. &lt;/p&gt;&#xA;" OwnerUserId="89" LastActivityDate="2014-02-16T16:53:05.923" Title="Pattern recognition and Machine Learning reference" Tags="|reference-request|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3452" PostTypeId="2" ParentId="3433" CreationDate="2012-09-26T01:40:24.590" Score="6" Body="&lt;p&gt;Here's the problem.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With an opaque learning algorithm, you have to figure out if your algorithm has really learned something about some deeper structure common to the desired problem area (assuming there is some to be found), or had just learned to recognize some particular inputs and spit out the desired answer only for those inputs (similar to school kids who just &quot;memorize the test&quot; but haven't a clue otherwise).  The latter isn't very useful when the training data consists of only a tiny fraction of the desired problem space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to find out, you train your algorithm on one set of data until it spits out the correct answers.  Then you change up the input to some different test data that the trained algorithm has never seen before, and see if it can still give you useful answers, or only really worked for the only the stuff in the original training set.  That's the test data set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have real-world data, it's common to divide it up into two disjoints sets, and not let the algorithm see the test set during training.  Similar to the teacher locking up the quiz questions until the end of the semester.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-09-26T01:40:24.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3453" PostTypeId="1" CreationDate="2012-09-26T04:38:17.270" Score="0" ViewCount="756" Body="&lt;p&gt;I am somewhat new to signal processing, but i'm hoping I can provide enough information in order to be pointed in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on analyzing the frequency spectrum of audio signal impulse response.  A few of the impulses seem to have what looks like a large variable dc bias, and when performing a FFT they come back with very large DC values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;subtracting the mean did not help much in ways of correction.  I think there may be other issues besides what appears to be DC but I am stuck.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The graphs below are plots of the FFT results from two signals - one with the warped dc bias, and one without. Hopefully this demonstrates better what may be happening to cause this.  Any help is greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;both Signals are of the same sample length and FFT size&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1st Image - FFT of good Signal, small-no DC value&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Grew.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2nd Image - FFT of problem Signal Large DC value&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eX6Xj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2019" LastEditorUserId="6" LastEditDate="2012-09-26T13:35:36.970" LastActivityDate="2012-09-26T13:55:48.377" Title="Correcting large variable dc bias in signal FFT" Tags="|fft|audio|impulse-response|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3454" PostTypeId="2" ParentId="3453" CreationDate="2012-09-26T06:29:57.270" Score="2" Body="&lt;p&gt;Which analysis do you want to perform and why is the DC bias a problem? It is absolutely normal for an impulse response to have a DC offset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DC component of an impulse response indicates how the corresponding filter will respond to a DC signal. A high-pass filter has a null response at DC, and thus its impulse response will not have a DC component. But a low-pass filter, or a delay, or a reverb, etc. pass DC signals, and thus their impulse response will have a DC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most common way of plotting a FFT is by having frequency (optionally on a log scale) on the X axis and the magnitude or squared magnitude of the FFT (optionally on a log scale) on the Y axis. The kind of plot you use does not show the frequency information, it's hard to see if there is or not a DC offset (coefficient 0).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-26T06:29:57.270" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3455" PostTypeId="2" ParentId="3451" CreationDate="2012-09-26T08:39:00.087" Score="3" Body="&lt;p&gt;Another good book is:&#xA; - &lt;a href=&quot;http://books.google.nl/books/about/Pattern_recognition.html?id=gAGRCmp8Sp8C&amp;amp;redir_esc=y&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pattern Recognition by Theodoridis and Koutroumbas&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's about classifiers, features and clustering in the context of pattern recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It contains all the mathematical stuff you want, and backs everything up with references to papers, books, etc. It has no exercises, so for that you need to look somewhere else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see this &lt;a href=&quot;https://stackoverflow.com/questions/9390974/statistical-machine-learning-books/9409489#9409489&quot;&gt;StackOverflow question&lt;/a&gt; on the matter.&lt;/p&gt;&#xA;" OwnerUserId="809" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-09-26T08:39:00.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3456" PostTypeId="2" ParentId="3453" CreationDate="2012-09-26T13:55:48.377" Score="3" Body="&lt;p&gt;Based on the plots shown in the OP, it doesn't appear that the signal you've noted as &quot;bad&quot; just has a DC bias. If there was a DC bias, then it would be expressed graphically as a bulk shift by some amount in the complex plane. Compared to the &quot;good&quot; example, it appears that the &quot;bad&quot; one has some time-varying amplitude modulation, which, when viewed as applied to a phasor in the complex plane, could trace out the loopy patterns shown in the plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This supports your claim that you tried just subtracting the mean of the signal and saw little improvement; while there does appear to be a nonzero DC value in the &quot;bad&quot; example, the differences aren't isolated to just the mean value, as I said above. The apparent amplitude modulation will add spectral content over some swath of bandwidth of the signal, which could overlap with the region that you want to analyze.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-09-26T13:55:48.377" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3457" PostTypeId="1" AcceptedAnswerId="3458" CreationDate="2012-09-26T14:17:08.320" Score="3" ViewCount="145" Body="&lt;p&gt;In &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0387310738&quot; rel=&quot;nofollow&quot;&gt;Bishop book&lt;/a&gt;, page 4, section 1.1, there's a notation I don't seem to understand what's meant by it. The whole paragraph, with which the section begins, is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We begin by introducing a simple regression problem, which we shall use as a running&#xA;  example throughout this chapter to motivate a number of key concepts. Suppose&#xA;  we observe a real-valued input variable x and we wish to use this observation to&#xA;  predict the value of a real-valued target variable t. For the present purposes, it is instructive&#xA;  to consider an artificial example using synthetically generated data because&#xA;  we then know the precise process that generated the data for comparison against any&#xA;  learned model. The data for this example is generated from the function sin(2πx)&#xA;  with random noise included in the target values, as described in detail in Appendix A.&#xA;  Now suppose that we are given a training set comprising N observations of x,&#xA;  written $x \equiv (x_1, . . . , x_N)^T$, together with corresponding observations of the values&#xA;  of t, denoted $t \equiv (t_1, . . . , t_N)^T$. Figure 1.2 shows a plot of a training set comprising&#xA;  N = 10 data points. The input data set x in Figure 1.2 was generated by choosing&#xA;  values of xn, for n = 1, . . . , N, spaced uniformly in range [0, 1], and the target&#xA;  data set t was obtained by first computing the corresponding values of the function&#xA;  1.1. Example: Polynomial Curve Fitting 5&#xA;  sin(2πx) and then adding a small level of random noise having a Gaussian distribution&#xA;  (the Gaussian distribution is discussed in Section 1.2.4) to each such point in&#xA;  order to obtain the corresponding value tn. By generating data in this way, we are&#xA;  capturing a property of many real data sets, namely that they possess an underlying&#xA;  regularity, which we wish to learn, but that individual observations are corrupted by&#xA;  random noise. This noise might arise from intrinsically stochastic (i.e. random) processes&#xA;  such as radioactive decay but more typically is due to there being sources of&#xA;  variability that are themselves unobserved.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not clear what the notation  $x \equiv (x_1, . . . , x_N)^T$ might mean here, especially the so called variable T. &#xA;I guess it means it's the set of input vectors together with its corresponding set of target vectors (t). If I am right, so is this an example of  supervised learning? Still, what's T?&lt;/p&gt;&#xA;" OwnerUserId="89" LastEditorUserId="26573" LastEditDate="2018-09-06T08:08:02.863" LastActivityDate="2018-09-06T08:08:02.863" Title="Clarifying some notation in Bishop book" Tags="|terminology|books|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3458" PostTypeId="2" ParentId="3457" CreationDate="2012-09-26T14:28:05.850" Score="8" Body="&lt;p&gt;$x$ is a vector, composed of the individual elements $x_1$, $x_2$, etc.  The &quot;T&quot; is for &lt;a href=&quot;http://en.wikipedia.org/wiki/Transpose&quot;&gt;transpose&lt;/a&gt;.  It is not a variable.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-09-26T14:28:05.850" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3459" PostTypeId="2" ParentId="3403" CreationDate="2012-09-26T20:40:26.883" Score="1" Body="&lt;p&gt;Two things come to mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, let's address the low-amplitude noise problem. This one is a typical textbook case for a &lt;a href=&quot;http://en.wikipedia.org/wiki/Noise_gate&quot; rel=&quot;nofollow&quot;&gt;noise gate&lt;/a&gt;. To give you an extreme example, these are sometimes even used on guitar distortion effects which are essentially insane amounts of controlled overdrive. I have to admit that I failed to find any literature on creating digital noise gates, but they exist abundantly as plugins so maybe digging through some open-source projects will score you a good basis for learning how to implement them. In essence, you measure windowed energy of a signal, and if it falls below a certain threshold, you fade your gain to zero (usually decaying exponentials are used). In any case, I'm sure you know what a noise gate is and I'm beating around the bush here. Make one and use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, when you say &lt;em&gt;roughly set the input gain for me automatically if it's way off&lt;/em&gt;, that sounds like a textbook case for using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Fuzzy_control_system&quot; rel=&quot;nofollow&quot;&gt;fuzzy controller&lt;/a&gt;. I'm linking to the Wikipedia page because I'm feeling a bit lazy, but you can find tons of great papers out there just on the first ten pages of Google results. The concept is exactly as you described it. You'll have several (say five for the sake of a simple example) levels of how close the gain is to what you think it should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;- Way too low&#xA;- Low&#xA;- About right&#xA;- High&#xA;- Way too high&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Based on these you will have some sort of fuzzy response like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;- Increase at a high rate&#xA;- Increase at a low rate&#xA;- Do nothing&#xA;- Decrease at a low rate&#xA;- Decrease at a high rate&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These are my thoughts on how I would do it. You still need some means of measuring your fuzzy control input (assessing how good current gain level is), but that's something for you to work out. I'd say that if you're riding very close to clipping, that's &lt;code&gt;High&lt;/code&gt;, if you've clipped, that's &lt;code&gt;Way too high&lt;/code&gt;, and so on. Depending on what the spec considers acceptable, fuzzy control can sometimes let you get away with very simple solutions.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-09-26T20:40:26.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3460" PostTypeId="1" AcceptedAnswerId="3461" CreationDate="2012-09-26T21:15:18.107" Score="0" ViewCount="180" Body="&lt;p&gt;I am calculating Time period of Sine/Cos Wave with different frequencies while keeping the Sampling Frequency at 1MHz and plotting it, but in some cases the value of time period is too big,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;have a look at some of the examples.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=[0:0.1:10] %because Time period is 10&#xA;&#xA;F1=100*10^3; %100KHz  and t=1*10^-5&#xA;Fs=1*10^6;  %1MHz =&amp;gt; Sampling Frequency&#xA;T=1/Fs;    %1*10^-6&#xA;&#xA;%Time period = t/T =&amp;gt; 10&#xA;&#xA;xn=cos(2*pi*(F1)*n*T)   %T=1/Fs&#xA;stem(n,xn);&#xA;&#xA;ylim([-1.5 1.5]);&#xA;xlim ([0 10]); %because Time period is 10&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here Time period = 10 which means one oscillation would take 10seconds to complete.&#xA;and here is the output as i expected,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6TXKi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly in second case when i changed the frequency to 10Hz while the Sampling frequency remains 1MHz the value of Time period is way too big,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=[0:1000:100*10^3] %because Time period is 100*10^3&#xA;&#xA;F1=10; %10Hz  and t=0.1&#xA;Fs=1*10^6  %1MHz&#xA;T=1/Fs;    %1*10^-6&#xA;&#xA;%Time period = t/T =&amp;gt; 100*10^3&#xA;&#xA;xn=sin(2*pi*(F1)*n*T)&#xA;&#xA;stem(n,xn)&#xA;&#xA;ylim([-1.5 1.5])&#xA;xlim ([0 100*10^3])  %because Time period is 100*10^3&#xA;ylim ([-1 1])&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the output wave is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QI4sm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is it the correct value or am i doing some sort mistakes calculating the time period ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2012-09-26T21:54:10.757" Title="Time Period of one Cycle is way too large" Tags="|frequency|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3461" PostTypeId="2" ParentId="3460" CreationDate="2012-09-26T21:54:10.757" Score="3" Body="&lt;p&gt;The equation &lt;code&gt;xn=cos(2*pi*(F1)*n*T)&lt;/code&gt; expects &lt;code&gt;n&lt;/code&gt; to be a sample index vector (&lt;code&gt;n=0:N&lt;/code&gt;) where &lt;code&gt;N&lt;/code&gt; is the total number of samples.  &lt;code&gt;n*T&lt;/code&gt; or &lt;code&gt;n/Fs&lt;/code&gt; produces the time vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a way to plot a single cycle:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F1 = 100e3;&#xA;Fs = 1e6;&#xA;t = 0:(1/Fs):1/F1;  %Creates time vector for a single cycle&#xA;x = cos(2*pi*F1*t);&#xA;stem(t, x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;1/F1&lt;/code&gt; gives the time period of a single cycle.&lt;/p&gt;&#xA;" OwnerUserId="52" LastActivityDate="2012-09-26T21:54:10.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3462" PostTypeId="2" ParentId="3447" CreationDate="2012-09-26T23:11:45.020" Score="1" Body="&lt;p&gt;You are missing the &lt;code&gt;abs&lt;/code&gt; command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = fft2(a)&#xA;shft = fftshift(abs(f));&#xA;imshow(log(shft)) %stretching&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="698" LastActivityDate="2012-09-26T23:11:45.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3463" PostTypeId="1" CreationDate="2012-09-27T10:29:32.883" Score="3" ViewCount="8846" Body="&lt;p&gt;to get the envelope of a time domain signal, s(t), I use the absolute of its analytical time domain signal. But there occur the problem that sometimes the envelope is not as desired a true envelope but it follows more or less the original time domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just for illustration some python code where the plot looks good:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pylab import *&#xA;import numpy&#xA;import scipy.signal.signaltools as sigtool&#xA;&#xA;x = linspace(0,5,1e4)&#xA;&#xA;s= numpy.sin(2*numpy.pi*x)*numpy.exp(-x**2/2)&#xA;env = numpy.abs(sigtool.hilbert(s)) # hilbert(s) actually returns the analytical signal&#xA;&#xA;plot(x,s,label='Time Signal')&#xA;plot(x,env,label='Envelope')&#xA;legend()&#xA;show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By changing the data for example to (taking abs):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = numpy.abs(numpy.sin(2*numpy.pi*x)*numpy.exp(-x**2/2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the resulting envelope is following the &quot;ripples&quot; instead of being an envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- WHY? ---&lt;/p&gt;&#xA;" OwnerUserId="2025" LastEditorUserId="90" LastEditDate="2012-09-27T13:17:24.540" LastActivityDate="2016-05-17T13:17:47.517" Title="Envelope of time domain signal // Hilbert transform" Tags="|analytic-signal|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3464" PostTypeId="2" ParentId="3463" CreationDate="2012-09-27T13:53:55.737" Score="11" Body="&lt;p&gt;Hilbert envelope, also called Energy-Time Curve (ETC), only works well for narrow-band fluctuations. Producing an analytic signal, of which you later take the absolute value, is a linear operation, so it treats all frequencies of your signal equally. If you give it a pure sine wave, it will indeed return to you a straight line. When you give it white noise however, you will likely get noise back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\lvert\cos(\omega t)\rvert^2 + \lvert i\sin(\omega t)\rvert^2  = \cos^2(\omega t) + \sin^2(\omega t)= 1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, you have $\cos(\omega t)$ as you input signal, and its analysis counterpart is $\cos(\omega t) + i\sin(\omega t)$. In it easy to see from expression above that its envelope is always a constant. Let's look at another example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x(t) = \cos(\omega_1 t) + \cos(\omega_2 t)$. Then its analytic counterpart is&#xA;$$&#xA;a(t) = \cos(\omega_1 t) + \cos(\omega_2 t) + i\sin(\omega_1 t) + i\sin(\omega_2 t).&#xA;$$&#xA;Let's take the absolute value of this signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;\lvert a(t)\rvert^2 &amp;amp;= \lvert\cos(\omega_1 t) + \cos(\omega_2 t)\rvert^2 + \lvert i\sin(\omega_1 t) + i\sin(\omega_2 t)\rvert^2\\&amp;amp;=\left(\cos(\omega_1 t) + \cos(\omega_2 t)\right)^2 + \left( \sin(\omega_1 t) + \sin(\omega_2 t) \right)^2 \\ &amp;amp;= \cos^2(\omega_1t) + \cos(\omega_1t)\cos(\omega_2t) + \cos^2(\omega_2t)\\&amp;amp; \quad + \sin^2(\omega_1t) + \sin(\omega_1t)\sin(\omega_2t) + \sin^2(\omega_2t) \\&amp;amp;= \cos^2(\omega_1t) + \frac{1}{2}\left[ \cos(\omega_1t-\omega_2t)+\cos(\omega_1t+\omega_2t)\right] + \cos^2(\omega_2t)\\&amp;amp;\quad + \sin^2(\omega_1t) + \frac{1}{2}\left[ \sin(\omega_1t-\omega_2t)-\sin(\omega_1t+\omega_2t)\right] + \sin^2(\omega_2t) \\ &amp;amp;= \left[ \cos^2(\omega_1t) + \sin^2(\omega_1t)\right] + \left[ \cos^2(\omega_2t) + \sin^2(\omega_2t)\right] \\ &amp;amp;\quad + \frac{1}{2}\left[\cos(\omega_1t-\omega_2t) + \cos(\omega_1t-\omega_2t) \right] + \frac{1}{2}\left[\sin(\omega_1t+\omega_2t) - \sin(\omega_1t+\omega_2t) \right] \\ &amp;amp;= 1 + 1 + \cos(\omega_1t - \omega_2t) + 0 \\ &amp;amp;= 2+\cos\left( \left[\omega_1-\omega_2\right]t\right)\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, this is &lt;em&gt;not&lt;/em&gt; a constant as one would expect. Note that if $\omega_1$ and $\omega_2$ are close to each other, only low-frequency oscillations are produced as an artifact. hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="1629" LastEditDate="2016-05-17T13:17:47.517" LastActivityDate="2016-05-17T13:17:47.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3465" PostTypeId="1" AcceptedAnswerId="3475" CreationDate="2012-09-27T16:36:20.050" Score="9" ViewCount="854" Body="&lt;p&gt;The highest voted answer to &lt;a href=&quot;https://dsp.stackexchange.com/questions/3066/bag-of-tricks-for-denoising-signals-while-maintaining-sharp-transitions&quot;&gt;this question&lt;/a&gt; suggests that to denoise a signal while preserving sharp transitions one should &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;minimize the objective function:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$ |x-y|^2 + b|f(y)| $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where $x$ is the noisy signal, $y$ is the denoised signal, $b$ is the&#xA;  regularziation parameter, and $|f(y)|$ is some L1 norm penalty.&#xA;  Denoising is accomplished by finding the solution $y$ to this&#xA;  optimization problem, and $b$ depends on the noise level.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, there is no indication of how one might accomplish that in practice as that is a problem in a &lt;em&gt;very&lt;/em&gt; high dimensional space, especially if the signal is e.g. 10 million samples long. In practice how is this sort of problem solved computationally for large signals? &lt;/p&gt;&#xA;" OwnerUserId="566" LastEditorUserId="128" LastEditDate="2018-07-07T21:53:58.893" LastActivityDate="2019-10-18T13:44:40.703" Title="Solving Convex Optimization Problem Used for High Quality Denoising" Tags="|noise|denoising|smoothing|convex-optimization|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3466" PostTypeId="1" AcceptedAnswerId="3470" CreationDate="2012-09-27T16:52:13.747" Score="8" ViewCount="31514" Body="&lt;p&gt;How does the Amplitude of the Signal is changed when taking the FFT of a Signal,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude had changed from 2 to 30, &#xA;&lt;img src=&quot;https://i.stack.imgur.com/MWFdo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and Here is my code for generating the above output,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f=1e3;   %Frequency of Wave&#xA;A=2;    %Amplitude&#xA;Fs = 1e6;  %Sampling Frequency&#xA;&#xA;Ts = 1/Fs;   %Sampling Rate&#xA;&#xA;t = 10/f;       %Time period of 1 Oscillation = 1/f &#xA;&#xA;n = 0:Ts:t;  %Generating Samples&#xA;&#xA;&#xA;x=A*sin(2*pi*f*n);&#xA;subplot(2,1 ,1)&#xA;plot(x&#xA;&#xA;&#xA;% 100,000 = Fs &#xA;% 10,000 = Length of the Signal&#xA;% 100,000/10,000 = 100Hz &amp;lt;- First point in FFT = 100Hz &#xA;% 2nd Point = 200Hz&#xA;% 3rd Point = 300Hz&#xA;% 4th Point = 400Hz&#xA;% .&#xA;% .&#xA;% 10th Point = 1KHz &amp;lt;- Original Signal Frequency&#xA;&#xA;subplot(2,1 ,2)&#xA;F=fft(x); &#xA;plot(real((F))),grid on  &#xA;xlim ([0 20])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2012-09-27T17:43:18.763" Title="Amplitude of the Signal in Frequency Domain different from Time Domain" Tags="|fft|frequency|time-frequency|frequency-domain|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3467" PostTypeId="5" CreationDate="2012-09-27T17:10:15.673" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2012-09-27T17:10:15.673" LastActivityDate="2012-09-27T17:10:15.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3468" PostTypeId="4" CreationDate="2012-09-27T17:10:15.673" Score="0" Body="image-segmentation refers to the process of partitioning a digital image into multiple segments, typically to locate objects and boundaries." OwnerUserId="1957" LastEditorUserId="1957" LastEditDate="2012-09-27T17:44:04.160" LastActivityDate="2012-09-27T17:44:04.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3469" PostTypeId="2" ParentId="3466" CreationDate="2012-09-27T17:18:34.363" Score="4" Body="&lt;p&gt;Here is how you should do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two spikes in the FFT will have an amplitude of 1 each (sum those and you get the time domain amplitude of 2)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc&#xA;close all&#xA;clear all&#xA;&#xA;f = 1000;&#xA;A = 2;&#xA;Fs = 16000;&#xA;t = 0:1/Fs:100/f;&#xA;x=A*sin(2*pi*f*t);&#xA;subplot(2,1 ,1)&#xA;plot(x)&#xA;&#xA;&#xA;% 100,000 = Fs &#xA;% 10,000 = Length of the Signal&#xA;% 100,000/10,000 = 100Hz &amp;lt;- First point in FFT = 100Hz &#xA;% 2nd Point = 200Hz&#xA;% 3rd Point = 300Hz&#xA;% 4th Point = 400Hz&#xA;% .&#xA;% .&#xA;% 10th Point = 1KHz &amp;lt;- Original Signal Frequency&#xA;&#xA;subplot(2,1 ,2)&#xA;plot(abs(fft(x))./length(x))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2029" LastEditorUserId="1324" LastEditDate="2012-09-27T17:43:18.763" LastActivityDate="2012-09-27T17:43:18.763" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3470" PostTypeId="2" ParentId="3466" CreationDate="2012-09-27T17:24:58.927" Score="11" Body="&lt;p&gt;You're overlooking four things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The $\frac{1}{FFT\_size}$ normalization coefficient. Some FFT implementations have or do not have this factor. Check the definition of FFT as performed by matlab on the Mathworks site!&lt;/li&gt;&#xA;&lt;li&gt;Why are you looking at the real part only? The amplitude is conveyed by the modulus (magnitude) of the complex number. Here, the real part is 31 but the imaginary part is -10000.&lt;/li&gt;&#xA;&lt;li&gt;A sine wave of amplitude 2 yields two complex exponentials of magnitude 1.&lt;/li&gt;&#xA;&lt;li&gt;Keep in mind that you are not computing the Fourier transform of a sine wave (which goes from minus infinity to infinity), but of a sine waved multiplied by a rectangular window. As a result, you won't find the spectrum of a sine wave, but the spectrum of a sine wave convolved by the spectrum of your aperture (a sinc function for the rectangular window). The energy will bleed over adjacent frequency bins instead of being confined in bin 11. You will need to sum the energy over the adjacent bins to recover all the energy!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Getting back to your example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;abs(F(11)) is 10000. Divide by the sample length and you get a bit less than one (which is the expected value). Sum the small residues across the adjacent bins and you'll get back your expected energy.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-09-27T17:24:58.927" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3471" PostTypeId="1" CreationDate="2012-09-27T18:38:43.537" Score="4" ViewCount="2449" Body="&lt;p&gt;I have sets of data of different deep sky objects. My job is to check for any periodicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use IDL to run an FFT and wavelet methods to check for a signal. To test my code I ran the IDL built in FFT operation on a sine wave, my code works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then add noise to the sine wave and increase the noise until I cant distinguish the frequency peak in the FFT output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what mathematical method can I use to say 'yes there is a signal and this is its frequency' or 'no there is no signal' ? Can or should I get a percent of certainty ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This post is very close to what I'm asking, but I only have one data set for an object so how could I make a ROC curve?: &lt;a href=&quot;https://dsp.stackexchange.com/questions/2104/what-statistic-is-used-to-determine-presence-of-a-signal-in-noise&quot;&gt;What statistic is used to determine presence of a signal in noise?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I think I dont want a ROC curve.&#xA;I will respond to any question you may have about my question. Thank you very much for your help. I am currently do research at UC Santa Cruz as an undergraduate.&lt;/p&gt;&#xA;" OwnerUserId="2031" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-11-27T14:04:29.107" Title="FFT, How to decide if there is a signal among noise?" Tags="|fft|fourier-transform|noise|statistics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3473" PostTypeId="2" ParentId="3290" CreationDate="2012-09-27T19:17:33.877" Score="2" Body="&lt;p&gt;I'm not sure of the reliability of your source... I worked with wavelets on my master's thesis and the basic wavelet transform is a convolution of the wavelet an your signal.&#xA;In most practical cases, it's best to go through Fast Fourier Transform (FFT), as it's mathematically equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With WT being the wavelet transform, and FFT() being the Fast Fourier Transform of what's inside the brackets, iFFT() is the inverse-FFT. You would compute the WT as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFT(WT) = FFT(signal) * FFT(wavelet)&#xA;WT = iFFT(WT)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, for the wavelet formula itself, I believe there has to be a specific scaling factor to get a reliable result. Here's what we used:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Psi = exp\Big(-\frac{ik_0x}{\lambda} - \frac{x^2}{2\lambda^2}\Big)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\lambda$ is the wavelength (or scale) and $k_0 = 5.336$ (source: J.F. Kirby, Computers &amp;amp; Geosciences 31 (2005) 846–864)&#xA;I did not include the normalization factor because you just have to divide your wavelet by it's highest value, and subtract its average, and you get the same result with less headhache.&#xA;Off course, you can interchange $1/\lambda$ by $2\pi*frequency$ in the formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to qualify for the &quot;Morlet&quot; name, I think you have to use the same wavelength in both places in the formula. Else, you over-sample or under-sample the frequency part of your signal. $k_0$ is the best ratio between the two, as explained by Kirby in his article.&lt;/p&gt;&#xA;" OwnerUserId="2030" LastEditorUserId="2030" LastEditDate="2012-10-01T21:17:45.170" LastActivityDate="2012-10-01T21:17:45.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3474" PostTypeId="1" AcceptedAnswerId="24647" CreationDate="2012-09-27T19:38:19.503" Score="9" ViewCount="12500" Body="&lt;p&gt;A client was trying to send me 250 GB worth of files. After attempting various ways of sharing the data, he sent me a zipped folder only 4 GB in size. That sounds like too much compression to me--I don't think when I've zipped things I've ever reduced more than 20% of the size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are some typical lossless compression ratios that one would see in practice? (Or alternatively, a range.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; I realise it's impossible to say without being able to guess at the actual information content, so perhaps this was an ill-worded question. I can't share the client's data. But looking at the &lt;code&gt;XML&lt;/code&gt; files, there are a lot of repeated phrases e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;thing&amp;gt;&#xA;    &amp;lt;property=&quot;1&quot; value=&quot;2&quot; /&amp;gt;&#xA;    &amp;lt;property=&quot;3&quot; value=&quot;4&quot; /&amp;gt;&#xA;    &amp;lt;property=&quot;5&quot; value=&quot;6&quot; /&amp;gt;&#xA;    &amp;lt;property=&quot;7&quot; value=&quot;8&quot; /&amp;gt;&#xA;    &amp;lt;property=&quot;9&quot; value=&quot;10&quot; /&amp;gt;&#xA;    &amp;lt;property=&quot;11&quot; value=&quot;12&quot; /&amp;gt;&#xA;    &amp;lt;property=&quot;13&quot; value=&quot;14&quot; /&amp;gt;&#xA;&amp;lt;/thing&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which does seem quite compressible.&lt;/p&gt;&#xA;" OwnerUserId="2010" LastEditorUserId="2010" LastEditDate="2012-10-01T01:39:05.120" LastActivityDate="2015-08-18T18:26:52.483" Title="What are some typical lossless compression ratios?" Tags="|compression|information-theory|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3475" PostTypeId="2" ParentId="3465" CreationDate="2012-09-27T19:46:20.647" Score="7" Body="&lt;p&gt;Boyd has &lt;a href=&quot;http://www.stanford.edu/~boyd/l1_ls/l1_ls_usrguide.pdf&quot; rel=&quot;nofollow&quot;&gt;A Matlab Solver for Large-Scale ℓ1-Regularized Least Squares Problems&lt;/a&gt;. The problem formulation in there is slightly different, but the method can be applied for the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://eeweb.poly.edu/iselesni/teaching/lecture_notes/sparse_signal_restoration.pdf&quot; rel=&quot;nofollow&quot;&gt;Classical majorization-minimization approach&lt;/a&gt; also works well. This corresponds to iteratively perform soft-thresholding (&lt;a href=&quot;http://eeweb.poly.edu/iselesni/teaching/lecture_notes/TV_filtering.pdf&quot; rel=&quot;nofollow&quot;&gt;for TV, clipping&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solutions can be seen from the links. However, there are many methods to minimize these functionals by the extensive use of optimisation literature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: As mentioned in other comments, FISTA will work well. Another 'very fast' algorithm family is primal-dual algorithms. You can see the &lt;a href=&quot;http://www.cmap.polytechnique.fr/preprint/repository/685.pdf&quot; rel=&quot;nofollow&quot;&gt;interesting paper of Chambolle&lt;/a&gt; for an example, however there are plethora of research papers on primal-dual methods for linear inverse problem formulations.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2012-10-02T20:04:40.327" LastActivityDate="2012-10-02T20:04:40.327" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3476" PostTypeId="2" ParentId="3474" CreationDate="2012-09-27T19:51:05.880" Score="10" Body="&lt;p&gt;It really depends on how much redundancy there is in the data. If all 250GB was just '0', then you could get fabulous levels of compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.maximumcompression.com/data/text.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;This page&lt;/a&gt; shows some results for compression of English text. It compresses 2,988,578 bytes worth of text using various techniques. The top three are: 330,571 (88.94%), 333,759 (88.83%), and 352,722 (88.20%).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relating this back to your case: that means 250GB would compress (at best) to 27.65GB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So perhaps there are lots of blank, repetitive patches in the data?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your edit, here is another &lt;a href=&quot;http://static.usenix.org/events/expcs07/papers/7-augeri.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper that looks at XML compression rates&lt;/a&gt;.&#xA;The upshot (Figure 8; screenshot below) is that they appear to see compression rates ranging from 1 (none) to about 50 at a maximum.  That suggests that you are correct to be suspicious of your customer's 62.5 to 1 (250 to 4) compression rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qyW9R.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2012-10-01T16:08:29.003" LastActivityDate="2012-10-01T16:08:29.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3477" PostTypeId="2" ParentId="3471" CreationDate="2012-09-27T19:58:29.037" Score="3" Body="&lt;p&gt;As a fellow astrophysicist, I suggest you use the standard 3 sigma above noise for detection, and 5 sigma above noise if you want to do analysis on what you find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your noise does not have a flat background, you need to subtract a &quot;Flat&quot;, an estimation of that the background might be. If you know what the noise should look like, such as exponential, gaussian, etc., try subtracting such a curve. If not, try a first order polynomial. If not good enough, then go with a second order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond that, it becomes interpretation... What if that tendency you notice in the noise is actually a signal, spread over many frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try computing the FFT of a pure white noise image, to get an idea of what your noise is supposed to look like. (Off course, remember that FFTs assumes your signal is periodic beyond its edges. Don't forget to zero-pad your data, and use a correct apodization, or limit your analysis to something smaller than half the size of your image.)&lt;/p&gt;&#xA;" OwnerUserId="2030" LastActivityDate="2012-09-27T19:58:29.037" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3478" PostTypeId="2" ParentId="3390" CreationDate="2012-09-27T20:00:05.850" Score="3" Body="&lt;p&gt;I've done this sort of thing by computing a T-statistic of the mean of the left part of the data vs. the right part of the data.  This assumes you know where the transition point is which of course you don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what you do is try several hundred partition points along the time axis and find the one with the most significant T-statistic.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u_left, u_right : mean of left and right portion&#xA;s_left, s_right : SD of left and right portion&#xA;n_left, n_right : number of samples on left and right (subtract one from each for the one degree of freedom)&#xA;&#xA;se = sqrt(s_left^2 / n_left^2 + s_right^2 / n_right^2)&#xA;T = (u_left - u_right) / se&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can do this as something like a binary search.  Try 10 data points, find the largest two, then try 10 points between those etc.  This way you could get a pretty precise transition point.  I'm not claiming accuracy. :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know how it goes!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. You can compute mean and sd as running sums which reduces the complexity of computing this partition function for every single possibilty this from N^2 to N.  Doing this you can probably afford to just compute the T statistic at every possible partition point.  &lt;/p&gt;&#xA;" OwnerUserId="2032" LastActivityDate="2012-09-27T20:00:05.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3479" PostTypeId="2" ParentId="3390" CreationDate="2012-09-27T20:07:42.390" Score="13" Body="&lt;p&gt;The classic reference for this problem is &lt;a href=&quot;http://people.irisa.fr/Michele.Basseville/kniga/&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Detection of Abrupt Changes - Theory and Application&lt;/em&gt; by Basseville and Nikiforov.&lt;/a&gt;  The whole book is available as a &lt;a href=&quot;http://people.irisa.fr/Michele.Basseville/kniga/kniga.pdf&quot; rel=&quot;noreferrer&quot;&gt;PDF download&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My recommendation is that you read Chapter 2.2 on the &lt;a href=&quot;http://en.wikipedia.org/wiki/CUSUM&quot; rel=&quot;noreferrer&quot;&gt;CUSUM (cumulative sum) algorithm.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2017-01-30T17:52:08.037" LastActivityDate="2017-01-30T17:52:08.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3480" PostTypeId="2" ParentId="1628" CreationDate="2012-09-27T20:36:40.190" Score="2" Body="&lt;p&gt;Unfortunately it's for 2D signals (image analysis), but I believe his conclusion would also apply to 1D signal.&#xA;J.F. Kirby, &quot;Which wavelet best reproduces the Fourier power spectrum?&quot;, Computers &amp;amp; Geosciences 31 (2005) 846–864&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, his conclusion is to go with the Fan wavelet, which is a 2D rotated version of the Morlet wavelet. In 1D, I'd suggest the complex Morlet. It's the mix of real and complex part that allows for a good similarity to a Fourier power spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In better precision, here what it should look like, converted to 1D from Kirby (2005):&#xA;$$ \Psi = exp\Big(-\frac{ik_0x}{\lambda} - \frac{x^2}{2\lambda^2}\Big),$$&#xA;where $\lambda$ is the scale you're looking at, and $k_0=5.336$ is a constant selected to give the best &quot;scale sampling&quot; vs &quot;frequency sampling&quot;. I didn't include the normalization constant because in every computational situation, it's better to just divide the final wavelet by its maximum value, and subtract its average. It gives pretty much the same result with less headache.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the complex Morlet wavelet is a Fourier transform &quot;wave&quot; ($exp(-i k_0 x/\lambda)$) bounded by a Gaussian kernel ($exp(-x^2/2)$). I suspect you might get a good power spectrum using only the real part (using $cos(x) \cdot exp(-x^2/2)$), but you would loose phase information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try comparing the spectrum obtained from a Fourier transform, from a complex Morlet and from a real Morlet. Watch out for bad/non-standard normalization found in many FFT algorithms.&lt;/p&gt;&#xA;" OwnerUserId="2030" LastEditorUserId="2030" LastEditDate="2012-10-01T21:19:24.653" LastActivityDate="2012-10-01T21:19:24.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3481" PostTypeId="1" AcceptedAnswerId="6041" CreationDate="2012-07-27T14:32:12.727" Score="9" ViewCount="11132" Body="&lt;p&gt;I implemented a 4-point radix-4 FFT and found that I need to do some manipulation of the output terms to get it to match a dft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is a pretty direct implementation of the matrix-formulation so I'm not clear on what the problem is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//                                | &#xA;// radix-4 butterfly matrix form  |  complex multiplication&#xA;//                                | &#xA;//        +-          -+ +-  -+   |    a+ib&#xA;// X[0] = | 1  1  1  1 | |x[0]|   |  * c+id&#xA;// X[1] = | 1 -i -1  i | |x[1]|   |    -------&#xA;// X[2] = | 1 -1  1 -1 | |x[2]|   |    ac + ibc&#xA;// X[3] = | 1  i -1 -i | |x[3]|   |         iad - bd&#xA;//        +-          -+ +-  -+   |    ------------------&#xA;//                                |    (ac-bd) + i(bc+ad)  &#xA;//                                | &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anybody spot where I went wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-David&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;typedef double fp; // base floating-point type&#xA;&#xA;&#xA;// naiive N-point DFT implementation as reference to check fft implementation against&#xA;//&#xA;void dft(int inv, struct cfp *x, struct cfp *y, int N) {&#xA;&#xA;  long int i, j;&#xA;  struct cfp w;&#xA;  fp ang;&#xA;&#xA;  for(i=0; i&amp;lt;N; i++) { // do N-point FFT/IFFT&#xA;    y[i].r = y[i].i = 0;&#xA;    if (inv) ang =  2*PI*(fp)i/(fp)N;&#xA;    else     ang = -2*PI*(fp)i/(fp)N;&#xA;    for (j=0; j&amp;lt;N; j++) {&#xA;      w.r = cos(j*ang);&#xA;      w.i = sin(j*ang);&#xA;      y[i].r += (x[j].r * w.r - x[j].i * w.i);&#xA;      y[i].i += (x[j].r * w.i + x[j].i * w.r);&#xA;    }&#xA;  }&#xA;&#xA;  // scale output in the case of an IFFT&#xA;  if (inv) {  &#xA;    for (i=0; i&amp;lt;N; i++) {&#xA;      y[i].r = y[i].r/(fp)N;&#xA;      y[i].i = y[i].i/(fp)N;&#xA;    }&#xA;  }&#xA;&#xA;} // dft()&#xA;&#xA;&#xA;void r4fft4(int inv, int reorder, struct cfp *x, struct cfp *y) {&#xA;  struct cfp x1[4], w[4];&#xA;  fp         ang, temp;&#xA;  int        i;&#xA;&#xA;  //                                | &#xA;  // radix-4 butterfly matrix form  |  complex multiplication&#xA;  //                                | &#xA;  //        +-          -+ +-  -+   |    a+ib&#xA;  // y[0] = | 1  1  1  1 | |x[0]|   |  * c+id&#xA;  // y[1] = | 1 -i -1  i | |x[1]|   |    -------&#xA;  // y[2] = | 1 -1  1 -1 | |x[2]|   |    ac + ibc&#xA;  // y[3] = | 1  i -1 -i | |x[3]|   |         iad - bd&#xA;  //        +-          -+ +-  -+   |    ------------------&#xA;  //                                |    (ac-bd) + i(bc+ad)  &#xA;  //                                | &#xA;&#xA;  if (inv) ang =  2*PI/(fp)4; // invert sign for IFFT&#xA;  else     ang = -2*PI/(fp)4;&#xA;  //&#xA;  w[1].r = cos(ang*1); w[1].i = sin(ang*1); // twiddle1 = exp(-2*pi/4 * 1);&#xA;  w[2].r = cos(ang*2); w[2].i = sin(ang*2); // twiddle2 = exp(-2*pi/4 * 2);&#xA;  w[3].r = cos(ang*3); w[3].i = sin(ang*3); // twiddle3 = exp(-2*pi/4 * 3);&#xA;&#xA;  //         *1       *1       *1       *1&#xA;  y[0].r  = x[0].r + x[1].r + x[2].r + x[3].r;&#xA;  y[0].i  = x[0].i + x[1].i + x[2].i + x[3].i;&#xA;  //         *1       *-i      *-1      *i&#xA;  x1[1].r = x[0].r + x[1].i - x[2].r - x[3].i;               &#xA;  x1[1].i = x[0].i - x[1].r - x[2].i + x[3].r;               &#xA;  //         *1       *-1      *1       *-1&#xA;  x1[2].r = x[0].r - x[1].r + x[2].r - x[3].r;&#xA;  x1[2].i = x[0].i - x[1].i + x[2].i - x[3].i;&#xA;  //         *1       *i       *-1      *-i&#xA;  x1[3].r = x[0].r - x[1].i - x[2].r + x[3].i;&#xA;  x1[3].i = x[0].i + x[1].r - x[2].i - x[3].r;&#xA;  //&#xA;  y[1].r = x1[1].r*w[1].r - x1[1].i*w[1].i; // scale radix-4 output&#xA;  y[1].i = x1[1].i*w[1].r + x1[1].r*w[1].i;&#xA;  //&#xA;  y[2].r = x1[2].r*w[2].r - x1[2].i*w[2].i; // scale radix-4 output&#xA;  y[2].i = x1[2].i*w[2].r + x1[2].r*w[2].i;&#xA;  //&#xA;  y[3].r = x1[3].r*w[3].r - x1[3].i*w[3].i; // scale radix-4 output&#xA;  y[3].i = x1[3].i*w[3].r + x1[3].r*w[3].i;&#xA;&#xA;  // reorder output stage ... mystery as to why I need this&#xA;  if (reorder) {&#xA;    temp = y[1].r; &#xA;    y[1].r = -1*y[1].i; &#xA;    y[1].i = temp;&#xA;    //&#xA;    y[2].r = -1*y[2].r; &#xA;    //&#xA;    temp = y[3].r; &#xA;    y[3].r = y[3].i; &#xA;    y[3].i = -1*temp;&#xA;  }&#xA;&#xA;  // scale output for inverse FFT&#xA;  if (inv) {&#xA;    for (i=0; i&amp;lt;4; i++) { // scale output by 1/N for IFFT&#xA;      y[i].r = y[i].r/(fp)4;&#xA;      y[i].i = y[i].i/(fp)4;&#xA;    }&#xA;  }&#xA;&#xA;} // r4fft4()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4983" OwnerDisplayName="user1211582" LastActivityDate="2012-11-20T16:46:05.460" Title="radix-4 FFT implementation" Tags="|fft|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3482" PostTypeId="1" CreationDate="2012-09-28T04:40:59.860" Score="9" ViewCount="3667" Body="&lt;p&gt;I am sorry, this is a very basic question. But i am having hard time understanding is how it is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know impulse response is the output of the system when impulse sequence is given as input with initial conditions set to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scaling is to increase the amplitude of the signal, i.e. if i multiply the input by 2, output will also be multiplied by 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time shifted signal is if I delay the input then the output is also delayed by the same factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now can some one please illustrate this with an example how any sequence can be decomposed into sum of copies of the impulse response, scaled and time-shifted signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance.&lt;/p&gt;&#xA;" OwnerUserId="2036" LastActivityDate="2012-11-15T15:05:44.390" Title="How can output sequence be equal to the sum of copies of the impulse response, scaled and time-shifted signals?" Tags="|discrete-signals|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3483" PostTypeId="2" ParentId="3482" CreationDate="2012-09-28T12:34:19.783" Score="4" Body="&lt;p&gt;If we consider a discrete signal, say &lt;/p&gt;&#xA;&#xA;&lt;p&gt;x[n] = {1,5,3} , having three impulses at n = 0, 1 and 2 with amplitude 1, 5 and 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, we can write &lt;/p&gt;&#xA;&#xA;&lt;p&gt;x[n] = 1*$\delta[n]$ + 5*$\delta[n-1]$ + 5*$\delta[n-2]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or we generalize it,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x[n] = $\sum^{\infty}_{-\infty} x[k]\delta(n-k)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Linear time invariant system we know that,  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;for a given input, x[n] = $x[m]\delta[n-m]$, a system response as h[n], &#xA;output $y_m[n]$ =  $x[m]h[n-m]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, using commutative property,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y[n] = $\sum^{\infty}_{-\infty} y_k[n]$ = $\sum^{\infty}_{-\infty} x[k]h[n-k]$&lt;/p&gt;&#xA;" OwnerUserId="1281" LastEditorUserId="1825" LastEditDate="2012-11-15T15:05:44.390" LastActivityDate="2012-11-15T15:05:44.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3484" PostTypeId="1" AcceptedAnswerId="3488" CreationDate="2012-09-28T12:38:18.173" Score="3" ViewCount="182" Body="&lt;p&gt;I am new to linear algebra and have this simple question...&#xA;in least sqaure estimation...the best estimation of the equation $Ax = b$ is $x_{Estimated} = A (A^t A )^{-1} A^t b$...the projection of $b$ on the column space of $A$ is $p = A (A^t A)^{-1} At b$ which is written as $p = P b...P$ is the projection matrix = $A (A^t A)^{-1} A^t$&#xA;now using inverse rule $(AB)^{-1} = B^{-1} A^{-1}$  .......$P$ reduces to $I$ ....so is the projection matrix &lt;strong&gt;$P$&lt;/strong&gt; just the identity matrix $I$ ..?? am i missing out some basic or is my concept not clear? can we write $(A^t A)^{-1}  = A^{-1} (A^t)^{-1}$ always??&lt;/p&gt;&#xA;" OwnerUserId="1942" LastEditorUserId="128" LastEditDate="2019-06-26T08:44:59.573" LastActivityDate="2019-06-26T08:44:59.573" Title="Least Square Error Estimation: Conditions for $ (A^TA)^{ -1} = A^{-1}(A^T)^{-1} $?" Tags="|discrete-signals|kalman-filters|linear-algebra|least-squares|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3485" PostTypeId="1" AcceptedAnswerId="3489" CreationDate="2012-09-28T12:42:39.280" Score="3" ViewCount="2368" Body="&lt;p&gt;So, When we take the FFT of any Composite or Single Sine Wave we get exact frequency on x-axis of the plot.&#xA;The point where we get the original frequency in FFT is depend upon the Sampling Rate and the Length of the actual signal, i.e&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is Sine wave of &lt;code&gt;100KHz&lt;/code&gt; and the Sampling Frequency equals to &lt;code&gt;1MHz&lt;/code&gt;, and If we are plotting the 10 Oscillations i.e &lt;code&gt;t = 10/f&lt;/code&gt; then the length of the Signal would be &lt;code&gt;100&lt;/code&gt;.&#xA;and If we plot the FFT of that signal than the First point in FFT represent &lt;code&gt;10KHz&lt;/code&gt; i.e &lt;code&gt;1MHz/100 = 10KHz&lt;/code&gt;. So the actual signal frequency will be plotted on the &lt;code&gt;10th&lt;/code&gt; point of FFT graph, ( 10KHz*10 = 100KHz ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how we can see the Frequency of our actual signal in Frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but what about an Image ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a binary &lt;code&gt;8x8&lt;/code&gt; image ,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image = [zeros(8,4) ones(8,4)]&#xA;&#xA;image =&#xA;&#xA;     0     0     0     0     1     1     1     1&#xA;     0     0     0     0     1     1     1     1&#xA;     0     0     0     0     1     1     1     1&#xA;     0     0     0     0     1     1     1     1&#xA;     0     0     0     0     1     1     1     1&#xA;     0     0     0     0     1     1     1     1&#xA;     0     0     0     0     1     1     1     1&#xA;     0     0     0     0     1     1     1     1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The FFT will be calculated for each row and for each column which mean the number of samples to calculate each FFT will be 8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the FFT values have no frequencies, it has only complex amplitudes, then how does the FFT is plotted for image, How can identify the actual frequency like i did in case of Sine wave by dividing the Fs with length of Signal ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is 1D FFT of the Signal,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = [0 0 0 0 1 1 1 1]; %what are the frequencies here&#xA;&#xA;    % Samples = 8&#xA;&#xA;    f = fft(x)&#xA;    plot (abs(f))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZPP2s.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody explain me please what are the frequencies in the FFT plot ! ??? &#xA;I just need one good example that explain the graph of FFt of this signal like i did for a sine wave.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-02-22T10:52:01.260" Title="Comparing Image FFT with Sine wave FFT" Tags="|fft|matlab|frequency|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3486" PostTypeId="1" CreationDate="2012-09-28T12:47:16.123" Score="1" ViewCount="902" Body="&lt;p&gt;I'm reading a &lt;a href=&quot;https://sites.google.com/site/hobbydebraj/home/goertzel-algorithm-dtmf-detection&quot; rel=&quot;nofollow&quot;&gt;Goertzel algorithm&lt;/a&gt; paper and an &lt;a href=&quot;http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm&quot; rel=&quot;nofollow&quot;&gt;embedded&lt;/a&gt; article. I have several questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I don't understand why the the magnitude is calculated as follows:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$\text{Magnitude} = y^2[n-2] + y^2[n-1] - a * y[n-2]y[n-1]$$&#xA;where $a$ is some coefficient. Can someone elaborate on why this is the expression?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Minimum block size If I have a sampling rate of 4000 Hz and target frequency of 50 Hz, what is the minimum block size?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If block size more that magnitude will more accurate right?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2008" LastEditorUserId="6" LastEditDate="2012-12-28T01:19:03.283" LastActivityDate="2012-12-28T01:19:03.283" Title="Goertzel algorithm magnitude" Tags="|algorithms|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3487" PostTypeId="2" ParentId="3484" CreationDate="2012-09-28T12:56:03.380" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://chortle.ccsu.edu/vectorlessons/vmch16/vmch16_13.html&quot; rel=&quot;nofollow&quot;&gt;From here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;(AB)(B^{-1}A^{-1}) = A (BB^{-1}) A^{-1} = A A^{-1}  = I&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $(AB)^{-1} = B^{-1} A^{-1}$ provided $A$ and $B$ are invertible.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2012-09-28T13:01:19.990" LastActivityDate="2012-09-28T13:01:19.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3488" PostTypeId="2" ParentId="3484" CreationDate="2012-09-28T13:59:08.903" Score="5" Body="&lt;p&gt;First of all, the minimum norm least square solution is $A^+b$, where $A^+$ is the pseudoinverse. Only when the left inverse $A_L^{-1}$ (or right inverse $A_R^{-1}$) exists, you have $A^+=A_L^{-1}=(A^TA)^{-1}A^T$ (or $A^+=A_R^{-1}=A^T(AA^T)^{-1}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, the projection matrix onto the column space is $P=AA^+$, or $P=AA_R^{-1}=AA^T(AA^T)^{-1}=I$ if $A_R^{-1}$ exists. In other words, if A has full row rank, then the projector $P$ is indeed an identity matrix. If only left inverse exists, then $P=AA_L^{-1}=A(A^TA)^{-1}A^T$ is not an identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, $(AB)^{-1}=A^{-1}B^{-1}$ is valid only when $A$ and $B$ are square matrices.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastEditorUserId="1641" LastEditDate="2012-09-28T14:14:35.953" LastActivityDate="2012-09-28T14:14:35.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3489" PostTypeId="2" ParentId="3485" CreationDate="2012-09-28T14:10:43.143" Score="2" Body="&lt;p&gt;&lt;code&gt;x = [0 0 0 0 1 1 1 1]&lt;/code&gt; is one cycle of a (not bandlimited) square wave, with a DC offset, with a period equal to the period of the window.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;....''''....''''....''''&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The DC component is the FFT value at index 1 (remember that Matlab's array indexing starts at 1 instead of the more sane 0-based indexing), and to get the true value you have to divide by the number of samples (4/8 = 1/2 DC offset).  The square wave is the components at index 2 and 4.  Because the signal is real, the components at 6, 7, 8 are just mirror images of 4, 3, 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A square wave is made up of odd harmonics with 1/n amplitude, so with fundamental f1&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;frequency   f1, amplitude   1&lt;/li&gt;&#xA;&lt;li&gt;frequency 3*f1, amplitude 1/3&lt;/li&gt;&#xA;&lt;li&gt;frequency 5*f1, amplitude 1/5&lt;/li&gt;&#xA;&lt;li&gt;frequency 7*f1, amplitude 1/7&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Since your number of samples is so low, you only have room for the first 2 harmonics before you hit the Nyquist frequency.  So the value at index 4 is the 3rd harmonic, which should be approximately 1/3 of the value at index 2, the first harmonic (though not exactly 1/3 because of aliasing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your sampling frequency is 1 MHz, and the value at index 2 represents the fundamental frequency, then you know the square wave fundamental frequency is (index-1)*fs/N = (2-1)*1MHz/8 = 125 kHz, or 1/8th of the sampling frequency, as you would expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try experimenting with longer signals and it will be easier to see what's happening.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-09-28T14:15:44.850" LastActivityDate="2012-09-28T14:15:44.850" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3490" PostTypeId="2" ParentId="3485" CreationDate="2012-09-28T14:46:34.100" Score="1" Body="&lt;p&gt;First of all, for short 1D signal it is useful to do the FFT of original signal padded with zeros. That way FFT will have higher resolution and it will be easier to identify specific frequencies. &#xA;For plotting of FFT I use this simple function to generate accurate frequency axis.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function f=faxis(N,fs)&#xA; deltaf=fs/N;&#xA; if 2*floor(N/2)==N % N is even&#xA; f=linspace(-fs/2,fs/2-deltaf,N);&#xA; else % N is odd&#xA; f=linspace(-(fs-deltaf)/2,(fs-deltaf)/2,N);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Example of plotting fft of signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = [0 0 0 0 1 1 1 1];&#xA;f = fft(x,1024); % fft of x padded 1016 zeros&#xA;&#xA;% plotting f in logarithmic scale, sampling frequency is 10000 Hz&#xA;plot(faxis(length(f),10000), 20*log10(abs(fftshift(f))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For 2D signals (images):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image = [zeros(8,4) ones(8,4)]&#xA;f = fft2(image,1024,1024); % padding to get higher resolution in frequency&#xA;imagesc(20*log10(abs(fftshift(f)))); % ploting in logarithmic scale&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For images, frequency unit is unclear (it isn'n Herz, because it's spatial frequency, it should be something like 1/meter) so it is beter to think in digital termes where maximum frequency is PI (or 1.0).&#xA;Using the code above, you will open a figure where the lowest frequencies will be in the middle, and at the edges high frequencies (PI).&lt;/p&gt;&#xA;" OwnerUserId="2034" LastEditorUserId="2034" LastEditDate="2012-09-28T20:43:41.220" LastActivityDate="2012-09-28T20:43:41.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3492" PostTypeId="1" AcceptedAnswerId="3497" CreationDate="2012-09-28T16:19:26.440" Score="2" ViewCount="89" Body="&lt;p&gt;We can write the error function ($E(w)=1/2\sum_{n=1}^{N}\{y(x_n,w)-t_n\}^2$) as a linear model using its partial derivatives. Is it possible to do the same thing about the modified error function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The modified error function is (page 10- pattern recognition by Bishop):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E(w)=1/2\sum_{n=1}^{N}\{y(x_n,w)-t_n\}^2+\dfrac \lambda2||w||^2$$&lt;/p&gt;&#xA;" OwnerUserId="89" LastEditorUserId="26573" LastEditDate="2018-12-22T17:59:09.673" LastActivityDate="2018-12-22T17:59:09.673" Title="Linear model of the modified error function" Tags="|linear-systems|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3493" PostTypeId="2" ParentId="3486" CreationDate="2012-09-28T17:00:00.013" Score="4" Body="&lt;p&gt;[1] It's a notch filter. It attenuates everything but the frequency component you're interested in. The output is summed up over some time to make the tone detection more reliable.&#xA;[2] There's no minimum block size. There's a requirement about the amount of time spent summing up the output. What you'll see is that the summed output over say 205 samples (at fs 8000kHz), grows much more if the input contains the frequency component you're interested in detecting.&lt;/p&gt;&#xA;" OwnerUserId="2029" LastActivityDate="2012-09-28T17:00:00.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3494" PostTypeId="1" CreationDate="2012-09-28T17:10:35.673" Score="3" ViewCount="5630" Body="&lt;p&gt;I'm trying to apply a sliding window minimum and maximum filter to an image of a certain window size. Actually, I'm trying to find the optimum window size for it. But I really haven't gotten the hang of it. I presume that I should be using &lt;code&gt;blockproc&lt;/code&gt; to implement the sliding window, but not really sure how to find the maximum and minimum filter. As to the implementation itself, should I use loops to slide the window across the entire area of the image ?&lt;/p&gt;&#xA;" OwnerUserId="1911" LastEditorUserId="1629" LastEditDate="2016-07-22T18:44:10.510" LastActivityDate="2021-12-04T22:56:49.033" Title="Sliding window minimum and maximum filter in MATLAB" Tags="|filters|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3495" PostTypeId="2" ParentId="3482" CreationDate="2012-09-28T17:27:00.613" Score="7" Body="&lt;p&gt;One interpretation of your question could be as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given that a system has the following two properties:&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;the &lt;em&gt;scaling&lt;/em&gt; or &lt;em&gt;homogeneity&lt;/em&gt; property that if the response to input $x(t)$ is output $y(t)$, then for any choice of $\alpha$, the system response&#xA;  to scaled input $\alpha\cdot x(t)$ is scaled output $\alpha\cdot y(t)$,&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;the &lt;em&gt;time-invariance&lt;/em&gt; property that for all choices of $\tau$,&#xA;  the response to time-delayed &#xA;  input $x(t-\tau)$ is time-delayed output $y(t-\tau)$,&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;  &#xA;  &lt;p&gt;then why does the system have the &lt;em&gt;additivity&lt;/em&gt; or &lt;em&gt;superposition&lt;/em&gt; property&#xA;  that the response to input $x_1(t)+x_2(t)$ is &#xA;  $y_1(t) + y_2(t)$ where&#xA;  the system response to $x_i(t)$ is $y_i(t)$, $i = 1,2~$ ???? $~~~~~~~~~~~$&#xA;  More generally, why is the system response to input &#xA;  $\alpha\cdot x_1(t-\tau_1) +  \beta\cdot x_2(t-\tau_2)$ &#xA;  given by $\alpha\cdot y_1(t-\tau_1) +  \beta\cdot y_2(t-\tau_2)~$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer is that a system with properties 1 and 2 does not&#xA;&lt;em&gt;necessarily&lt;/em&gt; have the additivity or superposition property.&#xA;If the superposition property &lt;em&gt;also&lt;/em&gt; holds, then the system&#xA;is called a &lt;strong&gt;linear time-invariant system.&lt;/strong&gt; But this is an&#xA;additional assumption that you need to make (or prove).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commonly, homogeneity and additivity are combined together&#xA;into the &lt;em&gt;linearity&lt;/em&gt; property that says that the response&#xA;to input $\alpha\cdot x_1(t)+\beta\cdot x_2(t)$ (that is,&#xA;a linear &#xA;combination of inputs $x_1(t)$ and $x_2(t)$) is &#xA;$\alpha\cdot y_1(t) + \beta\cdot y_2(t)$&#xA;(that is, the &lt;em&gt;same&lt;/em&gt; linear combination of outputs $y_1(t)$ and $y_2(t)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple of points that should be tucked away into the&#xA;back of one's mind:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A system can be linear without being time-invariant (e.g.&#xA;a modulator $x(t) \to x(t)\cos(\omega t)$, or&#xA;time-invariant without being linear (e.g. a square-law&#xA;circuit $x(t) \to [x(t)]^2$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A additive system which produces output $y(t) + y(t) = 2y(t)$&#xA;in response to input $x(t) + x(t) = 2x(t)$ and so &lt;em&gt;seems&lt;/em&gt;&#xA;to have the scaling property does not in fact have the&#xA;scaling property. Persuade yourself that this is true by&#xA;attempting to prove that the response to $0.5x(t)$ is&#xA;$0.5y(t)$. In short, scaling and additivity are two&#xA;different properties and a system that enjoys one of them&#xA;does not necessarily enjoy the other.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A second interpretation of your question could be as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For a linear time-invariant system, the output is supposed&#xA;  to be the sum of scaled and time-delayed versions of the&#xA;  impulse response, but I don't see how this is so. For example,&#xA;  the standard convolution result (for discrete-time systems)&#xA;  says&#xA;  $$y[n] = \sum_m x[m]h[n-m]$$&#xA;  where $h[\cdot]$ is the impulse (or unit) response of the&#xA;  system. But this seems to be completely backwards since the&#xA;  impulse response is running backwards in time (as in $-m$&#xA;  in the argument of $h$ in the above formula&#xA;  compared to $x[m]$ in which time is running forwards.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is indeed a legitimate concern, but actually the&#xA;convolution formula is very successful in &lt;em&gt;concealing&lt;/em&gt;&#xA;the result that the output is the sum of scaled and time-delayed&#xA;versions of the impulse response. What's going on is as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We break down the input signal $x$ into a &lt;em&gt;sum&lt;/em&gt; of scaled&#xA;unit pulse signals. The system response to the unit pulse signal&#xA;$\cdots, ~0, ~0, ~1, ~0, ~0, \cdots$ is&#xA;the &lt;em&gt;impulse response&lt;/em&gt; or &lt;em&gt;pulse response&lt;/em&gt; &#xA;$$h[0], ~h[1], \cdots, ~h[n], \cdots$$&#xA;and so by the scaling property &lt;em&gt;the single input value&lt;/em&gt; $x[0]$,&#xA;or, if you prefer&#xA;$$x[0](\cdots, ~0, ~0, ~1, ~0,~ 0, \cdots)&#xA;=  \cdots ~0, ~0, ~x[0], ~0, ~0, \cdots$$&#xA;creates a response&#xA;$$x[0]h[0], ~~x[0]h[1], \cdots, ~~x[0]h[n], \cdots$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, the single input value $x[1]$ or creates&#xA;$$x[1](\cdots, ~0, ~0, ~0, ~1,~ 0, \cdots)&#xA;=  \cdots ~0, ~0, ~0, ~x[1], ~0, \cdots$$&#xA;creates a response&#xA;$$0, x[1]h[0], ~~x[1]h[1], \cdots, ~~x[1]h[n-1], x[1]h[n] \cdots$$&#xA;Notice the delay in the response to $x[1]$.  We can continue further&#xA;in this vein, but it is best to switch to a more tabular form&#xA;and show the various outputs aligned properly in time. We have&#xA;$$\begin{array}{l|l|l|l|l|l|l|l}&#xA;\text{time} \to &amp;amp; 0 &amp;amp;1 &amp;amp;2 &amp;amp; \cdots &amp;amp; n &amp;amp; n+1 &amp;amp; \cdots \\&#xA;\hline&#xA;x[0] &amp;amp; x[0]h[0] &amp;amp;x[0]h[1] &amp;amp;x[0]h[2] &amp;amp; \cdots &amp;amp;x[0]h[n] &amp;amp; x[0]h[n+1] &amp;amp; \cdots\\&#xA;\hline&#xA;x[1] &amp;amp; 0 &amp;amp; x[1]h[0] &amp;amp;x[1]h[1] &amp;amp; \cdots &amp;amp;x[1]h[n-1] &amp;amp; x[1]h[n] &amp;amp; \cdots\\&#xA;\hline&#xA;x[2] &amp;amp; 0 &amp;amp; 0 &amp;amp;x[2]h[0] &amp;amp; \cdots &amp;amp;x[2]h[n-2] &amp;amp; x[2]h[n-1] &amp;amp; \cdots\\&#xA;\hline&#xA;\vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \\&#xA;\hline&#xA;x[m] &amp;amp; 0 &amp;amp;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; x[m]h[n-m] &amp;amp; x[m]h[n-m+1] &amp;amp; \cdots \\&#xA;\hline &#xA;\vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \ddots  &#xA;\end{array}$$&#xA;&lt;em&gt;The rows in the above array are precisely the scaled and&#xA;delayed versions of the impulse response that add up to&#xA;the response $y$ to input signal $x$.&lt;/em&gt;&#xA;But if you ask a more specific question such as&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the output at time $n$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;then you can get the answer by summing the $n$-th column to get&#xA;$$y[n] = x[0]h[n] + x[1]h[n-1] + x[2]h[n-2] + \cdots + x[m]h[n-m] + \cdots&#xA;= \sum_{m=0}^{\infty} x[m]h[n-m],$$&#xA;the beloved convolution formula that befuddles generations of students&#xA;because the impulse response seems to be running backwards in time.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-09-28T20:24:48.467" LastActivityDate="2012-09-28T20:24:48.467" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3496" PostTypeId="2" ParentId="3494" CreationDate="2012-09-28T17:51:21.163" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/images/ref/ordfilt2.html;jsessionid=df98191aa50128d1529198c12ab5&quot;&gt;ordfilt2&lt;/a&gt; will do this for you: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=5;&#xA;filtered_img = ordfilt2(img, 1, true(N));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for minimum and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filtered_img = ordfilt2(img, N*N, true(N));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for the maximum.  You can also use &lt;a href=&quot;http://www.mathworks.com/help/images/ref/imdilate.html&quot;&gt;imdilate&lt;/a&gt; and &lt;a href=&quot;http://www.mathworks.com/help/images/ref/imerode.html&quot;&gt;imerode&lt;/a&gt; to perform maximum and minimum filters.&lt;/p&gt;&#xA;" OwnerUserId="52" LastActivityDate="2012-09-28T17:51:21.163" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3497" PostTypeId="2" ParentId="3492" CreationDate="2012-09-28T18:10:38.107" Score="4" Body="&lt;p&gt;Yes, you can do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E(w)=1/2\sum_{n=1}^{N}\{y(x_n,w)-t_n\}^2+\dfrac \lambda2||w||^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align} \frac{\partial E(w)}{\partial w} &amp;amp;= \frac{\partial \left( 1/2\sum_{n=1}^{N}\{y(x_n,w)-t_n\}^2+\dfrac \lambda2||w||^2 \right)}{\partial w} \\ &amp;amp;= \frac{\partial \left( 1/2(y({\bf x},{\bf w} )-{\bf t})^T(y({\bf x},{\bf w} )-{\bf t})+\dfrac \lambda2{\bf w}^T{\bf w} \right)}{\partial {\bf w}} \\ &amp;amp;= \frac{\partial \left( 1/2(y({\bf x},{\bf w} )-{\bf t})^T(y({\bf x},{\bf w} )-{\bf t})\right)}{\partial {\bf w}}+\frac{\partial \left( \dfrac \lambda2{\bf w}^T{\bf w} \right)}{\partial {\bf w}} \\ &amp;amp;= \left( \frac{\partial y({\bf x},{\bf w} )}{\partial {\bf w} } \right)^T \left( y({\bf x},{\bf w} )-{\bf t} \right) + \lambda{ \bf w }\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-09-28T18:10:38.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3498" PostTypeId="2" ParentId="3385" CreationDate="2012-09-28T21:47:00.270" Score="1" Body="&lt;p&gt;Both equations are related by Euler's formula: &lt;a href=&quot;http://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Euler%27s_formula&lt;/a&gt;&#xA;They are mathematically equivalent, it's well explained on the Wikipedia page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a practical point of view, $\cos(x)+i\sin(x)$ allows for easy separation of real and imaginary. On the other hand, $\exp(ix)$ makes it easier to deal with Gaussian since $\exp(x)\cdot\exp(y)=\exp(x+y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2030" LastActivityDate="2012-09-28T21:47:00.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3499" PostTypeId="1" CreationDate="2012-09-28T22:49:53.090" Score="3" ViewCount="374" Body="&lt;p&gt;Accidentally asked this question in the general area and was told to ask here, so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to develop a lightweight, relatively-fast-to-decode sound compression format for use in my gaming projects (perfect reproduction is not needed so I only use 16 bit data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to split the sound data into 14-sample frames and use linear prediction to reduce the data size by only storing the residuals. To make it even lighter, the residuals are then quantized to 4 bits per sample by reducing their precision so that they are stored as scaled residuals, where the scale is dictated by the frame header. To make the signal less noisy, 16 linear prediction models are generated that best suit the signal in the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each frame ends up being 64 bits (4 bits for the LP model selection, 4 bits for the residual scale (2^n, so only n is stored), and 14*4 bits for the residual data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've been doing is simply solving the Yule-Walker equations for each frame to get the coefficients and then saving them in an array. After calculating the coefficients for all the frames, I then try to create 16 coefficients based on the Euclidean distance from each LP model and averaging them out. That is to say...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Zero-out target buffer&#xA;&#xA;For i = 1, i &amp;lt;= 16, i++&#xA;  Create and zero-out a temporary buffer for i LP models&#xA;&#xA;  For each saved LP model&#xA;    Find the model in the original target buffer [up to i] with the smallest Euclidean distance between it and this model&#xA;    Accumulate the coefficients to the temporary buffer&#xA;&#xA;  Average out the temporary buffer and store it to the final LP model array [again up to i]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As expected, this doesn't yield very good results at all if only because I imagine it's similar to uniform colour quantization - it has very little relation to the actual data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Googling for a few months, the only thing I can come up with is 'sparse convolution' but I'm not entirely sure what is meant by that when it comes to LPC or if it's even what I'm after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given these parameters (that is: generate 16 LPC models that will minimize the residual error given that the frames are 14 samples long), how would you go about doing it?&lt;/p&gt;&#xA;" OwnerUserId="2039" LastEditorUserId="4298" LastEditDate="2013-06-25T20:58:03.753" LastActivityDate="2013-06-25T20:58:03.753" Title="Linear predictive model convolution" Tags="|filters|audio|convolution|linear-prediction|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3500" PostTypeId="2" ParentId="3499" CreationDate="2012-09-28T23:45:41.947" Score="3" Body="&lt;p&gt;Averaging AR-coefficients is a risky business - this could cause drastic shifts in the position of the zeroes of the corresponding polynomial, resulting in instabilities!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were to approach the problem the first thing I would try would be the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Compute the spectrogram (short-term fourier transform)&lt;/li&gt;&#xA;&lt;li&gt;Run VQ on the spectral slices with a codebook size of 16, using euclidian distance on the log&lt;/li&gt;&#xA;&lt;li&gt;Once you have 16 spectral template, convert them back to autocorrelation functions, solve yule-walker for the 16 templates and you get your 16 models.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Or another &quot;safe&quot; way:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For each frame, extract the AR coefficients.&lt;/li&gt;&#xA;&lt;li&gt;Convert them into reflection coefficients or any other alternative representation like line spectral pairs which can be safely interpolated.&lt;/li&gt;&#xA;&lt;li&gt;Run VQ on these with a codebook size of 16 to get your 16 models.&lt;/li&gt;&#xA;&lt;li&gt;Convert back to AR coefficients.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But I really doubt this is a path worth exploring. My two intuitions would be that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If an audio file is long and diverse enough the 16 specialized models you would get out of it won't be very different form the 16 &quot;universal&quot; models you would obtain out of running the procedure once and for all on a large collection of audio files.&lt;/li&gt;&#xA;&lt;li&gt;Learning 16 models from a large collection of audio files is likely to give you the kind of naive &quot;fixed predictors&quot; used in FLAC (polynomial interpolators).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One related result is that running a KLT on mel-frequency spectra on a sufficiently long audio clip is going to yield something very similar to the DCT base - that's why audio codecs like mp3 or AAC are not using per-file optimized transforms - the DCT is a good, universal one, and the advantage of using universal transforms is that they don't even require any side-information. This is what motivates my intuition - you are looking at a large dataset (an entire audio file), 16 is small. You'd rather think of 16 good universal predictors and use them than instead of trying to optimize your 16 predictors per file.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-09-28T23:53:27.847" LastActivityDate="2012-09-28T23:53:27.847" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3501" PostTypeId="2" ParentId="3492" CreationDate="2012-09-28T23:47:07.513" Score="2" Body="&lt;p&gt;@Phonon's answer is absolutely correct, and very worthy of the upvote I gave it.  But I had to read it a few times to fully understand it, and I think the reason I was confused is that ${\bf w}$ has a different dimension from ${\bf x}$ and ${\bf t}$.  In the book, the dimension of the former is $M$, and of the others is $N$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an exercise for myself, I tried to write @Phonon's solution using $\sum$ notation, instead of using vectors, just so I could understand it better.  I'm posting the result just in case it's useful to @Gigili, or to anyone else reading this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;E({\bf w})&amp;amp;=\frac 12\sum_{n=1}^{N}\{y(x_n,{\bf w})-t_n\}^2&#xA;+\frac \lambda2||{\bf w}||^2 \\&#xA;\Rightarrow \frac{\partial E({\bf w})}{\partial w_i} &#xA;&amp;amp;= \frac{\partial \displaystyle \left( \frac 12\sum_{n=1}^N\{y(x_n,{\bf w})-t_n\}^2+\frac \lambda2||{\bf w}||^2 \right)}{\partial w_i} \\&#xA;&amp;amp;= \left( \frac 12 \sum_{n=1}^N \frac{\partial y(x_n, {\bf w})}{\partial w_i}\cdot 2\big( y(x_n, {\bf w})-t_n\big) \right) + \frac\lambda2(2w_i) \\&#xA;&amp;amp;= \left( \sum_{n=1}^N \frac{\partial y(x_n, {\bf w})}{\partial w_i}\big( y(x_n, {\bf w})-t_n\big) \right) + \lambda w_i&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="2014" LastActivityDate="2012-09-28T23:47:07.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3502" PostTypeId="1" AcceptedAnswerId="3503" CreationDate="2012-09-29T02:08:18.787" Score="1" ViewCount="1240" Body="&lt;p&gt;So, when we Sampled any signal at the rate lower than Nyquist Frequency we get aliasing,&#xA;for instance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency of Cosine wave is 5Hertz and I had to make 5cycles in a second and if the sampling frequency is 8Hz,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Frequency = 5Hz&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;t = 0.2&lt;/code&gt; &amp;lt;- 1 complete oscillation takes 0.2seconds&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Sampling Frequency = 8Hz&lt;/code&gt;&#xA;then Sampling rate would be, &lt;code&gt;0.125seconds&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means every sample will be generated on each instance of &lt;code&gt;0.125s&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the 8 samples would then be,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  0.1250    0.2500    0.3750    0.5000    0.6250    0.7500    0.8750    1.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;signal can't be completely recovered at this sampling rate, and only first few cycles will be generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the Fractional frequency will then would be, &lt;code&gt;5/8&lt;/code&gt;&#xA;(8 samples per second and 5 cycles per second).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the above example the Fractional frequency is produced due to the aliasing of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but as i studied, the Fractional frequency is the reason which cause the imaginary part of the frequencies to be generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is what I've found,&#xA;Here the cosine (real, labelled &quot;R&quot;) and sine (imaginary, labelled &quot;I&quot;) parts: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/K1qHJ.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in &lt;code&gt;figure #4&lt;/code&gt; , both the waves are sine wave, so the Fractional frequency is &lt;code&gt;-3/8&lt;/code&gt; &#xA;So if there is no Cosine does that mean that this point has no Real part ?&#xA;Then how it is generated while calculating the DFT ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2012-09-29T03:47:37.843" Title="Fractional Frequency and negative Frequencies" Tags="|fft|frequency|frequency-domain|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3503" PostTypeId="2" ParentId="3502" CreationDate="2012-09-29T03:47:37.843" Score="1" Body="&lt;p&gt;On figures 1, 2 and 3, you are plotting 2 curves which you call real and imaginary parts. These can be interpreted as the complex exponential&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = e^{jn\theta_0}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\theta_0$ being 0, $2\pi/8$ and $2\pi/2$. These are not cosines, but complex exponentials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, on figure 4, you only draw the sine part (what you call Imaginary), and not the cosine part. So this is why you don't find a cosine part!! You forgot to draw it. It has nothing to do with aliasing (which you interpret correctly).&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-09-29T03:47:37.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3505" PostTypeId="1" AcceptedAnswerId="53247" CreationDate="2012-09-29T12:07:27.317" Score="2" ViewCount="309" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/x6g1L.png&quot; alt=&quot;This is a page from the book linear algebra,geodesy and gps by Gilbert Strang....&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a page from the book linear algebra,geodesy and gps by Gilbert Strang....&#xA;the page explains about the justification of the inverse of the of the co variance matrix of measurement vector $b$ in the over determined system $Ax = b$ as the best weight matrix for best estimate of x.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;what does the line errors contained in the matrix mean?(underlined in blue color..)&lt;/li&gt;&#xA;&lt;li&gt;how does that substitution take place marked with a blue curve...&lt;/li&gt;&#xA;&lt;li&gt;is E{$rr^T$} = E{$bb^T$} ??&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;any explanation is welcome...&lt;/p&gt;&#xA;" OwnerUserId="1942" LastEditorUserId="128" LastEditDate="2019-06-26T08:45:57.393" LastActivityDate="2019-06-26T08:45:57.393" Title="Questions on Weighted Least Square Estimation" Tags="|discrete-signals|kalman-filters|linear-algebra|least-squares|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3506" PostTypeId="2" ParentId="3505" CreationDate="2012-09-29T12:53:19.003" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The linear model is $b=Ax+r$, so you can see the errors $r$ as the noise added to the measurements $b$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The covariance $\Sigma_b=E\{(b-\bar{b})(b-\bar{b})^T\}=E\{(b-Ax)(b-Ax)^T\}=E\{rr^T\}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$E\{rr^T\} \neq E\{bb^T\}$ unless $Ax=0$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1641" LastEditorUserId="1641" LastEditDate="2012-09-29T13:47:11.420" LastActivityDate="2012-09-29T13:47:11.420" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3507" PostTypeId="1" CreationDate="2012-09-27T02:23:58.770" Score="4" ViewCount="4763" Body="&lt;p&gt;How to find poles of &lt;a href=&quot;http://en.wikipedia.org/wiki/Transfer_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;transfer function&lt;/a&gt; by looking at the step response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a step response graph like such:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/IuEtI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I find the sketch for its poles on the complex plane? The only thing I can gather are the rise time, settling time, overshoot, etc. But how do I derive the poles from that?&lt;/p&gt;&#xA;" OwnerUserId="1570" OwnerDisplayName="mugetsu" LastEditorUserId="26573" LastEditDate="2019-01-14T22:20:29.150" LastActivityDate="2019-01-14T22:20:29.150" Title="How to find poles of transfer function by looking at the step response?" Tags="|transfer-function|poles-zeros|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3508" PostTypeId="2" ParentId="3507" CreationDate="2012-09-27T06:02:44.173" Score="0" Body="&lt;p&gt;The output here for t&gt;0 looks like a constant plus a decaying sine wave, so mathematically it's the real part of $A+Be^{st}$ for three complex constants (A,B,s).  Since the input for t&gt;0 is a constant, the non-constant output is from a pole (that's the definition of pole: zero input for some s can have finite output for that s), so you just need to estimate s from the plot (you technically have two poles which are complex conjugates, as needed to create a &quot;real part&quot;).&lt;/p&gt;&#xA;" OwnerDisplayName="bobuhito" LastActivityDate="2012-09-27T06:02:44.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3509" PostTypeId="2" ParentId="3507" CreationDate="2012-09-27T07:46:46.970" Score="4" Body="&lt;p&gt;There are two things to determine: the frequency $f_n$ (or angular frequency $\omega_n$) and the $Q$.  Approximately (for a high $Q$ system like the one pictured):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) period $T$ is the time between successive peaks. $f_n=1/T$, and $\omega_n=2 \pi f_n$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) ratio of successive positive (or negative) peaks (measured relative to steady-state) $ 1- \delta = e^{-2 \pi /(2Q)} $, or, for high $Q$, $ Q \approx \frac{\pi}{\delta}$.  [Example: If $\delta=0.1$ (10% amplitude decay per cycle), $Q \approx 30$.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The poles are at $ \omega_n \left[-\frac{1}{2Q} \pm i \sqrt{1-\frac{1}{(2Q)^2}} \right] $, or in radial coordinates: $(\omega_n, \pi \pm \tan^{-1}{\sqrt{4Q^2-1}})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[There's also a pole at zero for the step response. Per bobuhito's comment, this pole is not part of the transfer function.]&lt;/p&gt;&#xA;" OwnerDisplayName="Art Brown" LastActivityDate="2012-09-27T15:19:19.727" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3510" PostTypeId="1" AcceptedAnswerId="3515" CreationDate="2012-09-29T23:42:23.943" Score="8" ViewCount="2147" Body="&lt;p&gt;I want to print some line drawings on A3, but they aren't very large - around 600x800px.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried obvious functions in Gimp, like resize then enhancing with wavelet sharpener or unsharp mask, with selective gausian blur before it, but print results are no good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are not easy for vectorization either, but perhaps tweaking some tracing tool can give me better results then resizing bitmap. Before I start exploring this option, I thought to ask for advice:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone share a recipe, either by using programming algorithms (numpy/scipy or matlab) or by using tools available in Gimp or Photoshop, to accomplish quality resize of line drawing?&lt;/p&gt;&#xA;" OwnerUserId="719" LastActivityDate="2012-10-08T14:27:12.500" Title="Resize line art image" Tags="|image-processing|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3511" PostTypeId="1" AcceptedAnswerId="3572" CreationDate="2012-09-30T00:13:24.143" Score="2" ViewCount="2143" Body="&lt;p&gt;In case of 1-D FFT it is far more easier to find number of harmonics and their Respective frequencies and amplitudes.&#xA;Lets say if i have 8 points signal the harmonics of it then would be 7 with one DC point i.e,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eZ6Kh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the harmonics after 4th points would have negative imaginary part as it below the nyquist rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but if I've 2D signal of 8x8 Matrix there would be total of 64 harmonics and the Nyquist rate will then be on the 32nd point. Am i right ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my above statement is correct, the fractional frequency for the first harmonic then would be ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0 -&gt; Dc&#xA;1st Harmonic - &gt; 1/64 -&gt; 64 samples in 1 cycle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Number of Cycle 1.&#xA;Number of samples = 64&#xA;Sampling rate = 0.015625&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would then be the actual frequency of this Harmonic , I am asking this because i couldn't be able to identify it when i am plotting it on Matlab.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2012-10-06T10:11:29.270" Title="Harmonics in 2-D FFT Signal" Tags="|fft|matlab|2d|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3512" PostTypeId="1" AcceptedAnswerId="7531" CreationDate="2012-09-30T03:48:52.403" Score="7" ViewCount="497" Body="&lt;p&gt;I have a well-defined object and a clear image matrix of it. In subsequent frames the object moves, causing motion blur. I want to use the object as a reference to &quot;guide&quot; the deconvolution and eliminate the motion blur. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is to use a feedback loop: do object detection, find the object, then cross correlate with the original image to estimate the quality of my deconvolution. My concern is how to the evaluate the quality of the PSF so I can find the optimal estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a critique of my approach; does it make sense, and what are the pitfalls?&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="1059" LastEditDate="2013-01-16T04:54:52.493" LastActivityDate="2013-05-16T06:16:58.833" Title="Using reference objects to estimate the point spread function?" Tags="|cross-correlation|motion|deconvolution|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3513" PostTypeId="2" ParentId="1628" CreationDate="2012-09-30T04:15:11.793" Score="0" Body="&lt;p&gt;The discrete Meyer was my end choice; it provides a relatively clean sub-band separation. &lt;/p&gt;&#xA;" OwnerUserId="424" LastActivityDate="2012-09-30T04:15:11.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3514" PostTypeId="2" ParentId="3510" CreationDate="2012-09-30T11:07:14.670" Score="0" Body="&lt;p&gt;This is off the top of my head, but assuming you're dealing with images that can be treated as binary (either a pixel  belongs to a line of the drawing or not) you might try enlarging your images (with the ensuing blur) then thresholding to binarize the enlarged image, and then performing morphological thinning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, you'd look at the functions &lt;strong&gt;imresize&lt;/strong&gt;, &lt;strong&gt;im2bw&lt;/strong&gt; and &lt;strong&gt;bwmorph&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps...&lt;/p&gt;&#xA;" OwnerUserId="2045" LastEditorUserId="2045" LastEditDate="2012-09-30T12:40:47.923" LastActivityDate="2012-09-30T12:40:47.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3515" PostTypeId="2" ParentId="3510" CreationDate="2012-09-30T12:04:34.193" Score="3" Body="&lt;p&gt;I am not sure if this is the best way in your case, but I had success with combination of Gaussian and Median filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example I made entirely in Paint.NET. Original image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zjVal.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resize to 400% (Nearest Neighbor):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/do0DG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gaussian Blur (radius: 6.0 px):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hmjdR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Median filter (radius: 4 px, percentile: 50%):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zwegw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Levels to enhance contrast:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PdolD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Curves to cut off blurry shadows (thresholding would work better, but this is not available in Paint.NET by default):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ENiAs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the thin drawing without aliasing need to be strenghtened. You can achieve this by applying Levels prior to Median filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameters of filters I used are purely experimental - playing with these may lead to better result. Maybe stairstep zooming this way may improve it as well.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-09-30T12:04:34.193" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3516" PostTypeId="2" ParentId="2400" CreationDate="2012-09-30T13:30:52.650" Score="3" Body="&lt;p&gt;Think of the time - frequency ambiguity of your matched filter like so:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Frequency ambiguity means it will respond to a range of frequencies&lt;/li&gt;&#xA;&lt;li&gt;Time ambiguity means the response will be 'smeared' around the spatial location.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you you have 0% frequency ambiguity, the matched filter must look like a sine wave and go on for ever, which in the frequency spectrum looks like a dirac delta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0% time ambiguity is a dirac delta in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you have a matched filter that is more than 1 sample wide in the time domain, then it already is ambiguous in both time and frequency domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are doing matched filtering of the envelope, then you are just looking at the modulating signal, and there is no need to look at the 2D time-frequency spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to match the envelop (modulating signal) and the base frequency, then you need a quadrature filter with a bandwidth around the range of frequencies you expect. A quadrature filter is required because it will make the response invariant to the phase of the base signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't know the base frequency, a 2D time-frequency spectrogram will be useful as it will show you what frequency is being modulated. Essentially, the spectrogram is response of the signal - time axis - to a bunch of different (centre) frequency quadrature filters - frequency axis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;TLDR:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The premise that the evelope-matched filter in the time domain is 100% localised is incorrect.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2012-09-30T13:30:52.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3517" PostTypeId="1" CreationDate="2012-10-01T14:02:14.467" Score="3" ViewCount="113" Body="&lt;p&gt;When considering a linear-Gaussian state space model, it is often referred that, optimal inference is tractable which is very rare in state space models. When considering a nonlinear state space model, it is said that, &lt;em&gt;in general&lt;/em&gt; the posterior distribution is intractable, therefore, inference methods should be used to approximate the posterior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to ask is that, what is the exceptions for nonlinear state space models? Which nonlinear state space model is tractable analytically? Are there any examples?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: For instance, &lt;a href=&quot;ftp://ftp.idsa.prd.fr/local/aspi/legland/ref/doucet00b.pdf&quot; rel=&quot;nofollow&quot;&gt;Doucet says&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given the ﬁltering distribution one can then routinely proceed to&#xA;  ﬁltered point estimates such as the posterior mode or mean of the&#xA;  state. This problem is known as the Bayesian ﬁltering problem or the&#xA;  optimal ﬁltering problem. [...] Except in a few special cases,&#xA;  including linear Gaussian state space models (Kalman ﬁlter) and hidden&#xA;  ﬁnite-state space Markov chains, it is impossible to evaluate these&#xA;  distributions analytically.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To reexpress, I would like to ask that, which &lt;em&gt;nonlinear&lt;/em&gt; state space model is tractable?&lt;/p&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2012-10-01T14:10:05.423" LastActivityDate="2012-10-01T14:10:05.423" Title="Optimal inference for nonlinear state space models" Tags="|kalman-filters|control-systems|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3518" PostTypeId="1" AcceptedAnswerId="3599" CreationDate="2012-10-01T14:58:41.560" Score="15" ViewCount="1405" Body="&lt;p&gt;Image registration algorithms are usually based on point features such as SIFT (Scale-Invariant Feature Transform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw some references to line features, but I was wondering if it would be possible to &lt;strong&gt;match image segments instead of points&lt;/strong&gt;. For example, given source and transformed image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vipHn.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do edge detection, blurring and Watershed Transform on each:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e96oB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regrettably, the segmentation turned out to be too different on each image to match individual segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw some papers on matching shapes and shape descriptors which are invariant to affine transforms, so this area seems to be promising...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Are there any segmentation methods more robust to affine (or even projective) deformations of the image?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-10-09T11:42:38.023" Title="Image Registration by Segmentation" Tags="|local-features|image-segmentation|image-registration|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3519" PostTypeId="2" ParentId="3510" CreationDate="2012-10-01T16:43:19.520" Score="6" Body="&lt;p&gt;Take a look at &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Pixel_art_scaling_algorithms&quot;&gt;pixel art scaling algorithms&lt;/a&gt;, particularly the &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Hqx&quot;&gt;hqx algorithms&lt;/a&gt;.  They're typically limited to a integer scaling factor (i.e. 2x, 3x, 4x) so they aren't completely general purpose but they should do quite well on line drawings.&lt;/p&gt;&#xA;" OwnerUserId="703" LastActivityDate="2012-10-01T16:43:19.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3520" PostTypeId="1" CreationDate="2012-10-01T20:07:41.770" Score="2" ViewCount="208" Body="&lt;p&gt;A simple question as the title indicates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume that we have two signals, measured from two different sensors that are close together. (For this application, the sensors are measuring blood/biological activity at different positions on an animal body). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering when, (if at all), measuring the rising edges of both signals might offer a better estimate of their relative time delays, VS doing a simple cross-correlation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When might we expect this to be true, if ever?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ask because I would like to know if looking at rising edges may indeed be optimal in some sense, instead of it being something 'ad-hocy' and possibly mis-leading in lieu of cross-correlation.&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-10-02T13:34:49.653" Title="When might looking at rising edges perform better than cross-correlation?" Tags="|autocorrelation|cross-correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3521" PostTypeId="2" ParentId="3520" CreationDate="2012-10-01T23:59:10.883" Score="2" Body="&lt;p&gt;Using the rising edge is better than cross-correlation when there is the physical equivalent of an inductor in the system, which will introduce inertia into the system.  That inertia will cause the output to rise gradually, then fall back down.  Even in that case the cross-correlation might be more useful, but if you wanted to know when the input starts to affect the output the rise would be more accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gHNV4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figure above is illustrative of what I'm talking about.  The inductor (or &quot;inertia introducing object&quot;) resists any change in the current flow, so initially it resists the flow causing an exponential rise (as opposed to a sharp rise that matches the presumed non-ideal impulse at the input), and then opposes the current stopping when the input ends, causing the exponential fall at the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input looks more-or-less like an impulse function, it will correlate most strongly with the output at the output's peak, at time 100.  It's clear, though, that the input starts to affect the output at time 1.  In different situations, either measurement could be the more useful one.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-10-02T13:34:49.653" LastActivityDate="2012-10-02T13:34:49.653" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3522" PostTypeId="2" ParentId="3465" CreationDate="2012-10-02T02:25:54.797" Score="5" Body="&lt;p&gt;To solve optimization problems with TV penalty, we use a recently proposed algorithm called &lt;a href=&quot;https://ieeexplore.ieee.org/document/5173518&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Gradient Based Algorithms for Constrained Total Variation Image Denoising and Deblurring Problems (FISTA)&lt;/a&gt;, which has better convergence rate than conventional iterative methods, such as ASD-POCS.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastEditorUserId="128" LastEditDate="2019-10-18T13:44:40.703" LastActivityDate="2019-10-18T13:44:40.703" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3523" PostTypeId="2" ParentId="1991" CreationDate="2012-10-02T08:58:14.957" Score="-3" Body="&lt;p&gt;well, the simple way is , if u have used the fourier to find the spectra , and u need to know its frequency by how much is it shifted, u can do one thing ..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) find out the impulse response from that spectra&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) convolve it with a noise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) see the signal that u obtaine4) take its FFT just to be sure , if it matches with  the previous one &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4)and see the spectra by averaging in to differnt parts... for this i can give u a algorithm in mathematica software, which is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;reflect[a_] := Module[{n = Length[a]},&#xA;  RotateRight[a, Floor[n/2]]&#xA;  ]&#xA;&#xA;freqAxis[len_] := Module[{},&#xA;   If[OddQ[len],&#xA;    Range[1, len] - (Ceiling[len/2.]),&#xA;    Range[1, len] - (1 + Ceiling[len/2.])&#xA;    ]&#xA;   ];&#xA;&#xA;colors = {Black, Red, Blue, Brown , ColorData[&quot;Legacy&quot;, &quot;DarkGreen&quot;], &#xA;   ColorData[&quot;Legacy&quot;, &quot;Goldenrod&quot;], ColorData[&quot;Legacy&quot;, &quot;DeepPink&quot;], &#xA;   Cyan, Orange, Purple, ColorData[&quot;Legacy&quot;, &quot;DeepSkyBlue&quot;], Magenta};&#xA;&#xA;specPlot[pieces_, pieceLen_, color_] := &#xA; Module[{data, spec, fAxis, pos},&#xA;  fAxis = freqAxis[pieceLen];&#xA;  data = Partition[Take[mysignal, pieces*pieceLen], pieceLen];&#xA;  spec = Total[Abs[Fourier[data]]^2]/pieces;&#xA;  spec = reflect[spec];&#xA;  Print[&quot;valley=&quot;, Nearest[spec, 1.0][[1]], &quot; atPos=&quot;, &#xA;   pos = Position[spec, Nearest[spec, 1.0][[1]]][[1, 1]], &quot; atFpos=&quot;, &#xA;   Position[fAxis, 0][[1, 1]], &quot; atF=&quot;, fAxis[[pos]], &quot; firstMax=&quot;, &#xA;   Max[Take[spec, Round[pieceLen/2]]], &quot; atF=&quot;, &#xA;   fAxis[[Position[spec, Max[Take[spec, Round[pieceLen/2]]]][[1, &#xA;     1]]]], &quot; lastMax=&quot;, Max[Take[spec, -Round[pieceLen/2]]], &quot; atF=&quot;,&#xA;    fAxis[[Position[spec, Max[Take[spec, -Round[pieceLen/2]]]][[1, &#xA;     1]]]]];&#xA;  ListLinePlot[Transpose[{fAxis, spec}], PlotStyle -&amp;gt; colors[[color]],&#xA;    PlotLabel -&amp;gt; &quot;N = &quot; &amp;lt;&amp;gt; ToString[pieces], PlotRange -&amp;gt; All]&#xA;  ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in this code , i have a argument to take pmsesignal , so u can use ur own signal instead of it..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i am not sure, how well i explained this, but this had worked in my case.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="2049" LastEditorUserId="6" LastEditDate="2012-10-02T21:17:34.040" LastActivityDate="2012-10-02T21:17:34.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3524" PostTypeId="1" CreationDate="2012-10-02T15:00:09.277" Score="3" ViewCount="573" Body="&lt;p&gt;To my ears, sawtooth and square waves are more similar to each other than either one is to a triangle wave. However, when I compare their magnitude spectra against each other using &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation#Normalized_cross-correlation&quot; rel=&quot;nofollow&quot;&gt;normalized cross-correlation&lt;/a&gt;, the square and triangle waves are the most similar to each other, followed by the sawtooth and triangle waves. Does anyone know what the source of this apparent mismatch is?&lt;/p&gt;&#xA;" OwnerUserId="1458" LastEditorUserId="1458" LastEditDate="2012-10-02T17:48:36.157" LastActivityDate="2012-10-02T17:48:36.157" Title="Why is there a mismatch between normalized cross-correlation and perception for basic waveforms?" Tags="|frequency-spectrum|cross-correlation|waveform-similarity|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3525" PostTypeId="2" ParentId="3524" CreationDate="2012-10-02T15:14:27.043" Score="3" Body="&lt;p&gt;The human ear does not &quot;sense&quot; the time-domain representation of the signal, but, in a rough approximation, the magnitude of its frequency-domain representation (spectrum).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, several variants of the same stationary signal with different phase shifts will sound exactly the same. From that, it is clear to see that normalized cross-correlation is a poor metric for comparing audio signals; since a sine-wave and the same sine-wave with a 90° phase shift will have a low cross-correlation, while they are indistinguishable. A better place to start to compare waveforms would be to compute the cross-correlation of the magnitude spectra.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-10-02T17:42:05.670" LastActivityDate="2012-10-02T17:42:05.670" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3526" PostTypeId="2" ParentId="3524" CreationDate="2012-10-02T16:13:08.373" Score="4" Body="&lt;ul&gt;&#xA;&lt;li&gt;Sawtooth: &#xA;&lt;ul&gt;&#xA;&lt;li&gt;Even and odd harmonics, falling off at 1/n &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Square: &#xA;&lt;ul&gt;&#xA;&lt;li&gt;Odd harmonics only, falling off at 1/n&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Triangle: &#xA;&lt;ul&gt;&#xA;&lt;li&gt;Odd harmonics only, falling off at &lt;strong&gt;1/n&lt;sup&gt;2&lt;/sup&gt;&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So while triangle and square have the same set of frequencies present, the spectral envelope of sawtooth and square is more similar, with much stronger high frequency harmonics.  Triangle waves are simpler/closer to a sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Also, if you're generating them digitally, it's uncommon for them &lt;a href=&quot;http://www.slack.net/~ant/bl-synth/&quot; rel=&quot;nofollow&quot;&gt;to be bandlimited&lt;/a&gt;, which produces worse aliasing artifacts with the square and sawtooth than with the triangle.  This would be most audible with frequency sweeps or high fundamental frequencies.)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2012-10-02T16:13:08.373" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="3528" PostTypeId="1" AcceptedAnswerId="3532" CreationDate="2012-10-02T22:20:19.693" Score="2" ViewCount="906" Body="&lt;p&gt;I have a system of the form:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T(x(n))=x(n)+3x(n-2)-5x(n-3)x(2n)$$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I claim that  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T(x(n-k))=x(n-k)+3x(n-k-2)-5x(n-k-3)x(2n-2k),$$&#xA;$$y(x(n-k)= x(n-k)+3x(n-k-2)-5x(n-k-3)x(2n-2k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T(ax_1(n)+bx_2(n))=ax_1(n)+bx_2(n)+3\left( ax_1(n-2)+bx_2(n-2)\right) - 5 \left(ax_1(n-3)+bx_2(n-3) \right)\left( ax_1(2n)+bx_2(2n)\right),$$&#xA;$$aT(x_1(n))+bT(x_2(n))) = ax_1(n)+3x_1(n-2)-5x_1(n-3)x_1(2n) + ax_2(n)+3x_2(n-2)-5x_2(n-3)x_2(2n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the system is not linear, but is time-invariant.  I'm I applying the formulas correctly?&lt;/p&gt;&#xA;" OwnerUserId="1330" LastActivityDate="2012-10-03T13:58:04.243" Title="Verifying Linear Time Invariance" Tags="|linear-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3529" PostTypeId="1" AcceptedAnswerId="3530" CreationDate="2012-10-02T23:11:49.947" Score="1" ViewCount="122" Body="&lt;p&gt;I have an input signal $$x(n)=\left(3,-5,4,3,-1,-2,6,8\right), n=-3,..,4$$ and impulse response $$h(n)=(1,-1,1,-1,1), n=-1,...,3.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convolution between $x(n)$ and $h(n)$ is  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)*h(n)=\sum_{-\infty}^\infty x(k)h(n-k)$$&#xA;If I'm not mistaken, I can reduce this to the finite sum&#xA;$$=x(-3)h(n+3)+x(-2)h(n+2)+x(-1)h(n+1)+x(0)h(n)+x(1)h(n-1)+x(2)h(n-2)+x(3)h(n-3)+x(4)h(n-4)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if I were to calculate the sum by hand, I would proceed by first evaluating&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(-3)h(n+3)=3h(n+3) = (3,-3,3,-3,3)$ for $n=-4,...,0$&#xA;$x(-2)h(n+2)=-5h(n+3) = (-5,+5,-5,+5,-5)$ for $n=-3,...,1$&lt;br&gt;&#xA;etc...  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I would only add up the terms whose position $n$ aligns (that is, add all terms at n=-4 together, all terms at n=-3 together, etc...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my approach to evaluating the convolution correct?&lt;/p&gt;&#xA;" OwnerUserId="1330" LastActivityDate="2012-10-03T00:19:34.880" Title="Verifying the computation of a convolution" Tags="|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3530" PostTypeId="2" ParentId="3529" CreationDate="2012-10-03T00:19:34.880" Score="3" Body="&lt;p&gt;I would have liked to give a longer answer, but yes, your approach is correct. I don't see any problems with what you laid out in your question.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-10-03T00:19:34.880" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3531" PostTypeId="1" AcceptedAnswerId="3535" CreationDate="2012-10-03T02:55:05.270" Score="14" ViewCount="643" Body="&lt;p&gt;The starting assumption for compressed sensing (CS) is that the underlying signal is sparse in some basis, e.g., there are a maximum of   non-zero Fourier-coefficients for an  $s$-sparse signal. And real life experiences do show that the signals under consideration are often sparse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is - given a signal, before sending out the compressively-sampled bits to the receiver and let her recover to the best of her abilities, is there a way to tell what its sparsity is, and if it is a suitable candidate for compressed sensing in the first place? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, is there any additional/alternative characterization of sparsity that can tell us quickly whether CS will be useful or not. One can trivially see that the sender could do exactly what the receiver will do with some randomly chosen set of measurements, and then try to figure out the answer. But is there any alternate way to resolve this question ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My suspicion is that something like this must have been studied, but I couldn't find a good pointer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note : I had posted this question in Mathoverflow, a few weeks back, but didn't get any answer. Hence the cross-post.&lt;/p&gt;&#xA;" OwnerUserId="2051" LastActivityDate="2012-10-04T15:52:44.367" Title="Is there any alternative characterization of sparsity of a signal in compressed sensing" Tags="|compressive-sensing|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3532" PostTypeId="2" ParentId="3528" CreationDate="2012-10-03T12:51:40.510" Score="6" Body="&lt;p&gt;The term $x(2n)$ is not time invariant: it gives the even samples of $x$. Shift the input by 1 sample and you'll get the odd terms, which are different from the even terms shifted 1 place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your reasoning above is not correct. You should compare $T(x(n-k))$ to $T(x(n))|_{n-k}$ (that is, the original output, shifted by $k$ samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;These type of exercises are a common source of confusion because of the following abuse of notation: $x(n)$ is not a signal, but the nth sample of the signal, and having $n$ inside of the expressions is formally wrong. Even Oppenheim's book makes this mistake when working with LTI systems and impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct way for expressing transforms between signals is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x$ and $y$ be signals; $T\{\cdot\}$ be the transformation (system) under scrutiny; $R_k\{\cdot\}$ be a delay of $k$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in general you would write the relation between input and output signals as $y = T\{ x \}$, where the &lt;strong&gt;whole&lt;/strong&gt; signals are involved. Using $n$ inside these expressions collapses the signal to a single sample and this is wrong. And having the same variable $n$ on both sides of the equation only leads to confusion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, a system is time-invariant if $R_k\{T\{ \cdot \}\} = T\{ R_k\{ \cdot \}\}$ for all integer $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why I gave the example above with even-odd samples, in order to avoid the usual confusion with $n$ inside the expressions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, going back to the system $T$ that evaluates to $y[n] = x[2n]$ for each sample $n$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x_k = R_k\{x\}$ and $y_k = R_k\{y\} = R_k\{T\{x\}\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluating all these signals at sample $n$: $x_k[n] = x[n-k]$; $y_k[n] = x[2n - 2k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, $T\{x_k\}$ at sample $n$ is $x_k[2n] = x[2n - k]$ which is different from $y_k$.&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2012-10-03T13:58:04.243" LastActivityDate="2012-10-03T13:58:04.243" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3535" PostTypeId="2" ParentId="3531" CreationDate="2012-10-03T15:53:17.270" Score="4" Body="&lt;p&gt;Indeed, there are ways in which sparsity, or information content, may be estimated&#xA;at the acquisition device. The details, practicality, and actual usefulness of doing so&#xA;is debatable and heavily dependent upon the context in which it is applied. In the case&#xA;of imaging, one could determine areas of an image which are more or less compressibile &#xA;in a predetermined basis. For example, see &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5585813&quot; rel=&quot;nofollow&quot;&gt;&quot;Saliency-Based Compressive Sampling for Image Signals&quot; by Yu et al&lt;/a&gt;. In this case, the additional complexity requirements placed on the acquisition device provide marginal gains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regards to your questions about making determinations as to the usefulness of Compressed Sensing on a given signal at the time of acquisition: If the signal in question adheres to &#xA;any kind of model known &lt;em&gt;a priori&lt;/em&gt;, Compressed Sensing is possible. Accurate recovery is &#xA;simply dependent upon ratio between the number of measurements taken and the degree to which&#xA;the sampled signal adheres to your model. If it is a bad model, you won't get past &lt;a href=&quot;http://www.pnas.org/content/106/45/18914.full&quot; rel=&quot;nofollow&quot;&gt;the phase&#xA;transition&lt;/a&gt;. If it is a good model, then you will be able to calculate an accurate&#xA;reconstruction of the original signal. Additionally, Compressed Sensing measurements are, &#xA;in general, future proofed. If you have a given number of measurements for a signal which &#xA;are insufficient in number of accurately recover the original signal using the model you&#xA;have today, then it is still possible to devise a better model tomorrow for which these &#xA;measurements are sufficient for accurate recovery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Additional Note (edit):&lt;/strong&gt;&#xA;The acquisition approach mentioned in your question sounded quite near to adaptive Compressed Sensing, so I thought the following might be of interest for the readers of this question. Recent results by Arias-Castro, Candes, and Davenport have shown that adaptive measurement strategies cannot, in theory, offer any significant gains over non-adaptive (i.e. blind) Compressed Sensing. I refer readers to their work, &lt;a href=&quot;http://arxiv.org/pdf/1111.4646.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;On the Fundamental Limits of Adaptive Sensing&quot;&lt;/a&gt; which should be appearing in the ITIT soon. &lt;/p&gt;&#xA;" OwnerUserId="2054" LastEditorUserId="2054" LastEditDate="2012-10-04T04:49:59.063" LastActivityDate="2012-10-04T04:49:59.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3536" PostTypeId="1" CreationDate="2012-10-03T15:53:36.380" Score="0" ViewCount="984" Body="&lt;p&gt;I have this code for Gamut3D in &lt;code&gt;RGB&lt;/code&gt;, but I'm looking to convert it into &lt;code&gt;LAB&lt;/code&gt; colorspace but I'm not really sure what changes I should be making.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rgbImage = imread('pill1.jpg');&#xA;% Get the dimensions of the image.  numberOfColorBands should be = 3.&#xA;[rows columns numberOfColorBands] = size(rgbImage);&#xA;% Display the original color image.&#xA;imshow(rgbImage);&#xA;title('Original Color Image');&#xA;% Enlarge figure to full screen.&#xA;set(gcf, 'units','normalized','outerposition',[0 0 1 1]);&#xA;% Extract the individual red, green, and blue color channels.&#xA;redChannel = rgbImage(:, :, 1);&#xA;greenChannel = rgbImage(:, :, 2);&#xA;blueChannel = rgbImage(:, :, 3);&#xA;% Construct the 3D color gamut.&#xA;gamut3D = zeros(256,256,256);&#xA;for column = 1: columns&#xA;        for row = 1 : rows&#xA;                rIndex = redChannel(row, column) + 1;&#xA;                gIndex = greenChannel(row, column) + 1;&#xA;                bIndex = blueChannel(row, column) + 1;&#xA;                gamut3D(rIndex, gIndex, bIndex) = gamut3D(rIndex, gIndex, bIndex) + 1;&#xA;        end&#xA;end&#xA;% Get a list of non-zero colors so we can put it into scatter3()&#xA;% so that we can visualize the colors that are present.&#xA;r = zeros(256, 1);&#xA;g = zeros(256, 1);&#xA;b = zeros(256, 1);&#xA;nonZeroPixel = 1;&#xA;for red = 1 : 256&#xA;        for green = 1: 256&#xA;                for blue = 1: 256&#xA;                        if (gamut3D(red, green, blue) &amp;gt; 1)&#xA;                                % Record the RGB position of the color.&#xA;                                r(nonZeroPixel) = red;&#xA;                                g(nonZeroPixel) = green;&#xA;                                b(nonZeroPixel) = blue;&#xA;                                nonZeroPixel = nonZeroPixel + 1;&#xA;                        end&#xA;                end&#xA;        end&#xA;end&#xA;figure;&#xA;scatter3(r, g, b, 3);&#xA;xlabel('R' );&#xA;ylabel('G' );&#xA;zlabel('B' );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1911" LastEditorUserId="698" LastEditDate="2012-10-03T18:19:30.080" LastActivityDate="2012-10-03T23:10:52.207" Title="Converting Gamut3D from RGB colorspace to LAB colorspace" Tags="|matlab|color|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3537" PostTypeId="1" CreationDate="2012-10-03T16:22:51.790" Score="14" ViewCount="16850" Body="&lt;p&gt;I'd like to use STFT for multipitch analysis. &#xA;I realise detecting the partials existing in the signal is just the beginning.&#xA;Still I have problem with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have signal sampled with 'CD' frequency &lt;code&gt;44100Hz&lt;/code&gt;.&#xA;With window of &lt;code&gt;1024&lt;/code&gt; samples I get frequency bin resolution of &lt;code&gt;22500Hz/512=43Hz&lt;/code&gt;.&#xA;This is enough only to discern high piano notes like:&#xA;&lt;code&gt;C5 = 523.251Hz&lt;/code&gt; and &lt;code&gt;C#5 = 554.365&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used to think &lt;code&gt;1024&lt;/code&gt; is quite a large window.&#xA;But maybe it isn't and normally larger windows are used for detecting partials?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can frequency resolution be increased with some other method than increasing window size, which worsens time resolution?&#xA;I thought of two methods:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method1:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Divide signal into frequency bands with bandpassfilters (for example &lt;code&gt;0-11.25Hz&lt;/code&gt; and &lt;code&gt;11.25-22.5Hz&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Downsample higher bands so that original high frequencies will be now low frequencies&#xA;(so do it for second band &lt;code&gt;11.25-22.5Hz -&amp;gt; 0Hz-22.5Hz&lt;/code&gt;) - not sure this is possible.&lt;/li&gt;&#xA;&lt;li&gt;Concat resulting bins sets with adjusted labels.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Method2:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use series of lowpass filters with increasing limit.&lt;/li&gt;&#xA;&lt;li&gt;Perform FFT on increasing frequency ranges.&lt;/li&gt;&#xA;&lt;li&gt;For each frequency use best possible resolution (bins from the first FFT in which this frequency was included).&lt;/li&gt;&#xA;&lt;li&gt;This will cause low frequencies to have better resolution but I think this is ok because for higher notes&#xA;the frequency difference is grater.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I will be grateful any remarks on this issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also read here:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/602/how-do-window-size-sample-rate-influence-fft-pitch-estimation&quot;&gt;How do window size, sample rate influence FFT pitch estimation?&lt;/a&gt; &#xA;about method of improving peak picking results. I think will try to use it.&lt;/p&gt;&#xA;" OwnerUserId="2053" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2017-08-15T19:29:35.747" Title="Can you increase frequency resolution of FFT without increasing window size?" Tags="|filters|fft|pitch|stft|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3538" PostTypeId="1" AcceptedAnswerId="3542" CreationDate="2012-10-03T16:55:49.850" Score="2" ViewCount="281" Body="&lt;p&gt;I have a flying robot with magnetic coil as a sensor. An output from the coil is measured every second in different position. I know the position of the coil and its angles. I need to estimate the unknown position of magnetic source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the output is with noise I assume I need to use Kalman filter, but not sure how to start in this case. Do you know if i can implement Kalman to estimate the position of the source? Do not really know how to start. Did anyone know similar example described somewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for all advice.&lt;/p&gt;&#xA;" OwnerUserId="2055" LastActivityDate="2012-10-03T20:43:14.130" Title="estimation of the position of the magnetic source" Tags="|kalman-filters|position|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3539" PostTypeId="2" ParentId="3537" CreationDate="2012-10-03T17:15:28.080" Score="9" Body="&lt;p&gt;If you really insist on using FFT (rather than parametric methods, which wouldn't suffer from time/frequency trade-offs), you can fake a much better resolution by using the phase information to recover the instantaneous frequency for each FFT bin. Partials can then be detected by looking for plateaus in the function giving instantaneous frequency as a function of FFT bin index. The common implementation of this technique as described &lt;a href=&quot;http://www.asel.udel.edu/icslp/cdrom/vol2/676/a676.pdf&quot;&gt;in this paper&lt;/a&gt; will &quot;cost&quot; you one extra STFT (instantaneous frequency is recovered by operations on the STFT of the signal, and STFT of the derivative of the signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See for example the ifgram function in this &lt;a href=&quot;http://www.ee.columbia.edu/ln/rosa/matlab/sinemodel/&quot;&gt;Matlab implementation of sinusoidal modeling&lt;/a&gt; of audio signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this won't help resolving two partials falling into adjacent FFT bins. It will just provide a much more accurate frequency estimate than just converting into a frequency the FFT bin index of a spectral peak.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-10-03T17:15:28.080" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="3540" PostTypeId="2" ParentId="3536" CreationDate="2012-10-03T17:39:12.057" Score="1" Body="&lt;p&gt;The so-called &lt;code&gt;Gamut&lt;/code&gt; in the code, is nothing but a 3d color histogram. Colors from the image are collected into it, and then each unique &lt;code&gt;(r,g,b)&lt;/code&gt; is being shown as a scatter point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to show the distribution of the colors in &lt;code&gt;LAB&lt;/code&gt; space, you can convert your image from &lt;code&gt;sRGB&lt;/code&gt; to &lt;code&gt;LAB&lt;/code&gt;, (Assuming that the image is in &lt;code&gt;sRGB&lt;/code&gt; space) and then run the same procedure that you have now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to convert it, use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    cform = makecform('srgb2lab');&#xA;    labImage = applycform(cform, rgbImage);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;By the way, the code in your question can be optimized into 4 lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    im = imread('peppers.png');&#xA;    im = reshape(im,[],3);&#xA;    im = unique(im,'rows');&#xA;    scatter3(im(:,1),im(:,2),im(:,3));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-10-03T23:10:52.207" LastActivityDate="2012-10-03T23:10:52.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3541" PostTypeId="1" CreationDate="2012-10-03T17:57:17.853" Score="4" ViewCount="1614" Body="&lt;p&gt;I would like to sum a filterbank made of bandpass butterworth filters to reconstruct an audio signal. Given group delays for each channel shown in the following plot . . . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7laYQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about designing complementaty allpass filters to flatten this out somewhat? It doesn't have to be completely flat, just a bit flatter than it is. Sampling the impulse responses to make linear phase filters is not an option at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matlab code used to generate this is shown below. Note: I have multiplied the group delays by a factor of 2 as the signal is passed through the bank twice.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sr = 22050;&#xA;&#xA;%Make octave wide filters&#xA;cfs = [125 250 500 1000 2000 4000];&#xA;bw = 1; %octaves&#xA;&#xA;nBins = 2^12;&#xA;gd = zeros(nBins,numel(cfs));&#xA;&#xA;for nn = 1:numel(cfs)&#xA;    cf = cfs(nn);&#xA;    loEdge = cf*(2^-bw/2);&#xA;    hiEdge = cf*(2^+bw/2);&#xA;    [b, a] = butter(2, [loEdge hiEdge]/(sr/2), 'bandpass');&#xA;    [gd(:,nn),f] = grpdelay(b,a,nBins,sr);&#xA;end&#xA;&#xA;figure; semilogx(f,2*gd); xlim([10 8000])&#xA;legend(num2str(cfs')); xlabel ('F [Hz]'); ylabel('Group delay [samples]')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2015-06-23T00:28:52.973" Title="All-pass filters to remedy group delay" Tags="|filters|bandpass|filter-bank|allpass|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3542" PostTypeId="2" ParentId="3538" CreationDate="2012-10-03T18:15:06.510" Score="1" Body="&lt;p&gt;To start, you have to write a probabilistic model of your system. Let us denote, your outputs (observations) as $\bf{y}_t$'s and the true positions as $\bf{x}_t$'s. To use Kalman filter, you have to be sure that underlying noise is Gaussian and your observation and transition models (I will explain in the sequel) are linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, write a reasonable observation model such that,&#xA;$$ \mathbf{y}_t = H_t \mathbf{x}_t + \mathbf{w}_t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this model, you aim to model how your true positions are &lt;em&gt;corrupted&lt;/em&gt; and become observations. Thus you have to determine $H_t$. For example, if you are using a camera and want to know 3D positions, then observation model is a camera matrix which projects the real world points to 2D points. In your case, you have to know sensor characteristics (or model it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you have to write a transition model, this requires to use physical knowledge of the underlying system. For instance, if we model a ball and try to model its &lt;em&gt;evolution&lt;/em&gt; in time, certainly we have to write a motion model. Transition model can be written as, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathbf{x}_t = F_t \mathbf{x}_{t-1} + \mathbf{\eta}_t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that, in both models, the noise terms are Gaussian and $H$ and $F$ are linear. To use Kalman filter, you have to know these models, i.e., you should have a probabilistic model which explains the underlying physical structure. Then you can use the Kalman filtering recursions, which are straightforward from this point.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2012-10-03T20:43:14.130" LastActivityDate="2012-10-03T20:43:14.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3543" PostTypeId="2" ParentId="3537" CreationDate="2012-10-04T00:11:04.137" Score="3" Body="&lt;p&gt;The term &quot;resolution&quot; has multiple meanings.  In general, you can't increase your ability to separate (or &quot;resolve&quot;) closely spaced spectral peaks by interpolation using the same window length of data.  But you can estimate the frequency of isolated stationary spectral peaks that are well above the noise floor with finer resolution (sometimes much finer resolution) than the FFT bin spacing by various interpolation methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Common FFT result interpolation methods for higher resolution estimates include parabolic interpolation, Sinc interpolation, zero-padding the data into a much longer FFT, and phase vocoder methods using (slightly) offset overlapping windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FFT is essentially a bank of bandpass filters, each with a very steep transition but tons of stop-band ripple for a given FIR filter kernel length.  As such, these filters do not have great noise rejection of non-periodic-in-window noise.  If you suspect this type of interference to be a problem, then a windowed FFT or a custom filterbank may perform better.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-10-04T00:11:04.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3544" PostTypeId="1" CreationDate="2012-10-04T06:11:48.773" Score="3" ViewCount="2842" Body="&lt;p&gt;Interpreting some homework, I'm a little confused on what it's asking for. I'm asked to filter in the frequency domain (easy enough, just a fft2 and ifft2 when I'm done) a 256x256 8bit grayscale tiff with the following filters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Rectangular low pass filter using cutoff frequency of&#xA;(uc=N/4,vc=M/4) where N and M are the row and column sizes of the&#xA;image.&quot; &lt;/li&gt;&#xA;&lt;li&gt;&quot;Circular low pass filter using cutoff frequency of Circular&lt;br&gt;&#xA;filter the cutoff frequency is given by Rc=N/4= sqrt[(uc)^2+(vc)^2]&lt;br&gt;&#xA;where N and M are the row and column sizes of the image&quot; &lt;/li&gt;&#xA;&lt;li&gt;&quot;Rectangular high pass filter that has the same cutoff as part a.&quot; &lt;/li&gt;&#xA;&lt;li&gt;&quot;Circular high pass filter that has the same cutoff as part b.&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, I understand some of this well enough, but the &quot;Rectangular/Circular&quot; throw me.  We didn't really cover anything like that.  What we did cover were the ideal low/high pass filters and the butterworth low/high pass filters.  Is this perhaps a synonym for the two, the ideal with its immediate cutoff and the buttworth with its tapering? My book does not mention anything in this regard (though perhaps I have not found it...the book is verbose and I am an impatient student at times), only that the general form it gives for the Ideal filters is a circular cutoff, which is what prompts my second supposition: that the circular is the method the book uses, and the rectangluar means to filter anything inside a submatrix one quarter the size of my image, centered, in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or are we talking two different kinds of ideal LPFs and HPFs, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, this is homework for a course, but I'm not looking for easy answers.  I'm looking for understanding.&lt;/p&gt;&#xA;" OwnerUserId="2057" LastActivityDate="2012-10-14T05:52:27.417" Title="LPF and HPF Confusion - Rectangular and Circular Cut-Offs" Tags="|image-processing|fft|lowpass-filter|homework|highpass-filter|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3545" PostTypeId="2" ParentId="3531" CreationDate="2012-10-04T09:15:01.617" Score="2" Body="&lt;p&gt;One practical approach would be to check your signal of interest with a selection of dictionaries to figure out if it is sparse in any of them. You do not actually have to do what the receiver would do, i.e., compress and reconstruct the signal, to see if it is sparse in the particular dictionary. You can apply a linear transform to it and check if the transformed vector is sparse. If it is, the inverse transform is your dictionary. By sparse, I mean count the number of non-zero or non-negligible coefficients in the vector.&#xA;For example, compute the DFT of your signal. If the frequency-domain representation of it turns out to be sparse (enough), you can use the inverse DFT as dictionary.&#xA;If the transform is not invertible, e.g., a wide matrix, it is not quite as straightforward, but it should still be doable with frames.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Regarding alternatives to sparsity, &lt;strong&gt;endolith&lt;/strong&gt; mentions some attempts at generalizing the &quot;simplicity&quot; to more than just sparsity. In addition, there are also:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Low rank: utilized in matrix completion, which is a sort of matrix generalization of compressed sensing. See for example &lt;a href=&quot;http://www-stat.stanford.edu/~candes/papers/MatrixCompletion.pdf&quot; rel=&quot;nofollow&quot;&gt;Exact matrix completion via convex optimization&lt;/a&gt; and newer papers from Candès et al.&lt;/li&gt;&#xA;&lt;li&gt;&quot;&lt;em&gt;k&lt;/em&gt;-simpleness&quot;: the vectors are not exactly sparse; most of their entries are either &lt;em&gt;a&lt;/em&gt; or &lt;em&gt;b&lt;/em&gt; and a few (&lt;em&gt;k&lt;/em&gt;) of them are in between. This is for example described in &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.161.8439&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Donoho &amp;amp; Tanner, 'Precise Undersampling Theorems'&lt;/a&gt; (example 3).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1464" LastEditorUserId="1464" LastEditDate="2012-10-04T09:30:36.870" LastActivityDate="2012-10-04T09:30:36.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3546" PostTypeId="2" ParentId="3537" CreationDate="2012-10-04T10:08:26.027" Score="1" Body="&lt;p&gt;After further research invoked by &lt;strong&gt;Jim Clay&lt;/strong&gt; question and &lt;strong&gt;pichenettes&lt;/strong&gt; answer in comments I found that my &lt;strong&gt;Method2&lt;/strong&gt; is reinvented Bounded Q-transform described for example by Kashima and Mont-Reynaud (I'm not sure I can link to this article, file looks &lt;em&gt;ripped&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their approach is algorithmically more efficient as they start from the largest frequency range and iteratively downsample it by 2 till they get to the lowest octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Benefits of Q-transforms were also explored by Brown for example &lt;a href=&quot;http://www.wellesley.edu/Physics/brown/pubs/cq1stPaper.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&#xA;It may be not as efficient as single FFT, but has an advantage of not calculating thick FFT on high frequency bands which don't require this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for all answers, comments and links.&lt;/p&gt;&#xA;" OwnerUserId="2053" LastEditorUserId="2053" LastEditDate="2012-10-04T10:14:52.913" LastActivityDate="2012-10-04T10:14:52.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3547" PostTypeId="2" ParentId="3544" CreationDate="2012-10-04T13:58:38.790" Score="4" Body="&lt;p&gt;You're probably best off asking your professor for clarification. As you reasoned, it sounds like you're being asked to multiply the image in the frequency domain by either a rectangular or circular mask that eliminates all frequencies outside the mask. This is not typically how you would apply a filter, however, as &quot;ideal&quot; frequency-domain filter masks have unsatisfactory time-domain properties (e.g. a truly ideal rectangular filter has an infinitely long impulse response).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, filters with a tapered response (of which the Butterworth filter is an example) are more often used. However, the problem specification doesn't seem to contain the information that you would need to design such a filter, such as the type of filter and its order.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-10-04T13:58:38.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3548" PostTypeId="2" ParentId="3544" CreationDate="2012-10-04T14:00:42.440" Score="2" Body="&lt;p&gt;Well, you're talking about FFT filtering, right?  So you're transforming to the frequency domain, multiplying by a filter, and then inverse transforming back into the image domain (&quot;space domain&quot;?)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is the filter that you're multiplying by?  Another image, with values of 1 for the frequencies that should be kept, and values of 0 at the frequencies that should be filtered out, etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you understand how the frequency axes are mapped in your 2D FFT implementation, you can see that this filter can be drawn as a white square or a white circle.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2012-10-04T14:00:42.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3549" PostTypeId="1" AcceptedAnswerId="3551" CreationDate="2012-10-04T09:27:50.833" Score="5" ViewCount="1381" Body="&lt;p&gt;I have a hydraulic breaker on a excavator that hammers with a dynamic bpm. I have recorded this sound so that it is in a mp3-file and would like to determine the momentary bpm for the length of the file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using processing with beat detection from the minim-library but so far without any good results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is using beat detection with energy mode in a selected band the preferred way to go? I have had troubles getting good information about where, in terms of frequency, the beats are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of the sound could come from &lt;a href=&quot;http://www.youtube.com/watch?v=596Dtm95Txo&quot;&gt;http://www.youtube.com/watch?v=596Dtm95Txo&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2067" OwnerDisplayName="user1719508" LastEditorUserId="13320" LastEditDate="2016-11-21T12:59:56.403" LastActivityDate="2016-11-21T12:59:56.403" Title="Calculating bpm from machine sound (not music)" Tags="|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3550" PostTypeId="2" ParentId="3549" CreationDate="2012-10-04T14:26:50.860" Score="5" Body="&lt;p&gt;There are two differences between your problem and music beat detection:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The beat in music is a &quot;latent&quot; grid. It's not because a track is at 120BPM that you have exactly 2 notes per second. In music, the beat is more of a lowest common periodicity than an exact pulse train - that's why beat trackers often make octave errors, and also why there is no consensus between human listeners as to what is the BPM of some tracks. Your task doesn't suffer from the same ambiguity because every &quot;hit&quot; counts.&lt;/li&gt;&#xA;&lt;li&gt;The beat in music rarely changes over time; and when it changes, it is often progressive. As a result, the tempo can be assumed constant over windows of 5 or 6s for music. Judging from the video, you cannot make this assumption; because the &quot;rhythm&quot; here is very irregular; with pauses/breaks, and frequent changes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Because of these, I fear that all the assumptions embedded into beat tracking algorithms made them useless on your problem. My suggestion would be to just use an onset detector with a high threshold (to make it more robust to noise). The events you want to detect seem to cover a rather wide frequency band anyway and have a fast decaying envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, simply measure the time delta between adjacent events (when this delta is too high; consider that this is a pause); and eventually, average this over groups of a couple events.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-10-04T14:26:50.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3551" PostTypeId="2" ParentId="3549" CreationDate="2012-10-04T15:23:35.780" Score="2" Body="&lt;p&gt;First I would just try to detect peaks and measure the time between them.  If there's too much background noise to measure them reliably, I'd try to identify frequencies that are strong in the pulses only and filter out everything else.  If that didn't work, I'd try to do a sliding window auto-correlation:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Identify the longest gap between consecutive pulses&lt;/li&gt;&#xA;&lt;li&gt;Using a window that is wide enough to capture the entirety of these two pulses:&lt;/li&gt;&#xA;&lt;li&gt;Perform autocorrelation of the windowed signal (padded, not circular)&lt;/li&gt;&#xA;&lt;li&gt;Find the peak in the autocorrelation = time delay between pulses&lt;/li&gt;&#xA;&lt;li&gt;Convert from time offset to BPM&lt;/li&gt;&#xA;&lt;li&gt;Put in output array along with offset of window&lt;/li&gt;&#xA;&lt;li&gt;Slide the window to the right (maybe with overlap?)&lt;/li&gt;&#xA;&lt;li&gt;Repeat from step 3&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Actually, if the sounds you're looking for are similar enough, you can just use a regular cross-correlation, which will act like a sound-specific filter:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;From the recording, isolate one of the clang sounds, use that as your template.&lt;/li&gt;&#xA;&lt;li&gt;Cross-correlate the template with the template with the recording&lt;/li&gt;&#xA;&lt;li&gt;Every time the clang occurs in the recording, it will produce a large spike in the correlation, while noise or other sounds will not.&lt;/li&gt;&#xA;&lt;li&gt;Then it will be easier to find the peaks using a simple threshold and count the period &lt;em&gt;T&lt;/em&gt; (samples per beat) between them, which you can then convert to BPM &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;fs (samples/second) / T (samples/beat) * 60 (seconds/minute) = beats/minute&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried it with your YouTube recording but the clangs are not uniform enough to match perfectly.  They match well in the region of time from which I took the template, but not in earlier parts of the file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recording:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ljr13.png&quot; alt=&quot;Plot of recorded waveform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q4ts3.png&quot; alt=&quot;Plot of template waveform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross-correlation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WjXS0.png&quot; alt=&quot;cross-correlation match&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scikits.audiolab import wavread&#xA;from scipy.signal import fftconvolve&#xA;from matplotlib.pyplot import plot&#xA;&#xA;template, fs, enc = wavread('clang.wav')&#xA;recording, fs, enc = wavread('Volvo EC360B NLC clangs.wav')&#xA;&#xA;# Cross-correlation is convolution with one reversed&#xA;c = fftconvolve(template[::-1], recording)&#xA;&#xA;plot(abs(c))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-10-09T15:05:41.207" LastActivityDate="2012-10-09T15:05:41.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3552" PostTypeId="2" ParentId="3531" CreationDate="2012-10-04T15:52:44.367" Score="1" Body="&lt;p&gt;The paper &lt;a href=&quot;http://arxiv.org/abs/1204.4227&quot; rel=&quot;nofollow&quot;&gt;&quot;Estimating Unknown Sparsity in Compressed Sensing&quot;&lt;/a&gt;, by Miles Lopes addresses the issue of estimating the sparsity of a signal with a few linear measurements. Note that he estimates the ratio $\|x\|_1^2/\|x\|_2^2$, which is a lower bound of sparsity. And I think you need to know, or fix, the sparsity basis. &lt;/p&gt;&#xA;" OwnerUserId="172" LastActivityDate="2012-10-04T15:52:44.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3553" PostTypeId="2" ParentId="3465" CreationDate="2012-10-04T16:20:41.143" Score="4" Body="&lt;p&gt;In the particular case where $f(y)=\|y\|_1$, the objective function can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\|x-y\|^2 + b\|y\|_1 = \sum_i(x_i - y_i)^2 + b\sum_i |y_i|,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;minimizing it requires to minimize each entry of the sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{y_i} = argmin \{(x_i-y_i)^2 + b|y_i|\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using subdifferentials it is possible to show that the minimizer is the soft-thresholding operator with threshold $b$. That's the method proposed by Donoho and Johnstone for signal denoising. See their paper &lt;a href=&quot;http://biomet.oxfordjournals.org/cgi/content/abstract/81/3/425&quot; rel=&quot;nofollow&quot;&gt;Ideal spatial adaptation by wavelet shrinkage&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in this case, I think that you don't need a more sophisticated solver to estimate your signal.&lt;/p&gt;&#xA;" OwnerUserId="172" LastEditorUserId="172" LastEditDate="2012-10-04T17:33:35.007" LastActivityDate="2012-10-04T17:33:35.007" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3554" PostTypeId="1" CreationDate="2012-10-04T18:12:47.897" Score="1" ViewCount="669" Body="&lt;p&gt;I’m trying to understand the conception of function   &lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/maxstep.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;maxstep&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The foundation of this function is function &lt;code&gt;firwiener&lt;/code&gt; with input parameters: length of adaptive filter, samples of input signal, which returns dLam, kurt &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then step size calculated as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;*mumaxmse = 2/(max(dLam)*(kurt+2)+sum(dLam));*  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Though,  with some types of input data this function works correctly (&quot;x&quot; in Example2), and with some types (&quot;x&quot; in Example 1) incorrectly&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why it happens?&lt;/li&gt;&#xA;&lt;li&gt;How to  estimate  mumaxmse at Example 1?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Example 1 &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; D = 16; % Number of delay samples &#xA; b = exp(1j*pi/4)*[-0.7 1]; % Numerator coefficients &#xA; a = [1 -0.7]; % Denominator coefficients &#xA; ntr= 1000; % Number of iterations &#xA; s = sign(randn(1,ntr+D)) + 1j*sign(randn(1,ntr+D)); % QPSK signal &#xA; n = 0.1*(randn(1,ntr+D) + 1j*randn(1,ntr+D)); % Noise signal &#xA; r = filter(b,a,s)+n; % Received signal &#xA; x = r(1+D:ntr+D); % Input signal (received signal) &#xA; L = 32; % filter length &#xA;[~,~,~,~,~,dLam,kurt] = firwiener(32-1,x,x); % Third input is 'dummy'&#xA; mumaxmse = 2/(max(dLam)*(kurt+2)+sum(dLam));  %  Compute MSE Step size bound&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here  mumaxmse  is  NaN because of kurt (kurt is NaN)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;====================================== &#xA; Example 2 &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; x = randn(2000,1)+sqrt(-1)*randn(2000,1); &#xA; d = x; &#xA; obj = fdesign.lowpass('n,fc',31,0.5); &#xA; hd = design(obj,'window'); % FIR filter to identified. &#xA; coef = cell2mat(hd.coefficients); % Convert cell array to matrix. &#xA; x(:,1) = filter(sqrt(0.75),[1 -0.5],sign(randn(size(x,1),1))); &#xA;[~,~,~,~,~,dLam,kurt] = firwiener(32-1,x,x); % Third input is 'dummy'&#xA;mumaxmse = 2/(max(dLam)*(kurt+2)+sum(dLam));  %  Compute MSE Step size bound&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here  mumaxmse is correctly (kurt not NaN)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+++++From Matab++++++++++++&#xA;%MAXSTEP  Maximum step size for adaptive filter convergence.&#xA;%&#xA;%   MUMAX = MAXSTEP(H,X) predicts a bound on the step size to  provide&#xA;%   convergence of the mean values of the adaptive filter coefficients.  &#xA;%&#xA;%   The columns of the matrix X contain individual input signal sequences.&#xA;%   The signal set is assumed to have zero mean or nearly so.  &#xA;% &#xA;%   [MUMAX,MUMAXMSE] = MAXSTEP(H,X) predicts a bound on the adaptive&#xA;%   filter step size to provide convergence of the adaptive filter&#xA;%   coefficients in mean square.  &#xA;%&#xA;%   See also MSEPRED, MSESIM, FILTER.&#xA;&#xA;%   Author(s): S.C. Douglas&#xA;%   Copyright 1999-2009 The MathWorks, Inc.&#xA;%   $Revision: 1.6.4.2 $  $Date: 2009/10/16 04:52:21 $&#xA;&#xA;error(nargchk(2,2,nargin,'struct'));&#xA;&#xA;xt = x(:);                          %  Stack input sequences into one vector&#xA;&#xA;%  Compute Step size bound for convergence in the mean&#xA;L = length(h.Coefficients);              %  Length of coefficient vector&#xA;mumax = 2/(mean(xt.*xt)*L);         %  Calculate sufficient Step size bound&#xA;&#xA;if (nargout &amp;gt; 1)&#xA;    [~,~,~,~,~,dLam,kurt] = firwiener(L-1,x,x); % Third input is 'dummy'&#xA;    mumaxmse = 2/(max(dLam)*(kurt+2)+sum(dLam));  %  Compute MSE Step size bound&#xA;    if (h.StepSize &amp;gt; mumaxmse/2) || (h.StepSize &amp;lt;= 0)       %  Test h.StepSize and warn if outside reasonable limits&#xA;        warning(generatemsgid('InvalidStepSize'), ...&#xA;            ['Step size is not in the range ',...&#xA;            '0 &amp;lt; mu &amp;lt; mumaxmse/2: \n',...&#xA;            'Erratic behavior might result.']);&#xA;    end&#xA;end&#xA;&#xA;&#xA;&#xA;+++From MATLAB++++++++++++++++++++++++++++++++&#xA;function [W,R,P,V,Lam,dLam,kurt] = firwiener(N,x,y)&#xA;%FIRWIENER Optimal FIR Wiener filter.&#xA;%   B = FIRWIENER(N,X,Y) computes the optimal FIR Wiener filter of order N,&#xA;%   given two (stationary) random signals in column vectors X and Y.&#xA;%&#xA;%   B = FIRWIENER(N,X,Y) where X and Y are matrices, averages over the&#xA;%   columns of X and Y when computing the Wiener filter.&#xA;&#xA;%   Author(s): Scott C. Douglas&#xA;%   Copyright 1999-2009 The MathWorks, Inc.&#xA;%   $Revision: 1.1.4.3 $  $Date: 2009/09/03 04:50:31 $&#xA;&#xA;&#xA;[ntr,L] = size(x);              &#xA;r = zeros(2*(N+1)-1,1);             %  Initial autocorrelation vector&#xA;p = r;                          %  Initial cross correlation vector&#xA;for k=1:L&#xA;    r = r + xcorr(x(:,k),N);  %  Calculate (k)th autocorrelation and accumulate&#xA;    p = p +  xcorr(y(:,k),x(:,k),N);  %  Calculate (k)th cross correlation and     accumulate&#xA;end&#xA;R = toeplitz(r(N+1:2*(N+1)-1))/(L*ntr);  %  (L x L) input autocorrelation matrix&#xA;P = p(N+1:2*(N+1)-1).'/(L*ntr);          %  (1 x L) cross correlation vector&#xA;W = P/R;&#xA;&#xA;if nargout &amp;gt; 3,&#xA;    [V,Lam] = eig(R);               %  Find eigenvalue decomposition of R&#xA;    dLam = diag(Lam);               %  Specify eigenvalue vector&#xA;    if nargout &amp;gt; 6,&#xA;        kurt = 0;                   %  Initial kurtosis value&#xA;        for i=1:N&#xA;            for k=1:L&#xA;                xv = filter(V(:,i),1,x(:,k));  %  Calculate (k)th eigenvector filtered signal&#xA;                kurt = kurt + mean(xv.^4)/mean(xv.^2)^2 - 3;  %  Estimate kurtosis value&#xA;&#xA;            end&#xA;        end&#xA;        kurt = kurt/(L*N);              %  Average kurtosis value of eigenvector filtered signals&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2063" LastEditorUserId="20995" LastEditDate="2017-08-26T23:41:28.883" LastActivityDate="2017-08-26T23:41:28.883" Title="Maximum step size for adaptive filter convergence" Tags="|adaptive-filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3555" PostTypeId="1" AcceptedAnswerId="3621" CreationDate="2012-10-05T00:32:22.780" Score="5" ViewCount="1446" Body="&lt;p&gt;I'm very new to signal processing, and have been struggling this far. I've a rather messy signal measuring respiration using some chest bands and would like to focus solely on the inspiratory half of the data - ie. set the beginning of each inspiration to zero while maintaining the inspiratory amplitude of each breath.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've attached an example (upslope is inspiration, downslope is expiraion), and have tried various ways of detecting the change in slope indicating the beginning and end of inspiration but keep getting tripped up by small deviations/noise in the signal. Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &lt;strong&gt;&lt;a href=&quot;https://docs.google.com/open?id=0B84oZTKp4RZ3LS1mdTBCLTJRdEU&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.google.com/open?id=0B84oZTKp4RZ3LS1mdTBCLTJRdEU&lt;/a&gt;&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: pictures, hopefully better description:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When everything's going smoothly the it should be recording roughly 10-20breaths per minute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rP43P.jpg&quot; alt=&quot;Clean sample&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when the patient coughs/moves it looks something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ahoGL.jpg&quot; alt=&quot;Messy sample&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I'm mostly interested in the magnitude of each breath, my thinking is that resetting each the start of each breath to zero is an easy (so to speak) way to rid of that upward drift after a cough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the worst cases I lose the respiratory signal all together. This I'd like to discard and pick up any redeemable signal as soon as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XWo7v.jpg&quot; alt=&quot;Messiest sample&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if there's anything else I can provide for an answer!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks muchly.&lt;/p&gt;&#xA;" OwnerUserId="2065" LastEditorUserId="2065" LastEditDate="2015-08-07T05:09:53.450" LastActivityDate="2015-08-07T05:09:53.450" Title="Remove negative slopes from signal" Tags="|peak-detection|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3556" PostTypeId="2" ParentId="2969" CreationDate="2012-10-05T01:30:08.757" Score="3" Body="&lt;p&gt;This would be difficult to do. Convolution with a Gaussian is equivalent to multiplication with a Fourier Transform of the Gaussian in the frequency domain. This happens to be also a Gaussian of in essence this is a low pass filter and a really effective one at that. &#xA;Once you add noise all the information that's in the &quot;stop band&quot; of the Gaussian is destroyed. There is no way to recover that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;De-convolution is essentially multiplying with the inverse of the frequency response. Here is the problem: The inverse of the frequency response gets really, really big where the original Gaussian is very small. At these frequencies you would basically amplify the noise by huge amounts. Even if everything would be completely noise free, you'd most likely run into numerical problems. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-10-05T01:30:08.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3557" PostTypeId="1" AcceptedAnswerId="6198" CreationDate="2012-10-05T09:21:46.003" Score="8" ViewCount="2093" Body="&lt;p&gt;I am looking to understand recommended shapes of &lt;em&gt;structuring elements&lt;/em&gt; used in calculating &lt;em&gt;morphological gradients&lt;/em&gt;. According to &lt;em&gt;&lt;a href=&quot;http://dl.acm.org/citation.cfm?id=773286&quot;&gt;Pierre Soille: Morphological Image Analysis&lt;/a&gt;&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Only &lt;strong&gt;symmetric structuring&lt;/strong&gt; elements &lt;strong&gt;containing their origin&lt;/strong&gt; are considered. By doing so, we make sure that the &lt;em&gt;arithmetic difference is always nonnegative&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;arithmetic difference&lt;/em&gt; mentioned in the quote is referring to three combinations currently used to calculate the discrete gradient:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;arithmetic difference between the dilation and the erosion;&lt;/li&gt;&#xA;&lt;li&gt;arithmetic difference between the dilation and the original image;&lt;/li&gt;&#xA;&lt;li&gt;arithmetic difference between the original image and its erosion.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But, I think &lt;strong&gt;using a SE containing its origin&lt;/strong&gt; is &lt;strong&gt;enough&lt;/strong&gt; (it ensures &lt;em&gt;anti-extensivity&lt;/em&gt; of dilation and &lt;em&gt;extensivity&lt;/em&gt; of erosion). In this case, the following holds and ensures nonnegativity in all three cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\varepsilon_B \leq id \leq \delta_B$ (where $id$ is the identity transform)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I am looking for a reason to enforce the symmetry condition&lt;/strong&gt;. Intuitively, I understand that using a symmetrical SE is better than using a non-symmetrical one (e.g. examining a symmetrical pixel neighborhood). It was also suggested to me that there might be historical reason for this constraint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like specific examples, arguments or references that point to &lt;em&gt;desirable properties&lt;/em&gt; of symmetrical SEs (or undesirable properties of non-symmetrical ones).&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="1273" LastEditDate="2012-10-24T15:20:40.837" LastActivityDate="2013-11-06T10:56:56.360" Title="Shape of structuring elements for morphological gradients" Tags="|image-processing|morphological-operations|gradient|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3558" PostTypeId="1" AcceptedAnswerId="3562" CreationDate="2012-10-05T10:19:21.347" Score="2" ViewCount="630" Body="&lt;p&gt;I am looking for advice on a project I am thinking about completing (for experience etc..)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My project is triggering a set of traffic lights (simulation) using Speech recognition. In theory, I want to use a HMM (Hidden Markov model) to determine whether someone wants to cross the road or not, this can be determined by someone saying &quot;Yes&quot; and then if there is white-noise, or, the Phones &quot;Yes&quot; is not present it can infer that no-one wants to cross and therefore there is no need to trigger the lights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for advice in whether this can be done using an HMM? I have some experience in both of these I just need to know whether it would be a good idea to use an HMM / Viberti algorithm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope someone can help me,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2012-10-05T14:21:22.557" Title="Speech Recognition Project - HMM" Tags="|algorithms|speech-recognition|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3559" PostTypeId="1" CreationDate="2012-10-05T12:53:10.213" Score="2" ViewCount="201" Body="&lt;p&gt;First off, what does orthogonality mean in the context of adjacent channels in a filter bank? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, I am reviewing some code in which the dot product of the transfer functions of adjacent channels are being used to &quot;test orthogonality&quot;. Is this a formal method with a name? How does it work?&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="1024" LastEditDate="2012-10-05T14:07:37.757" LastActivityDate="2012-10-05T15:41:11.083" Title="What does orthogonality mean in the context of adjacent channels in a filter bank?" Tags="|terminology|filter-bank|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3560" PostTypeId="2" ParentId="2969" CreationDate="2012-10-05T13:13:50.140" Score="14" Body="&lt;p&gt;&lt;em&gt;I've explained it once on &lt;a href=&quot;https://stackoverflow.com/questions/11228526/deconvolution-between-matrix-and-submatrix/11229704#11229704&quot;&gt;StackOverflow&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Your signal can be represented as a vector, and convolution is multiplication with an N-diagonal matrix (where N is the length of the filter). &lt;em&gt;I am assuming for the sake of the answer that the filter is much smaller than the signal&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your vector/signal is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;V1&#xA;V2&#xA;...&#xA;Vn&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your filter (convolving element) is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  [b1 b2 b3];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the matrix is nxn: (Let it be called A):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b2 b3 0  0  0  0.... 0]&#xA;[b1 b2 b3 0  0  0.... 0]&#xA;[0  b1 b2 b3 0  0.... 0]&#xA;.....&#xA;[0  0  0  0  0  0...b2 b3]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Convolution is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A*v;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And de-convolution is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A^(-1) * ( A) * v;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, in some cases de-convolution is not possible. These are the cases when you have singular A. Even matrixes that are not singular, but close to being singular, can be problematic, as they will have large numeric error. You can estimate it by computing the &lt;a href=&quot;http://en.wikipedia.org/wiki/Condition_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;condition number&lt;/a&gt; of the matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If A has low condition, you can compute the inverse, and apply it on the result.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, let's see some examples in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I've made a function that computes the convolution matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function A = GetConvolutionMatrix(b,numA)&#xA;    A = zeros(numA,numA);&#xA;    vec = [b  zeros(1,numA-numel(b))];&#xA;    for i=1:size(A,1)&#xA;        A(i,:) = circshift(vec,[1 i]);&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, let's try to see what happens with different kernels:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    b = [1 1 1];&#xA;    A = GetConvolutionMatrix(b,10);&#xA;    disp(cond(A));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The condition number is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 7.8541&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This one is problematic, as expected. After averaging, it is hard to get back the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's try some milder averaging:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = [0.1 0.8 0.1];&#xA;A = GetConvolutionMatrix(b,10);&#xA;disp(cond(A));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.6667&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That goes well with our intuition, mild averaging of original signal is much easier to reverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can also see how the inverse matrix looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; figure;imagesc(inv(A));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c9gM0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is one line from the matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  0.0003   -0.0026    0.0208   -0.1640    1.2910   -0.1640    0.0208   -0.0026    0.0003   -0.0001&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We can see that most of the energy in each line is concentrated in 3-5 coefficients around the center. Therefore, in order to deconvolve, we can simply convolve the signal again with this approximation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   [0.0208   -0.1640    1.2910   -0.1640    0.0208]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This kernel looks interesting! It is a sharpening operator. Our intuition is correct, sharpening cancels out blur.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2019-11-26T10:01:56.390" LastActivityDate="2019-11-26T10:01:56.390" CommentCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="3561" PostTypeId="1" AcceptedAnswerId="3570" CreationDate="2012-10-05T14:14:50.690" Score="4" ViewCount="1257" Body="&lt;p&gt;i want to track random moving object with a camera using kalman filter...i have the following questions...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Randomly moving target means $Corelation(t) = E[ x(T)x(T+t) ]$ is very low...where $x(T)$ is the position of the target at time = $T$ along an axis say $x$ axis..eg...moving hand...moving bird..moving ant..what will be my state transition matrix $F(k)$ in $x(k+1) = F(k)x(k) + w(k)$ because i cannot describe it randomness...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;is there any standard model to represent any random moving target?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any suggestion is welcome....i am aware that any object can be determined in a given image frame using its characteristics by image processing techniques and hence tracked....but is it  possible to use Kalman Filter?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1942" LastActivityDate="2012-10-06T01:09:37.637" Title="Can Kalman Filter be used to track Randomly Moving Target?" Tags="|kalman-filters|statistics|random|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3562" PostTypeId="2" ParentId="3558" CreationDate="2012-10-05T14:21:22.557" Score="4" Body="&lt;p&gt;I learnt to use HTK based on this very basic tutorial&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.info2.uqam.ca/~boukadoum_m/DIC9315/Notes/Markov/HTK_basic_tutorial.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.info2.uqam.ca/~boukadoum_m/DIC9315/Notes/Markov/HTK_basic_tutorial.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It details how to make a yes/no recogniser. It should get you off to a good start at least.  There is also some HTK code on the main HTK site that allows you to perform real time speech recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To improve robustness, you might also consider training the recogniser on speech tokens that are mixed with the kind of noises that you'd expect to hear around your receiver. You could place a recording device near to the traffic light and record a day's worth of background material, then randomly select samples windows to add to your speech corpus at various levels.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-10-05T14:21:22.557" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3563" PostTypeId="2" ParentId="3561" CreationDate="2012-10-05T14:43:02.187" Score="4" Body="&lt;p&gt;You should define a linear $F$ to use Kalman filtering recursions. However, I think, random movements can not be described very well with linear models (an object which is tied to certain and linear physical rules can be tracked by the Kalman filter). Therefore, your state space model will not be linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, your question about $F$ is critical. Because, in many times, the art of Bayesian modeling is to write appropriate models for underlying physical structure. Therefore, if you write a certain motion model, you can use particle filtering (Also for nonlinear models it would not be $Fx$, it will become $f(x)$ where $f$ is a nonlinear function). And, I do not know, you may write a piecewise linear model for a bird or ant, in that case, you can use the Kalman filter but you have to estimate switching variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I suggest you to search about motion models of random movements. Then think about the inference mechanism.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2012-10-05T20:21:27.527" LastActivityDate="2012-10-05T20:21:27.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3564" PostTypeId="2" ParentId="3559" CreationDate="2012-10-05T15:41:11.083" Score="4" Body="&lt;p&gt;The mathematical definition of orthogonality between two vectors is that their dot product is zero.  It just means that there is no correlation between the two- at least at that &quot;phase&quot;.  It is often the case that if you shifted one of the vectors you would get strong correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Infinite vectors of different frequencies are always orthogonal, so in an ideal world the output of adjacent channels in a filter band would always be orthogonal.  There are two ways, though, that the real world is not ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, time limitations can introduce non-orthogonality.  The non-orthogonality is usually trivial if both of the vectors have &quot;many&quot; sinusoidal cycles, but can be substantial if the length is less than a cycle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, non-ideal filters means that attenuated stop-band frequencies get into the filter output, which means that the adjacent channels do have frequencies in common, just at different amplitudes.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-10-05T15:41:11.083" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3565" PostTypeId="1" CreationDate="2012-10-05T18:05:21.513" Score="3" ViewCount="3747" Body="&lt;p&gt;I would like to perform STFT on musical signal with defined sampling rate (&lt;code&gt;44100Hz&lt;/code&gt;).&#xA;I would like to get FFT result for smaller range of frequencies than are maximally available &#xA;(not &lt;code&gt;22050Hz&lt;/code&gt; but for &lt;code&gt;4000Hz&lt;/code&gt;) so the result will have better frequency resolution.&#xA;So I think I should downsample it, but how can you downsample to the frequency&#xA;that is not in integer relation to the input frequency (you cannot leave the kth sample)?&#xA;Do you do some kind of interpolation to get values of new samples? &#xA;How does it affect the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also know I should filter out the frequencies higher than &lt;code&gt;8000Hz&lt;/code&gt; otherwise&#xA;the signal would get aliased. Is there some kind of filter revelant for usage in STFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I know about filters is that to get better (more sharp) filter &#xA;you need more coefficents and so it will take more time to calculate. &#xA;I know there are IIR filters and FIR filters. &#xA;I read IIR filters can be unstable but should I care about it if I use a ready implementation (and I assume it's done right)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it better to filter the whole signal (whole audio file)&#xA;at once? If I get the infite response from the IIR filter and I filter&#xA;the whole signal at once will the energy be most smudged at the end part of the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also read filters can pose some kind of delay on the frequencies and it differs for different frequencies. How do you analyse and compensate this phenomenon?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I found that you can get FIR with linear delay and that now they are used more often than IIR. But there's still a delay, what does it mean? That the frequency events (like musical notes) will occur later in &lt;em&gt;sample number&lt;/em&gt; time? What will be this delay?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit2:&lt;/strong&gt; When I want to downsample to sampling rate of &lt;code&gt;8000Hz&lt;/code&gt; I have to filter so there won't be any frequencies over &lt;code&gt;4000Hz&lt;/code&gt;. Is this practically possible, because I looked at different FIR filters characteristics and they just seem to greatly damp the stopband frequencies not to eliminate them? If I will have just a bit of the high frequencies in the signal, will the signal &lt;em&gt;look ok&lt;/em&gt; when downsampled (aliasing won't be noticeable)?&lt;/p&gt;&#xA;" OwnerUserId="2053" LastEditorUserId="2053" LastEditDate="2012-10-06T16:45:04.583" LastActivityDate="2012-10-06T16:45:04.583" Title="How to filter and downsample before FFT?" Tags="|filters|fft|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="3566" PostTypeId="2" ParentId="3565" CreationDate="2012-10-05T19:50:51.157" Score="5" Body="&lt;p&gt;The process of changing the sampling rate by an arbitrary fraction $\frac{n}{k}$ is called resampling.  It is basically just &lt;a href=&quot;http://en.wikipedia.org/wiki/Interpolation&quot; rel=&quot;noreferrer&quot;&gt;interpolating&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Decimation_%28signal_processing%29&quot; rel=&quot;noreferrer&quot;&gt;decimating&lt;/a&gt; at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you are trying to go from 44100 Hz to 4000 Hz.  If so, that requires a sampling rate change of $\frac{40}{441}$, since $44100 * \frac{40}{441} = 4000$.  As a practical matter you don't want to do really large sample rate changes (like decimating by 441) all at once because it is very difficult to implement filters that can do that.  We thus try to break it down a bit into smaller steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you factor the interpolation rate, 40, we see that it is 2 * 2 * 2 * 5.  We can likewise factor the decimation rate to 3 * 3 * 7 * 7.  One simple way to do the resampling, then, would be to do it in four steps like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$44100 Hz * \frac{2}{3} * \frac{2}{3} * \frac{2}{7} * \frac{5}{7}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are trying to minimize the computational load you could rearrange the order of the resampling to reduce the sample rate as quickly as possible.  That would make the later resampling steps less computationally intensive because they don't have to work on as many samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$44100 Hz * \frac{2}{7} * \frac{2}{3} * \frac{2}{3} * \frac{5}{7}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also combine the two $\frac{2}{3}$ resamples because their product, $\frac{4}{9}$, does not have any large numbers.  That leaves us with the following-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$44100 Hz * \frac{2}{7} * \frac{4}{9} * \frac{5}{7}$&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-10-05T19:59:43.863" LastActivityDate="2012-10-05T19:59:43.863" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3568" PostTypeId="2" ParentId="3565" CreationDate="2012-10-06T00:29:34.903" Score="1" Body="&lt;p&gt;Answering the last edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is only a delay in FIR filters when the data is coming in real-time and you need to process results before sufficient future samples arrive.  For off-line processing, you can always read ahead in the file to get &quot;future&quot; samples, or even filter backwards in time order, so there needn't be any delay.  But you will still have to deal with incomplete (zero or made-up) filter input data at the beginning and end of the file.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-10-06T00:29:34.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3569" PostTypeId="1" AcceptedAnswerId="4782" CreationDate="2012-10-06T00:32:15.127" Score="6" ViewCount="61234" Body="&lt;p&gt;I wanted to generate Gray Scale wedge image of 10 Levels in MATLAB and then increase and decrease its Intensity. By high intensity, I mean mapping increasing the level of gray scale intensity in an image from lower value to higher values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The examples I have tried were performed on a Gray Scale wedge image of 10 levels:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0   28   57   85  113  142  170  198  227  255&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was using the function &lt;code&gt;imadjust&lt;/code&gt;. For increasing the intensity levels I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; imadjust(grayStepImage, [.35 .75], [0.7 0.8])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;179  179  179  179  184  192  199  204  204  204&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the result in image form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fdbAz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for lowering the intensity I used&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imadjust(grayStepImage, [.35 .75], [0.1 0.39])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Original and modified levels are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0   28   57   85  113  142  170  198  227  255&#xA;&#xA;&#xA;26   26   26   26   43   64   84   99   99   99&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the result in image form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uUO4F.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was I actually increasing/lowering intensity of the image? How do those operations relate to the case of increasing and decreasing the contrast of an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I know about contrast is,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Contrast is defined as the separation between the darkest and&#xA;  brightest areas of the image. Increase contrast and you increase the&#xA;  separation between dark and bright, making shadows darker and&#xA;  highlights brighter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does that mean, if I want to increase the contrast of an image I should increase the high intensity levels of an image to much higher and lower intensity level to much lower?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused with contrast and the intensity as they seem opposite to each other.&#xA;Kindly help me out.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1273" LastEditDate="2012-10-25T10:20:35.600" LastActivityDate="2012-11-05T13:43:21.950" Title="Difference between Contrast and Intensity of an Image" Tags="|image-processing|matlab|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3570" PostTypeId="2" ParentId="3561" CreationDate="2012-10-06T01:09:37.637" Score="5" Body="&lt;p&gt;It depends on what you mean by a &quot;randomly moving object&quot;.  If you are trying to track something that truly moves around in a totally uncorrelated manner from sample to sample (like, say, a laser pointer that flickers on and off and randomly changes position in your camera images) then a linear tracker will not give you insight into the object's state.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The examples you cited (a moving hand, bird, etc.) might exhibit random behavior on &quot;large&quot; time scales, but on &quot;small&quot; time scales their state is highly correlated. For such a system the most important point is to have a high data sampling rate relative to the dynamics of the system.  The higher the sampling and measurement update rate, the more linear the underlying system dynamics will be from one measurement time to the next.  Also if you know the object of interest can be randomly changing direction or accelerating you can incorporate this prior knowledge by increasing the process noise during the prediction phase of your Kalman filter, giving less weight to the predicted position during the &quot;update&quot; stage.  &lt;/p&gt;&#xA;" OwnerUserId="1770" LastActivityDate="2012-10-06T01:09:37.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3572" PostTypeId="2" ParentId="3511" CreationDate="2012-10-06T10:11:29.270" Score="9" Body="&lt;p&gt;Your diagram is incorrect. Computing the 2D-FFT of a 8x8 matrix is not the same as computing the 1D-FFT of a 1x64 vector. A 2D-FFT is &quot;probing&quot; your signal with templates which have both an horizontal and vertical frequency. A signal with a low horizontal frequency and a null vertical frequency is a progressive horizontal gradient. A signal whose vertical and horizontal frequency are both the nyquist frequency is a checkerboard pattern...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take an image and perform a 2D-FFT on it, you will find in the resulting matrix the following elements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cell (1, 1): DC component (average of all values in the matrix).&lt;/li&gt;&#xA;&lt;li&gt;Cell (2, 1): first horizontal harmonic; frequency 1/8.&lt;/li&gt;&#xA;&lt;li&gt;Cell (3, 1): second horizontal harmonic; frequency 2/8.&lt;/li&gt;&#xA;&lt;li&gt;Cell (4, 1): third horizontal harmonic; frequency 3/8.&lt;/li&gt;&#xA;&lt;li&gt;Cell (5, 1): fourth horizontal harmonic; frequency 4/8 (Nyquist).&lt;/li&gt;&#xA;&lt;li&gt;Cell (6, 1): third horizontal negative freq. harmonic; frequency -3/8.&lt;/li&gt;&#xA;&lt;li&gt;Cell (7, 1): second horizontal negative freq. harmonic; frequency -2/8.&lt;/li&gt;&#xA;&lt;li&gt;Cell (8, 1): first horizontal negative freq. harmonic; frequency -1/8.&lt;/li&gt;&#xA;&lt;li&gt;Cell (1, 2): first vertical harmonic; frequency 1/8.&lt;/li&gt;&#xA;&lt;li&gt;Cell (1, 3): second vertical harmonic; frequency 2/8.&#xA;...&lt;/li&gt;&#xA;&lt;li&gt;Cell (5, 5): fourth horizontal/vertical harmonic (Checkerboard pattern).&#xA;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A good way to visualize this is to compute the 2D IFFT of a single pixel at each of the 64 positions of the matrix, and look at the real part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KJ9T7.png&quot; alt=&quot;2D-FFT of a 8x8 matrix&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-10-06T10:11:29.270" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3573" PostTypeId="1" CreationDate="2012-10-06T11:26:36.083" Score="8" ViewCount="7859" Body="&lt;p&gt;The only 'authoritative' web reference (=very often linked) for calculating the coefficients for digital biquad filters seems to be this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anywone knows if there is out there any othe good reference or tutorial explaining the role and usage of the parameters Q, BW, dbGain ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: when shoud I use Q instead of BW in specifications ? And what exactly is the meaning of Q? For what I see it's related to the bandwidth of passband filters (in which unit? Hz or normalized frequency?), but maybe I'm wrong. If not, how are they related ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When and how should I specify the dbGain param? If I build a bandpass filter with the above formulas, I get a gain higher than around f0. How to correctly scale the a,b coeffs to obtain a unitary gain ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here some other interesting info about Bandwidth (BW) and Q specifications&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.rane.com/note170.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.rane.com/note170.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT after answers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what I see, one effect of the Q is to raise the selectivity on the center frequency, so a biquad bandpass with a higher Q should be more selective than a biquad with a lower one cutting down heavily the off-center frequency.&#xA;BUT, in the example I have a singal with tho alternating sine wave with frequency 1000 and 3000 hz (FS is 44100):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VruB5.png&quot; alt=&quot;Sines 1 and 3 kHZ&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i filter around the 3000 hz using a bandpass with a Q=2 I get a pretty good signal with little ripples in the bandstop (bandpass biquad coeff: b=[0.0939, 0, -0.0939], a=[1.0, -1.6492,0.8122])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZirIm.png&quot; alt=&quot;Biquad Q = 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I decide to raise the Q up to 20 to lowering the ripples, but all I obtain is this !&#xA;(bandpass biquad coeff: b=[0.0103, 0, -0.0103], a=[1.0, -1.8014, 0.9795])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/naKdl.png&quot; alt=&quot;Biquad Q = 20&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the Q=20 biquad bandpass seems to raise the frequency in the &lt;strong&gt;bandstop&lt;/strong&gt; instead of cut it off and why it spreads even more the center frequency ?&#xA;Why doesn't it make my signal sharper ?&#xA;Is there a way to mitigate these issues ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help !&lt;/p&gt;&#xA;" OwnerUserId="1884" LastEditorUserId="1884" LastEditDate="2012-10-21T08:48:02.123" LastActivityDate="2012-10-21T08:48:02.123" Title="Digital Biquad filters" Tags="|biquad|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3574" PostTypeId="1" CreationDate="2012-10-06T15:02:29.687" Score="5" ViewCount="398" Body="&lt;p&gt;In traditional compressed sensing, one would require &lt;span class=&quot;math-container&quot;&gt;$ m = O ( K.logN)$&lt;/span&gt; measurements to recover a signal of size &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, and sparsity &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The paper, &lt;a href=&quot;https://arxiv.org/abs/0808.3572&quot; rel=&quot;nofollow noreferrer&quot;&gt;Richard Baraniuk - Model Based Compressive Sensing&lt;/a&gt;, shows that it is actually possible to get rid of the &lt;span class=&quot;math-container&quot;&gt;$log N$&lt;/span&gt; factor in the number of sampled measurements, provided the &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;-sparse signals follow some additional characteristics. In traditional CS, in general, a &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;-sparse signal ( or a &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;-compressible one) lives on (or near) one of the canonical &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;-dimensional subspace of the basis of measurement. In &lt;em&gt;model sparse&lt;/em&gt; signals, the additional requirement is that only a subset of these subspaces are allowed. These subspaces are such that they obey some well-formed characteristic. For instance, a &lt;em&gt;Tree-sparse&lt;/em&gt; signal is one for which the top wavelet coefficients are to form a connected and rooted subtree in a wavelet tree decomposition.&lt;/p&gt;&#xA;&lt;p&gt;I have to admit that I am still trying to understand their paper, so it may be a bit naive to ask it, but here is the question.&lt;/p&gt;&#xA;&lt;p&gt;What sort of signals can one represent with these tree-sparse forms?  The above paper gives a few sample signals to that effect. But is there a general characterization of these signals?&#xA;For example, consider a signal comprising of, say &lt;span class=&quot;math-container&quot;&gt;$O(N/d)$&lt;/span&gt; gaussians, with peaks randomly located among the N points ( &lt;span class=&quot;math-container&quot;&gt;$d &amp;lt; N$&lt;/span&gt; is a constant in this case).  Can this be represented/approximated by one of these &lt;em&gt;Tree-sparse&lt;/em&gt; models?&lt;/p&gt;&#xA;&lt;p&gt;Any general pointer to literature that studied these objects?&lt;/p&gt;&#xA;" OwnerUserId="2051" LastEditorUserId="7092" LastEditDate="2021-06-07T01:01:45.987" LastActivityDate="2021-06-07T01:01:45.987" Title="Compressive Sensing: What Class of Signals Are Exactly Model Sparse?" Tags="|compressive-sensing|linear-algebra|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3575" PostTypeId="2" ParentId="3569" CreationDate="2012-10-06T15:15:40.647" Score="2" Body="&lt;p&gt;The value of a pixel is its intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intensity of an image could refer to a global measure of that image, such as mean pixel intensity. A relative measure of image intensity could be how bright (mean pixel intensity) the image appears compared to another image. Intensity of an image could also be how bright the image is compared to how bright the display is capable of producing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would define an image that has high contrast as one where the distribution of the pixel intensities is skewed towards both the low intensity (e.g. 0) and high intensity (e.g. 255) extremes of the intensity range. The imadjust command does this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lena, mean intensity 0.48 - (0,1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qDvrs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lena histogram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BJSil.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lena after imadjust(I,[0.15 0.85],[0 1]), mean intensity 0.48 - (0,1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JEfmk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Histogram after adjust:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4xO2g.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2012-10-06T15:15:40.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3576" PostTypeId="1" AcceptedAnswerId="3602" CreationDate="2012-10-06T17:29:42.807" Score="20" ViewCount="12095" Body="&lt;p&gt;I've been playing around with tomographic reconstruction algorithms recently.  I already have nice working implementations of FBP, ART, a SIRT/SART-like iterative scheme and even using straight linear algebra (slow!).  &lt;em&gt;This question is not about any of those techniques&lt;/em&gt;; answers of the form &quot;why would anyone do it that way, here's some FBP code instead&quot; are not what I'm looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next thing I wanted to do with this programme was &quot;&lt;a href=&quot;http://www.dspguide.com/ch25/5.htm&quot;&gt;complete the set&lt;/a&gt;&quot; and implement the so-called &quot;&lt;strong&gt;Fourier reconstruction method&lt;/strong&gt;&quot;.  My understanding of this is basically that you apply a 1D FFT to the sinogram &quot;exposures&quot;, arrange those as radial &quot;spokes of a wheel&quot; in 2D Fourier space (that this is a useful thing to do follows directly from the central slice theorem), interpolate from those points to a regular grid in that 2D space, and then it should be possible to inverse Fourier-transform to recover the original scan target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds simple, but I haven't had much luck getting any reconstructions which look anything like the original target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Python (numpy/SciPy/Matplotlib) code below is about the most concise expression I could come up with of what I'm trying to do.  When run, it displays the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 1: the target&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zN7UH.png&quot; alt=&quot;fig1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 2: a sinogram of the target&#xA;&lt;img src=&quot;https://i.stack.imgur.com/d82mi.png&quot; alt=&quot;fig2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 3: the FFT-ed sinogram rows&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DA9mo.png&quot; alt=&quot;fig3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 4: the top row is the 2D FFT space interpolated from the Fourier-domain sinogram rows; the bottom row is (for comparison purposes) the direct 2D FFT of the target.  This is the point at which I'm starting to get suspicious; the plots interpolated from the sinogram FFTs look similar to the plots made by directly 2D-FFTing the target... and yet different.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6iT3q.png&quot; alt=&quot;fig4&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 5: the inverse-Fourier transform of Figure 4.  I'd have hoped this would be a bit more recognizable as the target than it actually is.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9MEDm.png&quot; alt=&quot;fig5&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what I'm doing wrong ?  Not sure if my understanding of Fourier method reconstruction is fundamentally flawed, or there's just some bug in my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;import matplotlib&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;&#xA;import scipy.interpolate&#xA;import scipy.fftpack&#xA;import scipy.ndimage.interpolation&#xA;&#xA;S=256  # Size of target, and resolution of Fourier space&#xA;A=359  # Number of sinogram exposures&#xA;&#xA;# Construct a simple test target&#xA;target=np.zeros((S,S))&#xA;target[S/3:2*S/3,S/3:2*S/3]=0.5&#xA;target[120:136,100:116]=1.0&#xA;&#xA;plt.figure()&#xA;plt.title(&quot;Target&quot;)&#xA;plt.imshow(target)&#xA;&#xA;# Project the sinogram&#xA;sinogram=np.array([&#xA;        np.sum(&#xA;            scipy.ndimage.interpolation.rotate(&#xA;                target,a,order=1,reshape=False,mode='constant',cval=0.0&#xA;                )&#xA;            ,axis=1&#xA;            ) for a in xrange(A)&#xA;        ])&#xA;&#xA;plt.figure()&#xA;plt.title(&quot;Sinogram&quot;)&#xA;plt.imshow(sinogram)&#xA;&#xA;# Fourier transform the rows of the sinogram&#xA;sinogram_fft_rows=scipy.fftpack.fftshift(&#xA;    scipy.fftpack.fft(sinogram),&#xA;    axes=1&#xA;    )&#xA;&#xA;plt.figure()&#xA;plt.subplot(121)&#xA;plt.title(&quot;Sinogram rows FFT (real)&quot;)&#xA;plt.imshow(np.real(np.real(sinogram_fft_rows)),vmin=-50,vmax=50)&#xA;plt.subplot(122)&#xA;plt.title(&quot;Sinogram rows FFT (imag)&quot;)&#xA;plt.imshow(np.real(np.imag(sinogram_fft_rows)),vmin=-50,vmax=50)&#xA;&#xA;# Coordinates of sinogram FFT-ed rows' samples in 2D FFT space&#xA;a=(2.0*math.pi/A)*np.arange(A)&#xA;r=np.arange(S)-S/2&#xA;r,a=np.meshgrid(r,a)&#xA;r=r.flatten()&#xA;a=a.flatten()&#xA;srcx=(S/2)+r*np.cos(a)&#xA;srcy=(S/2)+r*np.sin(a)&#xA;&#xA;# Coordinates of regular grid in 2D FFT space&#xA;dstx,dsty=np.meshgrid(np.arange(S),np.arange(S))&#xA;dstx=dstx.flatten()&#xA;dsty=dsty.flatten()&#xA;&#xA;# Let the central slice theorem work its magic!&#xA;# Interpolate the 2D Fourier space grid from the transformed sinogram rows&#xA;fft2_real=scipy.interpolate.griddata(&#xA;    (srcy,srcx),&#xA;    np.real(sinogram_fft_rows).flatten(),&#xA;    (dsty,dstx),&#xA;    method='cubic',&#xA;    fill_value=0.0&#xA;    ).reshape((S,S))&#xA;fft2_imag=scipy.interpolate.griddata(&#xA;    (srcy,srcx),&#xA;    np.imag(sinogram_fft_rows).flatten(),&#xA;    (dsty,dstx),&#xA;    method='cubic',&#xA;    fill_value=0.0&#xA;    ).reshape((S,S))&#xA;&#xA;plt.figure()&#xA;plt.suptitle(&quot;FFT2 space&quot;)&#xA;plt.subplot(221)&#xA;plt.title(&quot;Recon (real)&quot;)&#xA;plt.imshow(fft2_real,vmin=-10,vmax=10)&#xA;plt.subplot(222)&#xA;plt.title(&quot;Recon (imag)&quot;)&#xA;plt.imshow(fft2_imag,vmin=-10,vmax=10)&#xA;&#xA;# Show 2D FFT of target, just for comparison&#xA;expected_fft2=scipy.fftpack.fftshift(scipy.fftpack.fft2(target))&#xA;&#xA;plt.subplot(223)&#xA;plt.title(&quot;Expected (real)&quot;)&#xA;plt.imshow(np.real(expected_fft2),vmin=-10,vmax=10)&#xA;plt.subplot(224)&#xA;plt.title(&quot;Expected (imag)&quot;)&#xA;plt.imshow(np.imag(expected_fft2),vmin=-10,vmax=10)&#xA;&#xA;# Transform from 2D Fourier space back to a reconstruction of the target&#xA;fft2=scipy.fftpack.ifftshift(fft2_real+1.0j*fft2_imag)&#xA;recon=np.real(scipy.fftpack.ifft2(fft2))&#xA;&#xA;plt.figure()&#xA;plt.title(&quot;Reconstruction&quot;)&#xA;plt.imshow(recon,vmin=0.0,vmax=1.0)&#xA;&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1828" LastEditorUserId="1828" LastEditDate="2012-10-06T17:51:23.053" LastActivityDate="2023-05-31T18:35:19.153" Title="What's wrong with this code for tomographic reconstruction by the Fourier method?" Tags="|image-processing|fourier-transform|python|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3577" PostTypeId="2" ParentId="3574" CreationDate="2012-10-06T19:15:31.590" Score="7" Body="&lt;p&gt;In the case of general Compressed Sensing, we assume that we have no prior information about the location of the sparse support of a given signal. If we knew the support exactly, that is, if an oracle told us where the non-zero coefficients are located, we would only need $K$ measurements to recover our signal accurately. Since we do not generally have such a genie, we require more measurements to both determine both the support and the signal values on that support, hence $M$ on the order of $O(K \operatorname{log}N)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors in the Model-Based Compressed Sensing technique make the observation that if an &lt;em&gt;a priori&lt;/em&gt; assumption can be made about the location of signal support, fewer measurements are required (since we know more about the support, statistically, we need to deduce less information from our measurements).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a signal obeys a tree-structured, or hierarchical, model for its support, we have an easy way of predicting the support. This knowledge allows us to lower the number of required measurements for accurate reconstruction. This kind of model is very common since many classes of interesting natural signals can be represented compactly using Wavelets. The multiresolution nature of wavelet analysis groups significant (i.e. non-zero) coefficients into a tree-structure: significant coefficients at one resolution scale are highly correlated with spatially co-located coefficients in neighboring resolution scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hJ1Qk.png&quot; alt=&quot;2D Wavelet Support Correlation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(from: &lt;a href=&quot;http://www.dominikdeak.com/coding/wavelet-compression/figure_17.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dominikdeak.com/coding/wavelet-compression/figure_17.png&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example you give about a mixture of Gaussians, it is not immediately clear that Model-Based CS can be used, since, as you say, the parameters (the peaks) of these Gaussians are randomly distributed within the signal. This kind of signal can be sparsely-represented (pretty much ideally) with some redundant dictionary of Gaussians of different parameters. &#xA;The sparse support when represented within this dictionary would not necessarily obey&#xA;any kind of model, the measurements alone would be needed to determine the support (Gaussian parameters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the topic of Compressed Sensing recovery of Gaussian Mixture Models, I ran a quick google search and came up with the following on arXiv:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://arxiv.org/abs/1101.5785&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yu and Sapiro, &quot;Statistical Compressed Sensing of Gaussian Mixture Models.&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2054" LastActivityDate="2012-10-06T19:15:31.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3578" PostTypeId="2" ParentId="3555" CreationDate="2012-10-07T03:31:06.980" Score="2" Body="&lt;p&gt;I would not do slope detection, I have spend a lot of time solving a similar problem and slope detection didn't work for me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few suggestions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Do a moving average, this would act as a filter and smooth the signal. Especially, your signal is slow, so you can oversample and easily do a moving average. Realize, this will shift your peaks.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you must get the peaks in precision, do a BPF, this would take out all HF noise and DC. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assuming you are measuring lung capacity, seek out the peak and dip points and subtract &#xA;them to find out the magnitude, don't assume a bias and try to calculate from there. It sounds like you have a virtual zero point and your try to see how much the amplitude of the signal. You can divide the result by two to get what you want. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can do BPF and last together and you can get a clean measurement out of it. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2012-10-07T03:31:06.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3579" PostTypeId="2" ParentId="3569" CreationDate="2012-10-07T07:06:13.813" Score="3" Body="&lt;p&gt;Intensity refers to the amount of light. For grayscale images, it's depicted by the grey level value at each pixel (e.g., 127 is darker than 220 and brighter than 055 for 8-bits coded images).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contrast refers to differences between bright and dark parts. If you only look at a neighborhood around a pixel it can be called micro-contrast or local contrast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, any &lt;strong&gt;non-decreasing function&lt;/strong&gt; of true input grey levels is a &lt;strong&gt;valid contrast change&lt;/strong&gt;. For most applications however you can consider tuning the contrast by &lt;strong&gt;multiplying&lt;/strong&gt; the image by some constant (&amp;lt; 1 if you want to lower the contrast, &gt; 1 otherwise) and adjusting the intensity of your image by adding a constant offset.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2012-10-07T07:06:13.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3580" PostTypeId="1" AcceptedAnswerId="3625" CreationDate="2012-10-07T08:47:35.870" Score="15" ViewCount="16514" Body="&lt;p&gt;I'm trying to work out how (if possible) to extract the frequency components of an arbitrary audio sample (typically music) in an FFT-like manner, but in my research on the FFT algorithm, I'm learning that it suffers some severe restrictions for this purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 3 problems which the FFT is presenting:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Because the FFT bin-resolution is equivalent to your window size, to achieve a pretty reasonable accuracy (say 1 Hz), you need an unreasonably long window (say 1 second). This means you can't detect transients or newly introduced frequencies quickly. It also means that the problem can't be solved with a faster CPU and a higher sample-rate -- the restriction is intrinsically tied to time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Humans perceive frequency logarithmically, but FFT bins are spaced linearly. Eg a difference of 20hz at the low end of our hearing is &lt;em&gt;huge&lt;/em&gt;, whereas a difference of 20hz at the high end is imperceptible. So to get the accuracy we require at low frequencies, we have to calculate far more than we require at high frequencies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Some of these problems can be resolved by interpolating between FFT bins. This may work for much musical audio, because frequencies will often be spaced quite far apart and so no more than 1 frequency will leak into a pair of bins. But this will not always be the case, particularly for inharmonic sounds like percussive instruments. So interpolation is really just guesswork.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From what I understand of the DFT/FFT algorithm, the outputs (bin amplitudes) are effectively the correlation of the sine/cosine at each bin's frequency. It strikes me that if the algorithm could be redesigned so that the bin frequencies are spaced non-linearly (i.e. we correlate a different set of sines/cosines), then we could achieve pyschoacoustically-equal resolution at all frequencies. Is this possible, or is it a pipe-dream based on my incomplete understanding of the maths involved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I could also solve the problem with brute-force, by correlating sines/cosines at every single frequency I'm interested in. I'm not too clued up on the maths here. Is this possible? What sort of efficiency? Would it solve my problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a different way to achieve more accurate, real-time, frequency decomposition of a signal? CPU efficiency is a concern, but not the major concern -- I'm partly interested in whether it can theoretically be done at all. However, something that's feasible in realtime on a modern desktop machine would be ideal.&lt;/p&gt;&#xA;" OwnerUserId="2076" LastActivityDate="2012-10-14T21:47:18.243" Title="Most efficient way to extract frequency components of audio signal with near-human accuracy in real time" Tags="|fft|audio|frequency|music|real-time|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3581" PostTypeId="1" AcceptedAnswerId="3583" CreationDate="2012-10-07T09:01:48.737" Score="68" ViewCount="48564" Body="&lt;p&gt;I'd like to mix two or more PCM audio channels (eg recorded samples) digitally in an acoustically-faithful manner, preferably in near-real-time (meaning little or no peek-ahead).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physically &quot;correct&quot; way to do this is summing the samples. However when you add two arbitrary samples, the resulting value could be up to twice the maximum value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your samples are 16-bit values, the result will be up to 65536*2. This results in clipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The naive solution here is to divide by N, where N is the number of channels being mixed. However, this results in each sample being 1/Nth as loud, which is completely unrealistic. In the real world, when two instruments play simultaneously, each instrument does not become half as loud.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From reading around, a common method of mixing is: result = A + B - AB, where A and B are the two normalized samples being mixed, and AB is a term to ensure louder sounds are increasingly &quot;soft-clipped&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this introduces a distortion of the signal. Is this level of distortion acceptable in high-quality audio synthesis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What other methods are there to solve this problem? I'm interested in efficient lesser-quality algorithms as well as less-efficient high-quality algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm asking my question in the context of digital music synthesis, for the purpose of mixing multiple instrument tracks together. The tracks could be synthesised audio, pre-recorded samples, or real-time microphone input.&lt;/p&gt;&#xA;" OwnerUserId="2076" LastEditorUserId="2076" LastEditDate="2012-10-07T18:59:51.577" LastActivityDate="2016-11-23T07:59:05.250" Title="Algorithm(s) to mix audio signals without clipping" Tags="|audio|algorithms|distortion|" AnswerCount="10" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3582" PostTypeId="2" ParentId="3580" CreationDate="2012-10-07T10:09:47.343" Score="5" Body="&lt;p&gt;First, with the classic short-term Fourier transform approach, there are alternative to interpolation - in particular techniques making use of phase information to recover the instantaneous frequency (&lt;a href=&quot;https://dsp.stackexchange.com/questions/3537/can-you-increase-frequency-resolution-of-fft-without-increasing-window-size&quot;&gt;See this question&lt;/a&gt;) which can give you very accurately the position of a spectral peak without an increase of FFT size. The drawback, as you correctly said, is that you are not increasing the ability of the system to discriminate adjacent peaks - but this is already a great improvement compared to using the central frequency of the FFT bin index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your brute force approach... FFT has this resolution limitation (with bins at $\frac{sr}{FFT\_size}$) because it is &quot;probing&quot; the signal with complex exponentials that have a null integral over the analysis window - and these must have a period which is an integer division of the length of the analysis window. If you try to naively use the same approach to &quot;probe&quot; frequencies at other ratios, it won't work because you'll be &quot;probing&quot; your signal with functions that do not contain a complete cycle. If you wanted to make it work, you would have to increase your analysis window to the least common multiple of the periods of all the signals in your brute-force search, and this is precisely what you want to avoid!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is another brute-force approach that works: &quot;probe&quot; your signals with windowed complex exponential (Gabor wavelets). These are characterized by a center frequency, a center time, and a bandwidth (which measures how the wavelet is spread over time or over frequency). You'll have to evaluate many, many, many correlations between your signal and these wavelets at as many time offsets, frequencies, and bandwidths you want. The result will be the same as a very flexible &quot;tiled&quot; STFT in which an optimal window size is selected for each time-range and each frequency-band. Besides the computational cost, the downside is that there is no efficient algorithm, and no causal algorithm (you will need to know as many samples in advance as the longest wavelet in your dictionary). If you want to experiment with these techniques, have a look at &lt;a href=&quot;http://mptk.irisa.fr/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MPTK&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A last class of approaches working quite well for music signals are subspace tracking / high resolution methods. They work the problem from a model estimation angle - &quot;assuming this signal is a sum of $k$ exponentially damped sinusoids, what are the best amplitudes/frequencies giving the least square error?&quot;, and as such the number of samples required to get an accurate estimate is only dependent on the noise level. There are some hurdles to make them work, though:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The number of components $k$ must ideally be known in advance. Order estimation methods like ESTER have been proposed to optimally pick the model order.&lt;/li&gt;&#xA;&lt;li&gt;They perform well in the presence of white noise - this requires the signal to be whitened before analysis; performing the analysis in individual channels of a filter bank helps too.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These are computationally expensive, but they can work online, with short windows if model orders and/or noise are low.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-10-07T10:09:47.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3583" PostTypeId="2" ParentId="3581" CreationDate="2012-10-07T10:46:47.607" Score="25" Body="&lt;p&gt;It's very hard to point you to relevant techniques without knowing any context for your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious answer would be to tell you to adjust the gain of each sample so that clipping rarely occurs. It is not that unrealistic to assume that musicians would play softer in an ensemble than when asked to play solo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The distortion introduced by A + B - AB is just not acceptable. It creates mirror images of A on each side of B's harmonics - equivalent to ring-modulation - which is pretty awful if A and B have a rich spectrum with harmonics which are not at integer ratios. Try it on two square waves at 220 and 400 Hz for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more &quot;natural&quot; clipping function which works on a sample-per-sample basis, is the tanh function - it actually matches the soft-limiting behavior of some analog elements. Beyond that, you can look into classic dynamic compression techniques - if your system can look ahead and see peaks comings in advance this is even better.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-10-07T10:46:47.607" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="3584" PostTypeId="1" CreationDate="2012-10-07T20:50:53.543" Score="7" ViewCount="184" Body="&lt;p&gt;I am specifically thinking about the reconstruction error of L1-minimization from compressed measurements with noise.&#xA;I know a bound from (8) in &lt;a href=&quot;http://www-stat.stanford.edu/~candes/papers/RIP.pdf&quot; rel=&quot;noreferrer&quot;&gt;The restricted isometry property and its implications for compressed sensing&lt;/a&gt;, but I was wondering if there is anything newer and or tighter that I am not aware of. Additionally, I would like to relate $\delta_{2s}$ to the size of e.g. a Gaussian measurement matrix. It seems I can do that from Lemma 3.1 and (3.22) in &lt;a href=&quot;http://www-stat.stanford.edu/~candes/papers/DecodingLP.pdf&quot; rel=&quot;noreferrer&quot;&gt;Decoding by linear programming&lt;/a&gt;, but how tight is (3.22) and can I get closer?&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2012-10-17T09:35:51.943" Title="What is the tightest known bound on the reconstruction error in compressed sensing?" Tags="|compressive-sensing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3585" PostTypeId="2" ParentId="3581" CreationDate="2012-10-08T01:52:00.407" Score="9" Body="&lt;p&gt;the formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{result} = A + B - AB$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;doesn't make any sense, even if you mean something other than $AB = A*B$. One thing you need to think about is that sound varies above and below zero. A better way to think about it is like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{result} = g( A + B )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $g\le 1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most simple approach is to say $g = 0.5$, which is conservative, linear and always works, but may not be as &quot;loud&quot; as you want. A less conservative approach that &quot;usually works&quot; and is &quot;louder&quot;, is $g = 1/\sqrt{2}$. Extensions to more channels with this approach work better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, $g$ can change over time, in which case it's usually the result of a compressor/limiter algorithm. Then you really have a difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{result}[i] = g[i]( A[i] + B[i] )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$g[i]$ is a then a function of previous $A$, $B$, $g$ and $\text{result}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[i] = f( A[i] + B[i], g[i-1] )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: As suggested by hotpaw2, you can delay the input signal but not the gain suppression. This is called a &quot;look-ahead limiter&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastEditorUserId="-1" LastEditDate="2015-08-31T12:47:04.067" LastActivityDate="2015-08-31T12:47:04.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3586" PostTypeId="2" ParentId="3580" CreationDate="2012-10-08T02:12:09.960" Score="2" Body="&lt;p&gt;There are many alternatives, but it depends on what you are doing. Physically, I would argue our ears are more like a parallel filter bank than an FFT, which gives them good time resolution, and a process called &quot;focusing&quot; gives them good frequency resolution. So, in some cases, you could theoretically use a filter bank, but this requires a lot of processing leaves you with a lot of data to process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to view wavelets as a set of particularly efficient and related filters. The problem with wavelets for musical and audio analysis is that they typically only give you 1 octave resolution (although you can do various things about this, I haven't really seen wavelets be particularly useful in audio).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach is to use overlapping FFT windows. You can increase the frequency resolution of the FFT by looking not just at the magnitude information, but the phase information. This allows you to use much shorter windows than you might otherwise use, which results in better performance and better time resolution. Overlapping windows are hard to resynthesize correctly, and making too many assumptions about phase can be hazardous as well. Be that as it may, these sorts of tricks are probably the staple of solving complex time-frequency analysis problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a number of other tools for specific applications as well.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-10-08T02:12:09.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3587" PostTypeId="1" AcceptedAnswerId="3591" CreationDate="2012-10-08T03:14:36.520" Score="4" ViewCount="1344" Body="&lt;p&gt;I'm given a graph of the fourier transform of some function $x(t)$.  The graph is labelled $F(X(\frac{\omega}{\pi}))$ on the y-axis and $\frac{\omega}{\pi}$ on the x-axis.  The graph is plotted only on the interval from 0 to 1 (corresponding to $\omega$ values ranging from 0 to pi).  There are points at  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left(\frac{\omega}{\pi},F(\frac{\omega}{\pi})\right)  = (0.2,1); (0.4,2); (0.6,3); (0.8,3);$ and  $(1,2)$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and is zero everywhere else.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confident that these nonzero points correspond to a linear combination of unit sample delta functions centered at $\omega= \pi/5, 2\pi/5, 3\pi/5, 4\pi/5$, and $\pi$, respectively.  Since the delta functions are purely real valued, I conjecture that the inverse fourier transform of this function should be a linear combination of cosine functions.  Based upon a table of fourier transforms, I surmise that $$x(t)=\frac{1}{\pi}cos\left( \frac{\pi t}{5}\right) + \frac{2}{\pi}cos\left( \frac{2\pi t}{5}\right) + \frac{3}{\pi}cos\left( \frac{3\pi t}{5}\right) + \frac{3}{\pi}cos\left( \frac{4\pi t}{5}\right) + \frac{2}{\pi}cos\left(\pi t\right)$$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I made the appropriate conclusions?&lt;/p&gt;&#xA;" OwnerUserId="1330" LastActivityDate="2012-10-08T13:03:10.087" Title="Interpreting the inverse fourier transform from a graph" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3588" PostTypeId="2" ParentId="3581" CreationDate="2012-10-08T06:12:15.173" Score="5" Body="&lt;p&gt;One way this can be done for non-real-time mixing to use a look-ahead AGC, where the gain of one or both channels is lowered at a hard-to-perceive rate before the sum amplitude exceeds the clipping limit.  The less look-ahead available, either the the AGC gain adjustment will become more audible, or the max gain for for a softer gain adjust ramp will get closer and closer to 0.5 per channel at the limit.  For sound sources with some predictability, one could also use statistics regarding the envelope's behavior over time to adaptively guess a gain limit, but with some probability of failure (which would be an abrupt AGC gain adjustment).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-10-08T17:08:54.803" LastActivityDate="2012-10-08T17:08:54.803" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3589" PostTypeId="2" ParentId="3580" CreationDate="2012-10-08T06:38:04.500" Score="4" Body="&lt;p&gt;Frequency or pitch?  There are already tons of research papers and books on human pitch perception.  But, IIRC, humans tend to be bad at accurately &quot;extracting&quot; frequencies unless they happen to be a pitch fundamental.  And multiple frequency peaks within a &quot;critical band&quot; tend to be perceived as noise.  So any method with &quot;near human accuracy&quot; may also have to include some human perceptive estimation failures as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FFT is just a bank of filters that are not optimal for many purposes unless orthogonality and invertibility are requirements.  Other filter banks are possible if you don't require those two (and human perception clearly does not), such as a MEL frequency filter bank.  Once a frequency peak is identified by a MEL frequency filter bank, further analysis by FFT interpolation or phase vocoder techniques might be useful to refine a frequency estimate of any isolated spectral frequency peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that no further information is actually gathered by any of these filtering techniques used over the same span of time-domain data, compared with an FFT.  What is happening might actually be the loss of information to better match the &quot;inaccuracy&quot; or anomalies of the human hearing system.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And pitch estimation from a set of frequencies is a completely different problem, again a topic with many research papers and chapter in books on audiology and such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last part of your question about performance may be a red herring.  One can do dozens of FFTs and dozens of different filter banks in real-time on a cell phone processor these days.  Given very efficient FFT libraries available from CPU vendors, a FFT with 1000's of &quot;excess&quot; bins may be more efficient than a significantly smaller but more naive-coded filter bank.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-10-08T17:24:58.653" LastActivityDate="2012-10-08T17:24:58.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3590" PostTypeId="1" AcceptedAnswerId="3600" CreationDate="2012-10-08T10:43:56.857" Score="3" ViewCount="3391" Body="&lt;p&gt;I want to use STFT to analyze my signal and am wondering what are differences between two solutions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use short windows (for ex. 256 samples window)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use longer windows (to get higher resolution in freq. domain) but let the windows overlap more (For ex. I use 1024 samples window, but let 1023 samples overlap)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you :)&lt;/p&gt;&#xA;" OwnerUserId="1864" LastActivityDate="2012-10-09T16:08:02.013" Title="length of window and overlap rate in STFT" Tags="|matlab|discrete-signals|fourier-transform|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3591" PostTypeId="2" ParentId="3587" CreationDate="2012-10-08T12:14:20.287" Score="5" Body="&lt;p&gt;If there are no negative frequencies, $x(t)$ would have an imaginary component (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Analytic_signal&lt;/a&gt;), but we can just assume that the graph was truncated for convenience. So I think you have got it right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: previously I wrote in this answer that the coefficients should have been multiples $\frac{1}{2\pi}$ but they are correct if we assume the negative frequencies mirror the positive.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2012-10-08T13:03:10.087" LastActivityDate="2012-10-08T13:03:10.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3592" PostTypeId="2" ParentId="3512" CreationDate="2012-10-08T12:57:04.930" Score="0" Body="&lt;p&gt;You could use some of the blind deconvolution methods. Using blind deconvolution you don't need the PSF. For example, this method &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5226594&amp;amp;tag=1&quot; rel=&quot;nofollow&quot;&gt;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5226594&amp;amp;tag=1&lt;/a&gt; simultaneously deblurs image and finds PSF. Authors also describe the way to include prior knowledge about PSF.&lt;/p&gt;&#xA;" OwnerUserId="2034" LastActivityDate="2012-10-08T12:57:04.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3593" PostTypeId="2" ParentId="160" CreationDate="2012-10-08T12:59:31.373" Score="0" Body="&lt;p&gt;ISOP (Interpolated Second Order Polynomial) are often used for compensation of CIC passband droop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matlab response of this filter can be shown using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alpha = 0.01 ;&#xA;b     = [1, alpha, -alpha] ; &#xA;h     = mfilt.firsrc(1,1,b)&#xA;freqz( b )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Choosing the alpha for your requirements is the tricky part. Worst case preform brute force simulations, looping over 0 to 0.5 in 0.001 increments finding the alpha which&#xA;results in the best droop compensation. Defining best droop compensation as minimal error at the edge of your passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For efficiency this filter is normally placed at the lower data rate, before the CIC for interpolation, and after the CIC for decimation.&lt;/p&gt;&#xA;" OwnerUserId="1603" LastEditorUserId="1603" LastEditDate="2012-10-09T08:13:40.483" LastActivityDate="2012-10-09T08:13:40.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3594" PostTypeId="2" ParentId="3510" CreationDate="2012-10-08T14:27:12.500" Score="0" Body="&lt;p&gt;Have you tried converting the image into a similar vectorized version, I know Flash and Inkscape has those:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://inkscape.org/doc/tracing/tutorial-tracing.html&quot; rel=&quot;nofollow&quot;&gt;http://inkscape.org/doc/tracing/tutorial-tracing.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.google.com/search?q=flash+image+to+vector&quot; rel=&quot;nofollow&quot;&gt;https://www.google.com/search?q=flash+image+to+vector&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="483" LastActivityDate="2012-10-08T14:27:12.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3595" PostTypeId="1" CreationDate="2012-10-04T09:16:02.743" Score="35" ViewCount="26916" Body="&lt;p&gt;I need to find the squares in an image using OpenCV (no problem in matlab or any other, generally what i expect are some ideas).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the test image below :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R6XHD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I need to find those coloured squares in above image accurately&lt;/strong&gt; (not the white long strips).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I have done :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I applied the common method (which comes with OpenCV samples), ie &lt;strong&gt;find contours&lt;/strong&gt; in all color planes, approximate it and check for number of elements=4. It works to some extend that, few squares are detected, especially the dark ones.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Next step i did was &lt;strong&gt;prediction&lt;/strong&gt;. ie &lt;em&gt;this arrangement is fixed&lt;/em&gt;. So, if some are obtained, I can predict remaining ones. It also worked to some further extend. But accuracy was very bad.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But I feel prediction is not a good method here and it doesn't always provide accurate answers as given by the first step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I need :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is there any other better methods to detect these squares more accurately? Or multiple methods? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One important point is that, &lt;strong&gt;time is not a problem here&lt;/strong&gt;. Algorithm can be slow, it doesn't matter. &lt;strong&gt;But accuracy is the major criteria.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes, images can be much more blurry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And one of the major problem I faced is that some squares have almost similar color as that of background (check column 3 first and second squares).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for ideas, thanks in advance &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the maximum accurate result I got :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rk12I.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the result image is resized a little bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE 2 : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have given a much more better solution in my answer below: &lt;a href=&quot;https://dsp.stackexchange.com/a/7526/818&quot;&gt;https://dsp.stackexchange.com/a/7526/818&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="818" OwnerDisplayName="Abid Rahman K" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-07-04T06:54:09.243" Title="Finding squares in Image" Tags="|python|matlab|image-processing|opencv|computer-vision|" AnswerCount="7" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="3596" PostTypeId="2" ParentId="3595" CreationDate="2012-10-04T09:34:48.530" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;this arrangement is fixed&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't really know what kind of prediction you did before, but have you tried to focus on the white long strips as a root. Then (if 3 columns of squares are equal-sized), you can detect the height of a square (distance between the two strips) and you can detect the max and min area (height and width) in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, try to detect the most common colour inside your whole square and set it to a &quot;non-square&quot; area. The rest is supposed to be the squares you are looking for.&lt;/p&gt;&#xA;" OwnerDisplayName="Antonin Duroy" LastActivityDate="2012-10-04T09:34:48.530" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3597" PostTypeId="2" ParentId="3595" CreationDate="2012-10-04T14:26:26.387" Score="10" Body="&lt;p&gt;A first attempt using Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = imread('squares.jpg');&#xA;im2 = rgb2gray(im);&#xA;&#xA;se = strel('disk', 15);&#xA;&#xA;for i = 1:16;&#xA;    t = 60+i*5; % try out a range of bw thresholds to see what works best&#xA;    labelled = bwlabel(im2&amp;gt;t); % label regions in the BW image&#xA;    closed = imclose(labelled, se); % close small regions&#xA;    cleared = imclearborder(~closed,4); % clear regions touching the border&#xA;    subplot(4,4,i); &#xA;    imshow(cleared); &#xA;    title(['T = ' num2str(t)]);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results in the following regions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Mq6tP.png&quot; alt=&quot;labelled regions&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, selecting the threshold that results in the highest number of regions (T=120) would already give 7 correct locations, some merged locations, one false positive and two false negatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was a fairly simple attempt but I think it shows that the approach works. Adding some stuff to break up elongated regions, or doing this for each color channel separately are just a couple of the things you could do to improve on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would also help if you provided a few more test images.&lt;/p&gt;&#xA;" OwnerUserId="2082" OwnerDisplayName="Junuxx" LastActivityDate="2012-10-04T17:00:13.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3598" PostTypeId="1" AcceptedAnswerId="3609" CreationDate="2012-10-08T15:05:10.360" Score="0" ViewCount="2420" Body="&lt;p&gt;Given an input signal $$x(n)=\cos(6\pi n +\frac{\pi}{6})$$ and system $$y(n)=0.5x(n)-0.1x(n-1)$$. In this case, the coefficients of the difference equation are $a_0=1$, $b_0=0.5$, and $b_1=$. The frequency response to this system is $$H(\omega)= b_0 + b_1e^{-j\omega}= 0.5 - 0.1 \cos(\omega)+0.1 j \sin(\omega)$$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the input $x(n)$ is a sinusoid of the form $$x(n)=A \cos(\omega n +\theta_0)$$, we can express the system's output as  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=A|H(\omega_0)|\cos\left(\omega_0 n+\theta_0+angle(H(\omega_0))\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that $A=1$, $\omega_0=6\pi$, and $\theta_0=\frac{\pi}{6}$ in this formula.  Hence, I have deduced that  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(\omega_0)|= |0.5 - 0.1 \cos(6\pi)+0.1j \sin(6\pi)| = 0.4$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, since $H(\omega_0) = 0.4$ (a positive real number), I conjecture that $$angle(H(\omega_0))=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I made the correct assumptions/conclusions?&lt;/p&gt;&#xA;" OwnerUserId="1330" LastEditorUserId="29" LastEditDate="2012-10-09T03:18:44.900" LastActivityDate="2012-10-09T13:35:23.013" Title="Calculating the system output using frequency response" Tags="|fourier-transform|linear-systems|frequency-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3599" PostTypeId="2" ParentId="3518" CreationDate="2012-10-08T15:13:25.167" Score="4" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions&quot; rel=&quot;nofollow&quot;&gt;MSER (Maximally stable extremal regions)&lt;/a&gt; are regions, not points. And they're invariant to affine transformation. But it's not a segmentation method, strictly speaking&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Informally speaking, the idea is to find blobs at various thresholds, then select the blobs that have the least change in shape/area over a range of thresholds. These regions should be stable for a large range of grayscale and geometric transformations.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-10-08T15:13:25.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3600" PostTypeId="2" ParentId="3590" CreationDate="2012-10-08T17:19:36.303" Score="5" Body="&lt;p&gt;In general, shorter windows contain less information, and will thus provide less frequency resolution.  But short windows will be more localized in time, and thus a sequence of short windows might allow greater resolution in locating or separating time domain behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Longer windows will contain more information, but this information will be averaged across the entire window duration, thus potentially smearing out any transients or other non-stationary behavior that might change more rapidly than the window length or duration.  But the greater information content might allow a higher resolution (both for separating peaks and locating or estimating isolated stationary frequency peaks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overlapped windows will provide some partially redundant information, but perhaps better localized data regarding rate of phase change for some types of signals that are stationary across multiple frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added:  Overlapping is also common when a non-rectangular window is used.  Since the windowing process (combined with finite arithmetic) can be quite lossy at the edges, overlapping helps provide some of the information that was thrown away by the windowing.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-10-09T16:08:02.013" LastActivityDate="2012-10-09T16:08:02.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3601" PostTypeId="2" ParentId="3576" CreationDate="2012-10-08T19:02:55.783" Score="3" Body="&lt;p&gt;I don't know exactly where the problem is, but the slice theorem means that these two special cases should be true:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fft2(target)[0] = fft(sinogram[270])&#xA;fft2(target)[:,0] = fft(sinogram[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So follow through your code and try to find the point where these stop being equivalent, working forward from the sinogram and backwards from the generated 2D FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't look right:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In [47]: angle(expected_fft2[127:130,127:130])&#xA;Out[47]: &#xA;array([[-0.07101021,  3.11754929,  0.02299738],&#xA;       [ 3.09818784,  0.        , -3.09818784],&#xA;       [-0.02299738, -3.11754929,  0.07101021]])&#xA;&#xA;In [48]: fft2_ = fft2_real+1.0j*fft2_imag&#xA;&#xA;In [49]: angle(fft2_[127:130,127:130])&#xA;Out[49]: &#xA;array([[ 3.13164353, -3.11056554,  3.11906449],&#xA;       [ 3.11754929,  0.        , -3.11754929],&#xA;       [ 3.11519503,  3.11056604, -2.61816765]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The 2D FFT you're generating is rotated 90 degrees from what it should be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest working with magnitude and phase rather than real and imaginary, so you can see more easily what's happening:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zdce9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The white corners are -inf from doing &lt;code&gt;log(abs(0))&lt;/code&gt;, they're not a problem)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2012-10-08T19:02:55.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3602" PostTypeId="2" ParentId="3576" CreationDate="2012-10-08T21:22:41.173" Score="16" Body="&lt;p&gt;OK I've cracked this finally.&lt;/p&gt;&#xA;&lt;p&gt;The trick basically came down to putting some &lt;code&gt;fftshift&lt;/code&gt;/&lt;code&gt;ifftshift&lt;/code&gt;s in the right place so the 2D Fourier space representation was not wildly oscillatory and doomed to be impossible to interpolate accurately.  At least that's what I &lt;em&gt;think&lt;/em&gt; fixed it.  Most of what limited understanding I do have of Fourier theory is based on the continuous integral formulation, and I always find the discrete domain and FFTs a bit... quirky.&lt;/p&gt;&#xA;&lt;p&gt;While I find Matlab code rather cryptic, I have to credit &lt;a href=&quot;http://code.google.com/p/centralslice/source/browse/trunk&quot; rel=&quot;nofollow noreferrer&quot;&gt;this implementation&lt;/a&gt; for at least giving me the confidence this reconstruction algorithm can be expressed reasonably compactly in this sort of an environment.&lt;/p&gt;&#xA;&lt;p&gt;First I'll show results, then code:&lt;/p&gt;&#xA;&lt;p&gt;Figure 1: a new, more complex target.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8UnAp.png&quot; alt=&quot;Fig1&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 2: the sinogram (OK OK, it's the Radon transform) of the target.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/f3CrP.png&quot; alt=&quot;Fig2&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 3: the FFT-ed rows of the sinogram (plotted with DC at center).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yOvWb.png&quot; alt=&quot;Fig3&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 4: the FFT-ed sinogram transformed to 2D FFT space (DC at center).  Color is a function of absolute value.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gFYpx.png&quot; alt=&quot;Fig4&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 4a: Zoom in on center of 2D FFT space just to show the radial nature of the sinogram data better.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hNEE8.png&quot; alt=&quot;Fig4a&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 5: Top row: the 2D FFT space interpolated from the radially arranged FFT-ed sinogram rows.  Bottom row: the expected appearance from simply 2D FFT-ing the target.&lt;br /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BZdKC.png&quot; alt=&quot;Fig5&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 5a: Zoom in on central region of the subplots in Fig5 to show these look to be in pretty good agreement qualitatively.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ROyj6.png&quot; alt=&quot;Fig5a&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 6: The acid test: inverse 2D FFT of the interpolated FFT space recovers the target.  Lena's still looking pretty good despite everything we've just put her through (probably because there are enough sinogram &amp;quot;spokes&amp;quot; to cover the 2D FFT plane fairly densely; things get interesting if you reduce the number of exposure angles so this is no longer true).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tXuu0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's the code; brings up the plots in less than 15s on Debian/Wheezy's 64bit SciPy on an i7.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;import scipy.fftpack&#xA;import scipy.interpolate&#xA;import scipy.misc&#xA;import scipy.ndimage.interpolation&#xA;import skimage&#xA;&#xA;S = 256  # Size of target, and resolution of Fourier space&#xA;N = 259  # Number of sinogram exposures (odd number avoids redundant direct opposites)&#xA;&#xA;V = 100  # Range on fft plots&#xA;&#xA;&#xA;# Convenience function&#xA;def sqr(x):&#xA;    return x * x&#xA;&#xA;&#xA;# Return the angle of the i-th (of 0-to-N-1) sinogram exposure in radians.&#xA;def angle(i):&#xA;    return (math.pi * i) / N&#xA;&#xA;&#xA;# Prepare a target image&#xA;x, y = np.meshgrid(np.arange(S) - S / 2, np.arange(S) - S / 2)&#xA;mask = sqr(x) + sqr(y) &amp;lt;= sqr(S / 2 - 10)&#xA;target = np.where(&#xA;    mask,&#xA;    skimage.transform.resize(skimage.data.camera(), (S, S), anti_aliasing=True),&#xA;    np.zeros((S, S)),&#xA;)&#xA;&#xA;plt.figure()&#xA;plt.title(&amp;quot;Target&amp;quot;)&#xA;plt.imshow(target)&#xA;plt.gray()&#xA;plt.savefig(&amp;quot;00_target.png&amp;quot;)&#xA;&#xA;# Project the sinogram (ie calculate Radon transform)&#xA;sinogram = np.array(&#xA;    [&#xA;        np.sum(&#xA;            scipy.ndimage.interpolation.rotate(&#xA;                target,&#xA;                np.rad2deg(angle(i)),  # NB rotate takes degrees argument&#xA;                order=3,&#xA;                reshape=False,&#xA;                mode=&amp;quot;constant&amp;quot;,&#xA;                cval=0.0,&#xA;            ),&#xA;            axis=0,&#xA;        )&#xA;        for i in range(N)&#xA;    ]&#xA;)&#xA;&#xA;plt.figure()&#xA;plt.title(&amp;quot;Sinogram&amp;quot;)&#xA;plt.imshow(sinogram)&#xA;plt.jet()&#xA;plt.savefig(&amp;quot;01_sinogram.png&amp;quot;)&#xA;&#xA;# Fourier transform the rows of the sinogram, move the DC component to the row's centre&#xA;sinogram_fft_rows = scipy.fftpack.fftshift(&#xA;    scipy.fftpack.fft(scipy.fftpack.ifftshift(sinogram, axes=1)), axes=1&#xA;)&#xA;&#xA;plt.figure()&#xA;plt.subplot(121)&#xA;plt.title(&amp;quot;Sinogram rows FFT (real)&amp;quot;)&#xA;plt.imshow(np.real(sinogram_fft_rows), vmin=-V, vmax=V)&#xA;&#xA;plt.subplot(122)&#xA;plt.title(&amp;quot;Sinogram rows FFT (imag)&amp;quot;)&#xA;plt.imshow(np.imag(sinogram_fft_rows), vmin=-V, vmax=V)&#xA;plt.savefig(&amp;quot;02_fft_rows.png&amp;quot;)&#xA;&#xA;&#xA;# Coordinates of sinogram FFT-ed rows' samples in 2D FFT space&#xA;a = np.array([angle(i) for i in range(N)])&#xA;r = np.arange(S) - S / 2&#xA;r, a = np.meshgrid(r, a)&#xA;r = r.flatten()&#xA;a = a.flatten()&#xA;srcx = (S / 2) + r * np.cos(a)&#xA;srcy = (S / 2) + r * np.sin(a)&#xA;&#xA;# Coordinates of regular grid in 2D FFT space&#xA;dstx, dsty = np.meshgrid(np.arange(S), np.arange(S))&#xA;dstx = dstx.flatten()&#xA;dsty = dsty.flatten()&#xA;&#xA;plt.figure()&#xA;plt.title(&amp;quot;Sinogram samples in 2D FFT (abs)&amp;quot;)&#xA;plt.scatter(&#xA;    srcx,&#xA;    srcy,&#xA;    c=np.absolute(sinogram_fft_rows.flatten()),&#xA;    marker=&amp;quot;.&amp;quot;,&#xA;    edgecolor=&amp;quot;none&amp;quot;,&#xA;    vmin=-V,&#xA;    vmax=V,&#xA;)&#xA;plt.savefig(&amp;quot;03_fft2d.png&amp;quot;)&#xA;&#xA;# Let the central slice theorem work its magic!&#xA;# Interpolate the 2D Fourier space grid from the transformed sinogram rows&#xA;fft2 = scipy.interpolate.griddata(&#xA;    (srcy, srcx),&#xA;    sinogram_fft_rows.flatten(),&#xA;    (dsty, dstx),&#xA;    method=&amp;quot;cubic&amp;quot;,&#xA;    fill_value=0.0,&#xA;).reshape((S, S))&#xA;&#xA;plt.figure()&#xA;plt.suptitle(&amp;quot;FFT2 space&amp;quot;)&#xA;plt.subplot(221)&#xA;plt.title(&amp;quot;Recon (real)&amp;quot;)&#xA;plt.imshow(np.real(fft2), vmin=-V, vmax=V)&#xA;plt.subplot(222)&#xA;plt.title(&amp;quot;Recon (imag)&amp;quot;)&#xA;plt.imshow(np.imag(fft2), vmin=-V, vmax=V)&#xA;&#xA;# Show 2D FFT of target, just for comparison&#xA;expected_fft2 = scipy.fftpack.fftshift(&#xA;    scipy.fftpack.fft2(scipy.fftpack.ifftshift(target))&#xA;)&#xA;&#xA;plt.subplot(223)&#xA;plt.title(&amp;quot;Expected (real)&amp;quot;)&#xA;plt.imshow(np.real(expected_fft2), vmin=-V, vmax=V)&#xA;plt.subplot(224)&#xA;plt.title(&amp;quot;Expected (imag)&amp;quot;)&#xA;plt.imshow(np.imag(expected_fft2), vmin=-V, vmax=V)&#xA;plt.savefig(&amp;quot;04_expected.png&amp;quot;)&#xA;&#xA;# Transform from 2D Fourier space back to a reconstruction of the target&#xA;recon = np.real(&#xA;    scipy.fftpack.fftshift(scipy.fftpack.ifft2(scipy.fftpack.ifftshift(fft2)))&#xA;)&#xA;&#xA;plt.figure()&#xA;plt.title(&amp;quot;Reconstruction&amp;quot;)&#xA;plt.imshow(recon, vmin=0.0, vmax=1.0)&#xA;plt.gray()&#xA;&#xA;plt.show()&#xA;plt.savefig(&amp;quot;05_reconstruction.png&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update 2013-02-17:&lt;/strong&gt; If you've been interested enough to wade through that lot, some more output from the self-study programme of which it was a part can be found in the form of &lt;a href=&quot;http://timday.bitbucket.org/tomographylab-poster.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this poster&lt;/a&gt;.  The body of code in &lt;a href=&quot;http://bitbucket.org/timday/tomographylab&quot; rel=&quot;nofollow noreferrer&quot;&gt;this repository&lt;/a&gt; may also be of interest (although note the code isn't nearly as streamlined as that above).  I may try and repackage it as an IPython &amp;quot;notebook&amp;quot; at some point.&lt;/p&gt;&#xA;" OwnerUserId="1828" LastEditorUserId="7092" LastEditDate="2023-05-31T18:35:19.153" LastActivityDate="2023-05-31T18:35:19.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3603" PostTypeId="2" ParentId="3581" CreationDate="2012-10-09T03:00:52.287" Score="36" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The physically &quot;correct&quot; way to do this is summing the samples. However when you add two arbitrary samples, the resulting value could be up to twice the maximum value. ... The naive solution here is to divide by N, where N is the number of channels being mixed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's not the &quot;naive&quot; solution, its the &lt;em&gt;only&lt;/em&gt; solution.  That's what every analog and digital mixer does, because it's what the air does, and it's what your brain does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, this appears to be a common misconception, as demonstrated by these other incorrect non-linear &quot;mixing&quot; (distortion) algorithms:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;s&gt;&lt;a href=&quot;http://www.vttoth.com/CMS/index.php/technical-notes/68&quot;&gt;Mixing digital audio&lt;/a&gt;&lt;/s&gt; (the wrong way)&lt;/li&gt;&#xA;&lt;li&gt;&lt;s&gt;&lt;a href=&quot;http://atastypixel.com/blog/how-to-mix-audio-samples-properly-on-ios/comment-page-1/#comment-6310&quot;&gt;A quick-and-dirty audio sample mixing technique to avoid clipping&lt;/a&gt;&lt;/s&gt; (don't do this)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &quot;dividing by N&quot; is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Headroom_%28audio_signal_processing%29&quot;&gt;headroom&lt;/a&gt;; the extra room for peaks that's allocated above the RMS level of the waveform.  The amount of headroom required for a signal is determined by the signal's &lt;a href=&quot;https://en.wikipedia.org/wiki/Crest_factor&quot;&gt;crest factor&lt;/a&gt;.  (Misunderstanding of digital signal levels and headroom is probably partially to blame for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Loudness_war&quot;&gt;Loudness war&lt;/a&gt; and &lt;a href=&quot;http://www.cutestudio.net/data/products/audio/CD_clipping/shame/index.php&quot;&gt;Elephunk&lt;/a&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In analog hardware, the headroom is maybe 20 dB.  In a hardware DSP, fixed-point is often used, with a fixed headroom; &lt;a href=&quot;http://ez.analog.com/message/13379&quot;&gt;AD's SigmaDSP&lt;/a&gt;, for instance, has 24 dB of headroom.  In computer software, the audio processing is usually performed in 32 bit floating point, so the headroom is enormous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, you wouldn't need to divide by N at all, you'd just sum the signals together, because your signals wouldn't be generated at 0 dBFS in the first place.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that most signals are not correlated to each other, anyway, so it's uncommon for all the channels of a mixer to constructively interfere at the same moment.  Yes, mixing 10 identical, in-phase sine waves would increase the peak level by 10 times (20 dB), but mixing 10 non-coherent noise sources will only increase the peak level by 3.2 times (10 dB).  For real signals, the value will be between these extremes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get the mixed signal out of a DAC without clipping, you simply reduce the gain of the mix.  If you want to keep the RMS level of the mix high without hard clipping, you will need to apply some type of &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_range_compression&quot;&gt;compression&lt;/a&gt; to limit the peaks of the waveform, but this is not part of mixing, it's a separate step.  You mix first, with plenty of headroom, and then put it through dynamic range compression later, if desired.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-06-12T15:11:00.773" LastActivityDate="2013-06-12T15:11:00.773" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3604" PostTypeId="2" ParentId="2654" CreationDate="2012-10-09T07:39:23.570" Score="16" Body="&lt;p&gt;For continuous convolution $$[Hf](x) \equiv f(x) * h(x) \equiv \int\mathrm{d}x' h(x-x')f(x')$$&#xA;and continuous cross-correlation $$[Gf](x) \equiv f(x) \star h(x) \equiv \int \mathrm{d}x'h^*(x'-x)f(x')$$&#xA;It's easy to show that the cross-correlation operator $G$ is the adjoint operator of the the convolution operator $H$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the convolution operation is commutative$$f(x) * h(x) = h(x) * f(x),$$ while cross-correlation does not have such a property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\\\\\\\\$&lt;/p&gt;&#xA;" OwnerUserId="1641" LastEditorUserId="2046" LastEditDate="2013-04-26T00:25:12.097" LastActivityDate="2013-04-26T00:25:12.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3605" PostTypeId="2" ParentId="3518" CreationDate="2012-10-09T11:42:38.023" Score="4" Body="&lt;p&gt;I am currently working on CBIR using &lt;em&gt;Component Trees&lt;/em&gt;, which should be a relatively new idea. Some expected advantages of using Component Trees to describe images would be: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Component Tree representation of an image would not depend so much on the deformations (even projective) to the image&lt;/li&gt;&#xA;&lt;li&gt;Examining different levels of the tree would allow comparisons and operations up to a different level of detail&lt;/li&gt;&#xA;&lt;li&gt;Discrimination and description should work better than current techniques on low-textured images.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As I just started with research related to this topic, I have just a vague idea of my goals: represent image with Component Tree and then compare the said Component Trees, either directly of by finding a vectorized representation. I will probably be able to say much more in a few weeks (or months), but for now I can only offer the list of papers recommended to me as an introduction to Component Trees (I did not read them yet):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=5230812&amp;amp;contentType=Journals+%26+Magazines&amp;amp;sortType%3Dasc_p_Sequence%26filter%3DAND%28p_IS_Number%3A5230792%29&quot; rel=&quot;nofollow&quot;&gt;P. Salembier and M.H.F. Wilkinson: &quot;Connected Operators&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.google.fr/url?sa=t&amp;amp;rct=j&amp;amp;q=vilaplana%2C%20marques%2C%20salembier%3A%20binary%20partition%20trees%20for%20object%20detection&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;ved=0CCcQFjAB&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel5%2F83%2F4648460%2F04637886.pdf%3Farnumber%3D4637886&amp;amp;ei=TQt0UID8GrGa0QW0uYGwCw&amp;amp;usg=AFQjCNE4Tv8SqWh7v258KOW8j7PdeY0Q8A&quot; rel=&quot;nofollow&quot;&gt;V. Vilaplana, F. Marques and P. Salembier: &quot;Binary Partition Trees for Object Detection&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.google.fr/url?sa=t&amp;amp;rct=j&amp;amp;q=soille%2C%20najman%3A%20on%20morphological%20hierarchical%20representations%20for%20image%20processing%20and%20spatial%20data%20clustering&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCAQFjAA&amp;amp;url=http%3A%2F%2Fwww.esiee.fr%2F~najmanl%2Fpapers%2Fnajman-soille2010wadgmm.pdf&amp;amp;ei=pgt0UMbHO9CT0QW9voGoAg&amp;amp;usg=AFQjCNH9SrcBhDPlKeqwdrLKeNyj21p6yA&amp;amp;cad=rja&quot; rel=&quot;nofollow&quot;&gt;P. Soille, L. Najman: &quot;On morphological hierarchical representations for image processing and spatial data clustering&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I can maybe update the answer as and if I find something relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if your goal is to, in a way, more accurately match image &lt;em&gt;regions&lt;/em&gt; instead of &lt;em&gt;just points&lt;/em&gt;, because regions might be more discriminative, there was a nice suggestion in &lt;a href=&quot;http://www.google.fr/url?sa=t&amp;amp;rct=j&amp;amp;q=sivic%20zisserman%20video%20google&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCAQFjAA&amp;amp;url=http%3A%2F%2Fweb.cs.swarthmore.edu%2F~turnbull%2Fcs97%2Ff08%2Fpaper%2Fsivic03.pdf&amp;amp;ei=Pwx0UNnXIerb0QWp64DADQ&amp;amp;usg=AFQjCNHtJaXW0h6sGZ340sqhM1Zvh9Gmew&quot; rel=&quot;nofollow&quot;&gt;J. Sivic and A. Zisserman: &quot;Video Google: A Text Retrieval Approach to Object Matching in Videos&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am referring to the section dealing with &lt;em&gt;Spatial Consistency&lt;/em&gt;, where a group of matches between feature points is accepted only if the feature points keep a similar spatial configuration in both images. Thus, matching is not only dependent on the type of feature extracted (DoG, MSER,...) or the descriptor (SIFT), but it also looks at the wider surroundings of a feature point, making it (at least a little) region dependent. &lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2012-10-09T11:42:38.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3606" PostTypeId="1" CreationDate="2012-10-09T12:07:02.467" Score="2" ViewCount="355" Body="&lt;p&gt;I have an image I(x,y): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kz2TT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Red indicates high values and blue low values. Everything in black is drawn onto the image afterwards.&#xA;The black dot (xp,yp) represents a point clicked by an user and the black curve a boundary around the high value region around the user clicked point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I automatically find this boundary?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As can be seen from the picture; I do not want the boundary to propagate through narrow gaps.&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-10-09T12:19:22.597" LastActivityDate="2012-10-09T13:40:37.680" Title="How can I automatically find the boundary of a high intensity region inside an image?" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3607" PostTypeId="1" AcceptedAnswerId="3608" CreationDate="2012-10-09T04:58:22.350" Score="5" ViewCount="5333" Body="&lt;p&gt;I have a situation where i need to extract the top view of a road from the 'skewed' view I get from a cc camera located on some roadside tree. I would like to do this using OpenCV, but since I'm very new to image processing and really don't know what approach to take, please provide me any sort of guidance on how to approach the problem.&lt;/p&gt;&#xA;" OwnerDisplayName="Aryan" LastActivityDate="2012-10-09T12:21:21.017" Title="How to get a top view using open cv?" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3608" PostTypeId="2" ParentId="3607" CreationDate="2012-10-09T07:58:28.560" Score="7" Body="&lt;p&gt;I am not giving you a complete algorithm here, but since I worked on a similar project, I can give you some hints and tips.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, changing an image taken from one perspective to a different one relatively easy only for planar surfaces. E.g., you have an image of a tall building with a road, and since buildings are usually build vertical in the air and roads tend to be flat on the ground, the planes of the building and the road are perpendicular. Now, if you want to get an image where you are looking straight in to the building (e.g. building plane parallel to image plane), you have two options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;either transform the image so that the building plane is the way you want it, and disregard the rest of the image (road plane will not be correctly transformed)&lt;/li&gt;&#xA;&lt;li&gt;in addition to transforming the building plane, calculate and perform a transformation on the image part representing the road plane, and somehow stitch them together.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The transformation that allows you to &quot;change&quot; the perspective is called the &lt;strong&gt;planar perspective transformation&lt;/strong&gt; or &lt;strong&gt;homography&lt;/strong&gt;. A homography represents a (mathematical) connection between two images of a same object taken from different perspective, e.g. allows you to calculate the &lt;em&gt;unknown image coordinates&lt;/em&gt; of a point in space &lt;em&gt;in one of the images&lt;/em&gt; from &lt;em&gt;known image coordinates of the same point&lt;/em&gt; in the &lt;em&gt;image with a different perspective&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be able to calculate a homography, you need to know four pairs of corresponding points. In case of bad camera, you will also have to take care of the camera intrinsic parameters. A very good post on this can be found &lt;a href=&quot;https://dsp.stackexchange.com/questions/2736/step-by-step-camera-pose-estimation-for-visual-tracking-and-planar-markers&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you really want to do it properly, you should understand all the terms I used up until now really well before doing anything else. That said, I have been working on a fairly large project, and some parts required to transform images of a road taken from a moving car in to images taken from the bird's perspective, &lt;strong&gt;which is what you want to do now&lt;/strong&gt;. The project was dealing with various road signalization, traffic signs and road markings. Useful references would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/mastif/index_en.shtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;MASTIF project site&lt;/a&gt; with all information related to the project&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/mastif/publications_en.shtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;publication list for the project&lt;/a&gt; containing all published articles related to the project&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/pubs/palasek11mipro.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Petar Palašek, Petra Bosilj, Siniša Šegvić: &quot;Detecting and recognizing centerlines as parabolic sections of the steerable filter response&quot;&lt;/a&gt; - a paper where I am a coauthor, shows a practical use for what you're trying to achieve, but is also a good source of further references. Has a brief explanation of homography - Section III should be the most interesting.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/pubs/sikiric10mipro.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ivan Sikirić, Karla Brkić, Siniša Šegvić: Recovering a comprehensive road appearance mosaic from video&lt;/a&gt; - a paper detailing how to calculate a rectifying transform used to change the image perspective.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This should give you all the material you need to get what you want to do. Good luck, it took us a while.&lt;/p&gt;&#xA;" OwnerUserId="1273" OwnerDisplayName="penelope" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-10-09T12:21:21.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3609" PostTypeId="2" ParentId="3598" CreationDate="2012-10-09T13:35:23.013" Score="1" Body="&lt;p&gt;Yes, you are correct.  The system input is rather strange, though, since $cos(6\pi n + \frac{\pi}{6})$ is equal to $cos(\frac{\pi}{6})$.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-10-09T13:35:23.013" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3610" PostTypeId="2" ParentId="3606" CreationDate="2012-10-09T13:40:37.680" Score="5" Body="&lt;p&gt;One method that I have had lots of success with, and others have too, is Circular Shortest Path (CSP). &lt;a href=&quot;http://www.google.com.au/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCMQFjAA&amp;amp;url=http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.1.2321&amp;amp;rep=rep1&amp;amp;type=pdf&amp;amp;ei=3CV0UJG3EcK2iwKUvoGgDg&amp;amp;usg=AFQjCNHGUR1fx51mXwj28Bjkb9mrLL3goQ&quot;&gt;Here is one paper&lt;/a&gt;, but there are quite a few more and possibly some code floating around the web. Another technique that are perhaps more popular, and for which code might be more common, are snakes (active contours).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These techniques work by finding a connected path that minimises a certain function. In your case, it would be to find the path that goes through many edge pixels while still remaining somewhat round. The roundness constraint is what keeps the path from going off down the narrow gaps. Snakes are different from CSP in that the boundary is 'grown' out from a seed area; CSP performs a polar transformation about the centre point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possibility is some kind of morphological operator. These can be used to find regions of a particular size. One would convert the image to binary, the apply a morphological opening using a structuring element of a big enough size to fit inside the area of interest, but not anywhere else.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2012-10-09T13:40:37.680" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3611" PostTypeId="2" ParentId="3576" CreationDate="2012-10-09T15:19:04.827" Score="4" Body="&lt;p&gt;I believe that the actual theoretical reason why the first solution did not work comes from the fact that the rotations are done with respect to the centers of the images, inducing an offset of &lt;code&gt;[S/2, S/2]&lt;/code&gt;, which means that each of the rows of your &lt;code&gt;sinogram&lt;/code&gt; is not from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;S&lt;/code&gt;, but rather from &lt;code&gt;-S/2&lt;/code&gt; to &lt;code&gt;S/2&lt;/code&gt;. In your example, the offset is actually &lt;code&gt;offset = np.floor(S/2.)&lt;/code&gt;. Note that this works for &lt;code&gt;S&lt;/code&gt; even or odd, and is equivalent to what you did in your code &lt;code&gt;S/2&lt;/code&gt; (although being more explicit avoids issues, when &lt;code&gt;S&lt;/code&gt; is a &lt;code&gt;float&lt;/code&gt;, for instance). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that the phase delays this shift introduces in the Fourier transform (FT) are at the origin of what you talk about in your second message: the phases are messed up, and one needs to compensate that shift in order to be able to apply the inversion of the Radon transform. One needs to dig more into that theory in order to be sure of what is exactly needed for the inverse to work as expected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compensate that offset, you can either use fftshift as you did (which puts the center of each row at the beginning, and since using DFT actually corresponds to computing the Fourier Transform of a S-periodic signal, you end up with the right stuff), or explicitly compensate this effect in the complex Fourier transform, when computing the &lt;code&gt;sinogram&lt;/code&gt; FT. In practice, instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sinogram_fft_rows=scipy.fftpack.fftshift(&#xA;    scipy.fftpack.fft(&#xA;        scipy.fftpack.ifftshift(&#xA;            sinogram,&#xA;            axes=1&#xA;            )&#xA;        ),&#xA;    axes=1&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you can remove the &lt;code&gt;ifftshift&lt;/code&gt; and multiply each row by a corrective vector:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;offset = np.floor(S/2.)&#xA;sinogram_fft_rows = scipy.fftpack.fftshift(&#xA;    scipy.fftpack.fft(sinogram, axis=1)&#xA;    * (np.exp(1j * 2.* np.pi * np.arange(S) * offset / S)),&#xA;    axes=1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This comes from the Fourier transform properties, when considering a time-shift (check &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Some_discrete_Fourier_transform_pairs&quot; rel=&quot;nofollow&quot;&gt;the FT wikipedia page&lt;/a&gt; for the &quot;shift theorem&quot;, and apply for the shift equal to &lt;code&gt;- offset&lt;/code&gt; - because we put the image back around the center).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, you can apply the same strategy to the reconstruction, and replace the &lt;code&gt;fftshift&lt;/code&gt; by the correction of the phases, in both dimensions, but in the other direction (compensating back):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;recon=np.real(&#xA;    scipy.fftpack.ifft2(&#xA;        scipy.fftpack.ifftshift(fft2)&#xA;        *  np.outer(np.exp(- 1j * 2.* np.pi * np.arange(S) * offset / S),&#xA;                    np.exp(- 1j * 2.* np.pi * np.arange(S) * offset / S))&#xA;        )&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Well, this does not improve your solution, but rather sheds another light on the theoretical aspects of your question. Hope that helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, I am not so fond of using &lt;code&gt;fftshift&lt;/code&gt; because it tends to mess around with the way the &lt;code&gt;fft&lt;/code&gt; is computed. In this case, however, you need to put the center of the FT in the center of the image before the interpolation to get &lt;code&gt;fft2&lt;/code&gt; (or at least be careful when setting &lt;code&gt;r&lt;/code&gt; - so you could make it completely &lt;code&gt;fftshift&lt;/code&gt;-free!), and &lt;code&gt;fftshift&lt;/code&gt; really comes handy there. I however prefer to keep the use of that function for visualisation purposes, and not within the computation &quot;core&quot;. :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jean-Louis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.: have you tried to reconstruct the image without cropping the circle around? that gives a pretty cool blurring effect on the corners, would be nice to have such a feature in programs like Instagram, wouldn't it?&lt;/p&gt;&#xA;" OwnerUserId="1301" LastEditorUserId="1301" LastEditDate="2012-10-09T21:37:08.517" LastActivityDate="2012-10-09T21:37:08.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3612" PostTypeId="2" ParentId="3595" CreationDate="2012-10-09T16:47:06.557" Score="5" Body="&lt;p&gt;Note: This method is going to be really slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generate a mask that looks like the contours of a ideal object. Similar to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t8Xxp.png&quot; alt=&quot;mask of the object&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then slide (position,scale,rotation) the mask over the image and match it with the contour of the real image (perhaps blurred a bit to get softer response) to calculate how similar they are, the (position,scale,rotation) with the highest similarity response should be the (position,scale,rotation) of the real object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method doesn't mind squares blending into the background or even partial occlusions of the object, since it considers the entire object. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have personally used this method successfully to track a mouse snout and whiskers, but I had some presumptions like it was close to the last known position etc. But I think you can bring down the search-space by applying some assumptions like: possible sizes of the object in the camera, how far of from the center it can be or rotation &amp;lt;10degrees etc.&lt;/p&gt;&#xA;" OwnerUserId="905" LastActivityDate="2012-10-09T16:47:06.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3613" PostTypeId="2" ParentId="3573" CreationDate="2012-10-09T17:14:31.237" Score="4" Body="&lt;p&gt;A biquad is simply a two-pole IIR filter, where both the numerator and denominator of the transfer function are quadratic equations.  Thus, you can factor the coefficient equations, and then use any reference regarding a filter's behavior related to pole/zero placements in the Z-plane to determine the behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One tutorial method I recall was a software package where you could drag the poles and zeros around and see a plot of the resulting response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q is a term from classic analog filter design which relates the inverse of bandwidth relative to center frequency.  So, given a known center frequency, the use of Q or bandwidth (depending on your exact interpretation or measurement method) is roughly interchangeable (after reciprocating one of them).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-10-10T05:51:43.120" LastActivityDate="2012-10-10T05:51:43.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3614" PostTypeId="1" AcceptedAnswerId="3616" CreationDate="2012-10-09T18:10:43.737" Score="15" ViewCount="11611" Body="&lt;p&gt;I recently encountered a DSP system which did some internal upsampling via zero padding.  Expecting zero-order-hold, I was surprised to find that a DC signal did not produce a DC output; many harmonics of the internal (lower) sampling frequency were also present in the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leads to my question: &lt;strong&gt;What upsampling techniques are commonly used, and what are their relative merits?&lt;/strong&gt;  Why would I choose zero padding, zero order hold, or first order hold, and what other techniques are available?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some clarifications:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The system is real-time, so the upsampling scheme must be causal.&lt;/li&gt;&#xA;&lt;li&gt;The upsampler is followed by a an anti-aliasing filter that can also be specified.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-10-09T20:34:14.657" LastActivityDate="2012-11-20T19:42:49.537" Title="What are the relative merits of various upsampling schemes?" Tags="|resampling|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3615" PostTypeId="1" AcceptedAnswerId="3624" CreationDate="2012-10-09T18:16:43.793" Score="5" ViewCount="1749" Body="&lt;p&gt;As part of my work I am putting together a simple bursty BPSK communication system.  I want to make the demodulation easy, so I am going to put a synchronization sequence at the beginning of each burst to help the receiver lock onto the frequency, phase, and timing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get good synchronization information and avoid false positives the autocorrelation of the synchronization sequence should be as close to a delta dirac as possible.  There may also be additional constraints, like starting the sequence with all 1's to help the receiver get frequency lock quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does one go about generating such a sequence?  Is there a systematic way of doing it, or do you use common sense and trial and error?&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-10-10T20:38:34.193" Title="Generating good synchronization sequences" Tags="|autocorrelation|signal-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3616" PostTypeId="2" ParentId="3614" CreationDate="2012-10-09T20:13:15.300" Score="17" Body="&lt;p&gt;For the purposes of this answer I will use Matlab's terminology and define &quot;upsampling&quot; as the process of inserting $m-1$ zeros in between the input samples, and &quot;interpolation&quot; as the combined process of upsampling and filtering to remove the $m-1$ aliases ($m$ being the interpolation factor) that upsampling introduces.  For an explanation of how/why upsampling introduces aliases, please see &lt;a href=&quot;https://dsp.stackexchange.com/questions/1775/understanding-multirate-filtering-fundamentals&quot;&gt;this thread&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important to understand that any low-pass filter can be used to get rid of the aliases and thus complete the interpolation.  Some filters have advantages when used in interpolation, though.  I'll discuss the various flavors of interpolation filtering below.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;FIR Filter&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Interpolating FIR filters are efficient because they combine upsampling and alias filtering into one step.  This is most easily seen in an example.  Suppose we have a data sequence $x[n]$ and we want to interpolate it by a factor of two.  The first step is to upsample by a factor of two.  This changes the original data sequence from $x_0, x_1, ... x_N$ to $x_0, 0, x_1, 0, ... x_N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose we have a low-pass FIR filter, $h[n]$, that we will use to remove the alias.  When we convolve the upsampled data sequence with the filter, half the filter taps are stimulated by the non-zero samples, and half the taps are inactive because they correspond to the zero samples.  The half that is stimulated and the half that is inactive flips back and forth as the filter goes through the data.  These two sets of taps are sometimes referred to as the filter phases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This same effect can be achieved implicitly by eliminating the upsampling, and filtering the original data sequence with an interpolating FIR filter.  The interpolating FIR filter produces $m$ outputs for every input sample.  For all $m$ outputs the filter will operate on the same $ceil(K/m)$ input samples (where K is the number of filter taps and &quot;ceil&quot; is the ceiling function).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example will hopefully illustrate how this works.  Suppose that we have a six tap filter and we are interpolating by a factor of two.  The filter taps are [1 -2 4 4 -2 1].  If we literally interpolated and then filtered the samples and filter taps would line up (once there was full overlap) as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;0 : 1\\&#xA;x_2 : -2 \\&#xA;0 : 4 \\&#xA;x_1 : 4 \\&#xA;0 : -2 \\&#xA;x_0 : 1 \\&#xA;$$&#xA;Next sample...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_3 : 1\\&#xA;0 : -2 \\&#xA;x_2 : 4 \\&#xA;0 : 4 \\&#xA;x_1 : -2 \\&#xA;0 : 1 \\&#xA;$$&#xA;Next sample...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;0 : 1\\&#xA;x_3 : -2 \\&#xA;0 : 4 \\&#xA;x_2 : 4 \\&#xA;0 : -2 \\&#xA;x_1 : 1 \\&#xA;$$&#xA;And so on.  The point of the interpolating filter is that it skips actually inserting the zeros and just alternates which set of taps it uses at the moment instead.  Thus, the preceding sequence would now look like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_2 : -2 \\&#xA;x_1 : 4 \\&#xA;x_0 : 1 \\&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_3 : 1 \\&#xA;x_2 : 4 \\&#xA;x_1 : -2 \\&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_3 : -2 \\&#xA;x_2 : 4 \\&#xA;x_1 : 1 \\&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Zero Order Hold&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;A zero-order hold interpolator is one that simply repeats each sample $m-1$ times.  So a factor of two zero-order hold interpolator converts $x_0, x_1, ... x_N$ into $x_0, x_0, x_1, x_1, ... x_N, x_N$.  This method is attractive because it is exceedingly easy, both in terms of coding and computational load, to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with it is that its low-pass filtering is quite poor.  We can see that when we recognize that the zero-hold interpolator is a special case of FIR interpolation.  It corresponds to upsampling followed by an $m$-wide rectangle filter.  The Fourier transform of a rectangle filter is a sinc function, which is a rather shabby low-pass filter.  It's shabbiness can be fixed with a compensating FIR filter, but if you are going to do that you might as well just use a good low-pass filter to begin with.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;First Order Hold&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;First order hold is a step up from the zero-hold interpolator in that it linearly interpolates the upsamples using the two nearest input samples.  So, a factor of two first-order hold interpolator would convert $x_0, x_1, ... x_N$ into $x_0, \frac{x_0+x_1}{2}, x_1, \frac{x_1+x_2}{2}, ... x_N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like the zero-order hold interpolator, the first-order hold interpolator is a special case of FIR interpolation.  It corresponds to upsampling and filtering with a triangle filter.  For factor-of-two interpolation the filter is $[\frac{1}{2} 1 \frac{1}{2}]$, for factor-of-three interpolation the filter is $[\frac{1}{3} \frac{2}{3} 1 \frac{2}{3} \frac{1}{2}]$, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The triangle filter is two rectangle filters convolved together, which corresponds to sinc squared in the frequency domain.  This is a definite step up from the zero-order hold, but is still not great.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;IIR Filter&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I have never used an interpolating IIR filter so I won't say a lot about them.  I assume that the same arguments apply as in regular filtering- IIR filters are more efficient, can be unstable, don't have linear phase, etc.  I do not believe that they can combine the upsampling and filtering steps like a FIR filter can, but I could be wrong about that.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;FFT Interpolation&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I'll throw this one in even though it's not very common (of course, I don't think the zero-hold is common either).  &lt;a href=&quot;https://dsp.stackexchange.com/questions/2962/how-to-resample-audio-using-fft-or-dft&quot;&gt;This thread&lt;/a&gt; discusses FFT resampling, where resampling is both interpolation and decimation.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Higher Order Holds&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Second-order hold interpolators are usually referred to as &quot;quadratic interpolators&quot;.  They are non-linear and thus cannot be implemented as FIR filters, which are linear.  I do not understand the math behind them well, so I won't discuss their performance.  I will say, though, that I believe that they are somewhat common outside of signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Higher order (three or more) methods also exist.  These are referred to as &quot;polynomial regressions&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Cascade Integrator Comb (CIC) Filters&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I forgot to mention &lt;a href=&quot;http://en.wikipedia.org/wiki/Cascaded_integrator-comb_filter&quot; rel=&quot;noreferrer&quot;&gt;CIC Filters&lt;/a&gt;.  CIC filters are used for two reasons: they use only adders/subtracters (not as big a deal now that multiplies are fast and cheap), and they can do really large sample rate changes pretty efficiently.  Their down side is that they are essentially an efficient implementation of a cascaded rectangle filter, so they have all of the disadvantages of rectangle filters as discussed above.  CIC interpolators are pretty much always preceded by a compensating FIR filter that pre-distorts the signal to cancel out the distortion introduced by the CIC.  If the sample rate change is large enough the cost of the pre-distortion filter is worth it.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-11-20T19:42:49.537" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="3617" PostTypeId="1" AcceptedAnswerId="3618" CreationDate="2012-10-09T21:44:20.147" Score="1" ViewCount="2653" Body="&lt;p&gt;I read about method of analyzing audio signals where FFT result is bandpass-filtered and the energy of this band is counted. &#xA;Can you count the momentary energy in frequency domain?&#xA;Does this mean summing magnitude value from all frequency bins (after filtering)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I don't care whether this will yield the value similar to the one counted in time domain but just if this can be of some benefit - reflect the energy present within this band.)&lt;/p&gt;&#xA;" OwnerUserId="2053" LastActivityDate="2012-10-10T09:50:39.490" Title="Can you count signal energy equivalent in frequency domain?" Tags="|filters|fft|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3618" PostTypeId="2" ParentId="3617" CreationDate="2012-10-09T22:19:23.107" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem#Applications&quot; rel=&quot;nofollow&quot;&gt;Parseval's theorem&lt;/a&gt; applied to the signal itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}|x[n]|^2 = \frac{1}{N}\sum_{k=0}^{N-1}|X[k]|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you sum the magnitude squared of the frequency coefficients of the DFT, you get the energy of your time-domain vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want power (i.e. energy per sample), divide both sides by $N$.&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2012-10-10T09:50:39.490" LastActivityDate="2012-10-10T09:50:39.490" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3619" PostTypeId="1" CreationDate="2012-10-10T02:36:41.070" Score="8" ViewCount="327" Body="&lt;p&gt;If you don't have a lot of money to spend but you want to estimate the frequency response of different loudspeaker setups what is the best way to do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I bought a very nice microphone and built a box with foam on the inside. My idea is to place the loudspeaker and the mic in the box and measure the power level at different frequencies by playing a sine tone at those frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is it better to have the microphone and loudspeaker in an open space where the mic is 10 inches away from the loudspeaker?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure neither of the 2 methods above are valid for making such measurements (if so please explain why), but how should I do then? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, should I use sine tones or is it better to use another test signal like an &quot;impulse&quot;, &quot;white&quot; noise or a chirp signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hoping to get some good answers / advice&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="2092" LastActivityDate="2012-10-18T08:12:37.660" Title="Evaluating loudspeakers" Tags="|impulse-response|frequency-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3620" PostTypeId="2" ParentId="3619" CreationDate="2012-10-10T13:22:09.767" Score="7" Body="&lt;p&gt;Not an easy job. A loudspeaker produces a complicated 3 dimensional sound field, which heavily interacts with the environment. Even at a distance of a about 3 feet the reflected energy is significantly bigger than the direct energy at most frequencies. Typical loudspeaker measurements are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;On axis response in an anechoic chamber&lt;/li&gt;&#xA;&lt;li&gt;Full 3D response in an anechoic chamber&lt;/li&gt;&#xA;&lt;li&gt;Radiated power in the far field in a highly reflective environment.&lt;/li&gt;&#xA;&lt;li&gt;Room responses taken in &quot;real world&quot; setups, deriving a perceptually relevant spectral metric and averaging over a large number of environments and placements&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Each of these measurements require specific measurement methods and techniques which are also not trivial. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything you can do with a single microphone in real room will most likely be either useless and misleading. The box is also not a good idea since any box has very strong internal acoustic modes and what you will be measuring will be dominated by these modes regardless of what the loudspeaker is doing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the physical size of the loudspeaker and the size of your measurement space, you may be able to pull off a near field measurement with careful time gating of the impulse response (loosing a lot of low frequency resolution in the process). Getting this right is a lot of work and in my opinion not worth the bother.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-10-10T13:22:09.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3621" PostTypeId="2" ParentId="3555" CreationDate="2012-10-10T13:35:24.973" Score="2" Body="&lt;p&gt;I think using quadrature filters would go well here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply your favourite bandpass filter to the signal. This will be necessary because of the noise that is present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the analytic signal. In matlab this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f_a = hilbert(f);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where $f_a$ is the analytic signal and $f$ is your bandpassed signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate amplitude, $a$, and phase, $p$, of the analytic signal. In matlab this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = abs(f_a);&#xA;p = atan2(imag(f_a),real(f_a));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The phase will give you a good idea where the peaks ($p = 0$) and troughs ($p = \pm\pi$) are. The amplitude will give you a good idea of the magnitude of the breath, and will help identify regions where the signal has been lost (low amplitude).&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2012-10-10T13:35:24.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3622" PostTypeId="2" ParentId="3614" CreationDate="2012-10-10T13:36:38.050" Score="4" Body="&lt;p&gt;Jim's answer covers it quite well. All upsampling methods follow the same basic scheme:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Insert zeros between samples: These results in a periodic repetition of the original spectrum but leaves the spectrum in the original band completely intact&lt;/li&gt;&#xA;&lt;li&gt;Low pass filter to get rid of all the mirror spectra&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The main difference between methods is how the low pass filtering is implemented. The ideal upsampler would be include an ideal low-pass filter but that's impractical. Considering the problem in the frequency domain allows to find the right up-sampling algorithm for your specific requirements: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How much amplitude distortion can I tolerate in the original band? Is that frequency dependent ?&lt;/li&gt;&#xA;&lt;li&gt;Do I care about phase in the original band? If you need to maintain the phase you need a linear phase FIR. If not a minimum phase does a better job at maintaining &quot;causality&quot; and sharp onsets. &lt;/li&gt;&#xA;&lt;li&gt;How much do I need to suppress the mirror images? Basically the mirror images will show up as extra noise in the base band.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;High order non-linear interpolators (spline , hermitian, Lagrange) typically don't work well since the interpolation error  is highly signal dependent and almost impossible to map to specific requirement. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-10-10T13:36:38.050" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3623" PostTypeId="2" ParentId="3614" CreationDate="2012-10-10T15:40:26.193" Score="0" Body="&lt;p&gt;When considering the difference between sample-and-hold (i.e. repetition of sample values) and zero padding, it's helpful to realize (as Jim and Hilmar point out) that sample-and-hold can be interpreted as upsampling by zero padding followed by an FIR filter whose impulse response consists of a rectangular pulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when upsampling from 2 kHz to 64 kHz (a factor of 32), we can implement this by inserting 31 zeros between each pair of 2 kHz sampling, and then filtering by an FIR filter which consists of 32 ones, with all other coefficients zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering the sample-and-hold in this way makes it easy to analyze.  We can get the frequency response of the sample-and-hold operation by taking the Fourier transform of the rectangular window.  As Jim points out, the Fourier transform of a rectangular pulse is a &lt;code&gt;sinc&lt;/code&gt; function with linear phase (since the rectangle is not centered around $\tau=0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that this &lt;code&gt;sinc&lt;/code&gt; function has its nulls at exactly the harmonics of the lower sampling frequency.  In our example application of upsampling from 2048 Hz to 65536 Hz, the frequency response of the sample-and-hold operation has nulls at 2048 Hz, 4096 Hz, etc .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HlwUl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, I conclude that any interpolating filter that totally suppresses the harmonics of the original sampling frequency will look something like &quot;sample and hold&quot;.  Is this right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With respect to the criteria of suppressing these harmonics, the sample-and-hold appears to be optimal.  However, its anti-aliasing abilities are poor, since, aside from the harmonic nulls, its frequency response only falls off like $1/f$ above the old Nyquist rate.&lt;/p&gt;&#xA;" OwnerUserId="64" LastActivityDate="2012-10-10T15:40:26.193" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="3624" PostTypeId="2" ParentId="3615" CreationDate="2012-10-10T17:22:59.817" Score="7" Body="&lt;p&gt;A synchronization sequence generally needs the property that its autocorrelation function resembles an impulse.  There are two possible autocorrelation functions that can be considered. For a (real-valued) sequence $x$ of length $N$, the &lt;em&gt;periodic&lt;/em&gt; autocorrelation function is&#xA;$$R_x[n] = \sum_{k=0}^{N-1}x[k]x[k+n]$$&#xA;where the sequence is assumed to extend periodically so that &#xA;$x[k+n] = x[k+n\bmod N]$.  In this case, one commonly used solution to&#xA;choose $x$ to be a &lt;em&gt;maximal-length&lt;/em&gt; linear binary feedback shift-register&#xA;(LFSR) sequence of&#xA;period $N = 2^m-1$ whose periodic autocorrelation function is&#xA;$$R_x[n] = \begin{cases} N, &amp;amp; n \equiv 0 \bmod N,\\ -1, &amp;amp; n \not\equiv 0 \bmod N,&#xA;\end{cases}$$&#xA;which resembles an impulse train of period $N$ except that the &quot;out-of-phase&quot;&#xA;value of the periodic autocorrelation function is not identically&#xA;zero, but is small (and constant) &#xA;compared to the &quot;in-phase&quot; value of $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other form of autocorrelation function is the &lt;em&gt;aperiodic&lt;/em&gt; autocorrelation &#xA;function which is given by&#xA;$$C_x[n] = \begin{cases}\sum_{k=0}^{N-1-n}x[k]x[k+n], &amp;amp; 0 \leq n &amp;lt; N,\\&#xA;\sum_{k=0}^{N-1+n}x[k-n]x[k], &amp;amp; -N &amp;lt; n &amp;lt; 0,\\&#xA;0, &amp;amp; |n| \geq N.&#xA;\end{cases}$$&#xA;Now, for &lt;em&gt;binary&lt;/em&gt; sequences where $x$ takes on values in $\{+1,-1\}$,&#xA;the value of $C_x[n]$ alternates between even and odd integers as&#xA;$n$ varies from $-(N-1)$ to $(N-1)$, and so a &quot;flat&quot; out-of-phase&#xA;aperiodic autocorrelation function is impossible to achieve. &#xA;The closest we can hope to come is to find sequences for which&#xA;$|C_x[n]| \leq 1$ for $1\leq n &amp;lt; N$.  Sequences with this property&#xA;are called &lt;a href=&quot;http://en.wikipedia.org/wiki/Barker_code&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Barker&lt;/em&gt; sequences&lt;/a&gt;, and the longest known Barker&#xA;sequence is of length $13$.  it is widely believed, though not&#xA;proven, that Barker sequences of longer lengths do not exist,&#xA;and numerical studies show that if such a sequence exists, it&#xA;it must be so long that it will not be be usable in any practical&#xA;scheme as a synchronization preamble.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="64" LastEditDate="2012-10-10T20:38:34.193" LastActivityDate="2012-10-10T20:38:34.193" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3625" PostTypeId="2" ParentId="3580" CreationDate="2012-10-10T21:24:44.497" Score="5" Body="&lt;p&gt;As I commented on a previous post, the time-frequency analysis method known as &quot;short term Fourier transform&quot; $X$ is equivalent to a filter bank, analysing your signal $x$. For a given analysis window $w_n$, of size $N$, the filter at frequency $k/N$ is :&#xA;$$ h_n=w_{−n}e^{j2\pi\frac{nk}{N}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For usual analysis windows (Hann, Hamming, or even rectangle), this correspond to a low-pass filter, with cut-off frequency around $1/N$, which is &quot;shifted&quot; to frequency bin $k$ (thanks to the complex exponential modulation), therefore leading to a band-pass filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, in order to answer directly your concern about reflecting human perception, some people derived the [&quot;constant-Q transform&quot; (CQT)][Brown91]. It relies on the same principle as the FT, in its filter bank interpretation. However, the centers $f_k$ are not linearly spaced as for a &quot;normal&quot; FT, but rather log2-spaced. The scale is then closely related to a Western musical scale: if one chooses $f_{k+1} = 2^{1/12} f_k$, then we obtain 12 frequencies per octave (rings a bell? :-) ), and the bandwidth is set to, say, $\frac{2^{1/12} - 1}{2} f_k$. You can also choose other centers, as best suits your need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find implementations of the CQT here and there, a recent one by Prof. Klapuri, coming with a rather decent inverse can be found &lt;a href=&quot;http://www.elec.qmul.ac.uk/people/anssik/cqt/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. The Audio group at Telecom ParisTech also has an &lt;a href=&quot;http://www.tsi.telecom-paristech.fr/aao/en/2011/06/06/inversible-cqt/&quot; rel=&quot;nofollow noreferrer&quot;&gt;implementation&lt;/a&gt; by Prof. Prado, but I did not try it yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Brown91] J. Brown, &quot;Calculation of a Constant Q Spectral Transform&quot;, Journal of the Acoustical Society of America, 1991, 89, 425-434&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 20121014: some answers and comments to your (bryhoyt's) questions.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Just general ideas on your own comments to the main question:&#xA;You seem to be interested in many applications which are, to me, not quite trivial problems to address. &quot;Timbre modelling&quot; sounds to me more related to speech recognition or the like, for which pitch or frequency resolution or precision is not much of an issue (consider how MFCCs are usually computed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider also how many top researchers (&lt;a href=&quot;http://www.csl.sony.fr/~pachet/&quot; rel=&quot;nofollow noreferrer&quot;&gt;F. Pachet&lt;/a&gt; and &lt;a href=&quot;http://repmus.ircam.fr/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the repmus team at IRCAM, France&lt;/a&gt;, to cite a few) are working on the topic of automatic improvisation and accompaniment: the task is not impossible, but requires expertise in many areas. To summarize, a typical system needs to imitate the human auditory system (at least), implement sound/music/pitch/rhythm perception, know about music theory and take decisions based on the estimations of all the previous steps. The Fourier transform, or any signal representation, is just one (tiny) step towards the end goal - and potentially, in my opinion, the best understood so far. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, there is still the possibility that everyone is looking far beyond what actually happens, and that you may crack it down in a simple, thus elegant solution! Don't forget to publish about it once it's done! :-)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;blockquote&gt;&#xA;  &lt;p&gt;a sample of 0.1s at 44kHz is enough to contain a vast range of frequencies&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This would lead, in the case of FT, to a resolution of the order of $F_s / N = 44100/4410 = 10Hz$, at all the frequency bins of the FT. That's almost 2 semitones at 100Hz! Could be better...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;blockquote&gt;&#xA;  &lt;p&gt;The FFT can't detect this for low and high frequencies, but you say other algorithms can: what's the tradeoff? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Short answer: read my thesis on melody estimation! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To elaborate a bit more: many pitch estimation algorithm go beyond the limitations of the FT, thanks to assumptions on the sounds to process. We expect notes from natural sounds (human voice, oboe, sax, piano...) to be more complex than single sinusoids. Most pitched sounds are more or less harmonic, which means that they can be modelled as sums of sinusoids whose frequency is a multiple of the fundamental frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is therefore useful to take into account these harmonics when estimating the pitch, with methods using detection functions such as spectral sums, spectral products or auto-correlation functions exist. Someone started &lt;a href=&quot;https://dsp.stackexchange.com/questions/3652/fft-pitch-detection-methods-autocorrelation-or-other&quot;&gt;a related topic&lt;/a&gt; recently.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;blockquote&gt;&#xA;  &lt;p&gt;What are the tradeoffs? More specifically, what level of frequency accuracy can I expect for a reasonably short window? (I understand the window size in CQT is variable -- how much so?) Even more specifically, how close will I be able to get to my approx. goal of 0.5% frequency difference with a window of 0.005s?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As previously said, with a window of 0.005s, you can expect something like 200Hz of &quot;frequency leak&quot;. That's really a problem only when you have 2 sinusoids with frequencies that are closer than 200Hz, such that the FT won't be able to show that they are 2 different sinusoids. Well, we are far from your 0.5% (by the way, a semitone is at 6% of the frequency!) and 0.005s is really a bit small for your purpose. However, if you want to provide an estimate every 0.005s, you can still process longer overlapping frames, as usually done in speech/music processing. Is that what you actually want?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the size of the windows, you can refer to [Schoerkhuber2010], with frame lengths equal to:&#xA;$$ &#xA;N_k = \frac{F_s}{f_k (2^{1/B} - 1)}&#xA;$$&#xA;where $B$ is the number of frequency bins per octave that is desired for the CQT. That means very long windows: $B=48$ and $f_k=100Hz$ require about 0.7s long windows. It's nothing to say that we then lose a bit of the temporal resolution... But as mentioned earlier, this is a problem only if we forget the structure of the sound. Additionally, psychoacoustics considers that below 500Hz, humans do not really distinguish the sinusoids so well: even humans are challenged there. Of course, we can hope our computers can do better than us, but here, we face a tough issue!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At last, note that other ways of computing a time-frequency representation of a sound exist, consider for instance gammatone filter-banks. The advantage of the CQT I mentioned previously is that there is software for both the transform and its invert. Personally, I still stick to the STFT, though, for its simplicity and because, so far, I never needed better resolution in low frequencies, even for source separation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Schoerkhuber2010] Schoerkhuber, C. and Klapuri, A., &quot; Constant-Q transform toolbox for music processing,&quot;, 7th Sound and Music Computing Conference, Barcelona, Spain, 2010.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1301" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-10-14T21:47:18.243" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3626" PostTypeId="1" CreationDate="2012-10-10T21:59:02.043" Score="2" ViewCount="212" Body="&lt;p&gt;I'm writing up a manuscript and I use the term spectrogram quite a bit.  I've defined a spectrogram as the magnitude squared of the short time Fourier transform of my signal.  It's an estimator for a time-varying spectrum of a non-stationary process.  I'd like to cite a paper for the origin of the term but I'm not sure what to cite.  Could anyone give me some advice?&lt;/p&gt;&#xA;" OwnerUserId="2007" LastActivityDate="2012-10-11T21:52:14.033" Title="Origin of term spectrogram" Tags="|reference-request|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="3627" PostTypeId="2" ParentId="3626" CreationDate="2012-10-11T00:43:33.997" Score="1" Body="&lt;p&gt;IIRC, etymology of &quot;Spectro&quot; is &quot;of radiant energy&quot;. &quot;Gram&quot; is derived from the Greek word gramma, γράμμα which is a written learning.&lt;/p&gt;&#xA;" OwnerUserId="638" LastActivityDate="2012-10-11T00:43:33.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3628" PostTypeId="1" CreationDate="2012-10-11T07:07:34.117" Score="0" ViewCount="169" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/3607/how-to-get-a-top-view-using-open-cv&quot;&gt;How to get a top view using open cv?&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;I have an image taken from an angle, at a height h from ground. I have all the intrinsic and extrinsic parameters, I need to get birds eye view from the image, How can i approach this ? My first approach was based on wrap perspective mapping but it somehow seems wrong cause i didn't find a way to use any camera parameters there. Correct me if I am wrong. Also the problem is that I need to use only one fixed camera to get a birds eye view.  Thank's in advance :) &lt;/p&gt;&#xA;" OwnerUserId="2097" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-10-11T07:07:34.117" Title="virtually rotating the view with intrinsic and extrinsic parameter known" Tags="|image-processing|opencv|" AnswerCount="0" CommentCount="3" ClosedDate="2012-10-13T17:24:08.213" ContentLicense="CC BY-SA 3.0" />
  <row Id="3629" PostTypeId="2" ParentId="3626" CreationDate="2012-10-11T13:14:31.920" Score="0" Body="&lt;p&gt;In Gabor's &quot;Theory of Communication&quot; (1947) these time-frequency plots are called &quot;information diagrams&quot; or &quot;time/frequency diagrams&quot;. &quot;Spectrogram&quot; is another name for the diagram, not necessarily the signal; the wikipedia article says it is a &quot;representation&quot;. Maybe time-varying spectrum would be a better term for the actual signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, it would be better to reference the origin of the concept, rather than the origin of the word.  The aforementioned paper may be a good one to start with. e.g. see Figure 1.6.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2012-10-11T13:14:31.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3631" PostTypeId="1" CreationDate="2012-10-11T19:27:42.423" Score="4" ViewCount="188" Body="&lt;p&gt;I'm learning DSP with &lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;Smith's book&lt;/a&gt;, but I discovered the second edition is from 1999, is this book still usable today?&lt;/p&gt;&#xA;" OwnerUserId="1428" LastActivityDate="2012-10-12T12:00:06.140" Title="Is Smith's book still usable and up-to-date?" Tags="|reference-request|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3632" PostTypeId="2" ParentId="3631" CreationDate="2012-10-11T20:04:09.753" Score="2" Body="&lt;p&gt;Hmm, I have it at home as well, but I put it down and got Richard Lyons' book instead. Richard Lyons' book is, hands down, ̶o̶n̶e̶ ̶o̶f̶  the best DSP books I have ever seen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Smiths' book is still ok in my book, no pun intended. In a field as wide as this, diversity is key, hearing the same content be talked about by different authors really helps build a more solid understanding of it. Some new nuggets are also presented, but you also get the authors' unique experience leak through, which is valuable in and of itself. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-10-11T20:04:09.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3633" PostTypeId="1" CreationDate="2012-10-11T20:07:25.637" Score="3" ViewCount="369" Body="&lt;p&gt;In what sense does empirical mode decomposition (EMD) bring out the sparsity in a signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if I had a signal $f$ and I broke it down into $n$ intrinsic mode functions (IMF), what should I do to get a representation that has very few nonzero components? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally when speaking of sparsity, we say that a signal is sparse in some basis. Since IMFs do not have a fixed basis, in what sense can they be (if at all) sparse?&lt;/p&gt;&#xA;" OwnerUserId="2100" LastEditorUserId="128" LastEditDate="2023-06-24T09:16:40.873" LastActivityDate="2023-06-24T09:16:40.873" Title="Empirical Mode Decomposition and Sparsity" Tags="|signal-analysis|decomposition|empirical-mode-decomposition|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="3634" PostTypeId="2" ParentId="3626" CreationDate="2012-10-11T21:52:14.033" Score="0" Body="&lt;p&gt;As many mentionned before, the term &quot;Spectogram&quot; refers to a representation of some data, with a similar etymology as the word &quot;diagram&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;squared magnitude of the Fourier transform of a signal&lt;/em&gt;, short term or not, would be called a &quot;Power Spectrum&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, the power spectrum is defined as the Fourier transform of a signal multiplied by the complex conjugate of that Fourier transform.&#xA;$$P(k)=F(x)\cdot F(x)^*=Re(F(x))^2+Im(F(x))^2$$ Where $P(k)$ is the power spectrum of your signal, with respect to the wavenumber $k$, and $F(x)$ denotes the Fourier transform of your signal ($x$ being your signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is purely symmetric, then there will be no imaginary part and the power spectrum would be equivalent to the squared magnitude of the Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then refer to your figures as &quot;diagrams of the Power Spectrum&quot;, or do like me and refer to them as &quot;Figure 1.5&quot;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that some variations exist in different fields, as Wikipedia defines my mathematical construct as the &quot;Energy Spectral Density&quot; (&lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_density&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Spectral_density&lt;/a&gt;)&#xA;In a field where you work with actual physical density (mass/volume), we try to avoid using that word for anything else...&lt;/p&gt;&#xA;" OwnerUserId="2030" LastActivityDate="2012-10-11T21:52:14.033" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3635" PostTypeId="1" AcceptedAnswerId="3637" CreationDate="2012-10-12T02:13:25.567" Score="4" ViewCount="5744" Body="&lt;p&gt;So I have an array of say 25 samples and I would want to be able to note the trends of whether it's decreasing n or increasing from those 25 sample time interval(basically 25 samples array is my buffer that is being filled by every say 1 ms). Note that it is general trend that I am looking for, not the individual derivative(as I would have obtained using finite difference or other numerical differentiation techniques). Basically I expect my data to be noisy so there might be ups and downs even after doing filtering and so on. But it's the general trend of increasing or decreasing behaviour that I am looking for. I want to integrate the increasing/decreasing behaviour in every ms to trigger some event which is more of a user interface event (blinking a LED) so it does not have to very delay of processing as long as I can detect the general trend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="2102" LastEditorUserId="2054" LastEditDate="2012-10-13T20:04:57.427" LastActivityDate="2012-10-13T20:04:57.427" Title="Computing the derivative from a set of real-time data?" Tags="|discrete-signals|real-time|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3636" PostTypeId="2" ParentId="3631" CreationDate="2012-10-12T03:46:14.883" Score="3" Body="&lt;p&gt;Do you think that there are a lot of new things have been introduced in the last 10 years? :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like this book. Book is quite accurate and quite pragmatic.  I think this book is a great introduction to DSP. But feel free  to use another books, especially if you want to known about the modern hardware equipment.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2012-10-12T03:46:14.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3637" PostTypeId="2" ParentId="3635" CreationDate="2012-10-12T04:24:27.177" Score="5" Body="&lt;p&gt;Depending on the level of noise you expect to encounter on your signal, you might actually be able to use the finite differencing you suggest, originally. If you want to know the general trend of your data upward or downward, sum together the, in your case, 24, differences. So, lets say that you have some metric, $D$, for your signal. Lets say that for a given signal, $x[n]$, the first order difference is denoted as $x\prime[n]$ (and is, of course, one entry shorter than $x[n]$). Define $D$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ D = \sum_{n=0}^{N-2} x\prime[n] .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, classify your signal as uptrending or downtrending via&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ D &amp;gt; 0 ~\therefore~\uparrow$$&#xA;$$ D &amp;lt; 0 ~\therefore~\downarrow$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made some basic assumptions about the nature of the signals in question. I just did the most basic analysis and thought, well, maybe just use a ramp, $r[n]$, corrupted by some noise, $z[n] \sim \mathcal{N}(0,\sigma^2)$. This may or may not be the situation you're looking at, so you'll need to adjust accordingly and see what works for you. But my final model was just the simple&#xA;$$x[n] = r[n] + z[n]$$ &#xA;for the length you gave, $N = 25$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went ahead and ran some experiments in MATLAB. I used the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;experiments = 1000;&#xA;N = 25;&#xA;&#xA;slope_min = -2;&#xA;slope_max = 2;&#xA;slope_range = slope_max - slope_min;&#xA;noise_level = 2;&#xA;&#xA;&#xA;for i=1:experiments&#xA;&#xA;    slope(i) = slope_range*rand(1)+slope_min;&#xA;    r = slope(i)*(1:N);&#xA;    z = noise_level.*randn(1,N);&#xA;&#xA;    x = r + z;&#xA;&#xA;    diffsum(i) = sum(diff(x));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First, let me show what some of the signals look like...&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DAucn.png&quot; alt=&quot;Upward Trending Signal&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uSyjO.png&quot; alt=&quot;Downward Trending Signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I varied the variance of the noise signal, $z[n]$ and recorded the following correlations between the true slope (up or down trend) of $r[n]$ in comparison with the metric we defined above, $D$. If $D$ does a good job determining the trend of the signal, we should see a strong correlation between downtrends (negative slopes) and negative $D$ and uptrends (positive slopes) and positive $D$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gwm6m.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mQXN1.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FCodT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see from the above that $D$ does seem to do a decent job. As the noise level increases (or the signal moves further away from our model), the correlations are not as strong. Try it out on your signals, see if does anything for you.        &lt;/p&gt;&#xA;" OwnerUserId="2054" LastEditorUserId="2054" LastEditDate="2012-10-12T14:25:42.420" LastActivityDate="2012-10-12T14:25:42.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3638" PostTypeId="2" ParentId="3635" CreationDate="2012-10-12T06:31:10.467" Score="0" Body="&lt;p&gt;Just adding to what Eric said, the same can be done in Python with &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.detrend.html&quot; rel=&quot;nofollow&quot;&gt;scipy.signal.detrend&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2100" LastEditorUserId="29" LastEditDate="2012-10-12T15:30:19.180" LastActivityDate="2012-10-12T15:30:19.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3641" PostTypeId="2" ParentId="3631" CreationDate="2012-10-12T12:00:06.140" Score="2" Body="&lt;p&gt;Smith's book is geared more towards practicioners than academics.  So the emphasis is more on the ideas of DSP than on the sometimes abstract and arcane mathematics that DSP requires.  For this reason I found Smith's book to be a much better learning aid than the more formal textbooks.  For the basic principles of DSP not all that much has changed in the past decade or so so 1999 is not out of date.  &lt;/p&gt;&#xA;" OwnerUserId="1770" LastActivityDate="2012-10-12T12:00:06.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3642" PostTypeId="2" ParentId="3635" CreationDate="2012-10-12T16:32:11.103" Score="0" Body="&lt;p&gt;If you need to smooth it, convoluting with the derivative of a gaussian is a standard approach if your data is noisy. This is effectively equivalent to using gaussian smoothing then applying the finite difference method suggested. The reason it is nice to know about this equivalence is because one may have developed a good intuition for whether, and how much, guassian smoothing is appropriate for a signal, and that then carries over to finding a derivative of that signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What will work depends a lot on your data set. In image processing slightly smoothed derivatives are often used, but for HOG filters on 200ish pixel wide images finite differences work better for person detection than smoothed derivatives. &lt;/p&gt;&#xA;" OwnerUserId="566" LastActivityDate="2012-10-12T16:32:11.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3643" PostTypeId="1" CreationDate="2012-10-12T15:07:56.163" Score="15" ViewCount="5226" Body="&lt;p&gt;Hi CV/Pattern Recognition Community,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a serious problem regarding the segmentation of an image.&#xA;The scenario is an atmosphere within a furnace which makes my head go insane.&#xA;And I need to detect object contours of different materials (glass, ceramics, Al, Ir,..) in a short period of time (&amp;lt;10 seconds) and not just for one special case.&#xA;I also need the contour in a sequential row of pixels for the code. Therefore a chain code or so called border/contour following is also needed, so open holes aren't good.&#xA;In the background are non linear noises, approximately of dust, particles or somewhat else, that are appearing from time to time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab or OpenCV suggestions are welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it more clear, I've posted another image of my goal and a half-transparent object, which needs also to be detected. Also further examples which need to be aware of.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/HgmGr.png&quot; alt=&quot;example1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7zIQm.jpg&quot; alt=&quot;example2&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/r2Ou7.png&quot; alt=&quot;example3&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cKjoI.png&quot; alt=&quot;example4&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in the Image #1, there are particles in the right part of the image and nearby the outer contour of the star, which is the object.&#xA;Also the overall contrast is not very good.&#xA;The object itself stands on an underground, which is not relevant for the contour detection.&#xA;The image #2 shows a halftransparent object, which is also possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find contour/perimeter of that object, like on the next screen (red line).&#xA;The two rectangles (yellow) are marking the starting (left) and the ending point (right).&#xA;The blue line is ignorable.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DH7uk.png&quot; alt=&quot;example2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I thought that I could solve the problem of that filthy atmosphere with just filters. But after a honourable ammount of investing time, I just realized, that I have to elimate or reduce the noises significantly in order to increase contrast of foreground and background.&#xA;I'd tried a lot of methods, like histogram equalization, Otsu-adaptive equalization, linear filters (e.g. gauss), nonlinear filters (median, diffusion), Active Contours, k-Means, Fuzzy-c-means and also Canny for pure Edge Detection in combination with morphological operators.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Canny: The particles and the atmosphere are causing holes, but I need a complete contour of the object. Still with closing, dilatating of morphological operators it is not well enough. Canny has still the best results of all methods I've studied because of hysteresis.&lt;/li&gt;&#xA;&lt;li&gt;Active Contours: They work on edges/gradients as well,&#xA;they act completely crazy after initializing inside the object, which maybe is caused by the edge map resulting the 'open' object. As far as I know the contour has to be closed.&#xA;Tried it with different derivates (GVF/VFC/Classic Snake).&lt;/li&gt;&#xA;&lt;li&gt;k-Means: Results include the furnace atmosphere, because of foggy background. Same for fuzzy-c-means. I chose two clusters, because of separating the object from the background. More clusters lead to weaker results.&lt;/li&gt;&#xA;&lt;li&gt;Histogram/Otsu: Because of the very close gray intensities (imho!), it's merging the object with the background. Tried it with local and global methods.&lt;/li&gt;&#xA;&lt;li&gt;Filters: Especially GLPF or other LPF are smearing the edges, which is not so good and doesn't even reduce the foggy atmosphere. &lt;/li&gt;&#xA;&lt;li&gt;Non-Linear Filters are preserving the edges. Most of them take too long for&#xA;calculating the large images. Took a fast bilateral filter for now. Results see below.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Therefore not a single method is good enough for post-processing steps, because the gained results of the object segment are poor competed to an existing algorithm.&#xA;That existing algorithm is very local and therefore it works for this very special scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am asking you, if I have missed something completely... &#xA;I have no further idea how to process and how I should get good contour results, without having gaps or holes..&#xA;Is it possible without making a lot of changes on the CCD and the physical environment?&#xA;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Last Approach so far (after a long night of experiments with MOs):&lt;/h1&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bilateral Filter (edge preserving, but smoothing homogenous areas)&lt;/li&gt;&#xA;&lt;li&gt;Canny (Sigma = 2, Threshold = [0.04 0.08])&lt;/li&gt;&#xA;&lt;li&gt;Morphological Operations (MO): &lt;code&gt;bwareopen&lt;/code&gt;,&lt;code&gt;closing&lt;/code&gt;,&lt;code&gt;remove&lt;/code&gt; &amp;amp; &lt;code&gt;bridge&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;bwlabel&lt;/code&gt; for selecting only the perimeter of the contour, which removes unwanted noises. no updated screenshots yet, but it works for the star. the glass gots an inner-contour which is connected to the outter contour, which can also be seen on the screenshot below.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I'm afraid that I need a special algorithm for the traversal of the outter contour. &#xA;It will be some clockwise/counterclockwise lookup of neighbourhood. That clockwise/counterclockwise step can switch, if there is a corner point.&#xA;if there is a gap, increase the radius and look again.&#xA;if there are two or more possible following points, take the one who got the same direction as the previous. &#xA;Do you think, that contour following algorithm makes sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z5YIr.png&quot; alt=&quot;Edges of Glass&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gykos.png&quot; alt=&quot;Star&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1923" OwnerDisplayName="mchlfchr" LastEditorUserId="1923" LastEditDate="2012-10-27T13:13:04.743" LastActivityDate="2013-09-30T11:57:58.023" Title="Image segmentation issue of different materials" Tags="|matlab|opencv|computer-vision|edge-detection|image-segmentation|" AnswerCount="6" CommentCount="7" CommunityOwnedDate="2012-10-27T13:04:28.000" ContentLicense="CC BY-SA 3.0" />
  <row Id="3644" PostTypeId="2" ParentId="3643" CreationDate="2012-10-12T15:12:09.777" Score="0" Body="&lt;p&gt;You clearly know what you're about but you haven't mentioned using thresholding, in particular have you tried applying a global threshold using Otsu to calculate the right level, then finding contours and selecting the largest ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Edit to clarify]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Global threshold obviously won't work due to the visible graident across the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a quick play with this and find that if you break the image into 6 chunks (2 rows of 3 columns equal sized) , then perform thresholding using Otsu on each one and then reassemble, it does a pretty god job at cleaning up the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are still some minor artifacts on the upper right portion of the star. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It occurs to me that since the object has straight line boundaries, you might want to consider a Hough transform to extract these edges, intersect them to locate vertices and use the result as your object contour.&lt;/p&gt;&#xA;" OwnerDisplayName="Dave Durbin" LastEditorUserId="-1" LastEditDate="2012-10-13T13:17:56.200" LastActivityDate="2012-10-13T13:17:56.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3645" PostTypeId="2" ParentId="3643" CreationDate="2012-10-12T15:32:21.963" Score="3" Body="&lt;p&gt;You can try the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Efficient Graph-Based Image Segmentation:&#xA;&lt;a href=&quot;http://www.cs.brown.edu/~pff/segment/&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.brown.edu/~pff/segment/&lt;/a&gt; (code available)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;GraphCut-based Segmentation:&#xA;&lt;a href=&quot;http://www.csd.uwo.ca/~olga/OldCode.html&quot; rel=&quot;nofollow&quot;&gt;http://www.csd.uwo.ca/~olga/OldCode.html&lt;/a&gt; (code available)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Denoise the image first using sparse methods:&#xA;&lt;a href=&quot;http://spams-devel.gforge.inria.fr/&quot; rel=&quot;nofollow&quot;&gt;http://spams-devel.gforge.inria.fr/&lt;/a&gt; (code available)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="593" OwnerDisplayName="oli" LastActivityDate="2012-10-12T15:32:21.963" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3646" PostTypeId="2" ParentId="3635" CreationDate="2012-10-12T17:30:31.483" Score="5" Body="&lt;p&gt;A more principled way of solving this problem is to apply signal detection theory (a.k.a hypothesis testing). I will outline here an easier case where we are trying to decide if the data has a positive slope trend vs. no trend. Setting up the hypotheses,&#xA;$$&#xA;H_0: y(n) = w(n)&#xA;$$&#xA;$$&#xA;H_1: y(n) = A n + w(n), \; \; A&amp;gt;0.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $\{y(n)\}_{n=0}^{24}$ is the data you get, $A$ is an unknown positive slope, $\{w(n)\}_{n=0}^{24}$ is i.i.d. Gaussian noise $N(0,\sigma^2)$ with known variance.&#xA;Working out the log-likelihood ratio, your test is of the form&#xA;$$&#xA;t = \sum_{n=0}^{24} n \; y(n) \underset{H_0}{\overset{H_1}{\gtrless}} \gamma&#xA;$$&#xA;where $\gamma$ is set in order to obtain a user specified false alarm probability. For instance, if you want your false alarm rate to be 0.05 (i.e. a 5 percent chance of announcing positive slope when there is no trend in reality), then the parameter $\gamma = (\sigma \sqrt{\sum_{n=1}^{24} y(n)^2}) \Phi^{-1}(0.05)$, where $\Phi$ is the c.d.f. of a Gaussian $N(0,\sigma^2)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically, you would calculate $t$ and if it exceeds this $\gamma$, conclude that there is positive trend. Note that there is no finite differencing in the calculation of the test statistic $t$, hence the procedure will be computationally quite stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to avoid doing this math, I am sure you will find hypothesis testing routines for trend detection in commercial statistical software suites like R or Minitab.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastActivityDate="2012-10-12T17:30:31.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3647" PostTypeId="2" ParentId="3633" CreationDate="2012-10-12T19:45:18.873" Score="3" Body="&lt;p&gt;The idea of being sparse in a certain basis can be extended and one can talk about being sparse in a frame, or even, being sparse in a dictionary. Now we may lose orthogonality, have redundant signals in our dictionary and no longer have unique signal expansions; which is OK if we only care about sparsity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The EMD expansion is sparse in the sense that you can express a signal as a linear combination of just a few IMFs.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="1825" LastEditDate="2015-04-20T20:40:48.713" LastActivityDate="2015-04-20T20:40:48.713" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="3648" PostTypeId="2" ParentId="3635" CreationDate="2012-10-13T05:24:53.807" Score="0" Body="&lt;p&gt;You need a model, or potential models, of the underlying cause of the data and the noise source, and the computed result will depend on which models you choose or guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if you think the data source can be modeled by a linear, quadratic, or other polynomial equation in Gaussian noise, then you might try a linear regression or some other polynomial regression fits.  Then check the regressions to see if or which model was a good match, and if close enough, use the (least squares) estimated polynomial coefficients to calculate the derivatives.  If you predict a sinusoidal model, then perhaps something similar using a DFT/FFT to find and extract the sine waves and phases, and then compute some derivatives from the sinusoidal estimates.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-10-13T05:24:53.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3649" PostTypeId="2" ParentId="3643" CreationDate="2012-10-13T12:26:19.727" Score="1" Body="&lt;p&gt;As suggested above, thresholding can be very effective on this image, which is essentially binary, except that a constant threshold will not do because of uneven lighting. You need adaptive thresholding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My advice would be to do background reconstruction with a simple model (possibly planar [3 DOF] or quadradic [6 DOF]), by sampling a small number of values in the light regions. The best is to use small ROIs to average away the noise. Then correct the shading by subtracting (or dividing by) the background values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If human interaction is not an option, you can automate the search for background areas by first straight Otsu and considering uniform ROIs (low variance) well under the threshold. After a first background reconstruction, you can probably improve by applying this process to the flat-corrected image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole process can be implemented to run well below a second.&lt;/p&gt;&#xA;" OwnerUserId="2109" LastActivityDate="2012-10-13T12:26:19.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="3650" PostTypeId="2" ParentId="3643" CreationDate="2012-10-13T15:03:01.247" Score="2" Body="&lt;p&gt;I think that you gave up on threshold techniques too early. Take a look at your histogram, it is clearly tri-modal:&#xA;&lt;em&gt;(I removed the white columns to the right of your image manually, I assume that they are not part of the image - please &lt;a href=&quot;https://i.stack.imgur.com/U2sc5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;take this image&lt;/a&gt; before running my code)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I64hX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at all values in the first group:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wx5nD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to find modes in tri-modal histogram, it is possible to use &lt;a href=&quot;http://en.wikipedia.org/wiki/K-means_clustering&quot; rel=&quot;nofollow noreferrer&quot;&gt;K-means clustering&lt;/a&gt; with &lt;code&gt;K=3&lt;/code&gt; on intensity. The following Matlab code finds &lt;code&gt;th1=67&lt;/code&gt; on your code. The idea is to assume that you have the 3 sets, and calculate the weighted centroid on each one. Then, each intensity level is assigned to its own cluster. You stop when the weighted centroids cease moving. Here is the result of finding two thresholds on your image, shown on the histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D7hnO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [th1,th2]=SegmentHistTo3()&#xA;    im = imread('https://i.stack.imgur.com/U2sc5.png');&#xA;    h = imhist(im(:,:,1)); %# Calculate histogram&#xA;&#xA;    th1new = round(256/3); %# Initial thresholds&#xA;    th2new = round(256*2/3);&#xA;    th1 = 0;&#xA;    th2 = 0;&#xA;&#xA;    while (th1~=th1new) || (th2~=th2new) %# While the centroids keep on moving&#xA;        th1 = th1new;&#xA;        th2 = th2new;&#xA;&#xA;        wa1 = WeightedAverage(h,1,th1);  %# Calculate 3 weighted averages&#xA;        wa2 = WeightedAverage(h,th1+1,th2);&#xA;        wa3 = WeightedAverage(h,th2,numel(h));&#xA;&#xA;        th1new = round( (wa1+wa2)/2 );  %# The thresholds are middle points between the averages&#xA;        th2new = round( (wa2+wa3)/2 );&#xA;    end&#xA;&#xA;    figure; hist( double( reshape(im(:,:,1),1,[]) ),256);&#xA;    hold on;&#xA;    plot( [th1 th1],[0 max(h)],'r','LineWidth',2);&#xA;    plot( [th2 th2],[0 max(h)],'r','LineWidth',2);&#xA;&#xA;    figure;imshow( im(:,:,1)&amp;lt;th1);&#xA;end&#xA;&#xA;function wa = WeightedAverage(region,th1,th2)    &#xA;    regionNonEmpty(th1:th2) = region(th1:th2);&#xA;    wa = sum( regionNonEmpty .* (1:numel(regionNonEmpty))) / sum(regionNonEmpty);    &#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Solving the problem afterwards is a piece of cake, simply do some simple morphological operations, like opening.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-10-13T15:58:19.870" LastActivityDate="2012-10-13T15:58:19.870" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="3651" PostTypeId="2" ParentId="3643" CreationDate="2012-10-13T16:01:32.737" Score="0" Body="&lt;p&gt;Are the outlines always straight lines or known curves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so then rather than trying to get each pixel along the edge correct I would use Hough transforms to get the equations of the lines and then recreate the countours from the lines and itnersections&lt;/p&gt;&#xA;" OwnerUserId="1002" LastActivityDate="2012-10-13T16:01:32.737" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3652" PostTypeId="1" AcceptedAnswerId="3653" CreationDate="2012-10-13T06:16:02.487" Score="0" ViewCount="7469" Body="&lt;p&gt;I've seen many posts here that state that an FFT is almost all you need to get the fundamental frequency from an input stream.  The problem is that, with sound, this doesn't work; we need to look for periodicity as well.  I know that autocorrelation is useful in this arena, but even then, I am unfamiliar with how one would extract the fundamental frequency from the data after autocorrelation.  Also, I am aware that there are alternative methods as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not interested in the easiest solution; I am interested in 1: the most efficient solution and 2: the most accurate solution, especially if these are mutually exclusive.&lt;/p&gt;&#xA;" OwnerUserId="22740" OwnerDisplayName="Adam" LastActivityDate="2016-07-01T16:07:40.457" Title="FFT Pitch Detection methods: Autocorrelation or other?" Tags="|fft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="3653" PostTypeId="2" ParentId="3652" CreationDate="2012-10-13T17:50:16.227" Score="4" Body="&lt;p&gt;FFTs alone are lousy at pitch estimation for many really common sound sources, including male voices, and low piano or guitar notes.  Thus, the comments that an FFT is all you need are false and misleading.  (Although FFTs can be used as components of a more accurate composite pitch detection algorithm.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using autocorrelation, after you remove or discount subharmonic lag peaks, the pitch frequency may be around or close to the reciprocal of the time lag corresponding to the autocorrelation peak.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pitch often refers to the human perception of such, and thus an estimate sometimes needs to include psycho-acoustics effects and illusions.  There are multiple methods for, and lots of book chapters and research papers on this problem of pitch detection.  How well each algorithm works might depend on your particular sound source and requirements.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pitch detection/estimation methods include lag estimators, such as autocorrelation, weighted autocorrelation, AMDF and ASDF; and frequency domain analysis methods based on initial FFTs, such as cepstral/cepstrum methods, and the harmonic product spectrum algorithm.  Composite methods, and ones that use some decision analysis are less easy, but can be more accurate or robust for some sound sources.  Look for &lt;a href=&quot;http://dafx10.iem.at/proceedings/papers/VonDemKnesebeckZoelzer_DAFx10_P102.pdf&quot; rel=&quot;nofollow&quot;&gt;YIN&lt;/a&gt;, &lt;a href=&quot;http://www.clsp.jhu.edu/ws2000/presentations/preliminary/paul_bamberg/pitch_tracking.shtml&quot; rel=&quot;nofollow&quot;&gt;RAPT&lt;/a&gt; and &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.129.4722&quot; rel=&quot;nofollow&quot;&gt;YAAPT&lt;/a&gt;.  This list is by no means exhaustive.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-10-13T19:39:38.940" LastActivityDate="2012-10-13T19:39:38.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="3654" PostTypeId="1" AcceptedAnswerId="4652" CreationDate="2012-10-13T18:46:34.500" Score="6" ViewCount="597" Body="&lt;p&gt;I'm trying to wrap my head around compressed sensing, so I've been reading &lt;a href=&quot;http://dsp.rice.edu/sites/dsp.rice.edu/files/cs/CSintro.pdf&quot; rel=&quot;noreferrer&quot;&gt;this intro to the topic&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm completely keeping up when they discuss exploiting the sparsity of a signal in some domain to compress it.  I also &lt;em&gt;think&lt;/em&gt; I get why you'd want to choose a sensing matrix that is incoherent with the basis in which your signal is sparse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point where my understanding breaks down is the &quot;Undersampling and Sparse Signal Recovery&quot; section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concretely, let's say I have a signal &lt;code&gt;f&lt;/code&gt; of length &lt;code&gt;n&lt;/code&gt;.  I have a sensing matrix which is incoherent with the basis in which &lt;code&gt;f&lt;/code&gt; is sparse that is &lt;code&gt;m x n&lt;/code&gt;, and &lt;code&gt;m &amp;lt; n&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly, I'm supposed to measure the signal by taking its inner product with each row of my sensing matrix, so I'll end up with samples of length &lt;code&gt;m&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand it, compressed sensing is useful in cases when sampling at the Nyquist/Shannon frequency is prohibitively expensive or slow.  I &lt;em&gt;must&lt;/em&gt; be missing something really fundamental, &lt;strong&gt;but didn't I have to do the work to acquire all samples of &lt;code&gt;f&lt;/code&gt; so that it could be correlated with my sensing matrix?&lt;/strong&gt;  As I understand it, I've compressed the data now, which is great, but I didn't save any energy in the acquisition process.&lt;/p&gt;&#xA;" OwnerUserId="2110" LastActivityDate="2012-10-13T20:21:13.607" Title="Signal Acquisition in Compressed Sensing" Tags="|compressive-sensing|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4652" PostTypeId="2" ParentId="3654" CreationDate="2012-10-13T20:21:13.607" Score="11" Body="&lt;p&gt;Just to restate everything for clarity, the Compressed Sensing problem is defined as the following: given a signal $x$ of length $N$, we measure the projection of $x$ by some projection operator, $\Phi$ of size $M \times N$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y = \Phi x,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y$ is are our $M$ measurements of the original signal. We could also state this in terms of the inner products of $x$ with the rows of $\Phi$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y_i = \left&amp;lt; \phi_i, x\right&amp;gt;.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the CS sampling procedure we have an inherent dimensionality reduction since we are taking a projection of $x$. The degree of this dimensionality reduction is usually referred to in terms of the ratio $\frac{M}{N}$ (aka the subsampling ratio or &quot;Subrate&quot;). By obtaining $y$ during acquisition we are simultaneously performing acquisition and dimensionality-reduction rather than full-resolution sampling followed by compression (DCT, DWT, etc.). The measurements $y$ are read off of the sensor, quantized (still an open problem, but decent results can be obtained through simple scalar quantization. &lt;a href=&quot;http://www.ece.rice.edu/~jnl5066/papers/thesis.pdf&quot; rel=&quot;noreferrer&quot;&gt;See Laska's dissertation&lt;/a&gt; for more novel approaches), entropy coded (pick your flavor), and then transmitted or stored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You touch on a good key point when it comes to CS signal acquisition, namely, if the calculation of this projection is costly then the advantage of CS for acquisition systems would appear small. However, depending on the context and type of signal, such projections can be accomplished in the analog domain (requiring no computation). &lt;a href=&quot;http://dsp.rice.edu/cscamera&quot; rel=&quot;noreferrer&quot;&gt;The single-pixel camera (SPC) is a great example of this&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oy8Cy.png&quot; alt=&quot;Single Pixel Camera&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Researchers have also been able to greatly reduce sampling times for MRI using CS techniques. Specifically, conventional MRI techniques sample along different radial lines within the frequency domain. Each radial line is a measurement of the MRI device requiring some sampling time. Traditionally, for higher resolution MRI, more radial lines must be acquired, incurring longer acquisition time (problematic for the MRI of small children). However, this process can also be characterized as linear projections within the frequency domain. Because of this, CS techniques can be used to recover MRI images from many fewer measurements, allowing for high resolution MRI with much shorter MRI appointments. This was, in fact, the context in which CS was first applied. For more info, &lt;a href=&quot;http://www.stanford.edu/~mlustig/CSMRI.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper by Lustig et al&lt;/a&gt; might be a good starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summation, the usefulness of CS to a particular context really depends on how you implement the projection. Getting it right can require some out-of-the-box thinking to come up with a novel sensing strategy. Thankfully, frameworks such as the SPC are generalizeable to a wide range of different signal contexts, so we don't have to re-invent the wheel every time.&lt;/p&gt;&#xA;" OwnerUserId="2054" LastActivityDate="2012-10-13T20:21:13.607" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4653" PostTypeId="2" ParentId="3544" CreationDate="2012-10-13T20:49:05.593" Score="2" Body="&lt;p&gt;The frequency domain is organized into a frequency distribution. For visual understandings you often see images, which have polar coordinates and the magnitude/power spectrum displaying for frequency domain. Some shifting of the quadrants is also done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lower frequencies are in the middle of the image while higher frequencies are going to the corners. This depends on the magnitude properties of lower and higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cutoff for a low pass filter (LPF) itself describes the ammount of low-frequencies you let pass through your filter. The rest is cut off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sharp cutoff (like in the ILPF (See &lt;a href=&quot;https://i.stack.imgur.com/RlP2z.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;) or IHPF) of a frequency filter leads to ringing of your signal in spatial/time domain, which is not quite good and creates artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore you fade your frequency filter to the edges, in order to minimize the artifact generation in spatial domain.&#xA;The Butterworth and the Gauss filter are using these technique (See Image &lt;a href=&quot;https://i.stack.imgur.com/QPshe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt; and &lt;a href=&quot;https://i.stack.imgur.com/5eWST.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;).&#xA;The $D_0$ of Gauss and Butterworth is describing the fading factor or commonly said how fast the fade to black/white takes place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can design your filtermasks circular or like a rectangle (box).&#xA;The images of the low pass filtermasks should give you a better understanding of what I posted above. It is also valid for rectangular shapes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RlP2z.jpg&quot; alt=&quot;ILPF&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/QPshe.jpg&quot; alt=&quot;BLPF&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5eWST.jpg&quot; alt=&quot;GLPF&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The high pass filters (HPF) are inverted.&lt;/p&gt;&#xA;" OwnerUserId="1923" LastEditorUserId="1923" LastEditDate="2012-10-14T05:52:27.417" LastActivityDate="2012-10-14T05:52:27.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4655" PostTypeId="1" AcceptedAnswerId="4656" CreationDate="2012-10-14T09:23:41.167" Score="6" ViewCount="2166" Body="&lt;p&gt;I've been involved in Image Processing kind of project for the last couple of month, before which i had no experience in Image processing.&#xA;While filtering the image today i had a thought what exactly happens when we fast forward any movie or a video clip ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example,&#xA;If I have a video whose Frame rate is 30 , this means that 30 frames will be process in a second.&#xA;and each frame will take &lt;code&gt;1/30 = 0.03sec&lt;/code&gt; to process , If we increase the frame rate or FPS of the video we will get more smooth view of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what exactly happens when we fast forward the video, what i think is (not sure) the audio and the video of any clip must be synchronized so that we can control both accordingly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when we forward the video does it skip certain Frames ? if yes, then what about the Audio ?&#xA;What exactly happens ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2012-10-14T13:30:16.053" LastActivityDate="2012-10-14T22:03:49.850" Title="What happens when we Fast Forward the Video" Tags="|image-processing|video-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4656" PostTypeId="2" ParentId="4655" CreationDate="2012-10-14T14:27:48.697" Score="8" Body="&lt;p&gt;What happens to the video:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the most simple implementation, which is suitable for large integer fast forward rates, only 1 frame out of N, where N is the fast forward rate is played. For example, with a normal play rate at 30 FPS, frames 0 to 29 are played in sequence over a duration of one second. In fast forward with a 3x rate, frames 0, 3, 6 ... 87 are played in one second; and frames 1, 2, 4, 5... 88, 89 are discarded. This can be quite computationally expensive as the video decoder has to provide 3 times as many frames per second as in normal play (though the display continues receiving 30 frames per second).&lt;/li&gt;&#xA;&lt;li&gt;When the hardware permits it and/or when the fast forward rate is small, the frame rate is simply increased. For example, in fast forward with a 1.1x rate, frames 0 .. 32 are played in one second.&lt;/li&gt;&#xA;&lt;li&gt;There are applications when a video stream has to be sped up/down by a small factor (say 5%) while maintaining a target frame rate (for example when a broadcaster wants to speed up a show to make room for twenty extra seconds of ads). In this case, interpolation/resampling methods have to be used - this is the same kind of techniques as those used for &lt;a href=&quot;http://en.wikipedia.org/wiki/Telecine&quot; rel=&quot;nofollow&quot;&gt;telecine conversion&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What happens to the audio:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In some implementations, the audio is read at a higher sample rate, and decimated to the target sample rate. For example let us consider the example where the original audio is at 44.1kHz, and the fast forward rate is 3x. In 1s, you need to play 3s of the original audio. So you read 44100 x 3 samples from the original audio stream, low-pass filter it with a filter which has a 1/3 normalized cutoff frequency; and keep only every third sample. This gives you 44100 samples of sped-up audio, which are played in a time span of 1s at 44.1kHz. This has the unwanted effect of shifting up the pitch of all sounds, giving voices a &quot;chipmunk effect&quot;. For small shift up/rates the effect is acceptable to the common public (though musically trained people might notice a well-known song has been shifted in pitch and is not in its original tonality).&lt;/li&gt;&#xA;&lt;li&gt;In some better implementations (eg Apple Quicktime player), a time-stretching algorithm is used to multiply the speed of the input audio without altering the pitch. For playback / scrubbing, the sound quality rarely matters and the time-stretching algorithms are rather crude (you can have a look at the source code of &lt;a href=&quot;http://www.surina.net/soundtouch/&quot; rel=&quot;nofollow&quot;&gt;soundtouch&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-10-14T22:03:49.850" LastActivityDate="2012-10-14T22:03:49.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4657" PostTypeId="1" CreationDate="2012-10-14T19:09:46.693" Score="1" ViewCount="1448" Body="&lt;p&gt;I have a signal's spectrogram and frequency spectrum (which, if i'm not mistaken, is its the signal's fourier transform) as given below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yRd5l.png&quot; alt=&quot;Spectrogram (top) and Frequency Spectrum (bottom)&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand that the spectrogram plots the frequency (y-axis) vs time (x-axis) and that the colors represent the amplitude.  I also understand the frequency spectrum as the plot of amplitude vs. frequency.  But I'm not quite sure how to produce one graph from the other.   Since there is no time axis on the frequency spectrum, surmise that it is impossible to create the spectrogram from a frequency spectrum.  It seems plausible to derive the frequency spectrum from the spectrogram, but I'm not quite sure how to remove the time parameter.&lt;/p&gt;&#xA;&lt;p&gt;Any help with this would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1330" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-10-14T21:11:47.780" Title="Deriving the frequency spectrum graph from the graph of a spectrogram and vice versa?" Tags="|frequency-spectrum|spectrogram|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4658" PostTypeId="2" ParentId="4657" CreationDate="2012-10-14T19:31:37.910" Score="2" Body="&lt;p&gt;The data that when colored produces one vertical slice of your spectrogram image is a spectrum.  If you have the color mapping function, and it is invertible, you could take the array of colors from one vertical column in a spectrogram and attempt to produce the original spectrum for that point in time.  But the inversion process would likely be lossy, since there are usually less quantized colors than spectrum amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since a spectrum is only one vertical slice of a spectrogram, a spectrogram produced from just one spectrum would only be something like 1 pixel wide, thus not very useful.  But a bunch of spectrums at evenly spaced time increments could be used to produce a wider spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that due to time-frequency-resolution trade-offs, the width of time data used for each FFT/DFT spectrum array can be different between spectrum and spectrogram analysis presentations.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-10-14T19:36:51.600" LastActivityDate="2012-10-14T19:36:51.600" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4661" PostTypeId="2" ParentId="3164" CreationDate="2012-10-14T20:42:02.183" Score="2" Body="&lt;p&gt;Do you really have to use Harris corners? There is many features developed after Harris corners, with better properties. A good overview can be found in this article:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=a.l.%20dahl%2C%20h.%20aan%C3%A6s%2C%20and%20k.s.%20pedersen.%20finding%20the%20best%20feature%20detector-descriptor%20combination&amp;amp;source=web&amp;amp;cd=3&amp;amp;ved=0CCkQFjAC&amp;amp;url=http%3A%2F%2Froboimagedata.imm.dtu.dk%2Fpapers%2F3DIMPVT_2011_descDetect.pdf&amp;amp;ei=bh17UNGUNOe40QXAroDADQ&amp;amp;usg=AFQjCNFkYimFuk20yJIiHBnlMq6UaeYJVQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;A.L. Dahl, H. Aanæs, and K.S. Pedersen. Finding the Best Feature Detector-&#xA;Descriptor combination&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Based on that article as well as my personal experience, I would suggest switching either to &lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=j.%20matas%2C%20o.%20chum%2C%20m.%20urban%2C%20and%20t.%20pajdla.%20robust%20wide-baseline%20stereo%20frommaximally%20stable%20extremal%20regions&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCEQFjAA&amp;amp;url=http%3A%2F%2Fcmp.felk.cvut.cz%2F~matas%2Fpapers%2Fmatas-bmvc02.pdf&amp;amp;ei=pB57UPvqKOqK0AXEhoGwDg&amp;amp;usg=AFQjCNGXv1k27m9V0t21Q89ogVqZLvtvYQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;MSER (Maximally Stable Extermal Regions)&lt;/a&gt;, or even combine them with &lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=d.g.%20lowe.%20distinctive%20image%20features%20from%20scale-invariant%20keypoint&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCIQFjAA&amp;amp;url=http%3A%2F%2Fwww.cs.ubc.ca%2F~lowe%2Fpapers%2Fijcv04.pdf&amp;amp;ei=dh57UITkFtO00QWVy4D4AQ&amp;amp;usg=AFQjCNExaFk5YsadEaL01y1K6FRDDh5u3g&quot; rel=&quot;nofollow noreferrer&quot;&gt;DoG (Difference of Gaussians)&lt;/a&gt; -- the features first presented as a part of the SIFT pipeline.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the problem &lt;em&gt;really is in low contrast&lt;/em&gt;, then MSER features should really make you happy: they are (fairly) invariant to changes in lighting. In short, they are connected regions of the image stable through a series of different threshold binarizations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The feature extraction process is independent from calculating the descriptors, so it shouldn't be too hard to integrate new ways of feature extraction in to your process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I've heard of (but never actually worked with) &lt;strong&gt;Multiscale Harris corners&lt;/strong&gt; as an extension to Harris corners. I don't know much about them and personally can not recommend any reading materials on this topic, so I leave article search and picking the most interesting materials to you.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Furthermore, might I suggest that the image you posted &lt;strong&gt;might have other problems than low contrast&lt;/strong&gt;. In my personal experience, vegetation like bushes or possibly the field you have, as well as the lovely bubbly clouds tend to produce &lt;em&gt;&quot;generic features&quot;&lt;/em&gt; -- features which tend to have equally similar (or dissimilar) descriptors as a lot of other features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically, this means that when doing feature matching on two images from a different perspective, features extracted from these kinds of surfaces tended to be falsely matched.  I have done a &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/bosilj12ms.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Master thesis&lt;/a&gt; that in a large part deals with feature extraction to be used in feature matching further used to calculate a homography transformation between two images when I came across this problem. I didn't find any other articles describing this problem at the time, but my thesis might be helpful for your overall approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, as you have set, thresholds and techniques that work just fine on most images extract to little features in this kind of images, because of its mostly homogeneous areas. This kind of images present problems in feature matching (which can be extended to image stitching), content based image retrieval, and I would presume tracking as well as similar applications. No method currently works quite well on them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Methods that work good on this kind of images as well as the typical cases are being explored and researched currently, such as an approach I started working on &lt;a href=&quot;https://dsp.stackexchange.com/a/3605/1273&quot;&gt;briefly described in this answer&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-10-14T21:06:11.773" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4662" PostTypeId="2" ParentId="4657" CreationDate="2012-10-14T21:06:32.013" Score="2" Body="&lt;p&gt;If you know the parameters that generated the spectrogram (time-frequency image) and you have the magnitude + phase information of the short-time Fourier transform (STFT), you can reconstruct the time domain signal and then calculate its DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you all have is the magnitude squared of the STFT (i.e. the spectrogram) then inversion is ill-posed. One option is to build ``fake'' phase values into it. Also see the paper by Griffin and Lim (1984) on STFT inversion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, going from the magnitude frequency spectrum (magnitide of DFT) to time domain is ill-posed, if you don't have any phase information. If you do have phase information, then you can get the time domain signal and then calculate its spectrogram.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="1825" LastEditDate="2012-10-14T21:11:47.780" LastActivityDate="2012-10-14T21:11:47.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4665" PostTypeId="1" AcceptedAnswerId="4678" CreationDate="2012-10-15T02:27:44.333" Score="1" ViewCount="262" Body="&lt;p&gt;The graph below was derived from a raw seismogram recorded during an earthquake over a timespan from t=0 to t=1400 seconds (not shown on x-axis). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EjWp7.png&quot; alt=&quot;Broadband Seismogram with Instrument Response removed. &quot;&gt;&lt;br&gt;&#xA;The original seismogram $s(t)$ is not shown, but it is known that the original signal is the convolution between the source wave $w(t)$, the effects of the medium $g(t)$, and the effects from instrument itself $i(t)$; that is,  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=w(t)*g(t)*i(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The graph above is what remains after removing the instrument response as shown below:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FcjLO.png&quot; alt=&quot;Instrument Response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this instrument response is telling me that the amplitudes of the original seismogram $s(t)$ at frequencies higher than $0.02Hz$ were amplified at a constant gain of approximately $1E9$, while amplitudes lower than $0.01Hz$ are effectively dampened (by gains significantly smaller than at those frequencies higher than $0.02Hz$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what exactly can I effectively say about the shape of the original seismogram from this information?  If these frequencies are 'dampened' in the broadband representation above, what, if anything, can be said about the amplitudes and shapes observed in the original graph?  Can I simply say that longer waves should be present in the original signal but not say anything about when they occur?  Could I somehow convolve these graphs to generate the original signal (or at least closely approximate it)?&lt;/p&gt;&#xA;" OwnerUserId="1330" LastActivityDate="2012-10-15T16:07:50.700" Title="Understanding the frequency scale of a spectrogram" Tags="|convolution|impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4666" PostTypeId="1" AcceptedAnswerId="4676" CreationDate="2012-10-15T02:50:21.773" Score="5" ViewCount="3344" Body="&lt;p&gt;I have been told that the signal in the graph below was obtained by passing a seismogram through a high-pass filter to obtain the high frequency-small amplitude waves common in tremors far from the epicenter of an earthquake.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uajxw.png&quot; alt=&quot;High pass filtered seismogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The high-pass filter used to unmask the tremor was selected to avoid the 'attenuation' of the tremor signal.  What exactly is meant by 'attenuation' in this context?&lt;/p&gt;&#xA;" OwnerUserId="1330" LastEditorUserId="15892" LastEditDate="2016-11-26T09:28:47.193" LastActivityDate="2017-08-17T12:59:58.850" Title="Understanding the attenuation of a signal" Tags="|highpass-filter|attenuation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4667" PostTypeId="1" AcceptedAnswerId="4671" CreationDate="2012-10-15T02:58:12.793" Score="1" ViewCount="709" Body="&lt;p&gt;It seems to me that the spectrogram representation of a finite signal gives you significantly more useful information than a frequency spectrum.  As I understand it, the spectrogram breaks down the spectrum over time whereas the frequency spectrum gives you no time dependent information.  Why wouldn't I want to use this kind of representation all the time?  When would it be more useful to use the frequency spectrum rather than the spectrogram?  Is it just computationally expedient to produce a frequency spectrum?&lt;/p&gt;&#xA;" OwnerUserId="1330" LastActivityDate="2012-10-17T21:36:07.477" Title="When should I use a frequency spectrum rather than a spectrogram representation?" Tags="|frequency-spectrum|spectrogram|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4668" PostTypeId="2" ParentId="2096" CreationDate="2012-10-15T06:04:11.747" Score="14" Body="&lt;p&gt;I wanted to add in to the only category that the first post didn't cover.  The multitaper method is a non-parametric method for computing a power spectrum similar to the periodogram approach.  In this method a power spectrum is computed by windowing the data and computing a Fourier transform, taking the magnitude of the result and squaring it.  The multitaper method averages a pre-determined number of periodograms each computed with a different window.  This method works because the selected windows have two mathematical properties.  First, the windows are orthogonal.  This means that each one of the periodograms is uncorrelated so averaging multiple periodograms gives an estimate with a lower variance than using just one taper.  Second, the windows have the best possible concentration in the frequency domain for a fixed signal length.  This means that these windows perform the best possible with respect to leakage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matlab, the window functions may be called by using the function dpss.  In addition to using optimal windows, an algorithm has been derived to weight the different periodograms based on how much leakage they will add to the power spectrum estimate.  The algorithm yields a set of data-adaptive weights.  Getting a spectrum estimate with a set of data-adaptive weights may be done in Matlab by creating a spectrum.mtm object with 'adaptive' used as the combine option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning non-parametric methods, the MT method is arguably the best method for estimating a power spectrum for a stationary time-series. &lt;/p&gt;&#xA;" OwnerUserId="2007" LastActivityDate="2012-10-15T06:04:11.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4669" PostTypeId="1" CreationDate="2012-10-15T06:27:39.587" Score="1" ViewCount="1811" Body="&lt;p&gt;I'm trying to register 2 images.First image don't change and second image is changing at each iteration by homography matrix and I'm using minimizer to find maximum of phase correlation, but for some reason it's doesn't work, maybe I'm conceptually wrong or maybe I'm using minimizer in a wrong way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is code on matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;main.m &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;global model; &#xA;global scene; &#xA;&#xA;scene = imread('001_001.tif'); &#xA;%test distortion homography matrix m11 m12 m21 m22 m31 m32 then we add nonchangeble m13=0 m23=0 m33=1 &#xA;H= [0.95 -0.05 0.0000 1.0000 -0.0000 -0.0000];% so we can test precision&#xA;model=warp_im(scene,H); &#xA;&#xA;%m11 m12 m21 m22 m31 m32 &#xA;init_sol= [1 0 0 1 0 0]; %initial solution&#xA;&#xA;opts= optimset('Algorithm','interior-point','MaxFunEvals',5000,'MaxIter',5000,'TolFun',1e-6,'TolX',1e-10); &#xA;&#xA;problem= createOptimProblem('fmincon','objective','compute_NCC','x0',init_sol,'options',opts); &#xA;&#xA;gs= GlobalSearch; &#xA;[x,f]= run(gs,problem) &#xA;param=x;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;compute_NCC.m &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function peak = compute_NCC(param) &#xA;&#xA;global scene; &#xA;global model; &#xA;&#xA;img= warp_im(model,param); &#xA;&#xA;%padd with zeros&#xA;sz1= size(scene); % y x  &#xA;sz2= size(img); &#xA;sz= abs(sz2-sz1); &#xA;pad_im1=scene;pad_im2=img; &#xA;if(sz1(1)&amp;gt;sz2(1))%y &#xA;pad_im2= padarray(img,[sz(1),0],'post'); &#xA;else &#xA;pad_im1= padarray(scene,[sz(1),0],'post'); &#xA;end; &#xA;if(sz1(2)&amp;gt;sz2(2))%x &#xA;pad_im2= padarray(pad_im2,[0,sz(2)],'post'); &#xA;else &#xA;pad_im1= padarray(pad_im1,[0,sz(2)],'post'); &#xA;end; &#xA;&#xA;FFT1 = fftshift(fft2(pad_im1)); &#xA;FFT2 = fftshift(fft2(pad_im2)); &#xA;&#xA;FFT = FFT1.*conj(FFT2); &#xA;FFT = FFT./abs(FFT); &#xA;&#xA;mag = (ifft2(FFT)); &#xA;&#xA;peak= -abs(max(max(mag))) % minimize&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;warp_im.m &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function out = warp_im(img,param) &#xA;param=[param(1:2),0,param(3:4),0,param(5:6),1] &#xA;H=reshape(param,3,3)' &#xA;&#xA;tform = maketform('projective',H'); &#xA;out= imtransform(img,tform);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1781" LastActivityDate="2012-10-15T06:27:39.587" Title="image registration using fft" Tags="|fft|matlab|image-registration|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4670" PostTypeId="1" CreationDate="2012-10-15T08:00:15.480" Score="7" ViewCount="2955" Body="&lt;p&gt;Hi CV/Pattern Recognition Community,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because my last thread was concerning the segmentation as BLOB and started to getting too big, with no clear results.&#xA;I would like to reconcider the last step of that process regarding the sequential gaining of object contour points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to extract the contour of an image from a defined starting point (left) to the right (endpoint).&#xA;As you can see in the next image, there are two yellow windows (left and right). These are the mentioned start- and endpoints.&#xA;And what I want to do: Starting from the left yellow window and moving to the right, saving (x,y) coords of the regarding points. This is what the red line (contour) does.&#xA;The sequence of the contour pixels does matter.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FPVC5.png&quot; alt=&quot;What I want to do&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am at the step where I've only got a binary image, &#xA;So far, so good.&#xA;In the worst case still with holes and possible noise in the rest of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, here are some images, which I want to extract.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this example, I'd like to get the outer contour line of the object on the table/underground. As you can see in the right upper corner and in the left upper corner are fragments of the edge detection process, which should not be traversed.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0iHxx.png&quot; alt=&quot;example1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/D3qDi.png&quot; alt=&quot;example2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&#xA;Matlab and/or OpenCV Hints are welcome!&lt;/p&gt;&#xA;" OwnerUserId="1923" LastActivityDate="2012-11-03T06:39:58.237" Title="Sequentially get the outer contour of an Edge Image" Tags="|image-processing|matlab|computer-vision|opencv|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4671" PostTypeId="2" ParentId="4667" CreationDate="2012-10-15T08:42:01.400" Score="4" Body="&lt;p&gt;The spectrogram suffers from a time/resolution restriction - the smaller your time step, the smaller your analysis windows become, the worse your frequency resolution gets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a waste of frequency resolution to break down a &lt;em&gt;stationary&lt;/em&gt; signal into tiny temporal slices. Thus, if you know in advance that your signal you analyze is stationary; or if you have pre-segmented your signal into stationary segments (using a transient/onset detector; novelty detection; or an auxiliary signal/sensor), there is no reason to lose frequency resolution by using the spectrogram.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-10-15T13:23:40.943" LastActivityDate="2012-10-15T13:23:40.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4672" PostTypeId="1" AcceptedAnswerId="4675" CreationDate="2012-10-15T10:59:48.790" Score="3" ViewCount="3644" Body="&lt;p&gt;First post here, trying to make it as good as possible. Do not know how to make the Python code look nice - any tips? :) Anywho - to the main problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently working on simulating the uplink of LTE starting with the SC-FDM(A) modulator. Now, the &quot;first edition&quot; is the OFDM modulator implemented in Python and basically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np  &#xA;&#xA;import numpy.fft as npf&#xA;&#xA;numSymbols = 12*10 # 10 resource blocks, each containing 12 subcarriers.   FFTsize = 1024&#xA;&#xA;tmp1 = np.array(np.random.randint(0,2,numSymbols))*2-1   tmp2 = np.array(np.random.randint(0,2,numSymbols))*2-1&#xA;&#xA;inputSymbols = (np.array(tmp1) + 1j*np.array(tmp2))/np.sqrt(2) # QPSK modulation&#xA;&#xA;TxSamples = npf.ifft(inputSymbols,FFTsize) # Zero-padded IFFT.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;TxSamples is the OFDM modulated signal of some random binary input. The subcarrier mapping is implicit in the IFFT due to the zero-padding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is the fact that LTE Uplink uses half a subcarrier shift in relation to DC. My implementation is build upon the assumption that each entry in the IFFT is spaced with 15kHz (the required subcarrier spacing according to LTE) and this is also the case for two other implementations I have found &lt;a href=&quot;http://code.google.com/p/pyltesimulator/&quot; rel=&quot;nofollow&quot; title=&quot;1&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/20454-simple-single-carrier-fdma-sc-fdma-simulator&quot; rel=&quot;nofollow&quot; title=&quot;example&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how can this half subcarrier shift (7.5kHz) be incoorperated into the simulation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you need more information - do not really know what is to much or to little information regarding my issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;** UPDATE: **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I tried to do the frequency oversampling by simply adding a zero in between samples. This resulted in me having a replica in the time domain. Cutting away this replica got me back to the starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have done in order to solve the problem is basically mathematical driven. From the formula for the DFT it is possible to derive that you can simply multiply the input symbols by a complex exponential. This will shift the frequency. The Python code is basically (overwriting the last line in the example above):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ism = []  &#xA;for m in range(len(inputSymbols)):  &#xA;    ism += [inputSymbols[m]*np.exp(1j*np.pi*m/FFTsize)]  &#xA;TxSamples = npf.ifft(ism,FFTsize)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which yields the correct time domain representation, with no sorta explicit oversampling. To verify scipy can be used as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import scipy.signal as sps  &#xA;import pylab as pl  &#xA;&#xA;ts1 = sps.resample(TxSamples,len(TxSamples)*2)  &#xA;pl.figure(1)  &#xA;pl.plot(10*np.log10(abs(npf.fft(ts1))))  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which should show that the signal has now been oversampled by two and that the frequency bins are located correctly, while the time domain representation is not broken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose this way one makes sure that both domains are &quot;the same&quot;. Since by simply oversampling in the frequency domain it is not possible to represent the time domain signal correctly. I do not know - it seems that this &quot;hacked&quot; solution works. However kind corrections are always welcome.&lt;/p&gt;&#xA;" OwnerUserId="3115" LastEditorUserId="3115" LastEditDate="2012-10-16T14:52:16.980" LastActivityDate="2019-07-13T09:35:46.363" Title="Half Subcarrier spacing in LTE Uplink" Tags="|modulation|python|ofdm|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4673" PostTypeId="2" ParentId="4667" CreationDate="2012-10-15T11:03:20.567" Score="2" Body="&lt;p&gt;As mentioned, if you analyze smaller time windows of a signal, the you'll loose frequency resolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you only need a coarse frequency resolution for your application, and you know the signal is stationary, or changes very slowly, you still might be best off just periodically taking a spectrum made of a limited number of samples. Spectrograms are generally made by taking the FFT of frames of overlapping samples to maximise the information in both time and frequency domains. They are used to make pretty pictures pleasing to the eye. However, the more data you generate, the more you have to waste processing resources sorting it. Think of the time resolution that you want and the frequency resolution that you want separately. You can then decide how many samples are in the FFT and how often you want to take it.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-10-15T11:03:20.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4675" PostTypeId="2" ParentId="4672" CreationDate="2012-10-15T13:12:14.387" Score="1" Body="&lt;p&gt;For implementing the frequency shift of 7.5 kHz you will have to apply oversampling at some point in your system. There are two principal methods to achieve this: in frequency domain or in time domain.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Frequency domain&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You could simply apply an additional zero padding in frequency domain by using a 2048 IFFT and by setting every second subcarrier to zero. You then shift all subcarriers by one frequency bin to achieve the frequency shift. This will maintain the frequency spacing of 15 kHz but the bandwidth of each subcarrier will be divided by two compared to the 1024 IFFT.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Time domain&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You apply two-times oversampling to the time domain signal at the output of the IFFT. This can be done by padding a zero sample after each sample followed by a lowpass filter or some other interpolation method. The frequency shift can then be achieved by multiplying the resulting signal by $\exp(j\Omega_1 n)$, where $\Omega_1$ is the 7.5 kHz normalized to the new sampling frequency (double the original sampling frequency) and $n$ is the discrete time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which method to choose depends on how close your simulation should be to the hardware implemenation. If the system you model has some intermediate frequency oscillator to do the frequency shift, the time domain method can model this. But if your digital-to-analog converter is fast enough and if you can implement a 2048-IFFT at the required speed, this is probably the way to go and you should therefore model it accordingly.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2012-10-15T13:12:14.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4676" PostTypeId="2" ParentId="4666" CreationDate="2012-10-15T13:54:23.280" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Attenuation&quot; rel=&quot;noreferrer&quot;&gt;Attenuation&lt;/a&gt; in this context refers to a reduction in amplitude of some signal component as it passes through a system (in your case, the system being the highpass filter. Linear filters are designed to pass certain frequency components while stopping (or &lt;em&gt;attenuating&lt;/em&gt;) others. As the name implies, a &lt;em&gt;highpass&lt;/em&gt; filter is designed to pass high-frequency content while attenuating low-frequency content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, the tremor features that you're interested in are high in frequency and small in amplitude. Thus, they may be masked by low-frequency components in the original seismogram. A highpass filter can be used to accentuate the high-frequency tremor waves by attenuating any low-frequency waves that might also be present.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-10-15T13:54:23.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4677" PostTypeId="1" AcceptedAnswerId="4679" CreationDate="2012-10-15T14:00:03.753" Score="3" ViewCount="6920" Body="&lt;p&gt;How to convert grayscale intensity input to something like the following image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tR6lc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that no response (0, black) is converted to dark blue, then it goes through other colors to red.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are these colors derived? Is there any standard gray-to-RGB conversion function for these?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried representing intensity as hue in CIE-LCH model and then converting to RGB through CIE-Lab. But the result weren't as nice as these MRI and PET scans.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach may be a rainbow, i.e. going from high frequency (violet-blue) to lower frequencies (dark red). But is there a conversion formula for this?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2016-03-04T12:41:07.463" Title="How to Generate False Color Palette" Tags="|color|enhancement|conversion|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4678" PostTypeId="2" ParentId="4665" CreationDate="2012-10-15T14:17:12.563" Score="2" Body="&lt;p&gt;I think what you're saying is that you have a &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system&quot; rel=&quot;nofollow&quot;&gt;linear, time invariant (LTI) system&lt;/a&gt; model for both the propagation medium and the response of the measurement instrument itself. Given that you know the (at least approximate) magnitude response of the instrument, you would like to best estimate what the actual signal at the instrument's input looked like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is similar to the process of &lt;a href=&quot;http://en.wikipedia.org/wiki/Equalization&quot; rel=&quot;nofollow&quot;&gt;equalization&lt;/a&gt; used in communications systems. Since you have some knowledge of the system (in this case characterized by the impulse response $i(t)$ or the frequency response plot that you showed), you can attempt to undo the effects on the signal that are imposed by the measurement instrument. More generally, this type of operation is known as &lt;a href=&quot;http://en.wikipedia.org/wiki/Deconvolution&quot; rel=&quot;nofollow&quot;&gt;deconvolution&lt;/a&gt;: given an output of a convolution and optionally knowledge of one of the inputs to the convolution, one would like to calculate the other input. In this case, one of the convolution inputs is $i(t)$ and the output is the measurements reported by your instrument. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that you don't know the exact impulse response of the measurement device, only its magnitude response. This isn't enough information in itself to execute the deconvolution, so you'll need to make some assumptions about the phase response of the instrument in order to move forward with that approach. This is a very powerful technique, however; as the Wikipedia article notes, the approach can be used to compensate for the effects of the seismic propagation medium also (since it's also modeled as a convolution with an impulse response), potentially allowing you to gain more insight as to the original seismic event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; And, as to your questions about how you're interpreting the plot, your understanding seems correct. The system has a highpass characteristic with a flat passband starting at approximately $0.02\ \text{Hz}$, with the magnitude response decreasing by a factor of 10 per decade of frequency below $0.02\ \text{Hz}$. This could be modeled well as a single-pole highpass filter.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-10-15T16:07:50.700" LastActivityDate="2012-10-15T16:07:50.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4679" PostTypeId="2" ParentId="4677" CreationDate="2012-10-15T14:20:18.987" Score="2" Body="&lt;p&gt;What you're looking for is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_mapping&quot; rel=&quot;nofollow&quot;&gt;color map&lt;/a&gt;. As its name implies, this process maps an input (single-component, or grayscale) value within a predetermined range to some other color based upon some mapping. The implementations I've seen typically use linear RGB interpolation between a number of control points specified throughout the allowed input range. The color map used in the image you showed is a pretty common one, starting with dark blue, then through cyan, green, yellow, orange, and ending with red. It is referred to as the &lt;code&gt;jet&lt;/code&gt; colormap in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as an example, for an input intensity on the range $[0,1]$, you might have an RGB lookup table of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0  -&amp;gt; (0, 0, 128)    (dark blue)&#xA;0.25 -&amp;gt; (0, 255, 0)    (green)&#xA;0.5  -&amp;gt; (255, 255, 0)  (yellow)&#xA;0.75 -&amp;gt; (255, 128, 0)  (orange)&#xA;1.0  -&amp;gt; (255, 0, 0)    (red)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, if you wanted to map the value $0.2$ to a color, then you would linearly interpolate between the first two datapoints as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;color = 1 / 5 * (0, 0, 128) / 0.25 + 4 / 5 * (0, 255, 0)&#xA;      = (0, 204, 26)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which would yield a greenish cyan, as it's close to the green control point.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-10-15T14:20:18.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4680" PostTypeId="1" CreationDate="2012-10-15T06:30:14.027" Score="18" ViewCount="7156" Body="&lt;p&gt;What is smoothing and how can I do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an array in Matlab which is the magnitude spectrum of a speech signal (the magnitude of 128 points of FFT). How do I smooth this using a moving average? From what I understand, I should take a window size of a certain number of elements, take average, and this becomes the new 1st element. Then shift the window to the right by one element, take average which becomes the 2nd element, and so on. Is that really how it works? I am not sure myself since if I do that, in my final result I will have less than 128 elements. So how does it work and how does it help to smooth the data points? Or is there any other way I can do smoothing of data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;a href=&quot;https://dsp.stackexchange.com/questions/4699/how-does-this-equation-correspond-to-smoothing&quot;&gt;link to followup question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user13267" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-12-27T15:10:10.593" Title="what is smoothing in very basic terms" Tags="|matlab|image-processing|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4681" PostTypeId="2" ParentId="4680" CreationDate="2012-10-15T06:36:02.183" Score="24" Body="&lt;p&gt;Smoothing can be done in many ways, but in very basic and general terms it means that you even out a signal, by mixing its elements with their neighbors. You smear/blur the signal a bit in order to get rid of noise. For example, a very simple smoothing technique would be, to recalculate every signal element &lt;code&gt;f(t)&lt;/code&gt; to as 0.8 of the original value, plus 0.1 of each of its neighbors:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f'(t) = 0.1*f(t-1) + 0.8*f(t) + 0.1*f(t+1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note how the multiplication factors, or weights, add up to one. So if the signal is fairly constant, smoothing doesn't change it much. But if the signal contained a sudden jerky change, then the contribution from its neighbors will help to clear up that noise a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weights you use in this recalculation function can be called a &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_(statistics)&quot; rel=&quot;noreferrer&quot;&gt;kernel&lt;/a&gt;. A one-dimensional Gaussian function or any other basic kernel should do in your case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nice example of one particular kind of smoothing:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Above: unsmoothed signal&lt;/strong&gt;&lt;br&gt;&#xA;&lt;strong&gt;Below: smoothed signal&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rbORe.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;strong&gt;Examples of a few kernels:&lt;/strong&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VFQIF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2082" OwnerDisplayName="Junuxx" LastActivityDate="2012-10-15T10:25:55.210" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4682" PostTypeId="2" ParentId="4680" CreationDate="2012-10-15T11:07:31.917" Score="8" Body="&lt;p&gt;In addition to the nice answer of Junuxx I would like to drop a few notes.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Smoothing is related to filtering (unfortunately quite vague &lt;a href=&quot;http://en.wikipedia.org/wiki/Filter_%28signal_processing%29&quot;&gt;Wikipedia article&lt;/a&gt;) - you should pick the smoother based on it's properties.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One of my favorites is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot;&gt;median filter&lt;/a&gt;. This is an example of a non-linear filter. It has some interesting properties, it preserves &quot;edges&quot; and is quite robust under large noise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have a model how your signal behaves a &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot;&gt;Kalman filter&lt;/a&gt; is worth a look. Its smoothing is actually a Bayesian maximum likelihood estimation of the signal based on observations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="bdecaf" LastActivityDate="2012-10-15T11:07:31.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4683" PostTypeId="2" ParentId="4680" CreationDate="2012-10-15T14:58:05.293" Score="4" Body="&lt;p&gt;You can find the entire matlab code for smoothing moving average filter for varying lengths of taps.&#xA;www.gaussianwaves.com/2010/11/moving-average-filter-ma-filter-2/&lt;/p&gt;&#xA;" OwnerUserId="3118" LastActivityDate="2012-10-15T14:58:05.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4684" PostTypeId="1" AcceptedAnswerId="4687" CreationDate="2012-10-15T15:08:01.273" Score="14" ViewCount="6233" Body="&lt;p&gt;I'm working in a project where fringes are projected against a subject, and a photo is taken. The task is to find the centerlines of the fringes, which represent, mathematically, the 3D curve of intersection between the fringe plane and the subject surface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The photo is a PNG (RGB), and former attempts used grayscaling then difference thresholding to get a black-and-white, &quot;zebra-like&quot; photography, from which it was easy to find the midpoint of each pixel column of each fringe. The problem is that, by thresholding and also by taking the mean height of a discrete pixel column, we're having some precision loss and quantization, which is not desired at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My impression,  by looking at the images, is that the centerlines could be more continuous (more points) and smoother (not quantized) if they were detected directly from the non-thresholded image (either RGB or grayscale), by some statistical sweeping method (some flooding / iterative convolution, whatever).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is an actual sample image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m0sy7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="1558" LastEditorUserId="698" LastEditDate="2012-10-15T23:11:17.850" LastActivityDate="2014-11-18T12:30:09.803" Title="Finding zebra-like pattern in image (Detection of structured-light fringe centerline from photo)" Tags="|image-processing|peak-detection|image-segmentation|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4685" PostTypeId="2" ParentId="3652" CreationDate="2012-10-15T15:51:44.433" Score="2" Body="&lt;p&gt;Auto-correlation is a very good start.  I've written a brief &lt;a href=&quot;http://voxit.azurewebsites.net/?p=71&quot; rel=&quot;nofollow&quot;&gt;blog post&lt;/a&gt; with an illustration comparing auto-correlation to a simple Fourier transform of the same data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input signal is periodic, the Fourier transform will have a peak at the corresponding frequency.  However, as I describe in the post linked above, it is not a very accurate estimate of that frequency.  Auto-correlation gives you a better estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third method that I've heard about but haven't tried yet is to use overlapping windows.  I think the basic algorithm is this:&#xA;1) Do a Fourier transform of the input, find the strongest peak (absolute value).&#xA;2) Shift the window forward by exactly one wavelength of that strongest peak&#xA;3) Compare the phase (i.e. angle of the complex number) for that frequency in the two Fourier transforms.&#xA;4) Compute a better estimate of wavelenth/phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_0, p_1 $ : Phase of the two frequency components in Radians&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$l$ : Wavelength of the selected frequency component&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$l_{est}$ : Estimate of the wavelength of the true frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$l_{est} = l * (1+\frac{(p_1 - p_0)}{2\pi}) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you shift the window by one wavelength, and it exactly matches the underlying wavelength, then $p_0 = p_1$, and $l$ is a good estimate of the true wavelength.  This happens when the window size is a multiple of the fundamental wavelength.  If the fundamental wavelength is slightly less than that, when you shift the window, the phase of the signal will be greater.  The fundamental is shorter than distinace you've shifted the window, so the phase is greater than it was before, so $p_1 &amp;gt; p_0$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: It's important that you shift the window in the original sample.  If you just rotate the buffer (bringing in the first few samples and putting them at the end), then your fourier transform will be identical and the phase will be shifted by exactly the amount you've rotated the buffer.&lt;/p&gt;&#xA;" OwnerUserId="2032" LastActivityDate="2012-10-15T15:51:44.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4686" PostTypeId="2" ParentId="4684" CreationDate="2012-10-15T16:13:00.100" Score="3" Body="&lt;p&gt;I wouldn't use the RGB image. Color images are typically made by putting a &lt;a href=&quot;http://en.wikipedia.org/wiki/Bayer_filter&quot; rel=&quot;nofollow&quot;&gt;&quot;Bayer Filter&quot;&lt;/a&gt; on the camera sensor, which usually reduces the resolution you can achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use the grayscale image, I think the steps you described (binarize &quot;zebra&quot; image, find midline) are a good start. As a final step, I would&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take each point in the midline you found&lt;/li&gt;&#xA;&lt;li&gt;take the grayvalues of the pixels in the &quot;zebra&quot; line above and below&lt;/li&gt;&#xA;&lt;li&gt;fit a parabola to these grayvalues using least mean squares&lt;/li&gt;&#xA;&lt;li&gt;the apex of this parabola is an improved estimate of the midline position&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-10-15T16:13:00.100" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4687" PostTypeId="2" ParentId="4684" CreationDate="2012-10-15T16:21:39.993" Score="14" Body="&lt;p&gt;I suggest the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find a threshold to separate the foreground from the background.&lt;/li&gt;&#xA;&lt;li&gt;For each blob in the binary image (one zebra stripe), for each &lt;code&gt;x&lt;/code&gt;, find the weighted center (by pixel intensity) in &lt;code&gt;y&lt;/code&gt; direction.&lt;/li&gt;&#xA;&lt;li&gt;Possibly, smooth the &lt;code&gt;y&lt;/code&gt; values, to remove noise.&lt;/li&gt;&#xA;&lt;li&gt;Connect the &lt;code&gt;(x,y)&lt;/code&gt; points by fitting some kind of curve. &lt;a href=&quot;http://www.ag.jku.at/pubs/spl97.pdf&quot; rel=&quot;noreferrer&quot;&gt;This article&lt;/a&gt; might help you. You can also fit a high-level polynomial, though it is worse, in my opinion.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is a Matlab code that shows steps 1,2 and 4. I skipped the automatic threshold selection. Instead I chose manual &lt;code&gt;th=40&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the curves that are found by finding the weighted average per column:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0YIDL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the curves after fitting a polynomial:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/IoIAO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function Zebra()&#xA;    im = imread('https://i.stack.imgur.com/m0sy7.png');&#xA;    im = uint8(mean(im,3));&#xA;&#xA;    th = 40;&#xA;    imBinary = im&amp;gt;th;&#xA;    imBinary = imclose(imBinary,strel('disk',2));&#xA;    % figure;imshow(imBinary);&#xA;    labels = logical(imBinary);&#xA;    props =regionprops(labels,im,'Image','Area','BoundingBox');&#xA;&#xA;    figure(1);imshow(im .* uint8(imBinary));&#xA;    figure(2);imshow(im .* uint8(imBinary));&#xA;&#xA;    for i=1:numel(props)&#xA;        %Ignore small ones&#xA;        if props(i).Area &amp;lt; 10&#xA;            continue&#xA;        end&#xA;        %Find weighted centroids&#xA;        boundingBox = props(i).BoundingBox;&#xA;        ul = boundingBox(1:2)+0.5;&#xA;        wh = boundingBox(3:4);&#xA;        clipped = im( ul(2): (ul(2)+wh(2)-1), ul(1): (ul(1)+wh(1)-1) );&#xA;        imClip = double(props(i).Image) .* double(clipped);&#xA;        rows = transpose( 1:size(imClip,1) );&#xA;        %Weighted calculation&#xA;        weightedRows  = sum(bsxfun(@times, imClip, rows),1) ./ sum(imClip,1);&#xA;        %Calculate x,y&#xA;        x = ( 1:numel(weightedRows) ) + ul(1) - 1;&#xA;        y = ( weightedRows ) + ul(2) - 1;&#xA;        figure(1);&#xA;        hold on;plot(x,y,'b','LineWidth',2);&#xA;        try %#ok&amp;lt;TRYNC&amp;gt;&#xA;            figure(2);&#xA;            [xo,yo] = FitCurveByPolynom(x,y);&#xA;            hold on;plot(xo,yo,'g','LineWidth',2);&#xA;        end&#xA;        linkaxes( cell2mat(get(get(0,'Children'),'Children')) )&#xA;    end        &#xA;end&#xA;&#xA;function [xo,yo] = FitCurveByPolynom(x,y)&#xA;   p = polyfit(x,y,15); &#xA;   yo = polyval(p,x);&#xA;   xo = x;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-10-15T18:26:25.443" LastActivityDate="2012-10-15T18:26:25.443" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4689" PostTypeId="2" ParentId="4680" CreationDate="2012-10-15T19:44:57.000" Score="4" Body="&lt;p&gt;Smoothing implies using information from neighboring samples in order to change the relationship between neighboring samples.  For finite vectors, at the ends, there is no neighboring information to one side.  Your choices are: don't smooth/filter the ends, accept a shorter resulting smoothed vector, make up data and smooth with that (depends on the accuracy/usefulness of any predictions off the ends), or maybe using different asymmetric smoothing kernels at the ends (which ends up shortening the information content in the signal anyway).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-10-15T19:44:57.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4690" PostTypeId="2" ParentId="1932" CreationDate="2012-10-16T11:04:44.893" Score="7" Body="&lt;p&gt;Another way using a bandpass filter (in MATLAB). Playing around with the difference of Gaussian parameters may give better results. The process is basically bandpass filter the image to remove the low frequency background blobs, normalise to [0,1] required for 'graythresh' command, threshold image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Load image and convert to grayscale double:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('hw.jpg');&#xA;I = rgb2gray(I);&#xA;I = double(I);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AsGZr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filter using difference of Gaussian kernel and normalise:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;J = imgaussian(I,1.5) - imgaussian(I,0.5);&#xA;J = J - min(J(:));&#xA;J = J / max(J(:));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O7rPd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate threshold and make 010101:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T = J &amp;gt; graythresh(J);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MYJrA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2012-10-16T11:04:44.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4691" PostTypeId="1" AcceptedAnswerId="4692" CreationDate="2012-10-16T11:45:46.277" Score="27" ViewCount="32513" Body="&lt;p&gt;The power spectrum of a signal can be calculated by taking the magnitude squared of its Fourier transform. Being an audio person, the signal of interest for me would be a time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this representation differ from a PSD (power spectral density), and importantly, in what practical situations should one use a PSD instead of the power spectrum described above?&lt;/p&gt;&#xA;" OwnerUserId="1024" LastEditorUserId="1024" LastEditDate="2012-10-16T13:39:20.277" LastActivityDate="2018-11-22T08:56:44.400" Title="What is the difference between PSD and squared magnitude of frequency spectrum?" Tags="|fft|frequency-spectrum|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4692" PostTypeId="2" ParentId="4691" CreationDate="2012-10-16T13:25:38.453" Score="35" Body="&lt;p&gt;The power spectral density describes the density of power in a stationary random process &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; per unit of frequency. By the &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem&quot; rel=&quot;noreferrer&quot;&gt;Wiener-Khinchin theorem&lt;/a&gt;, it can be calculated as follows for a &lt;a href=&quot;http://en.wikipedia.org/wiki/Wide-sense-stationary_random_process#Weak_or_wide-sense_stationarity&quot; rel=&quot;noreferrer&quot;&gt;wide-sense stationary&lt;/a&gt; random process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_{xx}(f) = \int_{-\infty}^{\infty} r_{xx}(\tau) e^{-j2\pi f \tau} d\tau&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$r_{xx}(\tau)$&lt;/span&gt; is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation_function&quot; rel=&quot;noreferrer&quot;&gt;autocorrelation function&lt;/a&gt; of the process &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;r_{xx}(\tau) = \mathbb{E}\left(X(t)X(t - \tau)\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is only valid for a wide-sense stationary process because its autocorrelation function is only a function of the time lag &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; and not the absolute time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;; stated differently, this means that its second-order statistics don't change as a function of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, if you have a sufficiently-detailed and accurate statistical model for your signal, then you can calculate its power spectral density using the relationship above. As an example, this can be used to calculate the power spectral density of communications signals, given the statistics of the information symbols carried by the signal and any pulse shaping employed during transmission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most practical situations, this level of information is not available, however, and one must resort to &lt;em&gt;estimating&lt;/em&gt; a given signal's power spectral density. One very straightforward approach is to take the squared magnitude of its Fourier transform (or, perhaps, the squared magnitude of several &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;short-time Fourier transforms&lt;/a&gt; and average them) as the estimate of the PSD. However, assuming that the signal you're observing contains some stochastic component (which is often the case), this is again just an &lt;em&gt;estimate&lt;/em&gt; of what the true underlying PSD is based upon a single realization (i.e. a single observation) of the random process. Whether the power spectrum that you calculate bears any meaningful resemblance to the actual PSD of the process is situation-dependent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2096/why-so-many-methods-of-computing-psd&quot;&gt;As this previous post notes&lt;/a&gt;, there are many methods for PSD estimation; which is most suitable depends upon the character of the random process, any &lt;em&gt;a priori&lt;/em&gt; information that you might have, and what features of the signal you're most interested in.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="39032" LastEditDate="2018-11-22T08:56:44.400" LastActivityDate="2018-11-22T08:56:44.400" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4693" PostTypeId="1" AcceptedAnswerId="4694" CreationDate="2012-10-16T15:32:47.263" Score="7" ViewCount="17136" Body="&lt;p&gt;I'm writing a C function to generate bandpass FIR filter coefficients using a simple window method (more details here &lt;a href=&quot;http://www.labbookpages.co.uk/audio/firWindowing.html&quot; rel=&quot;noreferrer&quot;&gt;FIR filters by windowing&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important code snippet is the following (f1 and f2 are the low and high bandpass frequency, fs is the sampling frequency, all in hz, M is the taps number, the M coeffs are in h[0..M-1])&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double* band_pass (double f1, double f2, double fs, int M) {&#xA;    double* h = (double*)calloc(M,sizeof(double));&#xA;    double w1 = 2.0*PI*f1/fs;&#xA;    double w2 = 2.0*PI*f2/fs;&#xA;    int MHALF = (M-1)/2;&#xA;    for (int n=0; n&amp;lt;MH; n++) {&#xA;        h[n] = (sin((n-MHALF)*w2) - sin((n-MHALF )*w1) ) / ((n-MHALF )*PI);&#xA;            h[n] = h[n] * (0.54-0.46*cos(2*PI*n/(M-1)));&#xA;        }&#xA;        h[M-n-1] = h[n];&#xA;    }&#xA;    h[MHALF ] = (w2 - w1) / PI;&#xA;    return h;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The coefficients (and so the filter) seem to work fine, but the gain in the bandpass isn't always unitary. I suppose I have to scale all the coefficients to obtain a unitary gain (in the bandpass).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is: how do I scale the coefficients ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Googling a bit I've found this formula for calc the BP filter gain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gain += 2*h[n]*cos((n-MHALF)*(w1+w2)/2.);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I have to divide all the coeffs for this gain.&#xA;If it's correct, where does the formula come from and which are the formulas for the gain of the others kind of window fir filters LP, HP, bandstop ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="1884" LastActivityDate="2013-11-04T17:08:46.187" Title="FIR filter gain" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4694" PostTypeId="2" ParentId="4693" CreationDate="2012-10-16T15:51:03.263" Score="19" Body="&lt;p&gt;If you want the gain of your length-$N$ filter to be unity at a particular frequency, then you can calculate it directly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G = \sum_{k=0}^{N-1} h[k] e^{-j\omega k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$G$ gives the gain of your filter at the frequency $\omega \in [0, 2\pi)$. If you would like to normalize the filter so that its gain at that frequency is $1$, then divide all of the filter coefficients by $G$. You would probably want to choose $\omega$ to lie in the middle of your passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll often see this for lowpass filters where you would like to have unity gain at DC. In that case, the formula simplifies to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G = \sum_{k=0}^{N-1} h[k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. $G$ is just the sum of the filter coefficients.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-10-16T15:51:03.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4695" PostTypeId="1" AcceptedAnswerId="36724" CreationDate="2012-10-17T08:28:34.297" Score="4" ViewCount="411" Body="&lt;p&gt;It is a natural idea to substitute our scanner with mobile phone, and perform OCR with the phone at the same time. If this can come true, two problems must be tackled: one is related to document image binarization, and the other is related to geometric distortion correction. Among all the distortions, projective distortion is most common, and in order to correct this kind of distortion usually the horizontal vanishing point and vertical vanishing point must be identified. There are many different ways to obtain the vanishing points, and different methods can lead to different vanishing points. Then my question is given several candidate vanishing points (horizontal vanishing points, for example) how can we select the best one? Of course we can get the projective transform model based on each vanishing point, and then correct the distorted image. Visual evaluation the corrected image can tell which vanishing point is better. But could I find the best vanishing point just before the correction? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1674" LastEditorUserId="7338" LastEditDate="2017-01-05T16:00:17.657" LastActivityDate="2017-01-05T16:00:17.657" Title="Document image vanishing point detection and evaluation" Tags="|image-processing|computer-vision|ocr|optical-char-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4696" PostTypeId="2" ParentId="3584" CreationDate="2012-10-17T09:35:51.943" Score="5" Body="&lt;p&gt;According to Michael McCoy on &lt;a href=&quot;http://www.linkedin.com/e/1pftv1-h84ydu4f-2v/vaq/172754620/683737/98766203/view_disc/?hs=false&amp;amp;tok=06TM_7g1tHj5s1&quot; rel=&quot;noreferrer&quot;&gt;LinkedIn&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best bound for Gaussian matrices is in: W. Xu and B. Hassibi, Precise Stability Phase Transitions for l1 Minimization: A Unified Geometric Framework, IEEE Trans. Inf. Theory. Oct. 2011&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See, for example, the curves in Fig. 1.&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2012-10-17T09:35:51.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4697" PostTypeId="1" AcceptedAnswerId="4700" CreationDate="2012-10-17T21:06:08.710" Score="1" ViewCount="858" Body="&lt;p&gt;Given the history of the sum of a time-varying mixture of periodic signals, say square waves, how would you efficiently estimate the number and frequencies of components active at a particular time? The amplitudes and frequencies of the components are arbitrary but fixed real numbers; if a component is active at a certain moment, it will retain its amplitude and frequency if it is active again.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-10-18T00:59:15.543" Title="Time-frequency analysis of non-sinusoidal periodic signals" Tags="|time-frequency|decomposition|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4698" PostTypeId="2" ParentId="4667" CreationDate="2012-10-17T21:36:07.477" Score="3" Body="&lt;p&gt;You use a spectrogram (time-frequency analysis) if you need to know &lt;em&gt;when&lt;/em&gt; a frequency component is active, and a frequency spectrum when you don't. The drawback of using a spectrogram is that it has less spectral resolution. The time-frequency trade-off is the well known Heisenberg &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Uncertainty_principle&quot; rel=&quot;nofollow&quot;&gt;uncertainty principle&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2012-10-17T21:36:07.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4699" PostTypeId="1" AcceptedAnswerId="4701" CreationDate="2012-10-18T00:51:11.617" Score="7" ViewCount="1370" Body="&lt;p&gt;Please help me understand smoothing of data. This is a follow up to my previous question &lt;a href=&quot;https://dsp.stackexchange.com/questions/4680/what-is-smoothing-in-very-basic-terms&quot;&gt;posted here&lt;/a&gt;. Especially the top answer by Junuxx where he says a way of smoothing a function $f(x)$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f'[t] = 0.1 f[t-1] + 0.8 f[t] + 0.1 f[t+1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here we can see that for every point in $f[x]$, we are taking a weighted average of that point and its two adjacent points, to get a smoothed version of $f[t]$ called $f'[t]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A paper on speech enhancement explains that an equation of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[i] = a[i]y[i-1] + (1 - [i]) x[i]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;helps us get the value of y as a recursive smoothing of x. Here $a[i]$ acts as a smoothing parameter and it is itself calculated as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a[i] = \alpha + (1 - \alpha)p[i]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $p[i]$ is calculated elsewhere and alpha is a constant. $y[i]$, $a[i]$, and $x[i]$ are all arrays with $i$ elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I relate this equation of $y[i]$ with the equation of $f'[t]$? Both of them are for smoothing data, however equation for $f'[t]$ contains weighted average of consecutive points in the array for $f[x]$ itself while the equation for $y[i]$ does not contain consecutive data points for $x[i]$. How can we comprehend this equation as a smoothing of data in $x$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this question is not relevant when the equations are taken out of context then I will be happy to provide more details.&lt;/p&gt;&#xA;" OwnerUserId="3121" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2012-12-13T13:11:24.900" Title="how does this equation correspond to smoothing?" Tags="|speech-recognition|smoothing|speech|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4700" PostTypeId="2" ParentId="4697" CreationDate="2012-10-18T00:53:10.603" Score="3" Body="&lt;p&gt;Let us start with the unsupervised methods...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A first approach would be to compute a spectrogram and factorize it with NMF (&lt;a href=&quot;http://en.wikipedia.org/wiki/Non-negative_matrix_factorization&quot; rel=&quot;nofollow&quot;&gt;Non-negative Matrix Factorization&lt;/a&gt;). If you are unfamiliar with this technique, it decomposes a spectrogram into a sum of $k$ constant-spectrum sources, each of these having a time-varying amplitude envelope applied to them. This model perfectly suits your problem and there is a good chance that the columns of the decomposition will be spectra for each  waveform/frequency pair (from which you can estimate a fundamental frequency through spectral sum or by turning it back into an autocorrelation function), and the rows will be the activation signals. There are many implementation out there and it's cheap to just throw your problem at it, there's a good chance it'll just work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the underlying model of NMF is less restrictive than your signal model...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, because your activation envelopes are either 0 or 1. I haven't dealt with such constraints in the past, but there's probably a way of defining a penalty measure on the terms of the activation matrix $W$ different from 0 and 1, adding that to the optimized criterion and derive a new set of multiplicative update equations. One constraint not mentioned in your comment is that you probably also assume that the sources are not &quot;blinking&quot; in and out rapidly, and stay active/inactive, for a rather long number of consecutive frames. Constraints can be added to NMF to penalize discontinuous activation envelopes. See &lt;a href=&quot;http://www.cs.tut.fi/sgn/arg/music/tuomasv/virtanen_taslp2007.pdf&quot; rel=&quot;nofollow&quot;&gt;Virtanen's paper on continuity constraints&lt;/a&gt; for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second specificity of your problem is that you might want to make the assumption that all sources have the same waveform, that is to say, that all sources have the same log-frequency spectrum, modulo a translation. To address this specifity, a recommended technique is to compute a constant-Q spectrogram on your input data (which has the right shift-invariance), and perform a &lt;a href=&quot;http://homepage.eircom.net/~derryfitzgerald/SSP05.pdf&quot; rel=&quot;nofollow&quot;&gt;shifted-NMF&lt;/a&gt;, with &lt;em&gt;one&lt;/em&gt; target source. This will recover the spectrum common to all your sources; and the spectral shifts and temporal activation matrix will provide the equivalent of a spectrogram tailored to your source spectrum. See the synthetic signal in the results section of this paper - this is &lt;strong&gt;exactly&lt;/strong&gt; the signal model you describe. This might require some work, but you could probably tweak this method as well to your more rigid signal model in which the activations are either 0 or 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now on to the supervised methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the set of candidate waveforms is known in advance and small and/or the number of frequencies at which they can appear is small (say you want to transcribe music played on a 80s toy keyboard), you could afford matching pursuit. This will correlate your signal with impulse responses consisting of a windowed signal for all searched waveforms/frequencies pair. Computational costs might rapidly make it a bad choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another supervised method is to use the same kind of multiplicative gradient updates as for NMF, but keeping the matrix $W$ containing the spectral templates &quot;locked&quot;. That is to say, you build a matrix W with all candidate spectra you want to probe, and perform your multiplicative update to decompose your spectrogram into a product of an activation matrix H and W. Again, update rules tweakable to include the binary activation constraints. See Bertin's work on piano transcription which uses this technique to factorize spectrograms into a sum of synthetic piano note spectrograms (&lt;a href=&quot;http://biblio.telecom-paristech.fr/cgi-bin/download.cgi?id=7663&quot; rel=&quot;nofollow&quot;&gt;a good start here&lt;/a&gt;). This has also been used for &lt;a href=&quot;http://www.eurasip.org/Proceedings/Eusipco/Eusipco2005/defevent/papers/cr1410.pdf&quot; rel=&quot;nofollow&quot;&gt;drum transcription by Paulus&lt;/a&gt; - using drum samples as a basis.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-10-18T00:59:15.543" LastActivityDate="2012-10-18T00:59:15.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4701" PostTypeId="2" ParentId="4699" CreationDate="2012-10-18T01:32:59.127" Score="11" Body="&lt;p&gt;The first equation you give is the difference equation for a &lt;a href=&quot;http://en.wikipedia.org/wiki/Lowpass_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;lowpass&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response&quot; rel=&quot;nofollow noreferrer&quot;&gt;FIR filter&lt;/a&gt;, or a linear filter with an impulse response that is finite in duration. I'll write it a bit differently (so that it is expressly discrete in time and &lt;a href=&quot;http://en.wikipedia.org/wiki/Causal_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;causal&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_s[n] = 0.1 f[n-2] + 0.8 f[n-1] + 0.1 f[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_s[n]$ is the smoothed version of the discrete-time input sequence $f[n]$, generated by passing $f[n]$ through an FIR filter with the coefficients $[0.1, 0.8, 0.1]$. The frequency response of this filter is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oLAkS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it turns out, it's not a very good lowpass filter. As the name implies, a lowpass filter should pass low-frequency content while removing higher frequencies. This provides the &quot;smoothing&quot; action that you're looking for, as &quot;jagged&quot;, non-smooth features are associated with high frequencies since they change rapidly with time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your second equation is an example of a lowpass &lt;a href=&quot;http://en.wikipedia.org/wiki/Iir_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;IIR filter&lt;/a&gt;, a linear filter whose impulse response is infinite in duration. The filter's difference equation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = \alpha y[n-1] + (1-\alpha) x[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is the filter input and $y[n]$ is the filter output. This type of filter is often used as a low-complexity lowpass filter and is often called a &lt;a href=&quot;http://www.claysturner.com/dsp/Leaky%20Integrator.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;leaky integrator&lt;/a&gt;. It is favored because of its simple implementation, low computational complexity, and its tunability: its cutoff frequency depends upon the value of $\alpha$. $\alpha$ can take on values on the interval $[0,1)$. $\alpha = 0$ yields no filtering at all (the output is equal to the input); as $\alpha$ increases, the cutoff frequency of the filter decreases. You can think of $\alpha = 1$ as a boundary case where the cutoff frequency is infinitely low (the filter output is zero for all time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, if $\alpha = 0.8$, the frequency response of the filter is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fG3MR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a better filter than your FIR example; it yields much better attenuation of frequencies toward the upper end of the band. Even though it might not be obvious by looking at the difference equation (because of the feedback from the filter output back to its input), it effectively performs smoothing on the input due to its lowpass nature. I'm not sure if this description will be particularly meaningful to you for your application, but these are pretty fundamental signal processing concepts; some study of introductory DSP texts could help fill in the gaps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; By request, here's a plot that shows both responses on the same axes, illustrating the relatively poor attenuation provided by the FIR example filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ncRO7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-10-18T12:42:41.640" LastActivityDate="2012-10-18T12:42:41.640" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4702" PostTypeId="1" AcceptedAnswerId="4773" CreationDate="2012-10-18T05:46:10.200" Score="2" ViewCount="322" Body="&lt;p&gt;I know I will have a 10% error rate, but this errors are truly random. I was using solomon reed codes, but if a single bit in the code or parity word is bad the whole word becomes useless. If I have eight bytes of data and eight bytes of parity codes then 5 bit error can make my whole message bad. Is there a better algorithm for cases like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to send packets of 128bit or 16bytes. 1/2 is data 1/2 is parity. I am having trouble figuring out how LDPC would be more beneficial. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have the same 16bytes with 8 bytes of parity and 8 bytes of data how ldpc be better? For example suppose with my example I have 1 bit errors in 5 different bytes. This would make SR unable to decode my data. Would it be the same LDPC or would it be able to recover that. From would I understand from LDPC it would still be unable to decode it. &lt;/p&gt;&#xA;" OwnerUserId="1912" LastEditorUserId="1912" LastEditDate="2012-10-21T21:47:16.500" LastActivityDate="2012-10-24T02:58:17.437" Title="A good ecc algorithm for random errors?" Tags="|reed-solomon|ecc|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4703" PostTypeId="2" ParentId="3619" CreationDate="2012-10-18T08:12:37.660" Score="1" Body="&lt;p&gt;If you have a reference loudspeaker with a frequency spectrum that is known (i.e. measured in an anechoic chamber with calibrated equipment), then you can derive an estimate of the frequency response of any other speaker in an echoic environment (assuming everything in the measurement environment behaves linearly).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set up speaker and microphone positions and keep these fixed.    &lt;/li&gt;&#xA;&lt;li&gt;Measure the impulse response of the reference in situ (most reliably&#xA;achieved using MLS in my experience)&lt;/li&gt;&#xA;&lt;li&gt;Calculate the frequency response of the amplifier/speaker/room/mic/mic-amp by taking the Fourier transform of the impulse response&lt;/li&gt;&#xA;&lt;li&gt;Perform spectral subtraction of your calibrated speaker values and your measurement to give you your &quot;measurement environment response&quot;.&lt;/li&gt;&#xA;&lt;li&gt;Obtain the combined frequency response of the speaker under test using steps 1 to 3.&lt;/li&gt;&#xA;&lt;li&gt;Subtract the measurement environment frequency response from this value to give you your estimate.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It is theoretically possible, but there are lots of places where this method can go wrong which is why direct measurement in an anechoic environment is the ideal choice. I don't think the foam box will be suitably anechoic!&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-10-18T08:12:37.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4704" PostTypeId="1" CreationDate="2012-10-18T08:21:52.437" Score="6" ViewCount="182" Body="&lt;p&gt;I have two sensors that measure speed $v(t)$ of a moving vehicle. The first sensor produces a signal $f(t)$ which is a very accurate estimation of speed. However, it only works for slow to moderate speeds and beyond a certain limit, it simply fails to report anything. Let's assume we can model this behavior with an additional output of this sensor using signal $h(t)$, which is $1$ while $f(t)$ is valid and is $0$ when $f(t)$ is invalid. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the second sensor produces signal $g(t)$ for all speeds but it is not particularly accurate. When $h(t)$ is 1, i.e. when speed is low and the first sensor produces perfect results via $f(t)$, the signal from the second sensor could be modeled as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation 1: $g(t) = \beta_{0}(t) + \beta_{1}(t)v(t) + \epsilon$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameters for this linear relationship, $\beta_{0}$ and $\beta_{1}$ are unknown. All we know is that they vary very slowly over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the problem is to estimate $v(t)$ given the 3 signals $f,h,g$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One solution is of course to forget about $g(t)$ and just report the last value of $f(t)$ when it becomes invalid. Effectively, it means to saturate the output at a certain high speed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, my initial idea was to use a form of rolling linear regression to estimate the $\beta$ parameters with a fixed window size $w$: When $h(t)$ is $1$, I simply report $f(t)$ and update $\beta_{0}$ and $\beta_{1}$. When it is $0$, I report a $\hat{v}(t)$ estimated using $g(t)$ and the last calculated $\beta$ coefficients. This is obviously very slow since I have to solve a linear regression at each sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;1&lt;/strong&gt;) Does the idea of using rolling linear regression make sense? If yes, how can I do it fast?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;2&lt;/strong&gt;) Would it be possible to something like a Kalman filter to solve this problem? I'm not sure how to express this problem in a linear state-space model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;3&lt;/strong&gt;) I guess the most challenging question would be what to do in the case that $f(t)$ is quantized (e.g. an integer value) while $v(t)$ and $g(t)$ are not. I guess we might be able to simulate it by assuming a uniform distribution for $\epsilon$ in equation 1. &lt;/p&gt;&#xA;" OwnerUserId="3125" LastEditorUserId="3125" LastEditDate="2012-10-18T08:31:08.527" LastActivityDate="2012-10-19T19:26:33.710" Title="How to combine a perfect signal with a limited dynamic range with a poor one with high dynamic range?" Tags="|kalman-filters|state-space|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4708" PostTypeId="1" AcceptedAnswerId="4712" CreationDate="2012-10-18T11:48:19.077" Score="8" ViewCount="637" Body="&lt;p&gt;I need to output a data stream at $40\textrm{ kbit/s}$ or faster out of a computer system whose only accessible output peripheral is the audio interface. This interface has reasonable specs, $96\textrm{ kHz}$ sample rate, with $24$-$\textrm{bit}$ resolution, but the output stage is AC-coupled. Only one output channel is available. A good assumption would be that it behaves like a band-pass filter with a $4\textrm{ Hz}$ to $40\textrm{ kHz}$ pass-band with less than $-1\textrm{ dB}$ attenuation; and that it has a $90\textrm{ dB}$ SNR. I don't have any other complexity constraint on the emitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not expect additional noise / attenuation on the cable connecting the emitter to the receiver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The receiver is an embedded system with a $120\textrm{ MHz}$ Cortex-M3 MCU. If necessary, similar audio acquisition performance can be assumed. An additional dedicated demodulation chip (if there exists such a thing for such low frequencies) could be an option.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Which digital modulation scheme would be suitable for this situation? &lt;/li&gt;&#xA;&lt;li&gt;Are there already code libraries (software defined radio libs?) that would prevent me from reinventing the wheel? &lt;/li&gt;&#xA;&lt;li&gt;Are there existing applications with similar constraints at which I could look for inspiration?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="1629" LastEditDate="2016-06-07T20:02:59.270" LastActivityDate="2016-06-07T20:02:59.270" Title="Which digital modulation scheme would be suitable for transmitting digital data through the output of a PC soundcard" Tags="|demodulation|digital-communications|embedded-systems|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4709" PostTypeId="1" CreationDate="2012-10-18T12:26:13.283" Score="1" ViewCount="637" Body="&lt;p&gt;What are Method to phase shift 50 Hz digital signal using microcontroller. Appart from storage of samples to array and shift sample wise,how to shift this signal fractionally.&lt;/p&gt;&#xA;" OwnerUserId="3129" LastActivityDate="2012-10-22T05:14:10.977" Title="Phase shifting of 50Hz signal" Tags="|discrete-signals|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4710" PostTypeId="1" CreationDate="2012-10-18T12:31:21.217" Score="1" ViewCount="582" Body="&lt;p&gt;I want to calculate a coef of image pixelation to remove bad pictures from a bunch of files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some pictures results from bad compression and we can see a lot of pixelation on them like img a here: &lt;a href=&quot;https://i.stack.imgur.com/EPOBI.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/EPOBI.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have heard of Fourier transform to calculate repetitive pattern, maybe it can be used in this case to detect pixel square ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any kind of code making it possible is welcome.&lt;/p&gt;&#xA;" OwnerUserId="3130" LastActivityDate="2012-10-18T12:31:21.217" Title="Use fourier transform to calculate image pixelation coef in python" Tags="|image-processing|fourier-transform|python|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4712" PostTypeId="2" ParentId="4708" CreationDate="2012-10-18T13:58:58.673" Score="8" Body="&lt;p&gt;You've got a pretty good set of circumstances here; you should be able to meet your goal without too much trouble. I don't see anything in your description that would eliminate a whole class of modulation (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-shift_keying&quot; rel=&quot;noreferrer&quot;&gt;phase-shift keying&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency-shift_keying&quot; rel=&quot;noreferrer&quot;&gt;frequency-shift keying&lt;/a&gt;, etc.). Some of the factors that would go into the choice of a suitable format would include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The required &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_efficiency&quot; rel=&quot;noreferrer&quot;&gt;spectral efficiency&lt;/a&gt; (i.e. how much data throughput you need relative to the available bandwidth)&lt;/li&gt;&#xA;&lt;li&gt;The complexity requirements for your receiver (which is usually the most complicated part of the system)&lt;/li&gt;&#xA;&lt;li&gt;How much effort you're willing to put into developing the implementation.&lt;/li&gt;&#xA;&lt;li&gt;Other circumstances specific to your application (e.g. if you have poor timing accuracy at one or both ends, known interference, or a poor channel response)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So, ticking these off one by one for your system, we can come up with a few guidelines:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It seems that your biggest constraint is your channel response (which is limited by your sound card's DAC). If you have 40 kHz of one-sided bandwidth available, then you're going to be limited to a symbol rate that is somewhat below that. For a target data rate of at least 40 kilobits per second, you'll want some scheme that transmits multiple bits per symbol.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Provided that your embedded platform isn't loaded down with too many other functions, a modern 120-MHz ARM processor should easily be able to handle demodulation of most any format in the tens-of-kilobits-per-second range.&lt;/p&gt;&#xA;&lt;p&gt;I'm not sure specifically which model you're running with, but many recent processors provide very tight integration of onboard ADCs with the memory and interrupt subsystem, perhaps allowing you to (without manual CPU intervention) automatically sample the input signal at a specified rate, store the samples in onboard memory, and trigger a processor interrupt only when a certain-sized block of samples is available to be processed. I know that some Atmel devices at a minimum provide this sort of functionality; I've had good success with them in the past.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I assume that this is probably one component of some larger system, so you don't want to have to build something really complex in order to meet your requirements. Luckily, based upon what you've said, I think you should be able to implement something that meets your requirements pretty simply. I assume that since the two devices are cabled together, you're likely to have a very high signal-to-noise ratio (40 dB or greater), which for digital modulations is typically measured as &lt;a href=&quot;http://en.wikipedia.org/wiki/Eb/N0&quot; rel=&quot;noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{E_b}{N_0}$&lt;/span&gt;&lt;/a&gt;. That makes life much easier, as you likely could skip additions like error-correction encoding altogether (or at least implement a very simple scheme that would catch the very infrequent errors that you would expect at such an SNR).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As far as special circumstances go, for this system, I wouldn't expect much of any. I would expect the oscillator accuracy on the PC side to be pretty good (at a minimum &lt;a href=&quot;http://en.wikipedia.org/wiki/Crystal_oscillator&quot; rel=&quot;noreferrer&quot;&gt;crystal-controlled&lt;/a&gt;, so you're in the range of &amp;lt;50 ppm or so; possibly much better if the oscillator is calibrated using some other more precise source). The embedded side is likely to be the same; I assume you're using a crystal oscillator as the clock source. Since the two ends are cabled together, I'll assume that you don't have interference of note.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So, smashing all of these together into a single recommendation, I would probably start down the path of a &lt;a href=&quot;http://en.wikipedia.org/wiki/QPSK#Quadrature_phase-shift_keying_.28QPSK.29&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;quadrature phase-shift keying (QPSK) approach at 24 kilosymbols per second&lt;/strong&gt;&lt;/a&gt;. At 2 bits per symbol, this yields a data rate of 48 kilobits per second, which is in excess of your requirement. This particular rate makes your implementation a bit easier; since the output DAC is running at 96 kHz, this results in 4 samples per symbol (it's always easier to run at an integer number of samples per symbol time). I would probably try to design the embedded side so that it would sample at the same 96 kHz rate if possible; this avoids the need to do any resampling on the more resource-starved end.&lt;/p&gt;&#xA;&lt;p&gt;To avoid any problems with the DC notch that your sound card DAC employs, you could modulate the QPSK signal onto a carrier at 24 kHz. Then, the modulated signal's spectrum would have a null at DC, which would line up with your notch. It's possible that the notch could end up not being a problem at all (especially if it is truly just a few Hz wide as your suggested). In that case, you could potentially get by with an even simpler scheme that just works at baseband, bypassing carrier modulation altogether.&lt;/p&gt;&#xA;&lt;p&gt;QPSK is a good choice because of its simplicity, both at the transmitter and receiver. At your SNR, you could accomplish greater spectral efficiency using a more complicated scheme like &lt;a href=&quot;http://en.wikipedia.org/wiki/Qam&quot; rel=&quot;noreferrer&quot;&gt;quadrature amplitude modulation (QAM)&lt;/a&gt;, but the constant-envelope property of PSK signals is attractive from a receiver complexity standpoint. As a note, if you truly needed more bits per symbol in the future, you could move to a higher-order PSK constellation like 8- or 16-PSK. However, these are suboptimal from a bit-error-rate performance standpoint when compared to QAM constellations.&lt;/p&gt;&#xA;&lt;p&gt;As far as a library implementation goes, I'm not aware of anything that you would just be able to drop in and go, especially for an embedded platform. Your receiver implementation is likely to be tied in with the hardware interface to some extent. You may be able to find some existing implementations for the various steps required for the demodulator, but you'll need to at least tweak what you might find to work well on your platform. The &lt;a href=&quot;http://gnuradio.org&quot; rel=&quot;noreferrer&quot;&gt;GNU Radio&lt;/a&gt; project is a good place to look if you just want to see C++ implementations of many different communications signal processing operations, and it might even yield a useful framework for implementing the transmitter onboard your PC. As a summary, the high-level steps that your receiver would need to do would include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If a nonzero carrier frequency was used:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Frequency synchronization: locate and track the carrier frequency offset due to oscillator mismatches between the transmitter and receiver (in many cases, that frequency offset will be approximately constant over time)&lt;/li&gt;&#xA;&lt;li&gt;Carrier demodulation: translate the signal to baseband, yielding two in-phase and quadrature (I/Q) signals (often expressed as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Baseband#Equivalent_baseband_signal&quot; rel=&quot;noreferrer&quot;&gt;complex baseband signal&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Matched filtering: pass the baseband signal through a filter matched to the pulse shape used at the transmitter (you can likely get away with a rectangular pulse)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Timing synchronization: locate and track the times that correspond to symbol transitions; this can be done by tracking the peak locations in the matched filter output modulo the symbol time&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bit slicing: convert the matched filter outputs at symbol sample times to hard bit decisions&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Serialization: make sure you write the multiple bits per symbol out in the right order!&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This might sound like a complicated process, but building a practical receiver for even a simple situation like this can be very illuminating. Just comment if there's anything else I left out.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-10-18T13:58:58.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4714" PostTypeId="1" CreationDate="2012-10-18T14:54:39.650" Score="0" ViewCount="955" Body="&lt;p&gt;I'm trying to get an LPC magnitude spectrum to match to an FFT magnitude spectrum.  Basically I want the peak height in the LPC Spectrum to match the peak height in the FFT Spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to numerical recipes I have  some code that produces me an LPC spectrum with what looks like the correct shape.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bool CLPC::BuildMagitudeSpectrumFromLPC( float* pOutSpec, unsigned int outSpecSize )&#xA;{&#xA;    int spec    = 0;&#xA;    while( spec &amp;lt; outSpecSize )&#xA;    {&#xA;        const float theta = (M_PI * 2.0f) * ((1.0f / (outSpecSize * 2)) * spec);&#xA;        const float wpr   = cosf( theta );&#xA;        const float wpi   = sinf( theta );&#xA;&#xA;        float sumR  = 1.0f;&#xA;        float sumI  = 0.0f;&#xA;&#xA;        float wR    = 1.0f;&#xA;        float wI    = 0.0f;&#xA;        int i   = 0;&#xA;        while( i &amp;lt; mNumLPC )&#xA;        {&#xA;            const float wTemp = wR;&#xA;            wR      = wR * wpr - wI     * wpi;&#xA;            wI      = wI * wpr + wTemp  * wpi;&#xA;&#xA;            sumR    -= mLPCs[i] * wR;&#xA;            sumI    -= mLPCs[i] * wI;&#xA;            i++;&#xA;        }&#xA;&#xA;        pOutSpec[spec] = mMeanSquareError / (sumR * sumR + sumI * sumI);&#xA;        spec++;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Its worth noting that I manually re-scale it to a dB scale elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem appears to be that I can't figure out the scaling on this spectrum.  The above code returns values of greater than 1 (at seemingly the correct peak locations) for values that are not greater than 0dBFS on the FFT magnitude spectrum.  When I overlay the 2 the toughs also appear to be too high as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone any idea how to get the peak heights and troughs to correspond between the 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm NOT windowing before passing to the LPC.  Should I be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aso, Am I right in thinking that this line is a bit odd:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; pOutSpec[spec] = mMeanSquareError / (sumR * sumR + sumI * sumI);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would have thought I'm taking the absoloute of the complex number represented by sumR and sumI.  Wouldn't this mean calling sqrt on it? ie.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; pOutSpec[spec] = mMeanSquareError / std::sqrt( sumR * sumR + sumI * sumI );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing the above doesn't help my problem all it does is squash up the LPC spectrum somewhat ...&lt;/p&gt;&#xA;" OwnerUserId="333" LastEditorUserId="333" LastEditDate="2012-10-18T14:59:42.967" LastActivityDate="2012-11-23T04:54:03.127" Title="Matching an LPC Magnitude Spectrum to FFT Magnitude Spectrum" Tags="|fft|lpc|magnitude|dbfs|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4715" PostTypeId="2" ParentId="4709" CreationDate="2012-10-18T15:05:38.220" Score="3" Body="&lt;p&gt;You do it by creating a windowed sinc filter that has a wide enough pass-band to preserve the energy of whatever it is you are trying to phase shift.  Instead of centering the sinc function, though, you shift it by whatever phase shift you want to introduce.  You then filter the signal, which will now have that phase shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Jason states in his comment, what we really want is a time delay, which means convolving with an impulse.  The problem is that you can only do delays that are an integer multiple of the sample period with this technique.  We get around that by creating a low-pass filter in the form of a windowed sinc.  This is effectively the same as an impulse in terms of faithfully reproducing the signal-of-interest as long as the energy of the SOI is within the pass-band of the LPF.  We then convolve the LPF with a fractionally delayed impulse.  We do this by calculating the values of the underlying sinc function at those shifted time points.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because convolution is a linear operation convolving your signal with the shifted sinc is equivalent to convolving the signal with a fractionally shifted impulse function and then convolving it with a LPF.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-10-18T18:31:29.403" LastActivityDate="2012-10-18T18:31:29.403" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4716" PostTypeId="1" AcceptedAnswerId="6445" CreationDate="2012-10-18T20:20:49.633" Score="8" ViewCount="9657" Body="&lt;p&gt;does anyone know why the MatLab Canny (MLC) is so different compared to the OpenCV Canny (OCC)?&#xA;ML-C delivers precise and more connected edges than the OCC, but how is that possible?&#xA;The reason why I ask is, that I need to implement my protoype of ML code into C++ and I wanted to use OpenCV.&#xA;Exporting code of ML isn't really possible as far as I have tried.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind regards,&lt;/p&gt;&#xA;" OwnerUserId="1923" LastActivityDate="2016-04-02T09:04:08.757" Title="Differences between OpenCV Canny and MatLab Canny?" Tags="|image-processing|matlab|opencv|edge-detection|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4717" PostTypeId="2" ParentId="4704" CreationDate="2012-10-18T21:35:01.230" Score="1" Body="&lt;p&gt;&lt;b&gt;In response to your question (1):&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking along the lines of your initial idea, there is a way to avoid regression and do the following approximate procedure instead: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without loss of generality, assume that $\epsilon$ has zero mean (if not, then just absorb it into the constant $\beta_0$). Also assume it is i.i.d and has finite variance. Suppose you obtain two sets of data for $(f,g)$ pairs when $h=1$. I will denote these as $\{(f_{1,i}, g_{1,i})\}_{i=1}^N$ and $\{(f_{2,i}, g_{2,i})\}_{i=1}^N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\bar{f_1} = \frac{1}{N} \sum_{i=1}^N f_{1,i}$ and similarly define $\bar{g}_1$, $\bar{f}_2$ and $\bar{g}_2$. If $N$ is sufficiently large, we can now claim that, at least approximately, the noise $\epsilon$ can be averaged out and we can write:&#xA;$$&#xA;\bar{g}_1 \approx \beta_0 + \beta_1 \bar{f_1}&#xA;$$&#xA;and&#xA;$$&#xA;\bar{g}_2 \approx \beta_0 + \beta_1 \bar{f_2}.&#xA;$$&#xA;Now we only need to solve two equations in two unknowns to get the scale parameter $\beta_1$ and offset $\beta_0$, provided $|\bar{f}_1 - \bar{f}_2|&amp;gt;0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, whether this will work in your application will depend on whether the variance of $\epsilon$ is small enough (remember: averaging will reduce the variance by a factor of $1/N$), and whether the $f$'s are really noise free when $h=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;In response to question (3):&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same procedure should work in case $f$ is a quantized version of the true velocity. The argument here is that quantization introduces a small amount of noise that is approximately uniformly distributed with zero mean. It gets averaged out for large $N$, or so I hope.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="1825" LastEditDate="2012-10-19T19:26:33.710" LastActivityDate="2012-10-19T19:26:33.710" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4718" PostTypeId="2" ParentId="4702" CreationDate="2012-10-19T13:14:32.523" Score="1" Body="&lt;p&gt;First, it is not true that an error in the parity portion of a Reed-Solomon code word renders the word useless.  RS codes can correct errors in their parity and their data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, 10% errors is very high and I would not use a RS code in that situation.  In fact, in a situation with that many errors you will occasionally have &gt; 50% errors just due to random distribution (random distribution is often &quot;clumpy&quot;) of the errors.  No code you use will correct all of the errors all of the time.  Your system should be designed with that fact in mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would use a big turbo code or LDPC code.  Either one will get you near optimal performance.  The code needs to be &quot;big&quot; in the sense of using large blocks to avoid the clumpiness problem noted above.  You will still get more errors on occasion, but (assuming a gaussian distribution) your tails will be MUCH smaller if you make your blocks large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your errors are bursty you can use interleaving to spread them out among multiple blocks.  If they aren't bursty, interleaving won't help any.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-10-19T13:14:32.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4719" PostTypeId="1" CreationDate="2012-10-20T05:58:41.470" Score="5" ViewCount="619" Body="&lt;p&gt;I'm trying to find the frequency response $$H(\omega) = Y(\omega)/X(\omega)$$&#xA;for this system- the signal equations are given:&#xA;$$y[n] = v[n - M] - g * v[n]$$&#xA;$$v[n] = x[n] + g * v[n - M]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using the z transform, and the fourier transform, but I just don't know how to get rid of the recursive terms to get it in terms of $Y(\omega)$ and $X(\omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system is illustrated as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0UlfQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3137" LastEditorUserId="6" LastEditDate="2013-01-03T17:16:20.940" LastActivityDate="2013-01-03T20:32:31.040" Title="Find the frequency response of a system" Tags="|filters|homework|frequency-response|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4720" PostTypeId="1" CreationDate="2012-10-20T09:16:44.303" Score="2" ViewCount="1129" Body="&lt;p&gt;What I understand from differentiation of discrete sinusoidal signal is $y(n) = \alpha(x(n)-y(n-1))$ where $\alpha$ may be a factor depending on sampling frequency and signal frequency. Now y(n) represents signal which is $90^\circ$ phase shifted sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why to go to Hilbert transform and other complex methods to shift a signal $90 ^\circ$. My concern is with $50\,\text{Hz}$ signal only till $40$-th harmonic. &lt;/p&gt;&#xA;" OwnerUserId="3129" LastEditorUserId="26" LastEditDate="2012-10-22T11:04:57.713" LastActivityDate="2012-10-22T11:04:57.713" Title="Differentiation of discrete sinusoidal signal" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4721" PostTypeId="2" ParentId="4720" CreationDate="2012-10-20T12:48:10.250" Score="1" Body="&lt;p&gt;Hilbert transform has the property of &lt;em&gt;harmonic correspondence&lt;/em&gt; (Vakman 1996), meaning that the Hilbert transform of a cosine wave is a sine wave etc. So the Hilbert transform is a 90 degree phase shift. In fact the Hilbert transform in the Fourier domain looks quite similar to the differential operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}\left[\tfrac{d}{dt} f(t)\right](u) = -iw \mathcal{F}[f(t)](u)$$&#xA;$$\mathcal{F}\left[\mathcal{H}[f](t)\right](u) = -i\frac{w}{|w|} \mathcal{F}[f(t)](u)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see that for a sinusoid of frequency $w_0$, the derivative is the Hilbert transform scaled by $w_0$. e.g. Hilbert transform of $\cos(n t) = -\sin(n t)$, derivative of $\cos(n t) = -n \sin(nt)$. So careful choice of alpha in your formula will give you the phase shift, while compensating for the scaling by frequency, which is the same as the Hilbert transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a non-sinuosidal signal, then the 90 degree phase shift must be applied to every sinusoidal component. This is not the same as differentiation, and you couldn't use your formula. e.g. Hilbert transform of square wave (from wikipedia):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/9/90/Hilbert_transform.svg/320px-Hilbert_transform.svg.png&quot; alt=&quot;asdf&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.873" LastActivityDate="2012-10-20T12:48:10.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4722" PostTypeId="2" ParentId="4719" CreationDate="2012-10-20T13:16:38.290" Score="4" Body="&lt;p&gt;I'll go through it in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform&quot; rel=&quot;nofollow&quot;&gt;$z$-domain&lt;/a&gt;. First, we find the transfer function $H_1(z) = \frac{V(z)}{X(z)}$. As you noted, in the time domain, $x[n]$ and $v[n]$ are related as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;v[n] = x[n] + g * v[n - M]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the $z$-transform of the above and you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V(z) = X(z) + z^{-M}G(z) V(z)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;taking advantage of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Properties&quot; rel=&quot;nofollow&quot;&gt;convolution property&lt;/a&gt;, which states that $x_1[n] * x_2[n] \Leftrightarrow X_1(z)X_2(z)$, as well as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Properties&quot; rel=&quot;nofollow&quot;&gt;time-delay property&lt;/a&gt;, which states that $x[n-M] \Leftrightarrow z^{-M}X(z)$. Now, we can rearrange terms in the above to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H_1(z) = \frac{V(z)}{X(z)} = \frac{1}{1 - z^{-M}G(z)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, find the transfer function $H_2(z) = \frac{Y(z)}{V(z)}$. They are related in the time domain as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = v[n-M] - g * v[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the $z$-transform of the above to yield:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y(z) = z^{-M} V(z) - G(z)V(z)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rearrange terms again to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H_2(z) = \frac{Y(z)}{V(z)} = z^{-M} - G(z)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can get the overall transfer function $H(z)$ by multiplying the two:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;H(z) &amp;amp;= H_1(z) H_2(z) = \frac{V(z)}{X(z)}\frac{Y(z)}{V(z)} = \frac{Y(z)}{X(z)} \\&#xA;&amp;amp;= \frac{1}{1-z^{-M}G(z)} \left(z^{-M} - G(z)\right) \\&#xA;&amp;amp;= \frac{-G(z) + z^{-M}}{1-z^{-M}G(z)}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has some nice symmetry to it. The overall response will be dependent upon the system $g$ in the feedback path. If you want to evaluate the frequency response, just let $z = e^{j\omega}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(\omega) = \frac{-G(\omega) + e^{-j\omega M}}{1-e^{-j\omega M}G(\omega)}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-10-20T13:16:38.290" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4723" PostTypeId="1" AcceptedAnswerId="4724" CreationDate="2012-10-20T18:52:01.683" Score="64" ViewCount="181927" Body="&lt;p&gt;If we convolve 2 signals we get a third signal. What does this third signal represent in relation to the input signals?&lt;/p&gt;&#xA;" OwnerUserId="3128" LastEditorUserId="4038" LastEditDate="2014-02-14T09:56:01.250" LastActivityDate="2022-12-16T17:26:49.857" Title="What is the physical meaning of the convolution of two signals?" Tags="|convolution|" AnswerCount="17" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4724" PostTypeId="2" ParentId="4723" CreationDate="2012-10-20T20:12:41.600" Score="44" Body="&lt;p&gt;There's not particularly any &quot;physical&quot; meaning to the convolution operation. The main use of convolution in engineering is in describing the output of a &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory&quot;&gt;linear, time-invariant (LTI)&lt;/a&gt; system. The input-output behavior of an LTI system can be characterized via its &lt;a href=&quot;http://en.wikipedia.org/wiki/Impulse_response&quot;&gt;impulse response&lt;/a&gt;, and the output of an LTI system for any input signal $x(t)$ can be expressed as the convolution of the input signal with the system's impulse response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely, if the signal $x(t)$ is applied to an LTI system with impulse response $h(t)$, then the output signal is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = x(t) * h(t) = \int_{-\infty}^{\infty}x(\tau)h(t - \tau)d\tau&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like I said, there's not much of a physical interpretation, but you can think of a convolution qualitatively as &quot;smearing&quot; the energy present in $x(t)$ out in time in some way, dependent upon the shape of the impulse response $h(t)$. At an engineering level (rigorous mathematicians wouldn't approve), you can get some insight by looking more closely at the structure of the integrand itself. You can think of the output $y(t)$ as the sum of an infinite number of copies of the impulse response, each shifted by a slightly different time delay ($\tau$) and scaled according to the value of the input signal at the value of $t$ that corresponds to the delay: $x(\tau)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sort of interpretation is similar to taking discrete-time convolution (discussed in Atul Ingle's answer) to a limit of an infinitesimally-short sample period, which again isn't fully mathematically sound, but makes for a decently intuitive way to visualize the action for a continuous-time system.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-10-21T01:31:36.100" LastActivityDate="2012-10-21T01:31:36.100" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4725" PostTypeId="2" ParentId="4723" CreationDate="2012-10-20T20:34:10.267" Score="21" Body="&lt;p&gt;A particularly useful intuitive explanation that works well for discrete signals is to think of convolution as a &quot;weighted sum of echoes&quot; or &quot;weighted sum of memories.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a moment, suppose the input signal to a discrete LTI system with transfer function $h(n)$ is a delta impulse $\delta(n-k)$. The convolution is&#xA;\begin{eqnarray}&#xA;y(n) &amp;amp;=&amp;amp; \sum_{m=-\infty}^{\infty} \delta(m-k) h(n-m) \\&#xA;&amp;amp;=&amp;amp; h(n-k).&#xA;\end{eqnarray}&#xA;This is just an echo (or memory) of the transfer function with delay of k units.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now think of an arbitrary input signal $x(n)$ as a sum of weighted $\delta$ functions. Then the output is a weighted sum of delayed versions of h(n). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if $x(n) = \{1, 2, 3\}$, then write $x(n) = \delta(n) + 2 \delta(n-1) + 3 \delta(n-2)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system output is a sum of the echoes $h(n)$, $h(n-1)$ and $h(n-2)$ with appropriate weights 1, 2, and 3, respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $y(n) = h(n) + 2h(n-1)+3h(n-2)$.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="1825" LastEditDate="2017-02-28T02:02:16.363" LastActivityDate="2017-02-28T02:02:16.363" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4726" PostTypeId="1" AcceptedAnswerId="4728" CreationDate="2012-10-20T21:01:39.650" Score="4" ViewCount="16969" Body="&lt;p&gt;I've been involved in Signal processing for quiet a time but I'm still so confused of what frequency could possibly is, as it has different meanings in different scenarios, for example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Wikipedia,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Frequency is the number of occurrences of a repeating event per unit&#xA;  time.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Calculating the frequency of a repeating event is accomplished by&#xA;  counting the number of times that event occurs within a specific time&#xA;  period, then dividing the count by the length of the time period. For&#xA;  example, if 71 events occur within 15 seconds the frequency is:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E0qOh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the most basic definition of the frequency that everybody knows. But what is the definition of Frequency in case of Digital Images and Sounds ?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For example, if a newborn baby's heart beats at a frequency of 120&#xA;  times a minute, its period (the interval between beats) is half a&#xA;  second.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;make sense so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is the Sine wave of various frequencies,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xry4U.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the bottom waves have higher frequencies than those above. The horizontal axis represents time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above signal makes sense to me that it has a frequency but how about a non periodic signals like a human voice, ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look,&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Pgg4j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this signal is not repeated on any instance so how one could say what is its frequency and how one could count the number of cycles repeated ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;aforesaid,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Frequency is the number of occurrences of a repeating event per unit&#xA;  time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How does this statement can be true in case of the frequency of human voice ? because when we speak we do not repeat anything than how the voice can have some frequency ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and in case of images,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the rapid change in the color is the part of the &lt;code&gt;High frequency&lt;/code&gt; of&#xA;  the image&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How this can be counted as frequency ?&#xA;if the image has all the different pixel values how there could be any frequency ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am so curious to know deep in detail about the exact definition of Frequency that holds for everything mentioned above.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="90" LastEditDate="2012-10-21T01:15:59.803" LastActivityDate="2020-04-28T08:24:14.827" Title="What does &quot;frequency&quot; mean for various kinds of signals?" Tags="|frequency|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4728" PostTypeId="2" ParentId="4726" CreationDate="2012-10-21T00:00:05.453" Score="7" Body="&lt;p&gt;The key insight that Fourier had when he developed &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_analysis&quot;&gt;Fourier analysis&lt;/a&gt; is that any absolutely integrable (thanks Jason R) function can be represented as the weighted sum of sines and cosines.  Explaining why this is true is way beyond the scope of this answer.  I suggest you study Fourier theory to understand this better.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-10-21T19:47:34.080" LastActivityDate="2012-10-21T19:47:34.080" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4729" PostTypeId="1" CreationDate="2012-10-20T15:27:53.590" Score="2" ViewCount="2527" Body="&lt;p&gt;I'm trying to figure out how to create a good spectral envelope of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I am, at present, taking a windowed section of audio applying an FFT and generating a bar chart style representation of the magnitude of the spectrum.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However to add to this I'd really like to have a good spectral envelope overlaid over the top.  Unfortunately I just can't seem to come up with a good solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried a simple peak picking algorithm where I find every peak in the spectrum (I literally just look for points where the current value is greater than the values in the buckets either side).  This returns me a set of peaks and I then use a catmull-rom interpolation to draw the line over the peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This follows the spectrum reasonably as you can see in the following screenshot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QPKmN.jpg&quot; alt=&quot;Reasonable envelope&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However its not ideal.  In that image for example you can see how it doesn't follow the spectrum on the lefthand side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you zoom out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GGbEo.jpg&quot; alt=&quot;Too jaggy&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see that the envelope is pretty jaggy.  Its not terrible but is this really the best way to build a spectral envelope?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way of picking the ideal peaks so that it truly envelopes the spectrum?  If so can anyone point me towards algorithms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also is catmull-rom interpolation the best way of doing it?  Can anyone suggest a better interpolation method and show me how to implement it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is language agnostic but I'm writing in C++.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Edit&lt;/em&gt;&lt;/strong&gt;: Ok I found an implementation of &lt;a href=&quot;http://paulbourke.net/miscellaneous/ar/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Auto-Regressive modelling&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then implemented the method as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    std::vector&amp;lt; float &amp;gt; coefficients( 3 );&#xA;    AutoRegression( &amp;amp;mSpecBuffer.front(), kFFTSizeDiv2, 3, &amp;amp;coefficients.front(), MAXENTROPY );&#xA;&#xA;    mPeakBuffer.clear();&#xA;&#xA;    mPeakBuffer.push_back( Peak( 0, mSpecBuffer[0] ) );&#xA;    mPeakBuffer.push_back( Peak( 1, mSpecBuffer[1] ) );&#xA;    mPeakBuffer.push_back( Peak( 2, mSpecBuffer[2] ) );&#xA;&#xA;    int x       = 3;&#xA;    int xMax    = kFFTSizeDiv2;&#xA;    while( x &amp;lt; xMax )&#xA;    {&#xA;        const float k3  = (mPeakBuffer.end() - 3)-&amp;gt;peakHeight;&#xA;        const float k2  = (mPeakBuffer.end() - 2)-&amp;gt;peakHeight;&#xA;        const float k1  = (mPeakBuffer.end() - 1)-&amp;gt;peakHeight;&#xA;&#xA;        const float k   = (k1 * coefficients[0]) + (k2 * coefficients[1]) + (k3 * coefficients[2]);&#xA;&#xA;        mPeakBuffer.push_back( Peak( x, k ) );&#xA;        x++;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QXwed.jpg&quot; alt=&quot;Auto-Regressive enveloping&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which to my eye looks a HELL of a lot better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zoomed right out it still looks pretty damned good:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bZSOj.jpg&quot; alt=&quot;Auto-Regressive enveloping (zoomed out)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I just want to check, if this is correct?  If so I'll work along this path further :)&lt;/p&gt;&#xA;" OwnerUserId="333" OwnerDisplayName="Goz" LastEditorUserId="333" LastEditDate="2012-10-21T09:38:14.373" LastActivityDate="2012-10-21T09:38:14.373" Title="Building a spectral envelop of FFT'd audio" Tags="|frequency-spectrum|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4730" PostTypeId="1" CreationDate="2012-10-19T15:24:13.710" Score="4" ViewCount="406" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/25RTS.jpg&quot; alt=&quot;Binary Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a binary image. I want to remove the portion in the red region, and keep the one in the green region. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red region has the property of double parallel edges, whereas green does not. If someone could suggest an algorithm it would be helpful.&lt;/p&gt;&#xA;" OwnerUserId="1613" OwnerDisplayName="crack_addict" LastEditorUserId="76" LastEditDate="2012-11-14T20:15:56.660" LastActivityDate="2012-11-14T20:15:56.660" Title="Removing parallel edges from binary image" Tags="|image-processing|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="4731" PostTypeId="2" ParentId="4729" CreationDate="2012-10-21T00:55:21.613" Score="2" Body="&lt;p&gt;Two techniques commonly used for recovering the spectral envelope of an audio signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Low-order AR modeling. Estimate your AR coefficients, then plot the magnitude of the frequency response of the estimated all-pole filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Cepstral analysis. Take the logarithm of the magnitude of the FFT output. Take the FFT, truncate to keep only the first coefficients, take the inverse FFT, take the exponential. This is equivalent to applying a low-pass filter on the spectrum (with a log-scale magnitude).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-10-21T00:55:21.613" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="4732" PostTypeId="2" ParentId="4729" CreationDate="2012-10-21T01:14:46.513" Score="1" Body="&lt;p&gt;This seems to be more a question of style than anything really based in theory if I read this correctly. It's not clear exactly what you want. What information would you hope that your user could extract about the audio signal by looking at the display? If your signal of interest truly has a &quot;jaggy&quot; spectrum (and your example does), then I wouldn't see a problem with plotting a &quot;jaggy&quot; envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You did point out the issue in the first image, where your interpolated envelope isn't strictly greater than or equal to all of the bins in your FFT. I think you could fix that by tweaking your algorithm for selecting control points in your spline interpolation. Instead of only selecting control points where there appears to be a peak, you could insert a control point to your spline on every bin $B_n$ where $B_n &amp;gt; B_{n-1}$. That is, for every bin, if it is greater than its left neighbor, make it a control point on your spline. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first image, then, the first 5 bins would all be control points, and the interpolated envelope would travel through each bin's actual value, which would likely give a better-looking &quot;enveloping&quot; of the underlying spectrum.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-10-21T01:14:46.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4733" PostTypeId="2" ParentId="4729" CreationDate="2012-10-21T09:36:55.783" Score="1" Body="&lt;p&gt;It seems to me that your goal is to obtain a line which is always strictly above the spectrum. This goes against many signal processing methods which tend to have an energy conservation property - with these methods, lowering the resolution will spread a spectral peak over adjacent FFT bins (say a peak at 1.0 in bin n will become spread into 0.1 at bin n-1, 0.8 at bin n, 0.1 at bin n+1). Of course, &quot;hacks&quot;, post-processing, etc., could certainly give something acceptable according to your visual criteria, the problem is that they would be meaningless from a signal processing perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest a slightly different approach which would be of: a/ trying to stay true to a well-defined, established, signal-processing metric; and b/ have a &quot;communication plan&quot; about what you are plotting expresses, and how it is useful to the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you could communicate that you are plotting a low-resolution representation, which emphasizes less on individual spectral peaks, and more on the overall frequency distribution - which would be the &quot;footprint&quot; of the sound in the ear, independently of pitch. For this you could use:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Lower order FFT (say the square root of the size used for the big FFT), sinc-interpolated to fit your full-size.&lt;/li&gt;&#xA;&lt;li&gt;Auditory spectrum. Take the output of your main FFT, sum the energy over overlapping triangular windows centered on the critical bands of hearing, convolve by a spread function, and translate back from Bark scale to linear frequency scale. See &lt;a href=&quot;http://web.media.mit.edu/~tristan/phd/dissertation/chapter3.html&quot; rel=&quot;nofollow&quot;&gt;chapter 3 of Tristan Jehan's PhD&lt;/a&gt; for a quick introduction.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Secondly, you could make use of temporal information; and communicate that what you are plotting is the current spectrum plotted on the backdrop of its &quot;context&quot; from the past few seconds - allowing the user to notice changes in sound (this kind of visualization is actually useful when setting up a multiband compressor).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A low-pass filtered spectrum: background[n] = 0.9 * background[n] + 0.1 * current_fft_frame[n] or...&lt;/li&gt;&#xA;&lt;li&gt;Maximum of each FFT bin over past $n$ analysis frames.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that this last option is the only one in my lists that comes with the guarantee that it will be always greater than the current frame spectrum.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-10-21T09:36:55.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4734" PostTypeId="2" ParentId="4730" CreationDate="2012-10-21T11:37:47.457" Score="2" Body="&lt;p&gt;Just a suggestion:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;perform binary skeletonization&lt;/li&gt;&#xA;&lt;li&gt;detect lines as connected sets of pixels&lt;/li&gt;&#xA;&lt;li&gt;for every line, find distance to nearest pixel on some other line&lt;/li&gt;&#xA;&lt;li&gt;compute average distance between inspected line and the nearest line&lt;/li&gt;&#xA;&lt;li&gt;if the computed distance lays within some predefined interval (say, 3-8 pixels), consider it a double-line and remove both lines&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The interval can be determined statistically because double lines have distances forming a distribution, which can be separated well from other line distances in the image.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-10-21T11:37:47.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4735" PostTypeId="1" AcceptedAnswerId="4829" CreationDate="2012-10-21T12:58:49.503" Score="2" ViewCount="556" Body="&lt;p&gt;I am an amateur astronomer and I took &lt;em&gt;recent interest in Radio astronomy&lt;/em&gt; and I am also new to &lt;em&gt;Digital Signal Processing&lt;/em&gt;. My team is trying to build a radio telescope. I am interested in the data analysis part. One thing that is predominant in the signals that is received is the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the data from the Radio Telescope of The University of Illinois recorded on July 4th 2011 and the telescope was pointing towards the Cygnus constellation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://radio.uindy.edu/data/2011/07041059-2.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://radio.uindy.edu/data/2011/07041059-2.txt&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: I am interested only in the third column of data&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a plot of the data using R and that turns out to be something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UIid2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the plot of the Cygnus constellation inferred by the University:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r9lyf.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I manually matched the above image with my plot and took out a portion of my plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0rqh8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seemed similar to me. The chances are that my manual matching is wrong. How do I tackle with the situation ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have just started learning DSP and please suggest resources and pointers for DSP techniques so that I may apply in radio astronomy.&lt;/p&gt;&#xA;" OwnerUserId="3141" LastEditorUserId="6" LastEditDate="2012-10-28T20:22:17.537" LastActivityDate="2012-10-28T20:39:36.807" Title="Signal Processing in Amateur Radio Astronomy" Tags="|statistics|real-time|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4736" PostTypeId="2" ParentId="4726" CreationDate="2012-10-21T15:14:28.927" Score="3" Body="&lt;p&gt;Words mean different things to different people.  Sometimes approximate things.  Such as that the repeated events might not be exactly identical, but only &quot;approximately&quot; or partially identical.  Or that the repetition rate varies &quot;slightly&quot;.  Where the words approximately and slightly may vary in meaning as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of signal processing, one might look at your voice signal as composed of the sum of pure periodic signals and wildly non-periodic signals, so that the repeated events looks hidden to you, but can be extracted by various forms of analysis (such as a DFT/FFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same with images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore the term frequency is often used for both the repetition of pure sinusoidal components, or for larger very non-sinusoidal looking patterns that the human ear is good at detecting very approximate (sometimes almost hidden) repetitions thereof, called the &quot;pitch&quot;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-10-21T15:20:24.927" LastActivityDate="2012-10-21T15:20:24.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4737" PostTypeId="1" AcceptedAnswerId="7768" CreationDate="2012-10-21T16:30:05.897" Score="0" ViewCount="11943" Body="&lt;p&gt;After getting suggestion to first study FFT on square wave to understand FFT of discrete signal, I'm trying to understand the FFT of square wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've coded a program, here is the details,&#xA;Frequency of Wave, 100KHz&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f= 100e3;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sampling Frequency, 1MHz &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1e6;  &#xA;Ts = 1/Fs;   %Sampling Rate&#xA;% Ts = 0.000001&#xA;&#xA;t = 1/f;       %Time period of 1 Oscillation = 1/f  &#xA;&#xA;% t = 0.00001&#xA;n = 0.000001:Ts:t;  %Generating Samples&#xA;&#xA;&#xA;% t/Ts = 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i.e 10 Samples will be generated&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% 1st  Sample at 0.000001s&#xA;% 2nd  Sample at 0.000002s&#xA;% 3rd  Sample at 0.000003s&#xA;% 4th  Sample at 0.000004s&#xA;% 5th  Sample at 0.000005s&#xA;% 6th  Sample at 0.000006s&#xA;% 7th  Sample at 0.000007s&#xA;% 8th  Sample at 0.000008s&#xA;% 9th  Sample at 0.000009s&#xA;% 10th Sample at 0.00001s&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;defining and plotting the square wave,&#xA;Since Amplitude is not defined it will be &lt;code&gt;1&lt;/code&gt; by default.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=square(2*pi*f*n);&#xA;subplot(2,1 ,1)&#xA;stem(n,x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output wave,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CSKQv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now plotting its FFT&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subplot(2,1 ,2)&#xA;F=fft(x)    &#xA;plot(2*abs(F)./(t/Ts));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output wave,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qDIrJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the First point, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fs / # of Samples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1000,000/10 = 100KHz &amp;lt;- First point = 100KHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Number of  Harmonics should be = 10 but What are the Frequency of each Harmonic ?&#xA;also, why the amplitude has changed to &lt;code&gt;1.2&lt;/code&gt; which is supposed to be &lt;code&gt;1&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-02-05T20:24:07.613" Title="FFT of a Square wave, what are frequency of each Harmonic here" Tags="|fft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4738" PostTypeId="2" ParentId="4726" CreationDate="2012-10-21T17:44:18.927" Score="0" Body="&lt;p&gt;Frequency rather then taking as cycles/sec if you take it as the rate of change of signal then you can understand ,in image frequency is the change in intensity(or color) value like frequency near the edges is high because there is sharp change in intensity values.&lt;/p&gt;&#xA;" OwnerUserId="3128" LastActivityDate="2012-10-21T17:44:18.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4739" PostTypeId="1" AcceptedAnswerId="4741" CreationDate="2012-10-21T19:34:56.010" Score="0" ViewCount="181" Body="&lt;p&gt;I plotted a simple Cosine wave and After taking its FFT the frequency can be seen easily but after modifying the original signal to add more lower and higher frequencies, the higher ones are visible but the lower ones is not showing in the FFT plot,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original Signal,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Amplitude = 4&#xA;x=A*cos(2*pi*f*n);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Frequency of Wave: &lt;code&gt;100Hz&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Amplitude = &lt;code&gt;4&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling Frequency = &lt;code&gt;10000Hz&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;100Hz&lt;/code&gt; frequency (original signal frequency) is supposed to be plotted at point 1 of FFT, which is fine,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sD1ll.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When adding another higher frequency into the original signal,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x= 1*cos(2*pi*500*n) + x ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;500HZ frequency is added into the original signal and supposed to be plotted at point 5 of the FFt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Results in,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6fFiB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is fine, but when i am trying to add lower frequencies than higher they are not visible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding &lt;code&gt;50Hz&lt;/code&gt; frequency to the original &lt;code&gt;100Hz&lt;/code&gt; Cosine wave,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;what i think is &lt;code&gt;50Hz&lt;/code&gt; should be plotted at the 0.5 of the x-axis as it is half of the original frequency.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x= 1*cos(2*pi*50*n) + x ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results in,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/27yTY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is the &lt;code&gt;50Hz&lt;/code&gt; frequency ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2012-10-21T19:57:22.270" Title="Lower frequencies is not visible in FFT plot when adding into the original signal" Tags="|fft|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4740" PostTypeId="1" AcceptedAnswerId="4742" CreationDate="2012-10-21T19:49:29.537" Score="1" ViewCount="183" Body="&lt;p&gt;I just got a thought when generating matrices , plotting it and taking its FFT,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say, I have randomly input a matrix of length 256,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1 7 9 5 7 1 -2 0..................8]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to the FFT, the resulting 256 FFT coefficients correspond to the following frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0, $f_s/256$, $2 f_s/256$, $3 f_s/256$, $\ldots$, $255 f_s/256$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but since the samples i taken has no sampling frequency defined how could there be some sampling frequency ? Like in an image ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the image is just a 2 dimensional Matrix , if i randomly generate an image in a matlab with random pixel values (sample points) and plot its FFT , the matlab will show the frequencies of that 2-D matrix but since there is no Sampling Frequency is defined how matlab calculates the frequency for each of the coefficient ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2015-03-20T07:58:06.420" Title="If we define samples manually how could there be a Sampling Frequency?" Tags="|fft|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4741" PostTypeId="2" ParentId="4739" CreationDate="2012-10-21T19:57:22.270" Score="5" Body="&lt;p&gt;What you're assuming about how FFT works is actually correct for &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Definition&quot;&gt;Fourier transform&lt;/a&gt;, but – despite its name – FFT is not such a continuous all-$\mathbb{R}$ transformation. It is actually just a DFT, &lt;em&gt;discrete&lt;/em&gt; Fourier transform, i.e. both the frequency and time spaces are quantised. In your example, you &lt;em&gt;selected&lt;/em&gt; the quantisation in frequency space to be $100\:\mathrm{Hz}$, so there exists no $50\: \mathrm{Hz}$ bin.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2012-10-21T19:57:22.270" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4742" PostTypeId="2" ParentId="4740" CreationDate="2012-10-21T20:22:59.033" Score="2" Body="&lt;p&gt;Units can be arbitrary, such as ISO Meters, or the length of the current king's foot (maybe longer than last year after the assassination of some shorter king).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good default unit if there isn't some ISO standard, useful natural unit, or you can't think of one to make up (how long is your monitor's display, or your left foot, etc.), is the length of your window of data.  e.g. 1 cycle per your vector of 256, 2 cycles, 3 cycles, etc. per your vector length.  If your vector displays as 3 inches long on your display, then you can also easily convert cycles/vec into cycles/inch, or per/mm, per/fortnight, etc.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-03-20T07:58:06.420" LastActivityDate="2015-03-20T07:58:06.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4743" PostTypeId="1" AcceptedAnswerId="4832" CreationDate="2012-10-22T01:36:25.010" Score="2" ViewCount="1431" Body="&lt;p&gt;I wish to create a finite impulse response filter to decode a dolby digital matrix encoded 2 channel signal into 5 channels. These filters would then be used in a realtime pipeline on a Linux machine using &lt;code&gt;jack&lt;/code&gt; and &lt;code&gt;jconvolver&lt;/code&gt; to do the convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DWyha.png&quot; alt=&quot;https://i.stack.imgur.com/Ow2Dm.png&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reference for the above equation is: &lt;a href=&quot;http://en.wikipedia.org/wiki/Matrix_decoder&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Matrix_decoder&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would seem this should be able to be done but I haven't the faintest how. Any help, and in particular working code that could generate the filters (Octave or other open source preferred) would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="3142" LastEditorUserId="76" LastEditDate="2012-10-22T06:26:58.320" LastActivityDate="2012-11-02T23:22:26.297" Title="Decoding Matrix Encoded Surround Sound Through Convolution" Tags="|audio|convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4744" PostTypeId="2" ParentId="4709" CreationDate="2012-10-22T04:46:43.590" Score="1" Body="&lt;p&gt;I agree with answer from Jim Clay. But if you need very fast algorithm and accuracy of results is not your main  purpose, you can use a simple linear interpolation. For example, if you want to do shift by half of sample resolution you can use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[i] = (x[i+1] + x[i])/2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yes, it is low-pass filter too, but very simple and very short. If you need more accurate results - use common answer from Jim Clay and carefully choose length of filter.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2012-10-22T05:14:10.977" LastActivityDate="2012-10-22T05:14:10.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4745" PostTypeId="1" CreationDate="2012-10-22T05:22:20.263" Score="2" ViewCount="1732" Body="&lt;p&gt;Suppose a signal with two-sided power spectral density $N/2$ is passed through an ideal LPF having cutoff frequncy  $B\,\mathrm{Hz}$. The output power is equal to $N/2 \times 2B = NB$ Watts. Why not $NB/2$?&lt;/p&gt;&#xA;" OwnerUserId="3144" LastEditorUserId="235" LastEditDate="2012-10-22T12:55:41.310" LastActivityDate="2015-04-09T08:01:09.773" Title="When negative frequencies cannot exist in practice, why do we calculate power in negative frequency?" Tags="|frequency-spectrum|lowpass-filter|power-spectral-density|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4746" PostTypeId="1" CreationDate="2012-10-22T08:20:44.063" Score="1" ViewCount="125" Body="&lt;p&gt;For a multi-scale keypoints detector, local extremas are found between the scales at EACH octave. &#xA;The scale-space is implemented as follows:&#xA;Each octave is downsampled by half from the first image in the previous octave.&#xA;In each octave the images are smoothed with a gaussian kernel s times (s in the number of levels in each octave). So, the scale space is constructed by o ocatves with s levels = o*s images at different sizes and different smoothing levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say, I have keypoints at the last octave (the smallest image), in scale s. Approximating the maximas (for better accuracy) gives (x',y',s').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are these values (x',y',s') converted to the original size image ? (surely, the location (x','y) of an image that was downsampled is different than the point location in the real image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="900" LastActivityDate="2012-10-22T08:20:44.063" Title="Sample keypoint found in multi-scale to one scale (scale space with O octaves)" Tags="|computer-vision|downsampling|scale-space|" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4748" PostTypeId="2" ParentId="4745" CreationDate="2012-10-22T11:54:10.593" Score="3" Body="&lt;p&gt;Negative frequencies do exist. The vector base for Fourier transforms (and therefore power spectral density) is the set of complex exponentials $e^{j\omega t}$ where the frequency $\omega$ can be positive or negative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A real sinusoid can be decomposed into complex exponentials:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos(\omega t) = \frac{e^{j\omega t} + e^{-j \omega t}}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There you have your practical signal (the cosine wave) expressed in terms of the Fourier vector base (complex exponentials). Both sides of the spectrum must be considered in order to calculate power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is similar for any other real signal. In general, for real signals, the power spectrum will be symmetric and you must consider power in both sides of the spectrum. &lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-10-22T11:54:10.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4750" PostTypeId="1" CreationDate="2012-10-22T16:06:54.633" Score="-1" ViewCount="1768" Body="&lt;p&gt;Moved from here &lt;a href=&quot;https://stackoverflow.com/questions/13013764/classification-of-objects-from-a-video-human-animals-otherscars-etc/13013919#comment17661061_13013919&quot;&gt;SO Link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi I am new to image processing field. My project is to classify the objects in an image/Video. The input is an image/video from surveillance camera. I should classify the objects into three classes. 1) Humans 2) Animals 3) Others (cars). We can consider a fixed background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can any one suggest any proven algorithms or papers or opensource code for this purpose? offcourse googling is obvious solution but always an experienced eye is always helpful!&lt;/p&gt;&#xA;" OwnerUserId="3147" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-10-31T14:38:16.607" Title="Classification of Objects from a video/Image ( human,animals,others(cars etc.,) )" Tags="|image-processing|computer-vision|image-segmentation|object-recognition|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4752" PostTypeId="1" AcceptedAnswerId="4756" CreationDate="2012-10-22T20:44:58.450" Score="2" ViewCount="6433" Body="&lt;p&gt;I've designed a simple FM communication system and found that high-frequency noise is a real problem.  It appears that this is a &lt;a href=&quot;http://www.claessonedwards.com/index.php?option=com_content&amp;amp;view=article&amp;amp;id=72&amp;amp;Itemid=89&quot; rel=&quot;nofollow&quot;&gt;well known issue&lt;/a&gt;, which has been solved through pre-emphasis of high frequencies at the transmitter and de-emphasis at the receiver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard pre-emphasis filter appears to have the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{pe}(f) = 1 + j2\pi f\tau_x, \quad \text{where } \tau = \rm75E-6$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The de-emphasis filter is simply the inverse of that, or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{de}(f) = \frac{1}{1 + j 2\pi f\tau_x}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm afraid I'm not much of an IIR filter designer, but from my research it appears to me that the de-emphasis filter is a relatively simple integrator, and that I can use the Impulse-Invariant method. The pre-emphasis filter, on the other hand, looks to be a bit tougher.  Should I use a bilinear transform approach?  When I tried to use the &lt;code&gt;bilinear&lt;/code&gt; command in MATLAB it complained, presumably because there were no poles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips or hints would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;The MATLAB command that I used was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[z, p, k] = bilinear([j*2*pi*75e-6], [], 1, 20e3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MATLAB (using version R2011b) returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error using bilinear (line 100)&#xA;First two arguments must have the same orientation.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="923" LastEditorUserId="1629" LastEditDate="2016-05-08T22:23:45.910" LastActivityDate="2016-05-08T22:23:45.910" Title="Pre-emphasis / De-emphasis filter design" Tags="|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4753" PostTypeId="2" ParentId="4723" CreationDate="2012-10-22T21:30:45.150" Score="14" Body="&lt;p&gt;A good intuitive way of understanding convolution is to look at the result of convolution with a point source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, the 2D convolution of a point with the flawed optics of Hubble Space Telescope creates this image: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vY0gz.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vY0gz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine what happens if there are two (or more) stars in a picture: you get this pattern twice (or more), centered on each star. The luminosity of the pattern is related to the luminosity of a star. (Note that a star is practically always a point source.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These patterns are basically the multiplication of the point source with the convoluted pattern, with the result stored at the pixel such that it reproduces the pattern when the resulting picture is viewed in its entirety.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My personal way of visualizing a convolution algorithm is that of a loop on every pixel of the source image. On each pixel, you multiply by the value of the convoluted pattern, and you store the result on the pixel which relative position corresponds to the pattern. Do that on every pixels (and sum results on every pixels), and you get the result.&lt;/p&gt;&#xA;" OwnerUserId="2030" LastEditorUserId="80" LastEditDate="2017-09-11T16:51:17.573" LastActivityDate="2017-09-11T16:51:17.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4754" PostTypeId="1" AcceptedAnswerId="4783" CreationDate="2012-10-22T22:54:44.020" Score="3" ViewCount="1021" Body="&lt;p&gt;I am just wondering if it's possible to gather the age group of someone speaking in a sample? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, could I tell whether the sample is a child, teenage, adult, etc?&lt;/p&gt;&#xA;" OwnerUserId="1810" LastEditorUserId="76" LastEditDate="2013-01-19T05:51:00.143" LastActivityDate="2013-01-19T05:51:00.143" Title="Identifying the age of a speaker using speech recognition" Tags="|signal-detection|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4756" PostTypeId="2" ParentId="4752" CreationDate="2012-10-23T02:53:25.833" Score="2" Body="&lt;p&gt;You really can use any filter design scheme that you want. I can't think of any reason why you would need to use an IIR approach, exclusively, so you have a number of options. For FIR filters, you have choices like the frequency sampling and least squares methods (look at &lt;code&gt;fir2&lt;/code&gt; and &lt;code&gt;firls&lt;/code&gt; in MATLAB). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an IIR implementation, you should be able to use the bilinear transform straightforwardly; since the filters you referenced are simple single-pole and single-zero ems, it's probably just as easy to work the math out by hand. One thing to remember is that you'll want to prewarp the frequency axis first to ensure that you get a good approximation across the passband of interest. It might help for you to provide any error that you were getting from MATLAB; the lack of poles shouldn't be problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; A few things to address your comments:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I wouldn't say that &lt;code&gt;firls&lt;/code&gt;, being a least-squares-based approach, is a step-wise approximation of a smooth curve. Yes, you provide a number of samples of the desired response to the least-squares algorithm, but you should still get a smooth curve out.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I started to work out the math on applying the bilinear transform to the pre-emphasis filter and came across a problem. Its frequenecy response is: &#xA;$$&#xA;H_{pe}(f) = 1 + j2\pi f \tau_x&#xA;$$&#xA;Noting that for the frequency response $H_{pe}(f)$, $s = j\omega = j 2 \pi f$:&#xA;$$&#xA;H_{pe}(s) = 1 + s\tau_x&#xA;$$&#xA;The bilinear transform maps the $j\omega$ axis in the $s$-plane to the unit circle of the discrete-time approximation's $z$-plane. So, we should be concerned about what happens to the transfer function as $s$ is allowed to vary along the entire imaginary axis. Note that:&#xA;$$&#xA;\lim_{s \to \infty} H_{pe}(s) = \infty&#xA;$$&#xA;This means that, for the discrete-time approximation generated by the bilinear transform, as the angular frequency $\omega \to \pm \pi$, the discrete-time filter's magnitude response will blow up to $\infty$, which is probably not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem would present itself for any analog system whose transfer function has a larger-degree numerator than denominator. So it's probably justified why MATLAB issues the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; [num, den] = bilinear([75e-6 1], 1, 100e3);&#xA;Error using bilinear (line 69)&#xA;Numerator cannot be higher order than denominator.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note that in your example, you passed an empty vector for the denominator; instead, you should pass &lt;code&gt;1&lt;/code&gt;, since the denominator of the transfer function is unity)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So as it turns out, I'm not aware of any analog-mapping techniques that will definitely work for your application. I don't believe the impulse invariant method will work since the pre-emphasis filter isn't bandlimited. You could use one of the FIR design methods, an IIR least-squares technique (e.g. Berchin's frequency-domain least-squares (FDLS) algorithm), or perhaps look into the &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_Z-transform_method&quot; rel=&quot;nofollow&quot;&gt;matched Z-transform method&lt;/a&gt;, which I'm not familiar with.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2012-10-23T15:04:22.203" LastActivityDate="2012-10-23T15:04:22.203" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4757" PostTypeId="1" CreationDate="2012-10-23T05:46:20.327" Score="1" ViewCount="84" Body="&lt;p&gt;&lt;strong&gt;My project is Face Authentication.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;System Description:&lt;/em&gt;&lt;/strong&gt; My input is only one image (which was taken when the user logins for the first time) and using that image system should authenticate whenever the user logins to the application. The authentication images may differ from the first input image like -- different illumination conditions, different distance from camera and -10 to 10 degrees variation in pose. The camera used is same (ex: ipad) for all cases.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Authentication images are stored each time the user logins. &lt;strong&gt;How to&#xA;  make use of these images to enhance the accuracy of the system??&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2) When a new image comes, I need to select the closest image(s) (and&#xA;  not all stored images) from the image repository and use for&#xA;  authenticate to reduce the time. &lt;strong&gt;How to label an image based on&#xA;  illumination/distance from camera automatically??&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;3) How should I make my system to perform decently for changes in&#xA;  illumination and distance from camera??&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Please, can anyone suggest me good alogirthm/papers/opensource-codes for my above questions??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though it sounds like a research project, I would be extremely grateful if I get any response from someone.&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2012-10-23T10:05:19.723" Title="FaceAuthentication" Tags="|image-processing|matlab|computer-vision|opencv|face-detection|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4758" PostTypeId="1" CreationDate="2012-10-23T06:06:00.880" Score="2" ViewCount="95" Body="&lt;p&gt;Actually, I am new to this field and would like to work on a project in Video processing. I have a little background in Image processing but would like to study further in video processing. So, If anyone could suggest some readings as pre-requisites for video processing.&lt;/p&gt;&#xA;" OwnerUserId="3153" LastActivityDate="2012-11-11T13:48:14.907" Title="Can anyone suggests some basic readings for video processing?" Tags="|video-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4759" PostTypeId="2" ParentId="4757" CreationDate="2012-10-23T10:05:19.723" Score="2" Body="&lt;p&gt;Here is one way to set up the project:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than analysing the difference between two pictures, try analysing the pictures themselves. For example by trying to identify charactaristics of people that make them unique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you do this once for the base image you can accept a login if the result of the new pic is sufficiently close to the baseline.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you get multiple pictures you can probably get a more accurate baseline and even a confidence band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that you should try to deal with it in a way that lighting and distance will not have much effect, so focus on ratios etc. Think about the distance between the ears compared to the distance from nose to lips or the number of rinkles on a persons forehead.&lt;/p&gt;&#xA;" OwnerUserId="3154" LastActivityDate="2012-10-23T10:05:19.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4760" PostTypeId="1" CreationDate="2012-10-23T12:14:10.910" Score="2" ViewCount="1860" Body="&lt;p&gt;I'm trying to do people detection from bird eye view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, it is not a normal bird eye view because I don't have RGB images but I have disparity map, depth map as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In these kind of images, people are shown like lines that represent a single side of the person. I try to re-explain it: these lines represent the front or the back of the person.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I searched for papers on internet but I got no results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any information about that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I'm working on Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following image shows how people looking like from a bird-eye view depth map. You don't look at the big stain. The 3 red circles contain the bird-eye view depth map of (from the left to right): a street fountain, a person and a roadsign.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NigzD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3156" LastEditorUserId="3164" LastEditDate="2012-10-24T14:03:25.873" LastActivityDate="2012-10-26T15:39:09.003" Title="How to do people detection from bird eye view?" Tags="|matlab|classification|motion-detection|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4761" PostTypeId="1" AcceptedAnswerId="4767" CreationDate="2012-10-23T01:55:53.397" Score="3" ViewCount="855" Body="&lt;p&gt;The setup:&#xA;Sound is being played by the speaker on the iphone. At the same moment i record sound via the microphone. Obviously the speaker sound will be recorded in addition to all the external noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal:&#xA;To determine the level of all external sound which is recorded in addition to the sound from the speakers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(no implementation yet)&#xA;So far my approach is to cross correlate the input stream with the output stream to get the delay between both of them and an integer representing the level of similarity at this point, which will be used to estimate external noise. (if the int drops below a given value the noise is too loud) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone experience with stuff like that, if this approach will be accurate enough to make a guess if the external noise reaches a certain level of disturbance?&#xA;Or will i have t do further analysation in the frequency domain via fft for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm completely new to this kind of problem so be kind with me, if I'm totally wrong ;)&lt;/p&gt;&#xA;" OwnerUserId="3160" OwnerDisplayName="Maximilian Körner" LastActivityDate="2012-10-23T16:55:14.637" Title="determine background noise level via cross correlation" Tags="|audio|cross-correlation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4762" PostTypeId="1" CreationDate="2012-10-23T13:43:23.430" Score="0" ViewCount="62" Body="&lt;p&gt;I don't understand the follow step in my notes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is about the filter roll-off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(w)={1\over 1+j(w/w_c)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Rightarrow$&#xA;$|H(w)|= {1\over \sqrt(1+(w/w_c)^2)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(w) = {v_o \over v_i}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w_c$ = cut-off frequency&lt;/p&gt;&#xA;" OwnerUserId="3157" LastActivityDate="2012-10-23T15:09:02.353" Title="Question about the derive of filter roll-off" Tags="|filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4763" PostTypeId="1" AcceptedAnswerId="4787" CreationDate="2012-10-23T14:13:54.217" Score="8" ViewCount="198" Body="&lt;p&gt;&lt;em&gt;Signal processing&lt;/em&gt; is Elsevier, so it's not open access, and &lt;em&gt;IEEE Transactions on Signal Processing&lt;/em&gt; is also not open access. I was wondering if there's any decent journal on par with those that's open access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to submit a paper on discrete time nonlinear filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(there are no tags relating to publication/journal/conference please feel free to add tags or suggest different SE)&lt;/p&gt;&#xA;" OwnerUserId="775" LastEditorUserId="775" LastEditDate="2012-10-25T15:29:28.140" LastActivityDate="2012-10-25T15:29:28.140" Title="Open access signal processing journal?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4764" PostTypeId="2" ParentId="3569" CreationDate="2012-10-23T14:46:41.347" Score="4" Body="&lt;p&gt;&lt;strong&gt;An intuitive explanation&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine that you are outside, at daytime, and there is a heavy fog. The &lt;em&gt;Intensity&lt;/em&gt; is high, because the sun shines. But you cannot see anything because of the fog. The &lt;em&gt;Contrast&lt;/em&gt; is low. All of the rays of light that reach you, have almost the same energy amount, due to the fog. You cannot decipher the details because your eye has some quantization of gray levels, and they look almost alike to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uYlts.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you are outside at night-time, there is no fog, and the moon shines. The &lt;em&gt;Intensity&lt;/em&gt; is low, because there is no direct radiation from the sun. The &lt;em&gt;Contrast&lt;/em&gt; is high, but you fail to see the objects (expect the moon) clearly, because of the low total &lt;em&gt;Intensity&lt;/em&gt;. Now you cannot decipher the details because your eye is not sensitive enough for that amount of energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5MF6l.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another, more mathematical way to think about it:&#xA;Consider the two following Gaussian functions, each has mean and standard deviation. Let's assume that they represent histograms of images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HtipY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Intensity&lt;/em&gt; is the mean value, &lt;em&gt;Contrast&lt;/em&gt; is the standard deviation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the image above, the red distribution has more intensity - its center is located more to the right. The blue distribution has more contrast, it is wider.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; I am confused with contrast and the intensity as they seem opposite to each other&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They are not opposite, the are orthogonal. There can be 4 possibilities:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;High Intensity, High Contrast - &lt;em&gt;Example : Sunny day&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;High Intensity, Low Contrast - &lt;em&gt;Example : Sunny day with fog&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Low Intensity, High Contrast - &lt;em&gt;Example : A moon in the night&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Low Intensity, Low  Contrast - &lt;em&gt;Example : A dark room&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-10-23T20:52:41.297" LastActivityDate="2012-10-23T20:52:41.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4765" PostTypeId="1" AcceptedAnswerId="4768" CreationDate="2012-10-23T14:49:20.237" Score="1" ViewCount="520" Body="&lt;p&gt;I use a swept sine to measure a transfer function, multiplying the reponse by the in phase and quadrature excitation to get a complex response at each frequency. Can you suggest an enhancement to this technique to estimate coherence as well to give an estimate of measurement quality, especially at higher frequencies where the response is small.&lt;/p&gt;&#xA;" OwnerUserId="1822" LastActivityDate="2012-10-23T19:53:06.890" Title="Algorithm to estimate coherence when measuring a transfer function with a swept sine" Tags="|transfer-function|coherence|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4766" PostTypeId="2" ParentId="4762" CreationDate="2012-10-23T15:09:02.353" Score="2" Body="&lt;p&gt;For any arbitrary rational complex function $H(\omega) = \frac{N(\omega)}{D(\omega)}$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|H(\omega)| = \frac{|N(\omega)|}{|D(\omega)|}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This follows straightforwardly from the properties of the polar (i.e. magnitude/phase) representation of complex numbers. So, for your example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|H(\omega)| = \frac{|1|}{|1 + j \frac{\omega}{\omega_c}|}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitude of an arbitrary complex number is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|a + jb| = \sqrt{a^2+b^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for your example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;|H(\omega)| &amp;amp;= \frac{1}{\sqrt{1^2 + \left(\frac{\omega}{\omega_c}\right)^2}} \\&#xA;&amp;amp;= \frac{1}{\sqrt{1 + \left(\frac{\omega}{\omega_c}\right)^2}}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-10-23T15:09:02.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4767" PostTypeId="2" ParentId="4761" CreationDate="2012-10-23T16:55:14.637" Score="2" Body="&lt;p&gt;If you want to get an estimate of the noise, do the cross-correlation, and then multiply your transmitted sound by your cross-correlation peak and then subtract it from your received sounds.  Make sure, of course, that you use the cross-correlation to line up the transmitted sound with when it was received.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What remains after you subtract is the noise with some amount of (hopefully small) error.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-10-23T16:55:14.637" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4768" PostTypeId="2" ParentId="4765" CreationDate="2012-10-23T19:06:54.063" Score="2" Body="&lt;p&gt;For each frequency, divide the measurement time into chunks.  For each chunk, do your estimation of the amplitude at that frequency in both the input and output channels.  Then compute the &lt;a href=&quot;http://en.wikipedia.org/wiki/Coherence_%28signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;coherence&lt;/a&gt; for this ensemble of measurements at each frequency.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you measure at each frequency for &lt;code&gt;Ncyc&lt;/code&gt; cycles, then divide these into &lt;code&gt;Navg&lt;/code&gt; measurements each of &lt;code&gt;Ncyc/Navg&lt;/code&gt; cycles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A nice reference on this subject is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470248777&quot; rel=&quot;nofollow&quot;&gt;Bendat and Piersol&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-10-23T19:53:06.890" LastActivityDate="2012-10-23T19:53:06.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4770" PostTypeId="1" AcceptedAnswerId="74935" CreationDate="2012-10-23T23:43:45.027" Score="4" ViewCount="3464" Body="&lt;p&gt;I've been doing some background readings on &lt;em&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Demosaicing&quot; rel=&quot;nofollow noreferrer&quot;&gt;demosaicing&lt;/a&gt;&lt;/em&gt; raw images.&#xA;I've seen the &lt;strong&gt;Kodak PhotoCD raw image dataset&lt;/strong&gt; mentioned in a few papers on demosaicing:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://jacques.desmis.perso.neuf.fr/geraud/demosaicing_survey.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Demosaicing: A Systematic Survey&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://research.microsoft.com/pubs/102068/Demosaicing_ICASSP04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;High Quality Linear Interpolation for Demosaicing of Bayer-Patterned Images&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.dmmd.net/research/publications/journal/demo_or.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Demosaicing using optimal recovery&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;After some googling, I haven't been able to find the Kodak dataset. Where can I download the Kodak PhotoCD dataset?&lt;/p&gt;&#xA;" OwnerUserId="3162" LastEditorUserId="7092" LastEditDate="2021-11-24T04:29:37.893" LastActivityDate="2021-11-24T04:29:37.893" Title="Where to get the Kodak PhotoCD raw image dataset?" Tags="|reference-request|camera|photo|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4771" PostTypeId="1" AcceptedAnswerId="4798" CreationDate="2012-10-24T00:00:05.683" Score="8" ViewCount="1036" Body="&lt;p&gt;Working with my own MATLAB implementation of the short-time Fourier transform (STFT), I've managed to write code for the analysis step where a 1D time-domain signal $s[t]$ is progressively windowed, taken into the Fourier domain and arranged in a 2D matrix $S[t,\omega]$.  Each element in the 2D matrix is a function of time $t$ and frequency $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://recherche.ircam.fr/anasyn/roebel/amt_audiosignale/VL2.pdf&quot; rel=&quot;nofollow&quot;&gt;presentation&lt;/a&gt; is a rather nice overview of the STFT, and gives a number of equations detailing the analysis and re-synthesis steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to be able to arbitrarily modify $S[t,\omega]$, and then use the re-synthesis to get back $s[t]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that I should be able to change $S[t,\omega]$ in whatever way that I want, and then obtain $s[t]$ by the re-synthesis procedure.  This seems to be very similar to the idea of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_vocoder&quot; rel=&quot;nofollow&quot;&gt;phase vocoder&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As noted in section 3.1 of the presentation, the time-domain signal $s[t]$ can be recomposed using a least-squares procedure.  This is given as Equation (6) in the 1984 paper by &lt;a href=&quot;http://musicweb.ucsd.edu/~sdubnov/catbox/Reader/GriffinLimMSTFT.pdf&quot; rel=&quot;nofollow&quot;&gt;Griffin and Lim&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The least-squares procedure is required to be applied when $S[t,\omega]$ is modified in some way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What does Equation (6) of the Griffin and Lim paper mean?  &lt;/li&gt;&#xA;&lt;li&gt;What steps do I follow to numerically implement Equation (6)?  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the presentation, the equation is written in a slightly different way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=\frac{\sum_{l=-\infty}^\infty w\left(n-lI\right)y\left(lI, n\right)}{\sum_{l=-\infty}^\infty w\left(n-lI\right)^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $x(n)$ is the re-synthesized time-domain sequence, $w(n)$ is the window function, and $y(n)$ is the time-domain version of a column of the 2D matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the presentation, here are the steps that I think are required to do the re-synthesis:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Let &lt;code&gt;w_n&lt;/code&gt; be the discrete window vector and &lt;code&gt;y_n(:,k)&lt;/code&gt; be the time domain vector computed using the IFFT on a column &lt;code&gt;k&lt;/code&gt; of the 2D matrix.  Both &lt;code&gt;w_n&lt;/code&gt; and &lt;code&gt;y_n(:,k)&lt;/code&gt; are the same length.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then, using Matlab syntax, we compute the point-by-point multiplication:&#xA;&lt;code&gt;w_n .* y_n(:,k)&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this the numerator of the expression above?&lt;/li&gt;&#xA;&lt;li&gt;What happens during steps 3 and 4? &lt;/li&gt;&#xA;&lt;li&gt;What do the infinite summations signify?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="128" LastEditDate="2019-11-28T06:25:39.450" LastActivityDate="2019-11-28T06:25:39.450" Title="Least Squares Re Synthesis of Short Time Fourier Transform (STFT)" Tags="|matlab|algorithms|stft|time-frequency|least-squares|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4772" PostTypeId="2" ParentId="4770" CreationDate="2012-10-24T00:17:17.220" Score="3" Body="&lt;p&gt;The dataset appears to be in the public domain, and has been posted at this site &lt;a href=&quot;http://r0k.us/graphics/kodak/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pictures (24 in total) were originally released in 1991 on a CD.  The original media with the actual image data could be requested via interlibrary loan; here is a WorldCat &lt;a href=&quot;http://www.worldcat.org/oclc/36953343&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; to the repositories holding this item. The CD was originally distributed by Apple Computer.  The raw version of the files do not appear to be available online.&lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="1048" LastEditDate="2012-10-24T01:38:27.780" LastActivityDate="2012-10-24T01:38:27.780" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4773" PostTypeId="2" ParentId="4702" CreationDate="2012-10-24T02:58:17.437" Score="2" Body="&lt;p&gt;This really is a comment but is posted as an answer because it&#xA;is too long to post as a comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your edited question says that you are transmitting $16$-byte packets &#xA;consisting of $8$ data bytes and $8$ parity bytes over a channel with &#xA;bit error rate of $10\%$ or $0.1$.  Thus, your code rate is fixed at $0.5$.&#xA;Now Shannon's capacity formula for a (binary memoryless) channel with bit &#xA;error rate $p$ is&#xA;$$C = -p\cdot\log_2(p) - (1-p)\cdot\log_2(1-p) = 0.46899559358929 ~~ \text{when}~p=0.1.$$&#xA;Thus it is not too surprising that using a rate-$\frac{1}{2}$ code is not&#xA;working too well, and switching from a Reed-Solomon code to an LDPC code&#xA;is not going to help matters very much as long as the code rate is fixed&#xA;at $\frac{1}{2}$. You may need to redesign the packet structure to reduce&#xA;the code rate and/or improve SNR on the physical layer channel to reduce the&#xA;error rate to something more easily handled by coding.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-10-24T02:58:17.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4774" PostTypeId="5" CreationDate="2012-10-24T07:16:08.700" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2012-10-24T07:16:08.700" LastActivityDate="2012-10-24T07:16:08.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4775" PostTypeId="4" CreationDate="2012-10-24T07:16:08.700" Score="0" Body="Smoothing a signal or data set approximates the data to reveal patterns and exclude noise, fine-scale structure and rapid changing phenomina." OwnerUserId="1822" LastEditorUserId="1822" LastEditDate="2012-10-24T14:40:33.843" LastActivityDate="2012-10-24T14:40:33.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4776" PostTypeId="5" CreationDate="2012-10-24T07:22:38.117" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2012-10-24T07:22:38.117" LastActivityDate="2012-10-24T07:22:38.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4777" PostTypeId="4" CreationDate="2012-10-24T07:22:38.117" Score="0" Body="In signal processing, estimation is a technique for approximating an unobserved signal from an observed signal containing noise." OwnerUserId="1822" LastEditorUserId="1822" LastEditDate="2012-10-24T15:40:57.193" LastActivityDate="2012-10-24T15:40:57.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4778" PostTypeId="5" CreationDate="2012-10-24T07:27:49.250" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2012-10-24T07:27:49.250" LastActivityDate="2012-10-24T07:27:49.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4779" PostTypeId="4" CreationDate="2012-10-24T07:27:49.250" Score="0" Body="In signal processing, a transform is a mathematical technique to convert data in one domain to another. The most common example is using the Fourier Transform to convert data from the time domain to the frequency domain." OwnerUserId="1822" LastEditorUserId="1822" LastEditDate="2012-10-24T15:41:08.287" LastActivityDate="2012-10-24T15:41:08.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4780" PostTypeId="5" CreationDate="2012-10-24T07:33:03.147" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2012-10-24T07:33:03.147" LastActivityDate="2012-10-24T07:33:03.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4781" PostTypeId="4" CreationDate="2012-10-24T07:33:03.147" Score="0" Body="A linear system operates on inputs with only linear operators so the response to a complex input can be analysed as the sum of the response to a set of simpler inputs. This mathematical property makes the analysis of linear systems much simpler than non-linear systems where this summation or superposition does not hold. Linear systems are generally further classified as time invariant, meaning that there characteristics do not change over time." OwnerUserId="1822" LastEditorUserId="1822" LastEditDate="2012-10-24T16:13:45.957" LastActivityDate="2012-10-24T16:13:45.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4782" PostTypeId="2" ParentId="3569" CreationDate="2012-10-24T08:33:55.013" Score="7" Body="&lt;p&gt;&lt;strong&gt;On intensity&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply said, it's hard to talk about &quot;intensity&quot; of an image. &lt;em&gt;Every pixel has its intensity&lt;/em&gt; (for greyscale images, they are usual allowed range is [0, 255]), but the concept of &lt;em&gt;image intensity&lt;/em&gt; does not exist. If you are doing some kind of image analysis, you could be interested in a parameter describing image intensities, e.g. mean intensity (like @geometrikal said) or distribution of image levels (which is related to &lt;em&gt;contrast&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On contrast&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you presume an idealized situation where a greyscale image contains only pixels of two &lt;em&gt;intensity values&lt;/em&gt;, one for background pixels and one for object pixels, the &lt;em&gt;contrast of the object&lt;/em&gt; would be the difference of those values. What it means on the displayed image --&gt; the higher the contrast, the easier it is to &lt;em&gt;spot&lt;/em&gt; (find, locate) the object on the image (for the human eye). Again, you would usually talk about contrast &lt;em&gt;of an object in an image&lt;/em&gt;, it's hard to talk about contrast of an image where it is not possible to define an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, let's look at several 1-D signals (you can produce images similar to your examples from these):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1)   0   0   0   0  20  20   0   0  &#xA;&#xA;2)   0   0   0   0 255 255   0   0&#xA;&#xA;3) 200 200 200 200 255 255 200 200&#xA;&#xA;4) 200 200 200 200   0   0 200 200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'll assume that the two pixels different from the rest in each example are object pixels, and the rest are background. We have several cases here (and I could make more):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;brighter object on dark background, all intensity values are low (i.e. the image is rather dark), contrast is low&lt;/li&gt;&#xA;&lt;li&gt;bright object on dark background, most pixels have low intensity, contrast is high (it's a black-white image)&lt;/li&gt;&#xA;&lt;li&gt;bright object on darker background, all intensity values are high (i.e. the image is bright), contrast is low (but higher then in the 1st example)&lt;/li&gt;&#xA;&lt;li&gt;dark object on bright background, most pixels have high intensity, contrast is high (but not as high as in the 2nd example)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's another example supporting the fact that the &lt;em&gt;contrast&lt;/em&gt; is usually an attribute describing an &lt;em&gt;object&lt;/em&gt;, either in relation to itself or to the surrounding. Another important fact to notice from this example is that contrast generally describes the difference between the intensity levels, &lt;em&gt;but the precise definition depends on the application (purpose for the measurement)&lt;/em&gt;. Let me paraphrase the contrast definition used in &lt;em&gt;hierarchical image segmentation&lt;/em&gt; from &lt;a href=&quot;http://www.google.fr/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=6&amp;amp;cad=rja&amp;amp;ved=0CFAQFjAF&amp;amp;url=http%3A%2F%2Fhal-enpc.archives-ouvertes.fr%2Fdocs%2F00%2F73%2F32%2F51%2FPDF%2Fsoille-najman2011lncs-camera-ready.pdf&amp;amp;ei=QbiXUOC8LoLP0QW3rYHoDA&amp;amp;usg=AFQjCNHS2DnE-ejdzramqx9dXfY4KqP4Yg&quot; rel=&quot;noreferrer&quot;&gt;P. Soille, L. Najman: On morphological hierarchical representations for image processing and spatial data clustering&lt;/a&gt; as an example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The &lt;em&gt;internal contrast&lt;/em&gt; of a connected component (object) corresponds to the &lt;em&gt;largest&lt;/em&gt; intensity difference between two adjacent pixels belonging to this connected component. The &lt;em&gt;external contrast&lt;/em&gt; is defined as the &lt;em&gt;smallest&lt;/em&gt; intensity difference between a pixel of the considered connected component and an adjacent pixel not belonging to the considered component.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Of course, a different application could use a different measurement for contrast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On &lt;code&gt;imadjust&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't usually work in MATLAB, but from the &lt;a href=&quot;http://www.mathworks.fr/fr/help/images/ref/imadjust.html&quot; rel=&quot;noreferrer&quot;&gt;documentation&lt;/a&gt;, it is used to map intensity range (intensity levels in given range) of an input image, to an intensity range specified for the output image. The default, no-parameter call, &lt;em&gt;will increase contrast&lt;/em&gt; of the image. But, you can &lt;em&gt;get a brighter/darker image&lt;/em&gt; with &lt;code&gt;imadjust&lt;/code&gt; with &lt;em&gt;either increasing or decreasing&lt;/em&gt; the object contrast. Let me demonstrate this on &lt;em&gt;my 3rd example&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imadjust(I3, [0.8; 1.0], [0.0; 1.0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should output &lt;code&gt;0 0 0 0 255 255 0 0&lt;/code&gt;. You would get a white object on black background. In general, the image is darker (lower intensity), but contrast is higher (black-white).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imadjust(I3, [0.8; 1.0], [0.0; 0.2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should output &lt;code&gt;0 0 0 0 51 51 0 0&lt;/code&gt;. Fairly dark object on a black background. The image is darker (lower intensity) and &lt;em&gt;the contrast of the object did not change&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imadjust(I3, [0.8; 1.0], [0.85; 0.9])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should output &lt;code&gt;216 216 216 229 229 216 216&lt;/code&gt;. Very bright object on bright background. The image is brighter (higher intensity), and the contrast of the object decreased (object intensity levels are more similar to the intensity levels of the background).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You get the actual ranges the function is working with by multiplying them with the maximum gray level (255). For example, a range &lt;code&gt;[0.2; 0.8]&lt;/code&gt; is actually intensity range &lt;code&gt;[51; 204]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more thing to take care of is that the function clips the values outside the first intensity range, and maps them to the new low if they're smaller or new high if they're larger then the range. All of my examples actually include this: the first range starts from &lt;code&gt;0.8&lt;/code&gt; which maps to intensity &lt;code&gt;204&lt;/code&gt;, but the intensity of &lt;code&gt;200&lt;/code&gt; from the input image is mapped to the output low in all the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it's actually just a simple &lt;strong&gt;scaling of image intensities&lt;/strong&gt; (with cut-offs). Also, the default call to &lt;code&gt;imadjust&lt;/code&gt; with only an image as an input parameter should increase contrast. I'd say that &lt;code&gt;imadjust(I2)&lt;/code&gt; wouldn't do anything (there's a maximum contrast in my second example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On contrast enhancement&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quote from &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=773286&quot; rel=&quot;noreferrer&quot;&gt;P. Soille: Morphological Image Analysis&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Image contrast enhancement refers to accentuation or sharpening of image features so as to make a graphic display more useful for visualization or analysis of the image by the human eye.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;He also emphasizes: with enhanced contrast &lt;em&gt;image analysis by visual (human) inspection is easier&lt;/em&gt;. In idealized images like in my examples, a computer wouldn't gain much in term of image analysis difficulty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. for object extraction by thresholding, it would just mean different thresholds should be used to extract the object from the background. But, a human examiner would spot the object much easier on high-contrast images. This all changes some in real images (objects don't have uniform gray levels), so contrast enhancement becomes useful in image analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several methods of contrast enhancement:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;point-based&lt;/em&gt; techniques, where the local neighborhood is &lt;em&gt;not important&lt;/em&gt;. They are based on the analysis of grey levels through the whole image&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;neighborhood based&lt;/em&gt; techniques, where &lt;em&gt;local neighborhood of the pixel is important&lt;/em&gt;. Examples are &lt;strong&gt;white&lt;/strong&gt; and &lt;strong&gt;black top-hat operators&lt;/strong&gt;, and &lt;strong&gt;toogle contrast operator&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;transform based&lt;/em&gt; techniques, where the filtering is done on a transformed image before using the inverse transform (e.g. filtering in the frequency domain after Fourier transform).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On intensity adjustment&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In term of greyscale image, the intensity of the pixel corresponds to it's brightness. The greater the intensity, the greater the brightness. This also means that &lt;em&gt;increasing intensity&lt;/em&gt; can be viewed as &lt;strong&gt;brightening the image&lt;/strong&gt; (while &lt;em&gt;decreasing intensity&lt;/em&gt; can be viewed as &lt;strong&gt;darkening the image&lt;/strong&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would describe the process of &lt;strong&gt;uniformly brightening&lt;/strong&gt; the image as &lt;em&gt;increasing intensity while leaving the contrast unchanged in the whole image&lt;/em&gt;.&#xA;This actually means adding a constant value to all the pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, as the pixel intensity values have a predefined range, typically [0..255], this means that the &lt;em&gt;maximum intensity&lt;/em&gt; exists. This inevitably means that some pixels (that were different from each other before) will become white (i.e. intensity 255).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &quot;naturally&quot; happens when you take a photo aimed towards something very bright -- sun or other light. Away from the light, you might see some details, but at the position of the light/sun and around it, you will get only white pixels meaning that the intensity (amount of light when the image was taken) &quot;hit&quot; its maximum (displayable/storable) value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way you &lt;em&gt;wouldn't lose details&lt;/em&gt; by this operation would be if the original pixel intensities belong to only a part of possible intensity range, e.g. if original pixels are in the range [10, 150], the image could be brightened by up to 105 intensity levels before you start to loose details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;code&gt;imgadjust&lt;/code&gt; is meant to preform &lt;em&gt;intensity scaling&lt;/em&gt;, it can do much more than just brighten/darken image. If you wanted to emulate brightening effect with &lt;code&gt;imadjust&lt;/code&gt;, you could write something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imadjust(I, [0.0; x], [1.0-x; 1.0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;x&lt;/code&gt; is any number between 0 and 1 (e.g. &lt;code&gt;x=0.5&lt;/code&gt; would brighten a [0..255] image by 127).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, this is an overkill for such a simple operation. I'm sure matlab has a elementary operation that adds a scalar to all elements of a matrix, so you could just use that :)&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="1273" LastEditDate="2012-11-05T13:43:21.950" LastActivityDate="2012-11-05T13:43:21.950" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4783" PostTypeId="2" ParentId="4754" CreationDate="2012-10-24T09:46:36.407" Score="4" Body="&lt;p&gt;Have a look at the acoustic scale website for some inspiration&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.acousticscale.org/wiki/index.php/Main_Page&quot; rel=&quot;nofollow&quot;&gt;http://www.acousticscale.org/wiki/index.php/Main_Page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can estimate age based on a combination of vocal tract length (vtl) and pitch. Both of these attributes can be extracted from vowel sounds. Children will have short vtls and high pitch, adult males will have low pitch and long vtl, adult women will have fairly long vtls and higher pitch. Dwarfs can have short vtls and low pitch. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Castrato&quot; rel=&quot;nofollow&quot;&gt;castrato&lt;/a&gt; will have long vtl and high pitch.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-10-24T09:46:36.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4784" PostTypeId="1" AcceptedAnswerId="4785" CreationDate="2012-10-23T22:51:47.943" Score="7" ViewCount="4512" Body="&lt;p&gt;I want to extract only the grapes from the images. Unfortunately, sometimes I don't get the grapes exactly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a code that doesn't work well in all cases. Sometimes, it does not differentiate between the shadows and the grapes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example input image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4etHi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result I'm getting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OAjIZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RGB = imread('DSC02807.JPG');&#xA;GRAY = rgb2gray(RGB);&#xA;&#xA;threshold = graythresh(GRAY);&#xA;originalImage = im2bw(GRAY, threshold);&#xA;&#xA;originalImage = bwareaopen(originalImage,250);&#xA;&#xA;SE = strel('disk',10);&#xA;IM2 = imclose(originalImage,SE);&#xA;&#xA;originalImage = IM2;&#xA;&#xA;imshow(originalImage);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3206" OwnerDisplayName="Alon Shmiel" LastEditorUserId="128" LastEditDate="2020-07-22T10:04:36.567" LastActivityDate="2020-07-22T10:04:36.567" Title="Remove Shadows from Contour of an Object (Grapes)" Tags="|image-processing|matlab|computer-vision|image-segmentation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4785" PostTypeId="2" ParentId="4784" CreationDate="2012-10-24T06:36:43.243" Score="8" Body="&lt;p&gt;This is what &lt;strong&gt;your&lt;/strong&gt; code produces (using colormap(hot) with white boundaries that are obtained from IM2):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Fby8W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the shadows are nicely treated, why are you thinking that your code doesn't notice between shadow to grapes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code used for producing this image&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bw=IM2&amp;lt;1;&#xA;[B,L] = bwboundaries(bw,'noholes'); % fill any holes, so that regionprops can be used to estimate&#xA;imagesc(GRAY); hold on&#xA;for k = 1:length(B) &#xA;    boundary = B{k};&#xA;    plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 1); hold on&#xA;end&#xA;colormap(hot(256))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2044" OwnerDisplayName="nate" LastActivityDate="2012-10-24T06:43:22.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4786" PostTypeId="2" ParentId="2604" CreationDate="2012-10-24T13:15:58.370" Score="2" Body="&lt;p&gt;I was just working on the same issue and the magnitude was the same as yours (10e-4), but the peak in the middle, in terms of the shape, looked correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to solve this problem by scaling back R, by d, the number of pixels in the image.  In my case I am using 64 x 64 pixel images (d = 64*64 = 4096).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, make sure you take the real of R, to get rid of the complex part, even though it should be very small, then multiply R by d and your scaling should be correct.  To test this, use an image you trained your filter on and your max(R(:)*d) = 1.0.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% COMPUTE THE CORRELATIN PLANE&#xA;R = ifftshift(ifft2(test_img.*conj(H_square)));&#xA;R = real(R);&#xA;% PLOT THE CORRELATION PLANE&#xA;figure;&#xA;mesh(R*d)&#xA;axis([0 64 0 64 -0.5 1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3167" LastActivityDate="2012-10-24T13:15:58.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4787" PostTypeId="2" ParentId="4763" CreationDate="2012-10-24T15:03:00.143" Score="7" Body="&lt;p&gt;The EURASIP Journal on Advances in Signal Processing is a Springer journal with open access.  It sounds like the topic of your paper is appropriate for it.  The impact factor is not as high as IEEE Transactions on Signal Processing though.&lt;/p&gt;&#xA;" OwnerUserId="2007" LastActivityDate="2012-10-24T15:03:00.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4788" PostTypeId="1" AcceptedAnswerId="4790" CreationDate="2012-10-24T19:33:28.110" Score="14" ViewCount="524" Body="&lt;p&gt;I know of some oscilloscopes (&lt;a href=&quot;http://www.tek.com/performance-oscilloscopes/dsa8300&quot;&gt;DSA8300&lt;/a&gt;) that repeatedly sample at a few hundred kS/s to reconstruct a few GHz signal. I was wondering if this could be extended to 2D signals (photographs). Can I take a series (say 4) of still pictures using a commercial 16MP camera to finally reconstruct a 32MP image? Will doing this remove aliasing I have from each image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should such a thing be attempted from a single image it would obviously not work as no new information is being introduced. If all the pictures taken are absolutely identical, will I still be at the same point as having one image? So are variations essential? Is CCD / CMOS noise enough variation for such a thing to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a name for such a technique or algorithm? What should I look for?&lt;/p&gt;&#xA;" OwnerUserId="842" LastEditorUserId="128" LastEditDate="2018-07-12T11:33:28.227" LastActivityDate="2018-07-12T11:33:28.227" Title="Increasing Image Resolution" Tags="|image-processing|aliasing|resolution|superresolution|inverse-problem|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4790" PostTypeId="2" ParentId="4788" CreationDate="2012-10-24T20:16:12.240" Score="8" Body="&lt;p&gt;One word for that technique is &lt;a href=&quot;http://en.wikipedia.org/wiki/Superresolution&quot;&gt;superresolution&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://robertgawron.blogspot.com/2011/01/super-resolution-algorithm-implemented.html&quot;&gt;Robert Gawron&lt;/a&gt; has a blog post here and the &lt;a href=&quot;https://github.com/RobertGawron/supper-resolution&quot;&gt;Python implementation here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, this technique relies on each image being slightly offset from the others.  The only gain you'd get from &lt;em&gt;not&lt;/em&gt; moving between shots would be to reduce the noise level.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2012-10-24T20:16:12.240" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4791" PostTypeId="2" ParentId="2855" CreationDate="2012-10-25T01:24:58.510" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Mellin_transform#Applications&quot; rel=&quot;nofollow&quot;&gt;Mellin transform&lt;/a&gt; can also be used to determine such signals, because &quot;the magnitude of the Mellin transform of a scaled function is identical to the magnitude of the original function. This scale invariance property is analogous to the Fourier Transform's shift invariance property. The magnitude of a Fourier transform of a time-shifted function is identical to the original function.&quot; (cited from wikipedia)&lt;/p&gt;&#xA;" OwnerUserId="1641" LastActivityDate="2012-10-25T01:24:58.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4792" PostTypeId="2" ParentId="2577" CreationDate="2012-10-25T01:47:55.057" Score="4" Body="&lt;p&gt;The Slepian sequences are a family of functions.  Most algorithms calculate 2*NW - 1  sequences at once for a given NW.  N is the number of points in the sequence and W decides half the width of the mainlobe in the frequency domain for the Fourier transform of a given Slepian sequence.  Typically you would use an NW of 3 or 4 for your signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In scipy, they are asking for the $N$ (m in the Python code) and the $W$ (width in the Python code) parameter separately while in matlab you input the time-bandwidth product $NW$ as a single parameter.  This makes sense because you're typically calculating the Slepian sequences for a fixed window size, $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are estimating the power spectrum of a stationary time series the DPSS are the set of windows you should use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The generalized Gaussian function returns a Gaussian-like function raised to successively higher powers depending on the p parameter.  As p is raised to successively higher powers the generalized Gaussian becomes narrower in the time domain.  The nice property of a Gaussian is that it is it's own Fourier transform and it is the function that achieves the limit concerning the uncertainty principle.  A Gaussian function may be useful if you would like to compute a short-time Fourier transform or spectrogram as an estimator for a time-varying power spectrum of a non-stationary time series.&lt;/p&gt;&#xA;" OwnerUserId="2007" LastEditorUserId="2007" LastEditDate="2012-10-25T02:16:49.477" LastActivityDate="2012-10-25T02:16:49.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4793" PostTypeId="2" ParentId="3320" CreationDate="2012-10-25T02:02:44.077" Score="2" Body="&lt;p&gt;There are two sources of error in estimating a quantity: variance and bias.  In your question you have only considered variance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The improvement in the spectrum estimate using the periodogram comes because there is less smearing of frequency components as you include more samples in your estimate of the power spectrum.  Using a longer data window causes less power from one frequency to be leaked into other frequencies.  However, this only reduces the bias of the estimate.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as you use more samples the bias is decreased, which means you do have a better estimate.  However, the variance remains unchanged, as stated in Numerical Recipes.  A discussion of this is given on this web page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://matlab.izmiran.ru/help/toolbox/signal/spectra7.html&quot; rel=&quot;nofollow&quot;&gt;http://matlab.izmiran.ru/help/toolbox/signal/spectra7.html&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="2007" LastActivityDate="2012-10-25T02:02:44.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4794" PostTypeId="1" CreationDate="2012-10-25T03:02:55.383" Score="1" ViewCount="228" Body="&lt;p&gt;Follow up &lt;a href=&quot;https://dsp.stackexchange.com/questions/4699/how-does-this-equation-correspond-to-smoothing/4701&quot;&gt;to the question here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a screen shot of an intermediate step in the middle of my calculation&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1RfmG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dotted line called MY is supposed to be a smoothed version of db pow y&#xA;db pow y is the magnitude squared represented in base 2 log scale, of the first half of a 128 point FFT&#xA;In the every next iteration, I can see that db pow y changes drastically (it is the sound input data, so it may be anything at every step) while the graph for MY changes very very slightly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my question is , since MY is a smoothed version of db pow y, shouldn't it be running close to the graph of db pow y? I know that it will definitely not be closer to db pow y as it changes drastically at each iteration and MY changes very slightly, but I still do not understand exactly how this is supposed to work&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, at points such as A in the graph above, the dotted line seems to &quot;ignore&quot; sharp variations in db pow y (as I would expect, since MY is smoothed version of db pow y), but then again, at positions such as B, the dotted line is the one changing drastically&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, could you please explain to me how this is supposed to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the smoothing equation used:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;    pDashS(i) = 0.2 * pDashS(i) + 0.8 * ((db_pow_y(i)-pres_minima(i)) &amp;gt; diff_between_db_pow_y_and_pres_min);&#xA;    alphaDTildS(i) = 0.95 + 0.05 * pDashS(i);&#xA;    MY(i) = alphaDTildS(i) * pastMY(i) + (1- alphaDTildS(i)) * db_pow_y(i);&#xA;    pastMY(i) = MY(i);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;where i ranges from 1 to 64, half of a 128 point FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the actual line performing the smoothing is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;MY(i) = alphaDTildS(i) * pastMY(i) + (1- alphaDTildS(i)) *&#xA;  db_pow_y(i);&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which, from what I understand from answers to my previous questions, this is an example of a low pass IIR filter which performs smoothing on db_pow_y and alphaDTildS is the smoothing parameter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(PS: code is in Matlab)&lt;/p&gt;&#xA;" OwnerUserId="3121" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-10-26T16:44:11.390" Title="Help me in understanding smoothing" Tags="|matlab|smoothing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4795" PostTypeId="2" ParentId="2738" CreationDate="2012-10-25T04:13:17.420" Score="3" Body="&lt;p&gt;Can you get multiple images, i.e. is the target static?&#xA;If so then you could 'stack' the images to remove the noise. A simple mean or median function will remove the random noise from the image stack and leave you with just the signal (i.e. the white lines).&lt;/p&gt;&#xA;" OwnerUserId="3172" LastActivityDate="2012-10-25T04:13:17.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4796" PostTypeId="1" CreationDate="2012-10-25T12:14:28.347" Score="-1" ViewCount="208" Body="&lt;p&gt;I got two sampled signals (samples at different rates ),how to find out the offset between them and to sync automatically  in Matlab &lt;/p&gt;&#xA;" OwnerUserId="2006" LastActivityDate="2012-10-25T14:12:00.093" Title="To find the time offset between two differently sampled signals" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4797" PostTypeId="2" ParentId="4796" CreationDate="2012-10-25T14:12:00.093" Score="4" Body="&lt;p&gt;Resample the signal at the lower rate to the higher rate, and then do a cross-correlation.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-10-25T14:12:00.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4798" PostTypeId="2" ParentId="4771" CreationDate="2012-10-25T16:01:50.227" Score="3" Body="&lt;p&gt;The least-squares re-synthesis procedure is very similar to the overlap-add (OLA) procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;code&gt;w_n&lt;/code&gt; be the discrete window vector and &lt;code&gt;y_n(:,k)&lt;/code&gt; be the time domain vector computed using the IFFT on a column &lt;code&gt;k&lt;/code&gt; of the 2D matrix. Both &lt;code&gt;w_n&lt;/code&gt; and &lt;code&gt;y_n(:,k)&lt;/code&gt; are the same length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, using Matlab syntax, we compute the point-by-point multiplication with the window:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;w_n .* y_n(:,k)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned in the comments above, the &lt;code&gt;y_n&lt;/code&gt; is trimmed to be the same length as the window &lt;code&gt;w_t&lt;/code&gt;.  The &lt;code&gt;w_n .* y_n(:,k)&lt;/code&gt; is then overlap-added in the same fashion as shown in the code associated with my previous post on the inverse STFT &lt;a href=&quot;https://dsp.stackexchange.com/questions/2757/inverse-short-time-fourier-transform-algorithm-described-in-words&quot;&gt;here&lt;/a&gt;.  The overlap-added sequence is the &lt;code&gt;numerator&lt;/code&gt; of the expression shown in the original question above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same overlap-add operation is applied to the squared window &lt;code&gt;w_t.^2&lt;/code&gt;.  This is the &lt;code&gt;denominator&lt;/code&gt; of the expression shown in the original question above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the final re-synthesized output is simply the point-by-point division of the numerator by the denominator.  In Matlab syntax,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;numerator ./ denominator&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-10-25T16:01:50.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4799" PostTypeId="1" AcceptedAnswerId="4810" CreationDate="2012-10-25T17:14:10.803" Score="3" ViewCount="282" Body="&lt;p&gt;I'm currently developing a multi-view stereo system but I'm confused as to how all the standard equations in Structure from Motion are affected in the presence of radial and decentering distortion. For example, the standard imaging model is that of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) World to Camera Coordinates --&gt; translate to camera center and rotate to match orientation of camera (R,t)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) Perspective Projection --&gt; x = fX/Z and y = fY/Z &lt;/p&gt;&#xA;&#xA;&lt;p&gt;c) Conversion to Pixel Coordinates --&gt; scale by no. of pixels/m and add principal point&#xA;(b and c can be combined into matrix K)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, we can build a projection matrix P = K[R|t]. Thus a point X in world coordinates can be represented in pixel coordinates as u = PX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can also create a fundamental matrix F between two images such that a pair of corresponding point (f on image I1 and f' on image I2) satisfy the epipolar constraint;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x'Fx = 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix F depends upon the matrix P. But, my question is that if we incorporate radial and decentering distortion, the matrix P can no longer represent the imaging model. How do we get an epipolar &quot;curve&quot; representation ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, for things like triagulation back to 3D coordinates from 2D point.. how do we do it ?&lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2014-04-09T08:18:15.340" Title="Incorporating Radial Distortion in Imaging Model" Tags="|image-processing|computer-vision|stereo-vision|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4801" PostTypeId="1" AcceptedAnswerId="4807" CreationDate="2012-10-25T21:26:41.193" Score="9" ViewCount="9450" Body="&lt;p&gt;So, I've just learned that the human voice is not a single sine wave its a bunch of unlimited Sine waves each having a different frequencies,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Wikipedia,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The voice consists of sound made by a human being using the vocal&#xA;  folds for talking, singing, laughing, crying, screaming, etc. Its&#xA;  frequency ranges from about 60 to 7000 Hz.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So if the human voice is a composite signals, it contains various frequencies ranges between 60Hz to 7KHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose if there is a group of people singing the same song all together, each person has its own ranges of voice frequencies,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a person A has the following frequencies,&#xA;100Hz , 250HZ 6KHz, 10Hz, 87Hz, 52Hz, 2KHz.......&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and a Person B has the following,&#xA;217Hz1, 11Hz, 12Hz, 2323Hz, 839Hz, 4KHz, 100Hz, 10Hz.....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there must be so many frequencies which are similar in both the person A &amp;amp; B, like in above example the frequencies 100Hz and 10Hz are common between two persons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was watching a TV Show name &quot;Fringe&quot; where they filter out the particular Man's voice from an audio file while there were other people voice present there too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does exactly they filter someone's voice out of the voice of 100s of people if there are so many frequencies common among all of them does it have to do something with the amplitudes of person's frequencies ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2012-10-26T13:46:17.297" LastActivityDate="2015-04-22T17:54:14.440" Title="How is it possible to Filter out a person's voice out of 100 of other voices?" Tags="|frequency|voice|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4802" PostTypeId="1" CreationDate="2012-10-25T15:33:33.823" Score="3" ViewCount="294" Body="&lt;p&gt;I'm designing a device that will have an IR photodiode connected to a low power microcontroller's ADC pin. At times, another device will be transmitting a 48KHz square wave, and I'd like to be able to detect when that is the case entirely in software, as well as being able to detect individual high and low transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that a &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-locked_loop&quot; rel=&quot;nofollow&quot;&gt;PLL&lt;/a&gt; is the correct solution to this problem. However, I have extremely limited DSP knowledge, so I have a fuzzy idea at best on how to actually implement this in software, and much of the documentation available goes well over my head with a lot of domain specific terminology. This is further complicated by the low power nature of the microcontroller - I have limited processor cycles available, and thus I'd like to sample as infrequently as possible while still reliably locking on to the signal. If it helps, the sampling timer can be adjusted to match the observed frequency of the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest an approach to this that is as straightforward and understandable as possible, while also minimizing CPU resources consumed?&lt;/p&gt;&#xA;" OwnerUserId="3181" OwnerDisplayName="Nick Johnson" LastEditorUserId="26573" LastEditDate="2018-09-11T00:52:17.500" LastActivityDate="2018-09-11T00:52:17.500" Title="Locking on to a square wave signal with minimum oversampling" Tags="|sampling|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4803" PostTypeId="2" ParentId="4802" CreationDate="2012-10-25T15:58:43.397" Score="2" Body="&lt;p&gt;One partial answer to my own question is to use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow&quot;&gt;Goertzel algorithm&lt;/a&gt; instead of a PLL. The Goertzel algorithm makes it possible to trivially determine the power of a particular frequency; it won't provide the phase, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Goertzel algorithm can be implemented quite trivially using a multiplication and two additions per sample; the sampling rate need only be a minimum of twice the frequency of the signal to be detected. Determining the amplitude of the signal from the Goertzel algorithm's output requires four more multiplies and two more additions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the multiplication in the main part of the Goertzel algorithm is by a constant factor of &lt;code&gt;2 * cos(2 * pi * w)&lt;/code&gt;, where &lt;code&gt;w&lt;/code&gt; is the number of samples per cycle, one multiplication can be eliminated entirely by sampling at 6 times the target frequency, making &lt;code&gt;2 * cos(2 * pi * 1/6) = 1&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3181" OwnerDisplayName="Nick Johnson" LastActivityDate="2012-10-25T16:08:18.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4804" PostTypeId="1" AcceptedAnswerId="4808" CreationDate="2012-10-26T07:42:53.063" Score="4" ViewCount="1299" Body="&lt;p&gt;I have an image, I, sampled on a uniform grid: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ x_i = i*\Delta x, y_j = j*\Delta y, $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to resample this image to a grid rotated counterclockwise by an angle $\ \theta$ around $\ (x_0,y_0)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ u_i = i*\Delta u, v_j = j*\Delta v $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ x(u_i,v_j) = x_0 + cos(\theta)*u_i - v_j*sin(\theta)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ y(u_i,v_j) = y_0 + sin(\theta)*u_i + v_j*cos(\theta)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I best do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that I can e.g. do bilinear interpolation to find I from the 4 (x,y) corners around each $\ (u_i,v_j)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am not free to choose $\ \Delta u $ and $\ \Delta v $ as I wish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the Nyquist criterion for this rotated grid? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right in assuming that it will be?:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \Delta u = cos(\theta)*\Delta x + sin(\theta)*\Delta y$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \Delta v = -sin(\theta)*\Delta x + cos(\theta)*\Delta y$&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-10-30T12:50:12.460" LastActivityDate="2012-10-30T12:50:12.460" Title="How do I resample an image to a rotated grid?" Tags="|image-processing|discrete-signals|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4805" PostTypeId="2" ParentId="2738" CreationDate="2012-10-26T07:57:35.027" Score="0" Body="&lt;p&gt;It looks like that the &quot;noise&quot; is a texture/pattern.&#xA;Maybe you'll have a try on removing that pattern, so you can go on in your processing pipeline.&#xA;In my opinion, morphological operations and edge detection won't work so well (have no proof, just a first impression on that scenario, because of too similiar looking of noise and features/wanted information).&#xA;If I got time at the weekend, I'd give it a shot with some texture removal methods and keep you informed.&lt;/p&gt;&#xA;" OwnerUserId="1923" LastActivityDate="2012-10-26T07:57:35.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4806" PostTypeId="2" ParentId="1336" CreationDate="2012-10-26T11:57:30.760" Score="8" Body="&lt;p&gt;During my Masters, the project my supervisor was involved in was dealing in detecting and recognizing all kinds of different traffic signalization in a video sequences (e.g. road detection, road centerline detection, but also &lt;strong&gt;traffic sign detection and recognition&lt;/strong&gt;). The video frames we were working on are in many ways similar to your example images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I personally didn't work on traffic signs, I think the best results were obtained by using the &lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCkQFjAA&amp;amp;url=http%3A%2F%2Fresearch.microsoft.com%2F~viola%2FPubs%2FDetect%2FviolaJones_IJCV.pdf&amp;amp;ei=D3iKUP3OJYix0QXNx4G4Cw&amp;amp;usg=AFQjCNHv5ZMXrBGA2ETaBg6suywybnkoQg&quot;&gt;&lt;strong&gt;Viola-Jones Algorithm&lt;/strong&gt; (paper)&lt;/a&gt;. In short, it is an algorithm that uses a cascade of &lt;em&gt;weak classifiers&lt;/em&gt; (with accuracy just a bit higher than that of a random algorithm) to construct a &lt;em&gt;strong classifier&lt;/em&gt; that is robust even in difficult tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The project was called &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/mastif/index_en.shtml&quot;&gt;MASTIF (Mapping and Assessing the State of Traffic InFrastructure)&lt;/a&gt; and did some really good work. Project's &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/mastif/publications_en.shtml&quot;&gt;publication page&lt;/a&gt; could be really useful because it provides links to all the published papers related to the project. Just to give you an idea, let me single some of the publications out (in chronological order):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/pubs/oagm09.pdf&quot;&gt;Karla Brkić, Axel Pinz, Siniša Šegvić: &quot;Traffic sign detection as a component of an automated traffic infrastructure inventory system&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/mastif/pubs/martinovic10.pdf&quot;&gt;A. Martinović, G. Glavaš, M. Juribašić, D. Sutić and Z. Kalafatić: &quot;Real-time Detection and Recognition of Traffic Signs&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/pubs/bonaci11cvww.pdf&quot;&gt;Igor Bonači, Ivan Kusalić, Ivan Kovaček, Zoran Kalafatić, Siniša Šegvić: &quot;Addressing false alarms and localization inaccuracy in traffic sign detection and recognition&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once again, I didn't personally work on traffic signs, but I think you can find plenty of useful material here. Also, I would suggest going through cited references in the papers as they can be of help as well.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2012-10-26T11:57:30.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4807" PostTypeId="2" ParentId="4801" CreationDate="2012-10-26T11:57:31.380" Score="6" Body="&lt;p&gt;If the signal is recorded using just one microphone, you can use methods such as spectral subtraction. This method is more suitable for &quot;constant&quot; noise, like the noise from a fan or an idle engine. Other methods rely on statistics and perceptual models of speech. If the signal is recorded with several microphones, you can use blind source separation for separating the (speech) signals. As it stands today, you won't get perfect results. The typical end-result is always a trade off between &quot;noise&quot; and clarity of the speech signal of interest. More &quot;noise&quot; suppression --&gt; more degradation of the signal of interest.&lt;/p&gt;&#xA;" OwnerUserId="3182" LastActivityDate="2012-10-26T11:57:31.380" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4808" PostTypeId="2" ParentId="4804" CreationDate="2012-10-26T12:46:56.387" Score="5" Body="&lt;p&gt;You should read about image transformations. Anyhow, the idea is quite simple:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute the inverse transform $T(x,y)$.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each point $(x,y)$ on the re-sampled grid:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Calculate $T(x,y)$, and find the 4 closest points on the original grid.&lt;/li&gt;&#xA;&lt;li&gt;Apply interpolation technique (For example, bi-linear) on the neighbors, and put the value in the re-sampled grid.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Some references: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cis.rit.edu/class/simg782/lectures/lecture_02/lec782_05_02.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cis.rit.edu/class/simg782/lectures/lecture_02/lec782_05_02.pdf&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.imageprocessingbasics.com/geometric-transforms/&quot; rel=&quot;nofollow&quot;&gt;http://www.imageprocessingbasics.com/geometric-transforms/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="90" LastEditDate="2012-10-26T13:13:08.367" LastActivityDate="2012-10-26T13:13:08.367" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4809" PostTypeId="2" ParentId="3643" CreationDate="2012-10-26T15:03:16.740" Score="1" Body="&lt;p&gt;I think best way is to use Active contours. If you are not aware what active contours are have a look at this video on youtube &lt;a href=&quot;http://www.youtube.com/watch?v=ijNe7f3QVdA&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=ijNe7f3QVdA&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, u need to give an initialize segmentation and it will improve the shape. &#xA;My suggestion is to one of the methods discussed on this post and use active contours as a 2nd step ie. as an improvement step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an implementation of active contours you could use&#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/19567&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/19567&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3184" LastActivityDate="2012-10-26T15:03:16.740" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4810" PostTypeId="2" ParentId="4799" CreationDate="2012-10-26T15:12:56.807" Score="2" Body="&lt;p&gt;If you know the radial distortion parameters (e. g. by calibrating the cameras), then you should simply compensate for the distortion before you do structure from motion.  You can either undistort the images before you do anything else, or you can undistort the coordinates of the points that you are trying to match.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-10-26T15:12:56.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4811" PostTypeId="2" ParentId="4760" CreationDate="2012-10-26T15:39:09.003" Score="4" Body="&lt;p&gt;It appears that motion is your only cue in this case, assuming that you have a time-series of these images. I would start by trying to track these objects using a Kalman filter with a constant velocity motion model. The fountain and the street sign would be stationary. If your images contain other moving objects, e. g. cars, then you can try using speed to distinguish them from people.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/motion-based-multiple-object-tracking.html&quot; rel=&quot;nofollow&quot;&gt;example of how to track multiple objects&lt;/a&gt; using the Computer Vision System Toolbox for MATLAB. The example detects moving foreground objects using the Gaussian mixture models. You may want to replace that part or augment it using the depth information.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-10-26T15:39:09.003" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="4812" PostTypeId="2" ParentId="4794" CreationDate="2012-10-26T16:44:11.390" Score="2" Body="&lt;p&gt;Your recursive smoothing equation will respond slowly to sudden fluctuations (that's why it's called smoothing!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try and change to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;alphaDTildS(i) = 0.7 + 0.3 * pDashS(i);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should make it closer to the underlying signal - but also less &quot;smooth&quot;&lt;/p&gt;&#xA;" OwnerUserId="3182" LastActivityDate="2012-10-26T16:44:11.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4813" PostTypeId="1" AcceptedAnswerId="60140" CreationDate="2012-10-26T17:06:02.133" Score="5" ViewCount="489" Body="&lt;p&gt;I have a filter kernel &lt;span class=&quot;math-container&quot;&gt;$K(\omega)$&lt;/span&gt; completely defined in the frequency domain as a continuous function of angular frequency &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;. I know &lt;span class=&quot;math-container&quot;&gt;$K(\omega)$&lt;/span&gt; defined as a continuous mathematical equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the discrete FFT and IFFT, I would like to apply this kernel to a discrete time-domain signal using convolution via multiplication in the frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is a good way to deal with this convolution?  Should I generate the &lt;span class=&quot;math-container&quot;&gt;$U(\omega)$&lt;/span&gt; as a continuous function in the frequency domain, take the IFFT, and then truncate, shift and window the signal as mentioned in the book &lt;a href=&quot;http://www.dspguide.com/ch17/1.htm&quot; rel=&quot;noreferrer&quot;&gt;Steven W. Smith - The Scientist and Engineer's Guide to Digital Signal Processing&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternately, should I take the continuous inverse Fourier transform of the function &lt;span class=&quot;math-container&quot;&gt;$K(\omega)$&lt;/span&gt;, and generate &lt;span class=&quot;math-container&quot;&gt;$k(t)$&lt;/span&gt; completely in the time domain as a discrete signal by evaluating &lt;span class=&quot;math-container&quot;&gt;$k(t)$&lt;/span&gt; for discrete values of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;?  Then &lt;span class=&quot;math-container&quot;&gt;$k(t)$&lt;/span&gt; can be treated as a FIR filter kernel and taken into the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although this is a discrete 1D signal, are 2D image filtering kernels generated in the frequency or spatial domains?  What is the difference between the application of the kernels in the time and frequency domains?&lt;/p&gt;&#xA;" OwnerUserId="1048" LastEditorUserId="128" LastEditDate="2020-05-02T11:25:28.110" LastActivityDate="2020-05-02T11:25:28.110" Title="Applying a Filter Kernel Defined by a Continuous Equation in the Frequency Domain" Tags="|fft|filters|filter-design|convolution|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4814" PostTypeId="2" ParentId="4750" CreationDate="2012-10-26T17:47:09.880" Score="1" Body="&lt;p&gt;Since you have a fixed camera, a typical approach to this problem is to use background subtraction to detect moving objects, and then track them across frames, and classify them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good starting point is this &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/motion-based-multiple-object-tracking.html&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; in the Computer Vision System Toolbox for MATLAB.  There is also an &lt;a href=&quot;http://www.mathworks.com/help/vision/ref/vision.peopledetectorclass.html&quot; rel=&quot;nofollow&quot;&gt;object that does people detection&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-10-26T17:47:09.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4815" PostTypeId="1" AcceptedAnswerId="4817" CreationDate="2012-10-26T21:19:36.833" Score="7" ViewCount="774" Body="&lt;p&gt;I am reading a book titled &lt;em&gt;&quot;Two Dimensional Wavelets and their relatives&quot;&lt;/em&gt; by Antoine et al. and it talks about &lt;em&gt;vanishing moments&lt;/em&gt;. I have trouble understanding the exact significance of it. Can anybody give an idea on vanishing moments?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l6Byp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3184" LastEditorUserId="77" LastEditDate="2012-10-26T22:44:00.923" LastActivityDate="2018-04-24T15:54:33.803" Title="Vanishing Moments" Tags="|wavelet|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4816" PostTypeId="1" CreationDate="2012-10-27T03:13:27.860" Score="0" ViewCount="896" Body="&lt;p&gt;I am new to MATLAB. I have the audio files A and B, B is recorded using a mic while playing audio file A. The length of file B is different from A. A does not always start from 0 second. My program is supposed to identify, file B from file A (giving a set of files A, X, Y, Z, etc. the program can figure out that the most correlation is A) Is there any existing resource or example for my problem? Or any suggestions for me to get start? Appropriate for your any comments and thanks!&lt;/p&gt;&#xA;" OwnerUserId="3175" LastEditorUserId="3175" LastEditDate="2012-11-01T06:34:50.277" LastActivityDate="2012-11-01T06:34:50.277" Title="Is there any example or existing resource for using matlab in audio comparison (cross correlation)?" Tags="|fft|matlab|audio|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4817" PostTypeId="2" ParentId="4815" CreationDate="2012-10-27T03:39:59.277" Score="7" Body="&lt;p&gt;A moment is a generalization of the notion in physics of moment of a (point) mass about an axis being the product of the mass and the distance from the axis.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a continuous random variable $X$ with probability density function $f(x)$, the $n$-th moment is &#xA;$$m_n = \int_{-\infty}^\infty x^n f(x)\,\mathrm dx.$$&#xA;The &lt;em&gt;zero-th&lt;/em&gt; moment is $1$ (the area under the density is $1$),&#xA;the &lt;em&gt;first moment&lt;/em&gt; is called the &lt;em&gt;mean&lt;/em&gt; or expected value of the random &#xA;variable and the &lt;em&gt;second moment&lt;/em&gt; the mean square value.  Note that since&#xA;$f(x) \geq 0$, the second moment cannot be zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even more generally, the  $n$-th moment of an &lt;em&gt;arbitrary&lt;/em&gt; function $f(x)$&#xA;can be defined as &#xA;$$m_n = \int_{-\infty}^\infty x^n f(x)\,\mathrm dx.$$&#xA;Now the restriction of zero-th moment being $1$ and&#xA;second moment being positive is not applicable any more, &#xA;and the &quot;vanishing moment&quot; is merely&#xA;a fancy way of saying that $f(x)$ must be such that&#xA;$m_0 = m_1 = m_2 = \cdots m_N = 0$. In particular, $m_0$ is&#xA;the &lt;em&gt;DC value&lt;/em&gt; of the wavelet and the authors are insisting&#xA;that the DC value be $0$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2012-10-27T03:39:59.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4818" PostTypeId="2" ParentId="4816" CreationDate="2012-10-27T07:44:37.833" Score="2" Body="&lt;p&gt;Your problem is known as &quot;robust audio fingerprinting&quot;, and cross-correlation is not useful for solving it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cross-correlation is computationally expensive for a full-length signal. Not to mention matching a collection of thousands (or even millions in industrial applications) of audio files.&lt;/li&gt;&#xA;&lt;li&gt;Your recorded signal B will be different enough from A (additional room noise and reverberation, loss of low and high frequencies) that the raw waveforms will poorly match.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The most common approach for solving this problem on music signals (eg as used by Shazam) is to extract &quot;landmarks&quot; in the spectrogram, which are sharp increases in energy at a specific time/frequency point; and to hash these. Landmark extraction reduces the amount of data to process (from &gt;10k samples per second to 50 or so data points per second), makes the extraction process robust to noise, and yields a data-representation fast to search since it can be quantized and hashed. &lt;a href=&quot;http://labrosa.ee.columbia.edu/matlab/fingerprint/&quot; rel=&quot;nofollow&quot;&gt;Matlab implementation here&lt;/a&gt;. You have not mentioned what kind of content your audio files have; this technique might not always work for other types of content than music.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-10-27T07:44:37.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4819" PostTypeId="1" AcceptedAnswerId="4820" CreationDate="2012-10-27T09:24:56.257" Score="3" ViewCount="1796" Body="&lt;p&gt;We're supposed to use KNN (K Nearest Neighbor) method for different values of K to classify a handwritten digit data set. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, this is the first time I want to do a project like that in Matlab. Could someone please explain the normal steps I should do for such problem? What values of K should I use? I read some articles on KNN method and have a rough idea about how the method works but I need help to do this and to be able to go through the following problem we should do after this. &lt;/p&gt;&#xA;" OwnerUserId="89" LastEditorUserId="1273" LastEditDate="2012-10-27T13:56:54.810" LastActivityDate="2012-10-27T14:47:58.123" Title="KNN method for different values of K on a handwritten digit data set" Tags="|image-processing|classification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4820" PostTypeId="2" ParentId="4819" CreationDate="2012-10-27T13:49:11.467" Score="4" Body="&lt;p&gt;The k-NN algorithm all by itself is very simple, and can be used on vectors of any dimensionality to classify them. Let me write it down here for the sake of answer completeness:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;store all your vectors from the training set&lt;/li&gt;&#xA;&lt;li&gt;store the &lt;strong&gt;class&lt;/strong&gt; of each vector together with them&lt;/li&gt;&#xA;&lt;li&gt;when a new, unclassified, vector arrives, compare it to &lt;strong&gt;all&lt;/strong&gt; the vectors from the training set&lt;/li&gt;&#xA;&lt;li&gt;select the $k$ neighbours that have the smallest distance to the new neighbour&lt;/li&gt;&#xA;&lt;li&gt;the class assigned to the new vector is the &lt;em&gt;most common&lt;/em&gt; class among those $k$ closest vectors&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, that said, the value of $k$ you choose depends greatly on the size of your training set. E.g. if you have a training set of size $100$, and set $k=100$, the result will &lt;em&gt;always be the same&lt;/em&gt;, equal to the most frequent class in your training set. If you set $k=1$, the new vector will be classified as the &lt;em&gt;geometrically closest&lt;/em&gt; vector (Euclidean distance) every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're just supposed to present the results for different $k$ for the sake of discussion and learning, I suggest you start from $k=1$ and test for all the $k$'s sequentially: it will make a nice graph and a nice analysis. Maybe you can skip the even values of $k$ (for $k=2$, if you get two different classes as the closest, you're unable to make a decision).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's really important is &lt;strong&gt;how are you going to shape your descriptor vectors&lt;/strong&gt;. Each component in your descriptor vector is a feature you describe numerically which should be able to help you make a decision. You also have &lt;em&gt;the curse of dimensionality&lt;/em&gt; to worry about: more components your vector has, slower the decision making process is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have two approaches here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Decide carefully on features that are &lt;em&gt;confirmed&lt;/em&gt; to be good at the task (do some research), and limit yourself to a certain number.&lt;/li&gt;&#xA;&lt;li&gt;Work with features you &lt;em&gt;think&lt;/em&gt; would be good, but don't worry too much about how good they are. Then, when you have a big number of features, use a method like &lt;a href=&quot;http://en.wikipedia.org/wiki/Principal_component_analysis&quot; rel=&quot;nofollow&quot;&gt;Principal Component Analysis (PCA)&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Fisher%27s_linear_discriminant&quot; rel=&quot;nofollow&quot;&gt;Fisher's linear discriminant (FLD)&lt;/a&gt; to &lt;strong&gt;reduce the dimensionality&lt;/strong&gt; of your descriptor vectors before the k-NN&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Lastly, let me give you some ideas about features you might want to use to form your feature vectors. I'm not guaranteeing for any of them, I'm just writing ideas off the top of my head:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Down-sample (shrink) your sample images to $3 \times 3$ or $3 \times 4$ pixel black and white images, and take the 0/1 values of &lt;em&gt;all the 9 or 12 pixels&lt;/em&gt; as features. You might want to do a &lt;em&gt;morphological thining&lt;/em&gt; or get the &lt;em&gt;skeleton of the pen stroke&lt;/em&gt; before you shrink your images.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Instead of taking each pixel from a down-sampled image, you could take only the count of background/foreground pixels in each row and column in the downsampled image, making for a total of 6 or 7 non-binary features as opposed to 9 or 12 binary ones.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Count the number of &lt;em&gt;holes&lt;/em&gt; in your (binarized) image. By &quot;hole&quot;, I mean a connected component of background pixels not connected to the image border.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a simple measure such as describing the &lt;em&gt;elongation&lt;/em&gt; of the object, e.g. the horizontal distance between two horizontally furthest pixels divided by the vertical distance between two vertically furthest pixels.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the &lt;strong&gt;Hu set of invariant image moments&lt;/strong&gt; (&lt;a href=&quot;http://en.wikipedia.org/wiki/Image_moment#Rotation_invariant_moments&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;, &lt;a href=&quot;http://www.google.hr/url?sa=t&amp;amp;rct=j&amp;amp;q=m.k.%20hu%2C%20pattern%20recognition%20by%20moment%20invariants%2C%20pro&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCEQFjAA&amp;amp;url=http%3A%2F%2Fwww.sci.utah.edu%2F~gerig%2FCS7960-S2010%2Fhandouts%2FHu.pdf&amp;amp;ei=XOWLUJT8MYLG0QX19oCoBA&amp;amp;usg=AFQjCNGEuioHZg5FM61GQByOboHI-zzwTQ&quot; rel=&quot;nofollow&quot;&gt;article&lt;/a&gt;) It's very old work, but I've used them while making a letter-recognition project during my studies, and for simple uses such as this they can still be helpfull.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="1273" LastEditDate="2012-10-27T14:47:58.123" LastActivityDate="2012-10-27T14:47:58.123" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4821" PostTypeId="1" CreationDate="2012-10-27T15:28:34.473" Score="4" ViewCount="1297" Body="&lt;p&gt;I have been searching for software that can handle the task of registering a 2D image to a 3D volume.  The 3D volume is a microCT scan, while the 2D image is taken from a plane passing through the sample.  I am looking for something that can locate the plane of the 2D image within this 3D volume, i.e. get the 3D translation, rotation and scale transform betwee the image and volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First prize is for pre-compiled free Windows software, but if that isn't possible then any libraries that can handle this task.  I see that ITK from Kitware provides registration tools, but I don't see any discussion of my specific task, which doesn't seem to a common one.&lt;/p&gt;&#xA;" OwnerUserId="1925" LastActivityDate="2015-01-24T23:51:40.853" Title="Software to register a 2D image to a 3D volume" Tags="|image-processing|3d|image-registration|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4822" PostTypeId="2" ParentId="4815" CreationDate="2012-10-27T20:30:14.470" Score="2" Body="&lt;p&gt;One of the applications of the (continuous!) wavelet transform is the detection and characterization of fractal signals. For that in particular the nature of the underlying singularities become important. Singularities are characterized by their Höldner exponent. In that context the number of vanishing moments of the analysis wavelet becomes important. It needs to have at least as many vanishing moments as the order of Höldner exponent to be discovered by it.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2012-10-27T20:30:14.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4823" PostTypeId="1" AcceptedAnswerId="4824" CreationDate="2012-10-27T22:43:47.793" Score="2" ViewCount="911" Body="&lt;p&gt;What kind of compression artifacts would typically be most noticeable to a non-audiophile listener in a low-bit rate mp3 (MPEG-2 Layer III) compressed audio file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of audio signal might one synthesize that would make these artifacts maximally audible between &quot;low&quot; and &quot;high&quot; bit rate mp3 compressed files (using commonly available encoders)?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-10-27T23:49:06.660" Title="Audible mp3 artifacts?" Tags="|audio|compression|mp3|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4824" PostTypeId="2" ParentId="4823" CreationDate="2012-10-27T23:49:06.660" Score="5" Body="&lt;p&gt;Pre-echo on very short and percussive sounds - for example crisp solo drums, or better, electronic drums. The TR-808 rimshot and clave are very short and impulsive sounds, about 5ms long (for the rimshot), and at less than 160kbps their attacks get &quot;swallowed&quot;. At less than 96kbps some notes appear to be duplicated or out of place rhythmically because of pre-echo. Worse, each note in a repeated pattern will sound different depending on how it falls within the analysis window. &lt;a href=&quot;http://dl.dropbox.com/u/612135/808.wav&quot;&gt;Here is an example&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try solo vocals too. I think casual listeners are better at detecting anomalies in voices (a kind of auditory &quot;uncanny valley&quot; effect). A classical example used in the audio coding community is the intro from Suzanne Vega's &lt;a href=&quot;http://en.wikipedia.org/wiki/Tom%27s_Diner#The_.22Mother_of_the_MP3.22&quot;&gt;&quot;Tom's Diner&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-10-27T23:49:06.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4825" PostTypeId="1" CreationDate="2012-10-28T16:37:15.483" Score="50" ViewCount="100762" Body="&lt;p&gt;If you do an FFT plot of a simple signal, like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:0.01:1 ;&#xA;N = max(size(t));&#xA;x = 1 + sin( 2*pi*t ) ;&#xA;y = abs( fft( x ) ) ;&#xA;stem( N*t, y )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1&gt;1Hz sinusoid + DC&lt;/h1&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z8udn.png&quot; alt=&quot;1Hz&quot; /&gt;&lt;/p&gt;&#xA;&lt;h1&gt;FFT of above&lt;/h1&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RO4c0.png&quot; alt=&quot;fft&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand that the number in the first bin is &amp;quot;how much DC&amp;quot; there is in the signal.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;y(1)  %DC&#xA;  &amp;gt; 101.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The number in the second bin should be &amp;quot;how much 1-cycle over the whole signal&amp;quot; there is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;y(2)  %1 cycle in the N samples&#xA;  &amp;gt; 50.6665&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But it's not 101!  It's about 50.5.&lt;/p&gt;&#xA;&lt;p&gt;There's another entry at the end of the fft signal, equal in magnitude:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;y(101)&#xA;  &amp;gt; 50.2971&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So 50.5 again.&lt;/p&gt;&#xA;&lt;p&gt;My question is, &lt;strong&gt;why is the FFT mirrored like this?&lt;/strong&gt;  Why isn't it just a 101 in &lt;code&gt;y(2)&lt;/code&gt; (which would of course mean, all 101 bins of your signal have a 1 Hz sinusoid in it?)&lt;/p&gt;&#xA;&lt;p&gt;Would it be accurate to do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;mid = round( N/2 ) ;&#xA;&#xA;% Prepend y(1), then add y(2:middle) with the mirror FLIPPED vector&#xA;% from y(middle+1:end)&#xA;z = [ y(1), y( 2:mid ) + fliplr( y(mid+1:end) ) ];&#xA;&#xA;stem( z )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1&gt;Flip and add-in the second half of the FFT vector&lt;/h1&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g6TQd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I thought now, the mirrored part on the right hand side is added in correctly, giving me the desired &amp;quot;all 101 bins of the FFT contain a 1Hz sinusoid&amp;quot;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; z(2)&#xA;&#xA;ans =&#xA;&#xA;  100.5943&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1040" LastEditorUserId="7092" LastEditDate="2023-11-21T16:41:21.263" LastActivityDate="2023-11-21T16:41:21.263" Title="Why is the FFT &quot;mirrored&quot;?" Tags="|fft|discrete-signals|dft|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4826" PostTypeId="1" CreationDate="2012-10-28T20:22:48.527" Score="5" ViewCount="119" Body="&lt;p&gt;A friend is doing renovations and getting his entire ground-floor street-side wall replaced with glass bricks.  I told him that with all those bricks giving similar distorted views of the same room, and scattering light in similar ways, there must be some statistical technique to inverse filter the light that comes through to clean the signal and see what's behind the bricks---and that he should watch out or at least consider curtains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was I right?  Or is this impossible (or NSA level stuff), or can this be done with standard image processing libraries and a little stats?&lt;/p&gt;&#xA;" OwnerUserId="3188" LastEditorUserId="3188" LastEditDate="2012-10-29T01:42:54.463" LastActivityDate="2012-10-29T05:56:12.507" Title="Is there a transformation filter to decode light signal through Glass Bricks?" Tags="|image-processing|filters|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4827" PostTypeId="2" ParentId="4825" CreationDate="2012-10-28T20:34:46.873" Score="52" Body="&lt;p&gt;Real signals are &amp;quot;mirrored&amp;quot; in the real and negative halves of the Fourier transform because of the nature of the Fourier transform.  The Fourier transform is defined as the following-&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(f) = \int h(t)e^{-j2\pi ft}dt$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Basically it correlates the signal with a bunch of complex sinusoids, each with its own frequency.  So what do those complex sinusoids look like?  The picture below illustrates one complex sinusoid.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9xx7h.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GpEPi.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/z9Lfa.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;corkscrew&amp;quot; is the rotating complex sinusoid in time, while the two sinusoids that follow it are the extracted real and imaginary components of the complex sinusoid.  The astute reader will note that the real and imaginary components are the exact same, only they are out of phase with each other by 90 degrees (&lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt;).  Because they are 90 degrees out of phase they are orthogonal and can &amp;quot;catch&amp;quot; any component of the signal at that frequency.&lt;/p&gt;&#xA;&lt;p&gt;The relationship between the exponential and the cosine/sine is given by Euler's formula-&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{jx} = \cos(x) + j\cdot\sin(x)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This allows us to modify the Fourier transform as follows-&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(f) = \int h(t)e^{-j2\pi ft}dt \\&#xA;= \int h(t)(\cos(2\pi ft) - j\cdot\sin(2\pi ft))dt&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;At the negative frequencies the Fourier transform becomes the following-&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(-f) = \int h(t)(\cos(2\pi (-f)t) - j\sin(2\pi (-f)t))dt \\&#xA;= \int h(t)(\cos(2\pi ft) + j\cdot\sin(2\pi ft))dt&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Comparing the negative frequency version with the positive frequency version shows that the cosine is the same while the sine is inverted.  They are still 90 degrees out of phase with each other, though, allowing them to catch any signal component at that (negative) frequency.&lt;/p&gt;&#xA;&lt;p&gt;Because both the positive and negative frequency sinusoids are 90 degrees out of phase and have the same magnitude, they will both respond to real signals in the same way.  Or rather, the &lt;em&gt;magnitude&lt;/em&gt; of their response will be the same, but the correlation phase will be different.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Specifically, the negative frequency correlation is the conjugate of the positive frequency correlation (due to the inverted imaginary sine component) for real signals.  In mathematical terms, this is, as Dilip pointed out, the following&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H(-f) = [H(f)]^*$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Another way to think about it:&lt;/p&gt;&#xA;&lt;p&gt;Imaginary components are just that..Imaginary! They are a tool, which allows the employ of an extra plane to view things on and makes much of digital (and analog) signal processing possible, if not much easier than using differential equations!&lt;/p&gt;&#xA;&lt;p&gt;But we can't break the logical laws of nature, we can't do anything 'real' with the imaginary content&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; and so it must effectively cancel itself out before returning to reality. How does this look in the Fourier Transform of a time based signal(complex frequency domain)? If we add/sum the positive and negative frequency components of the signal the imaginary parts cancel, this is what we mean by saying the positive and negative elements are conjugate to each-other. Notice that when an FT is taken of a time-signal there exists these conjugate signals, with the 'real' part of each sharing the magnitude, half in the positive domain, half in the negative, so in effect adding the conjugates together removes the imaginary content and provides the real content only.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; Meaning we can't create a voltage that is &lt;span class=&quot;math-container&quot;&gt;$5i$&lt;/span&gt; volts. Obviously, we can use imaginary numbers to represent real-world signals that are two-vector-valued,  such as circularly polarized EM waves.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="7092" LastEditDate="2021-12-16T14:45:01.117" LastActivityDate="2021-12-16T14:45:01.117" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="4828" PostTypeId="1" AcceptedAnswerId="6271" CreationDate="2012-10-28T20:37:19.773" Score="1" ViewCount="314" Body="&lt;p&gt;I have a camera and its K matrix (calibration matrix) also I have image of plane, I know the real points of the 4 corners and thier correspondence pixel. I know how to compute the H matrix if z=0 (H is homography matrix between Image and the real plane).&#xA;And Now I try to get the real point of the plane (3D point) with the rotation matrix and the transltion vector&#xA;I follow this paper :Calibrating an Overhead Video Camera by Raul Rojas in section 3 - 3.3.&#xA;My code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ImagePointsScreen=[16,8,1;505,55,1;505,248,1;44,301,1;];&#xA;&#xA;screenImage=imread( 'screen.jpg');&#xA;RealPointsMirror=[0,0,1;9,0,1;9,6,1;0,6,1]; %Mirror&#xA;RealPointsScreen=[0,0,1;47.5,0,1;47.5,20,1;0,20,1];%Screen&#xA;imagesc(screenImage);&#xA;hold on&#xA;for i=1:4&#xA;    drawBubble(ImagePointsScreen(i,1),ImagePointsScreen(i,2),1,'g',int2str(i),'r')&#xA;end&#xA;&#xA;Points3DScreen=Get3DpointSurface(RealPointsScreen,ImagePointsScreen,'Screen');&#xA;&#xA;figure&#xA;hold on&#xA;plot3(Points3DScreen(:,1),Points3DScreen(:,2),Points3DScreen(:,3));&#xA;for i=1:4&#xA;    drawBubble(Points3DScreen(i,1),Points3DScreen(i,2),1,'g',int2str(i),'r')&#xA;end&#xA;&#xA;&#xA;&#xA;function [ Points3D ] = Get3DpointSurface( RealPoints,ImagePoints,name)&#xA;M=zeros(8,9);&#xA;&#xA;for i=1:4&#xA;&#xA;M((i*2)-1,1:3)=-RealPoints(i,:);&#xA;M((i*2)-1,7:9)=RealPoints(i,:)*ImagePoints(i,1);&#xA;M(i*2,4:6)=-RealPoints(i,:);&#xA;M(i*2,7:9)=RealPoints(i,:)*ImagePoints(i,2);   &#xA;&#xA;end&#xA;&#xA;[U S V] = svd(M);&#xA;X = V(:,end);&#xA;H(1,:)=X(1:3,1)';&#xA;H(2,:)=X(4:6,1)';&#xA;H(3,:)=X(7:9,1)';&#xA;K=[680.561906875074,0,360.536967117290;0,682.250270165388,249.568615725655;0,0,1;];&#xA;&#xA;newRO=pinv(K)*H;&#xA;h1=newRO(1:3,1);&#xA;h2=newRO(1:3,2);&#xA;&#xA;scaleFactor=(norm(h1)+norm(h2))/2;&#xA;newRO=newRO./scaleFactor;&#xA;r1=newRO(1:3,1);&#xA;r2=newRO(1:3,2);&#xA;r3=cross(r1,r2);&#xA;r3=r3/norm(r3);&#xA;&#xA;R=[r1,r2,r3];&#xA;&#xA;RInv=pinv(R);&#xA;O=-RInv*newRO(1:3,3);&#xA;M=K*[R,-R*O];&#xA;for i=1:4&#xA;   res=pinv(M)* [ImagePoints(i,1),ImagePoints(i,2),1]';&#xA;   res=res';&#xA;   res=res*(1/res(1,4));&#xA;   Points3D(i,:)=res';&#xA;&#xA;end&#xA;Points3D(i+1,:)=Points3D(1,:);  %just add the first point to the end of the array for draw square&#xA;&#xA;end&#xA;&#xA;&#xA;&#xA;function drawBubble (xcenter, ycenter, radius, color, string,colorNum)&#xA;% draw circle with input xcenter, ycenter, radius, color and text&#xA;angles = linspace(0, 2*pi, 40);&#xA;bubx = xcenter + (radius * cos(angles));&#xA;buby = ycenter + (radius * sin(angles));&#xA;fill(bubx, buby, color, 'EdgeColor', color)&#xA;text(xcenter, ycenter, string, 'Color', colorNum, 'FontSize', 13, ...&#xA;       'FontWeight', 'normal', 'HorizontalAlignment', 'center')&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is that I don't get good results&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.The point 1 is at (0,0,0) and this is not the real location&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.the points are upside down&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am doing worng?&lt;/p&gt;&#xA;" OwnerUserId="3189" LastEditorUserId="3189" LastEditDate="2012-10-29T18:17:46.070" LastActivityDate="2012-12-14T02:50:32.190" Title="recovery plane from 4 point imaging using calibration camera" Tags="|image-processing|matlab|computer-vision|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="4829" PostTypeId="2" ParentId="4735" CreationDate="2012-10-28T20:39:36.807" Score="2" Body="&lt;p&gt;The signal processing operation that measures how &quot;alike&quot; two signals are is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;cross-correlation&lt;/a&gt;.  For cross-correlation to work both signals must be sampled at the same rate.  If they aren't, you must resample one of them to the rate of the other.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-10-28T20:39:36.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4830" PostTypeId="2" ParentId="4825" CreationDate="2012-10-28T20:46:57.833" Score="21" Body="&lt;p&gt;Note that an FFT result is mirrored (as in conjugate symmetric) only if the input data is real.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For strictly real input data, the two conjugate mirror images in the FFT result cancel out the imaginary parts of any complex sinusoids, and thus sum to a strictly real sinusoid (except for tiny numerical rounding noise), thus leaving you with a representation of strictly real sine waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the FFT result wasn't conjugate mirrored, it would represent a waveform that had complex values (non-zero imaginary components), not something strictly real valued.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-06-16T07:14:11.897" LastActivityDate="2016-06-16T07:14:11.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4831" PostTypeId="2" ParentId="4826" CreationDate="2012-10-29T05:56:12.507" Score="3" Body="&lt;p&gt;In theory this is possible, in practice probably very hard, but I wouldn't say impossible. See a recent &lt;a href=&quot;http://www.weizmann.ac.il/home/feyaron/PDFfiles/ImagingWalls.pdf&quot; rel=&quot;nofollow&quot;&gt;article&lt;/a&gt; by the Silberberg group for example, that demonstrates imaging through 'thin' turbid layers using scattered incoherent light. Also, search for works pioneered by A. P. Mosk on that matter (for example &lt;a href=&quot;http://physics.aps.org/articles/v3/22&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt; and &lt;a href=&quot;https://www.opticsinfobase.org/ol/abstract.cfm?uri=ol-32-16-2309&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;). The main challenges are algorithm speed, or, by the time you'll find the correct transmission matrix, it'll change due to thermal fluctuations. &lt;/p&gt;&#xA;" OwnerUserId="2044" LastActivityDate="2012-10-29T05:56:12.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4832" PostTypeId="2" ParentId="4743" CreationDate="2012-10-29T08:51:38.537" Score="3" Body="&lt;p&gt;Suppose that we had two channels encoded in some form in two signals according to a matrix.  Recovering the original signals would be straightforward using the matrix inverse (or impossible, if the inverse did not exist).  The situation is no different here, except that the matrix is not square, so you cannot use the conventional matrix inverse.  You can, however, use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Pseudoinverse&quot; rel=&quot;nofollow&quot;&gt;pseudoinverse&lt;/a&gt; or generalized inverse to reconstruct the original signals.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other matrices which are not equal to an inverse may work also succeed, and may in fact sound better.  I don't know the psychoacoustic situation, but it may more sense to do some transform based on the position of speakers for example. Certainly, the inverse seems like a good place to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I rewrote your encoder table as a 2x5 input matrix $ E $, and used &lt;a href=&quot;http://www.wolframalpha.com/input/?i=matrix&amp;amp;a=%2aC.matrix-_%2aCalculator.dflt-&amp;amp;a=FSelect_%2a%2aMatrixOperations-.MatricesOperations-&amp;amp;a=%2aFP.MatrixOperations.matrixop-_inv&amp;amp;f4=%7B%7B1,0,sqrt%281/2%29,i%2asqrt%282/3%29,i%2asqrt%281/3%29%7D,%7B0,1,sqrt%281/2%29,-i%2asqrt%281/3%29,-i%2asqrt%282/3%29%7D%7D&amp;amp;x=2&amp;amp;y=10&amp;amp;f=MatrixOperations.theMatrix_%7B%7B1,0,sqrt%281/2%29,i%2asqrt%282/3%29,i%2asqrt%281/3%29%7D,%7B0,1,sqrt%281/2%29,-i%2asqrt%281/3%29,-i%2asqrt%282/3%29%7D%7D&quot; rel=&quot;nofollow&quot;&gt;Wolfram Alpha&lt;/a&gt; to determine the inverse, $ D = E^{-1} $.  Here is the 5x2 result it provided, using $ i $ as the imaginary unit, with $ j = i $ and $ k = -i $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;D = \frac{1}{18(46+6\sqrt{2})} \begin{bmatrix}&#xA;405 &amp;amp; -3(27 - 36\sqrt{2}) \\&#xA;-3(27 - 36\sqrt{2}) &amp;amp; 405 \\&#xA;6(18+27\sqrt{2}) &amp;amp; 6(18+27\sqrt{2}) \\&#xA;-i(27\sqrt{3} + 99\sqrt{6}) &amp;amp; i(63\sqrt{3} + 27\sqrt{6}) \\&#xA;-i(63\sqrt{3} + 27\sqrt{6}) &amp;amp; i(27\sqrt{3} + 99\sqrt{6}) &#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As one would expect, the decoding matrix shows left/right symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can express the encoding/decoding operations as:&#xA;$$&#xA;\begin{bmatrix}&#xA;L_{encoded} \\&#xA;R_{encoded}&#xA;\end{bmatrix} = E \space{} \begin{bmatrix}&#xA;L \\&#xA;R \\&#xA;C \\&#xA;L_{rear} \\&#xA;R_{rear} \\&#xA;\end{bmatrix}&#xA;$$&#xA;$$&#xA;\begin{bmatrix}&#xA;L' \\&#xA;R' \\&#xA;C' \\&#xA;L_{rear}' \\&#xA;R_{rear}' \\&#xA;\end{bmatrix} = D \space{} \begin{bmatrix}&#xA;L_{encoded} \\&#xA;R_{encoded}&#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can easily obtain formulas to express the three front components as functions of the encoded left and right signals.  For the two rear components, you have an equation in the time domain with a complex component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the left rear component, and converting constants from the matrix $ D $ to numeric form:&#xA;$$&#xA;L_{rear}'[n] = -i0.2949 L_{encoded}[n] + i0.1787 R_{encoded}[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform can be used to remove the imaginary unit, because this has the same effect on the frequency domain of performing a ±90º phase shift.  The Hilbert transform only needs to be applied once, since convolution ($ * $) is distributive and commutative and all other good things.&#xA;$$&#xA;L_{rear}'[n] = (-0.2949 L_{encoded}[n] + 0.1787 R_{encoded}[n]) * H[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operating principle, then, is that the encoding technique functions in part by encoding the left/right rear components in quadrature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform is infinitely long, so it must be truncated and expressed as either a FIR filter, or depending on your circumstances, a FFT-IFFT operation.  A causal Hilbert transform will delay the rear channels, so your other filters will need to be delayed by some amount to compensate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if $ k $ is the group delay of a causal approximation of a Hilbert filter $ H_k[n] $ then you delay must delay the three front channels by $ k $ as well:&#xA;$$&#xA;C'[n] = (0.3437L_{encoded}[n] + 0.3437R_{encoded}[n]) * \delta[n-k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, all of the output signals depend on the two input signals.  That is, you take two input channels and produce one output channel five times.  Your JACK pipeline will need to accommodate this.&lt;/p&gt;&#xA;" OwnerUserId="3191" LastEditorUserId="3191" LastEditDate="2012-11-02T22:34:25.720" LastActivityDate="2012-11-02T22:34:25.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4833" PostTypeId="1" AcceptedAnswerId="4834" CreationDate="2012-10-29T10:08:59.493" Score="1" ViewCount="758" Body="&lt;p&gt;I'm computing 1 sec. hanning windows from a signal that has a variable frequency between 1-4Hz. My first impression is that data loss caused by the distortion due to the window function is greater than the correction that it is expected to give while taking FFT of that window. Am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it a bad approach to apply window functions to such windows with size of at most 4 wavelengths?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2012-10-29T19:32:59.090" Title="Applying Window Function to Low Frequency Signals" Tags="|fft|discrete-signals|frequency|window-functions|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4834" PostTypeId="2" ParentId="4833" CreationDate="2012-10-29T10:35:34.880" Score="2" Body="&lt;p&gt;A 1s Hann window will have (in the frequency domain) a main lobe width of 4Hz. This will severely mask your signal components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even a rectangular window will be ~2Hz main lobe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should use a greater windowing time depending on the accuracy you need for frequency detection.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-10-29T10:35:34.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4835" PostTypeId="1" CreationDate="2012-10-29T10:54:42.270" Score="10" ViewCount="7163" Body="&lt;p&gt;I have a digital signal processing system that operates on a fast x86 machine using &lt;a href=&quot;http://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format%3a_binary64&quot;&gt;double precision floating point numbers&lt;/a&gt;.&#xA;It occurred to me that I am not really using the huge dynamic range of the floating point representation -- all quantities fit easily in the range ±32768.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: is it possible that switching to &lt;em&gt;fixed point&lt;/em&gt; computations would provide a benefit in numerical accuracy (high priority) or computation time (low priority)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the answer depends on how many bits are available for a fixed-point calculation.  How many bits of precision do typical fixed-point systems utilize?  Is it possible to efficiently do fixed-point calculations, with, say, 64 bits (&lt;strong&gt;16 bits integer part, 48 bits fractional part&lt;/strong&gt;) on x86-64?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had always thought that fixed-point calculations were used only in situations where CPU power is limited--does it make sense to use fixed-point calculations when CPU power is no concern?&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2012-10-29T19:59:33.957" LastActivityDate="2012-10-29T19:59:33.957" Title="Relative merits of fixed point vs floating point computation?" Tags="|fixed-point|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4836" PostTypeId="2" ParentId="4835" CreationDate="2012-10-29T12:44:32.653" Score="1" Body="&lt;p&gt;Some points to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Most modern processors have been optimizing floating-point numbercrunching for many years, and even GPUs are being used for that already, very successfully;&lt;/li&gt;&#xA;&lt;li&gt;Fixed-point calculations hurt your data and can cause serious problems when arithmetic operations are not well-conditioned (that's why fixed-point numbers were replaced by floating point ones);&lt;/li&gt;&#xA;&lt;li&gt;Even if you use signed shorts to CONTAIN your data (lots dataloggers use 16bit precision), the CALCULATIONS should be done in floating point then converted back to integers, otherwise there could be artifacts such as quantization and aliasing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As a final word, I think our realworld data is precious and the computer's blind numbercrunching is a humble menial work. The computer must be put to do the heavy-lifting work for your data and for you, and not be treated as if it was the real star in the show.&lt;/p&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-10-29T12:44:32.653" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4837" PostTypeId="2" ParentId="4835" CreationDate="2012-10-29T14:33:25.810" Score="7" Body="&lt;p&gt;The numerical accuracy of integers will only be better than the numerical accuracy of floats if the integer resolution is better.  Doubles have 52 fractional bits, so double-precision floats have a resolution worse than integers at around $2^{52}$, which is much larger than 32768 ($2^{15}$).  So, no, the numerical accuracy will not be better if you go to integers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second issue is speed.  The answer is: it depends on the hardware.  If you are running your program on a digital signal processor that has multiple fixed point multiply/accumulate cores then yes, it will be far faster in fixed point.  On an x86 chip, on the other hand, it will actually probably be &lt;em&gt;slower&lt;/em&gt; in fixed point.  I did exactly what you are talking about once and saw my execution times increase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After doing some searches on the internet I found out that that is common.  The reason is because it has a dedicated floating-point processor that isn't doing anything when you transition to fixed point, while the fixed-point hardware is shared with the regular fixed-point action, such as pointer arithmetic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to speed up the processing, the way to do it is to change from double-precision floats to single-precision floats.  That should produce a significant increase in speed.  That would, of course, reduce your numerical accuracy though.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-10-29T16:58:08.743" LastActivityDate="2012-10-29T16:58:08.743" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4838" PostTypeId="2" ParentId="3557" CreationDate="2012-10-29T15:08:57.057" Score="2" Body="&lt;p&gt;I looked up in Jaehne, Gonzalez, Soille (the one you've posted as well as &lt;code&gt;Mathematical Morphology and Its Applications to Image and Signal Processing&lt;/code&gt;) and some other special morphological papers and haven't found neither any design criteria for the structuring element nor any special hints why it has to be symmetrical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I think that a symmetrical SE is good for the same symmetrical effects on the object you want to modify.&#xA;With my existing experience I would not use a non-symmetrical SE, because I can't take it for any object or scenario and I don't know how it will react for other cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless it's an interesting question and I am trying to get an answer.&lt;/p&gt;&#xA;" OwnerUserId="1923" LastActivityDate="2012-10-29T15:08:57.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4839" PostTypeId="2" ParentId="4835" CreationDate="2012-10-29T16:41:55.060" Score="5" Body="&lt;p&gt;Prefer single precision floats to doubles - this will halve your memory bandwidth, cache footprint and storage requirements, and make some mathematical operations faster. It also opens up the possibility of 4 way SIMD if further optimization is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed point is only really worthwhile when you don't have an FPU - most modern x86 CPUs have two FPUs so there is nothing to be gained from using fixed point, and performance may even be significantly worse with fixed point. (Note also that fixed point requires additional instructions compared to floating point for operations such as multiplication.)&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2012-10-29T16:41:55.060" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4840" PostTypeId="2" ParentId="4835" CreationDate="2012-10-29T18:48:12.133" Score="3" Body="&lt;p&gt;In addition to the very good answers provided here, a few things worth adding:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There are situations in which even if you have very basic requirements on the dynamic range of the data you process, you will still need a very good precision for some of the operations performed on it - for example you will want to apply an IIR filter which requires relatively small coefficients; and truncating them would cause instabilities. As soon as your system has feedback, there's a good chance quantization/truncation problems will bite you back when using fixed point - you have to be much more careful about things like filter topology and truncation/fraction-saving schemes.&lt;/li&gt;&#xA;&lt;li&gt;Unlike many DSP/DSC architectures, the x86 doesn't have saturated integer operations (well, it's there in SSE, not on standard scalar code). This means that in case of overflow, bad things can happen - values changing signs and &quot;wrapping&quot;. You have to be extra cautious with overflows and dynamic range, or sprinkle &lt;a href=&quot;https://stackoverflow.com/questions/121240/saturating-addition-in-c&quot;&gt;tests on operands ranges&lt;/a&gt; all over your code. This can seriously hurt performance. By comparison, floating point is more resilient to these problems, because the large dynamic range gives you more &quot;headroom&quot;, and overflows will not lead to catastrophic failures. Most audio signal processing code running on desktop computers is using the -1.0 .. 1.0 range, single or double precision; so this gives more than hundreds of dB of headroom. I have written audio signal processing code with both approaches, and when using floating point there are only a few places when I have to explicitly clip/saturate the signal - usually just at the end of the signal processing chain or in places where feedback occur.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-10-29T18:48:12.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4841" PostTypeId="2" ParentId="4833" CreationDate="2012-10-29T19:32:59.090" Score="1" Body="&lt;p&gt;A von Hann window does not &quot;correct&quot; the results of an FFT.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It (1) reduces interference from other portions of the spectrum in the window's stop-band at the cost of (2) reduced resolution (due a fatter main lobe in the frequency domain) and less total information.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to trade-off the 2 effects for your particular situation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-10-29T19:32:59.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4842" PostTypeId="2" ParentId="4835" CreationDate="2012-10-29T19:48:08.043" Score="6" Body="&lt;p&gt;The merits of fixed-point are mostly in terms of power (such as when you have a choice of processor hardware, or the processor is good at shutting down unused functional units).  That is because fixed-point units are commonly smaller (less transistors, shorter wires, less capacitance to overcome per MAC) for a given technology and operation issue rate, than floating point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However a vast amount of common contemporary processors (server, PC and even mobile), have more and faster FPUs (especially single-precision FP units) than integer multipliers, and most of the system power is not from using the FPU, so using fixed-point will have little or no advantages for typical DSP computation on these products, and can likely be a disadvantage in terms of pure performance.  Using current technology, any advantage to fixed-point will mostly accrue mostly in tiny embedded products, such as button-sized devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However also consider memory and processor cache footprints.  Clever use of smaller data types (short int and float) to fit a large computation completely in data cache may offset any pure FPU bandwidth advantages.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-10-29T19:48:08.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4843" PostTypeId="2" ParentId="4825" CreationDate="2012-10-29T21:38:08.733" Score="31" Body="&lt;p&gt;The &lt;strong&gt;FFT&lt;/strong&gt; (or Fast Fourier Transform) is actually an &lt;em&gt;algorithm&lt;/em&gt; for the computation of the &lt;strong&gt;Discrete&lt;/strong&gt; Fourier Transform or DFT. The typical implementation achieves speed-up over the conventional computation of the DFT&#xA;by exploiting the fact that $N$, the number of data points, is a composite integer&#xA;which is not the case here since $101$ is a prime number. (While FFTs exist for&#xA;the case when $N$ is a prime, they use a different formulation that might or might not be implemented in MATLAB).  Indeed, many people deliberately choose&#xA;$N$ to be of the form $2^k$ or $4^k$ so as to speed up the DFT computation&#xA;via the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning to the question as to why the mirroring occurs, hotpaw2 has essentially stated the reason, and so the following is just a filling in of the details.&#xA;The DFT of a sequence $\mathbf x = \bigr(x[0], x[1], x[2], \ldots, x[N-1]\bigr)$ of $N$&#xA;data points is defined&#xA;to be a sequence $\mathbf X =\bigr(X[0], X[1], X[2], \ldots, X[N-1]\bigr)$ where&#xA;$$X[m] = \sum_{n=0}^{N-1} x[n]\left(\exp\left(-j2\pi \frac{m}{N}\right)\right)^n, m = 0, 1, \ldots, N-1$$&#xA;where $j = \sqrt{-1}$.&#xA;It will be obvious that $\mathbf X$ is, in general &#xA;a &lt;em&gt;complex-valued&lt;/em&gt; sequence&#xA;even when $\mathbf x$ is a &lt;em&gt;real-valued&lt;/em&gt; sequence. But note that&#xA;when $\mathbf x$ is a real-valued&#xA;sequence, $\displaystyle X[0]=\sum_{n=0}^{N-1} x[n]$ is a real number. &#xA;Furthermore, if $N$ is an &lt;em&gt;even&lt;/em&gt; number, then, since $\exp(-j\pi) = -1$,&#xA;we also have that &#xA;$$X\left[\frac{N}{2}\right] = \sum_{n=0}^{N-1} x[n]\left(\exp\left(-j2\pi \frac{N/2}{N}\right)\right)^n = \sum_{n=0}^{N-1} x[n](-1)^n$$&#xA;is a real number. But, regardless of whether $N$ is odd or even,&#xA;the DFT $\mathbf X$ of a real-valued sequence $\mathbf x$&#xA;has &lt;em&gt;Hermitian symmetry&lt;/em&gt; property that you have mentioned in&#xA;a comment.  We have for any &lt;em&gt;fixed&lt;/em&gt; $m$, $1 \leq m \leq N-1$,&#xA;$$\begin{align*}&#xA;X[m] &amp;amp;= \sum_{n=0}^{N-1} x[n]\left(\exp\left(-j2\pi \frac{m}{N}\right)\right)^n\\&#xA;X[N-m] &amp;amp;= \sum_{n=0}^{N-1} x[n]\left(\exp\left(-j2\pi \frac{N-m}{N}\right)\right)^n\\&#xA;&amp;amp;= \sum_{n=0}^{N-1} x[n]\left(\exp\left(-j2\pi + j2\pi\frac{m}{N}\right)\right)^n\\&#xA;&amp;amp;= \sum_{n=0}^{N-1} x[n]\left(\exp\left(j2\pi\frac{m}{N}\right)\right)^n\\&#xA;&amp;amp;= \left(X[m]\right)^*&#xA;\end{align*}$$&#xA;Thus, for $1 \leq m \leq N-1$, $X[N-m] = \left(X[m]\right)^*$.  As a&#xA;special case of this, note that if we choose $m = N/2$ when $N$ is even, &#xA;we get that $X[N/2] = \left(X[N/2]\right)^*$, thus confirming our&#xA;earlier conclusion that $X[N/2]$ is a real number.&#xA;Note that an effect of the Hermitian symmetry property is that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the $m$-th bin in the&#xA;  DFT of a real-valued sequence has the &lt;em&gt;same magnitude&lt;/em&gt; as the $(N-m)$-th bin.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;MATLABi people will need to translate this to account for the&#xA;fact that MATLAB arrays are numbered from $1$ upwards.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Turning to your actual data, your $\mathbf x$ is a DC value of $1$ plus&#xA;&lt;em&gt;slightly more than one period&lt;/em&gt; of a sinusoid of frequency $1$ Hz.&#xA;Indeed, what you are getting is&#xA;$$x[n] = 1 + \sin(2\pi (0.01n)), ~ 0 \leq n \leq 100$$&#xA;where $x[0] = x[100] = 1$. Thus, the first and the last of $101$ samples&#xA;has the same value. The DFT that you are computing is thus given by&#xA;$$X[m] = \sum_{n=0}^{100} \left(1+\sin\left(2\pi \left(\frac{n}{100}\right)\right)\right)\left(\exp\left(-j2\pi \frac{m}{101}\right)\right)^n$$&#xA;The mismatch between $100$ and $101$  causes clutter in the DFT: the values of&#xA;$X[m]$ for $2 \leq m \leq 99$ are nonzero, albeit small.  On the other hand,&#xA;suppose you were to adjust the array &lt;code&gt;t&lt;/code&gt; in your MATLAB program&#xA;to have $100$ samples taken at $t=0, 0.01,&#xA;0.02, \ldots, 0.99$ so that&#xA;what you have is&#xA;$$x[n] = 1 + \sin(2\pi (0.01n)), ~ 0 \leq n \leq 99.$$&#xA;Then the DFT is&#xA;$$X[m] = \sum_{n=0}^{99} \left(1+\sin\left(2\pi \left(\frac{n}{100}\right)\right)\right)\left(\exp\left(-j2\pi \frac{m}{100}\right)\right)^n,$$&#xA; you will see that your DFT will be &lt;em&gt;exactly&lt;/em&gt;&#xA;$\mathbf X = (100, -50j, 0, 0, \ldots, 0, 50j)$ (or at least&#xA;within round-off error), and the &lt;em&gt;inverse&lt;/em&gt; DFT will give&#xA;that for $0 \leq n \leq 99$,&#xA;$$\begin{align*}&#xA;x[n] &amp;amp;= \frac{1}{100}\sum_{m=0}^{99}X[m]\left(\exp\left(j2\pi \frac{n}{100}\right)\right)^m\\&#xA;&amp;amp;= \frac{1}{100}\left[100 - 50j\exp\left(j2\pi \frac{n}{100}\right)^1&#xA;+ 50j \left(\exp\left(j2\pi \frac{n}{100}\right)\right)^{99}\right]\\&#xA;&amp;amp;= 1 + \frac{1}{2j}\left[\exp\left(j2\pi \frac{n}{100}\right)&#xA;- \exp\left(j2\pi \frac{-n}{100}\right)\right]\\&#xA;&amp;amp;= 1 + \sin(2\pi (0.01n))&#xA;\end{align*}$$&#xA;which is precisely what you started from.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-10-30T16:28:23.923" LastActivityDate="2012-10-30T16:28:23.923" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4844" PostTypeId="2" ParentId="3348" CreationDate="2012-10-29T21:48:53.423" Score="9" Body="&lt;p&gt;I think what you are asking is about the feasibility of your pedestrian algorithm.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two general strategies for this kind of problems: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;(bottom-to-top) Consider it as a pure detection problem, where in&#xA;each frame you detect only pedestrians. Once you detect them, a)&#xA;counting their number in a frame is fairly easy; and b) tracking any&#xA;of them in consecutive frames is also easy. Therefore, you solve everything.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(top-to-bottom) Consider it as a action recognition problem, where you detect whether a ROI in consecutive frames is a pedestrian or not according its actions. Once you solve this problem, then you solve the detection and tracking problems simultaneously.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Your heuristic algorithm is in the first category. I donot want to discourage you, but you might miss the key point that &lt;strong&gt;how to detect a pedestrian&lt;/strong&gt;. Because real data can be more complicated than what you thought. For example, if this is a subway camera, whose frames maybe full of pedestrians and thus removing background or detecting blobs does not help at all. In this case, it maybe more reasonable to use face detection and face recognition algorithms to solve the problem, because if you find a face you find a pedestrian. On the other hand, depending on your definition of a pedestrian, it maybe true that not everyone appeared in a frame should be treated as a pedestrian. In this case, it might be reasonable to use action recognition algorithms (the second category), where you can explicitly define a pedestrian based on his or her behaviors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some tips based on my experience:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Stick on what you know and what you can easily pick up. Donot invest&#xA;your time on something is fancy but requiring many backgrounds you&#xA;donot have. Trust me, all these algorithms will be good in some case&#xA;but bad in some others. Therefore, the first thing is to make&#xA;something work, no matter how good or bad it is. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Know more about your data and then determine your method. A general description about a problem is insufficient in many cases. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you want to demonstrate your idea,  it is better to use MATLAB and build a prototype.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2012-10-29T21:48:53.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4845" PostTypeId="1" CreationDate="2012-10-30T00:09:08.260" Score="3" ViewCount="498" Body="&lt;p&gt;I am deriving the temporal envelope of a signal (in a particular frequency band) by summing some FFT bin powers and taking the average, I do the FFT frame by frame, windowing and some overlap. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me understand the following: when the envelope of the signal changes slowly (say 5 Hz), I can track the envelope fine. However when the envelope is modulated at a higher frequency, say at 100 Hz, the dynamic range and amplitude of the detected envelope are very reduced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the Modulation Transfer Function (MTF) of this method has a low-pass look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand the reasons for this low-pass roll-off effect and the maths behind it. I see what's happening but I can't clearly conceptualise the underlying cause . It should also be possible to come up with a number regarding the slope of the MTF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GP,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 1 : Thanks for your answer. I can't post images cause I'm a new user apparently.. so here is a link: &lt;a href=&quot;http://s1052.photobucket.com/albums/s445/nanonash/?action=view&amp;amp;current=fftmoddifferences.png&quot; rel=&quot;nofollow&quot;&gt;Link&lt;/a&gt; . you see on the left the input signal is 4 kHz modulated by 5 Hz and I take some fft bin powers to track the 5 Hz envelope and it works fine. But at 75 Hz modulation (right), the amplitude and dynamic range of the envelope are reduced, and it gets worse as you increase the modulation freq (low pass effect). This is what I am trying to get my head around: where is this effect coming from ? Is it because I destroy phase information when I take the power of the bins ? I apply a hann window on the time domain input frames, before computing the FFT.&lt;/p&gt;&#xA;" OwnerUserId="3195" LastEditorUserId="3195" LastEditDate="2012-10-30T08:53:58.490" LastActivityDate="2013-05-28T22:20:06.890" Title="Envelope following using FFT bin power -&gt; Low pass effect on the modulation transfer function" Tags="|fft|modulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4847" PostTypeId="1" CreationDate="2012-10-30T12:37:18.517" Score="17" ViewCount="7897" Body="&lt;p&gt;I am trying to find some method to detect people using only one camera 3 meters above the ground. This is a frame returned by camera:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dmbpQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Video test -&gt; &lt;a href=&quot;http://dl.dropbox.com/u/5576334/top_head_shadow.avi&quot; rel=&quot;noreferrer&quot;&gt;http://dl.dropbox.com/u/5576334/top_head_shadow.avi&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to do that, first I understand that I have to perform a background-foreground segmentation. That is the easy part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the foreground mask, I am able to make simple operations such Hough transform to find circles, but this way only detects the 60% of heads, including many false positives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use some other simple techniques like color segmentation, but I found that people heads are very different seen from above because of their hairstyle, color, amount of hair,...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other option I have though about it is the possibility of using HOG Descriptors, or Haar-like features, but I would need an extensive database of people seen from above to train the models. I have not found anything like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought this would be a very recurrent problem, but I can not find very much about it in the literature or internet. Any help to resolve this task will be appreciated :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: For more information, The goal is to implement some generic method to make pedestrian flow tracking. The first prototype will be tested in a Mall.&lt;/p&gt;&#xA;" OwnerUserId="3197" LastEditorUserId="3197" LastEditDate="2012-11-01T10:32:43.290" LastActivityDate="2013-05-03T04:36:47.097" Title="People detection from above" Tags="|image-processing|computer-vision|opencv|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4848" PostTypeId="2" ParentId="4847" CreationDate="2012-10-30T13:23:24.683" Score="3" Body="&lt;p&gt;I think that you could &lt;em&gt;get started&lt;/em&gt; by combining a few answers from here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's two different approaches mentioned in &lt;a href=&quot;https://dsp.stackexchange.com/a/4844/1273&quot;&gt;this&lt;/a&gt; answer, with the major difference that it's impossible for you to do face detection since you do not see faces. But the other approach is still applicable: decide weather something is a pedestrian or not &lt;em&gt;based on it's actions (movements)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would, as you predicted, suggest using some kind of foreground-background segmentation. A very fast googling found &lt;a href=&quot;http://www.google.fr/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CB8QFjAA&amp;amp;url=http%3A%2F%2Fwww.cs.huji.ac.il%2F~daphna%2Fpapers%2FRosenfeld_ICCV2011.pdf&amp;amp;ei=bdGPUPjeD8mk0QXu34FI&amp;amp;usg=AFQjCNFbJnOQN3Nx9DBaNPPl5_EN4e_H4g&quot; rel=&quot;nofollow noreferrer&quot;&gt;this recent article&lt;/a&gt; that looked pretty promising, but since I never did this personally, you or someone else might have better suggestions for specific algorithm to use in this step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the first answer I linked just gives a very general approach idea. &lt;a href=&quot;https://dsp.stackexchange.com/a/4811/1273&quot;&gt;This answer&lt;/a&gt; however could give you idea about your next steps: track the objects, and try to distinguish between them based on the &lt;em&gt;speed&lt;/em&gt; or &lt;em&gt;moving direction&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I never tackled the problem you had, so I'm probably not of much help, but maybe the answers I linked to can give you some general idea for where to start. It also surprised me that I could not find any previous works and articles when searching for an answer to your problem, but then, maybe you just need somebody to tell you &lt;em&gt;the correct keywords to describe this problem&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2012-10-30T13:23:24.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4849" PostTypeId="1" AcceptedAnswerId="4861" CreationDate="2012-10-30T14:15:17.213" Score="11" ViewCount="25404" Body="&lt;p&gt;I am familiar with additive (RGB), substractive (CMYK), and HSV-like colorspaces, but an article I'm currently trying to understand operates on &lt;strong&gt;YCbCr&lt;/strong&gt; color space for image segmentation / object definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've spend most of my morning looking for something that would explain the YCbCr naturally, but I just don't get it. I got a nice, intuitive explanation of the &lt;em&gt;general idea behind this color space&lt;/em&gt; &lt;a href=&quot;https://photo.stackexchange.com/a/17241&quot;&gt;here&lt;/a&gt;, and explanation of how it's used for image coding/compression from &lt;a href=&quot;https://photo.stackexchange.com/a/8357&quot;&gt;these&lt;/a&gt; &lt;a href=&quot;https://photo.stackexchange.com/a/8312&quot;&gt;guys&lt;/a&gt; (all on photo.SE).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formulas for calculating YCbCr from RGB is readily accessible on &lt;a href=&quot;http://en.wikipedia.org/wiki/YCbCr&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got the motivation for this representation, I got that Y component contains the most important (to the human eye) grey-scale information about the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got that Cb and Cr carry information about the &lt;em&gt;colors&lt;/em&gt;, and that (because of human eye (in)sensibility), they can be compressed without a visible lost in quality. But, &lt;strong&gt;what does each of the chrominance components actually represent?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the article authors mention that &quot;chrominance information is paramount in the definition of objects&quot; in their approach, and I can not fully understand what I'm reading with my current &quot;Y is intensity, Cb and Cr carry color information somehow&quot; level of understanding YCbCr.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm seeking for an answer along the lines &quot;Cb is..., while Cr is...&quot; or &quot;if you imagine looking through/with XY, you're actually looking at Cb component...&quot;, or some other way that would help me understand information carried by each of the components separately,  not just that they, together, carry color information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me give examples of intuitive explanations for other color spaces of the type I'm looking for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;RGB&lt;/strong&gt;: Like shining a colored flashlight on a black wall: If you shine with a blue flashlight, you see a blue reflection. If you add a red flashlight, it will show a magenta reflection, which is a mixture of blue and red.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CMYK&lt;/strong&gt;: Like mixing watercolors, you &quot;add to the colors the surface reflects&quot;, (i.e. subtracts color from the background) so if you mix a yellow one with a cyan one, if will reflect green and thus you will get a green color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;HSV&lt;/strong&gt;: Little kids are attracted to highly saturated objects, not bright (value). The Hue component is what &quot;gives the color&quot;, while low saturation means the color is &quot;diluted&quot; by white. Change in value makes the whole thing brighter or darker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this definitions, I've been able to get an intuitive feeling about what a color representation in each color space means, without memorizing charts for each of them.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="128" LastEditDate="2019-03-19T17:24:31.947" LastActivityDate="2020-04-12T19:13:45.367" Title="Understanding Cb and Cr Components of YCbCr Color Space" Tags="|image-processing|image-segmentation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4850" PostTypeId="2" ParentId="4847" CreationDate="2012-10-30T14:20:49.603" Score="12" Body="&lt;p&gt;Are there any other objects that can move beside people? If there aren't, you can just find the  blobs (connected components) in your foreground mask, and these are your people. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They can also &quot;collide&quot; one with another, creating one blob instead of two. In this case, you can do a motion tracking and resolve the ambiguity by using the fact that the trajectory and the speed is smooth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are other objects (like dogs, cars), you should create a classifier that gets blob parameters like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Blob statistics (size, solidity,etc..)&lt;/li&gt;&#xA;&lt;li&gt;Color&lt;/li&gt;&#xA;&lt;li&gt;Edge information&lt;/li&gt;&#xA;&lt;li&gt;Speed (in case of tracking)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And returns the correct class (Human/No Human). &lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2012-10-30T14:20:49.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4851" PostTypeId="2" ParentId="3251" CreationDate="2012-10-30T14:55:33.263" Score="2" Body="&lt;p&gt;I seems to me like wavelets can offer a neat solution to your problem for noise filtering. Just incase you are not aware a wavelet transform uses two filters (also called mother and father wavelet). These two filters result in a sub-signal (also called sub-band) which is of half the size of the original signal. What I mean to say is say your signal length is 100. Upon wavelet transform you get 2 signals each of size 50. One of these signal is a approximation of original signal and the another one is detail signal. Usually the noise component is present in the detail section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as to get rid of the noise, what is usually done is to take a wavelet transform. Implementation of it is available in matlab (dwt() ). This will result in two outcomes cA and cD. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[cA,cD] = dwt(X,'haar')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I would suggest you to do usual noise removal algorithms on cD and with cA and cD' (ie. filtered cD) reconstruct the original signal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cD_1 = someProcessing( cD )&#xA;&#xA;X = idwt(cA, cD_1,'haar')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please have a look at the following links to get more information on noise filtering with wavelets&#xA;1. PhD Thesis titled &quot;Signal Recovery and Noise Reduction with Wavelets&quot; download from &lt;a href=&quot;http://www.google.ch/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCIQFjAA&amp;amp;url=http://gislib.poi.dvo.ru/stud/Goncharova/dsp-wavelets/Wavelets/diss_lu/wvlt_diss26_lu.pdf&amp;amp;ei=B-qPUNWDBOOG4gSnsoCwDQ&amp;amp;usg=AFQjCNGzdGAn8fiJEm4FYWQVfYKEtfsROw&amp;amp;sig2=AZ4S8EOBo4dqWsuXgFXEwg&amp;amp;cad=rja&quot; rel=&quot;nofollow&quot;&gt;HERE&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="3184" LastActivityDate="2012-10-30T14:55:33.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4852" PostTypeId="2" ParentId="3309" CreationDate="2012-10-30T15:01:18.887" Score="7" Body="&lt;p&gt;One simple way for quantification of contract that I can think of is through use of image histogram. Following is my suggestion&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute Histogram of the Image &lt;/li&gt;&#xA;&lt;li&gt;From the counts compute entropy&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you just want to try it out you can use the matlab inbuilt function &lt;a href=&quot;http://www.mathworks.ch/ch/help/images/ref/entropy.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.mathworks.ch/ch/help/images/ref/entropy.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the entropy value of the histogram as a measure of contract.&lt;/p&gt;&#xA;" OwnerUserId="3184" LastActivityDate="2012-10-30T15:01:18.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4853" PostTypeId="1" AcceptedAnswerId="4856" CreationDate="2012-10-30T15:41:20.567" Score="5" ViewCount="5300" Body="&lt;p&gt;I have an original image $\ I(x_i,y_j)$ where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ x_i = i*\Delta x, 0&amp;lt;= i &amp;lt; n_i $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ y_j = j*\Delta y, 0&amp;lt;= j &amp;lt; n_j$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to implement a function that resamples the image to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ I(x_k,y_l)$ where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ x_k = k*\Delta xx, 0&amp;lt;= k &amp;lt; n_k $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ y_l = l*\Delta yy, 0&amp;lt;= l &amp;lt; n_l$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The case when $\ \Delta xx &amp;lt;= \Delta x $ and $\ \Delta yy &amp;lt;= \Delta y $ : upsampling,&#xA;is quite easy (?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Linear interpolation between nearest neighbours should do a decent job?&lt;/strong&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Downsampling on the other hand is more tricky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make sure Nyquist is followed so that no aliasing occurs; I must lowpass filter before decimating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I do this an good yet simple manner?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking maybe using the FFT to do both upsampling and downsampling:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;take the FFT of the image&lt;/li&gt;&#xA;&lt;li&gt;zero pad or truncate the FFT&lt;/li&gt;&#xA;&lt;li&gt;inverse FFT&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the case of zero padding this amount to sinc interpolation (which is better than linear interpolation)?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the case of truncation this amount to (ideal) lowpass filtering?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this should be a both simple to implement and very good solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess one thing to look out for is edge effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do I best avoid this?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking repeating the image twice in x and y and then circulary shifting it half the width and height of the image.&#xA;That should make the padded image cyclical periodic.&lt;/p&gt;&#xA;" OwnerUserId="697" LastActivityDate="2012-10-30T17:55:13.590" Title="Best way to resample a signal (image)?" Tags="|image-processing|fft|discrete-signals|lowpass-filter|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4854" PostTypeId="2" ParentId="1512" CreationDate="2012-10-30T16:59:54.690" Score="1" Body="&lt;p&gt;yet another thing to try could be wavelet transform. Wavelets are powerful tools for analysis of signal. You could take a DWT of your signal and compare may be the most significant coefficients. Anyway but it would be helpful if you could post some sample data. &lt;/p&gt;&#xA;" OwnerUserId="3184" LastActivityDate="2012-10-30T16:59:54.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4855" PostTypeId="2" ParentId="2800" CreationDate="2012-10-30T17:05:47.363" Score="0" Body="&lt;p&gt;I would suggest you try HSV space thresholding. What I mean is convert the image to HSV space and set a threshold on either 1) H-channel or 2) combined threshold on H, S channel. I am suggesting this approach since the object you detect is of a particular color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using opencv you can use the function cvCvtColor() to convert to HSV color space. If you want your own stand alone implementation, conversion formulars for RGB to HSV may be found here : &lt;a href=&quot;http://en.wikipedia.org/wiki/HSL_and_HSV&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/HSL_and_HSV&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3184" LastActivityDate="2012-10-30T17:05:47.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4856" PostTypeId="2" ParentId="4853" CreationDate="2012-10-30T17:55:13.590" Score="4" Body="&lt;p&gt;An FFT approach to filtering/resampling should work fine, but you &lt;em&gt;don't&lt;/em&gt; want to just truncate or pad with zeros.  That will add effects to the image.  See &lt;a href=&quot;https://dsp.stackexchange.com/a/3005/923&quot;&gt;here&lt;/a&gt; for more information about FFT resampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also just do a FIR filter.  If you upsample by a ratio of $\frac{p}{q}$ then you would want your anti-aliasing filter to have a normalized bandwidth of $\frac{q}{p}$.  You could make the bandwidth a little smaller to get rid of more alias energy, as desired.  If you downsample by a ratio of $\frac{p}{q}$ then you would want the filter bandwidth to also be about $\frac{p}{q}$.  Again, you could make it a little smaller to get rid of more alias energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have your filter you just need to do a two-dimensional convolution and trim the extra resulting samples on each edge.  Many signal processing libraries have built-in two-dimensional filtering routines that can do this for you.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-10-30T17:55:13.590" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4857" PostTypeId="2" ParentId="4849" CreationDate="2012-10-30T19:04:08.273" Score="2" Body="&lt;p&gt;Not sure what you mean by &quot;actually&quot; represent, as neither RGB nor YUV represent either photon frequency or the typical human eyes rod/cone responses.  But you can see what they look like to you by synthesizing some YCrCb color patches, such as (1,1,0), (1,-1,0), (1,0,1), (1,0,-1), etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a Wikipedia page which includes a chart:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/File:YCbCr-CbCr_Scaled_Y50.png&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/File:YCbCr-CbCr_Scaled_Y50.png&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDED: RGB, and such, were almost designed (or evolved) to match a possible human intuitive understanding of perception (and color names turn out to be culturally learned).  YUV is the opposite, designed such that noise in the UV area (added to a noisy NTSC subband) would be hard to see and thus be harder to describe.  YCrCb is a variation on the same color mapping.  So don't look for an existing &quot;intuitive&quot; insight, which may not exist.  Perhaps create your own by &quot;learning&quot; the chart and building some brand new neural connections that may not currently exist in your brain (or something like that.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-10-30T20:17:00.573" LastActivityDate="2012-10-30T20:17:00.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4858" PostTypeId="2" ParentId="4845" CreationDate="2012-10-30T19:58:10.153" Score="1" Body="&lt;p&gt;Any set of FFT framings of the data is a form of averaging filter or FIR filter, and thus will have a low-pass filtering effect over some envelope frequency range.  You can understand this effect by treating the FFT window as a FIR filter kernel and calculating its frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the width of your FFT window is somewhere near the period of 5 Hz, then you will be in an area of filter roll-off.  You could try a shorter window, compensate for the window roll-off, perhaps using a &quot;flat-top&quot; window if your frequency of interest is well within the window's passband, or use another form of enveloper follower which does not have an intrinsic roll-off in the area of interest.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-10-30T19:58:10.153" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="4859" PostTypeId="1" AcceptedAnswerId="4860" CreationDate="2012-10-30T20:48:22.677" Score="4" ViewCount="733" Body="&lt;p&gt;I am not a DSP expert, so I would like someone to check my thought process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a text file representing the spectrum (calculated by some FFT hardware), and I'd like to calculate a cepstrum.  I'm using Octave in the examples below, but it's not required.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;My source data is two columns: &lt;code&gt;frequency&lt;/code&gt;, &lt;code&gt;amplitude&lt;/code&gt;, i.e.:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;+----------+----------+&#xA;| 0.00E+00 | 6.93E+01 |&#xA;| 1.00E+01 | 6.95E+01 |&#xA;| 2.00E+01 | 7.38E+01 |&#xA;| ...      | ...      |&#xA;| 2.00E+03 | 6.51E+01 |&#xA;+----------+----------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Load the data in to Octave, and use &lt;code&gt;ifft&lt;/code&gt; to put the spectrum into&#xA;the time domain.  Then use &lt;code&gt;rceps&lt;/code&gt; to calculate the cepstrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;rceps(ifft(my_data(:,2))); % my_data is the 2000x2 matrix from above&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Plot the result of &lt;code&gt;rceps&lt;/code&gt;.  The resulting curve should equal cepstrum that would have been produced if I had started with a time domain signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Is this a correct way to find the cepstrum when only spectrum (FFT) is available, or, is there a flaw in my thought process?&lt;/p&gt;&#xA;" OwnerUserId="3199" LastEditorUserId="3199" LastEditDate="2012-11-01T14:58:50.277" LastActivityDate="2012-11-01T14:58:50.277" Title="High Level Process, Calculating Cepstrum When You Only Have Spectrum" Tags="|fft|matlab|cepstral-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4860" PostTypeId="2" ParentId="4859" CreationDate="2012-10-30T21:36:59.413" Score="4" Body="&lt;p&gt;The cepstrum is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C = | \mathcal{F} \log( P(f) ) |^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathcal{F}$ is a Fourier transform and $P(f)$ is the power spectrum.  If you've got the power spectrum for the signal there is no need to go back to the time domain.  Just take the logarithm, compute an FFT, take the magnitude squared of the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the data you list is strictly positive and real so I'm assuming it's the spectrum.  At the end of your question you put spectrum (FFT).  If what you had was an FFT of a real-valued time domain signal, and not a spectrum, I would expect it to have an imaginary part. &lt;/p&gt;&#xA;" OwnerUserId="2007" LastEditorUserId="2007" LastEditDate="2012-10-31T20:44:10.933" LastActivityDate="2012-10-31T20:44:10.933" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="4861" PostTypeId="2" ParentId="4849" CreationDate="2012-10-30T23:34:35.087" Score="7" Body="&lt;p&gt;YUV (or YCbCr) is like HSV, but in different coordinates. (The difference between YUV and YCbCr is marginal - mostly related to exact formulas).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; component is the same. &lt;span class=&quot;math-container&quot;&gt;$(S,H)$&lt;/span&gt; can be thought of as polar coordinates, and &lt;span class=&quot;math-container&quot;&gt;$(U,V)$&lt;/span&gt; as cartesian. &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the angle and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the radius. A rough conversion would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ U = S \cdot \cos(H) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ V = S \cdot \sin(H) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see &lt;a href=&quot;http://itee.uq.edu.au/~elec4600/elec4600_lectures/1perpage/lectcol2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; link for more information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to add to your intuition list:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Saturation is how pure the color is from spectral point of view&lt;/em&gt;. For example, a laser has a very narrow spectrum, which implies high saturation.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="17653" LastEditDate="2020-04-12T19:13:45.367" LastActivityDate="2020-04-12T19:13:45.367" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4862" PostTypeId="2" ParentId="2800" CreationDate="2012-10-30T23:55:31.340" Score="1" Body="&lt;p&gt;I have recently implemented something like this. I would take the following approach. This assumes the paper is the in the image but there are no other objects. For example a scanner application for iPhone where the user places the paper and hits photo taking button. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Pass the image through first an edge detector and later binary thresholder and make the image binary&lt;/li&gt;&#xA;&lt;li&gt;Use a connected component detection algorithm (any one is fine) to detect the objects and find the extreme coordinates of each object.&lt;/li&gt;&#xA;&lt;li&gt;You can detect parallelism among the 4 corners of any object and this would translate into a mathematical equation where you can see if it is a rectangle and if rectangle, draw the polygon based on 4 corners.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="831" LastActivityDate="2012-10-30T23:55:31.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4863" PostTypeId="1" AcceptedAnswerId="4864" CreationDate="2012-10-30T21:23:46.760" Score="2" ViewCount="428" Body="&lt;p&gt;Hi I am just toying around with compression now that we are learning about Fourier transforms in my class (compression is not a part of the class but I became a bit curious). Trying to do this with a wav file and I have some questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume I don't know the sampling rate of the signal (.wav) how can I figure out what the FFT frequency range is in Hz? I know that the bins are multiples of the sampling rate ($F_s$) divided by N, or they are factors of Fs, eg 0.1*$F_s$, 0.2*$F_s$ etc... but how does this help me find the sampling frequency in Hz, so I can actually see which frequencies are doing what?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any clever trick in storing the coefficients of a real signal (wav)? They are always complex unless the signal is a pure cosine but what audio is? If I want to store the full range of coefficients I need at least as much storage as the .wav file (exploiting symmetry at the midpoint and having 2 units (real, imag) for every real input). This is of particular importance, if the coefficients are small they can be stored with less bits than the bits needed to represent the .wav datapoints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since for the case of functions you can split them in subintervalls and take the Fourier transform and depending on the result get some easier or more compact expression I was wondering if for the sake of compression I could split the audio-signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a .wav file with N datapoints then split into ten N/10 segments and then fft on each segment. But this then means that my sampling frequency is essentially reduced to N/10 $F_s$? This seems intuitive, if I &quot;zoom&quot; into a rapidly osciallitaing function then in that window it will look very slow and appear to have a low frequency.&lt;/p&gt;&#xA;" OwnerUserId="3203" OwnerDisplayName="user948652" LastEditorUserId="29" LastEditDate="2012-11-04T00:58:23.197" LastActivityDate="2012-11-04T00:58:23.197" Title="FFT of audio, packet sampling and others" Tags="|fft|" AnswerCount="2" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="4864" PostTypeId="2" ParentId="4863" CreationDate="2012-10-31T00:51:27.867" Score="6" Body="&lt;p&gt;As some comments have pointed out, there are a couple of practical ways to find out the sampling rate:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Read the sampling rate information from the WAV file header&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Look for mains hum in the recorded audio, which you'd see as a peak in the FFT response in the frequency bin corresponding to 60 Hz (or maybe 50 Hz).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But it sounds like you're looking for a mathematical property of the FFT that will allow you to back out the sampling frequency. Such a thing doesn't exist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only inputs to the FFT are the original sampled data. And this sample data itself has no information about the real sample rate contained in it. So there's no possibility that the spectral result of the FFT can tell you anything about the sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example,  there is no way to tell the difference between a 10 Hz signal sampled at 100 Sa/s from a 320 MHz signal sampled at 3.2 GSa/s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to know the sample rate you must record it as meta-data, for example in the header of a WAV file.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I have a .wav file with N datapoints then split into ten N/10 segments and then fft on each segment. But this then means that my sampling frequency is essentially reduced to N/10 Fs?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, the sample rate is still F&lt;sub&gt;s&lt;/sub&gt;. But the sample duration has been reduced to N/(10 * F&lt;sub&gt;s&lt;/sub&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that the spectrum will still cover the same frequency band (0 to F&lt;sub&gt;s&lt;/sub&gt;*(N-1)/N), but it will cover it in coarser steps. The bins of the DFT will be spaced by 10*F&lt;sub&gt;s&lt;/sub&gt;/N instead of F&lt;sub&gt;s&lt;/sub&gt;/N.&lt;/p&gt;&#xA;" OwnerUserId="3320" OwnerDisplayName="The Photon" LastActivityDate="2012-10-31T01:22:47.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4865" PostTypeId="1" AcceptedAnswerId="4866" CreationDate="2012-10-31T03:58:24.843" Score="7" ViewCount="7599" Body="&lt;p&gt;For signal $x(t)$ with bandwidth $B_x$ and signal $y(t)$ with bandwidth $B_y$, what will the bandwidth of the signal $z(t)=x(t)y(t)$ be?&lt;/p&gt;&#xA;" OwnerUserId="3200" LastActivityDate="2012-10-31T04:22:35.933" Title="What is the bandwidth of product of two signals?" Tags="|bandwidth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4866" PostTypeId="2" ParentId="4865" CreationDate="2012-10-31T04:22:35.933" Score="13" Body="&lt;p&gt;The bandwidths simply add. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can break down both signal into their sinusoidal components and pairwise multiply them. For every pair of sines you get the sum and difference frequencies. This is a simple consequence of the multiplication theorems for sine waves. The highest frequency of the product will be the sum of the highest frequencies in the individual signals. This is equivalent to a convolution in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-10-31T04:22:35.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4867" PostTypeId="2" ParentId="4863" CreationDate="2012-10-31T04:50:44.837" Score="1" Body="&lt;p&gt;&quot;Is there any clever trick in storing the coefficients of a real signal (wav)? &quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, there was a variation of the FFT called the Hartley transform that enjoyed modest popularity some years ago, but overall didn't actually save any trouble or clock cycles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key was to use a 45-degree shifted sine wave, not cos or sin, in the integral.  The shifted sine, if added or subtracted with its mirror image (negative frequency) gave a sine or cosine.  This clever fact was exploited to give an all-real spectrum.  Another nice property is that the inverse transform was exactly the same as the forward transform, not even a complex conjugate involved.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2012-10-31T04:50:44.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4868" PostTypeId="1" AcceptedAnswerId="8521" CreationDate="2012-10-31T08:53:14.987" Score="9" ViewCount="15614" Body="&lt;p&gt;I recently started using image moments for image processing of binary images. I read that the $0^{th}$ order &lt;strong&gt;contour&lt;/strong&gt; moment is &lt;em&gt;the perimeter&lt;/em&gt; and the $0^{th}$ order &lt;strong&gt;area&lt;/strong&gt; moment is the &lt;em&gt;area&lt;/em&gt;. These raw moments are both given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M_{ij} = \sum_{x}\sum_{y}x^iy^j$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means If I have an image like this (but binary, foreground pixels shown in blue), the $0^{th}$ moment will correspond to the the perimeter, since it's an image of a &lt;strong&gt;contour&lt;/strong&gt; :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EVDhe.png&quot; alt=&quot;Perimiter img&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if I have an image like this (foreground shown as while), I will get the &lt;strong&gt;area&lt;/strong&gt; of the object as the $0^{th}$ moment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HPzx6.png&quot; alt=&quot;Area img&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I want to use the contours to get more properties, I also calculate the higher order ($1^{st}$, $2^{nd}$, $3^{rd}$ order) raw &lt;strong&gt;contour&lt;/strong&gt; moment. I want to use these to get the central moments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formulas I am using to get the central moments are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mu_{00} = M_{00}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mu_{01} = 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mu_{10} = 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mu_{11} = \frac{M_{11}}{M_{00}} - x_c*y_c = \frac{M_{11}}{M_{00}} - (\frac{M_{10}}{M_{00}})*(\frac{M_{01}}{M_{00}})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formulas for calculating &lt;em&gt;central&lt;/em&gt; moments are using &lt;em&gt;raw moments&lt;/em&gt;. My question is: &lt;strong&gt;Which &lt;em&gt;raw&lt;/em&gt; moments are used to calculate central moments, &lt;em&gt;area&lt;/em&gt; or &lt;em&gt;contour&lt;/em&gt;?&lt;/strong&gt;. My guess is &lt;em&gt;area&lt;/em&gt; moments, since the $0^{th}$ order central moment is also equal to the area, which is in fact the $0^{th}$ order area moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, &lt;strong&gt;can I calculate the central moments based on contour raw moments&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="1273" LastEditDate="2013-04-05T14:30:00.303" LastActivityDate="2016-07-22T02:33:16.680" Title="Contour and area, raw (spatial) and central image moments" Tags="|image-processing|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4869" PostTypeId="2" ParentId="4670" CreationDate="2012-10-31T14:28:00.453" Score="2" Body="&lt;p&gt;You can do the following in order to get a connected contour. Get a few points on the contour say like 100 points or so. And then fit a &lt;a href=&quot;http://en.wikipedia.org/wiki/Spline_%28mathematics%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;cubic-spline&lt;/a&gt; on it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had done something which might be helpful to you. Below is what I had done.&#xA;The project was clustering of cars by shapes. So I had images of cars and I a user had marked the boundaries of the car. Red dots are the manually marked points. Then I had fit a closed cubic splines on these few points. The blue contour is the cubic spline. I then used this contour for my purpose &lt;img src=&quot;https://i.stack.imgur.com/1KWOa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure you can do something similar to get the contours. Please be aware that it is possible to get an open curve with cubic splines. Let me also tell you constructing splines from these set of co-ordinate points is simple. What you basically want to do is fit a cubic curve between each set of points. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please ask if you need further clarification on what I think. &lt;/p&gt;&#xA;" OwnerUserId="3184" LastActivityDate="2012-10-31T14:28:00.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4870" PostTypeId="1" AcceptedAnswerId="5929" CreationDate="2012-10-31T14:36:20.047" Score="7" ViewCount="1114" Body="&lt;p&gt;Say I have a complex function $f^*$ (e.g. a MRI image) that has a near piece-wise constant magnitude, but a non constant phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have an optimization problem to find $f^*$ and set up an objective function with a total variation term (e.g. for denoising or compressed sensing) it usually has the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$  &#xA;obj_1(f) = \ldots + \text{TV}(f)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since I assume that $f$ has a piece-wise constant magnitude, I think it might be better to use:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  obj_2(f) = \ldots + \text{TV}(|f|)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for a gradient based solver, one would have to know the gradient of obj2. The gradient for $obj_1(f)$ is: $\text{TV}'\left(TV(f)\right)$. What is the gradient of $obj_2(f)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively I would assume something like the following (since the phase has no influence on $obj_2$, leave the phase &quot;untouched&quot;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{TV}'\left(TV(|f|)\right)* e^{i \arg(f)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, my knowledge in complex analysis is very limited and I am not sure if this makes sense.&lt;/p&gt;&#xA;" OwnerUserId="1665" LastEditorUserId="128" LastEditDate="2018-05-12T09:09:59.787" LastActivityDate="2018-05-12T09:09:59.787" Title="Gradient of Total Variation of Magnitude of Complex Function for Denoising" Tags="|image-processing|noise|denoising|gradient|total-variation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4871" PostTypeId="2" ParentId="4750" CreationDate="2012-10-31T14:38:16.607" Score="1" Body="&lt;p&gt;I agree with @Maurits on his comment&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that you want to develop a simple system as a part of mini-project or something here is what you may do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic concept is that the places where there is change (along time) is the places where there are objects. So what you need to do as 1st step is change detection. A simple algorithm to do change detection is frame-differencing. What is essentially done is to subtract consecutive frames. And the absolute value of this differencing is threshold. What you really will do with this is that if difference in value is high then it is a pixel where there is change. If difference is not too much then it is not a change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this stage you should get a binary image (containing 0s and 1s). This image shall contain several blobs. You can iterate through these blobs by using connect component labelling. Implementations of these are available with matlab and opencv. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this you can have a simple rule like. If the ratio of width by height is more than 1 then it is a car else a human. This rule is applicable since cars are wide and humans are tall. (I hope you get what I am trying to say).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now there could be a few noise like objects. These can be filtered out based on their area. For example if the blob size is less than a threshold you can ignore that blob. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope with this simple approach you can make a system which can detect a car and a human from fixed background video. Please be warned that this is a simple apprach and likely is not robust. But should work fine under a few more assumptions. &lt;/p&gt;&#xA;" OwnerUserId="3184" LastActivityDate="2012-10-31T14:38:16.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4872" PostTypeId="1" AcceptedAnswerId="4880" CreationDate="2012-10-31T16:49:17.737" Score="4" ViewCount="1690" Body="&lt;p&gt;I'm using an algorithm to detect interest points in an image and get their descriptor. The most recent algorithms use binary strings instead of float vectors to dramatically increase the performance because inserting those float vectors in a database and comparing them to whatever will suffer the curse of dimensionality. The thing that bothers me is, if those algorithms convert the descriptors into binary strings, why does it still return a float vector? Do I need to binarise it manually? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a quick note, I'm also studying complementary solutions (e.g. Neural Network) for this large-dimension querying issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Found a very interesting &lt;a href=&quot;http://www.sersc.org/journals/IJSIP/vol3_no1/3.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; on the subject, but I'm having a hard time understanding how it's effectively done. Besides, I fear that this binarization is already being done somewhere in the descriptor extraction algorithm.&lt;/p&gt;&#xA;" OwnerUserId="3207" LastActivityDate="2012-11-01T10:28:37.793" Title="Binary descriptors" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4873" PostTypeId="1" AcceptedAnswerId="4897" CreationDate="2012-10-31T20:15:44.313" Score="7" ViewCount="2680" Body="&lt;p&gt;I need to decimate a signal by a factor of q.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically my signal is a 3D &quot;image&quot;: $\ I(x_i,y_j,z_k)$,&#xA;which I need to downsample by a factor of two in the z direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to do lowpass filtering before decimation by convolving with a Gaussian kernel of size n.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I create my Gaussian kernels 2 standard deviations below and above 0 since this accounts for 95 % of the distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I am looking for a rule of thumb that tells me how large n should be.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right in thinking that the Gaussian should filter out all frequencies above fN/q,&#xA;where fN: Nyquist frequency of original signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the Fourier of a Gaussian with standard deviation $\ \sigma $ is another Gaussian with standard deviation  $\ \sigma^* =1/\sigma $. I am not sure how strict my lowpass filter should be. Should the cut frequency, fc, be at 2 or 3 standard deviations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is then the equation for the cut frequency, fc, of a Gaussian kernel with size n: fc(n)=? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the frequency response of some Gaussian kernels calculated in Matlab:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zK3rw.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My actual problem involves q = 2, and from this figure I see that n=5 should work nicely.&#xA;It would have been good to have a rule of thumb do, so I did not have to do this for each q I encounter.&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2012-11-02T07:47:23.677" LastActivityDate="2012-11-02T22:46:40.117" Title="Choice of Gaussian kernel parameters when lowpass filtering before image resampling?" Tags="|image-processing|fourier-transform|filter-design|lowpass-filter|gaussian|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="4875" PostTypeId="1" CreationDate="2012-10-31T21:47:00.730" Score="1" ViewCount="1757" Body="&lt;p&gt;I am using simulink and have got IQ samples from an RTL-2832 / E4000 usb dongle. I would like to learn how to decode an FM station to audio and attempt this project on simulink. How do I proceed with the IQ Samples towards decoding?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Treat this a  question from a DSP novice.&lt;/p&gt;&#xA;" OwnerUserId="842" LastActivityDate="2012-10-31T21:47:00.730" Title="Demodulating FM from IQ Samples using Simulink" Tags="|matlab|audio|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4876" PostTypeId="5" CreationDate="2012-11-01T03:09:20.003" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2012-11-01T03:09:20.003" LastActivityDate="2012-11-01T03:09:20.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4877" PostTypeId="4" CreationDate="2012-11-01T03:09:20.003" Score="0" Body="real-time refers to processing done with a strict set of time constraints in a deterministic manner. " OwnerUserId="842" LastEditorUserId="842" LastEditDate="2012-11-01T06:51:31.970" LastActivityDate="2012-11-01T06:51:31.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4878" PostTypeId="1" CreationDate="2012-11-01T04:59:13.337" Score="6" ViewCount="190" Body="&lt;p&gt;I've been reading some papers in the context of super resolution in imaging and video (for example works by Michal Irani: &lt;a href=&quot;http://www.cse.unr.edu/%7Ebebis/CS485/FinalPresPapers/ResolutionIrani.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Improving Resolution by Image Registration&lt;/a&gt;, &lt;a href=&quot;http://www.wisdom.weizmann.ac.il/%7Evision/SingleVideoSR/singleVideoSR.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Space Time Super Resolution from a Single Video&lt;/a&gt; and so forth), and was wondering if a similar idea can be applied with improving the temporal resolution of waveforms. In other words, if there are multiple recorders that are deterministically delayed from one another, will I be able to super-resolve in &lt;em&gt;time&lt;/em&gt; a waveform? was this done?&lt;/p&gt;&#xA;" OwnerUserId="2044" LastEditorUserId="128" LastEditDate="2023-02-24T09:29:43.930" LastActivityDate="2023-02-24T09:29:43.930" Title="Possibility of temporal super resolution" Tags="|time-frequency|supersampling|superresolution|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4879" PostTypeId="1" AcceptedAnswerId="38733" CreationDate="2012-11-01T06:23:27.320" Score="6" ViewCount="2537" Body="&lt;p&gt;I am currently working on a product (can't disclose too much details of the actual project) in which some data is being sent via audible (but on the higher freq) sound that is encoded with dqpsk.&lt;/p&gt;&#xA;&lt;p&gt;However, it gets very inaccurate at times since the receiver and the broadcaster do not have the same sampling windows. I am not trained academically for DSP and therefore I'm having a lot of problems finding out what the correct terms to search for are.&lt;/p&gt;&#xA;&lt;p&gt;Basically after a lot of debugging and simulation, I found that the most major issue is that the phase information gets more and more inaccurate as the output and the input get more out of sync... Are there some techniques to find the beginning of the actual signal in the samples? &lt;em&gt;The data isn't contained in just one sample window (they can span through quite a lot of windows)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;I would appreciate any sort of help, even if it is just some term I should use to search on Google.&lt;/p&gt;&#xA;&lt;p&gt;And on a separate note, when the timing is relatively accurate, I am already able to get the data properly decoded, so I am not really having much problem with the psk side.&lt;/p&gt;&#xA;" OwnerUserId="3209" LastEditorUserId="7092" LastEditDate="2024-02-29T11:50:34.203" LastActivityDate="2024-03-01T19:55:52.810" Title="Recovering signal for psk" Tags="|signal-detection|qpsk|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4880" PostTypeId="2" ParentId="4872" CreationDate="2012-11-01T10:28:37.793" Score="5" Body="&lt;p&gt;You're mixing together different things, so let's have a look at the big picture first.&#xA;For object detection / image matching, it's common to use a keypoint-based process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;detect-and-describe keypoints in your database / learning set&lt;/li&gt;&#xA;&lt;li&gt;(optional) sort your reference descriptors in an acceleration structure (e.g. kd-tree)&lt;/li&gt;&#xA;&lt;li&gt;detect-and-describe keypoints in your query image&lt;/li&gt;&#xA;&lt;li&gt;find the nearest neighbors of your query descriptors and your reference set.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The descriptors can be real (floating-points, e.g. SIFT/SURF) or binary (bit-strings, e.g. BRIEF, BRISK, FREAK).&#xA;Binary descriptors are obtained through a specific design process: the operations used to compute the descriptor are quite different from the operations involved in real descriptors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take the example of SIFT vs. BRIEF.&#xA;The SIFT descriptor is made of histograms of the image gradient directions in a patch centered on the keypoint.&#xA;The BRIEF descriptor can be modeled by a 2-step process: &#xA; 1. compute a real descriptor by computing the difference between small neighborhoods inside a patch centered on the keypoint&#xA; 2. binaries descriptor by retaining only the sign of the difference.&#xA;I have also described this process in &lt;a href=&quot;http://www.computersdontsee.net/index.php/post/2012/07/04/Linearized-model-of-LBPs&quot; rel=&quot;noreferrer&quot;&gt;a blog post&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So no, you can't just binarize a floating-point descriptor, you need to use a dedicated one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, it's up to you how you do the nearest neighbors queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In actual implementations, you may find some weird things about descriptor sizes.&#xA;The goal is t ensure that the size of a binary feature vector fits with hardware dedicated commands to compute Hamming distances in order to be very fast, and to allow the use of vectorized instructions such as SSE to compare different descriptors at the same time.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2012-11-01T10:28:37.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4881" PostTypeId="1" CreationDate="2012-11-01T16:01:20.973" Score="2" ViewCount="726" Body="&lt;p&gt;Lets say I have a program like Skype and I call to my friend. I want to create a test to figure out what is the average delay from the audio, from my mic to his speakers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to measure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;delay in one instance of time&lt;/li&gt;&#xA;&lt;li&gt;delay over longer period (60 s)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Assumptions that i can make:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;at least 8000 samples per second. &lt;/li&gt;&#xA;&lt;li&gt;devices are in the same room and network propagation delay is negligible.&lt;/li&gt;&#xA;&lt;li&gt;external mic and photo-detector/camera should be used.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3210" LastActivityDate="2012-11-01T18:38:07.383" Title="How to create a test to measure end to end audio delay" Tags="|audio|signal-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4882" PostTypeId="2" ParentId="4881" CreationDate="2012-11-01T16:57:34.493" Score="1" Body="&lt;p&gt;I recently ecountered this problem too (about a month ago). This is what I found..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Network delay measuring protocol (NDMP) - little useful free-ware program. I used the same program to measure other VoIP call delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can download it from here: &lt;a href=&quot;http://www.unforgettable.dk/42.zip&quot; rel=&quot;nofollow&quot;&gt;http://www.unforgettable.dk/42.zip&lt;/a&gt;&#xA;ReadMe file is included in .zip file.&lt;/p&gt;&#xA;" OwnerUserId="3212" LastActivityDate="2012-11-01T16:57:34.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4884" PostTypeId="2" ParentId="4881" CreationDate="2012-11-01T18:38:07.383" Score="0" Body="&lt;p&gt;We may use audio recording software like adobe audition for this purpose.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;We can use the stereo mix feature of windows to record the mic input and speaker output.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Start the recording software at both ends, and record some portion of your communication. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now compare some prominent portion like sudden jump in audio within this software. You will get approximate delay between these audio files.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1281" LastActivityDate="2012-11-01T18:38:07.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4885" PostTypeId="2" ParentId="4847" CreationDate="2012-11-01T21:45:09.510" Score="8" Body="&lt;p&gt;I have been in the &quot;in order to use well tested methods I would need an extensive database of examples which I don't have&quot; position in a very small company that &quot;couldn't afford it&quot;. I regret very much that I didn't simply do whatever was necessary to get as much such data as possible. I think it would have made a world of difference to them in the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any sort of real world vision detection has a million things you didn't think of until you tried it and it failed. It is an old problem many, many times more difficult than it appears. I would recommend sticking to newtons method of &quot;standing on the shoulders of giants&quot; (or, almost as good, on top of a large pile of dwarves). That is, use a method you already know works and is robust. All the stuff that sounds like it will be &quot;good enough&quot; instead will fail miserably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;State of the art in pedestrian &lt;strong&gt;detection&lt;/strong&gt; last I knew was HOG which was originally tested in exactly that setting. You want &lt;em&gt;tracking&lt;/em&gt; so you will need to play around in google scholar a bit to find that. Buy my main point is, I have been in a similar position and from that I would recommend you get your database, whatever you have to do, and use something you know works, which is already tested with a known failure rate, &lt;em&gt;not&lt;/em&gt; something that just sounds good. The 40 year death march of computer vision algorithms which &quot;sound like they will work&quot; is not something you want to be part of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Not trying to critisize computer vision. Its one of my favorite areas. But it's history suggests there are a thousand wrong steps to take and not very many right ones. Its better to follow someone who already found some of those right steps.&lt;/p&gt;&#xA;" OwnerUserId="566" LastEditorUserId="566" LastEditDate="2012-11-01T22:18:16.593" LastActivityDate="2012-11-01T22:18:16.593" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4886" PostTypeId="1" CreationDate="2012-11-02T01:12:21.877" Score="10" ViewCount="14961" Body="&lt;p&gt;I'm trying to find the zero crossings of a sine wave to transform the sine wave into a square wave. The only problem is that the sine wave is noisy, so I'm getting lots of jitter and false zero crossings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone recommend any simple psuedocode or relevant materials? So far I have something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt; if (sample[i]&gt;0 &amp;amp;&amp;amp; sample[i+1]&amp;lt;0) || (sample[i]&amp;lt;0 &amp;amp;&amp;amp; sample[i+1]&gt;0) &lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone recommend a more robust method?&lt;/p&gt;&#xA;" OwnerUserId="3214" LastActivityDate="2017-07-11T03:25:53.577" Title="Zero Crossing of a Noisy Sine Wave" Tags="|noise|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4887" PostTypeId="2" ParentId="4886" CreationDate="2012-11-02T01:50:23.687" Score="8" Body="&lt;p&gt;You could try low-pass filtering the input signal to get smoother zero-crossings (or even band-pass filtering if you have a good idea of the frequency location of the sine wave). The risk is that if sample-accurate phase information is essential to your application, the additional lag from the filter might be a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach: instead of trying to transform the sine wave into a square wave, what about getting an independent square wave oscillator to align itself in phase/frequency with the sine wave? This can be done with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-locked_loop&quot;&gt;phase-locked loop&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-02T01:50:23.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4888" PostTypeId="2" ParentId="4886" CreationDate="2012-11-02T02:27:22.107" Score="6" Body="&lt;p&gt;What you've shown certainly is a zero-crossing detector. A couple things come to mind that might improve your situation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have noise that is outside the band of your signal (which is almost certainly the case, since your input is a pure tone), then you can improve the signal-to-noise ratio by applying a bandpass filter around the signal of interest. The passband width of the filter should be chosen based on how precisely you know the sinusoid frequency &lt;em&gt;a priori&lt;/em&gt;. By reducing the amount of noise present on the sinusoid, the number of false zero crossings and their jitter about the correct crossing times will be reduced.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;As a side note, if you don't have good information ahead of time, you could use a more sophisticated technique known as an &lt;em&gt;adaptive line enhancer&lt;/em&gt;, which, as its name implies, is an adaptive filter that will enhance a periodic input signal. However, this is a somewhat advanced topic, and you typically have a good enough idea of your signal's frequency that this sort of approach isn't needed.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With respect to the zero-crossing detector itself, you might add some &lt;a href=&quot;http://en.wikipedia.org/wiki/Hysteresis&quot;&gt;hysteresis&lt;/a&gt; to the process. This would prevent the generation of extra spurious measured crossings around the correct crossing instant. Adding hysteresis to the detector might look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if ((state == POSITIVE) &amp;amp;&amp;amp; (sample[i - 1] &amp;gt; -T) &amp;amp;&amp;amp; (sample[i] &amp;lt; -T))&#xA;{&#xA;    // handle negative zero-crossing&#xA;    state = NEGATIVE;&#xA;}&#xA;else if ((state == NEGATIVE) &amp;amp;&amp;amp; (sample[i - 1] &amp;lt; T) &amp;amp;&amp;amp; (sample[i] &amp;gt; T))&#xA;{&#xA;    // handle positive zero-crossing&#xA;    state = POSITIVE;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Effectively, you add some state to your zero-crossing detector. If you believe the input signal to have a positive value, you require that the signal dip down below a chosen threshold value &lt;code&gt;-T&lt;/code&gt; in order to declare a real zero crossing. Likewise, you require that the signal rise back up above the threshold &lt;code&gt;T&lt;/code&gt; in order to declare that the signal has oscillated back to positive again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could choose the thresholds to be whatever you want, but for a balanced signal like a sinusoid, it makes sense to have them be symmetric about zero. This approach can help give you a cleaner-looking output, but it will add some time delay due to the fact that you're actually measuring non-zero threshold crossings instead of zero crossings.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As pichenettes suggested in his answer, a phase-locked loop would be most likely the best way to go, as a PLL does pretty much exactly what you're trying to do. In short, you run a square wave generator that runs in parallel with the input sinusoid. The PLL makes periodic phase measurements on the sinusoid, then filters that stream of measurements in order to steer the instantaneous frequency of the square wave generator. At some point, the loop will (hopefully) lock, at which point the square wave should be locked in frequency and phase with the sinusoid of the input (with some amount of error, of course; nothing in engineering is perfect).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-11-02T02:27:22.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4889" PostTypeId="1" CreationDate="2012-11-02T06:59:36.930" Score="14" ViewCount="54891" Body="&lt;p&gt;I am having problems in understanding how to do it practically&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a wav file that contains pure speech and another ave file that just contains the background noise (can be various things, such as white noise, crowd noise, a recording of blowing wind, etc). These are either purely speech or purely noise. So I suppose I can get an SNR value from them by simple division of corresponding samples (or the average of a frame of samples) in both files. I then combine them in audacity to get a noisy speech file. I am guessing this file will still have the same SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I pass this file through my noise reduction program and get another file as a result. How do I calculate the SNR of this &quot;noise reduced&quot; file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- EDIT ---&lt;/p&gt;&#xA;&#xA;&lt;p&gt;follow-up question posted &lt;a href=&quot;https://dsp.stackexchange.com/questions/5951/snr-calculation-confusion&quot;&gt;HERE&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3121" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-07-19T21:39:08.207" Title="how do I calculate SNR of noisy signal?" Tags="|matlab|snr|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4890" PostTypeId="2" ParentId="4889" CreationDate="2012-11-02T08:30:42.783" Score="8" Body="&lt;p&gt;The common definition of SNR is the power of the wanted signal divided by the noise power. Suppose you have obtained the wanted and the noise signal as arrays, calculation of the SNR in Matlab before noise reduction can be done like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;snr_before = mean( signal .^ 2 ) / mean( noise .^ 2 );&#xA;snr_before_db = 10 * log10( snr_before ) % in dB&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After noise reduction, the residual noise can be calculated as the difference of the wanted signal and the actual signal. Calculation of SNR is then straightforward:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;residual_noise = signal - noise_reduced_signal; &#xA;snr_after = mean( signal .^ 2 ) / mean( residual_noise .^ 2 ); &#xA;snr_after_db = 10 * log10( snr_after )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2012-11-02T08:30:42.783" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="4891" PostTypeId="1" AcceptedAnswerId="4896" CreationDate="2012-11-02T09:51:42.850" Score="4" ViewCount="2463" Body="&lt;p&gt;I have got a signal which consists of zero crossings over discrete time and I would like to estimate the fundamental frequency (period) from this signal in order to remove noisy samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal is about 500 to 1500 samples long and has about 10-50 zero crossings, e.g. x[93] = 0; x[183] = 0; x[244]; x[282]; x[310]; x[439]; x[502]; x[515]; x[570]; x[590]; x[640]; x[635]; x[650]; x[710]; x[740]; x[835]; x[850]; x[905]; x[915]; x[980]; x[1050]; x[1110];&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output should be zero crossings again or their fundamental period, but without the &quot;noise&quot;. I'm only interested in the position of the &quot;new&quot; zero crossings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also not quite sure, how to model a zero-crossing signal for further processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any ideas.&lt;/p&gt;&#xA;" OwnerUserId="3215" LastActivityDate="2012-11-02T20:52:35.930" Title="Determine fundamental period from zero crossing signal" Tags="|discrete-signals|frequency|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="4892" PostTypeId="2" ParentId="4889" CreationDate="2012-11-02T16:17:38.107" Score="3" Body="&lt;p&gt;On the input side:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate DB1 = 10*log10(var(noiseSignal))&lt;/li&gt;&#xA;&lt;li&gt;Calculate DB2 = 10*log10(var(cleanSpeechSignal))&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The SNR is = DB2 - DB1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the output side:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Send the clean speech signal through your noise suppression algo. Denote the output Y1.&lt;/li&gt;&#xA;&lt;li&gt;Send the noisy speech signal through your noise suppression algo. Denote that output Y2.&lt;/li&gt;&#xA;&lt;li&gt;Calculate Z = Y2 - Y1&lt;/li&gt;&#xA;&lt;li&gt;residualNoiseDB = 10 * log10(var(Z))&lt;/li&gt;&#xA;&lt;li&gt;speechDB = 10*log10(var(Y1))&lt;/li&gt;&#xA;&lt;li&gt;SNR = speechDB - residualNoiseDB&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3182" LastActivityDate="2012-11-02T16:17:38.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4893" PostTypeId="1" CreationDate="2012-11-02T16:37:14.313" Score="17" ViewCount="20917" Body="&lt;p&gt;Can you list some scale and rotational invariant feature descriptors for use in feature detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The application is for the detection of cars and humans in video captured by a UAV, using a multi-class classifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have been looking at SIFT and MSER (which is affine invariant). I have also looked at LESH, LESH is based on the local energy model, but is calculated in a way that is not rotationally invariant, I have been trying to think of a way to make use of the Local energy, to build a rotationally invariant feature descriptor, I read here &lt;a href=&quot;https://dsp.stackexchange.com/questions/1288/what-are-some-free-alternatives-to-sift-surf-that-can-be-used-in-commercial-app&quot;&gt;What are some free alternatives to SIFT/ SURF that can be used in commercial applications?&lt;/a&gt; ,that &quot; if you assign orientation to the interest point and rotate the image patch accordingly, you get rotational invariance for free&quot;, but don't know if this is even relievent or how i could apply this to my problem, any help would be appreciated, thanks&lt;/p&gt;&#xA;" OwnerUserId="3217" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2018-08-25T00:46:13.523" Title="Scale and Rotation invariant feature descriptors" Tags="|computer-vision|local-features|classification|object-recognition|sift|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4894" PostTypeId="2" ParentId="4893" CreationDate="2012-11-02T17:09:54.323" Score="11" Body="&lt;p&gt;As far as alternatives to SIFT/SURF go, the &lt;a href=&quot;https://dsp.stackexchange.com/q/1288/1273&quot;&gt;question you linked&lt;/a&gt; provides very good answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There were two more questions I could read out:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;how could I build a useful (e.g. rotation invariant) feature descriptor&quot;?&lt;/li&gt;&#xA;&lt;li&gt;&quot;regarding the statement from the linked question, how does he accomplish free rotational invariance?&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Building feature descriptors&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a valid research topic. Good feature descriptors are not something just anyone can build in an afternoon. People publish articles when they successfully model feature descriptors with desirable properties. This is a reason that currently only a handful of state-of-the-art descriptors are used, and that is also what I advise you to do: &lt;em&gt;find a feature descriptors that's good for your needs&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Achieving rotational invariance &quot;for free&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can determine the &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_gradient&quot; rel=&quot;nofollow noreferrer&quot;&gt;dominant gradient&lt;/a&gt;, or orientation at an image patch (your feature area). Then, &lt;em&gt;rotate the image patch&lt;/em&gt; so that the gradient is always looking in the same direction, e.g $0$ (upwards). E.g. if you had a &lt;code&gt;|black-&amp;gt;gray-&amp;gt;white|&lt;/code&gt; and a &lt;code&gt;|white-&amp;gt;gray-&amp;gt;black|&lt;/code&gt; image, their dominant gradients would be pointing left ($-90$) and right ($90$) respectively, and when you rotate them by this amount, you get the same images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way you will always calculate the descriptor on an image patch with the same dominant orientation (the rotated patch), and thus you achieve rotational invariance.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-11-02T17:09:54.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4895" PostTypeId="2" ParentId="4893" CreationDate="2012-11-02T19:01:11.430" Score="5" Body="&lt;p&gt;Another way to get rotational invariance for free, is to choose objects that are rotationally invariant. For instance, a circle or a ring is invariant to rotations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Feature extractor&lt;/strong&gt;: Run edge detection. For each neighborhood of &lt;code&gt;NxN&lt;/code&gt; pixels, calculate edge direction and magnitude 2D histogram. Find all points that have high total magnitude, and &lt;a href=&quot;http://en.wikipedia.org/wiki/Directional_statistics#Examples_of_circular_distributions&quot; rel=&quot;nofollow noreferrer&quot;&gt;high angular spread&lt;/a&gt; . Remove all points that don't have radial symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Feature descriptor&lt;/strong&gt;: Find the center of each circular object. Since the object is circular, it has no dominant gradient angle. All angles are equal. Thus, a radial profile (sum of pixel value in polar coordinates) is an angle invariant descriptor.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;By the way, that is one of the reasons that fiducials are manufactured as circles on electric circuit boards:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S6NXB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-11-07T22:16:14.997" LastActivityDate="2012-11-07T22:16:14.997" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="4896" PostTypeId="2" ParentId="4891" CreationDate="2012-11-02T20:52:35.930" Score="2" Body="&lt;p&gt;In general, you can not determine period of a signal from just the zero crossings.  If the signal has harmonic content, then a pitch detection/estimation algorithm, such as autocorrelation, might be one solution.  If the signal is more spectrally pure (e.g. close to sinusoidal fundamental, little overtone or harmonic energy), then a suitable DSP band-pass filter applied before locating the zero-crossings may help get rid of &quot;noisy&quot; samples.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-11-02T20:52:35.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4897" PostTypeId="2" ParentId="4873" CreationDate="2012-11-02T22:46:40.117" Score="1" Body="&lt;p&gt;I guess what you want to do is similar to image resize. If so, then multiple build-in functions in MATLAB can be used for this purpose, for example &lt;strong&gt;imresize&lt;/strong&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2012-11-02T22:46:40.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4898" PostTypeId="2" ParentId="4743" CreationDate="2012-11-02T23:22:26.297" Score="3" Body="&lt;p&gt;Jbarlow's answer is excellently derived but misses a major issue: Almost all of the &quot;better&quot; surround sound decoders such as Dolby Prologic, DTS Neo 6, Lexicon, Bose Videostage are &quot;dynmaic&quot;, i.e. they looks constantly at the signal conditions and adjust the decoding matrix in the fly based on an estimate what the original signals may have been.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main problem here is that the encoder is &quot;lossy&quot;, i.e. a lot of information is lost during the encoding process and you can't fully recover the original signal. A simple example: let's say you start a &quot;left&quot; signal. That encodes to Lt = 1 and Rt = 0. Decoding this again then leads to signal in all five channels and not just in the left like the original condition. The only way around this is to dynamically look at correlation and panning of the input signals and adjust the decoder matrix on the fly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, while jbarlow's equations are mathematically correct, it's typically not done this way, even if it's only a static decoder. The main issue is that this creates side to side cross talk, i.e. signals that where original in the left front can end up partially in the right front which highly undesirable from a perceptual point of view. What's typically used is roughly something like this (properly normalized that is)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L= Lt, R = Rt;&#xA;C = .707*Lt + .707Rt;&#xA;Ls = .6*Lt - .3*Rt;&#xA;Rs = .6*Rt - 0.3 *Lt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In practice most people also don't bother with the Hilbert Transformer since most encoders that do a real time downmix (such as Blu ray players, set top boxes, or TVs) don't implement it in anyway.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-11-02T23:22:26.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4899" PostTypeId="2" ParentId="4670" CreationDate="2012-11-03T06:39:58.237" Score="0" Body="&lt;p&gt;What I can suggest is the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Chop of the image at certain sections. You know where the base is, that is where the blue line reside. Chop of the image from there. If you can safely remove the bottom which is not required&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Using Hough Transform, detect the horizontal and vertical lines of the image. Sort of the largest lines. And then remove them from the image. You should be now left with some clean image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- Either now find the contours of the image and see which contour now resides closest to the bottom of the image. This will ensure that your object of interest was close to the base. Or Find all the contours and remove the small ones of some predefined size and then look for the contours which lies near the base. Contours are always directional and in clock wise direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4- Or another way now is to start from the left yellow box and keep on tra&lt;/p&gt;&#xA;" OwnerUserId="1215" LastActivityDate="2012-11-03T06:39:58.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4900" PostTypeId="2" ParentId="4893" CreationDate="2012-11-03T15:33:31.597" Score="1" Body="&lt;p&gt;You can also check &lt;a href=&quot;http://www.edwardrosten.com/work/fast.html&quot; rel=&quot;nofollow&quot;&gt;FAST&lt;/a&gt; and &lt;a href=&quot;http://www.asl.ethz.ch/people/lestefan/personal/BRISK&quot; rel=&quot;nofollow&quot;&gt;BRISK&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-11-03T15:33:31.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="4901" PostTypeId="1" AcceptedAnswerId="4903" CreationDate="2012-11-04T01:09:08.107" Score="3" ViewCount="459" Body="&lt;p&gt;If you circularly shift a signal x[n]= [&lt;strong&gt;-3&lt;/strong&gt; -2 -1 0 1 2 3 2 1 0 -1 -2 ] to the right by M=1 compared to M=2, the phase spectra has a lot many zeros when M=2 compared to M=1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here, I am talking about Circular Time shifting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that if x[n] is even, then DFT is purely real and hence phase is zero. However, why are there way many more zeros when M=2 compared to M=1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3222" LastActivityDate="2012-11-04T22:57:15.013" Title="Circular Time Delay in signal, effect on phase spectra of DFT" Tags="|dft|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4902" PostTypeId="2" ParentId="3481" CreationDate="2012-11-04T01:22:03.980" Score="6" Body="&lt;p&gt;First, your supposed 'radix-4 butterfly' is a 4 point DFT, not an FFT.  It has 16 complex (ie: N squared) operations.  A typical 4 point FFT would have only Nlog(base 2)N (= 8 for N = 4).  Second, you have some supposed w[ ].r and w[ ].i 'scale' factors that don't belong.  Perhaps you obtained them from a radix-4 butterfly shown in a larger graph.  Such a butterfly would have some interstage twiddles appended to it, but they are not actually part of the butterfly.  A 4 point FFT only has an internal butterfly of -j when designed for a negative exponent FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than try to fix your code, it's just as easy to write my own, as shown below (DevC++ compiler; outputs appended at end of code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;cstdio&amp;gt;&#xA;#include &amp;lt;cstdlib&amp;gt;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;#include &amp;lt;cmath&amp;gt;&#xA;using namespace std;&#xA;void fft4(double* r, double* i);    // prototype declaration&#xA;int main (int nNumberofArgs, char* pszArgs[ ] ) { // arguments needed for Dev C++ I/O&#xA;&#xA;double r[4] = {1.5, -2.3, 4.65, -3.51}, i[4] = {-1.0, 2.6, 3.75, -2.32} ;&#xA;long n, k, j;      double  yr[4] = {0.}, yi[4] = {0.};&#xA;double ang, C, S, twopi = 6.2831853071795865;&#xA;&#xA;cout&amp;lt;&amp;lt;&quot;\n original real/imag data&quot;;&#xA;cout&amp;lt;&amp;lt;&quot;\n n         r[n]            i[n]\n&quot;;&#xA;for (n = 0; n &amp;lt; 4; n++)  {&#xA;    printf(&quot;%2d\t%9.4f\t%9.4f\n&quot;,n,r[n],i[n]);&#xA;} //end for loop over n&#xA;&#xA;// 4 point DFT&#xA;for (k = 0; k &amp;lt; 4; k++) {&#xA;    ang = twopi*k/4;&#xA;    for (j = 0; j &amp;lt; 4; j++) {&#xA;        C = cos(j*ang);       S = sin(j*ang);&#xA;        yr[k] = yr[k] + r[j]*C + i[j]*S;   // ( C - jS )*( r + ji )&#xA;        yi[k] = yi[k] + i[j]*C - r[j]*S;   // = ( rC + iS ) + j( iC - rS )&#xA;    }&#xA;}&#xA;&#xA;cout&amp;lt;&amp;lt;&quot;\n 4 point DFT results&quot;;&#xA;cout&amp;lt;&amp;lt;&quot;\n n         yr[n]           yi[n]           amplitude       phase(radians)\n&quot;;&#xA;double amp, phase;&#xA;for (n = 0; n &amp;lt; 4; n++)  {&#xA;    yr[n] = yr[n]/4 ;      yi[n] = yi[n]/4 ;  // scale outputs&#xA;    amp = sqrt( yr[n]*yr[n] + yi[n]*yi[n] ) ;&#xA;    phase = atan2( yi[n], yr[n] ) ; &#xA;    printf(&quot;%2d\t%9.4f\t%9.4f\t%9.4f\t%9.4f\n&quot;,n,yr[n],yi[n],amp,phase);&#xA;} //end for loop over n&#xA;&#xA;fft4(r, i) ;&#xA;&#xA;cout&amp;lt;&amp;lt;&quot;\n 4 point FFT results&quot;;&#xA;cout&amp;lt;&amp;lt;&quot;\n n         r[n]            i[n]            amplitude       phase(radians)\n&quot;;&#xA;&#xA;for (n = 0; n &amp;lt; 4; n++)  {&#xA;    r[n] = r[n]/4 ;      i[n] = i[n]/4 ;  // scale outputs&#xA;    amp = sqrt( r[n]*r[n] + i[n]*i[n] ) ;&#xA;    phase = atan2( i[n], r[n] ) ; &#xA;    printf(&quot;%2d\t%9.4f\t%9.4f\t%9.4f\t%9.4f\n&quot;,n,r[n],i[n],amp,phase);&#xA;} //end for loop over n&#xA;&#xA;fft4(i, r); // this is an inverse FFT (complex in/out routine)&#xA;&#xA;cout&amp;lt;&amp;lt;&quot;\n 4 point inverse FFT results&quot;;&#xA;cout&amp;lt;&amp;lt;&quot;\n n         r[n]            i[n]\n&quot;;&#xA;for (n = 0; n &amp;lt; 4; n++)  {&#xA;    printf(&quot;%2d\t%9.4f\t%9.4f\n&quot;,n,r[n],i[n]);&#xA;} //end for loop over n&#xA;&#xA;system (&quot;PAUSE&quot;);&#xA;return 0;&#xA;} // end main&#xA;//************************ fft4 **********&#xA;void fft4(double* r, double* i) {&#xA;double t;&#xA;&#xA;t = r[0]; r[0] = t + r[2]; r[2] = t - r[2];&#xA;t = i[0]; i[0] = t + i[2]; i[2] = t - i[2];&#xA;t = r[1]; r[1] = t + r[3]; r[3] = t - r[3];&#xA;t = i[1]; i[1] = t + i[3]; i[3] = t - i[3];&#xA;&#xA;t = r[3]; r[3] = i[3]; i[3] = -t; // (r + ji)*(-j)&#xA;&#xA;t = r[0]; r[0] = t + r[1]; r[1] = t - r[1];&#xA;t = i[0]; i[0] = t + i[1]; i[1] = t - i[1];&#xA;t = r[2]; r[2] = t + r[3]; r[3] = t - r[3];&#xA;t = i[2]; i[2] = t + i[3]; i[3] = t - i[3];&#xA;&#xA;t = r[1]; r[1] = r[2]; r[2] = t;  // swap 1&#xA;t = i[1]; i[1] = i[2]; i[2] = t;  //  and 2&#xA;} // end fft4&#xA;&#xA;&#xA;&#xA;&#xA; original real/imag data&#xA; n         r[n]            i[n]&#xA; 0         1.5000         -1.0000&#xA; 1        -2.3000          2.6000&#xA; 2         4.6500          3.7500&#xA; 3        -3.5100         -2.3200&#xA;&#xA; 4 point DFT results&#xA; n         yr[n]           yi[n]           amplitude       phase(radians)&#xA; 0         0.0850          0.7575          0.7623          1.4591&#xA; 1         0.4425         -1.4900          1.5543         -1.2821&#xA; 2         2.9900          0.6175          3.0531          0.2037&#xA; 3        -2.0175         -0.8850          2.2031         -2.7282&#xA;&#xA; 4 point FFT results&#xA; n         r[n]            i[n]            amplitude       phase(radians)&#xA; 0         0.0850          0.7575          0.7623          1.4591&#xA; 1         0.4425         -1.4900          1.5543         -1.2821&#xA; 2         2.9900          0.6175          3.0531          0.2037&#xA; 3        -2.0175         -0.8850          2.2031         -2.7282&#xA;&#xA; 4 point inverse FFT results&#xA; n         r[n]            i[n]&#xA; 0         1.5000         -1.0000&#xA; 1        -2.3000          2.6000&#xA; 2         4.6500          3.7500&#xA; 3        -3.5100         -2.3200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First, the input data (4 real, 4 imaginary) is printed out.  Then a 4 point DFT is taken.  The results (yr[ ] and yi[ ] plus amp/phase) are printed out.  Since the r[ ] and i[ ] original data were not overwritten when doing the DFT, those inputs are reused as inputs to the 4 point FFT.  Note that the latter has fewer +/- operations than the DFT.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code for the FFT is not particularly elegant nor efficient – there are many ways of doing butterflies.  The code above corresponds to the four radix-2 butterflies shown in Rabiner and Gold's book “Theory and Application of Digital Signal Processing” (p. 580, Fig. 10.9), with twiddles modified to reflect a negative exponent (the ones used for the figure in the book were positive).  Note that there is only one twiddle of -j in the code, and this does not require a multiply (it's a swap/sign change).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the FFT, the results are printed.  They're the same as the DFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally, the scaled results from the FFT are used as inputs to an inverse FFT.  This is accomplished via the 'exchange' or 'reverse the list' method (ie: if FFT(r,i) is a forward FFT, then FFT(i,r) is an inverse – provided, of course, that the FFT is capable of handling complex inputs/outputs – in other words – no 'real only' routines, which usually presume that imaginary inputs are zero).  This method was described nearly 25 years ago in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P. Duhamel, B. Piron, J. M. Etcheto, “On Computing the Inverse DFT,” IEEE Transactions&#xA;on Acoustics, Speech and Signal Processing, vol. 36, Feb. 1988, pp. 285-286.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of the inverse is then printed out.  It is the same as the original input data.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2012-11-04T01:22:03.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4903" PostTypeId="2" ParentId="4901" CreationDate="2012-11-04T16:26:32.690" Score="3" Body="&lt;p&gt;If by phase spectrum you mean the sequence $$\bigr(\angle X[0], \angle X[1], \angle X[2], \ldots, \angle X[N-1]\bigr),$$ then remember that a circular shift&#xA;by $M$ in the time domain results in each $X[n]$ being multiplied by $\exp(-j2\pi Mn/N)$, and thus causes a change in $\angle X[n]$; in particular, $\angle X[n]$&#xA;&lt;em&gt;decreases&lt;/em&gt; by $2\pi Mn/N$.  For the case $M=1$, the multipliers are distinct $N$-th roots of unity, that is, the &lt;strong&gt;changes in phase&lt;/strong&gt; are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Bigr(0, 2\pi\frac{1}{N}, 2\pi\frac{1}{N}, \ldots, 2\pi\frac{N-1}{N}\Bigr)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all of which are different numbers.  Thus, each entry in the phase &#xA;spectrum changes (except for the entry for $n=0$). For the case $M=2$ and $N=12$, the multipliers are $\exp(-j2\pi 2n/12) = \exp(-j2\pi n/6)$ and so the &lt;strong&gt;changes in phase&lt;/strong&gt; are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Bigr(0, 2\pi\frac{1}{6}, 2\pi\frac{2}{6}, \ldots, 2\pi\frac{5}{6},&#xA;2\pi\frac{6}{6}, 2\pi\frac{7}{6}, \ldots 2\pi\frac{11}{6}\Bigr)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But a phase change of $2\pi\frac{6}{6} = 2\pi$ is the same as &#xA;&lt;strong&gt;no phase change,&lt;/strong&gt; a phase change of $2\pi\frac{7}{6}$ is the same&#xA;as a phase change of $2\pi\frac{1}{6}$, and so on.  So the displayed&#xA;vector above of phase changes is actually &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Bigr(0, 2\pi\frac{1}{6}, 2\pi\frac{2}{6}, \ldots, 2\pi\frac{5}{6},&#xA;0, 2\pi\frac{1}{6}, \ldots 2\pi\frac{5}{6}\Bigr)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is two periods of a sequence of period $6$.  Note&#xA;each entry in the phase spectrum changes &lt;em&gt;except&lt;/em&gt; for $n=0$ and&#xA;$n=6$ which do  not change. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose that each $X[n]$ is a real number and thus the phase spectrum&#xA;is $0$ everywhere. Then, if you circularly shift by &lt;em&gt;one&lt;/em&gt; place ($M=1$ in the&#xA;time domain, &lt;strong&gt;all&lt;/strong&gt; entries in the phase spectrum will be nonzero&#xA;&lt;em&gt;except&lt;/em&gt; for the $n=0$ entry.  If instead you circularly shift by&#xA;&lt;em&gt;two&lt;/em&gt; places ($M=2$) in the time domain, the phase spectrum will have zeroes in&#xA;both the $n=0$ and $n=6$ entries.  Note also that $\exp(-j\pi = -1$,&#xA;and so for $M=1$, $X[0]$ and $X[6]$ will still be &lt;em&gt;real-valued&lt;/em&gt; (though&#xA;there &lt;em&gt;will&lt;/em&gt; have been a phase change of $\pi$ in $X[6]$) and similarly, for&#xA;$M=2$, $X[0], X[3], X[6]$, and $X[9]$ will still remain real-valued&#xA;though there will have been a phase change of $\pi$ in $X[3]$ and $X[9]$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-11-04T22:57:15.013" LastActivityDate="2012-11-04T22:57:15.013" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="4904" PostTypeId="1" CreationDate="2012-11-04T20:16:01.797" Score="3" ViewCount="6936" Body="&lt;p&gt;I am trying to build a model for speaker identification, and I understand that the first step is to extract the features from the audio signals that are in my database. I have done quite a bit of research and cant find how to do this extraction and to which features. How do I select which features to extract to? what would be the algorithm? Can someone please point me to either an algorithm that I could implement or a sample matlab code? &lt;/p&gt;&#xA;" OwnerUserId="1468" LastActivityDate="2018-01-26T22:55:12.907" Title="algorithm for feature extraction from audio signals" Tags="|matlab|audio|algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4905" PostTypeId="2" ParentId="4904" CreationDate="2012-11-04T22:07:56.273" Score="3" Body="&lt;p&gt;For speaker recognition, the features you should probably start with are &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel-frequency_cepstrum&quot; rel=&quot;nofollow&quot;&gt;MFCC&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are libraries offering MFCC extraction modules, such as &lt;a href=&quot;http://yaafe.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;YAAFE&lt;/a&gt;, &lt;a href=&quot;http://aubio.org/&quot; rel=&quot;nofollow&quot;&gt;aubio&lt;/a&gt; (C/C++), the MIR toolbox or Dan Ellis' &lt;a href=&quot;http://www.ee.columbia.edu/ln/rosa/matlab/rastamat/&quot; rel=&quot;nofollow&quot;&gt;implementation&lt;/a&gt; (Matlab) - and of course speech recognition frameworks (Sphinx, HTK) provides MFCC extraction tools.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-04T22:07:56.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="4906" PostTypeId="1" AcceptedAnswerId="5907" CreationDate="2012-11-05T10:37:16.110" Score="1" ViewCount="84" Body="&lt;p&gt;I need to the find the inverse continuous time Fourier transform for unitary angular frequency of the following signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$e^{a\omega^2 - b\omega + c}$ where $a$ and $b$ and $c$ are real numbers and I want to find the corresponding time-domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to get the $e^{a\omega^2 + c}$ term transformed, but I was unable to find a transform for $e^{- b\omega}$ that didn't result in a distribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without doing math and looking at the symmetry, I want to say that the $e^{- b\omega}$ term does a complex time shift, but now my mind hurts. Can somebody look up the identity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--edit--&#xA;This spectrum doesn't need to be symmetric, or causal, so expecting some solutions to have imaginary time could be correct. Can somebody comment on this? &lt;/p&gt;&#xA;" OwnerUserId="941" LastEditorUserId="941" LastEditDate="2012-11-06T05:18:14.390" LastActivityDate="2012-11-06T05:18:14.390" Title="Need an Identity for CTFT Polynomial Raised to an Exponent" Tags="|fourier-transform|continuous-signals|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="4907" PostTypeId="1" CreationDate="2012-11-05T21:22:48.740" Score="1" ViewCount="153" Body="&lt;p&gt;The challenge I'm looking at is to design an iPhone component that listens to microphone input and triggers when it hears a particular blip (preferably &amp;lt; 0.1sec duration).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can design the blip myself, and also false positives are okay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key constraint is that the listener is lightweight, so it doesn't drain CPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest a mechanism, or point me in a good direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:  this is as far as I have got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should be feeding audio into a ~1s buffer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the first check may throw up lots of false positives,  but this allows a second check to delve into the one second history and determine whether it was indeed a false positive or a valid blip.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the first check may just be listening for the presence of a particular frequency sustained over 0.1s&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to do this I could feed incoming audio into a 100 sample (for example) ring buffer,  and then, 50 times per second multiply the ring-data by a sine wave (giving x) and cosine wave (giving y), effectively manually calculating a single FFT bin x+iy.  then I could flag whenever the phase remains roughly constant over three frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or maybe I could use 3 such rings,  length 99, 100, 101 samples.   and monitor the amount of energy getting accumulated in each;  if the 100-sample-ring wins and the neighbours are roughly balanced, that would be an indicator that the 100-ring's resonant frequency has been detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but this approach would require feeding all audio data into three rings. it isn't  particularly lightweight...  maybe I could only feed one in 17 (say) samples into each ring, throwing away the other 16.   As 17 is co-prime with 99,100,101  it would fill all cells of the ring before overwriting the first again.&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2012-11-06T13:09:04.133" Title="Lightweight audio listener for detecting blip" Tags="|fft|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5907" PostTypeId="2" ParentId="4906" CreationDate="2012-11-05T21:44:52.253" Score="3" Body="&lt;p&gt;Dilip's idea is an excellent suggestion. Let me slightly modify it. You can rewrite&#xA;$$a\omega ^{2}-b\omega +c = a(\omega -\omega_{0} )^{2}+d$$&#xA;So the whole thing can be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{d}\cdot e^{a(\omega -\omega_{0} )^{2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's essentially a Gaussian shifted in frequency with a constant scale factor. The transform of a Gaussian is just another Gaussian and the shift in one domain corresponds to multiplication with a complex exponential in the other domain so the inverse ought to look something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = k\cdot e^{\tilde{a}t^{2}}\cdot e^{j\omega _{0}t}$$&#xA;where $k$, $\tilde{a}$, and $\omega _{0}$ are determined by the original a, b, and c. a better be a negative number, though, otherwise I don't think that the transform would be convergent.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-11-05T21:44:52.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5908" PostTypeId="2" ParentId="4907" CreationDate="2012-11-05T21:52:56.893" Score="3" Body="&lt;p&gt;One lighter-weight approach might be to use a narrow-band IIR filter centered at your blip frequency, rectify or square, feed this result to a low-pass filter, and look for a value passing some threshold.  A Goertzel filter is another possibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the most current iOS Accelerate framework includes a reportedly power-efficient biquad IIR filtering function.  Also note that on recent iOS devices, even a more heavyweight approach (FFTs, autocorrelation, and such) on a single channel of real-time audio input might use only a tiny percentage of total device power.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-11-05T21:52:56.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5909" PostTypeId="1" AcceptedAnswerId="5910" CreationDate="2012-11-05T21:57:01.097" Score="0" ViewCount="499" Body="&lt;p&gt;I'm developing a singing game and I want to output player's voice through speakers. I'm using portaudio for that, I acquire the input signal and just write it to the output buffer. The problem is the voice is bare audible. I tried to write to output buffer multiplying by a constant but that distorted the voice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1145" LastActivityDate="2012-11-05T22:42:35.987" Title="How to amplify sound wave" Tags="|discrete-signals|sound|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5910" PostTypeId="2" ParentId="5909" CreationDate="2012-11-05T22:42:35.987" Score="1" Body="&lt;p&gt;The first and best solution is to increase the input gain which should be possible on most platforms. If not, then read on...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If multiplying by a constant caused distortion then either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;it is too loud and distortion is inevitable (barring what I'll just call &quot;fancy&quot; signal processing)&lt;/li&gt;&#xA;&lt;li&gt;you are doing something wrong.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'll assume #2 since you started with the case of &quot;barely audible&quot;, and you should learn how to apply gain before doing anything &quot;fancy&quot; anyway. To apply gain, make sure you multiply each sample individually by the same constant. Remember that the sample count = frames * channels. Loop through each each sample in the buffer and multiply it by the gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this case, you probably want to use the float datatype in PortAudio, but any type will work.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-11-05T22:42:35.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5911" PostTypeId="1" CreationDate="2012-11-06T03:21:19.093" Score="3" ViewCount="72" Body="&lt;p&gt;This is more of a soft question, I am currently writing a paper for my Master's in Mathematics and my topic of choice has been to focus on the Mathematical techniques behind Spectrum Analysis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my initial reading I have focused on Kay &amp;amp; Marple's paper Spectrum Analysis- A Modern Perspective, however &quot;modern&quot; in this context is relative to 1981.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if anybody was aware of paper's published in the last few years (2005-onwards) which dealt with more recent developments. Currently I am focusing on Prony and ARMA techniques, with a contrast to Wavelets. However as I am hopefully going to be receiving actual experimental data (analyzing output of power from a laser) I would like to have access to a range of current ideas to analyse the data and present a contrast. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally i am looking for papers that give a treatment of the mathematical concepts behind the techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: I have been searching IEEE etc, and have a large variety of papers but i was hoping that i could be pointed towards good quality papers before i attempt to read them all to discover which are more helpful.&lt;/p&gt;&#xA;" OwnerUserId="1013" LastActivityDate="2012-11-06T03:21:19.093" Title="Recent Papers on Spectrum analysis" Tags="|reference-request|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5912" PostTypeId="1" AcceptedAnswerId="5914" CreationDate="2012-11-06T05:12:38.890" Score="2" ViewCount="6415" Body="&lt;p&gt;I am working on noise reduction and I need to learn how to analyze spectrograms&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mixed a pure speech file with violet noise in audacity and got the following spectrograms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab version&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I8I2a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sonogram version: (&lt;a href=&quot;http://www.makeuseof.com/tag/hand-voice-recognition-sonogram-visible-voice-tool/&quot; rel=&quot;nofollow noreferrer&quot;&gt;enter link description here&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Usf1Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrogram view in Audacity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SQOxk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do all the colours mean and why do they look different? Shouldn't everything have the same colours as in the Matlab version? Or are the exact colours not that important, since the darker pattern at the bottom of each figure still look similar in all of them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- EDIT :: Further additions: ---&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of the spectrogram of noisy speech as well as output of my noise reduced sound file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nLfwO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one on the left is noisy signal while one on the right is the one passed through the noise reduction algorithm. Both figures are plotted through the spectrogram function of matlab, called as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;spectrogram(data, hanning(128), 64, 128, 16000)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number 16000 is the Fs value (sampling frequency) returned by the wavread function used to read in the original noisy speech file into matlab. The sound file is a male adult speaking, mixed with violet noise in audacity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- EDIT 2: ---&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, here is the same thing in gray-scale, if it helps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hxDug.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3121" LastEditorUserId="3121" LastEditDate="2012-11-06T06:28:26.340" LastActivityDate="2021-08-22T18:55:03.513" Title="Please help me analyse spectrogram" Tags="|matlab|spectrogram|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5913" PostTypeId="2" ParentId="2696" CreationDate="2012-11-06T05:22:52.380" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I know that the Spectrogram is supposed to give you an idea of the fundamental frequencies present in your audio file&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For any sound sample there is always only one fundamental frequency and (possible) harmonics (integer multiples of fundamental frequency)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What does the Spectrogram exactly do? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;At the most basic level it is dividing the sound sample into multiple &quot;blocks&quot; (in time domain) and plotting the fft of each block and displaying all of them to you in the same graph. The x-axis is time and the y axis is frequency (compare to an fft amplitude plot, where x axis is frequency and y axis is amplitude; in this case the analysis is done only on one of the &quot;blocks&quot; of the time domain; in a spectrogram the fft amplitude plot of each such &quot;block&quot; is shown to us at the same time). The amplitude of FFT for each time domain block is represented by colour and intensity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: please leave any corrections or better references for this explanation in the comments&lt;/p&gt;&#xA;" OwnerUserId="3121" LastActivityDate="2012-11-06T05:22:52.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5914" PostTypeId="2" ParentId="5912" CreationDate="2012-11-06T06:32:32.030" Score="3" Body="&lt;p&gt;The spectrograms look different because they use:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Different parameters for the FFT size and hop size (window overlap ratio).&lt;/li&gt;&#xA;&lt;li&gt;They simply use different palettes. The spectrogram gives you an array of numbers, which are scaled and map to a color palette to produce a color image. Matlab's &lt;a href=&quot;http://www.mathworks.fr/fr/help/matlab/ref/colormap.html&quot; rel=&quot;nofollow&quot;&gt;colormaps&lt;/a&gt; are listed here - by default it uses &quot;jet&quot; ; so the time-frequency bins of lowest energy are colored in blue, and those of highest energy are colored red.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-06T06:32:32.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5915" PostTypeId="1" AcceptedAnswerId="5921" CreationDate="2012-11-06T08:13:20.017" Score="10" ViewCount="12803" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1406/real-discrete-fourier-transform&quot;&gt;Real Discrete Fourier Transform&lt;/a&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/q/646/77&quot;&gt;What is the most lucid, intuitive explanation for the various FTs - CFT, DFT, DTFT and the Fourier Series?&lt;/a&gt; &lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/q/1334/77&quot;&gt;Discrete-time Fourier transform&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;I read about the Discrete Fourier Transform. I understand how to compute it given a sequence of numbers(digital signal), but I still didn't get what's the meaning of the new sequence I get as the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, I know that the Fourier Transform takes an analog signal representation in the time domain and returns its representation in the frequency domain, its spectrum.&#xA;If I look at the analog signal in a time-window $T$, sampling it $N$ times , then the sampling interval will be $t_0 = T/N$ and the sampling frequency will be $f_s =1/t_0$.&#xA;The sampled values of the analog signal give me a new digital signal, lets say $s_n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is the meaning of the DFT of this digital signal $s_n$? How the DFT sequence related to $s_n$? How it is related to the original analog signal? What is the meaning of these frequency components I get? Should they be taught of an approximation the previous analog signal frequency components or as sampled values of its spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="3232" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2012-11-06T14:39:02.447" Title="What is the meaning of the DFT?" Tags="|dft|" AnswerCount="1" CommentCount="1" ClosedDate="2012-11-06T14:37:52.527" ContentLicense="CC BY-SA 3.0" />
  <row Id="5917" PostTypeId="1" AcceptedAnswerId="5920" CreationDate="2012-11-06T10:23:06.050" Score="3" ViewCount="501" Body="&lt;p&gt;I have the following sourcecode. For all I know, it should be a Bessel LPF at 10Hz. Is there a way to get the sampling frequence out of this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double LPF(register double value) { &#xA;    static double buf[4];&#xA;    register double tmp, fir, iir;&#xA;    tmp= buf[0]; memmove(buf, buf+1, 3*sizeof(double));&#xA;    iir= val * 1.865660386328251e-06;&#xA;    iir -= 0.9048452950692862*tmp; fir= tmp;&#xA;    iir -= -1.898666438223082*buf[0]; fir += buf[0]+buf[0];&#xA;    fir += iir;&#xA;    tmp= buf[1]; buf[1]= iir; val= fir;&#xA;    iir= val;&#xA;    iir -= 0.8712702520352774*tmp; fir= tmp;&#xA;    iir -= -1.866439169696869*buf[2]; fir += buf[2]+buf[2];&#xA;    fir += iir;&#xA;    buf[3]= iir; val= fir;&#xA;    return val;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3233" LastActivityDate="2012-11-06T18:29:56.780" Title="Reverse Engineering Bessel LPF (sample frequency needed)" Tags="|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5918" PostTypeId="1" CreationDate="2012-11-05T19:49:46.383" Score="4" ViewCount="121" Body="&lt;p&gt;I'm trying to synchronize (overlap) two audio recordings of the same song: a complete HQ version, and an incomplete, noisy version (phone recording for example). The noisy recording may have had its tempo increased/decreased.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have something working based on this 2001 paper: &lt;a href=&quot;http://www.rotorbrain.com/foote/papers/icme2001/icmehtml.htm&quot; rel=&quot;nofollow&quot;&gt;&quot;The Beat Spectrum: a New Approach To Rhythm Analysis&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Get a self-similarity vector for each song, which will contain peaks at every multiple of the song bar duration (every 4 or 8 beats for latin music for example)&lt;/li&gt;&#xA;&lt;li&gt;For each r (relative tempo ratio) from 0.7 to 1.3, scale the second vector and then do a dot product on the two vectors, using v1[i]·v2[i] = d1[i]*d2[i] (where d1[i] is the sign of v1's derivative; same for d2)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When the beats are clear in the recordings, I get a clear maximum at the correct ratio (usually 1.0). The problem is that when the beats are lost (due to EQ, bad mics, noise) the self-similarity chart stops showing the periodic bars and I get maximums in the wrong places in the dot product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what else could I use instead of the dot-product-of-the-derivative-sign, and what other robust ways are there to determine the tempo change ratio in the presence of noise, besides doing BPM(song1) / BPM(song2).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In case someone can take this further: computing self-similarity by overlapping the sample twice (at [0, ofs, ofs+ofs] instead of just [0, ofs]) gives much more accurate maximums for each beat duration. But I haven't tested it yet on all the samples I have.&lt;/p&gt;&#xA;" OwnerUserId="3239" OwnerDisplayName="patraulea" LastActivityDate="2012-11-06T11:31:18.210" Title="Relative beat detection for two audio recordings" Tags="|statistics|noise|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5919" PostTypeId="2" ParentId="4907" CreationDate="2012-11-06T13:09:04.133" Score="2" Body="&lt;p&gt;If you know what the bleep is going to look/sound like, you can use a matched filter to detect the bleep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Matched_filter&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3182" LastActivityDate="2012-11-06T13:09:04.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5920" PostTypeId="2" ParentId="5917" CreationDate="2012-11-06T13:16:13.617" Score="1" Body="&lt;p&gt;In digital signal processing, everything is normalized to and therefore independent of the sampling frequency. The sampling frequency is not defined before the digital signal is converted to an analogue signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose a digital lowpass filter has a 3dB cutoff frequency of 0.2 and the filtered signal is converted to an analogue signal with a rate of 50 samples/s. Then you will see the cutoff frequency of the &lt;em&gt;analogue&lt;/em&gt; signal at 10 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case, if you look at the whole system including DSP and digital-to-analogue conversion, you can calculate the sampling frequency if you know the cutoff frequency of the analogue signal and the normalized cutoff frequency of the digital filter. But with the source code alone, the sampling frequency cannot be determined.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2012-11-06T13:16:13.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5921" PostTypeId="2" ParentId="5915" CreationDate="2012-11-06T13:17:47.247" Score="9" Body="&lt;p&gt;As you noted, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dft&quot;&gt;discrete Fourier transform (DFT)&lt;/a&gt; maps a length-$N$ sequence to its (also length-$N$) frequency-domain equivalent. The time-domain signal $s[n]$ is transformed into a frequency-domain signal $S[k]$, such that the following two relations hold true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;S[k] = \sum_{n=0}^{N-1} s[n] e^{\frac{-j2\pi k n}{N}} \text{ (the DFT)}&#xA;$$&#xA;$$&#xA;s[n] = \sum_{k=0}^{N-1} S[k] e^{\frac{j2\pi k n}{N}} \text{ (the inverse DFT)}&#xA;$$&#xA;(ignoring scale factors that can be placed in many different places depending upon the preference of the author; one way to make them &quot;symmetric&quot; is to place a factor of $\frac{1}{\sqrt{N}}$ in front of each equation: &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_unitary_DFT&quot;&gt;the unitary DFT&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a number of intuitive interpretations for the action implied by these equations. Here's the way I usually think about them:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Forward DFT:&lt;/strong&gt; Each DFT output value $S[k]$ is a complex value that represents the amplitude and phase of $s[n]$'s content at frequency $\frac{2\pi k}{N}$. The multiplication by the exponential function effectively shifts $s[n]$ down in frequency by $\frac{2\pi k}{N}$. The sum over $N$ time samples can then be thought of as applying a decimating lowpass filter. So, effectively, the $N$ outputs of the DFT represent the results of applying a bank of equally-spaced filters across $s[n]$'s frequency band, thus measuring &quot;how much&quot; energy is present in various frequency bands in the input signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inverse DFT:&lt;/strong&gt; The DFT output values $S[k]$ are used to weight a number of complex exponential functions in order to resynthesize the original time-domain signal $s[n]$. The frequency associated with $S[k]$ is the additive inverse of the frequency used during the forward DFT. This view clearly shows that the DFT can be thought of as a means to decompose an arbitary finite-length time-domain signal $s[n]$ into a set of weighted orthogonal complex exponential functions (or &quot;complex sinusoids&quot;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, extending this concept a bit: when you sample a continuous-time signal $s(t)$ at discrete time instants, you get a (potentially infinite-length) discrete-time signal $s[n]$. Applying the Fourier transform to such a discrete-time signal results in the &lt;a href=&quot;http://en.wikipedia.org/wiki/DTFT&quot;&gt;discrete time Fourier transform (DTFT)&lt;/a&gt;, which is continuous in frequency and, like the DFT, periodic in frequency with period $2\pi$. Assuming that a large-enough sample rate was used during the conversion to discrete-time, the result of the DTFT will look a lot like the Fourier transform of the original signal $s(t)$.The DFT is only applicable to finite-length signals, so in order to apply it, one must truncate the discrete-time signal $s[n]$ to some finite length $N$, resulting in a potentially-shorter signal $s_N[n]$. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For this special case of a finite-length discrete-time signal, the $N$ DFT outputs are just equally-spaced samples of $s_N[n]$'s DTFT. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$s_N[n]$'s DTFT is related to $s[n]$'s DTFT; they may differ if $s[n]$ was longer than $N$ samples long originally and some truncation/windowing was involved in generating a finite sample length. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$s[n]$'s DTFT is related to the original signal's Fourier transform, with the caveat that the DTFT is periodic, so all of the frequency content from the continuous-time signal that is unambiguously representable in discrete-time (the bandwidth of which is determined by the sample rate used) is contained within a single length-$2\pi$ period of $s[n]$'s DTFT.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-11-06T13:17:47.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5922" PostTypeId="1" AcceptedAnswerId="5923" CreationDate="2012-11-04T20:00:08.010" Score="5" ViewCount="47553" Body="&lt;p&gt;Is there any method to find range of hsv values of image (object) in rectangle inside big image? I mean, there is fixed size rectangle on my image(frame from camera) and i want to find range of hsv values of object which is inside this rectangle. Object is changeable. If i put red ball inside rectangle it should find range of red ball's hsv values, if i put my hand inside rectangle it should find range of my skin's hsv values. Is there any way to do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;I get part of image with ROI, and convert it to hsv format. But problem is behind red ball, I get wide variety of colours. So which range will I choose from this image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: my frame:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mU6Dk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to find best range of hsv values of image in rectangle box for tracking it. (Now it should be green and ranges should be h:53-90 s:74-147 v: 160-255)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i can find this values, by using inRange method, i can convert it to binary image for tracking. Like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/62CRI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3235" OwnerDisplayName="gurcan15" LastActivityDate="2012-11-12T08:40:45.053" Title="How to determine range of HSV values of the image?" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5923" PostTypeId="2" ParentId="5922" CreationDate="2012-11-05T01:59:27.513" Score="8" Body="&lt;p&gt;You can simply specify a ROI for that region and convert it into HSV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For eg (below is pseudo-code in Python-OpenCV)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# define ROI of RGB image 'img'&#xA;roi = img[r1:r2, c1:c2]&#xA;&#xA;# convert it into HSV&#xA;hsv = cv2.cvtColor(roi,cv2.COLOR_BGR2HSV)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now it gives you the hsv values of the region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But one or two difficulties there:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your object may comprise some part of the ROI. There may be some background region also inside your ROI. ie if your object is red and background is blue, your ROI will contain two different values, one for RED and other for BLUE. Which one will your program select?&lt;/li&gt;&#xA;&lt;li&gt;But colors won't be constant like RED or BLUE. You get wide variety of colours. Below is a plot of different colours for a ROI with green object.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C6KOw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it has values from yellow to slight blue with green as major. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you will have to select color with maximum probability, may be from checking its histogram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check this SOF for more details : &lt;a href=&quot;https://stackoverflow.com/questions/13111504/selecting-best-range-of-values-from-histogram-curve&quot;&gt;https://stackoverflow.com/questions/13111504/selecting-best-range-of-values-from-histogram-curve&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="818" OwnerDisplayName="Abid Rahman K" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2012-11-05T01:59:27.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5924" PostTypeId="1" CreationDate="2012-11-06T14:47:59.013" Score="1" ViewCount="217" Body="&lt;p&gt;Input: Cropped face or Non Cropped face images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Detailed explanation: My project is face authentication. I am using OpenCV face detector to crop face from images. I am using OpenCV implementation of LBP for face recognition. My face recognition system works good when the the test images are not much variant (illumination) w.r.t training images. The constraint is, I don't have many variants during training; so, I need to categorize the images based on light/shadow and need to label each image . So that similarity score threshold value can be set dynamically based on the labels. I am not getting the desired results with the Illumination normalization algorithms (like Difference of Gaussian) and with the static threshold values for all variants of images . So, I need to know how to identify the quality(illumination) of images, to check the possibility of dynamic thresholds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any guidance on any of my above said process are appreciated and helpful to me.&lt;/p&gt;&#xA;" OwnerUserId="3147" LastEditorUserId="29" LastEditDate="2012-11-07T14:56:12.930" LastActivityDate="2024-04-03T14:06:55.867" Title="How to categorize the images based on Illumination / shadow?" Tags="|image-processing|computer-vision|opencv|face-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5925" PostTypeId="1" CreationDate="2012-11-06T14:54:22.180" Score="5" ViewCount="190" Body="&lt;p&gt;Project: Red eye detection&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Description: I want to remove red-eye from images. I am not able to use face detector because, the faces in the images are not always frontal and also the images are of players with helmet. And the images may have many red eyes. Also, the lighting is not proper. I want to know how to detect the red eyes? I am searching for some proven studies. Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2012-11-06T14:54:22.180" Title="Red eye detection" Tags="|image-processing|computer-vision|opencv|face-detection|" AnswerCount="0" CommentCount="2" ClosedDate="2013-10-26T05:10:33.263" ContentLicense="CC BY-SA 3.0" />
  <row Id="5926" PostTypeId="1" CreationDate="2012-11-06T15:11:28.607" Score="5" ViewCount="2243" Body="&lt;p&gt;Project: Face Detection&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Description: I want to detect and crop a face in an image. The image is captured through webcam and only one face per image.I used OpenCV face detector, but I was not satisfied with the cropping. So, I started using STASM (http://www.milbo.users.sonic.net/stasm/) face landmark detector to crop the image.STASM uses OpenCV face detector to find face in an image and STASM locates landmarks in faces. In bad light conditions, the cropped image from STASM is not good as it is not exactly detecting the face alone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I want to know any better algorithm for face detection. My main aim is to crop the face from an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) currently I am using STASM for cropping. In bad light conditions or when in an image, if the whole or complete face (forehead to chin) is not captured, STASM cropping is not reliable (The output will be only eye or lips). And in my application, if there is no proper output from the stasm or if the face is not cropped prpoerly then i should reject the images. How to do that? So I am planning to validate the face in an image by finding the Eyes. If I am right in my approach, how to detect the eyes from the cropped image?&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2013-08-27T08:34:54.630" Title="Face Detection + Cropping" Tags="|image-processing|computer-vision|opencv|face-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5928" PostTypeId="2" ParentId="5917" CreationDate="2012-11-06T18:29:56.780" Score="2" Body="&lt;p&gt;I don't think Deve's answer is correct. The coefficient determine the transfer function in normalized frequency. You can determine at what relative frequency the transfer function hits -3dB. Let's say it's 0.01. Since you  know this is corresponds to 10 Hz you can infer that the sample rate is indeed 1000Hz. &#xA;This code is difficult to read and there isn't a single line of comment in it, nor is there any explanation of what the state variables so it's difficult exactly which number is what coefficient (b0,b1,b2, a0,a1, a2 etc) but it is in principle possible to infer the sample rate.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-11-06T18:29:56.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5929" PostTypeId="2" ParentId="4870" CreationDate="2012-11-06T18:56:37.807" Score="4" Body="&lt;p&gt;The problem with $\left|f\right|$ is that since is not analytic the standard definition of complex derivative does not apply. A solution is to use Wirtinger derivatives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Wirtinger_derivatives&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Wirtinger_derivatives&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A detailed account of Wirtinger calculus for signal processing problems is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://arxiv.org/abs/0906.4835&quot; rel=&quot;nofollow&quot;&gt;http://arxiv.org/abs/0906.4835&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another (probably simpler) option is to treat the complex image as a two-channel (real,imag) image and use the definition of derivative for vector fields. This paper has a very clear explanation on how to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=80971&amp;amp;tag=1&quot; rel=&quot;nofollow&quot;&gt;Lee, H.-C.; Cok, D.R.; &quot;Detecting boundaries in a vector field&quot; (IEEE Transactions on Signal Processing, vol.39, no.5, pp.1181-1194, May 1991)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1696" LastEditorUserId="1273" LastEditDate="2012-11-07T12:52:08.680" LastActivityDate="2012-11-07T12:52:08.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5930" PostTypeId="1" AcceptedAnswerId="5943" CreationDate="2012-11-06T21:44:30.493" Score="17" ViewCount="22680" Body="&lt;p&gt;I have an image that looks like the one below:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/EUjtJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to find the radius (or diameter) of the circle.&#xA;I have tried using circular Hough transform (via matlab's &lt;code&gt;imfindcircles(bw,[rmin rmax],'ObjectPolarity','bright')&lt;/code&gt;) , and by fitting to a circle or an ellipse (home made function that works pretty well for less noisy data, see below). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried some image processing to get a clearer circle, for example, see below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;se = strel('disk', 2);&#xA;bw = imdilate(bw, se);&#xA;bw = bwareaopen(bw,100000); &#xA;bw =  edge(bw); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iEm2m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I feed the processed image to either techniques (Hough and circle\ellipse fitting) neither of them manage to detect the circle in a decent manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a code snippet of the circle finder I wrote (matlab)&#xA;       [row col]=find(bw);&#xA;       contour = bwtraceboundary(bw, row(1), col(1)], 'N', connectivity, num_points);&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    x = contour(:,2);&#xA;    y = contour(:,1);&#xA;&#xA;    % solve for parameters a, b, and c in the least-squares sense by&#xA;    % using the backslash operator&#xA;    abc = [x y ones(length(x),1)] \ -(x.^2+y.^2);&#xA;    a = abc(1); b = abc(2); c = abc(3);&#xA;&#xA;    % calculate the location of the center and the radius&#xA;    xc = -a/2;&#xA;    yc = -b/2;&#xA;    radius  =  sqrt((xc^2+yc^2)-c);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternative approaches will be appreciated...&lt;/p&gt;&#xA;" OwnerUserId="2044" LastEditorUserId="128" LastEditDate="2019-11-27T22:00:41.977" LastActivityDate="2019-11-27T22:00:41.977" Title="Detection of a Circle in Noisy Image Data" Tags="|image-processing|matlab|computer-vision|detection|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5931" PostTypeId="2" ParentId="5930" CreationDate="2012-11-07T00:05:46.200" Score="10" Body="&lt;p&gt;It's fairly straightforward to do it using image processing. The following is a proof of concept in &lt;em&gt;Mathematica&lt;/em&gt;. You'll have to translate it to MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, trim the axes and keep only the image part of it. I call this variable &lt;code&gt;img&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Binarize the image and dilate it, followed by a filling transform. I also remove stray small components that are not connected to the main blob. It should give you something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filled = Binarize@img ~Dilation~ 3 // FillingTransform // DeleteSmallComponents&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/syJxi.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Next, find the centroid of this blob and the equivalent disk radius of the blob (openCV, MATLAB all have equivalent commands to do this)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{center, radius} = 1 /. ComponentMeasurements[filled, {&quot;Centroid&quot;, &quot;EquivalentDiskRadius&quot;}]&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;That's it! Now plot the original image and a circle with the above center and radius to see how it fits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Show[img, Graphics[{Red, Circle[center, radius]}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/v1u6c.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="77" LastActivityDate="2012-11-07T00:05:46.200" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5932" PostTypeId="1" AcceptedAnswerId="5933" CreationDate="2012-11-07T06:26:48.940" Score="1" ViewCount="1991" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/5912/please-help-me-analyse-spectrogram&quot;&gt;Something related&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the spectrogram plots:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KF66W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Audacity version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vJhaE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the darker parts towards the right of the figure show speech. Silence was added to the left of the figure in audacity. This silent portion does not show any thing in the spectrogram as plotted by audacity which is as expected. but the same silence portion is covered with blue dots in case of the matlab plot. Why didn't Matlab plot it with all white (since it is silence added through software and is not supposed to have any energy)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---EDIT: response to pichenettes' answer ---&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you are right about the first explanation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The previous spectrogram was obtained by changing the time domain wave form view into spectrogram view immediately after I added silence. Actually in my case I had added silence at the end of the file to make it's length exactly equal to 2500ms, then cut and pasted to the beginning. So in my case it actually did show the time domain waveform of silence as well after insertion. But it seems that it does not actually include the 0's of silence in the wavfile until I export it. When I see the spectrogram of the wavfile after an export and a re-import, I an see blue dots in the audacity version as well&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cm9UE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And teh difference in colour is probably due to the difference in colour palettes used, as pinchette had pointed out in his other answer &lt;/p&gt;&#xA;" OwnerUserId="3121" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-11-07T07:52:37.353" Title="why is the spectrogram from matlab different from audacity" Tags="|matlab|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5933" PostTypeId="2" ParentId="5932" CreationDate="2012-11-07T07:05:44.950" Score="4" Body="&lt;p&gt;I see two possible explanations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Explanation 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Audacity is a non-destructive/non-linear audio editor. It primarily manipulate edit decision lists of audio signals, rarely the signals themselves. So when you nudge a block of audio 1.4s to the right, it does not fill the gap with 0 (silence). Instead, it just stores somewhere &quot;this block plays 1.4s from the beginning of the timeline&quot;. For example, I have created here a 30s sine wave tone and nudged it at time offset 27s. Notice that the gap between the origin and the waveform is empty rather than showing a flat line indicating a 0 amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XzNIK.png&quot; alt=&quot;Audacity is a non-linear audio editor&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you apply the &quot;Mix and render&quot; command, all editing and mixing commands will be actually performed on the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Explanation 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Digital silence is a sequence of 0. This causes a problem during the computation of the spectrogram because this involves the computation of log (0) to get to the dB scale. Audacity might use a special color in its palette for digital silence; while matlab might add a very low noise.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-07T07:05:44.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5934" PostTypeId="1" AcceptedAnswerId="5937" CreationDate="2012-11-07T08:31:23.887" Score="3" ViewCount="5179" Body="&lt;p&gt;I am very new to this things. Sorry for probably stupid question. I don't understand what units and meaning have the values on Y-axis of Fourier Transform graph? On X-axis it is Frequency (Hz). Pretty clear. Can't find the meaning of Y.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code in MATLAB I used to produce the graph, and the image of the output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = 5;&#xA;t = 0:1/1000:1;&#xA;f1 = 7;&#xA;s = A * sin(2 * pi * fi * t);&#xA;F = fft(s);&#xA;figure;&#xA;plot(abs(F)), (s);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IH5GT.png&quot; alt=&quot;https://i.stack.imgur.com/IH5GT.png&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3238" LastEditorUserId="1273" LastEditDate="2012-11-07T12:57:31.853" LastActivityDate="2012-11-07T13:21:28.673" Title="FFT spectre graph measurements y-axis" Tags="|fft|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5935" PostTypeId="1" AcceptedAnswerId="5939" CreationDate="2012-11-07T10:03:16.113" Score="2" ViewCount="111" Body="&lt;p&gt;I have a large face database, and I want to search through it. For example, if I input a new face image, the system would return the best N similarities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that PCA, LDA, and Procrustes analysis are used for this, but it seems that I need to project all this large database into PCA space, and I don't know any library that can handle that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there some tools, software, or a library for this?&lt;/p&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="76" LastEditDate="2012-11-07T13:28:38.967" LastActivityDate="2012-11-07T14:28:26.130" Title="Methods for searching a large face database" Tags="|computer-vision|object-recognition|face-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5937" PostTypeId="2" ParentId="5934" CreationDate="2012-11-07T13:21:28.673" Score="1" Body="&lt;p&gt;The Y-axis units are the same as the Y-axis units you would have if you plotted the time-domain signal.  For instance, if the samples that you input into the FFT are the signal voltage, then the FFT units are also voltage.  To get energy units you have to square the absolute value of the FFT.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-11-07T13:21:28.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5938" PostTypeId="1" AcceptedAnswerId="5944" CreationDate="2012-11-07T13:58:17.217" Score="4" ViewCount="6927" Body="&lt;p&gt;When implementing the fft, you always include a bit reverse at the end of the process to put the data in the correct order. It seems to be because the fft proceeds by decimating the input array into odd/even sections (for radix-2 algorithms, for other algorithms e.g. prime factor you have to do a radix reverse), the final stage of the algorithm involves multiplications (by several exponential factors) on the individual array members. These can be labelled by a series of EOEEO etc (E = even, O=odd) depending on the process of decimation and whether the subarray was an odd/even decimate. Why does replacing E with 1 and O with 0 result in the bins requiring a final permutation. This has always bothered me about the fft. &lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2012-11-08T07:11:35.920" Title="Why exactly is a bit/radix reverse required when calculating the fft?" Tags="|fft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5939" PostTypeId="2" ParentId="5935" CreationDate="2012-11-07T14:28:26.130" Score="1" Body="&lt;p&gt;If you can transform your problem into the following &quot;given a set of vectors find the N ones with the smallest euclidian distance to the query&quot;, there are well-known methods (Ball-trees, Locality-sensitive hashing...) for solving it on large datasets. With this approach, PCA / LDA is thus just a pre-processing step for transforming the set of features produced by your feature extractor into a lower-dimensionality feature vector.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-07T14:28:26.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5940" PostTypeId="1" CreationDate="2012-11-07T11:38:12.640" Score="6" ViewCount="1800" Body="&lt;p&gt;I have read through many papers related to the Mel-frequency cepstrum coefficient (MFCC): I have some confusion about the MFCC process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Many of the papers say that I have to do a FT (Fourier Transform) on the log-spectrum to obtain cepstrum (as mentioned in Wikipedia : definition of power cepstrum)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Many say I have to do an IFT (Inverse Fourier Transform) on log-spectrum to obtain cepstrum.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Many refer to the DCT-II (Discrete cosine Transform-2) on the Mel-log-spectrum to obtain MFCC.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is, which one is right: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;FT or IFT?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the IFT is correct than why are they using DCT-II instead of IDCT-II, since the DCT-II is similar to DFT or FT?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(hence, the IDFT or IFT should be similar to IDCT-II)&lt;/p&gt;&#xA;" OwnerDisplayName="user1646349" LastEditorUserId="76" LastEditDate="2012-11-07T17:10:02.263" LastActivityDate="2012-11-07T17:10:02.263" Title="MFCC process confusion" Tags="|fft|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5941" PostTypeId="2" ParentId="5940" CreationDate="2012-11-07T16:24:25.180" Score="9" Body="&lt;p&gt;First of all, FT and IFT of a discrete sequence are the same up to complex conjugation/scaling - these two operations will thus yield qualitatively the same result (in the sense that subsequence processing/statistical modeling will make abstraction of these differences anyway). The textbook definition of cepstrum requires a Fourier transform. People sometimes use the inverse Fourier transform to emphasizes that the X axis on the cepstrum plot can indeed be interpreted as a time (rather than as a quefrency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MFCC extraction process found in speech and audio analysis systems uses the DCT since it has the advantage of being a real -&gt; real transform, and because the resulting coefficients are in practice decorrelated from each other - which is not the case if you take the sequence of real/imaginary part of a FT or IFT. This makes the resulting data very good for subsequent modeling with gaussian models with diagonal covariance matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another view on this: take thousands of hours of audio, extract log mel frequency coefficients (through a bank of filters with triangular responses, with center frequencies distributed on the Mel scale) for each analysis frame. You'll get a big dataset... Do a PCA on it to extract the dimensionality reduction transform that captures most of the variance of the mel coefficients. The transform matrix the PCA will produce will be uncannily close to the DCT matrix.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-07T16:24:25.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5942" PostTypeId="2" ParentId="5938" CreationDate="2012-11-07T17:07:21.113" Score="3" Body="&lt;p&gt;One reason typical implementations of a radix-2 FFT require a permutation at the beginning or end is to reduce the use of any temporary memory when using a procedural/sequential processing engine.  When using a single complex array, larger than, say, the CPUs register set, for both the input, output and intermediate results, the intermediate butterfly results have to go somewhere in that array.  But the place most appropriate for a non-permuted result might still be occupied by unprocessed input data.  So you could either use more memory to save the unprocessed inputs somewhere else, use more memory to put the intermediate results somewhere else, or just put the results in an array location where the input data is no longer needed (e.g. the butterfly input locations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you allocate a full new array for each FFT radix-2 layer, no post-shuffling will be required.  You could also ping-pong 2 arrays, but that's still double the memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you had enough parallel ALU units that no temporary result are required, and the entire FFT result is available at once at the ALU outputs, then you could also write out the FFT result without any permutation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-11-07T17:07:21.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5943" PostTypeId="2" ParentId="5930" CreationDate="2012-11-07T21:47:35.390" Score="14" Body="&lt;p&gt;Here is my solution, it is close to @Yoda's idea, but I changed some steps.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mark all pixels such that there are at least 6 pixels in their 7x7 neighborhood&lt;/li&gt;&#xA;&lt;li&gt;Remove all blobs, but the largest&lt;/li&gt;&#xA;&lt;li&gt;Fill holes&lt;/li&gt;&#xA;&lt;li&gt;Apply edge detection&lt;/li&gt;&#xA;&lt;li&gt;Find circle using Hough transform&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zRSJ3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/K1MPY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/CDR6K.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hIjAx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OhMod.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the relevant Matlab code. I am using &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/26978-hough-transform-for-circles/content/html/circle_houghdemo.html&quot; rel=&quot;noreferrer&quot;&gt;Hough transform for circles&lt;/a&gt; .m file in my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function FindCircle()&#xA;    close all;&#xA;    im = imread('C:\circle.png');&#xA;    im = im(:,:,2);&#xA;&#xA;    ims = conv2(double(im), ones(7,7),'same');&#xA;    imbw = ims&amp;gt;6;&#xA;    figure;imshow(imbw);title('All pixels that there are at least 6 white pixels in their hood');&#xA;&#xA;    props = regionprops(imbw,'Area','PixelIdxList','MajorAxisLength','MinorAxisLength');&#xA;    [~,indexOfMax] = max([props.Area]);&#xA;    approximateRadius =  props(indexOfMax).MajorAxisLength/2;&#xA;&#xA;    largestBlobIndexes  = props(indexOfMax).PixelIdxList;&#xA;    bw = false(size(im));&#xA;    bw(largestBlobIndexes) = 1;&#xA;    bw = imfill(bw,'holes');&#xA;    figure;imshow(bw);title('Leaving only largest blob and filling holes');&#xA;    figure;imshow(edge(bw));title('Edge detection');&#xA;&#xA;    radiuses = round ( (approximateRadius-5):0.5:(approximateRadius+5) );&#xA;    h = circle_hough(edge(bw), radiuses,'same');&#xA;    [~,maxIndex] = max(h(:));&#xA;    [i,j,k] = ind2sub(size(h), maxIndex);&#xA;    radius = radiuses(k);&#xA;    center.x = j;&#xA;    center.y = i;&#xA;&#xA;    figure;imshow(edge(bw));imellipse(gca,[center.x-radius  center.y-radius 2*radius 2*radius]);&#xA;    title('Final solution (Shown on edge image)');&#xA;&#xA;    figure;imshow(im);imellipse(gca,[center.x-radius  center.y-radius 2*radius 2*radius]);&#xA;    title('Final solution (Shown on initial image)');&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="698" LastActivityDate="2012-11-07T21:47:35.390" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5944" PostTypeId="2" ParentId="5938" CreationDate="2012-11-08T07:11:35.920" Score="3" Body="&lt;p&gt;You might want to look at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tran-Thong, “Algebraic Formulation of the Fast Fourier Transform,” IEEE Circuits and Systems magazine, vol. 3, no. 2, June 1981, pp. 9-19.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author describes 16 'basic' FFT algorithms – 8 Decimation-in-Time and 8 Decimation-in-Frequency, also classified by: input order, output order, and characteristics (or geometry: in-place, same output, same input, or isogeometric).  It should be evident that bit reversal is NOT always required at the end (or beginning) of an FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, there are other FFT algorithms which cannot be neatly defined by the scheme above, such as some shown in Chapter 10 of Rabiner and Gold's book: “Theory and Application of Digital Signal Processing,” Englewood Cliffs, NJ, Prentice-Hall, 1975.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, it is possible to derive other algorithms which would defy ANY form of simple classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yet, despite the many differences (which strongly affect implementation), there are some simple, basic ideas which can be gleaned from the Tran-Thong paper.  For instance, starting with any one of the graphs in that paper, it is easy to show that all the other graphs of the same decimation type can be derived by simple graphical manipulations.  Similarly, decimations can be changed by factoring twiddles into common factors (eg: twiddle 3 = twiddle 1 times twiddle 2), and then moving common twiddle factors on input legs of a butterfly to an output (or vice-versa).  Likewise, it is easy to see how four connected radix-2 butterflies can be re-drawn as a single radix-4 butterfly (with appropriate output ordering, of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT is a very graphic thing.  Too often, some authors transmogrify it into something ugly and difficult.  It isn't.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2012-11-08T07:11:35.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5945" PostTypeId="1" CreationDate="2012-11-08T12:38:53.893" Score="2" ViewCount="715" Body="&lt;p&gt;I am currently making an analysis of a codec system that can encode up to 2 wave files into 1 file and decode it. Here is a simple illustration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L+R ---&amp;gt; ENC ---&amp;gt;L'+R'&#xA;with L'=L+∂1 &amp;amp; R'=R+∂2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The codec is not lossless and we are analyzing if there is any leakage from one source to another, some kind of crosstalk, if you will.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I have to do is find out if &lt;code&gt;∂1&lt;/code&gt; has traces of R &amp;amp; &lt;code&gt;∂2&lt;/code&gt; has traces of L.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel a general approach would be to subtract L/Ldec to get &lt;code&gt;∂&lt;/code&gt; and then compare that &lt;code&gt;∂&lt;/code&gt; to R.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done some reading on correlation but it's all a little vague at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, onto my question(s):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this possible with limited knowledge of DSP (reading up but it's a&#xA;lot &amp;amp; not that easy)? &lt;/li&gt;&#xA;&lt;li&gt;If not, on what should I do some reading (From what I've gathered so far: correlation &amp;amp; Pearson's coefficient)?&lt;/li&gt;&#xA;&lt;li&gt;Is there some sort of standardized test for this - I presume there is&#xA;but I can't find any! &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Even though code snippets would be handy since I only just started to use MATLAB &amp;amp; still am somewhat inexperienced, the main point of this topic is understanding so I can implement it. If someone else implements it I won't learn!&lt;/p&gt;&#xA;" OwnerUserId="3246" LastEditorUserId="76" LastEditDate="2012-11-22T12:55:22.660" LastActivityDate="2012-11-22T12:55:22.660" Title="Audio codec analysis in MATLAB: crosstalk" Tags="|matlab|audio|correlation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5947" PostTypeId="1" CreationDate="2012-11-08T13:22:59.130" Score="2" ViewCount="3003" Body="&lt;p&gt;I have a dataset with two columns (width and length, both in milimeter). When I make a scatter plot (please refer to the first figure), I see location of defects in a plane. I want to find if the location of the defect has some kind of pattern or it is just a noise. For that I was suggested to use 2D fft to recognize pattern. I don't have any background in 2D fft but I read some articles and used matlab function fft2. I get a plot (please refer to the second figure) which I dont I understand so much at this moment. Can any one has hint to get me going? A nice article could also be of help. I read the following article as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.qsimaging.com/ccd_noise_interpret_ffts.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.qsimaging.com/ccd_noise_interpret_ffts.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CEadE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YAoxV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="Chris" LastActivityDate="2013-07-10T15:23:56.743" Title="Pattern recognition using 2D fft in matlab" Tags="|matlab|image-processing|fft|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="5948" PostTypeId="2" ParentId="5947" CreationDate="2012-11-08T20:24:05.707" Score="1" Body="&lt;p&gt;DFT is a great tool to find periodic patterns in signals.  However, you should understand what kind of period you want to find. If you want to find a series of points that lie on a regular grid (with even spacing), or more mathematically speaking, a subset of points $(x_i,y_i)$, such that there exists $(dx,dy)$ for which the following equations hold: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_i = x_1 + dx*i $&lt;br&gt;&#xA;   $ y_i =y_1 + dy*j $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The patterns can also be rotated, and DFT will still find them). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should compute a 2D histogram of your data, with large number of bins, and run DFT on it. Afterwards, you should look for a peak in any location expect the DC. An ideal noise should have no patters, thus the contrast of the frequencies responses should be very low.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-11-08T23:40:47.477" LastActivityDate="2012-11-08T23:40:47.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5949" PostTypeId="1" AcceptedAnswerId="5950" CreationDate="2012-11-08T21:56:00.927" Score="1" ViewCount="681" Body="&lt;p&gt;I recorded sounds using a plug in microphone on a Windows 7 laptop. I used the Windows Sound recorder to record the sounds. It was only one microphone, but when I load the sound file into Audacity, it loads 2 channels. This is to be expected, but the sound files are slightly different (subtracting them from each other in MATLAB doesn't result in a zeroed signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shouldn't they be copies of one another?  I didn't use any special effects etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1348" LastActivityDate="2012-11-09T01:14:03.930" Title="Recorded an audio file using microphone via Windows Sound recorder, but has 2 channels that are slightly different. Why are they different?" Tags="|matlab|audio|sound|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5950" PostTypeId="2" ParentId="5949" CreationDate="2012-11-09T01:14:03.930" Score="2" Body="&lt;p&gt;I am not %100 sure, but it sounds like you are recording the file in stereo. If this is the case, then Windows Sound recorder is taking stereo input, which means it's accessing 2 AD converters which have the same input applied to them. The difference between the two signals in this case would be the noise and any offset between the two converters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would see if Windows Sound Recorder could make a mono recording, or else use another program to make the recording.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-11-09T01:14:03.930" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5951" PostTypeId="1" CreationDate="2012-11-09T01:20:51.790" Score="2" ViewCount="7723" Body="&lt;p&gt;Follow up to question and comments posted &lt;a href=&quot;https://dsp.stackexchange.com/questions/4889/how-do-i-calculate-snr-of-noisy-signal/4890&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The SNR calculation method posted as answers were implemented in matlab&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementation of Deve's answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% the starting and ending point of speech in samples obtain through Audacity;&#xA;% select a portion of the waveform where speech is seen to be present&#xA;begin_speech = 25400; end_speech = 26800; &#xA;&#xA;snr_before = mean( data_s(begin_speech:end_speech) .^2) / mean( data_n(begin_speech:end_speech) .^2); &#xA;db_snr_before = 10*log10( snr_before );     % same thing, but in dB&#xA;&#xA;% calculation on data after noise reduction follows: &#xA;residual_noise = data_s(begin_speech:end_speech) - output(begin_speech:end_speech); &#xA;snr_after = mean( data_s(begin_speech:end_speech) .^ 2)/mean( residual_noise .^ 2); &#xA;db_snr_after = 10*log10( snr_after );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;db_snr_before = 15.6853&#xA;db_snr_after = -22.0388&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Implementation of dspGuru's answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;begin_speech = 25400; end_speech = 26800;&#xA;&#xA;% before noise reduction &#xA;DB1 = 10*log10( var(data_n(begin_speech:end_speech))); &#xA;DB2 = 10*log10( var(data_s(begin_speech:end_speech))); &#xA;db_SNR_before = DB2 - DB1;&#xA;&#xA;% after noise reduction &#xA;[data_stnr, fs_stnr, nbits_stnr] = wavread('AdMStry_thru_nr.wav'); &#xA;Z = output(begin_speech:end_speech) - data_stnr(begin_speech:end_speech);  &#xA;db_residual_noise = 10*log10( var(Z) ); &#xA;db_speech = 10*log10( var(data_stnr(begin_speech:end_speech)));&#xA;db_SNR_after = db_speech - db_residual_noise;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;db_SNR_before = 15.6848    &#xA;db_SNR_after = 0.9252&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The begin_speech and end_speech represent those parts of the wavfile, in number of samples, where there is presence of speech for certain (obtained through audacity by observing the waveform directly)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the SNR less after passing through noise reduction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second method (dspGuru), to calculate SNR after noise reduction, to get the Signal value on the numerator, I have passed just the pure speech through the noise reduction algorithm as well. If I do the same thing in the first (Deve) method, the results of the two methods become almost equal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this happening? Why is SNR after less than SNR_before ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of the waveforms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qhUyY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3121" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-08-07T22:59:01.933" Title="SNR calculation confusion" Tags="|matlab|snr|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5953" PostTypeId="2" ParentId="5945" CreationDate="2012-11-09T18:59:36.070" Score="1" Body="&lt;p&gt;Most lossy stereo encoders (MP3, AAC, etc) operate in a joint-stereo mode, i.e. there will be a lot of cross talk between the two channels specifically at higher frequencies and in general they will allocate more bits to the sum then do to difference in the channels which also introduces cross talk.&#xA;The amount of cross talk will depend heavily on the signal and the bit rate. There isn't an east metric for it.&#xA;Subtracting the decoded version from the original is also not a great idea since you can't easily distinguish the encoding/decoding artifacts from the cross talk.  &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-11-09T18:59:36.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5954" PostTypeId="1" CreationDate="2012-11-10T06:25:50.220" Score="5" ViewCount="2090" Body="&lt;p&gt;In the image analysis literature there are a variety of ways people show the usefulness of their method. For example, performance on an ideal signal corrupted by noise, an artificial signal encompassing a range of relevant structures, or real world images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are some commonly used test image sets for the following methods?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Line and edge detection&lt;/li&gt;&#xA;&lt;li&gt;Corner and junction detection&lt;/li&gt;&#xA;&lt;li&gt;Segmentation&lt;/li&gt;&#xA;&lt;li&gt;Optical flow&lt;/li&gt;&#xA;&lt;li&gt;English / Chinese character recognition&lt;/li&gt;&#xA;&lt;li&gt;Handwriting author recognition&lt;/li&gt;&#xA;&lt;li&gt;Stereo vision / image registration&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="53" LastEditDate="2012-11-11T01:03:45.543" LastActivityDate="2012-11-13T08:20:57.867" Title="Commonly used test image sets" Tags="|computer-vision|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5955" PostTypeId="2" ParentId="5954" CreationDate="2012-11-10T09:43:44.543" Score="4" Body="&lt;p&gt;&lt;strong&gt;Segmentation&lt;/strong&gt; : &lt;a href=&quot;http://www.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/&quot; rel=&quot;nofollow&quot;&gt;Berkeley Segmentation Dataset and Benchmark&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Stereo&lt;/strong&gt; : &lt;a href=&quot;http://vision.middlebury.edu/stereo/data/&quot; rel=&quot;nofollow&quot;&gt;Middlebury Stereo Datasets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Shape from specular flow&lt;/strong&gt; - &lt;a href=&quot;http://www.cs.bgu.ac.il/~icvl/projects/project-sfsf.html&quot; rel=&quot;nofollow&quot;&gt;Shape from specular flow dataset&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, check out this link : &lt;a href=&quot;http://clickdamage.com/sourcecode/cv_datasets.php&quot; rel=&quot;nofollow&quot;&gt;http://clickdamage.com/sourcecode/cv_datasets.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-11-12T08:33:15.153" LastActivityDate="2012-11-12T08:33:15.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5956" PostTypeId="2" ParentId="5951" CreationDate="2012-11-10T13:47:31.857" Score="3" Body="&lt;p&gt;As Jason R has already mentioned in his comment, the noise reduction algorithm obviously introduces some amplification which renders the SNR estimates we proposed in our &lt;a href=&quot;https://dsp.stackexchange.com/questions/4889/how-do-i-calculate-snr-of-noisy-signal/4890&quot;&gt;earlier answers&lt;/a&gt; useless. This becomes clear if we look at how the SNR is calculated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x_k$ be the speech signal without noise and let $n_k$ be the noise. Then the SNR before noise reduction is&#xA;$$&#xA;\gamma_{before} = \frac{\sum x_k^2}{\sum n_k^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the noise reduction (NR) is applied to both signals yielding the pure speech signal after NR $\tilde{y}_k \neq x_k$.  Applying NR to the noisy signal produces some new signal $y_k + \tilde{n}_k$. As can be seen from your screenshots $y_k \neq \tilde{y}_k$. If we apply dspGurus method for calculating the SNR after NR we obtain&#xA;$$&#xA;\gamma_{after} = \frac{\sum \tilde{y}_k}{\sum [y_k - \tilde{y}_k + \tilde n_k]^2}&#xA;$$&#xA;The denominator not only conatins the residual noise but also an additional error $y_k - \tilde{y}_k$. This leads to a wrong estimation and a much lower SNR value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To overcome this problem, you could try to normalize the signals. This will be difficult, because obiously the NR algorithm scales the noisy and the noise free signal differently. If you've implemented the algorithm yourself, you should try to fix this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possible solution is to estimate the noise power in a region where the original signal contained silence and to calculate the total signal power in a region that contains noise &lt;em&gt;and&lt;/em&gt; signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take a region from the noisy signal after NR that only contains noise and calculate the mean power denoted as $\sigma_{n}^2$&lt;/li&gt;&#xA;&lt;li&gt;Take a region from the noisy signal after NR that contains noise and speech and calculate the mean power denoted as $\sigma_{n,s}^2$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now the SNR after NR can be estimated as&#xA;$$&#xA;\gamma_{after} = \frac{\sigma_{n,s}^2 - \sigma_{n}^2}{\sigma_{n}^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How good this estimation is, depends on how good the following prerequisites are fulfilled in your case:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A large number of samples should be used to calculate the mean powers. You used 1401, that's not much.&lt;/li&gt;&#xA;&lt;li&gt;Noise and signal after NR have to be uncorrelated. The NR algorithm possibly introduces noise that is a function of the signal. So this condition might not be fulfilled.&lt;/li&gt;&#xA;&lt;li&gt;The mean noise power should be constant over time. I think this is fulfilled.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-11-10T13:47:31.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5957" PostTypeId="1" CreationDate="2012-11-10T15:27:25.083" Score="1" ViewCount="1417" Body="&lt;p&gt;How do I estimate if in recorded sound samples is present an echo caused from walls reflection ? &#xA;(maybe there are multiples echoes: delayed, attenuated versions of the signal itself).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm recording several sound samples in my room and I suppose that in the recorded audio samples is present an echo image of the original sound. &#xA;How do I verify if this is true and in case, how can I calculate the samples delay (ms echo reflection time from the walls) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plot the cross-correlation of the samples with itself (xcorr in MATLAB, about 40000 samples, ~1 second) but I don't know which pattern to look for to check if one or more echoes are present. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aDA3v.png&quot; alt=&quot;xcorr&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I can understand the presence of the max peak in the middle of the graph, what are all the others equally spaced peaks on the both sides of the xcorr plot ? &#xA;Eventually, how do I estimate the echo parameters from the recorderd samples (ms delay or samples delay) ?&lt;/p&gt;&#xA;" OwnerUserId="1884" LastEditorUserId="1884" LastEditDate="2012-11-12T11:26:51.070" LastActivityDate="2012-11-12T11:26:51.070" Title="How identify echo patterns in audio samples" Tags="|audio|autocorrelation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5958" PostTypeId="2" ParentId="5957" CreationDate="2012-11-10T17:02:33.760" Score="2" Body="&lt;p&gt;Try limiting the max lag of the xcorr based on the largest delay that you care about.&lt;/p&gt;&#xA;" OwnerUserId="3259" LastActivityDate="2012-11-10T17:02:33.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5959" PostTypeId="1" AcceptedAnswerId="6178" CreationDate="2012-11-10T20:26:57.753" Score="17" ViewCount="15442" Body="&lt;p&gt;How do I add odd or even harmonics to a floating point signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to use tanh or sin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do is achieve some very simple distortion effects, but I'm having a hard time finding exact references. What I'd like is something similar to what the &lt;a href=&quot;http://www.mercenary.com/culturevulture.html&quot;&gt;Culture Vulture&lt;/a&gt; does by adding odd and even harmonics in its pentode and triode settings.  The float value is a single sample in a sample flow. &lt;/p&gt;&#xA;" OwnerUserId="3260" LastEditorUserId="15347" LastEditDate="2018-11-06T09:45:58.133" LastActivityDate="2018-11-06T09:45:58.133" Title="Add odd/even harmonics to signal?" Tags="|audio|signal-detection|c|distortion|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="5960" PostTypeId="2" ParentId="5957" CreationDate="2012-11-10T21:20:43.463" Score="3" Body="&lt;p&gt;The side peaks could be the result of periodic structure in your input signal (say around on the order of 8-10Hz, plus a 2nd harmonic).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are creating the sound samples, try playing pseudo-random noise, which has good autocorrelation properties for a long enough sample, notably tight peaks &amp;amp; aperiodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2nd John's answer. You can do a back-of-the-envelope estimate of the max echo lag (assume a few reflections) using the speed of sound &amp;amp; room size.&lt;/p&gt;&#xA;" OwnerUserId="3261" LastActivityDate="2012-11-10T21:20:43.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5962" PostTypeId="1" CreationDate="2012-11-11T08:52:06.550" Score="1" ViewCount="268" Body="&lt;p&gt;I am dealing with a problem where I need to make a decision on a 500khz  signal under 100usec. The signal is noisy and I am detecting a peak in the incoming signal. Currently I do a 7 step mean filter (down sample by 7) and a moving average of 8 taps following that. This delays my signal 56 samples roughly 112 usec. (2 usec* 7 * 8) If I reduce the filter taps the noise starts to confuse my detector and it starts to fail. Noise is white Gaussian noise, there are no dominant frequencies in the noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not just interested in the presence of the peak (that would have been a simpler problem) but I am also interested in rise and fall time of the peak. The peak base duration could be between 50 samples (100uSec) to 5,000 samples (10msec). In slow cases the decision speed doesn't matter but in high speeds, the decision speed does make a difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current detector is crude but very efficient. I basically look back filtered signals in time to see if certain thresholds are met or not to make a decision if there is a peak. Once I suspect there is a peak, I find the rise and fall time. This whole operation takes less than 50usec and very optimized. I loose another 100usec in time due to filter memory and I wanted to see if I could get a better detector design. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have considered several options, such as derivative of the signal (gave up due to noise), matched filter (due to wide frequency range, difficult to design a filter that would work well etc.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for ideas to optimize my decision time from its 150usec to 100usec range by reducing the filter delay but not impacting the filter quality.  &lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2012-11-17T10:17:58.110" LastActivityDate="2012-11-17T10:17:58.110" Title="Effective filter with small tap size" Tags="|filters|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="5963" PostTypeId="1" AcceptedAnswerId="5964" CreationDate="2012-11-11T09:23:12.480" Score="3" ViewCount="1901" Body="&lt;p&gt;I read that SVM is a supervised learning method, it is also a non-probabilistic binary linear classifier. I understand why it is binary because it classifies our training pattern to two classes $w_1$ and $w_2$ which are labeled as $y_i=+ 1$ and $-1$. And I understand why it is linear because it classifies when the classes are linearly separable. But I don't understand the non-probabilistic part, could someone clarify?&lt;/p&gt;&#xA;" OwnerUserId="89" LastActivityDate="2012-11-11T11:12:06.937" Title="Support Vector Machine: A non-probabilistic binary linear classifier" Tags="|classification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5964" PostTypeId="2" ParentId="5963" CreationDate="2012-11-11T11:12:06.937" Score="3" Body="&lt;p&gt;It can be said that, it is not based on a &lt;em&gt;generative model&lt;/em&gt; which models the generation process of the data and itself a probabilistic model. SVM is based on a minimization problem, which seeks for a hyperplane that optimally separates data points of two clusters given the labels. There is nothing probabilistic in this formulation. You just formulate an optimization problem and solve it via Lagrange multipliers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I heard (but not studied) that, there are probabilistic SVMs, maybe if you study them, you can see the difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, at the fundamentals, authors talk about probabilistic notions, such as risk minimization, however at the macro scale, there is no probabilistic notion.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastActivityDate="2012-11-11T11:12:06.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5965" PostTypeId="2" ParentId="4758" CreationDate="2012-11-11T13:48:14.907" Score="1" Body="&lt;p&gt;I recommend &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470749644&quot; rel=&quot;nofollow&quot;&gt;Video Tracking: Theory and Practice &lt;/a&gt; as comprehensive overview of what have been done in this area for last 15 years. Also, &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/3642017312&quot; rel=&quot;nofollow&quot;&gt;3D Computer Vision: Efficient Methods and Applications&lt;/a&gt; for quick understanding useful algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This books will be a good start, but when you have enough knowledge, you should start looking into research papers, because information there is more updated than in books.&lt;/p&gt;&#xA;" OwnerUserId="1899" LastActivityDate="2012-11-11T13:48:14.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5966" PostTypeId="1" AcceptedAnswerId="5970" CreationDate="2012-11-11T14:14:16.837" Score="3" ViewCount="1585" Body="&lt;p&gt;I have the moving-average mask as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   mask = [1 1 1; 1 1 1; 1 1 1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then I compute the convolution 3 times&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   imageF = conv2(conv2(conv2(originalImage, mask), mask), mask);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to know how can I get an equivalent mask to compute the filter with just one convolution&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   imageF = conv2(originalImage, equivMask);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3262" LastEditorUserId="3262" LastEditDate="2012-11-11T16:02:07.487" LastActivityDate="2012-11-11T18:54:38.103" Title="Equivalent 2D mask of moving-average" Tags="|image-processing|lowpass-filter|moving-average|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5967" PostTypeId="1" AcceptedAnswerId="5972" CreationDate="2012-11-11T14:19:58.307" Score="11" ViewCount="6324" Body="&lt;p&gt;I read in my book (statistical pattern classification by Webb and Wiley) in the section about SVMs and linearly non-separable data:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In many real-world practical problems there will be no linear boundary separating the&#xA;  classes and the problem of searching for an optimal separating hyperplane is meaningless.&#xA;  Even if we were to use sophisticated feature vectors, $\Phi(x)$, to transform the data to a&#xA;  high-dimensional feature space in which classes are linearly separable, this would lead&#xA;  to an over-fitting of the data and hence poor generalization ability.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why transforming the data to a high-dimensional feature space  in which classes are linearly separable leads to overfitting and poor generalization ability? &lt;/p&gt;&#xA;" OwnerUserId="89" LastActivityDate="2012-11-11T23:12:57.820" Title="Why transforming the data to a high-dimensional feature space in which classes are linearly separable leads to overfitting?" Tags="|classification|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5968" PostTypeId="2" ParentId="5959" CreationDate="2012-11-11T14:32:29.227" Score="11" Body="&lt;p&gt;What you trying to achieve is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Distortion&quot;&gt;&lt;em&gt;distortion&lt;/em&gt;&lt;/a&gt;. This techniques used when you want to add some harmonics to given signal. You have 2 basic methods to do this: waveshaping and &lt;a href=&quot;http://en.wikipedia.org/wiki/Ring_modulation&quot;&gt;ring modulation&lt;/a&gt;.I'll try to explain first one.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Waveshaping&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Waveshaper&quot;&gt;Waveshaping&lt;/a&gt; allows you to make distortion via use of specially selected &lt;em&gt;function&lt;/em&gt;. One of useful methods is &lt;a href=&quot;http://en.wikipedia.org/wiki/Chebyshev_polynomials&quot;&gt;Chebyshev polynomials&lt;/a&gt;.&#xA;They have a very important property when filing through them harmonic signal with unit amplitude (for example, a sine wave), we obtain the same signal, only a few times higher. Frequency multiplier will depend on the order of the polynomial. All polynomials looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\ y = f(x) =d_0 + d_1x + d_2x^2 + d_3x^3 +… + d_Nx^N;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case, each element generates a harmonica, and then they all add up. View of each member is determined by the following recurrence relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T_{k+1}(x) = 2xT_k(x) – T_{k–1}(x);&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In it, each member is determined based on the previous one, it all begins with a zero, in our case it is equal to one, and the first, which is equal to x( but you can change it, ofcourse)&#xA;$$&#xA;T_0(x) = 1;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T_1(x) = x;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing them, you can determine the third and forth:&#xA;$$&#xA;T_2(x) = 2x*x – 1 = 2x^2 – 1;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T_3(x) = 2x(2x^2 – 1) – x = 4x^3 – 3x;&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you might guess, the second term - the first harmonic, and the third - the second and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another feature of the Chebyshev polynomials, when through them gives a signal whose amplitude is less than the unit, the output is less saturated sound with harmonics. This allows to create overdrive effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;After all, your signal is an array of floating points, you can choose any part of your array and apply to them Chebyshev polynomials, which will create additional harmonics.&lt;/em&gt; And using $sin$ functions will be good enough for this.&lt;/p&gt;&#xA;" OwnerUserId="1899" LastEditorUserId="1899" LastEditDate="2012-11-12T11:44:51.530" LastActivityDate="2012-11-12T11:44:51.530" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="5969" PostTypeId="2" ParentId="5967" CreationDate="2012-11-11T15:35:27.913" Score="2" Body="&lt;p&gt;Did you read further?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end of 6.3.10 section:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;However, there are often &lt;strong&gt;parameters of the kernel&lt;/strong&gt; that must be set&#xA;  and a &lt;strong&gt;poor choice&lt;/strong&gt; can lead to poor generalisation. The choice of&#xA;  best kernel for a given problem is not resolved and special kernels&#xA;  have been derived for particular problems, for example document&#xA;  classification&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which leads us to section 6.3.3:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;&lt;strong&gt;Acceptable kernels&lt;/strong&gt; must be expressible as an inner product in a&#xA;  feature space, which means that they must satisfy Mercer’s condition&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Kernel by their own quite difficult area, you can have large data where in different parts should apply different parameters, such as smoothing, but don't know exactly when. Therefore such thing is quite difficult to generalise.&lt;/p&gt;&#xA;" OwnerUserId="1899" LastActivityDate="2012-11-11T15:35:27.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5970" PostTypeId="2" ParentId="5966" CreationDate="2012-11-11T15:49:57.800" Score="7" Body="&lt;p&gt;Convolution in linear time-invariant system is asociative. So to get the equivalent mask you just need to convolve the kernel with itself twice. This will then then give you a 7x7 kernel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:1&amp;gt; a = [ 1 1 1 ; 1 1 1 ; 1 1 1 ]&#xA;a =&#xA;&#xA;   1   1   1&#xA;   1   1   1&#xA;   1   1   1&#xA;&#xA;octave:2&amp;gt; conv2(a,conv2(a,a))&#xA;ans =&#xA;&#xA;    1    3    6    7    6    3    1&#xA;    3    9   18   21   18    9    3&#xA;    6   18   36   42   36   18    6&#xA;    7   21   42   49   42   21    7&#xA;    6   18   36   42   36   18    6&#xA;    3    9   18   21   18    9    3&#xA;    1    3    6    7    6    3    1&#xA;&#xA;octave:3&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the original mask is not normalised - it has a gain of 9 at DC - so with three convolutions you get an overall gain of 9^3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on what you're trying to achieve though you might just be better off with a 7x7 Gaussian.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2012-11-11T18:54:38.103" LastActivityDate="2012-11-11T18:54:38.103" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="5971" PostTypeId="2" ParentId="5967" CreationDate="2012-11-11T22:34:21.550" Score="6" Body="&lt;p&gt;Let's say we are trying to find function that approximates set of 2D points on the plain using linear regression (which is essentially pretty much what SVM does). At 3 images below red crosses are observations (training data) and 3 blue lines represent equations with different degree of polynomial used for regression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zbNLd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First image is generated by linear equation. As you can see, it reflects points quite poorly. This is called &lt;strong&gt;underfitting&lt;/strong&gt;, because we gave learning algorithm too little &quot;degree of freedom&quot; (polynomial of too small degree). Second image is much better - we used polynomial of second degree and it looks pretty good. However, if we further increase &quot;degree of freedom&quot; we get 3rd image. Blue line at it comes right through the crosses, but do you believe that this line really describes dependency? I don't think so. Yes, on training set learning error (distance between crosses and the line) is very small, but if we add one more observation (say, from real data), most probably error for it will be much larger than if we used equation from second image. This effect is called &lt;strong&gt;overfitting&lt;/strong&gt; - we try to &lt;strong&gt;follow training data too closely&lt;/strong&gt; and get to troubles.&#xA;Using polynomials of a single variable is a simple example of kernel - instead of one dimension ($x$) we use several ($x$, $x^2$, $x^3$, etc.). You can see that translating data into higher-dimensional space may &lt;strong&gt;help to overcome underfit&lt;/strong&gt;, &lt;strong&gt;but&lt;/strong&gt; it can also &lt;strong&gt;lead to overfit&lt;/strong&gt;. The real challenge is to find what is &quot;just right&quot;.&#xA;Couple of tips for your further research in this topic. You can detect overfitting with procedure called &lt;strong&gt;cross validation&lt;/strong&gt;. In short, you split you data into, say, 10 parts, take 9 of them for training and 1 for validation. If error on validation set is much higher than on train set, then you've got overfit. Most machine learning algorithms use some parameters (e.g. parameters of kernels in SVM) that allow to overcome overfitting. Also, one popular keyword here is &lt;strong&gt;regularization&lt;/strong&gt; - modification of algorithm that directly affects optimization process, literally saying it &quot;don't follow training data too closely&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, I'm not sure that DSP is the right site for this kind of questions, probably you will be interested in visiting &lt;a href=&quot;https://stats.stackexchange.com/&quot;&gt;CrossValidated&lt;/a&gt; too.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2012-11-11T22:34:21.550" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5972" PostTypeId="2" ParentId="5967" CreationDate="2012-11-11T23:12:57.820" Score="9" Body="&lt;p&gt;@ffriend has a good post about it, but generally speaking, if you transform to a high dimensional feature space and train from there, the learning algorithm is 'forced' to take into account the higher-space features, even though they might have nothing to do with the original data, and offer no predictive qualities. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that you are not going to be properly generalizing a learning rule when training. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take an intuitive example: Suppose you wanted to predict weight from height. You have all this data, corresponding to people's weights and heights. Let us say that very generally, they follow a linear relationship. That is, you can describe weight (W) and height (H) as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;W = mH - b&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;, where $m$ is the slope of your linear equation, and $b$ is the y-intercept, or in this case, the W-intercept. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us say that you are a seasoned biologist, and that you &lt;em&gt;know&lt;/em&gt; that the relationship is linear. Your data looks like a scatter plot trending upwards. If you keep the data in the 2-dimensional space, you will fit a line through it. It might not hit &lt;em&gt;all&lt;/em&gt; the points, but thats ok - you know that the relationship is linear, and you want a good approximation anyway. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now lets say that you took this 2-dimensional data and transformed it into higher dimensional space. So instead of only $H$, you also add 5 more dimensions, $H^2$, $H^3$, $H^4$, $H^5$, and $\sqrt{H^2 + H^7}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you go and find co-efficients of the polynomial to fit this data. That is, you want to find co-efficients $c_i$ for the this polynomial that 'best fits' the data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;W = c_1H + c_2H^2 + c_3H^3 + c_4H^4 + c_5H^5 + c_6\sqrt{H^2+H^7}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do that, what kind of line would you get? You would get one that looked a lot like @ffriend 's far right plot. You have overfit the data, because you 'forced' your learning algorithm to take into account higher order polynomials that have nothing to do with anything. Biologically speaking, weight just depends on height linearly. It doesnt depend on $\sqrt{H^2 + H^7}$ or any higher order nonsense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why if you transform the data to higher order dimensions blindly, you run a very bad risk of overfitting, and not generalizing. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-11-11T23:12:57.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5973" PostTypeId="1" AcceptedAnswerId="5981" CreationDate="2012-11-12T00:58:03.790" Score="0" ViewCount="80" Body="&lt;p&gt;I have an interlaced image and I like to make a deinterlaced image out of it. Currently I just take average of two rows to create the missing row. Is there a better way to do this? What is the state of the art?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have the previous or the next frames, just this one. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2012-11-13T03:01:52.267" Title="Interlaced to De-interlaced" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5975" PostTypeId="1" CreationDate="2012-11-12T08:43:01.717" Score="8" ViewCount="223" Body="&lt;p&gt;I know that HOG is pretty state of the art for person detection, but in its original form HOG is only a detection method, and I don't believe it is particularly fast either (there is a significant speedup which takes the sliding window and rejects unlikely possibilities early, but it has been patented).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the current state of the art approach for determining the pose of a person (including close poses like a head shot, and hand shot, etc...), and for segmenting the person from the background? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The setting here is still images.&lt;/p&gt;&#xA;" OwnerUserId="566" LastActivityDate="2014-01-06T23:54:42.997" Title="What are the state of the art methods for person segmentation and person pose identification" Tags="|computer-vision|image-segmentation|face-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5977" PostTypeId="1" AcceptedAnswerId="5978" CreationDate="2012-11-12T14:35:03.013" Score="4" ViewCount="6257" Body="&lt;p&gt;Not sure if this is the proper place to ask this, but I'm sure someone here will know the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this &lt;a href=&quot;http://www.naturalpoint.com/trackir/02-products/trackir-product-comparison.html&quot; rel=&quot;nofollow&quot;&gt;optical camera&lt;/a&gt; (TrackIR 4), which, for what you can see on the table, samples images at a rate of 120 frames per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now how would you do a conversion from fps to Hertz to find out the frequency rate at which the camera samples data? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe it's a stupid question, but I wanna make sure I get the right value.&lt;/p&gt;&#xA;" OwnerUserId="3268" LastActivityDate="2012-11-14T18:59:49.427" Title="FPS to Hertz in a camera" Tags="|frequency|camera|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5978" PostTypeId="2" ParentId="5977" CreationDate="2012-11-12T15:06:11.267" Score="5" Body="&lt;p&gt;The physical definition of frequency is the number of oscillations per second and measured in Hertz (Hz) or more general: 1/(duration of one period of a periodic event in seconds). In your case the periodic event is a frame and it occurs 120 times per second so the frequency is 120 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to find out the sampling frequency of the ADC device in the camera you could calculate it like that:&#xA;$$&#xA;f_\mathrm{s} = N_\mathrm{pixel} \cdot R_\mathrm{frame}&#xA;$$&#xA;where $N_\mathrm{pixel}$ is the number of pixels in the sensor and $R_\mathrm{frame}$ is the frame rate. With the numbers from the data sheet I obtain a sampling frequency of 12.3 MHz. I can't tell if this is the actual frequency used by the camera. If it uses oversampling or interlacing the value could differ.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="29" LastEditDate="2012-11-14T18:59:49.427" LastActivityDate="2012-11-14T18:59:49.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5979" PostTypeId="1" AcceptedAnswerId="5980" CreationDate="2012-11-12T18:29:16.737" Score="13" ViewCount="19383" Body="&lt;p&gt;I am hoping someone can explain how to use the bag of words model to perform image classification using SIFT/SURF/ORB features and a support vector machine? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I can compute the SIFT feature vectors for an image, and have implemented a SVM, however am finding it hard to understand the literature on how use the bag of words model to 'vector quantize' the SIFT features and build histograms that give fixed size vectors, that can be used to train and test the SVM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any links to tutorials or literature on the topic is welcome, thanks&lt;/p&gt;&#xA;" OwnerUserId="3217" LastActivityDate="2015-03-18T19:30:48.693" Title="Image classification using SIFT features and SVM" Tags="|classification|sift|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5980" PostTypeId="2" ParentId="5979" CreationDate="2012-11-12T20:59:07.223" Score="17" Body="&lt;p&gt;If you could implement an SVM, you can quantize the features. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically the features are quantized using k-means clustering.  First, you decide what your &quot;vocabulary size&quot; should be (say 200 &quot;visual words&quot;), and then you run k-means clustering for that number of clusters (200).  The SIFT descriptors are vectors of 128 elements, i. e. points in 128-dimensional space. So you can try to cluster them, like any other points. You extract SIFT descriptors from a large number of images, similar to those you wish classify using bag-of-features. (Ideally this should be a separate set of images, but in practice people often just get features from their training image set.) Then you run k-means clustering on this large set of SIFT descriptors to partition it into 200 (or whatever) clusters, i. e. to assign each descriptor to a cluster. k-means will give you 200 cluster centers, which you can use to assign any other SIFT descriptor to a particular cluster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you take each SIFT descriptor in your image, and decide which of the 200 clusters it belongs to, by finding the center of the cluster closest to it.  Then you simply count how many features from each cluster you have.  Thus, for any image with any number of SIFT features you have a histogram of 200 bins.  That is your feature vector which you give to the SVM.  (Note, the term features is grossly overloaded).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I recall, there was a lot of work done concerning how these histograms should be normalized.  I might be wrong, but I seem to recall a paper that claimed that a binary feature vector (i. e. 1 if at least 1 feature from this cluster is present, and 0 otherwise) worked better than a histogram.  You would have to check the literature for details, and the details are important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; The Computer Vision System Toolbox for MATLAB now provides &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/image-category-classification-using-bag-of-features.html&quot; rel=&quot;nofollow&quot;&gt;the bag of features functionality&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2015-03-18T19:30:48.693" LastActivityDate="2015-03-18T19:30:48.693" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="5981" PostTypeId="2" ParentId="5973" CreationDate="2012-11-12T21:00:08.663" Score="2" Body="&lt;p&gt;If you want to vertically upsample an image, one method possibility better than linear interpolation is to FFT, zero pad, and IFFT; or a similar process using the DCT/IDCT and/or sub-blocks of the image.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-11-12T21:00:08.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5982" PostTypeId="1" AcceptedAnswerId="6016" CreationDate="2012-11-12T21:06:48.170" Score="1" ViewCount="141" Body="&lt;p&gt;I have a set of samples from a signal. The signal is erratic in behaviour at the beginning but then it settles down and oscillates around the value of 100 (the frequency of oscillation is not necessarily a constant). Having settled down, the signal also begins to decay ever so slightly. Given that I only have samples for the beginning of the signal, how might I estimate the remaining samples in the signal until the point at which it flat-lines. That is, the point at which all consecutive samples will have a value of 100. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my samples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;3&#xA;84&#xA;200&#xA;130&#xA;106&#xA;80&#xA;70&#xA;65&#xA;66&#xA;73&#xA;78&#xA;92&#xA;105&#xA;120&#xA;120&#xA;103&#xA;94&#xA;79&#xA;72&#xA;73&#xA;78&#xA;93&#xA;101&#xA;109&#xA;108&#xA;104&#xA;90&#xA;81&#xA;78&#xA;79&#xA;80&#xA;97&#xA;101&#xA;104&#xA;100&#xA;92&#xA;87&#xA;82&#xA;87&#xA;99&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ayZEM.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1142" LastEditorUserId="1142" LastEditDate="2012-11-16T08:35:42.277" LastActivityDate="2012-11-16T08:35:42.277" Title="Establishing the function of a decaying signal" Tags="|frequency|signal-detection|statistics|estimation|approximation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5983" PostTypeId="2" ParentId="5973" CreationDate="2012-11-13T03:01:52.267" Score="0" Body="&lt;p&gt;You can use &lt;a href=&quot;http://prestospace.org/training/images/iccvg2004.pdf&quot; rel=&quot;nofollow&quot;&gt;image inpainting&lt;/a&gt;, or maybe algorithms from image demosaicing can also be used (AHD interpolation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach may incorporate half sizing (taking only even or odd lines), conversion to gradient domain, then doubling image height and conversion back to image domain. This is just a guess, maybe there is some work on the topic (intepolation in gradient domain).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-11-13T03:01:52.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5984" PostTypeId="1" CreationDate="2012-11-13T03:24:07.783" Score="4" ViewCount="532" Body="&lt;p&gt;I'm looking at a job spec, detailed below.   I'm perplexed as to what is being asked for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone offer a basic understanding of this material?   I can imagine a solution may involve performing an FFT, setting bins outside the desired frequency range to 0, modifying phase of remaining bins, and recombining with iFFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I am left scratching my head as to the purpose of this...&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Application is required to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A) input audio from external microphone jack input,&lt;br&gt;&#xA;B) bandpass filter to limit audio to between 50 to 500 Hz&lt;br&gt;&#xA;C) add phase delay between 150 degrees to 210 degrees (programmable via settings)&lt;br&gt;&#xA;D) output resultant audio stream via speaker phone or audio jack&lt;br&gt;&#xA;E) audio output volume to be calibrated to match audio input volume  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;User interface:&lt;br&gt;&#xA;A) two modes- configuration mode, normal mode.&lt;br&gt;&#xA;B) in configuration mode allow user to adjust phase delay and other audio    parameters, such as filter characteristics, gain and output volume.&lt;br&gt;&#xA;C) in configuration mode user can select audio output via speaker phone or external speakers.&lt;br&gt;&#xA;D) ability for user to disable incoming phone calls while app is running.  &lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2012-11-14T12:25:19.650" Title="What is a Phase Delay filter?" Tags="|fft|filters|phase|delay|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5986" PostTypeId="2" ParentId="5954" CreationDate="2012-11-13T08:20:57.867" Score="2" Body="&lt;p&gt;Collections of data sets for various computer vision tasks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.computervisiononline.com/datasets&quot; rel=&quot;nofollow&quot;&gt;http://www.computervisiononline.com/datasets&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cvpapers.com/datasets.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cvpapers.com/datasets.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="101" LastActivityDate="2012-11-13T08:20:57.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5988" PostTypeId="2" ParentId="5962" CreationDate="2012-11-14T02:16:24.280" Score="3" Body="&lt;p&gt;It is quite very difficult to give a correct answer, because you do not give the full information. But I will try.&#xA;One of standard way is using &quot;matching filter&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Matched_filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dspguide.com/ch17/3.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch17/3.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If length of your signal pattern is quite small (&amp;lt;50 usec) you can use this method.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2012-11-14T02:16:24.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="5989" PostTypeId="1" CreationDate="2012-11-14T02:45:40.920" Score="3" ViewCount="198" Body="&lt;p&gt;I am working on a pattern recognition problem to find two most similar rectangular regions in two given images. Specifically, I have two 2D (gray) images of the same sizes $I_A$ and $I_B$. Denote an arbitrary rectangular region in an image $I$ as $R^I(x_0,y_0,w,h)$, where $(x_0,y_0)$ denotes the upper left pixel of the rectangular of width $w$ and height $h$ and &#xA;$\forall i\in[0,w-1] \,\textrm{and} j\in [0,h-1],$,we have $ R^I(x_0,y_0,w,h)[i,j] = I[x_0+i,y_0+j]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is to find two rectangular regions of the same size, one in each image, (say they are $R^{I_A}(x^A_0,y^A_0,w,h)$ and $R^{I_B}(x^B_0,y^B_0,w,h)$) such that they are most similar in terms of the mean square error of theses two rectangular regions. Note it is possible to have $(x^A_0,y^A_0)\neq(x^B_0,y^B_0)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I want to answer this question for all possible $w,h$ combinations. It is very costly to compute even for a given pair of $w$ and $h$. So far, I adopt the integral image technique. However, it still requires shifting image pixels. I wonder whether there is some better technique. Can anyone help?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2012-11-15T22:58:38.510" Title="Is there any fast algorithm to compute the most similar rectangular regions in two images?" Tags="|image-processing|object-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5990" PostTypeId="2" ParentId="5989" CreationDate="2012-11-14T03:05:51.220" Score="1" Body="&lt;p&gt;I'm afraid, but the problem can only be solved by brute force (Calculate the correlation for all x0, y0, W, H). So it's very important to do the calculation fast. There is classical article - &lt;a href=&quot;http://scribblethink.org/Work/nvisionInterface/nip.pdf&quot; rel=&quot;nofollow&quot;&gt;J. P. Lewis &quot;Fast Normalized Cross-Correlation&quot;&lt;/a&gt;&#xA;Search for citation to this article too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Edit] You can achieve additional speed up by using some multiresolution techniques (image pyramid), but it is depend of nature of your images.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2012-11-14T15:18:12.313" LastActivityDate="2012-11-14T15:18:12.313" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="5991" PostTypeId="2" ParentId="5984" CreationDate="2012-11-14T12:25:19.650" Score="4" Body="&lt;p&gt;The thing you're looking for is known as an &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/All-pass_filter&quot; rel=&quot;nofollow&quot;&gt;all-pass filter&lt;/a&gt;&quot;, which has a flat amplitude response, but modifies the phase relationships within a signal. This would be a separate stage from the one that limits the bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the 50-500Hz bandpass filter is going to modify phase relationships, too, so the all-pass filter will need to be designed so that the overall system response is what the client is looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it's possible that the client just wants a time delay, but expressed it in terms of the phase angle of some fundamental frequency. This will need to be clarified.&lt;/p&gt;&#xA;" OwnerUserId="1996" LastActivityDate="2012-11-14T12:25:19.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="5992" PostTypeId="1" AcceptedAnswerId="6355" CreationDate="2012-11-14T18:35:13.913" Score="36" ViewCount="24778" Body="&lt;p&gt;During convolution on a signal, why do we need to flip the impulse response during the process?&lt;/p&gt;&#xA;" OwnerUserId="3277" LastEditorUserId="76" LastEditDate="2012-11-14T21:48:56.370" LastActivityDate="2022-05-22T21:56:16.387" Title="Flipping the impulse response in convolution" Tags="|convolution|impulse-response|" AnswerCount="6" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5993" PostTypeId="1" CreationDate="2012-11-14T18:44:58.930" Score="1" ViewCount="1645" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vTJh1.png&quot; alt=&quot;enter image description here&quot;&gt;I checked the earlier question on &quot;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1054/how-do-i-recover-the-signal-from-an-ecg-image&quot;&gt;How do I recover the signal from an ECG image&lt;/a&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/500Kg.jpg&quot; alt=&quot;Sample&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am trying to write a program to extract the x and y co-ordinates of an ECG signal embedded within the background grid . I was able to use the image from the earlier post and used some inbuilt functions to crop the image and convert the image to grayscale and then to binary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I did it: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Cropping the image and saving the co-ordinates &#xA;img=imcrop(imread('ecg_test.jpg'));&#xA;% select the boundries in the pop up window , hit on crop image to save the&#xA;% cropped image x,y co-ordinates&#xA;img1=rgb2gray(img);  % Converting the cropped image to grayscale&#xA;Bw=im2bw(img1,0.8);  % converting the grayscale image to binary image &#xA;imshow(Bw) ![cropped and binary image of the actual ecg_test.jpg][4]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to clean the image and then extract the co-ordinates of this image.  How do I implement the MATLAB part of: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = ColorConvert[&#xA;   ImagePad[&#xA;    Import[&quot;https://i.stack.imgur.com/500Kg.jpg&quot;], {{0, -20}, {0, 0}}],&#xA;    &quot;Grayscale&quot;];&#xA;&#xA;Image[&#xA; Transpose[Function[With[{m = Min[#]},&#xA;     Map[Function[{v}, If[v == m, 1, 0]], #]]] /@ &#xA;   Transpose[ImageData[img, &quot;Real&quot;]]&#xA;  ]&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3278" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-01-19T02:36:04.857" Title="How to extract the co-ordinates of an ECG signal from a scanned image" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5995" PostTypeId="1" CreationDate="2012-11-14T21:35:53.983" Score="49" ViewCount="21457" Body="&lt;p&gt;What is your best guess how Google Image Search works? I can upload a photo and can search for similar images. What algorithm does it use to identify similar images?&lt;/p&gt;&#xA;" OwnerUserId="3280" LastEditorUserId="26" LastEditDate="2012-11-15T12:49:31.213" LastActivityDate="2022-05-24T11:34:02.420" Title="What algorithm does Google use for its &quot;Search By Image&quot; site?" Tags="|image-processing|computer-vision|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="5997" PostTypeId="2" ParentId="5993" CreationDate="2012-11-15T08:19:44.167" Score="2" Body="&lt;p&gt;I believe this is an optimisation problem. E.g. what is the path from the left hand side of the image to the right hand of the image that is 'most black'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such 'rectangular shortest path' method would be ideal. You need to resample the image something like 10x to ensure that the method gets all the peaks properly, but in the end you will get something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PuGVU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a paper on circular shortest paths, but it is basically the same thing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://vision-cdc.csiro.au/changs/doc/sun-pallottino03pr2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://vision-cdc.csiro.au/changs/doc/sun-pallottino03pr2.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MATLAB script:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IM = imread('500Kg.jpg');&#xA;IM = rgb2gray(IM);&#xA;IM = double(IM);&#xA;&#xA;% Over sample 8 times in horizontal direction&#xA;% Amount to oversample is determined by maximum slope, e.g. if max slope is&#xA;% 16, oversample by 16.&#xA;IM2 = interp2(IM,linspace(1,size(IM,2),size(IM,2)*8),linspace(1,size(IM,1),size(IM,1))');&#xA;&#xA;% Calculate shortest path using 255 - image intensity as energy function&#xA;[spath,senergy,slastindex,im] = shortestPath(255-IM2',255,0,1,100);&#xA;&#xA;% Down sample path to account for original oversampling&#xA;p_x = 1:size(IM2,2);&#xA;p_x = p_x ./ 8;&#xA;p_y = spath(:,2);&#xA;&#xA;% Plot on top of original image&#xA;imagesc(IM); colormap gray; hold on; plot(p_x,p_y,'r'); hold off;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Shortest path function:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ p, e, l, im ] = shortestPath( m, opt, a, ax, bx  )&#xA;%SHORTESTPATH Summary of this function goes here&#xA;%   Detailed explanation goes here&#xA;&#xA;%Get size of matrix&#xA;[sy, sx] = size(m);&#xA;im = zeros(sy,sx);&#xA;&#xA;%Convert to value different from optimal&#xA;value = abs(opt - m);&#xA;&#xA;%Preallocate index matrix and energy matrix&#xA;lastindex = zeros(sy, sx);&#xA;energy = zeros(sy, sx);&#xA;&#xA;%Initialise first rows&#xA;energy(1,:) = value(1,:);&#xA;lastindex(1,:) = 1:sx;&#xA;&#xA;%Initialise temp matrix&#xA;t = zeros(1,3);&#xA;&#xA;%Loop through remaining rows&#xA;for row = 2:sy&#xA;    for col = ax:bx&#xA;        %Get the last energies and current values&#xA;        if col == ax &#xA;            t = [inf energy(row-1,col:(col+1))];&#xA;            cv = [inf value(row,col:(col+1))];&#xA;        elseif col == bx&#xA;            t = [energy(row-1,(col-1):col) inf];&#xA;            cv = [value(row,(col-1):col) inf];&#xA;        else&#xA;            t = energy(row-1,(col-1):(col+1));&#xA;            cv = value(row,(col-1):(col+1));&#xA;        end&#xA;&#xA;        %Add energy for moving&#xA;        t = t + [a 0 a];&#xA;&#xA;        %Add energy from difference from optimum&#xA;        t = t + cv;&#xA;&#xA;        %Find minimum&#xA;        [v,i] = min(t);&#xA;&#xA;        %Save new values&#xA;        energy(row,col) = v;&#xA;        lastindex(row,col) = col + i - 2;&#xA;&#xA;    end&#xA;end&#xA;&#xA;[v,li] = min(energy(sy,ax:bx));&#xA;li = ax + li - 1;&#xA;p(sy,:) = [sy li];&#xA;im(sy,li) = 1;&#xA;for row = (sy-1):-1:1&#xA;    i = lastindex(row,li);&#xA;    p(row,:) = [row,i];&#xA;    im(row,i) = 1;&#xA;    li = i;&#xA;end&#xA;&#xA;e = energy;&#xA;l = lastindex;&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2013-01-19T02:36:04.857" LastActivityDate="2013-01-19T02:36:04.857" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="5999" PostTypeId="2" ParentId="5995" CreationDate="2012-11-15T13:41:25.050" Score="30" Body="&lt;p&gt;I don't know which algorithm Google uses. But, since you wanted a best guess, let me give some ideas on &lt;strong&gt;how a similar system could be constructed&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The whole field dealing with search-image-base-by-image is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Content-based_image_retrieval&quot; rel=&quot;nofollow noreferrer&quot;&gt;Content Based Image Retrieval (CBIR)&lt;/a&gt;. The idea is somehow to construct an image representation (not necessarily understandable by humans) that &lt;em&gt;contains the information about image content&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Two basic approaches exist:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;retrieval using low-level (local) features: color, texture, shape at specific parts of images (an image is a collection of descriptors of &lt;em&gt;local&lt;/em&gt; features)&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;semantic&lt;/em&gt; approaches where an image is, in some way, represented as a collection of objects and their relations&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Low-level local approach&lt;/strong&gt; is very well researched. The best current approach extracts local features (there's a choice of feature extraction algorithm involved here) and uses their local descriptors (again, choice of descriptors) to compare the images.&lt;/p&gt;&#xA;&lt;p&gt;In newer works, the local descriptors are clustered first and then clusters are treated as &lt;em&gt;visual words&lt;/em&gt; -- the technique is then very similar to Google document search, but using &lt;em&gt;visual words&lt;/em&gt; instead of letter-words.&lt;/p&gt;&#xA;&lt;p&gt;You can think of visual words as equivalents to word roots in language: for example, the words: &lt;em&gt;work, working, worked&lt;/em&gt; all belong to the same word root.&lt;/p&gt;&#xA;&lt;p&gt;One of the drawbacks of these kinds of methods is that they usually under-perform on low-texture images.&lt;/p&gt;&#xA;&lt;p&gt;I've already given and seen a lot of answers detailing these approaches, so I'll just provide links to those answers:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;CBIR: &lt;a href=&quot;https://stackoverflow.com/a/10041801/884412&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://stackoverflow.com/q/10272017/884412&quot;&gt;2&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;feature extraction/description: &lt;a href=&quot;https://dsp.stackexchange.com/q/1433/1273&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/a/2466/1273&quot;&gt;2&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/1288/what-are-some-free-alternatives-to-sift-surf-that-can-be-used-in-commercial-app&quot;&gt;3&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/4893/scale-and-rotation-invariant-feature-descriptors/4894#4894&quot;&gt;4&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Semantic approaches&lt;/strong&gt; are typically based on hierarchical representations of the whole image. These approaches have not yet been perfected, especially for the general image types. There is some success in applying these kind of techniques to specific image domains.&lt;/p&gt;&#xA;&lt;p&gt;As I am currently in the middle of research of these approaches, I can not make any conclusions. Now, that said, I explained a general idea behind these techniques in &lt;a href=&quot;https://dsp.stackexchange.com/a/3605/1273&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Once again, shortly: the general idea is to represent an image with a tree-shaped structure, where leaves contain the image details and objects can be found in the nodes closer to the root of such trees. Then, somehow, you compare the sub-trees to identify the objects contained in different images.&lt;/p&gt;&#xA;&lt;p&gt;Here are some references for different tree representations. I did not read all of them, and some of them use this kind of representations for segmentation instead of CBIR, but still, here they are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;binary partition trees and mention of min/max trees: &lt;a href=&quot;https://doi.org/10.1109/MSP.2009.934154&quot; rel=&quot;nofollow noreferrer&quot;&gt;P. Salembier, M.H.F Wilkinson: Connected Operators&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;binary partition trees: &lt;a href=&quot;https://doi.org/10.1109/TIP.2008.2002841&quot; rel=&quot;nofollow noreferrer&quot;&gt;V. Vilaplana, F. Marques, P. Selembier: Binary Partition Trees for Object Detection&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;tree of shapes (component tree): &lt;a href=&quot;https://doi.org/10.1109/83.841532&quot; rel=&quot;nofollow noreferrer&quot;&gt;P. Monasse, F. Guichard: Fast Computation of Contrast-Invariant Image Representation&lt;/a&gt;, &lt;a href=&quot;https://doi.org/10.1051/cocv:2002069&quot; rel=&quot;nofollow noreferrer&quot;&gt;C. Ballester, V. Castellis, P. Monasse: The Tree of Shapes of an Image&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;monotonic trees: &lt;a href=&quot;https://doi.org/10.1007/s00530-002-0067-y&quot; rel=&quot;nofollow noreferrer&quot;&gt;Y. Song, A. Zhang: Analyzing scenery images by monotonic tree&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;edit:&lt;/strong&gt; further digging shows that &lt;em&gt;tree of shapes&lt;/em&gt; and &lt;em&gt;monotonic tree&lt;/em&gt; are &lt;em&gt;equivalent&lt;/em&gt;, except processing the image in 4-/8- (tree of shapes) or 6-connectivity (monotonic)&lt;/li&gt;&#xA;&lt;li&gt;extrema-watershed tree: &lt;a href=&quot;http://urlib.net/dpi.inpe.br/ismm@80/2007/03.02.08.07&quot; rel=&quot;nofollow noreferrer&quot;&gt;A. Vichik, R. Keshet, D. Malah: Self-dual morphology on tree semilattices and applications&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;constrained connectivity, alpha-trees, ultrametric waterseads: &lt;a href=&quot;https://doi.org/10.1007/978-3-642-32313-3_4&quot; rel=&quot;nofollow noreferrer&quot;&gt;P. Soille, L. Najman: On morphological hierarchical representations for image processing and spatial data clustering&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="7092" LastEditDate="2022-05-24T11:34:02.420" LastActivityDate="2022-05-24T11:34:02.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6000" PostTypeId="1" CreationDate="2012-11-15T02:21:45.963" Score="13" ViewCount="4993" Body="&lt;p&gt;I am trying, for my own learning purposes, to develop an implementation of an algorithm that would list books, given an image of a bookshelf like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IaLQk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step is to slice the image into individual books. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My algorithm, in &lt;em&gt;Mathematica&lt;/em&gt;, is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    img = ColorConvert[Import[&quot;https://i.stack.imgur.com/IaLQk.jpg&quot;], &quot;GrayScale&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;do a basic edge detection &amp;amp;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;remove the text and try to keep the long lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;edge = DeleteSmallComponents[EdgeDetect[img, 3],Last[ImageDimensions[img]]/5]&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;then remove unwanted horizontal lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lines = Sort[ImageLines[img5] /. {{0., _}, {_, _}} -&amp;gt; Sequence[]]&#xA;Show[img, Graphics[{Thick, Orange, Line /@ lines}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The results, though, are less than great:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O1qQY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can I improve this to yield better results?&lt;/li&gt;&#xA;&lt;li&gt;Is there a smarter way to do this?&lt;/li&gt;&#xA;&lt;li&gt;how further should I process the images to increase accuracy at the (later) OCR phase?&lt;/li&gt;&#xA;&lt;li&gt;How to use the color information to improve the segmentation?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3295" OwnerDisplayName="Oren Pinsky" LastActivityDate="2024-02-21T21:40:45.950" Title="Slicing and Recognition of book title and author from bookshelf image" Tags="|opencv|computer-vision|image-segmentation|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6001" PostTypeId="1" CreationDate="2012-11-15T14:58:07.207" Score="3" ViewCount="1177" Body="&lt;p&gt;I need to write a MATLAB function to estimate the best initial sampling point for demodulation of a 16-QAM. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do it by looking at the eye diagram, the point which at which the eye is &quot;open&quot;, but can this be done in MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="3284" LastEditorUserId="76" LastEditDate="2012-11-19T14:53:19.780" LastActivityDate="2012-11-19T14:53:19.780" Title="Estimating optimum sampling point for 16-QAM in MATLAB" Tags="|matlab|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6002" PostTypeId="2" ParentId="6001" CreationDate="2012-11-15T15:03:29.900" Score="4" Body="&lt;p&gt;An eye diagram can be created by just framing up your QAM signal (probably after matched filtering), where the frame length is the number of samples per QAM symbol. In MATLAB, this is very simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = output_of_matched_filter;&#xA;N = number_of_samples_per_symbol;&#xA;eye = reshape(x,N,[]);&#xA;% &quot;eye&quot; now is a two-dimensional matrix, with each column containing one trace&#xA;% to plot on the eye diagram. you can then plot all of the traces with:&#xA;plot(eye);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One note: the call to &lt;code&gt;reshape&lt;/code&gt; requires that the length of &lt;code&gt;x&lt;/code&gt; is a multiple of &lt;code&gt;N&lt;/code&gt;. If it isn't already, you'll need to slice the array to make it true:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nsyms = floor(length(x)/N);&#xA;eye = reshape(x(1:nsyms*N),N,nsyms);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-11-15T15:03:29.900" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6003" PostTypeId="1" AcceptedAnswerId="6009" CreationDate="2012-11-15T15:24:16.880" Score="2" ViewCount="2651" Body="&lt;p&gt;I read some articles about PCA and I think the nice way to summarize it is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is a way of identifying patterns in data, and expressing the data in such a way as to highlight their similarities and differences.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So in my code, we subtract the initial data from the mean and find principal components, then  we multiply the data by a variable called e as for our dimension reduction purposes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand here is that When we want to highlight the similarities and differences, it happens both about noise data, the data which is too big or too small, will be soften. What about the edges in our image? Will the same thing happen to those data? I mean, when we have a change of color from white to black and we don't want to lose such information, will PCA soften the data as well as noise? If yes, this is not what we want, is it? Is there a solution to solve this problem ?&lt;/p&gt;&#xA;" OwnerUserId="89" LastActivityDate="2012-11-16T00:52:27.597" Title="A feature extraction method: Principal Component Analysis (PCA)" Tags="|image-processing|local-features|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6005" PostTypeId="2" ParentId="69" CreationDate="2012-11-15T18:01:20.630" Score="18" Body="&lt;p&gt;Additional to Peter's answer, there is another reason which is also related to the eigenfunction. That's, $e^{kx}$ is the eigenfunction of the differential operator $\frac{d^n}{dx^n}$. That's why Fourier transform (corresponding to pure imaginary $k$) and Laplace transform (corresponding to complex $k$) can be used to solve differential equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $e^{kx}$ is the eigenfunction of both convolution and differential operator, maybe that's one the of the reasons why LSIV system can be represented by differential equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: As a matter of fact, differential (and integral) operators are LSIV operators, see &lt;a href=&quot;https://mathoverflow.net/questions/2809/intuition-for-integral-transforms/2829#2829&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1641" LastEditorUserId="-1" LastEditDate="2017-04-13T12:57:54.877" LastActivityDate="2015-01-31T06:16:12.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6006" PostTypeId="1" CreationDate="2012-11-15T18:34:51.340" Score="3" ViewCount="397" Body="&lt;p&gt;I am trying to model a robot (my &lt;a href=&quot;https://robotics.stackexchange.com/questions/436/how-do-i-model-a-robot&quot;&gt;question in robotics.SE&lt;/a&gt;), so that I may train it using some reinforcement learning techniques. I was wondering if I can compute an impulse response of a four wheel robotic chassis &lt;em&gt;empirically&lt;/em&gt;? Or something similar that might help me model the robot. Does a thing like 'the impulse response of a robot' even make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since a single strobe of a PWM signal shall hardly cause any movement, but a steady stream of PWM signals will, can I consider the impulse response as an infinite impulse response that superposition to cause perceivable motion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am certain that the robot chassis is a non-linear system. Generally speaking, will impulse response make any sense on a non-linear system?&lt;/p&gt;&#xA;" OwnerUserId="842" LastEditorUserId="-1" LastEditDate="2017-04-13T12:49:17.937" LastActivityDate="2013-03-23T22:48:14.373" Title="How do I compute the impulse response of a robot?" Tags="|impulse-response|linear-systems|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6007" PostTypeId="2" ParentId="4886" CreationDate="2012-11-15T19:07:38.110" Score="2" Body="&lt;p&gt;I have good experience with a very simple method to find the sign changes in signal at times:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a=diff(sign(signal)) !=0 # this detects the sign changes&lt;/li&gt;&#xA;&lt;li&gt;candidates=times[a] # these are all the candidate points, including the false crossings&lt;/li&gt;&#xA;&lt;li&gt;find clusters of points in candidates&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;average/median each cluster, this is your sign change&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;do correlation with step function at point predicted by 4&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;fit curve to correlation results and find peak&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In my case 5 and 6 don't increase the precision of the method. You can dither your signal with noise and see if it helps.&lt;/p&gt;&#xA;" OwnerUserId="3286" LastActivityDate="2012-11-15T19:07:38.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6008" PostTypeId="2" ParentId="5995" CreationDate="2012-11-15T19:12:02.593" Score="22" Body="&lt;p&gt;In  addition to the answer of penelope, there are two approaches, perceptual hashing and the bag-of-words model whose basic functionality is easily implemented and are therefor nice to play with or to learn from, before venturing into more advanced territory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Perceptual hashing&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perceptual hashing algorithms aim to construct a hash, that unlike a cryptographic hash, will give similar, or near similar hash values for identical images that have been slightly distorted for example by scaling or JPEG compression. They serve a useful purpose in detection near duplicates in an image collection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In its most basic form, you can implement this as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert image to grayscale &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make your image zero mean &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Crush your image down to thumbnail size, say [32x32] &lt;/li&gt;&#xA;&lt;li&gt;Run the two dimensional Discrete Cosine Transform&lt;/li&gt;&#xA;&lt;li&gt;Keep the top left [8 x 8], most significant low frequency components &lt;/li&gt;&#xA;&lt;li&gt;Binarize the block, based on the sign of the components&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The result is a resilient 64 bit hash, because it is based on the low frequency components of the image. A variant on this theme would be to divide each image into 64 subblocks and compare the global image mean to the local subblock mean and write out a 1 or 0 accordingly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perceptual hashing is implemented for example by &lt;a href=&quot;http://www.phash.org&quot;&gt;phash&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bag-of-words model&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bag-of-words model aims to semantically identify an image, e.g. all images with dogs in them. It does this by using certain image patches in the same spirit that one would classify a text document based on the occurrence of certain words.  One could categorize the words, say &quot;dog&quot; and &quot;dogs&quot; and store them as identifier in an inverted file where the &quot;dog&quot; categorie now points to all documents containing either &quot;dog&quot; or &quot;dogs&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In its most, most simple form, one can do this with images as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Deploy the so called SIFT features, for example using the excellent &lt;a href=&quot;http://www.vlfeat.org&quot;&gt;vlfeat&lt;/a&gt; library, which will detect the SIFT feature points and a SIFT descriptor per point. This descriptor is basically a smartly constructed template of the image patch surrounding that feature point. These descriptors are your raw words. &lt;/li&gt;&#xA;&lt;li&gt;Gather SIFT descriptors for all relevant images&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You now have a huge collection of SIFT descriptors. The problem is, is that even from near identical images, there will be some mismatch between descriptors. You want to group the identical ones together more or less like treating some words, as &quot;dog&quot; and &quot;dogs&quot; as identical and you need to compensate for errors. This is where clustering comes in to play.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take all SIFT descriptors and cluster them, for example with an algorithm like k-means. This will find a pre determined number of clusters with centroids in your descriptor data. These centroids are your new visual words. &lt;/li&gt;&#xA;&lt;li&gt;Now per image and its original found descriptors, you can look at the clusters these descriptors were assigned to. From this, you know wich centroids or visual words 'belong' to your image. These centroids or visual words become the new semantic descriptor of your image which can be stored in an inverted file. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;An image query, e.g find me similar images to the query-image, is then resolved as follows: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the SIFT points and their descriptors in the query image&lt;/li&gt;&#xA;&lt;li&gt;Assign the query descriptors to the centroids you earlier found in the enrollment phase. You now have a set of centroids or visual words that pertain to your query image&lt;/li&gt;&#xA;&lt;li&gt;Match the query visual words to visual words in your inverted file and return the matching images&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="420" LastEditorUserId="420" LastEditDate="2012-11-23T22:55:13.733" LastActivityDate="2012-11-23T22:55:13.733" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6009" PostTypeId="2" ParentId="6003" CreationDate="2012-11-15T20:16:48.497" Score="2" Body="&lt;p&gt;Ok, it sounds like you are trying to do eigenfaces, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, you have to think of your face images as points in a very high-dimensional space. For example, if your images are 32x32, then the space has 32 * 32 = 1024 dimensions.  Operating in so many dimensions is very difficult, because distances between points become almost meaningless.  With so many dimensions any point is very far away from any other point, even if the two points represent the same face.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why you want to reduce the dimensionality, and PCA is one way to do it. If you go from 1024 dimensions to, say, 10, then the distances will become more meaningful, which fits in with your idea of &quot;highlight their similarities and differences&quot;.  However, PCA by itself will not tell you of any patterns in your data, beyond the directions of greatest variance.  PCA will project your data into a lower-dimensional space with decorrelated axes, but you have to do more work to actually discover the patterns in the data, such as train a classifier, or run a clustering algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to understand what happens to the edges and transitions from light to dark, you have to display your eigenvectors as images and look at them. You will see that you don't really preserve the precise edge information, but you do keep course-level information about light and dark areas.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2012-11-15T20:16:48.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6011" PostTypeId="2" ParentId="6000" CreationDate="2012-11-15T21:16:21.133" Score="7" Body="&lt;p&gt;Here is the link to a research paper that tries to do the same thing as you wanted. It might help you.&lt;a href=&quot;http://www.stanford.edu/~dmchen/documents/SPIE2010_BookSpineRecognition.pdf&quot;&gt;using image features&lt;/a&gt;&#xA;Also a cool video on the &lt;a href=&quot;http://www.youtube.com/watch?feature=player_embedded&amp;amp;v=_R_Ha3YwFp0&quot;&gt;youtube&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3288" LastActivityDate="2012-11-15T21:16:21.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6012" PostTypeId="1" AcceptedAnswerId="6018" CreationDate="2012-11-15T22:39:38.430" Score="3" ViewCount="23165" Body="&lt;p&gt;I asked google and I've tried to find something in the API of OpenCV, but hadn't any good hints on split and merge image segmentation method. &#xA;I want to test it, if it's working better than my proposed method which I posted a while ago here on SP.&#xA;Do you know if there exists a free library or OpenCV extension for this segmentation method?&#xA;Any good hints for writing it fast by myself are welcome, if there is no available solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;kind regards&lt;/p&gt;&#xA;" OwnerUserId="1923" LastEditorUserId="1923" LastEditDate="2012-11-15T22:47:18.587" LastActivityDate="2012-11-23T07:42:54.270" Title="Split and Merge image segmentation algorithm in OpenCV" Tags="|image-processing|opencv|image-segmentation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6013" PostTypeId="2" ParentId="5989" CreationDate="2012-11-15T22:58:38.510" Score="2" Body="&lt;p&gt;As stated already, you can not do much to speed up a comparison between any two chosen patches. What you need to focus on in order to speed up the process is how to &lt;em&gt;reduce the number of patch pairs you need to compare&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the computational process is as expensive as I presume it is, in addition to already mentioned &lt;em&gt;image pyramid&lt;/em&gt;, I might have another suggestion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Extract local features and perform &lt;em&gt;feature matching&lt;/em&gt;&lt;/strong&gt;. This is the way to usually recognize similar images, but it works for finding objects in whole images, which means it should also match features in smaller, locally similar patches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These guys: &lt;em&gt;&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=sivic%20zisserman%20video%20google&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CC8QFjAA&amp;amp;url=https%3A%2F%2Fbitbucket.org%2Fvivalafiestaaa%2Fdbovw%2Fsrc%2F65f63ad8ee6aa48bc7639a7be9e496b3afadf5ea%2FPapers%2Fsivic03.pdf&amp;amp;ei=F3GlUOScCaTE0QWTkYFo&amp;amp;usg=AFQjCNFdt6b-4JyQgs_OpQBl41c8aqVs3g&quot; rel=&quot;nofollow&quot;&gt;Sivic, Zisserman: Video Google: A text retrieval approach to object matching in videos&lt;/a&gt;&lt;/em&gt; had a good idea about &lt;em&gt;spatial consistency&lt;/em&gt;. In short, they make sure that the groups of matches have a fairly similar geometrical layout. They use a fairly loose criterion but suggest a way to both loosen and &lt;em&gt;strengthen the criterion&lt;/em&gt;. You do have to do a straightforward brute force matching between the feature descriptors, but that still seems far less computationally expensive than directly calculating similarities between patches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way, you will hopefully get clusters of matches. Then you could &lt;em&gt;limit the search&lt;/em&gt; only to the patches that contain a &lt;em&gt;certain minimal number of matches&lt;/em&gt;. In my opinion, these patches would have a &lt;em&gt;substantially higher probability&lt;/em&gt; of being the most similar. This is a bit complex add on to make, but I think it could be worth a shot.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2012-11-15T22:58:38.510" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6014" PostTypeId="1" CreationDate="2012-11-15T23:12:48.570" Score="4" ViewCount="498" Body="&lt;p&gt;As hinted in &lt;a href=&quot;https://dsp.stackexchange.com/a/6008/1273&quot;&gt;this answer&lt;/a&gt;, &lt;strong&gt;Perceptual hashing&lt;/strong&gt; is a way to ascribe comparable measures (hashes) to images (rectangular patches). The images do not need to be the same size, and can be slightly distorted, according to the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I might soon need a way to measurably describe image patches of &lt;em&gt;different sizes&lt;/em&gt;, as well as &lt;em&gt;irregular&lt;/em&gt; (not only different) &lt;em&gt;shapes&lt;/em&gt;, and if Perceptual hashing could be adapted to work on non-rectangular image patches, it sounds interesting in this context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have any limitation to the way I describe the patches though, so any other suggestions are welcome. &lt;em&gt;It does not have to be a distance measure&lt;/em&gt;, in other words, I just want a measure with a &lt;em&gt;tendency&lt;/em&gt; to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;be more similar between patches of similar shape&lt;/li&gt;&#xA;&lt;li&gt;be more similar between patches of similar content (similar subparts of the image)&lt;/li&gt;&#xA;&lt;li&gt;still tolerate slight distortion in shapes and pixel values&lt;/li&gt;&#xA;&lt;li&gt;can be but does not have to be more similar for shapes of similar size&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-11-16T09:58:04.433" Title="How to construct descriptors for irregularly shaped image patches" Tags="|image-processing|object-recognition|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6015" PostTypeId="2" ParentId="6003" CreationDate="2012-11-16T00:52:27.597" Score="2" Body="&lt;p&gt;I think a better way to understand what PCA does is to understand what is a good feature. Suppose you are classifying obese people from non-obese people. A good feature (let's call it $f_1$) to use for example might be &quot;body mass index (BMI)&quot; for each person. Another good feature (called $f_2$) to use might be &quot;weight&quot;. A third feature $f_3$ to use would be a time-averaged &quot;blood glucose level&quot;. However, since BMI is calculated using weight anyways, the features $f_1$ and $f_2$ have some level of correlation between them. However, the weight and the blood glucose level do not have an immediate statistical correlation. They are uncorrelated features. In other words, including features $f_1$ and $f_2$ gives us a gain in information but not as much as including $f1$ and $f3$. If you want to design good features, then you need to &quot;whiten&quot; the data or include as many &quot;uncorrelated&quot; features as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where a transformation is useful. Consider a Fourier transform. The basis functions of a Fourier transform are complex exponentials which are orthogonal to each other (uncorrelated). Hence if you transform your feature vector into the Fourier domain you get uncorrelated features. But its not clear which subset to pick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PCA is a variant of the Karhunen-Loeve transform which use the data itself as a space within which to find basis functions. The eigenvectors of the data space form the basis functions and you can then project onto the eigenvectors with maximum eigenvalues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result you preserve most of the signal energy while losing a little depending on how low dimensional you project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now as far as preserving the edges goes, perhaps PCA is not the best basis for this. You might be better in the wavelet domain which is able to preserve discontinuities like edges. &lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2012-11-16T00:52:27.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6016" PostTypeId="2" ParentId="5982" CreationDate="2012-11-16T03:06:31.640" Score="3" Body="&lt;p&gt;There is &lt;a href=&quot;http://creativemachines.cornell.edu/eureqa&quot; rel=&quot;nofollow&quot;&gt;Eureqa&lt;/a&gt; : &lt;em&gt;Eureqa (pronounced &quot;eureka&quot;) is a software tool for detecting equations and hidden mathematical relationships in your data&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; : Now below is what I wrote in first place but reading myself again, I haven't really answered the exact question you've asked ... now that I (think) have (above), I just left it because in  my case Eureqa yielded no good results. (pretty much the same issue as you, I was trying to estimate when a turntable would really stop for my DJ-ing software)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here it is :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What about a &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_regression&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Linear_regression&lt;/a&gt; ? You might be interested in the &lt;em&gt;Estimation&lt;/em&gt; category, on the right of the page.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There's the &lt;a href=&quot;http://en.wikipedia.org/wiki/Zero-crossing_rate&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Zero-crossing_rate&lt;/a&gt;, it is quite primitive but yielded some nice results for me, you can find out how many times and how far occurences do occur for your value of 100. (You might need a lot more data than a few samples, though ... but you can oversample your signal)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Last thing, you can (and probably should) apply some filtering to the incoming signal, I did use the Moving Average Filter &lt;a href=&quot;http://www.dspguide.com/ch15/5.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch15/5.htm&lt;/a&gt;. Dependings your needs, you can get rid off some of the noise present to even enhance your estimation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From this great book : &lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;The Scientist and Engineer's Guide to&#xA;Digital Signal Processing&#xA;By Steven W. Smith, Ph.D.&lt;/a&gt; It is free ! Chapters of interest for you : 14, 15, 16, 19, 20, 21&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Wikipedia and this book, I've been able to track a time-code signal for my DJ-ing software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(if you don't know what a time-code is : &lt;a href=&quot;http://en.wikipedia.org/wiki/Vinyl_emulation_software&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Vinyl_emulation_software&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also it's a lot of trial and error, magic numbers sometimes, in my case it was &lt;em&gt;21&lt;/em&gt; samples (for the MA filter) at 44.1Khz, with this I've been able to track changes in the frequency of about 0.25Hz which was way better than when not using the MA filter before the ZCR.&lt;/p&gt;&#xA;" OwnerUserId="3290" LastActivityDate="2012-11-16T03:06:31.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6018" PostTypeId="2" ParentId="6012" CreationDate="2012-11-16T09:24:49.107" Score="5" Body="&lt;p&gt;I asked Google again for you, but I did manage to find some hits in the end. There is already a &lt;a href=&quot;https://stackoverflow.com/q/7050164/884412&quot;&gt;very good question on stackoverflow&lt;/a&gt; concerning the &lt;em&gt;exact same thing you are interested in&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a very nice explanation of split-and-merge provided in one of the answers, as well as simplified pseudocode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other answer provides a link to the implementation (although I did not check it, I'm not sure which language the implementation is in).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use split-and-merge as a reference segmentation technique to compare your idea with, other &lt;em&gt;segmentation methods offered by OpenCV&lt;/em&gt; might also be interesting:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.seas.upenn.edu/~bensapp/opencvdocs/ref/opencvref_cv.htm#cv_imgproc_ccomp&quot; rel=&quot;nofollow noreferrer&quot;&gt;functions useful in image segmentation&lt;/a&gt; from the OpenCV manual&lt;/li&gt;&#xA;&lt;li&gt;a chapter dealing with image segmentation in OpenCV from &lt;a href=&quot;http://my.safaribooksonline.com/book/programming/opencv/9780596516130/image-parts-and-segmentation/image_parts_and_segmentation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gary Bradski; Adrian Kaehler: Learning OpenCV&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=pyramid%20segmentation&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CC8QFjAA&amp;amp;url=http%3A%2F%2Faimm02.cse.ttu.edu.tw%2Fclass_2009_2%2FCV%2FOpenCV%2FReferences%2FPyramid%2520segmentation%2520algorithms%2520revisited.pdf&amp;amp;ei=sgGmUIClLZCRhQfjooCYCw&amp;amp;usg=AFQjCNHglrnUn-ys6F6GHgkqJiXNxe48MQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;article about &lt;strong&gt;Pyramid segmentation&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Mean-shift segmentation&lt;/strong&gt;: &lt;a href=&quot;https://stackoverflow.com/questions/4831813/image-segmentation-using-mean-shift-explained&quot;&gt;stackoverflow answer&lt;/a&gt;, &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1000236&quot; rel=&quot;nofollow noreferrer&quot;&gt;scientific article&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Watershed segmentation&lt;/strong&gt; seems fairly well explained by &lt;a href=&quot;http://en.wikipedia.org/wiki/Watershed_(image_processing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the end, you can choose one of the already offered methods as the reference method after all, or, if you want to present amazing, all-encompassing comparisson, you might also want to use more than one reference method&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-11-16T09:24:49.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6019" PostTypeId="1" AcceptedAnswerId="6052" CreationDate="2012-11-16T09:36:56.703" Score="6" ViewCount="276" Body="&lt;p&gt;Consider a situation where I am listening to loud music in a room. If I move into another room and close the door (so music is now played in another room behind the closed doors), I will hear the bass component of the music much better than other components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know why the bass voice is more audible (can be better heard through the closed door from another room) than other components in the music ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1273" LastEditDate="2012-11-16T12:34:51.670" LastActivityDate="2012-11-21T18:39:13.763" Title="Why are the bass components of music more audible than other components?" Tags="|voice|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6020" PostTypeId="1" AcceptedAnswerId="6021" CreationDate="2012-11-16T13:48:32.893" Score="4" ViewCount="976" Body="&lt;p&gt;If I have an image and its 2-D DFT of that image, what is the mapping between the value of the DFT at (u,v), and the frequency in the spatial domain in the x and y components, in cycles/pixel? I want to be able to say &quot;There is a peak in the DFT at (u,v), which corresponds to this frequency&quot;. I don't think the answer is u cycles/pixel, since the values shift with different image sizes, even if the image content remains the same.&lt;/p&gt;&#xA;" OwnerUserId="3292" LastEditorUserId="128" LastEditDate="2020-12-12T21:31:11.387" LastActivityDate="2020-12-12T21:31:11.387" Title="Mapping the Value of a Sample in a 2D DFT to Cycles/Pixel" Tags="|fft|frequency|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6021" PostTypeId="2" ParentId="6020" CreationDate="2012-11-16T14:00:54.157" Score="4" Body="&lt;p&gt;Well the Nyquist frequency is 0.5 cycles / pixel and the range of frequencies can be considered to range from -0.5 to +0.5 cycles / pixel. So if the dimension in a given axis is N pixels then each pixel is &lt;code&gt;1 / N&lt;/code&gt; cycles per pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your particular DFT/FFT implementation you may have zero frequency in the middle of the image (M/2, N/2) or in the corner (0, 0). For the former case the spatial frequency at u, v will be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(M/2 - u) / M, (N/2 - v) / N&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="39" LastActivityDate="2012-11-16T14:00:54.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6022" PostTypeId="2" ParentId="5951" CreationDate="2012-11-16T14:15:16.823" Score="2" Body="&lt;p&gt;Let $x_k$ be the clean speech signal without noise and let $n_k$ be the noise. Let's assume that the noisy&#xA;speech signal, $y_k$, can be modeled as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_k = x_k + n_k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume that the noise reduction algorithm, $NR()$, is a linear operation. From that follow that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;NR(y_k) = NR(x_k + n_k) = NR(x_k) + NR(n_k) = \tilde{x}_k + \tilde{n}_k &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The SNR of the output can thus be calculated as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;SNR_{after} = 10log_{10} * (\frac{var(\tilde{x}_k)}{var(\tilde{n}_k)})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can verify if your assumptions are correct by listening to this signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;NR(y_k) - NR(n_k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the output sounds noise free, then the above SNR calculation is valid.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc &#xA;close all &#xA;clear all&#xA;&#xA;% Generate a 'speech' signal &#xA;Fs = 8000; &#xA;[b,a] = butter(2,[300/(Fs/2) 3300/(Fs/2)]); &#xA;innovationSignal = randn(1,Fs); &#xA;cleanSpeech = filter(b,a,innovationSignal); &#xA;cleanSpeech = 0.3.*cleanSpeech./max(abs(cleanSpeech));&#xA;&#xA;% Specify what the signal components look like before processing &#xA;dBSNR = 5; &#xA;noisySpeechBeforeNoiseReduction = awgn(cleanSpeech,dBSNR,'measured');&#xA;noiseBeforeNoiseReduction = noisySpeechBeforeNoiseReduction - cleanSpeech; &#xA;&#xA;% Let's simulate a noise reduction of 10dB dBSNR = 15; &#xA;% Create a 15dB SNR speech signal &#xA;noisySpeechAfterNoiseReduction = awgn(cleanSpeech,dBSNR,'measured'); &#xA;&#xA;% Subtract clean speech to get the noise component &#xA;noiseAfterNoiseReduction =   noisySpeechAfterNoiseReduction - cleanSpeech; &#xA;&#xA;% Simulate noise suppression algo (adds gain and delay) &#xA;algoDelayCoeff = [zeros(1,100) 1]; &#xA;algoGain = 3; &#xA;cleanSpeechAfterNoiseReduction = algoGain.*filter(algoDelayCoeff,1,cleanSpeech);   &#xA;noiseAfterNoiseReduction = algoGain.*filter(algoDelayCoeff,1,noiseAfterNoiseReduction);&#xA;&#xA;% So the output of the NS algo looks like this &#xA;outputOfNoiseSupAlgo = cleanSpeechAfterNoiseReduction + noiseAfterNoiseReduction;&#xA;&#xA;% Verify SNR before noise reduction &#xA;SNR_before = 10*log10(var(cleanSpeech)/var(noiseBeforeNoiseReduction))&#xA;&#xA;% Verify SNR after noise reduction &#xA;SNR_after = 10*log10(var(cleanSpeechAfterNoiseReduction)/var(noiseAfterNoiseReduction))&#xA;&#xA;disp(['SNR improvement: ' num2str(SNR_after - SNR_before)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3287" LastEditorUserId="77" LastEditDate="2012-11-16T19:31:43.453" LastActivityDate="2012-11-16T19:31:43.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6023" PostTypeId="1" CreationDate="2012-11-16T14:17:51.437" Score="1" ViewCount="338" Body="&lt;p&gt;I'm developing a project that identifies Phonemes to be able to identify whether someone is saying either &quot;Yes&quot; or &quot;No&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far in the project, I have used Zero-crossings to identify what the person is saying, this works really well and seems simple enough to understand. The project, however, needs a few enhancements and has to be developed using a Hidden Markov Model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to develop a Hidden Markov Model, without erasing the work that I have already completed. I.e. I strip the data that do not warrant consideration by counting the number of zero-crossings as well as the summation of the blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand what data I would need to train the HMM in order to be able to identify these Phonemes. E.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Zero-crossings I have identifies that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Yes - Zero-crossings start low and then the value increases&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;No - Zero-crossings start low and then do not increase with value.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I train my HMM algorithm so that it interprets these values? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or could anyone suggest a method of which I can train the HMM to be able to identify the word that is inputted in the sample?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope someone can help :)!&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2012-11-16T17:40:13.743" Title="Hidden Markov Models - Identifying Phonemes" Tags="|signal-detection|speech-recognition|zeros|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6024" PostTypeId="1" AcceptedAnswerId="6028" CreationDate="2012-11-16T15:09:53.607" Score="2" ViewCount="182" Body="&lt;p&gt;I'm working with a grey-scale data-collection of Hebraic tombstones in content-based image retrieval CBIR). For example an image like this &lt;a href=&quot;http://www.steinheim-institut.de/daten/picshha/xl/0001_AG_0105090324.jpg&quot; rel=&quot;nofollow&quot;&gt;tombstone&lt;/a&gt;. I'm going to reduce the content of the image to the centered tombstone. And after some other processing steps I'm trying to find a suitable representation of this image to enable CBIR. So far SIFT and SURF were good detectors but others like MSER fail to produce good results. The problem is the heterogeneity of the data-collection (6.700 picture of different tombstone with different shapes, symbols, ornaments and Hebraic letters). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone can give me a hint which pattern-recognition approach might be suitable? OCR won't do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank for your help! If you need more picture, take a look around at &lt;a href=&quot;http://www.steinheim-institut.de/daten/picshha/xl/&quot; rel=&quot;nofollow&quot;&gt;the institue of German-Jewish history&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3293" LastActivityDate="2012-11-18T18:17:20.477" Title="Processing a heterogeneous image-collection for CBIR" Tags="|image-processing|cbir|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6025" PostTypeId="2" ParentId="6023" CreationDate="2012-11-16T17:40:13.743" Score="3" Body="&lt;p&gt;You should first appreciate why an HMM would be useful. The problem that you've described is classify a given utterance as either a yes or a no (it would be also useful to have a &quot;neither&quot; class). Because speech is a time-evolving quantity, it needs a classifier that is able to deal with sequences of feature vectors. Different people say &quot;yes&quot; or &quot;no&quot; with different speeds. For example, I might say &quot;no&quot; and the speech signal could be 200ms long or you could say &quot;no&quot; and the speech signal could be 50ms long. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to look into creating windows of a fixed length for your speech signal and extracting certain transform domain coefficients (like FFT, DCT etc.) from it and use these to train an HMM. Alternatively, the mel-frequency cepstrum coefficients (MFCCs) are also very popular in training phoneme based HMMs for speech recognition. &lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2012-11-16T17:40:13.743" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6026" PostTypeId="2" ParentId="6000" CreationDate="2012-11-17T11:55:00.310" Score="4" Body="&lt;p&gt;Which method are you using to detect the lines? Have you tried experimenting with &lt;a href=&quot;http://www.ipol.im/pub/art/2012/gjmr-lsd/&quot; rel=&quot;nofollow noreferrer&quot;&gt;LSD&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the results of a quick test I did using LSD:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this first image I have displayed only the vertical line segments with an angle between 75 and 105 degrees and the length greater than $0.1 * height$ of the image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Na4oa.jpg&quot; alt=&quot;pic1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second image are the results with the same angle constraint but disregarding the lengths of the segments:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/obmZd.jpg&quot; alt=&quot;pic2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try playing with this a bit, figure out how to chose the best line segments, extend them to lines and maybe get slightly better results than the ones you posted.&lt;/p&gt;&#xA;" OwnerUserId="3298" LastEditorUserId="1273" LastEditDate="2012-11-17T16:42:52.970" LastActivityDate="2012-11-17T16:42:52.970" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6028" PostTypeId="2" ParentId="6024" CreationDate="2012-11-17T17:59:53.540" Score="2" Body="&lt;p&gt;From what you said in the comments, it seems that CBIR is not really what you need here.&#xA;  I am guessing that you would help the historians more by clustering the images, rather than by doing &#xA;retrieval.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;SIFT and SURF are a good place to start.  You might also try the FREAK descriptor, which you can compute at the &#xA;points detected by SIFT or SURF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the important question is what you do with all those features.  For a problem like this you should consider the bag-of-features approach or the pyramid match kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; you may be right to look for a different interest point detector. SIFT and SURF detectors give you centers of blobs (roughly circular patches of uniform intensity).  Since you are looking at man-made gravestones with Hebrew text on them, corners might work better.  A classic approach is the Harris-Laplacian corner detector.  Note that the original Harris detector is not multi-scale.  For this application you definitely need multiple scales.  Other corner detectors such as FAST and &lt;a href=&quot;http://www6.in.tum.de/Main/ResearchAgast&quot; rel=&quot;nofollow&quot;&gt;AGAST&lt;/a&gt; have been proposed recently.  I have heard good things about AGAST, but I have not tried it.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2012-11-18T18:17:20.477" LastActivityDate="2012-11-18T18:17:20.477" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6029" PostTypeId="1" CreationDate="2012-11-17T20:16:39.400" Score="5" ViewCount="389" Body="&lt;p&gt;I have a major question. Please take a look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this differential equation (DE):&#xA;$$&#xA;\frac{d^2y(t)}{dt}  +\frac{dy(t)}{dt} +4y(t)= \frac{dx(t)}{dt} +2x(t)&#xA;$$&#xA;And I have to find impulse response (IR) and frequency response (FR).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can &quot;translate&quot; the given DE into:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y(\omega)(j\omega)^2 + Y(\omega)5(j\omega) + 4Y(\omega)= j\omega X(\omega)+2X(\omega)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i am reaching a point where $H(\omega) = Y(\omega)/X(\omega) = (j\omega +2)/[(j\omega)^2 +5j\omega + 4]$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The my main problem is that i dont know how to continue from this point, because in the numerator is that $j\omega$, otherwise i have my standard methodology to solve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what am I supposed to do for this point ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3300" LastEditorUserId="6" LastEditDate="2012-11-19T19:09:42.027" LastActivityDate="2012-11-19T19:09:42.027" Title="Impulse Response / Frequency response Question" Tags="|fourier-transform|impulse-response|frequency-response|" AnswerCount="0" CommentCount="3" ClosedDate="2013-10-26T05:07:35.763" ContentLicense="CC BY-SA 3.0" />
  <row Id="6030" PostTypeId="1" AcceptedAnswerId="6032" CreationDate="2012-11-18T01:18:05.860" Score="1" ViewCount="543" Body="&lt;p&gt;I am generating a simple musical instrument using a ST board. basically I have a sensor which detects motion or spatial angle and generates sounds of differnt pitch and volume depending on the angle. I already have the driver for the audio codec so all I need to do is to generate sound samples and feed the samples to it. Now I am able to get the angle readings from the sensor but the challenging part is how to generate sound. From google search so far, I think I need to generate a sin function with frequency and amplitude(volume) set according to the reading from the sensor. But my codec assumes a sampling rate 0f 48KHz so how would I go about generating sinusoids with different frequencies for a fixed sampling rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have done this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;samplingRate = 48000;&#xA;n = 0;//reset once there is a change in frequency&#xA;&#xA;//this function is called 48000 times a second&#xA;int generateSineWave(float frequency,float volume)&#xA;{&#xA;  int temp = volume*(sin(2*pi*frequency*n) ;&#xA;  n = n + 1; &#xA;  if(n == samplingRate )&#xA;    n = 0;&#xA;  if(abs(temp) &amp;gt; MAXVAL)&#xA;    return ERROR_CODE;&#xA;  return temp;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to be working (I am hearing something),but I am not sure if it's generating the right frequency sinusoid. also the sound I am hearing is not very pleasant, how would I go about generating complex tones(like the ones in piano for example)? I guess also my control variables(spatial angles) needs to be low pass filtered. But apart from that any idea on how I could generate more audibly pleasant waves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a newbie in sound synthesis so any suggestion/help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="2102" LastEditorUserId="39" LastEditDate="2012-11-18T17:22:56.650" LastActivityDate="2012-11-18T17:49:45.750" Title="How to perform sound synthesis?" Tags="|audio|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6032" PostTypeId="2" ParentId="6030" CreationDate="2012-11-18T10:48:09.423" Score="6" Body="&lt;p&gt;First of all, there is something wrong in your computation of the sine wave. It should be something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;volume * sin(2 * pi * frequency * n / SAMPLE_RATE);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, your code is generating very high frequencies and what you are hearing are their mirror images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the very first thing to fix. Other problems in your code include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Resetting the variable n every time the frequency is changed - this creates discontinuities (&quot;clicks&quot;) in the waveform.&lt;/li&gt;&#xA;&lt;li&gt;Resetting the variable n every time it reaches the sample rate. You are not sure the waveform has completed a series of full cycles because the frequency might not be an integer.&lt;/li&gt;&#xA;&lt;li&gt;Directly computing the phase by multiplication rather than by integration of the frequency. This &lt;a href=&quot;https://dsp.stackexchange.com/questions/2051/why-does-a-wave-continuously-decreasing-in-frequency-start-increasing-its-freque/2054#2054&quot;&gt;causes problems when frequency is modulated&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;li&gt;Computing the sin function directly, which is an expensive operation on embedded hardware, that will have to be replaced by a table lookup + interpolation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, make sure that your samples are scaled appropriately with respect to the scale of your DAC (for example, if this is sent to a 12-bit DAC with unsigned codes, volume must be lesser than 2047, and you should add a 2048 offset).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you get it working, you will have a pure tone - I wouldn't call this tone &quot;unpleasant&quot;, but it is static and not reminiscent of any music instrument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many sound synthesis techniques to try, an overview of which wouldn't fit in this post. In short:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Subtractive synthesis works by generating harmonically rich tones with simple waveforms (sawtooth, square), and then shaping them through filters. It is not really good at producing &quot;realistic&quot; sounds, but it is relatively easy to implement (the trickiest step is bandlimited waveform generation, read about minBLEP), the sounds it produce are expressive, and it is easy to understand how each synthesis parameter relates to each aspect of sound. Used by synthesizers in the 65-85, with a revival since 95 due to the popularity of the sounds they produce in &lt;a href=&quot;http://www.youtube.com/watch?v=hSchTzFj9kg&quot; rel=&quot;nofollow noreferrer&quot;&gt;electronic/dance music&lt;/a&gt;. A way of &quot;cheating&quot; to get subtractive synthesis sounds more realistic is to use single cycle waveforms of real instruments in place of oscillators, a technique known as wavetable synthesis.&lt;/li&gt;&#xA;&lt;li&gt;Additive synthesis directly builds up a complex tone by summing sinusoidal partials at various frequencies/amplitudes. Given the number of partials involved and the complexity of their variations over time, it is a rather unpractical method.&lt;/li&gt;&#xA;&lt;li&gt;FM synthesis works by interconnecting simple sine wave oscillators which modulate each other's frequency. It is surprisingly good at imitating natural sounds (esp. brass, metallophones), but it is very difficult to understand how its parameters (frequency ratios and modulation indices) relate to meaningful musical parameters (sound &quot;brightness&quot; for example). Had a golden era &lt;a href=&quot;http://www.youtube.com/watch?v=nmp9yqhsjqg&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the eighties&lt;/a&gt; and faded away.&lt;/li&gt;&#xA;&lt;li&gt;Sampling uses recordings of real instruments, and adjusts the playback speed of the recording (aka sample) to emulate the different notes. With this method it is trivial to get something that is immediately recognizable as a piano or guitar or &lt;a href=&quot;http://www.youtube.com/watch?v=q-lQc2ZudyA&quot; rel=&quot;nofollow noreferrer&quot;&gt;coughing Ferris Bueller&lt;/a&gt; - though if you wish to capture all the playing nuances of an instrument you will need an increasingly large number of recordings. Currently the dominant form of sound synthesis in many applications, driven by the lowest cost of data storage.&lt;/li&gt;&#xA;&lt;li&gt;Physical modeling attempts to simulate the physical processes happening in musical instruments - using techniques such as finite element models or digital waveguides. This process can be computationally expensive and/or require a complex modeling and data analysis effort. The results can be very expressive in reproducing all playing nuances of an instrument. Currently quite rare, except for some very narrow application (Piano synthesis).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is really a case of &quot;realism/expressivity/simplicity, pick any two&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure about your goals - how many instrument sounds should your system provide? do you also want to modulate other parameters of sound besides pitch and volume with the accelerometer data? I am not sure either about your target platform (the ST MCUs go from 24 MHz/32kb flash/no FPU to 168 MHz with FPU and DSP instructions and 1M of onboard flash). Another factor to take into account is polyphony - do you want your system to be able to play several notes at the same time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would recommend:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sampling if you have at least 128kb of flash and need only one sound/instrument, or if you have very limited CPU.&lt;/li&gt;&#xA;&lt;li&gt;Subtractive synthesis if you have less flash and/or need more sounds/instruments ; or if you need to use external sensor data to easily modulate sound parameters besides pitch/volume.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-11-18T17:49:45.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6034" PostTypeId="1" AcceptedAnswerId="6047" CreationDate="2012-11-18T13:33:10.213" Score="5" ViewCount="3181" Body="&lt;p&gt;i have obtained some skin detection map (i post below two example of detection map). but, i'm using a normal webcam and the map is noisy. Not a lot, just a bit.&lt;/p&gt;&#xA;&lt;p&gt;I think i can remove noise only with some combination of dilate and erode, and then threshold it.&lt;/p&gt;&#xA;&lt;p&gt;But, like a stupid child, i have spent hours in trying to set parameters, use in different combination like: dilate twice, erode three times, blur, and an erode again and so on.&lt;/p&gt;&#xA;&lt;p&gt;The only result i have obtained is to lost myself: it is not a robust approach at all.&lt;/p&gt;&#xA;&lt;p&gt;So, for image like this, how can i use those super-popular filters? Or some advice for getting a nice contour of the face and removing the noise?&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OSQTl.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;h3&gt;EDIT:&lt;/h3&gt;&#xA;&lt;p&gt;Those two are two different approach to skin recognition: backprojection and mahalonobis distance, using as training data the output of a simple haar face detection. I'm using both of them because with some illumination setting the first is better, for others the second is better. For my porpouse i can choose the best anytime I'm using my application.&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-11-20T09:57:20.980" Title="Recover myself from Dilate and Erode for noise reduction" Tags="|filters|computer-vision|noise|opencv|morphology|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6035" PostTypeId="2" ParentId="6034" CreationDate="2012-11-18T18:12:52.563" Score="3" Body="&lt;p&gt;First of all, are you using gray-scale morphology?  If so, then I would threshold the map first, to get a binary image, and then apply binary morphology to fill in gaps and get rid of the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, instead of erosion and dilation, try opening and closing, which are higher order morphological operations. Opening is erosion followed by dilation with the same structuring element.  Closing is dilation followed by erosion.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good thing to try is to do an opening to get rid of the noisy specks, and then do a closing to fill in the gaps.  This will simplify your process to three operations: threshold, open, close.  So you would only need to tune three parameters: the threshold and the two structuring elements.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2012-11-18T18:23:45.233" LastActivityDate="2012-11-18T18:23:45.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6036" PostTypeId="2" ParentId="3499" CreationDate="2012-11-18T19:39:21.457" Score="2" Body="&lt;p&gt;Okay, I finally got around to writing the code and testing it. The results? Amazing =D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed pichenettes's original advice to store the coefficients as RFCs instead of LPCs and then perform vector quantization (I tried the idea of using the 15 'global' predictors and 1 block predictor. The results weren't as good as I thought they would be, even with many different predictors and precisions =/).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I think the hardest part about this was trying to figure out how to safely interpolate the data and my lack of in-depth knowledge of DSP influencing that. However, after being pointed in the right direction, I'm happy to say that the results are exactly what I was hoping for when I started nearly a year ago (yes, I've been trying to do this for that long =P).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other part that was slightly tricky was writing fast vector quantization with acceptable results. While I could probably have done it the proper way with centroids, etc. I did it slightly differently (I wasn't sure how to show/hide blocks of preformatted text, so just read the bold lines if you don't want to see the C++ code I wrote to explain):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) Generate the first coefficient set as the average of all the unprocessed coefficients (a sort of training for the quantization)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Quantized coefficient sets&#xA;double VQCoef[CodebookSize][Order];&#xA;&#xA;// For all original coefficients...&#xA;for(int i=0; i &amp;lt; NumberOfCoef; i++) {&#xA;  // For each coefficient in the set...&#xA;  for(int j=0; j &amp;lt; Order; j++) {&#xA;    // Accumulate&#xA;    VQCoef[0][j] += Coef[i][j];&#xA;  }&#xA;}&#xA;&#xA;// Average out coefficients&#xA;// For each coefficient in the set...&#xA;for(int i=0; i &amp;lt; Order; i++) {&#xA;  // Normalize [clamped to (-1.0,+1.0) but omitted for brevity]&#xA;  VQCoef[0][i] /= (double)NumberOfCoef;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) Calculate the next 2^n coefficient sets based on the last ones with a slight offset&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// For each final coefficient set...&#xA;for(int i=0; i &amp;lt; CodebookSize;) {&#xA;  // Quantization buffer. Counter and accumulator.&#xA;  int    VQCnt[CodebookSize];        memset(VQCnt, 0, sizeof(VQCnt));&#xA;  double VQAcc[CodebookSize][Order]; memset(VQAcc, 0, sizeof(VQAcc));&#xA;&#xA;  // Estimate the next set by slightly offsetting the original data&#xA;  for(int j=0; j &amp;lt; i; j++) for(int k=0; k &amp;lt; Order; k++) VQCoef[i+j][k] = VQCoef[j][k] + 0.01;&#xA;}&#xA;&#xA;// Now we have double the amount of coefficients, so adjust 'i' accordingly&#xA;i *= 2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3) Go through the list of the unprocessed coefficients and find the target ones that had the closest correlation (dot product). Once found, accumulate the data into a temp buffer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// For each original coefficient...&#xA;for(int i=0; i &amp;lt; NumCoef; i++) {&#xA;  // Find target coefficient set with best correlation&#xA;  int    BestPos = 0;       // Best target [reset when code runs]&#xA;  double BestDst = -1.0e99; // Best distance [just a really large negative value]&#xA;  for(int j=0; j &amp;lt; CodebookSize; j++) {&#xA;    // Get correlation between the original coefficient set and the tested target&#xA;    double Dist = NormalizedDotProduct(Coef[i], VQCoef[j], Order);&#xA;&#xA;    // If the correlation was better, save this as the target&#xA;    if(Dist &amp;gt; BestDst) {&#xA;      BestPos = j;&#xA;      BestDst = Dist;&#xA;    }&#xA;  }&#xA;&#xA;  // Now that we know the target, save it to the accumulation buffer&#xA;  VQCnt[BestPos]++;&#xA;  for(int j=0; j &amp;lt; Order; j++) VQAcc[BestPos][j] += Coef[i][j];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4) When this lot of coefficient sets is complete, average it out to find the new sets&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// For all sets done up to now...&#xA;for(int i=0; i &amp;lt; CoefSetsDone; i++) {&#xA;  // Fetch count/normalization coefficient. If zero sets, don't bother doing this set&#xA;  double Cnt = VQCnt[i];&#xA;  if(Cnt != 0.0) {&#xA;    // We have sets, so average the coefficients out&#xA;    for(int j=0; j &amp;lt; Order; j++) {&#xA;      VQCoef[i][j] /= Cnt; // [again, this is clamped to (-1.0,+1.0)]&#xA;    }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Steps 2-4 are repeated until I get the 2^n sets I want, at which point I simply convert the reflection coefficients into LP coefficients and I'm done. =)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the project I intend to use this for is VERY long term (think over a decade long), would you be okay with me crediting you for a crucial part of the sound design?&lt;/p&gt;&#xA;" OwnerUserId="2039" LastActivityDate="2012-11-18T19:39:21.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6038" PostTypeId="1" AcceptedAnswerId="6039" CreationDate="2012-11-19T20:02:22.313" Score="6" ViewCount="6288" Body="&lt;p&gt;How can I find the Fourier transform of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f(x) = ( \cos(x) )^3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that for $ g(x) = \cos(x) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal F \Big\{ g(x) \Big\} = \mathcal F \Big\{ \cos(x) \Big\} = \pi \Big [ \delta(w-\pi / 2) + \delta(w+\pi / 2) \Big ]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But using this pair of Fourier transform how to obtain the $ F \Big\{ f(x) \Big\} $ ?? Is there a direct/simple way to do that?&lt;/p&gt;&#xA;" OwnerUserId="3262" LastEditorUserId="1629" LastEditDate="2016-05-26T06:34:49.203" LastActivityDate="2016-05-26T06:58:26.773" Title="Fourier transform of cosine to the power of 3" Tags="|fourier-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6039" PostTypeId="2" ParentId="6038" CreationDate="2012-11-19T20:21:34.023" Score="15" Body="&lt;p&gt;One way would be to use the &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_trigonometric_identities#Power-reduction_formula&quot; rel=&quot;noreferrer&quot;&gt;power-reduction trigonometric identity&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\cos^3(x) = \frac{3 \cos(x) + \cos(3x)}{4}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the linearity property of the Fourier transform, you can transform each term separately and take their weighted sum to get the transform of the entire expression. The relationship we will use (&lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Distributions&quot; rel=&quot;noreferrer&quot;&gt;from line 304 here&lt;/a&gt;) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{F}\{\cos(ax)\} = \pi\left(\delta(\omega - a) + \delta(\omega + a)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which assumes that you're using the non-unitary, angular frequency definition of the Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{F}\{x(t)\} = X(\omega) = \int_{-\infty}^{\infty}x(t) e^{-j\omega t}dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would yield:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;\mathcal{F}\{\cos^3(x)\} &amp;amp;= \frac 34 \mathcal{F}\{\cos(x)\} + \frac 14 \mathcal{F}\{\cos(3x)\} \\&#xA;&amp;amp;= \frac{\pi}{4}\left(3 \delta(\omega - 1) + 3\delta(\omega + 1) +  \delta(\omega - 3) + \delta(\omega + 3) \right)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="1629" LastEditDate="2016-05-26T06:58:26.773" LastActivityDate="2016-05-26T06:58:26.773" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6040" PostTypeId="2" ParentId="6038" CreationDate="2012-11-19T21:48:38.440" Score="8" Body="&lt;p&gt;I prefer Jason's answer, but thought that I would present an alternate way of doing it anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplication in the time domain is equivalent to convolution in the frequency domain.  You thus have the following-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal F\{\cos^3(x)\} = \mathcal F\{\cos(x)\cos(x)\cos(x)\} = \mathcal F\{\cos(x)\} \star \mathcal F\{\cos(x)\} \star \mathcal F\{\cos(x)\}&#xA;$$&#xA;If you use the fact that $\mathcal F\{\cos(x)\} = \frac{\delta(w - 1) + \delta(w + 1)}{2}$ you can get the same result as Jason's answer.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="1629" LastEditDate="2016-05-26T06:31:01.687" LastActivityDate="2016-05-26T06:31:01.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6041" PostTypeId="2" ParentId="3481" CreationDate="2012-11-19T22:21:20.663" Score="2" Body="&lt;p&gt;I've just ported a radix-4 DIF fft from S. Burrus Fortran code to Java.&#xA;Actually it lacks several optimization, first of all the table driven twiddle factor (sin and cos factors should be pre-calculated). This should speed the fft a bit more (maybe 50%). I've to hack a bit for that but if someone has the correct answer I'll be very happy and grateful. &#xA;I'll post the optimized code asap I hope maybe with some speed tests vs radix-2 algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More, the multiplications by 1 and sqrt(-1) aren't removed. Removing them will speed a little more. &#xA;But overall IMHO radix-4 seems be not more than 25% faster than a radix-2, so I don't know if the speed/complexity ratio is really worth. &#xA;Keep in mind that very optimized libraries like FFTW are largely available and used, so this effort could be just a personal 'divertissment'!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the java code. Porting it to C, C++ or C# should be very easy.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static void FFTR4(double[] X, double[] Y, int N, int M) {&#xA;    // N = 4 ^ M&#xA;    int N1,N2;&#xA;    int I1, I2, I3;&#xA;    double CO1,CO2,CO3,SI1,SI2,SI3;&#xA;    double A,B,C,E;&#xA;    double R1,R2,R3,R4;&#xA;    double S1,S2,S3,S4;&#xA;    // N = 1 &amp;lt;&amp;lt; (M+M);&#xA;    N2 = N;&#xA;    I2 = 0; I3 = 0;&#xA;    for (int K=0; K&amp;lt;M; ++K) {&#xA;        N1 = N2;&#xA;        N2 = N2 / 4;&#xA;        E = PI2 / (double)N1;&#xA;        A = 0.0;&#xA;        for (int J=0; J &amp;lt; N2; ++J) {&#xA;            A = J*E;&#xA;            B = A + A;&#xA;            C = A + B;&#xA;            //Should be pre-calculated for optimization&#xA;            CO1 = Math.cos(A);&#xA;            CO2 = Math.cos(B);&#xA;            CO3 = Math.cos(C);&#xA;            SI1 = Math.sin(A);&#xA;            SI2 = Math.sin(B);&#xA;            SI3 = Math.sin(C);&#xA;            for (int I = J; I&amp;lt;N; I+=N1) {&#xA;                I1 = I + N2;&#xA;                I2 = I1 + N2;&#xA;                I3 = I2 + N2;&#xA;                R1 = X[I] + X[I2];&#xA;                R3 = X[I] - X[I2];&#xA;                S1 = Y[I] + Y[I2];&#xA;                S3 = Y[I] - Y[I2];&#xA;                R2 = X[I1] + X[I3];&#xA;                R4 = X[I1] - X[I3];&#xA;                S2 = Y[I1] + Y[I3];&#xA;                S4 = Y[I1] - Y[I3];&#xA;                X[I] = R1 + R2;&#xA;                R2 = R1 - R2;&#xA;                R1 = R3 - S4;&#xA;                R3 = R3 + S4;&#xA;                Y[I] = S1 + S2;&#xA;                S2 = S1 - S2;&#xA;                S1 = S3 + R4;&#xA;                S3 = S3 - R4;&#xA;                X[I1] = CO1*R3 + SI1*S3;&#xA;                Y[I1] = CO1*S3 - SI1*R3;&#xA;                X[I2] = CO2*R2 + SI2*S2;&#xA;                Y[I2] = CO2*S2 - SI2*R2;&#xA;                X[I3] = CO3*R1 + SI3*S1;&#xA;                Y[I3] = CO3*S1 - SI3*R1;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    // Radix-4 bit-reverse&#xA;    double T;&#xA;    int J = 0;&#xA;    N2 = N&amp;gt;&amp;gt;2;&#xA;    for (int I=0; I &amp;lt; N-1; I++) {&#xA;        if (I &amp;lt; J) {&#xA;            T = X[I];&#xA;            X[I] = X[J];&#xA;            X[J] = T;&#xA;            T = Y[I];&#xA;            Y[I] = Y[J];&#xA;            Y[J] = T;&#xA;        }&#xA;        N1 = N2;&#xA;        while ( J &amp;gt;= 3*N1 ) {&#xA;            J -= 3*N1;&#xA;            N1 &amp;gt;&amp;gt;= 2;&#xA;        }&#xA;        J += N1;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the original Radix-4 DIF FORTRAN code by Sidney Burrus:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cnx.org/content/m17384/1.1/&quot; rel=&quot;nofollow&quot;&gt;Radix-4, DIF, One Butterfly FFT&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1884" LastEditorUserId="1884" LastEditDate="2012-11-20T16:46:05.460" LastActivityDate="2012-11-20T16:46:05.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6042" PostTypeId="1" AcceptedAnswerId="6043" CreationDate="2012-11-19T23:39:19.080" Score="1" ViewCount="2416" Body="&lt;p&gt;Is the identification of each point on the constellation diagram arbitrary as long as the sender and receiver know the mapping?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen some diagrams which order in an outward spiral, while others go left to right. Does it matter?&lt;/p&gt;&#xA;" OwnerUserId="1029" LastActivityDate="2012-11-21T02:51:08.270" Title="Need help understanding 16QAM constellation diagram" Tags="|modulation|demodulation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6043" PostTypeId="2" ParentId="6042" CreationDate="2012-11-19T23:59:31.057" Score="6" Body="&lt;p&gt;Yes and no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mapping is arbitrary as long as the receiver correctly determines which constellation point a symbol is.  If the receiver makes a mistake, though, it is most likely going to pick a &quot;neighbor&quot; constellation point (i.e. a constellation point that is only one spot away).  It is highly unlikely that a correctly implemented receiver will pick a constellation point far away from the transmitted point.  Communication systems try to mitigate the impact of the &quot;neighbor&quot; mistakes by minimizing the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hamming_distance&quot;&gt;Hamming distance&lt;/a&gt; between neighbors.  A map where all of the nearest neighbors have a Hamming distance of 1 is called a &lt;a href=&quot;http://en.wikipedia.org/wiki/Gray_code&quot;&gt;Gray&lt;/a&gt; map.  If you use a Gray map almost all of the symbol errors will only result in one bit error.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-11-19T23:59:31.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6044" PostTypeId="2" ParentId="6042" CreationDate="2012-11-20T00:00:31.793" Score="3" Body="&lt;p&gt;It all depends on what you mean by &lt;em&gt;identification&lt;/em&gt;.  The &lt;em&gt;four&lt;/em&gt; bits associated with each constellation point are arranged so that along any row (or any column)&#xA;two of the four bits are fixed and the other two change in &lt;em&gt;Gray code&lt;/em&gt; order.&#xA;Different people (and standards) might use different choices for which&#xA;two bits change along rows and which two change along columns. For&#xA;example, if the first two bits change on the Q axis and the last two&#xA;bits on the I axis, the assignment is as shown.&#xA;$$\begin{array}{l|l|l|l}&#xA;1111 &amp;amp; 1110 &amp;amp; 1100 &amp;amp; 1101\\&#xA;\hline&#xA;1011 &amp;amp; 1010 &amp;amp; 1000 &amp;amp; 1001\\&#xA;\hline&#xA;0011 &amp;amp; 0010 &amp;amp; 0000 &amp;amp; 0001\\&#xA;\hline&#xA;0111 &amp;amp; 0110 &amp;amp; 0100 &amp;amp; 0101&#xA;\end{array}&#xA;$$ but different Gray code orderings could also be used (e.g.&#xA;$00, 01, 11, 10$ instead of the $11,10,00,01$ from top to bottom&#xA;and left to right shown above.&#xA;If you want to label the constellation points as $s_0, s_1, \ldots, s_{15}$,&#xA;you can do so in any way you wish including the spiraling out from&#xA;the origin, but if you want the subscripts to match any straightforward&#xA;and commonly used mapping from integers $[0, 15]$ to $4$-bit nybbles, that is more complicated.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-11-21T02:51:08.270" LastActivityDate="2012-11-21T02:51:08.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6046" PostTypeId="2" ParentId="4828" CreationDate="2012-11-20T09:27:02.183" Score="0" Body="&lt;p&gt;Solving the upside down part is quite easy, just reverse the y coordinates, for instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = max(y) - y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then there is the point of the incorrect position, assuming you know or can finde the coordinates of point 1 in both pictures, say: &lt;code&gt;Xorig&lt;/code&gt; &lt;code&gt;Yorig&lt;/code&gt; &lt;code&gt;Xnew&lt;/code&gt; &lt;code&gt;Ynew&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can just shift the entire image by adding &lt;code&gt;Xorig-Xnew&lt;/code&gt; to all x coordinates, and &lt;code&gt;Yorig-Ynew&lt;/code&gt; to all y coordinates&lt;/p&gt;&#xA;" OwnerUserId="3154" LastActivityDate="2012-11-20T09:27:02.183" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6047" PostTypeId="2" ParentId="6034" CreationDate="2012-11-20T09:57:12.830" Score="2" Body="&lt;p&gt;This is more of an extension to the ideas mentioned by @Dima and @heltonbiker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @heltonbiker said, it might be a good idea to apply thresholding first: I would be more confident this is the right approach if the images you posted were a bit bigger so I could examine the details for myself. Adaptive thresholding is one that is (more or less) robust to background illumination changes, and there's a &lt;a href=&quot;https://dsp.stackexchange.com/q/2411/1273&quot;&gt;good post here&lt;/a&gt; that you can use as a starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Dima suggested opening and closing as higher order morphological operations: they are just one step more complicated than erosion and dilation. You should definitely try approaches &lt;em&gt;from the simpler to the more complicated&lt;/em&gt;, so I would try his idea first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, in case that does not give &lt;em&gt;satisfactory&lt;/em&gt; results (be prepared, nothing will give perfect results), let me suggest two morphological approaches that are a tad more complicated:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;first one is &lt;strong&gt;area closing and opening&lt;/strong&gt;, specific types of &lt;em&gt;algebraic openings and closings&lt;/em&gt;. They remove bright/dark elements not by direct application of a structuring element, but rather operate on shapes who satisfy a certain criterion (e.g. size $\ge$ or $\le 100$ pixels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A successful implementation of an area closing would, for example, allow you to fill all the black structures with a size smaller that a threshold  &lt;em&gt;completely&lt;/em&gt;, while leaving the bigger black structures &lt;em&gt;intact&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have talked briefly about that in &lt;a href=&quot;https://stackoverflow.com/a/12859523/884412&quot;&gt;this SO answer (second bulet)&lt;/a&gt;, and this article/chapter looks useful (although I've never read it): &lt;a href=&quot;http://orbi.ulg.ac.be/bitstream/2268/17697/1/Vandroogenbroeck2009Anchors.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;M. Van Droogenbroeck: Anchors of morphological operators and algebraic openings&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;second one is applying &lt;strong&gt;alternating sequential filters&lt;/strong&gt;. They're nice filter filters that treat dark and bright noise equivalently, so you should use them if that's the case. It also tries to &quot;prevent&quot; the removal of bright noise to remove bright objects (the same for dark noise/objects).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, let me define &lt;em&gt;sequential filters&lt;/em&gt;: it's nothing more than simply applying sequential application of opening and closing with an elementary structuring element for the grid in a combination of orders:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ m_i = \gamma_i \phi_i$;  $n_i = \phi_i \gamma_i $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r_i = \phi_i \gamma_i \phi_i $; $s_i = \gamma_i \phi_i \gamma_i $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\gamma_i$ is an opening and $\phi_i$ a dual closing. The index $i$ indicates the size of the structuring element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sequential filters by itself are sometimes enough: remove bright and then dark specks of certain size (or reverse order). Sometimes, however, if the SE size is not big enough, some things don't get cleaned, while if it's too big, removing bright specks messes with the bright structures. Here, &lt;em&gt;alternating sequential filters&lt;/em&gt; come in to play: you start with a small, precise SE and then gradually increase SE size you work with. Note, this means multiple openings and closings, so it's a slow operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general idea to construct an &lt;em&gt;alternating sequential filter is&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M_i$ = $m_i \cdots m_2 m_1$, and equivalent for other sequential filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some references: discussion that lead to &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/270818&quot; rel=&quot;nofollow noreferrer&quot;&gt;pseudocode in MATLAB&lt;/a&gt;, as well as an article that seems useful: &lt;a href=&quot;http://ntur.lib.ntu.edu.tw/bitstream/246246/142445/1/34.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;S. Pei, C. Lai: An Efﬁcient Class of Alternating Sequential Filters&#xA;in Morphology&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I drew all my explanations from a book &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=773286&quot; rel=&quot;nofollow noreferrer&quot;&gt;P. Soille: Morphological Image Analysis&lt;/a&gt;, but since it's a book, not an article, I didn't find a readily accessible PDF copy.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-11-20T09:57:12.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6049" PostTypeId="1" AcceptedAnswerId="6053" CreationDate="2012-11-20T16:08:46.393" Score="5" ViewCount="464" Body="&lt;p&gt;I have the following mask where the origin is marked in bold text&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \left[ \frac{-1}{4}~~~{\bf\frac{1}{2}}~~~\frac{-1}{4} \right ] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After computing the DFT, the result is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1}{2} - \frac{1}{2} \cos(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I know what type of filter is it? All-pass, Low-pass, Band-pass, High-pass, Band-cut or All-cut?&#xA;To see the type of filter should I just plot it under the main frequency $ [-\pi, \pi] $?&lt;/p&gt;&#xA;" OwnerUserId="3262" LastEditorUserId="29" LastEditDate="2012-11-20T16:56:16.347" LastActivityDate="2012-11-20T20:57:21.827" Title="Determining the type of filter on an image" Tags="|image-processing|filters|dft|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6050" PostTypeId="2" ParentId="6019" CreationDate="2012-11-20T17:44:14.233" Score="1" Body="&lt;p&gt;Something about low-freq can circumvent the objects and high-freq can only reflect and vanish? Microwaves works better in direct visage. Open spaces are better for high-freq and closed spaces are better to low. Observe: Country people, supose to leave in unobstrusive opened spaces, generally have high-freq voices (Willie Nelson) to be listen far in the hill. Otherwhise, city people must be listen in the near room so they have louder voices(Ezio Pinza);&lt;/p&gt;&#xA;" OwnerUserId="3317" LastActivityDate="2012-11-20T17:44:14.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6051" PostTypeId="2" ParentId="6012" CreationDate="2012-11-20T17:58:08.850" Score="-1" Body="&lt;p&gt;I stumbled upon this &lt;a href=&quot;http://www.packtpub.com/article/opencv-segmenting-images&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;. It offers an implementation of watershed segmentation using opencv. There is also an example of using &lt;a href=&quot;http://en.wikipedia.org/wiki/GrabCut&quot; rel=&quot;nofollow&quot;&gt;grabcut&lt;/a&gt;, which can help in segmenting out fo&lt;/p&gt;&#xA;" OwnerUserId="3318" LastActivityDate="2012-11-20T17:58:08.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6052" PostTypeId="2" ParentId="6019" CreationDate="2012-11-20T18:12:43.023" Score="8" Body="&lt;p&gt;The sound wave is a pressure wave in the air, a mechanical vibration. If you have two rooms separated by a wall or door, there is little or no air passage through which the sound can propagate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, the wall itself have to absorb and re-emit the mechanical vibration on the other side. Since doors and walls are massive objects, they are resonating on lower frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The high frequency sound cannot pass through the doors since it is able to make only small particles vibrating (or just surface of the door), hence the wave is not completely absorbed and rather reflected back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bass sound wavelenghts are about feet long (the range is quite large depending how you define &quot;bass&quot;), which roughly matches the size of such large objects like walls and doors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, waves with even larger wavelengths are unable to make objects of this size resonate and hence doors behave like a band-pass filter (as Dilip Sarwate noted).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-11-20T18:12:43.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6053" PostTypeId="2" ParentId="6049" CreationDate="2012-11-20T19:58:06.753" Score="9" Body="&lt;p&gt;As you said, you can simply plot the frequency response of your filter from $-\pi$ to $+\pi$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However since this is a filter only has real co-efficients, you can also just plot the frequency response from $0$ to $\pi$, as this will give you all the information you need. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because for a real signal, the DFT is conjugate symmetric, meaning that all positive frequencies are mirror images of the negative frequencies. In other words, you do not gain any additional knowledge by looking at both negative and positive frequencies. You just need to look at one of them. (Either negative or positive). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we do that, we see that your filter looks like so. Here I have shown all positive frequencies, from $0$ to $\pi$. This will give all the information you need. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/It6m9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, it looks like your filter is a 'graceful high pass filter'. We can clearly see that it passes high frequencies, and clearly see that it nulls low ones, esp DC. In fact, the sum of all your filter co-efficients is 0, meaning we expect it to null out DC completely. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further judging by context, this appears to be an edge detection filter. Edges are characterized by sharp transitions in space/time, meaning high frequencies in temporal/spatial frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a filter would isolate edges. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="29" LastEditDate="2012-11-20T20:57:21.827" LastActivityDate="2012-11-20T20:57:21.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6055" PostTypeId="1" AcceptedAnswerId="6057" CreationDate="2012-11-21T06:55:39.540" Score="29" ViewCount="31796" Body="&lt;p&gt;I have a camera matrix (I know both intrinsic and extrinsic parameters) known for image of size HxW. (I use this matrix for some calculations I need).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use a smaller image, say: $\frac{H}{2}\times \frac{W}{2}$ (half the original).&#xA;What changes do I need to make to the matrix, in order to keep the same relation ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have, $K$ as the intrinsic parameters, ($R$,$T$ rotation and translation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{cam} = K \cdot [R T]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$K = \left( \begin{array}&amp;amp;a_x &amp;amp;0 &amp;amp;u_0\\0 &amp;amp;a_y &amp;amp;v_0 \\ 0 &amp;amp;0 &amp;amp;1\end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$K$ is 3*3, I thought on multiplying $a_x$, $a_y$, $u_0$, and $v_0$ by 0.5 (the factor the image was resized) , but I'm not sure.&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="1606" LastEditDate="2014-05-26T08:41:39.273" LastActivityDate="2019-11-27T21:58:52.247" Title="How does resizing an image affect the intrinsic camera matrix?" Tags="|matlab|computer-vision|camera|camera-pose|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6056" PostTypeId="2" ParentId="2411" CreationDate="2012-11-21T09:22:45.460" Score="15" Body="&lt;p&gt;You can find a paper containing a comparison of a number of thresholding methods here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;M. Sezgin, B. Sankur - Survey over image thresholding techniques and quantitative performance evaluation, Journal of Electronic Imaging, 2004 - &lt;a href=&quot;http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's another paper evaluating binarization methods:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;P. Stathis, E. Kavallieratou and N. Papamarkos - An Evaluation Technique for Binarization Algorithms, Journal of Universal Computer Science,&#xA;2008, - &lt;a href=&quot;http://www.papamarkos.gr/uploaded-files/An%20Evaluation%20Technique%20for%20Binarization%20Algorithms.pdf&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The adaptive binarization method I have used in my last project uses integral images for fast computation of the threshold function used by the Sauvola method. The Sauvola method is described in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;J. Sauvola and M. Pietikainen, Adaptive document image binarization, Pattern Recognition 33, 2000. - &lt;a href=&quot;http://www.mediateam.oulu.fi/publications/pdf/24.p&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The modification which uses integral images providing a 20-fold speedup (according to the paper) is described in this paper:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;F. Shafait, D. Keysers, and T. M. Breuel, Efficient implementation of local adaptive thresholding techniques&#xA;using integral images, Document Recognition and Retrieval XV, 2008 - &lt;a href=&quot;http://www.dfki.uni-kl.de/~shafait/papers/Shafait-efficient-binarization-SPIE08.pdf&quot;&gt;pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These are just the papers I used when choosing the binarization method for my project (for finding text in images). I'm not an expert so I can't say which method is the best for which application.&lt;/p&gt;&#xA;" OwnerUserId="3298" LastActivityDate="2012-11-21T09:22:45.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6057" PostTypeId="2" ParentId="6055" CreationDate="2012-11-21T11:37:59.870" Score="21" Body="&lt;p&gt;&lt;em&gt;Note: That depends on what coordinates you use in the resized image. I am assuming that you are using zero-based system (like &lt;code&gt;C&lt;/code&gt;, unlike &lt;code&gt;Matlab&lt;/code&gt;) and 0 is transformed to 0. Also, I am assuming that you have no skew between coordinates. If you do have a skew, it should be multiplied as well&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Short answer&lt;/strong&gt;: Assuming that you are using a coordinate system in which &lt;span class=&quot;math-container&quot;&gt;$u' = \frac{u}{2} , v' = \frac{v}{2}$&lt;/span&gt;, yes, you should multiply &lt;span class=&quot;math-container&quot;&gt;$a_x,a_y,u_0,v_0$&lt;/span&gt; by 0.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Detailed answer&lt;/strong&gt; The function that converts a point &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; in world coordinates to camera coordinates  &lt;span class=&quot;math-container&quot;&gt;$(x,y,z,1)-&amp;gt;(u,v,S)$&lt;/span&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \left( \begin{array}{ccc}&#xA;a_x &amp;amp; 0 &amp;amp; u_0 \\&#xA;0 &amp;amp; a_y &amp;amp; v_0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 \end{array} \right)  &#xA;\left( \begin{array}{ccc}&#xA;R_{11}  &amp;amp; R_{12} &amp;amp; R_{13} &amp;amp; T_x \\&#xA;R_{21}  &amp;amp; R_{22} &amp;amp; R_{23} &amp;amp; T_y  \\&#xA;R_{31}  &amp;amp; R_{32} &amp;amp; R_{33} &amp;amp; T_z \\&#xA;0  &amp;amp; 0&amp;amp; 0 &amp;amp; 1 &#xA;\end{array} \right) &#xA;\left( \begin{array}{ccc}&#xA;x \\&#xA;y  \\&#xA;z \\&#xA; 1 &#xA;\end{array} \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$(u,v,S)-&amp;gt;(u/S,v/S,1)$&lt;/span&gt;, since the coordinates are homogenous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short this can be written as &#xA;&lt;span class=&quot;math-container&quot;&gt;$ u= \frac{m_1 P}{m_3 P} , v = \frac{m_2 P}{m_3 P}$&lt;/span&gt;&lt;br&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the product of the two matrixes mentioned above, and &lt;span class=&quot;math-container&quot;&gt;$m_i$&lt;/span&gt; is the i'th row of the matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. (The product is scalar product).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Re-sizing the image can be thought of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ u'=u/2, v'=v/2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ u' = (1/2) \frac {M_1 P} {M_3 P}  \\&#xA;v' = (1/2) \frac {M_2 P} {M_3 P} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Converting back to matrix form gives us:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left( \begin{array}{ccc}&#xA;0.5 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0.5 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 \end{array} \right) &#xA;\left( \begin{array}{ccc}&#xA;a_x &amp;amp; 0 &amp;amp; u_0 \\&#xA;0 &amp;amp; a_y &amp;amp; v_0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 \end{array} \right)  &#xA;\left( \begin{array}{ccc}&#xA;R_{11}  &amp;amp; R_{12} &amp;amp; R_{13} &amp;amp; T_x \\&#xA;R_{21}  &amp;amp; R_{22} &amp;amp; R_{23} &amp;amp; T_y  \\&#xA;R_{31}  &amp;amp; R_{32} &amp;amp; R_{33} &amp;amp; T_z \\&#xA;0  &amp;amp; 0&amp;amp; 0 &amp;amp; 1 &#xA;\end{array} \right) &#xA;\left( \begin{array}{ccc}&#xA;x \\&#xA;y  \\&#xA;z \\&#xA; 1 &#xA;\end{array} \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is equal to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \left( \begin{array}{ccc}&#xA;0.5 a_x &amp;amp; 0 &amp;amp; 0.5 u_0 \\&#xA;0 &amp;amp; 0.5 a_y &amp;amp; 0.5 v_0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 \end{array} \right)  &#xA;\left( \begin{array}{ccc}&#xA;R_{11}  &amp;amp; R_{12} &amp;amp; R_{13} &amp;amp; T_x \\&#xA;R_{21}  &amp;amp; R_{22} &amp;amp; R_{23} &amp;amp; T_y  \\&#xA;R_{31}  &amp;amp; R_{32} &amp;amp; R_{33} &amp;amp; T_z \\&#xA;0  &amp;amp; 0&amp;amp; 0 &amp;amp; 1 &#xA;\end{array} \right) &#xA;\left( \begin{array}{ccc}&#xA;x \\&#xA;y  \\&#xA;z \\&#xA; 1 &#xA;\end{array} \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For additional information, refer to &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/013608592X&quot; rel=&quot;noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Forsyth&lt;/a&gt;, chapter 3 - Geometric camera calibration.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="128" LastEditDate="2019-11-27T21:58:52.247" LastActivityDate="2019-11-27T21:58:52.247" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6058" PostTypeId="2" ParentId="4740" CreationDate="2012-11-21T13:49:13.110" Score="1" Body="&lt;p&gt;If your input data does not correspond to regularly-spaced samples, I would argue that it makes no sense to compute the Fourier transform.  Garbage in, garbage out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your matrix corresponds to an image, then it most likely &lt;em&gt;does&lt;/em&gt; consist of regularly spaced samples, and so a sampling frequency &lt;em&gt;is&lt;/em&gt; defined.&lt;/p&gt;&#xA;" OwnerUserId="64" LastActivityDate="2012-11-21T13:49:13.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6059" PostTypeId="2" ParentId="4740" CreationDate="2012-11-21T15:23:04.203" Score="1" Body="&lt;p&gt;Looks like you are generating your signal programmatically. I have done the same at my job a lot of times, with the specific goal of performing FFT analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact is: YOU must specify, arbitrarily, what is the sampling frequency, which you are supposed to already know. If the signal is synthetic, you can use any convenient value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I want to simulate 10 seconds of electromyogram signal (which is my actual field of application). I can take some magic function and use it to generate the desired signal. Since my ACTUAL sampling rate is 2 kHz, then I must &quot;tell&quot; the function to generate a signal with 20,000 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I take this signal and use it as an imput with some FFT function, one of the function parameters is the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose I have geological, or astronomical data. If I want to simulate large time scale events, I can tell my sampling interval is an year, or even a century. The input might even be the same array, but if you tell your FFT function that the sampling rate is R, then your output frequencies will be proportionally related to R. Sampling rate, in this case, is metadata, is independent of the signal, it is not &quot;contained&quot; in an array, which is just a sequence of values. It is only your pre-existent knowledge about the signal's nature that allows you to tell which is its sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-11-21T15:23:04.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6060" PostTypeId="1" AcceptedAnswerId="6062" CreationDate="2012-11-21T17:46:51.977" Score="1" ViewCount="92" Body="&lt;p&gt;I have developed an algorithm that counts the number of times a particular block (within a 2D block) crosses zero. Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B1 = {  1, 4, &#xA;        -1, -3, &#xA;        0.12, -2.3&#xA;     }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The answer would there for be 3. To do this, what I do is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the signum value of each element within the block (will return &quot;1&quot;, &quot;-1&quot;, &quot;0&quot;) respectively.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the signum value returns -1 then count increments by 1. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This will repeat until the there is no blocks, however, will only produce 1 value per block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a way to put all this process into an equation so I can demonstrate this rather than having to explain the processes in written text everytime. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="1810" LastEditorUserId="90" LastEditDate="2012-11-22T01:10:50.653" LastActivityDate="2012-11-23T07:51:41.710" Title="Showing processes as an Equation" Tags="|zeros|math|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6061" PostTypeId="2" ParentId="6019" CreationDate="2012-11-21T18:39:13.763" Score="5" Body="&lt;p&gt;That's a basic property of room acoustics. In essence the wall is a mass (ignoring resonant structures for now). Transmission through walls works as follows: sound energy hits the wall -&gt; wall starts to vibrate -&gt; wall radiates sound into the adjacent room. The wall simply follows Newton's second law of motion: F = m*a, force = mass times acceleration. For a given velocity the acceleration is proportional to the frequency, i.e. the walls moves half as much when the frequency doubles. In other words it takes a lot less force to shake a heavy object slowly than to shake it fast. In practice the transmission drops roughly by 4dB per frequency doubling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is quantified here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.engineeringtoolbox.com/sound-transmission-massive-walls-d_1409.html&quot;&gt;http://www.engineeringtoolbox.com/sound-transmission-massive-walls-d_1409.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-11-21T18:39:13.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6062" PostTypeId="2" ParentId="6060" CreationDate="2012-11-21T20:31:00.137" Score="4" Body="&lt;p&gt;Your algorithm, as described, is not correct.  You are simply counting the number of negative numbers, not the number of zero crossings.  For the particular data set that you use, B1, the two numbers are the same, but in general they won't be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to do it is to multiply each number by the number after it, and if &lt;em&gt;that&lt;/em&gt; number is negative, then you have a zero crossing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;zeroCrossings = sum((data(1:end-1) .* data(2:end)) &amp;lt; 0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You also need to add some logic to handle samples that are exactly zero, but hopefully you get the idea at this point.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-11-21T20:31:00.137" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="6063" PostTypeId="1" AcceptedAnswerId="6065" CreationDate="2012-11-21T23:42:42.060" Score="7" ViewCount="3428" Body="&lt;p&gt;After some &lt;a href=&quot;https://stackoverflow.com/questions/13499852/scipy-fourier-transform-of-a-few-selected-frequencies&quot;&gt;questioning on stackoverflow&lt;/a&gt;, I tried to implement a Goertzel algorithm in Python. But it doesn't work : &lt;a href=&quot;https://gist.github.com/4128537&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/4128537&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;&#xA;def goertzel(samples, sample_rate, f_start, f_end):&#xA;    &quot;&quot;&quot;&#xA;    Implementation of the Goertzel algorithm, useful for calculating individual&#xA;    terms of a discrete Fourier transform.&#xA;    &quot;&quot;&quot;&#xA;    window_size = len(samples)&#xA;    f_step = sample_rate / float(window_size)&#xA;    # Calculate which DFT bins we'll have to compute&#xA;    k_start = int(math.ceil(f_start / f_step))&#xA;    k_end = int(math.floor(f_end / f_step))&#xA;&#xA;    if k_end &amp;gt; window_size - 1: raise ValueError('frequency out of range %s' % k_end)&#xA;&#xA;    # For all the bins between `f_start` and `f_end`, calculate the DFT&#xA;    # term&#xA;    n_range = range(0, window_size)&#xA;    freqs = []&#xA;    results = []&#xA;    for k in range(k_start, k_end + 1):&#xA;        # Bin frequency and coefficients for the computation&#xA;        f = k * f_step&#xA;        w_real = 2.0 * math.cos(2.0 * math.pi * f)&#xA;        w_imag = math.sin(2.0 * math.pi * f)&#xA;&#xA;        # Doing the calculation on the whole sample&#xA;        d1, d2 = 0.0, 0.0&#xA;        for n in n_range:&#xA;            y  = samples[n] + w_real * d1 - d2&#xA;            d2, d1 = d1, y&#xA;&#xA;        # Storing results `(real part, imag part, power)`&#xA;        results.append((&#xA;            0.5 * w_real * d1 - d2, w_imag * d1,&#xA;            d2**2 + d1**2 - 2 * w_real * d1 * d2)&#xA;        )&#xA;        freqs.append(f)&#xA;    return freqs, results&#xA;&#xA;if __name__ == '__main__':&#xA;    # quick test&#xA;    import numpy as np&#xA;    import pylab&#xA;&#xA;    t = np.linspace(0, 1, 44100)&#xA;    sine_wave = np.sin(2*np.pi*441*t)[:1024]&#xA;    freqs, results = goertzel(sine_wave, 44100, 0, 22049)&#xA;    print np.array(results)&#xA;    pylab.plot(freqs, np.array(results)[:,2])&#xA;    pylab.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am a beginner in this topic, so I have no idea what could be wrong in there. Any advice would be welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I get when plotting the power ... as you can notice, the frequency 440 which should appear is not there : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JrSHp.png&quot; alt=&quot;Here is what I get when executing the code&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1169" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-11-22T09:04:28.637" Title="Failed to implement Goertzel algorithm in Python" Tags="|fft|dft|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6064" PostTypeId="1" CreationDate="2012-11-22T07:21:37.293" Score="0" ViewCount="186" Body="&lt;p&gt;Project: Content Based Image Retrieval - Semi-supervised (manual tagging is done on images while training)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Description&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 1000000 images in the database. The training is manual (supervised) - title and tags are provided for each image. Example: coke.jpg Title : Coke Tags : Coke, Can&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the images and tags, I have to train the system. After training, when I give a new image (already in database/ completely new) the system should output the possible tags the image may belong to and display few images belonging to each tag. The system may also say no match found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) What is mean by image fingerprint? What is the image fingerprint size expected ? (important because there will be millions of images to be inserted in database)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What is the field format of that fingerprint in the database ? (important because a fast search is needed … script should search in a 1M images database in less than 1 second)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) What is the descriptors (algorithms) we use to analyze them ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2012-11-23T08:01:59.013" Title="Can anyone suggest good algorithms for CBIR?" Tags="|image-processing|computer-vision|cbir|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6065" PostTypeId="2" ParentId="6063" CreationDate="2012-11-22T09:04:28.637" Score="7" Body="&lt;p&gt;Just had a look, and from the wikipedia definition of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;wikipedia&quot;&gt;Goertzel algorithm&lt;/a&gt;, the frequency in the cosine weight should be a normalized frequency (as for the DFT, by the way). If you modify your code as below, you should get the right output (note also that your computation of the power led to negative powers -sic-, removing a redundant factor 2 solved that issue as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The modified code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;&#xA;def goertzel(samples, sample_rate, f_start, f_end):&#xA;    &quot;&quot;&quot;&#xA;    Implementation of the Goertzel algorithm, useful for calculating individual&#xA;    terms of a discrete Fourier transform.&#xA;    &quot;&quot;&quot;&#xA;    window_size = len(samples)&#xA;    f_step = sample_rate / float(window_size) # JLD: in Hz&#xA;    # Calculate which DFT bins we'll have to compute&#xA;    k_start = int(math.ceil(f_start / f_step))&#xA;    k_end = int(math.floor(f_end / f_step))&#xA;&#xA;    if k_end &amp;gt; window_size - 1: raise ValueError('frequency out of range %s' % k_end)&#xA;&#xA;    # For all the bins between `f_start` and `f_end`, calculate the DFT&#xA;    # term&#xA;    n_range = range(0, window_size)&#xA;    freqs = []&#xA;    results = []&#xA;    f_step_normalized = 1./window_size # JLD: step in normalized frequency &#xA;    for k in range(k_start, k_end + 1):&#xA;        # Bin frequency and coefficients for the computation&#xA;        f = k * f_step_normalized # JLD: here you need the normalized frequency&#xA;        w_real = 2.0 * math.cos(2.0 * math.pi * f)&#xA;        w_imag = math.sin(2.0 * math.pi * f)&#xA;&#xA;        # Doing the calculation on the whole sample&#xA;        d1, d2 = 0.0, 0.0&#xA;        for n in n_range:&#xA;            y  = samples[n] + w_real * d1 - d2&#xA;            d2, d1 = d1, y&#xA;&#xA;        # Storing results `(real part, imag part, power)`&#xA;        results.append((&#xA;            0.5 * w_real * d1 - d2, w_imag * d1,&#xA;            d2**2 + d1**2 - w_real * d1 * d2) # removed factor 2: already in w_real!&#xA;        )&#xA;        freqs.append(f * sample_rate)&#xA;    return freqs, results&#xA;&#xA;if __name__ == '__main__':&#xA;    # quick test&#xA;    import numpy as np&#xA;    import pylab&#xA;&#xA;    ##t = np.linspace(0, 1, 44100)&#xA;    # JLD: if you do this, the sampling rate is not exactly 44100 anymore:&#xA;    #    linspace includes the boundaries 0 and 1, and there are therefore&#xA;    #    44100 samples for a bit more than 1 second...&#xA;    sample_rate = 44100 # in Hz&#xA;    t = np.arange(sample_rate) / np.double(sample_rate) # in seconds&#xA;    # JLD: with 1000 samples, a sine at 441Hz leads to a DFT with only one&#xA;    # non-nul component:&#xA;    sine_wave = np.sin(2*np.pi*441*t)[:1000]  &#xA;    freqs, results = goertzel(sine_wave, sample_rate, 0, 22049)&#xA;    print np.array(results)&#xA;    pylab.figure()&#xA;    pylab.clf()&#xA;    pylab.plot(np.array(freqs),&#xA;               np.array(results)[:,0]**2 + np.array(results)[:,1]**2,&#xA;               marker='x',&#xA;               label='computed power')&#xA;    pylab.plot(np.array(freqs),&#xA;               np.array(results)[:,0]**2 + np.array(results)[:,1]**2,&#xA;               linestyle='--',&#xA;               marker='o',&#xA;               label='returned power')&#xA;    pylab.xlim([0,1000])&#xA;    pylab.ylabel('Power')&#xA;    pylab.xlabel('Frequency (Hz)')&#xA;    pylab.legend()&#xA;    pylab.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did not thoroughly test that code, and I can't guarantee it to be bug-free, but for your simple example, it seems to work well. I obtain the following figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qcSkr.png&quot; alt=&quot;output of above python code&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jean-Louis!&lt;/p&gt;&#xA;" OwnerUserId="1301" LastActivityDate="2012-11-22T09:04:28.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6066" PostTypeId="2" ParentId="4714" CreationDate="2012-11-22T10:17:59.130" Score="1" Body="&lt;p&gt;I have a similar function to compute the Spectrum from the predicator coefficients, but instead of your code that I do not understand, I have the following :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pOutSpec[spec] = mMeanSquareError / (sumR * sumR + sumI * sumI);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have something that computes the real and imaginary parts into my buffer :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data[2 * spec] = sumR / (sumR * sumR + sumI * sumI);&#xA;data[(2 * spec) + 1] = -sumI / (sumR * sumR + sumI * sumI);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I use different functions to display the spectrum according to the chosen format (Real, Magnitude, Square Magnitude or Log).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have some problems with scaling, both for the FFT Spectrum and the LPC Spectrum. I have chosen to scale them based on my display area, but as a result, their scale is not exactly the same on the display.&lt;/p&gt;&#xA;" OwnerUserId="3324" LastEditorUserId="76" LastEditDate="2012-11-23T04:54:03.127" LastActivityDate="2012-11-23T04:54:03.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6067" PostTypeId="2" ParentId="4714" CreationDate="2012-11-22T14:01:23.347" Score="0" Body="&lt;p&gt;I found this at &lt;a href=&quot;http://web.science.mq.edu.au/~cassidy/comp449/html/comp449.html&quot; rel=&quot;nofollow&quot;&gt;http://web.science.mq.edu.au/~cassidy/comp449/html/comp449.html&lt;/a&gt;&#xA;6.3. Decibels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We commonly transform a spectrum as calculated by the fft into a decibel spectrum to better reflect the response of the human ear. The units of amplitude in the raw spectrum shown above are the same as those of the sampled acoustic signal. The decibel scale is a logarithmic scale of relative amplitude where we first devide by a reference amplitude (which corresponds to 0dB) and then take the naturnal logarithm. Finaly we multiply by 20:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AdB = 20*log(A / Aref)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where AdB is the amplitude in decibels, A is the raw amplitude and Aref is the (raw) reference amplitude. There are five basic choices for Aref:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Choose a known standard reference value. This requires calibration of your recording and digitising equipment against some standard.&#xA;2) Take Aref to be the average amplitude in the utterance you took your window from.&#xA;3) Make Aref the peak amplitude value in the spectrum, this makes the peak always have an amplitude of 0dB.&#xA;4) Make Aref the amplitude at a fixed frequency, say 1000Hz, for this spectrum. The spectrum will always now pass through 0dB at 1000Hz.&#xA;5) Make Aref zero, that is just take the log of the raw amplitude value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The choice of value for Aref depends on the needs of your application. The big question is whether you want to preserve differences in amplitude between spectra or between utterances. For example, if you think that amplitude is going to be a useful cue then you need to preserve the relative amplitude of your spectra, so you can't use either method 3 or 4 above. If you want to factor out the overall loudness of a recording then method 2 might be useful. If you want to get precise relative amplitude measures then you need to use a calibrated system (method 1).&lt;/p&gt;&#xA;" OwnerUserId="3324" LastActivityDate="2012-11-22T14:01:23.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6068" PostTypeId="2" ParentId="3324" CreationDate="2012-11-22T18:19:22.360" Score="2" Body="&lt;p&gt;Might be its helpfull for you but its too late as i visit this site today&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        Bitmap bmp=new Bitmap(pictureBox1.Image);&#xA;        int x1=0, x2=0, y1=0, y2=0;            &#xA;        for (int i = 1; i &amp;lt; bmp.Height;i++ )&#xA;        {                &#xA;            for (int j = 1; j &amp;lt; bmp.Width;j++ )&#xA;            {&#xA;                if( bmp.GetPixel(j,i).R&amp;lt;7  &amp;amp;&amp;amp;  bmp.GetPixel(j-1,i).R&amp;gt;240  &amp;amp;&amp;amp; bmp.GetPixel(j,i-1).R&amp;gt;240 ){&#xA;&#xA;                    for (int k = j; k &amp;lt; bmp.Width - 1;k++ )&#xA;                    {&#xA;&#xA;                        if ((bmp.GetPixel(k, i).R &amp;lt; 7) &amp;amp;&amp;amp; (bmp.GetPixel(k+1, i).R &amp;gt; 240) &amp;amp;&amp;amp; (k-j&amp;gt;30)) {&#xA;                            int count1 = 0;&#xA;&#xA;                            for (int g = j; g &amp;lt; k;g++ ){&#xA;                                if(bmp.GetPixel(g,i).R&amp;lt;7){&#xA;                                    count1++;                                    &#xA;                                }&#xA;                            }//get total width&#xA;&#xA;                         if(count1==k-j){                                 &#xA;                             x1 = j;&#xA;                             y1 = i;&#xA;                             x2 = k;&#xA;                         }&#xA;                        }&#xA;                    }&#xA;                         for (int a = i; a &amp;lt; bmp.Height - 1;a++ )&#xA;                         {&#xA;                             if ((bmp.GetPixel(j, a).R &amp;lt; 7) &amp;amp;&amp;amp; (bmp.GetPixel(j, a+1).R &amp;gt; 240) &amp;amp;&amp;amp; (a- i &amp;gt; 30)) {&#xA;&#xA;                                 int count2 = 0;&#xA;&#xA;                                 for (int x = i; x &amp;lt; a;x++ )&#xA;                                 {&#xA;                                     if(bmp.GetPixel(j,x).R&amp;lt;7){                                            &#xA;                                         count2++;&#xA;                                     }&#xA;                                 }&#xA;&#xA;&#xA;                                 if (count2 == (a - i))&#xA;                                 {&#xA;&#xA;                                     y2 = a;&#xA;                                 }&#xA;                                 else {&#xA;                                     Console.WriteLine(&quot;check&quot;);&#xA;                                 }&#xA;                             }&#xA;&#xA;                         }&#xA;&#xA;                         if ((bmp.GetPixel(x2, y2).R &amp;lt; 7) &amp;amp;&amp;amp; (bmp.GetPixel(x2 + 1, y2).R &amp;gt; 240) &amp;amp;&amp;amp; (bmp.GetPixel(x2, y2+1).R &amp;gt; 240))&#xA;                         {&#xA;&#xA;                             bool r1 = false;&#xA;                             bool r2 = false;&#xA;                             int count3 = 0;&#xA;                             for (int y = y1; y &amp;lt; y2;y++ )&#xA;                             {&#xA;                                 if(bmp.GetPixel(x2,y).R&amp;lt;7){&#xA;                                     count3++;                                     &#xA;                                 }&#xA;                             }&#xA;&#xA;                             if (count3== y2 - y1) {&#xA;                                 r1 = true;&#xA;                             }                                &#xA;                             if(r1==true){&#xA;                                 int count4=0;&#xA;                                 for (int x = x1; x &amp;lt; x2;x++ )&#xA;                                 {&#xA;                                     if(bmp.GetPixel(x,y1).R&amp;lt;7){&#xA;                                         count4++;&#xA;                                     }&#xA;                                 }&#xA;&#xA;                                 if(count4==x2-x1){&#xA;                                     r2 = true;&#xA;                                     Console.WriteLine(&quot;values :  X1 &quot; + x1 + &quot;   y1 :&quot; + y1 + &quot;   width : &quot; + (x2 - x1) + &quot;  height :  &quot; + (y2 - y1));&#xA;                                     Pen pen = new Pen(Color.Red, 2);&#xA;                                     pictureBox1.CreateGraphics().DrawRectangle(pen, x1, y1, x2 - x1, y2 - y1);&#xA;                                 }                     &#xA;                             }&#xA;                            }&#xA;&#xA;                }&#xA;&#xA;                    }// initial point loop&#xA;&#xA;&#xA;&#xA;&#xA;                }// first if&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3328" LastActivityDate="2012-11-22T18:19:22.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6069" PostTypeId="1" AcceptedAnswerId="6114" CreationDate="2012-11-22T21:19:46.883" Score="1" ViewCount="1736" Body="&lt;p&gt;&lt;code&gt;cvInRangeS&lt;/code&gt; method for HSV colorspace is used like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cvInRangeS(imgHSV, cvScalar( hMin,sMin,vMin),cvScalar(hMax,sMax, vMax),imgThresh);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For hue value we generally use a range between two numbers, a pair of small and big one like $(10-50)$, which means $10,11,12...48,49,50$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes I need to use a reverse range for red colors. By &quot;reverse range&quot;, I mean a range between a big and a small number like $(170-10)$ which loops at the value of $180$: $170,171,172 ... 179,180,0,1,2,3 ... 8,9,10$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I adjust this reverse range to &lt;code&gt;cvInRangeS&lt;/code&gt; method? Can anyone explain how to make this work?&lt;/p&gt;&#xA;" OwnerUserId="3235" LastEditorUserId="1273" LastEditDate="2012-11-28T12:09:38.813" LastActivityDate="2012-11-28T12:09:38.813" Title="How to adjust reverse range for Hue in cvInRangeS?" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6070" PostTypeId="1" AcceptedAnswerId="6071" CreationDate="2012-11-23T05:11:30.987" Score="4" ViewCount="443" Body="&lt;p&gt;So I'm trying to understand how MRI machines work. I understand all the concepts of it, the parts, what they do, how the machine works, etc. The part I'm having trouble with is the fourier transform business. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the MRI machine, when the hydrogen atoms release the radio frequencies previously absorbed, the transceiver absorbs it and uses fourier transform to convert those signals from the time domain to the frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part I don't understand is, how does the fourier transform end up producing the image of the body. How do you go from math to a detailed picture of the brain??? Can anyone explain that?&lt;/p&gt;&#xA;" OwnerUserId="3329" LastActivityDate="2012-11-23T18:57:55.040" Title="Signal Processing using Fourier Transform" Tags="|fourier-transform|image-processing|continuous-signals|fourier|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6071" PostTypeId="2" ParentId="6070" CreationDate="2012-11-23T07:33:06.263" Score="4" Body="&lt;p&gt;The signals that we measure in MRI are a combination of signals from all over the object being imaged. It so happens that any signal (even if you simply make one up and draw a squiggle) is composed of a series of sine waves, each with an individual frequency and amplitude. The Fourier transform allows us to work out what those frequencies and amplitudes are. (That is to say, it converts the signal from the time domain into the frequency domain.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we encode the signal with magnetic field gradients which make frequency and (rate of change of) phase relate to position, if we can separate out the frequencies we can say where we should plot the amplitudes on the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitudes serves as the brightness levels in the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Amplitude = I$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(Phase, Frequency) = (x,y)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$I(x,y) = I(x i + y j)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase and Frequency help to find where in the image(which exact part of the  MRI) has the particular amplitude measured by the technique of passing RF signals through the body and collecting the signal information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exact process is well explained with animations at:&#xA;&lt;a href=&quot;http://www.imaios.com/en/e-Courses/e-MRI/Signal-spatial-encoding&quot; rel=&quot;nofollow&quot;&gt;http://www.imaios.com/en/e-Courses/e-MRI/Signal-spatial-encoding&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An RF pulse does not have one frequency only (for this, it would need to be of infinite duration). It covers a certain bandwith, which depends on the shape of the pulse and its duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thickness of the slice can be varied by adjusting the bandwidth of the selective pulse  and the amplitude of the slice selection gradient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a fixed amplitude gradient, the wider the bandwidth, the greater the number of protons excited and the thicker the slice&#xA;For a fixed bandwidth, the stronger the gradient, the greater the variation of precession frequency in space and the thinner the slice&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, the shape of the RF pulse in time will also determine the bandwidth profile in frequency, and thus the slice profile.&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="1273" LastEditDate="2012-11-23T12:42:53.227" LastActivityDate="2012-11-23T12:42:53.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6072" PostTypeId="2" ParentId="6012" CreationDate="2012-11-23T07:42:54.270" Score="1" Body="&lt;p&gt;Here's a link to an implementation of ISODATA. Its something that I used for a project of mine earlier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.in/matlabcentral/fileexchange/5324-kmeans-isodata-algotithm&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.in/matlabcentral/fileexchange/5324-kmeans-isodata-algotithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ISODATA is a merge and split algorithm which is based off the size of the region. Other merge and split algorithms may use 'different techniques' based on different parameters for merging and splitting regions.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2012-11-23T07:42:54.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6073" PostTypeId="2" ParentId="6000" CreationDate="2012-11-23T07:48:50.983" Score="1" Body="&lt;p&gt;You can try doing edge detection on individual color domains and then merge them, using your method of choice for edge detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compared to edge detection directly on the color image, it might produce better results.&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="1273" LastEditDate="2012-11-23T13:04:51.017" LastActivityDate="2012-11-23T13:04:51.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6074" PostTypeId="2" ParentId="6060" CreationDate="2012-11-23T07:51:41.710" Score="0" Body="&lt;p&gt;If you typically want to 'convert' a random set of 'digital' points into a curve, then interpolation techniques or Curve fitting might be a good approach to consider. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, Jim Clay's answers would be sufficient.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2012-11-23T07:51:41.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6076" PostTypeId="2" ParentId="6064" CreationDate="2012-11-23T08:01:59.013" Score="2" Body="&lt;p&gt;A luminosity histogram (especially one that is separated into RGB components) is a reasonable fingerprint for an image - and can be implemented quite efficiently. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Subtracting one histogram from another will produce a new historgram which you can process to decide how similar two images are.&lt;/li&gt;&#xA;&lt;li&gt;Histograms, because the only evaluate the distribution and occurrence of luminosity/color information handle affine transformations quite well. &lt;/li&gt;&#xA;&lt;li&gt;Luminosity histograms produce false negatives when the color information in an image is manipulated. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="958" LastActivityDate="2012-11-23T08:01:59.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6078" PostTypeId="2" ParentId="4740" CreationDate="2012-11-24T00:21:48.417" Score="1" Body="&lt;p&gt;Matlab doesn't need to know a specific sampling frequency in order to implement the DFT/FFT. This comes from the definition of the forward DFT for a discrete-time signal (DT), $x[n]$, with $N$ entries (i.e. of finite length),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_k = \sum_{n=0}^{N-1} x[n] e ^{-j 2 \pi \frac{kn}{N}}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This definition does not make any use of the concept of a &quot;sampling frequency&quot;. While it is common that a DT signal is generated by sampling a continuous time (CT) signal, many discrete signals do not have such an origin. Specifically, the &quot;frequencies&quot; of the DFT are references to periodicity within the samples according to the length of the DT signal. Take a look at the complex sinusoid used in the DFT:&#xA;$$ e^{-j 2 \pi \frac{k}{N} n} = \cos(2 \pi \frac{k}{N}n) - j \sin(2 \pi \frac{k}{N}n) = \cos(\omega_k n) - j \sin(\omega_k n)$$&#xA;where $\omega_k =  2 \pi \frac{k}{N}$ is dependent upon which frequency coefficient ($X_k$) you are solving for and the length of the signal ($N$). So, we see that the DFT computes a &lt;em&gt;discrete&lt;/em&gt; number of frequency coefficients, where the maximum number of frequency coefficients which can be calculated is dependent upon the number entries in our original, finite length signal ($x[n]$), i.e. the frequencies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$0,\frac{2 \pi}{N}, \frac{4 \pi}{N}, \frac{6 \pi}{N}, ..., \frac{2 \pi (N-1)}{N}.$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the frequencies calculated using the DFT/FFT have to do with regularity at certain ratios of the signal length. So, regularities every one sample, two samples, three samples, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, keep in mind that coefficients produced by the DFT/FFT are periodic, so when you view the DFT/FFT coefficients, as in Matlab, you are only observing a single period (or &quot;replica&quot;) of the true spectrum. For more information on this, I would suggest reading up on, or asking about, the relationship between the DFT and the Discrete Time Fourier Transform (DTFT), which produces a continuous function of frequency for a set of discrete time entries.&lt;/p&gt;&#xA;" OwnerUserId="2054" LastActivityDate="2012-11-24T00:21:48.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6079" PostTypeId="1" AcceptedAnswerId="6087" CreationDate="2012-11-24T10:05:40.017" Score="16" ViewCount="9535" Body="&lt;p&gt;When synthesizing and processing audio on modern processors, when would one consider using something other than single precision (32 bit) floating point? Obviously, the audio coming in and going out to the real world is 16/24 bit, so I'm just talking about the precision of the signals (both the audio itself and things like filter coefficients) in the software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the CPU/DSP has hardware floating point support for both single and double precision&lt;/li&gt;&#xA;&lt;li&gt;The priority is quality audio, not high performance. For example, double precision would be considered if it offered better (perceptual) quality.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3332" LastActivityDate="2012-11-25T15:11:46.667" Title="When to consider double (64 bit) floating point for Audio" Tags="|audio|algorithms|software-implementation|fixed-point|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6081" PostTypeId="1" AcceptedAnswerId="6082" CreationDate="2012-11-24T13:55:24.033" Score="8" ViewCount="7654" Body="&lt;p&gt;According to &lt;a href=&quot;http://en.wikipedia.org/wiki/Sine_wave#Occurrences&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt; human whistling is a pure sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is true and if a human is whistling and produces a rhythm like any song, is he still producing a pure sine wave?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I am producing a tone of any music through my whistle would it still be a pure single harmonic sinusoidal wave?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="76" LastEditDate="2012-11-25T11:22:32.437" LastActivityDate="2015-10-17T00:48:44.350" Title="How is a human whistle a pure sine wave?" Tags="|sound|voice|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6082" PostTypeId="2" ParentId="6081" CreationDate="2012-11-24T14:13:12.540" Score="11" Body="&lt;p&gt;This is only an approximation!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;While the sound of whistling has a very prominent first harmonic, the other harmonics are still present too; there's a non-harmonic noise component; and the first harmonic is more a narrow bump than a sharp line. A better description of the sound of whistling would be white noise filtered through a band-pass filter with a very high Q, and sent through a slight waveshaper adding harmonics. With a slight modulation of amplitude and filter frequency.&lt;/li&gt;&#xA;&lt;li&gt;A pure sine wave is a  stationary signal, it has constant frequency and constant amplitude. If you observe a whistling sound on a window larger than a few tenths of seconds, you will observe modulations in frequency (because of the melody and articulations between notes), and modulations in amplitude (as you breath and start/end notes).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-24T14:13:12.540" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6083" PostTypeId="2" ParentId="6079" CreationDate="2012-11-24T14:45:24.463" Score="2" Body="&lt;p&gt;There are two benefits to going to double precision relative to single precision: increased range and better resolution.  I would be very surprised if the increased range would make any difference in your application.  If it does, there's probably something wrong with your scaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is an improvement it would be in the resolution.  Better resolution means less &lt;a href=&quot;http://en.wikipedia.org/wiki/Quantization_error&quot; rel=&quot;nofollow&quot;&gt;quantization noise&lt;/a&gt;.  Unless the quantization noise is close to the same level as all of your other sources of noise, though, it probably won't make any difference.  You can do some analysis of your noise and signal levels to get an idea of how much of the noise comes from quantization error, but you won't really know for sure if it will make a difference or not until you implement it with both and see if it makes a difference.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-11-24T14:45:24.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6084" PostTypeId="1" CreationDate="2012-11-24T15:33:53.090" Score="4" ViewCount="3802" Body="&lt;p&gt;I use the following formula for DoG:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{\sigma} (\frac{x^2}{2\sigma^2}-1.0) e^{\frac{-x^2}{2\sigma^2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the relationship between this formula and the difference of two Gaussian functions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone show me how to apply DoG on a 1D signal in MATLAB? My input can be considered as a 1D real-valued function, and I applied the above formula to detect blobs. The results make sense except that I don't know why I get many local minima in a relatively flat region (i.e., function values at points in the region almost stay constant). Since I don't have enough signal processing/image processing background, I want to see what a constant signal look like after being convolved with a DoG filter.&lt;/p&gt;&#xA;" OwnerUserId="3335" LastEditorUserId="76" LastEditDate="2012-11-25T21:43:47.410" LastActivityDate="2014-01-09T01:32:54.610" Title="Difference of Gaussians" Tags="|image-processing|discrete-signals|edge-detection|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6085" PostTypeId="2" ParentId="6079" CreationDate="2012-11-24T16:21:41.500" Score="3" Body="&lt;p&gt;If you're working with synthesised audio that undergoes a lot of processing between generation and rendering (conversion to 16/24 bit integer), then you'll benefit from working in the best numerical precision your machine has.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also important to make a fundamental distinction between integers and floating point numbers. A double-precision floating point (64bit) is different from a 64bit integer, and you can even work with arbitrary-precision integers in software, depending on the software tools you use. That would be important if you had to record sounds instead of generating them (as far as I know, AD conversion always saves sampled sounds in integer format).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot be totally sure about it, but if you generate your sound already in floating point, the more common artifacts most likely won't be present by definition, and you can process it with much more &quot;audio quality&quot;. Perhaps you can even generate the sound samples only AFTER you already applied some effects to the generator itself. The only moment when you'll actually introduce any potential artifact is when you convert it for output in some integer file format, such as .WAV for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, since most machines have a native &quot;double&quot; (64bit) precision nowadays, I don't see a reason to work with 32bits anymore...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-11-24T16:21:41.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6086" PostTypeId="2" ParentId="6079" CreationDate="2012-11-24T18:09:29.617" Score="11" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;the CPU/DSP has hardware floating point support for both single and double precision.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It really depends on what kind of support you are talking about. On x86, when using the x87 style floating point instructions, you get the full 80-bit internal precision and the same processing time - whether you are working with single or double precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when using the SIMD instructions, you can get twice more work done using 32-bit floats than 64-bit floats. That's a big deal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to take into account is memory - using double precision divides by two the amount of data that fits in the fastest levels of cache memory.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When synthesizing and processing audio on modern processors,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It will come down to what kind of synthesizing and processing you do. If it involves IIR filters (or more generally anything with state variables and/or feedback), you can more easily shoot yourself in the foot (instabilities or low-cutoff inaccuracies due to coefficient truncation) with 32-bit, if you don't think too much about what you are doing. Some filter topologies work flawlessly with 32-bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, it's a numerical precision issue - in terms of quality, there won't be any perceptual difference. Keep in mind that it is quite ridiculous to expect a hardware audio chain to have more than 20 bits of precision (assuming the board is impeccably routed and all parts are ideal, we're still running into the limit of Johnson noise!) - and this precision is largely covered by single-precision floats. The signal path on a high-end mixing desk has 50s of op-amps, which individually have several orders of magnitude more distortion than the quantization noise of arithmetic operations on single-precision floats.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-11-24T20:25:52.490" LastActivityDate="2012-11-24T20:25:52.490" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6087" PostTypeId="2" ParentId="6079" CreationDate="2012-11-24T18:48:33.727" Score="12" Body="&lt;p&gt;IEEE float singles only provide about 24 bits of mantissa.  But many DSP/filtering algorithms (IIR biquads with poles/zeros near the unit circle, etc.) require far more than 24 bits of mantissa for intermediate computational products (accumulators, etc.), just to get final results accurate to near 16 or 24 bits.  For these types of algorithms, 32, 40 and 48-bit scaled integer accumulators were often used with DSPs that had no FPU. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But on many current processor implementations (for PCs, smartphones, etc.), the double precision FPU is far faster than trying to use 32 or 64 bit scaled integer when your algorithm needs to have more than 24 bits of intermediate product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prevent trashing the data cache, the raw data can be in short integer or single precision float format, while only the more local computational kernel might use a higher resolution format.  But if you are sharing intermediate computation results between DSP modules, the interchange protocol between modules may also benefit from a higher resolution (more than 24-bit mantissa) bus or data format.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-11-24T18:54:58.723" LastActivityDate="2012-11-24T18:54:58.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6088" PostTypeId="1" CreationDate="2012-11-24T23:40:42.217" Score="7" ViewCount="1321" Body="&lt;p&gt;I want to use &lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/waverec.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;waverec&lt;/code&gt;&lt;/a&gt; to evaluate a linear combination of the scaled and shifted wavelet  of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sum_{i=1}^n\sum_{j=0}^{2^n-1}d_{nj} 2^{-n}\psi_{ij} (\frac{t-j}{2^n}) +c_{00}\phi(t)  $$&#xA;at $t=k2^{-n} $ for $k=0\dots2^{n}-1$. I know how do it for the Haar wavelet, namely&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[c,l]=wavedec(zeros(1,8),3,'haar')&#xA;waverec(2^(3/2)*[c00 d10 d20 d21 d30 d31 d32 d33],l,'haar')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can you do the same thing for Daubechies wavelets? The problem being that the array &lt;code&gt;c&lt;/code&gt; does not have 8 entries but 28:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[c,l]=wavedec(zeros(1,8),3,'db4')&#xA;&#xA;c =&#xA;&#xA;  Columns 1 through 14&#xA;&#xA;     0     0     0     0     0     0     0     0     0     0     0     0     0     0&#xA;&#xA;&#xA;  Columns 15 through 28&#xA;&#xA;     0     0     0     0     0     0     0     0     0     0     0     0     0     0&#xA;&#xA;&#xA;l =&#xA;&#xA;     7     7     7     7     8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Question is related to &lt;a href=&quot;https://dsp.stackexchange.com/questions/2765/number-of-daubechies-coefficients&quot;&gt;Number of Daubechies coefficients&lt;/a&gt;, but I do not understand the answer.&lt;/p&gt;&#xA;" OwnerUserId="3336" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-02-21T19:55:06.057" Title="Daubechies Wavelet and Matlab" Tags="|matlab|wavelet|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6090" PostTypeId="2" ParentId="6079" CreationDate="2012-11-25T15:11:46.667" Score="12" Body="&lt;p&gt;You need to know the numerical requirements of your algorithm and choose the precision accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's do the math here: A 32-bit floating point has a 24 bit mantissa and an 8 bit exponent. This gives you about 150 dB signal to noise ratio over a dynamic range of about 1540 dB. That's plenty for most things audio. Double precision gives you roughly twice as much. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each algorithm has certain requirements for numerical precision. If properly designed all audio algorithms that I know of do just a fine with 32-bit floating point. &quot;properly designed&quot; is the keyword here. For example a 6th order band pass from 40-200 Hz sampled at 44.1kHz  implemented as a direct from II IIR bi-quad filter will indeed have some noise problems at 32-bit. However it works perfectly fine as transposed form II or direct form I filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you attempt a partial fraction expansion of the same band pass filter using for example Matlab's residuez() function, you will get bad results even with double precision. Again the numerical requirements of the algorithm for that specific input data exceed what double precision has to offer. The key to fixing this is not to blindly up the precision, but to use a better algorithm instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally let's take a look at what makes floating (32 bit or 64 bit) vulnerable: You have enormous dynamic range, i.e. you can scale down the signal by 200dB, amplify by 500dB, reduce again by 300dB and you end up exactly where you started with almost no loss in precision whatsoever. So that's not it. Floating point has trouble adding numbers that are vastly different in size. There is a point where adding a small number just doesn't make any difference, i.e. you get 1 + dx =1. This number &quot;dx&quot; is about 1.2e-7 for 32-bit floating point and 2.2e-16 for 64 bit. If you algorithm includes adding or subtracting numbers that are that far apart in magnitude, you may run into problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good example for this is the Direct Form II filter mentioned earlier: The direct From II filter (see e.g. &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Direct_Form_II.html&quot;&gt;https://ccrma.stanford.edu/~jos/fp/Direct_Form_II.html&lt;/a&gt;) basically computes the state variables by filtering the input with the pole-only transfer function first and then filtering with the zeros to create the output. Now if the poles are close to the unit circle, the pole-only transfer function gets very, very large. So the state variable can be much bigger than the input (80db to 100dB bigger) and summing state variables with the input creates a lot of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution here is to go to a transposed Form II or direct Form I filter. Analysis shows that the state variables cannot be bigger than input/output then maybe 12dB or thereabouts, so the problem magnitude mismatch doesn't occur in the first place. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-11-25T15:11:46.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6092" PostTypeId="1" AcceptedAnswerId="6093" CreationDate="2012-11-25T04:46:13.230" Score="4" ViewCount="3057" Body="&lt;p&gt;I'm very new to digital signal processing, I've been reading a text book to try to figure out this assignment at work (avionics related).  I'm supposed to implement a two-pole low-pass filter with a fixed cutoff frequency (of 0.02Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if my current output is correct, given my understanding of how low pass filters are supposed to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YPMS0.png&quot; alt=&quot;filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top is my input signal. 3Hz to the left, 1Hz to the right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given my current level of understanding of digital signal processing, my expected output of a low-pass filter with a frequency cutoff of 2Hz is in the middle. 0 to the left, and the original 1Hz signal on the right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom is the output of my current implementation. I don't know if my current implementation is wrong, my understanding, or my expectations of how close to ideal the filters actually are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This actual implementation is a single pole recursive filter, just trying to get a working example (and understanding) I can test against, before I design everything the way they want it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sample rate is 100Hz, so for f = 2Hz, I tried poles of both x = e^(-2*pi*2/100) and x = e^(-2*pi*2/200) (the formula I saw wanted a value from 0 to .5, so assumed it was some fraction of sample rate?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="3340" OwnerDisplayName="Chad Mourning" LastActivityDate="2012-11-25T17:15:10.737" Title="Ideal Low-Pass Filter Output?" Tags="|lowpass-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6093" PostTypeId="2" ParentId="6092" CreationDate="2012-11-25T09:38:48.833" Score="3" Body="&lt;p&gt;From the description I'll take you have a filter with 3 coefficients. (and the formulae are missing the symbol &lt;em&gt;i&lt;/em&gt;). With a sample rate of 100 Hz you would require a filter of length 33 to make it cover the complete wave form of one cycle of 3 Hz signal. Just looking one tenth of a waveform a filter would have to do magic to attenuate (just) a 3Hz signal but leave 1Hz signals intact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'll have octave or matlab, you might want to see the frequency response of your filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; `a=exp(i*pi*2/100);freqz([1,a*conj(a)],1)`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here the 3dB cutoff is approximately at Fs/4 (one quarter of the sampling frequenzy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PRwJ8.gif&quot; alt=&quot;Cutoff frequency of the filter&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3341" OwnerDisplayName="Aki Suihkonen" LastActivityDate="2012-11-25T10:18:07.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6094" PostTypeId="1" CreationDate="2012-11-26T09:58:39.880" Score="3" ViewCount="715" Body="&lt;p&gt;I have a periodic signal generated by accelerometer sensor and I need to count the number of peaks. However, I can't predict when the periodic sequence starts and ends. What would be the best way to do this if expected frequency of the useful signal is between 0.2Hz - 5Hz? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the example of the signal - five squats. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/mNGM4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3342" LastEditorUserId="3342" LastEditDate="2012-11-27T09:05:47.863" LastActivityDate="2012-11-27T09:05:47.863" Title="How to detect the edges of periodic signal?" Tags="|signal-detection|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="6095" PostTypeId="2" ParentId="3312" CreationDate="2012-11-26T10:16:09.477" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Why it is plotting against only 500hz and what information I can get on this??&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Plotting against $500Hz$: Because that is the frequency of the sampled signal. We usually sample a signal at least two times of its max frequency in order to avoid aliasing. In your case $fs=1000Hz$ (sampling frequency), so max frequency is (no higher than) $500Hz$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The information you can get: Which frequency corresponds to high powers. You can avoid power below $0$ frequencies. High frequency components are usually our signal while low power is noise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3344" LastEditorUserId="1273" LastEditDate="2012-11-26T12:11:02.137" LastActivityDate="2012-11-26T12:11:02.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6096" PostTypeId="2" ParentId="1867" CreationDate="2012-11-26T11:41:12.413" Score="3" Body="&lt;p&gt;Please get a look at &lt;a href=&quot;ftp://ftp.signalogic.com/documentation/PESQ/P862E.pdf&quot; rel=&quot;nofollow&quot;&gt;ITU-T P.862&lt;/a&gt;. It is standardized form of &lt;a href=&quot;http://en.wikipedia.org/wiki/PESQ&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;PESQ (Perceptual Evaluation of Speech Quality)&lt;/em&gt;&lt;/a&gt;, family of standards for evaluating the speech quality as experienced by a user of a telephony system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is only around speech (not other audio information). You compare two audio files, &lt;em&gt;source&lt;/em&gt; and &lt;em&gt;degraded&lt;/em&gt; and you obtain a value in percent or MOS equivalent.&lt;/p&gt;&#xA;" OwnerUserId="3345" LastEditorUserId="18321" LastEditDate="2015-11-17T16:29:45.640" LastActivityDate="2015-11-17T16:29:45.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6098" PostTypeId="2" ParentId="6055" CreationDate="2012-11-26T17:39:12.217" Score="12" Body="&lt;p&gt;Andrey mentioned that his solution assumes 0 is transformed to 0.  If you are using pixel coordinates this is likely not true when you re-size the image.  The only assumption you really need to make is that your image transformation can be represented by a 3x3 matrix (as Andrey demonstrated).  To update your camera matrix you can just premultiply it by the matrix representing your image transformation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[new_camera_matrix] = [image_transform]*[old_camera_matrix]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As an example, say you need to change the resolution of an image by a factor $2^n$ and you are using 0 indexed pixel coordinates.  Your coordinates are transformed by the relationships&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x' = 2^n*(x+.5)-.5$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y' = 2^n*(y+.5)-.5$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this can be represented by the matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ &#xA;\left( \begin{array}{ccc}&#xA;2^n &amp;amp; 0 &amp;amp; 2^{n-1}-.5 \\&#xA;0 &amp;amp; 2^n &amp;amp; 2^{n-1}-.5 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 \end{array} \right) &#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so your final camera matrix would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ &#xA;\left( \begin{array}{ccc}&#xA;2^n &amp;amp; 0 &amp;amp; 2^{n-1}-.5 \\&#xA;0 &amp;amp; 2^n &amp;amp; 2^{n-1}-.5 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 \end{array} \right)  &#xA;\left( \begin{array}{ccc}&#xA;ax &amp;amp; 0 &amp;amp; u_0 \\&#xA;0 &amp;amp; ay &amp;amp; v_0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 \end{array} \right)  &#xA;$&lt;/p&gt;&#xA;" OwnerUserId="1722" LastActivityDate="2012-11-26T17:39:12.217" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6100" PostTypeId="2" ParentId="6094" CreationDate="2012-11-26T20:07:52.563" Score="2" Body="&lt;p&gt;The autocorrelation function of a sliding window of data may change by a significant amount when the window is slid past the first or last cycle of your burst of periodic events.  You may have to play with the width of the autocorrelation window depending on the estimated frequency of your cyclic/periodic events.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-11-26T20:07:52.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6102" PostTypeId="2" ParentId="4878" CreationDate="2012-11-27T10:33:23.480" Score="2" Body="&lt;p&gt;Broadly similar techniques are used in a variety of applications when it's necessary to capture more samples of an event than is possible with available equipment.  The idea is really quite simple: an interpolation is just &quot;stretching&quot; but it does not provide any new data, which is why interpolation requires a low pass filter.  By contrast, if you add another recorder (AD converter) at a fixed delay (usually by setting up another record that is trigger by a phase shifted version of the master clock), then you are &quot;subsampling&quot; the analog data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can improve temporal resolution by using multiple ADs at phase shifts, capturing the same analog signal. You can improve spatial resolution using multiple transducers.  You can do both at the same time, although there are practical limits to how much certainty either measurement can have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These techniques are used in probably all high end imaging: PET, airport scanners, CAT, medical ultrasound imaging, ground penetrating radar, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the discussion in those papers covers practical concerns that affect only video.&lt;/p&gt;&#xA;" OwnerUserId="3191" LastActivityDate="2012-11-27T10:33:23.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6103" PostTypeId="1" CreationDate="2012-11-27T11:40:18.380" Score="4" ViewCount="9152" Body="&lt;p&gt;I am doing a project on ECG arrythmia analysis using matlab.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have designed notch filter for removing 50 Hz noise but don't know how to add a 50 Hz powerline interference noise to a clean ECG signal? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, I want to check whether noise is reduced in the filtered signal. Will Power spectral density using modified welch periodogram indicate whether noise is filtered or not?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I compare which wavelet (e.g. db6) is best suited for ECG analysis?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3349" LastEditorUserId="47790" LastEditDate="2020-04-02T12:08:33.523" LastActivityDate="2020-04-02T12:08:33.523" Title="Adding noise to an ECG signal" Tags="|matlab|filters|noise|wavelet|ecg|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6104" PostTypeId="2" ParentId="6103" CreationDate="2012-11-27T13:54:14.297" Score="7" Body="&lt;p&gt;1) Create a 50 Hz sinusoid and then simply add it to your ECG signal.  You can control the power of the 50 Hz noise by multiplying the sinusoid by some gain factor (can be less than or more than 1) before you add it to the ECG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I'm not familiar with the Welch periodogram, but if it displays the power spectral density then it should do fine.  I would just do an FFT myself.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-11-27T13:54:14.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6106" PostTypeId="1" AcceptedAnswerId="6107" CreationDate="2012-11-27T17:19:23.027" Score="1" ViewCount="2464" Body="&lt;p&gt;I have executed an FFT on a .wav file of a person saying &quot;ahhh&quot; which shows the frequency and amplitude of the audio file.  When I run it on a .wav file it shows the frequency 0 Hz as having the highest amplitude.  I'm not sure where the problem is within my code and how I can fix it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does 0 Hz have the max amplitude?  The reason I'm trying to fix this is that I want to find the frequency with the highest amplitude in the wave file then run some calculation against it but running calculations against 0hz doesn't make any sense to me especially when I have to do multiplication with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I look at the &lt;code&gt;array_sort&lt;/code&gt; variable it says the frequency is &lt;strong&gt;0hz and 0.117341 as it's amplitude.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the wave file and .m file I'm using&#xA;&lt;a href=&quot;http://dl.dropbox.com/u/6576402/questions/fft/11262012_44100ahh.wav&quot; rel=&quot;nofollow&quot;&gt;http://dl.dropbox.com/u/6576402/questions/fft/11262012_44100ahh.wav&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.dropbox.com/u/6576402/questions/fft/test_rtfftphase_question.m&quot; rel=&quot;nofollow&quot;&gt;http://dl.dropbox.com/u/6576402/questions/fft/test_rtfftphase_question.m&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all, clc,clf,tic&#xA;dirpathtmp=strcat('/tmp/');&#xA;[vp_sig_orig, fs_rate, nbitsraw] = wavread(strcat(dirpathtmp,'/nov26/11262012_44100ahh.wav')); %must be mono&#xA;fs=fs_rate;&#xA;&#xA;&#xA;t_rebuilt=linspace(0,2*pi,fs); %creates same size time for new signal as orginal signal good for error checking&#xA;&#xA;vp_sig_len=length(vp_sig_orig); %get sample rate from vp fs_rate needs to be an even number?&#xA;&#xA;% Use next highest power of 2 greater than or equal to length(x) to calculate FFT.&#xA;nfft= 2^(nextpow2(length(vp_sig_orig))); &#xA;% Take fft, padding with zeros so that length(fftx) is equal to nfft &#xA;fftx = fft(vp_sig_orig,nfft); &#xA;sigfft= fft(vp_sig_orig); &#xA;sigifft=ifft(sigfft);&#xA;sigphase = unwrap(angle(sigfft')); %get phase of orginal signal&#xA;% Calculate the number of unique points&#xA;NumUniquePts = ceil((nfft+1)/2); &#xA;% FFT is symmetric, throw away second half &#xA;fftx = fftx(1:NumUniquePts); &#xA;% Take the magnitude of fft of x and scale the fft so that it is not a function of the length of x&#xA;mx = abs(fftx)/length(vp_sig_orig); %replaced for testing from stackexchage&#xA;&#xA;if rem(nfft, 2) % odd nfft excludes Nyquist point&#xA;  mx(2:end) = mx(2:end)*2;&#xA;else&#xA;  mx(2:end -1) = mx(2:end -1)*2;&#xA;end&#xA;&#xA;amp=mx;&#xA;ampinv=abs(amp-max(amp));&#xA;&#xA;% This is an evenly spaced frequency vector with NumUniquePts points. &#xA;freq_vect = (0:NumUniquePts-1)*vp_sig_len/nfft; &#xA;freq=freq_vect';&#xA;&#xA;%get phase of new signal&#xA;phase = unwrap(angle(fftx)); %get phase of orginal signal&#xA;array=[freq,amp];&#xA;array_sort=sortrows(array,-2); %sort by largest amplitude first &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using Octave 3.2.4 on Linux Ubuntu 64bit.&lt;/p&gt;&#xA;" OwnerUserId="1894" LastEditorUserId="76" LastEditDate="2012-11-28T05:51:52.103" LastActivityDate="2012-11-28T05:51:52.103" Title="Showing frequency and amplitude after doing an FFT on a signal" Tags="|fft|matlab|signal-detection|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6107" PostTypeId="2" ParentId="6106" CreationDate="2012-11-27T17:24:27.340" Score="6" Body="&lt;p&gt;A strong amplitude response at 0 Hz simply means that you have a very strong DC offset. In other words, it just means that the mean of your signal is not 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is the only problem you have, then all you really need to do, is remove the mean of your signal. In other words:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vp_sig_orig = vp_sig_orig - mean(vp_sig_orig);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-11-27T17:32:18.610" LastActivityDate="2012-11-27T17:32:18.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6108" PostTypeId="1" AcceptedAnswerId="6113" CreationDate="2012-11-27T17:29:39.357" Score="1" ViewCount="151" Body="&lt;p&gt;I have been stuck on this question for a while now. It has to do with vestigial sideband. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/009D6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wasn't sure if I should be dividing $H(\omega)$ graph values by 2 because only the positive side of the filter is given....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer that I am getting is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that $VSB(t) = A_c f(t)\cos(\omega_c t) \ast h(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then in frequency form I get: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$VSB(\omega) = A_c\pi  0.5 (\delta(\omega + (\omega_c + \omega_m)) + \delta(\omega + (\omega_c - \omega_m)) + \delta(\omega - (\omega_c + \omega_m)) + \delta(\omega - (\omega_c - \omega_m))) H(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now using the graph I am multiplying the appropriate $H(\omega)$ values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$VSB(\omega) = A_c \pi 0.5 (0.25 \delta(\omega + (\omega_c + \omega_m)) + 0.75 \delta(\omega + (\omega_c - \omega_m)) + 0.25 \delta(\omega - (\omega_c + \omega_m)) + 0.75 \delta(\omega - (\omega_c - \omega_m)))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where carrier wave is given by $A_c \cos(\omega_c t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have the solution to this, so I have no idea if my answer or reasoning is correct...&#xA;It would be sooooo helpful if someone could confirm/clarify&lt;/p&gt;&#xA;" OwnerUserId="3351" LastActivityDate="2012-11-28T02:59:28.403" Title="Vestigial Filter problem?" Tags="|filters|fourier-transform|frequency-spectrum|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6109" PostTypeId="1" CreationDate="2012-11-27T23:12:56.297" Score="1" ViewCount="390" Body="&lt;p&gt;I am trying to implement a Acoustic Echo cancellation algorithm in Java for a VoIP system. This AEC will help to cancel the echo (coming from Speaker) in microphone input at the same PC. The sound frequency is 16 kHz mono and 16 bits PCM frame. At first I tested my codes with artificial sound stream. I use a sound file as speaker output, and then put 0.6 second delay on the same sound file to simulate microphone input. My AEC works well with and without double-talk. &#xA;My problem is: my AEC can not work when I test it in a real scenario including two remote PCs. At the first a few minutes, there are a lot of high intensities noise. After I transfer the 16-bit PCM frames into SHORT in Java, these noises almost reach the maximum value of SHORT type.  These noise will go down after a few minutes, but echos are not cancelled completely. I have tried to adjust the size of FFT (currently, it is 256),  and the length of filer tail (Currently, it is 9600 frames for a 0.6 second standard echo delay in 16 kHz ) for a lot of different configurations, but none of them works to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does someone have any clue or ideas on this problem? My implementation is mainly based on the two papers below. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;J. S. Soo, K. K. Pang Multidelay block frequency adaptive filter, IEEE Trans. Acoust. Speech Signal Process., Vol. ASSP-38, No. 2, February 1990.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Valin, J.-M., On Adjusting the Learning Rate in Frequency Domain Echo Cancellation With Double-Talk. IEEE Transactions on Audio, Speech and Language Processing, Vol. 15, No. 3, pp. 1030-1034, 2007.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Additionally, there is an another question about my artificial testing data. If I use the sound of human being talking to simulate speaker output and microphone input, the 'echo' can be cancelled significantly. But the AEC can not converge completely if I use some repeating simple sound (like, calling sound of Skype). Initially, I thought that the bottom one would lead to a quick convergence, but it is not. Maybe this is relevant to my question about, but I am not sure. Also is there someone having any opinion on this?&#xA;(I tried to post a image about these two sound types, but I do not have enough reputation to do that T_T, sorry for this)&lt;/p&gt;&#xA;" OwnerUserId="3353" LastEditorUserId="3353" LastEditDate="2012-11-28T16:11:55.907" LastActivityDate="2012-11-28T16:11:55.907" Title="What causes High Intensity Noise after Acoustic Echo Cancellation for a VoIP?" Tags="|fft|noise|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6110" PostTypeId="1" CreationDate="2012-11-27T23:53:56.847" Score="3" ViewCount="1348" Body="&lt;p&gt;I have just started doing image processing, and I am currently working on line detection. I am using Hough transform on the image below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qEz6k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering how I can improve the efficiency of the Hough transform? Before applying the transform what can be done (pre-processes) to improve the performance?&lt;/p&gt;&#xA;" OwnerUserId="3323" LastEditorUserId="76" LastEditDate="2012-11-28T05:51:57.623" LastActivityDate="2012-11-28T05:51:57.623" Title="Improving the performance of the Hough transform" Tags="|image-processing|hough-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6111" PostTypeId="2" ParentId="6110" CreationDate="2012-11-28T02:38:16.070" Score="1" Body="&lt;p&gt;Are you using openCV?&#xA;Anyway, if you are running an edge-detection, and then the hough transform on the edges, it might help to smooth/blur the edges with some bluring functions. OpenCV got some different ones for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular a boxFilter with a 2x2 sized kernel, anchor=Point(-1,-1), and normalize=false.&#xA;It will hopefully make all the edges &quot;thicker&quot;, filling in gaps and inconsitencies in the process.&lt;/p&gt;&#xA;" OwnerUserId="3355" LastActivityDate="2012-11-28T02:38:16.070" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6112" PostTypeId="1" CreationDate="2012-11-28T02:48:39.657" Score="13" ViewCount="9278" Body="&lt;p&gt;I know you can calculate homographies from image to camera plane using correspondence points between a &quot;perfect model&quot; and the image points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm doing it for a football pitch/field, and have used edge detection to find the white lines in the pitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the camera does not (always) cover all of the pitch, so I can't see all the corners... and I only the corners are 100% known points in the model (no other distinguished points).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the problem is that unless the line intersects with another line and forms a corner, I only know the image points of the line, not it's corresponding &quot;perfect/real-world&quot; coordinates in the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way I can &lt;em&gt;use the detected lines to calculate a homography, or even just a set of candidate homographies&lt;/em&gt;, even if the detected lines do not intersect with each other and create a corner?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example image, showing the pitch, our field of view, and the points of the pitch where I can know the corresponding realworld/model coordinates(green circles), and an example of 2 lines that might be completely useless since in our field of view, I have no clue exactly at which point they start or stop in the corresponding realworld /model of the pitch:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7hLyH.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;The red lines are examples of lines which I would like to use, but I don't know their realworld coordinates, and it's kind of hard to estimate them because depending on the camera pose, the correspondent points could be &quot;anywhere&quot;.&lt;/p&gt;&#xA;" OwnerUserId="3355" LastEditorUserId="7338" LastEditDate="2017-01-30T23:08:02.690" LastActivityDate="2017-01-30T23:08:02.690" Title="Calculating a homography based on detected lines" Tags="|image-processing|computer-vision|opencv|homography|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6113" PostTypeId="2" ParentId="6108" CreationDate="2012-11-28T02:59:28.403" Score="0" Body="&lt;p&gt;Your reasoning seems reasonable and correct to me. Assuming that the filter's impulse response $h(t)$ is real, then its magnitude response $\left|H(\omega)\right|$ will be symmetric about $\omega=0$, so the negative-frequency terms will be scaled by the same values as those on the positive side of the frequency axis. I don't see any reason why you would need to multiply or divide by 2 anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing that might differ if you see a solution somewhere else might be the scaling factor at the front of the expression. The typical transform using angular frequency would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{F}\{\cos(ax)\} = \pi\left(\delta(\omega - a) + \delta(\omega + a)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which assumes a Fourier transform definition of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{F}\{x(t)\} = X(\omega) = \int_{-\infty}^{\infty}x(t) e^{-j\omega t}dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like you have an extra factor of $0.5$ at the front of your expression that you might have gotten from the transform. Note that different implementations or expressions of Fourier transforms often have arbitrary scaling factors included; what's most important is that if you apply the forward and inverse transforms in sequence, you get the original signal back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{F}^{-1}\left\{\mathcal{F}\{x(t)\}\right\} = \mathcal{F}^{-1}\left\{X(\omega)\right\} = x(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or at least to some known scaling factor.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-11-28T02:59:28.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6114" PostTypeId="2" ParentId="6069" CreationDate="2012-11-28T11:50:14.870" Score="2" Body="&lt;p&gt;You can generate two different threshold images, one with hue in the range from 0 to 10 and the other with hue from 170 to 180. To get an image with hue in range both from 0 to 10 and 170 to 180, just add the two threshold images together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In C++ code this would look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;inRange(imgHSV, Scalar(0, sMin, vMin), Scalar(10, sMax, vMax), imgThresh);&#xA;inRange(imgHSV, Scalar(170, sMin, vMin), Scalar(180, sMax, vMax), imgThresh1);&#xA;&#xA;Mat imgThreshCombined = imgThresh + imgThresh1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could probably do the same thing by finding the threshold image with hue in the range from 10 to 170 and then just subtracting it from a white image. &lt;/p&gt;&#xA;" OwnerUserId="3298" LastActivityDate="2012-11-28T11:50:14.870" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6115" PostTypeId="1" CreationDate="2012-11-28T19:18:38.350" Score="15" ViewCount="4215" Body="&lt;p&gt;I have a set of images representing the mean curvature of a human back surface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is to &quot;scan&quot; the image for points which have similar, reflected &quot;counterparts&quot; in some other part of the image (most likely symmetrical to the midline, but not necessarily since there might be deformities). Some image-stitching techniques use this to &quot;auto-detect&quot; similar points between images, but I want to detect them for both sides of the same image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ultimate goal is to find a continuous, most probably curved, longitudinal line that adaptively divides the back in symmetric &quot;halves&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sample image is placed below. Notice that not all the regions are symmetrical (specifically, just above the center of the image, the red vertical &quot;strip&quot; deviates to the right). That region should receive a bad score, or whatever, but then the local symmetry would be defined from symmetrical points placed farther away. In any case, I'll have to adapt any algorythm to my application domain, but what I'm after is som correlation/convolution/pattern-matching strategy, there must already be something around, I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(EDIT: there are more images below, and some more explanation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jf709.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: as requested, I'll include more typical images, either well-behaved and problematic. But instead of colormapped images, they are grayscale ones, so that color relates directly to data magnitude, which didn't happened with the colored image (provided just for communication). Although the gray images seem to lack contrast compared to the colored one, the data gradients are there and can be brought up with some adaptive contrast if desired.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;1) Image of a very symmetrical subject:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h4L4J.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;2) Image of the same subject at a different moment. Although there are more &quot;features&quot; (more gradients), it doesn't &quot;feel&quot; so symmetric as before:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s3VX7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;3) A thin young subject, with convexities (bony protrusions, denoted by lighter regions) at the midline instead of the more common concave midline:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wqqYj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;4) A young person with spinal deviation confirmed by X-Ray (note the asymmetries):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LltP7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;5) The typical &quot;tilted&quot; subject (although mostly symmetrical around the curved midline, and as such not properly &quot;deformed&quot;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n4lrr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Any help is much welcome!&lt;/p&gt;&#xA;" OwnerUserId="1558" LastEditorUserId="1558" LastEditDate="2012-11-29T13:39:05.720" LastActivityDate="2012-11-29T13:39:05.720" Title="Finding symmetric regions/patterns in image" Tags="|image-processing|cross-correlation|image-registration|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="6117" PostTypeId="2" ParentId="6081" CreationDate="2012-11-28T22:00:32.783" Score="5" Body="&lt;p&gt;When you whistle, your mouth acts as a Helmholtz resonator: the movement of the air past your lips is causing pressure disturbances that cause the mass of the air inside your mouth to oscillate on its own compliance (like a spring-bob oscillator). The frequency produced is determined by the volume of air and its density, as well as its bulk modulus (mass and stiffness). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Broadband noise is also produced by the rushing of turbulent airflow past your lips; this might excite higher harmonics, but the amplitude of the resultant vibration at these frequencies is likely to be very low. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Certainly if you do an STFT of whistling at a single frequency and plot as a waterfall plot or colour map, it looks very much like there is a single frequency only.&lt;/p&gt;&#xA;" OwnerUserId="3362" LastActivityDate="2012-11-28T22:00:32.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6120" PostTypeId="1" AcceptedAnswerId="6123" CreationDate="2012-11-28T23:23:23.297" Score="0" ViewCount="408" Body="&lt;p&gt;I am trying to construct a Hidden Markov Model to predict the next state to go to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing an example system, or, a test system that contains the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok so the training I have used is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;training = &quot;HTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTHHTTHTTTH&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the test case is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;HTHTTHTHTTHTHTHTHTTHHTHTHTTHTHTTHHT&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assign the values to these, so like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1, 'H', 0.5&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2, 'H', 0.75&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3, 'H', 0.25&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1, 'T', 0.5&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2, 'T', 0.25&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3, 'T', 0.75&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I compute the forward probability, this gives a result of: 0.25&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the viberti algorithm is used to find the best path:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 &#xA; , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , &#xA; 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 , 2 , 3 , 3 , 3 , 2 , 2 , 3 , 3 &#xA; , 2 , 3 , 3 , 3 , 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The confusion is how to do I determine which is the next sequence from the Viberti Algorithm? It gives values of (2, 3) BUT, I do not know whether these are H, or T.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone offer any help? &lt;/p&gt;&#xA;" OwnerUserId="1810" LastEditorUserId="1810" LastEditDate="2012-11-29T00:10:38.620" LastActivityDate="2012-11-29T01:18:12.753" Title="Hidden Markov Model" Tags="|algorithms|math|hmm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6121" PostTypeId="2" ParentId="5992" CreationDate="2012-11-28T23:26:25.543" Score="0" Body="&lt;p&gt;During convolution, no &quot;flip&quot; of the impulse response needs to occur at all...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you want to prevent any phase alteration, you can convolute a signal with an impulse response and then reverse the impulse response and re-convolute to cancel phase effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In offline processing, you could just as easily reverse the signal after the first convolution to get to the same conclusion (as the comments suggest).&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2012-11-28T23:26:25.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6123" PostTypeId="2" ParentId="6120" CreationDate="2012-11-29T01:18:12.753" Score="3" Body="&lt;p&gt;You don't need to use the Viterbi algorithm to do what you want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have only two possible outcomes: T or H. So train a model on your training sequence (not sure if this is the numbers you give - it looks like emission probabilities for 3 states, but you don't mention a transition matrix and how you derived these probabilities...), and then compute the probability of the observation sequence test + 'H' and test + 'T' - whichever has the highest score is the prediction. Cf &quot;problem 1&quot; in the classic &lt;a href=&quot;http://www.cs.cornell.edu/Courses/cs4758/2012sp/materials/hmm_paper_rabiner.pdf&quot; rel=&quot;nofollow&quot;&gt;Rabiner tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-29T01:18:12.753" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6124" PostTypeId="2" ParentId="6115" CreationDate="2012-11-29T04:49:46.427" Score="5" Body="&lt;p&gt;Interesting question. First, maybe you are after approaches based on interest keypoint detector and matching. This would include &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;SIFT&lt;/a&gt; (Scale-Invariant Feature Transform), SURF, ORB, etc ... or even a simpler approach based solely on the Harris operator (csce.uark.edu/~jgauch/library/Features/Harris.1988.pdf). It is not clear from your post what you have tried, so I'm sorry if I'm being naïve here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Said that, let me take a simpler approach with Mathematical Morphology (MM) just for fun :)&#xA;Images for visualization of all of the steps are at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took your sample image and converted it to the L&lt;em&gt;a&lt;/em&gt;b* colorspace using ImageMagick and used only the L* band:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;convert x.jpg -colorspace Lab -separate %d.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;0.png corresponds to the L* band. Now, I'm sure you have the actual image data, but I'm dealing with jpg compression artifacts and what not. To partially handle this issue, I performed a morphological opening followed by a morphological closing with a flat disk of radius 5. This is a basic way to reduce noise with MM, and given the disk radius not much of the image is changed. Next my idea was based on this single image, which has a great chance of failing for other cases. Your region of interest is visually distinguished by being darker (&quot;hotter&quot; in your color image), so I supposed a statistically-based binarizer could perform well. I used the Otsu's approach, which is an automatic one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, it is possible to clearly visualize the central region of interest. The problem is that, in my approach, I wanted it to be a closed component but it is not. I start by discarding every connected component that is smaller than the largest one (not counting background as one of them). This has greater chance to work in other cases if the binarization result was a good one. In your example image, there is one component connected to the background, so it is not discarded but it does not cause problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are still following me, we have yet to find the actual supposed central region of interest. Here is my take on it. No matter how curved the person is (actually I can see certain problematic cases), the region resembles a vertical line. To that end, I simplify the current image by performing a morphological opening with a vertical line of length 100. This length is purely arbitrary, if you do not have scaling issues then this is not a hard value to determine. Now we again discard components, but I was a bit more careful at this step. I used opening by area with the image's complement to discard what I considered small regions, this could be done in a more controlled way by performing something in the form of granulometrics analysis (from MM too).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We roughly have three pieces now: the left part of the image, the central part, and the right part of the image. The central part is expected to be the smaller component of the three, so it is trivially obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the final result, the bottom right image is just the superposed image to its left with the original one. The individual figures are not all aligned, sorry for the hurry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5UZqU.png&quot; alt=&quot;http://i.imgur.com/XRhYv.png&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3363" LastEditorUserId="590" LastEditDate="2012-11-29T09:25:57.917" LastActivityDate="2012-11-29T09:25:57.917" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6125" PostTypeId="1" AcceptedAnswerId="6132" CreationDate="2012-11-29T10:20:49.390" Score="4" ViewCount="358" Body="&lt;p&gt;If a note has a fundamental frequency of 100Hz, then its second harmonic is located at 200Hz and its tenth harmonic is located at 1000Hz. But for acoustic instruments, the harmonics will not occur at exact multiples of the fundamental. My question is, how much error is typical and what is the relationship between the degree of error and the harmonic number. So for example, is it common for the error in the tenth harmonic to be as much as, say, 50Hz. 1050Hz in other words. That's a 5% error. But would a 5% error be just as likely for the second harmonic? &lt;/p&gt;&#xA;" OwnerUserId="1142" LastActivityDate="2012-12-03T10:02:09.063" Title="Harmonic errors in acoustic instruments" Tags="|audio|frequency-spectrum|music|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6126" PostTypeId="1" AcceptedAnswerId="6128" CreationDate="2012-11-29T10:28:14.267" Score="11" ViewCount="16241" Body="&lt;p&gt;I know that zero shifting in the autocorrelation function is equal to its energy, yet, I would like to understand why the peak is at zero.&lt;/p&gt;&#xA;" OwnerUserId="3365" LastEditorUserId="235" LastEditDate="2012-11-29T11:33:58.017" LastActivityDate="2019-02-05T17:08:10.750" Title="Why does the autocorrelation get its peak at zero?" Tags="|autocorrelation|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6127" PostTypeId="2" ParentId="6115" CreationDate="2012-11-29T10:36:59.267" Score="10" Body="&lt;p&gt;As I've said in the comments, medical image registration is a topic with lots of research available, and I'm not an expert. From what I've read, the basic idea commonly used is to define a mapping between two images (in your case an image and its mirror image), then define energy terms for smoothness and for image similarity if the mapping is applied, and finally optimize this mapping using standard (or sometimes application-specific) optimization techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've hacked together a quick algorithm in Mathematica to demonstrate this. This is &lt;em&gt;not&lt;/em&gt; an algorithm you should use in a medical application, only a demonstration of the basic ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I load your image, mirror it and split these images into little blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;src = ColorConvert[Import[&quot;https://i.stack.imgur.com/jf709.jpg&quot;], &#xA;   &quot;Grayscale&quot;];&#xA;mirror = ImageReflect[src, Left -&amp;gt; Right];&#xA;blockSize = 30;&#xA;partsS = ImagePartition[src, {blockSize, blockSize}];&#xA;partsM = ImagePartition[mirror, {blockSize, blockSize}];&#xA;GraphicsGrid[partsS]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0rc3V.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, we would do an approximate rigid registration (using e.g. keypoints or image moments), but your image is almost centered, so I'll skip this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at one block and it's mirror-image counterpart:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{partsS[[6, 10]], partsM[[6, 10]]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KTeBW.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see that they're similar, but shifted. The amount and direction of shift is what we're trying to find out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To quantify the match similarity, I can use the squared euclidean distance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ListPlot3D[&#xA;  ImageData[&#xA;   ImageCorrelate[partsM[[6, 10]], partsS[[6, 10]], &#xA;    SquaredEuclideanDistance]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WaZp8.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sadly, using this data is the optimization directly was harder than I thought, so I used a 2nd order approximation instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fitTerms = {1, x, x^2, y, y^2, x*y};&#xA;&#xA;fit = Fit[&#xA;   Flatten[MapIndexed[{#2[[1]] - blockSize/2, #2[[2]] - &#xA;        blockSize/2, #1} &amp;amp;, &#xA;     ImageData[&#xA;      ImageCorrelate[partsM[[6, 10]], partsS[[6, 10]], &#xA;       SquaredEuclideanDistance]], {2}], 1], fitTerms, {x, y}];&#xA;&#xA;Plot3D[fit, {x, -25, 25}, {y, -25, 25}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h10EG.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function is not the same as the actual correlation function, but it's close enough for a first step. Let's calculate this for every pair of blocks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;distancesFit = MapThread[&#xA;   Function[{part, template},&#xA;    Fit[Flatten[&#xA;      MapIndexed[{#2[[2]] - blockSize/2, #2[[1]] - blockSize/2, #1} &amp;amp;,&#xA;        ImageData[&#xA;        ImageCorrelate[part, template, &#xA;         SquaredEuclideanDistance]], {2}], 1], &#xA;     fitTerms, {x, y}]], {partsM, partsS}, 2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives us our first energy term for the optimization:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;variablesX = Array[dx, Dimensions[partsS]];&#xA;variablesY = Array[dy, Dimensions[partsS]];&#xA;&#xA;matchEnergyFit = &#xA;  Total[MapThread[#1 /. {x -&amp;gt; #2, y -&amp;gt; #3} &amp;amp;, {distancesFit, &#xA;     variablesX, variablesY}, 2], 3];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;variablesX/Y&lt;/code&gt; contains the offsets for each block, and &lt;code&gt;matchEnergyFit&lt;/code&gt; approximates the squared euclidean difference between the original image and the mirrored image with the offsets applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Optimizing this energy alone would give poor results (if it converged at all). We also want the offsets to be smooth, where the block similarity tells as nothing about the offset (e.g. along a straight line or in the white background).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we set up a second energy term for smoothness:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;smoothnessEnergy = Total[Flatten[&#xA;    {&#xA;     Table[&#xA;      variablesX[[i, j - 1]] - 2 variablesX[[i, j]] + &#xA;       variablesX[[i, j + 1]], {i, 1, Length[partsS]}, {j, 2, &#xA;       Length[partsS[[1]]] - 1}],&#xA;     Table[&#xA;      variablesX[[i - 1, j]] - 2 variablesX[[i, j]] + &#xA;       variablesX[[i + 1, j]], {i, 2, Length[partsS] - 1}, {j, 1, &#xA;       Length[partsS[[1]]]}],&#xA;     Table[&#xA;      variablesY[[i, j - 1]] - 2 variablesY[[i, j]] + &#xA;       variablesY[[i, j + 1]], {i, 1, Length[partsS]}, {j, 2, &#xA;       Length[partsS[[1]]] - 1}],&#xA;     Table[&#xA;      variablesY[[i - 1, j]] - 2 variablesY[[i, j]] + &#xA;       variablesY[[i + 1, j]], {i, 2, Length[partsS] - 1}, {j, 1, &#xA;       Length[partsS[[1]]]}]&#xA;     }^2]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fortunately, constrained optimization is built-in in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;allVariables = Flatten[{variablesX, variablesY}];&#xA;constraints = -blockSize/3. &amp;lt; # &amp;lt; blockSize/3. &amp;amp; /@ allVariables;&#xA;initialValues = {#, 0} &amp;amp; /@ allVariables;&#xA;solution = &#xA;  FindMinimum[{matchEnergyFit + 0.1 smoothnessEnergy, constraints}, &#xA;   initialValues];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's look at the result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;grid = Table[{(j - 0.5)*blockSize - dx[i, j], (i - 0.5)*blockSize - &#xA;      dy[i, j]}, {i, Length[partsS]}, {j, Length[partsS[[1]]]}] /. &#xA;   solution[[2]];&#xA;Show[src, Graphics[&#xA;  {Red,&#xA;   Line /@ grid,&#xA;   Line /@ Transpose[grid]&#xA;   }]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rQskc.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;0.1&lt;/code&gt; factor before &lt;code&gt;smoothnessEnergy&lt;/code&gt; is the relative weight the smoothness energy gets in relation to the image match energy term. These are results for different weights:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OfsM3.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible improvements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Like I said, perform a rigid registration first. With a white background, simple image moments-based registration should work fine.&lt;/li&gt;&#xA;&lt;li&gt;This is only one step. You can use the offsets you found in one step and improve them in a second step, maybe with a smaller search window or smaller block sizes&lt;/li&gt;&#xA;&lt;li&gt;I've read articles where they do this without blocks at all, but optimize an offset per pixel.&lt;/li&gt;&#xA;&lt;li&gt;Try different smoothness functions&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2012-11-29T11:06:24.283" LastActivityDate="2012-11-29T11:06:24.283" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6128" PostTypeId="2" ParentId="6126" CreationDate="2012-11-29T10:51:36.170" Score="10" Body="&lt;p&gt;Are you looking for a formal proof or the intuition behind this? In the later case: &quot;Nothing can be more similar to a function than itself&quot;. Autocorrelation at lag $\tau$ measures the similarity between a function $f$ and the same function shifted by $\tau$. Note that if $f$ is periodic, $f$ shifted by any integer multiple of $\tau$ and $f$ coincide, so the autocorrelation has a comb shape - with peaks at the integer multiples of the period with the same height as the central peak.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2012-11-29T15:43:17.343" LastActivityDate="2012-11-29T15:43:17.343" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6129" PostTypeId="1" AcceptedAnswerId="6149" CreationDate="2012-11-29T11:25:02.457" Score="3" ViewCount="4275" Body="&lt;p&gt;I don't know much about filter design. After reading a few articles on wikipedia I am playing with filter design and I see something weird and would like some help in understanding what exactly is going on here. So I have a signal measured uniformly in time (every 30 seconds) with 1006 measurements in total and I want to estimate its power spectrum density eventually. However I want to look only at certain high frequencies so I decided to run it through a low pass filter to get the power in the zero channel and the neighboring small frequencies. Then I will subtract the filtered signal and look at the residual for power at the higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First thing, I just wrote my own naive ideal low pass filter where I take the FFT, zero out all frequencies above 0.8 mHz and then take the inverse FFT and this is the picture I get.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/S7Xe4.jpg&quot; alt=&quot;The Ideal Filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This picture makes perfect sense to me because the filtered signal just oscillates around the original signal and those are the low frequencies I see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I used the GUI based filter builder included in MATLAB's DSP System Toolbox to design my own filter. So I made a low pass, finite impulse response, single-rate filter using the equiripple method and the minimum order possible with the passed frequency amplitude being 1dB and the stopped frequency amplitude attenuated 60dB. Since the range must start with a strictly positive number I used the allowed range of 10e-9 Hz to 0.0008 Hz. The filter is implemented as a direct-form FIR. Here is the frequency response.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/KLsuu.jpg&quot; alt=&quot;Frequency Response of the Designed Filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is when I run the same data through this designed filter, the filtered signal looks so strange.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/weXev.jpg&quot; alt=&quot;Designed Filtered Data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please enlighten me as to what is going on here? Since I am using MATLAB's own implementation I don't think there is anything wrong with the math or the computations so it must be my own understanding. Is this expected? Is it the fact that there is nothing wrong anywhere and the picture is simply what it is? Is there a different filter I should be looking at instead or something? I was expecting this pic to look more or less like the first one where some low frequencies with the background power are just overlayed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I played with high pass filters and even band-pass filters over the specific frequency range I want to look at but they all behave strangely. Is it something to do with the signal itself? The background power is huge so is it leaking all over the spectrum and messing everything up or something? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Edit 1&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Thanks everyone for your comments. My original signal is that blue U shaped signal. I can post the measurements if you guys want here as soon as I figure out how to make a collapsable section. The original problem is to estimate the power spectral density between 0.8mHz and 8mHz. My first instinct was to just have a low pass filter and then subtract it. And then use the multitaper method on the residual to estimate the PSD. Subtraction came to mind because of the detrending. Since one usually detrends the data, I decided to detrend using the filtered signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I wrote my own naive digital filter, filtering in the frequency space. Here's the MATLAB code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1/30;         % Sampling Frequency - per second&#xA;L = length(data);  % Length of the signal&#xA;fftb = fft(data);&#xA;f = Fs/2*linspace(0,1,L/2+1);&#xA;f(end+1:2*end-1)=fliplr(f(2:end));&#xA;fftb(f(:)&amp;gt;0.0008)=0;&#xA;naivefiltered = real(ifft(fftb));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just take the FFT, zero the frequencies I don't want, then take the inverse FFT which sometimes is complex for some reason so I take the real part and I get the first picture up above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I used MATLAB's filter designing tool to design this filter and here is the code for that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fpass = 3.3135e-09;  % Passband Frequency&#xA;Fstop = 0.0008;      % Stopband Frequency&#xA;Apass = 1;           % Passband Ripple (dB)&#xA;Astop = 60;          % Stopband Attenuation (dB)&#xA;Fs    = 1/30;        % Sampling Frequency&#xA;h = fdesign.lowpass('fp,fst,ap,ast', Fpass, Fstop, Apass, Astop, Fs);&#xA;Hd = design(h, 'equiripple','MinOrder', 'any','StopbandShape', 'flat');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then for the third picture, I was using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;smbtotal = filter(Hd,data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but after endolith's comment (I didn't even know about filtfilt) I read about filtfilt and see that &quot;filter()&quot; introduces a huge time lag so when I use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;smbtotal = filtfilt(Hd.Numerator,1,data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the picture does look much better. Here it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bLpG2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it looks like this time/phase shift was the problem. So now I have three questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.For the type of data you see here (U shaped ranging over several orders of magnitudes) if I want to estimate the power at a specific band (0.8mHZ to 8mHz), which technique is better? Should I subtract a low-pass filtered signal? Should I high-pass filter the signal? Or should I band-pass filter it and then estimate the PSD?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.Designing filters is non-trivial. But why is applying filters non-trivial? Why does using &quot;filter()&quot; introduce this time/phase shift?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.Does it matter if I convolve in physical space or multiply in frequency domain? Which one is better? It looks to me like if I multiply in frequency domain (like I am doing with my naive filter) there is no issue with time/phase shifting. But if I convolve in physical space (like using &quot;filter()&quot; in MATLAB) then you have a problem with time/phase shifting? So is it always better to just multiply in frequency space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks everyone for your time. Appreciate it!&lt;/p&gt;&#xA;" OwnerUserId="3364" LastEditorUserId="1273" LastEditDate="2012-12-01T19:52:25.020" LastActivityDate="2015-08-06T23:46:35.827" Title="A Simple Lowpass Filter Behaving so Strangely" Tags="|matlab|frequency-spectrum|filter-design|lowpass-filter|finite-impulse-response|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6130" PostTypeId="2" ParentId="6126" CreationDate="2012-11-29T13:13:48.203" Score="8" Body="&lt;p&gt;The autocorrelation function of an aperiodic discrete-time finite-energy signal &#xA;is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_x[n] = \sum_{m=-\infty}^{\infty}x[m]x[m-n]~~~~ \text{or}~~~&#xA;R_x[m] = \sum_{m=-\infty}^{\infty}x[m](x[m-n])^*$$&lt;/span&gt;&#xA;for real signals and complex signals respectively. Restricting ourselves to real signals for ease of exposition,&#xA;let us consider the summand &lt;span class=&quot;math-container&quot;&gt;$x[m]x[m-n]$&lt;/span&gt;.  For fixed&#xA;delay &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and a given &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x[m]x[m-n]$&lt;/span&gt; &#xA;typically will have positive or negative value. If it so happens that &#xA;for a particular delay &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x[m]x[m-n]$&lt;/span&gt; is nonnegative&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, then all the terms in the sum will add up (no cancellation)&#xA;and so &lt;span class=&quot;math-container&quot;&gt;$R_x[n]$&lt;/span&gt; is guaranteed to have positive value.  In fact, the &#xA;sum will be largest if all the peaks in &lt;span class=&quot;math-container&quot;&gt;$x[m-n]$&lt;/span&gt; line up with peaks &#xA;in &lt;span class=&quot;math-container&quot;&gt;$x[m]$&lt;/span&gt; and the valleys in &lt;span class=&quot;math-container&quot;&gt;$x[m-n]$&lt;/span&gt;&#xA;line up with the valleys in &lt;span class=&quot;math-container&quot;&gt;$x[m]$&lt;/span&gt;.  For example, if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is an over-sampled&#xA;sinc function, say, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$x[m] = \begin{cases} \frac{\sin(0.1 \pi m)}{0.1 \pi m}, &amp;amp; m \neq 0,\\&#xA;1, &amp;amp; m = 0\end{cases}$$&lt;/span&gt;&#xA;with peaks at &lt;span class=&quot;math-container&quot;&gt;$m = 0, \pm 25, \pm 45, \ldots$&lt;/span&gt; and valleys at&#xA;&lt;span class=&quot;math-container&quot;&gt;$\pm 15, \pm 35, \pm 55, \ldots$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$R_x[n]$&lt;/span&gt; will have&#xA;&lt;em&gt;maxima&lt;/em&gt; at &lt;span class=&quot;math-container&quot;&gt;$n = 0, \pm 25, \pm 45, \ldots$&lt;/span&gt; (and by the same token,&#xA;will have &lt;em&gt;minima&lt;/em&gt; at &lt;span class=&quot;math-container&quot;&gt;$n = \pm 15, \pm 35, \pm 55, \ldots$&lt;/span&gt; when the peaks line&#xA;up with valleys).  The &lt;em&gt;global&lt;/em&gt; maximum of &lt;span class=&quot;math-container&quot;&gt;$R_x[n]$&lt;/span&gt; is obviously at delay &#xA;&lt;span class=&quot;math-container&quot;&gt;$n = 0$&lt;/span&gt; when the tallest peak in &lt;span class=&quot;math-container&quot;&gt;$x[m]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x[m-n]$&lt;/span&gt; coincide.  Indeed,&#xA;this conclusion applies not just to this sinc signal but to &lt;em&gt;any&lt;/em&gt; signal.&#xA;At &lt;em&gt;lag&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$n = 0$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_x[0] = \sum_{m=-\infty}^\infty (x[m])^2$$&lt;/span&gt;&#xA;and we are guaranteed that not only are all the peaks and valleys&#xA;lined up with each other (no matter where these occur in &lt;span class=&quot;math-container&quot;&gt;$x[m]$&lt;/span&gt;)&#xA;but also that the highest peaks and deepest valleys are lined up&#xA;appropriately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More formally, for pedants like @JohnSmith who demand formal proofs, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality#Statement_of_the_inequality&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cauchy Inequality&lt;/a&gt; says that for complex-valued sequences &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left|\sum_m u[m](v[m])^*\right|^2 \leq \sum_m |u[m]|^2 \sum_n |v[m]|^2.$$&lt;/span&gt;&#xA;Restricting ourselves to real-valued sequences only for ease of exposition, a more detailed version says that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-\sqrt{\sum_m \left(u[m]\right)^2 \sum_m \left(v[m]\right)^2} \leq \sum_m u[m]v[m] \leq &#xA;\sqrt{\sum_m \left(u[m]\right)^2 \sum_m \left(v[m]\right)^2}$$&lt;/span&gt;&#xA;where &lt;em&gt;equality&lt;/em&gt; holds in the upper (lower) bound if there is a positive (negative) number &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$u = \lambda v$&lt;/span&gt;, (that is, &lt;span class=&quot;math-container&quot;&gt;$u[m]=\lambda v[m] ~ \forall m$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\lambda &amp;gt; 0$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\lambda &amp;lt; 0$&lt;/span&gt;)). Recognizing that the sums inside the square roots are the energies &lt;span class=&quot;math-container&quot;&gt;$\mathcal E_u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal E_v$&lt;/span&gt; of the sequences, we can write that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-\sqrt{\mathcal E_u \mathcal E_v} \leq \sum_m u[m]v[m] \leq \sqrt{\mathcal E_u \mathcal E_v}$$&lt;/span&gt;&#xA;Setting &lt;span class=&quot;math-container&quot;&gt;$u[m] = x[m]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v[m] = x[m-n]$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is some integer, we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-\sqrt{\sum_m \left(x[m]\right)^2 \sum_m \left(x[m-n]\right)^2} \leq R_x[n] \leq &#xA;\sqrt{\sum_m \left(x[m]\right)^2 \sum_m \left(x[m-n]\right)^2}$$&lt;/span&gt; and recognizing that now &lt;span class=&quot;math-container&quot;&gt;$\mathcal E_u = \mathcal E_v = \mathcal E_x$&lt;/span&gt;, we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-\mathcal E_x \leq R_x[n] \leq \mathcal E_x$$&lt;/span&gt; with equality holding in one of the bounds if &lt;span class=&quot;math-container&quot;&gt;$x[m] = \lambda x[m-n]$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. Finally, noting that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal E_x = \sum_m (x[m])^2 = R_x[0]$$&lt;/span&gt; and that when &lt;span class=&quot;math-container&quot;&gt;$n=0$&lt;/span&gt;, the sequence &lt;span class=&quot;math-container&quot;&gt;$u[m] = x[m]$&lt;/span&gt; is &lt;em&gt;identical&lt;/em&gt; to the sequence &lt;span class=&quot;math-container&quot;&gt;$v[m] = x[m-n] = x[m-0] = x[m]$&lt;/span&gt; (that is, &lt;span class=&quot;math-container&quot;&gt;$\lambda = 1$&lt;/span&gt; is the positive real number such that &lt;span class=&quot;math-container&quot;&gt;$u[m] = \lambda v[m]$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;), we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-R_x[0] \leq R_x[n] \leq R_x[0]$$&lt;/span&gt; showing that &lt;span class=&quot;math-container&quot;&gt;$R_x[n]$&lt;/span&gt; has a peak value at &lt;span class=&quot;math-container&quot;&gt;$n=0$&lt;/span&gt;, all other autocorrelation values are smaller than this peak. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$x[m]$&lt;/span&gt; is a &lt;em&gt;periodic&lt;/em&gt; finite-power signal, the sums given&#xA;above for &lt;span class=&quot;math-container&quot;&gt;$R_x[n]$&lt;/span&gt;diverge. In such cases, one uses the &lt;em&gt;periodic&lt;/em&gt;&#xA;autocorrelation function &#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_x[n] = \sum_{m=0}^{N-1} x[m](x[m-n])$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the period of &lt;span class=&quot;math-container&quot;&gt;$x[m]$&lt;/span&gt;, that is, &lt;span class=&quot;math-container&quot;&gt;$x[m] = x[m-N]$&lt;/span&gt; for&#xA;all integers &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;.  Note that &lt;span class=&quot;math-container&quot;&gt;$R_x[n]$&lt;/span&gt; is a periodic function of &#xA;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.  Now, while it is true that &lt;span class=&quot;math-container&quot;&gt;$R_x[0] \geq |R_x[n]|$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$1 &amp;lt; n &amp;lt; N$&lt;/span&gt;,&#xA;the maximum value &lt;span class=&quot;math-container&quot;&gt;$R_x[0]$&lt;/span&gt; also repeats periodically: &lt;span class=&quot;math-container&quot;&gt;$R_x[kN] = R_x[0]$&lt;/span&gt;&#xA;for all integers &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.  Note also that it is possible that &lt;span class=&quot;math-container&quot;&gt;$R_x[n] = -R_x[0]$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$n \in \{1, 2, \ldots, N-1\}$&lt;/span&gt;, typically at &lt;span class=&quot;math-container&quot;&gt;$n = N/2$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is&#xA;even, and so we can have valleys that are as deep as the tallest peaks&#xA;in the &lt;em&gt;periodic&lt;/em&gt; autocorrelation function. The simplest example of such a sequence is when &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt; and one period of the sequence is &lt;span class=&quot;math-container&quot;&gt;$[1 ~ -1]$&lt;/span&gt; whose periodic autocorrelation is just the periodic sequence &lt;span class=&quot;math-container&quot;&gt;$[2 ~ -2]$&lt;/span&gt;, that is, alternating peaks and valleys with the autocorrelation &lt;span class=&quot;math-container&quot;&gt;$R_x[n]$&lt;/span&gt; having peak value &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is an even integer (don't forget that &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is an even integer!) and having &quot;anti peak&quot; value &lt;span class=&quot;math-container&quot;&gt;$-2$&lt;/span&gt; at odd values of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. More generally, we have this phenomenon whenever &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is even and one period &lt;span class=&quot;math-container&quot;&gt;$\vec{x}$&lt;/span&gt; can be decomposed into &lt;span class=&quot;math-container&quot;&gt;$[\vec{x^\prime}, -\vec{x^\prime}]$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2019-02-05T17:08:10.750" LastActivityDate="2019-02-05T17:08:10.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6131" PostTypeId="2" ParentId="6125" CreationDate="2012-11-29T15:36:07.490" Score="4" Body="&lt;p&gt;A few things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Not all instruments have partials neatly defined by the $h_n = nf$. Kettle drums would be an obvious example, but bells are another. In this case, you will be way off looking in the &quot;usual places&quot; +/- 5%.&lt;/li&gt;&#xA;&lt;li&gt;Many instruments have only even or odd harmonics. Others are designed to omit some harmonics. The piano, for example, is designed to have almost no 7th harmonic. This may not matter to you, but it's worth pointing out in case it does.&lt;/li&gt;&#xA;&lt;li&gt;It is common for higher harmonics to be &quot;out of tune&quot;, that is, not in the &quot;usual places&quot;. An engineer who once worked as a piano tuner once admonished me for using harmonics to tune my upright bass (a technique that works well for lighter-stringed instruments), because, he said, the partials are more out of tune with heavier stringed instruments. He said it's especially true told of higher harmonics, explaining that the math that gives you the simple formula for partials assumes that strings have no mass. 5% strikes me as a little much (almost a semi-tone!), but I don't think it's out of the question.&lt;/li&gt;&#xA;&lt;li&gt;Many instruments have &lt;a href=&quot;http://en.wikipedia.org/wiki/Vibrato&quot; rel=&quot;nofollow noreferrer&quot;&gt;vibrato&lt;/a&gt;. This throws all your harmonics out of wack:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R71Vb.gif&quot; alt=&quot;Image from channld.com/macthescope&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-11-29T15:36:07.490" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6132" PostTypeId="2" ParentId="6125" CreationDate="2012-11-29T15:39:09.623" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;how much error is typical and what is the relationship between the degree of error and the harmonic number&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think that's hard to answer.  Do you want to include contrived weird instruments with terrible inharmonicity?  Inherently inharmonic instruments that are manipulated to sound roughly harmonic, like bells and tympani?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started writing a program to analyze all of the &lt;a href=&quot;http://theremin.music.uiowa.edu/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Musical Instrument Samples Database&lt;/a&gt; and measure the inharmonicity of each harmonic, which would answer your question exactly for all those instruments, but I didn't finish it yet.  :)  &lt;a href=&quot;http://flic.kr/p/cNo4k9&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's a preliminary test graph&lt;/a&gt;, to give you a rough idea:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4rOdD.png&quot; alt=&quot;Inharmonicity vs harmonic number&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X axis is harmonic number, Y axis is frequency relative to a perfect multiple.  If the fundamental is 100 Hz, for instance, and the 2nd harmonic is 210 Hz, it will be mapped to 210/200 = 1.05.  The blue and green are piano tones (I didn't write down the fundamental frequency I used for this graph).  Purple and yellow are guitar.  Struck or plucked strings are inharmonic, with higher partials sharper than true harmonics.  The red and teal are double bass.  Bowed strings are perfectly harmonic because of the slip-stick motion of the bow. (Though there are weird jumps at the 2nd or 3rd harmonic.  Not sure what those are from.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The flattening out at the top right is definitely wrong, due to the algorithm &quot;locking onto&quot; things that are not actually harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for piano, you have to go up to the 25th partial to get 5% out of tune.  The 2nd partial is less than 1% off.  At the extremes, the 50th partial is maybe 13% sharp from the pure 50th harmonic.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2012-12-01T02:17:36.733" LastActivityDate="2012-12-01T02:17:36.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6133" PostTypeId="2" ParentId="6129" CreationDate="2012-11-29T16:55:02.077" Score="2" Body="&lt;p&gt;You mention that you want to interrogate the frequency response of your signal, specifically, that you want to know the levels of your signals high frequency components. (From: &quot;However I want to look only at certain high frequencies&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, if you just compute the DFT of your signal using MATLAB's built in function, this will tell you the frequency response of your signal. For example, you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz(signal, 1, 2^nextpow2(length(signal)), your_sampling_frequency_here);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should solve your problem as I understand it. From there, you can simply study the high-frequency components of your signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side note, you cannot, generally, filter a signal, then subtract the filtered version and look at the residual. This is because the very act of filtering your signal will introduce time/phase delays, which means that a subtraction between your filtered signal and original signal will be distorted accordingly. There are some techniques you could use to take those delays into account, but as a general case, be wary of doing such things. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-11-29T16:55:02.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6135" PostTypeId="1" CreationDate="2012-11-29T21:34:45.040" Score="2" ViewCount="1512" Body="&lt;p&gt;I have the following discrete system's transfer function (Z domain):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[z] = {z \over z - \frac{1}{2} }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to obtain the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The frequency response.&lt;/li&gt;&#xA;&lt;li&gt;The impulse response.&lt;/li&gt;&#xA;&lt;li&gt;The fourier spectre.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The first one is pretty easy we just substitute $z$ by $ e^{j \omega}$ giving us&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[\Omega] = { e^{j \omega} \over  e^{j \omega} - \frac{1}{2} }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second one is where I have some questions, as a rule the IR is just the anti-transform of the transfer function $h[\omega]$, the original transfer function $h[z]$ maps quite easily to $h[n] = ({1 \over 2})^n u[n]$, however I read or heard, not sure where though that the impulse response obtained from the frequecy response must be continuous, under that assumption we would replace $e^{j \Omega}$ with $\$$ giving us $h(\$) = {\$ \over $ - {1 \over 2}}$, the we would Laplace anti-trasnform to obtain the impulse response, so which approach would be the correct one? maybe I'm confusing concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the sake of completenes for the fourier espectre we just obtain the magnitude ($|h[\omega]|$) and phase of $\theta_{h[\omega]}$ and evaluate them over a set of $\omega$ values, plotting the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="3370" LastEditorUserId="-1" LastEditDate="2012-11-29T23:28:49.467" LastActivityDate="2013-07-18T04:04:37.520" Title="Obtaining the Impulse response from the frequency of a discrete system" Tags="|fourier-transform|homework|impulse-response|frequency-response|" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6136" PostTypeId="1" CreationDate="2012-11-29T22:21:04.223" Score="7" ViewCount="745" Body="&lt;p&gt;I've got a question related to a comparison of image segmentation algorithms.&#xA;I'd like to compare two algorithm results to each other in step one.&#xA;In another step I'd like to compare the two algorithms results against a few ground truth segmented images.&#xA;Unfortunately I got only a few ground truth data results in form of single images.&#xA;So I can't compare all possible images and parts of an image to the two algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first idea on step #1 was that I go down on subpixel area and look up which algorithm is more precise in relation to the original image and discuss it without the ground truth data.&#xA;I'll take the difference of the pixels on which the difference lasts. If it's too obvious, e.g. if one algorithm fails completely than the other wins automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second approach where I've got ground truth data I would measure the absolute difference in pixels of each algorithm on significant parts of an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what I wanted to know is:&#xA;1) Are this correct approaches for comparing segmentation algorithms? &#xA;2) How do I measure the difference in step 1? Do I have to measure all segments of each algorithm? &#xA;3) What is a good quality criteria? Is it possible to get a quantitative criteria for the two algorithms?&#xA;4) Do I have to compare the whole segmented parts of each algorithm to the ground truth data to gain absolutely correct results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if something is unclear or not correctly formulated.&#xA;Any help, advice or feedback is appreciated!&#xA;Thank you guys in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sincerely&lt;/p&gt;&#xA;" OwnerUserId="1923" LastActivityDate="2012-11-30T08:06:28.593" Title="Compare image segmentation approaches" Tags="|image-processing|computer-vision|image-segmentation|measurement|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6137" PostTypeId="1" AcceptedAnswerId="6140" CreationDate="2012-11-30T02:13:37.803" Score="1" ViewCount="1568" Body="&lt;p&gt;I have been researching about Speech Recognition and I have decided to take the MFCC approach to solving this problem of detecting whether someone is saying either &quot;Yes&quot; or &quot;No&quot;. So as mentioned before (My steps so far):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Read in Audio File&lt;/li&gt;&#xA;&lt;li&gt;Split the Audio Signal into blocks (600 samples, 30msec long)&lt;/li&gt;&#xA;&lt;li&gt;Strip the blocks that do not warrant consideration (Total Energy / Zero-crossing)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I am going to construct the MFCC based on &lt;a href=&quot;http://arxiv.org/pdf/1003.4083.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; and it has the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Pre–emphasis&lt;/li&gt;&#xA;&lt;li&gt;Framing&lt;/li&gt;&#xA;&lt;li&gt;Hamming Windowing &lt;/li&gt;&#xA;&lt;li&gt;FFT&lt;/li&gt;&#xA;&lt;li&gt;Mel Filter Bank Processing &lt;/li&gt;&#xA;&lt;li&gt;Discrete Cosine Transform &lt;/li&gt;&#xA;&lt;li&gt;Delta Energy and Delta Spectrum&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This makes sense to me (Kind of) and I am going to research into each of these steps. BUT should I perform the MFCC on the resulting blocks that I have already done with (steps 1, 2, 3) at the top of this question, or, should I not carry out these steps and just start from the beginning and compute the MFCC and will I still be able to implement a Hidden Markov Model?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other question is, if I split the signal into &quot;Frames&quot; (2D vector) will the resulting MFCC be a 2D vector, or a 1D vector?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope someone can help :)!&lt;/p&gt;&#xA;" OwnerUserId="1810" LastEditorUserId="1629" LastEditDate="2016-06-07T19:57:10.367" LastActivityDate="2016-06-07T19:57:10.367" Title="Voice Recognition - MFCC" Tags="|speech-recognition|mfcc|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6138" PostTypeId="1" CreationDate="2012-11-30T03:29:29.290" Score="8" ViewCount="2569" Body="&lt;p&gt;I am trying to ascertain what the 'ideal' FIR filter length should be, given the pulse length $T_p$ of a windowed sinusoid in noise that I seek to filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As parameters into an FIR filter that I design, I have:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$F_c = 15 \text{ kHz}$, The center frequency. (This is the carrier frequency of the signal). I know this. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since this is a BPF FIR, I specify the pass band as $F_{c} - \frac{1}{T_p}$ to $F_{c} + \frac{1}{T_p}$. This is because the bandwidth of the windowed sinusoid is $\frac{2}{T_p}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The last parameter that I do not know how exactly to specity, is the length of this FIR... this is where I am lost. What is the ideal length here, (if any?)... Should it just be the length of the pulse (in samples of course), thereby making it something akin to a matched filter? Does this mean I have no further gains in increasing filter length?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As further context, I am seeking this 'ideal' length, should it exist, because I am trying to filter out as much noise as possible, but also try my best to retain the sharp transients. This is what led me to ask, is there an ideal filter length to start from. For example, in the following plot below, I have filtered a noisy version of my signal, with filters of length &lt;em&gt;11&lt;/em&gt; (red) and &lt;em&gt;171&lt;/em&gt; (black) respectively. They are shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KQnaS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, while the black result is 'smoother', you can see that it is also more 'smudged' in as far as its transients go. In contrast, the red still retains some noise, but transients are not as affected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot below shows the spectrums of the above filters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kEtrL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TLDR:&lt;/strong&gt; So, is there an 'ideal' length for FIR filters, in so far as that further increasing the filter length does not buy you any more noise immunity, but might actually smear your transients even more than needed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;EDIT:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added two new images. The first one has filter of length 11, (red), filter of length 171, (black), and filter of length 901, (blue). The thick-blue is the spectrum of the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UaseW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the corresponding results for the filter of length 11, (red), and the new filter of length 901, (black). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qD5BC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="1629" LastEditDate="2016-05-18T15:15:27.727" LastActivityDate="2016-05-18T16:52:32.833" Title="What is the ideal FIR length, given a specific pulse length?" Tags="|filters|filter-design|bandpass|bandwidth|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6139" PostTypeId="2" ParentId="6136" CreationDate="2012-11-30T08:06:28.593" Score="3" Body="&lt;p&gt;Typically to compare segmentation algorithms, people use an NPR index. NPR stands for Normalized Probabilistic Rand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An over segmented or an under-segmented image will typically have negative values of NPR whereas a properly segmented image will have positive values of NPR index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of comparison is typically carried out for segmentation algorithms of the split-and-merge type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following this &lt;a href=&quot;http://www.ri.cmu.edu/pub_files/pub4/unnikrishnan_ranjith_2007_1/unnikrishnan_ranjith_2007_1.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; and the further publications of the group would be advantageous.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2012-11-30T08:06:28.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6140" PostTypeId="2" ParentId="6137" CreationDate="2012-11-30T10:06:16.593" Score="3" Body="&lt;p&gt;Regarding your existing steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do you have some overlap between adjacent blocks? It is common in feature extraction systems to have some overlap between adjacent blocks, so that a short transient event can be correctly captured (if it is right at the end of a block, it will be right in the middle of the next one).&lt;/li&gt;&#xA;&lt;li&gt;Your idea of discarding blocks is dangerous. You can do this to roughly identify the beginning and end of a speech segment; but silence recognition can also be built into the recognition model.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Regarding the data size:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your signal is split into frames. For each frame, you compute a 1-D MFCC vector. So in the end, you have a sequence of 1-D MFCC vectors. This is the data on which you train your HMMs.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2012-11-30T10:06:16.593" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6141" PostTypeId="1" CreationDate="2012-11-30T11:51:15.480" Score="4" ViewCount="498" Body="&lt;p&gt;I have a Bachelor of Science in Electrical Engineering, concentrating in VLSI, and I am currently in the process of switching fields to go into Physics. I love physics, and mathematics. I like pretty problems that need subtle insight to solve, which is why I'm moving from engineering to physics. Even though the prettiness of a problem may be subjective, I like the &quot;feeling&quot; I get when I'm doing physics, which was totally absent when I was working in VLSI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, before I make the transition complete, I would like to learn about other areas of electrical engineering that may be closer in spirit to physics and applied mathematics. I have a vague idea that signal processing and imaging are areas that may be quite different from VLSI. Are there any others? Which area should I dive into to get a feel for a different kind of electrical engineering? (I have matlab on my computer and I would like to make use of it). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I especially like to use mathematics on real world problems, and the reason I didn't enjoy VLSI too much is because it is full of boolean algebra, which is somewhat boring and non-visual. It would be helpful if, along with your topic suggestion, you could tell me what areas of mathematics it would involve. Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS - I don't have enough points to add &quot;projects&quot; and &quot;careers&quot; tag, so it would be nice if someone could do that for me. &lt;/p&gt;&#xA;" OwnerUserId="3374" LastEditorUserId="1558" LastEditDate="2012-11-30T12:14:09.507" LastActivityDate="2012-11-30T12:14:09.507" Title="Looking for project ideas to match my interests" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6142" PostTypeId="2" ParentId="6141" CreationDate="2012-11-30T12:12:54.263" Score="2" Body="&lt;p&gt;I am a former physician, having done half graduation in mechanical engineering, then a master degree in product design. Nowadays, I work for a biomedical/bioelectric-equipment company, doing mostly software design (algorithms and workflow), using Numpy (matlab like) for prototyping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;THAT fulfills my need (incredibly similar to yours) to solve new problems, work with pretty-picture generation via numbercrunching, programming, and putting the head to perform hard intellectual work very often. I can tell no two months from the three years I am working here have been like one another, and the product portfolio keeps increasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my spare-time, I have interest in geospatial stuff, most probably because I like to ride bikes on relatively remote places with maps and GPS, and the very description of geographical stuff allows for a lot of pretty-picturing. Recently, the avalanche of bike-riding GPS data on sites such as Strava, and the current problems CAUSED by traffic-engineering in big cities makes me think these statistical analysis from people displacement's big data can form a body of knowledge for an &quot;anti-traffic-engineering&quot; oriented for actual people instead of private automobiles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can &quot;feel&quot; there's a huge future demand, arriving pretty soon, for software tools that transform datasets into useful information. That can happen with medical imaging, geo-statistical imaging, traffic-engineering micro-modelling, and a lot of fields where data collection, transformation, analysis and interpretation is of huge importance, but still needs further development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure I am actually answering your question, but I feel your question is open to some daydreaming, so I hope this helps, and would be glad to answer any comment you may have!&lt;/p&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-11-30T12:12:54.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6143" PostTypeId="2" ParentId="6135" CreationDate="2012-11-30T13:36:54.283" Score="1" Body="&lt;p&gt;Impulse responses can be continuous or discrete, just like there are continuous and discrete versions of the Fourier transform.  Since this is a discrete system, giving a discrete impulse response is the appropriate thing to do.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-11-30T13:36:54.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6144" PostTypeId="1" AcceptedAnswerId="6151" CreationDate="2012-11-30T14:39:11.653" Score="14" ViewCount="2982" Body="&lt;p&gt;I am studying some deconvolution techniques, In order to remove motion blur, like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Richardson%E2%80%93Lucy_deconvolution&quot; rel=&quot;noreferrer&quot; title=&quot;Richardson-Lucy&quot;&gt;Richardson-Lucy&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;noreferrer&quot;&gt;Wiener&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Are there any pros / cons of using one versus another?&lt;br&gt;&#xA;For example which are the pros / cons of Richardson-Lucy technique?&lt;/p&gt;&#xA;" OwnerUserId="3376" LastEditorUserId="128" LastEditDate="2019-10-27T11:07:45.173" LastActivityDate="2021-08-18T15:30:03.390" Title="Deconvolution - Richardson Lucy vs. Wiener Filter" Tags="|image-processing|deconvolution|inverse-problem|blur|motion|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6145" PostTypeId="2" ParentId="6138" CreationDate="2012-11-30T18:10:55.593" Score="2" Body="&lt;p&gt;In order to obtain the &quot;best&quot; filter you need to go through a few steps&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Determine the spectrum of your signal: the spectrum of a windowed sine pulse is basically given by the window function convolved with the carrier. Since the carrier is a sine wave the convolution simply shifts the window spectrum. However the shape of the window is important: is it raised cosine, hanning, hamming, kaiser, etc. This determines how wide the bandwidth is and if there are strong side lobes that need to be maintained.&lt;/li&gt;&#xA;&lt;li&gt;Determine the spectrum of the noise: that's easiest done by looking at the spectrum at areas in the signal where there is only noise&lt;/li&gt;&#xA;&lt;li&gt;Look at signal and noise spectrum. Useful frequencies are the ones where the signal energy is larger than the noise. &quot;Bad&quot; frequencies are the ones where the noise is bigger.&lt;/li&gt;&#xA;&lt;li&gt;Create a filter specification that passes the &quot;useful&quot; frequencies and &quot;rejects&quot; the bad ones. The amount of rejection can be optimized using an approach called &quot;Wiener Filter&quot; &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Wiener_filter&lt;/a&gt;. In a pinch a bandpass will do as well.&lt;/li&gt;&#xA;&lt;li&gt;The filter spec should have at least center frequency, bandwidth and roll off steepness. More filter coefficients typically makes the pass band flatter and the roll off steeper. Again looking at a signal to noise graph will typically tell you what roll off makes sense&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-11-30T18:10:55.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6146" PostTypeId="1" CreationDate="2012-11-30T23:10:08.620" Score="3" ViewCount="5867" Body="&lt;p&gt;I've got a situation where I'd like to use an FFT to do interpolation in time on some complex data (I need to go to the frequency domain anyways to window my data).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notional way of doing this is to take an FFT, which, in the case of something like FFTW will put the frequency components &quot;in-order&quot; which can be viewed as having positive frequencies first, followed by negative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathcal{F}([\begin{array}{ccccccc} a &amp;amp; b &amp;amp; c &amp;amp; d &amp;amp; e &amp;amp; f &amp;amp; g &amp;amp; h \end{array}]) = \begin{array}{cccccccc} [A &amp;amp; B &amp;amp; C &amp;amp; D &amp;amp; E &amp;amp; F &amp;amp; G &amp;amp; H] \end{array}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where ABCD are positive frequency components, and EFGH are negative frequency components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can split the frequency response in two and zero-pad between D and E, but you have to be careful if your transform is an odd length, as well as possibly splitting the nyquist bin, and it's more cumbersome from a buffer-juggling perspective too.  It'd be better if I could pre-multiply by Fs/2, which will rotate the spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathcal{F}(exp(j2\pi fs/2t) * [\begin{array}{ccccccc} a &amp;amp; b &amp;amp; c &amp;amp; d &amp;amp; e &amp;amp; f &amp;amp; g &amp;amp; h \end{array}]) = \begin{array}{cccccccc} [E &amp;amp; F &amp;amp; G &amp;amp; H &amp;amp; A &amp;amp; B &amp;amp; C &amp;amp; D] \end{array}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it's just a matter of zero padding on the end, and getting back to the time domain.  This might be as simple as just transforming into a sufficiently large zeroed buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, it's the getting back to the time domain that's got me wrapped around the axle.  You can certainly inverse-FFT, and then multiply by -Fs/4 to shift things back to the way they should be, but I'd prefer to avoid the post-multiplication if I can (performance reasons).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My gut says that the shifted spectrum is now in the proper order (again in FFTW land) to just do a forward-FFT on it, but that might time-reverse the data, so perhaps a conjugate before transforming would be in order, but I'm not sure.  Can anyone help me puzzle this out?&lt;/p&gt;&#xA;" OwnerUserId="3377" LastActivityDate="2013-09-19T20:54:32.643" Title="Time domain interpolation using FFT with zero padding on the end" Tags="|fft|dft|interpolation|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6147" PostTypeId="1" CreationDate="2012-12-01T02:47:16.083" Score="3" ViewCount="621" Body="&lt;p&gt;I'm trying to figure out what the Signal to Quantized Noise Ratio (SQNR) is if I multiply 2 16-bit signed integer values and store the result as a 16-bit signed integer, dropping the least significant bits. Since this is signed multiplication, I'm dropping 15 bits of precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a (16 bit signed) * b (16 bit signed) = c (16 bit signed) without the LSBs.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to be more clear about what's after this, I am summing many successive values of the resulting 'c' - this sum is stored in an infinite length signed integer representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I calculate the SQNR in this situation?&lt;/p&gt;&#xA;" OwnerUserId="3379" LastActivityDate="2012-12-06T06:05:18.850" Title="SQNR when multiplying 2 16 bit signed integers and truncating result?" Tags="|noise|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6148" PostTypeId="2" ParentId="6135" CreationDate="2012-12-01T04:48:35.120" Score="0" Body="&lt;p&gt;$$&#xA;H(f) = \int_{-\infty}^{\infty} h(t) e^{-j 2 \pi ft} dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, given either a system's impulse response or its frequency response, you can calculate the other. Either one is sufficient to fully characterize the behavior of the system; the impulse response is useful when operating in the time domain and the frequency response is useful when analyzing behavior in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;h(t) here stands for the impulse response and H(f) stands for the frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also linking to an &lt;a href=&quot;https://dsp.stackexchange.com/questions/536/what-is-meant-by-a-systems-impulse-response-and-frequency-response&quot;&gt;excellent explanation&lt;/a&gt; on dsp.stackexchange, where you can understand the process in much more detail in comparison to substitute by s.&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-12-01T04:48:35.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6149" PostTypeId="2" ParentId="6129" CreationDate="2012-12-01T05:35:41.870" Score="2" Body="&lt;p&gt;Real filters for real-time applications approximate the ideal filter by truncating and windowing the infinite impulse response to make a finite impulse response; applying that filter requires delaying the signal for a moderate period of time, allowing the computation to &quot;see&quot; a little bit into the future. This delay is manifested as phase shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can calculate the phase shift manually(i.e by hand by following these steps).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute the Fourier transform of the filter.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the angle(or theta) of the Fourier transform. This means F(w) = |F(w)|(theta)&lt;/li&gt;&#xA;&lt;li&gt;The theta is the phase shift of the signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can then compute the time delay by multiplying the phase shift angle with the sampling(?) frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to work without time delays(or phase shifts) you should look at zero-phase filters which can be formed via &lt;a href=&quot;http://www.dspguide.com/ch19/4.htm&quot; rel=&quot;nofollow&quot;&gt;bi-directional filtering&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're multiplying in frequency domain, you're ignoring certain aspects of the time-domain signal and therefore not obtaining the true representation of your filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&#xA;In the frequency domain I can easily define F(w) such that it is 0 for 0:Fcutoff and 1 for Fcutoff:infinity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample algo for non-ideal High-pass filter in frequency domain would be :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; // Return RC high-pass filter output samples, given input samples,&#xA; // time interval dt, and time constant RC&#xA; function highpass(real[0..n] x, real dt, real RC)&#xA;   var real[0..n] y&#xA;   var real α := RC / (RC + dt)&#xA;   y[0] := x[0]&#xA;   for i from 1 to n&#xA;     y[i] := α * y[i-1] + α * (x[i] - x[i-1])&#xA;   return y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Therefore avoid designing the high-pass filters in the Fourier domain alone. Here alpha signifies the delay which you would have to artificially introduce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be an ideal high-pass filter with magnitude 1, which is un-realizable in real life because of the complexities that sampling brings into the picture.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2012-12-01T05:35:41.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6150" PostTypeId="1" AcceptedAnswerId="6183" CreationDate="2012-12-01T07:59:31.553" Score="3" ViewCount="1405" Body="&lt;p&gt;Is there any instance where Fourier transforms of color images have been used in conjunction with other object recognition method? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any instance of usage of Fourier transforms in color images? I think there is great potential in the usage of Fourier transforms of color images. &lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-06-21T02:08:56.433" Title="FFT of color images incorporated into an Object Recognition method?" Tags="|fourier-transform|image-segmentation|color|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6151" PostTypeId="2" ParentId="6144" CreationDate="2012-12-01T10:16:57.467" Score="11" Body="&lt;p&gt;Both are the MMSE estimators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main difference is Wiener is the optimal for Gaussian Noise while Richardson Lucy assumes Poisson Noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Poisson Noise is a better model for noise in photos captured by a Photo Diode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computationally, in the case of Gaussian Noise and Linear Convolution the solution has a closed form solution in the Maximum Likelihood / LS sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Lucy Richardson method, which is a Maximum Likelihood in the Poisson case, has no closed form solution and requires iterative approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://www.scribd.com/document/414486045/Noise-Image-Reconstruction-With-Noise&quot; rel=&quot;noreferrer&quot;&gt;Noise, Image Reconstruction with Noise (EE367/CS448I: Computational Imaging and Display, Class 10, Gordon Wetzstein, Stanford University)&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-07-17T13:27:39.080" LastActivityDate="2019-07-17T13:27:39.080" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6153" PostTypeId="1" CreationDate="2012-12-01T19:36:18.650" Score="1" ViewCount="531" Body="&lt;p&gt;I am working on a sinusoidal encoder &amp;amp; decoder to compress .wav files. For now I am trying to regenerate the audio by combining all the frequencies of the original .wav file. &#xA;Here is the code I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x fs] = wavread('clip.wav');&#xA;x  = mean(x,2);&#xA;NFFT = 1024;&#xA;hop = NFFT/2;&#xA;win = hann(NFFT);&#xA;&#xA;[S F]= spectrogram(x, win, hop, NFFT, fs);&#xA;freq = linspace(0, fs/2, hop + 1);&#xA;numFrames = size(S,2);&#xA;mag = abs(S);&#xA;phase = angle(S);&#xA;&#xA;%Decoding&#xA;output = zeros(size(x));&#xA;t = 0:(1/fs):(((NFFT-1)/fs));&#xA;sumOfCosine = zeros(1, NFFT );&#xA;frameStart = 1;&#xA;frameEnd = NFFT;&#xA;&#xA;%f = frame&#xA;for f = 1:numFrames&#xA;    sumOfCosine = zeros(1, NFFT );&#xA;&#xA;    %k = sinusoids in each frame&#xA;    for k = 1:hop+1&#xA;       sumOfCosine =  sumOfCosine + (mag(k,f)*cos(2*pi*F(k)*t + phase(k,f)));&#xA;    end&#xA;&#xA; sumOfCosine = sumOfCosine.*win';&#xA; a = hop;&#xA; % Normalize the window&#xA; sumOfCosine = (sumOfCosine./a);&#xA; sumOfCosine = sumOfCosine';&#xA; output(frameStart:frameEnd) = ((output(frameStart:frameEnd)+ sumOfCosine));&#xA; frameStart = frameStart + (hop);&#xA; frameEnd = frameEnd + (hop);&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I play play &lt;code&gt;output&lt;/code&gt;, there is still some noise in it. I tried comparing the original matrix &lt;code&gt;x&lt;/code&gt; multiplied by the window, &lt;code&gt;win&lt;/code&gt; to the &lt;code&gt;output&lt;/code&gt; frame by frame, and I can see that &lt;code&gt;output&lt;/code&gt; represented by green doesn't completely overlap with the original windowed signal. I am pasting the images for the first three frames below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uXj0y.png&quot; alt=&quot;Frame 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4L0ti.png&quot; alt=&quot;Frame 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ge149.png&quot; alt=&quot;Frame 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it can be seen there is some error due to the overlapping of windows maybe? I'd appreciate help in fixing this and make the output sound cleaner. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3385" LastEditorUserId="3385" LastEditDate="2012-12-01T20:27:59.370" LastActivityDate="2012-12-01T20:27:59.370" Title="Sinusoidal Synthesis of audio" Tags="|matlab|audio|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6154" PostTypeId="2" ParentId="6153" CreationDate="2012-12-01T20:02:07.693" Score="1" Body="&lt;p&gt;For the phases of sinusoids within the frame overlaps to sum constructively, either t has to be adjusted to be frame relative, or the fft phase result has to be adjusted to be relative to the same absolute time as t.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-12-01T20:02:07.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6155" PostTypeId="2" ParentId="6125" CreationDate="2012-12-01T20:57:22.767" Score="0" Body="&lt;p&gt;The idea that the higher harmonics are exact multiple of the fundamental is only true for a model that is a) pure linear, b) continuous , and c) only one-dimensional. Nothing of that is true in reality. The exact reason why it is for the piano exactly the way it is I cannot answer. But the main reason is nonlinearity in combination with the fact that even a string must be treated three-dimensional if one is interested in the details.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2012-12-01T20:57:22.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6158" PostTypeId="1" CreationDate="2012-12-02T00:20:50.833" Score="9" ViewCount="748" Body="&lt;p&gt;I am looking to develop an Android app. As part of the functionality the app would require to randomly sample 3-5 seconds of audio and classify it as containing human speech or not. I understand that this concept is called Voice Activity Detection?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to implement this on a Mobile phone. I developed a basic system using energy based features and thresholds. I am hoping to find something less susceptible to noise, probably using features such as MFCC or formants? I did go through a number of papers, but most of them would require me to collect data and train models. Is there any library or framework I could use which would work in realtime?&lt;/p&gt;&#xA;" OwnerUserId="3386" LastActivityDate="2018-09-26T06:01:45.257" Title="Detect human speech in realtime audio on mobile phones" Tags="|audio|speech|real-time|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6159" PostTypeId="1" AcceptedAnswerId="6175" CreationDate="2012-12-02T00:28:37.373" Score="2" ViewCount="945" Body="&lt;p&gt;Which audio features should be used to detect tone from audio? Are there any open source frameworks or implementations which can be ported to mobile phones to process audio?&#xA;Alternatively, would it be possible to collect audio features from the phone and then process this on the server so as to detect tone?&lt;/p&gt;&#xA;" OwnerUserId="3386" LastEditorUserId="3386" LastEditDate="2012-12-02T17:52:37.803" LastActivityDate="2012-12-04T09:00:34.950" Title="Emotional Tone detection using audio on mobile phones" Tags="|speech|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6161" PostTypeId="1" AcceptedAnswerId="6162" CreationDate="2012-12-02T01:12:45.467" Score="0" ViewCount="519" Body="&lt;p&gt;I am constructing a MFCC and come to a section which is kind of confusing me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 4: Fast Fourier Transform &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and has this equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dV0EJ.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I understand that FFT needs to be carried out, I just don't understand where the values are meant for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;h(t)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(t)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H(w)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(w)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Up to now, I have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Inputted the raw signal (vector)&lt;/li&gt;&#xA;&lt;li&gt;Pre-emphasis filtering on the signal&lt;/li&gt;&#xA;&lt;li&gt;Carried out &quot;Framing&quot; (vector of vectors)&lt;/li&gt;&#xA;&lt;li&gt;Computed Hamming Window&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's just this step I am unsure of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope someone can help :)&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2012-12-02T02:00:56.387" Title="Time -Domain to Frequency Domain" Tags="|fft|time-frequency|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6162" PostTypeId="2" ParentId="6161" CreationDate="2012-12-02T02:00:56.387" Score="1" Body="&lt;p&gt;By convention they mean the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)$ = Input in the time domain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h(t)$ = Filter impulse response (time domain)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(w)$ = Filter frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(w)$ = Input in the frequency domain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the equation that you wrote the two &quot;*&quot; symbols mean different things.  In the time domain it is convolution, in the frequency domain it is multiplication.  The equation is just saying that convolution in the time domain (which is how you do time domain filtering) is equivalent to multiplication in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-12-02T02:00:56.387" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="6163" PostTypeId="2" ParentId="6147" CreationDate="2012-12-02T02:21:14.283" Score="2" Body="&lt;p&gt;When you multiply the two 16 bit numbers you get the &quot;true&quot; 32 bit number and then you truncate to get a 16 bit number.  The noise that is introduced when you truncate is a random value from $0$ to $2^{16}-1$ ($65535$), which averages out to $32767.5$ and has an average power (average of the square) of $1.43E9$.  If you were rounding instead of truncating it would be a random value from $-(2^{15})$ to $2^{15}-1$, which averages out to approximately $0$ (no bias), and has an average power of $3.58E8$.  That's why it's better to round than truncate, but that's a story for another day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The truncation noise, therefore, is $1.43E9$.  You get the signal power by multiplying your truncated data by $2^{16}$ (to make the 16 bit values into 32 bit values), squaring them, and then calculating the mean.  You then calculate the SQNR by dividing the signal power by the truncation noise, $1.43E9$.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-12-02T02:21:14.283" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6164" PostTypeId="1" CreationDate="2012-12-02T03:07:16.443" Score="0" ViewCount="2027" Body="&lt;p&gt;I am feeding the samples of pure sin wave to the audio DAC, I would like to create an echo effect. What I am not sure is how to go about it.&#xA;I was thinking about superimposing the the current buffer that I am feeding with the delayed version of it with some decaying factor but that does not seem to help at all. I am using FIFO buffer to fill up with the next sample. &#xA;Is there any standard approach in creating a good echo effect? How long the delay should be(how many samples)?&lt;/p&gt;&#xA;" OwnerUserId="2102" LastActivityDate="2020-05-03T19:32:32.533" Title="How to create an echo effect in audio samples?" Tags="|audio|discrete-signals|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6165" PostTypeId="2" ParentId="1167" CreationDate="2012-12-02T06:11:33.020" Score="9" Body="&lt;p&gt;Let us consider a hypothetical random process where the sample functions are DC values and are different from each other:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;X&lt;sub&gt;1&lt;/sub&gt;(t)  = constant= mean of X&lt;sub&gt;1&lt;/sub&gt;(t)&lt;/p&gt;&#xA;&lt;p&gt;X&lt;sub&gt;2&lt;/sub&gt;(t)  = constant= mean of X&lt;sub&gt;2&lt;/sub&gt;(t)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The temporal mean of &lt;span class=&quot;math-container&quot;&gt;$X_1(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_2(t)$&lt;/span&gt; are constant but not equal.&#xA;if my process is stationary &lt;span class=&quot;math-container&quot;&gt;$X(t_1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(t_2)$&lt;/span&gt; are equal and RVs (refer Dilip's answer)&lt;/p&gt;&#xA;&lt;p&gt;So ensemble mean of &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; is constant.&lt;/p&gt;&#xA;&lt;p&gt;This ensemble mean is certainly not equal to the temporal mean of &lt;span class=&quot;math-container&quot;&gt;$X_1(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_2(t)$&lt;/span&gt; (they themselves are not equal). This can be called a stationary but &lt;strong&gt;not&lt;/strong&gt; an ergodic process.&lt;/p&gt;&#xA;&lt;p&gt;In contrast , &lt;span class=&quot;math-container&quot;&gt;$X(t)=Acos(\omega t+\theta)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is an RV is ergodic.&lt;/p&gt;&#xA;" OwnerUserId="3388" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-12-02T15:09:23.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6166" PostTypeId="2" ParentId="6146" CreationDate="2012-12-02T06:50:05.983" Score="5" Body="&lt;p&gt;It's important to remember that, for an even N, you have both F(0) and F(N/2) points, neither of which has a counterpart.  So, for instance, with N = 8, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;F(0),  F(1),  F(2),  F(3),  F(4),  F(-3),  F(-2),  F(-1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(some people consider the N/2 point as a negative frequency ( ie: F(-4) ), but we'll consider it to be positive)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to interpolate an 8 point FFT by a factor of 2, you'd do a 16 point inverse FFT using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;F(0),  F(1),  F(2),  F(3),  F(4)/2,  0,  0,  0,  0,  0,  0,  0,  F(4)/2,  F(-3),  F(-2),  F(-1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you split the N/2 point of your forward FFT, and add the appropriate number of zeroes in the center, and do the inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for an odd number N, you DON'T have an N/2 point (but you still have a unique 0 point), and the splitting business doesn't happen (but you still have to add the appropriate zeroes in the center).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you experiment with the FFT/IFFT method by using: a real input time domain waveform; a complex input time domain waveform; even and odd N; an integer number of cycles in the input; a non-integer number of cycles in the input.  Then compare/contrast your results from the FFT/IFFT method with to those generated by a strictly time domain based interpolation (eg: use A*cos(omega*t) for the FFT/IFFT method and compare to A*cos(omega*t/2) generated in the time domain).  Experience can be enlightening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your multiplying method – I don't think it will work for an even N.  And the FFT/IFFT timing, unless you're using very small FFT's, will probably dominate the total run time (of, course, you should always profile your programs to make sure).&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2012-12-02T06:50:05.983" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="6167" PostTypeId="1" AcceptedAnswerId="6169" CreationDate="2012-12-02T07:26:53.723" Score="0" ViewCount="711" Body="&lt;p&gt;I'm trying to understand how to find the coefficients a-h for inverse mapping,&#xA;my goal is to program projective transform from scratch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let assume i have user input 4 coords entered clockwise onto imageA and i want to map imageB.&#xA;imageA is 300X300 and imageA is 256X256.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ result ] = findCoefficients( imageA, imageB )&#xA;% finds coefficients for inverse mapping algorithem &#xA;%   takes 2 X 2d vectors each consists of 4 points x,y&#xA;%   and returns the coef accroding to reverse mapping function&#xA;%&#xA;% x y 0 0 1 0 -xx' -yx'&#xA;% 0 0 x y 0 1 -xy' -yy'  &#xA;%                       y' and x' are in the destination picture;&#xA;&#xA;&#xA;A = [imageB(1,1) imageB(2,1) 0 0 1 0 -imageB(1,1)*imageA(1,1) -imageB(2,1)*imageA(1,1); &#xA;0 0 imageB(1,1) imageB(2,1) 0 1 -imageB(1,1)*imageA(2,1) -imageB(2,1)*imageA(2,1);&#xA;imageB(1,2) imageB(2,2) 0 0 1 0 -imageB(1,2)*imageA(1,2) -imageB(2,2)*imageA(1,2);&#xA;0 0 imageB(1,2) imageB(2,2) 0 1 -imageB(1,2)*imageA(2,2) -imageB(2,2)*imageA(2,2);&#xA;imageB(1,3) imageB(2,3) 0 0 1 0 -imageB(1,3)*imageA(1,3) -imageB(2,3)*imageA(1,3);&#xA;0 0 imageB(1,3) imageB(2,3) 0 1 -imageB(1,3)*imageA(2,3) -imageB(2,3)*imageA(2,3);&#xA;imageB(1,4) imageB(2,4) 0 0 1 0 -imageB(1,4)*imageA(1,4) -imageB(2,4)*imageA(1,4);&#xA;0 0 imageB(1,4) imageB(2,4) 0 1 -imageB(1,4)*imageA(2,4) -imageB(2,4)*imageA(2,4)];&#xA;B = [imageA(1,1); imageA(2,1); imageA(1,2); imageA(2,2); imageA(1,3); imageA(2,3); imageA(1,4); imageA(2,4)];&#xA;&#xA;result = pinv(A)*B;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i'm getting a strange result it maps the photo however no into the bounding square i have chosen&lt;/p&gt;&#xA;" OwnerUserId="1831" LastEditorUserId="1031" LastEditDate="2012-12-02T15:48:49.090" LastActivityDate="2012-12-03T04:53:28.567" Title="inverse mapping" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6168" PostTypeId="2" ParentId="6164" CreationDate="2012-12-02T14:26:29.223" Score="1" Body="&lt;p&gt;As hotpaw2 said, you are not going to hear an echo or delay effect unless your signal changes, so you are not hearing it because you are sending in pure, unchanging signal. You might want to try sending a burst of sine waves every second or better yet a &lt;a href=&quot;http://en.wikipedia.org/wiki/Chirp&quot; rel=&quot;nofollow noreferrer&quot;&gt;chirp&lt;/a&gt; or an actual recording of music or someone speaking. It will work best if you have periods of silence in your input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an explanation of &lt;a href=&quot;https://stackoverflow.com/questions/11793310/how-to-add-echo-effect-on-audio-file-using-objective-c/11804367#11804367&quot;&gt;how to create a delay or echo effect&lt;/a&gt; in c-like pseudo-code.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-12-02T14:26:29.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6169" PostTypeId="2" ParentId="6167" CreationDate="2012-12-02T16:09:52.030" Score="2" Body="&lt;p&gt;I think you have error in your matrix $A$. According to &lt;a href=&quot;http://xenia.media.mit.edu/~cwren/interpolator/&quot; rel=&quot;nofollow&quot;&gt;this derivation&lt;/a&gt;, the matrix should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A=\begin{pmatrix} x &amp;amp; y &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -x' y &amp;amp; -x' y \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; x &amp;amp; y &amp;amp; 1 &amp;amp; -y' x &amp;amp; - y' y \\ &amp;amp; &amp;amp; &amp;amp; &amp;amp; \vdots \end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe your matrix is OK, but it depends on how your point vector is organized. In either case, the problem is probably in organization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that $A$ can easily get singular or near-singular. Solving $Ah=b$ for $h$ using direct inverse of $A$ is numerically quite unstable. You can use either QR decomposition or SVD to solve the linear system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even better method is a normalized DLT (Direct Linear Transform) which work with homogenous coordinates and the normalization step works as preconditioning to the above linear system. This is much more stable solution described in &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot; rel=&quot;nofollow&quot;&gt;Hartley &amp;amp; Zisserman's book&lt;/a&gt; (p. 88, section 4.1).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-12-03T04:53:28.567" LastActivityDate="2012-12-03T04:53:28.567" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6171" PostTypeId="1" AcceptedAnswerId="6237" CreationDate="2012-12-03T03:42:04.023" Score="4" ViewCount="774" Body="&lt;p&gt;I'm currently working with audio signals and have a problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;C = A*B + N&lt;/strong&gt;, where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;C&lt;/strong&gt; = recorded signal from microphone consisting of:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt; = known music file data played on speakers next to microphone  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;B&lt;/strong&gt; = some convolution on the recorded A-sound due to speaker-&gt;mic roundtrip&lt;br&gt;&#xA;(I mean the recorded signal won't be 100% the same as the audio data from the file before it is played to the speaker and recorded by mic. (Is this an impulse response?))  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;N&lt;/strong&gt; = some additional noise sounds recorded by microphone  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My goal:&lt;/strong&gt; an approximate estimation as to whether there is a signal N and how loud it is.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I don't have a need for accurate data!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional info:&lt;br&gt;&#xA;I'm working with Apple's vDSP API. I have cross correlated the signals A and C, so I have the time window in which the signals overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the overlapping window, I have both signals in the time and frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm helpless if, for example, a Wiener filter is the right approach and if I'm capable to apply one with my known parameters(Is a known noise required? or the impulse response of the environment?).  I tried to apply a Wiener deconvolution by dividing C/A in the frequency domain with no success.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once more: I don't need accurate data, just a rough guess how much N is there in the signal C. Actually a SNR like measure would be sufficient.&lt;/p&gt;&#xA;" OwnerUserId="3160" LastEditorUserId="128" LastEditDate="2019-03-24T17:25:49.570" LastActivityDate="2019-03-24T17:25:49.570" Title="Audio Signal Noise Filter Problem" Tags="|filters|audio|noise|denoising|deconvolution|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6172" PostTypeId="1" AcceptedAnswerId="6173" CreationDate="2012-12-03T07:15:05.047" Score="0" ViewCount="249" Body="&lt;p&gt;the question below asked in my latest signal processing exam. I have no idea about it and i could not find any solution in literature. Could you please help me finding out the answer. Actually i believe that i am quite good at signal processing until this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A voltage signal is sampled digitally in the laboratory at three different sampling frequencies, and FFTs are performed on the sampled data. In all cases, 512 data points are taken. Here is a record of the observations: &#xA;‒ Data sampled at 115 Hz: A peak appears in the frequency spectrum at 2 Hz, with amplitude close to 3.0 V. Another peak appears in the frequency spectrum at 45 Hz, with amplitude close to 1.0 V. &#xA;‒ Data sampled at 280 Hz: A peak appears in the frequency spectrum at 48 Hz, with amplitude close to 3.0 V. Another peak appears in the frequency spectrum at 95 Hz, with amplitude close to 1.0 V. &#xA;-Data sampled at 500 Hz: A peak appears in the frequency spectrum at 185 Hz, with &#xA;amplitude close to 1.0 V. Another peak appears in the frequency spectrum at 232 Hz, &#xA;with amplitude close to 3.0 V. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: What are most likely the true frequencies (and their corresponding amplitudes) in the voltage signal.&lt;/p&gt;&#xA;" OwnerDisplayName="user1871830" LastActivityDate="2012-12-03T13:44:59.967" Title="Commenting frequency spectrum of a sampled data" Tags="|fft|frequency|frequency-spectrum|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6173" PostTypeId="2" ParentId="6172" CreationDate="2012-12-03T10:53:44.597" Score="2" Body="&lt;p&gt;Consider the 3V component first (note that aliassing only affects frequency, not amplitude, so the 3V component will have the same magnitude at whatever frequencies it is aliassed to):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;code&gt;Fs = 115&lt;/code&gt; Hz the 3V component shows up at 2 Hz, so it's real frequency could be any value which satisfies &lt;code&gt;f = 115*k +/- 2&lt;/code&gt;, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  2 Hz&#xA;113 Hz&#xA;117 Hz&#xA;228 Hz&#xA;232 Hz&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do the same thing for &lt;code&gt;Fs = 280 Hz&lt;/code&gt;, where we have &lt;code&gt;f = 280*k +/- 48&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 48 Hz&#xA;232 Hz&#xA;328 Hz&#xA;512 Hz&#xA;608 Hz&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then again for &lt;code&gt;Fs = 500 Hz&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;232 Hz&#xA;268 Hz&#xA;732 Hz&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We can see that the only frequency which corresponds in all 3 cases is &lt;code&gt;232 Hz&lt;/code&gt;, so it looks like we have a 3V component at &lt;code&gt;f = 232 Hz&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now apply the same approach to identify the frequency of the 1V component.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastActivityDate="2012-12-03T10:53:44.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6175" PostTypeId="2" ParentId="6159" CreationDate="2012-12-03T14:37:03.583" Score="2" Body="&lt;p&gt;I dont know how bound your problem is... Is this dealing only with words that are already detected?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very very hard problem, as @JimClay mentions. For such problems, one cannot simply say &quot;pick highest &quot;x&quot;&quot;, because the features are not obvious to us. (Even though they might be obvious to non-observable states within our brains, whose signal processing paradigms are unfortunately inaccessible to us via introspection).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in problems such as those, I would first collect a large sample of &quot;angry&quot; tones, and a large sample of &quot;happy&quot; tones to contrast. You now have two options:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I would 'brute force' it and start looking for features to extract that separate them amicably in feature space. It is honestly hard to say where to begin without looking at real data. VERY coarsely speaking, I imagine angry tones have more low-frequency information, VS higher-pitched happy ones. This then lends itself to including the DFT of the data as 1 feature in DFT_length dimensional space. Of course, not all 'low pitchy' sounds are angry, and not all high-pitchy sounds are happy, so you need another feature vector(s) on which to discriminate, lest you inadvertently create a male-female detector...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I would use a different approach and simply label my data vectors, (here, each data vector is the time domain snippet of detected words, all of which are re-sampled so that they have the same pre-determined length). I would then start off with a simple &lt;a href=&quot;http://en.wikipedia.org/wiki/Perceptron&quot; rel=&quot;nofollow&quot;&gt;linear perceptron&lt;/a&gt; to try and create a hyper-plane to best separate the two classes. (You can add an extra dimension to your classifier to make linearly un-separable clusters separable by taking your hyper-plane up one more dimension). Once adequately trained, you can use that weight vector as your classifier and project all data vectors unto it to determine which class it falls under. Bear in mind you need A LOT of training data for this to work properly, because there are many situations where emotions can manifest itself in words and phrases. This is why I asked you how bound your problem is. (Words? Phrases? Sentences?, etc). &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2012-12-03T14:37:03.583" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6177" PostTypeId="1" CreationDate="2012-12-03T15:35:38.403" Score="13" ViewCount="1918" Body="&lt;p&gt;So I'm trying to write a frequency-domain interpolator that zero-pads the frequency response of a signal and inverse transforms.  There's two cases I have to deal with:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Even-length response - have to split the $F_s/2$ bin because it's ambiguous.  So I copy the negative part of the spectrum, and add &lt;code&gt;n*(interp-1)-1&lt;/code&gt; zeros in between.&lt;/li&gt;&#xA;&lt;li&gt;Odd-length response - there is no $F_s/2$ bin so just split positive/negative frequency and insert &lt;code&gt;n*(interp-1)&lt;/code&gt; zeros between them.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The code that does the zero-padding can be seen &lt;a href=&quot;http://pastebin.com/nngQaSTB&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Copy negative frequency components to end of buffer and zero out middle&#xA;//  inp    - input buffer of complex floats&#xA;//    n    - transform size&#xA;//  interp - interpolation amount&#xA;void zero_pad_freq(cfloat_t *inp, size_t n, size_t interp) {&#xA;    if ((n % 2) == 0) {&#xA;        memmove(inp + n*interp - n/2, inp + n/2,     n/2*sizeof(cfloat_t));&#xA;        memset (inp + n/2 + 1, 0,       (n*(interp-1)-1)*sizeof(cfloat_t)); // Duplicate Fs/2 so we need one less zero&#xA;&#xA;        inp[n/2]          /= 2.0;&#xA;        inp[n*interp-n/2] /= 2.0;&#xA;    } else {&#xA;        memmove(inp + n*interp - n/2, inp + (n+1)/2, n/2*sizeof(cfloat_t));&#xA;        memset (inp + (n+1)/2, 0,         (n*(interp-1))*sizeof(cfloat_t));&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first case is working fine, I'm testing it on a chirp signal and it interpolates just fine, there's a little numeric noise, but it's round tripped through an FFT so what can you do (first $50 \mu s$ or so of the signal show):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t12RJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t12RJ.png&quot;/&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is with the odd-length transform, I'm getting a pretty heinous transient response on the real samples only ($50 \mu s$ again, real):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qOwT0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qOwT0.png&quot;/&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imaginary channel has a small ripple on it, but not nearly as bad:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2umXC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2umXC.png&quot;/&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's like I've screwed up my $F_s/2$ bin in the odd case, but there is no $F_s/2$ bin, so I'm very puzzled.  Anyone have any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="3382" LastEditorUserId="1629" LastEditDate="2016-05-15T18:00:18.857" LastActivityDate="2017-05-27T13:10:43.107" Title="Real-valued ringing when zero-padding odd-length FFT" Tags="|fft|interpolation|c|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="6178" PostTypeId="2" ParentId="5959" CreationDate="2012-12-03T18:00:28.883" Score="22" Body="&lt;p&gt;What your distortion box does is apply a non-linear transfer function to the signal: &lt;code&gt;output = function(input)&lt;/code&gt; or &lt;code&gt;y = f(x)&lt;/code&gt;.  You're just applying the same function to every individual input sample to get the corresponding output sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your input signal is a sine wave, a specific type of distortion is produced called &lt;a href=&quot;https://en.wikipedia.org/wiki/Distortion#Harmonic_distortion&quot; rel=&quot;noreferrer&quot;&gt;harmonic distortion&lt;/a&gt;.  All of the new tones created by the distortion are perfect harmonics of the input signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If your transfer function has &lt;a href=&quot;https://en.wikipedia.org/wiki/Even_and_odd_functions&quot; rel=&quot;noreferrer&quot;&gt;odd symmetry&lt;/a&gt; (can be rotated 180° about the origin), then it will produce only odd harmonics (1f, 3f, 5f, ...).  An example of a system with odd symmetry is a symmetrically-clipping amplifier.&lt;/li&gt;&#xA;&lt;li&gt;If your transfer function has &lt;a href=&quot;https://en.wikipedia.org/wiki/Even_and_odd_functions&quot; rel=&quot;noreferrer&quot;&gt;even symmetry&lt;/a&gt; (can be reflected across the Y axis), then the harmonics produced will only be even-order harmonics (0f, 2f, 4f, 6f, ...)  The fundamental 1f is an odd harmonic, and gets removed.  An example of a system with even symmetry is a full-wave rectifier.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So yes, if you want to add odd harmonics, put your signal through an odd-symmetric transfer function like &lt;code&gt;y = tanh(x)&lt;/code&gt; or &lt;code&gt;y = x^3&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to add only even harmonics, put your signal through a transfer function that's even symmetric plus an identity function, to keep the original fundamental.  Something like &lt;code&gt;y = x + x^4&lt;/code&gt; or &lt;code&gt;y = x + abs(x)&lt;/code&gt;.  The &lt;code&gt;x +&lt;/code&gt; keeps the fundamental that would otherwise be destroyed, while the &lt;code&gt;x^4&lt;/code&gt; is even-symmetric and produces only even harmonics (including DC, which you probably want to remove afterwards with a high-pass filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Even symmetry:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transfer function with even symmetry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IDU18.png&quot; alt=&quot;y = x^6 transfer function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original signal in gray, with distorted signal in blue and spectrum of distorted signal showing only even harmonics and no fundamental:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RqxD8.png&quot; alt=&quot;y = x^6 spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Odd symmetry:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transfer function with odd symmetry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EBnE6.png&quot; alt=&quot;y = x^7 transfer function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original signal in gray, with distorted signal in blue and spectrum of distorted signal showing only odd harmonics, including fundamental:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JNvdw.png&quot; alt=&quot;y = x^7 spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Even symmetry + fundamental:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transfer function with even symmetry plus identity function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VnkzE.png&quot; alt=&quot;y = x + x^4 transfer function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original signal in gray, with distorted signal in blue and spectrum of distorted signal showing even harmonics plus fundamental:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/07hxn.png&quot; alt=&quot;y = x + x^4 spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what people are talking about when they say that a distortion box &quot;adds odd harmonics&quot;, but it's not really accurate.  The problem is that harmonic distortion &lt;em&gt;only exists for sine wave input&lt;/em&gt;.  Most people play instruments, not sine waves, so their input signal has multiple sine wave components.  In that case, you get &lt;a href=&quot;https://en.wikipedia.org/wiki/Intermodulation&quot; rel=&quot;noreferrer&quot;&gt;intermodulation distortion&lt;/a&gt;, not harmonic distortion, and these rules about odd and even harmonics no longer apply.  For instance, applying a full-wave rectifier (even symmetry) to the following signals:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;sine wave (fundamental odd harmonic only) → full-wave rectified sine (even harmonics only)&lt;/li&gt;&#xA;&lt;li&gt;square wave (odd harmonics only) → DC (even 0th harmonic only)&lt;/li&gt;&#xA;&lt;li&gt;sawtooth wave (odd and even harmonics) → triangle wave (odd harmonics only)&lt;/li&gt;&#xA;&lt;li&gt;triangle wave (odd harmonics only) → 2× triangle wave (odd harmonics only)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So the output spectrum depends strongly on the input signal, not the distortion device, and whenever someone says &quot;&lt;a href=&quot;https://proguitarshop.com/andyscorner/even-order-harmonics&quot; rel=&quot;noreferrer&quot;&gt;our amplifier/effect produces more-musical even-order harmonics&lt;/a&gt;&quot;, you should &lt;a href=&quot;http://sound.westhost.com/valves/thd-imd.html&quot; rel=&quot;noreferrer&quot;&gt;take it with a grain of salt&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(There is some truth to the claim that sounds with &lt;a href=&quot;http://flic.kr/p/eaGRxH&quot; rel=&quot;noreferrer&quot;&gt;even harmonics are &quot;more musical&quot; than sounds with only odd harmonics&lt;/a&gt;, but these spectra aren't actually being produced here, as explained above, and this claim is only valid in the context of Western scales anyway.  Odd-harmonic sounds (square waves, clarinets, etc.) are more consonant on a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bohlen%E2%80%93Pierce_scale&quot; rel=&quot;noreferrer&quot;&gt;Bohlen–Pierce musical scale&lt;/a&gt; based around the 3:1 ratio instead of the 2:1 octave.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to remember is that digital non-linear processes can cause aliasing, which can be badly audible.  See &lt;a href=&quot;https://dsp.stackexchange.com/q/2608/29&quot;&gt;Is there such a thing as band-limited non-linear distortion?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-08-11T18:14:46.730" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6180" PostTypeId="2" ParentId="6159" CreationDate="2012-12-04T02:17:45.663" Score="0" Body="&lt;p&gt;There are a number of papers on this topic in IEEE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://tomas.pfister.fi/files/pfister10dissertation.pdf&quot; rel=&quot;nofollow&quot;&gt;This&lt;/a&gt;&lt;/strong&gt; a thesis on the topic available to download. You can look at the papers in the thesis bibliography.&lt;/p&gt;&#xA;" OwnerUserId="3387" LastEditorUserId="1273" LastEditDate="2012-12-04T09:00:34.950" LastActivityDate="2012-12-04T09:00:34.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6181" PostTypeId="2" ParentId="6103" CreationDate="2012-12-04T03:46:42.657" Score="0" Body="&lt;p&gt;You could have a look at this paper: &lt;a href=&quot;http://web.media.mit.edu/~dolguin/CISS05_Olguin_Bouchereau_Martinez.pdf&quot; rel=&quot;nofollow&quot;&gt;http://web.media.mit.edu/~dolguin/CISS05_Olguin_Bouchereau_Martinez.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also demonstrates how to artificially generate Power-line interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The power line noise interference is a frequency-varying sinusoidal with a center frequency of 60 Hz. In this work this interference will be modeled as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p(n) = A cos{2π[f0 + fv(n)]n + ψ} .&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2012-12-04T03:46:42.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6182" PostTypeId="1" CreationDate="2012-12-04T08:14:52.160" Score="8" ViewCount="1744" Body="&lt;p&gt;I am trying to decipher a message hidden within a very noisy audio file(.wav)(I think it is white noise with an additional low drone).  The message is a &lt;em&gt;six digit number&lt;/em&gt;. I have not have any further details about the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I attempted to use a low-pass filter in the hopes that eliminating most of the higher frequencies would allow me to hear the numbers but, I seem to be unable to also get rid of enough of the low drone to hear the voice well enough. My attempt was as follows (the employed function &lt;code&gt;freq_space_low_pass_filter&lt;/code&gt; is included at the end):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[data, SampleRate, NbitsPerSample]=wavread('noisy_msg6.wav');&#xA;&#xA;y=data(:,1); % we will work only with one channel in this demo &#xA;N=length(y); %number of sample points&#xA;t=( (1:N)*1/SampleRate ).'; % time spacing is 1/SampleRate and we want column vector&#xA;&#xA;Y=fft(y);&#xA;&#xA;spectrum_freq=fourier_frequencies(SampleRate, N);&#xA;&#xA;Freq3db=100;&#xA;[spectrum_filtered,g_vs_freq]=freq_space_low_pass_filter(Y, SampleRate, Freq3db);&#xA;&#xA;&#xA;y_filtered=ifft(spectrum_filtered);&#xA;&#xA;y_filtered=real(y_filtered);&#xA;&#xA;&#xA;&#xA;wavwrite(y_filtered/(0.1+max(y_filtered)), SampleRate, NbitsPerSample,&#xA;         'noisy_msg6_filtered.wav');&#xA;&#xA;%%%%%%%%down sampling%%%%%%%%&#xA;&#xA;indexes=(abs(spectrum_freq) &amp;lt; 10*Freq3db);&#xA;spectrum_freq_down_sampled = spectrum_freq(indexes);&#xA;spectrum_down_sampled = spectrum_filtered(indexes);&#xA;N_down_sampled = length(spectrum_down_sampled);&#xA;&#xA;spectrum_down_sampled=spectrum_down_sampled*N_down_sampled/N;&#xA;&#xA;SampleRate_down_sampled=SampleRate*N_down_sampled/N;&#xA;&#xA;y_down_sampled=real(ifft(spectrum_down_sampled));&#xA;t_down_sampled = ( (1:N_down_sampled)*1/SampleRate_down_sampled ).';&#xA;&#xA;sound(y_down_sampled, SampleRate_down_sampled)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [spectrum_filtered,g]=freq_space_low_pass_filter(spectrum, SampleRate, Freq3db)&#xA;%% applies low pass filter in the frequency domain&#xA;% spectrum - result of fft on time series data (column vector is expected)&#xA;% SampleRate - measured in Hz, 1/dt where dt spacing of the points in time domain&#xA;% Freq3db - desired 3db roll off point in Hz&#xA;&#xA;N=length(spectrum);&#xA;&#xA;function G=filter_gain(freq, Freq3db)&#xA;    G=1./(1+1i*freq/Freq3db); % this corresponds to low pass RC filter&#xA;end&#xA;&#xA;spectrum_freq=fourier_frequencies(SampleRate, N);&#xA;&#xA;% calculate filter gain for each spectrum frequency&#xA;g=filter_gain(spectrum_freq, Freq3db);&#xA;spectrum_filtered=spectrum.*g;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Plot of the signal spectrum:&#xA;  &lt;img src=&quot;https://i.stack.imgur.com/ytWha.png&quot; alt=&quot;picture&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3398" LastEditorUserId="1273" LastEditDate="2012-12-04T09:35:42.733" LastActivityDate="2015-08-08T12:11:40.440" Title="Filter message from noisy voice signal" Tags="|matlab|noise|lowpass-filter|voice|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6183" PostTypeId="2" ParentId="6150" CreationDate="2012-12-04T09:04:33.683" Score="4" Body="&lt;p&gt;Okay I found some ideas about using Fourier Transforms in Object Recognition. What I am unable to understand is however, its downsides. Why was the method discarded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those who are interested in reading about how Fourier Transforms were applied in Object Recognition , look for Fourier Mellin Transforms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier-Mellin transform is a useful mathematical tool for image recognition because its resulting spectrum is invariant in rotation, translation and scale. The Fourier Transform itself (FT) is translation invariant and its conversion to log-polar coordinates converts the scale and rotation differences to vertical and horizontal offsets that can be measured. A second FFT, called the Mellin transform (MT) gives a transform-space image that is invariant to translation, rotation and scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps:&#xA;The Fourier Transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Discrete Fourier Transform (DFT) is given by the following expression:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/pXX8L.png&quot; alt=&quot;Discrete Fourier Transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is often computed using the Fast Fourier Transform algorithm to speed up the time needed for the calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cartesian to Log-Polar conversion&#xA;The FFT is projected onto the log-polar plane by the coordinate transform shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/II21d.png&quot; alt=&quot;Rectangular co-ordinates&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kS0rQ.png&quot; alt=&quot;Polar co-ordinates&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the conversion from Cartesian coordinates to Log-Polar coordinates the following equation is true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$r = \sqrt{x^2+y^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The origin $(m_o, n_o)$ should be at the center of the image matrix to ensure the maximum number of pixels is included. If the image consists of a square $N \times N$ matrix then the coordinates of the origin are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uSoOX.png&quot; alt=&quot;Polar Transforms 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maximum sampling radius for the conversion can now be calculated as:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/LQC3l.png&quot; alt=&quot;Polar Transforms 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an inscribed circle is chosen as the conversion boundary, some pixels that lie outside the circle will be ignored. If a circumscribed circle is chosen, all pixels will be taken in account, but some invalid pixels will also be included (pixels falling inside the circle but outside of the image matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the pixels in Cartesian coordinates cannot be mapped one-to-one onto pixels in the Log-Polar coordinate space, an average of the surrounding pixels needs to be calculated. The standard methods to do this includes nearest neighbor, bilinear and bicubic resampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relationship between the polar coordinates ($\rho$, $\theta$) used to sample the input image and the polar coordinates of the log-polar image (r , $\theta$) can be described by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(\rho,\theta)    =  (e^r, \theta) $$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To map the input image pixels imagein(xi,yi) onto the output image pixels imageout(rm, $\theta$m), the co-ordinates xi, yi are computed using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8NX5A.png&quot; alt=&quot;Transforms 5&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $$(\rho,\theta)    =  (e^r, \theta) $$    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step is to get a transform-space image that is a rotation and scale invariant representation of the original image. This is done using the Mellin transform which can be expressed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/925y1.png&quot; alt=&quot;Mellin Transform 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Converting to polar coordinates, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GafBS.png&quot; alt=&quot;Mellin Transform 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now using $$(\rho,\theta)    =  (e^r, \theta) $$    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3I5lo.png&quot; alt=&quot;Mellin Transform 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier Mellin transform has been used for Image Recognition in &lt;strong&gt;&lt;em&gt;R. Moller, H. Salguero, E. Salguero: “Image recognition using the Fourier-Mellin Transform”, LIPSE-SEPI-ESIME-IPN, Mexico&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="3803" LastEditDate="2013-06-21T02:08:56.433" LastActivityDate="2013-06-21T02:08:56.433" CommentCount="5" CommunityOwnedDate="2012-12-11T07:35:43.790" ContentLicense="CC BY-SA 3.0" />
  <row Id="6184" PostTypeId="1" AcceptedAnswerId="6334" CreationDate="2012-12-04T16:22:58.590" Score="11" ViewCount="1178" Body="&lt;p&gt;I'm totally stuck on an issue regarding the segmentation of glassy objects.&#xA;I need to get the object as precise as possible.&#xA;My approaches were different.&#xA;At first I tried to remove the background, so that only some sharp contours are left.&#xA;But that only works for objects which have sharp edges / gradients.&#xA;Otherwise the object itself is also removed.&#xA;I posted two different images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y6YO0.png&quot; alt=&quot;image 1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/bteoW.png&quot; alt=&quot;image 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to remove the background via morphological operations, like grayscale dilatation and a divison on it.&#xA;but it didnt help much.&#xA;after it, I tried a k-means with k=3 for getting the modified background separated from the gray and black values of the glass.&#xA;That wasn't successfull in some cases, but not overall/in average.&#xA;I also tried to make a canny edge detection with an overall blured filter, but that lead to weaker results in form of open contours, a lot of noise, etc. pp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Canny with automatic threshold results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;testimg = imread('https://i.stack.imgur.com/Y6YO0.png');  &#xA;imshow(testimg)&#xA;imedges = edge(testimg,'canny');&#xA;imshow(imedges);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Same goes for the second image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8rET4.png&quot; alt=&quot;canny output #1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Dt7b3.png&quot; alt=&quot;canny output #2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there is a lot of noise inside and outside and doubled edges from the glas border. Even there are gaps in the edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I need your advices for getting a general approach for dealing with this problem of half-transparent materials, not for just these two images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Other ideas for removing the background without damaging the object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Other segmentation methods for getting the object separated from the background?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's possible, then with Matlab, IPT or statistical toolbox hints. Any other hints are also welcome!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your answer in advance.&#xA;Sincerely&lt;/p&gt;&#xA;" OwnerUserId="1923" LastEditorUserId="1923" LastEditDate="2012-12-06T13:20:08.967" LastActivityDate="2012-12-27T09:37:20.333" Title="Segmentation of half transparent material, e.g. glass" Tags="|image-processing|matlab|computer-vision|image-segmentation|" AnswerCount="2" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="6186" PostTypeId="1" AcceptedAnswerId="6189" CreationDate="2012-12-04T23:05:41.917" Score="0" ViewCount="1027" Body="&lt;p&gt;I'm trying to generate a buzzer sound like &lt;a href=&quot;http://soundfxnow.com/sound-fx/wrong-answer-buzzer-1-2/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J4tau.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you look at the waveform, it's got sinusoidal notches cut into an otherwise normal looking sinewave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generate a sinewave tone, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 44100 ;&#xA;t = 0 : (1/fs) : 2 ;&#xA;f = 200 ;&#xA;y = 0.5*(sin( f*2*pi*t )) ;&#xA;sound( y, fs ) ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know how to cut the notches! How would you do it, so it sounds &quot;buzzy&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/26s6j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1040" LastEditorUserId="1040" LastEditDate="2012-12-05T02:32:12.530" LastActivityDate="2012-12-05T03:06:14.650" Title="Generate buzzer sound" Tags="|matlab|sound|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6188" PostTypeId="1" CreationDate="2012-12-05T01:06:54.627" Score="3" ViewCount="587" Body="&lt;p&gt;I'm trying to understand a piece of code that is using a camera projection matrix. The camera projection matrix $P = \left[\begin{array}{c}p_1^T \\ p_2^T \\ p_3^T\end{array}\right]$ takes a point $X$ in 3D world coordinates and projects it onto pixel coordinates $x$ of an image. It is a $3 \times 4$ matrix. The 3rd row $p_3^T$ is the optical axis of the camera (neglecting the 4th element). The 1st and 2nd rows also correspond to the x and y axes if I normalize them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the piece of code I am working with, the norm $\|p_1^T\| + \|p_2^T\|$ is calculated. Any idea what this quantity could represent? It is called a &quot;scale&quot; factor. &lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2012-12-05T01:06:54.627" Title="Projection Matrix (Computer Vision)" Tags="|computer-vision|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6189" PostTypeId="2" ParentId="6186" CreationDate="2012-12-05T03:06:14.650" Score="1" Body="&lt;p&gt;Based on the spectrum, it looks to me like this was generated by FM synthesis. The mathematics of starting with a sound and working backwards to generate it using FM synthesis can be time consuming. The best reference I know of is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0028646827&quot; rel=&quot;nofollow&quot;&gt;Computer Music&lt;/a&gt;. I've seen pdf editions of this book online that I thought were legal, but I'm only seeing illegal looking things now, so I'm not linking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some simpler approximations that might work, but almost certainly won't sound the same:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;white noise with a bandpass filter. (maybe plus a little clipped sine wave)&lt;/li&gt;&#xA;&lt;li&gt;a clipped sine wave or square wave through a low pass filter. (subtractive synthesis)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-12-05T03:06:14.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6190" PostTypeId="1" AcceptedAnswerId="6191" CreationDate="2012-12-05T13:55:09.277" Score="2" ViewCount="283" Body="&lt;p&gt;Is there a way to generate a waveform from data (any kind of data: integer, hexadecimal, string, char, binary), in a common audio player, without converting the data to an audio format?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a way to &quot;code&quot; an arbitrary file in to audio (obtain an audio-descriptor of the data).&lt;/p&gt;&#xA;" OwnerUserId="3405" LastEditorUserId="1273" LastEditDate="2012-12-06T19:42:51.557" LastActivityDate="2012-12-06T19:42:51.557" Title="Audio descriptor of data" Tags="|audio|waveform-similarity|visualization|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6191" PostTypeId="2" ParentId="6190" CreationDate="2012-12-05T16:54:36.553" Score="2" Body="&lt;p&gt;If you want a simple way to transform a numeric array in sound, I suggest you to use Python, with the &lt;code&gt;wave&lt;/code&gt; module and Numpy numeric package.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you want to analyze the spectrogram of the numbers without listening to anything, then Python's Matplotlib does what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a sample working code that generates a simple tone, saves it to a .wav file, AND displays a spectrogram:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;import wave&#xA;from matplotlib import pyplot as plt&#xA;&#xA;samplerate = 44100&#xA;&#xA;# generate simple sound&#xA;sound_data = numpy.sin(numpy.linspace(0,20000,100000))*1000&#xA;&#xA;# converts to a string representation (I suspect there might be a more natural way to do this)&#xA;raw = &quot;&quot;.join((wave.struct.pack('h', item) for item in sound_data))&#xA;&#xA;# saving to .wav file&#xA;filename = 'aaa.wav'&#xA;sound = wave.open(filename, 'wb')&#xA;sound.setparams((1, 2, samplerate, 1, 'NONE', 'noncompressed'))&#xA;sound.writeframes(raw)&#xA;sound.close()&#xA;&#xA;# plotting spectrogram&#xA;plt.specgram(sound_data)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1558" LastActivityDate="2012-12-05T16:54:36.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6192" PostTypeId="1" CreationDate="2012-12-06T02:39:18.910" Score="3" ViewCount="197" Body="&lt;p&gt;I am specifically working on a categorical time series of best n number of parallel threads (for n=1..16) for a multicore workstation. I constructed the Walsh-Fourier periodogram for size 2^10 and 2^11 data points. Both of the images are with the first value removed to allow a scaled image. The difference is dramatic as you can see. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My naive interpretation is that there is something stationary going on with the $2^{11}$ range that isn't happening in the $2^{10}$ range. In particular my data covers minute intervals and if I am looking for background programs that will effect the the best thread policy, if they are scheduled nightly (antivirus, back-up etc) then in terms of 1440 minutes=1 day they will fall within $2^{11}$ minutes because $2^{10}&amp;lt;1440&amp;lt;2^{11}$. Am I making the correct assumption here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I am too new on this particular stackexchange I am not allowed to post the periodograms but they are hosted &lt;a href=&quot;https://sites.google.com/site/aftermathzine/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3409" LastEditorUserId="3409" LastEditDate="2012-12-06T03:24:48.357" LastActivityDate="2012-12-06T03:24:48.357" Title="Interpretation of a periodogram: the effect of window sizes" Tags="|discrete-signals|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6194" PostTypeId="1" AcceptedAnswerId="6242" CreationDate="2012-12-06T13:22:41.817" Score="14" ViewCount="23842" Body="&lt;p&gt;I'm looking for a method for scale and rotation invariant Template matching. I already tried some, but they didn't work so good for my examples or took for ever to execute&#xA;.&#xA;SIFT and SURF Feature detection failed totally. I also tried to implement a Log-Polar Template Matching function, but I never finished (didn't know exactly how to).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In these Articles (the first is in german)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cvpr.uni-muenster.de/teaching/ss08/seminarSS08/downloads/Wentker-Vortrag.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://cvpr.uni-muenster.de/teaching/ss08/seminarSS08/downloads/Wentker-Vortrag.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.jprr.org/index.php/jprr/article/viewFile/355/148&quot; rel=&quot;noreferrer&quot;&gt;http://www.jprr.org/index.php/jprr/article/viewFile/355/148&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read about that method. Mapping the polar coordinates worked, but I don't know if it's right. The Images look like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.shareimages.com/images/pics/0/0/3/62394-pZSfl5WenZysnpyVnKg-source_log_polar.png&quot; rel=&quot;noreferrer&quot;&gt;source_log_polar.png http://www.shareimages.com/images/pics/0/0/3/62394-pZSfl5WenZysnpyVnKg-source_log_polar.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/38EZ7.png&quot; alt=&quot;template_log_polar.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And after matching these 2 images with OpenCV's Template Matching function i got that result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bbBhd.png&quot; alt=&quot;match_log_polar.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I don't how to go on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My templates are always simple symbols in building blueprints and the blueprints itself. The symbols can differ in size and orientation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example my simple blueprint:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tf8EV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And my template&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PlP4i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example there is only one template, but in the blueprints it should find all occurrences, even the ones with sizes and/or orientations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an approach how I could solve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An addition to Andrey's approach. The distance capturing algorithm for a radial profile. (Using EmguCV)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private float[] getRadialProfile( Image&amp;lt;Gray, byte&amp;gt; image, Point center, int resolution )&#xA; {&#xA;&#xA; var roi = image.ROI;&#xA;&#xA; if ( !roi.Contains( center ) )&#xA;  {&#xA;   return null;&#xA;  }&#xA;&#xA; var steps = resolution;&#xA; var degreeSteps = 360 / (double)resolution;&#xA; var data = image.Data;&#xA; var peak = 0.0f;&#xA; var bottom = double.MaxValue;&#xA; var bottomIndex = 0;&#xA; var width = roi.Width;&#xA; var height = roi.Height;&#xA; var minX = roi.X;&#xA; var minY = roi.Y;&#xA;&#xA; float[] distances = new float[resolution];&#xA; for ( var i = 0; i &amp;lt; steps; i++ )&#xA;  {&#xA;   var degree = i * degreeSteps;&#xA;   var radial = degree * Math.PI / 180.0;&#xA;   var dy = Math.Sin( radial );&#xA;   var dx = Math.Cos( radial );&#xA;&#xA;   var x = (double)center.X;&#xA;   var y = (double)center.Y;&#xA;&#xA;   while ( true )&#xA;    {&#xA;    x += dx;&#xA;    y += dy;&#xA;    if ( x &amp;gt;= minX + width || y &amp;gt;= minY + height || x &amp;lt;= minX || y &amp;lt;= minY )&#xA;     {&#xA;      x = -1;&#xA;      y = -1;&#xA;      break;&#xA;     }&#xA;    var pixel = data[(int)y, (int)x, 0];&#xA;    if ( pixel == 0 )&#xA;     {&#xA;      break;&#xA;     }&#xA;    }&#xA;&#xA;    float distance = 0.0f;&#xA;    if ( x != -1 &amp;amp;&amp;amp; y != -1 )&#xA;    {&#xA;      distance = (float)Math.Sqrt( Math.Pow( (center.X - x), 2 ) + Math.Pow( (center.Y - y), 2 ) );&#xA;    }&#xA;&#xA;    distances[i] = distance;&#xA;    if ( distance &amp;gt; peak )&#xA;    {&#xA;      peak = distance;&#xA;    }&#xA;    if ( distance &amp;lt; bottom )&#xA;    {&#xA;      bottom = distance;&#xA;      bottomIndex = i;&#xA;    }&#xA;   }&#xA;&#xA;    // Scale invariance. Divide by peak&#xA;   for ( var i = 0; i &amp;lt; distances.Length; i++ )&#xA;   {&#xA;     distances[i] /= peak;&#xA;   }&#xA;&#xA;    // rotation invariance, shift to lowest value&#xA;   for ( var i = 0; i &amp;lt; bottomIndex; i++ )&#xA;   {&#xA;     distances.ShiftLeft(); // Just rotates the array nothing special&#xA;   }&#xA;&#xA;   return distances;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3412" LastEditorUserId="26573" LastEditDate="2019-01-02T19:39:38.720" LastActivityDate="2019-01-02T19:39:38.720" Title="Scale and Rotation invariant Template Matching" Tags="|computer-vision|opencv|template-matching|" AnswerCount="4" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="6196" PostTypeId="2" ParentId="6190" CreationDate="2012-12-06T19:39:11.247" Score="2" Body="&lt;p&gt;Many audio players can be tricked into playing an array of raw PCM samples (16-bit signed linear little-endian) simply by pre-pending a 44-byte WAV/RIFF file header copied from another (larger?) .wav file of the same type (sample rate, mono/stereo, etc.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-12-06T19:39:11.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6197" PostTypeId="1" CreationDate="2012-12-07T03:29:30.427" Score="0" ViewCount="254" Body="&lt;pre&gt;&lt;code&gt;b = [0.9355,-3.6135,5.3603,-3.6135,0.9355]&#xA;a = [1,-3.7339,5.3562,-3.4929,0.8752]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use MATLAB to quantize the coefficients in the vectors a and b to 16 bits of precision. First, take each vector and divide by the smallest power of two such that, after division, the magnitude of the largest filter coefficient is no larger than 1. Next, multiply the resulting vectors by 2&lt;sup&gt;15&lt;/sup&gt;, and round to the nearest integer. (You can use the round function.) Divide the resulting vectors by 2&lt;sup&gt;15&lt;/sup&gt;. The resulting values should be no less than -1 and no larger than 1. Finally, multiply these values by the power of two by which you originally divided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand what that smallest power of two is! Can someone help me out with the code?&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3417" LastEditorUserId="1996" LastEditDate="2012-12-07T13:56:47.700" LastActivityDate="2012-12-07T13:56:47.700" Title="Matlab : Exploring the effects of co-efficient quantization" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6198" PostTypeId="2" ParentId="3557" CreationDate="2012-12-07T04:03:41.200" Score="2" Body="&lt;p&gt;For planar elements (implied by the wording &quot;structuring element&quot;) the containment of origin is enough to maintain the properties of anti-extensivity for erosion, and extensivity for dilation as can be found in many texts and you also pointed that out. So, yes, this is enough for the non-negativity for the arithmetic difference (this is directly shown by contradiction). The reason this piece of text is present in Pierre's book might be a simple one: a mistake. This statement is supported by other papers (like &quot;Morphological Gradients&quot; by Rivest, Soille, Beucher; or &quot;An Overview of Morphological Filtering&quot; by Serra, Vincent) on the morphological gradient defined by Beucher on his thesis. Now, I expect the most common situation to be the application of a gradient in an isotropic way, implying a symmetrical structuring element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to the second part of the question (supposing isotropy is not enough to conclude the answer). The first reason I can give for using symmetrical elements is to eliminate the burden of dealing with the multiple definitions for erosion and dilation present in the literature. It turns out that when you consider symmetrical elements, the distinct definitions become the same, guaranteeing the same behavior among different implementations. Using anisotropic elements will also translate your objects, which might be only useful for some certain applications. Also, some structuring elements are trivially decomposed when they are symmetric, enabling faster applications of morphological operations.&lt;/p&gt;&#xA;" OwnerUserId="3363" LastActivityDate="2012-12-07T04:03:41.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6200" PostTypeId="1" AcceptedAnswerId="6204" CreationDate="2012-12-07T13:05:43.970" Score="4" ViewCount="1337" Body="&lt;p&gt;I have a bunch of audio files all sampled at 44100 Hz sample frequency. I am trying to remove all the frequencies which are outside the human hearing range (I use the following as reference: &lt;a href=&quot;http://hypertextbook.com/facts/2003/ChrisDAmbrose.shtml&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Frequency Range of Human Hearing&quot;&gt;Frequency Range of Human Hearing&lt;/a&gt;, as well as &lt;strong&gt;robert.b&lt;/strong&gt;'s answer for determining the frequency value of a given bin: &lt;a href=&quot;https://stackoverflow.com/a/7242419/340750&quot; title=&quot;How to get Frequency from FFT result&quot;&gt;How to get Frequency from FFT result&lt;/a&gt;), and my basic approach is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Perform an FFT on the files&lt;/li&gt;&#xA;&lt;li&gt;Convert all frequency bin indices to actual frequencies&lt;/li&gt;&#xA;&lt;li&gt;Remove those which are outside the range (i.e. below 20 and above 20,000 Hz)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Would that be a valid approach, and would it be possible to &quot;put back&quot; my signals to a state (using the inverse FFT) where I can play them and check if they still sound &quot;normal&quot;?&lt;/p&gt;&#xA;" OwnerUserId="3419" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2016-05-18T08:11:57.617" Title="Chop out frequencies outside human hearing range" Tags="|fft|fourier-transform|frequency|frequency-domain|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6201" PostTypeId="2" ParentId="6197" CreationDate="2012-12-07T13:48:03.377" Score="1" Body="&lt;p&gt;For each of the vectors &quot;a&quot; and &quot;b&quot;, you need to find the element with the largest absolute magnitude. (I'm not sure of the specific Matlab code for this; probably something like &lt;code&gt;max (abs (a))&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you need to pick the smallest number of the form 2&lt;sup&gt;N&lt;/sup&gt; (N is an integer) that is larger than the value determined in the previous step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, the rest of the instructions should be straightforward.&lt;/p&gt;&#xA;" OwnerUserId="1996" LastActivityDate="2012-12-07T13:48:03.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6202" PostTypeId="2" ParentId="6200" CreationDate="2012-12-07T14:05:40.913" Score="5" Body="&lt;p&gt;FFT -&gt; zeroing coefficients -&gt; IFFT is not a good approach for implementing filters. This will lead to a filter with poor performances and/or complicated implementation and/or inefficient implementation. This has been frequently discussed on this site, for example in &lt;a href=&quot;https://dsp.stackexchange.com/questions/2984/filtering-of-streaming-audio&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look into digital filters instead.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-12-07T14:05:40.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6203" PostTypeId="2" ParentId="6200" CreationDate="2012-12-07T14:06:47.260" Score="2" Body="&lt;p&gt;Yes, it is possible to filter out the frequencies that you don't want using FFT's and inverse FFT's as you describe.  However, I do not recommend that you do it that way for a couple of reasons.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It's tempting to just zero out the frequencies that you don't want.  The problem with that is that it introduces strange artifacts when you transform your data back to the time domain.  There is a way to avoid introducing those artifacts, but it is more complicated than just straightforward time-domain filtering.&lt;/li&gt;&#xA;&lt;li&gt;Unless you FFT the entire sound clip at once, you will have to use either the &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;nofollow&quot;&gt;overlap-save&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;overlap-add&lt;/a&gt; method to avoid distortions at the points where you break the data up into frames.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Long story short, unless you really care about filtering speed, just do it in the time-domain.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-12-07T14:06:47.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6204" PostTypeId="2" ParentId="6200" CreationDate="2012-12-07T14:17:46.317" Score="4" Body="&lt;p&gt;What frequencies would you like to remove? 44.1kHz is specifically designed to capture audio files with good fidelity but also with not a lot of extra data. On the upper end, human hearing goes up to about 20 kHz. The Nyquist frequency is 22.05 kHz. The extra 2 kHz are needed to allow for anti aliasing filters that have finite steepness and not an extraneous amount of time domain ringing or group delay. At the low end, it can be beneficial to filter anything below 25 Hz or so specifically if it's badly recorded. Again, care need to be taken to control time domain distortions since the poles of a 25Hz high-pass at 44.1kHz are very, very close to the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zeroing in the FFT domain is generally a bad idea: If it's done wrong, it leads to time-domain  aliasing which sounds terrible. If it's done correctly (by properly choosing window size, shape, step size, and overlap) it is still just equivalent to time domain filtering with a fairly bad FIR filter. &lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2012-12-07T15:22:19.207" LastActivityDate="2012-12-07T15:22:19.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6205" PostTypeId="1" CreationDate="2012-12-07T18:58:33.607" Score="1" ViewCount="137" Body="&lt;p&gt;I am very confused about how to get the transmit sequence of the DPSK signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my lecture notes, teacher give as the following example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Assume the following rule is apply&#xA;&#xA;&quot;no change&quot; of sign for information 1&#xA;&quot;change&quot; of sign for information 0&#xA;&#xA;if the data sequence is &quot;0000 1010 1110 0011&quot;&#xA;then the transmitted sequence is &quot;+ -+-+ +--+ +++- +---&quot;&#xA;&#xA;if the data sequence is &quot;1101 0000 0111&quot;&#xA;then the transmitted sequence is &quot;- --++ -+-+ ----&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I cannot understand why the data sequence is 0000 and the transmit sequence is &lt;code&gt;-+-+&lt;/code&gt; instead of &lt;code&gt;++++&lt;/code&gt;? and When should I use &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt; in the transmitted sequence?&lt;/p&gt;&#xA;" OwnerUserId="3420" LastEditorUserId="1273" LastEditDate="2012-12-08T14:18:47.447" LastActivityDate="2012-12-08T14:18:47.447" Title="The transmitted signal of DPSK" Tags="|homework|modulation|bandpass|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6206" PostTypeId="1" AcceptedAnswerId="6234" CreationDate="2012-12-07T20:56:53.853" Score="10" ViewCount="78216" Body="&lt;p&gt;One Question of my note is like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Consider a communication channel with a bandwidth of 2400Hz. If QPSK technique is&#xA;used, what is the possible transmission rate? (Assume that rectangular&#xA;pulses are used in the baseband signals, and that 90% energy preservation is&#xA;required.)&#xA;&#xA;For a baseband system, a bipolar signal of bandwidth B can support a rate of B&#xA;with 90% energy preservation (since bandwidth =1/τ in this case).&#xA;For a bandpass system, a BPSK signal of bandwidth of B can support a rate of B/2.&#xA;This is because, after modulation, the bandwidth is 2/τ.&#xA;For QPSK, rate can be doubled using the same bandwidth. Therefore the&#xA;supported rate is 2400bps.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why the BPSK signal of bandwidth 2/τ can support a datarate of B/2? and what is the relationship between the bandwidth and the datarate? and why in the QPSK, the rate can be doubled using the same bandwidth?&lt;/p&gt;&#xA;" OwnerUserId="3420" LastEditorUserId="17876" LastEditDate="2016-01-08T16:27:52.577" LastActivityDate="2020-10-11T19:13:51.960" Title="the relationship between bandwidth and the datarate" Tags="|modulation|qpsk|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6207" PostTypeId="2" ParentId="6206" CreationDate="2012-12-07T22:57:01.377" Score="0" Body="&lt;p&gt;QPSK sends two bits per baud, where a baud is defined as one change in state of the signal. The tradeoff is that QPSK requires a better SNR, because it is more difficult to discriminate among 4 states per baud than 2.&lt;/p&gt;&#xA;" OwnerUserId="1996" LastActivityDate="2012-12-07T22:57:01.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6209" PostTypeId="2" ParentId="6194" CreationDate="2012-12-08T04:25:05.580" Score="3" Body="&lt;p&gt;Here's the basic idea of what I know can be done, based on a talk by Professor Anurag Mittal of IIT Madras.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is of shape based object detection, but can obviously be extended elsewhere as well. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute edgels using Berkeley edge detector.&lt;/li&gt;&#xA;&lt;li&gt;Connect edges obtained. &quot;Global Object Boundary Detection&quot;.&lt;/li&gt;&#xA;&lt;li&gt;Shape matching using Chamfer distance or Houstoff Distance.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;His paper on the same is available at: &lt;a href=&quot;http://www.cse.iitm.ac.in/~amittal/or_eccv2008.pdf&quot; rel=&quot;nofollow&quot;&gt;Multi-Stage Contour based Detection of Deformable Objects.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand I think SIFT should work as corner detection algorithms would work on the template feature that you have over there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: SIFT isn't completely rotation invariant. It is not able to cope with rotations &gt; 60 degrees or so. So forming multiple templates is a good idea. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As on log-polar based Fourier-Mellin Transfroms: They cause loss of information due to how sampling takes place for the transforms.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2012-12-08T04:25:05.580" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6211" PostTypeId="1" CreationDate="2012-12-08T15:43:04.300" Score="0" ViewCount="42" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/6199/convolution-and-dtft&quot;&gt;Convolution and DTFT&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;$x_1(n)=x_2(n)=1$&lt;br&gt;&#xA;where $0 ≤ n ≤ N-1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)The linear convolution of the signal gives a triangle how you write it in mathematical form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DTFT of the signal is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X_1(e^{jw})=X_2(e^{jw})=\pi \sum_{k=-\infty}^\infty \delta(w-2\pi k)+$$ \frac1 {1-e^{jw}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to calculate the $ DTFT^-(X_1(e^{jw}).X_2(e^{jw})?$&lt;/p&gt;&#xA;" OwnerUserId="3413" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-12-08T15:43:04.300" Title="Covolution of DTFT" Tags="|fourier-transform|convolution|" AnswerCount="0" CommentCount="2" ClosedDate="2012-12-08T16:20:55.190" ContentLicense="CC BY-SA 3.0" />
  <row Id="6212" PostTypeId="1" AcceptedAnswerId="6275" CreationDate="2012-12-08T17:57:53.857" Score="2" ViewCount="1078" Body="&lt;p&gt;Suppose PSD of a signal $x(n)$ is $ PSD_{xx}(\omega)=1$. Now if a window function $w(n)$ of length $ 0\le n \le N-1$ is applied to $x(n)$, what will the new PSD be?&lt;/p&gt;&#xA;" OwnerUserId="3413" LastEditorUserId="1629" LastEditDate="2016-12-14T06:39:18.463" LastActivityDate="2016-12-14T06:39:18.463" Title="PSD of a windowed signal" Tags="|window-functions|power-spectral-density|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6213" PostTypeId="1" CreationDate="2012-12-08T18:13:59.990" Score="7" ViewCount="450" Body="&lt;p&gt;I am building a whiteboard to track the position of its pen. I have &lt;code&gt;n&lt;/code&gt; ultrasound receivers placed on the periphery of the whiteboard, and an ultrasound emitter in the pen. The pen emits pulses the receivers detect. A microprocessor gathers the arrival times of the pulses for each receiver, and with the time differences of arrival (TDOA) it makes an estimate of the position of the pen following a &lt;a href=&quot;http://en.wikipedia.org/wiki/Multilateration&quot; rel=&quot;nofollow&quot;&gt;multilateration&lt;/a&gt; algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultrasounds reflect on surfaces, which can cause interference. This is a restriction on the frequency of the pulses. At the moment, I pulse the pen at 10Hz, which is enough for the reflections to die off and not interfere. Unfortunately, 10Hz is not fast enough a sampling for my purposes. Ideally the pen would pulse at 100Hz. (The pen emitter is connected to a microcontroller, so I can control the shape and frequency of the pulse.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What tricks can I use to tackle the reflection issue? What are some standard filtering techniques? Could using different pulse patterns in a cycle help filter out the reflections?&lt;/p&gt;&#xA;" OwnerUserId="3424" LastEditorUserId="3424" LastEditDate="2012-12-09T17:20:57.153" LastActivityDate="2013-04-10T20:03:49.180" Title="Ultrasound pulses and reflection problems" Tags="|filters|frequency-spectrum|frequency|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6214" PostTypeId="1" AcceptedAnswerId="6216" CreationDate="2012-12-08T18:14:01.120" Score="1" ViewCount="150" Body="&lt;p&gt;This is a question I found on internet under DSP section so that's why I am posting it here. Help me understand it please. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A computer adds 1000 random numbers that have each been rounded off to the nearest 10$^{\rm th}$. Find the probability that the total round-off error for the sum is $\ge 1$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How probability of any system can be greater than 1?&lt;/p&gt;&#xA;" OwnerUserId="3413" LastEditorUserId="1629" LastEditDate="2016-05-18T11:04:06.937" LastActivityDate="2016-05-18T11:04:06.937" Title="Probability of random numbers" Tags="|random|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6216" PostTypeId="2" ParentId="6214" CreationDate="2012-12-08T21:24:44.493" Score="3" Body="&lt;p&gt;The total roundoff error for the sum of $N$ numbers is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;S = \sum_{i=0}^{N-1} E_i&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The roundoff error for the $i$-th number is represented by the random variable $E_i$. If we assume that the random number generator used by the computer yields numbers $X_i$ taken from a uniform distribution, then the difference between each $X_i$ and the nearest tenth (which is the roundoff error $E_i$) is uniformly distributed on the interval $(-\frac{0.1}{2}, \frac{0.1}{2}) = (-0.05, 0.05)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we're concerned with, though, is the distribution of $S$. Since $S$ is the sum of $N$ &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables&quot; rel=&quot;nofollow&quot;&gt;independent, identically distributed (iid)&lt;/a&gt; random variables, then via the &lt;a href=&quot;http://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow&quot;&gt;central limit theorem&lt;/a&gt;, as $N \to \infty$, $S$ will tend to a Gaussian distribution. If we assume that your case of $N=1000$ is &quot;large enough&quot; for the Gaussian assumption to hold, we can easily estimate the probability that you seek. It's certainly possible to exactly calculate the distribution of $S$, but the Gaussian assumption is likely close enough for most applications with such large $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Gaussian distribution is characterized by its first two moments, so if we can find those for $S$, then we have all the information we need. These are easy to calculate for a sum of iid random variables. The mean of $S$ is equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbb{E}(S) = \sum_{i=0}^{N-1} \mathbb{E}(E_i) = 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variance of $S$ is equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbb{E}\left((S - \mathbb{E}(S))^2\right) = \sum_{i=0}^{N-1} \mathbb{E}\left((E_i - \mathbb{E}(E_i))^2\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that the random variables $E_i$ are distributed uniformly. &lt;a href=&quot;http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29&quot; rel=&quot;nofollow&quot;&gt;It is well known&lt;/a&gt; that the uniform distribution over the interval $(a,b)$ has variance $\frac{1}{12}(b-a)^2$. For this case, that yields a variance $\sigma_{E_i}^2 = \frac{0.01}{12}$. Therefore, the variance of the total roundoff error $S$ is $\sigma_{S}^2 = \frac{0.01N}{12}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in summary, we can approximate $S$'s distribution as Gaussian with mean zero and variance $\sigma_{S}^2 = \frac{0.01N}{12}$. Based on those parameters, you can easily calculate the estimated probability distribution function (pdf), then integrate that result to arrive at whatever probability you seek. The probability that there is a total roundoff error with magnitude greater than one would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;P(|S| &amp;gt; 1) &amp;amp;= P(S&amp;gt;1 \lor S &amp;lt; -1) \\&#xA;&amp;amp;= 1 - P(-1 &amp;lt; S &amp;lt; 1) \\&#xA;&amp;amp;= 1 - \int_{-1}^{1}f_S(s)ds &#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_S(s)$ is the Gaussian distribution's pdf that we arrived at before.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-12-08T21:24:44.493" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6218" PostTypeId="2" ParentId="6213" CreationDate="2012-12-09T01:08:39.927" Score="1" Body="&lt;p&gt;It would appear that your problem lends itself very nicely to using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Code_division_multiple_access&quot; rel=&quot;nofollow noreferrer&quot;&gt;CDMA&lt;/a&gt; scheme. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let starts with some properties of (DSSS) CDMA. (Direct Sequence Spread Spectrum, Code-Division Multiple Access). Its a mouthful, but it is really easy to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In CDMA, your pulse (at baseband) is actually made up of many concatenated '&lt;a href=&quot;http://en.wikipedia.org/wiki/Chip_%28CDMA%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;chips&lt;/a&gt;' as they are called. The chips are just 1s or -1s, of a fixed duration. For example, your chipping sequence might be [1 -1 1 -1 -1 -1 1]. You would use this chipping sequence to modulate your carrier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you cannot just make up your chipping code. What you want to do is use chipping codes that have the very nice property, that their autocorrelation function is a delta function like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/11EJN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Equivalently, their power spectral density is white). For example, you can look into using &lt;a href=&quot;http://en.wikipedia.org/wiki/Barker_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Barker Sequences&lt;/a&gt; as your chipping code, (usually used in radar), or you can also look at using &lt;a href=&quot;http://en.wikipedia.org/wiki/Gold_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gold Codes&lt;/a&gt;. Practically speaking however, this means that you get the maximum correlation score in your receiver, ONLY when the receivers' code, &lt;em&gt;exactly&lt;/em&gt; lines up with the transmitted code, and &lt;em&gt;zero&lt;/em&gt; otherwise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this help you? In your receiver, you would be running a correlator continuously. The correlator would be performing a running dot-product of its own local code, with whatever is received. Now imagine that you receive a transmitted waveform from your pen, and a second waveform from a reflection. As your receivers' correlator runs, it will give a peak when its own codeword exactly alligns with your code from the pen. This will cause your detector to 'lock' onto that specific delay value. Now, here is where you reap the benefits of a near-delta autocorrelation function of your code: The reflected signal will &lt;em&gt;also&lt;/em&gt; be present, and will &lt;em&gt;also&lt;/em&gt; have its dot product taken with the receivers' locked code, but it will give zero, or near zero score, since it is &lt;em&gt;orthoginal&lt;/em&gt; or &lt;em&gt;near-orthogonal&lt;/em&gt; to the delayed code that your receiver has already locked onto. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, if you had send out a un-coded carrier pulse, you would be at the mercy of constructive or destructive interference throwing off when exactly your pulse peaked at the detector level of your receiver, and thus get erroneous TDOAs. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2012-12-09T01:19:54.557" LastActivityDate="2012-12-09T01:19:54.557" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="6219" PostTypeId="1" CreationDate="2012-12-09T05:17:38.137" Score="1" ViewCount="1702" Body="&lt;p&gt;I am creating an application that works like the Shazam service. In short, my goal is to create an audio pattern matching service. However, I would like to use DWT and not the short time Fourier transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am faced with some problems interpreting the results of the DWT. In particular I have the following questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to plot the results of dwt like a spectrogram?&lt;/li&gt;&#xA;&lt;li&gt;How to determine what frequency prevails in a given time?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3291" LastEditorUserId="1273" LastEditDate="2012-12-09T15:14:21.657" LastActivityDate="2012-12-09T15:14:21.657" Title="Using Discrete Wavelet Transform in the time-frequency domain" Tags="|wavelet|fingerprint-recognition|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6220" PostTypeId="1" AcceptedAnswerId="6224" CreationDate="2012-12-09T05:21:02.790" Score="117" ViewCount="52877" Body="&lt;p&gt;It's very easy to filter a signal by performing an FFT on it, zeroing out some of the bins, and then performing an IFFT.  For instance:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0, 1, 256, endpoint=False)&#xA;x = sin(2 * pi * 3 * t) + cos(2 * pi * 100 * t)&#xA;X = fft(x)&#xA;X[64:192] = 0&#xA;y = ifft(X)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The high frequency component is completely removed by this &quot;brickwall&quot; FFT filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I've heard this is not a good method to use.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why is it generally a bad idea?  &lt;/li&gt;&#xA;&lt;li&gt;Are there circumstances in which it's an ok or good choice?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;[&lt;a href=&quot;https://dsp.stackexchange.com/questions/6200/chop-out-frequencies-outside-human-hearing-range#comment10637_6202&quot;&gt;as suggested by pichenettes&lt;/a&gt;]&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="8202" LastEditDate="2022-08-23T17:01:34.913" LastActivityDate="2022-08-23T17:01:34.913" Title="Why is it a bad idea to filter by zeroing out FFT bins?" Tags="|matlab|fft|filters|dft|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6221" PostTypeId="1" AcceptedAnswerId="6241" CreationDate="2012-12-09T06:53:58.847" Score="1" ViewCount="2595" Body="&lt;p&gt;If I pass a signal with DC component through a Low Pass Filter will the output be without the DC component?&lt;/p&gt;&#xA;" OwnerUserId="3422" LastActivityDate="2013-08-03T20:59:31.477" Title="Is a DC signal 0 frequency or extremely high?" Tags="|frequency|lowpass-filter|" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6222" PostTypeId="2" ParentId="6219" CreationDate="2012-12-09T09:42:59.077" Score="2" Body="&lt;p&gt;Generally below intensity of the color will tell you about importance of a frequency. Some programming languages have this functionality built in. Let's take for example &lt;a href=&quot;http://www.wolfram.com/mathematica/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Mathematica&lt;/strong&gt;&lt;/a&gt; (has free trial).  Let's import some sample recording:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;voice = ExampleData[{&quot;Sound&quot;, &quot;Apollo11ReturnSafely&quot;}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xi2nR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is built in &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/Spectrogram.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Spectrogram&lt;/strong&gt;&lt;/a&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = voice[[1, 1, 1]]; r = voice[[1, 2]];&#xA;Spectrogram[s, SampleRate -&amp;gt; r]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wg0Lc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with time on horizontal and frequencies on vertical axes. For wavelets though it is more natural to use Scalogram. Here is built-in function &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/WaveletScalogram.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;WaveletScalogram&lt;/strong&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cwt = ContinuousWaveletTransform[voice, GaborWavelet[6]];&#xA;WaveletScalogram[cwt, ColorFunction -&amp;gt; &quot;AvocadoColors&quot;, ColorFunctionScaling -&amp;gt; False]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/njvWJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scalogram can provide useful info. For example it is great for visualizing voice versus noise feature. Voice is more rich and irregular in structure, noise is more monotonic and repetitive. Horizontal axis is time. Vertical axis is octaves. Higher frequencies are resolved at lower octaves and lower frequencies at higher octaves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For DWT you will have a similar plot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cwt = DiscreteWaveletTransform[voice];&#xA;WaveletScalogram[cwt, ColorFunction -&amp;gt; &quot;AvocadoColors&quot;, ColorFunctionScaling -&amp;gt; False]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VhZ4c.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1878" LastEditorUserId="1878" LastEditDate="2012-12-09T09:58:15.017" LastActivityDate="2012-12-09T09:58:15.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6223" PostTypeId="1" CreationDate="2012-12-09T15:19:21.160" Score="4" ViewCount="1815" Body="&lt;p&gt;I am implementing reconstruction of image from gradient domain. This requires solving the following partial differential equation (a Poisson equation) on a 2D grid:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\nabla^{2}I=\mathbb{div} G$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbb{div} G$ is divergence of a gradient field, which is simply an image with Laplacian operator applied (second-order derivative):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zcPNK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original image have range of values 0 to 255 (8-bit image). The divergence image has values ranging from -341 to +318, which is expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I solve the above equation for $I$, the result have very small scale. The values of reconstructed image range from -0.000038 to +0.000029.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the gradient domain stores information up to a constant. In this case however, the scale has been changed considerably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I stretch the reconstructed image to 0-255 interval, the correct result is obtained:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rsDqM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Poisson solver based on the Full Multigrid Method (FMG) which works spectacularly in different application (HDR images). Here the values are stretched anyway so I never noticed the huge change of scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this scale change normal for gradient domain reconstruction or may there be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Some glitch in the numerical solution.&lt;/li&gt;&#xA;&lt;li&gt;The $\mathbb{div} G$ image is padded with zeros so its size conforms with the solver - could this affect the scale?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2013-09-22T14:18:15.520" LastActivityDate="2014-01-14T20:22:55.383" Title="Gradient Domain Reconstruction - Scaling Problem" Tags="|image-processing|transform|reconstruction|gradient-domain|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6224" PostTypeId="2" ParentId="6220" CreationDate="2012-12-09T15:54:35.773" Score="138" Body="&lt;p&gt;Zeroing bins in the frequency domain is the same as multiplying by a rectangular window in the frequency domain.  Multiplying by a window in the frequency domain is the same as circular convolution by the transform of that window in the time domain.  The transform of a rectangular window is the Sinc function (&lt;span class=&quot;math-container&quot;&gt;$\sin(\omega t)/\omega t$&lt;/span&gt;).  Note that the Sinc function has lots of large ripples and ripples that extend the full width of time domain aperture.  If a time-domain filter that can output all those ripples (ringing) is a &amp;quot;bad idea&amp;quot;, then so is zeroing bins.&lt;/p&gt;&#xA;&lt;p&gt;These ripples will be largest for any spectral content that is &amp;quot;between bins&amp;quot; or non-integer-periodic in the FFT aperture width.  So if your original FFT input data is a window on any data that is somewhat non-periodic in that window (e.g. most non-synchronously sampled &amp;quot;real world&amp;quot; signals), then those particular artifacts will be produced by zero-ing bins.&lt;/p&gt;&#xA;&lt;p&gt;Another way to look at it is that each FFT result bin represents a certain frequency of sine wave in the time domain.  Thus zeroing a bin will produce the same result as subtracting that sine wave, or, equivalently, adding a sine wave of an exact FFT bin center frequency but with the opposite phase.  Note that if the frequency of some content in the time domain is not purely integer periodic in the FFT width, then trying to cancel a non-integer periodic signal by adding the inverse of an exactly integer periodic sine wave will produce, not silence, but something that looks more like a &amp;quot;beat&amp;quot; note (AM modulated sine wave of a different frequency).  Again, probably not what is wanted.&lt;/p&gt;&#xA;&lt;p&gt;Conversely, if your original time domain signal is just a few pure unmodulated sinusoids that are all exactly integer periodic in the FFT aperture width, then zero-ing FFT bins will remove the designated ones without artifacts.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2021-12-20T23:42:17.677" LastActivityDate="2021-12-20T23:42:17.677" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="6226" PostTypeId="1" AcceptedAnswerId="6231" CreationDate="2012-12-09T19:11:23.153" Score="6" ViewCount="8739" Body="&lt;p&gt;I need to simulate the sampling of a continuous (fsCtu = 128000Hz), acoustic signal with two microphones that have a slight offset in sampling rate (fsMic1 = 16000, fsMic2 = 16000.1) in Matlab. What is the best way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things I tried:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Matlab &quot;resample&quot; command only works for resampling to 16000, not to 16000.1&lt;/li&gt;&#xA;&lt;li&gt;&quot;interp1&quot; doesn't seem to be an option because I think I need to use bandlimited interpolation for a correct simulation. (Is this assumption correct?)&lt;/li&gt;&#xA;&lt;li&gt;I tried to write my signal to a wav file and resample it via a system call using &lt;a href=&quot;https://ccrma.stanford.edu/~jos/resample/Free_Resampling_Software.html&quot; rel=&quot;nofollow&quot;&gt;this software&lt;/a&gt;, then load the processed file with wavread. I'm not sure if this is a good solution. A quick test revealed that this method doesn't give the same result as the &quot;resample&quot; command for resampling to 16000Hz, which I find strange.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any ideas or suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3428" LastEditorUserId="128" LastEditDate="2018-08-22T16:24:31.150" LastActivityDate="2018-08-22T16:24:31.150" Title="How Can I Resample a Signal with an Arbitrary Factor (For Example - 128000Hz to 16000.1Hz) in MATLAB?" Tags="|matlab|audio|interpolation|downsampling|resampling|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6228" PostTypeId="2" ParentId="6226" CreationDate="2012-12-09T21:41:40.740" Score="0" Body="&lt;p&gt;One possibility would be interpolation using a windowed-Sinc interpolation kernel.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-12-09T21:41:40.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6229" PostTypeId="2" ParentId="6226" CreationDate="2012-12-09T22:06:52.077" Score="-2" Body="&lt;p&gt;The correct way to do this in Matlab is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;128000 -&gt; 16000 ==&gt; resample(x,1,8)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;128000 -&gt; 16001 ==&gt; resample(x,16001,128000) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, I don't know what limitations Matlab places on P &amp;amp; Q. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;John&lt;/p&gt;&#xA;" OwnerUserId="3387" LastActivityDate="2012-12-09T22:06:52.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6230" PostTypeId="1" CreationDate="2012-12-10T01:18:10.743" Score="5" ViewCount="2173" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/q/6220/29&quot;&gt;Endolith's recent question on zeroing FFT bins&lt;/a&gt; got me thinking about a possible error in my workflow and I'd like to double check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a signal $x_i[m],\ m\in\{1,\ldots,M\}$, i.e. $M$ samples sampled at $f_s$ and the subscript denotes the $i^{th}$ such signal segment. I then filter this with a bandpass filter to between $0.1 f_s$ and $0.3f_s$ (at this stage, I was careful to not do a zero-the-bins kind of filtering) and Fourier transform it with an $N&amp;gt;2M$ long FFT. Let $X_i[k],\ k\in\{0,\ldots,N-1\}$ denote the Fourier coefficients and the filtered portion (including the roll-off frequencies on both ends) be the indices $0&amp;lt; k_l,...,k_u&amp;lt; N-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My application now involves applying some function, $g$ to the Fourier coefficients $X_i[k_l],\ldots,X_i[k_u]$, averaging across the different segments ($i$) and inverse Fourier transforming the resulting vector. In math, I compute&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_{avg}[k]=\left\langle g(X_i[k])\right\rangle_i,\ k\in\{k_l,\ldots,k_u\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\langle\cdot\rangle_i$ denotes averaging over the different segments. So far, so good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I didn't know what to do with the remaining Fourier coefficients $X_i[k'],\ k'\in\{0,\ldots,N-1\}\backslash \{k_l,\ldots,k_u\}$ before taking the IFFT. These coefficients are theoretically insignificant, since I've already filtered out content in them. So I went ahead and set $X_{avg}[k']=0$ and then computed the IFFT of $X_{avg}$. The results were along the lines of what I expected, but I didn't think of the aforementioned filtering issue, although I was aware of it (this is the same situation, with a bit of twists at places).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question then is: Is it still a problem in this case i.e., when the bins that I &quot;zeroed out&quot; were technically low/insignificant? If so, how should I have handled it?&lt;/p&gt;&#xA;" OwnerUserId="3432" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-07-27T16:05:26.403" Title="Zeroing bins before IFFT" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6231" PostTypeId="2" ParentId="6226" CreationDate="2012-12-10T01:40:57.390" Score="4" Body="&lt;p&gt;There are a couple of ways that you can do it.  The first is with resample, but it is a multi-step process.  First, you have to figure out which interpolation and decimation factors will get you the sample rate you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[n, k] = rat(16000.1 / 128000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gets you an interpolation factor of 20000 and a decimation factor of 159999.  You factor those to break them up into smaller chunks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nFactors = factor(n)&#xA;kFactors = factor(k)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It turns out that n factors to $2^5 * 5^4$ and k factors to $3 * 7 * 19 * 401$.  All of those are doable, though the decimation by 401 will not have great filtering properties.  Anyway, if you resample in stages you can get the final sample rate you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other way to do it is &lt;a href=&quot;http://en.wikipedia.org/wiki/Polynomial_interpolation&quot; rel=&quot;nofollow&quot;&gt;polynomial interpolation&lt;/a&gt;.  Essentially you model your signal as a polynomial through curve fitting techniques, and then you can simply feed in the time values that you want and out will pop the signal values.  This technique can be very effective, but modelling the signal well is a bit of an art.  In particular you don't want to &lt;a href=&quot;http://en.wikipedia.org/wiki/Overfitting&quot; rel=&quot;nofollow&quot;&gt;overfit&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-12-10T01:40:57.390" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6234" PostTypeId="2" ParentId="6206" CreationDate="2012-12-10T02:49:50.297" Score="12" Body="&lt;p&gt;Ideal symbol pulses are sequences of rectangular pulses.  Rectangular pulses, unfortunately, have horrible frequency profiles, as shown below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/x16jv.png&quot; alt=&quot;FFT of rectangular pulse&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main lobe is where most of the pulse power is, and the other lobes are called side lobes.  Though they do diminish in power the farther out they go, they don't diminish very quickly.  The main purpose of pulse shaping is to dramatically reduce the power of those side lobes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The width of the primary lobe is $\frac{2}{T}$, where $T$ is the rectangular pulse width, which is equivalent to the symbol period.  Thus, once pulse shaping is employed, the signal bandwidth is $\frac{2}{T}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since BPSK transmits one bit per symbol, and the symbol rate is $\frac{1}{T}$, BPSK can transmit $\frac{1}{T}$ bits per second.  Therefore, the bit rate divided by the bandwidth is $\frac{\frac{1}{T}}{\frac{2}{T}}$, which reduces to $\frac{1}{2}$.  Thus, the bit rate is $\frac{1}{2}$ the bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the signal is at baseband half of the mainlobe is in the positive frequencies and half is in the negative frequencies.  Given that it is a real signal, the two halves mirror each other so some people consider it the bandwidth to be halved, or $\frac{1}{T}$.  Thus, at baseband the bit rate would be equal to the bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;QPSK transmits two bits per symbol, so the bit rate for QPSK is $\frac{2}{T}$.  It follows that QPSK can transmit $2$ bits per Hz of bandwidth at baseband, and $1$ bit per Hz at passband.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2012-12-10T04:27:29.857" LastActivityDate="2012-12-10T04:27:29.857" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6236" PostTypeId="1" CreationDate="2012-12-10T14:15:42.927" Score="0" ViewCount="306" Body="&lt;p&gt;Project Description:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Frontal Face Image&#xA;Expression&#xA;Angle&#xA;Size&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Details:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to convert the input frontal face image into 3D face and simulate the given expression (smile, cry, neutral, ..); rotate by the given angle and re-size to the given size. Again convert back into 2D face after the changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After googling, I found that Morphable models is a good algorithm to start with; I want a 3D face database to start &amp;amp; complete the implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some 3D databases list on www.face-rec.org. Can anyone help me with buying (pricing, procedure ....) the database, and how to choose the database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance..&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2012-12-29T20:31:38.860" Title="What is the procedure to obtain a 3D face dataset? Can anyone suggest a good 3D face dataset?" Tags="|image-processing|computer-vision|3d|reconstruction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6237" PostTypeId="2" ParentId="6171" CreationDate="2012-12-10T17:17:16.790" Score="2" Body="&lt;p&gt;Wiener filtering is one approach. It might even be the best approach. A Wiener filter is designed to minimize the noise (in the least squares sense) and invert the effect of the impulse response, given a known signal and a signal that is known to be tainted with noise and an impulse response. Once you have a Wiener filter, you can then compare the amplitude of the filtered signal with the amplitude of the direct signal to estimate the noise (I think).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I've never implemented a Wiener filter myself, so I will defer to a textbook with chapter dedicated to the subject: &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0824791452&quot; rel=&quot;nofollow&quot;&gt;Advanced Digital Signal Processing (Electrical and Computer Engineering) by Glenn Zelniker and Fred J. Taylor.&lt;/a&gt; It's out of print, but I'm sure you can pick up a used copy for cheap somewhere. I suggest it because it's more mathematical than engineering in it's approach and that might appeal to you. Many other textbooks have info on the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a more ad-hoc approach suits you, here is a suggestion. I've never tried it, but it might work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create a filterbank, F, (a properly windowed FFT will work) to analyze both the known music file &lt;strong&gt;A&lt;/strong&gt; and the input &lt;strong&gt;C&lt;/strong&gt;. You will also need some measurement function, M. I would suggest $M(x) = | x |$, rather than $M(x) = x^2$, but both will work, and you may also want to do some smoothing over time. By comparing the results of $M(F(C))$ to $(M(F(A))$ when the noise is low, you should be able to determine the effect of &lt;strong&gt;B&lt;/strong&gt;. Of course, you may not know that the noise is low, in which case, you'll have to get a bit more clever, creating some estimate based on some statistics. The goal, however, is to get to a point where you can predict the output of $(M(F(C))$ from $(M(F(A)))$, to within some bounds. The lower the bounds the better you will be at detecting the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To estimate the noise, you will compare how far above those bounds the signal has actually gone. This will work well for band-limited noise, but for quieter, broadband noise, it may not work well. In that case, you may want to create an aggregate statistic based not just on how far above the bounds a signal has gone, but how many bounds have been crossed, or simply apply your measurement function directly to your unfiltered signal: $M(C)$ vs $(M(A))$.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2012-12-10T17:17:16.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6238" PostTypeId="1" AcceptedAnswerId="6239" CreationDate="2012-12-10T18:12:00.723" Score="3" ViewCount="2312" Body="&lt;p&gt;I created a discrete signal sampled at 44.1kHz that is 330Hz for 1 second, 360Hz for 0.5s, and 390Hz for 0.25s.  I did an FFT transformation of this, and got the magnitude graph below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xrwIX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how this magnitude information (combined with the phase information not shown) can reconstitute the original signal.  I know it does -- I'm not asking for a proof.  I'm hoping someone can supply the intuition for how that strange jagged FFT image ends up reconstructing the original signal.&lt;/p&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="29" LastEditDate="2012-12-10T19:21:36.977" LastActivityDate="2012-12-10T22:22:01.850" Title="Intuition for how a Fourier transform handles signals where the frequency varies with time?" Tags="|fft|frequency|fourier|" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6239" PostTypeId="2" ParentId="6238" CreationDate="2012-12-10T18:58:01.223" Score="5" Body="&lt;p&gt;Each frequency burst is equivalent to a rectangular window on an infinite sinusoid.  A rectangular window in the time domain is the same as circular convolution with a Sinc function in the frequency domain.  Thus, you end up with a spike with side humps (the spike for the sinusoid, and the humps due to the convolution with the transform of the rectangular window) for each frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, since the FFT operation is linear, the 3 sine bursts or, equivalently, the 3 spiky hump groups, just sum additively in both the time and the frequency time domain, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are correct in that the phase information is important for reconstruction.  The FFT phase results includes the information about the location of each (non-overlapping in your case) rectangular window for each sine burst.  Twist (or untwist) each spiky hump group's phase in the frequency domain, and you will move the burst's location (the rectangular window) in the time domain.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2012-12-10T19:03:25.330" LastActivityDate="2012-12-10T19:03:25.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6240" PostTypeId="2" ParentId="6230" CreationDate="2012-12-10T19:17:06.863" Score="0" Body="&lt;p&gt;The FFT operation is linear.  Thus any FFT bin that is in the noise floor relative to the sum magnitude of the spectrum of your signal of interest in the frequency domain will likely still be in the noise floor in the time domain, and thus so will the &quot;noise&quot; generated by zeroing that bin.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-12-10T19:17:06.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6241" PostTypeId="2" ParentId="6221" CreationDate="2012-12-10T19:26:24.320" Score="4" Body="&lt;p&gt;In most mathematical treatments of DSP, a &quot;DC&quot; signal acts like a frequency component with a frequency and phase of zero (0 Hz, cos(0)).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-03T20:59:31.477" LastActivityDate="2013-08-03T20:59:31.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6242" PostTypeId="2" ParentId="6194" CreationDate="2012-12-10T21:04:15.913" Score="7" Body="&lt;p&gt;I think that you can solve you problem in a much easier way. Considering that you are dealing with blueprints, you should not worry about edge connectivity, noise, and many other things that SIFT and SURF were built to accommodate for. Your template is a hollow shape with specific edge shapes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, My recommendation is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Walk around the perimeter and find a profile of distances of the edges around the center of the template. This is the radial profile of the template. Divide by largest distance, to be scale invariant. Rotate the vector so that the smallest distance is the first, to be rotation invariant. (If your template has no dominant distance, you can change step 2 later)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WOvsr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Find blobs in the image. Compute the radial profile described at part (1), and compare the two vectors by normalized correlation. If your template has no dominant distance, correlation becomes normalized cross-correlation, and selecting maximum). Those who pass some threshold are considered matches.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is some Matlab code for you to start with - I wrote the part that finds distance profile for a specific blob and calculated it for the template:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function Doors&#xA;    im = imread('https://i.stack.imgur.com/Tf8EV.png');&#xA;    im = im(:,:,1);&#xA;    template = imread('https://i.stack.imgur.com/PlP4i.png');&#xA;    template = template(:,:,1);&#xA;&#xA;    blobs = regionprops(template&amp;gt;0,'Area','Image');&#xA;    largestBlob = GetLargestBlob(blobs);&#xA;    [prof,edgeImage] = GetBlobRadialProfile(largestBlob);&#xA;&#xA;    figure;&#xA;    subplot(1,2,1);plot(prof); title('Radial profile')&#xA;    subplot(1,2,2);imshow(edgeImage); title('Template');&#xA;&#xA;end&#xA;&#xA;function [prof,edgeImage] = GetBlobRadialProfile(blob)&#xA;    paddedImage = padarray( blob.Image,[8 8]);&#xA;    erodedImage = imerode(paddedImage,strel('disk',1));&#xA;    edgeImage = xor(erodedImage,paddedImage);&#xA;&#xA;    c = regionprops(paddedImage,'Centroid');&#xA;    cx  = c.Centroid(1);&#xA;    cy  = c.Centroid(2);&#xA;&#xA;    [y,x] = find(edgeImage);&#xA;    rad = (x(:)-cx).^2 + (y(:)-cy).^2;&#xA;    [~,minIndex] = min(rad);&#xA;    contour = bwtraceboundary(edgeImage, [y(minIndex), x(minIndex)],'N');&#xA;    prof = (contour(:,2)-cx).^2 + (contour(:,1)-cy).^2;&#xA;    prof = prof./max(prof);&#xA;end&#xA;&#xA;function largestBlob = GetLargestBlob(blobs)    &#xA;    area = [blobs.Area];&#xA;    [~,index] = max(area);&#xA;    largestBlob = blobs(index);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-12-10T21:21:07.117" LastActivityDate="2012-12-10T21:21:07.117" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="6243" PostTypeId="2" ParentId="6238" CreationDate="2012-12-10T22:22:01.850" Score="3" Body="&lt;p&gt;As hotpaw2 already has stated, the time envelope information is included in the phase. Let's use the following example: A unit impulse has a flat magnitude frequency response and a zero phase. If you delay that unit impulse by, say, 1s, the magnitude response remains flat. However, the phase response has changed dramatically and is a linear with a very steep slope. &#xA;The amount of delay can often be recovered from the phase response by calculating the group delay. In the case of the delayed impulse has a group delay of 1s. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same thing applies to your three sine wave blips: the magnitude response mostly is given by the length and window shape of the blip and the delay is determined by the group delay in that frequency area. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-12-10T22:22:01.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6245" PostTypeId="2" ParentId="6226" CreationDate="2012-12-10T22:49:15.650" Score="2" Body="&lt;p&gt;What you need here is irrational sample rate conversion. This is often required when the conversion factor isn't a convenient rationale number or when real time sample rate conversion between two different clock sources needs to be done. There are multiple ways of doing this but the most popular one are polyphase FIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a bunch of parameters that need to be chose properly. These are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Filter length&lt;/li&gt;&#xA;&lt;li&gt;Number of phases&lt;/li&gt;&#xA;&lt;li&gt;Cutoff frequency&lt;/li&gt;&#xA;&lt;li&gt;Filter shape (least square, equiripple, etc.)&lt;/li&gt;&#xA;&lt;li&gt;Required stop band attenuation, allowable pass band ripple&lt;/li&gt;&#xA;&lt;li&gt;Linear or minimum phase&lt;/li&gt;&#xA;&lt;li&gt;Phase interpolation method (if any)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The choice of the parameter depends on the application constraints:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;MIPS, memory&lt;/li&gt;&#xA;&lt;li&gt;Sensitivity to phase distortions&lt;/li&gt;&#xA;&lt;li&gt;Sensitivity to noise as a function of frequency&lt;/li&gt;&#xA;&lt;li&gt;Latency requirements (if any)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is an article from the MATLAB application library that describes some of that in more detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/dsp/examples/efficient-sample-rate-conversion-between-arbitrary-factors.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/dsp/examples/efficient-sample-rate-conversion-between-arbitrary-factors.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This lists a specific implementation of the phase calculation through a polynomial fit across phases. It stems mainly from this article: &quot;http://130.230.88.154/images/0/00/Cr1006-2006.pdf&quot; but it's typically not a good choice unless you are heavily memory constraint.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-12-10T22:49:15.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6249" PostTypeId="1" CreationDate="2012-12-11T05:49:49.263" Score="2" ViewCount="856" Body="&lt;p&gt;What exactly is the difference or relationship between power spectral density and power density function? I thought they referred to the same thing but one article I need says to calculate both of them so now I don't know if they are different. A layman's explanation or explanation in terms of physical meaning would be better. Also what is it's relation ship with periodogram? If X(f) is the DFT of x(t), then is $|X(f)|^2$  same as periodogram?&lt;/p&gt;&#xA;" OwnerUserId="3121" LastActivityDate="2015-04-28T11:29:15.123" Title="difference (or relationship ?) between power spectral density, power density function and periodogram" Tags="|power-spectral-density|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6250" PostTypeId="1" CreationDate="2012-12-11T11:24:46.513" Score="5" ViewCount="1843" Body="&lt;p&gt;I need to estimate (extract/produce) the colored noise of a given PSD Data. I have the following procedure to get the desired results.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First of all I calculate the filter coefficiencts using firls command in MATLAB by implementing Helbert Transform firls(filter_order,norm_freq,signal,'hilbert'), the problem I face is to choose the right order for the filter, I am at the moment working with hit and trial method and rougly a value of around 400 is selected which fits quite well with the PSD curve.&lt;/li&gt;&#xA;&lt;li&gt;Secondly the white noise is passed to this filter and further amplified with a power amp. PSD of the extracted noise is again calculted and matched with the input PSD.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I want to know if this way is alright or not, moreover for passing white noise through the filter I am using Simulink, is there a way not to use time varibales and directly calculate the colored noise. In other word if I have to get rid of Simulink block. I tried to work with lsim and I can get to colored noise but it's amplitude is lesser and I am not sure how can I amplify the output signal so that it matches the input PSD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;just a short flow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;INPUT PSD --&gt; Filter Coefficient Calculated --&gt; White Noise Passed Through Filter --&gt; Colored Noise at a lower amplitude extracted --&gt; Amplified --&gt; PSD of Colored Noise Calculated --&gt; INPUT PSD matched with OUTPUT PSD&lt;/p&gt;&#xA;" OwnerUserId="3440" LastActivityDate="2016-07-17T21:04:22.723" Title="Producing Colored Noise from a given PSD Data" Tags="|matlab|filters|noise|power-spectral-density|signal-analysis|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6251" PostTypeId="1" AcceptedAnswerId="6252" CreationDate="2012-12-11T13:14:12.950" Score="2" ViewCount="131" Body="&lt;p&gt;I started working on a autonomous robot project in my spare time. Everything is finished except the image proccessing part. I want my robot to follow an object with particular properties. For the start, I decided to use color as the particular property. For example if object's color is yellow, then I want my robot to chase it. I am using OpenCV and tried some of the sample codes but the problem is that in real world lightning is not uniform and the sample codes which I tried did not do a good job because of the changing threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what can I do? What do you prefer to me? (Are there any better sample codes, algorithm suggestions etc?) I will appreciate if you explain your suggestions as if you were explaining it to someone with nearly none experience with image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Amadeus&lt;/p&gt;&#xA;" OwnerUserId="3323" LastActivityDate="2013-12-21T07:00:38.147" Title="Object Tracing with Particular Color" Tags="|image-processing|color|visual-tracking|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6252" PostTypeId="2" ParentId="6251" CreationDate="2012-12-11T14:37:33.963" Score="2" Body="&lt;p&gt;As you're probably starting to realise this is a very big field with a number of different methods which you can try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to try to use colour, you can try transforming from RGB to &lt;a href=&quot;http://en.wikipedia.org/wiki/HSL_and_HSV&quot; rel=&quot;nofollow&quot;&gt;HSV space&lt;/a&gt;, which attempts to decouple the colour from the &quot;lightness&quot;, this may improve your lighting inconsistencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next problem is how to track your object. If you know the object's colour distribution (histogram) then you can use &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/histograms/back_projection/back_projection.html?highlight=backprojection&quot; rel=&quot;nofollow&quot;&gt;backprojection&lt;/a&gt; to assign a likelihood to each pixel being that colour, then perhaps you could simply track the centre of mass of the back projection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could look into &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html#template-matching&quot; rel=&quot;nofollow&quot;&gt;template matching&lt;/a&gt;, where a template is scanned across the image and areas which match this template closely are scored more highly than non-matches, giving you likely areas for where the object is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any more specific information about what you are trying to acomplish, it will be easier to help you: do you have an example input image, with targeted highlighted?&lt;/p&gt;&#xA;" OwnerUserId="590" LastActivityDate="2012-12-11T14:37:33.963" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6253" PostTypeId="1" CreationDate="2012-12-11T16:47:32.747" Score="0" ViewCount="1060" Body="&lt;p&gt;I would like to compute the Inverse Fourier Transform of a given function using the DTFT definition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{jω})=\frac{1}{(2−e^{jω})(2−e^{−jω})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have to use the definition of the DTFT&#xA;$$H(e^{j\omega}) = \sum_{n = -\infty}^{n = \infty}{h(n) e^{j\omega n}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach was that I assume that $x=e^{jω}$, which then gives the equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(x) = \frac{1}{(2-x)(2-x^{-1})}$$&#xA;Now I can apply partial fraction decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my approach correct?&lt;/p&gt;&#xA;" OwnerUserId="3441" LastEditorUserId="3441" LastEditDate="2012-12-11T23:21:19.497" LastActivityDate="2012-12-13T02:12:06.940" Title="Inverse Discrete Time Fourier Transform of a given Function using the definition" Tags="|linear-systems|math|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6255" PostTypeId="2" ParentId="2607" CreationDate="2012-12-11T21:59:10.950" Score="2" Body="&lt;p&gt;You want only objective criteria to seperate the signals or is it important that they have some sort of similarity when listened to by someone? That of course would have to restrict you to signals a bit longer (more than 1000 samples).&lt;/p&gt;&#xA;" OwnerUserId="3445" LastActivityDate="2012-12-11T21:59:10.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6257" PostTypeId="1" AcceptedAnswerId="6262" CreationDate="2012-12-12T04:53:58.797" Score="2" ViewCount="3254" Body="&lt;p&gt;I'm trying to match SURF points between 2 images using SURF with opencv. One is the rotation of the other.&#xA;The problem is that the few matching it can found are wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jkW7V.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;image of matching points&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mainly took my code from opencv &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html#feature-flann-matcher&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.opencv.org/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html#feature-flann-matcher&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;string imageName1=&quot;test_right_rotate.jpg&quot;;&#xA;string imageName2=&quot;test_right.jpg&quot;;&#xA;Mat image1 = imread( imageName1, 1 );&#xA;Mat image2 = imread( imageName2, 1 );&#xA;int minHessian = 500;&#xA;SurfFeatureDetector detector( minHessian );&#xA;std::vector&amp;lt;KeyPoint&amp;gt; keypoints_1, keypoints_2;&#xA;&#xA;detector-&amp;gt;detect( image1, keypoints_1 );&#xA;detector-&amp;gt;detect( image2, keypoints_2 );&#xA;&#xA;SurfDescriptorExtractor extractor;&#xA;Mat descriptors_1, descriptors_2;&#xA;&#xA;extractor.compute( image1, keypoints_1, descriptors_1 );&#xA;extractor.compute( image2, keypoints_2, descriptors_2 );&#xA;&#xA;FlannBasedMatcher matcher;&#xA;std::vector&amp;lt;vector&amp;lt;DMatch &amp;gt; &amp;gt; matches;&#xA;matcher.knnMatch(descriptors_1,descriptors_2, matches, 2);&#xA;std::vector&amp;lt; DMatch &amp;gt; good_matches;&#xA;for(int i = 0; i &amp;lt; min(descriptors_1.rows-1,(int) matches.size()); i++) //THIS LOOP IS SENSITIVE TO SEGFAULTS&#xA;{&#xA;    if((matches[i][0].distance &amp;lt; 0.6*(matches[i][1].distance)) &amp;amp;&amp;amp; ((int) matches[i].size()&amp;lt;=2 &amp;amp;&amp;amp; (int) matches[i].size()&amp;gt;0))&#xA;    {&#xA;        good_matches.push_back(matches[i][0]);&#xA;    }&#xA;}&#xA;Mat img_matches;&#xA;drawMatches( image1, keypoints_1, image2, keypoints_2, good_matches, img_matches, Scalar::all(-1), Scalar::all(-1), vector&amp;lt;char&amp;gt;(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works well for scaled images and translated images but fails for rotated images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what is wrong but instead of using SURF, I used ORB as detector and FREAK as extractor and it works a lot better. &#xA;You can find the code on this SO : &lt;a href=&quot;https://stackoverflow.com/questions/12491022/opencv-freak-fast-retina-keypoint-descriptor&quot;&gt;https://stackoverflow.com/questions/12491022/opencv-freak-fast-retina-keypoint-descriptor&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1972" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2012-12-12T14:33:21.767" Title="Matching features points of rotate image using SURF" Tags="|computer-vision|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6258" PostTypeId="1" AcceptedAnswerId="6259" CreationDate="2012-12-12T07:48:45.217" Score="0" ViewCount="248" Body="&lt;p&gt;I want to stitch 2 images by crosscorrelation measure, but I don't want to use fft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tryed this but something seems to be wrong.any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void test(IplImage* src,IplImage* temp)&#xA;{&#xA;double max_peak=0;&#xA;                Point pt;&#xA;                double per_x=0.5;&#xA;                double per_y=0.5;&#xA;                for(int cy=-h*per_y;cy&amp;lt;h*per_y;++cy)&#xA;                {&#xA;                        for(int cx=-w*per_x;cx&amp;lt;w*per_x;++cx)&#xA;                        {&#xA;                                uchar* s_p= (uchar*) src-&amp;gt;imageData;&#xA;                                uchar* t_p= (uchar*) temp-&amp;gt;imageData;&#xA;                                __int64 suma=0;&#xA;                                __int64 sumb=0;&#xA;                                for(int y=0;y&amp;lt;h;++y)&#xA;                                {&#xA;                                        for(int x=0;x&amp;lt;w;++x)&#xA;                                        {&#xA;                                                suma+= s_p[x];&#xA;                                                if((y+cy)&amp;lt;h&amp;amp;&amp;amp;(x+cx)&amp;lt;w&amp;amp;&amp;amp;&#xA;                                                        (y+cy)&amp;gt;0&amp;amp;&amp;amp;(x+cx)&amp;gt;0)&#xA;                                                        sumb+= t_p[x+cx];&#xA;                                        }&#xA;                                        s_p+=w;&#xA;                                        t_p+=w;&#xA;                                }&#xA;                                int meana = (int)(suma / (w * h)),&#xA;                                        meanb = (int)(sumb / (w * h)); &#xA;&#xA;&#xA;                                s_p= (uchar*) src-&amp;gt;imageData;&#xA;                                t_p= (uchar*) temp-&amp;gt;imageData;&#xA;&#xA;                                __int64 corr = 0,&#xA;                                        denoma = 0,&#xA;                                        denomb = 0;&#xA;&#xA;                                for(int y=0;y&amp;lt;h;++y)&#xA;                                {&#xA;                                        for(int x=0;x&amp;lt;w;++x)&#xA;                                        {&#xA;                                                int da = (int)s_p[x] - meana;&#xA;                                                int db= 0;&#xA;                                                if((y+cy)&amp;lt;h&amp;amp;&amp;amp;(x+cx)&amp;lt;w&amp;amp;&amp;amp;&#xA;                                                        (y+cy)&amp;gt;0&amp;amp;&amp;amp;(x+cx)&amp;gt;0)&#xA;                                                        db = (int)t_p[x+cx] - meanb; &#xA;                                                else&#xA;                                                        db= -meanb;&#xA;&#xA;                                                corr += da * db;&#xA;                                                denoma += da * da;&#xA;                                                denomb += db * db;&#xA;                                        }&#xA;                                        s_p+=w;&#xA;                                        t_p+=w;&#xA;                                }&#xA;&#xA;                                double peak= corr / sqrt( (double)denoma * denomb);&#xA;                                if (peak&amp;gt;max_peak)&#xA;                                {&#xA;                                        pt.x= cx;&#xA;                                        pt.y= cy;&#xA;                                        max_peak=peak;&#xA;                                }&#xA;                        }&#xA;                }  &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1781" LastActivityDate="2012-12-12T09:24:57.963" Title="image correlation without fft" Tags="|image-processing|image-registration|correlation|stitching|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6259" PostTypeId="2" ParentId="6258" CreationDate="2012-12-12T08:07:06.997" Score="2" Body="&lt;p&gt;At the start of the inner loop, you assign&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;uchar* t_p= (uchar*) temp-&amp;gt;imageData;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;later on, you use it as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t_p[x+cx];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Aren't you missing the &lt;code&gt;cy&lt;/code&gt; here?&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-12-12T08:07:06.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6260" PostTypeId="1" AcceptedAnswerId="6263" CreationDate="2012-12-12T09:16:50.267" Score="4" ViewCount="341" Body="&lt;p&gt;I'm new to the field of DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to determine the period and shift of the function. I've tried using FFT, but haven't had much luck.  Seems like it should be simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal  (&lt;a href=&quot;http://pastebin.com/kJAbiKyh&quot; rel=&quot;nofollow noreferrer&quot;&gt;pastebin of Octave matrix&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Created by Octave 3.2.4, Wed Dec 12 00:26:41 2012 PST &amp;lt;jjohnson@jjohnson&amp;gt;&#xA;# name: a&#xA;# type: matrix&#xA;# rows: 1&#xA;# columns: 495&#xA; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.529411764705882 0.945098039215686 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.415686274509804 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.556862745098039 0.890196078431372 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.72156862745098 0.749019607843137 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.862745098039216 0.611764705882353 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.933333333333333 0.470588235294118 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Signal drawn with &lt;code&gt;plot(a)&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8k3GD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By hand I can tell that the shift is 75, and period is ~56.  How do I get that from the results of the FFT?!  Is there some other more appropriate algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT drawn with &lt;code&gt;plot(abs(fft(a)))&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E5oby.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3446" LastEditorUserId="1273" LastEditDate="2012-12-12T09:57:19.633" LastActivityDate="2015-10-29T15:45:14.130" Title="Determining the period of a discontinuous function" Tags="|fourier-transform|frequency|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6261" PostTypeId="2" ParentId="6258" CreationDate="2012-12-12T09:24:57.963" Score="1" Body="&lt;p&gt;Isn't that what the following function in OpenCV does?  Be sure to check out the &lt;strong&gt;method&lt;/strong&gt; param.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;void &lt;a href=&quot;http://opencv.willowgarage.com/documentation/object_detection.html?highlight=matchtemplate#cvMatchTemplate&quot; rel=&quot;nofollow&quot;&gt;cvMatchTemplate&lt;/a&gt;(const CvArr* image, const CvArr* templ, CvArr* result, int method)&lt;/p&gt;&#xA;" OwnerUserId="3446" LastActivityDate="2012-12-12T09:24:57.963" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6262" PostTypeId="2" ParentId="6257" CreationDate="2012-12-12T09:32:14.180" Score="2" Body="&lt;p&gt;SURF Features are not completely rotation invariant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;a href=&quot;http://www.emeraldinsight.com/journals.htm?issn=0305-6120&amp;amp;volume=38&amp;amp;issue=3&amp;amp;articleid=17048144&amp;amp;show=pdf&amp;amp;PHPSESSID=jtag65l2jba9s0h2khjq8vl665&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;, they try to make SURF more robust to rotations by following the following methodology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to improve the performance for rotation, the descriptors are based on multi-orientations. The many-to-many tentative correspondences are determined with a maximum distance. Hough transform is used to reject the mismatches and the affine parameters are computed with a least-squares solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image matching algorithm shows a better performance for image rotation than the standard SURF and it succeeds in matching the image including repetitive patterns which will deteriorate the distinctiveness of feature descriptors.&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="-1" LastEditDate="2012-12-12T14:33:21.767" LastActivityDate="2012-12-12T14:33:21.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6263" PostTypeId="2" ParentId="6260" CreationDate="2012-12-12T12:25:02.873" Score="7" Body="&lt;p&gt;This will give you a plot of the autocovariance up to lag 100 samples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(autocov(a,100))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5FFua.png&quot; alt=&quot;autocovariance&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There you can clearly get the period of your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach is to explicitly get the time of each pulse:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pulses = a &amp;gt; 0.1;&#xA;leading_edges = diff(pulses) &amp;gt; 0;&#xA;times = find(leading_edges &amp;gt; 0);&#xA;periods = diff(times)&#xA;&#xA;ans =&#xA;    55   56   56   56   56&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Explanation: &lt;code&gt;pulses&lt;/code&gt; is 1 wherever there is a pulse. &lt;code&gt;leading_edges&lt;/code&gt; gets a 1 only on the first sample of a pulse. &lt;code&gt;times&lt;/code&gt; gives the sample number of each leading edge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this result you can perform your own statistics or estimation. This second method is computationally more efficient than using transforms. Computing time is linear with number of samples.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-12-12T12:25:02.873" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6264" PostTypeId="2" ParentId="6260" CreationDate="2012-12-12T18:09:15.657" Score="1" Body="&lt;p&gt;If you remove the DC offset before the FFT, the FFT result will show the low frequency peak a little more clearly.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2012-12-12T18:09:15.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6265" PostTypeId="2" ParentId="6250" CreationDate="2012-12-12T19:15:46.497" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Estimating the necessary filter order&lt;/p&gt;&#xA;&lt;p&gt;There are methods for estimating the needed filter order for low/band/high-pass filters, but the fact that you are talking about &amp;quot;colored noise&amp;quot; suggests that you are not going for relatively simple frequency profiles.  Thus, the answer is &amp;quot;no&amp;quot;, I am not aware of an order estimator that will help you.  The best generic advice I can give you is to go as high as you can stand performance-wise and hopefully that will be enough.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Filtered/Colored output has lower amplitude than input&lt;/p&gt;&#xA;&lt;p&gt;It sounds like you know the frequency profile you want, and are creating a filter that produces that profile.  If that is the case, fixing this should be easy.  Do the following:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the average of the amplitude of the frequency profile you are creating.&lt;/li&gt;&#xA;&lt;li&gt;Divide all of your filter coefficients by that average.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;That should make the overall gain of the filter &amp;quot;1&amp;quot; with regards to white noise input.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-07-17T21:04:22.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6266" PostTypeId="1" AcceptedAnswerId="6269" CreationDate="2012-12-12T19:55:19.953" Score="11" ViewCount="4608" Body="&lt;p&gt;At a glance, the constant-Q fourier transform and the complex &lt;a href=&quot;https://dsp.stackexchange.com/q/2114/29&quot;&gt;Gabor-Morlet wavelet&lt;/a&gt; transform seem the same.  Both are time-frequency representations, based on constant-Q filters, windowed sinusoids, etc.  But maybe there's a difference that  I'm missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.elec.qmul.ac.uk/people/anssik/cqt/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Constant-Q Transform Toolbox for Music Processing&lt;/a&gt; says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CQT refers to a time-frequency representation where the frequency bins are geometrically spaced and the Q-factors (ratios of the center frequencies to bandwidths) of all bins are equal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://web.archive.org/web/20050411111713im_/http://www.engmath.dal.ca/courses/engm6610/notes1.pdf#page=19&quot; rel=&quot;nofollow noreferrer&quot;&gt;Time-scale analysis&lt;/a&gt; says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;That is, computing the CWT of a signal using the Morlet wavelet is the same as passing the signal through a series of bandpass filters centered at &lt;span class=&quot;math-container&quot;&gt;$f = \frac{5/2\pi}{a}$&lt;/span&gt; with constant Q of &lt;span class=&quot;math-container&quot;&gt;$5/2\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="29" LastEditorUserId="44499" LastEditDate="2019-08-10T17:07:07.797" LastActivityDate="2021-10-03T10:52:02.370" Title="What's the difference between the Gabor-Morlet wavelet transform and the constant-Q transform?" Tags="|fourier-transform|wavelet|stft|gabor|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6267" PostTypeId="2" ParentId="6253" CreationDate="2012-12-13T02:12:06.940" Score="1" Body="&lt;p&gt;Yes, you can do that. Because we substitute $e^{j\omega}$ for $z$ to get the frequency response of a discrete system, you can go back by substituting $z$ for $e^{j\omega}$. This yields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{1}{(2-z)(2-z^{-1})} = \frac{1}{5-2z^{-1}-2z} = \frac{z^{-1}}{-2+5z^{-1}-2z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore the system you're trying to find is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-2y[n]+5y[n-1]-2y[n-2] = -x[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = \frac{-x[n]-5y[n-1]+2y[n-2]}{-2} = \frac{1}{2}x[n] + \frac{5}{2}y[n-1] - y[n-2]$$&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2012-12-13T02:12:06.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6268" PostTypeId="1" AcceptedAnswerId="6272" CreationDate="2012-12-13T05:40:29.707" Score="5" ViewCount="1078" Body="&lt;p&gt;I would like to use MFCC analysis to distinguish between a male voice and a female voice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any particular quantifiable characteristics consistent with, and exclusive to, either gender? (E.g., energy, fundamental frequency, excitation, the presence of certain waveforms, etc.) &lt;/p&gt;&#xA;" OwnerUserId="1746" LastEditorUserId="76" LastEditDate="2012-12-16T06:53:37.580" LastActivityDate="2012-12-16T06:53:37.580" Title="Acoustic features distinguishing the male and female voice?" Tags="|voice|mfcc|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6269" PostTypeId="2" ParentId="6266" CreationDate="2012-12-13T08:10:48.373" Score="8" Body="&lt;p&gt;Simply speaking both the const-Q-transform and the Gabor-Morlet wavelet-transform are just continuous wavelet transforms. Or, more precisely, approximations thereof, as there will always be discretization issues in real applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A property of wavelet transforms is that they have build in the constant Q-factor property, or in other words logarithmic scaling.&#xA;Gabor and Morlet are just two names of a particular wavelet function (complex exponentials with a gaussian window) which is used most commonly.&#xA;The CQ-transform just uses another basis function/wavelet and has a special name attached to it, probably to some historical reason. &lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2012-12-13T08:10:48.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6271" PostTypeId="2" ParentId="4828" CreationDate="2012-12-13T15:15:28.027" Score="1" Body="&lt;p&gt;I found the answer in the paper: Calibrating an Overhead Video Camera by Raul Rojas in section 3 - 3.3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the start:&#xA; H=K^-1*H &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)  Given four points in the image and their known coordinates in the world, the matrix H can be recovered, up to a scaling factor . We know that the first two columns of the rotation matrix R must be the first two columns of the transformation matrix. Let us denote by h1, h2, and h3 the three columns of the matrix H.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)  Due to the scaling factor we then have that xr1 = h1 and xr2 = h2&#xA;Since&#xA;|r1| = 1,&#xA;then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x = |h1|/|r1| = |h1| and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;x = |h2|/|r2| = |h2|.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) We can thus compute the factor and eliminate it from the recovered matrix H. We just set &lt;/p&gt;&#xA;&#xA;&lt;p&gt;H'= H/x &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) In this way we recover the first two columns of the rotation matrix R. The third column of R can be found remembering that any column in a rotation matrix is the cross product of the other two columns (times the appropriate plus or minus sign). In particular &lt;/p&gt;&#xA;&#xA;&lt;p&gt;r3 = r1 × r2 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Therefore, we can recover from H the rotation matrix R. We can also recover the translation vector (the position of the camera in field coordinates). Just remember that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;h'3 = −R^t &lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) Therefore the position vector of the camera pin-hole t is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;t = −R^-1 h3&lt;/p&gt;&#xA;" OwnerUserId="3189" LastEditorUserId="958" LastEditDate="2012-12-14T02:50:32.190" LastActivityDate="2012-12-14T02:50:32.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6272" PostTypeId="2" ParentId="6268" CreationDate="2012-12-13T17:23:44.857" Score="6" Body="&lt;p&gt;Main difference is the frequency of the fundamental, which is about an octave higher for women with the split point around 160 Hz or so. A fundamental lower than 160 Hz is most likely a male and a fundamental higher is most likely a female. A good overview over a number of studies on the topic can be found at &lt;a href=&quot;http://www2.ling.su.se/staff/hartmut/f0_m%26f.pdf&quot;&gt;http://www2.ling.su.se/staff/hartmut/f0_m%26f.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-12-13T17:23:44.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6275" PostTypeId="2" ParentId="6212" CreationDate="2012-12-14T17:47:23.163" Score="1" Body="&lt;p&gt;When you &quot;window&quot; a signal in the time domain you are multiplying a block of signal data, element by element, with the window's elements.  This corresponds to convolution in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windows are usually &quot;pseudo-gaussian&quot;, in the sense that they look more-or-less like a bell curve (since they have finite length, of curse, the tails only go so far).  Like true gaussians, their Fourier transforms also look like gaussians, so in the frequency domain you will get some smearing.  The smearing effect is reduced as the window gets larger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: As Dilip and Hilmar pointed out, the correct formulation is $S_{out}(\omega) = S_{in}(\omega)\mid H(\omega)\mid^2$.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-05-08T02:53:23.073" LastActivityDate="2013-05-08T02:53:23.073" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6276" PostTypeId="2" ParentId="6212" CreationDate="2012-12-14T20:58:26.570" Score="2" Body="&lt;p&gt;Windowing is multiplication in the time domain which corresponds to convolution in the frequency domain, so the spectrum  of the windowed signal is the spectrum of the original signal convolved with the spectrum of the window. The PSD is simply the magnitude squared of the spectrum of the windowed signal, i.e.&#xA;$$P(\omega)=\left \| X(\omega)\ast W(\omega)  \right \|^{^{2}}$$&#xA;where $\ast$ is the convolution operator.&#xA;Hence the desire to have the spectrum of the window look like an impulse as that has the least impact on the PSD. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-12-14T20:58:26.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6278" PostTypeId="1" AcceptedAnswerId="6279" CreationDate="2012-12-15T13:38:50.450" Score="3" ViewCount="240" Body="&lt;p&gt;All thresholding algorithms I have read about make no mention about color space, except sometimes using pixel values between 0 and 255 as an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since the intensity output by a monitor of a greyscale is $greyscale^{gamma}$, the perceived difference between 1 and 2 is less than the difference between 254 and 255. Provided this fact, should it not improve accuracy to perform binarization on intensities rather than greyscale values?&lt;/p&gt;&#xA;" OwnerUserId="3429" LastEditorUserId="3429" LastEditDate="2012-12-15T19:21:49.753" LastActivityDate="2012-12-17T20:06:47.413" Title="Will binarization / thresholding of image yield better results when performed in a linear color space?" Tags="|image-processing|thresholding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6279" PostTypeId="2" ParentId="6278" CreationDate="2012-12-15T14:06:52.633" Score="4" Body="&lt;p&gt;&lt;em&gt;Disclaimer: What I am about to say is a general rule of the thumb, there are exceptions.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In short&lt;/strong&gt;: Linear space is more useful for computer vision while non-linear space is more useful for showing the final image to humans, without outputing a quantitative analysis. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This highly depends on your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linear space is more related to physical measurements. Thus, thresholding in it is more natural when you are dealing with measurements such as: counting instances, location of objects, etc. Noise behaves in a predictable way - variance of the signal is linearly dependent on the mean value of the signal. There are many other properties that make your algorithms more straightforward and easier to implement. Among other things, when you are selecting a threshold, you can use the linearity of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the non-linear space is more related to human perception of light intensity. Thus, it is more suited for image processing problems in which there is no measurement, but rather showing a good image to the observer, or measuring something in a way that humans do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Linear space -&lt;/strong&gt; &#xA;Counting cells in microscopic images, finding defects in a wafer, tracking cars on a road. (Some image processing operations must be done in linear space due to the physics of the process involved, but the final image is almost always in non-linear domain)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Non-Linear space&lt;/strong&gt; - Performing image processing pixel crunching operations to show a nice image on your tablet, attempting to find defects on a carpet texture, performing image segmentation of medical images in order to assist a human interpreting a scene. &lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-12-17T20:06:47.413" LastActivityDate="2012-12-17T20:06:47.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6282" PostTypeId="1" AcceptedAnswerId="6283" CreationDate="2012-12-15T18:29:24.067" Score="7" ViewCount="2212" Body="&lt;p&gt;By definition of Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\int_{-\infty}^\infty x(t) e^{-j\omega t} dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what will happen to the answer of transform  for example in case of $x(t)= \cos(\omega_0 t)$  if limit is $0$ to $A$ instead of $-\infty$ to $\infty$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $x(t)=\cos(\omega_0 t)$ its fourier transform is given by $ X(\omega)= \pi[\delta(\omega-\omega_0) + \delta(\omega+\omega_o)]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if the limit is changed will it effect the answer?&lt;/p&gt;&#xA;" OwnerUserId="3413" LastEditorUserId="1629" LastEditDate="2016-05-26T08:27:46.737" LastActivityDate="2016-05-26T08:27:46.737" Title="What happens if we change the limits of integral in Fourier transform?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6283" PostTypeId="2" ParentId="6282" CreationDate="2012-12-15T20:56:47.647" Score="13" Body="&lt;p&gt;Yes, it will affect the answer. What you're suggesting is known as the short-time Fourier transform. In the sinusoidal case that you proposed, you will observe spectral leakage, as the truncation of the integral limits is equivalent to multiplication of the sinusoid by a rectangular window function. This multiplication in the time domain maps to convolution in the frequency domain. The Fourier transform of a rectangular window is a sinc function, so the convolution will yield two sinc functions centered at the locations of the impulses in your original answer. &lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-12-15T20:56:47.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6285" PostTypeId="1" CreationDate="2012-12-15T21:57:48.603" Score="3" ViewCount="214" Body="&lt;p&gt;Is there any better measurement of error between two images than just taking pixel value differences?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I am tackling is stitching images containing &quot;sensitive&quot; objects, such as moving people. Here are two images I would like to blend:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RVvD7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7tPEb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I compute error map using inter-pixel differences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NDHO6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image is then considered a graph where pixels are nodes and edges are connecting neighboring pixels. Edge weights are differences between pixels taken from the error map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Max-Flow/Min-Cut algorithm will find an optimal seam which goes through minimum error path (minimum cut - highlighted in red):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UgWdX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the seam have successfully avoided girl's hand, but still goes through the guy's face.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is in the error map which assigns too low error for his face as he just moved his head and the pixel differences of his skin are smaller than ripples on water and other less important features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I heard about saliency map, but not sure if it is the right approach.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2012-12-16T09:43:17.637" LastActivityDate="2024-04-03T17:02:40.373" Title="Perceptually Corresponding Error Map" Tags="|image-processing|image-segmentation|stitching|segmentation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6286" PostTypeId="1" AcceptedAnswerId="6296" CreationDate="2012-12-17T07:55:55.497" Score="3" ViewCount="1823" Body="&lt;p&gt;Prewitt filters are popular filters in image processing for edge detection&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Prewitt_operator&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Prewitt_operator&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone give a proof on why Perwitt and other edge detecting filters are high pass? &lt;/p&gt;&#xA;" OwnerUserId="3184" LastEditorUserId="26" LastEditDate="2012-12-17T11:54:34.210" LastActivityDate="2014-03-03T13:09:26.493" Title="Why is Prewitt filter High Pass" Tags="|image-processing|edge-detection|highpass-filter|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6289" PostTypeId="1" CreationDate="2012-12-17T16:11:33.680" Score="11" ViewCount="13148" Body="&lt;p&gt;Allow me to show you a snip from Szeliski's Computer Vision book on bilateral filter. I don't know how to interpret these kernel definitions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SBH2B.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SBH2B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the actual summation what values do the $k$ and $l$ take? E.g For a kernel of size 5x5 does $k$ take values between negative and positive inf? or between 1 to 5 (e.g. in matlab programming)? Or does it take values from -2 to 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also what do those double bars mean in the definition of range kernel?&lt;/p&gt;&#xA;" OwnerUserId="3465" LastEditorUserId="128" LastEditDate="2018-08-23T08:47:38.397" LastActivityDate="2018-08-23T08:47:38.397" Title="Understanding the Parameters of the Bilateral Filter" Tags="|image-processing|filters|edge-preserving-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6290" PostTypeId="2" ParentId="6289" CreationDate="2012-12-17T16:40:09.327" Score="2" Body="&lt;p&gt;Typically in image processing, a filter kernel is centered upon the destination pixel, so in your example, $k$ and $l$ would take on the values $-2, 1, 0, 1, 2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The double-vertical-bar symbol is typically used to denote some kind of &lt;a href=&quot;http://en.wikipedia.org/wiki/Norm_%28mathematics%29&quot; rel=&quot;nofollow&quot;&gt;norm&lt;/a&gt;. In your case, since (I'm assuming) $f(i,j)$ and $f(k,l)$ are scalar values, I'm assuming $\lVert f(i,j) - f(k,l) \rVert^2$ refers to the squared magnitude of the difference between the two pixel values.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2012-12-17T16:40:09.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6291" PostTypeId="1" AcceptedAnswerId="6450" CreationDate="2012-12-18T00:52:49.990" Score="5" ViewCount="2359" Body="&lt;p&gt;My lecture slides mention that two-level (&quot;2-tasoiset&quot; in Finnish) signals are good in identification with linear systems. I am trying to understand this in noisy system. I cannot find any method really to identify the impulse response, perhaps good pre-processing and some other checks? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a sub-problem 2F &lt;a href=&quot;http://tenttiarkisto.fi/media/exams/9632.1.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for the course Mat-2.4129 in Aalto University.&lt;/p&gt;&#xA;" OwnerUserId="1824" LastEditorUserId="1824" LastEditDate="2012-12-18T18:57:34.813" LastActivityDate="2013-01-09T19:03:33.830" Title="How to identify impulse response of noisy system?" Tags="|impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6292" PostTypeId="1" AcceptedAnswerId="6304" CreationDate="2012-12-18T03:49:29.040" Score="1" ViewCount="101" Body="&lt;p&gt;i need some guidance with understanding frequency response characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have the a signal &lt;strong&gt;A&lt;/strong&gt; with is played on speakers and recorded via microphone which is signal &lt;strong&gt;B&lt;/strong&gt;.&#xA;then i apply a window function, shift both signals to frequency domain and analyze the magnitudes,&#xA;but the peak for the most dominant frequency is not at nearly the same index. it jumps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to do further analyzation of the signal my plan was to create the frequency response of my audio system, multiply my frequency domain signal &lt;strong&gt;A&lt;/strong&gt; with the &lt;strong&gt;FR&lt;/strong&gt; and the peaks should align.&lt;br&gt;&#xA;am i roughly right with this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if yes, additional question:&lt;br&gt;&#xA;as my processing power is limited i want to analyze only a certain frequency band. &#xA;what would be the best approach to generate an frequency response for a certain frequency band? and if i consider only a few frequencies, is it possible, that other frequencies outside my &quot;scope&quot; affect my observed ones and make my results unpredictable again?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks for any help in advance!&#xA;cheers&lt;/p&gt;&#xA;" OwnerUserId="3160" LastActivityDate="2012-12-19T08:55:49.787" Title="narrow band frequency response creation and general FR question" Tags="|frequency-response|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6293" PostTypeId="2" ParentId="6289" CreationDate="2012-12-18T05:50:08.783" Score="5" Body="&lt;p&gt;A small discussion of the details you've asked for:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The bilateral ﬁlter is controlled by two parameters: $\sigma$d and $\sigma$r.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;• As the range parameter $\sigma$r increases, the bilateral ﬁlter becomes closer to Gaussian blur because the range Gaussian is ﬂatter i.e., almost a constant over the intensity interval covered by the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Increasing the spatial parameter $\sigma$d smooths larger features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An important characteristic of bilateral ﬁltering is that the weights are multiplied, which&#xA;implies that as soon as one of the weight is close to 0, no smoothing occurs. As an example, a large spatial Gaussian coupled with narrow range Gaussian achieves a limited smoothing although the ﬁlter has large spatial extent. The range weight enforces a strict preservation of the contours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The Norm or the double bars indicate the gaussian distance in the equation.This distance is deﬁned by Gσ(||p − q||), where σ is a parameter deﬁning the extension of the neighborhood.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since (i,j) and (k,l) are simply spatial points on an image, they will vary from the start of the image to the end of the image. Typically this would be dependent on your indexing measure, for example in a matrix, you've have to range from 0 to 5 for a 5x5 image. The actual values of k,l matter little. Its the relative value which matters far more.&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="6956" LastEditDate="2013-11-13T02:36:29.250" LastActivityDate="2013-11-13T02:36:29.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6294" PostTypeId="2" ParentId="6286" CreationDate="2012-12-18T05:55:54.797" Score="1" Body="&lt;p&gt;A simple explanation: How would you try to implement a differentiation in circuit design? The prewitt operator is simply a digitalization of discrete differentiation. If it was implemented in a circuital form it would attentuate low frequency signals and only allow high frequency signals to pass through. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is precisely the definition of a high-pass filter.&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="958" LastEditDate="2012-12-19T03:58:53.120" LastActivityDate="2012-12-19T03:58:53.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6295" PostTypeId="1" CreationDate="2012-12-18T13:55:59.730" Score="2" ViewCount="470" Body="&lt;p&gt;I am working in face detection and recognition project. I am using STASM for face detction and locating face landmarks. On googling I found AAM (Active Appearance Model) and found that it is also used for face detection and locating face landmarks. Is AAM more efficient than STASM, can you provide your ideas like pros and cons between AAM and STASM or anyother better algorithm than these two?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image input: Web-cam/secondary-cam of Ipad &amp;amp; Android Tablets/Phones&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the same set of training images - which one has greater range of performance w.r.t distance from camera/pose/illumination?&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2012-12-18T13:55:59.730" Title="STASM or AAM which is more efficient" Tags="|image-processing|matlab|computer-vision|opencv|face-detection|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6296" PostTypeId="2" ParentId="6286" CreationDate="2012-12-18T15:17:15.437" Score="5" Body="&lt;p&gt;That depends on the definition of high-pass filter. If you define a &lt;em&gt;high-pass filter&lt;/em&gt; as &lt;em&gt;a filter that has high response in the high frequencies in frequency domain&lt;/em&gt;, then the easiest way is to take a look at the magnitude of Fourier transform, (by definition). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying Fourier transform (in Matlab)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; A = fftshift(abs(fft2(padarray([-1 -1 -1; 0 0 0; 1 1 1],[10 10]))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;results in the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i5256.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the interpretation - The part in the middle is the low frequencies. It has low response. There are 2 high responses, both with zero X frequency and some high Y frequency. That is not surprising since  we took a filter that detects edges in Y direction.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Why does it make sense to define high-pass filter in this way? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because a convolution can be thought as multiplication in Frequency domain. That is, if you have a signal $S$ and filter kernel $f$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F[S**f] = F[S] * F[f] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, put in another way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ S**f  = F^{-1} [ F[S] * F[f] ] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where convolution is denoted by $**$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There is another, more intuitive way, that does not involve Fourier transform. A response to a linear filter is strong when the underlying signal &quot;looks&quot; like the filter itself. Therefore, there should be a strong response to edges.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2014-03-03T13:09:26.493" LastActivityDate="2014-03-03T13:09:26.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6297" PostTypeId="2" ParentId="6184" CreationDate="2012-12-18T16:07:46.860" Score="1" Body="&lt;p&gt;This is no attempt to answer the whole question, but I do have an idea about &lt;em&gt;&quot;cleaning the image&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You said you tried &lt;strong&gt;morphological operations&lt;/strong&gt; already, and this is a &lt;strong&gt;variation&lt;/strong&gt; to the idea, hopefully an upgrade.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This article: &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDkQFjAA&amp;amp;url=http%3A%2F%2Furlib.net%2Fdpi.inpe.br%2Fismm%4080%2F2007%2F03.02.08.07&amp;amp;ei=x5DQUIOMKqOI0AX5n4CQAg&amp;amp;usg=AFQjCNHQMVu7M6i5ykQaF3mGdjEIQ7TUiw&amp;amp;bvm=bv.1355534169,d.d2k&quot; rel=&quot;nofollow noreferrer&quot;&gt;A. Vichik, R. Keshet, D. Malah: Self-dual morphology on tree semilattices and applications&lt;/a&gt; proposes a way to &lt;em&gt;enhance&lt;/em&gt; on the classical morphological operators in a way that can add more desirable properties to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article suggests to &lt;strong&gt;choose a hierarchical representation of an image&lt;/strong&gt; according to desirable properties, and then proposes a method to &lt;strong&gt;define operators&lt;/strong&gt; such as &lt;em&gt;erosion, dilation, opening, top-hat&lt;/em&gt; &lt;strong&gt;on that representation&lt;/strong&gt;. In their own words:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We have presented a &lt;em&gt;general framework for producing new morphological operators&lt;/em&gt; (...)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I explained these hierarchical, tree-shaped structures in the second part of &lt;a href=&quot;https://dsp.stackexchange.com/a/5999/1273&quot;&gt;this answer (&lt;strong&gt;Semantic approaches&lt;/strong&gt;)&lt;/a&gt;, to which you can add &lt;em&gt;Extrema-Watershed Tree&lt;/em&gt; mentioned in the article I linked &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDkQFjAA&amp;amp;url=http%3A%2F%2Furlib.net%2Fdpi.inpe.br%2Fismm%4080%2F2007%2F03.02.08.07&amp;amp;ei=x5DQUIOMKqOI0AX5n4CQAg&amp;amp;usg=AFQjCNHQMVu7M6i5ykQaF3mGdjEIQ7TUiw&amp;amp;bvm=bv.1355534169,d.d2k&quot; rel=&quot;nofollow noreferrer&quot;&gt;here (and again)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is an upgrade to (quoting the authors) &quot;traditional grayscale mathematical morphology&quot; because the operations &lt;strong&gt;keep the desirable properties of the representations&lt;/strong&gt;. E.g. if your hierarchical representation is self-dual, your operators will be really self-dual (e.g. compare with &lt;em&gt;quasi&lt;/em&gt;-self-dual opening-closing by reconstruction which is not &lt;em&gt;really&lt;/em&gt; self-dual.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The linked article also &lt;em&gt;presents some results in filtering out the noise&lt;/em&gt; - you can compare their results from the article (and from the Thesis referenced in the article) to what you need (at least visually) and see if it would work for you before starting to code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, while choosing the simplest representation (max-/min-) tree will yield exactly the classical operations, choosing a self-dual tree which best suits your needs might give you a robust enough approach.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2012-12-18T16:22:58.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6298" PostTypeId="1" AcceptedAnswerId="6308" CreationDate="2012-12-18T16:14:34.900" Score="3" ViewCount="1735" Body="&lt;p&gt;For a project I need to do convolution and i use gpu for calculations. Sometimes I have to deal with kernel sizes of 50x50 and this size of kernel is sufficiently large that it chokes the gpu. (not enough memory svailable by the gpu) I need to find a way to break the kernel into smaller sizes (8x8 or similar) and do the convolution this way (i.e. piece by piece and later stitch together) so that I can realize gpu enhancements. What is the best way to break these kernels into smaller pieces? (I have no prior knowledge of kernel size so the solution must be something I can deal with in run time. )&lt;/p&gt;&#xA;" OwnerUserId="831" LastEditorUserId="831" LastEditDate="2012-12-19T00:07:44.437" LastActivityDate="2012-12-19T20:51:33.890" Title="Breaking a convolution into smaller pieces" Tags="|convolution|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6300" PostTypeId="1" AcceptedAnswerId="6316" CreationDate="2012-12-18T19:43:12.390" Score="4" ViewCount="323" Body="&lt;p&gt;Let's say we have an ARMA (&lt;a href=&quot;https://en.wikipedia.org/wiki/Autoregressive%E2%80%93moving-average_model&quot; rel=&quot;noreferrer&quot;&gt;Auto Regressive Moving Average Model&lt;/a&gt;) process where the transfer function is a minimum phase system (Namely Invertible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By &lt;a href=&quot;http://en.wikipedia.org/wiki/Wold&amp;#39;s_decomposition&quot; rel=&quot;noreferrer&quot;&gt;Wold's Decomposition&lt;/a&gt; it is guaranteed to have MA representation of that system (Infinite order).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is could it be also represented by AR (&lt;a href=&quot;https://en.wikipedia.org/wiki/Autoregressive_model&quot; rel=&quot;noreferrer&quot;&gt;Auto Regressive&lt;/a&gt;) system (Finite or infinite order)? If so, how could the coefficients be calculated?&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-07-02T08:28:40.837" LastActivityDate="2018-07-02T08:28:40.837" Title="ARMA (Auto Regressive Mean Average) Process Representation as AR (Auto Regressive)" Tags="|linear-systems|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6301" PostTypeId="1" AcceptedAnswerId="64827" CreationDate="2012-12-18T20:58:52.790" Score="4" ViewCount="5663" Body="&lt;p&gt;With weight vector I mean the vector with weights that you have to multiply the observations in the window that slides over your data with so if you add those products together it returns the value of the EMA on the right side of the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a linear weighted moving average the formula for finding the weight vector is: &lt;code&gt;(1:n)/sum(1:n)&lt;/code&gt; (in R code). This series of length &lt;code&gt;n&lt;/code&gt; adds up to 1. For &lt;code&gt;n=10&lt;/code&gt; it will be&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;0.01818182&lt;br&gt;&#xA;  0.03636364&lt;br&gt;&#xA;  0.05454545&lt;br&gt;&#xA;  0.07272727&lt;br&gt;&#xA;  0.09090909&lt;br&gt;&#xA;  0.10909091&lt;br&gt;&#xA;  0.12727273&lt;br&gt;&#xA;  0.14545455&lt;br&gt;&#xA;  0.16363636&lt;br&gt;&#xA;  0.18181818&lt;br&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;the numbers 1 to 10 / 55, with 55 the sum of the numbers 1 to 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you calculate the weight vector for an exponential moving average (EMA) of length n?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average&quot; rel=&quot;nofollow&quot;&gt;Wikipedia  tells me&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;if &lt;code&gt;n&lt;/code&gt; is the length of the window, then &lt;code&gt;alpha&amp;lt;-2/(n+1)&lt;/code&gt; and &lt;code&gt;i&amp;lt;-1:n&lt;/code&gt; so &lt;code&gt;EmaWeightVector&amp;lt;-((alpha*(1-alpha)^(1-i)))&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is this correct? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though the EMA is not really confined to a window with a start and an end, shouldn't the weights add up to 1 just like with the LWMA?&lt;/p&gt;&#xA;" OwnerUserId="735" LastEditorUserId="80" LastEditDate="2013-04-23T16:50:14.680" LastActivityDate="2020-03-24T23:56:14.813" Title="Weight vector of an exponential moving average?" Tags="|filters|moving-average|averaging|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6302" PostTypeId="1" AcceptedAnswerId="6309" CreationDate="2012-12-18T21:17:26.040" Score="7" ViewCount="7656" Body="&lt;p&gt;What is the difference between circular and linear convolution? When would I choose one over the other? In image processing where a filter is applied to an image with a mask which type of convolution should I choose?&lt;/p&gt;&#xA;" OwnerUserId="3469" OwnerDisplayName="Juan" LastEditorUserId="39" LastEditDate="2012-12-19T18:07:09.803" LastActivityDate="2013-01-02T08:26:32.670" Title="Circular and Linear Convolution" Tags="|image-processing|convolution|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6303" PostTypeId="2" ParentId="536" CreationDate="2012-12-18T23:16:37.770" Score="9" Body="&lt;p&gt;Shortly, we have two kind of basic responses: &lt;strong&gt;time responses&lt;/strong&gt; and &lt;strong&gt;frequency responses&lt;/strong&gt;. Time responses test how the system works with momentary disturbance while the frequency response test it with continuous disturbance. Time responses contain things such as &lt;em&gt;step response, ramp response and impulse response&lt;/em&gt;. Frequency responses contain &lt;em&gt;sinusoidal responses&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Aalto University has some course Mat-2.4129 material freely &lt;a href=&quot;https://noppa.aalto.fi/noppa/kurssi/mat-2.4129/etusivu&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, most relevant probably the Matlab files because most stuff in Finnish. If you are more interested, you could check the videos below for introduction videos. I found them helpful myself.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;I have only very elementary knowledge about LTI problems so I will cover them below -- but there are surely much more different kinds of problems!&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Responses with Linear time-invariant problems&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;With LTI (linear time-invariant) problems, the input and output must have the same form: sinusoidal input has a sinusoidal output and similarly step input result into step output. If you don't have LTI system -- let say you have feedback or your control/noise and input correlate -- then all above assertions may be wrong. With LTI, you will get two type of changes: phase shift and amplitude changes but the frequency stays the same. If you break some assumptions let say with non-correlation-assumption, then the input and output may have very different forms.&lt;/p&gt;&#xA;&lt;p&gt;If you need to investigate whether a system is LTI or not, you could use tool such as Wiener-Hopf equation and correlation-analysis. Wiener-Hopf equation is used with noisy systems. It is essential to validate results and verify premises, otherwise easy to make mistakes with differente responses. More about determining the impulse response with noisy system &lt;a href=&quot;https://dsp.stackexchange.com/questions/6291/how-to-identify-impulse-response-of-noisy-system&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Wikipedia article about LTI &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Very good introduction videos about different responses &lt;a href=&quot;http://t.co/iOqPET9E&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://t.co/LVbP43jX&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; -- a few key points below.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AgFb6.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1824" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2012-12-18T23:26:45.990" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6304" PostTypeId="2" ParentId="6292" CreationDate="2012-12-19T08:55:49.787" Score="1" Body="&lt;p&gt;Let's assume that speaker, free space and microphone can be modeled as linear systems and that the overall system transfer function is given by $H(\omega)$. Then the received signal is given by&#xA;$$&#xA;B(\omega) = A(\omega)H(\omega),&#xA;$$&#xA;where $A(\omega)$ is the signal sent to the speaker. So, yes, if you know the transfer function $H(\omega)$ you can calculate $B(\omega)$ and it should align with what you record with the microphone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine $H(\omega)$ in practice you will have use discrete-time signals and play a unit impulse $a(n) = \delta(n)$, record the received signal $b(n)$ and calculate the transfer function with help of the discrete Fourier transform (DFT):&#xA;$$&#xA;B(k) = DFT[b(n)]&#xA;$$&#xA;Now the maximum frequency $\omega_m$ you are able to analyze depends on the sampling rate $\omega_s$ with which the samples of $b(t)$ are acquired after the microphone to obtain $b(n)$: $\omega_m = \omega_s/2$. Frequencies greater than $\omega_m$ can neither be measured nor calculated and will influence your result because of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;Aliasing&lt;/a&gt; effect unless they're filtered with a low pass filter before sampling. An alternative approach is to transmit a signal $A(k)$ that only contains frequencies in the range you're interested. The transfer function for this limited frequency range can then be calculated by&#xA;$$&#xA;H(k) = \frac{B(k)}{A(k)}&#xA;$$&#xA;In this case frequencies lying outside this range won't affect your result as long as it's a linear system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A comment on processing power: the sampling rate influences the clock rate in a real-time system and doesn't affect complexity otherwise. The cost of the DFT operation (implemented by the FFT algorithm) increases with the length $N$ of the recorded signal $b(n)$. The greater $N$ the greater the frequency resolution of $B(k)$.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2012-12-19T08:55:49.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6305" PostTypeId="2" ParentId="6298" CreationDate="2012-12-19T11:59:15.920" Score="1" Body="&lt;p&gt;The convolution operation is associative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(S ** g) ** h = S ** ( g ** h ) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that if you find two kernels $g,h$ such that $g**h = k$, (where $k$ is your kernel),&#xA;you can split your kernel into several parts, and apply each one individually. Each of the kernels can be smaller in size. The most known example of such kernels are Gaussian kernels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes, it is even possible to split the kernel into two parts, such that each works only on one dimension. This quality is also possessed by Gaussian kernels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum up, check if your kernel can be represented as convolution of two smaller kernels. This can be found out by &lt;a href=&quot;http://blogs.mathworks.com/steve/2006/11/28/separable-convolution-part-2/&quot; rel=&quot;nofollow&quot;&gt;checking the rank of the matrix&lt;/a&gt;. If it is equal to 1, it is separable. (That is because all of the rows are linear combinations of the first row).&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2012-12-19T17:28:35.287" LastActivityDate="2012-12-19T17:28:35.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6306" PostTypeId="1" CreationDate="2012-12-19T12:22:12.527" Score="4" ViewCount="986" Body="&lt;p&gt;I'm writing on a qualitative evaluation study of interest-point-detectors and descriptors. I've read all Mikolajczyk papers as well as most of the surves from Datta et al. etc. Now I'm implementing an evaluation-tool in &lt;a href=&quot;http://opencv.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV&lt;/a&gt;. I'll take to images. One referred as source- and one as comparison-image.&lt;/p&gt;&#xA;&lt;p&gt;1.) Detectors: Mikolajczyk uses the repeatability-criterion, correspondence count, matching score and an other metric to evaluate the performance of the detector. I would use repeatability and a correspondence count for matched regions.&lt;/p&gt;&#xA;&lt;p&gt;2.) Descriptors: Here I would use the widely used Recall and Precision on the matched regions to describe the performance of the descriptor.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question so far: Are these both good metrics for evaluation?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now I'm trying to implement this is OpenCV and need a good eye from somebody to tell me if this could do. Here I use SURF-Detector and -Descriptor for testing the metrics. Recall and Precision are not implemented yet, but there is a function calculating this.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;opencv.hpp&amp;gt;&#xA;#include &amp;quot;opencv2/core/core.hpp&amp;quot;&#xA;#include &amp;quot;opencv2/features2d/features2d.hpp&amp;quot;&#xA;#include &amp;quot;opencv2/nonfree/features2d.hpp&amp;quot;&#xA;#include &amp;quot;opencv2/highgui/highgui.hpp&amp;quot;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;&#xA;int startSURF() {&#xA;&#xA;    std::cout &amp;lt;&amp;lt; &amp;quot;Starting &amp;quot; &amp;lt;&amp;lt; std::endl;&#xA;    cv::Mat sourceImage = cv::imread(&amp;quot;collection_1/DSCN5205.JPG&amp;quot;,&#xA;            CV_LOAD_IMAGE_COLOR);&#xA;    cv::Mat comparisonImage = cv::imread(&amp;quot;collection_1/DSCN5207.JPG&amp;quot;,&#xA;            CV_LOAD_IMAGE_COLOR);&#xA;&#xA;    if (!sourceImage.data) {&#xA;        std::cout &amp;lt;&amp;lt; &amp;quot;Source-Image empty&amp;quot; &amp;lt;&amp;lt; std::endl;&#xA;        return -1;&#xA;    } else if (!comparisonImage.data) {&#xA;        std::cout &amp;lt;&amp;lt; &amp;quot;Comparison-Image empty&amp;quot; &amp;lt;&amp;lt; std::endl;&#xA;        return -1;&#xA;    }&#xA;&#xA;    //Detect keypoint with SURF&#xA;    int minHessian = 400;&#xA;    cv::Mat sourceMatchedImage, comparisonMatchedImage;&#xA;    std::vector&amp;lt;cv::KeyPoint&amp;gt; sourceKeypoints, comparisonKeypoints;&#xA;&#xA;    cv::SurfFeatureDetector surfDetect(minHessian);&#xA;    surfDetect.detect(sourceImage, sourceKeypoints);&#xA;    surfDetect.detect(comparisonImage, comparisonKeypoints);&#xA;&#xA;    //Calculate the SURF-Descriptor&#xA;    cv::SurfDescriptorExtractor surfExtractor;&#xA;    surfExtractor.compute(sourceImage, sourceKeypoints, sourceMatchedImage);&#xA;    surfExtractor.compute(comparisonImage, comparisonKeypoints,&#xA;            comparisonMatchedImage);&#xA;&#xA;    //Flann-Matching   &#xA;    cv::FlannBasedMatcher flann;&#xA;    std::vector&amp;lt;cv::DMatch&amp;gt; matches;&#xA;    flann.match(sourceMatchedImage, comparisonMatchedImage, matches);&#xA;&#xA;    //Repeatability and Correspondence-Counter    &#xA;    float repeatability;&#xA;    int corrCounter;&#xA;    cv::Mat h12;&#xA;&#xA;    std::vector&amp;lt;cv::Point2f&amp;gt; srcK;&#xA;    std::vector&amp;lt;cv::Point2f&amp;gt; refK;&#xA;&#xA;    for (int i = 0; i &amp;lt; matches.size(); i++) {&#xA;        srcK.push_back(sourceKeypoints[matches[i].queryIdx].pt);&#xA;        refK.push_back(comparisonKeypoints[matches[i].queryIdx].pt);&#xA;    }&#xA;&#xA;    std::cout &amp;lt;&amp;lt; &amp;quot;&amp;lt; Computing homography via RANSAC. Treshold-default is 3&amp;quot; &amp;lt;&amp;lt; std::endl;&#xA;    h12 = cv::findHomography( srcK,refK, CV_RANSAC, 1 );&#xA;&#xA;    cv::evaluateFeatureDetector(sourceImage, comparisonImage, h12,&#xA;            &amp;amp;sourceKeypoints, &amp;amp;comparisonKeypoints, repeatability, corrCounter);&#xA;&#xA;    std::cout &amp;lt;&amp;lt; &amp;quot;repeatability = &amp;quot; &amp;lt;&amp;lt; repeatability &amp;lt;&amp;lt; std::endl;&#xA;    std::cout &amp;lt;&amp;lt; &amp;quot;correspCount = &amp;quot; &amp;lt;&amp;lt; corrCounter &amp;lt;&amp;lt; std::endl;&#xA;    std::cout &amp;lt;&amp;lt; &amp;quot;&amp;gt;&amp;quot; &amp;lt;&amp;lt; std::endl;&#xA;&#xA;    std::cout &amp;lt;&amp;lt; &amp;quot;Done. &amp;quot; &amp;lt;&amp;lt; std::endl;&#xA;    return 0;    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm uncertain if this code works because SURF gets bad repeatability (e.g. 0.00471577) for my testing images with a rotation of almost 45°. &lt;strong&gt;Does anybody see a problem with the code?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to evaluate the detector without RANSAC?&lt;/strong&gt; I did not find a yet implemented method for this. &lt;strong&gt;Is the default of 3 a good threshold?&lt;/strong&gt; I could overwrite it but the problem is that a good threshold can only be determined by experimental results. But I need a robust default-value for all detectors.&lt;/p&gt;&#xA;&lt;p&gt;I think I definitively need the homography. But I never found a way to set the localisation-error ε for the repeatability-measure. &lt;strong&gt;Is there a way to set ε?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A lot of questions. I hope I was specific enough but if there is a question please comment and I will do my best to answer in order get help here. I wish you merry Merry Christmas!&lt;/p&gt;&#xA;&lt;p&gt;[EDIT] Additional Readings: &lt;a href=&quot;http://www.robots.ox.ac.uk/%7Evgg/research/affine/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.robots.ox.ac.uk/~vgg/research/affine/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3293" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-03-21T18:29:45.733" Title="Qualitative Evaluation of Interest-Point-Detectors and Descriptors in Computer Vision" Tags="|computer-vision|algorithms|opencv|image-processing|software-implementation|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6307" PostTypeId="2" ParentId="6302" CreationDate="2012-12-19T13:28:50.527" Score="6" Body="&lt;p&gt;When you implement convolution in images, you have to take care of boundary values, because at some point your convolution mask will get &quot;out&quot; of the image to process. Depending on how you fill the missing values will determine wether or not you implement circular convolution:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if you fill the missing values with 0's then you stay in linear convolution&lt;/li&gt;&#xA;&lt;li&gt;if you fill the missing values by periodicity then you're likely to use circular convolution.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that if you implement the convolution in the Fourier domain then you have no other choice but circular convolution, because the FFT algorithm will implicitly periodize your images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-- EDIT --&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is often implemented in the Fourier domain (=&gt; circular convolution) because it is significantly faster in most cases thanks to the FFT algorithm. Fast linear convolution algorithms exist, but are usually reserved to the separable kernel case where you can filter the image horizontally and vertically separately, which also yields less operations than a naive 2D implementation.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2012-12-21T09:56:16.473" LastActivityDate="2012-12-21T09:56:16.473" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6308" PostTypeId="2" ParentId="6298" CreationDate="2012-12-19T20:51:33.890" Score="4" Body="&lt;p&gt;Yes, you can split them up.  Convolution is a linear process, which means that &lt;a href=&quot;http://en.wikipedia.org/wiki/Superposition_principle&quot; rel=&quot;nofollow&quot;&gt;superposition&lt;/a&gt; holds.  Thus, you can break up any convolution kernel $k$ into multiple parts ($k_1, k_2, ... k_N$) such that $k = \sum k_i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you had a convolution kernel that looked like [1 2 3 4] (granted this is a silly kernel, but does fine for purposes of illustration), you could break it up into the following kernels, [1 2 0 0] and [0 0 3 4].  Now, you could simply do the convolutions like normal and then add the results together.  The sum would be equal to the convolution product of the original kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing that would be inefficient, though, both in terms of computations and memory.  Instead, you could simply drop the 0's at the ends of the &quot;sub-kernels&quot;, and do the convolutions using [1 2] and [3 4].  The one tricky part to this is that you have to offset the results before adding them together to get the correct answer.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-12-19T20:51:33.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6309" PostTypeId="2" ParentId="6302" CreationDate="2012-12-19T21:08:56.833" Score="9" Body="&lt;p&gt;If you have a vector of data, $d$, that is composed of elements $d_1, d_2,... d_N$, then linear convolution operates on them in order, starting with $d_1$ and ending with $d_N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine that the data vector $d$ is represented by a slip of paper with the $N$ elements written in order.  Now, imagine forming the slip of paper into a circle by touching the end (where $d_N$ is written) to the beginning (where $d_1$ is written).  Convolving that is circular convolution.  In practice linear convolution and circular convolution are nearly the same, the difference happening at the beginning and the end of linear convolution.  In linear convolution you assume that there are zero's before and after your data (i.e. we assume that &quot;$d_0$&quot; and &quot;$d_{N+1}$&quot; are 0), while with circular convolution we wrap the data to make it periodic (i.e. &quot;$d_0$&quot; is equal to $d_N$ and &quot;$d_{N+1}$&quot; is equal to $d_1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same principles hold for multi-dimensional arrays.  For linear convolution there is a definite start and end for each axis, with zeros assumed before and after.  For circular convolution the data wraps around in each axis.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;When would I choose one over the other?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With a few very rare exceptions we don't &quot;choose&quot; circular convolution.  We almost always want linear convolution.  The reason that circular convolutions pop up as much as they do is because convolutions via FFT's (FFT, multiply, inverse FFT) are circular convolutions, not linear.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-12-19T21:08:56.833" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6310" PostTypeId="1" AcceptedAnswerId="16343" CreationDate="2012-12-20T05:40:50.517" Score="5" ViewCount="2162" Body="&lt;p&gt;I know how the process works, first from difference equation make a homogeneous equation and then find natural response , then find a particular response (in the form of input) substitute it back in the equation and find constants.  And we get a forced response.  I have a doubt in finding constants.&lt;/p&gt;&#xA;&lt;p&gt;This example is &lt;em&gt;Drill problem 2.12&lt;/em&gt; in &amp;quot;Signals and Systems&amp;quot; by Simon Haykin:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For the equation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$y[n] - (0.25)*y[n-2] = 2*x[n]+x[n-1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;find a forced response for &lt;span class=&quot;math-container&quot;&gt;$x[n]=u[n].$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I have found the natural response and for particular response. Say, &lt;span class=&quot;math-container&quot;&gt;$y[n] = k*u[n]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now the equation is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$k*u[n] - 0.25*k*u[n-2] = 2*u[n] + u[n-1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The answer according to the book is &lt;span class=&quot;math-container&quot;&gt;$k=4$&lt;/span&gt;, but that is true only for &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;=2$&lt;/span&gt;. Can somebody explain what happens if &lt;span class=&quot;math-container&quot;&gt;$2&amp;gt;n&amp;gt;0$&lt;/span&gt;; &lt;span class=&quot;math-container&quot;&gt;$k=4$&lt;/span&gt; does not seem correct in this case, as &lt;span class=&quot;math-container&quot;&gt;$u[n-2]=0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n&amp;lt;2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$u[n-1]=0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n&amp;lt;1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why can we just substitute all &lt;span class=&quot;math-container&quot;&gt;$u[n-c] = 1$&lt;/span&gt;, in the difference equation for finding value of constants in particular solution?&lt;/p&gt;&#xA;" OwnerUserId="3472" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-05-19T17:17:37.457" Title="Concept of finding forced response from difference equation?" Tags="|discrete-signals|impulse-response|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6311" PostTypeId="1" AcceptedAnswerId="6317" CreationDate="2012-12-20T13:22:11.153" Score="4" ViewCount="979" Body="&lt;p&gt;tl;dr: What is a fast way to get the equation of this line?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to extract the &quot;line of best fit&quot; from this data (shown below), and many others like it (so I need a robust method). It is a a spectrogram of a linear chirp. The x axis is frequency and the y-axis is time. The linear chirp came from a truck outputting 4-140Hz linearly over exactly 8 seconds, but attenuation in the ground and some other physical phenomena mean that we are seeing a signal for around 10 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked into using the Hough transform to find the gradient of the line, and then cross-correlating the data with a line of this gradient. But the Hough transform is too slow to perform en mass, which is what I need to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about finding the maxima for frequency ranges (5-10, 10-15, etc.) and plotting a line of best fit through these, but in this particular example there are only two or three areas of strong intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other spectrograms look like this but the high intensity regions will move around to different points on the line, and some may have more noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whats a good way of doing this algorithmically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current idea is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Look for highest intesity regions.&lt;/li&gt;&#xA;&lt;li&gt;Look at many pixels in their neighbourhood and estimate the &quot;center of mass&quot;.&lt;/li&gt;&#xA;&lt;li&gt;Draw line between them and find equation of line.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there a better way? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SCaRK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SCaRK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3475" LastEditorUserId="90" LastEditDate="2012-12-20T13:25:55.747" LastActivityDate="2012-12-23T06:05:27.163" Title="Finding linear chirp parameters from a low quality spectrogram, possibly with image processing techniques?" Tags="|image-processing|matlab|linear-chirp|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6312" PostTypeId="1" CreationDate="2012-12-20T16:45:53.527" Score="4" ViewCount="2378" Body="&lt;p&gt;I would like some feedback on possible techniques that one may use to determine the envelope of a &lt;strong&gt;broad-band&lt;/strong&gt; time domain signal. I have heard anecdotally, that it is not as straight-forward as it seems, but I am not sure. (Some previous discussions about similar subjects exist &lt;a href=&quot;https://dsp.stackexchange.com/questions/424/hilbert-transform-to-compute-signal-envelope&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/3463/envelope-of-time-domain-signal-hilbert-transform&quot;&gt;here&lt;/a&gt; but I would like an explicit discussion on broad band signals here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For narrow-band signals, one may compute the envelope via the absolute value of the analytical signal as such: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $s(t) = A cos(2\pi ft)$ be the real signal. Then, the analytical signal is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a(t) = Ae^{j2\pi ft } = Acos(2\pi ft) + jH(s(t)) = Acos(2\pi ft) + jAsin(2\pi ft)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(.)$ denotes the hilbert transform of the real signal. Then the envelope is given by $E = |a(t)|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we are really doing is converting a real signal into phasor form, and taking that phasors absolute magnitude. In other words, since any real signal can be described as two phasors of equal magnitude rotating at both negative and positive angular frequencies, we simply discard of those phasors and work with the remaining one, and take its absolute magnitude. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to my understanding, this method works well for &lt;em&gt;narrow-band&lt;/em&gt; signals, and not for broad-band signals. Thus my questions are as follows:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I have edited and narrowed down my questions based on the feedback I have received:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: I am wondering, what ways one may use to compute the energy-envelope of the following broad-band signals, assuming the above analytical approach does not work well. (If it doesnt, why doesnt it?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i) A chirp signal, at some carrier. (linear, exponential, etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ii) A very short duration windowed sinusoid, of length $T_p$. (So bandwidth is $2/T_p$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iii) An OFDM signal at some carrier. OFDM is composed of multiple orthogonal (I do not care about it as much, but put it for completion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iv) @Andrey's 'mixture of tones'. (I am not clear on this, but I am guessing it means simple summation of multiple sinusoids around a carrier?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot think of any other types of broad-band signals, but answering those cases might go far in grounding my understanding here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2012-12-21T16:49:41.507" Title="How to find the envelope of a wide-band signal?" Tags="|fft|fourier-transform|frequency-spectrum|hilbert-transform|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6313" PostTypeId="1" AcceptedAnswerId="8595" CreationDate="2012-11-18T08:07:51.083" Score="12" ViewCount="11514" Body="&lt;p&gt;I need to downscale an image in a factor of $s_x$ horizontally and $s_y$ vertically ($s_x$, $s_y$ &amp;lt; $1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use a finite $n\times m$ low-pass filter before downsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I determine the low-pass filter parameters ($n, m$ and the Gaussian $\sigma$) to get it as a function of $s_x$ and $s_y$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I'm interesting in the case where $s_x=s_y=1/\sqrt{2}$.&lt;/p&gt;&#xA;" OwnerUserId="3240" OwnerDisplayName="Ben-Uri" LastEditorUserId="3240" LastEditDate="2013-10-05T17:10:49.093" LastActivityDate="2015-06-18T01:20:23.577" Title="Low-pass filter parameters for image downsampling" Tags="|image-processing|gaussian|" AnswerCount="5" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6314" PostTypeId="2" ParentId="6313" CreationDate="2012-12-18T23:20:50.843" Score="0" Body="&lt;p&gt;If you were doing a large downsize (say 2x, 3x, 4x) you can do pixel averaging to achieve good anti-aliasing.  That's actually why anti-aliasing uses a lot of additional CPU/GPU in order to make video games look crisper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're going from a 1000x1000 to a 707x707 image (just an example for the scale factor) you're correct that aliasing might be an issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thankfully this is a problem that many people have run into already and done quite a bit of work to solve.  In many cases a bicubic interpolation is the way to go.  There are some examples of what the different interpolation methods look like here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.compuphase.com/graphic/scale.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.compuphase.com/graphic/scale.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OpenCV's resize has several of those methods built-in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://opencv.willowgarage.com/documentation/cpp/geometric_image_transformations.html#cv-resize&quot; rel=&quot;nofollow&quot;&gt;http://opencv.willowgarage.com/documentation/cpp/geometric_image_transformations.html#cv-resize&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have already played around with several of those interpolation methods and they don't work well, please post some kind of a sample source image and sample result image showing the shortfall.  We'll need this in order to diagnose the problem and try and come up with a good solution to it.&lt;/p&gt;&#xA;" OwnerDisplayName="Mike Sandford" LastActivityDate="2012-12-18T23:20:50.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6315" PostTypeId="2" ParentId="6311" CreationDate="2012-12-20T23:23:43.520" Score="2" Body="&lt;p&gt;Though the question is classic signal processing, you can use a computer vision technique called &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hough line detector&lt;/a&gt;. The idea is that each pixel votes for all the possible lines that pass through it. Eventually, you select the line with the maximal amount of votes. In your case, you can weight each pixel  vote by its intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This step will give you a rough estimation of the line. Afterwards, you should throw away all outliers, find per each &lt;code&gt;x&lt;/code&gt; coordinate center of mass (in &lt;code&gt;Y&lt;/code&gt;)  and do a least squares line fit on the points. I described something similar to the last part &lt;a href=&quot;https://dsp.stackexchange.com/questions/4684/finding-zebra-like-pattern-in-image-detection-of-structured-light-fringe-center/4687#4687&quot;&gt;in this question&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: After a second look on your data it seems that there are places where finding the center of mass might only confuse you. You should either remove this locations beforehand, or use some kind of &lt;a href=&quot;http://en.wikipedia.org/wiki/Ransac&quot; rel=&quot;nofollow noreferrer&quot;&gt;RANSAC procedure&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S - if you post the original image, I can demonstrate the process in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2012-12-20T23:23:43.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6316" PostTypeId="2" ParentId="6300" CreationDate="2012-12-21T08:29:41.310" Score="2" Body="&lt;p&gt;Ok,&#xA;The answer is as following, any ARMA process which is Minimum Phase system could be represented as MA or AR system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MA part is easy by Wold's Decomposition.&#xA;Since the filter in Wold's Decomposition is Invertible (Minimum Phase by itself), Shall be called $ H \left( z \right) $, It is easy to build the optimal linear predictor from it, $ P \left( z \right) = 1 - \frac{1}{H \left( z \right)} $, which a linear combination of the past of the process -&gt; AR Model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is all coming from the property of the Minimum Phase system being analytic in the unit circle.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2012-12-21T08:29:41.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6317" PostTypeId="2" ParentId="6311" CreationDate="2012-12-21T09:05:13.830" Score="3" Body="&lt;p&gt;I think you can use standart method of fitting data to Straight Line. See for example explanation in 15.2 of &quot;Numerical Recipes in C&quot; &lt;a href=&quot;http://apps.nrbook.com/c/index.html&quot; rel=&quot;nofollow&quot;&gt;http://apps.nrbook.com/c/index.html&lt;/a&gt; (page 661-662)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;To prepare arrays of $x_i$, $y_i$, $\sigma_i$, you must for each point on your image (frequency-time):&lt;br&gt;&#xA;$x_i$ := frequency&lt;br&gt;&#xA;$y_i$ := time&lt;br&gt;&#xA;$\sigma_i$ := 1/intensity (or 1/intensity$^2$)&lt;br&gt;&#xA;size of arrays will be N*M (N, M - x and y size of spectrogram in points)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate a and  b (y = a + b*x) by using formula (15.2.6) from &lt;a href=&quot;http://apps.nrbook.com/c/index.html&quot; rel=&quot;nofollow&quot;&gt;http://apps.nrbook.com/c/index.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;If it will be some problem with outliers, use some robust fitting method. See for example 15.7 of  &lt;a href=&quot;http://apps.nrbook.com/c/index.html&quot; rel=&quot;nofollow&quot;&gt;http://apps.nrbook.com/c/index.html&lt;/a&gt;. But I think there will not such problem with your data.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This method is faster then Hough transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;br&gt;&#xA;It is very important to choose good expression for $\sigma_i$. May be better results will be with $\sigma_i$ := $1/\sqrt{intensity}$. May be will be better to use $\sigma_i$ := 1/(intensity-background) for (intensity &gt; background) and exclude all points with (intensity &amp;lt; background). If there are some limitations on parameres of straight line (a,b), you can exclude some x-y points from $x_i$-$y_i$ arrays. But this modifications depend on actual data. It will be very interesting to see the your results.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2012-12-23T06:05:27.163" LastActivityDate="2012-12-23T06:05:27.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6318" PostTypeId="2" ParentId="6312" CreationDate="2012-12-21T11:01:11.427" Score="4" Body="&lt;p&gt;The analytical signal approach works very well for chirp signals. It stops working for mixtures of different tones. Taking the absolute value is a nonlinear operation that introduces cross terms and thus distorts you envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd say that the envelope of a broad band signal as a property that is not well defined. First you need to define what you actually mean by that. Than you can come up with a method. For instance, the phase of a signal is not well defined for broad-band signals as well, because there exist two or more phases simultaneously. But depending on the actual problem you can come up with a special solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just some notes to the phase example, because I'm an expert there. In physics there is the problem of defining a phase to measure phase synchronization of two or more broad-band systems. One solution is to compute the Lyapunov spectrum which measure phase synchronization implicitly without ever defining a concrete phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just write that to make you think about what you actually want to know/measure/manipulate in order to step a bit back and have a more general look at your problem. &lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2012-12-21T11:01:11.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6319" PostTypeId="1" AcceptedAnswerId="6354" CreationDate="2012-12-21T18:10:53.550" Score="8" ViewCount="1761" Body="&lt;p&gt;I understand that the time domain representation of white noise looks like impulses. How do colored noises like brown, pink etc. look like when we perform an inverse Fourier Transform on them ? What could be some sources of colored noise that may affect speech signals?&lt;/p&gt;&#xA;" OwnerUserId="3480" LastEditorUserId="6" LastEditDate="2012-12-29T20:21:36.490" LastActivityDate="2016-03-01T10:14:28.987" Title="What do colored noises look like in the time domain?" Tags="|noise|speech|transform|fourier|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6320" PostTypeId="2" ParentId="6319" CreationDate="2012-12-21T19:49:15.083" Score="5" Body="&lt;p&gt;White noise implies no correlation between samples of the noise, even consecutive samples.  Colored noise, therefore, implies that there is correlation of some sort between the noise samples, which in turn implies that we can take advantage of that correlation to get rid of some of the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond that, there is not a lot that we can say about what it looks like in the time domain other than to say that colors that favor low frequencies, like pink noise, will tend to change more slowly, while high frequency colors, like &quot;blue&quot; noise, will tend to change more quickly.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2012-12-21T19:49:15.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6321" PostTypeId="1" AcceptedAnswerId="6335" CreationDate="2012-12-22T14:03:02.880" Score="6" ViewCount="1710" Body="&lt;p&gt;I am studying methods for recovering images (that has been blurred and noised).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain the difference between:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Wiener_deconvolution&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Wiener_filter&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I can understand that wiener deconvolution is used for &lt;code&gt;Deblurring&lt;/code&gt; while wiener filter is used for &lt;code&gt;Denoising&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that right? Are there any difference between the two?&lt;/p&gt;&#xA;" OwnerUserId="3376" LastActivityDate="2012-12-26T09:42:07.233" Title="Degraded image: Wiener Filter vs Wiener deconvolution" Tags="|discrete-signals|noise|blur|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6322" PostTypeId="1" CreationDate="2012-12-22T14:46:00.097" Score="2" ViewCount="635" Body="&lt;p&gt;I am relatively new to image processing and am working on a project that requires the thinning of binary images. In the literature, I've seen references to the Safe Point Thinning Algorithm(SPTA) quite a lot, but have failed to find any definitive source to the algorithm, maybe because most of the articles quoted to describe the SPTA are not in the public domain. &lt;strong&gt;Can you please explain SPTA for me? Or even point me to (free)resources that do?&lt;/strong&gt; The pros and cons of the algorithm are welcome. I could also use any alternative algorithm that is &quot;good enough&quot;.&lt;/p&gt;&#xA;" OwnerUserId="3484" LastActivityDate="2012-12-30T11:13:38.547" Title="Safe Point Thinning Algorithm - How to?" Tags="|image-processing|computer-vision|algorithms|opencv|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6323" PostTypeId="2" ParentId="6301" CreationDate="2012-12-22T23:28:16.113" Score="3" Body="&lt;p&gt;ok the solution was: (in R)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;emaweights&amp;lt;-function(m)&#xA;{&#xA;  alpha&amp;lt;-2/(m+1)&#xA;  i&amp;lt;-1:m&#xA;  sm&amp;lt;-sum((alpha*(1-alpha)^(1-i)))&#xA;  return(((alpha*(1-alpha)^(1-i)))/sm)  &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here the weights do add up to 1.&lt;/p&gt;&#xA;" OwnerUserId="735" LastActivityDate="2012-12-22T23:28:16.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6324" PostTypeId="1" AcceptedAnswerId="6350" CreationDate="2012-12-23T15:01:12.073" Score="7" ViewCount="3727" Body="&lt;p&gt;I would like to know if there's a standard way to obtain the FIR coefficients for a sampling frequency $F'$ when the coefficients are for a sampling frequency $F$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to implement the filter described in &lt;a href=&quot;http://www.itu.int/rec/R-REC-BS.1770-3-201208-I/en&quot; rel=&quot;nofollow&quot;&gt;ITU R BS.1770-3&lt;/a&gt;&#xA;(the oversampling FIR filter, page 18).&#xA;The filter coefficients are given for a sampling frequency of 48 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the way to derive the coefficients for another sampling frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit december 28 2012&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if there's a meaning in my request.&#xA;The described filter is used on a 48 kHz sampling frequency audio signal that has been transformed into a 192 kHz sampling frequency signal by stuffing 3 zeros between each original sample. It is the second step of an oversampling method.&#xA;The signal $[x_0, x_1, ..., x_n]$ is first transformed into $[x_0, 0,0,0, x_1, 0,0,0, ...,x_n,0,0,0]$. The filter I have mentioned is applied on this zero-stuffed signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly (which might not be the case), the cut-off frequency of this low pass filter can be expressed relative to the sampling frequency.&#xA;Given this context, and the desired result which is a sort of evaluation of the reconstruction of the audio signal into the analog domain, wouldn't this relative to sampling frequency cut-off frequency be appropriate for any sampling frequency ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say the cut-off frequency of the filter is $\alpha \times F_s$ ($\alpha$ should be around 0.125 for a 22 kHz analog upper bandwith ?), wouln't this $\alpha$ value be the good one for others sampling frequencies ?&#xA;If I have an original signal at 8 kHz sampling frequency, a four time oversample would lead to a 32 kHz sampling frequency, and I can suppose that the reconstructed analog signal would have an upper bandwith limit at approximately 4 kHz ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;End of Edit december 28 2012&lt;/p&gt;&#xA;" OwnerUserId="3485" LastEditorUserId="3485" LastEditDate="2012-12-28T07:53:30.280" LastActivityDate="2020-04-10T07:11:46.563" Title="FIR design : compute coefficients for the same frequency response at another sampling frequency" Tags="|filters|finite-impulse-response|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6326" PostTypeId="1" CreationDate="2012-12-23T21:26:14.140" Score="0" ViewCount="127" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1637/what-does-frequency-domain-denote-in-case-of-images&quot;&gt;What does frequency domain denote in case of images?&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;I am studying applications of low and high pass filters in images. However, first I'm trying to understand what exactly low and high frequencies are in images.&lt;/p&gt;&#xA;" OwnerUserId="3469" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2012-12-28T01:20:43.497" Title="Filtering + Images" Tags="|image-processing|dft|" AnswerCount="2" CommentCount="0" ClosedDate="2013-01-06T22:27:56.940" ContentLicense="CC BY-SA 3.0" />
  <row Id="6327" PostTypeId="2" ParentId="6326" CreationDate="2012-12-23T23:22:26.013" Score="2" Body="&lt;p&gt;You can look at frequency as a rate of change (not accurate but good enough). So, following this logic, low frequencies are a small change between pixels in the image, and high frequencies are a big changes between the &quot;values&quot; in the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think an example can help:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The highest frequency you can get in an black-white image is when the image is -one black pixel, followed by -one white pixel followed by -one black pixel (and so on...). this means that there is a &quot;big&quot; change between one pixel to it's neighbor and then the frequency is high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the value in one pixel is the same as in the next pixel, there will be no &quot;change&quot; which means &quot;zero frequency&quot; (DC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In real images, there are some changes in the image, some are big and other are small, which means that there is a range of frequencies (between the lowest frequency-DC and the highest frequency).&lt;/p&gt;&#xA;" OwnerUserId="3487" LastEditorUserId="76" LastEditDate="2012-12-24T02:31:58.950" LastActivityDate="2012-12-24T02:31:58.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6328" PostTypeId="1" AcceptedAnswerId="6336" CreationDate="2012-12-24T02:01:25.240" Score="2" ViewCount="81" Body="&lt;p&gt;I have two distance maps that describe distances from blue segment and the red segment. &lt;strong&gt;I need to compute a single weight map that describes transition from blue segment to the red segment.&lt;/strong&gt; The weight map should have values in the 0-1 range where 0 is one segment and 1 is the other one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are the distance maps with the respective segments highlighted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aFNfB.jpg&quot; alt=&quot;enter image description here&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/Kipvo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having $d_{1}$ and $d_{2}$ the distances in the first and second image, I tried the following formula for computing the transition weight map:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d=\frac{d_{1}-d_{2}+d_{2max}}{d_{1max}+d_{2max}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $d_{1max}$, $d_{2max}$ are maximum distances found in the first and second image.&#xA;The numerator have range $&amp;lt;0, d_{1max}+d_{2max}&amp;gt;$ so the result is in $&amp;lt;0,1&amp;gt;$ range.&#xA;This resulted in the following map:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bi4Pe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are sharp transitions between each segment and the map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also tried multiplicative formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d=\bar{d_{1}}\cdot (1 - \bar{d_{2}})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\bar{d_{1}}, \bar{d_{2}}$ are distances normalized to $&amp;lt;0,1&amp;gt;$ range. This resulted in little better transition, but still suffers from the same problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uPLHs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any other ideas how to combine the distance maps to obtain transition map?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-12-26T13:19:19.143" Title="Combining Distance Maps" Tags="|image-processing|transform|distance-metrics|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6329" PostTypeId="1" CreationDate="2012-12-24T10:30:08.257" Score="3" ViewCount="372" Body="&lt;p&gt;I have an unknown black-box that is generating a deterministic continuous periodic signal and the period is variable between 1 to 30 seconds. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When the black box is turned on, the period is fixed, but unknown.&lt;/li&gt;&#xA;&lt;li&gt;Sampling rate and signal period are not synched, and it is highly unlikely to be integer coefficient of one another.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All that is available to me is sparse (contains missed) samples with period of 100 ms to 10 ms.  (The parameter of source is fixed every time, for example I should construct a 3s signal from periodic 10ms samples). There is no limit on the duration of sample gathering but samples may be missed. Signal is smooth and does not change fast and slowest sampling rate satisfies nyquist rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a method to construct a single period of signal and enhance its resolution as time goes by?&lt;/p&gt;&#xA;" OwnerUserId="3488" LastEditorUserId="3490" LastEditDate="2012-12-26T18:19:02.833" LastActivityDate="2012-12-29T23:19:26.697" Title="How to construct an unknown signal from sparse periodic samples?" Tags="|resolution|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6330" PostTypeId="2" ParentId="513" CreationDate="2012-12-24T18:11:43.887" Score="4" Body="&lt;p&gt;The dilation operator with a structuring element is not the way to go. &quot;Stroking&quot; the contour is not the way to go. The distance transform, on the other hand, is exactly the method used by Photoshop. A thresholded distance transform is the equivalent of dilation of a binary image. But how do we dilate a grayscale image? This is how Photoshop does it: Calculate the Euclidean Distance transform using the Chamfer 5-7-11 metric. This is described in the original paper by G. Borgefors (&quot;Distance Transforms in Digital Images&quot; G. Borgefors, Computer Vision, Graphics, and Image Processing #34). However, instead of using floating point numbers, use integers with 8 bits of fixed point precision for the weights (i.e. all multiplied by 256). If distance &amp;lt;= radius * 256 then output a fully opaque pixel. If distance &amp;lt; (radius + 1) * 256 then output a pixel with transparency = 256 - (distance - (radius * 256)). Else, the pixel is fully transparent. This is implemented in my open source library:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/vinniefalco/LayerEffects&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vinniefalco/LayerEffects&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this technique is superior to the answer I gave previously, and gives results which are completely identical to Photoshop.&lt;/p&gt;&#xA;" OwnerUserId="1838" LastActivityDate="2012-12-24T18:11:43.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6333" PostTypeId="2" ParentId="6329" CreationDate="2012-12-25T22:11:50.943" Score="0" Body="&lt;p&gt;Imagine that you have many periods of the waveform plotted on a long strip chart. Now cut the strip chart into pieces and shuffle them. The task is to reconstruct one period of the waveform from the pieces. That can be attempted by finding the two pieces with maximum overlap, combining them into one, deleting the original two pieces, and repeating. The algorithm terminates when only one piece remains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure this is the same problem, but thought it might stimulate some ideas.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastEditorUserId="3434" LastEditDate="2012-12-26T01:37:32.227" LastActivityDate="2012-12-26T01:37:32.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6334" PostTypeId="2" ParentId="6184" CreationDate="2012-12-26T05:23:16.317" Score="3" Body="&lt;p&gt;Why not just use a simple 2D FFT (guassian) high pass filer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did this real quick using MATLAB&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shard #1 using high pass FFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ECpT3.jpg&quot; alt=&quot;http://i47.tinypic.com/rbjxnd.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same thing is done on #2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shard #2 using high pass FFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NHdym.jpg&quot; alt=&quot;http://i45.tinypic.com/209kms0.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the background and glass area is wiped out, and only the edges are traced.  I did not spend any time on it, but you can threshold the HP filtered output to have more crisp edges, or push the HP cut off higher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this more the results you are looking to get?&lt;/p&gt;&#xA;" OwnerUserId="3492" LastEditorUserId="76" LastEditDate="2012-12-27T09:37:20.333" LastActivityDate="2012-12-27T09:37:20.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6335" PostTypeId="2" ParentId="6321" CreationDate="2012-12-26T09:42:07.233" Score="10" Body="&lt;p&gt;Wiener deconvolution is an approach to solve the deconvolution problem that relies on the filter proposed by Wiener. The equation is the &lt;strong&gt;same&lt;/strong&gt; in denoising and deblurring, except that the filter $G$ (to stick with Wikipedia's notations) that you should use is different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make things clear:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;denoising consists in the case where the degradation kernel $H$ is the identity, &lt;/li&gt;&#xA;&lt;li&gt;in deconvolution this kernel is equal to the blur kernel that destroyed your image (motion &#xA;blur, lens PSF...). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hence, in denoising, the $H$ part that appears in the expression of the Wiener filter $G$ disappears (it is equal to 1), while in deconvolution it is equal to the Fourier transform of your blur kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, when using an inverse problem approach for these tasks, i.e. solving $\| A x - y \|^2 + \lambda g(x)$ (with $x$ your solution and $y$ the noisy observation, $g(x)$ some prior on $x$), you can always switch between denoising and deconvolution by choosing $A = Id$.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2012-12-26T09:42:07.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6336" PostTypeId="2" ParentId="6328" CreationDate="2012-12-26T13:19:19.143" Score="1" Body="&lt;p&gt;An obvious choice would be $\frac{d_1}{d_1+d_2+\epsilon }$, where $\epsilon$ is a small value to prevent division by zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using your images, I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;top = ColorNegate[Binarize[ImageApply[StandardDeviation, &#xA;           Import[&quot;https://i.stack.imgur.com/aFNfB.jpg&quot;]]]];&#xA;bottom = ColorNegate[Binarize[ImageApply[StandardDeviation, &#xA;           Import[&quot;https://i.stack.imgur.com/Kipvo.jpg&quot;]]]];&#xA;tDist = ImageData[DistanceTransform[top]];&#xA;bDist = ImageData[DistanceTransform[bottom]];&#xA;&#xA;\[Epsilon] = 10^-10;&#xA;Image[tDist/(tDist + bDist + \[Epsilon])] // ImageAdjust&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pM3g7.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-12-26T13:19:19.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6337" PostTypeId="1" CreationDate="2012-12-26T14:01:09.653" Score="2" ViewCount="1162" Body="&lt;p&gt;How to recognize a &lt;a href=&quot;http://en.wikipedia.org/wiki/Zebra_crossing&quot; rel=&quot;nofollow&quot;&gt;zebra crossing&lt;/a&gt; from top view using OpenCV?&#xA;It is not a straight zebra crossing - it has some twists and turns.&#xA;I have some ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;parallel line detection, but the available techniques only work to find straight parallel lines, not curved&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;template matching to match a template of back to back white and black stripes, but it becomes tedious since I can't find any pattern matching techniques with scaling and rotation&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3493" LastEditorUserId="39" LastEditDate="2012-12-26T17:44:15.290" LastActivityDate="2012-12-26T17:44:15.290" Title="How to recognize a zebra crossing from top view using OpenCV?" Tags="|image-processing|opencv|template-matching|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6338" PostTypeId="1" CreationDate="2012-12-25T23:18:16.303" Score="1" ViewCount="1344" Body="&lt;p&gt;Correct me if I'm wrong, I should read bitmap into matrix of float values where I would get numbers up to little more than 16*10^6, then I should expand my image matrix to size 2^k putting the original image matrix into top left corner of the new expanded matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should then expand given filter to that size (you could help me on this one I'm not sure how to do it, with what to fill it and how to reorganize it), then apply 2 dimensional fft on both matrices, then multiply them dot by dot and finally do inverse 2 dimensional fft to get wanted picture! Where do I get wrong? If I have filter like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0   0.2  0&#xA;0.2 0.2 0.2&#xA;0   0.2  0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What would this filter transformed to 16x16 filter looked like? Thanks for help, fft part was easy for me but this...&lt;/p&gt;&#xA;" OwnerUserId="3499" OwnerDisplayName="Ognjen Kocic" LastActivityDate="2012-12-27T00:56:03.223" Title="How to properly perform convolution on bitmap image?" Tags="|image-processing|fft|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6339" PostTypeId="2" ParentId="6338" CreationDate="2012-12-27T00:56:03.223" Score="1" Body="&lt;p&gt;You don't need to expand the filter kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just flip the filter matrix (otherwise it would result in correlation, not convolution), then perform FFT on the filter. In case of symmetric kernels like your, the flipping is obviously irrelevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before multiplying the two spectra, make sure their DC components are aligned, i.e. the transformed kernel is centered in the transformed image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe the lower frequencies are located in image corners. In that case, you have to split the transformed kernel in four squares and put each square in the respective corner of the image. (&lt;em&gt;Please edit my answer if you know better than me&lt;/em&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-12-27T00:56:03.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6340" PostTypeId="1" CreationDate="2012-12-27T10:03:14.647" Score="0" ViewCount="780" Body="&lt;p&gt;Project: 3D face reconstruction&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input: 2D frontal face Image Output: 3D face Reconstruction and expression simulation Platform: Matlab or Opencv cpp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found out after study that 3D Morphable Models (3DMM) algorithm is a good starting point for my project. But I don't have the Basel Face Model (3D face Database) to implement the algorithm. However, I have downloaded GavabDB from &lt;a href=&quot;http://gavab.escet.urjc.es/recursos_en.html&quot; rel=&quot;nofollow&quot;&gt;http://gavab.escet.urjc.es/recursos_en.html&lt;/a&gt;. Can I develop 3DMM using the GavabDB for 3D face reconstruction from frontal image? After reading the dataset description doc, I observed that Gavab doesn't provide Texture data of the 3D scans; is texture data compulsory?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the output quality depend on the 3D database used for modeling?&lt;/p&gt;&#xA;" OwnerUserId="3147" LastEditorUserId="3154" LastEditDate="2012-12-27T12:29:47.950" LastActivityDate="2012-12-27T12:29:47.950" Title="Using GavabDB for 3D face reconstruction from frontal image" Tags="|image-processing|computer-vision|opencv|3d|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6341" PostTypeId="1" AcceptedAnswerId="6343" CreationDate="2012-12-27T11:23:39.357" Score="2" ViewCount="393" Body="&lt;p&gt;Apologies if this is too basic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to implement a band-pass filter, for a realtime system.&#xA;Not sure what to use. FIR? IIR? Something else ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips would be highly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="685" LastActivityDate="2012-12-27T15:10:58.833" Title="A filter for for a realtime system?" Tags="|filters|filter-design|real-time|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6342" PostTypeId="2" ParentId="4680" CreationDate="2012-12-27T15:10:10.593" Score="1" Body="&lt;p&gt;Others have mentioned &lt;em&gt;how&lt;/em&gt; you do smoothing, I'd like to mention &lt;em&gt;why&lt;/em&gt; smoothing works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you properly oversample your signal, it will vary relatively little from one sample to the next (sample = timepoints, pixels, etc), and it is expected to have an overall smooth appearance. In other words, your signal contains few high frequencies, i.e. signal components that vary at a rate similar to your sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, measurements are often corrupted by noise. In a first approximation, we usually consider the noise to follow a Gaussian distribution with mean zero and a certain standard deviation that is simply added on top of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To reduce noise in our signal, we commonly make the following four assumptions: noise is random, is not correlated among samples, has a mean of zero, and the signal is sufficiently oversampled. With these assumptions, we can use a sliding average filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider, for example, three consecutive samples. Since the signal is highly oversampled, the underlying signal can be considered to change linearly, which means that the average of the signal across the three samples would equal the true signal at the middle sample. In contrast, the noise has mean zero and is uncorrelated, which means that its average should tend to zero. Thus, we can apply a three-sample sliding average filter, where we replace each sample with the average between itself and its two adjacent neighbors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the larger we make the window, the more the noise will average out to zero, but the less our assumption of linearity of the true signal holds. Thus, we have to make a trade-off. One way to attempt to get the best of both worlds is to use a weighted average, where we give farther away samples smaller weights, so that we average noise effects from larger ranges, while not weighting true signal too much where it deviates from our linearity assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How you should put the weights depends on the noise, the signal, and computational efficiency, and, of course, the trade-off between getting rid of the noise and cutting into the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there has been a lot of work done in the last few years to allow us to relax some of the four assumptions, for example by designing smoothing schemes with variable filter windows (anisotropic diffusion), or schemes that don't really use windows at all (nonlocal means). &lt;/p&gt;&#xA;" OwnerUserId="59" LastActivityDate="2012-12-27T15:10:10.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6343" PostTypeId="2" ParentId="6341" CreationDate="2012-12-27T15:10:58.833" Score="4" Body="&lt;p&gt;For an EEG signal, I suppose you need to keep the shape of the signal. Therefore the filter should have linear phase, so the reasonable way to go is a FIR filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If shape (transients) don't matter much for your application, then an IIR filter would be preferable since it will give less end-to-end delay in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that suprressing 0 - 1 Hz, inevitably gives a group delay of at least 1 second, depending on how sharp the transition should be, so your real-time requirements may conflict with the start frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may try some filter design tools (e.g. from matlab) to find a reasonable compromise between frequency response and group delay.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2012-12-27T15:10:58.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6345" PostTypeId="2" ParentId="6326" CreationDate="2012-12-27T17:27:10.260" Score="3" Body="&lt;p&gt;As jonsca stated, frequency can be understood as a rate of change. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Particularly, in images you can say that the high frequencies are the details of the image. Higher frequency, more &quot;edgy&quot; image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be easily seen if you apply some transformations to frequency domain to images, filter them, and them transform them back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NwN0G.png&quot; alt=&quot;Original Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A high-frequency component could be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/th16S.png&quot; alt=&quot;High Pass&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a low-frequency one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WldlS.png&quot; alt=&quot;Low Pass&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The low-pass filtered image has 'lost detail' and the high-pass filtered one has 'lost smoothness'&lt;/p&gt;&#xA;" OwnerUserId="3498" LastEditorUserId="59" LastEditDate="2012-12-27T18:41:57.590" LastActivityDate="2012-12-27T18:41:57.590" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6346" PostTypeId="1" AcceptedAnswerId="6385" CreationDate="2012-12-27T21:07:03.060" Score="3" ViewCount="4549" Body="&lt;p&gt;I'm trying to determine what &quot;filter&quot; has been applied to an image.  I have the original, raw image and the processed image.  The processed image has been put through a pipeline (black box) that does various things to the image in an iterative manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter, as far as I can tell, is similar to an unsharp-mask, but with &quot;negative bowls&quot; mitigated.  However, the processed image cannot be reproduced by a simple unsharp mask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've attempted to measure the &quot;filter function&quot; by taking the ratio of the power spectra of the raw and unprocessed images, but the best I've been able to do with that is unsharp mask with a non-gaussian smoothing function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What methods are available for determining the filter applied to an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(not related to &lt;a href=&quot;https://dsp.stackexchange.com/questions/6049/determining-the-type-of-filter-on-an-image&quot;&gt;Determining the type of filter on an image&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="1402" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-10-20T14:32:43.983" Title="Determining what filter (if any) has been applied to an image" Tags="|image-processing|filters|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6347" PostTypeId="1" AcceptedAnswerId="6375" CreationDate="2012-12-27T23:35:32.570" Score="4" ViewCount="202" Body="&lt;p&gt;I'm trying to determine the effect of a particular non-linear process on my data.  From simulations, I can measure the power spectra of &quot;ideal&quot; and &quot;processed&quot; images and take their ratio, which (I think) should correspond to some sort of filter or filtering process.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, are there any filters, or filtering processes, that look (vaguely) like the attached plots?  The two plots are the same data in linear-linear (left) and log-log (right) space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o89wb.png&quot; alt=&quot;Filter Function Plots&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More detail: I have a pipeline that takes timestream data where each point on the timestream is associated with a point in an image.  Some &quot;cleaning&quot; (PCA subtraction) is performed on the timestreams before creating the images.  My goal is to determine the effect the timestream processing has on the resulting image, with the end goal being to replicate the effect on images for which no comparable timestream data is available.  The data is coming from bolometer arrays and these are images of the sky at millimeter wavelengths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the simulated images.  Left is before, right is after processing.  The spiky points around the edges are where there is no timestream data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9tzWk.png&quot; alt=&quot;images described in text&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also this ipython notebook &lt;a href=&quot;http://nbviewer.ipython.org/4393835/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://nbviewer.ipython.org/4393835/&lt;/a&gt; for a little analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is entirely possible that the timestream filtering process cannot be represented by any filter in image space, an answer addressing &quot;how do I approximate these filter functions&quot;  is appropriate.&lt;/p&gt;&#xA;" OwnerUserId="1402" LastEditorUserId="1402" LastEditDate="2012-12-28T02:02:09.007" LastActivityDate="2013-01-01T10:34:13.357" Title="Are there any filters that look (vaguely) like this?" Tags="|filters|" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6348" PostTypeId="1" AcceptedAnswerId="6352" CreationDate="2012-12-28T04:16:03.910" Score="2" ViewCount="2382" Body="&lt;p&gt;I came across this paragraph in an article about signal processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Addition of redundant bits for improving the error probability leads to bandwidth expansion of the&#xA;transmitted signal by an amount equal to the reciprocal of the code rate.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(page 16)&#xA;&lt;a href=&quot;http://www.ece.rice.edu/~ashu/publications/encylopedia.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ece.rice.edu/~ashu/publications/encylopedia.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure I understand this. why adding redundancy means increasing the bandwidth? it will just take more time to transmit this signal, no?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me clarify this. thanks. &lt;/p&gt;&#xA;" OwnerUserId="1468" LastEditorUserId="1468" LastEditDate="2012-12-28T04:37:13.150" LastActivityDate="2014-01-30T04:08:45.320" Title="increase of encoding rate increases bandwidth?" Tags="|frequency-spectrum|digital-communications|channelcoding|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6349" PostTypeId="2" ParentId="6322" CreationDate="2012-12-28T17:05:45.280" Score="4" Body="&lt;p&gt;SPTA seems to be a quite old skeleton algorithm that is even hard to find behind paywalls. &#xA;Here is a link to a skeletonization paper that references it and comes with free access : &lt;a href=&quot;http://dspace1.acs.ucalgary.ca/bitstream/1880/45551/2/1987-287-35.pdf&quot; rel=&quot;nofollow&quot;&gt;http://dspace1.acs.ucalgary.ca/bitstream/1880/45551/2/1987-287-35.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But roughly speaking the idea of skeleton algorithms is to look of a simple shape &quot;midway&quot; inside the detected blob. For example, if you have detected a rectangle, then its skeleton is going to be the points inside the rectangle that are at equal distance from its boundaries, which makes a shape like this (the part inside the rectangle):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;--------&#xA;|&amp;gt;----&amp;lt;|&#xA;--------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If it helps, think of the way children draw characters wit just a few strokes...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-- EDIT --&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, if I had to choose some reference to implement (but I understood from the question that SPTA was actually used, not to be replaced), I would check the papers on this page:&#xA;&lt;a href=&quot;http://www.ensta-paristech.fr/~manzaner/publis.html&quot; rel=&quot;nofollow&quot;&gt;http://www.ensta-paristech.fr/~manzaner/publis.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer: I'm not this guy, I didn't write the papers, but I would start here because:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the papers are available for download&lt;/li&gt;&#xA;&lt;li&gt;A. Manzanera worked a lot on limited hardware (e.g. embedded stuff), so I guess the algorithms are efficient and not so tricky to implement&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2012-12-30T11:13:38.547" LastActivityDate="2012-12-30T11:13:38.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6350" PostTypeId="2" ParentId="6324" CreationDate="2012-12-28T19:01:53.310" Score="5" Body="&lt;p&gt;There is no direct way of converting filter coefficients between two sample rates while maintaining the exact transfer function (at least where it's properly defined). &#xA;Re-sampling the impulse response can be done but will often result in extra latency, a longer filter, and some change in the frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, however, you can derive the original filter specification from the filter coefficients and than re-design the filter using the same specification at a different sample rate. By visual inspection we can find that the ITU filter is an equiripple filter with&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;pass band edge: 20 kHz&lt;/li&gt;&#xA;&lt;li&gt;stop band edge: 28 kHz&lt;/li&gt;&#xA;&lt;li&gt;pass band ripple: 0.1dB&lt;/li&gt;&#xA;&lt;li&gt;stop band attenuation: 40 dB&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Let's say you want that filter at 4*44.1kHz instead of 4*48kHz. In Matlab you would do the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% match the filter at 44.1 kHz&#xA;fs = 4*44100;&#xA;d = fdesign.lowpass('Fp,Fst,Ap,Ast',20000,28000,0.1,40,fs);&#xA;hd = design(d,'equiripple');&#xA;% convert to polyphase&#xA;h4 = 4*reshape(hd.Numerator',4,12)';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the coefficients would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    0.0057292     0.001552   -0.0015723   -0.0049864&#xA;   -0.0056096   -0.0017098    0.0050592    0.0099256&#xA;    0.0080942   -0.0011323    -0.012505    -0.017267&#xA;   -0.0093558    0.0088501     0.025828     0.027239&#xA;    0.0063161    -0.028386    -0.054115    -0.045155&#xA;     0.011432      0.10497      0.20287      0.26531&#xA;      0.26531      0.20287      0.10497     0.011432&#xA;    -0.045155    -0.054115    -0.028386    0.0063161&#xA;     0.027239     0.025828    0.0088501   -0.0093558&#xA;    -0.017267    -0.012505   -0.0011323    0.0080942&#xA;    0.0099256    0.0050592   -0.0017098   -0.0056096&#xA;   -0.0049864   -0.0015723     0.001552    0.0057292&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, there are a bunch of potential problems: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In this case we simply lucked out that the number of coefficients for the new sample rate was 48 as well. In other cases you may have to adjust the stop band frequency to dial in the desired number of coefficients.&lt;/li&gt;&#xA;&lt;li&gt;This particular filter specification has been derived from the original sample rate, i.e. pass band and stop band are symmetrically spaced around the Nyquist frequency of 24 kHz. That is intentional. If your sample rate is different, you need to understand WHY it is different and whether the original specification is still appropriate. In the case of 44.1 kHz you may consider placing pass and stop band symmetrically around 22.050 kHz and maybe also consider lowering the pass band and/or increasing the number of coefficients.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastActivityDate="2012-12-28T19:01:53.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6352" PostTypeId="2" ParentId="6348" CreationDate="2012-12-28T21:21:55.860" Score="4" Body="&lt;p&gt;As per @JasonR's suggestion (but no longer succinct...., though&#xA;hopefully still correct...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error-control coding creates redundant symbols that are also transmitted&#xA;over the channel. A simple description of what happens is as follows.&#xA;The data symbols are divided into chunks of $k$ (data)&#xA;symbols and to each such chunk is appended a chunk of $n-k$&#xA;redundant symbols to create a &lt;em&gt;codeword&lt;/em&gt; of $n$ symbols. The&#xA;&lt;em&gt;rate&lt;/em&gt; of the code is $R = \frac{k}{n}$ since $n$ symbols must&#xA;be transmitted over the channel in order to get $k$ data symbols&#xA;across more reliably. The device that&#xA;creates and appends the redundant symbols is called an encoder.&#xA;Note that the encoder accepts $k$ symbols as input and spits&#xA;out $n &amp;gt; k$ symbols as output.  Now, it is possible for the encoder&#xA;to send the $n$ symbols to the transmitter for transmission using the&#xA;system and signaling design, modulation method that is already&#xA;set up. In this case, the channel signaling rate is not changed&#xA;at all and so the bandwidth remains the same. &lt;em&gt;However&lt;/em&gt;, &#xA;the codeword, consisting of $n$ symbols, takes longer &#xA;to transmit than the $k$ data symbols would have using the&#xA;same transmitter and channel that we have available.&#xA;There is also the issue of what happens to the &lt;em&gt;next&lt;/em&gt; chunk of&#xA;$k$ data symbols that are knocking at the encoder input while&#xA;the encoder is still busy sending the redundant symbols to&#xA;the transmitter.  So this scheme &lt;em&gt;can&lt;/em&gt; be implemented if&#xA;we don't really care about how long it takes to transmit&#xA;the data (which is presumed to be a finite-length file or&#xA;audio track (say) and not a (potentially) infinite never-ending&#xA;stream of data all of which needs to be delivered to the&#xA;receiver, and are willing to have lots of buffers&#xA;between the encoder and the transmitter to save the codewords&#xA;being generated until the transmitter gets around to transmitting&#xA;them.  We will also need buffers at the receiver where the&#xA;redundant symbols will be stripped off, and the data&#xA;symbols delivered to the destination in chunks of $k$&#xA;symbols followed by $n-k$ intervals of dead silence: buffering&#xA;can be used to save the $k$ symbol chunks and patch them&#xA;into a continuous stream of data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative, which most people opt for, is to &lt;em&gt;modify&lt;/em&gt;&#xA;the transmitter and receiver so that each channel symbol&#xA;takes less time (by a factor of $R$) to be transmitted,&#xA;so that the $n$ symbols of the codeword can be transmitted&#xA;in the same time that the $k$ data symbols would have been in&#xA;absence of error-control coding. The increase in the&#xA;signaling rate means that the transmitter output requires a&#xA;larger bandwidth (by a factor of $R^{-1}$) for transmission. &#xA;The channel thus must have larger bandwidth too, which can&#xA;create problems if wireless channels are being used.&#xA;Frequency bands are allotted by government agencies and if&#xA;your transmitter is already using the full spectrum allotted&#xA;to you, a Plan B and a complete re-design might be needed.&#xA;These systems with larger bandwidth &lt;em&gt;also&lt;/em&gt; need buffers&#xA;at the transmitting end as well as the receiving end,&#xA;but only two relatively small ones of $k$ symbols at both&#xA;ends. The two buffers precede the encoder and are used&#xA;in ping-pong fashion. The data source is reading in&#xA;$k$ symbols into one buffer, say one symbol every $T$&#xA;seconds, and thus taking a total of $kT$ seconds to fill&#xA;the buffer. During this time, the encoder reads out&#xA;the $k$ data symbols from the &lt;em&gt;other previously filled&lt;/em&gt; buffer&#xA;at a rate of one symbol every $RT$ seconds for a total&#xA;of $k(RT)$ seconds. The data symbols are also sent on to&#xA;the transmitter while the $n-k$ redundant symbols are created&#xA;within the encoder, which then spends the remaining&#xA;$kT-k(RT) = (n-k)(RT)$ seconds sending the $n-k$ redundant&#xA;symbols to the transmitter at a rate of one every $RT$&#xA;seconds.  At the end of a $kT$ second&#xA;period, the data source starts to fill the buffer just&#xA;emptied by the encoder, while the encoder starts to&#xA;accept data from the buffer just filled by the data&#xA;source. If you are still following all this, note&#xA;that the encoder and the transmitter are working &#xA;with a &lt;em&gt;clock&lt;/em&gt; that is running at a higher rate &#xA;(by a factor of $R^{-1}$) than&#xA;the clock of the data source, while the clock&#xA;signals to the buffers are alternately at the&#xA;low rate (when connected to data source) and&#xA;at high rate (when connected to encoder).&#xA;Similar things occur in reverse between the&#xA;receiver output and the data destination&#xA;but I will skip the details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third alternative, as pointed out by Bryan, &#xA;is to change the modulation format&#xA;on the channel so that, for example, instead of transmitting one channel bit&#xA;with each channel symbol (as in BPSK), you transmit more channel bits per&#xA;symbol (e.g. use QPSK to send two bits per channel symbol). In this case,&#xA;there need not be any increase in bandwidth (which is primarily determined&#xA;by the symbol rate (rate in baud)). A common use of the BPSK/QPSK usage&#xA;is the use of rate-$\frac{1}{2}$ convolutional coding which would double&#xA;the bandwidth if BPSK were used, but by switching to QPSK, the bandwidth &#xA;remains the same even when coding is used. However, as also noted by Bryan,&#xA;the transmitter and receiver become more complicated.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2012-12-29T16:12:42.840" LastActivityDate="2012-12-29T16:12:42.840" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6353" PostTypeId="1" CreationDate="2012-12-29T07:06:51.457" Score="4" ViewCount="2097" Body="&lt;p&gt;My goal is to build a real-time filter for EEG data. The data are being recorded in 512Hz and I wish to filter it (in a real-time, from 0.5Hz to 30Hz in the most optimal way). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I'm not expert in DSP stuff, so I'm not sure which type of filter I should use, an IIR or FIR? What is the recommended filter type &lt;code&gt;butter&lt;/code&gt;, &lt;code&gt;cheb1&lt;/code&gt;, or &lt;code&gt;cheb2&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I understand is there are some properties to set when designing a filter. Among of them are the transition band, the order of the filter, a group delay, Gibbs-effect, linear phase, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm really puzzled about these lists of properties. I also believe that some of the properties mentioned above are dependent on each other. I couldn't find any recipe that is &quot;easy to use &quot; on the web of how to build such a filter and what considerations should be made when building such filters.&lt;/p&gt;&#xA;" OwnerUserId="685" LastEditorUserId="76" LastEditDate="2012-12-29T15:48:07.953" LastActivityDate="2012-12-31T13:39:11.320" Title="Online filter for EEG" Tags="|filters|filter-design|real-time|bandpass|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6354" PostTypeId="2" ParentId="6319" CreationDate="2012-12-29T13:46:59.473" Score="1" Body="&lt;p&gt;I guess you ask how they &lt;em&gt;sound&lt;/em&gt; rather than how they look, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;color of the noise&quot; corresponds to the perception you would have from mixing different perfectly chromatic wavelengths: white if you cover all frequencies, pink when there is less blue (a smooth drop in high frequencies), brown (if the drop is even more sharp) and so on...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, the &quot;color of the your noise&quot; in the temporal domain should be put in analogy to natural sources of noises:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;drops of water are independent and there mixing tends to form white noise,&lt;/li&gt;&#xA;&lt;li&gt;the sound of hushing (&quot;shhh..&quot;) is basically white noise that would be filtered by your speech apparatus, so this comparable to pink noise,&lt;/li&gt;&#xA;&lt;li&gt;the diversity of colors can be perceived in music for instance&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2012-12-29T13:46:59.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6355" PostTypeId="2" ParentId="5992" CreationDate="2012-12-29T17:46:20.780" Score="39" Body="&lt;p&gt;Adapted from an answer to a different question (as mentioned in a comment) in the hope that this question will not get thrown up repeatedly by Community Wiki as one of the Top Questions....&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;There is no &amp;quot;flipping&amp;quot; of the impulse response by a linear&#xA;(time-invariant) system.&#xA;The output of a linear time-invariant system is&#xA;the sum of scaled and time-delayed versions of the&#xA;impulse response, &lt;strong&gt;not&lt;/strong&gt; the &amp;quot;flipped&amp;quot; impulse response.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;We break down the input signal &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; into a &lt;em&gt;sum&lt;/em&gt; of scaled&#xA;unit pulse signals. The system response to the unit pulse signal&#xA;&lt;span class=&quot;math-container&quot;&gt;$\cdots, ~0, ~0, ~1, ~0, ~0, \cdots$&lt;/span&gt; is&#xA;the &lt;em&gt;impulse response&lt;/em&gt; or &lt;em&gt;pulse response&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$h[0], ~h[1], \cdots, ~h[n], \cdots$$&lt;/span&gt;&#xA;and so by the scaling property &lt;em&gt;the single input value&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$x[0]$&lt;/span&gt;,&#xA;or, if you prefer&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x[0](\cdots, ~0, ~0, ~1, ~0,~ 0, \cdots)&#xA;=  \cdots ~0, ~0, ~x[0], ~0, ~0, \cdots$$&lt;/span&gt;&#xA;creates a response&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x[0]h[0], ~~x[0]h[1], \cdots, ~~x[0]h[n], \cdots$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly, the single input value &lt;span class=&quot;math-container&quot;&gt;$x[1]$&lt;/span&gt; or&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x[1](\cdots, ~0, ~0, ~0, ~1,~ 0, \cdots)&#xA;=  \cdots ~0, ~0, ~0, ~x[1], ~0, \cdots$$&lt;/span&gt;&#xA;creates a response&#xA;&lt;span class=&quot;math-container&quot;&gt;$$0, x[1]h[0], ~~x[1]h[1], \cdots, ~~x[1]h[n-1], x[1]h[n] \cdots$$&lt;/span&gt;&#xA;Notice the delay in the response to &lt;span class=&quot;math-container&quot;&gt;$x[1]$&lt;/span&gt;.  We can continue further&#xA;in this vein, but it is best to switch to a more tabular form&#xA;and show the various outputs aligned properly in time. We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{array}{l|l|l|l|l|l|l|l}&#xA;\text{time} \to &amp;amp; 0 &amp;amp;1 &amp;amp;2 &amp;amp; \cdots &amp;amp; n &amp;amp; n+1 &amp;amp; \cdots \\&#xA;\hline&#xA;x[0] &amp;amp; x[0]h[0] &amp;amp;x[0]h[1] &amp;amp;x[0]h[2] &amp;amp; \cdots &amp;amp;x[0]h[n] &amp;amp; x[0]h[n+1] &amp;amp; \cdots\\&#xA;\hline&#xA;x[1] &amp;amp; 0 &amp;amp; x[1]h[0] &amp;amp;x[1]h[1] &amp;amp; \cdots &amp;amp;x[1]h[n-1] &amp;amp; x[1]h[n] &amp;amp; \cdots\\&#xA;\hline&#xA;x[2] &amp;amp; 0 &amp;amp; 0 &amp;amp;x[2]h[0] &amp;amp; \cdots &amp;amp;x[2]h[n-2] &amp;amp; x[2]h[n-1] &amp;amp; \cdots\\&#xA;\hline&#xA;\vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \\&#xA;\hline&#xA;x[m] &amp;amp; 0 &amp;amp;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; x[m]h[n-m] &amp;amp; x[m]h[n-m+1] &amp;amp; \cdots \\&#xA;\hline &#xA;\vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \ddots  &#xA;\end{array}$$&lt;/span&gt;&#xA;&lt;em&gt;The rows in the above array are precisely the scaled and&#xA;delayed versions of the impulse response that add up to&#xA;the response &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; to input signal &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/em&gt;&#xA;But if you ask a more specific question such as&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What is the output at time &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;then you can get the answer by summing the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-th column to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}&#xA;y[n] &amp;amp;= x[0]h[n] + x[1]h[n-1] + x[2]h[n-2] + \cdots + x[m]h[n-m] + \cdots\\&#xA;&amp;amp;= \sum_{m=0}^{\infty} x[m]h[n-m],&#xA;\end{align*}$$&lt;/span&gt;&#xA;the beloved convolution formula that befuddles generations of students&#xA;because the impulse response seems to be &amp;quot;flipped over&amp;quot;&#xA;or running backwards in time. But, what people seem to forget&#xA;is that instead we could have written&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}&#xA;y[n] &amp;amp;= x[n]h[0] + x[n-1]h[1] + x[n-2]h[2] + \cdots + x[0]h[n] + \cdots\\&#xA;&amp;amp;= \sum_{m=0}^{\infty} x[n-m]h[m],&#xA;\end{align*}$$&lt;/span&gt;&#xA;so that it is the &lt;strong&gt;input&lt;/strong&gt; that seems &amp;quot;flipped over&amp;quot; or running&#xA;backwards in time!&#xA;In other words, it is &lt;em&gt;human&#xA;beings&lt;/em&gt; who flip the impulse response (or the input) over when computing&#xA;the response at time &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; using the convolution formula, but&#xA;the &lt;em&gt;system&lt;/em&gt; itself does nothing of the sort.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="63063" LastEditDate="2022-05-22T21:56:16.387" LastActivityDate="2022-05-22T21:56:16.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6356" PostTypeId="2" ParentId="6236" CreationDate="2012-12-29T20:29:27.830" Score="1" Body="&lt;p&gt;I don't personally know of a good one to vouch for, but on face-rec.org/databases/&#xA;at least, isn't the &quot;GavabDB: face database&quot; free?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see:&#xA;&lt;a href=&quot;http://gavab.escet.urjc.es/recursos_en.html&quot; rel=&quot;nofollow&quot;&gt;http://gavab.escet.urjc.es/recursos_en.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has 3 (apparently free) downloads:&#xA;Brief description: GavabDB is a 3D face database. It contains 549 three-dimensional images of facial surfaces. These meshes correspond to 61 different individuals (45 male and 16 female) having 9 images for each person. The total of the individuals are Caucasian and their age is between 18 and 40 years old. Each image is given by a mesh of connected 3D points of the facial surface without texture. The database provides systematic variations with respect to the pose and the facial expression. In particular, the 9 images corresponding to each individual are: 2 frontal views with neutral expression, 2 x-rotated views (±30º, looking up and looking down respectively) with neutral expression, 2 y-rotated views (±90º, left and right profiles respectively) with neutral expression and 3 frontal gesture images (laugh, smile and a random gesture chosen by the user, respectively). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note:&#xA;Those publications that use this signature date must reference the following work: A.B. Moreno y A.Sanchez. GavabDB: A 3D Face Database. Proc. 2nd COST Workshop on Biometrics on the Internet: Fundamentals, Advances and Applications, C. Garcia et al (eds): Proc. 2nd COST Workshop on Biometrics on the Internet: Fundamentals, Advances and Applications, Ed. Univ. Vigo, pp. 77-82, 2004&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Readme.rtf (9 kB; .rtf)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CD1_faces1-20.zip (38 MB; .zip)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CD2_faces21-40.zip (39 MB; .zip)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CD3_faces41-61.zip (38 MB; .zip)&lt;/p&gt;&#xA;" OwnerUserId="3492" LastActivityDate="2012-12-29T20:29:27.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6357" PostTypeId="2" ParentId="6236" CreationDate="2012-12-29T20:31:38.860" Score="1" Body="&lt;p&gt;BTW, in case you are interested in applying face algos to general objects, &#xA;Berkeley has 3-D Object Dataset:&#xA;&lt;a href=&quot;http://kinectdata.com/&quot; rel=&quot;nofollow&quot;&gt;http://kinectdata.com/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3492" LastActivityDate="2012-12-29T20:31:38.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6358" PostTypeId="2" ParentId="6329" CreationDate="2012-12-29T23:19:26.697" Score="1" Body="&lt;p&gt;&lt;strong&gt;Nonuniform Sampling&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you know what the actual sampling rate is, and exactly which samples are missed, it is possible to reconstruct the signal over a time interval T as long as the bandwidth W of the signal still satisfies the Nyquist criterion: W &amp;lt; N/T/2, where N is the number of samples you do have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Visualize it this way:&#xA;A signal of bandwidth W over a time interval T can be decomposed into a&#xA;linear combination of N sinc functions (sinc is shorthand for sin x/x),&#xA;where N&amp;nbsp;=&amp;nbsp;2&amp;times;W&amp;times;T.&#xA;The sinc functions are equally spaced over the interval in question and&#xA;their widths are all the same.&#xA;At the instant where each sinc pulse reaches its peak, all of the other&#xA;sinc functions have a value of zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zs9PX.gif&quot; alt=&quot;Figure 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sample the signal at the instants corresponding to the peaks of&#xA;the sinc functions (t&lt;sub&gt;A0&lt;/sub&gt;, t&lt;sub&gt;A1&lt;/sub&gt; and t&lt;sub&gt;A2&lt;/sub&gt;),&#xA;each sample directly yields the amplitude of the corresponding sinc pulse&#xA;(A0, A1 and A2).&#xA;The original signal can be reconstructed by creating new sinc pulses of the&#xA;correct amplitudes and overlaying them, usually by using a digital or&#xA;analog filter with the correct brick-wall frequency response.&#xA;The reconstructed signal will be described by the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal(t) = A0 sinc (t &amp;#150; t&lt;sub&gt;A0&lt;/sub&gt;)&#xA;     + A1 sinc (t &amp;#150; t&lt;sub&gt;A1&lt;/sub&gt;)&#xA;     + A2 sinc (t &amp;#150; t&lt;sub&gt;A2&lt;/sub&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take N samples of the signal at other instants, each sample will be&#xA;a linear combination of all of the sinc functions.&#xA;Each sinc pulse will contribute an amount to the sample based on the&#xA;time interval between the sample and the center of the sinc pulse.&#xA;It is still possible to calculate the amplitudes of the sinc pulses, but&#xA;now it is necessary to solve a solve a system of linear equations in order&#xA;to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aeGu6.gif&quot; alt=&quot;Figure 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have samples B1, B2 and B3 taken at times t&lt;sub&gt;B1&lt;/sub&gt;,&#xA;t&lt;sub&gt;B2&lt;/sub&gt; and t&lt;sub&gt;B3&lt;/sub&gt; as shown above, you can write the&#xA;following equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B1 = A0 sinc (t&lt;sub&gt;B1&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A0&lt;/sub&gt;)&#xA;     + A1 sinc (t&lt;sub&gt;B1&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A1&lt;/sub&gt;)&#xA;     + A2 sinc (t&lt;sub&gt;B1&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A2&lt;/sub&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B2 = A0 sinc (t&lt;sub&gt;B2&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A0&lt;/sub&gt;)&#xA;     + A1 sinc (t&lt;sub&gt;B2&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A1&lt;/sub&gt;)&#xA;     + A2 sinc (t&lt;sub&gt;B2&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A2&lt;/sub&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B3 = A0 sinc (t&lt;sub&gt;B3&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A0&lt;/sub&gt;)&#xA;     + A1 sinc (t&lt;sub&gt;B3&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A1&lt;/sub&gt;)&#xA;     + A2 sinc (t&lt;sub&gt;B3&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A2&lt;/sub&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that you know B1, B2 and B3, and all of the time values, it's a&#xA;straightforward matter to solve this system for A0, A1 and A2.&#xA;Once you have these coefficients, you can plug them into the reconstruction&#xA;equation given previously to reconstruct the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the above explanation, I have implicitly assumed that the&#xA;uniform sampling interval (t&lt;sub&gt;A1&lt;/sub&gt; &amp;#150; t&lt;sub&gt;A0&lt;/sub&gt;) equals&#xA;&amp;pi;, in order to simplify the diagrams and&#xA;equations.&#xA;The same argument holds for other sampling intervals (and bandwidths) as&#xA;well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Averaging Multiple Periods&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using multiple periods of the signal to improve the reconstruction requires that you can precisely correlate those periods in the time tomain. Once you have done the reconstruction described above, it should be possible to precisely locate features such as peaks and zero-crossings, even if these features fall between samples. Use this information to time-align multiple periods so that they can be averaged together to reduce errors such as noise, quantization error or timing jitter.&lt;/p&gt;&#xA;" OwnerUserId="1996" LastActivityDate="2012-12-29T23:19:26.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6359" PostTypeId="2" ParentId="6194" CreationDate="2012-12-30T03:33:31.090" Score="1" Body="&lt;p&gt;I have not given it much thought, but I'm pretty sure a robust solution can be had without much trouble using classic Fourier Descriptors (FD).  I think your problem might be a very good candidate for that.  Don't think you need to do edge detection b/c you have black line drawings.  Just start raster scanning until you hit any pixels, then do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just treat your room perimeters as if they were a 1D signal, where the signal amplitude is the normal distance from the centroid of the object, sampled at some steady rate.  So, do a simple FD model for the door.  Then, scan each room's parameter with a sort of convex filter looking for a rising edge, a peak, and fall, which sets a start/stop window of &quot;signal&quot; to capture.  Do a FFT or similar FD algo on that captured &quot;signal&quot; and compare against the FD template.  Maybe the template compare step can be a simple correlation with a threshold to trigger a match.  Since only your doors have round edges that should be a pretty easy FD matching problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of it like using FD's doing image or music retrieval from a database.  Lots of white papers on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://royalgarter-lifetime-projects.googlecode.com/svn/Ebook/Digital%20Image%20Processing/fourier_analysis.pdf&quot; rel=&quot;nofollow&quot;&gt;This is a good tutorial on using FDs to approximate shapes:&lt;/a&gt;&#xA;I doubt you'll need it, but you can also first transform your images to a polar coordinate framework to deal with rotations, like proposed in this paper:&#xA;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.63.6312&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Shape-based image retrieval using generic Fourier descriptor&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see how they FD parameterize the apple perimeter detection?  Same idea like your door.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, I'm pretty sure mapping the whole schematic to polar coordinates won't help rotational invariance- you would need to do that about the centroid of each door, which is exactly what your problem is to begin with.  That is why I think you want to just capture door candidates, and maybe map those to polar coordinates to match with the FD door template, like done in that paper linked above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let me know how it goes if you try this approach.&lt;/p&gt;&#xA;" OwnerUserId="3492" LastEditorUserId="3492" LastEditDate="2012-12-30T03:41:36.633" LastActivityDate="2012-12-30T03:41:36.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6360" PostTypeId="2" ParentId="4695" CreationDate="2012-12-30T04:51:16.660" Score="2" Body="&lt;p&gt;why use OCR techniques that are sensitive to vanishing points?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;projective distortion just skews the letters- right?  So, why not just model those expected skews into the OCR templates for each letter?  Also, the nearby letters would skew similarly, so you could probably use correlated parallel lines among neighboring letters to estimate the amount of local/global skew (and avoid dealing with VPs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;also, I assume you mean the phone will take a pic of the document, so don't you also have to worry about the paper not being flat and having curve linear distortions too, which seems to me would completely confound, and supersede any vanishing point issue you are worried about. &lt;/p&gt;&#xA;" OwnerUserId="3492" LastActivityDate="2012-12-30T04:51:16.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6362" PostTypeId="1" AcceptedAnswerId="6363" CreationDate="2012-12-30T23:39:17.520" Score="4" ViewCount="2454" Body="&lt;p&gt;I have an image with arbitrary area (the boundary is shown in gray):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0jMvC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I would like to blur just the image within boundaries.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ordinary blur causes the background proliferating to image and vice versa. This results in dark areas near boundaries of the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kthla.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2012-12-31T00:04:55.827" Title="Blurring Non-Uniform Areas" Tags="|image-processing|filters|blur|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6363" PostTypeId="2" ParentId="6362" CreationDate="2012-12-31T00:04:55.827" Score="4" Body="&lt;p&gt;One simple solution would be to create a binary (0/255) mask of the area you want to blur. Then blur the source image BITWISE AND mask, blur the mask with the same filter and divide them. As pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(filter(source &amp;amp; mask) / filter(mask)) &amp;amp; mask&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="291" LastActivityDate="2012-12-31T00:04:55.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6364" PostTypeId="1" CreationDate="2012-12-31T01:00:26.500" Score="4" ViewCount="3216" Body="&lt;p&gt;Why does oversampling make the job of an anti-alias filter easier? I don't understand the intuition on why it becomes helpful. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isn't it economical to just keep the sampling rate at the minimal level, that is twice the highest frequency of the signal, in that way, we can save energy, and processing and computational power.&lt;/p&gt;&#xA;" OwnerUserId="3512" LastEditorUserId="76" LastEditDate="2012-12-31T02:15:57.637" LastActivityDate="2012-12-31T04:09:44.997" Title="Why is oversampling helpful to an anti-alias filter?" Tags="|frequency|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6366" PostTypeId="2" ParentId="6364" CreationDate="2012-12-31T02:03:19.273" Score="8" Body="&lt;p&gt;You might remember Nyquist's theorem. Given a signal which is band limited to $f_1$, we must sample it at least at $2f_1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_S&amp;gt;2f_1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you check you favourite Signals and Systems book (e.g. Oppenheim's), you might recall that, once sampled, we can consider the signal's discrete Spectrum (which is periodic every $2\pi$ radians, by the way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kGuGs.gif&quot; alt=&quot;https://i.stack.imgur.com/17H8i.gif&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In the image, Hz are considered instead of radians, being a 2*pi scale factor the only difference)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, we would go back to continuous time by low pass filtering with $f_{cutoff}=f_S/2$. So let's look into a few cases:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if $f_S&amp;lt;f_1$, the original spectrum and the subsequent replicas would overlap ($f_1&amp;gt;f_S-f_1$). This would result in distortion over the original signal after the low pass filter. This is the so called aliasing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if $f_S&amp;gt;f_1$, as in the image, there is no overlapping, and therefore no aliasing. Furthermore, we can recover the original signal by applying a low pass filter. Fortunately, we don't need the sharpest transition band in our filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fK6ey.jpg&quot; alt=&quot;https://i.stack.imgur.com/jOpSh.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(please excuse my lack of accuracy here, the filter would also be periodic as we still are in discrete frequency domain. Also, please take into account that 3 dB cutoff should be on $f_S/2$)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Last, imagine how this would be if we adjusted $f_S=f_1$. Both spectra would converge at $f_S=f_1$, so we would need an ideal (infinite slope) filter to recover the undistorted original signal. Ideal is no good, you know.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, let's think about those LP filters. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/Xc7PM.png&quot; alt=&quot;https://i.stack.imgur.com/B7U04.png&quot;&gt; (wikipedia)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wider the transition band is, the flatter the pass band is. On the other hand, the pass band is curlier when the transition band is tighter. Non-flat frequency response means distortion. Don't forget that the signal that we are &quot;deleting&quot; in the stop band would produce distortion, both in the anti-alias and the D/A filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we want to keep the sampling frequency as low as possible, while not distorting the signal, either by the filter ripple or by aliasing. But, on the other hand, we want to keep the filter as cheap and accurate as possible. By allowing a wider transition band, we avoid the need of incrementing the order of the filters, i.e., the number of filter coefficients (in the D/A filter) or of electronic devices (in the anti-alias). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we confront a cost/distortion trade-off, in which it seems preferable to increase sampling rate (e.g. CD audio is sampled at 44.1 kHz while we hear no more than 20 kHz), so we can keep reasonable distortion and avoid huge order filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take into account that increasing filter's order also leads to an increment in number of operations, although it is less than the one produced by increasing sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filter terminology here, just in case: &lt;a href=&quot;http://www.dspguru.com/dsp/reference/filter-terminology&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dspguru.com/dsp/reference/filter-terminology&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1771" LastEditorUserId="76" LastEditDate="2012-12-31T04:09:44.997" LastActivityDate="2012-12-31T04:09:44.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6367" PostTypeId="1" CreationDate="2012-12-31T08:28:43.973" Score="5" ViewCount="291" Body="&lt;p&gt;I hope this is not off-topic for this site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my problem, Viterbi decoder is used for decoding convolutional-coded (rate = 1/2, constraint length = 7) messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A message is 250 bits where the first 8 bits are 1/3 of a preamble. There are several types of messages. A message is received as 500 bits because of the coding, which means, the preamble is also coded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there is no place marker other than the coded preamble, I am in trouble with finding the first bit of the 500 bits to start decoding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate any suggestions and comments.&lt;/p&gt;&#xA;" OwnerUserId="2024" LastActivityDate="2013-01-01T23:28:22.160" Title="Viterbi decoder on a bit stream where the preamble is also coded" Tags="|channelcoding|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6370" PostTypeId="1" AcceptedAnswerId="6373" CreationDate="2012-12-31T13:00:32.450" Score="4" ViewCount="437" Body="&lt;p&gt;I need to produce a signal which contains only several frequencies, for example, &lt;em&gt;17KHz, 17.2 kHz,17.6 kHz.&lt;/em&gt; The components I'm using are microcontroller (PIC16F1783 by microchip) which works at &lt;em&gt;80 kHz&lt;/em&gt; frequency, and produces an analog signal, which is then fed into an audio amplifier and then into a speaker. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I'm trying to output a single frequency, say 17 kHz. under timing and low memory constraints my algorithm is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I have an array of 400 elements which contains samples of a sine wave at constant intervals&lt;/li&gt;&#xA;&lt;li&gt;Every clock cycle(80,000^-1 sec) I output &lt;strong&gt;sine_array[index]&lt;/strong&gt; to the audio amplifier (and then to the speaker) where index starts at 0 and increased each cycle by: (17,000/80,000)*400=85. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, for some reason, besides seeing the pure 17 kHz frequency, I also hear (and see on the oscilloscope) parasitic 5 kHz frequency!&#xA;I've also noticed that for frequencies such as 16 kHz (index increased by 80), 8 kHz there are no parasitic frequencies.&lt;br&gt;&#xA;So I though it may have something to do with the fact that 400/80 is an integer, whereas 400/85 isn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please suggest a creative way to sort this issue? The final goal is, as stated, to produce a signal which is composed of several frequencies with a rather small difference (around 200 Hz).&lt;/p&gt;&#xA;" OwnerUserId="3514" LastEditorUserId="76" LastEditDate="2013-01-01T10:33:59.253" LastActivityDate="2013-06-12T14:37:26.573" Title="Sum of sines sound wave using microcontroller" Tags="|audio|discrete-signals|signal-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6371" PostTypeId="2" ParentId="6353" CreationDate="2012-12-31T13:39:11.320" Score="3" Body="&lt;p&gt;I'll try to guide your research a bit rather than giving you a direct answer. One-click recipes aren't too good for obtaining optimal results, and this requires some careful insight. After all, you are dealing with biological signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To develop a real-time filter you need to process each sample/&lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window&lt;/a&gt; before the next one comes up. You need to take into account the CPU time available for your calculations (depending on the platform) and the number of signals you must filter at once (with the subsequent impact in used memory, of course). After all, a digital filter is &lt;em&gt;no more&lt;/em&gt; than a bunch of sums and products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you should study the kind of signal you need to filter. You seem to be handling frequencies from delta to beta waves. You need an insight in the characteristics of each signal so that you keep them after the filtering (e.g. if studying brain activity during sleep, you should make sure that you don't miss out k-complexes and spindles during Phase II). This way you can look into some values: the maximum band pass ripple you are allowed, the width of the transition band, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having this information, after some research (e.g. &lt;em&gt;Digital filter design&lt;/em&gt; by Burrus &amp;amp; Parks; &lt;em&gt;Discrete-time signal processing&lt;/em&gt; by Oppenheim &amp;amp; Schafer) you can choose the kind of filter you need, and go into further details about implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, with a simple google query you can find out lots of things. There are Matlab toolboxes available to aid your filter design:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.es/products/signal/examples.html?file=/products/demos/shipping/signal/introfdatooldemo.html&quot; rel=&quot;nofollow&quot;&gt;FDATool&lt;/a&gt;, Matlab filter design toolbox.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;you can also take a look on &lt;a href=&quot;http://erpinfo.org/erplab/erplab-documentation/tutorial/Filtering.html&quot; rel=&quot;nofollow&quot;&gt;ERPLab&lt;/a&gt;, which seems a good starting point. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And lots of free papers: &lt;a href=&quot;https://www.google.com/webhp?sourceid=chrome-instant&amp;amp;ie=UTF-8#hl=en&amp;amp;safe=off&amp;amp;tbo=d&amp;amp;output=search&amp;amp;sclient=psy-ab&amp;amp;q=eeg%20filtering&amp;amp;oq=&amp;amp;gs_l=&amp;amp;pbx=1&amp;amp;fp=f324b4352f85d59f&amp;amp;bpcl=40096503&amp;amp;bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&amp;amp;bvm=bv.1355534169,d.d2k&amp;amp;biw=1366&amp;amp;bih=682&quot; rel=&quot;nofollow&quot; title=&quot;Google Query&quot;&gt;Google query for &quot;EEG filtering&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The higher the order of the filter, the more accurate it is, but the more operations per second it needs. So the main constraint here is that you need to keep it real-time for a bunch of signals.&lt;/p&gt;&#xA;" OwnerUserId="1771" LastActivityDate="2012-12-31T13:39:11.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6372" PostTypeId="1" AcceptedAnswerId="6390" CreationDate="2012-12-31T15:01:35.247" Score="6" ViewCount="19576" Body="&lt;p&gt;How can I use interpolation with an FIR filter? I am more familiar with interpolation such as nearest distance interpolation, linear interpolation and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose a signal is given as the following series:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    time=    1 2 3 4 5 6 7 8&#xA;    signal=[ 1 1 2 2 3 2 7 6]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, if I ask what's the signal value at time 2, we can see &lt;code&gt;signal[2] = 1&lt;/code&gt;; then how about the signal value at time 2.1? With a linear interpolation method, I can tell &lt;code&gt;signal[2.1] = 0.9*1+0.1*2 = 1.1&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, how could I know the corresponding FIR filter? How could I use the filter to obtain the signal value?&lt;/p&gt;&#xA;" OwnerUserId="1674" LastEditorUserId="76" LastEditDate="2013-01-01T22:23:32.820" LastActivityDate="2016-03-31T12:47:24.157" Title="Interpolation with an FIR filter" Tags="|filters|interpolation|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6373" PostTypeId="2" ParentId="6370" CreationDate="2012-12-31T15:57:52.800" Score="8" Body="&lt;p&gt;To explain the problem (without solving it):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, for some reason, besides seeing the pure 17KHz frequency, I also hear (and see on the oscilloscope) parasitic 5KHz frequency! &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your sampling rate is 80 kHz, so the Nyquist frequency is 40 kHz.  Your generation method produces a distorted sine wave at 17 kHz, which produces harmonics at:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;17×2 = 34 kHz&lt;/li&gt;&#xA;&lt;li&gt;17×3 = 51 kHz&lt;/li&gt;&#xA;&lt;li&gt;17×4 = 68 kHz&lt;/li&gt;&#xA;&lt;li&gt;17×5 = 85 kHz&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But everything above 40 kHz gets aliased, so &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;51 kHz becomes 40-(51-40) = 29 kHz&lt;/li&gt;&#xA;&lt;li&gt;68 kHz becomes 40-(68-40) = 12 kHz&lt;/li&gt;&#xA;&lt;li&gt;85 kHz becomes 40-(85-40) = -5 kHz, which then aliases off 0 Hz and becomes &lt;strong&gt;5 kHz&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I've also noticed that for frequencies such as 16KHz (index increased by 80) ,8KHz there are no parasitic frequencies.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now you've got harmonics at 32, 48, 64, 80, ...  These alias to 32 kHz, 32 kHz, 16 kHz, 0 kHz, etc.  So they aren't as obvious, but they're still there unless your wavetable is lining up perfectly with the samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at your output using an FFT analyzer, you should be able to see these aliased harmonics more clearly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SjCGA.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.music.mcgill.ca/~gary/307/week4/wavetables.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.music.mcgill.ca/~gary/307/week4/wavetables.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-06-12T14:37:26.573" LastActivityDate="2013-06-12T14:37:26.573" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6374" PostTypeId="2" ParentId="6372" CreationDate="2012-12-31T16:06:56.017" Score="3" Body="&lt;p&gt;Linear interpolation is suboptimal, as you may know. You understand it in time-domain, but let's look into it in frequency-domain. The sampled signal spectrum would be periodic with period $\omega=2\pi$ (f=1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kGuGs.gif&quot; alt=&quot;https://i.stack.imgur.com/17H8i.gif&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, we could use an ideal low pass filter with cutoff frequency at $f_S/2$ Don't forget that, although not in the picture, negative frequencies are defined. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hKKrE.png&quot; alt=&quot;http://i.imgur.com/3iHH7.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may recall that an ideal frequency response means a &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;sinc&lt;/a&gt; kind of time-domain impulse response. That means we would need infinite filter coefficients: every sample needs to know about every past and future sample. So why not try something simpler?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That would be, for example, linear interpolation. The linear time-domain response you use resembles a triangular signal, which could also be seen as a sinc in frequency-domain &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(j\omega)=1 / T · (sin (\omega T /2)/ (\omega/2))^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(please check Oppenheim's Signals and systems, section 7.2 for good graphs and a really deep and awesome explanation, you won't have trouble to find it in the net. Discrete time signal processing also includes this matter.)&#xA;Really inaccurately, this filter would look like:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/bRgdi.png&quot; alt=&quot;http://i.imgur.com/18Kvn.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, our filter is worse than the ideal (obviously), but now we have a finite time-domain response (a.k.a. FIR filter). This is the way that the time-domain operations you were doing relate to frequency-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info concerning how to apply the filter, I advise to check the mentioned books. If you define a filter in time-domain (h[n]) you can apply it using convolution, while if defined in frequency-domain (H(jw)) you can compute the output spectrum as the product of the input and the freq. response.&lt;/p&gt;&#xA;" OwnerUserId="1771" LastActivityDate="2012-12-31T16:06:56.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6375" PostTypeId="2" ParentId="6347" CreationDate="2012-12-31T17:10:29.723" Score="2" Body="&lt;p&gt;I would approximate the filter using an finite impulse design where the wrights of the FIR filter are computed based on the spectrum that the filter passes.  You can do this by choosing samples of the desired frequency response (from the graphs above) and taking the inverse discrete Fourier transform of the samples.  The result will be the impulse response of the desired filter.  The filter is then realized as a weighted sum using the impulse response sample values as the weights.  So your filter will be $A_0 + A_1Z^{-1} + A_2Z^{-2}...$  Where $A_0$ is the first value of the impulse response, $A_1$ is the second and so on.  $Z^{-n}$ represents a sample delay of n (coming from a Z domain representation of the filter structure).  This approach is sometimes referred to as the &quot;frequency sampling&quot; approach to FIR filter design.  I have used this approach to create time sequences that contain specific spectral content.  Google FIR filter design, frequency sampling.&lt;/p&gt;&#xA;" OwnerUserId="3517" LastEditorUserId="76" LastEditDate="2013-01-01T10:34:13.357" LastActivityDate="2013-01-01T10:34:13.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6376" PostTypeId="1" CreationDate="2012-12-31T08:13:38.287" Score="4" ViewCount="7924" Body="&lt;p&gt;I am working on finding the distance between a camera and an object using image processing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many places, it's written that we have to use a stereo pair, but my project allows only one camera.  Is it feasible to find distance to an object using just one camera? If so, what are the possible ways to do this?&lt;/p&gt;&#xA;" OwnerUserId="3535" OwnerDisplayName="swapna" LastActivityDate="2018-02-13T07:49:43.127" Title="Is it always necessary to use two cameras to find the distance between camera and object?" Tags="|matlab|image-processing|geometry|" AnswerCount="7" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6377" PostTypeId="2" ParentId="6376" CreationDate="2012-12-31T08:23:34.463" Score="0" Body="&lt;p&gt;Take a look at this &lt;a href=&quot;http://pages.cs.wisc.edu/~cs766-1/syllabus/10-07-svm/Criminisi_ijcv2001.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;.&#xA;You can calculate lengths using a reference object in the image. If you don't have a reference object then I think it is not possible by the way the images are taken today. Cameras today have a point of view. If you could invent a camera that captures plane of view you can use it for getting distances but the image probably will not be discernible to human eyes as human eyes use a point of view as well. So for today you need at least a pair of calibrated cameras or a pair of images from the same camera with the camera moved a little bit.  That's the reason we have 2 eyes instead of 1.  &lt;/p&gt;&#xA;" OwnerUserId="743" OwnerDisplayName="Aashish Thite" LastActivityDate="2012-12-31T08:23:34.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6378" PostTypeId="2" ParentId="6376" CreationDate="2012-12-31T08:25:39.573" Score="1" Body="&lt;p&gt;The advantage of using two cameras is that you can easily calculate the distance to an arbitrary object, without knowing anything about your surroundings..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only have one camera it becomes alot more difficult to calculate distance to a random point in the image..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you for example close one of your eyes you will notice that it gets much more difficult to tell how far away something really is. But you still have a general idea of the distance because you can see objects that you recognize and know how big they really are based on experience and can thus guesstimate a distance to them based on how big they appear to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only have one camera this is something you have to duplicate for your robot. Now creating a database of all known objects and making your robot recognize them is probably a little to big of a task.. but you could for example make the robot recognize a bright orange ball and based on how many pixels the ball occupies in your image guess a fairly accurate distance to it..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can however move the camera and know the distance the cameras has moved you can pretend you have two cameras by taking multiple pictures at known distances and comparing them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is if you can get a laser pointer mounted at a bit of an offset to the camera and then calculating the distance using simple trigonometry.&#xA;&lt;a href=&quot;https://sites.google.com/site/todddanko/home/webcam_laser_ranger&quot; rel=&quot;nofollow&quot;&gt;https://sites.google.com/site/todddanko/home/webcam_laser_ranger&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="Jens Berfenfeldt" LastActivityDate="2012-12-31T10:33:17.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6379" PostTypeId="2" ParentId="6376" CreationDate="2012-12-31T08:32:44.300" Score="1" Body="&lt;p&gt;Based on the comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ya i can move camera and scene is fixed&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;You can take one snapshot, move the camera sideways (or orbit the scene) and take another snapshot. This becomes your stereo pair.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This won't work if the scene isn't fixed&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will work to a great extent if the camera is moving much faster than the scene. This will also work somewhat (with large errors but mostly preserving the distance ordering) if the camera is moving at a comparable speed as the scene. &lt;/p&gt;&#xA;" OwnerUserId="3518" OwnerDisplayName="Jan Dvorak" LastActivityDate="2012-12-31T08:32:44.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6380" PostTypeId="2" ParentId="6376" CreationDate="2012-12-31T08:49:49.500" Score="1" Body="&lt;p&gt;If you know the width of the object, and the transformation the camera applies, you could calculate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe the quick and dirty drawing below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VEAJs.png&quot; alt=&quot;Quick and dirty drawing&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weird thing on the left is the camera, the other thing on the right is the object you want to measure the width (or height, ...) of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The camera applies a simple transformation on the scene: it shrinks (by estimation). There can be other transformations as well (wide-angle lenses and such), but I'll leave those out of the picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to know how much the camera shrinks, you need a reference object. That's saying: you need an object in the picture, of which you know both the width and the distance to the camera. Let's name those &lt;code&gt;w1&lt;/code&gt; and &lt;code&gt;d1&lt;/code&gt;. You can measure the width on the picture, that's &lt;code&gt;w1'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now one more assumption: The objects should be close to each other. The objects transform more to the sides of the image, and we want them to transform in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, another quick and dirty drawing, zoomed in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VEx9Q.png&quot; alt=&quot;Quick and dirty drawing #2&quot;&gt;&#xA;(&lt;code&gt;E&lt;/code&gt; is inside the camera, &lt;code&gt;DC&lt;/code&gt; is the picture, &lt;code&gt;AB&lt;/code&gt; is an object in the scene)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, we can see a &lt;a href=&quot;http://en.wikipedia.org/wiki/Thales&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Thales&quot;&gt;Thales' Theorem&lt;/a&gt; forming. According to Thales, &lt;code&gt;w1/w1' = EB/EC&lt;/code&gt;, therefore &lt;code&gt;w1/w1' = (d1+EC)/EC&lt;/code&gt;. We calculate &lt;code&gt;EC&lt;/code&gt; (which is why we need the reference object): &lt;code&gt;EC = d1 / (w1/w1' - 1)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same can be done for the measured object (same naming conventions, but with number 2): &lt;code&gt;w2/w2' = EB/EC&lt;/code&gt;. Therefore, &lt;code&gt;w2 = w2' * (d2 + EC) / EC&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if the two objects are close to each other on the picture, you can use the &lt;code&gt;EC&lt;/code&gt; we calculated with the reference object for the measured object. It's an approximation, though. It is only exact when there's an common edge.&lt;/p&gt;&#xA;" OwnerDisplayName="Noctua" LastActivityDate="2012-12-31T10:39:17.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6381" PostTypeId="2" ParentId="6376" CreationDate="2012-12-31T09:00:50.530" Score="8" Body="&lt;p&gt;There are various ways to measure distance and 3D using a single camera.&#xA;These include:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Moving the camera and taking another image - this simulates a 2 camera system.&lt;/li&gt;&#xA;&lt;li&gt;If you are imaging an object of a known size, then you can know the distance with some simple trigonometry.&lt;/li&gt;&#xA;&lt;li&gt;You can project a known pattern from a known projector location to reconstruct 3D. This is &lt;a href=&quot;http://en.wikipedia.org/wiki/Structured_light&quot; rel=&quot;nofollow noreferrer&quot;&gt;structured light&lt;/a&gt; and e.g. how Kinect works. Obviously the image(s) with the pattern will appear different from the normal image, so multiple exposures might be neccesary if you also want the appearance image.&lt;/li&gt;&#xA;&lt;li&gt;You can use &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/FAVARO1/dfdtutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Depth-from-Defocus&lt;/a&gt; by capturing multiple images at multiple focii.&lt;/li&gt;&#xA;&lt;li&gt;Sometimes an auto-focus lens can provide rough estimates on the depth of the object in focus. If the object is big enough in the frame this may be sufficient for some applications.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Each method has different trade-offs. You must consider which one suits your app.&lt;/p&gt;&#xA;" OwnerUserId="163" OwnerDisplayName="Adi Shavit" LastEditorUserId="163" LastEditDate="2018-02-13T07:49:43.127" LastActivityDate="2018-02-13T07:49:43.127" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6382" PostTypeId="2" ParentId="6370" CreationDate="2012-12-31T17:46:46.693" Score="1" Body="&lt;p&gt;Based on the previous post (3) I can add the following.  You need to remove the distortion from your signal(s).  I can think of 2 possible approaches for this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) You will have to approximation your frequencies so you can get exact periods that line up with your sampling rate. This may not be satisfactory because you will have to use frequencies that repeat over some number of samples exactly.  I haven't tried to work out the numbers.  If this isn't true, you will end up with discontinuities in you signal causing distortion.  You can decrease the distortion by using longer tables to extend the signal past a single cycle.  The longer the table (more cycles) the less energy you will have produced by the discontinuity.  You can also choose the table length to minimize the discontinuity (the end of the table should line up as closely as possible with the start of the signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Generate the signals with the frequencies you want (as you tried) then filter the signal using a low pass filter with a sharp cut off just above the highest frequency of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can combine these two approaches to optimize your results.  You can find low pass filter algorithms by searching on &quot;discrete time low pass filter design&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a direct way to come up with a sequence that produces the desired frequencies.  Basically you define the frequencies you want and then take the inverse discrete Fourier transform of the frequency definition.  The result from taking the inverse discrete Fourier transform will be the table entries.  The accuracy of the defined frequencies will depend on the chosen length of your table.  The longer the table, the better the accuracy.  A table with 80000 entries will have an accuracy of 1Hz.  Longer tables will be required for the accuracy you want.  This looks impractical, but once you have the desired table, you can shorten it using a windowing function (tapering the table off to shorten it at both ends).  A tool to help with the math is highly recommended.&lt;/p&gt;&#xA;" OwnerUserId="3517" LastEditorUserId="3517" LastEditDate="2012-12-31T18:09:11.217" LastActivityDate="2012-12-31T18:09:11.217" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6383" PostTypeId="2" ParentId="6376" CreationDate="2013-01-01T06:48:20.713" Score="1" Body="&lt;p&gt;Stereo vision is the best way to get the depth map. However if you want to find coordinates of the end point and not the actual depth, monocular vision is possible. This is done by having knowledge of the environment or by using monocular cues like 'depth by defocus', variation in hue, saturation, obstruction in the image and so on. This might not provide the exact depth but it might give relative depth. From the relative depth, you will have to calculate the exact depth by using the known elements in the image( ex: say there is a human in the picture, you know the height of the human. From this, you will have to estimate the depth of the human i.e how far the human may be inside the image(i hope you get what I am saying here)). Prof. Andrew Ng and Ashutosh Saxena from Stanford University AI lab have worked on this idea. You may want to refer to those papers. They have fed a lot of depth maps and have modelled a system in such a manner that, given any image, a depth map can be obtained. I built a simpler version of the same idea for my helicopter.&lt;/p&gt;&#xA;" OwnerUserId="3520" LastActivityDate="2013-01-01T06:48:20.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6384" PostTypeId="2" ParentId="6346" CreationDate="2013-01-01T15:22:01.337" Score="2" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In case your filter is linear, this should be quite easy. You have a linear model with unknown parameters (9 if your support is 3x3, 16 if 4x4, etc...). You have a lot of constraints - the original image and result image. You can use linear least squares. If you can generate any input, it is even easier. Recall that a linear time-invariant system is fully determined by its response to delta impulse, which is its kernel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In case your filter is not linear (like Paul says), there is almost nothing that you can do to find it out, except using your common sense, or attempting to optimize another model, given your inputs and outputs. Image processing logic can be very non-linear, including ad-hoc solutions, so it looks quite hard to me.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2013-01-01T19:44:12.080" LastActivityDate="2013-01-01T19:44:12.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6385" PostTypeId="2" ParentId="6346" CreationDate="2013-01-01T16:37:32.570" Score="2" Body="&lt;p&gt;If you have a &quot;black box&quot; filter, you can gain more knowledge about it by providing sets of synthetic images and then inspect changes in some of the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;spatial domain&lt;/li&gt;&#xA;&lt;li&gt;frequency domain&lt;/li&gt;&#xA;&lt;li&gt;gradient domain and edges&lt;/li&gt;&#xA;&lt;li&gt;histogram&lt;/li&gt;&#xA;&lt;li&gt;response curve&lt;/li&gt;&#xA;&lt;li&gt;pixel-pixel differences&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you know that the filter uses convolution, a method of &lt;em&gt;blind deconvolution&lt;/em&gt; may be helpful.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-01-01T16:37:32.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6386" PostTypeId="2" ParentId="6367" CreationDate="2013-01-01T23:28:22.160" Score="2" Body="&lt;p&gt;Is the 500-bit encoded message part of a continuous stream being decoded by the Viterbi decoder, or is it a 500-bit packet that is decoded individually?   If part of a stream, then decoding continuously and searching for the preamble indicates the beginning of the message.   If packetized, then the decoder memory needs to be managed so that the first decoded bit location is known.   This will be dependent on the decoder implementation.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2013-01-01T23:28:22.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6387" PostTypeId="2" ParentId="6372" CreationDate="2013-01-01T23:47:58.077" Score="3" Body="&lt;p&gt;The output of a FIR filter is an average computed over the filter length and centered at a location based on the weights, or coefficients, of the filter.  A simple &quot;box car&quot; moving average, where all weights are the same, will average all of the inputs equally and so the weighted average will be at the center of the length of the filter.   If the filter has an odd number of taps, the output will be the average of the samples around the center tap.   If the filter has an even number of taps, then the average will fall between the two center samples and the filter will &quot;interpolate&quot; the average of the covered samples in between the two center samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general a frequency-selective filter will have a &quot;weight&quot; profile shaped like a $\frac{\sin(x)}{x}$ or something similar, and the output sample will be aligned in time with the peak of the main lobe of the $\frac{\sin(x)}{x}$. If the $\frac{\sin(x)}{x}$ is symmetric with an even number of taps, the peak of the main lobe will be between input sample and, again, the filter will interpolate a value between the two input samples at the peak of the main lobe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many filters the sampling of the sinx/x function is done specifically to &quot;interpolate&quot; an output sample at some arbitrary location between input samples by placing the peak of the $\frac{\sin(x)}{x}$ at the desired interpolation point.  Polyphase resampling filters and Farrow filters do this by selecting the FIR filter coefficients dynamically so that the $\frac{\sin(x)}{x}$ peak falls at a particular desired location between input samples.&lt;/p&gt;&#xA;" OwnerUserId="51" LastEditorUserId="90" LastEditDate="2013-01-02T00:58:57.853" LastActivityDate="2013-01-02T00:58:57.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6388" PostTypeId="1" CreationDate="2013-01-02T07:56:47.173" Score="7" ViewCount="515" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/1336/how-to-extract-traffic-signs-from-a-photograph&quot;&gt;How to extract traffic signs from a photograph?&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;I am working on a project which involves detecting north american speed signs (black/white) using a 720p HD camera. My problem is that I cannot seem to figure out how to classify the rectangular profile of the speed signs in order to pass it on to the text detection stage. My current segmentation approach detects differing levels of white in an image and thresholds the image based on those values (determined from color of road signs). The problem is that I need to segment it further as threshold-ed shape doesn't contain the complete road sign, but bits and pieces of it. I wanted to know what would be the best way to classify the road sign?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are some pre-segmented images and the corresponding segmented images:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Untqt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/lXCj6.jpg&quot; alt=&quot;http://imgur.com/a/Hwpwq&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the road sign has holes in it but its distinct rectangular profile is in-tact in most cases. I am currently looking into using kurtosis shape profile to determine if it is rectangle however the approach seems complicated and computationally expensive, I wanted to know if anyone knows a faster simpler method to determine the rectangular profile of the road sign from the segmented image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did this in Matlab using the image processing toolbox. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Use Local OTSU thresholding it will allow for segmentation and further morph operations allow to speed sign detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whoever marked this similar to the link below as a duplicate, its not... there is fundamental difference between chromatic and achromatic colors (This question deals with achromatic) whereas the link suggested below deals with chromatic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/odCmN.jpg&quot; alt=&quot;Road Sign Images&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ki8Er.jpg&quot; alt=&quot;More road sign images&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3526" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-04-09T07:37:11.940" Title="White Road Sign Detection" Tags="|image-processing|image-segmentation|thresholding|" AnswerCount="1" CommentCount="4" ClosedDate="2013-01-04T19:43:17.570" ContentLicense="CC BY-SA 3.0" />
  <row Id="6390" PostTypeId="2" ParentId="6372" CreationDate="2013-01-02T13:21:08.840" Score="5" Body="&lt;p&gt;Let's view this from a slightly different angle:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the signal is properly sampled, i.e. in accordance with the Shannon/Nyquist criterion, then the samples contain all information about the original signal. If not, all bets are off, so we'll skip this for now.&lt;/li&gt;&#xA;&lt;li&gt;Interpolation is then equivalent to sampling the signal at a non-integer time. In your case you want to know what is x(t=2.1) by using the information x[1], x[2], x[3] ...&lt;/li&gt;&#xA;&lt;li&gt;There is only one &quot;correct&quot; answer to &quot;what is x(t=2.1). In your example it happens to be 1.05061339.... It can be calculated using the Whittaker Shannon interpolation (see Wikipedia) as $$x(t)=\sum_{n=-\infty }^{\infty }x[n]\cdot \mbox{sinc}(\frac{t-nT}{T})$$&lt;/li&gt;&#xA;&lt;li&gt;This can be interpreted as the convolution with an impulse response. However, it's not &quot;finite&quot;.&lt;/li&gt;&#xA;&lt;li&gt;Unfortunately The Whitaker Shannon interpolation is not very practical: The impulse response is infinite, the number of zeros is infinite and it's falloff with time is slow, so it's not a great candidate for windowing to get a time limited impulse response.&lt;/li&gt;&#xA;&lt;li&gt;The Whittaker Shannon interpolation is equivalent to convolution with the impulse response of an ideal low pass filter. All practical interpolation methods will also involve  a low pass filter. Even linear interpolation can be interpreted as a low pass filter, it's just a very bad one.&lt;/li&gt;&#xA;&lt;li&gt;Interpolation filters are made &quot;practical&quot; by adjusting filter parameters to the requirements of the application: how much precision do you need, what's the spectral content of the signal, what latency can you tolerate, etc.&lt;/li&gt;&#xA;&lt;li&gt;Filter parameters to adjust are filter order, cutoff frequency, rolloff, filter design method (equiripple, least squares, etc), linear or minimum phase, side lobe height, stop band attenuation, pass band ripple, etc. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="224" LastEditorUserId="80" LastEditDate="2016-03-31T12:47:24.157" LastActivityDate="2016-03-31T12:47:24.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6391" PostTypeId="2" ParentId="6372" CreationDate="2013-01-02T17:53:06.233" Score="1" Body="&lt;p&gt;If you have your FIR filter in terms of an closed-form equations or computable algorithm, such as with, say, a windowed Sinc using a von Hann window, then for each point you wish to interpolate, you can compute the vector of coefficients (taps) required by your FIR filter for the offset from your data vector points, and use the dot product of these coefficients and your data array to compute the FIR filtered interpolated result point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the offsets of the points you wish to interpolate are repeated, such as when doing a sequence of interpolations stepping at a rational fraction step interval, you can pre-compute or cache the coefficients, sometimes called a polyphase FIR filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of computing each coefficient, you might be able to get sufficient quality results by interpolating your interpolation coefficients, such as when interpolating a coarser polyphase FIR filter table, or you may be able to polynomial approximate the coefficients using something like the Farrow filter algorithm.  This potentially allow a lower computational cost than the possible need to call a transcendental library function multiple times for each tap for each point (or worse if your desired filter can't be expressed in simple easily computable closed form).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-01-02T17:58:19.467" LastActivityDate="2013-01-02T17:58:19.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6392" PostTypeId="1" CreationDate="2013-01-02T20:51:15.127" Score="2" ViewCount="617" Body="&lt;p&gt;I want to use Prony's method to fit a signal given by the sum of $p$ complex exponentials&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n]=\displaystyle{\sum_{k=1}^p} A_k{\rm e}^{\,{\rm j}\theta_k} {\rm e}^{2\pi\, {\rm j} f_k (n-1)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that Prony's standard formulation (Hildebrand, Introduction to Numerical Analysis, pp. 378-382) assumes that all the samples $x[n]$ with $n=1,\ldots,N$ are available, however in some applications $x[1]$ can't be measured. It seems that in this case Prony's method can't be applied. Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="1696" LastEditorUserId="1696" LastEditDate="2013-01-04T18:18:05.910" LastActivityDate="2013-01-04T18:25:20.530" Title="Question about Prony's method" Tags="|algorithms|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6393" PostTypeId="1" CreationDate="2013-01-02T14:58:57.793" Score="2" ViewCount="87" Body="&lt;p&gt;What are the known possibilities to date for filtering the phases of an image and what are they used for?&lt;br&gt;&#xA;Phases are used in some edge detection algorithms.&lt;br&gt;&#xA;They are also used for cross correlation of 2 images.&lt;br&gt;&#xA;Is there something more? (I'm thinking about the same principle used with the amplitudes, bandpass filtering)&lt;/p&gt;&#xA;" OwnerUserId="3554" OwnerDisplayName="Pella86" LastActivityDate="2013-01-02T21:11:06.523" Title="Fourier transform of images and phase filters" Tags="|image-processing|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6394" PostTypeId="2" ParentId="6138" CreationDate="2013-01-02T21:59:59.487" Score="1" Body="&lt;p&gt;The FIR filter length will determine the accuracy of the FIR filter.  The FIR filter is an approximation of the optimum filter response (which is for you to decide) and shouldn't be tied to the &quot;pulse&quot; duration.  The longer the FIR filter, the more coefficients you have, the more accurately the filter magnitude response will conform to your specifications.  There are two other issues to consider.  You have to consider the phase response because that can distort the shape of the demodulated pulse.  You may already be doing this, but I think you probably want your FIR filter to have linear phase.  Additionally as you increase the length of the FIR filter, you will add delay from input to output, so you don't want to just shoot for the moon in terms of filter length.  So in terms of optimal length, you have to find a happy medium between accuracy and response time.&lt;/p&gt;&#xA;" OwnerUserId="3517" LastActivityDate="2013-01-02T21:59:59.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6395" PostTypeId="1" CreationDate="2013-01-03T00:02:57.483" Score="9" ViewCount="4245" Body="&lt;p&gt;I'm working on a piano tuning program and part of it requires real-time pitch detection.  Here is the scheme I have so far which works to some degree but could probably use some refinement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm capturing mono, 44.1kHz, 16-bit PCM audio in chunks of 2^14 samples.  I combine the last 4 samples into a 2^16 length buffer, apply a Hann window to the buffer and run a FFT on it.  Then, I bucketize the results of the FFT in two resolutions.  First, I bucketize into 200 buckets and then run the HPS pitch detection algorithm at this granularity.  I don't need to get an exact frequency here, I just want to get close.  Then, I bucketize into 12000 buckets which gives me 1 cent resolution from 10Hz to 10kHz.  Once I know an approximate frequency from the 200 bin HPS algorithm, I search that range of the 12000 bin case for a peak to get a more exact frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to work okay for the notes in the middle of the keyboard.  What happens with the low notes is about 1.5s of mis-identification of the note as usually the 2nd or 3rd partial of the real note and then a correct identification of the note.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all of the spectral plots I created to see what is going on, there is more width to the peaks that I would expect.  This width is visually somewhat consistent from the 200 bin to 12000 bin case.  I would have expected the peaks to be narrower in the 200 bin case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, signal processing is new to me so there may be things that are problems that I wouldn't think to ask about but in terms of specific questions, are the sample sizes sufficient for this task?  Is Hann the right choice of window?  Should I smooth the data as well before FFT?  How sensitive is HPS to the number of bins?  I was thinking that if I used a lot of bins then inharmonicity might not make partials overlap their fundamentals with the HPS algorithm's simple approach of dividing by 2, 3, 4, etc.  &lt;/p&gt;&#xA;" OwnerUserId="3532" LastActivityDate="2013-01-04T18:23:38.953" Title="Piano pitch detection" Tags="|fft|audio|pitch|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6396" PostTypeId="2" ParentId="6395" CreationDate="2013-01-03T03:21:21.537" Score="6" Body="&lt;p&gt;Similar to this thread: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1317/is-there-an-algorithm-for-finding-a-frequency-without-dft-or-fft/1321#1321&quot;&gt;Is there an algorithm for finding a frequency without DFT or FFT?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT isn't a particular efficient way of building a tuner. Better (and cheaper) methods include auto-correlation, phased locked loops and delay locked loops, etc..  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example is to use tracking of local maxima and minima to roughly hone in on the fundamental frequency and then use a local oscillator and phase locked loop to track this frequency precisely. This can track a moving fundamental during tuning quickly, continuously, and with great accuracy even if the frequency is low and if the fundamental is weak.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-01-03T03:21:21.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6397" PostTypeId="1" CreationDate="2013-01-03T04:38:52.053" Score="3" ViewCount="637" Body="&lt;p&gt;I am a power systems engineer and am doing preliminary leg-work for detection of a specific anomaly in power systems that cause the observed waveform to be distorted. False positives are  somewhat acceptable here, as missing the said event can be catastrophic. This is what the signal looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/llqM6.png&quot; alt=&quot;Waveform-1000 Samples&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this waveform is an output of a anomaly simulating setup that has been fed a pure sine wave of $50\textrm{ Hz}$, captured using an Oscilloscope at $1000$ samples representing what was being displayed on the screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I detect where one cycle starts and ends programatically, where there are multiple points representing the zero crossover?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd run an FFT over it once I can do that, but might need help in interpretation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not have a formal background in DSP but am open to all reasonable ideas and suggestions, and willing to learn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P.S.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the $1000$ Samples&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-3.15, -3.15, -3.24, -3.34, -3.53, -3.63, -3.73, -3.82, -4.02, -4.02, -4.11, -4.21, -4.31, -4.50, -4.50, -4.50, -4.60, -4.70, -4.79, -4.89, -4.99, -5.08, -5.08, -5.18, -5.28, -5.37, -5.47, -5.57, -5.66, -5.66, -5.86, -5.95, -5.95, -6.05, -6.15, -6.15, -6.24, -6.34, -6.44, -6.44, -6.53, -6.53, -6.63, -6.73, -6.73, -6.82, -6.92, -6.92, -6.92, -7.02, -7.02, -7.12, -7.12, -7.21, -7.21, -7.31, -7.31, -7.31, -7.31, -7.31, -7.41, -7.41, -7.41, -7.50, -7.41, -7.50, -7.41, -7.50, -7.41, -7.41, -7.41, -7.31, -7.31, -7.21, -7.12, -6.92, -6.63, -6.15, -5.37, -4.21, -2.76, -1.60, -0.82, -0.44, -0.24, -0.15, -0.05, -0.05, 0.05, -0.05, 0.05, -0.05, -0.05, 0.05, -0.05, -0.05, -0.05, -0.05, 0.05, -0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, -0.05, 0.05, -0.05, -0.05, 0.05, 0.05, 0.05, 0.05, 0.05, -0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.15, 0.05, 0.15, 0.15, 0.15, 0.24, 0.15, 0.15, 0.15, 0.24, 0.15, 0.15, 0.15, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.44, 0.44, 0.44, 0.53, 0.53, 0.53, 0.63, 0.73, 0.73, 0.82, 0.82, 0.92, 1.02, 1.02, 1.11, 1.21, 1.21, 1.40, 1.40, 1.50, 1.69, 1.69, 1.79, 1.89, 2.08, 2.08, 2.28, 2.37, 2.37, 2.57, 2.66, 2.76, 2.95, 2.95, 3.05, 3.24, 3.44, 3.44, 3.53, 3.73, 3.82, 3.92, 4.02, 4.11, 4.21, 4.31, 4.40, 4.50, 4.50, 4.60, 4.70, 4.79, 4.89, 4.99, 4.99, 5.08, 5.18, 5.28, 5.37, 5.47, 5.57, 5.66, 5.76, 5.76, 5.95, 5.95, 6.05, 6.15, 6.15, 6.24, 6.34, 6.44, 6.44, 6.44, 6.63, 6.73, 6.73, 6.73, 6.82, 6.92, 6.92, 7.02, 7.02, 7.12, 7.12, 7.21, 7.21, 7.21, 7.31, 7.31, 7.31, 7.41, 7.41, 7.41, 7.50, 7.50, 7.50, 7.50, 7.50, 7.50, 7.50, 7.50, 7.41, 7.50, 7.50, 7.41, 7.41, 7.31, 7.21, 7.02, 6.63, 6.15, 5.37, 4.21, 2.76, 1.69, 0.82, 0.44, 0.15, 0.05, 0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.15, -0.15, -0.15, -0.05, -0.15, -0.15, -0.15, -0.05, -0.05, -0.05, -0.05, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.24, -0.24, -0.15, -0.24, -0.15, -0.24, -0.34, -0.24, -0.24, -0.24, -0.24, -0.24, -0.24, -0.34, -0.34, -0.24, -0.24, -0.34, -0.34, -0.34, -0.34, -0.44, -0.44, -0.44, -0.44, -0.53, -0.53, -0.53, -0.63, -0.63, -0.63, -0.73, -0.73, -0.82, -0.82, -0.92, -0.92, -1.02, -1.11, -1.21, -1.21, -1.31, -1.40, -1.50, -1.60, -1.69, -1.79, -1.89, -1.98, -2.08, -2.18, -2.28, -2.37, -2.47, -2.66, -2.76, -2.76, -3.05, -3.05, -3.24, -3.24, -3.34, -3.53, -3.63, -3.73, -3.82, -3.92, -4.11, -4.11, -4.21, -4.31, -4.40, -4.50, -4.50, -4.60, -4.70, -4.79, -4.89, -4.99, -5.08, -5.18, -5.28, -5.37, -5.37, -5.47, -5.57, -5.66, -5.76, -5.76, -5.95, -6.05, -6.05, -6.15, -6.15, -6.24, -6.34, -6.44, -6.44, -6.53, -6.53, -6.63, -6.73, -6.82, -6.82, -6.82, -6.92, -6.92, -7.02, -7.02, -7.12, -7.12, -7.12, -7.31, -7.31, -7.31, -7.31, -7.31, -7.41, -7.41, -7.31, -7.41, -7.41, -7.41, -7.50, -7.50, -7.41, -7.41, -7.41, -7.41, -7.31, -7.31, -7.21, -7.12, -6.92, -6.63, -6.15, -5.37, -4.21, -2.86, -1.69, -0.92, -0.44, -0.24, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, 0.05, 0.05, 0.05, 0.05, -0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, -0.05, 0.05, 0.05, 0.05, -0.05, -0.05, 0.05, -0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.15, 0.05, 0.05, 0.05, 0.15, 0.05, 0.15, 0.05, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.24, 0.15, 0.15, 0.24, 0.24, 0.24, 0.24, 0.15, 0.24, 0.24, 0.24, 0.24, 0.34, 0.34, 0.34, 0.34, 0.44, 0.44, 0.44, 0.53, 0.53, 0.53, 0.53, 0.63, 0.63, 0.73, 0.73, 0.82, 0.82, 0.92, 1.02, 1.02, 1.11, 1.21, 1.31, 1.31, 1.40, 1.50, 1.60, 1.69, 1.89, 1.89, 1.98, 2.08, 2.18, 2.28, 2.47, 2.57, 2.66, 2.76, 2.86, 3.05, 3.15, 3.24, 3.34, 3.44, 3.53, 3.73, 3.82, 3.82, 4.02, 4.11, 4.21, 4.40, 4.40, 4.50, 4.50, 4.60, 4.60, 4.79, 4.89, 4.89, 4.99, 5.18, 5.18, 5.28, 5.37, 5.47, 5.57, 5.66, 5.76, 5.76, 5.86, 5.95, 6.05, 6.15, 6.15, 6.24, 6.34, 6.44, 6.53, 6.53, 6.63, 6.63, 6.73, 6.73, 6.82, 6.82, 6.92, 7.02, 7.02, 7.12, 7.12, 7.21, 7.21, 7.31, 7.31, 7.31, 7.31, 7.41, 7.50, 7.41, 7.41, 7.50, 7.50, 7.50, 7.50, 7.50, 7.50, 7.50, 7.50, 7.50, 7.41, 7.50, 7.41, 7.31, 7.21, 7.02, 6.73, 6.15, 5.47, 4.40, 2.86, 1.69, 0.92, 0.44, 0.15, 0.15, 0.05, 0.05, -0.05, -0.05, -0.05, -0.05, 0.05, 0.05, 0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.05, -0.15, -0.05, -0.05, -0.05, -0.05, -0.05, -0.15, -0.05, -0.05, -0.05, -0.15, -0.05, -0.15, -0.15, -0.05, -0.15, -0.05, -0.05, -0.15, -0.05, -0.15, -0.15, -0.15, -0.15, -0.05, -0.24, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.24, -0.15, -0.15, -0.15, -0.15, -0.15, -0.15, -0.24, -0.15, -0.15, -0.24, -0.24, -0.24, -0.24, -0.24, -0.24, -0.24, -0.34, -0.34, -0.34, -0.24, -0.34, -0.34, -0.34, -0.44, -0.44, -0.44, -0.44, -0.53, -0.53, -0.53, -0.63, -0.63, -0.63, -0.73, -0.63, -0.73, -0.82, -0.92, -1.02, -1.02, -1.11, -1.11, -1.21, -1.31, -1.40, -1.50, -1.60, -1.69, -1.79, -1.79, -1.98, -2.08, -2.08, -2.37, -2.37, -2.57, -2.66, -2.76, -2.86, -2.95, -3.05, -3.24, -3.34, -3.44, -3.44, -3.53, -3.73, -3.82, -3.92, -4.02, -4.11, -4.11, -4.31, -4.50, -4.40, -4.60, -4.60, -4.70, -4.79, -4.89, -4.99, -4.99, -5.18, -5.18, -5.28, -5.37, -5.47, -5.57, -5.66, -5.76, -5.76, -5.86, -5.95, -6.05, -6.15, -6.24, -6.24, -6.34, -6.34, -6.44, -6.53, -6.53, -6.63, -6.73, -6.73, -6.82, -6.82, -6.92, -6.92, -7.02, -7.02, -7.12, -7.12, -7.12, -7.21, -7.31, -7.31, -7.31, -7.31, -7.41, -7.41, -7.41, -7.41, -7.41, -7.50, -7.41, -7.41, -7.41, -7.50, -7.41, -7.41, -7.41, -7.31, -7.21, -7.12, -6.92, -6.63, -6.15, -5.47, -4.40, -2.95, -1.69, -0.92, -0.53, -0.24, -0.15, -0.05, -0.05, -0.05, 0.05, -0.05, 0.05, 0.05, 0.05, -0.05, -0.05, -0.05, -0.05, -0.05, 0.05, -0.05, -0.05, -0.05, -0.05, -0.05, 0.05, 0.05, -0.05, 0.05, -0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, -0.05, 0.05, 0.05, 0.15, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.15, 0.05, 0.05, 0.05, 0.05, 0.05, 0.15, 0.15, 0.15, 0.05, 0.05, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.24, 0.15, 0.15, 0.15, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.34, 0.24, 0.34, 0.34, 0.34, 0.34, 0.34, 0.44, 0.44, 0.34, 0.44, 0.53, 0.53, 0.63, 0.63, 0.82, 0.73, 0.82, 0.73, 0.92, 1.02, 1.02, 1.11, 1.11, 1.21, 1.31, 1.40, 1.50, 1.60, 1.69, 1.79, 1.89, 1.98, 2.18, 2.28, 2.37, 2.47, 2.57, 2.66, 2.76, 2.95, 3.05&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1420" LastEditorUserId="1629" LastEditDate="2016-08-30T10:04:49.947" LastActivityDate="2016-08-30T10:04:49.947" Title="Signature of a Signal for anomaly detection in Power Systems" Tags="|signal-analysis|signal-detection|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6398" PostTypeId="1" AcceptedAnswerId="7885" CreationDate="2013-01-03T05:13:56.407" Score="7" ViewCount="3533" Body="&lt;p&gt;I have started looking into DSP and made an implementation of short-time fourier transform, using kissFFT to perform the FFT. I then render a spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example image that I have generated can be seen below. On top is the spectrogram of a music file from my implementation and under it is the spectrogram of the same section generated from audacity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cx89o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My concern is the vertical lines that show up from my implementation, which are most visible in the higher frequencies. They may interfere with other stuff I will try to do later on. Has anyone ever had the same problem or know the cause? How can I get rid of them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional information:&#xA;I use hamming window with 50% overlap (using different windows has not helped)&lt;/p&gt;&#xA;" OwnerUserId="3534" LastEditorUserId="6" LastEditDate="2013-01-03T05:34:52.467" LastActivityDate="2014-03-08T04:58:23.280" Title="Vertical lines noise in spectrogram" Tags="|fft|noise|spectrogram|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6399" PostTypeId="2" ParentId="6395" CreationDate="2013-01-03T07:03:25.093" Score="2" Body="&lt;p&gt;A search for 'piano tuning software' or similar items will yield a large number of hits – some good, some not so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every type of musical instrument has unique acoustic/physical/environmental characteristics that affect its sound.  And it can get complicated, as thousands of books and research papers would suggest (eg: tonality, attack/decay characteristics, inharmonicity, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pitch detection is itself a wide-ranging field.  The following is but a tiny fraction of what's available:&#xA;&lt;a href=&quot;https://ccrma.stanford.edu/~pdelac/research/MyPublishedPapers/icmc_2001-pitch_best.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;overview article 1&lt;/a&gt;&#xA;and&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/572/harmonic-product-spectrum-limitations-in-pitch-detection&quot;&gt;stack exchange post&lt;/a&gt;&#xA;and&#xA;&lt;a href=&quot;https://ccrma.stanford.edu/~pdelac/154/m154paper.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;overview article 2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your specific questions: 1) your sample size seems like overkill – depending on SNR and waveform stability, you can get high frequency accuracy using other methods using fewer cycles. (some methods are FFT-based).  And you may be capturing attack/decay with a long sample time, 2) any window other than rectangular will broaden the beam-width in the frequency domain, but that doesn't mean you shouldn't use one – Hann seems common with HPS, from what I've seen, 3) as noted in the first link above, HPS doesn't work very well at low frequency, and inharmonicity will affect you on the lower strings.&#xA;As for your overall method, without having to write  a lot of pages, I can only say that I would do it  differently, depending on the frequency range and harmonics I was dealing with.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-01-03T07:03:25.093" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6401" PostTypeId="2" ParentId="6397" CreationDate="2013-01-03T12:32:02.783" Score="4" Body="&lt;p&gt;First, you need to precisely define what you mean by starting point of the cycle. What exactly is your reference that determines t=0 and what exactly determines the start of the cycle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your signal is comprised of the fundamental and a lot of odd harmonics. The fundamental is the strongest. You can easily determine the &quot;start of the fundamental as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiply the signal with a complex exponential of 50 Hz. Sum the result (which will be a complex number). Calculate the phase and the associated time delay. In  your case this comes out to be 238.38 samples and roughly matches the maximum in the wave form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this with an FFT as well, but you need to make sure that the frequencies of interest (50 Hz, 150 Hz, 250 Hz, etc) are on the FFT grid. Assuming a 20 kHz sample rate, you could use an FFT length of 800 points which gives you a frequency resolution of 25 Hz and 50Hz would map to bin 2, 150 Hz to bin 6, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also track the maxima and minima, which is much easier than the zero crossings for this waveform.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT: added Matlab code how to derive the fundamental delay]&#xA;Multiplying with a complex exponential is basically the same as multiplying with a cosine and a sine wave. However this only works if your sampling clock doesn't drift a lot with respect to the 50 Hz fundamental and if the delay your are interested in is the delay of the fundamental itself. The higher harmonics have actually different delays.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% assume the signal is in variable x as a column vector&#xA;nx = length(x)&#xA;fs = 20000; % sample rate (guess on my part)&#xA;%&#xA;% create a complex exponentional at 50 Hz&#xA;cx = exp(j*2*pi*(0:nx-1)'*50/fs);&#xA;% scalar product&#xA;zx = sum(cx.*x);&#xA;% convert into a delay by calcualting pahse, wrapping and converting to &#xA;% samples&#xA;za = angle(zx); if(za &amp;lt; 0), za = za + 2*pi; end&#xA;% phase to delay in samples&#xA;dx = fs * ( za/(2*pi)/50);&#xA;% plot original wave form delayed cosine&#xA;plot([x max(x)*cos(2*pi*50*((0:nx-1)' - dx)/fs)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorUserId="224" LastEditDate="2013-01-04T15:24:45.683" LastActivityDate="2013-01-04T15:24:45.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6402" PostTypeId="2" ParentId="6398" CreationDate="2013-01-03T12:52:18.353" Score="0" Body="&lt;p&gt;I think you need to look at enough data to get a feel for how the spectrogram looks.  Spectrograms often have what looks like vertical lines or columns as a result of the time windows used to compute each section of the spectrogram.  The higher frequencies seem to show this more because you get a representation of greater energy (by color or intensity) distributed toward the top of the spectrogram where it stands out.  What other kinds of things do you want to do with the data?&lt;/p&gt;&#xA;" OwnerUserId="3517" LastActivityDate="2013-01-03T12:52:18.353" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6403" PostTypeId="2" ParentId="6395" CreationDate="2013-01-03T12:58:58.983" Score="1" Body="&lt;p&gt;With the lower notes of pianos, especially for uprights, the spectrum tends to be stretched out (the distance between the fundamental and first overtone is a little more than an octave, etc). This is what gives pianos their percussive sound, the lowest note on older uprights will often sound more like a thud than a note, and as I understand it this is why cheep uprights have their particular percussive honky tonk sound. Because of this good piano tuners (the people not algorithms) will tune pianos by the lower overtones than the fundamental for lower notes, the human ear tends to focus on the interaction of the lower overtones for these notes. The stretching of the harmonic series could also be the cause of the wider than expected peaks in the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="1144" LastActivityDate="2013-01-03T12:58:58.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6404" PostTypeId="2" ParentId="6398" CreationDate="2013-01-03T14:14:11.673" Score="3" Body="&lt;p&gt;The vertical lines you see could be clipping. I assume you took a loud MP3 file, decoded it to something like a linear PCM-Wave whith clipping and feed your program with it. As far as, I know Audacity decodes MP3 to 32bit floats internally which does not suffer from clipping issues. This could explain why the Audacity spectrogram looks clean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if this is true, your software is probably OK but your MP3 is simply too loud. The compression artefacts will make samples values go beyond the valid range and a decoder that outputs integer samples would have to do clipping.&lt;/p&gt;&#xA;" OwnerUserId="1961" LastActivityDate="2013-01-03T14:14:11.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6405" PostTypeId="1" CreationDate="2013-01-03T14:37:19.573" Score="14" ViewCount="3874" Body="&lt;p&gt;I want to know how to solve those types of problems.. is it by inspection ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the linear system below. When the inputs to the system $x_1[n]$, $x_2[n]$ and $x_3[n]$, the responses of the systems are $y_1[n]$, $y_2[n]$ and $y_3[n]$ as shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZC2Cu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Determine whether the system is time invariant or not. Just your answer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the impulse response?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;  Assuming a general case where the given inputs don't contain a scaled impulse like $x_2[n]$&lt;/p&gt;&#xA;" OwnerUserId="3536" LastEditorUserId="128" LastEditDate="2018-09-09T10:37:05.597" LastActivityDate="2021-02-23T07:10:15.483" Title="How to Deduce a Linear System's Impulse Response from a Set of Input and Output Signals?" Tags="|convolution|linear-systems|homework|deconvolution|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="6406" PostTypeId="2" ParentId="6395" CreationDate="2013-01-03T17:20:39.793" Score="2" Body="&lt;p&gt;Another answer suggests PLL. I think you should stay away from PLL: most literature on pitch tracking focuses on auto-correlation (search for &quot;YIN Pitch Tracking&quot; -- YIN is a modern pitch tracking algorithm based on auto-correlation) and FFT. I &lt;em&gt;believe&lt;/em&gt; PLL is more suited to tracking &lt;strong&gt;tiny&lt;/strong&gt; fluctuations in frequency, like with radio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Auto-correlation is a good place to start. It is fast, efficient and accurate. However, there are tricks for making FFT very accurate and fast (most techniques that use the FFT just look at the magnitude, but you can also use the phase information), so if you are familiar with FFTs you can use that technique as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do use either of these techniques, I suggest prefiltering with a lowpass to reduce harmonics and focus on the fundamental. With the FFT, you can, instead, or in addition, use tricks like looking at the first local maximum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be a good starting point for filtering and so on. It will also give you some tips about avoiding doing too much work, and it links to source code: &lt;a href=&quot;http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html&quot; rel=&quot;nofollow&quot;&gt;http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This book has sections that explain both YIN and FFT using phase information:&#xA;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470665998&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/DAFX-Digital-Udo-ouml-lzer/dp/0470665998&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you'll have to understand the specifics of pianos. I'm not sure if the tuner itself needs to do anything special WRT, eg, stretched tuning, or if that's left up to the person tuning the piano, but you'll need to at least understand that stuff. Another poster suggested looking at out of tune harmonics, but the main issue is to identify and tune the fundamental, so the harmonics being out of tune should not matter as long as you properly identify the fundamental.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2013-01-03T17:20:39.793" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6408" PostTypeId="2" ParentId="4719" CreationDate="2013-01-03T20:32:31.040" Score="3" Body="&lt;p&gt;As a side note: this contraption is known as a Schroeder-Allpass (see for example &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Schroeder_Allpass_Sections.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/pasp/Schroeder_Allpass_Sections.html&lt;/a&gt;) and often used in creating artificial reverb. For M=1 (i.e. a single sample delay), it degenerates into a regular first order all pass. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replacing the single tab with a multi-tab delay still maintains the overall all pass shape but with a phase that's &quot;compressed&quot; and &quot;repeated&quot; and hence a much larger group delays. This is actually true for any all pass: if you replace all delays inside an all pass structure with different delays or even all passes, the whole contraption stays an allpass. That is simply a function of the Z transform.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-03T20:32:31.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6409" PostTypeId="2" ParentId="6395" CreationDate="2013-01-03T21:33:48.037" Score="2" Body="&lt;p&gt;The wide peaks you see may be the result of physical phenomena, not a signal processing artifact.  In general, narrow peaks in an FFT result represents an unmodulated sinusoid exactly periodic in the window in the time domain.  But piano string vibrations are not that stationary.  They evolve over time, creating a noticeable modulation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Several effects: multiple piano strings per note will exchange energy thru the soundboard; the total vibration energy will decay over time; the vibration modes may be slightly inharmonic to start with; the exact frequency of vibration of each mode (harmonic) may change with decay in amplitude due to non-zero string stiffness and diameter; and each harmonic may decay at a different rate, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may have to decide which of these multiple modulations you want to call &quot;the pitch&quot; (books on audiology may help), and find a method to better track it inside the FFT's &quot;wide peak&quot;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-01-04T18:23:38.953" LastActivityDate="2013-01-04T18:23:38.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6410" PostTypeId="2" ParentId="6398" CreationDate="2013-01-03T22:02:22.217" Score="1" Body="&lt;p&gt;Vertical lines in a sequence of overlapped FFT results can be the result of impulse noise, which is wide spectrum.  The can be caused by misplaced samples, skipped samples, zeroed samples or greatly distorted samples in some of the audio data fed to some subset of the spectrograph's FFTs.  If it shows up in near silence, it could be sample or arithmetic quantization noise, stuff you could throw away if you are looking for an onset over some threshold well above the noise floor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-01-03T22:02:22.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6411" PostTypeId="2" ParentId="2696" CreationDate="2013-01-04T05:14:37.610" Score="1" Body="&lt;p&gt;I am happy to add my 2 cents to answer your question. First lets get to the basics. A speech signal in technical terms is a quasi stationary signal. This means that the features of the signal are constant for a very short duration(say for about 20-25 ms). A speech signal consists of source information (just think of air pulses vibrating at a specific frequency which is called the &lt;strong&gt;pitch frequency&lt;/strong&gt;) and the system information (As the air pulses pass thru your vocal tract they sort of get modulated by the &lt;strong&gt;resonant frequencies&lt;/strong&gt; of the vocal tract). It is these features which change every 20-25ms.Generally in Speech Signal Processing, any operation is performed on a subset of signal which is of 20-25 ms since it is over this window/frame that the features are constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your question about Spectrogram you need to know what a spectrum is. A &lt;strong&gt;spectrum&lt;/strong&gt; like I said previously is calculated for a small window/frame which shows the resonant frequencies present in that window.A spectrogram is a graphical representation that shows the spectrum plot over all the frames. This makes it a 3-D figure and the Spectrogram function generates a 2-D projection of this figure. The x-axis represents the time scale (or the corresponding window), the y-axis represents the frequency and the grey stripes you see denote the magnitude of the frequency for that particular window.The darker the stripe, greater is the magnitude of the frequency component in that particular window of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the previous post explains the spectrogram function in detail. Please feel free to get back if you have any queries.&lt;/p&gt;&#xA;" OwnerUserId="3542" LastActivityDate="2013-01-04T05:14:37.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6412" PostTypeId="1" AcceptedAnswerId="6414" CreationDate="2013-01-04T10:56:08.177" Score="7" ViewCount="752" Body="&lt;p&gt;I have two audio signals that I want to mix at various mixing ratios. Initially, I simply went for something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \alpha \cdot x_1(t) + (1-\alpha) \cdot x_2(t)$&lt;br&gt;&#xA;where $\alpha$ is the ratio between zero and one and $x_1$ and $x_2$ are the two signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have seen a few panning curves that did not mix signals linearly. They told me that a linear mix would change the overall loudness while mixing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something to that or is a linear mix the correct way to do it?&lt;/p&gt;&#xA;" OwnerUserId="3543" LastEditorUserId="3543" LastEditDate="2013-01-04T20:32:56.433" LastActivityDate="2013-01-04T20:32:56.433" Title="How to mix two signals without changing the overall loudness?" Tags="|audio|interpolation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6414" PostTypeId="2" ParentId="6412" CreationDate="2013-01-04T13:24:15.800" Score="9" Body="&lt;p&gt;That depends somewhat on the application. In most cases a &quot;constant energy&quot; pan will be best. This can be expressed as $$y(t)=\sqrt{\alpha} \cdot x_{1}(t)+\sqrt{1-\alpha}\cdot x_{2}(t)$$ where $\alpha = .5$ is the point of equal energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are working with fixed point signals, such as wave files for examples, you may run into clipping problems. That could be a topic for a separate question. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-04T13:24:15.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6415" PostTypeId="1" AcceptedAnswerId="6416" CreationDate="2013-01-04T16:17:22.653" Score="9" ViewCount="2920" Body="&lt;p&gt;I am currently studying DSP and FFT, I am very new to this and have been doing electronics for a long time with Arduino and hobby projects. Recently, I am doing a project with the goal to map potholes along your daily commute in the car, measuring road roughness. This is not the road profile, but the subjected roughness of the ride the driver feels during the trip. I have an acceleration mounted to measure Z-axis &quot;vertical&quot; acceleration of the car, when a pothole is struck the shocks and springs dampen the force as per the quarter car model for simplicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I want to be able to create a detector that will detect potholes by using FFT to find the dominating frequency of the vertical acceleration, then I can maybe match it to pattern to detect door slamming of the car door, or a man-hole cover from a pothole maybe in the future. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if FFT is the way to go, any input or advice and ideas are greatly appreciated, I have made a low pass filter to filter out the higher frequency vibration from the drive train and engine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on the subjected &quot;roughness&quot; felt by the passengers/driver in the car? I was thinking of doing road tests on a smooth road, gravel road, brick road, bad road, and coming up with a threshold of the magnitude of the vertical acceleration and making a scale somehow on what is considered &quot;rough&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The potholes detected would be also logged with GPS their locations, I'm trying to use the Rasberry Pi for this, with data storage and its speed as a good project for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks any help or ideas is appreciated, books, tutorials, wisdom, etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Carry over additional data here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://electronics.stackexchange.com/questions/56238/accelerometer-data-smoothing-filtering-pothole-detection&quot;&gt;https://electronics.stackexchange.com/questions/56238/accelerometer-data-smoothing-filtering-pothole-detection&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3548" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2019-12-07T07:57:38.913" Title="How can I detect potholes using an accelerometer mounted in a vehicle?" Tags="|fft|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="6416" PostTypeId="2" ParentId="6415" CreationDate="2013-01-04T16:50:12.260" Score="8" Body="&lt;p&gt;You are not really interested in the frequency information in your signal so much as detectable features - as such I would suggest that there isn't that much utility in an FFT here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you really want to do is &lt;strong&gt;correlate&lt;/strong&gt; the continuous 'car signal' recorded in the car with a different signal which is the 'signature' of the pothole bump. You will need to acquire this signature by recording it in a car going over a pothole (perhaps recording many and using them to produce a generic signal which is a good representation of a pothole). Once you have it you can &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross_correlation&quot;&gt;cross correlate&lt;/a&gt; it with your car signal. You may want to do this in the frequency domain in which case you should cross correlate the FFT of your signature with a sliding FFT of the car signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to process the car signal before you use it to remove, for example, high frequency noise (with a lowpass filter). You can do this pretty effectively by eye - play around with various filters on car signals to see which removes the most extraneous information while leaving the important pothole information intact.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-01-04T16:50:12.260" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="6417" PostTypeId="2" ParentId="6397" CreationDate="2013-01-04T17:06:01.380" Score="1" Body="&lt;p&gt;To detect where one cycle starts and ends programatically for this signal the simplest approach would be to detect when the sign of the gradient of the curve flips - this will give you the extrema of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do so simply take the difference between the current sample and the previous sample - when this value changes sign you have reached an extrema.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-01-04T17:06:01.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6418" PostTypeId="2" ParentId="6392" CreationDate="2013-01-04T17:58:34.723" Score="1" Body="&lt;p&gt;Drop the first sample - apply the formulation as if x[2] was x[1].&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-01-04T17:58:34.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6419" PostTypeId="2" ParentId="6392" CreationDate="2013-01-04T18:25:20.530" Score="1" Body="&lt;p&gt;An variant of Prony's method that does not require $x[1]$ is presented in&lt;br&gt;&#xA;Kahn et al. &quot;On the consistency of Prony's method and related algorithms.&quot; Journal of Computational and Graphical Statistics 1.4 (1992): 329-349. MATLAB code is available at &lt;a href=&quot;http://www.statsci.org/other/prony.html&quot; rel=&quot;nofollow&quot;&gt;http://www.statsci.org/other/prony.html&lt;/a&gt; &#xA;The signal model in this implementation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n]=\displaystyle{\sum_{k=1}^p} A_k{\rm e}^{\,{\rm j}\theta_k} {\rm e}^{2\pi\, {\rm j} f_k t_n}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n=1,\ldots,N$ and the only restriction is that the $t_n$ are equispaced.&lt;/p&gt;&#xA;" OwnerUserId="1696" LastActivityDate="2013-01-04T18:25:20.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6420" PostTypeId="2" ParentId="6388" CreationDate="2013-01-04T18:59:15.430" Score="2" Body="&lt;p&gt;Your question is broadly answered here: &lt;a href=&quot;https://dsp.stackexchange.com/questions/1336/how-to-extract-traffic-signs-from-a-photograph/&quot;&gt;How to extract traffic signs from a photograph?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your specific case is a little more complicated because the signs are not particularly distinguishing, however the same suggested techniques of cross correlating the images with clean images of original signs (you will probably want a library of images containing all signs for best results) are still applicable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One suggestion above was to use an infrared camera which will be very effective if the road signs are micro prismatic or glass bead designs.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2013-01-04T18:59:15.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6421" PostTypeId="1" AcceptedAnswerId="6440" CreationDate="2013-01-04T19:34:48.123" Score="1" ViewCount="482" Body="&lt;p&gt;Reading about independent component analysis (ICA), I learned that one of its applications is face recognition. I think in this problem we have a database of images and a test image to be recognized. However, I can't figure out what the independent components are and what the mixture (multivariate signal) is.&lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="1059" LastEditDate="2013-01-05T04:36:45.900" LastActivityDate="2013-01-07T16:24:54.197" Title="Face recognition using independent component analysis (ICA)" Tags="|ica|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6422" PostTypeId="2" ParentId="6421" CreationDate="2013-01-05T04:45:41.207" Score="1" Body="&lt;p&gt;The basic idea in ICA is to separate a mixture into statistically independent components. Sometimes that's the end of the problem (e.g., solving the cocktail party problem). In face recognition the weights of the mixture components are used to create a feature vector to uniquely and succinctly identify a person. A notable difference is that you are trying to estimate the components not of one mixture, but of several (the faces, that is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's an enlightening presentation with code &lt;a href=&quot;http://scikit-learn.org/stable/modules/decomposition.html#independent-component-analysis-ica&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-01-05T04:45:41.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6424" PostTypeId="2" ParentId="6138" CreationDate="2013-01-05T19:39:20.940" Score="4" Body="&lt;p&gt;I'm converting some of my comments from above into this answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are trying to detect the presence of some pulse shape $p(t)$ on the AWGN channel, then the optimum detector uses a filter that is matched to the pulse shape $p(t)$ (aptly named the &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;matched filter&lt;/a&gt;); this maximizes the signal-to-noise ratio (SNR) at the output of the filter and thus provides the best detection statistic. This approach is equivalent to a sliding cross-correlation of the pulse shape with the observed signal, expressed mathematically as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;d(t) = x(t) * p(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x(t)$ is the observed signal and $d(t)$ is the resulting detection statistic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main problem, therefore, consists of selection of an appropriate threshold that can be used to determine where the pulses of interest occur in $x(t)$. Specifically, one would indicate a detection when $d(t) &amp;gt; T$, where $T$ is a threshold used to balance between two opposing performance metrics: &lt;em&gt;probability of detection&lt;/em&gt; $P_d$ and &lt;em&gt;probability of false alarm&lt;/em&gt; $P_{fa}$. &lt;a href=&quot;https://dsp.stackexchange.com/questions/2104/what-statistic-is-used-to-determine-presence-of-a-signal-in-noise/2105#2105&quot;&gt;Here is a link to a previous answer where I talk about the tradeoff a bit more&lt;/a&gt;. Target values for these metrics would be chosen according to the requirements for your specific application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this case, we can come up with general expressions for $P_d$ and $P_{fa}$ pretty easily:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Probability of false alarm:&lt;/strong&gt; A &quot;false alarm&quot; indicates a case where the detector reports the presence of the target pulse $p(t)$ when it is in fact not present. Since we've defined the channel to be AWGN, that means that for a false alarm, the input signal $x(t)$ is a white Gaussian noise (WGN) process. Without loss of generality, we will assume that noise to be zero-mean with variance $\sigma^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine $P_{fa}$, we are concerned with what the signal at the output of the matched filter looks like. Recall that $d(t)$ is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;d(t) = x(t) * p(t) = \int_{-\infty}^{\infty} x(\tau) p(t-\tau) d\tau&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that $x(t)$ is a white Gaussian noise process with variance $\sigma^2$, it can be shown that $d(t)$ will also be Gaussian, with a variance equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sigma_d^2 = \sigma^2 \int_{-\infty}^{\infty} |p(t)|^2 dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, the variance at the output of the matched filter is just scaled by the total energy of the pulse waveform $p(t)$. The detection statistic $d(t)$ is then just a Gaussian process with variance $\sigma_d^2$. The probability of a false alarm at any given time $t$ is equal to the probability that the detection statistic exceeds the threshold $T$. Using the properties of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Normal_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian distribution&lt;/a&gt;, we can write this as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;P_{fa} &amp;amp;= P(d(t) &amp;gt; T\ | \text{ no signal present}) \\&#xA;&amp;amp;= 1 - F_d(T) \\&#xA;&amp;amp;= Q\left(\frac{T}{\sigma_d}\right)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $F_d(d)$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cumulative_distribution_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;cumulative distribution function (CDF)&lt;/a&gt; of the Gaussian distribution and $Q(x)$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Q-function&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q-function&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Probability of detection:&lt;/strong&gt; This case differs from the false-alarm case in that the signal of interest is present. Specifically, we examine the situation where the matched filter is perfectly aligned with the pulse of interest. The same noise component that we analyzed previously is present, but the autocorrelation of the desired pulse shape gives it a non-zero mean. This mean is equal to the total energy of the pulse waveform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbb{E}\left(d(t)\right) = \int_{-\infty}^{\infty} |p(t)|^2 dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability of detection, therefore, is the probability that the detection statistic exceeds threshold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;P_{d} &amp;amp;= P(d(t) &amp;gt; T\ | \text{ signal present}) \\&#xA;&amp;amp;= 1 - F_d(T) \\&#xA;&amp;amp;= Q\left(\frac{T - m_d}{\sigma_d}\right)&#xA;\end{align}&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The design process would then look like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Select an operating range for your detector, defining a minimum signal-to-noise ratio (or equivalently, a maximum noise variance $\sigma^2$) at which you will operate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assuming the worst-case conditions (i.e. the maximum noise level), select a threshold $T$ that meets either your required $P_d$ or $P_{fa}$ (whichever is more important to you).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Plug the resulting value for $T$ into the other equation to determine your predicted performance metrics.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is a pretty high-level treatment of the problem, and if you get down to business trying to build something that works practically, you'll run into some other details of note:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;One thing that may be relevant for your problem of detections sinusoids is that it's likely that the received pulses will be at some unknown starting phase $\phi$ relative to your template pulse shape $p(t)$. You would then observe a reduction in the correlation peak based on the amount of phase offset, which will wreak havoc with your detector's performance. If that is the case, a &lt;em&gt;noncoherent&lt;/em&gt; detector is a better approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;d_1(t) = x(t) * p(t)&#xA;$$&#xA;$$&#xA;d_2(t) = x(t) * p_Q(t)&#xA;$$&#xA;$$&#xA;d(t) = \sqrt{d_1^2(t) + d_2^2(t)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $p_Q(t)$ is a 90-degree shifted (or &lt;em&gt;quadrature&lt;/em&gt;) version of the template sinusoidal pulse. The statistics of this case are slightly different and are left as an exercise for the interested reader.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The above treatment assumes that the pulse is received in $x(t)$ at the same power level as the template $p(t)$, which is almost certain to be untrue. Two ways to approach this complication come to mind: either use some sort of automatic gain control (AGC) process in order to steer the received power level to what you would expect, or you can make $T$ an adaptive threshold that adjusts itself relative to the observed signal (e.g. you could try to estimate the background noise variance $\sigma^2$ and then set $T$ appropriately).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-05-18T16:52:32.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6425" PostTypeId="1" AcceptedAnswerId="6427" CreationDate="2013-01-06T08:04:40.477" Score="0" ViewCount="353" Body="&lt;p&gt;How do I implement an Infinite Impulse Response (IIR) filter using Finite State Machine(FSM)? The problem is FSM has finite memory, but an IIR filter has infinite outputs. The &lt;a href=&quot;https://ieeexplore.ieee.org/document/48698&quot; rel=&quot;nofollow noreferrer&quot;&gt;closest match is this paper &lt;/a&gt; . Unfortunately I do not have access to the paper.&lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="7092" LastEditDate="2022-04-18T12:09:36.760" LastActivityDate="2022-04-18T12:09:36.760" Title="Implementing IIR filter using FSM" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6426" PostTypeId="1" CreationDate="2013-01-06T15:54:34.027" Score="1" ViewCount="44" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Possible Duplicate:&lt;/strong&gt;&lt;br&gt;&#xA;  &lt;a href=&quot;https://dsp.stackexchange.com/questions/6436/looking-for-algorithm-to-extract-line-network-from-binary-images-within-labview&quot;&gt;Looking for algorithm to extract line network from binary images within LabView&lt;/a&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;I would like to create a LabView VI that receives an input image and the RGB-color codes of the powerlines depicted in the image. The output should (eventually) consist of id'd polygonial connections and their coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now i've finished creating a VI that converts the source image to a binary image with the respective line color types extracted into a binary image (see below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to apply some of edge/line finding VIs supplied by LabView Vision, but the results have not been very convincing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have considered implementing some sort of vectorization algorithm like '&lt;a href=&quot;http://www.kellogg.northwestern.edu/faculty/vanmieghem/htm/pubs/straightlineextraction_vcir1995.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight Line Extraction Using Iterative Total Least Squares Methods&lt;/a&gt;' or even some sort of line-walking-and-mapping algorithm, but before I do so I'd like to know if there already is some kind of fitting algorithm out there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attached you can find examples for the source and binary images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/40Yd3.jpg&quot; alt=&quot;Source image (in this case a snipped of poland)&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xCc20.jpg&quot; alt=&quot;binary image of extracted green lines&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eWRkn.jpg&quot; alt=&quot;binary image of extracted red lines&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also the &lt;a href=&quot;https://stackoverflow.com/questions/14183187/looking-for-algorithm-to-extract-line-network-from-binary-images-within-labview&quot;&gt;Stack Overflow&lt;/a&gt; version&lt;/p&gt;&#xA;" OwnerUserId="3560" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2013-01-07T05:08:25.813" Title="Looking for algorithm to extract line network from binary images" Tags="|computer-vision|algorithms|" AnswerCount="0" CommentCount="1" FavoriteCount="0" ClosedDate="2013-01-07T22:20:35.200" ContentLicense="CC BY-SA 3.0" />
  <row Id="6427" PostTypeId="2" ParentId="6425" CreationDate="2013-01-06T18:23:46.973" Score="1" Body="&lt;p&gt;Use feedback from output to input to perpetuate the output of the state machine.  You don't need an infinite number of states to produce an infinitely long output sequence.  For example, a state machine with a single memory element and feedback can be used to implement a first order IIR filter.  An example of such a system has the recursion relationship y[n] = 0.5y[n-1] + x[n] where y is the output x is the input and 0.5y[n-1] is the past output scaled, fedback and summed with the input x[n].&lt;/p&gt;&#xA;" OwnerUserId="3517" LastEditorUserId="3562" LastEditDate="2013-01-07T05:09:15.653" LastActivityDate="2013-01-07T05:09:15.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6428" PostTypeId="1" AcceptedAnswerId="6441" CreationDate="2013-01-06T21:38:01.270" Score="11" ViewCount="6603" Body="&lt;p&gt;I'm studying OpenCV and, in computer vision and image processing, people speak of blobs, contours, connected regions, and I sometimes hear the phrase &quot;image moments&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know of an article on &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_moment&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia about it&lt;/a&gt;, but I think it is too technical. I don't really want to go deep into the math background but I want to know what I'm talking about. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone explain to me what image moments are in plain English?&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="76" LastEditDate="2013-01-07T05:08:43.440" LastActivityDate="2013-01-07T19:56:47.267" Title="Digital image moments in plain English" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6430" PostTypeId="2" ParentId="6397" CreationDate="2013-01-06T22:50:10.240" Score="0" Body="&lt;p&gt;It seems that there is an implicit assumption that the signal of interest has a fundamental of 50Hz.  If this is the case, why not just collect N consecutive samples of the signal where N*T (T being the period of your sampling clock) is known to just exceed the period of the signal of interest(1/50Hz)?  The FFT doesn't care where you start or stop your cycle as long as you capture a complete cycle.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-06T22:50:10.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6434" PostTypeId="2" ParentId="6428" CreationDate="2013-01-07T07:27:37.307" Score="8" Body="&lt;p&gt;An image moment is simply a number that characterizes the image, construed as the realization of a spatial random variable. If you've taken any probability class, you should &lt;a href=&quot;http://en.wikipedia.org/wiki/Moment_%28mathematics%29&quot;&gt;remember&lt;/a&gt; the concepts of mean and variance, which are derived from the first and second moments of the random variable (the n'th moment of an r.v. is the expectation of its n'th power). Furthermore, the moments of a random variable collectively prescribe its distribution. In other words, you can reduce a probability distribution to a sequence of numbers, and this is useful when you want to compare distributions numerically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In image processing, if you want to compare images, you might not want the comparison to be sensitive to minor things like rotation, translation, and scale (since the image remains fundamentally the same). Thus the motivation behind invariant moments you see in the Wikipedia article you cited.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-01-07T07:27:37.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6435" PostTypeId="1" CreationDate="2013-01-07T09:35:20.920" Score="0" ViewCount="592" Body="&lt;p&gt;Are the following sequence of operations the same -&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Down-sampling filtering followed by gradient filtering with kernel [-1 0 1]&lt;/li&gt;&#xA;&lt;li&gt;Gradient filtering with kernel [-1 0 1] followed by down-sampling&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Could you point me to some math which can answer this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, I am thinking that these operations are the same. That is because down-sampling can be loosely modeled as low-pass filtering and since convolution is associative, I guess they should produce similar results. But I am not able to quantitatively prove this to be a fact.&lt;/p&gt;&#xA;" OwnerUserId="1860" LastActivityDate="2013-01-07T13:07:46.147" Title="Downsampling and Gradient filtering" Tags="|lowpass-filter|downsampling|gradient|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6436" PostTypeId="1" AcceptedAnswerId="6437" CreationDate="2013-01-06T14:44:51.020" Score="1" ViewCount="1358" Body="&lt;p&gt;I would like to create a LabView VI that receives an input image and the RGB-color codes of the powerlines depicted in the image. The output should (eventually) consist of id'd polygonial connections and their coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now i've finished creating a VI that converts the source image to a binary image with the respective line color types extracted into a binary image (see below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to apply some of edge/line finding VIs supplied by LabView Vision, but the results have not been very convincing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have considered implementing some sort of vectorization algorithm like '&lt;a href=&quot;http://www.kellogg.northwestern.edu/faculty/vanmieghem/htm/pubs/straightlineextraction_vcir1995.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Straight Line Extraction Using Iterative Total Least Squares Methods&lt;/a&gt;' or even some sort of line-walking-and-mapping algorithm, but before I do so I'd like to know if there already is some kind of fitting algorithm out there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attached you can find examples for the source and binary images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your input!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/40Yd3.jpg&quot; alt=&quot;Source image (in this case a snipped of poland)&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xCc20.jpg&quot; alt=&quot;binary image of extracted green lines&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eWRkn.jpg&quot; alt=&quot;binary image of extracted red lines&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3560" OwnerDisplayName="Igby" LastActivityDate="2013-01-07T12:45:14.300" Title="Looking for algorithm to extract line network from binary images within LabView" Tags="|computer-vision|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6437" PostTypeId="2" ParentId="6436" CreationDate="2013-01-06T16:52:50.403" Score="3" Body="&lt;p&gt;The go-to algorithm for extracting edges is to transform the image the an appropriate &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow&quot;&gt;Hough space&lt;/a&gt;. Luckily, the Hough transformation for extracting straight lines is one of the best documented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like &lt;a href=&quot;http://live.ece.utexas.edu/class/siva/siva_dip/siva_dip.htm&quot; rel=&quot;nofollow&quot;&gt;these folks&lt;/a&gt; may have a Hough transformation implementation for LabVIEW you could use. If not, it's a pretty well documented algorithm and you could try to roll your own or try to integrate an implementation from another language, eg: &lt;a href=&quot;http://www.mathworks.es/es/help/images/analyzing-images.html#f11-27827&quot; rel=&quot;nofollow&quot;&gt;MatLab&lt;/a&gt;, &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html&quot; rel=&quot;nofollow&quot;&gt;OpenCV&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the appropriate Hough transformation, you would be able to extract line segments from your image (converting to a binary image is a &lt;em&gt;great&lt;/em&gt; start). These line segments may not connect perfectly, depending on how straight your line is and how clear your image is, and you may need to process the vectors a bit more to get the results you desire.&lt;/p&gt;&#xA;" OwnerUserId="3564" OwnerDisplayName="Sean Connolly" LastActivityDate="2013-01-06T16:52:50.403" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6438" PostTypeId="2" ParentId="6435" CreationDate="2013-01-07T13:07:46.147" Score="2" Body="&lt;p&gt;As the commenters have stated, this is not the same. The relationships between down/up-sampling and filtering are formally described by the noble identities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case down-sampling followed by filtering with [-1 0 1] is equivalent to filtering with [-1 0 0 0 1] first and than downsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case you need to make sure your don't alias before down-sampling the picture. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-07T13:07:46.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6439" PostTypeId="1" CreationDate="2013-01-07T14:43:56.420" Score="3" ViewCount="135" Body="&lt;p&gt;I need to know the &quot;number of clusters&quot; in a dataaset.&lt;br&gt;&#xA;To find the number of clusters, I am using a Gaussian Mixture model fitting,&lt;br&gt;&#xA;bear with me,&lt;br&gt;&#xA;Because the underlying distributions (each cluster) are not Gaussian, the GM tends to give very bad fits, because it is trying to compensate for the skewness of the data by increasing the variance of the Gaussian it fits and things like this. I figured, I may be able to solve this by fitting more Gaussians than are clusters expected to be in the data and then based on the distance of clusters find out which ones are true clusters and which ones are fits to the same cluster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now my problem is&lt;/strong&gt; I have a distance matrix (Mahalanobis distances), distances between the fitted Gaussians coming out of the Gaussian mixture model, but I have no reliable way of &lt;strong&gt;counting the clusters&lt;/strong&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to make it a bit more clear, if I have two real clusters in the dataset, and I fit 6 Gaussians, I expect to get 1-5 of them fall on top of one of the real clusters and the remaining 5-1 of them on top of the other cluster. This means looking at the distance matrix I expect to see quite a few (maybe 5) large distances [these are between-cluster distances] and lots of small distances [within-cluster distances].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is a sample of the distance matrices I have, the dendrograms are just to help &quot;see&quot; the structure and have no additional information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gldcs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if anyone is interested in the raw(more raw) data, I can provide the data but if you don't have the domain specific knowledge (this is a spike sorting problem, in a neurophysiology context) it will not be easy for me to describe the data event in a few pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any comments?&lt;/p&gt;&#xA;" OwnerUserId="872" LastEditorUserId="872" LastEditDate="2013-01-07T16:46:51.460" LastActivityDate="2013-01-07T16:46:51.460" Title="Grouping clusters using Mahalanobis distances" Tags="|classification|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6440" PostTypeId="2" ParentId="6421" CreationDate="2013-01-07T16:24:54.197" Score="4" Body="&lt;p&gt;For your data set of images, first vectorize the images by raster scanning them, and making them vectors. Thus, say you have $M$ images, each of size 64*64 pixels. Then the total number of pixels per image is $N=64^2$, which means $N=4096$. Now, you have an image matrix of size $M\text{x}N$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this image matrix, what you want to do is find the $M$ independent components, of again, length $N$. In other words, you want to decompose this set of images into another set of images, except those images make up the independent components of the original faces. (Similar to eigen-faces, but different). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your question about the mixture, the set of faces that you start with &lt;em&gt;is&lt;/em&gt; the mixture. In other words, the set of faces that you have, is assumed to be a mixture of &lt;em&gt;independent&lt;/em&gt; faces that you are trying to find. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;ICA will find those independent features for you, and for natural images, independent components turn out to be features with extremely high kurtosis, namely, the edges. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-01-07T16:24:54.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6441" PostTypeId="2" ParentId="6428" CreationDate="2013-01-07T19:56:47.267" Score="8" Body="&lt;p&gt;Image moments are the same notion as in Mechanics. &#xA;The first order moment will give you the center of mass, where the mass of a pixel is its intensity, second order moment will tell you how this mass varies around the center of mass, etc. In the same way as you obtain a frame of inertia for a real world object, you can obtain one from the image moments. That will give you the principal axes of the shape you want to describe.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-01-07T19:56:47.267" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6442" PostTypeId="1" AcceptedAnswerId="6443" CreationDate="2013-01-07T22:49:06.807" Score="1" ViewCount="659" Body="&lt;p&gt;I'm sampling a signal at 44100kHz, and I have 1024 samples on which I perform an FFT.&#xA;My bin resolution is therefore around 43 hz/bin, so the frequencies I get energy for are multiples of 43hz: 43Hz,86Hz,129Hz etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I the frequency I need to calculate the energy for lies between those bins! Specifically, I have:&#xA;BIN[389]= 16750 Hz&#xA;BIN[390]= 16793 Hz&#xA;but I wish to calculate the energy for 16781Hz, 16824Hz,... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a mathematical manipulation I can pull off to get the info I need? zero padding? Or perhaps multiplying my sample by an exponent before performing an FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help&lt;/p&gt;&#xA;" OwnerUserId="3514" LastActivityDate="2013-01-07T23:57:04.940" Title="change FFT bins position" Tags="|fft|discrete-signals|zero-padding|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6443" PostTypeId="2" ParentId="6442" CreationDate="2013-01-07T23:37:03.923" Score="4" Body="&lt;p&gt;It's actually possible to pre-multiply the signal with a complex exponential and thus shift the center frequencies of the FFT bins. Particular useful is multiplication that shifts by half a bin since it maintains complex conjugate symmetry for real valued time domain signals and you end up with N/2 complex at N/2 frequencies instead with N/2+1 frequencies with N/2-1 complex numbers and two real numbers (Nyquist and DC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it really depends what you are trying to do. The interpretation of the FFT magnitude as a &quot;energy&quot; is a bit problematic. You are NOT just getting energy at the center frequency but a weighted sum of of the energies over a bunch of frequencies, where the weighting function has roughly a sin(x)/x shape. The frequency selectivity of an FFT is actually not particularly good and it's not a great tool to actually calculate the energy in a specific frequency band. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero padding can also be used to increase the frequency resolution, however you need to keep in mind that the FFT assumes discrete and PERIODIC signals so zero padding can only be done on signals that are trailing off sufficiently (like the impulse response of a filter) or when windowing is applied to mitigate the transition between signals and zeros.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-07T23:37:03.923" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6444" PostTypeId="2" ParentId="6442" CreationDate="2013-01-07T23:57:04.940" Score="2" Body="&lt;p&gt;If you used a rectangular window (e.g. the same as no window) on your signal before the FFT, then you can interpolate any point between bin centers using a Sinc interpolation kernel (a short window-ed Sinc interpolation kernel may be a good enough approximation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero-padding and using a longer FFT is the same as this interpolation, and may be computationally less effort if you need a lot of interpolated points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a &quot;bin&quot; contains not just one frequency, but really contains the result of a bandpass filter about 1 to 2 bins in width (and with lots of stop-band ripple unless using a suitable non-rectangular-shaped window). &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-01-07T23:57:04.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6445" PostTypeId="2" ParentId="4716" CreationDate="2013-01-08T04:34:08.310" Score="11" Body="&lt;p&gt;As suggested above, the Matlab Canny edge detector calculates the gradient using a &quot;derivative of a Gaussian filter&quot; (as stated in the documentation). In other words, Matlab does a Gaussian blur of the image and then finds the gradient of that smoothed image... all using a single fancy filter. [If you want to know the details, just type in &lt;code&gt;edit edge&lt;/code&gt; as Andrey suggested, and then scroll down to the &lt;code&gt;smoothGradient()&lt;/code&gt; function.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blurring operation significantly reduces the amount of noise present in the image, eliminating many spurious edges and leaving behind the good stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the OpenCV Canny function doesn't let you change the filter kernel it uses via the function parameters. However. &lt;strong&gt;You can generate the same results by first blurring the input image, and then passing this blurred image into the Canny function.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This significantly cleans up the resulting edge map. To blur the input image, I personally use OpenCV's &lt;code&gt;GaussianBlur()&lt;/code&gt; function with &lt;code&gt;sigmaX=2&lt;/code&gt;. This mimics the default sigma in Matlab. The best blurring kernel size can vary from case to case, but in Matlab it is calculated using &lt;code&gt;filterLength = 8*ceil(sigma);&lt;/code&gt;, so for a sigma of 2 that would mean a kernel size of &lt;code&gt;(16,16)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since both the Gaussian Blur and Sobel filters are linear, passing a blurred input image to the OpenCV &lt;code&gt;Canny()&lt;/code&gt; function is mathematically equivalent to what Matlab does because of the principle of superposition, as demonstrated in this pseudocode (note: &lt;code&gt;*&lt;/code&gt; is the convolution operator):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// The Matlab method: the sobel and blur operations are combined into&#xA;// a single filter, and that filter is then convolved with the image&#xA;matlabFancyFilter = (sobel * blur);&#xA;gradient = matlabFancyFilter * image;&#xA;&#xA;// Equivalent method: image is first convolved with the blur filter, and&#xA;// then convolved with the sobel filter.&#xA;gradient = sobel * (blur * image); // image is filtered twice&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is an &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html&quot;&gt;OpenCV Canny tutorial here&lt;/a&gt; that demonstrates how to do this using C++. I'm a python guy, so here is what I do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;smoothedInput = cv2.GaussianBlur(image, (7,7), 2);&#xA;edges = cv2.Canny(smoothedInput, 25, 50);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3570" LastActivityDate="2013-01-08T04:34:08.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6446" PostTypeId="1" AcceptedAnswerId="6447" CreationDate="2013-01-08T14:00:42.217" Score="12" ViewCount="22656" Body="&lt;p&gt;Both 4QAM and QPSK apparently produce the same waveform, but are they the same mathematically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a QPSK constellation, are the mapping points at 45, 135, 225 and 315 degrees while the 4QAM is at 0, 90, 180 and 270?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also struggle to understand the I/Q components of such a constellation diagram. What does &quot;inphase&quot; and &quot;quadrature-phase&quot; actually mean? Are they just another way to specify the real and imaginary part for this type of usage?&lt;/p&gt;&#xA;" OwnerUserId="3575" LastEditorUserId="3575" LastEditDate="2013-01-09T10:09:00.643" LastActivityDate="2019-08-18T22:52:12.147" Title="I and Q components and the difference between QPSK and 4QAM" Tags="|signal-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6447" PostTypeId="2" ParentId="6446" CreationDate="2013-01-08T15:08:13.913" Score="24" Body="&lt;p&gt;Both QPSK and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-QAM constellations have signal points at &lt;span class=&quot;math-container&quot;&gt;$45, 135, 225$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$315$&lt;/span&gt; degrees (note typo in your question).  They arise from &lt;em&gt;amplitude modulation&lt;/em&gt; (or, if&#xA;you prefer, &lt;em&gt;phase modulation&lt;/em&gt;) of two carrier signals&#xA;(called the inphase and quadrature carriers) that are orthogonal (meaning that they&#xA;differ in phase by 90 degrees.  The canonical representation of a QPSK or &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-QAM&#xA;signal during one symbol interval is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$s(t) = (-1)^{b_I}\cos(2\pi f_c t) - (-1)^{b_Q}\sin(2\pi f_c t)$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\cos(2\pi f_c t)$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$-\sin(2\pi f_c t)$&lt;/span&gt; are the &lt;em&gt;inphase&lt;/em&gt; and &lt;em&gt;quadrature&lt;/em&gt; carrier signals at&#xA;frequency &lt;span class=&quot;math-container&quot;&gt;$f_c$&lt;/span&gt; Hz&#xA;and &lt;span class=&quot;math-container&quot;&gt;$b_I, b_Q \in \{0,1\}$&lt;/span&gt;  are the two data bits (called the inphase&#xA;and quadrature data bits, naturally, since they are transmitted&#xA;on the inphase and quadrature carriers).  Notice that the &#xA;inphase carrier &lt;span class=&quot;math-container&quot;&gt;$\cos(2\pi f_c t)$&lt;/span&gt; has &lt;em&gt;amplitude&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or&#xA;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; according as the inphase data bit has value &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and&#xA;similarly the quadrature carrier &lt;span class=&quot;math-container&quot;&gt;$-\sin(2\pi f_c t)$&lt;/span&gt; has &lt;em&gt;amplitude&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or&#xA;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; according as the quadrature data bit has value &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&#xA;Some people regard this as an inversion of the normal scheme&#xA;of things, didactically asserting&#xA;that positive amplitudes must be associated with &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; data bits and&#xA;negative amplitudes with &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; bits. But if we look at it from the&#xA;&lt;em&gt;phase&lt;/em&gt; modulation perspective, a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; bit means that the carrier&#xA;(&lt;span class=&quot;math-container&quot;&gt;$\cos(2\pi f_c t)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-\sin(2\pi f_c t)$&lt;/span&gt; as the case may be) is &#xA;transmitted with &lt;em&gt;no change in phase&lt;/em&gt; while a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; data bit creates&#xA;a change in phase (we will think of it as a phase &lt;em&gt;delay&lt;/em&gt;)&#xA;of &lt;span class=&quot;math-container&quot;&gt;$180$&lt;/span&gt; degrees or &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; radians.  Indeed, another&#xA;way of expressing the QPSK/&lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-QAM signal is as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$s(t) = \cos(2\pi f_c t - b_I\pi) - \sin(2\pi f_c t - b_Q\pi)$$&lt;/span&gt;&#xA;which makes the phase modulation viewpoint very clear. But,&#xA;regardless of which viewpoint we use, during a symbol interval,&#xA;the  QPSK/&lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-QAM signal is one of the following &lt;em&gt;four&lt;/em&gt; signals:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{2}\cos\left(2\pi f_c t + \frac{\pi}{4}\right),\\&#xA;\sqrt{2}\cos\left(2\pi f_c t + \frac{3\pi}{4}\right),\\&#xA;\sqrt{2}\cos\left(2\pi f_c t + \frac{5\pi}{4}\right),\\&#xA;\sqrt{2}\cos\left(2\pi f_c t + \frac{7\pi}{4}\right)$$&lt;/span&gt;&#xA;corresponding to &lt;span class=&quot;math-container&quot;&gt;$(b_I,b_Q) = (0,0), (1,0), (1,1), (0,1)$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the viewpoint taken here is of QPSK as consisting of&#xA;two BPSK signals on &lt;em&gt;phase-orthogonal carriers&lt;/em&gt;. The demodulator&#xA;thus consists of two BPSK receivers (called the inphase branch&#xA;and quadrature branch, what else?).&#xA;An alternative view of QPSK as changing the phase&#xA;of a single carrier depending on a &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-valued symbol is developed a little later.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The QPSK/&lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-QAM signal can also be expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$s(t) = \text{Re}\{B \exp(j2\pi f_c t)\} &#xA;= \text{Re}\{[(-1)^{b_I}+j(-1)^{b_Q}] \exp(j2\pi f_c t)\}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is the &lt;em&gt;complex-valued baseband symbol&lt;/em&gt; taking on values&#xA;in &lt;span class=&quot;math-container&quot;&gt;$\{\pm 1 \pm j\}$&lt;/span&gt; and which, when plotted on the complex plane,&#xA;gives constellation points distant &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt; from the&#xA;origin and at  &lt;span class=&quot;math-container&quot;&gt;$45, 135, 225$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$315$&lt;/span&gt; degrees&#xA;corresponding to data bits &lt;span class=&quot;math-container&quot;&gt;$(b_I,b_Q) = (0,0), (1,0), (1,1), (0,1)$&lt;/span&gt;&#xA;respectively. Note that &lt;em&gt;complementary&lt;/em&gt; bit pairs lie diagonally across the circle from each other so that &lt;em&gt;double bit errors&lt;/em&gt; are less likely than single bit errors. Note also that the bits &lt;em&gt;naturally&lt;/em&gt;&#xA;occur around the circle in Gray code &lt;em&gt;order&lt;/em&gt;; there is no need to &lt;em&gt;massage&lt;/em&gt; a given &lt;em&gt;data&lt;/em&gt; bit pair &lt;span class=&quot;math-container&quot;&gt;$(d_I,d_Q)$&lt;/span&gt; (say &lt;span class=&quot;math-container&quot;&gt;$(0,1)$&lt;/span&gt;) from &quot;natural representation&quot; (where it means the integer &lt;span class=&quot;math-container&quot;&gt;$2 = d_I+2d_Q$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$d_I$&lt;/span&gt; is the LSB and &lt;span class=&quot;math-container&quot;&gt;$d_Q$&lt;/span&gt; the MSB here) to &quot;Gray code representation&quot; &lt;span class=&quot;math-container&quot;&gt;$(b_I,b_Q) = (1,1)$&lt;/span&gt; of the integer &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; as some implementations seem to insist&#xA;on doing. Indeed, such massaging leads to &lt;em&gt;poorer&lt;/em&gt; BER performance since the &lt;em&gt;decoded&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$(\hat{b}_I,\hat{b}_Q)$&lt;/span&gt; must be &lt;em&gt;ummassaged&lt;/em&gt; at the receiver into the &lt;em&gt;decoded data&lt;/em&gt; bits &lt;span class=&quot;math-container&quot;&gt;$(\hat{d}_I,\hat{d}_Q)$&lt;/span&gt; making the &lt;em&gt;single&lt;/em&gt; &lt;em&gt;channel&lt;/em&gt;  bit error &lt;span class=&quot;math-container&quot;&gt;$$(b_I,b_Q) = (1,1) \to (\hat{b}_I,\hat{b}_Q) = (1,0)$$&lt;/span&gt;&#xA;into the &lt;em&gt;double&lt;/em&gt; data bit error&#xA;&lt;span class=&quot;math-container&quot;&gt;$${(d_I,d_Q) = (0,1) \to (b_I,b_Q) = (1,1)\to (\hat{b}_I,\hat{b}_Q) = (1,0)}\to (\hat{d}_I,\hat{d}_Q) = (1,0).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If we &lt;em&gt;delay&lt;/em&gt; the four possible signals exhibited above by &lt;span class=&quot;math-container&quot;&gt;$45$&lt;/span&gt; degrees or&#xA;&lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; radians (subtract &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; radians from the argument of the cosinusoid), we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{2}\cos\left(2\pi f_c t + \frac{\pi}{4}\right)\Rightarrow \sqrt{2}\cos\left(2\pi f_c t + 0\frac{\pi}{2}\right) = \sqrt{2}\cos(2\pi f_c t),\\ \sqrt{2}\cos\left(2\pi f_c t + \frac{3\pi}{4}\right)\Rightarrow \sqrt{2}\cos\left(2\pi f_c t + 1\frac{\pi}{2}\right) = -\sqrt{2}\sin(2\pi f_c t),\\&#xA;\sqrt{2}\cos\left(2\pi f_c t + \frac{5\pi}{4}\right)&#xA;\Rightarrow \sqrt{2}\cos\left(2\pi f_c t + 2\frac{\pi}{2}\right) = -\sqrt{2}\cos(2\pi f_c t) \\&#xA;\sqrt{2}\cos\left(2\pi f_c t + \frac{7\pi}{4}\right)\Rightarrow \sqrt{2}\cos\left(2\pi f_c t + 3\frac{\pi}{2}\right) = \sqrt{2}\sin(2\pi f_c t),\\$$&lt;/span&gt;&#xA;which give the four constellation points at &lt;span class=&quot;math-container&quot;&gt;$0,90,180,270$&lt;/span&gt; degrees referred&#xA;to by the OP.  This form gives us another way of viewing QPSK signaling:&#xA;a single carrier signal whose phase takes on four values depending on&#xA;the input symbol which takes on values &lt;span class=&quot;math-container&quot;&gt;$\{0,1,2,3\}$&lt;/span&gt;. We express this in tabular form.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|c|c|c|c|c|}&#xA;\hline&#xA;(b_I,b_Q) &amp;amp; \text{normal value} ~k &amp;amp; \text{Gray code value} ~\ell &amp;amp; \text{signal as above} &amp;amp;\text{phase-modulated signal}\\&#xA;\hline&#xA;(0,0) &amp;amp; 0 &amp;amp; 0 &amp;amp; \sqrt{2}\cos(2\pi f_c t) &#xA;&amp;amp; \sqrt{2}\cos\left(2\pi f_c t - 0\frac{\pi}{2}\right)\\&#xA;(0,1) &amp;amp; 1 &amp;amp; 1 &amp;amp; \sqrt{2}\sin(2\pi f_c t) &#xA;&amp;amp; \sqrt{2}\cos\left(2\pi f_c t - 1\frac{\pi}{2}\right)\\&#xA;(1,1) &amp;amp; 3 &amp;amp; 2 &amp;amp; -\sqrt{2}\cos(2\pi f_c t)&#xA;&amp;amp; \sqrt{2}\cos\left(2\pi f_c t - 2\frac{\pi}{2}\right)\\&#xA;(1,0) &amp;amp; 2 &amp;amp; 3 &amp;amp; -\sqrt{2}\sin(2\pi f_c t) &#xA;&amp;amp; \sqrt{2}\cos\left(2\pi f_c t - 3\frac{\pi}{2}\right)\\&#xA;\hline&#xA;\end{array}&#xA;$$&lt;/span&gt;&#xA;That is, we can regard the QPSK modulator as having input&#xA;&lt;span class=&quot;math-container&quot;&gt;$(b_I,b_Q)$&lt;/span&gt; that it regards as the &lt;em&gt;Gray code&lt;/em&gt; representation&#xA;of the integer &lt;span class=&quot;math-container&quot;&gt;$\ell \in \{0,1,2,3\}$&lt;/span&gt; and produces the&#xA;output&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{2}\cos\left(2\pi f_c t - \ell\frac{\pi}{2}\right).$$&lt;/span&gt;&#xA;In other words, the &lt;em&gt;phase&lt;/em&gt; of carrier &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}\cos(2\pi f_c t)$&lt;/span&gt; is&#xA;&lt;em&gt;modulated&lt;/em&gt; (changed from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\ell\frac{\pi}{2}$&lt;/span&gt;) in&#xA;response to the input &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does this work in real life or MATLAB, whichever comes first?&#xA;If we define a QPSK signal as having value &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}\cos\left(2\pi f_c t - \ell\frac{\pi}{2}\right)$&lt;/span&gt; where the value of &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; is typed in as &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt; or &lt;code&gt;2&lt;/code&gt;&#xA;or &lt;code&gt;3&lt;/code&gt;, we &lt;em&gt;will&lt;/em&gt; get the QPSK signal described  above, but the&#xA;demodulator will produce the bit pair &lt;span class=&quot;math-container&quot;&gt;$(b_I, b_Q)$&lt;/span&gt; and we must&#xA;remember that the output is &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; in &lt;em&gt;Gray code&lt;/em&gt; interpretation,&#xA;that is, the demodulator output will be &lt;span class=&quot;math-container&quot;&gt;$(1,1)$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; happened&#xA;to have value &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, and interpreting output &lt;span class=&quot;math-container&quot;&gt;$(1,1)$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; is a &lt;em&gt;decoding&lt;/em&gt;&#xA;error that is not generally discussed in textbooks!&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2019-08-18T22:52:12.147" LastActivityDate="2019-08-18T22:52:12.147" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="6448" PostTypeId="1" CreationDate="2013-01-08T15:24:52.697" Score="12" ViewCount="341" Body="&lt;p&gt;I explain my question with a simplified example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can design an industrial vision system for the automatic inspection of an item with these main requirements:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the image of a good piece must be a black background and the piece must be grey.&lt;/li&gt;&#xA;&lt;li&gt;the defect must appear as a white area inside the grey area.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These requirements simplify a lot the software part of the system: in order to classify an item as defective the algorithm just counts the white pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in order to get this straightforward algorithm I have to be very good at designing the lighting/optical/mechanical part of the system and maybe that part will cost more than the software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe in the past I read a sentence like &lt;em&gt;&quot;do as much as possible with the mechanics and as little as possible with the software&quot;&lt;/em&gt;; it seems to me it was in a book of the 1990s (or 1980s) about practical machine vision but I can't find the proper citation/reference.&lt;/p&gt;&#xA;" OwnerUserId="3573" LastEditorUserId="3573" LastEditDate="2013-01-10T12:32:50.310" LastActivityDate="2013-11-09T07:43:37.693" Title="Any references for the trade-off between software and mechanics/optics in industrial machine vision systems?" Tags="|image-processing|computer-vision|algorithms|reference-request|theory|" AnswerCount="4" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6449" PostTypeId="1" CreationDate="2013-01-08T22:24:57.983" Score="6" ViewCount="684" Body="&lt;p&gt;I'm thresholding an image where the threshold value is a count of the pixels such that for instance if the threshold value is 100, any color value which has less than a 100 pixels is classified black and any color value which has greater than 100 pixels is classified as white. Right now, I'm using a manual method of specifying a threshold value. Are there any options that I can use for automatically finding the threshold in this case ?&lt;/p&gt;&#xA;" OwnerUserId="1911" LastActivityDate="2013-02-27T12:25:43.467" Title="Adaptive thresholding based on number of pixels" Tags="|image-processing|image-segmentation|thresholding|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6450" PostTypeId="2" ParentId="6291" CreationDate="2013-01-09T03:37:51.050" Score="6" Body="&lt;p&gt;If a linear time-invariant system has (deterministic) input $x(t)$ and output $y(t)$, then the &lt;em&gt;cross-correlation&lt;/em&gt; function $R_{y,x}$ of the output and input has value $h \star R_{x,x}$ where $R_{x,x}$ is the &lt;em&gt;autocorrelation&lt;/em&gt; function of the input signal and $h$ is the impulse response of the linear system.  For completeness, the &lt;em&gt;autocorrelation&lt;/em&gt; function $R_{y,y}$ of the output is given by&#xA;$$R_{y,y} = h\star \tilde{h}\star R_{x,x} = (h\star\tilde{h})\star R_{x,x} = R_{h,h}\star R_{x,x}$$&#xA;where $\tilde{h}(t) = h(-t)$ is the impulse response $h$ with time reversed, and $R_{h.h}$&#xA;is the autocorrelation function of the impulse response signal $h$.  In the frequency domain, this relation is the familiar power spectral density relationship&#xA;$$S_y(f) = |H(f)|^2 S_x(f).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming back to the business at hand, suppose that $x$ is a &lt;em&gt;periodic&lt;/em&gt; signal with&#xA;a &lt;em&gt;very&lt;/em&gt; long period, much longer than the &lt;em&gt;measurable&lt;/em&gt; duration of the impulse&#xA;response $h$. Then, the output signal $y$ also has the same period, and essentially looks like periodic repetitions of $h\star \hat{x}$ where $\hat{x}$ denotes one period&#xA;of $x$..  The input autocorrelation function&#xA;$R_{x,x}$ is also a periodic signal and thus $R_{y,x}$ looks like periodic &#xA;repetitions of $h\star \hat{R}_{x,x}$ where $\hat{R}_{x,x}$ is the &lt;em&gt;periodic&lt;/em&gt;&#xA;autocorrelation function of $\hat{x}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, suppose that $\hat{R}_{x,x}$ is an impulse and $R_{x,x}$ is&#xA;thus a periodic impulse train with very long period.  Then,  $R_{y,x}$&#xA;is just periodic repetitions of $h$, the impulse response that we seek. &#xA;Now, this is all fine and dandy but everyone knows that impulses&#xA;don't exist in real life and money can't buy happiness. But as&#xA;the vulgar rich know, and all others suspect, money&#xA;can buy the most remarkable substitutes for happiness. Similarly, there exist&#xA;signals whose periodic autocorrelation functions &lt;em&gt;approximate&lt;/em&gt; impulses.&#xA;If $\hat{R}_{x,x}(0)$ is &lt;em&gt;very large&lt;/em&gt; while $\hat{R}_{x,x}(\tau)$&#xA;is &lt;em&gt;very small&lt;/em&gt;, possibly even $0$, for all other $\tau$,&#xA;then $\hat{R}_{x,x}$ is essentially impulse-like. Even better,&#xA;such signals can even be chosen to be two-valued. They are, of course,&#xA;the binary $m$-sequences, also known as maximal-length linear feedback&#xA;shift register sequences. A $m$-bit linear feedback shift register&#xA;whose feedback connections are specified by a primitive binary&#xA;polynomial of degree $m$ produces a sequence of period $2^m-1$.&#xA;If the clock cycle duration is $T$ seconds, the output waveform&#xA;from the shift register has period $(2^m-1)T$ seconds. Regarded&#xA;as a two-level waveform with levels $\pm 1$, the periodic autocorrelation&#xA;function has a peak value of $(2^m-1)T$ which is &lt;em&gt;very large&lt;/em&gt;&#xA;compared to the off-peak value of $-T$, and indeed the difference&#xA;can be made &lt;em&gt;very large&lt;/em&gt; even with moderate values of $m$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, how does all this work? The input is a periodic &lt;strong&gt;two-level&lt;/strong&gt; $m$-sequence&#xA;signal whose periodic autocorrelation is the proverbial inverted&#xA;thumbtack function. We compute the cross-correlation of the output&#xA;and input signals, effectively getting the impulse response of the &#xA;system as the result. True, the result is actually the response to&#xA;periodic thumbtacks but the discrepancy can be made small. Note also&#xA;that we get the impulse response &lt;strong&gt;without having an impulse&#xA;applied to the system&lt;/strong&gt;. This is important: most linear systems&#xA;are actually nonlinear systems operated in a regime where the&#xA;signals are small in amplitude, and the excursions from the&#xA;nominal operating point are small enough that the tangent to&#xA;the (nonlinear) operating curve works well enough as a substitute&#xA;for the &lt;em&gt;exact&lt;/em&gt; response (small-signal analysis). So, the input&#xA;is low-level but by a miracle of modern mathematics, we are&#xA;able to &lt;em&gt;compute&lt;/em&gt; the response of the linearized version&#xA;of the nonlinear system to an impulse without using a large&#xA;signal that will blow fuses and drive the system into saturation,&#xA;overload, etc.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-01-09T13:01:39.557" LastActivityDate="2013-01-09T13:01:39.557" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6451" PostTypeId="1" AcceptedAnswerId="6455" CreationDate="2013-01-09T04:51:01.660" Score="4" ViewCount="398" Body="&lt;p&gt;I'm reading &lt;a href=&quot;http://szeliski.org/Book/&quot; rel=&quot;nofollow&quot;&gt;Computer Vision: Algorithms and Applications&lt;/a&gt; wich is available online as a PDF and on Chapter 3.2 page 111 it introduces convolution operators for images giving the formulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$g(i, j) = \Sigma_{k,l} f(i − k, j − l)h(k, l) = \Sigma_{k,l}f(k, l)h(i − k, j − l)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since $(i,j)$ are pixel coordinates $f$ is the pixel intensity function for the image we're convolving and $h$ is the function for the convolution matrix it makes sense to me that $g(i,j)$ is equal to the first sum expression but I can't wrap my head around how this is equivalent to the second sum expression. If someone could explain this I would really appreciate it.&lt;/p&gt;&#xA;" OwnerUserId="3576" LastActivityDate="2013-01-09T12:57:37.737" Title="Help Understanding Convolution Filter Formulation" Tags="|image-processing|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6452" PostTypeId="1" AcceptedAnswerId="6457" CreationDate="2013-01-09T10:58:58.480" Score="22" ViewCount="30247" Body="&lt;p&gt;What does High frequency and low frequency component signify in an image.&#xA;How to separate out the high frequency as well as low frequency component of an image using Bilateral filter.&lt;/p&gt;&#xA;" OwnerUserId="1757" LastEditorUserId="128" LastEditDate="2019-09-26T13:51:08.867" LastActivityDate="2020-06-25T06:06:17.257" Title="How to Extract High Frequency and Low Frequency Component Using Bilateral Filter?" Tags="|filters|image-processing|multi-scale-analysis|edge-preserving-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6453" PostTypeId="1" AcceptedAnswerId="6454" CreationDate="2013-01-09T11:00:55.707" Score="2" ViewCount="2100" Body="&lt;p&gt;I'm wondering why the following code for GNU Octave appears to be incorrect in the frequency domain by a magnitude of 2. For example, in Figure 1. (Sorry, I'm apparently not allowed to post images!) it can be seen that the -3dB points of the bandpass butterworth filter are at 150 and 300Hz instead of the design requirement of 300 and 600Hz. I can't really see that I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Start from nothing!&#xA;clear;&#xA;&#xA;% Set the sampling frequency used by our digital filtering system:&#xA;fs=8000;&#xA;&#xA;% Start designing a butterworth filter, passband. (In Hz)&#xA;pass_lo = 300;&#xA;pass_hi = 600;&#xA;&#xA;% The order of the filter&#xA;order = 4;&#xA;&#xA;% Determine the low and high frequencies of the passband as fractions of the&#xA;% sampling rate:&#xA;flo = pass_lo/fs;&#xA;fhi = pass_hi/fs;&#xA;&#xA;% Use the butterworth filter design function to get the coefficients for a&#xA;% bandpass filter with the settings above:&#xA;[b,a] = butter(order, [flo fhi]);&#xA;&#xA;% Determine the frequency response of the filter design above. Get the output&#xA;% in frequency rather than rad/s. Use 512 plot points.&#xA;[H,f] = freqz(b, a, 512, fs);&#xA;&#xA;% Plot the result so that we can see if it is correct:&#xA;figure(1);&#xA;plot(f, 20*log10(abs(H)));&#xA;xlabel('Frequency (Hz)');&#xA;ylabel('Magnitude (dB)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2013-01-09T12:46:44.497" Title="Frequency Response Error for IIR Butterworth in GNU Octave" Tags="|frequency|octave|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6454" PostTypeId="2" ParentId="6453" CreationDate="2013-01-09T12:46:44.497" Score="3" Body="&lt;p&gt;Don't know about GNU but in Matlab the frequency argument is specified relative to the Nyquist frequency (fs/2) and not the sample rate itself (fs). This makes the maxium legal argument for a relative cutoff frequency 1 (instead of 0.5). Your frequency argument should be [flo fhi]/fs*2.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-09T12:46:44.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6455" PostTypeId="2" ParentId="6451" CreationDate="2013-01-09T12:57:37.737" Score="6" Body="&lt;p&gt;Te elaborate on nikie's comment that it is just a change of variables, consider the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that the original image is a single pixel of intensity $1$ at point $(0,0)$&#xA;and all other pixels have intensity $0$. Then,&#xA;the result of the convolution of this image is $h(i,j)$, that is, this&#xA;single pixel in the original image produces pixel intensity $h(i,j)$ at&#xA;the point $(i,j)$.  The actual image is a whole bunch of pixels, though, at&#xA;different points, and the superposition principle says that the resulting&#xA;pixel intensity $g(i,j)$ at point $(i,j)$ is the sum of of the pixel intensities&#xA;produced by the various pixels in the original image. &#xA;There are two ways of calculating $g(i,j)$.&#xA;Let's go through the pixels in the original image in order of their&#xA;distance from the point $(i,j)$.  Well, the point $(i-k,j-l)$ is at distance&#xA;$(k,l)$ from $(i,j)$ and the pixel intensity $f(i-k,j-l)$ there&#xA;produces intensity $f(i-k,j-l)h(k,l)$ at $(i,j)$.  This gives the first&#xA;formula&#xA;$$g(i,j) = \sum_k\sum_l f(i-k,j-l)h(k,l).$$&#xA;Alternatively, we can go through the pixels in natural order and ask&#xA;what intensity the pixel $f(k,l)$ produces at the point $(i,j)$. Well,&#xA;the distance is $(i-k,j-l)$ and so the intensity is $f(k,l)h(i-k,j-l)$&#xA;giving&#xA;$$g(i,j) = \sum_k\sum_l f(k,l)h(i-k,j-l).$$&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-01-09T12:57:37.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6456" PostTypeId="1" AcceptedAnswerId="6458" CreationDate="2013-01-09T15:40:44.210" Score="1" ViewCount="2977" Body="&lt;p&gt;Sorry, two questions in one day!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm struggling to understand what I'm doing wrong in this very simple filter design. I want to design a simple, single pole low pass filter and implement it as an IIR in an embedded system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was looking at the DSP book online at recursive filters, and using their single-pole example to get started: &lt;a href=&quot;http://www.dspguide.com/ch19/1.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch19/1.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the next page the coefficients I should need for the IIR single pole low pass filter are:&#xA;$a_0=1-x$ and $b_1=x$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get $x$ they give the equation (19-5) of $x=\epsilon^{-2\pi f_c}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given an fc of 0.125, I calculate x = 0.455938. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An fc of 0.125 at a sampling rate of 8kHz is 1kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see why when I try to get the frequency response of this filter I end up with entirely positive gain, as shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.valvers.com/wp-content/uploads/2013/01/butterworth-lowpass-positive-gain.jpg&quot; rel=&quot;nofollow&quot;&gt;http://www.valvers.com/wp-content/uploads/2013/01/butterworth-lowpass-positive-gain.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I've been using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Start from nothing!&#xA;clear;&#xA;&#xA;% Set the sampling frequency used by our digital filtering system:&#xA;fs=8000;&#xA;&#xA;% Set the coefficients up (As already worked out!) for a single-pole low pass&#xA;% filter. This should give us -3dB @ 1kHz with -6dB/Octave roll off&#xA;a = [ 0.544062 ];&#xA;b = [ 1, 0.45594 ];&#xA;&#xA;% Determine the frequency response of the filter design above. Get the output&#xA;% in frequency rather than rad/s. Use 64 plot points.&#xA;[H,f] = freqz(b, a, 64, fs);&#xA;&#xA;% Show our cutoff frequency&#xA;cutoff = -3 * ones(64);&#xA;&#xA;% Plot the result so that we can see if it is correct:&#xA;figure(1);&#xA;plot(f, 20*log10(abs(H)), f, cutoff);&#xA;xlabel('Frequency (Hz)');&#xA;ylabel('Magnitude (dB)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm again, just stumped as to what's going on, and don't know how to solve the issue.&lt;/p&gt;&#xA;" OwnerUserId="3579" LastActivityDate="2013-06-21T13:17:41.610" Title="Why is the gain of my IIR filter positive?" Tags="|frequency-response|infinite-impulse-response|octave|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6457" PostTypeId="2" ParentId="6452" CreationDate="2013-01-09T16:24:13.623" Score="29" Body="&lt;p&gt;Similar to one dimensional signals, low frequencies in images mean pixel values that are changing slowly over space, while high frequency content means pixel values that are rapidly changing in space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the following image has strong low frequency components: You can intuitively see how I simply have a sin-wave propagating at some low frequency. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/UfTJw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, this image below is composed of a sin wave at double the above frequency. Notice how this manifests itself on the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZmKVC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any image can have any number of low and high frequency components together as well. For example, and image like this has both low and high frequency components:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kdRp8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see how you have a low-frequency 'trend', but also a lot of high frequency detail across the image. (Roughly speaking, in images, sharp transients like edges correspond to high frequencies, while long unchanging spaces correspond to low frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now, the point of an application of a bilateral filter (which is simply a convolution of your image with a gaussian kernel), is to remove &lt;em&gt;high&lt;/em&gt; frequency components, and retain your lower frequency components. So in this case, what happens if we convolve the above image, with a gaussian (bilateral) filter that looks like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mOBpu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we use this as our kernel, we will get the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JXKjS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, we have removed the high frequency components of the original image, but kept the low frequency components, since the variance of the gaussian kernel was chosen appropriately. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-01-09T16:24:13.623" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6458" PostTypeId="2" ParentId="6456" CreationDate="2013-01-09T17:54:22.140" Score="1" Body="&lt;p&gt;You have your &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; vectors reversed. For a first-order IIR filter, the a vector should have two elements (and you almost always want the first element to be unity). So, you're plotting the frequency response of the filter with difference equation $0.544062y[n]=x[n]+0.45594x[n−1]$, which is not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, as a note on MATLAB syntax, you'll also need to negate the second element of &lt;code&gt;a&lt;/code&gt; (multiply it by &lt;code&gt;-1&lt;/code&gt;) in order to get what you want. Read the documentation on functions that take IIR filter coefficients to learn why.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-01-09T17:54:22.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6459" PostTypeId="2" ParentId="6456" CreationDate="2013-01-09T17:57:45.977" Score="0" Body="&lt;p&gt;Yep, a and b reversed, AND x has the wrong sign. What you want is a=[1 -x]; b=1-x; The way that x is calculated seems also a bit off. A &quot;real&quot; low pass typically 0 gain at the Nyquist frequency. Taking into a account the bilinear transform you would want something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = tan(fc*pi); a=[1 -x]; b=[(1-x) (1-x)]/2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-09T17:57:45.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6462" PostTypeId="1" AcceptedAnswerId="6465" CreationDate="2013-01-09T18:48:57.823" Score="4" ViewCount="1111" Body="&lt;p&gt;I was confused about the double hat notation &lt;span class=&quot;math-container&quot;&gt;$\hat{\hat .}$&lt;/span&gt; and my teacher and I thought it probably means an estimate of an estimate most of the time, but we could not be 100% sure of its meaning.&lt;/p&gt;&#xA;&lt;p&gt;One hat &lt;span class=&quot;math-container&quot;&gt;$\hat .$&lt;/span&gt; is an estimate but what does this double hat usually mean? Does it have many different meanings in DSP? Can it mean an estimate of unit vector sometimes? Does it have other signs whatever it means?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;You can see such double hat on page such as 213 in Prentice Hall - Modeling Of Dynamic Systems book. In the chapter on Periodograms: Blackman-Tukey's Method, they use this kind of spectral estimate for N length function:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat\phi_N(\omega)=\int_{-\pi}^{\pi}W_\gamma (\omega-\xi)\hat{\hat{\phi}}_N(\xi)d\xi$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1824" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-01-09T22:46:37.217" Title="What does double hat mean in Spectral theory?" Tags="|power-spectral-density|terminology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6464" PostTypeId="1" CreationDate="2013-01-09T18:53:46.563" Score="8" ViewCount="408" Body="&lt;p&gt;I'm following a computer vision course and I have this exercise: write a program that, given an hand image, it can recognize if the hand is open, closed, in a punch, or holding an &quot;ok&quot; posture, using only the techniques provided till now (pixel 4/8 connected, connected region, contour finding, holes finding, blob property like centroid, area, perimeter, eccentricity, image moments, image transformation like invert/power/log/gamma correction/contrast stretching, histogram computation and equalization).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done it with some basic blob properties(closed hand has a low eccentricity, &quot;ok&quot; has a hole, open hand has a big difference between the area of the inscribed ellipse in the blob and the blob area itself with a low eccentricity).. It seems to work but the first image is a little bit problematic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think there could be something more to make a more robust algorithm. Maybe some kind of moment property? Could some blob axis/orientation/extreme points help? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS test images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XtOiG.jpg&quot; alt=&quot;ok2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZznjD.jpg&quot; alt=&quot;ok&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8xtwC.jpg&quot; alt=&quot;open&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/89BT5.jpg&quot; alt=&quot;punch&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="1059" LastEditDate="2013-01-11T23:39:56.733" LastActivityDate="2013-04-30T04:59:54.450" Title="Gesture recognition using only simple techniques" Tags="|computer-vision|homework|object-recognition|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6465" PostTypeId="2" ParentId="6462" CreationDate="2013-01-09T19:23:24.263" Score="2" Body="&lt;p&gt;It seems this notation is used for empirical transfer function estimates (see pg. 207, &lt;em&gt;8.4 Fourier Analysis&lt;/em&gt;). To wit, on &lt;a href=&quot;http://books.google.com/books?id=M7oZvR9AMKkC&amp;amp;lpg=PA79&amp;amp;ots=T6icNZ8yXK&amp;amp;dq=empirical%20transfer%20function%20estimate%20hat&amp;amp;pg=PA79#v=onepage&amp;amp;q=empirical%20transfer%20function%20estimate%20hat&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;pg. 79&lt;/a&gt; of &lt;em&gt;Modeling: identification and simulation of dynamical systems&lt;/em&gt; we have&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The double hat denotes that the ETFE is a very rough estimate of the transfer function.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2013-01-09T20:16:53.410" LastActivityDate="2013-01-09T20:16:53.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6469" PostTypeId="1" AcceptedAnswerId="6473" CreationDate="2013-01-10T07:11:25.023" Score="1" ViewCount="703" Body="&lt;p&gt;I have asked this question before in the sense that what does a high frequency and low frequency component signify in a image and i got satisfactory answers now i want to know that how i can get high frequency and low frequency component separately from the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean what changes i have to make in the equations of bilateral filters and its implementation in matlab so that i can get both high frequency and low frequency component of that image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because in my experiment i need both the high frequency and low frequency component of a image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bilateral filters takes a weighted sum of the pixels in a local neighborhood; the weights &#xA;depend on both the spatial distance and the intensity distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of a pixel assigned is given as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;      BF[I_p] = \frac{1}{W_p} \sum_{\substack{ q\in S }} G_{\sigma_s}(\parallel p-q \parallel) G_{\sigma_r}(\mid I_p - I_q\mid) I_q&#xA;      $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to make changes to this equation of bilateral filter to get high frequency and low frequency components separately .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What component does this equation signify is it the high frequency component or low frequency component ?&lt;/p&gt;&#xA;" OwnerUserId="1757" LastEditorUserId="128" LastEditDate="2019-03-15T22:10:16.593" LastActivityDate="2019-03-15T22:10:16.593" Title="How to Obtain Mathematically High Frequency and Low Frequency Component Separately Using Bilateral Filter?" Tags="|image-processing|filters|image-segmentation|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6470" PostTypeId="1" CreationDate="2013-01-09T05:14:52.503" Score="7" ViewCount="259" Body="&lt;p&gt;I am working on developing an autonomous control system for toy IR remote-controlled helicopters (like the Syma s107, for example) using a webcam and an Arduino with some IR LEDs. I am using C++ with OpenCV on a laptop running at about 2Ghz and I need to keep the system as close to real time as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unsure of a way to effectively determine the rotation of the helicopter in the 2D image (more precisely its yaw with respect to the camera image plane). This information is important to being able to stabilize the helicopter in the screen because otherwise it floats out of view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have considered, and at least partially tried to determine the location of the body and the tail and use some tricks of geometry and perspective to get an estimation of shape but accurately finding the tail and body with low enough noise proved difficult. I have also considered using colored markers of some sort on certain spots of the helicopter but I'm not sure how to get a more accurate estimation than approximately left and approximately right.&lt;/p&gt;&#xA;" OwnerDisplayName="user1960177" LastEditorUserId="76" LastEditDate="2013-01-10T15:43:31.660" LastActivityDate="2013-01-11T21:08:20.417" Title="Determining Toy Helicopter Orientation From Image" Tags="|image-processing|opencv|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6471" PostTypeId="2" ParentId="6470" CreationDate="2013-01-09T05:38:55.907" Score="1" Body="&lt;p&gt;The markers idea could work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; ___ ___                ___  ___ &#xA;  m | m                  m /  m&#xA;    |                     /   &#xA;    +                    +   &#xA;    |                   /   &#xA;    |                  /   &#xA; --- ---           --- --- &#xA;&#xA;&#xA;   \ /                   \ /        &#xA;    c                     c   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Imagine putting markers on the far side of the helicopter and having them blocked on the near side.  When the helicopter rotates, the marker on the approaching side will be exposed to the camera.&lt;/p&gt;&#xA;" OwnerUserId="23316" OwnerDisplayName="mgamba" LastActivityDate="2013-01-09T05:38:55.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6472" PostTypeId="2" ParentId="6470" CreationDate="2013-01-09T06:00:56.523" Score="4" Body="&lt;p&gt;For yaw it's sufficent to have three distinct data points fixed to the helicopter in a plane parallel to the rotor rotation: different colored leds for example. You could put them on three thin radial arms fixed to the landing gear. Maybe colored reflective materials would work, too, but you'd have to compensate for environmental light changes.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then getting the yaw angle is simple.  Suppose the lights are red, green, and blue 120 degrees apart and ccw when viewed from the top.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/udqnb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the image you will see these lights in various x-coordinate orders. As the helicopter rotates ccw fromt the position shown in the diagram:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;G R B   // green and blue in front; red in back&#xA;R G B   // green in front; red and blue in back&#xA;R B G   // red and gree in front; blue in back&#xA;B R G   // etc...&#xA;B G R&#xA;G B R&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Of course at the borders of these regions two lights will merge to a single point.  These can be handled as special cases.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So with 3 lights you have split all posible yaws into 6 x 60 degree segments.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can further get down to 30 degree resolution by just comparing the left and right &quot;gap&quot; widths. If pointing directly away from the camera is azimuth theta zero degrees and the red light is on the nose (as in the picture), then the algoritm is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Xr = -sin(theta)&#xA;Xg = -sin(theta + 60)&#xA;Xb = -sin(theta + 120)&#xA;if (Xg &amp;lt; Xr &amp;amp;&amp;amp; Xr &amp;lt;= Xb) {&#xA;  // Green and blue are in front of red&#xA;  dxLeft = Xr - Xg&#xA;  dxRight = Xb - Xr&#xA;  yaw = (dxLeft &amp;lt; dxRight) ? 15+-15 : -15+-15;&#xA;}&#xA;else if (Xr &amp;lt; Xg &amp;amp;&amp;amp; Xg &amp;lt; Xb) {&#xA;  // Green is in front of red and blue&#xA;  dxLeft = Xg - Xr&#xA;  dxRight = Xb - Xg&#xA;  yaw = (dxLeft &amp;lt; dxRight) ? 30+-15 : 60+-15;&#xA;}&#xA;else ... four more cases&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;X+-15&lt;/code&gt; above mean &lt;code&gt;X&lt;/code&gt; degrees plus or minus 15: a 30 degree segment.  To get the exact offset, you can construct a preprocessed table that converts the ratio &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R = dxLeft &amp;lt; dxRight ? xLeft / xRight : xRight / xLeft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;into an an exact azimuth offset between -15 and 15.  This is pretty simple trigonometry to work out, and the nice thing is that it works independent of how far away the helicopter is, so long as it never turns upside down!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another side benefit: the image distance between the outer two lights gives you inverse distance to the camera.&lt;/p&gt;&#xA;" OwnerDisplayName="Gene" LastActivityDate="2013-01-09T20:49:00.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6473" PostTypeId="2" ParentId="6469" CreationDate="2013-01-10T17:05:46.180" Score="1" Body="&lt;p&gt;One you have convolved your original image with the gaussian kernel (of appropriately chosen variance), then simply subtract the original image from the result of the convolution. This will give you the image with only the high frequency components of your original. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-01-10T17:05:46.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6474" PostTypeId="2" ParentId="691" CreationDate="2013-01-10T18:44:18.800" Score="2" Body="&lt;p&gt;In the question you say &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As I said I want to make some uniwersal thing&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but I am afraid it's quite difficult to find a &quot;universal&quot; solution to the problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can buy a commercial available pattern locator software and integrate it in your application, usually they perform quite well for a wide range of applications. Just to give you an idea this is the reference manual for such a product &lt;a href=&quot;http://www.lmi3d.com/sites/default/files/support/4.2.0.70-hexsight_user_guide.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.lmi3d.com/sites/default/files/support/4.2.0.70-hexsight_user_guide.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you can develop an ad hoc solution for some particular case (for example for the pen in your image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise you can study hard the problem, starting from the very basic foundations rooted in computational geometry (&lt;a href=&quot;http://www.cs.sunysb.edu/~algorith/files/shape-similarity.shtml&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.sunysb.edu/~algorith/files/shape-similarity.shtml&lt;/a&gt;), where your &quot;contours&quot; are called &quot;polygon&quot;, reading stuff like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://hal.inria.fr/docs/00/07/38/59/PDF/RR-2832.pdf&quot; rel=&quot;nofollow&quot;&gt;M. de Berg, O. Devillers, M. Kreveld, O. Schwarzkopf, and M. Teillaud.&#xA;&lt;em&gt;Computing the maximum overlap of two convex polygons under translations.&lt;/em&gt; &#xA;Theoretical Computer Science, 31:613–628, 1998.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://w3.jouy.inra.fr/unites/miaj/public/vigneron/preprints/rigidm.pdf&quot; rel=&quot;nofollow&quot;&gt;H. Ahn, O. Cheong, C. Park, C. Shin, and A. Vigneron. &#xA;&lt;em&gt;Maximizing the overlap of two planar convex sets under rigid motions.&lt;/em&gt; Computational Geometry: Theory and Applications, 37:3–15, 2007.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and ending with &lt;a href=&quot;http://tumb1.biblio.tu-muenchen.de/publ/diss/bv/2003/ulrich.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;Hierarchical Real-Time Recognition of&#xA;Compound Objects in Images&quot; by Markus Ulrich&lt;/a&gt; who collaborates with &lt;a href=&quot;http://www.mvtec.com/halcon/&quot; rel=&quot;nofollow&quot;&gt;MVTec&lt;/a&gt;, another software house selling object recognition software tools.&lt;/p&gt;&#xA;" OwnerUserId="3573" LastEditorUserId="3573" LastEditDate="2013-01-11T07:54:33.657" LastActivityDate="2013-01-11T07:54:33.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6475" PostTypeId="1" CreationDate="2013-01-10T19:18:13.333" Score="2" ViewCount="8594" Body="&lt;p&gt;I need to calculate frequency response, phase response and apply to signals the Butterworth, Chebychev1 and Chebychev2 band-pass filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm developing in C++ with Qt, and I'm looking for algorithms or a (free) library to do that. I have my plotting solution, I just need the formulas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input values I have are the time/amplitude signal, the order of the filter and the low and high cut-off frequencies.&lt;/p&gt;&#xA;" OwnerUserId="3586" LastActivityDate="2013-05-09T02:32:40.810" Title="Use Butterworth and Chebychev filters" Tags="|algorithms|transfer-function|signal-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6476" PostTypeId="1" AcceptedAnswerId="6477" CreationDate="2013-01-10T19:58:03.460" Score="0" ViewCount="3926" Body="&lt;p&gt;I encountered a problem when I tried to generate by a program an sinus audio signal.&#xA;My parameters are &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample Rate: 44100 Hz&#xA;Data Bits:      16 bits&#xA;Channels:        2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to create a WAV file that is generated on the fly in and play in real time directly to a audio out port.&#xA;There are two more requirements. I need to be able to change Frequency of the sinus signal with the delay of no more than 50 ms. The last requirements are to make any periods of sound and silence with the sinus. For example 100 ms sound and 50 ms of silence or even continuous signal of sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made everything and works but not for all frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean my signal is flawless. It's wave form displayed in audio editing software is perfect. Played through Media Player is perfect.&#xA;But when I play it on the fly it is producing strange noise, strange &quot;bump&quot; noise at the end of every wave chunk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The audio signal to be able to change it on the fly or with a maximum delay of 50ms I am creating wave chunks of 50 ms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I play it with 200Hz (sinus) and 50 ms buffer it sounds good.&#xA;But when I change a freq to 201Hz (sinus) and 50 ms buffer it is producing a constant train of &quot;BANG&quot; sounds at the and of every chunk. &quot;BUMP&quot;, &quot;BUMP&quot;, &quot;BUMP&quot;, &quot;BUMP&quot;, ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that I made a mistake in discrete domain. Some rounding of values at the end of every chunk. In addition I noticed that the problem is audible on the frequencies that are between every freq. that is not a multiple of number 20.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: 200Hz (good), 201, 202, ... 219 (bad), 220 Hz again good and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really do not understand what's wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically the only thing about what I can think is some relation between the buffer size of 50ms, Sample Rate of the audio signal and the frequency of sinus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the numbers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;44100 Hz =&gt; 44100 Samples/sec  x 50ms (buffer) = 2205 Samples / buffer&#xA;200 Hz (sinus) =&gt; T = 1/f = 5ms period    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;50ms (buffer)  / 5 ms (sinus period) = 10 sinus waves per buffer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the freq. is increased:&#xA;201 Hz (sinus) =&gt; T = 1/f = 4,9751 ms period&#xA;50 ms (buffer) / 4,9751 ms = 10,05 sinus waves per buffer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is in the second example the last sinus does not fit entirely into a buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can say that I am filling the next buffer at the exact following point but something still happens. I think that somewhere around this point is a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need at least a mathematical solution in discrete domain. The best will be a computer code or even pseudo code is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody be so kind to help me? It is very important to me.&#xA;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use the buffer chunk size of 50 ms and the Sinus frequency of 201 Hz and then used Audacity program to record the audio in real time. Very strange things are happening. at 100 ms and 200 ms are spikes at 300 is not, at 400, 450, 500, 550, 600 ms are other spikes. 650 is good as it must be, 700 is too, 750 again not, 800 spike ... then at 1000 ms is a different spike. I rely do not understand why is this happening. Maybe some calculation... Some rounding problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will put only a part of the code used. Complete code is very big. It consists of producer thread and consumer thread + the Wave out player internal thread. In between is a queue to not used to have constant flow between produce and consumer (player). So at least this is satisfied.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;These are the critical parts of the code.&#xA;&#xA;format.dwSamplesPerSec = 44100&#xA;format.wChannels = 2&#xA;format.wBitsPerSample = 16&#xA;&#xA;int minAudioChunk = 50; // in milliseconds&#xA;&#xA;data.dwChunkSize = (uint)(data.shortArray.Length * (format.wBitsPerSample / 8));&#xA;&#xA;volume = (double)(Volume / 100.0f);&#xA;&#xA;// Number of samples = sample rate * channels * bytes per sample&#xA;uint numSamples = (uint)(format.dwSamplesPerSec * format.wChannels * ((double)minAudioChunk / 1000));&#xA;&#xA;// Initialize the 16-bit array&#xA;data.shortArray = new short[numSamples];&#xA;&#xA;// Max amplitude for 16-bit audio&#xA;amplitude = (int)(MAX_AMPLITUDE_16BIT * volume);&#xA;&#xA;// Create a double version of the frequency for easier math&#xA;double freq = (double)frequency;&#xA;&#xA;// The &quot;angle&quot; used in the function, adjusted for the number of channels and sample rate.&#xA;// This value is like the period of the wave.&#xA;t = (Math.PI * 2 * freq) / (format.dwSamplesPerSec * format.wChannels);&#xA;&#xA;value = amplitude * Math.Sin(t * i);&#xA;&#xA;// Fill with a simple sine wave at max amplitude&#xA;for (int channel = 0; channel &amp;lt; format.wChannels; channel++)&#xA;{&#xA;    data.shortArray[bufferIndex + channel] = (short)value;&#xA;}&#xA;&#xA;bufferIndex  goes from 0 ... (numSamples-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="473" LastEditorUserId="473" LastEditDate="2013-01-11T21:39:40.400" LastActivityDate="2013-01-12T15:16:53.230" Title="How to generate a good Sinus audio signal of specific SampleRate, DataBits and Chunnels in a time frame" Tags="|audio|discrete-signals|wave|waveform-similarity|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6477" PostTypeId="2" ParentId="6476" CreationDate="2013-01-10T20:21:11.867" Score="1" Body="&lt;p&gt;It seems to me that your phase accumulator gets reset at the beginning of each chunk/buffer. When the waveform exactly goes through an integer number of periods over the duration of a buffer, there is no discontinuity, but if a buffer contains a non-integer number of periods, then a discontinuity will appear at each buffer boundary. Solution: store your phase accumulator somewhere at the end of a buffer; and reuse its value when rendering the next buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best way to troubleshoot this kind of problem is to run your audio rendering code offline and dump the samples into a .wav file. Open the file in an audio editor or make a plot to help you (and us) visualize the defect.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-01-10T20:21:11.867" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="6479" PostTypeId="2" ParentId="6476" CreationDate="2013-01-11T01:22:53.187" Score="1" Body="&lt;p&gt;As pointed by the other people you most likely have a frame boundary error. Let me suggest a different approach outlined in the code below. This is based on creating a oscillator using complex multiplication. In order to prevent amplitude drift there is a &quot;stabilization&quot; function that needs to be called every once in a while. This would work as follows: create the structure, call init() once, call setFrequency (in radians) to set the frequency. Call nextSample() to get the next value and fill your buffer as needed. Call stabilize() once every buffer. This has the advantage that it's cheap, very accurate, requires almost no memory, and the frequency can be adjusted whenever desired without creating any discontinuity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveat: I have neither compiled nor tested any of that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;typedef struct &#xA;{&#xA;  float cr, ci; // frequency, complex phasor&#xA;  float xr, xr; // state&#xA;} osc_t;&#xA;&#xA;Void oscInit(osc_t *p)&#xA;{&#xA;  p-&amp;gt;cr = p-&amp;gt;xr = 1.0F;&#xA;  p-&amp;gt;ci = p-&amp;gt;ci = 0.0F;&#xA;}&#xA;&#xA;float oscNextSample(osc_t *p)&#xA;{&#xA;   float xr1,xi1;&#xA;   // complex multiply&#xA;   xr1 = p-&amp;gt;xr*p-&amp;gt;cr – p-&amp;gt;xi*p-&amp;gt;ci;&#xA;   xi1 = p-&amp;gt;xr*p-&amp;gt;ci + p-&amp;gt;xi*p-&amp;gt;cr;&#xA;   p-&amp;gt;xr = xr1;&#xA;   p-&amp;gt;xi = xi1;&#xA;   return(xr1);&#xA;}&#xA;&#xA;void oscSetFrequency(osc_t *p, float freq)&#xA;{&#xA;  p-&amp;gt;cr = cosf(2*M_PI*freq);&#xA;  p-&amp;gt;ci = sinf(2*M_PI*freq);&#xA;}&#xA;&#xA;void oscStabilize(osc_t *p)&#xA;{&#xA;  float mag;&#xA;  mag = p-&amp;gt;xr*p-&amp;gt;xr + p-&amp;gt;xi*p-&amp;gt;xi;&#xA;  mag = .5F*(3.0F-mag);&#xA;  p-&amp;gt;xr *= mag;&#xA;  p-&amp;gt;xi *= mag;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-11T01:22:53.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6481" PostTypeId="1" AcceptedAnswerId="6483" CreationDate="2013-01-11T09:49:55.783" Score="1" ViewCount="2069" Body="&lt;p&gt;I got the concept of Convolution in signal processing from a video lecture that it is method to get the area overlapped between two signals when one signal is flipped over and traversed over another signal and that it allows for getting combined effect of two signals during that traversal. But how this concept is applied in image processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How a function of some arbitrary window size is used to be traversed over the image in order to get effect and how convolution is actually taking place there ?&lt;/p&gt;&#xA;" OwnerUserId="1757" LastEditorUserId="128" LastEditDate="2019-06-24T08:52:25.060" LastActivityDate="2019-06-24T08:52:25.060" Title="Convolution in Image Processing?" Tags="|image-processing|convolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6482" PostTypeId="2" ParentId="6476" CreationDate="2013-01-11T10:23:10.600" Score="0" Body="&lt;p&gt;One other possibility is that you are sending the buffers out to the DAC with the wrong timing (a synchronization error), or perhaps not flushing the data cache at the appropriate time.  Waves periodic in the buffer length will produce identical successive buffers and thus won't show borked buffer swaps.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-01-11T10:23:10.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6483" PostTypeId="2" ParentId="6481" CreationDate="2013-01-11T10:40:08.193" Score="3" Body="&lt;p&gt;Convolution is typically used in the context of filtering. You have an image, $I$, a filter kernel, $K$, and you convolve them together to get a filtered image, $J$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$J = I \star K$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nature of the filtering operation will be determined by the coefficients of the filter kernel, $K$.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2013-01-11T10:46:15.000" LastActivityDate="2013-01-11T10:46:15.000" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="6485" PostTypeId="2" ParentId="6230" CreationDate="2013-01-11T10:55:48.927" Score="5" Body="&lt;p&gt;Filtering a signal by modifying the Fourier coefficients and then inverse Fourier-transforming it is a filter design method known as the &quot;frequency-sampling&quot; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many research works on source separation for instance consider such filters because they are convenient (working on spectral characteristics to separate the signals - e.g. the fact that the frequency support of 2 sources is different) easy to implement and still lead to very convincing results (even the infamous &quot;binary masks&quot; :D). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could compare this method to others, for instance FIR filter design by the window method : compute the ideal IIR impulse response and crop it or window it with a Hann/Hamming/your-preferred-window function. The window method corresponds to multiplying your impulse response by a window, in the time domain. It therefore results in a convolution between the involved Fourier transforms, leading to the well-known Gibbs effect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the frequency sampling method, you don't need to find the impulse response, but this comes at the cost that you do not control much of what is happening /between/ the frequency bins: in your example, that would correspond to the frequencies $\frac{\nu}{N} f_s$ where $\nu \notin \{0,1, 2,..., N-1\}$. The actual frequency response of such a filtering process is then an interpolation between the sampled points of the desired frequency response. This issue is not often discussed in the literature, but could lead to big cripples in the resulting frequency response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other methods for designing filters, for instance for designing low/high pass or band-pass filters, but I have less practical experience there. I guess those are anyway not what you are looking for. I mentioned the window method only as a way of comparing what's happening: with the window method, you have trouble with the Gibbs effect, and with the frequency sampling method, you don't really know what's happening between the sampled frequency bins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This said, for your practical problem, from my own experience, zeroing frequency bins is usually fine. Assuming the way you decide how to enhance this or that frequency bin makes sense (avoiding too many &quot;jumps&quot; in the frequency response, for instance), the result should not exhibit too many artifacts from that process. Note that setting the low values to zeros, instead of keeping the original ones, may however deteriorate what is happening in the frequency region of interest. In source separation as I have experience it, we usually try to minimize some criterion (e.g. mean squared estimation errors), and that can provide us with an optimal way of setting all the values of the Fourier transform. I would argue that this is a better way of dealing with the matter, instead of trying all sort of values for the &quot;missing&quot; ones until the result is acceptable (a method which is most likely to depend on the test signal, hence poorly generalizing to other signals). &lt;/p&gt;&#xA;" OwnerUserId="1301" LastActivityDate="2013-01-11T10:55:48.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6486" PostTypeId="1" CreationDate="2013-01-11T14:23:07.403" Score="12" ViewCount="15414" Body="&lt;p&gt;Is there an accepted way of determining the noise floor of a signal by looking at it in the frequency domain?  Is it a matter of averaging all the bins, or median, or some more complex calculation like those described in the question below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1939/whats-the-best-criterion-for-determining-a-frequency-peak&quot;&gt;What&amp;#39;s the best criterion for determining a frequency peak?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to determine the noise floor to set a threshold for determining whether or not my signal contains a given frequency.&lt;/p&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-02-02T07:07:04.547" Title="Determining the noise floor of a signal in the frequency domain" Tags="|frequency-domain|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="6487" PostTypeId="2" ParentId="6486" CreationDate="2013-01-11T14:44:34.213" Score="2" Body="&lt;p&gt;You need to normalize your data based on the type of window you are using to obtain your frequency domain representation of the data.  The normalization differs depending on whether you are measuring a narrow band (your signal peak) or broadband (noise) signal.  Once you have the data properly normalized, the power of the narrow band signal can be read directly from the data.  The noise measurement must be estimated from the &quot;noise floor&quot; of the normalized frequency data.  Your noise power estimate will be 6dB less than the noise floor.  For a detailed discussion,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go to this link: &lt;a href=&quot;http://www.fhnw.ch/technik/ime/publikationen&quot; rel=&quot;nofollow&quot;&gt;http://www.fhnw.ch/technik/ime/publikationen&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Download the paper &quot;&quot;How to use the FFT for signal and noise simulations and measurements&quot;.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-02-01T15:23:59.183" LastActivityDate="2013-02-01T15:23:59.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6488" PostTypeId="1" CreationDate="2013-01-11T17:17:22.353" Score="2" ViewCount="2842" Body="&lt;p&gt;I have an PCM (pulse-code modulation) signal. If I want to work out the frequency of a sample $ x $ long, I count the number of peaks/troughs of the sample, and divide by $ x $. The equivent dB of frequencies $ 20Hz &amp;gt; 20 000 Hz $ is then just the equivelent dB of the signal as a whole&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to create a spectrum analyzer of the type shown below. This requires extracting the equivelent decibels of different frequencies in the signal. So I need to split the signal into different signals of different frequencies, so I have signals of $ 20Hz &amp;gt; 5000Hz $, $ 5000Hz &amp;gt; 10000Hz $,  $ 10000Hz &amp;gt; 20000 Hz $, ect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I extract signals for the different frequencies from one master signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TyMzL.jpg&quot; alt=&quot;Graphic EQ&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3589" LastEditorUserId="3589" LastEditDate="2013-01-11T20:06:25.390" LastActivityDate="2013-01-12T20:05:17.003" Title="Extract frequencies from PCM signal" Tags="|frequency-spectrum|frequency|frequency-domain|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6489" PostTypeId="2" ParentId="6488" CreationDate="2013-01-11T19:16:49.007" Score="4" Body="&lt;p&gt;It is not clear if you want to visualize the signal or process/transform it (&quot;graphic equalizer&quot; is an effect/transformation adjusting the signal level independently in various frequency bands, not a visualization - a more correct term for the representation you posted an image of is &quot;spectrum analyzer&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not clear if you are working in the analog domain or the digital domain, and what kind of technology you want to employ (analog electronics? computer code running on a DSP chip or microcontroller? on a desktop computer?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are your signals audio signals? In which case you have to be aware that a meaningful representation should display the 20 Hz .. 20kHz range (range of human hearing), and that it should be subdivided logarithmically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get this kind of visualization, there are two solutions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A bunch of band-pass filters (and a low-pass + a high-pass for the lower and higher channels). You then measure the (log-) energy in each band to get the &quot;height&quot; of each bar. This can be done in the analog domain (a bunch of op-amps for the filter, a rectifier to measure the signal level, and a log-amplifier to get the energy on a log scale; or with dedicated ICs like the MSGEQ7); or in the digital domain with &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_filter&quot; rel=&quot;nofollow&quot;&gt;digital filters&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;FFT&lt;/a&gt; + some grouping of adjacent bins (which is more or less equivalent to computing the filter bank in the frequency domain). Note that this can only be used for digital signals.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-01-11T19:16:49.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6490" PostTypeId="2" ParentId="6470" CreationDate="2013-01-11T21:08:20.417" Score="1" Body="&lt;p&gt;Full location and orientation of the copter can be calculated with: 4 known points on a plane + calibrated camera, or with 6 known points (certain 3D configuration will not work, for example the points must not be on a same plane). See &lt;a href=&quot;https://dsp.stackexchange.com/questions/1727/3d-position-estimation-using-2d-camera&quot;&gt;this question for 6 point algorithm&lt;/a&gt;, for 4 point algorithm I have found MSc thesis by Liljequist - Planes, Homographies and Augmented Reality very useful, but I can not find it on-line. More terse paper which focuses on the calibration is written by Zhang - A Flexible New Technique for Camera Calibration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good book about the topic: Hartley, Zisserman - Multiple view geometry in computer vision.&lt;/p&gt;&#xA;" OwnerUserId="1203" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-01-11T21:08:20.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6491" PostTypeId="2" ParentId="6476" CreationDate="2013-01-12T15:16:53.230" Score="1" Body="&lt;p&gt;I looked at your code. There a couple of problems. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, you don't preserve phase between buffers: Assuming that your index &quot;i&quot; runs from 0 to numSamples-1, your buffer always starts at 0. If the previous buffer didn't end on a 0 (which it won't for frequencies that are not a multiple of 200 Hz you get a discontinuity.&lt;/li&gt;&#xA;&lt;li&gt;Frequency calculation looks wrong, you divide by the number of channels, which I don't think is right&lt;/li&gt;&#xA;&lt;li&gt;The calculation of numSamples uses mixed fixed point and floating point with the final result being truncated instead of rounded. Depending on the hardware platform you may get tiny math errors and come up one sample short. Rounding would be much safer here.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To avoid the first problem, do something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;global float gPhaseAccumulator = 0.0F; // bad style, but this is for illustration only&#xA;&#xA;float dPhi; // phase increment&#xA;// set frequency&#xA;dPhi = 2.0F*M_PI*freq/(float)(format.dwSamplesPerSec);&#xA;// do the sine wave&#xA;for (i = 0; i &amp;lt; numSamples; i++)&#xA;{&#xA;   gPhaseAccumulator += dphi;&#xA;   value = amplitude*sinf(gPhaseAccumulator );&#xA;}&#xA;// unwrap the accumulator once per buffer&#xA;nWraps = (int)(gPhaseAccumulator/(2.0F *M_PI);&#xA;gPhaseAccumulator -= nWraps*2.0F*M_PI;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The use of the global variable will make sure that the phase is continuous between subsequent calls.  &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-12T15:16:53.230" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6492" PostTypeId="1" AcceptedAnswerId="6493" CreationDate="2013-01-12T17:44:28.303" Score="8" ViewCount="2048" Body="&lt;p&gt;By iterating or nesting a sine curve like in &lt;a href=&quot;https://math.stackexchange.com/questions/276297/does-this-curve-tend-to-a-square-wave&quot;&gt;this question&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get curves like these:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uWRtJ.png&quot; alt=&quot;partial sums&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that seem to tend to a square wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The eight case of these looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rB3OM.png&quot; alt=&quot;degree 8 curve&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which here on purpose was chosen for it's roundness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Mathematica code for these plots can be found here:&#xA;&lt;a href=&quot;http://pastebin.com/6UK1u1uX&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/6UK1u1uX&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know much about signal processing but I recalled the Gibbs phenomenon in square waves after I saw these curves.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would they solve the problem with the Gibbs phenomenon in the case of square waves?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the Fourier transform this kind of function is not of any use though I understand.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit 13.1.2013:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sawtooth wave:&#xA;&lt;a href=&quot;http://pastebin.com/JNg7bzzB&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/JNg7bzzB&lt;/a&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Dw2JY.png&quot; alt=&quot;sawtoothwave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Triangular wave (partial sums instead of integrals):&#xA;&lt;a href=&quot;http://pastebin.com/wRCBV7NF&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/wRCBV7NF&lt;/a&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/KFJxi.png&quot; alt=&quot;triangular wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dirac comb &lt;a href=&quot;http://pastebin.com/QMSMQf26&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/QMSMQf26&lt;/a&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/869lx.png&quot; alt=&quot;Dirac comb&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1020" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-11-08T20:01:10.233" Title="How much of a problem is the Gibbs phenomenon and would this solve it?" Tags="|gibbs-phenomenon|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6493" PostTypeId="2" ParentId="6492" CreationDate="2013-01-12T19:06:27.410" Score="5" Body="&lt;p&gt;I would say that this is interesting.  There has been a lot of work done regarding the study of Gibbs Phenomenon.  You should check out the following document to get a better understanding of how it comes up in practical DSP applications:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://people.clarkson.edu/~ajerri/books/examples/Gibbs_Book.pdf&quot;&gt;http://people.clarkson.edu/~ajerri/books/examples/Gibbs_Book.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The typical way to manage Gibbs Phenomenon is to use time domain window functions that taper data at the start and finish.  The window functions reduce spurious contributions to frequency domain information that come from discontinuities at the edges of data sequences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't seen much application of generating signals by composing them with individual sine waves.  Generally signal generation is done directly in the time domain.  I'm not sure how the function constructions you've documented can be employed to solve a practical problem, but perhaps there is application if you can identify an appropriate problem.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-12T19:06:27.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6494" PostTypeId="2" ParentId="6266" CreationDate="2013-01-12T19:52:33.620" Score="1" Body="&lt;p&gt;It is important to note that the various wavelets that have been developed offer different decompositions of the signals they are used to study.  Specific wavelets are chosen to reveal specific signal features in a particular way.  When you compute wavelet coefficients, you perform a correlation of the chosen wavelet with the signal of interest; thus the shape of the wavelet determines the shape of signal features that are revealed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some wavelet functions have been &quot;designed&quot; to provide decompositions that can relate to Fourier decompositions (actually more in line with short term Fourier decompositions used to produce spectrograms of  signals).  The Morlet wavelet is a good example of such a wavelet function.  Other wavelets have been &quot;designed&quot; to identify discontinuities or edges of signals.  I've see papers that use Daubechies wevelet functions for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may be helpful to do some research to see how each of the wavelet functions you've mentioned are being used in practice.  I think this will give you a better understanding of how various wavelets differ.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-12T19:52:33.620" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6495" PostTypeId="2" ParentId="6488" CreationDate="2013-01-12T20:05:17.003" Score="1" Body="&lt;p&gt;The signal is PCM data, so an FFT algorithm is appropriate (as already mentioned above).  There are lots of shareware applications that do this, so unless you are interested in the thrill of developing such an app, search for something like &quot;pc spectrum analyzer&quot;.  If you want to develop the app, you probably want to find some libraries that provide canned signal processing algorithms.  Again you can search and find such things without much difficulty.  Perhaps other users can offer up references to libraries that they have used.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-12T20:05:17.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6496" PostTypeId="1" CreationDate="2013-01-12T21:51:33.033" Score="2" ViewCount="121" Body="&lt;p&gt;In &quot;&lt;a href=&quot;http://perso.limsi.fr/Individu/vezien/PAPIERS_ACS/canny1986.pdf&quot; rel=&quot;nofollow&quot;&gt;A Computational Approach to Edge Detection&lt;/a&gt;&quot;, John Canny explains that the optimal &quot;detector&quot; for finding step edges profiles in an image via convolution is a non-closed-form function closely approximated by the first derivative of a Gaussian. He derives this by defining &quot;optimal&quot; as the function which maximizes the product of signal-to-noise ratio and localization (ability to detect the edges at the right location), as well as another criteria concerning multiple responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On p.5 of the paper, he also shows in a picture the optimal detectors, under that those criteria, for ridge and roof profiles, which also look Gaussian-ish in shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to compute the optimal detector for other, arbitrary profiles. Unfortunately, I'm not quite well-versed in numerical optimization enough to figure out how to do that based on the formulas in the paper, and I'm not able to find any resources that explains how to do so explicitly. Does anyone know of a guide or an implementation that will do that - finding the optimal detector for an arbitrary feature in an noisy image?&lt;/p&gt;&#xA;" OwnerUserId="3534" LastActivityDate="2013-01-12T21:51:33.033" Title="Finding optimal detectors by numerical optimization (Canny)" Tags="|edge-detection|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6497" PostTypeId="1" AcceptedAnswerId="6498" CreationDate="2013-01-13T10:13:59.643" Score="0" ViewCount="997" Body="&lt;p&gt;I have a sound signal, and I would like to implement a simple realtime level control (for info, I am using Pure Data, but I'd like to know about the general case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this I thought of using the envelope amplitude (in dB) of the input &lt;code&gt;Vin_db&lt;/code&gt;, calculated over a window of &lt;code&gt;N&lt;/code&gt; samples ; use it to calculate the gain &lt;code&gt;G&lt;/code&gt; to apply to the signal to get an output with amplitude &lt;code&gt;Vout_db&lt;/code&gt;. (Disclaimer : I am very rusty with maths and decibels ...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I took the wikipedia formula for decibels :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;V_db = 10 * log10(P / P0)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;=&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Vin_db = 10 * log10(Pin / P0)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Vout_db = 10 * log10(Pout / P0)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this gave me :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Pout = Pin * 10^((Vout_db - Vin_db) / 10)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;=&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;G = 10^((Vout_db - Vin_db) / 10)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this doesn't seem to work ... When I measure the output level it is not the expected &lt;code&gt;Vout&lt;/code&gt;. Is there a fundamental flaw in my reasoning ? Or just a calculation error ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to Paul R I found the correct formula (I need a &lt;code&gt;20&lt;/code&gt; instead of a &lt;code&gt;10&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;G = 10^((Vout_db - Vin_db) / 20)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="1169" LastEditorUserId="1169" LastEditDate="2013-01-13T10:48:32.570" LastActivityDate="2013-01-13T10:48:32.570" Title="Calculating the gain for adjusting sound level to X db" Tags="|sound|real-time|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6498" PostTypeId="2" ParentId="6497" CreationDate="2013-01-13T10:24:22.883" Score="1" Body="&lt;p&gt;You don't need to convert the voltages to dB, just calculate the required gain (as a factor) and then convert this to dB if necessary, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;G = Vout / Vin                 # required gain (factor)&#xA;&#xA;G_dB = 20 * log10(G)           # required gain (dB)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Vin = input voltage&#xA;Vout = output voltage&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you really want to work with dB throughout then you can do it like this (should give the same answer):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Vin_dB = 20 * log10(Vin)       # input voltage (dB)&#xA;&#xA;Vout_dB = 20 * log10(Vout)     # output voltage (dB)&#xA;&#xA;G_dB = Vout_dB - Vin_dB        # required gain (dB)&#xA;&#xA;G = 10 ^ (G_dB / 20)           # required gain (factor)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2013-01-13T10:30:15.307" LastActivityDate="2013-01-13T10:30:15.307" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="6499" PostTypeId="1" AcceptedAnswerId="6500" CreationDate="2013-01-13T21:15:02.977" Score="19" ViewCount="26241" Body="&lt;p&gt;I've been reading bits and pieces online but I just can't piece it all together. I have some background knowledge of signals / DSP stuff which should be enough prerequisites for this. I'm interested in eventually coding this algorithm in Java but I don't understand it fully yet which is why I'm here (it counts as math, right?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I think it works along with the gaps in my knowledge.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Start with your audio speech sample, say a .wav file, that you can read into an array. Call this array $x[n]$, where $n$ ranges from $0, 1, \ldots ,N-1$ (so $N$ samples). The values correspond to audio intensity I guess - amplitudes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Split the audio signal into distinct &quot;frames&quot; of 10ms or so where you assume the speech signal is &quot;stationary&quot;. This is a form of quantization. So if your sample rate is 44.1KHz, 10ms is equal to 441 samples, or values of $x[n]$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do a Fourier transform (FFT for computation's sake). Now is this done on the entire signal or on each separate frame of $x[n]$? I think there's a difference because in general the Fourier transform looks at all elements of a signal, so $\mathcal F(x[n]) \neq \mathcal F(x_1[n])$ joined with $\mathcal F(x_2[n])$ joined with $\ldots \mathcal F(x_N[n])$ where $x_i[n]$ are the smaller frames. Anyways, say we do some FFT and end up with $X[k]$ for the rest of this.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Mapping to the Mel scale, and logging. I know how to convert regular frequency numbers to the Mel scale. For each $k$ of $X[k]$ (the &quot;x-axis&quot; if you'll allow me), you can do the formula here: &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel_scale&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Mel_scale&lt;/a&gt;. But how about the &quot;y-values&quot; or the amplitudes of $X[k]$? Do they just remain the same values but shifted to the appropriate spots on the new Mel (x-) axis? I saw in some paper there was something about logging the actual values of $X[k]$ because then if $X[k] = A[k]*B[k]$ where one of those signals is presumed to be noise you don't want, the log operation on this equation turns the multiplicative noise into additive noise, which hopefully can be filtered (?).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now the final step is to take a DCT of your modified $X[k]$ from above (however it ended up getting modified). Then you take the amplitudes of this final result and those are your MFCCs. I read something about throwing away high frequency values.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So I'm trying to really iron out how to compute these guys step by step, and clearly some things are eluding me from above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I've heard about using &quot;filter banks&quot; (an array of band pass filters basically) and don't know if this refers to making the frames from the original signal, or maybe you make the frames after the FFT? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, there's something I saw about MFCCs having 13 coefficients?&lt;/p&gt;&#xA;" OwnerUserId="3595" LastEditorUserId="1629" LastEditDate="2016-01-12T20:17:03.343" LastActivityDate="2016-06-23T07:16:45.263" Title="Help calculating / understanding the MFCCs: Mel-Frequency Cepstrum Coefficients" Tags="|discrete-signals|signal-analysis|mfcc|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="6500" PostTypeId="2" ParentId="6499" CreationDate="2013-01-13T23:24:09.210" Score="29" Body="&lt;p&gt;Step by step...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. &amp;amp; 2&lt;/strong&gt;. This is correct. Note that the frames are usually overlapping, for example, frame 0 is samples 0 to 440; frame 1 is samples 220 to 660; frame 2 is samples 440 to 880 and so on... Note also that a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;noreferrer&quot;&gt;window function&lt;/a&gt; is applied to the samples in the frame. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3&lt;/strong&gt;. The Fourier transform is done for each frame. The motivation behind this is simple: a speech signal varies over time, but is stationary over short segments. You want to analyze each short segment individually - because on this segments the signal is simple enough to be described efficiently by few coefficients. Think of someone saying &quot;hello&quot;. You don't want to see all phonemes collapsed into one single spectrum (FFT collapses temporal information) by analyzing all the sound at once. You want to see &quot;hhhhheeeeeeeeeeelloooooooooo&quot; to recognize the word stage by stage, so it has to be broken down into short segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4&lt;/strong&gt;. &quot;Mapping to the Mel scale&quot; is misleading and that's probably why you're getting confused. A better description for this step would be: &quot;Compute the signal energy through a bank of filters tuned to mel-scaled frequencies&quot;. Here is how this is done. We consider $N$ frequencies (a commonly used value is $N = 40$) equally spaced according to the mel scale, between 20 Hz (bottom of the hearing range) and the Nyquist frequency. Practical example: The signal is sampled at 8kHz and we want 40 bins. Since 4kHz (Nyquist) is 2250 mel, the filterbank center frequencies will be:&#xA;0 mel, 2250 / 39 mel, 2 x 2250 / 39 mel .. 2250 mel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once these frequencies have been defined, we compute a weighted sum of the FFT magnitudes (or energies) around each of these frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the following picture, representing a filter bank with 12 bins:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YUH48.gif&quot; alt=&quot;Mel frequency filterbank with 12 channels&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 8th bin has a center frequency of around 2kHz. The energy in the 8th bin is obtained by summing weighted FFT energies in the 1600 to 2800 Hz approximately - with the weight peaking at around 2kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementation note: This bunch of weighted sums can be done in a single operation - a matrix multiplication of a &quot;filterbank matrix&quot; by the FFT energies vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at this stage we have &quot;summarized&quot; the FFT spectrum into a set of 40 (12 in the illustration) energy values, each corresponding to a different range of frequencies. We take the log of these values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5&lt;/strong&gt;. The next step consists in taking the DCT of this sequence of 40 log-energies. This will yield 40 values. The first $K$ coefficients are the MFCC (Usually, $K = 13$). Actually, the very first DCT coefficient is the sum of all the log-energies computed at the previous step - so it is an overall measure of signal loudness and is not very informative as to the actual spectral content of the signal - it is often discarded for speech recognition or speaker id applications where the system has to be robust to loudness variations.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="12250" LastEditDate="2016-06-23T07:16:45.263" LastActivityDate="2016-06-23T07:16:45.263" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="6501" PostTypeId="1" CreationDate="2013-01-14T00:46:42.917" Score="3" ViewCount="114" Body="&lt;p&gt;I need to count the number of 'patterns per second' in a signal. The problem is that the signal changes 'shape' a lot and unpredictably. It is still easy for a person to see the the pattern, but I don't know how to do this with code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT For extra clarity: say the first sample is 1 second. There are 17 copies of the pattern in this sample. So I want to compute &quot;17 (patterns per second)&quot;.&#xA;Also, it might be worth noting the samples below are from a continuous measurement, in this order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas how to tackle this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It needs to count the pattern in realtime.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some samples of the signal. (Zoom level in both directions is identical for all images.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zWqI7.png&quot; alt=&quot;sample 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bN2v6.png&quot; alt=&quot;sample 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a78e8.png&quot; alt=&quot;sample 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hJ4j9.png&quot; alt=&quot;sample 4&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ppTT7.png&quot; alt=&quot;sample 5&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3596" LastEditorUserId="3596" LastEditDate="2013-01-14T10:37:38.227" LastActivityDate="2013-01-14T21:04:18.920" Title="Counting shape changing pattern in signal" Tags="|frequency|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="6502" PostTypeId="1" CreationDate="2013-01-14T01:49:02.663" Score="0" ViewCount="470" Body="&lt;p&gt;I retrieve contours from images by using the Canny algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this enough preprocessing to have a descriptor image for input into an SVM to find similarities? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need other features like elongation, perimeter, area? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am asking about this because I was inspired by &lt;a href=&quot;http://scikit-learn.org/dev/auto_examples/plot_digits_classification.html&quot; rel=&quot;nofollow&quot;&gt;this example&lt;/a&gt;. I have given my image in greyscale first, in the Canny algorithm style second, and in both cases my confusion matrix had plenty of &lt;code&gt;0&lt;/code&gt;s like precision, recall, f1-score, support measure, etc.&lt;/p&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="76" LastEditDate="2013-01-14T06:59:01.930" LastActivityDate="2013-01-14T06:59:01.930" Title="Is the Canny algorithm enough for creating a feature descriptor image for input to an SVM?" Tags="|image-processing|computer-vision|canny-edge-detector|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="6503" PostTypeId="2" ParentId="6502" CreationDate="2013-01-14T03:00:04.013" Score="1" Body="&lt;p&gt;Yes and no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, the binary image output from the Canny edge detector is a feature set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the &lt;a href=&quot;http://en.wikipedia.org/wiki/Feature_%28computer_vision%29&quot; rel=&quot;nofollow&quot;&gt;Feature (computer vision)&lt;/a&gt; wiki page describes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... an edge can be represented as a boolean variable in each image point that describes whether an edge is present at that point. Alternatively, we can instead use a representation which provides a certainty measure instead of a boolean statement of the edge's existence and combine this with information about the orientation of the edge.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What you have is the former; a boolean variable for every pixel in the image, true where there is an edge. A &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow&quot;&gt;Hough Transform&lt;/a&gt; would be an example of a method to get the latter; edges represented by measure and orientation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take the same image and convert it to edges, the feature set will be the same. If you take two different images and convert them to edges, the feature set will likely be different. So yes, you can model an image using the Canny edge detector alone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, no, the binary image output from the Canny edge detector is &lt;em&gt;probably not a very useful&lt;/em&gt; feature set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a single training image of an apple and three test images: an apple, an orange, and a banana. By shape, what we are focusing on by focusing on the Canny edge detector, we would expect the test apple to be most closely related to the training apple, the orange second, and the banana last.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a candy land of image analysis, where the images are all &lt;em&gt;perfectly&lt;/em&gt; composed, their edges could line up such that the apples edges overlap exactly, the orange's edge overlaps a lot with the apple, and the banana's edges only overlap for the few pixels they intersect. However, in reality you are probably comparing images of different apples with different backgrounds and different composition. Imagine the test apple is shifted one pixel down and to the right, now it hardly overlaps with the training apple at all; the orange will be a better match. In this example, the binary image output from the Canny edge detector is not a &lt;strong&gt;robust&lt;/strong&gt; feature descriptor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of the Canny edge detector algorithm as a transformation of the image. It can be a useful step in getting to a powerful set of features which describe your image, but it itself is not &lt;em&gt;usually&lt;/em&gt; a powerful feature descriptor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what would be a powerful feature descriptor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;..well you didn't ask that ;)&lt;/p&gt;&#xA;" OwnerUserId="3564" LastEditorUserId="3564" LastEditDate="2013-01-14T03:07:18.273" LastActivityDate="2013-01-14T03:07:18.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="6504" PostTypeId="2" ParentId="6501" CreationDate="2013-01-14T05:00:44.047" Score="1" Body="&lt;p&gt;Since you have a periodic signal, you can look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow&quot;&gt;autocorrelation&lt;/a&gt;. The lag of the peaks will tell you the periods of the components. If by &quot;patterns&quot; you mean the peaks within each period, you can simply do another round of peak detection.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2013-01-14T05:06:22.047" LastActivityDate="2013-01-14T05:06:22.047" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6505" PostTypeId="1" AcceptedAnswerId="7508" CreationDate="2013-01-14T07:13:55.487" Score="2" ViewCount="3110" Body="&lt;p&gt;I'm playing with Python &amp;amp; numpy to filter audio. It is relatively straightforward to design and us low-high-bandpass/stop FIR and IIR filters, stuff can be done in a couple of lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm implementing a small software defined radio software, and I need an all-pass filter that has 90 degrees phase shift everywhere, and is flat (as much as possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I was unable to find any quick solution for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please share your thoughts on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tamás.&lt;/p&gt;&#xA;" OwnerUserId="1507" LastActivityDate="2023-09-19T23:45:35.753" Title="All-pass filter implementation in numpy" Tags="|python|allpass|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7504" PostTypeId="1" CreationDate="2013-01-14T13:55:58.907" Score="1" ViewCount="927" Body="&lt;p&gt;I want to learn computer vision and so I downloaded image processing slides from my university archive. I'm on histogram equalization. Learning about local histogram equalization points me out to this procedure:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The procedure is to define a square or rectangular window (m*n, n,m&#xA;  odds) and move the center of the window from pixel to pixel. At each&#xA;  location, the histogram of the points inside the window is computed&#xA;  and a histogram equalization transformation function is obtained. This&#xA;  function is finally used to map the intensity level of the pixel&#xA;  centered in the window to create a corresponding (processed) pixel in&#xA;  the output image. The center of the neighborhood region is then moved&#xA;  to an adjacent pixel location and the procedure is repeated.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(It is from a slide of my image processing course at university I don't think I can publish the link because it requires university credential)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering what kind of practical image this procedure can enhance. I have tried with &lt;a href=&quot;http://www.deepakantony.com/wp-content/uploads/2011/07/crowd.png&quot; rel=&quot;nofollow&quot;&gt;this example image&lt;/a&gt; but it does nothing then increment noise signal (global histogram equalization is much better) and it is super slow (no real-time usage can be even thought).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you advice me some test image in which this equalization procedure can be effective? When can I use it for real enhancement? What kind of image? With low contrast and big dark zone? In general, when does a local equalization is better then global equalization? Is it really usefull?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular I'm interested in when local histogram equalization increment noise signal or when it doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what about this particular procedure? I know that there are more specific tecniques (like Contrast limited adaptive histogram equalization). Is this a good tecnique?&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="1063" LastEditDate="2013-01-14T14:02:10.470" LastActivityDate="2013-01-14T14:02:10.470" Title="Local histogram equalization" Tags="|homework|equalization|histogram|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7505" PostTypeId="1" AcceptedAnswerId="7522" CreationDate="2013-01-14T10:11:05.070" Score="0" ViewCount="101" Body="&lt;p&gt;I'm having troubles trying to use one relatively simple noise estimation method, here it is:&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.173.1644&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;A Fast Method For Image Noise Estimation Using &#xA;Laplacian Operator and Adaptive Edge Detection&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is with their proposed noise deviation formula (page $2$, ($3$)), I can't seem to comprehend it. What I want to know am I right that this $N$ is amount of pixels in image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also I'm having troubles implementing first part of the formula since its result is float undeflow. Maybe I can just use regular pixel_value - pixel_mean formula? Will it produce same results? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Altrough images with massive noise will have mean that actually pretty much depends on the noise amount and thus estimation will be considerably lower than the real value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where can I read about this formula and how to use, or how it's even named? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I've implemented it wrongly, here's my code that does it: &#xA;&lt;a href=&quot;http://pastebin.com/Va4AhNqD&quot; rel=&quot;nofollow&quot;&gt;noise deviation implementation (C++ CImg)&lt;/a&gt;&#xA;It gives me very big numbers, like for noisy image of bears I got something like 1830152.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, what I'm supposed to get from that formula? Isn't it supposed to be some kind of 0.xx coefficient or maybe percent of noise in image?&lt;/p&gt;&#xA;" OwnerUserId="3599" OwnerDisplayName="Ivan0x32" LastActivityDate="2013-01-15T12:30:06.433" Title="Strange noise deviation formula" Tags="|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7506" PostTypeId="2" ParentId="6266" CreationDate="2013-01-14T14:44:15.950" Score="1" Body="&lt;p&gt;The constant Q transform is not a wavelet transform.  The constant Q transform is a particular variation on the short term Fourier transform in which the frequency bins are exponentially spaced instead of linearly spaced as is the case with the discrete Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See:  &lt;a href=&quot;http://en.wikipedia.org/wiki/Constant_Q_transform&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Constant_Q_transform&lt;/a&gt; for details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some wavelet transforms are also considered to be constant Q transforms because in the discrete versions of the transforms, the scale of the wavelet is varied exponentially (base being 2 in this case).  According to the following paper from Stanford university ( &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Continuous_Wavelet_Transform.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/sasp/Continuous_Wavelet_Transform.html&lt;/a&gt; ):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When the mother wavelet can be interpreted as a windowed sinusoid (such as the Morlet wavelet), the wavelet transform can be interpreted as a constant-Q Fourier transform.12.5Before the theory of wavelets, constant-Q Fourier transforms (such as obtained from a classic third-octave filter bank) were not easy to invert, because the basis signals were not orthogonal. See Appendix E for related discussion.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-14T14:44:15.950" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7507" PostTypeId="1" CreationDate="2013-01-14T14:47:46.317" Score="0" ViewCount="326" Body="&lt;p&gt;I would like to implement edge detectors for creating a feature vector for archeological signs.&#xA;Which are best features, algorithms to retrieve? That could be loaded in a Support vector machine for classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are in the image only signs with a uniform background it's better converting an image in a binary image and calculate convexHull, solidity, eccentricity, elongation of the archeological signs. &#xA;Then, what i do? I insert these data in a vector and put every vector of every image in a Support Vector Machine for training? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i measure &quot;distance&quot;, similarities among images?&lt;/p&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="3597" LastEditDate="2013-01-17T01:18:19.653" LastActivityDate="2013-01-17T01:18:19.653" Title="best robust feature detectors for detecting similarities among archeological signs" Tags="|computer-vision|edge-detection|local-features|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7508" PostTypeId="2" ParentId="6505" CreationDate="2013-01-14T15:12:20.770" Score="3" Body="&lt;p&gt;The Hilbert transform will produce a signal with 90 degree phase shift.  Look in Numpy documentation at &lt;a href=&quot;https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.hilbert.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;scipy.signal.hilbert&lt;/a&gt; as a start.&lt;/p&gt;&#xA;&lt;p&gt;I'm not sure what you are actually trying to do, but you mentioned 90 degree phase shift and radio in the same post, so you may find the following article of use:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://home.comcast.net/%7Eszemengtan/LinearSystems/hilbert.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://home.comcast.net/~szemengtan/LinearSystems/hilbert.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="7092" LastEditDate="2023-09-19T23:45:35.753" LastActivityDate="2023-09-19T23:45:35.753" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7509" PostTypeId="2" ParentId="7507" CreationDate="2013-01-14T16:09:09.633" Score="1" Body="&lt;p&gt;There is a difference between &lt;em&gt;edge detection&lt;/em&gt; and &lt;em&gt;feature detection&lt;/em&gt;, which is usually a &lt;em&gt;corner detection&lt;/em&gt; (e.g. Harris corner detector), &lt;em&gt;blob detection&lt;/em&gt; or even &lt;em&gt;region detection&lt;/em&gt; (e.g. MSER).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the features are detected in your image, they are described in some way. For point features (corners), there are many different descriptors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the simplest yet powerful one is simply taking a patch around the detected feature location. The patch can be quite large and should be rotated in the direction of dominant orientation (for rotational invariance).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The feature vector can consist of just horizontal and vertical image gradients. For a 64 by 64 pixel patch, this would lead to 4096 dimensional vector. This is quite large, but can be effectively reduced by PCA (Principal Component Analysis). This is quite slow but provides good quality and robustness of the descriptor comparable to SIFT or SURF descriptors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The SURF descriptor is based on Haar wavelet and is also quite easy to implement - it can produce smaller descriptor and hence PCA is not necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can take a look on &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/manik/projects/trade-off/papers/mikolajczykpami05.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; comparing various feature descriptors.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-01-14T16:09:09.633" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="7510" PostTypeId="1" AcceptedAnswerId="7517" CreationDate="2013-01-14T16:54:36.717" Score="1" ViewCount="84" Body="&lt;p&gt;How should buffer value at N/2 get initialized prior to performing an inverse FFT on a buffer, size N, that contains a complex frequency response in only values 0 to N/2-1?  It is pretty clear the buffer needs to be made symmetrical for prior to calculating the inverse FFT per table 12-1 of &lt;a href=&quot;http://www.dspguide.com/ch12/1.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch12/1.htm&lt;/a&gt;.  What is not clear is how to initialize the value at N/2.  Is it related to value at 0?&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2013-01-15T00:38:52.157" Title="Prepare Buffer for Inverse FFT" Tags="|fft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7511" PostTypeId="1" AcceptedAnswerId="7512" CreationDate="2013-01-14T17:11:12.407" Score="2" ViewCount="1895" Body="&lt;p&gt;I have a wav file containing a series of chords, each containing 3 or 4 notes, played concurrently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to find the frequencies of each note in each chord, and I can use matlab to do any computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I think I need to find the spectrogram of the wav file and convert the frequencies from normailsed frequencies to normal frequencies (I know the sampling rate). Here is the spectrogram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IAd36.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a good approach to solving this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already tried it, but the spectrogram isn't particularly informative. Is there an alternative method that I'm ignoring?&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="805" LastEditDate="2013-01-14T18:27:39.730" LastActivityDate="2013-01-14T20:21:09.070" Title="Finding the frequencies given in a wav file" Tags="|homework|spectrogram|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7512" PostTypeId="2" ParentId="7511" CreationDate="2013-01-14T18:57:48.267" Score="2" Body="&lt;p&gt;A spectrogram is problematic because the frequencies are not well localized.  You would be better off selecting a time window that only contains one chord and running an FFT to identify the frequencies.  Be aware that an FFT will essentially quantize the actually frequencies you are looking for into bins.  The resolution of the frequency bins depends on the length of your time window.  The longer the time window, the better the frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative, you can look into what is known as the constant Q transform which can be adapted to have frequency bins the align with the normal progression of musical notes.&#xA;See:  &lt;a href=&quot;http://www.elec.qmul.ac.uk/people/anssik/cqt/smc2010.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.elec.qmul.ac.uk/people/anssik/cqt/smc2010.pdf&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-14T18:57:48.267" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7513" PostTypeId="2" ParentId="6464" CreationDate="2013-01-14T19:06:53.760" Score="3" Body="&lt;p&gt;You can try looking at Hu invariant moments. They can be constructed from basic moments, and are rotation, scale, reflection, and translation invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate them for a set of training contours first, and then apply them to the test contour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are implementations in Matlab and OpenCV, as far as I remember.&lt;/p&gt;&#xA;" OwnerUserId="3603" LastEditorUserId="39" LastEditDate="2013-01-14T21:18:01.013" LastActivityDate="2013-01-14T21:18:01.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7514" PostTypeId="2" ParentId="7511" CreationDate="2013-01-14T20:15:35.667" Score="4" Body="&lt;p&gt;Polyphonic pitch estimation is still a difficult problem.  Search on the &lt;a href=&quot;http://www.music-ir.org/mirex/wiki/2012%3aMain_Page&quot; rel=&quot;nofollow&quot;&gt;MIREX&lt;/a&gt; forum for current research papers.  Simplistic spectrum based approaches usually require component pitches with extremely simple timbres (nearly pure unmodulated sine waves, etc.) rarely found in real-life polyphonic music.  More typical polyphonic music can contain a dense set of overlapping overtones plus other transient noises.  More complicated timbres creating polyphonic chords may require a statistical pattern matching based approach (against a database of potential instrument sounds), and/or machine learning algorithms, in addition to any signal processing for spectrum and envelope information.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-01-14T20:21:09.070" LastActivityDate="2013-01-14T20:21:09.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7515" PostTypeId="2" ParentId="6501" CreationDate="2013-01-14T20:57:35.560" Score="2" Body="&lt;p&gt;You can trying using a musical pitch detection/estimation algorithm, which may be more robust in some cases than just a simple autocorrelation (especially in one of your examples that includes a slightly inharmonic overtone).  From the frequency or period of the estimated &quot;pitch&quot; you can compute the number of pattern repetitions per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bunch of pitch estimation methods are mentioned in my answer to this question: &lt;a href=&quot;https://stackoverflow.com/questions/7181630/fft-on-iphone-to-ignore-background-noise-and-find-lower-pitches&quot;&gt;https://stackoverflow.com/questions/7181630/fft-on-iphone-to-ignore-background-noise-and-find-lower-pitches&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-01-14T21:04:18.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7517" PostTypeId="2" ParentId="7510" CreationDate="2013-01-15T00:38:52.157" Score="1" Body="&lt;p&gt;Normally a buffer of N points of data in the frequency domain covers, much like a two's complement number, -N/2 to +N/2-1.  So when you say that it doesn't cover N/2, it probably doesn't matter.  If it does matter and there is a &quot;place&quot; for N/2, just do as Paul suggested and set it to 0.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-01-15T00:38:52.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7519" PostTypeId="1" AcceptedAnswerId="7525" CreationDate="2013-01-15T06:35:19.880" Score="0" ViewCount="7709" Body="&lt;pre&gt;&lt;code&gt;  I = imread('13.jpg');&#xA;  Ir = I(:,:,1);&#xA;  Ig = I(:,:,2);&#xA;  Ib = I(:,:,3);&#xA;&#xA;   %# Create the gaussian filter with hsize = [5 5] and sigma = 2&#xA;   G = fspecial('gaussian',[10 10],1);&#xA;  %# Filter it&#xA;  Ig = imfilter(I,G,'same');&#xA;  %# Display&#xA;  imshow(Ig);&#xA;&#xA;  PSF = fspecial('gaussian',7,10);&#xA;&#xA;  Irc = conv2(Ir,PSF,'same');&#xA;  Igc = conv2(Ig,PSF,'same');&#xA;  Ibc = conv2(Ib,PSF,'same');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why am I getting this error?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       Warning: CONV2 on values of class UINT8 is obsolete.&#xA;       Use CONV2(DOUBLE(A),DOUBLE(B)) or&#xA;       CONV2(SINGLE(A),SINGLE(B)) instead. &#xA;       In uint8.conv2 at 11&#xA;       In Gaussian_Filter_image at 19 &#xA;      Warning: CONV2 on values of class UINT8 is obsolete.&#xA;       Use CONV2(DOUBLE(A),DOUBLE(B)) or&#xA;       CONV2(SINGLE(A),SINGLE(B)) instead. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;    In uint8.conv2 at 11&#xA;       In Gaussian_Filter_image at 20 &#xA;       Undefined function 'conv2' for input arguments of type 'double'&#xA;       and attributes 'full 3d real'.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      Error in uint8/conv2 (line 18)&#xA;       y = conv2(varargin{:});&#xA;&#xA;       Error in Gaussian_Filter_image (line 20)&#xA;       Igc = conv2(Ig,PSF,'same');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here I want to perform convolution of image and gaussian filter but I am unable to do that ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have even tried the modification after using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   Ir = double(:,:,1);&#xA;   Ig = double(:,:,2);&#xA;   Ib = double(:,:,3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then also I am getting the same error?&lt;/p&gt;&#xA;" OwnerUserId="1757" LastEditorUserId="39" LastEditDate="2013-01-15T12:05:45.123" LastActivityDate="2013-01-15T16:22:16.360" Title="How to use convolution operator in matlab?" Tags="|matlab|image-processing|convolution|" AnswerCount="1" CommentCount="2" ClosedDate="2013-01-16T00:07:06.653" ContentLicense="CC BY-SA 3.0" />
  <row Id="7520" PostTypeId="1" AcceptedAnswerId="7523" CreationDate="2013-01-15T09:13:55.783" Score="1" ViewCount="159" Body="&lt;p&gt;I have an EEG signal that I want to extract features to apply multilayer perceptron (MLP). What I should use, Fourier or wavelet coefficients?&lt;/p&gt;&#xA;" OwnerUserId="3510" LastEditorUserId="1825" LastEditDate="2013-01-15T12:30:44.340" LastActivityDate="2013-01-15T13:40:25.677" Title="What features to use for multilayer perceptron model of an EEG signal?" Tags="|frequency-domain|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7522" PostTypeId="2" ParentId="7505" CreationDate="2013-01-15T12:30:06.433" Score="0" Body="&lt;p&gt;I can answer the first part of your question: Where formula 2(3) comes from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the noise model is Laplacian, you are looking at an estimate of the standard deviation of a Laplace distribution. Compare the moments equation on this Wikipedia page: &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_distribution#Moments&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Laplace_distribution#Moments&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for what N is, it looks like they define it as a matrix operator in 2(2). So the sum in 2(3) is taken over pixels of an image generated by convolving the original image I(x,y) with the Laplacian operator N (which is denoted by $I(x,y)*N$, where $*$ is the convolution operator).&lt;/p&gt;&#xA;" OwnerUserId="1825" LastActivityDate="2013-01-15T12:30:06.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7523" PostTypeId="2" ParentId="7520" CreationDate="2013-01-15T13:40:25.677" Score="1" Body="&lt;p&gt;Fourier analysis doesn't provide you with temporal information.  If you need temporal information you have several choices, two of which are the short term Fourier transform STFT, and wavelet transforms.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The STFT provides frequency coefficients in fixed time intervals across your data.  There is a trade off between the time and frequency resolution obtained.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelet transforms pick apart features in your data at various time resolutions which may give you better time localization for your coefficients.  Additionally, you can choose different wavelet functions to control how features of your signal are extracted.  Another way of saying this is that your choice of wavelet function affects what your coefficients represent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the work on feature extraction that I've seen recently (this is in general, no specific to EEG signals) employ some form of wavelet analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example paper: &lt;a href=&quot;http://uprt.vscht.cz/vav/RSoftware/S7help.pdf&quot; rel=&quot;nofollow&quot;&gt;http://uprt.vscht.cz/vav/RSoftware/S7help.pdf&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-15T13:40:25.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7525" PostTypeId="2" ParentId="7519" CreationDate="2013-01-15T15:57:34.407" Score="2" Body="&lt;p&gt;You are getting the error because image &lt;code&gt;I&lt;/code&gt; is of class (data type) 'uint8', and the arguments to &lt;code&gt;conv2&lt;/code&gt; must be of class 'single' or 'double', i. e. floating point. You can get rid of the error by converting &lt;code&gt;I&lt;/code&gt; to double.  The best way to do that is to call &lt;code&gt;I = im2double(I)&lt;/code&gt;, which will re-scale the pixel values to be between 0 and 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But looking at the big picture, you should not use &lt;code&gt;conv2&lt;/code&gt; at all, and use &lt;code&gt;imfilter&lt;/code&gt; instead, which does take 'uint8' images.  Look at the help for it.  By default it does correlation, but it can also do convolution.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2013-01-15T16:22:16.360" LastActivityDate="2013-01-15T16:22:16.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7526" PostTypeId="2" ParentId="3595" CreationDate="2013-01-15T17:00:21.250" Score="10" Body="&lt;p&gt;I had tried something else to improve my result in question. Below solution is on the assumption that first square(orange) is always detected in step 1. And it is practical due to its high contrast color compare to background. Even the result I showed in question has detected it correctly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 1 : Find as many squares possible&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I split the image to R,G,B,H,S,V planes and thresholded the image for different threshold values like multiples of 25. For each image, I found squares in it, and put them on a &lt;strong&gt;&quot;mask image&quot;&lt;/strong&gt;. I also found average height and width of the square.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mask image (Total 7/12 squares detected) :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uvLIh.png&quot; alt=&quot;mask image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2 : Form a grid of squares&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I found the centroids of these squares in mask image. Sorted them and found the centroid of first square(orange). From close analysis, we can see the gap between two squares is a square in both horizontal and vertical direction. So this way, I made a grid of squares like below and called it &lt;strong&gt;ideal_squares&lt;/strong&gt; (it is just a name, it doesn't mean this is the output I need):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ideal_squares :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yc3yL.png&quot; alt=&quot;ideal image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3: Remap the ideal_image&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we have the ideal_squares centroids and original centroids. I found out the correct matches for each original centroid from ideal_centroids (by taking euclidean distance between them). Then I used Scipy interpolate.griddata for interpolation and remapped ideal_image as per the centroid values (it is almost same as warping done in these Q&amp;amp;A : &lt;a href=&quot;https://stackoverflow.com/questions/10196198/how-to-remove-convexity-defects-in-sudoku-square&quot;&gt;&lt;strong&gt;How to remove convexity defects in sudoku square&lt;/strong&gt;&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://stackoverflow.com/questions/10364201/image-transformation-in-opencv&quot;&gt;&lt;strong&gt;Image transformation in OpenCV&lt;/strong&gt;&lt;/a&gt;). So below is the output I got :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4BzV6.png&quot; alt=&quot;Output Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 4 : OR operate above output with mask image from first step&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9dttC.png&quot; alt=&quot;final output&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can see all the squares are detected, but with a problem mentioned below :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the output of the Step 3, ie remapped image of square grid. Except two central squares, all other squares are clipped. It is a problem associated with this remapping. I am not sure where is the problem, with scipy.interpolate.griddata() or cv2.remap(). I thought the whole image will be warped, but it is not. It warps only image inside the centroids we gave. If I can correct that, the output will be OK. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if someone knows a good idea for that, most welcome !!!&lt;/p&gt;&#xA;" OwnerUserId="818" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-01-15T18:57:23.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7527" PostTypeId="1" CreationDate="2013-01-15T06:52:35.450" Score="13" ViewCount="23814" Body="&lt;p&gt;I have multiple trials of physiological data. I am doing a frequency based analysis to analyze power (amplitude) in certain frequencies of interest. Is averaging multiple trials of equal length and then taking a single FFT of the averaged signal vs computing FFT for each trial and then averaging the frequency bins the same? In practice im finding this not to be the case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, the signal naturally has a strong 1/f component and this gets emphasized if I compute the FFT of each individual trial and then average the amplitudes (real part) of each frequency bin. Are the two equivalent? is there a right way to do things? or under what principled conditions should the choice between time domain averaging vs frequency bin averaging be made?   &lt;/p&gt;&#xA;" OwnerDisplayName="user1487551" LastActivityDate="2022-06-03T13:45:24.760" Title="FFT time domain average vs frequency bin average" Tags="|fft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7528" PostTypeId="2" ParentId="7527" CreationDate="2013-01-15T07:00:51.330" Score="2" Body="&lt;p&gt;First, the FFT is an algorithm. The transform is called the Fourier Transform! It represents the histogram of the signals. In the discrete case, a high reading in the frequency domains means lots of energy at that frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should not average the data before the FFT as phase information will cause a significant changes in data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine 2 samples each consisting of a pure cosine. In the real world you will never capture this cosine at the exact same starting point. One cosine will be shifted reletive to other (or both have different shifts reletive to the start. Mathmatically this is saying y1=cos(wt-A) y2=cos(wt-B) where A  &amp;amp; B are shifts. In your model these two better show up as the same thing. With a little math I can choose these values so that y2-y1=0. The average of zero is zero and entirely not what you want. This is the phase problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you goal is to find the average spectrum you should average across spectra, don't average the signals!&lt;/p&gt;&#xA;" OwnerUserId="941" OwnerDisplayName="Mikhail" LastActivityDate="2013-01-15T07:08:36.060" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7529" PostTypeId="2" ParentId="3595" CreationDate="2013-01-15T19:28:22.967" Score="6" Body="&lt;p&gt;Step 1: Whatever final binary image you are getting from analyzing in B,G,R,H,S,V plane, in that image do a blob counting algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2: Find the largest blob on basis of area or contour length. Since your blobs will be mostly parallelogram types so area or contour, any one will do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 3: With the largest blob (since largest blob is the best blob resembling your real world squares) try to find the orientation of the blob...this you can get by a fitting a best fit rectangle OR you can get the corner points...get the slope of the lines joining them (in both horizon and vertical direction).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 4: Once you get the two slopes draw two lines running through the axis of the blob. for axis you can average the corner points or you can use the centroid (center of mass)...I would go with average of corner points...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 5: Since in each horizontal and vertical direction, spacing is equal (ideally horizontal and vertical spacing are also equal as it comes from your ideal square picture but we will not assume it..) just need to locate the possible centroids of the other parallelograms&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BOTTOM LINE:&lt;/strong&gt; If any one square gets detected perfectly you can make the whole grid. Just keep marking centers at an interval of 2H (H = horizontal width of biggest blob) along the horizontal axis of the biggest blob and at an interval of 2V (V = vertical height of biggest blob) vertically along the vertical axis of the blob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some pics to support&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4bIMa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z0LBi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1942" LastActivityDate="2013-01-15T19:28:22.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7531" PostTypeId="2" ParentId="3512" CreationDate="2013-01-16T01:09:18.987" Score="2" Body="&lt;p&gt;As you probably know, there is a developed literature on deblurring. Regarding the evaluation of the PSF, you may find these useful:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Understanding and evaluating blind deconvolution algorithms&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Modeling the Performance of Image Restoration From Motion Blur&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If the known object $X_0$ is going to be shot head on in subsequent frames $Y_i$, you can find the blur kernel $K$ by maximizing some image similarity metric $I$ for basic (say, procrustes) transformations $T$ of $X_0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$K_i = \underset{K, T}{\arg \max} \; I \left( K \ast T X_0 ; Y_i \right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a more sophisticated formulation, you could enforce temporal smoothness priors on the $K_i$'s and $T$'s. I would also suggest using the last frame's optimal estimates as initial values for the next frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $X_0$ appears at an angle in $Y_i$ (since it is moving, after all) I conjecture that you will have a hard time finding a good match (that is, $X_0$ will not be of much use). Obviously, there is &lt;em&gt;some&lt;/em&gt; information to be leveraged, even when shot at an angle, but I suspect the effort will not be worth it. This leads me to wonder what sort of a scenario you would be able to use this technique in. You know what they say: there's one way to find out.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2013-01-16T02:24:09.210" LastActivityDate="2013-01-16T02:24:09.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7533" PostTypeId="1" CreationDate="2013-01-16T05:46:43.237" Score="1" ViewCount="3587" Body="&lt;p&gt;i am simulating OFDM transmitter in matlab....As u all know OFDM consists of different sub systems such as FEC coding, Bit interlever , Modulator , IFFT block and Adding cyclic prefix.... i have integrated all the subsystems.. now i have to check the datarate of the complete OFDM transmitter...how to find the datarate of this system.... i am comparing Different modulation technique, in the sense am using qpsk, 8 qam and 16 qam modulations and have to compare the datarate of these modulation techniques... &lt;/p&gt;&#xA;" OwnerUserId="3610" LastEditorUserId="3610" LastEditDate="2013-01-16T13:12:17.467" LastActivityDate="2013-01-18T21:59:08.760" Title="OFDM transmitter data rate" Tags="|matlab|image-processing|modulation|ofdm|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7534" PostTypeId="2" ParentId="327" CreationDate="2013-01-16T07:25:01.573" Score="2" Body="&lt;p&gt;A popular and performant method is to use a feature vector consisting of binarized nonlinear kernel classifiers, each of which encodes some abstract property of the image. One salient advantage of the method is its scalability, since it condenses each image into a few bits. (That's what the binarization is for.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A representative paper is &lt;a href=&quot;http://slipguru.disi.unige.it/Downloads/publications/TIP-preprint.pdf&quot; rel=&quot;nofollow&quot;&gt;Building Kernels from Binary Strings for Image Matching&lt;/a&gt;, and &lt;a href=&quot;http://techtalks.tv/talks/learning-a-compact-image-code-for-efficient-recognition-of-novel-classes/57857/&quot; rel=&quot;nofollow&quot;&gt;here is a presentation on the subject&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's too heavy or overkill I'll take another look into my archives.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-01-16T07:25:01.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7535" PostTypeId="1" AcceptedAnswerId="7592" CreationDate="2013-01-16T08:06:18.677" Score="2" ViewCount="1852" Body="&lt;p&gt;I'm currently designing a receiver which has to determine whether a signal contains specific frequencies or not. The frequencies are at constant 215Hz difference: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{16,351  16,566  16,781  16,996  17,211   17,426  17,641  17,856  18,071}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I sample at 44100kHz and I have 1024 samples each time. Therefore my resolution is 44100/1024=43.06Hz, and the bins centers are multiples of 43.06:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Bin[1]=43.06Hz,... BIN[385]=16578.10    BIN[386]= 16621.16   &#xA;BIN[387]=16664.22    BIN[388]=16707.28     IN[389]=16750.34&#xA;BIN[390]=16793.40    BIN[391]=16836.46    BIN[392]=16879.52    &#xA;BIN[393]=16922.58    BIN[394]=16965.64    BIN[395]=17008.70   &#xA;BIN[396]=17051.76    BIN[397]=17094.82,....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My algorithm is based on comparing the values of the desired bins (or the nearest ones) to the values of the bins in between.&#xA;for example, if I wish to know if 16,566 exists or not, I compare BIN[385] to BIN[386],BIN[387],BIN[384],BIN[383] and if it's value is significantly larger (say by a hundred) then the average value of the side ones then I conclude that this frequency does exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is as follows: considering the fact that I work in &lt;strong&gt;high noise environment&lt;/strong&gt;, and the algorithm I use is the one above, what would be the best window for me to apply before the FFT, other than the obvious rectangular window I currently use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3514" LastActivityDate="2013-01-22T03:52:18.150" Title="best window for close frequency components" Tags="|fft|noise|sampling|window-functions|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7536" PostTypeId="1" AcceptedAnswerId="7578" CreationDate="2013-01-16T09:33:31.320" Score="2" ViewCount="368" Body="&lt;p&gt;I have images where there is a lot of &quot;black&quot; background (few shades of black). (In many images at least half the pixels are background). I need to get interest points from the image, but because the background is not smooth (although black) , I get a lot of &quot;false&quot; key points in the background.&#xA;What filter/s will fit best to keep the details in the image but will smooth the background as much as possible ?&#xA;I tried median filter, but the size needed to reduce background noise ([5 5]) was to strong for the small details in the image I wanted to keep sharp, same for Gaussian with very small sigma. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="128" LastEditDate="2019-06-24T18:01:33.370" LastActivityDate="2019-06-24T18:01:33.370" Title="Filter for Reducing Background Noise in Image" Tags="|image-processing|filters|computer-vision|lowpass-filter|smoothing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7537" PostTypeId="1" AcceptedAnswerId="8662" CreationDate="2013-01-16T12:00:09.183" Score="4" ViewCount="1152" Body="&lt;p&gt;Hello I've been trying to understand the grayscale dilation operation using the following example, but my results are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$I = \begin{pmatrix}&#xA;\bf{5} &amp;amp; 2 &amp;amp; 4 \\&#xA;1 &amp;amp; -3 &amp;amp; 1&#xA;\end{pmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is the image to be dilated, and the structuring element is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S = \begin{pmatrix}&#xA;0 &amp;amp; x &amp;amp; \bf{0} \\&#xA;0 &amp;amp; 2 &amp;amp; -1&#xA;\end{pmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have marked the origin in the structuring element and the image (the bold $\bf5$ in the top left of $I$ and the bold $\bf0$ in the top right of $S$), and $x$ means that the pixel is not part of the structuring element.&#xA;The correct answer is supposed to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{pmatrix}&#xA;5 &amp;amp; 2 &amp;amp; 5 &amp;amp; 2 &amp;amp; 4 \\&#xA;5 &amp;amp; 7 &amp;amp; 4 &amp;amp; 6 &amp;amp; 3 \\&#xA;1 &amp;amp; 3 &amp;amp; 1 &amp;amp; 3 &amp;amp; 0&#xA;\end{pmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but my result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{pmatrix}&#xA;4 &amp;amp; 7 &amp;amp; 5 &amp;amp; 6 &amp;amp; 4 \\&#xA;5 &amp;amp; 3 &amp;amp; 5 &amp;amp; 3 &amp;amp; 4 \\&#xA;1 &amp;amp; -3 &amp;amp; 1 &amp;amp; -3 &amp;amp; 1&#xA;\end{pmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did was, put the center of the s.e. in each pixel, for each pixel in the neighborhood sum pixel to pixel their values and take the max of the neighborhood as the new value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when the s.e. is in pixel $I(0,1)$ then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\max( I(0,0)+SE(0,-1), I(0,1)+SE(0,0), I(1,0)+SE(1,-1), I(1,1)+SE(1,0) ) =\\ \max(5+x=x, 2, 3, -4)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can someone explain to me what is the correct way of doing this?&lt;/li&gt;&#xA;&lt;li&gt;In the dilation do we need to flip the structuring element? What about erosion?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3262" LastEditorUserId="80" LastEditDate="2013-04-25T20:07:32.203" LastActivityDate="2013-04-25T20:07:32.203" Title="Grayscale morphology" Tags="|image-processing|morphological-operations|morphology|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7538" PostTypeId="1" AcceptedAnswerId="7555" CreationDate="2013-01-16T12:03:04.847" Score="4" ViewCount="987" Body="&lt;p&gt;I have a block of n bits that I'd like to encode into m bits that have an equal number of zeros and ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked at protocols like 8b/10b but it wastes 25% of the data to achieve balance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, it turns out that 128 bits have ${128 \choose 64}$ combinations where there is an equal number of zeros and ones.  This number is greater than $2^{124}$.  This means that I should be able to encode 124 bits of data into 128 bits that have an equal number of zeros and ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea how to do this mapping though.  Obviously I can't make a look-up table of size $2^{124}$.  Anyone have any ideas?  &lt;/p&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="90" LastEditDate="2013-01-16T19:02:39.597" LastActivityDate="2013-01-16T23:09:48.397" Title="Optimal DC-free line encoding" Tags="|algorithms|digital-communications|channelcoding|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7539" PostTypeId="1" AcceptedAnswerId="13869" CreationDate="2013-01-16T12:20:33.210" Score="5" ViewCount="566" Body="&lt;p&gt;Are there any general assumptions for the calculation of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hurst_exponent&quot;&gt;Hurst exponent&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Does the signal need to be stationary, for example?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does it depend on the method?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What about the length of the time series, is longer better?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am interested in using implementing it for the analysis of an EEG signal. I have read many articles but can't find answers for these questions.&lt;/p&gt;&#xA;" OwnerUserId="3502" LastActivityDate="2015-04-29T22:07:49.237" Title="Assumptions for Hurst exponent calculation" Tags="|autocorrelation|signal-analysis|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7540" PostTypeId="2" ParentId="7536" CreationDate="2013-01-16T13:16:15.913" Score="1" Body="&lt;p&gt;You can reduce image size or use scale-invariant interest point detector which can deal with blurry images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that using some elaborate denoising algorithm may change each image in a slightly different way, thus possibly distorting the positions of your interest points.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-01-16T13:16:15.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7542" PostTypeId="2" ParentId="7538" CreationDate="2013-01-16T14:11:55.743" Score="2" Body="&lt;p&gt;There are more modern protocols that should be able to achieve the efficiency that you want. For example, &lt;a href=&quot;http://en.wikipedia.org/wiki/PCI_Express#PCI_Express_3.0&quot; rel=&quot;nofollow&quot;&gt;PCI Express 3.0&lt;/a&gt; (the most recent revision) uses 128b/130b encoding, which encodes 128 information bits into 130 channel bits. Ther seems to be on the order of overhead that you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of the implementation details for this specific encoder, but that should give you a place to start looking. For such a widespread standard, I'm guessing that you can find a description somewhere, or at least look at the standard for information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; It appears that in this case, a linear-feedback shift register is used. According to &lt;a href=&quot;http://www.designers-guide.org/Forum/YaBB.pl?num=1284927313&quot; rel=&quot;nofollow&quot;&gt;this forum post&lt;/a&gt;, the polynomial is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x^{23} + x^{21} + x^{16} + x^8 + x^5 + x^2 + 1.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't tell the complete story, because I'm not sure how the register is initialized or how the data is fed through.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-01-16T14:11:55.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7543" PostTypeId="2" ParentId="7538" CreationDate="2013-01-16T14:15:45.630" Score="2" Body="&lt;p&gt;To add to the other comments and answers, managing the DC component in your signaling stream is generally done by employing bipolar line coding techniques.  There are many.  Here is a reference:  &lt;a href=&quot;http://www.engr.sjsu.edu/rmorelos/ee161s12/PulseShaping.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.engr.sjsu.edu/rmorelos/ee161s12/PulseShaping.pdf&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-16T14:15:45.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7544" PostTypeId="1" AcceptedAnswerId="7547" CreationDate="2013-01-16T14:20:18.797" Score="8" ViewCount="1858" Body="&lt;p&gt;I am developing software for transmitting data from a computer to a mobile device using audio. Specifically, from the computer's speaker to the device's microphone. (I am developing both the sender and the receiver software.) This is one channel, and the sample rate is a standard 44.1Khz. It needs to be VERY resilient to noise - it will be used in environments with street noise, people talking, background music, etc., which may be 10dB louder than the signal itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing almost nothing about DSP, thus far I have apparently implemented frequency-division multiplexed on-off keying, without realizing it until now :) Basically each of 96 frequencies corresponds to a bit, and on the receiving end, if the frequency is present, the bit is on. I then use some custom error correction code to whittle those 96 bits down to 8 very reliable bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My system works very well and is very robust, but unfortunately has an EXTREMELY low data rate (~80 bits/sec). I have some ideas about how to improve bandwidth, like using more than 96 frequencies, and using the phase component to encode additional data. Also it appears I should look into frequency-shift keying and phase-shift keying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So - my question is simply this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the options for encoding data in a noisy broadcast audio signal, and what kind of bandwidth and error rates can be expected with each technique?&lt;/p&gt;&#xA;" OwnerUserId="3609" LastEditorUserId="3609" LastEditDate="2013-01-17T14:49:02.827" LastActivityDate="2013-01-17T14:49:02.827" Title="Common methods of transmitting digital data through an extremely noisy audio signal?" Tags="|audio|frequency-spectrum|frequency|demodulation|digital-communications|" AnswerCount="3" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7545" PostTypeId="2" ParentId="7544" CreationDate="2013-01-16T14:39:34.463" Score="4" Body="&lt;p&gt;It seems that your are trying to recreate work that has been done for voice band modems.  A simple and very reliable, protocol which is used in fax transmission is ITU V.21 300 bps FSK.  This modulation scheme is thoroughly documented.  This type of modulation is used for control signaling in FAX transmissions because it is very robust.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to go up to higher speeds, you are looking PSK which has been used for up to 9600bps on voice band channels.  Beyond that, you are looking at a very complex scheme using QAM, but I don't think you need to go there.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-16T14:39:34.463" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7547" PostTypeId="2" ParentId="7544" CreationDate="2013-01-16T16:07:54.240" Score="6" Body="&lt;p&gt;The scheme you are using is called &lt;a href=&quot;http://en.wikipedia.org/wiki/On-off_keying&quot;&gt;On/Off Keying&lt;/a&gt;.  It is not terribly efficient, but it is simple and gets the job done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you say that the signal is 10 dB below the noise floor I suspect what you mean is that if you add up all the signal energy and all of the noise from 0.3 - 14 kHz the signal is 10 dB weaker, but that the signal uses a much narrower frequency range, making the signal stronger at very specific frequencies.  If it wasn't, you would not be getting reliable data transmission without doing long synchronous averaging, and it sounds like you aren't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a number of different ways you could do this.  The state of the art would be to use an &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing&quot;&gt;OFDM&lt;/a&gt; signal in the 17-21 kHz band.  A much simpler but not as efficient way to go (but still much more efficient than your OOK) would be to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-shift_keying&quot;&gt;QPSK&lt;/a&gt; signal in the 17-21 kHz band.  If you have enough transmission power you could modify it to 8-PSK or 16-QAM for higher throughput.  Since it sounds like the transmission power is more of a limitation than the bandwidth (you can get a lot more data through 4 kHz of bandwidth than 80 bits/s), I would add a &lt;a href=&quot;http://en.wikipedia.org/wiki/Forward_error_correction&quot;&gt;forward error correction&lt;/a&gt; (FEC) code to the data stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With QPSK you can get (ignoring the potential reduction in throughput from the error correction code) 1 bit/s/Hz, so you would have an upper limit of 4 kbits/s.  With 8-PSK it would be 6 kbits/s, and with 16-QAM it is 8 kbits/s.  The price of going with the higher data rates is that you are more likely to have errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data rate for OFDM is more complicated.  Given your level of DSP knowledge I would go with QPSK, and then modify from there if needed.  It sounds like you would be thrilled with anything even close to 4 kbits/s, so that should be plenty good enough.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-01-16T16:07:54.240" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7548" PostTypeId="1" AcceptedAnswerId="7549" CreationDate="2013-01-16T08:00:46.263" Score="3" ViewCount="3393" Body="&lt;p&gt;I want to make any song sound like it's being played on a gramophone record in the 1920s. What specific filters would I apply to make this happen? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for technical details, not some magical program that does it for me. I'm trying to create a programming interface that does this, so a user interface doesn't work. I'm a Math major with understanding of FFTs, but I don't know all the lingo.&lt;/p&gt;&#xA;" OwnerUserId="3616" OwnerDisplayName="Jonathan Ong" LastActivityDate="2013-01-24T06:52:35.777" Title="What audio effects, filters, distortions, etc. create a &quot;vinyl&quot; effect?" Tags="|audio|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7549" PostTypeId="2" ParentId="7548" CreationDate="2013-01-16T14:59:46.907" Score="7" Body="&lt;p&gt;I don't know the precise formula for 1920's gramophone, but this is the general process for audio antiquing and should get you started. Depending on the exact settings, you can get vinyl, telephone, etc.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Convert to mono.&lt;/li&gt;&#xA;&lt;li&gt;Add white noise.&lt;/li&gt;&#xA;&lt;li&gt;Bandpass. I would start with a HP at 80 HZ and a steep LP at 8 kHz, but that's a guess. You'll have to use your ears until it sounds like the gramophone. You should try Chebychev and Butterworth filters if available.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You may also want to add &quot;clicks&quot; and &quot;Pops&quot;. You can model those in a variety of ways. One way to start is with a Dirac function and filter it with bandpass functions. Depending on how strict your bandpass in step three is, you might be able to just add the clicks and pops as Diracs at the same time you add white noise, but then all your clicks and pops will sound about the same, which isn't very realistic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some other things you may want to try for more realism:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;applying compression and saturation after step 1.&lt;/li&gt;&#xA;&lt;li&gt;applying wow and flutter emulation either before step 2 or after (or, for most accuracy, two stages of white noise before and after the wow and flutter emulation).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You may want to ask on &lt;a href=&quot;https://video.stackexchange.com/&quot;&gt;https://video.stackexchange.com/&lt;/a&gt; to see exactly what filter settings they would recommend for 1920's gramophone in particular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For tips on implementing basic audio filters, I have a blog post: &lt;a href=&quot;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1543" OwnerDisplayName="Bjorn Roche" LastEditorUserId="-1" LastEditDate="2017-04-12T07:32:17.973" LastActivityDate="2013-01-16T14:59:46.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7550" PostTypeId="2" ParentId="7544" CreationDate="2013-01-16T17:13:29.580" Score="5" Body="&lt;p&gt;It seems like you are already using a crude version of &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing&quot; rel=&quot;nofollow&quot;&gt;OFDM&lt;/a&gt; with no cyclic prefix, no coding (FEC), and lots of unused sub-carriers.  What you are currently doing is also similar to amateur radio protocols such as &lt;a href=&quot;http://www.arrl.org/mt-63&quot; rel=&quot;nofollow&quot;&gt;MT-63&lt;/a&gt;.  You could also look into spread spectrum modulation techniques (many) that were designed for very noisy channels with lots of interference.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-01-16T17:58:39.660" LastActivityDate="2013-01-16T17:58:39.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7551" PostTypeId="1" CreationDate="2013-01-16T17:50:29.833" Score="3" ViewCount="914" Body="&lt;p&gt;Let me start by clarifying the terminology that I will be using in the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A codec packet is the compressed data which an encoder returns when it is called once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An RTP payload can consist of one codec packet or a sequence of codec packets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the RFC for SILK allow the RTP payload to consist of more than one codec packet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, how do I split up the received RTP payload into the codec packets so each packet can be &#xA;decoded later in time (one codec packet at a time) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An application encodes 20ms 16bit LPCM audio blocks using SILK. Each codec packet is sent down to the network&#xA;stack for transmission via RTP. Let's say that the first 4 times the encoder is called, the encoder outputs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A 20ms codec packet of size 39 bytes&#xA;2) A 20ms codec packet of size 35 bytes&#xA;3) A 20ms codec packet of size 41 bytes&#xA;4) A 20ms codec packet of size 32 bytes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The network stack in the application assembles an RTP payload consisting of the 4 codec packets. So in this&#xA;case the RTP payload size is 39 + 35 + 41 + 32 = 147 bytes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the receiving end, the 147 byte RTP payload is received. How is the receiving application supposed to split&#xA;up the RTP payload into the original 4 codec packets of 39, 35, 41 and 32 bytes, respectively????&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure that the RFC doesn't allow this kind of scenario, but I want to make sure. Can somebody confirm&#xA;whether or not the RFC allows for more than one codec packet per RTP payload???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I understand, the RFC only allows ONE codec packet per RTP payload. If it's desired to send 80ms &#xA;per payload, the way it should be done is to configure the encoder to output 80ms codec packets (instead of 20ms).&#xA;Is this correct???&lt;/p&gt;&#xA;" OwnerUserId="3613" LastActivityDate="2013-10-14T02:38:12.307" Title="Skype's SILK Codec" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7552" PostTypeId="2" ParentId="7535" CreationDate="2013-01-16T17:52:13.183" Score="0" Body="&lt;p&gt;A rectangular window (no window) will give you the deepest notch in the immediately adjacent bins, however it is not very robust against &quot;spectral leakage&quot; from noise.   Any other window will cause significant spreading of any carrier into the immediately adjacent bins, so you won't get a 100X notch in those adjacent bins.  For looking 2 or 3 bins away, you could specify a window with a low stop-band in that region and beyond.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-01-16T17:52:13.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7553" PostTypeId="2" ParentId="1692" CreationDate="2013-01-16T17:59:21.453" Score="4" Body="&lt;p&gt;&lt;s&gt;If you have under 10 pages, &lt;a href=&quot;http://captricity.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Captricity&lt;/a&gt; can do it for free.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Out of the box, there are no good open source solutions to what you're looking for. Paid solutions cost a lot to license. This is based our experience building a handwriting OCR service at &lt;a href=&quot;http://captricity.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Captricity&lt;/a&gt;. We do use tesseract in production, but only as a vote that is combined with human intelligence (crowdsourcing) to deliver a high level of quality.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="3614" LastEditorUserId="8256" LastEditDate="2017-04-24T13:04:59.530" LastActivityDate="2017-04-24T13:04:59.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7554" PostTypeId="2" ParentId="7535" CreationDate="2013-01-16T19:09:52.887" Score="3" Body="&lt;p&gt;As is well-described in &lt;a href=&quot;https://dsp.stackexchange.com/questions/208/what-should-be-considered-when-selecting-a-windowing-function-when-smoothing-a-t/210#210&quot;&gt;this answer&lt;/a&gt;, window functions are characterized by their mainlobe width and maximum sidelobe height. There is an inherent tradeoff between the two (decreasing one will increase the other). For the case where you are trying to discriminate between two nearby frequencies at similar power levels, you want a window with as small of a main lobe as possible. That window is the rectangular window (i.e. none at all). However, it does have rather poor sidelobe performance, which can hurt you if you're trying to look for signals that are separated significantly in frequency but are at different power levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need even better frequency resolution than what the unwindowed approach will give you, the correct answer is to observe the signal longer and then analyze it using a longer DFT. Note that there is no free lunch; you can't just zero-pad the existing signal and then take the DFT (which will just interpolate between the bins you already have). You'll need to actually collect a longer block of samples to start with.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-01-16T19:09:52.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7555" PostTypeId="2" ParentId="7538" CreationDate="2013-01-16T20:12:23.657" Score="4" Body="&lt;p&gt;Your problem can be restated as the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Find an easily computable bijection from the integers $0 .. {n \choose n / 2} - 1$ to the set of binary strings of length $n$ with exactly $n / 2$ zeros and $n / 2$ ones.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formulated this way, this looks like a &lt;a href=&quot;http://en.wikipedia.org/wiki/Combinatorial_number_system&quot; rel=&quot;nofollow&quot;&gt;combinatorial numbering&lt;/a&gt; problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Decoding is quite simple and involves accumulating binomial coefficients for each bit set in the codeword. The encoding looks more complicated. Having enough ROM/RAM to store a big binomial coefficients table helps a lot in any case. You might want to repost on cs / math stackexchange, mentioning only the combinatorics aspect (not the digital communications application) if you are in search of more memory-efficient algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/4550369&quot; rel=&quot;nofollow&quot;&gt;See python code for encoding and decoding here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;High-level explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us consider the case $n = 6$ (3 ones and 3 zeros). The goal is to find a mapping between the strings 000111, 001011, 001101 up to 111000... and the numbers 0, 1, 2, 3 up to 19. This is equivalent to coding $\log_2 20 = 4.32$ bits into a 6-bit DC-free code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are ${6 \choose 3} = 20$ strings made of 3 zeros and 3 ones. ${5 \choose 3} = 10$ of them start with a 0 and ${5 \choose 2} = 10$ of them start with 1. So we can assign the numbers 0 to 9 to the first group, and 10 to 19 to the second group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the first group, there are ${4 \choose 3} = 4$ which start with 00 and ${4 \choose 2} = 6$ which start with 01. So we can assign the numbers 0 to 3 to the 00 group and 4 to 9 to the second group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the 00* group, there are ${3 \choose 3} = 1$ which start with 000 and ${3 \choose 2} = 3$ which start with 001. So we can assign the number 0 to the first one (000111), and the numbers 1 to 3 to the second group (001*). And so on...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe that in all the ${n \choose k}$ we have written, $n$ is always the number of remaining positions, and $k$ the number of unallocated ones. So the partitions of the $0 .. 19$ set we have built are created by adding ${\text{position at which we allocate a one} \choose \text{number of remaining ones}}$ terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us formalize this procedure. If the bitstring to decode is $b_5b_4b_3b_2b_1b_0$, the number we have associated to it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$b_5 {5 \choose b_4 + b_3 + b_2 + b_1 + b_0} + b_4 {4 \choose b_3 + b_2 + b_1 + b_0} + b_3 {3 \choose b_2 + b_1 + b_0} + b_2 {2 \choose b_1 + b_0} + b_1 {1 \choose b_0} + b_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's all for the decoding (DC-free bitstring to number)!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The encoding (number to DC-free bitstring) works by trying to &quot;fit&quot; the terms of this sum to the integer to encode. For example, given the number 15 to encode:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This number is above ${5 \choose 2}$ so the first digit is 1, and the first term of the sum is $1 {5 \choose 2} = 10$. 2 ones remains to be allocated. 5 remains in the sum.&lt;/li&gt;&#xA;&lt;li&gt;The remainder is less than ${4 \choose 2} = 6$ so the next digit can't be a 1, so the second term of the sum is $0 {4 \choose 2}$. 2 ones remain to be allocated. 5 remains in the sum.&lt;/li&gt;&#xA;&lt;li&gt;The remainder is above ${3 \choose 2} = 3$, so the next digit is 1, and the third term of the sum is $1 {3 \choose 2}$. 1 one remains to be allocated. 2 remains in the sum.&lt;/li&gt;&#xA;&lt;li&gt;The remainder is equal to ${2 \choose 1} = 2$, so the next digit is 1, and the fourth term of the sum is $1 {2 \choose 1}$. All ones are allocated. All terms of the sum are accounted for.&lt;/li&gt;&#xA;&lt;li&gt;The remaining terms are $0 {1 \choose 0} + 0$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus, the bitstring associated to 15 is 101100.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-01-16T23:09:48.397" LastActivityDate="2013-01-16T23:09:48.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7556" PostTypeId="2" ParentId="7551" CreationDate="2013-01-16T21:13:18.850" Score="1" Body="&lt;p&gt;I believe you are correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RFC for Silk allows up to 5, 20ms segments of data representing a single frame per RTP packet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the draft rfc...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;4.2.  Payload Structure&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The SILK encoder can be set to output encoded frames representing 20,&#xA;    40, 60, 80, or 100 ms of speech or audio data.  Only one frame output&#xA;    from the encoder MUST be used as the payload.  Figure 1 shows the&#xA;    structure combined with the RTP header.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;+----------+--------------+&#xA;   |RTP Header| SILK Payload |&#xA;   +----------+--------------+&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://tools.ietf.org/id/draft-spittka-silk-payload-format-00.txt&quot; rel=&quot;nofollow&quot;&gt;http://tools.ietf.org/id/draft-spittka-silk-payload-format-00.txt&lt;/a&gt; for more details.  Also search for the most recent draft of RFC to be sure you are current.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-01-16T21:19:01.207" LastActivityDate="2013-01-16T21:19:01.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7559" PostTypeId="7" CreationDate="2013-01-17T02:52:42.240" Score="0" Body="&lt;p&gt;&lt;strong&gt;Signal Processing&lt;/strong&gt; is a question and answer site for users interested in the theory and applications of analog and digital signal processing, image processing and computer vision. It's built and run &lt;em&gt;by you&lt;/em&gt; as part of the &lt;a href=&quot;https://stackexchange.com&quot;&gt;Stack Exchange&lt;/a&gt; network of Q&amp;amp;A sites. With your help, we're working together to build a library of detailed answers to every practical and answerable question on these topics.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="58306" LastEditDate="2021-07-13T11:27:51.027" LastActivityDate="2021-07-13T11:27:51.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7561" PostTypeId="1" CreationDate="2013-01-17T07:29:54.083" Score="0" ViewCount="119" Body="&lt;p&gt;I am working on building speech recognition software for my company.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime however, we will purchase some off-the-shelf commercial speech recognizers until the in-house one is ready. My question:&lt;br&gt;&#xA;1. How are speech recognizers evaluated?&lt;br&gt;&#xA;2. Are there any standardized tests available that can be used to test speech recognizers and determine the better one of the two?  &lt;/p&gt;&#xA;" OwnerUserId="102" LastActivityDate="2013-01-17T16:06:19.437" Title="How to compare two speech recognition softwares?" Tags="|speech-recognition|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7562" PostTypeId="1" CreationDate="2013-01-17T08:43:09.450" Score="1" ViewCount="219" Body="&lt;p&gt;I would like to evaluate frequency of some unstable periodic signal coming from a detector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X5P2i.png&quot; alt=&quot;signal started&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Zc9UZ.png&quot; alt=&quot;period zoom&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal is registered continuously and may or may not be present (i.e. be periodic). The frequency and amplitude of the periodic signal can change but stays in some certain range. The shape of the periodic signal is more or less the same as shown on the second image. It may sometimes have distortions of higher amplitude and frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to check 1) if there is a periodic signal and 2) what frequency it has.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any good way to do it?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;strong&gt;Edit 1&lt;/strong&gt;:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I am not sure if FFT is reliable in this case. What do you think?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency spectrum for &lt;a href=&quot;http://pastebin.com/raw.php?i=6AcfqPh7&quot; rel=&quot;nofollow noreferrer&quot;&gt;all data points&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NyiDZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrum with last 512 points&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T2Ofx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectra were calculated using Octave (&lt;a href=&quot;http://weboctave.mimuw.edu.pl/weboctave/web/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;online&lt;/a&gt;) based on &lt;a href=&quot;http://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;example from Matlab site&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 512; % length(all_data)&#xA;x = all_data(1:N);&#xA;Fs = N;&#xA;xdft = fft(x);&#xA;xdft = xdft(1:N/2+1);&#xA;psdx = (1/(Fs*N)).*abs(xdft).^2;&#xA;psdx(2:end-1) = 2*psdx(2:end-1);&#xA;freq = 0:Fs/length(x):Fs/2;&#xA;plot(freq,10*log10(psdx));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3617" LastEditorUserId="3617" LastEditDate="2013-01-17T10:47:41.760" LastActivityDate="2013-01-21T21:20:02.990" Title="Frequency of a periodic signal with distortions" Tags="|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7563" PostTypeId="2" ParentId="7533" CreationDate="2013-01-17T09:45:45.753" Score="3" Body="&lt;p&gt;A bit rate can't be &quot;measured&quot; like a physical quantity but it can be calculated from the following parameters (given the subsystems you mentioned):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$f_\mathrm{S}$ sampling rate&lt;/li&gt;&#xA;&lt;li&gt;$N_\mathrm{SC}$ number of subcarriers (= IFFT size)&lt;/li&gt;&#xA;&lt;li&gt;$N_\mathrm{U}$ number subcarriers used for data transmission (excluding possible pilot tones)&lt;/li&gt;&#xA;&lt;li&gt;$N_\mathrm{G}$ length of cyclic prefic in samples&lt;/li&gt;&#xA;&lt;li&gt;$M$ number of bits per subcarrier (for L-QAM, $M = log_2L$) (*)&lt;/li&gt;&#xA;&lt;li&gt;$r$ coderate of FEC, where $r = k/n$, with $k$ length of code word, $n$ length of information word&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The length $T$ of an OFDM symbol is the basic symbol length plus the length of cyclic prefix:&#xA;$$&#xA;T = \frac{N_\mathrm{SC}}{f_\mathrm{S}} + \frac{N_\mathrm{G}}{f_\mathrm{S}}&#xA;$$&#xA;Each OFDM symbol contains $N_\mathrm{U}$ subcarriers that carry $M$ bit of information each. Thus the bit rate $R$ is (excluding FEC):&#xA;$$&#xA;R = \frac{N_\mathrm{U}M}{T} = \frac{N_\mathrm{U}Mf_\mathrm{S}}{N_\mathrm{SC} + N_\mathrm{G}}&#xA;$$&#xA;Finally, if some overhead by FEC is added, the net bit rate $\tilde{R}$ is given by&#xA;$$&#xA;\tilde{R} = rR&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(*) A note on $M$: as Jim Clay has pointed out in his comment, the number of bits doesn't have to be the same for all subcarriers but is sometimes chosen individually for each subcarrier. This is often refered to as &quot;bit loading&quot;. In this case $N_\mathrm{U}M$ in the expression for $R$ has to be replaced by&#xA;$$&#xA;\sum_i^{N_\mathrm{U}}M_i&#xA;$$&#xA;where $M_i$ is the number of bits on the $i$th subcarrier.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-01-18T21:59:08.760" LastActivityDate="2013-01-18T21:59:08.760" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7564" PostTypeId="1" CreationDate="2013-01-17T11:12:54.810" Score="3" ViewCount="220" Body="&lt;p&gt;There are other shape properties scale-rotation invariant except HuMoment?&#xA;There are example that show me how can i implement them?&#xA;I find this example in c++ &lt;a href=&quot;https://stackoverflow.com/questions/8675878/opencvc-calculating-moments-from-contour&quot;&gt;https://stackoverflow.com/questions/8675878/opencvc-calculating-moments-from-contour&lt;/a&gt; but i prefer working in python&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the difference between WeightedNormalizedMoments, WeightedHuMoments and HuMoments? (&lt;a href=&quot;http://scikit-image.org/docs/0.6/api/skimage.measure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://scikit-image.org/docs/0.6/api/skimage.measure.html&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="128" LastEditDate="2023-07-08T11:46:23.553" LastActivityDate="2023-07-08T14:40:17.777" Title="Shape Properties Which Are Scale Rotation Invariant Like HuMoment" Tags="|image-processing|python|opencv|feature-extraction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7565" PostTypeId="1" CreationDate="2013-01-17T06:48:02.587" Score="0" ViewCount="836" Body="&lt;p&gt;I'd like to compare 2 speech similarity and show it in terms of 0-100%.&lt;br&gt;&#xA;Here's my approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1: Convert 2 audio waveform into audio spectrum by Fast Fourier Transform (FFT)&#xA;2: Use Dynamic Time Warping to compare 2 spectrums&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is fine when converting them into audio spectrum&#xA;But how to show the similarity in terms of percentage?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read this site: &lt;a href=&quot;https://stackoverflow.com/questions/2168027/dynamic-time-warping-to-compare-two-audio-recordings&quot;&gt;https://stackoverflow.com/questions/2168027/dynamic-time-warping-to-compare-two-audio-recordings&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on exactly the same things with him.&#xA;However I have no idea about the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please help me?&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerDisplayName="Ricky Chow" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-02-13T13:18:44.547" Title="Dynamic time warping in percentage" Tags="|c|audio|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7566" PostTypeId="2" ParentId="7565" CreationDate="2013-01-17T09:50:29.920" Score="3" Body="&lt;p&gt;There are no doubt plenty of ways you could define one of the measures in the linked question, but the question remains, after doing so, is the measure in any way meaningful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all depends on what you intend to do with the metric after computing it: If it's a perceptual estimate (quality of a Codec,  subjective similarity and so on), you will need a set of measured perceptual data to which you then attempt to fit (mathematically) your measure. &lt;/p&gt;&#xA;" OwnerUserId="3611" OwnerDisplayName="Marko" LastActivityDate="2013-01-17T09:50:29.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7567" PostTypeId="2" ParentId="7562" CreationDate="2013-01-17T14:07:14.263" Score="4" Body="&lt;p&gt;The signal looks like narrow band noise and may not be periodic at all.  The FFT will generally reveal a periodic signal that is in the presence of some noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the FFT results, if you have a periodic signal, you should see peaks at the fundamental and its harmonics.  If the &quot;periodic&quot; signal is unstable (modulated in some way) the peaks will become less distinct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try different window functions on your data to see if more defined harmonic peaks become visible in the FFT data.  For example compare results using a number of windows such as Gaussian and Blackman-Harris windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the choice of the window size (length of data) used when computing the FFT will affect your frequency resolution (bin spacing).  If you can roughly estimate the period of the signal, choose a data length that is a multiple of the estimated period so the bins line up with the signal harmonics.  In general a longer data set will provide better frequency resolution than a shorter data set, so if you don't know the period of the signal, go with a longer data set.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-17T14:07:14.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7568" PostTypeId="1" AcceptedAnswerId="7570" CreationDate="2013-01-17T14:10:08.840" Score="2" ViewCount="3795" Body="&lt;p&gt;I am struggling to find or derive the relationship between Doppler frequency and the associated phase shift.  Let's say I have a signal transmitted at a given frequency $f_c$.  I then down convert from $f_c$ to baseband at the receiver, but due to speed between the transmitter and receiver, I receive a frequency shifted by a Doppler frequency $\Delta f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I wish to generate a matching signal to that being received, I can use &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\cos(2 \pi \Delta f t + \phi) + i \sin(2 \pi \Delta f t + \phi)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part I'm struggling to get to grips with is how does $\phi$ relate to $\Delta f$?  Is it simply the integral of $\Delta f$ with respect to time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \phi = \int_0^t \Delta f dt $$&lt;/p&gt;&#xA;" OwnerUserId="3619" LastActivityDate="2018-10-11T20:34:36.623" Title="Doppler effect on phase" Tags="|frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7569" PostTypeId="1" CreationDate="2013-01-17T14:12:23.467" Score="0" ViewCount="324" Body="&lt;p&gt;What are the steps to built a system which recognizes hand written signs in an image and returns the most similar sign in Python? I know that depends on the image and many variables, but isn't there a sequence of steps, a main path to follow for recognizing images with at most 2 or 3 signs per image? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought the steps should be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Take an image and convert to binary&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply &lt;code&gt;find_contour&lt;/code&gt; to binary image&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Extract scale- and rotation-invariant properties&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a feature vector with scale/rotation-invariant properties (if there is much more than 1 sign, like for example a star and a square not overlapped, is that a problem?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Repeat steps 1 to 4 for every image&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Put them into a k-NN or SVM&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These next steps, I do not know how to implement:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I choose an image&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;System spits out the result (most similar image)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="29" LastEditDate="2013-01-18T00:01:44.547" LastActivityDate="2013-01-28T02:44:14.157" Title="Steps for recognizing hand written signs" Tags="|image-processing|computer-vision|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7570" PostTypeId="2" ParentId="7568" CreationDate="2013-01-17T15:02:13.407" Score="1" Body="&lt;p&gt;You are correct that the total accumulated phase offset due to Doppler could be calculated by integrating the Doppler shift $\Delta f(t)$ over time. In addition to Doppler shift, however, you would also need to take into account any frequency difference between the transmitter and receiver's reference oscillators. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would question the value of trying to do so. In most communications systems, there will be a random, unknown phase offset between the transmitter and receiver oscillators. This makes absolute phase measurements meaningless unless you have some reference. In real systems, phase synchronization is either achieved by exploiting some known characteristic of the signal (e.g. the known constellation of a PSK signal), or in some rare cases, via the explicit synchronization of the transmitter and receiver local oscillators.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-01-17T15:02:13.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7571" PostTypeId="2" ParentId="7561" CreationDate="2013-01-17T16:06:19.437" Score="1" Body="&lt;p&gt;NIST has a web page that provides a good detailed discussion of how to score ASR software.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.isip.piconepress.com/projects/speech/software/tutorials/production/fundamentals/v1.0/section_04/s04_03_p01.html&quot; rel=&quot;nofollow&quot;&gt;http://www.isip.piconepress.com/projects/speech/software/tutorials/production/fundamentals/v1.0/section_04/s04_03_p01.html&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-01-17T16:06:19.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7572" PostTypeId="2" ParentId="7569" CreationDate="2013-01-17T21:01:28.880" Score="1" Body="&lt;p&gt;That's what you would do with images, not so much with handwriting, which needs more preprocessing and robust features because people don't write exactly the same way twice. See for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Improving Offline Handwritten Text Recognition with Hybrid HMM/ANN Models&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Adaptive Membership Functions for Handwritten Character Recognition by Voronoi-Based Image Zoning&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;A visual approach to sketched symbol recognition&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Feature extraction and classifier combination for image-based sketch recognition&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Sketched symbol recognition with auto-completion&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;HBF49 feature set: A first unified baseline for online symbol recognition&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Neural network-based symbol recognition using a few labeled samples&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-01-17T21:01:28.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7573" PostTypeId="2" ParentId="1693" CreationDate="2013-01-17T21:15:46.423" Score="14" Body="&lt;p&gt;NASA used to use the Hadamard transform as a basis for compressing photographs from interplanetary probes during the 1960's and early '70s.  Hadamard is a computationally simpler substitute for the Fourier transform, since it requires no multiplication or division operations (all factors are plus or minus one).  Multiply and divide operations were extremely time intensive on the small computers used on board those spacecraft, so avoiding them was beneficial both in terms of compute time and energy consumption.  But since the development of faster computers incorporating single-cycle multipliers, and perfection of newer algorithms such as the Fast Fourier Transform, as well as the development of JPEG, MPEG, and other image compression, I believe Hadamard has fallen out of use.  However, I understand it may be staging a comeback for use in quantum computing.&#xA;(NASA use is from an old article in NASA Tech Briefs; exact attribution unavailable.)&lt;/p&gt;&#xA;" OwnerUserId="3621" LastActivityDate="2013-01-17T21:15:46.423" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7574" PostTypeId="2" ParentId="7562" CreationDate="2013-01-18T01:11:31.387" Score="1" Body="&lt;p&gt;Thanks for uploading your data. It looks like there is a fairly strong periodic component with frequency $~0.042 \approx 1/24$ (in rough agreement with your first plot):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/THV9K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generated with Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = ReadList[&quot;Desktop/raw.txt&quot;];&#xA;y = Abs@Fourier@Standardize[ x, Mean];&#xA;ListLinePlot[y[[1 ;; Round[0.15 Length@y]]], Filling -&amp;gt; Axis, PlotRange -&amp;gt; All, DataRange -&amp;gt; {0, 0.15}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;edit for MSalters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take a closer look at the first part, up to sample 1375:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z = Fourier@Standardize[x[[1 ;; 1375]], Mean]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jY9yR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We see that the impulse near the origin is gone. Then let's smooth its frequency spectrum:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ListLinePlot[Part[Abs@z /. s_ /; s &amp;lt; 3 :&amp;gt; 0, 1 ;; Round[0.08 Length@z]], PlotRange -&amp;gt; { {0, .08}, {0, 10}}, DataRange -&amp;gt; {0, .08}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GglwY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, let's convert this filtered spectrum back into the time domain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xrec = InverseFourier[z /. s_ /; Abs@s &amp;lt; 3 :&amp;gt; 0];&#xA;ListLinePlot[xrec - Min@xrec]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jPrcm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We see the characteristic multimodal peaks of the original signal.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2013-01-21T21:20:02.990" LastActivityDate="2013-01-21T21:20:02.990" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7576" PostTypeId="1" CreationDate="2013-01-18T06:45:59.617" Score="3" ViewCount="10342" Body="&lt;p&gt;can any one explain how actually IFFT generating sub carriers in OFDM.... when we are simulating OFDM transmitter in matlab, we are taking input data stream, encoding it and modulating the encoded data. then we are converting this modulated serial data stream to parallel data and giving it to the IFFT block. my problem is how sub carriers are generating in IFFT?? &lt;/p&gt;&#xA;" OwnerUserId="3610" LastActivityDate="2023-12-22T23:14:59.393" Title="IFFT Concept in OFDM" Tags="|matlab|ofdm|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7577" PostTypeId="1" CreationDate="2013-01-18T08:17:31.247" Score="0" ViewCount="455" Body="&lt;p&gt;I am in trouble with Viterbi decoder for a while. I have some questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to decode messages from a continuous stream which is encoded without resetting the state metrics. Each message starts with a preamble, but since these preambles are also encoded as part of the stream, there is actually no message concept before decoding.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Encoding without resetting the metrics means that the data is encoded as one big message, doesn't it?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The decoder I am using works frame by frame, without storing and re-using the state metrics. So, I am adding a prefix and a postfix from the previous and next messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(last $n$ bits of the previous encoded message + message to be decoded + first $m$ bits of the next encoded message)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hopefully expect that the prefix works as a training data, and the state metrics after the prefix are ready to decode the actual message. In order to decode the last bits of the message correctly, the postfix is used. I suppose using the data from the next message as the postfix is better than adding zeros or random bits, because adding zeros or random numbers may cause a wrong path affecting not only the decoding of the postfix but also of the actual message.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this procedure reasonable?  &lt;/li&gt;&#xA;&lt;li&gt;Is it common and does it have a name such as &lt;em&gt;sliding windows&lt;/em&gt;?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How many bits should I use as the prefix and postfix? (I cannot set the traceback length and see if it is pre-set somewhere. The code rate is $1/2$ and constraint length is $7$.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="2024" LastEditorUserId="1629" LastEditDate="2016-10-19T16:05:18.087" LastActivityDate="2016-10-19T16:05:18.087" Title="Viterbi Decoder - Decoding Continuously Encoded Stream Partially" Tags="|channelcoding|forward-error-correction|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7578" PostTypeId="2" ParentId="7536" CreationDate="2013-01-18T10:54:31.417" Score="1" Body="&lt;p&gt;For small noises erosion followed by dilation can help as the erosion will clear the noise and dilation will bring back the deleted boundaries.Though i have still not implemented this Erosion+dilation option myself on grayscale but may be they can help&lt;/p&gt;&#xA;" OwnerUserId="3523" LastActivityDate="2013-01-18T10:54:31.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7579" PostTypeId="2" ParentId="7576" CreationDate="2013-01-18T14:50:20.103" Score="2" Body="&lt;p&gt;Think of it this way.  The DFT and IDFT are two different representations of the same thing.  That thing is a sequence of complex exponentials (sub carriers) that have frequenies that are regularly spaced in the frequency domain (frequencies are the bins of a DFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of simplicity, I'm ignoring phase here&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;..IDFT............................DFT..&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A1e^f1nT + A2ef2nT +...   &amp;lt;---&gt;     A1, A2 ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients A1, A2 ... of the DFT (frequency domain) represent amplitude information&#xA;for the time sequence of complex exponentials (sub carriers) in &#xA;the sum on the left (IDFT - time domain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In OFDM, you map your data to represent the amplitudes of a DFT (A1,A2...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performing the IDFT, reconstructs a time sequence that is composed of the&#xA;complex exponentials (sub carriers) summed together using the amplitudes represented&#xA;by the coefficients A1,A2...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, just look at the definition of the IDFT.  The time sequence given from computing the IDFT is...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f[n] = \frac {1}{\sqrt[2]N} \sum_{k=0}^{N-1} A[k]e^{i2\pi nk/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the $e^{i2\pi nk/N}$ part of the sum represents each of the OFDM subcarriers.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-01-21T14:17:10.433" LastActivityDate="2013-01-21T14:17:10.433" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7580" PostTypeId="2" ParentId="7577" CreationDate="2013-01-18T15:41:30.723" Score="1" Body="&lt;p&gt;Since the decoder that you are working with is a black box, yes, adding prefixes and postfixes to the stream to &quot;window-ize&quot; it is appropriate.  The pre and postfixes need to be the actual data from the previous and post windows, and they need to be at least as long as the traceback depth.  If you do this and get rid of the result bits that correspond to the prefixes and postfixes, then you should do fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a normal situation you would not need to add any postfixes or prefixes.  There are only two things you need to do to handle continuous streams of Viterbi-encoded data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) occasionally check the state metrics and lower them when all of them get &quot;high&quot;.  This works because the only thing that matters is the difference between the state metrics, not their absolute value.  An easy way to do this is to check if all of them are equal to or above half the maximum state metric value.  If they are, subtract half the maximum value from all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You have to do tracebacks while you are decoding.  This is do-able in both FPGA's and microprocessors (it's actually quite easy in microprocessors).  Every $N$ transitions (pick an $N$ that works for your architecture) you do a traceback and output $N$ bits.  You have to go back through $M$ bits ($M$ being equal to the traceback depth) before you get to the $N$ bits that you will output.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-01-18T20:07:09.373" LastActivityDate="2013-01-18T20:07:09.373" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7581" PostTypeId="1" AcceptedAnswerId="7582" CreationDate="2013-01-18T19:21:23.340" Score="8" ViewCount="9033" Body="&lt;p&gt;I am trying to compare 2 speech samples and rate them on similarities. Think of someone trying to repeat a phrase, and then comparing those 2 audio files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started by implementing the MFCC (http://en.wikipedia.org/wiki/Mel-frequency_cepstrum) algorithm. I calculate the MFCCs of both audio samples, which gives me roughly 500 frames of audio (at 10ms each, with like 30% overlapping of the previous) having 14 or so MFCC coefficients. So a 500x14 matrix for each audio signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I do the naive approach of simply differencing the matrices. This does not give very promising results. Half of the time when I compare completely different audio samples (where different phrases are spoken), I get &lt;em&gt;less&lt;/em&gt; difference than comparing the audio where I try to repeat the same phrase! This is clearly backwards and can't give me a good scoring algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I improve on this? I thought MFCCs were a really important part of speech processing, though clearly I need to do more with it.&lt;/p&gt;&#xA;" OwnerUserId="3595" LastEditorUserId="76" LastEditDate="2013-01-19T05:50:34.310" LastActivityDate="2019-05-31T09:55:19.953" Title="Speech comparison algorithm for rating on similarities" Tags="|audio|mfcc|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7582" PostTypeId="2" ParentId="7581" CreationDate="2013-01-18T21:08:16.810" Score="13" Body="&lt;p&gt;First, you will have to correct for differences in timing. For example, if one utterance is &quot;--heeelloooo---&quot; and the other &quot;hellooooooo----&quot; (- representing silence), a direct pairwise comparison of MFCC frames will show differences simply because the two samples are not aligned. You can use &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_time_warping&quot;&gt;Dynamic Time Warping&lt;/a&gt; to find the best alignment between the two sequence of feature vectors - and compute the corresponding distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second problem is that if the two recordings are not from the same speaker, you will have to compensate for the differences in timbre. The MFCC of a female saying &quot;aaa&quot; are not the same as the MFCC of a male speaker saying the same phoneme! A relatively simple model to account for variations in voice timbre is to assume that there exists a &lt;a href=&quot;http://www.ee.ucla.edu/~spapl/paper/panchap_ltfw.pdf&quot;&gt;linear transform&lt;/a&gt; $\Gamma$ which &quot;maps&quot; the MFCCs of one speaker onto the MFCCs of another speaker (to be fair, only one small subset of these transform accurately model how changing parameters such as age, gender, etc &quot;shifts&quot; the MFCC). Once two recordings have been aligned, even roughly, you can use a least square procedure to estimate $\Gamma$. This procedure is known as speaker normalization or speaker adaptation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your comparison procedure will thus consists of the following steps. $A$ and $B$ are your original MFCC sequences.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Align the two utterances using DTW. This yields $A'$, a matrix with the observations from $A$ warped/shifted to be aligned with the observations in $B$. You can stop here if $A'$ and $B$ are known to be from the same speaker.&lt;/li&gt;&#xA;&lt;li&gt;Estimate the transform $\Gamma$ which minimizes the difference between $\Gamma A'$ and $B$.&lt;/li&gt;&#xA;&lt;li&gt;Use the distance between $\Gamma A'$ and $B$ as your metric.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A last thing that comes to my mind is that you have to discard the first MFCC coefficient (which roughly expresses the signal loudness) to improve the capacity of your system to match utterances pronounced at a different volume/recording level.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-01-18T21:08:16.810" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7583" PostTypeId="1" CreationDate="2013-01-18T23:14:58.820" Score="1" ViewCount="139" Body="&lt;p&gt;Let's suppose a chain of 6 multipliers: $b = a_1*a_2*a_3*a_4*a_5*a_6*a_7$, where $b$ is the output, and $a_i$ the inputs with 16 bits. How can I optimize the word lengths of the output of each multiplier in order to minimize the fixed point error against a full precision implementation?&#xA;Let's also suppose that the output $b$ shall be some reasonable word length, for example 35 bits.&lt;/p&gt;&#xA;" OwnerUserId="3625" LastEditorUserId="3625" LastEditDate="2013-01-22T22:12:12.407" LastActivityDate="2013-01-22T22:12:12.407" Title="Word-length optimization of a fixed point chain of multipliers" Tags="|fixed-point|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7585" PostTypeId="2" ParentId="1693" CreationDate="2013-01-20T08:14:17.467" Score="2" Body="&lt;p&gt;Would like to add that any m-transform (Toeplitz matrix generated by an m-sequence) can be decomposed into &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P1 * WHT * P2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where WHT is the Walsh Hadamard Transform, P1 and P2 are permutations (ref: &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=114749&quot; rel=&quot;nofollow&quot;&gt;http://dl.acm.org/citation.cfm?id=114749&lt;/a&gt;).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;m-transform is used for a number of things:&#xA; (1) system identification when the system is plagued with noise&#xA; and (2) by virtual of (1) identify phase lag in a system that is plagued with noise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for (1), m-transform recovers the system kernel(s) when the stimulus is a an m-sequence, which is useful in neurophysiology (e.g. &lt;a href=&quot;http://jn.physiology.org/content/99/1/367.full&quot; rel=&quot;nofollow&quot;&gt;http://jn.physiology.org/content/99/1/367.full&lt;/a&gt; and others) because it is high power for a wide-band signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For (2), Gold code is constructed from m-sequences (http://en.wikipedia.org/wiki/Gold_code).&lt;/p&gt;&#xA;" OwnerUserId="3632" LastActivityDate="2013-01-20T08:14:17.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7586" PostTypeId="1" AcceptedAnswerId="7588" CreationDate="2013-01-21T01:54:52.097" Score="5" ViewCount="2811" Body="&lt;p&gt;In the image processing world, I've noticed that a lot of the popular convolution filters are &lt;strong&gt;separable&lt;/strong&gt;. Here's a quick &lt;a href=&quot;https://stackoverflow.com/questions/4690756/separable-2d-blur-kernel&quot;&gt;list&lt;/a&gt; of common separable filters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://blogs.mathworks.com/steve/2006/10/04/separable-convolution/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sobel&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian blur&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Box filter (all ones, for example)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Not separable:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://math.stackexchange.com/questions/132183/laplacian-2d-kernel-is-it-separable&quot;&gt;Laplacian&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What other common filters are not separable?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm a little bit worried about this post being closed for being too broad or not constructive enough. But, some &quot;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1693/what-is-the-walsh-hadamard-transform-and-what-is-it-good-for&quot;&gt;what is this good for?&lt;/a&gt;&quot; questions have been well-received here. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Background: I've developed some high-performance 2D convolution implementations. I'd like to have a better handle on the motivating applications.&lt;/p&gt;&#xA;" OwnerUserId="3162" LastEditorUserId="128" LastEditDate="2018-08-21T07:30:43.193" LastActivityDate="2022-02-19T16:24:37.183" Title="Common Use Cases for 2D Non Separable Convolution Filters" Tags="|image-processing|fft|convolution|gaussian|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7588" PostTypeId="2" ParentId="7586" CreationDate="2013-01-21T10:58:15.153" Score="8" Body="&lt;p&gt;There are many.  In general, &lt;a href=&quot;http://persci.mit.edu/pub_pdfs/freeman_steerable.pdf&quot; rel=&quot;noreferrer&quot;&gt;steerable filters&lt;/a&gt; are not separable.  Few are, but many are not.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a short list:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gabor filters in certain directions&lt;/strong&gt;.  Of course, one can use the bases that are separable due to the fact that Gabor filters are steerable.  Gabor filters have the advantage that they are optimally localized in time and frequency.  As a degenerate case, consider a non-symmetric 2D Gaussian where the principal components are not horizontal or vertical.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Difference of gaussian (DoG)&lt;/strong&gt; used to model retinal ganglion and thalamic receptive fields are also not separable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;ftp://lamp.cfar.umd.edu/pub/chenxi/Paper%20Printer/1980Marr_Theroy%20of%20Edge%20Detection.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Marr-Hildreth&lt;/strong&gt;&lt;/a&gt; for edge detection is not separable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A bunch of filters used for segmentation are not separable: &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=720464&amp;amp;CFID=260338827&amp;amp;CFTOKEN=99199893&quot; rel=&quot;noreferrer&quot;&gt;http://dl.acm.org/citation.cfm?id=720464&amp;amp;CFID=260338827&amp;amp;CFTOKEN=99199893&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The list can go on and on, and these are just common examples!  You can certainly design FIR filters to fit your need, and there are methods to do this.  That is the whole purpose of a large sub-field of DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general when you design a 2-D filter, if it is anisotropic and not oriented horizontally or vertically, chances are that it is not separable.  For example, if you were to design a low pass (pre-)filter to remove high frequency that may cause aliasing in a hexagonal sampling system.  This would have to be an analog filter, but for digital, consider a down sampling scenario.  For optimal design, you'd want to keep as much information as possible, so your filter would most likely match the hexagonal sampling grid.  This will definitely give you a filter that is not separable.&lt;/p&gt;&#xA;" OwnerUserId="3632" LastEditorUserId="26" LastEditDate="2013-01-21T15:48:27.113" LastActivityDate="2013-01-21T15:48:27.113" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7589" PostTypeId="1" AcceptedAnswerId="7590" CreationDate="2013-01-20T08:40:12.813" Score="9" ViewCount="10044" Body="&lt;p&gt;I am trying to analyze the musics as possible as precisely.&#xA;Of course I tried FFT, but got some problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found low frequencies have very low resolution than human's hearing. I tried very long time FFT to resolve this problem, but even analyzing with 8192 samples/s in 44100Hz sample rate(Means lack of time resolution), I got not enough resolution on low frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found there are few solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, a quadratic interpolation on FFT bins.&#xA;&lt;br&gt;But it seems not a perfect way. Problems of this method are:&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;1. 'If i want to determine freqs between the freq bins, which three bins should I select to do an interpolation?'&#xA;&lt;br&gt;&#xA;2. 'Even I do this, there are no actual additional informations on result. I know interpolations are kind of tricky method.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, extracting each freq bins with desired frequency, so I can extract the bins logarithmically.&#xA;&lt;br&gt;&#xA;But have a critical computational cost problem: (maybe over)N^2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thirdly, LFT(Logarithmic Fourier Transform).&#xA;&lt;br&gt;&#xA;This requiers logarithmically-spaced samples and gives me result exactly what I looking for with incredibly fast speed; &lt;a href=&quot;https://stackoverflow.com/questions/1120422/is-there-an-fft-that-uses-a-logarithmic-division-of-frequency&quot;&gt;https://stackoverflow.com/questions/1120422/is-there-an-fft-that-uses-a-logarithmic-division-of-frequency&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have no idea with that algorithm. I tried to understand the paper and implement it, but it was impossible because of lack of my english and mathematical skills.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I need a help of implementation of LFT.&lt;/p&gt;&#xA;" OwnerUserId="3639" OwnerDisplayName="Jee-heon Oh" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2019-08-05T23:54:07.967" Title="Logarithmic fourier transform(LFT) on audio signal" Tags="|audio|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7590" PostTypeId="2" ParentId="7589" CreationDate="2013-01-20T12:03:41.617" Score="8" Body="&lt;p&gt;The simplest and most pragmatic solution is to use a normal FFT of a sufficiently large size that you get the required resolution at the lowest frequency of interest. E.g. if you want 1 Hz resolution at the lowest frequency of interest then you will need a 1 second FFT window, i.e. the FFT size would need to be equal the sample rate, e.g. 44100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that even if you &lt;em&gt;could&lt;/em&gt; implement a logarithmic FFT then it would still be bound by the laws of physics (information theory) and you would still need a similar length sample window - all you would gain would be convenience (not having to aggregate output bins) at the expense of performance.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastActivityDate="2013-01-20T12:03:41.617" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7591" PostTypeId="2" ParentId="7589" CreationDate="2013-01-20T13:09:59.557" Score="0" Body="&lt;p&gt;If the analysis you intend to perform requires the frequency of the signals in each bin, you can use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Short Time Fourier Transform&lt;/a&gt; to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each bin of the FFT yields a complex number representing the real and imaginary component-  or after a bit of manipulation phase and magnitude.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As frequency = dPhi/dt, (Phi == phase), by taking corresponding bins from pairs of consecutive STFT spectra, you can calculate frequency.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://web.archive.org/web/20150219024209/http://www.dspdimension.com/admin/time-pitch-overview/&quot; rel=&quot;nofollow noreferrer&quot;&gt;DSP Dimension&lt;/a&gt; has a good article on the process.&lt;/p&gt;&#xA;" OwnerUserId="3611" OwnerDisplayName="Marko" LastEditorUserId="44499" LastEditDate="2019-08-05T23:54:07.967" LastActivityDate="2019-08-05T23:54:07.967" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7592" PostTypeId="2" ParentId="7535" CreationDate="2013-01-22T03:52:18.150" Score="4" Body="&lt;p&gt;I'm presuming that you have some or all 9 of the input frequencies available at one time, and you just want to find out which of them is present (you didn't specify in your problem statement).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two methods come to mind: 1) compute DFTs at the frequencies of interest, or 2) use the Gaussian ratio technique, as described in reference_1 and reference _2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding 1) above: When Moses came down from the mountain, he did not carry tablets of stone on which it was commanded that in the equation: F = k*(df) = k*sample_rate/N, that k has to be an integer.  In other words, you can compute a DFT bin centered at ANY frequency, not just those that correspond to the usual k = integer of your FFT.  For example, given your sample rate and N, a frequency of F = 16351 would correspond to a DFT bin computed at k = (N*F)/sample_rate = 1024*16351/44100 = 379.669 (ie: between bins 379 and 380 of your FFT). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for the DFT, X(F) = (sum over n){x[n]*e[-j*twopi*n*k/N]}, where X[F] is the complex result, N = 1024, F = 16351, k = 379.669, and n = 0 to N-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the other values for your problem are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency   and value of   k&lt;/p&gt;&#xA;&#xA;&lt;p&gt;16,566  ==&gt; 384.662&lt;/p&gt;&#xA;&#xA;&lt;p&gt;16,781  ==&gt; 389.659&lt;/p&gt;&#xA;&#xA;&lt;p&gt;16,996  ==&gt; 394.646&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll leave it to you to figure out the rest.  And, as you can see, you've got about 5 bins of separation between the input frequencies.  That may, or may not be enough based on your SNR and method used.  And you might want to use N = 1025 instead – it makes your input frequencies much more 'bin-centered.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method 2) above uses an FFT, which, given the right circumstances, can be extraordinarily accurate when computing frequencies.  Note that in the first reference above, by using a Gaussian window, and then taking the log ratio of amplitudes from adjacent bins, you are actually solving for frequency, subject to the requirements of the technique.  Some code (DevC++ compiler) for your specific problem, followed by the programs' output is shown below (explanation to follow):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;cstdio&amp;gt;&#xA;#include &amp;lt;cstdlib&amp;gt;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;#include &amp;lt;cmath&amp;gt;&#xA;using namespace std;&#xA;void fft_recur(long, double* r, double* i);&#xA;int main (int nNumberofArgs, char* pszArgs[ ] ) { // arguments needed for Dev C++ I/O&#xA;const long N = 1024;   double sample_rate = 44100., r[N] = {0.}, i[N] = {0.}, w[N] = {0.} ;&#xA;long n;      double  t, twopi = 2*3.141592653589793238;&#xA;double amp_sq[N], F, fbin, amp, power, c = 2.3;&#xA;&#xA;for (n = 0; n &amp;lt; N; n++)  {  // generate test data&#xA;    t = twopi*n/sample_rate;&#xA;    r[n] = 1.*cos(16351.*t)+1.*cos(16996.*t)+1.*cos(17211.*t)+1.*cos(17426.*t) ;&#xA;} // end for&#xA;&#xA;//Gaussian window as computed in [MCEACH94] program&#xA;double z;&#xA;for (n = 0; n &amp;lt; N/2; n++) {&#xA;    z = (.5+(N/2)-1.-n)*(twopi/2.)/N;&#xA;    w[n] = exp(-c*z*z);&#xA;    w[N-1-n] = w[n];&#xA;}&#xA;&#xA;//multiply input data by window points&#xA;for (n = 0; n &amp;lt; N; n++)  {&#xA;    r[n] = w[n]*r[n];    // we're overwriting r[n] with the windowed r[n]&#xA;} //end for&#xA;&#xA;fft_recur(N, r, i);       // note: fft is not scaled&#xA;&#xA;// compute amplitude squared&#xA;for (n = 0; n &amp;lt; N/2+1; n++)  {&#xA;    amp_sq[n] = r[n]*r[n]+i[n]*i[n];&#xA;} //end for&#xA;&#xA;// compute natural log of FFT outputs&#xA;for (n = 0; n &amp;lt; N/2+1; n++)  {&#xA;    r[n] = .5*log( amp_sq[n] ) ; // r[n] is now the natural log of the amplitude of FFT bin 'n'&#xA;} // end for                     // .5*log(A squared) = log(A)&#xA;&#xA;cout&amp;lt;&amp;lt;&quot;\n\nfrequency and amplitude estimation results\n\n n        magnitude      frequency       amplitude\n\n&quot;;&#xA;for (n = 370; n &amp;lt; 415; n++)  {&#xA;    fbin = n+.5+.5*c*(r[n+1]-r[n]);   // r[n+1] and r[n] are ln(b) and ln(a)&#xA;    F = (sample_rate/N)*fbin;&#xA;    amp = sqrt(c)*exp(r[n]+((fbin-n)*(fbin-n))/c)*(2.0*sqrt(twopi/2.)/N) ;&#xA;    printf(&quot;%2d\t%9.5f\t%9.5f\t%9.5f\n&quot;,n,amp_sq[n],F,amp);&#xA;} //end for&#xA;&#xA;system (&quot;PAUSE&quot;);&#xA;return 0;&#xA;} // end main&#xA;//******************** fft_recur ***********************&#xA;void fft_recur(long N, double *r, double *i)  {&#xA;long h, i1, j = 0, k, i2 = N/2, l1, l2 = 1;&#xA;double c = -1.0, s = 0.0, t1, t2, u1, u2;&#xA;&#xA;for (h = 0; h &amp;lt; N-2; h++) {    // ***** bit reverse starts here ***&#xA;    if (h &amp;lt; j) {&#xA;       t1 = r[h]; r[h] = r[j]; r[j] = t1; &#xA;       t2 = i[h]; i[h] = i[j]; i[j] = t2;&#xA;    }&#xA;    k = i2;&#xA;    while (k &amp;lt;= j) {&#xA;          j = j - k;      k = k/2;&#xA;    }&#xA;    j = j + k;&#xA;}   //****** bit reverse done ******&#xA;&#xA;for (k = 1; k &amp;lt; N; k = k*2) {&#xA;    l1 = l2;     l2 = l2*2;&#xA;    u1 = 1.0;    u2 = 0.0;&#xA;    for (j = 0; j &amp;lt; l1; j++) {&#xA;        for (h = j; h &amp;lt; N; h = h + l2) {&#xA;            i1 = h + l1;&#xA;            t2 = (r[i1] - i[i1])*u2 ;&#xA;            t1 = t2 + r[i1]*(u1 - u2) ;&#xA;            t2 = t2 + i[i1]*(u1 + u2) ;&#xA;            r[i1] = r[h] - t1;&#xA;            i[i1] = i[h] - t2;&#xA;            r[h]  = r[h] + t1;&#xA;            i[h]  = i[h] + t2;              &#xA;        } // end for over h&#xA;        t1 = u1 * c - u2 * s;&#xA;        u2 = u1 * s + u2 * c;&#xA;        u1 = t1;  //x = u1 - u2;    y = u1 + u2;&#xA;    } // end for over j&#xA;    s = - sqrt((1.0 - c) / 2.0);&#xA;    c =   sqrt((1.0 + c) / 2.0);&#xA;} // end for over k&#xA;&#xA;} // end fft&#xA;&#xA;&#xA;frequency and amplitude estimation results&#xA;&#xA; n        magnitude      frequency       amplitude&#xA;&#xA;370       0.01156       15959.53142       0.00065&#xA;371       0.01328       16002.86947       0.00070&#xA;372       0.01542       16046.20441       0.00076&#xA;373       0.01810       16089.42371       0.00082&#xA;374       0.02138       16136.92108       0.00095&#xA;375       0.03020       16209.62311       0.00211&#xA;376       0.14116       16370.55303       3.20360&#xA;377      77.00512       16349.81449       0.95808&#xA;378     3193.91932      16351.21160       1.00396&#xA;379     24622.71009     16350.90700       0.99982&#xA;380     32939.04014     16351.10559       0.99850&#xA;381     7803.22610      16350.67285       1.01020&#xA;382     319.11953       16353.81879       0.87280&#xA;383       2.60322       16324.16039       7.57917&#xA;384       0.00113       16605.10228       0.00051&#xA;385       0.00724       16606.09917       0.00052&#xA;386       0.00851       16650.89175       0.00058&#xA;387       0.01072       16694.51462       0.00065&#xA;388       0.01381       16737.66957       0.00074&#xA;389       0.01787       16785.61197       0.00090&#xA;390       0.02814       16862.78585       0.00251&#xA;391       0.17568       17013.74935       2.83597&#xA;392      85.58946       16994.84074       0.95935&#xA;393     3413.62331      16996.22071       1.00408&#xA;394     25288.20406     16995.88948       0.99974&#xA;395     32472.56144     16995.79357       1.00043&#xA;396     7296.89833      16957.17339       4.09340&#xA;397      60.55471       17218.13259       1.24775&#xA;398     3330.74781      17212.33274       1.01810&#xA;399     25463.82887     17210.95691       0.99978&#xA;400     32350.54927     17210.69761       1.00169&#xA;401     7144.91966      17170.91626       4.35710&#xA;402      55.60789       17436.25628       1.40301&#xA;403     3423.65695      17427.15709       1.01474&#xA;404     25642.98140     17426.03425       1.00002&#xA;405     32244.80235     17425.93874       1.00073&#xA;406     7095.46971      17426.35995       0.98918&#xA;407     278.99401       17421.20777       1.27242&#xA;408       1.56515       17494.25360       0.02622&#xA;409       0.02946       17619.31213       0.00091&#xA;410       0.01521       17677.62446       0.00071&#xA;411       0.01452       17719.83432       0.00069&#xA;412       0.01340       17762.64014       0.00066&#xA;413       0.01224       17805.61294       0.00063&#xA;414       0.01113       17848.67454       0.00060&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First, 4 tones of the input are generated (I use twopi when computing time because it's easier than writing it 4 times into the cosines).  Then, the Gaussian window is generated, after which it is applied to the input (by the way, the window shown here, which is from reference_1, is slightly wrong – I don't want to use the 'corrected' version of it because I don't want to write a page describing how I derived it).  Then we take a 1024 point FFT, followed by the (non-normalized) calculation of amplitude squared.  Then comes the calculation of the natural log of each FFT bin.  Finally, I compute the frequencies and amplitudes via the equations in &lt;a href=&quot;http://www.edn.com/design/analog/4352503/EDN--03-03-94-Ratio-detection-precisely-characterizes-signals-amplitude-and-frequenc&quot; rel=&quot;nofollow&quot;&gt;reference 1&lt;/a&gt; and &lt;a href=&quot;http://www.ptodirect.com/Results/Patents?query=PN/5214708&quot; rel=&quot;nofollow&quot;&gt;reference 2&lt;/a&gt;above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from the results following the code, we have an isolated peak between bin 379 and 380 from the first input frequency, which is estimated as 16350.90700 and an amplitude of .99982.  We can also see that the other 3 inputs exhibit a little 'peak merging' from bins 392 to 407, but the peaks and associated estimated frequencies and amplitudes are quite accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results could be even more accurate if I had: 1) adjusted parameters, 2) used the 'correct' window, 2) used a non-recursive FFT, or 3) used one of the variations of the technique (which I am not going to show here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also notice that, as your value of the parameter 'c' gets smaller ('c' is related to the 'beamwidth' of the Gaussian window), you can actually improve some of your estimates, but it can cause some results to blow up due to numerical sensitivities.  The effective 'Q' or 'gain' of the Gaussian ratio technique is on the order of 5,000 – 10,000, and it can be much higher if you know how to adjust the parameters properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, if your SNR is too low, you may have to increase N to get more integration time, subject to the limits of signal stability.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2013-01-22T03:52:18.150" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7593" PostTypeId="1" AcceptedAnswerId="7602" CreationDate="2013-01-22T05:14:59.843" Score="3" ViewCount="9137" Body="&lt;p&gt;i have 2 audio signals, both available in time and frequency domain:&lt;br&gt;&#xA;A: Noise&lt;br&gt;&#xA;B: Noise(A with minor variations) + Additive sounds (C)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i want to eliminate Signal A from B to leave only C.&lt;br&gt;&#xA;C is for testing almost zero, so after removing A from B silence would be the best.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My signals to visualize the problem:&lt;br&gt;&#xA;Signal A:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/lsCAy.png&quot; alt=&quot;signal a&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal B:&#xA;  &lt;img src=&quot;https://i.stack.imgur.com/QCKIS.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my questions:&lt;br&gt;&#xA;What would be the best approach to eliminate A from B?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to implement power spectral subtraction with no results as the signals seem to bee not similar enough to just subtract them. (or i did it wrong, i this case just tell me if this is the best way to do it)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a spectrum of C would be sufficient a more graphical approach may be better? To smooth my fft data, compute power spectra (basically what audacity does in the pictures) and subtract them to see whats left? (should be C)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional question:&lt;br&gt;&#xA;how can i change the overall amplitude of a signal in frequency domain without &quot;colouring&quot; the sound? i tried multiplying all real and imaginary parts by x but this changes the sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help appreciated!&#xA;regards&lt;/p&gt;&#xA;" OwnerUserId="3160" LastEditorUserId="128" LastEditDate="2019-05-23T08:52:53.940" LastActivityDate="2019-05-23T08:52:53.940" Title="Eliminate Signal A from Signal B" Tags="|filters|audio|frequency-spectrum|denoising|audio-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7594" PostTypeId="1" AcceptedAnswerId="7596" CreationDate="2013-01-22T13:53:17.770" Score="4" ViewCount="13404" Body="&lt;p&gt;I just study signal processing and I have some questions.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to find impulse response $h[n]$ sequence of the system if I have&#xA;$x[n]$ and $y[n]$ (input and output) sequences? Hope there is a formula&#xA;to do that.&lt;/li&gt;&#xA;&lt;li&gt;How to find $x[n]$ input sequence if I have $h[n]$ and $y[n]$?&lt;/li&gt;&#xA;&lt;li&gt;Is it possible to find $x[n]$ if I just have set of $y[n]$ values, but I&#xA;don't know impulse response $h[n]$? How to do that if so?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Maybe you can also suggest something for further reading about this topics.&lt;/p&gt;&#xA;" OwnerUserId="3238" LastEditorUserId="90" LastEditDate="2013-01-22T14:13:52.257" LastActivityDate="2013-06-05T12:26:24.653" Title="Get an input signal from LTI system output, find impulse response" Tags="|convolution|impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7595" PostTypeId="2" ParentId="7593" CreationDate="2013-01-22T14:02:21.140" Score="4" Body="&lt;p&gt;If the noise signal B is highly correlated with signal A (means related through linear filtering) than you can use an adaptive FIR filter to subtract out the noise from signal B and leave just C. If the noises are uncorrelated but just have the same spectrum and/or probability density function, spectral subtraction or Wiener filter (or a combination of both) is your best shot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplication with a constant in the frequency domain should work. You have to make sure that multiply ALL frequencies with the same number, i.e. include DC, Nyquist and negative frequencies as well. If you do fixed point processing, you also need to watch out for overflow, clipping and/or quantization noise. Other than that it doesn't matter if you are multiplying in the time or frequency domain.  &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-22T14:02:21.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7596" PostTypeId="2" ParentId="7594" CreationDate="2013-01-22T14:10:11.663" Score="5" Body="&lt;p&gt;Ok.  You are touching on the topic of deconvolution.  You can do this most easily by transforming the data into the frequency domain, doing some basic math and then converting back to the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example for case 1, if you transform the signals you have&#xA;$ H(f) = Y(f)/X(f) $ so $h[n] = IDFT[Y(f)/X(f)]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do similar manipulations to handle case 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure case 3 is possible.  I think you need more information to produce x[n]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a site that discusses deconvolution:  &lt;a href=&quot;http://terpconnect.umd.edu/~toh/spectrum/Deconvolution.html&quot; rel=&quot;nofollow&quot;&gt;http://terpconnect.umd.edu/~toh/spectrum/Deconvolution.html&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a VERY simplified treatment of this question.  I'm not sure what level of detail is being requested in the posted question.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-01-22T14:52:31.607" LastActivityDate="2013-01-22T14:52:31.607" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7598" PostTypeId="2" ParentId="7576" CreationDate="2013-01-22T15:48:30.430" Score="2" Body="&lt;p&gt;This is my intuitive understanding of IFFT/FFT regarding OFDM (i.e. - little or no math):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea of most modern communication systems is to send symbols with some sequence of different amplitudes and phases.  In OFDM, Those symbols are contained in the frequency domain.  Transmitters need a sequence of complex symbols to send in the time domain, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that you are generating the samples at &quot;one-sample-per-symbol&quot; (and will upsample/resample later).  What is the simplest way to control the amplitude and phase of the sub-carriers in the frequency domain?  The answer is the IFFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know what the amplitude and phase of the sub-carriers should be, the easiest way to enforce that, and give the transmitter the time-series complex exponentials that it needs, is the IFFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have samples at &quot;one-sample-per-symbol&quot; (which is okay when generating symbols), you you can resample that sequence to whatever is required by the transmitter or the receiving side of the simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background: I found the official, mathematical explanation (Weinstein) from my digital communications class not very helpful.  I came to this intuitive understanding when writing an OFDM simulation and an actual receiver for an OFDM specification.  Some people learn differently and I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastActivityDate="2013-01-22T15:48:30.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7599" PostTypeId="1" AcceptedAnswerId="7601" CreationDate="2013-01-22T18:12:53.800" Score="4" ViewCount="501" Body="&lt;p&gt;Reading the signal literature I often come across the expression $k \delta (t)$ where $k$ is a constant. I presume this is a notation to suggest we are referring to the area or strength of the Dirac function since the multiplication of a constant, $k$, by $\delta (t)$ seems to make no sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what does $k \delta(t)$ mean? Am I correct in assuming that on its own it doesn't represent $k$ multiplied by $\delta(t)$?&lt;/p&gt;&#xA;" OwnerUserId="3648" LastActivityDate="2013-01-22T18:22:25.117" Title="The meaning of $k \delta (t)$" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7601" PostTypeId="2" ParentId="7599" CreationDate="2013-01-22T18:22:25.117" Score="6" Body="&lt;p&gt;You are correct. In your example, $k$ would refer to the &quot;area underneath&quot; the impulse. Mathematically speaking, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirac_delta_function&quot;&gt;Dirac delta&lt;/a&gt; isn't a function in the typical sense of the term. Instead, it is more of a distribution, characterized by the fact that when integrated across any interval that contains $t=0$, the result is unity. That is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{-\epsilon}^{\epsilon} \delta(t) dt = 1 \ \forall\ \epsilon &amp;gt; 0&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The distribution is typically defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\delta(t) = \begin{cases} \infty,\ t = 0 \\ 0, \text{ otherwise}\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplication by a constant $k$ obviously wouldn't change this definition at all. So instead, the scaling merely changes the area underneath the distribution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{-\epsilon}^{\epsilon} k\delta(t) dt = k \ \forall\ \epsilon &amp;gt; 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extending this concept of multiplication by a constant $k$ to multiplication by a function $f(t)$ yields the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{-\epsilon}^{\epsilon} f(t) \delta(t) dt = f(0) \ \forall\ \epsilon &amp;gt; 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or more generally:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{T-\epsilon}^{T+\epsilon} f(t) \delta(t-T) dt = f(T) \ \forall\ \epsilon &amp;gt; 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is known as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirac_delta_function#Translation&quot;&gt;sifting property&lt;/a&gt; of the Dirac delta and is used extensively in linear systems theory.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-01-22T18:22:25.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7602" PostTypeId="2" ParentId="7593" CreationDate="2013-01-22T20:18:11.270" Score="6" Body="&lt;p&gt;The fact that you are plotting the FFT of the whole audio clip makes me think that you are looking at the wrong class of solutions. From the waveforms of signal A and B, it is clear that your noise and signal are not stationary. If you want to use a frequency-domain noise reduction technique, this should be done, in your case, on shorter overlapping windows across which you can assume that the properties of your signal and noise are stationary. You cannot avoid using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot;&gt;Short-term Fourier Transform&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the rest of this post, I will switch notations to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$X$ original (not noisy) signal&lt;/li&gt;&#xA;&lt;li&gt;$N$ noise signal&lt;/li&gt;&#xA;&lt;li&gt;$Y = X + N$ your observation, that is to say $B$. $X$ is what you want to recover, $N$ in your case is known (signal $A$)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Most denoising methods share the same structure: get a STFT representation of $Y$ and $N$ (matrices $Y(p, k)$ and $N(p, k)$, where $p$ is the frame index and $k$ the frequency bin index), process pairs of FFT frames from rows of $Y$ and $N$ to get an estimate $\hat{X}$ of a slice of the denoised signal spectrum, and use it to build a filter/mask applied in the frequency domain to $Y$, the conversion back to the time-domain being performed through overlap-add.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to try to implement the Ephraim-Malah algorithm, which is a classic and often cited &quot;baseline&quot; denoising method. It is based on two intuitive tricks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Estimate the SNR and attenuate the strength of the denoising filter in segments with low SNR (this prevents many artifacts in areas where the signal is close to the noise level).&lt;/li&gt;&#xA;&lt;li&gt;Use temporal smoothing (if we have a high SNR in a frame, make the filtering/subtraction stronger in the next frame since it is also likely to contain signal...).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have found &lt;a href=&quot;http://sipl.technion.ac.il/new/Teaching/Related_Courses/Digital_Speech_Processing/Michael%20Bronstein%20-%20Suppression%20of%20Musical%20Noise.pdf&quot;&gt;a relatively self-contained set of slides on the topic&lt;/a&gt; - the author introduces increasingly sophisticated denoising rules, from spectral subtraction to full-blown Ephraim-Malah. The only thing he doesn't tell you to get to a practical implementation is how to get the estimate $\hat{S}_x(p,k)$ - since you don't observe $X(p,k)$, just $Y(p,k)$ and $N(p,k)$. The simplest approach is to subtract the power spectrum of the noise from the power spectrum of the signal, and zero the STFT cells in which the result is negative:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{S}_x(p,k) = \begin{cases} |Y(p,k)|^2 - |N(p,k)|^2 &amp;amp; when |Y(p,k)|^2 - |N(p,k)|^2 &amp;gt; 0 \\ 0 &amp;amp; otherwise \end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then try the filtering rules shown on pages 5 and 10 of the slides.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-01-22T20:18:11.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7603" PostTypeId="1" AcceptedAnswerId="7655" CreationDate="2013-01-22T23:33:37.823" Score="5" ViewCount="809" Body="&lt;p&gt;I have a digital signal which may be represented as a pulse noise source filtered with an FIR (finite impulse response) filter. Suppose that the noise consists of discrete pulses (nonzero samples where most samples are zero), and there is an equal probability of a pulse at any sample (so for example the number of pulses in an interval follows the Poisson distribution). Further suppose the strength of each pulse is equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can the coefficients of the FIR filter be recovered from the filtered signal, and how?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assume the noise is impulsive, but may be somewhat correlated with itself (it doesn't have perfect Poisson statistics). Also assume that the strength of each pulse may vary. Can the coefficients be recovered approximately if the exact distribution of noise is not known?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise source $N[i]$ where $i=0..n, N[i] = 1$ with some unknown but low probability $p$, 0 otherwise; each $N[i]$ is independent of other $N[i]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filter $F[k]$ where $k=0..m$, unknown, $m$ is much less than $n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal $S[i]$ where $i=0..n$, $S = N * F$, where * is convolution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given $S$, estimate $F$. $N$ and $p$ are also unknown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give this some practical background, the average period between noise pulses can be 20-40 samples, the FIR filter can have a few hundred nonzero coefficients (so the filtered signals resulting from each pulse overlap significantly), and the total signal is a few thousand samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: Some real-world data here: &lt;a href=&quot;http://pastebin.com/N3LZU6vm&quot; rel=&quot;nofollow&quot;&gt;http://pastebin.com/N3LZU6vm&lt;/a&gt;  I think what you see at sample 780-810 is pretty close to the impulse response to a single impulse.  This is generated by noise fed into a complex resonator, whether the noise is impulsive as described above is not actually known but is physically plausible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some synthetic data here: &lt;a href=&quot;http://pastebin.com/qTYLP5eA&quot; rel=&quot;nofollow&quot;&gt;http://pastebin.com/qTYLP5eA&lt;/a&gt;  This is generated from the following python code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;noise = numpy.where( numpy.random.rand(5000) &amp;lt; 1/20.0, numpy.ones(5000), numpy.zeros(5000))&#xA;filter = numpy.sin( numpy.arange(200) * 2 * math.pi / 11 ) * numpy.exp( - numpy.arange(200) / 30.0 )&#xA;signal = numpy.convolve( noise, filter )&#xA;for i in range(len(signal)): print int(signal[i] * (2**15)/ 3.0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This creates a filter wavelet from a sinewave with period 11 samples and an exponentially decaying envelope, and noise where each sample has an independent 5% probability of being an impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:  I think what I am looking for is very similar to what is involved in building an &lt;a href=&quot;http://en.wikipedia.org/wiki/Autoregressive_model&quot; rel=&quot;nofollow&quot;&gt;autoregressive model&lt;/a&gt; (AR).  There are slight differences in the formulation, for example AR is based on an IIR with lagged signal plus a noise term rather than FIR with lagged noise, and the noise is assumed to be Gaussian rather than impulses with Poisson distribution.  However I think AR proves that estimating a filter from filtered noise is possible, and in fact AR may just work for my problem.&lt;/p&gt;&#xA;" OwnerUserId="3650" LastEditorUserId="128" LastEditDate="2019-06-24T18:02:13.493" LastActivityDate="2019-06-24T18:02:13.493" Title="Recover Filter Coefficients from Filtered Noise" Tags="|filters|noise|impulse-response|deconvolution|" AnswerCount="3" CommentCount="16" ContentLicense="CC BY-SA 4.0" />
  <row Id="7604" PostTypeId="2" ParentId="7527" CreationDate="2013-01-23T04:48:35.840" Score="2" Body="&lt;p&gt;Unless I am completely off base or misunderstand your question, the answer is &lt;em&gt;yes&lt;/em&gt;: By linearity of the DFT, averaging the signals in time and then taking the DFT of the average is equivalent to averaging the DFTs of the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show this, let's define some variables:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$x_{n}[\ell]$: $\ell^{th}$-trial time domain sample at time $n$&lt;/li&gt;&#xA;&lt;li&gt;$X_{k}[\ell]$: $\ell^{th}$-trial frequency domain sample at frequency $k$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &quot;average&quot; signal in the time domain is given by $\frac{1}{L} \sum_{\ell=0}^{L} x_{n}[\ell]$. Taking its DFT, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{n=0}^{N-1} \frac{1}{L} \sum_{\ell}^{L} x_{n}[\ell] e^{-i 2 \pi k n / N}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Switching the order of the summations, we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1}{L} \sum_{\ell=0}^{L} \sum_{n=0}^{N-1} x_{n}[\ell] e^{-i 2 \pi k n / N},$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but this is the same as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1}{L} \sum_{\ell=0}^{L} X_{k}[l]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the same as averaging the DFTs of each trival. This is what we wanted to show.&lt;/p&gt;&#xA;" OwnerUserId="3653" LastEditorUserId="3653" LastEditDate="2013-01-23T15:40:24.700" LastActivityDate="2013-01-23T15:40:24.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7605" PostTypeId="1" AcceptedAnswerId="7609" CreationDate="2013-01-23T14:24:26.520" Score="4" ViewCount="1417" Body="&lt;p&gt;In 'Digital Filters' by Hamming there is a cryptic section where he describes how the Gibbs phenomenon can be viewed as the displacement between the centers of two functions as they are convolved together. This is on pages 112 - 113 of the 3rd edition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the process of this he shows that truncating the Fourier Series is the same as multiplying the Fourier coefficients with a rectangle function. He then goes on to show that the function that has 2N+1 coefficients which are 1 is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h(\theta)$ = $\frac{sin(2N+1/2)\theta}{sin(\theta /2)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused: I thought the frequency response of a rectangle was a sinc function, and another page he shows this (when he derives the Lanczos smoothing factors). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please clear this up for me?&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-01-25T09:25:50.830" Title="Gibbs phenomenon in Hamming's digital filters" Tags="|fourier-series|gibbs-phenomenon|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7606" PostTypeId="2" ParentId="7603" CreationDate="2013-01-23T14:57:23.907" Score="1" Body="&lt;p&gt;Here are a couple of ideas (not solutions)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, imagine what would happen if you're noise was instead a periodic impulse at the average period between samples (lets say a pulse every 30 samples).  You would end up with a periodic sequence.  Can you try averaging your data, perhaps using 30 sample long windows in such a way that the result, given sufficient sample size approaches this periodic response.  Once you have this &quot;average&quot; response signal, find the DFT over one period of the signal.  Then interpolate the DFT points to prvide enough detail (points/bins) to exceed the estimated support of F (say 200 bins).  Then take the IDFT of the result.  The reslult will provide an approximation of the FIR &quot;filter&quot; coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second you can look into research on the representation and recovery of signals using random sampling.  This is a different problem, but the techniques may be useful for the problem you are trying to solve.  Here is a link to an article:  &lt;a href=&quot;http://deepblue.lib.umich.edu/bitstream/handle/2027.42/22215/0000648.pdf;jsessionid=92ABBC582E3D6909A24775F88D6543D2?sequence=1&quot; rel=&quot;nofollow&quot;&gt;http://deepblue.lib.umich.edu/bitstream/handle/2027.42/22215/0000648.pdf;jsessionid=92ABBC582E3D6909A24775F88D6543D2?sequence=1&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-01-24T13:46:24.753" LastActivityDate="2013-01-24T13:46:24.753" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7607" PostTypeId="1" AcceptedAnswerId="8458" CreationDate="2013-01-23T15:30:00.883" Score="1" ViewCount="2918" Body="&lt;p&gt;I am somewhat new to DSP. I'm trying to implement BPSK by following &lt;a href=&quot;http://epx.com.br/artigos/qam_rx.php&quot; rel=&quot;nofollow&quot;&gt;this Python QAM tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code seems to work, but I really just ported the tutorial's Python code to C++, and do not understand it. This is the part that confuses me the most:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Demodulate in &quot;real&quot; and &quot;imaginary&quot; parts. The &quot;real&quot; part&#xA;# is the correlation with carrier. The &quot;imaginary&quot; part is the&#xA;# correlation with carrier offset 90 degrees. Having both values&#xA;# allows us to find QAM signal's phase.&#xA;&#xA;for sample in samples:&#xA;    t += 1&#xA;    angle = CARRIER * t * 2 * math.pi / SAMPLE_RATE&#xA;    real.append(sample * math.cos(angle))&#xA;    imag.append(sample * -math.sin(angle))&#xA;&#xA;for t in range(0, len(real)):&#xA;    # This converts (real, imag) to an angle&#xA;    angle = math.atan2(imag[t], real[t])&#xA;    phase.append(angle)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I understand that this code is correlating the input signal with two identical carrier waves which are offset by 90º. I do &lt;em&gt;not&lt;/em&gt; understand why that correlation has anything to do with phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love an answer to &lt;strong&gt;any&lt;/strong&gt; of the following questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why does this code work? &lt;/li&gt;&#xA;&lt;li&gt;What is the connection between correlation and phase? &lt;/li&gt;&#xA;&lt;li&gt;Is this a common, reliable method of calculating phase? &lt;/li&gt;&#xA;&lt;li&gt;Why does the FFT need so many samples to calculate phase, but this code just needs 1 sample?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Feel free to refer me to a signal theory or DSP book that answers these questions!&lt;/p&gt;&#xA;" OwnerUserId="3609" LastActivityDate="2013-04-01T21:26:04.580" Title="Why do you get instantaneous phase by calculating correlation with a carrier signal?" Tags="|digital-communications|correlation|phase|qpsk|bpsk|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7608" PostTypeId="1" AcceptedAnswerId="7610" CreationDate="2013-01-23T15:45:45.550" Score="8" ViewCount="285" Body="&lt;p&gt;I am pretty new to DSP. I need a computer to transmit data to a receiver through audio signals in a loud outdoor environment. (I am writing the software for both sender and receiver so I can design the signal however I want.) I am using cheap speakers and microphones operating at 44.1Khz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like for the sender to emit a signal that can be recognized by the receiver with extremely high accuracy on the time domain. This signal does not need to contain any information, the receiver just needs to be able to figure out &lt;strong&gt;exactly when the signal started&lt;/strong&gt;, ideally down to the exact sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first idea was for the sender to emit a 2kHz wave for 250ms. The receiver would continuously perform FFT to identify that wave, and when present, it would look at the FFT history to figure out the sample at which the wave had started. However this approach feels clunky because of the number of samples needed to satisfy the FFT. I could never achieve 1-sample accuracy without doing an FFT for each sample, and I don't think it would even give me good results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been learning about PSK for unrelated reasons, and I am getting the impression that there are lots of ways to detect properties of waves – without the FFT. So my question is – what methods could I use to identify an instantaneous change in my input signal, in an extremely noisy environment?&lt;/p&gt;&#xA;" OwnerUserId="3609" LastActivityDate="2013-01-23T18:34:41.213" Title="How to send / receive a short impulse in an extremely noisy signal with high timing accuracy?" Tags="|impulse-response|digital-communications|bpsk|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7609" PostTypeId="2" ParentId="7605" CreationDate="2013-01-23T16:58:55.907" Score="4" Body="&lt;p&gt;I think the main issue is you are jumping ahead of yourself.  You probably remember or read somewhere that the Fourier transform of a $rect$ function is a $sinc$ function.  This is true; however, no where in this section does he mention Fourier transform!  In fact, what he is doing is not Fourier transform.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What he does in this section is to represent any periodic function as a Fourier series:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1)    $f(\theta)=\frac{a_0}{2}+\sum_{k=0}^\infty{(a_k \cos k\theta + b_k \sin k\theta)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key here is that this function doesn't contain every frequency.  It contains frequency 0 (the DC) and $\frac{k}{2\pi}$ where $k=1,2,3,...\infty$.  This is actually &lt;em&gt;very&lt;/em&gt; important.  This function is always periodic with a period of $2\pi$.  The coefficients $a_k$ and $b_k$ are almost sampled values of the Fourier transform (but not quite, why? homework exercise! :p).  You have countably many of these coefficients.  Later in the book, you will learn that when you sample data in one space (frequency or time) it necessarily makes the counter part in the other space (time or frequency) periodic.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first case, he does the Lanczos smoothing derivation where he averages the function by running a rectangular window through it (convolving with rect).  What he shows is, not surprisingly, that the coefficients get multiplied by this term:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2)    $\frac{\sin k\pi/N}{k\pi N}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which should look very familiar to you, of course, because it is the $sinc$ function.  However, what you are missing is that $k$ is discrete!  It is actually a sampled version of the $sinc$ function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Effectively, he convolves a function with a $rect$ and shows that the coefficients of the resulting Fourier series (read loosely as: sampled Fourier transform) is a sampled $sinc$ function.  No surprise there.  Convolution thm says convolution in time turns into multiplication in frequency.  Fourier transform, which you know, of $rect$ is $sinc$, so convolution by $rect$ is multiplication by $sinc$ in frequency space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the next section, he does something different.  He takes the Fourier series (read: &lt;em&gt;sampled&lt;/em&gt; Fourier transform) and removes all the higher frequency coefficients.  In effect, he is taking the Fourier transform, multiplies by a $rect$, and then samples it.  For simplicity, he sets all the Fourier coefficients that did not get discarded to $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What he's left with is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3)    $h(\theta)=\frac{sin(N+1/2)\theta}{sin(\theta/2)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you ask, why isn't this a $sinc$ function?  Can you answer it now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quick answer is &lt;strong&gt;because what is applied in frequency domain is not just a truncation, it's a truncation and a sampling operator&lt;/strong&gt;.  What you know is that when you truncate (i.e. multiply by rect) in frequency domain, the time domain gets convolved with a $sinc$ (by Convolution thm and Fourier transform of $rect$), but this is &lt;strong&gt;without sampling&lt;/strong&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for why the formula looks the way it does, there are two ways to look at it.  The first, which he shows, is that you can just sum the Fourier series from $-N$ to $N$, and that's what you get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second, which is more profound and may come up later, is that (*) when you sample a function in one space (say frequency), the corresponding function in the other space (say time) becomes the sum of shifted versions of itself.  In fact, it probably won't come up exactly like that.  The typical scenario is that sampling time domain creates periodic replication in the frequency domain (btw: this is the reason for what people call aliasing).  However, you can apply the duality property of Fourier transform to get (*).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does equation (3) make sense now?  It is periodic.  The closer you get to 0, the more it looks like a $sinc$ function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, an exercise for you is to derive equation (3) by sampling and truncating in frequency space and applying inverse transform.&lt;/p&gt;&#xA;" OwnerUserId="3632" LastEditorUserId="3632" LastEditDate="2013-01-25T09:25:50.830" LastActivityDate="2013-01-25T09:25:50.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7610" PostTypeId="2" ParentId="7608" CreationDate="2013-01-23T17:46:48.367" Score="8" Body="&lt;p&gt;Using a sinusoid is a bad idea. In order to precisely detect the time of arrival, you want a signal with wide bandwidth. Here's a brief description of a good approach:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Transmit a known &lt;a href=&quot;http://en.wikipedia.org/wiki/Direct-sequence_spread_spectrum&quot;&gt;direct-sequence spread spectrum (DSSS)&lt;/a&gt; waveform (typically a &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-shift_keying&quot;&gt;phase-shift-keyed&lt;/a&gt; digital signal, either &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-shift_keying#Binary_phase-shift_keying_.28BPSK.29&quot;&gt;BPSK&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-shift_keying#Quadrature_phase-shift_keying_.28QPSK.29&quot;&gt;QPSK&lt;/a&gt;). You should pick a spreading code that has good autocorrelation properties: its autocorrelation should look close to an impulse. A sequence of random symbols will often work, or you can use something more well-defined like a &lt;a href=&quot;http://en.wikipedia.org/wiki/Maximum_length_sequence&quot;&gt;maximal-length sequence&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At the receiver, apply a &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot;&gt;matched filter&lt;/a&gt; to the known transmitted pattern. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You will see a spike in magnitude at the output of the filter that corresponds to the time of arrival of the signal of interest. Apply a threshold to the filter output to identify the locations of these spikes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The matched filter will have a delay of $N-1$ samples, where $N$ is the length of the sequence. Subtract this duration from the detected pulse locations to yield an estimate of the pulse arrival time.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Optionally, take the samples surrounding the peak and interpolate to get a finer (sub-sample) estimate of the actual peak location. Polynomial, sinc-based, or other methods may be used here.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is a very simplified description of what you might want to do, but it should get you started. One consideration to keep in mind when designing the length of the sequence: there is a tradeoff between the total integration period (i.e. the sequence length) and the frequency selectivity of the matched filter. If you have appreciable frequency error between your transmitter and receiver, the peaks at the matched filter output will become attenuated. The amount of attenuation depends on the frequency offset's relationship to the matched filter length. This is a common attribute of DSSS systems that must be handled appropriately.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-01-23T18:34:41.213" LastActivityDate="2013-01-23T18:34:41.213" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7611" PostTypeId="2" ParentId="7527" CreationDate="2013-01-23T19:11:35.903" Score="8" Body="&lt;p&gt;Let me clarify.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fourier transform does &lt;strong&gt;not&lt;/strong&gt; represent the histogram of the signal.  Fourier transform is a linear transform that takes signal from time domain (complex function) to frequency domain (another complex function).  It takes a complex function to another complex function.&lt;/li&gt;&#xA;&lt;li&gt;Fourier transform &lt;strong&gt;is&lt;/strong&gt; linear as the poster above pointed out.&lt;/li&gt;&#xA;&lt;li&gt;Phase in your samples matters as pointed out above.  If trial-by-trial data varies in phase, then you do not want to average before doing a Fourier transform, but you also do not want to average after Fourier transform.  You want to average after Fourier transform and norm.  I will elaborate below as far as exactly what needs to be done.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The main issue here is that the question is posed wrong.  It is not &amp;quot;should I take the Fourier transform before averaging or after averaging&amp;quot;.  Because it makes no difference due to linearity of Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;The correct question to ask is &amp;quot;should I take the amplitude of the Fourier transform before averaging or after averaging&amp;quot;.  For this question, the answer is before.&lt;/p&gt;&#xA;&lt;p&gt;Here are the details.&lt;/p&gt;&#xA;&lt;p&gt;Suppose your sampled data is represented by the sequences:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$d_1=d_1[n_1],d_1[n_2],...d_1[n_N]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$d_2=d_2[n_1],d_2[n_2],...d_2[n_N]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$d_3=d_3[n_1],d_3[n_2],...d_3[n_N]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$d_M=d_M[n_1],d_M[n_2],...d_M[n_N]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$d_1,...d_M$&lt;/span&gt; are data from M trials and &lt;span class=&quot;math-container&quot;&gt;$n_1,...n_N$&lt;/span&gt; are sampled time points, then:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$F_1 = \sum_{j=1}^M{|\mathcal{F}\{d_j\}|} \neq  |\mathcal{F}\{\sum_{j=1}^M{d_j}\}| = F_2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So while the transform &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; is linear, &lt;span class=&quot;math-container&quot;&gt;$|\mathcal{F}|$&lt;/span&gt; is not.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, while &lt;span class=&quot;math-container&quot;&gt;$d_j[n_i]$&lt;/span&gt; is real for all &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}\{d_j\}$&lt;/span&gt; is not, but &lt;span class=&quot;math-container&quot;&gt;$|\mathcal{F}\{d_j\}|$&lt;/span&gt; is.&lt;/p&gt;&#xA;&lt;p&gt;As for what you should do, you should take the Fourier transform of individual trials (via FFT), get the amplitude of individual trials, and a average them together.&lt;/p&gt;&#xA;&lt;p&gt;Finally, what is &lt;span class=&quot;math-container&quot;&gt;$1/f$&lt;/span&gt;.  &lt;span class=&quot;math-container&quot;&gt;$1/f$&lt;/span&gt; is a short term for the frequency spectrum of &amp;quot;natural&amp;quot; signals (usually people think of images).&lt;/p&gt;&#xA;&lt;p&gt;When people say there is a large &lt;span class=&quot;math-container&quot;&gt;$1/f$&lt;/span&gt; component, it means that the amplitude as a function of frequency looks like &lt;span class=&quot;math-container&quot;&gt;$1/f$&lt;/span&gt;.  It's totally hand-wavy... probably coming from a biologist :p&lt;/p&gt;&#xA;&lt;p&gt;The inverse Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$1/f$&lt;/span&gt; is some sign function, but that is useless.  It is an imaginary sign function!  Real functions generate symmetric Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;In fact saying that the spectrum is &lt;span class=&quot;math-container&quot;&gt;$1/f$&lt;/span&gt;, tells you something about the signal, but it doesn't let you recover the signal.  All that you know is that &lt;span class=&quot;math-container&quot;&gt;$|\mathcal{F}\{x(t)\}| = |1/f|$&lt;/span&gt;.  This doesn't let you uniquely determine &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; because all the phase information is gone, and we know that the structure of a signal &lt;a href=&quot;https://ieeexplore.ieee.org/document/1456290&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;The importance of phase in signals&quot;&gt;relies heavily on its phase&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What does &lt;span class=&quot;math-container&quot;&gt;$1/f$&lt;/span&gt; tell you?  Simply that it contains a lot of low frequency and a little high frequency.&lt;/p&gt;&#xA;&lt;p&gt;Just as important a question, what does averaging buy you?  and more important is how to interpret the result?  Tune in tomorrow for a more in depth discussion :p&lt;/p&gt;&#xA;" OwnerUserId="3632" LastEditorUserId="26573" LastEditDate="2022-06-03T13:45:24.760" LastActivityDate="2022-06-03T13:45:24.760" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7612" PostTypeId="1" AcceptedAnswerId="7613" CreationDate="2013-01-23T23:50:19.100" Score="5" ViewCount="13257" Body="&lt;p&gt;My understanding of I and Q channels is as follows (please correct me if I am wrong):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;I&lt;/code&gt; = In-phase, or real component&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Q&lt;/code&gt; = Quadrature (90° shift of real component)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Where do these two channels come from in the first place? Is one the electric field and the other the magnetic field of a EM wave? I was under the impression that these channels are only present in digital waveforms; if this is true, and if so, why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be used to find the vector of on incoming signal, and would the signal modulation make a difference (assuming you can invoke the proper filtering necessary)?&lt;/p&gt;&#xA;" OwnerUserId="3630" LastActivityDate="2014-05-06T14:15:28.340" Title="I and Q Channels" Tags="|signal-detection|soft-question|decomposition|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7613" PostTypeId="2" ParentId="7612" CreationDate="2013-01-24T00:24:01.823" Score="13" Body="&lt;p&gt;The two channels exist only inside a transmitter or a receiver; the channels are physically combined in a single signal (or channel) in the physical medium (wire, coax cable, free space, etc).  At the transmitter, two signals $s_I(t)$ and&#xA;$s_Q(t)$ (called the I (or inphase) signal and Q (or quadrature) signal&#xA;respectively) are combined into a single signal $s(t)$ that is transmitted&#xA;over the physical medium in a frequency band centered at $\omega_c$ radians&#xA;per second. Note that &#xA;$$s(t) = s_I(t)\cos(\omega_c t) - s_Q(t)\sin(\omega_c t)$$&#xA;The receiver separates out the two signals $s_I(t)$ and $s_Q(t)$ from this by multiplying $s(t)$&#xA;by $2\cos(\omega_c t)$ and $-2\sin(\omega_c t)$ respectively,&#xA;and low-pass filtering the two products. That is,&#xA;$$\begin{align*}&#xA;s_I(t) &amp;amp;= \text{result of low-pass filtering of}~ 2s(t)\cos(\omega_c t)\\&#xA;s_Q(t) &amp;amp;= \text{result of low-pass filtering of}~ -2s(t)\sin(\omega_c t)&#xA;\end{align*}$$&#xA;Note that &#xA;$$&#xA;\begin{align*}&#xA;2s(t)\cos(\omega_c t) &#xA;&amp;amp;= 2s_I(t)\cos^2(\omega_c t) - 2s_Q(t)\sin(\omega_ct)\cos(\omega_c t)\\&#xA;&amp;amp;= s_I(t) + \bigr [s_I(t)\cos(2\omega_c t) - s_Q(t)\sin(2\omega_c t)\bigr]\\&#xA;-2s(t)\sin(\omega_c t) &#xA;&amp;amp;= -2s_I(t)\cos(\omega_c t)\sin(\omega_c t) + 2s_Q(t)\sin^2(\omega_ct)\\&#xA;&amp;amp;= s_Q(t) + \bigr [-s_Q(t)\cos(2\omega_c t) - s_I(t)\sin(2\omega_c t)\bigr]\\&#xA;\end{align*}$$&#xA;where the quantities in square brackets are &lt;em&gt;double-frequency&lt;/em&gt; terms that are&#xA;eliminated by the low-pass filtering.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-05-06T14:15:28.340" LastActivityDate="2014-05-06T14:15:28.340" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7614" PostTypeId="1" AcceptedAnswerId="7615" CreationDate="2013-01-24T02:34:31.777" Score="4" ViewCount="500" Body="&lt;p&gt;One thing puzzles me about the state space representation and that is why is it claimed that such systems are linear and time-invariant but particularly why are they claimed to be linear?  The right-hand side of $dx/dt = A x(t) + B u(t)$ does not seem to obey superposition? Is it because the solutions to these systems are linear?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_1 = A x_1 + B u $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_2 = Ax_2 + B u$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_3 = A (x_1 + x_2) + B u $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore $y_3 \neq y_1 + y_2 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm I doing something wrong?&lt;/p&gt;&#xA;" OwnerUserId="3648" LastActivityDate="2013-01-24T16:27:39.537" Title="Why is the state space representation, $dx/dt = A x(t) + B u(t)$ linear?" Tags="|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7615" PostTypeId="2" ParentId="7614" CreationDate="2013-01-24T03:09:38.420" Score="7" Body="&lt;p&gt;What you have listed is a state equation.  Usually a state-space representation has two equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i) $\dot{x}(t)=Ax(t)+Bu(t)$&lt;br&gt;&#xA;(ii) $y(t)=Cx(t)+Du(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One takes the input $u(t)$ and generates the state $x(t)$ and another that takes the input $u(t)$ and state $x(t)$ and generates the output $y(t)$.  You are missing the second equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That aside, the equation that you have is basically a 1st order linear differential equation.  It's important to note, here, that the input is &lt;strong&gt;not&lt;/strong&gt; $x(t)$, it is $u(t)$.  $x(t)$ is the state variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will examine just the first half (input to state) and leave the second half (input and state to output) to you.  I will remark, though, that if $x(t)$ is linear with respect to $u(t)$ then $y$ in equation (ii) above necessarily has to be linear by virtual of adding two linear terms together, so the second half is really trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first half is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) $\dot{x}(t)=Ax(t)+Bu(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you show that it is linear?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will show additivity and leave homogeneity to you.  Say you have inputs $u_1$, $u_2$, and $u_3=u_1+u_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to do this is to solve (1).  As it is a 1st order ODE, it is not too difficult, but let's be lazy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x_1$ be the state generated by input $u_1$ and $x_2$ be the state generated from input $u_2$, then we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) $\dot{x_1}(t)=Ax_1(t)+Bu_1(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) $\dot{x_2}(t)=Ax_2(t)+Bu_2(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;adding (2) and (3) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4) $\dot{x_1}(t)+\dot{x_2}(t)=Ax_1(t)+Ax_2(t)+Bu_1(t)+Bu_2(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From linearity of derivative, we get that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(5) $\dot{x_3}(t)=A(x_3(t))+B(u_3(t))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_3 = x_1+x_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So input $u_3 = u_1+u_2$ generates state variable $x_3 = x_1+x_2$, showing that additivity holds for the state equation.&lt;/p&gt;&#xA;" OwnerUserId="3632" LastEditorUserId="3632" LastEditDate="2013-01-24T16:27:39.537" LastActivityDate="2013-01-24T16:27:39.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7616" PostTypeId="2" ParentId="7603" CreationDate="2013-01-24T04:02:17.517" Score="2" Body="&lt;p&gt;Ok, so for the discrete case, this is actually pretty simple.  It comes out to a big matrix equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you have that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) $s = n * f$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(notice that the conventional way to write this is $s = n*f$ but you can just as well transpose as convolution is commutative)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as you have stated.  In fact, this is really simple :p  I have used lower case letters to represent your variables.  This is because they are sequences, represented as vectors.  I am reserving uppercase for matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define $N$ to be (the transpose of) the &lt;a href=&quot;http://en.wikipedia.org/wiki/Toeplitz_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toeplitz matrix&lt;/a&gt; of $n$ given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ N =&#xA;\left[ \begin{array}{ccc}&#xA;n_1 &amp;amp; 0 &amp;amp; . &amp;amp; 0 \\&#xA;n_2 &amp;amp; n_1 &amp;amp;  . &amp;amp; 0 \\&#xA; .  &amp;amp; . &amp;amp; .  &amp;amp; . \\&#xA;n_m &amp;amp; n_{m-1} &amp;amp; . &amp;amp; n_1 \\&#xA; 0  &amp;amp; n_m &amp;amp; . &amp;amp; n_2 \\&#xA; .  &amp;amp;  .  &amp;amp; . &amp;amp; . \\&#xA; 0  &amp;amp;  0 &amp;amp;  0 &amp;amp; n_m \\&#xA;\end{array} \right]&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So equation (1) becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) $s = Nf$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;just a matrix multiplication.  In this equation, you know $s$ and $N$ and want to find $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably have a lot of input and output samples compared to the size of the filter, so the length of $s$ is a lot bigger than $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From linear algebra, recall that if rank(N)&gt;length(f), then you can completely reconstruct $f$ from $n$ and $s$.  Otherwise, you can't.  In this case, you can shuffle things around, but there's always going to be missing information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do you solve for $f$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's just a simple over-determined matrix equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way is to use least square by evaluating $ argmin_f||s-Nf||$.  There are many ways to do this, and it is the topic of several chapters in numerical methods.  I won't go into that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as per discussion below, it seems I misread and n is also unkown.  In this case it is impossible to recover f.  This is a case of system identification.  See here &lt;a href=&quot;https://dsp.stackexchange.com/questions/7594/get-an-input-signal-from-lti-system-output-find-impulse-response&quot;&gt;Get an input signal from LTI system output, find impulse response&lt;/a&gt; for a brief discussion about it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This issue is really quite simple.  I say c = axb (multiply, not convolution) and then tell you that c is 10.  what is b?  There is no way to tell. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your specific scenario is actually worse than that.  It is difficult to even make a connection between the distribution of s and n.  This is primarily because output s  generated by convolving n with f converts most distributions into something that looks normal (recall the central limit theorem), assuming that n is generated by an iid process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know that $n$ is sparse and can guarantee that the pulses are always farther apart than the support of f, then just model this into the formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in fact, you don't have to do anything.  whenever $s&amp;gt;0$, the portion of $s$ in the vicinity that is $&amp;gt;0$ a shifted version of your $f$.  Of course, there is no way to know the degree of shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know that there is a small probability of overlap between the pulses, then what you can do is generate $f_1$, ... $f_p$ for each time $s&amp;gt;0$.  Most of them will look similar (plus noise), and the rest will look like a shifted sum of the majority.  What you can do, then is, out of the $f_j$, take the ones with smallest support, shift them so the $L_2$ norm is minimal, and average the shifted versions them together.  This gives you an estimated $f$ (within shift in time) from pulses that are far apart.  You can similarly model 2, 3, 4, etc. overlapping pulses...&lt;/p&gt;&#xA;" OwnerUserId="3632" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-01-24T10:15:30.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7617" PostTypeId="2" ParentId="7548" CreationDate="2013-01-24T06:52:35.777" Score="1" Body="&lt;p&gt;Bjorn Roche gives most of the important points in his answer. Though what is an important consideration when modelling like this is early vinyl gramophones did not just create that &quot;old&quot; sound but also early microphone technology that created the recordings, which was very band-passed by todays terms. A lot of the energy in the signal can be found between 400-4000hz. I would look at microphone response charts (if you can find them!) to be more precise.&lt;/p&gt;&#xA;" OwnerUserId="3660" LastActivityDate="2013-01-24T06:52:35.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7618" PostTypeId="1" AcceptedAnswerId="7619" CreationDate="2013-01-24T07:58:02.153" Score="1" ViewCount="595" Body="&lt;p&gt;I have a signal X(n) of length 24. But I want to find 1024 point FFT of this signal. I can do this by padding 1000 0s in x(n). But this requires huge memory which actually will be having only 24 valid data points.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can avoid this extra padding and yet be able to perform FFT. To be very specifica I am using &lt;a href=&quot;https://developer.nvidia.com/cufft&quot; rel=&quot;nofollow&quot;&gt;CUFFT&lt;/a&gt; for finding FFT on the GPU. The padding 1000 0s means I have to allocate this extra memory on the GPU and also do copying operations from GPU to CPU and CPU to GPU etc.     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hint?&lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2013-01-24T10:05:15.693" Title="Avoiding padding during FFT calculation" Tags="|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7619" PostTypeId="2" ParentId="7618" CreationDate="2013-01-24T10:05:15.693" Score="2" Body="&lt;p&gt;From a programming point of view I don't see any possibility of avoiding the copy operation for 1024 values because the &lt;code&gt;CUFFT&lt;/code&gt; library expects a pointer to an array containing &lt;code&gt;NX&lt;/code&gt; (FFT size) values. If you don't initialize all of them, the result of the FFT operation will be random.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a DSP point of view you could easily use a 32- or even 24-FFT without loosing information. Zeropadding in time domain corresponds to an interpolation in frequency domain, where the interpolated frequency bins can be different from the actual spectrum. You should check if you really need the frequency resolution of a 1024-FFT.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-01-24T10:05:15.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7621" PostTypeId="2" ParentId="7607" CreationDate="2013-01-24T13:12:15.410" Score="1" Body="&lt;p&gt;This is the analytic signal. See &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt; for better details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically you are taking the carrier correlation, $f(x)$, and its Hilbert transform, $(h \ast f)(x)$ and combining them into a single complex valued signal, the analytic signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_A(x) = f(x) - i (h \ast f)(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be written as the complex exponential&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_A(x) = A(x) e^{i \phi(x)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why this is useful is that it performs a split of identity into seperate amplitude $A$ and phase $\phi$ components. Actually the Hilbert transform requires the entire signal to compute, but because you know the function of your signal already you only need the one sample.To localise the phase, you would use a bandpass filter.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-01-24T13:12:15.410" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7622" PostTypeId="1" CreationDate="2013-01-24T14:51:14.583" Score="3" ViewCount="6847" Body="&lt;p&gt;I have a skeleton image. I am able to detect branchpoints, endpoints and able to label image using BWMorph, BWLabel. Now I want to differntiate between skeleton center line and branches. In short I want to detect branches in skeleton. I want to perform operations on skeleton branches and I do not want to consider center line in these operations. Can someone help? Following is skeleton image.&#xA;&lt;a href=&quot;http://www.flickr.com/photos/92388309@N03/8397759970/in/photostream/&quot; rel=&quot;nofollow&quot;&gt;http://www.flickr.com/photos/92388309@N03/8397759970/in/photostream/&lt;/a&gt;&#xA;Arrows in following image show center line of skeleton.&#xA;&lt;a href=&quot;http://www.flickr.com/photos/92388309@N03/8404495186/in/photostream/&quot; rel=&quot;nofollow&quot;&gt;http://www.flickr.com/photos/92388309@N03/8404495186/in/photostream/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following is code I have used.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mn=bwmorph(y,'branchpoints');&#xA;[row column] = find(mn);&#xA;branchPts    = [row column];&#xA;endImg    = bwmorph(y, 'endpoints');&#xA;[row column] = find(endImg);&#xA;endPts       = [row column];&#xA;figure;imshow(y);&#xA;hold on ; &#xA;plot(branchPts(:,2),branchPts(:,1),'rx');&#xA;hold on; plot(endPts(:,2),endPts(:,1),'*');&#xA;% Labeling the Branches&#xA;branches = imsubtract(y,mn); % set branch points to zero&#xA;figure; imshow(branches);title('no bp')&#xA;branchesLabeled = bwlabel( branches); % label connected components&#xA;vislabels(branchesLabeled);&#xA;% Calculation of Length of Branches and Circular Neighbourhood Method for&#xA;% for detection of normal and abnormal branches.&#xA;sts = regionprops( branchesLabeled,'Area', 'Perimeter','MajorAxisLength','Centroid' );&#xA;figure&#xA;imshow(branchesLabeled)&#xA;hold on&#xA;% Loop for circles&#xA;for i=1:size(sts)&#xA;r= sts(i).MajorAxisLength/2 ; %desired radius&#xA;centerx = sts(i).Centroid(1);  &#xA;centery = sts(i).Centroid(2);&#xA;th = 0:pi/50:2*pi;&#xA;xunit = r * cos(th) + centerx;&#xA;yunit = r * sin(th) + centery;&#xA;plot(xunit, yunit);&#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3667" OwnerDisplayName="user1984451" LastEditorUserId="5886" LastEditDate="2014-02-04T16:34:54.257" LastActivityDate="2024-04-02T13:04:15.653" Title="Find branches in skeleton image using matlab" Tags="|image-processing|matlab|morphological-operations|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7623" PostTypeId="1" AcceptedAnswerId="7625" CreationDate="2013-01-24T16:30:51.637" Score="3" ViewCount="290" Body="&lt;p&gt;my question is quite straight-forward to be grasped and handled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an 1D array, &lt;code&gt;F_11&lt;/code&gt; representing a target power spectrum. It is sketched in the following figure&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Smrk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I start generating a time series &lt;code&gt;u&lt;/code&gt; which embodies the properties of &lt;code&gt;F_11&lt;/code&gt;, as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nn = complex(normrnd(0,1,[1,1000]),normrnd(0,1,[1,1000]));&#xA;u = abs(fftn(fftshift(F_11.*nn)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, just to check that u does actually reproduce a spectrum as &lt;code&gt;F_11&lt;/code&gt;, I try going backwards as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ps =  abs(ifftn(ifftshift(u)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, when plotting &lt;code&gt;ps&lt;/code&gt;, it does not exactly match &lt;code&gt;F_11&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zfP1B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the high frequency area, &lt;code&gt;ps&lt;/code&gt; drifts upwards, which is quite weird.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would you mind to sketch the flaw in my procedure?&lt;/p&gt;&#xA;" OwnerUserId="3666" OwnerDisplayName="fpe" LastActivityDate="2013-01-24T18:47:08.810" Title="check power spectrum" Tags="|matlab|fft|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7624" PostTypeId="1" AcceptedAnswerId="7632" CreationDate="2013-01-24T16:58:07.950" Score="2" ViewCount="3127" Body="&lt;p&gt;I have to design 2 IIR bandpass filter with the following specifications:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling frequency 1000 Hz&#xA;Pass-band 50 Hz to 200 Hz&#xA;Order 6&#xA;using bilinear transform and impulse invariance with Butterworth prototype analogue filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused, because the two methods I've got for producing the filters have different results. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 1000;&#xA;fNq = fs/2;&#xA;f1 = 50/fNq;&#xA;f2 = 200/fNq;&#xA;[z,p,k] = buttap(6);&#xA;[A,B,C,D] = zp2ss(z,p,k);&#xA;[zd,pd,kd] = bilinear(z,p,k,fs);&#xA;Bw = f2-f1;&#xA;Wo = sqrt(f1*f2);&#xA;[At,Bt,Ct,Dt] = lp2bp(A,B,C,D,Wo,Bw);&#xA;[b,a] = ss2tf(At,Bt,Ct,Dt);&#xA;&#xA;[Ad,Bd,Cd,Dd] = bilinear(At,Bt,Ct,Dt,fs);&#xA;[bz, az] = ss2tf(Ad,Bd,Cd,Dd);&#xA;fvtool(bz,az);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I think that) The above code creates an analogue prototype, transforms to a state-space form, applies the bilinear transform, transforms the low-pass filter to a band-pass filter, transforms to a transfer function and the plots it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that it is noticably different to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[num,den] = butter(6, [f1, f2], 's');&#xA;[B,A] = bilinear(num, den, fs);&#xA;fvtool(B, A);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have similar problems with the impulse invariance method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please give me a hint as to what I'm doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2016-10-04T10:21:01.433" Title="IIR filter design in matlab" Tags="|filter-design|homework|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7625" PostTypeId="2" ParentId="7623" CreationDate="2013-01-24T17:02:34.443" Score="5" Body="&lt;p&gt;Your &lt;code&gt;u&lt;/code&gt; variable is just the magnitude of the FFT, not the actual complex numbers that represent the FFT. Try removing the &lt;code&gt;abs()&lt;/code&gt; from &lt;code&gt;u&lt;/code&gt; and then doing the IFFT.&lt;/p&gt;&#xA;" OwnerUserId="3668" LastActivityDate="2013-01-24T17:02:34.443" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7626" PostTypeId="1" AcceptedAnswerId="7628" CreationDate="2013-01-24T17:04:59.967" Score="9" ViewCount="5934" Body="&lt;p&gt;My understanding of the scalogram is that, for a particular row, the scores of the projection of the input signal with the wavelet at a particular displacement is shown. Across rows, the same thing applies, but for dilated version of the wavelet. I thought that scalograms can be defined for all types of wavelet transforms, that is, for the:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Continuous wavelet transform&lt;/li&gt;&#xA;&lt;li&gt;Discrete wavelet transform&lt;/li&gt;&#xA;&lt;li&gt;Redundant wavelet transform&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However upon further investigation is seems that the scalogram is only definable for the CWT. Based on this I have multiple inter-related questions that google has not sufficed for ATM. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it true that the scalogram is not defined for the DWT or RWT? If so, why not?&lt;/li&gt;&#xA;&lt;li&gt;Let us say an $N$ length signal has a 10-level decomposition by using DWT. If all levels are plotted as an image, (that is, a $10xN$ image), what is this image called?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As an example of a DWT 'scalogram', here is one for AWGN:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OidO5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Concerning the same signal, suppose we instead plot the approximation MRA of the signal at all levels. (So again, a $10xN$) image. What is this image called in proper terminology?&#xA;For example, here I have shown approximation MRAs and detail MRAs for AWGN. (Clearly they are not the same as 'scalogram' of DWT).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eGq3h.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qX6tN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2013-01-24T21:08:17.083" LastActivityDate="2015-06-08T21:09:10.180" Title="Scalogram (and related nomenclatures) for DWT?" Tags="|discrete-signals|frequency-spectrum|wavelet|terminology|scale-space|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7627" PostTypeId="2" ParentId="7623" CreationDate="2013-01-24T18:47:08.810" Score="0" Body="&lt;p&gt;Can you first generate white noise and then filter it with the power spectrum that you desire? You can generate white Gaussian noise using &lt;code&gt;wgn&lt;/code&gt;&lt;a href=&quot;http://www.mathworks.com/help/comm/ref/wgn.html&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3670" LastActivityDate="2013-01-24T18:47:08.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7628" PostTypeId="2" ParentId="7626" CreationDate="2013-01-24T18:49:59.457" Score="9" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Continuous wavelet transform is suitable for a scalogram because the analysis window can be sized and placed at any position.  This flexibility allows for the generation of a smooth image in both the time in scale (analogous to frequency) directions.  The continuous wavelet transform is a redundant transform because the analysis window can overlap.  In fact the CWT is considered infinitely redundant.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Discrete wavelet transform is a non-redundant transform.  It was developed so there would be a one to one correspondence between the information in the signal domain and the transform domain.  This tight correspondence makes the DWT more suitable for use in signal reconstruction.  The analysis windows are fixed in both the time and scale directions, so if you plot the resulting DWT coefficients you will end up with a grid of boxes that start out large at one end of the scale axis and end up small at the other end.  This representation isn't very satisfying for visual analysis of a signal.  It certainly can be done, but I haven't seen anyone bother to do it.  The plot is also referred to as a scalogram.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Redundant Wavelet Transform:  I had no previous experience with this, but thanks to comments from the OP, I found that the RWT or Stationary Wavelet Transform (SWT) is a discrete wavelet transform that has redundancy introduced to make the transform translation invariant.  Furthermore, I found a reference that does a nice comparison of transform types as they apply to speech analysis.  In this article, the transform results are all plotted and for any case of wavelet transform, the plots are all referred to as scalograms (this includes the DWT and a version of RWT).  You can see how the various transform types present themselfs visually in the article.  For reference, here is a link to the article:  &lt;a href=&quot;http://www.math.purdue.edu/~lipeijun/paper/2005/End_Gen_Li_Fra_Sch_JASA_2005.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://www.math.purdue.edu/~lipeijun/paper/2005/End_Gen_Li_Fra_Sch_JASA_2005.pdf&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;MRA - My encounter with this term is in association with multiresolution analysis.  This applies to all wavelet transform types, but usually is discussed in the context of the DWT and its realization as a set of filter banks.  In this context the result of a MRA is the same as the result of a DWT and the plot of such results (a plot of a set of numbers) would still be a scalogram.  Here is another paper that discusses MRA: &lt;a href=&quot;http://alexandria.tue.nl/repository/books/612762.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://alexandria.tue.nl/repository/books/612762.pdf&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is an example of CWT and DFT Scalograms:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/jg0T8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-02-09T19:47:27.293" LastActivityDate="2013-02-09T19:47:27.293" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7630" PostTypeId="1" AcceptedAnswerId="7637" CreationDate="2013-01-25T09:11:08.453" Score="2" ViewCount="3751" Body="&lt;p&gt;If I have a average normalized power spectrum of noise is like this&#xA;$W(f)=N_0$ while frequency is $-B$ to $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the average normalized power is $1/4 N_0 (2B)$ insteat of $N_0 (2B)$?&lt;/p&gt;&#xA;" OwnerUserId="3420" LastActivityDate="2013-01-25T21:12:21.847" Title="A very fundamental question about average normalized power of noise" Tags="|noise|" AnswerCount="1" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="7631" PostTypeId="1" CreationDate="2013-01-25T09:43:14.683" Score="5" ViewCount="425" Body="&lt;p&gt;Suppose my model is reversible in time (e.g. GPS + accelerometers for a vehicle), so that I can run Kalman filter forwards or backwards. Kalman filter, of course, cannot be symmetric, because it is not casual. But will &lt;strong&gt;Kalman smoother&lt;/strong&gt; give the same results when run forwards and backwards (up to numeric errors)? If no, is there a filter that does guarantee this?&lt;/p&gt;&#xA;" OwnerUserId="3673" LastEditorUserId="3673" LastEditDate="2013-01-25T13:53:39.980" LastActivityDate="2013-04-26T21:06:52.350" Title="Is Kalman smoother symmetric in time?" Tags="|discrete-signals|kalman-filters|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7632" PostTypeId="2" ParentId="7624" CreationDate="2013-01-25T11:49:29.677" Score="4" Body="&lt;p&gt;The issue is resolved: the butter() function automatically does bilinear transform, you just need to specify the frequencies normalised to the Nyqyist freq. &lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-01-25T11:49:29.677" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7636" PostTypeId="1" AcceptedAnswerId="19439" CreationDate="2013-01-25T20:03:34.827" Score="5" ViewCount="1030" Body="&lt;p&gt;I need to draw waveforms for biometric data like ECG and EEG signals. When I have more samples than pixels at the X-axis, I need to draw a vertical line between the MIN and MAX sample-value for that period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I was wondering, suppose the signal is highly volatile, and the MAX for the next point is lower than the MIN from the previous point, there will be a 'gap' in the waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct way to connect these points? When drawn using standard polyline routines the pen will draw from the last position (MAX) to the start of the new line (MIN), which is a much larger distance, causing the signal look thicker than it would be if I just connected the previous MIN to the new MAX (if the trend is downwards), or the previous MAX to the new MIN (if the trend is upwards).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a standardized way to do this, or is it just a matter of taste?&lt;/p&gt;&#xA;" OwnerUserId="3679" LastActivityDate="2014-12-03T18:21:48.810" Title="Correct method for drawing waveforms" Tags="|continuous-signals|eeg|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7637" PostTypeId="2" ParentId="7630" CreationDate="2013-01-25T21:12:21.847" Score="5" Body="&lt;p&gt;If a filter with transfer function $H(f)$ has a noise process as input, then&#xA;the output noise power $P_{\scriptstyle{\text{out}}}$ is given by&#xA;$$P_{\scriptstyle{\text{out}}} = &#xA;\int_{-\infty}^\infty |H(f)|^2 S_x(f)\,\mathrm df&#xA;$$&#xA;where $S_x(f)$ is the power spectral density of the input noise process.&#xA;If the input process is modeled as a &lt;em&gt;white noise process&lt;/em&gt;, then $S_x(f)$&#xA;is a &lt;em&gt;constant&lt;/em&gt;, call it $K$ for now, and so we have that&#xA;$$P_{\scriptstyle{\text{out}}} = K&#xA;\int_{-\infty}^\infty |H(f)|^2\,\mathrm df&#xA;$$&#xA;For an ideal low-pass filter with &lt;strong&gt;cutoff frequency&lt;/strong&gt; $B$ Hz,&#xA;$$ H_{\scriptstyle{\text{lowpass}}}(f)&#xA;= \begin{cases} 1, &amp;amp;-B \leq f \leq B,\\&#xA;0, &amp;amp; |f| &amp;gt; B,\end{cases}$$&#xA;we have $P_{\scriptstyle{\text{out}}} = 2KB$. More generally,&#xA;for an arbitrary linear time-invariant system with maximum&#xA;passband gain equal to $1$, the &lt;em&gt;noise-equivalent&lt;/em&gt; bandwidth of the system&#xA;is &lt;em&gt;defined&lt;/em&gt; as&#xA;$$B_{\scriptstyle{\text{ne}}} = \frac{1}{2}\int_{-\infty}^\infty |H(f)|^2\,\mathrm df$$&#xA;and so we get $P_{\scriptstyle{\text{out}}} = 2KB_{\scriptstyle{\text{ne}}}$.&#xA;Put another way, the noise-equivalent bandwidth of an ideal LPF with&#xA;cutoff $B$ Hz is just $B$ Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is &lt;em&gt;conventional&lt;/em&gt; in the engineering literature to write $N_0/2$ instead&#xA;of $K$ because then the output noise power expression becomes&#xA;$N_0B_{\scriptstyle{\text{ne}}}$. The &lt;em&gt;constant of proportionality&lt;/em&gt;&#xA;$N_0$, measured in watts/Hz as Jason R pointed out, is convenient&#xA;for use in ordinary language when conversing with other engineers.&#xA;If we have a filter with noise&#xA;equivalent bandwidth $B_{\scriptstyle{\text{ne}}}$, and&#xA;the thermal noise power at the input of the filter  is $N_0$ watts/Hz,&#xA;then the output noise power is $N_0B_{\scriptstyle{\text{ne}}}$.&#xA;That's the way people talk during discussions. &lt;strong&gt;Nobody&lt;/strong&gt; will say that an ideal&#xA;lowpass filter with cutoff $B$ Hz has &quot;bandwidth&quot; $2B$ even though&#xA;the transfer function has value $1$ for $f \in [-B,B]$ and thus&#xA;the &lt;em&gt;support&lt;/em&gt; of $H_{\scriptstyle{\text{lowpass}}}(f)$ has length&#xA;$2B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning to your question, it is &lt;em&gt;not&lt;/em&gt; a good idea to write $W(f) = N_0$&#xA;for $f \in [-B,B]$, but if the paper you are reading &lt;em&gt;does&lt;/em&gt; insist on this notation,&#xA;then the output power is $N_0(2B)$. If the paper says that it is&#xA;$\frac{1}{4}N_0(2B)$, then it is mistaken. Another possibility is &#xA;that there are other conditions that are mentioned in the paper that&#xA;make $\frac{1}{4}N_0(2B)$ the correct answer, but you&#xA;have &lt;em&gt;not&lt;/em&gt; included these conditions in your question. For example,&#xA;if the passband gain of the ideal LPF is $\frac{1}{2}$, then&#xA;the expression $\frac{1}{4}N_0(2B)$ for the output power&#xA;is perfectly correct.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-01-25T21:12:21.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7640" PostTypeId="1" CreationDate="2013-01-26T02:32:21.660" Score="1" ViewCount="157" Body="&lt;p&gt;I want to do one of these common experiments to see the effect of increased noise on the performance of a feature detector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this add zero mean gaussian noise with fixed sigma to the image and look at the result. To vary the amount of noise I multiply the noise signal by different amounts before adding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the detector uses a bandpass filter as a first step, to calculate the SNR of the noisy image I calculate the energy of the bandpassed original image, and the energy of the band passed noise signal (before adding them together).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this sound reasonable (and is that method of adding noise correct)? My concern is that because the image is being bandpassed, if I evaluate the performance of the detector at a specific point I should be using an SNR value for that local area, rather than the whole image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would one go about calculating local signal to noise ratio?&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-01-26T02:32:21.660" Title="Local signal-to-noise ratio for an image" Tags="|image-processing|filters|noise|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7641" PostTypeId="2" ParentId="1335" CreationDate="2013-01-26T03:25:13.710" Score="5" Body="&lt;p&gt;A whole chapter of a book can be written to answer the &quot;Why&quot; in this question but the&#xA;short answer is that if the signals used are an &lt;em&gt;antipodal&lt;/em&gt; signal set (meaning &#xA;bits $0$ and $1$ are transmitted using signals $s_0(t)$ and $s_1(t)$ respectively&#xA;where $s_1(t) = -s_0(t)$ and the signals are of duration $T$ and energy $E$,&#xA;then with &lt;em&gt;matched filtering&lt;/em&gt;, the receiver makes a decision that $0$ was transmitted&#xA;or a $1$ was transmitted according as the &lt;em&gt;sample value&lt;/em&gt; from the matched filter&#xA;is positive or negative.  The sample value is a random variable $X$ whose&#xA;distribution is $\mathcal N\left(\pm \sqrt{E}, N_0/2\right)$ depending on whether&#xA;a $0$ or a $1$ was transmitted. If $X$ has mean $-\sqrt{E}$ when a $1$ is transmitted,&#xA;then the probability of error is&#xA;$$\begin{align*}&#xA;P_{e,1} &amp;amp;= P\{X &amp;gt; 0 \mid 1~\text{transmitted}\}\\&#xA;&amp;amp;= P\left\{\mathcal N\left(-\sqrt{E}, N_0/2\right) &amp;gt; 0\right\}\\&#xA;&amp;amp;= Q\left(\frac{0 - \left(-\sqrt{E}\right)}{\sqrt{N_0/2}}\right)\\&#xA;&amp;amp;= Q\left(\sqrt{\frac{2E}{N_0}}\right).&#xA;\end{align*}$$&#xA;Similarly, $X$ has mean $\sqrt{E}$ when a $0$ is transmitted,&#xA;and so the probability of error is&#xA;$$\begin{align*}&#xA;P_{e,0} &amp;amp;= P\{X &amp;lt; 0 \mid 0~\text{transmitted}\}\\&#xA;&amp;amp;= P\left\{\mathcal N\left(\sqrt{E}, N_0/2\right) &amp;lt; 0\right\}\\&#xA;&amp;amp;= \Phi\left(\frac{0 -\sqrt{E}}{\sqrt{N_0/2}}\right)\\&#xA;&amp;amp;= \Phi\left(-\sqrt{\frac{2E}{N_0}}\right)\\&#xA;&amp;amp;= Q\left(\sqrt{\frac{2E}{N_0}}\right).&#xA;\end{align*}$$&#xA;Finally, using the law of total probability, the probability of error is&#xA;$$P_e = P_{e,0}P\{0~\text{transmitted}\}&#xA;+ P_{e,1}P\{1~\text{transmitted}\} = Q\left(\sqrt{\frac{2E}{N_0}}\right)$$&#xA;regardless of the probabilities of transmitting $0$'s and $1$'s.&#xA;For more details such as &lt;em&gt;why&lt;/em&gt; the matched filters outputs&#xA;are as stated above, see, for example, &lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture03.pdf&quot; rel=&quot;nofollow&quot;&gt;this lecture &#xA;note&lt;/a&gt; and &#xA;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture04.pdf&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;&#xA;of mine.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-01-26T14:31:52.567" LastActivityDate="2013-01-26T14:31:52.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7643" PostTypeId="1" CreationDate="2013-01-26T07:29:40.040" Score="1" ViewCount="164" Body="&lt;p&gt;There is a Matlab-based package called Chebfun that (among other things) computes polynomial approximations of functions. See here: &lt;a href=&quot;http://www2.maths.ox.ac.uk/chebfun/&quot; rel=&quot;nofollow&quot;&gt;http://www2.maths.ox.ac.uk/chebfun/&lt;/a&gt;.&#xA;I don't know anything about signal processing, but it appears that this sort of approximation process is the foundation of some kinds of filter design. Apparently, the &quot;Parks-McClellan&quot; algorithm is the one typically used for this purpose. The PM algorithm just looks like a form of Remez algorithm, and the Chebfun code claims to be a &quot;modern&quot; version of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, has anyone tried to use Chebfun in place of the older Remez or PM codes?&#xA;If so, do you find that it's any better?&lt;/p&gt;&#xA;" OwnerUserId="3684" LastActivityDate="2013-01-26T07:29:40.040" Title="Chebfun versus Parks-McClellan" Tags="|filter-design|parks-mclellan|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7644" PostTypeId="1" CreationDate="2013-01-26T07:35:40.520" Score="3" ViewCount="1617" Body="&lt;p&gt;I want to use morphology operator for filling holes of a 3d image. The 3d image consists of 116 2-D image slices of the same size (512*512 pixels). I tried using imfill in Matlab for the 3d image but the result is not I want. One of the slices of the 3d input image(a) and the corresponding slice from the 3d output image(b) result of using imfill  is shown here . The small holes are filled and other holes are not filled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I tried using imfill slice by slice the result is correct. Is there any way for filling holes in 3d images? How can I do this? &lt;/p&gt;&#xA;" OwnerUserId="3685" LastEditorUserId="53" LastEditDate="2013-09-12T21:26:50.683" LastActivityDate="2014-07-01T06:31:33.853" Title="filling holes of a 3D image in Matlab" Tags="|matlab|3d|morphology|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7645" PostTypeId="1" CreationDate="2013-01-26T10:59:36.100" Score="1" ViewCount="159" Body="&lt;p&gt;Please bear with me, I know some of you will scoff but I have looked on Wiki and in various literature (see below) and can't quite get a handle on a few things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a general business programmer, in so much as I very rarely perform any &lt;em&gt;complicated&lt;/em&gt; maths/physics related programming.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, whilst at Uni and studying Computer Networks I was introduced to Fourier analysis down at the physical level. I had trouble understanding the actual application of the analysis (as described in A Tannenbaum's  Computer Networks) he just throws in some equations and asserts that they are used to approximate a signal modulated to carry data.  I could also never understand the relationship between harmonics and the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, in summary, is this analysis used to pick up from a physical medium, ie re-construct, retrieve the data initially sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &lt;/p&gt;&#xA;" OwnerUserId="3687" LastActivityDate="2013-01-26T10:59:36.100" Title="A Laymans Fourier transform and harmonics explanation?" Tags="|demodulation|fourier-series|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7647" PostTypeId="2" ParentId="7631" CreationDate="2013-01-26T20:24:02.840" Score="2" Body="&lt;p&gt;Running Kalman smoother &lt;strong&gt;is not same thing&lt;/strong&gt; with running Kalman filter backwards in time. They are different. In particular, RTS smoother does not take care of observations, it uses filtered estimates. Kalman filter is an online estimation algorithm and estimates the filtering distribution $p(x_t | y_{1:t})$, i.e., the posterior distribution over the hidden states given the observations up to time $t$. However, smoothing recursions give the posterior of the states given the whole observations: $p(x_t | y_{1:T})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if your observations are reversible in time (if that is what you imply by saying 'symmetric'), in that case whenever you process the filtering algorithm, the smoother will work backwards and since filtered estimates are incomplete and does not know future observations, they will typically be different.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastActivityDate="2013-01-26T20:24:02.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7648" PostTypeId="1" AcceptedAnswerId="7649" CreationDate="2013-01-27T09:16:35.243" Score="1" ViewCount="216" Body="&lt;p&gt;I'm generating an 18kHz sine signal using a dsPIC microcontroller at 44100kHz (I'm not sure I can call it sampling rate, maybe generation rate, although the concept is the same). &#xA;The dsPIC's DAC then feeds an LM386 amplifier and then an 8-ohm speaker.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the generation method is digital, I get harmonics (36kHz) which get aliased, and I hear the parasitic low frequency (8.1kHz) which is something I wish to get rid off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was told that I should put an LPF with a sharp cutoff just above 18kHz at the output of the microcontroller so that those high frequency harmonics don't get amplified, but my intuition tells me that I should put an HPF, since by the time the signal is out of the microcontroller &lt;strong&gt;it already contains those low frequencies&lt;/strong&gt; and an LPF will not help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct?&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3514" LastActivityDate="2013-01-29T15:11:30.367" Title="reduce harmonics produced by microcontroller" Tags="|filters|sampling|aliasing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7649" PostTypeId="2" ParentId="7648" CreationDate="2013-01-27T09:33:29.263" Score="1" Body="&lt;p&gt;No, you need a &lt;a href=&quot;http://en.wikipedia.org/wiki/Low-pass_filter&quot; rel=&quot;nofollow&quot;&gt;low pass filter&lt;/a&gt; &lt;em&gt;aka&lt;/em&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Reconstruction_filter&quot; rel=&quot;nofollow&quot;&gt;reconstruction filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the general case your filter needs to reject everything at or above Nyquist = Fs/2 = 22.05 kHz. Typically it might have have a roll-off from say -3 dB at 20kHz to -80 dB at 22 kHz. This would be quite a demanding filter to implement with analogue components however, so if you are really only interested in generating a single tone at 18 kHz then you can use a less aggressive LPF which has a -3 dB point at say 20 kHz and a stop-band which begins at 35 kHz.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2013-01-29T15:11:30.367" LastActivityDate="2013-01-29T15:11:30.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7650" PostTypeId="1" CreationDate="2013-01-27T10:01:49.707" Score="7" ViewCount="392" Body="&lt;p&gt;So, I've just begun a speech and language processing course and have found the explanation of the process of getting the cepstrum of a signal and its properties a little confusing. The following is a description of my current understanding and an explanation of confusion it's causing me:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;start with the speech signal. we can think of it as the formant signal convolved with a the excitation signal which is a dirac comb (approximately).&lt;/li&gt;&#xA;&lt;li&gt;take the FFT, giving the spectrum of the excitations multiplied with the spectrum of the formants. the FFT of the excitation signal is another dirac comb with period 1/T&lt;/li&gt;&#xA;&lt;li&gt;take logs. so the 2 signals above are now added&lt;/li&gt;&#xA;&lt;li&gt;inverse fourier transform - the two signals from 1 should now be combined in addition (the FT transform is linear)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So if those 4 step are right, then why does the excitation appear at a particular region in the quefrency domain? it should emerge as a Dirac comb, added to the formant impulse response shouldn't it?&lt;/p&gt;&#xA;" OwnerUserId="3689" LastEditorUserId="3689" LastEditDate="2013-01-28T10:05:28.303" LastActivityDate="2013-09-25T13:30:39.857" Title="Why does the excitation signal appear, separated, at high quefrencies in the cepstrum?" Tags="|speech-recognition|speech|voice|cepstral-analysis|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7651" PostTypeId="1" CreationDate="2013-01-27T12:10:08.257" Score="5" ViewCount="464" Body="&lt;p&gt;I have mp3s of radio talk shows in which the host interviews people on the phone. The host uses a microphone, and the interviewee uses either a landline phone or a cell phone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to save just the telephone audio to a different file. Is that feasible?&lt;/p&gt;&#xA;" OwnerUserId="3691" LastActivityDate="2016-05-26T15:33:26.663" Title="how to extract telephone audio only from an mp3" Tags="|filters|audio|filter-design|mp3|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7652" PostTypeId="1" CreationDate="2013-01-27T15:47:34.187" Score="0" ViewCount="9458" Body="&lt;p&gt;I have been asked  to study an experiment which says &quot;what is the effect of variation of duty cycle of sampling frequency on  a reconstructed signal&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not an electronics/electrical engineer I am CS guy.This experiment probably is a part of Analog to Digital Converion techniques, by now I have been able to understand Nyquist theorem and reconstruction is based on this.But for above experiment I am not clear with what to do or study so far what ever I have googled has not given me fruitful results let me know if some one has an answer to above problem.Following is the link which I have studied and could follow &lt;a href=&quot;http://mhakhan.tripod.com/07sampling.pdf&quot; rel=&quot;nofollow&quot;&gt;http://mhakhan.tripod.com/07sampling.pdf&lt;/a&gt;  a bit for the above question,what is exactly the thing which I should search?&lt;/p&gt;&#xA;" OwnerUserId="3694" LastActivityDate="2013-01-28T12:46:59.750" Title="what is the effect of variation of duty cycle of sampling frequency on a reconstructed signal" Tags="|sampling|nyquist|reconstruction|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7654" PostTypeId="2" ParentId="7650" CreationDate="2013-01-27T16:33:26.343" Score="0" Body="&lt;p&gt;In the source-filter model of speech production, the filter (formants) is very smooth in the frequency domain - it is just a bunch of relatively large-band bumps. Hence, in the quefrency domain, its energy is mostly spread over a handful of the lower cepstrum coefficients.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-01-27T16:33:26.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7655" PostTypeId="2" ParentId="7603" CreationDate="2013-01-27T17:30:47.783" Score="5" Body="&lt;p&gt;It's an interesting problem.  What you have there is what's known as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Blind_deconvolution&quot; rel=&quot;noreferrer&quot;&gt;blind deconvolution&lt;/a&gt; problem.  These are well known &quot;hard&quot; problems, but not necessarily impossible.  Finding an algorithm to solve it relies on using some prior knowledge you have about the filter or the noise source driving it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's an ill-posed problem mathematically, so if there is a solution, there's no guarantee it's unique.  In other words you might get a set of FIR coefficients that seem to fit the data, but it's not guaranteed that they are the &quot;right&quot; coefficients that model the filter well in the real world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, I've tried using the &lt;a href=&quot;http://melodi.ee.washington.edu/people/bilmes/mypapers/em.pdf&quot; rel=&quot;noreferrer&quot;&gt;EM algorithm&lt;/a&gt; and got some promising results.  It's not perfect, but I think it's possible to get a solution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've changed the model slightly so that $$S = N*F + v$$where $v$ is Gaussian noise with some unknown variance.  If we find a good solution, this variance should end up being small compared to the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the EM algorithm you need some hidden variables: in this case, $N$, and some unknown parameters.  Those are $F$, $\sigma^2$ the unknown noise variance, and $p$ the probability of $N_i\in{0,1}$ being equal to one.  This is the prior distribution on $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick to it I found was to use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm#Alternative_description&quot; rel=&quot;noreferrer&quot;&gt;alternative description&lt;/a&gt; of the EM algorithm where the hidden variables are described by an approximating distribution $q$.  We want $q$ to approximate the posterior distribution given the observations and the parameters: $p(N|S,F,p,\sigma^2)$.  This almost certainly doesn't factorize as a product of probabilities $q(N_0)q(N_1)...q(N_n)$ so this is an approximation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case $q$ consists of $q_i$ for $i=0..n$ where $q_i$ is the probability that $N_i=1$ under this approximating distribution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The EM algorithm is an iterative one, where each iteration involves alternately updating $q$ based on the current value of the parameters, then updating the parameters based on the current value of $q$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't said anything about $m$ yet: it's unknown, but if we make it too big, the extra FIR coefficients should be set to near zero.  These might be at the start or the end, it just depends where the algorithm decides to converge to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I simulated some data of my own with the same pulse shape as in your synthetic example, with these results.  The true value of $m$ was 200, so I ran the EM algorithm with $m=400$ to see how it did.  I made $S$ 10000 samples long, to be sure I had enough data.  The result came out at about half the amplitude of the original, and as explained above there are some extra coefficients at the start and the end, but shifting and scaling to compensate you can see that it got the shape of the impulse response fairly accurately:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xg11W.png&quot; alt=&quot;simulated data, 1000 samples&quot;&gt;&#xA;Zooming in on the middle section:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/T6efI.png&quot; alt=&quot;simulated data, 1000 samples, around the peak impulse response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your file synthetic_data.txt I got something similar:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BeUxp.png&quot; alt=&quot;result estimated from synth_data.txt&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/08MYk.png&quot; alt=&quot;result from synth_data.txt, zoomed&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it stands it seems to be overestimating $p$ i.e. putting in too many impulses and underestimating the magnitude of the FIR coefficients to compensate.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now on test_data.txt, the algorithm gave this impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C6d9F.png&quot; alt=&quot;impulse response estimated from test_data.txt&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's harder to tell how well the algorithm has done this time because we don't know the true impulse response.  One thing we can do it try to reconstruct $S$ from our estimate $\hat F$ and some estimate of $N$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used $q_i$ to estimate $N_i$ by thresholding: if $q_i&amp;gt;0.5$ I put $\hat N_i=1$ as my estimate of $N_i$, otherwise I use $N_i = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolving that sequence $\hat N$ with $\hat F$ gave a decent match to $S$.  I've zoomed in on a typical short subsequence so you can see the detail:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/k6lFK.png&quot; alt=&quot;typical section of the reconstructed sequence&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One caveat I have is that the rate of impulses seem a bit high: about 10% of the reconstructed $\hat N_i$ samples were equal to $1$, which is more than your 1 in 20 to 40 estimate.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But overall I think that's doing well for a blind deconvolution problem, so I'd say it's doable with an EM algorithm or something similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are quite a few other algorithms for blind deconvolution, see the references, and one of the others might be better for you.  Variational Bayesian EM would be worth trying, and there are others which might have some advantages in other ways.  It always depends on how much prior knowledge you have, and on other constraints like runtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below works in Octave: I haven't tried it in Matlab (because I don't have a licence) but it should work in Matlab too.  Very much prototype code, don't rely on it for anything critical without some more work (sanity checking, catching potential divide-by-zeros etc.)  Runs in about 30 minutes on my two-year-old laptop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for uploading the example datasets, which was very useful.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [Fhat,q] = blindDeconvImpulseNoise(filename)&#xA;&#xA;% Load data from file&#xA;S = load(filename);&#xA;% Renormalize&#xA;scaleFac = sqrt(mean(S.^2));&#xA;S = S/scaleFac;&#xA;&#xA;% Estimate (assume filter has less than 400 taps)&#xA;tic();&#xA;[Fhat,q] = estimate(S,400);&#xA;toc();&#xA;&#xA;Fhat = Fhat * scaleFac;&#xA;&#xA;end&#xA;&#xA;&#xA;% Run the estimation: the EM algorithm&#xA;% (see ftp://ftp.cs.toronto.edu/pub/radford/emk.pdf)&#xA;function [Fhat,q] = estimate(S,m)&#xA;&#xA;L = length(S);&#xA;&#xA;% Initial values&#xA;q                      = ones(L+m-1,1)/2;&#xA;&#xA;% Fhat is the estimated filter.  &#xA;Fhat = zeros(m,1);&#xA;Fhat(max(1,floor(m/2))) = 1;&#xA;&#xA;% Initial values of the scalar parameters: noise variance and &#xA;sigmasq_hat = 1;&#xA;Rhat = 0.01;&#xA;&#xA;last_sig = inf;&#xA;&#xA;starttime = now;&#xA;timeout   = 1800;&#xA;&#xA;while 1&#xA;&#xA;  % Estimate hidden variables&#xA;  % Start by converting hidden states into &#xA;  Fmtx  = getConvmtx(Fhat,length(q));&#xA;  Fmtx  = Fmtx(m:end-m+1,:);&#xA;&#xA;  for i=1:length(q)&#xA;&#xA;    ind = max(1,i - m):min(i+m-1,size(Fmtx,1));&#xA;    ind2 = max(1,i - 2*m):min(i+2*m-1,size(Fmtx,2)); &#xA;    ind2 = ind2(ind2~=i);&#xA;    Fi = Fmtx(ind,i);&#xA;    resid_less_i = S(ind) - Fmtx(ind,ind2) * q(ind2);&#xA;    l = (Fi'*Fi - 2*Fi'*resid_less_i)/(2*sigmasq_hat) ...&#xA;        - log(Rhat) + log(1-Rhat);&#xA;&#xA;    q(i) = 1./(1+exp(l));&#xA;&#xA;  end&#xA;&#xA;  qmtx                  = getConvmtx(q,m);&#xA;  qmtx                  = qmtx(m:end-m+1,:);&#xA;&#xA;  % Estimate parameters&#xA;  Sigma                 = (qmtx'*qmtx) ;&#xA;  % Matrix diagonal&#xA;  Sigma(1:m+1:end)      = sum(qmtx);&#xA;  % Store common term Q'*S&#xA;  NS                    = (qmtx'*S);&#xA;  % Pseudoinverse estimate of Fhat&#xA;  Fhat                  = Sigma\NS;&#xA;  % Noise estimate, based on error residual&#xA;  sigmasq_hat           = (S'*S - NS'*Fhat)/length(S);&#xA;  % Pulse rate estimate&#xA;  Rhat                  = mean(q);&#xA;&#xA;  if abs(sigmasq_hat - last_sig) &amp;lt; 1e-10&#xA;     % No change on this iteration: stop here&#xA;     break&#xA;  end&#xA;  last_sig = sigmasq_hat;&#xA;&#xA;  if 24*60*60*(now - starttime) &amp;gt; timeout&#xA;     warning('Timeout!');&#xA;     break&#xA;  end&#xA;end&#xA;&#xA;end&#xA;&#xA;&#xA;function Nmtx = getConvmtx(N,m)&#xA;&#xA;Nmtx = zeros(length(N)+m-1,m);&#xA;&#xA;for idx=1:m&#xA;    Nmtx(idx:end-m+idx,idx) = N;&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3561" LastEditorUserId="3561" LastEditDate="2013-01-27T20:16:59.427" LastActivityDate="2013-01-27T20:16:59.427" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7656" PostTypeId="2" ParentId="7652" CreationDate="2013-01-27T18:03:51.660" Score="1" Body="&lt;p&gt;First establish the following convention:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$DutyCycle = \frac{SampleClockOnTime}{SampleClockPeriod}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following discussion,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$SampleClockOnTime = T_p$$&#xA;$$SampleClockPeriod = T_s$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can model the effects of $T_p$ on your recovered signal as a pulse amplitude modulation signal recovery problem.  The sample clock signal is a pulse with finite duty cycle.  The reconstruction signal starts by modulating the sample clock signal with the data values of your sampled signal.  Literally you can think of multiplying your samples values by a unit amplitude pulse (your sample clock) to create a physical time sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain, you end up with a reconstructed signal that has altered frequency characteristics (roll off at the high frequencies) that are a direct consequence of the sample clock pulse width (aka duty cycle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To complete the recovery of your signal, you will pass the modulated pulse signal through a low pass filter to obtain only the baseband components of the signal.  The resulting signal with have frequency magnitude characteristis of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|F'(f)| = |F(f)||\frac{T_psin(pifT_p)}{T_s*f*T_p}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where: &#xA;F'(f) is the recovered signal and&#xA;F(f) is the spectrum of the origianl sampled signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effects of the sample clock pulse width is represented by:&#xA;$$\frac{T_psin(pifT_p)}{T_s*f*T_p}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you plot this, you will see the amplitude rolls off as frequency approaches the sample clock frequency and the roll off is becomes more pronounced as $T_p$ increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look for more information on this by searching on the topic of &quot;Sample and Hold effect&quot;.  Most of the work I've seen on this topic is in the context of switched capacitor filters (which is how I was exposed to it).&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-01-28T12:46:59.750" LastActivityDate="2013-01-28T12:46:59.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7657" PostTypeId="1" CreationDate="2013-01-27T19:15:38.643" Score="0" ViewCount="122" Body="&lt;p&gt;I'd like to ask a theoretical question about power spectra.&#xA;In MATLAB, by means of a particular approach, I'm trying to generate a Gaussian variable which embodies a particular power spectrum.&#xA;The theoretical power spectrum has been calculated over an illimited range (&lt;code&gt;[-Inf,Inf]&lt;/code&gt;), whereas the simulated one is obtained only in a short wave number vector range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, theoretical power spectrum and simulated one look like in the figure below&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VX2VR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Red&lt;/code&gt; and &lt;code&gt;green&lt;/code&gt; plots represent the simulated spectrum for two different configuration; the &lt;code&gt;blue&lt;/code&gt; line stays for the theoretical spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to know if there is any easy way to recover the spectrum loss in the high frequency region, in order to force the simulated spectrum perfectly match the theoretical. I was thinking of a fairly easy filter working this way&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter = sqrt(S_th.^2./S_sim.^2);&#xA;&#xA;S_rec = filter.*S_sim;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you believe such a procedure is allowed and physically reasonable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there&lt;/p&gt;&#xA;" OwnerUserId="3666" LastActivityDate="2013-01-27T19:15:38.643" Title="Recover High Frequency Loss in a Simulated Power Spectrum" Tags="|matlab|filters|frequency-spectrum|power-spectral-density|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7659" PostTypeId="2" ParentId="7652" CreationDate="2013-01-27T21:52:48.200" Score="0" Body="&lt;p&gt;If the sampler is edge triggered, and the changing duty cycle affects the edge doing the triggering (leading or trailing), then there will be sampling jitter.  If the sampler is pulse gated (for example, some capacitor in a sample-and-hold circuit being (dis)charged by the input signal for most of the duration of the pulse), then a change in duty cycle that affects the center of the gating pulse can cause sampling jitter.  Sampling jitter can produce a similar effect to that of frequency modulation of the signal, with the modulator being the timing noise or variation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-01-27T21:52:48.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7660" PostTypeId="2" ParentId="7650" CreationDate="2013-01-27T22:06:33.320" Score="2" Body="&lt;p&gt;When using an FFT, an evenly spaced sequence of events in one domain usually produces a strong component in the other domain at a location related to the spacing of the events in the first domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A voiced speech signal usually includes a lot of harmonics which are evenly spaced in the frequency domain.  These evenly spaced events in the frequency domain will thus produce a component in the quefrency domain whose location is related to the spacing of the harmonics.  And the spacing of the harmonics in the frequency domain is related to the spacing of the exciter events in the time domain (the period of the fundamental).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-01-27T22:06:33.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7661" PostTypeId="2" ParentId="5992" CreationDate="2013-01-28T01:01:26.063" Score="3" Body="&lt;p&gt;It's only 'flipped' for pointwise computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Dilip explains what the convolution integral/summation represents, but to explain why one of the two input functions (often &lt;code&gt;h(t)&lt;/code&gt;) is flipped for computation purposes, consider a discrete-time system with input &lt;code&gt;x[n]&lt;/code&gt; and impulse response &lt;code&gt;h[n]&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;You could&lt;/em&gt; take your input function &lt;code&gt;x[n]&lt;/code&gt;, and for each non-zero* sample &lt;code&gt;x[n]&lt;/code&gt; calculate the scaled impulse response from sample &lt;code&gt;n&lt;/code&gt; and on until the time-shifted &lt;code&gt;h[n]&lt;/code&gt; dies down to zero (assuming a causal &lt;code&gt;h[n]&lt;/code&gt;).  This would involve no 'flipping' (or more accurately 'time-reversal') of either &lt;code&gt;x[n]&lt;/code&gt; or &lt;code&gt;h[n]&lt;/code&gt;.  However, at the end you would have to add/superimpose all these scaled+shifted 'echos' of the impulse response for each non-zero &lt;code&gt;x[n]&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Or&lt;/em&gt;, for convenience you could time-reverse one of the functions about the time origin (usually 0), making your computation {multiply, add, multiply, add, ...} instead of {multiply, multiply, ..., add, add, ...}.  This results in the same output signal because it will perform the exact same multiply and add operations.  For example, think about the output contribution from a non-zero input signal at time 0 &lt;code&gt;x[0]&lt;/code&gt;.  When &lt;code&gt;k&lt;/code&gt; = 0 for the equation $$\sum_{k=-\infty}^{\infty} x[k]h[n-k]$$ the impulse reponse &lt;code&gt;h[n]&lt;/code&gt; will only be time-reversed but not shifted, giving us the first sample response for &lt;code&gt;x[n]&lt;/code&gt;, which is &lt;code&gt;x[0]h[0]&lt;/code&gt;.  Then, incrementing &lt;code&gt;k&lt;/code&gt; by one will shift &lt;code&gt;h[n]&lt;/code&gt; to the right one time step, such that the time-reversed &lt;code&gt;h[n]&lt;/code&gt;s second entry (&lt;code&gt;h[1]&lt;/code&gt;) will now be laying on top of &lt;code&gt;x[0]&lt;/code&gt;, waiting to be multiplied.  This will yield the desired contribution &lt;code&gt;x[0]h[1]&lt;/code&gt; at time &lt;code&gt;n=1&lt;/code&gt;, just as would have been done in the previous method.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;*I say non-zero &lt;code&gt;x[n]&lt;/code&gt; because $$\forall x[n] = 0$$ the impulse response &lt;code&gt;h[n]&lt;/code&gt; is scaled to zero, thus contributing nothing to the final output &lt;code&gt;y[n]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3698" LastActivityDate="2013-01-28T01:01:26.063" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7662" PostTypeId="2" ParentId="7569" CreationDate="2013-01-28T02:44:14.157" Score="0" Body="&lt;p&gt;In addition to Emre's suggestions, I'll add my favorite textbook on the subject:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Character Recognition Systems by Cheriet, et al.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.goodreads.com/author/show/1112467.Mohamed_Cheriet&quot; rel=&quot;nofollow&quot;&gt;http://www.goodreads.com/author/show/1112467.Mohamed_Cheriet&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An earlier but still useful work is that of Bunke, but used copies can be very expensive (check www.addall.com) so you might want to find one in an engineering library.&#xA;&lt;a href=&quot;http://textbooks.findthelisting.com/l/2266645/Handbook-of-character-recognition-and-document-image-analysis-981022270X&quot; rel=&quot;nofollow&quot;&gt;http://textbooks.findthelisting.com/l/2266645/Handbook-of-character-recognition-and-document-image-analysis-981022270X&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Handwriting recognition is an extraordinarily difficult problem in the general case. It's necessary to distinguish between analysis of handwriting on the fly (&quot;online&quot;) and analysis/recognition of handwriting on paper or in a scanned image (&quot;offline&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try to write the most detailed specification you can about what it is you want to achieve, including the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;script &amp;amp; language (e.g. English, Hindi, traditional Chinese, Hangul,...)&lt;/li&gt;&#xA;&lt;li&gt;image acquisition method (e.g. scanned paper, smart phone picture,...)&lt;/li&gt;&#xA;&lt;li&gt;size of dictionary of symbols to be matched (10? 500? 7000?)&lt;/li&gt;&#xA;&lt;li&gt;OCR character database used to measure performance&lt;/li&gt;&#xA;&lt;li&gt;accuracy&lt;/li&gt;&#xA;&lt;li&gt;means to train new symbols - can the user do it?&lt;/li&gt;&#xA;&lt;li&gt;target platform (phone? desktop? custom device? multiple devices?)&lt;/li&gt;&#xA;&lt;li&gt;amount of time you want to spend on development&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This problem has tortured researchers for decades, and although great progress has been made on many fronts it's exceedingly difficult to do well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For OCR problems in particular I recommend spending a few days trying to design the best algorithm you can based only on what you already know. Implement the algorithm, test it, and struggle with it. Find out what doesn't work. Rewrite your specification, and then dig up a good textbook on OCR and read it cover to cover.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, read this book to learn more about how humans can read characters and recognize symbols:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading in the Brain by Stanislas Dehaene.&#xA;&lt;a href=&quot;http://www.unicog.org/biblio/Author/DEHAENE-S.html&quot; rel=&quot;nofollow&quot;&gt;http://www.unicog.org/biblio/Author/DEHAENE-S.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can define a very narrow scope for your recognition algorithm, set modest goals for accuracy, read up on standard methods, and then give the problem at least a few months then I'm sure you'll learn quite a bit.&lt;/p&gt;&#xA;" OwnerUserId="742" LastActivityDate="2013-01-28T02:44:14.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7663" PostTypeId="2" ParentId="6449" CreationDate="2013-01-28T02:56:41.500" Score="1" Body="&lt;p&gt;The book Digital Image Processing by Gonzalez and Woods provides a good introduction into standard techniques for automatic binarization. The Otsu technique is a popular one, and it's good practice to implement it on your own at least once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.imageprocessingplace.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.imageprocessingplace.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But above all: give it a try! Look at a histogram of grayscale values in your image and then ask yourself whether the distribution of grayscale values immediately suggests a technique. Even if you're not sure how to work with the histogram, you might have an idea of the solution that you'd like to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not easy to learn image processing just from online sources in bits and pieces. If you plan to work in image processing, and if you can afford it, try to have your own copy of at least one image processing book for reference. The Gonzalez and Woods textbook is a good standard reference, and is used in a number of undergraduate courses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the OpenCV library, buy the O'Reilly book, read forum posts and questions about OpenCV, etc., but in my opinion the Gonzalez and Woods book will ease you into the subject more gracefully.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As always, if you are trying to solve a problem related to a specific image, please post the image. People who work in image processing for a living can often tell you a lot based just on an image; otherwise it can be difficult to provide more specific advice than just &quot;read this chapter.&quot; A binarization technique that works well for one set of images can perform poorly for another set of images.&lt;/p&gt;&#xA;" OwnerUserId="742" LastEditorUserId="2082" LastEditDate="2013-02-27T12:25:43.467" LastActivityDate="2013-02-27T12:25:43.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7666" PostTypeId="1" CreationDate="2013-01-28T10:01:27.747" Score="2" ViewCount="1519" Body="&lt;p&gt;I'm on histogram equalization process. I have quite well understood the math but i don't understand why an histogram on bimodal image fails in image enhancement and what techniques can be used in this case (some kind of local/adaptive histogram?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pv76s.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VQygg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="80" LastEditDate="2015-02-23T02:13:30.917" LastActivityDate="2015-03-25T09:07:06.737" Title="Why histogram equalization fail in enhance images for bimodal histogram?" Tags="|image-processing|equalization|histogram|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7667" PostTypeId="1" AcceptedAnswerId="7670" CreationDate="2013-01-28T10:36:57.067" Score="5" ViewCount="2669" Body="&lt;p&gt;I'm attempting to code Pisarenko's method for some time-series data that I have. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had a look at a couple of papers, which explain in detail the theory behind it, but I'm having some trouble figuring out how to convert the math into an algorithm for either C or Python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any information on how one can do that? A pseudocode algorithm, or some hints on which direction to start etc?&lt;/p&gt;&#xA;" OwnerUserId="3183" LastActivityDate="2022-06-06T11:34:43.083" Title="Pisarenko Harmonic Decomposition" Tags="|frequency-spectrum|algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7668" PostTypeId="1" AcceptedAnswerId="7676" CreationDate="2013-01-28T11:21:41.180" Score="2" ViewCount="344" Body="&lt;p&gt;I am implementing a digital image correlation algorithm, and I found that for some calculations the variance of the image noise would be very interesting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I determine that parameter? The only thing I have are a set of 1000 images of a metal deformation process and no prior information about the noise in the image.&lt;/p&gt;&#xA;" OwnerUserId="3701" LastEditorUserId="76" LastEditDate="2013-01-29T09:02:33.890" LastActivityDate="2013-01-29T09:06:36.363" Title="Obtaining the variance of the image noise" Tags="|image-processing|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7669" PostTypeId="1" CreationDate="2013-01-28T14:42:59.953" Score="4" ViewCount="473" Body="&lt;p&gt;What papers/articles/books are considered good for getting started with wavelets' application to cryptography? I'm primarily interested in irregular grid wavelets, but regular grid will do for starters. What I'm definitely not interested at is steganography.&lt;/p&gt;&#xA;&lt;p&gt;I'm posting this question here instead of &lt;a href=&quot;https://cs.stackexchange.com/&quot;&gt;Computer Science&lt;/a&gt; or &lt;a href=&quot;https://crypto.stackexchange.com/&quot;&gt;Cryptography&lt;/a&gt; because them people &lt;a href=&quot;https://crypto.stackexchange.com/search?q=wavelets&quot;&gt;don't really talk&lt;/a&gt; about &lt;a href=&quot;https://cs.stackexchange.com/search?q=wavelet&quot;&gt;wavelets&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A (not nearly full) list of things I've taken a look at or stumbled upon:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fekri, Delgosha &amp;quot;Finite-field Wavelets with Applications in Cryptography and Coding&amp;quot; - don't have the actual book. Should I obtain it or just google its &lt;a href=&quot;http://www.ablongman.com/preface/0130600202.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;table of contents&lt;/a&gt; apart?&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/1021333&quot; rel=&quot;nofollow noreferrer&quot;&gt;Luo, &amp;quot;A novel symmetric cryptography based on the hybrid Haar wavelets encoder and chaotic masking scheme&amp;quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/1337276&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chan, &amp;quot;A block cipher cryptosystem usig wavelet transforms over finite fields&amp;quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.google.com/file/d/1aivQ8EXK-I7RsO0OiWOS_bORn8MswX_0BBk41OGQP2wNMtt5jFpNzt9o6agc/edit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kumar, Chokhandre, Mishra &amp;quot;Discrete wavelet transform based signal stegnography &amp;amp; encryption&amp;quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.google.com/file/d/1DaSIjATpNsPdPpDdawqK4xYNXOAyHo4sucAnNRoYE-q04j_unxeydmIbcKOK/edit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Manikandan, Kamarasan, Sairam, &amp;quot;A New Approach for Secure Data Transfer based on Wavelet Transform&amp;quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;(Basically I was searching on google and google scholar for various combinations of &amp;quot;cryptography&amp;quot;, &amp;quot;wavelets&amp;quot;, &amp;quot;DWT&amp;quot;, etc)&lt;/p&gt;&#xA;" OwnerUserId="3601" LastEditorUserId="7092" LastEditDate="2022-04-21T12:23:03.043" LastActivityDate="2022-04-21T12:23:03.043" Title="Wavelets and cryptography" Tags="|wavelet|" AnswerCount="0" CommentCount="3" ClosedDate="2013-10-26T06:10:38.850" ContentLicense="CC BY-SA 4.0" />
  <row Id="7670" PostTypeId="2" ParentId="7667" CreationDate="2013-01-28T15:02:35.493" Score="4" Body="&lt;p&gt;UPDATE: On choosing the size of $R_{xx}$: If you suspect there are $M$ sources, then you need your autocorrelation matrix ($R_{xx}$) to be made up of M+1 unique (i.e. non-overlapping) snapshots.  For this reason, the snapshots technically have to be less than len(x) / M+1.  Estimating $R_{xx}$ is not trivial, and there are some pitfalls for certain signals and certain selections of N (size of autocorr matrix) if the segments or slices are non-overlapping.  This is why I typically use as many segments of x as possible when estimating $R_{xx}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you need an autocorrelation matrix.  One of the more fool-proof ways to do that, is to add up successive outer products of &quot;slices&quot; of the input vector where a slice is x[idx:idx+N].&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# x contains input vector , usually a time-series&#xA;N = 20 # length of one side of the square autocorr matrix&#xA;Rxx = NxN matrix of zeros&#xA;foreach unique slice of x of length N:&#xA;    s = unique slice&#xA;    Rxx += outer product of (s,s) #outer(s,s) in Numpy&#xA;Rxx /= nsnap # divide by number of snapshots that Rxx is composed of&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Second, calculate the eigenweights and eigenvectors of $R_{xx}$.  Save the &quot;minimum&quot; eigenvector. The minimum valued eigenweight and minimum eigenvector should correspond to the subspace of the noise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w,v = eig(Rxx)&#xA;vmin = v[:,abs(w).argmin()]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At this point, you have $v_{min}$ and $e^H$ is simply &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;eh = exp( 1j*omega*arange(N) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where $PHD = \frac{1}{ | e^H v_{min} |^2}$ or &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;phd[omegaIdx] = 1.0 / ( abs(eh * vmin) ** 2 )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do that for all omegas of interest.  The non-pseudo-code is in Python/Numpy, hence a * b is an element-by-element multiplication.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="3644" LastEditDate="2013-01-28T16:29:45.567" LastActivityDate="2013-01-28T16:29:45.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7671" PostTypeId="2" ParentId="7667" CreationDate="2013-01-28T15:39:35.253" Score="3" Body="&lt;p&gt;This probably doesn't do exactly what you're after, but I put &lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms/pisarenko&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Matlab code&lt;/a&gt; together many moons ago and think it may help in understanding what's happening.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;function omegahat = pisarenko(signal)&#xA;&#xA;%PISARENKO Find the Pisarenko frequency estimates of the signals &#xA;%          in each column of signal.&#xA;%&#xA;%          omegahat = pisarenko(signal)&#xA;%&#xA;% [1] V. F.  Pisarenko, &amp;quot;On the Estimation of Spectra by &#xA;%     Means of Non-linear Functions of the Covariance Matrix,&amp;quot;&#xA;%     Geophys. J. Roy. astr. Soc., Vol. 28, pp. 511-531, 1972. &#xA;%&#xA;% [2] V. F. Pisarenko, ``The Retrieval of Harmonics from a &#xA;%     Covariance Function,&amp;quot; Geophys. J. Roy. astr. Soc., &#xA;%     Vol.   33, pp. 347-366, 1973. &#xA;%&#xA;% &lt;span class=&quot;math-container&quot;&gt;$Id: pisarenko.m,v 1.2 1999/01/09 11:10:35 PeterK Exp PeterK $&lt;/span&gt;&#xA;&#xA;% File: pisarenko.m&#xA;%&#xA;% Copyright (C) 1999 Peter J. Kootsookos&#xA;% &#xA;% This software provided under the GNU General Public Licence, which&#xA;% is available from the website from which this file originated. For&#xA;% a copy, write to the Free Software Foundation, Inc., 675 Mass Ave, &#xA;% Cambridge, MA 02139, USA.&#xA;&#xA;%Type cast it to double.&#xA;signal = double(signal);&#xA;&#xA;%--------------------------------------------------------&#xA;% Error condition checks&#xA;&#xA;[T,N] = size(signal);&#xA;&#xA;if any([T N]==0)&#xA;  error('pisarenko: zero size data not allowed.');&#xA;end;&#xA;&#xA;if T==1&#xA;   signal = signal(:);&#xA;   [T,N] = size(signal);&#xA;end;&#xA;&#xA;Rss1 = sum(signal(2:T,:).*signal(1:T-1,:));&#xA;Rss2 = sum(signal(3:T,:).*signal(1:T-2,:));&#xA;&#xA;alpha = ( Rss2 + sqrt(Rss2.^2 + 8*Rss1.^2) ) ./ ( Rss1 + eps ) / 2;&#xA;&#xA;omegahat = acos(alpha/2);&#xA;&#xA;% Author: Peter J. Kootsookos (kootsoop@ieee.org)&#xA;%&#xA;% Based on: P.J. Kootsookos, S.J. Searle and B.G. Quinn, &#xA;% &amp;quot;Frequency Estimation Algorithms,&amp;quot; CRC for Robust and &#xA;% Adaptive Systems Internal Report, June 1993.&#xA;%&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;UPDATE: Regarding the issue of model order selection (size of the autocorrelation matrix to use), this turns out to be more complex than my comments below suggest.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://books.google.com/books/about/Digital_spectral_analysis.html?id=D-1QAAAAMAAJ&quot; rel=&quot;nofollow noreferrer&quot;&gt;Marple&lt;/a&gt; suggests on page 374 that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The idea of separating eigenvectors into signal and noise subspaces based upon an examination of either the eigenvalues of the autocorrelation matrix or the singular values of the data matrix does not work well in practice, especially with short sample records.  The &lt;a href=&quot;https://en.wikipedia.org/wiki/Akaike_information_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;AIC&lt;/a&gt; (&lt;a href=&quot;https://en.wikipedia.org/wiki/Akaike_information_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Akaike Information Criterion&lt;/a&gt;) order-selection criterion first introduced in Chap. 8 has been extended by &lt;a href=&quot;https://ieeexplore.ieee.org/document/1164557&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wax and Kailath [1985]&lt;/a&gt; to handle the subspace separation problem.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="80" LastEditorUserId="26573" LastEditDate="2022-06-06T11:34:43.083" LastActivityDate="2022-06-06T11:34:43.083" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="7672" PostTypeId="1" CreationDate="2013-01-28T15:42:36.390" Score="5" ViewCount="286" Body="&lt;p&gt;In my studies of wavelets, there appear to be 3 different families of them:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Continuous wavelet transform&lt;/li&gt;&#xA;&lt;li&gt;The Discrete wavelet transform&lt;/li&gt;&#xA;&lt;li&gt;The Redundant wavelet transform&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;They are all based on the same concept, but vary in how they are shifted/scaled, and/or decimated or not at every scale level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, where does each type find utility? For example, why would I want to use the Redundant Wavelet Transform over the Discrete Wavelet Transform, over the Continuous wavelet Transform in a particular application?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What advantages/disadvantages does one type of transform have over another, as far as its applicability is concerned?&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2018-04-07T21:05:59.793" Title="What are the uses of those three types of wavelet transformations?" Tags="|fourier-transform|frequency-spectrum|wavelet|transform|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7673" PostTypeId="2" ParentId="2493" CreationDate="2013-01-28T19:43:24.423" Score="2" Body="&lt;p&gt;Simply put, the relativly higher frequency usually has the ability to move from point A to point B, unlike the message signal. Also the carrier has the ability to span over the messgae signal, but not the otherwise. This is why it is called carrier, it is like the bus (carrier) carying people (data or message) and moving them from point A to point B. Under normal conditions and when the message can move from my mouth to your ears directly then there is no need to embedd the signal on top of a carrier.&lt;/p&gt;&#xA;" OwnerUserId="3705" LastActivityDate="2013-01-28T19:43:24.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7674" PostTypeId="1" CreationDate="2013-01-28T21:03:29.607" Score="8" ViewCount="6596" Body="&lt;p&gt;I'm looking for a broad classification on the kinds of techniques available. Something I can use to begin a literature survey.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some details:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;should be feasible for real-time implementation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Binary decision, I should be able to input the signal continuously, and the algo has to detect the start and stop times of the sinusoid in the waveform.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is no other signal, i.e. if the sinusoid is not present, then there will only be noise&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the input is band-limited, and the sinusoid, if present, is assured to be within that band.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Tradeoffs are between speed (how soon after the appearance of the sinusoid can the algo detect its presence) and false positives (should be minimal)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;I can't provide any exact numbers about acceptable performance measures, because I'm not sure myself. I intend to implement all your suggestions for my application and find out myself. I'm just looking for the &quot;standard&quot; techniques for tackling this problem.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Further details:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The input is the output of a band pass filter, so the noise is&#xA;also significant only in the pass band.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is no surety when&#xA;the sinusoid may appear. The duration of the sinusoid is in the&#xA;range of 50-100 ms. The amplitudes of the sinusoid will fluctuate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3708" LastEditorUserId="1273" LastEditDate="2013-01-29T11:02:27.003" LastActivityDate="2013-01-30T02:01:17.887" Title="What are some methods for detecting a sinusoid in noise?" Tags="|discrete-signals|signal-detection|signal-analysis|" AnswerCount="5" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7675" PostTypeId="1" AcceptedAnswerId="7686" CreationDate="2013-01-29T06:41:03.947" Score="3" ViewCount="883" Body="&lt;p&gt;There was an &lt;a href=&quot;http://fringefocus.com/2010/technical/analog-is-not-the-opposite-of-digital&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; a few years ago entitled &amp;quot;Analog is Not the Opposite of Digital&amp;quot;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Film is not analog, period. I used to shoot film on a Canon AE-1 from the ’70s. Now I have a digital SLR from Canon, and they’re obviously extremely different. But we have to be careful not to confuse ‘old’ and ‘new’, with two very specific terms like analog and digital.&lt;/p&gt;&#xA;&lt;p&gt;The word digital, to most people, refers to a device that can capture, store, or display data in a binary fashion. Ones and zeros, on and off, digital is all about numbers. Digital shouldn’t be confused with binary, of course, as digital simply means concrete values. Any system that utilizes solid values (or digits) is digital, binary is simply the most common system. Digital cameras capture light with a sensor, that light is converted into data (numbers), so the use of the word ‘digital’ for your cell phone camera or DSLR is accurate.&lt;/p&gt;&#xA;&lt;p&gt;Analog, however, is a very abused word. I would venture a guess that the significant amount of readers have used the word ‘analog’ to refer to film cameras. If the new, fancy robot cameras are ‘digital’ then our aging film cameras are ‘analog’, right?  Not at all. Older cameras capture light with film, which is basically plastic, gelatin, and silver halide. When you take a photo (perhaps of your dog drinking a beer), photons hit this material and produce a latent (invisible) image, that can later be brought into view by bathing the film in various chemicals. You could write hundreds of blog posts on film development alone, but the point is that film photography is a chemical process.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I understand the author's point about this misuse of the word &amp;quot;analog&amp;quot; in general, but it seems as though chemical film possesses many of the characteristics of an analog medium, in that it can capture a continuous spectrum of color values over a particular range.&lt;/p&gt;&#xA;&lt;p&gt;Does this characteristic (or any other) of chemical film make it directly comparable to other analog media such as a record or a cassette, or does the fact that the method of storage of the light information is not a continuous wave like a phonograph record preclude it from being classified as such?&lt;/p&gt;&#xA;&lt;p&gt;Since I know it will likely show up in a search for these topics, I had found &lt;a href=&quot;http://en.wikipedia.org/wiki/Analog_photography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Analog Photography&lt;/a&gt; appears to be a subfield of the art of photography, in which &amp;quot;progressively changing [the] recording medium&amp;quot; creates the image, regardless of whether chemical film or digital capture is used.  The technique itself seems to be the analog process in that case, and not any sort of statement about the photographic medium.&lt;/p&gt;&#xA;" OwnerUserId="76" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-01-29T20:28:45.583" Title="Are there characteristics of photographic film that would make it an analog medium?" Tags="|camera|soft-question|analog|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7676" PostTypeId="2" ParentId="7668" CreationDate="2013-01-29T09:06:36.363" Score="2" Body="&lt;p&gt;I found the answer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct approach is the next one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a controlled environment (appropiate ligth, no vibrations,...) take several images of the same object (e.g. a white sheet of paper). &#xA;Then calculate the variance of each pixel on time (in different images).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally mean all those variances and there it is! the variance of the image noise.&lt;/p&gt;&#xA;" OwnerUserId="3701" LastActivityDate="2013-01-29T09:06:36.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7677" PostTypeId="1" CreationDate="2013-01-29T11:32:51.543" Score="2" ViewCount="4176" Body="&lt;p&gt;I have following two related questions concerning unit step function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1-I want to sample the following signal. What will be the sample value at t=0? The signal takes 0 time to change from 0 to 1. So I  am confused what should be the sample value at t=0: 0 or 1?      &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- This signal is having infinite bandwidth (This signal is not possible in real world as all physical systems takes certain time to change its values, but here the value is changing in 0 time ). What is its counterpart in discrete domain (again with infinite bandwidth).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xzwtb.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2017-09-30T10:24:49.493" Title="Sampling a Unit step function" Tags="|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7678" PostTypeId="1" AcceptedAnswerId="9080" CreationDate="2013-01-29T11:50:15.560" Score="17" ViewCount="8123" Body="&lt;p&gt;How does one quantify how &quot;white&quot; some noise is? Are there any statistical measures, or any other measures (FFTs for example) that can quantify how close to white noise a particular sample is?&lt;/p&gt;&#xA;" OwnerUserId="3183" LastActivityDate="2021-10-20T23:20:14.053" Title="Determining the &quot;whiteness&quot; of noise" Tags="|noise|" AnswerCount="3" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="7679" PostTypeId="2" ParentId="7674" CreationDate="2013-01-29T11:55:51.980" Score="2" Body="&lt;p&gt;Depending on the frequency of sampling, a &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;FFT&lt;/a&gt; (Fast Fourier Transform) will work. For example, if your sampling rate is only once every 20 ms, you'll only get a few samples of the sinusoid, but if you're sampling every 0.5 ms then you'd get a lot more samples. FFTs usually work best with a large number of samples to average over. In that case even if your signal is the sum of a few sinusoids, they can be accurately determined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could have a look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Multiple_signal_classification#MUSIC_algorithm&quot; rel=&quot;nofollow&quot;&gt;MUSIC&lt;/a&gt; algorithm. I'm not too sure about the details of how it is implemented, but it has been implemented in several real-time detection scenarios. An alternative to MUSIC is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Esprit&quot; rel=&quot;nofollow&quot;&gt;Esprit&lt;/a&gt; algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, if your sample size is large enough and the noise doesn't swamp the signal entirely, then an FFT will be (on average) the fastest option. &lt;/p&gt;&#xA;" OwnerUserId="3183" LastActivityDate="2013-01-29T11:55:51.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7680" PostTypeId="2" ParentId="7677" CreationDate="2013-01-29T12:53:59.733" Score="4" Body="&lt;p&gt;1-) The value at t = 0 of an ideal step function converges to $\frac{f(0-) + f(0+)}{2}$ at 0 if you approach the question from a Fourier transform perspective (see Fourier transform of a discontinuous function).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2-) The analogous function in discrete time is still a unit step defined as:&#xA;$$&#xA;u[n] =&#xA;\begin{cases}&#xA;0 &amp;amp; \text{if n &amp;lt;  0} \\&#xA;1 &amp;amp; \text{if n &amp;gt;= 0} \\&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The concept of infinite frequency does not convey to discrete time representation.  In discrete time, frequency is represented by sequences of complex exponentials rather than continuous complex exponential functions.  Complex exponential sequences are not unique for frequencies above 1/2 your discrete time sampling rate so your frequency range is limited to $[0, \frac{f_s}{2}]$, where $f_s$ is your sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See sampling theory, the nyquist frequency and a discussion of the discrete Fourier transform for a more detailed discussion.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="13309" LastEditDate="2017-09-30T10:24:49.493" LastActivityDate="2017-09-30T10:24:49.493" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7681" PostTypeId="2" ParentId="7677" CreationDate="2013-01-29T12:58:22.303" Score="4" Body="&lt;p&gt;Strictly speaking you can't &quot;correctly&quot; sample a unit step function. The zero-length transition requires infinite bandwidth which violates the sample theorem. In order to sample it you need to pick a sample rate and that implicitly determines the bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can certainly fill a buffer with ones and zeros but if you were to stream this out over a DAC converter you would find that the result is NOT a unit step but that the bandwidth is limited, the transition is finite and that there likely to be some ringing around the transition region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice you may be able to approximate a unit step by choosing a high enough sample rate and/or by properly low passing an ideal unit step. This can be done by, for example, integrating the impulse response of a the low pass filter. It really depends on your application and what you are planning to do with it.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-01-29T12:58:22.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7682" PostTypeId="2" ParentId="7674" CreationDate="2013-01-29T13:29:06.097" Score="2" Body="&lt;p&gt;One way to detect a sinusoid is to use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Goertzel algorithm&lt;/a&gt;.  &lt;a href=&quot;http://www.embedded.com/design/real-world-applications/4401754/Single-tone-detection-with-the-Goertzel-algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rick Lyons gives a nice write-up here about how to use it for detection&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That second link has this equation for filtering your incoming signal and calculating the &quot;decision statistic&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ipt1D.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-01-29T13:29:06.097" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7683" PostTypeId="1" CreationDate="2013-01-29T14:15:30.240" Score="0" ViewCount="78" Body="&lt;p&gt;Suppose x(t) is a continuous-time signal and x(n) is a discrete time signal obtained by sampling the signal x(t) at a Nyquest sampling frequency Fs.  The signal x(t) requires a bandwidth of B1 Hz for faithful transmission through a communication channel, while the signal x(n) requires B2 Hz in the same communication channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1-Is there are any relationship between B1 and B2? are the two equal?    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Is it true that a digital signal utilizes bandwidth more efficiently as compared analog signal (perhaps by multiplexing) ?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for useful comments. &#xA;I am a little bit confused. I can get a clear idea if someone can answer my following question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Digital signals can utilize bandwidth more efficiently as compared to Analog. Is this true or false? &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="1598" LastEditDate="2013-01-30T08:53:52.700" LastActivityDate="2013-01-30T08:53:52.700" Title="Trying to understand whether digital signals help in better bandwidth utilisation or not" Tags="|sampling|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7685" PostTypeId="2" ParentId="7674" CreationDate="2013-01-29T16:36:59.410" Score="0" Body="&lt;p&gt;I would propose the following:&lt;br&gt;&#xA;1. organize a sliding window that is wide enough to contain the whole band of the signal (at least several periods of the lowest frequency signal)&lt;br&gt;&#xA;2. Perform a FFT of samples that are currently within a window, obtain a power spectrum from it.&lt;br&gt;&#xA;3. Crop the spectrum with the known band limits.&lt;br&gt;&#xA;4. Sort the remaining power spectrum values in decreasing order. Since the noise is gaussian, the noise spectrum would be averagely flat within the band, and if the mono-tonic beep was present in the window, it would produce the spike(s).&lt;br&gt;&#xA;5. Identify the typical spike bandwidth. Take the highest amplitude samples from a cropped-sorted power spectrum, obtain an average. That would be the potential &quot;beep&quot; energy.&lt;br&gt;&#xA;6. Also obtain an average of the remaining band samples, that would be the noise energy.&lt;br&gt;&#xA;7. Compute a ratio of energies obtained in (5) and (6). If the ratio exceeds the given threshold, set the flag indicating that the beep is found. If not, set the flag that there's currently no beep.&lt;br&gt;&#xA;8. Slide the window to the next frame (either sample-by sample, or by some larger step).&lt;/p&gt;&#xA;" OwnerUserId="745" LastActivityDate="2013-01-29T16:36:59.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7686" PostTypeId="2" ParentId="7675" CreationDate="2013-01-29T19:35:32.570" Score="5" Body="&lt;p&gt;Film isn't absolutely &quot;analog&quot;, as in continuous.  Every individual silver halide molecule, after exposure and development, is either metalized or not; and there are a finite number of these molecules in every frame of film, thus quantizing the exposure measurement.  However the density and location of the film grains and silver halide molecules is semi-randomized, which helps noise shape or dither the sampling, quantization and aliasing noise more than if they were in a regular grid with fixed step values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So some current differences are not that film is in some sense a truly continuous measurement system (at least down to the Planck level), but more might be that the &quot;sampling&quot; is dithered, and also that the dynamic range may be higher than in the most common digital formats (8 bit integer per channel).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-01-29T20:28:45.583" LastActivityDate="2013-01-29T20:28:45.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7687" PostTypeId="2" ParentId="7674" CreationDate="2013-01-29T19:52:13.410" Score="0" Body="&lt;p&gt;This is a statistics problem.  If you can characterize the noise, then you can look for particular characteristics of your signal of interest whose probability is below some likelihood (your required false positive error rate) to just randomly appear in the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the minimum duration of your sinusoid of interest (say 50 mS), you can try overlapped sliding FFT windows the length of that duration and look for spectral peaks above some threshold calculated by characterizing the noise.  If the same peak above the noise floor appears in multiple successive FFT windows, then the length of the sinusoid might be corresponding longer, depending on your FFT frame length and overlap.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-01-29T19:52:13.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7688" PostTypeId="1" AcceptedAnswerId="7701" CreationDate="2013-01-29T21:55:15.957" Score="2" ViewCount="455" Body="&lt;p&gt;I've read there are two admissibility criteria for wavelets, both of which are designed to preserve total power of the signal (source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Wavelet#Mother_wavelet&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Wavelet#Mother_wavelet&lt;/a&gt;, as well as various scientific papers)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Condition for zero-mean: $$\int_{-\infty}^{\infty}\psi(t)dt=0 $$&lt;/li&gt;&#xA;&lt;li&gt;Condition for square norm one: $$\int_{-\infty}^{\infty}|\psi(t)|^2dt=1,$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;where $\psi(t)$ is the wavelet kernel.&#xA;This leads to having a normalization factor of $\frac{1}{\sqrt{2\pi}}$ for the Gabor/Morlet wavelet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my question is: how do these admissibility criteria apply to 2D wavelets? (Let's say $\psi(x,y)$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess would be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$$\int_{x=-\infty}^{\infty}\int_{y=-\infty}^{\infty}\psi(x,y)dx dy=0 $$&lt;/li&gt;&#xA;&lt;li&gt;$$\int_{x=-\infty}^{\infty}\int_{y=-\infty}^{\infty}|\psi(x,y)|^2dxdy=1,$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;but I get inconsistent results in my computations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my guess right? If not, what are they? Can you provide a reliable source?&lt;/p&gt;&#xA;" OwnerUserId="2030" LastEditorUserId="2030" LastEditDate="2013-01-30T14:44:14.487" LastActivityDate="2013-01-30T19:52:13.567" Title="Multidimensionnal wavelet admissibility criteria" Tags="|wavelet|2d|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7689" PostTypeId="2" ParentId="7674" CreationDate="2013-01-30T02:01:17.887" Score="3" Body="&lt;p&gt;Everything depends on SNR.  The lower the SNR, the more processing you have to do to separate signal from noise.  I have solved a similar problem in the past, where I was looking for an intermittent, low SNR sinusoidal signal across a fairly broad range of frequencies.  This is what worked for me:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Perform an offline characterization of the noise of your system (in the frequency domain).  If the ambient noise level changes over time, periodically update this noise level online when the algorithm has high confidence that the signal of interest is not present.  If the noise isn't very stationary then this might not help much (and could hurt).  &lt;/li&gt;&#xA;&lt;li&gt;Perform a sliding FFT on discrete time windows.  Look for frequencies with energies that are some threshold above the background noise.  Get a list of candidate “peaks” that might be the signal of interest.  I opted to keep a circular buffer of data including samples from previous time windows so that the FFT had a better frequency resolution.  &lt;/li&gt;&#xA;&lt;li&gt;Build sinusoidal matched filters for the peak frequencies of interest identified in the FFT.  Look for responses above some threshold.  The match filter (a.k.a. the autocorrelation function) can attenuate noise really well and in my system it was quite good at pulling detections from what at first glance appeared to be hopeless data.  As a time domain filter, the matched filter can also tell you when the signal appears and when it disappears.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As others have recommended, I experimented with the MUSIC algorithm to separate signal from noise.  For my problem it was slightly better at finding low SNR candidate signals than the FFT, but since the computational burden was so much higher (and my algorithm was running on a wimpy fixed point DSP) I opted not to use it.  It was easier to just set the detection threshold lower with the FFT, detect more spurious peaks, and eliminate them in the matched filtering stage.  Low SNR detection can be a bit of a dark art but if you know enough about your system you can reliably detect signals with a lower amplitude than ambient noise levels.  It all depends on what information you know about your system that you can exploit.  &lt;/p&gt;&#xA;" OwnerUserId="1770" LastActivityDate="2013-01-30T02:01:17.887" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7690" PostTypeId="1" CreationDate="2013-01-30T05:27:41.373" Score="0" ViewCount="97" Body="&lt;p&gt;Since the list of phonemes in English is fixed, it should be possible to come up with a sample text(s) to collect all possible biphones for text-to-speech synthesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a sample text for this purpose?&lt;/p&gt;&#xA;" OwnerUserId="3713" LastActivityDate="2013-12-31T15:40:25.627" Title="Sample text to collect all possible English biphones for Text-To-Speech" Tags="|speech-synthesis|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7691" PostTypeId="1" AcceptedAnswerId="7693" CreationDate="2013-01-30T11:13:53.197" Score="1" ViewCount="96" Body="&lt;p&gt;this was a question i found online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;given an image with values between [0,1].&lt;br&gt;&#xA;how can I get the maximum contrast using linear gray-level transformation? &lt;br&gt;&#xA;something like I(x,y)=A*I(x,y)+B , where I is a histogram.&lt;br&gt;&#xA;we are also given MAX(I) and MIN(I).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as far as i can understand. &#xA;MAX(I) and MIN(I) will give you the values you have now and you wan to stretch the values into 0 and 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but how will this give me a linear equation? &lt;/p&gt;&#xA;" OwnerUserId="1831" LastActivityDate="2013-01-30T11:57:20.133" Title="maximum contrast using linear gery-level trasformation" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7692" PostTypeId="2" ParentId="7691" CreationDate="2013-01-30T11:54:15.947" Score="3" Body="&lt;p&gt;If you're subtracting the minimum and stretching the maximum remaining value to be 1, you get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $m = \min\{I(x,y)\}$ and $M = \max\{I(x,y)\}$&#xA;$$I_{\text{new}}(x,y) = \frac{I(x,y) - m}{M-m} = AI(x,y)+B $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A=\dfrac{1}{M-m}$ and $B = -\dfrac{m}{M-m}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this clears it up.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-01-30T11:54:15.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7693" PostTypeId="2" ParentId="7691" CreationDate="2013-01-30T11:57:20.133" Score="2" Body="&lt;p&gt;You want to design a linear transformation, that puts the MIN(I) at 0 and the MAX(I) at 1. A linear equation has the form: &lt;code&gt;y = m*x+b&lt;/code&gt;, where &lt;code&gt;m&lt;/code&gt; is the slope and &lt;code&gt;b&lt;/code&gt; is the point on the y-axis for &lt;code&gt;x = 0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to choose &lt;code&gt;m&lt;/code&gt; such that it goes from 0 to 1 (&lt;code&gt;dy = y_max - y_min = 1 - 0 = 1&lt;/code&gt;) within the interval from MIN(I) to MAX(I) (&lt;code&gt;dx = x_max - x_min = MAX(I) - MIN(I)&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m = 1/(MAX(I)-MIN(I));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next you want to make sure, that &lt;code&gt;y = m * MIN(I) + b == 0&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = -m*MIN(I);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have any further questions, let me know.&lt;/p&gt;&#xA;" OwnerUserId="101" LastActivityDate="2013-01-30T11:57:20.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7695" PostTypeId="1" CreationDate="2013-01-30T14:12:41.413" Score="2" ViewCount="123" Body="&lt;p&gt;I have some telephone voice audio with occasional &quot;blips&quot; in the audio.  The blips appear to come from an IP link buried in the PSTN (this is a conceptual explanation, so don't worry about things like packet loss concealment).   When a packet is dropped, there isn't a gap In the audio, instead, the audio has been spliced together causing a small discontinuity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a way to identify the discontinuities programmatically.  The most important feature of the identification is accurate time localization.  Also it isn't critical that all discontinuities be detected.  Even half would be sufficient.  My goal is to identify the time differences between detected discontinuities.  I can use this information to consider what processes may be involved in the errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried all kinds of spectral / wavelet analysis to look for the discontinuities, but these methods have been no more effective that scanning the data (in a wave viewer) in the time domain and making judgments about the signal values.  Occasionally conditions are just right so you can clearly identify a discontinuity in the time domain.  In general the identification is very difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I've thought about another approach.  The audio signal is human voice, so the correlation characteristics are well defined.  I'm thinking I can take advantage of this and look for “outliers” in the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is the basic problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have human voice that has been transmitted over a band limited channel with BW [200-3600Hz].  The sample rate is 8KHz, the audio encoding is 16 bit linear PCM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say I have data that runs for 10000 samples, call that number N and the data samples x[n].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to create an estimator that scans through the data, working on M samples at a time and advancing through the data in 1 sample increments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;M is in the order of 10 to 100 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given samples x[n] to x[n+M], I want to estimate x[n+M+1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like a standard estimation problem, but I'm not trying to estimate x[n] in the presence of AWGN, I am trying to predict x[n] from previous M values given the known correlation between samples of a human voice signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Call the estimate e[n].  I will then compare e[n] with x[n] and use a threshold to identify if the data is probably an outlier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the punch line is ...  $$\text{What is a good algorithm for producing e[n]}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The estimator parameters can be approached in two ways...&lt;br&gt;&#xA;1) derive parameters from the data&lt;br&gt;&#xA;2) impose the parameters based on the known characteristics of human speech   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for a priori information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PSD for male or female voice (average/typical) is available&lt;br&gt;&#xA; Probability distributions for modeling human voice are available  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just looking for some direction on the estimation approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have Mathematic to crunch numbers and try out various approaches and assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="4298" LastEditDate="2013-06-25T21:01:01.127" LastActivityDate="2013-06-25T21:01:01.127" Title="Voice sample prediction scheme" Tags="|discrete-signals|sampling|signal-analysis|estimation|linear-prediction|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7696" PostTypeId="1" CreationDate="2013-01-30T15:14:07.697" Score="3" ViewCount="961" Body="&lt;p&gt;I'm implementing DBPSK (differential binary phase-shift keying) over audio (44.1kHz sample-rate) using software.  Eventually I'll use multiple audio frequencies at once, so I'm using FFTs and inverse FFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As expected, as the window size (symbol length) gets smaller, ISI becomes more and more of a problem and the BER (bit error rate) increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like using RRC (root-raised cosine) filters is an established way to reduce ISI.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If as part of my data transmission I send out a special known signal that can be detected, then presumably I can determine the impulse response of the channel and apply an inverse transformation to re-construct (ignoring noise) the original signal without multi-path distortion.  Why is RRC useful if this transformation can be done?&lt;/p&gt;&#xA;" OwnerUserId="3435" LastActivityDate="2022-09-21T19:27:51.613" Title="Intersymbol Interference -- Root raised cosine filter redundant if doing impulse response equalization?" Tags="|filters|impulse-response|digital-communications|bpsk|multipath|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7697" PostTypeId="1" CreationDate="2013-01-30T15:24:31.527" Score="2" ViewCount="965" Body="&lt;p&gt;Q and I seem to come up a lot in discussions of digital communications, such as the comprehensive answer provided to this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/729/fft-window-phase-syncronising/2046#2046&quot;&gt;FFT window phase syncronising&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like the Q and I channels ultimately are combined into a sin wave of a given frequency, phase and amplitude.  If the communications system is all software (for example in a software-defined radio) is it necessary to worry about &quot;Q&quot; and &quot;I&quot;?  Is this just an artifact of when receivers and transmitters were electronics based?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the question more concrete, the link provided talks about putting the even bits onto Q and the odd bits onto I.  If this is the same thing as creating a sin wave of phase 0, 90, 180, or 270, then why bother with this seemingly unnecessary notation?  Perhaps the pulse shaping (like an RRC filter) needs to be independently applied to the Q and I channels?&lt;/p&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-02-12T09:44:27.337" Title="Meaning of Q and I in all-software QPSK communication systems?" Tags="|digital-communications|qpsk|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7698" PostTypeId="1" AcceptedAnswerId="7703" CreationDate="2013-01-30T15:44:58.290" Score="5" ViewCount="10939" Body="&lt;p&gt;I have been trying to reconstruct a random signal from its PSD and am running into trouble. I know that many different signals in the time or spatial domains can result in the same PSD-- I am interested in any of these signals. I am not the greatest at signal processing, so I've gotten a bit confused. I am reading &lt;a href=&quot;http://proceedings.spiedigitallibrary.org/proceeding.aspx?articleid=818939&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; paper. They state:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Therefore, PSD is approximated as&#xA;  $$&#xA;S(k)=\frac{2\sigma^2L_c}{(1+k^2L_c^2)^{0.5+\alpha}}&#xA;$$&#xA;  where&#xA;  $$&#xA;k=2\pi f, f=i/(N\Delta Z), 0\lt i \lt N/2&#xA;$$&#xA;  Lastly, N is the number of points along the line.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;...&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;With the magnitude information provided by S(k), we can reconstruct random line edges by applying a random phase to each frequency component of the PSD to form a unique signal in the frequency domain. A line edge with roughness can be simulated by doing an inverse Fourier transform of this signal. Random lines are distinguished through applied random phases.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have computed values for S(k), per the equation given. I then tried taking the square root of those values, multiplied them by the number of values, and subtracted their mean. Finally, I generated random phase information before doing an inverse FFT. Even after subtracting the mean I still see a very large spike at the beginning and end of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody have any suggestions as to what I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those that speak Python, here is the code I've written so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from matplotlib import pyplot as plt&#xA;&#xA;if __name__ == '__main__':&#xA;    SIGMA = 4.0&#xA;    ALPHA = 0.2&#xA;    Lc = 25&#xA;&#xA;    L = 2000.0&#xA;    N = 1000&#xA;&#xA;    dz = L/N&#xA;&#xA;    i = np.linspace(0,N/2,N)&#xA;    f = i/(N*dz)&#xA;    k = 2*np.pi*f&#xA;    PSD = lambda x: (2*3*SIGMA**2*Lc)/(1+(x*Lc)**2)**(0.5+ALPHA)&#xA;&#xA;    window = 25.0/46-21.0/46*np.cos((2*np.pi)/(N-1)*np.array(range(N)))&#xA;    magnitude = N*np.sqrt(PSD(k))&#xA;    phase = 1j*np.random.randint(0,6,N)+np.random.randn(N)&#xA;    FFT = magnitude-np.mean(magnitude)+phase&#xA;    FFT = window * FFT&#xA;    FFT = np.concatenate((FFT[::-1][0:-1],FFT))&#xA;&#xA;    fig = plt.figure()&#xA;    ax = fig.add_subplot(111)&#xA;&#xA;    ax.plot(np.fft.ifft(FFT))&#xA;&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit: I forgot about Gibbs phenomenon! As per Bruce Zenone's suggestion, I applied a Hamming window and mirrored my data. I added plots and updated my Python code. I am still seeing some effects of Gibbs phenomenon. Truncating the affected parts, the signal does not seem to be varying with sigma, alpha, and Lc.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my resulting signal:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yzpkO.png&quot; alt=&quot;my signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a figure from the paper showing the effect of the different parameters:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vMueb.png&quot; alt=&quot;example from paper&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3714" LastEditorUserId="3714" LastEditDate="2013-01-30T18:17:05.393" LastActivityDate="2013-01-30T21:35:45.173" Title="Working backwards from PSD to possible signal" Tags="|fft|python|power-spectral-density|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="7700" PostTypeId="2" ParentId="7696" CreationDate="2013-01-30T17:27:39.300" Score="3" Body="&lt;p&gt;There are three reasons to avoid ISI through pulse shaping rather than correcting it via channel correction methods.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;As Bruce pointed out, it is a simpler solution and requires fewer computations.&lt;/li&gt;&#xA;&lt;li&gt;Channel correction usually amplifies the received noise.&lt;/li&gt;&#xA;&lt;li&gt;Received noise will corrupt the channel model, making the ISI removal imperfect to some degree.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-01-30T17:27:39.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7701" PostTypeId="2" ParentId="7688" CreationDate="2013-01-30T17:38:07.150" Score="1" Body="&lt;p&gt;It turns out the admissibility criterion does not dictate that the energy of the wavelet must be unity. To be classified as a wavelet, a wavelet must follow the following criteria:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The wavelet must have finite energy, so $E = \int_{-\infty}^{+\infty} |\psi(t)|^{2} dt &amp;lt; \infty $&lt;/li&gt;&#xA;&lt;li&gt;The second condition is that the wavelet must have zero mean. (The intuition behind this is because the wavelet is acting like a matched filter, and we care only about how nicely the &lt;em&gt;shape&lt;/em&gt; of the received signal matches the wavelet, and not the &lt;em&gt;energy&lt;/em&gt; of the received signal). So if $\hat\psi(f) $ is the fourier transform of your wavelet, then: $$ C_g = \int_{0}^{\infty} \frac{|\hat\psi(f)|^2}{f} df &amp;lt; \infty $$ The $C_g$ here is called the admissibility constant, and the above property is called the admissibility criterion. This implies that $\hat\psi(0)=0$, because if it didn't, the above integral would blow up as you can see. &lt;/li&gt;&#xA;&lt;li&gt;Finally, for complex wavelets, the last criterion states that the Fourier transform must be both real, and vanish for negative frequencies. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now notice, no where does it state that the square norm of the wavelet must be equal to unity. It only states that the $E &amp;lt; \infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, it sounds as though the energy of your signal in the Wavelet domain, is not matching the energy of your signal in the Fourier domain. My best guess without further information is that you not normalize your wavelet to unit energy, since it is not demanded by the admissibility criterion. (First check though, if the energy of your signal in the spatial domain actually matches the energy of your signal in the wavelet domain). I would start there. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2013-01-30T19:52:13.567" LastActivityDate="2013-01-30T19:52:13.567" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7702" PostTypeId="2" ParentId="7697" CreationDate="2013-01-30T18:58:31.630" Score="1" Body="&lt;p&gt;A point in 2D space can be represented by either X and Y coordinates, or a distance and angle (relative to some reference point and axis).  However, the point measurement errors or noise is some common real systems is more likely to be uniform in the the units of an X,Y coordinate system, which may make error analysis and numerical error control in this space more tractable, thus lowering the computational requirement for most types of processing, even in purely digital systems.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-01-30T18:58:31.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7703" PostTypeId="2" ParentId="7698" CreationDate="2013-01-30T20:49:04.083" Score="6" Body="&lt;p&gt;There are several issues with your code:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The &quot;Gibbs&quot; issue is a non-issue, so you shouldn't need to window.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You are better off generating the complete $-\pi$ to $+\pi$ spectrum that you want, rather than relying on getting the symmetry correct.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFT = magnitude-np.mean(magnitude)+phase&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is changing the phase of the PSD magnitude by &lt;em&gt;addition&lt;/em&gt;. It should be using complex multiplication:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFT = magnitude * np.exp(1j*phase)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The code below is a modified version that seems to do the trick. The top graph shows the PSD and the (absolute value of the) FFT, showing that they overlap exactly.  The bottom graph shows the generated time domain signal for this particular realization of the phase noise.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; I just realized that the original code probably shifted the PSD by $\pi$ because the peak was in the center, rather than at the extremities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6Tw13.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;import numpy as np&#xA;from matplotlib import pyplot as plt&#xA;&#xA;    if __name__ == '__main__':&#xA;    SIGMA = 4.0&#xA;    ALPHA = 0.2&#xA;    Lc = 25&#xA;&#xA;    L = 2000.0&#xA;    N = 1000&#xA;&#xA;    dz = L/N&#xA;&#xA;    i = np.concatenate([np.linspace(0,N/2,N/2+1), np.linspace(-N/2+1,-1,N/2-1)])&#xA;&#xA;    f = i/(N*dz)&#xA;    k = 2*np.pi*f&#xA;    PSD = lambda x: (2*3*SIGMA**2*Lc)/(1+(x*Lc)**2)**(0.5+ALPHA)&#xA;&#xA;    magnitude = N*np.sqrt(PSD(k))&#xA;&#xA;    phase = 2*np.pi*np.random.randn(N)&#xA;    FFT = magnitude * np.exp(1j*phase)&#xA;&#xA;    fig = plt.figure()&#xA;&#xA;&#xA;    ax1 = fig.add_subplot(211)&#xA;    ax1.plot(np.abs(FFT))&#xA;    ax1.plot(magnitude)&#xA;&#xA;    ax2 = fig.add_subplot(212)&#xA;    ax2.plot(np.fft.ifft(FFT))&#xA;&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-01-30T21:35:45.173" LastActivityDate="2013-01-30T21:35:45.173" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7704" PostTypeId="1" AcceptedAnswerId="9095" CreationDate="2013-01-30T21:34:32.580" Score="9" ViewCount="276" Body="&lt;p&gt;I've got a 3D image of non-isotropic voxels, to which I'm applying a general rotation. How could I go about determining an appropriate voxel size for the rotated image? I need to minimize loss of information, but avoid too much supersampling to keep the image from getting too big.&lt;/p&gt;&#xA;" OwnerUserId="3715" LastActivityDate="2013-05-12T03:04:54.883" Title="Rotating a 3D image" Tags="|image-processing|resampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7705" PostTypeId="1" AcceptedAnswerId="7709" CreationDate="2013-01-31T00:49:33.043" Score="4" ViewCount="1033" Body="&lt;p&gt;I'm trying to create a seamless loop using a &quot;non-periodic&quot; signal using interpolation to smooth out the beginning and the end but I'm still getting a click at the beginning when it loops and I listen to it.  Can interpolation do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please Note that the equation is done this way to create a &quot;non-periodic&quot; signal to test when a signal does not start and end at the zero crossings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used audacity to zoom in and play the loops.  I've included images along with the matlab/octave code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LTmV5.png&quot; alt=&quot;Entire Signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TqudA.png&quot; alt=&quot;Begining of signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7QcgW.png&quot; alt=&quot;End of signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% combines sig to create seamless loop&#xA;clear all,clc,tic;&#xA;fs=44100;&#xA;dirpathtmp=strcat('/tmp/'); %/home/rat/Documents/octave/eq_research/main/transform/voice&#xA;fn=strcat('atest1',sprintf('%02d',fs),'.wav');&#xA;&#xA;&#xA;t1=linspace(0,2*pi,fs); %need to round off no decimals&#xA;t2=linspace(0,2*pi,fs); %need to round off no decimals&#xA;t3=linspace(0,2*pi,fs); %need to round off no decimals&#xA;&#xA;%Create signal in different arrays&#xA;y1=sin(7*t1);&#xA;y2=sin(12*t2);&#xA;y3=cos(2.2*t3);&#xA;yt=y1+y2+y3;&#xA;&#xA;ytnorm=(yt/max(abs(yt))*.8); %normalize signal &#xA;&#xA;%change end points to stddev number&#xA;ytnorm_std=std(ytnorm);&#xA;&#xA;%for loop to replace points to create seamless loop&#xA;ytnorm(1)=0; %set first point to 0&#xA;ytnorm(fs)=0; %set last point to zero&#xA;&#xA;for kk=2:1:15;&#xA;    kk&#xA;    ytnorm(kk)=interp1(t1,ytnorm,kk,'spline');&#xA;    ytnorm((fs+1)-kk)=interp1(t1,ytnorm,((fs+1)-kk),'spline');&#xA;end;&#xA;&#xA;wavwrite([ytnorm'] ,fs,16,strcat(dirpathtmp,fn)); &#xA;&#xA;plot(ytnorm)&#xA;&#xA;fprintf('\nfinally Done-elapsed time -%4.4fsec- or -%4.4fmins- or -%4.4fhours-\n',toc,toc/60,toc/3600);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1894" LastEditorUserId="1894" LastEditDate="2013-01-31T02:57:53.873" LastActivityDate="2013-02-01T14:34:17.230" Title="creating a seamless signal / loop using interpolation" Tags="|matlab|continuous-signals|interpolation|octave|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7706" PostTypeId="1" CreationDate="2013-01-31T02:56:46.057" Score="0" ViewCount="1576" Body="&lt;p&gt;im currently comparing 2 signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A = some music&lt;br&gt;&#xA;B = A + noise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and ive implemented cross correlation in frequency domain via complex multiplication to determine the time offset, which works perfectly so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what i need in addition to the time offset is the amplitude offset, means a faktor by which A should be scaled to match the amplitude of A contained in B. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ive been given advice to do this i have to multiply my A by the cross-correlation peak but heres my problem: my peak is NOT as expected between -1 and 1 but much higher (e.g. ~300). (even though it shows the time offset perfectly)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here are my questions:&#xA;am i missing some normalization of my CC values?&#xA;what exactly is the difference between normalized CC and &quot;normal&quot; CC.&#xA;what is the best way to get the amplitude factor?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3160" LastActivityDate="2013-01-31T07:31:22.810" Title="get amplitude difference via cross correlation?" Tags="|audio|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7707" PostTypeId="2" ParentId="7706" CreationDate="2013-01-31T07:31:22.810" Score="2" Body="&lt;p&gt;You divide the peak of the correlation by the energy of $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B$ is a scaled version of $A$, with some noise added to it.  Thus, the equation for the cross-correlation peak is-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ A * B' = A * (kA' + n') = k(A*A') + A*n'$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's ignore the noise term since we cannot predict its value.  The remaining term, $k(A*A')$, is the energy of $A$ times the scaling factor.  Thus, you simply need to divide the correlation peak by the energy of $A$ (which you know), and you have the scaling factor.  The noise term will introduce some error into the result, but there isn't really anything you can do about that other than reducing the noise or increasing the signal power in $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example- if $A$ is [1 2 1], then the energy is $1^2 + 2^2 + 1^2 = 6$.  If $B$ is twice $A$ ([2 4 2], then the cross correlation peak would occur when they were lined up, which would give us $1*2 + 2*4 + 1*2 = 12$.  Dividing the peak (12), by the energy of $A$ (6), gives a factor of 2, which is the correct result.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-01-31T07:31:22.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7708" PostTypeId="1" CreationDate="2013-01-31T08:21:40.647" Score="0" ViewCount="260" Body="&lt;p&gt;I have a video and I want to calculate the SNR for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to do it with an audio signal, but with a video I don't have a clue. I'm using SCILAB for the analysis. &lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="76" LastEditDate="2013-10-06T12:49:08.637" LastActivityDate="2013-10-06T12:49:08.637" Title="Calculating the SNR of a video" Tags="|image-processing|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7709" PostTypeId="2" ParentId="7705" CreationDate="2013-01-31T09:12:23.090" Score="0" Body="&lt;p&gt;Not sure if I understand it correctly, but assuming this is your problem:&#xA;&lt;code&gt;I have a signal that i want to repeat, but the beginning is not at the same level as the end&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution can be quite straightforward:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the trend &lt;code&gt;(end-begin)/length&lt;/code&gt; of interval and correct the sound value at each point in the interval for this trend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you already tried this, please plot  the entire signal played twice and look whether you still see something strange in the middle. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here is an example of what you can do to correct for the trend instead of interpolation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ydiff = ytnorm(end) - ytnorm(1);&#xA;ymean = mean(ytnorm);&#xA;ytnorm = ytnorm - (1:length(ytnorm)).*(ydiff /length(ytnorm)) ;&#xA;ytnorm = ytnorm - mean(ytnorm) + ymean;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3154" LastEditorUserId="3154" LastEditDate="2013-01-31T14:45:49.153" LastActivityDate="2013-01-31T14:45:49.153" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7710" PostTypeId="2" ParentId="7705" CreationDate="2013-01-31T09:12:53.327" Score="0" Body="&lt;p&gt;You're still getting clicks because you're forcing your signal to zero abprubtly. (Abrupt changes in time correspond to wide-band signals in frequency domain which account for the click-like sound). I think interpolation is not the suitable approach here as it involves the insertion of additional data points, what you probably don't want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fading the signal in/out can solve the problem. This can be a linear rise/decay or some spline curve. I'm quite sure Audacity can do this. Of course, you can also do it in Matlab by multiplying the beginning/end of your signal with some fading curve like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Fade In&#xA;L = 1000; % length of fade in&#xA;y_start = 0; % start value&#xA;y_stop = 1; % stop value&#xA;lin_fading_curve = linspace(y_start, y_stop, L); % linear fading curve&#xA;cub_fading_curve = 1.5 * lin_fading_curve - 0.5 * lin_fading_curve .^ 3; % cubic fading curve&#xA;y_lin_fade_in = [ytnorm(1:L) .* lin_fading_curve, ytnorm(L+1:end)];&#xA;y_cub_fade_in = [ytnorm(1:L) .* cub_fading_curve, ytnorm(L+1:end)];&#xA;&#xA;plot(t1,ytnorm);&#xA;hold on;    &#xA;plot(t1, y_lin_fade_in, 'r');&#xA;plot(t1, y_cub_fade_in, 'g');&#xA;xlim([0 2*pi/fs*1200]);&#xA;legend('original', 'linear', 'cubic', 'Location', 'SouthEast');&#xA;hold off;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's what you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s51s9.png&quot; alt=&quot;Fade-in of signal&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-01-31T12:33:24.233" LastActivityDate="2013-01-31T12:33:24.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7711" PostTypeId="1" AcceptedAnswerId="56204" CreationDate="2013-01-31T12:42:08.620" Score="6" ViewCount="566" Body="&lt;p&gt;When the captured image is blurring, one way of obtaining a clear image is via image deconvolution technique. In order to perform deconvolution successfully, usually we need to pay attention to the following issues:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Image content, which determines what kind of apriori information you will use (Total Variation, Laplacian and so on) during the image reconstruction procedure. &lt;/li&gt;&#xA;&lt;li&gt;Image noise level, which determines the balance factor between apriori information and data consistence term. &lt;/li&gt;&#xA;&lt;li&gt;Point Spread Function (PSF), which is used to measure how blurring the image is. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here my question is related to PSF estimation. The simplest way of finding the right PSF is to use different PSFs to perform deconvolution, and then select the best one visually. Then my question is how we can tell which PSF is the best visually. &lt;/p&gt;&#xA;" OwnerUserId="1674" LastEditorUserId="128" LastEditDate="2019-03-24T17:35:31.190" LastActivityDate="2019-04-23T19:01:30.247" Title="How to Select Point Spread Function Empirically for Image Deconvolution?" Tags="|image-processing|deconvolution|blind-deconvolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7712" PostTypeId="1" AcceptedAnswerId="7723" CreationDate="2013-01-31T14:12:22.667" Score="1" ViewCount="1426" Body="&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off let me explain that I understand that frequency makes no sense for a single sample. What I am actually talking about is the power spectrum within a short time window around a specific sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a time varying discrete signal: $\ s(t_i), i=0...199 $ with sampling dt = 10 ms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the power of a specific frequency: 15 Hz at time sample j = 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I would solve this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that I must extract a subset of the signal in a window around j = 100 and multiply it with a window function to avoid &quot;ringing&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I therefore extract the subset j=93..107 and multiply it with a -/+ 2 standard deviations gaussian kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Any advice on the size of the window?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I zero-pad the subset to 512 samples in order to achieve some &quot;spectral interpolation&quot;&#xA;and take the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally I locate the complex number corresponding to f=15 Hz and take the absolute value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually I would repeat this procedure for j = 7...192 to find the power of f=15 Hz at each sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However reading about the &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Short Time Fourier Transform&lt;/a&gt; got me confused&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;they seem to break the data to be transformed into overlapping chunks,&#xA;window the data within each chunk, take the FFT and then somehow adding the results together!?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this just a matter of performance?&#xA;As a first solution I would prefer a simple but slow approach (such as mine).&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="697" LastEditDate="2013-01-31T17:03:45.813" LastActivityDate="2013-02-01T19:09:50.167" Title="How do I find the power of a specific frequency at a specific sample of a discrete time varying signal?" Tags="|fourier-transform|frequency-spectrum|stft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7714" PostTypeId="2" ParentId="7705" CreationDate="2013-01-31T16:23:38.967" Score="1" Body="&lt;p&gt;An alternate method is to create an array of two copies of your input signal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = [ x , x ]         % MATLAB&#xA;y = hstack(( x , x )) # NUMPY&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Run $x[k]$ through a LPF.  Then slice $N$ samples from the &quot;middle&quot; of $y[k]$ where $N$ is the length of $x[k]$.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xsmooth = y( o : o + N - 1) % MATLAB&#xA;xsmooth = y[ o : o + N ]    # NUMPY&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where $o$ is an appropriately chosen offset.  Be mindful of filter &quot;tails&quot; if you carry out the LPF through conventional convolution.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="3644" LastEditDate="2013-02-01T14:34:17.230" LastActivityDate="2013-02-01T14:34:17.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7715" PostTypeId="1" CreationDate="2013-01-31T17:23:11.333" Score="2" ViewCount="621" Body="&lt;p&gt;I have a system that is forced by a sinusoidal function with specific amplitude, phase and frequency. I get a deformation of sinusoidal form as well, and I would like to find the phase lag. I use FFT and isolate the phase lag numerically, it says it is pi/2 however when I look at the plots, it is not pi/2 at all. What can I do? Thank you. PS:Can provide FFT code if needed.&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2013-01-31T17:23:11.333" Title="How to find the phase lag between a sinusoidal input force and the response?" Tags="|fft|phase|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7716" PostTypeId="1" AcceptedAnswerId="7736" CreationDate="2013-01-31T17:40:53.183" Score="2" ViewCount="1970" Body="&lt;p&gt;I would like to improve a simple Harris corner detector by adding more scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I &lt;em&gt;don't need&lt;/em&gt; scale-invariant interest points, just to detect more points by processing more scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Harris_affine_region_detector#Gaussian_scale-space&quot; rel=&quot;nofollow&quot;&gt;Wikipedia says&lt;/a&gt; there are two sigmas involved: a &lt;em&gt;derivative scale&lt;/em&gt; $\sigma_{D}$ and an &lt;em&gt;integration scale&lt;/em&gt; $\sigma_{I}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after computing derivative images on a given level, I smooth them with Gaussian filter of size $\sigma_{D}$, then for each location $(x,y)$ in the image I have the matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(x,y)=\begin{pmatrix}I_{x}^{2} &amp;amp; I_{x}I_{y} \\ I_{x}I_{y} &amp;amp; I_{y}^{2} \end{pmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $I_{x}$ and $I_{y}$ are the smoothed images (with $\sigma_{D})$ on the respective location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I apply the integration scale $\sigma_{I}$ now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to store separate images $I_{x}^{2}$, $I_{y}^{2}$ and $I_{x}I_{y}$ and smooth these with $\sigma_{I}$ before computing the matrix and Harris corner response from it?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-02-02T20:26:37.033" Title="Understanding Integration Scale in Multi-Scale Harris Corner Detector" Tags="|local-features|harris|corners|detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7719" PostTypeId="2" ParentId="6448" CreationDate="2013-01-31T22:38:24.967" Score="5" Body="&lt;p&gt;I have found some &quot;proverbs&quot; like:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Never use software to compensate for a poor lighting system. &#xA;  &lt;em&gt;It is not cost effective and will result in a poor system design.&lt;/em&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;It is cheaper to add a light-proof shroud to keep sun-light away from&#xA;  the object under inspection than to modify the software. &lt;em&gt;Another&#xA;  universal truth which is often forgotten.&lt;/em&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Nothing exceeds the speed of light. &lt;em&gt;Any processing that can be done&#xA;  optically will save a lot of computer processing later.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;in the book &lt;a href=&quot;http://elm.eeng.dcu.ie/~whelanp/ivsi/IVSI.pdf&quot;&gt;&quot;Intelligent Vision Systems for Industry&quot; by Bruce G. Batchelor and Paul F. Whelan&lt;/a&gt; and also in B.G. Batchelor and P.F. Whelan (1994), &quot;Machine vision systems: Proverbs, principles, prejudices and priorities&quot;, Proceedings of the SPIE - The International Society for Optical Engineering, Vol. 2347 - Machine Vision Applications, Architectures, and Systems Integration III, Boston (USA), pp 374-&#xA;383. (see here &lt;a href=&quot;http://elm.eeng.dcu.ie/~whelanp/proverbs/proverbs.pdf&quot;&gt;http://elm.eeng.dcu.ie/~whelanp/proverbs/proverbs.pdf&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proverbs are also in the 2012 book &lt;a href=&quot;http://link.springer.com/book/10.1007/978-1-84996-169-1/page/1&quot;&gt;&quot;Machine Vision Handbook&quot;, Editors: Bruce G. Batchelor ISBN: 978-1-84996-168-4&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3573" LastActivityDate="2013-01-31T22:38:24.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7720" PostTypeId="1" CreationDate="2013-02-01T09:41:36.997" Score="9" ViewCount="6530" Body="&lt;p&gt;For fun and work I've to implement a java based application that can Encode text or data to sound and transmit using PC's speaker and on the receiving side is a microphone with decoder software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking of using FSK (syn or async or suggest) for the implementation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Text (data) ---modulate---&gt; 10khz-20khz audio carrier wave ---&gt; Over the air transmission ---&gt; microphone -&gt; demodulate ---&gt; Display text or data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main considerations are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;~200bps bandwidth if not more&lt;/li&gt;&#xA;&lt;li&gt;resilient to noise upto certain level&lt;/li&gt;&#xA;&lt;li&gt;preferably 16khz - 20khz carrier wave with 44.1khz sampling (there's less noise in this area and its not really audible to older people and mics, speakers are cheap, readily available in laptops)&lt;/li&gt;&#xA;&lt;li&gt;Not too complex coding logic.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What Modulation would work best with least coding efforts? Any recommendations on libraries/samples for achieving FSK/BFSK/PSK or DSSS using java?&lt;/p&gt;&#xA;" OwnerUserId="3728" LastActivityDate="2017-03-08T15:44:23.250" Title="PC-to-PC data communication over Sound FSK / PSK / DSSS" Tags="|audio|modulation|sound|fsk|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7721" PostTypeId="1" AcceptedAnswerId="7722" CreationDate="2013-02-01T11:47:09.553" Score="3" ViewCount="2067" Body="&lt;p&gt;Let's say I have an audio sample, whose pitch is known to be C4 (don't wanna go in detail here, let's say I just sampled a tuned piano playing the C4 key).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rules of the game are: I can only change the sample playback rate by any ratio. No pitchshifter module, no frequency analysis. If I set the playbackrate to 2.0, for example, the sample is played back at twice its speed. If I set it to 0.5, the sample is played back at half its speed, and so on. This changes the playback time as well as the sample pitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I wanted to generate any arbitrary &quot;note&quot; from this sample, what is the relation between the playback rate and the sample pitch? For example, I know that C4 fundamental frequency is 261.63 Hz. What playback rate should I set to make the sample &quot;sound like&quot; a C#4/Db4 (277.18 Hz) or a D4 (293.66 Hz)? What is the general, formulaic, relationship?&lt;/p&gt;&#xA;" OwnerUserId="3674" LastActivityDate="2013-02-01T12:14:52.327" Title="pitch vs playback rate" Tags="|audio|frequency|sampling|pitch|resampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7722" PostTypeId="2" ParentId="7721" CreationDate="2013-02-01T12:14:52.327" Score="3" Body="&lt;p&gt;The ratio of sample playback rates should be equal to the ratio of pitches you want to obtain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your C4 note was sampled at 48kHz, you'll need to play it back at $48000 \times \frac{277.18}{261.63} = 50.85kHz$ to make it sound like a C#4.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-02-01T12:14:52.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7723" PostTypeId="2" ParentId="7712" CreationDate="2013-02-01T19:09:50.167" Score="2" Body="&lt;p&gt;I realize this doesn't answer the detail of what you're asking, but I believe it answers the question in the title:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.embedded.com/design/real-world-applications/4401754/Single-tone-detection-with-the-Goertzel-algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;See Rick Lyons's writeup here&lt;/a&gt; for using the Goertzel algorithm to get the signal level at a specific frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then follow up the equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EqgAf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{p}(n) = | y(n) |^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and use $\hat{p}(n)$ as your &quot;instantaneous power&quot; at frequency $\omega =2\pi m/N$ --- which is sort of like  Lyons's eq. 13.83:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cQqZF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(though he's evaluating this one at the &quot;end&quot; of his DFT length).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-02-01T19:09:50.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7724" PostTypeId="1" CreationDate="2013-02-01T22:53:51.163" Score="12" ViewCount="19249" Body="&lt;p&gt;I'm trying to understand how symbol synchronization is done in OFDM using pilot tones, cyclic prefixes, or any other technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read the following answers which provide some explanation, but I still don't totally understand it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/360/how-to-demodulate-an-ofdm-signal/368#368&quot;&gt;How to demodulate an OFDM signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/309/how-to-estimate-the-number-of-taps-needed-for-subsequent-channel-estimation-algo/315#315&quot;&gt;How to estimate the number of taps needed for subsequent channel estimation algorithms?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specific questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) How is a pilot tone found?  What makes it different than the regular data on a sub-carrier?  How can it be used to determine symbol starts and ends? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If I understand the answers above correctly, a cyclic prefix can be used to find the symbol start/end because it will auto-correlate with some delay.  However, the cyclic-prefix exists in order to &quot;absorb&quot; ISI.  So if the prefix has been munged with ISI, then how can this auto-correlation be successful?&lt;/p&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2018-12-15T22:10:36.167" Title="How is symbol synchronization with OFDM done?" Tags="|digital-communications|ofdm|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7725" PostTypeId="1" AcceptedAnswerId="7727" CreationDate="2013-02-01T23:02:50.397" Score="4" ViewCount="6546" Body="&lt;p&gt;My understanding is that BPSK/QPSK/... are often implemented with root-raised cosine (RRC) filters to reduce ISI and bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OFDM can be understood to be BPSK/QPSK/... implemented on multiple orthogonal carriers, with some additional complications like cyclic prefixes, pilot tones, and implementation using FFT/IFFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I've read, it seems OFDM doesn't usually use RRC filters.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it that BPSK/QPSK/... use RCC while OFDM doesn't use RRC and instead uses a cyclic-prefix to combat ISI?  In other words, why isn't OFDM implemented the same way as BPSK/QPSK/... just with multiple orthogonal carriers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know what I'm missing! :)  Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3435" LastActivityDate="2017-07-13T16:14:17.847" Title="Why does OFDM use cyclic-prefix while QPSK uses root-raised cosine filters?" Tags="|filters|digital-communications|ofdm|bpsk|qpsk|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7726" PostTypeId="2" ParentId="7724" CreationDate="2013-02-02T01:30:42.680" Score="6" Body="&lt;pre&gt;&lt;code&gt;How is a pilot tone found?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The location of pilot tones in terms of sub-carriers is defined by the signal protocol.  For instance, in the case of 802.11a the pilot sub-carriers are -21, -7, 7, and 21.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;What makes it different than the regular data on a sub-carrier?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is different in that the receiver knows exactly what the pilot tone contains.  There is no uncertainty other than noise and distortion brought on by carrier offset, symbol (timing) offset, channel effects (e.g. multi-path) , etc.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;How can it be used to determine symbol starts and ends?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Circular shifts (sometimes called &quot;barrel&quot; shifts) produce phase offsets in FFT's.  The cyclic prefix prepends the end of the symbol for the exact purpose of making a time shift a circular shift.  Thus, when the inverse FFT is performed, any time offset will create a phase offset in all of the channels.  Because we know exactly what the pilot tones should be, the phase offset (which corresponds to a time offset in the original symbol) can be detected and corrected.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;If I understand the answers above correctly, a cyclic prefix can be used to find the&#xA;symbol start/end because it will auto-correlate with some delay.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again, it is not an auto-correlation thing, it is that the inverse FFT translates the time shift into a phase shift that we can use the pilot channels to detect.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;However, the cyclic-prefix exists in order to &quot;absorb&quot; ISI. So if the prefix has been&#xA;munged with ISI, then how can this auto-correlation be successful?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without multi-path there is no ISI with OFDM signals.  The only ISI they have to worry about is when there is a delayed multi-path signal that interferes with the primary signal.  They intentionally make the cyclic prefix longer than any &quot;normal&quot; multi-path delay, so there is almost always an intact FFT's worth of uncorrupted data.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-02-02T02:04:24.893" LastActivityDate="2013-02-02T02:04:24.893" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7727" PostTypeId="2" ParentId="7725" CreationDate="2013-02-02T01:41:05.723" Score="11" Body="&lt;p&gt;ISI, or intersymbol interference, means different things in the context of PSK and OFDM signals.  In PSK signals the symbols almost always have tails that extend, in the time-domain, into the times of other symbols.  This is what they mean by &quot;intersymbol interference&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oSSra.png&quot; alt=&quot;Consecutive raised cosines&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately they have to do this to reduce the bandwidth of the signal.  They eliminate the negative effects of intersymbol interference by very carefully shaping the symbols so that when the receiver filters them through a matched filter, the other symbols have zero output at the sampling times of the other symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With OFDM signals there is no overlap in the time-domain between symbols, so there is no intersymbol interference in the PSK sense of the term.  What they mean by ISI in the context of ISI is when time-delayed multi-path signals cause the time-delayed symbols to overlap with the following symbol in the non-delayed signal.  The cyclic prefix is added to the symbols to give the receiver enough un-corrupted data to recover the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, let's say that there are 64 sub-carriers and when we FFT them we get 64 samples of time-domain data.  Let's also say that we think the worst multi-path we will generally see will be a time delay of 7 samples.  If we make the cyclic-prefix 8 samples long then we should always have at least 65 &quot;clean&quot; samples, which gives us enough to recover the symbol.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-02-02T01:41:05.723" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7728" PostTypeId="1" CreationDate="2013-02-02T02:30:05.490" Score="9" ViewCount="7787" Body="&lt;p&gt;I have exposure to MATLAB and have some basic exposure to signal processing and plotting in MATLAB... but I am more comfortable with C/C++ than MATLAB because I have been working in Image processing with OpenCV... I was just curious: Is there any DSP library or platform (as OpenCV is for image processing) for doing signal processing in C/C++?&lt;/p&gt;&#xA;" OwnerUserId="1942" LastEditorUserId="21075" LastEditDate="2023-11-21T21:49:36.260" LastActivityDate="2023-11-21T21:49:36.260" Title="DSP programming in C/C++" Tags="|image-processing|signal-analysis|dsp-core|c|" AnswerCount="6" CommentCount="4" CommunityOwnedDate="2013-02-07T11:30:10.930" ContentLicense="CC BY-SA 3.0" />
  <row Id="7729" PostTypeId="2" ParentId="6486" CreationDate="2013-02-02T07:07:04.547" Score="3" Body="&lt;p&gt;Since your noise is gaussian, then its power spectrum is flat. You may have some signal spectrum peaks, so they should be avoided. I would propose either median of the power spectrum samples or alpha-trimmed average of the power spectrum samples, or ultimately the inter-quartile average. All of these estimates are robust, you may choose any that fits best.&lt;/p&gt;&#xA;" OwnerUserId="745" LastActivityDate="2013-02-02T07:07:04.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7730" PostTypeId="2" ParentId="7728" CreationDate="2013-02-02T12:31:00.057" Score="7" Body="&lt;p&gt;Octave is a multi-platform open source math and matrix toolkit. It has a command line interpreter aimed to be very similar to MATLAB, but there is also a &lt;a href=&quot;http://octave.sourceforge.net/doxygen/html/&quot;&gt;C++ API&lt;/a&gt; available for use. Since you refer to signal processing in contrast to image processing, I assume you mean audio processing, so you might need to look into the &quot;signal&quot; and &quot;audio&quot; packages in octave (which provide e.g. wavread). Keep in mind however, that the API is primarily designed for internal use in the octave CLI, and that it is considered not stable (i.e. the bindings might change). Also, since the library is not primarily meant to be linked with, the documentation is poor to say the least.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, there is also &lt;a href=&quot;http://www.gnu.org/software/gsl/&quot;&gt;GNU Scientific Library&lt;/a&gt;, which is not primarily aimed at signal processing, but provides complex numbers, matrices, fft and so on. On Windows, you would have to compile that yourself using Cygwin.&lt;/p&gt;&#xA;" OwnerUserId="3702" LastActivityDate="2013-02-02T12:31:00.057" CommentCount="0" CommunityOwnedDate="2013-02-07T11:30:10.930" ContentLicense="CC BY-SA 3.0" />
  <row Id="7731" PostTypeId="1" AcceptedAnswerId="7735" CreationDate="2013-02-02T13:49:19.067" Score="7" ViewCount="5840" Body="&lt;p&gt;I know that sampling in one domian (time or frequency) gives raise to replicas in another domain (frequency / time).&lt;/p&gt;&#xA;&lt;p&gt;How replicas are formed?&lt;/p&gt;&#xA;&lt;p&gt;What is this Time domain periodicity and frequency domain periodicity here in sampling?&lt;/p&gt;&#xA;" OwnerUserId="3638" LastEditorUserId="40918" LastEditDate="2020-06-28T14:41:03.823" LastActivityDate="2020-06-28T14:41:03.823" Title="How replicas are formed in Frequency domain when a signal is sampled in Time Domain?" Tags="|sampling|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7732" PostTypeId="2" ParentId="7724" CreationDate="2013-02-02T14:48:27.907" Score="9" Body="&lt;p&gt;&lt;strong&gt;Regarding you're general question about how symbol sychronization is done in OFDM systems:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;One of the most popular and frequently used techniques is the transmission of one or several pilot &lt;em&gt;symbols&lt;/em&gt; that are known in the receiver. A pilot symbol is a complete OFDM symbol where the value of each subcarrier is predefined and known in transmitter and receiver. It is repeated with a certain rate that depends on how fast the channel changes. The received signal is correlated with the pilot symbol to detect the OFDM symbol start. It can also be used for channel estimation. Schmidl and Cox have introduced in [1] a pilot symbol based technique where the pilot symbol has a special symmetry so that the pilot symbol need not to be known at the receiver.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As Jason R has noted in his comment, although it is not its initial purpose, the cyclic prefix can also be used for symbol synchronization because its a known repetition of some part of the received signal that can be detected through autocorrelation. It is especially well-suited for fast-changing channels, because the delay time can be updated on a per-symbol basis. Additionaly, it does not add any additional overhead. However, it is more sensitive to noise [2] and presumably also to ISI.&lt;br&gt;&#xA;&lt;em&gt;Edit:&lt;/em&gt; The maximum delay that can be detected by this method is the lenght of one OFDM symbol. It's therefore only suited for fine synchronization.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There are some more &quot;exotic&quot; techniques. In one of these, for instance, the N-DFT (N = number of subcarriers) of time-shifted versions of the received signal is calculated. If you apply the DFT to the wrong time window, the resulting constellation diagram will be a mess. If you got the correct time window, the constallation digaram shows distinct constellation points. This can be detected by calculating the standard deviation of the DFT output. This method implies a high computational cost.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding you specific questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How is a pilot tone found? What makes it different than the regular data on a sub-carrier? How can it be used to determine symbol starts and ends?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Once you have synchronized the received signal the pilot tones are at predefined bins of the DFT. When designing the system the location of pilot tones in the spectrum is fixed. There are more complex schemes, where the location of the pilot tones changes in a predefined pattern to get a good approximation of the channel in both frequency and time domain. Pilot tones cannot be used for synchronization, because the received signal has first to be synchronized before you can even extract the pilot tones in frequency domain. Assume that a wrong time window is used: ortogonality of subcarriers will be lost and the result of DFT is some mixture of two consecutive OFDM symbols. This is a nonlinear effect and the pilot symbols cannot be extracted from this mixture. Pilot tones are used for channel estimation and sometimes phase noise mitigation.&lt;br&gt;&#xA;&lt;em&gt;Edit:&lt;/em&gt; As Jim Clay has pointed out in his comments, fine synchronization through pilot tones is possible if a coarse value for the delay is known and the residual delay does not exceed the length of the cyclic prefix.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I understand the answers above correctly, a cyclic prefix can be used to find the symbol start/end because it will auto-correlate with some delay. However, the cyclic-prefix exists in order to &quot;absorb&quot; ISI. So if the prefix has been munged with ISI, then how can this auto-correlation be successful?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Like all synchronisation techniques this method will suffer from noise and channel dispersion and consequently will only work to some extent of the beforementioned effects. Quantifying to which extent &lt;em&gt;exactly&lt;/em&gt; it is still working would require some thorough research that somone has certainly already done.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1] Schmidl, T.M.; Cox, D.C.; , &quot;Robust frequency and timing synchronization for OFDM,&quot; Communications, IEEE Transactions on , vol.45, no.12, pp.1613-1621, Dec 1997&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] van de Beek, J.J.; Sandell, M.; Borjesson, P.O.; , &quot;ML estimation of time and frequency offset in OFDM systems,&quot; Signal Processing, IEEE Transactions on , vol.45, no.7, pp.1800-1805, Jul 1997&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-02-04T10:23:48.307" LastActivityDate="2013-02-04T10:23:48.307" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7733" PostTypeId="2" ParentId="7731" CreationDate="2013-02-02T18:42:36.657" Score="1" Body="&lt;p&gt;Sampling in one domain implies periodicity in the other. For example the Discrete Fourier Series (which the FFT is a special case off), requires both time and frequency domain signals to be discrete and periodic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This really isn't a topic that can be exhaustively discussed on board like this. I would recommend spending some quality time with good text book such as this &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0132146355&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Digital-Signal-Processing-Alan-Oppenheim/dp/0132146355&lt;/a&gt; or &lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-02-02T18:42:36.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7734" PostTypeId="2" ParentId="7720" CreationDate="2013-02-02T18:45:31.740" Score="7" Body="&lt;p&gt;This is actually a really tough problem because of the channel characteristics. Most computer speakers have fairly limited bandwidth, have significant non-linearities and the room acoustics are often time variant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Life becomes A LOT easier if you can just run a cable from the headphone output of one PC into the line input of the other. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-02-02T18:45:31.740" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7735" PostTypeId="2" ParentId="7731" CreationDate="2013-02-02T19:04:37.863" Score="11" Body="&lt;p&gt;Some people treat sampling in the time domain as the &lt;strong&gt;multiplication&lt;/strong&gt; of a signal $x(t)$ by a &lt;em&gt;periodic&lt;/em&gt; impulse train $\sum_n \delta(t-nT)$. Since the Fourier transform of a periodic impulse train is a periodic impulse train $\sum_k \delta\left(f-\frac{k}{T}\right)$ (I might be off by a factor of $T$ here, but the basic idea is correct), and&#xA;&lt;em&gt;multiplication in the time domain corresponds to convolution in the frequency domain,&lt;/em&gt; &#xA;we get that the Fourier transform of the sampled signal is&#xA;$$X(f)\star\sum_k \delta\left(f-\frac{k}{T}\right) = \sum_k X(f)\star\delta\left(f-\frac{k}{T}\right) = \sum_k X\left(f-\frac{k}{T}\right)$$&#xA;which is a periodic function of $f$ since $X(f)$ is replicated at intervals of &#xA;$\frac{1}{T}$ Hz along the frequency axis.&#xA;If $X(f)$ is bandlimited to $\left(-\frac{1}{2T},\frac{1}{2T}\right)$, the replicas&#xA;do not overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other people resolutely refuse to consider impulse trains and come up&#xA;with other, equally valid, means of arriving at the same result.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-02-02T19:04:37.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7736" PostTypeId="2" ParentId="7716" CreationDate="2013-02-02T20:26:37.033" Score="1" Body="&lt;p&gt;I think the first smoothing, by $\sigma_D$, is only done to get more stable derivatives whereas in the second step the convolution by a Gaussian with $\sigma_I$ is done to establish the 'scale-space' in which the operator is applied. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ignoring $\sigma_D$, this looks like this in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dx = [-1 0 1; -1 0 1; -1 0 1];  % Simple mask for derivative &#xA;Ix = conv2(im, dx, 'same');     % Convolve against image&#xA;Iy = conv2(im, dx', 'same');    % Again for y-direction with transposed mask&#xA;&#xA;% Gaussian filter, as defined by Kovesi&#xA;% www.csse.uwa.edu.au/~pk/Research/MatlabFns/index.html&#xA;sigma = 1;&#xA;g = fspecial('gaussian', max(1, fix(6*sigma)), sigma);  &#xA;&#xA;% Determine smoothed squared image derivatives via convolution&#xA;Ix2 = conv2(Ix.^2, g, 'same'); &#xA;Iy2 = conv2(Iy.^2, g, 'same');&#xA;Ixy = conv2(Ix.*Iy, g, 'same');&#xA;&#xA;% Metric to define the corner score&#xA;cim = (Ix2.*Iy2 - Ixy.^2) - k*(Ix2 + Iy2).^2;    % Original measure&#xA;cim = (Ix2.*Iy2 - Ixy.^2)./(Ix2 + Iy2 + eps);    % Kovesi measure&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="420" LastActivityDate="2013-02-02T20:26:37.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7737" PostTypeId="1" AcceptedAnswerId="7741" CreationDate="2013-02-02T22:16:31.533" Score="4" ViewCount="3097" Body="&lt;p&gt;Say I have an LTI system whose impulse response h[n] is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    h[n] = \delta[n] + \delta[n-4]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the group delay of this system. I know the group delay ($grd$) is defined as:&#xA;$$&#xA;  grd = \frac{-d}{dw}(\angle H(e^{jw}))&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I get $\angle H(e^{jw}) = -4w$ and the $grd = 4$ but I believe this is incorrect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more complicated example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h[n] = -\delta[n+1] + \delta[n] + 2*\delta[n-1] + 2*\delta[n-2] + \delta[n-3] - \delta[n-4]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would my $\angle H(e^{jw})$ be? Thanks for helping me understand something fundamental that I am missing about group delay.&lt;/p&gt;&#xA;" OwnerUserId="3733" LastActivityDate="2013-02-04T16:05:41.320" Title="Group Delay of a system" Tags="|impulse-response|linear-systems|phase|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7738" PostTypeId="1" AcceptedAnswerId="7739" CreationDate="2013-02-03T06:57:12.330" Score="4" ViewCount="2531" Body="&lt;p&gt;I have a question form my teachers, and I cannot understand why I can find out the modulation index form the figure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question provide a Figure like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N8pND.jpg&quot; alt=&quot;Figure 1&quot;&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;And the information signal is a sinusoidal test signal with peak amplitude $6\ \rm V$ and is applied to an AM-DSB-C modulator, the Fourier spectrum of the modulated signal is shown above.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The solution is like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As $\displaystyle \frac {\frac {Acm}{4}}{\frac{Ac}{2}}=\frac{3}{4}$, $m=1.5$, so the modulation index is $1.5$&#xA;  Moreover as $\displaystyle  m=\frac{x}{c}$, the peak amplitude of $s(t)$ is $6\ \rm V$, so the DC offset($c$) is $4\ \rm V$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know where is the $\displaystyle \frac {Ac}{2}=4$ come form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as $s_{AM-DSB-C}(t)=A\big(s(t)+c\big)\cos(2 \pi f_c t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathcal F\left\{s_{AM-DSB-C}(t)\right\} &amp;amp;=S_{AM-DSB-C}(f)\\&#xA;&amp;amp;=\frac{A}{2}\big[S(f-f_c)+S(f+f_c)\big] + \frac {Ac}{2} \big[\delta (f-f_c) + \delta (f+f_c)\big]&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, form the second term we can get $\displaystyle\frac {Ac}{2}=4$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I cannot understand how the solution can get $\displaystyle \frac {Acm}{4}=3$. &lt;/p&gt;&#xA;" OwnerUserId="3420" LastEditorUserId="1629" LastEditDate="2017-12-11T21:44:24.517" LastActivityDate="2017-12-11T21:44:35.840" Title="Finding out modulation index and DC offset" Tags="|fourier-transform|digital-communications|modulation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7739" PostTypeId="2" ParentId="7738" CreationDate="2013-02-03T09:59:17.630" Score="6" Body="&lt;p&gt;The sinusoid test signal is given by&#xA;$$&#xA;s(t) = V_0\cos(2\pi f_0)&#xA;$$&#xA;and its Fourier transform by&#xA;$$&#xA;S(f) = \frac{V_0}{2}\big[\delta(f-f_0) + \delta(f+f_0)\big].&#xA;$$&#xA;Inserted in $S_\mathrm{AM-DSB-C}$ it yields&#xA;$$&#xA;S_\mathrm{AM-DSB-C}(f) = \frac{AV_0}{4}\big[\delta(f-f_c-f_0) + \delta(f-f_c+f_0) + \delta(f+f_c-f_0) + \delta(f+f_c+f_0) \big] + \frac {Ac}{2} \big[\delta (f-f_c) + \delta (f+f_c)\big].&#xA;$$&#xA;Comparing that with the figure given we see that $AV_0/4 = 3$ and $Ac/2 = 4$. Additionaly, $f_0 = 10\text{ kHz, } f_c = 100\text{ kHz}$. Using $m = V_0/c$ and $V_0 = 6\text{ V}$ we find&#xA;$$&#xA;m = 1.5, c = \frac{V_0}{m}=4\text{ V}.&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1629" LastEditDate="2017-12-11T21:44:35.840" LastActivityDate="2017-12-11T21:44:35.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7741" PostTypeId="2" ParentId="7737" CreationDate="2013-02-03T19:29:10.983" Score="5" Body="&lt;p&gt;The z domain transfer function  of the system is the z transform of the system impulse response, so start by taking the Z transform of h[n] ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H[z] = -z^1 + 1 + 2z^{-1} + 2z^{-2}  + z^{-3} -z^{-4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may be able to message this into a nicer form, but that isn't necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, to get the the frequency response, replace z with $e^{jw}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this yields $-e^{jw} + 1 + 2e^{-jw} + 2e^{-2jw}  + e^{-3jw} -e^{-4jw}$ which is a complex function with both a phase and a magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the phase of this expression and you are done.  I don't have time to wrestle this into Magnitude*phase form, so I'll go to your first example which is a simple case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H[z] =  1 + z^{-4} $$&#xA;or&#xA;$$H[z] =  z^{-2}(z^2 + z^{-2}) $$&#xA;then you have&#xA;$$H[e^{jw}] =  e^{-j2w}(e^{j2w} + e^{-j2w}) = 2cos(2w)e^{-j2w} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your phase is the argument of the complex exponential $e^{-j2w}$, so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\angle H(e^{jw})$ is the expression $-2w$&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-02-04T16:05:41.320" LastActivityDate="2013-02-04T16:05:41.320" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7742" PostTypeId="1" CreationDate="2013-02-04T14:40:16.223" Score="1" ViewCount="321" Body="&lt;p&gt;I have posted a question on Stackoverflow and was suggested to post here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please refer this question for the images: &lt;a href=&quot;https://stackoverflow.com/questions/14534202/seperating-similiar-object-in-an-image-opencv-python&quot;&gt;Similar Question&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used SURF Keypoints and a &lt;strong&gt;FLANN Based matcher&lt;/strong&gt; and plotted the matching Keypoints as circles and then drawn the rectangle grouping all the keypoints.&#xA;As you can see, there are multiple vehicles matching the Template. I want to group the keypoints in a way such that I can get the count of the matching Vehicles.&#xA;How can I go about doing this?&#xA;I know that I can't just use a clustering method because, I need to group them more than just spatially.&lt;/p&gt;&#xA;" OwnerUserId="3735" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-02-04T14:40:16.223" Title="Separating similiar object in an image" Tags="|image-processing|opencv|image-segmentation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7743" PostTypeId="1" AcceptedAnswerId="7744" CreationDate="2013-02-04T15:21:28.777" Score="3" ViewCount="178" Body="&lt;p&gt;My text book (Communication Systems analysis and design P.334, 335) have a FM signal is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$s_{FM}(t) = A cos[2\pi[f_c+ks(t)]t+\phi]$ where k is a constant and $\phi$ is the arbitrary phase angles&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;then the textbook suggest&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;while in FM, instantaneous frequency minus carrier frequency is a linear function of s(t)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, I try to prove the $s_{FM}(t)$ is a FM signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The instantaneous frequency is $f(t)= \frac {d\psi}{dt}=2\pi f_c+2 \pi s'(t) t +2 \pi s(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the instantaneous carrier ferquency is $f_{carrier} (t)=\frac{d\psi_{carrier}}{dt}=\frac {d}{dt} [2 \pi f_c t + \theta]=2 \pi f_c$. Assume the carrier signal is $Asin(2 \pi f_c t + \theta)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, $f(t)-f_{carrier}(t)=2 \pi s'(t) t +2 \pi s(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And my problem is why the text book suggest that signal is a FM signal? Clearly, I cannot prove the signal is linear.&lt;/p&gt;&#xA;" OwnerUserId="3420" LastActivityDate="2013-02-05T03:30:54.370" Title="About FM signal's proving" Tags="|modulation|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7744" PostTypeId="2" ParentId="7743" CreationDate="2013-02-04T15:54:17.170" Score="2" Body="&lt;p&gt;As you have correctly derived, the difference of carrier and instantaneous frequency is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;g(s(t)) = \omega(t) - \omega_\mathrm{carrier} = 2\pi k s(t) + 2\pi k s(t)'t&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will omit $t$ for convenience. If $g(s)$ is a linear function of $s$ it must fulfill the following condition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;g(c(a + b)) = cg(a) + cg(b)&#xA;$$&#xA;So here:&#xA;$$&#xA;g(c(a+b)) = 2\pi k c(a + b) + 2\pi k \left[\frac{d}{dt}(c(a + b))\right]t\\&#xA;= 2\pi k c a + 2\pi k c b + 2\pi k c a' t + 2\pi k c b' t\\&#xA;= c(2\pi k a + 2\pi k a' t) + c(2\pi k b + 2\pi k b' t)\\&#xA;= cg(a) + cg(b)&#xA;$$&#xA;Thus, $g(s(t))$ is indeed a linear function of $s(t)$.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-02-04T15:54:17.170" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7745" PostTypeId="2" ParentId="7728" CreationDate="2013-02-04T18:33:11.257" Score="2" Body="&lt;p&gt;I haven't used it, but have heard good things about armadillo ( &lt;a href=&quot;http://arma.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;http://arma.sourceforge.net/&lt;/a&gt; ) for matlab-like functionality.  There are a few others like it, but it seems that armadillo is optimized and actively developed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of the appeal of octave, matlab, or python/numpy/scipy (sometimes called &quot;pylab&quot;) is the simple syntax along with an interactive interpreter with tab completions.  This can speed up development quite a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With python/numpy, it's possible to wrap a dll with a python wrapper, and use it from within the interactive interpreter.  I believe this can also be done with matlab, but I'm unsure if this can be done in octave.  Be warned, however, that this can be slightly complicated in python/numpy though I've found the benefits to be worth the cost in the past when performance is critical.  &lt;/p&gt;&#xA;" OwnerUserId="3644" LastActivityDate="2013-02-04T18:33:11.257" CommentCount="0" CommunityOwnedDate="2013-02-07T11:30:10.930" ContentLicense="CC BY-SA 3.0" />
  <row Id="7746" PostTypeId="1" CreationDate="2013-02-04T18:54:28.320" Score="3" ViewCount="116" Body="&lt;p&gt;This is a simple question. Fourier analysis gives us the DFT, which is known as a global transform of a signal. In contrast, the Discrete Wavelet Transform (DWT) has a plethora of wavelets, all of which fall under the umbrella of local transforms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder, might there be other global transforms besides projection onto a family of orthogonal complex exponentials as with the DFT? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I am aware of the DST and DCT, however I am looking for applicable non-sinusoidal bases). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2013-02-04T19:04:35.590" LastActivityDate="2013-02-04T19:04:35.590" Title="Global Transforms besides the DFT?" Tags="|fourier-transform|frequency|transform|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7748" PostTypeId="1" CreationDate="2013-02-04T22:29:18.260" Score="11" ViewCount="2032" Body="&lt;p&gt;I was doing some reading up on image segmentation techniques and I was wondering about modern day, state-of-the-art segmentation algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What current segmentation techniques that are a 'must-read', i.e. currently most commonly used in the community? Which techniques did you came in contact with and found most effective and useful (and for which application)?&lt;/p&gt;&#xA;" OwnerUserId="1911" LastEditorUserId="1273" LastEditDate="2013-10-09T09:09:07.843" LastActivityDate="2014-01-13T16:39:14.437" Title="Most common modern day Image Segmentation techniques" Tags="|image-processing|image-segmentation|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7749" PostTypeId="1" AcceptedAnswerId="7758" CreationDate="2013-02-05T00:49:01.653" Score="1" ViewCount="150" Body="&lt;p&gt;Suppose I have a system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = x[n] + x[n-1] + x[0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see if this system is time-variant, we can compare $H\{x[n-1]\}$ to $y[n-1]$ and check that they are different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the delayed (by 1 unit) response to $x[n]$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n-1] = x[n-1] + x[n-2] + x[-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, I'm having &lt;em&gt;an issue understanding why&lt;/em&gt;. How does the $x[0]$ term (from $y[n]$) become $x[-1]$ while calculating $y[n-1]$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, to calculate $y[n-1]$, I thought it would be reasonable to replace $n$ by $(n-1)$ in the equation, which would result in $y[n-1] = x[n-1] + x[n-2] + x[0]$. I mean, if $y[n]$ &lt;em&gt;response contains a constant tern&lt;/em&gt; $x[0]$, I &lt;em&gt;expect this value to remain&lt;/em&gt; in $y[n]$ independent of the $n$ index.&#xA;&lt;strong&gt;Why that's not the case ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I also have a problem with a different system:&#xA;$$y[n] = x[2n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why this system presents a delayed response:&#xA;$$y[n-1] = x[2n - 1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(instead of $y[n-1]=x[2n-2]$) and why its response to the shifted (by 1 unit) input is $H\{x[2n - 2]\}$ instead of $H\{x[2n -1]\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks like I have doubts about how to calculate the delayed response. Can you point out to problems in my examples to help clarify it?&lt;/p&gt;&#xA;" OwnerUserId="3739" LastEditorUserId="1273" LastEditDate="2013-02-05T10:37:46.740" LastActivityDate="2013-02-05T14:33:41.137" Title="Calculating a delayed response of a system" Tags="|linear-systems|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7750" PostTypeId="1" AcceptedAnswerId="7755" CreationDate="2013-02-05T02:30:42.957" Score="1" ViewCount="600" Body="&lt;p&gt;I am converting color from RGB to CIELab to train a GMM. When I get back the mean of clusters of the GMM I have sometimes negatives values in RGB space. I was wondering if the mean of only visible color can be non visible color ? Therefore I was also wondering if the visual color of CIELab forms a convex shape. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &#xA;I'm using Expectation-Minimization of OpenCV to train the Gaussian Mixture Model.&lt;/p&gt;&#xA;" OwnerUserId="1972" LastEditorUserId="1972" LastEditDate="2013-02-06T01:29:01.017" LastActivityDate="2013-02-06T01:29:01.017" Title="Is the mean of visible color in CIELab color space can be non visible color?" Tags="|image-processing|color|conversion|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7751" PostTypeId="1" CreationDate="2013-02-05T02:48:02.443" Score="5" ViewCount="1097" Body="&lt;p&gt;Ok, so I'm trying to compare two different speech signals and I have come into a problem. Here goes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have split the signal into blocks, and I have computed the MFCC coefficients of each block. I then use a DTW algorithm to compare the (inputted) signal to the training signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The training data is the MFCC values of a signal of someone saying &quot;No&quot;. If I have the inputted signal of someone saying no the values then give:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;13.9462, &#xA;  55.8784, &#xA;  38.3383, &#xA;  29.9468, &#xA;  32.7136, &#xA;  24.8893, &#xA;  34.0734, &#xA;  24.3645, &#xA;  39.329, &#xA;  20.4847, &#xA;  31.1939, &#xA;  29.8841, &#xA;  25.7655, &#xA;  28.222, &#xA;  23.1643, &#xA;  33.4366, &#xA;  .....,&#xA;  ......&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where the max data for this dataset is: &lt;code&gt;97.4834&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the data for someone saying a different word:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;28.6696,&#xA;  65.8777,&#xA;  44.2725,&#xA;  31.6083,&#xA;  42.6541,&#xA;  38.4104,&#xA;  26.6311,&#xA;  34.9188,&#xA;  37.2065,&#xA;  25.2479,&#xA;  41.5969,&#xA;  54.2681,&#xA;  37.0685,&#xA;  26.2073,&#xA;  33.9836,&#xA;  38.7847,&#xA;  28.3622,&#xA;  67.8788,&#xA;  74.9075,&#xA;  .....,&#xA;  .....&#xA;  Where the max value in this dataset is: 97.5609&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My guess (reading through the algorithm) is that the smallest difference should be the correct result. However, I do not know if it is possible to either:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Calculate the MAX value for each dataset and then see which value is smaller&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Get the first variable and compare it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any suggestions to how I would compare these kind of values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2022-04-02T15:08:05.790" Title="Dynamic Time Warping - Comparing Values" Tags="|speech-recognition|mfcc|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7753" PostTypeId="1" CreationDate="2013-02-05T04:25:35.500" Score="0" ViewCount="84" Body="&lt;p&gt;I have &lt;strong&gt;one cycle&lt;/strong&gt; of the following signal stored in a memory:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; x(n)=sin(2 * pi * n/N + theta)&#xA;&#xA; where  theta= 2*pi*q/N and q, N are integers. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I use these values to obtain sinusoides (samples) with same frequency but different phase?  &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="1598" LastEditDate="2013-02-05T09:50:00.597" LastActivityDate="2013-02-05T13:24:20.157" Title="Using phase information to extract sample values" Tags="|discrete-signals|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7754" PostTypeId="1" CreationDate="2013-02-05T01:52:32.477" Score="0" ViewCount="43" Body="&lt;p&gt;I have to develop a software where the user inputs a 16 bits binary sequence, which is supposed to be the codification of a FM (or even AM) signal, then I should graph it according to Frequence / Time ....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What procedure I should take to treat such input?&lt;/p&gt;&#xA;" OwnerUserId="4116" OwnerDisplayName="Diego" LastEditorUserId="26573" LastEditDate="2018-09-24T22:46:01.597" LastActivityDate="2018-09-24T22:46:01.597" Title="How can I graph a simulation of a FM 16 bits codification?" Tags="|modulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7755" PostTypeId="2" ParentId="7750" CreationDate="2013-02-05T08:30:59.340" Score="1" Body="&lt;p&gt;You are &lt;a href=&quot;http://en.wikipedia.org/wiki/SRGB#The_forward_transformation_.28CIE_xyY_or_CIE_XYZ_to_sRGB.29&quot; rel=&quot;nofollow&quot;&gt;implicitly using sRGB&lt;/a&gt;, a small color space. You might like to try using &lt;a href=&quot;http://en.wikipedia.org/wiki/ScRGB&quot; rel=&quot;nofollow&quot;&gt;scRGB&lt;/a&gt;, a similar color space that allows such values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The average of visible colors should also be visible, however the calculation should be performed in a &lt;a href=&quot;http://www.scholarpedia.org/article/Color_spaces#Perceptual_uniformity%3a_by_attribute_or_isotropic&quot; rel=&quot;nofollow&quot;&gt;perceptual color space&lt;/a&gt; for the result to be more meaningful; L*a*b* is better than sRGB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question to ponder is whether the centers make sense in L*a*b*. Perhaps you have a bug?&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-02-05T08:30:59.340" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7756" PostTypeId="1" CreationDate="2013-02-05T09:08:58.307" Score="1" ViewCount="92" Body="&lt;p&gt;In Matlab I've got to generate a Gaussian process embodying a certain frequency content. Not to go multidimensional, I have used &lt;code&gt;reshape&lt;/code&gt; function. I explain better with a piece of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dk1 = 2*pi*L/L1;&#xA;dk2 = 2*pi*L/L2;&#xA;dk3 = 2*pi*L/L3;&#xA;k1 = dk1*(-N1/2:(N1/2-1));&#xA;k2 = dk2*(-N2/2:(N2/2-1));&#xA;k2min = min(k2);&#xA;k2max = max(k2);&#xA;k3 = dk3*(-N3/2:(N3/2-1));&#xA;k3min = min(k3);&#xA;k3max = max(k3);&#xA;k = allcomb(k1,k2,k3);&#xA;k1 = reshape(k(:,1),[1,N]);&#xA;k2 = reshape(k(:,2),[1,N]);&#xA;k3 = reshape(k(:,3),[1,N]);&#xA;k = sqrt(k1.^2 + k2.^2 + k3.^2);&#xA;idx = (k1~=0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;allcomb&lt;/code&gt; may be found here: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/10064&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/10064&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Afterwards, I proceed as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k30 = k3(idx) + beta.*k1(idx);&#xA;k0 = sqrt(k1(idx).^2 + k2(idx).^2 + k30.^2);&#xA;&#xA;C1 = (beta.*k1(idx).^2.*(k1(idx).^2 + k2(idx).^2 - k3(idx).*k30))./(k(idx).^2.*(k1(idx).^2 + k2(idx).^2));&#xA;C2 = ((k2(idx).*k0.^2)./((k1(idx).^2 + k2(idx).^2).^(3/2))).*atan2((beta.*k1(idx).*sqrt(k1(idx).^2 + k2(idx).^2)),(k0.^2 - k30.*k1(idx).*beta));&#xA;&#xA;xhsi1 = C1 - (k2(idx)./k1(idx)).*C2;&#xA;xhsi2 = (k2(idx)./k1(idx)).*C1 + C2;&#xA;&#xA;Ek0 = 1.453.*k0.^4./((1 + k0.^2).^(17/6));&#xA;&#xA;B = sigma_iso*sqrt((2*pi.^2*L.^3.*Ek0)./(V.*k0.^4));&#xA;&#xA;%% C-matrix Calculation for all those k satisfying the condition |k| &amp;gt; 3&#xA;&#xA;C = zeros(3,3,N);&#xA;% In this case, the approximation proposed in Mann[94],Mann[98] and IEC&#xA;% 61400-1 3rd Ed. will be used&#xA;C(1,1,idx) = B.*(k2(idx).*xhsi1);&#xA;C(1,2,idx) = B.*(k3(idx) - k1(idx).*xhsi1 + beta.*k1(idx));&#xA;C(1,3,idx) = B.*(-k2(idx));&#xA;&#xA;C(2,1,idx) = B.*(k2(idx).*xhsi2 - k3(idx) - beta.*k1(idx));&#xA;C(2,2,idx) = B.*(-k1(idx).*xhsi2);&#xA;C(2,3,idx) = B.*(k1(idx));&#xA;&#xA;C(3,1,idx) = B.*(k2(idx).*((k0./k(idx)).^2));&#xA;C(3,2,idx) = B.*(-k1(idx).*((k0./k(idx)).^2));&#xA;&#xA;nn = normrnd(0,1,[3,N]);&#xA;&#xA;u = zeros(3,N);&#xA;for l = 1:size(C,3)&#xA;    u(:,l) = C(:,:,l)*nn(:,l);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, I need a 3D fft of &lt;code&gt;u&lt;/code&gt;; thus, I use &lt;code&gt;reshape&lt;/code&gt; once more as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u = reshape(u,[3,N1,N2,N3]);&#xA;U = fftn(u);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I believe that this flow is somehow affecting and corrupting the right frequency content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, I would go for:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[k1,k2,k3] = ndgrid(k1,k2,k3);&#xA;k = sqrt(k1.^2 + k2.^2 + k3.^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;further to u calculation. The core of the code would switch to 5D instead of 3D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea how to improve this code? Or may you spot the flaw?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any support or criticism are welcome.&lt;/p&gt;&#xA;" OwnerUserId="3666" LastActivityDate="2013-02-05T09:08:58.307" Title="Keep the exact frequency content - Multidimensional fft" Tags="|fft|matlab|frequency-domain|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7757" PostTypeId="1" AcceptedAnswerId="7759" CreationDate="2013-02-05T10:29:31.100" Score="8" ViewCount="2863" Body="&lt;p&gt;From the high school maths we know that y=mx+c is a linear equation. However, in DSP the linear system must satisfy Additivity properties which y=mx+c does not hold because of +c. &#xA;So, is the definition of Linearity different in DSP and Maths? if so why? &#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3741" LastActivityDate="2013-02-05T23:54:40.937" Title="Problem with the definition of Linearity" Tags="|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7758" PostTypeId="2" ParentId="7749" CreationDate="2013-02-05T10:36:18.597" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://dsp.stackexchange.com/questions/3528/verifying-linear-time-invariance/3532#3532&quot;&gt;answer&lt;/a&gt; @Juancho liked to is indeed very useful. To me it looks like you don't understand time invariance fully, and that answer sould clarify things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, concerning your questions of &lt;strong&gt;getting the delayed response of the systems&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the first system, $y[n] = x[n] + x[n-1] + x[0]$, &lt;em&gt;you are right&lt;/em&gt;. &lt;strong&gt;The constant term will not change&lt;/strong&gt;, since it is constantly $x[0]$, and thus not dependent of $n$. The correct delayed response is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n-1] = x[n-1] + x[n-2] + x[0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can calculate that by substituting $n$ by $m-1$ (or $n-1$, it's the same which letter you use, but it's simpler for me to use a different letter while substituting). Now, whit $n=m-1$, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = y[m-1] = x[(m-1)] + x[(m-1)-1] + x[0] = x[m-1] + x[m-2] + x[0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you get the final result (when you can't simplify any more), you can change the variable name from $m$ to $n$ again and get the first formula above.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;With the second system, you employ the same logic to get the delayed response. Starting from:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = x[2n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a delayed response you must substitute $n$ with $m-1$ and you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$n = m-1$$&#xA;$$y[n] = y[m-1] = x[2 \times (m-1)] = x[2m - 2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and now you can change the variable name again to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n-1] = x[2n - 2]$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are explanations on &lt;strong&gt;how to calculate a delayed response (by 1).&lt;/strong&gt; Looking at a &lt;strong&gt;response of a system delayed by 1&lt;/strong&gt; actually means that at time $n=5$, you will be looking at a response that you would normally get for $n=4$. &lt;em&gt;The system is delayed, i.e. it behaves as the original, just with some time-delay&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To put it very simply, if I mark the delayed response by $y'[n]$, and the original by $y[n]$, this would hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y'[1] = y[0]$$&#xA;$$y'[2] = y[1]$$&#xA;$$y'[100] = y[99]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and more generally:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y'[n] = y[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For understanding time-invariance in systems, consult the linked question since that's precisely its topic.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To comment on the incorrect answers you proposed as delayed responses: they are actually &lt;strong&gt;responses to a delayed input&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What that means is that you will be feeding your &lt;em&gt;original&lt;/em&gt; system with a &lt;em&gt;delayed&lt;/em&gt; input. If your original input signal was $x[n]$, to get a response to a delayed input, you actually want to &quot;feed&quot; your system to a signal $x'[n] = x[n-1]$. Let's mark &lt;em&gt;systems response to a delayed input&lt;/em&gt; with $y''[n]$ and calculate that for your first example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y''[n] = x'[n] + x'[n-1] + x'[0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system &lt;em&gt;didn't change&lt;/em&gt;: It's still calculating the same operation: summing up the input at time $n$ with the input at time $n-1$ with the value of the input at time $0$. &lt;strong&gt;But, the input changed!&lt;/strong&gt;. Substituting $x'[n] = x[n-1]$, you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y''[n] = x[(n)-1] + x[(n-1)-1] + x[(0)-1] = x[n-1] + x[n-2] + x[-1]$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To summarize, in order for a system to be time-invariant, the &lt;em&gt;response of the system delayed by $k$&lt;/em&gt; should be the same as the &lt;em&gt;response of the system to the input delayed by $k$&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, we were just examining delays by $1$. What proves that the system is &lt;strong&gt;not time-invariant&lt;/strong&gt; in you case is the fact that $y'[n] \neq y''[n]$ because you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y'[n] = y[n-1] = x[n-1] + x[n-2] + x[0]$$&#xA;$$y''[n] = x'[n] + x'[n-1] + x'[0] = x[n-1] + x[n-2] + x[-1]$$&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-02-05T14:33:41.137" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7759" PostTypeId="2" ParentId="7757" CreationDate="2013-02-05T11:58:15.060" Score="12" Body="&lt;p&gt;Yes, in some sense the definitions are different. I'll give you two points of view, the first one will support your keen observation, the other will provide evidence for the contrary. These two do not conflict with each other, it's a matter of semantics. If the second one confuses you stick with the first one. Prelude concluded, here goes.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem Definition 1&lt;/strong&gt;: $y = mx + c $ means $f(x)=mx+c$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here we take the usual point of view in which $y$ is assumed to be the output of some manipulations on $x$. We call that something a function, and we can write down the same expression with a little more mathematical elegance: $f(x)=mx+c$. It is now clear that $f(x)$ is in some sense on &lt;em&gt;output&lt;/em&gt; of some mathematical manipulation to which $x$ is the &lt;em&gt;input&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's refresh criteria for linearity. A function $g(x)$ is linear is it satisfies both of the following conditions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$g(a+b) = g(a)+g(b)$ for all $a$ and $b$&lt;/li&gt;&#xA;&lt;li&gt;$g(cx) = cg(x)$ for all constants $c$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Clearly, our favorite function $f(x)$ does not satisfy either of these properties. So yes, from this perspective $f(x)$ is not a linear function. The closest thing to &quot;linear&quot; we can call it is &quot;&lt;a href=&quot;http://www.math.ubc.ca/~cass/courses/m309-03a/a1/olafson/affine_fuctions.htm&quot;&gt;affine&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q.E.D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may now brace yourself for part 2 of the answer.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem Definition 2&lt;/strong&gt;: $y = mx + c $ means $L(x,y)=y-mx$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take it one step at a time. Suppose you're trying to solve a system of two linear equations. How do you do it? One way is to write down the equations as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} y &amp;amp;= m_1x + c_1\\y &amp;amp;= m_2x + c_2 \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surely, that's how we've all been doing it since seventh grade. Now all you have to do is solve it by substitution or whichever way you prefer. But what do you do when you have a system of equations of more that two variables? Will you write it down like so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} y &amp;amp;= a_1x + c_1z + d_1\\y &amp;amp;= a_2x + c_2z + d_2\\y &amp;amp;= a_3x + c_3z + d_3 \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That doesn't really look right. And for a very good reason. There are many ways of interpreting functions of any number of variables, and it's not just the semantics that's different. To digress for a moment, take the equation $x^2+y^2=r^2$. Almost anyone (visiting this forum that is) will immediately identify it as an equation of a circle. But recall definition of a &lt;em&gt;function&lt;/em&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we interpret it as $f(x) = \pm \sqrt{r^2-x^2}$ we get two solutions: an upper half of a circle and a lower half of a circle. The entire circle cannot be a solution because it violates the property that in functions, for every input there's at most one unique output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we on the other hand interpret it as $f(x,y)=r^2$, we get back the entire circle as a solution, because we're viewing it as a function of two variables equal to a constant. In other words, even though we're written the same expression $x^2+y^2=r^2$, we &lt;em&gt;must&lt;/em&gt; define what we're talking about. Otherwise this problem is not well-defined. In one interpretation it is a function $f:\mathbb{R} \rightarrow \mathbb{R}$, in another interpretation it is a function $f:\mathbb{R^2} \rightarrow \mathbb{R}$. Remember all that mumble about domains and ranges in high school? Yeah, this is exactly what it is. Now, back to our myterious topic of linear functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, by this point you're already has your &lt;em&gt;aha!&lt;/em&gt; moment. If not, here's our finish straight. Remember that system of three equations that didn't quite look right? First of all note that it looks affine, because in addition to variables $x$ and $z$ there are constants $d$ as well. Now a nicer way of writing down this system of equations is like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} -a_1x + y + -c_1z &amp;amp;= d_1 \\ -a_2x + y + -c_2z &amp;amp;= d_2 \\ -a_3x + y + -c_3z &amp;amp;= d_3\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we're getting somewhere. As you can see, we can write it out in matrix form as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{bmatrix} -a_1 &amp;amp;1 &amp;amp;-c_1 \\-a_2 &amp;amp;1 &amp;amp;-c_2 \\-a_3 &amp;amp;1 &amp;amp;-c_3 \end{bmatrix}\begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} d_1 \\ d_2 \\ d_3 \end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, this is a &lt;em&gt;linear&lt;/em&gt; system of equations. Where's the catch? Well, at first it looked like a system of three functions of the form $f:\mathbb{R^2} \rightarrow \mathbb{R}$, and now we're representing it as a single function of the form $f:\mathbb{R^3} \rightarrow \mathbb{R^3}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, this is a &lt;em&gt;single function&lt;/em&gt; which takes in a vector in $\mathbb{R}^3$ and returns another vector in $\mathbb{R}^3$. Let's call this function $L(x,y,z)$, precicely $L:\mathbb{R^3} \rightarrow \mathbb{R^3}$. I will let you check that this function is &lt;em&gt;linear&lt;/em&gt;. Concretely, if $\begin{bmatrix} a_{11} &amp;amp;a_{12} &amp;amp;a_{13} \\a_{21} &amp;amp;a_{22} &amp;amp;a_{23} \\a_{31} &amp;amp;a_{32} &amp;amp;a_{33} \end{bmatrix}\begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} d_1 \\ d_2 \\ d_3 \end{bmatrix}$ and $\begin{bmatrix} a_{11} &amp;amp;a_{12} &amp;amp;a_{13} \\a_{21} &amp;amp;a_{22} &amp;amp;a_{23} \\a_{31} &amp;amp;a_{32} &amp;amp;a_{33} \end{bmatrix}\begin{bmatrix} \alpha \\ \beta \\ \gamma \end{bmatrix} = \begin{bmatrix} \delta_1 \\ \delta_2 \\ \delta_3 \end{bmatrix}$, then&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$\begin{bmatrix} a_{11} &amp;amp;a_{12} &amp;amp;a_{13} \\a_{21} &amp;amp;a_{22} &amp;amp;a_{23} \\a_{31} &amp;amp;a_{32} &amp;amp;a_{33} \end{bmatrix}\begin{bmatrix} x+\alpha \\ y+\beta \\ z+\gamma \end{bmatrix} = \begin{bmatrix} d_1 + \delta_1 \\ d_2 + \delta_2 \\ d_3 + \delta_3 \end{bmatrix}$, and&lt;/li&gt;&#xA;&lt;li&gt;$\begin{bmatrix} a_{11} &amp;amp;a_{12} &amp;amp;a_{13} \\a_{21} &amp;amp;a_{22} &amp;amp;a_{23} \\a_{31} &amp;amp;a_{32} &amp;amp;a_{33} \end{bmatrix}\begin{bmatrix} kx \\ ky \\ kz \end{bmatrix} = \begin{bmatrix} kd_1 \\ kd_2 \\ kd_3 \end{bmatrix}$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In other words (and yes, this is the real reason mathematicians keep constantly coming up with new concise notation!), let $\vec{u},\vec{v} \in \mathbb{R}^3$ ($\vec{u}$ and $\vec{v}$ and 3-dimensional vectors of real numbers). Then&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$L(\vec{u}+\vec{v}) = L(\vec{u})+L(\vec{v})$&lt;/li&gt;&#xA;&lt;li&gt;$L(k\vec{u}) = kL(\vec{u})$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Linear! Q.E.D.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In conclusion, we've explored mysterious subtleties of mathematics of functions and in particular the importance of defining problems well. The function $f(x) = mx + c$ is obviously non-linear (or more precisely affine), and the function $g(x,y) = y - mx$ is linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Come back for more interesting stuff. We like giving twisted answers to simple questions.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2013-02-05T23:54:40.937" LastActivityDate="2013-02-05T23:54:40.937" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7760" PostTypeId="2" ParentId="7753" CreationDate="2013-02-05T13:24:20.157" Score="2" Body="&lt;p&gt;If the values are stored in a linear array indexed by $n$, read the values out &#xA;sequentially from a &lt;em&gt;different&lt;/em&gt; starting point in the array, that is beginning with a &lt;em&gt;nonzero&lt;/em&gt; value of $n$, and have the read out &quot;wrap&quot; around the end of the array, that&#xA;is, the incrementing of the index is done &lt;em&gt;modulo&lt;/em&gt; $N$. This gives sinusoids&#xA;with possible initial&#xA;phases $0, 2\pi/N, (2)2\pi/N, (3)2\pi/N, \ldots, (N-1)2\pi/N$ depending on the&#xA;choice of starting point of the read out.  If you want other values&#xA;for the initial phase, you will need to do some computations, and not just&#xA;a plain reading out from memory.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-02-05T13:24:20.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7761" PostTypeId="2" ParentId="7754" CreationDate="2013-02-05T13:49:56.087" Score="1" Body="&lt;p&gt;It's hard to tell what you're asking here, but it sounds like you have a discrete-time frequency-modulated signal with 16 bits per sample. In order to convert this to a frequency-versus-time signal, you want to demodulate the FM. One way to do this is with an FM discriminator. A digital implementation could look like this (assuming a complex input signal $x[n]$ sampled at a rate of $f_s$ Hz):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_{d}[n] = x[n]x^*[n-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f[n] = \text{atan2}\left(\text{Im}[x_d[n]], \text{Re}[x_d[n]]\right) \frac{f_s}{2\pi}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This simple implementation estimates the frequency of the signal $x[n]$ using a first-order phase difference. The phase of the product $x_d[n]$ is equal to the phase difference between successive samples $x[n]$ and $x[n-1]$. This phase difference can be used as an approximation of the frequency of the signal at time $n$. To extract the phase of $x_d[n]$, we use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Atan2&quot; rel=&quot;nofollow&quot;&gt;atan2&lt;/a&gt; function, then scale it appropriately so that $f[n]$ is measured in Hz. $f[n]$ is then the estimated frequency modulation input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; As I said before, this technique assumes a complex input signal. If what you have is real-valued, you'll want to convert $x[n]$ to &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;analytic signal&lt;/a&gt; format first.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-02-05T13:49:56.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7763" PostTypeId="1" CreationDate="2013-02-05T15:28:59.657" Score="2" ViewCount="116" Body="&lt;p&gt;Question: Can anyone refer me the Phong reflection model parameters for a face image taken for web-cam?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Details:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing 3D reconstruction of 2D images using 3D Morphable Model as in this paper &lt;a href=&quot;http://gravis.cs.unibas.ch/publications/pami03.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vetter &amp;amp; Blanz, 2003&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a cost function which needs to be optimized using Newton Method. I need to give initialization values for the Newton method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below equation is the phong reflection model of an image. The ambient, diffuse and the specualr components are shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6MFWz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Phong_reflection_model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phong Reflection Model wiki&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phong Parameters: Ks, Kd, Ka, α, Lm, V&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am estimating the above parameters using Newton method. The image is of human face and the camera is web-cam.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I gave the below values: Ks = Kd = Ka = 0.6&#xA;α = 5&#xA;Lm = [0 1 1]&#xA;V = [0 0 1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone comment on the above values and what can be a good initialization values for the parameters??&lt;/p&gt;&#xA;" OwnerUserId="3147" LastEditorUserId="5886" LastEditDate="2014-01-13T19:05:18.693" LastActivityDate="2014-01-13T19:05:18.693" Title="Phong Reflection Model Parameters" Tags="|image-processing|computer-vision|algorithms|3d|optimization|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7764" PostTypeId="2" ParentId="7728" CreationDate="2013-02-05T17:18:38.697" Score="4" Body="&lt;p&gt;Have you checked out &lt;a href=&quot;http://gnuradio.org/redmine/projects/gnuradio/wiki&quot; rel=&quot;nofollow&quot;&gt;gnuradio&lt;/a&gt;? They have blocks similar to what is used in signal processing. When I used to a few years ago, there were a large number of blocks that were already available and more in the works, all written in C++. The blocks were glued together using python, but a complete C++ implementation was in the works.&lt;/p&gt;&#xA;" OwnerUserId="3670" LastActivityDate="2013-02-05T17:18:38.697" CommentCount="0" CommunityOwnedDate="2013-02-07T11:30:10.930" ContentLicense="CC BY-SA 3.0" />
  <row Id="7765" PostTypeId="1" CreationDate="2013-02-05T18:02:57.003" Score="2" ViewCount="81" Body="&lt;p&gt;The camera uses two cameras and reflective infrared markers to compute 3D positions. For recognized marker configurations, the camera computes a translation and an orientation (quaternion). For stray markers, only the position is returned. The camera sends updates at 20-60 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compute the depth (z-value) of a marker, the camera uses two noisy images. That means the noise in the z-dimension is different (and larger) than the noise in x and y. The noise increases with distance. For recognized configurations (translation+orientation), the noise distribution is pretty unclear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you go about filtering this kind of data? We're mainly interested in getting rid of the jitter which is most noticeable when the trackers are just lying around or moving very slowly.&lt;/p&gt;&#xA;" OwnerUserId="3745" LastActivityDate="2013-02-05T18:02:57.003" Title="Smoothing data from a 3D camera" Tags="|filters|noise|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7766" PostTypeId="1" AcceptedAnswerId="7870" CreationDate="2013-02-05T18:10:37.863" Score="3" ViewCount="1583" Body="&lt;p&gt;Was recommended to migrate this question from SO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am building an iOS app that, as a key feature, incorporates image matching. The problem is the images I need to recognize are small orienteering 10x10 plaques with simple large text on them. They can be quite reflective and will be outside(so the light conditions will be variable). Sample image &lt;a href=&quot;http://i1274.photobucket.com/albums/y425/Chris_Mitchelmore/2_zpsce84d4f3.png&quot; rel=&quot;nofollow&quot;&gt;http://i1274.photobucket.com/albums/y425/Chris_Mitchelmore/2_zpsce84d4f3.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There will be up to 15 of these types of image in the pool and really all I need to detect is the text, in order to log where the user has been.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I am facing is that with the image matching software I have tried, aurasma and slightly more successfully arlabs, they can't distinguish between them as they are primarily built to work with detailed images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to accurately detect which plaque is being scanned and have considered using gps to refine the selection but the only reliable way I have found is to get the user to manually enter the text. One of the key attractions we have based the product around is being able to detect these images that are already in place and not have to set up any additional material.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest a piece of software that would work(as is iOS friendly) or a method of detection that would be effective and interactive/pleasing for the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample environment:&#xA;&lt;a href=&quot;http://www.orienteeringcoach.com/wp-content/uploads/2012/08/startfinishscp.jpeg&quot; rel=&quot;nofollow&quot;&gt;http://www.orienteeringcoach.com/wp-content/uploads/2012/08/startfinishscp.jpeg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The environment can change substantially, basically anywhere a plaque could be positioned they are; fences, walls, and posts in either wooded or open areas, but overwhelmingly outdoors.&lt;/p&gt;&#xA;" OwnerUserId="3746" LastEditorUserId="3746" LastEditDate="2013-02-06T08:55:09.820" LastActivityDate="2013-02-16T15:19:35.737" Title="Image Matching on iOS" Tags="|image-processing|object-recognition|matched-filter|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7767" PostTypeId="2" ParentId="4737" CreationDate="2013-02-05T20:01:24.577" Score="3" Body="&lt;p&gt;When I do everything exactly as you outline in your post, except change x to the following-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = [ones(1,5), -ones(1,5)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following plot-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TEmPV.png&quot; alt=&quot;Short square wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT bin 2 is the first harmonic and FFT bin 4 is the third harmonic (square waves only have odd harmonics).  Likewise, FFT bin 10 is the negative first harmonic, and FFT bins 8 and 6 are the negative third and fifth harmonics, respectively.  You can see that the harmonics gradually diminish in power.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-02-05T20:01:24.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7768" PostTypeId="2" ParentId="4737" CreationDate="2013-02-05T20:24:07.613" Score="5" Body="&lt;p&gt;From the Wikipedia article on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Discrete Fourier Transform&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The sequence of $N$ complex numbers $x_0, ..., x_{N−1}$ is transformed into an $N$-periodic sequence of complex numbers according to the DFT formula:&#xA;  $$ X_k=\sum_{n=0}^{N-1} x_n e^{-2\pi ikn/N}.$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What you have done is taken $N=10$ integers, $n=\{1,2,...,N\}$, and turned them into $10$ time samples $t=\{T_s,2T_s,...,NT_s\}$, or $t_n=nT_s$. (To clarify my notation change, this second set is what you called $n$.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you created the signal $x_n=\text{square}(2\pi ft_n)$ with period $f=(NT_s)^{-1}$and fed it into MATLAB's FFT algorithm, attempting to take the DFT of it (as the FFT is just a fast DFT). However, this is NOT what the FFT expects to see!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your signal starts with $x_1$ and ends with $x_N$. However, if you see the definition of the DFT I gave above, it expects the signal to start with $x_0$ and end with $x_{N-1}$. Ordinarily, this would not be much of a problem, because if your signal $x$ is actually $N$-periodic, then $x_0=x_N$.&#xA;However, as noted in the comments by &lt;a href=&quot;https://dsp.stackexchange.com/questions/4737/fft-of-a-square-wave-what-are-frequency-of-each-harmonic-here#comment8735_4737&quot;&gt;Jim Clay&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/4737/fft-of-a-square-wave-what-are-frequency-of-each-harmonic-here#comment12786_4737&quot;&gt;Jason R&lt;/a&gt; above, the signal you start with is not actually a square wave. As you can see in your screenshot, there are six &quot;1&quot; values and only four &quot;-1&quot; values. The square wave should have an equal number of &quot;1&quot;s and &quot;-1&quot;s. I do not know why the values you put in are not a proper square wave, and I suspect there is some odd detail in how MATLAB implimented the function $\text{square}$. To create a square wave, you should change the line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 0.000001:Ts:t;  %Generating Samples&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 0:Ts:t-Ts;  %Generating Samples&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or, even better, to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=t/Ts;&#xA;n=(0:N-1)*Ts;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which makes it clear that you are sampling at integer multiples of your sampling time. The signal $x$ you generate in this way will be equivalent to what Jim Clay has generated in &lt;a href=&quot;https://dsp.stackexchange.com/a/7767/1784&quot;&gt;his answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to why your signal has magnitude $\approx 1.2$ instead of $1$, you need to remember how the square wave is defined. From the Wikipedia article on &lt;a href=&quot;http://en.wikipedia.org/wiki/Square_wave&quot; rel=&quot;nofollow noreferrer&quot;&gt;the square wave&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$x_{\mathrm{square}}(t) =\frac{4}{\pi}\left (\sin(2\pi ft) + {1\over3}\sin(6\pi ft) + {1\over5}\sin(10\pi ft) + \cdots\right ).$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The first term of this function has frequency $f$ and magnitude $\frac{4}{\pi}\approx 1.27$. If you look at &lt;a href=&quot;https://dsp.stackexchange.com/a/7767/1784&quot;&gt;Jim Clay's plot&lt;/a&gt; this is exactly the magnitude in bin 2 of the function he has plotted. &#xA;Up to bin $N/2+1$, the value that will be plotted in bin $k$ is the coefficient of the term in the square wave with frequency $(k-1)f$. (The $-1$ comes from MATLAB indexing beginning with one rather than zero). &lt;/p&gt;&#xA;" OwnerUserId="1784" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-02-05T20:24:07.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7769" PostTypeId="1" CreationDate="2013-02-05T21:13:42.840" Score="2" ViewCount="793" Body="&lt;p&gt;I got 2 pictures which is almost parallel, and not positioned very far from each other.&#xA;&lt;br /&gt;I'm using OpenCV to try to create a disparity map (Stereo correspondence).&#xA;&lt;br /&gt;Because I'm trying to use it in a real world scenario, the use of chessboard calibration is a bit un-practical.&lt;br&gt;&#xA;Because of that, I'm using &lt;b&gt;stereoRectifyUncalibrated()&lt;/b&gt;.&lt;br&gt;&#xA;&lt;br&gt;&#xA;I tried to compare the results, using 2 different sets of corresponding points for the rectification:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Points manually selected(point &amp;amp; click)&lt;/li&gt;&#xA;&lt;li&gt;Points generated from SURF and filtered with RANSAC&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Input image1:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/npC30.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;Input image2:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8wGOu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Note that I do undistortion on the images before using them for rectification etc)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rectified images with SURF and RANSAC:&lt;br&gt;(1 and 2 in that order):&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PaGve.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/XRIV3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rectified images using the manually selected points(which is more inaccurate!):&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/KCGy7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the thing is, looking at the result we see that the surf-version is almost perfectly rectified.(The epipolar lines are quite well aligned). &lt;br&gt;&#xA;While the manually selected point version is quite badly rectified...the epipolar lines are nowhere near aligned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when we look at the result of openCV's sgBM() using both our rectifications:&#xA;&lt;br&gt;&#xA;Manual point result:&#xA;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MT3nQ.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;SURF point result:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sH7vf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The disparity/depth shown is more accurate/correct with the SURF-point(well rectified version). No surprise there.&lt;br&gt;&#xA;However, the actual detected object-pixels and object-boundaries are actually a lot better on the badly rectified verison.&lt;br&gt;&#xA;For instance, you can see that the pen is actually a pen and has the shape of a pen, in the bad rectified disparity map, but not in the well-rectified map.&#xA;&lt;br&gt; &lt;strong&gt;Question is, why?&lt;/strong&gt;&#xA;And how can I fix it?&#xA;(I tried fooling around with the sgBM() paramteres, making sure they are the same for both etc, but it does not have any effect. It is the different rectifications alone that makes the badly rectified image look good for some reason(with respect to object-boundaries)).&lt;/p&gt;&#xA;" OwnerUserId="3355" LastEditorUserId="6" LastEditDate="2013-02-13T08:36:59.043" LastActivityDate="2013-02-13T08:37:38.997" Title="Why do object-boundaries look better on a badly rectified image?(openCV stereo correspondence)" Tags="|image-processing|opencv|stereo-vision|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7770" PostTypeId="1" AcceptedAnswerId="7776" CreationDate="2013-02-05T22:51:17.493" Score="2" ViewCount="209" Body="&lt;p&gt;Given $f(x)$ and its FFT $F(u)$, I need to prove that $df/dx = F(u) * 2iu\pi /n.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$df/dx = f'(x)$ and $n$ is the number of pixels of the one dimensional image $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use the convolution theorem using conv($f[1 -1]$) which is the same as $df/dx$ and in the frequency domain it's $F(u) * FFT([1 -1])$ however there sizes don't match.&lt;/p&gt;&#xA;" OwnerUserId="3749" LastEditorUserId="3183" LastEditDate="2013-02-06T12:00:34.017" LastActivityDate="2013-02-06T16:02:10.940" Title="Given f(x) and its FFT F(u), I need to prove that df/dx = F(u)*2iu(pi)/n" Tags="|image-processing|fft|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7771" PostTypeId="1" CreationDate="2013-02-06T02:31:43.313" Score="4" ViewCount="7925" Body="&lt;p&gt;My professor asked me why you choose $a=0.97$ in a pre-emphasis filter $H(z)=1-\frac{a}{z}$ for your pre-processing step. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the relation between $a$ and the filter?&lt;/li&gt;&#xA;&lt;li&gt;How does this coefficient effect the performance?&lt;/li&gt;&#xA;&lt;li&gt;Why do people use $a=0.9$ or $a=0.97$? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3750" LastEditorUserId="1629" LastEditDate="2016-05-15T12:15:40.807" LastActivityDate="2016-05-15T17:37:07.827" Title="How should one select this filter coefficient for a pre-emphasis filter?" Tags="|matlab|filters|dsp-core|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7772" PostTypeId="2" ParentId="7771" CreationDate="2013-02-06T06:25:08.810" Score="2" Body="&lt;p&gt;If you're familiar with the concept of &quot;poles&quot; and &quot;zeros&quot; in the z-domain, feel free to skip the next paragraph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to quickly visualize the frequency response of a filter in the z-domain is to &quot;trace&quot; the unit circle, by setting $z = e^{j\omega}$.  If a point on the unit circle &quot;trace&quot; is close to a zero, the corresponding frequency  will be attenuated.  Alternatively, if a point on the unit circle is close to a pole, it will be amplified.  By corresponding frequency, I mean $\omega$ when tracing the unit circle by setting $z = e^{jw}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the given form, it should be clear that there will be a &quot;zero&quot; when $a=z$.  Setting $a$ to $0.9$ or $0.97$ puts the &quot;zero&quot; at $0.9$ or $0.97$ respectively.  This will attenuate the low frequencies that are close $\omega=0$.  This filter will attenuate frequencies near $\omega=0$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer to the first two is that setting $a$ to $0.97$ will attenuate said low frequencies more than $a=0.9$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer to the &quot;why&quot; is really dependent upon the application of the filter and what its &quot;processing&quot; step entails if this is a &quot;pre-processing&quot; filter.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastActivityDate="2013-02-06T06:25:08.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7773" PostTypeId="2" ParentId="7771" CreationDate="2013-02-06T13:08:14.907" Score="6" Body="&lt;p&gt;If you look at the spectrum of speech sounds, you will notice that less energy is present in the highest frequencies, with an overall decreasing slope. The goal of the pre-emphasis filter is to counter-balance this, and flatten the spectrum. This helps for one or several of the following reasons, depending on your application:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In an analog speech transmission/recording system, applying an emphasis filter on the emitter (recorder) and a de-emphasis filter on the receiver (player) improves the signal to noise ratio for the high frequencies - since they will be recorded/transmitted at a higher amplitude than without pre-emphasis. This is why vinyl records need a special kind of pre-amplifier (&lt;a href=&quot;http://en.wikipedia.org/wiki/RIAA_equalization&quot; rel=&quot;noreferrer&quot;&gt;RIAA equalization&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;In a digital speech processing system implemented with fixed point arithmetics, this avoids truncation errors, by allowing the FFT coefficients carrying the highest frequencies to have a larger magnitude, making better use of the available dynamic range.&lt;/li&gt;&#xA;&lt;li&gt;In a speech analysis/modeling context (such as linear prediction or sinusoidal modeling), one seeks the model parameters which minimize the distance between the model and the signal. When applying these techniques on speech signals which have not been pre-emphasized, the model will spend a lot of its &quot;parameter space budget&quot; (sinusoids, poles...) trying to overfit the very first harmonics, while ignoring the highest order ones - while these harmonics might actually be relevant for speech intelligibility or phoneme discrimination. Applying pre-emphasis ensures that the model will fit the spectrum more evenly.&lt;/li&gt;&#xA;&lt;li&gt;The low frequency band is occupied by sounds which are useless/harmful for speech recognition: DC offsets, microphone pops, AC 50Hz/60Hz buzz from ground loops or poor board design, etc. The pre-emphasis filter you mention, which is indeed a simple high-pass filter, helps getting rid of these.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As for the the actual value of $a$, you can try plotting the frequency response of the filter for these different values and/or see where the cutoff frequency is. You could also try to visualize its effect on a small corpus of speech signals - how balanced the spectrum becomes after pre-emphasis. It is largely application-dependent - for example, in some applications, poor microphone quality adds an extra 6dB roll-off of the higher frequencies which need more compensation. In speech recognition, this is the kind of parameter tuned a posteriori to try to get better recognition results - though my experience is that with modern models and recognition techniques it has little influence on performance.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-02-06T13:08:14.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7774" PostTypeId="2" ParentId="7771" CreationDate="2013-02-06T14:35:44.540" Score="2" Body="&lt;p&gt;Start by finding the frequency response of the pre-emphasis filter.  By the way, this is an FIR filter, so there are no filter poles, only zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the frequency response, substitute $\exp\left(j\frac{2\pi f}{f_s}\right)$ for $z$ (where $f_s$ is your sampling frequency). This yields &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(f) = 1 - a\exp\left(-j\frac{2\pi f}{f_s}\right)\quad \text{or}\quad1 - a\left[\cos\left(\frac{2\pi f}{f_s}\right) - j\sin\left(\frac{2\pi f}{f_s}\right)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the purpose of pre-emphasis, you are probably most interested in the magnitude response.  This is a complex function, so the magnitude is given by (after massaging a little):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lvert H(f)\rvert = 1 + a^2 - 2a\cos\left(\frac{2\pi f}{f_s}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot this funciton and you will see that it is a highpass response with a maximum at $1/2$ your sampling frequncy and that the filter coefficient $a$ affects the gain, roll-off and DC component of the &quot;message&quot; signal you are processing.  The choice for $a$ depends on the nature of the medium or channel that will be used to store or convey the message signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What exactly is the signal that you will be applying pre-emphasis to?&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="1629" LastEditDate="2016-05-15T12:27:34.517" LastActivityDate="2016-05-15T12:27:34.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7775" PostTypeId="1" CreationDate="2013-02-06T15:32:02.090" Score="3" ViewCount="185" Body="&lt;p&gt;I have &lt;a href=&quot;https://docs.google.com/file/d/0B6zJ3_hrkW40U182SWNWX3o4dE0/edit?usp=sharing&quot; rel=&quot;nofollow&quot;&gt;75 images of handwritten signs&lt;/a&gt; from which I extracted 7 Hu moments and solidity features. How can I find similarities among them to train a classifier and predict the value? I thought SVM was a good choice, but I don't have a target vector (what do I put? I do not know differences in signs that I can say there are, say, three labels, such as &quot;circle&quot;, &quot;triangle&quot; or &quot;square&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is cluster analysis more appropriate? If yes, What is best method?&#xA;I am using the &lt;code&gt;scikit-learn&lt;/code&gt; module in python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://scikit-learn.org/stable/modules/svm.html&quot; rel=&quot;nofollow&quot;&gt;http://scikit-learn.org/stable/modules/svm.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://scikit-learn.org/stable/modules/clustering.html&quot; rel=&quot;nofollow&quot;&gt;http://scikit-learn.org/stable/modules/clustering.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="3597" LastEditDate="2013-02-07T14:48:58.053" LastActivityDate="2013-02-07T14:48:58.053" Title="Recognizing hand-written archaeological signs" Tags="|image-processing|computer-vision|classification|ocr|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7776" PostTypeId="2" ParentId="7770" CreationDate="2013-02-06T16:02:10.940" Score="3" Body="&lt;p&gt;This should have been a comment on the question but is too long to fit within&#xA;the 500-character limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $f$ that is the subject of this question is a &lt;em&gt;sequence&lt;/em&gt; or vector of $n$ numbers&#xA;$$[f_0, f_1, \ldots, f_{n-1}] ~~ \text{or} ~~ \left[f[0], f[1], \ldots, f[n-1]\right] &#xA;~~ \text{or} ~~ \left[f(0), f(1), \ldots, f(n-1)\right]$$&#xA;depending on choice of notation, and its Discrete Fourier Transform (DFT) $F$ (called the&#xA;FFT by the OP) is another &lt;em&gt;sequence&lt;/em&gt; or vector of $n$ numbers. Thus,&#xA;it is not clear what the derivative $\frac{\mathrm d}{\mathrm dx}f(x) = f^\prime(x)$ means&#xA;since the &lt;em&gt;argument&lt;/em&gt; of $f(\cdot)$ is an integer and not a continuous variable.  One&#xA;could attempt to make sense of what is intended by looking at the OP's approach to the&#xA;problem via (cyclic or periodic) convolution with the sequence $[1, -1]$ (actually should have been $[1,-1,0,0,\ldots, 0]$ which results in replacing $f_i$ by $f_{i+1}-f_i$.&#xA;Now, we are getting closer to the notion of differentiation since the derivative of&#xA;a continuous function is obtained by looking at the limit of $\frac{f(x+h)-f(x)}{h}$ as &#xA;$h \to 0$. Here we have the closest we can get since we are&#xA;using $\frac{f(i+1)-f(i)}{1} = f_{i+1}-f_i$, and of course $1$ cannot &quot;approach&quot; $0$.&#xA;Unfortunately, this does not give the desired result.  The $k$-th term of the&#xA;DFT of $[1,-1,0,0,\ldots, 0]$&#xA;is readily computed from the &lt;em&gt;definition&lt;/em&gt; (no FFTs needed)&#xA;as $1 - e^{-j2\pi k/n}$, and so the DFT of the &quot;derivative&quot; sequence&#xA;$f_{i+1}-f_i$ has $k$-th term $F_k(1 - e^{-j2\pi k/n})$ which is &lt;em&gt;not&lt;/em&gt;&#xA;what the OP wants to prove.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what &lt;em&gt;does&lt;/em&gt; the OP want to prove? It is &#xA;$\frac{\mathrm df}{\mathrm dx} \mathbf{=} F(u)*j(2\pi u/n)$.&#xA;This needs clarification on two grounds. First, the left side&#xA;of this equality is a function of $x$, the right side a function&#xA;of $u$. So what does it mean to say the two are &lt;strong&gt;equal?&lt;/strong&gt; &#xA;Second, what the right side means needs clarification. Does&#xA;the $*$ mean &lt;em&gt;multiplication&lt;/em&gt; of the two complex numbers $F(u)$ and&#xA;$j(2\pi u/n)$, or is the $*$ denoting &lt;em&gt;complex conjugation&lt;/em&gt; of $F(u)$&#xA;before the multiplication, or does $*$ denote &lt;em&gt;convolution&lt;/em&gt; so&#xA;that $F(u)*j(2\pi u/n)$ means the $u$-th term of the (cyclic or periodic)&#xA;convolution of the &lt;em&gt;sequences&lt;/em&gt; $[F_0,F_1,\ldots,F_{n-1}]$ and &#xA;$[1, j(2\pi/n),j(2\pi 2/n), \ldots, j(2\pi (n-1)/n)]$?&#xA;The closest match occurs if we assume that $=$ is a typographical&#xA;error and that what is meant is not the &lt;em&gt;equality&lt;/em&gt; that the OP&#xA;claims is needed. Instead, suppose that what was really asked&#xA;for but mistranslated by the OP is that &lt;strong&gt;the $k$-th term of&#xA;the DFT of $\frac{\mathrm df}{\mathrm dx}$&lt;/strong&gt;&#xA;by which is meant the &lt;em&gt;sequence&lt;/em&gt; with $i$-th term $f_{i+1}-f_i$ &#xA;is $F_ke^{j2\pi k/n}$ (another typo, the missing exponential!). As&#xA;noted above, this is not quite right: it should be&#xA;$F_k(1 - e^{-j2\pi k/n})$. Note, incidentally, that the inverse&#xA;DFT of the sequence with $k$-th term $F_ke^{j2\pi k/n}$ is a&#xA;&lt;em&gt;cyclic shift&lt;/em&gt; of the sequence $f$; see, for example, &#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Shift_theorem&quot; rel=&quot;nofollow&quot;&gt;this&#xA;Wikipedia entry&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But maybe as a non-expert in image processing I am missing something completely&#xA;and so I await clarification from the OP, or perhaps a more detailed&#xA;explanation from @JasonR of the method outlined in his comment on the OP's&#xA;question.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-02-06T16:02:10.940" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7777" PostTypeId="1" CreationDate="2013-02-06T16:09:10.453" Score="5" ViewCount="156" Body="&lt;p&gt;I made a multi-scale Harris corner detector (inspired by &lt;a href=&quot;http://research.microsoft.com/pubs/74482/cvpr05.pdf&quot; rel=&quot;noreferrer&quot;&gt;MOPS&lt;/a&gt;) which is simply a Harris corner detector performed on several scales (i.e. subsampled versions of the same image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This effectively make the detector more robust to noisy/blurred images and able to find more features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are cases where two or more features are detected at the same location on different scales. See the image - each circle represents an oriented corner, radius of the circle corresponds with its scale:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JwTiP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of this, some features have similar descriptors and this would theoretically weaken later correspondence matching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Detectors like SIFT or Harris-Laplace deal with the problem by either detecting scale-space maxima only or finding characteristic scale of each detected corner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it would be reasonable to group corners that are close to each other spatially and then choose just the strongest one (the one with the strongest response is nearest to its characteristic scale). I am already performing Adaptive Non-Maximal Suppression, but this happens on each scale separately (to keep moderate amount of features on each scale) so the corners with similar locations can still remain when they are on different scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe just operating on descriptor vectors would be sufficient, but this problem have much higher dimensionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2013-02-06T18:41:27.257" LastActivityDate="2013-02-06T18:41:27.257" Title="Filtering Corners Detected on Multiple Scales" Tags="|local-features|harris|corners|detection|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7778" PostTypeId="1" AcceptedAnswerId="7783" CreationDate="2013-02-06T19:24:49.627" Score="3" ViewCount="5150" Body="&lt;p&gt;I am doing some research into GNSS (Global Navigation Satellite Systems) and have come across various signals listed as having the in-phase or quadrature channels modulated with BPSK(2) or BPSK(10), etc.  However, I am struggling to find a definition of BPSK that includes this additional parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does the (n) signify in BPSK(n)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the basic concept of BPSK - Binary Phase Shift Keying and have implemented this in very basic tests by multiplying the LO by 1 or -1 for a 1 or 0 chip respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been suggested by a colleague that the n is simply the chip rate and that BPSK(1) is a chip rate of 1MHz, BPSK(2) 2MHz, BPSK(10) 10MHz, etc. as mentioned in the comments by Jim Clay.&lt;/p&gt;&#xA;" OwnerUserId="3619" LastEditorUserId="3619" LastEditDate="2013-02-07T10:17:35.403" LastActivityDate="2015-04-01T07:34:33.697" Title="What is the meaning of BPSK(n)" Tags="|modulation|bpsk|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="7779" PostTypeId="2" ParentId="7775" CreationDate="2013-02-06T20:39:05.557" Score="3" Body="&lt;p&gt;It is a bit hard to understand what you are trying to do. What are these signs? The one you posted looks like a wheel.  Are there meaningful categories that you can name? If so, then this is a supervised learning (classification) problem, and you should use a classification algorithm such as SVM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are no clear labels, but you want to group together similar-looking signs, then this is an unsupervised learning problem, and you should use a clustering algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your description it sounds more like a clustering problem.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-02-06T20:39:05.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7780" PostTypeId="1" AcceptedAnswerId="7794" CreationDate="2013-02-07T08:39:53.337" Score="2" ViewCount="741" Body="&lt;p&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0130402680&quot; rel=&quot;nofollow&quot;&gt;My textbook&lt;/a&gt; have a question p.360 problem 6.26 is like this&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Consider the signal $v(t) = 8 cos (2\pi [10^5 + 4 sin(5 \times 10^3 t)]t)$. And Please Draw the amplitude spectrum of $v(t)$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, The first step, I did, was proving the $v(t)$ is a FM signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The the instantaneous frequency is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac {d\psi} {dt} = \frac {d} {dt} 2 \pi[10^5+4sin(5 \times 10^3 t)]t = 2\pi10^5+8\pi sin(5 \times 10^3t) + 8 \pi t (5 \times 10^3) cos (5 \times 10^3 t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it is linear function to $\frac {d} {dt} t[sin(5 \times 10^3 t)]$ and it is a FM signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I don't know why I cannot find out the summation of sinusoids.&#xA;My methods is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v(t) = 8 cos (2\pi [10^5 + 4 sin(5 \times 10^3 t)]t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=Re \{ 8 e^{(j 2 \pi 10^5 t)} e^{j4t sin(5 \times 10^3 t)} \}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=Re \{ 8 e^{(j 2 \pi 10^5 t)}  \sum\limits_{n=-\infty}^\infty J_n(4) e^{j 2 \pi n (\frac {5 \times 10^3}{2 \pi})t}\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And my problem is I dont know my last step is correct or not because it look very weird. &lt;/p&gt;&#xA;" OwnerUserId="3420" LastEditorUserId="235" LastEditDate="2013-02-09T03:02:41.900" LastActivityDate="2013-02-09T14:27:26.507" Title="Finding the Amplitude spectrum of a FM signal" Tags="|frequency-spectrum|modulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7781" PostTypeId="1" CreationDate="2013-02-07T10:36:09.993" Score="0" ViewCount="426" Body="&lt;p&gt;I have implemented Haar Function in MATLAB based on formulas stated &lt;a href=&quot;http://mathworld.wolfram.com/HaarFunction.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. However this formulas generate functions only between 0 and 1 (on [0..1] interval). I need to generate such functions periodically from -infinity to +infinity for instance with period = 1. It should depend on length of my time vector. For example if time vector on interval [0..10] I should generate Haar function vector on the same interval [0..10]. I hope you get a point. Here is my MATLAB code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ f ] = haar(x)&#xA;%Haar function&#xA;%   x: time vector&#xA;vectorLength = length(x);&#xA;f = zeros(1, vectorLength);&#xA;for k = 1:vectorLength&#xA;    if (x(k) &amp;gt;= 0 &amp;amp;&amp;amp; x(k) &amp;lt; 1/2)&#xA;        f(k) = 1;&#xA;    elseif (x(k) &amp;gt; 1/2 &amp;amp;&amp;amp; x(k) &amp;lt;= 1)&#xA;        f(k) = -1;&#xA;    end;&#xA;end;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3238" LastActivityDate="2013-02-07T10:36:09.993" Title="Make Haar Functions periodic" Tags="|matlab|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7783" PostTypeId="2" ParentId="7778" CreationDate="2013-02-07T15:16:32.890" Score="3" Body="&lt;p&gt;While I do not have proof, it seems pretty clear, given the &quot;Characteristics of Compass signals reported as of May 2008 compared to GPS-L1CA&quot; table at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Beidou_Navigation_Satellite_System#Compass-M1&quot; rel=&quot;nofollow&quot;&gt;Wikipedia page&lt;/a&gt; that you offered as an example, that the &quot;(n)&quot; notation refers to the chip rate.  You will notice that there is one BPSK(1) signal that has a chip rate of 1.023 Mchips/s.  There are four BPSK(2) signals listed, and all of them have a chip rate of 2.046 Mchips/s, which is twice 1.023 Mchips/s.  There are also three BPSK(10) signals that have a chip rate of 10.23 Mchips/s which is, of course, 10 times 1.023 Mchips/s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that the &quot;(n)&quot; notation means that the signal has a chip rate of $n*f_o$, and in the case of the Compass signals $f_o$ is 1.023 Mchips/s.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-02-07T15:16:32.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7784" PostTypeId="1" CreationDate="2013-02-07T02:45:50.823" Score="2" ViewCount="11225" Body="&lt;p&gt;Hi I am trying to use a low pass filter in Matlab. I am trying to use the simple butterworth filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have defined dataset say &quot;data&quot;. Then I created the butterworth filter as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[B,A]=butter(2,0.01)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Butterworth design require the user to give N and Wn. I used N as 2 and Wn as 0.01. Here, I randomly chose the value of Wn to 0.01.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My data is a hourly data and I want to apply 48 hour low pass filter. What would be the cut off frequency in my case ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that I used the following code to design a filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter(B,A,data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The filtered data looks good but I want to know what cutoff frequency should I use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerDisplayName="Jdbaba" LastActivityDate="2013-02-07T21:46:53.000" Title="Cut off frequency for low pass filter" Tags="|matlab|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7785" PostTypeId="2" ParentId="7784" CreationDate="2013-02-07T16:13:14.930" Score="0" Body="&lt;p&gt;Filters are agnostic to the sampling frequency you use. What matters is the normalized cut off frequency. As a result the filter obtained from a function like &lt;code&gt;butter&lt;/code&gt; will work for any sampling frequency. A value of 1 corresponds to half the sampling frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case your sampling frequency is 1 hr$^{-1}$. Hence a value of 0.01 corresponds to a frequency cutoff of .01 $\times$ 0.5 = .005 hr$^{-1}$ or 200 hrs time.&lt;/p&gt;&#xA;" OwnerUserId="3670" OwnerDisplayName="Karthik V" LastEditorUserId="80" LastEditDate="2013-02-07T20:55:46.160" LastActivityDate="2013-02-07T20:55:46.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7786" PostTypeId="1" CreationDate="2013-02-07T18:53:49.640" Score="3" ViewCount="1432" Body="&lt;p&gt;I have a pending exam and this is one of the must-know questions. It will be about checking controllability/observability of a simple MIMO linear system, using Controlability Gramian/Observability Gramian. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, the system will be given in state-space representation, with the system matrix A of size 3x3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Searching around, &lt;a href=&quot;http://maecourses.ucsd.edu/~mdeolive/mae280b/lecture/lecture1.pdf&quot; rel=&quot;nofollow&quot;&gt;both Gramian matrixes are well defined&lt;/a&gt;. However, I am unable to solve the integral equation.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do I need to solve the integral equation from the definition?  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://teal.gmu.edu/ececourses/ece521/lecturenote/chap2/node5.html&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a very nice tutorial with an example. I still don't understand the final substitution for t in the first example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that a gramian matrix of full rank means the rows or columns of the matrix are linearly independent. But what has that to do with controllability?&#xA; * If so, how do I compute exp(A) on paper for A being a 3x3 matrix?&#xA; * &lt;a href=&quot;http://teal.gmu.edu/ececourses/ece521/lecturenote/chap2/node5.html&quot; rel=&quot;nofollow&quot;&gt;From this example&lt;/a&gt;, I conclude that the definite integral of a matrix is computed element-wise. Is that so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know those are a bunch of silly question. What I am looking for is just a tutorial or a sample calculation&lt;/p&gt;&#xA;" OwnerUserId="1575" LastEditorUserId="1575" LastEditDate="2014-01-19T17:45:35.677" LastActivityDate="2014-01-19T17:45:35.677" Title="How do I check controllability and observability using Gramian matrixes?" Tags="|homework|control-systems|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7787" PostTypeId="2" ParentId="7784" CreationDate="2013-02-07T21:46:53.000" Score="2" Body="&lt;p&gt;The butter command expects a &lt;a href=&quot;https://en.wikipedia.org/wiki/Normalized_frequency_%28digital_signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;normalized frequency&lt;/a&gt; from 0 to 1, where 1 is the Nyquist frequency.  In other words, &lt;code&gt;Wn&lt;/code&gt; is in half-cycles per sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you just divide your desired frequency (1 cycle / 48 hours) by half the sample rate ((1 sample per hour)/2), giving Wn = 0.04167 half-cycles per sample.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-02-07T21:46:53.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7788" PostTypeId="1" AcceptedAnswerId="7790" CreationDate="2013-02-08T14:54:50.093" Score="6" ViewCount="3311" Body="&lt;p&gt;I've just stepped into the FFT's world since the last weeks, therefore I still don't have an clear overall idea of how to setup the frequency array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of &lt;code&gt;even&lt;/code&gt; number &lt;code&gt;N&lt;/code&gt;, I usually do (with respect to the Nyquist cut-off frequency)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f=\left(-N/2\,:\, N/2-1\right)*f_{s}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but how does it work in case of &lt;code&gt;odd&lt;/code&gt; number &lt;code&gt;N&lt;/code&gt;. Is it just&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f=\left(-(N+1)/2\,:\,(N+1)/2-1\right)*f_{s}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thank you all in advance.&lt;/p&gt;&#xA;" OwnerUserId="3666" LastActivityDate="2014-07-10T13:58:08.590" Title="Setup frequency array properly" Tags="|fft|frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7789" PostTypeId="2" ParentId="7728" CreationDate="2013-02-08T15:13:45.627" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://arma.sourceforge.net&quot; rel=&quot;nofollow&quot;&gt;Armadillo&lt;/a&gt; does a great job for linear algebra in C++ (pretty fast via expression templates), and can be certainly used for signal processing as well. Apart from supporting matrices with various element types, it has support for 3rd order tensors (cubes), which are useful in image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a related C++ library known as &lt;a href=&quot;http://sourceforge.net/projects/itpp/&quot; rel=&quot;nofollow&quot;&gt;IT++&lt;/a&gt;, which is not as fast as Armadillo, but it has more pre-built classes geared towards signal processing and communication.&lt;/p&gt;&#xA;" OwnerUserId="3761" LastActivityDate="2013-02-08T15:13:45.627" CommentCount="1" CommunityOwnedDate="2013-02-08T15:13:45.627" ContentLicense="CC BY-SA 3.0" />
  <row Id="7790" PostTypeId="2" ParentId="7788" CreationDate="2013-02-08T15:25:22.700" Score="6" Body="&lt;p&gt;Short answer: yes, I think so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long answer: The FFT is just a fast implementation of the DFT.  The frequency spacing of an N-point DFT operation is $\frac{f_s}{N}$.  Samples of the DFT where  $\omega \ge \pi$ correspond to the negative frequencies.  If N is odd, then $\frac{N-1}{2} \cdot \frac{2\pi}{N}$ is less than $\pi$ and the next DFT frequency, $\frac{N+1}{2} \cdot \frac{2\pi}{N}$, is above $\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think your answer is correct, and another way to think about it is that you have a DC bin, with (N-1)/2 negative frequencies, and (N-1)/2 positive frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;update:&#xA;MATLAB/Octave syntax for odd-N DFT frequencies:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqs = (fs/N)*( (N-1)/2 : (N-1)/2 )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Python/Numpy/Scipy syntax for odd-N DFT frequencies:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqs = (fs/N) * arange(-(N-1)/2,(N+1)/2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Python/Numpy/Scipy syntax for even and odd N DFT frequencies ( via @endolith ):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fftshift(fftfreq(N,1./fs))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="3644" LastEditDate="2013-02-08T20:38:04.093" LastActivityDate="2013-02-08T20:38:04.093" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7791" PostTypeId="2" ParentId="7788" CreationDate="2013-02-08T20:52:19.797" Score="12" Body="&lt;p&gt;Posted for anyone who may find this useful...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a picture that shows DFT frequency bin spacing for odd and even cases of N where N is the number of samples.  FFTs usually operate on an even number of samples (the algorithm works by repeatedly breaking the problem into halves), so only the even case applies.  The DC component (0*fs) is always part of the computation .  The bin at the nyquist frequency (fs/2) only shows up for the even case.  The frequencies above the nyquist frequency reflect back on the negative side of the frequency axis in reverse order.  For real signals the reflected FFT values are complex conjugates of their positive counterparts.  There are two specific cases depicted on the complex plane, N=5 for the odd case and N=8 for the even case.&lt;img src=&quot;https://i.stack.imgur.com/dpBUj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-02-08T21:39:28.457" LastActivityDate="2013-02-08T21:39:28.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7792" PostTypeId="2" ParentId="3002" CreationDate="2013-02-08T21:26:45.160" Score="10" Body="&lt;p&gt;The imagemagick manual has a great explanation of why filtering with sinc functions leads to &quot;ringing&quot; effects while gaussians do not.  (&lt;a href=&quot;http://www.imagemagick.org/Usage/fourier/#blurring&quot; rel=&quot;noreferrer&quot;&gt;http://www.imagemagick.org/Usage/fourier/#blurring&lt;/a&gt; and &lt;a href=&quot;http://www.imagemagick.org/Usage/fourier/#circle_spectrum&quot; rel=&quot;noreferrer&quot;&gt;http://www.imagemagick.org/Usage/fourier/#circle_spectrum&lt;/a&gt;).  When you have edges (discontinuities) in your image (which most images do) then completely chopping out all the high frequencies leaves you with ripples in the spatial domain.  You also get ringing when you filter square waves with a sinc function in one dimension.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-02-08T21:26:45.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7793" PostTypeId="2" ParentId="7724" CreationDate="2013-02-09T00:21:13.977" Score="1" Body="&lt;p&gt;To roughly summarize Deve &amp;amp; Jim Clay's excellent responses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Symbol Synchronization consists of two different tasks -- rough symbol synchronization, where the symbol boundaries are approximated, and fine symbol synchronization, where the rough synchronization is slightly adjusted.  Often the fine synchronization is less computationally intensive and so can be done more frequently to adjust for changes in the channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pilot symbols, which are special predefined symbols that are known to the transmitter and receiver can be used to do rough synchronization by searching for the symbol in the time-domain (&quot;auto-correlation&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase of a sub-carrier should change in a predictable way from one window to the next.  For example, in BPSK, the phase should be 0 or pi radians away from its expected value from one window to the next.  By trying different window positions, and testing multiple sub-carriers (for better noise immunity) rough symbol synchronization can be achieved.  This is an &quot;exotic&quot; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cyclic prefixes, which are a continuation of the symbol that is prefixed to the beginning, can be used for fine correlation through auto-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pilot tones are specific sub-carriers that are chosen ahead of time.  They carry a specific repeating pattern.  They are used for channel estimation and additionally can be used for fine synchronization.&lt;/p&gt;&#xA;" OwnerUserId="3435" LastActivityDate="2013-02-09T00:21:13.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7794" PostTypeId="2" ParentId="7780" CreationDate="2013-02-09T04:11:11.763" Score="2" Body="&lt;p&gt;The difficulty with respect to this question as well as &lt;a href=&quot;https://dsp.stackexchange.com/q/7743/235&quot;&gt;a related one&lt;/a&gt; is that the authors of the text that the OP is using have chosen to adopt a definition of an FM signal that is &lt;em&gt;not&lt;/em&gt;&#xA;the one used by most other writers.  This unfortunate choice muddies&#xA;the study of what is already a difficult-to-understand modulation method&#xA;(as compared to amplitude modulation and even phase modulation). Most people&#xA;use take an FM signal to be of the form given in &#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_modulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; where,&#xA;for a modulating signal $x(t)$ (assumed to be of magnitude at most $1$), the FM signal is&#xA;of the form&#xA;$$A \cos\left(2\pi f_c t + 2\pi f_\Delta \int_0^t x(\tau)\,\mathrm d\tau \right)$$&#xA;where $f_c$ is the &lt;em&gt;carrier frequency&lt;/em&gt; and $f_\Delta$ is the &lt;em&gt;maximum frequency deviation&lt;/em&gt; from the carrier.&#xA;The &lt;em&gt;instantaneous frequency&lt;/em&gt; is the &lt;em&gt;derivative&lt;/em&gt; of the phase (argument of the $\cos$) with respect to time $t$, and is thus&#xA;$$\begin{align*}&#xA;\omega_{\scriptstyle{\text{inst}}} &#xA;&amp;amp;= \frac{\mathrm d}{\mathrm dt}\left[2\pi f_c t &#xA;+ 2\pi f_\Delta \int_0^t x(\tau)\,\mathrm d\tau \right] &#xA;= 2\pi f_c + 2\pi f_\Delta x(t) ~ \text{rad/sec},\\&#xA;f_{\scriptstyle{\text{inst}}} &#xA;&amp;amp;= \frac{1}{2\pi}\frac{\mathrm d}{\mathrm dt}\left[2\pi f_c t &#xA;+ 2\pi f_\Delta \int_0^t x(\tau)\,\mathrm d\tau \right] &#xA;= f_c + f_\Delta x(t) ~ \text{Hz}.&#xA;\end{align*}$$&#xA;When $x(t)$ is a sinusoidal signal, say $\cos(2\pi f_s t)$, &#xA;its integral is &#xA;$$\int_0^t \cos(2\pi f_s \tau)\,\mathrm d\tau &#xA;= \left.\frac{1}{2\pi f_s}\sin(2\pi f_s\tau)\right\vert_0^t&#xA;= \frac{1}{2\pi f_s}\sin(2\pi f_s t)$$&#xA;is also a sinusoid at the same frequency, and so for&#xA;this special case, the FM signal can be written as&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$A \cos\left( 2\pi f_c t + \frac{f_\Delta}{f_s} \sin(2\pi f_s t)\right)&#xA;= A \cos\left(2\pi f_c t + k\sin(2\pi f_s t)\right).$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Note that the &lt;em&gt;instantaneous frequency&lt;/em&gt; of the FM signal&#xA;varies (in sinusoidal fashion) between $f_c-k$ and $f_c+k$ Hz.&#xA;Note also the &lt;strong&gt;difference&lt;/strong&gt; between this standard result&#xA;and what the OP &lt;em&gt;claims&lt;/em&gt; is the formula in his textbook&#xA;(I have not read the text myself and have no idea what&#xA;it actually says):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$v(t) = 8 cos (2\pi [10^5 + 4 sin(5 \times 10^3 t)]\,\mathbf t\,)$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The extra $\mathbf t$ at the end changes the instantaneous frequency&#xA;to &#xA;$$2\pi10^5+8\pi sin(5 \times 10^3t) + 8 \pi \, \mathbf{t}\,  (5 \times 10^3) cos (5 \times 10^3 t)$$&#xA;(as correctly calculated by the OP).  But,&#xA;instead of the instantaneous frequency fluctuating between&#xA;fixed limits, the maximum frequency deviation &lt;strong&gt;increases&lt;/strong&gt; with time.&#xA;The claim that this is an FM signal (in the&#xA;usual sense of the word) is certainly not tenable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If OP Samuel has correctly copied the problem from&#xA;his textbook, then the problem, as stated, has no solution.&#xA;Perhaps it is just a typo in this particular problem.&#xA;On the other hand,&#xA;if the same &quot;additional&quot; $t$ occurs in&#xA;occurs in the text in the definition of an FM signal,&#xA;and this formulation is used throughout the book, then&#xA;the book certainly has a major blunder in it.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-02-09T14:27:26.507" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7796" PostTypeId="1" CreationDate="2013-02-09T06:13:27.247" Score="4" ViewCount="775" Body="&lt;p&gt;I'm working on a project to detect a road sign from the Image. Consider the sample image below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/j5YjB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using a heuristic search to detect the road sign within an image. Basically, I want some weak features (colour, shape, zero symmetry within road signs) which can be calculated very fast and their weighted average can be used recognize the road sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm searching the entire image to find the road sign which could be of different scale. Since the domain of search is a lot, I tried to reduce it bu by using some heuristics:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Location of sign detect in previous frame (its mostly likely to be near)&lt;/li&gt;&#xA;&lt;li&gt;Road signs are usually on right sign&lt;/li&gt;&#xA;&lt;li&gt;Road sign contains enough white pixels&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But eventually search needs to stop when it finds the region that contains a road sign. For this purpose, I'm relying on some fast and robust local features that predicts likelihood of containing road sign within given region of an image. Currently, I'm relying mainly on colour and some region props that Matlab provides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried looking for lines and corners within edge map of the region even tried thresholding and looking for rectangle using morphology. But seems like they are too binary either its YES or its NO. In fact in most cases it fails, so my questions what are some nice local features that I could rely on to detect road sign?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2ycut.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/94XuG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate if somebody you guide in the right direction or provide some links or papers that could be helpful for this problem.&lt;/p&gt;&#xA;" OwnerUserId="3527" LastEditorUserId="3527" LastEditDate="2013-02-09T06:18:45.077" LastActivityDate="2013-02-25T10:21:17.117" Title="Local Image Features Extraction for Road Signs" Tags="|image-processing|image-segmentation|local-features|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7797" PostTypeId="1" AcceptedAnswerId="8162" CreationDate="2013-02-09T16:00:37.093" Score="6" ViewCount="803" Body="&lt;p&gt;In this case, the picture below shows a color fringe detected on its edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rVMww.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am experiencing the same difficulty on a hyperspectral image, so I am looking for a good algorithm correcting chromatic aberration for hyperspectral images. I understand there are several algorithms for RGB images, but it seems that it's difficult to extend any of them for hyperspectral images. &lt;/p&gt;&#xA;" OwnerUserId="1011" LastEditorUserId="76" LastEditDate="2013-02-11T02:58:17.777" LastActivityDate="2014-01-08T20:54:56.507" Title="Algorithm correcting chromatic aberration on hyperspectral images" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7798" PostTypeId="1" AcceptedAnswerId="7799" CreationDate="2013-02-09T21:42:10.887" Score="1" ViewCount="4358" Body="&lt;p&gt;I have a parity matrix (&quot;H&quot;) that is not in canonical form (the identity matrix is not on the right side). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to programatically calculate the generator matrix (&quot;G&quot;) from it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Wikipedia entry on Hamming codes talks about the relationship between parity check matrixes and generator matrixes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Hamming_code&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Hamming_code&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It says that H*transpose(G)=0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I could figure out G by taking the Nullspace of H.  However, I end up with many fractional numbers and don't know how to use that.  The examples I've seen use gauss-jordan elimination to put the matrix into row-echelon form.  However, shouldn't I be able to do it numerically using svd or something like that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some code where I multiply a message by a generator matrix (the example is taken from Wikipedia).  I would like to get the same message when I multiply by the generator that I have calculated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;import numpy as np&#xA;import scipy.linalg&#xA;&#xA;def nullspace(A, atol=1e-13, rtol=0):&#xA;    A = np.atleast_2d(A)&#xA;    u, s, vh = np.linalg.svd(A)&#xA;    tol = max(atol, rtol * s[0])&#xA;    nnz = (s &gt;= tol).sum()&#xA;    ns = vh[nnz:].conj().T&#xA;    return ns&#xA;&#xA;H = np.mat( [[1,1,1,1,0,0],&#xA;             [0,0,1,1,0,1],&#xA;             [1,0,0,1,1,0]] )&#xA;&#xA;G = np.mat( [[1,0,0,1,0,1],&#xA;             [0,1,0,1,1,1],&#xA;             [0,0,1,1,1,0]] )&#xA;&#xA;M = np.mat( [1,0,1] )&#xA;&#xA;print &quot;Message * generator=&quot;, M*G&#xA;&#xA;GT2 = nullspace(H)&#xA;G2 = GT2.T&#xA;&#xA;print &quot;Message * calculated generator=&quot;, M*G2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3435" LastActivityDate="2013-02-09T22:20:00.967" Title="How to compute generator matrix from a parity check matrix?" Tags="|linear-algebra|forward-error-correction|ecc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7799" PostTypeId="2" ParentId="7798" CreationDate="2013-02-09T22:20:00.967" Score="2" Body="&lt;p&gt;With forward-error-correcting coding, one is working in a &lt;em&gt;finite field&lt;/em&gt;, typically the field of two elements denoted by GF$(2)$ or $\mathbb F_2$. So, &lt;strong&gt;there are no fractional numbers&#xA;and no fancy methods such as singular value decomposition&lt;/strong&gt;: you use bit-by-bit XOR additions of the rows of $H$ and Gauss-Jordan elimination to reduce $H$ to row-echelon form $[P_{(n-k)\times k} \mid I_{(n-k)\times(n-k)}]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, set $G = [I_{k\times k} \mid (P^T)_{k\times(n-k)}]$ and you are done. (For &#xA;nonbinary fields, use $[I \mid -P^T]$).  Note&#xA;that all arithmetic in the verification $HG^T = 0$ is also finite field arithmetic&#xA;with $1\cdot 1 =1$ and $1+1 = 0 = 1\oplus 1$ for the case of GF$(2)$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-02-09T22:20:00.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7800" PostTypeId="1" CreationDate="2013-02-10T10:24:49.913" Score="4" ViewCount="162" Body="&lt;p&gt;Suppose that there is a FIR filter F and a signal S.  The filtered signal is the convolution of F and S, F * S.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem: how to calculate a signal S' such that F * S' = S' (the filtered version is the same as itself, up to a fixed time shift), and S' minimizes norm(S, S') (where norm is some kind of distance metric, for example sum of squared differences).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loosely: how to calculate the most similar signal to a given signal which is not affected by a filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: The original problem may be over constrained because there may be very few (or no) signals for which F*S = S exactly.  An alternate formulation is to find S' which minimizes the combined error alpha*norm( F*S' - S') + beta*norm( S' - S ), for some weights alpha and beta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: The specific filter I have in this case is F=[ 0.00097656, -0.00976562,  0.06347656, -0.15625   ,  0.18554688,   0.83203125,  0.18554688, -0.15625   ,  0.06347656, -0.00976562,    0.00097656] which is a fairly modest lowpass filter.  I was interested in the general case as well though.&lt;/p&gt;&#xA;" OwnerUserId="3650" LastEditorUserId="3650" LastEditDate="2013-02-11T01:09:36.233" LastActivityDate="2013-02-11T01:09:36.233" Title="How to calculate signal which is not changed by a filter?" Tags="|filters|finite-impulse-response|optimization|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7801" PostTypeId="2" ParentId="88" CreationDate="2013-02-10T10:30:16.180" Score="5" Body="&lt;p&gt;A convenient version can be found in Python's &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.remez.html&quot; rel=&quot;noreferrer&quot;&gt;scipy.signal.remez&lt;/a&gt;.  Nice if using numpy/scipy.&lt;/p&gt;&#xA;" OwnerUserId="3650" LastActivityDate="2013-02-10T10:30:16.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7802" PostTypeId="2" ParentId="7800" CreationDate="2013-02-10T22:29:37.290" Score="3" Body="&lt;p&gt;If a filter with transfer function $H(f)$ passes a signal $x(t)$ with Fourier transform $X(f)$ &lt;em&gt;unchanged&lt;/em&gt;, then $H(f)X(f) = X(f)$ for all $f$, and &#xA;so $H(f)$ must have the property that&#xA;$$H(f) = 1 ~ \text{for all frequencies}~ f~ \text{for which}~ X(f) \neq 0.$$&#xA;Thus, an &lt;em&gt;arbitrary&lt;/em&gt; filter will not enjoy this property for very many&#xA;signals, perhaps for no signal at all.  Indeed, if $H(f_0) = H(-f_0) = 1$ for&#xA;some $f_0$, then the filter will pass the sinusoid &#xA;$A\cos(2\pi f_0t + \theta), -\infty &amp;lt; t &amp;lt; \infty$ unchanged, but it will&#xA;not pass a &lt;em&gt;sinusoidal pulse&lt;/em&gt; such as&#xA;$$x(t) = \begin{cases} A\cos(2\pi f_0t + \theta), &#xA;&amp;amp; -T &amp;lt; t &amp;lt; T,\\ 0, &amp;amp;\text{otherwise,}\end{cases}$$&#xA;without distorting it. Of course, it is possible that $H(f) \neq 1$ for&#xA;all $f$ and so even passing a monochromatic sinusoid is not possible&#xA;(cf. @hotpaw's comment).&#xA;In short, the subspace referred to by @AtulIngle might well be&#xA;the trivial subspace of zero dimension containing only the&#xA;zero signal.&#xA;It is also worth noting that if $H(f)$ has &lt;em&gt;constant nonzero value&lt;/em&gt;&#xA;over an &lt;em&gt;interval&lt;/em&gt;, then the filter is &lt;em&gt;physically unrealizable&lt;/em&gt; for&#xA;essentially the same reason that an &lt;em&gt;ideal low-pass filter&lt;/em&gt; is&#xA;unrealizable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the OP's question is likely to have no answer at all because the&#xA;signals $S^\prime$ that he seeks to find may not exist at all for&#xA;the given filter. Perhaps something else was intended to be asked?&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-02-10T22:29:37.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7803" PostTypeId="1" AcceptedAnswerId="7807" CreationDate="2013-02-10T23:31:33.010" Score="2" ViewCount="1384" Body="&lt;p&gt;I tried to do a histogram equalisation on an image, and then display its histogram. I realise that when I show the histogram with 10 bins, it looks more &quot;equalised&quot; than when I show the histogram with 256 bins. Here's is an image of the 10-bin and 256-bin histograms of the same image after running a histogram equalisation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OVnbW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So again, in the image above, clearly, the histogram with 10 bins looks more equalised than the histogram with 256 bins. Since both the histograms reflect the colour pixels for the same image, is there reason as to why the 10-bin histogram looks more equalised than then 256-bin histogram?&lt;/p&gt;&#xA;" OwnerUserId="3769" LastActivityDate="2013-02-11T04:25:31.690" Title="Lesser bins histogram looks more equalised than higher bins histogram after histogram equalisation?" Tags="|image-processing|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7804" PostTypeId="1" AcceptedAnswerId="7812" CreationDate="2013-02-11T00:58:49.960" Score="3" ViewCount="13488" Body="&lt;p&gt;I am trying to figure out how to use the step $u(t)$ and ramp $r(t)$ functions to create the function $f(t)$ below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(x) = \begin{cases}0 &amp;amp; \text{for } t &amp;lt; 0 \\ t &amp;amp; \text{for }-1 \lt t \lt 1 \\ 2 &amp;amp; \text{for }t \gt 1 \end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The step function $u(t)$ is defined to be 1 when $t \gt 0$ and $0$ otherwise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ramp function $r(t)$ is defined to $t$ for $t \gt 0$ and $0$ otherwise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is my thought process: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(t)$ has a line with a slope of 1 from [-1,1]. This looks just like the r(t) function shifted to the left by one. Hence, r(t+1). However, the problem arises after $t = 1$.  $r(t+1)$ continues on with a slope of 1 infinitely, but the graph below flattens out at $t=1$. Somehow, I need to cancel out the slope of 1 by adding with a slope of -1. The only way I can get a slope of -1 is by negating $r(t)$ and shifting it to the right by 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This yields $r(t+1) - r(t-1)$. This will cancel out the positive slope 1 for t &gt; 1, but this creates a problem on left side because the slope of -1 continues on to negative infinity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I'm over thinking this problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate it if somebody could explain this problem in the simplest possible way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, somebody told me there is an easy way to solve problems like this by looking at where the discontinuities are and where the slopes change.  The discontinuities imply using an amplitude with u(t) and slopes imply using amplitude with $r(t)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would appreciate all / any advise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3770" LastEditorUserId="6" LastEditDate="2013-02-11T04:31:32.967" LastActivityDate="2013-04-13T00:04:19.163" Title="How do I use the step and ramp functions to create a specific signal?" Tags="|continuous-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7805" PostTypeId="1" CreationDate="2013-02-11T02:16:44.587" Score="2" ViewCount="49" Body="&lt;p&gt;We have a set of images which are immunofluorescence stainings of mice brain slices. These image show the expression level of a marked protein.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have two groups of mice, which underwent behavioral experiments that we suspect caused a change in the expression of this protein.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we want to compare the signal intensity between this two groups of images. Which could be the better approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We thought of taking the luminosity channel of every pixel in the selected area and average it among all the pixel to retrieve a single luminosity value for the picture. Is this a correct method? Isn't it too much simple? Is there a better method to achieve more significant data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="3771" LastActivityDate="2013-02-11T02:16:44.587" Title="Compare luminosity beetween groups of images" Tags="|image-processing|signal-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7806" PostTypeId="1" AcceptedAnswerId="7808" CreationDate="2013-02-11T04:04:57.983" Score="2" ViewCount="1983" Body="&lt;p&gt;I'm trying to visualize the differences on the output waveform of a modulator when using NRZ or a Manchester pulse shaping filter. To keep it simple, let's think of a binary PAM signal with an input bit sequence 101011. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thoughts are that with a Half Sine or a Raised Cosine pulse shaping filter, I will see the transitions between the 1's and 0's smooth out, but I'm struggling to think about the differences between the NRZ and the Manchester.&lt;/p&gt;&#xA;" OwnerUserId="3733" LastActivityDate="2013-02-12T17:29:20.013" Title="NRZ vs. Manchester pulse shaping filter (Modulator)" Tags="|modulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7807" PostTypeId="2" ParentId="7803" CreationDate="2013-02-11T04:25:31.690" Score="5" Body="&lt;p&gt;I'm not sure if this is the best answer to your question out there, but I would disagree that your 256-bin histogram isn't equalized. Think of it this way.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Each bin represents the count of pixels of a certain intensity. When you're performing histogram equalization, you're &lt;em&gt;moving that bin&lt;/em&gt; to a new intensity value, according to the empirical distribution (i.e. histogram of the original image). You're shifting &lt;em&gt;all&lt;/em&gt; of those pixels to a new value, which means that if 30% of all your pixels had a certain value, all 30% will again be in the same bin, just with a different value.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Histogram equalization tries to equalize the &lt;em&gt;density&lt;/em&gt; of pixel values within any neighborhood. For example, since that huge bin with 30% of all pixels cannot be made smaller (all values of those pixels change to the same new value), equalization will try to move all other bins away from it, so that that neighborhood around the big bin frees up a bit. This is exactly what happens in the picture on the right. Notice that all tall bins have large spacing between them, while all short bins are stuck close together. This ensures that on average you have the same amount of pixels &quot;per unit length of histogram's x-axis&quot; if you will. This brings us to the last point.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When you're using less bins, (10 in your case), you're basically summing or averaging bins of your high-resolution histogram into a low-resolution histogram. Remember that the amount of pixels in a certain intensity neighborhood is what's really equalized, and that really manifests itself when you're summing or averaging components in one of those neighborhoods. Because taller bins have more space between them, and shorter bins have less spacing, you're getting approximately equal height bins when you sum or average. This shows that histogram equalization works as intended.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-02-11T04:25:31.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7808" PostTypeId="2" ParentId="7806" CreationDate="2013-02-11T04:56:41.980" Score="2" Body="&lt;p&gt;Manchester coding effectively creates a bit sequence that is twice as long as the given bit sequence and then applies NRZ pulses to the resulting bit stream.&#xA;There are two types of Manchester coding. In one form, each $0$ in the original&#xA;sequence is replaced by $01$ and each $1$ by $10$ while the other form complements&#xA;these bit patterns.  Using the first form, &#xA;$$101011 \to 10\,01\,10\,01\,10\,10$$ while the second form gives the complementary&#xA;bit sequence $01\,10\,01\,10\,0101$. If each data bit is of duration $T$, the NRZ&#xA;waveform with Half Sine pulses has sines of period $2T$ so that each bit&#xA;pulse has duration half a period. Thus, that leading $1$ gets&#xA;modulated to $\sin(\pi t/T)$ lasting from $t = 0$ till $t = T$.&#xA;With Manchester coding, each &lt;em&gt;channel&lt;/em&gt; bit&#xA;(of duration $T/2$) gets a Half Sine of a sine of period $T$. Put another &#xA;way, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;with plain NRZ, that first $1$ in your bit sequence will have&#xA;pulse $\sin(\pi t/T)$ lasting from $t = 0$ to $t = T$. This is a positive&#xA;going pulse rising from $0$ at $t=0$, peaking at $1$ at $t=T/2$, and&#xA;falling to $0$ at $t = T$&lt;/li&gt;&#xA;&lt;li&gt;with Manchester coding, that data $1$ will become channel $10$ giving a positive pulse $\sin(2\pi t/T)$ from $0$ to $T/2$. The next channel bit&#xA;$0$ has the &lt;em&gt;delayed&lt;/em&gt; half-sine pulse $\sin(2\pi (t-T/2)/T$ from $t=T/2$&#xA;to $t = T$, but with a &lt;em&gt;negative&lt;/em&gt; amplitude (the &lt;em&gt;channel&lt;/em&gt; bit &#xA;during this interval is $0$ instead of a $1$) which&#xA;works out to be&#xA;$$\begin{align*}&#xA;-\sin(2\pi(t-T/2)/T) &amp;amp;= -\sin(2\pi t/T - \pi)\\&#xA;&amp;amp;= -\sin(2\pi t/T)\cos(\pi) + \cos(2\pi t/T)\sin(\pi)\\&#xA;&amp;amp;= \sin(2\pi t/T)&#xA;\end{align*}$$&#xA;lasting from $t = T/2$ to $t = T$. In short, &lt;em&gt;during the entire data&#xA;bit interval&lt;/em&gt; $[0,T]$ the signal can be expressed as $\sin(2\pi t/T)$&#xA;and is &lt;em&gt;one&lt;/em&gt; cycle of the sine wave of period T. If the &lt;em&gt;data&lt;/em&gt;&#xA;bit were a $0$ instead of a $1$, the channel bits would be $01$&#xA;and we would get $-\sin(2\pi t/T)$ from $t=0$ to $t=T$. In short,&#xA;Manchester coding with half-sine pulses&#xA;effectively creates a &lt;em&gt;phase-modulated&lt;/em&gt; signal&#xA;from the data sequence with a carrier frequency of $1/T$ Hz and&#xA;each data bit interval contains exactly one period of the sinusoid.&#xA;If you look at the figure for Thomas's Manchester coding&#xA;in &lt;a href=&quot;http://en.wikipedia.org/wiki/Manchester_code&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;,&#xA;what we have is the $\pm$ rectangular pulses comprising each&#xA;data bit interval, which look like a hard-limited sinusoid&#xA;of period $T$, being replaced by the sinusoid.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The OP says, &quot;My thoughts are that with a Half Sine ....  pulse shaping &#xA;  filter, I will see the transitions between the 1's and 0's smooth out,...&quot;&#xA;  but this does not happen, there will be &lt;em&gt;abrupt&lt;/em&gt; reversals of carrier&#xA;  phase at those data bit boundaries where there is a transition&#xA;  from $0$ to $1$ or from $1$ to $0$, pretty much as happens&#xA;  in plain PSK.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-02-12T17:29:20.013" LastActivityDate="2013-02-12T17:29:20.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7809" PostTypeId="1" CreationDate="2013-02-11T09:25:38.723" Score="3" ViewCount="1933" Body="&lt;p&gt;I need to make an application in iphone which needs to calculate noise, geometric deformation other distortions in an image. How to do this? I have done some image processing stuff with opencv + iphone. But I dont know how to calculate these parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) How to calculate noise in an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What is geometric deformation and how to calculate geometric deformation of an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Is geometric deformation and distortion are same parameters in terms of image filter? or any other distortions available to calculate an image is good quality or not?&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2013-02-13T16:50:15.583" Title="How to calculate Noise and distortion of an image?" Tags="|image-processing|computer-vision|noise|opencv|distortion|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7810" PostTypeId="1" AcceptedAnswerId="7813" CreationDate="2013-02-11T16:40:58.033" Score="3" ViewCount="803" Body="&lt;p&gt;I've just read the papers from &lt;a href=&quot;https://willowgarage.com/sites/default/files/orb_final.pdf&quot; rel=&quot;nofollow&quot;&gt;Rublee et al. (ORB: an efﬁcient alternative to SIFT or SURF)&lt;/a&gt; and &lt;a href=&quot;http://www.edwardrosten.com/work/fast.html&quot; rel=&quot;nofollow&quot;&gt;Rosten et al. (Machine learning for high-speed corner detection)&lt;/a&gt; (=fast-detector). Rublee tries to explain the oriented-FAST-Detector an its improvements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there is one thin I can't understand. He assumes that a detected corner is not the real centroid of this corner. He uses the image moments to determine the real centroid. He then computes the atan2 to get the orientation of the intensity patch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Question is:&lt;/strong&gt; What will he do with this orientation? I don't see any sentence about a shift of a possible corner-point using the orientation and den centroid.&lt;/p&gt;&#xA;" OwnerUserId="3293" LastActivityDate="2013-02-12T14:35:53.507" Title="Keypoint orientation with the oFAST from Rublee's ORB" Tags="|image-processing|edge-detection|corners|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7811" PostTypeId="1" CreationDate="2013-02-11T13:21:37.200" Score="8" ViewCount="1603" Body="&lt;p&gt;Given a filter, if it is given as an equation such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x,y) = \left(\frac{\partial^2}{\partial x^2} + \frac{\partial^2}{\partial y^2}\right) \exp\left(-\frac{x^2 + y^2}{\sigma^2}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or in a kernel such as:&#xA;$$&#xA;\left[\begin{array}{rrr}&#xA;0 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; -4 &amp;amp; 1 \\&#xA;0 &amp;amp; 1 &amp;amp; 0&#xA;\end{array}\right]&#xA;$$&#xA;How much can I find out about the filter. Specifically can I find out if it is a highpass/ lowpass/ bandpass filter (if so how?), and can I find out the bandwidth of the filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it helps, the context is image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3998" OwnerDisplayName="Peter" LastEditorUserId="35" LastEditDate="2013-02-19T20:17:29.793" LastActivityDate="2013-02-19T20:17:29.793" Title="Determining Type and Bandwidth of a filter" Tags="|image-processing|filters|2d|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7812" PostTypeId="2" ParentId="7804" CreationDate="2013-02-11T17:27:55.807" Score="2" Body="&lt;p&gt;You have a confilct in your definition for t &amp;lt; 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to assume you mean f(t) = 0 for t &amp;lt; -1, with the rest of the definition unchanged. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest way I can think of doing this is to use u(t) as a tool to switch functions on and off over the desired ranges of time.  For example, if you want a function to be on over a range of time, say t1 to t2, multply the function by u(t-t1)-u(t-t2).  This turns the function on at t1 and off again at t2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One representation of your function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = [u(t+1)-u(t-1)]t + 2u(t-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this representation, we've used two functions: t and the constant function 2.&#xA;The function t is switch on at t1=-1 and off at t2=1.  The constant function '2' is switched on at t2=1 and never switched off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to use the ramp function instead of t, your function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = -[u(t+1)-u(t)]r(-t) + [u(t)-u(t-1)]r(t) + 2u(t-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here we've used three functions: -r(-t), r(t) and 2.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-02-11T23:15:23.120" LastActivityDate="2013-02-11T23:15:23.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7813" PostTypeId="2" ParentId="7810" CreationDate="2013-02-11T17:43:45.247" Score="3" Body="&lt;p&gt;The point descriptor usually requires samples at some specific locations from around the detected point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have point location refined and orientation assigned, you just shift and rotate the locations before computing point descriptor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some simple descriptors require samples at discrete locations (e.g. 15x15 pixel image patch) and applying shift+rotation will make the sample locations non-discrete (the patch is arbitrarily rotated and shifted) and you have to use bilinear or bicubic interpolation to take the pixel values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a sample of detected points - notice the corresponding patches are rotated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/f7MtY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get e.g. 64x64 matrix of values for each patch, one has to sample points rotated accordingly.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2013-02-12T14:35:53.507" LastActivityDate="2013-02-12T14:35:53.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7814" PostTypeId="2" ParentId="7811" CreationDate="2013-02-11T18:00:35.790" Score="3" Body="&lt;p&gt;If you have the MATLAB Image Processing Toolbox, you could use freqz2:&#xA;&lt;a href=&quot;http://www.mathworks.com/help/images/ref/freqz2.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/images/ref/freqz2.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scipy code for a 2-d DFT/FFT as noted by @endolith and @Mohammad&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = array([[0,1,0],[1,-4,1],[0,1,0]])&#xA;N=32; &#xA;figure(); &#xA;imshow(abs(fft2(h,s=(N,N))),interpolation='nearest');&#xA;colorbar()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="3644" LastEditDate="2013-02-11T21:44:31.260" LastActivityDate="2013-02-11T21:44:31.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7815" PostTypeId="2" ParentId="7796" CreationDate="2013-02-11T19:44:33.747" Score="2" Body="&lt;p&gt;Do you know what signs you are looking for? If yes, maybe you could do template matching (e.g. a normalized cross-correlation, available in matlab). It won't work great when signals are getting closer, since the perspective projection will change their appearance, but it should work for mid-range detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can limit your template-matching search to the right side of the road.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also template matching algorithms for affine transformations that might be a next step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Christos&lt;/p&gt;&#xA;" OwnerUserId="3603" LastEditorUserId="3603" LastEditDate="2013-02-12T19:34:07.537" LastActivityDate="2013-02-12T19:34:07.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7816" PostTypeId="2" ParentId="7811" CreationDate="2013-02-11T19:50:09.170" Score="3" Body="&lt;p&gt;The negative of the second derivative of a gaussian kernel as you have described it turns out to be what is called the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mexican_hat_wavelet&quot; rel=&quot;nofollow&quot;&gt;'Mexican Hat'&lt;/a&gt;. kernel. You can see some of its uses in the wiki. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it stands, such a filter can be used to detect edges. The kernel you have provided can also be used in the same capacity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to be able to tell if a filter is low/band/high pass is to observe it in the frequency domain, as that will tell you what bands are being suppressed, or left alone. Performing the 2-dimensional DFT, and taking the magnitude of the result should give you this information. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-02-11T19:50:09.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7817" PostTypeId="1" AcceptedAnswerId="7818" CreationDate="2013-02-11T20:05:15.737" Score="2" ViewCount="1580" Body="&lt;p&gt;I have a time series of water temperature, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = 1+(30-10).*rand(1,365);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have previously used the wavelet denoising routine in the wavelet toolbox by matlab to remove unwanted noise from a signal, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[s_denoised, ~, ~] = wden(y, 'minimaxi', 's', 'sln', 2, 'db4');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I am unsure whether I am using this method correctly! If my time series is of water temperature which is characteristic of an environmental data series i.e. high power at low frequency (e.g. seasonal cycle) and low power at high frequency (e.g. diel cycle) and I wish to remove noise caused by internal wave motion in lakes (which cause sudden increases or decreases in temperature), should I be using the wavelet shown here or is there a better wavelet to use? &lt;/p&gt;&#xA;" OwnerUserId="3774" LastActivityDate="2013-03-06T16:42:15.427" Title="wavelet denoising routine for environmental data series" Tags="|matlab|wavelet|denoising|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7818" PostTypeId="2" ParentId="7817" CreationDate="2013-02-11T20:53:55.850" Score="4" Body="&lt;p&gt;First, a comment - before you denoise, you are basically going to be converting your data from the (time)-domain into the wavelet domain. This is nothing but a series of projections of your data unto user-picked basis functions. (The wavelets). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you denoise, you will be zeroing out, or shrinking, coefficients which (ostensibly) belong to the noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, imagine that you picked a wavelet type, and when you transformed your noiseless signal, the very first coefficient was some number, and the rest were zero. This means that you &lt;em&gt;know&lt;/em&gt;, that your pure signal, will always give you a non-zero as the first coefficient in the wavelet domain, with other coefficients always being zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine that you transformed your noisy signal. You would probably still see a high value for that first coefficient, (belonging to your true data), but all the other coefficients that you were expecting to be zero have some small value. If you zero them out and inverse transform, you have denoised your signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question you want to answer then becomes, &lt;em&gt;&quot;Which wavelet type, when projected against my data, gives me the &lt;strong&gt;sparsest&lt;/strong&gt; representation in the wavelet domain?&quot;&lt;/em&gt; In other words, which wavelet, when used against your (pure, noiseless) data, gives you coefficients that are mostly zero? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, what you want is a wavelet that has as many vanishing moments as your data template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; For example, let us say that know that your data template (in your case, the temperature without internal wave motion corruption) is a polynomial of 0th order, (a constant), then you want to use the Haar wavelet, since it has 1 vanishing moment. This means that if you transform your pure-signal into the Haar domain, most of the coefficients will be zero. However when you transform your data-with-internal-wave-corruption, the coefficients that were normally zero now have some value, that you can then clobber and inverse transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same thing can be said for other templates. Let us say that your pure-data was a polynomial with maximum degree of 7. That means then that you want a wavelet that &lt;em&gt;makes my polynomials of maximum degree 7 disappear&lt;/em&gt;, or in other words, has 8 vanishing moments. This would make your signal look quite sparse in the transform domain, and thus any other noise of higher order would make it less sparse, and you would be able to denoise by removing those suspicious coefficients that were supposed to be zero. &lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2013-03-06T16:42:15.427" LastActivityDate="2013-03-06T16:42:15.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7819" PostTypeId="1" AcceptedAnswerId="7820" CreationDate="2013-02-11T22:02:00.550" Score="12" ViewCount="3002" Body="&lt;p&gt;A median filter is a non-linear and lossy process, so it doesn't have a closed form frequency response as would a FIR filter (say a box filter of the same length) in an LTI system.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;But how closely can something similar to a frequency response of a median filter be approximated?  &lt;/li&gt;&#xA;&lt;li&gt;How would this scale with the length of a median filter?  &lt;/li&gt;&#xA;&lt;li&gt;Under what conditions or for what class of signals might this approximation be ballpark &quot;close&quot;?  &lt;/li&gt;&#xA;&lt;li&gt;For what class of signals might this approximation be very inaccurate? &lt;/li&gt;&#xA;&lt;li&gt;What kinds of frequency domain distortion or additive noise does a median filter produce?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="154" LastEditorUserId="1629" LastEditDate="2016-09-11T08:38:43.023" LastActivityDate="2016-09-11T08:38:43.023" Title="Approximating the frequency response of a median filter" Tags="|noise|frequency-response|filtering|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7820" PostTypeId="2" ParentId="7819" CreationDate="2013-02-11T22:49:28.093" Score="9" Body="&lt;p&gt;For a start, any &lt;em&gt;non-linear&lt;/em&gt; system will not have an easily-identifiable frequency response. So, it's really a nonsensical question. I intend no offense; nonsensical questions are often the  most enlightening!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However one way to &lt;em&gt;try&lt;/em&gt; to answer your question is to assume that the LTI filter involved is the &lt;code&gt;mean&lt;/code&gt; (rather than the &lt;code&gt;median&lt;/code&gt;) of the windowed data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Under what conditions or for what class of signals might this approximation be ballpark &quot;close&quot;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;becomes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Under what conditions or for what class of signals might the mean be ballpark &quot;close&quot; to the median.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In that case, for a purely stochastic signal, the mean and median are similar when the probability density function (PDF) of the signal is symmetric about the mean.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For what class of signals might this approximation be very inaccurate?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When the signal's PDF is &quot;very&quot; asymmetric. &lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-02-11T22:49:28.093" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7822" PostTypeId="1" AcceptedAnswerId="7823" CreationDate="2013-02-12T12:20:10.507" Score="5" ViewCount="1185" Body="&lt;p&gt;I am analyzing some time series of sea surface water temperature and am using wavelet analysis to do so. I am computing the continuous wavelet transform and then removing some specific frequencies and then converting the series back from the frequency to the time domain. I am following the methods of torrence and compo 1998 (Practical guide to wavelet analysis) to perform this operation but am a bit confused as to why my results are not as expected. As an example, I will fist decompose the time series into the frequency domain and then reconstruct the signal without altering any of the coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q4KIA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the attached figure we have the original series in red and the reconstructed series in blue, straight away we can see that the the reconstructed signal is much lower than the original series. The main reason I think this occurs is that the wavelet transform normalizes the series to have unit energy (in order to compare the coefficients across scales). Therefore, I was wondering if it was possible to convert the reconstructed signal back to have the same magnitude (?) as the original series i.e. reverse the normalizing to have unit energy stage?&lt;/p&gt;&#xA;" OwnerUserId="3774" LastActivityDate="2013-02-12T13:47:27.923" Title="wavelet analysis normalized to have unit energy" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7823" PostTypeId="2" ParentId="7822" CreationDate="2013-02-12T13:47:27.923" Score="3" Body="&lt;p&gt;Take the mean of the original signal and add it to the reconstructed signal. IIRC wavelets have no DC response, and so the reconstructed signal will have 0 mean.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-02-12T13:47:27.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7824" PostTypeId="1" CreationDate="2013-02-12T14:10:04.993" Score="4" ViewCount="3250" Body="&lt;p&gt;I have read some papers about distance measures like Euclidean, Manhattan or Chi-Square for matching gradient based image descriptors like those computed from the SIFT Algorithm (128-D vectors). Most of them state, that one or the other measure is more suitable for that task and that this decision depends on the noise distribution assumed (Like L2 is suitable if Gaussian noise is assumed or L1 for Laplacian noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: how do I determine the distribution of my descriptors and how does that affect the choice for a distance measure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In one paper the authors stated that the distribution would be the distances between SIFT descriptors of correctly matching keypoints. But doesn't that mean this distribution is biased by the choice of the distance metric itself?!&lt;/p&gt;&#xA;" OwnerUserId="969" LastEditorUserId="26" LastEditDate="2013-02-14T15:58:46.163" LastActivityDate="2021-12-19T08:35:23.170" Title="What is a good distance measure for matching SIFT descriptors depending on the distribution of their noise?" Tags="|image-processing|computer-vision|statistics|object-recognition|distance-metrics|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7825" PostTypeId="1" AcceptedAnswerId="7826" CreationDate="2013-02-12T19:05:38.943" Score="10" ViewCount="2338" Body="&lt;p&gt;This &lt;em&gt;might&lt;/em&gt; be a terminology question but I am not sure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, what is the difference between &lt;em&gt;conventional&lt;/em&gt; beamformers, and &lt;em&gt;adaptive&lt;/em&gt; beamformers? I thought that all beamformers were inherently adaptive to some criteria, like minimization of distortion or variance, or some other spatial filtering criteria etc. So what is the difference between them?&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-02-13T14:07:34.507" Title="Difference between 'conventional' and 'adaptive' beamformers?" Tags="|filters|frequency|adaptive-filters|adaptive-algorithms|beamforming|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7826" PostTypeId="2" ParentId="7825" CreationDate="2013-02-12T20:07:27.827" Score="12" Body="&lt;p&gt;A beamformer is basically a spatial filter.  It can be passive, just like a temporal filter.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of samples separated by time, they are separated by space.  A passive temporal filter can be a bandpass that is &quot;aimed&quot; or &quot;steered&quot; at a particular frequency.  For passive spatial filters (i.e. beamformers), the filter can be steered towards a particular angle of arrival, instead of temporal frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adaptive filters/beamformers can be incredible because they can &quot;steer&quot; a null towards a frequency or angle where there is an interfering signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just like a temporal adaptive filter, a spatial adaptive filter (i.e. beamformer) is constantly adjusting the filter weights/coefficients to optimize some criteria that usually involves &quot;nulling out&quot; or &quot;rejecting&quot; an interferer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a diagram of a CBF that is called a &quot;K-Omega&quot; Beamformer.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TPwe9.png&quot; alt=&quot;K-Omega Beamformer Diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a diagram to reinforce the idea that a passive beamformer is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o3bfb.png&quot; alt=&quot;Beamformer Concept&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize that these are a bit random, but hopefully you can follow the logic of the above.&#xA;I'll see if I can find a better diagram that more clearly shows what's happening.  To be clear, the windows referred to above are Hamming/Hanning type windows, and this process is basically returning a 2-d matrix where temporal frequency is on the x-axis and a special spatial variable is on the y-axis.  This special variables makes the math easier, and it's a one step process to convert the special spatial variable and temporal frequency to an angle of arrival.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The green lines below are lines of constant angles.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gftA9.png&quot; alt=&quot;Beamforming Angle Lines&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that all of this is for CBF (conventional beamformers) and the above covers all spatial and temporal frequency (within the limits of Nyquist.&lt;br&gt;&#xA;Some common ABF techniques are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MPDR - Minimum Power Distortionless Rejection BF (Described by Van Trees)&#xA;DMR - Dominant Mode Rejection BF (Abraham and Owsley)&#xA;R-DMR - Robust Dominant Mode Rejection BF (Cox and Pitre)&#xA;EBAE - DMR BF with Eigenvector Beam Association and Excision (Kogon)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of using a spatial FFT as the spatial filtering operation, these techniques typically involve constructing an updated spatial autocorrelation matrix of the incoming signal, and then using that matrix or eigenvectors of that matrix to adaptively influence the spatial filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update for @Mohammad:&#xA;Below is the list that of beamforming texts I received from my professor:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Van Veen, B.D.; Buckley, K.M.; , &quot;Beamforming: a versatile approach to spatial filtering,&quot; ASSP Magazine, IEEE , vol.5, no.2, pp.4-24, April 1988&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Efficient digital beamforming in the frequency domain&#xA;Brian Maranda, J. Acoust. Soc. Am. 86, 1813 (1989)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Array Signal Processing by Don Johnson and Dan Dudgeon, Prentice Hall, 1993&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Optimum Array Processing by Harry L. Van Trees, Wiley, 2002.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, after searching around, this looks very interesting.  It seems to be more interested in the practical/implementation side than the theory.  I don't have it but I'll probably buy a copy:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Practical Array Processing by Mark Sullivan, McGraw Hill, 2008 ( &lt;a href=&quot;http://www.practicalarrayprocessing.com/index.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.practicalarrayprocessing.com/index.html&lt;/a&gt; )&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="3644" LastEditDate="2013-02-13T14:07:34.507" LastActivityDate="2013-02-13T14:07:34.507" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7827" PostTypeId="1" AcceptedAnswerId="7828" CreationDate="2013-02-12T20:14:42.620" Score="-1" ViewCount="617" Body="&lt;p&gt;I'm using matlab/octave and would like some help trying to improve the speed of my code.  I've tried to vectorize the code but I run out of memory so I went back to for loops.  What I'm trying to do is have a function that will allow me to shift an array cell by cell.  The reason I'm doing this is to have exact precision over a signal.  Once I shift the array I plan on adding several of them together and comparing them to the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a function along with some test code to test the speed. See times and code below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ii = 0&#xA;-elapsed time -67.5671sec- or -1.1261mins- or -0.0188hours-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ii =  14700&#xA;-elapsed time -613.3785sec- or -10.2230mins- or -0.1704hours-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ii =  29400&#xA;-elapsed time -1150.6487sec- or -19.1775mins- or -0.3196hours-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code takes a long time to run on 1 second of an audio signal at a sample rate of 44100 any idea how I can speed this up and accomplish my goals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Function:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [array_shifted]=rtphaseshiftarraypts(sigarray,pts_to_shift)&#xA;fs=length(sigarray);&#xA;&#xA;a_L=zeros(1,length(sigarray));&#xA;&#xA;cycle_permute_lt = @(sigarray, k) [sigarray(mod((1:end)-k-1, end)+1 )];&#xA;&#xA;for ii=0:1:fs&#xA;    a_L=cycle_permute_lt(sigarray, ii+pts_to_shift);    &#xA;end;&#xA;array_shifted=a_L;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Test Code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all, clc,clf,tic&#xA;fs=44100; &#xA;t=linspace(0,2*pi,fs);&#xA;y=sinc(t*1);&#xA;y=fliplr(y); %just flipping y to look like milo wolffs&#xA;[y]=rtphaseshiftarraypts(y,fs/2);&#xA;&#xA;&#xA;lr_sig=[y*1 -y*1];&#xA;for ii=0:round(fs/3):fs %ii=0:1:90 going right , ii=0:-1:-90 going left&#xA;&#xA;    array_shifted_L=y*1; %ampcomb(ii);&#xA;    array_shifted_R=-y*1; %ampcomb(ii);&#xA;    ii &#xA;    fprintf('\n-elapsed time -%4.4fsec- or -%4.4fmins- or -%4.4fhours-\n',toc,toc/60,toc/3600);&#xA;&#xA;    acombr=rtphaseshiftarraypts(lr_sig,ii);&#xA;    acombl=rtphaseshiftarraypts(lr_sig,-ii+fs/2);&#xA;&#xA;    subplot(4,1,1),plot(array_shifted_L)&#xA;    ylabel('rgt-in-wave')&#xA;    axis([0 fs+100 -2 2])&#xA;&#xA;    subplot(4,1,2),plot(array_shifted_R)&#xA;    ylabel('lft-out-wave')&#xA;    axis([0 fs+100 -2 2])&#xA;&#xA;    subplot(4,1,3),plot(acombr)&#xA;    axis([0 (fs*2)+100 -2 2])&#xA;&#xA;    subplot(4,1,4),plot(acombl)&#xA;    axis([0 (fs*2)+100 -2 2])&#xA;    str_title='Angle is '; &#xA;    title([str_title,num2str(ii),' pts']) %turns of latex interperter so I can use underscores my way&#xA;&#xA;    pause(.001)&#xA;    %hold on    &#xA;end&#xA;fprintf('\nfinally Done-elapsed time -%4.4fsec- or -%4.4fmins- or -%4.4fhours-\n',toc,toc/60,toc/3600);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1894" LastEditorUserId="1894" LastEditDate="2013-02-12T20:29:29.040" LastActivityDate="2013-02-12T20:34:01.600" Title="Shifting / Permutation of an array taking a long time" Tags="|matlab|signal-analysis|octave|" AnswerCount="1" CommentCount="4" ClosedDate="2013-02-13T15:52:22.433" ContentLicense="CC BY-SA 3.0" />
  <row Id="7828" PostTypeId="2" ParentId="7827" CreationDate="2013-02-12T20:34:01.600" Score="1" Body="&lt;p&gt;Your example is to take:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1,2,3,4,5,6,7,8,9,10&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;3,4,5,6,7,8,9,10,1,2&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would just &lt;a href=&quot;https://stackoverflow.com/questions/11584711/how-to-perform-a-column-by-column-circular-shift-of-a-matrix-without-a-loop&quot;&gt;follow this example&lt;/a&gt; and use &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/circshift.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;circshift&lt;/code&gt;&lt;/a&gt;, or that more detailed solution for multi-dimensional arrays.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2013-02-12T20:34:01.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7829" PostTypeId="1" CreationDate="2013-02-12T21:37:50.820" Score="0" ViewCount="544" Body="&lt;p&gt;I use Nearest Neighbour function of Scikit learn module in python for training and compare an image set (&lt;a href=&quot;https://docs.google.com/file/d/0B6zJ3_hrkW40U182SWNWX3o4dE0/edit?usp=sharing&amp;amp;pli=1&quot; rel=&quot;nofollow&quot;&gt;https://docs.google.com/file/d/0B6zJ3_hrkW40U182SWNWX3o4dE0/edit?usp=sharing&amp;amp;pli=1&lt;/a&gt;)&#xA;By deafult NN function use euclidean distance, but in these way it mixes all feature without giving a weight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use feature like solidity, and Humoment that are rotation and scale invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my features:&lt;br&gt;&#xA;    [[solidity,1sthumoment,2ndhumoment, 3rdhumoment, 4thhumoment, 5thhumoment,6thhumoment,7thhumoment][...]...]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[0.87044372948387361, 0.063642083932879651, 0.12356758667941924, 0.0079915727336300653, 0.0002061055245765021, 0.0019832214511596759, 0.000143483068555641, 0.17750220723974636]&#xA;[0.43762295557263098, 0.032602517700434798, 0.0045084338591890975, 0.00040343031030726695, -4.3220757761746937e-07, 4.1662265592274961e-05, -3.3048990436934407e-07, 2.83559235524301e-05]&#xA;[0.67217292360607472, 0.21411359416298198, 0.038240138048085716, 0.00056521478226677867, 1.6126276972407056e-06, 0.00020982069131408694, -2.0746983237760103e-06, 0.00030014256771966684]&#xA;[0.51893243284454049, 0.14486098229876093, 0.007011404157031503, 0.00042653374379056195, -6.0947207554547829e-07, 0.00015935932421697882, -4.1548384524149294e-07, 0.0013995801259622112]&#xA;[0.72398269966588791, 0.31689878513436764, 0.00089365579831210602, 0.00022784188716352421, 6.83376830706894e-08, -5.1956738361704706e-05, 7.6810569991291178e-08, 0.0005244526025960404]&#xA;...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which are the best similarity metrics i could use for that image set, with that features ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here (&lt;a href=&quot;http://scikit-learn.org/dev/modules/generated/sklearn.neighbors.KNeighborsClassifier.html&quot; rel=&quot;nofollow&quot;&gt;http://scikit-learn.org/dev/modules/generated/sklearn.neighbors.KNeighborsClassifier.html&lt;/a&gt;)&#xA;i saw Minkowski metric,manhattan_distance, euclidean_distance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Parameter for the Minkowski metric from sklearn.metrics.pairwise.pairwise_distances. When p = 1, this is equivalent to using manhattan_distance (l1), and euclidean_distance (l2) for p = 2. For arbitrary p, minkowski_distance (l_p) is used&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or maybe:&quot; a user-defined function which accepts an array of distances, and returns an array of the same shape containing the weights.&quot;&lt;/p&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="3597" LastEditDate="2013-02-12T22:50:04.717" LastActivityDate="2024-04-02T01:07:20.867" Title="What distance metric can I use for comparing image features in a nearest neighbour algorithm?" Tags="|image-processing|distance-metrics|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7830" PostTypeId="1" CreationDate="2013-02-12T22:22:33.163" Score="5" ViewCount="2158" Body="&lt;p&gt;&lt;a href=&quot;http://freeverb3.sourceforge.net/iir_filter.shtml&quot; rel=&quot;nofollow&quot;&gt;A practical guide for digital IIR audio filters&lt;/a&gt; has cookbook-style values for creating higher-order Bessel filters out of biquads, but the values listed aren't very precise:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;You should multiply the Fc for each stage by the following coefficients:&#xA;1: 1.00&#xA;2: 1.27&#xA;3: 1.32 1.45&#xA;4: 1.60 1.43&#xA;5: 1.50 1.76 1.56&#xA;6: 1.90 1.69 1.60&#xA;&#xA;The corresponding Q values are:&#xA;1: ---&#xA;2: 0.58&#xA;3: --- 0.69&#xA;4: 0.81 0.52&#xA;5: ---- 0.92 0.56&#xA;6: 1.02 0.61 0.51&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What are the expressions to calculate these values exactly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Butterworth table, &lt;a href=&quot;http://www.dsprelated.com/showmessage/74598/1.php&quot; rel=&quot;nofollow&quot;&gt;the values are given by&lt;/a&gt; &lt;code&gt;Q = 1/(2 * sin((pi / N) * (n + 1 / 2)))&lt;/code&gt;, for instance.  So where the table says &lt;code&gt;4: 0.54 1.31&lt;/code&gt;, the equation gives 1.3065629648763766 and 0.54119610014619701.  But I can't find the expression for Bessel filters, except that &lt;code&gt;2: 0.58&lt;/code&gt; is $1\over\sqrt3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://read.pudn.com/downloads48/sourcecode/math/163974/besselap.m__.htm&quot; rel=&quot;nofollow&quot;&gt;Prototype-generating&lt;/a&gt; &lt;a href=&quot;https://github.com/scipy/scipy/blob/master/scipy/signal/filter_design.py#L1509&quot; rel=&quot;nofollow&quot;&gt;functions&lt;/a&gt; just have long tables of numbers, so maybe these are not easy to calculate?  (Bessel functions?)  If so, a listing of these Q and Fc values for the first several orders would be good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(And yes, I know the bilinear transformed Bessel &lt;a href=&quot;http://www.dsprelated.com/showmessage/78866/1.php&quot; rel=&quot;nofollow&quot;&gt;is no longer linear-phase&lt;/a&gt;.  :/  I just want to know where these numbers are from.)&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-02-13T02:06:10.447" LastActivityDate="2013-03-13T19:40:42.210" Title="Bessel filter second-order sections Q and Fc multiplier derivation" Tags="|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7833" PostTypeId="1" AcceptedAnswerId="7843" CreationDate="2013-02-13T09:56:43.147" Score="21" ViewCount="92216" Body="&lt;p&gt;Is there any existing application to sample someone's voice and use it to modulate any other voice or synthesize a text to resemble the original one? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, this &lt;a href=&quot;http://www2.research.att.com/~ttsweb/tts/demo.php&quot;&gt;Text-to-Speech Demo by AT&amp;amp;T&lt;/a&gt; lets you choose a voice and a language from presets that I guess are based on some human voice that have been sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you call this process? Is it voice modulation? Voice synthesis?&lt;/p&gt;&#xA;" OwnerUserId="3784" LastEditorUserId="3784" LastEditDate="2013-02-13T17:04:20.660" LastActivityDate="2015-10-13T18:40:44.380" Title="How to mimic/copy/fake someone's voice?" Tags="|modulation|voice|" AnswerCount="4" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7834" PostTypeId="1" CreationDate="2013-02-13T13:08:10.623" Score="1" ViewCount="2926" Body="&lt;p&gt;How can i measure shape elongation faeture in matlab or python opencv?&#xA;There is a function library or i have to implement to my own?&#xA;In case there is no function, i found this definition: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The less-common elongation shape factor is defined as the square root of the ratio of the two second moments in of the particle around its principal axes&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f_elong = sqrt (i2/i1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where i found these first and second moments?&lt;/p&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="3597" LastEditDate="2013-02-13T13:32:48.483" LastActivityDate="2013-05-14T15:16:55.220" Title="How can i measure shape elongation feature in matlab or python opencv?" Tags="|image-processing|matlab|python|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7836" PostTypeId="2" ParentId="7830" CreationDate="2013-02-13T14:09:09.377" Score="2" Body="&lt;p&gt;There is no simple closed-form equation to calculate Bessel filter bi-quad coefficients. The poles of the filter come from a Bessel polynomial. Higher order Bessel polynomials are determined using a recursion relationship. You need computer algorithms to calculate the poles and resolve the bi-quad coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two books I can recommend: &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/047182352X&quot; rel=&quot;nofollow&quot;&gt;“Passive and Active Filters” by Wai-Kai Chen&lt;/a&gt; and &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0195107349&quot; rel=&quot;nofollow&quot;&gt;“Analog Filter Design” by M.E. Van Valkenburg&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="29" LastEditDate="2013-02-13T20:38:24.870" LastActivityDate="2013-02-13T20:38:24.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7837" PostTypeId="2" ParentId="7834" CreationDate="2013-02-13T14:35:23.390" Score="1" Body="&lt;p&gt;In the Image Processing Toolbox for MATLAB there is a function called &lt;code&gt;regionprops&lt;/code&gt;, which may be what you need. It takes a binary image, finds connected components in it, and returns various measurements of each connected component.  Here's a list of things it can compute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Shape Measurements&#xA;&#xA;  'Area'              'EulerNumber'       'Orientation'               &#xA;  'BoundingBox'       'Extent'            'Perimeter'          &#xA;  'Centroid'          'Extrema'           'PixelIdxList' &#xA;  'ConvexArea'        'FilledArea'        'PixelList'&#xA;  'ConvexHull'        'FilledImage'       'Solidity' &#xA;  'ConvexImage'       'Image'             'SubarrayIdx'            &#xA;  'Eccentricity'      'MajorAxisLength' &#xA;  'EquivDiameter'     'MinorAxisLength'                   &#xA;&#xA;Pixel Value Measurements (requires grayscale image as an input)&#xA;&#xA;  'MaxIntensity'&#xA;  'MeanIntensity'&#xA;  'MinIntensity'&#xA;  'PixelValues'&#xA;  'WeightedCentroid'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-02-13T14:35:23.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7838" PostTypeId="2" ParentId="7809" CreationDate="2013-02-13T16:50:15.583" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You should do it on a known set of calibration targets. For example, this type of calibration target is being used to measure noise. You should find the patches locations, and measure the noise by some metric. If you don't know any metric, you can start by browsing &lt;a href=&quot;http://www.dxolabs.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;DXOlabs&lt;/a&gt; site, or &lt;a href=&quot;http://www.imatest.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imatest&lt;/a&gt; site.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1xLZY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I guess that you mean radial distortion. Radial distortion can be found by a process called camera calibration, by using a known target such as checkerboard. For more info, see &lt;a href=&quot;http://www.vision.caltech.edu/bouguetj/calib_doc/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Camera Calibration Toolbox&lt;/a&gt;. Here is an image from another software that does it:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/M92IC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I didn't understand your question at all. Please reprase it and add more information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="698" LastActivityDate="2013-02-13T16:50:15.583" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7839" PostTypeId="2" ParentId="7833" CreationDate="2013-02-13T19:30:50.860" Score="0" Body="&lt;p&gt;What you are looking for is called a vocoder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you tried Audcity's vocoder? Audacity can be downloaded from: &lt;a href=&quot;http://audacity.sourceforge.net/download&quot; rel=&quot;nofollow&quot;&gt;http://audacity.sourceforge.net/download&lt;/a&gt;. A demo on how to use it can be found at &lt;a href=&quot;https://www.youtube.com/watch?v=J_rPEmJfwNs&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=J_rPEmJfwNs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2013-02-13T19:30:50.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7840" PostTypeId="1" AcceptedAnswerId="7841" CreationDate="2013-02-13T20:16:02.070" Score="5" ViewCount="370" Body="&lt;p&gt;I am having a really hard time in understanding how to formulate a model say linear AR model to represent a communication channel or maybe any motion. I have the experimental data representing the kinematics of robot movement. In the case of a communication channel, it will have a medium, transmitter and receiver. So, will the medium be represented by AR model or do we represent the transmitter and receiver by these models? How to decide the order of the system to be chosen initially. I am not from the area of signal processing but need to use this for a part of my research work. I have gone through literature review and the background of Kalman filter, Least square method, recursive least square for estimation purpose. But I cannot find a good example which shows how the parameters are estimated from the time series or motion data or speech modeling. Can somebody explain or point out the starting point and how to go about it? I know this is a very broad topic but an explaination with a small example will be really an eye opener for a beginner.&lt;/p&gt;&#xA;" OwnerUserId="750" LastActivityDate="2013-02-13T22:27:47.543" Title="How to perform model fitting for system identification" Tags="|linear-systems|autoregressive-model|system-identification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7841" PostTypeId="2" ParentId="7840" CreationDate="2013-02-13T21:26:43.070" Score="3" Body="&lt;p&gt;In any signal processing problem, there are usually two components: the signal model and the channel model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal model is the mathematical description of how your &lt;em&gt;ideal&lt;/em&gt; signal, call it $s(t)$ is generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The channel model is the mathematical description of how your channel corrupts or alters the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One aim in telecommunications is to look at the received signal $r(t)$ --- $s(t)$ corrupted by the channel --- and try to undo the effects of the channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose&#xA;$$&#xA;s(t) = A \sin(\omega_0 t + \phi)&#xA;$$&#xA;and suppose the channel is:&#xA;$$&#xA;r(t) = h(t)*s(t) + n(t)&#xA;$$&#xA;where $h(t)$ is the impulse response of the channel, and $n(t)$ is some additive noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this context, your &quot;AR&quot;  filter is the $h(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the context is in robotics or kinematics, then things &lt;a href=&quot;https://dsp.stackexchange.com/questions/320/is-a-kalman-filter-suitable-to-filter-projected-points-positions-given-euler-an/321#321&quot;&gt;get a little more complicated.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Did you open the &quot;Algorithm&quot; tab on the link in your comment? It's pretty straighforward:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The polyfit MATLAB file forms the Vandermonde matrix, $\bf V$, whose elements are powers of $x$: &lt;br&gt;&#xA;  $v_{i,j} = x_i^{n - j}$ &lt;br&gt;&#xA;  It then uses the backslash operator, $\backslash $, to solve the least squares problem ${\bf V} p \approx y$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-02-13T22:27:47.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7842" PostTypeId="2" ParentId="7833" CreationDate="2013-02-13T21:26:51.873" Score="4" Body="&lt;p&gt;You can use something like &lt;a href=&quot;http://www.screamingbee.com/product/MorphVOX.aspx&quot; rel=&quot;nofollow&quot;&gt;MorphVox&lt;/a&gt;. &lt;a href=&quot;http://www.youtube.com/watch?v=13t69RVq1YY&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a demonstration. The process is called voice morphing or conversion. If you are interested in the technical aspects, a recent article you can study is &lt;em&gt;Voice Conversion Using Dynamic Kernel Partial Least Squares Regression&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-02-13T21:26:51.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7843" PostTypeId="2" ParentId="7833" CreationDate="2013-02-13T21:28:19.410" Score="27" Body="&lt;p&gt;A first note: Most modern text-to-speech systems, like the one from AT&amp;amp;T you have linked to, use &lt;em&gt;concatenative speech synthesis&lt;/em&gt;. This technique uses a large database of recordings of one person's voice uttering a long collection of sentences - selected so that the largest number of phoneme combinations are present. Synthesizing a sentence can be done just by stringing together segments from this corpus - the challenging bit is making the stringing together seamless and expressive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two big hurdles if you want to use this technique to make president Obama say embarrassing words:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You need to have access to a large collection of sentences of the target voice, preferably recorded with uniform recording conditions and good quality. AT&amp;amp;T has a budget to record dozens of hours of the same speaker in the same studio, but if you want to fake someone's voice from just 5 mins of recording it will be difficult.&lt;/li&gt;&#xA;&lt;li&gt;There is a considerable amount of manual alignment and preprocessing before the raw material recorded is in the right &quot;format&quot; to be exploited by a concatenative speech synthesis system.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Your intuition that this is a possible solution is valid - provided you have the budget to tackle these two problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, there are other techniques which can work with less supervision and less data. The field of speech synthesis interested in &quot;faking&quot; or &quot;mimicking&quot; one voice from a recording is known as &lt;em&gt;voice conversion&lt;/em&gt;. You have a recording A1 of target speaker A saying sentence 1, and a recording B2 of source speaker B saying sentence 2, you aim at producing a recording A2 of speaker A saying sentence 2, possibly with access to a recording B1 of speaker B reproducing with his/her voice the same utterance as the target speaker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The outline of a voice conversion system is the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Audio features are extracted from recording A1, and they are clustered into acoustic classes. At this stage, it is a bit like having bags will all &quot;a&quot; of speaker A, all &quot;o&quot; of speaker A, etc. Note that this is a much simpler and rough operation than true speech recognition - we are not interested in recognizing correctly formed words - and we don't even know which bag contains &quot;o&quot; and which bag contains &quot;a&quot; - we just know that we have multiple instances of the same sound in each bag.&lt;/li&gt;&#xA;&lt;li&gt;The same process is applied on B2.&lt;/li&gt;&#xA;&lt;li&gt;The acoustic classes from A1 and B2 are aligned. To continue with the bags analogy, this is equivalent to pairing the bags from step 1 and 2, so that all the sounds we have in this bag from speaker A should correspond to the sounds we have in that bag from speaker B. This matching is much easier to do if B1 is used at step 2.&lt;/li&gt;&#xA;&lt;li&gt;A mapping function is estimated for each pair of bags. Since we know that this bag contains sounds from speaker A, and that bag the same sounds but said by speaker B - we can find an operation (for example a matrix multiplication on feature vectors) that make them correspond. In other words, we now know how to make speaker 2's &quot;o&quot; sound like speaker 1's &quot;o&quot;.&lt;/li&gt;&#xA;&lt;li&gt;At this stage we have all cards in hand to perform the voice conversion. From each slice of the recording of B2, we use the result of step 2. to figure out which acoustic class it corresponds to. We then use the mapping function estimated at step 4 to transform the slice.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I insist on the fact that this operates at a much lower level than performing speech recognition on B2, and then doing TTS using A1's voice as a corpus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Various statistical techniques are used for steps 1 and 2 - GMM or VQ being the most common ones. Various alignment algorithms are used for part 2 - this is the trickiest part, and it is obviously easier to align A1 vs B1, than A1 vs B2. In the simpler case, methods like Dynamic Time Warping can be used to make the alignment. As for step 4, the most common transform are linear transforms (matrix multiplication) on feature vectors. More complex transforms make for more realistic imitations but the regression problem to find the optimal mapping is more complex to solve. Finally, as for step 5, the quality of resynthesis is limited by the features used. LPC are generally easier to deal with a simple transformation method (take signal frame -&gt; estimate residual and LPC spectrum -&gt; if necessary pitch-shift residual -&gt; apply modified LPC spectrum to modified residual). Using a representation of speech that can be inverted back to the time domain, and which provide good separation between prosody and phonemes is the key here! Finally, provided you have access to aligned recordings of speaker A and B saying the same sentence, there are statistical models which simultaneously tackle steps 1, 2, 3 and 4 in one single model estimation procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I might come back with a bibliography later, but a very good place to start to get a feel for the problem and the overall framework used to solve it is Stylianou, Moulines and Cappé's &quot;A system for voice conversion based on probabilistic classification and a harmonic plus noise model&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is to my knowledge no widely piece of software performing voice conversion - only software modifying properties of the source voice - like pitch and vocal tract length parameters (For example IRCAM TRAX transformer) - with which you have to mess in the hope of making your recording sound closer to the target voice.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-02-13T21:42:45.027" LastActivityDate="2013-02-13T21:42:45.027" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="7845" PostTypeId="2" ParentId="866" CreationDate="2013-02-14T02:15:49.513" Score="2" Body="&lt;p&gt;What appears to be happening is, as you start over-modeling, the error signal becomes less and less white.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I modified your code to return the error signal (part of the &lt;code&gt;residue&lt;/code&gt; term).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plot shows the off-zero-lag coefficients of the &lt;code&gt;xcorr&lt;/code&gt; of the error for order = 2 (blue), 3 (red), and 4 (green).  As you can see, the close-to-but-not-zero lag terms are getting larger in magnitude. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at the FFT (spectrum) of the &lt;code&gt;xcorr&lt;/code&gt; of the error, then we see that the lower frequency terms (that cause the large drifts) are getting smaller (the error is containing more high frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it seems the effect of over-modeling in this case is to high-pass filter the error, which (for this example) is beneficial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l0idq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BNoDl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [th,err]=ar_nlms(y,order,mu)&#xA;eps = 0.000000001;&#xA;N=length(y);&#xA;th=zeros(order,N); // estimated parameters&#xA;err = zeros(1,N);&#xA;for t=order+1:N&#xA;    phi = -y( t-1:-1:t-order, : );&#xA;    err(t) = y(t)-phi'*th(:,t-1);&#xA;    residue = phi*( err(t) );&#xA;    th(:,t) = th(:,t-1) + (mu/(phi'*phi+eps)) * residue;&#xA;    size(residue)&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-02-14T02:15:49.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7846" PostTypeId="1" CreationDate="2013-02-14T06:01:20.023" Score="7" ViewCount="3282" Body="&lt;p&gt;I am trying to simulate a model of an ADC and determine its performance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the interesting properties is the &lt;a href=&quot;http://en.wikipedia.org/wiki/ENOB&quot; rel=&quot;noreferrer&quot;&gt;ENOB (Effective Number Of Bits)&lt;/a&gt;, which can be calculated from &lt;a href=&quot;http://en.wikipedia.org/wiki/SINAD&quot; rel=&quot;noreferrer&quot;&gt;SINAD (SIgnal-to-Noise And Distortion ratio)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On that SINAD Wikipedia page, there is a &lt;a href=&quot;http://www.analog.com/static/imported-files/tutorials/MT-003.pdf&quot; rel=&quot;noreferrer&quot;&gt;PDF document&lt;/a&gt; which suggests that the second definition on the SINAD Wikipedia page is the one to use and which I interpreted to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;SINAD = 10 \log_{10} \left( \frac{p_f} {\sum_i{(p_i)} - p_0 - p_f} \right)dB&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $p_x$ is the power the FFT bin at frequency $x$, $p_f$ is the power of the frequency bin containing the signal frequency $f$ and $p_0$ is the DC component. I calculate the power of each bin by squaring the normalized amplitude. Also note that the sum in that equation runs over all frequencies from $0$ to the Nyquist bandwidth $f_s/2$ with $f_s$ being the sampling frequency of the ADC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That same document also defines&#xA;$$&#xA;ENOB = \frac{SINAD-1.76dB}{6.02}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using my SINAD and this ENOB definition, I compared the output of an ideal $N$ bit ADC model, which matched for my FFT depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;http://www.analog.com/static/imported-files/tutorials/MT-001.pdf&quot; rel=&quot;noreferrer&quot;&gt;another (related) PDF document&lt;/a&gt;, it states that the FFT depth must be large enough in order to distinguish between the FFT noise floor and the ADC noise. To my surprise, it also says that the FFT noise floor is&#xA;$$&#xA;10 \log_{10} \left( \frac{M}{2} \right)dB&#xA;$$&#xA;&lt;em&gt;below&lt;/em&gt; the theoretical signal-to-quantization-noise $SNR=6.02N+1.76dB$, which makes me wonder how $M$ can thus ever be &quot;too low&quot;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While playing with different ADC models, I have seen that the ENOB &lt;em&gt;does&lt;/em&gt; vary significantly when I set $M$ too low, so I am wondering if there is any guide on how to choose $M$ for a desired ADC bitwidth of $N$?&lt;/p&gt;&#xA;" OwnerUserId="3775" LastEditorUserId="90" LastEditDate="2013-02-14T14:23:58.763" LastActivityDate="2019-12-15T14:00:26.260" Title="How to choose FFT depth for ADC performance analysis (SINAD, ENOB)" Tags="|fft|noise|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7847" PostTypeId="2" ParentId="7811" CreationDate="2013-02-14T08:26:12.910" Score="6" Body="&lt;p&gt;As others have mentioned, performing a 2D FFT on the kernel will give you the frequency response of the filter. However, it's worth mentioning that 2D filters can be analyzed using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Z-transform&lt;/a&gt;, which may or may not provide deeper insight, depending on the filter (and what you want to know).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, given the kernel you specified, the corresponding &lt;a href=&quot;http://en.wikipedia.org/wiki/Difference_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;difference equation&lt;/a&gt; would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n_1,n_2) = x(n_1+1,n_2) + x(n_1,n_2 + 1) + x(n_1-1,n_2) + x(n_1,n_2-1) - 4x(n_1,n_2).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its Z-transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y(z_1,z_2) = z_1X(z_1,z_2) + z_2X(z_1,z_2) + z^{-1}_1X(z_1,z_2) + z_2^{-1}X(z_1,z_2) - 4X(z_1,z_2),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, after rearranging, yields the following &lt;a href=&quot;http://en.wikipedia.org/wiki/Transfer_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;transfer function&lt;/a&gt; for the filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z_1,z_2) = \frac{Y(z_1,z_2)}{X(z_1,z_2)} = z_1 + z_2 + z_1^{-1} + z_2^{-1} - 4.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine the magnitude response, just plug in a pair of &lt;a href=&quot;http://en.wikipedia.org/wiki/Complex_exponential&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex exponentials&lt;/a&gt; and simplify, as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{aligned} &#xA;H(e^{iw_1},e^{iw_2}) &amp;amp; = e^{iw_1} + e^{iw_2} + e^{-iw_1} + e^{-iw_2} - 4  \\ &#xA;                     &amp;amp; = (e^{iw_1} + e^{-iw_1}) + (e^{iw_2} + e^{-iw_2}) - 4 \\&#xA;                     &amp;amp; = 2\cos{w_1} + 2\cos{w_2} - 4 \\&#xA;|H(e^{iw_1},e^{iw_2})| &amp;amp; = 2\sqrt{ (\cos{w_1} + \cos{w_2} - 2)^2  } .&#xA;\end{aligned} &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluating the magnitude response at extreme frequencies will give you a sense of highpass vs. lowpass for the filter. For example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |H(e^{i0},e^{i0})| = 2\sqrt{(\cos{0} + \cos{0} - 2)^2} = 2\sqrt{(1+1-2)^2} = 0,$$&#xA;and&#xA;$$ |H(e^{i\pi},e^{i\pi})| = 2\sqrt{(\cos{\pi} + \cos{\pi} - 2)^2} = 2\sqrt{(-1-1-2)^2} = 8.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the transfer function can be evaluated directly to plot the magnitude response of the filter as well. Here's an example using &lt;a href=&quot;http://www.numpy.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;numpy&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab as py&#xA;from mpl_toolkits.mplot3d import axes3d&#xA;&#xA;def H(z1,z2):&#xA;    return z1 + z2 + 1./z1 + 1./z2 - 4.0&#xA;&#xA;n = 100&#xA;w1 = w2 = np.linspace(-np.pi,np.pi, n)    &#xA;mag = np.zeros((n,n))&#xA;&#xA;for i1 in xrange(0,n):&#xA;    for i2 in xrange(0,n):&#xA;        z1 = np.exp(1j*w1[i1])&#xA;        z2 = np.exp(1j*w2[i2])&#xA;        mag[i1,i2] = np.abs(H(z1,z2))&#xA;&#xA;fig = py.figure()&#xA;ax = fig.add_subplot(111, projection='3d')    &#xA;X, Y = np.meshgrid(w1,w2)&#xA;ax.plot_surface(X, Y, mag, cmap='bone', alpha=.5)&#xA;py.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/txukF.jpg&quot; alt=&quot;Filter magnitude response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that if you use the kernel 2D FFT technique, the resulting magnitudes won't necessarily be centered at zero like the above plot.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-02-14T08:26:12.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7848" PostTypeId="1" CreationDate="2013-02-14T10:05:36.500" Score="1" ViewCount="4655" Body="&lt;p&gt;I have a receiver which is left to open for sensing. I'm using the periodogram method for estimating the PSD. I need to calculate the SNR of the incoming for which I need to calculate the variance. Can anyone suggest me ways to calculate the variance from the PSD?&lt;/p&gt;&#xA;" OwnerUserId="3637" LastEditorUserId="1606" LastEditDate="2013-02-14T10:41:49.547" LastActivityDate="2013-02-14T17:52:34.407" Title="Variance calculation from PSD" Tags="|signal-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7849" PostTypeId="1" CreationDate="2013-02-14T10:36:30.953" Score="2" ViewCount="321" Body="&lt;p&gt;I know very basic image processing. Please suggest me how do I and where do I start learning Gabor Filters ?&lt;/p&gt;&#xA;" OwnerUserId="1289" LastActivityDate="2013-02-15T00:41:26.110" Title="How do I start studying Gabor Filters ?" Tags="|image-processing|filters|gabor|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7850" PostTypeId="1" AcceptedAnswerId="7851" CreationDate="2013-02-14T10:47:18.527" Score="0" ViewCount="1126" Body="&lt;p&gt;Tell me how do I find out gray level variance of the image? Is it any different from the normal variance of the image. &lt;/p&gt;&#xA;" OwnerUserId="1289" LastActivityDate="2013-02-14T15:15:27.207" Title="How do I find Gray Level Variance of the Image?" Tags="|image-processing|covariance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7851" PostTypeId="2" ParentId="7850" CreationDate="2013-02-14T15:15:27.207" Score="2" Body="&lt;p&gt;I would think that it is indeed the &quot;normal&quot; variance of the image.  You look at the distribution of the pixel values (i. e. gray levels), and compute its variance.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-02-14T15:15:27.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7853" PostTypeId="2" ParentId="7848" CreationDate="2013-02-14T17:52:34.407" Score="2" Body="&lt;p&gt;For a &lt;em&gt;wide-sense-stationary&lt;/em&gt; random process, all the random variables&#xA;comprising the process have the same mean $\mu$ and variance $\sigma^2$, and&#xA;the variance is the integral of the power spectral density $S(f)$ less the square&#xA;of the mean:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma^2 = \int_{-\infty}^{\infty} S(f)\,\,\mathrm df - \mu^2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, the mean is $0$ and $\sigma^2$ is just the integral of&#xA;$S(f)$, but when $\mu \neq 0$, then $S(f)$ includes&#xA;an impulse of $\mu^2\delta(f)$ at $f=0$ which contributes $\mu^2$ to&#xA;the integral, and this gets subtracted off by the $-\mu^2$ term in the&#xA;above formula. For discrete-time signals, the integrals should&#xA;be replaced by the appropriate sums.  But when there is a &#xA;(deterministic) signal component and a (random, zero-mean)&#xA;noise component, calculation of the signal-to-noise ratio SNR&#xA;(which has many definitions including one which says it is&#xA;the ratio of the signal energy to the noise variance times&#xA;the signal duration), requires separating out&#xA;the two numbers needed from knowledge of their sum (which is&#xA;what the periodogram will give you). This is a lot trickier&#xA;and the answer will typically depends on details of the signal that you&#xA;have not shared with us.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-02-14T17:52:34.407" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7854" PostTypeId="1" AcceptedAnswerId="8060" CreationDate="2013-02-14T21:01:08.027" Score="5" ViewCount="335" Body="&lt;p&gt;I have some digital recordings of some received over-the-air CW broadcasts of known plain-text (W1AW code practice) at known WPM code speeds, but in moderate to heavy RF noise and fading.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I describe a S/N ratio for the Morse Code in these recordings?  If so, how would I calculate this S/N ratio?  What bandwidths should I use for the signal and for the noise?  Should I use recordings with or without the radio receivers narrow-band CW filter enabled?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If possible, I would like to use these S/N numbers to try and plot the decoding error rates versus the S/N ratios for various &quot;demodulators&quot; (including both software decoders, as well as humans at different experience levels).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-03-01T18:09:51.470" Title="Received Morse Code signal-to-noise ratio?" Tags="|noise|signal-detection|measurement|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7855" PostTypeId="2" ParentId="7849" CreationDate="2013-02-15T00:41:26.110" Score="3" Body="&lt;p&gt;You know what I actually found really useful, Gabor's original paper, &quot;Theory of Communication&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://redwood.berkeley.edu/w/images/b/b6/Gabor.pdf&quot; rel=&quot;nofollow&quot;&gt;http://redwood.berkeley.edu/w/images/b/b6/Gabor.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of particular interest is how Gabor used banks of reeds, tuned to different frequencies, to visualise his filters. For me this led to a good conceptual understanding, especially of the uncertainty principle, before diving into the mathematics.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-02-15T00:41:26.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7856" PostTypeId="1" CreationDate="2013-02-15T01:15:30.993" Score="2" ViewCount="5144" Body="&lt;p&gt;I have an unorganized point cloud with a bunch of 3d points. I use a certain surface reconstruction method to obtain a triangle mesh of the underlying surface. The surface could be closed or not. Can somebody point me out to how I would go about estimating the volume enclosed by such a surface (if its closed). If its not closed, then what would a way to &quot;close&quot; it and get a volume? I would appreciate if somebody could even point out C++ libraries that would help me do this.&lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2013-05-18T14:18:23.797" Title="Calculating the volume of a triangular mesh?" Tags="|point-cloud|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7857" PostTypeId="1" CreationDate="2013-02-15T03:37:28.503" Score="13" ViewCount="6629" Body="&lt;p&gt;While working on &lt;a href=&quot;https://dsp.stackexchange.com/questions/7846/how-to-choose-fft-depth-for-adc-performance-analysis-sinad-enob&quot;&gt;this problem&lt;/a&gt;, I started to have doubts that my initial definition of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$SINAD = 10 \log_{10} \left( \frac{p_f} {\sum_i{(p_i)} - p_0 - p_f} \right)dB$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is correct. In this equation, $p_x$ is the power the FFT bin at frequency $x$, $p_f$ is the power of the frequency bin containing the signal frequency $f$ and $p_0$ is the DC component. The sum over $i$ accumulates all frequency components, before removing the DC component $p_0$ and the the signal frequency $p_f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, I am unsure about the $\sum_i(p_i)$ part, which I interpreted from the &lt;a href=&quot;http://en.wikipedia.org/wiki/SINAD&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia description&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The ratio of (a) the power of original modulating audio signal, i.e., from a modulated radio frequency carrier to (b) the residual audio power, i.e., noise-plus-distortion powers remaining after the original modulating audio signal is removed. With this definition, it is possible to have a SINAD level less than one.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Comparing with the equation, the &quot;original modulating audio signal&quot; is at frequency $f$, which is accounted for in the $p_f$ term from the FFT. The $p_0$ term I got from the following paper, which says to remove the DC component:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;a href=&quot;http://www.analog.com/static/imported-files/tutorials/MT-003.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Understand SINAD, ENOB, SNR, THD, THD + N, and SFDR&quot; document&lt;/a&gt;, it says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Signal-to-Noise-and Distortion (SINAD, or S/(N + D) is the ratio of the rms signal amplitude to the mean value of the root-sum-square (rss) of all other spectral components, including harmonics, but excluding dc&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Looking at these definitions, I can think of another possible definitions of SINAD, namely&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$SINAD = 10 \log_{10} \left( \frac{p_f} { \sqrt{ \sum_i{(p_i^2)} } - p_0 - p_f} \right)dB$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which uses the RSS (root-sum-square) of the noise and distortion bins of the FFT result. But then, what exactly is meant by &quot;mean value&quot; in that document?&lt;/p&gt;&#xA;" OwnerUserId="3775" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-09-21T19:06:09.663" Title="ADC performance simulation: How to calculate SINAD from FFT?" Tags="|fft|noise|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7859" PostTypeId="1" AcceptedAnswerId="7862" CreationDate="2013-02-15T10:48:21.483" Score="14" ViewCount="6048" Body="&lt;p&gt;I have a basic implementation knowledge of the 2D 8x8 DCT used in image &amp;amp; video compression. Whilst reading about Principle Component Analysis, I can see a lot of similarity, albeit PCA is clearly more generic. When I've read about DCT previously it was always presented in relation to DFT. So my question is how can the DCT be derived from a PCA perspective? (even a hand-wavey explanation is sufficient)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="300" LastActivityDate="2022-05-24T11:03:23.497" Title="Relationship between DCT and PCA" Tags="|image-processing|discrete-signals|dct|video-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7860" PostTypeId="1" AcceptedAnswerId="7920" CreationDate="2013-02-15T11:32:32.917" Score="1" ViewCount="3721" Body="&lt;p&gt;I can't understand how to use normalization technique for EEG. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is it used for results of FFT or for raw EEG signal? &lt;/li&gt;&#xA;&lt;li&gt;Are there different methods with common name &quot;$z$-transform&quot;? &lt;/li&gt;&#xA;&lt;li&gt;And what z-score used in &lt;a href=&quot;http://link.springer.com/article/10.1007/s10548-009-0127-0&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; article?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3502" LastEditorUserId="1629" LastEditDate="2016-06-05T12:10:37.040" LastActivityDate="2016-06-05T12:10:37.040" Title="What is the standard way to use z-score with EEG?" Tags="|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7861" PostTypeId="2" ParentId="1608" CreationDate="2013-02-15T12:28:56.157" Score="2" Body="&lt;p&gt;I think the answer vinay provides is correct although there are few more details that in my opinion provide a better answer to the fundamental question that Hossin is looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT size N=2048 sets the upper limit that can characterise all channel bandwidth from 1.4- 20 MHz (or 72-1200 occuppied subcarriers). Recall that resource blocks only have values on the occupied subcarriers and the rest are padded with zeros in order to fit the FFT size. So, for example, if you use 72 subcarriers (i.e 1.4 MHz CBW) and use an FFT size of 128 you will have to pad 56 subcarriers with zeros. The same can be said if you use an FFT size of 2048 where you will have to pad 1976 subcarriers. If you do it properly there should not be any difference in the spectrum between the two if you were to compute the FFT after you do the IFFT (both forms will show a total bandwidth of approx 1080 kHz = 15kHz*72).&lt;/p&gt;&#xA;" OwnerUserId="3796" LastActivityDate="2013-02-15T12:28:56.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7862" PostTypeId="2" ParentId="7859" CreationDate="2013-02-15T12:56:44.173" Score="21" Body="&lt;p&gt;The main difference between DCT and PCA (more precisely, representing a dataset in the basis formed by the eigenvectors of its correlation matrix - also known as the &lt;em&gt;Karhunen Loeve Transform&lt;/em&gt;) is that the PCA must be defined with respect to a given dataset (from which the correlation matrix is estimated), while the DCT is &quot;absolute&quot; and is only defined by the input size. This makes the PCA an &quot;adaptive&quot; transform, while the DCT is data-independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One might wonder why the PCA is not used more often in image or audio compression, because of its adaptivity. There are two reasons :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Imagine an encoder computing a PCA of a dataset and encoding the coefficients. To reconstruct the dataset, the decoder will need not only the coefficients themselves, but also the transform matrix (it depends on the data, which it does not have access to!). The DCT or any other data-independent transform might be less efficient in removing statistical dependencies in the input data, but the transform matrix is known in advance by both the coder and decoder without the need for transmitting it. A &quot;good enough&quot; transform which requires little side information is sometimes better than an optimal transform which requires an extra load of side information...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a large collection of $N$ 8x8 tiles extracted from photos. Form a $N \times 64$ matrix with the luminosity of these tiles. Compute a PCA on this data, and plot the principal components that will be estimated. This is a very enlightening experiment! There is a very good chance that most of the higher-ranked eigenvectors will actually look like the kind of modulated sine-wave patterns of the DCT basis. This means that for a sufficiently large and generic set of image tiles, the DCT is a very good approximation of the eigenbasis. The same thing has also been verified for audio, where the eigenbasis for log- signal energy in mel-spaced frequency bands, estimated on a large volume of audio recordings, is close to the DCT basis (hence the use of DCT as a decorrelation transform when computing MFCC).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-02-15T16:03:33.097" LastActivityDate="2013-02-15T16:03:33.097" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="7864" PostTypeId="1" AcceptedAnswerId="7892" CreationDate="2013-02-15T22:33:28.960" Score="3" ViewCount="753" Body="&lt;p&gt;I have tried to make this question as readable and consistent as possible. The short of it, is that I am trying to ascertain how one gets from the math equation shown, (which I understand), to the correct implementation. (Which I also understand). However, how/why one gets from one to the other seems unclear to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is my setup:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have an $M$ length 'original' signal $x[m]$: &lt;strong&gt;(Equation 1)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[m] , \space m = 0,1,..M-1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We wish to take a 'zoom-DFT' of it, where the DFT length will be, $N$, where $N &amp;gt; M$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We thus now have an $N$ length zero-padded new signal, lets call it $x_p[n]$, where: &lt;strong&gt;(Equation 2)&lt;/strong&gt;&#xA;$$&#xA;x_p[n], \space n = 0,1,...N-1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our discrete time variable is now $n = 0,1,...N-1$, and our discrete frequency variable is $k = 0,1,...N-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $N$-length DFT of a signal is defined as such: &lt;strong&gt;(Equation 3)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \sum_{n=0}^{N-1} x_p[n]\space e^{-j\frac{2\pi nk}{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the $nk$ in the DFT equation is written as $\frac{-(k-n)^2 + n^2 + k^2}{2}$, then the DFT can now be written as: &lt;strong&gt;(Equation 4)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = e^{-j\frac{\pi k^2}{N}} \space \sum_{n=0}^{N-1} x_p[n]\space e^{-j\frac{\pi n^2}{N}} \space e^{j\frac{\pi (k-n)^2}{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This expresses the full DFT, (i.e, the DFT from 0 to nyquist), as a convolution. To evaluate the 'Zoom-DFT', where we want to interrogate only frequencies between $f_1$ and $f_2$, and so the following minor modification is made: If we let $F_{\Delta} = \frac{(f_2 - f_1)}{f_s}$, and $F_1 = \frac{f_1}{f_s}$, then the zoom-DFT, $X_{z}[k]$ becomes: &lt;strong&gt;(Equation 5)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_z[k] = e^{-j\frac{\pi F_{\Delta} k^2}{N}} \space \sum_{n=0}^{N-1} x_p[n]\space e^{-j\frac{\pi n^2}{N}} \space e^{-j 2\pi \space F_1 n}\space e^{j\frac{\pi F_{\Delta} (k-n)^2}{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can then simplify, if we let: &lt;strong&gt;(Equation 6)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a[u] = x_p[u]\space e^{-j\frac{\pi u^2}{N}} \space e^{-j 2\pi \space F_1 u} \\&#xA;b[u] = e^{j\frac{\pi F_{\Delta} u^2}{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;, where $u$ is just some general dummy variable, (you will see why I picked it later). Anyway, now finally, we simply have: &lt;strong&gt;(Equation 7)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_z[k] = b^*[k] \space \sum_{n=0}^{N-1} a[n] \space b[k-n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This, as we are told &lt;a href=&quot;http://en.wikipedia.org/wiki/Bluestein%27s_FFT_algorithm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, and &lt;a href=&quot;http://www.freeinfosociety.com/media/pdf/2819.pdf&quot; rel=&quot;nofollow&quot;&gt;here, page 183&lt;/a&gt;, is how the DFT can be re-written as a convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great! So far so good. The problem comes in interpretation vs implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;em&gt;interpretation&lt;/em&gt; of &lt;strong&gt;(Equation 7)&lt;/strong&gt;, is that $a[u]$ is of length $N$, and $b[u]$ is also of length $N$, where we evaluate then for $u = 0,1,...N-1$. Then, we do a &lt;em&gt;circular&lt;/em&gt; convolution of the series $a[u]$ and $b[u]$, to attain a series also of length $N$, (which is our desired DFT length), before we finally perform an element-by-element post-multiply with another series, also of length $N$. I dont so much care about post-multiply, that is not the point of this question. The point here is that $a[u]$ is length $N$, $b[u]$ is also length $N$, and $u$ for both of them is evaluated for $0 \leq u \leq N-1$, and then we do a circular convolution, modulo-$N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you however now take this interpretation and implement it, you will not get the right answer. In fact, you will only ever get the right answer, if the $u$ variable for evaluation of $a[u]$ is taken from $u = 0,1,...N-1$, (same as above), &lt;strong&gt;BUT&lt;/strong&gt;, the $u$ variable for evaluation of $b[u]$ is taken from $-(M-1) \leq u \leq N-1$. So now the series $b[u]$ is not length $N$ anymore, it is of length $N+M-1$. Then, if we do a modulo-($N+M-1$) circular convolution, and extract the indicies from $M$ to $M+N-1$, we will get the right answer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;...How, from equation-1, does one possibly get this 'correct' interpretation though? This, I cannot seem to explain, however I understand everything else. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, I have sat down and done the computation 'by hand', so I can 'see' why $b[u]$ MUST be taken from $-(M-1) \leq u \leq N-1$. (It would otherwise be impossible to compute the DFT for $k = 0,1,...N-1$). However I do not understand how one goes from &lt;strong&gt;(Equation 7)&lt;/strong&gt;, to this conclusion. Right now, to me, EQ-1 just looks like a garden variety circular convolution, with no hints as to the details for now $a[u]$ and $b[u]$ must be exactly evaluated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put another way - AFAIK, when we see equation-1, we simply assume that $a[u]$ and $b[u]$ are evaluated from $0 \leq u \leq N-1$, and then we do a circular convolution, modulo-$N$ - how/why then do we derive the proper evaluations for $a$ and $b$ from this equation??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2013-02-19T15:24:32.370" LastActivityDate="2013-02-19T16:58:34.003" Title="DFT as convolution question" Tags="|fft|fourier-transform|frequency-spectrum|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7865" PostTypeId="2" ParentId="7856" CreationDate="2013-02-16T03:30:17.907" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://www.geometrictools.com/Documentation/Documentation.html&quot; rel=&quot;nofollow&quot;&gt;This site&lt;/a&gt; has both code and theoretical descriptions. Look for items that mention &quot;polyhedral mass properties&quot;. They typically live in the &quot;physics&quot; sections of the site.&lt;/p&gt;&#xA;" OwnerUserId="3684" LastActivityDate="2013-02-16T03:30:17.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7866" PostTypeId="1" AcceptedAnswerId="7949" CreationDate="2013-02-16T08:43:46.630" Score="2" ViewCount="17474" Body="&lt;p&gt;I cannot understand some part of the period signal's Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;Here this my note's methods,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For periodic signal with period &lt;span class=&quot;math-container&quot;&gt;$T_0$&lt;/span&gt;, define as &lt;span class=&quot;math-container&quot;&gt;$s_{T_0}(t)$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ s_{T_0} (t) = &#xA;\begin{cases}&#xA;s(t) for -T_0/2 &amp;lt;t&amp;lt;T_0/2\\&#xA;0 &amp;amp; \text{otherwise.}&#xA;\end{cases}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$s(t)=\sum_{n=-\infty}^{\infty}s_{T_0}(t-n T_0) = s_{T_0}(t) * \sum_{n=-\infty}^{\infty} \delta (t-n T_0)$$&lt;/span&gt;&#xA;So the Fourier transform will be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S(f)=S_{T_0}(f) \cdot f_0 \sum_{n=-\infty}^{\infty}\delta(f-n f_0) = f_0 \sum_{n=-\infty}^{\infty}S_{T_0}(n f_0) \delta(f-n f_0)$$&lt;/span&gt;&#xA;and the other methods is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x(t)= s(t) \cdot \sum_{n=-\infty}^{\infty} \delta (t-n T_0)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X(f)=S(f) * f_0 \sum_{n=-\infty}^{\infty}\delta(f- n f_0) = f_0 \sum_{n=-\infty}^{\infty}S(f-n f_0)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I cannot understand why I have &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\cdot f_0$&lt;/span&gt;&amp;quot; after Fourier Transform and why &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\delta(f-n f_0)$&lt;/span&gt;&amp;quot; can transform to &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\delta(t-nT_0)$&lt;/span&gt;&amp;quot;? And the last questions is, for the periods signal, why the note can use Fourier transform directly with out considering the Fourier serials?&lt;/p&gt;&#xA;" OwnerUserId="3420" LastEditorUserId="7092" LastEditDate="2023-07-03T01:38:18.937" LastActivityDate="2023-07-03T01:38:18.937" Title="About the Fourier transform of periodic signal" Tags="|fourier-transform|continuous-signals|periodic|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="7868" PostTypeId="1" AcceptedAnswerId="7871" CreationDate="2013-02-16T10:20:48.707" Score="2" ViewCount="1111" Body="&lt;p&gt;I've developed a large test-system which can use every interest-point-detector and -descriptor. I use it for evaluation of the given algorithms with the &lt;a href=&quot;http://mars01.stanford.edu/mvs/&quot; rel=&quot;nofollow noreferrer&quot;&gt;standford-image-collection of cd-covers&lt;/a&gt;. This post will not go any deeper with any source-code. I only found out that switching to images (no referred as firstImg and secondImg) will create to different results. The Ransac-Threshold is used to compute the homography and epsilon is the reprojection-error. For this example I use the &lt;a href=&quot;http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scale-Invariant-Feature-Transform by David Lowe&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First test with the secondImg as the queue-image creates the following results I've written down:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Inliner: &quot;1672&quot;  &lt;/li&gt;&#xA;&lt;li&gt;Number_of_Keypoints_FST: &quot;368&quot;&lt;/li&gt;&#xA;&lt;li&gt;Number_of_Keypoints_SND: &quot;1749&quot;&lt;/li&gt;&#xA;&lt;li&gt;Outlier: &quot;77&quot;&lt;/li&gt;&#xA;&lt;li&gt;Ransac: &quot;65&quot;&lt;/li&gt;&#xA;&lt;li&gt;Epsilon: &quot;10&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P9bEs.jpg&quot; alt=&quot;Here is the saved image.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm switching the order. The firstImg is the queue.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Inliner: &quot;310&quot;  &lt;/li&gt;&#xA;&lt;li&gt;Number_of_Keypoints_FST: &quot;1749&quot;&lt;/li&gt;&#xA;&lt;li&gt;Number_of_Keypoints_SND: &quot;368&quot;&lt;/li&gt;&#xA;&lt;li&gt;Outlier: &quot;58&quot;&lt;/li&gt;&#xA;&lt;li&gt;Ransac: &quot;65&quot;&lt;/li&gt;&#xA;&lt;li&gt;Epsilon: &quot;10&quot;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jih5D.jpg&quot; alt=&quot;Here is the second result.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt; I'm confused that switching the order of the images affects the results. Should the matched keypoints be identical for the matched ones when switching the order of the images? Should the inliner be identical?&lt;/p&gt;&#xA;" OwnerUserId="3293" LastEditorUserId="3293" LastEditDate="2013-02-16T12:30:57.547" LastActivityDate="2014-02-16T08:37:59.410" Title="Object-Recognition using SIFT: Switching the order of images creates two different results" Tags="|opencv|image-processing|sift|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7869" PostTypeId="1" CreationDate="2013-02-16T13:49:05.637" Score="2" ViewCount="2316" Body="&lt;p&gt;I have 3D points (xyz) of a face image and I have 2D face image of the same person.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3D points of the face are such that If I project the points to 2D plane, it matches with the 2D face image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to map the color information on to the 3D image.&#xA;So after mapping I will have the texture of each point.&#xA;I want to do it using Matlab/OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest any algorithm or refer some source for me to start.&lt;/p&gt;&#xA;" OwnerUserId="3743" LastActivityDate="2013-03-19T15:45:40.933" Title="Texture mapping on a 3D face from 2D face image" Tags="|image-processing|algorithms|opencv|3d|reconstruction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7870" PostTypeId="2" ParentId="7766" CreationDate="2013-02-16T15:19:35.737" Score="0" Body="&lt;p&gt;I managed to find a solution that is working quite well. Im not fully optimized yet but I think its just tweaking filters, as ill explain later on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially I tried to set up opencv but it was very time consuming and a steep learning curve but it did give me an idea. The key to my problem is really detecting the characters within the image and ignoring the background, which was basically just noise. OCR was designed exactly for this purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the free library tesseract (&lt;a href=&quot;https://github.com/ldiqual/tesseract-ios-lib&quot; rel=&quot;nofollow&quot;&gt;https://github.com/ldiqual/tesseract-ios-lib&lt;/a&gt;) easy to use and with plenty of customizability. At first the results were very random but applying sharpening and monochromatic filter and a color invert worked well to clean up the text. Next a marked out a target area on the ui and used that to cut out the rectangle of image to process. The speed of processing is slow on large images and this cut it dramatically. The OCR filter allowed me to restrict allowable characters and as the plaques follow a standard configuration this narrowed down the accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far its been successful with the grey background plaques but I havent found the correct filter for the red and white editions. My goal will be to add color detection and remove the need to feed in the data type.&lt;/p&gt;&#xA;" OwnerUserId="3746" LastActivityDate="2013-02-16T15:19:35.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7871" PostTypeId="2" ParentId="7868" CreationDate="2013-02-16T15:35:12.540" Score="0" Body="&lt;p&gt;ARGH. I feel ashamed. How about a cross validation? That's the solution. Now there are almost exact matches ... almost. =) Thank you, Libor. The second comment gave me a hint. =)&lt;/p&gt;&#xA;" OwnerUserId="3293" LastEditorUserId="3293" LastEditDate="2013-02-17T12:43:23.747" LastActivityDate="2013-02-17T12:43:23.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7872" PostTypeId="1" AcceptedAnswerId="7874" CreationDate="2013-02-16T16:47:40.693" Score="3" ViewCount="4114" Body="&lt;p&gt;With the desired magnitude of a transfer function in the frequency domain in C++ as described below what is the correct corresponding minimum phase?  In general how does one derive the correct minimum phase in the frequency domain if the desired magnitude is known, specifically such that the a complex IFFT of it would return an entirely real part.&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-cpp prettyprint-override&quot;&gt;&lt;code&gt;// PnCutoff.cpp : Pink noise above a cutoff.&#xA;#include &amp;lt;tchar.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;#include &amp;lt;conio.h&amp;gt;&#xA;&#xA;class PnAtFilter&#xA;{&#xA;    double _fcHz;&#xA;    public:&#xA;    PnAtFilter(double fcHz) { _fcHz = fcHz; }&#xA;    double Mag(double fHz)&#xA;    {&#xA;        if(fHz &amp;lt; _fcHz) return 1.0;&#xA;        else return  1.0 / sqrt(fHz/_fcHz);&#xA;    }&#xA;    double Phase(double fHz)&#xA;    {&#xA;        return 0.0; // what is the the correct minimum phase in r?&#xA;    }&#xA;};&#xA;&#xA;int _tmain(int argc, _TCHAR* argv[])&#xA;{&#xA;    PnAtFilter* pnf = new PnAtFilter(1000);&#xA;    for(int fHz = 10; fHz &amp;lt;= 100000; fHz *= 10)&#xA;    {&#xA;        double mag = pnf-&amp;gt;Mag(fHz); &#xA;        double phase = pnf-&amp;gt;Phase(fHz);&#xA;        _cprintf_s(&amp;quot;%d Mag=%f, Phase=%f\r\n&amp;quot;, fHz, mag, phase);&#xA;    }&#xA;    _getch();&#xA;    return 0;&#xA;}&#xA;&#xA;/* output:&#xA;10 Mag=1.000000, Phase=0.000000&#xA;100 Mag=1.000000, Phase=0.000000&#xA;1000 Mag=1.000000, Phase=0.000000&#xA;10000 Mag=0.316228, Phase=0.000000&#xA;100000 Mag=0.100000, Phase=0.000000&#xA;*/&#xA;&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3602" LastEditorUserId="7092" LastEditDate="2023-11-22T20:43:51.287" LastActivityDate="2023-11-22T20:43:51.287" Title="Derive minimum phase from magnitude" Tags="|transfer-function|hilbert-transform|minimum-phase|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7873" PostTypeId="2" ParentId="7872" CreationDate="2013-02-16T17:10:15.060" Score="9" Body="&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Minimum_Phase_Filter_Design.html&quot;&gt;Check out Julius O. Smith III's write up&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a Hilbert transform relationship between the magnitude response, $G(\omega)$, and the phase response, $\theta(\omega),$ of the associated minimum phase filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(\omega) = G(\omega) \exp(\jmath \theta(\omega))&#xA;$$&#xA;then&#xA;$$&#xA;\ln( H(\omega) ) = \ln(G(\omega)) + j\theta(\omega)&#xA;$$ &#xA;and&#xA;$$&#xA;\theta(\omega) = - {\cal H}\left[ \ln(G(\omega)) \right]&#xA;$$&#xA;where ${\cal H}$ is the Hilbert transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Minimum_phase#Relationship_of_magnitude_response_to_phase_response&quot;&gt;Also check out Wikipedia's write up.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-02-16T17:10:15.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7874" PostTypeId="2" ParentId="7872" CreationDate="2013-02-16T18:29:28.297" Score="2" Body="&lt;p&gt;One method to approximate a minimum phase transfer function from a magnitude-only frequency response is to first find an suitable approximation to the transfer function in the pole-zero Z-plane domain.  Then reflect all the zeros to inside the unit circle to get a minimum phase response.  The first part of this is sometimes called a &quot;system identification problem&quot; and usually has no closed form solution.  Differential evolution algorithms might be useful is finding a &quot;close enough&quot; pole-zero approximation (There appear to be IEEE papers on this method.  See the 2005-Jan issue of IEEE Signal Processing Magazine).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course if you can do an exact factorization of your frequency response, then the solution is straight forward. (reflect zeros, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &quot;smooth magnitude responses&quot; another approximation is to use a property of the complex cepstrum as described &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Creating_Minimum_Phase_Filters.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; by J.O.S. at CCRMA.  The following script for converting an arbitrary FIR filter into a minimum phase approximation requires the frequency response not to have any zeros in order to allow approximate inversion of the real part of the cepstrum of the given magnitude response.  Use of FFTs much much longer than your given magnitude response or initial FIR filter approximation may be required to get useful results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wn = [ones(1,m); 2*ones((n+odd)/2-1,m) ; ones(1-rem(n,2),m); zeros((n+od d)/2-1,m)];&#xA;y = real(ifft(exp(fft(wn .*  real(ifft(log(abs(fft(x)))))  ))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-02-16T19:06:37.423" LastActivityDate="2013-02-16T19:06:37.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7875" PostTypeId="1" AcceptedAnswerId="7878" CreationDate="2013-01-31T07:57:00.340" Score="8" ViewCount="2796" Body="&lt;p&gt;Operate on an image by performing Median Filtering in a 3x3 window.&#xA;Operate on the resulting image by performing, again, Median Filtering in a 3x3 window.&#xA;Can the resulting image be obtained from a single Median filtering?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my initial thought is that it can be done with the right mask. maybe a median next to a median. but i'm not sure.&lt;/p&gt;&#xA;" OwnerUserId="1831" OwnerDisplayName="Androidy" LastActivityDate="2013-02-16T20:36:22.600" Title="Median Filter one after another" Tags="|image-processing|theory|" AnswerCount="3" CommentCount="21" ContentLicense="CC BY-SA 3.0" />
  <row Id="7876" PostTypeId="2" ParentId="7875" CreationDate="2013-02-02T15:30:22.207" Score="2" Body="&lt;p&gt;The answer is no:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the following rearrangements of numbers from 1 to 81. &#xA;In the left  case the 3x3 median of 3x3 medians will be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;median([77, 72, 67, 62, 57, 52, 47, 37]) = 57, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in right case &#xA;median&lt;/p&gt;&#xA;&#xA;&lt;p&gt;([5, 15, 23, 32, 41, 50, 59, 68, 77]) = 41&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the median of the whole 9x9 block is 41 for both cases.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uOQxu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="sega_sai" LastActivityDate="2013-02-02T15:52:34.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7877" PostTypeId="2" ParentId="7875" CreationDate="2013-02-02T15:45:58.187" Score="1" Body="&lt;p&gt;Yes, sorry I was wrong talking about averaging instead of median.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets see what happens in median filtering.&#xA;Suppose that your filtering routine goes on image from TOP lines down, line after line.&#xA;Suppose also that it goes in every line from left to the right.&#xA;You can define it to go in any order, it will not change that point that I try to explain here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In such walk it creates new picture, pixel by pixel that come from median 3 on 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) When we do first median filtering, pixel that is located in first line from above, can travel to second line (in resulting image) and not to third (since meadian 3 on 3 can only &quot;push&quot; pixes for distance of one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) When we do second median filtering, this pixel can travel one more step down - to third line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what with travel distance for pixel that will want to move UP in lines?&#xA;For example at the beginig this pixel is in fifth line.&#xA;This distance for this pixel is only 1 and not more, since out routine goes from top to bottom in lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is just property of algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you will want to use bigger median mask. Such mask will give you longer bottom to top traveling distance from bottom up, not 1! &#xA;This will bring pixels to places, where they can not to be moved using 3 on 3 medians, as we did in first case! And this means that does not matter what size of median you take, such problem will present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can define any order of work for your median routine, problem will present but with different directions (up-down-left-right).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MAIN LINE: Its impossible to do same work with larger median mask, since it will give to pixels more fredom to move, then they have when two subsequent median filters of 3 on 3 are applied.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, I hope I was clear enough. Just a direction to think about it.&#xA;Problem can be that my solution is not really connected to image processind and more to some procedural features of algorithm.&lt;/p&gt;&#xA;" OwnerDisplayName="sapwood" LastActivityDate="2013-02-02T15:45:58.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7878" PostTypeId="2" ParentId="7875" CreationDate="2013-02-02T22:34:05.357" Score="2" Body="&lt;p&gt;ok so here is the answer of my Prof. Hagit Hal-or:&lt;BR&gt;&lt;br&gt;&#xA;if there is such a mask then it must be 5x5.&lt;BR&gt;&#xA;A counter example shows that this can not be.&lt;br&gt;&#xA;consider the 5x5 region of an image: we fill it with values 0...0,1,2...2  (12 0's and 12 2's)&lt;br&gt;&#xA;the 5x5 median on this region gives 1, regardless where you place the numbers.&lt;br&gt;&#xA;Now we build the 5x5 region so that if we apply the median on the median we do NOT get 1.&lt;br&gt;&#xA;Set the following:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 0 0 x x&#xA;0 0 0 x x&#xA;0 0 0 x x&#xA;x x x x x&#xA;x x x x x &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where x are the rest of the numbers.&lt;br&gt;&#xA;The first pass with median will set the top left 3x3 to 0 and so the 1 is &quot;lost&quot; and any order&lt;br&gt;&#xA;of placing the rest of the numbers will not bring the 1 back. So median on all other &lt;br&gt;regions will result in 0 or 2. So that the second pass of the median will look at numbers that are 0 and 2 only and so will NOT result in 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks all for helping&lt;/p&gt;&#xA;" OwnerUserId="1831" OwnerDisplayName="Androidy" LastActivityDate="2013-02-02T22:34:05.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7879" PostTypeId="1" AcceptedAnswerId="7886" CreationDate="2013-02-17T03:34:41.847" Score="13" ViewCount="4869" Body="&lt;p&gt;I am trying to assess the quality of several image interpolation methods for an application that involves generating subpixel-shifted images. I thought I could compare the results of a subpixel shift using all these interpolation variants with some perfectly shifted image, but it's probably not possible to obtain it (what would be the need for interpolation then?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking about using DFT + shifting in the frequency domain, and I am unsure as to how it actually works in comparison to explicitly interpolating the image (using bilinear, bicubic, etc...). I'm sure it can't possibly generate a &lt;em&gt;perfectly shifted image&lt;/em&gt;, but I can't put my finger on it. Is subpixel shifting with DFT equivalent to applying interpolation and if so, which one? What is the bias of the pixel values in images obtained using this method? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;EDIT:&lt;/b&gt;&#xA;After thinking the matter over, I figured since the FFT is an approximation (even more so the DFT) of the original function in terms of harmonics (sine functions), that it would amount to some sort of trigonometric interpolation. I recall a &quot;Fourier series interpolation&quot; formula for discrete data which was a trigonometric interpolation, but not sure if it's connected.&lt;/p&gt;&#xA;" OwnerUserId="3800" LastEditorUserId="3800" LastEditDate="2013-02-18T09:40:50.187" LastActivityDate="2016-01-24T19:50:11.030" Title="How does subpixel image shifting using DFT really work?" Tags="|image-processing|dft|interpolation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7880" PostTypeId="1" AcceptedAnswerId="7881" CreationDate="2013-02-17T07:17:26.367" Score="3" ViewCount="612" Body="&lt;p&gt;I'm implementing affine transformations on images. Currently I'm doing rotation, but general transformation will be added later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically each pixel is mapped by the rotation matrix R:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{bmatrix} cos(a) &amp;amp; -sin(a) \\ sin(a)  &amp;amp; cos(a) \end{bmatrix} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that mapping back does not always come back to a grid point, so I basically rounding it using a brute force approach. What is a better approach (similarly to Bresenham's line drawing algorithm)?&lt;/p&gt;&#xA;" OwnerUserId="3802" LastEditorUserId="76" LastEditDate="2013-02-18T03:14:21.870" LastActivityDate="2013-02-18T03:14:21.870" Title="Affine transformation on a pixel grid" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7881" PostTypeId="2" ParentId="7880" CreationDate="2013-02-17T09:41:27.443" Score="4" Body="&lt;p&gt;What you need is an &lt;em&gt;interpolation method&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method you described is called nearest-neighbor, because you pick the pixel that is nearest to the place you actually wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other methods include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;bi-linear interpolation (Select 4 nearest points, interpolate by &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; according to distance) (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_interpolation&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;barycentric interpolation (Select 3 nearest points, interpolate in the system of coordinates of the triangle)&lt;/li&gt;&#xA;&lt;li&gt;bi-cubic interpolation (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Bicubic_interpolation&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2013-02-17T11:11:28.700" LastActivityDate="2013-02-17T11:11:28.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7882" PostTypeId="2" ParentId="7869" CreationDate="2013-02-17T15:28:03.177" Score="1" Body="&lt;p&gt;What you're trying to do is more in the image synthesis / computer graphics domain (technically, it's &quot;texture mapping&quot;) than it is in the image-processing domain, so it's not obvious that Matlab/OpenCV are going to have any relevant supporting functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I had the same problem in my (preferred) Python/SciPy/Matplotlib world, I'd probably see if &lt;a href=&quot;http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#surface-plots&quot; rel=&quot;nofollow&quot;&gt;mplot3d's surface plotting&lt;/a&gt; was up to the job (passing the 2D image as the &lt;code&gt;facecolors&lt;/code&gt; parameter).  However general experience is that it doesn't deal well with 100s x 100s size grids, only a few 10s x 10s.  Sorry, I don't know what Matlab's equivalent is.  (And if mplot3d wasn't up to the job I'd be looking at the mlab VTK wrapping's &lt;a href=&quot;http://enthought-dev.117412.n3.nabble.com/MayaVI-Texture-Map-td4026003.html&quot; rel=&quot;nofollow&quot;&gt;texture mapping&lt;/a&gt; support).&lt;/p&gt;&#xA;" OwnerUserId="1828" LastActivityDate="2013-02-17T15:28:03.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7883" PostTypeId="2" ParentId="7857" CreationDate="2013-02-17T18:38:52.490" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;what exactly is meant by &quot;mean value&quot; in that document?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the time domain, SINAD is calculated as a ratio of the RMS value of the signal to the RMS value of the noise + distortion, so I believe the mean value in the context of the AD document refers to the mean in the RMS measurement.  Doing the calculation in the frequency domain conceals the mean operation because the magnitude of the DFT coefficients are already conditioned to be proportional to the time domain RMS value.  RMS values are summed as squares and then the square root is taken of the result to obtain a composite RMS value.  The RSS achieves the necessary arithmetic operation.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="29" LastEditDate="2013-04-03T13:58:22.353" LastActivityDate="2013-04-03T13:58:22.353" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7884" PostTypeId="1" AcceptedAnswerId="7957" CreationDate="2013-02-17T18:39:08.513" Score="0" ViewCount="64" Body="&lt;p&gt;I have a counter in my embedded system with &lt;code&gt;f = 64 Mhz&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let's say its read value is $cnt_i$&#xA;where $i$ is the index of the time I sampled it.&#xA;$$\Delta = cnt_{i+1} -cnt_i$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let's say I take $\Delta^{'} = \Delta/64 = \Delta &amp;gt;&amp;gt;6$ where $&amp;gt;&amp;gt;$ is shift right operator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that the value of the actual counter now is equivalent to &lt;code&gt;1 Mhz&lt;/code&gt; but How can I show that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Delta^{'} = \Delta/64 $ $[\Delta^{'}]_{sec} = \frac{\Delta}{64Mhz}*\frac{1}{64}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it is exactly the opposite, what do I miss?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2013-02-22T21:24:23.900" LastActivityDate="2013-02-23T16:57:41.263" Title="How to calculate the quantum of the difference between two value of clock counter where the values are divided by 64?" Tags="|frequency|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7885" PostTypeId="2" ParentId="6398" CreationDate="2013-02-17T21:08:39.810" Score="5" Body="&lt;p&gt;After wasting forever on this problem, I found that it was just a question of window function. Doh!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Window functions that are not zero-ended produce these vertical lines. For example, Rectangular Window, Hamming Window, Gaussian Window (with low sigma) produce these lines, and Barlett Window, Hanning Window, Blackmann Window, Welch Window, don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had tried other window functions but maybe during my tests, I made a coding mistake so I didn't find the fix. Moral of the story : do tests carefully!&lt;/p&gt;&#xA;" OwnerUserId="3534" LastActivityDate="2013-02-17T21:08:39.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7886" PostTypeId="2" ParentId="7879" CreationDate="2013-02-18T07:43:29.097" Score="5" Body="&lt;p&gt;A DFT/FFT, plus added zero-padding in the frequency domain, then a longer IDFT/IFFT, returns interpolated points.  These points will be interpolated using a periodic Sinc kernel, which is a perfect interpolation for original data that is strictly band-limited to below half the original sample rate.  However, the data will be acted on as if it were circularly wrapped, which may produce odd results at the edges of some images.  So you may want to pad the edges of the original source with a nice filler or framing color before interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you upsample by 2X (zero-pad the FFT to double the length before the IFFT), then you can do a half-pixel shift using the interpolated points.  3X for a third pixel shift, etc.  For shifting, you can throw away the original points plus any excess interpolated points to get the size desired.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-24T19:50:11.030" LastActivityDate="2016-01-24T19:50:11.030" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7887" PostTypeId="1" CreationDate="2013-02-18T09:36:15.720" Score="2" ViewCount="10266" Body="&lt;p&gt;I am writing a script to frequency modulate the stereo audio signal, and later calculating the modulation index wrt time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we have to modulate the stereo audio signal, I have to first synthesize the composite signal of bandwidth 96KHz and modulate it with carrier frequency of 1MHz(assume here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We define FM signal as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = A * sin \big(2\pi*\int_{-\infty}^t(f_o + k*m(\tau))  d\tau\big)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per FCC rule, maximum frequency deviation should be 75KHz, here I have to keep k = 75000 and m(t) between -1 to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a very big audio file, my script should fetch some samples from the file and modulate it, and repeat the above steps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I am confused about the integration limits. Do I need to take integration from very start for each upcoming sample? If I see the hardware implementation for FM generation, VCO should have some sensitivity. What I understand it, as VCO output cant change abruptly, it will change the frequency as per the cumulative effect of its present and previous inputs of some input voltages. Therefore, In hardware any upcoming sample frequency will depends only on some past message signal samples. Am I right here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we see the instantaneous frequency of FM signal, from the above formula, it should be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;f_i = f_o + k*m(t)&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It means that maximum frequency which could change is $k*max(|m(t)|)$, equal to 75KHz, but when we do frequency transform of FM signals, there are many sidelobs which is beyond 75Khz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not able to think where my concepts are going wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1281" LastEditorUserId="1281" LastEditDate="2013-02-18T10:30:10.200" LastActivityDate="2013-02-18T10:30:10.200" Title="Maximum Frequency deviation in Frequency Modulation" Tags="|frequency|modulation|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7888" PostTypeId="1" CreationDate="2013-02-14T21:40:37.263" Score="4" ViewCount="81" Body="&lt;p&gt;I am working on a scientific application where I would like to evaluate luminance in an image, however I am unsure if what I receive from my setup is &lt;a href=&quot;http://en.wikipedia.org/wiki/Luminance&quot; rel=&quot;nofollow&quot;&gt;luminance (Y)&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Luma_%28video%29&quot; rel=&quot;nofollow&quot;&gt;luma (Y')&lt;/a&gt;. I use a camera with a &lt;a href=&quot;http://www.toshiba.ch/ics/media/pdfs/Brochures/Micro_Camera_1CCD/IK-CU51-Brochure.pdf&quot; rel=&quot;nofollow&quot;&gt;TOSH IK CU51 (PAL)&lt;/a&gt; control unit which is connected via S-Video to a &lt;a href=&quot;http://www.lib.neu.edu/dmdsiguide/Resources/Manuals/CANOPUSADVC300.pdf&quot; rel=&quot;nofollow&quot;&gt;Canopus ADVC-300&lt;/a&gt; analog to digital converter. The digitized data are streamed to a computer and presented in YUV2 format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the problem: I read into luminance and luma and realized that I do not know if gamma compression is applied somewhere on the way between the camera and the computer, so that really I am getting Y'UV2 instead of YUV2, is there e.g. a definition for a PAL signal to be gamma compressed and for an S-Video signal not to be corrected? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: As there are no answers yet, I think I should be more specific: Is there any flexibility in the PAL or S-Video standard or in how a device is generally expected to work where I would have to take gamma correction into account? &#xA;A little more background: luminance is proportional to energy per spatial area. If gamma correction were applied then I'd get a somewhat distorted value. If I knew gamma, I could adjust for this.&lt;/p&gt;&#xA;" OwnerUserId="3810" OwnerDisplayName="Sebastian" LastActivityDate="2013-02-18T17:38:54.627" Title="Is gamma correction applied in my setup" Tags="|conversion|camera|analog|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7889" PostTypeId="2" ParentId="7888" CreationDate="2013-02-18T17:38:54.627" Score="2" Body="&lt;p&gt;You should photograph a known calibration target with your system, (like &lt;a href=&quot;http://www.image-engineering.de/images/downloads/manuals/testcharts/BBC64%20A%20datasheet.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; one or the one that I put in the thumbnail). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/993xV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will allow you discovering the &lt;a href=&quot;http://www.imatest.com/guides/modules/stepchart/&quot; rel=&quot;nofollow noreferrer&quot;&gt;OECF&lt;/a&gt; of your system. You can either calculate it by yourself, given the technical data sheet or use third-party software like &lt;a href=&quot;http://www.imatest.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imatest&lt;/a&gt;, ImageAnalyzer or others.&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2013-02-18T17:38:54.627" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7890" PostTypeId="1" AcceptedAnswerId="7891" CreationDate="2013-02-18T18:43:50.680" Score="2" ViewCount="219" Body="&lt;p&gt;I'm doing image analysis, and I want to classify smooth objects (has smooth boundaries) from non-smooth objects (has zigzag-like boundaries). Which feature should be fed into ML framework? What are some popular techniques for feature extraction of shapes?&lt;/p&gt;&#xA;" OwnerUserId="3802" LastEditorUserId="1059" LastEditDate="2013-02-18T20:57:56.843" LastActivityDate="2013-02-18T20:57:56.843" Title="Classifying 2D shapes by the smoothness of their boundaries" Tags="|classification|shape-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7891" PostTypeId="2" ParentId="7890" CreationDate="2013-02-18T19:03:12.017" Score="2" Body="&lt;p&gt;Fourier shape descriptors are quite easy to use and can do well to differentiate smooth objects from jagged ones. Imagine a polar coordinate system with the origin at the centroid of the 2D object. Store a vector of $r$ values as $\theta$ varies in $[0, 2\pi)$ where $r$ is the distance of the boundary from the centroid at each fixed angle $\theta$. Next, take the Fourier transform (FT) of this vector of $r$ values. If the boundary of the 2D object is jagged, the FT will have lot of non-zeros even at high frequencies. On the other hand, imagine doing this with a perfectly smooth circular object---you will end up with a vector of constant $r$ values whose FT is simply a non-zero DC term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT vector can be used as a feature vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See slides 16-20 in this pdf:&#xA;&lt;a href=&quot;http://homepages.cae.wisc.edu/~ece533/project/f06/karrels_ppt.pdf&quot; rel=&quot;nofollow&quot;&gt;http://homepages.cae.wisc.edu/~ece533/project/f06/karrels_ppt.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1825" LastActivityDate="2013-02-18T19:03:12.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7892" PostTypeId="2" ParentId="7864" CreationDate="2013-02-18T21:43:53.927" Score="1" Body="&lt;p&gt;You're interpretation that a[u] and b[u] are both N length sequences is incorrect.  a[u]  is of length N because it is effectively truncated by the length of your input sequence.  The period of b[u] is not necessarily N.  Depending on the value of N, b[u] may not even be periodic, so what you have in Equation 7 is a linear convolution of two sequences.  One sequence (a[u] has length N, the other (b[u]) has length unknown.  The limits of summation in the convolution equation are strictly set by the length of $a[u]$ and don't imply circular convolution or anything about the length of sequence b[u].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next you have to consider what range of values of b[u] are required to compute the convolution.  Straight from the form of EQUATION 1, you see that b[u] in general must be defined in the range -[N-1] to N-1.  The negative boundary is set by the most negative b[u] value required to calculate X[0] (i.e. you need b[0−(N-1)] for this calculation).  The positive boundary is set by the maximum spectral step you want to evaluate in the chirp Z transform (X[K] max).  From the way the question has been posed, X[k] is best interpreted as $X[N-1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason your computations work with a range that only goes back as far as -[M-1] is because you started with an M length sequence and zero padded it up to length N which zeros out any b[u] values going back further than -[M-1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an interesting write up of Chirp-Z along with Goertzel's algorithm that I think puts this in proper perspective:  &lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=goertzel%20algorithm&amp;amp;source=web&amp;amp;cd=3&amp;amp;sqi=2&amp;amp;ved=0CEIQFjAC&amp;amp;url=http%3A%2F%2Focw.mit.edu%2Fcourses%2Felectrical-engineering-and-computer-science%2F6-341-discrete-time-signal-processing-fall-2005%2Flecture-notes%2Flec20.pdf&amp;amp;ei=rawjUd6sM-LE0QHJ2IGQAQ&amp;amp;usg=AFQjCNEFEo7R7VSmk5jWYon0f4WqZYpvzg&amp;amp;bvm=bv.42553238,d.dmQ&quot; rel=&quot;nofollow&quot;&gt;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=goertzel%20algorithm&amp;amp;source=web&amp;amp;cd=3&amp;amp;sqi=2&amp;amp;ved=0CEIQFjAC&amp;amp;url=http%3A%2F%2Focw.mit.edu%2Fcourses%2Felectrical-engineering-and-computer-science%2F6-341-discrete-time-signal-processing-fall-2005%2Flecture-notes%2Flec20.pdf&amp;amp;ei=rawjUd6sM-LE0QHJ2IGQAQ&amp;amp;usg=AFQjCNEFEo7R7VSmk5jWYon0f4WqZYpvzg&amp;amp;bvm=bv.42553238,d.dmQ&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-02-19T16:58:34.003" LastActivityDate="2013-02-19T16:58:34.003" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="7893" PostTypeId="1" CreationDate="2013-02-18T22:56:50.550" Score="3" ViewCount="181" Body="&lt;p&gt;As many will know, images of all US censuses going back to 1790 are available online &lt;a href=&quot;http://blog.archive.org/2010/12/22/1790-1930-u-s-census-records-available-free/&quot; rel=&quot;nofollow&quot;&gt;http://blog.archive.org/2010/12/22/1790-1930-u-s-census-records-available-free/&lt;/a&gt;. Unfortunately the quality of the images is very poor in places and, as far as I know, there are no free processed versions of them available.  If you take an example like the following from the 1920 census, what would be a good method to extract relatively clean images of the handwritten text from the background image and noise?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original pdf for the page is at&#xA;&lt;a href=&quot;http://wikisend.com/download/737634/page.pdf&quot; rel=&quot;nofollow&quot;&gt;http://wikisend.com/download/737634/page.pdf&lt;/a&gt;  as I don't have the reputation points to post it here yet (can someone with more rep upload it?).&lt;/p&gt;&#xA;" OwnerUserId="3812" LastEditorUserId="3812" LastEditDate="2013-02-19T09:15:12.893" LastActivityDate="2015-04-17T21:25:07.020" Title="Extract hand written text from US census images" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7895" PostTypeId="1" CreationDate="2013-02-19T10:34:29.933" Score="3" ViewCount="137" Body="&lt;p&gt;Don't have any formal dsp experience - sophomore in college.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working on constructing a 25 band bark spectrogram for psychoacoustic analysis of audio FFT data. To do this, I'm grouping all FFT frequency bins into their relevant bark band and then averaging (summing them and dividing by the total number) the db values in each band to get the representative value for each band. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the correct way to represent a bunch of db values as a single value?&lt;/p&gt;&#xA;" OwnerUserId="3814" LastActivityDate="2014-05-03T02:18:36.887" Title="Compressing A Range Of Decibel Values to One &quot;Representative&quot; Value" Tags="|fft|audio|spectrogram|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7897" PostTypeId="2" ParentId="7830" CreationDate="2013-02-19T15:53:55.313" Score="0" Body="&lt;p&gt;I back-calculated from the Python prototype filters to get more precise values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f multiplier to get -3 dB at fc, for N = &#xA; 1: 1.0*           &#xA; 2: 1.27201964951  &#xA; 3: 1.32267579991*  1.44761713315  &#xA; 4: 1.60335751622   1.43017155999  &#xA; 5: 1.50231627145*  1.75537777664   1.5563471223   &#xA; 6: 1.9047076123    1.68916826762   1.60391912877  &#xA; 7: 1.68436817927*  2.04949090027   1.82241747886   1.71635604487  &#xA; 8: 2.18872623053   1.95319575902   1.8320926012    1.77846591177  &#xA;&#xA;Q for N = &#xA; 1: --------------&#xA; 2: 0.57735026919 &#xA; 3: -------------- 0.691046625825&#xA; 4: 0.805538281842 0.521934581669&#xA; 5: -------------- 0.916477373948 0.563535620851&#xA; 6: 1.02331395383  0.611194546878 0.510317824749&#xA; 7: -------------- 1.12625754198  0.660821389297 0.5323556979  &#xA; 8: 1.22566942541  0.710852074442 0.559609164796 0.505991069397&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Kind of cheating, but whatever, BLT is an approximation anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/endolith/4982787&quot; rel=&quot;nofollow&quot;&gt;Code and tables for N up to 25 is here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 2 separate frequency tables:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For matching the phase of high and lowpass filters / matching the asymptotes of a Butterworth of the same order.&lt;/li&gt;&#xA;&lt;li&gt;For setting the cutoff frequency to -3 dB&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The latter list can also be found in &quot;&lt;a href=&quot;http://books.google.com/books?id=E01DvO2nsH0C&amp;amp;pg=PA170&quot; rel=&quot;nofollow&quot;&gt;Table 7.5: Frequencies and Qs for Bessel Lowpass Filters up to Eighth Order&lt;/a&gt;&quot; of &quot;The Design of Active Crossovers&quot;, though it sounds like it was derived by trial-and-error.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-03-13T19:40:42.210" LastActivityDate="2013-03-13T19:40:42.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7898" PostTypeId="1" AcceptedAnswerId="7899" CreationDate="2013-02-19T17:53:04.713" Score="1" ViewCount="776" Body="&lt;p&gt;I really, really hope someone can help me with regards to this question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to implement a Hidden Markov Model (based off this paper: &lt;a href=&quot;http://www.cs.sjsu.edu/~stamp/RUA/HMM.pdf&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the processes, but, I do not understand what M would represent in the data I am trying to train the HMM with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am given this example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;N = the number of hidden states&#xA; M = the number of distinct observation symbols&#xA; T = the number of observations&#xA;&#xA; So, for the English text example, if you let N = 2, M = 27 (26 letters&#xA; plus word-space), and T = 50,000 (number of input letters to use), you&#xA; should see that the 2 hidden states correspond to consonants and&#xA; vowels.&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This example works for the English Dictionary, I understand that. BUT I am attempting to train the HMM with MFCC Coefficients of a file (stop.mfc) which contains 4k+ values. Now my interpretation would be that: &lt;code&gt;T = 4000; (The size of the 'Observable' sequence)&lt;/code&gt; and &lt;code&gt;N = 2; (&quot;Stop&quot; and &quot;Go&quot;)&lt;/code&gt; so therefore what would M represent in the example I am giving? Which is: Differentiating between someone saying &quot;Stop&quot; or &quot;Go&quot; Would &lt;code&gt;M&lt;/code&gt; infer the number of training samples I have?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really hope someone can help me with this.&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2016-11-27T18:08:41.270" Title="Hidden Markov Models - Distinct Observation Symbols" Tags="|speech-recognition|mfcc|hmm|dynamic-programming|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="7899" PostTypeId="2" ParentId="7898" CreationDate="2013-02-19T19:33:01.073" Score="2" Body="&lt;p&gt;Firstly, this is not because you have two words to identify that you need $N = 2$ states. Your goal is not to train a model with two states - one for each word to recognize - but to train 2 models, one for each word to recognize, and each of these models will have as many states as necessary. In fact, each state in your HMM should correspond to a distinct &quot;stage&quot; in the pronunciation of a word - and will very likely correspond to a phoneme. Your vocabulary size (here, two: &quot;stop&quot; and &quot;go&quot;) is external to this. For &quot;stop&quot;, there are 4 phonemes. For &quot;go&quot;, there are 2 phonemes. So you train a 4-state left-to-right model on the &quot;stop&quot; data; and independently of this, a 2-state left-to-right model on the &quot;go&quot; data. To recognize a word given its MFCCs, you evaluate which of these two models has the highest likelihood given the data. If you had to recognize words within a lexicon of 10 words, you would similarly train 10 HMMs, one for each word, each of these models having a number of states suitable to the length/complexity of the word to recognize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to step back and ask yourself &quot;why HMMs in the first place?&quot;. We need HMM for speech recognition because words are made of a sequence of distinct elements in sequence (phonemes). If we want to describe/recognize the word &quot;stop&quot;, we need to learn a description which is expressive enough to capture that &quot;first it sounds like ssss, for a short while, then it is tttt for a short while, then it is oooo for a longer amount of time, then it is pppp for a short moment&quot;. HMMs are a good match for expressing that - states are phonemes, the transition matrix (which will be here diagonal + upper diagonal) indicates that we move through the word from first phoneme to last phoneme, staying a variable amount of time in each phoneme, and the distribution associated with each state indicates how each phoneme translates into your acoustic features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems also that you are mixing up discrete HMM (in which the observations are drawn from a discrete distribution associated with each state) with continuous HMMs (in which the observations are scalars or vectors, characterized by a continuous distribution such as a gaussian). So the parameter $M$, number of distinct observation symbols, is irrelevant in your case, since your observations are 13-dimensional vectors, an uncountable set! ($M$ would be... the cardinality of the continuum).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am afraid the introduction material you have picked is not directly relevant to speech recognition - though it is useful for applications in which HMMs are used to recover hidden structure from a discrete observations (and there are many of them, for example parsing/tagging in NLP). Try to master this material without thinking much about your speech recognition problem, and then move on to material about continuous HMMs with multivariate normal distributions - and finally to continuous HMM with mixtures of multivariate normal distributions (since this is what is likely to work best for speech).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-02-19T19:38:09.383" LastActivityDate="2013-02-19T19:38:09.383" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="7901" PostTypeId="1" CreationDate="2013-02-20T00:14:51.810" Score="0" ViewCount="127" Body="&lt;p&gt;I have sample images, and I need to extract certain features that depend on color. Images are more like line art, contours, and consist of various line forms, and several colors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can extract specific features through thresholding, but if lines intersect I always get discontinuities (holes) that are not acceptable. As example I prepared this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have image with two &quot;lines&quot;:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HiAxr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'll threshold to remove black, but underneath line (which of course doesn't exist as information in bitmap representation) gets discontinued:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1pdmE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;while I want it like this:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E1aU7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which I'll later equalize, and get wanted context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used image processing program, and would appreciate some tip how to do this in Gimp or Photoshop, but any answer is welcomed like Python/ndimage, Matlab/Octave...&lt;/p&gt;&#xA;" OwnerUserId="719" LastEditorUserId="719" LastEditDate="2013-02-20T00:44:56.020" LastActivityDate="2013-03-01T01:57:12.393" Title="Image thresholding while retaining &quot;underneath&quot; contents" Tags="|image-processing|image-segmentation|thresholding|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7902" PostTypeId="1" AcceptedAnswerId="7951" CreationDate="2013-02-20T06:07:00.433" Score="1" ViewCount="337" Body="&lt;p&gt;I would like to know how to determine (using any programming language) whether a given audio file contains noise, such as of people talking in background, how to remove the noise, and how to subsequently compare the cleaned file with the original file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input to the program will be a sound file containing a conversation between two people and the program should be able to remove the noise from that file and should output only the conversation between the two people.&lt;/p&gt;&#xA;" OwnerUserId="3819" LastEditorUserId="1059" LastEditDate="2013-02-20T07:16:18.173" LastActivityDate="2013-03-25T08:53:53.830" Title="How to denoise a conversation between two people?" Tags="|denoising|speech-processing|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="7904" PostTypeId="2" ParentId="7879" CreationDate="2013-02-20T07:40:56.127" Score="8" Body="&lt;p&gt;There are several key insights you need in order to understand how DFT allows you to shift an image.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, Fourier's theorum: It's probably easier to look at the continuous (i.e., analog) case first.  Imagine you have some function, call it g(t).  For simplicity, let's say that g(t) is an analog audio recording, so it's a one-dimensional function, which is continuous, and represents the instantaneous pressure as a function of time.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, g(t) is one way we can represent our audio recording.  Another is G(f).  G(f) is the Fourier transform of g(t).  So, G(f) == FT(g(t)).   G(f) has all the same information as g(t), but it represents that information in the frequency domain instead of the time domain.  There are some nit-picky details about Fourier Transforms, which I won't mention.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can sort of think of G(f) as the &quot;distribution of frequencies&quot; contained in g(t).  So, if g(t) is a sine-wave (i.e., a pure tone), then G(f) will be zero everywhere, except at the frequency of that tone.  This is probably a good point to mention that G(f) is in general a complex function--that is to say that it returns complex numbers, which can be thought of having a real and imaginary component or a magnitude and phase.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One small digression here:  Since g(t) is continuous (both in domain and range), G(f) is also continuous. So, how can G(f) be zero everywhere except for the tone frequency?  Well, FT(sin(wt)) = $\delta(w)$.  Where $\delta$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirac_delta_function&quot;&gt;Dirac delta function&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so now we've got continuous FT's under our belt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the second insight:  A Discrete Fourier Transform is to a Fourier Transform as a sampled signal is to an analog signal.  In this case, the &#xA;&quot;discrete&quot; refers to quantization of the function's domain (time or frequency), not it's range.  (The sampled digital signal you get from your sound card is quantized in both domain and range.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The digital byte-stream you get from your sound card contains &quot;samples&quot; of the original continuous (analog) signal from the microphone.  If we take the DFT of our sampled g(t), we still get a G(f).  G(f), remember, is just a different way of representing the information contained in g(t). If we obeyed &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot;&gt;Nyquist's theorum&lt;/a&gt;, the sampled signal g(t) contains all the &quot;intelligence&quot; of the original continuous signal, so our discrete G(f) must contain all the information from our original continuous signal. Parenthetically, G(f) is still a complex function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where the magic of sub-pixel shifting comes in, but in this case I'm going to write about shifting the audio signal in time by less than a sample, since it's the same thing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember how G(f) is a complex function?  It needs to be complex in order to represent frequencies that aren't zero at t=0.  Remember, sin(0)=0, so sin(2*0)=0, etc.  But what if we started recording a quarter of the way through a cycle of the tone?  That's where the phase part of G(f) comes from.  In this case, the phase would be 90 degrees or pi/2 radians, depending on your preference for representing a quarter of a cycle.  So G(tone_frequency) = 0 + i or $e^{{i \pi}\over{2}}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means we can shift our audio recording in time (by &lt;em&gt;any&lt;/em&gt; amount we choose, including a fraction of a sample time) simply by modifying the phase of G(t). Actually, that statement is perhaps a bit too casual.  For an un-quantized, sampled signal the phase can be adjusted arbitrarily (this is part of the reason I made the distinction between quantization of domain and range earlier).  However, for a quantized sampled signal (our byte-stream of audio, for example) the quantization step size (i.e., number of bits) determines the resolution with which we can adjust the phase.  When we Inverse Fourier Transform G(f) (or DIFT it, for this sampled signal), the new set of samples g'(t) = DIFT(G(F)) will all be shifted in time by the amount we pick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying this to your pixels simply means using a 2-dimensional FT instead of the 1-dimensional FT discussed here.&lt;/p&gt;&#xA;" OwnerUserId="3820" LastEditorUserId="3820" LastEditDate="2013-02-20T16:59:43.393" LastActivityDate="2013-02-20T16:59:43.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7905" PostTypeId="1" AcceptedAnswerId="7907" CreationDate="2013-02-20T09:40:08.383" Score="16" ViewCount="36252" Body="&lt;p&gt;In MATLAB I have to pass cut-off frequency for designing a filter. But this Cut-off frequency is in radians-per-sample. How do I convert my analog Cut off frequency in $\textrm{Hz}$, into the required radians-per-sample for MATLAB?     &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="1629" LastEditDate="2016-09-02T20:55:32.773" LastActivityDate="2016-09-02T20:59:21.647" Title="Converting frequency from $\textrm{Hz}$ to radians-per-sample" Tags="|matlab|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7906" PostTypeId="1" AcceptedAnswerId="7912" CreationDate="2013-02-20T10:12:52.713" Score="8" ViewCount="6010" Body="&lt;p&gt;I am stumped on a simple problem. Let's say I have two 4 bit numbers in Q0.3 format. One sign bit and three fractional bits. So I can represent $-1$ through to $0.875$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's now say I wish to do this calculation: $-0.25 \times 0.875$. Which is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{-2}{2^3} \times \frac{7}{2^3}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which means I am multiplying $1110$ ($-2$) by $0111$ ($7$). Of course the answer is $-0.21875$ or $-0.25$ using the closest Q0.3 number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's do the working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;1110 \times 0111 = 01100010&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which when viewed as a Q0.6 number is $1.100010$, which is $-0.46875$ by my books. Why is this incorrect? I expect an answer of $1.110010$ ($-0.21875$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I done wrong?&lt;/p&gt;&#xA;" OwnerUserId="3821" LastActivityDate="2013-02-20T16:03:41.853" Title="Fixed point multiplication with negative numbers" Tags="|fixed-point|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7907" PostTypeId="2" ParentId="7905" CreationDate="2013-02-20T12:49:50.287" Score="22" Body="&lt;p&gt;Problems like these are best attacked using some dimensional analysis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_{[\rm rad/samples]} = f_{[\rm cycles/sec]}\cdot \frac{\text{sec}}{\text{samples}}\cdot \frac{\text{rad}}{\text{cycle}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_{[\rm rad/samples]} = f_{[\rm cycles/sec]}\cdot \frac{2\pi}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sample rate in $\textrm{Hz}$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="1629" LastEditDate="2016-09-02T20:59:21.647" LastActivityDate="2016-09-02T20:59:21.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7908" PostTypeId="2" ParentId="7724" CreationDate="2013-02-20T14:06:28.070" Score="6" Body="&lt;p&gt;Synchronization is an important task in practical communication systems but it is not directly related to the theory of OFDM. &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Frame Synchronization&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Practical communication systems (such as IEEE 802.11 or 802.3) exchange so-called frames, which consist of several fields, which in turn accomplish different, specific tasks. &#xA;Typically, the first field of a frame is a so-called preamble, which has the mere purpose of&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;detecting arriving frames, &lt;/li&gt;&#xA;&lt;li&gt;synchronizing the receiver with the transmitter, &lt;/li&gt;&#xA;&lt;li&gt;performing automatic gain correction (AGC) at the receiver (required in wireless communication systems). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The preamble typically consists of a Barker sequence, which is a binary code with minimal off-peak autocorrelation. &#xA;This code doesn't even necessarily have to be OFDM-modulated, but it may be BPSK-modulated on a single carrier within the available frequency band. &#xA;The receiver applies a matched filter to the incoming stream of samples. &#xA;If the matched filter's output exceeds a specific threshold, it is very likely that it has detected an incoming preamble. &#xA;As the Barker code's off-peak autocorrelation coefficients are minimal, the peak of the matched filter's output provides the required information to align the subsequent fields of the frame with the receiver's FFT. &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Training Sequence&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;After the preamble, the next field of a frame is typically some sort of an OFDM &lt;em&gt;training sequence&lt;/em&gt;. &#xA;The main purpose of training sequences is to &lt;em&gt;estimate channel coefficients&lt;/em&gt; of individual subcarriers, not synchronization. &#xA;Some protocols distinguish also between long and short training sequences, whereas a long training sequence can be found directly after the preamble and short training sequences are spread in the rest of the frame. &#xA;Generally, the receiver knows in advance&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the positions of training sequences in the frame and&lt;/li&gt;&#xA;&lt;li&gt;the values of the pilot symbols contained in the training sequences. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As the channel coefficients may change over time due to mobility of nodes and obstacles in the environment, they have to be re-estimated within the so-called coherence time, which is accomplished by short training sequences (i.e., pilot symbols) between payload OFDM symbols. &#xA;The coherence time can be approximated as the inverse of the maximum Doppler spread. &#xA;Also, in some protocols, training sequences are transmitted only on a few, equally-spaced subcarriers, while all other subcarriers in between continue payload transmissions. &#xA;This works since the channel coefficients of neighboring subcarriers are correlated to each other. &#xA;The coherence bandwidth of a fading channel can be estimated as the inverse of the channel delay spread. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that in practical systems, the pilot symbols may also be used for other purposes, such as to estimate the SNR of individual subcarriers or to perform estimation of the carrier frequency offset (see below). &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Cyclic prefix&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The main purpose of the cyclic prefix inserted between successive OFDM symbols is mitigation of ISI (Inter-Symbol-Interference) and ICI (Inter-Carrier-Interference), not synchronization or determining symbol starts or ends. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Mitigation of ISI&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Due to multipath propagation, multiple copies of the transmitted waveform arrive at the receiver at different time instants. &#xA;Hence, if there was no guard space between successive OFDM symbols, a transmitted OFDM symbol may overlap with its subsequent OFDM symbol at the receiver, causing ISI. &#xA;Inserting a guard space between successive OFDM symbols in the time domain mitigates this effect. &#xA;If the guard space is larger than the maximum channel delay spread, all of the multi-path copies arrive within the guard space, keeping the subsequent OFDM symbol unaffected. &#xA;Note that the guard space may also contain zeros to mitigate the effect of ISI. &#xA;In fact, no cyclic prefix is required in the guard space in any digital communication technique to mitigate the effect of ISI. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Mitigation of ICI&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In OFDM, guard spaces are filled with a cyclic prefix to maintain orthogonality between subcarriers on condition that multiple delayed copies arrive at the receiver due to multi-path propagation. &#xA;If the guard space was actually filled with zeros at the transmitter, the multiple copies arriving at the receiver would be non-orthogonal (i.e., somehow correlated) to each other, causing ICI. &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Carrier Frequency Offset (CFO) and Phase Noise&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;In practical systems, the transmitter's and the receiver's carrier frequency oscillators typically have a slight offset in frequency, which causes a &lt;em&gt;phase drift&lt;/em&gt; over time. &#xA;In addition, the power spectral density of a practical oscillator is not an ideal delta function, resulting in phase noise. &#xA;Phase noise causes the CFO to continuously change, resulting in a change of the phase drift's speed and direction. &#xA;There are various techniques to &lt;em&gt;resynchronize&lt;/em&gt; the receiver to the received signal, i.e., to track the phase of the incoming signal. &#xA;These techniques may additionally exploit the presence of pilot symbols in the signal, and/or apply blind estimation and correlation techniques. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also maintain an open-source &lt;a href=&quot;https://github.com/r3nk/WARPLab-OFDM&quot; rel=&quot;noreferrer&quot;&gt;OFDM framework&lt;/a&gt; for software defined radios, which covers the techniques described above in Matlab code. &lt;/p&gt;&#xA;" OwnerUserId="3822" LastActivityDate="2013-02-20T14:06:28.070" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7909" PostTypeId="1" CreationDate="2013-02-20T14:48:18.893" Score="6" ViewCount="530" Body="&lt;p&gt;This is a question that came to mind as a result of a previous question &lt;a href=&quot;https://dsp.stackexchange.com/questions/7898/hidden-markov-models-distinct-observation-symbols&quot;&gt;Hidden Markov Models - Distinct Observation Symbols&lt;/a&gt; and subsequent answer from @pichenettes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach to speech recognition is to use Hidden Markov Models (HMM) to identify patterns in speech.  Both discrete HMM models and continuous HMM models have been used, but the continuous HMM approach seems to produce better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In continuous approach, the “input” to the HMM models is a series of vectors constructed from frames of processed speech.  So speech as processed in blocks of some time length resulting in vectors of some fixed dimension say N, with the size of N being directly related to the frame length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is this:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a relationship between the frame length (or alternatively the dimension of the vectors, N) and the number of states resulting in the HMM models used for recognition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also  is there a relationshiop between the number of HMM models required to predic speech and the size of N?&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2018-01-30T05:26:00.577" Title="Hidden Markov Model for Speech Rcognition. HMM Number of States" Tags="|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7911" PostTypeId="1" AcceptedAnswerId="7925" CreationDate="2013-02-20T15:39:17.127" Score="15" ViewCount="13203" Body="&lt;p&gt;I am having trouble understanding on how to read the plot plotted by a wavelet transform,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is my simple Matlab code,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;load noissin;&#xA;% c is a 48-by-1000 matrix, each row &#xA;% of which corresponds to a single scale.&#xA;c = cwt(noissin,1:48,'db4','plot');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jmu3N.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the brightest part means the scaling coffiecient size is bigger, but how exactly i can understand this plot what is happening there ?&#xA;Kindly help me.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2015-07-25T20:30:55.420" Title="Reading the Wavelet transform plot" Tags="|wavelet|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7912" PostTypeId="2" ParentId="7906" CreationDate="2013-02-20T15:57:57.227" Score="11" Body="&lt;p&gt;When multiplying two's complement numbers, you have to perform sign extensions to the operands to meet the number of digits your multiplication will yield, i.e., in your case $4 + 4 = 8$ digits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;11111110_2 \times 00000111_2 = 11110010_2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As there are $2 * 3$ fractional bits, the result is $1.110010_2 = \frac{-14}{2^6} = -0.21875$. Normalizing this number to $3$ fractional bits in Q0.3 format yields $1.110_2 = -0.25$.&lt;/p&gt;&#xA;" OwnerUserId="3822" LastEditorUserId="3822" LastEditDate="2013-02-20T16:03:41.853" LastActivityDate="2013-02-20T16:03:41.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7913" PostTypeId="2" ParentId="7911" CreationDate="2013-02-20T16:10:43.770" Score="15" Body="&lt;p&gt;Imagine for one second, that you just plotted your &lt;a href=&quot;http://en.wikipedia.org/wiki/Daubechies_wavelet&quot;&gt;daubechies-4&lt;/a&gt; wavelet, as you can &#xA;see here in red. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ku1Gw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine that you take this waveform in red, and simply do a cross-correlation with your signal. You plot that result. This will be the first row of your plot. This is scale-1. Next, you dilate your Daubechies-4 wavelet, (that is, you simply make it 'stretch' it in time, by some factor). Then, you again do a cross-correlation of this new waveform with your signal. You then get row two of your plot. This is scale-2. You keep doing this for all scales, which means you keep taking your original 'mother' wavelet, and you keep dilating, then cross-correlating, dilating, and cross-correlating, etc, and you just plot the results one on top of the others. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what the CWT plot is showing you. The results of performing a cross-correlation of your signal with a wavelet at different scales, that is, at different dilation (stretch) factors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let us interpret your image. In the first row, you can see that you have weak amplitudes in your cross-correlation. That means that it is telling you, almost nothing in your signal correlates, (or 'matches') your wavelet, when it is at scale-1, (when it is at the smallest scale). You keep stretching your wavelet and correlating, and still it is not matching anything in your signal, until you reach say, scale-31. So when you stretch your wavelet 31 times, and performed a cross-correlation, you start to see some bright spots, which means you are getting good cross-correlation scores between your stretched wavelet, and your signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look however at the very top, we have the brightest spots. So for scale-46, you made that row by stretching your original wavelet 46 times, and then cross-correlated it with your signal, and then that is your row-46. So you see a lot of nice bright spots. You can see that at positions (x-axis) ~25, ~190, and ~610, I have bright spots. So that is telling you, you have some feature in your signal, that very closely matches your wavelet &lt;em&gt;that is stretched 46 times&lt;/em&gt;. So you have 'something' at those locations that closely match your wavelet at this scale. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Of course, in your case, you have used noise, so the positions that I have talked about are random - that is, there is nothing really 'interesting' going on. Do a CWT with a sine pulse and what I am saying can be made clearer to you.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, the CWT is simply showing you all possible correlation scores between your template/matched filter (in this case daub-4 wavelet), at different positions, (x-axis) , also at different stretched factors, (y-axis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helped.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2013-02-20T16:15:58.310" LastActivityDate="2013-02-20T16:15:58.310" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7914" PostTypeId="1" CreationDate="2013-02-20T16:41:14.363" Score="2" ViewCount="190" Body="&lt;p&gt;I've read the explanation in &lt;a href=&quot;http://urchin.earth.li/~twic/Golomb-Rice_Coding.html&quot; rel=&quot;nofollow&quot;&gt;http://urchin.earth.li/~twic/Golomb-Rice_Coding.html&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Golomb_coding&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Golomb_coding&lt;/a&gt; , however, I still not get the intuition why it is efficient and when it is useful.&lt;/p&gt;&#xA;" OwnerUserId="3365" LastActivityDate="2013-02-20T16:41:14.363" Title="How does Golomb-Rice Coding work?" Tags="|compression|image-compression|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7915" PostTypeId="1" CreationDate="2013-02-20T18:24:33.457" Score="6" ViewCount="3960" Body="&lt;p&gt;I have a system that gives me a noisy data set similar to the one generated by this matlab/octave code. The y-axis represents the signal intensity and the x-axis represents spatial distance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;noise = randn(1,512);&#xA;points = gaussian(512,.01);&#xA;noisy = points + .02*(noise');&#xA;plot(noisy)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pVM8B.jpg&quot; alt=&quot;Noisy signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual signal will be asymmetric and not the result of a gaussian function(but close). I can't create the noise accurately by hand and the underlying signal algorithmically so image these two together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kPRRz.png&quot; alt=&quot;Wavy signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal is to construct an interpolating curve, using bicubic splines, based on only one data set of this signal. The signal cannot be captured multiple times and averaged together to remove the noise. Since the signal is noisy, I can't simply pick points every N samples as the interpolation points so I need to do some signal conditioning first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will not be able to use an exact model of the underlying physical process but the sources of noise are known and I can make some assumptions regarding the maximum slope and SNR. The interpolation is used to correct for manufacturing limitations so the curve is intended to be smooth(exclusive of noise) but for cost reasons is not. Therefore we don't expect any large deviations from this example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial approaches used an M-point moving average filter to smooth the signal, then used polyfit handle the ends of the signal. This worked but could potentially reduce the center peak, if M is large enough. I've also since learned smoothing signals before interpolation is generally discouraged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a better approach to achieve this? &lt;/p&gt;&#xA;" OwnerUserId="3826" LastEditorUserId="3826" LastEditDate="2013-02-20T20:49:14.413" LastActivityDate="2013-02-21T21:21:25.117" Title="Fitting piecewise splines to noisy data" Tags="|noise|interpolation|smoothing|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7917" PostTypeId="2" ParentId="7911" CreationDate="2013-02-20T20:40:31.620" Score="12" Body="&lt;p&gt;These plots were helpful for me to understand, coming from a &lt;a href=&quot;https://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;STFT&lt;/a&gt; background:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Morlet_wavelet&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;complex&lt;/em&gt; Morlet (sinusoidal) wavelet&lt;/a&gt; looks and behaves like the complex kernel of a STFT (since it's derived from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gabor_transform&quot; rel=&quot;noreferrer&quot;&gt;Gabor transform&lt;/a&gt;, a type of STFT).  When you &quot;slide it past&quot; a signal of the same frequency, it matches, no matter the phase of the signal you're measuring, producing a magnitude and phase measurement at each point (and this is a plot of the magnitude alone):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7IkZD.jpg&quot; alt=&quot;Magnitude of complex Morlet wavelet transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://flic.kr/p/7oXfbT&quot; rel=&quot;noreferrer&quot;&gt;Magnitude plot of complex Morlet wavelet transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;real-valued&lt;/em&gt; Morlet wavelet only matches when the phases of the wavelet and the signal line up.  So as you slide it past the signal you're measuring, it goes in and out of phase, producing maxima and minima as they cancel or reinforce:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aBnux.jpg&quot; alt=&quot;Magnitude of continuous real Morlet wavelet transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://flic.kr/p/7oXfh6&quot; rel=&quot;noreferrer&quot;&gt;Magnitude of continuous real Morlet wavelet transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Actually, in that case, we're plotting the magnitude, so both the positive and negative matches produce orange dots.  It's better to switch to a &lt;a href=&quot;https://gist.github.com/endolith/2879736&quot; rel=&quot;noreferrer&quot;&gt;bipolar colormap&lt;/a&gt; instead, to show that some peaks are in phase and others are out of phase):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8w6YK.jpg&quot; alt=&quot;Continuous real Morlet wavelet transform using bipolar colormap&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://flic.kr/p/dWSfUd&quot; rel=&quot;noreferrer&quot;&gt;Continuous real Morlet wavelet transform using bipolar colormap&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the real-valued Morlet, the magnitude and phase information are combined into a single output value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most commonly-used wavelets are real-valued, so they only match up when the wave you're measuring and the wave you're testing with line up, leading to these oscillations or ripples in the scalogram as you slide one past the other.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-09-05T14:10:07.613" LastActivityDate="2013-09-05T14:10:07.613" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7918" PostTypeId="2" ParentId="7915" CreationDate="2013-02-21T02:52:42.670" Score="1" Body="&lt;p&gt;Not knowing the underlying model, you might just try a few things and see what best passes your fitness metric.  Try interpolating the entire data set with polynomials of various degrees well below N.  Try low-pass filters, maybe applied in the frequency domain to an FFT of your data set, with various cut-off frequencies and transition widths to roll-off any spectrum capable of producing a slope over the maximum expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can calculate the maximum slope of each trial, and subtract the trial interpolation from the data to get a hypothetical noise signal.  Iterate the polynomial degree and/or the filter passband until you get a maximim slope and a noise level that meets your fitness metric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might even be able to automate the above with either a successive approximation or genetic/evolutionary algorithm.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-02-21T02:52:42.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7920" PostTypeId="2" ParentId="7860" CreationDate="2013-02-21T10:19:27.980" Score="0" Body="&lt;p&gt;Need a bit of clarity in question. There can be numerous normalization techniques for EEG depending on how they are used. That can be before processing (i.e. raw) or even after processing (for example, with FFT or other transforms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Z-transform is ONE method. Period. There is nothing else called z-transform. You can have a look on Wikipedia entry of z-transform &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Z-score, as used in your article, is a statistical measure, also called the standard score. More info &lt;a href=&quot;http://en.wikipedia.org/wiki/Standard_score&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum up, z-transform and z-score are NOT linked. &lt;/p&gt;&#xA;" OwnerUserId="73" LastActivityDate="2013-02-21T10:19:27.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7921" PostTypeId="2" ParentId="1512" CreationDate="2013-02-21T10:22:07.463" Score="0" Body="&lt;p&gt;I'll be surprised if the difference is only amplitudes. And if they are, just take the mean amplitude of both signals and you know which one is which. However, I doubt if thats the case.&lt;/p&gt;&#xA;" OwnerUserId="73" LastActivityDate="2013-02-21T10:22:07.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7922" PostTypeId="1" AcceptedAnswerId="7923" CreationDate="2013-02-21T13:02:27.777" Score="1" ViewCount="148" Body="&lt;p&gt;For the difference equation below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(k)=1/2{x(k)+x(k-1)}$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How i can find he z-domain transfer function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3828" LastActivityDate="2013-02-21T13:29:19.963" Title="Z-domain transfer function question" Tags="|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7923" PostTypeId="2" ParentId="7922" CreationDate="2013-02-21T13:29:19.963" Score="3" Body="&lt;p&gt;I assume this is homework, but transforming a difference equation to the $z$-domain is simple; just recall the time-shifting property of the transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] \Leftrightarrow X(z) \rightarrow x[n-k] \Leftrightarrow z^{-k}X(z)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = \frac{1}{2}x[n] + x[n-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y(z) = \frac{1}{2}X(z) + z^{-1}X(z)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = \frac{Y(z)}{X(z)} = \frac{1}{2} + z^{-1}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-02-21T13:29:19.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7924" PostTypeId="1" AcceptedAnswerId="7936" CreationDate="2013-02-21T14:17:57.517" Score="2" ViewCount="5993" Body="&lt;p&gt;I have a signal in MATLAB on which I'd like to perform an FFT. My signal is stored in s, and I use the code below (inspired by the MATLAB help):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = length(s);&#xA;nfft = 2^nextpow2(L);&#xA;S = fft(s,nfft)/L;&#xA;fftf = 1/Ts/2*linspace(0,1,nfft/2+1);&#xA;ffts = (2*abs(S(1:nfft/2+1)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;s is a GMSK-modulated bit sequence, that is, it varies between $f_c-2400$ Hz and $f_c+2400$ Hz in my case when transmitting 0 or 1, respectively. $f_c$ is set to 100kHz. For a long input, say, 250 bits worth of 1's and 250 bits worth of 0's, I get what I expect, see the first image below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I instead choose a low number of bits, say 10 1 bits followed by 10 0 bits, I get as expected, but it is shifted down to ~90kHz instead of centered at 100kHz. This is something I can't quite understand - it seems changing the sample rate and length of the FFT changes absolutely nothing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain to me why? Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long data: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IXzZn.png&quot; alt=&quot;http://f.cl.ly/items/0R1i0x0m46221A230m25/fft1.png&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short data: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i4bUC.png&quot; alt=&quot;http://f.cl.ly/items/2a320I2l2r3M1i2o2N11/fft1.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code used to generate the signal and FFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Configuration&#xA;clear; clf;&#xA;&#xA;DataRate = 9600;          % 9600 kbps for AIS&#xA;N = 100;                  % Samples per bit&#xA;Tb = 1/DataRate;          % Bit period&#xA;Ts = Tb/N;                % Sampling period&#xA;BT = 0.5;                 % AIS spec, time-bandwidth product&#xA;Ftrans = 100e3;           % Frequency of &quot;transmitted&quot; signal&#xA;&#xA;num = 200;&#xA;Bits = zeros(1,num)+1;&#xA;Bits = [Bits zeros(1,num)-1];&#xA;clear num;&#xA;&#xA;%% Modulation&#xA;&#xA;% Prep a time axis from -2Tb to 2Tb&#xA;t_g = -2*Tb:Ts:2*Tb;&#xA;&#xA;% Gaussian response to rectangular pulse [Haykin4th, p. 397]&#xA;x = pi*sqrt(2/log(2))*BT;&#xA;gr = 1/2*(erfc(x*(t_g/Tb-1/2))-erfc(x*(t_g/Tb+1/2))); &#xA;&#xA;% Truncate to 3Tb, pulse centered at 1.5Tb&#xA;gr = gr(0.5*N+2:3.5*N+1);&#xA;&#xA;% Normalize&#xA;% when integrating, we want to end at 0.5 (phase changes by 0.5pi)&#xA;% so, we want sum(y)=0.5 -&amp;gt; normalize by sum(y) and divide by two.&#xA;gr = (gr)./(2*sum(gr));&#xA;&#xA;% Generate the Gaussian filtered pulse train by centering a &quot;Gaussian&#xA;% rectangle&quot; on each bit, and adding inter-symbol interference&#xA;f = zeros(1,(length(Bits)+2)*N);&#xA;for n = 1:length(Bits)&#xA;    f((n-1)*N+1:(n+2)*N) = f((n-1)*N+1:(n+2)*N) + Bits(n).*gr;&#xA;end&#xA;&#xA;% Since gr corresponds to changing the phase 0.5, multiplying by pi and&#xA;% integrating gives the resulting phase.&#xA;theta = pi*cumsum(f);&#xA;&#xA;% Prep I,Q&#xA;I = cos(theta);&#xA;Q = sin(theta);&#xA;&#xA;% Transmitted signal, shifted to ftrans&#xA;t = linspace(0,length(Bits)*N,length(I))*Ts;&#xA;s = -sin(2*pi*Ftrans.*t).*Q+cos(2*pi*Ftrans.*t).*I;&#xA;&#xA;%% FFT&#xA;&#xA;L = length(s);&#xA;% faster w/ a pow2 length, signal padded with zeros&#xA;nfft = 2^nextpow2(L);&#xA;% do the nfft-point fft and normalize&#xA;S = fft(s,nfft)/L;&#xA;% x-axis from 0 to fs/2, nfft/2+1 points&#xA;fftf = 1/Ts/2*linspace(0,1,nfft/2+1);&#xA;% only plotting the first half since its mirrored, thus 1:nfft/2+1&#xA;% why multiplied with 2?&#xA;ffts = (2*abs(S(1:nfft/2+1)));&#xA;&#xA;%% Plotting&#xA;&#xA;% FFT PLOT&#xA;plot(fftf/1e3,ffts);&#xA;title('FFT of transmitted signal S(f)');&#xA;set(gca,'xlim',[Ftrans/1e3-20 Ftrans/1e3+20]);&#xA;ylabel('|S(f)|');&#xA;xlabel('Frequency [kHz]');&#xA;grid;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adjusting the sample frequency by changing N seems to have no effect - but changing num from e.g. 10 to 100 (changing the number of bits) clearly shifts the plotted spectrum closer to 100kHz.&lt;/p&gt;&#xA;" OwnerUserId="3829" LastEditorUserId="76" LastEditDate="2013-02-26T00:50:12.237" LastActivityDate="2014-02-02T07:13:03.890" Title="FFT in MATLAB is shifted in frequency" Tags="|fft|matlab|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7925" PostTypeId="2" ParentId="7911" CreationDate="2013-02-21T14:22:20.063" Score="5" Body="&lt;p&gt;This is the example that i think is the best to understand Wavelet plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the image below,&#xA;The Waveform (A) is our original Signal, Waveform (B) shows a Daubechies 20 (Db20) wavelet about 1/8 second long that starts at the beginning (t = 0) and effectively ends well before 1/4 second. The zero values are extended to the full 1 second. The point-by-point comparison* with our pulse signal (A) will be very poor and we will obtain a very small correlation value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we first shift the unstretched basic or mother wavelet slightly to the right and perform another comparison of the signal with this new waveform to get another correlation value. We continue to shift and when the Db20 wavelet is in the position shown in (C) we get a little better comparison than with (B), but still very poor because (C) and (A) are different frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After we have continued shifting the wavelet all the way to the end of the 1 second time interval, we start over with a slightly stretched wavelet at the beginning and repeatedly shift to the right to obtain another full set of these correlation values. Waveform (D) shows the Db20 wavelet stretched to where the frequency is roughly the same as the pulse (A) and shifted to the right until the peaks and valleys line up fairly well. At these particular amounts of shifting and stretching we should obtain a very good comparison and a large correlation value. &#xA;Further shifting to the right, however, even at this same stretching will yield increasingly poor correlations. Further stretching doesn't help at all because even when lined up, the pulse and the over-stretched wavelet won’t be the same frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gxiJq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the CWT we have one correlation value for every shift of every stretched&#xA;wavelet.† To show the correlation values (quality of the “match”) for all these stretches and shifts, we use a 3-D display. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it goes,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5wZzs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bright spots indicate where the peaks and valleys of the stretched and shifted wavelet align best with the peaks and valleys of the embedded pulse (dark when no alignment, dimmer where only some peaks and valleys line up, but brightest where all the peaks and valleys align). In this simple example, stretching the wavelet by a factor of 2 from 40 to 20 Hz (stretching the filter from the original 20 points to 40 points) and shifting it 3/8 second in time gave the best correlation and agrees with what we knew a priori or “up front” about the pulse (pulse centered at 3/8 second, pulse frequency 20 Hz). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We chose the Db20 wavelet because it looks a little like the pulse signal. If we didn’t know a priori what the event looked like we could try several wavelets (easily switched in software) to see which produced a CWT display with the brightest spots (indicating best correlation). This would tell us something about the shape of the event.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the simple tutorial example above we could have just visually discerned the location and frequency of the pulse (A). The next example is a little more representative of wavelets in the real world where location and frequency are not visible to the naked eye. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the example below,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uQFbm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelets can be used to analyze local events. We construct a 300 point slowly varying sine wave signal and add a tiny “glitch” or discontinuity (in slope) at time = 180. We would not notice the glitch unless we were looking at the closeup (b).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now lets see how FFT will display this Glitch, have a look,&#xA;&lt;img src=&quot;https://i.stack.imgur.com/XtbSK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The low frequency of the sine wave is easy to notice, but the small glitch cannot be seen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if we use CWT instead of FFT it will clearly display that glitch,&#xA;&lt;img src=&quot;https://i.stack.imgur.com/HpJ0p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see CWT wavelet display clearly shows a vertical line at time = 180 and at low scales. (The wavelet has very little stretching at low scales, indicating that the glitch was very short.) The CWT also compares well to the large oscillating sine wave which hides the glitch. At these higher scales the wavelet has been stretched (to a lower frequency) and thus “finds” the peak and the valley of the sine wave to be at time = 75 and 225, For this short discontinuity we used a short 4-point Db4 wavelet (as shown) for best comparison. &lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2013-02-21T18:30:07.067" LastActivityDate="2013-02-21T18:30:07.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7926" PostTypeId="2" ParentId="7796" CreationDate="2013-02-21T14:45:30.043" Score="0" Body="&lt;p&gt;I think something worthy for you to have a try is the pixel co-occurrence model. Roughly speaking, this is something based on pixel intensities. So you can quickly skip all unlikely positions and concentrate on those interested ones. Search for articles about skin models. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meanwhile, there are some HAAR orthogonal projection based recognition algorithms (this idea is published on CVPR and PAMI). Although I have not used it before, it is not surprising that this algorithm is quite fast, because its computations are integral image-like. In other words, you can match an arbitrary size of rectangular ROI in a target image. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-02-21T14:45:30.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7927" PostTypeId="1" AcceptedAnswerId="7928" CreationDate="2013-02-21T16:18:11.030" Score="2" ViewCount="875" Body="&lt;p&gt;I am implementing a non-coherent receiver for DBPSK.&#xA;I have a computer science background with little knowledge of DSP so my questions here may seem obvious.&#xA;The design of the receiver I am trying to implement is the following:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/D2P2Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Design of DPSK receiver&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what I am doing right now is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the tx side&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Differentially encoding my bit sequence&lt;/li&gt;&#xA;&lt;li&gt;BPSK modulating it&lt;/li&gt;&#xA;&lt;li&gt;Applying a high-pass filter&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;On the rx side&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Applying a band-pass filter around the carrier frequency&lt;/li&gt;&#xA;&lt;li&gt;Delaying (by one bit worth of data) and multiplying the data by itself&lt;/li&gt;&#xA;&lt;li&gt;Applying a low-pass filter&lt;/li&gt;&#xA;&lt;li&gt;Integrating over one bit worth of data (i.e. sum the sample values)&lt;/li&gt;&#xA;&lt;li&gt;Making the decision depending on the sign of my integral&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;By 'data' I mean samples at 44.1kHz.&#xA;When I simulate this on Octave, it works (i.e. I can detect the bit sequence even with high AWGN).&#xA;The problem is I am trying to move to an infinitely long data sequence (i.e. I do not know the exact moment where the tx began).&#xA;So here are my questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;How can I achieve time and frame synchronization ?&lt;/strong&gt; (I tried with a barker code but I am not sure I am getting it right)&#xA;This is the thing that's most confusing to me. My guess is you'd have to get time synced before the integration block, and frame synced after the decision block.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I express the bandwidth in function of carrier frequency f and bit rate ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Does the relation between bit rate and carrier frequency have any influence on the receiver ?&lt;/li&gt;&#xA;&lt;li&gt;What are the optimal values for the filters ? (number of taps)&lt;/li&gt;&#xA;&lt;li&gt;How do I calculate Eb/N0 for in my case ? (I want to compare my BER curve with others to see how good is my receiver)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3762" LastEditorUserId="13320" LastEditDate="2016-05-13T10:39:17.050" LastActivityDate="2016-05-13T10:39:17.050" Title="Non-coherent receiver for DBPSK: Implementation details" Tags="|modulation|bpsk|synchronization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7928" PostTypeId="2" ParentId="7927" CreationDate="2013-02-21T16:54:52.030" Score="2" Body="&lt;p&gt;1) A typical approach would be to have a frame alignment word (and by &quot;word&quot; I mean bit sequence) at the beginning of every frame.  You could time synchronize by looking for that FAW through cross-correlations.  Barker codes are a good choice because they have good autocorrelation properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with the approach is that the data, being random, can look like the FAW sometimes.  You can use the periodicity of the FAW to screen out those false positives.  For instance, if your frame is 1000 bits long, you would look for multiple hits spaced 1000 bits apart.  Once you have found them you have both time and frame synchronization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) There is not a direct relationship between carrier frequency and bandwidth.  There is a direct relationship between bit rate and bandwidth, but there are other factors involved.  The easiest way to determine your bandwidth is to take an FFT of your signal and measure it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Your question is unclear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) You haven't provided enough information, and &quot;optimal&quot; can mean a lot of different things.  If you want a good answer to this you should start a new thread with more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) It sounds like you are adding noise via AWGN, so you know what your SNR is.  With BPSK Eb/No is equal to the SNR.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-02-22T12:01:05.873" LastActivityDate="2013-02-22T12:01:05.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7929" PostTypeId="1" AcceptedAnswerId="7930" CreationDate="2013-02-21T17:53:33.910" Score="2" ViewCount="436" Body="&lt;p&gt;While studying about Wavelet Transform, I'm confused as why this is called a [1 -1] Filter , Here is what i'm talking about.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In this hypothetical example the student does fairly well the first&#xA;  half of the     term then neglects his or her studies for the last&#xA;  half. Thus the exam scores     for the term were 80%, 80%, 80%, 80%,&#xA;  0%, 0%, 0%, and 0%*     We can tell the average of all the scores&#xA;  (40%) and when the scores “tanked”     after the 4th exam just by&#xA;  looking. Knowing the answer in advance, however,     is a good way to&#xA;  learn and to verify the wavelet transforms. Then we     can use them&#xA;  with confidence on real-world data where we can’t simply     “eyeball”&#xA;  the final values.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;We will now walk through the CWT process step by step using the&#xA;  simplest     of the wavelet filters on this example. We begin by&#xA;  comparing the humble Haar wavelet filter, [1 –1], with the data as&#xA;  shown&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;80 80 80 80 0 0 0 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If We now keep subtracting each value from the next value we will eventually get,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0, 0, 0, 80, 0, 0, 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now If I want to stretch the Filter to three points i.e If the filter is stretched from [1 –1] to [1 0 –1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How will I calculate these points as I did in case of two point Filter where i simply subtract each value from the next value ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-02-21T18:05:06.440" Title="What is mean by [1 -1] Filter?" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7930" PostTypeId="2" ParentId="7929" CreationDate="2013-02-21T18:05:06.440" Score="3" Body="&lt;p&gt;I have the same book as you. :-) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The [1 -1] filter is a a simple differentiator, also known as, the Haar mother wavelet. You need to understand convolution to understand what he is saying. On the first level, you convolve your signal with [1 -1]. Then on the next level, you convole your signal with [1 0 -1], etc. That is all the &lt;a href=&quot;http://en.wikipedia.org/wiki/Continuous_wavelet_transform&quot; rel=&quot;nofollow&quot;&gt;CWT&lt;/a&gt; is doing. (Look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;convolution&lt;/a&gt; first). If you understand that well, you can understand CWT very easily. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-02-21T18:05:06.440" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7931" PostTypeId="1" CreationDate="2013-02-21T19:03:44.830" Score="0" ViewCount="60" Body="&lt;p&gt;I have a MxN image matrix in, and need to get out matrix out size MxN as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each point out[i,j] is the average of all in[i,j] inside a window size WxW (if boundary allows). For example if W=10&lt;/p&gt;&#xA;&#xA;&lt;p&gt;out[10,10] is average of in[5:15,5:15]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;out[1,1] is average of in[1:5,1:5]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be implemented as a correlation with ones(1:W,1:W)/W^2, but at the boundary the result is not correct. How should I apply the convolution? I tried pad zeros, reflect but it's not correct yet&lt;/p&gt;&#xA;" OwnerUserId="3802" LastActivityDate="2013-02-21T19:03:44.830" Title="Implement average as correlation" Tags="|convolution|correlation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7932" PostTypeId="2" ParentId="7915" CreationDate="2013-02-21T19:18:16.270" Score="2" Body="&lt;p&gt;It seems like you don't want to make any prior assumptions about the exact shape of the signal, other than assuming that it is ``smooth''. This is best attacked using a non-parametric function fitting/regression approach. Use either&#xA;a) spline fitting or b) kernel smoothing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two reasons why this is a good idea:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;These methods are optimal in the sense that no other non-parametric filtering technique (moving average, etc.) can give you a better worst case error decay rate. This answers your main question: &lt;em&gt;there is no better method if you care about minimax error.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Spline fitting and kernel regression codes are very easily available. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A quick Google search gives me the following:&#xA;In Octave interp1 has a 'cubic' option:&#xA;&lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/One_002ddimensional-Interpolation.html&quot; rel=&quot;nofollow&quot;&gt;http://www.gnu.org/software/octave/doc/interpreter/One_002ddimensional-Interpolation.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Open source code for kernel smoothing:&#xA;&lt;a href=&quot;http://code.google.com/p/pmtk3/source/browse/trunk/matlabTools/stats/kernelSmoothingRegression.m?r=2645&amp;amp;spec=svn2776&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/p/pmtk3/source/browse/trunk/matlabTools/stats/kernelSmoothingRegression.m?r=2645&amp;amp;spec=svn2776&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="1825" LastEditDate="2013-02-21T21:21:25.117" LastActivityDate="2013-02-21T21:21:25.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7933" PostTypeId="1" AcceptedAnswerId="7934" CreationDate="2013-02-21T19:37:06.597" Score="4" ViewCount="1619" Body="&lt;p&gt;The goal is to get a 200ms decaying delay of an audio signal while preserving the sharpness of attacks to mimick human perception of sound. &lt;a href=&quot;http://web.media.mit.edu/~tristan/phd/dissertation/chapter3.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The paper I'm following&lt;/a&gt; convolves a 200ms half-Hanning window with each frequency band to simulate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using numpy.hanning() since there's no half-Hanning and have tried either setting the first half of the hanning window to 0, the first half to 1, or chopping it off and only using the second half. I'm also normalizing the window to keep scales the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I don't really know, which one of these would be the &quot;correct&quot; half-Hanning?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The chopping off version, which seems the most likely to me, works but is offshifted 100 ms to the left. Should I just shift it 100ms to the right and call it good?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dataMasked = np.zeros(data.shape)&#xA;for i in xrange(freqs.size): # Loop through each frequency band&#xA;    winSize = round(0.4/(length/bins.size)) #Calc win size&#xA;    hann = np.hanning(winSize)&#xA;    halfPoint = np.argmax(hann)&#xA;    hann = hann[halfPoint:] #Chop at half&#xA;    hann = normHann(hann)&#xA;    dataMasked[i,:] = np.convolve(data[i,:],hann,mode='same')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the plot of what I'm getting (blue is raw loudness curve, while green is adjusted).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LBW1c.png&quot; alt=&quot;a Loudness Plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper I'm following shows this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GHf70.png&quot; alt=&quot;a Paper Loudness Plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3814" LastEditorUserId="35" LastEditDate="2013-02-21T20:16:41.250" LastActivityDate="2013-02-21T21:18:52.083" Title="Convolving With half-Hanning" Tags="|fft|audio|spectrogram|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7934" PostTypeId="2" ParentId="7933" CreationDate="2013-02-21T21:06:49.067" Score="2" Body="&lt;p&gt;Using the second half only (chopping) is the correct way. Note that setting the first half to zero is actually the same thing, up to a constant delay. The 100ms delay you observe might be due to the use of the &quot;same&quot; flag for the numpy convolution. It seems to me that the right truncation for this application would be to use &lt;code&gt;numpy.convolve(signal, window, 'full')[:len(signal)]&lt;/code&gt; - without the kind of centering that 'same' does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you have noticed, the peaks in the smoothed envelope function do not exactly coincide with the peaks in the original envelope and there is no magic trick to make them coincide (the delay will depend on the sharpness of the attack) - so the resulting curve is not ideal for very accurate beat detection and chopping.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-02-21T21:18:52.083" LastActivityDate="2013-02-21T21:18:52.083" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7935" PostTypeId="1" AcceptedAnswerId="7946" CreationDate="2013-02-22T00:09:20.687" Score="3" ViewCount="1124" Body="&lt;p&gt;I am attempting to implement a chirp z algorithm to handle random sized DFTs, and I can not seem to obtain any meaningful results. I have gone over several write ups and &quot;think&quot; I have a handle on what a chirp transform should do, but I wanted to ask here to double check and make sure my understanding of the process is sound. In pseudo code, here is the process I am applying.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;*function Chirpz(input x[n], discrete values such that n = 0, 1, ... N - 1)*&#xA;*// To keep numbers in perspective I will assume N = 5.*&#xA;&#xA;M = The minimum power of 2 which is greater than 2N - 1 // In our case of N=5 =&amp;gt; M=16.&#xA;&#xA;Pad x[n] with 0s so that it has a total length of M.&#xA;&#xA;// Create y[n] by performing the following:&#xA;&#xA;value = 1 - N&amp;lt;br&amp;gt;&#xA;for n = 0 to n = 2N - 1&amp;lt;br&amp;gt;&#xA;y[n] = e^i(PI / N * value * value)     // W^((k - n)^2 / 2)&#xA;value = value + 1&amp;lt;br&amp;gt;&#xA;next n&#xA;&#xA;Pad y[n] with 0s so that it has a total length of M.&#xA;&#xA;// Multiply x[n] by W^(-n^2 / 2):&#xA;&#xA;&#xA;for n = 0 to n = N&#xA;x[n] = x[n] * e^-i(PI / N * n * n)&#xA;&#xA;Perform FFT(x[n]) which has M elements using a radix-2 FFT algorithm&#xA;Perform FFT(y[n]) which has M elements using a radix-2 FFT algorithm&#xA;&#xA;// With the results of the FFTs now in x[n] and y[n], multiply each value:&#xA;for n = 0 to n = M&#xA;x[n] = x[n] * y[n]&#xA;&#xA;Perform IFFT(x[n]) which has M elements using radix-2 FFT algorithm&#xA;&#xA;// Multiply x[n] by W^(-k^2 / 2)&#xA;for n = 0 to n = M&#xA;x[n] = x[n] * e^-i(PI / N * n * n)&#xA;&#xA;// Now the first N elements in x[n] &quot;should&quot; have the result&#xA;X[k] = x[n] for n from 0 to N - 1&#xA;&#xA;return X[k]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But my results don't match anything near what is returned by fftw3 given the same input. In fact my results look to be garbage. As I am pretty new to this, I just want to make sure my understanding of the algorithm is sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3832" LastEditorUserId="29" LastEditDate="2013-02-22T03:26:08.363" LastActivityDate="2013-02-22T17:33:48.203" Title="Chirp z algorithm clarification" Tags="|fft|algorithms|dft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7936" PostTypeId="2" ParentId="7924" CreationDate="2013-02-22T00:22:51.633" Score="6" Body="&lt;p&gt;Unfortunately I don't have Matlab now but I'm thinking your problem has to do with linspace. Remember linspace gives the actual first and last values always. When you're doing the FFT binning I don't believe you want the boundaries to be pinned that way. I'd try using the colon operator instead and appropriate starting and delta values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;If you look at the definition of the DFT it is:&#xA;$$X(k)=\sum_{n=0}^{N−1}x(n)e^{j\frac{2πkn}{N}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows that the first DFT output at $k=0$ is at baseband. Every subsequent frequency is at an interval of $F_s/N$. So if you had 10 points the bin centers would be from $0...(\frac{N-1}{N}F_s=0.9F_s)$. For 1000 points it would span $0...0.999F_s$. Linspace, on the other hand always leaves the first and last points exact. You need the start and spacing exact, or to adjust the ending point with linspace.&lt;/p&gt;&#xA;" OwnerUserId="1678" LastEditorUserId="1678" LastEditDate="2013-02-22T15:03:23.183" LastActivityDate="2013-02-22T15:03:23.183" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7938" PostTypeId="2" ParentId="7909" CreationDate="2013-02-22T12:36:43.970" Score="6" Body="&lt;p&gt;The dimension of the frame's feature vector N depends on the frequency range and the number of frequency bins in the frame. For example for 16khz audio signal it's common to take 39 feature vectors created from 40 cepstrum values. For 8khz it's enough to have 20 cepstrum values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feature dimension is not equivalent to the frame length. Frame length could be rather arbitrary as long as you catch sound variation in time. Frame length is determined by how fast your speech signal changes. It's enough to have 10ms frame length, though 20ms and 5ms work almost equally well. If you have frame of 30ms you will have issues since some speech sounds change faster. Thrilled r for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Number of distinct HMM models (tied phone detectors for example) depends on the diversity of the speech signal, on the number of distinct sounds (temporal audio patterns) there. Each distinct sound ideally has to be better modelled with it's own HMM model. The number of states depends on the size of the training database and on the vocabulary of the database, not on the feature extraction parameters. The more words you want to recognize the more HMM models you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no direct relation between both feature vector size and length of the frame and the number of states in HMM models.&lt;/p&gt;&#xA;" OwnerUserId="3453" LastEditorUserId="3453" LastEditDate="2013-02-22T16:19:36.833" LastActivityDate="2013-02-22T16:19:36.833" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7939" PostTypeId="1" AcceptedAnswerId="7941" CreationDate="2013-02-22T14:47:01.667" Score="3" ViewCount="3450" Body="&lt;p&gt;I'm trying to understand Wavelet Transform , I've done well enough to understand Continuous Wavelet Transform which was easy enough, where we simply stretch the wavelet and match it with the original signal.&#xA;But i couldn't be able to understand the Discrete Wavelet transform in fact I've always had a trouble understanding Discrete of any transform (like DFT , DCT which are still not clear to me).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Wavelet transform we Stretch our signal and then match it with the original signal to find out the frequency.&#xA;This is the example shown in the book,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In this hypothetical example the student does fairly well the first&#xA;  half of the term then neglects his or her studies for the last half.&#xA;  Thus the exam scores for the term were 80%, 80%, 80%, 80%, 0%, 0%, 0%,&#xA;  and 0%* We can tell the average of all the scores (40%) and when the&#xA;  scores “tanked” after the 4th exam just by looking. Knowing the answer&#xA;  in advance, however, is a good way to learn and to verify the wavelet&#xA;  transforms. Then we can use them with confidence on real-world data&#xA;  where we can’t simply “eyeball” the final values.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;We will now walk through the CWT process step by step using the&#xA;  simplest of the wavelet filters on this example. We begin by comparing&#xA;  the humble Haar wavelet filter, [1 –1]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Signal -&gt; [80 80 80 80 0 0 0 0]&#xA;Filter(or signal that will be stretched later) -&gt; [1 -1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing the first 2 points with the wavelet filter we obtain 80 – 80 = 0. For&#xA;this very simple high-pass filter we can say there was no change in the first 2&#xA;exam scores.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how we've done it,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;80*1 + 80*(-1) =&gt; 80 - 80 = 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now We have,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0 80 80 80 0 0 0 0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shifting once to the right and applying filter again we get,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;80*1 + 80*(-1) =&gt; 80 - 80 = 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now We have,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0 0 80 80 0 0 0 0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shifting once again the right and applying filter again we get,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;80*1 + 80*(-1) =&gt; 80 - 80 = 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now We have,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0 0 0 80 0 0 0 0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shifting again,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;80*1 + 0*(-1) =&gt; 80 - 0 = 80&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now We have,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0 0 0 80 0 0 0 0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We will eventually end-up with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0, 0, 0, 80, 0, 0, 0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is significant in that this wavelet process of comparison and&#xA;shifting has just indicated a large change between the 4th and 5th exam. We&#xA;have “found the discontinuity”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This actually makes sense as we had a large change from 4th to 5th point But how does this discontinuity defines a frequency here ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if we stretch our signal from [1 -1] to [1 0 -1] and repeat the process,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We will eventually end-up with,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;= –80 –80 0 0 80 80 0 0 0 0 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we used filter [1 -1] , our output at least makes some sense it clearly shows a rapid change, but what happened here in case of 3 point filter ? what are these weird values (-80 -80) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we keep scaling to 10th times here is what we'll eventually get,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(scale = 10) –320 –160 0 160 320 320 240 160&#xA;(scale = 9)  –240 –80 80 240 320 240 160 80&#xA;(scale = 8)  –320 –160 0 160 320 240 160 80&#xA;(scale = 7)  –240 –80 80 240 240 160 80 0&#xA;(scale = 6)  –240 –160 0 160 240 160 80 0&#xA;(scale = 5)  –160 –80 80 160 160 80 0 0&#xA;(scale = 4)  –160 –80 0 80 160 80 0 0&#xA;(scale = 3)  –80 0 0 80 80 0 0 0&#xA;(scale = 2)  –80 0 0 0 80 0 0 0&#xA;(scale = 1)   0 0 0 0 0 0 0 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While studying the Continuous Wavelet Transform the scaling made sense but i could't understand the scaling here ? what are these points -80, -160, -240, -320 represents ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the final output,&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RHwx7.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;How can i relate this output from my original signal ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-08-14T20:32:12.913" Title="Understanding this Haar Wavelet Example" Tags="|wavelet|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7941" PostTypeId="2" ParentId="7939" CreationDate="2013-02-22T16:09:10.107" Score="5" Body="&lt;p&gt;It looks like there is a problem with your scaling.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scaling for the DWT has the same interpretation as it does for the CWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the DWT, the scale of the analyzing function (wavelet) is increased using a dyadic scale (increasing by factors of 2) in non-overlapping time intervals.  Increasing scale corresponds to narrower frequency distributions in the frequency domain.  Basically think of the analyzing function (wavelet) as a bandpass filter for which you are both narrowing the bandwidth and shifting down the center frequency by increasing the time scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example (see images below) I've transformed an audio signal using a CWT and then again using a DWT.  Notice that the results look similar, they scale in the same way, except in the DWT, the regions of analysis are discrete non-overlapping intervals (sharp boundaries).  Notice also that as the time scale increases (heading south on the CWT diagram), you have fewer DWT coefficients, so the number of blocks in the image decrease.  I don't see this kind of scaling in your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rm5Z7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-02-22T18:56:04.703" LastActivityDate="2013-02-22T18:56:04.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7943" PostTypeId="1" CreationDate="2013-02-22T16:50:28.183" Score="15" ViewCount="21248" Body="&lt;p&gt;Please tell me. Also I dont know why phase is linear with FIR filters. I would like quantitative analysis. And why linear phase is not achieved by IIR filters ?&lt;/p&gt;&#xA;" OwnerUserId="3835" LastEditorUserId="1650" LastEditDate="2013-02-23T22:51:16.047" LastActivityDate="2020-03-30T18:25:49.850" Title="could anybody explains me why IIR filters do not have linear phase?" Tags="|filters|linear-phase|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7945" PostTypeId="2" ParentId="7943" CreationDate="2013-02-22T17:11:28.327" Score="8" Body="&lt;p&gt;The impulse response of a linear phase filter must be symmetric.  If the impulse response is infinitely long, then the center of the impulse is an infinite distance away from the beginning, giving the symmetric IIR filter infinite delay.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-02-22T17:11:28.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7946" PostTypeId="2" ParentId="7935" CreationDate="2013-02-22T17:26:00.780" Score="2" Body="&lt;p&gt;Ok, after some head scratching and re-re-re-reading I realize what I was missing. When creating the chirp signal used in convolution, the values of (k - n) which result in a negative need to be wrapped around and placed at the end of the signal rather than in the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, replacing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create y[n] by performing the following:&#xA;&#xA;value = 1 - N&amp;lt;br&amp;gt;&#xA;for n = 0 to n = 2N - 1&amp;lt;br&amp;gt;&#xA;y[n] = e^i(PI / N * value * value)     // W^((k - n)^2 / 2)&#xA;value = value + 1&amp;lt;br&amp;gt;&#xA;next n&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create y[n] by performing the following:&#xA;&#xA;// Take care of values of k - n which are greater than zero.&#xA;for n = 0 to N - 1&#xA;y[n] = e^i(PI / N * n * n)&#xA;&#xA;// Add the zero padding.&#xA;for n = N to M - N&#xA;y[n] = 0&#xA;&#xA;// Now place the negative values at the end of the signal&#xA;for n = 1 - N to -1&#xA;y[M + n] = e^i(PI / N * n * n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yields the expected results.&lt;/p&gt;&#xA;" OwnerUserId="3832" LastEditorUserId="3832" LastEditDate="2013-02-22T17:33:48.203" LastActivityDate="2013-02-22T17:33:48.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7947" PostTypeId="1" CreationDate="2013-02-22T19:07:24.400" Score="0" ViewCount="1828" Body="&lt;p&gt;I'm using Welch's method (pwelch, in octave) to get the PSD of a recorded sound signal (i.e. pressure level vs. time). I then took the PSD data and took the sum of the amplitude in each octave band (1/3 octave). My question is: how can I convert the PSD data to a sound pressure level (per band, or per frequency if I do it before 1/3 octave sort/sum). For an overall SPL, I can take the pre-PSD estimation data and calculate via the equation Lp = 20 log10(Prms/Pref).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="3836" LastActivityDate="2013-02-22T19:07:24.400" Title="Getting sound pressure level (SPL) for a frequency band from Welch's derived PSD" Tags="|sound|octave|power-spectral-density|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7949" PostTypeId="2" ParentId="7866" CreationDate="2013-02-22T22:32:16.630" Score="8" Body="&lt;p&gt;It is not obvious what exactly OP Samuel wants to know, and so I am posting a generic answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x(t)$ denote a finite-energy continuous-time signal by which we mean that&#xA;$\displaystyle \int_{-\infty}^\infty |x(t)|^2\,\mathrm dt = \mathbb E_x &amp;lt; \infty$.&lt;br&gt;&#xA;It is important to understand that a finite-energy signal &lt;em&gt;cannot be a periodic signal&lt;/em&gt;, that &#xA;is, there is &lt;strong&gt;no nonzero real number&lt;/strong&gt; $T$ for which the following equation&#xA;can hold &lt;strong&gt;for all time instants&lt;/strong&gt; $t$:&#xA;$$x(t+T) = x(t)~~\text{for all}~ t, -\infty &amp;lt; t &amp;lt; \infty.$$&#xA;Of course, the above might hold for &lt;em&gt;some&lt;/em&gt;, possibly even&#xA;&lt;em&gt;many&lt;/em&gt;, values of $t$, &#xA;but it cannot hold for all $t$.  For example, if &#xA;$x(t) =\begin{cases}\sin(200\pi t), &amp;amp;-1 \leq t \leq +1,\\&#xA;0, &amp;amp;\text{otherwise,}&#xA;\end{cases}$ is a sinusoidal pulse of duration $2$ seconds&#xA;containing $200$ cycles&#xA;of a $100$ Hz sine wave, then &#xA;$x(t+0.01) = x(t)$ for all $t$ &lt;strong&gt;except&lt;/strong&gt; for $t \in (-1.01,1)$ and&#xA;$t \in(0.99,1)$.&#xA;On the other hand, we do not insist that $x(t)$ be of finite duration,&#xA;or that $x(t)$ be causal, etc. In these circumstances, $x(t)$ has&#xA;a &lt;em&gt;Fourier transform&lt;/em&gt; $X(f)$ given by&#xA;$$X(f) &#xA;= \int_{-\infty}^\infty x(t)\exp(-j2\pi ft)\,\mathrm dt,&#xA;~~ -\infty &amp;lt; f &amp;lt; \infty \tag{1}$$&#xA;where $j = \sqrt{-1}$,&#xA;and $x(t)$ can be recovered from its Fourier transform using the &lt;em&gt;inverse&lt;/em&gt;&#xA;Fourier transform which gives&#xA;$$x(t) &#xA;= \int_{-\infty}^\infty X(f)\exp(j2\pi ft)\,\mathrm df, &#xA;~~-\infty &amp;lt; t &amp;lt; \infty.\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;All this, of course, is old hat to most readers, so now let us&#xA;construct a &lt;em&gt;periodic&lt;/em&gt; signal from $x(t)$.  Let $T_0$ denote&#xA;some positive number, and define&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$s(t) = \sum_{n=-\infty}^\infty x(t - nT_0).\tag{3}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then, we claim that $s(t)$ is a signal of period $T_0$.&#xA;Note that for every choice of real number $t$, we have that&#xA;$$\begin{align}&#xA;s(t+T_0) &amp;amp;= \sum_{n=-\infty}^\infty x(t+T_0-nT_0)\\&#xA;&amp;amp;= \sum_{n=-\infty}^\infty x(t-(n-1)T_0) &amp;amp;\text{and now replace}~ n-1~\text{by}~m\\&#xA;&amp;amp;= \sum_{m=-\infty}^\infty x(t-mT_0)\\&#xA;&amp;amp;= s(t).&#xA;\end{align}$$&#xA;But, what does &lt;em&gt;one period&lt;/em&gt; of $s(t)$ look like? Well, for&#xA;$-T_0/2 \leq t \leq T_0/2$, $s(t)$ is &lt;em&gt;not&lt;/em&gt; the same as $x(t)$&#xA;except in the special case when the support of $x(t)$&#xA;is a subset of $[-T_0/2,T_0/2]$. Instead, one period (what OP&#xA;Samuel calls $s_{T_0}(t)$) can be found by slicing up&#xA;the graph of $x(t)$ into pieces of duration $T_0$ centered at&#xA;integer multiples of $T_0$, moving all the pieces to be centered&#xA;at $0$, and then adding them up.  This sum, one period of the&#xA;periodic signal that we have created, is now replicated at&#xA;intervals of $T_0$ seconds all along the time axis. Thus,&#xA;we have &lt;em&gt;another&lt;/em&gt; representation of $s(t)$, namely,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$s(t) = \sum_{n=-\infty}^\infty s_{T_0}(t - nT_0).&#xA;\tag{4}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let us at this point introduce Dirac deltas or impulses $\delta(t)$&#xA;which have the property that for any $g(t)$ that is continuous&#xA;at $t = a$,&#xA;$$\int_{-\infty}^\infty g(t)\delta(t-a)\,\mathrm dt &#xA;= \int_{-\infty}^\infty g(t)\delta(a-t)\,\mathrm dt = g(a).$$&#xA;Now, the &lt;em&gt;convolution&lt;/em&gt; of $g(t)$ and $h(t)$ is a signal $(g\star h)$&#xA;whose value $(g\star h)(\tau)$ at particular time instant $\tau$ is given by&#xA;$$(g\star h)(\tau) = \int_{-\infty}^\infty g(t)h(\tau-t)\,\mathrm dt$$&#xA;and so if $h_n(t) = \delta(t-nT_0)$, we have that&#xA;$$\begin{align}&#xA;(x\star h_n)(\tau) &amp;amp;= \int_{-\infty}^\infty x(t)h_n(\tau-t)\,\mathrm dt\\&#xA;&amp;amp;= \int_{-\infty}^\infty x(t)\delta(\tau-t-nT_0)\,\mathrm dt\\&#xA;&amp;amp;= \int_{-\infty}^\infty x(t)\delta((\tau-nT_0) - t)\,\mathrm dt\\&#xA;&amp;amp;= x(\tau - nT_0).&#xA;\end{align}$$&#xA;This gives us yet another representation of the &lt;em&gt;periodic&lt;/em&gt; signal $s(t)$,&#xA;namely,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$s(t)= x(t) \star \sum_{n=-\infty}^\infty \delta(t-nT_0) &#xA;= \sum_{n=-\infty}^\infty x(t-nT_0). \tag{5}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is worth reminding ourselves at this point that $s(t)$ is&#xA;a &lt;em&gt;continuous-time&lt;/em&gt; finite amplitude signal that, despite&#xA;what it looks like in the middle sum in $(5)$ &lt;strong&gt;does not&#xA;contain any impulses.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Returning to Fourier transforms (bet you thought I forgot about&#xA;them, didn't you?), we come up against the uncomfortable fact&#xA;that $s(t)$ does not have a Fourier transform in the usual&#xA;sense of the word because it is &lt;em&gt;not a finite-energy signal&lt;/em&gt;.&#xA;What it &lt;em&gt;does&lt;/em&gt; have is a Fourier series representation,&#xA;as pointed out by Fourier himself almost two hundred years ago.&#xA;We can incorporate Fourier series into Fourier transforms&#xA;if we use impulses in the frequency domain. So, what &lt;em&gt;is&lt;/em&gt;&#xA;the Fourier series for $s(t)$? We write&#xA;$$s(t) = \sum_{k=-\infty}^\infty c_k \exp(j2\pi kt/T_0), -\infty &amp;lt; t &amp;lt; \infty$$&#xA;where&#xA;$$\begin{align}&#xA;c_k &amp;amp;= \frac{1}{T_0}\int_{-T_0/2}^{T_0/2}s(t)\exp(-j2\pi kt/T_0)\,\mathrm dt\\&#xA;&amp;amp;= \frac{1}{T_0}\int_{-T_0/2}^{T_0/2}\sum_{n=-\infty}^\infty x(t-nT_0)&#xA;\exp(-j2\pi kt/T_0)\,\mathrm dt  &amp;amp;\text{using}~ (3)\\&#xA;&amp;amp;= \frac{1}{T_0}\sum_{n=-\infty}^\infty \int_{-T_0/2}^{T_0/2}x(t-nT_0)&#xA;\exp(-j2\pi kt/T_0)\,\mathrm dt &amp;amp;\text{now change variables}~ \tau = t-nT_0\\&#xA;&amp;amp;= \frac{1}{T_0}\sum_{n=-\infty}^\infty \int_{nT_0-T_0/2}^{nT_0+T_0/2}&#xA;x(\tau) \exp(-j2\pi k(\tau+nT_0)/T_0)\,\mathrm d\tau \\&#xA;&amp;amp;= \frac{1}{T_0}\sum_{n=-\infty}^\infty \int_{nT_0-T_0/2}^{nT_0+T_0/2}&#xA;x(\tau) \exp(-j2\pi k\tau/T_0)\,\mathrm d\tau&#xA;&amp;amp;\text{now combine the integrals into one}\\&#xA;&amp;amp;=\frac{1}{T_0}\int_{-\infty}^\infty x(\tau)\exp(-j2\pi k\tau/T_0)\,\mathrm d\tau\\&#xA;&amp;amp;= \frac{1}{T_0}X\left(\frac{k}{T_0}\right) &amp;amp;\text{using the definition}~ (2)&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have the Fourier series representation&#xA;$$s(t) &#xA;= \frac{1}{T_0}\sum_{k=-\infty}^{\infty}&#xA;X\left(\frac{k}{T_0}\right)\exp(j2\pi kt/T_0).\tag{6}$$&#xA;What should $S(f)$ be so that when it is plugged into the&#xA;inverse Fourier transform $(2)$ will give us&#xA;$$s(t) &#xA;= \int_{-\infty}^\infty S(f)\exp(j2\pi ft)\,\mathrm df&#xA;= \frac{1}{T_0}\sum_{k=-\infty}^{\infty}&#xA;X\left(\frac{k}{T_0}\right)\exp(j2\pi kt/T_0)??$$&#xA;The answer is readily worked out to be&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$\begin{align}&#xA;S(f) &amp;amp;= \frac{1}{T_0}\sum_{k=-\infty}^{\infty}&#xA;X(f) \delta\left(f-\frac{k}{T_0}\right)&#xA;= \frac{1}{T_0}\sum_{k=-\infty}^{\infty}&#xA;X\left(\frac{k}{T_0}\right) \delta\left(f-\frac{k}{T_0}\right)\\&#xA;&amp;amp;= f_0 \sum_{k=-\infty}^{\infty} X(kf_0)\delta(f-kf_0)&#xA;\end{align}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I will not say much about OP Samuel's &quot;other method&quot; since&#xA;it is comparing apples and oranges. The signal&#xA;$$x(t)\cdot \sum_{n=-\infty}^\infty \delta(t-nT_0)&#xA;= \sum_{n=-\infty}^\infty x(nT_0)\delta(t-nT_0)\tag{7}$$ is a&#xA;&lt;strong&gt;impulse train&lt;/strong&gt; in the time domain (one way of&#xA;representing a &lt;em&gt;sampled-data or discrete-time signal&lt;/em&gt; with sampling interval&#xA;$T_0$), and is &lt;strong&gt;very different&lt;/strong&gt;&#xA;from the signal&#xA;$$x(t) \star \sum_{n=-\infty}^\infty \delta(t-nT_0) &#xA;= \sum_{n=-\infty}^\infty x(t-nT_0)$$ in $(5)$ which is a &lt;strong&gt;continuous-time&#xA;signal containing no impulses.&lt;/strong&gt;&#xA;There is no reason for the two to have similar or identical Fourier transforms,&#xA;and the OP's Procrustean efforts to equate both is leading him &#xA;into a great deal&#xA;of confusion.&#xA;In fact, &lt;em&gt;duality&lt;/em&gt; suggests that, just as the Fourier transform of&#xA;a periodic signal is a set of equally-spaced impulses (of different&#xA;&lt;em&gt;amplitudes&lt;/em&gt;) in the frequency domain, the Fourier transform of&#xA;a set of equally-spaced impulses (of different amplitudes) in&#xA;the time domain is a &lt;em&gt;periodic&lt;/em&gt; function in the frequency domain.&#xA;For details, see  &lt;a href=&quot;https://dsp.stackexchange.com/a/7735/235&quot;&gt;this answer&lt;/a&gt;&#xA;to a different question in which the Fourier transform of $(7)$ has been&#xA;described in more depth than the hand-waving in the previous sentence.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-02-23T14:58:21.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7950" PostTypeId="1" CreationDate="2013-02-23T01:20:58.773" Score="2" ViewCount="228" Body="&lt;p&gt;Say A is symmetric positive definite matrix , which means one necessary condition is diagonal entries of A are positive. If I do cholesky factorisation using outer product form, Can there be any positbility that $\sqrt{A[i][i]}$ will result in negative square roots ?&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="6" LastEditDate="2013-10-27T03:56:03.960" LastActivityDate="2013-10-27T03:56:03.960" Title="Can Cholesky outer product version result in negative square roots?" Tags="|matrix|decomposition|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7951" PostTypeId="2" ParentId="7902" CreationDate="2013-02-23T08:20:07.930" Score="1" Body="&lt;p&gt;I think what you're attempting to do is a case of blind source separation (check Wikipedia). There are many techniques to solve this kind of problem, maybe you could check those on the Wikipedia and use the one that fits your needs best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Particularly, last year one of my teachers showed us a demo of the ICA algorithm, and we got to play round with it in MATLAB. It seemed really effective, and there's a research group that even created &lt;a href=&quot;http://www.cs.helsinki.fi/u/ahyvarin/whatisica.shtml&quot; rel=&quot;nofollow&quot;&gt;this MATLAB toolbox&lt;/a&gt; for the ICA algorithm. &lt;a href=&quot;http://research.ics.aalto.fi/ica/cocktail/cocktail_en.cgi&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; you can check a simple demo (called cocktail party problem) of how ICA works and how effective it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you say you're new to DSP, I'm not sure if ICA or the other techniques would be too advanced for you, but maybe this will put you in the right direction. Good luck.&lt;/p&gt;&#xA;" OwnerUserId="3865" LastActivityDate="2013-02-23T08:20:07.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7952" PostTypeId="2" ParentId="374" CreationDate="2013-02-23T11:23:43.240" Score="18" Body="&lt;p&gt;I trained a discriminative classifier on the pixels using derivative features (up to 2nd order) on different scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My labels:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jMcnq.jpg&quot; alt=&quot;Labeling&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prediction on training image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bgsqp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prediction on the other two images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/woggC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Orfl8.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this looks promising and could yield usable results given more training data and maybe smarter features. On the other hand it took me only a few minutes to get these results. You may reproduce the results yourself by using the open source software &lt;a href=&quot;http://ilastik.org&quot; rel=&quot;noreferrer&quot;&gt;ilastik&lt;/a&gt; . [Disclaimer: I'm one of the main developers.]&lt;/p&gt;&#xA;" OwnerUserId="3888" LastActivityDate="2013-02-23T11:23:43.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7955" PostTypeId="1" CreationDate="2013-02-23T15:05:12.290" Score="2" ViewCount="1862" Body="&lt;p&gt;I'm using the Web Audio API to make a graphic EQ with four BiQuad filters; a highpass, two bandpass and a low pass:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OEAbm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can see each node representing each filter's frequency. It's working nicely but I'd like to draw the shape of the filter's roll-off you'd usually find in other graphic EQ's.&lt;/p&gt;&#xA;&lt;p&gt;I have the Q-factor of each filter and the central frequency. What I would like to do is get a formula that allows me to get the frequency of the roll-off at a specific db value. For example what is the frequency of the roll-off at -200db?&lt;/p&gt;&#xA;&lt;p&gt;It's been a while since I've done any heavy mathematical stuff and so any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3809" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-02-23T17:07:46.587" Title="Calculating a filter's attenuation at a certain frequency from the Q-factor" Tags="|filters|frequency-spectrum|frequency|bandpass|bandwidth|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7956" PostTypeId="2" ParentId="7943" CreationDate="2013-02-23T15:38:30.867" Score="12" Body="&lt;p&gt;For digital filters, linear phase places the following requirement on the transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = H(z^{-1}).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That restriction implies a linear phase IIR filter would need to have poles both inside and outside the unit circle, making it unstable. Similar arguments apply for analog filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, there are any number of approximations which may be &quot;close enough&quot; to linear phase, depending on the application--especially if the causality of filter is sacrificed. For a review of techniques, see the introduction to this paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;S.R. Powell, P.M.Chau, &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=2202027&quot;&gt;A Technique for Realizing Linear-Phase IIR&#xA;  Filters&lt;/a&gt;, IEEE Trans. Signal Processing, Vol 39, No 11, Nov 1991, pp&#xA;  2425-2435.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The algorithm in that paper achieves linear phase with acausal block processing, rather than the usual offline &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Forward_Backward_Filtering.html&quot;&gt;&quot;Forward-Backward&quot;&lt;/a&gt; zero-phase approach.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-02-23T15:38:30.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7957" PostTypeId="2" ParentId="7884" CreationDate="2013-02-23T16:57:41.263" Score="1" Body="&lt;p&gt;In order to show that a counter is running at a specific frequency, you need to take two readings spaced at some known time period apart and then calculate how many ticks would occur in one second. Say that you take two measurements from a monotonically-increasing counter at times $t_1$ and $t_2$. Their difference is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Delta C = C_{t_2} - C_{t_1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can calculate the frequency of the counter from the difference as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f = \frac{\text{number of ticks}}{\text{time period}} = \frac{\Delta C}{\Delta t} = \frac{C_{t_2} - C_{t_1}}{t_2 - t_1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, if you divide both counter values $C_{t_1}$ and $C_{t_2}$ by a factor of 64 (for instance, by right-shifting by 6 bits), then the above equation becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f = \frac{1}{64}\frac{C_{t_2} - C_{t_1}}{t_2 - t_1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the action of dividing the counter's output value by 64 has the likewise action of dividing its output frequency by the same factor.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-02-23T16:57:41.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7958" PostTypeId="1" AcceptedAnswerId="7962" CreationDate="2013-02-23T17:57:38.047" Score="4" ViewCount="4303" Body="&lt;p&gt;I understand how to find the output from the input with an impulse response, but how can I go about finding the input if given the other two?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have $y[n] = [-1, -1, 11, -3, 30, 28, 48]$ and $h[n] = [-1, 2, 3, 4]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I go about finding $x[n]$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know very little about signal processing, so if you don't mind giving an easy explanation, then I appreciate it. Or, if it's possible to do an example, that's better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I think that if I know $y[n]$ I can guess what $x[n]$ would be by multiplying and summing the results, but I'm not sure how to figure out the length of $x[n]$.&lt;/p&gt;&#xA;" OwnerUserId="3929" LastEditorUserId="128" LastEditDate="2019-11-28T06:41:33.840" LastActivityDate="2019-11-28T06:41:33.840" Title="How to Estimate the Input for a Convolution Given the Filter (Impulse Response) and the Output of the Convolution" Tags="|convolution|deconvolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7960" PostTypeId="1" AcceptedAnswerId="7964" CreationDate="2013-02-23T19:42:32.977" Score="5" ViewCount="332" Body="&lt;p&gt;I'm working with a collection of old photographs. They were scanned on brown paper in various configurations. Some scans have a single photo, others have three or four. Some of the photos are mounted on white cards, others are not:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/V7cuM.jpg&quot; alt=&quot;One photo with a white card&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/IaUZb.jpg&quot; alt=&quot;One larger photo without a white card&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fAVkh.jpg&quot; alt=&quot;Three photos with white cards&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I developed an algorithm to find the individual photographs on each scan, which is described &lt;a href=&quot;http://www.danvk.org/wp/2013-02-09/finding-pictures-in-pictures/&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. The gist is to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the median color (independently for each RGB channel, 0-255)&lt;/li&gt;&#xA;&lt;li&gt;Blur the image.&lt;/li&gt;&#xA;&lt;li&gt;Binarize according to whether each pixel's RGB values have an RMSE of &amp;lt;20 from the median.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This leaves a mostly-black image with a few large white rectangles on it, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lYhbD.png&quot; alt=&quot;Black rectangle containing two white rectangles&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the rectangle coordinates, I use the following procedure:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Pick a random white pixel, (x, y) (statistically, this is likely to be in a photo)&lt;/li&gt;&#xA;&lt;li&gt;Call this a 1×1 rectangle.&lt;/li&gt;&#xA;&lt;li&gt;Extend the rectangle out in all directions, so long as you keep adding new white pixels.&lt;/li&gt;&#xA;&lt;li&gt;If this rectangle is larger than 100×100, record it as a photo. (The originals are much larger than the photos I've uploaded for this question.)&lt;/li&gt;&#xA;&lt;li&gt;Color the rectangle black.&lt;/li&gt;&#xA;&lt;li&gt;If &amp;lt;90% of the image is black, go back to step 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This has worked on most (90+%) of the scans that I've tested it on, but it is quite ad-hoc, particularly the RMSE 20 threshold in the first portion and the entire procedure to find the rectangle coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more principled way to find these photo rectangles? How would someone with experience in image processing solve this problem?&lt;/p&gt;&#xA;" OwnerUserId="3934" LastActivityDate="2013-02-24T19:19:13.790" Title="Detecting Individual Photos on a Scanned Page" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7961" PostTypeId="2" ParentId="7958" CreationDate="2013-02-23T19:47:48.373" Score="1" Body="&lt;p&gt;Mathematically, here is the demostration for what you want to do:&#xA;y[n] = x[n]*h[n] (This is a convolution),&#xA;Applying convolution theorem you can prove that:&#xA;Y[f] = X[f]*H[f] (this is an ordinary product),&#xA;Then:&#xA;&lt;strong&gt;X[f] = Y[f]/H[f]&lt;/strong&gt;,&#xA;Now if we apply fourier inverse transform to X[f] you can have x[n].&#xA;Implementing this in matlab can be pretty straightforward now.&#xA;Cheers&lt;/p&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2013-02-23T19:47:48.373" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7962" PostTypeId="2" ParentId="7958" CreationDate="2013-02-23T20:15:40.690" Score="1" Body="&lt;p&gt;&lt;strong&gt;This answer was given in response to the ORIGINAL version of the question in which &#xA;$y[n]$ and $h[n]$ were vastly different sequences. Click on the &lt;code&gt;edited n hours ago&lt;/code&gt;&#xA;link that appears below the question to view the original version of the question.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define &lt;em&gt;polynomials&lt;/em&gt; &#xA;$$\begin{align}&#xA;y(\alpha) &amp;amp;= -\alpha^6+11\alpha^5 +2\alpha^4+\cdots + 4\alpha+3,\\&#xA;h(\alpha) &amp;amp;= -\alpha^3+2\alpha^2+\alpha+3.&#xA;\end{align}$$&#xA;&lt;em&gt;Divide&lt;/em&gt; $y(\alpha)$ by $h(\alpha)$. Assuming $h(\alpha)$ divides&#xA;$y(\alpha)$ evenly, meaning that the remainder is $0$,&#xA;the quotient tells you the input sequence $x[n]$. If the remainder is&#xA;&lt;em&gt;not&lt;/em&gt; $0$, whoever told you that the output is $y[n]$ is mistaken.&#xA;I have a sneaking suspicion that the latter is likely to be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some people will insist that you replace $\alpha$ by $z$ in the above&#xA;formulas, and then divide $z^{-6}y(z)$ &#xA;by $z^{-3}h(z)$, but you will arrive at the same end result if you follow their&#xA;method.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-02-24T15:02:31.880" LastActivityDate="2013-02-24T15:02:31.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7963" PostTypeId="1" AcceptedAnswerId="7965" CreationDate="2013-02-23T21:22:18.270" Score="7" ViewCount="1932" Body="&lt;p&gt;Can the walsh hadamard transform be calculated for odd image block sizes such as 5x5 or 7x7? Most of the examples I've seen are for 4x4 and 8x8?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I fear it probably can't from the description I read on Wikipedia ( though I'm still trying to fully digest that page).&lt;/p&gt;&#xA;" OwnerUserId="300" LastEditorUserId="300" LastEditDate="2013-02-24T00:32:22.923" LastActivityDate="2013-02-24T03:40:11.987" Title="Can the Walsh Hadamard transform be computed for non power of 2 sizes?" Tags="|image-processing|filters|dct|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7964" PostTypeId="2" ParentId="7960" CreationDate="2013-02-23T22:18:54.030" Score="1" Body="&lt;p&gt;Most of the image processing/computer vision algorithms are ad hoc. Your algorithm is good. However, I think that a few points can be improved:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Instead of finding median color, you could do use the geometry of your images, which is more robust. For example, you know that the background part (The one that touches the boundaries is black, and the one inside it has the color you are looking for.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In order to find the rectangle coordinates, you should use a blob analysis procedure. In Matlab it is done by using &lt;code&gt;regionprops&lt;/code&gt; command. It will give you properties like &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;area of blob (To remove the small ones)&lt;/li&gt;&#xA;&lt;li&gt;solidity (Can be used to separate the rectangles from non-rectangles)&lt;/li&gt;&#xA;&lt;li&gt;coordinates of pixels&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Also, you could try to use morphological pre-processing like &lt;code&gt;opening&lt;/code&gt;, to remove small blobs.&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2013-02-23T22:18:54.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7965" PostTypeId="2" ParentId="7963" CreationDate="2013-02-24T03:40:11.987" Score="11" Body="&lt;p&gt;The Walsh-Hadamard transform requires a Hadamard matrix -- which has entries $\pm 1$ and&#xA;whose rows are orthogonal vectors.  A $n \times n$ Hadamard matrix is known to exist&#xA;for $n = 2$. Larger Hadamard matrices can exist only if $n$ is a multiple of $4$, though&#xA;it is not known if there is a Hadamard matrix for &lt;em&gt;every&lt;/em&gt; multiple of $4$. However,&#xA;there is a &lt;em&gt;recursive&lt;/em&gt; construction that can be used to construct a $2^m \times 2^m$&#xA;Hadamard matrix from a $2^{m-1}\times 2^{m-1}$ Hadamard matrix, and this structure &#xA;allows for the use of the &lt;em&gt;Fast Hadamard Transform&lt;/em&gt; algorithm, which reduces the&#xA;computational cost from $2^{2m}$ additions and subtractions to $m2^m$ additions and&#xA;subtractions (just like the $N$-FFT reduces the number of multiplications from&#xA;$O(N^2)$ to $O(N\log N)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this as background, the answer is Yes, you can use a Walsh-Hadamard transform&#xA;of length $N$ if you can find a $N\times N$ Hadamard matrix, but your choices&#xA;for $N$ are necessarily restricted. Also, &lt;em&gt;fast&lt;/em&gt; algorithms may not exist&#xA;for your choice of $N$, though &lt;em&gt;some&lt;/em&gt; speed-up is usually possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that Walsh-Hadamard transforms (WHTs) do &lt;em&gt;not&lt;/em&gt; support cyclic convolutions, but&#xA;they do support what is sometimes called Poisson convolution. If $H$ denotes &#xA;a $2^m\times 2^m$&#xA;Hadamard matrix and $\mathbf x$ and $\mathbf y$ are vectors of length $2^m$ with \WHTs $\mathbf xH$ and $\mathbf yH$,&#xA;then the &lt;em&gt;inverse WHT&lt;/em&gt; of the &lt;em&gt;term-by-term&lt;/em&gt; multiplication of the entries&#xA;in $\mathbf xH$ and $\mathbf yH$ can be described as follows.  Suppose that the entries in&#xA;$\mathbf x$ and $\mathbf y$ etc are indexed not by integers $0$ through $2^m-1$ but rather&#xA;by the $m$-bit representations of these numbers.  Thus, we talk not of&#xA;$x[k]$ as the $k$-th entry in $\mathbf x$ but rather of $x[\mathbf k]$ where&#xA;$\mathbf k$ is the $m$-bit representation of $k$.  Then, the iWHT of the term-by-term&#xA;product of the entries in $\mathbf xH$ and $\mathbf yH$ has $\mathbf k$-th entry&#xA;$$\sum_{\mathbf i} x[\mathbf i]y[\mathbf k\oplus \mathbf i]$$&#xA;which is eerily reminiscent of&#xA;$$\sum_i x[i]y[k-i]$$&#xA;and even more so if one notes that modulo two, addition and subtraction&#xA;are the same and so that $\mathbf k\oplus \mathbf i$ could as well&#xA;have been written as $\mathbf k\ominus \mathbf i$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-02-24T03:40:11.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7966" PostTypeId="1" CreationDate="2013-02-24T12:00:55.947" Score="1" ViewCount="259" Body="&lt;p&gt;I am currently doing a research project into the effectiveness of different keypoint detector and feature descriptor combinations for the task of vehicle detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I am using a SVM for simple binary classification of vehicles testing both the bag-of-features model and pyramid match kernels for mapping the set of vectors detected to a single feature space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only have a limited dataset of around 5 minutes of video captured from a UAV, of which I have manually extracted the vehicle images and rotated them so that the cars direction is horizontal. Currently I am evaluating the performance of the different detector and descriptor combos using the F-measure (F1 score). However with the aim to find a combo that are invariant to image transformations, scale, rotation, illumination/lighting variations, colour and slight affine transformations as to generalize well and be sufficiently unique to maximise the accuracy of classification, should I also be evaluating the F-measure in different conditions such as scale changes, rotation, perspective rotation, camera yaw, motion blur, and varying static and dynamic lighting conditions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However with a limited dataset I am finding it difficult to to understand how I should go about this. For example would it be appropriate to rotate my test set by varying degrees and then use the evaluated f-measures to compare the feature detector/descriptor combos accuracy under different rotation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any recommendations of how I should approach the evaluation/comparison of the keypoint detector and feature descriptors under these situations would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3217" LastEditorUserId="128" LastEditDate="2023-07-08T11:48:07.770" LastActivityDate="2023-07-08T11:48:07.770" Title="Evaluation of Keypoint Detector and Feature Descriptor Combos for Vehicle Detection" Tags="|image-processing|computer-vision|classification|object-recognition|feature-extraction|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7968" PostTypeId="1" CreationDate="2013-02-24T14:54:38.857" Score="1" ViewCount="107" Body="&lt;p&gt;Is there any Application, Programming Library or Theory that could be used to identify human language phrases in a set of audio files, so as to calculate the frequency of occurrence of each such phrase. For example, how often does the phrase &quot;Thank You&quot; occur in these files? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One solution might be to convert the audio to an International Phonetic Alphabet form but I cant find such a tool. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm basically trying to find patterns in speech and the frequency at which they occur. Of course the pattern for &quot;Thank You&quot; is slightly different in different dialects, but I've no problem in having different matches in such cases.&lt;/p&gt;&#xA;" OwnerUserId="1142" LastActivityDate="2013-02-26T12:48:13.397" Title="Establishing Phrase Frequency in Audio Files" Tags="|audio|speech-recognition|speech|voice|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7969" PostTypeId="2" ParentId="7728" CreationDate="2013-02-24T17:06:34.507" Score="3" Body="&lt;p&gt;Intel's &lt;a href=&quot;http://software.intel.com/en-us/intel-ipp&quot; rel=&quot;nofollow&quot;&gt;Integrated Performance Primitives&lt;/a&gt; (IPP) C++ library has both signal processing and image processing components.&lt;/p&gt;&#xA;" OwnerUserId="3980" LastActivityDate="2013-02-24T17:06:34.507" CommentCount="0" CommunityOwnedDate="2013-02-24T17:06:34.507" ContentLicense="CC BY-SA 3.0" />
  <row Id="7970" PostTypeId="1" CreationDate="2013-02-24T18:12:33.270" Score="4" ViewCount="1761" Body="&lt;p&gt;For the past month I've been chasing the DFT/FFT rabbit.&#xA;Along the way I've been cut-n-pasting the name of other rabbits to chase later:&#xA;Autocorrelation, Phase Vocoder, Parabolic Approximation, Wavelet Transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my problem.&#xA;When using an FFT, the lower frequencies are always going to be missing.&#xA;I actually found the same problem described here:&#xA;&lt;a href=&quot;http://music.columbia.edu/cmc/musicandcomputers/chapter3/03_05.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Problems with the FFT/IFFT&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frankly it is worse than that. The energy of these frequencies are not missing at all.&#xA;They are dissolved into the first several bins, making these bins semi-useless for interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, I simply want a general approximation of the Low Frequencies, including amplitude and phase. In FFT terms, I want bin #0.05, 0.10, 0.15, 0.20, 0.25 ...up to say around bin 3.50. Realistically, I understand that anything to small, say 0.05, would almost amount to Linear Regression. But in my mind, 0.5 or 0.75 should be doable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I even toyed with changing k to a double (which was 'cough' &quot;interesting&quot;):&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/7535/best-window-for-close-frequency-components&quot;&gt;best window for close frequency components&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;When Moses came down from the mountain, he did not carry tablets of stone on which it was commanded that in the equation: F = k*(df) = k*sample_rate/N, that k has to be an integer.&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Anyway, I've decided it is time to try something else.&#xA;So, what rabbit should I chase next?&#xA;(even if it is close approximation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: recommending a bigger sample is not the answer - I'm already sampling my available limit.&#xA;&lt;hr&gt;&#xA;Edited to add pics (hoping for a possible new answer):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Test Case (I want a Blue approximation, even if lousy):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xdUMB.gif&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rectangle (of course, lousy Green and so-so Red):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/KEHJ2.gif&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gaussian 3.0 (only Red can be Interpolated, but decent):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0Ys1h.gif&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Smaller Gaussian gives a lousy Green Interpolation and decent Red.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;Edited to answer general questions (I'm sorry I did not do this to begin with):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the mathematical description of the data in the plot?&#xA;I'm guessing Sum of Sinusoids (with noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the sample rate?&#xA;All of my samples are at different rates, as in, each entire file size is used.&#xA;Rather than Hertz/periods/cycles, the measurements are in deserialized data units.&#xA;Most often I work with 8-byte doubles, but sometimes 4-byte integers.&#xA;Therefore, with doubles, you can say that my Fs = fileBytes/8&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many samples can you capture?&#xA;One each per file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the application?&#xA;I have no clue - it's for a client.&lt;/p&gt;&#xA;" OwnerDisplayName="user3981" LastEditorUserId="-1" LastEditorDisplayName="user3981" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-03-06T16:20:49.500" Title="Estimating Low Frequencies (including amplitude and phase)" Tags="|fft|frequency|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="7971" PostTypeId="2" ParentId="7960" CreationDate="2013-02-24T19:19:13.790" Score="0" Body="&lt;p&gt;I have approached a similar problem using &lt;strong&gt;line Hough transform&lt;/strong&gt;. The a rectangle can be found by searching four local maxima separated by 90°.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once a rectangle is computed from line intersections, it can be further tested by comparing color/texture at the corners (within image and outside the image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The detection can be more restrictive if you know aspect ratio of the photos, background color or other information beforehand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally a rule removing intersecting rectangles or rectangles within rectangles is convenient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering prior to detection as you did enhances the repeatability. Try looking for a segmentation method that will separate foreground and background. I can think of Watershed transform that would work if the background is not too noisy.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-02-24T19:19:13.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7973" PostTypeId="2" ParentId="7970" CreationDate="2013-02-24T20:08:24.900" Score="1" Body="&lt;p&gt;If you only want low frequencies, you can decimate (downsample) your input first and then run the same FFT.  Lets say you have an input signal at 8kHz FS, but you are only interested in 100Hz and below.  With a 512 point FFT you only get 15.625Hz per bin @ 8kHz FS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can decimate (downsample) that 8kHz to 200Hz FS and then run the SAME FFT.  You essentially throw away /LPF everything &gt;= 100Hz.  Now, each bin contains 200Hz / 512 or 0.390625Hz per bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are essentially running a much longer FFT.  There is extra processing, though, for the downsample, but no extra memory required for the FFT, which is probably where you run into the &quot;max length&quot; wall, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Found a link to a relevant answer:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/577/downsampling-lowpass-filter-for-audio-fir-or-iir&quot;&gt;Downsampling lowpass filter for audio: FIR or IIR?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3985" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2013-02-24T20:17:27.990" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="7974" PostTypeId="1" CreationDate="2013-02-25T00:34:28.017" Score="3" ViewCount="5827" Body="&lt;p&gt;In my text book, Digital Signal Processing, Principles, Algorithms, and Applications by John Proakis, it asks the question to show how &lt;span class=&quot;math-container&quot;&gt;$$\delta(n) = u(n) - u(n-1).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can understand how this is true if &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is an integer, but sometimes I see the step function as a continuous line instead of a fixed point at an instant. In that case, is it incorrect to think of &lt;span class=&quot;math-container&quot;&gt;$u(n)$&lt;/span&gt; as something continuous?&lt;/p&gt;&#xA;" OwnerUserId="3929" LastEditorUserId="80" LastEditDate="2021-10-27T23:10:55.227" LastActivityDate="2021-10-27T23:10:55.227" Title="Is $\delta(n) = u(n) - u(n-1)$?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="7975" PostTypeId="1" CreationDate="2013-02-25T01:24:09.413" Score="11" ViewCount="10641" Body="&lt;p&gt;If you put a wave packet through the passband of a 1st-order low-pass filter, it will be delayed by the group delay of the filter, and remain the same amplitude, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you put the same wave packet through a complementary 1st-order highpass filter with the same cutoff frequency, the group delay curve is the same, so the delay of the packet will be the same, but the gain is much lower, so it will be both delayed and attenuated to negligibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the output of the highpass filter is very small, if you sum the outputs of these two filters (as in an audio crossover), I would expect it to be negligibly different from the output of the lowpass filter:  Large delayed signal + very small delayed signal = large delayed signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet if you sum the filter responses, the amplitude is 0 dB everywhere, and the phase is 0 everywhere, and therefore the group delay becomes 0, which would mean that the wave packet comes out with no delay and no changes.  I don't understand how this can be possible.  Don't filters always incur delay?  How can a filter (which also has positive group delay) undo the delay caused by the other channel, especially when this is happening in the stopband?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which part am I misunderstanding here?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The best-known crossover types with linear phase are first-order non-inverted crossovers, ... The first-order crossover is minimum phase when its outputs are summed&#xA;  normally; it has a flat phase plot at 0°. - &lt;a href=&quot;http://www.amnet.net.au/~amunday/random/DouglasSelf.pdf&quot; rel=&quot;noreferrer&quot;&gt;The Design of&#xA;  Active Crossovers&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Here the result of summing the outputs together produces 0° phase&#xA;  shift, which is to say that the summed amplitude and phase shift of a&#xA;  1st-order crossover is equivalent to a piece of wire. - &lt;a href=&quot;http://www.rane.com/note160.html&quot; rel=&quot;noreferrer&quot;&gt;Linkwitz-Riley Crossovers: A Primer: 1st-Order Crossover Networks&lt;/a&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/d4oF2.png&quot; alt=&quot;First-order crossover frequency response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Testing on actual pulses shows how the lowpass (blue) delays the pulse, as expected, and how the highpass (green) can combine with it to produce the original (red) pulse, but how is the highpass pulse occurring &lt;em&gt;before&lt;/em&gt; the original if the highpass filter is causal and has positive group delay?  Intuition is failing me.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5r2LL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It &lt;em&gt;does&lt;/em&gt; show that the highpass output is not as negligible as I imagined, and the delay is more negligible than I imagined, and as you move the carrier frequency around, these two properties change in a proportional way (smaller delay requires lower amplitude highpass output to correct it).  But I still don't really understand it.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-02-26T00:55:32.397" LastActivityDate="2019-10-26T12:40:23.490" Title="How can a filter have zero group delay?" Tags="|filters|phase|group-delay|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7979" PostTypeId="1" AcceptedAnswerId="7984" CreationDate="2013-02-25T05:12:54.937" Score="3" ViewCount="893" Body="&lt;p&gt;I'd like to understand how to calculate the cyclic convolution as well as understand what that means exactly. How should I go about finding the output for various periods for a system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(n) = &#xA;\begin{cases}&#xA;n &amp;amp; \textrm{for} \quad 1 \leq n \leq 3\\ 0 &amp;amp;\textrm{otherwise}\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(n) = &#xA;\begin{cases}&#xA;n &amp;amp; \textrm{for} \quad 1 \leq n \leq 2\\ 0 &amp;amp; \textrm{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I perform the convolution, then I get the following values for $y(n)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(2) = 1;\quad y(3) = 4;\quad y(4) = 7;\quad y(5) = 6$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if I want a period = 3, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n) = x(n+3k) \quad\textrm{and}\quad h(n) = h(n+3k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, I'm unsure of what to do to get values that correspond to a period.&lt;/p&gt;&#xA;" OwnerUserId="3929" LastEditorUserId="1629" LastEditDate="2016-07-27T16:40:06.013" LastActivityDate="2016-07-27T16:40:06.013" Title="How can I calculate the cyclic (periodic) convolution?" Tags="|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7980" PostTypeId="1" CreationDate="2013-02-25T07:16:39.420" Score="3" ViewCount="1957" Body="&lt;p&gt;I have to simulate facial expressions on a face image ( say open mouth ). For this I first extracted the facial feature points and found the corners of the lips. Now I need to deform the image by moving the points down. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ciyrm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above image I need to move the points ( 2 ) and ( 3 ) to some distance left and right respectively. And point ( 18 ) and ( 19 ) littele bit down. So that I will get an expression like opened mouth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is this the above way right to proceed to simulate facial expression?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) If it is right how to move the points and create a new image in opencv?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2013-05-29T02:05:16.373" Title="How to relocate face points in opencv / face distortion?" Tags="|image-processing|computer-vision|opencv|3d|face-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7981" PostTypeId="1" CreationDate="2013-02-25T08:25:45.700" Score="0" ViewCount="342" Body="&lt;p&gt;My question is regarding the memory of a filter when we want to implement it on a real time dsp environment. We have certain memories like scratch memory , intermediate memory and internal memory. Does anyone knows how to we implement a filter in real time environment keeping in mind the memory considerations because memory is an important issue when it comes to real time signal processing. I want to implement a low pass filter using the above conditions.&lt;/p&gt;&#xA;" OwnerUserId="3993" LastActivityDate="2013-04-26T16:06:52.750" Title="Memory of a filter used on real time digital signal processing" Tags="|lowpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7982" PostTypeId="2" ParentId="7796" CreationDate="2013-02-25T10:21:17.117" Score="2" Body="&lt;p&gt;You could take a look at recent publications by Segvic et al, I know they have been working on the problems of traffic sign detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea was to use the Viola-Jones framework for object detection, which was later improved by adding some temporal and spatial constraints. If I remember correctly, they achieved a nearly 100% recall rate with just 2 false positives on 10000 frames (I might be wrong with the numbers, but they are something like that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best is to refer to the papers directly (sorted by year):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/pubs/segvic10itsc.pdf&quot; rel=&quot;nofollow&quot;&gt;Sinisa Segvic, Karla Brkic, Zoran Kalafatic, Vladimir Stanisavljevic, Marko Sevrovic, Damir Budimir and Ivan Dadic. A computer vision assisted geoinformation inventory for traffic infrastructure. ITSC, Madeira, Portugal, September 2010: 66-73&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/pubs/segvic12mva.pdf&quot; rel=&quot;nofollow&quot;&gt;Sinisa Segvic, Karla Brkic, Zoran Kalafatic, Axel Pinz. Exploiting temporal and spatial constraints in traffic sign detection from a moving vehicle. Machine Vision and Applications (accepted for publication)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/pubs/segvic12syroco.pdf&quot; rel=&quot;nofollow&quot;&gt;Sinisa Segvic, Zoran Kalafatic, Ivan Kovacek. Sliding Window Object Detection without Spatial Clustering of Raw Detection Responses. IFAC SYROCO 2012&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case I forgot to link something relevant, see the other publications &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/pubs_en.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3298" LastActivityDate="2013-02-25T10:21:17.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7984" PostTypeId="2" ParentId="7979" CreationDate="2013-02-25T13:14:50.650" Score="2" Body="&lt;p&gt;People generally define the cyclic convolution of &lt;em&gt;periodic&lt;/em&gt; sequences&#xA;$x$ and $h$ of period $N$ as&#xA;$$y[n] = \sum_{m=0}^{N-1}x[m]h[n-m], n = 0, 1, \ldots, N-1.\tag{1}$$&#xA;Note that the above expression consists of $N$ different sums that&#xA;you have to compute, and if while computing any particular sum,&#xA;the value of $n-m$ is not in the range of numbers for which you&#xA;are given $h[\cdot]$, then you use the periodicity ($h[n-m] = h[n-m+N]$&#xA;or $h[n-m] = h[n-m-N]$) to get the argument into the range for which &#xA;you know the value of $h[\cdot]$. &#xA;Also, note that $(1)$ holds for &lt;em&gt;all&lt;/em&gt; integers $n$, but we don't&#xA;need to &lt;em&gt;calculate&lt;/em&gt; more than $N$ sums like $(1)$ because&#xA;$y[n]$ is &lt;em&gt;also&lt;/em&gt; a periodic sequence of period $N$ and so we have&#xA;for any integer&#xA;$M$ that  $y[M] = y[M \bmod N]$ where, of course, $0 \leq M \bmod N \leq N-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exercise: &lt;strong&gt;write out&lt;/strong&gt; the above formula &lt;strong&gt;explicitly&lt;/strong&gt;, meaning&#xA;no summations, for $n = 0, 1, 2$ and proceed from there.  Go on;&#xA;you can do it. There are only three sums of three terms each.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-02-25T15:29:53.597" LastActivityDate="2013-02-25T15:29:53.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7985" PostTypeId="2" ParentId="7981" CreationDate="2013-02-25T13:19:48.887" Score="0" Body="&lt;p&gt;Not really sure what you mean...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scratch memory is probably temporary memory that is only used during one call to the filter (like the result of the MAC operations in an FIR).  This should be internal since it is used so often.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intermediate(?) memory - could this be state variables like the input signal history as in an FIR?  If so, also internal, because the FIR does convolution with this array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Internal memory is internal memory.  This should be internal because it is called internal.  You are probably referring to the coefficients of a filter since these don't change, but I have no idea from your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing you should have externally might be your input signal - each new sample gets copied into your history array for multiplication with the coefficients of the filter.  1 copy from external memory per filter pass isn't too expensive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things get much more complicated when you have SIMD, multiple memory banks, etc., but you didn't mention any of that in your question.&lt;/p&gt;&#xA;" OwnerUserId="3985" LastActivityDate="2013-02-25T13:19:48.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7986" PostTypeId="2" ParentId="7975" CreationDate="2013-02-25T13:46:14.963" Score="6" Body="&lt;p&gt;There are a couple of interesting aspects of &quot;reconstruction to unity&quot;. First, there are two ways of combining two filters: parallel and in series. For a parallel topology it is ALWAYS possible to find a complimentary filter so that the pairs add to unity. It's easy enough, actually. Simply do $\tilde{H}(\omega) = 1-H(\omega)$. In the time domain that means that the impulse response of the complimentary filter is simply the negative of the original impulse response with 1 added to the first sample. So all the &quot;ringy&quot; stuff cancels out. Now the shape of this complimentary filter is not always what one would expect. For a 1st order low pass it actually is a first order high pass but for higher order filters it tends to have over/under swings in the cutoff region. However, it always exists as a stable causal filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Series (or cascade) &quot;reconstruction to unity&quot; is bit more complicated. Obviously the filters would have to be the inverse of each others, i.e. $\tilde{H}(\omega) = \frac{1}{H(\omega)}$. In general this can be done for any minimum phase filter. The inverse of a minimum phase filter is minimum phase as well and both are causal and stable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this leaves us with the question of how to interpret group delay in these cases. The cascade case is actually the more interesting. Since the filters are inverse of each other, the phase, and hence the group delay, of one is the negative of the other. So at frequencies were one filter has positive group delay, the other has negative group delay. An easy example would be a low shelf with +6dB of gain and a low shelf with 6dB of cut.&#xA;So negative group delays are very real and certainly not a violation of causality. In practice, these show up in areas of the filter that are fairly &quot;non-flat&quot; so the traditional interpretation of &quot;delay of the envelope&quot; doesn't quite apply since there is a fair amount of amplitude distortion as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you Google &quot;negative group delay&quot;, you can find a few IEEE articles that have tackled the subject.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-02-25T13:46:14.963" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="7987" PostTypeId="1" CreationDate="2013-02-25T16:48:35.523" Score="3" ViewCount="484" Body="&lt;p&gt;I want to measure the frequencies at which a point oscillates in a multidimensional space, let's take the example of a point on a 2d-surface.&#xA;For now, I naïvely split the signal in two, along the cartesian coordinates, and compute the two FFTs separately. This approach could work but seems to be arbitrary and may loose relevant information. Is there a &lt;strong&gt;canonical&lt;/strong&gt; way to perform the &lt;strong&gt;frequency analysis in multidimensional space&lt;/strong&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;It is &lt;strong&gt;unrelated&lt;/strong&gt; to 2D FFT. I take a vector of size 2*T and 2D FFT is concerned by plain T^2 data, like images.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here is an example where halving the signal along the polar coordinates seems better than along the cartesian coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data used, a point evolving in 2D,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aJVFj.png&quot; alt=&quot;Evolution of a point in 2D&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the FFTs for&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The cartesian coordinates x and y (a bit noisy)&lt;/li&gt;&#xA;&lt;li&gt;The polar coordinates theta and rho (very clear)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uIBQS.png&quot; alt=&quot;FFT for the previous data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;edit after Mohammad's comment about velocity&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the FFT for the velocity vector (very noisy, and looses information in high frequencies)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iYADA.png&quot; alt=&quot;FFT for the velocity&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4000" LastEditorUserId="4000" LastEditDate="2013-02-25T17:29:57.437" LastActivityDate="2013-02-25T17:29:57.437" Title="Discrete Fourier transform in a multidimensional space" Tags="|fft|fourier-transform|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="7988" PostTypeId="1" AcceptedAnswerId="30179" CreationDate="2013-02-25T16:49:11.370" Score="0" ViewCount="1042" Body="&lt;p&gt;I want to phase shift an incoming sine wave with varying frequency but I am unsure how to go about doing so in practical terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little more info regarding the requirements:&#xA;I have an encoder producing a sine/cosine pair with a fixed Peak to Peak but as the speed changes so obviously does the frequency. I want to effectively advance/retard the signal by altering the phase of the incoming signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I am unsure is how to go about doing this, if I use a look up table (LUT) for fast frequencies this would be ok but at slower frequencies I am going to get a very rough (digitised) signal. I was thinking I could calculate the signal 'on the fly' but again that would require having a LUT ie output = sin (input(amplitude) + offset[amplitude])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I maybe going about this the wrong way and there is possibly a simple solution to this?&lt;/p&gt;&#xA;" OwnerUserId="4001" LastActivityDate="2016-04-17T19:43:51.197" Title="How to process/generate a phase shifted frequency varying sine wave?" Tags="|phase|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="7989" PostTypeId="1" AcceptedAnswerId="7991" CreationDate="2013-02-25T17:44:41.307" Score="0" ViewCount="535" Body="&lt;p&gt;if i have the transfer function of magnitude response is there a method that i could calculate the frequency response? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the transfer function of the magnitude response is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ 3db \pm  3.5db  $ for $|ν|&amp;lt;0.1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ &amp;lt;-55db $        for  $|ν|&amp;lt;0.2$&lt;/p&gt;&#xA;" OwnerUserId="3828" LastActivityDate="2013-02-25T18:06:24.643" Title="Find the frequency response if i have the magnitude response?" Tags="|frequency-response|transfer-function|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="7990" PostTypeId="1" AcceptedAnswerId="7992" CreationDate="2013-02-25T17:57:57.270" Score="8" ViewCount="4048" Body="&lt;p&gt;I am confused as why do we need to represent the complex numbers with the imaginary y-axis if we can simply represent them as (x,y) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read that Multiplication by &lt;em&gt;i&lt;/em&gt; is an anti-clockwise rotation of a quarter-circle over y-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1wP8S.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplying 1 by i gives i. Multiplying &lt;em&gt;i&lt;/em&gt;, by &lt;em&gt;i&lt;/em&gt; once more, does another quarter-circle and gives -1. So, multiplying by -1 means a rotation of a half-circle. That is the meaning of i*i=-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what does that supposed to mean ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose, I am solving an equation and I ended up with an answer like &lt;em&gt;3i&lt;/em&gt; does that mean i've moved from x-axis to y-axis by half-circle counter clock wise ? I couldn't be able to visualize this properly&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2020-08-02T15:17:31.767" Title="Why complex numbers are represents as a+ib and can't be as (a,b)?" Tags="|signal-analysis|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7991" PostTypeId="2" ParentId="7989" CreationDate="2013-02-25T18:06:24.643" Score="2" Body="&lt;p&gt;The frequency response of a system can be represented in polar format, in which the magnitude and phase response are considered separately:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(\omega) = |H(\omega)| \angle H(\omega)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this representation, it should be clear that the magnitude response alone is not sufficient to characterize the full frequency response of a system; you have to know (or assume) what its phase response is also.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-02-25T18:06:24.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7992" PostTypeId="2" ParentId="7990" CreationDate="2013-02-25T18:18:57.910" Score="8" Body="&lt;p&gt;Yes, in signal processing, complex numbers are usually visualized on the complex plane, as you have said. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that if you put them on a plane, then you are able to measure two important quantities: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;em&gt;Magnitude&lt;/em&gt;, which is $\sqrt{x^2 + y^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;em&gt;Phase&lt;/em&gt; angle between your point and the origin, given by $\tan^{-1} \frac{y}{x}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you simply left them as a point, ($x$,$y$), you would not be able to concretize and have a frame work for those quantities. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may ask, why are those quantities, in turn, important? In signal processing, we are of course dealing with signals, and physically, we are dealing with 'real' signals. However, though a nice trick, an constant oscillation of a quantity in 'real' life, (like a cosine wave), is equivalent to two phasors, rotating around in opposite directions on the complex plane, and adding up together. With this framework, we can see that the phase angles 'cancel' each other out, and that the magnitudes of their resultant give us the magnitude of our 'real' signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact this is what one of euler's formulas captures. That is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\cos(2\pi ft) = \frac{e^{j2\pi ft} + e^{-j2\pi ft}}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see here how we can easily relate a 'real' world concept, like an oscillating cosine wave, with the 'complex' world of phasors, as they exist and rotate around in the complex plane. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one of the corner stones of DSP.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2018-05-28T04:51:39.157" LastActivityDate="2018-05-28T04:51:39.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7993" PostTypeId="2" ParentId="2566" CreationDate="2013-02-25T19:47:31.347" Score="2" Body="&lt;p&gt;A function with real even symmetry and imaginary odd symmetry will always have a purely real DFT/IDFT.  If you define the frequency response for only positive frequencies, then your spectrum does not have any symmetry about 0, and will have a complex impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should make sense, because cosine functions are even and sine functions are odd.  If you have an arbitrary even function, you would only be able to express it in terms of cosines, not sines.  Hence, it's frequency spectrum would be purely real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An even impulse response would have coefficients for positive and negative times, which means it would have to see into the future.  In order to implement this in a real time filter, you would shift the impulse response until it can be implemented with only data that has already happened.  This shift will cause a linear phase response in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using an FFT, keep in mind that negative frequencies will be aliased up to the region below the sample rate frequency.&lt;/p&gt;&#xA;" OwnerUserId="4002" LastActivityDate="2013-02-25T19:47:31.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7994" PostTypeId="2" ParentId="7990" CreationDate="2013-02-25T19:54:04.487" Score="4" Body="&lt;p&gt;For one definition of complex numbers, the symbology &quot;a + ib&quot; and &quot;(a,b)&quot; are equivalent representations as long as the operations on those symbols completely follow the set of rules for complex arithmetic (including multiplication implying a rotation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The meaning is that complex arithmetic using such arithmetic rules actually simplifies a whole bunch of theorems and computations (including solutions of polynomial roots, infinite series convergence, etc.).  The behavior of pairs of real quantities in the real world can sometimes be closely approximated by models using arithmetic under such rules, and then by calling one of the quantities &quot;imaginary&quot; to match the computational symbology used in the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider it a mathematical &quot;trick&quot; that is too helpful to not use.  e.g. Cardano and other Renaissance-era Italian mathematicians attempted to solve cubic equations without the use of complex or imaginary numbers, and their solutions were tons more long-winded because of that.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-02-25T20:05:26.707" LastActivityDate="2013-02-25T20:05:26.707" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7996" PostTypeId="1" CreationDate="2013-02-26T00:29:00.793" Score="3" ViewCount="965" Body="&lt;p&gt;I am trying to send a short amount of data (10-15 characters) from one mobile device to another via (inaudible) sound within 1-2 seconds. I'd like to be able to deal with normal external noises (chatter, traffic, etc). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a software engineering background, but no experience working with sound or audio. Is there a known/documented solution to address this problem of reasonably reliable ultrasonic data transfer? If you know of a guide or some document that'll explain the concepts to me as I develop out a solution that would be really awesome. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've researched a little bit on this topic, but have been unable to find something concrete for ultrasonic communication. Any direction would be much appreciated (and yes, I know I'm a noob here). Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4006" LastActivityDate="2013-07-13T18:55:50.690" Title="Ultrasonic data transfer" Tags="|sound|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="7997" PostTypeId="1" AcceptedAnswerId="7998" CreationDate="2013-02-26T03:14:30.547" Score="1" ViewCount="367" Body="&lt;p&gt;I'm converting the simulink diagram found in &lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CC8QFjAA&amp;amp;url=http://ijcsi.org/papers/IJCSI-8-5-1-360-365.pdf&amp;amp;ei=EyIsUcbrKNTXiAKZ7YC4CA&amp;amp;usg=AFQjCNGOlkjvvL_KXPvHFIrns3hIwtzFKw&amp;amp;bvm=bv.42965579,d.cGE&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; to C code.  I'm not familiar with matlab/simulink(too expensive) so need help interpreting the diagram.  The problem I experience is that once a value like $\theta$, or $x_1$ becomes zero, zero is propagated everywhere due to the multiplication.  The paper states that the integrators are initialized to zero, so I don't see how the system works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the simulink diagram and my C code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The block diagram is found in the paper above as Figure 1 and Figure 2 :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QGQGK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;typedef struct  { float zeta,gamma;} PARAM_ANFfloat;&#xA;typedef struct  { float err,regressor,x1,theta;} STATE_ANFfloat;&#xA;&#xA;typedef struct {PARAM_ANFfloat p;STATE_ANFfloat s;} ANFfloat;&#xA;&#xA;void dspANFfloat_perform(ANFfloat *anf, float y)&#xA;{&#xA;    anf-&amp;gt;s.err = y - anf-&amp;gt;s.regressor;&#xA;&#xA;    anf-&amp;gt;s.theta = -anf-&amp;gt;p.gamma * anf-&amp;gt;s.x1 * anf-&amp;gt;s.theta * anf-&amp;gt;s.err;&#xA;&#xA;    anf-&amp;gt;s.x1 = anf-&amp;gt;s.theta * anf-&amp;gt;s.err * 2 * anf-&amp;gt;p.zeta - anf-&amp;gt;s.x1 * - anf-&amp;gt;s.theta * anf-&amp;gt;s.theta;&#xA;&#xA;    anf-&amp;gt;s.regressor = anf-&amp;gt;s.x1;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4008" LastEditorUserId="80" LastEditDate="2013-02-26T03:34:46.450" LastActivityDate="2013-02-26T03:44:19.720" Title="Adjustable Notch Filter help" Tags="|filters|matlab|adaptive-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="7998" PostTypeId="2" ParentId="7997" CreationDate="2013-02-26T03:44:19.720" Score="2" Body="&lt;p&gt;In this line:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;anf-&gt;s.theta = -anf-&gt;p.gamma * anf-&gt;s.x1 * anf-&gt;s.theta * anf-&gt;s.err;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;you seem to be conflating $\theta$ and $\dot{\theta}$ (the derivative).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation 5 of the paper is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\dot{\theta} = -\gamma x_1 \theta \left[ y(t) - \sum_{l=1}^n \dot{x}_l \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the left-hand term is the derivative of $\theta$, not $\theta$ itself.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-02-26T03:44:19.720" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="7999" PostTypeId="1" CreationDate="2013-02-26T06:11:46.147" Score="3" ViewCount="188" Body="&lt;p&gt;I am working with Walsh coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the intuitive understanding is almost that that they are the degree of connectivity, but it is there a better way of thinking about it? What is the definition of a Walsh coefficient besides &quot;What you get when you take the Walsh transform&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4010" LastActivityDate="2013-02-26T06:11:46.147" Title="Understanding Walsh coefficients" Tags="|fourier-transform|transform|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8001" PostTypeId="1" CreationDate="2013-02-26T10:16:33.360" Score="9" ViewCount="10464" Body="&lt;p&gt;In physical systems I understand what is the meaning of stability or unstability. An operational amplifier for example, if working in positive feedback will either saturate or start osscilating (i.e will not have any stable state). thats clear to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am unable to understand what exactly we mean when we say an IIR filter (or any other digital system), for example, can become very unstable. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What exactly inside the Digital Signal Proccessor  happens, what happens to the output physically? &lt;/li&gt;&#xA;&lt;li&gt;What exactly we mean by unstable system in this context?         &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="1629" LastEditDate="2016-09-10T08:04:39.110" LastActivityDate="2016-09-10T08:04:39.110" Title="What is the exact meaning of unstable system in DSP?" Tags="|infinite-impulse-response|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8002" PostTypeId="2" ParentId="8001" CreationDate="2013-02-26T12:16:54.147" Score="6" Body="&lt;p&gt;Unstable typically means and unbounded output for a bounded input. In other words the output of, say , a filter can get infinitely large although the input is perfectly okay and of &quot;normal&quot; size.&#xA;A simple example would be the difference equation $y[n] =  x[n] + y[n-1]$. If we calculate the step response, i.e. $x[n] = u[n]$, we get y[0] = 1, y[1] = 2, y[2] = 3 ...&#xA;The output grows infinitely even though the input is a perfectly well behaved signal, bounded by 1.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3562" LastEditDate="2013-02-26T15:22:11.643" LastActivityDate="2013-02-26T15:22:11.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8003" PostTypeId="2" ParentId="7968" CreationDate="2013-02-26T12:48:13.397" Score="2" Body="&lt;p&gt;This is &lt;em&gt;not&lt;/em&gt; a simple problem.  Almost certainly any &quot;home-brewed&quot; system you create looking for &quot;frequency patterns&quot; is going to have horrible performance, unless it develops complexity comparable to full-fledged speech recognizer.  The reason for this is that recognizing speech, while it &lt;em&gt;seems&lt;/em&gt; like a simple task to our ears, is in fact quite complex, and requires large amounts of context to have good accuracy.  What I'm trying to say is that if you just try to recognize the phonemes from the audio locally, you're going to get gibberish. You need to take into account the neighboring phonemes, the vocabulary of the language being spoken, and the large scale structure and content of the surrounding sentences in order to get anywhere &lt;em&gt;near&lt;/em&gt; human level performance.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of the day if you try to write something which &quot;recognizes frequency patterns of speech&quot; from scratch, you're going to be reinventing the wheel, and a pretty dang big wheel at that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this reason, the best thing for you to do would be to take an existing speech recognition system, and modify its output to suit your needs.  I would suggest using &lt;a href=&quot;http://cmusphinx.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;CMU Sphinx&lt;/a&gt; to decode the audio into an N-Best list, and then search this list for the text you are looking for.  CMU Sphinx has good recognition performance and is highly configurable.&lt;/p&gt;&#xA;" OwnerUserId="4012" LastActivityDate="2013-02-26T12:48:13.397" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8004" PostTypeId="1" CreationDate="2013-02-25T14:58:54.033" Score="11" ViewCount="14268" Body="&lt;p&gt;I am trying to understand how and why the fourier transform is used in image processing / computer vision. Below is what I have gathered so far. Would my understanding of it be correct? If not, could somebody explain it to me in simple, plain english? Or, does anybody have anything to add to it? Last but not least, could somebody explain the &quot;discrete fourier transform&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fourier transform decomposes an image into its sine and cosine components. Put simply, sine and cosine are waves starting at a minimum and maximum respectively. In the real world, we can't tell whether a wave that we observe started at a maximum or minimum point, and therefore we can't really distinguish between the two. Therefore, sine and cosine are simply referred to as sinusoids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When applying the FT to an image, we transform it from its spatial domain into a &quot;frequency domain&quot;, which in essence is the image represented in terms of its variation in colour and brightness over time (well, not time, but space. That is, over a number of pixels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Why would I use the Fourier Transform? And what are its benefits over other methods? For example, one application in literature is in shape recognition or noise elimination. In basic terms, how could one go about shape recognition using the FT? &lt;/p&gt;&#xA;" OwnerDisplayName="user1796218" LastActivityDate="2013-02-26T20:55:02.100" Title="Image processing and the Fourier Transform" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8005" PostTypeId="2" ParentId="2042" CreationDate="2013-02-26T13:13:04.493" Score="2" Body="&lt;p&gt;As has been mentioned in the comments, you can't just get a transcript without knowing what language is being spoken.  However, you can decode the audio &lt;em&gt;assuming&lt;/em&gt; it is of a given language.  Thus I would propose the following system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You run your speech recognizer N times on your audio, where N is the number of languages you  are identifying, using the respective language model and acoustic model of each language. This will give you N transcripts of the audio, each based on the assumption that the audio is in &lt;em&gt;that&lt;/em&gt; language.  However, more significantly, HMM-based speech recognizers (by far the most common type) will also give you an estimate of the log probability of a given utterance, essentially telling you how well the given utterance matches your language and acoustic models.  Once you have the log probabilities for each of the different languages, you just need to do a comparison and pick the best one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, depending on the differences between the models, there might be some bias in these probabilities.  For example, the English model give higher probabilities than the Chinese model for almost &lt;em&gt;all&lt;/em&gt; input utterances, even if they are in Chinese. To fix this, you need to renormalize these values to ranges where they can be compared.  This can only be done by looking at the log probabilities given for large numbers of utterances across a variety of languages, and seeing how they compare between your different languages. You could even see this as a machine learning problem if you wanted to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest using &lt;a href=&quot;http://cmusphinx.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;CMU Sphinx&lt;/a&gt;, an open source recognizer with good performance that has prebuilt language and acoustic models for Enlish, Chinese, French, Spanish, German, Russian, and other lagnuages.  Also, I can confirm that at least for the pocketsphinx recognizer, it will output the log probabilities of hypotheses. (In fact, it will even give you the probabilities of the scores of the best few hypotheses for a given model, additional information that might allow you to guess the language even more accurately).&lt;/p&gt;&#xA;" OwnerUserId="4012" LastActivityDate="2013-02-26T13:13:04.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8006" PostTypeId="2" ParentId="8001" CreationDate="2013-02-26T15:44:05.460" Score="2" Body="&lt;p&gt;An IIR filter has poles, which means it has feedback from the system output that factor into its output computations.  The poles of a discrete time system must have an absolute magnitude smaller than 1 for the system to be stable.  This equates to having the poles fall inside a unit circle in the complex plane (generally referring to the z plane associated with the z domain transfer function of the system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The analogous situation for &quot;real world&quot; systems (systems that can be modeled by linear differential equations with constant coefficients - thus can be represented by a transfer function in the Laplace domain or S domain), is that the poles of the system transfer function must be on the left hand side of the S plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For discrete time systems, if poles are outside the unit circle, values represented internally as well as the system output can grow without bound.  If poles are located on the unit circle, values internal to the system as well as the output may oscillate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a stable system, internal values and the system output are expected to be a function of the system input.  This will not be the case if the system is oscillatory or has values that exceed the size of the numbers used to represent internal values (register overflow).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If poles are too close to the unit circle, the system may be marginally stable.  Is such cases, the system may behave for some limited set of input conditions, but may become uncontrolled for other conditions.  The reason for this is that DSP systems are inherently non-linear.  Internal values are often represented using fixed point arithmetic and are always stored in finite sized registers, so if the maximum values that can be represented are exceeded, the system experiences a non linearity.  Another feature of DSP systems is that signals are quantized.  Signal quantization adds low level non-linear effects to the system.  Quantization error is often modeled as noise, but it can become correlated with system values and result in oscillations called limit cycles.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Care must be taken to avoid saturating (hitting absolute maximum values) in fixed point representations.  Generally it is considered better, if absolute values are exceeded, that the representation be held at the maximum value rather than cause a sign inversion of the value.  This is called saturation limiting and it does a better job of preserving the system behavior that allowing sign inversions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general an unstable DSP system will saturate to a fixed value or oscillate in a chaotic way due to internal nonliteraries.  &lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-02-26T15:50:14.890" LastActivityDate="2013-02-26T15:50:14.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8007" PostTypeId="1" AcceptedAnswerId="8017" CreationDate="2013-02-26T16:15:01.607" Score="2" ViewCount="200" Body="&lt;p&gt;What distance metric can I use for comparing image features like elongation and solidity of a contour of each image? &#xA;Except Least Square and without using a support vector machine because i do not know at which class images belong.&lt;/p&gt;&#xA;" OwnerUserId="3597" LastActivityDate="2013-02-26T20:24:46.050" Title="What distance metric can I use for comparing image features like elongation and solidity of each image?" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8008" PostTypeId="2" ParentId="7996" CreationDate="2013-02-26T17:53:00.440" Score="2" Body="&lt;p&gt;Even using the highest audio frequencies that a typical mobile device can generate (which are below the ultrasonic range), there is no guarantee that &quot;normal external noise&quot; won't interfere.  Transient impact noises can be quite wide-band.  Therefore one may have to try various forms and levels of redundancy or Forward Error Correction coding (Hamming, Reed-Solomon, etc.), until the reliability probabilities reach a suitable level for your application.  For many (most?) modulation schemes, just lowering the bandwidth sent/used can also improve the reliability probabilities of the channel.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-02-26T17:53:00.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8009" PostTypeId="1" AcceptedAnswerId="8024" CreationDate="2013-02-26T18:57:18.060" Score="18" ViewCount="17769" Body="&lt;p&gt;I am familiar with much of the mathematical background behind wavelets. However when implementing algorithms on a computer with wavelets I am less certain about whether I should be using continuous or discrete wavelets. In all reality everything on a computer is discrete of course, so it seems obvious that discrete wavelets are the right choice for digital signal processing. However &lt;a href=&quot;http://en.wikipedia.org/wiki/Continuous_wavelet_transform&quot;&gt;according to wikipedia&lt;/a&gt; it is the continuous wavelet transform that is primarily used in (digital) image compression as well as a large number of other digital data processing activities. What are the pros and cons to consider when deciding whether to use an (approximate) continuous wavelet transform instead of an (exact) discrete wavelet transform for digital image or signal processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. (Checking an assumption here) I am assuming continuous wavelet transforms are used in digital processing by simply taking the value of the continuous wavelet at evenly spaced points and using the resulting sequence for wavelet computations. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.P.S. Usually wikipedia is pretty precise about mathematics, so I am assuming that the applications in the article on Continuous Wavelet Transforms are in fact applications of the Continuous Wavelet Transform. Certainly it mentions some that are specifically CWT so there is clearly some use of CWT in digital applications.&lt;/p&gt;&#xA;" OwnerUserId="566" LastActivityDate="2013-08-14T20:48:30.730" Title="Using continuous verses discrete wavelet transform in digital applications" Tags="|discrete-signals|wavelet|continuous-signals|approximation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8010" PostTypeId="1" AcceptedAnswerId="8043" CreationDate="2013-02-26T19:08:22.007" Score="4" ViewCount="3991" Body="&lt;p&gt;It seems that when doing FEC with a concatenated-code, an interleaver is often placed between the outer block code and the inner convolution code.  The explanations I've seen say that this is because the convolution decoder often has errors in bursts.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if we assume that we're using a Reed-Solomon decoder with 8-bit symbols, then spreading the bursts onto multiple blocks would seem to increase errors rather than decrease them.  What am I missing that explains why this interleaving is good?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rough idea of the decode and encode process:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Encode:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$\boxed{\textrm{Data}}{\longrightarrow}\boxed{\textrm{RS Encoder}}{\longrightarrow}\boxed{\textrm{Interleaver}}{\longrightarrow}\boxed{\textrm{Convolution Encoder}}{\longrightarrow} \boxed{\textrm{Modulator}}$$ &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Decode:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$\boxed{\textrm{Demodulator}}{\longrightarrow}\boxed{\textrm{Convolution Decoder}}{\longrightarrow}\boxed{\textrm{De-interleaver}}{\longrightarrow}\boxed{\textrm{RS Decoder}}{\longrightarrow}\boxed{\textrm{Data}}$$&lt;/p&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="1629" LastEditDate="2016-12-29T15:13:54.260" LastActivityDate="2016-12-29T15:13:54.260" Title="Why is an interleaver often placed between an outer block code and an inner convolution code?" Tags="|digital-communications|channelcoding|forward-error-correction|reed-solomon|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8011" PostTypeId="2" ParentId="8009" CreationDate="2013-02-26T19:17:15.457" Score="12" Body="&lt;p&gt;A very common yet unfortunate mis-conception in the field of wavelets has to do with the ill-coined terminology of &quot;Continuous Wavelet Transforms&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First thing's first: The Continuous Wavelet Transform, (CWT), and the Discrete Wavelet Transform (DWT), &lt;strong&gt;are both, point-by-point, digital, transformations that are easily implemented on a computer.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference between a &quot;Continuous&quot; Transform, and a &quot;Discrete&quot; Transform in the wavelet context, comes from:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The number of samples skipped when you cross-correlate a signal with your wavelet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The number of samples skipped when you dilate your wavelet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) The CWT uses only a wavelet, while the DWT uses both a wavelet and a scale-let. (Not important for this discussion, but here for completeness).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But make no mistake - a CWT, just like a DWT, &lt;strong&gt;is at all times a discrete, digital, operation.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let this example illustrate this: Consider the Haar Wavelet, [1 -1]. Let us say that we wanted to do a DWT with the Haar Wavelet. So you convolve your signal, with the Haar mother wavelet, [1 -1], but only at dyadic delays. For example, let us say your signal is the following vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x = [1 \ 2 \ 3 \ 4 \ 5 \ 6 \ 7 \ 8] &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first result of the DWT convolution with your Haar Wavelet is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;1(-1) + 2(1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next result is:&#xA;$$&#xA;3(-1) + 4(1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;5(-1) + 6(1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally the last one is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;7(-1) + 8(1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does something strike you as odd? I said take the convolution of your signal with the wavelet - so how come I only end up with four values? This is because I &lt;em&gt;skip&lt;/em&gt; samples when I do convolutions in the DWT. I first took [1 2], did a dot product, and then took [3 4]. What happened to [2 3]? I skipped it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When do you not skip it? When you do a CWT. If you did a CWT, it would be a 'normal' digital convolution of your signal, with the Haar wavelet. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The second thing, is the way you dilate your wavelet. In the top example, the Haar Wavelet is [1 -1] for the first level decomposition. In the second level, the DWT Haar Wavelet becomes [1 1 -1 -1]. However, in the CWT, the second level Haar wavelet is [1 0 -1]. Once again, in the DWT, I am not expanding point for point - I never have a three-length wavelet. However, in the CWT, I go from length 2, to length 3. In the DWT, I went straight from length 2, to length 4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the long and short of it, hope this helped.&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-02-26T19:17:15.457" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8012" PostTypeId="2" ParentId="8001" CreationDate="2013-02-26T19:17:59.937" Score="4" Body="&lt;p&gt;An unstable IIR filter will act just like an unstable op-amp circuit, except that the input and output are streams of numbers instead of voltages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the output can oscillate, get stuck at a min/max value, or generally just be crudded up. Just like an unstable op-amp circuit, it might work for some inputs and oscillate for others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty much any type of system where feedback is involved can be unstable if it's designed wrong. This is because some of the output feeds back into the input (hence being feedback!), so an unstable system will keep feeding back more and more until it goes crazy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's nothing special about IIR filters vs. op-amp filters - they both have feedback, and can both be stable or unstable depending on the poles, which represent the feedback part of a transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's actually the difference between an FIR digital filter and an IIR digital filter: FIR filters don't have any feedback, so they can never be unstable (the tradeoff here is that an equivalent FIR filter usually takes a ton more computation). They're basically pure feed-forward, instead of having feedback (and probably also some feed-forward) like an IIR.&lt;/p&gt;&#xA;" OwnerUserId="4018" LastEditorUserId="4018" LastEditDate="2013-02-26T22:04:51.700" LastActivityDate="2013-02-26T22:04:51.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8013" PostTypeId="2" ParentId="8010" CreationDate="2013-02-26T19:22:44.667" Score="1" Body="&lt;p&gt;Block codes (such as the Reed-Solomon you mentioned) have the ability to detect and correct a certain number of errors that is tied directly to the properties of that code (minimum Hamming distance for example). By passing on burst errors from the inner-channel, this may put too many errors in a single block than the code is capable of correcting. If, however, we spread these errors to multiple block codes, then each respective block code will hopefully have a small number of errors it's capable of correcting. As an example with probably unrealistic numbers (these type of setups are often used with massive convolutional codes), if your block code is capable of correcting 1 error, and you get a burst of 4 errors, then you will have 1 block with 4 errors, 1 block with 3 and 1 block with 1, or 2 blocks with with 2 errors. In all scenarios, we have an uncorrectable error if we don't do any interleaving. However, if we can interleave such that we guarantee bursts of 4 errors will be spread in 4 blocks, then we can correct all errors and all is well.&lt;/p&gt;&#xA;" OwnerUserId="1279" LastActivityDate="2013-02-26T19:22:44.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8014" PostTypeId="1" AcceptedAnswerId="8019" CreationDate="2013-02-26T19:41:14.827" Score="4" ViewCount="2039" Body="&lt;p&gt;I have a stream of music that I'm reading(from a microphone, from an online streaming source or whatever). And I want to have a system that will detect when a song changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, is this possible with any kind of accuracy?(even something 75% rate of detection would be helpful).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, would it be possible to detect large enough changes in the music(so it might be a song change but it could just be a switch from a verse to chorus or chorus to bridge, etc...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not asking for an exact algorithm -- though obviously if you know one then I obviously wouldn't mind -- but even a general approach on how to tackle such a problem would be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All pointers welcome, scientific papers, open source projects, some random guy's blog, whatever.&lt;/p&gt;&#xA;" OwnerUserId="4013" LastActivityDate="2013-02-26T23:20:05.780" Title="Detect song changes in audio stream" Tags="|music|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8015" PostTypeId="2" ParentId="8010" CreationDate="2013-02-26T19:53:21.587" Score="1" Body="&lt;p&gt;I think the part that you are missing is that the burst of errors out of the convolutional decoder is (or at least should be) a rare event.  Thus, every once in a while there will be a burst of errors, but most of the time there are no errors coming out of the convolutional decoder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there wasn't an interleaver whenever a burst of errors occurred one or two blocks (depending on where the burst occurred relative to the block boundaries) would be swamped with errors while their neighbors would have no errors.  The interleaver spreads the errors out so that they are &quot;shared&quot; between many blocks, making them manageable by all the blocks.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-02-26T19:53:21.587" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8016" PostTypeId="2" ParentId="8014" CreationDate="2013-02-26T20:19:20.370" Score="1" Body="&lt;p&gt;I think your best bet is some combination of key and tempo detection.  There are a number of threads that discuss how to determine a note's pitch (see &lt;a href=&quot;https://dsp.stackexchange.com/questions/tagged/pitch&quot;&gt;here&lt;/a&gt;), so I won't get into that.  Key detection should simply be an expansion of pitch detection.  You determine the pitch of the notes and find the key that matches.  You could also use information like that the primary, third, and fifth notes will tend to be more common than the others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you started seeing notes that didn't fit the key, there might have been a key change.  You could see if the new set of notes match a different key.  You could also use the fact that some key changes are more likely than others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other characteristic to use is tempo.  This is simply how quickly the notes come.  Some notes, of course, will be held longer than others (eighth notes, quarter notes, half notes, full notes, etc.), but they should have a primary period.  A change in that primary period could indicate a song change.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-02-26T20:19:20.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8017" PostTypeId="2" ParentId="8007" CreationDate="2013-02-26T20:24:46.050" Score="3" Body="&lt;p&gt;If I understood you correctly, each contour is described by a 2-element feature vector $f = [e, s]$, where $e$ is elongation and $s$ is solidity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, you might want to try the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mahalanobis_distance&quot; rel=&quot;nofollow&quot;&gt;Mahalanobis distance&lt;/a&gt;, which is defined as follows:&#xA;$$d(f_1, f_2) = \sqrt{(f_2 - f_1)C^{-1}(f_2 - f_1)}$$&#xA;where $f_1$ and $f_2$ are the feature vectors that you are comparing, and $C$ is the covariance matrix of your data set.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-02-26T20:24:46.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8018" PostTypeId="2" ParentId="8004" CreationDate="2013-02-26T20:43:13.913" Score="11" Body="&lt;p&gt;At a conceptual level, the Fourier Transform tells you what is happening in the image in terms the frequencies of those sinusoids. For example, if you have a picture of a plain wall, the values of the pixels change very little as you go from left to right or from top to bottom.  In the frequency domain that means that your image contains low frequencies, but no high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if you have a picture of a picket fence, then the values of the pixels change all the time as you go from left to right.  So in Fourier domain you have high frequencies in the X direction, but not in the Y direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if you have a picture of a checkerboard, then the pixel values change a lot in both directions.  Thus the Fourier transform of the image will have high frequencies in both X and Y.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the Fourier transform tells you what is happening in your image, it is often convenient to describe image processing operations in terms of what they do to the frequencies contained in the image.  For example, eliminating high frequencies blurs the image.  Eliminating low frequencies gives you edges.  And enhancing high frequencies while keeping the low frequencies sharpens the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT is used extensively in image processing and computer vision. For example, convolution, a fundamental image processing operation, can be done much faster by using the FFT.  The Wiener filter, used for image deblurring, is defined in therms of the Fourier transform.  But more importantly, even when the Fourier transform is not used directly, it provides a very useful framework for reasoning about the image processing operations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steve Eddins, one of the authors of &quot;Digital Image Processing with MATLAB&quot;, has a whole series of &lt;a href=&quot;http://blogs.mathworks.com/steve/category/fourier-transforms/&quot;&gt;blog posts&lt;/a&gt; on the Fourier transform and how it is used in image processing.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2013-02-26T20:55:02.100" LastActivityDate="2013-02-26T20:55:02.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8019" PostTypeId="2" ParentId="8014" CreationDate="2013-02-26T21:02:22.733" Score="9" Body="&lt;p&gt;The very first thing to try would be to implement a rough speech/music classifier to detect a radio host/DJ; and to extract the amplitude envelope to detect fade outs and fade ins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have implemented that and/or if this doesn't solve your problem because your stream is continuous (DJ-style mix), you'll certainly run into the song boundary / song section boundary ambiguity - but if this is not a problem to you then there are solutions. What you are looking for is known in the academic community as ``unsupervised audio stream segmentation&quot; - with a variety of techniques proposed over the years. You have to decide on two ingredients: which audio features to extract from the audio stream; and which statistical analysis method to use to detect changes/structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the features, the consensus is on a combinations of the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MFCC (which carry timbre/instrumentation information)&lt;/li&gt;&#xA;&lt;li&gt;Chroma (which carry key/chord information)&lt;/li&gt;&#xA;&lt;li&gt;Loudness&lt;/li&gt;&#xA;&lt;li&gt;Tempo or other measures of rhythm (beat histogram, Pampalk's fluctuation patterns, etc.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Very frequently, an algorithm can be repurposed just by a change of features... For example, there are papers on musicological analysis of piano music which will not use MFCC (same timbre throughout the piece), or papers on pop song structure analysis which will not use tempo (assumed to be constant throughout the piece, so not informative) - but the methods they describe could very well work for you if you decide to include other features - so don't be narrow when looking for literature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the statistical analysis methods, the usual suspects are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Computation of a self-similarity matrix, and &quot;checkerboard&quot; filter to detect blocks. The classic paper is by Foote, &quot;Automatic Audio Segmentation Using A Measure of Audio Novelty&quot;. Foote's novelty detection function can be computed online and incrementally - over a buffer of past audio frames.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hidden Markov models, used in an unsupervised way. You hope that the HMM states will map well into segments (Peeters and Rodet, &quot;Music Structure Discovering Using Dynamic Audio Features for Audio Summary Generation: Sequence and State Approach&quot;), or you overestimate the number of HMM states and look for changes in the HMM state distribution within small windows (Levy and Sandler, &quot;Structural Segmentation of Musical Audio by Constrained Clustering&quot;). These methods are more geared towards offline processing, and situations in which you have an idea in advance of how many segments you want to identify.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;Streaming&quot; change detection methods. The principle is to split the past $N$ frames of audio into two $N/2$ frames blocks $S_1$ and $S_2$, and to perform a statistical test to decide which of the hypotheses &quot;Frames from $S_1$ and $S_2$ are drawn from the same distribution $P$&quot; and &quot;Frames from $S_1$ and $S_2$ are drawn from a different distribution $P_1$ and $P_2$&quot; is the most likely. Big peaks or dips in the test outcome indicate that the middle of the block is a segment change. There are a number of information criteria used to weigh the two hypotheses, such as the BIC (Classic paper: &quot;Unsupervised Audio Stream Segmentation And Clustering Via The Bayesian Information Criterion&quot; by Zhou). The limitation here is that you usually have little data to perform the test, and the data has weird-looking distributions. See the section 2.2 of Gillet et al's &quot;Comparing audio and video segmentations for music videos indexing&quot; for a few pointers on kernel methods that overcome these limitations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TTjWW.png&quot; alt=&quot;Change detection&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a real-life application (indexing of radio streams), see for example Ramona's &quot;Combined supervised and unsupervised approaches for automatic segmentation of radiophonic audio streams&quot; - this work combined the kind of unsupervised section detectors discussed here to a supervised speech/music classifier (to tackle the most obvious part of the problem).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-02-26T23:20:05.780" LastActivityDate="2013-02-26T23:20:05.780" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8020" PostTypeId="1" CreationDate="2013-02-27T02:13:54.867" Score="5" ViewCount="1118" Body="&lt;p&gt;Is there any current ideas about IIR filter algorithm parallelization with thread count greater than filter order?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, parallelization method should load GPU efficiently.&lt;/p&gt;&#xA;" OwnerDisplayName="user3789" LastActivityDate="2013-05-14T22:04:13.670" Title="IIR filter parallelization" Tags="|filter-design|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8021" PostTypeId="1" AcceptedAnswerId="8034" CreationDate="2013-02-27T02:53:21.207" Score="3" ViewCount="548" Body="&lt;p&gt;Does anyone have any good references for deriving parameters of an IIR Low pass/High Pass filter directly in the digital domain using the magnitude squared at the corner frequency? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been able to derive the parameters of a first order Low/High pass filter with $3\textrm{ dB}$ attenuation at the corner frequency i.e. calculating $k$ and $\alpha$ in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = k\frac{\left(1+z^{-1}\right)}{\left(1-\alpha z^{-1}\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is that I distinctly remember deriving the parameters using a $6\textrm{ dB}$ attenuation at the corner frequency in a DSP course I have done previously but I have forgotten the trigonometric identiftes used to finish the derivation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general procedure is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Let $\omega = 0/\pi$ to calculate the gain term $k$ such that there is a $0\textrm{ dB}$ gain at $0/\pi$&lt;/li&gt;&#xA;&lt;li&gt;Calculate the magnitude squared at the corner frequency to obtain a value for $\alpha$ in terms of the corner frequency.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The problem may be that it should be a second order filter or I am recalling the method for a band pass/stop filter but I'm not sure and it appears this method is not used very often except in the case of band pass/stop filters for parametric EQ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope the question is clear and I will try to improve the structure with the responses so it will be useful for others. Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="3296" LastEditorUserId="1629" LastEditDate="2016-05-31T18:45:23.497" LastActivityDate="2016-05-31T18:58:02.827" Title="IIR filter design in digital domain using the magnitude squared" Tags="|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8022" PostTypeId="1" AcceptedAnswerId="8061" CreationDate="2013-02-27T11:04:56.397" Score="0" ViewCount="286" Body="&lt;p&gt;I'm trying to understand Fast Fourier Transform in Detail to find out what exactly the frequencies when dealing with discrete sequence,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I've done,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I've taken a Sinusoidal wave with &lt;code&gt;1Hz&lt;/code&gt; Frequency&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = 4;       %Amplitude&#xA;&#xA;Fs = 8;      %Sampling Frequency 8Hertz&#xA;Ts = 1/Fs;   %Sampling Rate = 0.125&#xA;&#xA;f = 1;       %Frequency of Wave = 1Hz&#xA;t = 1/f;     %Time period = 1 Second&#xA;&#xA;n = 0:Ts:(t);  %{0,0.125,0.250,0.375,0.500,0.625,0.750,0.875,0.100}&#xA;&#xA;x=A*sin(2*pi*f*n);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, If I plot it,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subplot(2,1 ,1);&#xA;plot(n,x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7BAFq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The values of the sampled points are ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6DVYP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Generated Sample's Amplitudes = {0,3,4,3,0,-3,-4,-3,0}&#xA;&#xA;&#xA;% Sinewave Period = (Samples/Period)*(Time/Sample)&#xA;% Sinewave Period = (8)*(0.125)&#xA;% Sinewave Period = 1sec&#xA;% Reciprocal of 1sec =&amp;gt; 1Hz &amp;lt;-- Original Frequency&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now let's take its FFT by manually giving discrete sequence as input,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT divides your Sampling frequency into N equal parts and returns the strength of the signal at each of these frequency levels. What it means is you are dividing frequencies from 0 to 8(Fs) into 8(No.of Samples) equal parts. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F = fft([0 3 4 3 0 -3 -4 -3 0]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qZ1bT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if I take the FFT of completely Random Sequence, like,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fft([40 2 8 31 6 8 -4]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have a look at its Frequency Plot,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LIxKE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've reading a book and found,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Sinewave Period = (Samples/Period)*(Time/Sample)&#xA;  Freqeuncy = 1/Sinewave Period&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In Random sequence I mentioned above have total of 7 samples, but What it its period ? What it is the time between each Sample in this signal since it is totally random ?&#xA;How could this sequence represents more than 1 frequency ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-03-01T18:35:23.070" Title="How Discrete sequence could have more than one Frequency" Tags="|discrete-signals|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8023" PostTypeId="1" AcceptedAnswerId="8025" CreationDate="2013-02-27T11:41:28.097" Score="0" ViewCount="6817" Body="&lt;p&gt;Is there any technology to help find out when an audio file is actually recorded? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given an audio file, how can we find out when it is recorded? File creation time is useless because it can be altered.&lt;/p&gt;&#xA;" OwnerUserId="4020" LastActivityDate="2013-02-27T15:46:18.203" Title="Find out when an audio file is actually recorded?" Tags="|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8024" PostTypeId="2" ParentId="8009" CreationDate="2013-02-27T12:02:14.770" Score="12" Body="&lt;p&gt;As Mohammad stated already the terms Continuous Wavelet Transforms (CWT) and Discrete Wavelet Transforms (DWT) are a little bit misleading. They relate approximately as (Continuous) Fourier Transform (the math. integral transform) to DFT (Discrete Fourier Transform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to understand the details it is good to see the historical context. The wavelet transform was originally introduced in geophysics by Morlet, and was basically a Gabor transform with a Window that grows and shrinks together with the selected scale/frequency. Later Daubchies (a physicist-ett from Belgium) realized that by choosing special orthogonal wavelet bases the infinitely redundant CWT can be critically sampled on a dyadic grid. From the resulting DWT the corresponding full CWT can be obtained by convolving the DWT with the reproducing kernel of the respective wavelet. The reproducing kernel is the CWT of the wavelet itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Daubchies findings gave a big boost to the wavelet theory in the early 80ies. The next big result was that the DWT can be computed very efficiently (this is sometimes called FWT [fast WT] as well) by using techniques from the theory of filterbanks, namely quadrature mirror filters (QMF) together with downsampling filterbanks. By constructing special QMFs the corresponding DWT can be computed via filtering and downsampling, which is the state-of-the-art algorithm to compute DWTs today. You do not need the scaling function to compute the DWT, it is just an implementation detail that FWT process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the application side the CWT is the more ideal candidate for signal or time series analysis due to its more fine grained resolution and is usually chosen in most tasks (e.g. singularity detection). The DWT is more of interest in the context of fast non redundant transforms. The DWT has a very good energy compactification and is thus a good candidate for lossy compressions and signal transmissions.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hope that clarified things.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2013-02-27T12:02:14.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8025" PostTypeId="2" ParentId="8023" CreationDate="2013-02-27T13:09:23.833" Score="3" Body="&lt;p&gt;Baring information content that contains verifiable historical landmarks, you can't date data .  Anything can be altered in a file, including the recorded content, so the data itself is no more reliable than a time stamp in a file header.  The normal assumption about data files is that they can be faithfully reproduced over and over without degradation, so there is no time information in the data itself.  You may be able to infer rough time estimates about the age of a recording based on certain qualities in the recording (assuming that the data has been unaltered).  For example a digital reproduction of an analog recoding that was originally mastered on a particular media has qualities that may be discernible upon analysis.  If you can identify qualities that indicate the type of equipment used to capture the audio and type of media the audio was captured on, you may be able to infer that the recording is from a certain time period.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-02-27T13:09:23.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8026" PostTypeId="2" ParentId="8022" CreationDate="2013-02-27T13:51:05.000" Score="1" Body="&lt;p&gt;When you are working with discrete sequences, frequency really becomes a different concept that &quot;real world&quot; frequency.  You can use analogy to relate information from discrete analysis back to the real world, but the two worlds are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, once you have converted a real time / continuous signal to a discrete version, you immediately change the data representation such that no frequencies above 1/2 the sampling rate can be represented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the concept of frequency in the discrete world, with regard to the FFT, is based on the Discrete Fourier Transform (DFT).  The DFT imposes a restriction on your analysis.  The DFT assumes that all data is periodic.  The longest period represented in the transform is based on the length of samples being analyzed.  The representation says that your data is composed of a finite number of evenly spaced (in frequency) periodic sequences.  The set of periodic sequences are thought of as frequency bins.  The number of frequency bins is equal to to the length of the data.  So if you have say 8 samples your are working with, there are 8 frequency bins.  Half of the frequency bins are &quot;reflections&quot; of each other (represent the same frequency) so you are now down to 4 bins.  Two bins fall into the DC component, so you are left with 3 periodic sequences to represent your data.  So in terms of the original random signal you are analyzing, by doing an FFT analysis, you converted the signal from random to a band limited periodic signal composed of a finite number of frequencies.  This is very different from a real world random signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your specific case, where you have computed fft([40 2 8 31 6 8 -4]), I don't know the mechanics of the specific FFT algorithm, but it looks like the data has been padded up to 8 samples, so you have a DC component and 3 additional periodic sequences.  Notice that the values ranging from 2 to 7 are symmetric around 4.5, so your periodic sequences are for frequencies represented by bins 2, 3 and 4 (5 is a reflection of 4, 6 is a reflection of 3 and 7 is a reflection of 2).  Bin 1 would be considered the period of the overall sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to consider the sampling rate to convert the bins back to real frequencies: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;bin# * SampleRate / NumberOfBins&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-02-27T13:51:05.000" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8027" PostTypeId="2" ParentId="8023" CreationDate="2013-02-27T15:46:18.203" Score="3" Body="&lt;p&gt;If there is some background hum due to AC mains interferences, you can match that with historical records of the fluctuation patterns in mains frequency within the electricity grid. &lt;a href=&quot;https://en.wikipedia.org/wiki/Electrical_network_frequency_analysis&quot; rel=&quot;nofollow&quot;&gt;Reference here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-02-27T15:46:18.203" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8028" PostTypeId="1" AcceptedAnswerId="8029" CreationDate="2013-02-27T16:16:48.550" Score="2" ViewCount="655" Body="&lt;p&gt;I have a long recording of a train (&lt;a href=&quot;http://www.qfpost.com/file/d?g=8v8s7J9Dm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here is a small sample&lt;/a&gt;) there are a number of clicks as the wheels go over joins in the tracks. I would like to detect the location of these. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the waveform:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JxpvQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There appear to be 8-10 clicks. Some are close together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that they appear as regions of sustained high amplitude. Is there a filter I could cross-correlate this with that would pick them out or is there another better method?&lt;/p&gt;&#xA;" OwnerUserId="4021" LastActivityDate="2013-02-27T17:04:12.200" Title="How can I detect clicks/ticks in a wav file?" Tags="|filters|fourier-transform|cross-correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8029" PostTypeId="2" ParentId="8028" CreationDate="2013-02-27T17:04:12.200" Score="6" Body="&lt;p&gt;Use an onset detector - a classic method is described in Duxbury's paper &quot;A combined phase and amplitude based approach to onset detection for audio segmentation&quot;. If you want a ready to use solution, you can use &lt;a href=&quot;http://www.sonicvisualiser.org/&quot; rel=&quot;noreferrer&quot;&gt;Sonic Visualizer / Sonic annotator&lt;/a&gt;, which can export onset positions as a text file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works well for your example, with only one false positive - which could be easily discarded by adding an additional threshold on the onset detection detection function (second curve) value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8p9EY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-02-27T17:04:12.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8031" PostTypeId="2" ParentId="1883" CreationDate="2013-02-27T23:01:57.287" Score="0" Body="&lt;p&gt;There is a very good technique developed back in the mid-80 by Gerig and Klein. It is a backmapping procedure that analyses the Hough space to identify the most likely point associated with each edge point and then constructs a second Hough space where the mapping of edge points to parameters is one-to-one rather than one-to-many which is the usual first stage. I don't have the reference to hand but look in the seminal Hough review paper of Illingworth and Kittler (about 1987?)&lt;/p&gt;&#xA;" OwnerUserId="4027" LastActivityDate="2013-02-27T23:01:57.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8032" PostTypeId="2" ParentId="1960" CreationDate="2013-02-27T23:07:53.050" Score="1" Body="&lt;p&gt;There is an algorithm from the mid 1980s by Kittler and Illingworth called &quot;Minimum Error Thresholding&quot; that solves this problem for Gaussian distributions. Recently Mike Titterington (University of Glasgow)  and J-H Xue (now at UCL) have put this in more formal statistics framework, see their joint journal publications.&lt;/p&gt;&#xA;" OwnerUserId="4027" LastActivityDate="2013-02-27T23:07:53.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8033" PostTypeId="2" ParentId="7901" CreationDate="2013-02-28T04:43:58.017" Score="1" Body="&lt;p&gt;This is by no means a complete answer but I think it will get you far enough to achieve what you want. Edit: maybe not.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;find main colours using kmeans&lt;/li&gt;&#xA;&lt;li&gt;assign main colours to different types (brown line, blue line, etc). Some appear in both&lt;/li&gt;&#xA;&lt;li&gt;clean up with morphology&lt;/li&gt;&#xA;&lt;li&gt;segment image&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I thought might work was to pick out the most common colours and classify each pixel by the nearest colour. Then classify each pixel by type (brown line, etc), where the colour class can belong to multiple type classes. This would hopefully solve the problem of gaps in the lines - i.e. the colour where blue crosses brown would belong to both type class and fill the gap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if it really does a better job. The issue with kmeans is that it uses random starting points so the colour classes were changing every time the script was run. I think I've fixed that now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if there is some code out there to connect the broken lines?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;% Read file&#xA;I = imread('mapdsp.jpg');&#xA;&#xA;% Reshape into 2D matrix of pixel colours&#xA;ir = reshape(I, [size(I,1) * size(I,2),3]);&#xA;&#xA;% Choose exact same sample points everytime&#xA;rng(0);&#xA;ir_indx = randi(size(ir,1),20,1);&#xA;ir_startpoints = ir(ir_indx,:);&#xA;&#xA;% Use k-means clustering to find most common colours&#xA;[ik,c,sk,sd] = kmeans(double(ir),20,'Start',double(ir_startpoints));&#xA;&#xA;% Show colours&#xA;cim = reshape(uint8(c),[1,20,3]);&#xA;image(cim); title('Colours'); pause;&#xA;&#xA;% Sort colours&#xA;chsv = rgb2hsv(c);&#xA;[~,cni] = sort(chsv(:,1),1);&#xA;cn = c(cni,:);&#xA;cnim = reshape(uint8(cn),[1,20,3]);&#xA;image(cnim); title('Sorted colours'); pause;&#xA;&#xA;% Get index of index &#xA;[~,cni2] = sort(cni);&#xA;&#xA;% Show pixels classified&#xA;in = reshape(cni2(ik,:), [size(I,1),size(I,2)]);&#xA;imagesc(in);  title('Pixel classification'); pause;&#xA;&#xA;&#xA;% Show each class&#xA;In = zeros(size(I));&#xA;for k = 1:20&#xA;    In(:,:,1) = I(:,:,1) .* uint8(in == k);&#xA;    In(:,:,2) = I(:,:,2) .* uint8(in == k);&#xA;    In(:,:,3) = I(:,:,3) .* uint8(in == k);&#xA;    image(uint8(In)); title (['Class ' num2str(k)]); pause;    &#xA;    im_dist(:,:,k) = reshape(sd(:,k), [size(I,1),size(I,2)]);&#xA;    imagesc(-im_dist(:,:,k) .* (in == k));  title('Pixel distance'); pause;&#xA;end&#xA;&#xA;% 12,19 and 20 blue lines&#xA;im_blue = (in == 13) | (in == 19) | (in == 20);&#xA;imagesc(im_blue); title('Blue lines'); colormap gray; pause;&#xA;im_blue = imopen(im_blue,strel('diamond',1));&#xA;imagesc(im_blue); title('Blue lines opened'); colormap gray; pause;&#xA;for k=1:3; In(:,:,k) = I(:,:,k) .* uint8(im_blue); end;&#xA;image(uint8(In)); pause;&#xA;imagesc(bwmorph(im_blue,'skel',Inf));&#xA;&#xA;% brown lines&#xA;im_brown = (in == 1) | (in == 2) | (in == 1) | ...&#xA;    (in == 7) | (in == 8) | (in == 11) | (in == 12) | (in == 13);&#xA;imagesc(im_brown); title('Brown lines'); pause;&#xA;im_brown = imopen(im_brown,strel('diamond',1));&#xA;imagesc(im_brown); title('Brown lines opened'); pause;&#xA;for k=1:3; In(:,:,k) = I(:,:,k) .* uint8(im_brown); end;&#xA;image(uint8(In)); pause;&#xA;imagesc(bwmorph(im_brown,'skel',Inf));&#xA;&#xA;% 9 - black line&#xA;im_black = (in == 10);&#xA;imagesc(im_black); title('Black lines'); pause;&#xA;im_black = imopen(im_black,strel('diamond',1));&#xA;imagesc(im_black); title('Black lines opened'); pause&#xA;for k=1:3; In(:,:,k) = I(:,:,k) .* uint8(im_black); end;&#xA;image(uint8(In)); pause;&#xA;imagesc(bwmorph(im_black,'skel',Inf));&#xA;&#xA;% 16,17,18 green area&#xA;im_green = (in == 16) | (in == 17) | (in == 18);&#xA;imagesc(im_green); title('Grean area'); pause;&#xA;im_green = imopen(im_green,strel('diamond',1));&#xA;imagesc(im_green); title('Green area opened'); pause;&#xA;im_green = imclose(im_green,strel('disk',7));&#xA;imagesc(im_green); title('Green area opened and closed'); pause;&#xA;for k=1:3; In(:,:,k) = I(:,:,k) .* uint8(im_green); end;&#xA;image(uint8(In)); pause;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2013-03-01T01:57:12.393" LastActivityDate="2013-03-01T01:57:12.393" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8034" PostTypeId="2" ParentId="8021" CreationDate="2013-02-28T04:51:26.153" Score="2" Body="&lt;p&gt;To solve the case that you mentioned...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have 2 variables to determine, so you need two relationships to resolve the two variables.  I'm going to use $k$ and $a$ as the variables to make this easy to type up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = k\frac{1 + z^-1}{1-az^-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start by considering the passband gain.  Use $f = 0$ for this.  Assume you want unity gain at $f_0=0$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume:  $H(f_0) = 1, f_0 = 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substitute $e^{i2\pi f/f_s}$ for $z$, $f_s$ is your sampling rate, set $f = 0$ and solve for $k$ to satisfy $H\left(f_0\right) = 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this you get $k = \frac{(1-a)}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now work on the gain squared at your desired corner frequency ($f_c$) to determine $a$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(f_c) = -3\textrm{ dB}$ (magnitude squared will be $-6\textrm{ dB}$ as you've stated)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll work with the magnitude squared at $f_c$ and set the gain to $1/2$ ($-6\textrm{ dB}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert H\left(f_c\right)\rvert^2 = \frac{1}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time substitute $e^{i2\pi fc/f_s}$ for $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To simplify the arithmatic you can solve this equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left(\frac{\lvert H(f_0)\rvert}{\lvert H(f_c)\rvert}\right)^2 = 2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This eliminates the factor $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will end up with a quadradic relationship in $a$.  Solving for $a$ yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a = \frac {1 - \sqrt{1-\cos^2\left(2\pi\frac{f_c}{f_s}\right)}} {\cos\left(2\pi\frac{f_c}{f_s}\right) }= \frac {1 - \sin\left(2\pi\frac{f_c}{f_s}\right)} {\cos\left(2\pi\frac{f_c}{f_s}\right) }&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="1629" LastEditDate="2016-05-31T18:58:02.827" LastActivityDate="2016-05-31T18:58:02.827" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8036" PostTypeId="1" CreationDate="2013-02-28T08:39:05.153" Score="0" ViewCount="2003" Body="&lt;p&gt;I need  a low cost DSP kit for learning purpose, along with development tools. One main requirement is to process a voice signal (8KHz sampling frequency), with a USB interface.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A friend of mine suggested that I can use my PC sound card as a DSP- at least for learning basic DSP for sound and speech processing. I would like to know if some body has already experimented with it, and thus can give me some pointers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start with, basic experiments  I will be doing are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Performing sampling of speech or music at different sampling frequency (so the quenstion is can I program the ADC/DAC of the sound card or not?), and play to see how it affects the sound quality&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Some kind of frequency analysis, using FFT and DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- Then do some kind of filtering, and then observe the sound quality&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4- Deliberately add noise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5- trying to put some phase distortion&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6- Using the above to develop a voice recognition system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;7- See performance of different type of filters (FIR, IIR)            &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is if I chose sound  card DSP, will I be able to perform the above tasks, are the software tools available for this purpose ?     &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="1598" LastEditDate="2013-02-28T13:28:43.317" LastActivityDate="2013-04-01T16:47:08.177" Title="Low cost DSP development kit" Tags="|dsp-core|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8037" PostTypeId="1" AcceptedAnswerId="8039" CreationDate="2013-02-28T09:57:20.893" Score="1" ViewCount="3629" Body="&lt;p&gt;I will be using the filter coefficients generated by MATLAB in my code that will run on a microcontroller. The poor microcontroller is very bad in floating point Arithmetic. So What do I do? Shall I directly truncate all float values to nearest int? shall I do ceil? or floor? Is there any function that can automatically do this conversion for me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; &#xA;All my filter coefficeints are coming like: 0.465, 0.76, 0.23 etc, so If I use ciel then all will become zero. What should I do now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actual Filter Coefficients are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; -0.00385638&#xA;&amp;gt;  0.004944457&#xA;&amp;gt;  0.01505063&#xA;&amp;gt;  0.018768283&#xA;&amp;gt;  0.009635631&#xA;&amp;gt; -0.01192891&#xA;&amp;gt; -0.035809426&#xA;&amp;gt; -0.045043857&#xA;&amp;gt; -0.023993426&#xA;&amp;gt;  0.032106934&#xA;&amp;gt;  0.111777547&#xA;&amp;gt;  0.18997355&#xA;&amp;gt;  0.238374966&#xA;&amp;gt;  0.238374966&#xA;&amp;gt;  0.18997355&#xA;&amp;gt;  0.111777547&#xA;&amp;gt;  0.032106934&#xA;&amp;gt; -0.023993426&#xA;&amp;gt; -0.045043857&#xA;&amp;gt; -0.035809426&#xA;&amp;gt; -0.01192891&#xA;&amp;gt; 0.009635631&#xA;&amp;gt; 0.018768283&#xA;&amp;gt; 0.01505063&#xA;&amp;gt; 0.004944457&#xA;&amp;gt; -0.00385638&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="1598" LastEditDate="2013-04-03T06:45:16.113" LastActivityDate="2017-10-05T03:40:22.537" Title="Filter Coefficients in MATLAB are always float data type" Tags="|filters|matlab|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8038" PostTypeId="1" AcceptedAnswerId="8044" CreationDate="2013-02-28T10:30:23.293" Score="1" ViewCount="418" Body="&lt;p&gt;Which approach is better or there is mathematical justification for using Bilater filter and Fourier Transform to decompose a image into High Frequency and Low Frequency Component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both Bilateral Filter and Fourier Transform can be used for getting High and Low Frequency component of an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is one approach is better than the other or are both same in getting high and low frequency component of a image, or are they used in some particular context of image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that Bilateral Filter uses range weights and Spatial weights into consideration for getting high and low frequency components.&lt;/p&gt;&#xA;" OwnerUserId="1757" LastEditorUserId="128" LastEditDate="2019-09-26T13:50:30.107" LastActivityDate="2019-09-26T13:50:30.107" Title="Which Approach Is Better for Decomposing an Image into High Frequency and Low Frequency Components?" Tags="|filters|fourier-transform|image-processing|multi-scale-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8039" PostTypeId="2" ParentId="8037" CreationDate="2013-02-28T11:05:47.917" Score="7" Body="&lt;p&gt;Normally you would use &lt;a href=&quot;http://en.wikipedia.org/wiki/Fixed-point_arithmetic&quot; rel=&quot;nofollow&quot;&gt;fixed-point arithmetic&lt;/a&gt; for performing DSP on a a floating-point-challenged CPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for, say, 16 bit fixed-point coefficients with a range of -1.0 to +1.0 your coeffs would translate to e.g.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.465    =&amp;gt;    0.465 * 0x7fff = 0x3b5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your microcontroller does not have direct support for fixed point arithemtic (most DSPs do, general purpose microcontrollers typically do not) then you'll need to take care of scaling when you multiply or divide. (Addition and subtraction work as normal of course, provided you are not mixing different fixed point types.)&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2013-04-03T09:37:22.783" LastActivityDate="2013-04-03T09:37:22.783" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8041" PostTypeId="2" ParentId="8036" CreationDate="2013-02-28T14:12:16.893" Score="6" Body="&lt;p&gt;You can do a lot for &quot;free&quot; by working with python/numpy.  You can work with .wav files.  Most computers have some kind of sound proceseeing hardware for audio I/O, but you may want to get a sound card if you're computer doesn't already have this.  You can record audio for processing using Windows Sound Recorder.  Numpy has tools for importing and exporting .wav files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to learn about DSP coding, get a development Kit from TI or Analog Devices.  These kits include a board with DSP, computer I/O (often via USB) and development tools for generating and debugging code.  Analog Devices seems to have the least expensive development kits.  Try something in the EZ-KIT family from Analog Devices.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-02-28T14:12:16.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8042" PostTypeId="1" AcceptedAnswerId="8045" CreationDate="2013-02-28T14:34:27.387" Score="1" ViewCount="400" Body="&lt;p&gt;I have been reading up on the pyramid match kernel as an alternative to using the bag-of-words model for object classification using a SVM. The bag-of-words model provides a model for transforming a set of features to a single feature vector, however im confused as to how the pyramid match kernel can be used for this task, for instant if a SVM has been trained using a pyramid match kernel how do I present a test image represented by a set of feature vectors to the SVM as, as far as I can tell the kernel generates some feature space F(x) but provides no mapping to this space. Could someone please give a brief description of how this works?&lt;/p&gt;&#xA;" OwnerUserId="3217" LastEditorUserId="53" LastEditDate="2013-03-01T01:20:17.353" LastActivityDate="2013-03-01T02:00:42.653" Title="Object Classification using pyramid match kernel" Tags="|computer-vision|classification|object-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8043" PostTypeId="2" ParentId="8010" CreationDate="2013-02-28T18:23:21.240" Score="5" Body="&lt;p&gt;As the other answers mention, the use of FEC results in post-decoding errors occurring &#xA;in bursts. Indeed, this happens regardless of whether the code is a convolutional code&#xA;or a block code.  With a $(n,k)$ block code, the decoder output ($k$ bits)&#xA;from the decoding of one &#xA;received word is (hopefully with high probability) completely correct, or it has &#xA;an unknown number of errors in it that can be regarded as a burst error of length $k$.&#xA;With a convolutional code, the decoder output is mostly correct as the decoder&#xA;finds the correct path through the trellis, but occasionally the decoder's&#xA;chosen path &lt;em&gt;deviates&lt;/em&gt; from the correct path and later &lt;em&gt;rejoins&lt;/em&gt; the correct &#xA;path during which time there is a burst of errors. In contrast to&#xA;block codes, there can be multiple&#xA;isolated burst errors (of variable lengths) in a single transmission&#xA;using a convolutional code. Also, the number of data bits in a single&#xA;transmission is far larger than the typical values of $k$ for a&#xA;block code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea behind a concatenated&#xA;coding scheme is that with an inner code suited to the physical channel,&#xA;and an outer code over a &lt;em&gt;very large symbol alphabet&lt;/em&gt;, we can make&#xA;the burst errors in the inner decoder output look like a &lt;em&gt;single&#xA;symbol error&lt;/em&gt; to the outer code.  This is important because the&#xA;outer code should be a very high rate code because the net rate&#xA;is product of the inner code rate (more or less determined by&#xA;the channel and the link budget) and the outer code rate. &#xA;Unfortunately, outer codes over very large alphabets are very&#xA;expensive to implement, and so interleaved Reed-Solomon codes&#xA;over smaller alphabets (often GF$(2^8)$ ) are used (with &#xA;interleaving at the symbol&#xA;level, as Jim Clay points out). Because of the interleaving, the burst&#xA;errors in the inner decoder output become single symbol (byte) errors in the&#xA;received words of the interleaved Reed-Solomon code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the above is mostly a rehash of what the answers by Bryan and&#xA;Jim Clay have already said, but I wish to point out the following.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Interleaved Reed-Solomon codewords can be decoded much more&#xA;  efficiently and with smaller delay if they are &lt;em&gt;not&lt;/em&gt; de-interleaved&#xA;  first.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;http://www.vlsi.csl.uiuc.edu/~shanbhag/publications/sarwt-tvlsi-2001.pdf&quot; rel=&quot;noreferrer&quot;&gt;Reed-Solomon decoder&lt;/a&gt; that can decode interleaved codewords is different from&#xA;the off-the-shelf standard Reed-Solomon&#xA;decoders that are available, and the use of such a decoder might not be&#xA;feasible if the development team does not have control of this aspect of&#xA;the design. But, if such a decoder is used, the de-interleaver&#xA;can be moved from the between the inner decoder and outer decoder to&#xA;just after the outer decoder. The de-interleaver is also &lt;em&gt;smaller&lt;/em&gt; since&#xA;it has to deinterleave a $K\times L$ array instead of a $N \times L$&#xA;array (for a $(N.K)$ Reed-Solomon code interleaved to depth $L$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If a &lt;em&gt;delay-scaled&lt;/em&gt; Reed-Solomon &lt;em&gt;encoder&lt;/em&gt; is used along with the&#xA;  Reed-Solomon decoder for interleaved codewords described above, the interleaver&#xA;  at the transmitter and the de-interleaver at the receiver&#xA;  can be eliminated entirely.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The output of the delay-scaled&#xA;encoder (see also &#xA;&lt;a href=&quot;http://ieeexplore.ieee.org/iel5/4586217/4594928/04595370.pdf?&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; &#xA;which is unfortunately behind a paywall)&#xA;is a set of &lt;em&gt;interleaved&lt;/em&gt; Reed-Solomon codewords, but&#xA;is &lt;em&gt;not&lt;/em&gt; the same sequence of bytes that one would get from&#xA;doing a standard Reed-Solomon encoding followed by interleaving.&#xA;So, no further interleaving is necessary.&#xA;The output of the interleaved Reed-Solomon decoder is the&#xA;same byte sequence in the same order that went into the &lt;em&gt;delay-scaled&lt;/em&gt;&#xA;Reed-Solomon encoder, and so no de-interleaving is necessary&#xA;at the decoder, either.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-02-28T21:33:46.777" LastActivityDate="2013-02-28T21:33:46.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8044" PostTypeId="2" ParentId="8038" CreationDate="2013-02-28T21:26:17.577" Score="2" Body="&lt;p&gt;The bilateral filter is just that: a filter. It does not decompose the image into anything. It just attenuates &quot;medium&quot; frequency content in a clever manner. In other words, it smooths things that are mostly smooth further, and leaves sharp edges sharp. What you are left with has more low and high frequency content (on a relative basis) than what you started with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform, on the other hand, actually does reveal the entire spectrum for an image. Unlike a filter, it does not change the information content of an image. It just rearranges it into the frequency, rather than spatial, domain. The bilateral filter does not reveal the spectral content of an image, so really only the Fourier transform (or one of its related transforms, like cosine and wavelet) can be used to get the high and low frequency components of an image.&lt;/p&gt;&#xA;" OwnerUserId="1278" LastActivityDate="2013-02-28T21:26:17.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8045" PostTypeId="2" ParentId="8042" CreationDate="2013-03-01T02:00:42.653" Score="2" Body="&lt;p&gt;The pyramid match kernel does not operate on the sets of feature vectors directly.  It operates on multi-level histograms of feature vectors. Let's say you are using the SIFT descriptors, which live in 128-dimensional space.  First you divide each dimension into 2 bins, which divides the entire feature space into $2^{128}$ bins. Then you count how many features fall into each bin.  This is the first level of your histogram.  Then you divide each dimension into 4 bins, and so on. Luckily, this histogram is going to be very sparse, so you only need to allocate the memory for non-zero bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do this for the training images, and the images that you want to classify.  Then the pyramid match kernel is simply the intersection of two histograms. &lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-03-01T02:00:42.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8046" PostTypeId="2" ParentId="6448" CreationDate="2013-03-01T03:14:32.293" Score="2" Body="&lt;p&gt;I'm not sure I can find your quote, but I can mention a few books of the past 30 years that leaned at least somewhat toward the practical advice rather than toward the more purely theoretical/mathematical/snooty. (One of the more &quot;theoretical&quot; textbooks I've read simply regurgitated pages of math from an earlier textbook, complete with the exact same glaring typo.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Digital Picture Processing&lt;/strong&gt; by Rosenfeld and Kak is a classic. My editions of Volume 1 and Volume 2 have a copyright of &lt;strong&gt;1982&lt;/strong&gt;. Volume 1 covers more of the fundamentals of the mathematics &amp;amp; image formation, and Volume 2 digs into practicalities of segmentation, matching, etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Computer Vision&lt;/strong&gt; by Ballard and Brown, also from &lt;strong&gt;1982&lt;/strong&gt;, is even today a useful reference for those who have to make a vision system work. This book is a bit friendlier in terms of presenting real images and also color plates. There are pseudocode algorithms and several useful formula (e.g. RGB to HSI color space). They make a number of useful practical points about the application of algorithms, and they might have written something similar to the quote you mention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Applying Machine Vision&lt;/strong&gt; by Nello Zuech was published in &lt;strong&gt;1988&lt;/strong&gt;. My later edition is named &lt;strong&gt;Understanding and Applying Machine Vision&lt;/strong&gt;. Unlike the other books I mention, Zuech's book is more of a practical guide for engineers who have to specify, install, maintain, and possibly modify vision systems. The list price for Zuech's book is $200 on Amazon, but if you do a search you may find other sources. He has so many checklists, decision matrices, etc., that the book is great as a general reference. That book or something else Zuech wrote could have been your source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Digital Image Processing&lt;/strong&gt; by Gonzalez and Woods (1st edition &lt;strong&gt;1992&lt;/strong&gt;) is a commonly used textbook, and it's reasonably chatty in tone, although there's not much (that I remember) about system integration or lighting. Also check out their website &lt;a href=&quot;http://www.imageprocessingplace.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.imageprocessingplace.com/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Machine Vision: Theory, Algorithms, Practicalities&lt;/strong&gt; by E.R. Davies (1st edition &lt;strong&gt;1990&lt;/strong&gt;, 3rd edition, &lt;strong&gt;2006&lt;/strong&gt;) is one of the better textbooks examining the real work required to solve an application. The algorithms as a rule are the simpler ones, but Davies digs in and examines not only where an algorithm might be applied, but the practical results of doing so. That said, it's probably too recent to be your source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of all those, Zuech's book is most oriented to the practical assessment of a complete system. Even if he's not your source, it's good to have a copy of his work. &lt;/p&gt;&#xA;" OwnerUserId="742" LastEditorUserId="-1" LastEditDate="2013-03-01T20:25:10.303" LastActivityDate="2013-03-01T20:25:10.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8047" PostTypeId="1" AcceptedAnswerId="8083" CreationDate="2013-03-01T07:08:22.413" Score="1" ViewCount="4131" Body="&lt;p&gt;In my time series data, I have often spikes with regular periods. Sometimes, I get two or three different periodical spike sequences (two electrical noise sources), some with T1 seconds period, some with T2 second period and some irregular and at random times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say I have two groups of overlapping periodical spikes in my data, one with a period of 8 seconds and another with 6. I have zeroed the data except for the times where there is spikes. So, my data now looks like a train of spikes. How can I find the periodicity of the two and separate the two groups? Cross-correlation didn't help as many are just single sample spikes. I was thinking of FFT. But I can't see anything in the spectra at those low frequencies, nor when I use FFT on original data. My data has 500 Hz. sampling frequency. I do not want to remove them, just to find the periodicity. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2013-03-04T17:36:06.633" Title="Finding periodicity of spikes, matlab" Tags="|fft|cross-correlation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8048" PostTypeId="1" AcceptedAnswerId="8056" CreationDate="2013-03-01T09:07:19.190" Score="2" ViewCount="3812" Body="&lt;p&gt;This seems like a trivial concept but I just can't get the hold of it. I have a signal with two complex sinusoids having frequencies -25MHz and 17MHz. Currently it is being sampled at 64MHz so I get two peaks of fft at -25MHz and 17 MHz. If I throw every other sample away the component at 17MHz shifts to -30MHz and the one at -25MHz to 14 MHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it is due to the aliasing/folding but why exactly are these frequency components present in the aliased signal? Is there any way to predict the frequency content of the aliased signal without looking at the fft? What spectrum should I get if every fourth sample is dropped (i.e. sampling frequency now becomes 16MHz)?&lt;/p&gt;&#xA;" OwnerUserId="4037" LastActivityDate="2013-03-01T15:17:02.940" Title="How to predict the spectrum of an aliased/folded signal without looking at the FFT?" Tags="|fft|discrete-signals|frequency-spectrum|sampling|aliasing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8049" PostTypeId="1" AcceptedAnswerId="8050" CreationDate="2013-03-01T09:54:11.350" Score="0" ViewCount="1367" Body="&lt;p&gt;I'm confused as what is the difference between these two sine wave equations&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(t) = Sin(2*pi*F*t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(t) = Sin(2*pi*F*nTs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x(t) = Sin(2*pi*F*t)&lt;/code&gt; is supposed to be used with analog signal, here &lt;code&gt;t&lt;/code&gt; is supposed to me the samples when speaking of matlab.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = 4;       %Amplitude&#xA;Freq = 100;&#xA;Time = 1/Freq; %0.01&#xA;Fs = 1000;      %Sampling Frequency &#xA;Ts = 1/Fs;   %Sampling Rate &#xA;t = 0:Ts:(Time); &#xA;x=A*sin(2*pi*Freq*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YXMQ4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly if I use the stem command than a plot command I will get the sampled values instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tj4VC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm getting the sampled result from the first equation than what is the purpose to replace &lt;code&gt;t&lt;/code&gt; by &lt;code&gt;nTs&lt;/code&gt; in the equation and using the second equation ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't be able to demonstrate the difference and visualize it in Matlab. Kindly guide me.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="39" LastEditDate="2013-03-01T10:04:16.933" LastActivityDate="2013-03-01T10:04:16.933" Title="Difference between two Sine wave equations" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8050" PostTypeId="2" ParentId="8049" CreationDate="2013-03-01T09:59:00.103" Score="5" Body="&lt;p&gt;The first equation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(t) = Sin(2*pi*F*t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is for a &lt;em&gt;continuous&lt;/em&gt; (&quot;analogue&quot;) signal, where &lt;code&gt;t&lt;/code&gt; may take any real value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second equation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(t) = Sin(2*pi*F*n*Ts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I assume that this is the correct version - it looks like you have a typo in the question ?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is for a &lt;em&gt;discrete&lt;/em&gt; (&quot;sampled&quot; or &quot;digital&quot;) signal, where &lt;code&gt;n&lt;/code&gt; is the sample number (integer) and &lt;code&gt;Ts&lt;/code&gt; is the sample interval (inverse of sample rate). It has values only at the discrete sampling points where &lt;code&gt;t = n * Ts&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your MATLAB code you are effectively sampling a continuous function, so although you start off with the first (continuous) equation you end up with the second equation because you are only evaluating (sampling) the continuous function at a set of discrete points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that as &lt;code&gt;Ts -&amp;gt; 0&lt;/code&gt; the discrete version tends towards the continuous version.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2013-03-01T09:59:00.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8051" PostTypeId="1" AcceptedAnswerId="8054" CreationDate="2013-03-01T11:30:45.943" Score="9" ViewCount="5078" Body="&lt;p&gt;I'm successfully soft-decoding D-BPSK by taking the dot-product of the constellation-position of the symbol and of the previous symbol.  If the result is &gt;= 1, then the symbol phase hasn't changed and the bit is a zero.  If the result is &amp;lt;= -1 then the phase has shifted and the result is a one.  In between -1 and 1 the result is a soft 0 or soft 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out how to do the same thing with D-QPSK.  I can use just the phase, but this throws away a lot of information that could help the soft-decoder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://tinyurl.com/cv3p2ms&quot; rel=&quot;noreferrer&quot;&gt;This paper&lt;/a&gt; explains how to do it and gives a formula (10):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$b_1 = \mathrm{Re}\{s_n s^*_{n-1}\}, b_2 = \mathrm{Im}\{s_n s^*_{n-1}\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't understand the notation — what does a &lt;code&gt;*&lt;/code&gt; floating above mean?  I tried just multiplying the complex numbers and taking the real and imaginary parts but this didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the constellation can rotate, how can the two axes be teased apart?&lt;/p&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="29" LastEditDate="2013-03-04T20:52:18.887" LastActivityDate="2019-08-06T14:44:10.337" Title="How to soft decode DQPSK?" Tags="|modulation|demodulation|bpsk|channelcoding|qpsk|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8052" PostTypeId="2" ParentId="8051" CreationDate="2013-03-01T13:15:37.450" Score="3" Body="&lt;p&gt;The asterisk refers to a complex conjugate. One typical method for soft decoding of differential modulations is the &lt;em&gt;delay, conjugate, multiply&lt;/em&gt; technique:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;S_i = D_i D_{i-1}^*&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $D_i$ and $D_{i-1}$ are two consecutive differentially-encoded symbols and $S_i$ is the differentially-decoded result. This general formula will work for DBPSK or DQPSK (since BPSK signals are real, the conjugate just drops out). The resulting signal stream $S_i$ lies on the same constellation as the input, so you can make hard decisions using the same rules you would for normal BPSK or QPSK.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-03-01T13:15:37.450" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8053" PostTypeId="2" ParentId="8037" CreationDate="2013-03-01T14:09:42.377" Score="0" Body="&lt;p&gt;Fixed point signal processing is a lot more complicated than floating point. The fixed point related problems include: quantization noise, coefficient quantization, overflow, underflow, saturation, limit cycles, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, writing an IIR filter in fixed point, requires fairly thorough analysis of the filter topology, input &amp;amp; output signal statistics, state variable behavior and the filter transfer function as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you have a very simple task, say a low order FIR filter with well known coefficients, I recommend some text book study.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-03-01T14:09:42.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8054" PostTypeId="2" ParentId="8051" CreationDate="2013-03-01T14:46:49.593" Score="5" Body="&lt;p&gt;Two successive symbols in the demodulator are &lt;span class=&quot;math-container&quot;&gt;$Z_1 = (X_1,Y_1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2 =(X_2,Y_2)$&lt;/span&gt; &#xA;where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is&#xA;the output of the I branch and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; the output of the Q branch of the receiver. The &#xA;&lt;em&gt;hard-decision&lt;/em&gt; DBPSK decision device considers the question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is the new symbol &lt;span class=&quot;math-container&quot;&gt;$Z_2$&lt;/span&gt; closer to the old symbol &lt;span class=&quot;math-container&quot;&gt;$Z_1$&lt;/span&gt; or to the&#xA;  &lt;em&gt;negative&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$-Z_1$&lt;/span&gt; of the old symbol?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and thus compares&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(X_2-X_1)^2 + (Y_2-Y_1)^2 \gtrless (X_2+X_1)^2 + (Y_2+Y_1)^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be simplified to a sign comparison on &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1,Z_2\rangle = X_1X_2+Y_1Y_2$&lt;/span&gt;.&#xA;Note that this is essentially asking &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are the two &lt;em&gt;vectors&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$Z_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2$&lt;/span&gt;&#xA;  are pointing in roughly the same direction (in which case the inner product &#xA;  or dot product is positive) or in roughly opposite direction (in which case&#xA;  the dot product is negative)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A third viewpoint thinks of &lt;span class=&quot;math-container&quot;&gt;$Z_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2$&lt;/span&gt; as&#xA;&lt;em&gt;complex&lt;/em&gt; numbers and asks&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is &lt;span class=&quot;math-container&quot;&gt;$\text{Re}(Z_1Z_2^*) = X_1X_2+Y_1Y_2$&lt;/span&gt; positive or negative?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;soft decision&lt;/em&gt; decision device simply&#xA;passes on the exact value of the dot product to the soft decision decoder&#xA;which may opt to quantize dot products that are very large in magnitude&#xA;into hard decisions and continue waffling on the rest.  This is what &#xA;the decision rule stated in the OP's question is, where large is taken as&#xA;exceeding &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In DQPSK, the &lt;em&gt;encoding&lt;/em&gt; uses one of two conventions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the signal phase is &lt;em&gt;delayed&lt;/em&gt; by &lt;span class=&quot;math-container&quot;&gt;$0, \pi/2, \pi, 3\pi/2$&lt;/span&gt; according&#xA;as the dibit to be transmitted is &lt;span class=&quot;math-container&quot;&gt;$00, 01, 11, 10$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the signal phase is &lt;em&gt;advanced&lt;/em&gt; by &lt;span class=&quot;math-container&quot;&gt;$0, \pi/2, \pi, 3\pi/2$&lt;/span&gt; according&#xA;as the dibit to be transmitted is &lt;span class=&quot;math-container&quot;&gt;$00, 01, 11, 10$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that a DQPSK signal is &lt;strong&gt;not&lt;/strong&gt; the sum of two DBPSK signals&#xA;modulated on phase-orthogonal carriers, but the I and Q bits&#xA;&lt;em&gt;jointly&lt;/em&gt; affect the net carrier phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For demodulating a DQPSK signal, the decision device needs to ask&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Which of the &lt;em&gt;four&lt;/em&gt; symbols &lt;span class=&quot;math-container&quot;&gt;$Z_1,\quad jZ_1 = (-Y_1,X_1),\quad -Z_1,\quad -jZ_1 = (Y_1,-X_1)$&lt;/span&gt;&#xA;  is &lt;span class=&quot;math-container&quot;&gt;$Z_2$&lt;/span&gt; closest to? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thus, in addition to the comparison&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(X_2-X_1)^2 + (Y_2-Y_1)^2 \gtrless (X_2+X_1)^2 + (Y_2+Y_1)^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it is necessary to compare&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(X_2+Y_1)^2 + (Y_2-X_1)^2 \gtrless (X_2-Y_1)^2 + (Y_2+X_1)^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which works out to looking at &lt;span class=&quot;math-container&quot;&gt;$\text{Im}(Z_1Z_2^*)$&lt;/span&gt; in&#xA;addition to &lt;span class=&quot;math-container&quot;&gt;$\text{Re}(Z_1Z_2^*)$&lt;/span&gt; and making the decision&#xA;according as which quantity has the largest magnitude&#xA;and the &lt;em&gt;sign&lt;/em&gt; of the largest magnitude.  The details&#xA;of how the soft-decision decoder uses the decision&#xA;statistic &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2^* = (\text{Re}(Z_1Z_2^*), \text{Im}(Z_1Z_2^*))$&lt;/span&gt;&#xA;will determine how these numbers are further&#xA;massaged.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2019-08-06T14:44:10.337" LastActivityDate="2019-08-06T14:44:10.337" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8055" PostTypeId="2" ParentId="8048" CreationDate="2013-03-01T14:54:40.310" Score="1" Body="&lt;p&gt;Based on your post, you are down sampling you're signals by a factor of 2, so your new aliased frequencies should also be devided by this factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;New Sampling rate (fs2):  32MHz&#xA;New Nyquist frequency:    16MHz.&#xA;Aliased freuencies fa:    7MHz,  15MHz&#xA;Actual frequencies fx:   -25MHz, 17MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To keep things simple I'll work with positive frequency first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signals to be sampled are less than the new sampling rate, you can calculate the aliased frequencies as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fa = |fs2 - fx|&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we consider the original frequencies (fx) as positive (17MHz and 25MHz)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;17MHz ---&gt; fa = 32MHz - 17MHz = 15MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;25MHz ---&gt; fz = 32MHz - 25MHz =  7MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you have a negative frequency to deal with you have to handle the negative frequency as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fa = |-fs2-fx| = |-32MHz - (-25MHz)| = 7MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a frequency greater than the new sample rate (fs2 = 32MHz) you have to modifiy the value of fs2.  The new value is the integer multiple of fs2 that is closest to the frequency of the signal to be sampled.  I'll call the modified value Nfs2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if fx was 33MHz, you would use Nfs2' = (1)*fs2 = 32MHz because 32MHz is the closed integer multiple of 32MHz to 33MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would yeild fa = |33MHz - 32MHz| = 1MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If fx was 63MHz, you would use Nfs2 = 64MHz ( 2*32MHz is closest to 63MHz ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This yields fa = |63MHz - 64MHz| = 1MHz&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-03-01T15:05:39.537" LastActivityDate="2013-03-01T15:05:39.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8056" PostTypeId="2" ParentId="8048" CreationDate="2013-03-01T15:05:34.953" Score="3" Body="&lt;p&gt;Your description of the situation is faulty.  A complex signal sampled at 64 MHz can represent frequencies from -32 MHz to +32 MHz, so the presence of tones at -25 MHz and +17MHz is fine.  However, when you decimate by two the sample rate drops to 32 MHz, and the frequency range becomes -16 MHz to +16 MHz.  In other words, you can't have a signal at -30 MHz afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aliasing shifts the signals down to the new Nyquist zone (the region between the negative and positive Nyquist frequencies, -16 MHz and +16 MHz respectively).  -25 MHz is 9 MHz below the negative Nyquist frequency so it is shifted up by 32 MHz (the width of the Nyquist zone) to +7 MHz.  +17 MHz is 1 MHz above the positive Nyquist frequency, so it is shifted down by 32 MHz to -15 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cuxwW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture above shows the before (top plot) and after (bottom plot) frequency spectrum.  It was created with the following Matlab commands:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sig = exp(j*(1:1000)*2*pi*-25E6/64E6) + exp(j*(1:1000)*2*pi*17E6/64E6);&#xA;freq = -32E6:64E6/1000:32E6;&#xA;dec = sig(1:2:end);&#xA;freqDec = -16E6:64E6/1000:(16E6-1);&#xA;subplot(2,1,1)&#xA;plot(freq, 20*log10(abs(fftshift(fft(sig)))))&#xA;subplot(2,1,2)&#xA;plot(freqDec, 20*log10(abs(fftshift(fft(dec)))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: I see that you largely had the right idea when you calculated the aliased frequencies.  The only mistake that you made was to not divide the frequencies by 2 due to the decimation.  Thus, -30 MHz should have been -15 MHz, and 14 MHz should have been 7 MHz.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-03-01T15:17:02.940" LastActivityDate="2013-03-01T15:17:02.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8057" PostTypeId="1" AcceptedAnswerId="8064" CreationDate="2013-03-01T16:21:08.553" Score="1" ViewCount="917" Body="&lt;p&gt;I'm so happy that i managed to come at this level to understand Wavelet transform to some extent with the help of Stackexchange fellows, Initially i had so many difficulties as i had no concept of Frequency Domain, then I realized that in order to Understand DCT it is mandatory to have basic idea of Co-relation. After studying different books I managed to understand how Wavelets works and how it plot its plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is when I am analyzing the noissin signal in Matlab Wavelet Toolbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yjxl2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The db4 wavelet is used here with scaling of 1-48 and step size equals to 1.&#xA;The first Plot is the original signal and the second plot is its Wavelet tranform which seems easy enough to understand now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but what are the other two plots (3rd and 4th) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the book says that Wavelet transform plots time vs scale plot and the inverse of scaling is the frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the scaling levels are 1-48 , so what are the frequencies supposed to be, &#xA;are they , 1/1 , 1/2, 1/3, 1/4, .....1/48 ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-03-02T00:21:08.157" Title="1-D Wavelet Toolbox in Matlab" Tags="|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8058" PostTypeId="1" AcceptedAnswerId="8059" CreationDate="2013-03-01T16:36:06.077" Score="5" ViewCount="1276" Body="&lt;p&gt;While we are decomposing a signal using Wavelets into levels why do we call our high frequency components as Detail and Low Frequency Components as Approximation ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-03-06T11:57:34.723" Title="Why Low Frequency called Approximation and High Frequency Detail?" Tags="|wavelet|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8059" PostTypeId="2" ParentId="8058" CreationDate="2013-03-01T16:59:12.133" Score="6" Body="&lt;p&gt;Intuitively speaking, anything that is 'high frequency' is something that is 'rapidly changing in time'. Anything that is 'low frequency' is something that is 'slowly changing in time'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think about it, any time you have 'detail' in a signal or image, it means that you have, very quick, rapid variations in time or space. This then becomes the 'detail' of your signal/image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, if you just care about how something changes generally, you care about long-term trends - you dont care about how things change with every sample, you just care about how things change over a long time, or over long space. In this case, you just want to 'approximate' your signal. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-03-01T16:59:12.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8060" PostTypeId="2" ParentId="7854" CreationDate="2013-03-01T18:09:51.470" Score="2" Body="&lt;p&gt;Personally, I'd use whatever filtering scheme the actual receiver uses. If the narrow-band CW filter is exactly this, or even close, I'd use that. Then try to automatically (or manually) determine the regions where the signal is present. Measure the average power in the &quot;off&quot; regions, and that will be N. Measure the average power in the &quot;on&quot; regions, and that will be S+N. S = S+N - N, and then take 10*log10( S / N ). This will give you S/N ratio for the bandwidth of the narrow-band filter.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastActivityDate="2013-03-01T18:09:51.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8061" PostTypeId="2" ParentId="8022" CreationDate="2013-03-01T18:35:23.070" Score="1" Body="&lt;p&gt;Not trying to be negative, but your questions don't make much sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: In Random sequence I mentioned above have total of 7 samples, but What it its period ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A1: There is no period of a random sequence.  If something is periodic, there will be repeated sections.  If you know a section will be repeated, that is not thought of as random.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: What it is the time between each Sample in this signal since it is totally random ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A2: The time between each sample is Ts.  randn(7,1) has no sample rate.  If you want it to represent 7 random numbers sampled at 8Hz, then the time between each sample is 1/8 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q3: How could this sequence represents more than 1 frequency ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A3: With out going in to examples, a random sequence, &lt;em&gt;by definition&lt;/em&gt; must represent more than one frequency.  Anything that is not a single sinusoid will represent more than one frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plots are helpful in explaining the scenario, but you may want to revise your questions.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastActivityDate="2013-03-01T18:35:23.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8062" PostTypeId="1" AcceptedAnswerId="8065" CreationDate="2013-03-01T20:52:00.683" Score="2" ViewCount="2253" Body="&lt;p&gt;I have a waveform containing &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;voice&lt;/li&gt;&#xA;&lt;li&gt;some children screaming&lt;/li&gt;&#xA;&lt;li&gt;some times when there is no noise at all&lt;/li&gt;&#xA;&lt;li&gt;some times there are cars driving by when talking&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I want to detect the start and ending times of the loudest voice or the areas in which the same speaker is talking to cut them out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did was a FFT on the waveform to realize that voice means there is(in a small time unit of a few ms) always a high amplitude at the base frequency to be followed by equidistant frequencies, being apart in the integral multiple of the base frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this also applied to some noises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal is to detect voice and cut the parts containing voice out(ie. keep them) with all background sounds. It is not about only having voice but finding out where voice is and cutting it out with all cars children or whatever was surrounding the microphone while recording. The problem is that I get many false positives when music(no voice) is being played or some squealing sound can be heard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is a better approach to filter out the times voice is at in a wav file with these given features?&lt;/p&gt;&#xA;" OwnerUserId="4039" LastEditorUserId="4039" LastEditDate="2013-03-02T19:40:28.033" LastActivityDate="2013-03-07T20:26:00.483" Title="About voice filtering" Tags="|fft|filters|voice|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8063" PostTypeId="1" AcceptedAnswerId="8107" CreationDate="2013-03-01T22:22:02.850" Score="0" ViewCount="322" Body="&lt;p&gt;I've been Googling &quot;FIR filters&quot; and &quot;FFT convolution&quot; etc. and I ran across something interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Array Index vs. Pointers:&#xA;&lt;a href=&quot;http://www.bores.com/courses/intro/program/7_array.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.bores.com/courses/intro/program/7_array.htm&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.dspguru.com/dsp/tricks/fir-filtering-in-c&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguru.com/dsp/tricks/fir-filtering-in-c&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, here's my question:&#xA;Why is almost every &quot;Fast!!&quot; Fourier Transform function on the web using Array Indexing?&#xA;(I just thought I would throw it out there.)&lt;/p&gt;&#xA;" OwnerDisplayName="user3981" LastActivityDate="2013-03-06T15:10:13.550" Title="FFT Data Array Indexing" Tags="|fft|algorithms|c|" AnswerCount="2" CommentCount="7" ClosedDate="2013-03-06T19:26:51.593" ContentLicense="CC BY-SA 3.0" />
  <row Id="8064" PostTypeId="2" ParentId="8057" CreationDate="2013-03-01T23:35:58.573" Score="2" Body="&lt;p&gt;&quot;but what are the other two plots (3rd and 4th) ?...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good questions.  This is the way I understand the two diagrams:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Wavelet transform can be thought of as a bank of filters with progressively wider bandwidths (working from the bottom to the top of figure 1).  If you look at the output of the transform for a specific scale (e.g. scale 24) such as figure 3, you can think of this graph as a plot of your original signal after it has been passed through a bandpass filter where the characteristics of the filter are defined by the wavelet and the particular scale (24).  This plot is the magnitude of the signal in the particular passband at sequential increments of time.  If you reconstructed your signal from these coefficients you would end up with the signal resulting from the bandpass filter at that scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4)-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The continuous wavelet transform is particularly good at making irregularities in a signal &quot;visible.&quot;  In this context, an irregularity is a discontinuity or a sharp change or &quot;cusp&quot; in your signal.  When sharp changes occur in a signal, the CWT will produce large coefficient values across many or all scales around the time of the irregularity.  The function that produced diagram 4 attempts to locate such irregularities by examining the peak values of the CWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from your data, this is not an exact science.  You're data doesn't really contain any &quot;irregularities&quot;, but the algorithm picked up on some random changes and produced an output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of processing is mostly useful in cases where the signal of interest is fairly regular but includes occasional sharp deviations.  Imagine what would happen if you had a voice signal and you lost 30 contiguous samples (VoIP packet loss) and then spliced the signal back together.  The resulting signal would be relatively smooth, but where the packet loss happened, the signal would have a sudden change in value.  The &quot;local maxima&quot; plot can reveal the location of this kind of disturbance in your data. &lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-03-02T00:21:08.157" LastActivityDate="2013-03-02T00:21:08.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8065" PostTypeId="2" ParentId="8062" CreationDate="2013-03-02T01:08:49.517" Score="3" Body="&lt;p&gt;I don't think filtering is the way to go. The spectra of the different signals (the desired voice, the screamy children and the cars) are probably overlapping, so there is no real way to get rid of all that noise without spoiling your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, the approach would depend in how loud the noise is in comparison to the signal. If the speaker is near the microphone, and therefore the relative noise level is ''low'', this sounds like a &lt;a href=&quot;http://en.wikipedia.org/wiki/Voice_activity_detection&quot; rel=&quot;nofollow&quot;&gt;VAD&lt;/a&gt; kind of problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If noise level is quite low, an energy-based VAD may work: after &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;windowing&lt;/a&gt; the input signal (let's say to 20ms windows), each window's energy can be computed. Then, a threshold can be applied in order to decide if that window is noise or voice. You would simply discard the windows that aren't load enough to meet the threshold. This is unarguably the simplest approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple improvement to this kind of VAD, assuming you only have one speaker, is to reduce the bandwidth in which you apply the stated algorithm. This way, if the kids voice spectrum begins at about e.g. 500Hz, and the cars induce some low frequencies up to e.g. 80Hz, you could use a band pass (e.g. 100Hz - 300Hz, assuming the speaker fundamental frequency is about 200Hz) filtered signal to decide wether each window is or isn't noise, and select those who aren't in the original signal. I know this is not ideal, as too many coincidences are needed to have a reliable system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, this won't work when noise gets louder. Furthermore, some phonems may be discarded due to their low energy, such as /s/ or /z/. This just makes speech sound weird. There are some more advanced VAD techniques such as &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.550&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Sohn's &lt;em&gt;A Statistical Model-Based Voice Activity Detection&lt;/em&gt;&lt;/a&gt;. You can find some Matlab implementations in the net. I have used this in addition to spectral substraction noise reduction (which doesn't seem to be needed in your case) in a noisy environment (babble + WGN) and results were susprisingly good.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Matlab code for using Voicebox's Sohn VAD.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;in_file='yourfile.wav';&#xA;[s,fs,wmode,fidx]=readwav(in_file,'p',-1,3500); %3500 is the number of samples to discard at the beginning of your file. &#xA;[y1,zo]=vadsohn(s,fs); %y1 is 1 when there is voice, 0 when there isn't&#xA;y=s(1:length(y1)).*y1; %apply mask&#xA;y(1)=0;&#xA;&#xA;for i=2:length(y)&#xA;    if y(i-1)&amp;lt;y(i)&#xA;        StartTime=(i-2)/fs&#xA;    elseif y(i-1)&amp;gt;y(i)&#xA;        EndTime=(i-2)/fs&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1771" LastEditorUserId="1771" LastEditDate="2013-03-07T20:26:00.483" LastActivityDate="2013-03-07T20:26:00.483" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8066" PostTypeId="1" AcceptedAnswerId="8074" CreationDate="2013-03-02T03:29:48.077" Score="2" ViewCount="14915" Body="&lt;p&gt;I have recorded my own voice in Matlab and I intend to add some echo to it.I came up with one solution for getting the desired echo effect:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Delay the sampled audio in the time domain and adding it to the original sample&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In order to do this I'm using Matlab and I have basically done the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;recObj = audiorecorder(44100, 16, 2);%sampling rate of 44100Hz, stereo&#xA;recordblocking(recObj,length);%record audio for a fixed length duration&#xA;y = time_delay(getaudiodata(recObj) , 5000 );%set a delay of 5000 to original sampled audio data&#xA;&#xA;function [ y ]  = time_delay ( x , R )&#xA;%this function sets a delay to x of R&#xA;y = zeros(length(x) + R , 1);&#xA;y(R + 1:length(y)) = x(1:length(x));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see I have a recObj wich I can use for playing the recorded audio.In order to get a delayed version of the recorded audio I have used getaudiodata(recObj) and my own function time_delay.A problem that I have is that I don't know how to get a new delayed audiorecorder object from the delayed audio data retrieved by the time_delay function and I need an audiorecord object cause this is the only way of playing something.&#xA;So, my question is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this a good approach to get the desired echo effect in an audio&#xA;signal?&lt;/li&gt;&#xA;&lt;li&gt;If it is, then how do I set the delayed audio data to an&lt;br&gt;&#xA;audiorecorder object?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2013-05-01T18:10:14.740" Title="Adding echo to audio sample" Tags="|matlab|audio|discrete-signals|sampling|time-frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8068" PostTypeId="1" AcceptedAnswerId="8070" CreationDate="2013-03-02T07:18:45.080" Score="3" ViewCount="224" Body="&lt;p&gt;I'd like to understand when an input signal is time varying or time invariant.&#xA;Specifically, I have this function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n) = x(n) + 0.1 + (0.2)^n + x(n-3)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that this is time varying because of the $n$ in the exponent. Would anyone mind to clear this up for me? Is this time invariant or time varying?&lt;/p&gt;&#xA;" OwnerUserId="3929" LastActivityDate="2013-03-03T14:13:26.223" Title="Is this input function time varying?" Tags="|system-identification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8069" PostTypeId="1" AcceptedAnswerId="8073" CreationDate="2013-03-02T12:31:14.560" Score="8" ViewCount="4841" Body="&lt;p&gt;Problem of processing speech. Required to determine the phonemes and identify vowels and consonants. Anyone involved in this? Please advise what work on the subject is worth reading?&lt;/p&gt;&#xA;" OwnerUserId="4045" LastActivityDate="2013-03-18T15:03:17.920" Title="Distinguish vowels from consonants" Tags="|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8070" PostTypeId="2" ParentId="8068" CreationDate="2013-03-02T13:09:17.390" Score="2" Body="&lt;p&gt;Signals are (almost) always time variant. Otherwise they would be very boring :-). I believe your question is about whether &quot;systems&quot; are time invariant or not. A system basically is a &quot;prescription&quot; of how to create an output signal from an input signal. The equation you show is a system equation of how to create output y[n] from input x[n].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea of time invariance is the following: The behavior of the system doesn't depend on absolute time, i.e. the relationship between input and output is the same, regardless of whether it's Tuesday or Friday. You can find a more mathematical description here &lt;a href=&quot;http://en.wikipedia.org/wiki/Time-invariant_system&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Time-invariant_system&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest invariance test is the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;pick any input signal, typically $\delta [n]$ will do fine.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the output $y{_{0}}[n]$ for that intput&lt;/li&gt;&#xA;&lt;li&gt;now delay the input signal by some amount. &lt;/li&gt;&#xA;&lt;li&gt;Calculate the output $y{_{1}}[n]$ for the delayed input&lt;/li&gt;&#xA;&lt;li&gt;If $y{_{1}}[n]$ is NOT simply a delayed version of  $y{_{0}}[n]$ then the system time variant&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Another (equivalent) test is the following&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For time invariant system, the system equations only dependency on time must be as linear index into the input signal&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Either one will work.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="224" LastEditDate="2013-03-03T14:13:26.223" LastActivityDate="2013-03-03T14:13:26.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8071" PostTypeId="2" ParentId="8063" CreationDate="2013-03-02T13:34:16.797" Score="1" Body="&lt;p&gt;First link is broken, the second link is about unrolling loops, so it's not entirely clear (to me) what exactly you mean by &quot;array indexing&quot;. Anyway most of this heavily depends on the instruction set of the processor. For example and FIR filter would have to do something like this (in the innner loop)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;read filter coefficient&lt;/li&gt;&#xA;&lt;li&gt;read delayed input sample (state variable)&lt;/li&gt;&#xA;&lt;li&gt;multiply the two&lt;/li&gt;&#xA;&lt;li&gt;add to accumulator&lt;/li&gt;&#xA;&lt;li&gt;decrement coefficient pointer (or decrement coefficient read index)&lt;/li&gt;&#xA;&lt;li&gt;increment state pointer (or increment state read index)&lt;/li&gt;&#xA;&lt;li&gt;warp state pointer if needed (these tend to be circular buffers)&lt;/li&gt;&#xA;&lt;li&gt;decrement loop counter, test for 0&lt;/li&gt;&#xA;&lt;li&gt;jump to beginning of loop or past the loop depending on previous test&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So that's a lot of stuff to do. Especially the &quot;wrapping&quot; part can be quite expensive as it includes a test for wrap around and a conditional which can break the pipeline on many processors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway on some processors, like a risc, or i86 this can easily take 10-20 cycles, on a dedicated DSP like an Analog devices Sharc or a TI TMS320 these take about half a cycle (can do two in a single CPU clock), so there is a huge dependency on instruction set efficiency. The tricks the second long talks about can help with avoiding the unwarpping part and also reduces the overhead for looping since you only do it once every 4 coefficients.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-03-02T13:34:16.797" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8072" PostTypeId="2" ParentId="8066" CreationDate="2013-03-02T14:16:17.880" Score="0" Body="&lt;p&gt;To record, it may be easier to use a simple recording program to get a. wav file, and then import that in to Matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Mathworks didn't remove the sound function, I would use that. It should just take a vector and a sampling rate to play a sound. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For implementing the delay, I would just make an h[n] that contains the impulse response of the echo operation and then filter your signal by that. &lt;/p&gt;&#xA;" OwnerUserId="3644" LastActivityDate="2013-03-02T14:16:17.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8073" PostTypeId="2" ParentId="8069" CreationDate="2013-03-02T15:27:00.673" Score="14" Body="&lt;p&gt;This is somehow a broad question. An interesting book is &lt;em&gt;Digital Processing of speech signals&lt;/em&gt; by Rabiner &amp;amp; Schafer, in which you can find some good explanations to get started. It probably is out of date when looking into more advanced techniques, but I think it's good to understand the main characteristics of speech.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, every sound we produce is determined by the disposition of the vocal tract. In particular, if the vocal folds are tense and don't vibrate, the sound is said to be &lt;em&gt;unvoiced&lt;/em&gt;. However, if they vibrate, the sound is &lt;em&gt;voiced&lt;/em&gt;. You can sense the difference by placing your hand in your neck while you say &quot;Ahhhh&quot; or &quot;Ssssshh&quot;. In Spanish, all vowels are voiced and all consonants are unvoiced (&lt;strong&gt;this is not totally true, please refer to the comments&lt;/strong&gt;). I'm not sure about other languages though. You can think about a generator (glottis) which is connected to a filter (vocal tract) in a way that sounds take their characteristic shape. This is in fact the basis for speech production models (such as &lt;a href=&quot;http://www.ee.ucla.edu/~spapl/projects/ee214aW2002/1/report_fichiers/image005.gif&quot; rel=&quot;noreferrer&quot;&gt;the simplest&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look closely to a speech signal, you can easily find differences between the different phonemes. &lt;strong&gt;Voiced&lt;/strong&gt; phonemes are said to be pseudo-periodic. This means that, if you look at a fragment of the signal which is short enough (about tens of milliseconds long, e.g. 40ms), you can find the superposition of harmonic sine signals. This means that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The signal is periodic with a fundamental frequency $f_0$. This is also known as the pitch.&lt;/li&gt;&#xA;&lt;li&gt;Harmonics will appear with frequencies $2f_0, 3f_0, 4f_0$... which energy will depend on the exact phoneme.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you plot the spectrum of this speech signal, you can find something like the following (&lt;a href=&quot;http://hyperphysics.phy-astr.gsu.edu/%E2%80%8Chbase/music/vowel.html&quot; rel=&quot;noreferrer&quot;&gt;source&lt;/a&gt;).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nAFbT.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This resembles, for example, the harmonic structure of a brass instrument sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, &lt;strong&gt;unvoiced&lt;/strong&gt; signals don't have such a clear harmonic structure. In fact, they have no fundamental frequency, and can be conceived as a noisy signal. You can sing by saying &quot;Ahh&quot;, but you can't by saying &quot;Ddd&quot;. Unvoiced sounds can be conceived as coloured noise. They usually have less energy than voiced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Aydh2.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking these differences into account, we can think about a way to detect them automatically.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Voiced sounds are periodic while unvoiced aren't.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To detect periodicity, you can use &lt;a href=&quot;http://www.nyu.edu/classes/bello/MIR_files/periodicity.pdf&quot; rel=&quot;noreferrer&quot;&gt;methods&lt;/a&gt; such as autocorrelation (which has been widely treated in this site).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Voiced sounds have more energy than unvoiced.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can divide the signal in 20-40ms windows, compute the energy for each one and decide according to a threshold.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unvoiced sounds are noisy and tend to be prominent in high frequencies, while voiced aren't so.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Therefore, unvoiced will cross with zero more often than voiced. This is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Zero-crossing_rate&quot; rel=&quot;noreferrer&quot;&gt;Zero Crossing Rate&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While these simple methods are not too accurate by themselves, are a good place to start from. Furthermore, I am sure you can get good results by combining them. In any case, this post does not substitute a good book, as the one I mentioned before. It's just some kind of introduction to show you some possibilities.&lt;/p&gt;&#xA;" OwnerUserId="1771" LastEditorUserId="1771" LastEditDate="2013-03-18T15:03:17.920" LastActivityDate="2013-03-18T15:03:17.920" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8074" PostTypeId="2" ParentId="8066" CreationDate="2013-03-02T17:33:06.377" Score="2" Body="&lt;p&gt;Here is the code for adding the two signals(the delayed and not-delayed): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    x = getaudiodata(recObj); n1 = 1:size(x,1);%audiodata of original signal&#xA;    y = time_delay(x , 50000 ); n2 = 1:size(y,1);%audiodata of delayed signal&#xA;    mixed = sigadd(x,y,n1,n2); %audiodata of mixed signal&#xA;    mixrecObj = audioplayer(mixed,44100);&#xA;    play(mixrecObj);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the sigadd function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ y,n ] = sigadd( x1,x2,n1,n2 )&#xA;%implements y[n] = x1[n] + x2[n]&#xA;%y = sum sequence over n wich includes n1 and n2&#xA;%x1 = first sequence over n1&#xA;%x2 = second sequence over n2&#xA;%&#xA;&#xA;n = min(min(n1),min(n2)):max(max(n1),max(n2)); %duration of y(n)&#xA;y1 = zeros(1,length(n)); y2 = y1;&#xA;y1(find((n &amp;gt;= min(n1))&amp;amp;(n &amp;lt;= max(n1)) == 1)) = x1;&#xA;y2(find((n &amp;gt;= min(n2))&amp;amp;(n &amp;lt;= max(n2)) == 1)) = x2;&#xA;y = y1 + y2;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works perfectly, but is not enough for getting a real echo effect. In order to archieve this we have to &#xA;create more delayed signals(with diferent delays of course), and then add them all,like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = getaudiodata(recObj); n1 = 1:size(x,1);&#xA;y = tim_delay(x , 5000 ); n2 = 1:size(y,1);&#xA;s = time_delay(x , 4000 ); n3 = 1:size(s,1);&#xA;d = time_delay(x , 3000 ); n4 = 1:size(d,1);&#xA;mixed1 = sigadd(s,d,n3,n4);n5 = 1:size(mixed1,2);&#xA;mixed2 = sigadd(x,y,n1,n2);n6 = 1:size(mixed2,2);&#xA;totmixed = sigadd(mixed1,mixed2,n5,n6);&#xA;mixrecObj = audioplayer(totmixed,44100);&#xA;play(mixrecObj);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tested this one with the three delays plus the original and you can hear a pretty nice echo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: In the third piece of code it would have be better if there were a function that returned the signal with the echo by passing an echo effect index  as a parameter to it, but I left it that way for the sake of simplicity.      &lt;/p&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2013-03-02T17:33:06.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8075" PostTypeId="1" CreationDate="2013-03-02T17:44:14.217" Score="4" ViewCount="1155" Body="&lt;p&gt;I have to make comparison between 155 image feature vectors. Every feature vector has got  5 features.&#xA;My image are divided in 10 classes.&#xA;Unfortunately for using support vector machine i need at least 100 images for class, There is any alternative?&lt;/p&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="53" LastEditDate="2013-03-06T03:04:53.623" LastActivityDate="2021-12-21T19:27:59.087" Title="Alternative to support vector machine?" Tags="|image-processing|computer-vision|object-recognition|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8076" PostTypeId="2" ParentId="8075" CreationDate="2013-03-02T18:55:21.550" Score="2" Body="&lt;p&gt;Why not just stick with something simpler like &lt;a href=&quot;http://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;k-nearest neighbors&lt;/a&gt; or &lt;a href=&quot;https://web.archive.org/web/20120710155909/http://www.wcsit.org/pub/2012/vol.2no.3/Learning%20Vector%20Quantization%20(LVQ)%20and%20k-Nearest%20Neighbor%20for%20Intrusion%20Classification.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;(learning) vector quantization&lt;/a&gt; (PDF)?&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2021-12-21T19:27:59.087" LastActivityDate="2021-12-21T19:27:59.087" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8077" PostTypeId="1" CreationDate="2013-03-02T19:37:20.203" Score="1" ViewCount="520" Body="&lt;p&gt;I apologize if this is not the appropriate site or the appropriate type of question, but I didn't know where else to ask. If it is, please inform me to delete the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took a year in college and wasn't ready and so did horribly. However, A couple of years later now I am definitely ready to go back. I've been self-studying mathematics and a bit of programming and plan on starting to study more in depth topics in computer science. My plan is to go to a community college for a year or two then transfer to Rutgers to get an M.A. in mathematics while self-studying computer science in particular machine learning and computer vision. My question is this. Is this at all practical. What are the chances of success? I don't want to put all my eggs in one basket and end up failing because of a questions that I could have asked now and have to end up working as a cashier at McDonalds for the rest of my life. If you can offer me any advice it would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4049" LastEditorUserId="4049" LastEditDate="2013-03-02T21:25:45.700" LastActivityDate="2013-03-02T21:25:45.700" Title="Career in computer vision" Tags="|soft-question|" AnswerCount="0" CommentCount="12" CommunityOwnedDate="2013-03-03T08:38:44.297" ContentLicense="CC BY-SA 3.0" />
  <row Id="8078" PostTypeId="2" ParentId="7970" CreationDate="2013-03-03T03:03:11.223" Score="1" Body="&lt;p&gt;In the frequency representation given by the FFT there are no frequencies missing and their is no binning of frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT decomposes a discrete signal in to a sum of sinusoids of certain frequency and phase. This representation is exact and has the same energy as the original signal. No information is lost, as you can do an inverse FFT and recover the original signal exactly. The binning is coming from the discretisation of the signal, not the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also for a finite length signal, there are no frequencies lower than the one with the period equal to the length of the signal. This is from the mathematical definition of the spectrum. Put more simply, the DFT/FFT 'assumes' the signal is repeating. Zero padding of the signal therefore increases the period and therefore the lowers the first frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are lower frequencies due to some prior knowledge, e.g. if we sampled a sine wave over half its period, then this information must be included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One solution may be to roll your own spectrum and scale the frequency components with period longer than that of the signal. The assumption being that the low frequency component continues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let $f_S$ be the frequency you are interested in, with period = $1/f_s &amp;gt; 1$ longer than the period of the signal which is normalised to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you convolve the signal with the sine and cosine waves at that frequency. No zero padding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_e = \sum_t^N f[t] \times cos[2\pi f_s t]$$&#xA;$$f_o = \sum_t^N f[t] \times sin[2\pi f_s t]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then multiply by $1/ f_s$ to account for the assumption the signal outside of the sample continues like this, and multiply by 1/N to account for number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_e' = f_e \times 1/ f_s \times 1/N$$&#xA;$$f_o' = f_o \times 1/ f_s \times 1/N$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Amplitude and phase are then given in the usual way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be done at whatever frequency graduations you desire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Changes with regard to first comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2:&#xA;Answer riddled with errors. Updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 3: Add factoring for N&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&#xA;Edits welcome if I have this wrong. &lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2013-03-06T02:04:42.127" LastActivityDate="2013-03-06T02:04:42.127" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8079" PostTypeId="1" AcceptedAnswerId="8080" CreationDate="2013-03-03T09:16:55.637" Score="16" ViewCount="3989" Body="&lt;p&gt;If we already had Short-time Fourier transform for better analysis of a signal than Discrete Fourier Transform, then what was the need that leads to development of Wavelet Transform ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-03-03T20:19:09.180" Title="Why Wavelet developed when we already had Short-time Fourier transform" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8080" PostTypeId="2" ParentId="8079" CreationDate="2013-03-03T20:19:09.180" Score="10" Body="&lt;p&gt;The short-time Fourier transform doesn’t offer better analysis of data than the discrete Fourier transform, it offers a different kind of analysis.  The DFT offers an exact decomposition of data to a frequency representation. The STFT offers an approximate decomposition to a time/frequency representation.  Which is better depends on what you are after.  The same holds true of the Wavelet transform.  Wavelet transforms can be thought of as decomposition to a time/frequency representation, but wavelet transforms generalize the concept of decomposition.  Different wavelet functions have been created so you can choose a decomposition that suits your needs.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-03-03T20:19:09.180" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8081" PostTypeId="1" CreationDate="2013-03-03T22:29:31.003" Score="3" ViewCount="1149" Body="&lt;p&gt;Frequently programs for calculating the spectrum of a signal using the multi-taper method require the user to specify the time-bandwidth product.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What considerations must be made when selecting the time-bandwidth product? &#xA;Would would be the effect on the resulting spectrum if the selected time-bandwidth product is too large or too small?&lt;/p&gt;&#xA;" OwnerUserId="2004" LastActivityDate="2013-03-03T22:29:31.003" Title="What is the proper way to select the time-bandwidth product when doing multi-taper spectral estimation?" Tags="|fft|frequency-spectrum|estimation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8083" PostTypeId="2" ParentId="8047" CreationDate="2013-03-04T05:45:12.813" Score="2" Body="&lt;p&gt;My Scipy code that generates data, plots it and performs the fft is listed below.  The code generates two &quot;spike trains&quot; at intervals of 6 and 8 seconds.  The following plot shows the signal in time, and its fft (sorry, the fft title got mangled).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3KQ8l.png&quot; alt=&quot;signal and fft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interesting thing to notice is that the frequencies you are looking for are there.  Said frequencies are &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1/8 Hz or omega = 1/8/500 = 0.00025 omega and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1/6 Hz or omega = 1/6/500 = 0.00033&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is where the first two peaks are in the frequency domain.  Further out are many more repeating peaks/aliases because these are essentially really extreme, intermittent square waves. You could try low-pass-filtering to isolate the fundamental frequencies and eliminate other peaks, but I think that's probably a lost cause at a sample rate of 500 Hz.  Trying to get a 0.2 Hz cutoff filter @ 500 Hz seems a bit much.  Just zooming in on the frequency region of interest might be good enough.  The next step could be to understand exactly how these spike trains are going to cause repetition/aliasing in the frequency domain and look for a certain pattern. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or try to either LPF and downsample a lot and retry the FFT route,  calculate individual DFT bins using straight-up DFT math or use the Goertzel algorithm to calculate DFT bins for suspected frequency locations.  Maybe try a Goertzel algorithm from 0.0 Hz to 0.2 Hz with 0.01 spacing - just as an example.&lt;br&gt;&#xA;Good luck - it doesn't seem like a trivial problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pylab import *&#xA;close('all') #close previous plots&#xA;&#xA;fs=500 # generate signal&#xA;s1 = hstack(( 1,zeros(fs*6-1) )) # 1/6 Hz&#xA;s2 = hstack(( 1,zeros(fs*8-1) )) # 1/8 Hz&#xA;s1r = tile(s1,(12,))&#xA;s2r = tile(s2,(9,))&#xA;s = s1r + s2r&#xA;print &quot;shape of s is %s&quot;%(str(s.shape))&#xA;&#xA;sfft=fft(s) # execute fft&#xA;sfreqs=fftshift(fftfreq(len(sfft)))&#xA;print &quot;shape of sfft is %s&quot;%(str(sfft.shape))&#xA;&#xA;figure(); # generate plots&#xA;subplot(211); plot( 1./fs * arange(len(s)) , s ) #, 'o' )&#xA;title('signal, s');xlabel('sec');ylabel('mag')&#xA;subplot(212); plot( sfreqs , (abs(sfft)) ) #, 'o' )&#xA;title('fft(s)');xlabel('$\omega$');ylabel('linear mag')&#xA;axis([0.0,0.0005,0.0,25.])&#xA;show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Thinking about it some more, the best solution probably doesn't involve signal processing.  You may want to threshold the samples in to zeros and spikes.  Then take the interval between the spike locations 0 and 1 and look for that interval through the rest of the spikes.  If that interval is consistent with all of your spikes, then you've found that series of spikes and should &quot;subtract out&quot; that series from the spikes.  Then keep iteratively looking at intervals of spikes.  In a noise, imperfect system, a good implementation of this will probably be tricky, but it's probably a better solution to this specific problem.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="3644" LastEditDate="2013-03-04T17:36:06.633" LastActivityDate="2013-03-04T17:36:06.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8084" PostTypeId="1" CreationDate="2013-03-04T09:51:20.193" Score="9" ViewCount="275" Body="&lt;p&gt;I have the images of cartoons, that were compressed. The example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g551w.jpg&quot; alt=&quot;Original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have such noise, that is not easy to delete. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c4qye.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though the pixels are on the gray background, the noise pixels can be of very different colors and if I look at the histogram (of grayscale image) of such image I see a lot of bins around the bin of main color. But I can't just delete the colors of value, that are not of main color, because there is a risk to delete some important features (as eye, for example). Also I've tried to posterize image (example presents 8 colors), but some pixels still remain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gjIAG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I've tried median filter, but it is not able to vanish such heavy noise ( I use 3*3 filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, give some methods that can effectively remove the noise in this case. I would be grateful for any help!&lt;/p&gt;&#xA;" OwnerUserId="4061" LastEditorUserId="4061" LastEditDate="2013-03-04T13:01:54.290" LastActivityDate="2013-03-06T10:27:19.357" Title="Remove noise on edge (compression deffects)" Tags="|image-processing|filters|noise|reconstruction|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8085" PostTypeId="1" CreationDate="2013-03-04T10:12:03.977" Score="2" ViewCount="682" Body="&lt;p&gt;In opencv if i use findcontours function, i get contours and i can compute area, perimeter, convex hull.&#xA;if i use a Skeletonized image of a circle how can i compute perimeter,area, convex hull of the skeletonized circle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.google.com/file/d/0ByS6Z5WRz-h2RXdzVGtXUTlPSGc/edit?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;image:&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HacE8.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My skeletonize function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import cv2&#xA;import scipy.ndimage.morphology as m&#xA;&#xA;def skeletonize(img):&#xA;    h1 = np.array([[0, 0, 0],[0, 1, 0],[1, 1, 1]]) &#xA;    m1 = np.array([[1, 1, 1],[0, 0, 0],[0, 0, 0]]) &#xA;    h2 = np.array([[0, 0, 0],[1, 1, 0],[0, 1, 0]]) &#xA;    m2 = np.array([[0, 1, 1],[0, 0, 1],[0, 0, 0]])    &#xA;    hit_list = [] &#xA;    miss_list = []&#xA;    for k in range(4): &#xA;        hit_list.append(np.rot90(h1, k))&#xA;        hit_list.append(np.rot90(h2, k))&#xA;        miss_list.append(np.rot90(m1, k))&#xA;        miss_list.append(np.rot90(m2, k))    &#xA;    img = img.copy()&#xA;    while True:&#xA;        last = img&#xA;        for hit, miss in zip(hit_list, miss_list): &#xA;            hm = m.binary_hit_or_miss(img, hit, miss) &#xA;            img = np.logical_and(img, np.logical_not(hm)) &#xA;        if np.all(img == last):  &#xA;            break&#xA;    return img&#xA;&#xA;nomeimg = &quot;JPEG/e(5).jpg&quot;    &#xA;img = cv2.imread(nomeimg,0)&#xA;ret,img = cv2.threshold(img,127,255,0)&#xA;element = cv2.getStructuringElement(cv2.MORPH_CROSS,(3,3))&#xA;img = 255 - img&#xA;img = cv2.dilate(img, element, iterations=7)&#xA;img = cv2.erode(img, element)&#xA;&#xA;#element = cv2.getStructuringElement(cv2.MORPH_CROSS,(6,6)) &#xA;&#xA;skel = skeletonize(img)&#xA;skel = skel.astype(np.uint8)*255&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3597" LastEditorUserId="128" LastEditDate="2023-07-02T18:55:57.007" LastActivityDate="2023-07-02T18:55:57.007" Title="How can i compute perimeter and area of a skeletonized circle?" Tags="|image-processing|opencv|morphological-operations|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8086" PostTypeId="2" ParentId="8085" CreationDate="2013-03-04T13:08:57.473" Score="2" Body="&lt;p&gt;It is not clear if the skeletonized image can be reversed to a contour image. Skeletonization is often done by calculating the distance transform and then thresholding the result or performing a non-maximum suppression. At this point you have already lost too much information and the features, you are asking for cannot be calculated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the distance transform, you can approximate those values:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You get the radius ($r$) of the circle from the height of peak which represents the circle (the skeleton of an ideal circle would be a dot)&lt;/li&gt;&#xA;&lt;li&gt;Perimeter = $2\pi r$&lt;/li&gt;&#xA;&lt;li&gt;Area = $\pi r^2$&lt;/li&gt;&#xA;&lt;li&gt;Convex hull $\rightarrow$ draw a circle with radius $r$ at the position where the peak is&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="101" LastActivityDate="2013-03-04T13:08:57.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8087" PostTypeId="2" ParentId="7970" CreationDate="2013-03-04T19:07:33.313" Score="1" Body="&lt;p&gt;Updated/Revised: &#xA;It sounds like you need something very powerful that goes beyond correlator/passive techniques.  It sounds like you need an adaptive filter.  There are various types of adaptive filtering techniques for spectral estimation, but they are often very dependent upon the application and types of input to said techniques.  Could you elaborate more on how the data is collected, what you suspect is in the data, and exactly what you hope to accomplish?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a good solution exists, I think it will require some type of adaptive filter as (I think) you are asking for something beyond the typical reach of conventional correlation/filter/FFT techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple simple options that are generally useful but probably won't work:&#xA;1) &lt;a href=&quot;http://www.ingelec.uns.edu.ar/pds2803/Materiales/Articulos/AnalisisFrecuencial/04205098.pdf&quot; rel=&quot;nofollow&quot;&gt;The first one&lt;/a&gt; is good for interpolating a single DFT/FFT peak &quot;in between&quot; bins, but it relies on the fact that there is only one true peak and is concerned with finding the location of that peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If you want to calculate DFT bins at arbitrary frequencys (i.e. &quot;bin 1.65&quot;), then read up on the Goertzel algorithm as this will allow you to do that.  Or zero-pad and then FFT.  This should have the same basic effect, though, you still won't be able to resolve between bins 1.65 and 1.70 - they'll just be two points on the same gentle curve and not two distinct peaks.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="3644" LastEditDate="2013-03-05T19:25:22.963" LastActivityDate="2013-03-05T19:25:22.963" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8088" PostTypeId="1" CreationDate="2013-03-04T19:48:12.567" Score="10" ViewCount="3907" Body="&lt;p&gt;If I recall correctly, there is a variation of the DFT that can be used to analyze a specific band of the spectrum of a signal. How is it called?&lt;/p&gt;&#xA;" OwnerUserId="1696" LastEditorUserId="18335" LastEditDate="2016-07-26T20:05:09.663" LastActivityDate="2016-07-26T20:05:09.663" Title="What transform can I use to &quot;zoom&quot; in a specific portion of a signal's spectrum?" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8089" PostTypeId="2" ParentId="8088" CreationDate="2013-03-04T20:10:54.390" Score="9" Body="&lt;p&gt;You're probably referring to the &lt;a href=&quot;http://arc.id.au/ZoomFFT.html&quot;&gt;zoom FFT&lt;/a&gt;. It's essentially a technique that allows for complexity reduction in the case where you have a small portion of a larger band that you'd like to analyze at high spectral resolution. It prevents you from having to calculate the high-resolution frequency content in the bands that you don't care about. Roughly, the algorithm can be summarized as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a bandpass filter around the region of interest, eliminating the components outside the band that you care about.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Decimate the signal by a factor $D$, such that the resulting sample rate still meets the Nyquist criterion for the filter's passband width. Depending upon where the band's center frequency was, this process might also involve frequency-translating the signal to baseband.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform a DFT on the signal. In order to get the same frequency resolution at the output, the &quot;zoomed&quot; transform only requires a transform length that is $\frac{1}{D}$-th of what you would need to use if you used the original, unfiltered signal for your analysis.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-03-05T02:20:05.013" LastActivityDate="2013-03-05T02:20:05.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8090" PostTypeId="1" CreationDate="2013-03-05T02:57:24.883" Score="3" ViewCount="930" Body="&lt;p&gt;What might be, if any, some good numerical approximation functions to the ISO 226 family of human perceptual equal loudness curves?  Is there a polynomial fit of reasonably low degree?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-03-05T05:08:53.587" Title="Equal loudness curves: any good numerical approximation equations?" Tags="|audio|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8091" PostTypeId="2" ParentId="8090" CreationDate="2013-03-05T05:08:53.587" Score="2" Body="&lt;p&gt;I believe that the actual standard (access to which of course must be purchased) specifies all the mathematics. I did find this one MATLAB file in file exchange:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/7028&quot; rel=&quot;nofollow&quot;&gt;ISO 226 Equal-Loudness-Level Contour Signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're going to use it in a commercial applications though, the distribution license won't allow you to do so. Still, a good start if you don't have the standard handy.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-03-05T05:08:53.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8092" PostTypeId="1" AcceptedAnswerId="8108" CreationDate="2013-03-05T05:33:01.787" Score="2" ViewCount="173" Body="&lt;p&gt;I'm analyzing guitar string plucks and sustains.  I'm having good success with auto correlation using FFT's.  Now I'd like to detect plucks while the string is still vibrating.  Since I already am periodically taking FFT's to find the pitch, I thought maybe I can take advantage of the fft results and look for changes that might indicate a repluck.  Do I simply add up the bins for some kind of power measurement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4008" LastEditorUserId="1650" LastEditDate="2013-03-05T16:47:57.430" LastActivityDate="2013-03-06T18:10:53.863" Title="Guitar String Replucks" Tags="|fft|music|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8094" PostTypeId="1" AcceptedAnswerId="8098" CreationDate="2013-03-05T14:38:00.983" Score="2" ViewCount="581" Body="&lt;p&gt;Does converting zeros into ones and ones into zeros in the input stream affect the decoding result? Empirically I have seen that it does not affect, decoding $[0 1 0 1 \ldots]$ and $[1 0 1 0 \ldots]$ produce the same output stream. But I am not sure if it is true or not, and I am looking for a theoretical proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why I am doing this is because the convolutionally encoded stream (rate $\frac{1}{2}$ and constraint length 7) is received without the phase information, thus a conversion is needed. I am trying to determine in which step I should convert the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate if you could share any knowledge.&lt;/p&gt;&#xA;" OwnerUserId="2024" LastEditorUserId="90" LastEditDate="2013-03-06T13:47:23.923" LastActivityDate="2013-03-06T13:47:23.923" Title="Viterbi Decoder - How does inverting the input bits affect the result?" Tags="|channelcoding|viterbi-algorithm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8095" PostTypeId="1" CreationDate="2013-03-05T15:12:53.167" Score="1" ViewCount="447" Body="&lt;p&gt;With a 1/2-rate convolutional encoder, $n$ bits are encoded into $2n$ symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume we have a long encoded stream such as $[... s_0, s_1,  s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, ..., s_{100}, ...]$. I want to extract a small portion from the middle of it, and decode it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting from the symbol $s_1$, the data is decoded as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, ..., s_{100}]$ ---Viterbi Decoder---&gt; $[b_1, b_2, b_3, b_4, ..., b_{50}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens if we start from $s_2$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, ..., s_{100}]$ ---Viterbi Decoder---&gt; $[b_1', b_2', b_3', b_4', ..., b_{49}']$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Matlab's vitdec, starting from $s_1$ or $s_3$ produces the same result where the only difference is that $s_3$ starts from the second bit. But starting from $s_2$ produces a totally different vector, there is no small pattern in common between this and the results obtained when starting from $s_1$ or $s_3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the expected result? Do we have to do symbol alignment to get correct results? Since the preamble in the data is encoded too, I do not know where to start decoding.&lt;/p&gt;&#xA;" OwnerUserId="2024" LastEditorUserId="2024" LastEditDate="2013-03-06T00:42:54.947" LastActivityDate="2013-03-06T00:42:54.947" Title="Viterbi Decoder - Symbol Alignment" Tags="|channelcoding|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8096" PostTypeId="1" AcceptedAnswerId="8132" CreationDate="2013-03-05T15:33:33.450" Score="9" ViewCount="1777" Body="&lt;p&gt;This sample image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s2YEI.png&quot; alt=&quot;img&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is warped on the left side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to dewarp, but just to remove shadow gradient (caused by book's spine). I guess gradient can be calculated from upper part of the image and that information can be used for reconstruction.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I thought to apply some layer transformation in Photoshop. I took upper part with clear gradient and scaled it vertically to cover whole image in new layer. Then I did layer difference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PYuCI.png&quot; alt=&quot;img&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but while upper part is acceptably reconstructed, colored part is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea how to approach this in Photoshop, or Python/SciPy/OpenCV, or Matlab?&lt;/p&gt;&#xA;" OwnerUserId="719" LastEditorUserId="128" LastEditDate="2019-06-24T09:12:10.860" LastActivityDate="2019-06-24T09:12:10.860" Title="Scanning from Book - Gradient Removal" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8098" PostTypeId="2" ParentId="8094" CreationDate="2013-03-05T16:46:52.080" Score="2" Body="&lt;p&gt;Convolutional codes are linear in the Galois{2} (i.e. binary) field.  We know this because the convolution operation is linear.  The fact that Viterbi codes are linear has a few implications.  First, if you input all 0's you will get all 0's out.  Second, if you add two inputs together the output will be the sum of their individual outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last piece of information that we need for a very informal &quot;proof&quot; is that when you input all 1's the output is all 1's (EDIT: this is not always true- see the edit at the bottom of the answer).  We see that this must be so because the encoder state is constant (you are, after all, inputting all 1's) so the output must be constant.  The output cannot be 0's because that would match the all 0's case which would make the code non-linear (other than in the trivial case where the encoder always outputs 0 no matter what the input is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we've established that inputting all 1's causes the output to be all 1's we can prove that yes, inverting the input is equivalent to inverting the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Input =&amp;gt; Output\\&#xA;Input + Ones =&amp;gt; Output + Ones&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume the first statement then the second statement follows due to linearity and all 1's producing all 1's, with the understanding that binary inversion is equivalent to adding 1.  0 + 1 = 1, 1 + 1 = 2 = 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Dilip is correct.  For some generator polynomials an all 1's input will produce an all 1's output and so inverting the input is equivalent to inverting the output.  For some generator polynomials, though, an all 1's input will &lt;em&gt;not&lt;/em&gt; produce an all 1's output, so inverting the input is &lt;em&gt;not&lt;/em&gt; equivalent to inverting the output.  The generator polynomials that do produce an all 1's output have odd Hamming weights for both polynomials.  The reason that Dilip's polynomial does not meet the criteria is that one of the polynomials ($1 + x^2$) has an even Hamming weight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: Dilip makes a valid point that even polynomials with odd Hamming weights will produce some zeros at the beginning while the zeros in the state memory are shifted out and replaced with ones.  This is relatively brief, but it does mean that the inversion equivalence does not hold during that time.  It does hold during the &quot;steady state&quot; behavior.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-03-06T13:42:27.400" LastActivityDate="2013-03-06T13:42:27.400" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8099" PostTypeId="2" ParentId="8095" CreationDate="2013-03-05T16:52:35.133" Score="2" Body="&lt;p&gt;I find it surprising that it didn't matter where you started.  Normally incorrect symbol alignment will completely change your results.  The usual method for determining the correct alignment (assuming you don't have other information like a Frame Alignment Word to help you figure it out) is to try both possible phases and see which produces a lower path metric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, by the way, do the same when the code is punctured, you just have more phases to try.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-05T16:52:35.133" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8100" PostTypeId="2" ParentId="8095" CreationDate="2013-03-05T18:51:44.170" Score="1" Body="&lt;p&gt;I do not have any information about MATLAB's &lt;code&gt;vitdec&lt;/code&gt; program and questions about &lt;code&gt;vitdec&lt;/code&gt; are off-topic here anyway, but in general, if the SNR&#xA;is good, a Viterbi decoder can be used to &lt;em&gt;detect&lt;/em&gt; a mis-framing&#xA;of the incoming signal reasonably reliably.&#xA;If the SNR is not very good, the method described below can&#xA;lead to lots of false alarms that the incoming signal is mis-framed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a received sequence (of bits or soft decisions)&#xA;the Viterbi decoder for a $(n,k)$ convolutional code&#xA;of constraint length $\nu$ finds the maximum-likelihood path &#xA;(which corresponds to the maximum-likelihood codeword)&#xA;through the code trellis by computing iteratively&#xA;the maximum-likelihood path to each of the $2^{\nu}$ nodes in the &#xA;trellis at depth $j$.  Now, assuming that the SNR is good,&#xA;and there has not, in&#xA;the immediate past, been an unusually long (or unusually strong) &#xA;burst of noise (none in progress right now, either!)&#xA;&lt;em&gt;one&lt;/em&gt; of the paths typically has much larger log-likelihood than most&#xA;of the other paths. Furthermore, when the add-compare-select&#xA;process is choosing the best path to a node at the next level, in most cases,&#xA;one path is a clear winner over the others.&#xA;On the other hand, if the sequence is&#xA;mis-framed, then all the log-likelihoods of paths at depth $j$ are&#xA;not only comparable, but also very negative. Also, in&#xA;the add-select-compare process at the nodes at the next depth,&#xA;hardly any of the paths look particularly appealing, and the&#xA;system chooses the best of a bad lot.  Thus, repeated &lt;em&gt;absence&lt;/em&gt; &#xA;of good choices and universally low path metrics &lt;em&gt;can&lt;/em&gt; be taken&#xA;as an indication that mis-framing has occurred. Recovery&#xA;depends on the rest of the system implemenation. Perhaps there&#xA;is enough time to re-run the incoming signal with a different&#xA;framing. Or the mis-framing can be corrected by some bit-stuffing&#xA;or bit-deletion of the signal as it continues to come in,&#xA;and it is left to the next higher level to request a re-transmission&#xA;of the mis-framed portion, etc.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-03-05T18:51:44.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8101" PostTypeId="1" AcceptedAnswerId="8112" CreationDate="2013-03-05T21:12:04.767" Score="5" ViewCount="211" Body="&lt;p&gt;In paper &lt;a href=&quot;http://journals.tubitak.gov.tr/elektrik/issues/elk-06-14-2/elk-14-2-5-0510-1.pdf&quot; rel=&quot;nofollow&quot;&gt;Human identification using gaits&lt;/a&gt; Section 3.2, the authors explain how to represent a 3D image (x,y,t) into 2D image with (x,t) ; (y,t) denoted 1D signals. I have a conceptual doubt which is in my case I have a matrix (x,y) represent the centroid of the motion- a pixel point from one frame to the next. So, if we want to do some kind of processing like finding the fourier transform, then is it theoretically correct to treat x- coordinate and y coordinate separately?Do we need to perform some trasnformations?I did not understand how the authors are representing an image pixel as 1D signal.Questions are : &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It is not clear how the authors have converted to four 1D signals. How to use/represent the image pixel coordinates as 1D signals as done in the paper for further analysis?Should I perform autocorrelation between x and y to get 1D vector?&lt;/li&gt;&#xA;&lt;li&gt;Phase space plot = it is plot of 2 variables. So, in this case, will it be a plot of &lt;code&gt;x(t) vs y(t)&lt;/code&gt; or &lt;code&gt;x(t-1) vs x(t)&lt;/code&gt; or the future_predicted_values for x cordinate vs the current measured values of x coordinate?Or the plot of features?&lt;/li&gt;&#xA;&lt;li&gt;Do I need to smooth the data?If so then how to use bsplines as I found that this is popularly used for smoothening.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Example data points representing pixels (x,y) are&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x      y&#xA;160    210&#xA;160    230&#xA;160    250&#xA;170    83&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and so on for 1000 frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody please help in explaining the concept and the way to proceed with image signals so that a phase space plot can be created.&lt;/p&gt;&#xA;" OwnerUserId="1699" LastEditorUserId="1699" LastEditDate="2013-03-06T18:18:18.737" LastActivityDate="2013-03-07T12:06:44.460" Title="Representation of frame image pixels" Tags="|image-processing|signal-analysis|soft-question|video-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8104" PostTypeId="2" ParentId="2317" CreationDate="2013-03-06T10:25:32.133" Score="6" Body="&lt;p&gt;I haven't read the paper on sFFT, but my feeling is that the idea of fasten the FFT behind is exploiting the prior of k-sparsity. Hence, one do not have to compute all entries of FFT coefficients, instead, only computing k of them. So that's why for k-sparse signal, the complexity is O(klog n) instead of O(nlog n) for conventional FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way, regarding to the comments of @rcmpton, by saying &quot;The idea behind compressed sensing is that you can recover sparse data from sparse random samples drawn from a different domain (eg recover sparse images from random sparse frequency data (ie MRI)).&quot; The question is what is &quot;sparse random samples&quot;? I think it might be samples collected by randomly projecting the sparse data to some lower (measurement) subspace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as I understood, the theoretical framework of compressive sensing is majorly comprised of 3 issues, sparsity, measurement, and recovery. By sparsity, it pertains to seeking sparse representations for certain class of signals, which is the task of dictionary learning. By measurement, it pertains to seeking a efficient way (computational efficiency and recoverable) to measure the data (or projecting data to lower measurement space), which is the task of measurement matrix design, such as random Gaussian matrix, structured random matrix, .... And by recovery, is the sparse regularized linear inversion problems, l0, l1, l1-l2, lp, l-group, blabla..., and the resulted algorithms are various, Matching pursuit, soft thresholding, hard thresholding, basis pursuit, bayesian, .... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is true that &quot;cs is minimization of L1 norm&quot;, and L1 norm is a basic principle for cs, but cs is not only minimization of L1 norm. Besides the above 3 parts, there are also some extensions, like structured (group, or model) compressive sensing, where structured sparsity is also exploited, and is proved to largely improve the recovery ability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a conclusion, cs is a big step in sampling theory, providing an efficient way to sample signals, &lt;strong&gt;provided that these signals are sparse enough&lt;/strong&gt;. So, &lt;strong&gt;cs is a sampling theory&lt;/strong&gt;, anyone who is going to use it as some technique for classification or recognition is misleading the principle. And occasionally, I find some paper titled with &quot;compressive sensing based .....&quot;, and I think the principle of such paper is exploiting l1-minimization instead of cs and it's better to use &quot;l1-minimization based ....&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am wrong, correct me please.&lt;/p&gt;&#xA;" OwnerUserId="4076" LastActivityDate="2013-03-06T10:25:32.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8105" PostTypeId="2" ParentId="8084" CreationDate="2013-03-06T10:27:19.357" Score="1" Body="&lt;p&gt;The Total Variation (TV, a.k.a. Rudin-Osher-Fatemi functional) denoising wold help here.&#xA;You can apply it on every color layer or look for a vectorized version if th eresults ar enot good enough for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good references of tsable and easy to implememnt algorithms for TV denoising are for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.160.5226&quot; rel=&quot;nofollow&quot;&gt;Chambolle's algorithm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;the Chambolle-Pock &lt;a href=&quot;http://www.icg.tugraz.at/publications/a-first-order-primal-dual-algorithm-for-convex-problems-with-applications-to-imaging&quot; rel=&quot;nofollow&quot;&gt;primal dual algorithm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Both references have good performance and are easy to implement from the papers.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-06T10:27:19.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8106" PostTypeId="2" ParentId="8058" CreationDate="2013-03-06T11:57:34.723" Score="2" Body="&lt;p&gt;Another metaphor to complete Mohammad's answer: think of zooming in/out on your signal.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Zooming out makes details of the signal / image disappear, and it is a low pass operation such as the one used to recover the low frequency components.&lt;/li&gt;&#xA;&lt;li&gt;Zooming in on the other hand will reveal things that were lost (or hidden) in the low frequency part. The difference between the zoomed-in and the zoomed-out images can be intuitively called &lt;em&gt;details&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-06T11:57:34.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8107" PostTypeId="2" ParentId="8063" CreationDate="2013-03-06T15:10:13.550" Score="0" Body="&lt;p&gt;Since this was a semi-rhetorical question, the answer is - example code that you find on the web is often written for readability. Meaning, you should always look for ways to optimize it. Especially if said code is used in the field of DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(feel free to close this question now)&lt;/p&gt;&#xA;" OwnerDisplayName="user3981" LastActivityDate="2013-03-06T15:10:13.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8108" PostTypeId="2" ParentId="8092" CreationDate="2013-03-06T18:05:33.780" Score="4" Body="&lt;p&gt;A pluck might produce significantly more broadband noise than a free string.  An FFT of such noise would show more relative energy outside of all the FFT result bins that are related to (F0 or overtones of) a single pitch.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, a free string has a more predictable decay rate in any FFT magnitudes related to the pitch across successive offset FFT frames windowing the sound data.  A sudden change from this decay rate (a stop or a big increase) might infer a disturbance, such as a pluck.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-03-06T18:10:53.863" LastActivityDate="2013-03-06T18:10:53.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8109" PostTypeId="2" ParentId="2565" CreationDate="2013-03-06T19:16:57.867" Score="4" Body="&lt;p&gt;In my experience best method for this is converting it to Lab color space.&#xA;L represents the light, and a and b are light independent.&#xA;OpenCV supports Lab color scale conversion.&lt;/p&gt;&#xA;" OwnerUserId="464" LastActivityDate="2013-03-06T19:16:57.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8110" PostTypeId="2" ParentId="3358" CreationDate="2013-03-07T08:54:12.797" Score="1" Body="&lt;p&gt;I was searching for a book as well, best to cover the basics required to learn and implement kalman filtering in real life situation. So far I finalized my choice to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1600867189&quot; rel=&quot;nofollow&quot;&gt;Fundamentals of Kalman Filtering: A Practical Approach (Progress in Astronautics and Aeronautics) by Paul Zarchan&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this should be the one and I'm ordering it now. :)&lt;/p&gt;&#xA;" OwnerUserId="4081" LastEditorUserId="80" LastEditDate="2013-03-07T09:44:47.593" LastActivityDate="2013-03-07T09:44:47.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8111" PostTypeId="1" CreationDate="2013-03-07T11:51:03.620" Score="-1" ViewCount="103" Body="&lt;p&gt;For background information, see &quot;Some background&quot; further down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a list that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Start-Time-In-Seconds;End-Time-In-Seconds&#xA;1;2&#xA;4;6&#xA;12;15&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works together with a wave file by acting as a cutlist. So the desired parts are 1-&gt;2, 4-&gt;6, 12-&gt;15, ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the distance between End-Time-In-Seconds of the previous element and Start-Time-In-Seconds of the current element is below a threshold of seconds(I call it &lt;em&gt;Pausendauer&lt;/em&gt;) I merge those two, ie if the threshold is 3 seconds then the list will be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Start-Time-In-Seconds;End-Time-In-Seconds&#xA;1;6&#xA;12;15&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the distance between Start-Time-In-Seconds and End-Time-In-Seconds is below a threshold of seconds(I call it &lt;em&gt;Minimallänge&lt;/em&gt;) I discard this sample, ie if the threshold is 4 seconds then the list will be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Start-Time-In-Seconds;End-Time-In-Seconds&#xA;1;6&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What could an algorithm look like that iterates (intelligently) through all combinations of &lt;em&gt;Minimallänge&lt;/em&gt; and &lt;em&gt;Pausendauer&lt;/em&gt; to aim at a certain number of entries? Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of entries should be 3. Given the number 3 the algorithm should iterate (intelligently) through all combinations of &lt;em&gt;Minimallänge&lt;/em&gt; and &lt;em&gt;Pausendauer&lt;/em&gt; to output something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Start-Time-In-Seconds;End-Time-In-Seconds&#xA;1;12&#xA;18;20&#xA;50;100&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that should be all. You notice I did not add &quot;...&quot; to it as the final list is to only consist of three entries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Some background&lt;/em&gt;: The wave file contains several interviews being recorded continuously with pauses in between. A VAD gave me areas where it presumes voice to be. As I know the number of total conversations(f.i. 3, usually more which is why this makes sense) my goal is to determine them automatically. The cutlist is the raw output of my VAD which I want to turn into a usable cutlist for ffmpeg.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;PS&lt;/em&gt;: If you can, share an algorithm in c#.&lt;/p&gt;&#xA;" OwnerUserId="4039" LastEditorUserId="4039" LastEditDate="2013-03-07T14:44:49.920" LastActivityDate="2013-03-07T14:44:49.920" Title="What could an algorithm look like that iterates through all combinations of two variables to aim at a certain number of entries?" Tags="|algorithms|adaptive-algorithms|c#|" AnswerCount="1" CommentCount="5" ClosedDate="2013-03-14T12:13:59.650" ContentLicense="CC BY-SA 3.0" />
  <row Id="8112" PostTypeId="2" ParentId="8101" CreationDate="2013-03-07T12:06:44.460" Score="1" Body="&lt;p&gt;The paper that you are quoting assumes that the motions along the different coordinates are independant functions, i.e., $$P(t) = \left(x(t),y(t)\right) = (f_1(t),f_2(t)) \neq f(x,y)(t),$$ where $P$ stand for position.&#xA;The various 1D functions are obtained in this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit of smoothing is generally helpful. &#xA;However, when to comes to gait recognition, you will probably have to test different smoothing procedures: my intuition is that gait recognition relies on high frequency / low amplitude clues that can easily be cancelled out (but I may be wrong for this).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-07T12:06:44.460" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8113" PostTypeId="1" CreationDate="2013-03-07T13:11:47.990" Score="4" ViewCount="3171" Body="&lt;p&gt;Given a discrete real signal &lt;span class=&quot;math-container&quot;&gt;$ f_{re}(t) $&lt;/span&gt; the (complex) analytic signal is given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ x(t) = f_{re}(t) + j*f_{im}(t) $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I want to calculate &lt;span class=&quot;math-container&quot;&gt;$f_{im}(t)$&lt;/span&gt;: the &lt;em&gt;quadrature&lt;/em&gt; by convolving with a Hilbert kernel of size 2*n+1:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f_{im}(t) = H*f_{re}(t)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H=[H_{-n},H_{-n+1},..,H_0,H_{n-1},H_n]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;According to &amp;quot;Complex seismic trace analysis&amp;quot;,M. T. Taner*, F. Koehler*, and R. E. Sheriff;&#xA;&lt;span class=&quot;math-container&quot;&gt;$ H_i = 2*sin^2(\pi i/2)/(\pi i), H_0 = 0$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$ n = \infty $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I want to use a finite length kernel, e.g. n=16.&#xA;Do I need to taper the kernel from the equation above with a window?&lt;/p&gt;&#xA;&lt;p&gt;How do I normalize the odd (antisymmetric) result kernel?&lt;/p&gt;&#xA;&lt;p&gt;Am I right in assuming that calculating the quadrature by convolving with H introduces a smoothing?&lt;/p&gt;&#xA;&lt;p&gt;If so; should I also smooth the real signal, e.g. by a gaussian kernel of size 2n+1?&lt;/p&gt;&#xA;&lt;p&gt;EDIT:&#xA;In Matlab there is a function called &amp;quot;firpm&amp;quot; that creates a &amp;quot;Parks-McClellan optimal equiripple FIR filter&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;It seems this is generally considered the &amp;quot;optimal&amp;quot; FIR approximation to an IIR?&lt;/p&gt;&#xA;&lt;p&gt;Does this mean that using the simple coefficient equation from &amp;quot;Complex seismic trace analysis&amp;quot; is too simplistic?&lt;/p&gt;&#xA;&lt;p&gt;EDIT2:&#xA;regarding the normalization: I tested in Matlab and found that convolving with a kernel calculated from the simple coefficient equation gave good results in the case of the input signal being a sine. However I had to divide by a factor m to get correct normalization:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;H5 = [-0.0000   -0.6366  0    0.6366    0.0000]: m = 0.1271&#xA;H7 = [-0.2122 -0.0000 -0.6366  0  0.6366 0.0000 0.2122]: m=0.2525 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What is the general formulae for m?&lt;/p&gt;&#xA;&lt;p&gt;EDIT 3:&#xA;The ideal kernel would have constant magnitude response. However it seems that since my kernel will be of finite size; it will act as an bandpass filter, and therefore I need to look out for bandpass ripple.&#xA;The solution seems to be a magnitude response that rolls of gently at the low and high frequencies. The &amp;quot;simple coefficient equation&amp;quot; is quite good in this respect; it does not introduce a lot of ripple, instead the shorter the kernel the earlier it starts rolling off. As an example here is the 19 point kernel:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7gdCV.png&quot; alt=&quot;Magnitude response of 19 point kernel from &amp;quot;simple coefficient equation&amp;quot;&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;In comparison the 19 point kernel from Matlabs firpm does not roll of at high frequencies (!?) but otherwise have roughly the same amount of ripple as my simple kernel:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zHGPc.png&quot; alt=&quot;Magnitude response of 19 point kernel from firpm&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;My conclusion so far thus seem to be: no the &amp;quot;simple coefficient equation&amp;quot; gives a good approximation to the optimal FIR for the Hilbert convolution operator. The &amp;quot;Parks-McClellan optimal equiripple FIR filter&amp;quot; might be slightly more &amp;quot;optimal&amp;quot; but the difference is neglible, at least for reasonably large kernels (say 19 points and upwards). &lt;strong&gt;Anything I am forgetting?&lt;/strong&gt; I will therefore move on with this approach. Only remaining problem: &lt;strong&gt;how do I normalize?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="697" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-08-20T00:19:43.610" Title="How do I find the Hilbert transform (qudrature) of a discrete signal by convolution with a Hilbert kernel?" Tags="|filters|discrete-signals|convolution|hilbert-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8114" PostTypeId="2" ParentId="8113" CreationDate="2013-03-07T14:25:20.010" Score="5" Body="&lt;p&gt;The short answer: with a finite convolution you can't calculate the Hilbert transform exactly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The long answer: You will have to make approximations and decide what types and amounts of error you can live with. This will depend heavily on the application, the signals itself and what you are trying to do with the results. This paper may give good guidance on math and potential trade offs &lt;a href=&quot;http://www.andrewduncan.ws/air/index.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.andrewduncan.ws/air/index.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Per se, the Hilbert Transform is not a smoothing operation. For example the HT of a cosine is a sine, which isn't any smoother.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-03-07T14:25:20.010" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8115" PostTypeId="2" ParentId="8111" CreationDate="2013-03-07T14:34:42.570" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;CPU is cheap these days, try them all. Unless the data set is&#xA;massively large 2-dim binary search should do it&lt;/li&gt;&#xA;&lt;li&gt;The problem is ill posed: for every given number of entries there will be many possible combination of Minimallänge and Pausendauer, so you need on extra constrain or assumption to get a unique answer&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A good way to visualize this would be the following: create a graph with Pausendauer as X-axis and Minimallänge as Y-axis. Then calculate the number of entries for each combo and then you can draw &quot;lines of equal number of entries&quot; into the graph. That will show you the general shape of the solution space. A 3-D graph obviously would do the same&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-03-07T14:34:42.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8116" PostTypeId="1" CreationDate="2013-03-07T18:02:50.150" Score="2" ViewCount="211" Body="&lt;p&gt;I understand that a digital signal processor consist of multiple MAD (muliply add units), which execute in parallel to implement a difference equation, like this one: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n]=10y[n-1] + 45y[n-2] + 45y[n-4]+ 67x[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this one;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n]=10x[n-1] + 45x[n-2] + 45x[n-4]+ 67x[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is do I need to be careful about synchronization as we do when programming a multicore CPU/GPU and FPGA? &#xA;If not why?  &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="1598" LastEditDate="2013-03-08T09:52:38.773" LastActivityDate="2013-03-08T09:52:38.773" Title="Do I need to worry about synchronization in a digital signal processor?" Tags="|dsp-core|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8117" PostTypeId="2" ParentId="8116" CreationDate="2013-03-07T18:21:30.590" Score="1" Body="&lt;p&gt;It's hard to come up with a general answer to such a question, because CPU architectures, especially those specialized for signal-processing applications, are all different. In most cases, you shouldn't have to worry about execution-unit synchronization on processors that support parallel execution of some combinations of instructions. In order to achieve such parallelism, there are often some criteria that must be met, such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Inter-instruction dependencies (or &lt;em&gt;data hazards&lt;/em&gt;), where the output of one instruction is the input to a subsequent one, can cause pipeline stalls if the previous instruction's latency is too large.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Often, you'll need to ensure that your input data is stored in a memory that is fast enough to support parallel execution. As an example, on TI C5000 architectures, there are two flavors of internal RAM: DARAM (double-access RAM) and SARAM (single-access RAM). In order to fully utilize the dual MAC units on the processor, your input data must be in DARAM, or the memory interface won't be fast enough to feed the execution units.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you meet these processor-specific constraints, then typically, the processor's pipeline logic is smart enough to know this and automatically forward instructions to the appropriate execution units, so that the process is transparent to you. It might be more involved than this on more complicated architectures: I seem to recall that some TI C6000 DSPs, for instance, had a pipeline with less protection, so by ordering instructions incorrectly, you could get undesired operation (whether that was reduced performance or incorrect answers, I don't remember).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-03-07T18:21:30.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8118" PostTypeId="2" ParentId="8116" CreationDate="2013-03-07T18:48:52.767" Score="1" Body="&lt;p&gt;That's heavily dependent on the processor. The difference equations that you list as an example,   is an IIR filter. Here the result for the current sample time depends on the result from the previous sample time. That really doesn't parallelize well and so multiple multiply add units aren't very useful. This is different for a FIR filter where every filter coefficient can run on an individual multiplier.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-03-07T18:48:52.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8119" PostTypeId="1" AcceptedAnswerId="8129" CreationDate="2013-03-07T20:45:48.117" Score="1" ViewCount="1028" Body="&lt;p&gt;I've implemented a soft-decoder for DQPSK using the wonderful answers I received here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8051/how-to-soft-decode-dqpsk#comment13421_8051&quot;&gt;How to soft decode DQPSK?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the soft-decoder working properly I needed to precode the data I was sending out.  I implemented the precoder mentioned in &lt;a href=&quot;http://www.shf.de/communication/support/application_notes/getfile/230/269/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$I_k=\overline{u_k \oplus v_k}*(u_k \oplus I_{k-1})+(u_k \oplus v_k)*(v_k \oplus Q_{k-1})$&#xA;$Q_k=\overline{u_k \oplus v_k}*(v_k \oplus Q_{k-1})+(u_k \oplus v_k)*(u_k \oplus I_{k-1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to know why this precoder is necessary -- what does that complicated expression of XORs actually accomplish?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a table showing what the equation yields.  If &quot;to_encode&quot; is 00, the to_send symbol is the same as the previous (&quot;prev&quot;) symbol.  If the &quot;to_encode&quot; is 11, the to_send symbol is the previous symbol xor 11.  What is the meaning in other cases?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;to_encode prev  to send&#xA;[ 0 0 ] [ 0 0 ] [ 0 0 ]&#xA;[ 0 1 ] [ 0 0 ] [ 1 0 ]&#xA;[ 1 0 ] [ 0 0 ] [ 0 1 ]&#xA;[ 1 1 ] [ 0 0 ] [ 1 1 ]&#xA;[ 0 0 ] [ 0 1 ] [ 0 1 ]&#xA;[ 0 1 ] [ 0 1 ] [ 0 0 ]&#xA;[ 1 0 ] [ 0 1 ] [ 1 1 ]&#xA;[ 1 1 ] [ 0 1 ] [ 1 0 ]&#xA;[ 0 0 ] [ 1 0 ] [ 1 0 ]&#xA;[ 0 1 ] [ 1 0 ] [ 1 1 ]&#xA;[ 1 0 ] [ 1 0 ] [ 0 0 ]&#xA;[ 1 1 ] [ 1 0 ] [ 0 1 ]&#xA;[ 0 0 ] [ 1 1 ] [ 1 1 ]&#xA;[ 0 1 ] [ 1 1 ] [ 0 1 ]&#xA;[ 1 0 ] [ 1 1 ] [ 1 0 ]&#xA;[ 1 1 ] [ 1 1 ] [ 0 0 ]&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-07-16T23:01:46.687" Title="Why is a precoder necessary for DQPSK and what does it accomplish?" Tags="|modulation|demodulation|channelcoding|qpsk|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8120" PostTypeId="1" CreationDate="2013-03-08T06:05:06.027" Score="4" ViewCount="2519" Body="&lt;p&gt;Is it possible to dynamically filter a signal in realtime on a microcontroller? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean by dynamically is to change the cut off frequency of the filter on the fly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some DSP knowledge and realize that I probably do not have the computational power to do an FFT on the fly. Instead I should be looking at creating an IIR or FIR filter that I can continually convolve with my signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is now whether or not I have enough computational power to generate the filter coeffecients quickly and then convolve with the signal. I'm guessing that because of this I'm going to have to be very lenient on the response of the filter which is ok for my application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at algorithms such as the Remez Exchange algorithm and believe this may be able to work but am not sure. I wanted to check before I start the lengthy process of implementing whether or not I am on the right track.&lt;/p&gt;&#xA;" OwnerUserId="4086" LastActivityDate="2013-03-08T13:06:36.190" Title="Realtime filtering on a microcontroller, with dynamic cut off frequencies" Tags="|filter-design|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8121" PostTypeId="2" ParentId="8120" CreationDate="2013-03-08T10:07:31.220" Score="3" Body="&lt;ul&gt;&#xA;&lt;li&gt;You can pre-compute the coefficients for a bunch (say $N=1024$) different cutoff frequencies. If your application doesn't need to provide fine control over the cutoff frequency, just read from your table and you're done. This works best if you have a lot of ROM and/or you use short FIR or IIR filters.&lt;/li&gt;&#xA;&lt;li&gt;If you need finer control than those $N$ values, and if the relationship between your coefficients and cutoff frequency is well-behaved (ideally, monotonic), you can use linear interpolation within the pre-computed table of coefficients. This works best with well-behaved structures like state-variable filters - for which the coefficients are monotonic functions of the cutoff frequencies, and which do not get unstable when modulating them at fast rates. This is a very common problem in musical audio applications (equalizers, synthesizer analog filter emulation...). If you use other filter topologies, make sure that they cannot get unstable when their coefficients are changed &quot;in mid-flight&quot; - to me, this is a harder problem than actually computing them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-03-08T10:07:31.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8122" PostTypeId="2" ParentId="8120" CreationDate="2013-03-08T13:06:36.190" Score="3" Body="&lt;p&gt;The main issues are different based upon whether you're doing FIR or IIR filtering:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;FIR:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You probably don't want to try designing filters via the Remez exchange algorithm online in a real time application. For some combinations of parameters, it can be tricky to get the algorithm to converge and/or it may take a lot of iterations, so the runtime for the filter design process isn't very predictable. That's not good for real-time systems.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One suitable algorithm for real-time filter design (although you have less control over the resulting frequency response) is the &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Window_Method_FIR_Filter.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;window design method&lt;/a&gt;. Essentially, you create a direct finite-length approximation of the ideal filter's frequency response. You don't have the same degrees of freedom as you would with a Remez exchange equiripple filter design, but the amount of computation required here is very predictable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You shouldn't have to worry about stability with FIR filters; they are unconditionally &lt;a href=&quot;http://en.wikipedia.org/wiki/BIBO_stability&quot; rel=&quot;nofollow noreferrer&quot;&gt;BIBO stable&lt;/a&gt;. This guarantee continues to hold even if you change the coefficients on the fly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;IIR:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You will want to think about the same things regarding how to calculate coefficients on the fly if you want to do that. Often, IIR filters are based upon some analog prototype (e.g. a &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Butterworth filter&lt;/a&gt;), using the analytically-known frequency response for the prototype filter and a mapping scheme like the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;bilinear transform&lt;/a&gt;. These could be amenable to dynamic recalculation, depending upon the complexity of the prototype filter's transfer function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One simple topology that allows for easy tuning of the filter cutoff is a so-called &quot;leaky integrator&quot;, which &lt;a href=&quot;https://dsp.stackexchange.com/questions/1004/low-pass-filter-in-non-ee-software-api-contexts/1006#1006&quot;&gt;is described in detail in this answer to a previous question&lt;/a&gt;. It contains a single parameter $\alpha$, which varies across the range $[0, 1)$. Adjusting this parameter will directly affect the filter's cutoff frequency. However, as a really simple filter structure, you don't have a lot of control over its frequency response if you have specific requirements for its shape.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;IIR filters are unstable if any of their poles lie outside the unit circle. Therefore, when designing such a filter, you'll want to make sure that you don't generate a design that toes this line. If you have poles that are inside, but very close to, the unit circle, then finite numeric precision effects could induce instability (think of roundoff error in your calculations that pushes the effective pole locations outside the unit circle). As pichenettes pointed out already, if you use an interpolation-based method for designing filters on the fly, then you should be very mindful of this requirement.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-03-08T13:06:36.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8123" PostTypeId="2" ParentId="3348" CreationDate="2013-03-08T13:55:58.207" Score="8" Body="&lt;p&gt;I can see a number of possible problems with this approach. I speak from my own experience here from improving a pedestrian counting system with a very similar approach, so I don't mean to be discouraging. On the contrary, I'd like to warn you of possible hurdles you may have to overcome in order to build an accurate and robust system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, &lt;strong&gt;background substraction&lt;/strong&gt; assumes that objects of interest will always be moving, and objects you aren't interested in counting will remain completely still. Surely enough, this may be the case in your scenario, but it still is a very limiting assumption. I've also found background substraction to be very sensitive to changes in illumination (I agree with geometrikal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be wary of making &lt;strong&gt;the assumption that one blob = one person&lt;/strong&gt;, even if you think that your environment is well controlled. It happened way too often that blobs corresponding to people went undetected because they weren't moving or they were too small, so they were deleted by erosion or by some thresholding criteria (and believe me, you don't want to get into the &quot;tune thresholds until everything works&quot; trap. It doesn't work ;) ). It can also happen that a single blob corresponds to two people walking together, or a single person carrying some sort of luggage. Or a dog. So don't make clever assumptions about blobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, since you do mention that you are using LBP's for &lt;strong&gt;person detection&lt;/strong&gt;, I think you are in the right track of not making the mistakes in the paragraph above. I can't comment on the effectiveness of LBP's in particular, though. I've also read that HOG (histogram of gradients) are a state of the art method in people detection, see &lt;a href=&quot;http://lear.inrialpes.fr/people/triggs/pubs/Dalal-cvpr05.pdf&quot;&gt;Histograms of Oriented Gradients for Human Detection&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My last gripe is related with using &lt;strong&gt;Camshift&lt;/strong&gt;. It is based in color histograms, so, by itself, it works nicely when tracking a single object that is easy to distinguish by color, as long as the tracking window is big enough and there are no occlusions or abrupt changes. But as soon as you have to track multiple targets which may have very similar color descriptions and which &lt;em&gt;will&lt;/em&gt; move very near to one another, you simply can't do without an algorithm that somehow allows you to maintain multiple hypothesis. This may be a particle filter or a framework such as MCMCDA (Markov Chain Monte Carlo Data Association, see &lt;a href=&quot;http://www.cs.berkeley.edu/~russell/papers/tr-mcmcda.pdf&quot;&gt;Markov Chain Monte Carlo Data Association for Multiple-Target Tracking&lt;/a&gt;). My experience with using Meanshift alone when tracking multiple objects is everything that shouldn't happen with tracking: losing track, confusing targets, fixating in the background, etc. Read a bit about multiple object tracking and data association problems, this might be at the heart of counting multiple people after all (I say &quot;might be&quot; because your goal is counting not tracking, so I don't completely discard the possibility of some clever approach that counts without tracking...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My last piece of advice is: &lt;strong&gt;there is only so much you can do with a given approach&lt;/strong&gt;, and you &lt;em&gt;will&lt;/em&gt; need fancier stuff to achieve better performance (so I disagree with user36624 in this regard). This may imply changing a piece of your algorithm by something more powerful, or changing the architecture altogether. Of course, you have to know which fancy stuff is really useful for you. There are publications that attempt to solve the problem in a principled way, while others simply come up with an algorithm for a given data set and expect you to train a classifier that isn't really suited to the problem at hand, while requiring you to adjust a few thresholds too. People counting &lt;em&gt;is&lt;/em&gt; ongoing research, so don't expect things to come easily. Do make an effort to learn things that are slightly beyond your ability, and then do it again and again...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I acknowledge that I haven't offered any solutions and instead have only pointed out flaws in your approach (which all come from my own experience). For inspiration, I recommend you read some recent research, for example &lt;a href=&quot;http://www.robots.ox.ac.uk/~lav/Papers/benfold_reid_cvpr2011/benfold_reid_cvpr2011.html&quot;&gt;Stable Multi-Target Tracking in Real-Time Surveillance Video&lt;/a&gt;. Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4089" LastActivityDate="2013-03-08T13:55:58.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8124" PostTypeId="1" AcceptedAnswerId="8125" CreationDate="2013-03-08T14:04:46.120" Score="3" ViewCount="1561" Body="&lt;p&gt;I'd like to ask when we apply Wavelet transform on 1-D Signal in Matlab it simply stores both Approximations and Details into a single row which is quite annoying for me,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;have a look,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W6HsN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X = original Signal&#xA;cDn = Details coefficients&#xA;cAn = Approximations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how Matlab do it,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a random sequence,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X=[2 2 3 100 4 0 98 100 90 2 3 67 98 0 6 6 89 9 21 78]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I apply 2-level Wavelet transform on this signal it will be decomposed in to cA1 and cD1. cA1 will then further decomposed into cA2 and cD2. But matlab will store all these A's and D's into a single row. Have a look what matlab will do to the resultant coefficients after performing Wavelet Transform on it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = 20 Samplesc  -&amp;gt; cD1 = 10 Samples&#xA;                    cA1 = 10 Samples&#xA;                                     -&amp;gt; cD2 = 5 Samples&#xA;                                        cA2 = 5 Samples&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rows = 1&#xA;Columns = 20&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Column 1 to 5 =   cA2&#xA;Column 6 to 10 =  cD2&#xA;Column 11 to 20 = cD1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why Matlab does that ? Why it doesn't decompose signal in Rows since that would be easier to represent.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2014-09-22T17:09:25.173" Title="Matlab stores all level of Wavelet's Approximation &amp; Details in a single Row" Tags="|matlab|wavelet|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8125" PostTypeId="2" ParentId="8124" CreationDate="2013-03-08T16:31:09.883" Score="2" Body="&lt;p&gt;You can use the function &lt;code&gt;dwt&lt;/code&gt; instead that does single-level decomposition and use that again for 2-level decomposition. Personally, I use &lt;code&gt;wavedec&lt;/code&gt; all the time, I actually find it easy to have it in one array. Boils down to personal preferences I guess.&lt;/p&gt;&#xA;" OwnerUserId="73" LastActivityDate="2013-03-08T16:31:09.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8126" PostTypeId="1" AcceptedAnswerId="8236" CreationDate="2013-03-08T16:41:55.343" Score="14" ViewCount="4463" Body="&lt;p&gt;I have an arbitrary shape defined by a binary mask (gray = shape, black = background).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to find a largest possible rectangle containing only gray pixels (such rectangle is pictured in yellow):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DNvCh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The shape is always &quot;one piece&quot; but it is not necessarily convex (not all point pairs on the shape's boundary can be connected by a straight line going through the shape).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes many of such &quot;maximum rectangles&quot; exist and then further constrains can be introduced, such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Taking the rectangle with its center nearest to shape's center of mass (or center of image)&lt;/li&gt;&#xA;&lt;li&gt;Taking rectangle with aspect ratio nearest to a predefined ratio (i.e. 4:3)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pN49e.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought about the algorithm is the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute distance transform of the shape and find its center of mass&lt;/li&gt;&#xA;&lt;li&gt;Grow square area while it contains only shape's pixels&lt;/li&gt;&#xA;&lt;li&gt;Grow the rectangle (originally a square) in width or height while it contains only shape's pixels.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, I think such algorithm would be slow and would not lead to optimal solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2017-09-07T11:22:38.727" Title="Automatic Cropping of Arbitrary Shapes" Tags="|image-processing|geometry|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8127" PostTypeId="1" CreationDate="2013-03-08T16:54:18.253" Score="1" ViewCount="64" Body="&lt;p&gt;Given an hidden law $$I(t)=\frac{1}{2}[A+B.cos(2\pi\nu_0t+\phi_0)]$$ I observe its signal with 256 samples and compute its FFT over this interval, and  represent the FFT result from 0 to 1 (normalised frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get a figure whose pic is at 0.83.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I retreive A,B and $\phi_0$ from this graphics ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A second question is : is it normal that this figure is not symmetric ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A final question is : doing an analytical computation on classical Fourier transform gives a result. How much does what I observe from FFT and the analytical result differ ?&lt;/p&gt;&#xA;" OwnerUserId="653" LastEditorUserId="653" LastEditDate="2013-03-08T17:04:41.890" LastActivityDate="2013-03-08T20:42:09.657" Title="How to get some law parameters from its FFT figure?" Tags="|fft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8129" PostTypeId="2" ParentId="8119" CreationDate="2013-03-08T20:28:49.693" Score="3" Body="&lt;p&gt;Regard the dibits as &lt;em&gt;Gray code&lt;/em&gt; representations of the&#xA;integers $0,1,2,3$, more specifically,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[0, 0] \leftrightarrow 0, ~~ [0, 1] \leftrightarrow 1, ~~ [1, 1] \leftrightarrow 2, ~~ [1, 0] \leftrightarrow 3.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the precoding scheme is nothing but &lt;strong&gt;differential encoding&lt;/strong&gt; for QPSK&#xA;with   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;to send = prev - to_encode&lt;/code&gt; modulo $4$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the line &lt;code&gt;[ 1 0 ] [ 0 1 ] [ 1 1 ]&lt;/code&gt; in the question says that to encode $3 = $ &lt;code&gt;[1 0]&lt;/code&gt;  when the previous symbol was $1 = $ &lt;code&gt;[0 1]&lt;/code&gt;, we send $1-3 = -2 \equiv 2 \bmod 4$ where $2 =$ &lt;code&gt;[1 1]&lt;/code&gt;.&lt;br&gt;&#xA;As stated in the answers and comments&#xA;on the &lt;a href=&quot;https://dsp.stackexchange.com/q/8051/235&quot;&gt;previous question&lt;/a&gt;, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Differential encoding for QPSK is &lt;strong&gt;not&lt;/strong&gt; the same as differential &#xA;  (binary) encoding of the I and Q bit streams separately.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So the precoding scheme is just differential encoding for QPSK.&#xA;As to &lt;em&gt;why&lt;/em&gt; it is included in the system, it must be that the&#xA;channel characteristics and system requirements are such that &#xA;coherent detection of the signal is not thought to be feasible, &#xA;and so the receiver is being implemented &#xA;is a differentially coherent detector for DQPSK (differentially encoded &#xA;QPSK).  Note that coherent detection requires that the receiver&#xA;phase lock loop acquire (and track) the incoming carrier in &#xA;both frequency and phase (including resolution of&#xA;the four-fold phase ambiguity) while for differentially coherent&#xA;detection, frequency acquisition and tracking suffices, so that&#xA;the receiver is simpler and more robust, though of course &#xA;for a given SNR, the BER of the differentially coherent&#xA;receiver is higher than the BER of the coherent receiver.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-03-09T02:54:10.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8130" PostTypeId="2" ParentId="8127" CreationDate="2013-03-08T20:35:15.920" Score="2" Body="&lt;p&gt;If you feed an FFT a finite set of samples from a function of theoretically infinite range, you have implicitly windowed your function with a rectangular window before the FFT.  Thus, the FFT result will be the convolution of the spectrum of your function and the transform of a rectangular window (a periodic Sinc).  This convolution will be an identity operation only if the samples happen to span exactly an integer multiple of periods of a purely periodic function.  So how much your FFT result will change or differ will depend on the offset and length of your FFT aperture/window with respect to some reference point on and the scale of your function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a single sinusoid in zero noise, I reference 2 papers by Clay Turner on solving for the 3 unknowns using only 3 or 4 non-aliased samples, somewhere on my web page: &lt;a href=&quot;http://www.nicholson.com/rhn/dsp.html&quot; rel=&quot;nofollow&quot;&gt;http://www.nicholson.com/rhn/dsp.html&lt;/a&gt;   No FFT needed.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-03-08T20:42:09.657" LastActivityDate="2013-03-08T20:42:09.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8132" PostTypeId="2" ParentId="8096" CreationDate="2013-03-09T05:39:11.583" Score="8" Body="&lt;p&gt;The simplest approach would be to divide the gradient rather than subtract it. Here's what the result looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mPU7B.jpg&quot; alt=&quot;Gradient Removal&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-03-09T05:39:11.583" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8133" PostTypeId="1" AcceptedAnswerId="8151" CreationDate="2013-03-09T06:25:03.463" Score="17" ViewCount="31898" Body="&lt;p&gt;I'm trying to understand how the PSD is calculated.  I've looked in a few of my Communication Engineering textbooks but to no avail.  I've also looked online.  &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_density#Motivating_example&quot;&gt;Wikipedia&lt;/a&gt; seems to have the best explanation; however, I get lost at the part where they decide to make the CDF (Cumulative Distrubution Function) and then for some reason decide to related that to the autocorrelation function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess what I don't understand is, how does autocorrelation having anything to do with calculating the PSD?  I would've thought that the PSD simple be the Fourier Transform of $P(t)$ (where $P(t)$ is the power of the signal with respect to time).&lt;/p&gt;&#xA;" OwnerUserId="1146" LastActivityDate="2013-03-12T11:29:44.110" Title="PSD (Power spectral density) explanation" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8134" PostTypeId="1" CreationDate="2013-03-09T09:16:06.753" Score="1" ViewCount="959" Body="&lt;p&gt;I am trying to understand different filters' and other things' effects on Radon Transform by using MATLAB. First I upload an image, then take its Radon transform with radon function and then reconstruct it with iradon function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I wanted to see the difference between undersampling the projection data by reducing the number of parallel beams by a factor of 4 and reducing the number of rotation angles by a factor of 4. However according to what I understood from radon and iradon functions' descriptions, I can only change the number of rotation angles. Is not it true? If not, what is the way to do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I do to decrease the number of rotation angles by a factor of 4:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread ('asdasd.tif'); &#xA;Rad = radon (img,0:4:179); &#xA;I_ram = iradon(Rad,0:4:179,'linear','Ram-Lak'); &#xA;I_ham = iradon(Rad,0:4:179,'linear','Hamming');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3323" LastActivityDate="2013-03-11T01:47:44.057" Title="Radon Transform reducing the number of parallel beams (MATLAB)" Tags="|matlab|image-processing|reconstruction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8135" PostTypeId="2" ParentId="8134" CreationDate="2013-03-09T17:48:07.943" Score="0" Body="&lt;p&gt;I do not think that you can reduce the number of parallel beams. I would also believe that even if there was a way to do it, that would not have solved your problem. This is because, in that case an additional question would arise - Which columns(or rows) of the data matrix will be struck by the beams. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think of the Radon Transform, it talks about projections of the data taken at multiple angles. Hence, it does not talk about what columns should be involved or not. Hence, that is the reason  I can figure out, for the absence of any such option of reducing the number of beams.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you change the number of angles, it would give you a good idea of its effect on the reconstruction. Greater the number, the better the reconstruction will be.&lt;/p&gt;&#xA;" OwnerUserId="3566" LastEditorUserId="76" LastEditDate="2013-03-10T06:10:13.710" LastActivityDate="2013-03-10T06:10:13.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8136" PostTypeId="1" CreationDate="2013-03-10T09:30:35.910" Score="5" ViewCount="2157" Body="&lt;p&gt;I've written a quick test app that uses the Goertzel algorithm to determine if a given frequency is present in the signal. This is to pick up DTMF tones and various other signals. The app appears to be working. I'm using the 'magnitude squared' approach in my final stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm&quot; rel=&quot;noreferrer&quot;&gt;http://www.embedded.com/design/configurable-systems/4024443/The-Goertzel-Algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how does this magnitude relate to all the other variables (especially the amplitude of the source signal)? Most of the implementations determine the presence of a given frequency if the magnitude exceeds some threshold. I want to know how this threshold is determined, and how would I go about selecting a suitable threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, I think I've found the answer (I hope). Most implementations of the algorithm state that is will return the 'relative power'. I couldn't find any that stated what it was relative to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This morning, it dawned on me (pun intended) that it's probably relative to the input signal (duh!). So, if we calculated what the power of the input signal is over all the samples taken, and then compare this to the relative power given by the algorithm, we should have a good idea of the contribution of our target frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my understanding correct?&lt;/p&gt;&#xA;" OwnerUserId="4093" LastEditorUserId="4093" LastEditDate="2013-03-10T20:47:36.340" LastActivityDate="2013-04-09T21:03:44.967" Title="Goertzel algorithm: Relationship of magnitude" Tags="|filters|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8137" PostTypeId="1" CreationDate="2013-03-10T15:35:31.323" Score="12" ViewCount="1003" Body="&lt;p&gt;How would would one approximately reconstruct the branches in a photo of a tree, where portions of the branches are covered by leaves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can extract the visible portions of the branches by threshholding then opening with line segments at a few different angles.  But how would I then (approximately) fill in the spaces that were covered by leaves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we start with this drawing of a tree:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1vnFx.jpg&quot; alt=&quot;color tree&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;load the image as grayscale&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;uu = mmreadgray('tree2.jpg')&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jIbl2.jpg&quot; alt=&quot;tree&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;threshold the darker colors; convert to binary; remove connected regions under 200px area&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;vv = mmareaopen(mmbinary(mmthreshad(mmneg(uu), 200)), 20)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1iioK.jpg&quot; alt=&quot;tree&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;open vv with 10px line segments at 90 degrees, 180 degrees, 135 degrees and 45 degrees; add these images together to form a marker image zz&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;zz = mmaddm(mmaddm(mmaddm(mmopen(vv, mmseline(10, 90)), mmopen(vv, mmseline(10, 180))), mmopen(vv, mmseline(10, 135))), mmopen(vv, mmseline(10, 45)))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5i26b.jpg&quot; alt=&quot;tree&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;reconstruct the visible limb portions in vv from marker image zz&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;aa = mminfrec(zz, vv)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hnzxP.jpg&quot; alt=&quot;tree&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;display result aa on top of original image uu; a reasonable extraction of limbs is achieved&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;mmshow(uu, aa)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OXFg9.jpg&quot; alt=&quot;tree&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any thoughts on how to now approximately reconstruct the entire limb.  (Or improvements to the steps given above).  Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3912" LastEditorUserId="80" LastEditDate="2013-03-15T21:55:20.813" LastActivityDate="2013-10-14T00:33:05.620" Title="Reconstructing Tree Limbs that are Occluded by Leaves" Tags="|image-processing|matlab|image-segmentation|morphology|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8138" PostTypeId="2" ParentId="8136" CreationDate="2013-03-10T16:44:25.470" Score="3" Body="&lt;p&gt;You can potentially base the threshold on the overall energy in the frame. If the tone has, say, 10% or more of the total energy, there is a good bet it's there and not just noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general FFT based algorithms may not be the best choice for this. Unless your tone and your local sample clock are phase-locked, you can't line up the tone on one of the FFT bins (or your Goertzel frequency) so the energy of the tone will &quot;smear&quot; out over multiple frequency bins. The FFT is actually a pretty band band pass filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative would be a time-domain band pass filter with a well defined bandwidth and steepness. This would also get rid of the framing constraint and you can dial in the time constant based on the properties of the signal rather then internal properties of the algorithm. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-03-10T16:44:25.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8139" PostTypeId="1" CreationDate="2013-03-10T18:41:56.067" Score="2" ViewCount="309" Body="&lt;p&gt;I'm working with a Continuous Hidden Markov Model, and using the Viterbi Decoder which finds the best possible path for a given sequence. Here is how my algorithm works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Process the (input) .wav speech signal&#xA;2) Extract the MFCC Coefficients (13) &#xA;3) Use these values to train the HMM&#xA;4) Execute the Viterbi Decoder &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And an example input, after step 4 gives the best path of: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 0 0 0 0 0 0 0 0 0 0 0 2 12 6 6 2 2 4 2 2 2 2 2 6 4 2 2 6 6 2 2 2 2 2 2 2 2 &#xA;8 4 4 2 4 2 2 2 2 6 2 2 4 2 6 2 2 2 2 2 6 2 10 2 6 4 2 2 4 2 2 2 2 2 4 4 2 2 2 &#xA;6 10 2 2 4 2 2 2 2 2 2 4 2 2 4 2 2 2 2 2 2 4 2 2 2 2 6 2 2 2 2 2 2 4 4 2 2 2 2 &#xA;2 2 2 2 2 2 2 2 4 2 12 2 6 2 2 2 2 2 2 2 2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 &#xA;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 1 2 2 2 2 2 2 2 6 2 2 6 2 2 2 &#xA;2 12 2 2 2 13 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 8 4 4 2 2 2 2 2 2 4 2 2 4 &#xA;2 6 2 6 6 12 2 2 4 2 12 4 2 2 2 10 4 2 6 8 8 2 2 2 2 12 4 2 2 12 6 2 2 2 8 2 4 &#xA;2 4 2 2 2 12 2 2 2 2 4 4 6 2 2 6 6 2 4 4 2 2 2 4 2 4 10 10 8 2 2 2 2 6 4 2 4 2 &#xA;2 2 2 4 2 2 4 2 2 8 2 2 2 2 2 2 8 2 6 2 4 2 10 8 4 2 2 8 2 2 4 4 2 2 8 4 2 6 8 &#xA;4 2 2 12 2 6 2 4 8 4 2 2 2 2 4 2 2 2 2 2 2 2 2 2 2 4 2 4 2 2 2 2 2 2 2 2 2 2 2 &#xA;8 2 2 2 2 4 2 2 2 2 8 2 2 4 4 2 2 2 6 2 4 2 2 2 12 2 2 2 2 4 2 12 2 2 2 2 2 2 &#xA;2 8 2 2 2 6 12 2 2 2 2 2 2 2 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I find the best possible path for each of my training data (MFCC) against the model, carried out in the steps above. This gives an ok result when comparing myself, in that, if I enter a speech file &quot;Yes&quot; as input, then, the training for &quot;Yes&quot; will show a very simular path, whereas, if I entered &quot;Yes&quot; as input and compared against training for &quot;No&quot; then the best path will be different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is this: Which would give me the most efficient way to compare the viterbi paths? I have only researched the Euclidean Distance algorithm, as well as the Hamming Distance so would prefer to use these. I know it's a very subjective question, but, I am asking in terms of being able to match two possible paths. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope someone can help me. &lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2013-03-10T18:41:56.067" Title="Most efficient algorithm for comparing two paths" Tags="|speech-recognition|mfcc|hmm|viterbi-algorithm|" AnswerCount="0" CommentCount="24" ContentLicense="CC BY-SA 3.0" />
  <row Id="8140" PostTypeId="1" CreationDate="2013-03-10T19:20:38.503" Score="3" ViewCount="357" Body="&lt;p&gt;I'm trying to get a grip on Wavelets. I've read &quot;Wavelets, Their Friends, and What They Can Do for You&quot; which lead me to an implementation of the discrete DWT with filter banks. Basically, I'm using the equations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a_{j,k} = \left[\tilde{H} * a_{j+1}\right](2k)\\&#xA;d_{j,k} = \left[\tilde{G} * a_{j+1}\right](2k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which involve convolution and downsampling to get the coefficients $a$ and $d$. $\tilde{H}$ and $\tilde{G}$ refer to the flipped impulse response of the wavelet, for which I currently use normalized Daubechies 2 (db2), i. e. $H = \{0.483, 0.837, 0.224, -0.129\}$ and $\tilde{H} = \{-0.129, 0.224, 0.837, 0.483\}$. Convolution is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left[\tilde{H} * a_{j+1}\right](2k) := \sum_{n=0}^{3} \tilde{h}_na_{j+1,2k-n}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and uses a periodically extended signal. For $\tilde{G}$ it is defined likewise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I wanted to transform the very simple signal $x = [1,2,3,4] = a_{1}$ to the coefficients $a$ and $d$. For testing purposes I used PyWavelets, which claims to be tested against Matlab. The result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a_{0,0}=2.82842712\ a_{0,1}=4.24264069\\ d_{0,0}=-0.51763809\ d_{0,1}=1.93185165&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for both implementations, i.e. my own and PyWavelets. However, for a slightly extended signal $x = [1,2,3,4,5]$, the ordering and some values of the coefficients does not match. E.g. for $a$ &lt;strong&gt;my&lt;/strong&gt; implementation yields $[3.725, 5.787, 3.311]$, whereas PyWavelets yields $[3.311, 3.725,  7.106]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm confused and I'm trying to clarify some things, so&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there a way to test the correctness of the decomposition? E.g. by applying inverse DWT and testing whether the resulting signal matches the original signal?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If 1. succeeds in my case, then is the ordering of the coefficients not relevant if the correct reverse ordering is applied?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why does the book names Daubechies Wavelet as DB2, although it has 4 taps? PyWavelets does this likewise, but e.g. Wikipedia does this &lt;strong&gt;not&lt;/strong&gt;, anyway, I'm not a fan of wikipedia.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to &lt;em&gt;datageist&lt;/em&gt; for answering question #3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the other two, I came up with the idea that my convolution might be wrong, and I tested two other &quot;modes&quot; of PyWavelets, namely zero-padding (&lt;em&gt;zpd&lt;/em&gt;) and periodic-padding (&lt;em&gt;ppd&lt;/em&gt;). Before that I used the periodic mode (&lt;em&gt;per&lt;/em&gt;) which basically also performs &lt;em&gt;ppd&lt;/em&gt; but yields less elements, and I had problems with that. So, I changed the signal with the filter and from now on moved the filter through the signal. For &lt;em&gt;ppd&lt;/em&gt; I get the following scheme:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{matrix}&#xA;x &amp;amp; 1 &amp;amp; 2 &amp;amp; 3 &amp;amp; 4 &amp;amp; 5 &amp;amp; 6 \\ \\&#xA;a_3 &amp;amp; 0.224 &amp;amp; -0.129 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0.483 &amp;amp; 0.832 \\&#xA;a_2 &amp;amp; 0.483 &amp;amp; 0.832 &amp;amp; 0.224 &amp;amp; -0.129 &amp;amp; 0 &amp;amp; 0 \\&#xA;a_1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0.483 &amp;amp; 0.832 &amp;amp; 0.224 &amp;amp; -0.129 \\&#xA;a_0 &amp;amp; 0.224 &amp;amp; -0.129 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0.483 &amp;amp; 0.832 &#xA;\end{matrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplying row elements with $x$ and summing up yields the correct result for each row, and it also matches with PyWavelets (except for rounding issues). The same goes for zpd:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{matrix}&#xA;x &amp;amp; 1 &amp;amp; 2 &amp;amp; 3 &amp;amp; 4 &amp;amp; 5 &amp;amp; 6 \\ \\&#xA;a_3 &amp;amp; 0.224 &amp;amp; -0.129 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;a_2 &amp;amp; 0.483 &amp;amp; 0.832 &amp;amp; 0.224 &amp;amp; -0.129 &amp;amp; 0 &amp;amp; 0 \\&#xA;a_1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0.483 &amp;amp; 0.832 &amp;amp; 0.224 &amp;amp; -0.129 \\&#xA;a_0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0.483 &amp;amp; 0.832 &#xA;\end{matrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which also yields the correct results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for &lt;em&gt;per&lt;/em&gt;, the results are still wrong, so I'll have to find out what they do there.&lt;/p&gt;&#xA;" OwnerUserId="4094" LastEditorUserId="4094" LastEditDate="2013-03-11T08:57:33.740" LastActivityDate="2013-03-11T08:57:33.740" Title="Wavelet computation with filter bank - differing results" Tags="|discrete-signals|convolution|wavelet|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8141" PostTypeId="2" ParentId="853" CreationDate="2013-03-11T00:24:28.783" Score="5" Body="&lt;p&gt;Your derivations are correct.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\bar P = P(t|t-1)$ and $K(t) = A \bar K$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this your confusion: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why didn't they have the term $t|t-1$ in the Kalman Gain and Covariance Matrix Expressions?&lt;/li&gt;&#xA;&lt;li&gt;How can this be &quot;stationary&quot; when your derivation shows that it is time varying? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Bad choice of notation on the &lt;em&gt;book's&lt;/em&gt; part&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Let's look at the expression: &#xA;$ \bar P = A\bar PA^T - A\bar P C^T(C\bar P C^T + R)^{-1}C\bar PA^T + Q $. &#xA;The fact that $\bar P $ is a function of itself shows a recursive relationship. In other words, it uses its past values. So, it is &lt;strong&gt;NOT&lt;/strong&gt; the same for all time instants -  It changes at every iteration. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Misunderstanding of the word &quot;stationary&quot;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;When the author of the book said &quot;stationary&quot; he/she did not mean that $P$ and $K$ have the same value at all time instants. Instead, the author wanted to emphasise that the expressions for those to values are the same for all statistical realisations.  Stationarity is a statistical concept which means that the &lt;strong&gt;Statistics&lt;/strong&gt; of the system is same all the time. Look at the expressions for $\bar P$ and $\bar K$ again. They depend only on &#xA;\&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Previous values of themselves&lt;/li&gt;&#xA;&lt;li&gt;Transition matrices $A$ and $C$ which are deterministic and in your case time-invariant ($A$  and $C$ are the same at all times)&lt;/li&gt;&#xA;&lt;li&gt;$Q$ and $R$ which are the noise covariance matrices. These 2 matrices describe the statistics of the noises and are the same in all realisations and time instances. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The Kalman gain, $K$, and the state covariance Matrix $P$ will have the same value for all realisations of this random process. (&lt;em&gt;Side Note: None of these 2 terms depend on the measurements, $y$. So they can be computed beforehand.&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Conclusion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;time-variant&quot; equations you derived were equivalent to the ones in the book. Besides, the notational differences, there was a slight misunderstanding on your part regarding what changes and what doesn't.  &lt;/p&gt;&#xA;" OwnerUserId="4096" LastActivityDate="2013-03-11T00:24:28.783" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8142" PostTypeId="2" ParentId="2347" CreationDate="2013-03-11T01:20:02.467" Score="13" Body="&lt;p&gt;The Kalman gain tells you &lt;strong&gt;how much&lt;/strong&gt; I want to change my estimate by given a measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;${\bf S}_k$ is the estimated covariance matrix of the measurements ${\bf z}_k$. This tells us the &quot;variability&quot; in our measurements. If it's large, it means that the measurements &quot;change&quot; a lot. So your confidence in these measurements is low. On the other hand, &lt;strong&gt;if ${\bf S}_k$ is small&lt;/strong&gt;, variability is low, our confidence in the measurement increases. When we are confident about our measurements, were  confident that the information we're obtaining is good enough for us to update/change our state estimates. So the Kalman gain is higher. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;${\bf P}_k$ is the estimated state covariance matrix. This tells us the &quot;variability&quot; of the state, ${\bf x}_k$. &lt;strong&gt;If ${\bf P}_k$ is large&lt;/strong&gt;, it means that the state is estimated to change a lot. So you need to be able to change your estimates with new measurements. As a result, the Kalman gain is higher. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conversely,  if ${\bf P}_k$ is small, then you know that your state doensn't change that much, so you don't want to alter your estimates too much at every time instant. @Jav_Rock's answer says that if ${\bf P}_k \rightarrow 0$, then the $K\rightarrow 0$. In other words, he implied that if you think that your state doesn't vary anymore, you don't try to change your estimate anymore. &lt;/p&gt;&#xA;" OwnerUserId="4096" LastEditorUserId="4096" LastEditDate="2013-03-12T06:10:38.213" LastActivityDate="2013-03-12T06:10:38.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8143" PostTypeId="2" ParentId="3358" CreationDate="2013-03-11T01:31:39.943" Score="1" Body="&lt;p&gt;A good 3 part series of Youtube Videos (~10 mins each) provides an intuitive understanding of the Kalman Filter.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=FkCT_LV9Syk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Student Dave - Tutorial: Kalman Filter with MATLAB&lt;/a&gt; (YouTube Video).&lt;/p&gt;&#xA;&lt;p&gt;One thing to note is that there are various ways to derive the Kalman Filter equations and each method gives you a different perspective of how it works. So, I suggest that you look into 2 - 3 different derivations to help you internalize this algorithm.&lt;/p&gt;&#xA;" OwnerUserId="4096" LastEditorUserId="128" LastEditDate="2021-12-01T21:04:00.513" LastActivityDate="2021-12-01T21:04:00.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8144" PostTypeId="2" ParentId="8134" CreationDate="2013-03-11T01:47:44.057" Score="1" Body="&lt;p&gt;Unfortunately you can't do this with the &lt;code&gt;radon&lt;/code&gt; function as it comes.  However, the function is written in MATLAB form (as opposed to being a compiled function), so you could extend the function yourself.  This would also be a good way to learn more about the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To reconstruct properly, you would also need to perform edits on the &lt;code&gt;iradon&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative way to get what you're looking for would be to get projections as they come from &lt;code&gt;radon&lt;/code&gt;, then reduce the array size by averaging the projection rays in groups of 4.  You would probably want the reconstruction to be the same size, so you'd need to repeat the averaged values 4 times in the argument to &lt;code&gt;iradon&lt;/code&gt;.  So maybe something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p = phantom ();&#xA;proj = radon (p, 0:179);&#xA;proj_avg = proj (1:4:end,:) + proj (2:4:end,:) ...&#xA;         + proj (3:4:end,:) + proj (4:4:end,:);&#xA;proj_rep = reshape (repmat (proj_avg',1,4)', [], length (proj(:,1)))';&#xA;recon_few_beams = iradon (proj_rep, 0:179);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-11T01:47:44.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8145" PostTypeId="2" ParentId="2197" CreationDate="2013-03-11T02:28:37.993" Score="2" Body="&lt;p&gt;In short, it all depends on what you're trying to estimate i.e. what you know about the signal and what you don't. The Kalman filter will try to estimate the state based on &lt;em&gt;your&lt;/em&gt; definition of what that state is. The conventional problem is when we are trying to estimate the AR coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take an example of an $AR(2)$ model with no constant term $\mu$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y_k =  a_1y_{k-1} + a_2y_{k-2} + \eta_k$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To estimate the system above, all you need to do is estimate the AR coefficients, $a_1$ and $a_2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;General Kalman Filter State Space set-up:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {\bf x}_{k} = {\bf F}_{k-1}{\bf x}_{k-1} + {\bf w}_k $$&#xA;$$ {\bf y}_{k} = {\bf H}_{k}{\bf x}_{k} + {\bf v}_k $$&#xA;$ {\bf w}_k= WGN(0,  Q^s)$  and $ {\bf v}_k= WGN(0,  Q^o)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, we need to estimate $a_1$ and $a_2$. So it is natural to set the state as these coefficients. ${\bf x}_k = [a_1, a_2]^T$ For this example, tthese coeffients are constant (${\bf F}_{k} ={\bf F}_{k-1} = {\bf I} $) and there is no noise in these coefficients either  -&gt; ${\bf w}_k = {\bf 0} \implies Q^s = {\bf 0}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since all we observe is $y_k$, they become the measurements for our system. Since we have already defined what the state vector is, for our measurement equations to be equal to the AR model given, we replace our measurement noise $ {\bf v}_k$ with $\eta_k$ and ${\bf H}_{k} = [y_{k-1}, y_{k-2}]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {\bf x}_{k} = {\bf x}_{k-1} = \begin{bmatrix} &#xA;                                     a_1 &#xA;                                   \\ a_2 &#xA;                                  \end{bmatrix}$$&#xA;$$ y_k = {\bf H}_{k}{\bf x}_{k} + \eta_k = \begin{bmatrix} y_{k-1} &amp;amp; y_{k-2} \end{bmatrix}\begin{bmatrix} &#xA;                                     a_1 &#xA;                                   \\ a_2 &#xA;                                  \end{bmatrix} + \eta_k $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can use the Kalman filter to estimate your state and consequently your signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: The only odd thing here is your matrix ${\bf H}_k$ depends on your measurements $y_k$. Some people have the misconception that the Kalman Gains and State Covariance Matrix are always measurement independent and that they can be computed beforehand. This case clearly shows that this is not the case. Both the Kalman Gain and State Covariance Matrix are estimated with functions of  ${\bf H}_k$, which in this case is measurement dependent.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4096" LastEditorUserId="4096" LastEditDate="2013-03-11T02:40:27.590" LastActivityDate="2013-03-11T02:40:27.590" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8146" PostTypeId="1" AcceptedAnswerId="8147" CreationDate="2013-03-11T04:22:23.063" Score="6" ViewCount="917" Body="&lt;p&gt;I'm doing autocorrelation (via fft) on pure, synthetic generated sinusoids and getting unexpected jitter in the results.  The jitter depend on where in the sine the signal buffer is started.  I get the correct results if I start the buffer at 0 and 180 degrees of a sine wave, and get the most error at 90 and 270 degrees.  I am padding with zeros after the signal buffer up to the next power of 2 above 2x-1 the signal buffer size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been using scipy fftconvolve, as well as doing the auto-correlation with fft, multiply the results by it's complex conjugate, then inverse fft.   I get the same results both ways.   This makes me think I am not preparing my signal buffer properly or analyzing the autocorrelation function results correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are two examples of autocorrelation of a 440hz signal.  The signal buffer the autocorrelator is analyzing is enclosed by the two vertical lines, approximately two and a half periods and 256 samples at 44.1khz sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first example, the buffer is filled with the sine starting at 0 degrees.  The result is 440.7 hz.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/arGub.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second example, below, the buffer is filled with the sine starting at 90 degrees.  The result is 453hz, a considerable error.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cINdY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on why the error is so large in the second example?&lt;/p&gt;&#xA;" OwnerUserId="4008" LastEditorUserId="4008" LastEditDate="2013-03-11T15:57:21.573" LastActivityDate="2013-03-11T21:25:12.577" Title="Autocorrelation Jitter" Tags="|fft|autocorrelation|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="8147" PostTypeId="2" ParentId="8146" CreationDate="2013-03-11T16:57:29.393" Score="5" Body="&lt;p&gt;The (periodic) autocorrelation function of a sinusoid $A\cos(2\pi f_0 t + \theta)$&#xA;is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;R(\tau) &amp;amp;= \int_0^{f_0^{-1}} A\cos(2\pi f_0 t + \theta)&#xA;A\cos(2\pi f_0 (t +\tau)+ \theta)\,\mathrm dt\\&#xA;&amp;amp;= \frac{A^2}{2}\int_0^{f_0^{-1}} \cos(2\pi f_0\tau)+\cos(2\pi f_0 (2t +\tau)+ \theta)\,\mathrm dt\\&#xA;&amp;amp;= \frac{A^2}{2f_0}\cos(2\pi f_0\tau)&#xA;\end{align}$$&#xA;which has a peak at $\tau = 0$. Notice in&#xA;particular that there is no dependence on $\theta$.   More generally,&#xA;if the integration is carried out over an interval $[0,T]$&#xA;of arbitrary length, we get&#xA;$$\begin{align}&#xA;\hat{R}(\tau) &amp;amp;= \int_0^{T} A\cos(2\pi f_0 t + \theta)&#xA;A\cos(2\pi f_0 (t +\tau)+ \theta)\,\mathrm dt\\&#xA;&amp;amp;= \frac{A^2}{2}\int_0^{T} \cos(2\pi f_0\tau)+\cos(2\pi f_0 (2t +\tau)+ \theta)\,\mathrm dt\\&#xA;&amp;amp;= \frac{A^2T}{2}\cos(2\pi f_0\tau) + \left.\frac{A^2}{2}\frac{\sin(2\pi f_0 (2t +\tau)+ \theta)}{4\pi f_0}\right|_0^T\\&#xA;&amp;amp;= \frac{A^2T}{2}\cos(2\pi f_0\tau) + \frac{A^2}{2}\frac{\sin(2\pi f_0 (2T +\tau)+ \theta)-\sin(2\pi f_0\tau + \theta)}{4\pi f_0}\\&#xA;&amp;amp;= \frac{A^2T}{2} \left[\cos(2\pi f_0\tau) + \frac{\sin(2\pi f_0 (2T +\tau)+ \theta)-\sin(2\pi f_0\tau + \theta)}{4\pi f_0T}\right]&#xA;\end{align}$$&#xA;which &lt;em&gt;does&lt;/em&gt; depend on $\theta$ as well as $T$. Notice that &#xA;if $T$ is an integer multiple $kf_0^{-1}$ of the fundamental&#xA;period $f_0^{-1}$, then the second term&#xA;in brackets disappears entirely and we get&#xA;$$\hat{R}(\tau) = kR(\tau).$$&#xA;On the other hand, since the numerator in that second term cannot&#xA;have value more than $2$, we get that if $T \gg f_0^{-1}$ but&#xA;is not an integer multiple of $f_0^{-1}$, the&#xA;second term is quite small in magnitude and so the autocorrelation&#xA;function that one deduces from $\hat{R}(\tau)$ depends only&#xA;very slightly on $\theta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that as prologue, I point out to you that the FFT method of &#xA;computing the autocorrelation function of a signal gives the&#xA;periodic autocorrelation function of a &lt;em&gt;segment&lt;/em&gt; of the&#xA;signal, that is, what one gets is effectively an approximation to &#xA;$\hat{R}_x(\tau)$ for a &lt;em&gt;periodic&lt;/em&gt; signal $x(t)$ that is &lt;em&gt;approximately&lt;/em&gt; &#xA;$2.5$ periods of a sinusoid repeated over and over again.  In particular,&#xA;this periodic repetition &lt;strong&gt;is not the same&lt;/strong&gt; as the sinusoid continuing&#xA;smoothly and without break as one would want it to be for the above&#xA;results to apply.  Thus, it is not at all surprising that the&#xA;results from the &#xA;FFT method of computing the autocorrelation function depend more&#xA;heavily on the phase of the sinusoid. In approximately&#xA;$2.5$ periods, the $sin(\cdot)$ goes from $0$ at $t=0$ to nearly&#xA;$0$ again at the end of nearly $2.5$ periods. Thus, the periodic&#xA;extension is &lt;em&gt;nearly&lt;/em&gt; continuous (though there is an abrupt&#xA;change of phase at the transition). On the other hand, with&#xA;a $90$-degree phase shift, $\cos(\cdot)$ goes from $1$ at &#xA;$t = 0$ to nearly $-1$ at the end of nearly $2.5$ periods,&#xA;and so the periodic extension is &lt;em&gt;very&lt;/em&gt; discontinuous. This&#xA;shows up in the FFT results which don't get a good estimate of&#xA;the frequency in the latter case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take the frequency of the sinusoid to be be such&#xA;that an &lt;em&gt;integer&lt;/em&gt; number of cycles fit into the $N$ that&#xA;you are using for your FFT, these artifacts will disappear.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-03-11T16:57:29.393" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8148" PostTypeId="2" ParentId="8146" CreationDate="2013-03-11T21:20:10.413" Score="1" Body="&lt;p&gt;FFT-based autocorrelation gives you a circular autocorrelation, which will be phase dependent for any waveform not perfectly periodic in the FFT aperture width, due to the discontinuity at the wrap-around points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could try instead is a (FFT fast) cross-correlation between a zero-padded copy of the data against a longer unpadded vector of the same data source.  If the zero-padding is longer than the period, then the circular effects will be removed (similar to the effect of zero-padding for fast convolution) for some range of lags.  If you expect noise, then you might also want to try windowing just the portion of the data to be zero-padded.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-03-11T21:25:12.577" LastActivityDate="2013-03-11T21:25:12.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8149" PostTypeId="1" AcceptedAnswerId="8150" CreationDate="2013-03-11T20:20:58.990" Score="7" ViewCount="4576" Body="&lt;p&gt;I would like to know the theoretical difference or relationship between noise and artifact in images, I barely know the relation between noise and distributions, but I'd like a deep explanation if it is possible related to medical imaging field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have a link, paper at hand?&lt;/p&gt;&#xA;" OwnerUserId="543" OwnerDisplayName="user12287" LastActivityDate="2013-03-12T00:50:27.750" Title="In image processing, what is the difference or relationship between noise and artifact?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8150" PostTypeId="2" ParentId="8149" CreationDate="2013-03-11T22:48:26.873" Score="12" Body="&lt;p&gt;The difference is that noise may obscure features in an image, while artefacts appear to be features but are not.  If the 'problem' is structured, it is probably an artefact, whereas if it is random, it is probably noise (as a generalisation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A computed tomography example:  noise will make the image look grainy, and make small differences in contrast difficult (or impossible) to identify.  A streak artefact on the other hand has structure to it, and looks like the patient has a region of low density where they actually don't.  Likewise with ring artefacts - they look like the patient has ring shaped structures within them.  Artefacts are generally caused by assumptions made in the development of the reconstruction algorithm (though not always).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is similar to the difference between noise and interference in some other fields - interference is structured in some way, having some particular source, while noise is less predictable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Just found something in the glossary of &quot;Computed Tomography&quot; by Willi A. Kalender, 2011 (978-3-89578-317-3):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;artifact&lt;/strong&gt;: part of the contents of an image that does not have a counterpart in the physical object being imaged; in CT images an artifact can appear as false structures (e.g. aliasing artifact, beam hardening artifact, motion artifact, partial volume artifact) or as a corruption of the CT numbers.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;noise&lt;/strong&gt;: contributions to a measured signal due to random processes; in principle these contributions are of statistical nature and do not carry any information about the signal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If that's of any use to you.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastEditorUserId="1496" LastEditDate="2013-03-12T00:50:27.750" LastActivityDate="2013-03-12T00:50:27.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8151" PostTypeId="2" ParentId="8133" CreationDate="2013-03-12T00:31:10.640" Score="21" Body="&lt;p&gt;You are right, PSD has to do with calculating the Fourier Transform of the power of the signal and guess what.....it does. But first let's look at the mathematical relationship between the PSD and the autocorrelation function.  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Notations: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fourier Transform:&#xA;$$ \mathcal{F}[  x(t)] = X(\omega) = \int_{-\infty}^{\infty} x(t)e^{-j\omega t}dt $$ &lt;/li&gt;&#xA;&lt;li&gt;(Time) Auto-Correlation Function:&#xA;$$ R(\tau) = x(\tau) * x(-\tau) = \int_{-\infty}^{\infty} x(t)x(t + \tau)dt $$ &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's prove that the Fourier Transform of the Auto-Correlation function does indeed equal to the Power Spectral density of our stochastic signal signal $x(t)$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$ \mathcal{F}[  R(\tau)]= \int_{-\infty}^{\infty} R(\tau)e^{-j\omega \tau}d\tau $$ &#xA;$$   = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} x(t)x(t + \tau) e^{-j\omega \tau} dtd\tau $$ &#xA;$$   = \int_{-\infty}^{\infty}x(t) \underbrace{\int_{-\infty}^{\infty} x(t + \tau) e^{-j\omega \tau} d\tau}_{\mathcal{F}[x(t + \tau) ] =  X(\omega)e^{j\omega t}} dt $$ &#xA;$$   = X(\omega) {\int_{-\infty}^{\infty}x(t)e^{j\omega t}  dt}    $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$   = X(\omega)X^*(\omega)= |X(\omega)|^2 $$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What does it all mean? &#xA;&lt;em&gt;Note: This explanation is a bit &quot;hacky&quot;. But here it goes&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform tells us the spectral components of a signal. In our case, the signal is Stochastic; So, trying to calculate the spectral components of the signal will be pointless because, for every realisation of the random process, you will have different expressions for $ \mathcal{F}[x(t)]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if you take the Expected Value of the Fourier transform then? This wouldn't work. Let's take a zero mean signal for example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathbb{E}\{ \mathcal{F}[x(t)] \} = \mathcal{F}[\mathbb{E}\{ x(t) \}] = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, what if you take the Fourier transform of the square of the signal. &#xA;$$ \mathbb{E}\{ \mathcal{F}[x^2(t)] \} = \mathcal{F}[\underbrace{\mathbb{E}\{ x^2(t) \}}_{\text{Av. Power of the Signal}}] $$&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The autocorrelation function is essentially the $P(t) $ which you were alluding to.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Communications 1, P-L. Dragotti, Imperial College London&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] White Noise and Estimation, F. Tobar [Unpublished Report]&lt;/p&gt;&#xA;" OwnerUserId="4096" LastEditorUserId="4096" LastEditDate="2013-03-12T00:41:17.460" LastActivityDate="2013-03-12T00:41:17.460" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8152" PostTypeId="1" CreationDate="2013-03-12T02:53:19.517" Score="2" ViewCount="122" Body="&lt;p&gt;I'm learning about Directional Filter Banks for my Thesis about Image Enhancement. I read it from some papers (Bamberger(1992) and Park(2004)) but I still cannot understand it clearly in detail. Could anyone here please explain it to me the process? Does it applied on Frequency domain or Spatial domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance.&lt;/p&gt;&#xA;" OwnerUserId="4102" LastActivityDate="2013-03-12T02:53:19.517" Title="Could someone please explain to me about Directional Filter Bank?" Tags="|image-processing|filter-bank|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8154" PostTypeId="2" ParentId="8133" CreationDate="2013-03-12T07:27:18.877" Score="8" Body="&lt;p&gt;Nice derivation but I think you can do this even easier&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Auto correlation $r(t) = x(t)*x(-t)$, it's the convolution of the signal with it's time flipped self.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution in the time domain is multiplication in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time flip in the time domain is &quot;complex conjugate&quot; in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence we get $$ R(\omega) = \mathcal{F}\{r(t)\} = \mathcal{F}\{x(t)\}\mathcal{F}\{x(-t)\} = X(\omega) X^*(\omega) = |X(\omega)|^2 = PSD $$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="4096" LastEditDate="2013-03-12T11:29:44.110" LastActivityDate="2013-03-12T11:29:44.110" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8155" PostTypeId="1" AcceptedAnswerId="8156" CreationDate="2013-03-12T08:06:04.380" Score="2" ViewCount="353" Body="&lt;p&gt;How do those matrices work? Do I need to multiple every single pixel? How about the upperleft, upperright, bottomleft and bottomleft pixels where there's no surrounding pixel? And does the matrix work from left to right and from up to bottom or from up to bottom first and then left to right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does this kernel (Edge enhance):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lyQgD.png&quot; alt=&quot;this kernel (Edge enhance)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;turns into this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZuhdE.jpg&quot; alt=&quot;this image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4106" LastEditorUserId="39" LastEditDate="2013-03-12T08:47:36.340" LastActivityDate="2013-03-12T20:59:45.527" Title="How do convolution matrices work?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8156" PostTypeId="2" ParentId="8155" CreationDate="2013-03-12T10:30:47.010" Score="4" Body="&lt;p&gt;The convolution process works by multiplying every single pixel on the image with the matrix/kernel. And for the outer pixel in top, bottom, right and left there are several ways to do it: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You can ignore it, so you can start from the second line if the kernel is 3x3. &lt;/li&gt;&#xA;&lt;li&gt;You can put a 0 value as the outer border.&lt;/li&gt;&#xA;&lt;li&gt;You can copy the closest neighbor pixel value in as the outer border.&lt;/li&gt;&#xA;&lt;li&gt;You can pretend the image is circular by using the opposite pixel. Top with bottom and left with right border.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As far as I know the matrix goes from left to right direction. And for that matrix (the edge enhancement), it gets pixel that have huge difference with the left neighbor. The pixel is multiplied with 1 and the left neighbor is multiplied with -1. If the two pixels have huge difference, the result will be near to white (1 or 255) but if the two pixels have small difference, the result will be near black (0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this answers your questions.&lt;/p&gt;&#xA;" OwnerUserId="4102" LastEditorUserId="4102" LastEditDate="2013-03-12T20:59:45.527" LastActivityDate="2013-03-12T20:59:45.527" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8157" PostTypeId="1" AcceptedAnswerId="8164" CreationDate="2013-03-12T10:34:48.743" Score="4" ViewCount="2835" Body="&lt;p&gt;I've got in total 6 images, from 2 cameras (thus 3 per camera) storing 16 bit data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I need to feedback to the user is like some sort of sharpness coefficient, preferably live while he is adjusting the focus of the whole system (since its looking into the eyes, it depends on the dioptres of the patient). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am currently using is a contrast coefficient combined with standard deviation, which should work fine, but with a change of the focus the field of view changes slightly, which can impact the contrast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I wonder when I move to use the FFTW library to get the FFT of my image, it results in an array of fftw_complex (which is double[2]).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my purpose, it should be fine to calculate the average of the resulting array, but I don't understand how to mangle real / complex components in this. Do I iterate over the whole array, calculate sum equalling sum of double[0] and double[1], or am I totally wrong here? I don't really understand why there is a real and a complex component. I understand that the FFT results in coefficients for different frequency sinus waves, but the frequency of the wave depends on its position in the array, while the amplitude should be the real component. Is the combination of real and complex variable responsible for the direction in the image, or what is it used for, and how would I use it to get an idea of an &quot;average&quot; frequency (sharpness) in the image?&lt;/p&gt;&#xA;" OwnerUserId="1269" LastActivityDate="2013-03-19T18:46:04.030" Title="Extract sharpness from FFT" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8159" PostTypeId="1" AcceptedAnswerId="8185" CreationDate="2013-03-12T13:24:09.910" Score="7" ViewCount="692" Body="&lt;p&gt;I have a very specific application which requires to use the complex Morlet wavelet (or Gabor wavelet, if that's the name you use). I currently use the convolution theorem to compute wavelets transforms, but I'm reading everywhere that direct wavelet transforms are more computer efficient, because of the lifting scheme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, I searched for lifting scheme, and it's so much of a different paradigm that I have no idea how to use it with my wavelet, or whether it's even possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: is it possible to use the lifting scheme with the Morlet wavelet in 1D and 2D? If so, can you recommend some litterature explaining the algorithm?&lt;/p&gt;&#xA;" OwnerUserId="2030" LastEditorUserId="2030" LastEditDate="2013-03-12T13:32:02.650" LastActivityDate="2013-03-14T17:41:26.263" Title="How to turn Morlet wavelet into second generation wavelet?" Tags="|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8161" PostTypeId="1" AcceptedAnswerId="8163" CreationDate="2013-03-12T13:43:22.480" Score="7" ViewCount="11775" Body="&lt;p&gt;It has always been said that $F(0)$ is the &quot;DC component&quot; in fourier transform. However, I don't get what it means to say that $F(0)$ is &quot;DC&quot; in the context of image processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The zero in this case just meant zero frequency, and hence no changes isn't it? Then in the context of image processing, how should I imagine the picture to be like at $F(0)$? What exactly is that &quot;DC&quot; component? &lt;/p&gt;&#xA;" OwnerUserId="3769" LastActivityDate="2013-03-13T10:26:34.020" Title="What is $F(0)$ is &quot;dc&quot; component in the context of image processing?" Tags="|image-processing|fourier-transform|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8162" PostTypeId="2" ParentId="7797" CreationDate="2013-03-12T13:51:26.037" Score="1" Body="&lt;p&gt;Having worked with hyperspectral images from experimental setups, I know it's hard to fix these little details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way my group has to fix alignment and chromatic shifts is to use calibration images: Take a picture of something simple for which you know how the result should look like, and use the same correction on every pictures you take hereafter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example I'm thinking would be to take a picture of a small white dot against a black background. Every misaligned color will create a colored dot at a different place. You then find the mathematical operation necessary to put all these colored dots back together, creating a single white one (it will probably be a translation with a color dependant magnitude).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IF this shift is always the same from picture to picture, you can implement it in your data reduction code. IF not, you will have to take a calibration picture before every picture you take.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're lucky, it will be a translation. If you're not, the transformation might also depend on where you are in the picture. In that case, use a grid of white dots.&lt;/p&gt;&#xA;" OwnerUserId="2030" LastActivityDate="2013-03-12T13:51:26.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8163" PostTypeId="2" ParentId="8161" CreationDate="2013-03-12T14:27:51.390" Score="8" Body="&lt;p&gt;The zero frequency of an image DCT is the mean gray value of the pixels of the input image (for graylevel images).&#xA;$F(0)$ is not an image: it is a single coefficient.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-03-13T10:26:34.020" LastActivityDate="2013-03-13T10:26:34.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8164" PostTypeId="2" ParentId="8157" CreationDate="2013-03-12T16:18:27.887" Score="3" Body="&lt;p&gt;As you said, in the fourier transform, the frequency of the wave depends on its position in the array. But, the amplitude of the wave is not always the real component, it is actually the magnitude of the complex number ($\sqrt{real^2+imaginary^2}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your initial image is perfectly symmetric along the exact center, you can get real coefficients, but it's something which seldom appears in image analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Here's more details... Couldn't find the picture I was refering to...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete Fourier transform, the basis of every FFT algorithm, is defined as such:&#xA;$$X_k = \sum_{n=0}^{N-1}x_n\cdot e^{-i2\pi kn/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Euler's formula, a complex exponential can be separated in a complex sum of cosinus and sinus:&#xA;$$e^{ix}=\cos(x)+i\sin(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we now look back at the Fourier transform, it can be separated into two sums:&#xA;$$X_k = \sum_{n=0}^{N-1}x_n\cos(-2\pi kn/N) + i \sum_{n=0}^{N-1}x_n\sin(-2\pi kn/N)$$&#xA;As a sidenote here, if your image (or signal) is perfectly symemtric about it's center, the cosinus will resonate strongly with your image while the sinus will not output anything. It will result a completly real image. It's the other way around for a perfectly anti-symmetric signal where one half is the negative of the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now knowing this, it's straightforward to compute the amplitude of the resulting FFT, using the formula I gave in the first paragraph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the frequency of the image itself is less obvious. We would expect the result to look somewhat like this, with the zero-frequency component at the center. It is, however, not the case.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/CpDZK.png&quot; alt=&quot;shifted fft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;standard&quot; FFT algorithm will put the zero-frequency component in a corner (I can never remember which one, top-left or bottom-left!), such that the array indice [0,0] corresponds to $k_x=k_y=0$. But wait, once you cross N/2, the pixels represents negative frequencies, counting backwards. A good reminder is Python's scipy.fftpack.fftfreq() function found &lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fftfreq.html&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;here&quot;&gt;fftfreq()&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My personal tips to take a quick look at an image's spectrum is to shift it then display the logarithm of it. When it's not shifted, it's hard to see asymetries. When looking at the non-log version, it's usually just a big black square with a small fuzzy grey dot...&lt;/p&gt;&#xA;" OwnerUserId="2030" LastEditorUserId="2030" LastEditDate="2013-03-19T18:46:04.030" LastActivityDate="2013-03-19T18:46:04.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8165" PostTypeId="1" AcceptedAnswerId="8169" CreationDate="2013-03-12T16:43:09.233" Score="4" ViewCount="760" Body="&lt;p&gt;Why is the least squares cost function used in adaptive noise cancellation with the recursive least squares (RLS) algorithm, but the mean squared error used in signal estimation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an ergodic source (where time and ensemble averages should be the same) I would have thought the choice was arbitrary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my notes: LMS minimises $\|e[n]\|^{2}$ and RLS minimises $\sum_{i=0}^{N} e^{2}[i], $&#xA;where $e[n]$ is the difference between the desired signal and the output of the filter.&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="1771" LastEditDate="2013-03-12T19:53:23.273" LastActivityDate="2013-03-12T21:37:26.837" Title="Choice of cost function in adaptive noise cancellation" Tags="|filter-design|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8166" PostTypeId="1" CreationDate="2013-03-12T16:43:33.343" Score="2" ViewCount="1459" Body="&lt;p&gt;How would I extract the circular area of a binary image which looks like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/v0pmS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The two rods emerging from the side of the circle are noise.&lt;/p&gt;&#xA;&lt;p&gt;I know of the hough transform in Matlab. However, I am using R and can't seem to find anything similar.&lt;/p&gt;&#xA;&lt;p&gt;Ideas anyone?&lt;/p&gt;&#xA;" OwnerUserId="4110" LastEditorUserId="7092" LastEditDate="2021-04-02T18:08:04.593" LastActivityDate="2022-04-27T23:01:15.123" Title="Finding circle in binary image (R, not matlab)" Tags="|image-processing|noise|r|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8167" PostTypeId="1" AcceptedAnswerId="8625" CreationDate="2013-03-12T17:03:54.393" Score="2" ViewCount="14740" Body="&lt;p&gt;I'm just learning about Fourier Transforms and as an input I'm using a WAV file (Matlab) and taking one channel of it and performing a quick Fourier transform. I've zero padded the input, as I've been told that it gives a better frequency resolution. I've done this and I see an identical looking graph apart from that the magnitude has changed. Could somebody please explain to me why the magnitude has decreased and is their any linearity to how it changes? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that the frequencies will be similar to those before the zero padding but just be a better fit?&lt;/p&gt;&#xA;" OwnerUserId="4111" LastEditorUserId="76" LastEditDate="2013-03-13T03:15:04.447" LastActivityDate="2021-02-05T17:46:18.507" Title="FFT Zero Padding - Amplitude Change" Tags="|fft|matlab|frequency|zero-padding|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8168" PostTypeId="2" ParentId="8165" CreationDate="2013-03-12T18:07:29.943" Score="0" Body="&lt;p&gt;As far as I know, you are always taking the MSE, however maybe my peers can confirm/deny this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about the simple case, where you just have two co-efficients. Those two co-efficients are on the x-y plane, and your error, is on the z-axis. This means your error has to be a scalar. Which then means you are taking the error in the expectation. (Average). Otherwise, how can you start to take derivatives, and minimize anything? So as far as I know, you are always taking expectations of errors, or as you have said, $\frac{1}{N}\sum_{n=0}^{N-1} e^{2}[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to think about it. You are essentially computing an error vector, for every iteration. The error vector is the error between what you have, and what you are computing, at &lt;em&gt;each&lt;/em&gt; time sample. But you want to minimize the &lt;em&gt;total&lt;/em&gt; error. This is where the expectation comes in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet another way to think about it - think about the cost space - you are travelling in a gradient, that it going to continuously minimize an error. What error? The total error. Try hard as you might, you need, at the end of the day, a scalar error number that measures your total error in some way. The usual case is L-2 norm error, (LSE), but L-1 is also possible. The point is that you travel in a direction that minimizes a &lt;em&gt;scalar&lt;/em&gt; number, that scalar number being some way you have decided to measure your &lt;em&gt;total&lt;/em&gt; error.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2013-03-12T18:23:23.503" LastActivityDate="2013-03-12T18:23:23.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8169" PostTypeId="2" ParentId="8165" CreationDate="2013-03-12T21:31:20.340" Score="3" Body="&lt;p&gt;You are actually asking 2 separate questions. If I have interpreted your post correctly, they are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why is the RLS used in Noise Cancellation, whereas the LMS is used in signal estimation?&lt;/li&gt;&#xA;&lt;li&gt;(If we assume that the signal is ergodic) Isn't minimising the Ensemble average, $E\{e_n^2 \}$, equivalent to minimising the time average, $ \sum_{i = 1}^{N}e_i^2$; i.e. Shouldn't the LMS perform as good as the RLS?  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Answers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are free to choose &lt;em&gt;ANY&lt;/em&gt; adaptive filtering algorithm for &lt;em&gt;ANY&lt;/em&gt; application (e.g. Adaptive Noise Cancellation -ANC).  It need not be the RLS. The same goes with signal estimation, or any other application you can think of. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you have a specific application in mind, and you know something about the system or how the algorithm performs in that setting, you may want to choose one adaptive algorithm over another. (E.g. If your application is to do with converging faster as opposed to having a low error at steady state, you might choose Algorithm X over Y) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once again, this choice is not made based on whether you minimize the mean squared error or the sum of the squared error. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Q2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This questions still keeps me up on some nights. Fundamentally, Minimum Mean Squared  Error&#xA;based algorithms are based on, finding the system parameters which minimise the $ E\{ e_n^2 \}$. Now, the expected value of the error &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both the LMS and the RLS are &lt;strong&gt;&lt;em&gt;based&lt;/em&gt;&lt;/strong&gt; on minimising this quantity. How they do it, however, is quite different. Remember, that the Expected value is statistical operator - it's the average over all realisations of the random signal. In real life applications, we only have access to one realisation of this signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Example: Let's say you have the price of a stock, all you get is one value at each time (e.g. £10) The stock price never says, &quot;oh well I have a 5% chance of being £10, on the other hand I could be £12, or £14.....etc&quot;. But I digress.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SO, &#xA;How are we going to minimize the mean squared error, when we can't compute the true mean? &#xA;The Least Mean Square (Widrow-Hoff) says, &quot;You know what, I am going to drop the $E\{.\}$ and minimise $e_n^2$. Yes it is a hack, but my god what a hack! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RLS uses the fact you mentioned: Since the process is ergodic, you can get the time average instead of the ensemble. The sum squared error is equivalent to the average of the squared error. The only thing that's missing is the $1/N$ term in the sum squared error. It is discarded because, it cancels out with another $1/N$ term in the derivation of the RLS. So don't worry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interesting thing is how this difference affects the performance of the 2 filters. &lt;em&gt;(This is a whole different question and I suggest that you ask it here - it might get a lot of people interested)&lt;/em&gt; The RLS is known to converge faster than the LMS. But when tracking time-varying parameters the LMS can perform better than the RLS in certain conditions. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;LMS:&#xA;$$ E\{e_n^2 \} \approx e_n^2$$&#xA;RLS:&#xA;$$ E\{e_n^2 \} \approx \frac{1}{N} \sum_{i =1}^N e_i^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum up: Both the RLS and LMS try to approximate $E\{e^2\}$. They way they do it is different - so the way they behave is different. And you are free to choose any filter for any application. &lt;/p&gt;&#xA;" OwnerUserId="4096" LastEditorUserId="4096" LastEditDate="2013-03-12T21:37:26.837" LastActivityDate="2013-03-12T21:37:26.837" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8170" PostTypeId="2" ParentId="8167" CreationDate="2013-03-12T23:12:25.533" Score="1" Body="&lt;p&gt;Zero-padding before an FFT gives you a higher density interpolation, which can increase graphic or plot resolution, but it's only an interpolation, not added information.  Any closer spectral peak pairs or finer &quot;wrinkles&quot; in the spectrum won't appear, and you can get almost the same effect by using an appropriate smooth curve-fitting algorithm (such as splines or Sinc kernel interpolation) before graphing the non-zero-padded FFT result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your FFT is dividing by N, then feeding it the exact same data but using a larger N denominator (wider FFT aperture after zero-padding), will re-scale the FFT result by the ratio of the two N's.  But not all FFT implementations divide by N.  Check yours.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-03-12T23:22:40.853" LastActivityDate="2013-03-12T23:22:40.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8171" PostTypeId="2" ParentId="8161" CreationDate="2013-03-12T23:23:37.693" Score="6" Body="&lt;p&gt;In the Fourier series, $x(t) = \sum\limits_{-\infty}^{\infty} C_n e^{jnwt}$ where $C_n =\frac{1}{T} \int\limits_0^T x(\lambda)e^{-jnwt} d\lambda$. $T$ is the period, $w$ the frequency, $j = \sqrt{-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we plug in $n=0$, we get the following: $x(t) = \sum\limits_{-\infty}^{\infty} C_n e^{0}$, with $C_n =\frac{1}{T} \int\limits_0^T x(\lambda)e^{0} d\lambda$. Any number raised to the $0$th power is $1$, so $C_n =\frac{1}{T} \int\limits_0^T x(\lambda) d\lambda$. This is exactly how we define the average value. So in image processing, $F(0)$ corresponds to the average value of all the pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yes, this is the term that looks at a frequency of 0. It's simply an offset to be added. It's not the whole image, it's just a coefficient. So yeah, I guess it could be the whole image, just a horrible approximation. It would have every pixel equal to the average.&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2013-03-12T23:23:37.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8172" PostTypeId="1" AcceptedAnswerId="8175" CreationDate="2013-03-13T01:35:37.187" Score="1" ViewCount="771" Body="&lt;p&gt;I am looking for a technique for measure the quality of my denoise filter, is the SNR formula useful for that purpose?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is, I have an image with noise, I apply the &quot;adaptive median filter&quot;, how to know if the noise has decreased?&lt;/p&gt;&#xA;" OwnerUserId="543" LastActivityDate="2013-03-13T03:52:24.783" Title="How to know if the noise was removed in an image?" Tags="|image-processing|matlab|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8173" PostTypeId="1" CreationDate="2013-03-13T03:07:43.050" Score="0" ViewCount="172" Body="&lt;p&gt;I'm comparing frequency spectrum of FSK, ASK, QPSK, and MSK. And I'm asked which has the least and greatest spectral coverage. Could someone enlighten me on how to get it?&lt;/p&gt;&#xA;" OwnerUserId="4115" LastActivityDate="2013-10-29T23:45:07.180" Title="How do you calculate/compute/determine the spectral coverage of a frequency spectrum?" Tags="|frequency-spectrum|frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8174" PostTypeId="1" CreationDate="2013-03-13T03:16:32.447" Score="1" ViewCount="6627" Body="&lt;p&gt;Is it because noise manifests itself in the transmitted signal's amplitude?&lt;/p&gt;&#xA;" OwnerUserId="4115" LastActivityDate="2018-07-21T09:25:02.880" Title="Why is Frequency Shift Keying more immune to noise than ASK?" Tags="|noise|fsk|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8175" PostTypeId="2" ParentId="8172" CreationDate="2013-03-13T03:52:24.783" Score="1" Body="&lt;p&gt;You can measure that with SNR, yes.  What you call 'signal' can get a little fluffy, but you should at least be able to compare two versions of the same image (before and after).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your image has a nice homogeneous area in it, you can measure the variance of the pixel values in this region, and compare this before and after - so long as the image doesn't otherwise change.  Do make sure that you account for any scaling or shifting that a filter might be doing (an adaptive median filter shouldn't do either of these if it is implemented properly).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A common method for testing denoising filters is to start with a pure image (one that you define yourself), then add noise to it artificially then compare the denoised version to the original.  You will need to make sure to add the correct type of noise for your context (is it simple Gaussian, or Poisson, or ...?).&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-13T03:52:24.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8176" PostTypeId="1" AcceptedAnswerId="8182" CreationDate="2013-03-13T04:58:08.283" Score="3" ViewCount="363" Body="&lt;p&gt;For an image has a simulated horizontal motion blur on it, is it reasonable for someone to say that the suggested shape for the point-spread function resulting in this motion blur is a rectangular pulse aligned in the direction of motion? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, what is an explanation for this?&lt;/p&gt;&#xA;" OwnerUserId="3769" LastEditorUserId="3769" LastEditDate="2013-03-13T05:38:30.650" LastActivityDate="2013-03-13T13:48:36.000" Title="Does horizontal motion blur imply the shape of PSF is rectangular pulse?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8178" PostTypeId="1" AcceptedAnswerId="8299" CreationDate="2013-03-13T07:08:03.270" Score="2" ViewCount="649" Body="&lt;p&gt;I'm using the 2D Fast Hartley Transform to do fast correlation of two images in the frequency domain, which is the equivalent of NCC (normalized cross correlation) in the spatial domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, with NCC, I can get a confidence metric that gives me an idea of how strong the correlation is at a certain offset. In the frequency domain version, I end up with a peak-finding problem in the inverse FHT after doing the correlation, so my question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I use the value of the peak that I find in the correlation image to derive the same (or similar) confidence metric that I can get from NCC? If so, how do I calculate it?&lt;/p&gt;&#xA;" OwnerUserId="4117" LastActivityDate="2013-06-11T06:04:39.437" Title="Normalized cross correlation via FHT - how can I get correlation score?" Tags="|cross-correlation|image-registration|fourier|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8179" PostTypeId="1" AcceptedAnswerId="8181" CreationDate="2013-03-13T07:42:00.107" Score="2" ViewCount="1404" Body="&lt;p&gt;I took an image, did an &lt;code&gt;fft2&lt;/code&gt; to it in Matlab and then squared the &lt;code&gt;abs&lt;/code&gt; of the fourier transform to get the power spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something I notice about the power spectrum however is that there are vertical lines in it like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QW8gs.png&quot; alt=&quot;Power Spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the original image which the power spectrum was calculated from, for reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3hgfC.jpg&quot; alt=&quot;Original Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are these lines and why do I see such phenomenon from the transformed image? Do the lines imply anything about the original image and the fourier transform?&lt;/p&gt;&#xA;" OwnerUserId="3769" LastEditorUserId="3769" LastEditDate="2013-03-13T12:37:55.960" LastActivityDate="2013-03-13T12:37:55.960" Title="Why are there vertical lines in the power spectrum?" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8180" PostTypeId="1" AcceptedAnswerId="8189" CreationDate="2013-03-13T09:40:07.493" Score="2" ViewCount="538" Body="&lt;p&gt;I have a time varying discrete signal x(t) sampled at 5ms rate.&#xA;I need to find the amplitude of the 20 Hz frequency component for each sample.&#xA;What I do today is that for each sample I do a Short-time Fourier Transform of the data in a window around that sample. Then I read the amplitude for the 20 Hz frequency component off the  amplitude spectrum.&#xA;This seems to work fine, but it is &lt;strong&gt;slow&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I speed up this process?&#xA;For instance I am only interested in the 20 Hz component. Is there some way I can avoid finding the complete amplitude spectrum (that is faster than FFT)?    &lt;/p&gt;&#xA;" OwnerUserId="697" LastActivityDate="2013-03-13T13:25:11.647" Title="How can I find the amplitude of the 20 Hz frequency component of a signal faster?" Tags="|fourier-transform|stft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8181" PostTypeId="2" ParentId="8179" CreationDate="2013-03-13T09:41:26.413" Score="6" Body="&lt;p&gt;Let's interpret what we are seeing: the spectrum seems to be made of the pointwise multiplication of 2 known Fourier patterns:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a first one is the usual messy image Fourier transform&lt;/li&gt;&#xA;&lt;li&gt;a second pattern that modulates the image spectrum and that has a $sinc$ shape.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, let's see what the theory provides us:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;multiplication in the spectral domain is a convolution in the spatial domain =&gt; we are observing the convolution of an image by a blur kernel&lt;/li&gt;&#xA;&lt;li&gt;the inverse Fourier transform of a $sinc$ is a box =&gt; the blur kernel has an horizontal box shape (we can infer that from the orientation of the zero bands).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Finally, let's summarize: the image was blurred by a linear (horizontal) kernel.&#xA;This is a typical example of motion blur, where the motion is horizontal.&#xA;This is confirmed by looking at the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as a bonus, here is a paper where special shapes of motion blurs are designed, where the blur shapes do not have zeros that will disturb the deconvolution process:&#xA;&lt;a href=&quot;http://web.media.mit.edu/~raskar/deblur/CodedExpousreLowres.pdf&quot; rel=&quot;nofollow&quot;&gt;http://web.media.mit.edu/~raskar/deblur/CodedExpousreLowres.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-03-13T09:58:46.400" LastActivityDate="2013-03-13T09:58:46.400" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8182" PostTypeId="2" ParentId="8176" CreationDate="2013-03-13T10:07:25.720" Score="3" Body="&lt;p&gt;Think a minute of what a motion blur means for the &lt;strong&gt;physical pixels&lt;/strong&gt;: they are moved during the acquisition process.&#xA;Assuming left-to-right horizontal motion for simplicity, then what happens is that one pixel will measure the amount of light in its initial position, then the light in the position that was occupied before by its right neighbour, and so on until the frame acquisition ends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Mathematically&lt;/strong&gt;, the light measured by one pixel is then a &lt;strong&gt;mixture&lt;/strong&gt; between the value in its original position and the values of its neighbours in their original positions.&#xA;Hence, up to a rescaling of the output value (that is unnecessary of you normalize the blur kernel), an horizontal motion blur can be modelled by an horizontal blur kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this is &lt;em&gt;grossly simplified&lt;/em&gt; (I did intentionally forgot about minimum exposure time for example and supposed instead that the measurement was instantaneous) that assumes that the scene is at a fixed distance from the camera and that all the image points are at the same distance, without independantly moving objects.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-03-13T13:48:36.000" LastActivityDate="2013-03-13T13:48:36.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8183" PostTypeId="1" AcceptedAnswerId="8209" CreationDate="2013-03-13T10:59:53.303" Score="0" ViewCount="720" Body="&lt;p&gt;I have implemented a texture recognition algorithm in MATLAB and it works well. Now, my next step is to summarize with the accuracy percentage. Now, I would like to summarize my work and attribute an accuracy to my algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have around 1000 images and only one training image. The feature vectors are available for all the images in the dataset. Right now I am getting the top 5 matches from the dataset for a given image. Everything works well!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now i want to calculate accuracy for all the images in the dataset and average it out to get the final accuracy. Can someone tell me what could be the best method for calculating the accuracy and precision and how should i proceed in case of large datasets?&lt;/p&gt;&#xA;" OwnerUserId="3606" LastEditorUserId="958" LastEditDate="2013-03-14T17:04:08.807" LastActivityDate="2013-03-14T17:04:08.807" Title="accuracy calculation" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8184" PostTypeId="1" AcceptedAnswerId="8188" CreationDate="2013-03-13T11:06:49.117" Score="5" ViewCount="6340" Body="&lt;p&gt;It's known that the RLS filter converges faster than the LMS filter in general, but that if you're tracking time varying parameters the LMS algorithm can perform better. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is under what conditions does this hold? I understand that the LMS filter is like a point estimate, but the RLS uses more data - when would using less data be helpful?&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="35" LastEditDate="2013-03-13T11:22:25.083" LastActivityDate="2015-12-30T07:12:47.263" Title="Relative performance of RLS and LMS filters" Tags="|filter-design|adaptive-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8185" PostTypeId="2" ParentId="8159" CreationDate="2013-03-13T11:48:42.877" Score="4" Body="&lt;p&gt;The Lifting scheme is special algorithm that allows a very efficient computation of the discrete wavelet transform (DWT), via special filters (QMF) and down/up-samplers. In order to compute a DWT the wavelet has to fulfill orthogonality constraints under translation and dilation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Morlet wavelet does not fulfill these contraints. Thus, you cannot compute a DWT with it und consequently you cannot use the lifting scheme. The Morlet wavelet is only applicable for computing a continuous wavelet transform. If you need a fast approximation you can have a look here: &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19.7500&quot; rel=&quot;nofollow&quot;&gt;Fast Gabor-Like Windowed Fourier and Continuous Wavelet Transforms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="1589" LastEditDate="2013-03-14T17:41:26.263" LastActivityDate="2013-03-14T17:41:26.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8186" PostTypeId="1" AcceptedAnswerId="8191" CreationDate="2013-03-13T12:22:25.423" Score="0" ViewCount="235" Body="&lt;p&gt;I have a Xilinx FPGA running at 200MHz with an ADC and DAC on board.  I am taking a 2462MHz sine wave (pretending it is 802.11b chan 11), mixing it down to 40MHz putting it through my FPGA, mixing it back up and looking at it on a Spectrum Analyzer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 4 taps (255 clock delays deep) to play with in my FPGA and am currently only using 2 of them.  I worked out the phase delay on each tap index by saying that the phase for a particular index (i) is phase=i*(2*pi)&lt;em&gt;(2.462e9/200e6).  So index 1 has a phase of 0.13&lt;/em&gt;(2*pi) and index 250 has a phase of pi.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Armed with that, I put my signal through with no delay on the first tap, and then delayed the signal on my second tap by 250 clocks (so it should be 180 degrees out of phase).  Yet the signal doesn't disappear on the specAn.  I haven't found a tap that does make the signal cancel out, so that was where I was curious what I was doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping there was something simple I am missing, as opposed to finding out it can't be done without implementing some sort of fractional delay filters (or something to that effect).&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2013-03-13T13:34:58.617" Title="simulating multipath via tap delays in FPGA" Tags="|sampling|multipath|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8187" PostTypeId="2" ParentId="8167" CreationDate="2013-03-13T12:27:15.430" Score="2" Body="&lt;p&gt;This is directly related to a generalization of &lt;a href=&quot;https://dsp.stackexchange.com/questions/8161/what-is-f0-is-dc-component-in-the-context-of-image-processing&quot;&gt;this previous question&lt;/a&gt; and to &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Plancherel_theorem_and_Parseval.27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Parseval's equality&lt;/a&gt;.&#xA;When you expand your spectrum by zero padding, you increase the size of your signal.&#xA;Since you did not change its total energy (because you only added &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;'s), you did actually divide the amplitude of each sample after inversion of the Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;Consider for example the DC coefficient, that is equal to the mean of the input image.&#xA;After doubling the size of the spectrum along each dimension :&lt;span class=&quot;math-container&quot;&gt;$(w,h) \rightarrow (2w,2h)$&lt;/span&gt;, and inversion of the Fourier transform, you obtain an image with 4 times more pixels but the same mean.&#xA;Hence, you did divide the value of each individual sample by 4.&#xA;The same reasoning goes for each coefficient.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, if you apply the correct scaling before inverting the Fourier transform (multiply the amplitude by 2 in your case, by 4 with my image example), you obtain a zoomed signal where the amplitudes are correct.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2021-02-05T17:46:18.507" LastActivityDate="2021-02-05T17:46:18.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8188" PostTypeId="2" ParentId="8184" CreationDate="2013-03-13T13:10:33.207" Score="2" Body="&lt;p&gt;Using less data is helpful when, as you said, the parameters are time varying, and in particular when they change a lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key difference is that LMS is a Markov process.  It has its current state, but other than that it does not remember data from the past.  For time-varying signals this is a feature because past data will give you erroneous information about the current parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RLS algorithm uses all of the information, past and present, but that can be a problem if the past data is misleading for the current parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking for a quantitative rule for when to use one or the other, I don't have one.  RLS is more computationally intensive than LMS, so if LMS is good enough then that is the safe one to go with.  RLS converges faster, but is more computationally intensive and has the time-varying weakness, so I would only use it if the parameters don't vary much and you really needed the fast convergence.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-13T13:10:33.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8189" PostTypeId="2" ParentId="8180" CreationDate="2013-03-13T13:25:11.647" Score="6" Body="&lt;p&gt;As pichenettes already pointed out in a comment above, one approach is to use the Goertzel algorithm. However, it is a somewhat common misconception that in order to deduce the amplitude of various frequency bands in a signal, one must use Fourier-transform-based techniques. There are other methods that may be more appropriate to your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, for example, you would do equally well by just creating any bandpass filter centered at 20 Hz and watching the amplitude of its output over time. The DFT (and by extension the Goertzel algorithm) can be viewed as just a bank of equally-spaced, critically-sampled bandpass filters. If you only need one output, then a DFT is overkill, and the Goertzel algorithm can be limiting, as you don't have much control over its frequency response about 20 Hz.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-03-13T13:25:11.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8190" PostTypeId="1" CreationDate="2013-03-13T13:25:15.267" Score="2" ViewCount="267" Body="&lt;p&gt;I was reading about Digital Cosine Transform (DCT Type-I) and it's use in JPEG.&#xA;I have the following doubt. My teacher offered an explanation which wasn't very convincing.&#xA;What property of Digital Cosine Transform makes it attractive for compression of images? Why Digital Sine Tranform is not used? &#xA;More specifically, what is the intuition behind the usage of DCTs?&lt;/p&gt;&#xA;" OwnerUserId="4121" LastEditorUserId="8330" LastEditDate="2014-03-26T22:40:55.253" LastActivityDate="2018-06-19T05:48:06.130" Title="Usage of Digital Cosine Transform in lossy compression of images" Tags="|image-processing|discrete-signals|compression|jpeg|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8191" PostTypeId="2" ParentId="8186" CreationDate="2013-03-13T13:27:20.167" Score="1" Body="&lt;p&gt;Perfect destructive interference is possible in theory, but very difficult to do in practice without feedback to dynamically adjust.  The reason for this is that there are three things you have to get just right to eliminate the tone: frequency, time (or equivalently, phase), and amplitude.  If you get any of those wrong there will still be a tone (or rather, two tones) left over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Frequency&lt;/strong&gt;  No matter what you do at the baseband level (i.e. in the FPGA), the frequency will not match if your upmixing does not exactly match your downmixing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Time/Phase&lt;/strong&gt;  This is a lot more complicated than you realize.  First, your phase-per-tap calculation requires that the sinusoid be exactly 2.462GHz and that your FPGA frequency be exactly 200MHz.  Neither one is.  You can &lt;em&gt;never&lt;/em&gt; get an exact frequency, there is always some error and jitter.  If you take the derivative of the phase-per-tap with respect to the sinusoid frequency (2.462GHz), you will find that the phase per tap is very sensitive to sinusoid frequency errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have also not taken into consideration the time delays through your ADC, DAC, and connectors, passive analog components, etc.  They all matter too.  Long story short, I would not try to figure out the correct delay, I would empirically see how the jammer's phase relates to the original sinusoid and adjust from there.  Yes, you will almost certainly have to use fractional delays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Amplitude&lt;/strong&gt;  Even if you get the frequency and phase right you will only be changing the tone's magnitude unless you match its amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that see that you have taken on a very difficult task.  Since you are only trying to test simulated delays, I would find an easier way to do that.  I would look at using chirp signals, and then vary the delays to move the responding chirp in time.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-03-13T13:34:58.617" LastActivityDate="2013-03-13T13:34:58.617" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8192" PostTypeId="1" CreationDate="2013-03-13T16:47:52.697" Score="1" ViewCount="286" Body="&lt;p&gt;I am trying to generate a random signal that represents a gyroscope drift. I know the Allan Variance characteristics of the signal (ARW, RRW, Bias Instability and Cluster Time for for Bias Instability). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I could model this as an addition to two stochastic processes: a white noise process and a drift process. The white noise process is easy to setup since its a random variate of a Normal Distribution. Not quite sure how I go about modeling the drift process? I know its supposed to be a Gauss Markov process but don’t have a clue how to do it. &lt;/p&gt;&#xA;" OwnerUserId="4122" LastEditorUserId="13320" LastEditDate="2016-11-21T13:20:57.277" LastActivityDate="2016-11-21T13:20:57.277" Title="Gauss Markov Process" Tags="|random|random-process|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8193" PostTypeId="2" ParentId="8166" CreationDate="2013-03-13T16:56:32.090" Score="-1" Body="&lt;p&gt;On page 4 of &lt;a href=&quot;http://cran.r-project.org/web/packages/PET/PET.pdf&quot; rel=&quot;nofollow&quot;&gt;this document&lt;/a&gt; describing the R PET package, there's documentation of the Hough transformation. That's probably what you want.&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2013-03-13T16:56:32.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8194" PostTypeId="2" ParentId="8190" CreationDate="2013-03-13T17:07:51.817" Score="2" Body="&lt;p&gt;Unlike DFT, DCT outputs real (non-complex) coefficients.&#xA;This allows to have smaller outputs (no phase should be stored).&#xA;Furthermore, it corresponds to a special type of boundary conditions in the DFT that is easily handled by implementations: symmetric signals.&#xA;This makes 2 arguments in favor of the DCT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like DFT, DCT produces outputs with few significant coefficients, hence its use in compression and more generally in sparse algorithms.&#xA;This just corresponds to the fact that not all the possible spatial frequencies exist in an image, but only a subset (for example, there are usually many horizontal and vertical lines).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-13T17:07:51.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8195" PostTypeId="1" AcceptedAnswerId="8207" CreationDate="2013-03-13T17:31:58.870" Score="9" ViewCount="395" Body="&lt;p&gt;I've been working on a project for some time, to detect and track vehicles in video captured from UAV's, currently I am using an SVM trained on bag-of-feature representations of local features extracted from vehicle and background images. I am then using a sliding window detection approach to try and localise vehicles in the images, which I would then like to track. The problem is that this approach is far to slow and my detector isn't as reliable as I would like so Im getting quite a few false positives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have been considering attempting to segment the cars from the background to find the approximate position so to reduce the search space before applying my classifier, but I am not sure how to go about this, and was hoping someone could help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, I have been reading about motion segmentation with layers, using optical flow to segment the frame by flow model, does anyone have any experience with this method, if so could you offer some input to as whether you think this method would be applicable for my problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: I posted this question on stack overflow as well, and had an excellent &lt;a href=&quot;https://stackoverflow.com/a/15393025/900253&quot;&gt;answer&lt;/a&gt;, I've implemented this idea already and it is working surprising well and im now investigating using optical flow in addition to this technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is two frames from a sample video &lt;/p&gt;&#xA;&#xA;&lt;p&gt;frame 0:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CM8qA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CM8qA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;frame 5:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XVVZL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XVVZL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3217" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-08-25T08:13:58.620" Title="Vehicle segmentation and tracking" Tags="|image-segmentation|classification|object-recognition|motion-detection|visual-tracking|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8196" PostTypeId="2" ParentId="8190" CreationDate="2013-03-13T18:48:26.890" Score="3" Body="&lt;p&gt;A rectangular window of data can have a discontinuity between the front and back edge.  An FFT of that window represents that circular edge discontinuity with energy in a bunch of high frequency bins.  Take that segment of signal and mirror it around one edge.  Note that a circular or periodic extension of this no longer has a discontinuity across the edge.  The FFT of that doubled-by-mirroring signal might thus have less information energy in the high bins.  Thus there may be more of these high bins that can be &quot;thrown away&quot; by a compression algorithm without major damage (information loss).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A DCT is an FFT of the doubled-by-mirroring product.  Since the mirrored intermediate vector is symmetric, some efficiency can be gotten by throwing away any computations only required for the sine components since they will be zero anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A DST would be the FFT of a doubled-by-mirroring-the-inverse signal, which would make the discontinuities worse, which would spread even more information/energy into the bins you would really like to throw away, thus making things far worse for simply but lossy compression.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-03-13T19:00:46.467" LastActivityDate="2013-03-13T19:00:46.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8198" PostTypeId="2" ParentId="8174" CreationDate="2013-03-13T19:38:46.003" Score="1" Body="&lt;p&gt;Looking through some literature shows that a side by side comparison of FSK with ASK does not give FSK a performance advantage over ASK in the presence of noise &lt;sup&gt;&lt;a href=&quot;http://www.rfm.com/corp/appdata/ook.pdf&quot; rel=&quot;nofollow&quot;&gt;(1)&lt;/a&gt;&lt;/sup&gt;; however you can do some nonlinear processing with FSK in the demodulator that does produce a signal that is more tolerant to noise than ASK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some instances of FSK modulation/demodulation schemes, you can force the receive signal to clip (i.e. put the signal through a Schmidt trigger) so the amplitude noise is essentially eliminated.  You can't do this with the ASK signal because this eliminates the information in the modulated signal.  For the FSK signal, the clipped signal still carries frequency information with a slight phase error due to the noise signal.  There is a threshold at which noise can cause enough phase error to affect the demodulation even after clipping the signal, but below that threshold, the signal is largely immune to noise.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="4355" LastEditDate="2013-06-13T23:31:29.667" LastActivityDate="2013-06-13T23:31:29.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8199" PostTypeId="2" ParentId="3358" CreationDate="2013-03-13T21:56:54.877" Score="1" Body="&lt;p&gt;A Very good book to learn &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470173661&quot; rel=&quot;nofollow&quot;&gt;Kalman Theory and implementation using MATLAB is here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4126" LastActivityDate="2013-03-13T21:56:54.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8200" PostTypeId="1" CreationDate="2013-03-13T22:06:18.923" Score="1" ViewCount="1570" Body="&lt;p&gt;I have checked &lt;a href=&quot;https://dsp.stackexchange.com/questions/1571/optimized-ansi-c-libraries-for-dsp&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/1571/optimized-ansi-c-libraries-for-dsp&quot;&gt;this&lt;/a&gt; Question in this site very much similar to my question. But I want to know are they Qt compatible? I want to start learn developing DSP application in Qt framework so I want some library compatible with Qt so that it can later be translated into Qtpython also? Can we use same libraries with Qt as it is? Will it make effect on changing data types to and from this library to QtObject? I am new to DSP and Qt. so may be the question seems silly. &lt;/p&gt;&#xA;" OwnerUserId="4126" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-03-15T20:00:02.330" Title="DSP library compatible with QT?" Tags="|c|" AnswerCount="1" CommentCount="1" ClosedDate="2013-03-30T17:48:24.027" ContentLicense="CC BY-SA 3.0" />
  <row Id="8201" PostTypeId="1" AcceptedAnswerId="8203" CreationDate="2013-03-13T22:26:37.073" Score="0" ViewCount="407" Body="&lt;p&gt;I am having trouble understanding what is causing the problem to my Wavelet output when i am trying to display the image with the figure command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to display both the Original image and its Wavelets decomposition,&#xA;but when I'm using this code the original image is not displaying in a separate figure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = imread('cameraman.tif');&#xA;imshow(im),title('Original Image')&#xA;&#xA;[cA1,cH1,cV1,cD1] = dwt2(im,'bior3.7');&#xA;A1 = upcoef2('a',cA1,'bior3.7',1);&#xA;H1 = upcoef2('h',cH1,'bior3.7',1);&#xA;V1 = upcoef2('v',cV1,'bior3.7',1);&#xA;D1 = upcoef2('d',cD1,'bior3.7',1);&#xA;&#xA;% To display the results of the level 1 decomposition, type:&#xA;&#xA;&#xA;subplot(2,2,1); image(wcodemat(A1,192));&#xA;title('Approximation A1')&#xA;&#xA;subplot(2,2,2); image(wcodemat(H1,192));&#xA;title('Horizontal Detail H1')&#xA;&#xA;subplot(2,2,3); image(wcodemat(V1,192));&#xA;title('Vertical Detail V1')&#xA;&#xA;subplot(2,2,4); image(wcodemat(D1,192));&#xA;title('Diagonal Detail D1')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the output of this code is just one figure with four plots (Digonal, Horizontal, Vertical details and Approximations)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UdPNh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when I'm using &lt;code&gt;figure&lt;/code&gt; command to display the original image in a separate figure,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; im = imread('cameraman.tif');&#xA;imshow(im),title('Original Image')&#xA;figure &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it messes up the wavelet output,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/72pPy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does it happens that my output is changed to blue and red color ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-03-14T03:55:36.187" Title="2-D Wavelet output changing when using 'figure' command in Matlab" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8202" PostTypeId="1" CreationDate="2013-03-13T23:46:40.990" Score="0" ViewCount="109" Body="&lt;p&gt;I'm working on a project to hide simple string inside a 255x255 image using Wavelet transform. The problem is that, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i used &lt;code&gt;Haar&lt;/code&gt; Wavelet the result is successful,&#xA;This is what I've done,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Decompose the image into its approximation and details(Vertical,Horizontal,Diognal)&lt;/li&gt;&#xA;&lt;li&gt;then Hiding message in the details of the Image,&lt;/li&gt;&#xA;&lt;li&gt;Reconstructing the Image with Hidden message,&lt;/li&gt;&#xA;&lt;li&gt;Applying same wavelet on the Reconstructed Image.&lt;/li&gt;&#xA;&lt;li&gt;Decoding the algorithms applied for the encoding of the Message.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;but when i tried these Wavelets,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Coiflets 'coif1', ... , 'coif5'&#xA;&#xA;Symlets'sym2', ... , 'sym8', ... ,'sym45'&#xA;&#xA;Discrete Meyer'dmey'&#xA;&#xA;Biorthogonal'bior1.1', 'bior1.3', 'bior1.5'&#xA;'bior2.2', 'bior2.4', 'bior2.6', 'bior2.8'&#xA;'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7'&#xA;'bior3.9', 'bior4.4', 'bior5.5', 'bior6.8'&#xA;&#xA;Reverse Biorthogonal'rbio1.1', 'rbio1.3', 'rbio1.5'&#xA;'rbio2.2', 'rbio2.4', 'rbio2.6', 'rbio2.8'&#xA;'rbio3.1', 'rbio3.3', 'rbio3.5', 'rbio3.7'&#xA;'rbio3.9', 'rbio4.4', 'rbio5.5', 'rbio6.8'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting weird characters rather than my original Hidden Message.&#xA;What does that mean ? How would i know which Wavelet should i suppose to use when the message is totally random ? &lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="21075" LastEditDate="2020-05-09T14:54:04.253" LastActivityDate="2020-05-09T14:54:04.253" Title="Steganography using wavelet transform — not every wavelet recovering the hidden message efficiently" Tags="|wavelet|steganography|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8203" PostTypeId="2" ParentId="8201" CreationDate="2013-03-14T03:55:36.187" Score="2" Body="&lt;p&gt;The reasoning is simple. MATLAB defaults to a 'jetblue' colormap when you use imshow(im). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically you need to specify the colormap being used when you use imshow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this, add another command like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$colormap(gray(256));$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to your current script.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-03-14T03:55:36.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8204" PostTypeId="1" AcceptedAnswerId="8212" CreationDate="2013-03-14T05:00:52.430" Score="6" ViewCount="991" Body="&lt;p&gt;I want to excite a loudspeaker with a constant magnitude chirp that sweeps across all frequencies in the audio band. I downloaded a &lt;a href=&quot;http://www.audiocheck.net/download.php?filename=Audio/audiocheck.net_hdsweep_1Hz_48000Hz_-3dBFS_30s.wav&quot; rel=&quot;nofollow noreferrer&quot;&gt;test file&lt;/a&gt; from this &lt;a href=&quot;http://www.audiocheck.net/testtones_highdefinitionaudio.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audio Check - High Definition Audio Test Files&lt;/a&gt; to start with.&lt;/p&gt;&#xA;&lt;p&gt;I plot the log magnitude of the file with the following code which I use for other applications as well.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[X Fs nbits] = wavread('audiocheck.net_hdchirp_96k_-3dBFS_log.wav');&#xA;X = X(:,1);&#xA;fft_prep = fftshift(fft(X));&#xA;fft_mag = real(fft_prep).^2 + imag(fft_prep).^2;&#xA;pos_fft=fft_mag(ceil(length(fft_mag)/2+1:length(fft_mag)));&#xA;db_fft=20*log10(pos_fft);&#xA;figure(1);&#xA;plot(linspace(0,48000,length(db_fft)), db_fft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I see this graph:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pwQbX.png&quot; alt=&quot;sweep&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was hoping to see a constant magnitude response. A friend of mine mentioned something about how &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Parseval's Theorem&lt;/a&gt; states that there will be different energy in different frequencies. I found &lt;a href=&quot;http://cdn.intechopen.com/pdfs/35222/InTech-Aspects_of_using_chirp_excitation_for_estimation_of_bioimpedance_spectrum.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt; that talks about Parseval's Theorem and also says in the section &amp;quot;Spectral features and energy of chirps&amp;quot;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Important and desired spectral properties of excitation signals to improve the quality of&#xA;wideband measurement are: flat amplitude spectrum with minimal fluctuation (ripple) together with the absence of overshoots inside the generated (excitation) bandwidth Bexc =ffin - fst; steep drop-down of the amplitude spectrum outside the bandwidth Bexc; maximal energy-efficiency, i.e., the ratio between the energy lying within the generated&#xA;(excitation) bandwidth Bexc and total energy of the signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mYHFS.png&quot; alt=&quot;good chirps&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;To avoid worrying about a chirp someone else made. I am also trying to generate a chirp in Matlab and I am seeing the following response with:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:0.001:10;      % 10 seconds @ 1kHz sample rate&#xA;fo = 10; f1 = 400;   % Start at 10Hz, go up to 400Hz&#xA;X = chirp(t,fo,10,f1,'logarithmic');&#xA;fft_prep = fftshift(fft(X));&#xA;fft_mag = abs(fft_prep);&#xA;pos_fft = fft_mag(ceil(length(fft_mag)/2)+1:length(fft_mag));&#xA;db_fft = 20*log10(pos_fft);&#xA;figure(1);&#xA;plot(linspace(fo,f1,length(db_fft)), db_fft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8WU9u.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I generate a relatively constant magnitude sweep across the audio range in Matlab like I see in figure 8 above? Any advice is welcome and I appreciate the help.&lt;/p&gt;&#xA;" OwnerUserId="3733" LastEditorUserId="7092" LastEditDate="2021-05-29T13:22:18.067" LastActivityDate="2021-05-29T13:22:18.067" Title="Constant Magnitude Chirp across audio band (Parseval's Theorem?)" Tags="|fft|matlab|frequency-spectrum|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8205" PostTypeId="1" CreationDate="2013-03-14T06:00:29.650" Score="2" ViewCount="178" Body="&lt;p&gt;We are investigating ways to test a control algorithm.  The algorithm has a non-equidistant track of input data (i.e. not every sample is valid, and we know it), and should output a series of correction factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under a certain frequency, it should correct for a deteriorating light source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to black-box test the algorithm's transfer function?  I'm having trouble especially with the fact that it's non-equidistant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of the tests would be to have a clear idea on the algorithm's behavior in terms of &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;delay/phase response&lt;/li&gt;&#xA;&lt;li&gt;resonances&lt;/li&gt;&#xA;&lt;li&gt;frequency response&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I was actually dreaming of a kind of a 'swept sine' test, or an impulse response, or something alike, but I'm a bit lost in what is feasible with non-equidistant signals.&lt;/p&gt;&#xA;" OwnerUserId="134" LastEditorUserId="134" LastEditDate="2013-03-15T21:38:15.890" LastActivityDate="2014-01-10T02:33:38.560" Title="response of algorithm in non-equidistant time" Tags="|discrete-signals|impulse-response|control-systems|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8206" PostTypeId="1" AcceptedAnswerId="10437" CreationDate="2013-03-14T06:39:19.560" Score="0" ViewCount="267" Body="&lt;p&gt;I need to graph a $16$ bits binary sequence, assuming that it'll be a FM analog signal I need to apply FSK to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I think I should use the formula &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A \cos(2\pi f_1 t)$ for binary $1$'s&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A \cos(2\pi f_2 t)$ for binary $0$'s&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm really confused about how to set a method for getting the graph for my $16$ bit sequence ...&lt;/p&gt;&#xA;" OwnerUserId="4116" LastEditorUserId="5104" LastEditDate="2013-08-22T12:05:22.593" LastActivityDate="2013-08-23T01:21:11.973" Title="How should I modulate a $16$ bit input using FSK?" Tags="|modulation|fsk|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8207" PostTypeId="2" ParentId="8195" CreationDate="2013-03-14T12:04:32.557" Score="6" Body="&lt;p&gt;Alas, optical flow is a difficult problem too ;-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, to be more constructive, here are a few algorithms that should be worth trying (or have been tried on this particular sequence) :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;re-train your bags of features on a databse of vehicles more representative (in size and orientation) to your actual problem in order to obtain better results&lt;/li&gt;&#xA;&lt;li&gt;use the fact that the ground is a flat plane to do some parametric optical flow (search for an affine flow) or to compute some affine registration between the frames of the sequence. The moving vehicles will then be outlier from this dominant motion&lt;/li&gt;&#xA;&lt;li&gt;use some optical flow algorithm to compute the flow, then try to classifiy / cluster the optical flow vectors (this is still a widely open problem!). Depending on the language you use, you can use OpenCV's optical flow, the one from &lt;a href=&quot;http://gpu4vision.icg.tugraz.at/index.php?content=Cat_1&quot;&gt;TU Graz&lt;/a&gt;, &lt;a href=&quot;http://cs.brown.edu/~dqsun/research/software.html&quot;&gt;D. Sun's optical flow&lt;/a&gt;, or even &lt;a href=&quot;http://lts2www.epfl.ch/people/dangelo/opticalflow&quot;&gt;mine&lt;/a&gt; ;-). Note however that segmenting the flow will be a non-trivial task that you should probably do in two steps: global (dominant) motion etsimation, then small motion detection.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-14T12:04:32.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8208" PostTypeId="1" CreationDate="2013-03-14T12:07:41.203" Score="3" ViewCount="53" Body="&lt;p&gt;I am interested in knowing the step amplitude on a signal which can only be measured through a hardware RC filter. The measured signal follows this formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V(t) = V_0 \left(1 - e^{-\frac{t}{RC}}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to estimate the step amplitude, $V_0$, given that we can perform two measurements on the almost linear part of the rising edge (with a known delay between them)?&lt;/p&gt;&#xA;" OwnerUserId="3401" LastEditorUserId="90" LastEditDate="2013-03-14T12:59:18.190" LastActivityDate="2013-03-14T14:26:59.557" Title="Estimate input from measuring only RC filtered input" Tags="|continuous-signals|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8209" PostTypeId="2" ParentId="8183" CreationDate="2013-03-14T12:11:59.917" Score="1" Body="&lt;p&gt;A common practice in your case is to give the mean rank of the correct answer (the ground truth), eventually after querying for only the 5 best matches. An alternative is to give the percentage of tests where the good solution was in the top 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Search for related papers in your field, this will give you some hints on what to choose.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-14T12:11:59.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8210" PostTypeId="1" AcceptedAnswerId="8232" CreationDate="2013-03-14T12:14:24.613" Score="1" ViewCount="1373" Body="&lt;p&gt;&lt;br/&gt;&#xA;I am working on a video motion feature implementation. I am implementing a work in a research paper. What I want to implement is this: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The frames contained in a video clip can be thought of as a volume obtained by considering all the frames in time. This volume can be decomposed into a set of two 2-D temporal slices I(x,t)and I(y,t).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What's the methodology of implementing this i.e slicing the volume of frames in time? &lt;br/&gt;&#xA;Relevant link of paper: &lt;a href=&quot;http://www.cs.cmu.edu/~yaser/RasheedSheikhShah_CVST_2005.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.cmu.edu/~yaser/RasheedSheikhShah_CVST_2005.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4132" LastEditorUserId="4132" LastEditDate="2013-03-14T17:06:50.980" LastActivityDate="2016-12-18T18:24:54.720" Title="Decompose video frames into slices" Tags="|matlab|image-processing|dsp-core|video-processing|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8211" PostTypeId="2" ParentId="8208" CreationDate="2013-03-14T13:14:17.577" Score="2" Body="&lt;p&gt;That's certainly possible, assuming you know the values of the resistance and capacitance $R$ and $C$. You can expand the signal $V(t)$ in a &lt;a href=&quot;http://en.wikipedia.org/wiki/Taylor_series&quot; rel=&quot;nofollow&quot;&gt;Taylor series&lt;/a&gt; about $t=0$ to arrive at an approximate linear model. First, remember the Taylor series of the exponential function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2} + \ldots&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're assuming a linear model near the step input time of $t=0$, then truncate the sum to arrive at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e^x \approx 1 + x&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substitute this into the equation for $V(t)$ to yield:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V(t) \approx V_0\left(1 - \left(1 - \frac{t}{RC}\right)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V(t) \approx V_0\frac{t}{RC}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is a pretty simple result. If you know the absolute time of the step input, then you theoretically don't even need multiple measurements; you could estimate $V_0$ directly using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V_0 \approx \frac{V(T)RC}{T}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is the time at which you measure the signal. If you don't know the exact time at which the step is input, then you can take two measurements, as you suggested, at times $T_1$ and $T_2$, then form the estimate as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V(T_2) - V(T_1) \approx V_0\frac{T_2}{RC} - V_0\frac{T_1}{RC}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V_0 \approx RC \frac{V(T_2) - V(T_1)}{T_2 - T_1}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-03-14T13:55:38.727" LastActivityDate="2013-03-14T13:55:38.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8212" PostTypeId="2" ParentId="8204" CreationDate="2013-03-14T13:26:50.180" Score="3" Body="&lt;p&gt;If you change the &quot;X = chirp(t,fo,10,f1,'logarithmic');&quot; to &quot;X = chirp(t,fo,10,f1,'linear');&quot; you will get the response that you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To have the energy be equal it must spend an equal amount of time at each frequency.  With the linear sweep it does that.  With the logarithmic sweep it spends more time at the lower frequencies and much less time at the higher frequencies, resulting in unequal energy.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-14T13:26:50.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8214" PostTypeId="2" ParentId="8210" CreationDate="2013-03-14T15:36:41.657" Score="0" Body="&lt;p&gt;The simplest 'idea' as to do this would be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Partition video into image frames at a particular frame rate.&#xA;This can be done as in - &lt;a href=&quot;http://www.mathworks.in/help/vision/ug/partition-video-frames-to-multiple-image-files.html&quot; rel=&quot;nofollow&quot;&gt;link 1&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;Then, extract the (x,y) co-ordinates from each frame via batch processing of images and batch them with the frame numbers as a vector/matrix.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-03-14T15:36:41.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8215" PostTypeId="1" AcceptedAnswerId="8219" CreationDate="2013-03-14T15:40:56.020" Score="0" ViewCount="522" Body="&lt;p&gt;i have two audio signals .wav and i want to convolve them, the trouble is that the frequency do not fit, they aren´t just the same frecuency-lenght in the wavread arguments. i am supposed to use the lesser frequency to resample the other one using interp1 and splines. I really appreciate your help.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3275" LastActivityDate="2013-03-14T22:18:49.610" Title="How to resample in MATLAB one signal that is supposed to be convolve with another one?" Tags="|matlab|audio|discrete-signals|dsp-core|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8216" PostTypeId="1" CreationDate="2013-03-14T18:51:08.507" Score="0" ViewCount="1189" Body="&lt;p&gt;I used MATLAB to produce a simple sine wave over time:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;frequency=7&#xA;sampling_frequency=1000;&#xA;total_time=1-1/sampling_frequency;&#xA;step=1/1000;&#xA;theta=0;&#xA;time=0:step:total_time;&#xA;&#xA;y=Amplitude*sin(2*pi*frequency*time+theta)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then used the following code to fast fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y=fft(y);&#xA;ploty=Y/length(y);&#xA;stem(abs(ploty))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was expecting to see one spike at 7 instead I am getting 2 and not even at 7.&#xA;One is at 8 and the other at 994. I am totally confused as to why.&lt;/p&gt;&#xA;" OwnerUserId="4134" LastEditorUserId="39" LastEditDate="2013-03-15T15:59:24.143" LastActivityDate="2013-03-15T15:59:24.143" Title="Fast fourier transform and frequency domain spike in wrong area" Tags="|fft|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8218" PostTypeId="2" ParentId="8216" CreationDate="2013-03-14T19:53:53.700" Score="7" Body="&lt;p&gt;You see one at index 8 because MATLAB's indexing is one-based, not zero-based as the equations that describe the DFT are. You get two spikes because your input signal is real and is therefore conjugate-symmetric in the frequency domain. If you work out the math, you'll see that the Fourier transform of a $\sin$ has two spikes symmetric about zero frequency. In order to get a single spike, you need to use a &lt;em&gt;complex exponential&lt;/em&gt; function at the same frequency instead.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-03-14T19:53:53.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8219" PostTypeId="2" ParentId="8215" CreationDate="2013-03-14T22:18:49.610" Score="1" Body="&lt;p&gt;If the ratio of the sample rates is reasonably rational (i.e can be represented as the quotient of reasonably small integers) then you can use the MATLAB function resample().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolving to audio signals is rather unusual. Typically and audio signal is convolved with filter impulse response. The impulse response could be stored in an aduio file, but that would be a bit unusual. I would double check if you understood the task correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both interp1() and spline() are poor choices for sample rate conversion as they don't control the mirror images in any predictable way. I recommend reading up on &quot;sample rate conversion&quot;.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-03-14T22:18:49.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8220" PostTypeId="1" AcceptedAnswerId="8221" CreationDate="2013-03-14T22:45:26.613" Score="2" ViewCount="1945" Body="&lt;p&gt;It is perhaps important to start with the fact that I am a complete beginner in DSP.&#xA;I have got a number of audio recordings (of sampling rate 22 kHz) - of bird songs - which I have been trying to analyse using FFT (in Matlab/Octave). Particularly, I am trying to show using Machine Learning classification algorithms that different classes of those recordings have prominence of different frequencies (or frequency ranges).&#xA;The recordings are of variable length and, due to computation limitations, the largest size FFT that I can do is 2^19 (which I understand is the number of points it takes from each audio file).&#xA;So, my first question is: if I break my recordings in parts, each corresponding to the size of FFT that I've chosen - would it be still reasonable to treat those parts as separate data examples (i.e. separate recordings), and what kind of information do I lose when splitting the larger recordings in such way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second question is: is there a better way for a beginner to perform this analysis, in a not so computationally expensive way, since I think working with vectors of size 2^18+1 is not really the best thing to do in the current case.&lt;/p&gt;&#xA;" OwnerUserId="3419" LastActivityDate="2013-11-07T10:38:20.247" Title="Performing classification based on FFT results" Tags="|fft|frequency|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8221" PostTypeId="2" ParentId="8220" CreationDate="2013-03-14T23:26:36.897" Score="5" Body="&lt;p&gt;I think the FFT is a bad choice of representation for your problem - it captures many properties of the signal irrelevant to your application, and as you are suspecting, it generates a huge amount of data to process if you extract the FFT of the whole signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that the most important quantity to consider when studying birdsongs is pitch (fundamental frequency) - all other dimensions of sound (loudness, timbre) are actually variability factors you want to get rid off. For example, two recordings of the same birdsong made in a different environment and with different equipment will exhibit a different frequency response due to the variation in conditions; but fortunately the pitch profile would be exactly the same!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I suggest you to use a pitch transcription utility (canned solutions : &lt;a href=&quot;http://aubio.org/&quot; rel=&quot;nofollow&quot;&gt;aubio&lt;/a&gt;, &lt;a href=&quot;http://www.fon.hum.uva.nl/praat/&quot; rel=&quot;nofollow&quot;&gt;praat&lt;/a&gt;, &lt;a href=&quot;http://www.sonicvisualiser.org/&quot; rel=&quot;nofollow&quot;&gt;sonic visualizer&lt;/a&gt;...) to extract a pitch contour - a function giving the predominant &quot;note&quot; as a function of time. From that, you could define a feature vector containing pitch statistics (mean, standard deviation, maybe higher order moments); or maybe just build a histogram of pitch values; and this would result in a very compact feature vector suitable for automatic classification. To improve your results, you might then add features capturing the dynamics of pitch over time - dominant modulation rates extracted form the pitch contour, variation of pitch statistics over chunks of a few seconds of audio, etc..&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-03-15T00:05:36.300" LastActivityDate="2013-03-15T00:05:36.300" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8223" PostTypeId="1" CreationDate="2013-03-15T08:07:05.843" Score="1" ViewCount="188" Body="&lt;p&gt;I have an image convoluted by a rectangular PSF of a blur kernel. The fourier transform of the PSF has pattern of a sinc function: $\frac{\tau sin(\pi \tau f)}{\pi f}$. The image size is 256x256.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would my following assumptions about the PSF on its period in frequency domain and width of its pulse in the PSF be correct:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The rectangular pulse of the PSF will run with an impulse value of&#xA;  $f(x)=1$ from $\frac{-128\tau}{1}$ to $\frac{+128\tau}{1}$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;So the width of this rectangular pulse in the PSF is $128 \times 2 =&#xA;&amp;gt; 256$ in width.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The sinc period in the frequency domain of the PSF would be the same, running&#xA;  from $\frac{-128\tau}{1}$ to $\frac{+128\tau}{1}$. (This is my most&#xA;  unsure part)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3769" LastActivityDate="2013-03-15T08:07:05.843" Title="How to compute sinc period in frequency domain and width of pulse" Tags="|image-processing|matlab|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8224" PostTypeId="1" CreationDate="2013-03-15T09:00:42.467" Score="3" ViewCount="150" Body="&lt;p&gt;I am not sure if this question will be a little off-topic on this forum, that I will give it a try anyway, since it implies signal process arguments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using &lt;code&gt;MATLAB&lt;/code&gt;, I'm on my way to generate a &lt;em&gt;turbulent wind field&lt;/em&gt;. This wind field is generally a &lt;em&gt;Gaussian process&lt;/em&gt; with all the time series having &lt;strong&gt;0 mean value&lt;/strong&gt; and &lt;strong&gt;unitary standard deviation&lt;/strong&gt;. I will shortly introduce you to the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Discretize the space in &lt;strong&gt;Y-Z&lt;/strong&gt; plane in a certain number of points &lt;code&gt;Ny&lt;/code&gt;, &lt;code&gt;Nz&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Discretize the time scale (generally &lt;em&gt;600s&lt;/em&gt;) with a proper time sample, &lt;code&gt;dt = 0.15&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Calculate distance among points;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Generate only positive frequency vector &lt;code&gt;f = (0:length(t)/2-1)*df&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Generate power spectra&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S_{ii}(f)=\frac{4\sigma_{ii}^{2}\left(L_{ii}/U\right)}{\left(1+6f\left(L_{ii}/U\right)\right)^{5/3}} $$&#xA;where&#xA;$$ ii = u,v,w\,\, (speed\,\,components\,in\,x\,y\,z\,direction)$$&#xA;$$ U = const $$&#xA;$$ L_{ii} = const $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) Generate coherence matix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Coh_{u}=\exp\left(-12\sqrt{\left(\frac{f*dist}{U}\right)^{2}+\left(0.12\frac{dist}{U}\right)^{2}}\right) $$&#xA;$$ Coh_{v,w}= \exp\left(-12\, dist\,\frac{f}{U}\right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;7) Generate random numbers with 0 mean and 1 std&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nn_u = complex(normrnd(0,1,size(H_u)),normrnd(0,1,size(H_u)));&#xA;nn_v = complex(normrnd(0,1,size(H_v)),normrnd(0,1,size(H_v)));&#xA;nn_w = complex(normrnd(0,1,size(H_w)),normrnd(0,1,size(H_w)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;8) Cholesky factorization of the Coherence matrix (retrieves lower triangular factor)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;9) Generate time series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ U = [real(fft(Coh_{u}*nn_{u}))\,\,imag(fft(Coh_{u}*nn_{u}))] $$&#xA;$$ V = [real(fft(Coh_{v}*nn_{v}))\,\,imag(fft(Coh_{v}*nn_{v}))] $$&#xA;$$ W = [real(fft(Coh_{w}*nn_{w}))\,\,imag(fft(Coh_{w}*nn_{w}))] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, after this consistent theorethical introduction, &lt;strong&gt;I can move towards the real matter&lt;/strong&gt;: when calculating the standard deviations for eac time series &lt;em&gt;(u,v,w components)&lt;/em&gt;, they don't match the expected values&#xA;$$ \sigma_{u} = 1 $$&#xA;$$ \sigma_{v} = 0.8 $$&#xA;$$ \sigma_{w} = 0.5 $$&#xA;because of several reasons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;space discretization introducing smoothing effects&lt;/li&gt;&#xA;&lt;li&gt;time sample period&lt;/li&gt;&#xA;&lt;li&gt;power spectrum only within a short frequency range&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Btw, I would like to, let's say, scale the time series in order they to be still Gaussian variables with zero mean and a standard deviation better approaching the expected values.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any hint?&lt;/p&gt;&#xA;" OwnerUserId="3666" LastEditorUserId="3666" LastEditDate="2013-03-15T11:21:04.177" LastActivityDate="2013-03-15T11:21:04.177" Title="Compensate for standard deviation loss" Tags="|fft|matlab|gaussian|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8225" PostTypeId="1" AcceptedAnswerId="8227" CreationDate="2013-03-15T10:35:17.270" Score="2" ViewCount="492" Body="&lt;p&gt;How exactly we should describe the process of Entropy Coding in wavelets ? can't it be simply called Coding ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the block Diagram of Image compression using wavelet,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rRusL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused about the &quot;Entropy Coding&quot; part. Can i simply use Huffman coding to code bits ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2013-03-15T14:35:18.637" LastActivityDate="2013-03-15T14:35:18.637" Title="Is Entropy Coding in Wavelet equivalent to Huffman Coding in DCT" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8226" PostTypeId="1" CreationDate="2013-03-15T10:51:24.917" Score="2" ViewCount="375" Body="&lt;p&gt;Suppose a random signal &lt;span class=&quot;math-container&quot;&gt;$x(t)=\sum\limits_{n=-\infty}^\infty Z_n \delta(t-n\tau)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$ z_n = Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is a random variable with equal probability to be &lt;span class=&quot;math-container&quot;&gt;$+-1$&lt;/span&gt;,  is passing through a low pass filter &lt;span class=&quot;math-container&quot;&gt;$h(t) = sinc(\frac t \tau)$&lt;/span&gt; and the output is &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt;. and I want to prove the output signal is cyclostationary process signal.&lt;/p&gt;&#xA;&lt;p&gt;I know the &lt;span class=&quot;math-container&quot;&gt;$\mu_y(t) = \int\limits_{-\infty}^\infty E[X(z)]h(t-z) dz = \sum\limits_{n=-\infty}^\infty \int\limits_{-\infty}^{\infty} E[Z_n] \delta(z-n\tau)h(t-z) dz$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the autocorrelation of &lt;span class=&quot;math-container&quot;&gt;$Y(t)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$R_Y(t, t+x)=E[Y(t_1)Y(t_2)]=\int\limits_{-\infty}^\infty\int\limits_{-\infty}^\infty E[X(z)X(u)] h(t-z) h(t+x-u) dz du = \sum\limits_{n=-\infty}^\infty \sum\limits_{m=-\infty}^\infty \int\limits_{-\infty}^\infty\int\limits_{-\infty}^\infty E[Z_n Z_m] \delta (z-n \tau) h(t-z) \delta (u-m \tau) h(t+x-u) dz du$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And this is what I need to prove&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Cyclostationary Process&lt;/p&gt;&#xA;&lt;p&gt;A random process &lt;span class=&quot;math-container&quot;&gt;$X(t)$&lt;/span&gt; with mean &lt;span class=&quot;math-container&quot;&gt;$\mu(t)$&lt;/span&gt; and auto correlation function &lt;span class=&quot;math-container&quot;&gt;$R_x(t+\tau, t)$&lt;/span&gt; is called cyclostationary. if both the mean and the auto correlation are periodic in t with some period &lt;span class=&quot;math-container&quot;&gt;$T_0$&lt;/span&gt;, i.e. if&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mu_x (t + T_0) = \mu(t)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_x (t + \tau + T_0, t + T_0) = R_x (t + \tau , t)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;And I think &lt;span class=&quot;math-container&quot;&gt;$\mu_y(t)$&lt;/span&gt; is 0 because &lt;span class=&quot;math-container&quot;&gt;$E[Z_n]$&lt;/span&gt; is 0 (right?),&#xA;But how can I prove the auto-correlation are periodic?&lt;/p&gt;&#xA;&lt;p&gt;Last thing, I want to thanks all you guys for your comments and intuitive answer that help me so much on my study and get my head straight. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3420" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2018-07-07T16:13:52.253" Title="Proving a cyclostationary processes signal" Tags="|autocorrelation|homework|cyclostationary-random-process|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8227" PostTypeId="2" ParentId="8225" CreationDate="2013-03-15T11:20:12.063" Score="2" Body="&lt;p&gt;The goal of entropy coding is to code your data such that the length of the code associated with a symbol is close to $-\log_2 p$, where $p$ is the probability of the symbol (Shannon's limit). This can be achieved through different techniques: Huffman coding is one of them, but arithmetic coding is another option - or if the distribution of the coefficients can be known in advance, a pre-computed code can be specified. The choice of an entropy coding method is motivated by performance/complexity trade-offs, and by the known (or unknown) distribution of the coefficients. If two transforms generate the same distribution of coefficients, the same entropy coding methods can be used for both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the diagram from your question hints that your application is JPEG2000 compression, I suggest you to look into the JPEG2000 specifications to see which entropy coding method they have actually specified.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-03-15T11:37:10.570" LastActivityDate="2013-03-15T11:37:10.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8229" PostTypeId="1" CreationDate="2013-03-15T12:18:49.330" Score="2" ViewCount="141" Body="&lt;p&gt;I am looking for a method to calculate the instantaneous pitch variation within a speech signal for time-warping application. Sample by sample frequency variation knowledge within a frame will give more accurate output in time-warping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Till now, I read about a method based on Teager's energy operator. Please suggest me some other methods for the same.&lt;/p&gt;&#xA;" OwnerUserId="1281" LastActivityDate="2013-03-15T12:18:49.330" Title="Instantaneous Frequency variation" Tags="|sampling|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8230" PostTypeId="2" ParentId="8200" CreationDate="2013-03-15T12:53:18.090" Score="2" Body="&lt;p&gt;Not quite the answer you requested, but I think the sanest thing(OOP wise)  to do in most of the situations is to have the backend of the application separated from the frontend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could create a standalone library(either static or dynamic) for your dsp code and separate it from the QT code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way your DSP code would be independent of the frontend you are using.&#xA;You could switch from QT to anything else(wxWidgets/GTK+ etc) and your DSP functions inside the lib would remain the same.&lt;/p&gt;&#xA;" OwnerUserId="731" LastActivityDate="2013-03-15T12:53:18.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8231" PostTypeId="2" ParentId="8205" CreationDate="2013-03-15T14:10:15.590" Score="1" Body="&lt;p&gt;I would try to stick with a conventional discrete time control approach.  Trying to deal with missing samples in the control algorithm complicates things and without dealing with them the control output will not be very stable.  Can something like this work in your application?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the assumption is that you can detect missing samples and use an interpolation algorithm to fill in the gaps before applying the signal to your controller/compensator.  The &quot;Control Signal&quot; input is a reference that can be used to set the normal operating intensity of the Light Source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would characterize the transfer function with using normal control signals (impulse, step, swept sine, all with uniform sampling).  Then I would model the real signal (from the lamp transducer) with some impulse variations that match the characteristics of your missing samples.  By impulse variations I mean adding small error quatities to signal to represent error from your interpolator.  Test how well the transfer function regulates in the presense of this &quot;impulse noise&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/quDCU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-03-15T22:44:57.763" LastActivityDate="2013-03-15T22:44:57.763" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8232" PostTypeId="2" ParentId="8210" CreationDate="2013-03-15T15:39:02.990" Score="1" Body="&lt;p&gt;Each frame of your movie is a &lt;strong&gt;2D plane&lt;/strong&gt; indexed by $x$ and $y$.&#xA;When you consider several consecutive frames, you can stack them in order to have a 3D cube, where &lt;strong&gt;each slice of the cube is a frame&lt;/strong&gt;.&#xA;This space-time volume is now indexed by $x,y$ and $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can manipulate this volume as any 3D volume, just replace i nyour mind $t$ by $z$ if you find it confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have this volume, if you change the normal axis used to define the 2D slices (remember it was the $t$ axis initially), you obtain the different slices that you want:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;choosing the $x$ axis as normal, you obtain 2D $(y,t)$ slices&lt;/li&gt;&#xA;&lt;li&gt;choosing the $y$ axis as normal, you obtain 2D $(x,t)$ slices&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;By the way, the classical term for these kind of slices is &lt;strong&gt;epipolar-plane image analysis&lt;/strong&gt; if you are loking for more references.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-15T15:39:02.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8233" PostTypeId="1" CreationDate="2013-03-15T17:01:18.260" Score="1" ViewCount="1563" Body="&lt;p&gt;I need help to develop an object recognition system. It needs to identify an object in an image by comparing it with an image in an existing database. For example my database may consist of images of cars, buses, cups, etc. If i give a certain image as an input i want the code to check and tell me whether a car(as in the car in the database) can be found to exist in the input image or not. This is strictly to be implemented in c#. I have tried correlation, image subtraction and a few other algorithms but to no effect.So if you have any project regarding this then also you can help me by providing that project with source code. I will learn seeing your project.Your advice are also lots for me. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4139" LastActivityDate="2013-04-18T16:05:32.637" Title="Object Recognition" Tags="|c#|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8234" PostTypeId="2" ParentId="8233" CreationDate="2013-03-15T17:37:02.613" Score="1" Body="&lt;p&gt;I am developing an image &lt;a href=&quot;http://www.imagingshop.com/sharpstitch&quot; rel=&quot;nofollow&quot;&gt;registration software in C# called SharpStitch&lt;/a&gt; (it is a commercial package).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The software is written in 100% managed code (C#) and contains the routines required for image matching (feature extration, correspondence matching, multi-image matching, Bayesian check).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am still in process of writing documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also various packages like OpenCV, VLFeat, OpenSURF (C# code available) which allow you to extract features from image. The matching is a different task though.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-03-15T17:37:02.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8235" PostTypeId="2" ParentId="8233" CreationDate="2013-03-15T17:58:09.517" Score="2" Body="&lt;p&gt;This is a very old problem and a very difficult one. Trying to match off a single example image is not going to work well. Computer vision is a great area, but it is a difficult one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally the focus in these types of problems is that you have a single specific type of item you want to identify (e.g. pedestrians) and you try to simply answer questions like: Does my picture have this type of item in it? If it does, where is it? Which pixels are part of the item (this last is called segmentation - as of a couple years ago a five year old will still do better than state of the art on segmentation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These problems are hard enough that people mostly focused on just identifying one type of object, or maybe a very small handful. Not too long ago a few researchers put together databases for trying to distinguish a larger selection - It was called the caltech 101 because it had 101 items. Then I believe a version with 500 items was created. &#xA;However for each of these items there are a number of different photos of the item (at least 24(?) or something like that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Distinguishing items in this database with high reliability is, last I knew, a state of the art challenge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mention this just to ensure that you know what you are asking. If I understand, you are trying to use single photos to recognize the same type of item (but not the same photo of that item) out of a database of single photos of items reliably, and this problem is likely far past what the research state of the art is.&lt;/p&gt;&#xA;" OwnerUserId="566" LastEditorUserId="566" LastEditDate="2013-03-19T15:49:13.180" LastActivityDate="2013-03-19T15:49:13.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8236" PostTypeId="2" ParentId="8126" CreationDate="2013-03-15T19:27:51.220" Score="10" Body="&lt;p&gt;There is a code on Matlab Fileexchange that is relevant to your problem:&#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/28155-inscribedrectangle/content/html/Inscribed_Rectangle_demo.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/28155-inscribedrectangle/content/html/Inscribed_Rectangle_demo.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote this &lt;a href=&quot;http://www.imagingshop.com/automatic-cropping-of-non-rectangular-images/&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial article&lt;/a&gt; on computing largest inscribed rectangles based on the above link from Atul Ingle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm first searches for largest squares on a binary mask. This is done using simple dynamic programming algorithm. Each new pixel is updated using the three neighbors already known:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;squares[x,y] = min(squares[x+1,y], squares[x,y+1], squares[x+1,y+1]) + 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yBgXo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sample binary mask and computed map look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/83S9M.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/pd7Uu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking maximum in the map reveals the largest inscribed square:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NBlKs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rectangle searching algorithm than scans the mask two more times looking for two classes of rectangles:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;width greater than square's size (and height possibly smaller)&lt;/li&gt;&#xA;&lt;li&gt;height greater than square's size (and width possibly smaller)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Both classes are bounded by the largest squares since no rectangle at a given point can have both dimensions greater than the inscribed square (though one dimension can be larger).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One have to choose some metric for rectangle sizes, like area, circumference or weighted sum of dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the resulting map for rectangles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/83S9M.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OswPa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is convenient to store position and size of the best rectangle found so far in a variable instead of building maps and then looking for maxima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y4bTB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The practical application of this algorithm is cropping non-rectangular images. I have used this algorithm in my &lt;a href=&quot;http://www.imagingshop.com/sharpstitch&quot; rel=&quot;nofollow noreferrer&quot;&gt;image stitching library SharpStitch&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9vCFx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="30656" LastEditDate="2017-09-07T11:22:38.727" LastActivityDate="2017-09-07T11:22:38.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8237" PostTypeId="1" AcceptedAnswerId="15641" CreationDate="2013-03-16T05:47:58.007" Score="8" ViewCount="262" Body="&lt;p&gt;I know this is probably a simple question, but I haven't been able to find a satisfactory answer anywhere...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have a time series signal of finite length N.  Call it $y[n]$.  It looks like a sine-gaussian perhaps but with some random effects.  The mean of zero, and no trend is present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, say you receive this signal $y[n]$, and you have a set of K other 'candidate' signals, $x_{1}[n], x_{2}[n], ...,x_{K}[n]$.  You want to see what the most likely candidate is.  Is there a way to do this, and attach probabilities?  For example, candidate 1 has a 20% probability of being present, candidate 2 15%, etc. such that the percents add to 100%.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I want amplitude to matter.  If the candidate signal has a much smaller amplitude than $y[n]$, it should be less likely to be present, than another candidate which is otherwise exactly the same, but with a higher amplitude.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The variance of each data point in the signals (either $y[n]$ or $x[n]$) is unknown.  All we are given is what is mentioned above.  I know that in order to do something like a $\chi^{2}$ goodness of fit test (which has been suggested to me), something must be known about the variance of each data point in the signals.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The closest thing I have found is matched filtering, but how do I compute probabilities like I mentioned above?  Or is computing probabilities like that sort of the wrong answer to the question?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Coherence is related, but its more about how the signals change over time (from my limited understanding).  All the signals mentioned have a finite length N, and the signals are already matched in time (we only care about how similar they are at a particular time instant).  Time delays between them are irrelevant.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks!! Any thoughts any of you have on this would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4141" LastEditorUserId="128" LastEditDate="2018-07-02T08:49:27.027" LastActivityDate="2018-07-02T08:49:27.027" Title="How to Tell How Likely a Signal Is Present in Another One (Variance Unknown)?" Tags="|signal-detection|random|matched-filter|coherence|template-matching|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8238" PostTypeId="1" AcceptedAnswerId="8239" CreationDate="2013-03-16T14:53:03.277" Score="1" ViewCount="181" Body="&lt;p&gt;When we say we set a threshold to the edge finding, what values are we exactly thresholding on? I know a threshold value to limit only certain edges to show up, but what value of the edges is compared with the threshold?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both the sobel and canny edge detection, they are comparing with a threshold value but I am never sure what values of the edges are being compared.&lt;/p&gt;&#xA;" OwnerUserId="3769" LastActivityDate="2013-03-16T15:17:11.600" Title="In edge detection, what value is being compared to the threshold value?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8239" PostTypeId="2" ParentId="8238" CreationDate="2013-03-16T15:17:11.600" Score="1" Body="&lt;p&gt;Its simple. The gradient matrix is computed while performing the Canny/Sobel edge detection. No the gradient varies according to the edge. When you digitize this gradient function, you get a value which tells the magnitude of the gradient at that point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you threshold. These magnitudes are compared to the threshold value. If you want weak edges, you keep low threshold values. In such a case all minor edges will show up as well.&#xA;If you want only strong 'clear' edges, then you keep higher threshold values.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-03-16T15:17:11.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8240" PostTypeId="1" CreationDate="2013-03-13T22:09:43.570" Score="14" ViewCount="26109" Body="&lt;p&gt;I know this question may not be very relevant to programming, but if I don't understand the theory behind image processing I'll never be able to implement something in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I got it right Gaussian filters are convolved with an image for noise reduction since they compute a weighed average of a pixel's neighborhood and they are very useful in edge-detection, since you can apply a blur and derive the image at the same time by simply convolving with the derivative of a Gaussian function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But can anyone explain me, or give me some references on how are they computed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Canny_edge_detector&quot;&gt;Canny's edge detector&lt;/a&gt; talks about a 5x5 Gaussian filter, but how did they get those particular numbers? And how did they go from a continuous convolution to a Matrix multiplication? &lt;/p&gt;&#xA;" OwnerUserId="4170" OwnerDisplayName="Matteo" LastEditorUserId="128" LastEditDate="2022-12-03T15:54:23.593" LastActivityDate="2022-12-03T15:54:23.593" Title="How Does a Convolution of an Image Can Be Expressed as a Matrix Multiplication (Matrix Form)?" Tags="|image-processing|convolution|filtering|edge-detection|linear-algebra|" AnswerCount="5" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8242" PostTypeId="2" ParentId="8240" CreationDate="2013-03-16T16:30:59.567" Score="2" Body="&lt;p&gt;Convolution in Time domain equals matrix multiplication in the frequency domain and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering is equivalent to convolution in the time domain and hence matrix multiplication in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the 5x5 maps or masks, they come from discretizing the canny/sobel operators.&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="958" LastEditDate="2013-03-17T04:14:42.957" LastActivityDate="2013-03-17T04:14:42.957" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8243" PostTypeId="2" ParentId="4745" CreationDate="2013-03-17T08:19:54.307" Score="-3" Body="&lt;p&gt;The negative is comparatively concept .. this means when your reference signal has a main component @ fo there are also other components that leading and lagging to fo .. so the leading and lagging produce the (+) and (-) components on the right and left sides if fo respectively ..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this may clear your confusion about negative frequencies..&lt;/p&gt;&#xA;" OwnerUserId="4146" LastActivityDate="2013-03-17T08:19:54.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8245" PostTypeId="1" AcceptedAnswerId="8246" CreationDate="2013-03-17T10:04:36.100" Score="4" ViewCount="3353" Body="&lt;p&gt;For audio classification we are using cepstral coefficients, but how should I decide the number of coefficients?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastEditorUserId="76" LastEditDate="2013-03-18T04:03:03.620" LastActivityDate="2013-03-18T04:03:03.620" Title="How to decide the number of cepstral coefficients?" Tags="|speech-recognition|sound|cepstral-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8246" PostTypeId="2" ParentId="8245" CreationDate="2013-03-17T13:03:45.740" Score="5" Body="&lt;p&gt;From &lt;a href=&quot;http://cmusphinx.sourceforge.net/wiki/faq#qwhat_speech_feature_type_does_cmusphinx_use_and_what_do_they_represent&quot; rel=&quot;nofollow&quot;&gt;CMUSphinx FAQ&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There are various types of MFCC which differ by number of parameters,&#xA;  but not really different for accuracy (it might be a few percent worse&#xA;  or better).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The interpretation of MFCC (Roughtly introduced Alan V. Oppenheim and&#xA;  Ronald W. Schafer. From Frequency to Quefrency: A History of the&#xA;  Cepstrum. IEEE SIGNAL PROCESSING MAGAZINE) is not applicable as such,&#xA;  and the use of 12 or 13 coefficients seem to be due to historical&#xA;  reasons in many of the reported cases. The choice of the number of&#xA;  MFCCs to include in an ASR system is largely empirical. To understand&#xA;  why any specific number of cepstral coefficients is used, you could do&#xA;  worse than look at very early (pre-HMM) papers. When using DTW using&#xA;  Euclidean or even Mahalanobis distances, it quickly became apparent&#xA;  that the very high cepstral coefficients were not helpful for&#xA;  recognition, and to a lesser extent, neither were the very low ones.&#xA;  The most common solution was to “lifter” the MFCCs - i.e. apply a&#xA;  weighting function to them to emphasise the mid-range coefficients.&#xA;  These liftering functions were “optimised” by a number of researchers,&#xA;  but they almost always ended up being close to zero by the time you&#xA;  got to the 12th coefficient.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In practice, the optimal number of coefficients depends on the&#xA;  quantity of training data, the details of the training algorithm (in&#xA;  particular how well the PDFs can be modelled as the dimensionality of&#xA;  the feature space increases), the number of Gaussian mixtures in the&#xA;  HMMs, the speaker and background noise characteristics, and sometimes&#xA;  the available computing resources.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3453" LastEditorUserId="35" LastEditDate="2013-03-18T03:27:44.053" LastActivityDate="2013-03-18T03:27:44.053" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8247" PostTypeId="1" AcceptedAnswerId="8248" CreationDate="2013-03-17T13:15:36.173" Score="4" ViewCount="1170" Body="&lt;p&gt;I'm trying to gain a better understanding of windowing functions, but so far I can't tell why they're used. As an example, I'm familiar with the Hamming Window:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ w(k) = 0.54-0.46cos( \frac{2{\pi}k}{N-1})$ if $0&amp;lt;k&amp;lt;N$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't understand how this can be done without distorting the signal. Are these specially chosen functions that just happen to retain the spectrum of the signal sample? Can it be proven mathematically that multiplying by this function retains the spectrum? And what is the advantage to using this, rather than simply windowing it and not multiplying it by any windowing function at all (i.e. a windowing function of 1)?&lt;/p&gt;&#xA;" OwnerUserId="1746" LastActivityDate="2013-03-17T13:29:42.610" Title="how do windowing functions not distort the signal?" Tags="|frequency-spectrum|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8248" PostTypeId="2" ParentId="8247" CreationDate="2013-03-17T13:29:42.610" Score="8" Body="&lt;p&gt;They do &quot;distort&quot; the signal, as you noted. Multiplying by a window function does not &quot;retain&quot; the spectrum of the original signal. Recall the multiplication property of the &lt;a href=&quot;http://en.wikipedia.org/Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fourier transform&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) w(t) \Leftrightarrow X(\omega) * W(\omega)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the $*$ denotes convolution. So, multiplying by a window function in the time domain yields convolution of the input signal and window function's spectra in the frequency domain. In this way, there is some &quot;distortion&quot; of the input signal's spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noted, however, there are cases where using window functions can be useful. &lt;a href=&quot;https://dsp.stackexchange.com/questions/208/what-should-be-considered-when-selecting-a-windowing-function-when-smoothing-a-t?rq=1&quot;&gt;There is a good illustration of the tradeoffs here&lt;/a&gt;. I will shamelessly steal the plot for reproduction here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sfrTk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summarizing the discussion briefly: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you don't use a window, that is equivalent to using a rectangular window, assuming you are analyzing a finite-length signal (and if you aren't, then you better be patient). The rectangular window has a very slow decay rate on its sidelobes. You have to move away from the main lobe a long way in frequency in order to achieve a certain amount of attenuation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Say you had a case where you wanted to analyze two tones in a signal, where one is 40 dB stronger than the other. Compare this to the plot of the rectangular window's frequency response in the linked answer above. You can see that for that case, the sidelobe response of the rectangular window never drops below ~30-35 dB or so (except for the very narrow nulls). That means that the sidelobe response from the stronger signal would &quot;wash out&quot; the other peak, thwarting your attempt to analyze both signals simultaneously.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The solution to such a problem is to use a window function: there are a few illustrated there, but there are a lot of them. Select one that has enough sidelobe attenuation for your application. For example, the Blackman-Harris window has greater than 90 dB of sidelobe attenuation, which provides a lot more dynamic range than the rectangular window.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You pay a price for such a choice, though. The &quot;distortion&quot; that you referred to, caused by the convolution of the input signal and window spectra, comes into play. Note that the greater the dynamic range of the window function (i.e. the lower its sidelobes are), the wider its main lobe is. This can affect your ability to resolve two tones that are very close to one another (if they are too close, then the width of the window's main lobe will cause them to smear together). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This is the inherent tradeoff when selecting a window function.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2013-03-17T13:29:42.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8249" PostTypeId="1" CreationDate="2013-03-13T04:11:27.260" Score="2" ViewCount="1478" Body="&lt;p&gt;I am sampling a 5mhz blocks at an IF of 40 MHZ. I am sampling at 11MHz per bandpass sampling theory, but when I run the FFT I get all the aliases. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am trying to figure out how to constrain the fft interpretation to the appropriate bands. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;IE i may be sampling the band from 80-85MHz by mixing it down to 37.5-42.5 MHZ and sampling at 11 MHZ. How do I take the FFT and plot it showing the peaks appropriately?&lt;/p&gt;&#xA;" OwnerDisplayName="jarick" LastActivityDate="2013-03-18T16:56:28.467" Title="How to take the FFT of an undersampled signal" Tags="|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8250" PostTypeId="1" CreationDate="2013-03-17T16:13:35.540" Score="1" ViewCount="1147" Body="&lt;p&gt;I am a newbie in speech processing and experimenting to get a feel. I have extracted some speech segments using a window function and I want to find distance between a pair of segments. First, I took DFT of a segment and downsampled from the resulting frequencies (like 16 out of 256) and used them as features. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I saw cepstrum (cceps in matlab) and linear predictive coding (lpc in matlab) coefficients can be extracted from a speech segment. My question is; what is a good way to use these coefficients to find distance. Should I use the first k coefficients or downsample like in DFT? Any hints about their usage would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4150" LastActivityDate="2013-03-17T16:13:35.540" Title="DFT, cepstrum, LPC for feature extraction" Tags="|dft|speech-recognition|cepstral-analysis|lpc|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8251" PostTypeId="2" ParentId="8240" CreationDate="2013-03-17T16:32:49.790" Score="4" Body="&lt;p&gt;For this operation to work, you need to imagine that your image is reshaped as a vector.&#xA;Then, this vector is multiplied on its left by the convolution matrix in order to obtain the blurred image.&#xA;Note that the result is also a vector the same size as the input, i.e., an image of the same size.&lt;/p&gt;&#xA;&lt;p&gt;Each row of the convolution matrix corresponds to one pixel in the input image.&#xA;It contains the weight of the contributions of all the other pixels in the image to the blurred counterpart of the considered pixel.&lt;/p&gt;&#xA;&lt;p&gt;Let's take an example: box blur of size &lt;span class=&quot;math-container&quot;&gt;$3 \times 3$&lt;/span&gt; pixels on an image of size &lt;span class=&quot;math-container&quot;&gt;$6 \times 6$&lt;/span&gt; pixels.&#xA;The reshaped image is a column of 36 elects, while the blur matrix has size &lt;span class=&quot;math-container&quot;&gt;$36 \times 36$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let's initialize this matrix to 0 everywhere.&lt;/li&gt;&#xA;&lt;li&gt;Now, consider the pixel of coordinates &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt; in the input image (not on its border for simplicity). Its blurred counterpart is obtained by applying a weight of &lt;span class=&quot;math-container&quot;&gt;$1/9$&lt;/span&gt; to itself and each of its neighbours at the positions &lt;span class=&quot;math-container&quot;&gt;$(i-1,j-1); (i-1,j), (i-1,j+1),\ldots,(i+1,j+1)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In the column vector, the pixel &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt; has the position &lt;span class=&quot;math-container&quot;&gt;$6*i + j$&lt;/span&gt; (assuming lexicographic ordering). we report the weight &lt;span class=&quot;math-container&quot;&gt;$1/9$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$(6i+j)$&lt;/span&gt;-th line of the blur matrix.&lt;/li&gt;&#xA;&lt;li&gt;Do the same with all other pixels.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A visual illustration of a closely related process (convolution + subtraction) can be found on my personal blog &lt;a href=&quot;https://www.computersdontsee.net/post/2012-07-04-linearized-model-of-lbps/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Computers Don't See (Yet) - Linearized model of LBPs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="7092" LastEditDate="2021-02-20T14:24:44.757" LastActivityDate="2021-02-20T14:24:44.757" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8252" PostTypeId="1" CreationDate="2013-03-17T21:43:45.467" Score="5" ViewCount="7197" Body="&lt;p&gt;Can someone explain sharpen in a non-technical way. So, I don't mean that you need to multiply every pixel with 5 and subtract it with the pixel left, under, above and right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XXBUN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XXBUN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4152" LastEditorUserId="128" LastEditDate="2019-11-28T06:39:04.860" LastActivityDate="2019-11-28T06:39:04.860" Title="An Intuitive Way to Understand the Sharpen Convolution Filter in Image Processing" Tags="|image-processing|convolution|highpass-filter|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8253" PostTypeId="2" ParentId="8252" CreationDate="2013-03-17T22:30:04.887" Score="4" Body="&lt;p&gt;Consider this filter in 1D (for the sake of simplicity):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[-1 1 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This filter responds to pixel differences, i.e. edges (left pixel * (-1) + center pixel * 1 + right pixel * 0) which is (center pixel - left pixel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Response of this filter is positive on rising edges and negative on falling edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter is not symmetric and hence it will &quot;shift&quot; the image to the left. To make this filter responding to &quot;edge on the left&quot; and &quot;edge on the right&quot; equally, we have to compensate it by similar filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[-1 1 0] + [0 1 -1] = [-1 2 -1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now this can produce &quot;edge image&quot;. We will enhance the edges by adding them to the original image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[-1 2 -1] + [0 1 0] = [-1 3 -1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This kernel have sum of 1 and does not produce negative values. It is the desired sharpening kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt; Sharpening =  edge detection + original image.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-03-17T22:30:04.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8254" PostTypeId="1" AcceptedAnswerId="8255" CreationDate="2013-03-17T23:08:16.040" Score="1" ViewCount="143" Body="&lt;p&gt;To find the complex Fourier coefficients of this sequence, then The $k^{th}$&#xA;coeff. $c[k]$ is given by the DTFS formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;c[k]=%&#xA;%TCIMACRO{\dsum \limits_{n=0}^{N-1}}%&#xA;%BeginExpansion&#xA;{\displaystyle\sum\limits_{n=0}^{N-1}}&#xA;%EndExpansion&#xA;x[n]\exp(-in\frac{2\pi}{N}k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Lets forget about the $1/N$ scaling for now). My question is on the ordering&#xA;of the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, given $x=[1,1,0,0]$, hence $N=4$. Then applying the above gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c[0]=2,c[1]=1-i,c[2]=0,c[3]=1+i$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but Matlab's  &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/fft.html&quot; rel=&quot;nofollow&quot;&gt;fft&lt;/a&gt;  gives&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c=fft([1 1 0 0]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$c[0]=2,c[1]=1+i,c[2]=0,c[3]=1-i$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So matlab's $c[1]$ is the formulas $c[3]$ and Matlab's $c[3]$ is the formulas&#xA;$c[1]$. So the order seems to be swapped around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ofcourse they are still complex conjugate of each others. So both answers are correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is on the order of terms and why they come out this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thought on what that is, and why the result is not in the same order as&#xA;the formula gives? And if it is possible to make fft give the same order as the formula?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;add&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the problem. I used transpose to change row result from fft to column to make it easy to see. But I did not use the correct tranpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I transposed the result, which was a row, to a column to easier to see, the terms got switch around. Here is an example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z=[1 2+1i 3 4+1i];&#xA;z'&#xA;&#xA;   1.0000 + 0.0000i&#xA;   2.0000 - 1.0000i&#xA;   3.0000 + 0.0000i&#xA;   4.0000 - 1.0000i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I should have used non-conjugate tranpose:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z=[1 2+1i 3 4+1i];&#xA;z.'&#xA;&#xA;   1.0000 + 0.0000i&#xA;   2.0000 + 1.0000i&#xA;   3.0000 + 0.0000i&#xA;   4.0000 + 1.0000i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, terms are in correct order all along.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;User error. sorry.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2013-03-17T23:34:52.267" LastActivityDate="2013-03-17T23:34:52.267" Title="fft result order compared to direct implementation of DTFS using text book" Tags="|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8255" PostTypeId="2" ParentId="8254" CreationDate="2013-03-17T23:20:54.190" Score="1" Body="&lt;p&gt;Octave returns your same first result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave-3.2.3:1&amp;gt; fft([1 1 0 0])&#xA;ans =&#xA;&#xA;   2 + 0i   1 - 1i   0 + 0i   1 + 1i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While &lt;code&gt;4*ifft([1 1 0 0])&lt;/code&gt; results in what you claim is Matlab's result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please check you are not confusing direct and inverse FFT.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2013-03-17T23:20:54.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8256" PostTypeId="2" ParentId="8252" CreationDate="2013-03-17T23:46:31.810" Score="2" Body="&lt;p&gt;Another good explanation is that you enlarge the amount of energy in your image, and then &#xA;subtract only the low frequencies from your image, thus making the high frequencies more dominant:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 4 * [0 1 0] - [1 1 1]   = [-1 3 -1] &#xA;   Image     Low frequency&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is an old technique known as unsharp masking, known from the age of non-digital photography. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the filter is 2D, which makes it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;5* [0 0 0    [0 1 0&#xA;    0 1 0  -  1 1 1&#xA;    0 0 0]    0 1 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As @Libor  points out, this operation should not change the total energy. Thus, the sum of the kernel is 1.  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For those who are interested, I also explained it in a bit more mathematical way in &lt;a href=&quot;https://dsp.stackexchange.com/questions/2969/deconvolution-of-1d-signals/3560#3560&quot;&gt;here&lt;/a&gt;. Basically, I show there using inverse matrices that sharpening is the inverse operation of smoothing.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-03-17T23:46:31.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8257" PostTypeId="1" AcceptedAnswerId="8258" CreationDate="2013-03-18T02:02:57.747" Score="5" ViewCount="1131" Body="&lt;p&gt;I am trying to better understand discrete-time PLLs. I drew a picture of a simple feedback system here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UkGK8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to describe and understand the system at v(t) and y(t). I found a fairly &lt;a href=&quot;http://www.stanford.edu/group/cioffi/book/chap6.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;good reference&lt;/a&gt; with the following diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rSJ35.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am still having a hard time and I think if I could see a signal go through this system either visually or computationally, I would be able to understand it better. So for example in my diagram, what would $y(t)$ and $v(t)$ be if $x(t)=5u(t)$ and $h(t)=6{\delta(t)}$?&lt;/p&gt;&#xA;" OwnerUserId="3733" LastEditorUserId="3733" LastEditDate="2013-03-18T02:30:06.397" LastActivityDate="2015-08-26T18:03:57.257" Title="Phase Locked Loop Basics" Tags="|discrete-signals|phase|feedback|pll|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8258" PostTypeId="2" ParentId="8257" CreationDate="2013-03-18T04:04:13.147" Score="5" Body="&lt;p&gt;You're probably better off skipping the $5u(t)$ idea and going straight to a periodic input, probably a sinusoid.  A phase locked loop is for signals that have a phase to lock onto, whereas $u(t)$ doesn't have a phase.  The Stanford reference looks pretty good.  Start by comparing that to your feedback system:  Note that the phase detector is a multiplication, where you appear to have an addition.  Also notice that the VCO isn't actually putting out $\hat \theta$, but $\hat s(t) = \cos\left(\omega_{lo}t + \hat\theta(t)\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after the multiplication you end up with the sum of two new sinusoids, one at the sum of the frequencies of $\hat s(t)$ and $s(t)$, the other at their difference.  The loop filter is there to remove the higher frequency one, leaving just the difference, which will be $\sin\left(\theta(t) - \hat\theta(t)\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a few different situations.  First, the easy one - the input is running at exactly the same frequency as the local oscillator, so $s(t) = \cos(\omega_{lo}t)$.  Assume there is nothing on the input to the VCO to begin with, and so $\hat\theta(t) = 0$ too.  The output from the phase detector will be only the high frequency term, and that will get filtered out by the loop filter, leaving $e(t) = 0$.  The system is in equilibrium, everyone can go home and have a beer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now the frequency of the input signal increases a little.  $\theta(t)$ is now a linearly increasing value (if it were a constant, then the input signal would still have the same frequency, but just be delayed or advanced a bit).  Now the phase detector is also producing a low frequency term, $\sin(\theta(t))$ in addition to the high frequency one.  This is passed through the filter, and since the frequency only increased a little, $\theta(t)$ is small so $\sin(\theta(t)) \approx \theta(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that $e(t)$ is no longer zero, and so the phase of the VCO begins to increase; $\hat s(t)$ runs faster.  If it hasn't caught up to the frequency of $s(t)$, then the phase difference will continue to increase, and since that difference is being integrated by the VCO, the VCO frequency will increase faster.  Eventually the VCO will be running at the same frequency as $s(t)$.  However, note that it will be lagging in phase:  To run at the same frequency, $\hat\theta(t)$ needs to be increasing at the same rate as $\theta(t)$.  For $\hat\theta(t)$ to be increasing linearly, $e(t)$ needs to be a constant, and non-zero, which means $\theta(t) - \hat\theta(t)$ must be non-zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency of the input signal were to decrease, you would get a similar situation, except that now the VCO output would be leading the input signal rather than lagging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a real situation, the input signal frequency is usually changing all the time (otherwise you wouldn't need a PLL to track it), and all this is happening constantly.  Hopefully you can see from this description that if the input frequency changes too quickly then the system can be thrown off (remember the small angle approximation I used).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the principles for a discrete-time PLL are similar.  Sampling rates with respect to the input frequency will need to be considered, as usual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps, I'm not sure if you are completely familiar with continuous PLLs and just looking for the differences when you go discrete, or the whole thing is a little fuzzy for you.  Since you've got continuous-time looking variables in your feedback system diagram I've assumed the whole PLL game is of interest to you.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-18T04:04:13.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8259" PostTypeId="1" AcceptedAnswerId="8270" CreationDate="2013-03-18T08:55:02.013" Score="3" ViewCount="15605" Body="&lt;p&gt;I want some data to fit the corresponding Gaussian distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data is meant to be Gaussian already, but for some filtering reasons, they will not perfectly match the prescribed and expected Gaussian distribution. I therefore aim to reduce the existing scatter between data and desired distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, my data fit the Gaussian distribution as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AcPPf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bkdtu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approximation is already decent, but I really want to crunch the still tangible scatter between simulated data and expected distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I achieve this?&lt;/p&gt;&#xA;" OwnerUserId="3666" LastActivityDate="2015-01-30T11:02:02.093" Title="Fit data to Gaussian distribution" Tags="|matlab|gaussian|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8261" PostTypeId="2" ParentId="8249" CreationDate="2013-03-18T12:00:35.377" Score="2" Body="&lt;p&gt;If there is other frequency content in other Nyquist regions, you will see those alias into your digitized signal also; there's no free lunch here. If you wish to use bandpass sampling, then you need to first apply a bandpass anti-aliasing filter to suppress the unwanted content.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-03-18T12:00:35.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8262" PostTypeId="1" AcceptedAnswerId="8263" CreationDate="2013-03-18T12:12:01.650" Score="4" ViewCount="29205" Body="&lt;p&gt;I have a little problem with the subject Theory of signal. We were told to make amplitude and phase spectrum of cosinus in MATLAB, but we don't have results nor materials from our teachers, so we have to study from many different materials and you can imagine what this is like. So I'm a little confused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I did some graphs, that should be what I want, according to instructions, but I have never seen something like that, so I'm not sure, if that's right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bdbWU.jpg&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do these graphs make any sense to you? I used fast Fourier transform (fft(y) in MATLAB) on the signal and then plot the result of transform versus sample frequency and I thought it's possible to get phase of the signal by angle(fft(y)), so I plotted this on the last graph. I'm very unsure especially by the third graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to apologize for incorrect notions I might use, 'cause I'm not a native english speaker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="35" LastEditDate="2013-03-18T12:29:20.517" LastActivityDate="2022-04-14T11:22:49.593" Title="Amplitude and phase spectrum in MATLAB" Tags="|matlab|discrete-signals|frequency-spectrum|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8263" PostTypeId="2" ParentId="8262" CreationDate="2013-03-18T12:32:31.480" Score="4" Body="&lt;p&gt;This is the most simple FT that you should understand. The basic rule is: a sine of frequency f0 in time domain is a delta at f0 and -f0 in frequency. You can do this theoretically, as shown in &lt;a href=&quot;http://mathworld.wolfram.com/FourierTransformCosine.html&quot; rel=&quot;nofollow&quot;&gt;http://mathworld.wolfram.com/FourierTransformCosine.html&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those peaks in your graph are consistent with this. However, it isn't true that there is a peak in at 90Hz. The peaks should be at 10 Hz and -10 Hz. There are two possible approaches here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Use fftshift to correct this issue. This will take each frequency to its real place.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs=100; %sampling frequency&#xA;T=1; %signal length&#xA;N=T*Fs;     %number of samples&#xA;f=-Fs/2:Fs/N:Fs/2-Fs/N; %frequency vector&#xA;x=cos(2*pi*10*t);&#xA;Xf=fft(x);&#xA;Xf=fftshift(Xf);&#xA;plot(f,abs(Xf)) %magnitude&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;b) Assume the signal is real, so the spectrum is symmetric. It is true in this case, but it doesn't have to. You could just plot the first half of your fft, i.e. from 0 Hz to 50 Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, if you plot &lt;code&gt;plot(f,abs(Xf)/N)&lt;/code&gt;, you will find that the peaks have an amplitude of 0.5A (being A the amplitude of the sinusoid). The phase plot seems OK to me, especially after fftshift-ing it. &lt;/p&gt;&#xA;" OwnerUserId="1771" LastActivityDate="2013-03-18T12:32:31.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8265" PostTypeId="2" ParentId="8252" CreationDate="2013-03-18T14:51:14.400" Score="2" Body="&lt;p&gt;In a fully non-technical way, here is how the sharpen filter could be described:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;an image can be decomposed intuitively in two parts: a low resolution part (that can be ccalled low pass filtered or blurred), and a high resolution part (a.k.a. the details, that include fine details, object boundaries detected by Canny or Sobel operators, etc.)&lt;/li&gt;&#xA;&lt;li&gt;given an image, it is simple to build the low resolution part by blurring the image. Intuitively, blur conveys the idea of destroying (hiding) fine details&lt;/li&gt;&#xA;&lt;li&gt;given an image, its details can be retrieved by computing the difference between the input image and its blurred version&lt;/li&gt;&#xA;&lt;li&gt;finally, once one has an image and its details, the details can be added again to the image in order to emphasize them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The convolution kernel given in the link in your question does these operations at once and takes care of the proper normalization of the values so that th eoutput dynamic range matches with the input dynamic range. &lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-18T14:51:14.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8266" PostTypeId="2" ParentId="8249" CreationDate="2013-03-18T16:56:28.467" Score="0" Body="&lt;p&gt;Look at &lt;a href=&quot;http://www-stat.stanford.edu/~candes/papers/CompressiveSampling.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; by Emmanuel Candés. It describes exactly how to sample some signal at a low frequency (11MHz) when it's at a higher frequency (40MHz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A compressed sensing technique is called &quot;iterative hard thresholding.&quot; It's represented by $x^{n+1} = H_K(x^n + FFT(y-FFT^{-1}(x^n)) $ where $H_K$ is a nonlinear operator that takes the largest $k$ terms, $y$ your measurements in the time domain, and $x$ your reconstruction in the Fourier domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made &lt;a href=&quot;https://gist.github.com/scottsievert/5188726&quot; rel=&quot;nofollow&quot;&gt;a gist available&lt;/a&gt;. I was using the discrete wavelet transform, but you should easily be able to replace that with the FFT. This gist reads an image then reconstructs it, and does the associated setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may not be what you're looking for: you may not be able to do the computation on the fly like this. My bet is that you could do these computations when the signal is returned to the &quot;brain,&quot; but that will only work if it's not real-time (although it may work anyways).&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2013-03-18T16:56:28.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8267" PostTypeId="1" CreationDate="2013-03-18T05:27:20.440" Score="5" ViewCount="2824" Body="&lt;p&gt;I am working on lane detection system and I would like some suggestions from you as to how to detect lanes from a filtered image which I got after performing certain operations. Firstly, I should mention a few things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The lane detection would be in a real road environment unlike &lt;a href=&quot;https://stackoverflow.com/questions/4248670/lane-detection-in-an-artificial-environment&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;As of now, I am running it in real-time (O(n)) to be precise, which I would like to maintain.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The following image shows the original image and my filtered image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EmR74.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;As you can see, there are false positives which I want to remove and that is my main problem&lt;/strong&gt;. Now, these are the few approaches I have thought of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Check the intensity on the left and right hand side for desired areas. It should be high for desired area and low on both sides.&#xA;**Problem: I am finding it difficult to define 'high' and 'low' since the method has to be independent of time of the day.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One approach I thought was to check shapes but I can't think of any algorithm since those are not rectangles, those are essentially distorted parallelograms(?).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;One more, I have seen people generate lines on these type of images using hough, &lt;a href=&quot;https://stackoverflow.com/questions/4248670/lane-detection-in-an-artificial-environment&quot;&gt;this&lt;/a&gt; same question does that. If I run hough, I am not getting lines. Is the intensity of the image a problem or should I run Hough on binary mask image? I am currently doing this with MATLAB but I will be finally implementing with OpenCV to keep it real-time.&lt;/p&gt;&#xA;" OwnerUserId="11271" OwnerDisplayName="Parag" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2013-05-07T13:40:03.767" Title="Detect lanes from a filtered image" Tags="|matlab|opencv|image-processing|computer-vision|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8268" PostTypeId="2" ParentId="8267" CreationDate="2013-03-18T08:56:14.390" Score="6" Body="&lt;p&gt;Finding shapes / lines is a good idea. Threshold tweaking is almost certainly a bad idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hough transform typically expects your lines to be (1) in a binary image and (2) of one pixel width. Try to apply an edge detector (Matlab: &lt;code&gt;edge&lt;/code&gt;) on your filtered image in order to get the boundaries of your white regions as one-pixel lines. Then Hough transform should find something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also consider doing edge detection on your original image rather than your feature image. Then you can try to tweak the edge detector, rather than first running your &quot;certain operations&quot; and then detecting edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have some lines you will face the problem of finding the good ones. You could look at (i.e. google for) &quot;vanishing point detection&quot;, and read about &lt;a href=&quot;http://de.wikipedia.org/wiki/RANSAC&quot;&gt;RANSAC&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4160" OwnerDisplayName="DCS" LastActivityDate="2013-03-18T08:56:14.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8269" PostTypeId="2" ParentId="8267" CreationDate="2013-03-18T11:58:47.447" Score="0" Body="&lt;p&gt;This paper gives quite a lot of detail:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dl.acm.org/citation.cfm?id=1866593&quot; rel=&quot;nofollow&quot;&gt;http://dl.acm.org/citation.cfm?id=1866593&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have access to it anymore, but as I recall, it goes through an image processing pipeline from smoothing, edge detection, hough-transform and filtering.  All done using Matlab+System Generator.  There is a &quot;less-formal&quot; summary in Xilinx's journal here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.nxtbook.com/nxtbooks/xilinx/xcell66/index.php?startid=20&quot; rel=&quot;nofollow&quot;&gt;http://www.nxtbook.com/nxtbooks/xilinx/xcell66/index.php?startid=20&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(I'll not say any more, given what I work on... :)&lt;/p&gt;&#xA;" OwnerUserId="26" OwnerDisplayName="Martin Thompson" LastEditorUserId="26" LastEditDate="2013-05-07T13:40:03.767" LastActivityDate="2013-05-07T13:40:03.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8270" PostTypeId="2" ParentId="8259" CreationDate="2013-03-18T17:23:05.043" Score="4" Body="&lt;p&gt;The least-squares fitting is probably what your are looking for as this is maximum likelihood estimator for data points with Gaussian distribution around best fit curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is already a built-in function &lt;a href=&quot;http://www.mathworks.com/help/optim/ug/lsqcurvefit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;lsqcurvefit&lt;/a&gt; in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a tutorial article on both linear and non-linear least squares methods (Gauss-Newton, Levenberg-Marquardt) if you need some deeper understanding of the topic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.imagingshop.com/articles/least-squares&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linear and Nonlinear Least-Squares with Math.NET&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Please note you are asking how to use some actual piece of &lt;em&gt;software&lt;/em&gt; (i.e. MATLAB) while this site is more about principles and practices. You can find hints for MATLAB on other forum (e.g. &lt;a href=&quot;https://stackoverflow.com/questions/tagged/matlab&quot;&gt;StackOverflow&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2015-01-30T11:02:02.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8271" PostTypeId="1" CreationDate="2013-03-18T18:13:31.663" Score="0" ViewCount="807" Body="&lt;p&gt;This question is moved from Stack Overflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry about this noob question, because I never work with matlab and signal processing before. Here is what I want to do: I have a fixed length of byte array X, now I want to encode it to a sound file, I also want this process to be reversible, which means the sound can be converted back to X with no error. I searched online, and found the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = 16; &#xA;x = randint(5000,1,M); &#xA;y=modulate(modem.qammod(M),x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is that, is QAM the best way to do this? and how to use it? I will need to send the sound signal over the air, and I just need to transfer about 128 bit data each time. A little bit code example will be really appreciated, Thank you! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;update#1: I tried to output y by sound(y), but matlab does not allow me to do so, it says I can only output floating numbers. How can I solve this? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4161" LastActivityDate="2013-03-18T18:13:31.663" Title="How to encode a byte array to sound file and then convert back?" Tags="|matlab|digital-communications|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8272" PostTypeId="1" CreationDate="2013-03-18T18:23:58.330" Score="2" ViewCount="877" Body="&lt;p&gt;I am using Naudio open source library and I am trying to do some simple filtering. The problem is that I hear some &quot;clicks&quot;, not too loud. The library offers me the possibility to use at least two buffers, so the computing time doesn't introduce a delay between them.  Because in the most of the time I am dealing with a stereo signal, I have split it in two arrays and I compute each other independently. I would like to know if is there something special that I have to do with a filter when I used it on a buffer. I have first used a low pass biquad filter like the one below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       //generate coeff&#xA;       //sincerely, I don't know what's up with q&#xA;       //I have taken into consideration some values&#xA;       //to see if the noise disappears   &#xA;       double w0 = 2 * Math.PI * cutoffFrequency / _sampleRate;&#xA;       double cosw0 = Math.Cos(w0);&#xA;       double alpha = Math.Sin(w0) / (2 * q);&#xA;       _b0 = (1 - cosw0) / 2;&#xA;       _b1 = 1 - cosw0;&#xA;       _b2 = (1 - cosw0) / 2;&#xA;       _a0 = 1 + alpha;&#xA;       _a1 = -2 * cosw0;&#xA;       _a2 = 1 - alpha; &#xA;       for (int i = 2; i &amp;lt; length; i++)  &#xA;       {&#xA;            output[i] = (float)((_b0 / _a0) * input[i] + (_b1 / _a0) * input[i - 1] + (_b2 / _a0) * input[i - 2]- (_a1 / _a0) * output[i - 1] - (_a2 / _a0) * output[i - 2]);&#xA;       }&#xA;       output[1] = (float)(&#xA;                (_b0 / _a0) * input[1] + (_b1 / _a0) * input[0] + (_b2 / _a0) * input[0]&#xA;                - (_a1 / _a0) * output[0] - (_a2 / _a0) * output[0]);&#xA;        output[0] = (float)(&#xA;                (_b0 / _a0) * input[0] + (_b1 / _a0) * 0 + (_b2 / _a0) * 0&#xA;                - (_a1 / _a0) * 0 - (_a2 / _a0) * 0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought that  all my problems came from the first two samples (output 0:1), I've tried all combinations: output[-1]=0,output[-1]=output[0], but nothing worked. What values output[i-1], output[i-2] should have when &quot;i&quot; is 0 or 1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have encountered the same noise (clicks) when I used a LowPass Windowed-Sinc Filter, just like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;//calculate coeff&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        int i;&#xA;&#xA;        int m = length;&#xA;        double PI = Math.PI;&#xA;        length=101;&#xA;        for (i = 0; i &amp;lt; length; i++)&#xA;        {&#xA;            if (i - m / 2 == 0)&#xA;            {&#xA;                _h[i] = 2 * PI * _cutOffFrecv;&#xA;            }&#xA;            else&#xA;            { &#xA;                //!=0&#xA;                _h[i] = Math.Sin(2 * PI * _cutOffFrecv * (i - m / 2)) / (i - m / 2);&#xA;            }&#xA;            _h[i] = _h[i] * (0.54 - 0.46 * Math.Cos(2 * PI * i / m));&#xA;        }&#xA;        //normalize the low-pass filter kernel for unity gain at DC&#xA;        double s = 0;&#xA;        for (i = 0; i &amp;lt; m; i++)&#xA;        {&#xA;            s = s + _h[i];&#xA;        }&#xA;        for (i = 0; i &amp;lt; m; i++)&#xA;        {&#xA;            _h[i] = _h[i] / s;&#xA;        }&#xA;        //convolve the input &amp;amp; kernel&#xA;        //_kernelSize=101&#xA;        //most often length is 6615 or 6614 for each channel&#xA;        //in these examples I compute only one channel&#xA;        for (j = 0; j &amp;lt; length; j++)&#xA;        {&#xA;            output[j]=0;&#xA;            for (i = 0; i &amp;lt; _kernelSize; i++)&#xA;            {&#xA;                if (j &amp;gt;= i)&#xA;                {&#xA;                    output[j] =(float)(output[j]+ _h[i] * input[j - i]);&#xA;                }&#xA;            }&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem surely is not from splitting the signal, or from combining channels, because I have tested this without any filter and everything is ok. I have also tried to simulate some delays created by a processing algorithm (but without changing the signal) and nothing went wrong. I am very sure that the problem comes from filtering.&#xA;Everything  I wrote is used on a buffer.&lt;/p&gt;&#xA;" OwnerUserId="4159" LastActivityDate="2013-03-20T14:55:11.803" Title="Strange noises when filtering audio signal" Tags="|lowpass-filter|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8273" PostTypeId="2" ParentId="8272" CreationDate="2013-03-18T20:35:53.107" Score="1" Body="&lt;p&gt;The context in which you use these functions is not clear, but it seems to me that your problem is &quot;edge effects&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you are evaluating the convolution or the biquad, you need to access samples which are outside the current buffer. Your two implementations evaluate these samples as zero. This is incorrect. For example, for the biquad, everytime you process a block of audio, you need to store the last 2 values of the &lt;code&gt;input[]&lt;/code&gt; and &lt;code&gt;output[]&lt;/code&gt;; and reuse them in place of &lt;code&gt;input[-1]&lt;/code&gt;, &lt;code&gt;input[-2]&lt;/code&gt;, &lt;code&gt;output[-1]&lt;/code&gt;, &lt;code&gt;output[-2]&lt;/code&gt;. Even if the data you process comes in small chunks, you must process it as if it came in one single stream; so the state variables of your filters must not be reset to zero at the boundaries of each buffer.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-03-18T20:35:53.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8274" PostTypeId="1" AcceptedAnswerId="8276" CreationDate="2013-03-18T20:43:23.587" Score="0" ViewCount="185" Body="&lt;p&gt;I have a output signal $Y(t)= \sum_{n=-\infty}^{\infty} Z_n \delta (t-n\tau) h(t)$ and $Z_n$ is a random variable with equal probability to be $+-1$ and h(t) is $sinc(\frac t {\tau})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the Expected value of $Y(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E(Y(t)) = E[\sum_{n=-\infty}^{\infty} Z_n \delta (t-n\tau) h(t)]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=\sum_{n=-\infty}^{\infty}h(n\tau) E[Z_n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I calculated in other way&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\int_{-\infty}^\infty t Y(t) dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=\int_{-\infty}^\infty t \sum_{n=-\infty}^{\infty} Z_n \delta (t-n\tau) h(t) dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$= \int_{-\infty}^\infty  \sum_{n=-\infty}^{\infty} tZ_n \delta (t-n\tau) h(t) dt$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$= \int_{-\infty}^\infty  \sum_{n=-\infty}^{\infty} n\tau Z_n h(n\tau) dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=  \sum_{n=-\infty}^{\infty} [n\tau h(n\tau)\int_{-\infty}^\infty   Z_n  dt]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why I have two different result with same signal? Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="3420" LastActivityDate="2013-03-18T21:50:42.543" Title="Expected value of a Delta function times a function" Tags="|statistics|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8275" PostTypeId="2" ParentId="8274" CreationDate="2013-03-18T21:30:52.210" Score="3" Body="&lt;p&gt;If $h(t)$ is continuous at $a$, then $h(t)\delta(t-a) = h(a)\delta(t-a)$. Since the &#xA;$\operatorname{sinc}$ function is&#xA;continuous everywhere, &#xA;$$\begin{align}&#xA;Y(t) &amp;amp;= \sum_{n=-\infty}^{\infty} Z_n\delta(t-n\tau)h(t)\\&#xA;&amp;amp;= \sum_{n=-\infty}^{\infty} Z_n\delta(t-n\tau)h(n\tau)\\&#xA;&amp;amp;= \sum_{n=-\infty}^{\infty} Z_n\delta(t-n\tau)\operatorname{sinc}(n)\\&#xA;&amp;amp;= Z_0\delta(t)&#xA;\end{align}$$&#xA;since $\operatorname{sinc}(n) = \begin{cases}1,&amp;amp;n = 0,\\0,&amp;amp; n\neq 0.\end{cases}$&#xA;You (or your textbook's authors) probably meant to write something else.&#xA;You sure you are not missing a $\star$ indicating a convolution between&#xA;that $\delta(t-n\tau)$ and $h(t)$?&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-03-18T21:30:52.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8276" PostTypeId="2" ParentId="8274" CreationDate="2013-03-18T21:50:42.543" Score="1" Body="&lt;p&gt;Your second equation $E[Y(t)] = \int_{-\infty}^\infty tY(t)dt$ is wrong; that won't calculate the expected value of $Y(t)$.  The equation you are thinking of is $E[Y(t)] = \int_\Omega Y(t)P[Y(t)]$, where you would determine $P[Y(t)]$ by a joint probability of the $Z_n$'s.  That's why they don't match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, @Dilip-Sarwate has an answer showing that you can simplify this particular equation to a state where the answer becomes trivial (and is equal to the first answer you found).&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-18T21:50:42.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8277" PostTypeId="1" CreationDate="2013-03-18T21:59:08.287" Score="2" ViewCount="437" Body="&lt;p&gt;I want to estimate a channel based on LTE 3GPP EVA with given power delay profile (set of average power and delay of channel taps).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tau = [0, 30e-9, 150e-9, 310e-9,  370e-9,  710e-9, 1090e-9,  1730e-9, 2510e-9]; % relative delay (s)&#xA;pdb = [0,  -1.5,   -1.4,   -3.6,    -0.6,    -9.1,    -7.0,    -12.0,   -16.9]; % avg. power (dB)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the relative delays of channel taps are not multiples of my sampling time &lt;strong&gt;Ts&lt;/strong&gt;=3.3333e-07 s.&#xA;Here, I assumed the number of taps to be estimated is &lt;strong&gt;Ds/Ts&lt;/strong&gt;, where &lt;strong&gt;Ds&lt;/strong&gt; is the delay spread.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, please let me know if there is anything wrong in my approach.&#xA;Also, How should I measure my estimation error in this case? Should I compare my estimates with channel sampled at my sampling rate, or should I subtract the reconstructed frequency response of estimate and the original one?&#xA;Anyhow, due to the difference in the sampling time and delays, there is an intrinsic error in my estimation no matter how I measure it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance :)&lt;/p&gt;&#xA;" OwnerUserId="4163" LastActivityDate="2013-03-18T21:59:08.287" Title="How to model/estimate channel in discrete time with different sampling time?" Tags="|discrete-signals|continuous-signals|estimation|transform|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8279" PostTypeId="1" CreationDate="2013-03-19T05:39:54.927" Score="3" ViewCount="1086" Body="&lt;p&gt;The transfer function of a Low pass filter is H(w). From this I want to develop a high Pass filter. I read in &lt;a href=&quot;http://books.google.co.in/books/about/Digital_Signal_Processing_Principles_Alg.html?id=CTw6GoBh-vkC&quot; rel=&quot;nofollow&quot;&gt;DSP by Proakis, Sec 4.5&lt;/a&gt;, that the high pass filter can be obtained by translating H(w) by  PI radians. I did not get how it will form a High Pass Filter? I think tt should form a Bandpass   &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2013-03-19T18:12:47.397" Title="Frequency response of Low pass filter and High pass filter" Tags="|frequency-response|filtering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8280" PostTypeId="1" AcceptedAnswerId="10117" CreationDate="2013-03-19T08:19:20.047" Score="3" ViewCount="1496" Body="&lt;p&gt;Does anyone know how does the &lt;strong&gt;&quot;Songify&quot;&lt;/strong&gt; app algorithm work? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 2 inputs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;speech (or amateur singing), and&lt;/li&gt;&#xA;&lt;li&gt;underlying music.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Somehow the speech is altered and mixed into the music. Which DSP algorithms are needed to achieve this effect? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pitch-shifter? &lt;/li&gt;&#xA;&lt;li&gt;Time-stretcher? &lt;/li&gt;&#xA;&lt;li&gt;Fundamental (F0) frequency detection?&lt;/li&gt;&#xA;&lt;li&gt;Auto-tune? &lt;/li&gt;&#xA;&lt;li&gt;Else?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What would be the steps?&lt;/p&gt;&#xA;" OwnerUserId="1585" LastEditorUserId="1585" LastEditDate="2013-03-19T08:44:38.007" LastActivityDate="2013-08-28T19:19:56.947" Title="How does Songify work?" Tags="|audio|algorithms|dsp-core|voice|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8281" PostTypeId="2" ParentId="8279" CreationDate="2013-03-19T11:18:48.430" Score="5" Body="&lt;p&gt;In previous sections of the book, the fact that a discrete-time signal's spectrum is periodic may have been mentioned. It can be described formally as follows:&#xA;$$X(e^{j\omega})=\frac1{T} \sum_{k=-\infty}^{\infty}X_C\biggr(j\biggr(\frac{\omega}{T}-\frac{2\pi k}{T}\biggr)\biggr)$$&#xA;being $X_C(j\omega)$ the Fourier Transform of the continuous signal, and $T=1/f_s$ the sampling period. That expression is actually saying that the discrete-time spectrum can be computed from the continuous spectrum just by expanding its width $T$ times, and repeating this every $\frac{2\pi}{T}$. To keep things simple, we can normalize the frequency so that every signal's spectrum is periodic every $2\pi$, no matter how we sampled it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keeping this in mind, a low pass filter isn't just a &quot;step&quot; around $\omega=0$, but also around $\omega=2\pi,4\pi,...$ and, of course, their negative counterparts. I mean low frequencies repeat around $\omega=0, 2\pi,4\pi,...$, while high frequencies do around $\omega=-\pi,\pi,3\pi,...$&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xopkk.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Shifting its frequency response by $\pi$, we get $H(e^{j(\omega-\pi)})$, which would look like the following:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xE90M.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Remember that $\omega=\pi$ corresponds to your Nyquist frequency (= half the sampling frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Image credit: Oppenheim &amp;amp; Schafer, Discrete-time signal processing&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1771" LastEditorUserId="1771" LastEditDate="2013-03-19T18:12:47.397" LastActivityDate="2013-03-19T18:12:47.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8282" PostTypeId="1" CreationDate="2013-03-19T13:16:18.663" Score="4" ViewCount="10708" Body="&lt;p&gt;Consider this system:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; y[n]=y[n-1] + x[n]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It can be verified easily that this system has a finite impulse response (by putting x[n]= delta[n]  i.e impulse, and evaluating impulse response h[n]=y[n]). Yet for a unit step input U[n], this system is an unstable system.  On wikipedia it is mentioned that &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_signal_processing&quot; rel=&quot;nofollow&quot;&gt;FIR filters are always stable&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is , is this an FIR filter or an IIR filter?     &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2017-09-30T15:59:55.513" Title="Is this system an FIR filter or an IIR filter?" Tags="|filters|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8283" PostTypeId="1" CreationDate="2013-03-19T13:17:15.140" Score="2" ViewCount="185" Body="&lt;p&gt;Before today I had no idea there is any transform an such; I was only aware with DCT and wavelet transforms but today one of my teacher who is doing research on image processing project had told me that contourlet transform is way better than wavelet transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is better because wavelet transform extract frequencies in 3 directions (diagonal, horizontal, vertical) while contourlet transform is capable of extracting information in any direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are various books on wavelet transform but I couldn't be able to find a book that mainly focus on contourlet transform, is there any book you would recommend for contourlet transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: I'm not talking about research papers.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="18335" LastEditDate="2016-12-21T15:01:48.650" LastActivityDate="2016-12-21T17:08:22.497" Title="Contourlet transform for image compression" Tags="|transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8284" PostTypeId="2" ParentId="7856" CreationDate="2013-03-19T13:21:37.077" Score="1" Body="&lt;p&gt;&quot;Closing&quot; the volume can be done by adding missing surfaces. Project your entire mesh onto the XY plane, assigning the value +1 if the normal of a triangle points away from the XY plane and -1 if it points to the XY plane. If the volume is closed, each part of the projection is covered by an even number of triangles from the mesh; half with value +1 and half with value -1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's a simple single hole in the triangle mesh, there will be a simple single hole in the projection as well. Just trace the edges back. If there are multiple holes, there's generally no unique solution. (You could patch both holes or connect them by a tube).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there might be triangles missing orthogonal to the XY plane, you also need to repeat this for the XZ and YZ planes.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2013-03-19T13:21:37.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8285" PostTypeId="2" ParentId="8282" CreationDate="2013-03-19T13:25:08.490" Score="12" Body="&lt;p&gt;It is an IIR filter.  I think you misunderstand what is meant by &quot;finite impulse response&quot;.  It does not mean finite amplitude, it means finite time- i.e. that the impulse response eventually becomes zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impulse response of the filter is a step function, which is infinite in time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x[-1] = 0&#xA;x[ 0] = 1&#xA;x[ 1] = 0 ...&#xA;&#xA;y[-1] = 0&#xA;y[ 0] = 1&#xA;y[ 1] = 1&#xA;y[ 2] = 1 ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-19T13:25:08.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8286" PostTypeId="2" ParentId="8282" CreationDate="2013-03-19T13:26:08.123" Score="0" Body="&lt;p&gt;This is an IIR filter as the output is recursively related to input and previous output values (here: &lt;code&gt;y[n-1]&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $x[n] = \delta[n]$, then $h[n] = y[n -1] + \delta[n]$ which is infinite in time.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-03-19T13:26:08.123" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8287" PostTypeId="1" CreationDate="2013-03-19T14:47:35.643" Score="2" ViewCount="8643" Body="&lt;p&gt;I'm trying to use and understand SciPy's &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.deconvolve.html&quot; rel=&quot;nofollow&quot;&gt;deconvolve&lt;/a&gt; for a project I'm working on. I'm having some trouble understanding how to use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is to take two PMFs from discrete gaussian distributions and recover an unknown distribution using deconvolution. My understanding is that if I deconvolve the PMF from ~N(10, 1) and the PMF from ~N(30, 2), I should recover the PMF for the distribution ~N(20, 1). How can I do this in SciPy. It would be great, if I could see an example. Thanks in advance for the help.&lt;/p&gt;&#xA;" OwnerUserId="4166" LastActivityDate="2013-05-03T17:10:18.800" Title="Deconvolution in Python" Tags="|convolution|python|deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8290" PostTypeId="2" ParentId="8282" CreationDate="2013-03-19T19:08:58.770" Score="-2" Body="&lt;p&gt;It is obviously IIR because the output sequence y[...] occurs on both the left-hand and right-hand sides.&lt;/p&gt;&#xA;" OwnerUserId="709" LastActivityDate="2013-03-19T19:08:58.770" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8291" PostTypeId="1" CreationDate="2013-03-19T19:20:10.657" Score="2" ViewCount="964" Body="&lt;p&gt;I'm reading up on DSP implementations and &lt;a href=&quot;http://en.wikipedia.org/wiki/Q_%28number_format%29&quot; rel=&quot;nofollow&quot;&gt;Q number format&lt;/a&gt; for representing decimal and decimal fractional numbers. Why would you use the Q format and not a standard like &lt;a href=&quot;http://en.wikipedia.org/wiki/IEEE_floating_point&quot; rel=&quot;nofollow&quot;&gt;IEEE 754&lt;/a&gt;? When would you use one instead of the other? They both encode numbers into a sequence of bits, right?&lt;/p&gt;&#xA;" OwnerUserId="709" LastEditorUserId="709" LastEditDate="2013-03-20T17:47:10.943" LastActivityDate="2013-03-20T17:47:10.943" Title="Q number format vs IEEE 754 format?" Tags="|dsp-core|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8292" PostTypeId="1" CreationDate="2013-03-19T19:43:24.677" Score="2" ViewCount="289" Body="&lt;p&gt;&lt;a href=&quot;http://www.ing.unitn.it/~bertolaz/2-teaching/2012-2013/AA-2012-2013-DYSY/lucidi/Bode.pdf&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; you can see that the transfer function applied to a cosine input will give you a sinusoid and a transient term:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = \underbrace{(x(0) + x'(0))(2 e^{-t} - e^{-2t}) + \frac{2}{5} e^{-t}  - \frac{1}{2}e^{-t}}_{{\rm goes\ to\ } 0 {\rm\ as\ } t \rightarrow \infty }\ \ \  + \frac{1}{10} \cos(t) + \frac{3}{10} \sin(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't understand how this can be, aren't exponentials eigenfunctions of LTI systems? so how come it can give an extra (transient) term?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the same time it makes sense that it has a transient term from the CF of the function. How do I reconcile this?&lt;/p&gt;&#xA;" OwnerUserId="4167" LastEditorUserId="1496" LastEditDate="2013-03-20T03:31:14.757" LastActivityDate="2013-03-20T03:31:14.757" Title="If exponentials are eigenfunctions, where does the transient term come from?" Tags="|transfer-function|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8293" PostTypeId="2" ParentId="8292" CreationDate="2013-03-19T20:29:10.747" Score="4" Body="&lt;p&gt;There is a transient because the input isn't just a cosine, but a causal cosine; that is, the input isn't a cosine from $-\infty \rightarrow \infty$, only from 0 onwards.  If the input were actually just an infinite length cosine, then you would not get any transients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice that the notes you are working from don't show that the input is causal.  One reason I maintain that it actually is, is that otherwise you have an output that is tending to $\infty$ as $t \rightarrow -\infty$.  And also you don't get transients without a change to the system; the change in this case is that the system starts at time $t=0$.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-19T20:29:10.747" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8294" PostTypeId="2" ParentId="8291" CreationDate="2013-03-19T20:39:57.440" Score="8" Body="&lt;p&gt;Q format numbers are fixed-point, which means they can be manipulated by integer ALUs, rather than needing to use a floating-point unit.  In a DSP setting, this is useful for greater speed and lower power consumption, since fixed-point arithmetic is much simpler than floating-point.  On the other hand, the main advantage of using a floating-point representation is greater dynamic range.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-19T20:39:57.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8297" PostTypeId="1" CreationDate="2013-03-19T23:06:35.430" Score="1" ViewCount="1020" Body="&lt;p&gt;I'm starting to brush up on the Kalman Filtering I learned a couple decades ago. From what I remember, if you have a measurement vector &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;z=H x + v&#xA;$$&#xA; and the $n$ components of the measurement noise $v$ are uncorrelated with each other, then you can process the measurements sequentially in the KF equations. Is there a good reference somewhere (preferably online) that discusses why this is so? Intuitively it is understandable if each measurement $z$ depends on only one state element in $x$, but it isn't obvious if each measurement of $z$ depends on several elements of $x$.&lt;/p&gt;&#xA;" OwnerUserId="4171" LastEditorUserId="80" LastEditDate="2013-03-20T00:03:06.713" LastActivityDate="2013-06-09T23:27:33.673" Title="Sequential processing of uncorrelated measurements in Kalman Filter" Tags="|kalman-filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8298" PostTypeId="1" AcceptedAnswerId="8324" CreationDate="2013-03-20T01:43:43.683" Score="5" ViewCount="255" Body="&lt;p&gt;I have been posting all over SE looking for a good method of finding the maximum of a trigonometric polynomial. A trigonometric polynomial is the sum of a set of sinusoids,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_0 + \sum_{k = 1}^{N} a_k \cos(k \theta + \phi_k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and can also be written in the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sum_{k=-N}^{N} c_k \, e^{i k \theta} $$&#xA;where $c_k$ = $\bar{c}_{-k}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting $z = e^{i \theta}$ turns this into the typical form of a complex valued polynomial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I am currently using is to take the find the roots of the derivative of the polynomial, then evaluate the original polynomial at these locations to find the maximum. While quite fast with MATLABs roots command, it is not quite fast enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a method where I can trade accuracy for speed. Does anyone know of any other fast methods? This is a similar problem to estimating the crest factor of a signal. In my problem $N$ ranges from 3 to 15.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2013-03-22T17:02:48.897" LastActivityDate="2013-03-22T17:02:48.897" Title="Finding the maximum of a real valued trigonometric polynomial" Tags="|signal-analysis|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8299" PostTypeId="2" ParentId="8178" CreationDate="2013-03-20T05:49:13.673" Score="3" Body="&lt;p&gt;Ok, I finally found the reason for my confusion - thanks to &lt;a href=&quot;https://math.stackexchange.com/a/332586/66531&quot;&gt;this answer.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There were a number of reasons why I couldn't get my spatial NCC and frequency domain peak values to agree numerically. Some obvious, some subtle, all stupid. For the sake of completeness, here they are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I had missed an offset and scale factor that was introduced when&#xA;normalising my image data after importing the pixel values in&#xA;preparation for FHT. &lt;/li&gt;&#xA;&lt;li&gt;I was using a predicted maximum value for the&#xA;    peak, from my sub-pixel shift calculation instead of the actual&#xA;    peak.&lt;/li&gt;&#xA;&lt;li&gt;I had a low-pass filter in the pipeline, which - for&#xA;    performance - I was applying concurrently with the correlation&#xA;    operation. So my peak value was scaled by the filter.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Not being mathematically inclined, I was wrongly attempting to &quot;explain&quot; my problem by assuming that using FHT was somehow inherently different to using FFT. After &lt;a href=&quot;https://math.stackexchange.com/a/332586/66531&quot;&gt;being pointed in the right direction&lt;/a&gt; I found the above issues and finally got the results I was expecting.&lt;/p&gt;&#xA;" OwnerUserId="4117" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-03-20T07:44:09.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8300" PostTypeId="2" ParentId="8291" CreationDate="2013-03-20T07:24:01.917" Score="5" Body="&lt;p&gt;Addition and subtraction usimg floating point representations requires a normalization step at the end, which requires more instructions in a software FP implementation and more transistors and longer (thus probably having higher electrical capacitance) wires in a hardware implementation.  Thus, depending on the DSP implementation, using floating point may incur a higher transistor, time and/or energy cost over scaled integer formats that do not require a normalization step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, many modern processors have such fast floating point (or slow integer multiplies) that this difference may be impossible to measure, or even negative.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-03-20T07:24:01.917" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8301" PostTypeId="1" AcceptedAnswerId="8303" CreationDate="2013-03-20T07:28:59.540" Score="4" ViewCount="2965" Body="&lt;p&gt;I have been trying to implement the &lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_histogram_equalization#Contrast_Limited_AHE&quot; rel=&quot;nofollow&quot;&gt;CLAHE&lt;/a&gt; algorithm and came across &lt;a href=&quot;http://www.cs.utah.edu/~sujin/courses/reports/cs6640/project2/clahe.html&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; which states step by step procedure for the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the initial steps to perform HE of tiles in the image. But can't figure out how to perform the interpolation in the last step to remove the artificial boundaries between the tiles? Can someone explain this to me? It would be really helpful if someone explains it with a figure.&lt;/p&gt;&#xA;" OwnerUserId="1948" LastEditorUserId="35" LastEditDate="2013-03-20T07:35:22.317" LastActivityDate="2013-04-19T12:05:33.830" Title="Interpolation in Contrast Limited Adaptive Histogram Equalization" Tags="|image-processing|interpolation|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8302" PostTypeId="1" CreationDate="2013-03-20T07:45:29.857" Score="7" ViewCount="25606" Body="&lt;p&gt;Am reading Rick Lyons - Understanding DSP book about Sampling. I have few doubts related to this chapter.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;what is the difference between Bandpass Signal and a Passband Signal ?&lt;/li&gt;&#xA;&lt;li&gt;Can somebody give an example for a Bandpass system which produces Bandpass signal as output !&lt;/li&gt;&#xA;&lt;li&gt;When it comes to Baseband Sampling ( Low pass Sampling ) sampling theorem states that &quot; Fs &gt; twice the Highest frequency Component&quot; and for Bandpass Sampling, sampling theorem says Fs &gt; twice the Bandwidth of the signal. why two different sampling statements for the same signal of B hertz.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I understand in Bandpass sampling if I sample at the rate of twice the highest frequency component, then it'll be oversampling.&lt;/p&gt;&#xA;" OwnerUserId="3638" LastActivityDate="2017-09-02T16:54:07.667" Title="BandPass Signal Vs PassBand Signal" Tags="|sampling|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8303" PostTypeId="2" ParentId="8301" CreationDate="2013-03-20T11:56:46.443" Score="2" Body="&lt;p&gt;In step 8 of the reference you provide, you obtain 4 possible values for a given pixel (based on the values obtained from its 4 neighbours, which I assume are the usual North-East-South_West neighbours).&#xA;Then, to avoid introducing tile artifacts, you can use any sufficiently regular interpolation method to obtain the value in the center of these 4 pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity and computational issues, I suggest that you try &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_interpolation&quot; rel=&quot;nofollow&quot;&gt;bilinear interpolation&lt;/a&gt;. It will not introduce ringing or ripple artifacts and will not overflow the dynamic range of the input pixels.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-20T11:56:46.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8304" PostTypeId="2" ParentId="8302" CreationDate="2013-03-20T12:04:32.500" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;A PassBand is the Band that can be passed through a BandPass filter, or for that matter, any filter. In other words, the filter is a Bandpass, what signal passes through is a Passband.&lt;/li&gt;&#xA;&lt;li&gt;The classic is a high pass and low pass together. For instance, a capacitor, inductor, and resistor in series is an example of a bandpass filter. Digitally, you combine a high pass and a low pass filter together. &lt;/li&gt;&#xA;&lt;li&gt;Essentially, if you are limited to a small region, you can infer what frequency you are limited to. The classic example is Nf-&gt;2*Nf. The frequencies reported at 0 is 2*Nf, the frequency reported at Nf is actually NF, and continue the pattern for the rest. This only works when you are guaranteed to only have frequencies in the particular band.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="88" LastEditorUserId="88" LastEditDate="2013-03-20T18:19:07.113" LastActivityDate="2013-03-20T18:19:07.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8305" PostTypeId="2" ParentId="8302" CreationDate="2013-03-20T13:08:03.377" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;what is the difference between Bandpass Signal and a Passband Signal ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would normally refer to a band-limited signal. IE a signal which is limited in bandwidth to some degree.  All real-world signals are &quot;band-limited signals&quot;.  I have looked in the book for a reference to bandpass signals and can't see one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would call a passband signal &quot;a signal which falls within the passband of a filter&quot; and hence passes through it more-or-less unmodified.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can somebody give an example for a Bandpass system which produces Bandpass signal as output !&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would expect any bandpass system will produce a bandpass signal.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When it comes to Baseband Sampling ( Low pass Sampling ) sampling theorem states that &quot; Fs &gt; twice the Highest frequency Component&quot; and for Bandpass Sampling, sampling theorem says Fs &gt; twice the Bandwidth of the signal. why two different sampling statements for the same signal of B hertz.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The sampling theorem really says the latter ($Fs &amp;gt; 2*bandwidth$) - usually sampling is done at the baseband, so it's simpler to talk in terms of the highest frequency component, but it's actually the same thing when the lowest frequency component is at or very near DC.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2013-03-20T13:08:03.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8307" PostTypeId="2" ParentId="8272" CreationDate="2013-03-20T14:55:11.803" Score="0" Body="&lt;p&gt;Regarding the biquad filter, I've saved the previous values as you said, but nothing has changed. Here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public void DoFiltering(float[] input, float[] output, int length, bool rightChannel)&#xA;    {&#xA;&#xA;&#xA;        for (int i = 2; i &amp;lt; length; i++)&#xA;        {&#xA;            output[i] = (float)(&#xA;                (_b0 / _a0) * input[i] + (_b1 / _a0) * input[i - 1] + (_b2 / _a0) * input[i - 2]&#xA;                - (_a1 / _a0) * output[i - 1] - (_a2 / _a0) * output[i - 2]);&#xA;        }&#xA;&#xA;        if (rightChannel)&#xA;        {&#xA;            //output[-1] = _outR_Channel[0]&#xA;            //output[-2]= _outL_Channel[1]&#xA;            //the same thing for left channel&#xA;            //and for input&#xA;            output[1] = (float)(&#xA;                (_b0 / _a0) * input[1] + (_b1 / _a0) * input[0] + (_b2 / _a0) * _inR_Channel[0]&#xA;                - (_a1 / _a0) * output[0] - (_a2 / _a0) * _outR_Channel[0]);&#xA;            output[0] = (float)(&#xA;                (_b0 / _a0) * input[0] + (_b1 / _a0) * _inR_Channel[0] + (_b2 / _a0) * _inR_Channel[1]&#xA;                - (_a1 / _a0) * _outR_Channel[0] - (_a2 / _a0) * _outR_Channel[1]);&#xA;            //save the last two values in order to use them in the next step&#xA;            _outR_Channel[0] = output[length - 1];&#xA;            _outR_Channel[1] = output[length - 2];&#xA;            _inR_Channel[0] = input[length - 1];&#xA;            _inR_Channel[1] = input[length - 2];&#xA;            // (output[length-2],output[length-1]) &amp;lt;=&amp;gt; (output[-2],output[-1]) &amp;lt;=&amp;gt; (_output[1],_output[0])&#xA;        }&#xA;        else&#xA;        {&#xA;&#xA;            output[1] = (float)(&#xA;                (_b0 / _a0) * input[1] + (_b1 / _a0) * input[0] + (_b2 / _a0) * _inL_Channel[0]&#xA;                - (_a1 / _a0) * output[0] - (_a2 / _a0) * _outL_Channel[0]);&#xA;            output[0] = (float)(&#xA;                (_b0 / _a0) * input[0] + (_b1 / _a0) * _inL_Channel[0] + (_b2 / _a0) * _inL_Channel[1]&#xA;                - (_a1 / _a0) * _outL_Channel[0] - (_a2 / _a0) * _outL_Channel[1]);&#xA;&#xA;            _outL_Channel[0] = output[length - 1];&#xA;            _outL_Channel[1] = output[length - 2];&#xA;            _inL_Channel[0] = input[length - 1];&#xA;            _inL_Channel[1] = input[length - 2];&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've checked the indexes several times to see if I'am not making any mistake. I am sure that the split channel procedure is correct because I have tested it independently and without any filter. I would like to know how I should change the window-sinc filter. Supposing that I have an input of &quot;n&quot; elements, shifting it with &quot;k&quot; positions to the left and padding it with previous input values ( &quot;k&quot; values), would it be ok? What about the output? in this case, I will obtain n+k output array, but I need only n values. It would be ok if I would take samples from k to k+n-1 ? I'am also thinking to take into consideration the next values and the input should be: [k previous values] [current data - n length] [k next values]. And for the output I would have the same structure, but different values. That would give a headache, because I have to do another double buffering, or triple buffering technique. I would like to point out the fact that Naudio gives me the chance to change the buffer length. In fact, I can change a latency time which directly affects the buffer length. If I increase it, let's say 400 or 500 ms, the clicks are not so often.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea about how I should resolve this problem? I am quite sure that it should be a solution.&lt;/p&gt;&#xA;" OwnerUserId="4159" LastActivityDate="2013-03-20T14:55:11.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8308" PostTypeId="2" ParentId="8302" CreationDate="2013-03-20T15:39:56.927" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;what is the difference between Bandpass Signal and a Passband Signal ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are several kinds of filters, with names that describe their function:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Low-pass_filter&quot; rel=&quot;nofollow&quot;&gt;Low-pass&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/High-pass_filter&quot; rel=&quot;nofollow&quot;&gt;High-pass&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Band-pass_filter&quot; rel=&quot;nofollow&quot;&gt;Band-pass&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Band-stop_filter&quot; rel=&quot;nofollow&quot;&gt;Band-stop&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/All-pass_filter&quot; rel=&quot;nofollow&quot;&gt;All-pass&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For all of these filters, different frequencies are either passed or stopped by the filter, giving them their name.  You can then talk about the &lt;em&gt;regions&lt;/em&gt; that are passed or stopped using the words:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Passband&quot; rel=&quot;nofollow&quot;&gt;Passband&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Stopband&quot; rel=&quot;nofollow&quot;&gt;Stopband&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For instance:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;100 Hz is in the passband of a 200 Hz lowpass filter, while 300 Hz is in the stopband.&lt;/li&gt;&#xA;&lt;li&gt;100 Hz is in the stopband of a 200 Hz highpass filter.&lt;/li&gt;&#xA;&lt;li&gt;200 Hz is in the passband of a 100-300 Hz bandpass filter, while 50 Hz is in the stopband.&lt;/li&gt;&#xA;&lt;li&gt;All frequencies are in the passband of an all-pass filter.  All-pass filters have no stopband.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A &quot;passband signal&quot; is a signal that falls into the passband of a given filter.  What that means depends on the type of filter you're talking about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &quot;bandpass signal&quot; is a signal that has passed through a band-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can somebody give an example for a Bandpass system which produces Bandpass signal as output !&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All of them!&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-03-20T15:39:56.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8309" PostTypeId="1" CreationDate="2013-03-20T17:37:30.667" Score="6" ViewCount="346" Body="&lt;p&gt;I've got a real 2D image of propagating waves in both directions. How can I separate this image into one with the upward-propagating waves and one with the downward-propagating ones?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example has one wave in each direction. The x-scale shows time, the y-scale shows position, and intensity shows the amplitude of the wave at that position and time. The first image is my input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rxzc9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not very used to 2D signal processing, so the way I'm doing this is by just setting two quadrants of the FFT spectrum to zero and then reverse-transforming back. I got the other two images using the following algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = fftshift(fft2( x )); % x is the input (image above)&#xA;X( 1:floor(size(X,1)/2),    1:floor(size(X,2)/2)   ) = 0; % null 1st quadrant&#xA;X( ceil(size(X,1)/2)+1:end, ceil(size(X,2)/2)+1:end) = 0; % null 3rd quadrant&#xA;y = ifft2( ifftshift(X) );&#xA;y = real( y ); % y is the output (image above)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It feels like such a barbaric method would introduce all kinds of artefacts, so I'm looking for feedback from someone more experienced.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a better way to achieve this?&lt;/li&gt;&#xA;&lt;li&gt;How should I &quot;soften&quot; the edges of the 0/1 &quot;mask&quot; I'm multiplying the FFT with?&lt;/li&gt;&#xA;&lt;li&gt;The output is complex, so I'm discarding the imaginary part. Is that correct?&lt;/li&gt;&#xA;&lt;li&gt;I'm also a bit worried about the fact that the noise will not be white anymore, but I suppose there isn't much to do about that except for low-pass filtering the whole image.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="471" LastEditorUserId="471" LastEditDate="2013-03-23T08:19:05.650" LastActivityDate="2016-04-08T09:46:51.433" Title="How to separate the upwards-propagating from the downwards-propagating waves?" Tags="|matlab|filters|dft|gibbs-phenomenon|2d|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8310" PostTypeId="2" ParentId="8298" CreationDate="2013-03-20T19:51:35.183" Score="1" Body="&lt;p&gt;This function is periodic with 2*pi and it it's highest frequency component is N times the fundamental frequency. As such it can be sampled at a rate of 1/2*N without losing information. However, there is no guarantee that sampling will hit the maximum or that maximum sampled value is close to the analog maximum. The likelihood of this increases drastically by oversampling, e.g sample 4*N or 8*N values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So one thing to try would be to basically calculate the function values on a equidistant grid of, say 8*N, values, locate the maximum and then do a binary search around the maximum until the desired accuracy is reached. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again there is no guarantee that this will ALWAYS work, however you can try it with a few actual data sets and see how much over sampling is required and whether this is actually faster than the root search.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-03-20T19:51:35.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8312" PostTypeId="1" AcceptedAnswerId="8315" CreationDate="2013-03-21T04:02:24.090" Score="1" ViewCount="186" Body="&lt;p&gt;I need to approximate a function f, but I cannot do so with frequencies that exceed 1kHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best approximation I can get? Is taking the Fourier transform then zeroing any term above 1kHz the best approximation? Or can I fiddle with the lower order terms and get a better fit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a made up scenario, but I have to prove the same concept with Walsh transforms. I am fairly certain that the lower order terms form the best approximation from random twiddling and hill climbing searches, but I need proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the proof is something very similar to a least squares regression proof, but I can't get it. Has this problem been solved before? At least in the Fourier domain?&lt;/p&gt;&#xA;" OwnerUserId="4010" LastActivityDate="2013-04-04T03:59:11.900" Title="Approximation using a Fourier transform with low pass filter" Tags="|fourier-transform|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8313" PostTypeId="1" CreationDate="2013-03-21T04:17:15.633" Score="1" ViewCount="622" Body="&lt;p&gt;I know this is very basic question and i am new to this site. But can anybody help me with my question. How to convert a sound file to other data format say using some type of transform (FFT or DFT) with which i can manipulate the data of the sound. Lets say i get frequency values from the sound i should be able to manipulate or compare these values to another sound file which is again converted to the same format so i can compare these two. Are there any algorithms to do this.&lt;/p&gt;&#xA;" OwnerUserId="4183" LastActivityDate="2013-03-21T04:17:15.633" Title="How to convert a sound file to any other data format which can be manipulated" Tags="|fft|fourier-transform|frequency|sound|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8315" PostTypeId="2" ParentId="8312" CreationDate="2013-03-21T04:44:00.840" Score="2" Body="&lt;p&gt;Depends on what you mean by 'best'.  In terms of least squares, then yes, just knocking off the terms above 1kHz will give the closest approximation.  I guess one way to prove it would be:&#xA;$$&#xA;     x(t) = \int_{-\infty}^{\infty} X(f)\exp\left( j2\pi ft \right) dt\\&#xA;\hat x(t) = \int_{-1k}^{1k} X(f)        \exp\left( j2\pi ft \right) dt&#xA;$$&#xA;leaving a residual error of&#xA;$$&#xA;e(t) = \int_{|f| &amp;gt; 1k} X(f)\exp\left( j2\pi ft \right) dt .&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compare this to a 'fiddled' version, using $\tilde X(f)$ for the coefficients:&#xA;$$&#xA;\hat x(t) = \int_{-1k}^{1k} \tilde X(f) \exp\left( j2\pi ft \right) dt,&#xA;$$&#xA;which has a residual error of&#xA;$$&#xA;e(t) = \int_{|f| \le 1k} \left(X(f) - \tilde X(f)\right) \exp\left( j2\pi ft \right) dt + &#xA;\int_{|f| &amp;gt; 1k} X(f)\exp\left( j2\pi ft \right) dt ,&#xA;$$&#xA;which is greater than the error in the first instance unless $\tilde X(f) = X(f) \; \forall f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like that ought to do it, anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: It is possible to prove that a projection onto any orthogonal set of functions (doesn't need to be the Fourier set) gives the least squares fit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int f_k(t) f_m(t) dt = \cases{&#xA;  0, &amp;amp; $k \ne m$ \\&#xA;  1/\lambda_k, &amp;amp; $k = m$}&#xA;$$&#xA;for any orthogonal basis set $\{f_k\}$ (I'm not bothering with weighting functions), where&#xA;$$&#xA;\lambda_k = \frac{1}{\int f^2(t) dt}&#xA;$$&#xA;The projection of $g(t)$ onto the set is given by&#xA;$$&#xA;c_k = \lambda_k \int g(t)f_k(t) dt.&#xA;$$&#xA;The least squares fit of a set of orthogonal basis function is the minimisation of&#xA;$$&#xA;\int \left[g(t) - \sum_k d_k f_k(t)\right]^2 dt.&#xA;$$&#xA;Minimise by setting the derivative (wrt $d_m$) to zero:&#xA;$$&#xA;2\int\left(g(t) - \sum_kd_kf_k(t)\right)\left(-f_m(t)\right) dt = 0 \\&#xA;-\int f_m(t)g(t)dt + \int f_m(t)\sum_kd_kf_k(t)dt = 0 \\&#xA;-\int f_m(t)g(t)dt + \sum_kd_k \int f_m(t)f_k(t)dt = 0 \\&#xA;-\int f_m(t)g(t)dt + \sum_kd_k \frac{1}{\lambda_m} = 0&#xA;$$&#xA;which rearranges to give the same value as for $c_k$, thus the least squares fit is exactly the straightforward projection onto the orthogonal set.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastEditorUserId="1496" LastEditDate="2013-04-04T03:59:11.900" LastActivityDate="2013-04-04T03:59:11.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8316" PostTypeId="1" CreationDate="2013-03-21T06:17:46.580" Score="13" ViewCount="10823" Body="&lt;p&gt;I would like to know the basic differneces between Gaussian filter and Bilateral filter in digital image processing...&#xA;I just know that both are used to smooth out an image but I would really appreciate if somebody let me know what is the purpose and scenario of each of these filters.&#xA;Thanking in advance!&lt;/p&gt;&#xA;" OwnerUserId="4184" LastEditorUserId="128" LastEditDate="2018-08-23T08:45:03.777" LastActivityDate="2018-08-23T08:45:03.777" Title="The Difference Between Bilateral Filter and Gaussian Filter" Tags="|image-processing|filters|edge-preserving-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8317" PostTypeId="1" AcceptedAnswerId="8333" CreationDate="2013-03-21T07:22:55.700" Score="5" ViewCount="23155" Body="&lt;p&gt;Can I use the word &lt;em&gt;amplitude&lt;/em&gt; instead of &lt;em&gt;magnitude&lt;/em&gt; when I describe FFT bins? I dont see any similar word in my language.&lt;/p&gt;&#xA;" OwnerUserId="1708" LastEditorUserId="1606" LastEditDate="2013-03-21T10:05:27.303" LastActivityDate="2016-10-25T07:27:57.303" Title="FFT amplitude or magnitude" Tags="|fft|dft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8318" PostTypeId="1" CreationDate="2013-03-21T08:02:20.567" Score="4" ViewCount="1566" Body="&lt;p&gt;I have designed a low pass filter that smooths the output coming from an accelerometer attached to a vibrating machine. I designed this assuming cut-off frequency $f_{c1}$, and sampling frequency $f_s$. Now the issue is when I change the machine , I have to change the cut-off frequency and $f_s$ manually, else the output is not as smooth as expected. That is every machine is actually vibrating with slightly changed frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way the filter learns the appropriate Cut-off frequency $f_{c2}$ and $f_{s2}$, itself, without me to change the code  and perform filtering based on this $f_{c2}$ and $f_{s2}$?       &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I shall appreciate if some one can provide some web-links so I can explore this area further.  &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="80" LastEditDate="2013-04-20T14:12:32.210" LastActivityDate="2013-04-20T14:12:32.210" Title="Dynamically changing cut-off and sampling frequency of a digital filter" Tags="|filters|filter-design|sampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8319" PostTypeId="1" AcceptedAnswerId="8420" CreationDate="2013-03-21T08:15:39.247" Score="5" ViewCount="4275" Body="&lt;p&gt;My task is simple; I want to simulate analog low-pass filtering of an input signal, using Python. Note that the input signal is an array of values, not an analytical function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first question is if it simply is possible? If so, where is the line drawn between making a digital (FIR/IIR) filter and simulating an analog filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second question is how I, in python, can make two equivalent simulations, using convolution in one, and converting the input signal to frequency domain in the other. Convolution is used in the link below, and it would help me a lot to see how exactly the same thing would be done by instead using fft (even though I think it's using an FIR filter, not simulating an analog filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://glowingpython.blogspot.nl/2012/02/convolution-with-numpy.html&quot; rel=&quot;noreferrer&quot;&gt;http://glowingpython.blogspot.nl/2012/02/convolution-with-numpy.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance!&lt;/p&gt;&#xA;" OwnerUserId="4186" LastActivityDate="2023-09-04T14:33:13.673" Title="Simulating analog filter using convolution or converting with fft" Tags="|fft|filters|convolution|python|" AnswerCount="3" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="8320" PostTypeId="2" ParentId="8316" CreationDate="2013-03-21T09:05:43.977" Score="10" Body="&lt;p&gt;The Gaussian filter corresponds to isotropic diffusion (or the heat equation if you are familiar with it).&#xA;Its application to an image will blur it uniformly, whatever the image content, edges, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bilateral filter is almost like a Gaussian filter, except that the Gaussian is modulated by a function that computes the similarity between the central pixel (where the filter is applied) and a pixel in its neighborhood (that is used in blurring).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the two pixel values are very close, it multiplies the Gaussian coefficient by something close to 1, and hence it is equivalent to Gaussian filtering.&lt;/li&gt;&#xA;&lt;li&gt;If the pixel values are very different , it will multiply the Gaussian coefficient by a number close to 0, thus turning off the Gaussian filtering for this pixel.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Intuitively, this behaviour yields the following result: Gaussian filtering in uniform areas of the image, no filtering across object borders.&#xA;The bilateral filter will produce a more pleasant results, because it will avoid the introduction of blur between objects while still removing noise in uniform areas.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-21T09:05:43.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8321" PostTypeId="2" ParentId="6313" CreationDate="2013-03-21T09:45:11.760" Score="0" Body="&lt;p&gt;I don't really have a good answer for you, but here are 2 options that you could try:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in Computer Vision , this rescaling factor is usually handled by applying a Gaussian filter of width (in pixels) between 5 and 9. You can find the corresponding $\sigma$ of the Gaussian because the pixel width is classically equal to $3 \sigma$.&lt;/li&gt;&#xA;&lt;li&gt;if you are willing to do fine signal-sampling computations, then why not using Fourier transform ? Take the FFT of your image, keep only the subpart that corresponds to your target size, and invert the transform. This will apply an anti-aliasing filter on your spectrum. If there are too many artifacts (ripples, ringing) for you, then apply on your spectrum of Gaussian filter whose width corresponds to your target size .&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-21T09:45:11.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8323" PostTypeId="2" ParentId="8318" CreationDate="2013-03-21T12:32:28.603" Score="1" Body="&lt;p&gt;There are a few ways that you could do run-time dynamic filters.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;With a program like Matlab or Octave, but I'm guessing that they aren't available to your application.  There might be DSP libraries that have functions for generating filters though.&lt;/li&gt;&#xA;&lt;li&gt;Calculating from scratch a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;windowed&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow&quot;&gt;sinc function&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;You could create somewhat crude low-pass filters based off of your starting filter.  For instance, if you wanted to halve the cutoff frequency you would halve the filter sample time.  You would thus create a new filter that had all of the original filter's samples and a sample in between those samples.  You could create the extra samples through &lt;a href=&quot;http://en.wikipedia.org/wiki/Spline_%28mathematics%29&quot; rel=&quot;nofollow&quot;&gt;splines&lt;/a&gt;.  This same approach could be used to create any fractional cutoff frequency change.  A more complicated example would be if you wanted the cutoff frequency to be $\frac{9}{8}f_c$.  If we say that your original filter's samples are at time 0, 1, 2, ..., $n$, then the new filter's samples would be at time 0, $\frac{9}{8}$, $\frac{18}{8}$, ...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-21T12:32:28.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8324" PostTypeId="2" ParentId="8298" CreationDate="2013-03-21T13:11:11.527" Score="1" Body="&lt;p&gt;I would proceed as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Implement trigonometric polynomial at equidistant 'theta' nodes by means of an 'fft'.&#xA;   Sampling density on 'theta' axis can be increased by interleaving zeros between subsequent   elements of the input vector &#xA;    e.q c[-N] 0 0 0 c[-N+1] 0 0 0 ... c[N-1] 0 0 0 c[N]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Call 'max' function of Matlab to find maximal value and its index.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should compute reasonably fast and you can trade the speed for accuracy by increasing the number of zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to correct myself - sampling density can be increased by &lt;strong&gt;zero-padding&lt;/strong&gt; vector $c$ rather than interleaving zeros. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following Matlab script demonstrates the idea by computing approximated values of a trigonometric polynomial by means of FFT.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Create 'c' coefficients of a trigonometric polynomial approximation of a&#xA;% shifted sinc function&#xA;N = 6;&#xA;shift = -pi/N;&#xA;cc =  fftshift(ifft(conj(sinc(linspace(-2*pi+shift,2*pi+shift,2*N+1)))));&#xA;&#xA;% Evaluate trigonometric polynomial computing it directly according to definition&#xA;% Maximal value of this trigonometric polynomial is ~0.923&#xA;theta = [0:-0.01:-2*pi];&#xA;[NN,THETA]=meshgrid([-N:N], theta);&#xA;y = (exp(i.*NN.*THETA)*cc.').';&#xA;&#xA;% Plot the densely sampled trigonometric polynomial&#xA;figure;&#xA;plot(theta,real(y));&#xA;&#xA;% Sample trigonometric polynomial at equidistant nodes using FFT&#xA;% theta = [-2*pi*[0:N-1]./N]&#xA;fft_approx{1} = conj(fft(ifftshift(cc)));&#xA;&#xA;% Overlay the plot&#xA;hold on;&#xA;plot(-2*pi*[0:2*N]./(2*N+1),fft_approx{1},'.:r');&#xA;&#xA;% Find a maximum value &#xA;max_val{1} = max(real(fft_approx{1}));&#xA;&#xA;% Increase the sampling density 5 times using zero-padding&#xA;os_factor = 5;&#xA;zpad = zeros(1,numel(cc)*floor(os_factor/2));&#xA;cc_padded = [ zpad cc zpad];&#xA;&#xA;% Sample trigonometric polynomial at a denser grid using FFT&#xA;fft_approx{2} = conj(fft(ifftshift(cc_padded)));&#xA;&#xA;% Overlay the plot&#xA;hold on;&#xA;plot(-2*pi*[0:numel(fft_approx{2})-1]./numel(fft_approx{2}),real(fft_approx{2}),'.:g');&#xA;&#xA;% Find a maximum value &#xA;max_val{2} = max(real(fft_approx{2}));&#xA;&#xA;% Annotate the graph&#xA;legend('Original trigonometric polynomial',...&#xA;       sprintf('Sampled at %d points using fft',numel(fft_approx{1})),...&#xA;       sprintf('Sampled at %d points using fft',numel(fft_approx{2})));&#xA;&#xA;% Display approximated maximal values   &#xA;fprintf('-----------------------------------------------------\n');   &#xA;fprintf('%d-points fft approximation of the maximal value = %g\n',numel(fft_approx{1}),max_val{1});&#xA;fprintf('%d-points fft approximation of the maximal value = %g\n',numel(fft_approx{2}),max_val{2});&#xA;&#xA;fprintf('-----------------------------------------------------\n');&#xA;fprintf('True maximal value to 3 decimal places is 0.923\n');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4188" LastEditorUserId="4188" LastEditDate="2013-03-22T13:11:25.187" LastActivityDate="2013-03-22T13:11:25.187" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8325" PostTypeId="2" ParentId="8317" CreationDate="2013-03-21T13:53:34.193" Score="6" Body="&lt;p&gt;Even i had confusion differentiating between these two terms at the beginning ,&#xA;have a look at this explanation from one of the Award winning DSP books.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hLziY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Amplitudes,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P47CO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Magnitudes,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7Sg2R.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EhLYs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2013-03-21T14:07:01.963" LastActivityDate="2013-03-21T14:07:01.963" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8326" PostTypeId="1" CreationDate="2013-03-21T14:08:16.103" Score="1" ViewCount="425" Body="&lt;p&gt;i have 15 set of data which is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Scattering_parameters&quot; rel=&quot;nofollow&quot;&gt;s-parameter&lt;/a&gt;, consist of 2 column (1001x2) each set. The first column is frequency and the second column is magnitude in dB. I have transform the magnitude from (dB) into value and frequency into time. But i have no idea how to transform these 15 sets of data into an image by using Matlab. Can anybody help me?&lt;/p&gt;&#xA;" OwnerUserId="3833" LastEditorUserId="958" LastEditDate="2013-03-28T10:11:47.397" LastActivityDate="2018-02-20T11:21:48.517" Title="How to do image reconstruction from array data?" Tags="|image-processing|matlab|frequency-domain|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8327" PostTypeId="1" AcceptedAnswerId="8352" CreationDate="2013-03-21T16:16:44.820" Score="8" ViewCount="3613" Body="&lt;p&gt;I am currently working on a gesture recognition system (for an Android Application). I think that I have completed the Image processing stage, where I am able to extract the contour of the hand (I am wearing a glove to avoid background subtraction for now).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also getting the bounding ellipse/rectangle, the centroid as 'important' shape features of the hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that not a lot of literature indicate what the next stage is before the classification of the image through the hidden markov model. I am finding this 'Feature Extraction' stage very ambiguous. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am getting a list of angles of the contour (which is approximated so as to obtain a limited number of angles)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I am clueless as what to do next. When I search for literature as 'Shape classification using HMMs' I still find it hard to what should I do next.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a tool for HMM I plan to use JaHMM. But I don't know how to experiment with the tool at this stage since I do not know what will be the input to this classification stage!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wL10t.png&quot; alt=&quot;This shows the information I can obtain from my hand &quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have encountered a list of functions I found in some literature, such as Fast Fourier Descriptors, Curvature Descriptors, B Spline; yet I am clueless as to how to apply these functions to my current data (i.e. list of angles, e.g.: -63, 154, 3, 23, 54, ....)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your information. @Peter K.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the poses: I was going to go for a set of words in American Sign Language which are fingerspelled, e.g 'dog' -&gt; 'd' 'o' 'g' (3 states); but the moment I haven't decided what to go for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently reading some more papers to see what type of information I should extract, such as :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;centroid of hand&lt;/li&gt;&#xA;&lt;li&gt;angle of motion&lt;/li&gt;&#xA;&lt;li&gt;distance from a particular point to different points of the hand contour (etc..)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now I have encountered a paper which seems to show what I want to do, I'm not sure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://espace.library.uq.edu.au/eserv.php?pid=UQ:10700&amp;amp;dsID=n0273.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://espace.library.uq.edu.au/eserv.php?pid=UQ:10700&amp;amp;dsID=n0273.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently reading section 5 - Vector Quantization (I heard of this term before but do not actually know what it involves, and in figure 5 there seems to be a complex algorithm which, if I understood correcty, converts the set of values I achieve from the hand (just mentioned) into 1 digit which I can use as the Observation sequence to train an HMM for 1 particular sign. Do you think I'm moving on the right track? (I'm working on Android, (NDK), I found JaHMM as an HMM tool, and using OpenCV for image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Peter K. Thank you for your answer. Regarding the data generation I was planning to follow the steps of this paper, after I produce my personal dataset:&#xA;(section 4 and 5)&#xA;&lt;a href=&quot;http://www.i.ci.ritsumei.ac.jp/~shimada/papers/vi02-tanibata.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.i.ci.ritsumei.ac.jp/~shimada/papers/vi02-tanibata.pdf&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE 2: keeping in mind that a gesture is formed of {posture a, posture b, posture c}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now thinking that I must make use of some form of classification algorithm. That is, I currently have a set of feature vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Posture A:&#xA;[angle of ellipse surrounding it, height:width ratio]&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0.802985 33.909615&lt;/li&gt;&#xA;&lt;li&gt;0.722824    31.209663&lt;/li&gt;&#xA;&lt;li&gt;0.734535    30.206722&lt;/li&gt;&#xA;&lt;li&gt;0.68397 31.838253&lt;/li&gt;&#xA;&lt;li&gt;0.713706    34.29641&lt;/li&gt;&#xA;&lt;li&gt;0.688798    30.603661&lt;/li&gt;&#xA;&lt;li&gt;0.721395    34.880161&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Posture B:&#xA;[structured the same as posture A]&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0.474164 16.077467&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0.483104 14.526289&lt;/li&gt;&#xA;&lt;li&gt;0.478904 14.800572&lt;/li&gt;&#xA;&lt;li&gt;0.483134 14.523611&lt;/li&gt;&#xA;&lt;li&gt;0.480608 14.41159&lt;/li&gt;&#xA;&lt;li&gt;0.481552  15.563665&lt;/li&gt;&#xA;&lt;li&gt;0.497951  15.563585&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I would like that when I feed a feature vector I obtain a simple symbol, e.g. 'A', 'B', etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? I also migrated the question here: &lt;a href=&quot;https://stackoverflow.com/questions/15602963/vector-quantization-algorithms-used-to-provide-observation-sequences-for-hidden&quot;&gt;https://stackoverflow.com/questions/15602963/vector-quantization-algorithms-used-to-provide-observation-sequences-for-hidden&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4190" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-04-05T21:12:30.737" Title="Gesture recognition with Hidden Markov Models" Tags="|image-processing|fft|hmm|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8328" PostTypeId="1" AcceptedAnswerId="8331" CreationDate="2013-03-21T16:33:02.297" Score="4" ViewCount="78" Body="&lt;p&gt;Does the length of a Fourier Transform affect the ability to discern a small event in the data? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a tricky question to ask, let me clarify. I don't care about when the event happened and I don't care about the resolution of the event (it doesn't have to be some precise measurement) but I want to SEE the event. I realize short events/pulses will affect the results in a weird ways, but it doesn't matter, I just want to know some event/pulse happened. Will the length of an FFT affect how long this event/pulse needs to be before I become aware of it?&lt;/p&gt;&#xA;" OwnerUserId="4191" LastActivityDate="2013-03-21T20:46:43.637" Title="Transform Length and event duration" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8331" PostTypeId="2" ParentId="8328" CreationDate="2013-03-21T19:44:26.793" Score="3" Body="&lt;p&gt;I assume that &quot;small event&quot; means &quot;short (in time) event&quot;.  Fourier transforms are not good instruments for detecting short events.  You would be better off looking for such events in the time domain, or with a wavelet transform, perhaps, that is set up specifically to detect the events you are interested in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, if for some reason the events have to be detected in the frequency domain then I would keep the transforms short.  The reason for this is if the event is short with respect to the transform length it will look like a non-ideal impulse, which basically just creates a lot of high frequency content.  Because of the small amount of energy (due to the short time) it will probably be difficult to pick the signal out of the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the transform is short, on the other hand, then its energy is a significant part of the total transform energy.  That will make it possible to pick the signal out of the noise, or even enable detection by measuring the total energy.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-03-21T20:46:43.637" LastActivityDate="2013-03-21T20:46:43.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8332" PostTypeId="2" ParentId="8326" CreationDate="2013-03-21T19:52:56.960" Score="1" Body="&lt;p&gt;You will not be able to reconstruct the image without the phase information.  The frequency magnitudes alone are not sufficient.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-21T19:52:56.960" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8333" PostTypeId="2" ParentId="8317" CreationDate="2013-03-21T20:14:11.203" Score="6" Body="&lt;p&gt;I've always considered them to be somewhat related, but different:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Amplitude is the peak value of a sinusoid in the time domain&lt;/li&gt;&#xA;&lt;li&gt;Magnitude is the absolute value of any value, as opposed to its phase.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With these meanings, you would not use &lt;em&gt;amplitude&lt;/em&gt; for FFT bins, you would use &lt;em&gt;magnitude&lt;/em&gt;, since you are describing a single value.  The link would be that for a pure sinusoid, the signal amplitude would be the same as the magnitude of the appropriate FFT bin ('same as' depending on what scaling etc is used in the FFT implementation, but at the very least will be 'proportional to').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In saying all that, if you were to tell me about the amplitude of an FFT bin, I would know exactly what you were talking about.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-21T20:14:11.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8334" PostTypeId="1" CreationDate="2013-03-21T21:00:58.077" Score="0" ViewCount="491" Body="&lt;p&gt;I have a signal $X(t)=\sum_{n=-\infty}^{\infty} Z_n \delta(t-n\tau)$, $Z_n$ is a random variable with equal possibility of $\pm 1$ and I know the power spectrum of this signal is $\frac {1}{\tau}$ from the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have try to calculate the power spectrum by the auto-correlation and then calulated by its Fourier transform. As following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;R_X (t+\tau, t) &amp;amp;=E\left[X(t+\tau) X(t)\right]\\&#xA;&amp;amp;=E\left[\sum_{n=-\infty}^{\infty}\sum_{m=-\infty}^{\infty} Z_n Z_m \delta(t+\tau-n \tau)\delta(t-m\tau)\right]\\&#xA;&amp;amp;=\sum_{n=-\infty}^{\infty}\sum_{m=-\infty}^{\infty} \delta(t+\tau-n \tau)\delta(t-m\tau)\\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I have no idea how to calulate its Fourier transfrom to get the solution as simple as $\frac {1}{\tau}$. I don't know which part is gone wrong, appreciate any help.&lt;/p&gt;&#xA;" OwnerUserId="3420" LastEditorUserId="1629" LastEditDate="2016-05-18T11:07:47.890" LastActivityDate="2016-05-18T11:07:47.890" Title="Random signal power spectrum" Tags="|power-spectral-density|random|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8335" PostTypeId="2" ParentId="8334" CreationDate="2013-03-21T22:04:20.837" Score="1" Body="&lt;p&gt;You have to simplify your expression in order to obtain a Dirac Comb (a.k.a. impulse train).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_X(t+\tau,t)=\sum_{n=-\infty}^{\infty}\sum_{m=-\infty}^{\infty} \delta(t+\tau-n \tau)\delta(t-m\tau) = \sum_{n=-\infty}^{\infty}\sum_{m=-\infty}^{\infty} \delta(t-(n+1)\tau)\delta(t-m\tau)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both $\sum_{m=-\infty}^{\infty} \delta(t-m\tau)$ and $\sum_{n=-\infty}^{\infty} \delta(t-(n+1)\tau)$ are actually the same signal: a Dirac Comb with $\tau$ period. The difference would be the that the ''n'' signal would be &lt;a href=&quot;http://cnx.org/content/m10125/latest/&quot; rel=&quot;nofollow&quot;&gt;time shifted&lt;/a&gt; by n+1, while the ''m'' signal is shifted by m. As they are defined in $(-\infty,\infty)$, they are defined in exactly the same instants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying delta's well known property:&#xA;$$\delta(t-t_0)x(t)=x(t_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can obtain that, as we intuitively know because both signals are the same, &#xA;$$R_X(t+\tau,t)=\sum_{m=-\infty}^{\infty} \delta(t-m\tau)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here, we just have to obtain the Fourier Transform of the Dirac Comb, which can be easily found, e.g. in &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirac_comb#Fourier_series&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;, obtaining that all the coefficients are $\frac{1}{\tau}$.&lt;/p&gt;&#xA;" OwnerUserId="1771" LastEditorUserId="1771" LastEditDate="2013-03-21T23:33:09.157" LastActivityDate="2013-03-21T23:33:09.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8336" PostTypeId="1" CreationDate="2013-03-22T01:48:22.957" Score="2" ViewCount="3093" Body="&lt;p&gt;I am attempting to implement observer based state feedback in C and can't figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is pseudocode of the algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Initialize Stuff&#xA;&#xA;loop:&#xA;&#xA;//read process variable                                                                                 &#xA;y = read(ch1)  &#xA;&#xA;//compute control variable                                                                      &#xA;u = -K * xhat &#xA;&#xA;//set process input                                                                             &#xA;write(u) &#xA;&#xA;//update state estimate                                                                                  &#xA;xhat = xhat + Ts * (A*xhat + B*u + L*(y-C*xhat))&#xA;&#xA;// repeat loop&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;xhat is the estimated state                                                                            &lt;/li&gt;&#xA;&lt;li&gt;K is the feedback gain                                               &lt;/li&gt;&#xA;&lt;li&gt;L is the observer gain                                               &lt;/li&gt;&#xA;&lt;li&gt;y is the system output                                               &lt;/li&gt;&#xA;&lt;li&gt;u is the system input                                                &lt;/li&gt;&#xA;&lt;li&gt;Ts is the sampling period                                            &lt;/li&gt;&#xA;&lt;li&gt;A, B, &amp;amp; C are the state space matrices&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this how observer feedback is supposed to be implemented?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the actual code I have for the loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Get Process Output from Sensors:&#xA;y[0] = sensor1();&#xA;y[1] = sensor2();&#xA;&#xA;// Compute Control Variable:&#xA;u = 0;  &#xA;for (i=0; i&amp;lt;4; i++)         &#xA;    u += K[i]*xhat[i];&#xA;&#xA;// Set Process Input:&#xA;write_to_DAC(u);&#xA;&#xA;// Calculate: A*xhat + B*u&#xA;for (i=0; i&amp;lt;4; i++) {&#xA;    Ax_Bu[i] = 0;&#xA;    for (j=0; j&amp;lt;4; j++)&#xA;        Ax_Bu[i] += A[i*4+j]*xhat[j];    &#xA;    Ax_Bu[i] += B[i]*u; &#xA;}&#xA;&#xA;// Calculate: y-y_hat&#xA;for (i=0; i&amp;lt;2; i++) {&#xA;    yhat[i]   = 0;&#xA;    y_yhat[i] = 0;  &#xA;    for (j=0; j&amp;lt;4; j++) {&#xA;        yhat[i] +=  C[i*4+j]*xhat[j]; // Calculate yhat = C*xhat&#xA;        y_yhat[i] = y[i]-yhat[i];     // Calculate the 'Innovation'&#xA;    }             &#xA;}&#xA;&#xA;// Calculate: L*(y-y_hat)&#xA;for (i=0; i&amp;lt;4; i++) {&#xA;    L_y_yhat[i] = 0;&#xA;    for (j=0; j&amp;lt;2; j++) &#xA;        L_y_yhat[i] += L[i*2+j]*y_yhat[j];    &#xA;}   &#xA;&#xA;// Update State Estimate:&#xA;for (i=0; i&amp;lt;4; i++) &#xA;    xhat[i] += Ts*(Ax_Bu[i] + L_y_yhat[i]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3608" LastEditorUserId="3608" LastEditDate="2013-03-28T18:43:03.050" LastActivityDate="2013-08-25T20:16:48.093" Title="State Space Observer Control" Tags="|control-systems|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8337" PostTypeId="2" ParentId="8334" CreationDate="2013-03-22T01:50:23.093" Score="1" Body="&lt;p&gt;I'm not quite finished, so this answer is highly likely to change, but I'll show what I've got for now:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a start, you have used the same variable $\tau$ for both autocorrelation lag and as a parameter of the original function - can't do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R_X(\theta) = E\left[\sum_n Z_n\delta (t - n\tau + \theta) \sum_m Z_m\delta (t - m\tau)\right]\\&#xA;= E\left[\sum_n \sum_m Z_n Z_m \delta (t - n\tau + \theta) \delta (t - m\tau)\right] \\&#xA;= \sum_n \sum_m E\left[Z_n Z_m \delta (t - n\tau + \theta) \delta (t - m\tau)\right] \\&#xA;= \sum_n \sum_m E\left[Z_n Z_m\right] E\left[\delta (t - n\tau + \theta) \delta (t - m\tau)\right]&#xA;$$&#xA;I can split the expectation like that because the two terms are independent - the delta terms aren't affected by what value is taken by $Z$.  Now note that the expected value of $Z_nZ_m$ is 1 if $n=m$, and 0 otherwise, (also known as a Kronecker delta), so&#xA;$$&#xA;R_X(\theta) = \sum_n E\left[\delta (t - n\tau + \theta)\delta(t-n\tau)\right] \\&#xA;= &#xA;\begin{cases}&#xA;\sum_n \int_{-\infty}^{\infty} \delta (t - n\tau) \delta (t - n\tau) dt, &amp;amp;\theta = 0 \\&#xA;0, &amp;amp;\rm\ otherwise&#xA;\end{cases}&#xA;$$&#xA;which is looking like a delta too, which is good.  I say good because the answer you are shooting for is $S_X(f) = \frac{1}{\tau}$, which is constant with frequency.  A constant in the frequency domain is a delta in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I've struck now is that I'm not sure what to do with two deltas under an integral.  I can treat it like a normal sifting situation, to get&#xA;$$&#xA;R_X(0) = \sum_n \delta (n\tau - n\tau) \\&#xA;= \sum_n \delta(0)&#xA;$$&#xA;but I don't know if that's correct, nor do I know how to get the $\tau$ term involved to get to the final answer... any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-22T01:50:23.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8338" PostTypeId="1" CreationDate="2013-03-22T06:10:00.173" Score="9" ViewCount="637" Body="&lt;p&gt;I'm trying to understand the maths behind this &lt;a href=&quot;http://dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization&quot; rel=&quot;noreferrer&quot;&gt;Fast fixed-point $\tt atan2$ calculation with self-normalization&lt;/a&gt;. In particular, equation $(2)$ for &lt;code&gt;theta1&lt;/code&gt; appears to provide a first-degree expansion of some series. Similarly, equation $(2a)$ under &quot;QUICK NOTE&quot; seems to expand this series. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the series that's being expanded? &lt;/li&gt;&#xA;&lt;li&gt;How &lt;em&gt;exactly&lt;/em&gt; is equation $(2)$ derived?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3780" LastEditorUserId="1629" LastEditDate="2016-05-14T13:33:50.640" LastActivityDate="2022-11-06T20:03:30.127" Title="Derivation of fixed-point $\tt atan2$ with self-normalization" Tags="|fixed-point|math|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8339" PostTypeId="1" AcceptedAnswerId="8341" CreationDate="2013-03-22T10:37:12.450" Score="5" ViewCount="13245" Body="&lt;p&gt;I have 2 arrays of 800000 input and output data samples. The system is a kind of oven that works from 0 to 10 volts. The sample time is 0.001s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to identify the model of this system, but first of all, given that the data are clearly dirty, I would like to filter the noise.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I do it with the System Identification Toolbox of MATLAB?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Moreover, how can I estimate the cutoff frequency to remove the noise?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As suggested, here below are the sampled data plot. As you can see the voltage inputs looks good, but the temperature outputs are affect of noise. I would like to remove it, in order have the output more &quot;smooth&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pWyR8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4197" LastEditorUserId="1629" LastEditDate="2016-05-17T10:21:49.857" LastActivityDate="2016-05-17T10:21:49.857" Title="How to filter data to remove noise in MATLAB?" Tags="|matlab|system-identification|" AnswerCount="2" CommentCount="8" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8340" PostTypeId="1" CreationDate="2013-03-22T14:18:24.960" Score="2" ViewCount="84" Body="&lt;p&gt;I would like to emulate a signal with bandwidth (like BPSK) for some testing, but the two signal generators I have access to do not have any BPSK options installed.  If I know the frequency (2462MHz) and the bandwidth (16MHz) I want, is there a way to mock this up easily with two signal generators?  I feel like this isn't a hard problem, but I am drawing a blank.  &lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2013-03-22T14:18:24.960" Title="Varying signal bandwidth with two signal generators" Tags="|frequency|bandwidth|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8341" PostTypeId="2" ParentId="8339" CreationDate="2013-03-22T15:23:47.457" Score="2" Body="&lt;p&gt;There are two sources of errors that cause the temperature reading to look different than the voltage reading: sensor error and temperature error.  You want to get rid of the sensor error and keep the temperature error.  I would surmise that the high-frequency spikes are sensor error, and everything else is temperature error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would do it like this- plot the power of the voltage input in the frequency domain (e.g. &lt;code&gt;plot(20*log10(abs(fft(voltInput))))&lt;/code&gt; in MATLAB).  It will have power across the entire frequency spectrum, but should be concentrated primarily in the lower frequencies.  Figure out  a cutoff point that will preserve most of your &quot;signal&quot; (voltage input) but should also get rid of most of your noise.  I'm guessing that the oven acts like a low-pass filter (takes time for it to change temperature), so this shouldn't affect the true temperature reading much.  You could verify this by doing a similar plot of the temperature reading.  I bet the high-frequency signal content is quite attenuated.  Setting your cutoff point to somewhere in that attenuated region would be a good choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also adjust your cutoff frequency and empirically see how that affects the results.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="1629" LastEditDate="2016-05-17T10:18:18.023" LastActivityDate="2016-05-17T10:18:18.023" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8342" PostTypeId="1" AcceptedAnswerId="8343" CreationDate="2013-03-22T14:25:25.590" Score="6" ViewCount="4421" Body="&lt;p&gt;I am trying to record a sound two times and compare the two recordings. I am playing exactly the same sound both times (for example, play a small .wav file twice and record it each time), so I hoped that my attempt would not rise to the complexity of Speech Recognition...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried computing the DFT (using FFT) and comparing the two power spectrums of the signals (more precisely, comparing their MSE - Mean Squared Error), but the results were discouraging (sometimes for recordings of the same sound the error was greater than for different sounds)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I found out about the MFCCs and computed them for each signal. That leaves me with 12 coefficients for each frame I devided my signal into (details below). How should I combine these groups of 12 coefficients to get some value(s) that describe the whole signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Appending them and extracting the MSE for the two arrays did not return encouraging results either...)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Below are some details about the way I computed the MFCCs and values I chose for computing it. Maybe it's here that I'm doing something wrong:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(sample rate = 22000 Hz)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Pre-emphasis.&lt;/li&gt;&#xA;&lt;li&gt;Framing with frame size = 512, frame overlap = 200. (because &quot;each frame should be ~20-30ms long&quot; and 512 / 22000 = 0,023 seconds = 23 ms. As &quot;the overlap should be of ~10ms and 200 / 22000 = 0,009s = 9ms)&lt;/li&gt;&#xA;&lt;li&gt;Apply Hamming window to each 512-size frame.&lt;/li&gt;&#xA;&lt;li&gt;Apply FFT to each windowed 512-size frame =&gt; 512 magnitudes for my signal, from witch I use only the first 256. Domain: Hz from 0 to 22000 (to 11000, respectively)&lt;/li&gt;&#xA;&lt;li&gt;Compute the Mel Filter Bank: (min frequency = 300 Hz, max frequency = 11000 Hz) &#xA;&lt;ul&gt;&#xA;&lt;li&gt;Compute mels from min and max frequences and then compute 26 equally distanced values between these two mel values. &lt;/li&gt;&#xA;&lt;li&gt;Convert them back to Hz =&gt; array of 28 frequency filters. &lt;/li&gt;&#xA;&lt;li&gt;Compute a filterbank (filter triangle) for each three consecutive values =&gt; 28 - 2 = 26 filterbanks. &lt;/li&gt;&#xA;&lt;li&gt;Pass the whole power spectrum (256 magnitudes) from step 4 through each triangular filter to get a &quot;filterbank energy&quot; for each filter =&gt; 26-sized array of energies.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply log: ln(each energy) (they are still frequency-domain values)&lt;/li&gt;&#xA;&lt;li&gt;Apply DCT to the logged energies =&gt; 26-sized array of (time-domain?) values.&lt;/li&gt;&#xA;&lt;li&gt;Take only the first 12 =&gt; 12 MFCCs for &lt;em&gt;each&lt;/em&gt; 215-sized frame of my signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4200" OwnerDisplayName="Ioanna" LastEditorUserId="4200" LastEditDate="2013-03-23T10:19:12.827" LastActivityDate="2013-03-23T10:19:12.827" Title="How to stitch together MFCCs from multiple frames?" Tags="|audio|mfcc|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8343" PostTypeId="2" ParentId="8342" CreationDate="2013-03-22T20:20:11.550" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How should I combine these groups of 12 coefficients to get some&#xA;  value(s) that describe the whole signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't think &quot;flattening&quot; the sequence of $215 \times 12$ coefficients into a $1 \times N$ vector, and then computing the distance between these vectors to compare two sounds is a good idea. This approach collapses the temporal information - the way a sound evolves in time. For example, let us say that you decide to use the standard deviation and mean of each coefficient to &quot;summarize&quot; the sequence of MFCC vectors (this is a technique used in some applications). If you use this approach, both a sound and the same sound played backwards will yield exactly the same feature vector! This might work for simple tasks like recognizing different music instruments, but as soon as the temporal information needs to be preserved (distinguishing &quot;halo&quot; and &quot;hola&quot;, or a drum instrument playing &quot;boom boom tchik&quot; vs &quot;boom tchik boom&quot;), thinking in terms of vectors rather than sequences no longer works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might not be the answer you expect, but I suggest you to stop reasoning in terms of vector comparison, and rather think of a way of comparing the sequences of MFCC frames themselves. Your approach - which is akin to computing the raw pairwise distance between sequence of vectors - is not robust to difference in timing between the two sequences. The solution is to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_time_warping&quot; rel=&quot;noreferrer&quot;&gt;Dynamic Time Warping&lt;/a&gt;. It attempts to optimally align the two sequences in time (so that comparing &quot;hoooolaa   &quot; with &quot;   holaaa&quot; yields the same score as comparing &quot;hola&quot; and &quot;hola&quot;). This technique is good enough for basic voice command recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to model each sound by a HMM with a few states; and to use the distance between models as a similarity metric. This can be more computationally efficient, and put you in control of how strict you want to respect temporal information (by increasing the number of states).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-03-22T20:28:06.340" LastActivityDate="2013-03-22T20:28:06.340" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8344" PostTypeId="1" AcceptedAnswerId="8398" CreationDate="2013-03-23T00:56:10.890" Score="5" ViewCount="2300" Body="&lt;p&gt;I read a paper about directional filter bank (&lt;a href=&quot;https://ieeexplore.ieee.org/document/1344034&quot; rel=&quot;nofollow noreferrer&quot;&gt;Improved structures of maximally decimated directional filter Banks for spatial image analysis&lt;/a&gt;) in image processing and I don't understand clearly about the process. It says they use '2-band structure' like this image:&lt;img src=&quot;https://i.stack.imgur.com/ZuSFa.png&quot; alt=&quot;2-band structure&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Could someone explain it to me how this process works? I would like to implement it on python or MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="4102" LastEditorUserId="7092" LastEditDate="2022-04-25T11:51:35.633" LastActivityDate="2022-04-25T11:51:35.633" Title="How does filter bank work in image processing?" Tags="|image-processing|software-implementation|filter-bank|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8345" PostTypeId="2" ParentId="8342" CreationDate="2013-03-23T04:11:52.530" Score="2" Body="&lt;p&gt;You could try homebrewing something similar to the basic idea of sound fingerprinting.  Create a 2D array (maybe even graph it to take a look) of your Mel energies, pick out all the local maxima, and then compare the 2D distances between the nearest peak pairs between the two graphs as a similarity measure.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-03-23T04:11:52.530" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8346" PostTypeId="1" AcceptedAnswerId="8347" CreationDate="2013-03-23T06:33:46.597" Score="0" ViewCount="275" Body="&lt;p&gt;I have an fft function in matlab/octave that works great on an imported mono wav/audio signal that is 1 second long, but when the signal imported is more than 1 second the frequency values become incorrect.  To check this I created a 2 second signal using audacity the first half of the 2 second signal (1 second of it) was 500hz at 0.3 amplitude and the second half of the 2 second signal (1 second of it) was 200hz at 0.8 amplitude.  I also checked it with audacity's analyse spectrum option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use the function on this 2 second signal it shows that the max frequency is at 999.95hz when it should show the max frequency is at 200hz.  Can anyone help me get this function to work with signals greater than just 1 second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've included the function along with the code that calls the function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The FUNCTION:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [freq,amp,ampinv,phase,phase_radtodeg,phase_degtorad,phase_adjindeg,phase_adjinrad,sigfft,sigifft,sigphase]=rtfftphase(vp_sig_orig,Fs,phase_goal)&#xA;&#xA;    vp_sig_orig = vp_sig_orig - mean(vp_sig_orig); %remove the mean of your signal due to dc offset&#xA;&#xA;    vp_sig_orig=vp_sig_orig';&#xA;    vp_sig_len=length(vp_sig_orig); %get sample rate from vp fs_rate needs to be an even number?&#xA;&#xA;    % Use next highest power of 2 greater than or equal to length(x) to calculate FFT.&#xA;    nfft= 2^(nextpow2(length(vp_sig_orig))); &#xA;&#xA;    % Take fft, padding with zeros so that length(fftx) is equal to nfft &#xA;    fftx = fft(vp_sig_orig,nfft); &#xA;    sigfft= fft(vp_sig_orig); &#xA;    sigifft=ifft(sigfft);&#xA;    sigphase = unwrap(angle(sigfft')); %get phase of orginal signal&#xA;&#xA;    % Calculate the number of unique points&#xA;    NumUniquePts = ceil((nfft+1)/2); &#xA;&#xA;    % FFT is symmetric, throw away second half &#xA;    fftx = fftx(1:NumUniquePts); &#xA;&#xA;    % Take the magnitude of fft of x and scale the fft so that it is not a function of the length of x&#xA;    mx = abs(fftx)/length(vp_sig_orig); %replaced for testing from stackexchage&#xA;&#xA;% Since we dropped half the FFT, we multiply mx by 2 to keep the same energy.&#xA;    % The DC component and Nyquist component, if it exists, are unique and should not be multiplied by 2.&#xA;    if rem(nfft, 2) % odd nfft excludes Nyquist point&#xA;    mx(2:end) = mx(2:end)*2;&#xA;    else&#xA;    mx(2:end -1) = mx(2:end -1)*2;&#xA;    end&#xA;&#xA;    %yamp=(mx(1,:)/max(abs(mx(1,:)))*1); % keep at 1, dont use in function use in script file directly&#xA;    amp=mx;&#xA;    ampinv=abs(amp-max(amp));&#xA;&#xA;    % This is an evenly spaced frequency vector with NumUniquePts points. &#xA;    freq_vect = (0:NumUniquePts-1)*vp_sig_len/nfft; &#xA;    freq=(freq_vect'); %take of round if you want exact numbers&#xA;&#xA;    %get phase of new signal&#xA;    phase = unwrap(angle(fftx)); %get phase of orginal signal&#xA;&#xA;    %phase stuff phase adj stuff not fully done yet I don't know the correct way to use it leave at 0 for now&#xA;    phase_radtodeg=rtrad2deg(phase); %also check sigphase to see if it's the same.&#xA;    phase_degtorad=rtdeg2rad(phase_radtodeg); %for checking&#xA;    phase_adjindeg=phase_goal-phase_radtodeg; %used to create new phase to get to goal phase&#xA;    phase_adjinrad=rtdeg2rad(phase_adjindeg);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example: that calls the function&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imported_sig_L=imported_sig(:,1)';&#xA;[xfreq_orig,yamp_orig,yamp_inv,phase_orig,phase_in_deg,phase_in_rad,phase_adjindeg,phase_adjinrad,sigfft,sigifft,sigphase]=rtfftphase(imported_sig_L,fs_rate,0); &#xA;&#xA;&#xA;array1=[xfreq_orig,yamp_orig,yamp_inv,phase_orig,mod(phase_in_deg,360),phase_in_rad,phase_adjindeg,phase_adjinrad]; %have degs only go up to 360&#xA;&#xA;&#xA;%Sort Array Section&#xA;&#xA;array1_sort_amp_norm=sortrows(array1,-2); %sort by amplitude&#xA;array1_sort_amp_inv=sortrows(array1,-3); %sort by amplitude inverse&#xA;&#xA;&#xA;%get max freq checking to make sure freq isn't zero if so go to next row&#xA;if (array1_sort_amp_norm(1,1)&amp;gt;0); % To get max amplitude&#xA;    maxfreq_normA=array1_sort_amp_norm(1,1)&#xA;elseif   (array1_sort_amp_norm(1,1)&amp;lt;=0); %&#xA;    maxfreq_normA=array1_sort_amp_norm(2,1)&#xA;end&#xA;&#xA;if (array1_sort_amp_inv(1,1)&amp;gt;0); % To get inverted max amplitude&#xA;    maxfreq_invA=array1_sort_amp_inv(1,1)&#xA;elseif   (array1_sort_amp_inv(1,1)&amp;lt;=0); %&#xA;    maxfreq_invA=array1_sort_amp_inv(2,1)&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1894" LastActivityDate="2013-03-23T07:18:29.807" Title="FFT function isn't working on imported signals greater than a second" Tags="|fft|matlab|signal-analysis|octave|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8347" PostTypeId="2" ParentId="8346" CreationDate="2013-03-23T07:18:29.807" Score="2" Body="&lt;p&gt;Here a short example of how to deal with FFT in octave/matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function freq(npts, len, basefreq)&#xA;    x = [0 : npts - 1] / npts * len;&#xA;    y = sin(basefreq * x * 2 * pi);&#xA;    F = abs(fft(y));&#xA;    half = npts / 2;&#xA;    F = F(1 : half);&#xA;    plot([0 : half - 1] / len, F);&#xA;    printf(&quot;Base frequency = %g\n&quot;, (find(F == max(F)) - 1) / len);&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;try this function with different parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;code&gt;npts&lt;/code&gt; is size of data vector; &lt;code&gt;len&lt;/code&gt; - time length of data (in seconds); &lt;code&gt;basefreq&lt;/code&gt; - base frequency for sine function.&#xA;First we fit a time axe (&lt;code&gt;x&lt;/code&gt;), after that we calculate sinusoid with given frequency, get modulus of its FFT, trim it to half (BTW, another variant is not to trim, but to move frequency zero to middle of &lt;code&gt;fftshift&lt;/code&gt;'ed data). After all we plot result of FFT and print out founded base frequency.&lt;/p&gt;&#xA;" OwnerUserId="3766" LastActivityDate="2013-03-23T07:18:29.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8348" PostTypeId="1" AcceptedAnswerId="8349" CreationDate="2013-03-23T09:17:55.063" Score="3" ViewCount="359" Body="&lt;p&gt;According to &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Stiff_String.html&quot; rel=&quot;nofollow&quot;&gt;JOS on stiff-string synthesis&lt;/a&gt;, stiff strings (like on a piano) introduce inharmonicity (i.e. the harmonics of the tone are not all in tune) due to different frequency components of the wave travelling at different speeds. This inharmonicity is called &quot;dispersion&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Stiff_String_Synthesis_Models.html&quot; rel=&quot;nofollow&quot;&gt;another page on the same site about modelling this effect&lt;/a&gt;, he says it can be done by putting an LTI (linear, time-invariant) filter of some sort at one end of the delay line (in waveguide modelling, a delay line is used to model a physical string) before feeding the output back into the delay line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somehow, this LTI filter introduces inharmonicity, or frequency distortion. But by definition, an LTI filter does not introduce any new frequencies into the signal (and thus can be accurately represented by a frequency-response graph).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can inharmonic tones be introduced by an LTI filter? Am I missing something obvious? Do I not understand my DSP basics well enough?&lt;/p&gt;&#xA;" OwnerUserId="2076" LastEditorUserId="2076" LastEditDate="2013-03-23T19:56:06.083" LastActivityDate="2013-03-23T19:56:06.083" Title="How can frequency dispersion in a vibrating string be modelled using an LTI filter?" Tags="|filters|audio|linear-systems|music|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8349" PostTypeId="2" ParentId="8348" CreationDate="2013-03-23T10:05:53.740" Score="3" Body="&lt;p&gt;From your question, it sounds like you think the all-pass filter is an independent post-processing step that takes as its input the output of the classic Karplus-Strong model (delay line, LP filter, close the loop). If that would be the case, yes, it would be very surprising indeed that new harmonics would appear! But here, the allpass filter is part of the closed loop. You can intuitively think about what it does in these terms: it is a short delay, with a delay value which is frequency-dependent (phase shifter). This gets added to the delay provided by the main $N$ samples delay line, and causes the lower frequencies to &quot;see&quot; a longer loop. So the highest harmonics will have a period close to $N$, and the lower harmonics will have a lower period. The overall transfer function of the loop is no longer a comb with regular spacing between teeth, but a comb with a slowly increasing gap between teeth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are forgetting also is that this whole system (delay line, all-pass filter combined with loss LP filter, close the loop) which is a LTI, is excited by a burst of white noise. So the input signal contains all frequencies, and there's nothing surprising or contradictory with the fact that altering the transfer function of a LTI can change its frequency response so that its resonant frequencies are shifted, or so that new bumps appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to convince yourself... System A is a band-pass filter with a frequency of 1kHz. System B is a band-pass filter with a frequency of 1kHz ; in parallel with a band-pass filter with a frequency of 2kHz. Both are excited by white noise. In the second case you have &quot;added&quot; a LTI filter in the system; and a new frequency has appeared. There's no magic in this - you have just shaped the frequency response of the system differently to sculpt the input in new ways.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-03-23T18:56:51.280" LastActivityDate="2013-03-23T18:56:51.280" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8350" PostTypeId="1" CreationDate="2013-03-23T15:43:56.840" Score="2" ViewCount="320" Body="&lt;p&gt;Let $x[n] = \cos(wn)\ \ $ be our signal. Let the other signal be $x_2[n] = \cos(2wn)\ \ $ . The spectrum of $x[n]$ and $x_2[n]$ are well defined and consist of impulses at the relevant frequencies with weight $\pi$. However, if we interpret $x_2[n]$ as the decimated version of $x[n]$, the spectrum of $x_2[n]$ must have impulses with weight $\frac{\pi}{2}$. I have the explanation but I would like to hear the alternatives, what is the best way to resolve  these seemingly contradicting facts?&lt;/p&gt;&#xA;" OwnerUserId="4201" LastEditorUserId="80" LastEditDate="2013-04-02T22:20:36.733" LastActivityDate="2013-05-02T23:10:17.110" Title="Decimating a discrete time cosine function" Tags="|decimation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8351" PostTypeId="2" ParentId="8327" CreationDate="2013-03-23T16:53:08.233" Score="3" Body="&lt;p&gt;Let's start with pose recognition.  &lt;a href=&quot;http://www.iaeng.org/publication/IMECS2009/IMECS2009_pp489-493.pdf&quot; rel=&quot;nofollow&quot;&gt;This paper&lt;/a&gt; traces the boundary of the hand, and counts the number of finger tip detections from that boundary.  One thing to note in that paper is that there is no &quot;state&quot; information required. For pose / position estimation, HMMs are probably not a good fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gesture information fits better into the HMM gamut for problem-solving. However, I'd need to see a bit more of the sort of data you are going to use for gestures. Can you explain a bit more about the algorithm that generates the data you have?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://espace.library.uq.edu.au/eserv/UQ:10225/TENCON.pdf&quot; rel=&quot;nofollow&quot;&gt;The problem is that selecting the right structure of the hidden Markov model has quite a bit of bearing on the achievable accuracy...&lt;/a&gt; Warning: PDF link!&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-03-23T16:53:08.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8352" PostTypeId="2" ParentId="8327" CreationDate="2013-03-23T18:12:43.927" Score="5" Body="&lt;p&gt;I have used HMM for gesture recognition (not pose recognition). What I did was: tracking the hand and recognize the gesture the hand was drawing in the air, you can image it as a trail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use HMM as sequence recognizer, so first of all you need to transform your image into a discrete number sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each gesture you want to recognize, you need to train an HMM for that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have a dictionary with some known word. Each one is a trained HMM. If you have a new word (unknown obdervation) you can compute the probability for each word of the dictionary to be likely the unknown one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some pseudo-code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;##################### training phase&#xA;&#xA;examples = [112233, 11233, 123, 1122223333]&#xA;word1 = train(example)&#xA;&#xA;examples = [222333, 22222223333, 2222333333]&#xA;word2 = train(example)&#xA;&#xA;examples = [124555, 1122445, 1111111222224444555]&#xA;word3 = train(example)&#xA;&#xA;dictionary = [word1, word2, word3]&#xA;&#xA;&#xA;##################### recognition phase&#xA;&#xA;#let's say you have a new unkown word: 12245, you want to know what word of the dictionary it is more likly&#xA;&#xA;unkown = 12245&#xA;probabilities = []&#xA;for w in word:&#xA;    probabilities.append( calculate_prob(unkown) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, see what the is the maximum value in probabilities and you get the most likely word of the dictionary!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ece.ucsb.edu/Faculty/Rabiner/ece259/Reprints/tutorial%20on%20hmm%20and%20applications.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ece.ucsb.edu/Faculty/Rabiner/ece259/Reprints/tutorial%20on%20hmm%20and%20applications.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/69647/Hidden-Markov-Models-in-C&quot; rel=&quot;nofollow&quot;&gt;http://www.codeproject.com/Articles/69647/Hidden-Markov-Models-in-C&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.creativedistraction.com/demos/gesture-recognition-kinect-with-hidden-markov-models-hmms/&quot; rel=&quot;nofollow&quot;&gt;http://www.creativedistraction.com/demos/gesture-recognition-kinect-with-hidden-markov-models-hmms/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="80" LastEditDate="2013-03-23T18:33:44.497" LastActivityDate="2013-03-23T18:33:44.497" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8353" PostTypeId="2" ParentId="664" CreationDate="2013-03-23T20:48:03.333" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In general equalizing a channel with deep fades is a problem for all equalizers. CMA equalizer is no exception. Absence of a training signal makes things worse.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This is obviously an example of the CMA stuck in a local minimum. The inital condition of the CMA equalizer was probably in the vicinity of the local minimum. The equalizer filter to which the CMA converged, convolved with the channel does not yield to an impulse-like overall response.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Remember that the cost functions of CMA equalizers are nonlinear. Modifying the modulus do not have a &quot;linear&quot; effect on the cost function. What happened probably was that your initial condition (which is identical to the one in the previous case) of the &quot;modified modulus&quot; CMA equalizer had now fallen into the vicinity of the global minimum. This is the &quot;beauty&quot; of nonlinearity!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4201" LastEditorUserId="4201" LastEditDate="2013-03-23T23:38:25.180" LastActivityDate="2013-03-23T23:38:25.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8354" PostTypeId="1" AcceptedAnswerId="25789" CreationDate="2013-03-23T22:34:48.143" Score="1" ViewCount="325" Body="&lt;p&gt;Let's start with a simple temporal law, that I want to analyze in the frequency domain :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)=\frac{1}{2}(A+Bcos(2\pi \nu_0 t+\phi_0))$, with :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$A=4$ &lt;/li&gt;&#xA;&lt;li&gt;$B=10$ &lt;/li&gt;&#xA;&lt;li&gt;$\nu_0=10^8$&lt;/li&gt;&#xA;&lt;li&gt;$\phi_0=10^8$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I made a simple DFT (in Ruby) with $N=256$ samples at $f_s=6.10^8$ and got the following results, that are self explanatory, hopefully :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{:freq=&amp;gt; 0, :ampl=&amp;gt;1.9661708933907966, :phase=&amp;gt;0.0}&#xA;...non significant amplitudes...&#xA;{:freq=&amp;gt;41, :ampl=&amp;gt;0.8468197908638829, :phase=&amp;gt;0.502386551741981},&#xA;{:freq=&amp;gt;42, :ampl=&amp;gt;2.0871309982776522, :phase=&amp;gt;0.5146361931223131},&#xA;{:freq=&amp;gt;43, :ampl=&amp;gt;4.115492878192129,  :phase=&amp;gt;0.5268855235929356},&#xA;{:freq=&amp;gt;44, :ampl=&amp;gt;1.0144367909506748, :phase=&amp;gt;0.5391345296503323},&#xA;...non significant amplitudes...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I clearly retreive A : $1.96 = \frac{A}{2}$ gives $A = 3.9 \approx 4$. Good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for $\nu_0$, this seems correct also :&lt;br&gt;&#xA;$f_{analysis}(43)=\frac{43f_s}{256}=100781250.0\approx 10^8=\nu_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $B$ and $\phi_0$, things are more difficult, because (I guess) of DFT &lt;a href=&quot;http://www.jot.fm/issues/issue_2009_11/column2/index.html&quot; rel=&quot;nofollow&quot;&gt;frequency leakage&lt;/a&gt;. Direct reading of my result gives $$2\times 4.11=8.22 \not\approx B=10$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As experts, how would you get acceptable $B$ and $\phi_0$, from my results ? &lt;/p&gt;&#xA;" OwnerUserId="653" LastEditorUserId="653" LastEditDate="2013-03-25T20:03:05.780" LastActivityDate="2015-09-13T08:15:49.443" Title="Parameter extraction from DFT results, possibly with leakage effects" Tags="|fft|dft|time-frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8355" PostTypeId="2" ParentId="6006" CreationDate="2013-03-23T22:48:14.373" Score="2" Body="&lt;p&gt;Impulse response makes sense for linear systems. If your system is nonlinear forget it. If you assume that your system is linear time invariant, you may want to measure the impulse response by exerting a short duration high energy pulse to your robot. It must have sufficiently high energy so that most of the exerted energy is transferred to kinematic energy of the robot to enable motion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not possible you can apply longer duration pulses to your robot and then measure its response (motion). You must deconvolve then the response and the input to get the impulse response of your robot. You may try this for a number of different shape pulses and if you get impulse responses similar to each other every time, you can be fairly sure that your system is linear. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your comment on having an infinite impulse response is not in line with correct systems modelling, so forget about it.&lt;/p&gt;&#xA;" OwnerUserId="4201" LastActivityDate="2013-03-23T22:48:14.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8356" PostTypeId="2" ParentId="8336" CreationDate="2013-03-24T00:07:31.533" Score="1" Body="&lt;p&gt;Assuming $y$ and $u$ are scalars, then the first equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;u = -K \hat{x}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is just a vector-vector multiplication and can be implemented in &lt;code&gt;C&lt;/code&gt; as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u = 0.0;&#xA;for (i=0; i&amp;lt;N; i++)&#xA;{  &#xA;    u += xhat[i]*K[i];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;assuming that $K$ is $1 \times N$ and that $\hat{x}$ is $N \times 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The multiplication &lt;code&gt;C*xhat&lt;/code&gt; can be implemented similarly (because I suspect that $C$ is really $1 \times N$ rather than $2 \times N$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The multiplications &lt;code&gt;L*(y-C*xhat)&lt;/code&gt; and &lt;code&gt;B*u&lt;/code&gt; are vector-scalar multiplications which, for the latter, would look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Bu = 0.0;&#xA;for (i=0; i&amp;lt;N; i++)&#xA;{  &#xA;    Bu += B[i]*u;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The multiplication  &lt;code&gt;A*xhat&lt;/code&gt;  will be slightly different because $A$ is $N \times N$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-03-24T00:07:31.533" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8357" PostTypeId="2" ParentId="8309" CreationDate="2013-03-24T06:02:27.590" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;I would expect that this is (at least roughly) the best way to do&#xA;this. &lt;/li&gt;&#xA;&lt;li&gt;If you find that you need to soften the edges, you could use a&#xA;cosine roll-off.&lt;/li&gt;&#xA;&lt;li&gt;I'm not sure about which bit to discard.  I would look at the data and see where most of the energy lies - compare just taking the real part to just taking the magnitude (signed magnitude I guess), and see which version accounts for the most energy in the image.&lt;/li&gt;&#xA;&lt;li&gt;Are you sure the noise will no longer be white?  I think it might still be.  At least along the radial lines you are keeping you haven't changed the noise profile.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Your results look pretty good to me.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-24T06:02:27.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8358" PostTypeId="1" AcceptedAnswerId="8368" CreationDate="2013-03-24T10:11:08.507" Score="1" ViewCount="1252" Body="&lt;p&gt;This question is a little theoretical. Say I have 3 points that are bound within a certain 3D volume of some shape (i.e. box, cylinder, cone, etc). By using PCA, I find the most two dominant directions and reduce the data dimension to 2D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of this is done by the following: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute 3x3 covariance matrix of the 3D data.&lt;/li&gt;&#xA;&lt;li&gt;Take eigenvectors and eigenvalues of the covariance matrix.&lt;/li&gt;&#xA;&lt;li&gt;Sort by eigs by descending order of eigenvalues.&lt;/li&gt;&#xA;&lt;li&gt;Take first two largest eigenvectors and multiply them with the data. The data is now 2 dimensions.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is: What properties are maintained through the projection? For example, if the original 3D data was bound by a radius of size r (say in the X and Y directions only), does this apply also to the 2D data? What happens to the range of the data? The distances? What can I infer about the new 2D data from knowing the characteristics of the 3D data?&lt;/p&gt;&#xA;" OwnerUserId="900" LastEditorUserId="38" LastEditDate="2013-03-24T20:46:48.710" LastActivityDate="2013-03-25T11:44:49.923" Title="Properties of projected 3d points (to 2d), Principal component analysis (PCA)" Tags="|image-processing|computer-vision|3d|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8360" PostTypeId="1" AcceptedAnswerId="8362" CreationDate="2013-03-24T18:43:28.077" Score="3" ViewCount="174" Body="&lt;p&gt;I was looking over some DSP and came across the following signal: $x[n] = 1/n$. So I wondered whether it had a z-transform but I soon realized that it fails to meet two conditions described &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Existence_Z_Transform.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...(1) the signal starts at a finite time and (2) it is asymptotically&#xA;  exponentially bounded...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I modified it to meet those requirements: $x[n] = \frac{1}{n^2} u[n] $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;em&gt;I assume $n&amp;gt;0$ is a condition or perhaps $u[n]$ should be changed to $u[n-1]$.&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering that signal, I believe it satisfies both requirements however I don't see anything like it in a table of common z-transforms, but it can be rewritten as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x[n] = \frac{1}{1^2}*\delta[n-1] + \frac{1}{2^2}*\delta[n-2] + \frac{1}{3^2}*\delta[n-3]\ +\  ...$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which I believe transforms to $ X(z) = \frac{1}{z^1} + \frac{1}{(2z)^2} + \frac{1}{3^2z^3} +\ ...  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this transformation make sense? Is it the best approach? And if it's correct, is there a more compact way to express it?&lt;/p&gt;&#xA;" OwnerUserId="38" LastActivityDate="2013-03-24T21:04:07.767" Title="Is this a valid z-transform of $ \frac{1}{n^2}u[n] $?" Tags="|discrete-signals|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8361" PostTypeId="1" CreationDate="2013-03-24T20:44:49.053" Score="8" ViewCount="1274" Body="&lt;p&gt;I have been struggling to find a well-cited approach to this.  Essentially, I am experimenting with different background subtraction algorithms, but none seem to perform well when there are significant lighting changes (say, from a window in the scene getting significant glare at specific times).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is simple (relatively): what are the state-of-the-art methods for background subtraction with sudden illumination changes?  My scenario is surveillance cameras.&lt;/p&gt;&#xA;" OwnerUserId="4204" LastActivityDate="2013-05-29T10:42:29.473" Title="What is the state-of-the-art method for dealing with illumination issues in background subtraction?" Tags="|computer-vision|background-subtraction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8362" PostTypeId="2" ParentId="8360" CreationDate="2013-03-24T21:04:07.767" Score="3" Body="&lt;p&gt;What you've got is definitely the z-transform of that signal (by definition).  For a more compact expression, notice that the &lt;a href=&quot;http://mathworld.wolfram.com/Polylogarithm.html&quot; rel=&quot;nofollow&quot;&gt;polylogarithm&lt;/a&gt; is exactly the infinite sum you've shown (just replace $ z \rightarrow 1/z$ in the Mathworld expression). Unfortunately I don't think there's any nicer way to write it; sometimes there just isn't.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-24T21:04:07.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8363" PostTypeId="2" ParentId="8354" CreationDate="2013-03-24T22:48:03.117" Score="0" Body="&lt;p&gt;Interpolation is one method used to estimate parameters of non-periodic-in-FFT-aperture signals.  Parabolic or, better yet, Sinc interpolation will help with estimating both the frequency and the amplitude peak B.  For phase interpolation, I find it easier to use something like a pre or post fftshift to move the phase 0 reference to the middle of your data, then interpolating an estimated phase from the fft, then offsetting the phase back relative to wherever using the frequency estimate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-03-24T22:48:03.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8364" PostTypeId="2" ParentId="8339" CreationDate="2013-03-25T04:46:10.573" Score="5" Body="&lt;p&gt;You can try to remove noise (especially occasional spikes) by non-linear filter. I suggest to use median filter (&lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Median_filter&lt;/a&gt;), as your spikes has length only few points (as I see). There is matlab function - &lt;strong&gt;medfilt1&lt;/strong&gt;. It is probably that such filtration will be enough.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2013-03-25T04:46:10.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8365" PostTypeId="1" CreationDate="2013-03-25T09:29:47.307" Score="1" ViewCount="276" Body="&lt;p&gt;I have a periodical function $f(x)$ that is sampled in time, at a rate of 1 millisecond. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Together with this, I also have a second function $t(x)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the correlations between periods of the first function and the second function $t(x)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I approach this issue? &lt;/p&gt;&#xA;" OwnerUserId="4208" LastEditorUserId="29" LastEditDate="2013-06-28T21:27:05.860" LastActivityDate="2013-08-27T22:17:41.843" Title="Correlation between 2 functions" Tags="|cross-correlation|correlation|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8366" PostTypeId="1" CreationDate="2013-03-24T22:55:49.567" Score="8" ViewCount="9216" Body="&lt;p&gt;I am trying to make sense of FFTs and binary data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have a series of random binary data, which is measured with a repetition rate of 400Hz (interval time of 0.0025s). I have a total of 12489 points, which corresponds to a total measurement time of about 31 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to be able to learn more about what I would expect an FFT of this data to look like. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some things I would like to understand the significance of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What should be the average amplitude of the data, post-FFT?&lt;/li&gt;&#xA;&lt;li&gt;what is the significance of the maximum amplitude of binary data that is not random, but consists of 1,0,1,0,1,0 data (12489 points). How can this help me find my y-scale?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="ElizabethPor" LastActivityDate="2018-05-15T12:23:28.250" Title="FFT of random binary data" Tags="|frequency|fourier-transform|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8367" PostTypeId="2" ParentId="8366" CreationDate="2013-03-25T11:42:16.100" Score="0" Body="&lt;p&gt;The output will depend on the exact type of random law that creates the binary points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the mean and maximum amplitude of you sample signal, you can apply &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_identity&quot; rel=&quot;nofollow&quot;&gt;Parseval's identity&lt;/a&gt; that states that the energy of the input signal is preserved (up to a $2 \pi$ constant factor in 1D).&#xA;The maximum peak is obtained in the case where there is only one non-null frequency in the analysis.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-25T11:42:16.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8368" PostTypeId="2" ParentId="8358" CreationDate="2013-03-25T11:44:49.923" Score="0" Body="&lt;p&gt;The new 2D data is the projection of the 3D data onto the tangential plane of the underlying 3D shape.&#xA;This should allow you to answer most of your questions by a simple drawing. &lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-25T11:44:49.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8370" PostTypeId="2" ParentId="8361" CreationDate="2013-03-25T12:16:44.900" Score="4" Body="&lt;p&gt;The standard approach is to use a mixture of Gaussians to model the various laws that command the intensity of a pixel. In this approach, a pixel can be assigned several normal laws (with different mean and variance), each of them will model its value under different conditions.&#xA;Of course, only 1 Gaussian needs to be active at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the maximum number of Gaussians in the mixture is a (fixed) parameter, the parameters of each Gaussian are learned online.&#xA;You can find an example implementation in the &lt;a href=&quot;http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#backgroundsubtractor&quot; rel=&quot;nofollow&quot;&gt;OpenCV&lt;/a&gt; library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few years ago, someone (sorry, i can't find the name anymore) proposed an interesting alternative approach: using variations of the image gradient orientation instead of variations of the light intensities.&#xA;The gradient orientation has the advantage of being contrast invariant, making it more robust to illumination changes.&#xA;Intuitively, it works because the gradient orientation is tied to the shapes in the image, not to their color or luminosity.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="29" LastEditDate="2013-03-25T17:54:08.807" LastActivityDate="2013-03-25T17:54:08.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8371" PostTypeId="1" AcceptedAnswerId="8375" CreationDate="2013-03-25T15:50:25.873" Score="2" ViewCount="106" Body="&lt;p&gt;I have two audio signals, both with supposedly matching frequencies at each time window.  What I would like to do is to verify that the frequencies are identical.  However, one was created at a higher power than the other, so simply checking for a match at each sample won't work.  I've already cross-correlated the signals, so there's no time lag between them.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to compare the &quot;shapes&quot; of two waveforms of differing amplitudes?  If there's some way to drop the amplitude domain from the signal, that would work - I don't know nearly enough about DSP to know if it's easy or not.&lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2013-03-25T21:18:27.917" Title="Finding Frequency Differences In Differing Amplitude Signals" Tags="|discrete-signals|frequency|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8372" PostTypeId="2" ParentId="8366" CreationDate="2013-03-25T17:39:38.800" Score="1" Body="&lt;p&gt;First: don't say FFT when you actually mean &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt; (Discrete Fourier Transform) (FFT is just an algorithm that computes efficiently the DFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second: the Fourier transform of random data (stochastic process) is rather tricky to work with/interpret. You should first try to understand the DFT for deterministic data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third: in most typical applications, you don't take the Fourier transform of the &quot;full signal&quot; (12489 samples=31 seconds), but rather segment it in short &quot;frames&quot; and take the DTF of each frame.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What should be the average amplitude of the data, post-FFT?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You must remember that the DFT is not real but a complex signal. If you are insterested only in magnitudes, of course you can take the (squared) absolute value of it. Now, if the signal is random, this is equivalent of getting a Periodogram, which is an estimate of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Spectral_analysis&quot; rel=&quot;nofollow&quot;&gt;Spectral density&lt;/a&gt;  of the signal. The &quot;spectrum&quot; (not random) of a random signal  is the fourier transform, not of the signal itself, but of the autocorrelation function. Informally, it measures how much &quot;energy&quot; the signal has in each frequency band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the answer of your question is not simple. The only simple property that could help is is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_Plancherel_theorem_and_Parseval.27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval theorem&lt;/a&gt;: this says that the mean squared value of the spectogram equals the mean squared value of the signal (&quot;total energy&quot;), properly normalized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another property (for deterministic signals) is that the zero frequency value of the DFT is the mean value of the signal, properly normalized.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what is the significance of the maximum amplitude of binary data that&#xA;  is not random, but consists of 1,0,1,0,1,0 data (12489 points).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Such a signal has almost all its enery at the highest frequency (plus a zero-frequency component, given by its mean value =1/2. Hence, its DFT will be practically zero everywhere except at frequency zero, and at k=N/2  (wchich corresponds to maximum frequency).&lt;/p&gt;&#xA;" OwnerUserId="358" LastActivityDate="2013-03-25T17:39:38.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8373" PostTypeId="1" CreationDate="2013-03-25T18:24:43.350" Score="2" ViewCount="1821" Body="&lt;p&gt;Is there any good documentation about training your own classifiers(with examples included) different from &lt;a href=&quot;http://www.google.com.cu/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDQQFjAA&amp;amp;url=http://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetectorclass.html&amp;amp;ei=iI9QUY29L6PC0QGQ3ICADQ&amp;amp;usg=AFQjCNF4snrodCNChYWSUWK7LaICz8GHzA&amp;amp;bvm=bv.44158598,d.dmQ&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt; provided by MathWorks.&#xA;Thanks in Advance&lt;/p&gt;&#xA;" OwnerUserId="3793" LastEditorUserId="53" LastEditDate="2014-12-23T15:19:23.767" LastActivityDate="2014-12-23T15:19:23.767" Title="Training custom classifiers using trainCascadeObjectDetector" Tags="|image-processing|matlab|computer-vision|object-recognition|matlab-cvst|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8374" PostTypeId="2" ParentId="8373" CreationDate="2013-03-25T20:52:52.867" Score="1" Body="&lt;p&gt;Check out this &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/train-a-cascade-object-detector.html&quot; rel=&quot;nofollow&quot;&gt;tutorial on how to use trainCascadeObjectDetector&lt;/a&gt;. It describes common pitfalls, and includes examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/39627&quot; rel=&quot;nofollow&quot;&gt;graphical tool for labeling training images&lt;/a&gt; on MATLAB Central, which makes preparing your training data much less painful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, the link you posted is actually the documentation for vision.CascadeObjectDetector, which uses the classifier produced by trainCascadeObjectDetector. The doc page for trainCascadeObjectDetector is &lt;a href=&quot;http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2013-03-25T21:00:17.203" LastActivityDate="2013-03-25T21:00:17.203" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8375" PostTypeId="2" ParentId="8371" CreationDate="2013-03-25T21:18:27.917" Score="0" Body="&lt;p&gt;Sounds to me like you need to look at the signals in the frequency domain.  Take the Fourier transform of each signal (use an FFT), and look at the spectrum.  I'm not sure if you've got signals with just a single frequency (a tone) or with many frequencies, but in either case if they have the same frequencies in them then the spectra should look the same (except for one being larger than the other).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're unfamiliar with frequency domain concepts, I'd suggest you read up on them first.  The wikipedia page on Fourier transforms is pretty large, so I'm not sure how good that would be as an introduction, but there are a large number of books on the topic and many websites too.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-03-25T21:18:27.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8376" PostTypeId="1" AcceptedAnswerId="8399" CreationDate="2013-03-26T01:08:02.083" Score="4" ViewCount="567" Body="&lt;p&gt;For the differential equation&#xA;$$\frac{d^2y(t)}{dt^2}+\frac{3dy(t)}{dt} + 2y = x(t),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to find the frequency response as $$H(j\omega)= \frac{1}{-\omega^2+3j\omega+2}.$$ However, I am not sure how to find the impulse response, which is the next part. Please help, and thank you in advance. &lt;/p&gt;&#xA;" OwnerUserId="4212" LastEditorUserId="1496" LastEditDate="2013-03-26T08:49:34.917" LastActivityDate="2013-03-27T13:13:31.130" Title="Impulse Response Question" Tags="|frequency|impulse-response|linear-systems|frequency-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8377" PostTypeId="1" CreationDate="2013-03-26T08:18:37.410" Score="0" ViewCount="138" Body="&lt;p&gt;I am working on camera motion detection.How do I decouple translation and rotation? I have obtained rotation by using sensors. I understand we can do something as simple as X'=RX+T , where R-rotation, T-translation and X,X' are the points involved. These points are 3D points(either world or camera coordinate system). How do i determine these 3D points by analyzing an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other way to obtain translation? (some Image Processing technique may be?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any links for literature would be helpful.&lt;/p&gt;&#xA;" OwnerUserId="4214" LastActivityDate="2013-03-26T10:49:02.833" Title="camera motion detection" Tags="|camera|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8378" PostTypeId="2" ParentId="8377" CreationDate="2013-03-26T10:49:02.833" Score="2" Body="&lt;p&gt;If X are known 3D points, then the translation is given simply by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T=\frac{\sum_{i=1}^{n}{X'_{i}-RX_{i}}}{n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of points being in projected coordinates, then more work have to be done. You can express the 3D points in homogenous coordinates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X=(x, y, z, w)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w$ is 1 by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then both the translation and rotation can be joined via matrix multiplication:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X'=TRX=\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; t_{x} \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; t_{y} \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; t_{z} \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix}RX$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, you would be able to add camrea projection matrix in the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X'=TRPX$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now each point correspondence ($X\leftrightarrow X')$ will give you 4 equations. The minimum number of point correspondences depends on the number of unknowns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are usually more than enough points and the problem is overdetermined. The above equation can then be solved in a least-squares fashion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach is to first perform camera calibration to determine matrix $P$. Then the problem will be simplified greatly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best reference I know is (what else) &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot; rel=&quot;nofollow&quot;&gt;H&amp;amp;Z book&lt;/a&gt;. Chapter 7 is all about computing the camera matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Estimation methods are described as well.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-03-26T10:49:02.833" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8379" PostTypeId="1" CreationDate="2013-03-26T11:20:06.847" Score="1" ViewCount="3186" Body="&lt;p&gt;I've got an array of different values representing the y-values in a plot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y-values = [0.07, 0.09, 0.04, 0.15, 0.14, 0.05, 0.02, 0.2, 0.18,...  ...0.06, 0.2, 0.17, 0.19, 0.21, 0.3]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to split it in 3 intervals:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the first one should return the values to the &lt;strong&gt;first&lt;/strong&gt; big amplitude (here: [0.07, 0.09, 0.04, 0.15])&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the second one should return the values to the &lt;strong&gt;last&lt;/strong&gt; big amplitude (here: [0.14, 0.05, 0.02, 0.2, 0.18,...  ...0.06, 0.2])&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the last one should contain the last values (here: [0.17, 0.19, 0.21, 0.3])&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have no idea how to calculate these threshold-amplitudes. Can anyone help me with this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to implement this. I originally posted it on StackOverflow, but this is too mathematical as a programming subject, hope I can get some help here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HaccH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="76" LastEditDate="2013-03-28T10:11:02.927" LastActivityDate="2013-03-28T10:11:02.927" Title="Amplitude calculation" Tags="|python|software-implementation|statistics|peak-detection|math|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8380" PostTypeId="1" CreationDate="2013-03-26T12:31:46.993" Score="1" ViewCount="962" Body="&lt;p&gt;I'm trying to do some simple filtering for an audio signal using a window-sinc low pass filter. Supposing that my buffer has M values and the filter kernel size is N, after convolving these two arrays I would obtain an output of m+n-1 values. Which part should I take into consideration? I'm asking this because, if I read a M values array I should write a M values array. I have tried to take the first M or the last M values for output, but the result is not too good. I was wondering if I have to use a circular buffer in which I put every time M+N-1 values, but I read the first M values. &lt;/p&gt;&#xA;" OwnerUserId="4159" LastActivityDate="2013-03-26T13:14:37.757" Title="How to apply convolution on a buffer" Tags="|audio|convolution|filtering|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8381" PostTypeId="1" CreationDate="2013-03-26T12:33:54.117" Score="1" ViewCount="86" Body="&lt;p&gt;For audio classification we are using the cepstral coefficients and their derivatives. Which I calculate using the Matlab libary &lt;a href=&quot;http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html&quot; rel=&quot;nofollow&quot;&gt;voicebox&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for some literature for how to choose the frame length and overlap of frames. Most literature that I know of are considering speech recognition, but for this application are the audio signals not generated by humans and they are chancing slowly over time. I suppose the last part have an impact when choosing the frame length?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastActivityDate="2013-03-26T12:33:54.117" Title="Length of frames for calculating cepstral coefficients" Tags="|audio|sound|cepstral-analysis|" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8382" PostTypeId="2" ParentId="8380" CreationDate="2013-03-26T13:14:37.757" Score="3" Body="&lt;ul&gt;&#xA;&lt;li&gt;Output the first M samples of your convolution result&lt;/li&gt;&#xA;&lt;li&gt;Keep the remaining samples and ADD those to the result next buffer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Google &quot;overlap add&quot; for more information. While overlap add is a frequency domain method, it explains the framing and buffer handling well.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-03-26T13:14:37.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8383" PostTypeId="2" ParentId="8379" CreationDate="2013-03-26T13:19:53.070" Score="1" Body="&lt;p&gt;You have to be specific about your selection criteria. All you're &quot;big amplitude&quot; are local maxima but there are also other local maxima that don't qualify (why?). It looks like you want a local maximum that's above a certain threshold. Or maybe you only want the top 3? &#xA;Anyway, you can find local maxima by either differentiating and finding the zeros or my a simple search by looking at the neighbors of each sample. Then this can be combined with a threshold detector or a sorting algorithm.&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-03-26T13:19:53.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8384" PostTypeId="1" AcceptedAnswerId="8391" CreationDate="2013-03-26T15:22:44.013" Score="1" ViewCount="2907" Body="&lt;p&gt;I am fairly new to both Matlab and FFT. I would like someone to explain to me the relationship between the frequency of the wave being processed, the number of point (usually called NFFT), the Nyquist Fs and frequency vector. Basically how do you find the peak frequencies? how does FFT represent the frequencies? Any and all help is welcome. Thank you&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2013-03-27T02:02:41.373" Title="What is the relationship between frequency vector and the peak frequency in FFT?" Tags="|fft|frequency|nyquist|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8385" PostTypeId="2" ParentId="8384" CreationDate="2013-03-26T15:56:42.637" Score="1" Body="&lt;p&gt;There is no fixed relationship between the frequencies present in the input signal and the length of the DFT that you perform. You can choose the DFT length to be any value that you want, irrespective of what the input signal is. Whether you get the results that you want is another story, but there's no fixed relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Briefly, a DFT cross-correlates the input signal against a set of complex exponential functions at equally spaced frequencies between zero and the Nyquist frequency. The result of that correlation for each exponential function is the corresponding DFT output for that frequency. This interpretation is based upon a direct reading of the equation describing the DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \sum_{n=0}^{N-1}x[n] e^{\frac{-j2\pi nk}{N}}, k = 0, \ldots , N-1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N$ is the DFT length in this case. Therefore, you get a grid of frequencies starting at zero frequency and spaced in normalized angular frequency by $\frac{2\pi}{N}$ radians. So, if you want a finer grid, you would use a larger DFT. This requires either zero-padding the input data (which only interpolates the DFT output, not giving you any extra resolution) or collecting more samples of the input signal before performing the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To your other question of how to locate the peak frequencies in a signal, one way would be to perform the DFT on some sufficiently-large segment of the signal, then search the result for the largest $M$ values, where $M$ is the number of frequency components that you expect. The DFT length $N$ in this case would need to be set so that the frequency grid spacing on the transform output is small enough to resolve the minimum spacing between frequency components that you expect to see.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-03-26T15:56:42.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8388" PostTypeId="2" ParentId="8365" CreationDate="2013-03-26T21:22:03.847" Score="1" Body="&lt;p&gt;If you want to merely compare the periods of the functions $f_1$ and $f_2$, you could use the following &quot;metric&quot; (it might not technically be one if it disobeys the triangle inequality, but someone else will have to check for that):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Delta (f_1, f_2) \equiv \dfrac{\left| T_1 - T_2 \right|}{\max {T_1, T_2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the similarity can simply be defined as $s(f_1, f_2) \equiv 1-\Delta(f_1, f_2)$&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-03-26T21:22:03.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8389" PostTypeId="1" CreationDate="2013-03-26T21:42:18.037" Score="1" ViewCount="123" Body="&lt;p&gt;I am trying to implement Wavelet transform in an embedded environment. The problem I face goes like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Two vectors, A and B. A is input samples. B is vector co-efficients.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I take convolution of A and B, call it C.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now I go back to B and up-sample the co-efficients. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiple C with new up sampled signal of B.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Problem is I am constrained to up-sample only C, and not B. Is there a way that I can obtain a result where &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;conv(upsample(B,2), C) == conv(upsample(C,2), B)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4142" LastEditorUserId="4142" LastEditDate="2013-03-26T21:49:49.860" LastActivityDate="2013-03-26T21:49:49.860" Title="Reconstruction from Convolution" Tags="|convolution|wavelet|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8390" PostTypeId="2" ParentId="8350" CreationDate="2013-03-27T01:12:39.213" Score="0" Body="&lt;p&gt;I'm not sure where you get the idea that $x_2[n]$ must have weight $\frac{\pi}{2}$. You can conclude that the weights are the same for both cases using a simple change of varible in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DTFT equation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = \cos(\omega_0n)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;X(\omega) &amp;amp;= \sum_{n=-\infty}^{\infty} x[n] e^{-j\omega n} \\&#xA;&amp;amp;= \sum_{n=-\infty}^{\infty} \cos(\omega_0 n) e^{-j\omega n} \\&#xA;&amp;amp;= \pi(\delta(\omega-\omega_0) + \delta(\omega+\omega_0))&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the other signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_2[n] = \cos(2\omega_0 n)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;X_2(\omega) &amp;amp;= \sum_{n=-\infty}^{\infty} x_2[n] e^{-j\omega n} \\&#xA;&amp;amp;= \sum_{n=-\infty}^{\infty} \cos(2 \omega_0 n) e^{-j\omega n}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perform a change of variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;n' = 2n&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the limits of the summation over $n$ extend to infinity, we also sum from $-\infty$ to $\infty$ over $n'$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_2(\omega) = \sum_{n'=-\infty}^{\infty} \cos(\omega_0 n') e^{-j\omega \frac{n'}{2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, regroup the exponent inside the sum to yield:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_2(\omega) = \sum_{n=-\infty}^{\infty} \cos(\omega_0 n') e^{-j\frac{\omega}{2} n'}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then via inspection we can observe that $X_2(\omega) = X\left(\frac{\omega}{2}\right)$. Then, in terms of the equation that we found previously, we conclude that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;X_2(\omega) &amp;amp;= X\left(\frac{\omega}{2}\right) \\&#xA;&amp;amp;= \pi\left(\delta\left(\frac{\omega}{2}-\omega_0\right) + \delta\left(\frac{\omega}{2}+\omega_0\right)\right) \\&#xA;&amp;amp;= \pi\left(\delta\left(\omega-2\omega_0\right) + \delta\left(\omega+2\omega_0\right)\right)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; After thinking about it a bit more and looking at the notation that you posted in the below comment, I assert that the two are equivalent, although that may not be readily apparent. While the equation given in your comment has a typo, you can find a derivation on &lt;a href=&quot;http://courses.ece.ubc.ca/359/lectures/chapter5.pdf&quot; rel=&quot;nofollow&quot;&gt;slide 22 in this presentation&lt;/a&gt;. That structure makes explicit the aliasing that can happen when decimating a signal. The correct form is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[an] \Leftrightarrow \frac{1}{a} \sum_{k=0}^{a-1} X\left(\frac{\omega}{a} - \frac{2\pi k}{a}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for the case you posed, we can write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;x_2[n] = x[2n] \Leftrightarrow X_2(\omega) &amp;amp;= \frac{1}{2} \sum_{k=0}^{1} X\left(\frac{\omega}{2} - \frac{2\pi k}{2}\right) \\&#xA;&amp;amp;= \frac{1}{2} \sum_{k=0}^{1} X\left(\frac{\omega - 2 \pi k}{2}\right) \\&#xA;&amp;amp;= \frac{1}{2} \left(X\left(\frac{\omega}{2}\right) + X\left(\frac{\omega}{2} - \pi\right)\right)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then substitute the known expression for $X(\omega)$ to yield:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_2(\omega) = \frac{1}{2} \pi\left(\delta\left(\frac{\omega}{2}-\omega_0\right) + \delta\left(\frac{\omega}{2}+\omega_0\right) + \delta\left(\frac{\omega}{2}-\omega_0-\pi\right) + \delta\left(\frac{\omega}{2}+\omega_0-\pi\right)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then manipulate the arguments to the impulses, noting that they are nonzero when their argument is equal to zero:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_2(\omega) = \frac{1}{2} \pi\left(\delta\left(\omega-2\omega_0\right) + \delta\left(\omega+2\omega_0\right) + \delta\left(\omega-2\omega_0-2\pi\right) + \delta\left(\omega+2\omega_0-2\pi\right)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which, noting the $2\pi$-periodicity of $X(\omega)$, is equivalent to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;X_2(\omega) &amp;amp;= \frac{1}{2} \pi\left(\delta\left(\omega-2\omega_0\right) + \delta\left(\omega+2\omega_0\right) + \delta\left(\omega-2\omega_0\right) + \delta\left(\omega+2\omega_0\right)\right) \\&#xA;&amp;amp;= \pi\left(\delta\left(\omega-2\omega_0\right) + \delta\left(\omega+2\omega_0\right)\right) \\&#xA;&amp;amp;= X\left(\frac{\omega}{2}\right)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-03-28T01:59:35.777" LastActivityDate="2013-03-28T01:59:35.777" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8391" PostTypeId="2" ParentId="8384" CreationDate="2013-03-27T01:35:14.170" Score="2" Body="&lt;p&gt;Although I think Jason's &lt;a href=&quot;https://dsp.stackexchange.com/a/8385/3775&quot;&gt;answer contains all the information you requested&lt;/a&gt;, maybe what you're looking for is a little less theoretical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume you have a signal of $$x(t)=cos(2\pi t f_x)$$&#xA;where $t$ is the time in seconds and its frequency $f_x=20$Hz. Let's assume further you sample this signal at $f_s=1000$Hz over $T=3$ seconds, i.e. you have $K=3000$ samples $x[k]$, where $k$ is the integer sample index of the signal $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Sampling_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;sampling theorem&lt;/a&gt; basically says that your sampling frequency $f_s$ must be at least twice the maximum signal frequency (which is the Nyquist frequency $f_s/2$) in order to reproduce it without aliasing. For our example: $f_s=1000&amp;gt;2f_x=40$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You choose the &quot;number of points&quot; $N$ for the FFT (you called it NFFT) yourself, depending on how many different frequency samples you need to distinguish. The maximum frequency resolution you get by using &lt;em&gt;all&lt;/em&gt; available samples you have for calculating the FFT, which - depending on the $f_s$ and $T$ of your signal - might not be feasible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For our example, using all 3000 samples $x[k]$ is not a problem on a PC running Matlab, so let's assume we do that get $N=3000$ complex frequency samples $X[n]$ where $n$ is the integer frequency index. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to your question where in $X[n]$ to find a specific frequency $f$ you're interested in if $N=K$: $$n = f T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the Nyquist frequency $f_s/2$ bin is at $n_s = T f_s/2 = 1500$, right in the middle of the FFT result vector. If you plot the amplitude spectrum $abs(X)/N$, you'll notice that there are peaks at $n_x = T f_x = 60$ and $n_x' = 2940 = N - 60$, each of magnitude $1/2$. This is because the spectrum is &quot;mirrored&quot; around $f_s$ and the signal amplitude of 1 is divided between both peaks $n_x$ and $n_x'$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Matlab indices, I think you'll have to add 1 to the $n$ mentioned above because Matlab's vector indices start at 1 instead of 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you have frequencies $f$ which are not a multiple of your sampling frequency $f_s$, the amplitude will spread to neighbouring bins and you'll have to round $n$ to the nearest integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;http://www.mathworks.com.au/help/matlab/ref/fft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab's FFT documentation&lt;/a&gt;, which has a nice example.&lt;/p&gt;&#xA;" OwnerUserId="3775" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-03-27T01:47:48.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8392" PostTypeId="2" ParentId="8384" CreationDate="2013-03-27T02:02:41.373" Score="0" Body="&lt;p&gt;The FFT doesn't represent absolute frequencies, only complex magnitudes (magnitudes with a phase).   If you know your time domain signal contained a strongest sinusoid at frequency f0, then it's magnitude would end up mostly in bin round( f0 / (Fs/N) ), which will vary with both the sample rate and length represented by the input.&#xA;If you don't know f0, you would just search all the FFT result bins from 0 to N/2, and look for the one containing the largest magnitude compared to all the other bins.  From there you can estimate f0.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-03-27T02:02:41.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8393" PostTypeId="1" AcceptedAnswerId="8396" CreationDate="2013-03-27T03:40:08.260" Score="3" ViewCount="2187" Body="&lt;p&gt;I'm trying to implement some watermarking algorithm found in a paper*. This is a line of the paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Do the H-level DWT for all the renumbered segments.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then in simulation section the author explains the wavelet used for experiments.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;DWT transform adopted the common wavelet &quot;Daubechies-1&quot; and level H =&#xA;  3.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I just don't get what does H means, how do I input H=3 in matlab DWT function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My actual code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[cA,cD] = dwt(audio,'db1');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*Ji, Y. &amp;amp; Kim, J. A Quantified Audio Watermarking Algorithm Based on DWT-DCT. Multimedia, Computer Graphics and Broadcasting 339–344 (2011)&lt;/p&gt;&#xA;" OwnerUserId="4222" LastActivityDate="2013-03-27T11:17:39.543" Title="Matlab DWT H-level" Tags="|matlab|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8394" PostTypeId="1" CreationDate="2013-03-27T07:27:10.677" Score="4" ViewCount="252" Body="&lt;p&gt;I've a scatter plot with x- and y-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to calculate a rectangle which displays where 80% of the points in this plot are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not very familiar with statistics, so I don't know the method I have to use. Read something about percentiles. Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I have to calculate where 80% are on the x-axis and also where 80% are on the y-axis and then I got my rectangle corners, but how do I calculate the 80%?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/y836A.jpg&quot; alt=&quot;Sample data&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="26" LastEditDate="2013-03-27T18:17:26.627" LastActivityDate="2013-03-28T16:43:08.950" Title="Scatter plot: calculate box where 80 % of the points are" Tags="|statistics|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8395" PostTypeId="1" AcceptedAnswerId="8402" CreationDate="2013-03-27T08:06:02.700" Score="2" ViewCount="5343" Body="&lt;p&gt;I have a source that emits $M$ equiprobable messages, which are assigned signals $s_1, \dots,s_M,$ that are equidistant by $a$. That is, if we plot the $s_k$ signals in a horizontal axis they are dots separate by the same distance $a$. And so I would like to determine the optimum receiver and the corresponding error probability $P_{eM}$ for and AWGN channel as a function of $E_b/\cal N$.&lt;/p&gt;&#xA;" OwnerUserId="4224" LastActivityDate="2018-04-05T16:10:47.150" Title="Determine the optimum receiver and the corresponding $P_{eM}$ for an AWGN channel" Tags="|digital-communications|signal-analysis|gaussian|optimization|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8396" PostTypeId="2" ParentId="8393" CreationDate="2013-03-27T10:57:43.533" Score="3" Body="&lt;p&gt;intuitively speaking, H-level define how many level of DWT you need to perform on your signal in this case you need to perform 3rd level &quot;Daubechies-1&quot; wavelet Transform on your Signal, what that really mean is applying DWT on your signal 3 times,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how you are suppose to do that,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply DWT on your Signal to decompose it into &lt;code&gt;Approximations&lt;/code&gt; (low-frequency) and &lt;code&gt;Details&lt;/code&gt; (High-frequency). This is level 1 decomposition, according to your requirements we need to perform level 3 DWT therefore we will pick the Approximation(lets say &lt;code&gt;a1&lt;/code&gt;) of the above decomposed signal and again apply DWT to decompose it into more deep Approximations (let say &lt;code&gt;a2&lt;/code&gt;) and details (&lt;code&gt;d2&lt;/code&gt;), Now do it one more time for level 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is simple demonstration I've done using Matlab Wavelet toolbox,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/neMDc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;S is the original signal (&lt;code&gt;noissin&lt;/code&gt; in this case; which is a built-in waveform in matlab) which is decomposed in &lt;code&gt;a1&lt;/code&gt; and &lt;code&gt;d1&lt;/code&gt; we then picked &lt;code&gt;a1&lt;/code&gt; and applied DWT on this signal again to get &lt;code&gt;a2&lt;/code&gt; and &lt;code&gt;d2&lt;/code&gt;; &lt;code&gt;a2&lt;/code&gt; is further decomposed in &lt;code&gt;a3&lt;/code&gt; and &lt;code&gt;d3&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is the tree view of what i said earlier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KPbN4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to better understand how Wavelet transform works, type &lt;code&gt;wavemenu&lt;/code&gt; in the matlab command window then go to Wavelet 1-D option, load any built-in signal and play around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The built-in signal can be found in &lt;code&gt;Matlab Directory&lt;/code&gt; -&gt; &lt;code&gt;toolbox&lt;/code&gt; -&gt; &lt;code&gt;wavelet&lt;/code&gt; -&gt; &lt;code&gt;wavedemo&lt;/code&gt; folder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to perform perform level 3 decomposition in matlab I'd rather prefer &lt;code&gt;wavedec&lt;/code&gt; instead of &lt;code&gt;dwt&lt;/code&gt; because the syntax is far more easier and well explained,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is the syntax for &lt;code&gt;wavedec&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[C,L] = wavedec(X,N,'wname')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X = your Signal to decompose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N = Level; in your case it should be 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;wname = Wavelet to use; in your case it should be &lt;code&gt;'db1'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% L is the matrix that store length of each decomposed signal&#xA;% This is how it will be stored in Matrix of [C,L]&#xA;%----------------------------------&#xA;% C: |cA3|cD3|cD2|cD1|&#xA;%----------------------------------&#xA;%----------------------------------&#xA;% L: | (length cA3) | (length of cD3) | (length of cD2) | (length of cD1) |&#xA;%----------------------------------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2013-03-27T11:17:39.543" LastActivityDate="2013-03-27T11:17:39.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8397" PostTypeId="1" CreationDate="2013-03-27T12:01:47.880" Score="2" ViewCount="275" Body="&lt;p&gt;The question is revised to make it more specific and constructive. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing imtransform, yet the xdata and ydata are very much different from that of size(output).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[ output, xdata, ydata ] = imtransform( imgDouble{1}, tform );&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real data test: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;K&amp;gt;&amp;gt; size(output)&#xA;&#xA;ans =&#xA;&#xA;         854        1230&#xA;&#xA;K&amp;gt;&amp;gt; xdata(2) - xdata(1)&#xA;&#xA;ans =&#xA;&#xA;   1.6635e+03&#xA;&#xA;K&amp;gt;&amp;gt; ydata(2) - ydata(1)&#xA;&#xA;ans =&#xA;&#xA;  876.1373&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="4226" LastEditDate="2013-03-28T22:04:12.637" LastActivityDate="2013-03-28T22:04:12.637" Title="MATLAB: Why my Pixel Indices are so different from that in Spatial Coordinates" Tags="|image-processing|matlab|computer-vision|" AnswerCount="1" CommentCount="2" ClosedDate="2013-08-17T11:30:27.697" ContentLicense="CC BY-SA 3.0" />
  <row Id="8398" PostTypeId="2" ParentId="8344" CreationDate="2013-03-27T12:02:42.403" Score="1" Body="&lt;p&gt;Sorry, I couldn't access the paper behing the paywall, so here is an educated guess about the figure that you linked in the question.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$H_0$ is a low-pass filter, while $H_1$ is a high-pass filter. You can note that the union of both domains correctly yield the full bandwidth of the input signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;These filters are directional, i.e., they operate on different subbands that correspond to a set of orientations. This is shown in the figure by the 1,2,3,4 triangles: each triangle corresponds to a set of low/high-frequency of a given set of orientations. For example, 1 corrresponds to lower frequencies, and the slope of the lines in 1 is positive.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, the directional filter bank consists in two operations: separatig low/high frequencies (the &lt;em&gt;filter bank&lt;/em&gt; part) and applying a transfer function that also depends on the orientation of the current frequency (the &lt;em&gt;directional&lt;/em&gt; part).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm note sure that you can implement the figure from this explanation though. A good starting point now would be for you to look for an example code that does similar things.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-03-27T12:02:42.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8399" PostTypeId="2" ParentId="8376" CreationDate="2013-03-27T13:13:31.130" Score="6" Body="&lt;p&gt;As Dilip pointed out in the comment above, you can get the impulse response using the inverse &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform&quot;&gt;Fourier transform&lt;/a&gt;. However, a slightly easier method might be to use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_transform&quot;&gt;Laplace domain&lt;/a&gt; instead; it's more amenable to easy inverse transforming via transform tables. First, recall that the frequency response is really just the $s$-plane transfer function evaluated along the imaginary axis. That is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(j\omega) = H(s)|_{s=j\omega}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go through your frequency response expression and substitute $s$ back in for $j\omega$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;H(j\omega) &amp;amp;= \frac{1}{-\omega^2+3j\omega+2} \\&#xA;&amp;amp;= \frac{1}{(j\omega)^2+3j\omega+2} \\&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s) = \frac{1}{s^2+3s+2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now we have the transfer function in the $s$-plane. To get from here to an easily-inverse-transformable expression, we use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Partial_fraction&quot;&gt;partial fraction decomposition&lt;/a&gt; on the transfer function (&lt;a href=&quot;http://www.wolframalpha.com/widgets/view.jsp?id=ec4a062bb304f88c2ba0b631d7acabbc&quot;&gt;an online calculator is available here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s) = \frac{1}{s+1} + \frac{1}{s+2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this form, we now refer to a &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_transform#Table_of_selected_Laplace_transforms&quot;&gt;table of common Laplace transforms&lt;/a&gt; to find:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e^{-\alpha t} u(t) \Leftrightarrow \frac{1}{s+\alpha}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u(t)$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Heaviside_step&quot;&gt;Heaviside step function&lt;/a&gt;. The impulse response of the system is the inverse Laplace transform of its transfer function. Using the linearity of the Laplace transform and the above relation, we can therefore conclude that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(t) = u(t) \left(e^{-t} + e^{-2t} \right)&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-03-27T13:13:31.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8400" PostTypeId="2" ParentId="7981" CreationDate="2013-03-27T15:15:09.940" Score="2" Body="&lt;p&gt;If memory is your primary concern then an IIR filter is the way to go.  It uses very little memory and is pretty computationally efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FIR filters' memory length is one less than the number of filter taps.  This usually isn't that much, but it can add up if there are a number of filters and/or they are long.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-27T15:15:09.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8401" PostTypeId="1" AcceptedAnswerId="8403" CreationDate="2013-03-27T15:36:24.360" Score="6" ViewCount="234" Body="&lt;p&gt;I'm looking for a kind of error correction code or solution that can correct my codeword in this case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My message holds $k$ bits, and $2k$ bits codeword (rate is $1/2$) is produced by the generator matrix, e.g. $k=5$, so it yields $10$ bits codeword $\rm 1001100111$. If the codeword is erased for some reason and it becomes $\rm 1xx1x00xx1$ (similar to the codeword transmitted through Binary Erasure Channel, and $\rm x$ is unknown, either '$0$' or '$1$'), can I still correct all the &quot;$\rm x$ bits&quot; in such situation as bit error rate is $1/2$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read about some error correction code, such as block code, convolutional code and LDPC and got the following questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;All these ECC have pratical application in communication, so do they still work when BER is close to $1/2$ (I think BER is impossible so high)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Are there any feasible solution to my case? In fact, my message is $30$ bits and I can introduce another $30$ bits redundancy as parity bits. Can I still correct my codeword even if its half bits are erased where the recipient knows which bits he didn't receive properly?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What's the limit of ECC? If it can't correct half bits of codeword that are erased, how many bits can it correct at most?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any guides or suggestions are appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4227" LastEditorUserId="1629" LastEditDate="2016-06-02T08:29:07.640" LastActivityDate="2016-06-02T08:29:07.640" Title="Does any error correction code still work in such situation?" Tags="|digital-communications|information-theory|channelcoding|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8402" PostTypeId="2" ParentId="8395" CreationDate="2013-03-27T17:12:06.267" Score="4" Body="&lt;p&gt;As has been referenced in the comments already, you're describing a &lt;a href=&quot;http://en.wikipedia.org/wiki/Pulse-amplitude_modulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;pulse-amplitude modulation (PAM)&lt;/a&gt; signal constellation. The problem, as you've framed it, seems to suggest the &lt;a href=&quot;http://en.wikipedia.org/wiki/AWGN&quot; rel=&quot;nofollow noreferrer&quot;&gt;AWGN&lt;/a&gt; &lt;em&gt;vector channel&lt;/em&gt; (where symbols are described using discrete values $s_1$, $s_2$, and so on), in contrast to the &lt;em&gt;waveform channel&lt;/em&gt;, where symbols are expressed using waveforms that are transmitted over some period of continuous time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While in the real world, the waveform channel is often used as a communication medium, analysis of performance of digital communication systems is typically related back to the vector channel for ease of analysis. &lt;a href=&quot;http://www.stanford.edu/group/cioffi/book/chap1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This document&lt;/a&gt; has a discussion of the distinction between the two channels and how the conversion between the two is modeled mathematically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, you can frame the problem rather simply. Assume that at each symbol time, your receiver observes a value $x$, which is defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x = s_i + n,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the value of $i$ indicates the symbol that was transmitted. $s_i$ refers to the value that would be expected at the receiver in the case of no noise (i.e. $s_i$ refers to the amplitude that is transmitted for symbol $i$). I will state without proof that the optimal decision rule (for minimum probability of bit error) for the case of equiprobable input symbols and white Gaussian noise is to pick the symbol value whose constellation position is closest to the observed point. This result follows from Bayesian decision theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exact expression for the bit error rate will depend upon the coding of bits onto the symbols in your constellation. Borrowing a figure from an above comment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6YTje.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are examples of &lt;a href=&quot;http://en.wikipedia.org/wiki/Gray_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gray coded&lt;/a&gt; constellations, such that adjacent symbol positions only differ by one bit. These codings are used to minimize the probability of bit error for multi-bit-per-symbol modulations. You might ask: why do you need to know the symbol encoding in order to calculate the system's error performance? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer might not be obvious: the overall bit error probability is a single number that is averaged across the ensemble of all possible transmitted symbols and observed channel noise. However, it should be clear from the above figure that the bit error probability must be different based upon which symbol is actually transmitted. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Assume the $M=8$ case illustrated above, with a transmitted symbol of $000$. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The noise observed at the receiver $n$ can take on any value $&amp;lt; 0$ without having any chance of causing a bit error! $n$ could be $-10000000a$ (which is likely not very probable), but $000$ would still be the closest constellation position and therefore the receiver would make the right decision. We clearly couldn't say this for another transmitted symbol like $110$, however, so the bit error probability must be dependent upon the symbol that was actually transmitted.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Assuming a particular coding of bits onto the constellation (e.g. the illustrated Gray code), you can construct the &lt;a href=&quot;http://en.wikipedia.org/wiki/Conditional_probability&quot; rel=&quot;nofollow noreferrer&quot;&gt;error probability conditioned on the actually-transmitted symbol&lt;/a&gt;. I will tackle the $M=4$ case from above because it is simpler than the 8-point constellation, but the same principle applies. While the spacing between points isn't shown on the graph (because I'm too lazy to draw one), the points from left to right should be located at $-1.5a$, $-0.5a$, $0.5a$, and $1.5a$, respectively. Remember that the optimum receiver chooses the constellation point that is closest to the observed value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P(\text{error | 00 transmitted}) = \frac{1}{2} \\&#xA;(P(\text{choose 01 | 00 transmitted}) + \\ &#xA;2 P(\text{choose 11 | 00 transmitted}) + \\ &#xA;P(\text{choose 10 | 00 transmitted}) )&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we've very straightforwardly stated what the probability of a bit error is for this case. If $00$ was transmitted and $01$ is chosen by the receiver, then you have one bit error; if $11$ is chosen by the receiver, you have 2 bit errors; and so on. Since we know the decision rule employed by the receiver, we can state this more directly in terms of the observation. Remember that if the symbol $00$ was transmitted, then the observation should have the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x = s_i + n = -1.5a + n&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P(\text{error | 00 transmitted}) = \frac{1}{2} \\ &#xA;(P(-a &amp;lt; x &amp;lt; 0\ |\ x = -1.5a + n) + \\&#xA;2P(0 &amp;lt; x &amp;lt; a\ |\ x = -1.5a + n) + \\&#xA;P(x &amp;gt; a\ |\ x = -1.5a + n) )&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can rearrange the above to be solely in terms of the noise term $n$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P(\text{error | 00 transmitted}) = \frac{1}{2} \\&#xA;\left(P(0.5a &amp;lt; n &amp;lt; 1.5a) + \\&#xA;2P(1.5a &amp;lt; n &amp;lt; 2.5a) + \\&#xA;P(x &amp;gt; 2.5a)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the AWGN channel, $n$ is a sample from a zero-mean white Gaussian random process. Assuming the noise process has variance $\sigma^2$, the above probabilities can be written in terms of the Gaussian distribution's tail probability function, known as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Q_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P(\text{error | 00 transmitted}) = \frac{1}{2} \left(\left(Q\left(\frac{0.5a}{\sigma}\right) - Q\left(\frac{1.5a}{\sigma}\right)\right) + 2\left(Q\left(\frac{1.5a}{\sigma}\right) - Q\left(\frac{2.5a}{\sigma}\right)\right) + Q\left(\frac{2.5a}{\sigma}\right)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most cases, the error probability will be dominated by the closest constellation points (the noise is unlikely to be large enough to cause you to skip multiple points over in the constellation, so the corresponding probabilities will be small compared to those for the nearby points), but for strict correctness, you would need to include all of the terms. You can then repeat this analysis for each constellation point, calculating what the probability of making all of the incorrect choices are. Then, to arrive at a single bit error probability number, you use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Law_of_total_probability&quot; rel=&quot;nofollow noreferrer&quot;&gt;law of total probability&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P_e = \sum_{i=1}^{M} P(\text{error | }s_i\text{ transmitted}) P(s_i\text{ transmitted})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since all of the symbols are equally probable,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P(s_i\text{ transmitted}) = \frac{1}{M}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P_e = \frac{1}{M} \sum_{i=1}^{M} P(\text{error | }s_i\text{ transmitted}) &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that is how you would calculate the bit error performance for an arbitrary PAM constellation. Note that it is inherently a function of the signal-to-noise ratio, implied via the proxy values of $a$ (which is related to the received amplitudes, which is related to the received &quot;energy per bit&quot; $E_b$) and the noise variance $\sigma^2$ (which is also often dubbed $N_0$ in digital communications analysis). You could manipulate the above for given values of $M$, $a$, and $\sigma^2$ to arrive at a final result that is a function of the typical metric $\frac{E_b}{N_0}$. That is left as an exercise to the reader.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-03-28T16:17:59.970" LastActivityDate="2013-03-28T16:17:59.970" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8403" PostTypeId="2" ParentId="8401" CreationDate="2013-03-27T21:07:28.547" Score="5" Body="&lt;p&gt;I'm afraid that this will be an incomplete answer, but I'm giving it in the hopes that it is better than nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is impossible to recover any information with a BER of 50% because, as information theory tells us, no information is getting through such a channel.  You can see this intuitively if you realize that no matter what bit you send, 0 or 1, it has equal chance of arriving at the receiver as a 0 or 1, so what you receive tells you nothing about what was actually sent.  In such a case it is theoretically impossible to create an ECC that will help at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Erasures are, in some situations, better than errors though.  Reed-Solomon decoders often use erasures to increase their error correction capability.  The reason why it works is because with RS codes you have two sets of unknowns: the error locations and the error magnitudes (the number of errors is also an implicit unknown).  Erasures give the decoder the error location so it only needs to figure out the magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Talking about &quot;erasures&quot; in the context of bits, though, makes little sense because with bit-based codes there is only one set of unknowns: the error locations.  The error magnitudes are always 1.  So if you have a bit &quot;erasure&quot; you are trading one unknown (error location) for another (error magnitude).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With bit-based codes like Viterbi codes the analog to erasures is using soft-decisions.  Soft-decisions contain &quot;confidence&quot; information- i.e. how sure the receiver is that the bit is really a 1 or really a 0.  That information can be used to greatly improve decoder performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that being said, though, if your error/erasure rate is really that high you will probably not get good performance out of any ECC.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-27T21:07:28.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8404" PostTypeId="1" AcceptedAnswerId="8405" CreationDate="2013-03-28T09:16:48.277" Score="9" ViewCount="2667" Body="&lt;p&gt;I am using IIR filter for smoothing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = ax[n]+(1-a)y[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, if I add another IIR filter, will it be the second order of IIR filter? If not, what it can be called?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_2[n] = ay[n] + (1-a)y_2[n-1] $$&lt;/p&gt;&#xA;" OwnerUserId="4234" LastEditorUserId="128" LastEditDate="2019-02-13T09:16:42.670" LastActivityDate="2019-02-13T09:16:42.670" Title="IIR Filter for Smoothing (Low Pass Filter)" Tags="|infinite-impulse-response|smoothing|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8405" PostTypeId="2" ParentId="8404" CreationDate="2013-03-28T12:26:34.977" Score="7" Body="&lt;p&gt;If you apply two filters in a series cascade, then the behavior of the cascade can be expressed in two different ways. In the time domain, the overall system's impulse response can be calculated by convolving the impulse responses of $y[n]$ and $y_2[n]$ together. For IIR filters, this can be somewhat cumbersome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain, the overall system's $z$-domain transfer function can be calculated by multiplying the transfer functions $H_y(z)$ and $H_{y_2}(z)$ together. This is usually a much easier route for filters with feedback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the two filters actually have the same input/output relationship (assuming that $y[n]$ is the input to $y_2[n]$. Using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform&quot; rel=&quot;nofollow&quot;&gt;$z$-transform&lt;/a&gt;, it's easy to find that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H_y(z) = H_{y_2}(z) = \frac{Y(z)}{X(z)} = \frac{a}{1 - (1-a)z^{-1}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the relationship I mentioned above, you can calculate the transfer function of the two filters in cascade using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = H_y(z) H_{y_2}(z) = \left(\frac{a}{1 - (1-a)z^{-1}}\right)^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = \frac{a^2}{1 - 2(1-a)z^{-1} + (1-a)^2z^{-2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can just as easily use the inverse $z$-transform to arrive back at the difference equation for the two cascaded filters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y_c[n] = a^2x[n] - 2(1-a)y[n-1]+(1-a)^2y[n-2]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By inspection, we can state that this is a second-order filter (provided $a \not= 1\ $), as you suspected.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2014-06-26T16:05:19.743" LastActivityDate="2014-06-26T16:05:19.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8406" PostTypeId="2" ParentId="8404" CreationDate="2013-03-28T13:03:30.680" Score="3" Body="&lt;p&gt;Yes, the combination of the two first order IIR filters would be called a 2nd order IIR filter. The process of combining two first order filters to form a second order filter is called cascading. &lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-03-28T13:03:30.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8407" PostTypeId="2" ParentId="8394" CreationDate="2013-03-28T14:10:07.447" Score="2" Body="&lt;p&gt;Your question seems to imply that there will always be just a single cluster of points.  If this is the case, I would go with a fairly simple heuristic like the following-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the mean and variance of the point positions in both the x and y directions.  The mean is the center point of your box, and you can use the ratio of the x/y variances to determine in which directions the box should grow faster.  For instance, if the x variance is &quot;1&quot; and the y variance is &quot;2&quot;, I would have the box expand twice as fast in the y direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now simply expand the box until you have at least 80% of the points contained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is ever more than one cluster of points you may need to use a more sophisticated solution that uses clustering algorithms to identify the clusters and a box for each cluster.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-03-28T14:10:07.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8408" PostTypeId="1" AcceptedAnswerId="8417" CreationDate="2013-03-28T14:43:23.997" Score="1" ViewCount="2350" Body="&lt;p&gt;I have computed the MFCCs for two audio files and applied the DTW to both sets of coeficients for both files. Now each such pair the two files is described by one single value (computed by the DTW). Let's call this value Diff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the audio files differ more, then Diff is greater, which is great. (so Diff is proportional to the difference between the audio signals - great!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that Diff seems to be also proportional to the length of the files (?). Therefore, for two &lt;em&gt;similar&lt;/em&gt; long audio signals, Diff might be greater than for two &lt;em&gt;different&lt;/em&gt; short signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I thought that, as DTW computes the shortest path for two arrays, the final value should be proportional to the lenght of the two arrays (i.e. the number of frames for each of the signals). So I tried dividing it by the product and by the average of the two lenghts but the results was discouraging (too big for some files that did not differ so much, too small for others).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I thought that if it is proportional to the lenght of the files, then dividing it to the average number of frames (in which I divided the two signals for computing the MFCCs) would do the trick... but it didn't...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I thought that, as the MFCCs are computed from the result of the FFT, the final DTW result might be proportional to the sum of the FFT magnitudes, so I tried dividing it by this sum (of the spectrum elements, returned by the FFT algorithm). Again, the results were not what I hoped them to be...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I'm out of ideas... What is the DTW result depending on, what is it proportional to?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Here are some values, after pichenettes' suggestion to try the geometric average of the lengths of the files:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;same sound . avgLengths = 106000. Diff = 409. Diff / avgLengths = 38&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;same sound . avgLengths = 191000. Diff = 609. Diff / avgLengths = 31&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;diff sounds. avgLengths =  80000. Diff = 437. Diff / avgLengths = 55&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;diff sounds. avgLengths = 193000. Diff = 692. Diff / avgLengths = 35&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;38 &gt; 35 :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(the sounds from 2. and 4. are almost similar, and so are the ones from 1. and 3. In 1. the trailing silence for one file is a little longer)&lt;/p&gt;&#xA;" OwnerUserId="4200" LastEditorUserId="4200" LastEditDate="2013-03-29T09:10:24.217" LastActivityDate="2013-03-29T13:32:45.520" Title="What is the DTW result (applied to the MFCCs of an audio file) proportional to?" Tags="|speech-recognition|sound|mfcc|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8409" PostTypeId="2" ParentId="8397" CreationDate="2013-03-28T15:08:14.297" Score="1" Body="&lt;p&gt;It is about &lt;a href=&quot;https://www.mathworks.com/help/images/image-coordinate-systems.html#brcu_cr&quot; rel=&quot;nofollow noreferrer&quot;&gt;Expressing Image Locations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two kinds of image location expression, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One and the most common one is the &lt;/p&gt;&#xA;&#xA;&lt;p&gt;pixel indices: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in row and column&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other one is Intrinsic Coordinate System: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;express in x and y: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://www.mathworks.com/help/images/intro_r_1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.903" LastActivityDate="2013-03-28T22:00:18.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8410" PostTypeId="1" AcceptedAnswerId="8413" CreationDate="2013-03-28T15:44:19.857" Score="4" ViewCount="1705" Body="&lt;p&gt;I have created a Low Pass filter (I am trying to understand the topic of DSP, and it's hard.. But moving along with samples, books and a nice post on &lt;a href=&quot;https://stackoverflow.com/questions/15479785/low-pass-audio-filter-calculating-rms-on-ios&quot;&gt;Stack Overflow&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am saving the 'output' to a file, and I hear a constant clicking noise (very rapid, medium-pitch). The volume (intensity) of the 'clicking' gets louder as there is more intensity (in the passband of my filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been reading something about possible Artifacts when designing filters (FIR), but I am wondering if this is the constant clicking noise I hear ? It's not bad for my system, because I try to measure the intensity of the 0..100Hz band, and the clicking increases when the low sound increases. But I am just wondering if it's bad, or a possible symptom of a flaw in my filter ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Filter (of-course the getLPCoefficientsButterworth2Pole() is called first):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double ax[3];&#xA;double by[3];&#xA;double xv[3];&#xA;double yv[3];&#xA;&#xA;void getLPCoefficientsButterworth2Pole(const int samplerate, const double cutoff, double* const ax, double* const by)&#xA;{&#xA;double PI = M_PI;&#xA;double sqrt2 = sqrt(2);&#xA;&#xA;double QcRaw  = (2 * PI * cutoff) / samplerate; // Find cutoff frequency in [0..PI]&#xA;double QcWarp = tan(QcRaw); // Warp cutoff frequency&#xA;&#xA;double gain = 1 / ( 1 + sqrt2 / QcWarp + 2 / ( QcWarp * QcWarp ) );&#xA;&#xA;by[2] = ( 1 - sqrt2 / QcWarp + 2 / ( QcWarp * QcWarp ) ) * gain;&#xA;by[1] = ( 2 - 2 * 2 / ( QcWarp * QcWarp ) ) * gain;&#xA;by[0] = 1;&#xA;&#xA;ax[0] = 1 * gain;&#xA;ax[1] = 2 * gain;&#xA;ax[2] = 1 * gain;&#xA;}&#xA;&#xA;void process(MTAudioProcessingTapRef tap, CMItemCount numberFrames,&#xA;         MTAudioProcessingTapFlags flags, AudioBufferList *bufferListInOut,&#xA;         CMItemCount *numberFramesOut, MTAudioProcessingTapFlags *flagsOut)&#xA;{&#xA;OSStatus err = MTAudioProcessingTapGetSourceAudio(tap, numberFrames, bufferListInOut,&#xA;                                                  flagsOut, NULL, numberFramesOut);&#xA;&#xA;if (err)&#xA;    NSLog(@&quot;Error from GetSourceAudio: %ld&quot;, err);&#xA;&#xA;float leftVolume, rightVolume;&#xA;&#xA;NSLog(@&quot;Test: %f&quot;, xv[1]);&#xA;&#xA;for (CMItemCount i = 0; i &amp;lt; bufferListInOut-&amp;gt;mNumberBuffers; i++) {&#xA;    AudioBuffer *pBuffer = &amp;amp;bufferListInOut-&amp;gt;mBuffers[i];&#xA;    int cSamples = numberFrames * pBuffer-&amp;gt;mNumberChannels;&#xA;&#xA;    float *pData = (float *)pBuffer-&amp;gt;mData;&#xA;    float rms = 0.0f;&#xA;&#xA;    for (int j = 0; j &amp;lt; cSamples; j++) {&#xA;&#xA;        xv[2] = xv[1];&#xA;        xv[1] = xv[0];&#xA;&#xA;        xv[0] = pData[j];&#xA;        yv[2] = yv[1];&#xA;        yv[1] = yv[0];&#xA;&#xA;        yv[0] =   (ax[0] * xv[0] + ax[1] * xv[1] + ax[2] * xv[2]&#xA;                   - by[1] * yv[0]&#xA;                   - by[2] * yv[1]);&#xA;&#xA;        pData[j] = 20 * yv[0];&#xA;        rms += yv[0] * yv[0];&#xA;&#xA;    }&#xA;&#xA;    if (cSamples &amp;gt; 0) {&#xA;        rms = sqrtf(rms / cSamples);&#xA;    }&#xA;&#xA;    if (0 == i) {&#xA;        leftVolume = rms;&#xA;    }&#xA;&#xA;    if (1 == i || (0 == i &amp;amp;&amp;amp; 1 == bufferListInOut-&amp;gt;mNumberBuffers)) {&#xA;        rightVolume = rms;&#xA;    }&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4238" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2013-03-29T16:12:26.493" Title="Low Pass Filter Artifacts" Tags="|audio|lowpass-filter|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8411" PostTypeId="2" ParentId="8410" CreationDate="2013-03-28T15:58:11.007" Score="3" Body="&lt;p&gt;Common causes of clicking sounds in filter output are &lt;a href=&quot;http://en.wikipedia.org/wiki/Clipping_%28audio%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;clipping&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/10974336/fixed-point-fir-filter-output-size&quot;&gt;accumulator overflo&lt;/a&gt;w (the numbers your filter is summing together are integers and go larger than the largest possible integer stored on your device).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having a plot (or the actual samples) of the output would help identify which issue (of these or others not mentioned) it is.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Thanks for uploading!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not clear &lt;em&gt;why&lt;/em&gt; these are happening, but it seems like your filter implementation is inducing the clicks.  This plot shows a zoomed-in look towards the start of the signal.  There are many tiny glitches that I do not believe should be there and these are the clicks that can be heard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to share you low pass filter implementation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JoZ3D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-03-28T16:35:25.417" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8412" PostTypeId="2" ParentId="8394" CreationDate="2013-03-28T16:43:08.950" Score="1" Body="&lt;p&gt;First of all, I donot think you described your problem properly, because you might find multiple 'boxes' containing 80% of points. I call your box of interest as BOI in the rest of my post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've no idea what you gonna to do with this BOI, but I guess you are trying to do some data visualization or find criteria to differentiate outliners. There are many more professional ways to visualize scatter data points within a certain confidence interval. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, these algorithms normally do the following things&#xA;1) estimate the statistics of the given sample data, eg. mean and standard deviation&#xA;2) compute the confidence interval of a certain level, according to your prescribed data distribution or estimated distribution&#xA;3) plot the contours of the found confidence interval on the scatter plot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the rectangular region of a confidence interval sounds simple, it is clearly less accurate than than other shapes, e.g. a eclipse used in guassian distributed data. So if you are writing a scientific report, please follow these existing methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you insist to find the BOI, you can following the similar steps with additional considerations on defining the best BOI of all found BOIs. Why? Because you shall see multiple BOIs that containing 80% of data points. To be frank, finding the best BOI is a task that is more difficult then it looks like. However, several things are clear here:&#xA;1) the mean point of the data set should be in the best BOI &#xA;2) we should define what is your best BOI (I think the BOI with the minimum variance should be the best)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following described method is actually something like the histogram analysis. To find the best BOI, you shall put your data points into bins, and allows us to compute histogram later. Note the bin width defines the resolution of our method. If it is too big, for example, as wide as your data point span, then you will never find a so-call 80% BOI. If it is tot small, for example, the finite precision of your machine, then you might take hours to find the best BOI. In general, simply pick something moderate is OK (or you can implement adaptive methods to pick the width and height of the bin for you data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume you pick the bin size. Then you simply compute the histogram of your data $T=\textrm{Hist}(Data|bin)$, where each bin contains an integer number of points. You should have a 2D histogram if your data is 2D. Once you get this histogram, retrieve its height $h$ and width $w$, then do the following things, you shall find the unique BOI defined as the quadruple of $(x,y,W,H)$, where $x,y$ defines the upper-left point of the $W\times H$ BOI. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Construct the integral image of this histogram&#xA;$\textrm{II}(T)$(how to do? see details in wiki. This fast method&#xA;will allow you to compute the number of points within an arbitrary&#xA;BOI for only three operations.)&lt;/li&gt;&#xA;&lt;li&gt;Initialize $v_{min} = realmax$&lt;/li&gt;&#xA;&lt;li&gt;For each possible BOI size $W\times H$, you retrieve the number of data points of $W\times H$ BOI from $\textrm{II}(T)$&lt;/li&gt;&#xA;&lt;li&gt;Eliminate all candidate BOIs without the mean point&lt;/li&gt;&#xA;&lt;li&gt;Eliminate all candidate BOIs with less than 80% points&lt;/li&gt;&#xA;&lt;li&gt;Compute the variance of data points within each candidate BOI&lt;/li&gt;&#xA;&lt;li&gt;Find the BOI with the minimum variance as $v$ of size $W\times H$&lt;/li&gt;&#xA;&lt;li&gt;If $v&amp;lt;v_{min}$, then update $v_{min}=v$ and record the quadruple of this BOI.&lt;/li&gt;&#xA;&lt;li&gt;Repeat step 3-8 until you search all possible sizes&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In the end, this should give you a unique BOI with the minimum variance. Depending on the number of data points and the bin size, you might expect the above algorithm takes a reasonable long time to get your the best BOI.  &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-03-28T16:43:08.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8413" PostTypeId="2" ParentId="8410" CreationDate="2013-03-28T19:53:16.150" Score="5" Body="&lt;p&gt;From the audio clip posted on soundcloud, it looks like there's a discontinuity in the output every ~2060th sample. I suspect that you process your audio stream by blocks and that you do not save/restore the state variables of your filter between each call to the filtering function - so every time you process a new chunk of audio it is as if it was preceded by zeros - which is not the case obviously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8272/strange-noises-when-filtering-audio-signal/8273#8273&quot;&gt;Related question.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-03-28T19:53:16.150" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8414" PostTypeId="1" CreationDate="2013-03-28T21:54:55.753" Score="0" ViewCount="148" Body="&lt;p&gt;The choice of frame length for calculating the Mel Frequency Cepstral Coefficients of a signal, depend on the how much the signal change over a small time scale.&#xA;I guess that human speech change rapidity while some animal sound change more slowly, but what is the measure of small time scale of an audio signal?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastEditorUserId="6" LastEditDate="2013-03-29T17:47:02.770" LastActivityDate="2013-03-29T17:47:02.770" Title="How to measure the short-time change in an audio signal?" Tags="|audio|discrete-signals|signal-analysis|mfcc|cepstral-analysis|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8416" PostTypeId="2" ParentId="8309" CreationDate="2013-03-29T09:03:42.493" Score="3" Body="&lt;p&gt;Instead of nulling the 2 quadrants, multiply them by $i$. Then the real part will be one image and the imaginary part the other image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;X = fftshift(fft2( x )); % x is the input (image above)&#xA;X( 1:floor(size(X,1)/2),    1:floor(size(X,2)/2)   ) = ...&#xA;    X( 1:floor(size(X,1)/2),    1:floor(size(X,2)/2)   ) * 1i;&#xA;X( ceil(size(X,1)/2)+1:end, ceil(size(X,2)/2)+1:end) = ...&#xA;    X( ceil(size(X,1)/2)+1:end, ceil(size(X,2)/2)+1:end) * 1i;&#xA;y = ifft2( ifftshift(X) );&#xA;imagesc(real(y)); pause;&#xA;imagesc(imag(y)); pause;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since this is unitary operation the energy of this complex image will be the same as the original, as will the noise energy. Doesn't look very white to me though, seems there is differences between entire rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get rid of the artefacts, you could use a smoother function such as cosine of the angle of the spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;pre&gt;&lt;code&gt;&#xA;[rows,cols] = size(x);&#xA;IM = fft2(x);&#xA;% Create polar co-ordinate of FFT&#xA;[ux, uy] = meshgrid(([1:cols]-(fix(cols/2)+1))/(cols-mod(cols,2)), ...&#xA;    ([1:rows]-(fix(rows/2)+1))/(rows-mod(rows,2)));&#xA;ux = ifftshift(ux);   % Quadrant shift to put 0 frequency at the corners&#xA;uy = ifftshift(uy);&#xA;th = atan2(uy,ux);&#xA;r = sqrt(ux.^2 + uy.^2);&#xA;% cos^2&#xA;R2 = cos(th +pi/4).^2 + 1i*cos(th +3*pi/4).^2;&#xA;R2(1,1) = 0;&#xA;I_a = real(ifft2(R2.*IM));&#xA;I_b = imag(ifft2(R2.*IM));&#xA;imagesc(I_a); pause;&#xA;imagesc(I_b); pause;&#xA;&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think the energy remains constant in this case, but assuming white noise energy the noise of the resulting two images should be similar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the polar form of the spectrum it will be easier to experiment and create smoother cutoffs. For example, you could 'narrow' the angle of the filter to isolate the wave further.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-03-29T09:03:42.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8417" PostTypeId="2" ParentId="8408" CreationDate="2013-03-29T13:32:45.520" Score="3" Body="&lt;p&gt;DTW is not proportional to anything, including frame length. It's not a good idea to compare DTW values between two different pairs like you are doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that DTW is not just the number but also an alignment. If alignment does not match, you can not relate numbers. You only can relate numbers if you align to the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalization is often suggested, but mathematically it doesn't have much sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In classical tasks like speech recognition you never compare the DTW values between pairs, instead, you compare a sample to several templates and find the best one. The fact that you try to match to same sample allows you to compare DTW values. In keyword spotting using DTW the threshold must depend on every template you are matching, you can not use single threshold for all the templates. Even more, for the two different templates of the same length DTW thresholds must be different.&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2013-03-29T13:32:45.520" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="8418" PostTypeId="1" AcceptedAnswerId="8419" CreationDate="2013-03-29T15:04:47.007" Score="18" ViewCount="28324" Body="&lt;p&gt;I would like to create white noise in the frequency domain, and then transform it to the time domain using python. To understand the problem, I simply generated white noise in the time domain, and transformed it to freq domain: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import scipy.signal as sg&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;e = np.random.normal(0,1,1e3)&#xA;E = sg.fft(e)&#xA;&#xA;plt.figure(&quot;Bode plot&quot;)&#xA;plt.subplot(211)&#xA;plt.title(&quot;Magitude&quot;)&#xA;plt.plot(abs(E))&#xA;plt.subplot(212)&#xA;plt.title(&quot;Phase&quot;)&#xA;plt.plot(np.angle(E))&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I does not look at all as I expected:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6pqXw.png&quot; alt=&quot;Bode plot of white noise&quot;&gt;&#xA;Questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Isn't white noise supposed to have a flat magnitude response? (equal amounts for all frequencies)&lt;/li&gt;&#xA;&lt;li&gt;What is the relationship between the standard deviation (1 in my example) and the magnitude and phase?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="4186" LastActivityDate="2019-06-18T01:31:23.387" Title="What is the phase and magnitude response of white noise?" Tags="|fft|noise|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8419" PostTypeId="2" ParentId="8418" CreationDate="2013-03-29T16:00:37.407" Score="25" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Isn't white noise supposed to have a flat magnitude response? &#xA;      (equal amounts for all frequencies)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;expected&lt;/em&gt; magnitude response of white noise is flat (this is what JasonR calls the power spectral density).  Any particular instance of a white noise sequence will not have precisely flat response (this is what JasonR's comment refers to as the power spectrum).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/White_noise#White_noise_vector&quot; rel=&quot;noreferrer&quot;&gt;In fact, the Fourier transform of white noise is... white noise!&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the relationship between the standard deviation &#xA;      (1 in my example) and the magnitude and phase?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There will be no relationship between the standard deviation and the phase.  As for the magnitude, suppose &lt;span class=&quot;math-container&quot;&gt;$n(t)$&lt;/span&gt; is stationary white noise with zero mean and standard deviation &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. Then the autocorrelation (covariance) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{nn}(\tau) = E[n(t)n(t+\tau)] = \sigma^2\delta(\tau)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the power spectral density is just &lt;span class=&quot;math-container&quot;&gt;$\sigma^2$&lt;/span&gt; (though for discrete-time, there will be a scaling based on the duration of the signal).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Questions from comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;When you say that the Fourier transform is also white noise, &#xA;  how can I measure the std-dev when the transform is complex? Real, &#xA;  imaginary part or some combination? &lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Assume that our noise is discrete-time and is &lt;span class=&quot;math-container&quot;&gt;$n[m]$&lt;/span&gt; (zero mean, Gaussian, white noise with variance &lt;span class=&quot;math-container&quot;&gt;$\sigma^2$&lt;/span&gt;).  Then the transform is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{eqnarray}&#xA;N[k] &amp;amp;=&amp;amp; \sum_{m=0}^{M-1} n[m] e^{-j2\pi mk/M} \\&#xA; &amp;amp;=&amp;amp; \sum_{m=0}^{M-1} n[m] \cos(2\pi mk/M) + j n[m] \sin(2\pi mk/M)&#xA;\end{eqnarray}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the expected value is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{eqnarray}&#xA;E\left[N[k]\right] &amp;amp;=&amp;amp; E\left[\sum_{m=0}^{M-1} n[m] e^{-j2\pi mk/M} \right]\\&#xA;&amp;amp;=&amp;amp; \sum_{m=0}^{M-1} E\left[n[m]\right] e^{-j2\pi mk/M} \\&#xA;&amp;amp;=&amp;amp; 0&#xA;\end{eqnarray}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variance of the real part is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{eqnarray}&#xA;E\left[ (\Re N[k])^2 \right] &amp;amp;=&amp;amp; E \left [ \sum_{m=0}^{M-1} n[m] \cos(2\pi mk/M)  \cdot \sum_{p=0}^{M-1} n[p] \cos(2\pi pk/M) \right ]\\&#xA;&amp;amp;=&amp;amp; E\left[ \sum_{m=0}^{M-1} \sum_{p=0}^{M-1} n[m]n[p] \delta[n-p] \cos(2\pi mk/M)\cos(2\pi pk/M) \right]\\&#xA;&amp;amp;=&amp;amp; \sum_{m=0}^{M-1} E\left[ n[m]^2 \right]\cos^2(2\pi mk/M)\\&#xA;&amp;amp;=&amp;amp; \sigma^2\sum_{m=0}^{M-1} \cos^2(2\pi mk/M)\\&#xA;&amp;amp;=&amp;amp; \sigma^2 \left( \frac{M}{2} +  \frac{\cos(M+1) 2\pi k/M \sin(2\pi Mk/M) }{ 2 \sin (2\pi k/M) } \ \ \ \right)\\&#xA;&amp;amp;=&amp;amp; \frac{\sigma^2 M}{2}&#xA;\end{eqnarray}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the imaginary part will behave the same way.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;Could you please enlighten me how the duration of the signal relates &#xA;  to the power spectral density (for discrete time situations) &lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I believe that (based on the above derivation), the power spectral density (the expected value of the square of the DFT) will scale linearly as the duration. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;3&quot;&gt;&#xA;  &lt;li&gt;If the phase is not affected by the std-dev, what determines the 3 degree amplitude, and the type of distribution (seems to be uniform rather than normal) &lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://radarsp.weebly.com/uploads/2/1/4/7/21471216/dft_of_noise.pdf&quot; rel=&quot;noreferrer&quot;&gt;Check out the table on page 2 of this PDF file&lt;/a&gt;. it says that the argument (phase) of the coefficients will be uniformly distributed, as you state. Screenshot of the table included below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ue5eW.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2019-06-18T01:31:23.387" LastActivityDate="2019-06-18T01:31:23.387" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8420" PostTypeId="2" ParentId="8319" CreationDate="2013-03-29T16:16:44.397" Score="8" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What's not clear to me is what the fundamental difference (if any) is between simulating an analog filter and making a digital filter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Either way, these functions will produce &quot;ba&quot; transfer function outputs, but the b and a are totally different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a 2nd-order filter, for instance, b = [b0, b1, b2] and a = [a0, a1, a2].  These are the coefficients of the transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an analog filter, this represents a transfer function like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s) = \frac{b_2 s^2 + b_1 s + b_0}{a_2 s^2 + a_1 s + a_0}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a digital filter, the transfer function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{b_0+b_1z^{-1}+b_2z^{-2}} {a_0+a_1z^{-1}+a_2z^{-2} }$$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note that the input signal is an array of values&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then you are doing digital filtering.  You can &lt;em&gt;simulate&lt;/em&gt; analog filtering this way, but it's only going to be a simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the &lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/signal.html#matlab-style-iir-filter-design&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python IIR filter functions&lt;/a&gt; you're talking about, when outputting a digital filter, design it as an approximation of the analog filter using an analog filter transfer function prototype and then converting it to digital using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;bilinear transform&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Bilinear_transform#Frequency_warping&quot; rel=&quot;nofollow noreferrer&quot;&gt;frequency warping&lt;/a&gt;.  Yes, they can output analog transfer functions, but I think that's only useful for building actually analog electronic filters, or for plotting the &lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.signal.freqs.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;frequency response&lt;/a&gt;, &lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.signal.impulse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;impulse response&lt;/a&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Bessel in particular is a bad approximation as you get near fs/4, because the important property of a Bessel filter is group delay, not amplitude, and phase/group delay is not preserved by the bilinear transform (red vertical line is fs/4):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wDcRe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://secure.flickr.com/photos/56868697@N00/tags/besselfilter/&quot; rel=&quot;nofollow noreferrer&quot;&gt;More plots of digital Bessel filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can make the simulation closer to what an analog filter would produce by putting a large margin between the highest frequency in your signal and the sampling frequency, called &lt;a href=&quot;https://en.wikipedia.org/wiki/Oversampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;oversampling&lt;/a&gt;.  Assuming your &quot;array of values&quot; is correctly bandlimited, then you can upsample them and then apply the digital filter using &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lfilter.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;lfilter&lt;/a&gt; and the ba digital filter coefficients you found earlier.  If not, you need to bandlimit the analog signal and then sample it at a significantly higher rate.  How did you get your sampled signal?  If you are generating it digitally, it is probably not bandlimited, unless you specifically thought of bandlimiting while generating it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;for example a 1st-order Bessel filter&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All 1st-order filters are the same, the &quot;1st-order Bessel&quot; is the same thing as a &quot;1st-order Butterworth&quot; or anything else.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-05-07T15:47:12.877" LastActivityDate="2013-05-07T15:47:12.877" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="8421" PostTypeId="1" CreationDate="2013-03-29T03:21:44.583" Score="-1" ViewCount="210" Body="&lt;p&gt;Consider filtering square n*n images by square,separable m*m filters. What are the general computation time for the following approaches 1) FFT 2) by 2-D convolution 3) by two 1-D convolutions. (Capital letters to indicate implementation-dependent constants) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.s what does it mean for a 2-D filter to be separable? &#xA;    what are the different and specific procedure of these three approaches?  &lt;/p&gt;&#xA;" OwnerDisplayName="grace" LastEditorUserId="128" LastEditDate="2020-04-27T06:34:55.480" LastActivityDate="2020-04-27T06:34:55.480" Title="Comparing Computation Time of Applying Separable 2D Convolution: 2D Direct Convolution, 2 1D Convolutions, Frequency Domain" Tags="|fft|convolution|image-processing|performance|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8422" PostTypeId="2" ParentId="8421" CreationDate="2013-03-29T06:32:15.833" Score="1" Body="&lt;p&gt;That's a fairly broad brushed question. By 'general computation time' I presume that you mean how many floating point operations are performed by each of the three methods? Well, there's standard theoretical answers to that question which I don't know off the top of my head.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think that matters because in my experience taking that theoretical number of operations and applying that to the theoretical GFLOPs score of the CPU in question won't get anywhere close to the real world runtime. The runtime of any particular algorithm depends on so many factors like CPU clock frequency, cache sizes, data sizes, and the cleverness of the library routine itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The library routine you use makes a huge difference. Some associates of mine once did some benchmarking on 1D FFTs on PowerPC with Altivec and found that the best (a proprietary library) was 30% faster than the next best, which was the open source FFTW. In our situation that was hugely significant. When you're building a system with tight real time and size requirements you gladly pay for a library that allows you to throw away one third of your hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general I've always ended up doing complex FFTs rather than convolution, they always seem to be a bit faster. Complex FFTs always seem a bit quicker than the real equivalent - seems to be to do with the data movements matching the cache behaviours a bit better. Of course that depends on pre computing the twiddle factors for the FFT beforehand. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general I've found for big, cache busting data sets that clock speed doesn't matter a damn but memory speed does (so Intel i7 is really good for that). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For smaller data sets PowerPC has until very recently been king (a decent library + Altivec is way better than Intel's library + SSE, overcoming the clock rate difference). That was because Altivec's architecture allows you to do so many parts of the FFT all at once as well as featuring a fused multiply-add instruction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However Intel have stepped up finally and given X86 a fused multiply-add, and AVX is 256 bits wide. So I suspect that Intel now win on the small scale too, what with Freescale being tardy in getting the latest PowerPC out the door (it looked good on paper, just for the moment).&lt;/p&gt;&#xA;" OwnerDisplayName="bazza" LastActivityDate="2013-03-29T06:32:15.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8424" PostTypeId="1" CreationDate="2013-03-29T23:11:04.223" Score="5" ViewCount="1298" Body="&lt;p&gt;I have four .wav files and each contain bird chirps.  Given an input .wav file, I need to find out which bird it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some basic understanding of signal processing. I have used spectrogram to analyze my audio files and now I don't know how to make the frequency spectrum comparison to find out the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please let me know the process with which I could find out the frequency of sound, bird chirps in my case, programmatically from the spectrogram? I am just a beginner, so I apologize if I said something which wasn't clear &lt;/p&gt;&#xA;" OwnerUserId="4251" LastEditorUserId="29" LastEditDate="2013-04-02T14:42:39.693" LastActivityDate="2014-06-29T06:06:45.927" Title="Spectrogram Analysis" Tags="|matlab|spectrogram|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8425" PostTypeId="1" CreationDate="2013-03-29T23:13:14.740" Score="1" ViewCount="303" Body="&lt;p&gt;What algorithms or methods can be used for the tracking of audio pitch contours?  (Such as in musical vibrato and glissando, or for tonal vowels in languages such as Chinese?). Will a PLL work even for pitched tones that have a weak or missing fundamental?  Or is there a more suitable tracking method?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2017-04-20T12:03:04.883" Title="Melodic or tonal pitch contour tracking?" Tags="|frequency|pitch|pll|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8426" PostTypeId="2" ParentId="8373" CreationDate="2013-03-29T23:50:10.367" Score="0" Body="&lt;p&gt;&lt;a href=&quot;http://note.sonots.com/SciSoftware/haartraining.html&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a very good tutorial on how to train classifiers, is not specifically for Matlab but still it is very useful.It is for OpenCV mainly. &lt;/p&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2013-03-29T23:50:10.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8427" PostTypeId="2" ParentId="8424" CreationDate="2013-03-29T23:57:46.753" Score="5" Body="&lt;p&gt;Please check &lt;a href=&quot;https://dsp.stackexchange.com/questions/8220/performing-classification-based-on-fft-results&quot;&gt;this answer&lt;/a&gt;, which describes a few approaches to the same problem. Given that bird song is a monophonic signal (only one fundamental frequency at any point in time - as opposed to polyphonic) - and given that the timbre is irrelevant, the most interesting feature to extract for this classification task is a pitch contour.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-03-29T23:57:46.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8428" PostTypeId="2" ParentId="8425" CreationDate="2013-03-30T00:26:18.857" Score="2" Body="&lt;p&gt;I think a PLL would be hard to use for pitch detection in singing or speech. For the reasons you mention (classic phase/frequency comparators output garbage when the waveforms are too different due to a missing f0), but also because you'll need another method anyway for tracking the large changes in pitch or the switch to voice/unvoiced that would put a PLL off the tracks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A baseline system could be to extract a pitch on small frames with a classic f0 detector (autocorrelation, AMDF, YIN, or any auditory model), and then use dynamic programming (or from another point of view, the Viterbi algorithm on a HMM whose states are discretized pitch values) to recover a pitch track. A ready to use Matlab implementation for this (auditory model + viterbi) is &lt;a href=&quot;http://www.ee.columbia.edu/~bsl/projects/wu/&quot; rel=&quot;nofollow&quot;&gt;available here&lt;/a&gt; or (fancy autocorrelation flavour + dynamic programming) &lt;a href=&quot;http://www.ws.binghamton.edu/zahorian/yaapt.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be discretized on both the time and pitch axes, but you could then interpolate.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-03-30T00:26:18.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8429" PostTypeId="1" CreationDate="2013-03-30T03:56:31.460" Score="1" ViewCount="76" Body="&lt;p&gt;I am training a classifier of my own, specifically for detecting body arms. According to the training process I have to provide positive samples and negative samples, wich will be used in the different stages of the cascade classifier. As Mathworks says &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/train-a-cascade-object-detector.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, there is a tradeoff between having a higher false positive rate(wich I think is good) and the training set size you have, so, if I want a high false positive rate, then I have to provide a lot of positive and negative samples. I don't expect to provide picture by picture and selecting ROIs(Region of Interest) hundreds of times manually, so my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there any good repository of sample images for CV and specifically&#xA;for body parts(I need arms specifically) different from &lt;a href=&quot;http://www.cs.cmu.edu/~cil/v-images.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Am I doing the right thing, or creating samples of my own is a better&#xA;way to do this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;PD: &lt;strong&gt;Remember: I am interested in having a high false positive rate&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2013-03-30T03:56:31.460" Title="Searching for image samples in order to create custom classifier" Tags="|computer-vision|object-recognition|face-detection|motion-detection|detection|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8432" PostTypeId="1" CreationDate="2013-03-30T12:37:11.760" Score="3" ViewCount="4183" Body="&lt;p&gt;I am trying to get the fundamental frequency of a signal that only has a single pitch. I coded out the autocorrelation function using FFT and already got the autocorrelation result. Unfortunately, I don't know how to get the fundamental frequency from the autocorrelation result. Can someone help me? My JAVA code for getting the fundamental frequency using autocorrelation is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public double getPitch(double[] buffer, int firstSample, int lastSample, double sampleRate)&#xA;{&#xA;    int lengthOfFFTWindow=lastSample-firstSample;&#xA;    double[] input_buffer=new double[lengthOfFFTWindow];&#xA;    DoubleFFT_1D fft = new DoubleFFT_1D(lengthOfFFTWindow);&#xA;    double[] autocorrelation_values=new double[lengthOfFFTWindow];&#xA;    double[] fftData = new double[lengthOfFFTWindow * 2];&#xA;    double max=-1;&#xA;    double max_i=-1;&#xA;    //FFT on each sample in each window&#xA;    for (int i = 0; i &amp;lt; lengthOfFFTWindow; i++) {&#xA;        // copying audio data to the fft data buffer, imaginary part is 0&#xA;        fftData[2 * i] = buffer[i+firstSample];&#xA;        fftData[2 * i + 1] = 0;&#xA;    }&#xA;    fft.complexForward(fftData);&#xA;    for (int i = 0,j=0; i &amp;lt; fftData.length; i += 2,j++) {&#xA;        // complex numbers -&amp;gt; vectors, so we compute the length of the vector, which is sqrt(realpart^2+imaginarypart^2)&#xA;        autocorrelation_values[j] = Math.sqrt((fftData[i] * fftData[i]) + (fftData[i + 1] * fftData[i + 1]));&#xA;    }&#xA;    fft.complexInverse(fftData, false);&#xA;    for(int i=0;i&amp;lt;autocorrelation_values.length;i++)&#xA;    {&#xA;        if(max&amp;lt;autocorrelation_values[i])&#xA;        {&#xA;            max=autocorrelation_values[i];&#xA;            max_i=i;&#xA;        }&#xA;    }&#xA;    return max/2;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it correct to return the maximum autocorrelation value divide by 2 as the fundamental frequency? I keep getting wrong answers when I do that. &lt;/p&gt;&#xA;" OwnerUserId="4252" LastActivityDate="2014-05-28T03:16:59.020" Title="How to get fundamental frequency of a signal using autocorrelation?" Tags="|fft|audio|autocorrelation|signal-analysis|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8433" PostTypeId="2" ParentId="8432" CreationDate="2013-03-30T13:11:57.083" Score="5" Body="&lt;p&gt;The value of the peak of the autocorrelation function (maximum) is not really important - though it can be used as a basic feature for voiced/unvoiced classification or more generally for &quot;pitchedness&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What matters is the index at which the function takes its maximum (arg-maximum). This is very intuitive to understand: if the signal has a period of $\tau$ samples, the original signal and the signal shifted by $\tau$ samples should be very similar, so the autocorrelation function will have a peak when evaluated at $\tau$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the interesting variable is &lt;code&gt;max_i&lt;/code&gt; in your code. One thing I notice is that you search through the whole &lt;code&gt;autocorrelation_values&lt;/code&gt; vector. But the autocorrelation function is maximum at 0, so your maximum will always be 0! I advise you to think about a meaningful range for the fundamental frequency you want to detect, and restrict the search in this range to get a meaningful result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hadn't checked the rest of your code in details, I don't think it is the purpose of this site to dive into coding/implementation problems.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-03-30T13:11:57.083" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8434" PostTypeId="1" AcceptedAnswerId="8454" CreationDate="2013-03-30T13:59:13.493" Score="0" ViewCount="240" Body="&lt;p&gt;I have been trying to implement image classification by extracting facial features. I tried starting with some already established methods like &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/software/MKL/&quot; rel=&quot;nofollow&quot;&gt;Multi Kernel Approach&lt;/a&gt;, using Independent Component Analysis etc. Is there a very basic algorithm for image classification with which I can proceed the implementation ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data set I am currently considering is &lt;a href=&quot;http://archive.ics.uci.edu/ml/datasets/CMU+Face+Images&quot; rel=&quot;nofollow&quot;&gt;CMU Face Images data set&lt;/a&gt;. So aim is to separate images with human faces to those who do not contain human faces. I think I need to learn parameters by supplying  positive data set and negative data set as well. I am aware that SIFT, SURF, VJ algorithm etc. are helpful fir extracting features from an image. But I am stuck on how to start i.e. what features are required for face detection, and how to proceed towards implementing them.&lt;/p&gt;&#xA;" OwnerUserId="1115" LastEditorUserId="80" LastEditDate="2013-04-01T15:15:44.990" LastActivityDate="2013-04-01T15:33:50.347" Title="Basic Algorithm for Image Classification" Tags="|image-processing|image-segmentation|object-recognition|face-detection|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8436" PostTypeId="1" AcceptedAnswerId="11289" CreationDate="2013-03-31T07:58:29.537" Score="3" ViewCount="1595" Body="&lt;p&gt;I need to divide an audio signal into frames in which the signal can be assumed to be stationary. How can I measure whether an audio signal is stationary in a frame?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastActivityDate="2015-01-29T13:15:18.963" Title="Are there any measurements or test for whether an audio signal is stationary?" Tags="|audio|discrete-signals|signal-analysis|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8437" PostTypeId="1" CreationDate="2013-03-31T12:39:21.257" Score="6" ViewCount="936" Body="&lt;p&gt;I already have an algorithm for making panoramic image mosaics by image registration and then blending images in the overlap regions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following image from &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_stitching&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt; illustrates several images under translational movement &lt;em&gt;stitched&lt;/em&gt; together by finding optimal dividing lines in the overlap regions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1ETOU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I would like to extend this blending algorithm to various panoramic image projections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest case is planar projection in which does not posses any problems for blending. The following image illustrates two images and the stitch line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can basically take a region from &lt;em&gt;canvas&lt;/em&gt; (already stitched composite image) and a corresponding region from image, then blend the two together and render the blended region back to canvas:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/czj0K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is done sequentially for each new image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I experimented with spherical projection and 360° mosaics a problem appears when two images and their overlap region crosses the 360° boundary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CisIc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can no longer take out a simple rectangular regions to blend as I have to count on &lt;em&gt;wrapping&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even worse, blending images on a &lt;em&gt;cube map&lt;/em&gt; can split the overlap region in two or three parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IOlc5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came with a few solutions on how to blend images on spherical surface or a cube map, but no one is satisfactory:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Process each facet of the cube separately (or similarly, each part of a spherical map separately). Unfortunately, this produces visible artifacts where the two facets of the cube meet as the blending of images in neighboring facets are different sub-optimal solutions.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perform blending in the context of newly added image. This requires to inversely project composite image from cube map (or spherical map) in the coordinate system of newly added image, blend the two images and the project the overlap region back on the compositing surface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work and remove artifacts, but requires more computation as data are repeatedly projected back and forth.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Always blend on a spherical surface, then project the whole mosaic on whatever surface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This reduces blending problem on a single type of surface, but spherical projection treats image parts unevenly and more elaborate approach (such as blending images on a triangulated sphere) would be needed to ensure high quality re-projection.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution 4&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When performing the blending, provide a function that properly maps out-of-bounds coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is similar to Solution 2, but may be even more computationally expensive as the mapping function would be called too often (the blending algorithm may access the same pixel position many times).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to efficently blend several images on spherical surface or cube map or some other common compositing surface?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-10-05T22:55:51.057" Title="How to blend images on a spherical surface / cube map" Tags="|image-processing|3d|image-registration|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8438" PostTypeId="1" AcceptedAnswerId="8453" CreationDate="2013-03-31T14:48:06.420" Score="3" ViewCount="5334" Body="&lt;p&gt;Is there anyone with Image Processing background who can suggests which one is better for Image Processing algorithms among &lt;a href=&quot;http://en.wikipedia.org/wiki/CUDA&quot; rel=&quot;nofollow&quot;&gt;CUDA&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Fpga&quot; rel=&quot;nofollow&quot;&gt;FPGA&lt;/a&gt;. I'm specifically looking to write code for Wavelet Transform and Discrete Cosine Transform and eventually writing code for Quantization and Arithmatic coding, but i am confused which hardware programming language should i focus on among CUDA and FPGA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are few questions i want to ask,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Which one is better for Image Processing like compression, watermarking etc ? &lt;/li&gt;&#xA;&lt;li&gt;Which one is Faster ?&lt;/li&gt;&#xA;&lt;li&gt;Which one is easy to    implement ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2018-04-10T11:22:07.150" Title="CUDA vs FPGA for Image Processing; which is better" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8439" PostTypeId="1" AcceptedAnswerId="8443" CreationDate="2013-03-31T14:51:56.120" Score="2" ViewCount="1619" Body="&lt;p&gt;What's an extremely efficient way of detecting when a user has stopped talking into a microphone? When I use systems like Siri it can detect when I've stopped talking almost immediately, even when there's background noise. My initial guess was to get the average volume of the background noise first but it seems there isn't much time for that as Siri starts listening straight after the button is pressed. The method doesn't have to be accurate in what is being said, just recognize that something is being said. What algorithms should I look into?&lt;/p&gt;&#xA;" OwnerUserId="334" LastEditorUserId="13320" LastEditDate="2018-06-10T10:50:46.513" LastActivityDate="2018-06-10T10:50:46.513" Title="Detect When Someone Has Stopped Talking" Tags="|algorithms|signal-detection|speech|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8440" PostTypeId="1" AcceptedAnswerId="8442" CreationDate="2013-03-31T16:51:50.213" Score="0" ViewCount="207" Body="&lt;p&gt;I'm trying to segment a specific part in a gray-scale image and I want to achieve this by applying the OSTU algorithm, but after using this function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = imread('ready.jpg');&#xA;oim =otsu(im,10);&#xA;figure,imshow(oim, [1 10]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I could show the output image, but I do not know how can I save the result to be able to use it later as a mask.&lt;/p&gt;&#xA;" OwnerUserId="4255" LastEditorUserId="76" LastEditDate="2013-04-01T00:16:45.493" LastActivityDate="2013-04-01T00:16:45.493" Title="Multithresholding- OTSU method" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8442" PostTypeId="2" ParentId="8440" CreationDate="2013-03-31T21:13:44.380" Score="1" Body="&lt;p&gt;I am sorry that I cannot see where your problem is. What do you mean by &quot;how can I save the result?&quot; If you want to use $oim$ in matlab, then it is already there. If you are interested in extracting one specific class, you can simply get the corresponding $n$th mask by calling $mask=(oim==n)$, which returns a binary mask with only the pixel belonging to the $n$th class marked as 1s. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are going to save the classification result outside of matlab, for example a tif image, simply use &lt;strong&gt;imwrite&lt;/strong&gt; function in matlab. Late you can read it via &lt;strong&gt;imread&lt;/strong&gt; function.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-03-31T21:13:44.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8443" PostTypeId="2" ParentId="8439" CreationDate="2013-03-31T21:33:11.167" Score="4" Body="&lt;p&gt;Assume noise is not a serious issue in your problem. I guess you can get pretty clear speech signal. If you have speech recognition part implemented in your system, I think you should be able to take advantage over the language model in your recognition system. According to the transition probabilities, you shall get some confidence to say at what moment someone stopped talking. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you donot know the language model. Here is a simple example. Suppose I want to introduce myself. I will say &quot;Hello[verb] everyone [object]. My name [subject] is [verb] Bob [object]. I [subject] came [verb] from ... [object]&quot;. The probability for someone to stop talking right after a subject or verb is much lower than after an object. If you can recognize speech, then you shall be able to take advantage over these language models. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other thing that is worthy to try is to see whether you can find some stop patterns when someone is talking. What I mean is that from word to word, sentence to sentence, everyone might have his/her stop patterns. If you could successfully retrieve some patterns for example duration, then they shall help you differentiate whether the current stop is alike previous stops or not.  &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-03-31T21:33:11.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8444" PostTypeId="1" CreationDate="2013-03-31T22:47:00.997" Score="1" ViewCount="844" Body="&lt;p&gt;Take:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$&#xA;(u*v)(k) = \sum_{i=-\infty}^\infty u(i)v(k-i).&#xA;$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The $k$ is there, it's because you want to define&#xA;  $$&#xA;\ldots\ldots, (u*v)(-3), (u*v)(-2), (u*v)(-1), (u*v)(0), (u*v)(1), (u*v)(2), (u*v)(3), \ldots\ldots&#xA;&amp;gt;$$&#xA;  etc.  The number in the parentheses is $k$.  Thus, for example, when $k=4$, we have&#xA;  \begin{align}&#xA;(u*v)(4) = \sum_{i=-\infty}^\infty u(i)v(4-i)&#xA;\end{align}&#xA;  $$&#xA;= \cdots\cdots+u(-3)v(7)+u(-2)v(6)+u(-1)v(5)+u(0)v(4)+u(1)v(3)+u(2)v(2)&#xA;&amp;gt;$$&#xA;  $$&#xA;\phantom{={}} {}+u(3)v(1)+ u(4)v(0) + u(5) v(-1) + u(6)v(-2)+u(7)v(-3)+u(8)v(-4)+\cdots&amp;gt;\cdots.&#xA;&amp;gt;$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Could you give examples of what the 'k' value could stand for?&#xA;Can it only be time offset?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you give an intuitive explaination why you need to multiply u(-3) [a point left from the y-axes] with v(7) [a point right from the y-axes]! And not u(-3) with v(-3) for example? With a diagram for example.&lt;/p&gt;&#xA;" OwnerUserId="4257" LastEditorUserId="128" LastEditDate="2020-03-14T09:35:35.843" LastActivityDate="2020-03-14T09:35:35.843" Title="Understanding Convolution" Tags="|discrete-signals|convolution|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8445" PostTypeId="1" AcceptedAnswerId="8448" CreationDate="2013-04-01T00:14:47.353" Score="3" ViewCount="1177" Body="&lt;p&gt;I hope this ultra-noob question is not entirely out of place here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to make a super simple ringtone: 0.5s silence + 1s &quot;pure tone&quot; + 0.5s silence + 1s &quot;pure tone&quot; + 0.5s silence.  By &quot;pure tone&quot; I mean something like a sinusoidal or square wave with a fixed frequency (let's say 350Hz for concreteness).  This profile results in a very standard beep-beep ringtone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;a href=&quot;http://audacity.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;Audacity&lt;/a&gt;, it's relatively simple to generate this profile (with &lt;code&gt;Generate &amp;gt; Silence...&lt;/code&gt; and &lt;code&gt;Generate &amp;gt; Tone...&lt;/code&gt;), and one even has a choice of wave shapes (sinusoidal, square, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I pick the sinusoidal option when constructing the profile above, and export it as a WAV file, when I play the ringtone in my phone, I can hear a slight &quot;pop&quot; at the beginning of each beep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to get rid of those pops, with little success.  I figure that the pops are an artifact of the discontinuity of the wave at the beginning of each beep (though, curiously, I don't hear a pop at the end of each beep).  So I tried fading the sound in and out, which does get rid of the pop, but, as one would expect, makes the beeps sound less crisp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've heard many ringtones of this sort that are crisp, pleasant-sounding, and &lt;em&gt;pop-free&lt;/em&gt;, so there must be a way to get rid of these pops.  Any suggestions would be appreciated!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;P.S.  If I pick the square wave + no aliasing option (which, to my ear sounds a little &quot;cleaner&quot; than the option with aliasing, for some reason), the resulting ringtone does not have the &quot;pop&quot; at the beginning of each beep, but it sounds very harsh and loud.  I tried to adjust the loudness of the beep by lowering the amplitude of the wave generated by Audacity, and in fact, when Audacity plays this reduced-amplitude wave it indeed sounds quieter, but when it is saved as a ringtone in my phone, the phone plays both versions of the square-wave ringtone equally loudly.  I figure that the phone probably normalizes the ringtone's loudness somehow.  What's surprising to me is that the ringtone made with the sinusoidal wave (the one with the slight &quot;pops&quot; at the beginning of each beep) sounds considerably less loud than the ringtones made with the square wave.  In any case, even if I could find a way to reduce the volume of the square-wave ringtone that the phone did not &quot;normalize away&quot;, I still would prefer a pop-free version of the sinusoidal-wave ringtone.&lt;/p&gt;&#xA;" OwnerUserId="4258" LastActivityDate="2013-04-01T15:50:17.947" Title="How to make pop-free, crisp two-beep ringtone?" Tags="|audio|sound|wave|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8446" PostTypeId="2" ParentId="8444" CreationDate="2013-04-01T00:33:35.910" Score="3" Body="&lt;p&gt;It is the definition of convolution operation, i.e :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;(u*v)(k) \stackrel{\mathrm{def}}{=} \sum_{i=-\infty}^\infty u(i)v(k-i)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this definition is not arbitrary. $k$ simply stands for the independent variable ; in some extents represents time and sometimes other quantities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example when multiplying two polynomials, the coefficients of the product are given by the convolution of the original coefficient sequences ( extended with zeros) . (Cauchy product) . (here $k$ does not represent time!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the theory of linear time-invariant systems ,you can derive the response of the system as the convolution of input function with impulse response of the system. So you can arrive at the above definition for convolution in this way too.(here , k stands for time,) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;also , convolution doesn't add any new frequencies to the fourier spectrum of the convolved signals and the resulting signal spectrum is the product of the two spectrums. If you start from this , you can arrive at the definition of convolution.(convolution theorem)&lt;/p&gt;&#xA;" OwnerUserId="4243" LastActivityDate="2013-04-01T00:33:35.910" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8447" PostTypeId="2" ParentId="8444" CreationDate="2013-04-01T00:40:52.073" Score="1" Body="&lt;p&gt;I guess one misunderstanding that you had is the only reason we need to multiply $u(-3)$ and $v(7)$ is because $(u*v)(4)$ requires all $x,y$ that $x+y=4$ in $u(x)v(y)$. If you take $x=i$ and $y=4-i$, you will see the same formulation as you described. We actually also need $u(-3)v(-3)$, but this term is for $(u*v)(0)$ rather than $(u*v)(4)$. If you want to see examples of convolutions, go to &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;the convolution wiki page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To some extend, I agree that the convolution operation is defined in a weird way that many students may ask why define convolution in this way but not something different. If this is also your problem, then you get the point: if you define convolution in other ways, then it is not &lt;strong&gt;convolution&lt;/strong&gt; again. Of course, you may define an operation as&#xA;$$(u\star v)(k)=\sum_{i=-\infty}^{\infty}u(i)v(k+i)$$, and this is so called cross-correlation. The only difference between the cross correlation and the convolution is that the convolution requires to first flip the signal then to compute the sum, while the cross-correlation computes the sum directly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think in most cases understanding the function of convolution or cross-correlation from a high level is good enough. Both convolution and cross-correlation do a similar thing, that is to compute some quality dependent on two signals. Because they can be easily computed (via FFT) and their computed qualities are meaningful to some extend. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-04-01T00:40:52.073" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8448" PostTypeId="2" ParentId="8445" CreationDate="2013-04-01T01:00:33.880" Score="7" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The &quot;click&quot; is caused by the discontinuity in the waveform and its derivatives - even if the waveform stops at a zero-crossing you might still hear a pop if there's a discontinuity in the higher order derivatives! Its loudness depends on the amplitude at the discontinuity - and it is thus influenced by the length/frequency/phase of the sinusoidal tone. Note also that if the tone is contained within a clip in an audio editor, a short fade-in/fade-out might be added automatically by it, attenuating the problem. I know a few audio editors that dynamically apply a short fade (say 32 samples) at the boundary of each audio clip during mixing during playback.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You hear the click clearly with the sine wave because the tone has very few harmonics (ideally: none). You might not hear it with the other waveforms (square) because they already have high frequency content that will cover part of it (frequency masking phenomenon). For example, you won't hear a click when a burst of white noise stops.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The solution is to apply a short fade-in / fade-out. 1ms is a good start. Above 5ms it'll start feeling &quot;slow&quot;. There is a trade-off to find between &quot;clicky and snappy&quot; and &quot;slow&quot; - this is a problem even &lt;a href=&quot;http://faq.waldorfian.info/faq-browse.php?product=pu#115&quot; rel=&quot;nofollow&quot;&gt;well-established synth manufacturers&lt;/a&gt; have to educate the public about. With a sine-wave, an envelope curve like a raised cosine function ensures that the resulting signal has continuous derivatives throughout the fade.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Aliasing is the bad thing to get rid off, so it is normal that the &quot;no-aliasing&quot; option produces a better quality output.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A sine wave with an amplitude of 1V has twice as less energy as a square wave with the same amplitude. Assuming that the phone normalizes amplitude, it is normal that with a given dynamic range/amplitude budget, the sine wave will sound quieter. Energy/RMS is a rather bad proxy for the perceptual concept of loudness, but it's much more accurate at this task than peak-to-peak amplitude!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-04-01T15:50:17.947" LastActivityDate="2013-04-01T15:50:17.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8450" PostTypeId="2" ParentId="8444" CreationDate="2013-04-01T03:50:31.390" Score="4" Body="&lt;p&gt;I think the reason you are getting confused is that you are only considering the convolution of two signals, whereas convolution is not usually between signals but between a signal and an impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to visualise it is probably with a filter.  For example, in &#xA;&lt;img src=&quot;https://i.stack.imgur.com/G2HFu.png&quot; alt=&quot;simple FIR filter (from Wikipedia)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can see that the input comes in, and is multiplied by $b_0$ to give its contribution to the output $y$.  Then in the next time step, that input value is multiplied by $b_1$ to give its contribution to the output, and so forth.  In this case your $k$ variable specifies which time in the output sequence you want.  The output signal is given by $y[n] = (x * b)[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider the case of $n=4$ (that's the same as $k=4$ in your example).  That means we're looking at the 4th time step (since time = 0).  So the value at the input is $x[4]$, the fourth input value; the value to the right of the first $z^{-1}$ block is the previous input value $x[3]$; the value to the right of the next $z^{-1}$ block is $x[2]$; and so forth.  The output $y[4]$ will be given by &#xA;$$y[4] = x[4]b_0 + x[3]b_1 + x[2]b_2 + x[1]b_3 + \cdots + x[-3]b_7 + \cdots$$&#xA; which you should be able to see is the discrete convolution sum, and includes the product of $x[-3]$ with $b[7]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any linear filter or transfer function can be implemented as a convolution, where the output is given by the convolution of the input with the system impulse response.  Try reading up on convolution in a text book, and look particularly at the sliding-strip method of calculating it, which might help with your visualisation.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastEditorUserId="1496" LastEditDate="2013-04-01T20:21:13.600" LastActivityDate="2013-04-01T20:21:13.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8451" PostTypeId="1" AcceptedAnswerId="8452" CreationDate="2013-04-01T04:20:44.977" Score="2" ViewCount="2777" Body="&lt;p&gt;I'm having trouble implementing OFDM with a raised cosine (RC) window in Matlab. I know how to generate an OFDM signal and how to show its spectrum, I just don't know how to generate the window extensions. Each OFDM symbol is extended by $TW$ samples at both ends to smooth the transitions between successive symbols, this is done mainly to improve the out of band spectrum and reduce the interference to adjacent channels. I'm hoping someone here knows how to do this.&lt;/p&gt;&#xA;" OwnerUserId="4259" LastActivityDate="2018-12-19T23:04:55.897" Title="Spectrum of OFDM with raised cosine window" Tags="|frequency-spectrum|ofdm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8452" PostTypeId="2" ParentId="8451" CreationDate="2013-04-01T13:02:59.917" Score="2" Body="&lt;p&gt;This spectral shaping technique is applied in time domain, after adding the guard interval (GI). But I find it easier to add GI and the cyclic extension for windowing in one step. Let $x(n)$ be an $N$ subcarriers OFDM symbol without guard interval. Then $W + G$ samples are copied to the beginning accounting for guard interval and windowing samples. Additionaly, $W$ samples are copied to the end, also for windowing:&#xA;$$&#xA;y(n) =&#xA;\begin{cases}&#xA;x(n+N) &amp;amp; \text{for} &amp;amp; -G-W \leq n \leq -1 \\&#xA;x(n) &amp;amp; \text{for} &amp;amp; 0 \leq n \leq N -1 \\&#xA;x(n-N) &amp;amp; \text{for} &amp;amp; N \leq n \leq N + W -1&#xA;\end{cases}&#xA;$$&#xA;In the next step, the raised cosine function is applied to the first and last $W$ samples of $y(n)$, respectively. The windowing function $w(n)$ is given by:&#xA;$$&#xA;w(n)=&#xA;\begin{cases}&#xA;\cos^2\left( \frac{n+G+1}{W-1} \frac{\pi}{2}\right) &amp;amp; \text{for} &amp;amp; -G-W \leq n \leq -G-1 \\&#xA;1 &amp;amp; \text{for} &amp;amp; -G \leq n \leq N - 1 \\&#xA;\cos^2\left( \frac{n-N}{W-1} \frac{\pi}{2}\right) &amp;amp; \text{for} &amp;amp; N \leq n \leq N+W-1 \\&#xA;0 &amp;amp; \text{otherwise} &#xA;\end{cases}&#xA;$$&#xA;$w(n)$ is similar but not equal to the transfer function of a raised cosine filter often used as impulse shaper in single carrier transmission systems. The two differences are: (1) the raised cosine function is applied in time domain for OFDM systems and in frequency domain for single carrier systems and (2) the &quot;flat top&quot; is usually much longer for OFDM systems, whereas its length is in a fixed relation with the flanks' length, given by the roll-off factor, for single carrier systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the OFDM symbol including GI and spectral shaping is calculated by&#xA;$$&#xA;z(n) = w(n)y(n)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When transmitting several OFDM symbols $z_i(n)$, two consecutive symbols overlap at $W$ samples. The discrete transmit signal $u(n)$ is therefore given by&#xA;$$&#xA;u(n)=\sum_{i=-\infty}^\infty z_i(n-i(N+G+W))&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The implementation in Matlab should now be straightforward by substituting $n$ with $n' = n + G+ W+ 1$ in the above equations. Leave a comment if not.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-04-01T15:58:14.570" LastActivityDate="2013-04-01T15:58:14.570" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8453" PostTypeId="2" ParentId="8438" CreationDate="2013-04-01T13:26:58.747" Score="5" Body="&lt;p&gt;Did you have a chance to look at &lt;a href=&quot;http://spiral.net/hardware/ldpc.html&quot; rel=&quot;noreferrer&quot;&gt;Spiral&lt;/a&gt; site?  They try to address this question.  For example, there are special cases where FPGA will run O(N) instead of the customary O(N log N).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a &lt;a href=&quot;http://spiral.ece.cmu.edu:8080/pub-spiral/pubfile/paper_52.pdf&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; that deals with generating FPGA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the way at the end of &lt;a href=&quot;http://spiral.net/bench.html&quot; rel=&quot;noreferrer&quot;&gt;benchmarks page&lt;/a&gt; they show performance of a software algorithm enhanced with FPGA-based solvers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.  It's worth noting that Spiral can be used to optimize algorithms other than FFT, but presented data outlines the popular case only.&lt;/p&gt;&#xA;" OwnerUserId="4164" LastEditorUserId="4164" LastEditDate="2013-04-01T13:39:12.693" LastActivityDate="2013-04-01T13:39:12.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8454" PostTypeId="2" ParentId="8434" CreationDate="2013-04-01T15:33:50.347" Score="1" Body="&lt;p&gt;Have a look at &lt;a href=&quot;http://www.ehu.es/ccwintco/uploads/e/eb/PFC-IonMarques.pdf&quot; rel=&quot;nofollow&quot;&gt;this report by Marques (PDF)&lt;/a&gt;. In particular, have a read through section 1.4. It describes several different aspects to the face detection problem. You might want to decide what scenario you're after. Fully unconstrained (uncontrolled environment) face detection is hard to do accurately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a first approach, try just doing color-based segmentation.  See &lt;a href=&quot;http://www.csee.wvu.edu/~richas/papers/tkjse.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper by Singh, Chauhan, Vatsa and Singh&lt;/a&gt; for some details about how to use color to segment your images for face detection.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-01T15:33:50.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8455" PostTypeId="2" ParentId="8036" CreationDate="2013-04-01T16:47:08.177" Score="0" Body="&lt;p&gt;As B Z says, try it out without extra hardware first.  Also, have a look at Microsoft's &lt;a href=&quot;http://en.wikipedia.org/wiki/DirectX&quot; rel=&quot;nofollow&quot;&gt;DirectX&lt;/a&gt; libraries they allow you to do lots of signal / low level image processing under Windows.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-01T16:47:08.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8456" PostTypeId="1" AcceptedAnswerId="8462" CreationDate="2013-04-01T17:05:42.143" Score="13" ViewCount="12150" Body="&lt;p&gt;What are the options for recovering the phase of a BPSK signal in software? The only resources I can find online contain circuit diagrams – there seems to be no one willing to explain this to people unfamiliar with analog circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like any explanation of how carrier recovery works in theory, and would also love pseudocode or code examples.&lt;/p&gt;&#xA;" OwnerUserId="3609" LastEditorUserId="3609" LastEditDate="2013-04-01T21:06:53.217" LastActivityDate="2013-04-03T16:33:05.933" Title="How to perform carrier phase recovery in software?" Tags="|digital-communications|demodulation|phase|bpsk|qpsk|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8457" PostTypeId="2" ParentId="8350" CreationDate="2013-04-01T21:11:30.160" Score="1" Body="&lt;p&gt;&lt;strong&gt;The following correction of Jason R's answer completely resolves the problem:&lt;/strong&gt; The frequency spectrum of $X_2(ω)$  consists of two components, which are scaled versions of $X(ω)$. Those are $4\pi$-periodic instead of being $2\pi$-periodic. When those $4\pi$-periodic versions are added up, the sum becomes $2π$-periodic again. THERE IS NO ALIASING or IMPULSES SUPERIMPOSED ON EACH OTHER. The derivation from&#xA;$$&#xA;X_2(\omega) = \frac{1}{2} \pi\left(\delta\left(\frac{\omega}{2}-\omega_0\right) + \delta\left(\frac{\omega}{2}+\omega_0\right) + \delta\left(\frac{\omega}{2}-\omega_0-\pi\right) + \delta\left(\frac{\omega}{2}+\omega_0-\pi\right)\right)&#xA;$$&#xA;to&#xA;$$&#xA;X_2(\omega) = \frac{1}{2} \pi\left(\delta\left(\omega-2\omega_0\right) + \delta\left(\omega+2\omega_0\right) + \delta\left(\omega-2\omega_0-2\pi\right) + \delta\left(\omega+2\omega_0-2\pi\right)\right)&#xA;$$&#xA;is not correct. Instead it must read &#xA;$$&#xA;X_2(ω)=π(δ(ω−2ω_0 )+δ(ω+2ω_0)+δ(ω−2ω_0−2π)+δ(ω+2ω_0−2π)) \qquad (∗) &#xA;$$ &#xA;This is due to the scaling property of impulses &#xA;$$&#xA;δ(aω)=\frac{δ(ω)}{|a|}   &#xA;$$ &#xA;Then, observing that (*) is $2π$-periodic, two of the impulses are redundant and hence the DTFT of $x_2[n]=x[2n]$  becomes&#xA;$$&#xA;X_2(ω)=π(δ(ω−2ω_0)+δ(ω+2ω_0)) &#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="4201" LastActivityDate="2013-04-01T21:11:30.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8458" PostTypeId="2" ParentId="7607" CreationDate="2013-04-01T21:26:04.580" Score="0" Body="&lt;p&gt;This was finally was explained to me by the author of &lt;a href=&quot;http://epx.com.br/artigos/qam_rx.php&quot; rel=&quot;nofollow&quot;&gt;the tutorial&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Demodulation is achieved just by multiplying the signal again&#xA;  &lt;em&gt;and using a low-pass filter&lt;/em&gt; because demodulation leaves a high-frequency &lt;em&gt;(2 * carrier)&lt;/em&gt; undesirable &quot;noise.&quot;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The modulator changes phase of the carrier. RX demodulates using two carriers, 90 degrees&#xA;  apart. The low-pass result of each demodulation will be proportional&#xA;  to the phase of the signal.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For example, if the original information was &quot;angle = 90&quot;, the&#xA;  modulated signal will be $\sin (t)$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;PSK detection yields&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$y = \sin (t) \sin (t) = \frac{1 - \cos (2t)}{2}$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$x = \sin (t) \cos (t) = \frac{\sin (2t)}{2}$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you pass both signals through a low-pass filter that removes the&#xA;  $2t$ frequency noise, you are left with&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$y = \frac{1}{2}$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$x = 0$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;and $\arctan(y, x)$ is 90 degrees. If the signal was 45 degrees, both&#xA;  demodulators would yield similar and positive values, once lowpassed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3609" LastActivityDate="2013-04-01T21:26:04.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8459" PostTypeId="1" CreationDate="2013-04-02T09:50:53.990" Score="6" ViewCount="8801" Body="&lt;p&gt;I am trying to understand the periodicity of the DFT. How can this property (both in time and frequency domain) be used and can be helpful while developing on a DSP? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be good to see some source code or pseudo code, in MATLAB preferably, where this property is exploited/demonstrated. &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="80" LastEditDate="2013-04-02T14:27:59.140" LastActivityDate="2013-05-02T11:49:11.013" Title="Periodicity property of DFT in time and frequency domain" Tags="|matlab|dft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8460" PostTypeId="2" ParentId="8459" CreationDate="2013-04-02T12:42:38.643" Score="0" Body="&lt;p&gt;In the time domain, the DFT is periodic by definition.  While DFT stands for Discrete Fourier Transform, the operation is in fact a discrete fourier series.  The signal to be analyzed is assumed to be periodic in the lenght of the signal.  This periodic signal is decomposed into a series of periodic sequences.  The DFT frequency bins are located at f = 1/T and its integer multiples, where T is the duration of the signal to be analyzed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain, the DFT is periodic because the time domain signal being analyzed is sampled.  Recall that any periodic sequence cannot be uniquely represented for frequencies above fs/2 where fs is the sampling frequency of the sequence (also known as the nyquist frequency).  Above fs/2 all signal energy is reflected back into the frequency range 0-fs/2.  Between fs/2 and fs, the reflection is in reverse order which gives rise to a DFT period equal to fs.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-04-02T12:42:38.643" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="8461" PostTypeId="1" CreationDate="2013-04-02T13:40:22.923" Score="6" ViewCount="1087" Body="&lt;p&gt;Consider filtering square $n\times n$ images by square, separable $m\times m$ filters. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Give general equations for the computation time for the following approaches to this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Filtering using FFT&lt;/li&gt;&#xA;&lt;li&gt;2-D convolution&lt;/li&gt;&#xA;&lt;li&gt;Two 1-D convolutions &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Use capital letters to indicate implementation-dependent constants.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;For particular implementations of the methods of filtering in part 1) the following computation timings were recorded: &lt;pre&gt;&#xA;n=64    m=3   FFT=2,498,561      2-D convolution=73,829      two 1-D convolutions=245,761 &#xA;n=256   m=5   FFT=53,084,161     2-D convolution=1,179,649   two 1-D convolutions=3,932,161&#xA;n=1024  m=3   FFT=1,059,061,761  2-D convolution=18,874,369  two 1-D convolutions=62,914,561&#xA;n=1024  m=11  FFT=1,059,061,761  2-D convolution=471,859,201 two 1-D convolutions=314,572,801&#xA;&lt;/pre&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Estimate the values of the implementation-dependent constants to 1)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For the implementation in 2) give values of $m$ and $n$ for which the FFT implementation is expected to be fastest.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My point of view about:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;FFT is: Firstly, applying FFT to each column separately and then to each row. FFT for $N$ data points takes about $2N\log N$ multiplications, for $n\times n$ images it will be $2n\cdot 2n\cdot\log n$ multiplications. Secondly, inverse FFT to get back to sensible image. Another $2n\cdot 2n\cdot \log n$. Thirdly, multiply by FT of the kernel, it will be $n^2$ complex multiplication, that is $4\cdot n^2$ real multiplication. Thus the computation time for FFT is $\mathcal O_1\left(8\cdot n^2\log n +4\cdot n^2\right)$. Is that correct?&lt;/li&gt;&#xA;&lt;li&gt;2-D convolution: I am confused about this. It could be $\mathcal O_2\left(n^2\cdot m^2\right)$. Is it correct? &lt;/li&gt;&#xA;&lt;li&gt;Two 1-D convolution: Firstly, convolution per row. It should be $(n+m-1)^2$. Secondly, transpose the matrix of the image. Will this process include the computation time? Thirdly, convolution on the rows again. Another $(n+m-1)^2$. Fourthly, second transpose, return the image back to its original orientation. Computation equation is $\mathcal O_3\left(2\cdot\left(n+m-1\right)^2\right)$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, according to my computation equations, I cannot compromise my equations to the recorded computation timings. In this way, I think I need to correct my equations to solve the problems in part 3). &lt;/p&gt;&#xA;" OwnerUserId="4262" LastEditorUserId="128" LastEditDate="2018-07-28T08:56:04.667" LastActivityDate="2018-07-28T08:56:04.667" Title="Filtering $ n \times n $ Images by Separable $ m \times m $ Filters. Computation Time for Filtering Using FFT, 2D Convolution and Two 1D Convolutions" Tags="|image-processing|fft|convolution|homework|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="8462" PostTypeId="2" ParentId="8456" CreationDate="2013-04-02T17:28:21.993" Score="26" Body="&lt;p&gt;To demodulate a phase-shift keyed signal, of which BPSK is the simplest, you have to recover the carrier frequency, phase, and symbol timing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bursty Signals&lt;/strong&gt;&#xA;Some signals are bursty and provide a known data sequence called a preamble or mid-amble (depending on whether it shows up at the beginning or middle of the burst).  Demodulators can use a matched filter that &quot;looks&quot; for the known data sequence and use it to figure out the burst's frequency, phase, and symbol timing.  They do this for every burst and don't need to bother with &quot;drift&quot; (the gradual distance that builds up between the demodulator and the received signal as small errors accumulate) because the bursts are generally short enough that the drift isn't a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Continuous Signals&lt;/strong&gt;&#xA;Then there are continuous signals.  They are in many ways tougher to recover than bursty signals because you normally do not have a known data sequence to aid in locking up with the signal, and you do have to worry about drift even after you lock onto the signal.  I'll try to describe at a high level the main steps that are typically used to recover continuous signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Carrier Recovery&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually you know what frequency the signal you are looking for will be at, or at least what set of frequencies it could be at.  Even with this knowledge, though, you usually have to be able to correct frequency offset because no two transmitters transmit at the same frequency.  There is always some error.  The usual method, then, is to mix the frequency that you think that the signal will be at, and then correct the residual frequency error.  This can be done with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Costas_loop&quot; rel=&quot;noreferrer&quot;&gt;Costas Loop&lt;/a&gt;, or by taking the fourth power of the baseband signal data and looking for a frequency spike.  There should be a frequency spike at the carrier offset * 4 (e.g. if you take an FFT of the data to the 4th power and see a frequency spike at 8300 Hz, that means the carrier offset is 8300/4 = 2075 Hz).  This is a very effective means of getting an initial lock on the frequency offset.  You can also use it to compensate for drift if you re-do it occasionally.  There is another way to compensate for drift which I will touch upon later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Carrier Phase&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point if you plotted your complex data in the complex plane (x-axis is real, y-axis is imaginary) it should look something like the following-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3lRYy.png&quot; alt=&quot;Rotated BPSK&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look closely you can see two dense areas towards the ends of the blurry line.  Those are the BPSK constellation points.  The points in between are the transitions between the constellation points.  Those will clear up once we get the symbol timing.  The reason that the line is at an angle is because of the carrier phase.  This can be measured by mirroring the signal by multiplying all points that have negative real values by $e^{j*\pi}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7cySP.png&quot; alt=&quot;Rotated and mirrored BPSK&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then taking the mean of the angles of the points.  Once you have calculated that, subtract that angle from all points that have had the carrier offset removed by multiplying the points by $e^{j*-\omega}$.  You can also compensate for carrier offset drift with this technique by dynamically updating the phase offset.  Once the data is phase corrected it should look something like this-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3USFz.png&quot; alt=&quot;Noisy BPSK&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the data is phase corrected you can drop the imaginary part of the data because it does not add any information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Symbol Timing&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should normally know, a priori, the symbol period of the signal you are trying to demodulate.  If you do need to determine the symbol period/frequency though, you can do it in a similar way to how the carrier offset was detected.  You can square the data which will cause a frequency spike at twice the symbol frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like with the carrier you will have to get the phase (timing) right and then compensate for drift.  The usual method for both of these problems is to look for the zero crossings.  Unless the noise is quite bad it should only cross the zero-point in the middle of a symbol transition from -1 to 1 or from 1 to -1.  Even if noise does cause this to happen in the middle of a symbol it won't happen very often.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GZa5i.png&quot; alt=&quot;Eye diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture above is usually called an &quot;eye diagram&quot; or &quot;eye pattern&quot;.  It is two symbol periods wide, and has many symbols &quot;stacked&quot; on top of one another.  I don't know if you are familiar with oscilloscopes or not, but you can get an oscilloscope to show a picture like this.  Anyway, the two &quot;X's&quot; are symbol transitions.  The high to low lines in the X's are when the symbol transitions from a 1 to a -1, and the low to high lines in the X's are when the symbol transitions from a -1 to a 1.  The point in between, where the pink line is, is the optimum place to sample the data to see if the symbol is a 1 or -1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This same technique can be used to handle symbol timing drift.  Take a running average of the distance from the prior zero crossing and following zero crossing.  If the two averages are about the same, all is well.  If one is bigger than the other then you need to shift where you are grabbing your sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have sampled the symbols at the correct points your data points should get something that looks like the classic BPSK constellation points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JGqEV.png&quot; alt=&quot;Noisy BPSK constellation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-04-03T16:33:05.933" LastActivityDate="2013-04-03T16:33:05.933" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8463" PostTypeId="1" AcceptedAnswerId="8464" CreationDate="2013-04-02T01:27:49.920" Score="2" ViewCount="226" Body="&lt;p&gt;I'm looking for two signals embedded in very noisy data. I know they are close to periodic and integral with the run, but are rather close (30s and 21s during a 210s measurement), and our sampling rate is low (1.25s). We have multiple observations to work with per sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering how I might deal with the problem of spectral leakage: it is evident in the FFT of our samples. Since our two signals of interest are so close together (10 and 7 cycles per measurement), it may well be that spectral power is leaking from the stronger of the two signals into the weaker one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will zero-padding with a window (rectangular or hamming) allow us to define a boundary between the two signal? Would another approach would be to concatenate these observations, driving the periodicities further apart (20 and 14)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help, joseph&lt;/p&gt;&#xA;" OwnerUserId="4266" OwnerDisplayName="user2015850" LastActivityDate="2013-04-02T17:44:29.800" Title="Dealing with spectral leakage between two frequency bins" Tags="|signal-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8464" PostTypeId="2" ParentId="8463" CreationDate="2013-04-02T17:44:29.800" Score="3" Body="&lt;p&gt;Yes, concatenating the data will greatly reduce the spectral leakage problem.  There will still be spectral leakage of course, but there will be more bins in between your signals-of-interest, so they won't leak as much into each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yes, windowing should help too.  You are already using a &quot;rectangular&quot; window.  I would suggest trying other windows such as Hamming.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-02T17:44:29.800" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8465" PostTypeId="1" CreationDate="2013-04-02T20:02:34.027" Score="3" ViewCount="3817" Body="&lt;p&gt;I am trying to understand the logic behind unsharp filter in matlab. If I type:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image = imread('nameoffile');&#xA;filter = fspecial('unsharp', 0.5);&#xA;resultImage = imfilter(image, filter);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;resultImage is sharper than image. I opened fspecial.m file and saw that unsharp filter is created as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; h = [0 0 0;0 1 0;0 0 0] - fspecial('laplacian',alpha);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I filter an image with this matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0 0 0;&#xA; 0 1 0;&#xA; 0 0 0;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;result image is the same with original one. I know laplacian filter detects sharp edges. So, if we subtract sharp edges from an image we must get blurred image, I suppose. However, if we filter an image with h matrix(unsharp filter), we get sharper image. I did not understand the logic. &lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2013-04-04T06:50:03.557" Title="Logic behind unsharp filter in matlab" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8468" PostTypeId="1" CreationDate="2013-04-03T03:43:45.243" Score="5" ViewCount="11405" Body="&lt;p&gt;I sent a square wave signal (red) through a IIR filter (butterworth in this case), to make it more &quot;realistic&quot;. Then there's a slight group delay in my output signal (blue). Is there a way to find out what the group delay is? I only need the total group delay, not spectrum of group delay. I need the number so I can shift my decision point accordingly, so I am still sampling at the middle of the eye diagram to achieve optimum result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mDSAS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4083" LastEditorUserId="4083" LastEditDate="2013-04-03T19:01:19.607" LastActivityDate="2018-09-28T21:19:12.677" Title="How to find the group delay of IIR filters in Python/SciPy" Tags="|filters|python|digital-communications|infinite-impulse-response|group-delay|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8469" PostTypeId="1" AcceptedAnswerId="8477" CreationDate="2013-04-03T04:23:36.283" Score="0" ViewCount="464" Body="&lt;p&gt;I'm trying to detect the presence of a sinusoid in 1/f noise conditions using the STFT and the DWT with Haar wavelets. I find this interesting phenomenon that I'm not able to explain (see plot at &lt;a href=&quot;https://i.stack.imgur.com/x3UQ9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My sampling rate is 1200 Hz and the graphs show the one sided response (0-600 Hz). I am using 2 scales for the Wavelet Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, why in the FFT method can I clearly see the blips in about the correct frequency as my simulated data (180 Hz), while in the WT method, the increase in energy is spread visible across all three bands. Shouldn't I see a bright line only in the highpass segment of the second scale?&lt;/p&gt;&#xA;" OwnerUserId="3709" LastActivityDate="2013-04-03T11:45:04.903" Title="Question about the Haar Wavelet transform" Tags="|fourier-transform|wavelet|signal-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8470" PostTypeId="2" ParentId="8037" CreationDate="2013-04-03T07:06:46.100" Score="2" Body="&lt;p&gt;If your coefficients are contained in a vector &quot;h,&quot; multiply them by 2^15, and use the int16() function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;coeffs = int16(h*2^15);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will put them in an integer format filling the span of a 16 bit signed integer and from there you can export the coefficients to a header or delimited data file. The processor does not care whether they're integer or fractional. As far as it is concerned, it's just a binary pattern. It's up to the programmer to decide what those patterns mean. &lt;/p&gt;&#xA;" OwnerUserId="3495" LastActivityDate="2013-04-03T07:06:46.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8471" PostTypeId="1" CreationDate="2013-04-03T07:21:51.900" Score="1" ViewCount="2439" Body="&lt;p&gt;I am trying to understand where does the convolution fit in Discrete Fourier Transform. I know that convolution is &lt;em&gt;producing a third signal from two other signals.&lt;/em&gt; I also know that DFT transforms one signal from time to frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what is the relationship between the two (if any)?&lt;/p&gt;&#xA;" OwnerUserId="1798" LastEditorUserId="1355" LastEditDate="2013-04-03T13:29:48.050" LastActivityDate="2013-04-03T13:49:36.877" Title="Where does convolution fit in DFT?" Tags="|convolution|dft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8472" PostTypeId="2" ParentId="8465" CreationDate="2013-04-03T07:34:01.683" Score="3" Body="&lt;p&gt;The Laplacian filter does actually outputs values of 0 on edges, and positive/negative inside image regions. Edges are detected as zero-crossings of the Laplacian. &#xA;This makes sense if you remember that the Laplacian is a second-order derivative, and not a first order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the unsharp filter that you describe computes (identity - Laplacian) convoluted with the image, i.e., the image minus something that is zero on edges. Hence, high frequencies (edges) are not attenuated while lower frequencies are weakened.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-04-04T06:50:03.557" LastActivityDate="2013-04-04T06:50:03.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8473" PostTypeId="2" ParentId="8471" CreationDate="2013-04-03T07:39:02.050" Score="4" Body="&lt;p&gt;FFT and DFT are a faster way to implement convolution.&#xA;Since convolution in time domain corresponds to &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution_theorem&quot; rel=&quot;nofollow&quot;&gt;multiplication in the Fourier domain&lt;/a&gt;, you replace the sliding-window based implementation of convolution (in time domain) by a pointwise multiplication (in Fourier domain). This avoids you an extra inner loop over the input data and saves time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With respect to boundary conditions, there is a minor difference with finite-length signals.&#xA;Using the convolution theorem to compute a convolution product in the Fourier domain implicitely assumes that the input data is periodic, i.e., when you reach the right end of the signal you re-enter by its leftmost part. This is also known as &lt;em&gt;circular convolution&lt;/em&gt;.&#xA;If you need to have a convolution of explicitely non-periodic signals, you can add zeros at the beginning and end of your signal to avoid these border effects.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-04-03T13:49:36.877" LastActivityDate="2013-04-03T13:49:36.877" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8474" PostTypeId="1" CreationDate="2013-04-03T08:01:29.917" Score="1" ViewCount="2085" Body="&lt;p&gt;i got that system $x_n \to x_n-x_{n-1}$, so $h_n=[.....,0,1,-1,0,...]$, with $h_0=1$ and $h_1=-1$, so the transfer function given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{i=-\infty}^{\infty} h_ne^{-jwn} = h_0e^{-jw(0)}+h_1e^{-jw(1)}=1-e^{-jw}$$. How to knwo the type of filter, if it is HPF, LPF, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate your help.&lt;/p&gt;&#xA;" OwnerUserId="3275" LastActivityDate="2013-04-03T11:31:16.137" Title="Determine the type of filter from the transfer function" Tags="|filters|discrete-signals|filter-design|transfer-function|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8475" PostTypeId="1" AcceptedAnswerId="8480" CreationDate="2013-04-03T10:09:54.757" Score="11" ViewCount="2705" Body="&lt;p&gt;I know that while taking pictures from a camera, noise may appear in the image.&#xA;It is often described as  Gaussian, but what about the other noises, when do they occur in real world?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help!&lt;/p&gt;&#xA;" OwnerUserId="4271" LastEditorUserId="-1" LastEditDate="2013-04-06T15:47:15.850" LastActivityDate="2013-04-06T15:47:15.850" Title="Where can we find noises like Gaussian, Rayleigh, Gamma, exponential noises in real world images?" Tags="|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8476" PostTypeId="2" ParentId="8474" CreationDate="2013-04-03T11:31:16.137" Score="2" Body="&lt;p&gt;That is an FIR filter transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot the frequency response to determine if it is HP, BP, LP.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Hint: compare the magnitude at w=0 and w=pi to get a quick idea)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like a homework problem, so I don't think it is appropriate to supply a complete answer.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-04-03T11:31:16.137" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8477" PostTypeId="2" ParentId="8469" CreationDate="2013-04-03T11:40:00.787" Score="4" Body="&lt;p&gt;The FFT is much better at detecting a sinusoid than a DWT.  The FFT is approximating a periodic signal with a series of periodic signals.  The coefficients of the FFT will be maximum in the frequency bins (could be a single bin with sufficient resolution) where the component of the FFT series best matches the periodic signal to be detected.  The noise will distribute roughly evenly in all bins, so the signal to be detected will show up readily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DWT is representing the signal to be detected (in this case a periodic signal) with a set of non-periodic functions, so this requires lots of components (bands as you refer to them – but DWT really works with scale not frequency) to follow the periodic nature of the signal to be detected.  The DWT is better suited to detect / analyze non-periodic signals.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-04-03T11:45:04.903" LastActivityDate="2013-04-03T11:45:04.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8479" PostTypeId="1" CreationDate="2013-04-03T13:25:48.063" Score="3" ViewCount="2385" Body="&lt;p&gt;I have an image that I am trying to process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/97FL4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want two seamingly contradictory effects:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I want to remove &quot;holes&quot; inside &quot;the blob&quot;. That is I want all pixels inside the blob to be solid red.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I want to move the boundary of the blob inwards.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From what I gather the morphological operation dilatation would do 1. and erosion would do 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But dilatation and erosion counteract each other?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How would you suggest I go about to achieve the desired result?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="697" LastActivityDate="2013-04-12T23:02:47.883" Title="Image processing: how do I erode on boundary and dilate inside boundary?" Tags="|image-processing|morphological-operations|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8480" PostTypeId="2" ParentId="8475" CreationDate="2013-04-03T13:32:45.377" Score="5" Body="&lt;p&gt;Gaussian Noise: Standard model of amplifier noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gamma Noise: Frequent in Radar/LiDAR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rayleigh Noise: One example where the Rayleigh distribution naturally arises is when wind velocity is analyzed into its orthogonal 2-dimensional vector components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exponential Noise: Channel Based Communication(see AEN).&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="958" LastEditDate="2013-04-03T19:14:39.763" LastActivityDate="2013-04-03T19:14:39.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8481" PostTypeId="1" AcceptedAnswerId="8497" CreationDate="2013-04-03T14:11:44.320" Score="2" ViewCount="96" Body="&lt;p&gt;i got a system with transfer function given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=1-e^{-j\omega}$$&#xA;I already plot it, and that seems to be a periodic function with $H(0)=0$, $H(\pi)=2$, , is that enough to show that this is a FIR bandpass filter. thank you very much&lt;/p&gt;&#xA;" OwnerUserId="3275" LastEditorUserId="3275" LastEditDate="2013-04-03T15:28:19.920" LastActivityDate="2013-04-04T13:25:57.203" Title="How to show that this filter is a HP filter" Tags="|filters|convolution|dsp-core|transfer-function|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8482" PostTypeId="1" AcceptedAnswerId="8483" CreationDate="2013-04-03T15:54:45.623" Score="2" ViewCount="574" Body="&lt;p&gt;What is the role of complex exponential $ e^{jθ} $ in Fourier Transform? Is it different in the continuous and in discrete time domain?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="80" LastEditDate="2013-04-03T15:59:00.077" LastActivityDate="2013-04-03T16:19:51.513" Title="What is the role of complex exponential?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8483" PostTypeId="2" ParentId="8482" CreationDate="2013-04-03T16:19:51.513" Score="2" Body="&lt;p&gt;Euler's relationship says that $e^{j\Theta}$ is equal to $cos(\Theta) + j*sin(\Theta)$.  The Fourier Transform can then be seen as correlating the signal with sinusoids at various frequencies.  The continuous Fourier Transform correlates with an infinite number of sinusoids, while the discrete transform uses $N$ sinusoids, where $N$ is the length of the transform.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-03T16:19:51.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8484" PostTypeId="2" ParentId="8287" CreationDate="2013-04-03T16:29:40.543" Score="3" Body="&lt;p&gt;The function is based on Matlab's &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/deconv.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;deconv&lt;/code&gt;&lt;/a&gt;, so reading that page should help understand it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a docstring I wrote for SciPy's deconvolve, but haven't submitted yet because I'm not sure it's 100% correct: &lt;a href=&quot;https://github.com/scipy/scipy/pull/430#issuecomment-13675004&quot; rel=&quot;nofollow&quot;&gt;https://github.com/scipy/scipy/pull/430#issuecomment-13675004&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input to deconvolve is &lt;code&gt;signal&lt;/code&gt; and &lt;code&gt;divisor&lt;/code&gt;, and your output is &lt;code&gt;quotient&lt;/code&gt; and &lt;code&gt;remainder&lt;/code&gt;, where &lt;code&gt;signal&lt;/code&gt; was originally produced by &lt;code&gt;signal = convolve(divisor, quotient) + remainder&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;original = [0, 1, 0, 0, 1, 1, 0, 0]&#xA;impulse_response = [2, 1]&#xA;recorded = scipy.signal.convolve(impulse_response, original)&#xA;print recorded&#xA;# [0 2 1 0 2 3 1 0 0]&#xA;recovered, remainder = scipy.signal.deconvolve(recorded, impulse_response)&#xA;print recovered, remainder&#xA;# [ 0.  1.  0.  0.  1.  1.  0.  0.] [ 0.  0.  0.  0.  0.  0.  0.  0.  0.]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't understand what you're trying to do with PMFs, though, so I can't give a more specific example.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-04-03T16:35:28.880" LastActivityDate="2013-04-03T16:35:28.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8485" PostTypeId="1" AcceptedAnswerId="8500" CreationDate="2013-04-03T17:45:58.220" Score="4" ViewCount="387" Body="&lt;p&gt;Is it possible to generate the z-domain transfer function from a pole-zero plot diagram?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="90" LastEditDate="2013-04-04T17:46:47.280" LastActivityDate="2013-04-04T17:46:47.280" Title="Can I determine a system's $z$-domain transfer function from its pole-zero plot?" Tags="|transfer-function|z-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8486" PostTypeId="1" CreationDate="2013-04-03T19:00:26.743" Score="2" ViewCount="11539" Body="&lt;p&gt;If I have, for example a 16-QAM signal, and the constellation points are &lt;code&gt;(3,3),(3,1),(1,3),(1,1),...(-3,-3)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have a simulated in coming signal with arbitrary power, how can I normalize the signal to this constellation so I can make correct decisions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing I could think of is to calculate the average power of the in coming signal and normalize it to the average energy of the constellation. But then when I have a very noisy signal, the noise power will effect the scaling factor considerably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there some kind of &lt;em&gt;least mean square&lt;/em&gt; method that I can implement so I can really get the scaling correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW I'm using Python/NumPy/SciPy for my simulation.&lt;/p&gt;&#xA;" OwnerUserId="4083" LastEditorUserId="90" LastEditDate="2013-04-05T19:56:35.883" LastActivityDate="2013-04-05T22:47:47.967" Title="How to normalize the power of a QAM signal?" Tags="|digital-communications|demodulation|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8487" PostTypeId="1" AcceptedAnswerId="8507" CreationDate="2013-04-03T19:47:18.903" Score="2" ViewCount="1308" Body="&lt;p&gt;Using the Fourier transformation I can translate a signal from the time-domain to the frequency-domain. If I divide the frequency axis into intervals, how can I calculate the audios signals energy for each of these intervals?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastActivityDate="2013-04-04T16:33:23.593" Title="How to calculate the energy levels of frequency intervals of an audio signal?" Tags="|audio|discrete-signals|fourier-transform|frequency|signal-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8488" PostTypeId="1" CreationDate="2013-04-03T20:19:57.833" Score="31" ViewCount="24618" Body="&lt;p&gt;I have a sensor that reports its readings with a time stamp and a value. However, it does not generate readings at a fixed rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find the variable rate data difficult to deal with. Most filters expect a fixed sample rate. Drawing graphs is easier with a fixed sample rate as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an algorithm to resample from a variable sample rate to a fixed sample rate?&lt;/p&gt;&#xA;" OwnerUserId="4274" LastActivityDate="2018-07-09T14:14:28.990" Title="What is an algorithm to re-sample from a variable rate to a fixed rate?" Tags="|resampling|" AnswerCount="7" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8489" PostTypeId="2" ParentId="8475" CreationDate="2013-04-03T20:30:06.630" Score="3" Body="&lt;p&gt;The noise that appears on x-ray images is Poisson in nature.  I find the treatment in &lt;a href=&quot;http://books.google.co.nz/books/about/Computed_Tomography.html?id=fNH1fSnjwrkC&amp;amp;redir_esc=y&quot; rel=&quot;nofollow&quot;&gt;Computed Tomography: From Photon Statistics to Modern Cone-Beam CT&lt;/a&gt; to be good for showing why, but in summary: X-ray photon generation in an x-ray tube is a Poisson process, then attenuation in whatever is being imaged is binomial, and so is detection, so the final image is still Poisson.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't help with examples of the other types, sorry.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-04-03T20:30:06.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8490" PostTypeId="1" CreationDate="2013-04-04T00:36:15.790" Score="1" ViewCount="97" Body="&lt;p&gt;I want to learn how to design structures that could model difference equations. I don't know how we call this things but i can show a picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uwcko.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example i want to understand the procedure that using addition, multiplication and delay operators like the above i can describe equations like: $ y(k)=1/2(x(k)+x(k-1)) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone knows any resources like books, tutorials , articles that explain how to design these structures?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-04-04T00:59:50.737" LastActivityDate="2013-04-04T00:59:50.737" Title="How to implement structures for difference equations?" Tags="|filters|delay|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8491" PostTypeId="2" ParentId="8486" CreationDate="2013-04-04T03:26:04.233" Score="2" Body="&lt;p&gt;If your signal is not rotating and/or sliding, then make a histogram of magnitudes. The peaks on histogram will clearly tell where are the constellation points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal is rotating and/or sliding, then your only option is rms value with sufficient averaging.&lt;/p&gt;&#xA;" OwnerUserId="4277" LastActivityDate="2013-04-04T03:26:04.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8492" PostTypeId="1" CreationDate="2013-04-04T11:12:33.933" Score="2" ViewCount="323" Body="&lt;p&gt;While reading a description on FFT from &lt;a href=&quot;http://www.dspguide.com/ch12/2.htm&quot; rel=&quot;nofollow&quot;&gt;this book&lt;/a&gt;, I found the following statement:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...diluting the time domain with zeros corresponds to a duplication of&#xA;  the frequency spectrum.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can I prove this intuitively or otherwise? I have read some properties of Fourier Transform, such as a  circular shift in time domain and frequency domain etc, but I am unable to deduce how duplication in frequency domain will happen. Following illustrate this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Time domain samples&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(0)=a    &#xA;x(1)=b&#xA;x(2)=c&#xA;x(3)=d&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Frequency domain samples&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X(0)=A    &#xA;X(1)=B&#xA;X(2)=C&#xA;X(3)=D&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Dilution with 0 in time domain&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(0)=a    &#xA;x(1)=0&#xA;x(2)=b&#xA;x(3)=0&#xA;x(4)=c    &#xA;x(5)=0&#xA;x(6)=d&#xA;x(7)=0 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Frequency domain samples having duplicate values&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X(0)=A    &#xA;X(1)=B&#xA;X(2)=C&#xA;X(3)=D&#xA;X(4)=A    &#xA;X(5)=B&#xA;X(6)=C&#xA;X(7)=D&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Frequency domain samples have duplicate values. Why? &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2013-11-07T17:17:29.560" Title="How to prove that Dilution of a time domain signal results in duplication in Frequncy domain?" Tags="|fft|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8493" PostTypeId="1" CreationDate="2013-04-04T12:26:22.227" Score="2" ViewCount="4769" Body="&lt;p&gt;I'm working on an OFDM-QPSK based system and I'm having some trouble to match the BER of my system with the theoretical curve. My OFDM implementation fills all the subcarriers and have t_symbol s duration and t_cp cyclic prefix duration. I'm trying this to validate my system implementation before go on with my system development. I'm using the following python code for apply noise:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def awgn(self,data,noise_power):        &#xA;    Es = sum(abs(data)**2.)&#xA;    Eb = Es/(self.OFDM_SIZE*2.)&#xA;    EbN0_dB = noise_power + 10*log10(self.t_symbol/(self.t_symbol - self.t_cp))&#xA;    EbN0 = (10.)**(EbN0_dB/10.)&#xA;    N0 = Eb/EbN0&#xA;    noise = sqrt(N0/2.)*(random.standard_normal((data.size,)) + random.standard_normal((data.size,))*1j)&#xA;    return (data + noise)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I just realize that the normalization done here is not correct, since this signal is post OFDM modulation. But the problem remains.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The equation for the theoretical curve used is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BER_t   = 0.5*erfc(n_sqrt((10.**(EbN0_vt/10.))/2.))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I had used similar code before on Matlab and it worked fine, but now It's not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it's not working now because my system don't have the constellation with (1+1j),(1-1j)... I have to use values that are less than one, since my system is implemented in fixed point. Now I'm using 0.75 as an amplitude but it's arbitrary chosen. I tried to correct the energy symbol to get a mean energy equal to one but using this take my signal out of range. I'm thinking about correct the EbN0 before apply on the theoretical BER equation,  but I'm just wondering how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone give me the correct way to go?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;My central question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Trying to improve my question:&#xA;What I need to know is how to apply awgn on ofdm signal when it's subcarrier are modulated with QPSK and how to match it with the theoretical BER plot. My QPSK symbol have an amplitude of 0.75. The above code is to show how I'm doing it now.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;update&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I run the code changing the FFT subsystem to the scipy.fftpack and the amplitude of the QPSK symbol to 1 instead of 0.75. And the curve match. I also had corrected the theoretical curve to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BER_t   = 0.5*erfc(n_sqrt((10.**(EbN0_vec/10.))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I still think it's a matter of correct the EbN0 in the above equation.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;update2&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;After several testing of the above functions I found thet they are correct. The source of the problem is that I'm dealing with fixed point implementation of IFFT/FFT and I have to handle the channel model with this situation in mind. I'm trying to figure out how to handle this but without a solution yet.&lt;/p&gt;&#xA;" OwnerUserId="4144" LastEditorUserId="4144" LastEditDate="2013-04-08T19:13:06.767" LastActivityDate="2013-04-08T19:13:06.767" Title="Apply AWGN noise to QPSK-OFDM symbol" Tags="|python|digital-communications|qpsk|ofdm|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="8494" PostTypeId="1" AcceptedAnswerId="8495" CreationDate="2013-04-04T12:34:02.587" Score="4" ViewCount="931" Body="&lt;p&gt;Is there a verb for removing the mean or DC component of a signal? I am trying to name a flag for doing just that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Normalize&quot; can mean many things, so I don't think that would be a good choice.&lt;/p&gt;&#xA;" OwnerUserId="471" LastEditorUserId="15892" LastEditDate="2018-07-20T20:57:32.863" LastActivityDate="2018-07-20T21:04:47.423" Title="Verb for subtracting the mean?" Tags="|terminology|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8495" PostTypeId="2" ParentId="8494" CreationDate="2013-04-04T13:02:20.637" Score="8" Body="&lt;p&gt;I've heard this referred to as &lt;em&gt;demeaning&lt;/em&gt; a signal, or applying a &lt;em&gt;DC notch&lt;/em&gt; (or, in some more hardware-related domains, a &lt;em&gt;DC block&lt;/em&gt;). More generally, it might be called just &lt;em&gt;highpass filtering&lt;/em&gt; the signal to remove the DC component.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-04-04T13:02:20.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8496" PostTypeId="2" ParentId="8494" CreationDate="2013-04-04T13:05:22.717" Score="3" Body="&lt;p&gt;I've heard this called &lt;strong&gt;detrending&lt;/strong&gt;. Although DC removal is a subset of what this means, &lt;a href=&quot;http://www.mathworks.com/help/matlab/data_analysis/detrending-data.html&quot; rel=&quot;nofollow&quot;&gt;the Mathworks refers to it&lt;/a&gt; in their &lt;code&gt;detrend&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The MATLAB® function detrend subtracts the mean or a best-fit line &#xA;(in the least-squares sense) from your data. If your data contains &#xA;several data columns, detrend treats each data column separately.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-04T13:05:22.717" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8497" PostTypeId="2" ParentId="8481" CreationDate="2013-04-04T13:25:57.203" Score="3" Body="&lt;p&gt;As was pointed out in the comments above, this is a highpass filter. There is no strict definition for what constitutes a lowpass, bandpass, or highpass filter. Instead, they possess certain qualities:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Lowpass filters attenuate high frequencies while passing low frequencies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bandpass filters attenuate low and high frequencies, while passing some band in the middle.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Highpass filters attenuate low frequencies while passing high frequencies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note the lack of precise terms in the descriptions above. In order to classify a filter into a category like those above, one evaluates the character of its magnitude transfer function. That requires a little manipulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(\omega) = 1 - e^{-j\omega}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;|H(\omega)| &amp;amp;= |1 - e^{-j\omega}| \\&#xA;&amp;amp;= \left|e^{-j\frac{\omega}{2}} \left(e^{j\frac{\omega}{2}} - e^{j\frac{\omega}{2}}\right)\right|&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;http://en.wikipedia.org/wiki/Euler%27s_formula#Relationship_to_trigonometry&quot; rel=&quot;nofollow noreferrer&quot;&gt;Euler's identity&lt;/a&gt;, we can simplify the expression inside the parentheses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e^{j\frac{\omega}{2}} - e^{j\frac{\omega}{2}} = j2\sin\left(\frac{\omega}{2}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|H(\omega)| = \left|e^{-j\frac{\omega}{2}} j2\sin\left(\frac{\omega}{2}\right)\right|&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can drop the $j$ and $e^{-j\frac{\omega}{2}}$ terms here, because each of them have unity magnitude and therefore don't affect $|H(\omega)|$. Therefore:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|H(\omega)| = \left|2\sin\left(\frac{\omega}{2}\right)\right|&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can check this result by comparing it with a plot from MATLAB's Filter Visualization Tool (&lt;code&gt;fvtool&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P0FRw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which looks about right. This is plotted over the region $\omega \in [0, \pi]$, and shows that the filter has zero response at DC (attenuating low frequencies) and a magnitude response of $2$ at $\omega = \pi$ (passing high frequencies). That looks like a highpass filter.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-04-04T13:25:57.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8498" PostTypeId="2" ParentId="8488" CreationDate="2013-04-04T13:28:29.333" Score="1" Body="&lt;p&gt;Before you get into doing some exotic processing you could try something simple like this (pseudo code - no interpolation, but that could be added)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;TimeStamp[]  //Array of Sensor TimeStamps -NULL terminated – TimeStamp[i] corresponds to Reading[i]&#xA;Reading[]      //Array of Sensor Readings       -NULL terminated&#xA;&#xA;AlgorithmOut   //Delimited file of of readings in fixed sample time (5ms) &#xA;CurrentSavedReading = Reading[0]&#xA;&#xA;SampleTime=TimeStamp[0] //ms virtual sample time, 5ms fixed samples&#xA;&#xA;i = 0 // loop index&#xA;While(TimeStamp[i] != NULL)&#xA;{&#xA;   FileWrite (CurrentSavedReading, AlgorithmOut)//write value to file&#xA;   SampleTime = SampleTime + 5//ms&#xA;   if(SampleTime &amp;gt; TimeStamp[i])&#xA;   {&#xA;      i++&#xA;      CurrentSavedReading = Reading[i]&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="1849" LastEditDate="2013-04-05T13:06:51.013" LastActivityDate="2013-04-05T13:06:51.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8499" PostTypeId="2" ParentId="7576" CreationDate="2013-04-04T14:03:49.710" Score="3" Body="&lt;p&gt;The first thing you must change for understanding why IFFT is used for OFDM is to forget about time and frequency domains. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the name states OFDM is a technique about frequency domain multiplexing. When you think in FDM you'll have several channels modulated with a guard interval between then to prevent interference. If the carriers are orthogonal you'll not have interference, but without the waste of band guard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how you can have this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way is to use several modulators, as in FDM, but with the correct frequencies. This is hard to accomplish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you will implement digitally the filter bank,and this is the correct way to view IFFT on OFDM systems: a transmultiplexer(TMUX), is equivalent to an IDFT. This is why you can use IFFT as a fast implementation for OFDM. You can read one of the books about multi-carrier communication for a better explanation. This paper&#xA;&lt;a href=&quot;http://wsl.stanford.edu/~ee359/ofdm_bingham.pdf&quot; rel=&quot;nofollow&quot;&gt;http://wsl.stanford.edu/~ee359/ofdm_bingham.pdf&lt;/a&gt; is also one that I like about multi-carrier modulation.&lt;/p&gt;&#xA;" OwnerUserId="4144" LastActivityDate="2013-04-04T14:03:49.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8500" PostTypeId="2" ParentId="8485" CreationDate="2013-04-04T14:19:44.283" Score="4" Body="&lt;p&gt;Without knowing specifics (ignoring a proportionality constant we'll call K as inidicated in the more compete answer above).  Note that K does not affect the dynamic behavior of the system, so it may not be of particular interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it goes like this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H(z) is a rational function of the form &#xA;$$H(z) = \frac{(z-Z1)(z-Z2)...(z-Zm)}{(z-P1)(z-P2)...(z-Pn)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where Z1,Z2...Zm are your zero values and P1,P2...Pn are your pole values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you know the exact values of you're poles and zeros. If you don't, you'll have to determine approximations from the PZP.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-04-04T17:14:07.703" LastActivityDate="2013-04-04T17:14:07.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8501" PostTypeId="1" AcceptedAnswerId="8503" CreationDate="2013-04-04T14:21:23.473" Score="4" ViewCount="7200" Body="&lt;p&gt;I found an approximation of a 5x5 2D convolution kernel like this :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JoGaV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the sum of the elements is zero and this one was used for Laplacian of Gaussian!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another one here :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UsU96.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This one has all positive and the sum is not zero and is being used for smoothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please tell me what is with the sum being zero in the previous case ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://fourier.eng.hmc.edu/e161/lectures/gradient/node9.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link1&lt;/a&gt; and  &lt;a href=&quot;http://www.songho.ca/dsp/convolution/convolution.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link2&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4271" LastEditorUserId="3958" LastEditDate="2019-09-11T12:22:36.580" LastActivityDate="2019-09-11T12:22:36.580" Title="When should the sum of all elements of a gaussian kernel be zero?" Tags="|convolution|gaussian|smoothing|kernel|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8502" PostTypeId="2" ParentId="8488" CreationDate="2013-04-04T14:26:41.550" Score="5" Body="&lt;p&gt;I think Jacob's answer is very workable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easier method that's probably not quite as good in terms of introducing distortion is to do polynomial interpolation.  I would use either linear interpolation (easy, not as good signal performance-wise) or cubic splines (still not too hard, better signal performance) to produce samples at any time you want from your arbitrary time samples.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-04-04T16:16:45.410" LastActivityDate="2013-04-04T16:16:45.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8503" PostTypeId="2" ParentId="8501" CreationDate="2013-04-04T14:32:23.623" Score="8" Body="&lt;p&gt;The sum of a gaussian kernel cannot be zero, because all the elements are going to be positive. The first kernel you have shown, is most likely an edge detection kernel, (which is a type of high pass filter), so the elements add up to zero because you want to completely null out any DC/constant component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second kernel you have shown however, is a low pass kernel, indeed used in smoothing. Here the elements are not going to add up to zero because you are not trying to remove the 'constant' part of the image, in fact, you are trying to remove any high frequency noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-04-04T14:32:23.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8504" PostTypeId="2" ParentId="8501" CreationDate="2013-04-04T15:11:46.347" Score="1" Body="&lt;p&gt;The sum of all the elements in &lt;strong&gt;a&lt;/strong&gt; kernel should be zero when you want to completely remove the &quot;DC&quot; or constant or offset term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/8503/80&quot;&gt;As Mohammad says&lt;/a&gt;: this means that the Gaussian &lt;em&gt;cannot&lt;/em&gt; sum to zero, because it is  a smoothing kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your title should say &lt;code&gt;When should the sum of all elements of a Laplacian of Gaussian kernel be zero?&lt;/code&gt;, then that makes more sense.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-04-04T15:11:46.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8505" PostTypeId="2" ParentId="8485" CreationDate="2013-04-04T15:15:12.597" Score="4" Body="&lt;p&gt;No, it is not possible to generate the $z$-domain transfer function uniquely and solely from the pole-zero plot. The reason is because you can only generate something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = K \frac{(z-Z_1)(z-Z_2)...(z-Z_m)}{(z-P_1)(z-P_2)...(z-P_n)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from the pole-zero diagram, and there is nothing in that diagram to tell you what the gain term, $K$, is.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-04T16:17:19.547" LastActivityDate="2013-04-04T16:17:19.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8506" PostTypeId="2" ParentId="8488" CreationDate="2013-04-04T15:25:38.860" Score="6" Body="&lt;p&gt;This sounds like a problem of asynchronous sample rate conversion.  To convert from one sample rate to another, we can compute the continuous time representation of the signal by performing sinc interpolation, then resample at our new sample rate.  What you are doing is not much different.  You need to resample your signal to have sample times that are fixed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The continuous time signal can be calculated by convolving each sample with a sinc function.  Since the sinc function continues indefinately, we use something more practical like a windowed sinc of a practical finite length.  The tricky part is that because your samples move about in time, a sinc with a different phase offset may need to be used for each sample when resampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuous time signal from sampled signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t) = \sum\limits_{n=-\infty}^\infty x[n]sinc({t-nT_s\over T_s})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T_s$ is your sample time.  In your case, however, your sample time is not fixed.  So I think you need to replace it with the sample time at that sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t) = \sum\limits_{n=-\infty}^\infty x[n]sinc({t-nT_s[n]\over T_s[n]})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this you can resample the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = x(nT_{ns} $)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T_{ns}$ is the desired sample time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting it all together you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[m] = \sum\limits_{n=-\infty}^\infty x[n]sinc({mT_{ns}-nT_s[n]\over T_s[n]})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is not causal or tractable, the sinc function can be replaced with a function of finite support and the limits of summation adjusted accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let kernel(t) be a windowed sinc or other similar function of length 2k then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[m] = \sum\limits_{n=-k}^k x[n]kernel({mT_{ns}-nT_s[n]\over T_s[n]})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps..., but I may have made a mistake along the way and it might be a little math intensive.  I would recommend researching sample rate conversion for more information.  Maybe somebody else here could give a better explanation or solution as well.&lt;/p&gt;&#xA;" OwnerUserId="153" LastActivityDate="2013-04-04T15:25:38.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8507" PostTypeId="2" ParentId="8487" CreationDate="2013-04-04T16:33:23.593" Score="3" Body="&lt;p&gt;You may research for spectrogram. The above comments from pichennets and B Z are correct, but you have to pay attention to the effect of just take some subset of coefficients and calculate the power. When you take this way you're applying a retangular window in frequency, and some peaks in the frequency domain power. You must apply a window in time domain before take the FFT and calculate the power.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I want to add this as a comment, since it's not a real answer but I'm not abble to do this.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4144" LastActivityDate="2013-04-04T16:33:23.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8508" PostTypeId="1" AcceptedAnswerId="8510" CreationDate="2013-04-04T22:01:34.680" Score="3" ViewCount="12506" Body="&lt;p&gt;I am given 256 &lt;a href=&quot;https://dl.dropbox.com/u/16641927/dataSet.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;samples&lt;/a&gt; at a sampling rate of 48k and am asked to find the frequency of dominate tones and the amplitude of the largest tone. The data looks like this when plotted: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SKTI4.png&quot; alt=&quot;n&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume I must use a FFT transform to do this. I've tried this in matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 48000;&#xA;x = dataSet; % 256 samples data set&#xA;xdft = fft(x);&#xA;maxAmp = max(abs(xdft));&#xA;%Not sure how I can grab the tones here&#xA;freq = 0:Fs / length(x):Fs/2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not really sure how to proceed, Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4281" LastEditorUserId="4281" LastEditDate="2013-04-04T22:11:18.107" LastActivityDate="2017-06-23T09:27:48.283" Title="Finding the dominant tone in a signal" Tags="|fft|matlab|discrete-signals|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8509" PostTypeId="2" ParentId="8508" CreationDate="2013-04-04T23:19:43.940" Score="3" Body="&lt;p&gt;Have you tried plotting the magnitude of &lt;code&gt;xdft&lt;/code&gt;?  You should be able to see where the peaks are.  To find the frequency associated with any peak, find the index where the peak magnitude lives, and use that to pull the frequency from an array like your &lt;code&gt;freq&lt;/code&gt;, except you should create it from 0 to &lt;code&gt;Fs&lt;/code&gt; with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freq = 0:Fs/(length(xdft)-1):Fs;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;since the DFT runs from 0 to the sampling frequency.  If you would prefer it in the range &lt;code&gt;-Fs/2:Fs/2&lt;/code&gt;, you can reorder it with &lt;code&gt;fftshift&lt;/code&gt;, but I'll let you read up on that function.  You should also find that the spectrum is symmetrical, so you'll get two peaks (of the same height) for the strongest frequency.  You can easily drop half of the spectrum for processing, of course.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-04-04T23:19:43.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8510" PostTypeId="2" ParentId="8508" CreationDate="2013-04-04T23:31:10.747" Score="5" Body="&lt;p&gt;I think you are having trouble constructing your frequency axis properly. Once you do this, you can do a simple peak pick. I have re-written the code for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 48000;&#xA;x = dataSet;            % 256 samples data set&#xA;fftLength = length(x);  % Always make sure to be at least as long as your data. &#xA;xdft = fft(x,fftLength);&#xA;maxAmp = max(abs(xdft));&#xA;&#xA;freq = [0:fftLength-1].*(Fs/fftLength); % This is your total freq-axis&#xA;freqsYouCareAbout = freq(freq &amp;lt; Fs/2);  % You only care about either the pos or neg &#xA;                                        % frequencies, since they are redundant for&#xA;                                        % a real signal.&#xA;&#xA;xdftYouCareAbout = abs(xdft(1:round(fftLength/2))); % Take the absolute magnitude.&#xA;&#xA;[maxVal, index] = max(xdftYouCareAbout); % maxVal is your (un-normalized) maximum amplitude&#xA;&#xA;maxFreq = freqsYouCareAbout(index); % This is the frequency of your dominant signal. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="293" LastEditorUserId="14931" LastEditDate="2015-03-04T02:57:26.030" LastActivityDate="2015-03-04T02:57:26.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8511" PostTypeId="2" ParentId="8494" CreationDate="2013-04-05T05:53:07.883" Score="0" Body="&lt;p&gt;Another potential candidate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Zero-DC-ing the signal&quot;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-04-05T05:53:07.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8512" PostTypeId="2" ParentId="8494" CreationDate="2013-04-05T06:35:31.343" Score="6" Body="&lt;p&gt;I've heard the word &lt;em&gt;centering&lt;/em&gt; for setting the mean of a signal to 0.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-04-05T08:08:01.890" LastActivityDate="2013-04-05T08:08:01.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8513" PostTypeId="1" AcceptedAnswerId="8523" CreationDate="2013-04-05T07:47:57.217" Score="1" ViewCount="1361" Body="&lt;p&gt;I am trying to write an image processing program to recognize bubbles in oil.&#xA;It has been suggested I try computing the convolution of the image and an image of a typical bubble. &#xA;i.e. : ifft(fft(a).fft(b)) will have high peaks near bubbles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;br&gt;&#xA;ifft : inverse fourier transform &lt;br&gt;&#xA;fft : fourier transform &lt;br&gt;&#xA;a : the image &lt;br&gt;&#xA;b : kernel image (bubbles) &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a good way to solve this problem? Also, for the dot product to work, I need the images to be the same dimension. This is not likely to be the case.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastEditorUserId="609" LastEditDate="2013-04-05T13:07:30.423" LastActivityDate="2013-04-06T08:01:36.290" Title="Image processing, recognizing a small feature in a larger image" Tags="|image-processing|fourier-transform|opencv|convolution|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8514" PostTypeId="2" ParentId="8513" CreationDate="2013-04-05T08:07:34.887" Score="5" Body="&lt;p&gt;What has been suggested to you is called &lt;em&gt;template matching&lt;/em&gt;. If you don't mind re-using code (and working with C++), you can find an implementation in the &lt;a href=&quot;http://opencv.org&quot;&gt;OpenCV library&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simpler alternative (that I would start with) would be to work with &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform#Circle_Detection_Process&quot;&gt;generalized Hough transform&lt;/a&gt;, but that will require some pre-processing first by detecting the edges in the image.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-04-05T08:07:34.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8515" PostTypeId="1" CreationDate="2013-04-05T08:36:07.903" Score="1" ViewCount="1217" Body="&lt;p&gt;I read many sources about kalman filter, yet no about the other approach to filtering, where canonical parametrization instead of moments parametrization is used. &#xA;So I would like to learn on examples how to use this filter with information matrix and information vector (not mean and covariance from KF). &#xA;Can anyone help me with this, give some examples, webpages, or parts of implementation code to be a basis to learn? &#xA;Really appreciate!&lt;/p&gt;&#xA;" OwnerUserId="4168" LastActivityDate="2013-04-05T10:25:23.127" Title="information filter instead of kalman filter approach" Tags="|filters|kalman-filters|covariance|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8516" PostTypeId="2" ParentId="8515" CreationDate="2013-04-05T10:25:23.127" Score="-1" Body="&lt;p&gt;Information filters are an application of a learning algorithm. One example of an information filter would be a recommendation system. On the other hand, a kalman filter is restricted to linear tracking. Its not learning per se.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking for machine learning/AI based approaches to SLAM, then you should probably look at Particle Filters.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-04-05T10:25:23.127" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8518" PostTypeId="2" ParentId="4868" CreationDate="2013-04-05T12:36:57.080" Score="0" Body="&lt;p&gt;No matter of contour or area moments, &lt;em&gt;central moments&lt;/em&gt; mean moments that are computed in a centered reference frame, i.e., a frame centered on the mean of your phenomenon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, this means that you need to compute the first order moments $(\mu_{0,1},\mu_{1,0})$ (contour or area), then compute subsequent moments using $\mathbf{\mu} = (\mu_{01},\mu_{10})$ as origin.&#xA;This is a simple translation (subtraction of coordinates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also related, this &lt;a href=&quot;https://dsp.stackexchange.com/questions/8494/verb-for-subtracting-the-mean/8512#8512&quot;&gt;question&lt;/a&gt; about vocabulary.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-04-05T12:36:57.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8519" PostTypeId="2" ParentId="8508" CreationDate="2013-04-05T12:45:59.990" Score="0" Body="&lt;p&gt;OK, there are several issues here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You need to detrend :-) the data to remove the non-zero mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x = dataSet - mean(dataSet);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because the largest component (when I do an FFT) is the DC offset.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then you can use any number of techniques to find the next highest.  The previous answers are good. &lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms/discperiod&quot; rel=&quot;nofollow&quot;&gt;This link has an implementation of it that I did many moons ago called &lt;code&gt;discperiod&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;omega1 = discperiod(dataSet);&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;That, however, will only find the &lt;em&gt;next&lt;/em&gt; highest peak in the spectrum. So you need to remove the frequency component found in step 2. To do that in a statistically sensible way, you need to find the amplitude and phase of that component. One way to do this is to solve the least squares problem:&#xA;$$&#xA;   \min_{A, \phi} \sum_{t=0}^{T-1} \left | x[t] - A \cos({\tt omega1} t + \phi) \right|^2&#xA;$$&#xA;That is, minimize over $A$ and $\phi$. This can be done pretty simply by just finding the FFT coefficient of &lt;code&gt;omega1&lt;/code&gt;. &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Sinusoidal_Amplitude_Phase_Estimation.html&quot; rel=&quot;nofollow&quot;&gt;Julius O. Smith III derives this here.&lt;/a&gt;  The mean correction is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x_res = x - A*cos(omega*[0:T-1]'+phi);&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Trying to find the next highest peak from &lt;code&gt;x_res&lt;/code&gt; can show up a problem: the next highest peak is probably on the &quot;edge&quot; of the first peak (that has just been removed). This is because the &lt;code&gt;discperiod&lt;/code&gt; function quantizes the possible frequencies to the FFT bin frequencies. A simple way to fix this is to choose what Mohammad calls &lt;code&gt;fftLength&lt;/code&gt; to be as large as the accuracy required. This can be several times larger than the length of the signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;No more time! Will try to write up more later.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-05T12:45:59.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8520" PostTypeId="2" ParentId="8493" CreationDate="2013-04-05T13:24:39.550" Score="2" Body="&lt;p&gt;Your measurement of the symbol and noise energy is not correct.  Please note that the following is pseudo-code, not valid Python code.  EbN0_dB should be an input to this code, not an output.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Esymbol = sum(real(data*conj(data))) / numSymbolsInData&#xA;Eb = Es/numPayloadBitsPerSymbol&#xA;Eb_dB = 10*log10(Eb)&#xA;N0_dB = Eb_dB - EbN0_dB&#xA;N0 = (10.)**(N0_dB/10.)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-05T13:24:39.550" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8521" PostTypeId="2" ParentId="4868" CreationDate="2013-04-05T13:57:43.087" Score="5" Body="&lt;p&gt;Actually, I was surprised how hard was it do deduct a proper definition of &lt;em&gt;contour&lt;/em&gt; versus &lt;em&gt;&quot;normal&quot;, non-contour&lt;/em&gt; moments of an image. After reading a bunch of materials, here come my conclusions.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Firstly, in order to &lt;strong&gt;understand moments&lt;/strong&gt;, and especially the difference and the usage of &lt;em&gt;spatial&lt;/em&gt; (what the OP calls &quot;raw&quot;), &lt;em&gt;central&lt;/em&gt;, and &lt;em&gt;central normalized&lt;/em&gt; moments, I found two very good materials:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;(manual) &lt;a href=&quot;http://breckon.eu/toby/teaching/dip/opencv/SimpleImageAnalysisbyMoments.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Johannes Kilian: &quot;Simple Image Analysis By Moments&quot;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Excellent manual with simple mathematics. Don't be scared by the integrals - you can read all of them as summations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, it has a small overview on OpenCV functions used to operate with this moments. It's very old material (2001), so the OpenCV manual it is referring to is a bit old, but it still helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And than there's the wonderful third chapter, specifying which moment is used to describe which characteristic of a moment.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(image processing blog) &lt;a href=&quot;http://www.aishack.in/tutorials/image-moments/&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Utkarsh: Image Moments&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple, short and friendly. I found a lot of good material on this blog before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;sub&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt; &lt;em&gt;AI Shack&lt;/em&gt; seemed to be offline at some point. &lt;a href=&quot;http://utkarshsinha.com/&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is the homepage from the &lt;em&gt;AI Shack&lt;/em&gt; author, where he talks about this project, so it still seems to be supported. I hope it comes back online soon, but if not maybe it can be tracked through the author's webpage.&lt;/sub&gt;&lt;/sup&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Shortly, the &lt;strong&gt;spatial&lt;/strong&gt; moments give information about the object &lt;em&gt;in the image&lt;/em&gt;, i.e. &lt;em&gt;related (dependent) on the object position&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;central&lt;/strong&gt; moments are &lt;em&gt;adjusted for translational invariance&lt;/em&gt;, by moving the origin of the &quot;coordinate system&quot; used for calculations to the centroid (center of gravity) of the object in question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the &lt;strong&gt;central normalized moments&lt;/strong&gt; are scaled by the area of the object, and are thus &lt;em&gt;scale invariant&lt;/em&gt; in addition to translational invariance.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now for the actual question part: &lt;strong&gt;what about contour moments?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The deductions from this part are mostly based on&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://docs.opencv.org/opencv2refman.pdf&quot; rel=&quot;nofollow&quot;&gt;OpenCV reference manual, v. 2.4.4.0&lt;/a&gt;, Chapter 3.5: &lt;em&gt;Structural Analysis and Shape Descriptors&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Green_theorem&quot; rel=&quot;nofollow&quot;&gt;wikipedia page for &lt;em&gt;Green's theorem&lt;/em&gt;&lt;/a&gt; - following the link from OpenCV manual, the method used when calculating contour moments (I'll explain in a few lines)&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://books.google.fr/books?id=seAgiOfu2EIC&amp;amp;pg=PA252&amp;amp;lpg=PA252&amp;amp;dq=%22contour+moments%22+images&amp;amp;source=bl&amp;amp;ots=hSJ56lhCKe&amp;amp;sig=XfG5u8Yg_PeRdCyO1oWDoMrtydw&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=fcheUcDLC6Ob0AXg5IDIBg&amp;amp;redir_esc=y#v=onepage&amp;amp;q=%22contour%20moments%22%20images&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;Gary Bradski, Adrian Kaehler: &quot;Learning OpenCV: Computer Vision with the OpenCV Library&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Link is to google books, but the relevant pages are accessible. The section that I linked to, plus the next 2-3 sections are relevant. That's about 3 pages total)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And the most important quotes from those sources:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The moments of a contour are deﬁned in the same way but computed using the Green’s formula.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(OpenCV reference manual)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In plane geometry, and in particular, area surveying, Green's theorem can be &lt;strong&gt;used to determine the area and centroid&lt;/strong&gt; of plane figures &lt;strong&gt;solely by integrating over the perimeter&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(wiki for Green)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Moreover, &lt;code&gt;cvContourMoments&lt;/code&gt; is now just an alias for &lt;code&gt;cvMoments&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(Bradski Kaehler book)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on that, I would deduce that &lt;strong&gt;contour moments does not refer to special measures of the object contours, but instead to a &lt;em&gt;particular way to calculate image moments&lt;/em&gt;, only using the contour information&lt;/strong&gt; (instead of pixel information for the whole image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference, in the fundamental case, would be how both are calculated.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;My guess would be that the direct implementation would work by pixel-by-pixel summation, directly implementing the formula. The object is expected to be filled.&lt;/li&gt;&#xA;&lt;li&gt;My guess for the contour moments would be that the image contours are first determined (consult OpenCV manual) and then the Green theorem is applied on the contour data.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That would make the measurements slightly different for real images because the methods would differ in their: &lt;strong&gt;sensitivity to: noise, scaling, discretisation&lt;/strong&gt; (pixel grid instead of continuous image). Also, the &lt;strong&gt;speed&lt;/strong&gt;: calculating using contours is faster than using the direct approach. I would speculate that they would give perfectly equal results for an (idealized) continuous black and white image with no noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to answer your questions: &lt;strong&gt;the moments should be the same&lt;/strong&gt; (differing because of noise etc). You can use &lt;em&gt;spatial (raw) moments&lt;/em&gt; calculated by both methods to determine &lt;em&gt;central moments&lt;/em&gt; (that will still describe the same thing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further support of this claims is the existence of this article (I only read the abstract, but should be very relevant, and even the abstract is informative) from 1994:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.48.6956&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Luren Yang, Fritz Albregtsen: &quot;Fast and Exact Computation of Moments Using Discrete Green's Theorem&quot;&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note about getting the perimeter measure&lt;/strong&gt;: I think, to get the &quot;perimeter&quot; which is actually just area of the contour, I would calculate the $0^{th}$ moment of the image of the contours of the objects, but treat the contours as &lt;em&gt;a really thin object, instead of as &quot;contours of an object&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All further measurements would of course differ if you used this moment further.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="1707" LastEditDate="2016-07-22T02:33:16.680" LastActivityDate="2016-07-22T02:33:16.680" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8523" PostTypeId="2" ParentId="8513" CreationDate="2013-04-05T14:39:40.473" Score="2" Body="&lt;p&gt;Template matching works well for some cases, with some caveats: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) you will probably need to pre-whiten your image before it will work successfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) your FFTs and IFFT should be of an appropriate length to avoid aliasing due to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Circular_convolution&quot; rel=&quot;nofollow noreferrer&quot;&gt;circular convolution&lt;/a&gt; involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this example of item 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WtUiL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The patch we are trying to find is the singer's nose.  This is a toy example, because I've used the exact pixels from the image (rather than a &quot;template&quot;), but it illustrates the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom left image shows what happens when you use template matching (as you've described in the question) without doing any processing.  The problem is that there is no localization at all: it's very hard to discern the true &quot;peak&quot; in the surface that is generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom right image shows what happens when the same operation occurs, but a (stupidly simple) pre-whitening of applying the &lt;code&gt;diff&lt;/code&gt; operation to both the image being searched and the template.  It's a little hard to see because the peak is so small and large, but there is a red peak in the correct place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image shows the &quot;side view&quot; of the bottom two images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QqMFc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-05T18:09:45.413" LastActivityDate="2013-04-05T18:09:45.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8524" PostTypeId="1" CreationDate="2013-04-05T14:40:22.663" Score="3" ViewCount="63" Body="&lt;p&gt;In an old paper &quot;A New Approach to Geometry of Range Difference Location&quot;, there is a mathematical derivation that does not include any mention of the relationship to the underlying problem. In the problem, there are 3 receivers (at $(x_1, y_1)$, $(x_2, y_2)$, and $(x_3, y_3)$) and a transmitter at unknown position $(x_0, y_0)$. We also know the range difference (computed from the time difference of arrival) between each pair of receivers ($\Delta_mn = r_n - r_m$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The derivation starts by writing the distance (range) from each receiver to the unknown transmitter location as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$r_i^2 = (x_0 - x_i)^2 + (y_0 - y_i)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good. However, the next step only says &quot;Then, $r_j^2 - r_i^2 = \Delta_{ij} (r_i + r_j)$&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author goes on to show more manipulations to get to the point he is trying to show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like you can apply the &quot;difference of squares&quot; factorization to $r_j^2 - r_i^2$ to obtain $(r_j-r_i)(r_j+r_i)$ (where $r_j - r_i$ is exactly $\Delta_{ij}$), but what I don't understand is the meaning of $r_j^2 - r_i^2 = \Delta_{ij} (r_i + r_j)$. That is, why is the difference of squared distances from the transmitter to two receivers related to the sum of the distances from the transmitter to the two receivers (besides &quot;because we happened to subtract two things and then find a factorization that happened to contain a term we know)? Does anyone have any insight on this? Perhaps a way to explain this using some kind of triangle theorem in a diagram?&lt;/p&gt;&#xA;" OwnerUserId="1032" LastActivityDate="2013-04-05T14:40:22.663" Title="Intuition of Location on the Conic Axis TDOA solution" Tags="|signal-detection|signal-analysis|geometry|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8525" PostTypeId="1" AcceptedAnswerId="8526" CreationDate="2013-04-05T15:59:15.333" Score="9" ViewCount="13143" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hrtqx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am learning DFT and I am not sure I understand it correctly. I am just going to write out the process of DFT and I am asking you to tell me if I am thinking the right way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have a signal on which we run DFT to get the frequencies incorporated in the signal. We use a window of size N samples and calculate DFT on it. The result are frequencies which occur in this chunk of audio. Now we can display the spectrum (like Winamp does). But we would like to display the spectrum while the song is playing thus calculating DFT for many such windows. Because it would take a long time to do this with all the windows, we say we have a &lt;code&gt;timestep (dt)&lt;/code&gt; between windows. This way we loose some frequencies (not all samples are processed) but we gain in computing time and this way it is possible to display spectrum &quot;realtime&quot; while the audio is playing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, I am not sure if what I wrote is correct so please shed a light.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if everything what I wrote above is true indeed, where does the &lt;code&gt;frequency resolution (df)&lt;/code&gt; step in? My first answer would be the window size (N) because that way we can test more samples.&lt;/p&gt;&#xA;" OwnerUserId="1798" LastActivityDate="2019-12-29T23:48:35.033" Title="Frequency resolution and timestep in DFT" Tags="|frequency-spectrum|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8526" PostTypeId="2" ParentId="8525" CreationDate="2013-04-05T17:33:07.433" Score="8" Body="&lt;p&gt;The &quot;timestep&quot; $dt$ (using your nomenclature) between DFT windows can really be anything you choose. There are a few different cases to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$dt &amp;lt; N$: In this case, there is overlap between successive windows of samples that you input to the DFT. This can be used if you would like to get answers more frequently than every $N$ samples. It's quite common to see something like 50% overlap between windows being used.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$dt = N$: In this case, there is no overlap; you just take successive blocks of $N$ samples and use those as inputs to the DFT. This would give you the minimum processing load while not skipping any input data.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$dt &amp;gt; N$: As you noted, in this case, you're skipping data between windows (sometimes called &quot;underlap&quot;). This can reduce your processing load further, but since you're skipping data, you run the risk of missing the analysis of some feature in that portion of data that was discarded.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The frequency spacing of the DFT is related to the sample rate and the DFT length. Specifically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;df = \frac{f_s}{N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sample rate of the input data. $df$ in the equation above corresponds to the frequency spacing between each output (i.e. with $f_s$ measured in Hz, the outputs will have a spacing of $df$ Hz).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-04-05T17:33:07.433" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8527" PostTypeId="2" ParentId="8486" CreationDate="2013-04-05T19:23:37.223" Score="3" Body="&lt;p&gt;In $16$-QAM, four constellation points &#xA;$\left(\pm\frac{d}{2},\pm\frac{d}{2}\right)$ are &quot;interior&quot; points while&#xA;the remaining $12$ are &quot;edge&quot; points or &quot;corner&quot; points for which&#xA;&lt;em&gt;at least&lt;/em&gt; one of the coordinates is $\pm\frac{3d}{2}$. &#xA;Thus, in&#xA;$n$ measurements $(X_i,Y_i)$ of successive transmitted symbols,&#xA;some of the $X_i$ will equal $\pm\frac{d}{2} + NI_i$ while&#xA;others will be $\pm\frac{3d}{2} + NI_i$.  Similarly,&#xA;some of the $Y_i$ will equal $\pm\frac{d}{2} + NQ_i$ while&#xA;others will be $\pm\frac{3d}{2} + NQ_i$.  Here, $NI_i$ and $NQ_i$&#xA;are independent zero-mean Gaussian random variables with variance&#xA;$\sigma^2$ representing the noise. Note that we can expect &#xA;about $\frac{3}{4}$-th of the&#xA;samples to have at least one large coordinate. Now, consider&#xA;that if we want to &lt;em&gt;estimate&lt;/em&gt; the value of $d$ from the measurements,&#xA;and want to use the &lt;em&gt;average energy&lt;/em&gt; calculations, then&#xA;$\sum_i (X_i^2+Y_i^2)$ is one possibility, but we are weighting&#xA;equally the symbols with large means and the symbols with small&#xA;means, and the noise component is a more significant part of&#xA;the symbols with small means than it is of symbols with large&#xA;means.  It might be better to use a &lt;em&gt;weighted&lt;/em&gt; sum to estimate&#xA;$d$ (or $d^2$), and one extreme possibility is to give zero weight to&#xA;interior points ($(X_i$ and $Y_i$ are both small) and to use&#xA;only the large values of $X_i$ and $Y_i$ (edge and corner&#xA;points) in the estimation.  If the number of samples is large,&#xA;this could be as simple as taking those (approximately) $3n/4$&#xA;samples in which either $X_i$ or $Y_i$ (possibly both) is&#xA;large, and averaging the absolute values of the largest $X_i$ and&#xA;$Y_i$ to get an estimate of $3d/2$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once upon a time, when&#xA;analog circuits were in use, these kinds of calculations would&#xA;have been difficult to implement in hardware, and this effect&#xA;carries over into some present-day implementations that faithfully&#xA;follow the methods of the past that were originally devised&#xA;because of hardware limitations.&#xA;But these days, with digital computation being ubiquitous,&#xA;perhaps something new can be attempted. &lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-04-05T22:47:47.967" LastActivityDate="2013-04-05T22:47:47.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8528" PostTypeId="2" ParentId="8513" CreationDate="2013-04-06T03:21:55.317" Score="1" Body="&lt;p&gt;You must calculate correlation between  kernel image &lt;strong&gt;&quot;b&quot;&lt;/strong&gt; and sub-images of whole original image of same size in any possible position. If the correlation is quite high for some position - you have found bubble in this position. If size of kernel image is quite big - use FFT for calculation of correlation. If kernel is small - it may be better to use direct calculation of correlation. It is better to use normalization correlation. This calculation need very much computer power. So it's very important to do the calculation fast. There is classical article - &lt;a href=&quot;http://scribblethink.org/Work/nvisionInterface/nip.pdf&quot; rel=&quot;nofollow&quot;&gt;J. P. Lewis &quot;Fast Normalized Cross-Correlation&lt;/a&gt;. Search for citation to this article too. Article in wiki is very useful too - &lt;a href=&quot;http://en.wikipedia.org/wiki/Template_matching#Speeding_up_the_Process&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Template_matching#Speeding_up_the_Process&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I confirm answer of &lt;strong&gt;sansuiso&lt;/strong&gt; - OpenCV library has very good implementation of template matching. If size of bubbles is quite different it will be better to use another algorithm - see reference on generalized Hough transform in answer of &lt;strong&gt;sansuiso&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2013-04-06T08:01:36.290" LastActivityDate="2013-04-06T08:01:36.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8530" PostTypeId="1" CreationDate="2013-04-06T13:05:50.377" Score="4" ViewCount="2462" Body="&lt;p&gt;I showed the question about flipping the impulse response to some math teachers and electrical engineers at an university. They read Dilip's answer and thought that it was hard to understand what Dilip meant and it was simply not true...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone confirm that it really isn't true what Dilip Sarwate wrote. And explain it in a way that is easier to read.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://dsp.stackexchange.com/questions/5992/flipping-the-impulse-response-in-convolution/6355#6355&quot;&gt;Flipping the impulse response in convolution&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There is no &quot;flipping&quot; of the impulse response by a linear (time-invariant) system. The output of a linear time-invariant system is the sum of scaled and time-delayed versions of the impulse response, not the &quot;flipped&quot; impulse response.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4289" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-04-11T03:55:53.463" Title="A better explaination for 'there's no flipping of the impulse response'" Tags="|convolution|" AnswerCount="4" CommentCount="9" ClosedDate="2013-04-12T15:32:14.957" ContentLicense="CC BY-SA 3.0" />
  <row Id="8531" PostTypeId="1" CreationDate="2013-04-06T14:53:27.763" Score="2" ViewCount="837" Body="&lt;p&gt;From what I have read about signal (de)modulation I understand that multiplying two sine waves, both with the same frequency, gives a two frequency component sine wave. One at DC and one at $2\omega$. Using a low pass filter will let us remove the $2\omega$ component. Now DC amplitude is proportional to the phase difference between the two sine waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&#xA;$$&#xA;A \sin(\omega t) \sin(\omega t + \theta) = \frac{A}{2}\cos(\theta) + \frac{A}{2}\cos(2\omega t + \theta) \rightarrow {\rm LPF} \rightarrow \frac{A}{2}\cos(\theta)&#xA;$$&#xA;where $\omega$ is the frequency, LPF is Low Pass Filter, $A$ is the amplitude and $\theta$ is the phase difference between the sine waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a Matlab program to plot this, then I tried with a square wave multiplied with a sine wave. I can see that there is still a connection between DC and phase by doing a FFT as well as in the time domain. I would like to see the math for the relationship between DC and phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sine $\times$ sine, I have read that sampling with a frequency four times the modulated signal frequency will make it possible to get the I and Q values by subtracting samples in the following order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;I(t) = s(t) - s(t-2)&#xA;$$&#xA;$$&#xA;Q(t) = s(t-3) - s(t-1)&#xA;$$&#xA;where&#xA;$$&#xA;s(t) = A\sin(\omega t + \theta)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This I do not quite understand yet and therefore leads me to be unable to determine if this also is valid for a square $\times$ sine. Can anyone try to explain this to me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will appreciate any feedback on how to effectively do IQ demodulation on a micro-controller using a square reference waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Additional information:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to use a micro-controller to sample the analog sine and square (reference) signal and do IQ demodulation. I almost only find information about sine $\times$ sine and therefore want to know if there are any pitfalls using a reference square wave that I am not seeing yet.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastEditorUserId="80" LastEditDate="2013-04-06T16:00:18.123" LastActivityDate="2013-04-06T16:15:26.703" Title="DC to phase relationship with Low pass filtered sine and square wave multiplication and it's pitfalls. IQ Demodulation" Tags="|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8532" PostTypeId="1" CreationDate="2013-04-06T15:40:22.870" Score="3" ViewCount="316" Body="&lt;p&gt;We have several audio tracks, all of which are different versions of the same track under one type of distortion: the speed of the track is increased by a constant factor K (hence frequences are multiplied by K, timesteps are divided by K), K is relatively small (0.8&amp;lt; K &amp;lt; 1.2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know the best way to get a good spectrogram out of these tracks. &#xA;Before defining what I mean by 'good', let me state my final goal: I want to retrieve points, à la Shazam, based on the maximum amplitudes (ie amplitudes &gt; a certain threshold). A good threshold is to be defined too, but I was thinking of taking the average local RMS of the signal and its standard deviation and make the treshold = mean(localRMS) + (constant factor)*std(localRMS). Then I'd like to apply computer vision algorithms to the resulting image to measure similarity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good spectrogram is then defined as such:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;the frequencies are logarithmically spaced the points of interest&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;for one track are a translation along the frequency axis of the points of interest of&#xA;another track.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Do you know what type of spectrogram would be the best? (I'm thinking of using either a logarithmically spaced fourier transform or a constant Q Fourier transform) Would my threshold work or are there better ones? Any remark on the whole design would be truly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4291" LastEditorUserId="1650" LastEditDate="2013-04-08T13:29:19.447" LastActivityDate="2013-04-08T13:29:19.447" Title="Points of interest in a spectrogram" Tags="|fft|computer-vision|spectrogram|fourier|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8533" PostTypeId="2" ParentId="8531" CreationDate="2013-04-06T16:15:26.703" Score="2" Body="&lt;p&gt;So if your sampling rate is four times the modulated signal frequency (and sampling synchronously) then $\omega= \pi/2$. So then&#xA;$$&#xA;\begin{array}&#xA; II(t) &amp;amp;=&amp;amp; s(t) - s(t-2)\\&#xA;&amp;amp;=&amp;amp; A\sin(\pi/2 t + \theta) - A\sin(\pi/2 (t - 2) + \theta)\\&#xA;&amp;amp;=&amp;amp; 2A\sin(\pi/2 t + \theta) &#xA;\end{array}&#xA;$$&#xA;and&#xA;$$&#xA;\begin{array}&#xA; QQ(t) &amp;amp;=&amp;amp; s(t-3) - s(t-1)\\&#xA;&amp;amp;=&amp;amp; A\sin(\pi/2 (t-3) + \theta) - A\sin(\pi/2 (t - 1) + \theta)\\&#xA;&amp;amp;=&amp;amp; A\sin(\pi/2 t + \theta - 3\pi/2) - A\sin(\pi/2 t + \theta - \pi/2)\\&#xA;&amp;amp;=&amp;amp; 2A \cos((\pi/2 t + \theta - 3\pi/2 + \pi/2 t + \theta - \pi/2)/2) \\&#xA;&amp;amp;&amp;amp;\sin((\pi/2 t + \theta - 3\pi/2 - (\pi/2 t + \theta - \pi/2))/2)\\&#xA;&amp;amp;=&amp;amp; 2A\cos(\pi/2 t + \theta) &#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick will be to think about the square wave case, and see what this derivation tells you about that.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-06T16:15:26.703" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8534" PostTypeId="1" CreationDate="2013-04-06T16:18:53.540" Score="3" ViewCount="142" Body="&lt;p&gt;I am implementing a method known as trace transform for image analysis. The algorithm extracts a lot of features of an image (in my case features pertained to texture) using a set of transforms on the values of the pixels. &lt;a href=&quot;http://pdf.aminer.org/000/067/295/texture_classification_with_thousands_of_features.pdf&quot; rel=&quot;nofollow&quot;&gt;Here is a paper describing the algorithm:&lt;/a&gt; (PDF link).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm finally constructs a &quot;triple feature&quot; which is a number that characterizes the image and was calculated by applying a first set of transforms on the pixel values extracted by all the tracing lines going through the image at all angles. On the paper you can see this description starting on page 2, Figure 1 shows an abstraction of such a tracing line which is defined by its angle (phi) and the distance (d) of the line from the center of the image. So we can describe each tracing line by the pair (phi,d).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now on the next page on the paper (page 3) we have Table 1 which is the set of functionals that is applied to the pixel values extracted by the tracing lines. Each of these functionals applied to all the tracing lines generates another representation of the image. Then another set of functionals (those that appear on Table 2 on page 4) are applied to the new representation of the image along the columns which is basically along parameter d generating, this way, another new representation of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally another set of functionals is applied to this last representation which is an array of values over parameter phi which was the angle parameter (that means we have 360 values describing the image, one for each angle of the tracing lines). You can see these functionals in the paper on Table 3 page 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now some of this last set of functionals that have to be applied to the last representation of the image over parameter phi need to calculate the harmonics of this set of 360 values. First I need to calculate the first harmonic and then the amplitude and phase of the first through fourth harmonic but I don't know how to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read the first couple of pages of the paper since it's probably better explained there. And figure 1 makes it clear what I mean by tracing lines and the representation of each line by the (phi,d) pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other functionals I have trouble with since I don't know if I'm understanding them correctly are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; \text{c so that:}\sum_{i=1}^cx_i=\sum_c^Nx_i.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_i$ is one of the values and $N$ is the total number of values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my doubt is with what the result should be. The source (the paper listed above) has nothing else to contextualize this functional that's all it says so I'm interpreting that the result is $c$ rather than the sum of $x_i$ until $c$ right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say I have this set of numbers {2 2 3 1} where each number is one value $x_i$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the above functional will tell me $c=2$ but the result of the sum is 4. So which should I take as the result in this case given the above functional?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other functionals I'm having trouble with are related to the calculation of harmonics based on the dataset extracted from the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{i so that } x_i=\min_{i=1 \ldots N}x_i\text{ without the first Harmonic}&#xA;$$&#xA;$$&#xA;\text{i so that } x_i=\max_{i=1 \ldots N} x_i\text{ without the first Harmonic}&#xA;$$&#xA;$$&#xA;\text{Amplitud of the first Harmonic}&#xA;$$&#xA;$$&#xA;\text{Phase of the first Harmonic}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all the way to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{Amplitud of the fourth Harmonic}&#xA;$$&#xA;$$&#xA;\text{Phase of the fourth Harmonic}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really don't know how to calculate a Harmonic or the amplitude or phase of it for the values. If someone more knowledgeable than me on image analysis can look into the paper linked above and provide me some tips I'll be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4267" LastEditorUserId="80" LastEditDate="2013-04-20T20:33:17.177" LastActivityDate="2013-04-20T20:33:17.177" Title="Question about harmonic calculations and other functionals for image analysis" Tags="|image-processing|transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8537" PostTypeId="2" ParentId="8530" CreationDate="2013-04-06T17:32:34.020" Score="1" Body="&lt;p&gt;A convolution is a computational trick where a &quot;flipped&quot; impulse response is used to compute how all the actual unflipped impulse responses due to input back in historical time would have summed up to create a current response, had they not already been doing so by an LTI system carrying its own state.  The same computational trick could be performed by flipping the input (by index) in time, instead of the impulse response, but people don't like doing this as much.  This computational trick assists in the use vector processors that only step down multiple vectors via a single incrementing index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An LTI state machine, left on its own, and running forward in time, executes down the path of un-flipped impulse responses already initiated (scaled) by actual previous input to the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The LTI system does no flipping.  But if you want to see what it would have done on some input that isn't currently represented by its actual current state, you might use this computational &quot;flipping&quot; trick on either the impulse response or on the time domain input.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-04-06T18:25:40.523" LastActivityDate="2013-04-06T18:25:40.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8538" PostTypeId="1" CreationDate="2013-04-06T19:36:24.780" Score="2" ViewCount="115" Body="&lt;p&gt;I'm trying to do a CT Fourier Transform of these two signals&#xA;$$x_1(t)=e^{−a(t−1)} \cdot u(t−1)$$&#xA;and&#xA;$$x_2(t)=e^{−a(t−1)} \cdot u(t)$$&#xA;Where $a$ is any real number, and $u(t)$ is the unit step function and that is multiplication, not convolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://chattypics.com/files/droidUpload_qdg2kdu2di_yp4yyclp6d.jpg&quot; rel=&quot;nofollow&quot;&gt;Picture of my work and answers here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answers listed should not contain the extra &#xA;$$t \cdot u(t-1)$$ and $$t \cdot u(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay, thanks to Dilip i now have my answers to look like &#xA;$$ x_1(F)=\frac{e^{2a+j2\pi\cdot F}}{a+j2\pi\cdot F}$$&#xA;and &#xA;$$x_2(F) =\frac{e^a}{a+j2\pi\cdot F} $$&#xA;That does seem more elegant than what i previously had, I feel like I could possibly manipulate $x_1(F)$ into a sinc function, but I don't think it's necessary.&lt;/p&gt;&#xA;" OwnerUserId="4293" LastEditorUserId="80" LastEditDate="2013-04-06T23:59:49.070" LastActivityDate="2013-04-06T23:59:49.070" Title="A simpler method or more descriptive answer to the Fourier Transform" Tags="|fourier-transform|continuous-signals|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8539" PostTypeId="1" CreationDate="2013-04-06T21:13:16.787" Score="5" ViewCount="472" Body="&lt;p&gt;I'm analysing several measurements taken with a SR830 lockin amplifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These measurements look similar to this one.&lt;img src=&quot;https://i.stack.imgur.com/panDv.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Since I'm interrested in the derivative of the signal I took the numerical difference. What I found was this. &lt;img src=&quot;https://i.stack.imgur.com/OEIHs.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;One can clearly see two bands in the signal. I'm no expert, but I'm guessing it might be related to digitalisation in the lock-in amplifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this leads me to two questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What could be the origin of these two bands and how to avoid them in the first place?&lt;/li&gt;&#xA;&lt;li&gt;How should I correct the data already taken?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="851" LastEditorUserId="851" LastEditDate="2013-04-10T15:32:30.600" LastActivityDate="2015-04-17T20:20:40.857" Title="Banding in the derivative of a lock-in amplifier signal" Tags="|discrete-signals|gradient|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8540" PostTypeId="2" ParentId="8530" CreationDate="2013-04-07T00:08:11.227" Score="9" Body="&lt;p&gt;Flipping the impulse response is really just a matter of perspective.  The LTI system doesn't care about perspective.  In any case, here is a graphic showing a system that takes an input of color weighted impulses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z2f2T.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-04-07T00:49:17.397" LastActivityDate="2013-04-07T00:49:17.397" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8541" PostTypeId="1" CreationDate="2013-04-07T01:19:43.927" Score="2" ViewCount="512" Body="&lt;p&gt;I have a two data set files &lt;code&gt;data1&lt;/code&gt; and &lt;code&gt;data2&lt;/code&gt; each containing 5000 points having 3 columns representing &lt;code&gt;x,y(coordinate (centroid)),angular movement(theta)&lt;/code&gt; resepectively for two robot movements obtained by numerical programming and solution of a circuit representing robot equations.I need to simulate a graph for coverage with obstacle and without obstacle in a grid like fashion and then calculate the percentage of coverage where A is the coverage for each cell, &lt;code&gt;A(i)=1&lt;/code&gt; if cell i is covered otherwise 0. I went through this link &lt;a href=&quot;https://stackoverflow.com/questions/11125284/how-to-generate-graph-for-rate-of-traversal&quot;&gt;SO&lt;/a&gt; but the answer is too obscure and I cannot follow. Can somebody please tell me how to generate these two graphs?Thank you&lt;/p&gt;&#xA;" OwnerUserId="4294" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2013-04-08T00:25:25.713" Title="How to plot graph for coverage area" Tags="|matlab|" AnswerCount="0" CommentCount="2" ClosedDate="2013-08-18T16:30:04.563" ContentLicense="CC BY-SA 3.0" />
  <row Id="8542" PostTypeId="2" ParentId="8530" CreationDate="2013-04-07T01:53:58.643" Score="1" Body="&lt;p&gt;You're on a mountain top, surrounded by a few other peaks, and shout &quot;HEY!!&quot;. 2 seconds later you hear &quot;HEY&quot; (10% softer), and another second later an even softer &quot;hey&quot; (1% softer). So the impulse response of the system is a dirac at t = 2 with a weight of 0.1, plus another dirac at t = 3 with a weight of 0.01.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you say &quot;ECHO!!&quot;, at $t = 0$ and the whole utterance takes a bit more than 1 second. How to determine, at a given point $t$ in time, say $t = 3$, what will be heard from the echo? (Answer: a mixture of a loud &quot;O&quot; and a softer &quot;E&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way is to figure out if something has been shouted 2s ago (in which case you hear it attenuated by 0.1), and if something has been shouted 3s ago (in which case you hear it attenuated by 0.01). This could be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \int h(\tau)x(t-\tau)d\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;For each tap of the impulse response at $\tau$, I'm looking in the past of the input $x(t-\tau)$&quot;. This is the &quot;scaled and time-shifted impulse response&quot; view. Dilip's post, BZ's post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way, is to say, &quot;OK, let's play back a recording of what has been shouted originally. I hear &quot;E&quot; at $\tau = 0$. I'm interested in knowing what's happening at $t = 3$. I will check how strong the echo is after $3$ seconds. Then I hear &quot;O&quot; at $\tau = 1$. How strong is the echo after $2$ seconds? This could be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \int x(\tau)h(t-\tau)d\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;I am retracing the history of the input $x(\tau)$ and read from the impulse response by how much each sample is weighted to affect the present - the quantity $h(t - \tau)$&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both are equivalent because they are just the same integral with a variable substitution - convolution is commutative. None of them imply that mountain echoes have time-traveling properties. None of them imply that you'll hear a softer &quot;hey&quot; before you hear the louder &quot;HEY&quot;. None of them imply that you'll hear your voice backwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What changes is just the order in which you access the history of the input to compute the output - in reverse-chronological order ; or in chronological order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A way of writing things in a way that does not show a minus sign:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \iint\limits_{u, v, u+v = t} x(u) h(v) du dv$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me beat this dead horse one last time: when you do a long multiplication (this is indeed a convolution of the sequence of digits, with some carrying over), you will process digits in a different order whether you write it as $A \times B$ or $B \times A$. The result is the same and no number gets &quot;written backwards&quot; in the process.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-04-07T02:28:55.603" LastActivityDate="2013-04-07T02:28:55.603" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8544" PostTypeId="1" AcceptedAnswerId="8545" CreationDate="2013-04-07T03:22:59.570" Score="8" ViewCount="645" Body="&lt;p&gt;Maybe a stupid question, but if there is a time-domain representation of audio signal, and also frequency-domain, so is there any other domain that signal can be represented in?&lt;/p&gt;&#xA;" OwnerUserId="1708" LastEditorUserId="90" LastEditDate="2013-04-07T13:02:05.587" LastActivityDate="2013-04-07T13:02:05.587" Title="Can you represent an audio signal in any other domains besides time and frequency?" Tags="|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8545" PostTypeId="2" ParentId="8544" CreationDate="2013-04-07T04:32:16.770" Score="8" Body="&lt;p&gt;Audio only really exist in the time domain, in audio we translate it into sum of sine wave because that related to how we hear sounds. There are other ways sounds can be interpreted it all depends on if that representation is useful to you. Things you might find of interest are, wavelets, granular syntheses, formant syntheses, I remember reading about something which work by representing sound a kind of granular synthesis where each granule was made of the natural harmonic series, I think it was called resonant synthesis.&lt;/p&gt;&#xA;" OwnerUserId="1144" LastActivityDate="2013-04-07T04:32:16.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8546" PostTypeId="2" ParentId="8544" CreationDate="2013-04-07T04:58:13.807" Score="13" Body="&lt;p&gt;Basically it's all about breaking down the information into several 'bits'.  The actual audio signal is a time varying 'value', however often it is useful to consider it in a different form.  As an analogy, consider the number &lt;code&gt;256&lt;/code&gt;:  depending on what you're doing with your numbers, it might be useful to treat the number as &lt;code&gt;200 + 50 + 6&lt;/code&gt;, or &lt;code&gt;16 + 240&lt;/code&gt;, or &lt;code&gt;16*16&lt;/code&gt;, or maybe as &lt;code&gt;2^8&lt;/code&gt;; there are an infinite number of ways to treat the number, and which one you use depends on what you're trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'frequency domain representation' is an example of doing the above break-down, but with a signal rather than a number.  In this case, you're representing the original signal as a sum of sinusoids, all with different frequencies, amplitudes, and phases.  If you add them all together, you get your original signal back.  You could alternatively choose to represent it in a different way, such as with wavelets, or any other approach that may or may not even have a name (yet), if it is useful for what you're doing to it.  Maybe you could break it into 3 second chunks, then rearrange the signal in each of those chunks to be monotonically increasing, and remember how you reordered them.  This sounds a bit ridiculous, but there is an approach to manipulating MRI images with this sort of reordering (it doesn't use the chunking part, but that's just an example of how you can do whatever you like).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One advantage of sinusoids is that, like Nathan Day says, it relates to the way our ears interpret the pitch of sounds.  But a more important reason is that sinusoids are complex exponentials, which are eigenfunctions of linear systems; that is to say that linear systems are much much simpler to analyse if you consider the inputs and outputs as sums of sinusoids.  That is the main reason why Fourier analysis is so widespread and important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Short answer to your question: there are an infinite number of domains you can represent an audio signal in.  For another popular one, see wavelets.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-04-07T04:58:13.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8547" PostTypeId="2" ParentId="8534" CreationDate="2013-04-07T10:28:03.580" Score="1" Body="&lt;p&gt;Perhaps looking at this &lt;a href=&quot;http://www2.ee.ic.ac.uk/publications/p4673.pdf&quot; rel=&quot;nofollow&quot;&gt;paper 1&lt;/a&gt; would be appropriate for a literature survey.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper describes in detail the rules of constructing functionals for a Trace transform. The functionals described in your paper are merely examples of the functions which follow the rules presented in paper 1.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-04-07T10:28:03.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8549" PostTypeId="1" AcceptedAnswerId="8552" CreationDate="2013-04-07T22:24:40.067" Score="3" ViewCount="171" Body="&lt;p&gt;I want to fuse objects coming from several sensors, with different (sometimes overlapping!) fields of view. Having object lists, how can I determine whether some objects observed by different sensors are in fact the same object? Only then I can truly write an algorithm to predict future state of such an object.&#xA;In other words, I want to associate properly those lists. &lt;/p&gt;&#xA;" OwnerUserId="4168" LastEditorUserId="1063" LastEditDate="2013-04-08T07:29:54.933" LastActivityDate="2015-03-12T14:23:37.523" Title="object level sensor fusion for multiobject tracking" Tags="|filters|algorithms|object-recognition|tracking|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8551" PostTypeId="2" ParentId="8488" CreationDate="2013-04-08T06:20:54.523" Score="27" Body="&lt;p&gt;The simplest approach is to do some kind of spline interpolation like &lt;a href=&quot;https://dsp.stackexchange.com/a/8502/35&quot;&gt;Jim Clay suggests&lt;/a&gt; (linear or otherwise). However, if you have the luxury of batch processing, and especially if you have an overdetermined set of nonuniform samples, there's a &quot;perfect reconstruction&quot; algorithm that's extremely elegant. For numerical reasons, it may not be practical in all cases, but it's at least worth knowing about conceptually. I first read about it in &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.11.1581&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is to consider your set of nonuniform samples as having already been reconstructed from uniform samples through &lt;a href=&quot;http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&quot; rel=&quot;noreferrer&quot;&gt;sinc interpolation&lt;/a&gt;. Following the notation in the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = \sum_{k=1}^{N}{y(kT)\frac{\sin(\pi(t - kT)/T)}{\pi(t - kT)/T}} = \sum_{k=1}^{N}{y(kT)\mathrm{sinc}(\frac{t - kT}{T})}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this provides a set of linear equations, one for each nonuniform sample $y(t)$, where the unknowns are the equally-spaced samples $y(kT)$, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix} y(t_0) \\ y(t_1) \\ \cdots \\ y(t_m) \end{bmatrix} = \begin{bmatrix} \mathrm{sinc}(\frac{t_0 - T}{T}) &amp;amp; \mathrm{sinc}(\frac{t_0 - 2T}{T}) &amp;amp; \cdots &amp;amp;  \mathrm{sinc}(\frac{t_0 - nT}{T}) \\ \mathrm{sinc}(\frac{t_1 - T}{T}) &amp;amp; \mathrm{sinc}(\frac{t_1 - 2T}{T}) &amp;amp; \cdots &amp;amp; \mathrm{sinc}(\frac{t_1 - nT}{T}) \\ \cdots &amp;amp; \cdots &amp;amp; \cdots &amp;amp;\cdots \\ \mathrm{sinc}(\frac{t_m - T}{T}) &amp;amp; \mathrm{sinc}(\frac{t_m - 2T}{T}) &amp;amp; \cdots &amp;amp; \mathrm{sinc}(\frac{t_m - nT}{T}) \end{bmatrix} \begin{bmatrix} y(T) \\ y(2T) \\ \cdots \\ y(nT) \end{bmatrix}. &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above equation, $n$ is the number of unknown uniform samples, $T$ is the inverse of the uniform sample rate, and $m$ is the number of nonuniform samples (which may be greater than $n$).  By computing the &lt;a href=&quot;http://www.youtube.com/watch?v=ZKhZclqfR5E&quot; rel=&quot;noreferrer&quot;&gt;least squares&lt;/a&gt; solution of that system, the uniform samples can be reconstructed. Technically, only $n$ nonuniform samples are necessary, but depending on how &quot;scattered&quot; they are in time, the interpolation matrix may be horribly &lt;a href=&quot;http://en.wikipedia.org/wiki/Condition_number&quot; rel=&quot;noreferrer&quot;&gt;ill-conditioned&lt;/a&gt;. When that's the case, using more nonuniform samples usually helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a toy example, here's a comparison (using &lt;a href=&quot;http://www.numpy.org/&quot; rel=&quot;noreferrer&quot;&gt;numpy&lt;/a&gt;) between the above method and cubic spline interpolation on a mildly jittered grid:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c855r.png&quot; alt=&quot;Sinc vs Cubic Spline Reconstruction of Nonuniform Samples&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Code to reproduce the above plot is included at the end of this answer)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that being said, for high-quality, robust methods, starting with something in one of the following papers would probably be more appropriate:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A. Aldroubi and Karlheinz Grochenig, &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=588799&quot; rel=&quot;noreferrer&quot;&gt;Nonuniform sampling and&#xA;  reconstruction in shift-invariant spaces&lt;/a&gt;, SIAM Rev., 2001, no. 4,&#xA;  585-620. (&lt;a href=&quot;http://mate.dm.uba.ar/~hafg/papers-sem-05/al-gr-review.pdf&quot; rel=&quot;noreferrer&quot;&gt;pdf link&lt;/a&gt;).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;K. Grochenig and H. Schwab, &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.5.7792&quot; rel=&quot;noreferrer&quot;&gt;Fast local reconstruction methods for&#xA;  nonuniform sampling in shift-invariant spaces&lt;/a&gt;, SIAM J. Matrix Anal.&#xA;  Appl., 24(2003), 899-&#xA;  913.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab as py&#xA;&#xA;import scipy.interpolate as spi&#xA;import numpy.random as npr&#xA;import numpy.linalg as npl&#xA;&#xA;npr.seed(0)&#xA;&#xA;class Signal(object):&#xA;&#xA;    def __init__(self, x, y):&#xA;        self.x = x&#xA;        self.y = y&#xA;&#xA;    def plot(self, title):&#xA;        self._plot(title)&#xA;        py.plot(self.x, self.y ,'bo-')&#xA;        py.ylim([-1.8,1.8])&#xA;        py.plot(hires.x,hires.y, 'k-', alpha=.5)&#xA;&#xA;    def _plot(self, title):&#xA;        py.grid()&#xA;        py.title(title)&#xA;        py.xlim([0.0,1.0])&#xA;&#xA;    def sinc_resample(self, xnew):&#xA;        m,n = (len(self.x), len(xnew))&#xA;        T = 1./n&#xA;        A = np.zeros((m,n))&#xA;&#xA;        for i in range(0,m):&#xA;            A[i,:] = np.sinc((self.x[i] - xnew)/T)&#xA;&#xA;        return Signal(xnew, npl.lstsq(A,self.y)[0])&#xA;&#xA;    def spline_resample(self, xnew):&#xA;        s = spi.splrep(self.x, self.y)&#xA;        return Signal(xnew, spi.splev(xnew, s))&#xA;&#xA;class Error(Signal):&#xA;&#xA;    def __init__(self, a, b):&#xA;        self.x = a.x&#xA;        self.y = np.abs(a.y - b.y)&#xA;&#xA;    def plot(self, title):&#xA;        self._plot(title)&#xA;        py.plot(self.x, self.y, 'bo-')&#xA;        py.ylim([0.0,.5])&#xA;&#xA;def grid(n): return np.linspace(0.0,1.0,n)&#xA;def sample(f, x): return Signal(x, f(x))&#xA;&#xA;def random_offsets(n, amt=.5):&#xA;    return (amt/n) * (npr.random(n) - .5)&#xA;&#xA;def jittered_grid(n, amt=.5):&#xA;    return np.sort(grid(n) + random_offsets(n,amt))&#xA;&#xA;def f(x):&#xA;    t = np.pi * 2.0 * x&#xA;    return np.sin(t) + .5 * np.sin(14.0*t)&#xA;&#xA;n = 30&#xA;m = n + 1&#xA;&#xA;# Signals&#xA;even   = sample(f, np.r_[1:n+1] / float(n))&#xA;uneven = sample(f, jittered_grid(m))&#xA;hires  = sample(f, grid(10*n))&#xA;&#xA;sinc   = uneven.sinc_resample(even.x)&#xA;spline = uneven.spline_resample(even.x)&#xA;&#xA;sinc_err   = Error(sinc, even)&#xA;spline_err = Error(spline, even)&#xA;&#xA;# Plot Labels&#xA;sn = lambda x,n: &quot;%sly Sampled (%s points)&quot; % (x,n)&#xA;r  = lambda x: &quot;%s Reconstruction&quot; % x&#xA;re = lambda x: &quot;%s Error&quot; % r(x)&#xA;&#xA;plots = [&#xA;    [even,       sn(&quot;Even&quot;, n)],&#xA;    [uneven,     sn(&quot;Uneven&quot;, m)],&#xA;    [sinc,       r(&quot;Sinc&quot;)],&#xA;    [sinc_err,   re(&quot;Sinc&quot;)],&#xA;    [spline,     r(&quot;Cubic Spline&quot;)],&#xA;    [spline_err, re(&quot;Cubic Spline&quot;)]&#xA;]&#xA;&#xA;for i in range(0,len(plots)):&#xA;    py.subplot(3, 2, i+1)&#xA;    p = plots[i]&#xA;    p[0].plot(p[1])&#xA;&#xA;py.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="35" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-04-08T06:20:54.523" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8552" PostTypeId="2" ParentId="8549" CreationDate="2013-04-08T06:29:56.700" Score="4" Body="&lt;p&gt;There are many different algorithms or theories to tackle your problem.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;As suggested in the comments, Kalman filters (in a regular or extended implementation) ore often tried in this case.&lt;/li&gt;&#xA;&lt;li&gt;If you are in a discrete world (I guess so from your question), you can try to solve your problem in a discrete setting with (for example) the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hungarian_algorithm&quot; rel=&quot;nofollow&quot;&gt;Hungarian algorithm&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If your detections come with associated confidence or plausibility (likelihood) measurements and if you are not afraid by the maths, you can try the popular &lt;a href=&quot;http://en.wikipedia.org/wiki/Dempster%E2%80%93Shafer_theory&quot; rel=&quot;nofollow&quot;&gt;Dempster-Shafer&lt;/a&gt; evidence theory (or one of its variants).&lt;/li&gt;&#xA;&lt;li&gt;Etc. (correlations between tracks, a variant of sparse regression...).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fusion with Kalman filtering&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you know that you have one object, with the corresponding state vector (e.g., position, or position + velocity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose that you are observing this state with 2 different sensors or algorithms.&#xA;For example, a robot or a UAV can have a first position estimation coming form an inertial measurement unit (IMU) and another positoin estimated via computer vision by detecting its pose with respect to known points of interests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Kalman filter with solve the problem of providing an estimate of the true state (position) accoridng to these two inputs.&#xA;It will solve it in a least squares sense taking into account the intrinsic precision of the two sources.&#xA;Note that it is not different to using it for tracking (in time) a single object: in the fusion case, the only difference is that all the observations were acquired at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your inputs to the Kalman filters are the previous position + the 2 estimated positions, and the output is a single position (ideally the &quot;true&quot; one).&#xA;The observation matrix produces a position given the sensor inputs. In this example (input=position, output=position) it would be the identity.&#xA;You incorporate knowledge about the precision of each sensor in the variance matrix of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://people.cs.ubc.ca/~caronfr/Publications/J_Information_Fusion_2004.pdf&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is an example application that I have found.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-04-08T08:12:40.230" LastActivityDate="2013-04-08T08:12:40.230" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8553" PostTypeId="1" CreationDate="2013-04-07T17:10:42.120" Score="1" ViewCount="51" Body="&lt;p&gt;I need to filter the image raster below with the following mask:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0 1&#xA;-1 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the Image Raster:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 0 0 0 1&#xA;0 0 0 0 1 1&#xA;0 0 0 1 1 1&#xA;0 0 1 1 1 1&#xA;1 1 1 1 1 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My results are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0 0 0 0 0&#xA; 0 0 0 0 0&#xA; 0 0 0 0 0&#xA;-1 0 0 0 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In what direction does this mask detect intensity change? What does the sign of the output signal mean?&lt;/p&gt;&#xA;" OwnerDisplayName="nsc010" LastActivityDate="2013-04-09T02:32:26.950" Title="Intensity change after filtering this image?" Tags="|filters|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8554" PostTypeId="1" CreationDate="2013-04-08T15:00:58.073" Score="5" ViewCount="615" Body="&lt;p&gt;I have a bunch of simulated time series, for which I can compute the power spectrum. Generally, the simulated power spectrum can be sketched as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JTZlo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now aim to calculate the features of the theoretical power spectrum. The theoretical power spectrum can be represented by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S_{th}=\frac{4\left(L/U_{hub}\right)}{\left(1+6f\left(L/U_{hub}\right)\right)^{5/3}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ L = constant\ length\ scale $$&#xA;$$ U_{hub} = constant\ speed $$&#xA;$$ f = frequency\ vector $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given &lt;code&gt;Uhub&lt;/code&gt; and &lt;code&gt;f&lt;/code&gt; (they are &quot;environtmental variables&quot;), the theoretical power spectrum will approach, within a certain tolerance, the simulated one only for a certain defined value of &lt;code&gt;L&lt;/code&gt;. This procedure will lead to the following figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bR1yd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I am interested in developing a method which allows for the extrapolation of the right &lt;code&gt;L&lt;/code&gt; value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been thinking of using &lt;code&gt;lsqcurvefit&lt;/code&gt;. Up to now I used it this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function p_theo = ps_th(x,f)&#xA; L = x(1);&#xA; Uhub = x(2);&#xA; exp = 5/3;&#xA; C = (L/Hub);&#xA; f_x = 6.*f.*C;&#xA; p_theo = 4*C./((1 + f_x).^exp);&#xA;end&#xA;&#xA;lsqcurvefit(@ps_th,[330;Uhub],f,ps_sim)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I am evidently using &lt;code&gt;lsqcurvefit&lt;/code&gt; improperly, since only &lt;code&gt;L&lt;/code&gt; is driving the optimization and &lt;code&gt;Uhub&lt;/code&gt; must stay fixed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed light on this problem? &lt;/p&gt;&#xA;" OwnerUserId="3666" LastEditorUserId="4344" LastEditDate="2013-04-24T20:36:40.227" LastActivityDate="2014-01-18T15:32:44.133" Title="fit theoretical spectrum to simulated one" Tags="|matlab|power-spectral-density|optimization|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8555" PostTypeId="1" CreationDate="2013-04-08T16:29:27.440" Score="3" ViewCount="546" Body="&lt;p&gt;I want to use GMM for image classification. &#xA;So, I have extracted &lt;strong&gt;SIFT&lt;/strong&gt; features from each image in the corpus.&#xA;Then, I apply EM algorithm to learn &lt;strong&gt;GMM&lt;/strong&gt; parameters (I have coded it in matlab).&#xA;I get &lt;strong&gt;very low Recognition&lt;/strong&gt; rates for unseen images when I test the model on &lt;strong&gt;larger number of classes (&gt;=4)&lt;/strong&gt;.&#xA;Who can explain this result ?  Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4304" LastEditorUserId="958" LastEditDate="2013-04-09T13:36:04.127" LastActivityDate="2013-04-10T14:06:07.243" Title="Low recognition rates using GMM for image classification" Tags="|image-processing|object-recognition|classification|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8556" PostTypeId="1" AcceptedAnswerId="8557" CreationDate="2013-04-08T19:47:17.360" Score="4" ViewCount="18614" Body="&lt;p&gt;I have got a question concerning the definition of the frequency vector for an fft operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, I work with a frequency vector, &lt;code&gt;f&lt;/code&gt;, with power of 2 elements (2048, 4096, 8192, ...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a certain simulation analysis time, &lt;code&gt;time&lt;/code&gt; (e.g. 600s), I should define &lt;code&gt;f&lt;/code&gt; as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Frequency defition&#xA;t = 0:dt:(time-dt);&#xA;df = 1/(time);&#xA;fn = Nfft/time;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$$ f = -f_{n}/2:df:f_{n}/2-1; $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ f_{n} $ represent the Nyquist cut-off frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;computational reasons&lt;/li&gt;&#xA;&lt;li&gt;symmetry of the power spectra along &lt;code&gt;f&lt;/code&gt; axis&lt;/li&gt;&#xA;&lt;li&gt;not throwing away &lt;code&gt;real&lt;/code&gt; or &lt;code&gt;imag&lt;/code&gt; part of the &lt;code&gt;fft&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I aim to define only half of the frequency range, as for example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f = 0:df:f_{n}/2-1; $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After calling the &lt;code&gt;fft&lt;/code&gt; of my input signal, I would get the desired time series as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ouput = [real(fft) imag(fft)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, this way, I count the &lt;code&gt;0&lt;/code&gt; frequency term twice and the &lt;code&gt;-fn/2&lt;/code&gt; is completely discarded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would it be possible to emcompasses the whole standard frequency range starting from only half of it?&lt;/p&gt;&#xA;" OwnerUserId="3666" LastEditorUserId="3666" LastEditDate="2013-04-08T20:23:08.843" LastActivityDate="2017-07-02T06:40:21.967" Title="Frequency vector and fft" Tags="|fft|matlab|frequency|frequency-spectrum|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8557" PostTypeId="2" ParentId="8556" CreationDate="2013-04-08T20:28:24.317" Score="4" Body="&lt;p&gt;The proper way to define your frequency vector after a DFT is as follows. Let $N$ be your DFT length, and $f_s$ be your sampling rate in Hz. Furthermore, define an $N$-length frequency vector $\bf{f}$, where each element $f_i = i$, for $i = 0, 1, 2, ... N-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now your frequency vector in hertz is simply going to be $\bf{f}$$\frac{f_s}{N}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assuming you are DFT'ing a real sequence, simply pick all elements with frequency values less than $\frac{f_s}{2}$, and you are in business!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also see my answer &lt;a href=&quot;https://dsp.stackexchange.com/questions/8508/finding-the-dominant-tone-in-a-signal/8510#8510&quot;&gt;here for actual code&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-04-08T20:28:24.317" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8559" PostTypeId="2" ParentId="3581" CreationDate="2013-04-08T21:53:06.537" Score="-1" Body="&lt;pre&gt;&lt;code&gt;A + B + {&#xA;    (|A| = A) = (|B| = B) = true: -AB;&#xA;    (|A| = A) = (|B| = B) = false: AB;&#xA;    else: 0&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is, if both A and B share a sign, apply a limiting offset.  The magnitude of the offset is the product of A and B.  The direction of the offset is opposite to that of A and B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If A and B do not share a sign, no limit is applied, as there is no way to overflow.&lt;/p&gt;&#xA;" OwnerUserId="4306" LastEditorUserId="609" LastEditDate="2013-04-09T11:47:04.730" LastActivityDate="2013-04-09T11:47:04.730" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8560" PostTypeId="2" ParentId="8553" CreationDate="2013-04-09T02:32:26.950" Score="2" Body="&lt;p&gt;For binary images, the filter kernel you have is looking for a $0 \rightarrow 1$ edge in the North-East direction.  Your image raster only has one place where such an edge exists (in the bottom left / South-West corner).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sign of the output means that the edge is a $1 \rightarrow 0$ edge transition rather than a $0 \rightarrow 1$ transition.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-09T02:32:26.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8561" PostTypeId="2" ParentId="3581" CreationDate="2013-04-09T03:24:47.757" Score="2" Body="&lt;p&gt;I had talked with a mixer designer of the late 1990's and first 2000's that was going on the digital wave (after having tiptoed). I think the guy was a designer for SPL, but maybe not that big, I absolutely don't remember neither the name neither the brand, I just remember how really really big and expensive the machine was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We spoke long, and finally spoke about the techniques for really guaranteeing that their 64/128 @ 24bits channels mixed together were remaining a 24 bits accurate mixed output channel without clipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The technique he explained was rather simple.&#xA;The 64 tracks (on 24 bits) were added in a 48 bits channel, where the clipping cannot occur. Straight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot say how that signal was then dithered 48 back from to 24 bits.&#xA;Maybe that's where the tricky kitchen recipes are applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there maybe are a lot of techniques to achieve that, above all different whether done in real-time or with the all signal already recorded with high-peaks simple to determine... all kind of normalizations to imagine I think.&lt;/p&gt;&#xA;" OwnerUserId="1650" LastEditorUserId="1650" LastEditDate="2013-04-09T03:30:14.130" LastActivityDate="2013-04-09T03:30:14.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8562" PostTypeId="2" ParentId="8555" CreationDate="2013-04-09T08:47:19.627" Score="0" Body="&lt;p&gt;Professor Andrew Moore has worked actively on using Gaussian Mixture Models along with Expectation Maximization in order to find the GMM parameters. He could probably contacted at his email address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general problem with unsupervised learning is that it typically requires a very-very large data set. Otherwise it will start classifying images based on 'less important' features rather than the more important features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, reducing the number of features obtained via SIFT could probably make your model significantly better.This could be done via preprocessing the image and :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Cropping less important parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Smoothing the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Reducing the color range/binarizing the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, care must be taken to do these things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all, I find the results of unsupervised classification of images 'poor' and 'unreliable'.&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="958" LastEditDate="2013-04-09T13:35:40.640" LastActivityDate="2013-04-09T13:35:40.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8563" PostTypeId="2" ParentId="8459" CreationDate="2013-04-09T09:01:43.520" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If the expression that defines the DFT is evaluated for all integers&#xA;  $k$ instead of just for $k = 0, \dots, N-1$ , then the resulting&#xA;  infinite sequence is a periodic extension of the DFT, periodic with&#xA;  period $N$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The periodicity can be shown directly from the definition:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$ X_{k+N} \stackrel{\mathrm{def}}{=} \ \sum_{n=0}^{N-1} x_n e^{-\frac{2\pi i}{N} (k+N) n} = \sum_{n=0}^{N-1} x_n e^{-\frac{2\pi i}{N} k n} \underbrace{e^{-2 \pi i n}}_{1} = \sum_{n=0}^{N-1} x_n e^{-\frac{2\pi i}{N} k n} = X_k.$$ &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Similarly, it can be shown that the IDFT formula leads to a periodic&#xA;  extension.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Source: &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Periodicity&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While the periodic property of DFT isn't very widely utilized, it often causes aliasing problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://www.dspguide.com/ch10/3.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch10/3.htm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="958" LastEditorUserId="80" LastEditDate="2013-05-02T11:49:11.013" LastActivityDate="2013-05-02T11:49:11.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8564" PostTypeId="1" CreationDate="2013-04-09T10:50:50.357" Score="1" ViewCount="60" Body="&lt;p&gt;This is MR Modality Link &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.uploadmb.com/dw.php?id=1365578059&quot; rel=&quot;nofollow&quot;&gt;MR Modality&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this file where i find the LV Cavity in above link file. Also how to draw Tumor Marker from over it &lt;/p&gt;&#xA;" OwnerUserId="4308" LastEditorUserId="4308" LastEditDate="2013-04-10T07:19:22.723" LastActivityDate="2013-04-10T08:28:12.437" Title="How can detect the Left Ventricle (LV) Cavity into the MR dicom file?" Tags="|image-processing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8565" PostTypeId="1" AcceptedAnswerId="8569" CreationDate="2013-04-09T13:33:05.733" Score="1" ViewCount="2406" Body="&lt;p&gt;The matlab &quot;ellip&quot; function can be used to design the unquantised coefficient set.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;From matlab website:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$ [b,a]=ellip(n,Rp,Rs,Wp) , $&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;n: order of filter&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Wp: normalized passband edge frequency   &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Rp: ripple in passband (db) &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Rs: db down from he peak value in the passband&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If i have an 8th order IIR filter with the following transfer function magnitude response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA; 0\,\mathrm{db} \pm 1.5 \,\mathrm{db} &amp;amp; \quad \text{for } \quad 0.2&amp;lt;|v|&amp;lt;0.3 \cr&#xA; \lt −60\,\mathrm{db} &amp;amp; \quad\text{for } \quad |v|&amp;lt;0.14\text{ and } |v|&amp;gt;0.36&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how i can fill the matlab function with the suitable values?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-04-09T15:09:22.660" LastActivityDate="2015-03-06T09:09:00.130" Title="Fill matlab &quot;ellip&quot; function through transfer function magnitude response" Tags="|filters|filter-design|transfer-function|magnitude|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8567" PostTypeId="1" AcceptedAnswerId="8568" CreationDate="2013-04-09T14:01:04.827" Score="4" ViewCount="6476" Body="&lt;p&gt;Plotting the FFT of a signal with Matlab e.g. by the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y_fft = abs(fft(y));&#xA;f = fs*(0:length(y)-1)/length(y);&#xA;plot(f,y_fft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;y&lt;/code&gt; is the discrete signal and 'fs' is sample rate. creates a plot where the curve can be mirrored in the middle of the x-axis e.g.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FSKvQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why can the FFT always be mirrored in the middle of the x axis?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastActivityDate="2013-04-09T14:09:09.673" Title="Why can the FFT always be mirrored in the middle of the x axis?" Tags="|fft|matlab|" AnswerCount="1" CommentCount="1" ClosedDate="2013-04-12T00:02:24.863" ContentLicense="CC BY-SA 3.0" />
  <row Id="8568" PostTypeId="2" ParentId="8567" CreationDate="2013-04-09T14:09:09.673" Score="7" Body="&lt;p&gt;The DFT of a real signal is conjugate symmetric. For example, if your DFT result at, say, 2Hz was $1+j5$, then your DFT result at -2Hz would be $1-j5$. This is conjugate symmetry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, when you take the absolute magnitude, the result in both cases is the same, which is why you see this mirror image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going deeper, the reason for why a real signal can be decomposed into symmetric complex conjugate parts, is because a real signal oscillates on the real axis, and this can be thought of as the resultant of two phasors rotating around the center of the complex plane, in opposite directions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helped. &lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-04-09T14:09:09.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8569" PostTypeId="2" ParentId="8565" CreationDate="2013-04-09T15:24:15.880" Score="3" Body="&lt;p&gt;The quickest way would be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = ellip(8,1.5,60,[.2 .3]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This designs a bandpass from .2 to .3 with 1.5 dB ripple and 60 db stop band attenuation. You don't get to pick the edges of the stop band since you already pre-selected the order. You can do one or the other but not both at the same time. However the 8th order filter is more than enough to meet your stop band requirements. In fact the low band stops at 0.195 and the high stop band starts at 0.307.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another wrinkle is that the ripple actually only goes down, i.e. passband is not between -1.5dB and +1.5 dB but only between -1.5dB and 0 dB. In order to work aound this (if you care) you can double the ripple to 3 dB and than simply add 1.5 dB gain. You would also have to increase the stop band attenuation to 61.5dB to compensate for the overall gain change. The funcion $ellipord$ allows to calculate the required order to achieve a certain stop band, so the correctest way would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Ellip filter design example&#xA;[n,wp] = ellipord([.2 .3],[.14 .36],3,61.5);&#xA;[b,a] = ellip(n,3,61.5,wp);&#xA;% add 1.5 dB of gain&#xA;b = b*10.^(1.5/20);&#xA;[H,F]= freqz(b,a,1000,2);&#xA;plot(F,10*log10(H.*conj(H)));&#xA;set(gca,'ylim',[-70,3]);&#xA;grid('on');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it turns out a 5th order elliptic filter can do the job just fine.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-09T15:24:15.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8570" PostTypeId="1" AcceptedAnswerId="8598" CreationDate="2013-04-09T17:27:03.083" Score="2" ViewCount="1202" Body="&lt;p&gt;I'm reading an IEEE standard and it says that the first channel needs to be 50dB below the highest power in a 6 MHz operating channel in 100 KHz bandwidth. It was mentioned several times that the power spectrum measurement needs to be done over a 100 KHz bandwidth. Isn't it sufficient to just say that the power of the first channel should be 50dB below the highest power. I guess my question is what is the significance of the measurement bandwidth, such as the 100 KHz. Why do we need to specify a measurement bandwidth?.    &lt;/p&gt;&#xA;" OwnerUserId="4259" LastActivityDate="2013-04-11T04:07:59.053" Title="RF mask (power spectrum measurement bandwidth)" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8571" PostTypeId="1" AcceptedAnswerId="8573" CreationDate="2013-04-09T19:29:17.530" Score="3" ViewCount="3519" Body="&lt;p&gt;Suppose we have create an IIR filter with matlab function &quot;ellip&quot;,  and then we want to quantize the coefficients using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;bq=Quantize('round',b,2^8); \cr&#xA;aq=Quantize('round',a,2^8);&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read that there are 4 major types of rounding:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;truncate&lt;/li&gt;&#xA;&lt;li&gt;round&lt;/li&gt;&#xA;&lt;li&gt;convergent rounding&lt;/li&gt;&#xA;&lt;li&gt;round-to-zero&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What is the differences between of them and how i know which method is best to choose?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="923" LastEditDate="2013-04-09T20:19:18.287" LastActivityDate="2013-04-09T20:33:23.727" Title="Types of rounding in coefficients quantization" Tags="|filters|filter-design|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8572" PostTypeId="2" ParentId="8571" CreationDate="2013-04-09T20:31:46.807" Score="5" Body="&lt;p&gt;Different types of rounding:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;truncate: choose the nearest integer that's smaller than the actual number, also known as &quot;round towards -infinity&quot;. That's then default for many compilers as it's the easiest to implement in hardware.&lt;/li&gt;&#xA;&lt;li&gt;round: choose the nearest integer. That minimizes overall noise energy.&lt;/li&gt;&#xA;&lt;li&gt;round-to-zero: chose the nearest integer that's smaller in magnitude. Example 1.8-&gt;1, -1.8-&gt;-1&lt;/li&gt;&#xA;&lt;li&gt;Convergent rounding: very similar to &quot;round&quot;, only the way exact half (2.5, -4.5 etc.) are different to avoid a rounding bias. Very little practical difference, so we ignore it&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Typically truncate is the worst, but cheapest; round minimizes overall noise, and round-to-zero maximizes stability and minimizes limit cycles. However that only applies to signal conversion in, for example IIR Filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coefficient quantization is more complicated. First you need to define what you care most about: Is it magnitude response, phase response, are there any &quot;don't care&quot; regions in frequency, etc. It's typically best to try all possible combinations and then pick the best one based on a pre-defined some error criteria. In extreme cases (poles very close to the unit circle), the quantization can kick a pole out of the unit circle and the filter becomes unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantization also needs to take the filter topology into account. Typically this filters are broken down in biquads and the specific implementation of the biquad will impact the coefficient representation and the sensitivity to quantization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If in doubt, try them all, that's what computers are good at.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-09T20:31:46.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8573" PostTypeId="2" ParentId="8571" CreationDate="2013-04-09T20:33:23.727" Score="7" Body="&lt;p&gt;The various rounding methods have a computation vs. quantization error tradeoff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Truncate&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Truncation is the simplest method.  Everything after the decimal point is simply lopped off.  For instance, both 2.1 and 2.9 become 2.  This is very simple, but is the worst method in terms of quantization error.  It is particularly bad because when you are dealing with non-negative numbers it introduces a strong negative bias.  In some algorithms that can be bad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Round/Convergent Rounding&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply saying &quot;Round&quot; doesn't tell you enough to know what is meant.  What kind of rounding?  People usually mean convergent rounding when they say &quot;round&quot;, so I will assume that that is what is meant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convergent rounding rounds down when the decimal place is $\le .499\overline{9}$ and rounds up when the decimal place is $\ge .500\overline{0}1$.  The question remains- what to do when you have exactly $.5$?  Some rounding algorithms always round down (this is called &quot;round-to-zero&quot;), but that introduces a very small amount of bias.  Convergent rounding tries to eliminate the bias by rounding to the nearest even number, the assumption being that around half the time that will be up and half the time it will be down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the best algorithm in terms of quantization noise, but is the most computationally intense.  In many situations though, you don't care how computationally intense it is since the calculation isn't done at run-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Round-to-Zero&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned previously, round-to-zero is the same as convergent rounding except it always rounds towards zero when the decimal portion is $.5$.  This is a compromise between truncation (easy computationally) and convergent rounding (low quantization error).&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-09T20:33:23.727" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8574" PostTypeId="2" ParentId="8555" CreationDate="2013-04-09T20:52:00.740" Score="1" Body="&lt;p&gt;Are you trying to model the distribution of the SIFT descriptors using GMM? Are you using the actual 128-element descriptors?  If so, then you are trying to model a distribution in a 128-dimensional space, which is not likely to work well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to reduce the dimensionality. If you insist on using GMM, then the simplest thing to try is to use principal components analysis (PCA) to reduce the dimensionality of your descriptors.  I would not use more than 10 dimensions.  Here is a &lt;a href=&quot;http://vis-www.cs.umass.edu/papers/local_global_workshop.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;, that tried kernel density estimation on reduced SIFT descriptors among other things.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could try other algorithms, such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Bag-of-words_model_in_computer_vision&quot; rel=&quot;nofollow&quot;&gt;Bag Of Features&lt;/a&gt;, or the Pyramid Match Kernel.  &lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2013-04-09T20:57:28.410" LastActivityDate="2013-04-09T20:57:28.410" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8575" PostTypeId="2" ParentId="8564" CreationDate="2013-04-10T08:28:12.437" Score="1" Body="&lt;p&gt;I'm looking at this DICOM now and it is very hard to tell where I am in the brain (since there is only one slice). Anyhow, tumours tend to be bright irregularities. The thing I &lt;em&gt;think&lt;/em&gt; is a tumour certainly isn't in the LV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can just draw an ROI over it using something like FSLVIEW if you are planning to do it manually, or you can have some fun and use something that looks for irregularities across hemispheres in the edges as detected by an algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.medicalimagingandgraphics.com/article/S0895-6111(11)00079-6/abstract&quot; rel=&quot;nofollow&quot;&gt;http://www.medicalimagingandgraphics.com/article/S0895-6111(11)00079-6/abstract&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps...&lt;/p&gt;&#xA;" OwnerUserId="4266" LastActivityDate="2013-04-10T08:28:12.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8576" PostTypeId="1" CreationDate="2013-04-10T09:28:54.580" Score="3" ViewCount="402" Body="&lt;p&gt;I am doing R&amp;amp;D over the MR Segmentation to draw marker over the Heart MR Dicom Images. My Question is that how I can draw a such marker over the dicom image that show in attach/link image. that Region of Interesr ROI read from the tag or its part of Pixel Processing.&lt;img src=&quot;https://i.stack.imgur.com/89qOz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4318" LastActivityDate="2018-06-01T07:49:28.127" Title="MR Segmentation to draw marker over the MR Dicom Images" Tags="|image-processing|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8577" PostTypeId="1" AcceptedAnswerId="8578" CreationDate="2013-04-10T09:38:52.017" Score="7" ViewCount="713" Body="&lt;pre&gt;&lt;code&gt;1 2 1                         1 2 1                    &#xA;2 4 2 (A)            (1/16) * 2 4 2  (B)&#xA;1 2 1                         1 2 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both matrices are the same except that the matrix B is multiplied by the sum of its elements.&#xA;When convolved with an image, they give nearly the same blurred image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the exact difference between them and when they should be used ?&lt;/p&gt;&#xA;" OwnerUserId="4271" LastActivityDate="2013-04-11T06:50:59.763" Title="What is the difference between a simple gaussian filter and gaussian filter multiplied by its sum of it elements?" Tags="|image-processing|filters|gaussian|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8578" PostTypeId="2" ParentId="8577" CreationDate="2013-04-10T09:44:21.830" Score="8" Body="&lt;p&gt;The rightmost one (where you divide by the sum) ensures that the output of the filter wil have the same dynamic range as the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, the output blurred images &lt;strong&gt;are not the same&lt;/strong&gt; because their pixel values are different. You have the feeling that they are similar because your software (I assume Matlab) does remap the intensity values of the pixels to a range that is acceptable by typical displays, i.e., 8-bits values between 0 and 255. If you used a more &quot;close to the metal&quot; software or library, then you would have to do this operation by yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Data dynamic range&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dynamic range of an image is given either by the min and max intensity values present in the image or by the min and max intensity that can be represented by the digital format used to store the intensity values. (From the context it is usually clear which one of the definitions is in use.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typical ranges are $[2,255]$ (with integer spacing) that corresponds to 8 bits quantization and $[0,1]$ for floating point values (either single or double precision). The same convention is used in Computer Graphics, OpenGL, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take a constant image with value 1 everywhere: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the left filter will output a constant image with value 16 everywhere, &lt;/li&gt;&#xA;&lt;li&gt;the second (rightmost) one produces a constant image of value 1.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From this simple example, you can see that one filter preserved the enery of the image, while the second one increased it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it is &lt;strong&gt;harmless in this case&lt;/strong&gt;, it can lead to numerous &lt;strong&gt;problems in practice&lt;/strong&gt;.&#xA;For example, &lt;strong&gt;iterative algorithms may diverge&lt;/strong&gt; (because of &lt;em&gt;numerical overflows&lt;/em&gt;), your computer may run out of bits to represent your data, or you may lose precision (single and double precision floating-point values do not have a uniform precision over the range of the possible values).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-04-11T06:50:59.763" LastActivityDate="2013-04-11T06:50:59.763" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8579" PostTypeId="1" CreationDate="2013-04-10T09:54:22.260" Score="4" ViewCount="287" Body="&lt;p&gt;I would like to ask what could be the easiest way to &lt;strong&gt;detect the presence and beginning (no more, no less)&lt;/strong&gt; of under-damped harmonic signal in a collect of ultrasound data. I have some acquired data which is presented in 2-D image form, where vertical axis are related with time. Under-damped harmonic signal, which I need to detect, looks like &lt;a href=&quot;http://www.biomathdynamics.com/underdampingFigure.jpg&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, but of course it is noised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to detect presence of this kind of signal automatically. Currently I've developed algorithm, which calculates short-time Fourier transform for every vertical line of image, collect values of five the most often frequencies for every short-time window, and chooses the vertical line with the most harmonically nature - with the most repeated frequencies. Unfortunately in this solution every time one of the line is chosen. I can use some kind of threshold for sure, but i don't think so it's good solution. However, it isn't the most important problem - my algorithm calculate which line has under-damped harmonic signal, no where it starts. Second problem is that this solution is too slow for my purpose - 20 times per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to make my own research but solutions like Kalman filter, or estimation by least squares method, in my opinion, it's like attempting to kill ant by tank - I need smaller caliber method. Currently I don't need to know features of signal like values of angular frequencies and amplitudes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas signal-processing community? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4319" LastActivityDate="2013-04-10T15:11:26.727" Title="How to detect underdamped harmonic signal?" Tags="|signal-detection|detection|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8580" PostTypeId="1" AcceptedAnswerId="8583" CreationDate="2013-04-10T10:48:32.547" Score="6" ViewCount="18110" Body="&lt;p&gt;I have a GMSK modulator in MATLAB and wish to generate AWGN with a specific SNR, and I'm having some issues figuring out just how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found this step-by-step process to generate zero-mean Gaussian noise with a specified power spectral density W0:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Form Gaussian distributed random variable: w = randn(1,N)&lt;/li&gt;&#xA;&lt;li&gt;Map top zero mean: w = w - sum(w)/N&lt;/li&gt;&#xA;&lt;li&gt;Compute average power: Pw = sum(w.^2)/N&lt;/li&gt;&#xA;&lt;li&gt;Form w = w.*sqrt(W0*fs/Pw)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note: As pointed out by Deve, steps 2 and 3 should not be necessary, since randn() generates a random variable with zero-mean and power 1. However, it is possible that the mean and power may be slightly off, since the vector is of finite length. For my application, neglecting these steps give a slightly less accurate SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how do I determine which power spectral density I need to achieve a specified SNR? I understand that SNR is defined as $SNR=P_s/P_n$. Measuring the signal power using $P_s=\frac{1}{N}\sum_{n=0}^{N-1} s[n]^2$ and then isolating $P_n=P_s/SNR$ seems trivial, but how do I relate $P_n$ to $W_0$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Using Deves answer, I have written the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s           = signal;&#xA;L           = length(s);&#xA;&#xA;% Convert SNR from dB&#xA;SNRdB       = 10;&#xA;SNR         = 10^(SNRdB/10);&#xA;&#xA;% Measure average power of signal&#xA;Ps          = sum(s.^2)/L;&#xA;&#xA;% Calculate wanted noise power&#xA;Pn          = Ps/SNR;&#xA;&#xA;% Generate random vector and ensure 0-mean &#xA;w           = randn(1,L);&#xA;w           = w-sum(w)/L;&#xA;&#xA;% Scale to wanted power&#xA;Pw          = 1/L*sum(w.^2);&#xA;w           = sqrt(Pn/Pw).*w;&#xA;&#xA;% Measure resulting SNR&#xA;Pw_meas     = 1/L*sum(w.^2);&#xA;SNRdB_meas  = 10*log10( Ps/Pw_meas ); % Gives 10.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's a plot in time domain for anyone interested:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WBjlo.png&quot; alt=&quot;Signal and noise in timedomain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't seem like a lot of noise - but I guess the calculation of &lt;code&gt;SNRdB_meas&lt;/code&gt; is quite foolproof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[PSD plot removed]&lt;/p&gt;&#xA;" OwnerUserId="3829" LastEditorUserId="3829" LastEditDate="2013-04-11T13:25:17.400" LastActivityDate="2019-07-17T15:13:01.893" Title="Power spectral density and SNR for AWGN" Tags="|noise|snr|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8581" PostTypeId="2" ParentId="8576" CreationDate="2013-04-10T11:05:45.243" Score="2" Body="&lt;p&gt;Typically research papers handling DICOM standard images would probably extract the ROI using pixel processing methods. However, a lot of medical imaging companies like to implement their own DICOM tags(public/private) to keep track of such information for various purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, General Electric keeps the following tag enabled on most MR images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;VerticesOfTheRegion found at (0028,9503), which is according to the DICOM standard, a private tag(odd location tags are private)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short: Its implausible to tell you,how was the ROI extracted without having access to the DICOM metadata of the image in question.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-04-10T11:05:45.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8582" PostTypeId="1" CreationDate="2013-04-10T13:30:05.870" Score="4" ViewCount="657" Body="&lt;p&gt;How can I obtain the wavelet filter coefficients ( i.e.       lowpass decomposition filter,        highpass decomposition filter,        lowpass reconstruction filter,        highpass reconstruction filter) for the Morlet wavelet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For convenience: the wavelet curve follows the equation $$\pi^{1/4}  \exp(jwx) \exp(-0.5x^2)\,.$$&lt;/p&gt;&#xA;" OwnerUserId="4320" LastEditorUserId="15892" LastEditDate="2018-03-27T17:25:28.227" LastActivityDate="2022-04-06T08:00:45.077" Title="Wavelet filter coefficients from the Morlet wavelet" Tags="|filters|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8583" PostTypeId="2" ParentId="8580" CreationDate="2013-04-10T13:55:01.530" Score="4" Body="&lt;p&gt;First a comment on your noise-generation process. The Matlab function &lt;code&gt;randn()&lt;/code&gt; generates Gaussian noise with zero mean and mean power 1. So steps 2 and 3 are obsolete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to achieve a given SNR, then creating the noise signal with the wanted power is as simple as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w = w .* sqrt(P_n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;P_n&lt;/code&gt; is the mean noise power and can be calculated by the equation you've already found yourself. Actually you're doing the exact same thing in your step 4, from which you can also derive that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;P_n = W0 * fs&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assuming that &lt;code&gt;fs&lt;/code&gt; is the sampling frequency of your system and thus equal to the bandwidth and using &lt;code&gt;Pw = 1&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-04-10T13:55:01.530" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8584" PostTypeId="2" ParentId="8555" CreationDate="2013-04-10T14:06:07.243" Score="0" Body="&lt;p&gt;Based on posted answers, I will try to add the following steps in the model process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a preprocessing-step on images in corpus before applying SIFT&lt;/li&gt;&#xA;&lt;li&gt;a postprocessing-step on images after applying SIFT such that PCA to reduce dimensions of features&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks again for your help&lt;/p&gt;&#xA;" OwnerUserId="4304" LastActivityDate="2013-04-10T14:06:07.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8585" PostTypeId="2" ParentId="8580" CreationDate="2013-04-10T14:11:53.227" Score="1" Body="&lt;p&gt;This is how I compute the EbN0, you must realize that exist a little difference between it and SNR(depends on modulation type).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%signal energy&#xA;calculate the mean symbol energy&#xA;% Bit energy for each symbol&#xA;Eb   = Es/bit_per_symbol;&#xA;EbNo = 10^(EbNo_dB/10);&#xA;% Noise variance   &#xA;No   = Eb/EbNo;                             &#xA;noise = sqrt(No/2)*(randn(1,length(symbol))+j*randn(1,length(symbol))); &#xA;noise_symbol = symbol + noise;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using the pseudo-code above in several systems with success. You may pay attention to the characteristics of the system you are simulating as: Number of bits per symbol, overhead in the symbol etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may wish to take several symbols for a better estimate on each Eb/N0 value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know GMSK modulators very well so I can't give you a working code, but I guess you can handle the simulation with the code above. &lt;/p&gt;&#xA;" OwnerUserId="4144" LastActivityDate="2013-04-10T14:11:53.227" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8586" PostTypeId="1" CreationDate="2013-04-10T14:19:01.800" Score="11" ViewCount="1126" Body="&lt;p&gt;I have values (plotted below) of expected RSSI values over time that I would like to compare with my measured RSSI values.  What I was looking for was a way to quantify it so I can change parameters and be able to compare/contrast different approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a hard problem in my mind because I don't know how to compare the signals and yet take into account the large-scale (overall shape) and small-scale (individual fluctuations) of signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, here is a plot of one set of signals:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vdfCV.png&quot; alt=&quot;RSSI vs Time&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the image I can see that the red measure signal roughly follows the model, but it also does an OK job of simulating some of the sinusoidal qualities of the model (in some places).  Any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;lt;&gt;&#xA;In response to pichenettes' comments (which seem reasonable), I took a diff of the two values and plotted the abs(fft(diff)) and got this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DKwhH.png&quot; alt=&quot;FFT&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure what to make of that though.  Since we don't have any actual freqs, I am not sure how to scale the axis, and then if I did, what metric would you use?&lt;/p&gt;&#xA;" OwnerUserId="4120" LastEditorUserId="4120" LastEditDate="2013-04-10T17:47:58.207" LastActivityDate="2014-02-05T21:18:00.510" Title="How to measure the agreement between to curves?" Tags="|matlab|algorithms|sampling|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8587" PostTypeId="1" CreationDate="2013-04-07T02:26:00.137" Score="1" ViewCount="432" Body="&lt;p&gt;I have some programming experiences but am really new to these kind of algorithms. I can find a few source code about implementing HHT, and most of them are written with MATLAB. What I am trying to do:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply HHT algorithm in detection of image splicing. I want to find object edges in images.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Implement this with C/C++ or other efficient languages so it can be used for real project.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;But now I don't have any ideas, I don't even know how to design the function prototype for HHT, what its input/output are.&lt;/p&gt;&#xA;&lt;p&gt;Any help are welcome, thank you&lt;/p&gt;&#xA;" OwnerDisplayName="Mickey Shine" LastEditorUserId="128" LastEditDate="2023-07-14T18:18:19.923" LastActivityDate="2023-07-14T18:18:19.923" Title="Implement Hilbert Huang Transform" Tags="|image-processing|c|software-implementation|empirical-mode-decomposition|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8588" PostTypeId="1" AcceptedAnswerId="8603" CreationDate="2013-04-10T14:30:47.650" Score="0" ViewCount="488" Body="&lt;p&gt;I'm currently reading a paper and I can't seem to make sense of a certain part. A link to the paper: removed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part I don't quite get is on page 286 (after the part where they explain their filters). It starts with the sentence &lt;em&gt;&quot;Two common methods can be used ...&quot;&lt;/em&gt;. They explain how they calculate the interbeat intervals of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The things I do not understand:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Cubic spline interpolation is applied to the data for ensuring the&#xA;  existence of continuous ﬁrst-order differential and second-order&#xA;  differential&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Do they mean that the first &amp;amp; second order derivative of two sequential splines should be the same to ensure that they are smooth ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$m$ is the number of feature points&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Is this the $n$ in the formula ? ( really none of the symbols are explained of the formula. I doubt t is the value at a certain frame, since the values are really small, which would make it impossible to be in the defined interval.)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subsequently then:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We consider the interval between [0.25, 2]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. what is this interval ? With respect to which variable ?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this sentence I can't figure out entirely.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We choose the ﬁrst-order differential point in each cycle of BVP as&#xA;  characteristic point to demarcate the interval. The number of&#xA;  ﬁrst-order differential points in a period of wave ﬂuctuates narrowly&#xA;  than the number of usual maximum points in the presence of measuring&#xA;  errors. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4. How do they know anything about any cycle at this point, this is what they are trying to determine at this point ...&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5. What is a first-order differential point in a cycle ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;6. Is a feature point a first-order differential point ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to implement this (in python), based on this explanation I can't seem to figure out the details to do this.&lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="569" LastEditDate="2013-05-08T06:48:00.083" LastActivityDate="2013-05-08T06:48:00.083" Title="Calculate interbeat intervals" Tags="|discrete-signals|interpolation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8589" PostTypeId="1" CreationDate="2013-04-10T15:07:42.030" Score="5" ViewCount="277" Body="&lt;p&gt;I am a little confused as to how to compute the nyquist criterion for a sensor array that is not linear, and/or non-uniform. For the linear, uniformly spaced case, the spatial nyquist is delimited by finding the half-wavelength that fits between the space of two adjacent sensors. Thus, if the distance between two sensors is given by $d$, then the highest frequency that is allowed is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d &amp;lt; \frac{\lambda}{2} = \frac{c}{2f}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $c$ is the speed of light, and $f$ is the frequency of the signal. And so therefore, the highest frequency allowed such that no spatial aliasing occurs is given by: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f &amp;lt; \frac{c}{2d}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is twofold: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I) What is the spatial nyquist for arrays that are uniformly spaced, but non-linear, (for example, 10 sensors evenly spaced on a circle)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;II) What is the spatial nyquist for cases where the array is non-uniform and non-linear. (for example, some odd shaped number of sensors placed arbitrarily). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; it has to do with the largest distance between them, but I am not clear on this, because, well, what distances do you care about?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="293" LastEditorUserId="293" LastEditDate="2013-04-10T15:13:07.367" LastActivityDate="2013-04-10T15:13:07.367" Title="Question on spatial sampling for non-linear and/or non-uniform arrays" Tags="|frequency|frequency-spectrum|beamforming|spatial|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8590" PostTypeId="2" ParentId="8579" CreationDate="2013-04-10T15:11:26.727" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First, de-noise the waveform using a technique suitable for non-stationary signals. Admittedly, the spectrum of the signal doesn't change too much over time. There are efficient iterative de-noising algorithms for this purpose, such as basis pursuit de-noising [1]. But even a simple low-pass filter may be sufficient depending on how bad the non-stationarity is.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since your record is mostly oscillatory, the underdamped signal effectively begins when the successive peaks of your signal are lower in amplitude. With your de-noised smoothed signal, attempt to pick up local extrema. This can be done in real-time by looking at the first derivative or discrete difference. Once you have extracted the extrema, using the values of the extrema, you can construct the signal envelope. Empirically, you can decide that if the envelope is decaying, then it signifies the starting point for under-damped behavior. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Fourier and short-time Fourier transforms may not be as effective in this problem since you are looking for the exponential decay feature, which is a temporal signature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Chen, Scott Shaobing, David L. Donoho, and Michael A. Saunders. &quot;Atomic decomposition by basis pursuit.&quot; SIAM journal on scientific computing 20.1 (1998): 33-61.&lt;/p&gt;&#xA;" OwnerUserId="4268" LastActivityDate="2013-04-10T15:11:26.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8591" PostTypeId="1" AcceptedAnswerId="8592" CreationDate="2013-04-10T18:44:10.843" Score="3" ViewCount="154" Body="&lt;p&gt;I don't if I am posting my question in the correct place.  I have tried hard to solved it but I am unsuccessful.&lt;br&gt;&#xA;I have an structuring element shown below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 1 1&#xA;1 1 1&#xA;1 1 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My image is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;11   11&#xA;11   11&#xA;11   11&#xA;11   11&#xA;1111111&#xA;11   11&#xA;11   11&#xA;11   11&#xA;11   11&#xA;11   11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have to apply erosion using the above image and structuring element (It is not programming, it is a question from exam paper).  When I apply the structuring element on the image, I found that the overall image disappear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me. Kindly please note that I am new here and I don't know if I can place this question here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4322" LastEditorUserId="4322" LastEditDate="2013-04-10T19:08:07.207" LastActivityDate="2013-04-10T19:08:07.207" Title="Erosion in image" Tags="|image-processing|homework|morphological-operations|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8592" PostTypeId="2" ParentId="8591" CreationDate="2013-04-10T19:03:13.180" Score="2" Body="&lt;p&gt;You are correct.  Erosion of that image with that structuring element should cause all of the 1's to disappear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways to look at it.  One is that only ones that are surrounded by ones will remain.  There are no such ones.  The other is that you will only have ones remain where you can fit the structure element into a set of ones in the image, and there is no such place.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-10T19:03:13.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8593" PostTypeId="2" ParentId="8586" CreationDate="2013-04-10T19:20:59.253" Score="0" Body="&lt;p&gt;I'm using RMS of the error vector as a measure. Since I'm dealing with complex modulation schemes I'm also using EVM as a measure.&lt;/p&gt;&#xA;" OwnerUserId="4144" LastActivityDate="2013-04-10T19:20:59.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8594" PostTypeId="2" ParentId="8577" CreationDate="2013-04-10T20:07:34.903" Score="1" Body="&lt;p&gt;When you convolve an image with a filter, the result depends on both the filter and the image pixel values. if the filter doesn't sum up to one, then it will have its own positive contribution to the convolution. For example if you convolve an image that consists of only a constant value, with a filter that doesn't sum up to one, then the convolution would result in an image with a higher constant value. So this filter would change the average brightness of the image, which may not be desirable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exact difference between both images would be a constant term i.e. the sum of the filter kernel, the dynamic range that is the difference between positive and negative values, would stay exactly the same.&lt;/p&gt;&#xA;" OwnerUserId="4323" LastActivityDate="2013-04-10T20:07:34.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8595" PostTypeId="2" ParentId="6313" CreationDate="2013-04-10T20:14:17.493" Score="5" Body="&lt;p&gt;You have to think about the change in Nyquist frequency between both images. If the Nyquist frequency of the original image is N, the downsampled image will have a lower Nyquist frequency, xN, where x is related to the ratio of sizes between the final image and the initial one. You would need to remove those spatial frequencies which are higher than xN in the original image before downsampling it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The power spectrum of a Gaussian in the image space, is also a Gaussian in the frequency space. If we ignore for a moment the second dimension, the Gaussian in the image space is defined as exp(-x^2/s^2), where x represents your pixels. This is mapped to the frequency space as exp(-w^2*s^2), where w is the frequency. The sigma parameter (s) shows that a broad Gaussian in the image space, corresponds to a narrow Gaussian in the frequency space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would like to choose a sigma parameter that yields a very low value in frequency space at the frequency that corresponds to the Nyquist frequency of the down sampled image.&lt;/p&gt;&#xA;" OwnerUserId="4323" LastEditorUserId="4323" LastEditDate="2013-04-14T15:14:23.180" LastActivityDate="2013-04-14T15:14:23.180" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8596" PostTypeId="1" CreationDate="2013-04-11T02:12:04.820" Score="0" ViewCount="549" Body="&lt;p&gt;I want to eliminate spurious peaks of Hilbert transform for finding glottal closure in the linear prediction (LP) residual. I have the following 4 steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Down-sample.&lt;/li&gt;&#xA;&lt;li&gt;Hilbert Transform.&lt;/li&gt;&#xA;&lt;li&gt;Identify Peaks in Hilbert Transform.&lt;/li&gt;&#xA;&lt;li&gt;Consider this hypothesis that time gap between two successive glottal closure instance is not likely to vary in the adjacent pitch period.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Case 3 would help to find peaks such as candidate and spurious peaks. However case 4 improve our results for best peaks candidate for glottal closure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have written the following MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;e_downsample = downsample(e,2);&#xA;DFT=fft(e);&#xA;hilbert_e=ifft(complex(imag(DFT(1:(length(DFT)/2))),real(DFT(1:(length(DFT)/2)))));&#xA;h_e=sqrt(e_downsample(:).^2-hilbert_e(:).^2);&#xA;[pks,locs] = findpeaks(abs(h_e));&#xA;figure, &#xA;plot(abs(h_e));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I will really appreciate, if anyone help me in cases 3 and 4.&lt;/p&gt;&#xA;" OwnerUserId="4327" LastEditorUserId="1629" LastEditDate="2016-03-26T16:50:53.060" LastActivityDate="2016-03-26T16:50:53.060" Title="Remove spurious peaks of Hilbert transform" Tags="|noise|digital-communications|lpc|speech-processing|enhancement|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8597" PostTypeId="2" ParentId="8530" CreationDate="2013-04-11T03:55:53.463" Score="3" Body="&lt;p&gt;I'll try my hand at this also. In my experience, in courses where the concept of convolution is taught, it's common to see the &quot;flip-and-slide&quot; process diagrammed out as you've alluded to. I don't feel that the graphical illustration itself really gives that much insight, but here's how you might arrive at it starting with the convolution integral itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = \int_{-\infty}^{\infty} x(\tau)h(t-\tau)d\tau&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the event that the impulse response $h(t)$ is causal (i.e. it is zero $\forall t &amp;lt; 0$, and it usually is), then the above integral can instead be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = \int_{-\infty}^{t} x(\tau)h(t-\tau)d\tau&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you can change the limits of the integral, because $\forall \tau &amp;gt; t$, the argument to $h(t)$ is less than zero, therefore making the integrand zero. Likewise, if the input signal $x(t)$ is causal, then the above integrand is zero $\forall \tau &amp;lt; 0$, simplifying it further to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = \int_{0}^{t} x(\tau)h(t-\tau)d\tau&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is starting to look a bit less imposing. Now, the question is, how does this equation lead to the &quot;flip and slide&quot; interpretation of convolution? Well, by straightforwardly reading the above equation, you can recognize the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In order to calculate the output of the convolution $y$ at some point in time $t$, we sum up a bunch of terms over the variable of integration $\tau$, ranging from $0$ to $t$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Each term consists of the product of the impulse response evaluated at the variable of integration $\tau$ and the input signal, time-reversed with respect to the variable of integration $\tau$ and shifted to the left by the current output time $t$. &lt;strong&gt;This is where the concept of &quot;flipping&quot; the impulse response as an interpretation of the convolution integral comes from.&lt;/strong&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, understand one thing: there is no actual time reversal of the impulse response that occurs when you excite an LTI system with an input signal. That's merely one way of intuitively interpreting the structure of the convolution equation, and one that lends itself well to a graphical explanation that most will probably have seen in an undergraduate signals and systems course. One such example is given &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution#Derivations&quot; rel=&quot;nofollow noreferrer&quot;&gt;on Wikipedia&lt;/a&gt;, duplicated below. It is interpreted as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hskip1in$&lt;img src=&quot;https://i.stack.imgur.com/dEczK.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;When you see the impulse response &quot;sliding&quot; across the input signal, that illustrates the progression of the time variable $t$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At any particular time instant instant $t$, in the animation, remember that the output signal is equal to&#xA;$$&#xA;y(t) = \int_{-\infty}^{\infty} x(\tau)h(t-\tau)d\tau&#xA;$$&#xA;I kept the generic form here to better fit the diagram on Wikipedia, which is not causal. We take the product of the input signal $x(\tau)$ and the time-reversed, shifted impulse response $h(t-\tau)$ and integrate over the range of $\tau$ where the two functions overlap. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This action is equivalent to finding the area under the curve formed by the product $x(\tau)h(t-\tau)$. This area is shown as the yellow area in the animation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At any time $t$, the output of the system $y(t)$ is equal to the amount of area shown in the animation at that particular time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As I said, that's the description that you've probably gotten from your professors, and it works well if you're tasked with calculating convolution integrals for simple functions, which typically involves some variation of the above process over a few piecewise intervals. Like I said before, though, I don't feel like this interpretation gives you much intuition to go on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In my opinion, the superior explanation is that espoused by Dilip in the linked answer.&lt;/strong&gt; You can arrive at it via what I think is an even more straightforward reading of the convolution integral:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = \int_{0}^{t} x(\tau)h(t-\tau)d\tau&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read it as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The time function $y(t)$ consists of the sum of a bunch (an infinite number, actually) of functions of $t$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Each term in the sum has the form:&#xA;$$&#xA;x(\tau)h(t-\tau)&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This is a function of $t$, expressing a copy of the system's impulse response $h(t)$, delayed in time by $\tau$ (the variable of integration) and weighted by the input signal $x(t)$, evaluated for $t=\tau$ (again, the variable of integration.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;So, intuitively, we form the output signal $y(t)$ by adding an infinite number of copies of the impulse response. Each copy of the impulse response is delayed by $\tau$ and weighted by the input signal evaluated at that value $\tau$. For the causal case, $\tau$ ranges from zero to $t$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That's it! I feel that this gives a much better feel for the &quot;action&quot; that an LTI system performs to an input signal. Think of it this way (which is very mathematically imprecise): at each time instant, the input signal &quot;causes a copy of the impulse response to start coming out of the system,&quot; with an amplitude commensurate with the value of the input at that instant. Due to the linearity and time invariance of the system, all of these impulse response copies sum up to form the composite that is the output signal $y(t)$. While I find this very intuitive, it is even more clear for the discrete-time case:&#xA;$$&#xA;y[n] = \sum_{k=0}^{n} x[k] h[n-k]&#xA;$$&#xA;This is the exact same concept, except the infinitesimally-spaced integrals turn into discrete sums (and the discrete nature makes it even easier to visualize, as Dilip tabulated it in his answer that you referenced). I think that using this idea is the best way to express the nature of the convolution integral.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-04-11T03:55:53.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8598" PostTypeId="2" ParentId="8570" CreationDate="2013-04-11T04:07:59.053" Score="1" Body="&lt;p&gt;The simple answer: when you take a power measurement using some piece of test equipment (such as a spectrum analyzer or an RF power meter), the reported value indicates the amount of power measured within some detection bandwidth of the instrument. For some devices, that might be a fixed value, determined by the filtering present in its RF front end. Other types of equipment, like a spectrum analyzer, will typically have adjustable bandwidth (which in this case would usually be called the instrument's &lt;em&gt;resolution bandwidth&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see how the bandwidth setting affects the measurement, try injecting a modulated signal into a spectrum analyzer and see how the power measurements vary as you change the resolution bandwidth: you can get very different answers. Take a common $\frac{\sin{x}}{x}$ spectral envelope as an example: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you use a very small measurement bandwidth, then you're taking power measurements over very small swaths of frequency. This allows you to observe the detail in the spectrum's shape. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As you increase the resolution bandwidth, your instrument will take more and more of the signal's spectrum into account for the power measurement, and the reported values will become more of an overall measure of the total received power.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As was indicated in the comments already, the specification calls out a specific bandwith to ensure repeatability. Specifications are used to validate implementations as conforming to an existing standard. This particular scheme for measuring the emission mask of a transmitter implementation is likely in use because that was the one that was chosen when the standard was designed. Due to the imprecise definitions of concepts like SNR and bandwidth, there are many ways that you could define such a requirement, but this is the one that the authors chose. That doesn't make it right or wrong; it just is.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-04-11T04:07:59.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8599" PostTypeId="1" CreationDate="2013-04-11T05:08:09.207" Score="2" ViewCount="100" Body="&lt;p&gt;I am trying to get the position data from an IMU 6 Degrees of Freedom (&lt;a href=&quot;http://store.explorelabs.com/index.php?main_page=product_info&amp;amp;cPath=12&amp;amp;products_id=142&quot; rel=&quot;nofollow&quot;&gt;MPU-6150&lt;/a&gt;) board using an Arduino Uno. I am trying Jeff Rowberg’s example MPU6050_DMP6.ino that may be found &lt;a href=&quot;http://store.explorelabs.com/index.php?main_page=product_info&amp;amp;cPath=12&amp;amp;products_id=142&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the first time I am working with an IMU. I have no idea whether it's possible to get the position data using the using quaternions and yaw, pitch and roll data? It would be great if someone can explain how to find the position of the sensor (translation in cm or mm and rotation in degrees) using that sketch.&lt;/p&gt;&#xA;" OwnerUserId="4330" LastActivityDate="2013-04-11T05:08:09.207" Title="How to get translation and roation data using 6DOF MPU6150" Tags="|algorithms|filter-design|motion-detection|motion|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8600" PostTypeId="2" ParentId="5992" CreationDate="2013-04-11T05:12:27.537" Score="4" Body="&lt;p&gt;At index c[n], the convolution of a[n] and b[n], is such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;c[n] is a summation of all products (a[k]b[m]) such that m+k=n,&quot; so m = n - k or k = n - m, which means that one of the sequences has to be flipped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now why does convolution behave this way in the first place? Because of its connection with multiplying polynomials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplying two polynomials results in a new polynomial with co-efficients. The co-efficients of the product polynomial define the operation of convolution. Now, in signal processing, transfer functions- Laplace transforms or z-transforms are these polynomials, with each co-efficient corresponding to a different time-delay. Matching the co-efficients of the product and the multiplicands results in the fact that 'multiplication in one representation corresponds to convolution in the transformed representation'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/amZuf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4268" LastActivityDate="2013-04-11T05:12:27.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8601" PostTypeId="1" CreationDate="2013-04-11T07:00:53.357" Score="1" ViewCount="820" Body="&lt;p&gt;i am working on simulation of an article &quot;A Real-time ECG Data Compression Algorithm for a Digital Holter System&quot;. This algorithm has five steps &quot;Difference=&gt; ECG Signal=&gt;Classification=&gt; DCT=&gt; Window Filter =&gt; Huffman&quot; . it described window filter as &quot;In order to implement a high compression ratio, the DCT window size, which is chosen to be proportional to the DCT result, is adjusted from 15% to 100%.&quot;. i do not understand this step and how can i do it? how can i change window size? &#xA;please help me&#xA;thanx&lt;/p&gt;&#xA;" OwnerUserId="4331" LastActivityDate="2013-04-11T12:28:19.990" Title="what is window size?" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8603" PostTypeId="2" ParentId="8588" CreationDate="2013-04-11T08:46:47.070" Score="1" Body="&lt;p&gt;I splitted the question into smaller bits to allow more precise answers.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Question 1:&lt;/strong&gt; you seem to not understand what spline interpolation is. The quoted sentence means that you need to use an interpolation function that guarantees the continuity of 1st and 2nd order derivatives. This is the case of cubic spline and a justification for their use.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Question 2:&lt;/strong&gt; yes, I guess that there is a typo here and $n$ is $m$.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Question 3:&lt;/strong&gt; it is an interval of sampling rates. It is not very clear though...&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Questions 4/5:&lt;/strong&gt; the paper is clearly not clear or informative at this point. What the authors do is to detect a heart cycle by looking at the &lt;em&gt;1st order differential points&lt;/em&gt; (not defined, but that are opposed to the number of local extrema). My guess is that these points are the zero-crossing of the signal derivative (computed from the spline interpolation, cf. question 1).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As an additional note, the paper is not really well written or informative. For example, Laplacian eigenmaps are poorly exposed, and prior knowledge is required to understand it. Maybe you should pick another reference paper in order to get started in this field.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-04-11T14:09:22.053" LastActivityDate="2013-04-11T14:09:22.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8604" PostTypeId="1" CreationDate="2013-04-11T08:57:25.033" Score="17" ViewCount="13831" Body="&lt;p&gt;The cyan plot is a spectrum of 50 Hz, and the magenta one is a 50.1 Hz sine wave (having amplitude 0.7). Both are sampled at 1024 samples/s. I performed a 1024 point FFT to get this spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is only the 50Hz spectrum a single value? Why does the  50.1 Hz sine consist of other frequencies apart from 50.1 Hz; where do these new frequencies come from? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not do any non-linear processing on the 50.1 Hz signal! Also the 50.1 Hz appears to have smaller maximum amplitude, i.e. it's not 0.7, when in fact the sine wave I generated has an amplitude of 0.7. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c4X5W.jpg&quot; alt=&quot;Two spectra, for 50Hz and 50.1Hz respectively&quot;&gt;&#xA;Obtained by MATALB command fft();&lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="80" LastEditDate="2013-04-12T11:59:02.753" LastActivityDate="2017-05-31T12:06:33.887" Title="FFT of sine wave not coming as expected i.e single point" Tags="|fft|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8605" PostTypeId="2" ParentId="8604" CreationDate="2013-04-11T09:41:07.063" Score="12" Body="&lt;p&gt;This is the effect of truncating or windowing the sine signal. You need to truncate in such a way that if you add the shifted signal to the truncated one, it will still be the original sine wave.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-11T09:41:07.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8606" PostTypeId="2" ParentId="8604" CreationDate="2013-04-11T11:52:55.947" Score="17" Body="&lt;p&gt;Acually Matt's answer already gives one view on the problem here: the DFT is implicitly periodic in both time and frequency domain (see &lt;a href=&quot;https://dsp.stackexchange.com/questions/8459/periodicity-property-of-dft-in-time-and-frequency-domain&quot;&gt;this question&lt;/a&gt;). From your parameters we can calculate that your observation period is 1 s. That means you observe 50 periods of a 50 Hz tone. Periodically extending that observation interval will always result in a seemless sine wave. If you take the 50.1 Hz tone, you're transforming 50.1 periods of an oscillation. Periodically extending &lt;em&gt;that&lt;/em&gt; signal will result in phase jumps that cause additional spectral tributaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another view is the frequency resolution that is defined as $f_\mathrm{s}/N_ \mathrm{DFT} = 1024 \text{Hz}/1024 = 1 \text{Hz}$. As 50 Hz is an integer multiple of 1 Hz, this tone can be reresented by a single DFT bin. As the result of the DFT is discrete values that are space 1 Hz apart, a 50.1 Hz &lt;em&gt;cannot&lt;/em&gt; be represented by a single bin and the energy is smeared over the frequency domain. In your example this is the reason for the slightly asymmetric magenta spectrum and for the lower magnitude of the 50 Hz bin compared to the 0.7 magnitude of the 50 Hz spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both effects described above contribute to the spectrum you're observing.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-04-11T11:52:55.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8607" PostTypeId="2" ParentId="8601" CreationDate="2013-04-11T12:28:19.990" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://www2.lirmm.fr/lirmm/interne/BIBLI/CDROM/ROB/2008/EMBC_2008/PDFs/Papers/11980335.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;That paper is very poorly written.&lt;/a&gt; It's no wonder you have a hard time understanding it; I certainly did!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I think is happening is that several of the DCT coefficients are being thrown out (windowed). So if the window is 100%, then all the DCT coefficients are kept; if the window is 30% then 70% of the coefficients are thrown out (zeroed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Figure 11 of that paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ybrDK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The left hand signal are the DCT coefficients. The right-hand graph is the applied window. The two are multiplied together.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-11T12:28:19.990" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8608" PostTypeId="2" ParentId="8604" CreationDate="2013-04-11T14:00:07.763" Score="5" Body="&lt;p&gt;I bet your sine wave is zero at the first and last sample?  It shouldn't be.  It should be lined up so that the &lt;em&gt;next&lt;/em&gt; sample after the last sample is zero, so that you can copy and paste copies of the signal one after another and they will look continuous, with no duplicated samples.  Maybe think of it like tiled desktop wallpaper, where one edge has to seamlessly meet the opposite edge when tiled.  :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://gist.github.com/endolith/236567&quot; rel=&quot;noreferrer&quot;&gt;https://gist.github.com/endolith/236567&lt;/a&gt; for a python example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Sampling rate&#xA;fs = 128 # Hz&#xA;&#xA;# Time is from 0 to 1 seconds, but leave off the endpoint, so that 1.0 seconds is the first sample of the *next* chunk&#xA;length = 1 # second&#xA;N = fs * length&#xA;t = linspace(0, length, num = N, endpoint = False)&#xA;&#xA;# Generate a sinusoid at frequency f&#xA;f = 10 # Hz&#xA;a = cos(2 * pi * f * t)&#xA;&#xA;# Use FFT to get the amplitude of the spectrum&#xA;ampl = 1/N * abs(fft(a))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See how two copies of the signal fit together end-to-end to make a continuous wave:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C8oiJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this happens, the FFT energy is contained entirely in a single bin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DZdZj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-04-11T14:00:07.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8609" PostTypeId="1" CreationDate="2013-04-11T14:17:22.493" Score="0" ViewCount="798" Body="&lt;p&gt;I would like to create an algorithm that, given an &lt;code&gt;iddata&lt;/code&gt;,  estimates different &lt;code&gt;armax&lt;/code&gt; models with different &lt;code&gt;na&lt;/code&gt;, &lt;code&gt;nb&lt;/code&gt;, &lt;code&gt;nc&lt;/code&gt;, &lt;code&gt;nk&lt;/code&gt;, and finally show the compare plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to use the &lt;code&gt;armax&lt;/code&gt; estimation function, but how can I store the model in a variable in a such that I can compare them later?&lt;/p&gt;&#xA;" OwnerUserId="4197" LastEditorUserId="1629" LastEditDate="2016-05-27T08:33:03.953" LastActivityDate="2017-11-19T21:58:01.417" Title="Comparing multiple $\tt armax$ models" Tags="|matlab|system-identification|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8610" PostTypeId="1" AcceptedAnswerId="8655" CreationDate="2013-04-11T18:06:32.010" Score="3" ViewCount="520" Body="&lt;p&gt;I'm testing an OFDM system implemented in fixed point. The data format is Q11. My system work's fine but I need to test it under some channel for evaluation of the design before field testing. The system will be tested on Rician fading channel but for now I'm working on AWGN testing first. I asked a similar question here:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8493/apply-awgn-noise-to-qpsk-ofdm-symbol&quot;&gt;Apply AWGN noise to QPSK-OFDM symbol&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I realized that the problem is in the fixed point - float point conversion. I had a simulation of my system using 32b and the results agree with the theoretical BERXEbN0 for QPSK systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the following code for apply noise:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def awgn(self,data,noise_power):&#xA;    data_dq = data*(2.**(DATA_WIDTH-1))&#xA;    Es = sum(abs(data_dq)**2.)&#xA;    Eb = Es/(self.OFDM_SIZE*2.)&#xA;    EbN0_dB = noise_power + 10*log10(self.t_symbol/(self.t_symbol - self.t_cp))&#xA;    EbN0 = (10.)**(EbN0_dB/10.)&#xA;    N0 = Eb/EbN0&#xA;    noise = sqrt(N0/2.)*(random.standard_normal((data_dq.size,)) + random.standard_normal((data_dq.size,))*1j)&#xA;    return around(data_dq + noise)/(2.**(DATA_WIDTH-1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where DATA_WIDTH = 12.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this implementation the system agree for some regions of EbN0 curve and goes far from the curve in the other regions. With this number of bits I'm getting $10^{-2}$ BER with an EbN0 of 10dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: how to handle the conversion between fixed and float point in this context?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;update&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I had changed some parts of the above code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def awgn(self,data,noise_power):&#xA;    data_dq = data&#xA;    Es = sum(abs(data_dq)**2.)&#xA;    Eb = Es/(self.OFDM_SIZE*2.)&#xA;    EbN0_dB = noise_power + 10*log10(self.t_symbol/(self.t_symbol - self.t_cp))&#xA;    EbN0 = (10.)**(EbN0_dB/10.)&#xA;    N0 = Eb/EbN0&#xA;    noise = sqrt(N0/2.)*(random.standard_normal((data_dq.size,)) + random.standard_normal((data_dq.size,))*1j)&#xA;    return data_dq + around(noise*(2.**(DATA_WIDTH-1)))/(2.**(DATA_WIDTH-1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess it will not affect the system performance but it's here for keep updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are the curve from my last simulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m9yx5.png&quot; alt=&quot;BER Simulation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see I have a floor in my present design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm asking if this floor is due to my fixed point system performance or it's an effect of the channel model.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Update[Solution]&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Just fro add an update to the problem for future reference. The problem was in the parameters of the fixed-point FFT core used. The effects in the figure above are due to clipping, as stated from the helpful comments in this topic. Thank you for your support.&lt;/p&gt;&#xA;" OwnerUserId="4144" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-04-22T15:48:45.967" Title="Fixed point channel model for OFDM system" Tags="|digital-communications|python|ofdm|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8611" PostTypeId="1" AcceptedAnswerId="8612" CreationDate="2013-04-11T18:14:41.563" Score="3" ViewCount="14299" Body="&lt;p&gt;I was looking for a more efficient way of finding the magnitude and phase of a signal at a certain frequency without performing an FFT because it produces more information than I need and I came across this comment on the Matlab message board:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_original/250421&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_original/250421&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am sampling at 1500Hz and my signal is 100 points and I am looking for the phase and magnitude at 15Hz, would this be suitable method for obtaining the information I need? Also, why does the OP suggest windowing the signal as well?&lt;/p&gt;&#xA;" OwnerUserId="4334" LastActivityDate="2017-06-23T09:50:49.763" Title="FFT for a single frequency" Tags="|fft|fourier-transform|frequency|dft|signal-analysis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8612" PostTypeId="2" ParentId="8611" CreationDate="2013-04-11T18:23:58.437" Score="7" Body="&lt;p&gt;It's certainly calculating the right thing.  Though instead of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sum(x.*(cos(1000*2*pi*t)-i*sin(2*pi*1000*t)))*2/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you might try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sum(x.*exp(-i*2*pi*1000*t))*2/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need to do something similar, but in-line (not in a batch), you might want to look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot;&gt;Goertzel algorithm&lt;/a&gt;. As the Wikipedia link says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;.. provides a means for efficient evaluation of individual terms of the Discrete Fourier Transform&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And there's nothing particularly &quot;Fast&quot; about this way of doing it, so it's really just calculating one DFT bin.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-11T18:23:58.437" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="8613" PostTypeId="2" ParentId="8611" CreationDate="2013-04-11T21:54:29.123" Score="5" Body="&lt;p&gt;An $N$-point DFT for single bin $k$ can be computed as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k = 3;&#xA;N = 10;&#xA;x = [0:N-1];&#xA;X = sum(x.*exp(-i*2*pi*k*[0:N-1]/N));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the bin frequency is given by $k*fs/N$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to do this regularly overtime as in a STDFT, you can use the sliding DFT or sliding Goertzel (cheaper) [1]. The sliding Goertzel is essentially a comb filter (with a delay set to $N$ samples) followed by a second order IIR. You need only compute the complex spectral coefficient every $hop$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper also describes how to perform frequency domain windowing by convolving adjacent bins with the DFT of the window. For example, a hanning windowed version of the $k$th bin can be obtained by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;-0.25X_{k-1} + 0.5X_{k} - 0.25 X_{k+1}&#xA;$$&#xA;In [2], there is some discussion of implementation, precision and other considerations when using the sliding Goertzel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Eric Jacobsen and Richard Lyons. The Sliding DFT. IEEE Signal Processing Magazine, Vol. 20, No. 2. (March 2003), pp. 74-80.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] &lt;a href=&quot;http://newsgroups.derkeiler.com/Archive/Comp/comp.dsp/2005-11/msg00862.html&quot; rel=&quot;nofollow&quot;&gt;http://newsgroups.derkeiler.com/Archive/Comp/comp.dsp/2005-11/msg00862.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4335" LastEditorUserId="4335" LastEditDate="2013-04-12T09:43:35.677" LastActivityDate="2013-04-12T09:43:35.677" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8614" PostTypeId="2" ParentId="8604" CreationDate="2013-04-12T02:39:41.280" Score="8" Body="&lt;p&gt;You will only get a single result FFT point for  a frequency of pure unmodulated sinusoid that is exactly integer periodic in the FFT aperture or width.  Any other frequency of sinusoid will appear as convolved with the transform (a periodic Sinc) of the default window (a rectangle).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;50.1 Hz is not exactly periodic in your FFT's 1 second window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those other &quot;leakage&quot; FFT result bins or frequencies are needed to represent the discontinuity produced between the window boundaries by any signal that is not exactly integer periodic in the FFT width.  This is because all the basis vectors of a DFT are exactly integer periodic within the DFT's width, and thus have no sharp discontinuity between the end and beginning of the basis vector.  So any signal that doesn't have those characteristics can't be represented by just one DFT basis vector (and its complex conjugate), so the information about the rest of the signal has to go somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the total energy is preserved by the FFT transform (Parseval'a theorem), the energy in the &quot;leakage&quot; bins takes away from the peak bin.  Thus the magnitude of the peak bin must be lower.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2017-05-31T12:06:33.887" LastActivityDate="2017-05-31T12:06:33.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8616" PostTypeId="1" CreationDate="2013-04-12T10:04:36.723" Score="-2" ViewCount="73" Body="&lt;p&gt;After so much search on google i find out few things hope so that correct for detecting Left ventricles of hearth and draw the Region of Interest(ROI) on MR Modality .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you give me please more detiails idea about &quot;Morphology Algorithm&quot; for tumore detection in heart of LV&lt;/p&gt;&#xA;" OwnerUserId="4318" LastActivityDate="2013-04-12T11:02:22.637" Title="Morphology algorithm how it work for left ventricles dicom image" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="1" ClosedDate="2013-05-21T12:58:40.987" ContentLicense="CC BY-SA 3.0" />
  <row Id="8617" PostTypeId="1" AcceptedAnswerId="8618" CreationDate="2013-04-12T10:15:45.793" Score="1" ViewCount="167" Body="&lt;p&gt;If i add the two tones then the result if two peaks are added together will be greater then the the sample max (2^15).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the life of me I couldn't think of the right words to google. Think i have google block.&lt;/p&gt;&#xA;" OwnerUserId="4340" LastActivityDate="2013-04-12T10:43:13.960" Title="Generating Music Tones, How to handle when tones overlap? (16bit samples)" Tags="|sound|music|" AnswerCount="2" CommentCount="0" ClosedDate="2013-04-14T14:39:02.423" ContentLicense="CC BY-SA 3.0" />
  <row Id="8618" PostTypeId="2" ParentId="8617" CreationDate="2013-04-12T10:40:41.337" Score="3" Body="&lt;p&gt;If you can't tolerate any distortion, then divide by 2 the amplitude of the signals you want to mix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/3581/algorithms-to-mix-audio-signals-without-clipping&quot;&gt;Please check this question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-04-12T10:40:41.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8619" PostTypeId="2" ParentId="8617" CreationDate="2013-04-12T10:43:13.960" Score="3" Body="&lt;p&gt;You need to attenuate the signals.  Either by reducing the gain using a gain fader control on each signal prior to mixing them or applying a compressor to each channel so that when combined they do not exceed unity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;Mixing 2 or more sound signals together&quot; thread in the March 2004 archives of the MusicDSP mailing list archive (&lt;a href=&quot;http://music.columbia.edu/pipermail/music-dsp/2004-March/subject.html&quot; rel=&quot;nofollow&quot;&gt;http://music.columbia.edu/pipermail/music-dsp/2004-March/subject.html&lt;/a&gt;) is worth a read.&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2013-04-12T10:43:13.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8620" PostTypeId="2" ParentId="8616" CreationDate="2013-04-12T11:02:22.637" Score="2" Body="&lt;p&gt;Morphology is more a framework than a single algorithm; there are many morphological image processing algorithms for many problems. They (more or less) try to enhance/impair objects on the image based on their shape (hence the name of this family of algorithms). I would strongly recommend reading &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/3540429883&quot; rel=&quot;nofollow&quot;&gt;Morphological Image Analysis, Principles and Applications&lt;/a&gt; first, as it is a very good overview on the field, then you could try to choose an algorithm for your specific problem. As for a segmentation problem, I would look after morphological reconstruction and watershed algorithm (&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;frm=1&amp;amp;source=web&amp;amp;cd=4&amp;amp;cad=rja&amp;amp;sqi=2&amp;amp;ved=0CEAQFjAD&amp;amp;url=http://www.vincent-net.com/luc/papers/93ieeeip_recons.pdf&amp;amp;ei=ROpnUaLnE-jW4ATOtIGoBg&amp;amp;usg=AFQjCNGVgCfUv3WqLCMaWvzd33oJYHaRZw&amp;amp;sig2=BhzRJnCPpWKsMnnsGlvxpQ&amp;amp;bvm=bv.45175338,d.Yms&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; article is an excellent starting point).&lt;/p&gt;&#xA;" OwnerUserId="215" LastActivityDate="2013-04-12T11:02:22.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8622" PostTypeId="2" ParentId="8609" CreationDate="2013-04-12T11:55:56.693" Score="1" Body="&lt;p&gt;What's wrong with just doing &lt;code&gt;sys = armax(data,[na,nb,nc,nk]);&lt;/code&gt; &lt;a href=&quot;http://www.mathworks.com/help/ident/ref/armax.html&quot; rel=&quot;nofollow&quot;&gt;as per the Mathworks manual&lt;/a&gt;? sys is the variable. You could do sys[i] = ... to store several of them in an array (or perhaps sys{i}). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, to compare them, you could use &lt;a href=&quot;http://www.mathworks.com/help/ident/ref/getcov.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;getcov()&lt;/code&gt;&lt;/a&gt; and compare the covariances of each model.  These covariances tell you how &quot;uncertain&quot; the model is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach might be to look at the &lt;a href=&quot;http://www.mathworks.com/help/ident/ug/residual-analysis.html&quot; rel=&quot;nofollow&quot;&gt;model residuals&lt;/a&gt;. If the residuals are white (uncorrelated), then the model is good.  The relatively energy / power of the residuals will be a measure of how accurate the model matches the data (the smaller the residual, the better the model).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-12T11:55:56.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8623" PostTypeId="2" ParentId="8596" CreationDate="2013-04-12T13:50:05.037" Score="1" Body="&lt;p&gt;As far as I understand, you have a periodic signal, or a quasi periodic signal. And as far as I understand, you have lots of false positives when you detect the peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need a better way to identify peaks, try &lt;a href=&quot;https://github.com/selimonat/published_code/blob/master/globalfunctions/DetectPeaks.m&quot; rel=&quot;nofollow&quot;&gt;this &lt;/a&gt; one...&lt;/p&gt;&#xA;" OwnerUserId="4323" LastEditorUserId="4323" LastEditDate="2013-04-13T14:07:13.773" LastActivityDate="2013-04-13T14:07:13.773" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8625" PostTypeId="2" ParentId="8167" CreationDate="2013-04-12T18:05:37.067" Score="3" Body="&lt;p&gt;Zero padding is a useful interpolation tool using sinc function (or kernel). I will below explain it in 3 parts.&#xA;First: what is DFT; Second: Zero-padding; Third: Usage of zero-padding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(a) $\textbf{What is DFT}$: By taking a DFT of a data set we are mapping the data values from the current discrete domain (many case happens to be time example in audio signals; it can also be spatial co-ordinates as for images) to a discrete frequency domain. With the transform doing this mapping being a matrix (hence linear) which is always full-rank the mapping is always invertible without any loss in information content. Example we can take idft of the obatined dft and get back the same data we started with again or no loss!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why go to this other domain (so called transform (here frequency) domain) of representing the same data?&#xA;Well, (a real life note) when we are trying to make decisions we want to see the facts clear in front of us. We don't want unnecessary facts and likes and dislikes to wander in our mind. It similar in signal processing. When we want to analyze data we want to see the data in such a domain of representation where we have, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;concentration of information only in localized points in that domain&lt;/li&gt;&#xA;&lt;li&gt;the domain gives some sort of a physical interpretation to the data we have (this is a super plus point)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus it is clear by using DFT we want see if we can gain from the above two. Of course, if the data has one of the columns of the DFT matrix itself we have gained the maximum out of the DFT domain based representation i.e only one point in the mapped domain values will have a non-zero value ideally. Now suppose the signal is not representable using any one of the columns of the DFT matrix. Then DFT will try to represent the data by a minimal number of mixture of the columns of the DFT matrix i.e only few of the mapped domain values will have a non-zero values. So, which type of data will do this: those which share some characteristics with the DFT matrix columns such as are periodic.&#xA;$A\ moral$: hence DFT is good to represent periodic data as it gives a minimal representation based on number of non-zeros values (magnitude captures the contribution of each column in making up the original domain data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(b)$\textbf{ Zero-padding}$: In zero-padding we have first padded zeros to the data in the original domain and then take the new zero-padded signal's DFT. &#xA;This means by zero-padding we have increased the number of columns in the DFT matrix (with the matrix now also being orthogonal) with no new data in the original domain being added. With this we can hope to see more in deep how much the new added columns contribute in representing the time-domain signal. Note what we earlier say with N-point DFT will also see the same at those N points in a subsequent 2N-point DFT of the same data. So the peak magnitude will not change. (Considering we are not normalizing the DFT matrix). Now when we take the iDFT normalization factor comes into picture and we have to normalize by 1/2N this time to get the same data back instead of by N in the previous case and not pick only N points in the 2N point data. The zero-padding in time-domain can also be interpreted as sinc interpolation in the DFT domain to get the contribution of the newly introduced columns in the 2N-pont DFT. This needs a separate post of detail description. But you can see it easily by drawing the signal and seeing the zero-padded signal as a multiplication of the original assumed to be 2N length signal with a rectangular window which results in convolution in the frequency domain with a sinc function.&#xA;It may be clear now that we are not increasing frequency resolution by zero-padding i.e we are not resolving two frequencies close by but we are filling new frequencies between the existing N-point DFT frequencies and finding their contributions for making the signal. Frequency resolution can be increased only by sampling the data more finely or taking new data points which is in our hand only if we are an experimenter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(c) $\textbf{Applications of zero-padding}$: It is used as a frequency domain interpolation tool for getting the side lobe structure for filters. Also it is used to interpolate (or re-sampling) in time domain by zero-padding in frequency domain. Zero-padding in frequency domain needs care so as to preserve the original phase of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this post is clear. May have a lot of redundancy if you already know much of it.&lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2013-04-12T18:05:37.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8626" PostTypeId="1" CreationDate="2013-04-12T18:57:46.970" Score="1" ViewCount="239" Body="&lt;p&gt;I am collecting a 15Hz sine wave at 1500Hz. Therefore, every 100 points of data collected should contain a single complete sine wave.  If I sample for 10 seconds, I will have 15000 points of data. If I perform an FFT on this data I will have very high frequency resolution.  However, If I wanted to divide these 15000 points into 100 point sections and average them together to get a mean signal of 100 points, and performed an FFT on that, my frequency resolution would be very low.  So, by averaging my data I am losing frequency resolution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I would like to get an average is because high amplitude noise is periodically injected into the sine wave.  I would like to throw away the sections containing noise and only have the frequency information of the average of clean data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fairly new to DSP so I'm not quite sure how to approach this problem.  Any thoughts would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4334" LastActivityDate="2013-04-12T19:18:10.637" Title="Ways to analyze electrical signals without FFT?" Tags="|fft|dft|sampling|signal-analysis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8627" PostTypeId="2" ParentId="8626" CreationDate="2013-04-12T19:12:37.397" Score="1" Body="&lt;p&gt;Please be specific about what kind of analysis you want to perform. My reply is based on the assumption that you want to measure the exact frequency of the input (since you are talking about frequency resolution) - that is known to be near 15 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Averaging is not the only option to remove the noise. You can filter your input signal by a low-pass filter with a cutoff-frequency near the frequency of interest. If your noise is very spiky (just a glitchy sample with an abnormally high amplitude), there are non-linear techniques which might be even more efficient at removing spurious transient events without much impact on the overall shape of the signal - for example, median filtering. The danger of averaging is that the averaged segments will have to be perfectly synchronized with the period of your input signal - if they are not, the phase differences will cause cancellations and your signal will lose amplitude as segments are averaged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even with averaging and/or in a situation with access to a limited number of samples, there are better techniques than the FFT. For example, accurately determining the frequency of a sinusoidal signal can be seen as a model fitting problem and can be solved by least square techniques. You could also use a PLL to try to lock into the input signal, and thus get the phase/frequency information - if this is what you are interested in knowing...&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-04-12T19:12:37.397" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8628" PostTypeId="2" ParentId="8626" CreationDate="2013-04-12T19:18:10.637" Score="0" Body="&lt;p&gt;Look up &lt;a href=&quot;http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/denoisingwav_1_wavelet_1d/&quot; rel=&quot;nofollow&quot;&gt;wavelet denoising&lt;/a&gt; if you want an alternative to FFTs (which you should still consider).&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-04-12T19:18:10.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8629" PostTypeId="1" AcceptedAnswerId="8632" CreationDate="2013-04-12T20:39:16.920" Score="30" ViewCount="86642" Body="&lt;p&gt;It could seem an easy question and without any doubts it is but I'm trying to calculate the variance of white Gaussian noise without any result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The power spectral density (PSD) of additive white Gaussian noise (AWGN) is $\frac{N_0}{2}$ while the autocorrelation is $\frac{N_0}{2}\delta(\tau)$, so variance is infinite?&lt;/p&gt;&#xA;" OwnerUserId="1141" LastEditorUserId="128" LastEditDate="2018-06-16T19:08:11.177" LastActivityDate="2018-06-16T19:08:11.177" Title="Variance of White Gaussian Noise" Tags="|noise|power-spectral-density|random-process|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8630" PostTypeId="2" ParentId="8479" CreationDate="2013-04-12T20:42:47.917" Score="5" Body="&lt;p&gt;You will want to use the morphological &lt;a href=&quot;http://en.wikipedia.org/wiki/Closing_%28morphology%29&quot; rel=&quot;nofollow&quot;&gt;closing operation&lt;/a&gt;, which is the erosion of the dilation of an image. This means that you first dilate the image, removing the small 'holes' in the interior of the image, and then you erode the image, shrinking the boundary. If you want the final boundary to be 'smaller' than the original boundary, simply erode more than you dilate, ensuring that you dilate enough to completely fill the interior holes first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea behind this is that by removing the holes via dilation, the information about those holes is lost from the image. When you then proceed to erode the image, there are no longer interior gaps to erode away from, so it only erodes away from the outer image. Therefore, despite being opposing operations, the erosion does not simply reverse the dilation, provided the feature sizes to be removed are 'smaller' than the size of the dilation.&lt;/p&gt;&#xA;" OwnerUserId="4344" LastEditorUserId="4344" LastEditDate="2013-04-12T23:02:47.883" LastActivityDate="2013-04-12T23:02:47.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8631" PostTypeId="2" ParentId="8629" CreationDate="2013-04-12T20:57:56.310" Score="8" Body="&lt;p&gt;Suppose we have a discrete-time sequence $x[t]$ which is stationary, zero mean, white noise with variance $\sigma^2$. Then the autocorrelation of $x$ is:&#xA;$$&#xA;\begin{array}&#xA;RR_{xx}[\tau] &amp;amp;=&amp;amp; E\left[ x[t] x[t+\tau] \right]\\&#xA;&amp;amp;=&amp;amp; \left \{ \begin{array} EE \left[ x[t]^2 \right], {\rm if\ }\tau=0 \\ 0, {\rm otherwise} \end{array} \right.&#xA;\\&#xA;&amp;amp;=&amp;amp; \sigma^2 \delta[\tau]&#xA;\end{array}&#xA;$$&#xA;where $\delta[\tau]$ is the Kronecker delta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, that implies that $\sigma^2 = \frac{N_0}{2}$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-13T00:25:07.993" LastActivityDate="2013-04-13T00:25:07.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8632" PostTypeId="2" ParentId="8629" CreationDate="2013-04-12T22:00:07.857" Score="35" Body="&lt;p&gt;White Gaussian noise in the continuous-time case is not what is called a second-order process (meaning $E[X^2(t)]$ is finite) and so, yes, the variance is infinite. Fortunately, we can never observe a white noise process (whether &#xA;Gaussian or not) in nature; it is only observable through some kind of device, &#xA;e.g. a (BIBO-stable) linear filter with transfer function $H(f)$ in which case &#xA;what you get is a stationary Gaussian process with power spectral density $\frac{N_0}{2}|H(f)|^2$ and finite variance&#xA;$$\sigma^2  = \int_{-\infty}^\infty \frac{N_0}{2}|H(f)|^2\,\mathrm df.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More than what you probably want to know about white Gaussian noise&#xA;can be found in the Appendix of &lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture03.pdf&quot;&gt;this lecture &#xA;note&lt;/a&gt;&#xA;of mine.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-04-12T22:00:07.857" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="8633" PostTypeId="1" CreationDate="2013-04-13T08:05:50.773" Score="1" ViewCount="85" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WZnXm.jpg&quot; alt=&quot;enter image description here&quot;&gt;How to detection of the boundary of the left ventricle from MR images, the crucial step is to determine the region of interest (ROI) or the center point (CP) of the left ventricle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want to show this marker over the Left ventricle of heart of MR Dicom Image&lt;/p&gt;&#xA;" OwnerUserId="4308" LastEditorUserId="4308" LastEditDate="2013-04-15T09:32:48.867" LastActivityDate="2013-04-15T09:32:48.867" Title="How to detection of the boundary of the left ventricle" Tags="|image-processing|image-segmentation|" AnswerCount="0" CommentCount="2" ClosedDate="2013-05-21T12:58:31.157" ContentLicense="CC BY-SA 3.0" />
  <row Id="8634" PostTypeId="1" CreationDate="2013-04-13T10:49:14.177" Score="4" ViewCount="440" Body="&lt;p&gt;I was supposed to find state space representation and its matrices of this system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wsiev.png&quot; alt=&quot;system in s-domain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I have no idea, how to do this. We were told not to transfer the system to time domain, but I can only do state space representation from time domain schemas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I tried to solve this, I got matrices&#xA;$$A =  \left( \begin{array}{ccc@{\ }r}&#xA;    -a &amp;amp; k  \\&#xA;    -b &amp;amp; -p \\&#xA;    \end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$B =  \left( \begin{array}{ccc@{\ }r}&#xA;    0  \\&#xA;    b \\&#xA;    \end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C =  \left( \begin{array}{ccc@{\ }r}&#xA;    1 &amp;amp; 0  \\&#xA;    \end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D =  \left( \begin{array}{ccc@{\ }r}&#xA;    0&#xA;    \end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that right? If not, how sould I solve it?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="21075" LastEditDate="2018-01-16T13:00:21.810" LastActivityDate="2018-06-15T23:31:10.723" Title="State space representation in s-domain" Tags="|linear-systems|state-space|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8635" PostTypeId="1" AcceptedAnswerId="8642" CreationDate="2013-04-13T12:37:00.950" Score="2" ViewCount="1538" Body="&lt;p&gt;I experiment with the coefficient quantization in an IIR filter. I change some values like the passband ripple and also how many bits i want for the quantization method. In the first picture i have 1db passband ripple , 'round'and 7-bits as the quantization method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8V1k5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second picture i have 1.3db as the passband ripple ,'round' and 6-bits as quantization method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w3TZF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the PZP diagrams. I dont understand how i can extract useful information from the diagrams in order to say which design is better or to make comparisons between these 2 designs.How the Poles and Zeros affect my decision for what is better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: the images becomes bigger and more visible when you copy the url and open or select view image. Also with the green is the quantized and with blue the un-quantized coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit2:As Matt asks for magnitude frequency response I have add the extra information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1db passband ripple , 'round'and 7-bits&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hqE4A.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PED6V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/b0nxq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.3db as the passband ripple ,'round' and 6-bits&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fC3un.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aTbcT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tO8HC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; After the answer from Matt i need to add more information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find a set of quantized coefficients that meet the specification with the minimum number of bits. &#xA; My specification is an 8th-order IIR filter with the following transfer function magnitude response:&#xA;\begin{align*}&#xA; 0\,\mathrm{db} \pm 1.5 \,\mathrm{db} &amp;amp; \quad \text{for } \quad 0.2&amp;lt;|v|&amp;lt;0.3 \cr&#xA; \lt −60\,\mathrm{db} &amp;amp; \quad\text{for } \quad |v|&amp;lt;0.14\text{ and } |v|&amp;gt;0.36&#xA;\end{align*} &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use this matlab function:  $ [b,a]=ellip(n,Rp,Rs,Wp) , $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;after some trials i found that (the filter is implemented using second-order sections) :  $ [b,a]=ellip(4,1,60,2*[0.2,0.3]) $  and using 7-bit quantization i take the diagram above that i think verify the specification (if i make a mistake please correct me) , &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but if a use: $ [b,a]=ellip(4,1.3,60,2*[0.2,0.3]) $ and 6-bit quantization also i take a reasonable result. My concern is if my thought and procedure is correct or i have a mistake and i need to stick with 7-bits quantization?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-04-14T12:48:27.203" LastActivityDate="2013-04-14T15:45:44.693" Title="Pole-Zero Plots Diagram Explanation" Tags="|filters|infinite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8637" PostTypeId="2" ParentId="8635" CreationDate="2013-04-13T14:50:30.093" Score="3" Body="&lt;p&gt;It is indeed hard to compare the two designs just using the pole-zero diagrams. I think it would be much more useful to have a look at the (magnitude of the) frequency responses, and compare the change of the frequency response before and after coefficient quantization. The only thing I can say from looking at the pole-zero plots is that you have designed an eighth order bandpass filter with center frequency $f_s/4$ (by $f_s$ I mean the sampling frequency).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-04-14T15:45:44.693" LastActivityDate="2013-04-14T15:45:44.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8638" PostTypeId="1" AcceptedAnswerId="8640" CreationDate="2013-04-13T16:11:08.597" Score="0" ViewCount="767" Body="&lt;p&gt;I want to implement an IIR filter.  The filter is going to implement by cascading second order sections. Below there are 3 pictures that implement this filter using:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Denominator - Numerator using Tapped Delay Line Structure 2:&lt;/li&gt;&#xA;&lt;li&gt;Numerator -Denominator using Time Delay and Accumulate Structure 3:&lt;/li&gt;&#xA;&lt;li&gt;Denominator - Nominator using Time Delay and Accumulate Structure&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FMBS6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9UVFs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zkiu7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a,b: coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to examine the efficiency of the structure due to dynamic range and ease of implementation. I also want to use only one multiplier in the architecture. I think it is easier to implement the structure with less delayers but what is the dynamic range and how i can find it??&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-04-13T16:40:23.203" LastActivityDate="2013-04-13T18:51:40.283" Title="IIR Filter structure implementation dynamic range" Tags="|filters|infinite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8639" PostTypeId="2" ParentId="8638" CreationDate="2013-04-13T18:09:09.960" Score="3" Body="&lt;p&gt;Please see &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Direct_Form_II.html&quot; rel=&quot;nofollow&quot;&gt;this write-up by Julius O. Smith III on the Direct Form II filter structure.&lt;/a&gt; One issue with &quot;canonical with respect to delay&quot; filter structures is that they can be subject to overflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll need to go through it completely, but I believe structures (1) and (2) in your question will be subject to this possible overflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you implementing this in fixed point arithmetic?  Do you have a known input range?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was a little confused by your diagrams: what I believe you are using for delay elements would normally be gain-only (amplifiers). Delay elements are usually drawn differently.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-13T18:09:09.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8640" PostTypeId="2" ParentId="8638" CreationDate="2013-04-13T18:51:40.283" Score="6" Body="&lt;p&gt;Peter's correct.  at least if fixed-point arithmetic is used.  the DF2 has poles before zeros.  that means the signal is getting boosted by the poles before the zeros (which are often sitting very close to the poles) beat the gain back down to reasonable levels.  so if the signal overflows, saturates, and distorts due to this gain, the attenuation offered by the zeros does not reverse that distortion error.  it's too late.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now the DF1 implements the zeros before the poles, and if you did &lt;em&gt;not&lt;/em&gt; have an accumulator that has a double word width, then the DF1 suffers a sorta opposite flaw.  instead of potentially overflowing (and saturating) due to gain from the poles which is what the DF2 does, the DF1 will have attenuation first (due to the zeros) followed by the compensating gain from the poles.  if the accumulator is no wider than the signal word going in, there is roundoff error due to quantizing the attenuated signal.  then when the poles act on the attenuated and quantized signal, that quantization error is boosted by the poles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;BUT&lt;/em&gt; if your DSP (or whatever processor you use) has an accumulator that is twice the width of the two multiplicands, there is &lt;em&gt;no&lt;/em&gt; roundoff error for the poles to boost.  so the DF1 avoids the overflow problems of the DF2, but if and only if there is a double-wide accumulator, does not suffer from boosting the roundoff error.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-04-13T18:51:40.283" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8641" PostTypeId="1" CreationDate="2013-04-13T22:43:22.077" Score="1" ViewCount="664" Body="&lt;p&gt;I want to detect the regions of voice in a song. Currently, I am using the fact that the vocals in the song are recorded as center panned. So, I am removing all center panned audio from the song. However, this removes other instruments such as bass also. So, it sometimes gives false indication of voice being present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want a way ( better? than this naive approach?) to be able to detect portions of the song where a singer is singing. There is no specific type of music, I'd like an implementation for any type of song. A sample might be &lt;a href=&quot;http://www.youtube.com/watch?v=w_Rut4qm33g&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=w_Rut4qm33g&lt;/a&gt; but I up for any song for which this can be done, even if it has some specific properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current implementation is - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y, fs] = wavread('song.wav');&#xA;&#xA;subplot(2, 1, 1);&#xA;plot(y)&#xA;&#xA;left = y(:,1);&#xA;right = y(:,2);&#xA;yOut(:,1) = (left - right)/2;&#xA;yOut(:,2) = (left - right)/2;&#xA;wavwrite(yOut, fs, 'tmp2.wav');&#xA;&#xA;fftL = fft(left);&#xA;fftR = fft(right);&#xA;&#xA;N = size(fftL)&#xA;N = N(1);&#xA;&#xA;M = size(fftR)&#xA;M = M(1);&#xA;&#xA;N = min(N, M);&#xA;&#xA;&#xA;for i = 1:N&#xA;  dif = fftL(i,1) / fftR(i,1);&#xA;  dif = abs(dif);&#xA;  if (dif &amp;gt; 0.7 &amp;amp;&amp;amp; dif &amp;lt; 1.5)&#xA;    fftL(i,1) = 0;&#xA;    fftR(i,1) = 0;&#xA;  end;&#xA;&#xA;&#xA;end;&#xA;&#xA;leftOut = ifft(fftL);&#xA;rightOut = ifft(fftR);&#xA;yOut(:,1) = leftOut;&#xA;yOut(:,2) = rightOut;&#xA;&#xA;subplot(2, 1, 2);&#xA;plot(yOut)&#xA;&#xA;N = size(yOut);&#xA;N = N(1);&#xA;for i = 6:N&#xA;    yOut(i) = 1/5* (yOut(i-1) + yOut(i-2) + yOut(i-3) + yOut(i-4) + yOut(i-5));&#xA;end&#xA;wavwrite(yOut, fs, 'tmp.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4347" LastEditorUserId="4347" LastEditDate="2013-04-14T18:43:54.420" LastActivityDate="2019-09-08T17:41:38.743" Title="Detection of regions of voice in music" Tags="|filters|audio|music|voice|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8642" PostTypeId="2" ParentId="8635" CreationDate="2013-04-14T10:09:31.923" Score="1" Body="&lt;p&gt;I provide another answer now that I can see the nice magnitude response plots. What we notice is of course a slight change in magnitude response due to coefficient quantization, but it is obviously relatively small. The stopband behavior is no problem at all, the only noticeable change is in the passbands, where there is a slight overshoot close to the band edges. This comes from the poles moving a bit closer to the unit circle after quantization. This overshoot is a bit bigger for the 6-bit design than for the 7-bit design, which doesn't come as a surprise (coarser quantization &amp;lt;=&gt; more movement of the poles from their ideal positions). What is tolerable depends totally on the application. When asking which design is better, it is mandatory to answer the question &quot;better for what?&quot; beforehand. What I would do in any case is normalize the filters such that the maximum of the magnitude response is 1 even after quantization. This will avoid overflow problems (at least the ones due to coefficient quantization). All other measures that you may or may not need will depend on your application.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-14T10:09:31.923" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8643" PostTypeId="1" AcceptedAnswerId="8644" CreationDate="2013-04-14T12:28:01.950" Score="3" ViewCount="154" Body="&lt;p&gt;I have noticed that the spectrogram for a audio signal is often calculated in different ways when the result from the DFT is transformed into real numbers; some tend to compute $|k|$ or $|k|^2$ while others use the formula $Re(k)^2 + Im(k)^2\ \ $ for each DFT bin $k$. What is the theoretic difference between these and what should be considered as the standard (if any)?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastEditorUserId="80" LastEditDate="2013-04-14T13:55:09.127" LastActivityDate="2013-04-14T14:22:16.680" Title="What is the theoretic difference in the ways to compute the spectrogram?" Tags="|audio|discrete-signals|frequency-spectrum|spectrogram|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8644" PostTypeId="2" ParentId="8643" CreationDate="2013-04-14T13:43:52.653" Score="3" Body="&lt;p&gt;Firstly $$abs(z)^{2}=Re \left \{ z \right \}^{2}+Im \left \{z  \right \}^{2}=z*z^{^{'}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are all mathematically identical, so either one will work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That leaves the question of whether the square should be applied or not. In nearly all cases the original signal will represent a &quot;linear&quot; quantity such as voltage, current, force, pressure, particle velocity, volume velocity, etc. The physical power is always related to the square (or more precise the product) of these quantities. So if you are interested in actual physical power (or energy or intensity), then you to need to apply the square. That is indeed to convention for audio signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Geek Mode on]: One caveat is that simply squaring a linear quantity makes an implicit assumption about the impedance which can be misleading. For example, if you measure with a microphone reasonably far away from a loudspeaker the acoustic intensity (at this spot) is indeed proportional to the square of the measured pressure. Close up to the speaker that's not the case any more since particle velocity and pressure are not in phase. [Geek Mode off]&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-04-14T13:43:52.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8645" PostTypeId="2" ParentId="8643" CreationDate="2013-04-14T14:15:40.230" Score="2" Body="&lt;p&gt;To better approximate human perceptual response (see Weber-Fechner law) to the input data in a simplified mathematical formula, often a spectrogram displays the log of the DFT magnitudes.  Thus to square the magnitude or not disappears into the graph scaling or brightness/coloring gain after taking the log().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, no difference at all (disregarding arbitrary scaling).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-04-14T14:22:16.680" LastActivityDate="2013-04-14T14:22:16.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8646" PostTypeId="2" ParentId="8641" CreationDate="2013-04-14T21:05:31.707" Score="1" Body="&lt;p&gt;Warning: this is still an active research topic so there is no &quot;canned&quot; solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you have stated, middle channel suppression is not a very robust method. It can help in getting a very rough &quot;Karaoke&quot; version but you can't infer anything reliable from the resulting audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple approach would consist in extracting a bunch of audio features on each signal frame, and use machine learning techniques (for example support vector machines) to discriminate the &quot;voice present&quot;/&quot;no voice&quot; classes. This works relatively well (reported recognition rates in the literature are in the 70-80% range), but the downside is that you have to manually annotate material to get training data. You might try to use karaoke files (with precise timing of the lyrics) and align them with the audio to get a kind of automatic transcription, but remember that your system will only be as good as your training data. Your training database will have to cover all the possible genres of music on which your classification system will be unleashed. See &lt;a href=&quot;http://iie.fing.edu.uy/publicaciones/2011/Roc11/Roc11.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rocamora's Master's thesis&lt;/a&gt; or &lt;a href=&quot;https://perso.telecom-paristech.fr/grichard/Publications/Icassp08_ramona.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ramona et al's paper&lt;/a&gt;. There are dozens of other papers presenting variations of this scheme - with different feature sets, post-processing/temporal-smoothing operations, etc. Follow the references in the papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't afford to spend countless hours in Transcriber or Wavesurfer annotating data, there are still unsupervised methods that would reasonably work. I recommend you to look into lead melody separation methods such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;REpeating Pattern Extraction Technique (REPET): A&#xA;Simple Method for Music/Voice Separation&quot; (Rafii / Pardo). This is a very simple method which works very well on &quot;commercial&quot; pop music (with a very stereotypical structure and modern computer-based production).&lt;/li&gt;&#xA;&lt;li&gt;&quot;Source/Filter Model for Main Melody Extraction From Polyphonic Audio Signals&quot; (Durrieu et al). Complex algorithm, but the code is available.&lt;/li&gt;&#xA;&lt;li&gt;If you want something really simple, just extract and track the most salient pitch and assume it is the lead melody. This works to some extent in recordings in which the singer voice is well isolated from the mix (other instruments EQ'ed so that they do not overlap much with it).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You don't need to bother here with resynthesis - just use the energy of the extracted spectrum / f0 track.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A last angle of attack is to use a multi-f0 estimator or a sinusoids tracker, and check if one of the tracks has frequency fluctuations typical of vibrato or glissando. In commercial pop music, most instruments have a very stable pitch contour (keyboards, fretted bass and guitars), and the voice is the only instrument with a very wobbly pitch contour - unless it has been doctored by autotune.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="34516" LastEditDate="2019-09-08T17:41:38.743" LastActivityDate="2019-09-08T17:41:38.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8647" PostTypeId="2" ParentId="7644" CreationDate="2013-04-14T22:41:26.357" Score="1" Body="&lt;p&gt;imfill would work with images and not volumes. However Matlab has many basic tools to fill the holes, that is to interpolate missing data points. What you are after is interpolation and Matlab has a function called interp3.&lt;/p&gt;&#xA;" OwnerUserId="4323" LastActivityDate="2013-04-14T22:41:26.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8648" PostTypeId="1" AcceptedAnswerId="8651" CreationDate="2013-04-15T08:06:55.050" Score="3" ViewCount="1530" Body="&lt;p&gt;The optimal binary detector for asymmetric, equiprobable PAM pulse normally have structure as shown below,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qIfr1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I cannot understand what is the multiplier and the integrator using for. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why the detector need to care the signal difference and multiply with the received signal? &lt;/li&gt;&#xA;&lt;li&gt;Why can't I directly put the received signal to the threshold comparsion? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3420" LastEditorUserId="1629" LastEditDate="2016-03-18T16:49:20.247" LastActivityDate="2016-03-18T16:49:20.247" Title="Integrator and the multiplier in the Optimal Binary Detector" Tags="|signal-detection|demodulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8649" PostTypeId="1" CreationDate="2013-04-15T10:31:07.347" Score="0" ViewCount="447" Body="&lt;p&gt;suppose that we have a wave which has some peaks in some indexes like 2,12,25,... and otherwise zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to extract the time lag or lags between peaks of a signal. could anyone help me ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1vRaF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4327" LastEditorUserId="80" LastEditDate="2013-04-17T16:44:40.033" LastActivityDate="2013-08-15T19:06:47.423" Title="Find the time lag for a wave" Tags="|digital-communications|signal-analysis|autocorrelation|cross-correlation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8650" PostTypeId="2" ParentId="6464" CreationDate="2013-04-15T10:53:16.133" Score="3" Body="&lt;p&gt;According to the book &lt;a href=&quot;http://programmingcomputervision.com/&quot; rel=&quot;nofollow&quot;&gt;Programming computer vision with Python&lt;/a&gt; an interesting approach is to use dense SIFT (a.k.a. HoG) features on your images, and feed these features to a classifier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't try it myself, but it seems quite sound as an approach.&#xA;Furthermore, the inventor of the HoG feature proposes the &lt;a href=&quot;https://flutterapp.com/&quot; rel=&quot;nofollow&quot;&gt;Flutter app&lt;/a&gt; that worked quite well in my  tests, and it would be very weird if the inventor didn't use his own features or a close derivative. &lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-04-15T10:53:16.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8651" PostTypeId="2" ParentId="8648" CreationDate="2013-04-15T11:23:04.657" Score="5" Body="&lt;p&gt;There are several things missing/extra in your diagram. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What you are using is &#xA;rectangular PAM pulses of duration $T$ to send data across the channel, and so &#xA;you really don't need the multiplier. It is necessary only if $s_1(t)$ and $s_2(t)$&#xA;are different from rectangular pulses (though they are still of duration $T$, &#xA;and in that case, the input $s_1(t)-s_2(t)$ to the multiplier does not tell &#xA;the whole story. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The integrator that you are using is really what is called an &#xA;&lt;strong&gt;integrate-and-dump&lt;/strong&gt; correlator. The input is &#xA;integrated over &lt;em&gt;intervals&lt;/em&gt; of time $[(n-1)T, nT)$. &lt;em&gt;Just before the end of&#xA;the integration period&lt;/em&gt;, at time $nT^{--}$, the integrator output is &lt;em&gt;sampled&lt;/em&gt;&#xA;and the sample value is what is used in the threshold device. Following&#xA;the sampling at $nT^{--}$, the integrator is &lt;em&gt;dumped&lt;/em&gt; (meaning that &#xA;the output is &lt;em&gt;reset&lt;/em&gt; to $0$) at time $nT^{-}$, and the integrator is&#xA;&lt;em&gt;restarted&lt;/em&gt; at $t = nT$ for the next data bit from $nT$ to $(n+1)T$.&#xA;Note that there is what computer engineers call a &lt;em&gt;critical race&lt;/em&gt; involved:&#xA;the circuit designer has to make absolutely sure that the &lt;em&gt;sample&lt;/em&gt; signal &#xA;arrives at the integrator &lt;em&gt;before&lt;/em&gt; the &lt;em&gt;dump&lt;/em&gt; signal. Getting this wrong&#xA;can be a fireable offense.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With the integrate-and-dump correlator working as described above,&#xA;the input to the multiplier during $[(n-1)T, nT)$ needs to be&#xA;$s_1(t-(n-1)T)-s_2(t-(n-1)T)$, that is, the signal $s_1(t)-s_2(t)$&#xA;(which is nonzero only for $t \in [0,T)$) delayed by $(n-1)T$ seconds.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What the integrate-and-dump correlator is doing is computing the&#xA;output of the &lt;em&gt;matched filter&lt;/em&gt; for signals $s_1(t)$ and $s_2(t)$&#xA;in additive white Gaussian noise at times $nT$.  Note that the&#xA;correlator output is &lt;em&gt;not&lt;/em&gt; equal to the matched filter output&#xA;at times other than $nT$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The reason you cannot simply sample the received signal&#xA;and make a decision from the sample is that the SNR is abysmal.&#xA;Technically, AWGN has infinite variance &#xA;(cf. &lt;a href=&quot;https://dsp.stackexchange.com/q/8629/235&quot;&gt;this question&lt;/a&gt;),&#xA;but even otherwise this is a big problem.  The matched&#xA;filter maximizes the SNR at the sampling instants,&#xA;and the correlator is just calculating what the matched&#xA;filter will give you at the sampling instants.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For details of all this, see, for example, pp. 85-93&#xA;of these &lt;a href=&quot;http://courses.engr.illinois.edu/ece461/spring98/book1/Matched_Filters.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancient lecture notes&lt;/a&gt; of mine.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-04-15T11:23:04.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8652" PostTypeId="1" CreationDate="2013-04-15T12:56:04.847" Score="4" ViewCount="1027" Body="&lt;p&gt;Does anyone knows can i find a FFT of 1536 length input. Its a specification given in 3gpp Lte and we need a transform of 1536 input size which is neither a power of any number i would say. I just need a theoretical idea.&lt;/p&gt;&#xA;" OwnerUserId="3993" LastEditorUserId="4298" LastEditDate="2021-02-09T11:29:47.227" LastActivityDate="2021-02-09T11:29:47.227" Title="FFT of input length 1536" Tags="|fft|fourier-transform|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8653" PostTypeId="2" ParentId="8652" CreationDate="2013-04-15T13:12:21.620" Score="12" Body="&lt;p&gt;Note that $1536 = 3\cdot 512$. You can use a decimation in time method. See &lt;a href=&quot;http://www.altera.com/literature/an/an480.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.altera.com/literature/an/an480.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll add some extra information here in response to your comment to sansuiso's answer (even though this comment actually referred to the pdf file I mentioned above in this answer). As explained in the above document, you need to compute 3 FFTs of length 512. You do this by taking time samples 0,3,6,9, ... and compute their FFT, then you take the samples 1,4,7,10,... and compute another FFT. Finally you compute the FFT of samples 2,5,8,11,... Then you combine the 3 FFTs using the appropriate twiddle factors to obtain the desired 1536-point FFT. This last step is the radix-3 stage. Have a look at Equation (2) on page 3 of the document (also Fig. 1 on page 4).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also check out &lt;a href=&quot;http://mattsdsp.blogspot.nl/2014/11/fft-cooley-tukey-algorithm-for-general.html&quot; rel=&quot;nofollow&quot;&gt;this blog post&lt;/a&gt;. It also includes a little Matlab program.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-08T12:44:54.233" LastActivityDate="2015-01-08T12:44:54.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8654" PostTypeId="2" ParentId="8652" CreationDate="2013-04-15T13:14:28.527" Score="6" Body="&lt;p&gt;You can find a lot of information for very fast FFT with non-power-of-two data on the site of the &lt;a href=&quot;http://fftw.org/links.html&quot;&gt;fftw&lt;/a&gt; library. If you can use GPL software, it's a good library to work with.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-04-15T13:14:28.527" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8655" PostTypeId="2" ParentId="8610" CreationDate="2013-04-15T14:22:05.933" Score="2" Body="&lt;p&gt;The effect you're observing is most certainly due to quantization errors. If your calculation of noise power was wrong you would get an offset between the simulated and the theoretical curve but not an error floor. The fact that it works fine with 32 bit resolution supports that hypothesis. You can analyze the output signal of your VHDL transmitter in order to find out whether it's already corrupted. There are several things I would consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Calculate the BER without channel (back-to-back). It should be zero but from your diagram I guess it will be something around 0.02.&lt;/li&gt;&#xA;&lt;li&gt;Plot the constellation diagram. You should see distinct points not &quot;clouds&quot;.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the signal-to-quantization-noise ratio $\gamma_\mathrm{q}$. Let $a_{\nu k}$ be the complex value of subcarrier $\nu$ in OFDM symbol $k$ after mapping and $b_{\nu k}$ be the respective subcarrier value at the transmitter output (can be obtained by applying FFT to the tx output). Then&#xA;$$&#xA;\gamma_\mathrm{q}=\frac{\sum_{\nu.k}|a_{\nu k}|^2}{\sum_{\nu.k}|b_{\nu k} - a_{\nu k}|^2}&#xA;$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-04-15T14:22:05.933" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8656" PostTypeId="2" ParentId="8610" CreationDate="2013-04-15T16:38:59.520" Score="2" Body="&lt;p&gt;I do not think that your problem is noise quantization.  Your curve shows that the BER levels out somewhere around EbN0 = 4, which means that that is around where the quantization noise equals the intended noise.  That is unbelievable unless your signal power is really, really low. Q11 has 66 dB of dynamic range, so if you are using a significant portion of your dynamic range quantization noise simply should not be a factor at those EbN0's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I suspect is happening is that when you switch from 32 bits to 11 bits that affects all of the processing blocks of your VHDL design via &quot;generic&quot; statements, and so the data bit width throughout your design changes.  I think some piece or pieces of your processing chain are not doing well at the lower bit widths.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-15T16:38:59.520" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8658" PostTypeId="1" CreationDate="2013-04-15T14:16:41.247" Score="3" ViewCount="11423" Body="&lt;p&gt;Long story short, I have a sinusoidal wave with DC offset going in with a given frequency of say 100 Hz and $\phi = 0$ (which I'm guessing is really $\pi/2$ since it is a sine wave not cosine). I get an output of the same frequency and, using FFT, I would like to find the phase between these two. What I did is I found the peak frequencies (-100 and 100 Hz), found their bin and from the same bin I extracted the amplitude and the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that correct?&lt;/p&gt;&#xA;" OwnerDisplayName="Amani Lama" LastEditorUserId="80" LastEditDate="2013-04-15T20:17:33.300" LastActivityDate="2013-04-15T22:51:14.133" Title="Am I understanding the phase angle from FFT correctly?" Tags="|fft|phase|" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8659" PostTypeId="2" ParentId="8658" CreationDate="2013-04-15T15:08:57.407" Score="3" Body="&lt;p&gt;The phase is relative to the start of the sample window, and unless the frequency component corresponds exactly with the center frequency of the relevant FFT bin then you also need to apply a correction.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastActivityDate="2013-04-15T15:08:57.407" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8660" PostTypeId="2" ParentId="8658" CreationDate="2013-04-15T17:51:22.140" Score="3" Body="&lt;p&gt;If you're interested in the time delay between the two signals, it's probably most useful to compute the cross-correlation function of the two signals and find its maximum. The location of the maximum will give you the time lag.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-15T17:51:22.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8661" PostTypeId="1" CreationDate="2013-04-15T18:07:55.870" Score="2" ViewCount="1254" Body="&lt;h2&gt;@Jim Clay: No if the filter varies slowly, then the clicks go away. So I guess the filter needs to vary slowly to avoid audible clicking sounds.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I created a test in matlab where I'm comparing time-domain filtering with frequency-domain filtering. The two operations produce the same output, but I get clicks in the audio when I switch filter parameters periodically. How do I solve that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc&#xA;close all&#xA;clear all&#xA;&#xA;[x,fs] = wavread('audiosignal');&#xA;x = x';&#xA;numberOfFilterTaps = 256;&#xA;NFFT = numberOfFilterTaps * 2;&#xA;z1 = zeros(1,numberOfFilterTaps-1);&#xA;blockSize = 64;&#xA;numberOfSamples = length(x);&#xA;h1 = fir1(numberOfFilterTaps-1, 0.5);&#xA;h2 = fir1(numberOfFilterTaps-1, 0.9);&#xA;blockCounter = 0;&#xA;ola = zeros(1,NFFT);&#xA;enableThis = 1;&#xA;switchCounter = 0;&#xA;&#xA;while 1&#xA;    idx1 = 1 + blockSize * blockCounter;&#xA;    idx2 = blockSize + blockSize * blockCounter;&#xA;&#xA;    if (idx2 &amp;gt; numberOfSamples)&#xA;        break;&#xA;    end&#xA;&#xA;    idx = idx1:idx2;&#xA;&#xA;    sampleBlock = x(idx);&#xA;&#xA;    % Switch filter periodically&#xA;    if (switchCounter == 0)&#xA;        switchCounter = 0;&#xA;        if (enableThis)&#xA;            h = h1;&#xA;            H = fft(h,NFFT);&#xA;            enableThis = 0;&#xA;        else&#xA;            enableThis = 1;&#xA;            h = h2;&#xA;            H = fft(h,NFFT);&#xA;        end&#xA;    end&#xA;    switchCounter = switchCounter +1;&#xA;    if (switchCounter &amp;gt; 60)&#xA;        switchCounter = 0;&#xA;    end&#xA;&#xA;    % Method #1&#xA;    [y1(idx),z1] = filter(h,1,sampleBlock,z1);&#xA;&#xA;    % Method #2&#xA;    tmp = real(ifft(fft(sampleBlock, NFFT) .* H));&#xA;    tmp = tmp + ola;&#xA;    ola = [tmp(blockSize+1:end) zeros(1,blockSize)];&#xA;    y2(idx) = tmp(1:blockSize);&#xA;&#xA;    blockCounter = blockCounter + 1;&#xA;end&#xA;&#xA;wavwrite(y1,fs,'output_y1');&#xA;wavwrite(y2,fs,'output_y2');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4353" LastEditorUserId="4353" LastEditDate="2013-04-16T12:53:39.853" LastActivityDate="2013-04-16T12:53:39.853" Title="Question about overlap-add" Tags="|matlab|audio|speech-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8662" PostTypeId="2" ParentId="7537" CreationDate="2013-04-15T18:45:46.410" Score="2" Body="&lt;p&gt;According to &lt;a href=&quot;http://www.ee.lamar.edu/gleb/dip/10-3%20-%20Morphological%20Image%20Processing.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;, the grayscale dilation of image $I$ by a non-flat structuring element $S$ is defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[I ⊕ S](x,y) = \displaystyle\max_{(s,t)∈S}\{I(x-s,y-t)+S(s,t)\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the origin of the structuring element is in the top right corner, we have that $s∈[0,1]$ and $t∈[-2,0]$ excluding the point $(s,t)=(0,-1)$. So using your example of element $I(0,1)$ we have the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[I ⊕ S](0,1)=\max\{I(0,3)+S(0,-2),\ I(-1,3)+S(1,-2),\ I(-1,2)+S(1,-1),\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ I(0,1)+S(0,0),\ I(-1,1)+S(1,0)\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=\max\{0+0,0+0,0+2,2+0,0+(-1)\}=\max\{0,0,2,2,-1\}=2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the correct value for element $(0,1)$ in the dilated matrix. You can then simply apply the formula to the other $(x,y)$ value pairs of interest to obtain the final result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of erosion (and the other morphological operations) can also be found in that paper and applied in the same manner.&lt;/p&gt;&#xA;" OwnerUserId="4344" LastEditorUserId="4344" LastEditDate="2013-04-25T20:06:12.850" LastActivityDate="2013-04-25T20:06:12.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8663" PostTypeId="2" ParentId="8661" CreationDate="2013-04-15T19:26:03.890" Score="4" Body="&lt;p&gt;The main issue here is that you are implementing a time-variant filter. Both FIR filter and overlap algorithms are only valid if your filter is time-invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need time variant filters, you need to solve two problems: continuity of the state variable and continuity of the output waveform. The easiest way to deal with this is to basically run both filters in parallel and then cross-fade between the outputs at switch time. The time constant of the cross fade determines what audibility you get, so this can be adjusted to the desired level. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-15T19:26:03.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8664" PostTypeId="2" ParentId="8658" CreationDate="2013-04-15T22:43:23.493" Score="2" Body="&lt;p&gt;You method will work for frequencies that are exactly periodic in the FFT width.  For frequencies that are in between bins, I would first do an fftshift (of both FFTs) to position the 0 phase reference at the window center before interpolating phase and doing the phase subtraction.  Otherwise the FFT will flip the phase between alternating FFT result bins making phase interpolation far more non-intuitive.  However the evenness/oddness ratio of a sinusoid about the window center does not flip even for FFT result bins of non-periodic-in-aperture sinusoids, allowing a more intuitive phase comparison (after the fftshifts).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-04-15T22:51:14.133" LastActivityDate="2013-04-15T22:51:14.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8665" PostTypeId="2" ParentId="8319" CreationDate="2013-04-16T01:26:44.763" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Q1. Am I right in thinking that using scipy.signal.bessel with analog=1 and multiplying in the frequency domain will be the most similar to the analog situation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What you get from &lt;code&gt;scipy.signal.bessel&lt;/code&gt; with &lt;code&gt;analog = 1&lt;/code&gt; will be the continuous-time transfer function (assuming you want the &lt;code&gt;ba&lt;/code&gt; version of the output).  You will have to be careful to make sure you're doing the right sort of filtering: just using FFTs to simulate this will probably not work correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm &lt;strong&gt;not&lt;/strong&gt; an expert in &lt;code&gt;python&lt;/code&gt;, but I suspect you want to use &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.freqs.html#scipy.signal.freqs&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;scipy.signal.freqs&lt;/code&gt;&lt;/a&gt; to get the &lt;em&gt;continuous&lt;/em&gt; frequency response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trouble then is: how do you get the &lt;em&gt;continuous&lt;/em&gt; frequency response of your input signal?  Do you now how your analog input signal vector was generated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So reading the scipy manual, I see &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lsim.html#scipy.signal.lsim&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;lsim&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lsim2.html#scipy.signal.lsim2&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;lsim2&lt;/code&gt;&lt;/a&gt; are probably the options you want. It appears to allow you to apply a continuous-time system to data sampled at given sample points.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Q2. ... how [can] I, in python, can make two equivalent simulations, using convolution in one, and converting the input signal to frequency domain in the other&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To do the convolution, you could just use &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.impulse.html#scipy.signal.impulse&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;scipy.signal.impulse&lt;/code&gt;&lt;/a&gt; to get the impulse response of your filter, and then use &lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.signal.convolve.html#scipy.signal.convolve&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;scipy.signal.convolve&lt;/code&gt;&lt;/a&gt; to convolve it with your sampled data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the frequency domain version, you'll again need to understand how your analog input signal vector was generated.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-17T12:12:08.380" LastActivityDate="2013-04-17T12:12:08.380" CommentCount="2" CommunityOwnedDate="2013-04-16T01:26:44.763" ContentLicense="CC BY-SA 3.0" />
  <row Id="8667" PostTypeId="1" CreationDate="2013-04-16T08:57:12.183" Score="1" ViewCount="3467" Body="&lt;p&gt;I am trying to understand and visualize the concept of a covariance matrix. Suppose I have a matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A = \begin{pmatrix} 2 &amp;amp; 3 &amp;amp; 4\\ 5 &amp;amp; 5 &amp;amp; 6 \end{pmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how do I calculate its covariance matrix, and what is its practical meaning? &#xA;(All I was able to understand by now is that on the diagonal of the covariance matrix, variances for particular variables are placed, and on the upper and lower fields are the correlations between those variables.)&lt;/p&gt;&#xA;" OwnerUserId="4168" LastEditorUserId="4344" LastEditDate="2013-07-15T21:19:22.207" LastActivityDate="2013-07-16T12:24:07.437" Title="Covariance matrix explanation" Tags="|matrix|covariance|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8669" PostTypeId="1" AcceptedAnswerId="8670" CreationDate="2013-04-16T12:39:16.250" Score="4" ViewCount="1718" Body="&lt;p&gt;I have a noisy signal with jumps to high value and back to normal for limited time bins (40 for example) which I want to filter to have a smooth signal with no jumps. Here is the &lt;a href=&quot;https://i.stack.imgur.com/l9bKD.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;graph&lt;/a&gt;, the blue one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XbNC8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried moving average filter (n=20), the green one. Also tried window based (kaiser) LPF with cut-off freq=0.01 (I choose it manually) but still the filtered signal follows the jumps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I tried to flatten the signal by using the average of the past n values whenever there is a jump. But how could I find the start of a jump. I need a threshold. Also there is difficulty with determining the end of a jump. I need another threshold. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there any way to filter the signal in a way that it doesn't follow&#xA;the jumps?  &lt;/li&gt;&#xA;&lt;li&gt;Are those jumps and falls caused by low frequencies, since LPF don't eliminate them? So I should use high pass filter? I am confused.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;EDIT: Another &lt;a href=&quot;https://i.stack.imgur.com/XO9Cv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;graph&lt;/a&gt; that shows what I want to eliminate (the gray regions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/stb0s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4358" LastEditorUserId="80" LastEditDate="2013-04-16T13:57:08.020" LastActivityDate="2018-09-24T15:58:41.707" Title="How to filter pulse like jumps in a signal?" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8670" PostTypeId="2" ParentId="8669" CreationDate="2013-04-16T12:53:55.460" Score="9" Body="&lt;p&gt;I think that you will not be able to get acceptable results with linear filtering because the impulse noise covers the whole frequency range. You may want to look into nonlinear filtering techniques. As a first (and simple) approach try median filtering: &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot;&gt;http://en.wikipedia.org/wiki/Median_filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think if you optimize the window size of the median filter you should get better results than with purely linear filtering.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-16T12:53:55.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8671" PostTypeId="1" CreationDate="2013-04-16T14:49:21.907" Score="1" ViewCount="1502" Body="&lt;p&gt;I have already asked this question 2 times, but still i am confused because this is not available anywhere on the internet and explained properly. I found some information in this document and i am going to apply their method , but confused to understand. here is the document &lt;a href=&quot;https://www.intel.com/programmable/technical-pdfs/654012.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Altera Application Note 480: 1536-Point FFT for 3GPP Long Term Evolution&lt;/a&gt;. If anyone have some time to explain me kindly explain me where is radix 2 stage in this document to calculate the fft of size 512 because it has been broken into 3 small sequences of length 512 and then applied the fft on small lengths and then calculated it with combining and multiplying it with twiddle factors respectively. Kindly help me i am stuck in here for more than a week.&lt;/p&gt;&#xA;" OwnerUserId="3993" LastEditorUserId="15347" LastEditDate="2023-02-26T18:19:34.957" LastActivityDate="2023-02-26T20:06:37.253" Title="Solution for FFT size 1536" Tags="|fft|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8672" PostTypeId="2" ParentId="8671" CreationDate="2013-04-16T15:01:37.920" Score="4" Body="&lt;p&gt;Your FFT size is $1536 = 3 \times 512$.  The FFT radixes you need are, therefore, 3 and 2 (or some other power of 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way the FFT works is by decomposing the full length DFT into smaller (prime-number-length), simpler FFTs.  The way you decompose a particular length is by looking at the prime factors of the length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Split-radix_FFT_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;See the wikipedia entry on the &lt;em&gt;Split Radix FFT Algorithm&lt;/em&gt; for more detail.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.freescale.com/files/dsp/doc/app_note/AN3680.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Then see this link, which has this derivation:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/j9Pma.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-16T16:18:33.010" LastActivityDate="2013-04-16T16:18:33.010" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8673" PostTypeId="1" AcceptedAnswerId="8680" CreationDate="2013-04-16T15:20:04.590" Score="6" ViewCount="23294" Body="&lt;p&gt;I have been asking around if the way I was extracting phase shift (lag) was correct, and I ran into some trouble.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in general, given 2 arrays of data of the same length, representing:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the input sinusoid and&lt;/li&gt;&#xA;&lt;li&gt;the response, also a sinusoid. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So not knowing the functions that produced the input (but knowing the frequency, starting phase of the input, fs, and so on), what is the best way to find the phase lag?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;should I do it &quot;manually&quot; by looking at the graphs and finding the phase lag at each component?&lt;/li&gt;&#xA;&lt;li&gt;should I use FFT, like I have been trying?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;any suggestions, links, books are welcome.&lt;/p&gt;&#xA;" OwnerUserId="3723" LastEditorUserId="13320" LastEditDate="2016-11-21T13:04:47.373" LastActivityDate="2016-11-21T13:04:47.373" Title="Best method to extract phase shift between 2 sinosoids, from data provided" Tags="|fft|phase|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8674" PostTypeId="1" CreationDate="2013-04-16T15:23:40.310" Score="3" ViewCount="1374" Body="&lt;p&gt;Hi guys, I've been reading some papers on - how to remove ghosting artefacts from the Fourier Slice theorem applied to a 3D discrete image volume. The papers mention that in order to remove ghosting artefacts &lt;code&gt;&quot;employ a better(and typically wider) interpolation filter&quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, in Matlab I fft a 3D image space volume to Fourier space. I then extract a 2D plane at an arbitrary angle from this 3D frequency domain volume, making sure that my 2D plane passes through the centre of the volume. Since, this 2D plane is at an angle (not all points on the plane correspond to the uniform discrete values in the volume), I the use interpolation on the 3D volume in Fourier space, which I believe uses weighted linear interpolation (8 nearest point average). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do these papers mean when they say - apply an interpolation filter, is this any different from what I am doing? If it is different, should I be multiplying this interpolation filter with the frequency spectrum and if so what does this filter look like? &lt;/p&gt;&#xA;" OwnerUserId="4360" LastEditorUserId="609" LastEditDate="2013-04-17T06:10:28.863" LastActivityDate="2023-04-02T00:19:24.193" Title="Interpolation vs Interpolation Filter?" Tags="|image-processing|filters|fourier-transform|interpolation|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8675" PostTypeId="2" ParentId="8667" CreationDate="2013-04-16T15:28:41.963" Score="3" Body="&lt;p&gt;You can't really have a covariance of a matrix.  What you can have, is a covariance matrix of a set of vectors.  So, if you think of the rows of your matrix &lt;code&gt;A&lt;/code&gt; as two vectors in 3D: &lt;code&gt;[2 3 4]&lt;/code&gt; and &lt;code&gt;[5 5 6]&lt;/code&gt;, then the covariance matrix of this set of two vectors is &lt;code&gt;C = A' * A&lt;/code&gt; (A transpose times A).  Note that if you shuffle the rows of &lt;code&gt;A&lt;/code&gt; in a different order, &lt;code&gt;C&lt;/code&gt; does not change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that you have &lt;code&gt;C&lt;/code&gt;, you understood it correctly.  You can also do interesting things with the eigenvalues and eigenvectors of &lt;code&gt;C&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oops... Totally forgot.  Before you do anything, you have to compute the mean vector (column-wise mean of A) and subtract it from every row.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2013-04-16T17:47:38.943" LastActivityDate="2013-04-16T17:47:38.943" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8676" PostTypeId="2" ParentId="8674" CreationDate="2013-04-16T16:06:17.580" Score="6" Body="&lt;p&gt;Interpolation is the process of adding zeros in between your samples and then low-pass filtering to get rid of the aliases that result.  Linear interpolation is just one out of many different possible filters.  Linear interpolation filters can always be represented by FIR filters.  In one-dimension the interpolation by two linear interpolation filter is $[\frac{1}{2}, 1, \frac{1}{2}]$.  There are better low-pass filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not clear from your quote what they meant by a &quot;wider&quot; filter.  I'm guessing they mean &quot;one with more taps&quot;, but it could also mean &quot;one with a wider passband&quot;.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-04-16T16:26:35.237" LastActivityDate="2013-04-16T16:26:35.237" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8677" PostTypeId="1" AcceptedAnswerId="8703" CreationDate="2013-04-16T16:50:54.733" Score="3" ViewCount="200" Body="&lt;p&gt;I heard that the padding with zeros is mainly for efficiency and speed, other than that, is there a downside to use fft(signal) instead of fft(signal, N) where N is a power of 2 assuming signal length is not a power of 2. &#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="3723" LastActivityDate="2013-04-17T14:08:32.040" Title="Do I get less accurate results if I do not use a power of 2 points for my FFT?" Tags="|fft|" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8678" PostTypeId="1" AcceptedAnswerId="8679" CreationDate="2013-04-16T17:00:00.797" Score="2" ViewCount="141" Body="&lt;p&gt;I have to implement a second order filter in DF1 or DF2. I should avoid housekeeping operations by suitable addressing strategies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand what &quot;housekeeping operations&quot; means. Anyone could help me or propose a source i can find more information?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use DF2 for the second-order filter:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/trrho.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As pichenettes proposes with Housekeeping the code in matlab is something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%x=input sample&#xA;%state=containing old input values&#xA;%compute output value&#xA;y=b(1)*x+state(2)&#xA;&#xA;%Update states&#xA;state(2)=b(2)*x-a(2)*y+state(1)&#xA;state(1)=b(3)*x-a(3)*y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without Housekeeping is going to be like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%compute output value&#xA;y=b(1)*x+state(pointer+1);&#xA;pointer=rem(pointer+1,N-1); %increment pointer in modulo form, N number of taps &#xA;&#xA;%Update states &#xA;state(pointer+1)=b(2)*x-a(2)*y+state(pointer+1);&#xA;pointer=rem(pointer+1,N-1);&#xA;&#xA;&#xA;%Overwrite oldest sum with b(N-1).x&#xA;state(pointer+1)=b(3)*x-a(3)*y;&#xA;pointer=rem(pointer+1,N-1);%Increment pointer modulo-(N-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is that right?Any mistakes?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-04-16T19:04:56.067" LastActivityDate="2013-04-16T19:04:56.067" Title="Housekeeping operations in filters" Tags="|filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8679" PostTypeId="2" ParentId="8678" CreationDate="2013-04-16T17:23:56.827" Score="4" Body="&lt;p&gt;First, maybe you could give us more context (is that homework?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that what is meant by &quot;housekeeping operations&quot; are the data transfers between registers / state variables (&quot;delay propagation&quot;) that naturally arise when naively implementing filters. For example, a naive implementation of a 4-tap FIR would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output = h[0] * input + h[1] * x[0] + h[2] * x[1] + h[3] * x[2]&#xA;// &quot;Housekeeping&quot; operations&#xA;x[2] = x[1]&#xA;x[1] = x[0]&#xA;x[0] = input&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The data transfers operations can be avoided on some hardware architectures (especially DSP) by using modulo addressing. I think this is what is meant by &quot;suitable addressing strategies&quot;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-04-16T17:23:56.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8680" PostTypeId="2" ParentId="8673" CreationDate="2013-04-16T17:51:33.447" Score="10" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross_correlation&quot;&gt;cross-correlation&lt;/a&gt; function to determine the lag between the two signals.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="1355" LastEditDate="2013-04-17T07:27:48.567" LastActivityDate="2013-04-17T07:27:48.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8681" PostTypeId="1" CreationDate="2013-04-16T17:56:28.527" Score="4" ViewCount="2677" Body="&lt;p&gt;I am trying to convert from a floating point number to a Q-notation signed 16-bit fixed point number (e.g. Q15). How can this be done in C or Java? I searched online but could not find any available code.&lt;/p&gt;&#xA;" OwnerUserId="709" LastActivityDate="2013-04-16T19:39:15.977" Title="Converting floating point number to Q-notation fixed point number in C/Java?" Tags="|dsp-core|fixed-point|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8682" PostTypeId="2" ParentId="8673" CreationDate="2013-04-16T17:56:49.520" Score="6" Body="&lt;p&gt;A &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;noreferrer&quot;&gt;cross-correlation&lt;/a&gt; of your signals could be used to determine the phase lag. Cross-correlation basically consists of sliding one function along the time-axis while keeping the other fixed, calculating the integral of their products at each time-shifted position. The integral will be greatest when the signals 'line-up' and the time-shift corresponding to this position can then be used with the signal frequency to calculate the phase-lag ($2\pi f*timeDelay = phaseLag$).&lt;/p&gt;&#xA;" OwnerUserId="4344" LastEditorUserId="4344" LastEditDate="2013-05-01T22:02:22.250" LastActivityDate="2013-05-01T22:02:22.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8684" PostTypeId="2" ParentId="8681" CreationDate="2013-04-16T18:34:10.430" Score="3" Body="&lt;p&gt;If your floating point number is X, then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;X_Q15 = 32768 * X  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if (X_Q15 &gt; 32767)&lt;br&gt;&#xA;    X_Q15 = 32767;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if (X_Q15 &amp;lt; -32768)&lt;br&gt;&#xA;    X_Q15 = -32768;  &lt;/p&gt;&#xA;" OwnerUserId="4353" LastEditorUserId="4290" LastEditDate="2013-04-16T19:39:15.977" LastActivityDate="2013-04-16T19:39:15.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8685" PostTypeId="1" AcceptedAnswerId="8686" CreationDate="2013-04-16T18:48:47.800" Score="37" ViewCount="58586" Body="&lt;p&gt;I'm learning DSP slowly and trying to wrap my head around some terminology:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Question 1&lt;/strong&gt;: Suppose I have the following filter difference equation: &#xA;$$y[n] = 2 x[n] + 4 x[n-2] + 6 x[n-3] + 8 x[n-4]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 4 coefficients on the right-hand side. Are the &quot;number of taps&quot; also 4? Is the &quot;filter order&quot; also 4?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Question 2&lt;/strong&gt;: I am trying to use the MATLAB &lt;code&gt;fir1(n, Wn)&lt;/code&gt; function. If I wanted to create a 10-tap filter, would I set $n=10$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Question 3&lt;/strong&gt;: Suppose I have the following recursive (presumably IIR) filter difference equation:&#xA;$$y[n] + 2 y[n-1] = 2 x[n] + 4 x[n-2] + 6 x[n-3] + 8 x[n-4]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I determine the &quot;number of taps&quot; and the &quot;filter order&quot; since the number of coefficients differ on the left-hand and right-hand sides?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Question 4&lt;/strong&gt;: Are the following logical if-and-only-if statements true?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The filter is recursive $\iff$ The filter is IIR.&lt;/li&gt;&#xA;&lt;li&gt;The filter is nonrecursive $\iff$ The filter is FIR.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="709" LastEditorUserId="4298" LastEditDate="2018-01-07T12:47:47.537" LastActivityDate="2018-03-14T02:27:38.510" Title="Filter order vs number of taps vs number of coefficients" Tags="|filters|filter-design|infinite-impulse-response|finite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8686" PostTypeId="2" ParentId="8685" CreationDate="2013-04-16T19:06:02.147" Score="45" Body="&lt;p&gt;OK, I'll try to answer your questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: the number of taps is not equal the to the filter order. In your example the filter length is 5, i.e. the filter extends over 5 input samples [$x(n), x(n-1), x(n-2), x(n-3), x(n-4)$]. The number of taps is the same as the filter length. In your case you have one tap equal to zero (the coefficient for $x(n-1)$), so you happen to have 4 non-zero taps. Still, the filter length is 5. The order of an FIR filter is filter length minus 1, i.e. the filter order in your example is 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: the $n$ in the Matlab function fir1() is the filter order, i.e. you get a vector with $n+1$ elements as a result (so $n+1$ is your filter length = number of taps).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q3: the filter order is again 4. You can see it from the maximum delay needed to implement your filter. It is indeed a recursive IIR filter. If by number of taps you mean the number of filter coefficients, then for an $n^{th}$ order IIR filter you generally have $2(n+1)$ coefficients, even though in your example several of them are zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q4: this is a slightly tricky one. Let's start with the simple case: a non-recursive filter always has a finite impulse response, i.e. it is a FIR filter. Usually a recursive filter has an infinite impulse response, i.e. it is an IIR filter, but there are degenerate cases where a finite impulse response is implemented using a recursive structure. But the latter case is the exception.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-16T19:06:02.147" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8687" PostTypeId="1" AcceptedAnswerId="8690" CreationDate="2013-04-16T19:52:10.217" Score="5" ViewCount="8369" Body="&lt;p&gt;I have 2 sin waves:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1500;&#xA;N = 100;&#xA;t = (0:N-1)'/Fs;&#xA;&#xA;sinwave = sin(2*pi*15*t);&#xA;sinwaveshifted = sin(2*pi*15*t + 1.3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I get the magnitude at 15Hz using an fft (need to use an FFT that is a power of 2 for reasons beyond my control):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fftsin = fft(sinwave,128);&#xA;fftsinshift = fft(sinwaveshifted,128);&#xA;&#xA;% 2 corresponds to 15Hz &#xA;&#xA;abs(fftsin(2)) = 51.819;&#xA;abs(fftsinshift(2)) = 41.6151;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why the difference?  I'm assuming because my bins do not line up perfectly there is some leakage occurring. Also, I haven't done any windowing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do window my signals (I used a flat top because I read that was best in terms of magnitude accuracy), these are my results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w = window(@flattopwin, 100);&#xA;sinwin = sinwave .* w;&#xA;sinshiftwin = sinwaveshift .* w;&#xA;&#xA;fftsin = fft(sinwin ,128);&#xA;fftsinshift = fft(sinshiftwin ,128);&#xA;&#xA;% 2 corresponds to 15Hz &#xA;&#xA;abs(fftsin(2)) = 2.7283;&#xA;abs(fftsinshift(2)) = 17.822;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why the huge difference?&lt;/p&gt;&#xA;" OwnerUserId="4334" LastActivityDate="2013-04-17T16:36:48.510" Title="Effect of windowing on FFT magnitude" Tags="|fft|matlab|window-functions|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8688" PostTypeId="1" AcceptedAnswerId="8691" CreationDate="2013-04-16T20:16:17.267" Score="8" ViewCount="3424" Body="&lt;p&gt;What is the difference between an impulse and a step response diagram?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2014-04-22T22:40:34.390" LastActivityDate="2014-04-22T22:40:34.390" Title="Impulse vs Step response" Tags="|impulse-response|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8689" PostTypeId="2" ParentId="8687" CreationDate="2013-04-16T20:37:26.447" Score="7" Body="&lt;p&gt;Couple of things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;With an FFT of 128 points your frequency resolution is 11.71 Hz, so you can't really directly look at 15 Hz. Your assertion that $fftsin(2)$ corresponds to 15 Hz is wrong.&lt;/li&gt;&#xA;&lt;li&gt;By doing an FFT of 128 points over a 100 time domain samples, you basically append 28 zeros to the waveform. That changes the spectrum significantly. &lt;/li&gt;&#xA;&lt;li&gt;The window is a lot shorter than a single wavelength so the exact lineup between window and sine wave makes a huge difference. You get a lot more energy if you window around the peak of the sine wave as compared to the zero crossing. The window would work better for a much higher frequency. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-16T20:37:26.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8690" PostTypeId="2" ParentId="8687" CreationDate="2013-04-16T20:48:54.100" Score="12" Body="&lt;p&gt;I presume you are correct in that the small difference in the original signal fft's is due to leakage. However, the huge difference in the windowed results arises because you simply do not have enough data. Your original signals only have data for one period of the sinusoid. When you window this, you are clamping the edges of your signal to zero, effectively leaving you with only the middle portion of the signal. So you are left with signals that have only a fraction of a single period worth of information, definitely not enough to have any accuracy in the extracted frequency analysis. To illustrate this, here are matlab images of your original functions before and after windowing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/24e4w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you can easily see the loss of much of the meaningful frequency information from the signals. A better candidate for windowing would be something like below, using 10 periods of your sinusoid signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TAQCE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which demonstrates the balance between retaining frequency information and clamping the edges to reduce leakage. This &lt;a href=&quot;http://www.physik.uni-wuerzburg.de/~praktiku/Anleitung/Fremde/ANO14.pdf&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; provides a more in depth look at different windowing functions and their performance on different classes of signals if you are interested.&lt;/p&gt;&#xA;" OwnerUserId="4344" LastActivityDate="2013-04-16T20:48:54.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8691" PostTypeId="2" ParentId="8688" CreationDate="2013-04-16T21:23:49.490" Score="6" Body="&lt;p&gt;If the impulse response is $h[n], n\geq 0$, then the step response $s[m]$ at any time $m≥0$ is&#xA;$$s[m]=h[0]+h[1]+h[2]+\cdots +h[m].$$&#xA;Note that if the filter is a &lt;em&gt;finite impulse response&lt;/em&gt; (FIR) filter so that&#xA;$h[m] = 0$ for $m &amp;gt; M$, then the step response at $M$ is&#xA;$$s[M] = h[0]+h[1]+h[2]+\cdots +h[M]$$&#xA;and remains at this value forever afterwards, that is, $s[m]=s[M]$ for all $m \geq M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What other information do you want to get? The transfer function of the filter? That's easy:&#xA;$$H(z)=h[0]+h[1]z^{−1}+h[2]z^{−2}\cdots $$&#xA;which works out to be polynomial of degree $M$ in $z^{-1}$ for a FIR filter.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-04-16T21:23:49.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8692" PostTypeId="1" CreationDate="2013-04-16T23:34:08.670" Score="4" ViewCount="4229" Body="&lt;p&gt;Does anyone have any experience designing wideband IIR Hilbert transform filters with audio applications in mind? I am using the filter for single side band modulation audio effects discussed in this paper :-&lt;a href=&quot;http://www.mikrocontroller.net/attachment/33905/Audio_Hilbert_WAR19.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mikrocontroller.net/attachment/33905/Audio_Hilbert_WAR19.pdf&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to implement the design technique discussed in this paper:- &lt;a href=&quot;http://www.aes.org/e-lib/browse.cfm?elib=15680&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.aes.org/e-lib/browse.cfm?elib=15680&lt;/a&gt; but have not been able to achieve the results in the paper using frequency warping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help on the topic is appreciated; please find MATLAB code below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&#xA;I now achieve better results without warping with some loss in accuracy in the magnitude response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i133.photobucket.com/albums/q59/melinge/untitled.jpg&quot; alt=&quot;warping vs. no warping&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Frequency Warping:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Half band frequencies:-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\omega _{p}= \tan^{-1}\left [ \left ( \frac{\tan \frac{\omega _{1}}{2}}{\tan \frac{\omega _{2}}{2}} \right )^{\frac{1}{2}} \right ]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\omega _{s}= \tan^{-1}\left [ \left ( \frac{\tan \frac{\omega _{2}}{2}}{\tan \frac{\omega _{1}}{2}} \right )^{\frac{1}{2}} \right ]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \text{Where } \omega _{1} \text{ and }\omega _{2} \text{ is the hilbert frequency range}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Warping:-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z^{-1}= \frac{k_{b}+z^{-1}}{1+k_{b}z^{-1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$k_{b} = \frac{\beta -1}{\beta +1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\beta = \left [ \tan \frac{\omega _{1}}{2}\tan \frac{\omega _{2}}{2}  \right ]^{_{\frac{1}{2}}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c_{new} = \frac{-p+k_{b}}{1-pk_{b}} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \text{Where } c_{new} \text{ is the new filter coefficient and } p \text{ is the filter pole} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% IIR Hilbert transformer pair&#xA;%specifacation&#xA;fs = 40000;&#xA;fsinv = 1/fs;&#xA;w1 = 200*fsinv*pi*2;&#xA;w2 = fsinv*15000*pi*2;&#xA;&#xA;% prewarp spec&#xA;wp_hil = 2*atan(sqrt((tan(w1/2))/(tan(w2/2))))&#xA;ws_hil = 2*atan(sqrt((tan(w2/2))/(tan(w1/2))))&#xA;&#xA;% halfband spec&#xA;%wp = (pi/2)-wp_hil; &#xA;A_s = 80;&#xA;&#xA;% Calculate poles for A0(z) and A1(z)&#xA;[alpha_dash] = IIR_Halfband(wp_hil ,ws_hil ,A_s); &#xA;&#xA;% Calculate poles for A0(z^2) and A1(z^2)&#xA;alpha = sort([1j*sqrt(alpha_dash) -1j*sqrt(alpha_dash)]);&#xA;&#xA;% Convert to hilbert transform filter &amp;amp; interlace poles&#xA;var = 0;&#xA;idx_a = 1;&#xA;idx_b = 1;&#xA;A1_p = zeros((length(alpha))/2,1);&#xA;A0_p = zeros((length(alpha))/2,1);&#xA;for idx = length(alpha):-1:1&#xA;    if (var &amp;lt;2)&#xA;        A1_p(idx_b) = 1j*alpha(idx);&#xA;        var = var + 1;&#xA;        idx_b = idx_b +1;&#xA;    else&#xA;        A0_p(idx_a) = 1j*alpha(idx);&#xA;        var = var + 1;&#xA;        idx_a = idx_a +1;&#xA;        var = mod(var,4);&#xA;    end&#xA;end&#xA;A1_p = [0;A1_p]; % additional delay element for imajinary path&#xA;&#xA;% Frequency warping&#xA;A1_p2 = zeros((length(A1_p)),1);&#xA;A0_p2 = zeros((length(A0_p)),1);&#xA;&#xA;beta = sqrt((tan(w1/2))*(tan(w2/2)));&#xA;kb = (beta-1)/(beta+1);&#xA;for idx = 1:length(A1_p2)&#xA;    A1_p2(idx) = (-A1_p(idx)+ kb)/(-A1_p(idx)*kb +1);&#xA;end&#xA;for idx = 1:length(A0_p2)&#xA;    A0_p2(idx) = (-A0_p(idx)+ kb)/(-A0_p(idx)*kb +1);&#xA;end&#xA;&#xA;% generate transfer functions&#xA;sys_i = tf([A1_p2(1) 1],[1 A1_p2(1)],fs,'Variable','z^-1');&#xA;sys_r =1;&#xA;for idx = 1:length(A0_p)&#xA;    sys_i = sys_i*tf([A1_p2(idx+1) 1],[1 A1_p2(idx+1)],fs,'Variable','z^-1');&#xA;    sys_r = sys_r*tf([A0_p2(idx) 1],[1 A0_p2(idx)],fs,'Variable','z^-1');&#xA;end&#xA;&#xA;% plot filter atributes&#xA;%fvtool(cell2mat(sys_r.num),cell2mat(sys_r.den))&#xA;%fvtool(cell2mat(sys_i.num),cell2mat(sys_i.den))&#xA;&#xA;% phase difference&#xA;[phi,w] = phasez(cell2mat(sys_r.num),cell2mat(sys_r.den)) ;&#xA;[phi2,w] = phasez(cell2mat(sys_i.num),cell2mat(sys_i.den)) ;&#xA;plot(w/(2*pi),180*((phi-phi2)/pi))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Half-band filter design function based on Program 13_9 in Digital Signal Processing: A Computer-Based Approach 3ed &lt;a href=&quot;http://highered.mcgraw-hill.com/sites/0072865466/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://highered.mcgraw-hill.com/sites/0072865466/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% IIR Lowpass Half-band Filter Design&#xA;function[alpha] = IIR_Halfband(wp,ws,A_s) &#xA;% Enter filter stopband specifications&#xA;&#xA;%ws = pi - wp;&#xA;delta_s = 10^(-(A_s/20));&#xA;% Order estimation&#xA;r = tan(0.5*wp)/tan(0.5*ws);&#xA;r_hat = sqrt(1-(r^2));&#xA;q0 = 0.5*(1-sqrt(r_hat))/(1+sqrt(r_hat));&#xA;q = q0+2*(q0^5)+15*(q0^9)+150*(q0^13);&#xA;D = ((1-(delta_s^2))/(delta_s^2))^2;&#xA;N = ceil((log10(16*D))/(log10(1/q)))&#xA;if (mod(N,2) == 0)&#xA;    N = N+1&#xA;end;&#xA;% Readjusting ripple size&#xA;D = (1/16)*(10^(N*log10(1/q)));&#xA;delta_s = sqrt(1/(1+sqrt(D)));&#xA;% Computing filter coefficients&#xA;alpha = zeros(length((N-1)/2),1);&#xA;for k = 1:(N-1)/2,&#xA;    sum1 = 0;sum2 = 0;&#xA;    for i = 0:6,&#xA;        sum1 = sum1+((-1)^i)*(q^(i*(i+1)))*sin((2*i+1)*k*pi/N);&#xA;        if (i ~= 0)&#xA;        sum2 = sum2+((-1)^i)*(q^(i^2))*cos(2*pi*k*i/N);&#xA;        end;&#xA;    end;&#xA;    lambda(k) = (2*q^(0.25)*sum1)/(1+2*sum2);&#xA;    b(k) = sqrt((1-r*(lambda(k)^2))*(1-(lambda(k)^2)/r));&#xA;    c(k) = (2*b(k))/(1+(lambda(k)^2));&#xA;    alpha(k) = (2-c(k))/(2+c(k));&#xA;end;&#xA;alpha = sort(alpha);&#xA;end  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3296" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.913" LastActivityDate="2023-01-30T09:44:27.783" Title="Hilbert transform filter for audio applications: Using IIR half-band parallel all pass structure" Tags="|filters|audio|infinite-impulse-response|hilbert-transform|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8693" PostTypeId="1" AcceptedAnswerId="8694" CreationDate="2013-04-17T08:28:40.743" Score="9" ViewCount="31003" Body="&lt;p&gt;I have been working on a simple low pass filter for &amp;lt; 100 Hz metering in my application. But so far, I am struggling with the theory behind it all. It's cool that I got it working, but I'd really enjoy it if I knew how/why it is working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void getLPCoefficientsButterworth2Pole(const int samplerate, const double cutoff, double* const ax, double* const by)&#xA;{&#xA;    double PI = M_PI;&#xA;    double sqrt2 = sqrt(2);&#xA;&#xA;    double QcRaw  = (2 * PI * cutoff) / samplerate; // Find cutoff frequency in [0..PI]&#xA;    double QcWarp = tan(QcRaw); // Warp cutoff frequency&#xA;&#xA;    double gain = 1 / ( 1 + sqrt2 / QcWarp + 2 / ( QcWarp * QcWarp ) );&#xA;&#xA;    by[2] = ( 1 - sqrt2 / QcWarp + 2 / ( QcWarp * QcWarp ) ) * gain;&#xA;    by[1] = ( 2 - 2 * 2 / ( QcWarp * QcWarp ) ) * gain;&#xA;    by[0] = 1;&#xA;&#xA;    ax[0] = 1 * gain;&#xA;    ax[1] = 2 * gain;&#xA;    ax[2] = 1 * gain;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To calculate the Coefficients. Then, in the audio samples, I 'low pass' them this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        xv[2] = xv[1];&#xA;        xv[1] = xv[0];&#xA;&#xA;        xv[0] = pData[j];&#xA;        yv[2] = yv[1];&#xA;        yv[1] = yv[0];&#xA;&#xA;        yv[0] = (ax[0] * xv[0] + ax[1] * xv[1] + ax[2] * xv[2]&#xA;                   - by[1] * yv[0]&#xA;                   - by[2] * yv[1]);&#xA;&#xA;        pData[j] = yv[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get a lowpass design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering a few things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I receive the audio samples in a simple float* array. What is that float number? The only thing I see is a number, how is that a piece of sound?&lt;/li&gt;&#xA;&lt;li&gt;The code is using past calculations (three of them) in the new calculation per sample. Does that mean that the first 2 data samples are not filtered correctly? (not that it would matter because it's just 2 samples, but just wondering)&lt;/li&gt;&#xA;&lt;li&gt;Trying to learn everything, I found a couple of formulas for the Butterworth (2nd Pole) filter. How are those formulas reflected in this code? None of the formulas I found have these calculations that you can see in the 'getLPCoefficientsButterworth2Pole()' function.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4238" LastActivityDate="2014-05-20T07:03:51.187" Title="How does a low-pass filter programmatically work?" Tags="|lowpass-filter|c|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8694" PostTypeId="2" ParentId="8693" CreationDate="2013-04-17T09:03:38.077" Score="6" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The number float* array is a pointer to the array. It is a single number which contains the address of the first element of the array of float values.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Usually, the initial condition (i.e. the initial 'past' elements of x and y) are 0, but if their values are not equal to 0 it is no big problem either, because after a while the initial conditions have no effect on the output signal for any stable filter. And your filter is obviously stable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A second order lowpass transfer function with Butterworth characteristic and cut-off frequency $\omega_a=2*\pi*f_a$ (with $f_a$ in Hertz) is given by&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$H(s) = \frac{\omega_a^2}{s^2+\sqrt{2}\omega_a s + \omega_a^2}\tag{1}$$&#xA;This is a standard result which you can easily find on the web. In order to get a discrete-time filter you can apply a so-called bilinear transformation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s = 2f_s\frac{z-1}{z+1}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sampling frequency.&#xA;This is necessary because the frequency axis of the analog signals ($0\le  f\le\infty$) needs to be mapped to the allowed frequency range for discrete-time signals ($0\le f\le f_s/2$). Since this transformation warps the frequencies, we need to compute the desired analog cut-off frequency from the given cut-off frequency $f_d$ in the discrete-time domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_a = 2f_s \tan(\frac{\omega_d}{2})\text{ with }\omega_d = 2\pi f_d/f_s$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you insert (2) into (1) you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = k\frac{z^2+b_1z+b_2}{z^2+a_1z+a_2}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$k=\frac{\alpha^2}{1+\sqrt{2}\alpha+\alpha^2}\text{ (gain)}$$&#xA;$$a_1 = \frac{2(\alpha^2-1)}{1+\sqrt{2}\alpha+\alpha^2},\quad&#xA;a_2=\frac{1-\sqrt{2}\alpha+\alpha^2}{1+\sqrt{2}\alpha+\alpha^2},\quad&#xA;b_1=2,\quad b_2=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I've used $\alpha=\tan(\frac{\omega_d}{2})$.&#xA;The transfer function (3) corresponds to the time domain equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) = kx(n) + kb_1x(n-1) + kb_2x(n-2) - a_1y(n-1) - a_2y(n-2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there's quite some resemblance with your code. However, there are some differences too and you should check the frequency response of your filter. I think that the above equations are correct, but it's up to you to check them and decide which version is the correct one.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-04-17T12:30:43.917" LastActivityDate="2013-04-17T12:30:43.917" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8695" PostTypeId="2" ParentId="8693" CreationDate="2013-04-17T10:24:14.780" Score="1" Body="&lt;p&gt;It depends on how you want it. For me I have implemented in &lt;code&gt;C&lt;/code&gt;. So, What i did was that I generated filter coefficients in &lt;code&gt;matlab&lt;/code&gt; using &lt;code&gt;firls&lt;/code&gt;. Then I stored that filter coefficients in an array and then pass these filter coefficients to the filter function in &lt;code&gt;C&lt;/code&gt;. In &lt;code&gt;matlab&lt;/code&gt; it is quite easy to generated the filter coefficients, and then use the convolution operation or use a specific filter. But in &lt;code&gt;C&lt;/code&gt; you have to implement the filter as well. For my part I have to do it for DSPs, so implemented in &lt;code&gt;C&lt;/code&gt; and got the results in &lt;code&gt;matlab&lt;/code&gt; using mex function. To calculate the coefficients use this command in &lt;code&gt;matlab&lt;/code&gt; :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=17                  %filter order&#xA;f=[0 0.167 0.333 1]   %Frequency band edges&#xA;a=[1 1 0 0]           %Desired amplitudes&#xA;fir= firls (n, f,a )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3993" LastEditorUserId="80" LastEditDate="2013-04-17T11:36:44.803" LastActivityDate="2013-04-17T11:36:44.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8696" PostTypeId="1" AcceptedAnswerId="8698" CreationDate="2013-04-17T11:48:28.730" Score="5" ViewCount="792" Body="&lt;p&gt;I am trying to bandpass filter a signal using a butterworth filter, but I am getting the following result (click to enlarge): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zgyuj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zgyuj.png&quot; alt=&quot;signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original signal is the blue and the filtered one is the green.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does the first part of the filtered signal (from 0 to 50) is changing so much from the original? Can you help me understand why this is happening?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here goes some details:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Signal length: 256&lt;/li&gt;&#xA;&lt;li&gt;Frequency: 22Hz&lt;/li&gt;&#xA;&lt;li&gt;Cutoff frequencies: 0.7Hz and 3.0Hz&lt;/li&gt;&#xA;&lt;li&gt;Filter order: 6&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Python code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nyq = 0.5 * fs&#xA;low = lowcut / nyq&#xA;high = highcut / nyq&#xA;b, a = butter(order, [low, high], btype='band')&#xA;y = lfilter(b, a, data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4364" LastEditorDisplayName="user11906" LastEditDate="2015-05-14T01:08:37.633" LastActivityDate="2015-05-14T01:08:37.633" Title="Help designing Butterworth filter" Tags="|filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8698" PostTypeId="2" ParentId="8696" CreationDate="2013-04-17T12:19:33.937" Score="4" Body="&lt;p&gt;The first part of the response may be a result of the transient response of the Butterworth filter.  Also note that the signal is phase shifted and the basic shape is altered.  This looks like the result of phase distortion.  You may want to try again using a Bessel filter which has better transient and phase characteristics.  If you are using DSP, you can also try a true linear phase FIR approach.  This will yield the best transient and phase characteristics.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-04-17T12:19:33.937" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8699" PostTypeId="2" ParentId="8685" CreationDate="2013-04-17T12:20:30.690" Score="3" Body="&lt;ul&gt;&#xA;&lt;li&gt;Question 1: The number of taps = number of coefficient s = Length of&#xA;filter in case of FIR filter. The order of the filter is equal to&#xA;Length of filter-1.&lt;/li&gt;&#xA;&lt;li&gt;Question 2: $n$ should be set to 9 if you are using FIR filter.&lt;/li&gt;&#xA;&lt;li&gt;Question 3: This is an IIR filter since you have a feed back in it.&#xA;Try to convert back the equation to z-transform and and express it as&#xA;a transfer function such as $$Y(z) / X(z) = H(z)$$ and then you can see&#xA;what you are asking or may be read more for IIR filters to determine&#xA;their order.&lt;/li&gt;&#xA;&lt;li&gt;Question 4: FIR Filter is direct means it has no feedback, but for&#xA;IIR filter you would have a feed back. I would suggest you to use FIR&#xA;filters because they have a linear phase. On the other hand IIR&#xA;filter computations are less for the same size of FIR filter, as IIR&#xA;filter has less number of coefficients, but IIR filter doesn't have&#xA;linear phase. So, its a trade off you can say.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3993" LastEditorUserId="17089" LastEditDate="2018-03-14T02:27:38.510" LastActivityDate="2018-03-14T02:27:38.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8700" PostTypeId="2" ParentId="8677" CreationDate="2013-04-17T12:34:27.120" Score="2" Body="&lt;p&gt;Well I guess I can give a suitable answer for this question because i am working on a task in LTE 3ggp in which I have to calculate the FFT of 1536 which is not a power of 2. If your input length is a power of 2 it means you can easily use radix2 fft algorithm to compute the dft. But if your length is not a multiple of any number directly like in my case its 1536 you can't use one algorithm, you have to split it and used several algorithms and yeah it may increase the computational cost. You have to look for it in detail. I would recommend you to go this document and have a look if you are really interested because its quite time consuming to understand and more cumbersome to program in C.&#xA;&lt;a href=&quot;http://www.freescale.com/files/dsp/doc/app_note/AN3680.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.freescale.com/files/dsp/doc/app_note/AN3680.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3993" LastEditorUserId="3993" LastEditDate="2013-04-17T12:43:53.220" LastActivityDate="2013-04-17T12:43:53.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8701" PostTypeId="2" ParentId="8693" CreationDate="2013-04-17T12:34:49.587" Score="12" Body="&lt;p&gt;You asked how a low pass filter works and mentioned that the filter uses past values of you're data.  This is a non-technical discussion of what happens in a low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The low pass filter takes differing views (shifted in time) of your signal, scales them and adds them together.  You can imagine drawing your signal 3 times, one being current, the second being shifted by one sample time, the third being shifted by 2 sample times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At low frequencies, all the views look very similar (shifting by a single sample barely changes where you are on the signal at any instant in time).  In this case, the three versions will add together in a constructive (or at least non destructive) way, so the signal passes through the filter.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now moving to higher frequencies, each shifted version of the signal becomes more distinct at any given instant (sample point) and in fact may even reverse in sign.  At these higher frequencies, the three versions of your signal tend to cancel out (added destructively) so the signal becomes attenuated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Different types of filters arrange for this kind of constructive/destructive interference to take place over appropriate frequency bands to create low-pass, band-pass or high-pass filters.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="29" LastEditDate="2013-04-18T13:25:13.543" LastActivityDate="2013-04-18T13:25:13.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8702" PostTypeId="2" ParentId="8692" CreationDate="2013-04-17T13:11:23.273" Score="1" Body="&lt;p&gt;This is a hard problem for a variety of reasons:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly the ideal Hilbert Transformer is infinitely non causal, which is a fancy way of saying that the impulse response starts at $t = -\infty $. That's of course impossible to implement so some sort of an approximation is required. You need to find out over what frequency range and to what precision you need the approximation. For example for audio you could say &quot;40Hz-16 kHz, phase = 90deg +- 1 deg, level = +- 0.1 dB&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your IIR filter is causal by definition. In order to have any chance on matching the Hilbert transformer needs to be cascaded with a pre-delay, i.e. your target will need to be ideal Hilbert transformer cascaded with some bulk delay. The bulk delay will have to be applied to all parallel paths in your system as well and it will add to the overall latency. If you need a high precision Hilbert Transformer with very low latency, you are out of luck: Can't be done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick &amp;amp; dirty way to determine the required pre-delay is to take a VERY long FIR version of the ideal HT and start truncating or windowing and determine at what window length you can meet the actual requirement. Then retry your IIR fit with a target of Hilbert + bulk delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW: the reason what you see trouble at lower frequencies means that your pre-delay (if you have) is too short. The ideal Hilbert transformer requires an infinitely sharp transition of the phase from 0deg at DC to 90 deg at anthing above DC. That's off course impossible so there must be some sort of finite transition at low frequencies.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-17T13:11:23.273" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8703" PostTypeId="2" ParentId="8677" CreationDate="2013-04-17T14:08:32.040" Score="5" Body="&lt;p&gt;Assuming a proper implementation, and discarding the small rounding differences that you'll get just by doing a different sequence of operations, no, there's no substantive drop in accuracy if you slightly pad your DFT length to the next power of 2. Whether it ends up actually being any faster is dependent upon your implementation, however. Why is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a very common misconception that there is a &lt;em&gt;single&lt;/em&gt; Fast Fourier Transform algorithm and that you must use a power-of-2 size for best performance. If you look for a description of an FFT algorithm, you'll often see the radix-2 decimation-in-time or decimation-in-frequency techniques explained, likely because they're the easiest to illustrate. However, even the seminal FFT technique, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm#General_factorizations&quot; rel=&quot;noreferrer&quot;&gt;Cooley-Tukey algorithm&lt;/a&gt;, generically factorizes the FFT size into smaller numbers, not just powers of 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a good FFT library, you'll get the best performance if your FFT size can be factored into a number of small prime factors. The FFT library will then have optimized implementations of DFT kernels for each of these primes, which can then be recombined appropriately to yield the full set of DFT outputs. As I alluded to in a comment on another question, modern libraries will often give good performance for all prime factors ~13 and below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, you may find that by padding up to the next power of 2, it's possible that your transform might become &lt;em&gt;slower&lt;/em&gt;. If you're already using an FFT size that your library implementation is well-suited for, you're just adding extra work for yourself by padding the size out. The best way to judge this is to benchmark a few candidate sizes and see which does best on your platform. If you have to make an automated choice of a good FFT size, then based on the characteristics of the radixes that your library supports, you can choose the next size that has an appropriate set of prime factors.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-04-17T14:08:32.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8704" PostTypeId="2" ParentId="8649" CreationDate="2013-04-17T16:22:56.803" Score="1" Body="&lt;p&gt;The time lag is equal to the index difference times the sample period.  The sample period is:&#xA;$$&#xA;T_s = \frac{1}{f_s} = \frac{1}{16000} = 62.5\mu s&#xA;$$&#xA;Thus, the time lag from the first peak to the second is $(12 - 2) * T_s = 625\mu s$.  The time lag from the second peak to the third is $(25 - 12) * T_s = 812.5\mu s$.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-17T16:22:56.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8705" PostTypeId="2" ParentId="8687" CreationDate="2013-04-17T16:36:48.510" Score="6" Body="&lt;p&gt;Windowing in the time domain is a convolution in the frequency domain.  A window function will thus, in the frequency domain, convolve a single spectral frequency point with a spreading function.  For very low frequencies, this window spreading function can spread an FFT frequency bin and its corresponding negative frequency bin right across DC so that the 2 frequencies (positive and negative) interfere or even partially cancel each other out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amount of cancellation between the positive and negative bins will depend on the phase of the sinusoid with respect to the FFT aperture center.  Even, cosine or real components will add.  Odd, sine or imaginary components will cancel.  (Because real time domain input produces complex conjugate symmetry in the FFT result).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus windowing should not be used (or used very carefully, taking into account phase) for measuring the magnitude of frequencies very near DC (around the first FFT result bin or two), or very near Fs/2.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-04-17T16:36:48.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8706" PostTypeId="2" ParentId="8696" CreationDate="2013-04-17T18:42:47.413" Score="3" Body="&lt;p&gt;Just in case you wonder why the filtered signal is shifted down: by bandpass filtering you remove the (relatively strong) DC component of the signal. So the filter signal has a DC value of 0.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-17T18:42:47.413" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8707" PostTypeId="2" ParentId="3284" CreationDate="2013-04-17T18:48:09.610" Score="0" Body="&lt;p&gt;Have a look at &lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/fdesign.arbgrpdelay.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fdesign.arbgrpdelay&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example there is: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Create an arbitrary group delay filter that delays the higher–frequency wave packet by approximately 100 samples.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And they give the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 18;&#xA;f = 0:.1:1;&#xA;gd = ones(size(f));&#xA;% Delay pi/2 radians/sample by 100 samples&#xA;gd(6) = 100;&#xA;d = fdesign.arbgrpdelay(N,f,gd);&#xA;Hd = design(d,'iirlpnorm','MaxPoleRadius',0.9);&#xA;% Visualize the group delay&#xA;fvtool(Hd,'analysis','grpdelay');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-17T18:48:09.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8708" PostTypeId="2" ParentId="1933" CreationDate="2013-04-17T19:09:29.610" Score="3" Body="&lt;p&gt;I know this is old, but I thought I would add something here.  You can smoothly blend the part the filtered and unfiltered segments with a gradual function such as a sinusoidal window function.  That will make this a little more agnostic to the type of input function since it will retain the original, unprocessed function at the boundaries yet leave less visually unsavory artifacts where the original and processed segments join.  In this particular case, it will result in a perfect match assuming you keep the processed signal at 0 during the boundary transient.  You would need to start blending in the processed signal &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You window two segments:&#xA;Y) A segment of data you have processed&#xA;X) The segment you wish to leave unprocessed with the inverse of the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output = window*X + (1.0-window)*Y&#xA;One possible window function could be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;window =&lt;br&gt;&#xA; 0.0  for 0 &amp;lt; n &amp;lt; M&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.5 + 0.5*cos(pi*(n-M)/N)   for  M &amp;lt;= n &amp;lt; (M+N)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.0     for   (M+N) &amp;lt;= n &amp;lt; S&lt;/p&gt;&#xA;&#xA;&lt;p&gt;S = Size of entire Data Set&lt;/p&gt;&#xA;&#xA;&lt;p&gt;M = Length of transient (size if filter kernel)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N = Number of samples over which you want to blend X and Y (raise from 0 to 1.0)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;n = 0 ... S&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way it will smoothly transition the two functions.  This is not necessarily better than just rectangular windowing and appending the two together as has been suggested.  This could be considered equivalent of the above considering N--&gt;0.  Thinking of it that way, &quot;N&quot; is the blending factor.  The larger N, the more gradual the transition form X to Y.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This principle is used by Paul Nasca in the ZynAddSubFX synthesizer filter routine to reduce aliasing due to rapidly changing filter coefficients.  Two chunks of audio are processed through filters with two different cutoff frequencies where the second filter must allow the boundary transient to decay before it can be made audible.  By gradually blending the audio chunks from first filter (steady state) with the second filter, the  transient due to the discontinuous filter coefficients change will be masked by the initial steady state filter until the transient has settled.  This is performed over a long enough audio block to minimize the &quot;zipper&quot; noise that you would hear if it were to be stair-stepped (short blending period).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't consider this application to be very much different from the audio processing example I used.&lt;/p&gt;&#xA;" OwnerUserId="4365" LastActivityDate="2013-04-17T19:09:29.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8709" PostTypeId="2" ParentId="8674" CreationDate="2013-04-17T20:03:26.373" Score="3" Body="&lt;p&gt;Interpolation and interpolation filters are almost synonyms. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Interpolation is the process of generating additional data points that lie between original sample points. &lt;/li&gt;&#xA;&lt;li&gt;An interpolation filter performs the interpolation operation. Adding &lt;em&gt;filter&lt;/em&gt; in the name puts an emphasis on the fact that you adopt a Signal Processing point of view and that you take great care of not introducing high frequency artifacts.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-04-17T20:03:26.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8710" PostTypeId="1" AcceptedAnswerId="8724" CreationDate="2013-04-17T20:38:16.037" Score="8" ViewCount="10036" Body="&lt;p&gt;I have two plots, each having frequency as x-axis and Gain as y-axis. By taking one data set as a reference I have to calculate similarity between them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The graphs have same values on the x-axis and have same range on the x axis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can 2D Correlation or Co-variance can do a decent job ? or&#xA;should I opt for Fréchet distance or DWT as I have read in some other posts ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first plot is the reference plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the plots:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sI0ZS.jpg&quot; alt=&quot;Reference figure&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qPuX9.jpg&quot; alt=&quot;Figure 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help!&lt;/p&gt;&#xA;" OwnerUserId="4271" LastEditorUserId="4271" LastEditDate="2013-04-18T13:56:21.173" LastActivityDate="2021-06-06T05:19:55.650" Title="Calculating similarity between two signal plots" Tags="|correlation|waveform-similarity|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8711" PostTypeId="2" ParentId="8710" CreationDate="2013-04-17T21:16:11.830" Score="0" Body="&lt;p&gt;What's wrong with just normal 1D correlation?  That's what it finds - the similarity between two signals (&lt;code&gt;plots&lt;/code&gt;), at a range of offsets.&lt;/p&gt;&#xA;&lt;p&gt;The other answer to your question is :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What exactly do you mean by 'similarity'?  Because that will define how you calculate it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1496" LastEditorUserId="7092" LastEditDate="2021-06-06T05:19:55.650" LastActivityDate="2021-06-06T05:19:55.650" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8712" PostTypeId="2" ParentId="8710" CreationDate="2013-04-17T21:25:39.583" Score="3" Body="&lt;p&gt;I would use correlation for simple and small data. If your data is large though, I would think about using feature extraction via ICA or PCA analysis, and then compare the features via correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with correlation is scale.&#xA;Look at the image in the URL below:&lt;br&gt;&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/File%3aCorrelation_examples2.svg&quot; rel=&quot;nofollow&quot;&gt;Correlation examples&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;80% is pretty similar in my imagination, but in correlation it really isn't that similar. So, if I were you I would define my own scale of similarity, situated closer to 95-100% on the correlation scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I agree with lxop, in that a correlation between 2 1D signals is enough, given of course that each successive sample index corresponds to the same X-value (frequency) in both signals.&lt;/p&gt;&#xA;" OwnerUserId="3831" LastActivityDate="2013-04-17T21:25:39.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8713" PostTypeId="1" CreationDate="2013-04-18T06:42:14.743" Score="1" ViewCount="181" Body="&lt;p&gt;I have a discrete signal. I want to do sinusoidal regression to estimate the parameters such as amplitude, phase, frequency, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important to note I only have the signal values and have no time when these values were recorded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I possibly do the sine regression?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="415" LastEditorUserId="47251" LastEditDate="2020-02-16T20:23:42.950" LastActivityDate="2020-02-16T20:48:17.200" Title="doing sine regression to recover the paramters from a given signal" Tags="|discrete-signals|signal-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8715" PostTypeId="1" CreationDate="2013-04-18T09:24:08.693" Score="10" ViewCount="13628" Body="&lt;pre&gt;&lt;code&gt;INPUT&#xA;x[0] = (0.00 + j 0.00)&#xA;x[1] = (1.00 + j 0.00)&#xA;x[2] = (2.00 + j 0.00)&#xA;x[3] = (3.00 + j 0.00)&#xA;x[4] = (4.00 + j 0.00)&#xA;x[5] = (5.00 + j 0.00)&#xA;x[6] = (6.00 + j 0.00)&#xA;x[7] = (7.00 + j 0.00)&#xA;x[8] = (8.00 + j 0.00)&#xA;x[9] = (9.00 + j 0.00)&#xA;x[10] = (0.00 + j 0.00)&#xA;x[11] = (0.00 + j 0.00)&#xA;x[12] = (0.00 + j 0.00)&#xA;x[13] = (0.00 + j 0.00)&#xA;x[14] = (0.00 + j 0.00)&#xA;x[15] = (0.00 + j 0.00)&#xA;&#xA;FFT:&#xA;X[0] = (45.00 + j 0.00)&#xA;X[1] = (-25.45 + j 16.67)&#xA;X[2] = (10.36 + j -3.29)&#xA;X[3] = (-9.06 + j -2.33)&#xA;X[4] = (4.00 + j 5.00)&#xA;X[5] = (-1.28 + j -5.64)&#xA;X[6] = (-2.36 + j 4.71)&#xA;X[7] = (3.80 + j -2.65)&#xA;X[8] = (-5.00 + j 0.00)&#xA;X[9] = (3.80 + j 2.65)&#xA;X[10] = (-2.36 + j -4.71)&#xA;X[11] = (-1.28 + j 5.64)&#xA;X[12] = (4.00 + j -5.00)&#xA;X[13] = (-9.06 + j 2.33)&#xA;X[14] = (10.36 + j 3.29)&#xA;X[15] = (-25.45 + j -16.67)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From the above FFT out put I noticed the following: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Re(x[1])=Re(x[15]),  Im(x[1])=-Im(x[15])&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Re(x[2])=Re(x[14]),  Im(x[2])=-Im(x[14])&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Re(x[3])=Re(x[13]),  Im(x[3])=-Im(x[13])&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Re(x[4])=Re(x[12]),  Im(x[4])=-Im(x[12])&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and so on&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a proven result that &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Re(X[n])=Re(x[N-n]), and Im(X[n])=-Im(x[N-n])  for 0&amp;lt;n&amp;lt;N-1, where N is no. of DFT points?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If yes then is there any particular condition under which this is true ? What is the gerenralised result?   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is a general rule then I can save alot in memory and arithmatics as I am concerned only in magnitudes of the DFT output, and not in phase.  &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2013-04-18T10:34:57.367" Title="Symmetry of real and imaginary parts in FFT" Tags="|fft|dft|" AnswerCount="1" CommentCount="0" ClosedDate="2013-05-04T22:12:35.333" ContentLicense="CC BY-SA 3.0" />
  <row Id="8716" PostTypeId="2" ParentId="8715" CreationDate="2013-04-18T09:50:10.643" Score="17" Body="&lt;p&gt;Yes, this is always true if the input to the DFT is &lt;em&gt;real valued&lt;/em&gt;. It's called the &quot;conjugate complex symmetry&quot;, because&#xA;$$&#xA;X_{N-n} = {X_n}^*&#xA;$$&#xA;where $X_n$ is the DFT output and $()^*$ denotes the conjugate. It can be proven by inserting the property into the transformation formula of time domain sequence $x_k$:&#xA;$$&#xA;X_n = \sum_{k=0}^{N-1}x_ke^{-j\frac{2\pi k n}{N}}\\&#xA;X_{N-n} = \sum_{k=0}^{N-1}x_ke^{-j\frac{2\pi k (N-n)}{N}}\\&#xA;=\sum_{k=0}^{N-1}x_k e^{-j 2\pi k}e^{j\frac{2\pi k n}{N}}&#xA;$$&#xA;Using $exp(-j2\pi k) = 1 \:\: \forall \: k$ we find&#xA;$$&#xA;X_{N-n} = \sum_{k=0}^{N-1}x_k e^{j\frac{2\pi k n}{N}}&#xA;$$&#xA;Now we exploit that $x_k$ is real for all $k$ to rewrite the above:&#xA;$$&#xA;X_{N-n} = \sum_{k=0}^{N-1}\left(x_k e^{-j\frac{2\pi k n}{N}}\right)^* = X_n^*&#xA;$$&#xA;It's now straightforward to show that the same is valid for the IDFT. (real spectrum -&gt; complex conjugate symmetric time domain sequence). Moreover, the opposite statement is also true: if the input to the DFT (IDFT) is complex conjugate symmetric its output is real valued.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-04-18T10:34:57.367" LastActivityDate="2013-04-18T10:34:57.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8717" PostTypeId="1" AcceptedAnswerId="8719" CreationDate="2013-04-18T10:14:47.530" Score="1" ViewCount="87" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ykJRT.jpg&quot; alt=&quot;Eye Background - Sample image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an image like the one above, and what I need to find are the red circled areas. They are caused by how the nerve layer is in the eye, and I have no idea what method to use to extract them. (I am looking for a brighter background from the nerve layer)&#xA;I have found all the blood vessels, so I can ignore those area easily. But I don't have any concept of how to begin the search for these areas. Note that the bright spots on the right top side (lets say 12 o clock / 1 o clock from the image center) are not caused by the nerve layer, but from being in a young persons eye.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me to a method to extract these areas? Note that the areas could also be non-existant, or be formed like a cross, or like an hourglass. &lt;/p&gt;&#xA;" OwnerUserId="1269" LastActivityDate="2013-04-18T13:11:24.783" Title="Extract feature area from image" Tags="|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8718" PostTypeId="1" AcceptedAnswerId="8720" CreationDate="2013-04-18T10:39:00.023" Score="0" ViewCount="451" Body="&lt;p&gt;The periodic square wave,&#xA;$$x(t) = 1, |t| &amp;lt; T_1 \\&#xA;x(t) = 0, T_1 &amp;lt; |t| &amp;lt; T/2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I wonder is ..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) If $T_1$ is constant and $T \to \infty$, is x(t) a constant function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) If $T_1$ is constant and $T \to 0$, is this non-sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) If $T$ is constant and $T_1 \to 2/T$, is x(t) a constant function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4) If $T$ is constant and $T_1 \to 0$, is x(t) a impulse function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, I am a undergraduate and it is my first class about signal. I don't know impulse function correctly. Could you explain impulse function in terms of (4) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above questions are my intutitions. I don't know answers.&lt;/p&gt;&#xA;" OwnerUserId="4367" LastActivityDate="2013-04-18T10:51:20.630" Title="In a periodic square wave, how to change in a particular condition?" Tags="|continuous-signals|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8719" PostTypeId="2" ParentId="8717" CreationDate="2013-04-18T10:44:21.503" Score="2" Body="&lt;p&gt;It is going to be a tough task, and you may not achieve an automated process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some bricks that you could try:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Enhance the contrast of the image so that you can clearly distinguish all the features by looking at the image. &lt;a href=&quot;http://www.ipol.im/pub/pre/84/&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a link to an algorithm that shows good results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In this enhanced image, extract the edges (using for example a standard Canny-Deriche edge detector).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;From the edge detector output, you can start adding the required application logic in order to keep the desired vessels: size or length criteria, linear features extraction, etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="80" LastEditDate="2013-04-18T13:11:24.783" LastActivityDate="2013-04-18T13:11:24.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8720" PostTypeId="2" ParentId="8718" CreationDate="2013-04-18T10:51:20.630" Score="2" Body="&lt;p&gt;If $T_1$ remains constant and $T\rightarrow\infty$ then you get a single square pulse of length $2T_1$. There won't be another square pulse because the period is infinite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T_1$ constant and $T\rightarrow 0$ is indeed nonsensical because the definition of the signal assumes $T_1 &amp;lt; T/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $T$ is constant, you can get a constant function if $T_1=T/2$ (and not $2/T$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $T$ is constant and $T_1\rightarrow 0$ your function becomes 0. You will only get an impulse if you keep the area under the rectangle constant, i.e. if its height increases as its width decreases.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-18T10:51:20.630" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8721" PostTypeId="1" CreationDate="2013-04-18T11:47:19.090" Score="11" ViewCount="3414" Body="&lt;p&gt;I have been trying to implement an algorithm for successfully counting cars in an image. I have tried implementing &lt;a href=&quot;http://ieeexplore.ieee.org/iel5/6979/4298892/04298908.pdf?arnumber=4298908&quot; rel=&quot;noreferrer&quot;&gt;A Method for Vehicle Count in the Presence of&#xA;Multiple-Vehicle Occlusions in Traffic Images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It estimates the background from a set of various images. I have looked into various other techniques for this purpose and all of these in one way or the other use either background estimation from a set of images or require a video. I have as an input, traffic images where the background (probably road in most of the papers) is hardly visible. Moreover, the images are from different areas so they don't have common backgrounds as well. How should I proceed in that case ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking that if somehow I can match the structure of vehicles (car) then probably they can be matched. But I don't know if this is feasible and if it is how to proceed since the image contains multiple occluded vehicles as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints or even research papers are also welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sample image is as follows:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/R1A9R.jpg&quot; alt=&quot;Traffic Sample Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gL0iE.jpg&quot; alt=&quot;Traffic Sample Image 2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1115" LastEditorUserId="1115" LastEditDate="2013-04-19T05:27:45.987" LastActivityDate="2022-05-16T15:59:05.570" Title="Counting vechicles in an image" Tags="|image-processing|matlab|computer-vision|image-segmentation|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8722" PostTypeId="1" AcceptedAnswerId="8723" CreationDate="2013-04-18T13:18:02.860" Score="2" ViewCount="3496" Body="&lt;p&gt;I need to transform this function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = 4\sin(20\pi t ) - 5\cos(24\pi t ) + 3\sin(120\pi t )&#xA;$$ &#xA;into a sequence $x(n)$ given that the sampling frequency should be 50 Hz. So that means the sampling interval $T = \frac{1}{50} = 0.02\ s\ $. So would the sequence be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = 4\sin(20\pi0.02n ) - 5\cos(24\pi 0.02n ) + 3\sin(120\pi 0.02n)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I dont know how to compare the CTFT of $x(t)$ and the DTFT of $x(n)$. Any idea ?      &lt;/p&gt;&#xA;" OwnerUserId="4370" LastEditorUserId="90" LastEditDate="2013-04-18T13:28:37.663" LastActivityDate="2013-04-18T13:32:03.757" Title="Relation between CTFT and DTFT" Tags="|sampling|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8723" PostTypeId="2" ParentId="8722" CreationDate="2013-04-18T13:32:03.757" Score="1" Body="&lt;p&gt;Your sequence simply is a sampled version of the continuous signal $x(t)$. So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_d(n)=x(nT),\quad T=\frac{1}{50}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relation between the CTFT of $x(t)$ and the DTFT of $x_d(n)$ is that the DTFT is the sum of shifted versions of the CTFT. The spectra are shifted by the sampling frequency. That's the reason for aliasing.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-18T13:32:03.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8724" PostTypeId="2" ParentId="8710" CreationDate="2013-04-18T14:55:50.523" Score="6" Body="&lt;p&gt;Why not just use something like the relative &quot;error&quot; between the two?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your frequency magnitude responses are $G_1$ and $G_2$, then calculate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;ERR = \sum \left | G_1(n) - G_2(n) \right|^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then normalize with respect to the reference, $G_1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;NORMALIZED = \sum \left | G_1(n) - G_2(n) \right|^2 /  \sum \left | G_1(n) \right|^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlation is also a way to go, but it might show some cases where the same shape happens, but at very different frequencies... which might not be what you want.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-18T14:55:50.523" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8725" PostTypeId="2" ParentId="8713" CreationDate="2013-04-18T17:53:19.943" Score="3" Body="&lt;p&gt;If your samples are equidistant you can use a model function like&#xA;$$\hat{x}(n)=a\sin(bn+c)+d$$ where $n$ is your sample index. You can compute the parameters $a,b,c,d$ by setting up an overdetermined nonlinear system of equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x(n)$ be your signal. Then you'll have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a\sin(b\cdot 0 + c) + d = x(0)\\&#xA;a\sin(b\cdot 1 + c) + d = x(1)\\&#xA;a\sin(b\cdot 2 + c) + d = x(2)\\\vdots&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Of course, the equalities are only approximate equalities.) You can use a nonlinear method such as the Newton method to solve this nonlinear overdetermined system. The only problem is that you need a sufficiently good initial solution. Try to find a simple initial guess by inspection (if your data looks at all like a sinusoid ...). For $a$ and $d$ you could simply use&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_0 = \max(|x(n)|),\quad d_0 = \frac{1}{N}\sum_{n=0}^{N-1}x(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as initial guess ($N$ is the number of data points).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-18T17:53:19.943" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8728" PostTypeId="1" CreationDate="2013-04-19T00:19:47.287" Score="1" ViewCount="74" Body="&lt;p&gt;I am working on the implementation of a location recognition pipeline as detailed in the section 5.4 of the paper &lt;a href=&quot;http://link.springer.com/article/10.1007/s11263-011-0458-7&quot; rel=&quot;nofollow&quot;&gt;Leveraging 3D City Models for Rotation Invariant Place-of-Interest Recognition&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Vocabulary tree + Inverted File System + SIFT detector/descriptors (discarding features not lying on a building using geometric models) + RANSAC for estimating an affine model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand most of the elements there but they don't detail much on which types of geometric models are they using, nor what to discard, features from the database of images or from the query image, and neither how are they applying them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking on something like RANSAC for estimation of an homography but is only an assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is which geometric models would you suggest me to use in this case (urban environment images of common city landmarks)?&lt;/p&gt;&#xA;" OwnerUserId="4373" LastActivityDate="2013-04-19T00:19:47.287" Title="Geometric models to discard image features" Tags="|image-processing|computer-vision|sift|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8729" PostTypeId="1" CreationDate="2013-04-19T06:12:51.173" Score="1" ViewCount="54" Body="&lt;p&gt;I have a bunch of short axis MRI images of the heart(Left Ventricle), in dicom format.&#xA;I want to do a Automatic segmentation of various structures in these images.&#xA;Does anyone know of a program I could use? (a C# would be fine also)&#xA;I basically just need a program which allows me to select a couple of&#xA;points on the images and then automatically saves the coordinates of those&#xA;points in a file.&#xA;Any help would be most appreciated.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4318" LastActivityDate="2013-04-19T06:12:51.173" Title="Automatic MRI Segmenation of Heart over Dicom Image" Tags="|image-processing|image-segmentation|" AnswerCount="0" CommentCount="1" ClosedDate="2013-05-04T22:14:09.857" ContentLicense="CC BY-SA 3.0" />
  <row Id="8730" PostTypeId="1" CreationDate="2013-04-19T07:42:56.583" Score="9" ViewCount="1106" Body="&lt;p&gt;I am currently trying to count cars using OpenCV 2.4.4 with a HOG descriptor. Because a model for car detection is not available in OpenCV, I am creating my own model using SVMLight and a dataset of cars from the INRIA car dataset here (positive and negative samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created the model using the positive and negative samples with SVMLight (I resized the images to 128 * 104 because a HOG image must be power of 2), by following this tutorial and code. I applied the model to my program, and it detected cars correctly, but also with lot of false positives (3- 8 false positives per image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read in Dalal paper about the HOG Detector, and I found out that the model needs to be retrained using false positives found by applying the preliminary model on the negative samples. The resulting patches came in varying sizes, so again, I resized it to 128*104 px.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I reran the HOG training program using positive and negative samples like the preliminary run, but this time, I added the false positives on the negative samples (this is what I think of retraining based on the paper by Dalal). Then I have the retrained model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I ran the car detection program using the new model, but all images returned with no car detection although I used positive sample images and other images with a car in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is very interesting and I am curious if any of you can point out what have I done wrong. &lt;/p&gt;&#xA;" OwnerUserId="4377" LastEditorUserId="76" LastEditDate="2013-11-24T15:56:18.067" LastActivityDate="2013-11-24T15:56:18.067" Title="Help in Retraining a HOG Descriptor using SVMLight" Tags="|computer-vision|opencv|detection|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8732" PostTypeId="1" AcceptedAnswerId="8746" CreationDate="2013-04-19T11:17:33.707" Score="5" ViewCount="9746" Body="&lt;p&gt;What is the definition of Generalized Cross Correlation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need it for estimating the delay (time offset) between two audio signals. The time offset between the two signals might be as large as 500ms.&lt;/p&gt;&#xA;" OwnerUserId="4353" LastActivityDate="2014-01-09T03:03:41.353" Title="Generalized Cross Correlation" Tags="|matlab|audio|signal-analysis|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8733" PostTypeId="2" ParentId="8732" CreationDate="2013-04-19T11:27:38.973" Score="2" Body="&lt;p&gt;I'm not sure what the &quot;generalized&quot; exactly refers to. But to calculate the time offset between two (discrete time) audio signals $r(n)$ and $s(n)$ I would use the following cross correlation function:&#xA;$$&#xA;R(m) = \sum_{n=0}^{N-1}r(n)s^*(n-m)&#xA;$$&#xA;Here, $()^*$ denotes the conjugate complex and $N$ is the length of the audio signals assuming they have the same length. The position of the maximum of $R(m)$ is expected to be the time offset.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-04-19T11:27:38.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8734" PostTypeId="2" ParentId="8732" CreationDate="2013-04-19T11:30:30.147" Score="6" Body="&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;  The OP mentions below Deve's answer that this was not the &quot;Generalized Cross Correlation&quot; algorithm referred to.  The real one seems to be &lt;a href=&quot;http://www.xavieranguera.com/phdthesis/node92.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ywd5j.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;ftp://ftp.esat.kuleuven.be/pub/SISTA/ida/reports/12-133.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; seems to give equations about how to implement it in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation they give is basically what &lt;a href=&quot;https://dsp.stackexchange.com/a/8733/80&quot;&gt;Deve reports below&lt;/a&gt;. The key point they make is that the &quot;input&quot; to the cross-correlation is not the bare signals, but the residuals of an LMS algorithm applied to the bare signals.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This as the effect of pre-whitening the input signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WSqnz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The method seems to be from this paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=1164314&amp;amp;isnumber=26183&quot; rel=&quot;nofollow noreferrer&quot;&gt;Azaria, M.; Hertz, D., &quot;Time delay estimation by generalized cross correlation methods,&quot; Acoustics, Speech and Signal Processing, IEEE Transactions on , vol.32, no.2, pp.280,285, Apr 1984&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;doi: 10.1109/TASSP.1984.1164314&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Abstract:&lt;/em&gt;&lt;/strong&gt; The problem of estimating time delay by cross correlation methods is reexamined for the whole class of stationary signals. Expressions are derived for the estimation mean square error (MSE) by the cross correlation method, and are shown to be identical to previously published results for Gaussian signals. The generalized cross correlation method is also analyzed, and the optimal weight function for this method is derived. It is shown to be identical to that derived for Gaussian signals by the maximum likelihood method. For the cross correlation method a simplified MSE expression is derived, which is to be used instead of a previously published result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;keywords:&lt;/strong&gt; {Autocorrelation;Bandwidth;Correlation;Delay effects;Delay estimation;Error analysis;Estimation error;Maximum likelihood estimation;Mean square error methods;Signal to noise ratio}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From which the key formula appears to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2GHRV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uccNw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-04-19T18:59:03.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8735" PostTypeId="1" CreationDate="2013-04-19T12:04:40.790" Score="1" ViewCount="6693" Body="&lt;p&gt;I have seen that in OFDM, the sampling rate is much lesser than twice the bandwidth of signal. why is it so? How is sampling rate calculated in OFDM? Does it depend on the modulation type used inside like QAM or BPSK. Does it relate to FFT length by any chance.&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="80" LastEditDate="2013-04-19T19:00:22.620" LastActivityDate="2013-04-19T20:25:23.653" Title="Determining sampling rate in OFDM demodulation" Tags="|fft|sampling|digital-communications|ofdm|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8736" PostTypeId="1" AcceptedAnswerId="8906" CreationDate="2013-04-19T12:10:10.687" Score="2" ViewCount="691" Body="&lt;p&gt;I am trying to read OFDM synchronization paper by &lt;a href=&quot;http://home.mit.bme.hu/~kollar/papers/Schmidl2.pdf&quot; rel=&quot;nofollow&quot;&gt;Schmidl and Cox&lt;/a&gt;. The math is slightly overwhelming. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the formula that they use in implementation that distinguishes between coarse estimation and fine estimation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly once fine frequency offset is done, how do you determine that you need to do coarse frequency synchronization or not?  What is it that you will check to determine it? If anybody could explain with a set of equations that would  be very helpful. &lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="80" LastEditDate="2013-04-20T18:04:26.163" LastActivityDate="2013-04-29T14:43:25.463" Title="OFDM coarse freq estimation" Tags="|frequency-spectrum|digital-communications|ofdm|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8737" PostTypeId="1" CreationDate="2013-04-19T12:58:23.983" Score="5" ViewCount="4156" Body="&lt;p&gt;I'm looking for an algorithm which can accurately estimate the time-offset/delay between two audio signals in real-time. One audio signal is a loudspeaker signal and the other signal is the microphone signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Audio is processed in blocks of 10ms (sample frequency 16kHz).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is light office noise embedded in the signals&lt;/li&gt;&#xA;&lt;li&gt;The algorithm must be able to estimate delays up to 500ms.&lt;/li&gt;&#xA;&lt;li&gt;The delay is usually constant for a period of time (with some variability -10ms to 10ms), but occasionally the delay &quot;jumps&quot;. Those sudden jumps can be in the order of 50 to 80 ms. The algorithm must be able to handle that.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've read that GCC PHAT is one algorithm which can be used, but I'm not sure how it would work in a real-time environment.&lt;/p&gt;&#xA;" OwnerUserId="4353" LastActivityDate="2013-04-19T13:48:56.703" Title="Estimating the time offset (delay) between two audio signals in real-time" Tags="|matlab|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8738" PostTypeId="2" ParentId="8735" CreationDate="2013-04-19T13:09:14.977" Score="3" Body="&lt;p&gt;It is incorrect to say that the sample rate is &quot;much less&quot; than the bandwidth of the signal.  It is true to say that it is a &quot;little less&quot;.  Even that statement is only true for part of the demodulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Demodulators almost always use a sample rate that is higher than the bandwidth for two reasons: to ensure that all of the signal is captured rather than aliased due to Nyquist frequency limitations, and to do some version of early/late gating when syncing with the symbols.  It is very common to sample at twice the symbol rate because that is very convenient for capturing the symbols and doing early/late gating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OFDM is different because of the FFTs/IFFTs built into the signal.  There is no advantage for the demodulator to do the FFT at higher than the symbol rate, so they don't.  The roll-off in OFDM is very minimal (an example of typical OFDM roll-off is shown below), though, so the sample rate is not much less than the bandwidth.  In some schemes, like 802.11a, the outer frequency bins are not used which reduces the bandwidth of the signal relative to the sample rate, meaning that the sample rate will be higher than the bandwidth even when taking into consideration the signal roll-off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w0hsP.gif&quot; alt=&quot;OFDM Bandwidth&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, before the demodulator does the FFT it has to eliminate as much carrier offset as it can.  This is typically done at a sample rate that is higher than the bandwidth for the same Nyquist reasons as a typical demodulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I see that I forgot to answer some of your questions.  The sample rate for OFDM is exactly equal to the sample rate that the OFDM transmitter used when it inverse FFT'ed the data.  No, the sample rate has nothing to do with the modulation types used inside the OFDM symbols (e.g. BPSK or QPSK).  No, the sample rate has nothing to do with the FFT length.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-04-19T20:25:23.653" LastActivityDate="2013-04-19T20:25:23.653" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8739" PostTypeId="2" ParentId="8737" CreationDate="2013-04-19T13:19:10.907" Score="5" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;noreferrer&quot;&gt;Cross correlation&lt;/a&gt; is what you want.  If the two signals are similar then the cross correlation should produce a large peak.  The location of the peak would tell you what the sample offset is, and the sample offset together with the sample frequency tells you the time delay between the two.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-19T13:19:10.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8740" PostTypeId="2" ParentId="8737" CreationDate="2013-04-19T13:48:56.703" Score="6" Body="&lt;p&gt;There are a variety of techniques available. See &lt;a href=&quot;http://www.control.isy.liu.se/research/reports/LicentiateThesis/Lic1061.pdf&quot; rel=&quot;noreferrer&quot;&gt;this thesis&lt;/a&gt; for a nice write-up.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the list of algorithms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dYnFR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, note that they recommend &lt;a href=&quot;https://sites.google.com/site/kootsoop/prewhitening&quot; rel=&quot;noreferrer&quot;&gt;pre-whitening&lt;/a&gt; the signals before correlation --- to ensure that the cross-correlation has a nice, narrow peak for better &quot;localization&quot;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-19T13:48:56.703" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8742" PostTypeId="1" CreationDate="2013-04-19T17:20:42.293" Score="4" ViewCount="3007" Body="&lt;p&gt;I want to convert the two's complement, 16-bit output from an ADC into a generic fixed-point format, $\rm Qm.n$, where $\rm m$ is the number of integer bits and $\rm n$ is the number of fraction bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints/procedure to do this job would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="4383" LastEditorUserId="1629" LastEditDate="2016-05-23T18:31:15.223" LastActivityDate="2017-07-10T06:18:43.610" Title="Converting ADC output to fixed-point format" Tags="|fixed-point|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8744" PostTypeId="2" ParentId="8742" CreationDate="2013-04-19T18:01:40.530" Score="14" Body="&lt;p&gt;You don't have anything to do, because $\rm Qm.n$ is just an &quot;interpretation&quot; of an integer. The only thing that really matters is that you need to correctly apply a shift operation when multiplying numbers; or when adding/subtracting numbers with different values of $\rm (m, n)$ - You can think of the $\rm Qm.n$ representation as a &quot;tag&quot; you attach to number, a bit like physical units.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the output of your ADC is an integer between $-32768$ and $32767$. This number can be interpreted as a $\rm Q15$ fixed-point number between $-1.0$ and $0.99997$. Or as a $\rm Q2.14$ fixed-point number between $-4.0$ and $3.99987$. Or as a $\rm Q8.8$ number between $-256.0$ and $255.992$. You don't have to do any arithmetic operation.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="1629" LastEditDate="2016-05-23T18:34:50.520" LastActivityDate="2016-05-23T18:34:50.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8745" PostTypeId="2" ParentId="8671" CreationDate="2013-04-19T20:40:55.897" Score="6" Body="&lt;p&gt;It's hard to see what could be added to Peter K.'s answer to make it any clearer. Here is a snippet of MATLAB code that shows the whole process in all it's glory. Just copy and paste in MATLAB or octave and you can step through it one line at a time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% 1536 FFT based on three FFTs of 512 each&#xA;n = 1536; &#xA;% Create a piece of noise&#xA;x = randn(n,1);&#xA;% calculate FFT using MATLAB native fft() function. &#xA;% We'll use this as a reference to prove it works&#xA;fx = fft(x);&#xA;% Break down into three signals of 512 points each &#xA;p = x(1:3:end);&#xA;q = x(2:3:end);&#xA;r = x(3:3:end);&#xA;% FFT each of those. This is  a 512 power-of-two standard FFT&#xA;fp = fft(p);&#xA;fq = fft(q);&#xA;fr = fft(r);&#xA;% Do three times periodic extention (just repeat it three times)&#xA;fp3 = [fp; fp; fp];&#xA;fq3 = [fq; fq; fq];&#xA;fr3 = [fr; fr; fr];&#xA;% calculate the 1536 twiddle factors&#xA;k3 = (0:n-1)';&#xA;W3 = exp(-j*2*pi*k3/n);&#xA;% assemble the result&#xA;fy3 = fp3 + W3.*fq3 + W3.^2.*fr3;&#xA;% calculate the error&#xA;ferror = fy3-fx;&#xA;fprintf('Error = %6.2f dB\n',10*log10(sum(ferror.*conj(ferror))./sum(fx.*conj(fx))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-19T20:40:55.897" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8746" PostTypeId="2" ParentId="8732" CreationDate="2013-04-20T05:16:56.600" Score="6" Body="&lt;p&gt;Cross-correlation implies that you have 2 signals, and there is a delay between them.  A 'basic' frequency domain cross-correlator does an FFT on each signal, conjugates one of them, multiplies one versus the other, then inverse transforms.  A peak in the result indicates a time delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a lot of problems with this simple approach.  For instance: you want a linear cross-correlation instead of a circular one; you may have strong sinusoidal interference which will generates multiple peaks; you may have very low SNR; the noise may not be what you expect it to be, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 'generalized' cross-correlation adds a windowing (or filtering) function prior to the inverse transform.  It's purpose is to improve the estimation of the time delay, depending on the specific characteristics of the signals and noise (broadband/narrowband/interference signals, Gaussian noise, etc.).  Since there are many different types of signals and noise, there are many different window functions (eg.: SCOT, Ekhart, etc.)  Each one is designed for specific problems.  Understanding these differences is not trivial, nor is proper calculation of the window function.  They are typically dealt with in graduate-level time delay estimation or sonar/radar courses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some references for generalized cross-correlation are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J. C. Hassab, R. E. Boucher, “Optimum Estimation of Time Delay by a Generalized&#xA;Correlator,” IEEE T-ASSP, vol. 27, no. 4, Aug. 1979, pp. 373-380 (discusses various window types).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J. C. Hassab, R. E. Boucher, “Performance of the Generalized Cross Correlator in the&#xA;Presence of a Strong Spectral Peak in the Signal,” IEEE T-ASSP, vol. 29, no. 3, June 1981, pp. 549-555.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J. C. Hassab, R. E. Boucher, “An Experimental Comparison of Optimum and Sub-Optimum&#xA;Filters’ Effectiveness in the Generalized Correlator,” J. Sound and Vibration, 1981, pp. 4+ (12 pages total)(Fig. 1 contains a block diagram of a generalized cross-correlator).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many others.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2013-04-20T05:16:56.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8747" PostTypeId="2" ParentId="1868" CreationDate="2013-04-20T14:09:46.960" Score="3" Body="&lt;p&gt;Another way is to find a separable approximation $x \otimes y \otimes z$&#xA;to your kernel $A$, and see how close it is.&#xA;Two ways of doing this, i.e. to minimize&#xA;$|A - x \otimes y \otimes z|$:&lt;br&gt;&#xA;1) brute-force optimize $x\ y\ z$; this takes time ~ the sum, not the product, of their lengths&lt;br&gt;&#xA;2) for fixed $y$ and $z$, the optimal $x$ is just a projection, so optimize&#xA;$x\ y\ z\ x\ y\ z\ ...$ in turn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(From &lt;a href=&quot;https://math.stackexchange.com/questions/210565/approximate-a-convolution-as-a-sum-of-separable-convolutions&quot;&gt;approximate-a-convolution-as-a-sum-of-separable-convolutions&lt;/a&gt; &#xA; on math.stackexchange.)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-04-26T10:45:08.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8749" PostTypeId="1" AcceptedAnswerId="8751" CreationDate="2013-04-20T15:56:53.757" Score="0" ViewCount="1986" Body="&lt;p&gt;I use the below matlab function to design the unquantised coefficient set:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[b,a]=ellip (4,2,60,2*[0.2,0.3]);&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and then i use the matlab finction &quot;tf2sos&quot; to convert the direct form coefficients to a set of a factorized second-order sections:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[sos,g]=tf2sos(b,a);&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My result is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tzOGs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The normalized version of the difference equation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bAZnp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How i can find the b and the c1,c2,...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the actual result in this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Aear1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or factorized means normalized and the result is in this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MaZ32.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gain plays any special role?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-04-20T16:02:56.433" LastActivityDate="2013-04-20T19:18:18.637" Title="How to find the normalized coefficients?" Tags="|filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8750" PostTypeId="2" ParentId="8736" CreationDate="2013-04-20T18:27:45.167" Score="3" Body="&lt;p&gt;The key part of the paper seems to be section IV.  There, they estimate the frequency offset by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DcTpQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $P(d)$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WJE1B.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then $\widehat{\Delta f}$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KArA7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $|\hat{\phi}| &amp;lt; \pi$, or a correction is added:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hc2Gd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;otherwise.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-20T18:27:45.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8751" PostTypeId="2" ParentId="8749" CreationDate="2013-04-20T19:18:18.637" Score="2" Body="&lt;p&gt;I'm not sure how you define your normalized difference equation, but in any case you can equate the $b_{ij}$ coefficents in the sos matrix with your $c$ coefficients, and the gain that tf2sos returns would then be your normalization constant $b$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you already know, but just to be clear: every row of the sos matrix contains the coefficients for one second-order section, starting with the 3 numerator coefficients, and then the denominator coefficients (the first of which is always 1). You can incorporate the gain into the first section.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-20T19:18:18.637" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8752" PostTypeId="2" ParentId="8534" CreationDate="2013-04-20T19:23:29.940" Score="0" Body="&lt;p&gt;I managed to calculate the amplitude and phase of the harmonics for the values representing the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if it's correct but I did it by following what's on this link:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://clivac.eri.ucsb.edu/harmonic_analysis.htm&quot; rel=&quot;nofollow&quot;&gt;http://clivac.eri.ucsb.edu/harmonic_analysis.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is based on what is written in the book &lt;em&gt;Statistical Methods in the Atmospheric Sciences&lt;/em&gt; by Daniel S. Wilks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I take my 360 values that represent an image as a time series of a periodic function then I can calculate the amplitude and phase of the harmonics this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; A_k=2/n\sum_{t=1}^ny_t \cos(2\pi kt/n)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; B_k=2/n\sum_{t=1}^ny_t\sin(2\pi kt/n)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $k$ is the number of the harmonic for example the first harmonic is $k=1$ while the second is $k=2$. $n$ is the total number of values of the time series, in my case 360. $y_t$ is the value of the periodic function at time $t$ of the time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to calculate the amplitude of the harmonic I do&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; C_k=(A_k^2+B_k^2)^{1/2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C_k$ is the amplitude of the harmonic k&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the phase of the harmonic is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; \tan^{-1}(B_k/A_k) \text{ if } A_k&amp;gt;0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; \tan^{-1}(B_k/A_k)+\pi \text{ if } A_k&amp;lt;0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; \pi/2 \text{ if } A_k=0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I now have the amplitude and phase of the harmonics but I still haven't figured out what to do in this functionals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{i so that } x_i=\min_{i=1 \ldots N}x_i\text{ without the first Harmonic}&#xA;$$&#xA;$$&#xA;\text{i so that } x_i=\max_{i=1 \ldots N} x_i\text{ without the first Harmonic}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the link I can get the first harmonic using this equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\bar{y}+A_k\cos(2\pi kt/n)+B_k\sin(2\pi kt/n)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\bar{y}$ is the mean of the values, $k=1$ (because it's the first harmonic) and $t$, in this case should be the time $t$ of the highest value of the periodic series if I'm not mistaken. But I still don't know how to pick up the index of the maximum value of the minimum value of the series without the first harmonic. I'm not sure what it means.&lt;/p&gt;&#xA;" OwnerUserId="4267" LastEditorUserId="80" LastEditDate="2013-04-20T20:31:52.703" LastActivityDate="2013-04-20T20:31:52.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8753" PostTypeId="1" AcceptedAnswerId="8754" CreationDate="2013-04-20T23:55:27.690" Score="1" ViewCount="3510" Body="&lt;p&gt;Windowing is a popular method of reducing the spectral sidelobes of OFDM. A popular window usually used for this purpose in the raised cosine (RC) window, because of its tapered and smooth edges. I understand the concept of windowing and why it reduces the sidelobes, however what I don't understand is this: &quot;windowing a time domain OFDM signal is equivalent to every subcarrier being individually windowed by the window function (RC for example), basically the sinc sidelobes of every subcarrier will be reduced&quot;. This is true and you can actually see it when the window function is applied to a non-contiguous OFDM signal (some subcarriers are deactivated somewhere in the middle of the spectrum), the spectrum is not only reduced at the edges of the band, but also in the in-band. You can't get this if you apply a filter to the signal, with a filter you only see power spectrum reduction in the edges but not in the band. I'd appreciate if someone can explain why this is true, preferably with some equations.&lt;/p&gt;&#xA;" OwnerUserId="4259" LastActivityDate="2018-12-19T22:47:12.497" Title="Windowing a time domain OFDM signal" Tags="|power-spectral-density|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8754" PostTypeId="2" ParentId="8753" CreationDate="2013-04-21T01:19:21.340" Score="4" Body="&lt;p&gt;If I understand the question properly, then it sounds like the difference between time-domain multiplication and frequency domain multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowing is a time-domain multiplication operation.  As such, it is equivalent to convolving the spectrum with the window kernel, which will operate all frequencies the same way.  On the other hand, filtering is (can be) a frequency domain multiplication, so the filter can be designed to operate specifically on chosen frequencies (or bands of frequencies if you like).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To look at it slightly differently: if you consider your signal as the sum of all your subcarriers (which you can do with linearity), then windowing your signal with an RC is the same as windowing each of your subcarriers with an RC before adding them together.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-04-21T01:19:21.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8755" PostTypeId="1" CreationDate="2013-04-21T02:31:32.857" Score="0" ViewCount="2608" Body="&lt;p&gt;Anybody knows what is the best pdf for periodic signal ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have signal with &lt;span class=&quot;math-container&quot;&gt;$480$&lt;/span&gt; samples &lt;span class=&quot;math-container&quot;&gt;$\left(16000*0.03=480\right)$&lt;/span&gt; but I could not find the exact pdf for that. sometimes it appear like 2 mixed Gaussian.  &lt;/p&gt;&#xA;" OwnerUserId="4327" LastEditorUserId="47251" LastEditDate="2020-02-03T10:44:22.710" LastActivityDate="2020-02-03T10:44:22.710" Title="what is probability density function (PDF) of periodic signal" Tags="|audio|fourier-transform|algorithms|statistics|speech|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8756" PostTypeId="2" ParentId="8755" CreationDate="2013-04-21T07:00:01.043" Score="3" Body="&lt;p&gt;There is no best pdf for a periodic signal. There is also no way to find the 'exact' pdf of a measured signal. What you have to do is to measure the pdf from the data. Use a histogram to approximate the pdf of your data. Define a number of intervals within the amplitude range of your signal and simply count the numbers of data samples per interval. This gives you the histogram which is an approximation of the pdf of your signal.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-21T07:00:01.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8757" PostTypeId="1" CreationDate="2013-04-21T08:23:25.333" Score="5" ViewCount="185" Body="&lt;p&gt;I am required extremely fast to fill the gap and learn Fourier Transform with application in Computer Vision. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was easy to find mathematical aspects of Fourier Transform, but I am more interested in application in Computer Vision for a newbie with a lot of examples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you familiar with a textbook or have any other source of information about Fourier Transform well explained with examples in the field of Computer Vision, please share it with us.&lt;/p&gt;&#xA;" OwnerUserId="4393" LastActivityDate="2013-07-14T19:04:30.643" Title="Fourier Transform Computer Vision Textbook" Tags="|computer-vision|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8758" PostTypeId="2" ParentId="2608" CreationDate="2013-04-21T11:02:24.400" Score="2" Body="&lt;p&gt;One algorithm that qualifies as bandlimited distortion is the use of &lt;a href=&quot;http://en.wikipedia.org/wiki/Chebyshev_polynomials&quot; rel=&quot;nofollow&quot;&gt;Chebyshev polynomials&lt;/a&gt; with sinusoidal inputs for waveshaping synthesis. The Chebyshev polynomials [of the first kind] can be defined as &#xA;$$&#xA;T_n(x) = \mathrm{cos}(n \, \mathrm{arccos}(x)).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I won't go into details here, but there's a relatively simple derivation using &lt;a href=&quot;http://en.wikipedia.org/wiki/De_Moivre%27s_formula&quot; rel=&quot;nofollow&quot;&gt;De Moivre's Theorem&lt;/a&gt; which shows how the above formula defines a set of polynomials (cf. Sec. 7.2 in &lt;a href=&quot;http://books.google.com/books/about/Digital_filters.html?id=GQv9UOdeW9cC&quot; rel=&quot;nofollow&quot;&gt;Digital Filters&lt;/a&gt; by Hamming). The trigonometric definition is useful because it makes it easy to see how each $T_n(x)$ maps a unit amplitude cosine into its nth harmonic, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T_n(\mathrm{cos}(kx)) = \mathrm{cos}(n\,\mathrm{arccos}(\mathrm{cos}(kx))) = \mathrm{cos}(nkx). \tag{1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The polynomials themselves can be easily generated by using the following &lt;a href=&quot;http://en.wikipedia.org/wiki/Favard%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;recurrence relation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T_0(x) = 1 \\ T_1(x) = x \\ T_n(x) = 2x\,T_{n-1}(x) - T_{n-2}(x).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the first few:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\eqalign{&#xA;T_0(x) &amp;amp;= 1 \\&#xA;T_1(x) &amp;amp;= x \\&#xA;T_2(x) = 2x(x - 1) &amp;amp;= 2x^2 - 1 \\&#xA;T_3(x) = 2x(2x^2 - 1) - x &amp;amp;= 4x^3 - 3x \\&#xA;T_4(x) = 2x(4x^3 - 3x) - (2x^2 - 1) &amp;amp;= 8x^4 - 8x^2 + 1 \\&#xA;\ldots&#xA;}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to gain intuition for property $(1)$ is to consider, for example, the operation of $T_2$ on the complex exponential form of $\mathrm{cos}(x)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\eqalign{2\,\mathrm{cos}^2(x) - 1 &amp;amp;= 2\left(\frac{e^{ix} + e^{-ix}}{2}\right)^2 - 1 \\ &amp;amp;= \frac{2}{4}(e^{i2x} + 2e^{ix}e^{-ix} + e^{-i2x}) - 1 \\ &amp;amp;= \left(\frac{e^{i2x} + e^{-i2x}}{2}\right) + \frac{2}{2} - 1 \\ &amp;amp;= \mathrm{cos}(2x).&#xA;}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By computing a Chebyshev Series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f(x) = \sum_{n = 0}^{\infty}{a_n\,T_n(x)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;truncated to an appropriate value of $n$, you get a waveshaper (i.e. $f(x)$) that, when applied to a unit amplitude cosine, will generate an arbitrary [integer] set of bandlimited harmonics.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-04-21T11:02:24.400" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8759" PostTypeId="1" CreationDate="2013-04-21T11:38:57.363" Score="3" ViewCount="158" Body="&lt;p&gt;so there is this paper I'm reading and trying to understand fully: &lt;strong&gt;Towards Practical Identification of HF RFID Devices&lt;/strong&gt;&#xA;&lt;a href=&quot;http://dl.acm.org/citation.cfm?id=2240276.2240278&quot; rel=&quot;nofollow&quot;&gt;http://dl.acm.org/citation.cfm?id=2240276.2240278&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to link the PDF here, but maybe you can catch it from ACM or somewhere else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what we need to know: They record a signal for $5 \mu s$ with 4 GS/s. From the normalized amplitude of the signal $l$ at time $t$ called $f(t,l)$ they obtain $F(\omega, l)$ by FT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F(\omega, l) = \frac{1}{\sqrt{M}} \sum_{m=0}^{M-1} f(t,l) \exp (-2 \pi i \frac{t\omega}{M})&#xA;$$&#xA;Where M is the length of signal considered and $0 \leq t \leq M − 1$ is time. Now quoting:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We then remove from $F(\omega, l)$ its DC component and the redundant part of the spectrum; &#xA;  we denote the remaining part of the spectrum by $\vec{s}_{l}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So now for the spectrum between 0 to 100 MHz the vector $\vec{s}_{l}$ contains amplitudes for 20000 frequencies $(D=20000)$. To reduce the dimensions the authors filter the signal with a bandpass.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A projected vector $\vec{b}_{l}$, also called filtered features, is extracted &#xA;  from the basic features $\vec{s}_{l}$ using a bandpass filter transformation $W_{BPF}$:&#xA;  $$&#xA;\vec{b}_{l} = W_{BPF}^{t} \vec{s}_{l}&#xA;$$&#xA;  The feature extraction from N captured responses for a given RFID device is &#xA;  then given by $G = W_{BPF}^{t}S$ where $G$ is an array of  $\vec{b}_{l}$ and &#xA;  $S = [\vec{s}_{0} \dots \vec{s}_{l} \dots \vec{s}_{N}]$ is a matrix that&#xA;  contains the basic features of N captured responses.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In our implementation, the transformation $W_{BPF}$ consisted of a Chebyshev Type I bandpass filter with filter order of 100 [Williams and Taylors 1988]. The filter was used to keep the frequencies in a target frequency range enclosed between the upper and lower bandpass edge frequencies, denoted by Fp1 and Fp2 respectively; the latter were experimentally determined. We chose the filter order to be high for better bandpass filtering quality. Using this technique the basic feature dimensionality can be effectively reduced to only tens of frequencies (dimensions) comprised between Fp1 and Fp2.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Later on in the paper they state the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Therefore, we applied feature selection by filtering with parameters Fp1 = 11 MHz and Fp2 = 15 MHz. This procedure reduced the features (fingerprint) dimensionality to D = 40.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;And now my question (lately).&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why is the dimensionality now 40? If we have amplitudes of 20000 frequencies between 0-100 MHz and filter from 11 to 15 MHz shouldn't there be 800 left?&lt;/li&gt;&#xA;&lt;li&gt;How does this bandpass matrix $W_{BPF}^{t}$ look like?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading and greetings,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;para&lt;/p&gt;&#xA;" OwnerUserId="4394" LastEditorUserId="4394" LastEditDate="2013-04-22T07:00:56.300" LastActivityDate="2013-04-22T07:00:56.300" Title="Feature Selection by Filtering" Tags="|filters|fourier-transform|bandpass|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8760" PostTypeId="1" CreationDate="2013-04-21T12:57:23.727" Score="4" ViewCount="3279" Body="&lt;p&gt;Currently I'm working on a project to record ELF (Extremely Low Frequency) signals from a receiver. The highest frequency of interest is about 30 Hz and the system should have a flat frequency response.  I'm looking for a simple solution using an 8 bit ADC and I wonder how the resolution can be improved using oversampling and to alleviate the requirements for the analog low pass filter before the ADC. Without oversampling and a sampling rate of 64 sps a rather steep analog low pass filter is needed to avoid aliasing. With oversampling and a gain of 3 more bits the sampling rate is 2^(2*3) times 64 sps = 4096 sps and the analog filter before the ADC is much easier to realize. The problem is to convert the 4096 sps signal back to 64 sps using a digital low pass filter and downsampling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I read so far, the attenuation needs to be almost 68 dB at 32 Hz for 11 bits but at the same time signals up to about 30 Hz should pass. It seems a very steep digital low pass filter is needed. I tried to do some calculations with filter design software, but the required order is too high to get results. Is this really so hard to realize or am I missing something? Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4395" LastActivityDate="2013-04-21T17:59:22.653" Title="Oversampling then filtering and downsampling" Tags="|filter-design|downsampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8761" PostTypeId="1" AcceptedAnswerId="8768" CreationDate="2013-04-21T13:56:33.353" Score="2" ViewCount="349" Body="&lt;p&gt;I use matlab function tf2sos to convert digital filter transfer function data to second-order sections form:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[sos,g] = tf2sos(b,a)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Taken from the help menu of the matlab:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;G is a scalar which accounts for the overall gain of the system&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My question is: Because G is the overall gain if i draw the block diagram is going to be something like below (i use office visio for the pictures, if you press view picture the resolution is good but in this thumbnails they look awfull, sorry about that) :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JOmjo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if i want yo design my system like:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mReUf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how can i find the gain between every node(b1,b2...etc)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D2nSm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-04-21T14:10:20.587" LastActivityDate="2013-04-21T18:01:31.177" Title="Second order sections and normalized factor" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8762" PostTypeId="2" ParentId="8760" CreationDate="2013-04-21T14:49:30.667" Score="4" Body="&lt;p&gt;As you've figured out, for the filter specifications you gave, you need a very high filter. To summarize, you're asking for:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Passband edge: 30 Hz&lt;/li&gt;&#xA;&lt;li&gt;Stopband edge: 32 Hz&lt;/li&gt;&#xA;&lt;li&gt;Minimum stopband attenuation: 68 dB&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The main determining factor for the filter order that you need to meet the specifications is the width of the transition band as a fraction of the sample rate. In your case, you want a transition band that is 2 Hz wide, at a sample rate of 4096 Hz. That's a very sharp transition!&lt;/p&gt;&#xA;&lt;p&gt;A better approach is to perform the decimation in multiple filter stages that are cascaded in series. This allows you to meet the overall frequency response requirements that you have without using a single very-high-order filter. You need an overall decimation factor of 64 to be implemented by the cascade of filters. It can be hard to determine the optimal (in terms of total overall computations to apply the filters) arrangement of stages, but I would recommend the following approach as a start:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stage 1:&lt;/strong&gt; Design a filter with a passband edge at 30 Hz and a stopband edge of (512 - 32) = 480 Hz. Decimate the output of the filter by 8. Thus, at the output of this filter, you will have a signal sampled at 512 Hz.&lt;/p&gt;&#xA;&lt;p&gt;You might notice that this approach yields some aliasing, as the transition band of the stage-1 filter is allowed to extend beyond the new Nyquist frequency of 256 Hz. However, this &lt;strong&gt;isn't&lt;/strong&gt; a problem, because none of the aliasing occurs within the desired passband of the overall cascade. You're allowing some energy to alias through into what will become the stopband of stage 2, where it will be eliminated. Stretching out the transition band of the stage 1 filter allows you to save some computations, because the wider transition will require a lower filter order. Since stage 1 operates at the highest sample rate, this can be a significant benefit.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stage 2:&lt;/strong&gt; Design a filter with a passband edge at 30 Hz and a stopband edge of 32 Hz. Decimate the output of the filter by 8. Thus, at the output of this filter, you will have a signal sampled at 64 Hz with a 30 Hz passband.&lt;/p&gt;&#xA;&lt;p&gt;While this is still quite a sharp transition band, it should be easier to design because the transition band width is a factor of 8 larger when expressed as a ratio of the filter's sample rate. In addition, the work required to apply the stage-2 filter is reduced further because it operates at the lower 512 Hz rate instead of 4096 Hz.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Using MATLAB's &lt;code&gt;fdatool&lt;/code&gt;, the above specifications yield the following filters:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Stage 1:&lt;/strong&gt; 29th-order FIR, 0.1 dB passband ripple, 80 dB stopband attenuation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OTGIN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Stage 2:&lt;/strong&gt; 852nd-order FIR, 0.1 dB passband ripple, 80 dB stopband attenuation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mk4MJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I just used the default attenuation settings for illustration. You'll notice that with this setup, the second-stage filter is still quite complex. While I've used filters of this length before, it's likely that you might want to break the problem down even further to avoid such long filters. To do so, you would add more stages of decimation. For instance, you might try three stages of decimation by 4, or 6 stages of decimation by 2. The best way forward is dictated by your system's constraints, but you should see the idea of the approach.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-04-21T14:49:30.667" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8763" PostTypeId="1" AcceptedAnswerId="8767" CreationDate="2013-04-21T15:08:25.813" Score="8" ViewCount="5782" Body="&lt;p&gt;I am a long time software engineer but have practically zero experience with signal/audio processing. I am interested in learning about signal processing via a use-case we have for one of our audio components. NOTE: this is just a learning exercise for me... it is not a priority that the end result be useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a component (A) which produces audio (via a speaker). We have another component (B) which records that audio (via a simple microphone).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is use A to record B's audio. Then I would like to, if even possible, compare the two streams. The goal would be to remove the audio that was present in stream A - leaving the ambient conditions which existed during the recording - I understand full removal is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize that there are phase and magnitude issues. I also realize that it isn't just a simple matter of &quot;subtracting&quot; B from A. That said, my assumption is you &lt;em&gt;can&lt;/em&gt; subtract A from A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to understand how to approach the problem. Again, this is a learning experience for me (there are no deadlines); I am more than willing to start from the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice/suggestions would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4396" LastActivityDate="2013-04-21T20:37:31.753" Title="“Subtracting” one audio stream from another audio stream" Tags="|filters|audio|background-subtraction|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8764" PostTypeId="2" ParentId="8763" CreationDate="2013-04-21T16:13:53.380" Score="1" Body="&lt;p&gt;The issue which will not allow exact ambient sound to be the output are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(a) the loudness difference&#xA;(b) phase difference due to time delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus overall the recorded signal by B will be (assuming the room behaves as an LTI system) $y_B[n]=\sum_{k=0}^{p}\alpha_k x_A[n-k]+x_{amb}[n])=(x*h)[n]+x_{amb}[n]$, where $h[n]=\alpha_n$ or so the room impulse response. Here $x_{amb}[n]$ is the ambient signal at B's location. Now, $z[n]=x_A[n]-y_B[n]$ you can see that you will have $z[n]\neq x_{amb}[n]$, unless you know the room impulse response or its estimate.&#xA;To get the insight you may go forward by doing the subtraction and seeing the spectrogram of the resulting signal and comparing with the ambient signal's and only A's signal spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other way around is to place the mic close to A to minimize the effect of room impulse response, such a technique is used in noise cancelling headphones where the ambient noise is to be removed.&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Noise-cancelling_headphonese&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Noise-cancelling_headphonese&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2013-04-21T16:13:53.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8765" PostTypeId="2" ParentId="8763" CreationDate="2013-04-21T17:35:13.937" Score="1" Body="&lt;p&gt;That sounds like a standard case for &quot;acoustic echo cancellation&quot;. A LOT of patents, research papers and academic theses exist on the topic (starting in 1967, I believe with M.M. Sondhi's paper &quot;An adaptive acoustic Echo Cancellor&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple overview is here &lt;a href=&quot;http://supportdocs.polycom.com/PolycomService/support/global/documents/support/technical/products/voice/vortex_choose_acoustic_echo_canceller.pdf&quot; rel=&quot;nofollow&quot;&gt;http://supportdocs.polycom.com/PolycomService/support/global/documents/support/technical/products/voice/vortex_choose_acoustic_echo_canceller.pdf&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a decent book on the topic &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/3540417214&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Advances-Network-Acoustic-Cancellation-Processing/dp/3540417214&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-21T17:35:13.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8766" PostTypeId="2" ParentId="8760" CreationDate="2013-04-21T17:59:22.653" Score="4" Body="&lt;p&gt;As written this is pretty tough constraint to meet. You have two basic choices:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Linear phase filter&lt;/strong&gt;: preserves the original phase but requires a large bulk delay and smears the time domain both forward and backward in time. Does a very poor job at preserving transients in the time domain&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Minimum phase filter&lt;/strong&gt;: does not require a bulk delay and smears only forward in time (causality is mostly preserved). Does a better job at preserving transients but the phase response is severely impacted. In your example a 12th order elliptic filter with 0.1dB pass band ripple would do the job.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In either cases there will be substantial time domain ringing that will drag out for multiple seconds. The steeper the frequency transition, the more time domain ringing you get regardless of filter type or structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would recommend re-evaluating the application constraints again to check whether you really need a filter that steep. How &quot;flat&quot; does it really need to be? How much amplitude and phase ripple can the application tolerate?  What's spectrum of the input signal like? Do you really have full scale spectral components that are in the aliasing range or is the signal already attenuated at aliasing frequencies? &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-21T17:59:22.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8767" PostTypeId="2" ParentId="8763" CreationDate="2013-04-21T17:59:33.620" Score="5" Body="&lt;p&gt;This setup shares some similarities with system identification problems, where $A$ would be the input of the LTI system you want to estimate the transfer function of, $B$ being the output; and the &quot;ambient sound&quot; being the additive noise. The LTI assumption is reasonable provided your converters/amplifiers/transducers are of decent quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the steps would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use a system identification technique to find the FIR filter $\hat{h}$ that minimizes the mean-square error between $\hat{h} \star A$ and $B$. A simple method, which might not be the most suitable here, is to divide the cross-correlation of $A$ and $B$ by the autocorrelation of $A$. &lt;a href=&quot;https://ccrma.stanford.edu/~jos/st/FIR_System_Identification.html&quot; rel=&quot;noreferrer&quot;&gt;Explanation here&lt;/a&gt;. The limitation is that it will not work well for long recordings (you might better compute your estimates on shorter segments and average them) - and that music is not the best &quot;probe&quot; signal to send into a system to estimate its response.&lt;/li&gt;&#xA;&lt;li&gt;You can now use $\hat{h} \star A$ as an estimate of the original signal A as &quot;heard&quot; by the microphone and subtract it from $B$ to retrieve the ambient sound.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I gave a shot at this using a music clip (A), applying a reverb and slight amp model to simulate a speaker in a room, then mixing in a cat audio sample to get (B), then estimating an impulse response from the (A, B) pair, then subtracting the filtered A from B. This shows &lt;a href=&quot;https://dl.dropboxusercontent.com/u/612135/ir_estimation_example.zip&quot; rel=&quot;noreferrer&quot;&gt;some results&lt;/a&gt; but a better FIR estimation technique might help here! (note that I truncated the estimated IR to its first 5000 samples to speed up computations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there are algorithms for doing this adaptively (such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_mean_squares_filter&quot; rel=&quot;noreferrer&quot;&gt;LMS&lt;/a&gt;). This might be more suitable for your problem if $A$ and $B$ are processed in realtime rather than offline. Such algorithms form the basis of echo cancellation systems used in telecommunications.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-04-21T20:37:31.753" LastActivityDate="2013-04-21T20:37:31.753" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8768" PostTypeId="2" ParentId="8761" CreationDate="2013-04-21T18:01:31.177" Score="2" Body="&lt;p&gt;If I understand your question correctly, you want to split the total gain between two or more stages. In this case you just have to satisfy $G=g_1g_2g_3$, where $G$ is the total gain returned by tf2sos() and the $g_i$ are the individual gains per stage.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-21T18:01:31.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8769" PostTypeId="1" CreationDate="2013-04-21T11:56:20.820" Score="2" ViewCount="227" Body="&lt;p&gt;Sometimes the terms 'Fourier domain', 'complex frequency domain', 'Frequency domain' and 's domain' are used interchangeably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take those answers here for example: &lt;a href=&quot;http://answers.yahoo.com/question/index?qid=20090924230321AAxvnJg&quot; rel=&quot;nofollow&quot;&gt;http://answers.yahoo.com/question/index?qid=20090924230321AAxvnJg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you really use them interchangeably all the time, without being technically wrong? So, could you describe what would be wrong if I would replace 's domain' by 'fourier domain' for example? Or replacing 'complex frequency domain' by 'frequency domain'?&lt;/p&gt;&#xA;" OwnerUserId="4106" OwnerDisplayName="user1095332" LastEditorUserId="26573" LastEditDate="2018-09-06T08:08:09.277" LastActivityDate="2018-09-06T08:08:09.277" Title="How to distinguish between the different frequency domains?" Tags="|frequency-domain|terminology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8770" PostTypeId="2" ParentId="8769" CreationDate="2013-04-21T12:25:32.677" Score="3" Body="&lt;p&gt;This answer is primarily opinion. It seems to me that the most sensible thing to do is to make the transform of interest clear in your text. Then you can use &quot;frequency domain&quot; exclusively and unambiguously. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Laplace transforms, &quot;s domain&quot; will work as well, and I do believe they are interchangeable. I do not believe &quot;Fourier domain&quot; would be correct usage in this case. &quot;s domain&quot; may be preferred if you wish to emphasize that real values of $s$ have a clear aperiodic interpretation (exponentials in the time domain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the transform is not yet clear, you could say &quot;Fourier domain&quot;, I suppose. In that case the assumed spectrum would be the complex (possibly conjugate symmetric) form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, if it is within your control, be explicit about the chosen transform.&lt;/p&gt;&#xA;" OwnerUserId="4402" OwnerDisplayName="Michael Grant" LastActivityDate="2013-04-21T13:19:53.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8771" PostTypeId="1" AcceptedAnswerId="8773" CreationDate="2013-04-21T18:58:35.577" Score="2" ViewCount="1585" Body="&lt;p&gt;I know overlap save and overlap add are used for long data sequence filtering. Are there any other similar or better techniques like these? &lt;/p&gt;&#xA;" OwnerUserId="4400" LastEditorUserId="4346" LastEditDate="2017-01-05T04:11:02.820" LastActivityDate="2017-01-05T04:11:02.820" Title="Other techniques like overlap save/overlap add" Tags="|filtering|fast-convolution|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8772" PostTypeId="2" ParentId="8771" CreationDate="2013-04-21T19:23:45.977" Score="1" Body="&lt;p&gt;Overlap-add and overlap-save are block processing algorithms for implementing FIR (finite impulse response) filters. Both of them use an FFT algorithm to compute the output samples, which makes these methods computationally efficient. In principle, any other filter implementation can also be used, even with long input sequences. IIR (infinite impulse response) filters can be more efficient than any overlap-add or overlap-save method because they need much fewer coefficients than FIR filters to achieve comparable frequency responses.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-21T19:23:45.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8773" PostTypeId="2" ParentId="8771" CreationDate="2013-04-21T19:38:36.457" Score="2" Body="&lt;p&gt;The main alternative that I can think of is the hybrid method proposed by &lt;a href=&quot;http://alumni.media.mit.edu/~billg/projects.html#conv&quot; rel=&quot;nofollow&quot;&gt;Bill Gardner&lt;/a&gt; and &lt;a href=&quot;http://www.freepatentsonline.com/6421697.html&quot; rel=&quot;nofollow&quot;&gt;patented by Lake DSP&lt;/a&gt; (now part of Dolby). &lt;a href=&quot;http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF&quot; rel=&quot;nofollow&quot;&gt;There appears to be a copy of Gardner's paper here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-21T19:38:36.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8774" PostTypeId="1" AcceptedAnswerId="8776" CreationDate="2013-04-21T20:38:49.017" Score="1" ViewCount="4808" Body="&lt;p&gt;I am computing the fourier series of the following function between $[-0.5, 0.5]$&#xA;$$\displaystyle f(t) = \frac{1}{2} - |t|$$&#xA;According to the definition of Fourier Series the coefficients are given by&#xA;$$\displaystyle \hat f_n = \frac{-(-1)^n}{2\pi ^2 n^2} + \frac{1}{2\pi ^2 n^2}$$&#xA;That's easy to calculate. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the coefficients I know I can do the approximation of the function $f(t)$. But then how to plot, the frequency spectrum??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I defined the function $f(t)$ in matlab and plot it from $-0.5$ to $0.5$ and got the triangle function. Now, I have the coefficients that depend on $n$ but what's the range of $n$? Plotting the coefficients will give me the frequency spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me clarify this I'm really confused, seems I can't get the relation.&lt;/p&gt;&#xA;" OwnerUserId="3262" LastActivityDate="2013-04-22T11:55:16.320" Title="Fourier series - time and frequency domain confusion" Tags="|time-frequency|frequency-domain|fourier-series|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8775" PostTypeId="2" ParentId="8771" CreationDate="2013-04-21T20:46:29.117" Score="3" Body="&lt;p&gt;The traditional overlap-add technique cannot be used as is in musical applications (reverberation) where latency is critical. It is a common practice to break down the impulse response into non-uniform chunks, and to run in parallel different convolvers for each segment of the impulse response - some of them being naive FIR implementations (for the short blocks at the &quot;head&quot; of the response), and some of them being high-latency overlap-add FFT convolvers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://netzspannung.org/cat/servlet/CatServlet/%24files/221609/04_Rovaniemi99LLC.pdf&quot; rel=&quot;nofollow&quot;&gt;See this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-04-21T20:46:29.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8776" PostTypeId="2" ParentId="8774" CreationDate="2013-04-21T21:18:13.250" Score="4" Body="&lt;p&gt;The coefficients of the Fourier series that you have computed are, in effect, the spectrum of the &lt;em&gt;periodic&lt;/em&gt; signal consisting of the sum of signals $f(t)$ delayed in time or advanced in time by integer multiples of $1$ second.  Mathematically, the Fourier &lt;em&gt;transform&lt;/em&gt; of a periodic function has &lt;em&gt;impulses&lt;/em&gt; in it with the impulse amplitudes being the Fourier series coefficients. The impulses occur at intervals of the period, in this instance $1$ second, &#xA;and a &quot;plot&quot; of the spectrum typically shows a bunch of vertical arrows (a common representation of impulses) with the amplitude marked just above the arrowhead. In your case, assuming that you have computed the complex form of the Fourier series,&#xA;you would get a series of such arrows extending from $n=0$ out to $\pm \infty$. &#xA;Note that your formula &#xA;$$&#xA; \hat f_n = \frac{-(-1)^n}{2\pi ^2 n^2} + \frac{1}{2\pi ^2 n^2}&#xA;$$&#xA;is saying that $\hat{f}_n = 0$ when $n$ is even. Also, putting $n=0$ in the formula&#xA;makes $\hat{f}_0$ undefined which is incorrect since $\hat{f}_0$ is the&#xA;&quot;DC value&quot; which is $\frac{1}{4}$ by inspection.. So please do check your work.&#xA;In particular, note that while integrating by parts as you are likely&#xA;to be doing, the antiderivative&#xA;$$\int e^{-j2\pi nt}\,\mathrm dt = \frac{e^{-j2\pi nt}}{-j2\pi n}$$&#xA;cannot be used when $n=0$: $\int 1 \,\mathrm dt = t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: if you computed the sine/cosine form of the Fourier series, then you&#xA;should have found that the coefficients of the $\sin(2\pi nt)$ terms are all&#xA;$0$ and your spectrum will extend from $n=0$ to $n=\infty$ only.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-04-22T11:55:16.320" LastActivityDate="2013-04-22T11:55:16.320" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8777" PostTypeId="2" ParentId="69" CreationDate="2013-04-22T00:09:44.017" Score="8" Body="&lt;p&gt;The other people have given great, useful answers. Just think about some signal: you only care what frequencies are in it (and their phase), not about the time domain. &lt;strong&gt;I do not know that this is a final or complete answer, but just another reason why the Fourier transform is useful.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have some signal, it could be composed of an infinite (or close to) number of frequencies, depending on your sampling rate. But, that's not the case: we know that most signals have the fewest number of frequencies possible, or that we're sampling at a high enough rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we know that, why can't we use it? That's what the field of compressed sensing does. They know that the most likely signal is one that has the least error and has the fewest frequencies. So, they minimize the overall error relative to our measurements as well as the magnitude of the Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal of a few frequencies often has a minimal Fourier transform, or mostly zeros (aka &quot;sparse,&quot; as they say in compressed sensing). A signal of one frequency just has a delta function as the transform, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can use the formal mathematical definition too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\bar{x} = \textrm{arg min } ||y-Ax|| + \lambda||F(x)||$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, all we're doing is minimizing the error (first set of $||\cdot||$) and minimizing the Fourier transform (second set of $||\cdot||$). Here, we have&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\bar{x}$ as our reconstructed signal (most likely close to the original)&lt;/li&gt;&#xA;&lt;li&gt;$y$, our measurements&lt;/li&gt;&#xA;&lt;li&gt;$A$, a selection matrix&lt;/li&gt;&#xA;&lt;li&gt;$x$, our signal&lt;/li&gt;&#xA;&lt;li&gt;$\lambda$ some constant&lt;/li&gt;&#xA;&lt;li&gt;$F(x)$ the Fourier transform.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You may recall that Nyquist said that you have to measure at twice the highest frequency to get a good representation. Well, that was assuming you had infinite frequencies in your signal. We can get past that!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field of compressed sensing can reconstruct any signal that's mostly zeros (or sparse) in some domain. Well, that's the case for the Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="4112" LastEditorUserId="5843" LastEditDate="2018-07-31T21:11:53.137" LastActivityDate="2018-07-31T21:11:53.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8778" PostTypeId="2" ParentId="8759" CreationDate="2013-04-22T01:41:55.830" Score="1" Body="&lt;p&gt;The problem is that the following statement- &quot;So now for the spectrum between 0 to 100 MHz the vector s⃗ l contains amplitudes for 20000 frequencies (D=20000)&quot;- is faulty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal that lasts $5\mu s$ is captured at 4 GS/s.  That is a total of 5e-6 * 4e9 = 20000 samples.  The Nyquist frequency is half the sample rate, or 2 GHz.  They take the Fourier transform of the samples ($F(w,l)$).  At this point, assuming the samples are real (as opposed to complex), there are 20000 frequency bins representing -2 GHz to +2 GHz.  The negative frequency information is redundant since it mirrors the positive frequencies.  I believe that when they said &quot;We then remove from F(ω,l) its DC component and the redundant part of the spectrum&quot; they were talking about getting rid of the 0 Hz and negative frequency information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That would leave you with 9999 frequency bins representing 200 kHz to 2 GHz.  To make life easier, though, let's bring back the DC bin and say that we have 10000 frequency bins representing 0 Hz to 2 GHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully it is clear now why &quot;So now for the spectrum between 0 to 100 MHz the vector s⃗ l contains amplitudes for 20000 frequencies (D=20000)&quot; is faulty.  There are 10000 bins and they represent 0 to 2 GHz, not 0 to 100 MHz.  They now bandpass the signal down to 4 MHz bandwidth.  $(4e6 / 2e9) * 10000 = 20$ frequency bins.  I believe they get 40 dimensions from those 20 bins by counting both the amplitude and phase of the bins as features, $20 * 2 = 40$.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-22T01:41:55.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8779" PostTypeId="1" CreationDate="2013-04-22T03:03:57.037" Score="4" ViewCount="823" Body="&lt;p&gt;I am performing a system identification by striking an experimental model with an instrumented impact hammer and measuring the strain response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The timebase for the recorded signals is 5 microseconds and the hammer pulse width is typically around 200 microseconds. The data are recorded for 20 milliseconds prior to the hammer hit and for 60 milliseconds after. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of the recorded data is provided &lt;a href=&quot;https://www.dropbox.com/s/2rcz2xi02ufuvkw/strain_response.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. A close-up of the pre-trigger strain signal is provided &lt;a href=&quot;https://www.dropbox.com/s/e39maiqxlqtpaym/strain_response_close_up.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prior to the hammer hit, the strain signal is non-zero with both low and high frequency noise present. The low frequency noise is of most concern as this affects the quality of the system impulse response function that I subsequently compute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately when completing the tests I did not record a zero-reference prior to each hammer hit. Thus my questions are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) What methods are available for removing the low-frequency line noise from the entire signal given that the strain response is also of low-frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Is is possible to use the first 20 milliseconds to construct a longer zero-reference signal that I may then subtract from the recorded data? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="4404" LastActivityDate="2013-04-22T11:38:03.240" Title="What are some suitable methods for removing low-frequency line noise from measured data prior to system identification/deconvolution?" Tags="|noise|system-identification|deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8780" PostTypeId="1" CreationDate="2013-04-22T04:14:08.127" Score="0" ViewCount="194" Body="&lt;p&gt;I am confusing when I find the lpc roots magnitude, f1=0.9313, f2=0.9308, f3=0.91 and f4=0.95 but when I look at LPC envelope the f1 is higher than f4 in term of magnitude in dB.&#xA;Could anybody explain it ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have wrote following MATLAB code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;frame=wave((i-1)*frame_length+1:(i*frame_length));&#xA;a=lpc(frame,30);&#xA;r=roots(a);             &#xA;r=r(imag(r)&amp;gt;0.01);           % only look for roots &amp;gt;0Hz up to fs/2&#xA;for k=1:length(r)&#xA;z(k) = abs(r(k));&#xA;ffreq(k)=(atan2(imag(r(k)),real(r(k)))*fs/(2*pi));% convert to Hz and sort&#xA;end&#xA;[ff,index]=sort(ffreq);&#xA;fprintf('\n Start of frame %d \n ',i);&#xA;for j=1:length(ff)&#xA;fprintf('Formant %d Frequency %.1f --- %.2f\n',j,ff(j),z(index(j)));&#xA;end&#xA;fprintf('\n End of frame %d \n ',i);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4327" LastEditorUserId="4327" LastEditDate="2013-04-24T02:57:18.043" LastActivityDate="2013-04-24T13:19:54.290" Title="Format location from LPC magnitude" Tags="|discrete-signals|frequency-spectrum|algorithms|speech|lpc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8781" PostTypeId="1" AcceptedAnswerId="8783" CreationDate="2013-04-22T08:50:21.760" Score="5" ViewCount="656" Body="&lt;p&gt;I want to implement Wavelet Transform from the scratch, that mean breaking the wavelet transform into its equations to implement in any Programming language. Matlab Comes with built-in functions to implement Wavelet Transform but It is really hard to understand which processes are exactly involved in the implementation if one wants to develop their own functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are Low and High Pass filter involved and the other step called , Down-Sampling but I still have so many doubts on how exactly to combine these filters and samplers to design one's own Wavelet Transform function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wavelet tranform block diagram looks like this,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/d6cFh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but there are so many Wavelet transform like Haar, db1, db2 etc. Which wavelet tranform does this blog diagram defines anyway.&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-04-24T17:49:50.687" Title="Implementing Wavelet Transform using Equations" Tags="|wavelet|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8782" PostTypeId="2" ParentId="8774" CreationDate="2013-04-22T09:02:52.523" Score="2" Body="&lt;p&gt;As correctly pointed out by Dilip Sarwate, the Fourier coefficients apply to the periodic continuation of your triangular function. However, they are also samples of the continuous Fourier transform of the original (non-periodic) triangular function. So the Fourier coefficients can also be used as a discrete approximation of the spectrum of the non-periodic function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's now have a look at the formula for the coefficients. As you know, there are two representations for the Fourier coefficients. I learned them in this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = \frac{a_0}{2} + \sum_{n=1}^{\infty}\left (a_n\cos n\omega t + b_n\sin n\omega t \right )$$&#xA;$$a_0=\frac{2}{T}\int_{-T/2}^{T/2}f(t)dt,\;&#xA;a_n=\frac{2}{T}\int_{-T/2}^{T/2}f(t)\cos n\omega tdt,\;&#xA;b_n=\frac{2}{T}\int_{-T/2}^{T/2}f(t)\sin n\omega tdt,\; n\ge 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\omega=\frac{2\pi}{T}$, where $T$ is the period of the function $f(t)$. The other representation uses complex coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = \sum_{n=-\infty}^{\infty}c_n e^{jn\omega t}$$&#xA;$$c_n=\frac{1}{T}\int_{-T/2}^{T/2}f(t)e^{-jn\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's first calculate the coefficients $a_n$ and $b_n$. We can immediately note that $b_n=0,\; n=1,2,\dots$ because the function under consideration is even. With $T=1$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_0=2\int_{-1/2}^{1/2}f(t)dt=\frac{1}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that according to the definition I use, the DC component is $a_0/2=1/4$. For $a_n,\; n\ge 1,$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_n = 2\int_{-1/2}^{1/2}f(t)\cos 2\pi n tdt =&#xA;4\int_{0}^{1/2}f(t)\cos 2\pi n tdt =\\&#xA;=4\int_{0}^{1/2}\left (\frac{1}{2}-t\right )\cos 2\pi n tdt =&#xA;2\int_{0}^{1/2}\cos 2\pi n t dt -&#xA;4\int_{0}^{1/2}t\cos 2\pi n tdt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to symmetry, the first term is zero. The second term can be obtained by integrating by parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_n = -4\int_{0}^{1/2}t\cos 2\pi n tdt = \frac{1-\cos n\pi}{(n\pi)^2} =&#xA;\frac{1-(-1)^n}{(n\pi)^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the complex coefficients we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n=\int_{-1/2}^{1/2}f(t)e^{-j2\pi n t}dt =&#xA;\frac{1}{2}\int_{-1/2}^{1/2}e^{-j2\pi n t}dt - \int_{0}^{1/2}te^{-j2\pi n t}&#xA;+ \int_{-1/2}^{0}te^{-j2\pi n t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, the first term equals 0 due to symmetry. Combining the other two terms yields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-\int_{0}^{1/2}t\left ( e^{j2\pi n t} + e^{-j2\pi n t} \right )dt =&#xA;-2\int_{0}^{1/2}t\cos 2\pi n t dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, apart from a factor 2, is the same integral as above for $a_n$. So we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n = \frac{1-\cos n\pi}{2(n\pi)^2} =&#xA;\frac{1-(-1)^n}{2(n\pi)^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value $c_0$ can be obtained from &#xA;$$c_0 = \int_{-1/2}^{1/2}f(t)dt$$ but it can also be obtained from (1) by calculating the limit $n\rightarrow 0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_0 = \lim_{n\rightarrow 0}\frac{1-\cos n\pi}{2(n\pi)^2} = \frac{(n\pi)^2}{4(n\pi)^2}=\frac{1}{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I used the Taylor series expansion of $\cos(x)$ at $x=0$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-04-22T09:30:50.267" LastActivityDate="2013-04-22T09:30:50.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8783" PostTypeId="2" ParentId="8781" CreationDate="2013-04-22T09:22:54.487" Score="3" Body="&lt;p&gt;I found the &lt;a href=&quot;http://grail.cs.washington.edu/pub/stoll/wavelet1.pdf&quot; rel=&quot;nofollow&quot;&gt;Wavelets for Computer Graphics: A Primer&lt;/a&gt; a good introduction to the Haar wavelet and its role in image processing. &lt;/p&gt;&#xA;" OwnerUserId="420" LastActivityDate="2013-04-22T09:22:54.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8784" PostTypeId="2" ParentId="8779" CreationDate="2013-04-22T11:38:03.240" Score="3" Body="&lt;p&gt;Taking a quick look at your acquisition: this doesn't look too terrible in terms of noise, however, the acquisition window looks way too short. With a 60ms window your frequency resolution is only 160 Hz. From the looks of it, you will also get a massive truncation error. As a rough rule of thumb, you want the acquisition window long enough so that the impulse response visually disappears in the noise.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specific answers (although they may not help given the truncation error)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If it's really line (like in AC supply voltage hum) noise you can measure the exact location and notch it out for the fundamental and the harmonics.&lt;/li&gt;&#xA;&lt;li&gt;Sure. Take the mean and subtract. However, again, the window is way too short to get decent low frequency resolution.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A bunch of tips&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Make the acquisition window long enough to capture the complete impulse response&lt;/li&gt;&#xA;&lt;li&gt;Take an acquisition with no excitation. That's your noise floor&lt;/li&gt;&#xA;&lt;li&gt;Take an acquisition with excitation. That's your signal&lt;/li&gt;&#xA;&lt;li&gt;Compare signal spectrum to noise floor spectrum. Calculate SNR as a function of frequency&lt;/li&gt;&#xA;&lt;li&gt;You want at least 10 dB SNR for a decent measurement. Frequencies must either meet that or be so low in level that they don't matter (&amp;lt; at least 20 dB of &quot;the bulk&quot;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If that can't be done there are more esoteric methods like Wiener filtering and/or reconstructive modelling, but it's certainly preferable to clean up the measurement process. &lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-04-22T11:38:03.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8785" PostTypeId="1" AcceptedAnswerId="8786" CreationDate="2013-04-22T11:53:37.120" Score="17" ViewCount="31730" Body="&lt;p&gt;I asked myself how to compute dBFS (dB full scale) from a value of sample between 1 and -1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and in general?&lt;/p&gt;&#xA;" OwnerUserId="3352" LastActivityDate="2022-08-11T15:28:40.170" Title="How to compute dBFS?" Tags="|matlab|discrete-signals|sound|dbfs|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8786" PostTypeId="2" ParentId="8785" CreationDate="2013-04-22T11:53:37.120" Score="20" Body="&lt;p&gt;It is really quite simple for values between 1 and -1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;valueDBFS = 20*log10(abs(value))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have values between another range, for example 16bit, then it's:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;valueDBFS = 20*log10(abs(value)/32768)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(because 16bit signed has values between -32768 and +32767, e.g. 2^15=32768)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so the general formula is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;valueDBFS = 20*log10(abs(value)/maxValue)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code examples are given in MATLAB code. &lt;/p&gt;&#xA;" OwnerUserId="3352" LastEditorUserId="-1" LastEditDate="2013-10-08T18:58:54.053" LastActivityDate="2013-10-08T18:58:54.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8787" PostTypeId="1" CreationDate="2013-04-22T13:03:14.147" Score="0" ViewCount="1920" Body="&lt;p&gt;I use discrete Fourier transform for digital image processing purposes , but I don't understand basic concept behind it. For example : &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What information exists in frequency domain? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is difference between spatial domain and frequency domain? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4408" LastEditorUserId="80" LastEditDate="2013-04-22T13:39:30.927" LastActivityDate="2015-10-14T21:48:02.853" Title="What is the basic concept of Fourier transform" Tags="|dft|frequency-domain|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8789" PostTypeId="2" ParentId="8787" CreationDate="2013-04-22T13:20:59.740" Score="1" Body="&lt;p&gt;Fourier transform approximates a function to a sum of sine and cosine signals of varying frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform is an extension of the Fourier series that results when the period of the represented function is lengthened and allowed to approach infinity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the properties of sine and cosine, it is possible to recover the amplitude of each wave in a Fourier series using an integral.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-04-22T13:20:59.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8790" PostTypeId="2" ParentId="8787" CreationDate="2013-04-22T14:30:51.387" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What information exists in frequency domain?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As JasonR says in the comment, &lt;strong&gt;&lt;em&gt;The frequency domain &#xA;is a different view of the same data.&lt;/em&gt;&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;No new information is created, it just takes the &quot;spatial&quot; domain data (the image pixel values and their locations) and re-presents it as the coefficients of complex exponentials (sines and cosines).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is difference between spatial domain and frequency domain?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The spatial domain is the domain of the image: the pixel values are located at particular positions in the image --- they are spatially distributed, usually in a regular grid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency domain takes this same data and finds any underlying periodicities (sine waves and cosine waves) in the spatial data, and their amplitudes and phases (spatial offsets).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose I have the following image (Scialab, not matlab):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 100;&#xA;x = [1:N];&#xA;y = [1:N];&#xA;phi = 2*%pi*0.0987298374*ones(N,1)*x + 2*%pi*0.033102974*y'*ones(1,N);&#xA;im1 = sin(phi);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which looks like (appropriately scaled to the grey scale values):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vNmzL.png&quot; alt=&quot;Periodic image (scaled)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the FFT of this is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rjd48.png&quot; alt=&quot;FFT of periodic image (scaled)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(again, with appropriate scaling).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency domain version shows up the periodicities of the spatial domain as a small number of large coefficients.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-22T15:43:41.137" LastActivityDate="2013-04-22T15:43:41.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8791" PostTypeId="1" AcceptedAnswerId="8797" CreationDate="2013-04-22T14:59:41.123" Score="3" ViewCount="529" Body="&lt;p&gt;The question I have is related to image quality evaluation. Suppose you are supposed to perform OCR (Optical Character Recognition) on a set of document images. Some images, however, are very blurring, and for these images blind deconvolution is needed. However, there are good images that do not need deconvolution. Then my question is: could I find a criterion to automatically separate these images into two groups: blurred image and clear images and then treat them differently when performing OCR?  &lt;/p&gt;&#xA;" OwnerUserId="1674" LastActivityDate="2013-04-23T01:03:55.580" Title="How to automatically detect blurred document images" Tags="|image-processing|discrete-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8792" PostTypeId="1" CreationDate="2013-04-22T15:05:19.990" Score="10" ViewCount="12597" Body="&lt;p&gt;My question is regarding the input size of a signal which is not a power of 2 and we have to take the fft of it. Some solutions say that suppose  if we want to take the fft of 1800 we should zero pad it till the length of 2048 to make it power of 2 and then apply the radix 2 algorithm. But there are other solutions as well which applies a combination of different algorithms without zero padding and then calculating the required FFT. My question is Does zero padding a signal to length of 2048 in case we have to take fft of 1800 makes any difference in results , if we use a combination of different algorithms to calculate the fft of size 1800. Would there be any difference or the result would be same. &lt;/p&gt;&#xA;" OwnerUserId="3993" LastActivityDate="2018-09-18T09:51:08.967" Title="FFT of size not a power of 2" Tags="|fft|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="8793" PostTypeId="1" CreationDate="2013-04-22T15:57:09.890" Score="2" ViewCount="3090" Body="&lt;p&gt;I'm trying to implement a multipath ricean channel model. I had found several resources but I'm kind of lost with too much information. What I have from now is the following step:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1- Generate the signal without noise/channel&#xA;2- convolve with the channel response &#xA;3- add white gaussian noise&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is how to generate the channel response? As far as I understand I have to generate a ricean distributed filter with ntaps, where each tap represent one path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transmitted data is a series of OFDM symbols for a BERxSNR plot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The channel model is Ricean with multipath and doppler shift. From my references I have all the parameters but I didn't understand how to transform this into an algorithm.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;update&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def generate_rician(self,K,data):&#xA;    self.__rician_mu  = sqrt(K/(K+1))&#xA;    self.__rician_s   = sqrt(1/(2*(K+1)))&#xA;    self.__rician_chn = self.__rician_s*(random.standard_normal((data_size,)) + random.standard_normal((data_size,))*1j) + self.__rician_mu&#xA;    return self.__rician_chn*data + wgn&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where wgn is the white gaussian noise, omitted here. I have to improve this code adding doppler spread and multipath&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[edited]&#xA;The above code try to reflect the following equations:&#xA;$$&#xA;C = \sqrt{\frac{1}{2*(K+1)}}*(X+j*Y) + \sqrt{\frac{K}{K+1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R = TxC + N&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $T$ is the transmited signal(QPSK-OFDM), $N$ is the white gaussian noise, $X$ and $Y$ are two pseudo random variables with normal distrubution. $K$ is the ricean factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a reference the equation used as theoretical reference is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Pb = \frac{1}{2} {\rm erfc} \left (\sqrt{\frac{K*EbN0}{K + EbN0}}  \right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An output of my system simulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1CXHf.png&quot; alt=&quot;Rician fading simulation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see my results are divergent from the theoretical. The simulation was done using scipy fftpack and the code above.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In green you see the theoretical AWGN BER curve, in blue theoretical rician fadin K=5 and in red the results from my simulated system.&lt;/p&gt;&#xA;" OwnerUserId="4144" LastEditorUserId="4144" LastEditDate="2013-04-25T12:14:12.317" LastActivityDate="2013-04-25T12:14:12.317" Title="Ricean Multipath channel model implementation" Tags="|python|ofdm|multipath|" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="8795" PostTypeId="2" ParentId="8792" CreationDate="2013-04-23T00:04:56.070" Score="8" Body="&lt;p&gt;The resulting FFT will be different: instead of calculating the FFT at the frequencies $2\pi n/1800\ \ $ for $n=0\ldots 1799\ \ $, you will be calculating them at $2\pi n/2048\ \ $ for $n=0\ldots 2047\ \ $. However, there is no degradation of the information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both approaches are correct: using 1800 or 2048. I'd use the &quot;minimum energy solution&quot; (i.e. the simplest, the laziest solution).  This would usually be using the 2048 length transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;People tend to use radix-2 transforms because they don't know any better. There seems to be much mis-information about FFTs HAVING to be power-of-2. There is no such constraint.  Also, they probably don't know about about decent non-radix-2 algorithms, such as those available in &lt;a href=&quot;http://www.fftw.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;FFTW&lt;/a&gt; and other libraries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see that the FFT of any length is information-preserving:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Assume your data of length 1800 is in &lt;code&gt;x&lt;/code&gt;.  Form &lt;code&gt;X = fft(x,2048);&lt;/code&gt; (or some other  length different from 1800).&lt;br&gt; &#xA;  Find &lt;code&gt;xx = ifft(X);&lt;/code&gt;.&lt;br&gt;&#xA;  See what &lt;code&gt;sum(abs(x-xx(1:1800)));&lt;/code&gt; is.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/q/741/80&quot;&gt;See also this question and its answers.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-04-23T00:48:52.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8796" PostTypeId="2" ParentId="741" CreationDate="2013-04-23T00:09:30.367" Score="40" Body="&lt;p&gt;There are a few things to consider before you decide to zero pad your time-domain signal.  You may not need to zero pad the signal at all!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Lengthen the time-domain data (not zero padding) to get better resolution in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Increase the number of FFT points beyond your time-domain signal length (zero padding) if you would like to see better definition of the FFT bins, though it doesn't buy you any more true resolution.  You can also pad to get to a power of 2 number of FFT points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) When fiddling with the FFT points (in the previous point), make sure your frequency points end up where you want them.  The spacing of the points is $f_s/N$, where $f_s$ is the sampling frequency and $N$ is the number of FFT points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some nice figures illustrating these points at &lt;a href=&quot;http://www.bitweenie.com/listings/fft-zero-padding/&quot;&gt;http://www.bitweenie.com/listings/fft-zero-padding/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One last thing to mention:  If you zero pad the signal in the time domain and you want to use a windowing function, make sure you window the signal before you zero pad.  If you apply the window function after zero padding, you won't accomplish what the window is supposed to accomplish.  More specifically, you'll still have a sharp transition from the signal to zero instead of a smooth transition to zero.&lt;/p&gt;&#xA;" OwnerUserId="4409" LastEditorUserId="80" LastEditDate="2013-04-23T01:01:35.030" LastActivityDate="2013-04-23T01:01:35.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8797" PostTypeId="2" ParentId="8791" CreationDate="2013-04-23T01:03:55.580" Score="4" Body="&lt;p&gt;Yes, but doing so is difficult. You are basically assuming that when a certain feature is sufficiently present in an image, you can apply a filter and realize an improvement in OCR accuracy. This implies that you can find the right feature, apply the right filter, and evaluate OCR accuracy correctly. Since there are lots of features that might be relevant (edge prominence, high-frequency energy, PSF estimation, unfiltered image OCR accuracy metrics (as @Matt mentions), etc.), lots of filters available (&lt;a href=&quot;http://www.mathworks.com/products/demos/image/ipexblind/ipexblind.html&quot; rel=&quot;nofollow&quot;&gt;blind deconvolution&lt;/a&gt;, &lt;a href=&quot;http://blogs.mathworks.com/steve/2007/08/13/image-deblurring-introduction/&quot; rel=&quot;nofollow&quot;&gt;among others&lt;/a&gt;), and you'll need lots of ground truth images to prove system effectiveness, you are looking at a lot of work and experimentation to create a system that works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need to make sure you are not working against the OCR software itself, which may do its own image processing to improve its accuracy. In other words, make sure that artifacts introduced by your deblurring do not make OCR accuracy worse, even if the deblurring was done &quot;well&quot; from a deblurring perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that being said, it should be possible to do this. You might even be able to do this adaptively, by automatically and iteratively adjusting parameters and approaches to optimize the result.&lt;/p&gt;&#xA;" OwnerUserId="1278" LastActivityDate="2013-04-23T01:03:55.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8798" PostTypeId="1" CreationDate="2013-04-22T23:06:07.173" Score="1" ViewCount="394" Body="&lt;p&gt;Given a sound clip (whose source is an FM radio signal) I'd like to measure how different from background noise (the &quot;in-between channels&quot; noise) the sound clip is, so that I can compare the &quot;non-noisiness&quot; (and thus the quality) of two radio signals. Is there a good way to do this?&lt;/p&gt;&#xA;" OwnerUserId="4416" OwnerDisplayName="Aqwis" LastActivityDate="2013-04-23T20:37:06.067" Title="Measuring how &quot;non-noisy&quot; a sound signal is" Tags="|sound|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8799" PostTypeId="1" CreationDate="2013-04-23T05:27:52.760" Score="4" ViewCount="2861" Body="&lt;p&gt;I want to up-sample my input signal by a factor of $2$. I saw zero padding followed by low pass filter method being used in few cases. But still I need some help in this. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Say I have $10$ input samples and my interpolating factor is $2$, then if I am doing interpolation using above method, will I get $20$ samples at the output?&lt;/li&gt;&#xA;&lt;li&gt;Also how to increase the pass-band gain of the low pass filter to $6.02\textrm{ dB}$?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4411" LastEditorUserId="1629" LastEditDate="2016-06-24T17:46:11.890" LastActivityDate="2016-06-24T17:46:11.890" Title="Interpolation by factor of 2" Tags="|filter-design|lowpass-filter|interpolation|" AnswerCount="3" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8800" PostTypeId="1" CreationDate="2013-04-23T06:20:53.357" Score="1" ViewCount="191" Body="&lt;p&gt;I am trying to extract only urban aeas from satellite imagery Using Matlab. I have applied some edge detectors like canny and also used morphological functions and I am able to extract all the boundaries ,but not able to seperate them from various urban aeas like roads, trees and waterbodies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help i can share the code if any one wants&lt;/p&gt;&#xA;" OwnerUserId="4412" LastActivityDate="2014-04-25T12:34:40.547" Title="Digital Image Processing" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8801" PostTypeId="2" ParentId="8798" CreationDate="2013-04-23T07:05:48.600" Score="3" Body="&lt;p&gt;If the noise is (close to) stationary, you could use one of the many noise-floor estimation methods to get an estimate of the noise power and, consequently, of the SNR. Search for &quot;noise floor estimation&quot; and &quot;noise floor tracking&quot;. You'll find a lot of publications and patents.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-23T07:05:48.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8802" PostTypeId="1" AcceptedAnswerId="8808" CreationDate="2013-04-23T07:18:39.213" Score="4" ViewCount="479" Body="&lt;p&gt;I have read in my textbook and i don't understand this part, that the Direct Form II implementation of an IIR filter is a bit tricky in memory addressing.There is need of clever memory addressing.  Memory is the place that we store partial summations(states of the filter). Anyone that understands the problem and explain to me?&lt;/p&gt;&#xA;" OwnerUserId="4157" LastActivityDate="2013-04-23T11:37:38.813" Title="Direct Form II , IIR filter" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8804" PostTypeId="1" CreationDate="2013-04-23T08:47:03.707" Score="2" ViewCount="29137" Body="&lt;p&gt;Can anyone tell me how does bit reversal order technique works for FFT when you are trying to break down the FFT to small sizes. Like I want to only for the when the index is odd because that involve some reverse carry propagation, but when the index is even you just add N/2 to it to get your reverse index r. An example of N=8 would be perfect if someone can explain me.&lt;/p&gt;&#xA;" OwnerUserId="3993" LastActivityDate="2022-05-25T20:09:16.987" Title="Bit reverse order Technique in FFT" Tags="|fft|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8806" PostTypeId="2" ParentId="8804" CreationDate="2013-04-23T09:23:32.680" Score="5" Body="&lt;p&gt;If I understand your question correctly you want this (index | binary | bit rev. | bit rev. index):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;0\quad        000\quad      000\quad 0\\&#xA;1\quad        001\quad      100\quad 4\\&#xA;2\quad        010\quad      010\quad 2\\&#xA;3\quad        011\quad      110\quad 6\\&#xA;4\quad        100\quad      001\quad 1\\&#xA;5\quad        101\quad      101\quad 5\\&#xA;6\quad        110\quad      011\quad 3\\&#xA;7\quad        111\quad      111\quad 7\\&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-23T09:23:32.680" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8807" PostTypeId="2" ParentId="8799" CreationDate="2013-04-23T11:25:04.297" Score="2" Body="&lt;p&gt;Looks like a bit of confusion here. Zero-padding (before an FFT) will provide interpolation in the frequency domain. Interpolation in the time domain is done (typically) by inserting zeros between samples and then applying a suitable low pass filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Suitable&quot; here depends highly on the requirements of your application, there is no &quot;one size fits all&quot; filter. Things to consider are passband ripple, phase distortion, residual aliasing, latency, stop band attenuation, causality, transient behavior, etc. Stanford's Julius Smith teaches a good course on the topic &lt;a href=&quot;https://ccrma.stanford.edu/~jos/Interpolation/&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/Interpolation/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-23T11:25:04.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8808" PostTypeId="2" ParentId="8802" CreationDate="2013-04-23T11:37:38.813" Score="3" Body="&lt;p&gt;The tricky part tends to be time shifting the state variables. You try to avoid spending extra cycles on explicitly doing this but ideally this can be all kept in registers or just happens during the natural flow of the instructions. The best way to do this will highly depend on your instruction set and/or specific capabilities of the hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general Direct Form II is a poor choice. The transfer function between the input and the state variables is vine solely through the poles which leads frequently to stability and noise problems. Transposed Form II is almost always the better choice. Only exception would be a fixed point processor with a double precision accumulator in which Direct Form I would be the preferred choice. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-23T11:37:38.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8809" PostTypeId="1" AcceptedAnswerId="8810" CreationDate="2013-04-23T13:10:14.927" Score="1" ViewCount="66" Body="&lt;p&gt;I'm trying to understand this code, however I'm unable to deduce the meaning of reds and trans. I would be glad if you can help with it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import sys&#xA;import Image&#xA;&#xA;# pixel constants in hex&#xA;trans=&quot;\x00\x00\x00\x00&quot;&#xA;# reds most to least, the last is trans and used as a noise factor&#xA;reds=(&quot;\xf1\x34\x00\xff&quot; , &quot;\xfa\x00\x2f\xff&quot;,&#xA;   &quot;\xf1\x36\x36\xff&quot;, &quot;\xfe\x74\x74\xff&quot;, &quot;\xfe\xc3\xc3\xff&quot;,&#xA;   &quot;\xf9\xcb\xcb\xff&quot;, &quot;\xf1\xd3\xd3\xff&quot;, &quot;\x00\x00\x00\x00&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The complete code is at: &lt;a href=&quot;https://matsu-project.googlecode.com/svn-history/r28/trunk/streaming-image-processing/src/reduce.py&quot; rel=&quot;nofollow&quot;&gt;https://matsu-project.googlecode.com/svn-history/r28/trunk/streaming-image-processing/src/reduce.py&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4417" LastActivityDate="2013-04-23T13:15:45.817" Title="What are reds and trans in Image processing" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8810" PostTypeId="2" ParentId="8809" CreationDate="2013-04-23T13:15:45.817" Score="3" Body="&lt;p&gt;The numbers appear to be &lt;a href=&quot;http://www.css3.info/preview/rgba/&quot; rel=&quot;nofollow&quot;&gt;RGBA&lt;/a&gt; values: red, green, blue, and alpha (transparency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;reds&lt;/code&gt; appear to be mostly red-tinted colors (except the last entry, which is a completely transparent  item).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;trans&lt;/code&gt; is the transparent &quot;color&quot;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-23T13:15:45.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8811" PostTypeId="2" ParentId="8799" CreationDate="2013-04-23T14:47:42.930" Score="2" Body="&lt;p&gt;When you upsample by a factor of two by inserting a zero between each sample you create an alias of your signal centered at the new Nyquist frequency (half the new sample rate).  You get rid of the alias by low-pass filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The specifications of the filter that you need depend on your signal.  Say that your signal has one-sided bandwidth $B$ (by one-sided I mean that we are only talking about the positive frequencies, not the negative ones).  $B$ must have been less than the Nyquist frequency of the old sample rate, $f_{sOld}$, to avoid aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lhoq8.png&quot; alt=&quot;Original signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you upsample the alias appears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4WEZE.png&quot; alt=&quot;Interpolated signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully these pictures will help to gain an intuitive grasp of how to characterize the required low-pass filter.  The passband must be flat from 0 Hz to $B$ Hz, and it must cutoff at $\frac{f_{sNew}}{2} - B = f_{sOld} - B$.  The amount of attenuation that is required in the cutoff region depends on your application.  Usually 50 dB is more than sufficient.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-04-23T14:47:42.930" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8812" PostTypeId="5" CreationDate="2013-04-23T17:04:24.777" Score="0" Body="&lt;p&gt;OFDM stands for orthogonal, frequency-division multiplexing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing&quot; rel=&quot;nofollow&quot;&gt;wikipedia page&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-23T17:04:24.777" LastActivityDate="2013-04-23T17:04:24.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8813" PostTypeId="4" CreationDate="2013-04-23T17:04:24.777" Score="0" Body="OFDM stands for Orthogonal, Frequency-Division Multiplexing." OwnerUserId="80" LastEditorUserId="4346" LastEditDate="2017-02-12T20:39:00.257" LastActivityDate="2017-02-12T20:39:00.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8814" PostTypeId="2" ParentId="8799" CreationDate="2013-04-23T17:23:22.797" Score="1" Body="&lt;p&gt;If you must zero-pad to do a 2X interpolation, one solution is to zero-pad around Fs/2 in the frequency domain, and then IFFT this 2X longer vector to produce the 2X longer time domain data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, additional zero-padding in the time domain before the first FFT might help reduce circular convolution effects (assuming that that is less offensive than tapering to the padding level at the data edges).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-04-23T17:23:22.797" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8815" PostTypeId="1" AcceptedAnswerId="8817" CreationDate="2013-04-23T18:20:32.343" Score="1" ViewCount="970" Body="&lt;p&gt;I have a wav file which is gained by playing 2 different wav files with 2 speakers and recorded with mic. If I want to get one of the original signals using the resulting wav file and the other original wav file, is it possible to do this? I checked online and only got blind signal separation algorithm. Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="4161" LastEditorUserId="128" LastEditDate="2018-08-10T06:23:12.437" LastActivityDate="2018-08-10T06:23:12.437" Title="One Source Signal Separation" Tags="|matlab|discrete-signals|continuous-signals|source-separation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8816" PostTypeId="2" ParentId="8815" CreationDate="2013-04-23T18:39:54.070" Score="2" Body="&lt;p&gt;Let's sum your problem. Assuming the transfer function of the whole signal transmission chain from the source 1 to the recorded signal (DAC, speaker, room, microphone, ADC...) is $h_1$ (and $h_2$ from source 2 to microphone), then the signals you have complete access too are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$(h_1 \star x_1)(n) + (h_2 \star x_2)(n)$ (the resulting signal)&lt;/li&gt;&#xA;&lt;li&gt;$x_1(n)$ (one of the original signals).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And your problem is that you want to recover $x_2$? Then this is the same setup as &lt;a href=&quot;https://dsp.stackexchange.com/questions/8763/subtracting-one-audio-stream-from-another-audio-stream&quot;&gt;this question&lt;/a&gt;, and certainly not a problem of source separation - since one of the signals is already known (up to a convolution). You can get an estimate of $h_1$, and recover $h_2 \star x_2$. And if you can assume that $h_1$ and $h_2$ are similar, you can try inverting $h_2$ and get a result closer to $x_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be a true BSS problem is you had no prior information about both $x_1$ and $x_2$, in which case it would have been intractable (unless some assumptions can be made about the way these sounds are produced - eg one of them is speech and the other is background music).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-04-23T18:39:54.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8817" PostTypeId="2" ParentId="8815" CreationDate="2013-04-23T18:41:14.697" Score="2" Body="&lt;p&gt;Let's call your signals $x_1$ and $x_2$. The recorded signal is $y$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) = (x_1*h_1)(n) + (x_2*h_2)(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n$ is the sample (time) index, and $h_1$ and $h_2$ are the room impulse responses from the respective speakers to the mic. Assume you want to retrieve $x_2$ from $y$ with the knowledge of $x_1$. You can apply echo cancellation methods to remove the part in $y$ stemming from $x_1$.&#xA;What you get is $(x_2*h_2)(n)$ plus some residual from $x_1$ due to imperfect echo cancellation. If you also want to get rid of the effect of $h_2$, you must resort to blind deconvolution methods, which is a lot harder (and you need to know or assume some things about the desired signal $x_2$).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-23T18:41:14.697" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8818" PostTypeId="1" CreationDate="2013-04-23T18:44:54.700" Score="1" ViewCount="166" Body="&lt;p&gt;Three methods of estimating maximum signal level at a node:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Worst Case Min-Max (L1-Norm)   &lt;/li&gt;&#xA;&lt;li&gt;Mean Square (L2-Norm)  &lt;/li&gt;&#xA;&lt;li&gt;Frequency Domain (Linfinity-Norm)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RQ7rX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matlab i found the code for L1, L2&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;Hfull=[h(r,:),conj(fliplr(h(r,2:end-1)))];&#xA;L1(r)=sum(abs(ifft(Hfull)));&#xA;L2(r)=sqrt(mean(Hfull.*conj(Hfull)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For Linf is correct the below?:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linf(r)=max(abs(Hfull));&lt;/p&gt;&#xA;" OwnerUserId="4157" LastActivityDate="2013-04-23T18:44:54.700" Title="Signal level estimation, matlab" Tags="|matlab|filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8819" PostTypeId="2" ParentId="8736" CreationDate="2013-04-23T19:10:19.333" Score="1" Body="&lt;p&gt;This paper is specific to LTE, but it describes the synchronization of the OFDM physical layer really well:&#xA;&quot;A Closed Concept for Synchronization and Cell Search in 3GPP LTE Systems&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I highly recommend it and based an academic paper from it by verifying the results.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastActivityDate="2013-04-23T19:10:19.333" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8820" PostTypeId="2" ParentId="8798" CreationDate="2013-04-23T20:37:06.067" Score="3" Body="&lt;p&gt;@Matt's answer is nice and general (+1), but I would also look at the noise level in silent passages on a tuned station. Since there is a carrier frequency, this might be different from noise levels measured &quot;in-between channels&quot; where there is no carrier, as you suggest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, this might not be what you are asking about, but since your source is FM radio, which presumably contains a lot of music, you could find a pristine (i.e. uncompressed) copy of a song playing on the radio, time-align the signals from the radio and the reference song, and compare the spectra. The difference would be noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a problem with this approach, however, and that is the fact that many radio stations equalize and apply dynamic range compression and other effects to the music they play. This will lead to differences in the reference and recorded spectra not created by noise. Perhaps public or college radio would not mess with the broadcast signal, but that is just a guess.&lt;/p&gt;&#xA;" OwnerUserId="1278" LastActivityDate="2013-04-23T20:37:06.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8821" PostTypeId="1" CreationDate="2013-04-23T20:52:33.840" Score="5" ViewCount="1332" Body="&lt;p&gt;&lt;strong&gt;Question Details:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a variety of image processing algorithms useful for detecting reference marks (contour tracing, FAST, MSER, Haar Feature-based Cascade Classifier, or even just Harris Edge detector, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a variety of simple geometric shapes one might pick for use as reference marks (circle, square, X, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if someone has some experience with what combinations work best? Some additional criteria I have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;using an algorithm implemented in openCV would be great&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Background invariance: detection algorithm should be robust against&#xA;random background features(folds in clothing, random sharp corners, random&#xA;colors present in background, speckle noise)   &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Distance invariance: detection algorithm should be stable with&#xA;respect to scale. (i.e. is should work whether the reference mark&#xA;takes up a 100x100 pixel square in the image or 30x30 pixel square)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Angle invariance: detection algorithm should not fail if the&#xA;reference mark is viewed at an angle&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I am using a 640x480 webcam as a source of the images, so image processing at better than 5-10 fps would be nice&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Additional Info:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to print out a fixed number black shapes on white paper. Place them in arbitrary positions in the scene that I am imaging with a webcam, and try to detect the center coordinates of each of the black shapes using a c++ program w/ openCV. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if there is any consensus about what type of shape is the easiest to detect and how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Approaches that I have tried:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Detecting concentric circles using contour tracing: 1) Find the contours that are n times nested 2) compute the center point.  The problem is that it is hard to resolve the rings at far distances (&gt;5 feet) and angles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Detecting cross shapes using contour tracing: 1) find contours, 2) find convex hull of each contour, 3) find number of convexity defects 4) compute the center if convexity defects == 4. Alternatively I have tried finding the depth of each convexity defect and comparing it to the width of the bounding rectangle around the contour to determine if it is a &quot;real&quot; convexity defect or just due to noise. This method works but sometimes certain background features, like folds in clothing, can make extra objects detected.&lt;/p&gt;&#xA;" OwnerUserId="4421" LastActivityDate="2017-02-01T10:24:55.543" Title="What are some easy to detect reference mark shapes and corresponding detection methods?" Tags="|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8822" PostTypeId="2" ParentId="8821" CreationDate="2013-04-23T21:04:26.120" Score="2" Body="&lt;p&gt;These marks (in the electronics manufacturing industry) are usually called &lt;a href=&quot;http://en.wikipedia.org/wiki/Fiduciary_marker&quot; rel=&quot;nofollow noreferrer&quot;&gt;fiducials or fiducial markers&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.accutroninc.com/pdf/download/fiducial.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper from Accutron suggests&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HqvrN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though I have no reference (or even measure) of the &quot;optimality&quot; of the disk / circle.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-23T21:04:26.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8824" PostTypeId="1" CreationDate="2013-04-24T03:08:34.820" Score="2" ViewCount="405" Body="&lt;p&gt;This is just an idea. How can we model the kalman filter to get the state representation in continuous space when the observations to the system are actually from the discrete space. The discrete observation, for example, can be sequence of digits (0-9) where the digits themselves do not have numerical meaning but the sequence of observations are correlated. I know we can try Hidden Markov Model (HMM) for this, but I would like to get the continuous (real-valued vector) space state representation rather than the discrete space as in HMM.&lt;/p&gt;&#xA;" OwnerUserId="4423" LastActivityDate="2013-04-24T03:08:34.820" Title="Kalman Filter: continuous state space, discrete observations" Tags="|discrete-signals|kalman-filters|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8825" PostTypeId="1" CreationDate="2013-04-24T06:25:07.613" Score="6" ViewCount="438" Body="&lt;p&gt;Here's my problem. The input signals $x$ and $y$ will be having the time value aligned with each other. However, the data are not evenly sampled. I would like to calculate CPSD of both signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution comes to my mind is as follow&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$R_{xy}$ = cross correlation of $x$ and $y$ (I'm not sure how to do it with unevenly sampled data)&lt;/li&gt;&#xA;&lt;li&gt;Use Lomb Periodogram to estimate the CPSD of Rxy&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there anything I miss? And what is the right way to do it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sam Maloney suggested to use interpolation to fill the gap to produce evenly sampled data. &#xA;This solution is good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the data I obtained may have some missing data / long gap. Interpolating the data may &quot;predict&quot; the data wrongly and produce undesired end result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As quoted in &lt;a href=&quot;http://www.mpi-hd.mpg.de/astrophysik/HEA/internal/Numerical_Recipes/f13-8.pdf&quot; rel=&quot;nofollow&quot; title=&quot;Numerical Recipes Chapter 13.8&quot;&gt;Numerical Recipes (Spectral Analysis of Unevenly Sampled&#xA;Data)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, the experience of practitioners of such interpolation techniques is not reassuring. Generally speaking, such techniques perform poorly. Long gaps in the data, for example,&#xA;  often produce a spurious bulge of power at low frequencies (wavelengths comparable to gaps)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is the reason why I choose Lomb Periodogram over FFT in &lt;strong&gt;Step 2&lt;/strong&gt; without interpolating the data. However, I'm unable to figure out how to solve the &lt;strong&gt;Step 1&lt;/strong&gt;. Is there any way to calculate the cross correlation of 2 signals without interpolating them? &lt;/p&gt;&#xA;" OwnerUserId="4425" LastEditorUserId="4425" LastEditDate="2013-04-29T02:30:01.010" LastActivityDate="2013-04-29T02:30:01.010" Title="Cross Power Spectral Density of Unevenly Sampled Data" Tags="|discrete-signals|cross-correlation|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8826" PostTypeId="1" CreationDate="2013-04-24T06:36:33.720" Score="4" ViewCount="407" Body="&lt;p&gt;I am currently working on the FFT function in MATLAB. In this function, i require a 1024 number of data Time Domain plot and produce a 400 number of data Frequency domain plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying the FFT function, i obtain a result of a graph going up to 6000Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the Frequency band produced is too big and I only wanna analyze between 0 ~ 500 Hz.&#xA;I applied the Chirp-Z transform to obtain the band of 0 ~ 500 Hz, at the same time retaining the output as 400 number of data. This is what I obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LkkPS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem arise as I made a comparison to the graph originally in Frequency Domain already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6XoPJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please note that I have already both the original graphs - Time and Frequency domain to make comparison with)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I compared the graph from MATLAB and the original one, there seems to be extra 'fingers' or so present when its supposed to be a straight line. What could be the problem and its appropriate solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;EDIT 1&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After trying almost all available Window functions, the taylorwin Window function seems the best and this is the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vuQYd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However it still does not produce a graph that is almost similar to the original graph&lt;/p&gt;&#xA;" OwnerUserId="4427" LastEditorUserId="2046" LastEditDate="2015-08-26T09:07:01.507" LastActivityDate="2015-08-26T09:07:01.507" Title="Extra 'fingers' found in graph after applying FFT in MATLAB" Tags="|fft|matlab|" AnswerCount="0" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="8827" PostTypeId="1" AcceptedAnswerId="8829" CreationDate="2013-04-24T07:16:31.607" Score="6" ViewCount="679" Body="&lt;p&gt;I'm trying to understand how DFT works exactly. However, when experimenting around, I compared both Matlab generated FFT result with a dummy approach result and I get similar result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the Imaginary part of both results are negated. The code below is my implementation. The implementation of dummy approach is based on &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Definition&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Definition&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_k = \sum_{n=0}^{N-1}x_n . e^{-i2\pi kn/N}\,.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 500; % Sampling frequency &#xA;T = 1/Fs; % Sample time &#xA;N = 1000; % Length of signal&#xA;t = (0:N-1)*T; % Time vector &#xA;x = cos(2*pi*100*t)+randn(size(t));&#xA;&#xA;% Calculate by using Matlab build-in FFT &#xA;fdft = fft(x);&#xA;&#xA;% A dummy way to calculate DFT&#xA;n = 0:N-1;&#xA;k = 0:N-1;&#xA;kn = bsxfun(@times, n', k);&#xA;dummydft = x * exp(-i * 2 * pi * kn / N )';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anything I miss? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4430" LastEditorUserId="4430" LastEditDate="2013-04-24T08:07:23.093" LastActivityDate="2013-04-24T08:07:23.093" Title="Discrete Fourier Transform a dummy approach" Tags="|fft|matlab|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8828" PostTypeId="1" CreationDate="2013-04-24T07:19:46.900" Score="1" ViewCount="56" Body="&lt;p&gt;I have a raw infrared image with 16384(2^14) intensity levels.The raw image must be compressed into one with 256(2^8) intensity levels. In order to retain the original details( small blocks) , the compressed image must be enhanced. Which the best method I should select?Someone advice that &quot;histogram matching&quot; method should be taken.But the both images are different in intensity levels,how can do it?Any advice will be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4429" LastActivityDate="2013-04-24T10:52:53.943" Title="Which method should be selected to enhance the compressed image?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8829" PostTypeId="2" ParentId="8827" CreationDate="2013-04-24T07:56:49.650" Score="10" Body="&lt;p&gt;It should be OK. You did not specify how you obtain the vector $t$ used in generating $x$, but otherwise everything seems fine. I haven't used $\tt{bsxfun}$ but I would simply write the DFT like this:&#xA;$$\tt{dummydft=x*exp(-2*pi*i*(n'*k)/N);}$$&#xA;I've tried it and it gives the same result as $\tt{fft(x)}$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-24T07:56:49.650" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8830" PostTypeId="1" AcceptedAnswerId="8837" CreationDate="2013-04-24T10:52:22.470" Score="15" ViewCount="16255" Body="&lt;p&gt;I want to know how I can determine whether a series of data is periodic or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use Fourier transform/series. My data looks either aperiodic &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[111100001111000110010101010000101] &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;or periodic &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[11001100110011001100]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and I need to decide which it is automatically. What types of analyses or calculations can I perform to determine if a signal is periodic or not?&lt;/p&gt;&#xA;" OwnerUserId="4432" LastEditorUserId="4355" LastEditDate="2013-04-25T22:58:51.150" LastActivityDate="2013-04-30T15:46:28.517" Title="How do I determine if a discrete signal is periodic or not?" Tags="|frequency|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8831" PostTypeId="2" ParentId="8828" CreationDate="2013-04-24T10:52:53.943" Score="2" Body="&lt;p&gt;I would advise you to try between two different approaches, then test and see which one performs best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first one is &lt;strong&gt;intensity clustering&lt;/strong&gt;. In this approach, you data points are one-dimensional and correspond to the intensity of your raw pixels. Then, run a clustering algorithm such as $k$-means with $k = 256$, and perform the final quantization by replacing the intensity of each pixel by the mean value (or the index) of the corresponding cluster mean. With this approach you can limit the information loss by forming an image of indices and keeping a look-up table of the real (14 bits) cluster mean values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second would be to perform some &lt;a href=&quot;http://en.wikipedia.org/wiki/Clahe#CLAHE&quot; rel=&quot;nofollow&quot;&gt;local histogram equalization&lt;/a&gt;, i.e., cutting your image into blocks and performing equalization (or any other enhancement procedure) on each block.&#xA;You will obtain an image where the features are mstly preserved and that you can remap linearly into $[0,255]$.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-04-24T10:52:53.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8832" PostTypeId="2" ParentId="8804" CreationDate="2013-04-24T11:56:30.393" Score="6" Body="&lt;p&gt;To find the next bit-reversal address, you simply add N/2 to the present address, &lt;strong&gt;from left to right&lt;/strong&gt; (not our usual right-to-left addition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the case as in the image given by Matt's answer, N = 8. that corresponds to 1000. Therefore, N/2 = 4 = 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take first address, X = 000 | add N/2 =&gt; 100, ie bit_reverse address = 4 (100)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now take new one, X = 100 | add N/2, be careful here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to add &lt;strong&gt;from left-to-right&lt;/strong&gt;, just opposite of what you normally do during addition.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;address  1 0 0 +&#xA;N/2      1 0 0&#xA;         ------&#xA;result   0 1 0  ----&amp;gt; 2&#xA;carry    1 0 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you continue this steps, and you will generate address like this, 0--&gt;4--&gt;2--&gt;6--&gt;1--&gt;5--&gt;3--&gt;7.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's us do one more example. Suppose you reached bit-reversed address Y = 5. You need to find next address, simply add N/2 to that. (We know answer is 3).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;address  1 0 1 +&#xA;N/2      1 0 0&#xA;         ------&#xA;result   0 1 1  ----&amp;gt; 3&#xA;carry    1 0 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is how you generate bit-reversed address. &lt;/p&gt;&#xA;" OwnerUserId="818" LastActivityDate="2013-04-24T11:56:30.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8833" PostTypeId="1" CreationDate="2013-04-24T12:43:01.183" Score="5" ViewCount="1338" Body="&lt;p&gt;I am trying to implement speech recognition using backpropagation algorithm, and I have been following &lt;a href=&quot;http://research.ijcaonline.org/volume42/number12/pxc3877946.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&#xA;I have followed it all the way, except that it tells me to zero-pad the coefficients when there is an empty slot, because the MFCC coefficients of two samples are not the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is, do I randomly distribute the zeros through the coefficients, or is there a  rule of some type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S- I have perused &lt;a href=&quot;https://stackoverflow.com/questions/6932096/matching-two-series-of-mfcc-coefficients&quot;&gt;this paper&lt;/a&gt; as well; however, the question does not relate to taking the MFCC coefficients an inputs. &lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2016-05-19T07:47:16.323" Title="Zero-padding of MFCC coefficients" Tags="|matlab|speech-recognition|mfcc|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8834" PostTypeId="1" CreationDate="2013-04-24T12:58:08.233" Score="3" ViewCount="5589" Body="&lt;p&gt;I use this snippet of python code to transform data to Fourier phase and magnitude and then retrieving original data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from random import randint as RI&#xA;import numpy.fft as FFT&#xA;import math&#xA;&#xA;w = 4&#xA;h = 4&#xA;random_range = 255&#xA;&#xA;vals = [[] for i in range(h)]&#xA;&#xA;for i in range(h):&#xA;    for j in range(w):&#xA;        vals[i].append(RI(0,random_range))&#xA;&#xA;fftc = FFT.fft2(vals) &#xA;&#xA;magnitudes = [[] for i in range(h)]&#xA;phases = [[] for i in range(h)]&#xA;&#xA;for i in range(h):&#xA;    for j in range(w):&#xA;        magnitudes[i].append(math.sqrt(fftc[i][j].real**2+fftc[i][j].imag**2))&#xA;        phases[i].append(math.atan(fftc[i][j].imag/fftc[i][j].real))&#xA;&#xA;for_ifft = [[] for i in range(h)]&#xA;&#xA;for i in range(h):&#xA;    for j in range(w):&#xA;        rl = magnitudes[i][j]*math.cos(phases[i][j])&#xA;        im = magnitudes[i][j]*math.sin(phases[i][j])&#xA;        for_ifft[i].append(complex(rl,im))&#xA;&#xA;&#xA;ifftc = FFT.ifft2(for_ifft)&#xA;&#xA;&#xA;print vals&#xA;print ifftc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When i compare outputs, results are different. for example two typical outputs are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//original data&#xA;[[115, 4, 33, 91], [228, 123, 46, 111], [83, 227, 81, 55], [229, 188, 138, 41]]&#xA;&#xA;//retrieved data from phase and magnitude informations&#xA;[[ 309,182.25,105,57.25],[ 33,118.75,120.50,116.25],[ 148,128.75,79,94.75],[ 165,112.25,-6.50,29.75]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know the theory behind it. for example for calculating phase and magnitude we do this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Magnitude = Square_Root(real*real+imaginary*imaginary)&#xA;Phase = Inverse_Tangent(imaginary/real)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and for calculating complex number from magnitude and phase we do this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Real = Magnitude * cos(Phase)&#xA;Imaginary = Magnitude * sin(Phase)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, what is the cause of problem. Is it a data scaling issue.&lt;/p&gt;&#xA;" OwnerUserId="4408" LastActivityDate="2013-04-25T12:46:44.100" Title="retrieving original data from phase and magnitude of Fourier transform" Tags="|fft|dft|phase|magnitude|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8835" PostTypeId="2" ParentId="8780" CreationDate="2013-04-24T13:19:54.290" Score="1" Body="&lt;p&gt;The magnitude of the roots does not give you the format gain. You need to evaluate the frequency response of the filter $H(z)=\frac{1}{A(z)}$, where $A(z)$ is the polynomial returned by the LPC function, at the point on the unit circle corresponding to the desired format frequency. Like this freqz(1,a, angle(r)) for instance.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-04-24T13:19:54.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8836" PostTypeId="2" ParentId="8834" CreationDate="2013-04-24T13:20:20.890" Score="4" Body="&lt;p&gt;You need to change how you're calculating the phase from &quot;atan&quot; to &quot;atan2&quot;.  The reason is that atan doesn't work in all quadrants.  More on atan2 &lt;a href=&quot;http://en.wikipedia.org/wiki/Atan2&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-04-25T12:46:44.100" LastActivityDate="2013-04-25T12:46:44.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8837" PostTypeId="2" ParentId="8830" CreationDate="2013-04-24T13:29:56.523" Score="15" Body="&lt;p&gt;I would do a normalized &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;noreferrer&quot;&gt;autocorrelation&lt;/a&gt; to determine periodicity.  If it is periodic with period $P$ you should see peaks at every $P$ samples in the result.  A normalized result of &quot;1&quot; implies perfect periodicity, &quot;0&quot; implies no periodicity at all at that period, and values in between imply imperfect periodicity.  Subtract the data sequence's mean from the data sequence before doing the autocorrelation because it will bias the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The peaks will tend to diminish the farther away from the center they get simply because of having fewer overlapping samples.  You can mitigate that effect by multiplying the results by the inverse of the percentage of overlapping samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;U(n) = A(n) * \frac{N}{\lvert N-n\rvert}&#xA;$$&#xA;where $U(n)$ is the un-biased autocorrelation, $A(n)$ is the normalized autocorrelation, $n$ is the offset, and $N$ is the number of samples in the data sequence that you are checking for periodicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: This is an example of how to tell if the sequences are periodic.  The following is Matlab code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s1 = [1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 0 1 0 1];&#xA;s1n = s1 - mean(s1);&#xA;plot(xcorr(s1n, 'unbiased'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &quot;unbiased&quot; parameter to the xcorr function tells it to do the scaling described in my equation above.  The auto-correlation is not normalized, though, which is why the peak at the center is around 0.25 instead of 1.  That doesn't matter, though, as long as we keep in mind that the center peak is perfect correlation.  We see that there are no other corresponding peaks except at the outermost edges.  Those do not matter because there there is only one sample overlapping, so that is not meaningful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WVd7i.png&quot; alt=&quot;Non-periodic&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s2 = [1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0];&#xA;s2n = s2 - mean(s2);&#xA;plot(xcorr(s2n, 'unbiased'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here we see that the sequence is periodic because there are multiple unbiased autocorrelation peaks with the same magnitude as the center peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VKbe2.png&quot; alt=&quot;Periodic&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-04-30T12:23:28.630" LastActivityDate="2013-04-30T12:23:28.630" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="8838" PostTypeId="2" ParentId="8781" CreationDate="2013-04-24T14:38:52.100" Score="2" Body="&lt;p&gt;You should go for the polyphase implementation of wavelet filter bank.&#xA;You are referred to the book&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://books.google.ca/books/about/Wavelets_and_Filter_Banks.html?id=Z76N_Ab5pp8C&amp;amp;redir_esc=y&quot; rel=&quot;nofollow&quot;&gt;Wavelets and Filter Banks, by Gilbert Strang and Truong Nguyen&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="4344" LastEditDate="2013-04-24T17:49:50.687" LastActivityDate="2013-04-24T17:49:50.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8839" PostTypeId="1" CreationDate="2013-04-24T16:59:11.107" Score="3" ViewCount="1387" Body="&lt;p&gt;I am implementing &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;phase correlation algorithm&lt;/a&gt; to determine shift between two images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It generally works, but I am not sure how to interpret the resulting shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ft1 = FT(input1)&#xA;ft2 = FT(input2)&#xA;&#xA;for each pixel p&#xA;  product = ft1[p] * conj(ft2[p])&#xA;  cross_power[p] = product / abs(product)&#xA;&#xA;cross_correlation = IFT(cross_power)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where FT and IFT are Discrete Fourier Transform and its inverse, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are input images and resulting phase correlation taken from Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WU0yP.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/KMbvX.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/DHezX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The peak is located at (20, 21) which corresponds to shifting of the second image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have obtained similar result, but it comes out flipped:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oOipc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I flip the input images the peak appears at the top left corner of the phase correlation image but how to interpret this as a negative shift (-20, -21)? Based on image quadrants?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Fourier transform routine from Math.NET Numerics package. It provides only 1D FT, so I am doing transforms of rows and then columns to obtain 2D FT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to extract shift from the peak position allowing for negative shifts as well?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is the peak located differently in my result?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2013-04-24T17:05:40.577" LastActivityDate="2019-01-18T07:29:11.887" Title="Phase Correlation and Negative Shifts" Tags="|fft|fourier-transform|dft|phase|correlation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8840" PostTypeId="1" AcceptedAnswerId="8845" CreationDate="2013-04-24T19:54:07.090" Score="11" ViewCount="30575" Body="&lt;p&gt;I've used &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot;&gt;Kalman filters&lt;/a&gt; for various things in the past, but I'm now interested in using one to track position, speed and acceleration in the context of tracking position for smartphone apps.  It strikes me that this should be a text book example of a simple linear Kalman filter, but I can't seem to find any online links which discuss this.  I can think of various ways of doing this, but rather than researching it from scratch, perhaps someone here can point me in the right direction:&lt;ol&gt;&lt;li&gt;Does anyone know the best way of setting up this system?  For example, given the recent history of position observations, what's the best way of predicting the next point in the Kalman filter state space?  What are the advantages and disadvantages of including acceleration in the state space?  If all measurements are position, then if speed and acceleration are in the state space can the system become unstable?  Etc ...&lt;/li&gt;&lt;li&gt;Alternatively, does anyone know of a good reference for this application of Kalman filters?&lt;/li&gt;&lt;/ol&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4436" LastActivityDate="2014-02-22T09:45:55.153" Title="Implementing a Kalman filter for position, velocity, acceleration" Tags="|kalman-filters|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8841" PostTypeId="1" AcceptedAnswerId="8842" CreationDate="2013-04-24T21:06:38.473" Score="3" ViewCount="2685" Body="&lt;p&gt;I have quite a straight-forward question. What I aim for is the generation of a certain set of random numbers with a normal distribution (&lt;code&gt;mu = 0&lt;/code&gt;, &lt;code&gt;sigma = 1&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the best way to approach the above mentioned gaussian bell is to generate quite a large number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, in my case, I can only generate a &lt;strong&gt;retained subset of samples&lt;/strong&gt;: usually around &lt;code&gt;2048&lt;/code&gt; samples, which lead to a poor fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am actually wondering if there is any way to improve the fitness, by first generating a larger set of samples or more subsets of the same size (as 10 times 2048 samples) and then pick those 2048 which approximate the best for desired &lt;strong&gt;mean&lt;/strong&gt; and &lt;strong&gt;standard deviation&lt;/strong&gt; (and the gaussian of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would you suggest or how would you proceed?&lt;/p&gt;&#xA;" OwnerUserId="3666" LastActivityDate="2018-04-19T18:18:20.250" Title="Gaussian random generator" Tags="|matlab|gaussian|random|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8842" PostTypeId="2" ParentId="8841" CreationDate="2013-04-25T00:14:02.447" Score="5" Body="&lt;p&gt;To elaborate on Dilip's answer (which is perfectly correct, though in practice the &lt;a href=&quot;http://en.wikipedia.org/wiki/Ziggurat_algorithm&quot;&gt;Ziggurat method&lt;/a&gt; is much more computationally efficient than Box-Mueller):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One key ingredient missing from your reasoning is whether you want your samples to be independent. It is not clear from your question, but this is the most common situation...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want your samples to be independent, then you will have to accept that their empirical mean and variance will not exactly be 0 and 1 - what is known is that the larger the sample, the closer the empirical values will be to 0, 1 - this is absolutely fine - this is a &quot;feature&quot; of the normal distribution rather than a &quot;bug&quot;. It is a bad idea to try to select the samples that look more &quot;random&quot; or &quot;well-behaved&quot;; because this very selection process is making them less random! For example, if you come up with a process that always results in 2048-sample blocks with exactly $\mu = 0$ and $\sigma = 1$, it would mean that there are only 2046 possible degrees of freedom in your generation process, and thus that your samples are not independent (given the 2046 first samples, you can guess the values of the 2047th and 2048th using the $\mu = 0$ and $\sigma = 1$ equation... so these last two values are not random!).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-04-25T00:14:02.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8843" PostTypeId="2" ParentId="8841" CreationDate="2013-04-25T03:20:39.790" Score="4" Body="&lt;p&gt;Dilip and pichenettes have already pointed out two methods for generating Gaussian random variables (the &lt;a href=&quot;http://en.wikipedia.org/wiki/Box-Muller&quot; rel=&quot;nofollow&quot;&gt;Box-Muller transform&lt;/a&gt; and the &lt;a href=&quot;http://en.wikipedia.org/wiki/Ziggurat_algorithm&quot; rel=&quot;nofollow&quot;&gt;Ziggurat algorithm&lt;/a&gt;). For completeness, I will point out another: &lt;a href=&quot;http://en.wikipedia.org/wiki/Inverse_transform_sampling&quot; rel=&quot;nofollow&quot;&gt;inverse transform sampling&lt;/a&gt;. I recently had the need to create a maximum-throughput software Gaussian random number generator, and after evaluating all of the methods that I could find, I settled on this one, as it proved to be the fastest on the target system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea of inverse transform sampling is that you start with a base random generator that yields uniform values over some interval, typically $[0, 1)$ (or some variation of whether the interval is open or closed on either end). You then apply those uniform values to a function that is chosen such that the resulting outputs will have the desired distribution. The setup for this technique goes like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Select the distribution that you want to generate random numbers from. Determine its &lt;a href=&quot;http://en.wikipedia.org/wiki/Cumulative_distribution_function&quot; rel=&quot;nofollow&quot;&gt;cumulative distribution function (cdf)&lt;/a&gt; $F_x(x)$. For the Gaussian distribution, this function is:&#xA;$$&#xA;F_x(x) = \frac{1}{2}\left(1 + \operatorname{erf}\left(\frac{x-\mu}{\sqrt{2\sigma^2}}\right)\right)&#xA;$$&#xA;where $\operatorname{erf}(z)$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Error_function&quot; rel=&quot;nofollow&quot;&gt;error function&lt;/a&gt;. For the standard Gaussian distribution, $\mu = 0$ and $\sigma = 1$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Invert the distribution's CDF to yield its inverse CDF $F^{-1}_x(x)$, sometimes called the &lt;a href=&quot;http://en.wikipedia.org/wiki/Quantile_function&quot; rel=&quot;nofollow&quot;&gt;quantile function&lt;/a&gt;. This is often difficult or impossible to do in a compact analytical form, so you might need to rely upon numerical approximations. For the standard Gaussian distribution, this is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Probit_function&quot; rel=&quot;nofollow&quot;&gt;probit function&lt;/a&gt;, which can be obtained from the above expression for the cdf:&#xA;$$&#xA;F^{-1}_x(x) = \sqrt{2}\operatorname{erf}^{-1}(2x - 1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your computing environment has an implementation of the inverse error function, then this should be easy to evaluate. Otherwise, you'll need to rely upon some numerical approximation of the function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Armed with the above information, you can now generate values from the desired distribution. The simple procedure is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate a uniform value $u$ on the interval $[0, 1)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate $y = F^{-1}_x(u)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Output $y$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Assuming that you have a good base uniform generator (and a good implementation of the inverse CDF function), the resulting samples of $y$ should be distributed very closely to the desired distribution. There are a couple nice things about this technique:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It is very general; while I talked about Gaussian random number generation above, you can use this successfully with many distributions by just changing the function you use for the inverse CDF.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have a simple implementation of the inverse CDF function, it can be very fast (although the speed of the uniform generator is important). I was able to squeeze more speed out of this method than the Ziggurat algorithm by using an inverse CDF approximation that didn't use any logical checks or branching.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-04-25T03:20:39.790" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8844" PostTypeId="1" AcceptedAnswerId="8847" CreationDate="2013-04-25T04:36:39.357" Score="5" ViewCount="1121" Body="&lt;p&gt;In my filter specs, the passband gain is given as 6.02db. How do I achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually all texts give the passband gain as 0db (as well as passband ripples if any).&lt;/p&gt;&#xA;" OwnerUserId="4411" LastEditorUserId="4298" LastEditDate="2020-11-01T15:33:56.240" LastActivityDate="2020-11-01T15:33:56.240" Title="Low pass fir filter with non-unity gain" Tags="|filter-design|lowpass-filter|finite-impulse-response|" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8845" PostTypeId="2" ParentId="8840" CreationDate="2013-04-25T05:48:36.173" Score="6" Body="&lt;p&gt;This is the best one that I know of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full derivation with explanation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.isr.ist.utl.pt/~mir/pub/kalman.pdf&quot; rel=&quot;noreferrer&quot;&gt;Kalman&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a good resource for learning about the Kalman filter. If you are more concerned with getting the smartphone app working I would suggest looking for a pre-existing implementation of the Kalman filter. Why reinvent the wheel? For example if you are developing for android, openCV has an implementation of the Kalman filter. See &lt;a href=&quot;http://opencv.org/android&quot; rel=&quot;noreferrer&quot;&gt;Android OpenCV&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cse.iitk.ac.in/users/vision/dipakmj/papers/OReilly%20Learning%20OpenCV.pdf&quot; rel=&quot;noreferrer&quot;&gt;Bradski and Kaehler&lt;/a&gt; is a good resource on image processing in general and includes a section on the Kalman filter including code examples.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastEditorUserId="80" LastEditDate="2013-04-25T12:08:25.973" LastActivityDate="2013-04-25T12:08:25.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8846" PostTypeId="2" ParentId="8844" CreationDate="2013-04-25T06:15:53.817" Score="2" Body="&lt;p&gt;Just multiply your FIR coefficients by 2. You can verify your passband gain at DC by setting $z=1$ which amounts to just summing the coefficients.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-04-25T06:15:53.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8847" PostTypeId="2" ParentId="8844" CreationDate="2013-04-25T06:56:16.790" Score="6" Body="&lt;p&gt;As pointed out by niaren, you have to multiply by two, but this also means that your whole magnitude response is shifted up by 6dB, also in the stopbands. So you will have 6dB less stopband attenuation. Of course, the attenuation relative to the passband gain remains constant. You have to take this into account when designing your filter. Say you need 60dB stopband attenuation in absolute terms, not relative to the passband gain, then you need to design a 0dB gain filter with 66dB stopband gain. After multiplying the coefficients by 2 you'll get 6dB passband gain and 60dB stopband attenuation.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-25T06:56:16.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8848" PostTypeId="1" CreationDate="2013-04-25T07:01:07.850" Score="4" ViewCount="1554" Body="&lt;p&gt;I want to port the following FFT code on a microcontoller having a very little floating point capability. I want to perform FFT of the output from 12 bit ADC. Since my values are all 12 bit numbers it is wasteful of storage and processing power (I do not need very accurate FFT output) if I do every thing in double as the following code does. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I modify this C code so that it works only for 12 bit numbers and do not do any floating point arithmatic. This way I can save lots of storage space and  do very litlle arithmatics.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define PI  M_PI    /* pi to machine precision, defined in math.h */&#xA;#define TWOPI   (2.0*PI)&#xA;&#xA;&#xA;void four1(double data[], int nn, int isign)&#xA;{&#xA;    int n, mmax, m, j, istep, i;&#xA;    double wtemp, wr, wpr, wpi, wi, theta;&#xA;    double tempr, tempi;&#xA;&#xA;    n = nn &amp;lt;&amp;lt; 1;&#xA;    j = 1;&#xA;    for (i = 1; i &amp;lt; n; i += 2) {&#xA;    if (j &amp;gt; i) {&#xA;        tempr = data[j];     data[j] = data[i];     data[i] = tempr;&#xA;        tempr = data[j+1]; data[j+1] = data[i+1]; data[i+1] = tempr;&#xA;    }&#xA;    m = n &amp;gt;&amp;gt; 1;&#xA;    while (m &amp;gt;= 2 &amp;amp;&amp;amp; j &amp;gt; m) {&#xA;        j -= m;&#xA;        m &amp;gt;&amp;gt;= 1;&#xA;    }&#xA;    j += m;&#xA;    }&#xA;    mmax = 2;&#xA;    while (n &amp;gt; mmax) {&#xA;    istep = 2*mmax;&#xA;    theta = TWOPI/(isign*mmax);&#xA;    wtemp = sin(0.5*theta);&#xA;    wpr = -2.0*wtemp*wtemp;&#xA;    wpi = sin(theta);&#xA;    wr = 1.0;&#xA;    wi = 0.0;&#xA;    for (m = 1; m &amp;lt; mmax; m += 2) {&#xA;        for (i = m; i &amp;lt;= n; i += istep) {&#xA;        j =i + mmax;&#xA;        tempr = wr*data[j]   - wi*data[j+1];&#xA;        tempi = wr*data[j+1] + wi*data[j];&#xA;        data[j]   = data[i]   - tempr;&#xA;        data[j+1] = data[i+1] - tempi;&#xA;        data[i] += tempr;&#xA;        data[i+1] += tempi;&#xA;        }&#xA;        wr = (wtemp = wr)*wpr - wi*wpi + wr;&#xA;        wi = wi*wpr + wtemp*wpi + wi;&#xA;    }&#xA;    mmax = istep;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2013-04-25T08:57:55.530" Title="Optimizing FFT code for 12 bit processing on microcontroller" Tags="|fft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8849" PostTypeId="1" CreationDate="2013-04-25T07:27:23.487" Score="-1" ViewCount="159" Body="&lt;p&gt;I am an image processing engineer. I my work I often find that there are many aspects for my code to be improved. Who can recommend a book which focuses on optimization methods for image processing? Any advice will be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4429" LastEditorUserId="6" LastEditDate="2013-04-25T10:34:00.280" LastActivityDate="2013-04-25T10:56:38.687" Title="A book that focuses on optimization methods for image processing?" Tags="|image-processing|" AnswerCount="1" CommentCount="4" ClosedDate="2013-12-13T13:01:24.630" ContentLicense="CC BY-SA 3.0" />
  <row Id="8850" PostTypeId="2" ParentId="8848" CreationDate="2013-04-25T07:35:36.240" Score="5" Body="&lt;p&gt;As you probably know, C does not provide any special support for fixed-point implementations. This means that you would need to do everything by yourself: doing the appropriate scaling, checking for underflow and overflow, etc. This is definitely possible but it's a lot of work and you might encounter numerical issues resulting in large errors if the variable scaling is not done properly. But there is definitely a lot of literature to help you with this task (just search for &quot;fixed-point FFT&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said all that, you still might want to try a simpler route. I'm not sure about the floating point capabilities of your microcontroller, but you could try the shortest floating point format (instead of double). Another great improvement would be to use pre-calculated tables for the sine and cosine values. I would try such simple strategies first and see if the computational complexity can be sufficiently reduced or if you really need to go for a fixed-point solution.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-25T07:35:36.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8851" PostTypeId="1" AcceptedAnswerId="8852" CreationDate="2013-04-25T08:23:41.677" Score="3" ViewCount="1682" Body="&lt;p&gt;I am confused about this Q&amp;amp;A :  &lt;a href=&quot;https://dsp.stackexchange.com/questions/8799/interpolation-by-factor-of-2&quot;&gt;Interpolation by factor of 2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my input signal &#xA;$$&#xA;x[n]= x0,x1,x2,x3&#xA;$$&#xA;then according to the threads explaination my $v[n]$ will be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;v[n]=x0,0,x1,0,x2,0,x3,0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n] \rightarrow$ zeropad $\rightarrow v[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v[n]\rightarrow$ LPF $\rightarrow y[m]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My $y[m]$ is the output of LPF which removes aliases. So basically LPF transfer function is given as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[m] = v[n]*h[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i,e. $y[m]=\displaystyle\sum_{n=0}^{\infty}h(m-n)v(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here $h[m]$ is my filter coefficients and  $v[n]$ is my zero padded input signal...&#xA;so, if I multiply zero with my filter coefficients, then my output will also be zero...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I send 10 input samples, after zero padding I will get 20 samples, out of which 10 will be zero....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is the use of getting zero as my output? Correct me if am wrong (I know I am wrong, but please give me some idea how zero padding &amp;amp; LPF is helping in this regard).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For FIR filter: $y(n)=h(0)x(n)+h(1)x(n−1)+....+h(N−1)x(n−N+1)$,&#xA; where $x(n)$ is the input signal,&#xA; $y(n)$ is the output signal, &#xA;$h(n)$ is the impulse response, &#xA;and $N$ is the filter length. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity, I am taking order $N=4$,and some random numbers&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    (time) n --&amp;gt; [ 0  1  2  3] &#xA;         x[n]--&amp;gt; [ 2  4  6  8] &#xA;         h[n]--&amp;gt; [.1 .2 .3 .4] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;what is $y[2.5]$??? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                  n--&amp;gt;[0 0.5 1 1.5 2 2.5 3 3.5]  &#xA;               v[n]--&amp;gt;[2  0  4  0  6  0  8  0 ] (after zero padding)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lets calculate for $y[2.5]=h(0)x(2.5)+h(1)x(1.5)+h(2)x(0.5)+h(3)x(-0.5)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so here $x(2.5)=x(1.5)=x(0.5)=0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please answer this to clear my confusion???&lt;/p&gt;&#xA;" OwnerUserId="4411" LastEditorUserId="4298" LastEditDate="2020-11-01T15:36:53.463" LastActivityDate="2020-11-01T15:36:53.463" Title="Interpolated FIR filter" Tags="|filter-design|lowpass-filter|finite-impulse-response|interpolation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8852" PostTypeId="2" ParentId="8851" CreationDate="2013-04-25T08:55:21.957" Score="5" Body="&lt;p&gt;The interpolation lowpass filter computes a weighted sum of input samples, which results in the zero input samples being interpolated using the non-zero samples of the input signal. The $*$ sign is NOT multiplication but convolution!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I'm adding a simple example to clear things up a bit. Let's consider the impulse response $h = [0.5, 1, 0.5]$ and a zero-padded input signal&#xA;$x=[1,0,3,0,5,0,3,0,1]$. The time index is denoted by $n$, and $n=0$ corresponds to the left-most values of $h$ and $x$. The output $y$ is the convolution of $(x*h)(n)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(0) = h(0)x(0) = 0.5\\&#xA;y(1) = h(0)x(1) + h(1)x(0) = 1\\&#xA;y(2) = h(0)x(2) + h(1)x(1) + h(2)x(0) = 2\\&#xA;y(3) = h(0)x(3) + h(1)x(2) + h(2)x(1) = 3\\&#xA;y(4) = h(0)x(4) + h(1)x(3) + h(2)x(2) = 4\\&#xA;y(5) = h(0)x(5) + h(1)x(4) + h(2)x(3) = 5\\\vdots$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This impulse response obviously performs linear interpolation of the zero-padded input signal.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-04-25T10:30:26.527" LastActivityDate="2013-04-25T10:30:26.527" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8853" PostTypeId="2" ParentId="8848" CreationDate="2013-04-25T08:57:55.530" Score="8" Body="&lt;p&gt;12-bit is not a native data type on your platform, so the best you can do without loss of precision is 16-bit per sample, in Q15 format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know the Stellaris line well, but from what I gathered on the TI website, these are either Cortex M3 (LM3xxx) or Cortex M4 (LM4xxx).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Cortex M4 embeds a floating point unit; so there won't be as much benefit in terms of run-time from converting your code to fixed point as you think. The immediate thing is to switch to 32-bit floats. The next thing is to check your compiler settings and have a quick look at the disassembled generated code to check that it actually generates floating point instructions rather than using emulation. With gcc, you'll probably have to use compilation flags like &lt;code&gt;-mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16&lt;/code&gt; (which are the flags I use with another Cortex-M4 product). There's a good chance you'll get better performance from using a vendor-supplied function rather than your own code. Try &lt;code&gt;arm_cfft_radix4_f32&lt;/code&gt; in the CMSIS DSP library. This should solve your performance problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use a M3 part instead, and/or are really short on RAM for your samples, you'll have to switch to fixed point (Q15 format). Again, you don't have to write code for that, just grab the CMSIS DSP library provided by TI and use the functions &lt;code&gt;arm_rfft_q15&lt;/code&gt; (for real input) or &lt;code&gt;arm_cfft_radix4_q15&lt;/code&gt; (for complex input, if the input size is a power of 4).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-04-25T08:57:55.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8854" PostTypeId="2" ParentId="8844" CreationDate="2013-04-25T10:31:29.813" Score="3" Body="&lt;p&gt;This simply means that you have a non-unity gain in the passband. The number 6.02 in decibels corresponds to a multiplicative gain factor of two. You can check it like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$10^\tfrac{6.02}{20} = 2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you have to do then is multiply all you FIR filter coefficients by 2.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2013-04-25T10:37:09.217" LastActivityDate="2013-04-25T10:37:09.217" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8855" PostTypeId="2" ParentId="8849" CreationDate="2013-04-25T10:56:38.687" Score="1" Body="&lt;p&gt;It depends on yor actual focus.&#xA;For mathematical models and algorithms, I've seen people using this book: &lt;a href=&quot;http://vision.mas.ecp.fr/paragios-chen-faugeras/&quot; rel=&quot;nofollow&quot;&gt;The Handbook of Mathematical Models in Computer Vision&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the focus is more on Computer Vision, I've found these books useful too (including mathematical background):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://szeliski.org/Book/&quot; rel=&quot;nofollow&quot;&gt;Richard Szeliski's recent book&lt;/a&gt; (from Microsoft Research)&lt;/li&gt;&#xA;&lt;li&gt;or &lt;a href=&quot;http://books.google.ch/books/about/Computer_vision.html?id=a3-TQgAACAAJ&amp;amp;redir_esc=y&quot; rel=&quot;nofollow&quot;&gt;Computer Vision, a modern approach (2nd ed.).&lt;/a&gt; This book has many small assignements at the end of each chapter that you can use to improve your work step-by-step.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-04-25T10:56:38.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8856" PostTypeId="1" AcceptedAnswerId="8858" CreationDate="2013-04-25T13:45:04.240" Score="2" ViewCount="1595" Body="&lt;p&gt;I'm trying to work out what the correct solution is for a DCT of a 4x4 checkerboard matrix (let's call it A) and for a matrix of ones (let's call it B). So A is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   0   1   0   1&#xA;   1   0   1   0&#xA;   0   1   0   1&#xA;   1   0   1   0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And B is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   1   1   1   1&#xA;   1   1   1   1&#xA;   1   1   1   1&#xA;   1   1   1   1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With Octave for &lt;code&gt;dct(A)&lt;/code&gt; I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   1.00000   1.00000   1.00000   1.00000&#xA;  -0.38268   0.38268  -0.38268   0.38268&#xA;   0.00000   0.00000   0.00000   0.00000&#xA;  -0.92388   0.92388  -0.92388   0.92388&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for &lt;code&gt;dctmtx(4) * A * transpose(dctmtx(4))&lt;/code&gt; (which should be equivalent) I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   2.00000   0.00000  -0.00000  -0.00000&#xA;   0.00000  -0.29289  -0.00000  -0.70711&#xA;  -0.00000  -0.00000   0.00000  -0.00000&#xA;  -0.00000  -0.70711  -0.00000  -1.70711&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then &lt;code&gt;dct(B)&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   2   2   2   2&#xA;   0   0   0   0&#xA;   0   0   0   0&#xA;   0   0   0   0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And &lt;code&gt;dctmtx(4) * B * transpose(dctmtx(4))&lt;/code&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   4   0   0   0&#xA;   0   0   0   0&#xA;   0   0   0   0&#xA;   0   0   0   0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's going on? Which is correct?&lt;/p&gt;&#xA;" OwnerUserId="4440" LastActivityDate="2013-04-25T16:02:04.937" Title="DCT of 4x4 checkerboard matrix - what's the correct result?" Tags="|dct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8857" PostTypeId="1" CreationDate="2013-04-25T14:20:45.130" Score="1" ViewCount="521" Body="&lt;p&gt;I am trying to thin foreground pixels of a finger print until they are one pixel wide without using the built in bwmorph and thin operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain to me how to write them in matlab without actually using the built in function. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4441" LastEditorUserId="128" LastEditDate="2023-07-08T11:49:19.073" LastActivityDate="2023-07-08T11:49:19.073" Title="Finger print skeletonization without using matlab functions" Tags="|image-processing|matlab|morphological-operations|image-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8858" PostTypeId="2" ParentId="8856" CreationDate="2013-04-25T14:25:14.847" Score="3" Body="&lt;p&gt;As far as I can see, there are two little mistakes. First of all, you should use dct2() instead of dct(). And second, you shouldn't use the 'transpose' function because you want the DCT matrix not only transposed but also conjugated. So you should do the following:&#xA;$$\tt{T=dctmtx(4); DCTB = T*B*T'}$$&#xA;And this should equal $\tt dct2(B)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; As correctly pointed out by Peter K., the DCT matrix is real-valued, so indeed the 'transpose' operation and the ' operation give the same result. So I only noticed ONE little mistake ...&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-04-25T16:02:04.937" LastActivityDate="2013-04-25T16:02:04.937" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8859" PostTypeId="1" AcceptedAnswerId="8862" CreationDate="2013-04-25T16:18:28.073" Score="3" ViewCount="993" Body="&lt;p&gt;I have a bunch of 8x8 images which have been vectorized and formed into a 64xN matrix, X.  I'd like to take the 2D-FFT of each of these images without reshaping each column of X into an 8x8 image and using fft2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?  I've tried playing around with properties of kronecker products and vec() operations but haven't gotten anywhere.&lt;/p&gt;&#xA;" OwnerUserId="4202" LastEditorUserId="4202" LastEditDate="2013-04-25T17:42:28.567" LastActivityDate="2013-05-02T00:02:42.053" Title="2D FFT of Vector" Tags="|image-processing|fft|matlab|2d|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8860" PostTypeId="1" AcceptedAnswerId="8869" CreationDate="2013-04-25T18:30:46.380" Score="31" ViewCount="73475" Body="&lt;p&gt;Thanks to everyone who posted comments/answers to my query yesterday (&lt;a href=&quot;https://dsp.stackexchange.com/questions/8840/implementing-a-kalman-filter-for-position-velocity-acceleration&quot;&gt;Implementing a Kalman filter for position, velocity, acceleration&lt;/a&gt; ).  I've been looking at what was recommended, and in particular at both (a) &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical&quot; rel=&quot;noreferrer&quot;&gt;the wikipedia example on one dimensional position and velocity&lt;/a&gt; and also &lt;a href=&quot;http://campar.in.tum.de/Chair/KalmanFilter&quot; rel=&quot;noreferrer&quot;&gt;another website that considers a similar thing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;Update 26-Apr-2013&lt;/b&gt;: the original question here contained some errors, related to the fact that I hadn't properly understood the &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical&quot; rel=&quot;noreferrer&quot;&gt;the wikipedia example on one dimensional position and velocity&lt;/a&gt;.  With my improved understanding of what's going on, I've now redrafted the question and focused it more tightly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both examples that I refer to in the introductory paragraph above assume that it's only position that's measured.  However, neither example has any kind of calculation $(x_k-x_{k-1})/dt$ for speed.  For example, the Wikipedia example specifies the ${\bf H}$ matrix as ${\bf H} = [1\ \ \  0]$, which means that only position is input.  Focussing on the Wikipedia example, the state vector ${\bf x}_k$ of the Kalman filter contains position $x_k$and speed $\dot{x}_{k}$, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;\mathbf{x}_{k}  &amp;amp; =\left(\begin{array}[c]{c}x_{k}\\&#xA;\dot{x}_{k}\end{array}&#xA;\right)&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose the measurement of position at time $k$ is $\hat{x}_k$.  Then if the position and speed at time $k-1$ were $x_{k-1}$ and $\dot{x}_{k-1}$, and if $a$ is a constant acceleration that applies in the time interval $k-1$ to $k$, from the measurement of $\hat{x}$ it's possible to deduce a value for $a$ using the formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{x}_k = x_{k-1} + \dot{x}_{k-1} dt + \frac{1}{2} a dt^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This implies that at time $k$, a measurement $\hat{\dot{x}}_k$ of the speed is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{\dot{x}}_k = \dot{x}_{k-1} + a dt = 2 \frac{\hat{x}_k - {x}_{k-1}}{dt} - \dot{x}_{k-1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the quantities on the right hand side of that equation (i.e. $\hat{x}_k$, $x_{k-1}$ and $\dot{x}_{k-1}$) are normally distributed random variables with known means and standard deviations, so the $\bf R$ matrix for the measurement vector&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;\mathbf{\hat{x}}_{k}  &amp;amp; =\left(\begin{array}[c]{c}\hat{x}_{k}\\&#xA;\hat{\dot{x}}_{k}\end{array}&#xA;\right)&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be calculated.  Is this a valid way of introducing speed estimates into the process?&lt;/p&gt;&#xA;" OwnerUserId="4436" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2019-10-08T08:32:39.037" Title="Kalman filter for position and velocity: introducing speed estimates" Tags="|kalman-filters|" AnswerCount="1" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="8861" PostTypeId="1" AcceptedAnswerId="8863" CreationDate="2013-04-25T19:41:11.713" Score="3" ViewCount="945" Body="&lt;p&gt;Could anybody tell me a method to calculate the &quot;4 Hz modulation energy&quot; for a speech signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get some details : 4 Hz modulation energy: Speech has a characteristic energy modulation peak around the 4 Hz syllabic rate [3]. We use a portion of the MFCC algorithm [4] to convert the audio signal into 40 perceptual channels. We extract the energy in each band, bandpass filter each channel with a second order filter with a center frequency of 4 Hz, then calculate the short-term energy by squaring and smoothing the result. We normalize each channel's 4 Hz energy by the overall channel energy in the frame, and sum the result from all channels. Speech tends to have more modulation energy at 4Hz than music does. &lt;/p&gt;&#xA;" OwnerUserId="4442" LastEditorUserId="4442" LastEditDate="2013-04-25T19:54:04.667" LastActivityDate="2013-04-25T20:20:16.717" Title="obtaining &quot;4 Hz modulation energy&quot;" Tags="|matlab|modulation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8862" PostTypeId="2" ParentId="8859" CreationDate="2013-04-25T19:57:22.213" Score="2" Body="&lt;p&gt;Your matrix looks like this:&#xA;$$\begin{array}{ccc}X_1(:,1) &amp;amp; \ldots &amp;amp; X_N(:,1)\\\vdots &amp;amp; \ddots &amp;amp; \vdots\\X_1(:,8) &amp;amp; \ldots &amp;amp; X_N(:,8)\end{array}$$&#xA;where $X_i,\; i=1,\ldots 64,$ are the $8\times 8$ image matrices. So $X_i(:,1)$ is the first column of the $i^{th}$ image (I'm using matlab/octave notation). You said you don't want to reshape each column and you've tried kronecker products etc., but I actually think that reshaping is the simplest solution to your problem. Look at the code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\tt Z=[];\\for\; i=1:N, Y=reshape(X(:,i),8,8); Z=[Z,fft2(Y)]; end$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\tt N$ is the total number of images in matrix $\tt X$. $\tt Z$ is a $8\times 8N$ matrix containing the DFTs of all $N$ images. I think it won't get much simpler than that. If so, please let me know.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-25T19:57:22.213" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8863" PostTypeId="2" ParentId="8861" CreationDate="2013-04-25T19:57:26.340" Score="5" Body="&lt;p&gt;&lt;a href=&quot;http://www.auditory.org/mhonarc/2005/msg00222.html&quot; rel=&quot;noreferrer&quot;&gt;The link in my comment&lt;/a&gt; suggests the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I would recommend first extracting the envelope by using either a halfwave&#xA;  rectification (i.e., replace all the negative values in the time waveform&#xA;  with zeros) or a Hilbert Transform and then lowpass filtering the waveform&#xA;  at around 50 Hz (the lowpass is optional if you only care about the 4 Hz&#xA;  component).   Once you have the envelope, simply do an fft (making sure&#xA;  that your frequency resolution is at least 1 Hz) and look for the energy&#xA;  around 4 Hz.  If any of these steps don't seem obvious too you, let me know&#xA;  and I can send you some Matlab code.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, what that means is you need to take your speech $s[n]$ and find the envelope:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e[n] = \left | s[n] + j{\bf H}\left[s[n]\right] \right |&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where ${\bf H}$ is the Hilbert transform of your speech signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, take the FFT and look at the bin at 4Hz.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-25T20:20:16.717" LastActivityDate="2013-04-25T20:20:16.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8865" PostTypeId="1" CreationDate="2013-04-26T03:40:51.993" Score="6" ViewCount="932" Body="&lt;p&gt;I am working in the field of digital image restoration. I have images that are degraded by camera shake. My images are similar to &lt;a href=&quot;http://www.cambridgeincolour.com/tutorials/camera-shake.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; blurry photo from camera shake. Can anyone please suggest a better &lt;strong&gt;non-blind deconvolution&lt;/strong&gt; algorithm?&lt;/p&gt;&#xA;&lt;p&gt;I have already checked some of the &lt;strong&gt;blind deconvolution&lt;/strong&gt; algorithms such as &lt;a href=&quot;http://cs.nyu.edu/%7Edilip/research/blind-deconvolution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dilip Krishnan&lt;/a&gt; and others, but these algorithms are not producing &lt;strong&gt;desired&lt;/strong&gt; result on my highly blurred images.&lt;/p&gt;&#xA;" OwnerUserId="4444" LastEditorUserId="7092" LastEditDate="2024-01-02T16:19:18.973" LastActivityDate="2024-01-02T16:19:18.973" Title="Any good image blind deconvolution algorithm for removing camera shake?" Tags="|image-processing|matlab|deconvolution|image-restoration|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8866" PostTypeId="1" AcceptedAnswerId="8867" CreationDate="2013-04-26T07:01:05.460" Score="5" ViewCount="3376" Body="&lt;p&gt;The steps of computing the Mel-Frequency Cepstrum Coefficients (MFCC) are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Frame blocking -&amp;gt; Windowing-&amp;gt; abs(DFT) -&amp;gt; Mel filter bank-&amp;gt; Sum coefficients for each filter-&amp;gt; Logarithm -&amp;gt; DCT&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what is the purpose of the logarithm step?&lt;/p&gt;&#xA;" OwnerUserId="4147" LastEditorUserId="4147" LastEditDate="2013-06-02T19:56:49.907" LastActivityDate="2013-06-02T19:56:49.907" Title="What is the purpose of the log when computing the MFCC?" Tags="|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8867" PostTypeId="2" ParentId="8866" CreationDate="2013-04-26T07:42:14.203" Score="11" Body="&lt;p&gt;The logarithm serves to transform a multiplication into an addition. It is part of the computation of the cepstrum. The basic idea is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume a source signal $x$ is convolved by some impulse response $h$. The resulting magnitude spectrum is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|Y(\omega)| = |X(\omega)||H(\omega)|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By applying the logarithm we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\log |Y(\omega)| = \log |X(\omega)| + \log |H(\omega)|\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to equalize / undo the effect of filtering by $H(\omega)$ we can hope that this task is easier if we transform the convolution into additive noise. This is exactly what happens by taking the logarithm in (1). &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-26T07:42:14.203" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8868" PostTypeId="1" CreationDate="2013-04-26T11:08:17.150" Score="2" ViewCount="971" Body="&lt;p&gt;I have some data sets on which I applied Gaussian smoothing using &lt;code&gt;[1 4 6 4 1]&lt;/code&gt; kernel. In my program I iterated this kernel 50 times on the data sets. But only a few of them could retain their shape, most of them just flattened and lost all the patterns&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know is there any way I can estimate the number of iterations of smoothing for each data set ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I be using Normalized Squared Error for the data set and its smoothed version , or maybe use any type of Correlation between the two ?&lt;/p&gt;&#xA;" OwnerUserId="4271" LastEditorUserId="4271" LastEditDate="2017-11-02T15:21:03.130" LastActivityDate="2017-11-02T15:21:03.130" Title="Estimating number for iterations for gaussian smoothing" Tags="|smoothing|gaussian|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8869" PostTypeId="2" ParentId="8860" CreationDate="2013-04-26T13:36:03.253" Score="37" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this a valid way of introducing speed estimates into the process?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you choose your state appropriately, then the speed estimates come &quot;for free&quot;. See the derivation of the signal model below (for the simple 1-D case we've been looking at).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Signal Model, Take 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we really need to agree on a signal model before we can move this forward.  From your edit, it looks like your model of the position, $x_k$, is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{array}&#xA;xx_{k+1} &amp;amp;=&amp;amp; x_{k} + \dot{x}_{k} \Delta t + \frac{1}{2} a (\Delta t)^2\\&#xA;\dot{x}_{k+1} &amp;amp;=&amp;amp; \dot{x}_{k} + a \Delta t &#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If our state is as before:&#xA;$$&#xA;\begin{align*}&#xA;\mathbf{x}_{k}  &amp;amp; =\left(\begin{array}[c]{c}x_{k}\\&#xA;\dot{x}_{k}\end{array}&#xA;\right)  &#xA;\end{align*}&#xA;$$&#xA;then the state update equation is just:&#xA;$$&#xA;\mathbf{x}_{k+1} = &#xA;\left(\begin{array}[c]{c} 1\ \ \Delta t\\&#xA;0\ \ 1\end{array}&#xA;\right) &#xA;\mathbf{x}_{k} + &#xA;\left(\begin{array}[c]{c} \frac{(\Delta t)^2}{2} \\&#xA;\Delta t \end{array}&#xA;\right) &#xA;a_k&#xA;$$&#xA;where now our $a_k$ is the normally distributed acceleration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That gives different $\mathbf{G}$ matrix from the previous version, but the $\mathbf{F}$ and $\mathbf{H}$ matrices should be the same.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If I implement this in &lt;code&gt;scilab&lt;/code&gt; (sorry, no access to matlab), it looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Signal Model&#xA;DeltaT = 0.1;&#xA;F = [1 DeltaT; 0 1];&#xA;G = [DeltaT^2/2; DeltaT];&#xA;H = [1 0];&#xA;&#xA;x0 = [0;0];&#xA;sigma_a = 0.1;&#xA;&#xA;Q = sigma_a^2;&#xA;R = 0.1;&#xA;&#xA;N = 1000;&#xA;&#xA;a = rand(1,N,&quot;normal&quot;)*sigma_a;&#xA;&#xA;x_truth(:,1) = x0;&#xA;for t=1:N,&#xA;    x_truth(:,t+1) = F*x_truth(:,t) + G*a(t);&#xA;    y(t) = H*x_truth(:,t) + rand(1,1,&quot;normal&quot;)*sqrt(R);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, I can apply the Kalman filter equations to this $y$ (the noisy measurements).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Kalman Filter&#xA;p0 = 100*eye(2,2);&#xA;&#xA;xx(:,1) = x0;&#xA;pp = p0;&#xA;pp_norm(1) = norm(pp);&#xA;for t=1:N,&#xA;    [x1,p1,x,p] = kalm(y(t),xx(:,t),pp,F,G,H,Q,R);&#xA;    xx(:,t+1) = x1;&#xA;    pp = p1;&#xA;    pp_norm(t+1) = norm(pp);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So we have our noisy measurements $y$, and we've applied the Kalman filter to them and used the same signal model to generate $y$ as we do to apply the Kalman filter (a pretty big assumption, sometimes!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then following plots show the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plot 1&lt;/strong&gt;: $y$ and $x_k$ versus time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mAf8u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plot 2&lt;/strong&gt;: A zoomed view of the first few samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FjdL2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plot 3&lt;/strong&gt;: Something you never get in real life, the true position vs the state estimate of the position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YztSL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plot 4&lt;/strong&gt;: Something you also never get in real life, the true velocity vs the state estimate of the velocity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k1c9P.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plot 5&lt;/strong&gt;: The norm of the state covariance matrix (something you should always monitor in real life!).  Note that it very quickly goes from its initial very large value to something very small, so I've only shown the first few samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/au56O.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Plot 6&lt;/strong&gt;: Plots of the error between the true position and velocity and their estimates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TQBT4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you study the case where the position measurements are exact, then you find that the Kalman udpate equations produce exact results for BOTH position and speed.  Mathematically it's straightforward to see why.  Using the same notation as &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical&quot; rel=&quot;noreferrer&quot;&gt;the wikipedia article&lt;/a&gt;, exact measurements mean that $\mathbf{z}_{k+1}=x_{k+1}$. If you assume that the initial position and speed are known so that $\mathbf{P}_k=0$, then $\mathbf{P}_{k+1}^{-}=\mathbf{Q}$ and the Kalman gain matrix $\mathbf{K}_{k+1}$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{K}_{k+1} = \left(\begin{array}[c]{c}1\\&#xA;2/dt\end{array}&#xA;\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that the Kalman update procedure produces&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;\mathbf{\hat{x}}_{k+1} &amp;amp; = \mathbf{F}_{k+1}\mathbf{x}_k + \mathbf{K}_{k+1}\left(\mathbf{z}_{k+1} - \mathbf{H}_{k+1} \mathbf{F}_{k+1}\mathbf{x}_k\right)\\&#xA;&amp;amp; = \left(\begin{array}[c]{c}x_k + \dot{x}_k dt\\&#xA;\dot{x}_k\end{array}&#xA;\right) +&#xA;\left(\begin{array}[c]{c}1\\&#xA;2/dt\end{array}&#xA;\right)&#xA;\left(x_{k+1} - \left( x_k + \dot{x}_k dt\right)&#xA;\right)\\&#xA;&amp;amp; = \left(\begin{array}[c]{c}x_{k+1}\\&#xA; 2 \left(x_{k+1} - x_k \right) /dt - \dot{x}_k\end{array}&#xA;\right)&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the value for the speed is given by exactly the formula you were proposing to use for the speed estimate.  So although you couldn't see any kind of calculation $(x_k-x_{k-1})/dt$ for speed, in fact it is hidden in there after all.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="4436" LastEditDate="2013-04-27T15:15:18.877" LastActivityDate="2013-04-27T15:15:18.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8872" PostTypeId="1" CreationDate="2013-04-26T15:03:47.973" Score="1" ViewCount="1240" Body="&lt;p&gt;How to calculate auto-correlation of a bpsk modulated signal, or how to calculate expectation value of complex exponential function manually not by using matlab or any other software?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)= a\exp(i2\pi ft)+n(t)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;how would you solve&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathrm{E}[x(t)]=?$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R(t,t_1)= \mathrm{E}[x(t+t_1/2)x'(t-t_1/2)]=?$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ is either $+1$ or $-1$ mapped from the binary representation of the ASCII value of any text message.&lt;/p&gt;&#xA;" OwnerUserId="4445" OwnerDisplayName="Neha Ali" LastEditorUserId="26573" LastEditDate="2018-09-10T21:38:15.487" LastActivityDate="2018-09-10T21:38:15.487" Title="How to calculate auto-correlation of a bpsk modulated signal or how to calculate expectation value of complex exponential function" Tags="|autocorrelation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8873" PostTypeId="2" ParentId="8825" CreationDate="2013-04-26T18:10:39.280" Score="2" Body="&lt;p&gt;One way would be to interpolate the signals to produce evenly-spaced samples and then calculate the CPSD as normal.&lt;/p&gt;&#xA;" OwnerUserId="4344" LastActivityDate="2013-04-26T18:10:39.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8874" PostTypeId="2" ParentId="8872" CreationDate="2013-04-26T19:37:11.840" Score="2" Body="&lt;p&gt;This question is essentially unanswerable because too many details are left out.&#xA;Here is an answer to the following simplified version of the question&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the autocorrelation function of the random process &#xA;  $$X(t) = A\exp(j2\pi f_ct), -\infty &amp;lt; t &amp;lt; \infty$$&#xA;  where $A$ is a random variable equally likely to have values&#xA;  $+1$ and $-1$, and the autocorrelation function is defined as&#xA;  $$R_X(t,\tau) = E[X(t+\tau/2)X^*(t-\tau/2)], -\infty &amp;lt; t,\tau &amp;lt; \infty.$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is easy since the only random variable involved is $A$, and&#xA;it is a &lt;em&gt;discrete&lt;/em&gt; random variable.  Thus, we have&#xA;$$\begin{align}&#xA;E[X(t)]&amp;amp;= E[A]\cdot \exp(j2\pi f_ct)\\&#xA;&amp;amp;= 0 ~~\scriptstyle{\text{since }} E[A]=0.\\&#xA;R_X(t,\tau) &amp;amp;= E[X(t+\tau/2)X^*(t-\tau/2)],\\&#xA;&amp;amp;= E[A^2]\cdot \exp\left(j2\pi f_c(t+\tau/2)-j2\pi f_c(t-\tau/2)\right)\\&#xA;&amp;amp;= \exp(j2\pi f_c\tau)~~\scriptstyle{\text{since }} E[A^2]=1.&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What would be needed to make this question worth answering? First,&#xA;one usually has a &lt;em&gt;baseband pulse shape&lt;/em&gt;, usually time-limited, &#xA;that is nowhere mentioned by the OP. The autocorrelation function&#xA;of a BPSK signal is usually a scaled version of the&#xA;autocorrelation of the baseband pulse shape (and so the power&#xA;spectral density is determined by the shape of the baseband pulse).&#xA;To get to this result, one needs to consider not just&#xA;one bit but rather the stream of bits that modulate the BPSK signal,&#xA;and assume that these bits are i.i.d. random variables (such as&#xA;$A$ above). Second, something needs to be said about the noise&#xA;$n(t)$ that the OP casually includes in her question.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-04-26T23:56:11.703" LastActivityDate="2013-04-26T23:56:11.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8875" PostTypeId="1" AcceptedAnswerId="8881" CreationDate="2013-04-26T19:42:03.330" Score="10" ViewCount="8496" Body="&lt;p&gt;I have successfully tested 1D &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_correlation&quot; rel=&quot;noreferrer&quot;&gt;phase correlation&lt;/a&gt; algorithm to determine vertical shift between two synthetic images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I moved to real images, however, it is not able to detect translation at all (the peak is located at 0, which is wrong result).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W7JZ6.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;img src=&quot;https://i.stack.imgur.com/PN7GA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And resulting phase correlation (Magnitude, Real, Imaginary):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JCA26.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1iqes.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4gFDd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first scanline of the image is completely white, but the shift is obviously larger (20 pixels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expected result is white line on 20th row which happens only on synthetic images or light noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My algorithm is very simple - for each image column:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute 1D FT of source and target image columns (&lt;code&gt;a=FT(A)&lt;/code&gt;, &lt;code&gt;b=FT(B)&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Compute cross-power spectrum (&lt;code&gt;cross_power = a *. conj(b) / |a *. conj(b)|&lt;/code&gt;) - &lt;code&gt;*.&lt;/code&gt; denotes pointwise mutliplication, &lt;code&gt;conj(x)&lt;/code&gt; denotes complex conjugate&lt;/li&gt;&#xA;&lt;li&gt;Compute phase correlation (&lt;code&gt;phase = IFT(cross_power)&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Find maximum magnitude in every column of &lt;code&gt;phase&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Find consensus peak location (e.g. median of detected peak locations)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can you please advise me how to improve baseline phase correlation algorithm to deal with real-world (noisy) images?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Should I rather use NCC (Normalized Cross Correlation) instead of FFT-based phase correlation?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was experimenting with zero padding to rule out errors introduced by circular shifting (only simple linear shifting of images is desirable) and tested this on original images from Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Obh8N.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;img src=&quot;https://i.stack.imgur.com/2Z31J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The single peak is clearly there as it should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w90B1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However - if I perform slight smoothing (Gaussian blur) to reduce noise and actually &lt;em&gt;improve&lt;/em&gt; the result, the phase correlation comes out totally mangled:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Xsnh.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;img src=&quot;https://i.stack.imgur.com/Z3WGg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8BXFq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the enhanced version - the original peak is weaker (why??) and there appeared new peaks around zero shifts (why??):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/30Ter.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2013-04-26T22:24:23.843" LastActivityDate="2014-05-26T07:34:17.197" Title="Phase Correlation - Poor Performance on Noisy/Blurred Images?" Tags="|fourier-transform|image-processing|cross-correlation|phase|correlation|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="8877" PostTypeId="1" AcceptedAnswerId="8966" CreationDate="2013-04-27T00:20:39.633" Score="1" ViewCount="862" Body="&lt;p&gt;I have a noisy signal with frequency between 1/3 and 1/5 of the sampling window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DFT has a very low resolution for low frequency components, what is the best way to find the frequence? &lt;/p&gt;&#xA;" OwnerUserId="4446" LastActivityDate="2014-10-23T08:36:33.197" Title="How to determine a very low frequency signal?" Tags="|frequency-spectrum|dft|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8878" PostTypeId="1" CreationDate="2013-04-27T02:49:23.627" Score="0" ViewCount="211" Body="&lt;p&gt;When I recreate a signal it seems to look great. But when I try and increase it's frequency (which is done in a for loop and the variable &lt;strong&gt;new_freq=&lt;a href=&quot;https://i.stack.imgur.com/g3Lif.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;&lt;/strong&gt;) it starts to drift. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Image below (The top image is 1hz and the bottom image is 2hz. I circled the image with the problem). I also noticed when I increase the sample frequency the problem gets even more noticeable. Notice the top one is at 8000 as the sample frequency and the bottom one is at sample frequency of 44100. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've posted the for loop below any ideas why the variables &lt;strong&gt;aa_sig_rebuilt_norm_bin&lt;/strong&gt; and &lt;strong&gt;aa_sig_combined_norm_bin&lt;/strong&gt; are drifting so much?&#xA;&lt;strong&gt;Please note I'm using much more complex signals than just sine waves (if I were just using sine waves I would use the sinwave equation to increase the frequency. I used a sinewave as an example)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole for loop is base on rebuilding a signal using the equation Amplitude&lt;em&gt;Cos(freq&lt;/em&gt;time+phase) I did an fft/ifft to get all the frequencies/amplitudes/phases then just change the frequency to what I want&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do want to vectorize this for loop but at the moment I'm trying to fix the drift&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;new_freq=[2]; %increase frequency&#xA;fn_array=[];&#xA;array1=[xfreq_orig,yamp_orig,yamp_inv,phase_orig,mod(phase_in_deg,360),phase_in_rad,phase_adjindeg,phase_adjinrad]; %have degs only go up to 360&#xA;&#xA;t_rebuilt=linspace(0,2*pi,fs);&#xA;&#xA;for zz=1:1:length(new_freq); %&#xA;&#xA;    zz&#xA;    %needs to be in for loop to reset variables for next new_freq&#xA;    aa_sig_rebuilt_norm=zeros(1,length(t_rebuilt));&#xA;    aa_sig_rebuilt_norm_bin=zeros(1,length(t_rebuilt));&#xA;    aa_sig_combined_norm=zeros(1,length(t_rebuilt));&#xA;    aa_sig_combined_norm_bin=zeros(1,length(t_rebuilt));&#xA;    sig_norm=zeros(1,length(t_rebuilt));&#xA;    sig_norm_bin=zeros(1,length(t_rebuilt));&#xA;    for kk=1:1:length(xfreq_orig);&#xA;        aa_sig_rebuilt_norm = array1(kk, 2)*cos (array1(kk,1)*t_rebuilt+(array1(kk, 4))); &#xA;        aa_sig_combined_norm = aa_sig_combined_norm + aa_sig_rebuilt_norm;&#xA;&#xA;        aa_sig_rebuilt_norm_bin = array1(kk, 2)*cos ((new_freq(zz,1))*array1(kk,1)*t_rebuilt+(array1(kk, 4))); %binural section&#xA;        aa_sig_combined_norm_bin = aa_sig_combined_norm_bin + aa_sig_rebuilt_norm_bin;&#xA;    end;&#xA;&#xA;    %have it export to file &#xA;    sig_norm=(aa_sig_combined_norm/max(abs(aa_sig_combined_norm))*.8); %normalize signal &#xA;    sig_norm_bin=(aa_sig_combined_norm_bin/max(abs(aa_sig_combined_norm_bin))*.8); %normalize signal &#xA;&#xA;&#xA;    wavwrite([sig_norm' sig_norm_bin'] ,fs,16,strcat(dirpathtmp,fn_LR_norm_bin)); %export file&#xA;&#xA;&#xA;end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JOaZY.png&quot; alt=&quot;frequency sample at 8000hz&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g3Lif.png&quot; alt=&quot;frequency sample at 44100hz&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1894" LastEditorUserId="1894" LastEditDate="2013-04-27T12:30:53.747" LastActivityDate="2013-04-27T12:30:53.747" Title="How to prevent Signal drifting when changing frequency" Tags="|fft|matlab|octave|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8879" PostTypeId="1" AcceptedAnswerId="8880" CreationDate="2013-04-27T09:30:05.767" Score="0" ViewCount="384" Body="&lt;p&gt;I have a signal that it is like a Sinusoidal signal with many local maximum, I want to smooth this signal with almost connecting it's local maximum to each other.&lt;/p&gt;&#xA;" OwnerUserId="4450" LastActivityDate="2013-04-27T15:32:35.757" Title="How i can smooth a sinusoidal signal using it's local maximum" Tags="|smoothing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8880" PostTypeId="2" ParentId="8879" CreationDate="2013-04-27T10:01:30.007" Score="2" Body="&lt;p&gt;You could use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hilbert transform&lt;/a&gt; to calculate the signal envelope. It is discussed in &lt;a href=&quot;https://dsp.stackexchange.com/questions/424/hilbert-transform-to-compute-signal-envelope&quot;&gt;this&lt;/a&gt; question.&lt;/p&gt;&#xA;" OwnerUserId="215" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-04-27T15:32:35.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8881" PostTypeId="2" ParentId="8875" CreationDate="2013-04-27T16:20:24.660" Score="10" Body="&lt;p&gt;&lt;strong&gt;One-dimensional version&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one-dimensional version that you list won't work. When there is a large enough shift in images (more than one or two pixels in real-world images), there will be nothing relating the column pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an example of this, try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I5 = rand(100,100)*255;&#xA;I6 = zeros(100,100);&#xA;I6(11:100,22:100) = I5(1:90,1:79);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that we have I5:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rRoxW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I6:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SahHy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the one-dimensional phase correlation is just:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xvnGB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whereas the two-dimensional phase correlation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8Jaat.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a bit hard to see, but there is a very high peak in the bottom-righthand corner of the image. No clear peak exists in the one dimensional version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why doesn't smoothing help? #1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What correlation is trying to do is to find &quot;similar&quot; variations in each image.  If the underlying signals are sufficiently random, then this will work well: the correlation of white noise with itself gives a really nice peak at the origin, and close-to-zero elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Smoothing a &quot;random&quot; image with a Gaussian will have the effect of &lt;em&gt;smoothing&lt;/em&gt; out the correlation your expecting --- spreading the energy in any peaks over a wider area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Smoothing has the &lt;em&gt;opposite&lt;/em&gt; effect of &quot;pre-whitening&quot; the image. Pre-whitening (as the name suggests) tries to make the image more like white noise --- which has the best form if we are doing correlation-based detection (in that the peak is well-localized).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are better off doing is using the matlab &lt;code&gt;diff&lt;/code&gt; operation for a simplistic, but surprisingly effective, way of pre-whitening images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://sites.google.com/site/kootsoop/prewhitening&quot; rel=&quot;nofollow noreferrer&quot;&gt;See this example.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why doesn't smoothing help? #2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does smoothing cause the extra peaks?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you smooth each image with a kernel $k(x,y)$ then we get:&#xA;$$&#xA;h_a = g_a \star k\\&#xA;h_b = g_b \star k&#xA;$$&#xA;where $\star$ is convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now,&#xA;$$&#xA;H_a = K G_a\\&#xA;H_b = K G_b\\&#xA;R = \frac{H_a H_b^*}{|H_a H_b^*|} = \frac{|K|^2G_a G_b^*}{|K|^2|G_a G_b^*|}\\ &#xA;=  \frac{G_a G_b^*}{|G_a G_b^*|}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I suspect is happening (though I am not sure) is that perhaps your kernel has near-zero values in the frequency domain, causing numerical problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I apply a kernel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;K = one(5,5);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to my random images, then I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s7KWJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the two-dimensional correlation, which makes the peak more spread out, but does not exhibit the problems you are seeing.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-27T16:20:24.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8883" PostTypeId="1" AcceptedAnswerId="8887" CreationDate="2013-04-27T23:30:34.537" Score="-3" ViewCount="162" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q7gGc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hey guys, what is the difference between b.) and c.)? Why do we need each of them? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Excrept from: &lt;a href=&quot;http://www.dspguide.com/ch8/5.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dspguide.com/ch8/5.htm&lt;/a&gt; (scroll below)&lt;/p&gt;&#xA;" OwnerUserId="3512" LastActivityDate="2013-04-28T13:36:58.403" Title="frequency domain vs cosine wave amplitude" Tags="|frequency-spectrum|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8884" PostTypeId="1" AcceptedAnswerId="8886" CreationDate="2013-04-28T00:17:52.087" Score="3" ViewCount="4949" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sICNs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How did letter d.) become letter e.)? How do we perform this averaging process? Its clear the averaging the signal causes some noise to be reduced.&lt;/p&gt;&#xA;" OwnerUserId="3512" LastEditorUserId="80" LastEditDate="2013-04-28T00:39:48.230" LastActivityDate="2013-04-28T00:43:31.557" Title="How do I average frequency spectra?" Tags="|averaging|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8885" PostTypeId="2" ParentId="8877" CreationDate="2013-04-28T00:38:34.493" Score="1" Body="&lt;p&gt;Have you tried just zero-padding?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;SINE = sin(2*%pi*0.001923492369*[0:1023] + rand(1)&lt;em&gt;2&lt;/em&gt;%pi);&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hqOO5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I zero-pad it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;SINE_ZERO_PADDED = [SINE zeros(1,10240)];&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then I can take the FFT of both:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tE3YB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the blue plot is the absolute value of the FFT of the original, and the red (dashed) plot is the absolute value of the FFT of the zero-padded signal.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-05-02T12:12:36.140" LastActivityDate="2013-05-02T12:12:36.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8886" PostTypeId="2" ParentId="8884" CreationDate="2013-04-28T00:43:31.557" Score="1" Body="&lt;p&gt;If you are in a position to acquire $N$ snapshots of data, $s_n(t)$, for $n=0\ldots N-1$ then you can just do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;S_n(k) = |\mathrm{fft}(s_n(t))|^2\\&#xA;\hat{S}(k) =  \frac{1}{N} \sum_{n=0}^{N-1} S_n(k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and a certain amount of averaging will reduce the apparent noise on the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-28T00:43:31.557" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8887" PostTypeId="2" ParentId="8883" CreationDate="2013-04-28T01:13:52.817" Score="3" Body="&lt;p&gt;Why did you cut off the explanation on the figure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D9BCM.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation 8-2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Mj5Pl.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-28T13:36:58.403" LastActivityDate="2013-04-28T13:36:58.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8888" PostTypeId="1" CreationDate="2013-04-28T07:42:39.770" Score="0" ViewCount="108" Body="&lt;p&gt;I am working in digital image restoration field and i have studied this is many research papers that presence of &lt;strong&gt;saturated pixels&lt;/strong&gt; violates the assumption which is initially assumed by many &lt;strong&gt;blind deconvolution algorithms&lt;/strong&gt;, that the image formation process is linear...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please explain that how this rule is violated.?&lt;/p&gt;&#xA;" OwnerUserId="4444" LastActivityDate="2013-04-28T09:47:52.473" Title="How the Saturated Pixels violate the assumption that the image formation process in linear?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8889" PostTypeId="2" ParentId="8888" CreationDate="2013-04-28T09:47:52.473" Score="2" Body="&lt;p&gt;Blind deconvolution assumes that the blurred image is the result of distorting the original image by convolution. Convolution is a linear process, i.e. the image is just a sum of shifted and scaled versions of the original image. Pixel saturation, on the other hand, is a non-linear process, which cannot be modeled by convolution. Consequently, it cannot be handled by conventional blind deconvolution techniques. Also note that saturation is irreversible, i.e. once a quantity is saturated its original value cannot be recovered.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-28T09:47:52.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8890" PostTypeId="1" AcceptedAnswerId="8892" CreationDate="2013-04-28T11:32:27.653" Score="3" ViewCount="4767" Body="&lt;p&gt;Given a list of overtones (F1, F2, F3, etc), how do I compute the fundamental frequency? Can I do something like F2/F1=F1/F0? Is it the correct method to use?&lt;/p&gt;&#xA;" OwnerUserId="4252" LastActivityDate="2013-04-29T07:01:52.730" Title="How to compute fundamental frequency from a list of overtones?" Tags="|frequency-spectrum|frequency|frequency-domain|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8891" PostTypeId="2" ParentId="8890" CreationDate="2013-04-28T11:39:41.557" Score="5" Body="&lt;p&gt;Nope. Difference between overtones is a good point to start, i,e F3-F2, F2-F1. The differences should be all the same or multiple of each other. The smallest one is often the fundamental. It gets more tricky of the spectrum is &quot;sparse&quot;, i.e. a lot of the harmonics are missing. Then you need to find a largest possible divisor that turns all frequencies into integers or, to be precise, so that the ratio of frequency to fundamental is within the measurement accuracy of the nearest integer. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="39" LastEditDate="2013-04-28T15:07:05.147" LastActivityDate="2013-04-28T15:07:05.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8892" PostTypeId="2" ParentId="8890" CreationDate="2013-04-28T11:40:07.593" Score="3" Body="&lt;p&gt;The frequencies of the harmonics are integer multiples of the fundamental frequency $f_0$, i.e. $f_n = (n+1)f_0$. The fundamental frequency $f_0$ is the greatest common divisor of the harmonics $f_n$. If you are sure that there is no other unknown harmonic between two known harmonics, e.g. you know that you have the fourth and the fifth harmonic, then $f_0$ is of course the difference between the two. But if you just have a collection of harmonics and you don't know anything else about them, then you need to determine $f_0$ as the gcd of $f_n$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-04-29T07:01:52.730" LastActivityDate="2013-04-29T07:01:52.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8893" PostTypeId="2" ParentId="8890" CreationDate="2013-04-28T13:12:29.933" Score="4" Body="&lt;p&gt;Look up the Harmonic Product Spectrum algorithm, which given a sufficient number of actual overtones, is a bit more robust against missing overtones and added noise spectra, than just subtracting all successive tones frequency pairs.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-04-28T13:31:10.693" LastActivityDate="2013-04-28T13:31:10.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8894" PostTypeId="2" ParentId="8868" CreationDate="2013-04-28T16:07:05.053" Score="1" Body="&lt;p&gt;&lt;strong&gt;Short Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just compute a gaussian blur kernel for a given sigma, then perform single iteration of 2D convolution or two 1D convolutions (for rows, then for columns or vice versa).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't forget to normalize the kernel!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the kernel comes out too large (it is typically cropped to $\lceil 3\sigma\rceil$), compute the convolution in frequency domain (i.e. &lt;code&gt;IFT(FT(image) *. FT(kernel))&lt;/code&gt; where &lt;code&gt;*.&lt;/code&gt; is a point-wise multiplication).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't care about precision, you can apply several iterations of a box filter (the more iterations, the better approximation to Gaussian blur, but the more blurring occurs). You can find a nice definition in &lt;a href=&quot;http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement&quot; rel=&quot;nofollow&quot;&gt;SVG Specs&lt;/a&gt;. Box filter is separable (can be done as two 1D filterings) and can be implemented with running sum (filter size is not a problem) - this is probably the fastest approximate smoothing method possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SInce you have the kernel in integers, it is only approximation to gaussian. To imagine what happens after applying by &lt;code&gt;source_kernel&lt;/code&gt; 50 times is equivalent to applying this &lt;code&gt;target_kernel&lt;/code&gt; once:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;target_kernel = IFT( FT(source_kernel) ^. 50 )&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;^.50&lt;/code&gt; is point-wise power function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To learn more about the iterative approach, note that Gaussian blurring is equivalent to applying heat equation on an image (imagine how light &quot;hot&quot; pixels diffuse into darker, cooler pixels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The heat equation is partial differential equation (PDE) in case of images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can apply certain amount of smoothing by specifying time amount for simulating heat dissipation and then applying the heat equation in small time steps. I don't know how time amount relates to gaussian $\sigma$, but you probably find more info in any introductory material to diffusion image filtering using PDEs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each time step requires computing finite differences at every pixel and applying a small stencil - it is somewhat similar to convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This iterative approach is called implicit filtering and can give you very precise amount of smoothing (the precision is limited by the size of your time steps).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Explicit formulation also exists but require solving very large system of equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This kind of filering is rather used for more comlplicated problems like anisotropic diffusion, inverse problems, total variation denoising etc.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-04-28T16:07:05.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8895" PostTypeId="1" CreationDate="2013-04-28T17:31:10.343" Score="1" ViewCount="9462" Body="&lt;p&gt;I have a wav file recorded from my smartphone's mic, and I want to reconstruct the sampled signal and plot the reconstructed signal. After some research and search, I was able to get the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y, fs, nb] = wavread('new.wav');&#xA;x=[1:1:length(y)];&#xA;z = y(:,[1]);&#xA;samp=transpose(z);&#xA;b = 48000/fs;&#xA;&#xA;% Quantizing the Sampled Signal&#xA;    no = N/b;           % no. of samples&#xA;    z = ceil(5*(no));       % no. of bits required&#xA;    quan = zeros(1,z);      % constructing a zero array&#xA;    c = (abs(p_max) + abs(p_min))/32     % size of quantized level&#xA;    u = p_min;&#xA;    w = 1;&#xA;    quant = zeros(1,N);&#xA;    for (q = 1 : b : N)&#xA;        for (r = 1 : 32)&#xA;            y = r;&#xA;            if (samp(q)&amp;gt;=u &amp;amp; samp(q)&amp;lt;=(u+c))&#xA;                for (v = (w+4) : -1 : w) % this loop is for converting decimal into binary&#xA;                    quan(v) = mod(y,2);&#xA;                    y = (y/2)- (mod(y,2)/2);&#xA;                end&#xA;                 quant(q) = r;&#xA;            end&#xA;            u = u + c;&#xA;        end&#xA;        u = p_min;&#xA;        w = w + 5;&#xA;    end&#xA;    quan&#xA;&#xA;    % Writing the Quantized Signal&#xA;    fid = fopen ('quant.bin','w');&#xA;    count = fwrite (fid,quant,'int8');&#xA;&#xA;    % Reading the Quantized Signal&#xA;    fid = fopen ('quant.bin','r');&#xA;    [quant_r,count] = fread (fid,inf,'int8');&#xA;&#xA;    % Reconstructing the Sample of the Quantized Signal&#xA;    for (n = 1 : N)&#xA;        u = p_min;&#xA;        for (ab = 1 : 32)&#xA;            if (quant_r(n)==ab)&#xA;                quant_r(n) = u;&#xA;            end&#xA;            u = u + c;&#xA;        end&#xA;    end&#xA;    figure&#xA;    stem (quant_r);&#xA;    title ('The Reconstructed Sample of Quantized Signal')&#xA;    grid on;&#xA;&#xA;    % Reconstructing the Original Signal&#xA;    for (c1 = 1 : b : (N-b))&#xA;        if (b~=1)&#xA;            xyz = (quant_r(c1+b)-quant_r(c1))/b;&#xA;            for (c2 = (c1+1) : (c1+b-1))&#xA;                quant_r(c2) = quant_r(c2-1) + xyz;&#xA;            end&#xA;        end&#xA;    end&#xA;    figure&#xA;    quant_r = smooth (quant_r);&#xA;    plot (quant_r);&#xA;    title ('The Reconstructed Signal')&#xA;    grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it looks like I can't get my desired output, I'm completely new to signal processing, can someone tell me what is wrong with my code? Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update#1: I just realized that I used a fairly high sample rate(44100hz), so I tried downsampling using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[piano,fs]=wavread('new.wav'); % loads piano&#xA;play=piano(:,1); % Renames the file as &quot;play&quot;&#xA;&#xA;%t = linspace(0,time,length(play));          % Time vector&#xA;x = play;&#xA;y = decimate(x,25);&#xA;&#xA;stem(x(1:30)), axis([0 30 -2 2])   % Original signal&#xA;title('Original Signal')&#xA;figure&#xA;stem(y(1:30))                        % Decimated signal&#xA;title('Decimated Signal')&#xA;&#xA;%changes the sampling rate&#xA;&#xA;fs1 = fs/2;&#xA;fs2 = fs/3;&#xA;fs3 = fs/4;&#xA;fs4 = fs*2;&#xA;fs5 = fs*3;&#xA;fs6 = fs*4;&#xA;&#xA;wavwrite(y,fs3,'new1');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this what I should do? Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update#2: I think my problem is this line:  &lt;code&gt;b = 48000/fs;&lt;/code&gt; it should be sampled interval, I have no idea how to deal with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update#3: I just found the following code that seems do the same thing, is this right? If so I don't need to implement it myself.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sub1=wavread('jamming.wav');&#xA; magnSub1=abs(fft(sub1));&#xA; phaseSub1=angle(fft(sub1));&#xA; sub1_L=magnSub1.*exp(i*phaseSub1);&#xA; sub1_L=ifft(sub1_L);&#xA; q=(abs(sub1_L).*cos(angle(sub1_L)));&#xA; plot(q);&#xA; axis([44000,45000,-1,+1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4161" LastEditorUserId="4161" LastEditDate="2013-04-28T20:11:53.600" LastActivityDate="2014-01-13T08:05:09.913" Title="Sampled signal reconstruction using matlab" Tags="|matlab|continuous-signals|reconstruction|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8896" PostTypeId="1" CreationDate="2013-04-28T17:48:51.923" Score="2" ViewCount="1116" Body="&lt;p&gt;I read this lecture on using PCA/eigenfaces: &lt;a href=&quot;http://www.cse.psu.edu/~rcollins/CSE486/lecture32.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cse.psu.edu/~rcollins/CSE486/lecture32.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I want to use this general procedure to recognize a 3D clay model that I took pictures of from multiple angles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having trouble conceptualizing how it's actually implemented in software. I've &quot;trained&quot; the initial mean and eigenvectors for using ~40 images offline. So I have new input images that will have my 3D model in it (or wont).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My confusion: I'm worried that there's so much else going on in my input image that applying the projection + thresholding equation isn't going to work. It almost seems like I need to sub-image my input many times and try over and over again to get the right projection (almost like multi-template matching). Or maybe I can detect blobs first, create sub-images from the blobs, then try the projection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I have multiple angles of the model I suppose that handles rotational invariance, but what about scale invariance? Seems like whatever subimage I get from my input, I have to try at different scales. Or I'm not understanding something fundamental about how to use PCA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help; for reference I would like to implement this in OpenCV (Java-based).&lt;/p&gt;&#xA;" OwnerUserId="3595" LastActivityDate="2013-05-02T08:52:27.123" Title="Image processing: using PCA for 3d object recognition" Tags="|image-processing|computer-vision|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8897" PostTypeId="1" CreationDate="2013-04-29T00:27:33.733" Score="7" ViewCount="1864" Body="&lt;p&gt;I am sampling a signal at 1kHz, which is essentially a single-frequency sinusoid with a DC offset (and a small amount of noise). I don't know the precise frequency of the sinusoid (it is at most 10Hz), and I want to record the mean value of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I take samples for an arbitrary number of seconds and find the average value (with a longer sample time corresponding to a lower error value, clearly):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\langle x \rangle = \frac{1}{N} \sum_{i=0}^N x_i&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like there should be a better way to do this, however, given that I know something about the form of the signal (namely, it consists of a single-frequency sine wave). If I could determine the frequency, then averaging over a complete number of periods would be an improvement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a FFT to find the frequency seems to be tricky though, since (as far as I can tell) the discrete fourier transform will yield values that are periodic in the frequency domain (ie. the discrete frequencies returned are $ f =i \times f_s \mathbin{/} N$, where $ f_s $ is the sampling frequency; $ f $ is thus always periodic within the $ N $ samples I've measured).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest a good way to do this - either via FFT, or a better method of mean-determination?&lt;/p&gt;&#xA;" OwnerUserId="4457" LastActivityDate="2013-04-29T22:13:29.753" Title="Determining the mean of of a sampled signal (improvements to time averaging method)" Tags="|fft|discrete-signals|dft|sampling|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8899" PostTypeId="2" ParentId="8895" CreationDate="2013-04-29T01:51:12.127" Score="1" Body="&lt;p&gt;I'm not exactly sure what you mean by &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I want to reconstruct the sampled signal&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The term reconstruct has a special meaning in DSP and is related to converting a signal from discrete form to continuous using a DAC and a low-pass filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to guess that you are just looking to plot the signal in time domain, and if that is the case then your code would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y, fs, nbits] = wavread('signal.wav')&#xA;sample_period = 1/fs;                % sample period is just the inverse of the sample rate&#xA;sample_time = size(y)/fs;            % total time represented by the samples &#xA;time = 0:sample_period:sample_time;  % create the time array&#xA;plot(time,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4458" LastActivityDate="2013-04-29T01:51:12.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8900" PostTypeId="2" ParentId="8897" CreationDate="2013-04-29T02:24:15.640" Score="2" Body="&lt;p&gt;tl;dr: The last couple of paragraphs actually give possible answers to the question, including windowing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With any situation where you try to improve upon a method, it is worthwhile looking at how much improvement is available.  That way you can decide how valuable the improvement is, to decide whether it is worth pursuing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error you are trying to avoid is basically that introduced by having partial cycles of the sinusoid in the signal.  If there are a complete number of periods, then taking the time average is the best you are going to get, since the sinusoid disappears in the sum (I'm assuming zero-mean noise here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot below shows the amount of error that will be introduced by incomplete cycles in the signal.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/j57yT.png&quot; alt=&quot;Error in sinusoid mean&quot;&gt;&#xA;This shows the mean of a sinusoidal signal (unit amplitude) over a 1 second, with $f_s = 1$kHz.  If you sample for more than one second, the error will reduce (as you note), and the error will depend on the amplitude of the sinusoid.  For reference, with two seconds of sampling, you end up with this much error:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OZhAa.png&quot; alt=&quot;Error in sinusoidal mean, 2 second signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You note correctly that you won't necessarily be able to measure the exact frequency of your signal with a DFT.  One method that springs to mind for resolving this could be to calculate the FFT of your signal after chopping various numbers of samples from the end.  Do this to minimise the amount of spectral leakage (skirting) in the spectrum, then you will have found the closest approximation to a complete number of cycles of the sinusoid, and can assume the signal mean is about the best you're going to get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can detect minimisation of the leakage by identifying and removing the peak value from the spectrum, then finding the mean of the surrounding few values in the spectrum.  When that mean is minimal (it starts rising again as you continue to remove samples from the signal), you have your sweet spot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: forgot to mention, another simple method would be to window your signal (for example, with a Hamming window).  Then find the average of the windowed signal, and scale it back up to counter the effect of the window.  The scaling value should be &#xA;$$&#xA;\frac{N}{\sum_{n=1}^N w[n]}&#xA;$$&#xA;where $N$ is the number of samples in your signal.  Experiment with different windows to see what works best.&lt;/p&gt;&#xA;" OwnerUserId="1496" LastEditorUserId="1496" LastEditDate="2013-04-29T03:21:44.603" LastActivityDate="2013-04-29T03:21:44.603" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8901" PostTypeId="1" CreationDate="2013-04-29T04:31:46.813" Score="7" ViewCount="1238" Body="&lt;p&gt;Assume a camera has no skew, and has square pixels, that is, its camera-calibration matrix, $K$, looks like:&#xA;$$&#xA;K = \left[\begin{matrix} \alpha&amp;amp;0&amp;amp;u_x\\0&amp;amp;\alpha&amp;amp;u_y\\0&amp;amp;0&amp;amp;1 \end{matrix}\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, it seems that it should be possible to recover the pose of a rectangular planar object, $P$, (for example a flat piece of paper) by only knowing the projected image coordinates $\vec{p_i}$ for $i={1, 2, 3, 4}$ of the object's four corners without knowledge of $K$.  To be more precise, I only care about the orientation of the unit normal vector, $\vec{n}$, of $P$, not its location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the answer given in response to this question:  &lt;a href=&quot;https://dsp.stackexchange.com/questions/2736/step-by-step-camera-pose-estimation-for-visual-tracking-and-planar-markers&quot;&gt;Step by Step Camera Pose Estimation for Visual Tracking and Planar Markers&lt;/a&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We choose world-coordinates such that $P$ is the plane $Z=0$.  We find the homography, $H$, mapping the four-corners of $P$ in world-frame coordinates to its projected coordinates $\vec{p_i}$ for $i=1,2,3,4$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, $H = K[R | \vec{t}]$.  Where $R \in SO(3)$ is the camera's rotation and $t \in \mathbb{R}^3$ is the camera's translation.  If we make the assumption that $K$ is identity (I'll return to this later), then &#xA;$H = [\vec{R_1}|\vec{R_2}|\vec{t}]$.  Where $\vec{R_1}, \vec{R_2}$ are the first and second columns of $R$.  The third column of $R$,  $\vec{R_3}$, is equal to $\vec{R_1}\times\vec{R_2}$.  Finally, $\vec{n} = R\left[\begin{matrix}0\\0\\1\end{matrix}\right] = \vec{R_1}\times\vec{R_2}$ and we are done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's examine the effect of $K$ on our answer $\vec{n}$.  My intuition tells me that $K$ shouldn't matter because varying $\alpha$ will ultimately act as a scalar multiple on our answer $\vec{n}$ which is normalized out since I am only concerned with the direction of $\vec{n}$, not its magnitude.  In addition, it seems that varying $u_x, u_y$ should have the effect of translating the locations of the projected corners $\vec{p_i}$, which should affect $\vec{t}$, but not $\vec{n}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's see if this is true.  If $K \neq I$, then $H = K[\vec{R_1}|\vec{R_2}|\vec{t}]$ and $$\begin{equation}&#xA;\vec{n} = K \vec{R_1} \times K \vec{R_2} = det(K)K^{-T}(\vec{R_1}\times\vec{R_2})\end{equation}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, if $\alpha \neq 1$, &#xA;$$\vec{n} = \alpha(\vec{R_1} \times \vec{R_2})$$&#xA;which is our answer from above times a scalar as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if $u_x, u_y \neq 0$ then &#xA;$$det(K)K^{-T} = \left[\begin{matrix} 1&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\-u_x&amp;amp;-u_y&amp;amp;1 \end{matrix}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &#xA;$$\vec{n} = \left[\begin{matrix} 1&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\-u_x&amp;amp;-u_y&amp;amp;1 \end{matrix}\right](\vec{R_1} \times \vec{R_2})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, our choice of camera center has a large effect on our calculations.  This is not intuitive to me.  Isn't our choice of camera center, $u_x, u_y$ completely arbitrary (for example $[0, 0]$ vs. $[w/2, h/2]$) or is there something I am missing?&lt;/p&gt;&#xA;" OwnerUserId="4460" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2020-12-04T08:53:51.743" Title="Estimating Plane Pose Without Knowledge of Intrinsic Camera Parameters" Tags="|computer-vision|estimation|camera-pose|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8903" PostTypeId="1" CreationDate="2013-04-29T09:14:06.043" Score="4" ViewCount="10059" Body="&lt;p&gt;I would like to ask about smoothing data by using Kalman filter. Due to quantization, I have data that is not smooth. How can I smooth this data by using Kalman Filter. For your information, the data is not constant and have some gradient.&lt;/p&gt;&#xA;" OwnerUserId="4234" LastEditorUserId="80" LastEditDate="2013-04-29T14:49:27.147" LastActivityDate="2013-05-02T16:57:07.197" Title="Smoothing data by using Kalman filter" Tags="|kalman-filters|smoothing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8904" PostTypeId="1" AcceptedAnswerId="8907" CreationDate="2013-04-29T10:26:10.343" Score="1" ViewCount="993" Body="&lt;p&gt;I am confused while writing code to implement Fisher’s F-ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have 4 speakers, each speaker pronounces 2 words and each word has 3 frames and each frame has 30 sub-bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u$ is mean of all speakers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose $x_{ij}$ is one sub-band energy of the $j$th speech frame of&#xA;speaker $i$ with $j= 1\ldots N$, and $i = 1 \ldots M$. $u_i$ and&#xA;$u$ are the sub-band energy averages for speaker $i$ and for&#xA;all speakers, respectively, which are defined as &#xA;$$&#xA;u = \frac{1}{MN} \sum_{i=1}^{M}\sum_{j=1}^N x_{ij}\\&#xA;u_i = \frac{1}{N} \sum_{j=1}^N x_{ij}&#xA;$$&#xA;I have written following MATLAB code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;U=mean(mean(mean(mean(spectr1(:,:,:,:)))));&#xA;for subband=1:N&#xA;nominator=0;&#xA;for speaker=1:speaker_number&#xA;   nominator=(mean(mean(spectr1(speaker,:,:,subband)))-U).^2+nominator;&#xA;end&#xA;denaminator=0;&#xA;denaminator=(mean(mean(mean(spectr1(:,:,:,subband))))-mean(mean(spectr1(speaker,:,:,subband)))).^2;&#xA;F_ratio(subband)=((1/speaker_number)*(nominator))/((1/(speaker_number*phonem_number))*denaminator);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4327" LastEditorUserId="80" LastEditDate="2013-04-29T11:59:04.977" LastActivityDate="2013-04-29T16:51:53.553" Title="Fisher ratio or F_ratio" Tags="|algorithms|statistics|speech-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8905" PostTypeId="2" ParentId="8897" CreationDate="2013-04-29T10:40:45.753" Score="2" Body="&lt;p&gt;Your sampled signal looks like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n) = A\sin\left (\frac{2\pi fn}{f_s} + \phi\right ) + B + e(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A$ is the amplitude, $\phi$ is the phase, $f$ is the frequency of the sinusoidal signal, $f_s$ is the sampling frequency, $B$ is the DC offset, and $e(n)$ is some additive noise, hopefully with zero mean. $A$, $f$, $\phi$, $B$, and $e(n)$ are unknown, and you would like to know $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your idea of averaging the signal is a perfectly valid choice for estimating $B$ (if the additive noise $e(n)$ has indeed a mean value of zero). The problem you have noted is of course that you never know if there is an integer number of periods in your sampled data. To improve on your solution you could try the following. Take a large block of data. Your block length $N$ must satisfy&#xA;$$N\gg \frac{f_s}{f}\tag{1}$$&#xA;Then create sub-blocks of sufficient length (still satisfying (1)). To get your sub-blocks simply cut out overlapping blocks from your original block of data. In this way you introduce a random phase of your signal with respect to the beginning and end of the data blocks, and if you average over each sub-block, and then average the results of all sub-blocks, you'll get a better total estimate. Say your estimate based on the $i^{th}$ sub-block is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{B_{i}}=\frac{1}{M}\sum_{n=n_i}^{n_i+M-1}x(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $M$ the number of data samples in the sub-blocks, then your final estimate of the DC offset would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{B} = \frac{1}{L}\sum_{i=0}^{L-1}\hat{B_{i}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $L$ is the number of sub-blocks.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-29T10:40:45.753" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8906" PostTypeId="2" ParentId="8736" CreationDate="2013-04-29T14:36:51.200" Score="2" Body="&lt;p&gt;I think I understand your question better now. In the Schmidl &amp;amp; Cox paper they do frequency synchronization in two steps by splitting the frequency offset $\Delta f$ into two parts:&#xA;$$&#xA;\Delta f = \Delta f_1 + \frac{2z}{T}\text{,} \quad z \in \mathbb{Z}\text{, }\Delta f_1 &amp;lt; \frac{2}{T}&#xA;$$&#xA;These two parts are estimated and corrected in two steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Correct any frequency offset $\Delta f_1$ with the help of the first training symbol, where $T$ is the OFDM symbol duration without guard interval.&lt;/li&gt;&#xA;&lt;li&gt;Correct the residual frequency offset $2z/T$ with the help of the second training symbol. If $\Delta f &amp;lt; 2/T$ (i.e. $z=0$) the result of the maximization of $B(g)$ should be $\hat g = 0$ and no further correction is necessary in this step.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I think you were referring to step 1 as &quot;fine sync&quot; and to step 2 as &quot;coarse sync&quot;. If you're aksing how it can be determined whether step 2 is necessary then my answer is: you can't unless you can guarantee that $\Delta f &amp;lt; 2/T$. In that case it would never be necessary and the second training symbol would not be needed.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-04-29T14:43:25.463" LastActivityDate="2013-04-29T14:43:25.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8907" PostTypeId="2" ParentId="8904" CreationDate="2013-04-29T16:20:05.960" Score="0" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/F-test&quot; rel=&quot;nofollow&quot;&gt;Well, check out Wikipedia.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ratio is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F = \frac{\mathrm{between-group\ variability}}{\mathrm{within-group\ variability}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where, using your notation, they say that the between-group variability is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{i=1}^{M} (u_i - u)^2/(M -1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the within-group variability is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{i=1}^{M} \sum_{j=1}^{N}( x_{ij} - u_i )^2 / (N - M)&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-04-29T16:51:53.553" LastActivityDate="2013-04-29T16:51:53.553" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8908" PostTypeId="2" ParentId="8897" CreationDate="2013-04-29T17:53:03.950" Score="4" Body="&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: After thinking about it some more I came up with something much simpler than the phase-locked loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem you are having is because you are filtering with a boxcar.  The boxcar filter has a lot of ripples in the frequency domain, so if you choose the wrong width you don't get good attenuation of your approximately 10Hz signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use a Butterworth filter you will get a frequency response that has no ripples.  &lt;em&gt;Everything&lt;/em&gt; over (say) 5Hz will be attenuated by more than -3db.  A Butterworth filter is also cheap to calculate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went to &lt;a href=&quot;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&lt;/a&gt; and asked for a 3rd order Butterworth low-pass filter with a cutoff frequency of 5Hz on a sample rate of 1000Hz and got the following recurrence relation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[n] = (  1 * x[n- 3])&#xA;     + (  3 * x[n- 2])&#xA;     + (  3 * x[n- 1])&#xA;     + (  1 * x[n- 0])&#xA;&#xA;     + (  0.9390989403 * y[n- 3])&#xA;     + ( -2.8762997235 * y[n- 2])&#xA;     + (  2.9371707284 * y[n- 1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'd probably get a better result by using Matlab to design an elliptic filter (and probably one with higher order than 3).  You'll get sharper attenuation beyond the cutoff frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is my original answer about phase-locked loops:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would try a &lt;a href=&quot;http://home.deib.polimi.it/spalvier/TN2/digitalpll.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;discrete time phase-locked loop&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eKvG8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to multiply your input signal by a sinusoid of the same frequency, followed by a low pass filter.  This shifts the sinusoidal part of your input signal to (nearly) zero frequency.  By observing the changes to the output of the low pass filter you are getting an estimate of how far off your estimated frequency is from the actual frequency.  So you feedback the adjustment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the multiplier in the picture above is:&#xA;$$&#xA;Be^{2\pi i \theta_n} + Ae^{2 \pi i (\theta_n + \omega n)} + Ae^{2 \pi i (\theta_n - \omega n)} + \varepsilon'(n).&#xA;$$&#xA;$\theta_n$ is the running sum of the estimated frequency, $\hat{\omega}_n$.  When $\hat{\omega}_n = \omega$ then $\theta_n-\omega n$ is constant, so $A e^{2 \pi i (\theta_n - \omega n)}$ is constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The derivative you want here is the &lt;em&gt;angular&lt;/em&gt; derivative.  Given samples from the low pass filter, $r_ne^{2\pi i \alpha_n}$ and $r_{n+1}e^{2\pi i \alpha_{n+1}}$ you really want $\alpha_{n+1}-\alpha_{n}$.  Dividing low-passed sample $n+1$ by low-passed sample $n$ and taking the complex part gets you essentially the right thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;adjust $\hat{\omega}_n$&quot; box is also non-trivial.  The estimated phase error is likely to be a little noisy so you might want to low-pass filter the phase error and you might want to only adjust $\hat{\omega}_n$ by a fraction of the estimated phase error, rather than by the entire phase error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{\omega}_n$ is the estimated frequency, and $1/\hat{\omega}_n$ is the low-pass filter width you are looking for in your question.  I think you can apply the same trick to the low-pass filter in the phase-locked loop.  By dynamically adjusting the phase-locked loop low-pass filter width to $1/\hat{\omega}_n$ you completely eliminate $Be^{2\pi i \theta_n}$.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="3764" LastEditDate="2013-04-29T22:13:29.753" LastActivityDate="2013-04-29T22:13:29.753" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8909" PostTypeId="1" CreationDate="2013-04-29T18:10:12.483" Score="2" ViewCount="667" Body="&lt;p&gt;I am trying to find the three cervical vertebrae (C2 , C3 , C4)in x-ray videos (gray images)&#xA;I am using SURF to identify the place that has these 3 vertebrae (big box for all of them )&lt;br&gt;&#xA;SURF gives me good result in this case &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am trying to identify each one of these vertebrae from this big box, but SURF failed in this case &#xA;The SURF works very good with the area that has 3 vertebrae , but not good to find each of them separately&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update :&lt;/strong&gt;&#xA;The idea of SURF is finding  the important keypoints in the image. therefore, I am using this idea to find the keypoints in 2 images then find the match points between these 2 images. in the beginning of my program , the user select 4 boxes. one big box for all vertebrae and the other 3 of each one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will use this selected area as a template to find them in the next images in the videos. &#xA;first I will apply SURF to find the big box of the all vertebrae. and this work good with this code &lt;/p&gt;&#xA;&#xA;&lt;p&gt;now I am tying to find the three small boxes inside the big one&#xA;but SURF gives me bad results (wrong boxes)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The photo show you the 4 boxes (ignore the left box and the three points )&#xA;these are the 4 template images that I am using (after crop it 4 times)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question , &#xA;How can I improve the SURF results to get the three vertebrae ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help will be so appreciate :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is the image that show the perfect results .... big box has 3 boxes ... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7R2Zo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code that I am using &#xA;First parameters (Mat img_object) is the template image that I am trying to find in (Mat img_scene) , this second paramter is the big box that has the 3 vertebrae , third parameter is the size of the box that I wanna draw around the object when we find it &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CvRect Identify_SURF_Frame (Mat img_object , Mat img_scene , CvRect in_box) &#xA;    { &#xA;cvNamedWindow(&quot;Good Matches &amp;amp; Object detection&quot;, CV_WINDOW_AUTOSIZE);&#xA;CvRect output_box; &#xA;//-- Step 1: Detect the keypoints using SURF Detector&#xA;int minHessian = 1;  // I reduce this number so I can have a lot of number for  keypoints &#xA;SurfFeatureDetector detector( minHessian , 2 , 3 , true , true );&#xA;std::vector&amp;lt;KeyPoint&amp;gt; keypoints_object, keypoints_scene;&#xA;detector.detect( img_object, keypoints_object );&#xA;detector.detect( img_scene, keypoints_scene );&#xA;&#xA;//-- Step 2: Calculate descriptors (feature vectors)&#xA;SurfDescriptorExtractor extractor;&#xA;Mat descriptors_object, descriptors_scene;&#xA;extractor.compute( img_object, keypoints_object, descriptors_object );&#xA;extractor.compute( img_scene, keypoints_scene, descriptors_scene );&#xA;&#xA;//-- Step 3: Matching descriptor vectors using FLANN matcher&#xA;BruteForceMatcher &amp;lt; L2 &amp;lt; float &amp;gt; &amp;gt; matcher;&#xA;std::vector&amp;lt; DMatch &amp;gt; matches;&#xA;matcher.match( descriptors_object, descriptors_scene, matches );&#xA;double max_dist = 0; double min_dist = 100;&#xA;&#xA;//-- Quick calculation of max and min distances between keypoints&#xA;for( int i = 0; i &amp;lt; descriptors_object.rows; i++ )&#xA;{ &#xA;    double dist = matches[i].distance;&#xA;    if( dist &amp;lt; min_dist ) min_dist = dist;&#xA;    if( dist &amp;gt; max_dist ) max_dist = dist;&#xA;}&#xA;&#xA;//-- Draw only &quot;good&quot; matches (i.e. whose distance is less than 3*min_dist )&#xA;std::vector&amp;lt; DMatch &amp;gt; good_matches;&#xA;for( int i = 0; i &amp;lt; descriptors_object.rows; i++ )&#xA;{ &#xA;    if( matches[i].distance &amp;lt; 4 * min_dist )&#xA;    { &#xA;        good_matches.push_back( matches[i]); &#xA;    }&#xA;}&#xA;&#xA;Mat img_matches;&#xA;drawMatches( img_object, keypoints_object, img_scene, keypoints_scene, good_matches, img_matches, Scalar::all(-1), Scalar::all(-1), &#xA;            vector&amp;lt;char&amp;gt;(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );&#xA;&#xA;//-- Localize the object&#xA;std::vector&amp;lt;Point2f&amp;gt; obj;&#xA;std::vector&amp;lt;Point2f&amp;gt; scene;&#xA;if (good_matches.size() &amp;gt;= 4)&#xA;{&#xA;    for( int i = 0; i &amp;lt; good_matches.size(); i++ )&#xA;    {&#xA;        //-- Get the keypoints from the good matches&#xA;        obj.push_back( keypoints_object[ good_matches[i].queryIdx ].pt );&#xA;        scene.push_back( keypoints_scene[ good_matches[i].trainIdx ].pt );&#xA;    }&#xA;&#xA;    Mat H = findHomography( obj, scene, CV_RANSAC );&#xA;    //-- Get the corners from the image_1 ( the object to be &quot;detected&quot; )&#xA;    std::vector&amp;lt;Point2f&amp;gt; obj_corners(2);&#xA;    obj_corners[0] = cvPoint(0,0); &#xA;    obj_corners[1] = cvPoint( img_object.cols, 0 );&#xA;    //obj_corners[2] = cvPoint( img_object.cols, img_object.rows ); &#xA;    //obj_corners[3] = cvPoint( 0, img_object.rows );&#xA;&#xA;    std::vector&amp;lt;Point2f&amp;gt; scene_corners(2);&#xA;    perspectiveTransform( obj_corners, scene_corners, H);&#xA;    int x1 , x2 , y1 , y2 ;&#xA;    x1 = scene_corners[0].x + Point2f( img_object.cols, 0).x ; &#xA;    y1 = scene_corners[0].y + Point2f( img_object.cols, 0).y ; &#xA;    x2 = scene_corners[0].x + Point2f( img_object.cols, 0).x + in_box.width ; &#xA;    y2 = scene_corners[0].y + Point2f( img_object.cols, 0).y + in_box.height ; &#xA;&#xA;    rectangle(img_matches , cvPoint(x1, y1) , cvPoint(x2, y2)  , Scalar( 255, 255, 255), 1 );&#xA;    output_box.x = x1 - in_box.width ; &#xA;    output_box.y = y1 ; &#xA;    output_box.width = in_box.width ; &#xA;    output_box.height = in_box.height ; &#xA;}&#xA;//-- Show detected matches&#xA;imshow( &quot;Good Matches &amp;amp; Object detection&quot;, img_matches );&#xA;return output_box ; &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4463" LastEditorUserId="4463" LastEditDate="2013-04-29T19:48:18.530" LastActivityDate="2013-04-30T13:00:35.300" Title="False SURF output in video" Tags="|opencv|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8910" PostTypeId="1" AcceptedAnswerId="8917" CreationDate="2013-04-29T19:13:52.487" Score="11" ViewCount="2690" Body="&lt;p&gt;I was asked this question and couldn't come up with an answer on the spot which didn't involve the frequency domain (basically that the co-efficients of the delay sequence are the impulse response of a FIR filter). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any insight which makes this process 'obvious'?&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2022-08-11T07:32:04.933" Title="Why does adding a time delayed version of a signal to itself create a filtered signal?" Tags="|filters|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8911" PostTypeId="1" AcceptedAnswerId="23379" CreationDate="2013-04-29T19:14:04.357" Score="16" ViewCount="27444" Body="&lt;p&gt;I thought that DSP would be done by using FFT of portions of a signal, modify the samples that result from FFT (since they represent the spectrum of our signal + noise) and remove any unwanted signals and than do an inverse FFT to get a time domain representation of the filtered signal (noise has been removed now). This however is not done, instead we do all the work in time domain using window functions. Why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we multiply window function in time domain than we are convolving the window function's frequency response with spectrum of our signal in frequency domain, how does that work out? I mean if we just did all the work in frequency domain by multiplying our signal with the frequency response of the filter, that would be like filtering right? But here we do all the stuff in time domain instead using window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt;Lets see where my confusion comes from. For analogue filters e.g low pass filter, we have this pulse like frequency response. When we filter a signal, we are effectively multiplying our signal's spectrum with the pulse like frequency response of the filter. This will reduce all frequencies in our signal above a cut-off to 0. This is how a low pass filter works in essence. Why not do the same with digital filters as well?&lt;/p&gt;&#xA;" OwnerUserId="4464" LastEditorUserId="4298" LastEditDate="2021-02-09T11:30:28.863" LastActivityDate="2021-02-09T11:30:28.863" Title="Why do we use window in time domain rather than do FFT modify the spectrum and than inverse FFT" Tags="|filters|fft|frequency-spectrum|filter-design|window-functions|" AnswerCount="9" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8912" PostTypeId="2" ParentId="8910" CreationDate="2013-04-29T19:24:37.853" Score="6" Body="&lt;p&gt;If you define (linear time-invariant) filtering as convolution, then the answer is obvious: the sum of a signal and a delayed version of it can be written as a convolution with an impulse response $h(t)$:&#xA;$$h(t) = \delta(t) + \delta(t-T)$$&#xA;where $T$ is the delay between the two versions of the signal.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-29T19:24:37.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8913" PostTypeId="2" ParentId="8911" CreationDate="2013-04-29T20:05:49.467" Score="13" Body="&lt;p&gt;Windowing is used because the DFT calculations operate on the infinite periodic extension of the input signal. Since many actual signals are either not periodic at all, or are sampled over an interval different from their actual period, this can produce false frequency components at the artificial 'edge' between repeated intervals, called &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot;&gt;leakage&lt;/a&gt;. By first multiplying the time-domain signal by a windowing function which goes to zero at both ends, you create a smooth transition between repeated intervals in the infinite periodic extension, thus mitigating the creation of these artificial frequency components when we then take the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://www.physik.uni-wuerzburg.de/~praktiku/Anleitung/Fremde/ANO14.pdf&quot;&gt;paper&lt;/a&gt; gives a more in depth look at this phenomenon, as well as some insight into the effects of different windowing functions.&lt;/p&gt;&#xA;" OwnerUserId="4344" LastActivityDate="2013-04-29T20:05:49.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8914" PostTypeId="2" ParentId="8911" CreationDate="2013-04-29T22:09:43.857" Score="12" Body="&lt;p&gt;I think you are confusing two different operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowing in the time domain is explained by @sam, so I won't repeat that.  But windowing is not done to perform filtering.  Filtering by multiplying the FFT of a signal by the filter frequency response is entirely reasonable in many situations, and is indeed done.  The alternative for filtering is time-domain convolution (which is different to windowing).  This has its own advantages, such as operating on a signal in 'real-time' as it is measured without waiting for the whole thing to be stored then transforming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to your question 'Why not do the same with digital filters as well?', the answer is simply 'we do, when it suits.'&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-04-29T22:09:43.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8915" PostTypeId="2" ParentId="8911" CreationDate="2013-04-29T22:23:31.167" Score="5" Body="&lt;p&gt;Window in the time domain because&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;we can guarantee zero at the edges of the window&lt;/li&gt;&#xA;&lt;li&gt;window functions have a nice analytic expression in spatial domain&lt;/li&gt;&#xA;&lt;li&gt;many window functions have a weird shaped spectrum that would be hard to approximate&lt;/li&gt;&#xA;&lt;li&gt;only a finite number of samples are needed (windowing can be done as the signal streams in)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;e.g. from &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;noreferrer&quot;&gt;wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nWdtg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hard cut off going to zero of windowing functions means in the spectral domain they have side lobes that go to zero very slowly. If we get rid of this constraint we can have functions that are compact in both spatial and spectral domains, like the Gaussian filter. This means you could filter via the spectral domain but that requires the whole signal to be known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do have the entire signal already another alternative would be to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Wavelet&quot; rel=&quot;noreferrer&quot;&gt;wavelets&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-04-29T22:23:31.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8916" PostTypeId="1" CreationDate="2013-04-29T22:25:01.043" Score="4" ViewCount="294" Body="&lt;p&gt;I am trying to understand the LidarBoost algorithm as explained in &lt;a href=&quot;http://www.mpi-inf.mpg.de/~theobalt/cvpr09_superresolution.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; (PDF warning). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how they take the original depth-images $Y_k$ and transform them into the up-sampled images $D_k$. I get how optical flow is used to align the $Y_k$ into a chosen reference frame, but is the transform between $Y_k$ and $D_k$ just a standard image up-sampling with nearest neighbors for the &quot;interpolation&quot; step? If that's the case, can someone explain how they get the term $W_k$ in their data term of the energy function? They say this about it, but I don't understand how to construct $W_k$ for each $k$:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$W_k \in \mathbb{R}^{\beta_n \times \beta_m}$ is a banded matrix that&#xA;  encodes the positions of $D_k$ which one samples from during&#xA;  resampling on the high-resolution target grid&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm trying (so far frustratingly ineffectively) to get enough of a sense of the algorithm to try to implement it.&lt;/p&gt;&#xA;" OwnerUserId="3292" LastEditorUserId="80" LastEditDate="2013-04-30T19:54:18.783" LastActivityDate="2013-04-30T20:09:06.810" Title="Explanation of LidarBoost Algorithm?" Tags="|algorithms|sampling|reconstruction|resampling|superresolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8917" PostTypeId="2" ParentId="8910" CreationDate="2013-04-29T22:27:01.503" Score="11" Body="&lt;p&gt;When you delay a signal by $T$ seconds and add it to the signal itself,&#xA;you are cancelling out or &lt;em&gt;nulling&lt;/em&gt; the signal component at frequency &#xA;$\frac{1}{2T}$ Hz since that signal component will have changed phase&#xA;by exactly $\pi$:&#xA;$$\begin{align}&#xA;\sin\left(2\pi\frac{1}{2T}t + \theta\right) +&#xA;\sin\left(2\pi\frac{1}{2T}(t-T) + \theta\right)&#xA;&amp;amp;= \sin\left(2\pi\frac{1}{2T}t + \theta\right)&#xA;+ \sin\left(2\pi\frac{1}{2T}t + \theta  - \pi\right)\\&#xA;&amp;amp;= \sin\left(2\pi\frac{1}{2T}t + \theta\right)&#xA;+\sin\left(2\pi\frac{1}{2T}t + \theta\right)\cos(\pi)\\&#xA;&amp;amp;\ \hspace{0.2in}-\cos\left(2\pi\frac{1}{2T}t + \theta\right)\sin(\pi)\\&#xA;&amp;amp;= \sin\left(2\pi\frac{1}{2T}t + \theta\right)&#xA;-\sin\left(2\pi\frac{1}{2T}t + \theta\right)-0\\&#xA;&amp;amp;= 0.&#xA;\end{align}$$&#xA;A similar thing happens at odd multiples of $\frac{1}{2T}$ Hz also.&#xA;For nearby frequencies, the cancellation is not as complete, and&#xA;of course, at even multiples of $\frac{1}{2T}$ Hz, the signal &#xA;component is doubled in value instead of being cancelled.&#xA;Similarly, if the delayed signal is reduced in amplitude,&#xA;cancellation is not complete at $\frac{1}{2T}$ Hz etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize, the signal &lt;em&gt;is&lt;/em&gt; being filtered because different&#xA;frequencies are being passed through with different gains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the frequency-domain explanation, the transfer&#xA;function $H(f)$ of the system is the Fourier transform of what Matt's&#xA;answer gave as the impulse response, viz.&#xA;$$\mathcal F\left[\delta(t) + \delta(t-T)\right] = 1+\exp(-j2\pi fT)$$&#xA;which is a nonconstant function of $f$ (in fact, $|H(f)|$ varies&#xA;sinusoidally from a maximum of $2$ to a minimum of $0$ as discussed&#xA;above), and so $Y(f)=H(f)X(f)$ is&#xA;not a scalar multiple of $X(f)$. Filtering!&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-04-29T23:03:52.037" LastActivityDate="2013-04-29T23:03:52.037" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8918" PostTypeId="2" ParentId="8859" CreationDate="2013-04-29T22:57:02.373" Score="2" Body="&lt;p&gt;you could create a matrix that contains the Fourier basis set in the format that conforms to the vectorized version of your images and use this matrix to compute the fft2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can therefore get what you want with a simple matrix multiplication.&lt;/p&gt;&#xA;" OwnerUserId="4323" LastEditorUserId="4323" LastEditDate="2013-05-02T00:02:42.053" LastActivityDate="2013-05-02T00:02:42.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8919" PostTypeId="1" AcceptedAnswerId="8930" CreationDate="2013-04-30T01:36:52.713" Score="8" ViewCount="470" Body="&lt;p&gt;If I record a sound at a rate of 8000 samples per second I know that the highest frequency that can be reproduced from the sound is 4000 Hz. What I want to know is;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the sound contains frequencies above 4000 Hz when I play the sound&#xA;  back what would I hear and what frequencies would be produced at the&#xA;  points where the frequency of the original sound is greater than&#xA;  4000Hz.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="4298" LastEditDate="2013-04-30T06:31:31.590" LastActivityDate="2013-04-30T17:39:17.177" Title="Recording and playback of sound, frequencies question" Tags="|frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8920" PostTypeId="2" ParentId="6464" CreationDate="2013-04-30T04:59:54.450" Score="3" Body="&lt;p&gt;One of my friends did this for his undergraduate thesis. What he basically did was encode properties of each gesture. For example,in the first figure, take a rectangular mask over theportions of the hand. The parts where the skin meets the rectangular mask edge should be noted and marked. Then the relative positions of the larger edge and the smaller edge can be compared. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for pointing upwards, you will have a smaller edge upwards and larger edge at the wrist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For pointing sideways, you have a smaller edge at one side and larger edge at the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The directions at the very least can be covered in this way.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-04-30T04:59:54.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8921" PostTypeId="2" ParentId="8919" CreationDate="2013-04-30T06:30:31.007" Score="8" Body="&lt;p&gt;If your sampling frequency is $f_s=8000$ Hz, your maximum signal frequency is indeed 4000 Hz ($=f_s/2$). If your signal contains frequencies above $=f_s/2$ you would hear the results of &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot;&gt;aliasing&lt;/a&gt;. This means that the original spectrum is folded back into the range $[0,4000]$ Hz. What actually happens is that by sampling with a sampling frequency $f_s$ your spectrum is made periodic with period $f_s$. So if the signal is not band-limited with maximum frequency $f_s/2$, the resulting periodic spectrum will have regions of overlap. E.g., if your signal has frequency components up to 5000 Hz, these frequencies would get folded back to the frequency band between 3000 and 4000 Hz, and consequently lead to distortions in this band. This is the reason why sampling is always preceded by lowpass filtering to attenuate all frequency components that might lead to aliasing (anti-aliasing filter). You can listen to some examples of aliasing &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing#Online_.22live.22_example&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-04-30T06:40:31.170" LastActivityDate="2013-04-30T06:40:31.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8922" PostTypeId="2" ParentId="8909" CreationDate="2013-04-30T06:49:46.723" Score="4" Body="&lt;p&gt;In brief, what you are trying to do is probably not feasible.&#xA;Why? Because SURF was not designed to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a first approximation, SURF is designed as a faster (approximated and with less invariance) SIFT, i.e., a computer vision keypoint detector.&#xA;Roughly speaking, CV keypoints are either corners or blobs as detected by some kind of difference of Gaussians (the scale-space search is used to auomatically select the best Gaussian widths).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While these keypoints are present in structure-from-motion or urban stereoscopic images, they are clearly absent in your images.&#xA;If your primary goal is to detect the vertebrae, you should try instead (and for example):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;template matching approaches (since you have an accurate visual model of what you are looking for)&lt;/li&gt;&#xA;&lt;li&gt;or maybe train some cascade or HoG based detector that will be applied using sliding windows on your full images.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1031" LastEditDate="2013-04-30T13:00:35.300" LastActivityDate="2013-04-30T13:00:35.300" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8923" PostTypeId="2" ParentId="8911" CreationDate="2013-04-30T08:41:30.527" Score="12" Body="&lt;p&gt;There have been several good answers to this question. However, I feel that one important point has not been made entirely clear. One part of the question was why we don't just multiply the FFT of a signal with the desired filter response. E.g., if we want to lowpass filter our signal, we could simply zero all frequency components higher than the desired cut-off frequency. This is in fact a simple application of the well-known frequency sampling method for designing FIR filters. The problem is that we can just zero the discrete frequency components computed by the FFT. We have no control over what happens in between these discrete frequencies. It turns out that such a simple version of filtering will only give a poor stopband attenuation (regardless of the FFT length). If you have access to matlab or octave, it's very instructive to try it yourself: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=2*rand(1024,1)-1;&#xA;X=fft(x);&#xA;Y=X.*[ones(200,1);zeros(625,1);ones(199,1)]; % lowpass filter&#xA;y=real(ifft(Y)); % real() just to remove numerical errors&#xA;Y=fft(y,4096);&#xA;plot(20*log10(abs(Y(1:2048)))),axis([0,2048,-30,50])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-04-30T08:41:30.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8924" PostTypeId="1" AcceptedAnswerId="8925" CreationDate="2013-04-30T09:24:01.390" Score="1" ViewCount="6017" Body="&lt;p&gt;I am trying to implement OFDM on gnuradio. I have two questions.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The sampling frequency which is slightly higher than available bandwidth  satisfies Nyqvist criterion for complex baseband signals. So why do we need to add oversampling factor again? Suppose say oversampling factor is 2. How does that help us in recovery of input signal?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have seen in an OFDM implementation that &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;t_{\rm symbol}=t_{\rm sampl} *(N_c+N_G)*{\rm oversamplingrate } &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_{\rm symbol}$ = Symbol duration,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_{\rm sampl}$=sampling duration,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N_c$ = No. of subcarriers consisting of data and pilot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N_G$ = No. of guard band taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this formula come about? I also have a doubt as to whether each subcarrier corresponds to a single symbol or you can have multiple symbols per subcarrier. What is parameter that decides this?&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="80" LastEditDate="2013-04-30T15:07:16.693" LastActivityDate="2014-06-27T22:10:28.987" Title="Need for Oversampling in OFDM and symbol time determination" Tags="|sampling|digital-communications|dsp-core|ofdm|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8925" PostTypeId="2" ParentId="8924" CreationDate="2013-04-30T09:47:26.893" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;Theoretically, you're right. When all subcarriers are modulated the (baseband) bandwidth of an OFDM signal is approximately $f_\mathrm{s}/2$, where $f_\mathrm{s}$ is the sampling rate. An ideal rectangular filter before A/D conversion would be needed at the receiver to avoid anti-aliasing. As such a filter cannot be implemented in practice, some subcarriers remain unmodulated to make the OFDM spectrum narrower. This zero padding in frequency domain corresponds to oversampling in time domain.&lt;/li&gt;&#xA;&lt;li&gt;An OFDM symbol including guard interval consists of $N_\mathrm{c} + N_\mathrm{G}$ samples each of which has duration $1/f_\mathrm{s}$, where $N_\mathrm{c}$ is the number of subcarriers (equal to IDFT length) and $N_\mathrm{G}$ is the number of guard interval samples. The &quot;oversamplingrate&quot; parameter in the source you referenced seems to be some additional oversampling factor of the transmit signal. What it's needed for, I don't know, because I don't know this software project.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Regarding the terminology of symbols: in OFDM each subcarrier is modulated by a complex value. All subcarriers keep their values during the duration of the OFDM symbol. Sometimes these values are also called symbols because they're usually taken from an QAM alphabet. A subcarrier cannot contain several symbols at a time. To sum it up:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;symbol&lt;/em&gt;: Value of a subcarrier&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;OFDM symbol&lt;/em&gt; (in time domain): entity of all time domain samples that are obtained by taking the IDFT of all subcarriers &lt;em&gt;plus&lt;/em&gt; the guard interval. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The OFDM symbol rate is therefore given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R_\mathrm{s} = \frac{f_\mathrm{s}}{N_\mathrm{c} + N_\mathrm{G}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the number of zero padded subcarriers is irrelevant for the calculation of $R_\mathrm{s}$.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-04-30T13:02:24.463" LastActivityDate="2013-04-30T13:02:24.463" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="8926" PostTypeId="1" CreationDate="2013-04-30T13:22:48.450" Score="1" ViewCount="1203" Body="&lt;p&gt;I extracted sift feature to construct a bag-of-words model. I did the following to extract the feature vector:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Extracted features from the key frames.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After the feature extraction I tried using Principle Component Analysis to reduce the size of my features.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Query: What further pre-processing steps should I take before creating a codebook out of the set of features extracted ?&lt;/p&gt;&#xA;" OwnerUserId="4470" LastEditorUserId="958" LastEditDate="2013-05-02T11:43:46.943" LastActivityDate="2015-03-22T13:17:27.013" Title="How to proceed for BOW creation From sift features" Tags="|matlab|sift|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8927" PostTypeId="1" CreationDate="2013-04-30T14:43:59.743" Score="5" ViewCount="257" Body="&lt;p&gt;Consider a filter which tracks $x_i$, clipping $|x_i - x_{i-1}| &amp;gt;$ some limit, say 1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;in:  0 1 2  10 0 0  10 10 10  0 0 0 0&#xA;out: 0 1 2   3 2 1   2  3  4  3 2 1 0  -- |delta| &amp;lt;= 1&#xA;&#xA;(in Python with Numpy:  cumsum( clip( diff( x ), - limit, limit ))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me to a description of such filters,&#xA;either in theory or in practice ?&lt;br&gt;&#xA;Or is there no theory -- for the task of smoothing concrete $x$,&#xA;just vary the limit and see what happens ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Added: &quot;This tutorial was written for normal engineers, who do not have nonlinear filters for breakfast.&quot; -- F.Daum, &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1499276&quot; rel=&quot;nofollow&quot;&gt;Nonlinear filters: beyond the Kalman filter&lt;/a&gt;. Is this online anywhere ?)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="4389" LastEditDate="2013-05-02T16:49:43.393" LastActivityDate="2013-05-02T16:49:43.393" Title="Delta-limiting filter" Tags="|filters|reference-request|non-linear|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8928" PostTypeId="2" ParentId="8830" CreationDate="2013-04-30T15:46:28.517" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/8837/80&quot;&gt;Jim's answer&lt;/a&gt; sent me to think about how to test this statistically.  This led me to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Durbin%E2%80%93Watson_statistic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Durbin-Watson autocorrelation test&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The generalization of it is to form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;DW(\tau) = \frac{\displaystyle \sum_{n=\tau}^{N-1} \left [ U(n) - U(n-\tau) \right ]^2 }{\displaystyle\sum_{n=0}^{N-1} U(n)^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and my attempt at implementing this in scilab is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// http://en.wikipedia.org/wiki/Durbin%E2%80%93Watson_statistic&#xA;s1 = [1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 0 1 0 1];&#xA;s1n = s1 - mean(s1);&#xA;xs1 = xcorr(s1n,&quot;unbiased&quot;);&#xA;N1 = length(xs1);&#xA;&#xA;s2 = [1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0];&#xA;s2n = s2 - mean(s2);&#xA;xs2 = xcorr(s2n,&quot;unbiased&quot;);&#xA;N2 = length(xs2);&#xA;&#xA;dwstat1 = [];&#xA;dwstat2 = [];&#xA;&#xA;for lag = 1:15,&#xA;&#xA;    dxs1 = xs1((lag+1):N1) - xs1(1:(N1-lag));&#xA;    dxs2 = xs2((lag+1):N2) - xs2(1:(N2-lag));&#xA;&#xA;&#xA;    dwstat1 = [dwstat1 sum(dxs1.^2) / sum(xs1.^2)];&#xA;    dwstat2 = [dwstat2 sum(dxs2.^2) / sum(xs2.^2)];&#xA;&#xA;end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The upshot is that if $DW(\tau)$ is close to zero or close to 4 for a given value of $\tau$, then there is a periodicity (autocorrelation) there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I plot the result for our two example sequences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OLkll.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it's clear that the second sequence exhibits correlation at lags of 4, 8, etc. and anti-correlation at lags of 2, 6, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm still not sure about is how to say $DW(\tau)$ is &quot;close to&quot; 0 or 4.  I'll dig a little further and see what I come up with.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-04-30T15:46:28.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8929" PostTypeId="2" ParentId="8911" CreationDate="2013-04-30T17:26:54.880" Score="6" Body="&lt;p&gt;If you don't use a non-rectangular window, then the FFT results will already be convolved with the transform of a default rectangular window (a periodic Sinc) before doing any frequency domain filtering.  e.g. you will get two filters applied, one of which you probably don't want.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By windowing in the time domain, before the FFT and frequency domain filtering, you replace any filtering (so-called &quot;leakage&quot;) done by rectangular windowing, and thus don't get an additional unwanted filter convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other way to do this is to use overlap-add or overlap save methods on consecutive windows, where the effects of one rectangular window get cancelled by similar effects from the adjacent windows.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-04-30T19:10:14.237" LastActivityDate="2013-04-30T19:10:14.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8930" PostTypeId="2" ParentId="8919" CreationDate="2013-04-30T17:33:52.580" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If I record a sound at a rate of 8000 samples per second I know that&#xA;  the highest frequency that can be reproduced from the sound is 4000&#xA;  Hz.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;False!&lt;/strong&gt;  You can only reproduce frequency content that is &lt;strong&gt;below&lt;/strong&gt; half the sample rate, or in your case, strictly &lt;strong&gt;below&lt;/strong&gt; 4000 Hz (not at 4000 Hz).  Spectral content at exactly half the sample rate might be partially reproduced depending on the phase.  Spectral content near half the sample rate in a finite length window has a similar problem, where it can be strongly attenuated, depending on the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Content above half the sample rate is just folded below half the sample rate.  A frequency above Fs/2 by dF that isn't removed by an anti-aliasing filter will be heard at a frequency of (Fs/2) - dF.  e.g. A 5500 Hz (4000 + 1500) sinewave will be heard as  2500 Hz (4000 - 1500) sinewave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to think about content at exactly half the sample rate is that it gets folded back on itself, and thus interferes with itself, either additively or destructively, depending on phase.  Not good.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-04-30T17:39:17.177" LastActivityDate="2013-04-30T17:39:17.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8931" PostTypeId="2" ParentId="8910" CreationDate="2013-04-30T17:48:00.807" Score="5" Body="&lt;p&gt;If the time delay of the delayed added version of a signal is exactly one cycle of any periodic content, then the output will be additively increased.  If the delay is exactly half the period of any sinusoidal component, then that component will destructively interfere, and thus be zero-ed out of the output.  If the delay is zero, then the signal will be doubled.  For frequency/phase combinations that are between complete destructive interference or complete addition, the additive result will also be in between.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Increasing and decreasing the output depending on the frequency content of the input is typical filtering.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-04-30T17:48:00.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8932" PostTypeId="2" ParentId="8927" CreationDate="2013-04-30T18:37:23.620" Score="4" Body="&lt;p&gt;I guess that would be a slew rate limiter. This is concept is mostly used an amplifier design as a practical constraint of the circuit. I haven't seen it applied as a digital filter. It is certainly very non-linear and it would make a poor &quot;smoothing filter&quot; as it's highly dependent  on the absolute amplitude. Could you shed some light on the specific application and explain what a regular low pass filter can't do the desired smoothing job?&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-04-30T18:37:23.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8933" PostTypeId="2" ParentId="8916" CreationDate="2013-04-30T20:09:06.810" Score="2" Body="&lt;p&gt;It sounds like $W_k$ is just a matrix of 1's and 0's.  When $W_k$ is a 1, then the corresponding range value in $D_k$ is used. If it's a 0, then that range value is not used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, $T_k$ should be mostly 1, and 0 when the corresponding $D_k$ values are unreliable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that tally with your understanding?  If not, can you elaborate on your question with more details of what you suspect?&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-04-30T20:09:06.810" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8935" PostTypeId="1" CreationDate="2013-05-01T00:58:28.187" Score="3" ViewCount="7477" Body="&lt;p&gt;I'm new to Matlab/Simulink and would like to convert the continuous system below to discrete for eventual conversion to C code. Matlab has a c2d function, but I don't know how to apply it to a simulink system.  The c2d function requires the system to be in transfer function or state-space form, neither of which I know how to convert the diagram to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So any ideas on how to use the c2d function in this situation?  Or should I use something like Tick's rule to replace the integrators?  Any other methods?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the simulink diagram in question.  It's purpose is to determine the fundamental of a sine wave.  With further stages, it can also extract higher harmonics if present.  The scope is connected to the fundamental frequency estimate.  The system needs to be converted to 44.1Khz sampled system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rpjo6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this paper for more info: &lt;a href=&quot;http://ijcsi.org/papers/IJCSI-8-5-1-360-365.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ijcsi.org/papers/IJCSI-8-5-1-360-365.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4008" LastEditorUserId="4008" LastEditDate="2013-05-01T17:09:07.760" LastActivityDate="2013-05-01T17:09:07.760" Title="Simulink continuous to discrete question" Tags="|matlab|filters|discrete-signals|continuous-signals|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8936" PostTypeId="1" CreationDate="2013-05-01T01:29:23.183" Score="1" ViewCount="1368" Body="&lt;p&gt;I am working for my class project on making animal repellent , I need to know how I could go about taking a normal audio file and shift its frequency/Pitch very high to make it an ultrasonic sound.&lt;/p&gt;&#xA;" OwnerUserId="4251" LastEditorUserId="13320" LastEditDate="2016-11-21T13:05:28.933" LastActivityDate="2016-11-21T13:05:28.933" Title="generating ultrasonic sound in matlab" Tags="|matlab|audio|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8937" PostTypeId="1" CreationDate="2013-05-01T06:51:50.003" Score="4" ViewCount="2876" Body="&lt;p&gt;I am learning about the Discrete Cosine Transform (DCT) and I read somewhere that, in general, images have very few high frequency components. Can someone give me an intuitive explanation for why this is so? Is this assumption violated in any scenario?&lt;/p&gt;&#xA;" OwnerUserId="3374" LastActivityDate="2013-05-01T15:39:02.400" Title="Why are there only a few high frequency components in the Discrete Cosine Transform?" Tags="|dct|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8938" PostTypeId="2" ParentId="8936" CreationDate="2013-05-01T08:40:39.647" Score="1" Body="&lt;p&gt;A frequency shift by $f_0$ can be realised by amplitude modulation which involves multiplying the input signal $x(t)$ with a carrrier $\cos(2\pi f_0t)$, i. e.&#xA;$$&#xA;y(t) = x(t) \cos(2\pi f_0t)&#xA;$$&#xA;When implementing this in the discrete domain (e.g. in Matlab) the sampling frequency $f_\mathrm{s,in}$ of the input signal has generally to be increased. Assume $x(t)$ has a cut off frequency (alias bandwidth) of $f_\mathrm{c}$. Then the frequency shifted signal $y(t)$ has a cut off frequency of $f_\mathrm{c}+f_0$. Consequently, the sampling frequency $f_\mathrm{s,out}$ of $y(t)$ must fulfill $f_\mathrm{s,out} \geq 2(f_\mathrm{c}+f_0)$ (sampling theorem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest the following steps to implement it in Matlab ($n$ is the discrete time):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create an upsampled version $\tilde x_n$ of the input sequence $x_n$, so that its sampling frequency $f_\mathrm{s,out}$ fulfills the above condition. Use the Matlab function &lt;code&gt;upsample&lt;/code&gt;. If you don't know $f_\mathrm{c}$ assume $f_\mathrm{c}=f_\mathrm{s,in}/2$.&lt;/li&gt;&#xA;&lt;li&gt;Create the discrete-time carrier signal $\cos(2\pi F_0n)$ with $F_0 = f_0/f_\mathrm{s,out}$. It must have the same lenght as $\tilde x_n$.&lt;/li&gt;&#xA;&lt;li&gt;Compute $y_n = x_n \cos(2\pi F_0n)$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-05-01T08:40:39.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8939" PostTypeId="2" ParentId="8936" CreationDate="2013-05-01T08:55:26.087" Score="6" Body="&lt;p&gt;To answer the &quot;how to shift the frequency of an audio signal up&quot; bit:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You could multiply the signal by a sine wave at a high frequency. This would shift and mirror the whole spectrum of the original signal into the high frequencies (multiplication by a sine in the time domain = convolution by a pair of symmetric Dirac in the frequency domain) - the mirror image could then be removed by high-pass filtering. Limitation: this would not preserve integer ratios between harmonics. For example, a harmonic mixture with partials at 100, 200 and 300 Hz would have partials at 1100, 1200 and 1300 Hz if shifted by 1kHz - and the integer ratio between harmonics is lost, making the resulting audio signal &quot;metallic&quot; or &quot;dissonant&quot; - at least to human hearing's perception criteria!.&lt;/li&gt;&#xA;&lt;li&gt;You could simply play back the original data at a higher sample rate. Limitation: multiplying the sample rate will also reduce the duration of the original data.&lt;/li&gt;&#xA;&lt;li&gt;Actual musical pitch-shifting is done with techniques such as the phase vocoder (Short-Term Fourier Transform).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, you probably don't need to bother with any of these methods because:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is no need to shift an existing audio signal - given that the content of the original signal is of little relevance and will be degraded in one way or the other by the transposition process, why not directly generating a tone at the required frequency to start with?&lt;/li&gt;&#xA;&lt;li&gt;Keep in mind that whatever you do, the converters and transducers that come with a computer cannot reproduce ultrasounds (they have a cutoff at the upper limit of the human hearing range, about 20kHz).&lt;/li&gt;&#xA;&lt;li&gt;The evidence that ultrasounds have a repellent effect on mosquitoes is &lt;a href=&quot;http://www.thecochranelibrary.com/userfiles/ccoch/file/CD005434.pdf&quot;&gt;very shallow&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-05-01T08:55:26.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8940" PostTypeId="1" CreationDate="2013-05-01T09:30:42.957" Score="1" ViewCount="2482" Body="&lt;p&gt;I have a signal that was recorded with around 300 samples in a second. Now I want to run a low pass and a high pass butterworth filter over it. The frequency for the high pass filter is around 0.05 Hz and the one for the low pass around 5 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I decide which order my butterworth filters should have? Is there any formula? &lt;/p&gt;&#xA;" OwnerUserId="4476" LastActivityDate="2013-05-01T09:30:42.957" Title="How do decide which order my butterworth filter should have?" Tags="|frequency|filter-design|lowpass-filter|highpass-filter|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8941" PostTypeId="2" ParentId="8937" CreationDate="2013-05-01T09:36:23.260" Score="6" Body="&lt;p&gt;High frequencies correspond to rapid changes in pixel intensity over a small displacement (a few pixels) - most &quot;natural&quot; images have large features which change relatively slowly so most of the information is in the lower spatial frequency range. High frequencies tend to be mainly noise, sharp edges or very fine textured features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that a similar general principle also applies to audio - most of the information is in the lower part of the audible range, while the higher frequencies are mainly noise and less important details.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2013-05-01T12:29:38.507" LastActivityDate="2013-05-01T12:29:38.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8942" PostTypeId="2" ParentId="8937" CreationDate="2013-05-01T11:04:37.690" Score="3" Body="&lt;p&gt;Regarding exceptions: Scanned monochrome documents, especially drawings/engravings/comics/technical blueprints, can have high frequency components, due to the sharp edges, fill patterns and use of &lt;a href=&quot;https://en.wikipedia.org/wiki/Hatching&quot; rel=&quot;nofollow&quot;&gt;cross-hatching&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-05-01T11:04:37.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8943" PostTypeId="2" ParentId="8937" CreationDate="2013-05-01T12:58:34.237" Score="2" Body="&lt;p&gt;First, most images have pixel values that are always positive. For example, 8-bit grey-scale images usually have pixel values in the range from 0 to 255.  So a fundamental reason for images having &quot;smaller&quot; high-frequency components is that there is always a large &quot;DC&quot; (zero-frequency) component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take, for example, this test image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0eFiw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the background has a value of about 140 or so, as can be seen from this cross-section at row 543.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GmoOj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image is obviously a test image, and so contains several elements of higher-than-normal frequency. However, even this image does not contain much energy in the high frequency range, as can be seen from taking the FFT of the same row 543 (with the mean-value removed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OKw0I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-05-01T13:50:36.980" LastActivityDate="2013-05-01T13:50:36.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8944" PostTypeId="2" ParentId="8937" CreationDate="2013-05-01T15:39:02.400" Score="8" Body="&lt;p&gt;There are two parts to the answer.  One has to do with the nature of sharp edges, the second has to do with the how imaging systems (lenses and the human eye) work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @PeterK's example demonstrates artificial (human created) images tend to have large regions of one color with sharp transitions between the regions.  This is similar to a square wave.  But if you look at the fourier transform of a square wave it will be a &lt;em&gt;decreasing&lt;/em&gt; sum of the odd frequencies:&#xA;$$&#xA;\sum_{n=1, 3, 5, ...}\frac{1}{n} \sin{ n \omega t}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images of the natural world also often have regions of slowly changing color with sharp transitions where one object overlaps another.  There can actually be a lot of high frequency &quot;texture&quot; in an image (grass, leaves, a pebbly beach, waves on water that is relatively far away, whispy clouds) but the sharp edges of the occlusions (overlaps) obey the same square-wave fall-off in frequencies beyond the fundamental frequency (the average distance between tree trunks, blades of grass, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second part of the answer is that imaging systems (camera lenses/eyes) can not make out features smaller than a certain minimum angular resolution.  Images outside of the imaging systems &lt;a href=&quot;http://en.wikipedia.org/wiki/Lens_(optics)#Imaging_properties&quot; rel=&quot;noreferrer&quot;&gt;depth of field&lt;/a&gt; will be blurred because lenses have focal points.  But even objects inside the depth of field will be blurred.  This is because the aperture through which the light must pass must be reasonably large (several mm) in order to let in enough light.  But this means that point-sources of light actually create a &lt;a href=&quot;http://en.wikipedia.org/wiki/Circle_of_confusion&quot; rel=&quot;noreferrer&quot;&gt;circle of confusion&lt;/a&gt; that essentially acts as a low-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of this the human eye, for example, is more sensitive at some frequencies than others.  In the below image the contrast differences across horizontal scans in the image are the same, but your eye is more sensitive to mid-frequency contrast differences than high-frequency contrast differences.  (You may have to adjust the distance from the image to your eye to see the effect line up with the black line drawn on the image.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OZKAv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-05-01T15:39:02.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8945" PostTypeId="1" CreationDate="2013-05-01T16:43:31.237" Score="3" ViewCount="257" Body="&lt;p&gt;This is a classical image segmentation problem: I need to make a visual measurement of particles.&#xA;I've been using watershed, kmeans and mean shift but it doesn't work well on this image. Could you please recommend me some other methods/open source code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P/S: Any manual/semi automatic segmentation is also ok with me. I just need the correct segmentation in a reasonable not time consuming way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TV3fx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3802" LastEditorUserId="2046" LastEditDate="2013-05-02T07:41:59.710" LastActivityDate="2016-01-04T05:16:01.580" Title="Segmentation of microscopic images" Tags="|image-segmentation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8946" PostTypeId="5" CreationDate="2013-05-01T18:45:37.797" Score="0" Body="&lt;p&gt;FSK or &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency-shift_keying&quot; rel=&quot;nofollow noreferrer&quot;&gt;Frequency-Shift Keying&lt;/a&gt; is a frequency modulation scheme in which digital information is transmitted through discrete frequency changes of carrier waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are multiple implementation of FSK which can include (but not limited to):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Minimum-shift_keying&quot; rel=&quot;nofollow noreferrer&quot;&gt;Minimum frequency-shift keying or Minimum-shift keying (MSK)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Audio frequency-shift keying (AFSK)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The most common application of FSK is that of binary data, where a digital signal (comprising of 1's and 0's) is carried through a modulated carrier signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aM1Nj.png&quot; alt=&quot;Stolen from wikipedia&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4355" LastEditorUserId="80" LastEditDate="2013-05-01T19:02:29.410" LastActivityDate="2013-05-01T19:02:29.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8947" PostTypeId="4" CreationDate="2013-05-01T18:45:37.797" Score="0" Body="FSK or Frequency-Shift Keying is a frequency modulation scheme in which digital information is transmitted through discrete frequency changes of carrier waves." OwnerUserId="4355" LastEditorUserId="80" LastEditDate="2013-05-01T19:02:56.210" LastActivityDate="2013-05-01T19:02:56.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8949" PostTypeId="1" CreationDate="2013-05-01T19:28:12.260" Score="18" ViewCount="36961" Body="&lt;p&gt;How can I calculate the (black body equivalent) color temperature of the light source illuminating a given image? Below are screenshots of Adobe Lightroom manipulating color temperature and a shift in the RGB Histograms. Given RGB components of the image, how do I go about calculating it? I should expect a single value - The black body equivalent temperature of the illumination source, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/b0f5p.png&quot; alt=&quot;4600K&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/e2RBH.png&quot; alt=&quot;23810K&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="842" LastEditorUserId="128" LastEditDate="2020-12-12T21:28:21.843" LastActivityDate="2021-08-23T03:59:35.170" Title="How to Calculate the Color Temperature / Tint of the Colors in an Image?" Tags="|image-processing|color|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8950" PostTypeId="1" CreationDate="2013-05-01T19:44:28.497" Score="3" ViewCount="2662" Body="&lt;p&gt;Why do we need to flip the kernel in 2D convolution in the first place?&#xA;What's the benefit of this?&#xA;So, why can't we leave it unflipped? What kind of terrible thing can happen if you don't flip it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SEE:&#xA;&quot;First, flip the kernel, which is the shaded box, in both horizontal and vertical direction&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.songho.ca/dsp/convolution/convolution2d_example.html&quot; rel=&quot;nofollow&quot;&gt;http://www.songho.ca/dsp/convolution/convolution2d_example.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4478" LastActivityDate="2013-05-01T20:35:21.747" Title="Why do we need to flip the kernel in 2D convolution?" Tags="|image-processing|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="8951" PostTypeId="2" ParentId="8950" CreationDate="2013-05-01T20:35:21.747" Score="2" Body="&lt;p&gt;At the risk of repeating what has been said elsewhere, this is how convolution in two dimensions is defined:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n_1,n_2) = \sum_{k}\sum_{l}x(k,l)h(n_1-k,n_2-l))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n_1,n_2)$ is your data and $h(n_1,n_2)$ is the kernel. Note that in order to compute the double sum above, you need to flip $h(n_1,n_2)$ with respect to $x(n_1,n_2)$. Just take $n_1=0$ and $n_2=0$: in this case you need to multiply $x(k,l)$ with the flipped kernel $h(-k,-l)$. In order to compute the output for other values of $n_1$ and $n_2$ you need to move the flipped kernel across the input data.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-01T20:35:21.747" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8952" PostTypeId="1" AcceptedAnswerId="8953" CreationDate="2013-05-01T21:24:12.390" Score="4" ViewCount="15080" Body="&lt;p&gt;So I am working on a project using digital signal processing, which I am not familiar with at all, and a lot of this is all new to me. I am using SciPy\NumPy to play around with code to understand the Fourier Transform.  Basically, I have been able to read in a wave file and perform an FFT on the data using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;samplerate, data = wavfile.read(sys.argv[1])&#xA;fftres = fft(data)&#xA;&#xA;for i in range(1, len(fftres)):&#xA;    print i, &quot;,&quot;, fftres[i], &quot;\n&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My results look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(51.0478396084-421.235956694j)&#xA;(0.0324635664874+372.476395255j)&#xA;(-198.202964067+219.743659247j)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what I'm looking at to be honest.  I need to find the frequencies in my file so I can apply a bandpass filter on the audio signal.  From my output, how do I actually get the frequencies?&lt;/p&gt;&#xA;" OwnerUserId="4479" LastEditorUserId="4344" LastEditDate="2013-05-01T22:16:32.203" LastActivityDate="2013-05-01T23:04:24.377" Title="What do I do with the result of an FFT?" Tags="|fft|python|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8953" PostTypeId="2" ParentId="8952" CreationDate="2013-05-01T23:04:24.377" Score="7" Body="&lt;p&gt;I would recommend doing some proper reading of books/tutorials etc on the Fourier transform and the Discrete Fourier Transform (DFT).  You will also want to look at filters and probably convolution for the bandpass filter.  But regardless, here's some info that should help with your current state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use matplotlib to plot the FT that you've calculated:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 44100 # Or whatever the actual sample rate is (Hz)&#xA;f = linspace (fs,len(data), endpoint=False)&#xA;mpl.plot (f, abs (fftres))&#xA;title ('Magnitude spectrum of the signal')&#xA;xlabel ('Frequency (Hz)')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another function you will want to look at is &lt;code&gt;fftshift&lt;/code&gt;, which makes it simple to 'roll' your spectrum around so that DC is in the centre.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequencies that are sampled by the DFT are between $-f_s/2 &amp;lt; f &amp;lt; f_s/2$ for sampling frequency $f_s$.  And the FFT produces the same number of samples as the number of data points provided to it.  The FFT function returns the spectrum so that the DC (constant/average) value is first in the array.  Use the function &lt;code&gt;fftshift&lt;/code&gt; to adjust the array if you want it ordered  $-f_s/2 &amp;lt; f &amp;lt; f_s/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will now repeat: Fourier transforms and filtering are a huge field, and while it will definitely be interesting and useful to play with the functions for a bit like you are doing, you really need to read up on what is going on if you want to actually do anything useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside: why are you starting at index 1 in your loop, rather than 0?&lt;/p&gt;&#xA;" OwnerUserId="1496" LastActivityDate="2013-05-01T23:04:24.377" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="8954" PostTypeId="1" CreationDate="2013-05-02T06:48:02.153" Score="1" ViewCount="101" Body="&lt;p&gt;Suppose there is a distribution that has values sampled on the interval 1-25 with corresponding sample values that have to be smoothed. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n    f[n]&#xA;&#xA;3    123&#xA;5    234&#xA;8    246&#xA;10   567&#xA;14   253&#xA;18   251&#xA;24   132&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first column has sample points between 1-25 but does not have samples for all points on the interval. Should interpolation of other points in the distribution be done so that we have approximate values for all points between 1-25 before applying Gaussian smoothing?&lt;/p&gt;&#xA;" OwnerUserId="4271" LastEditorUserId="4344" LastEditDate="2013-05-02T16:42:40.210" LastActivityDate="2013-05-02T16:42:40.210" Title="Is there a need of Point interpolation before proceeding for gaussian smoothing of an incomplete distribution?" Tags="|interpolation|smoothing|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8955" PostTypeId="1" CreationDate="2013-05-02T07:03:37.330" Score="-1" ViewCount="345" Body="&lt;p&gt;i am working in digital image restoration field, i am familiar with java and i want to use java in &lt;strong&gt;image restoration&lt;/strong&gt;, can any please suggest me any book or tutorials where i can learn about image restoration using java.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already checked this &lt;a href=&quot;http://www.jhlabs.com/ip/blurring.html&quot; rel=&quot;nofollow&quot;&gt;java tutorial&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4444" LastEditorUserId="4344" LastEditDate="2013-05-02T16:51:40.303" LastActivityDate="2013-05-02T16:51:40.303" Title="Image restoration using java" Tags="|image-processing|java|" AnswerCount="1" CommentCount="0" ClosedDate="2013-06-14T21:59:20.203" ContentLicense="CC BY-SA 3.0" />
  <row Id="8956" PostTypeId="1" AcceptedAnswerId="50352" CreationDate="2013-05-02T07:45:48.590" Score="7" ViewCount="795" Body="&lt;p&gt;I am doing some massive number crunching in MATLAB which involves millions of PSD estimations. Each data segment has length 41. So I have been using the multi-taper method with &lt;code&gt;nfft=41&lt;/code&gt; (details below in the code). My last simulation took more than eight hours. The code is optimized and vectorized as I can make it so I thought maybe if I change &lt;code&gt;nfft=64&lt;/code&gt; that might speed up. The profiler confirms that &lt;code&gt;pmtm&lt;/code&gt; is the slowest part by far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, looking at the MATLAB help pages, I see that in the documentation it says nothing more than if &lt;code&gt;nfft&lt;/code&gt; is larger than the length of the data segment then it is zeropadded. My question is what exactly is MATLAB doing? How exactly is the signal padded?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't really find anything googling and I ran my own experiments and I am not getting what I'm supposed to. Here I present my code and the result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;close all&#xA;clear all&#xA;&#xA;dseg = [ 395.9640&#xA;  392.3630&#xA;  388.8230&#xA;  385.2820&#xA;  381.6130&#xA;  378.2600&#xA;  374.7470&#xA;  371.1860&#xA;  367.9920&#xA;  364.7830&#xA;  361.6630&#xA;  358.5660&#xA;  355.5620&#xA;  352.5820&#xA;  349.5530&#xA;  346.8110&#xA;  343.8130&#xA;  340.9010&#xA;  338.1460&#xA;  335.5110&#xA;  332.6300&#xA;  330.0470&#xA;  327.4020&#xA;  324.0930&#xA;  321.4680&#xA;  318.8760&#xA;  316.4470&#xA;  314.0850&#xA;  311.5310&#xA;  309.0600&#xA;  306.7570&#xA;  304.6690&#xA;  302.5820&#xA;  300.3890&#xA;  298.2480&#xA;  296.3650&#xA;  294.1660&#xA;  291.7610&#xA;  290.3300&#xA;  287.9700&#xA;  285.9850];&#xA;&#xA;% Original signal with length=41&#xA;[ffty1,fftf1] = pmtm(dseg,4,41,1/30);&#xA;semilogy(fftf1,ffty1,'-o')&#xA;hold on&#xA;&#xA;% Matlab &quot;zeropads&quot; to length=64&#xA;[ffty2,fftf2] = pmtm(dseg,4,64,1/30);&#xA;semilogy(fftf2,ffty2,'-or')&#xA;&#xA;% Original zeropaded on both sides&#xA;dsegpad = [zeros(11,1); dseg; zeros(11,1); 0];&#xA;[ffty3,fftf3] = pmtm(dsegpad,4,64,1/30);&#xA;semilogy(fftf3,ffty3,'-ok')&#xA;&#xA;% Original zeropadded at the end&#xA;dsegpad = [dseg; zeros(23,1)];&#xA;[ffty4,fftf4] = pmtm(dsegpad,4,64,1/30);&#xA;semilogy(fftf4,ffty4,'-og')&#xA;&#xA;% Original signal just repeated&#xA;dsegpad = [dseg; dseg(1:23)];&#xA;[ffty5,fftf5] = pmtm(dsegpad,4,64,1/30);&#xA;semilogy(fftf5,ffty5,'-oc')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I compare the original PSD with MATLAB's padded PSD and they are close. Then I zeropad myself instead of letting MATLAB do it. I zeropadded on both sides of the signal. I tried zeropadding all on one side. I even tried periodically repeating the signal to pad the length. But in all three of the cases my padded PSDs are way larger than the original and MATLABs PSDs. Here is what I see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/emRVr.jpg&quot; alt=&quot;MATLAB PSD comparison&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried looking at &lt;code&gt;pmtm&lt;/code&gt; code but got lost pretty fast. Anybody knows what MATLAB is doing and why does it obfuscate it so?&lt;/p&gt;&#xA;" OwnerUserId="3364" LastEditorUserId="128" LastEditDate="2018-07-07T11:12:47.130" LastActivityDate="2021-04-29T04:21:18.347" Title="How Exactly Does MATLAB Zero Pad Signal?" Tags="|matlab|signal-analysis|power-spectral-density|zero-padding|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8957" PostTypeId="2" ParentId="8955" CreationDate="2013-05-02T08:18:44.720" Score="2" Body="&lt;p&gt;I don't think Java as such would offer exceptional advantages to Image Restoration as such. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are comfortable using Java and want to use it as a development tool, using ImageJ as a library would be a good starting step. &lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-05-02T08:18:44.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8958" PostTypeId="2" ParentId="8896" CreationDate="2013-05-02T08:52:27.123" Score="2" Body="&lt;p&gt;Principle Component Analysis by itself is not going to provide rotational or scale invariance. You still have to provide templates for rotational and scaled models for image/template matching. What PCA does do is reduce the dimensionality of the search space  by converting a set of observations of possibly correlated variables into a set of values of linearly uncorrelated variables called principal components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now since number of principle components &amp;lt;= number of components, you save on the search space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the lecture tries to tell you is with the eigenvectors, you get an efficient representation of the scales of the template which are easier to manipulate(a single scale factor) then manipulating the entire image everytime.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-05-02T08:52:27.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8959" PostTypeId="2" ParentId="8903" CreationDate="2013-05-02T09:05:30.047" Score="0" Body="&lt;p&gt;The Kalman gain is a function of the relative certainty of the measurements and current state estimate, and can be &quot;tuned&quot; to achieve particular performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A. If we can tune the gain parameter to be high, the filter will emphasize(follow) on the sensor measurements and will follow the sensor measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;em&gt;This kind of a setting will not allow you to smooth your data&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B. If we can tune the gain parameter to be low, the filter will emphasize more(follow) on the values as predicted by the system/signal model and smooth out the noise in the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;em&gt;This type of tuning would lead to smoothed data at the cost of responsiveness of the data to fluctuations&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the extremes, a gain of one causes the filter to ignore the state estimate entirely, while a gain of zero causes the measurements to be ignored.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2013-05-02T09:05:30.047" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8960" PostTypeId="2" ParentId="8954" CreationDate="2013-05-02T10:49:15.257" Score="1" Body="&lt;p&gt;Irregularly sampled data need not necessarily be interpolated prior to smoothing. You can try to smooth your data in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t_n)=\frac{\sum_{k}g(t_n-t_k)x(t_k)}{\sum_{k}g(t_n-t_k)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $t_n$ are your sample times, $x(t_n)$ are your data, and $g(n)$ is your smoothing kernel. Note that $t_n$ need to be integers (as in your example), which is no restriction, just a matter of formulation. Since $t_n$ are irregular, you do not always use all values of the chosen kernel $g(n)$, but this is compensated for by the normalization in (1). The kernel width has to be chosen such that the kernel always covers at least several of your irregularly sampled data. The smoothing in (1) is also used in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_regression#Nadaraya-Watson_kernel_regression&quot; rel=&quot;nofollow&quot;&gt;Nadaraya-Watson estimator&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-02T10:49:15.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8961" PostTypeId="2" ParentId="8903" CreationDate="2013-05-02T14:20:45.550" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/8869/80&quot;&gt;Using the same state transition information as this answer to another question&lt;/a&gt;, but using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(t) = round(H*x_truth(:,t) + rand(1,1,&quot;normal&quot;)*sqrt(R));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as the signal model's output equation, we can apply the same Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not really accurate, because the &lt;code&gt;round&lt;/code&gt; function is a nonlinearity sort of like quantization. However, quantization can also be modeled as an additive noise, so we'll proceed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results are shown in the plot below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the black line is the true position, &lt;/li&gt;&#xA;&lt;li&gt;the red &lt;code&gt;+&lt;/code&gt; signs are the quantized, noisy position measurements, and&lt;/li&gt;&#xA;&lt;li&gt;the green line is the Kalman filter's estimate of the position.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this the sort of &quot;smoothing&quot; you're interested in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cLvMz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the error between the true position and the Kalman filter's estimate is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KVznl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Including full scilab script for reference.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Signal Model&#xA;DeltaT = 0.1;&#xA;F = [1 DeltaT; 0 1];&#xA;G = [DeltaT^2/2; DeltaT];&#xA;H = [1 0];&#xA;&#xA;x0 = [0;0];&#xA;sigma_a = 0.1;&#xA;&#xA;Q = sigma_a^2;&#xA;R = 0.1;&#xA;&#xA;N = 1000;&#xA;&#xA;a = rand(1,N,&quot;normal&quot;)*sigma_a;&#xA;&#xA;x_truth(:,1) = x0;&#xA;for t=1:N,&#xA;    x_truth(:,t+1) = F*x_truth(:,t) + G*a(t);&#xA;    y(t) = round(H*x_truth(:,t) + rand(1,1,&quot;normal&quot;)*sqrt(R));  // &amp;lt;== Changed line!!&#xA;end&#xA;&#xA;// Kalman Filter&#xA;p0 = 100*eye(2,2);&#xA;&#xA;xx(:,1) = x0;&#xA;pp = p0;&#xA;pp_norm(1) = norm(pp);&#xA;for t=1:N,&#xA;    [x1,p1,x,p] = kalm(y(t),xx(:,t),pp,F,G,H,Q,R);&#xA;    xx(:,t+1) = x1;&#xA;    pp = p1;&#xA;    pp_norm(t+1) = norm(pp);&#xA;end&#xA;&#xA;// Plots&#xA;figure(1);&#xA;clf;&#xA;plot(x_truth(1,:),'ko');&#xA;plot(y,'r+');  &#xA;plot(xx(1,:),'g.');&#xA;&#xA;figure(2);&#xA;clf;&#xA;plot(x_truth(1,:) - xx(1,:));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-05-02T16:57:07.197" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8962" PostTypeId="1" AcceptedAnswerId="8964" CreationDate="2013-05-02T15:20:47.123" Score="5" ViewCount="12596" Body="&lt;p&gt;I've sampled a propagating wave so that I know its amplitude at several equidistant points on a line, and at several points in time. That is, I have this discrete function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f[t,x]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, I want to find the frequency of the wave. But there seems to be two frequencies I can calculate: by finding the FFT at different points in time (e.g. FFT{f[1,x]} ) and at different points in space (e.g. FFT{f[t,1]}).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only the latter (&quot;temporal frequency&quot;) gives me a main frequency in Hz. The other one gives one in 1/m, but I suppose that if I knew the wave propagation speed in m/s, I could convert one to the other. Is this true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the above I've just reasoned through myself. Could someone point me to a source where I could read about the two different types of frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I'll add that the time-space relation is &quot;normal&quot;, i.e. the wave propagates like $g(kx-\omega t)$. Hope I'm not being too unclear. I realise that I'm lacking the terminology needed to explain what I mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2: It might be important to know that $f$ is a pulse that is localised in time and space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 3: I'll put this question here too: Is there a way to take advantage of all the sample points (a 2D matrix) to estimate the central frequency, assuming I know the wave speed?&lt;/p&gt;&#xA;" OwnerUserId="471" LastEditorUserId="471" LastEditDate="2013-05-02T16:30:27.127" LastActivityDate="2022-04-18T10:47:38.447" Title="Spatial and temporal frequency of a wave" Tags="|fft|frequency-spectrum|frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8964" PostTypeId="2" ParentId="8962" CreationDate="2013-05-02T15:47:15.023" Score="8" Body="&lt;p&gt;The two frequencies you are referring to are the &lt;a href=&quot;http://en.wikipedia.org/wiki/Spatial_frequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;spatial frequency&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;temporal frequency&lt;/a&gt; of the wave, and you are correct in your reasoning on converting one to the other. The spatial frequency refers to how many complete periods the signal goes through for a given unit of distance (eg. cylcles/m) while the temporal frequency refers to how many complete periods the signal goes through for a given unit of time (eg. cyles/s or Hz).&lt;/p&gt;&#xA;&lt;p&gt;The physical meaning of the two frequencies should be fairly easy to understand if you imagine the wave you are sampling is a simple sine wave. Then it is easy to see that for any constant point in time, your signal will be a frozen sine wave which is periodic in space, and thus has a &amp;quot;spatial frequency&amp;quot;. Conversely, for any constant point in space, the value of the signal will oscillate over a regular period in time, and thus have a &amp;quot;temporal frequency&amp;quot; component. You can also imagine that the faster the wave was travelling through space, the faster the signal would change at any one point in space, giving rise to a higher temporal frequency and underlining the relationship between the two properties via the wave's speed.&lt;/p&gt;&#xA;&lt;p&gt;Regarding using all the sample points to estimate the wave frequency, I believe you should be able to use the known speed to scale one of your dimensions to match the other, since &lt;span class=&quot;math-container&quot;&gt;$distance=velocity*time$&lt;/span&gt;. Then a 2D FFT of the matrix should give you information based on all of the available samples in whichever dimension you choose.&lt;/p&gt;&#xA;" OwnerUserId="4344" LastEditorUserId="4344" LastEditDate="2022-04-18T10:47:38.447" LastActivityDate="2022-04-18T10:47:38.447" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8966" PostTypeId="2" ParentId="8877" CreationDate="2013-05-02T16:34:35.107" Score="3" Body="&lt;p&gt;Check out this article by Eric Jacobsen and Peter Kootsookos:&#xA;&lt;a href=&quot;http://www.ingelec.uns.edu.ar/pds2803/Materiales/Articulos/AnalisisFrecuencial/04205098.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ingelec.uns.edu.ar/pds2803/Materiales/Articulos/AnalisisFrecuencial/04205098.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had some success using this method for doing &quot;sub-bin&quot; frequency estimation when only one sinusoid is present.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="80" LastEditDate="2014-10-23T08:36:33.197" LastActivityDate="2014-10-23T08:36:33.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8967" PostTypeId="1" CreationDate="2013-05-02T17:20:43.707" Score="2" ViewCount="383" Body="&lt;p&gt;I know there's a benefit of knowing the Fourier Transform for image processing, but is there a benefit to know Fourier series, or could you just skip them? Would you recommend skipping Fourier series or would that make it too abstract? What's your opinion on this?&lt;/p&gt;&#xA;" OwnerUserId="4478" LastActivityDate="2013-05-03T13:26:16.390" Title="Benefit to know Fourier series for image processing?" Tags="|fourier-transform|fourier-series|" AnswerCount="1" CommentCount="8" ClosedDate="2013-05-04T11:58:34.877" ContentLicense="CC BY-SA 3.0" />
  <row Id="8968" PostTypeId="2" ParentId="8949" CreationDate="2013-05-02T21:21:55.710" Score="12" Body="&lt;p&gt;This &lt;a href=&quot;https://ams.com/documents/20143/80162/TCS34xx_AN000517_1-00.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; (pdf download/updated link) gives the following formulae for calculating Correlated Color Temperature (CCT). They do not explicitly say (or I missed it), but their example leads me to infer that they are assuming RGB values in the range of 0-255.&lt;/p&gt;&#xA;&lt;p&gt;1. Convert the RGB values to &lt;a href=&quot;http://en.wikipedia.org/wiki/CIE_1931_color_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;CIE tristimulus values&lt;/a&gt; (XYZ) as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X = (-0.14282)(R) + (1.54924)(G) + (-0.95641)(B)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Y = (-0.32466)(R) + (1.57837)(G) + (-0.73191)(B) = Illuminance$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Z = (-0.68202)(R) + (0.77073)(G) + (0.56332)(B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;2. Calculate the normalized chromaticity values:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x = X/(X+Y+Z)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$y = Y/(X+Y+Z)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;3. Compute the CCT value from:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CCT = 449n^3 + 3525n^2 + 6823.3n + 5520.33$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{where }n = (x − 0.3320) / (0.1858 − y)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which can be combined to form the following equation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CCT = 449n^3 + 3525n^2 + 6823.3n + 5520.33$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{where }n = ((0.23881)R+(0.25499)G+(-0.58291)B) / ((0.11109)R+(-0.85406)G+(0.52289)B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am not sure about applying this to an image, but if you just want a single, generalizing number, than you could perhaps use some sort of averaging? Either find an acceptable &amp;quot;average&amp;quot; RGB value for the image (eg. the centroid) and use that to calculate a temperature or (a much more computationally expensive option) calculate the temperature for each pixel in the image and take the average of those results.&lt;/p&gt;&#xA;&lt;p&gt;Also, bear in mind that CCT is only an approximate metric for most colors, since only a single curve in the color space actually represents color which can be obtained from a real world black body radiator. Thus for all other colors, the calculated color temperature is simply an approximation of the black body temperature it most closely represents. Thus, for some colors (especially greens) it can actually be a somewhat meaningless value, at least in a physical sense. This is illustrated well in the following image (from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_temperature&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia article on color temperature&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IJuJT.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The black line in the image represents the &lt;a href=&quot;http://en.wikipedia.org/wiki/Planckian_locus&quot; rel=&quot;nofollow noreferrer&quot;&gt;Planckian Locus&lt;/a&gt; of colors which could actually be produced by block body radiation. The smaller crossing lines represent the isotherms of the CCT approximation nearby.&lt;/p&gt;&#xA;&lt;p&gt;Also, since your question specifically references Adobe Lightroom, I found &lt;a href=&quot;http://forums.adobe.com/message/3936298&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; while searching around:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The sliders [in Adobe Lightroom] adjust not the black body temp of the light, but the compensation applied to the image to compensate for the black body temp of the light.  This goes the other way round.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So bear in mind that the color temperature you see on the Lightroom slider will not be the same as those calculated from the above formulae.&lt;/p&gt;&#xA;" OwnerUserId="4344" LastEditorUserId="7092" LastEditDate="2021-08-23T03:59:35.170" LastActivityDate="2021-08-23T03:59:35.170" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8969" PostTypeId="2" ParentId="4847" CreationDate="2013-05-03T04:36:47.097" Score="1" Body="&lt;p&gt;I have some kind of task as described here, counting people. But my requirement is the camera should be facing people from left/right side, not over the head.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, exploring possible solution for my case, I stumble upon an interesting method for your case (overhead detection). Those solutions use stereo camera so that you can handle blobs (people moving too close together) by seeing the depth (e.g. only see blobs on average people head level).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This product might give you better explanation:&#xA;&lt;a href=&quot;http://www.digiop.com/products/3d-camera&quot; rel=&quot;nofollow&quot;&gt;digiop&lt;/a&gt;. See the brochure for more technical explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I am not representing the company, just pointing out a well documented solution&lt;/p&gt;&#xA;" OwnerUserId="4377" LastActivityDate="2013-05-03T04:36:47.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8971" PostTypeId="1" CreationDate="2013-05-03T06:47:07.090" Score="3" ViewCount="987" Body="&lt;p&gt;I'm modulating a message with particular baudrate, say 2MHz using BPSK , Carrier frequency(Fc) is 8MHz, What should be appropriate Sampling Frequency(Fs) following Nyquist criteria, Should it be greater than 2*(2*baudrate) or 2*(Fc+baudrate)?&lt;/p&gt;&#xA;" OwnerUserId="4445" LastActivityDate="2015-01-30T03:31:14.243" Title="Appropriate sampling frequency for bpsk modulated signal" Tags="|digital-communications|dsp-core|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8972" PostTypeId="2" ParentId="1759" CreationDate="2013-05-03T10:14:08.920" Score="5" Body="&lt;p&gt;The time domain signal (or impulse response)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h(n)=a^{n}\cos n\theta_0,\quad &#xA;\theta_0=2\pi\frac{f_0}{f_s},\; n\ge 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is very common: it is a damped sinusoidal function (assuming &lt;span class=&quot;math-container&quot;&gt;$|a|&amp;lt;1$&lt;/span&gt;) which occurs frequently, because it is one possible response of a second order linear time-invariant system. So concerning your doubt, the cosine part is definitely meant to be part of the time domain signal. The poles and zeros can be found by rewriting &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}H(z)&amp;amp;=\frac{1-az^{-1}\cos \theta_0}{1-2az^{-1}\cos\theta_0+a^2z^{-2}}\\&amp;amp;=&#xA;\frac{z(z-a\cos \theta_0)}{z^2-2az\cos\theta_0+a^2}\end{align}\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) it is easy to determine the zeros of &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$z_{0,0}=0\quad z_{0,1}=a\cos\theta_0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For determing the poles, we write &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt; as a partial fraction expansion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(z)=\frac{1}{2}\left [ \frac{1}{1-ae^{j\theta_0}z^{-1}}&#xA;+ \frac{1}{1-ae^{-j\theta_0}z^{-1}} \right ]\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (2) we see that the poles are given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$z_{\infty,0}=ae^{j\theta_0}\quad z_{\infty,1}=ae^{-j\theta_0}$$&lt;/span&gt;&#xA;We have complex conjugate poles because &lt;span class=&quot;math-container&quot;&gt;$h(n)$&lt;/span&gt; is real-valued. Assuming that &lt;span class=&quot;math-container&quot;&gt;$h(n)$&lt;/span&gt; is an impulse response, we can see from the poles that the system is stable if &lt;span class=&quot;math-container&quot;&gt;$|a|&amp;lt;1$&lt;/span&gt; because then the poles are inside the unit circle of the complex plane.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2019-08-21T09:07:13.593" LastActivityDate="2019-08-21T09:07:13.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8974" PostTypeId="2" ParentId="8967" CreationDate="2013-05-03T12:24:14.617" Score="6" Body="&lt;p&gt;In image processing, you are always dealing with discrete data, so the transform isn't really a Fourier transform, it is a discrete Fourier transform (DFT with a sum rather than an integral).  The DFT can be understood as providing the coefficients of a Fourier series from which a periodic version of you're original image can be reconstructed.  The &quot;checker board&quot; image is always implied in the inverse of the DFT which would construct an infinite checker board of squares made up of your original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally the area outside the boundaries of you're original image is just ignored (treated as undefined), but if for some reason that area must be considered when reconstructing from a DFT (you transformed a sub-section of an image for example) that area will be filled with a periodic replication of of the transformed portion of you're image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say it is worth the little bit of time it takes to understand Fourier series before moving on to Fourier transforms so you understand the underlying assumptions and mechanics of the transform.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2013-05-03T12:24:14.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8977" PostTypeId="1" CreationDate="2013-05-03T13:48:21.167" Score="1" ViewCount="392" Body="&lt;p&gt;Wikipedia lists a number of different FFT algorithms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cooley–Tukey FFT algorithm, Prime-factor FFT algorithm, Bruun's FFT algorithm, Rader's FFT algorithm, and Bluestein's FFT algorithm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the pros and cons of each algorithms? (think about: computational expense, parallelizability, ease of implementation, etc.)&#xA;And which ones are preferred for which applications?&lt;/p&gt;&#xA;" OwnerUserId="4478" OwnerDisplayName="user8005" LastEditorUserId="4478" LastEditDate="2013-05-03T22:31:55.763" LastActivityDate="2013-05-03T22:31:55.763" Title="What are the differences between the various FFT algorithms?" Tags="|fft|algorithms|" AnswerCount="0" CommentCount="4" ClosedDate="2013-05-03T21:10:29.547" ContentLicense="CC BY-SA 3.0" />
  <row Id="8979" PostTypeId="1" AcceptedAnswerId="8982" CreationDate="2013-05-03T21:57:59.330" Score="3" ViewCount="11902" Body="&lt;p&gt;I need to smooth some data segments and one of the techniques I am experimenting is a low-pass filter. So I designed a low-pass filter in matlab and applied it to my signals. Here is what happened with two of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0tpXX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Panel A is one of the data segments plotted with its filtered signal. It looks good. This is what I expect and Panel B is its signed residual which is the filtered signal minus the original signal. I see there is no DC offset and no linear trend so I am happy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Panel C is another data segment plotted with its filtered result and there is an obvious offset between the two. The filtered signal &quot;doesn't run through&quot; the signal like how I think it should. Panel D is its residual and we confirm that the mean is not zero. And sometimes (not shown here) I see a linear trend as well in the residual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is what is going on here? How should one interpret this? I am using low-pass filtering so the DC component should be included so the mean of the residual should be close to zero. Does this say something about the power at high frequencies like is there &quot;too much&quot; power at higher frequencies? Something with leakage or something like power leaking from the zero channel to other neighboring frequencies? Maybe I did something wrong? Is there anyway to fix this? I need to be sure that all of the residuals are like Panel B with no linear trends and the mean being around zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bigger focus is to look at both the smoothed signal (the low-pass filtered signal) AND the residual with the emphasis being on the residual. If this can be fixed then good otherwise I am thinking after filtering like this, then subtracting a least squares fit straight line from the residual. Then adding the signed residual to the original signal to get the smoothed-version that goes &quot;through&quot; the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yep, I know guys that generally it isn't a good idea to low-pass and subtract. But long story and I have no choice. As you can see in the code, the data segments all have length 41 with 30 seconds cadence so the frequency step size is 0.000813 which is of course also the first bin after the zero channel. So what I am trying to do is to get rid of the power in the zero channel and then look at all other (higher) frequency bins so in other words, detrending (hence my cutoff frequency at 9mHz). The problem is that I need a smoothed version of the signal as well as the detrended signal. So as far as I can tell, either low pass and then subtract...OR...high pass and then add.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks everyone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;% Filter Design&#xA;Fpass = 1e-09;   % Passband Frequency&#xA;Fstop = 0.009;   % Stopband Frequency&#xA;Apass = 1;       % Passband Ripple (dB)&#xA;Astop = 60;      % Stopband Attenuation (dB)&#xA;Fs    = 1/30;    % Sampling Frequency&#xA;h = fdesign.lowpass('fp,fst,ap,ast', Fpass, Fstop, Apass, Astop, Fs);&#xA;Hd = design(h, 'equiripple', ...&#xA;        'MinOrder', 'any', ...&#xA;        'StopbandShape', 'flat');&#xA;xavg = filtfilt(Hd.numerator,1,x);&#xA;yavg = filtfilt(Hd.numerator,1,y);&#xA;xdelta = xavg - x;&#xA;ydelta = yavg - y;&#xA;&#xA;t=1:41;&#xA;&#xA;figure&#xA;subplot(2,2,1)&#xA;plot(t,x,'o',t,xavg)&#xA;legend('x','Filtered x')&#xA;title('Panel A - Signal x and Filtered Signal x')&#xA;subplot(2,2,3)&#xA;plot(t,y,'o',t,yavg)&#xA;legend('y','Filtered y')&#xA;title('Panel C - Signal y and Filtered Signal y')&#xA;&#xA;subplot(2,2,2)&#xA;plot(t,xdelta)&#xA;title('Panel B - Signed Residual - Filtered x minus x')&#xA;subplot(2,2,4)&#xA;plot(t,ydelta)&#xA;title('Panel B - Signed Residual - Filtered y minus y')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit: I didn't see the comments before. I just saw them right now and checked out what geometrikal pointed out. And here is the pic&#xA;&lt;img src=&quot;https://i.stack.imgur.com/bMID5.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;different data sets but same idea. I couldn't find the original numbers I used so just took another set of numbers. So here I am only plotting two signals, no residuals. Call the top X which gives a bigger offset and the bottom Y. So for both of the signals, I plot the signals with results of the various filtering methods. Here is the code to show what I am doing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;% Just normal filtering&#xA;xfilt = filtfilt(Hd.numerator,1,x);&#xA;yfilt = filtfilt(Hd.numerator,1,y);&#xA;&#xA;% Filtering by subtracting the mean and then adding it&#xA;xfiltmean = filtfilt(Hd.numerator,1,x-mean(x))+mean(x);&#xA;yfiltmean = filtfilt(Hd.numerator,1,y-mean(y))+mean(y);&#xA;&#xA;% The scaled filter&#xA;sc = mean(filtfilt(Hd.numerator,1,ones(1,41)));&#xA;xfiltsc = xfilt/sc;&#xA;yfiltsc = yfilt/sc;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and yep the filter doesn't sum to one as the picture clearly shows. sum(Hd.numerator)=0.9546 so which one of the two is the problem is this? What does this mean? Is it the zeropadding or this scaling thing? Because applying both of these fixes individually seems to work or at least they give roughly the same answers. Both of them together like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;(filtfilt(Hd.numerator,1,x-mean(x))+mean(x))/sc;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;won't work because now the filtered signal will clearly be too large (and verified this with my data). And the magnitude of the data doesn't seem to matter even if I do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;x = x+1000;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the same results. Both filters are almost identical. So which fix should I apply? Removing the mean or scaling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks guys for all your help.&lt;/p&gt;&#xA;" OwnerUserId="3364" LastEditorUserId="3364" LastEditDate="2013-05-08T05:55:02.723" LastActivityDate="2013-05-08T05:55:02.723" Title="Even after applying a low pass filter, why is there a DC offset?" Tags="|matlab|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="8980" PostTypeId="1" AcceptedAnswerId="8991" CreationDate="2013-05-03T22:08:26.923" Score="2" ViewCount="1760" Body="&lt;p&gt;I have a small 2D Gaussian image filter that I am currently applying as a window by convolution. I would like to do this in the Fourier domain as a single multiplication. I would like to convert my current small filter to the Fourier domain as it is with maximum possible fidelity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know the size of the image that I shall be applying it on and want to be able to dynamically change it for any image size. How do I go about doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I scale my filter to the image size (&lt;strong&gt;square to rectangle&lt;/strong&gt;), FFT the scaled and now distorted and multiply in the Fourier domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I FFT it first, scale up (&lt;strong&gt;square to rectangle&lt;/strong&gt;) and distort the FFT and then multiply it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not convinced that either is a correct approach. Are there any alternative ways?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working with this in MATLAB&lt;/p&gt;&#xA;" OwnerUserId="842" LastActivityDate="2013-06-04T03:20:26.577" Title="How do I convert a filter from Spatial to Fourier domain?" Tags="|image-processing|fft|filter-design|resampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8981" PostTypeId="2" ParentId="8979" CreationDate="2013-05-03T23:17:48.700" Score="3" Body="&lt;p&gt;The DC offset is just the average of all your samples.  You should calculate that first, subtract it, &lt;em&gt;then&lt;/em&gt; run your filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what is happening here is that your data is getting padded with zeros on the left and right, so you are actually averaging your real data with a bunch of extra zeros.  (I don't know matlab, so I may be very wrong about this.)  So the DC value you are getting right now is &lt;em&gt;way&lt;/em&gt; off (low because your data is all large and positive.)&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-05-03T23:17:48.700" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="8982" PostTypeId="2" ParentId="8979" CreationDate="2013-05-03T23:45:30.113" Score="2" Body="&lt;p&gt;It could be a few things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero padding of the input signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some filtering operations pad the end of the signal with zeros before convolving it with the filter kernel. I don't think &lt;code&gt;filtfilt&lt;/code&gt; does this though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filter doesn't sum to 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say you had a discrete signal that was all 1's. The low pass filtering should also return all 1's. Because you are operating on discrete signals, even if the filter is designed properly the errors that come in through discretisation can cause the filter to give a different value. For example, compare the discrete Gaussian kernel to the sampled Gaussian kernel below (image taken from wikipedia, more info at &lt;a href=&quot;http://en.wikipedia.org/wiki/Sampled_Gaussian_kernel&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Sampled_Gaussian_kernel&lt;/a&gt;). I think this is the most likely explanation. You could scale your filter output as a crude fix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FwbFp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Gaussian kernel is often used for low-pass smoothing because it generates a scale-space. In practice this means that smoothing does not generate any new features in the signal, and that more smoothed signals will always have the same or less detail as less smoothed signals. I would try that if you haven't already.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-03T23:45:30.113" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8983" PostTypeId="1" AcceptedAnswerId="8989" CreationDate="2013-05-04T04:15:24.260" Score="2" ViewCount="2286" Body="&lt;p&gt;I am going through an old exam paper and trying to understand this question where they ask us to tell them what effect the following image filter would have if its convolved with an image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     0     0     0     0     1     0     0&#xA;     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     0&#xA;     0     0     0     0     0     0     1&#xA;     0     0     0     0     0     0     0&#xA;     1     0     0     0     0     0     0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now by using Matlab I can easily tell that this blurs the image. But what I am wondering is how would one know by just looking at this filter that the image will get blurred when this filter is applied?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the image I'm working with in its original form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lLrmc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the same image after being convolved with the kernel in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E3F4w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate an explanation here or if someone can point me in the right direction as to a reading online I'd appreciate that too.&lt;/p&gt;&#xA;" OwnerUserId="4471" LastEditorUserId="128" LastEditDate="2019-08-16T06:01:49.937" LastActivityDate="2019-08-16T06:01:49.937" Title="The Effect of a Kernel on an Image By Filtering" Tags="|image-processing|filters|convolution|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8984" PostTypeId="1" CreationDate="2013-05-04T07:34:01.223" Score="4" ViewCount="249" Body="&lt;p&gt;Can you help me (show me how) to solve the following exercise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the process with transfer function $G(s)=e^{-2s}/(s+1)$ design a digital controller with sampling time $T_{s} = 1$ that meets the specifications:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$e_{∞}$ (steady state error) null whit a step as input;&lt;/li&gt;&#xA;&lt;li&gt;dominant poles in closed loop with damping $ζ≥0,5$;&lt;/li&gt;&#xA;&lt;li&gt;settling time $T_{a1}≤20sec $.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4490" LastEditorUserId="4490" LastEditDate="2013-05-05T08:48:26.800" LastActivityDate="2013-05-05T08:48:26.800" Title="Digital control: Exercise solution" Tags="|frequency-response|transfer-function|control-systems|performance|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8985" PostTypeId="1" CreationDate="2013-05-04T07:42:00.520" Score="0" ViewCount="305" Body="&lt;p&gt;I am trying to understand how image processing is applied for detection of cancer tumor using image processing. Towards this direction I am trying to get latest information i.e state of the art in this area. I found one book titled &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://books.google.co.in/books/about/Image_Processing_Techniques_for_Tumor_De.html?id=HiGMZDT1IXYC&amp;amp;redir_esc=y&quot; rel=&quot;nofollow&quot;&gt;&quot;Image-Processing Techniques for Tumor Detection&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this is more than 10 years old and I think lots of new developments must have taken place since then. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be thankful if somebody can point me to references which are latest on the subject.       &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2023-12-11T20:05:45.710" Title="State of the art in Cancer tumour detection using Digital image processing algorithms" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="8987" PostTypeId="2" ParentId="8983" CreationDate="2013-05-04T08:43:36.213" Score="1" Body="&lt;p&gt;You need to understand how convolution work. You apply the filter by placing the filter on the image.  You than calculate sum of all the P(x,y)*C(x,y)=v. Then you replace center pixel value (the pixel value which is under the center of the filter) with v.  This is the new value of pixel You then slide the filter up, down , left right in every possible direction, and replace all pixels that coincides with center of filter by a newly computed v. Ultimately you get a filter image. The coefficients of the  filter  would define which type of filter is this: high, low or some thing else. To be a high pass filter it need to have all the coefficients equal such that total sum of the coefficient is 1. (this is not strictly needed though). This is because when you take equal coefficients you are essentially taking effects from all the neighboring pixels equally and replacing the pixel by this effect. Thus you have minimized the 'changes'. Which is low pass filtering.                   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In present case it is not clear how you know that it is blurring filter. In fact it can be seen that it is not a low pass or blurring filter. Why I said this? Because you look at the filter coefficients which are mostly zero. In a blurring filter (which is a low pass filter) the idea is to take neighboring effects 'equally' and replace the pixel in question with this neighboring effect. In your case actually you are taking effects from far apart pixels since you have coefficients 1 there only.  So it cannot be said that it is blurring in true sense.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take a complete white image think how will it appear after filtering? For an 8 bit image it will be: every pixel will be replaced by (256 + 256 +256)= 256. So the image will remain as it is. Here we have ignored boundary conditions.  In general we can say that each v value will be very much different from the actual neighboring pixel of the pixel in question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will add to this answer more later.                 &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2013-05-04T08:43:36.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8988" PostTypeId="1" CreationDate="2013-05-04T11:54:50.633" Score="0" ViewCount="345" Body="&lt;p&gt;I have a degree in Electrical Engineering (focusing on VLSI). However, I am more mathematically minded, and only recently discovered that image processing seems to contain lots of interesting maths. I am looking to break into this field in a about a year or so in spite of not having any formal experience in this area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering: would contributing to code development on one of the open source projects help my cause? Would this enable me to overcome my lack of formal education or experience in this field? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also appreciate it if someone could point me to good open source resources. I know of GitHub and Nasa's Vision workbench. However, I have not contributed to any open source projects and I don't know what to expect. &lt;/p&gt;&#xA;" OwnerUserId="3374" LastEditorUserId="3374" LastEditDate="2013-06-10T11:07:08.073" LastActivityDate="2013-06-10T11:07:08.073" Title="Getting stuck into an open source image processing/computer vision project" Tags="|image-processing|soft-question|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8989" PostTypeId="2" ParentId="8983" CreationDate="2013-05-04T12:16:03.737" Score="6" Body="&lt;p&gt;Convolution with following kernel returns the signal unchanged.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0     0     0     0     0     0     0&#xA; 0     0     0     0     0     0     0&#xA; 0     0     0     0     0     0     0&#xA; 0     0     0     1     0     0     0&#xA; 0     0     0     0     0     0     0&#xA; 0     0     0     0     0     0     0&#xA; 0     0     0     0     0     0     0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the '1' is shifted to the right one position, the convolution output will be shifted to the right one position as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the '1' is a '2' the convolution output will be double (scaled by 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is more than one non-zero number in the kernel, the convolution output will be the addition of each scaled and shifted copy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your kernel&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0     0     0     0     1     0     0&#xA; 0     0     0     0     0     0     0&#xA; 0     0     0     0     0     0     0&#xA; 0     0     0     0     0     0     0&#xA; 0     0     0     0     0     0     1&#xA; 0     0     0     0     0     0     0&#xA; 1     0     0     0     0     0     0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the output is the addition of three copies of the signal, shifted by (1,3), (3,-1) and (-3,-3) and scaled by 1. I wouldn't call it blurring though. &lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-04T12:16:03.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8990" PostTypeId="2" ParentId="8983" CreationDate="2013-05-04T12:59:29.247" Score="0" Body="&lt;p&gt;I would say it does sums three shifted copies of the original image. The shifts are given by positions of 1s in the kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the kernel is normalized (i.e. 1/3 instead of each 1), the result would be average of the three shifted image.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-05-04T12:59:29.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8991" PostTypeId="2" ParentId="8980" CreationDate="2013-05-04T13:36:47.670" Score="1" Body="&lt;p&gt;For a low-pass filter that is small compared to the image you can put your filter (unscaled) in the center of a square/rectangle the size and shape of your image (all the other pixels are 0), take the FFT and multiply the result  in the Fourier domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are using a Gaussian filter you &lt;em&gt;could&lt;/em&gt; do something more efficient than that.  The Gaussian filter is _ separable_ so you can actually create a 2D Gaussian filter by doing a 1D Gaussian filter in every row (column) in one dimension followed by a 1D Gaussian filter in every column (row) in the other dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the Fourier transform of a Gaussian is a Gaussian.  So we can work in one dimension at a time, we know what we're going to get, and multiplying a Gaussian in the Fourier domain is also separable since $e^{-(x^2+y^2)}=e^{-x^2}e^{-y^2}$.  The only question is what the standard deviation ($\sigma$) of the transformed Gaussian is going to be.  The derivation is worked out on &lt;a href=&quot;http://mathworld.wolfram.com/FourierTransformGaussian.html&quot; rel=&quot;nofollow&quot;&gt;Mathworld&lt;/a&gt; as:&#xA;$$&#xA;\mathcal{F}[e^{-ax^2}](k)=\sqrt{\frac{\pi}{a}}e^{-\pi^2k^2/a}.&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="3764" LastEditDate="2013-05-05T03:17:53.420" LastActivityDate="2013-05-05T03:17:53.420" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="8993" PostTypeId="2" ParentId="8988" CreationDate="2013-05-05T03:59:43.607" Score="3" Body="&lt;p&gt;I believe it would if you intend to practice your knowledge, rather than go into academia.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you look into the code base of &lt;code&gt;opencv&lt;/code&gt;, &lt;code&gt;simplecv&lt;/code&gt;, and &lt;code&gt;scikit-image&lt;/code&gt;, as suggested. Once you become comfortable with using them, you can submit patches for bugs and new algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, you will also need to understand what you are doing at a theoretical level, so get some books too. There are also courses online, such as &lt;a href=&quot;https://www.coursera.org/course/images&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://www.coursera.org/course/digital&quot; rel=&quot;nofollow&quot;&gt;that&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2013-05-05T03:59:43.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8995" PostTypeId="1" AcceptedAnswerId="8996" CreationDate="2013-05-04T23:33:15.490" Score="2" ViewCount="2140" Body="&lt;p&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/filtops.htm&quot; rel=&quot;nofollow&quot;&gt;This link&lt;/a&gt; contains the following statement:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In contrast to the frequency domain, it is possible to implement non-linear filters in the spatial domain. In this case, the summations in the convolution function are replaced with some kind of non-linear operator.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is it not possible to perform non-linear filtering in frequency domain ?&lt;/p&gt;&#xA;" OwnerUserId="4515" OwnerDisplayName="curryage" LastActivityDate="2013-05-05T15:51:38.013" Title="Is it not possible to perform non-linear filtering in frequency domain?" Tags="|image-processing|filtering|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8996" PostTypeId="2" ParentId="8995" CreationDate="2013-05-05T05:52:58.487" Score="9" Body="&lt;p&gt;Linear filters in the spatial domain have a direct equivalent in the frequency domain, so you can transform your data and filter between spatial&amp;lt;-&gt;frequency domains and get equivalent results. However the transforms that we use for converting between spatial&amp;lt;-&gt;frequency domains are only valid for &lt;em&gt;linear systems&lt;/em&gt; - a non-linear filter such as a median filter therefore has no frequency domain equivalent, so we can't perform e.g. median filtering in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this does not mean that there are no non-linear operations that we can perform in the frequency domain, e.g. we could reduce all frequency components below a certain threshold value to zero, it's just that there are no counterparts between the two domains for non-linear operations, so the frequency domain threshold operation described would have no equivalent operation in the spatial domain.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastEditorUserId="39" LastEditDate="2013-05-05T15:51:38.013" LastActivityDate="2013-05-05T15:51:38.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="8997" PostTypeId="1" AcceptedAnswerId="8999" CreationDate="2013-05-05T13:52:38.163" Score="8" ViewCount="2299" Body="&lt;p&gt;&lt;strong&gt;Update 8&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unhappy of having to upload tracks to the service and looking at the new release of RekordBox 3 I've decided to take another look for an offline approach and a finer resolution :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sounds promising though still in a very alpha state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Johnick - Good Time&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KXxB4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9cfTv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there's no logarithmic scale nor palette tuning, just a raw mapping from frequency to HSL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The idea&lt;/em&gt; : now a waveform renderer has a color provider which is queried for a color for a specific position. The one you are seeing above gets the zero crossing rate for the 1024 samples next to that position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously there's still a lot to do before getting something robust but it seems like a good path...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;http://rekordbox.com/en/&quot; rel=&quot;nofollow noreferrer&quot;&gt;RekordBox 3&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xxW3U.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CGCpV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 7&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final form that I'll adopt, much like in Update 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PaRN5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(it's been a little Photoshopped to get smooth transitions between colors)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conclusion is I was close months ago but did not consider that result thinking it was bad X)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 6&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've unearthed the project recently, so I thought about updating here :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Song : Chic - Good Times 2001 (Stonebridge Club mix)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hHQIY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GW8Pr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZXG3S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GepMz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's way better IMO, beats have a constant color etc ... it's not optimized though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;How ?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still with &lt;a href=&quot;http://developer.echonest.com/docs/v4/_static/AnalyzeDocumentation.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://developer.echonest.com/docs/v4/_static/AnalyzeDocumentation.pdf&lt;/a&gt; (page 6)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each segment :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static int GetSegmentColorFromTimbre(Segment[] segments, Segment segment)&#xA;{&#xA;    var timbres = segment.Timbre;&#xA;&#xA;    var avgLoudness = timbres[0];&#xA;    var avgLoudnesses = segments.Select(s =&amp;gt; s.Timbre[0]).ToArray();&#xA;    double avgLoudnessNormalized = Normalize(avgLoudness, avgLoudnesses);&#xA;&#xA;    var brightness = timbres[1];&#xA;    var brightnesses = segments.Select(s =&amp;gt; s.Timbre[1]).ToArray();&#xA;    double brightnessNormalized = Normalize(brightness, brightnesses);&#xA;&#xA;    ColorHSL hsl = new ColorHSL(brightnessNormalized, 1.0d, avgLoudnessNormalized);&#xA;    var i = hsl.ToInt32();&#xA;    return i;&#xA;}&#xA;&#xA;public static double Normalize(double value, double[] values)&#xA;{&#xA;    var min = values.Min();&#xA;    var max = values.Max();&#xA;    return (value - min) / (max - min);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously there's a lot more code needed before you get here (upload to service, parse JSON etc) but that's &lt;strong&gt;not&lt;/strong&gt; the point of this site so I'm just posting the relevant stuff for getting the above result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm using the first 2 functions of the analysis result, there is certainly more to do with but I still need to test. If I ever find something cooler than above I'll come back and update here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As always, any hints on the topic are more than welcome !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 5&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some gradient using &lt;a href=&quot;http://en.wikipedia.org/wiki/Harmonic_series_%28music%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;harmonic series&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NusYn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The color smoothing is ratio-sensitive otherwise it looks bad, will need some adjustment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 4&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rewrote the coloring to happen at source and smoothed colors using an &lt;a href=&quot;http://en.wikipedia.org/wiki/Alpha_beta_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Alpha beta filter&lt;/a&gt; with 0.08 and 0.02 values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r6lE1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little better when zoomed out&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MdWFr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next step is to get a great color palette !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Eurzo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yellows represents mediums&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6ebPM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not so great when unzoomed, yet.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MzilY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(the palette needs some serious work)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preliminary test using second 'timbre' coefficient hint from &lt;a href=&quot;https://dsp.stackexchange.com/questions/8997/coloring-a-waveform-with-spectral-centroid-or-by-other-means?noredirect=1#comment15146_8999&quot;&gt;pichenettes&lt;/a&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/lAfzU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A preliminary test using an analysis result from &lt;a href=&quot;http://echonest.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;EchoNest&lt;/a&gt; service, note that it's not aligned very well (my fault) but it's much more coherent than the above approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VCxyR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For people interested in using this great API, start here : &lt;a href=&quot;http://developer.echonest.com/docs/v4/track.html#profile&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://developer.echonest.com/docs/v4/track.html#profile&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, don't get confused by these waveforms as they do represent 3 different songs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Initial question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far this is the result I get using a 256-samples FFT and calculating each chunk's &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_centroid&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral centroid&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Raw result of the calculations&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Zgded.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some smoothing applied (form looks much better with it)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/e57Ha.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Waveform produced&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yXDMD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, this is how it should look like (taken from &lt;a href=&quot;http://serato.com/dj&quot; rel=&quot;nofollow noreferrer&quot;&gt;Serato DJ&lt;/a&gt; software)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/jYY3u.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know what technique/algorithm I could use to be able to split the audio when average frequency changes over time ? (like the above image)&lt;/p&gt;&#xA;" OwnerUserId="3290" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-05-21T19:26:56.380" Title="Coloring a waveform with spectral centroid or by other means" Tags="|fft|audio|color|" AnswerCount="1" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="8999" PostTypeId="2" ParentId="8997" CreationDate="2013-05-05T17:30:31.893" Score="4" Body="&lt;p&gt;You can try first the following (no segmentation):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Process the signal in small chunks (say 10ms to 50ms in duration) - if necessary with a 50% overlap between them.&lt;/li&gt;&#xA;&lt;li&gt;Compute the spectral centroid on each chunk.&lt;/li&gt;&#xA;&lt;li&gt;Apply a non-linear function to the spectral centroid value to get a uniform distribution of the palette color used. Logarithm is a good start. Another option is to compute first the distribution of the centroid value other the entire file, and then color according to percentiles of this distribution (&lt;a href=&quot;http://en.wikipedia.org/wiki/Cumulative_distribution_function&quot; rel=&quot;nofollow&quot;&gt;CDF&lt;/a&gt;). This adaptive approach guarantees that each color in the palette will be used in equal proportion. The drawback is that what is plotted in blue in one file won't be similar sounding to what is plotted in blue in another file if this adaptive approach is used!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is not clear from the picture if Serato does this, or indeed goes one step further and attempts to segment the signal - it might not be surprising that it does since knowing the instants at which notes are present in a music signal can help synchronizing them! The steps would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Compute a Short-Term Fourier Transform (spectrogram) of the signal - using the FFT on short overlapping segments (start with a FFT size of 1024 or 2048 with 44.1kHz audio).&lt;/li&gt;&#xA;&lt;li&gt;Compute an onset-detection function. I recommend you to look at &lt;a href=&quot;http://www-student.elec.qmul.ac.uk/people/juan/Documents/Duxbury-DAFx-2003.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; - the proposed approach is very effective and even a C++ implementation takes less than 10 lines. You can find an implementation in &lt;a href=&quot;http://yaafe.sourceforge.net/index.html&quot; rel=&quot;nofollow&quot;&gt;Yaafe&lt;/a&gt; - as &lt;code&gt;ComplexDomainOnsetDetection&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Detect peaks in the onset-detection function to get the position of note onsets.&lt;/li&gt;&#xA;&lt;li&gt;Compute the spectral centroid over all the time segments delimited by the detected onsets (don't forget to window and/or zero-pad!)&lt;/li&gt;&#xA;&lt;li&gt;And don't forget the non-linear map! Note that the gradient-effect that appear between each note on the Serato waveform might be artificially generated.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once you get this working, a &quot;low hanging fruit&quot; would be to compute a few other features on each segment (moments, a handful of MFCCs...), run k-means on these feature vectors, and decide on the color of the segment using the cluster index. See section II of &lt;a href=&quot;https://files.nyu.edu/jb2843/public/Publications_files/Ravelli-SPL-2007.pdf&quot; rel=&quot;nofollow&quot;&gt;Ravelli's paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-05-05T17:30:31.893" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="9000" PostTypeId="1" AcceptedAnswerId="9003" CreationDate="2013-05-05T18:36:11.740" Score="5" ViewCount="404" Body="&lt;p&gt;According to this &lt;a href=&quot;http://www.baudline.com/manual/measurements.html#peaks&quot;&gt;page&lt;/a&gt;, the Baudline software tool implements&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...the uHz-rotator algorithm that operates in the complex domain to&#xA;  calculate an extremely accurate estimate of the frequency.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Furthermore&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Under good conditions (strong signal and low noise) the frequency&#xA;  accuracy can exceed 8 significant digits (~.000001 Hz).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tested it with a signal generator (ToneGen). For 82.41 Hz (E2) it displays 82.40999 with averaging and 82.4 without (the rest of the digits keep spinning). The FFT size is only 2048 and the sample rate is the standard 44100Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compare, an implementation I'm working on, which employs quadratic interpolation, has a poor estimate of anywhere between 84 and 86Hz. The phase difference estimator isn't doing much better. In both cases I only get the precision to the first decimal when I increase the FFT size to 8192.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is this uHz algorithm and how do you get such precision?&lt;/p&gt;&#xA;" OwnerUserId="3266" LastActivityDate="2013-05-06T14:21:25.903" Title="What is the uHz-rotator algorithm?" Tags="|fft|pitch|peak-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9001" PostTypeId="1" CreationDate="2013-05-05T19:37:43.247" Score="3" ViewCount="137" Body="&lt;p&gt;I have a feedback loop with transfer $L(z)= \frac{H(z)C(z)}{1+H(z)C(z)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = h\quad \text{and} \quad C(z) = \frac{K}{z-\alpha}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I manually calculate the transfer function, I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$L(z) = \frac{Kh}{z-\alpha + Kh}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I let MATLAB do the calculation I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$L(z) = \frac{z-\alpha}{z-\alpha}\frac{Kh}{z-\alpha + Kh}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L(z)$ is unstable with $\alpha=2$ and $K=\frac{1}{h}$. The second transfer function (calculated with MATLAB) has two poles $(1,2)$ of which one is outside the unit circle. So the second one seems to be correct. What is wrong with the first one?&lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="1629" LastEditDate="2016-06-25T15:39:36.393" LastActivityDate="2016-06-25T15:39:36.393" Title="Why is a feedback loop not represented by the least order transfer function?" Tags="|matlab|discrete-signals|transfer-function|z-transform|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9002" PostTypeId="2" ParentId="9001" CreationDate="2013-05-05T20:57:48.940" Score="2" Body="&lt;p&gt;Not really an answer, but let's work it out with $H(z) = h$ and $C(z) = \frac{K}{z-\alpha}$.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{array}&#xA;\ L(z) &amp;amp;=&amp;amp; \frac{H(z)C(z)}{1+H(Z)C(z)}\\&#xA;&amp;amp;=&amp;amp; \frac{h \frac{K}{z-\alpha}}{ 1 + h \frac{K}{z-\alpha}}\\&#xA;&amp;amp;=&amp;amp; \frac{h K}{ z - \alpha + h K}\\&#xA;&amp;amp;=&amp;amp; \frac{h K}{ z - \alpha + h K}\ \ \frac{z - \beta}{ z - \beta}&#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added the last line to show what I mean by a pole-zero cancellation.  $\beta$ can be any value; if the pole and the zero at $\beta$ cancel out, the overall value of $\frac{z - \beta}{ z - \beta}$ is 1.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick will be to figure out why matlab inserts the extra $\frac{z - \alpha}{ z - \alpha}$ in there in the first plcae,&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-05-05T20:57:48.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9003" PostTypeId="2" ParentId="9000" CreationDate="2013-05-06T00:08:32.023" Score="8" Body="&lt;p&gt;From the (limited) description the &lt;code&gt;uHz rotator&lt;/code&gt; algorithm sounds like one of the &lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms&quot;&gt;phase-weighted averages from this site,&lt;/a&gt; but it's not an algorithm I am familiar with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Cram%C3%A9r%E2%80%93Rao_bound&quot;&gt;Cramér–Rao lower bound$^1$&lt;/a&gt; for estimating the frequency of sinusoid with amplitude $A$ in white noise with variance $\sigma^2$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathrm{var}(\hat{f}) \ge \frac{12}{(2\pi)^2\eta N(N^2-1)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the number of samples and $\eta = A^2/(2\sigma^2)$ (taken from Kay's &lt;em&gt;Fundamentals of Statistical Signal Processing, Estimation Theory&lt;/em&gt; equation 3.41).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, assuming $A =1$, $\sigma^2 = 0.1$, and assuming that &lt;code&gt;frequency accuracy can exceed 8 significant digits&lt;/code&gt; means that $\mathrm{var}(\hat{f}) &amp;lt; (10^{-8})^2$ we get:&#xA;$$&#xA;\begin{array}&#xA;\ (10^{-8})^2 &amp;amp;\ge&amp;amp; \frac{12}{(2\pi)^2 5 N(N^2-1)}\\&#xA;\frac{20}{12} \pi^2 \times 10^{-16} &amp;amp;\ge&amp;amp; \frac{1}{N(N^2-1)}\\&#xA;N(N^2-1) &amp;amp;\ge&amp;amp; 6.079271 \times 10^{14}\\&#xA;N &amp;amp;\ge&amp;amp;  84713&#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that your data length would need to be 84713 samples to achieve this accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For different values of $\sigma^2$ see the following table.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;$$&#xA;\begin{array}&#xA;\ \sigma^2 &amp;amp; \eta &amp;amp; 10\log_{10}(\eta) &amp;amp; N\\&#xA;\\&#xA;0.1&amp;amp;    5.\ \ &amp;amp;    6.9897\ \ &amp;amp;    84714.\\  &#xA;\\&#xA;    0.01&amp;amp;    50.\ \ &amp;amp;    16.9897\ \ &amp;amp;    39321.\\  &#xA;\\&#xA;    0.001&amp;amp;    500.\ \ &amp;amp;    26.9897\ \ &amp;amp;    18252.\\  &#xA;\\&#xA;    0.0001&amp;amp;    5000.\ \ &amp;amp;    36.9897\ \ &amp;amp;    8472.\\  &#xA;\end{array}&#xA;$$&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;PS: I have emailed the author of that web-site and asked for their comment. Let's see if they respond.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;$^1$ The Cramér–Rao lower bound is the lowest achievable variance of an unbiased estimator.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-05-06T13:36:06.743" LastActivityDate="2013-05-06T13:36:06.743" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9004" PostTypeId="1" CreationDate="2013-05-06T05:18:21.440" Score="0" ViewCount="1354" Body="&lt;p&gt;Can any one suggest me a Bandpass filter in java which I would like to apply on generated sine wave of a particular frequency&lt;/p&gt;&#xA;" OwnerUserId="4505" LastEditorUserId="4505" LastEditDate="2013-05-06T05:56:38.807" LastActivityDate="2021-11-27T23:06:04.530" Title="SineWave generation and BandPass filter : Audio" Tags="|audio|bandpass|java|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9006" PostTypeId="1" AcceptedAnswerId="9209" CreationDate="2013-05-06T10:15:27.453" Score="5" ViewCount="2033" Body="&lt;p&gt;For OFDM synchronisation, we are using two training symbols according to the &lt;a href=&quot;http://home.mit.bme.hu/%7Ekollar/papers/Schmidl2.pdf&quot; rel=&quot;noreferrer&quot;&gt;Schmidl and Cox method of frequency synchronization and timing synchronization&lt;/a&gt;. The paper says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The first OFDM training symbol has only even numbered subcarriers applying a PN sequence.The result is two identical half symbols in time domain each consisting of Nc/2 samples each.&lt;/p&gt;&#xA;&lt;p&gt;The second training symbol consists of even numbered subcarriers that are differentially modulated with even numbered subcarriers of first training symbol using a PN sequence. The odd numbered subcarriers of second training symbol can be used for data, pilot or reference symbols.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I have two questions on this.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In OFDM, every subcarrier corresponds to one symbol which is a complex value. So what does it mean by saying  even numbered subcarriers are modulated in a symbol using a PN sequence? How does that ensure that it results in two identical halves of a time domain symbol.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;what is differential modulation using a PN sequence. How is it achieved?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-05-20T16:26:11.290" Title="OFDM training symbol format" Tags="|modulation|digital-communications|dsp-core|ofdm|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9008" PostTypeId="1" AcceptedAnswerId="9009" CreationDate="2013-05-06T11:53:50.797" Score="3" ViewCount="1379" Body="&lt;p&gt;Is it possible to break out the i and q of a complex WiFi signal?  If I have a laptop with a standard WiFi card in it, could I break out the i and q in analog, or upon sampling in an FPGA via digital means?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It must be possible since it is being done on a WiFi receiver, right?&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2013-05-06T12:41:03.010" Title="Possible to break out complex WiFi signal?" Tags="|signal-analysis|demodulation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9009" PostTypeId="2" ParentId="9008" CreationDate="2013-05-06T12:39:50.347" Score="1" Body="&lt;p&gt;The in-phase and quadrature components are easy to break out. You just need to demodulate using in-phase and quadrature local oscillators. See the diagram below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fnZBU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The received signal $r(t,k)$ is mixed with a $\cos$ and a $-\sin$ wave of the appropriate frequency, and then low-pass filtered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/IEEE_802.11#Protocol&quot; rel=&quot;nofollow noreferrer&quot;&gt;The actual IEEE 802.11 modulation schemes&lt;/a&gt; used are a little more complicated than indicated, but not overly so.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-05-06T12:39:50.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9010" PostTypeId="2" ParentId="9008" CreationDate="2013-05-06T12:41:03.010" Score="1" Body="&lt;p&gt;In theory, it can be possible to tap off some point in the analog chain to do what you want. Often, receivers have a &lt;a href=&quot;http://en.wikipedia.org/wiki/Superheterodyne_receiver&quot; rel=&quot;nofollow&quot;&gt;superheterodyne&lt;/a&gt; structure, where the RF signal of interest is downconverted to some fixed &lt;a href=&quot;http://en.wikipedia.org/wiki/Intermediate_frequency&quot; rel=&quot;nofollow&quot;&gt;intermediate frequency&lt;/a&gt;, after which further signal processing is performed to demodulate the signal and obtain the information encoded in it. That would probably be the best place to capture the view of the signal that you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, however, &lt;strong&gt;this is not likely to be possible&lt;/strong&gt;. Modern WiFi receivers are highly integrated. It is likely that the receiver in your laptop consists of an antenna and a single-chip integrated circuit that performs all of the responsibilities of the receiver, analog and digital. Thus, there wouldn't be any spot to tap in order to get the view of the receiver that you want; everything is within a single integrated circuit package.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-06T12:41:03.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9011" PostTypeId="1" AcceptedAnswerId="9016" CreationDate="2013-05-06T13:17:49.167" Score="3" ViewCount="394" Body="&lt;p&gt;I am creating a system (modulator and demodulator) for broadcasting binary data through an analog signal. I'm using BPSK with great success – at least, I'm generating great graphs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yURxK.jpg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Green is input signal, red is carrier phase, pink is digital zeroes and ones.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is – now that I have that pink stream of binary data, how to delineate bytes? I have been reading about clock recovery, 8b/10b, Manchester, NRZI... And I'm a little confused about what those offer me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine I could just come up with a system like Manchester, where each 0 is just 01 and each 1 is 10 – and then use a pattern like 0000 to mean &quot;start of next byte&quot; – but this doesn't seem right. Under that system, how would you interpret 10000010? It could mean the last byte ended with a 1 and the next byte starts with a 1 – or it could mean the exact opposite – the last byte ends with a 0 and the next byte starts with a 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there must be some basic DSP concepts that could help me here, please point me to some resources!&lt;/p&gt;&#xA;" OwnerUserId="3609" LastActivityDate="2013-05-06T15:43:26.087" Title="What are the options for turning a bit stream into a byte stream?" Tags="|modulation|digital-communications|demodulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9012" PostTypeId="1" AcceptedAnswerId="9017" CreationDate="2013-05-06T13:59:13.417" Score="3" ViewCount="527" Body="&lt;p&gt;The following binary maps are the results of a measurement I've carried out. I'm looking for a quantifiable measure of the red areas. I could trace rectangles manually (the green rectangle on the upper-right image), but it's hard to motivate their shapes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a natural (and well-used) method to detect the shapes of these rectangles?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qW3cT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qW3cT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial idea was to sum all columns and all rows, and then find the edges through some thresholding. But I'd like some more ideas, because my plan feels quite ad-hoc.&lt;/p&gt;&#xA;" OwnerUserId="471" LastActivityDate="2013-07-22T19:15:14.320" Title="How to approximate these fuzzy rectangle shapes in binary maps?" Tags="|image-segmentation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9013" PostTypeId="2" ParentId="9000" CreationDate="2013-05-06T14:21:25.903" Score="7" Body="&lt;p&gt;I'll take an orthogonal tack to answering this question from what Peter K has (validly) already proposed. I assert that the 8-significant-figure claim is little more than marketing-speak; while the software may be able to provide you an estimate with that many digits on it, that doesn't mean that they carry any real information!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that the software in question is intended for use with input signals taken from a sound card. Since any frequency measurements that are taken in the digital domain are relative to the sample rate of the input, the rate at which samples are taken is critical if accurate digital frequency measurements are required. The sample rate of the card is going to be driven by a reference oscillator of some kind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical sound card is likely to have a &lt;a href=&quot;http://en.wikipedia.org/wiki/Crystal_oscillator&quot;&gt;crystal-controlled oscillator&lt;/a&gt; that controls its sample frequency. Crystals are very short-term stable, but over the long term (months and years), aging causes their frequency to drift. Further, they can be relatively sensitive to temperature variations, with small amounts of frequency deviation as you sweep the temperature across its specified operating range (which often is something like -10 to +30 degrees Celsius or so). The temperature problem can be addressed using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Crystal_oscillator#Stability_and_aging&quot;&gt;temperature-controlled crystal oscillator (TCXO, cheap and small) or oven-controlled crystal oscillator (OCXO, expensive, power-hungry and large)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quality sound card might have a TCXO to provide maximum initial accuracy from the factory at a specified operating temperature. However, typical values for a highly precise crystal cut from the factory are in the 0.1-0.2 parts per million (ppm) range. Therefore, if the intended crystal frequency is 1 MHz, then the crystal's true oscillating frequency can vary by ~0.2 Hz or so. For most purposes, this is actually quite sufficient. However, if one wants to measure a particular frequency with 8 significant figures, this falls short: the reference oscillator used by your sampler has much more error than the software purports to provide, an example of &lt;a href=&quot;http://en.wikipedia.org/wiki/False_precision&quot;&gt;false precision&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you truly wanted to build a system that was capable of measuring frequency that accurately, you would need a very accurate frequency reference to compare it against. A couple ways you could do that would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Use more expensive hardware. &lt;a href=&quot;http://en.wikipedia.org/wiki/Rubidium_standard&quot;&gt;Rubidium frequency standards&lt;/a&gt; could be used for this sort of application. They typically provide frequency accuracies in the $10^{-4}$-ppm range or so over long periods of time, so a Rubidium standard could be used as the reference oscillator for a sampler.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Borrow expensive hardware to calibrate your cheap hardware. The frequency error in your sound card is likely to be pretty stable for a short period of time, so you could use a calibration procedure to estimate what the sample rate error in your card is. However, there's no free lunch: you need to get a very accurate signal source to perform the calibration, which could be just as difficult as the first option. Also, the calibration would only be valid in similar environmental conditions for a limited period of time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;While I've provided a simplified treatment of the problem above, the analysis of oscillator accuracy is actually pretty complicated. There are more complicated metrics that are used to characterize oscillator performance in various contexts that might be more appropriate.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-06T14:21:25.903" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="9015" PostTypeId="2" ParentId="9004" CreationDate="2013-05-06T15:39:24.740" Score="3" Body="&lt;p&gt;As someone suggested in the comments, filtering a sine wave is just a change in amplitude and possibly phase, although you will have some edge effects at the beginning. I assume this is not simply an excersize in changing amplitudes and that you really need a real filter.&lt;/p&gt;&#xA;&lt;p&gt;I don't know of an open source library in Java, although &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0130876763&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book&lt;/a&gt; contains some simple source for a few filters (not sure it has a bandpass, but lowpass + highpass = bandpass).&lt;/p&gt;&#xA;&lt;p&gt;I don't recommend the suggestion in the comments of using an FFT, although if you can perform a transform on your entire input that is an option, and one that many people find very intuitive. Keep in mind it's an O(n log n) operation, so it may not be feasible for large or even moderately-sized audio files. I explain &lt;a href=&quot;http://blog.bjornroche.com/2012/08/why-eq-is-done-in-time-domain.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; more on why EQ is usually not done in the frequency domain. Some people design their filters in the frequency domain and use the IFFT to create a filter, but this results in a design that is inferior in many ways. There are some rules of thumb that make this better, but there are better techniques, so this is not a well developed art.&lt;/p&gt;&#xA;&lt;p&gt;You haven't specified your filter in any meaningful way, but assuming a basic biquad will suffice, checkout &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;RBJ's audio EQ cookbook&lt;/a&gt;. If you need help implementing those filters, I've written &lt;a href=&quot;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;a tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally, someone else on StackOverflow just &lt;a href=&quot;https://stackoverflow.com/questions/16389205/simple-bandpass-filter-in-java&quot;&gt;asked about a bandpass filter in Java&lt;/a&gt;, and offered some not yet working code. Their design is based on a blackman windowed sinc filter. This is a high-quality FIR filter.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastEditorUserId="4346" LastEditDate="2021-11-27T23:06:04.530" LastActivityDate="2021-11-27T23:06:04.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9016" PostTypeId="2" ParentId="9011" CreationDate="2013-05-06T15:43:26.087" Score="2" Body="&lt;p&gt;I would use a frame alignment word to synchronize your data.  The basic idea is to insert your FAW at the beginning of every $N$ bytes.  After you demodulate the data you look for the FAW to synchronize the data.  To avoid false positives you should try to have a longish FAW (16 bits should be plenty) and look for repeated FAWs.  To avoid inefficient overhead you should try to make $N$ large compared to the size of the FAW.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-05-06T15:43:26.087" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9017" PostTypeId="2" ParentId="9012" CreationDate="2013-05-06T16:14:51.170" Score="2" Body="&lt;p&gt;You might get better answers to this question over at &lt;a href=&quot;http://math.stackexchange.com&quot;&gt;Math Stack Exchange&lt;/a&gt;, but let me give it a try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, you should try to decide what the property that you want your rectangle to maximize actually is.  I'll take a wild guess and say that it might be &lt;strong&gt;the number of red pixels minus the number of blue pixels inside the rectangle&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my guess is right (or at least a good approximation), then the first thing you probably want to do is &lt;strong&gt;integrate your data&lt;/strong&gt;.  That is, let $f(x,y)$ be $1$ if the pixel at $(x,y)$ is red, and $-1$ if it's blue.  Then, for each point $(x,y)$, you want to calculate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ F(x,y) = \sum_{i=0}^x \sum_{j=0}^y f(i,j) \;. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is easy to calculate in two passes over the data, e.g. in pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// first pass: integrate over x for each y&#xA;for y from 0 to y_max:&#xA;    sum = 0;&#xA;    for x from 0 to x_max:&#xA;        sum = sum + data[x,y];&#xA;        out[x,y] = sum;&#xA;&#xA;// second pass: integrate over y for each x&#xA;for x from 0 to x_max:&#xA;    sum = 0;&#xA;    for y from 0 to y_max:&#xA;        sum = sum + out[x,y];&#xA;        out[x,y] = sum;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or, indeed, even in just one pass:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// do first row:&#xA;sum = 0;&#xA;for x from 0 to x_max:&#xA;    sum = sum + data[x,0];&#xA;    out[x,0] = sum;&#xA;&#xA;// do other rows:&#xA;for y from 1 to y_max:&#xA;    sum = 0;&#xA;    for x from 0 to x_max:&#xA;        sum = sum + data[x,y];&#xA;        out[x,y] = sum + out[x,y-1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(The careful reader will also note that both of these code examples can be made to work in-place just by replacing all instances of &lt;code&gt;out&lt;/code&gt; with &lt;code&gt;data&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if one corner of your rectangle were fixed at $(0,0)$, all you'd need to do to optimally place the other corner would be to find the maximum of $F$.  (This can be done easily and efficiently just by looping over all points and keeping track of the maximum value seen so far and its location.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if both corners can be at arbitrary locations, then things get a bit more complicated.  Essentially, what you want to maximize is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{aligned}&#xA;G(x_1,y_1; x_2,y_2)&#xA;&amp;amp;= \sum_{i=x_1}^{x_2} \sum_{j=y_1}^{y_2} f(i,j) \\&#xA;&amp;amp;= F(x_1,y_1) - F(x_1,y_2) - F(x_2,y_1) + F(x_2,y_2)&#xA;\end{aligned}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the latter formula can be derived using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle&quot; rel=&quot;nofollow&quot;&gt;inclusion–exclusion principle&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, while the analogous problem in one dimension is relatively easy to solve, in two dimensions it gets trickier.  If you don't have too many points, you &lt;em&gt;could&lt;/em&gt; just loop over every possible pair of points and select the one that maximizes $G$, but the time that takes scales with the square of the number of points (and thus with the fourth power of the data resolution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you may be better off exploiting the relative smoothness of the integrated data by first sampling $G$ at a lower resolution to find an approximate maximum, and then refining it, either just by sampling the vicinity of the approximate maximum more finely, or perhaps using &lt;a href=&quot;http://en.wikipedia.org/wiki/Hill_climbing&quot; rel=&quot;nofollow&quot;&gt;simple hill cimbing&lt;/a&gt;.  Or you could try starting a simple hill climbing process from &lt;em&gt;each&lt;/em&gt; low-resolution sample point to find the nearby local maximum, and then take the highest of these maxima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You could even consider more advanced optimization techniques, such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Simulated_annealing&quot; rel=&quot;nofollow&quot;&gt;simulated annealing&lt;/a&gt;, but these may well be overkill for your purposes, and might even be less efficient than the simpler methods described above.)&lt;/p&gt;&#xA;" OwnerUserId="724" LastEditorUserId="724" LastEditDate="2013-07-22T19:15:14.320" LastActivityDate="2013-07-22T19:15:14.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9018" PostTypeId="1" CreationDate="2013-04-13T13:41:22.047" Score="4" ViewCount="695" Body="&lt;p&gt;Using a signal of three joined sinus of equal length at different frequencies (40 Hz, 50 Hz, 80 Hz) I calculate a scalogram of it (scale vertical, time horizontal, The steps of variing the scale parameter are equidistant):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot of the Scalogram: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WYo3T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast to my expection that lower frequencies (i.e. higher values for the scale) should be better resolved according to wavelet resolution theory, the first third (corresponding to 40 Hz) is smeared vertically much more than the second third (50 Hz) which in turn is again more smeared than the last third part (80 Hz) of the time duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why?&lt;/p&gt;&#xA;" OwnerDisplayName="user1283244" LastEditorUserId="29" LastEditDate="2013-05-07T00:05:32.333" LastActivityDate="2013-05-07T07:45:41.540" Title="Scalogram (Wavelet)" Tags="|wavelet|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9019" PostTypeId="2" ParentId="9018" CreationDate="2013-04-15T08:19:47.990" Score="0" Body="&lt;p&gt;I think the point actually is that the resolition at higher scales become better. Hence the 40 Hz sinus is &quot;visible&quot; to the wavelets over a wider range of scales. The 80 Hz sinus in contrast is only detected at less scales since each scale covers a larger bandwidth.&lt;/p&gt;&#xA;" OwnerDisplayName="user1283244" LastActivityDate="2013-04-15T08:19:47.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9020" PostTypeId="1" AcceptedAnswerId="73149" CreationDate="2013-05-07T03:21:44.480" Score="10" ViewCount="1937" Body="&lt;p&gt;We know that DFT (discrete Fourier transform) breaks down a signal into multiple frequencies of sine waves. Does there exist a transform that does the same thing, but for triangle waves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my purposes, im only talking about 1-d signals (like voltages, etc). I'm studying historical stock market data, and I just want to look at reversals in certain stocks. In other words, I want to perform a &quot;low-pass&quot; on the stock price using this transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;If yes, how can I do it?&lt;/p&gt;&#xA;" OwnerUserId="4511" LastEditorUserId="35" LastEditDate="2013-05-07T17:08:50.817" LastActivityDate="2024-01-06T00:42:14.247" Title="DFT-like transform using triangle waves instead of sin waves" Tags="|fft|dft|transform|" AnswerCount="6" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9021" PostTypeId="1" CreationDate="2013-05-07T04:03:01.280" Score="2" ViewCount="5143" Body="&lt;p&gt;I'm writing a C++ application to extract four modulated carrier signals at four separate frequencies, from a single input signal. I've designed four FIR filters at &lt;a href=&quot;http://t-filter.appspot.com&quot; rel=&quot;nofollow&quot;&gt;t-filter.appspot.com&lt;/a&gt; but they run very slowly, even when I reduce # of taps to 80.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better option? People seem to point to biquad filters – are these different from FIR filters, and do they run more quickly in software?&lt;/p&gt;&#xA;" OwnerUserId="3609" LastActivityDate="2019-11-01T14:26:08.790" Title="What is the most efficient type of software bandpass filter?" Tags="|filters|filter-design|software-implementation|bandpass|c|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9022" PostTypeId="2" ParentId="8267" CreationDate="2013-05-07T07:00:08.747" Score="-1" Body="&lt;p&gt;The following page might help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://subbeta.com/road_detection.php&quot; rel=&quot;nofollow&quot;&gt;Road detetction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gives results with different methods, and also explains them more or less.&lt;/p&gt;&#xA;" OwnerUserId="4512" LastActivityDate="2013-05-07T07:00:08.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9023" PostTypeId="2" ParentId="9018" CreationDate="2013-05-07T07:45:41.540" Score="2" Body="&lt;p&gt;The scalogram is probably constructed using frequencies that vary logarithmically. e.g. 1, 2, 4, 8 etc. If you plot the y-axis of your graph on a log-scale then I think they will have the same width. The log-scale makes sense when we consider that our ears perceive sound pitch in this manner. For example, each octave in a musical scale is a doubling of frequency.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-07T07:45:41.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9024" PostTypeId="2" ParentId="8267" CreationDate="2013-05-07T08:19:16.467" Score="5" Body="&lt;p&gt;I was doing something similar for my Bachelor thesis. In combination with a friends thesis, we accomplished to to &lt;strong&gt;detect, follow,&lt;/strong&gt; and recognize &lt;strong&gt;the type&lt;/strong&gt; of the &lt;em&gt;centerline&lt;/em&gt; in the image. I understand that you need lanes, and not centerlines, but I think a big majority of the approach is applicable, especially since you're planning to play with lines as well.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;First step&lt;/em&gt; was to transform the perspective of the image. Our images (they looked very similar to yours), were taken from a camera mounted on top of the car. By applying the &lt;strong&gt;inverse perspective transform&lt;/strong&gt;, we &lt;em&gt;obtained the image &lt;strong&gt;from &amp;quot;bird-view&amp;quot;&lt;/strong&gt;&lt;/em&gt; perspective. -- and there, &lt;strong&gt;the lines are almost parallel&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you want to detect lanes, that's what would fix your &amp;quot;it's a parallelogram, not a rectangle&amp;quot; problem.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Next step&lt;/em&gt; was image &lt;strong&gt;binarization (thresholding)&lt;/strong&gt;, which was not my part, but you have an excellent &lt;a href=&quot;https://dsp.stackexchange.com/q/2411/1273&quot;&gt;post on thresholding here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Finally&lt;/em&gt;, we tried to &lt;strong&gt;fit a second order (quadratic) curve&lt;/strong&gt; on the binarized image, using RANSAC (as @DCS mentioned) to get rid of the outliers.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Additionally&lt;/em&gt;, once the line would be detected, we would also &lt;strong&gt;limit the search space&lt;/strong&gt; in the next image to the area close to the centerline detected in previous frame to achieve &lt;em&gt;additional speed-up&lt;/em&gt;. (Don't forget: you have a video, where frames are consequential, not just a bunch of disconnected images)&lt;/p&gt;&#xA;&lt;p&gt;It worked pretty well, real time, got lost at strong turns sometimes, but not too often.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(Additionally, the idea we had for fixing the problems with strong turns, but which we have never implemented, is to try and fit a &lt;strong&gt;linear function&lt;/strong&gt; to the centerline as well, and if it is not too bad compared to the fitted parabola, we would use that to estimate the next frame search space)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;All in all, my part was only the perspective transform, so can't tell you more then just the general description of the rest.&lt;/p&gt;&#xA;&lt;p&gt;We wrote a paper from those Bachelor theses, in which you can find all the details of what I just outlined in the answer:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.zemris.fer.hr/%7Essegvic/pubs/palasek11mipro.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Petar Palašek, Petra Bosilj, Siniša Šegvić: &lt;strong&gt;Detecting and recognizing centerlines as parabolic sections of the steerable ﬁlter response&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-05-07T08:19:16.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9025" PostTypeId="2" ParentId="8673" CreationDate="2013-05-07T08:43:42.143" Score="11" Body="&lt;p&gt;Answers about using cross-correlation are correct. But if your input and output signals are sinusoid you can use more simple and faster method.&lt;br&gt;&#xA;input - $y1=a*\sin(\omega*t)$&lt;br&gt;&#xA;output - $y2=b*\sin(\omega*t+\phi)$ &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;multiply input and output:&lt;br&gt;&#xA;$y1*y2=a*b*\sin(\omega*t)*\sin(\omega*t+\phi)=a*b*1/2*(\cos(\phi) - \cos(2*\omega*t+\phi))$  &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;eliminate high-frequency part. You can use some low-pass filter or average with time window which equals the period of signal (as you know the frequency).&lt;br&gt;&#xA;$&amp;lt;y1*y2&amp;gt;=a*b*1/2*\cos(\phi)$  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;calculate amplitudes of signals and calculate $\cos(\phi) = &amp;lt;y1*y2&amp;gt;*2/(a*b)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;pro - you can calculate phase shift continuously and in &quot;real time&quot; (with time lag which can be ~$2*\pi/\omega$)&lt;br&gt;&#xA;cons - if your signal is not sinusoid, you must use common way - cross-correlation&lt;br&gt;&#xA;P.S.&lt;br&gt;&#xA;Real algorithm can include a lot of important details (robust calculation of amplitudes, robust calculation when $\phi$ ~ 0 and ...)&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2014-03-18T04:05:14.803" LastActivityDate="2014-03-18T04:05:14.803" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9026" PostTypeId="1" AcceptedAnswerId="9043" CreationDate="2013-05-07T09:46:07.700" Score="2" ViewCount="609" Body="&lt;p&gt;In a baseband complex signal, I need to generate a BSPK modulated signal at a given frequency.  If I generate a CW at this frequency, all is good.  However, when I then BPSK modulate the CW, I get a signal at both the positive and negative frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of implementing BPSK modulation without this negative frequency image, or must I simply implement a filter to remove the image?&lt;/p&gt;&#xA;" OwnerUserId="3619" LastActivityDate="2013-05-08T11:41:26.477" Title="Prevent negative image with BPSK modulation in a complex signal" Tags="|bpsk|analytic-signal|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9027" PostTypeId="2" ParentId="9026" CreationDate="2013-05-07T11:47:44.593" Score="3" Body="&lt;p&gt;An actual BPSK signal can be expressed as&#xA;$$\begin{align}&#xA;s(t) &amp;amp;= \operatorname{Re}\left[\sum_{n=-\infty}^\infty&#xA;(-1)^{b_n}p(t-nT)e^{j(2\pi f_c t + \theta)}\right]\\&#xA;&amp;amp;= \left[\sum_{n=-\infty}^\infty&#xA;(-1)^{b_n}p(t-nT)\right]\cos(2\pi f_c t + \theta)&#xA;\end{align}$$&#xA;where &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$b_n \in {0,1}$ is the $n$-th data bit (note that $(-1)^{b_n} = \pm 1$),&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$p(t)$ is the baseband pulse shape. Typically $p(t)$ is nonzero only for&#xA;$t \in \left[-\frac{T}{2},\frac{T}{2}\right)$, e.g. &#xA;$\operatorname{rect}\left(\frac{t}{T}\right)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$f_c$ is the carrier frequency which is sometimes chosen to be a harmonic of&#xA;the bit rate $T^{-1}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\theta$ is the carrier phase which might be arbitrary (depending&#xA;on initial conditions in the local oscillator when it is turned on) or carefully controlled to have &#xA;value $0$ or $\pm \frac{\pi}{2}$ etc. by MATLABi people.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Notice that the term in square brackets in the second displayed equation&#xA;above is a series of &lt;em&gt;nonoverlapping&lt;/em&gt; pulses $\pm p(t-nT)$ and that&#xA;the value of $b_n$ affects the BPSK signal phase only during &#xA;$\left[nT-\frac{T}{2},nT+\frac{T}{2}\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that as a preliminary setting of the stage, note that the negative&#xA;frequency image comes about from taking the real part in the first&#xA;displayed equation above.  We have&#xA;$$\operatorname{Re}\left[e^{j(2\pi f_c t + \theta)}\right]&#xA;= \frac{e^{j(2\pi f_c t + \theta)} + e^{-j(2\pi f_c t + \theta)}}{2}&#xA;= \frac{e^{j(2\pi f_c t + \theta)} + e^{j(2\pi (-f_c) t - \theta)}}{2}.$$&#xA;Furthermore,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;no filtering can remove the negative frequency image.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You might say &quot;Well, let's not take the real part at all&#xA;since that's the source of the trouble!&quot; and say&#xA;that&#xA;$$\sum_{n=-\infty}^\infty&#xA;(-1)^{b_n}p(t-nT)e^{j(2\pi f_c t + \theta)}$$ is a BPSK signal&#xA;containing positive frequencies only. Unfortunately, that is&#xA;a &lt;em&gt;complex-valued&lt;/em&gt; signal that cannot be transmitted on a single&#xA;wire or radiated from a single antenna.  So you need to live with&#xA;the negative frequency image: it is there to make your complex&#xA;signal more real.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-05-07T11:47:44.593" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9028" PostTypeId="2" ParentId="9020" CreationDate="2013-05-07T12:59:19.387" Score="5" Body="&lt;p&gt;You can do a transform that uses triangle waves instead of sine waves, but it is not a good choice because they are not orthogonal.  Orthogonality is an important property of transform vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://fourier.eng.hmc.edu/e101/lectures/fourier_analysis/node12.html&quot; rel=&quot;noreferrer&quot;&gt;Properties of Orthogonal Transforms&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mathworld.wolfram.com/OrthogonalTransformation.html&quot; rel=&quot;noreferrer&quot;&gt;Orthogonal Transformation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-05-07T12:59:19.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9030" PostTypeId="2" ParentId="9020" CreationDate="2013-05-07T15:33:44.273" Score="5" Body="&lt;p&gt;First order B-splines are triangles, and there exist algorithms to represent an arbitrary signal as a sum of B-splines.  As mentioned, these splines do not form an orthobasis, but this is not necessarily a terrible thing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good place to start is the the paper by Unser on efficient B-spline approximation. &lt;a href=&quot;http://bigwww.epfl.ch/publications/unser9301.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://bigwww.epfl.ch/publications/unser9301.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4202" LastActivityDate="2013-05-07T15:33:44.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9031" PostTypeId="2" ParentId="9020" CreationDate="2013-05-07T17:30:10.383" Score="9" Body="&lt;p&gt;The closest orthogonal transform I know of that might meet your needs is the &lt;a href=&quot;https://ieeexplore.ieee.org/document/1092335&quot; rel=&quot;nofollow noreferrer&quot;&gt;Slant Transform&lt;/a&gt;. It's based on sawtooth(ish) waves, but some of the basis functions do resemble triangle waves:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e6Ko6.jpg&quot; alt=&quot;Slant Basis Functions&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;(source: &lt;a href=&quot;https://books.google.com/books?id=wJF_nJQz0MsC&amp;amp;pg=PA220#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Applied Fourier transform&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;It was developed for image coding/compression, but it seems like a reasonable first approach for the analysis of long-term linear trends/reversals in financial data. It doesn't seem like many of the &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00207167608803122#preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;key papers&lt;/a&gt; describing the transform are available [for free] online, but the following paper probably has sufficient detail to implement something:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A Truncation Method for Computing Slant Transforms with Applications&#xA;to Image Processing. M. M. Anguh, R. R. Martin. IEEE Trans.&#xA;Communications 43 (6), 2103-2110, 1995. (&lt;a href=&quot;https://web.archive.org/web/20210506225151/http://ralph.cs.cf.ac.uk/publications.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;author link&lt;/a&gt;) (&lt;a href=&quot;https://web.archive.org/web/20210506201530/http://ralph.cs.cf.ac.uk/papers/Geometry/TruncationSlant.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;pdf link&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Specifically, see Section III which gives the recursion relations used to construct the transform matrix.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="26573" LastEditDate="2022-06-09T13:32:33.403" LastActivityDate="2022-06-09T13:32:33.403" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9033" PostTypeId="1" AcceptedAnswerId="29363" CreationDate="2013-05-07T17:54:31.393" Score="4" ViewCount="326" Body="&lt;p&gt;I was wondering if anyone had run into the problem of trying to estimate errors in their signal processing on spectroscopic data. I know that many people use spectroscopic techniques to estimate concentrations of different materials, but I would like to know how accurate these measurements can be  (i.e. I would like to get an output something like &quot;species A is 20% +-1% of the sample given&quot;).  Further, I would like to know how to deal with very extreme cases, where several different types of materials are present, and may have observables which fall directly on top of each other.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example may be the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p3omz.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see there are two species being fit to the data. If the areas are then transformed by calculation into percentages, (i.e. the sample taken is 48% B, 52% A) how can we be sure of this and how accurate is the fit?   I know this will be dependent on the accuracy of the estimate of the positions of these peaks that are (perhaps) given by the user, so I am interested in a method that takes a known error in the parameters (say +-15 on the x axis for error in the peak center position, +-10 error in the width of the peak, etc.). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that the errors will become large when the observables overlap (i.e. the peak centers for two fitting functions are the same).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, it is possible that these spectra have a large background, which may also have error, affecting all of the other species and their errors.  I am not certain if this background would be treated differently than all of the other species, or if it could be treated within the same algorithm as all of the other species.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate my point further, here is an image of a spectroscopic measurement of several different materials:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JgeY7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the top in red is the raw data given by optical absorption (the measured data), while the black is a calculated background, and the blue is a calculated sum of all of the species including the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the bottom, the calculated background is subtracted (blue and red lines now DO NOT include the calculated background), while the several different colored lines below are each individual species being summed up to create the blue line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the calculated measurements I am interested in estimating the error in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the error is enormously large in this example for most of the calculated measurements. Each species may or may not have several 'peaks' associated with it, which can be illustrated by the bolded yellow calculated line.  In addition, you can see that several of the calculated peak centers fall around the same place, so this will likely reduce the certainty that the measurements are correct even if the calculated line falls directly upon the raw data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have calculated the mean squared displacement as a quick estimate of how good the fit is, but I know that this doesn't do anything to address any larger concerns of the actual calculated measurement uncertainty. The most I have really done in statistics is standard deviation and calculations dealing with several measurements, but this is quite different, since it deals with how sure you can be with only one measurement, not seeing differences in multiple measurements. Is there a way of using confidence intervals and confidence levels on non independent and identically distributed random variables?  (Again, I am very new to statistics and have never taken a course on it, so I apologize if this is elementary or trivial)&lt;/p&gt;&#xA;" OwnerUserId="4385" LastEditorUserId="80" LastEditDate="2013-05-07T19:50:01.007" LastActivityDate="2016-03-10T20:04:04.520" Title="Getting error in fit" Tags="|sampling|cross-correlation|statistics|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9034" PostTypeId="2" ParentId="9021" CreationDate="2013-05-07T19:19:43.843" Score="4" Body="&lt;p&gt;Frequency domain filtering (FFT), as suggested by some comments, is definitely wrong -- it's even slower, or same speed at best! A recursive filter (IIR) is the fastes possible solution. If you choose a typical second order filter (called biquad in engineering slang) of Butterworth type and do your math right (factoring out coefficients) you only have 3 multiplications and five addition.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit: link to classics page: &lt;a href=&quot;https://www.musicdsp.org/en/latest/_downloads/3e1dc886e7849251d6747b194d482272/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;filter cookbook&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="11256" LastEditDate="2019-11-01T14:26:08.790" LastActivityDate="2019-11-01T14:26:08.790" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9035" PostTypeId="1" AcceptedAnswerId="9055" CreationDate="2013-05-07T19:35:14.133" Score="0" ViewCount="314" Body="&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first version of my question has not worked as I expected, so that I will try to be a little bit more specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final goal I am trying to achieve is the generation of a ten minutes time series: to achieve this I have to perform an &lt;code&gt;FFT&lt;/code&gt; operation, and it's the point I have been stumbling upon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally the aimed time series will be assigned as the sum of two terms: a steady component $U(t)$ and a fluctuating component $u^{'}(t)$. That is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u(t) = U(t) + u^{'}(t);$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So generally, my code follows this procedure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) Given data&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$time = 600 [s];$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Nfft = 4096;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L = 340.2 [m];$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$U = 10 [m/s]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$df = 1/600 = 0.00167 Hz;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{n} = Nfft/(2*time) = 3.4133 Hz;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that my frequency array should be laid out as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f = (-f_{n}+df):df:f_{n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, instead of using the whole $f$ array, I am only making use of the positive half:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f_{+} = df:f_{n} = 0.00167:3.4133 Hz; $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) Spectrum Definition&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I define a certain spectrum shape, applying the following relationship&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S_{u} = \frac{6L/U}{(1 + 6f_{+}L/U)^{5/3}}; $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3) Random phase generation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I, then, have to generate a set of &lt;code&gt;complex&lt;/code&gt; samples with a determined distribution: in my case, the random phase will approach a standard Gaussian distribution $(\mu = 0, \sigma = 1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;code&gt;MATLAB&lt;/code&gt; I call&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nn = complex(normrnd(0,1,Nfft/2),normrnd(0,1,Nfft/2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4) Apply random phase&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To apply the random phase, I just do this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_{u} = S_{u}*nn; $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point start my pains!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I only generated $Nfft/2 = 2048$ complex samples accounting for the $f_{+}$ content. Therefore, the content accounting for the negative half of $f$ is still missing. To overcome this issue, I was thinking to merge the $real$ and $imaginary$ part of $H_{u}$, in order to get a signal $H_{uu}$ with $Nfft = 4096$ samples and with all real values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, by using this merging process, the $0-th$ frequency order would not be represented, since the $complex$ part of $H_{u}$ is defined for $f_{+}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, how to account for the $0-th$ order by keeping a procedure as the one I have been proposing so far?&lt;/p&gt;&#xA;" OwnerUserId="3666" LastEditorUserId="3666" LastEditDate="2013-05-08T07:55:29.957" LastActivityDate="2013-05-08T20:40:16.230" Title="Frequency array feed real values FFT" Tags="|fft|matlab|frequency|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9036" PostTypeId="1" AcceptedAnswerId="9037" CreationDate="2013-05-07T21:28:00.890" Score="2" ViewCount="2854" Body="&lt;p&gt;This may be a very straightforward question but I've been trying to understand this for a long time and can't wrap my head around it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would one go about discretizing the following continuous time signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal_continuous = 1/6 * sin(880*pi*t) + 1/15*sin(1760*pi*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as I understand, if I wanted to sample the above signal with a sampling rate of 8Khz over two seconds. I would do something like this (in Matlab speak):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = [0:1/8000:2-1/8000];&#xA;signal_discrete = signal_continuous./t;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the whole picture or have I completely missed the point here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My rationale behind doing the above is that since the continuous time signal is, well, continuous and if I want to sample it at 8000 cycles per second over a two second period. I would just divide the signal by that (t in this case). However, what happens to the rest of the signal? Or rather, does this not distort the whole signal (if the original was longer than 2 seconds, for example)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was complicating things for no reason. In Matlab I would just need to do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = [0:1/8000:2-1/8000];&#xA;discrete_signal = 1/6 * sin(880*pi*t) + 1/15*sin(1760*pi*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would create a two second discrete-time signal out of the original continuous signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The theory provided in the answer, I think, is beneficial so I'm leaving the question up.&lt;/p&gt;&#xA;" OwnerUserId="4471" LastEditorUserId="4471" LastEditDate="2013-05-07T23:05:35.550" LastActivityDate="2013-05-07T23:15:26.127" Title="Discretizing a continuous time signal" Tags="|discrete-signals|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9037" PostTypeId="2" ParentId="9036" CreationDate="2013-05-07T21:40:42.230" Score="5" Body="&lt;p&gt;A continuous-time signal $x(t)$ is sampled to create an ideal discrete time signal $x[n]$ by just taking the instantaneous value of the continuous-time signal at the sampling instants. If you sample the signal at an interval $T_s$, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = x(nT_s) = [0, x(T_s), x(2T_s),\ \ldots \ ]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, $T_s = \frac{1}{8000}\text{sec}$. In practice, there are no ideal samplers, so this model doesn't strictly hold, but it is close enough for most applications and is the model that you would typically see used in introductory signal processing textbooks and courses.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-07T21:40:42.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9039" PostTypeId="1" AcceptedAnswerId="9042" CreationDate="2013-05-07T23:32:18.163" Score="12" ViewCount="10467" Body="&lt;p&gt;I am working on a image processing application which uses a discrete fourier transform to implement blurring/sharpening. The application is more or less working, but something about the mechanics is still confusing to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, it is how the process of centering the zero frequencies is being done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example I have seen preprocesses the input image (of greyscale intensities) by multiplying it with a matrix of size equal to the input image, whose values are $(-1)^{x+y}$, where $x$ is the row, $y$ is the column, so a pattern alternating $1$ and $-1$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the notes, this is equivalent of swapping the quadrants of matrix by flipping across the $x$ and $y$ axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand why this is done, and I would like to stress I understand I have my code/Fourier stuff working, I just don't understand why multiplying the input matrix by 1/-1 ends up centering the zero frequency component around 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4509" LastActivityDate="2013-11-02T02:15:22.890" Title="Centering zero frequency for Discrete Fourier Transform" Tags="|image-processing|fourier-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9040" PostTypeId="1" AcceptedAnswerId="9048" CreationDate="2013-05-07T23:35:12.487" Score="4" ViewCount="3404" Body="&lt;p&gt;Suppose I have a $4x4$ image with the following values as its grey-level intensity for each pixel like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2I8Xm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get its Fourier spectrum. Usually, I would just punch into Matlab and run a fft for everything to be calculated automatically. Now, if I don't have Matlab, and I have to do it by hand and with just an ordinary scientific calculator, can I still do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could do the brute force way on the Fourier transform's equation like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nuvsf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, $N=M=4$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, $f(x,y)$ returns the intensity value of the above image at position $x$ and $y$. Eg, $f(1,1)=1$, $f(2, 0)=3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this will be insane to work out the summations so many times on paper. Most calculators can't do summations with complex numbers too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried doing it with Fourier transform's separability property, but doesn't seem to work as I still have to go through the tedious summations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What other ways can I use to calculate Fourier transform on a simple image without using Matlab, particularly for the values in the first row of the example image above?&lt;/p&gt;&#xA;" OwnerUserId="3769" LastEditorUserId="3769" LastEditDate="2013-05-08T01:01:25.173" LastActivityDate="2019-05-08T06:57:54.600" Title="Calculating an image's fourier spectrum by hand?" Tags="|image-processing|fourier-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9041" PostTypeId="2" ParentId="9040" CreationDate="2013-05-08T00:04:04.627" Score="0" Body="&lt;p&gt;From wikipedia (&lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Fast_Fourier_transform&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Since 1968, however, the lowest published count for power-of-two N was long achieved by the split-radix FFT algorithm, which requires $4N \log_2 N -6N + 8$ real multiplications and additions for $N &amp;gt; 1$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For $N=4$ that is 16 operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an image that is specifically 4x4, you could make use of the fact that the exponential part of the sum only has values containing $1,-1,i,-i$. This is because the exponent can only have values that are a multiple of $\pi/2$ times $-i$. &lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2013-05-08T01:39:57.287" LastActivityDate="2013-05-08T01:39:57.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9042" PostTypeId="2" ParentId="9039" CreationDate="2013-05-08T01:59:36.020" Score="21" Body="&lt;p&gt;Oh!  What a cool trick!  It works because of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution_theorem&quot; rel=&quot;noreferrer&quot;&gt;convolution theorem&lt;/a&gt; (i.e., multiplication in the spatial/time domain is equivalent to convolution in the frequency domain.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not flipping across the $x$ and $y$ axis, it is rotating the image of the Fourier transform (think of shifting halfway around a cylinder).  The trick here is that alternating -1,1 in the spatial domain is a signal with the highest frequency.  So the Fourier transform of that image is a single point in the frequency domain.  Convolving by a single point is equivalent to shifting (rotating) the image by the offset of the point from the zero frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a test image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DkvsC.png&quot; alt=&quot;test image&quot;&gt;.  It's Fourier transform looks like: &lt;img src=&quot;https://i.stack.imgur.com/kBG5k.png&quot; alt=&quot;fourier transform of test image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take the Fourier transform of the alternating image (&lt;img src=&quot;https://i.stack.imgur.com/tijib.png&quot; alt=&quot;checkerboard image&quot;&gt;), it results in a single point right at the center of the Fourier transform: &lt;img src=&quot;https://i.stack.imgur.com/BeICn.png&quot; alt=&quot;enter image description here&quot;&gt;.  (Recall we haven't done our rotation yet, so the center of the fourier transform is the high frequencies and the low frequencies are at the corners still.)  But this is the &quot;rotation kernel!&quot;  Convolving with this rotation kernel moves everything down and to the right (but things that fall off the bottom right rotate into the top left.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolving the original image with the rotation kernel (in the image domain) gives you: &lt;img src=&quot;https://i.stack.imgur.com/7l7Xs.png&quot; alt=&quot;convolved image&quot;&gt;, while convolving the fourier transform image with the rotation kernel (in the frequency domain) gives you: &lt;img src=&quot;https://i.stack.imgur.com/k1o8y.png&quot; alt=&quot;rotated fourier transform&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And we can check that multiplying the testimage by the checkerboard in the image domain gives &lt;img src=&quot;https://i.stack.imgur.com/D0aIw.png&quot; alt=&quot;multiplication image&quot;&gt;, which has a fourier transform of: &lt;img src=&quot;https://i.stack.imgur.com/k1o8y.png&quot; alt=&quot;again rotated fourier transform&quot;&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="3764" LastEditDate="2013-05-08T03:44:07.390" LastActivityDate="2013-05-08T03:44:07.390" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9043" PostTypeId="2" ParentId="9026" CreationDate="2013-05-08T02:06:10.293" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;This question apparently is not at all about &lt;em&gt;negative&lt;/em&gt; frequencies which is the point I addressed earlier in a separate answer but about the signal at the image&#xA;  frequency that occurs as a result of the &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It appears from the comments by the OP on an earlier answer of mine that his question is&#xA;about an entirely different problem. The OP apparently&#xA;creates a BPSK signal $x(t)\cos(2\pi f_0 t)$&#xA;at a low frequency $f_0$ Hz and then mixes it with a high-frequency signal at frequency&#xA;$f_1$ Hz where $f_1 \gg f_0$.  This creates &lt;em&gt;two&lt;/em&gt; BPSK signals at carrier frequencies&#xA;$f_1 \pm f_0$ respectively and the question is whether this duplication&#xA;can be avoided somehow in the mixing&#xA;process, or whether one must filter the output to leave only one BPSK signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trigonometric identity &#xA;$2\cos(A)\cos(B) = \cos(A+B) + \cos(A-B)$ shows that mixing (multiplying)&#xA;the BPSK&#xA;signal $x(t)\cos(2\pi f_0 t)$ with $2\cos(2\pi f_1 t)$ gives &#xA;$$2\cos(2\pi f_1 t)x(t)\cos(2\pi f_0 t)&#xA;= x(t)\cos(2\pi (f_1+f_0)t) + x(t)\cos(2\pi (f_1-f_0)t),$$&#xA;that is, two BPSK signals at carrier frequencies $f_1+f_0$ Hz and&#xA;$f_1-f_0$ Hz. If one desires to have only the BPSK signal&#xA;at $f_1+f_0 = f_c$ Hz, say, then the BPSK signal at the&#xA;&lt;em&gt;image frequency&lt;/em&gt; $f_1-f_0$ &#xA;must be filtered out by passing the mixer output through&#xA;a bandstop filter that removes the image signal.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Can the filtering to remove the image frequency&#xA;be avoided by clever design of the mixer?&#xA;Mathematically Yes, but the costs might be prohibitive&#xA;and the physical circuitry requiring very careful design&#xA;and constant retuning.  The practical details are best&#xA;discussed over on the sister site electronics.SE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we create &lt;em&gt;two&lt;/em&gt; BPSK signals $x(t)\cos(2\pi f_0 t)$&#xA;and $x(t)\sin(2\pi f_0 t)$ on &lt;em&gt;phase-orthogonal&lt;/em&gt; carriers&#xA;at frequency $f_0$ and mix them (separately) with &lt;em&gt;phase-orthogonal&lt;/em&gt;&#xA;carriers at frequency $f_1$.  Then, their &lt;em&gt;difference&lt;/em&gt;&#xA;is&#xA;$$x(t)\cos(2\pi f_0 t)\cos(2\pi f_1 t) - x(t)\sin(2\pi f_0 t)\sin(2\pi f_1 t)&#xA;= x(t)\cos(2\pi (f_1+f_0)t)$$&#xA;which is a single BPSK signal at the desired frequency $f_1+f_0 = f_c$!!&#xA;However, notice that we need two baseband modulators and two RF mixers&#xA;instead of one of each plus a filter. Also, we need precise matching &#xA;of hardware so that the two signals are generated with equal amplitudes,&#xA;are amplified exactly equally, are modulated onto phase-orthogonal carrier&#xA;signals of precisely equal amplitudes and precise phase difference that must&#xA;be maintained through oscillator drift, ambient temperature changes, etc.&#xA;Why is all this so important? Well, &lt;em&gt;both&lt;/em&gt; mixer outputs &#xA;$x(t)\cos(2\pi f_0 t)\cos(2\pi f_1 t)$ and $x(t)\sin(2\pi f_0 t)\sin(2\pi f_1 t)$&#xA;contain &lt;em&gt;two&lt;/em&gt; BPSK signals, one at carrier frequency $f_1+f_0 = f_c$&#xA;and the other at carrier frequency $f_1-f_0$. When we take the difference,&#xA;the BPSK signals at carrier frequency $f_1+f_0 = f_c$ add constructively&#xA;and appear at the output of the subtractor, while the BPSK signals at&#xA;at carrier frequency $f_1-f_0$ cancel out. This is easy to do mathematically&#xA;or MATLABitacally or in software radio, but much more complicated to&#xA;achieve with analog circuits where slight differences in gains, phase shifts,&#xA;etc in the two allegedly identical circuits make it difficult to&#xA;achieve the exact cancellation of the undesired BPSK signal.&#xA;In short, getting a single BPSK signal via this method is by no means&#xA;as simple in practice as the straightforward mathematical result suggests.&#xA;As noted previously, questions about feasibility are best discussed over&#xA;on electronics.SE.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-05-08T11:41:26.477" LastActivityDate="2013-05-08T11:41:26.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9044" PostTypeId="2" ParentId="9020" CreationDate="2013-05-08T03:10:09.077" Score="0" Body="&lt;p&gt;You could use the adjoint of the integrator operator (i.e. cumsum) followed by a Fast Walsh-Hadamard transform.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. in Matlab&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 16;&#xA;H = fwht(eye(n))*sqrt(n); % Walsh-Hadamrd in full unitary matrix form&#xA;S = cumsum(eye(n)); % the integrator in full matrix form&#xA;T = H*S';  % cumsum along the rows of the W-H &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The sections of constant positive values in H integrate to cause inclines in the sawtooth waves; negative values become decline.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;T is not unitary which has repercussions for dimensional stretching.  On the bright side, it does have a fast inverse: another fwht followed by a differentiator.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D = inv(S');  % difference matrix with an extra row at bottom for full rank&#xA;Tinv = D*H;   % inverse of T&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2013-05-08T12:47:50.520" LastActivityDate="2013-05-08T12:47:50.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9045" PostTypeId="2" ParentId="8588" CreationDate="2013-05-08T06:26:48.203" Score="1" Body="&lt;p&gt;I can only offer a suggestion regarding Question 2, which is that .25 Hz and 2 Hz represent the reasonable bounds of the signal they're interested in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CEUQFjAB&amp;amp;url=http://dspace.mit.edu/openaccess-disseminate/1721.1/66243&amp;amp;ei=GumJUbvGG-fgiALajYGgBg&amp;amp;usg=AFQjCNFajqtw080oAp-Rd3MAGOoXFDywyQ&amp;amp;sig2=GZMTZ3v0DaKel-5XK6altg&amp;amp;bvm=bv.46226182,d.cGE&quot; rel=&quot;nofollow&quot; title=&quot;Non-contact, automated cardiac pulse measurements using video imaging and blind source separation&quot;&gt;related paper&lt;/a&gt; on measuring heart rate via video, they consider the range .75 Hz to 4 Hz of a computed frequency spectrum to find a human heart rate (.75 Hz = 45 BPM, 4 Hz = 240 BPM). Now, .25 Hz = 15 BPM and 2 Hz = 120 BPM aren't the most reasonable bounds for a human heart, so maybe they're looking for a related measure if they're focused on HRV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the name of the paper?&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2013-05-08T06:26:48.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9046" PostTypeId="1" AcceptedAnswerId="9061" CreationDate="2013-05-08T07:43:28.433" Score="7" ViewCount="269" Body="&lt;p&gt;I am looking for theory on whether compressed sensing reconstruction via &amp;#x2113;&lt;sub&gt;1&lt;/sub&gt;-minimization is unique and under which conditions.&lt;br/&gt;&#xA;I have looked through: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Tropp, J. A., &quot;Just relax: convex programming methods for identifying sparse signals in noise,&quot; &lt;em&gt;IEEE Transactions on Information Theory&lt;/em&gt;, 2006, 52, 1030-1051.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This paper states that the minimizer is unique but I can't quite boil down exactly what is required for this uniqueness (Eq. (&amp;#x2113;&lt;sub&gt;1&lt;/sub&gt;-Error) and Theorem 14) to hold.&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also looked at: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Candès, E. J.; Romberg, J. &amp;amp; Tao, T., &quot;Stable signal recovery from incomplete and inaccurate measurements,&quot; &lt;em&gt;Communications on Pure and Applied Mathematics&lt;/em&gt;, 2006, 59, 1207-1223.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, they do not seem to claim that the minimizer is unique.&lt;br/&gt;&#xA;Since both of these papers are from the earlier days of compressed sensing, I suspect that there may be newer results on this uniqueness of the solution. Do any of you have some hints?&lt;/p&gt;&#xA;" OwnerUserId="1464" LastEditorUserId="80" LastEditDate="2013-05-08T16:10:15.130" LastActivityDate="2013-05-09T00:47:53.627" Title="Conditions for unique (not exact) recovery from noisy compressed measurements" Tags="|compressive-sensing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9047" PostTypeId="2" ParentId="9040" CreationDate="2013-05-08T07:47:32.890" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://www.wolframalpha.com/input/?i=fft(%7B%7B0,+0,+3,+3%7D,+%7B0,+1,+3,+3%7D,+%7B0,+0,+3,+3%7D,+%7B0,+0,+3,+3%7D%7D)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wolfram Alpha&lt;/a&gt; is very useful for this kind of task - it gives the result for your 4x4 FFT above as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{{6.25+0. i, -3.-2.75 i, -0.25+0. i, -3.+2.75 i},&#xA; {0.+0.25 i, -0.25+0. i, 0.-0.25 i, 0.25+0. i},&#xA; {-0.25+0. i, 0.-0.25 i, 0.25+0. i, 0.+0.25 i},&#xA; {0.-0.25 i, 0.25+0. i, 0.+0.25 i, -0.25+0. i}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2019-05-08T06:57:54.600" LastActivityDate="2019-05-08T06:57:54.600" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9048" PostTypeId="2" ParentId="9040" CreationDate="2013-05-08T09:34:28.547" Score="5" Body="&lt;p&gt;Your particular case can be solved without a calculator. Fourier transforms are linear operations. You can decompose your input as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$3 \left( \begin{array}{cccc} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \end{array} \right) + \left( \begin{array}{cccc} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{array} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first matrix is constant on the Y axis, so its 2D FFT is only the 1D-FFT of one row, times 4, and 0 everywhere else. The 1D FFT of $(0, 0, 1, 1)$ is $(2, -1+j, 0, -1-j)$, so this gives you, for the first term:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$3 \times 4 \times \left( \begin{array}{cccc} 2 &amp;amp; -1+j &amp;amp; 0 &amp;amp; -1-j \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the second term, there's only one value so there's only one component in the sum - it's just one of the basis functions, the checkerboard pattern:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left( \begin{array}{cccc} 1 &amp;amp; -j &amp;amp; -1 &amp;amp; j \\&#xA;-j &amp;amp; -1 &amp;amp; j &amp;amp; 1 \\&#xA;-1 &amp;amp; j &amp;amp; 1 &amp;amp; -j \\&#xA;j &amp;amp; 1 &amp;amp; -j &amp;amp; -1 \end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summing these two, you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left( \begin{array}{cccc} 25 &amp;amp; -12+11j &amp;amp; -1 &amp;amp; -12-11j \\&#xA;-j &amp;amp; -1 &amp;amp; j &amp;amp; 1 \\&#xA;-1 &amp;amp; j &amp;amp; 1 &amp;amp; -j \\&#xA;j &amp;amp; 1 &amp;amp; -j &amp;amp; -1 \end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this differs from Paul R's answer because of the normalization and sign conventions nobody agrees with... Divide by 4 and take the conjugate and you'll find the same result as his.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-05-08T09:34:28.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9050" PostTypeId="1" AcceptedAnswerId="9051" CreationDate="2013-05-08T11:40:18.170" Score="1" ViewCount="103" Body="&lt;p&gt;What is the meaning of $Ta_k$ of fourier series or transform?&#xA;I am taking a course on signal and systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In 286 page of my textbook, it says that as T becomes arbitrarily large the original periodic square wave approaches a rectangular pulse.&#xA;Also it says that all that remains in the time domain is an aperiodic signal corresponding to one period of the square wave.&#xA;(textbook: siganls and systems sencond edition, author: oppenheim)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a difficulty understanding this.. I can't connect this idea with fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest a link &lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-fall-2011/lecture-videos-and-slides/MIT6_003F11_lec16.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-fall-2011/lecture-videos-and-slides/MIT6_003F11_lec16.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="4367" LastEditDate="2013-05-08T12:02:42.373" LastActivityDate="2013-05-08T12:35:27.930" Title="What is the meaning of $Ta_k$ of fourier series or transform?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9051" PostTypeId="2" ParentId="9050" CreationDate="2013-05-08T12:35:27.930" Score="3" Body="&lt;p&gt;The idea is that a &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow&quot;&gt;Fourier series&lt;/a&gt; is only defined for periodic signals. In the discussion in the linked slides, the author is considering a rectangular pulse train with period $T$. That is, a pulse of width $2S$ repeats periodically with a spacing of $T$ between them. The pulses are therefore centered at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;[\ldots, -2T, T, 0, T, 2T, \ldots ]&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, consider what happens as $T \to \infty$: in the limit, the only pulse that remains is the one centered at zero; the others are infinitely far away. When the author makes the claim that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\lim_{T\to \infty} T a_k = E(\omega)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He or she is trying to show that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Fourier transform&lt;/a&gt;, which is defined for suitably well-formed aperiodic signals, can be thought of as the Fourier series of that signal (which typically wouldn't be defined since the signal is not periodic) in the limiting case of an infinite period. Stated a little differently, you can in some way think of an aperiodic signal as a periodic signal with infinite period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The multiplication by $T$ in the limit is to account for the differences in definition between the Fourier series and Fourier transform: the series representation typically has a factor of $\frac{1}{T}$, while the transform does not. I don't know that there is a lot of insight to be gained via this analysis, but it shows that the series and transform representations are intimately related.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-08T12:35:27.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9052" PostTypeId="1" CreationDate="2013-05-08T12:43:19.803" Score="3" ViewCount="174" Body="&lt;p&gt;i have to estimate a process which changes over time, not with respect to the system-evolution or the measurement-function, but regarding the number of objects that have to be estimated. So every iteration I have to estimate e.g. 5 more state variables of a new object. Do you know method to do this with a Kalman or Particle Filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="4518" LastActivityDate="2013-05-08T12:43:19.803" Title="(Unscented) Kalman Filter with variable state dimensions" Tags="|kalman-filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9053" PostTypeId="2" ParentId="9035" CreationDate="2013-05-08T14:44:36.767" Score="1" Body="&lt;p&gt;To get a real signal valued time domain signal: create the negative frequencies as the complex  conjugate of the positive frequencies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a complex time domain signal: create negative frequencies by copying the amplitudes of the positive frequencies and applying a random phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you construct the signal in frames you will been apply windowing and overlap to avoid discontinuities at the frame boundaries.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-05-08T14:44:36.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9054" PostTypeId="1" CreationDate="2013-05-08T14:52:51.477" Score="5" ViewCount="46284" Body="&lt;p&gt;I'm trying to remove noise from an audio file. This audio file contains speech as well as constant pink noise. I know that I have to use the Fourier transform to convert to the frequency domain then use a filter to filter out the frequencies of the pink noise, but I really don't know where to start with that. It also seems that the noise covers many more frequencies than the speech file (I have the speech and noise files separately) by looking at the plots in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doesn't that mean that if I filter out the frequencies of the noise it'll remove all the speech as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot of the speech audio in the frequency domain displays that the frequencies are mostly between -450 and 450.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot of the noise alone in the frequency domain displays that the frequencies are between -2000 and 2000. This clearly covers a much wider range of frequencies than the speech audio. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean I can't remove it from the noisy speech audio without removing the speech too? Or can I remove the frequencies outside of -450 and 450 and that would remove much of the noise? If so, how do I compute the range of frequencies instead of looking at plots myself to see the range?&lt;/p&gt;&#xA;" OwnerUserId="4522" LastEditorUserId="80" LastEditDate="2013-05-08T15:56:22.893" LastActivityDate="2013-05-08T20:39:37.463" Title="Removing noise from audio using Fourier transform in Matlab" Tags="|fft|matlab|audio|frequency|noise|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9055" PostTypeId="2" ParentId="9035" CreationDate="2013-05-08T15:49:44.840" Score="1" Body="&lt;p&gt;There is still lots of issues with what you're trying to achieve, but it's a little clearer for me now. Thanks for the edit.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;DC term:&lt;/strong&gt; You say&#xA;$$&#xA;u(t) = U(t) + u^{'}(t);&#xA;$$&#xA;with $U = 10 [m/s]$.  Surely the constant $U$ is your &quot;DC&quot; (zeroth order) term?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sampling Rate:&lt;/strong&gt; You say that $time = 600$ and that $Nfft = 4096$. Does that make your sampling rate $f_s = 4096 / 600  = 6.8267$ Hz?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;df&lt;/em&gt; Choice:&lt;/strong&gt; I am not sure why you choose $df = 600$ ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Random Phase Generation:&lt;/strong&gt; Your phase generation seems odd to me.  This &#xA;&lt;code&gt;nn = complex(normrnd(0,1,Nfft/2),normrnd(0,1,Nfft/2));&lt;/code&gt;&#xA;will not generate &lt;em&gt;just&lt;/em&gt; random phase. It will also generate a random amplitude, which is not what you want if you're just after phase.  To get a random phase, you're better off doing: &lt;code&gt;nn = exp(1j*2*pi*rand(1,Nfft/2))&lt;/code&gt;.  That generates &lt;code&gt;Nfft/2&lt;/code&gt; uniform random variables (between 0 and 1), multiplies them by $2\pi$ and then forms $e^{j2\pi\times \mathrm{rand(1,Nfft/2)}}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to account for the DC term?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your (positive-frequency) spectrum is $H_n(f)$ for $f= k df$ for $k=1,\ldots,Nfft/2$, then just form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{array}&#xA;\ H(f) &amp;amp;=&amp;amp; U, \mathrm{for\ } f=0\\&#xA;&amp;amp;=&amp;amp; H_n(f), \mathrm{for\ } f&amp;gt;0\\&#xA;&amp;amp;=&amp;amp; H^*_n(-f), \mathrm{for\ } f&amp;lt;0&#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-05-08T20:40:16.230" LastActivityDate="2013-05-08T20:40:16.230" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9056" PostTypeId="2" ParentId="9054" CreationDate="2013-05-08T16:09:04.920" Score="2" Body="&lt;p&gt;You can filter out everything that's below a certain threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a quick approach (I didn't test the code):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the FFT of the samples:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;fft_values = fft(samples);&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get the mean value and calculate a threshold:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;mean_value = mean(abs(fft));&#xA;threshold  = 1.1*mean_value; % Fine-tune this&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Remove everything that's below the threshold (we assume that it corresponds to noise):&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;fft_values[abs(fft_values) &amp;lt; threshold] = 0;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get the filtered samples:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;filtered_samples = ifft(fft_values);&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's a starting point. You could use sliding windows for better filtering.&lt;/p&gt;&#xA;" OwnerUserId="4523" LastActivityDate="2013-05-08T16:09:04.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9057" PostTypeId="2" ParentId="9039" CreationDate="2013-05-08T17:19:28.260" Score="11" Body="&lt;p&gt;Wandering Logic's answer is correct and detailed. Just thought you'd want to see some math instead of pictures:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at the 1D case, you are multiplying the input by $(-1)^k = e^{j\omega}$ where the frequency $\omega$ happens to be $2\pi (k/2)$. I.e., the multiplication shifts the spectrum of the signal by half the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect is that the zero frequency - which was at index 0 before - is now at half the image width (or height, depending on whether you multiply the columns or the rows).&lt;/p&gt;&#xA;" OwnerUserId="1082" LastEditorUserId="1082" LastEditDate="2013-05-18T17:55:45.677" LastActivityDate="2013-05-18T17:55:45.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9058" PostTypeId="1" AcceptedAnswerId="9059" CreationDate="2013-05-08T17:33:48.353" Score="8" ViewCount="7510" Body="&lt;p&gt;Before anyone yells at me I fully realize that this question has been asked numerous times. I assure you that I've read through the existing questions and answers but I am still confused about part of the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a sound source that plays music (A) in a closed environment. I have a mic  that I'm using to record  A. I am left with two wav files which share the same characteristics and length (number of samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is calculate the time it took for A to reach the mic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to perform the calculation using cross-correlation (numpy):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Delay estimation&#xA;corr = numpy.convolve(original_audio, recorded_audio, 'full')&#xA;delay = int(len(corr)/2) - numpy.argmax(corr)&#xA;distance = delay / sample_rate * 343 # sample_rate == 22050, m/s = speed of sound&#xA;print(&quot;Distance full: %.2f cm&quot; % (distance * 100))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I consistently obtain values in the 300,000 cm range. The distance between the speaker and mic is approximately 2 feet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is all pretty new to me so I'm sure I'm missing something obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4396" LastActivityDate="2013-05-08T20:00:57.407" Title="Measuring time delay of audio signals" Tags="|audio|cross-correlation|estimation|delay|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9059" PostTypeId="2" ParentId="9058" CreationDate="2013-05-08T20:00:57.407" Score="8" Body="&lt;p&gt;Are you sure you shouldn't be using &lt;code&gt;numpy.correlate&lt;/code&gt; instead of &lt;code&gt;numpy.convolve&lt;/code&gt;?  To estimate delay, you want to cross-correlate your signals, not convolve them.  You'll possibly end up with a much larger delay by convolving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying something simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = [1, 0, 0, 0, 0 ];&#xA;y = [0, 0, 0, 0, 1 ];&#xA;conv = numpy.convolve(x,y); &#xA;conv&#xA;array([0, 0, 0, 0, 1, 0, 0, 0, 0])&#xA;corr = numpy.correlate(x,y,&quot;full&quot;);&#xA;corr&#xA;array([1, 0, 0, 0, 0, 0, 0, 0, 0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-05-08T20:00:57.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9060" PostTypeId="2" ParentId="9054" CreationDate="2013-05-08T20:39:37.463" Score="5" Body="&lt;p&gt;From my experience, your best bet is spectral subtraction. You can find a lot of literature about it on the web. Here just a quick overview of what you need to do. You take overlapping windowed blocks of your time domain signal and transform them to the frequency domain using an FFT. Then for each frequency bin you need to estimate the signal-to-noise ratio. There are several simple noise tracking algorithms that perform well if the noise is relatively stationary. Based on the estimated SNR per frequency bin you mulitply each bin with a gain constant between 0 (terrible SNR) and 1 (no noise). Note that you only deal with magnitudes, the phase of the FFT is left unchanged. After modifying the FFT bins with the gain factors, you combine the processed bins back to the time domain using the phase of the original noisy signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://teal.gmu.edu/~yephraim/Papers/assp%201984%20stsa.pdf&quot; rel=&quot;noreferrer&quot;&gt;Here&lt;/a&gt; is a classic paper on this subject. It goes a bit further than pure spectral subtraction but the overall system is the same. Don't worry too much about the math involved to derive the optimal gain function.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-08T20:39:37.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9061" PostTypeId="2" ParentId="9046" CreationDate="2013-05-09T00:47:53.627" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.150.5176&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;noreferrer&quot;&gt;&quot;Recovery of Exact Sparse Representations in the Presence of Bounded Noise&quot;&lt;/a&gt;, by J. Fuchs, deals with the case you ask. From the abstract:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The purpose of this contribution is to extend some recent results on sparse representations of signals in redundant bases developed in the noise-free case to the case of noisy observations. [..] We consider the case $b = Ax_0 + e$ [...] and seek conditions under which $x_0$ can be recovered from $b$ ...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think theorem 2 and 3 are what you're looking for (at least in part).&lt;/p&gt;&#xA;" OwnerUserId="172" LastActivityDate="2013-05-09T00:47:53.627" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9063" PostTypeId="2" ParentId="6475" CreationDate="2013-05-09T02:32:40.810" Score="6" Body="&lt;p&gt;You might try Vincent Falco's &lt;a href=&quot;https://github.com/vinniefalco/DSPFilters&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Collection of Useful C++ Classes for Digital Signal Processing&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The StackOverflow Question &lt;a href=&quot;https://stackoverflow.com/questions/6664686/a-c-library-for-iir-filter&quot;&gt;&lt;strong&gt;A C++ library for IIR filter&lt;/strong&gt;&lt;/a&gt; offers a few more suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally: the hard part for Butterworth/Chebychev filters is really the design, not the implementation.  You might consider doing the design in Matlab (or Gnu Octave), or an online site like: &lt;strong&gt;&lt;a href=&quot;http://www-users.cs.york.ac.uk/~fisher/mkfilter/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www-users.cs.york.ac.uk/~fisher/mkfilter/&lt;/a&gt;&lt;/strong&gt;.  Writing the C code should be trivial once you know the coefficients for the recurrence relation.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2013-05-09T02:32:40.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9064" PostTypeId="1" AcceptedAnswerId="10445" CreationDate="2013-05-09T02:54:32.713" Score="6" ViewCount="862" Body="&lt;p&gt;I'm writing an app that recognizes Sudoku puzzles from a camera input.  I'd like to remove camera blur from the images to improve recognition.  Here is an example image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/foukI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I'm processing a continuous camera feed, I'm concerned about speed, since slow algorithms will degrade my frame rate.  On the other hand, the technique doesn't have to be super-accurate, since I will be thresholding/binarizing the image afterwards.  The deblurring algorithm I use only needs to be accurate enough so that the digits will be clear after thresholding.  Here is what the image currently looks like after a segmented Otsu threshold (the threshold level is selected independently for each 3x3 grid of cells):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N52pz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to write an implementation that's compatible with OpenCV data structures.  This means that an off-the-shelf Matlab solution isn't an option.  However, I found &lt;a href=&quot;https://www.mathworks.com/help/images/understanding-deblurring.html&quot; rel=&quot;noreferrer&quot;&gt;the Matlab documentation on image deblurring&lt;/a&gt; to be quite helpful in understanding the general principles, as well as &lt;a href=&quot;http://www.owlnet.rice.edu/~elec539/Projects99/BACH/proj2/intro.html&quot; rel=&quot;noreferrer&quot;&gt;this site&lt;/a&gt;.  The Matlab functions are all computationally-intensive in any case, and I wasn't able to pick an estimated point-spread function (PSR) that gave good results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are your suggestions for a fast deblurring algorithm that allows features to be distinguished easily by a subsequent threshold?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4526" LastActivityDate="2013-08-22T20:31:23.897" Title="Deblurring algorithm to precede thresholding - speed over accuracy" Tags="|image-processing|thresholding|deconvolution|blur|blind-deconvolution|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9066" PostTypeId="1" AcceptedAnswerId="9093" CreationDate="2013-05-09T20:51:54.637" Score="5" ViewCount="3270" Body="&lt;p&gt;We're trying to implement a &quot;simple&quot; speech recognition application in MATLAB (isolated words from a very limited dictionary). We've been trying the following methods:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Extract MFCC coefficients for each frame of the word, and then compare to templates that we have recorded previously using DTW, and take the template that gave the minimal distance as the recognized word. (note: the &quot;templates&quot; are 10 recordings of each of the 6 dictionary-words).&lt;/li&gt;&#xA;&lt;li&gt;Extract MFCC coefficients for each frame, and run an SVM on the coefficients (for each dictionary word we had a different SVM classifier).&lt;/li&gt;&#xA;&lt;li&gt;Extract MFCC coefficients for each frame, and then define the feature vector as the vector of all distances from all the templates, then run an SVM on these features.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All three of these methods didn't work well (and gave almost everything wrong results). &#xA;We don't know what the problem is.. A few questions that arose, but we don't know the answers, are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Do we really need 10 samples of each word? or can we &quot;combine&quot; them into a single template? and if so, how?&lt;/li&gt;&#xA;&lt;li&gt;Should we run the SVM directly on the MFCCs vectors? On the MFCC vector of vectors (for each word)? On the DTW values? or should we combine all the MFCC vectors into a single one?&lt;/li&gt;&#xA;&lt;li&gt;If we should look for a minimal match for the DTW between the input and the templates, should we give different weights to the templates depending on length, or even account for the differences between the templates (the templates of the word &quot;1&quot; are more distant from one another than the templates of the word &quot;2&quot;).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would appreciate any help, or references to good sources. We thought about using HMMs, but it seems much more difficult and not really possible in our time-frame..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4529" LastActivityDate="2015-05-21T18:02:57.570" Title="Using MFCC in spoken words recognition" Tags="|algorithms|speech-recognition|mfcc|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9067" PostTypeId="1" AcceptedAnswerId="9072" CreationDate="2013-05-09T22:28:45.187" Score="4" ViewCount="97" Body="&lt;p&gt;I want to ask about this scheme:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/aOzRy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u_0$ should be something as input in specific point given by the initial conditions and $y_0$ output. Block State Spase represented linearized system by A, B, C, D state metrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I'm wondering why there is &quot;-&quot; by $u_0$ and &quot;+&quot; by $y_0$. Is this scheme universal? Why does it look like it looks?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastActivityDate="2013-05-10T01:03:44.260" Title="Linearized system and State Space" Tags="|state-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9068" PostTypeId="1" CreationDate="2013-05-09T22:45:06.600" Score="3" ViewCount="1156" Body="&lt;p&gt;It is well known that the DFT can be interpreted as a filter bank. The same can be done for the DCT, for instance Fig. 3.29, pag. 129 in [1] shows a plot of the frequency response of a DCT filter bank. I am wondering how this plot (and similar plots for other transforms like DST, etc.) was obtained. For the DFT, we have the &lt;em&gt;prototype filter&lt;/em&gt; $H_0(z)=\sum_{n=0}^{N-1}z^{-n}$. The frequency response of the $k$-th DFT bin is $H_k(z)=H_0(z\, e^{-j\frac{2\pi}{N}k})$. Using the transformation $z=e^{j\omega}$ we can readily find the frequency response for all bins (see the plot below).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fl3nU.png&quot; alt=&quot;DFT filter bank frequency response (N=8)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know there is no z-transform equivalent for the DCT, so it's not clear to me how that plot was obtained. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Malvar, H.S., Signal processing with lapped transforms, 1992, Artech House&lt;/p&gt;&#xA;" OwnerUserId="1696" LastActivityDate="2014-05-06T00:55:28.687" Title="Conversion between DCT to DFT frequency domains" Tags="|filters|dct|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9069" PostTypeId="1" AcceptedAnswerId="9071" CreationDate="2013-05-09T21:47:38.243" Score="3" ViewCount="950" Body="&lt;p&gt;I am having trouble with zero-padding. As I understand it, in theory, zero-padding in the time-domain should 'sinc-interpolate' the FFT of the signal in the frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would mean, that 1) none of the values of the original signal change. 2) the overall profile of the FFT doesnt change- aka the peaks remain around the same point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in simulations this does not work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I FFT the following sequence &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;x=[0 1 0 1 0 1 0 1] &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;at an imaginary same frequency, Fs=1Hz. With no zero-padding (FFT-8),&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;|X(f=.3125)|=4. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;With 2x zero-padding (FFT-14), &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;|X(f=.3125)|=2.6. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As $N \rightarrow \infty$, $|X(f=.3125)| \rightarrow 0\ $. Also, the peak of the FFT shifts from .3125 to .25 as $N \rightarrow \infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code. The relavent parameter is ZP, which controls the amount of zero-padding (N=8*ZP):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ZP=0;       % of times of original length of signal to ZP with&#xA;&#xA;x=[0 1 0 1 0 1 0 1]; &#xA;x=[x,zeros(1,length(x)*2^ZP-length(x))];&#xA;X=fft(x);&#xA;&#xA;Fs=1;&#xA;L=length(x);&#xA;df=.5*Fs/L;&#xA;t=(1:L)*(1/Fs);&#xA;f=(1:L)*df;&#xA;&#xA;figure(12), &#xA;subplot(211), stem(x);&#xA;subplot(212), stem(f,abs(X)); xlim([-.02,.52])&#xA;&#xA;test_pnt=.3125;&#xA;I=find(f==test_pnt);&#xA;title(['abs[X(' mat2str(test_pnt) ')]=' mat2str(abs(X(I)))]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4550" OwnerDisplayName="DankMasterDan" LastEditorUserId="80" LastEditDate="2013-05-10T00:35:36.617" LastActivityDate="2013-05-10T01:14:36.983" Title="Zero-Padding seems to CHANGE FFT of signal!" Tags="|fft|zero-padding|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9070" PostTypeId="2" ParentId="9068" CreationDate="2013-05-10T00:28:41.757" Score="0" Body="&lt;p&gt;A DCT bin filter's response depends on both the frequency and phase of the input.  Thus a frequency response alone in informationally incomplete.  Adjacent DCT bins overlap in frequency, but with differing phase responses at the overlap frequencies.  Thus it may take 2 DCT bins to convey or respond to both the frequency and phase of any input sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot may be for only one phase of input per bin.  If the phase is fixed for any given frequency, then there can be a response that strictly depends on frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-05-10T00:34:38.233" LastActivityDate="2013-05-10T00:34:38.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9071" PostTypeId="2" ParentId="9069" CreationDate="2013-05-10T00:45:29.667" Score="9" Body="&lt;p&gt;Your problem is these two lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=(1:L)*(1/Fs);&#xA;f=(1:L)*df;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They should read:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=(0:L-1)*(1/Fs);&#xA;f=(0:L-1)*df;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I modify your script as below (for scilab, not matlab), I get the following plot.  The peaks all line up correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the peak of the FFT is at 0.25 not 0.3125.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3OV3s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for ZP=0:5       // of times of original length of signal to ZP with&#xA;&#xA;    x=[0 1 0 1 0 1 0 1]; &#xA;    x=[x,zeros(1,length(x)*2^ZP-length(x))];&#xA;    X=fft(x);&#xA;&#xA;    Fs=1;&#xA;    L=length(x);&#xA;    df=.5*Fs/L;    &#xA;    t=(0:L-1)*(1/Fs);&#xA;    f=(0:L-1)*df;&#xA;&#xA;    figure; &#xA;    subplot(211), plot(x);&#xA;    subplot(212), plot(f,abs(X)); //xlim([-.02,.52])&#xA;&#xA;    test_pnt=.3125;&#xA;    I=find(f==test_pnt);&#xA;    title('abs[X(' + string(test_pnt) +']='+ string(abs(X(I))));&#xA;&#xA;end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-05-10T01:14:36.983" LastActivityDate="2013-05-10T01:14:36.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9072" PostTypeId="2" ParentId="9067" CreationDate="2013-05-10T01:03:44.260" Score="1" Body="&lt;p&gt;The scheme is not universal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One reason to do it is to allow the system to be modeled around a set-point or bias level ($u_0$) without having that set-point affect the state space model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtracting the set-point, doing the state space equations, and then adding back on the &lt;em&gt;corrected&lt;/em&gt; set-point ($y_0$) lets you do this.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-05-10T01:03:44.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9073" PostTypeId="1" CreationDate="2013-05-10T04:55:30.343" Score="-1" ViewCount="176" Body="&lt;p&gt;I am working in digital image processing field, i have set of mammogram images in &lt;strong&gt;.bmp&lt;/strong&gt; format, when i am opening anyone image using &lt;strong&gt;MATLAB&lt;/strong&gt; then i am getting intensity value as &lt;strong&gt;0&lt;/strong&gt; for a particular location (i,j), but when i am opening this image from &lt;strong&gt;java program&lt;/strong&gt; using &lt;strong&gt;BufferedImage&lt;/strong&gt; then i am getting intensity value as &lt;strong&gt;59&lt;/strong&gt; for same location (i,j). Please tell what is reason behind it.&lt;/p&gt;&#xA;" OwnerUserId="4444" LastActivityDate="2013-05-10T09:12:07.807" Title="Getting Different Intensity Values in MATLAB and Java Program output" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9075" PostTypeId="2" ParentId="9073" CreationDate="2013-05-10T09:12:07.807" Score="1" Body="&lt;p&gt;Many possibilities - &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Color image, in which case you have three indices in MATLAB, e.g. &lt;code&gt;I(i,j,k)&lt;/code&gt; where k is 1, 2 or 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0-based vs 1-based indexing. First pixel is I(1,1) in MATLAB, I(0,0) in Java&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB indexes by row then column, BufferedImage's getRGB function does column (x) then row (y)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest starting at (1,1) and getting them to match. Then try (1,2) and (2,1).&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-10T09:12:07.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9076" PostTypeId="2" ParentId="1242" CreationDate="2013-05-10T12:23:23.487" Score="6" Body="&lt;p&gt;Inferring whether two signals are independent is very hard to do (given finite observations) without any prior knowledge/assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two random variable $X$ and $Y$ are independent if the value of $X$ doesn't give any information about the value of $Y$ (i.e. doesn't affect our prior probability distribution for $Y$).&#xA;This is equivalent to any nonlinear transformation of $X$ and $Y$ being uncorrelated i.e.&#xA;$$\text{cov}(f_1(X),f_2(Y)) = E(f_1(X),f_2(Y)) = 0$$&#xA;for any non-linear $f_1$ and $f_2$ assuming wlog both variables have zero mean.&#xA;The difference between independence and uncorrelatedness is that $X$ and $Y$ are uncorrelated if the above holds, only for $f_1(x) = f_2(x) = x$, the identity function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume joint Gaussianity, then all joint moments greater than order 2 are equal to zero and in this case uncorrelated implies independent.&#xA;If we have no prior assumptions then estimation of the joint moments $E(X^iY^j)$ will give us information on 'how dependent' they are upon one another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can generalise this to signals $X(t)$ and $Y(t)$ by considering the cross-spectra $$S_{X,Y}(f),S_{X^2,Y}(f),S_{X,Y^2}(f) \dots$$ across all frequencies $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading 'pichenettes' comment I was inspired to use his idea as an example. Consider the signals&#xA;$$X(t) = \sin(2 \pi ft)$$&#xA;$$Y(t) = \sin( 2 \pi ftk)$$&#xA;for $k \in \mathbb{Z}$ and $k \neq 1$. Clearly there is no linear transform sending $X(t)$ to $Y(t)$ as they oscillate at different frequencies. However, it is well known that we can write $\sin(kx)$ as a function in $\sin(x)$ and therefore,&#xA;$$Y(t) = f (X (t))$$&#xA;for some polynomial $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence despite being uncorrelated signals, $X(t)$ and $Y(t)$ are not independent.&lt;/p&gt;&#xA;" OwnerUserId="4534" LastEditorUserId="4534" LastEditDate="2014-04-18T16:44:17.023" LastActivityDate="2014-04-18T16:44:17.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9077" PostTypeId="2" ParentId="1523" CreationDate="2013-05-10T13:02:09.917" Score="4" Body="&lt;p&gt;As mentioned above, both signals 3 and 5 appear to be quite correlated and have a similar period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can think of two signals being correlated if we can shift one of the sources left or right and increase or decrease its amplitude so that it fits on top of the other source. Note we are not changing the frequency of the source, we are just performing a phase and amplitude shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above case, we can shift source 3 so that its peaks coincide with source 5. This is the sort of thing that will mess source extraction when using ICA due to the independence assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: A nice illustration of the above concept is to think of two sinusoidal waves. These are both completely deterministic. If they both have the same frequency (even with different phase) then they are perfectly correlated and ICA will not be able to separate them. If instead they have different frequencies (that are not integer multiples of one another), then they are &lt;strong&gt;independent&lt;/strong&gt; and can be seperated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is some Matlab code for you to see this for yourself&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Sine waves of equal frequency&#xA;X = 1:1000;&#xA;Y(1,:) = sin(2*pi*X*10/1000);&#xA;Y(2,:) = sin(1+2*pi*X*10/1000);&#xA;&#xA;figure&#xA;subplot(3,2,1)&#xA;plot(Y(1,:))&#xA;title('Initial Source 1')&#xA;subplot(3,2,2)&#xA;plot(Y(2,:))&#xA;title('Initial Source 2')&#xA;A = [1, 2; 4, -1];&#xA;Y = A*Y;&#xA;subplot(3,2,3)&#xA;plot(Y(1,:))&#xA;title('Signal 1')&#xA;subplot(3,2,4)&#xA;plot(Y(2,:))&#xA;title('Signal 2')&#xA;&#xA;Z = fastica(Y);&#xA;&#xA;subplot(3,2,5)&#xA;plot(Z(1,:))&#xA;title('Source 1')&#xA;subplot(3,2,6)&#xA;plot(Z(2,:))&#xA;title('Source 2')&#xA;&#xA;%Sine waves of different frequency&#xA;X = 1:1000;&#xA;Y(1,:) = sin(2*pi*X*10/1000);&#xA;Y(2,:) = sin(1+2*pi*X*8/1000);&#xA;&#xA;figure&#xA;subplot(3,2,1)&#xA;plot(Y(1,:))&#xA;title('Initial Source 1')&#xA;subplot(3,2,2)&#xA;plot(Y(2,:))&#xA;title('Initial Source 2')&#xA;A = [1, 2; 4, -1];&#xA;Y = A*Y;&#xA;subplot(3,2,3)&#xA;plot(Y(1,:))&#xA;title('Signal 1')&#xA;subplot(3,2,4)&#xA;plot(Y(2,:))&#xA;title('Signal 2')&#xA;&#xA;Z = fastica(Y);&#xA;&#xA;subplot(3,2,5)&#xA;plot(Z(1,:))&#xA;title('Source 1')&#xA;subplot(3,2,6)&#xA;plot(Z(2,:))&#xA;title('Source 2')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that for the waves of the same frequency, ICA just returns the input signals, but for different frequencies it returns the original sources.&lt;/p&gt;&#xA;" OwnerUserId="4534" LastEditorUserId="4534" LastEditDate="2013-05-10T17:10:01.547" LastActivityDate="2013-05-10T17:10:01.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9078" PostTypeId="2" ParentId="6182" CreationDate="2013-05-10T13:11:23.200" Score="0" Body="&lt;p&gt;You mention using a low pass filter, but as one of the commenters mentioned you would probably do better with a band-pass filter to also filter out the low frequency noise.  There also exists noise reduction filters in third-party libraries if you are interested in pre-existing solutions.&lt;/p&gt;&#xA;" OwnerUserId="4535" LastActivityDate="2013-05-10T13:11:23.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9079" PostTypeId="2" ParentId="7678" CreationDate="2013-05-10T13:18:28.723" Score="5" Body="&lt;p&gt;I would use the signal's autocorrelation properties or flatness of PSD to determine this.  The autocorrelation of theoretical white noise is an impulse at lag 0.  Furthermore, the PSD of the fourier transform of the autocorrelation function, the PSD of theoretical white noise is constant.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either of these should give you a good idea of the whiteness of your noise.&lt;/p&gt;&#xA;" OwnerUserId="4535" LastActivityDate="2013-05-10T13:18:28.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9080" PostTypeId="2" ParentId="7678" CreationDate="2013-05-10T16:47:06.743" Score="14" Body="&lt;p&gt;You could form a statistical test, based on the autocorrelation of the potentially-white sequence. The &lt;a href=&quot;http://books.google.com/books?id=Zhc36gyobk0C&amp;amp;lpg=SA16-PA8&amp;amp;ots=-lsjlElOfc&amp;amp;dq=statistical%20test%20for%20whiteness&amp;amp;pg=SA16-PA8#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Digital Signal Processing Handbook&lt;/em&gt;&lt;/a&gt; suggests the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6dt1e.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may be implemented in scilab as below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running this function over two noise sequences: a white noise one, and a lightly filtered white noise one, then the following plot results.  Script for generation of each realization of the noise sequences is at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yRa0T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mean of the statistic for the white noise is 9.79; the mean of the statistic for the filtered noise is 343.3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at a &lt;a href=&quot;http://www.wolframalpha.com/input/?i=Chi-Square+Distribution,+Degrees+of+Freedom%3D%5B%2F%2Fmath:10%2F%2F%5D&quot; rel=&quot;nofollow noreferrer&quot;&gt;chi-squared table&lt;/a&gt; for 10 degrees of freedom, we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gtm6J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gtm6J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we see that there is no significance level at which 9.79 (in the table) that the white noise isn't white. We also see that the value of 343.3 is very likely to be non-white (comparing it to the 23.2093 value in the $p=0.01$ significance column).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function R = whiteness_test(x,m)&#xA;    N = length(x);&#xA;    XC = xcorr(x);&#xA;    len = length(XC);&#xA;    lags = len/2+1 + [1:m];&#xA;    R = N*sum(XC(lags).^2)/XC(len/2+1).^2;&#xA; endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = rand(1,1000,'normal');&#xA;Y = filter(1,[1 -0.5],X)&#xA;R = [R; whiteness_test(X,10)];&#xA;R2 = [R2; whiteness_test(Y,10)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2018-08-03T11:58:24.690" LastActivityDate="2018-08-03T11:58:24.690" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="9081" PostTypeId="1" AcceptedAnswerId="9084" CreationDate="2013-05-10T19:05:40.663" Score="7" ViewCount="3689" Body="&lt;p&gt;I have a block of audio and I have performed an FFT on it.  Now what I want to do is convert this FFT into a set of MFCCs, however while I know I need to do something with weighting the FFT samples based upon a set f triangular filters I haven't really got a clue what this involves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone go into some good detail on it?  If you are going to give me a matlab example please explain each step well as matlab allows you to cut quite a few corners and I'm trying to implement MFCC extraction on iPhone.&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2013-05-10T21:31:39.343" Title="MFCC feature extraction" Tags="|fft|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9082" PostTypeId="2" ParentId="9066" CreationDate="2013-05-10T19:18:41.890" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Do we really need 10 samples of each word? or can we &quot;combine&quot; them into a single template? and if so, how?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can use single template, 10 templates will make result more accurate.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Should we run the SVM directly on the MFCCs vectors? On the MFCC vector of vectors (for each word)? On the DTW values? or should we combine all the MFCC vectors into a single one?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;SVM has no meaning for your application because it is not invariant to time stretch so it's not suitable for classification of time series. There are SVM modifications to deal with time series, for example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.7.8542&quot; rel=&quot;nofollow&quot;&gt;Hidden Markov Support Vector Machines&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it's completely different story&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If we should look for a minimal match for the DTW between the input and the templates, should we give different weights to the templates depending on length, or even account for the differences between the templates (the templates of the word &quot;1&quot; are more distant from one another than the templates of the word &quot;2&quot;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, it's not necessary. A simple comparison of DTW values should work.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;All three of these methods didn't work well (and gave almost everything wrong results).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Probably you made a mistake in DTW implementation first of all. You need to verify if you implemented everything correctly. You might make a mistake in DTW and go to incorrect conclusion&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;or references to good sources.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Read a good text book. At least &lt;a href=&quot;http://books.google.com/books/about/Fundamentals_Of_Speech_Recognition.html?id=4PQeabgwfX8C&quot; rel=&quot;nofollow&quot;&gt;Rabiner &quot;Fundamentals of Speech Recognition&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3453" LastEditorUserId="80" LastEditDate="2013-05-10T19:28:23.347" LastActivityDate="2013-05-10T19:28:23.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9083" PostTypeId="1" AcceptedAnswerId="9087" CreationDate="2013-05-10T20:26:02.277" Score="5" ViewCount="1221" Body="&lt;p&gt;Is there any way to control per-pixel contrast? E.g., a way to set an upper or lower limit on the contrast between pixels?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest thing I've found is a high-pass filter of an &lt;em&gt;n&lt;/em&gt;-pixel radius, inverted and applied as an overlay layer in Photoshop. Other kinds of filters, such as median, blurs, and traditional contrast adjustment, produce a result which is similar to my goal in some circumstances, but for the whole image, rather than only pixel pairs over a given contrast threshold, or proportionally based on contrast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this concept have a name? Is there an easier way to do what I'm attempting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Edit: And is there any free or affordable software which can be coerced to do this?]&lt;/p&gt;&#xA;" OwnerUserId="4491" LastEditorUserId="4491" LastEditDate="2013-05-12T14:34:20.207" LastActivityDate="2013-05-12T14:34:20.207" Title="Can I control per-pixel contrast in an image?" Tags="|image-processing|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9084" PostTypeId="2" ParentId="9081" CreationDate="2013-05-10T20:36:40.897" Score="11" Body="&lt;p&gt;There's a lot of literature on MFCCs on the web, so it would be a bit easier if you could be more specific as to which part of the processing you don't understand. But I'll give an overview of what needs to be done, hoping this is helpful for you:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;compute the squared magnitudes of the FFT bins&lt;/li&gt;&#xA;&lt;li&gt;weigh the bins using triangular windows; usually the windows are chosen such that the centers of the triangles are equidistant on a mel-frequency scale, and such that each triangle begins and ends at the centers of the two adjacent triangles. The mel-frequency scale is defined by&#xA;$$m=2595\log_{10}(1+f/700)$$ where $f$ is the frequency in Hz. Look at the figure to see how it works:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Nq3n0.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Note that the kernels are normalized such that the sum of the weights per triangle equals 1. Usually around 20 such triangular windows are used.&lt;/li&gt;&#xA;&lt;li&gt;Take the logarithm of the weighted coefficients.&lt;/li&gt;&#xA;&lt;li&gt;Compute the DCT.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-10T21:31:39.343" LastActivityDate="2013-05-10T21:31:39.343" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9085" PostTypeId="1" AcceptedAnswerId="9088" CreationDate="2013-05-10T20:49:36.433" Score="4" ViewCount="4777" Body="&lt;p&gt;I started studying DSP and the first things that came out were the differences between continuous and discrete time signals. So, I was wondering if I understood well these concepts before I keep going into more difficult topics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing I realized is that discrete-time signals replace the continuous parameter $t$ (time) for $n$ (sample) where $n$ is always an integer, leading this to two main differences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Complex exponential sequences $Ae^{j\omega n}$ with frequencies $\omega + 2\pi k$ where $k$ is an integer are indistinguishable from one another since $e^{j2\pi n} = 1$  always. This is not true for continuous time signals since&#xA; $e^{j2\pi t}$ can possibly be different from $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning periodicity, in the discrete time case, the fundamental period $N$ is always an integer equal to $\frac{k}{F}$ where $k$ is an integer, meaning that $N$ is not necessarily equal to $\frac{1}{F}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the continuous case, this is not true since $T = \frac{1}{F}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Am I correct about this two differences? If this is not the case, please&#xA;explain it to me better.&lt;/li&gt;&#xA;&lt;li&gt;Are these two the more important to take into account, or am I&#xA;missing something (else) big?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3793" LastEditorUserId="80" LastEditDate="2013-05-11T17:03:44.257" LastActivityDate="2014-02-20T16:40:11.757" Title="Main differences to take into account between continuous and discrete time signals" Tags="|discrete-signals|signal-analysis|continuous-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9086" PostTypeId="2" ParentId="9083" CreationDate="2013-05-11T02:04:32.927" Score="2" Body="&lt;p&gt;You could certainly write some software to do this, and leverage &lt;a href=&quot;http://www.graphicsmagick.org/&quot; rel=&quot;nofollow&quot;&gt;graphicsmagick&lt;/a&gt;.  Not familiar with photoshop but you could probably write a filter to do it as well.  It may be challenging to get a satisfactory result though because your contrast delta in some areas of the image might end up different than the deltas in another area, due to a snowball effect of adjusting contrast on a per pixel basis.  It might be more wise to break the image up into successively smaller chunks, adjusting contrast of each chunk at each stage in order to maintain a greater consistency overall.  The level adjustment algorithm would be the same for each stage, but you would adjust &lt;em&gt;all&lt;/em&gt; the pixels in each chunk at once.  Just an exemplary thought.&lt;/p&gt;&#xA;" OwnerUserId="4535" LastActivityDate="2013-05-11T02:04:32.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9087" PostTypeId="2" ParentId="9083" CreationDate="2013-05-11T02:41:30.270" Score="6" Body="&lt;p&gt;By per-pixel I assume that you mean only the surrounding pixels should influence the pixel value. Unfortunately changing the pixel value in response to one adjacent pixel means the contrast with the others could also change. Kind of like a 'chain reaction' of changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, saw we had $I = [0,7,11]$ and we wanted a maximum contrast of 5. Going from the left we change 7 to 5, which then requires 11 to be changed to 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Maximum Contrast&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way per pixel maximum contrast can be done is by using &lt;a href=&quot;http://en.wikipedia.org/wiki/Mathematical_morphology&quot;&gt;morphological operators&lt;/a&gt;. Specifically, performing a dilation (or erosion) with a pyramid structuring element based on the maximum contrast value, $c$. For dilation, the structuring element is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;... ... ... ... ... ... ... ... ...&#xA;... -3c -3c -3c -3c -3c -3c -3c ...&#xA;... -3c -2c -2c -2c -2c -2c -3c ... &#xA;... -3c -2c -1c -1c -1c -2c -3c ... &#xA;... -3c -2c -1c   0 -1c -2c -3c ...&#xA;... -3c -2c -1c -1c -1c -2c -3c ... &#xA;... -3c -2c -2c -2c -2c -2c -3c ...&#xA;... -3c -3c -3c -3c -3c -3c -3c ...&#xA;... ... ... ... ... ... ... ... ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The size of the structuring element will depend on $c$ and the range of pixel values. Assuming pixel values are in [0,255], size will be N x N pixels where N = 2*floor(255/c) + 1, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = 100&#xA;&#xA;-200 -200 -200 -200 -200&#xA;-200 -100 -100 -100 -200&#xA;-200 -100    0 -100 -200&#xA;-200 -100 -100 -100 -200&#xA;-200 -200 -200 -200 -200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Dilation increases pixel values to enforce the maximum contrast, erosion decreases pixel values. In out example above, dilation would give $I = [2,7,11]$, erosion would give $I = [0,5,10]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Minimum Contrast&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enforcing a minimum contrast is not going to give you good results. Imagine having a minimum contrast in a flat area, it will turn it into a ramp. For this operation it is better to look at filters that enhance edges etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MATLAB code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB code to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;clear all;&#xA;    close all;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Test image&#xA;I = randi(256,10,10)-1;&#xA;imagesc(I); colorbar; title('test image'); pause;&#xA;&#xA;% Constrast settings&#xA;c = 10;&#xA;maxPixelValue = 255;&#xA;&#xA;% Structuring element&#xA;halfN = floor(maxPixelValue/c);&#xA;N = 2*halfN + 1;&#xA;[x,y] = ndgrid(-halfN:halfN);&#xA;stDH(:,:,1) = abs(x) * -c;&#xA;stDH(:,:,2) = abs(y) * -c;&#xA;stDH = min(stDH,[],3);&#xA;stD = strel('arbitrary',ones(N),stDH);&#xA;stE = strel('arbitrary',ones(N),stDH);&#xA;imagesc(stDH); colorbar; title('structuring element'); pause;&#xA;&#xA;% Dilation result&#xA;Id_max = imdilate(I,stD);&#xA;imagesc(Id_max); colorbar; title('max contrast (dilation)'); pause;&#xA;imagesc(I-Id_max); colorbar; title('diff with original'); pause;&#xA;&#xA;% Erosion result&#xA;Ie_max = imerode(I,stE);&#xA;imagesc(Ie_max); colorbar; title('max contrast (erosion)'); pause;&#xA;imagesc(I-Ie_max); colorbar; title('diff with original'); pause;&#xA;&#xA;%% Min contrast&#xA;stD = strel('arbitrary',ones(N),-stDH);&#xA;stE = strel('arbitrary',ones(N),-stDH);&#xA;&#xA;% Dilation result&#xA;Id_max = imdilate(I,stD);&#xA;imagesc(Id_max); colorbar; title('min contrast (dilation)'); pause;&#xA;imagesc(I-Id_max); colorbar; title('diff with original'); pause;&#xA;&#xA;% Erosion result&#xA;Ie_max = imerode(I,stE);&#xA;imagesc(Ie_max); colorbar; title('min contrast (erosion)'); pause;&#xA;imagesc(I-Ie_max); colorbar; title('diff with original'); pause;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-11T02:41:30.270" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9088" PostTypeId="2" ParentId="9085" CreationDate="2013-05-11T04:12:19.653" Score="4" Body="&lt;p&gt;In general I'd say that you understand the differences pretty well.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You nailed the first difference- continuous time vs. discrete time (samples).&lt;/li&gt;&#xA;&lt;li&gt;You were also correct about there being sets of indistinguishable frequencies in the discrete realm.  A corollary of this is that all discrete signals are band-limited, whereas continuous signals do not have to be.  This concept is most often referred to as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow&quot;&gt;Nyquist frequency&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I don't entirely agree with your point about periodicity, though I believe I understand what you're getting at.  If by periodicity you mean having the exact same values repeated, then yes, a discrete period would have to be an integer number of samples.  On the other hand, if you take periodic to mean that the &quot;underlying&quot; signal repeats, then it is possible to have the samples not be the exact same if the period is not an integer multiple of samples.  You could still detect the periodicity with an autocorrelation though.  Anyway, if this point is confusing, don't worry about it- it's not terribly important.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It is, by the way, possible to view discrete signals as a special case of continuous signals.  You can model discrete signals as continuous signals that have been multiplied by an infinite set of evenly spaced delta functions.  If the delta functions are separated by $T_s$ seconds, then in the frequency domain they can be represented by another set of delta functions that are separated by $\frac{1}{T_s}$ Hz.  The multiplication in the time domain is equivalent to convolution in the frequency domain, so copies of the signal are reproduced in the frequency domain at each of the delta functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though the mathematicians in the audience will probably scream at me for saying this, I think that you can likewise look at continuous signals as a special case of discrete signals, where we take the limit of $T_s$ as it approaches zero.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-05-11T04:12:19.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9089" PostTypeId="2" ParentId="9083" CreationDate="2013-05-11T16:03:04.607" Score="2" Body="&lt;p&gt;It is possible to work directly in &quot;contrast domain&quot; of an image, fiddling with local contrast values and then finding image whose contrast domain best matches the adjusted one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see R. Mantiuk, K. Myszkowski: &lt;em&gt;&quot;A Perceptual Framework for Contrast Processing of High Dynamic Range Images&quot;&lt;/em&gt;:&#xA;&lt;a href=&quot;http://www.mpi-inf.mpg.de/~mantiuk/contrast_domain/&quot; rel=&quot;nofollow&quot;&gt;http://www.mpi-inf.mpg.de/~mantiuk/contrast_domain/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, it depends on how you define the contrast. The one used in above paper is differences in neighboring pixels (this works the similar way as gradient domain processing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest definition is just color contrast, which can be adjusted using traditional filters (e.g. converting each color channel to $&amp;lt;-1,1&amp;gt;$ and then multiplying the value by a contrast factor $c$, clamp back to $&amp;lt;-1,1&amp;gt;$ and convert back to $&amp;lt;0,255&amp;gt;$ or whatever scale you use. The contrast is increased for $c&amp;gt;1$ and decreased for $0&amp;gt;c&amp;gt;1$.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-05-11T16:03:04.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9090" PostTypeId="2" ParentId="9085" CreationDate="2013-05-11T16:59:28.210" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/9088/80&quot;&gt;Jim Clay's answer&lt;/a&gt; is a good one, but I thought I'd expand a little on point 3 about periodicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal, $x\{s\}$, is said to be &lt;strong&gt;periodic&lt;/strong&gt; with period $P$ if&#xA;$$&#xA;x\{s\} = x\{s + P\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;strong&gt;continuous-time&lt;/strong&gt; case, $s = t \in \mathbb{R} $ (real numbers) and we get:&#xA;$$&#xA;x(t) = x(t + P)&#xA;$$&#xA;with $P \in \mathbb{R}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;strong&gt;discrete-time&lt;/strong&gt; case, $s = n \in \mathbb{Z}$ (integers) and we get&#xA;$$&#xA;x[n] = x[n + P].&#xA;$$&#xA;Because $x[t]$ with $t\in \mathbb{R}$ makes no sense for $t$ not also an integer, we must have the condition $P \in \mathbb{Z}$ here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that's what you mean when you say &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\ldots N$ is not necessarily equal to $\frac{1}{f}$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;because, in the discrete-time case &quot;periodicity&quot; is a much more strict condition (periodic with a period that is an integer number of samples long).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-05-11T16:59:28.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9091" PostTypeId="2" ParentId="1871" CreationDate="2013-05-11T19:00:51.843" Score="6" Body="&lt;p&gt;Even though I realize that this is a very late response, I will nevertheless try to answer this question because I find it instructive and also because the number of upvotes suggests that this question is of general interest to the community.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As already suggested in the question, let's define two signals $x(t)$ and $w(t)$ as&#xA;$$x(t)=e^{-kt}u(t),\quad k&amp;gt;0\\w(t)=\frac{\sin(\pi t/10)}{\pi t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible interpretation of the convolution $(x*w)(t)$ is that an exponentially damped signal $x(t)$ is filtered by an ideal lowpass filter with impulse response $w(t)$. In the question it was also correctly pointed out that convolution in the time domain corresponds to multiplication in the frequency domain. The Fourier integral of $x(t)$ can be easily computed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(j\omega)=\int_{0}^{\infty}e^{-kt}e^{-j\omega t}dt = \frac{1}{k+j\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of $w(t)$ should be familiar because it is an ideal lowpass filter. In the question there was some confusion concerning the definition of the Sinc function. I suggest to simply remember the impulse response of a unity gain lowpass filter with cut-off frequency $\omega_0=2\pi f_0$ without making use of any of the definitions of the Sinc function:&#xA;$$h_{LP}(t)=\frac{\sin \omega_0 t}{\pi t}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing (1) with the definition of $w(t)$, we see that $w(t)$ is simply a unity gain lowpass filter with cut-off frequency $\omega_0=\pi/10$:&#xA;$$W(j\omega)=u(\omega+\omega_0)-u(\omega-\omega_0)$$ where I've used the step function $u(\omega)$ in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to find the time function $y(t)=(x*w)(t)$ one can compute the inverse Fourier transformation of $Y(j\omega)=X(j\omega)W(j\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty}X(j\omega)W(j\omega)e^{j\omega t}d\omega=&#xA;\frac{1}{2\pi}\int_{-\omega_0}^{\omega_0}\frac{1}{k+j\omega}e^{j\omega t}d\omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, there is no closed form solution of this integral using elementary functions. It can be evaluated numerically using the exponential integral $\text{Ei}(x)$, or, alternatively, the sine and cosine integrals $\text{Si}(x)$ and $\text{Ci}(x)$. So I don't think that the purpose of the exercise was to actually compute the convolution, but its purpose was probably to come up with a qualitative description of what is going on (exponential signal filtered by an ideal lowpass filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, I thought it would be instructive to take a look at the signal $y(t)$, so I evaluated it numerically for the parameters $k=0.05$ and $\omega_0=\pi/10$. The following figure shows the result:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/dwtDF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The green curve is the input signal $x(t)$ and the blue curve is the filtered signal $y(t)$. Note the (non-causal) ripples of $y(t)$ for $t&amp;lt;0$ caused by the ideal (non-causal) lowpass filter. If we increase the cut-off frequency of the lowpass filter, the distortion of the input signal should become smaller. This is shown in the next figure where I've increased the cut-off frequency by a factor of 10, i.e. $\omega_0=\pi$ (instead of $\pi/10$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QTJrP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-11T22:03:50.643" LastActivityDate="2013-05-11T22:03:50.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9092" PostTypeId="2" ParentId="1637" CreationDate="2013-05-11T19:20:16.330" Score="42" Body="&lt;p&gt;I think this was put very well in the well known &quot;DSP guide&quot; (&lt;a href=&quot;http://www.dspguide.com/ch24/5.htm&quot; rel=&quot;noreferrer&quot;&gt;chapter 24, section 5&lt;/a&gt;): &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Fourier analysis is used in image processing in much the same way as with&#xA;  one-dimensional signals. However, images do not have their information&#xA;  encoded in the frequency domain, making the techniques much less useful. For&#xA;  example, when the Fourier transform is taken of an audio signal, the confusing&#xA;  time domain waveform is converted into an easy to understand frequency spectrum. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In comparison, taking the Fourier transform of an image converts the straightforward information in the spatial domain into a scrambled form in&#xA;  the frequency domain. In short, don't expect the Fourier transform to help you&#xA;  understand the information encoded in images.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So there is, of course, some structure and meaning behind the seemingly random pattern obtained by taking the DFT of a typical image (such as the example below), but it is not in a form that the human brain is prepared to understand intuitively, at least regarding visual perception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FSeRl.png&quot; alt=&quot;Imgur&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://wayback.archive.org/web/20130513181427id_/http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering&quot; rel=&quot;noreferrer&quot;&gt;Here&lt;/a&gt; is another interesting and quite readable exposition of what is contained in a Fourier transform of an image, and how it can be interpreted. It has a series of images that make it quite clear what the correspondence is between the Fourier-transformed and the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit:&lt;/strong&gt; take also a look at &lt;a href=&quot;http://matlabgeeks.com/tips-tutorials/how-to-do-a-2-d-fourier-transform-in-matlab/&quot; rel=&quot;noreferrer&quot;&gt;this page&lt;/a&gt;, which demonstrates —near the end— how most of the perceptually important information of an image is stored in the phase (angle) component of the frequency representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit 2:&lt;/strong&gt; another example of the meaning of phase and magnitude in the Fourier representation: &quot;Section 3.4.1, Importance of phase and magnitude&quot; of TU Delft's textbook &quot;&lt;a href=&quot;http://www.tnw.tudelft.nl/fileadmin/Faculteit/TNW/Over_de_faculteit/Afdelingen/Imaging_Science_and_Technology/Research/Research_Groups/Quantitative_Imaging/Education/doc/FIP2_3.pdf&quot; rel=&quot;noreferrer&quot;&gt;Fundamentals of Image Processing&lt;/a&gt;&quot; demonstrates this quite clearly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0LM2C.png&quot; alt=&quot;Imgur&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4399" LastEditorUserId="4399" LastEditDate="2015-04-19T23:49:47.723" LastActivityDate="2015-04-19T23:49:47.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9093" PostTypeId="2" ParentId="9066" CreationDate="2013-05-11T22:55:53.673" Score="2" Body="&lt;p&gt;What finally worked for me:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the DTW between the MFCC vectors of each of the training samples.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Classify in pairs (i.e. check if the word $w$ is in &lt;i&gt;{class1, class2}&lt;/i&gt;. If the decision is &lt;i&gt;class1&lt;/i&gt;, then $w\notin$&lt;i&gt;class2&lt;/i&gt;. Then check &lt;i&gt;{class1, class3}&lt;/i&gt;, etc...).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate for each word $w$ and pair of classes &lt;i&gt;{class1, class2}&lt;/i&gt; a 2D feature vector, $p$, as follows: $p_i$ = mean of the DTW between $w$ and all the training words of &lt;i&gt;class-i&lt;/i&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now I generated the feature vectors for every word of the training set (and for every class-pair), and used them to train $n \choose 2$ SVM classifiers ($n$ - number of different classes).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For the classification, we need to make $n$ tests (to rule out $n-1$ classes).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;More words in the dictionary $\Rightarrow$ the method will allow less &quot;difference&quot; between the original words (training data) and the input. e.g. users will encounter more wrong-classifications.&lt;/li&gt;&#xA;&lt;li&gt;When using with a few words (2 words in my case), it works surprisingly well, and almost has no mistakes (even when users are trying to mislead it).&lt;/li&gt;&#xA;&lt;li&gt;Using less than 10 samples will probably work (i'd recommend at least 2, though). I believe that for a bigger dictionary you should use more training data (not tested this).&lt;/li&gt;&#xA;&lt;li&gt;Noise filtering is a must - when recording with or without a fan near me, it really moved the feature vectors in space, and made a few mistakes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4529" LastActivityDate="2013-05-11T22:55:53.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9094" PostTypeId="1" AcceptedAnswerId="9389" CreationDate="2013-05-12T02:52:53.490" Score="38" ViewCount="76511" Body="&lt;p&gt;I have a question about matched filtering.  Does the matched filter maximise the SNR at the moment of decision only?  As far as I understand, if you put, say, NRZ through a matched filter, the SNR will be maximised at the decision point only and that is the advantage of the matched filter.  Does it maximise the SNR anywhere else in the output function, or just at the point of decision?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Wikipedia&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The matched filter is the optimal linear filter for maximizing the signal to noise ratio (SNR) in the presence of additive stochastic noise&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This to me implies that it maximises it everywhere, but I don't see how that is possible.  I've looked at the maths in my communications engineering textbooks, and from what I can tell, it's just at the decision point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question I have is, why not make a filter that makes a really tall skinny spike at the point of decision.  Wouldn't that make the SNR even better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;I guess what I'm also thinking is, say you have a some NRZ data and you use a matched filter, the matched filter could be implemented with an I&amp;amp;D (integrate and dump).  The I&amp;amp;D will basically ramp up until it gets to the sampling time and the idea is that one samples at the peak of the I&amp;amp;D because at that point, the SNR is a maximum.  What I don't get is, why not create a filter that double integrates it or something like that, that way, you'd have a squared increase (rather than a ramp) and the point at which you sample would be even higher up and from what I can tell, more likely to be interpreted correctly by the decision circuit (and give a lower Pe (probability of error))?&lt;/p&gt;&#xA;" OwnerUserId="1146" LastEditorUserId="128" LastEditDate="2018-07-06T20:49:10.427" LastActivityDate="2021-10-11T14:57:26.087" Title="Understanding the Matched Filter" Tags="|filters|digital-communications|matched-filter|" AnswerCount="7" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9095" PostTypeId="2" ParentId="7704" CreationDate="2013-05-12T03:04:54.883" Score="2" Body="&lt;p&gt;3D is a bit out of my depth.  If it were 2D I'd choose pixel aspect ratios in the rotated image such that the ratio of sampling rates is approximately equal to the rate at which you are intersecting scan lines in the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm making this up as I go along, so let me work an example first:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose my pixels are 16 units wide and 1 unit high.  No matter how much I rotate I'd like the resulting pixels to have an area of about 16 units squared.  If I rotate by $\pi/2$, I'd like my new pixels 1x16.  If I rotate by $\pi/4$, I'd like my new pixels to be 4x4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So more generally, given an initial image with horizontal pixel width $x_0$ and vertical pixel height $y_0$, and a rotation of angle $0 \le\theta\le\pi/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/86V4L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My new horizontal scan lines are going to intersect the vertical scan lines from the original image at a rate of $\frac{1}{x_0}\cos\theta$ per unit length and intersect the horizontal scan lines from the original image at a rate of $\frac{1}{y_0}\sin\theta$ per unit length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, my new vertical scan lines are going to intersect the original horizontal scan lines at a rate of $\frac{1}{y_0}\cos\theta$ and the original vertical scan lines at a rate of $\frac{1}{x_0}\sin\theta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'd like my aspect ratio to be&#xA;$$&#xA;\frac{x_\theta}{y_\theta} = \frac{x_0 \cos\theta + y_0\sin\theta}{y_0\cos\theta + x_0\sin\theta}&#xA;$$&#xA;and my new pixel area to be&#xA;$$&#xA;x_\theta y_\theta = x_0 y_0.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea how to best deal with the round-off errors, since you probably need the aspect ratios to be rational and the pixel areas to be integers.  Also note that I haven't proved anything, just come up with some formulas for aspect ratio that match intuition at $\theta = 0$, $\theta = \pi/2$, and $\theta=\pi/4$.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-05-12T03:04:54.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9096" PostTypeId="2" ParentId="9094" CreationDate="2013-05-12T03:46:57.663" Score="5" Body="&lt;p&gt;You are right: A matched filter will maximize SNR at the instant of decision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that your proposal of a tall spike &quot;filter&quot; is not a filter, but actually a sampler (the sampler used at the decision point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matched filter is a filter (i.e. linear time-invariant system) applied to the continuous input signal. The &quot;spike at the point of decision&quot; is very time-dependant (it is not a filter but a sampler).&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2013-05-12T03:46:57.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9097" PostTypeId="1" AcceptedAnswerId="9103" CreationDate="2013-05-12T09:51:28.263" Score="2" ViewCount="1691" Body="&lt;p&gt;I have a question concerning BPSK and the bandpass filter that seems to be sometimes placed before the receiver circuit (the receiver is a mixer and lowpass filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, from what I've noticed, there is sometimes a bandpass filter before the receiver of BPSK (and other types of receivers too I think).  Is the only purpose of this bandpass filter to band limit the signal and basically just improve the carrier to noise ratio?  It doesn't actually need to be there does it?  It's optional right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1146" LastActivityDate="2013-05-12T22:23:48.577" Title="Bandpass filter BPSK" Tags="|digital-communications|modulation|bandpass|bpsk|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9098" PostTypeId="1" AcceptedAnswerId="9100" CreationDate="2013-05-12T11:20:32.977" Score="2" ViewCount="1511" Body="&lt;p&gt;I'm trying to find out why digital systems are stable iff poles oh their transfer function are inside the unit circle (or are there any others conditions?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand analogous systems are stable iff all poles of their transfer function are negative 'cause of inverse Laplace transform, where $\mathcal{L}^{-1} \left \{ \frac {1}{s+a} \right \} = e^{-at} \cdot \mathcal{1} (t) $. (by the $\mathcal{1} (t)$ i mean heaviside function). Is that right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how to derive conditions for stability of discrete system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What others ways for derivating stability of discrete and continuous systems exist?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="4158" LastEditDate="2013-05-12T14:58:48.327" LastActivityDate="2013-05-12T19:12:04.197" Title="How to derive stability of analogue and digital systems" Tags="|discrete-signals|continuous-signals|z-transform|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9099" PostTypeId="1" CreationDate="2013-05-12T11:33:45.830" Score="10" ViewCount="2696" Body="&lt;p&gt;I've been sent here from &lt;strong&gt;&lt;a href=&quot;https://stackoverflow.com/questions/16498421/detecting-a-filled-glass-object-in-opencv&quot;&gt;this question in stackoverflow&lt;/a&gt;&lt;/strong&gt;, please excuse me if the question comes too specific and it's not in the manners in here:)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The task&lt;/strong&gt; is to find a glass with specific liquid in it. Let me show you the pictures and then describe what i'm trying to achieve and how i was trying to achieve so far in the description below the pictures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The pictures&lt;/strong&gt;: (seems i need at least 10 reputation to post pictures and links, so links will have to do :( otherwise you can look at the stack overflow question)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/H4lv4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/miXnZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kzxMA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Djy5G.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A detailed description&lt;/strong&gt;:&#xA;I was trying to implement an algorithm that would detect a glass of a specific shape in opencv (glass may be transformed by a different camera shot angle/distance). There will be also other glasses of other shapes. The glass i'm searching for will also be filled with some colored liquid that will distinguish it from glasses containing other colors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, i have tried using SIFT feature extractor to try to find some features in the glass and then match them with other photos with the glass in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach worked only in very specific conditions where i would have glass in a very specific position and the background would be similar to the learning images. The problem also is that the glass is a 3d object and i don't know how to extract features from that (maybe multiple photos from different angles linked-somehow?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now i don't know what other approach could i use. I have found some clues on this (here &lt;a href=&quot;https://stackoverflow.com/questions/10168686/algorithm-improvement-for-coca-cola-can-shape-recognition#answer-10219338&quot;&gt;https://stackoverflow.com/questions/10168686/algorithm-improvement-for-coca-cola-can-shape-recognition#answer-10219338&lt;/a&gt; ) but the links seem to be broken. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem would be to detect different &quot;levels of emptiness&quot; in such glass, but i haven't even been able to find the glass itself properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be your recommendations on the approach in this task? Would it be better to use a different way to find the local 3d object feature? Or would it be better to use other approach altogether? I have heard about algorithms &quot;learning&quot; the object from a set of multiple photos but i have never seen this in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Any&lt;/strong&gt; advice would be really appreciated &lt;/p&gt;&#xA;" OwnerUserId="4540" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2016-02-14T14:56:46.913" Title="Detecting a filled glass object" Tags="|image-processing|opencv|object-recognition|sift|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9100" PostTypeId="2" ParentId="9098" CreationDate="2013-05-12T12:19:48.847" Score="3" Body="&lt;p&gt;In the discrete-time case you can use the $\mathcal{Z}$-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{Z}\{x(n)\}=X(z)=\sum_{n=0}^{\infty}x(n)z^{-n}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (1) is the unilateral $\mathcal{Z}$-transform which is useful for causal signals which are zero for $n&amp;lt;0$. Now consider the signal $x(n)=a^n$, $n\ge 0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\sum_{n=0}^{\infty}a^nz^{-n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This series converges for $|a|&amp;lt;1$ and in this case $X(z)$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{1}{1-az^{-1}}=\frac{z}{z-a}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (2) you can see that $a$ is the pole of $X(z)$, and for $x(n)$ to be stable (if seen as a system's impulse response), and for $X(z)$ to exist, $|a|&amp;lt;1$ must hold, i.e. the pole must be inside the unit circle of the complex $z$-plane. This example is analogous to the continuous-time example in your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also take a look at the concept of &lt;a href=&quot;http://en.wikipedia.org/wiki/BIBO_stability&quot; rel=&quot;nofollow&quot;&gt;BIBO-stability&lt;/a&gt; (bounded-input-bounded-output stability), which leads to the same conclusion: for continuous time signals/systems the poles must be in the strict left half of the $s$-plane, and for discrete-time signals/systems the poles must be strictly inside the unit circle of the $z$-plane. The condition on the time-domain signals is that they be absolutely integrable in the continuous case, and absolutely summable in the discrete-time case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}|x(t)|dt &amp;lt;\infty\\&#xA;\sum_{n=-\infty}^{\infty}|x(n)| &amp;lt;\infty$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-12T19:12:04.197" LastActivityDate="2013-05-12T19:12:04.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9101" PostTypeId="2" ParentId="9097" CreationDate="2013-05-12T13:39:17.183" Score="8" Body="&lt;p&gt;The filter that you're referring to is called a &lt;em&gt;preselection&lt;/em&gt; filter. Its purpose is to filter out everything but the desired signal of interest before mixing to baseband. Unwanted components could include other signals that are nearby in frequency, or just noise that lies outside the desired signal's bandwidth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preselection can serve multiple purposes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It is common to have a low-noise analog amplifier in your receiver chain to reduce the receiver's overall noise figure. Bandlimiting the input of the amplifier using a preselector can result in improved amplifier performance in some cases, especially those where there are strong interfering signals in nearby bands. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In cases where bandpass sampling is used (i.e. the desired signal is sampled directly at its nonzero intermediate frequency), a bandpass filter will typically be required in order to remove other signal or noise components that would otherwise alias into the sampled signal bandwidth. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Whether the filter is optional or not would be application-dependent. &lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-05-12T22:23:48.577" LastActivityDate="2013-05-12T22:23:48.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9102" PostTypeId="2" ParentId="9094" CreationDate="2013-05-12T14:04:25.200" Score="3" Body="&lt;p&gt;The matched filter is the maximum-likelihood receiver in the presence of additive white Gaussian noise. Thus, for equal prior symbol probabilities, it will yield optimum bit-error performance. This is equivalent on the AWGN channel to maximizing the signal-to-noise ratio, as you pointed out. You also correctly pointed out that this maximum-SNR condition is at the decision instant for each symbol. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The misconception in your proposal is that you can't do any better than the matched-filter approach on the AWGN channel. The output of the filter for time instants other than the decision point is irrelevant for bit-error performance. In a practical sense, it can be easier to obtain symbol-timing synchronization if the matched-filter output (i.e. the shape of the autocorrelation of the signal's pulse shape) has an impulse-like shape. In fact, some real communication techniques (like direct sequence spread spectrum modulation) have this property. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming perfect synchronization, however, which is the typical case when analyzing bit-error rates, the performance that is attained is unrelated to the shape of the matched filter's output; all that matters is the total energy in the pulse, which determines the value of the matched filter's output at the decision point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, it can be very difficult to design a different filter that would have the specific time-domain response that you want. Such a process is known as deconvolution, and isn't easy. The double-filter approach that you suggest would actually have the opposite effect of smearing out the decision statistic even further (convolution inherently smears the signal out in time). You could perhaps devise some nonlinear filter that would give you a shape that you like more, but it isn't clear that it would retain the optimality of the matched filter approach. &lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-12T14:04:25.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9103" PostTypeId="2" ParentId="9097" CreationDate="2013-05-12T14:41:51.117" Score="4" Body="&lt;p&gt;The mixer/LPF filter that you describe as the receiver is typically one that is &lt;em&gt;designed&lt;/em&gt; (possibly for optimal performance e.g. matched filter) using a mathematical model that assumes its input is the desired signal plus noise (often AWGN) &lt;em&gt;and nothing else&lt;/em&gt;.&#xA;If &lt;em&gt;other&lt;/em&gt; signals are present, they are assumed to be&#xA;&lt;em&gt;orthogonal&lt;/em&gt; to the signal of interest (as in CDMA signaling)&#xA;and thus not interfering with the receiver operations. Such&#xA;assumptions are rarely valid in practice since the antenna picks up adjacent-channel&#xA;signals etc. as pointed out in JasonR's answer, and such signals are not necessarily&#xA;orthogonal to the desired signal. So the bandpass filter is needed to eliminate&#xA;such signals. If out-of-band interference is &lt;em&gt;guaranteed&lt;/em&gt; to be absent, then the&#xA;bandpass filter might not be needed; but paranoid designers who don't trust&#xA;such guarantees and suspect that the customer will come right back and&#xA;complain that the receiver does not work as certified (usually because of&#xA;out-of-band interference that the customer (who is always right) never &#xA;told them about) will include the&#xA;bandpass filter right from the start to avoid re-doing the work.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-05-12T14:41:51.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9104" PostTypeId="1" CreationDate="2013-05-12T15:48:41.050" Score="2" ViewCount="1594" Body="&lt;p&gt;I have as a homework to determine the line rate and frame rate for a system described above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Heigh of monitor:             40cm&#xA;Screen Aspect Ratio:          16:9&#xA;Pixel Aspect Ratio:           4:3&#xA;Progressive scan&#xA;Viewing distance from screen: 0.6m&#xA;Active line period:           15μs &#xA;Horizontal Blanking:          5μs &#xA;Vertical blanking lines:      20&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I search for the definitions in order to understand the system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Line rate&lt;/strong&gt;: It indicates the actual speed with which the bits are sent onto the wire&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Frame rate&lt;/strong&gt;: frequency at which an imaging device produces unique images(frames)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Progressive video&lt;/strong&gt;: is the method by which all lines (whole frame) are captured at the same instant, representing a single moment in time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;screen aspect ratio&lt;/strong&gt; is width divided by height, and the same for the &lt;strong&gt;pixel aspect ratio&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Horizontal blanking interval&lt;/strong&gt; refers to a part of the process of displaying images on a computer monitor or television screen via raster scanning. CRT screens display images by moving beams of electrons very quickly across the screen. Once the beam of the monitor has reached the edge of the screen, the beam is switched off, and the deflection circuit voltages (or currents) are returned to the values they had for the other edge of the screen; this would have the effect of retracing the screen in the opposite direction, so the beam is turned off during this time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Vertical blanking interval&lt;/strong&gt; is an interval of time between the last line of a given frame and the beginning of the next frame, during which the incoming data stream is not displayed on a CRT  screen. It is the time interval allowed for the analog TV electron gun beam to move from the bottom of the current frame to the top of the next one as it scans images. This requires the last 45 lines of each 525-line frame.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ycVkM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that i cant find a proper way to calculate the line rate or frame rate from the above. I didn't find any equation or a guide. Can someone help me or point me a tutorial? I assume that the line rate has something to do with the horizontal blanking and vertical blanking because the electrons that need to provide through the wire, but still i need an equation.&lt;/p&gt;&#xA;" OwnerUserId="4273" LastActivityDate="2015-11-08T15:42:46.870" Title="Determine line rate and frame rate of a system" Tags="|image-processing|homework|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9105" PostTypeId="2" ParentId="9099" CreationDate="2013-05-12T16:32:12.137" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://www-cvr.ai.uiuc.edu/ponce_grp/publication/paper/cvpr06a.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The paper referenced in your link seems to be this one.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of particular interest there is Table 1 (included below). The accuracy rates aren't great, though they are better than other approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i039z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-05-12T16:32:12.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9107" PostTypeId="1" CreationDate="2013-05-13T22:49:27.480" Score="1" ViewCount="213" Body="&lt;p&gt;I would like to ask, cuz I don't know much from that, how we can find the BER at a GSM network (uplink &amp;amp; downlink separately of course), while we are using FSK modulation? I mean the equations precisely, cuz I searched the Internet and there's nothing clear. Most cases where about MFSK, QFSK etc., but not specific for FSK.&lt;/p&gt;&#xA;" OwnerUserId="4552" LastEditorUserId="4552" LastEditDate="2013-05-13T23:27:24.800" LastActivityDate="2013-05-24T10:24:10.937" Title="Finding BER, using FSK at GSM network" Tags="|fsk|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9108" PostTypeId="1" CreationDate="2013-05-13T03:19:54.557" Score="1" ViewCount="171" Body="&lt;p&gt;I've been trying to do some research on audio watermarking and what i wanted is to insert string into audio file in the transform domain (DWT), i've read some literature of DWT especially HAAR transform and try to implement it. So far i can embedd and extract watermark from the audio which is wav file beacuse i following &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDAQFjAA&amp;amp;url=http://in3.uoc.edu/opencms_in3/export/sites/in3/webs/grups_de_recerca/Kison/_resources/documents/J1.pdf&amp;amp;ei=T1eQUdHaG8b3rQfS-oGoCQ&amp;amp;usg=AFQjCNEV4Pa8T7wZgCu1PT_x0WGhjQCu3Q&amp;amp;sig2=RK-hUv8ONk8zOiuFRIijJA&amp;amp;bvm=bv.46340616,d.bmk&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; literature but apperently it is not lossless watermarking as i try to implement it. What i want to know is from your logical view is that literature really give a lossless method because it said that they got the analisis which mention it supposed to be lossless &lt;strong&gt;(BER equal to zero or near zero)&lt;/strong&gt; when attacked. Or maybe i'm the one who implement it wrong, my analisis give me result that the proposed method is not lossless(sometime the result is wrong). If there is any embedding method that support haar and which is lossless, because i hardly find the literature that exactly pointing out audio watermarking (that insert some text to audio).If anyone know any lossless embedding method in transform domain please help me?&lt;/p&gt;&#xA;" OwnerUserId="4680" OwnerDisplayName="Wawan Ma-chun" LastActivityDate="2013-05-13T22:53:53.560" Title="Are there any lossless embedding algorithm to support Haar(DWT) in audio watermarking?" Tags="|algorithms|wavelet|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9109" PostTypeId="1" AcceptedAnswerId="9115" CreationDate="2013-05-14T03:28:38.293" Score="1" ViewCount="199" Body="&lt;p&gt;I have these values,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;m2 = 1 -1 -1 1&#xA;w2 =-1 -1 1 1    -1 -1 1 1    -1 -1 1 1    -1 -1 1 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im about to multiply m2 with w2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should i multiply m2 with all of w2&#xA;(1 * -1 -1 1 1    -1 -1 1 1    -1 -1 1 1    -1 -1 1 1)&#xA;(-1 * -1 -1 1 1    -1 -1 1 1    -1 -1 1 1    -1 -1 1 1)&#xA;(-1 * -1 -1 1 1    -1 -1 1 1    -1 -1 1 1    -1 -1 1 1)&#xA;(1 * -1 -1 1 1    -1 -1 1 1    -1 -1 1 1    -1 -1 1 1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do it one by one,&#xA;(1 * -1 -1 1 1)&#xA;(-1 * -1 -1 1 1),&#xA;...&#xA;..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one is correct?&lt;/p&gt;&#xA;" OwnerUserId="4553" LastActivityDate="2013-05-14T13:27:22.397" Title="CDMA : Calculating M from m1 * w1, m2*w2, etc M as Walsh Code, M as Orthogonal COde" Tags="|frequency-spectrum|convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9110" PostTypeId="1" AcceptedAnswerId="9116" CreationDate="2013-05-14T04:34:55.997" Score="8" ViewCount="2140" Body="&lt;p&gt;I'm an electronics engineering student with high inclination to analysis and pure mathematics.  I was just wondering if there was any book ( or any resource ) that treats signal and systems and signal processing with a lot of mathematics rigour ( actually doing proper complex analysis, using functional analysis and linear algebra rigorously to explain convolution, fourier, laplace and z transforms for example ).     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm very disapointed with the books i've read ( Oppenhein, Lathi and related ) because it actually throws a lot of the beauty of analysis and algebra away, focusing on the computational side.     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot&lt;/p&gt;&#xA;" OwnerUserId="4370" LastEditorUserId="128" LastEditDate="2019-11-27T21:47:46.430" LastActivityDate="2019-11-27T21:47:46.430" Title="Mathematically Inclined Signal and Systems / Signal Processing Book Recommendations" Tags="|discrete-signals|fourier-transform|continuous-signals|dsp-core|self-study|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9111" PostTypeId="2" ParentId="9110" CreationDate="2013-05-14T06:58:52.423" Score="5" Body="&lt;p&gt;You should take a look at &quot;Mathematical Methods and Algorithms for Signal Processing&quot; by Moon and Stirling. The only downside is its long list of errata, so hopefully there will be a new edition soon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A beautiful book about the Fourier transform as it's used in signal and system theory is &quot;The Fourier Integral and its Applications&quot; by Papoulis. It's quite old but I think it's an excellent book. It only treats continuous-time systems. You can find a pdf on the web.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested in filter banks and transforms you should check out Strang's &quot;Wavelets and Filter Banks&quot; and Vaidyanathan's &quot;Multirate Systems and Filter Banks&quot;. &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-14T06:58:52.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9113" PostTypeId="2" ParentId="9109" CreationDate="2013-05-14T09:50:50.027" Score="3" Body="&lt;p&gt;You could have given a bit more background and explanation in your question, but as far as I understand your question, $m2$ is your data and $w2$ is the spreading code. The spreading ratio is 4 because the length of the spreading sequence is four times the data length. So you have to stretch out your data by a factor of 4 to line it up with the spreading sequence. Then you can do the multiplication as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{rrrrrrrrrrrrrrrrr}m2: &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1&#xA;&amp;amp; -1 &amp;amp; -1 &amp;amp; -1 &amp;amp; -1 &amp;amp; -1 &amp;amp; -1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\&#xA;w2: &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 &amp;amp; 1&amp;amp; -1 &amp;amp; -1 &amp;amp; 1 &amp;amp; 1&amp;amp; -1 &amp;amp; -1 &amp;amp; 1 &amp;amp; 1&amp;amp; -1 &amp;amp; -1 &amp;amp; 1 &amp;amp; 1\\&#xA;\text{result}:&#xA;&amp;amp; -1 &amp;amp; -1 &amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;-1&amp;amp;-1&amp;amp;1&amp;amp;1&amp;amp;-1&amp;amp;-1&amp;amp;-1&amp;amp;-1&amp;amp;1&amp;amp;1\end{array}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-14T09:50:50.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9114" PostTypeId="2" ParentId="9099" CreationDate="2013-05-14T10:18:10.553" Score="-1" Body="&lt;p&gt;There has been much work done on this when it comes to facial recognition software. For example, if you notice on Facebook when tagging photos the location of the faces are boxed and suggested to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen a lot of literature on facial recognition in images using neural networks and a quick Google search will undoubtedly turn up a vast amount of information on the subject. These networks take the pixels of the image as inputs. In your case, the way the opacity changes/light reflects off the glass may be good identifying features that the network will learn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One problem may be the number of photos you have to use as training data and the pre-processing of these (i.e. identifying the faces yourself). If it is unfeasible to do this for enough images to train your network well enough then you will have to look for some shortcuts in the learning stage. This paper is relevant to what you want to do: &lt;a href=&quot;http://www.ll.mit.edu/publications/journal/pdf/vol04_no2/4.2.5.neuralnetwork.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ll.mit.edu/publications/journal/pdf/vol04_no2/4.2.5.neuralnetwork.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately this is a very active field and much of the code necessary for this type of problem is readily available online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you are able to identify the glasses in the images you can perform further analysis from there.&lt;/p&gt;&#xA;" OwnerUserId="4534" LastActivityDate="2013-05-14T10:18:10.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9115" PostTypeId="2" ParentId="9109" CreationDate="2013-05-14T11:46:06.123" Score="2" Body="&lt;p&gt;I agree with @MattL when he says that the OP could have given more detail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two different ways of interpreting what the OP has said, and the first,&#xA;which is the one chosen by Matt, is that the spreading code $w2$ is actually just &#xA;$$-1\ -1\ +1\ +1$$ and what is happening is that the spreading code or its complement is repeated $4$ times ($4$ being the length of the message $m2$), &#xA;with choice of whether $+w2$ or $-w2$ is used depending on whether the corresponding &quot;bit&quot;&#xA;in $m2$ is $+1$ or $-1$. In other words, the result is just&#xA;$$\begin{array}{cccc}m2=+1&amp;amp;m2=-1&amp;amp;m2=-1&amp;amp;m2=+1\\&#xA;\Downarrow&amp;amp;\Downarrow&amp;amp;\Downarrow&amp;amp;\Downarrow\\&#xA;+w2&amp;amp;-w2&amp;amp;-w2&amp;amp;+w2\\&#xA;\overbrace{-1\ -1\ +1\ +1}&#xA;&amp;amp;\overbrace{+1\ +1\ -1\ -1}&#xA;&amp;amp;\overbrace{+1\ +1\ -1\ -1}&#xA;&amp;amp;\overbrace{-1\ -1\ +1\ +1}&#xA;\end{array}$$&#xA;Also, no &lt;em&gt;multiplication&lt;/em&gt; is really necessary regardless of whether the&#xA;calculation is being done in software or hardware since the whole process&#xA;can be implemented using &lt;code&gt;if-then-else&lt;/code&gt; statements or multiplexers as the &#xA;case may be.&#xA;Finally, for &lt;em&gt;this&lt;/em&gt; particular $w2$, if &lt;em&gt;sketching&lt;/em&gt; the waveform&#xA;using rectangular NRZ pulses will show that the end result is really&#xA;just &lt;em&gt;Manchester coding&lt;/em&gt; of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;other&lt;/em&gt; interpretation is similar to what has been said above&#xA;except that $w2$ really is what the OP says it is, &lt;em&gt;viz.&lt;/em&gt;,&#xA;$$-1\ -1\ +1\ +1\ -1\ -1\ +1\ +1\ -1\ -1\ +1\ +1\ -1\ -1\ +1\ +1$$&#xA;and so that the spreading factor is $16$ and&#xA;each $\pm 1$ in $m2$ results in the $16$-symbol $\pm w2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\scriptscriptstyle{\begin{array}{cccc}m2=+1&amp;amp;m2=-1&amp;amp;m2=-1&amp;amp;m2=+1\\&#xA;\Downarrow&amp;amp;\Downarrow&amp;amp;\Downarrow&amp;amp;\Downarrow\\&#xA;+w2&amp;amp;-w2&amp;amp;-w2&amp;amp;+w2\\&#xA;\overbrace{-1\ -1\ +1\ +1\ -1\ -1\ +1\ +1\ -1\ -1\ +1\ +1\ -1\ -1\ +1\ +1}&#xA;&amp;amp;\overbrace{+1\ +1\ -1\ -1\ +1\ +1\ -1\ -1\ +1\ +1\ -1\ -1\ +1\ +1\ -1\ -1}&#xA;&amp;amp;\overbrace{+1\ +1\ \cdots\ -1\ -1}&#xA;&amp;amp;\overbrace{-1\ -1\ \cdots\ +1\ +1}&#xA;\end{array}}$$&#xA;The previous remarks about no multiplications being necessary are still&#xA;applicable, though the result is no longer just simple Manchester coding.&#xA;Note , however, that the &lt;em&gt;Sylvester construction&lt;/em&gt; of the $16\times 16$&#xA;Hadamard matrix $H_{16}$ gives&#xA;$$H_{16}=\left[\begin{matrix}&#xA;H_4&amp;amp;H_4&amp;amp;H_4&amp;amp;H_4\\&#xA;H_4&amp;amp;-H_4&amp;amp;H_4&amp;amp;-H_4\\&#xA;H_4&amp;amp;H_4&amp;amp;-H_4&amp;amp;-H_4\\&#xA;H_4&amp;amp;-H_4&amp;amp;-H_4&amp;amp;H_4\\\end{matrix}\right]$$&#xA;and since the third row of $H_4$ is $+1\ +1\ -1\ -1$, the third row&#xA;of $H_{16}$ is just $-w2$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-05-14T13:27:22.397" LastActivityDate="2013-05-14T13:27:22.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9116" PostTypeId="2" ParentId="9110" CreationDate="2013-05-14T14:22:28.800" Score="10" Body="&lt;p&gt;Oppenheim and Willsky's &lt;em&gt;Signals and Systems&lt;/em&gt; or Lathi's &lt;em&gt;Linear Systems and Signals&lt;/em&gt; are intended for Sophomores who have only a single semester of differential equations under their belts, so it is a bit unfair to criticize them for leaving out the functional analysis and the conformal mapping.  At the sophomore level my favorite book is Siebert's &lt;em&gt;Circuits, Signals, and Systems.&lt;/em&gt;  It won't give you the mathematical rigor you desire either, but you can see his great love for the mathematics and he has these wonderful, witty, footnotes that provide a great historical perspective. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a great book (which I love, but do &lt;em&gt;not&lt;/em&gt; recommend to you) by the (applied) mathematician Richard Hamming (of the &quot;Hamming window&quot;, &quot;Hamming code&quot;, &quot;Hamming distance&quot;, &quot;Hamming bound&quot; and &quot;Hamming problem&quot;) called &lt;em&gt;Digital Filters&lt;/em&gt;.  In it he makes a number of snarky comments like:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Since we are interested mainly in &lt;em&gt;using&lt;/em&gt; mathematics, we are obliged in our turn to be ambiguous with respect to mathematical rigor.  Those who believe that mathematical rigor justifies the use of mathematics in applications are referred to Lighthill and Papoulis for rigor; those who believe that it is the usefulness in practice that justifies the mathematics are referred to the rest of this book.  (1998 Dover edition, page 72.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So in addition to the book by Papoulis that @Matt_L recommended I will add Hamming's (and Siebert's!) recommendation of M.J. Lighthill, &lt;em&gt;Fourier Analysis and Generalized Functions&lt;/em&gt;, Cambridge University Press, 1958.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="29" LastEditDate="2013-05-15T15:25:38.097" LastActivityDate="2013-05-15T15:25:38.097" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9117" PostTypeId="2" ParentId="2493" CreationDate="2013-05-14T15:16:25.063" Score="0" Body="&lt;p&gt;Antenna height also has got something to do with carrier frequency, i believe. To receive an EM wave of wave length 'l', the antenna height should be atleast 'l/10'. As u all know, wavelength of an EM wave can be calculated as 'c/frequency in Hz'. Where c is the speed of light which is equal to 3E8 m/s. Results u can just calculate and see. So, thinking logically, I believe there is no point in modulating a lower frequency carrier using a high frequency message signal.&lt;/p&gt;&#xA;" OwnerUserId="4559" LastActivityDate="2013-05-14T15:16:25.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9118" PostTypeId="1" AcceptedAnswerId="9119" CreationDate="2013-05-14T15:55:11.353" Score="3" ViewCount="3640" Body="&lt;p&gt;I'm trying to intuitively understand why a windowing function of a signal is a low-pass filter.&lt;/p&gt;&#xA;&lt;p&gt;I know its DTFT is a sinc function, making it mathematically a low-pass filter, but my logic says truncating a signal with a windowing function would preserve high frequencies better than low frequencies, since high frequencies have a better chance at showing up in the window.&lt;/p&gt;&#xA;" OwnerUserId="4560" LastEditorUserId="7092" LastEditDate="2023-01-29T01:23:19.673" LastActivityDate="2023-01-29T01:23:19.673" Title="Intuitively, why is windowing function a low-pass filter?" Tags="|lowpass-filter|window-functions|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9119" PostTypeId="2" ParentId="9118" CreationDate="2013-05-14T16:33:23.070" Score="10" Body="&lt;p&gt;Windowing is not a filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowing is a multiplication of two signals in time (the input samples with the window function: $x_w[n] = x[n] \times w[n]$ ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you get in the frequency domain is a (circular) convolution of the transforms of your signal and the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This convolution in the frequency domain can be seen as the spectrum being low-pass-filtered, giving a resulting spectrum with less detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[In the case of a filter, you get convolution in time and product in frequency.]&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2013-05-14T16:33:23.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9120" PostTypeId="1" AcceptedAnswerId="9122" CreationDate="2013-05-14T19:08:45.593" Score="5" ViewCount="1549" Body="&lt;p&gt;I'm processing audio data for voice input from a mic. The data arrives in 32 bit floats [-1 ~ +1]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first filter is to remove DC:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// x = new input value, y = filtered output value&#xA;m_x += ( 0.01 * ( x - m_x ) );&#xA;y = ( x - m_x );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I feed it audio that is close to clipping (but not actually hitting -1 or +1), I'll get values back that actually do go above the [-1 ~ +1] limit - sometimes way above. I find this behavior curious. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain why this happens?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what's the best way to &quot;fix&quot; this? Do a simple clamp for the returned y value? Pre-scale the input down via (x * 0.7071) first?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4562" LastEditorUserId="4562" LastEditDate="2013-05-14T19:32:33.910" LastActivityDate="2013-05-16T06:22:43.953" Title="DC blocking IIR filter clipping?" Tags="|filters|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9121" PostTypeId="2" ParentId="467" CreationDate="2013-05-14T19:44:04.227" Score="-1" Body="&lt;p&gt;Why not to do average removal? The later step which does it &quot;again&quot; just doesn't have effect (it would be substracting zero).&lt;/p&gt;&#xA;" OwnerUserId="4563" LastActivityDate="2013-05-14T19:44:04.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9122" PostTypeId="2" ParentId="9120" CreationDate="2013-05-14T21:48:09.057" Score="3" Body="&lt;p&gt;Your DC blocker transfer function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = (1-a)\frac{1-z^{-1}}{1-(1-a)z^{-1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and an alternative (equivalent) difference equation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_n = (1-a)(x_n - x_{n-1}+y_{n-1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although this filter provides no gain it is possible to find inputs that exceed +1. For instance this input [1 -1 -1 -1 1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you seem to work with a floating point realization you should not need to scale down before filtering. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &#xA;The output of your filter is bounded this way: $|y_n|&amp;lt;2(1-a)$. So an input gain of 0.5 guarantees that the output of the filter can't exceed +1 if the input is bounded between -1 and +1. Can you come up with an input that produces an output value that exceeds +1.5 or an input that produces an output values that is less than -1.5?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit2:&#xA;Filters can provide amplification as well as attenuation, otherwise they wouldn't be that interesting. Your filter does not provide amplification in the sense that a sinusoid passing through your filter will not have an increased amplitude. You can see that by plotting the amplitude/frequency response of your filter. However, for more complex inputs the non-linear phase response of your filter can cause 'overshoots' in the output. An allpass filter for instance, even though it has a completely flat amplitude response can also provide 'overshoots' for fullscale inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to deal with the spikes depends very much on what the other modules in your signal path are doing. Maybe some of the modules create headroom maybe some of them consume headroom. I don't know. Considering your DC blocker in isolation then you can apply a headroom gain of say 0.7 or 0.8 and then saturate your output. Although this setting is likely to perform some saturations my guess is that they will be completely inaudible. You will have to confirm this by experiment.&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2013-05-16T06:22:43.953" LastActivityDate="2013-05-16T06:22:43.953" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9123" PostTypeId="2" ParentId="8020" CreationDate="2013-05-14T22:04:13.670" Score="4" Body="&lt;p&gt;You might be interested in the following paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nehab, D; Maximo, A; Lima, R; Hoppe, H: GPU-Efficient Recursive Filtering and Summed-Area Tables. ACM Trans. Graph. 30(6):176 (December 2011). doi://10.1145/2024156.2024210&#xA;&lt;a href=&quot;http://w3.impa.br/~diego/publications/NehEtAl11.pdf&quot; rel=&quot;nofollow&quot;&gt;http://w3.impa.br/~diego/publications/NehEtAl11.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to recognize that linear filters are associative (at least in theory) and thus you can&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;divide your input into chunks.&lt;/li&gt;&#xA;&lt;li&gt;every thread initializes its iir filter state with 0s and processes its chunk.&lt;/li&gt;&#xA;&lt;li&gt;every thread stores the final state of its iir filter for its chunk.&lt;/li&gt;&#xA;&lt;li&gt;now (because of associativity) you can figure out what the beginning filter state is of every chunk.&lt;/li&gt;&#xA;&lt;li&gt;so then you run the filter over the chunk again, this time correctly initialized and get the correct output.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As @jonsca pointed out, you were a bit vague about your use case.  The above all assumes that you can do batch processing on your input.  If you need some kind of real-time filtering none of what I said is relevant.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-05-14T22:04:13.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9124" PostTypeId="1" AcceptedAnswerId="9125" CreationDate="2013-05-15T07:30:19.697" Score="0" ViewCount="63" Body="&lt;p&gt;I'm sure there must be an easy way to do this, but given the Fourier transform of an isotropic filter kernel, $\hat{f}(\mathbf{u}) = \mathcal{F}f(\mathbf{z})$, can one calculate the value of the kernel at $\mathbf{z} = 0$?&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-15T07:46:36.043" Title="Calculate maximum of filter kernel" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9125" PostTypeId="2" ParentId="9124" CreationDate="2013-05-15T07:46:36.043" Score="3" Body="&lt;p&gt;Since $$f(\mathbf{z})=\int_{\mathbf{R}^n}\hat{f}(\mathbf{u})e^{2\pi i\mathbf{z}\cdot\mathbf{u}}\;d\mathbf{u}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(\mathbf{0})=\int_{\mathbf{R}^n}\hat{f}(\mathbf{u})\;d\mathbf{u}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you simply integrate (or sum in the discrete case) over $\hat{f}(\mathbf{u})$. &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-15T07:46:36.043" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9126" PostTypeId="1" AcceptedAnswerId="9141" CreationDate="2013-05-15T12:38:00.730" Score="3" ViewCount="4439" Body="&lt;p&gt;I have a image and I want calculate fft2 of it, after it I want recover image only by magnitude of it. how can I achieve this work?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I=imread('1.bmp');&#xA;I = rgb2gray(I);&#xA;imafft = fft2(double(I));&#xA;&#xA; % Gets magnitude and phase.&#xA; mag = abs(imafft);&#xA;&#xA; % Generates the modified spectrum&#xA; newfft = mag.*exp(0*angle(imafft));&#xA; ima_out = ifft2(newfft);&#xA; imshow(abs(ima_out));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is return me white page.&lt;/p&gt;&#xA;" OwnerUserId="4568" LastEditorUserId="7092" LastEditDate="2015-02-26T20:11:47.357" LastActivityDate="2015-03-02T15:50:25.563" Title="recover image by only magnitude of image fourier transform" Tags="|image-processing|matlab|fft|magnitude|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9127" PostTypeId="2" ParentId="9126" CreationDate="2013-05-15T13:02:42.260" Score="2" Body="&lt;p&gt;You cannot recover an image with just the frequency magnitudes.  You need the phase information as well to recover it.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-05-15T13:02:42.260" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9128" PostTypeId="1" AcceptedAnswerId="9140" CreationDate="2013-05-15T13:16:01.327" Score="5" ViewCount="2960" Body="&lt;p&gt;I'm pretty new on signal processing and I've been reading a lot the last days in order to understand a little about it. But still there are things that I'm not sure if I got well. Sorry if I don't use the terms well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm developing an application that detects onsets using a frequency spectrum, using KissFFT. Basically I apply FFT to 1024 samples, so I get 513 values (one for DC and the rest are the different values for each frequency range). I analyse the variations in each frequency range (each value of the resulting array from the FFT) in order to detect the onsets (comparing them to the values' mean from the past half second, and checking that the next values are lower). I want to know in which frequency the onset has been detected. So here are my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;As I'm analysing music, it doesn't make sense to consider the whole spectrum range, am I right? I mean, based on &lt;a href=&quot;http://www.dak.com/reviews/ImagesR/2024_FreqGraph.gif&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;, I should worry to check only until the 4k range.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;So, in case the previous sentence is right, I shouldn't take all the 512 spectrum values, but only the first ones. So if my samples are at 44100Hz, and I have a spectrum with 512 values, each one should cover a range of (approximately) 86Hz. Is that correct? In that case, I should only analyse the first 47 array values and safely ignore the rest, I guess.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I want to analyse a wider frequency, would be enough to sum the values from each frequency and calculate the mean? Is that correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What I'm doing is reasonable? Or I'm just making crazy random stuff?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sorry for making such basic questions, as I said, I'm just entering in this and the more I read, the more confused I get. Thanks&lt;/p&gt;&#xA;" OwnerUserId="4569" LastActivityDate="2013-05-15T23:17:45.823" Title="Basics of frequency spectrum for onset detection using FFT" Tags="|fft|frequency-spectrum|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9129" PostTypeId="2" ParentId="9118" CreationDate="2013-05-15T14:23:52.663" Score="0" Body="&lt;p&gt;&quot;Intuitively, why is windowing function a low-pass filter?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, assuming you are not using a rectangular filter, the window function removes the sharp transitions at the start and end of the data to be analyzed.  The onset of the data is tapered up gently from 0 to full scale and the data is tapered down gently to 0 at the trailing end of the data.  This reduces high frequency content associated with the transition at the start and end of the data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you assume your data to be a rectangular pulse just shorter than the analysis window, the rectangular pulse will have some high frequency content associated with the sharp transitions at the start and end of the pulse.  Now apply  a trapezoidal window function so the rectangular pulse also becomes trapezoidal.  Clearly the DFT will show less high frequency content after application of the window.  Other tapering windows have a similar effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The degree to which high frequency content is affected by the window function will depend on the nature (shape) of both your window and your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned above, this is not technically a linear filter operation, but the window function can have a lowpass effect on the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2013-05-16T23:14:04.227" LastActivityDate="2013-05-16T23:14:04.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9130" PostTypeId="2" ParentId="9128" CreationDate="2013-05-15T16:13:25.693" Score="3" Body="&lt;p&gt;Here are some thoughts concerning your questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I guess you have to find the relevant frequency range by experiment, because, depending on the instrument, a lot of signal energy can be in the harmonics.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If your sampling frequency is 44.1 kHz and you use a 1024 point FFT your frequency interval is about 43 Hz, because the 513 points you mentioned are between DC and half the sampling frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You could indeed average some frequency bins, or simply use a shorter FFT length.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I would say your methodology is pretty reasonable. Have you checked the literature? You're probably not the first one the do onset detection.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-15T16:13:25.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9132" PostTypeId="1" AcceptedAnswerId="9134" CreationDate="2013-05-15T16:51:04.880" Score="2" ViewCount="235" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/27KPj.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here we have the basic formula of a Proportional Integral Derivative controller. This is the formula from the &lt;a href=&quot;http://en.wikipedia.org/wiki/PID_controller&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page on the subject&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to implement this type of controller in my system. Currently the system (function in the software) is fed a psi value and told to set an analog output to a value so that this pressure is achieved. The function, lets call it &lt;code&gt;SetPressure(int psi)&lt;/code&gt;, has access to a table of psi vs analog signal output, it does quick binary search and finds the closest match and sets the analog output to that match. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not good enough for when the machinery/valves &quot;wears in&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now I have access to a pressure transducer to tell me the actual pressure in the line I am trying to control. It gives me an analog input to my function. I would like to figure out, given these values of commanded and actual values, how to create a software PID. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the first value is easy; P. This is found by determining the error in the value &lt;code&gt;error = DesiredValue - ActualValue&lt;/code&gt; and multiplying it by some proportional gain &lt;code&gt;Kp&lt;/code&gt;. So &lt;code&gt;P = Kp*error&lt;/code&gt; this is easy enough to understand. After some tuning I should find a suitable value of &lt;code&gt;Kp&lt;/code&gt; such that I can control the pressure a little better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about if I would like to find the I and D? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The software this PID runs in is real time. It gets called every few milliseconds and reads the inputs and determines the outputs based on its state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess for a start, where do I go from here to get I and D. I understand that there are gains for each of these terms but I am not sure about how I calculate the entire term. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, &lt;img src=&quot;https://i.stack.imgur.com/pXJ32.png&quot; alt=&quot;&quot;&gt; Do I need to save each calculated error for each time t so that I might find the integral? This seems it would be a waste of memory, saving each error for each moment in time would accumulate to a huge list in a matter of seconds. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated. Please ask for clarification if needed, and note this is my first time working with something like this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code Sample so far: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(anaOutput[PRESS_OUT_DAC]  is already determined above in the code from the analog vs psi table)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float KpPressure = 1; // These gains are to be determined&#xA;float KiPressure = 1;&#xA;float KdPressure = 1;&#xA;float MVout = anaOutput[PRESS_OUT_DAC]; // Init to output &#xA;&#xA;if(anaInput[PRESS_IN_DAC] != anaOutput[PRESS_OUT_DAC])&#xA;{&#xA;    // error = SetPoint - ProcessValue&#xA;   float error = (float)anaOutput[PRESS_OUT_DAC] - (float)anaInput[PRESS_IN_DAC];&#xA;&#xA;   // Pout = Kp * error&#xA;   float Pout = KpPRessure * error;&#xA;   // Iout = Ki * Int(0,t)[error(t)]&#xA;   float Iout = KiPressure * 1;              //// What should 1 be?&#xA;   // Dout = Kd * (d/dt)[error(t)]&#xA;   float Dout = KdPressure * 1;              //// What should 1 be?&#xA;&#xA;   // Manipulated Output = Combination of PID&#xA;   MVout = P + I + D;   &#xA;}&#xA;if(MVout &amp;gt; MAX_SIGNAL) &#xA;      MVout = MAX_SIGNAL;&#xA;&#xA; anaOutput[PRESS_OUT_DAC] = (UWORD)MVout + ANALOG_ZERO;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4572" LastActivityDate="2013-05-15T17:55:45.127" Title="Implement a software PID for the first time in real time software, I can find P what about I and D?" Tags="|real-time|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9133" PostTypeId="1" CreationDate="2013-05-15T17:00:00.727" Score="6" ViewCount="313" Body="&lt;p&gt;I have a discrete function that represents a 1d position in space over time.  I have a motion system that would like to achieve this curve, but, due to constraints on jerk (3rd derivative) and acceleration (2nd derivative), it cannot actually achieve the motion.  This occurs due to a discontinuity in the function, where it goes from a flat signal to a sharp rise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for an algorithm that will take the discrete series and produce a new series that approximates the original, without violating the upper limits on the magnitude of the second and third derivatives.  I don't have a strict definition for how I'd like to minimize the error for the position, but a standard sum mean-squared error fit is probably reasonable.  For the derivative, I'm approximating using the standard centered difference $\frac{f(x+1)-f(x-1)}{(2{\Delta}t)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried simply applying the limits and driving toward the target position as fast as possible, but this is unstable (it doesn't properly consider the de-jerk and decel time and therefore overshoots the target and oscillates.)  I've considered applying a repeated low-pass filter until the constraints are met, but this seems like a bit of a hack and I'm not convinced it will give me a very good fit.  Is there some way to create a filter that specifically limits the derivatives of the signal?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A few additional notes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The new series must have the same length as the original series.  This motion occurs at the same time as another operation and the two are strictly synchronized.  It is acceptable, however, if it can't achieve the final position within the constraints; this just means that the parallel operation is too aggressive for the motion to follow.  This should not occur, in practice, when configured properly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I've started investigating an iterative approach that identifies a point that violates the constraints, then adjusts for the error and splits the negative of the error between the two neighboring points, so that the sum of the function values will be preserved.  It then computes the error at the neighbor and transfers the remaining error to the left or right, respectively.  If it reaches the end of the function and there is still error, it just chops to the limits.  I don't know if this approach has any sound theoretical grounding, but I'll experiment and see how it performs with my signals.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;More notes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's reasonable to approximate the jerk (third derivative) function as a linear combination of non-overlapping step and impulse functions.  For a typical input series, it looks something like this (the blue vs. red is my current attempt at filtering; this is mainly just to convey an idea of the shape):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h9wO8.png&quot; alt=&quot;Jerk Series&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a typical acceleration profile:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3RX1m.png&quot; alt=&quot;Accel Series&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a typical velocity profile (the climb at the start is what causes all the trouble; the physics of the problem make the system prefer to start moving at close to infinite velocity right from the get-go, but practical considerations get in the way):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mL9wv.png&quot; alt=&quot;Velocity Series&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those who are interested, here is the raw tab-delimited data series from which the central-difference derivatives were approximated to produce the above graphs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x   4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.510544858 4.529570168 4.548595479 4.567620789 4.5866461   4.60567141  4.624696721 4.643722031 4.662747342 4.681772652 4.700797963 4.719823273 4.738848584 4.757873894 4.776899204 4.795924515 4.814949825 4.833975136 4.853000446 4.872025757 4.891051067 4.910076378 4.929101688 4.948126999 4.967152309 4.98617762  5.00520293  5.024228241 5.043253551 5.062278862 5.081304172 5.100329483 5.119354793 5.138380104 5.157405414 5.176430725 5.195456035 5.214481346 5.233506656 5.252531967 5.271557277 5.290582588 5.309607898 5.328633209 5.347658519 5.36668383  5.38570914  5.404734451 5.423759761 5.442785072 5.461810382 5.480714657 5.497626044 5.514537431 5.531448818 5.548360206 5.565271593 5.58218298  5.599094367 5.616005754 5.632917141 5.649828528 5.666739915 5.683651302 5.700562689 5.717474077 5.734385464 5.751296851 5.768208238 5.785119625 5.802031012 5.818942399 5.835853786 5.852765173 5.869676561 5.886587948 5.903499335 5.920410722 5.937322109 5.954233496 5.971144883 5.98805627  6.004967657 6.021879044 6.038790432 6.055701819 6.072613206 6.089524593 6.10643598  6.123347367 6.140258754 6.157170141 6.174081528 6.190992916 6.207904303 6.22481569  6.241727077 6.258638464 6.275549851 6.292461238 6.309372625 6.326284012 6.343195399 6.360106787 6.377018174 6.393929561 6.410840948 6.427752335 6.444663722 6.461575109 6.478486496 6.495397883 6.512309271 6.529220658 6.546132045 6.563043432 6.579954819 6.596866206 6.613777593 6.63068898  6.647600367 6.664511754 6.681423142 6.698334529 6.715245916 6.732157303 6.74906869  6.765980077 6.782891464 6.79783353  6.807698506 6.817563482 6.827428457 6.837293433 6.847158409 6.857023385 6.866888361 6.876753336 6.886618312 6.896483288 6.906348264 6.91621324  6.926078215 6.935943191 6.945808167 6.955673143 6.965538119 6.975403095 6.98526807  6.995133046 7.004998022 7.014862998 7.024727974 7.034592949 7.044457925 7.054322901 7.064187877 7.074052853 7.083917828 7.093782804 7.10364778  7.113512756 7.123377732 7.133242707 7.143107683 7.152972659 7.162837635 7.172702611 7.182567587 7.192432562 7.202297538 7.212162514 7.22202749  7.231892466 7.241757441 7.251622417 7.261487393 7.271352369 7.281217345 7.29108232  7.300947296 7.310812272 7.320677248 7.330542224 7.3404072   7.350272175 7.360137151 7.370002127 7.379867103 7.389732079 7.399597054 7.40946203  7.419327006 7.429191982 7.439056958 7.448921933 7.45668417  7.46311785  7.46955153  7.47598521  7.48241889  7.488852569 7.495286249 7.501719929 7.508153609 7.514587289 7.521020969 7.527454649 7.533888329 7.540322008 7.546755688 7.553189368 7.559623048 7.566056728 7.572490408 7.578924088 7.585357768 7.591791447 7.598225127 7.604658807 7.611092487 7.617471594 7.622952136 7.628432678 7.63391322  7.639393762 7.644874304 7.650354846 7.655835389 7.661315931 7.666796473 7.672277015 7.677757557 7.683238099 7.688718641 7.694199183 7.699679725 7.705160268 7.71064081  7.716121352 7.721601894 7.727082436 7.732562978 7.73804352  7.743524062 7.749004605 7.754485147 7.759965689 7.765446231 7.770926773 7.776407315 7.781828236 7.786267475 7.790706714 7.795145953 7.799585192 7.804024432 7.808463671 7.81290291  7.817342149 7.821781388 7.826220627 7.830659866 7.835099105 7.839538344 7.843977584 7.848416823 7.852856062 7.857295301 7.86173454  7.866173779 7.870613018 7.875052257 7.879491497 7.883930736 7.888369975 7.892809214 7.897248453 7.901687692 7.906126931 7.91056617  7.915005409 7.919444649 7.923883888 7.928323127 7.932762366 7.937201605 7.941640844 7.946080083 7.950519322 7.954958561 7.959397801 7.96383704  7.968276279 7.972715518 7.977154757 7.980384921 7.982851165 7.985317409 7.987783653 7.990249897 7.992716141 7.995182385 7.997648629 8.000114873 8.002581117 8.005047361 8.007513605 8.009979849 8.012446092 8.014912336 8.01737858  8.019844824 8.022311068 8.024777312 8.027243556 8.0297098   8.032176044 8.034642288 8.037108532 8.039574776 8.04204102  8.044507264 8.046973508 8.049439752 8.051905996 8.05437224  8.056838484 8.059304728 8.061633119 8.063606114 8.065579109 8.067552105 8.0695251   8.071498095 8.07347109  8.075444085 8.07741708  8.079390076 8.081363071 8.083336066 8.085309061 8.087282056 8.089255051 8.091228046 8.093201042 8.09410447  8.094332124 8.094559777 8.09478743  8.095015084 8.095242737 8.09547039  8.095698043 8.095925697 8.09615335  8.096381003 8.096608657 8.09683631  8.097063963 8.097291616 8.09751927  8.097746923 8.097974576 8.09820223  8.098429883 8.098657536 8.098885189 8.099112843 8.099340496 8.099568149 8.099795803 8.100023456 8.100251109 8.100478762 8.100706416 8.100934069 8.101161722 8.101389376 8.101617029 8.101844682 8.102072336 8.102299989 8.102527642 8.102755295 8.102982949 8.103210602 8.103438255 8.103665909 8.103893562 8.104121215 8.104348868 8.104576522 8.104804175 8.105031828 8.105259482 8.105487135 8.105714788 8.105942441 8.106170095 8.106397748 8.106625401 8.106853055 8.107080708 8.107308361 8.107536014 8.107763668 8.107991321 8.108218974 8.108446628 8.108674183 8.108899792 8.109120089 8.109331659 8.109531087 8.109714959 8.10987986  8.110022376 8.110139158 8.11022965  8.110297009 8.110344649 8.110375986 8.110394434 8.110403409 8.110406324 8.110406324&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4573" LastEditorUserId="4573" LastEditDate="2013-05-21T17:35:08.030" LastActivityDate="2014-01-16T23:12:19.123" Title="'Best fit' motion curve for an unachievable profile" Tags="|filters|discrete-signals|motion|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9134" PostTypeId="2" ParentId="9132" CreationDate="2013-05-15T17:01:11.363" Score="2" Body="&lt;p&gt;It sounds like you're on the right track for the proportional part of the controller; you seem to understand what's going on pretty well. The other two portions are easier than you think. The main difference between what you might read in basic control theory and how you're implementing it is that your computer is a discrete-time system. Since you don't have infinitesimal time steps, you'll need to approximate the other two branches in the controller.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integral:&lt;/strong&gt; You can approximate integration via discrete summation:&#xA;$$&#xA;I_{out} = K_i\int_{0}^{t}e(\tau)d\tau \approx K_i \sum_{n=0}^{N} e[n]\Delta t&#xA;$$&#xA;where $\Delta t$ is the time step between updates of the controller output, and $e[n]$ is the calculated error at the $n$-th time step. This does not require a lot of memory; instead of storing each error sample, you can store their cumulative sum. This is analogous to how an analog integrator would operate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Derivative:&lt;/strong&gt; You can approximate differentiation in multiple ways. The simplest is a first-order difference:&#xA;$$&#xA;I_{out} = K_d\frac{d}{dt}e(t) \approx K_d \frac{e[n] - e[n-1]}{\Delta t}&#xA;$$&#xA;If your time step is large, then this may not be a great approximation of the derivative. In fact, it is difficult in any case to implement a good, robust differentiator in practice. You could improve the approximation by decreasing your time step (effectively increasing the sample rate of your discrete-time controller) or by using a more sophisticated digital differentiator design.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-15T17:01:11.363" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9135" PostTypeId="2" ParentId="9132" CreationDate="2013-05-15T17:55:45.127" Score="3" Body="&lt;p&gt;Once you get the basics covered (Jason has covered this pretty well), you will also want to research &lt;a href=&quot;http://en.wikipedia.org/wiki/Integral_windup&quot; rel=&quot;nofollow&quot;&gt;Integral Windup&lt;/a&gt; and filtering of the error signal and its estimated derivative.  The former is very important if your control point changes discontinuously (i.e. you don't have a separate controller 'ramping' the control signal for your PID.)  The latter is important in the presence of real-world sensor noise, in order to avoid instability.  Many sensors can introduce large noise 'spikes' that can greatly perturb a control system without filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many physical systems also exhibit resonance effects that can lead to run-away oscillations (the &lt;a href=&quot;http://en.wikipedia.org/wiki/Tacoma_Narrows_Bridge_%281940%29&quot; rel=&quot;nofollow&quot;&gt;Tacoma Narrows Bridge&lt;/a&gt; is the classic example of how bad this can get.)  A feedback system can exacerbate these effects, so an important part of 'tuning' your PID is characterizing its stability at the various feedback and control signal frequencies you will encounter.  This is another area where filtering of the feedback signal is helpful; in particular, notch filters at 60Hz are common for systems using AC power in the US.  In practice, the resonances are application-specific, so most controller manufacturers supply a general toolkit of filters that can used and then leave it up to the process engineers to configure them appropriately for their application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next steps after you've covered stability:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;'Ramping' the control signal by applying constraints on its rate of change.  For motion systems, this typically involves limiting velocity and acceleration.  This makes the job of the PID easier, as the control signal is moving more 'smoothly'.  It also generally results in a smoother output signal for your actuator, which can be important, since most actuators have practical limits on their ability to respond to rapid changes in their control signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Adjusting the feedback/control signals outside the PID to get the best response from your particular system.  For instance, there may be known hysteresis effects in the actuator or sensor that you want to correct for.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All that said, there's a reason why most integrators buy off-the-shelf controllers for the devices they're integrating.  Control systems are complicated and there are a lot of proprietary tricks that vendors have developed over the years to get the best performance out of their particular components.  It's still valuable to understand these systems to get the best results from them, but there is more going on here than you may realize.&lt;/p&gt;&#xA;" OwnerUserId="4573" LastActivityDate="2013-05-15T17:55:45.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9137" PostTypeId="2" ParentId="9128" CreationDate="2013-05-15T19:54:46.807" Score="3" Body="&lt;ul&gt;&#xA;&lt;li&gt;Instead of the document you linked to, I suggest you to directly look at spectrograms of actual recordings - you'll see that at the note onsets, there's a lot of high-frequency content (due to the sharp transient/attack - especially for piano, percussions...) - some of it well above 4kHz.&lt;/li&gt;&#xA;&lt;li&gt;There's no harm in processing all frequency bands.&lt;/li&gt;&#xA;&lt;li&gt;If you want to work with larger frequency bands, you need to sum the magnitudes (or squared magnitude) of the FFT values - not the raw complex values as these could cancel each other.&lt;/li&gt;&#xA;&lt;li&gt;What you're doing is called the &quot;spectral energy flux&quot; method, and is indeed a classic onset detection method. The &quot;values' mean from the past half second&quot; you want to use are a special and not that great case of low-pass filter - you can do better in this department! If you want to go this route, I suggest you to have a look at &lt;a href=&quot;http://cecs.uci.edu/~papers/icme05/defevent/papers/cr1513.pdf&quot; rel=&quot;nofollow&quot;&gt;Alonso et al.'s paper&lt;/a&gt; - which introduces a bunch of perceptually motivated pre- and post- processing steps in the process to make it work. A simpler and quite efficient method is based on &lt;a href=&quot;http://www.eecs.qmul.ac.uk/dafx03/proceedings/pdfs/dafx81.pdf&quot; rel=&quot;nofollow&quot;&gt;phase and amplitude comparison&lt;/a&gt; (there are discontinuity both in amplitude and phase at note onsets).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Regarding your reply to Paul, what you want to achieve (assign a source to an onset) is better done as a post-processing. What you have to keep in mind is that if there is, for example, a piano and a bass playing together, the onsets of the bass will look like vertical lines in the spectrogram, extending to the high frequencies.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-05-15T20:24:07.703" LastActivityDate="2013-05-15T20:24:07.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9138" PostTypeId="1" AcceptedAnswerId="9139" CreationDate="2013-05-15T22:34:26.713" Score="2" ViewCount="4482" Body="&lt;p&gt;I am software engineer studying DSP on my own. I came across this question in a graduate textbook and am not sure how to proceed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Determine the frequency response for the filter:&#xA;H(z) = 1.5 / (1 + 3z^-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Clearly, this is a z-domain transfer function. How do I get the frequency response? I am thinking of converting it into a time-domain difference equation, calculating about 128 points, running it through MATLAB's FFT, plot it, and voila, the final curve would be the answer. Is that a right approach? Is there a more analytic/math-y answer?&lt;/p&gt;&#xA;" OwnerUserId="709" LastActivityDate="2013-05-17T06:55:48.937" Title="Finding the frequency response of a filter defined as a Z-domain transfer function" Tags="|dsp-core|frequency-response|transfer-function|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9139" PostTypeId="2" ParentId="9138" CreationDate="2013-05-15T23:06:31.177" Score="4" Body="&lt;p&gt;The analytic way is to substitute the variable $z$ by $e^{j\omega}$ to get the frequency response $H(\omega)$ (with $\omega = \frac{2 \pi f}{F_s}$) - that is to say, the frequency response is the $z$ transform evaluated on the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that matlab has a built-in function for plotting the frequency response straight from filter coefficients (&lt;code&gt;freqz&lt;/code&gt;), whose source code can be seen. Have a look! The implementation does not even involve solving the difference equation or filtering an impulse - you can simply divide the FFT of the numerator sequence by the FFT of the denominator sequence - padded up to the desired number of frequency points.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-05-15T23:06:31.177" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9140" PostTypeId="2" ParentId="9128" CreationDate="2013-05-15T23:17:45.823" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;As I'm analysing music, it doesn't make sense to consider the whole spectrum range, am I right? I mean, based on this, I should worry to check only until the 4k range.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is not right. What the chart does not show is the approximate energy drop per octave of each instrument. A kick drum, for example, will have strong energy in the low range (say below 120Hz), but often very little within the highs (say above 10kHz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are analysing music, and say there is a kick drum and a distorted guitar (which has dominent frequencies from the fundamental all the way up the spectrum), you are unlikely to be able to detect the kick drum, as the distorted guitar 4k energy will overpower any 4k in the kick. If you however analyse 80Hz - you should 'see' the kick no problem.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So, in case the previous sentence is right, I shouldn't take all the 512 spectrum values, but only the first ones. So if my samples are at 44100Hz, and I have a spectrum with 512 values, each one should cover a range of (approximately) 86Hz. Is that correct? In that case, I should only analyse the first 47 array values and safely ignore the rest, I guess.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As explained, the previous sentence is not right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, a sample rate of 44100Hz can contain frequencies up to 22050Hz (aka the Nyquist frequency = half the sample rate). I'm not sure what KissFFT gives you back, most FFTs will give you a mirrored result, of which you take the first half, and you work out what x-value corresponds to what frequency by calculating the frequency gap. I hope that you get how this is done from this code (alternatively look at the code &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ug/psd-estimate-using-fft.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ iSamples, iSamplingRate, iBitDepth ] = wavread( '100Hz16b.wav' );&#xA;&#xA;iNyquist       = iSamplingRate / 2;&#xA;iSampleCount   = length( iSamples );&#xA;iAudioDuration = iSampleCount / iSamplingRate;&#xA;&#xA;iFrequencyDelta = 1 / iAudioDuration;&#xA;&#xA;iFFT = fft( iSamples );&#xA;&#xA;# Get half of the set&#xA;iFFT = iFFT( 1:iSampleCount/2 + 1);&#xA;&#xA;iFreqRange = 0: iFrequencyDelta : iNyquist;&#xA;plot( iFreqRange, 10*log10( abs(iFFT) ) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I want to analyse a wider frequency, would be enough to sum the values from each frequency and calculate the mean? Is that correct?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally speaking this is correct, but the wider the bandwidth of your analysis is, the harder it will be to detect differences. Say we take the extreme case where you analyse the whole frequency spectrum - you would not be able to distinguish one instrument from another. More on this below.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What I'm doing is reasonable? Or I'm just making crazy random stuff?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a momentous challenge (PhD stuff), but with a hard effort you might be able to demonstrate some degree of success (depending on the complexity of the material being analysed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have to consider is that the timbre of all sounds can be broken down into two components:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Their spectral content (ie, what frequencies exist and how much energy in each range).&lt;/li&gt;&#xA;&lt;li&gt;Their dynamic envelope (how their average level changes over time).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For the latter, do some research on 'beat detection' (but try to ignore anything with DJ in the title) and envelope followers (which is a very common strategy to detect the transient nature of sounds - work better than compering RMS to peak).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I can't share an untested strategy, you may want to consider (starting with extremely simple material, like a kick drum and a violin going slowly crescendo):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Perform FFT.&lt;/li&gt;&#xA;&lt;li&gt;Perform envelope follower on each of the bands you get.&lt;/li&gt;&#xA;&lt;li&gt;Take it from here (think patterns and deviations).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4576" LastActivityDate="2013-05-15T23:17:45.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9141" PostTypeId="2" ParentId="9126" CreationDate="2013-05-16T05:55:23.593" Score="6" Body="&lt;p&gt;Check out this classic example from Oppenheim, A. V., &amp;amp; Lim, J. S. (1981). &quot;The importance of phase in signals&quot;. a) and b) are the original images, c) is the image created using the phase of a) with the magnitude of b), d) is the image created using the phase of b) and the magnitude of a). Phase carries most of the information in an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dlihl.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-16T05:55:23.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9142" PostTypeId="2" ParentId="9138" CreationDate="2013-05-16T07:09:01.990" Score="3" Body="&lt;p&gt;First of all, your transfer function has a pole at $z=-3$, which means your filter is unstable and you will probably see your output going to infinity if your process anything with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in general, you can process an impulse with your difference equation and do an FFT (or freqz) of the resulting impulse response. That should give the same result as freqz of the transfer function (if your filter is not unstable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also process an arbitrary input and determine the frequency response of the filter by taking the ratio of the frequency response of the output and frequency response of the input. If you do this by FFT then dependent on your filter choosing a window function can be important. If you get strange results then try a triangular or parzen window (they have less leakage than other common windows).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Maybe, in the first place, the idea of using an unstable filter is to prevent the use of your method (filtering some samples) to compute the frequency response. Although, the filter is unstable it gives a perfectly fine frequency response that doesn't 'blow up' because the pole is not actually directly on or in the near vicinity to the unit cirle if you use freqz or if you do it analytically. E.g&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|H(e^{j\omega})|^2 = H(e^{j\omega}) H^*(e^{j\omega}) = H(e^{j\omega}) H(e^{-j\omega}) = \frac{b^2}{1+a^2+2a\cos(\omega)}$   ,  where $b=1.5$ and $a=3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't really tell from this expression that the underlying filter is unstable. But let's say that you 'like' the frequency response of this transfer function, is it then possible to find another transfer function which has exactly the same frequency response (amplitude response) but with pole(s) inside the unit circle? &lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2013-05-17T06:55:48.937" LastActivityDate="2013-05-17T06:55:48.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9144" PostTypeId="1" AcceptedAnswerId="9146" CreationDate="2013-05-16T11:23:27.157" Score="9" ViewCount="32215" Body="&lt;p&gt;Take the simple frequency-domain band-pass filtering operation below . . .&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NFFT = 128;&#xA;x = randn(NFFT,1);&#xA;H = zeros(NFFT,1);&#xA;H(10:20) = 1;&#xA;y = ifft(H.*fft(x), 'symmetric');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives a real output because I'm using the conjugate symmetric flag to the ifft operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want a function that returns the conjugate symmetric version of H, so I do not have to rely on the builtin symmetric option in Matlab's ifft. NFFT can be any positive integer. This could be called something like this . .&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H(10:20) = 1;&#xA;H = MakeConjSym(H);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2018-11-30T11:02:57.810" Title="How to make a signal conjugate symmetric?" Tags="|fft|ifft|conjugate|symmetry|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9145" PostTypeId="2" ParentId="9144" CreationDate="2013-05-16T11:53:58.607" Score="6" Body="&lt;p&gt;You just have to make sure that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_k = H^*_{N-k},\quad k=1,2,\ldots N-1,\quad (N\ldots\text{FFT length})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and that $H_0$ is real-valued.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-16T11:53:58.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9146" PostTypeId="2" ParentId="9144" CreationDate="2013-05-16T11:54:02.433" Score="10" Body="&lt;p&gt;Conjugate symmetric means&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(-x) = f^{\ast}(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. the sign of the imaginary part is opposite when $x&amp;lt;0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT of a real signal is conjugate symmetric. One half of the spectrum is the positive frequencies, and the other half is the negative. The negative coefficients are conjugate of the positive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you do filtering, your envelope must do both the positive frequencies and their corresponding negative frequencies, so that the imaginary bits cancel out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, H does only one half. That is why the output has imaginary bits in it. What you want is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NFFT = 128;&#xA;x = randn(NFFT,1);&#xA;H = zeros(NFFT,1);&#xA;H(10:20) = 1;&#xA;H(end-20+2:end-10+2) = 1;    % Other half&#xA;y = ifft(H.*fft(x));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-16T11:54:02.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9148" PostTypeId="1" CreationDate="2013-05-16T17:03:42.677" Score="1" ViewCount="1022" Body="&lt;p&gt;I want to calculate the total bit rate of a video system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to calculate the total bit rate for a 1080/50p video system(4:2:2) we need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;•   Luminance sampling rate:Fs=13.5MHz  (standard for 4:2:2)&#xA;•   Number of bits: N=8&#xA;•   Number of components per PEL:  M=3 (Y,Cb,Cr)&#xA;•   Number of lines: L=1080 &#xA;•   Line duration: Tline=?&#xA;•   Frame Rate:  Fr=50&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I dont know how to find line duration. Is line duration Tline=L/Fs ??&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-05-16T17:13:01.193" LastActivityDate="2013-05-16T17:13:01.193" Title="Calculate total bit rate" Tags="|homework|video-processing|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9151" PostTypeId="1" AcceptedAnswerId="9159" CreationDate="2013-05-17T06:44:23.637" Score="1" ViewCount="2144" Body="&lt;p&gt;I have to use image processing for quality control of a cookie manufacturer (as a part of my project). The program must be able to detect oversized, undersized, distorted cookies, cookies having cracks, etc. I am new to opencv. Can you please suggest which all functions would help me?&lt;/p&gt;&#xA;" OwnerUserId="4585" LastActivityDate="2013-05-17T14:00:43.893" Title="Image processing functions for quality control" Tags="|opencv|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9153" PostTypeId="1" AcceptedAnswerId="9155" CreationDate="2013-05-17T09:06:10.927" Score="0" ViewCount="69" Body="&lt;p&gt;What does $|H(j\omega)|^2$ in $20 \log_{10}|H(j\omega)|$ mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it some ratio of energy or power? And why? How to derive it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sorry for curtness of my questin.&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="4298" LastEditDate="2013-05-17T10:24:08.910" LastActivityDate="2013-05-17T10:24:38.817" Title="Square of Frequency characteristic of the system" Tags="|frequency-spectrum|frequency-domain|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9154" PostTypeId="1" AcceptedAnswerId="9158" CreationDate="2013-05-17T09:38:13.933" Score="2" ViewCount="4178" Body="&lt;p&gt;While going through FFT I came to know that, shifting of phase in frequency domain results on shifting of time in time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to this, in wireless communications, from the transmitter side having 2 antennas,signal s1 transmitted from Ant 1 and phase shifted version of sig2 in frequency domain transmitted from Ant2, sig2 will become a delayed version of sig1. And when both the antennas transmitting sig1 and sig2 at the same time how sig2 will become a delayed version or a multipath component to sig 1. &lt;/p&gt;&#xA;" OwnerUserId="3638" LastActivityDate="2013-05-17T15:07:41.713" Title="frequency domain phase shift" Tags="|fft|frequency-domain|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9155" PostTypeId="2" ParentId="9153" CreationDate="2013-05-17T10:09:19.853" Score="1" Body="&lt;p&gt;I suppose you're talking about the frequency response of a continuous-time linear time-invariant system. It is defined as the Fourier transform of the system's impulse response $h(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\omega)=\int_{-\infty}^{\infty}h(t)e^{-j\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its practical relevance is that it shows the frequency dependence of the system's input-output relation. If $X(j\omega)$ is the Fourier transform of the input signal, and $Y(j\omega)$ is the Fourier transform of the output signal, then&#xA;$$H(j\omega)=\frac{Y(j\omega)}{X(j\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a sinusoidal input signal $x(t)=\sin (\omega_0 t)$ the output signal $y(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=|H(j\omega_0)|\sin (\omega_0 t + \text{arg}\{H(j\omega_0\})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\text{arg}\{H(j\omega_0\})$ is the phase of the complex function $H(j\omega)$ at frequency $\omega_0$. So you can see that $|H(j\omega)|$ represents the amplification of the system at frequency $\omega$. From above relations it is also obvious that the output signal cannot contain any frequencies that were not present in the input signal. $H(j\omega)$ can only reduce or amplify frequency components of the input signal. This is how (linear time-invariant) filtering works.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-17T10:24:38.817" LastActivityDate="2013-05-17T10:24:38.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9156" PostTypeId="1" AcceptedAnswerId="9308" CreationDate="2013-05-17T10:32:24.223" Score="4" ViewCount="2039" Body="&lt;p&gt;Is there an analytic expression by which it is possible to calculate overshoot of step-response of second order IIR digital filter? I have tried to search through Mitra's signal processing book and through some other materials, but wasn't able to find it.&lt;/p&gt;&#xA;" OwnerUserId="4587" LastActivityDate="2013-05-28T10:30:00.000" Title="Step response overshoot in IIR filters" Tags="|filters|infinite-impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9158" PostTypeId="2" ParentId="9154" CreationDate="2013-05-17T12:04:51.010" Score="3" Body="&lt;p&gt;Suppose one signal is $a_1(t) = \cos(\omega t)$ and the other is &#xA;$a_2(t) = \cos(\omega t - \theta)$. Note the&#xA;phase shift $\theta$ between the two signals, and note also that we can write&#xA;$$a_2(t) = \cos(\omega t - \theta) &#xA;= \cos\left(\omega\left(t-\frac{\theta}{\omega}\right)\right) &#xA;= \cos(\omega (t - t_0)) = a_1(t-t_0)$$&#xA;where $t_0 = \frac{\theta}{\omega}$ showing that $a_2(t)$ is a &lt;em&gt;delayed&lt;/em&gt; version of $a_1(t)$.  Suppose that $a_1(t)$ and $a_2(t)$&#xA;are transmitted from the two separate antennas &lt;em&gt;simultaneously&lt;/em&gt;, that is,&#xA;no additional time delay between them, &#xA;and reach the receiver over paths of delays $\tau_1$ and $\tau_2$&#xA;respectively and gains $A_1$ and $A_2$ respectively.&#xA;Then the received signals are &#xA;$$\begin{align}&#xA;A_1a_1(t-\tau_1) &amp;amp;= A_1\cos(\omega (t -\tau_1)) = A_1\cos(\omega \hat{t})\\&#xA;A_2a_2(t-\tau_2) &amp;amp;= A_2\cos(\omega (t -t_0 - \tau_2))\\&#xA;&amp;amp;= A_2\cos(\omega (\hat{t} +\tau_1 -t_0-\tau_2))\\&#xA;&amp;amp;= A_2\cos(\omega (\hat{t} - (t_0 + \tau_2-\tau_1))\\&#xA;&amp;amp;= A_2\cos(\omega \hat{t} -\hat{\theta})&#xA;\end{align}$$&#xA;where $\hat{t} = t-\tau_1$ is the &lt;em&gt;time as measured by the receiver clock&lt;/em&gt;.&#xA;Thus we see that the second signal is delayed &#xA;&lt;em&gt;with respect&lt;/em&gt; to the former by $t_0+\tau_2-\tau_1$, that is,&#xA;the delay introduced at the transmitter plus the difference in the&#xA;delays between the two paths, and this can be expressed as a phase&#xA;shift of $\hat{\theta}= \frac{t_0+\tau_2-\tau_1}{\omega}$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If $\tau_1 = \tau_2$ so that the&#xA;two paths are of identical lengths, the second signal&#xA;looks like a multipath signal with respect to the first with a delay&#xA;of $t_0$ (equivalently the same phase shift $\theta$ as existed at&#xA;the transmitter).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $t_0 = 0$ so that effectively only one signal is&#xA;transmitted, but is received over paths of different lengths,&#xA;the second signal &lt;em&gt;is&lt;/em&gt; a multipath signal with respect to the first&#xA;with a delay of $\tau_2-\tau_1$ and it too can be expressed&#xA;as a phase shifted version of the first signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-05-17T15:07:41.713" LastActivityDate="2013-05-17T15:07:41.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9159" PostTypeId="2" ParentId="9151" CreationDate="2013-05-17T13:49:47.210" Score="3" Body="&lt;p&gt;Your first task is to collect examples of various defects and narrow the requirements down from &quot;find defective cookies&quot; to &quot;identify these particular precisely-defined categories of defects&quot;.  You will also want to define allowable failure rates (and how much you prefer false positives vs. false negatives) if you want to have a requirement that can actually be met.  Once you have that, you can start designing the optics and lighting you will need to acquire images that highlight the various defects.  This might require more than one imaging operation, as different lighting/optical conditions will highlight different features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the above is done, you can start capturing images; once you have images, you can start to explore what vision tools will work for identifying the various defect categories you defined previously.  A few thoughts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Identify cookie shape/size.  A back-light is often ideal for this kind of application, but you can sometimes get away with more direct lighting if you have a good even background that is easy to identify.  Your first goal is to separate the cookie from the background; next, you can use a tool like &lt;a href=&quot;http://code.google.com/p/cvblob/&quot; rel=&quot;nofollow&quot;&gt;Blob Analysis&lt;/a&gt; to look at the distribution of the cookie's shape.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Look for cracks.  Here you will want to investigate edges.  Using the segmented image from above (so you know what part of the image is 'cookie'), you use various edge filters, like the &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.html&quot; rel=&quot;nofollow&quot;&gt;Sobel operator&lt;/a&gt;, to identify areas with sharp transitions.  You would then want to experiment with various 'normal' and 'cracked' cookies to understand how the edges vary between them.  You might be able to look at a threshold for the total intensity of edges in the cookie to classify a defect, but this is something that will require more investigation before you can make a good design decision.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;One side note: the process of designing lighting/optics, taking images, designing/implementing algorithms, and testing their results is, in practice, an iterative one.  You will learn from your experiments what areas you need to improve and will make adjustments to your earlier imaging system designs to better achieve the results you're after.  You will also likely discover new categories of defects or new ways that the system behavior can change that you did not anticipate.  A long-term systems approach to this kind of task involves a lot of ongoing monitoring and data gathering to characterize the performance of the system over time.  You might find interesting trends like an increase in failures between 1:00 and 3:00 pm, when external light comes through a window and happens to interfere with your processing, for instance.&lt;/p&gt;&#xA;" OwnerUserId="4573" LastEditorUserId="4573" LastEditDate="2013-05-17T14:00:43.893" LastActivityDate="2013-05-17T14:00:43.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9160" PostTypeId="2" ParentId="8488" CreationDate="2013-05-17T15:41:51.443" Score="2" Body="&lt;p&gt;(A month later) there are two main choices for any interpolation method:&lt;br&gt;&#xA;1) the number of data points nearest the missing point to use, $Nnear$ 2 4 6 ...&lt;br&gt;&#xA;2) the class of basis functions to use: linear, polynomial,&#xA;sine-cosine (Fourier),&#xA;piecewise cubic (B-spline or interpolating spline), sinc-like ...&lt;br&gt;&#xA;(Choice 0 is whether to use somebody else's method and code, or do-it-yourself.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fitting a straight line to $Nnear$ points is easy:&lt;br&gt;&#xA;2 points [-1, $y_{-1}$], [1, $y_1$ ]:&lt;br&gt;&#xA;$\qquad$ estimate $ y_0 \sim (y_{-1} + y_1) / 2 $&lt;br&gt;&#xA;points $[x_i, y_i]$ with average $x_i = 0$:&lt;br&gt;&#xA;$ \qquad y_0 \sim$ average $y_i$&lt;br&gt;&#xA;general $[x_i, y_i]$:&lt;br&gt;&#xA;$\qquad$ see e.g.&#xA;&lt;a href=&quot;http://apps.nrbook.com/empanel/index.html?pg=781&quot; rel=&quot;nofollow noreferrer&quot;&gt;Numerical Recipes&lt;/a&gt; p. 781:&#xA;fit a line $a + b x$&#xA;and estimate $ y_0 \sim a $.&lt;br&gt;&#xA;$\qquad$ One can fit quadratics, cubics, sine-cosines ... in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that you have uniformly-spaced data with a few points missing,&#xA;is that right ?&lt;br&gt;&#xA;How well does linear interpolation work for this case ?&lt;br&gt;&#xA;Well, let's try cos $ 2 \pi f t$ with $f$ = 0.25: 1 0 -1 0 1 0 -1 0 ...&lt;br&gt;&#xA;2 neighbors of any point average to 0, terrible.&lt;br&gt;&#xA;4 neighbors: average of [ 1 0 (missing -1) 0 1] = 1/2, terrible.&lt;br&gt;&#xA;(Try the 4-neighbor filter [-1 3 3 -1] / 4 on this.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linear interplation with 4 or 6 or 8 neighbors might work well enough&#xA;for your data.&lt;br&gt;&#xA;I'd suggest starting with a method that you understand&#xA;thoroughly before diving into splines, sinc-like ...&#xA;although those can be fun too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;Another, quite different method is&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Inverse_distance_weighting&quot; rel=&quot;nofollow noreferrer&quot;&gt;Inverse distance weighting&lt;/a&gt; .&#xA;It's easy to implement&#xA;(see &lt;a href=&quot;https://stackoverflow.com/questions/3104781/inverse-distance-weighted-idw-interpolation-with-python&quot;&gt;idw-interpolation-with-python&lt;/a&gt; on SO), works in 2d 3d and up too,&#xA;but is afaik hard to analyze theoretically.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Obviously, &lt;em&gt;NO&lt;/em&gt; single interpolation method can possibly fit&#xA;the zillions of combinations of&lt;br&gt;&#xA;[signal, noise, error metric, test function]&#xA;that occur in reality.&lt;br&gt;&#xA;There are more methods in the world, with more knobs,&#xA;than test functions.&lt;br&gt;&#xA;Nonetheless a gallery of methods and test functions might be useful.)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2013-05-20T10:37:49.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9161" PostTypeId="1" CreationDate="2013-05-17T16:56:14.773" Score="11" ViewCount="586" Body="&lt;p&gt;Suppose there is a DFT vector $\mathbf{X}$ with length N, which presents complex conjugate symmetry around its middle point, i.e., $X(1) = X(N-1)^*$, $X(2) = X(N - 2)^*$ and so forth.  $X(0)$ and $X(N/2)$ are the DC and Nyquist frequency respectively, therefore are real numbers. The remaining elements are complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose there is a matrix $\mathbf{T}$, with size $N \times N$, which multiplies vector X.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{Y} = \mathbf{T}\mathbf{X}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In what conditions, for matrix $\mathbf{T}$, the complex conjugte symmetry around the middle point of the resulting vector $\mathbf{Y}$ is preserved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motivation for this question is trying to come up with a precoder matrix $\mathbf{T}$ that results in a precoded (pre-equalized) symbol $\mathbf{Y}$ whose IFFT is real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks @MattL. and @niaren.&#xA;The difficulty about this question is to find necessary conditions. Matt's answer is indeed sufficient. It is also sufficient to make the following modifications:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first row and the first column do not need to be zero. Instead, they could be non-zero, as long as its values present a complex conjugate symmetry around the middle point, its first value is real and its $(N/2+1)$-th value is real, just like the symbol. The same could be stated for the $(N/2+1)$-th column, the $(N/2+1)$-th row, and the main diagonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, the same correspondence between the matrix in the upper left corner and lower right corner could be made between the upper right corner and the lower left corner, that is, chose an $(N/2 -1)\times(N/2-1)$ matrix starting from $t_{2,N/2 + 2}$ to $t_{N/2,N}$, flip from left to right, flip upside down and take the conjugate, then put at the lower left corner. On MATLAB, that would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T(N/2+2:N,2:N/2) = conj(fliplr(flipud(Tisi(2:(N/2),N/2+2:N))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This structure is similar to the structure of the DFT matrix. Would that be a necessary condition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT(2):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code implements such a valid operator for any real-valued $N \times N$ matrix $\mathbf{A}$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 8;  &#xA;A = rand(N,N); %must be real-valued  &#xA;w = exp(-1j*2*pi/N); % twiddle factor  &#xA;W = w.^(repmat(0:N-1,N,1).*repmat(0:N-1,N,1).'); % DFT matrix  &#xA;T = W*A*W'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT(3):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also interesting to note the $\mathbf{T}^{-1}$ presents the sufficient condition too. This comes from the fact that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{T}^{-1} &amp;amp;= \mathbf{\left(W A W^{H}\right)}^{-1}\\&#xA; &amp;amp;= \mathbf{\left(W^{H}\right)}^{-1} \mathbf{A}^{-1} \mathbf{W}^{-1} &#xA;\end{align}&#xA;where $\mathbf{W}$ is the DFT matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $\mathbf{W^{H}} = N\mathbf{W}^{-1}$. This equation becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{T}^{-1} &amp;amp;= \left(N\mathbf{W}^{-1}\right)^{-1} \mathbf{A}^{-1} \frac{1}{N}\mathbf{W^{H}}\\&#xA;&amp;amp;= \mathbf{W} \mathbf{A}^{-1} \mathbf{W^{H}}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, since $\mathbf{A}^{-1}$ is real-valued, provided that $\mathbf{A}$ is full rank,$\mathbf{T}^{-1}$ is sufficient. &lt;/p&gt;&#xA;" OwnerUserId="4590" LastEditorUserId="8202" LastEditDate="2014-06-12T08:20:49.967" LastActivityDate="2018-08-21T20:01:44.490" Title="Conditions for precoding matrix to preserve complex conjugate symmetry on DFT vector" Tags="|dft|equalization|linear-algebra|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9162" PostTypeId="2" ParentId="9161" CreationDate="2013-05-17T17:48:04.477" Score="-1" Body="&lt;p&gt;If I'm not mistaken the only solution for $\mathbf{T}$ which is independent of the vector $\mathbf{X}$ is a diagonal (complex) matrix, where the diagonal satisfies the complex conjugate symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; OK, I was mistaken. Diagonal is fine, but it's not necessary. The matrix $\mathbf{T}$ must have the following general structure: elements $t_{11}$ and $t_{N/2+1,N/2+1}$ must be real-valued (they correspond to DC and Nyquist). Apart from $t_{11}$ the first row and column contains only zeros. For elements $t_{22}$ to $t_{N/2,N/2}$ chose an arbitray $(N/2-1)\times (N/2-1)$ matrix. Then use this arbitray matrix to form a new matrix by swapping all rows (the first row becomes the last one, the second row becomes the second last one, etc.), by flipping the rows from left to right, and by conjugating. Then put this submatrix in the lower right corner of the total matrix $\mathbf{T}$. All other elements of $\mathbf{T}$ must be zero. I'm aware that this is a bit tough to understand without a visualization, so I'll add one later on when I have more time.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-17T19:11:23.333" LastActivityDate="2013-05-17T19:11:23.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9163" PostTypeId="2" ParentId="9161" CreationDate="2013-05-17T17:50:26.720" Score="3" Body="&lt;p&gt;I think that the entries in your matrix $\bf{T}$ must obey $a_{N-n+1,N-m+1} = a^*_{n,m}$.&#xA;This is saying that the entries in row $N-n+1$ are the same as the coefficients in row n but where the coefficients are conjugated and reversed. The pattern in $\bf{T}$ for $N=4$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T_4 = \left[ \begin{smallmatrix} a_{11}&amp;amp;a_{12}&amp;amp;a_{13}&amp;amp;a_{14}\\ a_{21}&amp;amp;a_{22}&amp;amp;a_{23}&amp;amp;a_{24} \\ a^*_{24}&amp;amp;a^*_{23}&amp;amp;a^*_{22}&amp;amp;a^*_{21} \\ a^*_{14}&amp;amp;a^*_{13}&amp;amp;a^*_{12}&amp;amp;a^*_{11}\end{smallmatrix} \right]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure someone will come up with a better and more precise answer.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-05-17T17:50:26.720" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9165" PostTypeId="1" AcceptedAnswerId="9169" CreationDate="2013-05-17T19:03:08.047" Score="3" ViewCount="317" Body="&lt;p&gt;I'm processing audio signal sampled at 44.1 kHz. After some other processing, I need to filter the signal between ~5-50 Hz. Achieving this for a signal with such a high sampling frequency appears to be difficult. I would like the magnitude response to be nicely flat within the bass-band. No phase distortion is allowed. I'm using MATLAB toolbox fdatool for the filter design, FIR filter created with least squares approximation. After some testing, I found out I could get better magnitude responses if I first decimate the signal with some small factor, and then to do the final filtering. Is this a common thing to be done (how about in scientific research, I'm trying to do this the right way..)? All help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4592" LastActivityDate="2013-05-18T01:12:04.103" Title="Multiple filters or not?" Tags="|discrete-signals|filter-design|frequency-response|bandpass|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9167" PostTypeId="1" AcceptedAnswerId="9173" CreationDate="2013-05-17T20:51:42.887" Score="3" ViewCount="653" Body="&lt;p&gt;Adobe Acrobat has this as a feature called &lt;a href=&quot;http://blogs.adobe.com/acrolaw/2009/05/better_pdf_ocr_clearscan_is_smal/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ClearScan&lt;/a&gt;. While doing OCR it allows image enhancement, by smoothing irregularities on font outlines.&lt;/p&gt;&#xA;&lt;p&gt;For example, this source:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L5LXq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;turns to this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2iwyD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Are there other tools with such feature, or public algorithms (Matlab/Python) that can smooth contours of arbitrary font-like objects?&lt;/p&gt;&#xA;" OwnerUserId="719" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2017-01-30T09:59:48.880" Title="Smoothing &quot;font characters&quot; outlines in bitmap image" Tags="|image-processing|image-segmentation|ocr|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9169" PostTypeId="2" ParentId="9165" CreationDate="2013-05-18T00:22:26.860" Score="1" Body="&lt;p&gt;Your goal should be achievable. The key driver for the filter's complexity is the size of the transition band, which you haven't specified. If you can live with a slow rolloff, then you can use a relatively low order filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, as is more likely, you want to isolate the band from 5 to 50 Hz with relatively sharp cutoffs, then as you have started to discover, you will want to use a multi-stage approach. Instead of decimating by a factor of several hundred all at once, you decimate by a series small factors (something like 2, 4, or 8). By gradually decreasing the sample rate, you end up with filter designs that are much less complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8760/oversampling-then-filtering-and-downsampling&quot;&gt;This previous question&lt;/a&gt; has a very similar aim to yours, only with slightly different filter specs and sample rate. You should be able to adapt the information there to your application.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-05-18T00:22:26.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9170" PostTypeId="2" ParentId="9165" CreationDate="2013-05-18T01:12:04.103" Score="0" Body="&lt;p&gt;Yes, decimating first is the most common approach.  I would do something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Decimate x10: new fs = 4410, passband = 50 Hz, cutoff = 2205 (new Nyquist frequency)&#xA;Decimate x10: new fs = 441, passband = 50 Hz, cutoff = 220&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could do more decimation or just leave it at that point.  It should be relatively easy to get the filter characteristics you want at that point, and the computational load will be greatly reduced.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-05-18T01:12:04.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9172" PostTypeId="2" ParentId="9110" CreationDate="2013-05-18T01:36:25.803" Score="3" Body="&lt;p&gt;There aren't many general signal processing books that follow a strictly mathematical (i.e. theorem/proof) style. &lt;a href=&quot;http://books.google.com/books?id=MtPLYXQ9d9MC&amp;amp;lpg=PA441&amp;amp;dq=%22ima%20volumes%20in%20mathematics%20and%20its%20applications%22%20blahut&amp;amp;pg=PP1#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;The Mathematics of Signal Processing&lt;/a&gt; by Damelin and Miller might be exactly what you have in mind though.&#xA;From the preface:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Basically, this is a book about mathematics...where ideas from signal&#xA;  processing are used to motivate much of the material, and applications&#xA;  of the theory to signal processing are featured. It is meant for math&#xA;  students who are interested in potential applications of mathematical&#xA;  structures and for students from the fields of application who want to&#xA;  understand the mathematical foundations of their subject.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-05-18T01:36:25.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9173" PostTypeId="2" ParentId="9167" CreationDate="2013-05-18T02:02:33.023" Score="4" Body="&lt;p&gt;I think the open-source command-line program &lt;a href=&quot;http://potrace.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;potrace&lt;/a&gt;, might do what you want.  It converts bitmaps to bezier curves and has a bunch of options allowing you to trade off smoothness and accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The open-source &lt;a href=&quot;http://inkscape.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Inkscape vector (svg) editor&lt;/a&gt; has potrace built in (under the Path-&gt;Trace Bitmap menu option.)  The result of applying your example in Inkscape, (I used the mode Inkscape calls &quot;Brightness cutoff&quot; with the default threshold of .45, since your image was already black-and-white rather than grayscale) scaling the size of the resulting bezier curves up a bit, and then having Inkscape output a bitmap is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oxPZn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the cute side-effects of converting to bezier and then back to grayscale is that you get nice anti-aliasing around the curves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With grayscale input images I find that the &quot;Edge detection&quot; mode works a little better.  There are also options for choosing less or more smoothing, and less or more speckle elimination.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-05-18T02:02:33.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9174" PostTypeId="1" AcceptedAnswerId="9176" CreationDate="2013-05-18T12:35:25.950" Score="0" ViewCount="763" Body="&lt;p&gt;I want to select a random sub-block of 8x8 out of an image 256x256. Is there an instruction that do this thing or i need to calculate it with a different approach. I found how to choose a galois field array out of a  matrix but i think this is not in my case what i need.&lt;/p&gt;&#xA;" OwnerUserId="4273" LastActivityDate="2013-05-18T12:56:35.767" Title="Random selection of sub-block in an image with matlab" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9175" PostTypeId="2" ParentId="1656" CreationDate="2013-05-18T12:40:07.940" Score="1" Body="&lt;p&gt;&lt;strong&gt;Projection onto 1D&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is similar to what I use, it is an attempt to project the 2D spectrum onto 1D. That is, it tries to perform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{f}_{pol}(r) = \int_{0}^{2\pi} \hat{f}(r,\theta) \, d\theta $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $[u,v] = [r \cos\theta, r \sin\theta]$ and $u,v$ are the spectrum coordinates. There is a section in the code where the spectrum is multiplied by $r$, this is to try to adjust for the interpolation errors close to the centre due to discretisation. The 1D projections can then be compared between images.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all&#xA;&#xA;% Image&#xA;I = imread('cameraman.tif');&#xA;imagesc(I); colormap gray; title('Original image'); pause;&#xA;&#xA;% Fourier transform&#xA;F = ifftshift(fft2(I))./rows./cols;&#xA;&#xA;% Show spectrum (log)&#xA;imagesc(log(abs(F))); title('Fourier transform (abs log)'); pause;&#xA;&#xA;% Grid of FFT coordinates&#xA;[rows, cols] = size(F);&#xA;[ux, uy] = meshgrid(([1:cols]-(fix(cols/2)+1))/(cols-mod(cols,2)), ...&#xA;    ([1:rows]-(fix(rows/2)+1))/(rows-mod(rows,2)));&#xA;&#xA;% Convert to polar coordinates&#xA;th = atan2(uy,ux);&#xA;r = sqrt(ux.^2 + uy.^2);&#xA;&#xA;% Convert to polar coordinates&#xA;Fr = F .* r;&#xA;imagesc(abs(Fr)); title('Fourier transform x radius'); pause;&#xA;rcoords = linspace(0,sqrt(ux(1,1)^2 + uy(1,1)^2),rows);&#xA;thcoords = linspace(0,2*pi,cols);&#xA;[ri,thi] = meshgrid(rcoords,thcoords);&#xA;[x,y] = pol2cart(thi,ri);&#xA;Fp = interp2(ux,uy,abs(Fr),x,y);&#xA;imagesc(Fp); title('Fourier transform in polar coordinates'); pause;&#xA;&#xA;% Sum columns to give 1D projection&#xA;F1D = sum(Fp);&#xA;plot(rcoords,F1D); title('Projection onto 1D'); xlim([0 0.5]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-18T12:40:07.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9176" PostTypeId="2" ParentId="9174" CreationDate="2013-05-18T12:42:08.367" Score="2" Body="&lt;pre&gt;&lt;code&gt;r = randi(256-7);&#xA;c = randi(256-7);&#xA;&#xA;subblock = I(r:r+7, c:c+7);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2013-05-18T12:56:35.767" LastActivityDate="2013-05-18T12:56:35.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9177" PostTypeId="2" ParentId="9156" CreationDate="2013-05-18T14:00:22.343" Score="5" Body="&lt;p&gt;If we have a second-order discrete-time system with complex conjugate poles at $z_{\infty}=re^{\pm j\theta}$, $0&amp;lt;r&amp;lt;1$, $0&amp;lt;\theta&amp;lt;\pi$ (i.e. with poles inside the unit circle and no poles on the real axis), then we have a transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{1-2r\cos \theta z^{-1} + r^2z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the moment we assume there are no zeros away from the origin of the $z$-plane. The step response of such a system is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(n)=\frac{1}{1-2r\cos \theta + r^2}\left [1+&#xA;\frac{r^{n+2}\sin[\theta(n+1)] - r^{n+1}\sin[\theta(n+2)] }{\sin\theta} \right ]\sigma(n) =$$&#xA;$$=a_{\infty}[1+d(n)]\sigma(n)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\sigma(n)$ is the Heaviside step function, $a_{\infty}$ is the value of the step response for $n\rightarrow\infty$, and $d(n)$ corresponds to the ringing of the step response. Consequently, the maximum overshoot of $a(n)$ corresponds to the maximum of $d(n)$. You could try with Mathematica to see if there is an analytic solution for the (largest local) maximum of $d(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the system has zeros away from the origin of the $z$-plane, then $H(z)$ has a numerator polynomal $b_0+b_1z^{-1}+b_2z^{-2}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{b_0+b_1z^{-1}+b_2z^{-2}}{1-2r\cos \theta z^{-1} + r^2z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case the formula for the step response given by (1) still holds with&#xA;$$a^{\prime}_{\infty}=a_{\infty}\sum_kb_k$$ and with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d^{\prime}(n)=\frac{(d*b)(n)}{\sum_kb_k}=\frac{b_0d(n)+b_1d(n-1)+b_2d(n-2)}{\sum_kb_k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may be even more difficult to find an analytic solution for the maximum of $d^{\prime}(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So unfortunately I cannot give a plug-and-play formula for the maximum overshoot, but my intent was to give you some analytical results to experiment with, either with Mathematica, or by using some very simple numerical search strategies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If everything else fails (Mathematica etc.), I would simply compute $a_{\infty}$ by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_{\infty}=\frac{b_0+b_1+b_2}{1+a_1+a_2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then actually compute the filter output (e.g. with Matlab's $\tt{filter}$ function), feeding the filter with a step, until you have found the first maximum of the output signal $a_{max}$. The overshoot is then given by $\frac{a_{max}}{a_{\infty}}$. But this may be obvious to you anyway.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-18T14:00:22.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9178" PostTypeId="1" CreationDate="2013-05-18T15:04:01.260" Score="0" ViewCount="2150" Body="&lt;p&gt;I am trying to track small object in videos using LK &#xA;but the problem is, some time the object does not appear in the frames ! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I track an object that does not appear in few frames ?? &#xA; how can I approximate it is place automatically ,,,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to find the object using Optical flow LK ... but this technique lost when my   object does not appear &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion ideas ??? &lt;/p&gt;&#xA;" OwnerUserId="4463" LastActivityDate="2013-05-18T19:29:18.990" Title="Tracking object that is missing in some frames" Tags="|opencv|tracking|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9179" PostTypeId="1" CreationDate="2013-05-18T15:42:23.210" Score="4" ViewCount="4578" Body="&lt;p&gt;What does the spectrum of a sampled signal look like if one uses a zero-order-hold?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is some information in:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1409/sampling-theorem-and-dirac-comb&quot;&gt;Sampling theorem and Dirac comb&lt;/a&gt;, but I am wondering, how to apply this in practice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting with an analytic spectrum I generated a time signal and recalculated the spectrum and it fits quite well. In a next step I used a moving average for the time signal and again calculated the spectrum. The moving average filter can be considered as a convolution with a rectangular window. For the Fouier Transform this is simply a multiplication and finally the analytical spectrum can be found by multiplying the original spectrum with the sinc function and its conjugate. The spectrum based on the data again fits quite well to the analytical spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am unable to find a similar solution for the signal sampled with the zero-order-hold.&#xA;Some help would be highly appreciated :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below the matlab code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; close all;clc&#xA;%% Configuration&#xA;T_max           = 2^9;      % [s]&#xA;f_max           = 2^2;      % [Hz]&#xA;fs              = f_max*2^2;% [Hz] Nyquist–Shannon sampling theorem: fs&amp;gt;=f_max*2&#xA;SampleLength    = 2^4;      % [-]&#xA;%% Analytical Spectra &#xA;df              = 1/T_max;&#xA;f               = [df:df:f_max];&#xA;n_FFT           = fs/df;&#xA;dt              = 1/fs;&#xA;t               = 0:dt:T_max-dt;&#xA;T               = SampleLength*dt;&#xA;%-----------&#xA;S               = 1./(1+f.^2);&#xA;%-----------&#xA;RECT            = sinc(f*T);&#xA;X               = 1./(1+1i*f);&#xA;S_MAV           = X.*conj(X).*RECT.*conj(RECT);&#xA;%-----------&#xA;nk              = 2^7; % T_max/T seems be a better number&#xA;for ik=-nk:1:nk&#xA;    for jk=-nk:1:nk&#xA;        X_i                 = 1./(1+1i*(f-ik/T));&#xA;        X_j                 = 1./(1+1i*(f-jk/T));&#xA;        S_ZOH_ij(jk+nk+1,:) = RECT.*conj(RECT).*X_i.*conj(X_j)*(1/T/4);&#xA;    end&#xA;    S_ZOH_i(ik+nk+1,:)      = sum(S_ZOH_ij);&#xA;end&#xA;S_ZOH                   = sum(S_ZOH_i);      &#xA;%% Time Signals&#xA;phi             = rand(size(f))*2*pi;   % random phase shift&#xA;A               = sqrt(S/(1/2/df));     % Amplitudes&#xA;% time signal is a sum of all frequencies&#xA;x               = (A*cos(2*pi*f'*t+repmat(phi',1,n_FFT)));&#xA;% Moving AVerage&#xA;x_MAV           = filter(ones(1,SampleLength)/SampleLength,1,x);&#xA;% Zero Order Hold&#xA;x_ZOH           = reshape(repmat(x(1:SampleLength:end),SampleLength,1),1,[]);&#xA;%% Spectra from data&#xA;nBlocks             = 2^5;&#xA;nDataPerBlock       = floor(n_FFT/nBlocks/2)*2; % should be even&#xA;vWindow             = hann(nDataPerBlock);&#xA;%-----------&#xA;[S_D        f_D]    = pwelch(detrend(x,'constant'),     vWindow,[],[],fs);&#xA;[S_D_MAV    f_D]    = pwelch(detrend(x_MAV,'constant'), vWindow,[],[],fs);&#xA;[S_D_ZOH    f_D]    = pwelch(detrend(x_ZOH,'constant'), vWindow,[],[],fs);&#xA;%% Spectra via FFT&#xA;x_FFT       = fft(x,n_FFT);&#xA;X           = [x_FFT(1) 2*x_FFT(2:n_FFT/2) x_FFT(n_FFT/2+1)]/n_FFT;&#xA;S_FFT       = 1/2/df*X.*conj(X);&#xA;f_FFT       = 0:df:1/2*fs;   &#xA;%% Plots&#xA;figure('Name', 'Time')&#xA;hold on;grid on;box on;&#xA;plot(t,x,'.-');&#xA;plot(t,x_MAV ,'g');&#xA;plot(t,x_ZOH ,'o-r');&#xA;xlim([0 8])&#xA;xlabel('t [s]')&#xA;ylabel('x [-]')&#xA;legend('x','x_{MAV}','x_{ZOH}')&#xA;%-----------&#xA;figure('Name', 'Spectra')&#xA;hold on;grid on;box on;&#xA;plot(f_D,S_D,'LineWidth',3)&#xA;plot(f_D,S_D_MAV,'g','LineWidth',3)&#xA;plot(f_D,S_D_ZOH,'m','LineWidth',3)&#xA;plot(f,S,'c','LineWidth',1)&#xA;plot(f,S_MAV,'k','LineWidth',1)&#xA;plot(f,abs(S_ZOH),'r','LineWidth',1)&#xA;legend('S_{D}','S_{D,MAV}','S_{D,ZOH}','S','S_{MAV}','S_{ZOH}')&#xA;set(gca,'XScale','log')&#xA;set(gca,'YScale','log')&#xA;ylabel('S [1/Hz]')&#xA;xlabel('f [Hz]')&#xA;xlim([df*nBlocks f_max])&#xA;ylim([1e-4 1e1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Update&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I updated the code and we are getting closer (&lt;a href=&quot;https://i.stack.imgur.com/7UBvD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;). But there is still a problem with the scaling.&#xA;Starting with the Fourier transform&#xA;$$X(f)=\frac{1}{1+jf},$$&#xA;the auto spectrum is (omitting all scaling factors)&#xA;$$S(f)=X(f)X^*(f)=\frac{1}{1+f^2},$$&#xA;where $X^*(f)$ is the conjugate, we get with Matt's comment using $\omega=2\pi f$&#xA;$$X_{ZOH}(f)=e^{-j\pi f T}sinc(fT)\frac{2\pi}{T}\sum_{k=-\infty}^{k=\infty} X(f-\frac{k}{T})$$&#xA;and finally&#xA;$$S_{ZOH}(f)=X_{ZOH}(f)X_{ZOH}^*(f)=sinc^2(fT) \left(\frac{2\pi}{T}\right)^2 \left(\sum_{k=-\infty}^{k=\infty} X(f-\frac{k}{T})\right)\left(\sum_{k=-\infty}^{k=\infty} X^*(f-\frac{k}{T})\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $k$ I used only a limited number, but the last two brackets are still computational intensive. It there any shortcut?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The remaining problem is the scaling: It seems to be in some way depending on the sampling frequency. Does anyone have an idea?&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Update 2&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;By trial and error I found out, that the following Spectra is a good approximation with different sampling frequencies and hold times (&lt;a href=&quot;https://i.stack.imgur.com/B7WAk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;).&#xA;$$S_{ZOH}(f)=X_{ZOH}(f)X_{ZOH}^*(f)=sinc^2(fT) \left(\frac{1}{4T}\right) \left(\sum_{k=-\infty}^{k=\infty} X(f-\frac{k}{T})\right)\left(\sum_{k=-\infty}^{k=\infty} X^*(f-\frac{k}{T})\right).$$&#xA;Does anyone have an explication for the $\left(\frac{1}{4T}\right)$ term?&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Update 3&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I added a part calculating the spectrum via FFT. At least for the unfiltered spectrum it coincide with the original spectrum. So, I assume, there is no scaling introduced by the pwelch algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The line A=sqrt(S/(1/2/df)) I used to get the amplitudes out of the spectrum to generate the time signal. I am not really sure, but it is related to the fact, that the spectrum is only one-sided and I use the power for one $df$:&#xA;$$S(f)=\frac{A^2(f)}{2df}$$&#xA;Therefore, I don't think, it is the reason for the $\left(\frac{1}{4T}\right)$ term ...&lt;/p&gt;&#xA;" OwnerUserId="4583" LastEditorUserId="128" LastEditDate="2019-03-25T08:27:50.653" LastActivityDate="2019-03-25T08:27:50.653" Title="Spectrum of a Signal Going Through a Zero Order Hold Sampling System" Tags="|matlab|frequency-spectrum|sampling|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9181" PostTypeId="2" ParentId="9178" CreationDate="2013-05-18T19:29:18.990" Score="2" Body="&lt;p&gt;The short answer is: use your optical flow algorithm to get the best-fit warping of some number of previous images into your current image.  Then assume that your object is moving on a line through the images, and do some kind of robust best-fit to that line.  When the object reappears it is more likely to be near the predicted projection of the line than not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You didn't give enough specifics in your question to really say more than that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume by &quot;LK&quot; you mean &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Lucas%E2%80%93Kanade_method&quot; rel=&quot;nofollow&quot;&gt;the Lucas-Kanade optical flow algorithm&lt;/a&gt;?&quot;  But what are you really doing?  Are you taking image pyramids of each image and then doing multiple iterations of warping at each level of the pyramid?  Are you really doing the simplest form of Lucas-Kanade or are you actually doing one of the varieties of &lt;a href=&quot;http://en.wikipedia.org/wiki/Kanade%E2%80%93Lucas%E2%80%93Tomasi_Feature_Tracker&quot; rel=&quot;nofollow&quot;&gt;Kanade-Lucas-Tomasi&lt;/a&gt; where you are concentrating on &quot;corners&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is your description of an &quot;object&quot;?  Is it really just a &quot;feature&quot; (a corner point) or a small set of features?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may need to use a more accurate and robust optical flow algorithm.  For example, some variation that does dense estimation (rather than the sparse estimation done by Lucas-Kanade) and that uses more robust distance metrics than least squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cs.brown.edu/people/dqsun/pubs/cvpr_2010_flow.pdf&quot; rel=&quot;nofollow&quot;&gt;Secrets of optical flow estimation and their principles&lt;/a&gt;&#xA;Sun, D., Roth, S., and Black, M. J.,&#xA;IEEE Conf. on Computer Vision and Pattern Recog., CVPR, June 2010.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-05-18T19:29:18.990" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="9182" PostTypeId="2" ParentId="9179" CreationDate="2013-05-18T20:54:35.650" Score="5" Body="&lt;p&gt;The sampled time domain signal with a zero-order hold is a weighted pulse train convolved with the impulse response of the zero-order hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_n x(nT)\delta(t-nT) * \text{rect}(t-T/2,T/2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have the following Fourier transform pairs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_n x(nT)\delta(t-nT) \Longleftrightarrow \frac{1}{T}\sum_k X(f-\frac{k}{T})\\&#xA;\text{rect}(t-T/2,T/2)\Longleftrightarrow e^{-j\pi fT}T\text{sinc}(fT)&#xA;$$&#xA;with $\text{sinc}(x)=\sin(\pi x)/(\pi x)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplying the two transforms, we get for the Fourier transform of the sampled signal with zero-order hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{-j\pi fT}\text{sinc}(fT)\sum_k X(f-\frac{k}{T})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response of the zero-order hold attenuates the shifted versions of the spectrum $X(f)$ somewhat but does not really suppress them well.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-20T11:15:51.043" LastActivityDate="2013-05-20T11:15:51.043" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9183" PostTypeId="1" AcceptedAnswerId="9187" CreationDate="2013-05-19T04:37:08.593" Score="2" ViewCount="467" Body="&lt;p&gt;I have DSP in my curriculum. I kindly request suggestions on alternatives to MATLAB. Ideally, alternatives that are not as &amp;quot;heavy&amp;quot;, megabyte-wise.&lt;/p&gt;&#xA;" OwnerUserId="4580" LastEditorUserId="7092" LastEditDate="2023-11-21T22:03:30.873" LastActivityDate="2023-11-21T22:03:30.873" Title="In DSP, are there alternatives to MATLAB?" Tags="|matlab|discrete-signals|" AnswerCount="3" CommentCount="7" ClosedDate="2013-05-20T18:05:09.287" ContentLicense="CC BY-SA 4.0" />
  <row Id="9184" PostTypeId="2" ParentId="9183" CreationDate="2013-05-19T04:44:38.070" Score="2" Body="&lt;p&gt;I have found Scilab and sage as somewhat better alternative to the MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Sage: &lt;a href=&quot;http://www.sagemath.org/&quot; rel=&quot;nofollow&quot;&gt;http://www.sagemath.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Scilab : &lt;a href=&quot;https://www.scilab.org/&quot; rel=&quot;nofollow&quot;&gt;https://www.scilab.org/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4580" LastActivityDate="2013-05-19T04:44:38.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9186" PostTypeId="1" AcceptedAnswerId="9208" CreationDate="2013-05-19T10:57:49.577" Score="2" ViewCount="209" Body="&lt;p&gt;I'm a student studying communications engineering.  I'm trying to understand why this particular laser diode is made for 155 Mbps and 622 Mbps.  I'm thinking that the bitrate is entirely dependent upon the bandwidth of the photodiode.  I can see from the datasheet that $f_c = 2 \text{ GHz}$ and so what I'm thinking is that you could have, a 1 GHz carrier with around 2 GHz of data.  So wouldn't this allow for a 2 Gbps bitrate?  I'm just wondering if this thinking is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The datasheet can be found here:&#xA;&lt;a href=&quot;http://pdf1.alldatasheet.com/datasheet-pdf/view/95885/NEC/NX8503BG.html&quot; rel=&quot;nofollow&quot;&gt;Datasheet&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1146" LastActivityDate="2013-05-20T14:36:46.293" Title="Laser diode bitrate datasheet" Tags="|digital-communications|bandwidth|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9187" PostTypeId="2" ParentId="9183" CreationDate="2013-05-19T12:12:05.040" Score="3" Body="&lt;p&gt;Octave is a good option. Some people call it as a free version of Matlab. &#xA;I found Wolfram Mathematica to be of great use. It seems to be much more powerful than Matlab, not to mention, simpler to use. &lt;/p&gt;&#xA;" OwnerUserId="3520" LastActivityDate="2013-05-19T12:12:05.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9188" PostTypeId="2" ParentId="2708" CreationDate="2013-05-19T14:11:34.243" Score="2" Body="&lt;p&gt;A simple and general method for filling in missing data,&#xA;if you have runs of complete data, is to use&lt;br&gt;&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_regression&quot; rel=&quot;nofollow&quot;&gt;Linear regression&lt;/a&gt;.&#xA;Say you have 1000 runs of 5 in a row with none missing.&lt;br&gt;&#xA;Set up the 1000 x 1 vector y and 1000 x 4 matrix X:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y       X&#xA;wt[0]   wt[-2] wt[-1] wt[1] wt[2]&#xA;---------------------------------&#xA;68      67     70     70    68&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Regression will give you 4 numbers a b c d that give a best match&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wt[0] ~= a * wt[-2]  + b * wt[-1]  + c * wt[1]  + d * wt[2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;for your 1000 rows of data&lt;/em&gt; &amp;mdash; different data, different a b c d.&lt;br&gt;&#xA;Then you use these a b c d to estimate (predict, interpolate)&#xA;missing wt[0].&lt;br&gt;&#xA;(For human weights, I'd expect a b c d to be all around 1/4.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In python, see&#xA;&lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.lstsq.html&quot; rel=&quot;nofollow&quot;&gt;numpy.linalg.lstsq&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(There are zillions of books and papers on regression, at all levels.&#xA;For the connection with interpolation, though, I don't know of a good introduction; anyone ?)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="4389" LastEditDate="2013-05-21T18:01:09.847" LastActivityDate="2013-05-21T18:01:09.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9189" PostTypeId="1" AcceptedAnswerId="9200" CreationDate="2013-05-19T14:27:32.077" Score="1" ViewCount="830" Body="&lt;p&gt;How I can approximate the signal $x(t)=0.001\,t^3 \exp(-0.1t)$ in the interval $[0,100]$ using a linear combination of the following functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_1(t)=A_1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_2(t)=A_2\cos(0.05t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_3(t)=A_3\cos(0.1t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_4(t)=A_4\cos(0.2t+1)\exp(-0.2t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_5(t)=A_5\,t^3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to write a matlab code. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=[0:100];&#xA;x_t=0.001*(t.^3).*exp(-0.1*t); %signal given for aproximation&#xA;f1_t=x_t.^0;&#xA;f2_t=cos(0.05*x_t);&#xA;f3_t=cos(0.1*x_t);&#xA;f4_t=cos(0.2*x_t+1).*exp(-0.2*x_t);&#xA;f5_t=x_t.^3;&#xA;M=[f1_t' f2_t' f3_t' f4_t' f5_t']; %matrix with linear components&#xA;A=M\x_t'; %matrix with coefficients&#xA;f_t=(A(1)*f1_t)+(A(2)*f2_t)+(A(3)*f3_t)+(A(4)*f4_t)+(A(5)*f5_t);&#xA;figure(1),plot(f_t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4273" LastActivityDate="2013-05-19T22:17:01.917" Title="Signal approximation using linear combination of functions" Tags="|matlab|homework|continuous-signals|approximation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9190" PostTypeId="1" AcceptedAnswerId="9192" CreationDate="2013-05-19T15:33:13.523" Score="0" ViewCount="1451" Body="&lt;p&gt;When we perform DCT transform using matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; number_of_sample_data = 100;&#xA; f=0.1; %frequency&#xA; fs=1; %sampling rate &#xA; phi_0=0&#xA; t=0:1/fs:((number_of_sample_data-1)*1/fs); %generate 100 samples&#xA; x=sin(2*pi*f*t+phi_0);&#xA;dct_transform=dct(x); %perform discrete cosine transform&#xA;figure(1), stem(dct_transform);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this piece of code will plot the magnitude of coefficients against frequencies or something else?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-05-19T16:00:24.710" LastActivityDate="2013-05-19T16:10:19.433" Title="Plot the magnitude of coefficients against frequencies of DCT transform" Tags="|matlab|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9191" PostTypeId="1" CreationDate="2013-05-19T15:39:59.237" Score="1" ViewCount="351" Body="&lt;p&gt;Suppose there is a DFT vector $\mathbf{X}$ with length N, which presents complex conjugate symmetry around its middle point, i.e., $X(1) = X(N-1)^*$, $X(2) = X(N - 2)^*$ and so forth.  $X(0)$ and $X(N/2)$ are the DC and Nyquist frequency respectively, therefore are real numbers. The remaining elements are complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose there is a matrix $\mathbf{T}$, with size $N \times N$, which multiplies vector X.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{Y} = \mathbf{T}\mathbf{X}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the operator $\mathbf{T}$ preserves the complex conjugate symmetry in $\mathbf{Y}$ (see &lt;a href=&quot;https://dsp.stackexchange.com/questions/9161/conditions-for-precoding-matrix-to-preserve-complex-conjugate-symmetry-on-dft-ve&quot;&gt;Conditions for precoding matrix to preserve complex conjugate symmetry on DFT vector&lt;/a&gt; for more details), how can I obtain the same &quot;positive frequencies&quot; (from $X(0)$ to $X(N/2)$), using an $(N/2 + 1) \times (N/2 +1)$ matrix $\mathbf{T}$, instead of an $N \times N$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motivation for this question is to reduce complexity in the operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider that $X$ is a DMT symbol and its elements are mapped from QAM constellations with different sizes. Consider also that only the positive frequencies carry useful information, the &quot;negative&quot; frequencies are only used for the IFFT to be real. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Is there a low-complexity solution other than using the $N/2+1$ upper rows of $\mathbf{T}$ multiplying the length-$N$ vector $\mathbf{X}$? This reduces the complexity to $N(N/2+1)$ CMACS plus the operations required to assemble the hermitian symmetric symbol&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT(2):&lt;/strong&gt;&#xA;I suggest the following code to illustrate the problem:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 8;  &#xA;A = rand(N,N); %must be real-valued  &#xA;w = exp(-1j*2*pi/N); % twiddle factor  &#xA;W = w.^(repmat(0:N-1,N,1).*repmat(0:N-1,N,1).'); % DFT matrix  &#xA;T = W*A*W' % Linear operator  &#xA;x =  fft(rand(8,1));  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is obviously clear that:&lt;br&gt;&#xA;   T(1:N/2+1,:)&lt;em&gt;x&lt;br&gt;&#xA;Returns the positive frequencies from:&lt;br&gt;&#xA;   T&lt;/em&gt;x&lt;br&gt;&#xA;However,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;x(1:N/2+1)&lt;/code&gt;, what linear operator (with size $(N/2 + 1) \times (N/2 + 1)$) should I use to obtain the positive frequencies?&lt;/p&gt;&#xA;" OwnerUserId="4590" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-05-29T18:19:50.770" Title="How can a linear operator on DFT vector produce the same vector using only half of the DFT vector?" Tags="|dft|linear-algebra|symmetry|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9192" PostTypeId="2" ParentId="9190" CreationDate="2013-05-19T15:52:04.067" Score="1" Body="&lt;p&gt;Actuually, that code doesn't work without defining axis t variable, and frequency f, regarding to what that code does, is simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=sin(2*pi*f*t);        %x is a sinusoidal vector of frequency f and length t;&#xA;dct_transform=dct(x);   %dct_transform is a vector containing the unitary discrete transform of x&#xA;figure(1), plot(dct_transform); %plots the the unitary discrete transform of the sinusoid against default axis in Matlab&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you are just plotting the discrete transform vector against sample position, wish is what Matlab does by default. &lt;/p&gt;&#xA;" OwnerUserId="3793" LastEditorUserId="3793" LastEditDate="2013-05-19T16:10:19.433" LastActivityDate="2013-05-19T16:10:19.433" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9193" PostTypeId="1" AcceptedAnswerId="9196" CreationDate="2013-05-19T17:34:29.823" Score="-2" ViewCount="99" Body="&lt;p&gt;I want to found how many elements in an array is not equal to zero. I use this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=sum(img_dct~=0);&#xA;z=sum(y);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can i make this with a different way? Is there a matlab instruction like 'numel' that can do the job?&lt;/p&gt;&#xA;" OwnerUserId="4273" LastActivityDate="2013-05-22T14:16:09.343" Title="Number of elements of an array" Tags="|matlab|" AnswerCount="4" CommentCount="1" ClosedDate="2013-06-08T15:17:30.737" ContentLicense="CC BY-SA 3.0" />
  <row Id="9194" PostTypeId="1" AcceptedAnswerId="9197" CreationDate="2013-05-19T17:45:52.160" Score="14" ViewCount="4152" Body="&lt;p&gt;I would like to start learning audio signal processing. There are numerous books online and academic papers all of which seem to skip the fundamentals of the topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know a rough roadmap, so to speak, to follow in order to successfully learn audio signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read that calculus is the first step before starting with signal analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It feels to me like audio signal analysis is only one part of the overall knowledge needed. Where other topics are music theory, audio engineering and programming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I may ask people with knowledge on this area to suggest possible steps towards understanding how to analyse and manipulate/create audio signals.&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2013-06-27T23:34:42.547" LastActivityDate="2013-07-04T05:47:25.373" Title="Learning roadmap for the audio signal processing beginner" Tags="|audio|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9195" PostTypeId="2" ParentId="9193" CreationDate="2013-05-19T17:57:47.347" Score="1" Body="&lt;p&gt;You should get the number of how many elements are not equal to zero directly by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z=sum(img_dct~=0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4583" LastActivityDate="2013-05-19T17:57:47.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9196" PostTypeId="2" ParentId="9193" CreationDate="2013-05-19T18:13:42.857" Score="3" Body="&lt;p&gt;You can do it in one command by first using the colon operator to cast the matrix to a column vector.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z = sum(img_dict(:) ~= 0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-19T18:13:42.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9197" PostTypeId="2" ParentId="9194" CreationDate="2013-05-19T18:21:53.417" Score="18" Body="&lt;p&gt;I recommend having a look at &lt;a href=&quot;http://ccrma.stanford.edu/~jos/pasp/&quot; rel=&quot;noreferrer&quot;&gt;Prof. Julius O. Smith III's &lt;em&gt;Physical Audio Signal Processing&lt;/em&gt;&lt;/a&gt;. It's available online, or can be purchased through Amazon's print-on-demand service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, the description in the &lt;a href=&quot;http://ccrma.stanford.edu/~jos/pasp/Book_Series_Overview.html&quot; rel=&quot;noreferrer&quot;&gt;Book Series Overview&lt;/a&gt; might be worthwhile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nICLa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-05-19T18:21:53.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9200" PostTypeId="2" ParentId="9189" CreationDate="2013-05-19T22:17:01.917" Score="3" Body="&lt;p&gt;The method you chose is a standard least squares approximation, i.e. you minimize the sum of squared errors on the chosen grid. You obtain your coefficients by solving an overdetermined system of linear equations in a least squares sense. I think that's a very sane approach.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-19T22:17:01.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9201" PostTypeId="2" ParentId="9191" CreationDate="2013-05-20T01:06:12.870" Score="1" Body="&lt;p&gt;I've suggested in the comments above (and I think Matt L is trying to say the same thing also) that you should be able to just discard the negative frequency elements entirely for your analysis. They don't seem to be relevant to what you're doing (which makes sense, since they don't carry any information, as the time-domain signal is real). Look at your equation again:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{y} = \mathbf{Tx}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I changed the casing so that lower-case symbols are vectors and upper-case are matrices, as is the typical convention)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume for the time being that $\mathbf{x}$ and $\mathbf{y}$ are length-$N$ and thus $\mathbf{T}$ is $N$-by-$N$. This would correspond to the general case, where the time-domain signals corresponding to $\mathbf{x}$ and $\mathbf{y}$ need not be real. If $\mathbf{y}$ is a column vector, then you can think of the matrix operation instead as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{y} = \sum_{k=1}^N x_k\mathbf{t_k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_k$ is the $k$-th element of the vector $\mathbf{x}$ and $\mathbf{t_k}$ is the $k$-th column of the matrix $\mathbf{T}$. My question at this point would be, instead of using the full $N$-length vector and $N$-by-$N$ matrix, why not just use the $N/2$ rows that contain information? Then, the calculation would turn into:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{y^+} = \sum_{k=1}^{N/2} x_k\mathbf{t_k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(neglecting the details of the boundary cases for the zeroth and Nyquist bins, which depend upon whether $N$ is even or odd)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting vector $\mathbf{y^+}$ contains the positive frequencies for the desired result. You can then just symmetrically extend it to get a full length-$N$ vector that has the conjugate symmetry that you seek. This should make intuitive sense in the following ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If there is no information in the negative frequencies in the input vector $\mathbf{x}$ (which there isn't, since the entire vector is defined by its positive frequency components), then you shouldn't need to use them in your calculations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If there is no information in the negative frequencies in the output vector $\mathbf{y}$ (which there isn't, since the entire vector is defined by its positive frequency components), then you shouldn't need to waste time calculating what their values would be.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This should free you from worrying about any bizarre constraints on the properties of the matrix $\mathbf{T}$. I think you're trying to think of the action of the precoder as too coupled with the OFDM modulation. Instead, think of it just as a preprocessing operation that happens on the encoded symbols before you assign them to frequency bins in the OFDM modulator's IDFT.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-20T01:06:12.870" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="9202" PostTypeId="2" ParentId="3066" CreationDate="2013-05-20T03:17:52.810" Score="4" Body="&lt;p&gt;A simple method that often works is to apply a median filter.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-20T03:17:52.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9203" PostTypeId="1" AcceptedAnswerId="36394" CreationDate="2013-05-20T06:49:33.243" Score="5" ViewCount="1136" Body="&lt;p&gt;I am doing 1D wavelet decomposition and I am particularly interested in parts at the border of the signal. These parts are affected by boundary effects. &#xA;I know that some of the methods to extend the signal are periodic and reflexion, but none of these solutions are acceptable in my case.&#xA;I would like to extend the signal by the value at the border (something a bit like zero padding, but with a non zero value)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does something like this has already been tested for wavelets?&lt;/p&gt;&#xA;" OwnerUserId="4609" LastEditorUserId="4609" LastEditDate="2016-12-20T01:11:52.373" LastActivityDate="2016-12-20T09:31:17.570" Title="wavelet transform boundary" Tags="|wavelet|decomposition|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9204" PostTypeId="1" CreationDate="2013-05-20T06:58:50.063" Score="1" ViewCount="1928" Body="&lt;p&gt;I have this assignment that I can't figure how to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a sound.wav human-voice file, and use matlab add-random-noise (monotonic)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; &lt;em&gt;to remove the noise from the sound (and the sound from the noise)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've done so far is to read the file and then add the noise.&#xA;I then do an &lt;em&gt;fft&lt;/em&gt;.&#xA;&lt;strong&gt;&lt;em&gt;Now I need to analyze the frequency spectrum, but I'm not sure how to do it.&lt;/em&gt;&lt;/strong&gt;&#xA;And finally do an &lt;em&gt;ifft&lt;/em&gt; to recover the sound back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used many kinds of filters: low pass, high pass, band pass, moving average. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problems were:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I've managed to filter the sound without the noise BUT the sound always got worse as well.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It worked only for specific cases of random noise but not for any random noise that function might produce.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h3&gt;Any help would be appriciated. Thanks!&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;add_random_noise.m&#xA;    function yn=add_random_noise(y,Fs)&#xA;        n=[0:length(y)-1]';&#xA;        r=rand();&#xA;        %%rr=1+rand();&#xA;        %%rrr=2+2*rand();&#xA;        c=cos(2*pi*440*r*n/Fs);%%+cos(2*pi*440*rr*n/Fs)+cos(2*pi*440*rrr*n/Fs);&#xA;        yn=y+c/17;&#xA;        yn=yn/max(yn);&#xA;    end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;include:&#xA;&lt;a href=&quot;https://docs.google.com/file/d/0B_9WXGGn4j8ecnFQMm1YNTlLT28/edit?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;add_random_noise.m&lt;/a&gt;&#xA;&lt;a href=&quot;https://docs.google.com/file/d/0B_9WXGGn4j8eeXZ3Z2l1LWVBY0U/edit?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;sound.wav&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have changed the add &quot;noise&quot; to return only one sinusoid noise.&#xA;I run the same noise with my original wav and with zeros and watched the noise in the peak in the range of the lower frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now i`m having truble to make the filter:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/9365/matlab-how-to-design-lpf-bpf-hpf-without-builtin-functions&quot;&gt;matlab How to design lpf\bpf\hpf without builtin functions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4608" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-10-04T16:12:47.427" Title="Filtering voice signal from randomly added frequencies" Tags="|matlab|filters|filter-design|homework|voice|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9205" PostTypeId="1" AcceptedAnswerId="9239" CreationDate="2013-05-20T08:23:22.300" Score="12" ViewCount="13621" Body="&lt;p&gt;I am working on a board that has no antialisaing filter at the input of the ADC. I have  option to I implement my own filter using RC + Opamp circuit. But is it also possible to implement Anti Aliasing filter after sampling by ADC and processing in Digital domain: a digital Anti aliasing filter?    &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="4298" LastEditDate="2020-06-15T16:14:20.257" LastActivityDate="2020-06-15T16:14:20.257" Title="Can we have a Digital Anti Aliasing filter?" Tags="|filters|sampling|filtering|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9206" PostTypeId="2" ParentId="9205" CreationDate="2013-05-20T09:32:50.313" Score="16" Body="&lt;p&gt;No, this does not make sense. Say your ADC sample rate is 1kHz. A 100 Hz sine wave and a 900 Hz sine wave will yield exactly the same sequence of digital samples once fed into your ADC - but you want to pass the former and attenuate the later. How do you expect your digital filter to produce different outputs when fed the same input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing that could work would be to sample the input signal as fast as your ADC allows, and then downsample it in the digital domain to your target sample rate - but unless you have CPU cycles to waste, you'd better use an analog filter upstream.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-05-20T09:46:03.457" LastActivityDate="2013-05-20T09:46:03.457" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9207" PostTypeId="2" ParentId="9205" CreationDate="2013-05-20T10:37:44.427" Score="16" Body="&lt;p&gt;I agree with pichenettes's answer but I would like to add that it is pretty common practice to use a simple inexpensive low-order analog anti-aliasing filter, and do the rest of the anti-aliasing filtering in the digital domain. This implies of course that you do not process at maximum sampling rate but that you downsample after the digital anti-aliasing filter. Summarizing:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Of course you need an analog anti-aliasing filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The analog filter can be kept very simple if you can downsample your signal. In this case you can do more aliasing removal in the digital domain (before downsampling). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-20T10:37:44.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9208" PostTypeId="2" ParentId="9186" CreationDate="2013-05-20T14:36:46.293" Score="3" Body="&lt;p&gt;I guess I'll convert my comments above into an answer: apart from the theoretical signal processing concepts, physical devices are made to be used in real, physical systems. 155 Mbps and 622 Mbps are common data rates used on fiber-optic &lt;a href=&quot;https://en.wikipedia.org/wiki/Synchronous_Optical_Networking&quot; rel=&quot;nofollow&quot;&gt;SONET&lt;/a&gt; networks, specifically &lt;a href=&quot;https://en.wikipedia.org/wiki/Optical_Carrier_transmission_rates&quot; rel=&quot;nofollow&quot;&gt;OC-3 and OC-12 lines&lt;/a&gt;. Therefore, the diode that you referenced is specifically designed and manufactured for use on those systems; it would not be common for such a device to be used for some other nonstandard application (not many people would want to go to the expense of designing their own custom fiber-optic networking standard).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, in theory you could potentially use the devices for higher-bandwidth transmission, barring any specific device-related limitations (I haven't read the full datasheet). As long as the carrier frequency is high enough to accommodate the bandwidth of the signal, then it would be possible (e.g. a 1 GHz carrier can't have any larger than 1 GHz one-sided bandwidth).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-20T14:36:46.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9209" PostTypeId="2" ParentId="9006" CreationDate="2013-05-20T16:26:11.290" Score="5" Body="&lt;p&gt;To answer your first question, what they mean is that the first training symbol only encodes data on the even-numbered subcarriers. The other subcarriers are set to zero. That is, the frequency-domain,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] =&#xA;\begin{cases} &#xA;s_k, &amp;amp;k \text{ mod } 2 = 0 \\&#xA;0, &amp;amp;\text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbols to encode on the even-numbered subcarriers $s_k$ are chosen from a &lt;a href=&quot;http://en.wikipedia.org/wiki/Pseudorandom_noise&quot; rel=&quot;noreferrer&quot;&gt;pseudorandom noise (PN) sequence&lt;/a&gt;. They assert that this results in a time-domain symbol that has two identical half-symbols in it (i.e. the first half of the symbol period is equal to the second half). Why is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall one of the properties of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;discrete-time Fourier transform&lt;/a&gt;: if you zero-stuff a signal in the time-domain (by inserting zeros between each pair of samples), then in the frequency domain, the spectrum is repeated periodically. You might have seen this before in a description of discrete-time interpolation: insert zeros, then add a lowpass filter to eliminate the spectrum duplicates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The property is dual in the sense that it works the other way also. When assigning symbols to subcarriers, you're working in the frequency domain. An inverse DFT is used to generate the time-domain signal for transmission. If you set all of the odd-numbered subcarriers to zero, then you're generating a frequency-domain signal that is zero-stuffed by a factor of two. When you inverse transform that to the time domain, you get the same effect: the resulting symbol consists of two periodic half-symbol waveforms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't read the paper in detail, but I'm assuming their synchronization technique takes this redundancy into account in some way.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-20T16:26:11.290" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9210" PostTypeId="2" ParentId="9183" CreationDate="2013-05-20T16:51:12.547" Score="4" Body="&lt;p&gt;I've been using &lt;a href=&quot;https://scipy.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;NumPy/SciPy&lt;/a&gt; for everything.  It doesn't have as many functions/features as Matlab, but the Python language is much nicer to work with, and it's free and open-source, so it's getting better all the time.&lt;/p&gt;&#xA;&lt;p&gt;Python is very modular, so depending on which features you want, it may be a large download or a small download.  I don't care about download or installation size, so I use the &lt;a href=&quot;https://python-xy.github.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python(x,y)&lt;/a&gt; package on Windows, which is based on the Spyder IDE, and includes lots of packages I may or may not use (117 MB).  The bare minimum to try it out is &lt;a href=&quot;https://www.python.org/getit/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python&lt;/a&gt; and &lt;a href=&quot;https://pypi.org/project/numpy/&quot; rel=&quot;nofollow noreferrer&quot;&gt;NumPy&lt;/a&gt;, which is about 20 MB + 3 MB.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://pyzo.org/install_packages.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;pyzo&lt;/a&gt; is another collection of Python packages for scientific computing, for Win/Linux/Mac, at 79 MB, with &lt;a href=&quot;https://pyzo.org/iep.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;IEP&lt;/a&gt; IDE.  I've never tried IEP.  &amp;quot;&lt;a href=&quot;https://web.archive.org/web/20160114060930/https://code.google.com/p/iep/wiki/Alternatives&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spyder, PTK and IEP&lt;/a&gt; are IDE's that provide a Matlab-like interface. The development of each of these started before the release of any of the other.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;https://numpy.org/devdocs/user/numpy-for-matlab-users.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;NumPy for Matlab users&lt;/a&gt; and my answer to &lt;a href=&quot;https://softwareengineering.stackexchange.com/a/198069/7525&quot;&gt;Moving to Python (SciPy and NumPy) for Scientific Computing&lt;/a&gt; on Programmers.SE.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="7092" LastEditDate="2022-12-03T02:03:05.547" LastActivityDate="2022-12-03T02:03:05.547" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9211" PostTypeId="1" AcceptedAnswerId="9213" CreationDate="2013-05-20T17:03:37.617" Score="3" ViewCount="2600" Body="&lt;p&gt;I have DSP in my academics and while going through the video lectures i am stuck regarding power of periodic signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its mentioned as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_{\text{avg}}= \frac{1}{N}\sum_{n=0}^{N-1}|x(n)|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my doubt is why we have to mention $|x(n)|$ as square ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I am having format issues please edit my Question and put it in format. thank you.&lt;/p&gt;&#xA;" OwnerUserId="4580" LastEditorUserId="6" LastEditDate="2013-05-20T17:59:41.110" LastActivityDate="2013-05-20T18:10:11.057" Title="Why the power of periodic signal is square?" Tags="|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9212" PostTypeId="2" ParentId="9211" CreationDate="2013-05-20T18:09:55.383" Score="6" Body="&lt;p&gt;Power is proportional to the squared amplitude of a signal. This &quot;power&quot; concept comes from thinking of the signal $x[n]$ as representative of a voltage or current waveform. In that model, the power dissipated by applying $x[n]$ to a one-ohm resistor is the value of $|x[n]|^2$ averaged over one period.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-20T18:09:55.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9213" PostTypeId="2" ParentId="9211" CreationDate="2013-05-20T18:10:11.057" Score="5" Body="&lt;p&gt;Power or energy are always squared quantities. If you consider simple circuits as an example, then power is $V^2/R$ or $I^2R$ (with $V$ voltage, $I$ current, and $R$ resistance). For time-varying signals, the power or energy is computed by a time average of the squared signal. For stochastic signals, the power is defined by the expectation $E[|x(t)|^2]$, which again is usually estimated by computing time averages. The fact that we're always dealing with squared quantities basically goes back to the definition of energy and power.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-20T18:10:11.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9215" PostTypeId="2" ParentId="9191" CreationDate="2013-05-20T18:37:59.817" Score="1" Body="&lt;p&gt;Assuming that you still need conjugate symmetry, i.e. you're dealing with real-valued signals, you have vectors of length $N/2+1$ and a $(N/2+1)\times (N/2+1)$ transformation matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{y}=\mathbf{Tx}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we have only positive frequencies between DC and Nyquist, there are only constraints on the first and the last element of $\mathbf{y}$, respectively. They must be real-valued. All other elements of $\mathbf{y}$ can be complex-valued and there are no further constraints on them. Since the DC component of $\mathbf{y}$ is given by (I use indices from $1$ to $N/2+1$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(1)=t_{11}x(1) + t_{12}x(2)+\ldots + t_{1,N/2+1}x(N/2+1)$$&#xA;and since only $x(1)$ and $x(N/2+1)$ are necessarily real-valued, we need to make sure that $t_{11}$ and $t_{1,N/2+1}$ are real-valued and that all other elements $t_{1i}$, $i=2,\ldots, N/2$ are zero. The same constraint applies to the last row of the matrix $\mathbf{T}$ (corresponding to $y(N/2+1)$ at Nyquist). All other rows of $\mathbf{T}$ can contain arbitrary complex-valued numbers. &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-20T18:37:59.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9216" PostTypeId="1" CreationDate="2013-05-20T20:30:31.690" Score="3" ViewCount="265" Body="&lt;p&gt;So if I have an image of the size: 1920×1080 and I want to apply a convolution filter of 3x3. Take the formula for DFT $N^2$ and FFT $N \log N$. What should I fill in for N in this case?&lt;/p&gt;&#xA;" OwnerUserId="4106" OwnerDisplayName="user1095332" LastEditorUserId="6" LastEditDate="2013-05-20T21:32:32.577" LastActivityDate="2013-05-21T01:38:54.560" Title="DFT/FFT: What did N stand for again?" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9217" PostTypeId="1" CreationDate="2013-05-20T21:28:20.337" Score="2" ViewCount="185" Body="&lt;p&gt;I am approaching to the &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/data/oxbuildings/&quot; rel=&quot;nofollow&quot;&gt;Oxford Buildings dataset&lt;/a&gt; which contains already computed SIFT descriptors from affine detected keypoint locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually SIFT detector provides to its detected keypoints with scale and orientation information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of affine keypoints is clear that they don't have a single scale parameter but three corresponding to the ellipse (the affine covariant region) they belong to, but what about orientation, do they have any? if not can I say it is zero?&lt;/p&gt;&#xA;" OwnerUserId="4373" LastActivityDate="2013-05-20T21:28:20.337" Title="Affine detector + SIFT descriptor" Tags="|image-processing|computer-vision|local-features|sift|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9218" PostTypeId="2" ParentId="9216" CreationDate="2013-05-20T21:37:28.940" Score="6" Body="&lt;p&gt;Your image is M rows x N cols, and a 2D FFT requires 1D FFTs on all rows followed by 1D column-wise FFTs on the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M N \log N + N M \log M = MN (\log M + \log N) = MN \log MN$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;operations in total.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT case can be derived using a similar method - this is left as an exercise for the reader.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2013-05-20T21:37:28.940" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9220" PostTypeId="1" CreationDate="2013-05-20T23:13:03.770" Score="4" ViewCount="148" Body="&lt;p&gt;Suppose that I have a sensor that can acquire samples $X[k]$ of the Fourier transform of an unknown signal $Y[t]$. An example is MRI, where the acquired data is in $k-$space. Now suppose that the unknown signal $Y[t]$ is known to be real and non-negative. My question is: is there a principled way to incorporate this knowledge into the spectral analysis algorithm that will estimate $Y[t]$ from $X[k]$, in order to produce an estimate with less bias or variance? I am thinking at non-parametric spectral estimation algorithms. A naive way of course would be to take the real part of $Y[t]$ and clip the negative values, but this does not seem to be optimal. I am looking for some sort of Cadzow's denoising method for spectral data. &lt;/p&gt;&#xA;" OwnerUserId="1696" LastActivityDate="2013-05-21T01:14:51.340" Title="Spectral analysis of positive signals" Tags="|frequency-spectrum|denoising|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9221" PostTypeId="2" ParentId="9220" CreationDate="2013-05-21T00:53:58.677" Score="1" Body="&lt;p&gt;To give a complete answer to this question you're going to need to provide more details about the kind of models you're considering in the first place. But yes, in many cases you can augment those models with &lt;em&gt;a priori&lt;/em&gt; constraints on $Y[t]$, such as $0 \leq Y[t] \leq 1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if the standard model has some sort of least-squares structure, then adding constraints of that type turns the problem into a bound-constrained least squares problem. There are a variety of approaches to solving such problems, and while they are more expensive than standard least squares, they are quite tractable. And it's very likely that such constraints will produce a better reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even without knowing more, though, I will say this: if your modeling approach does not produce real signals &lt;em&gt;naturally&lt;/em&gt;, then you are almost certainly using the wrong modeling approach. It concerns me that you are even proposing taking the real part of the output of some other model. You should be searching the space of real signals if you know that to be the underlying structure.&lt;/p&gt;&#xA;" OwnerUserId="4402" LastEditorUserId="4402" LastEditDate="2013-05-21T01:14:51.340" LastActivityDate="2013-05-21T01:14:51.340" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9222" PostTypeId="2" ParentId="9216" CreationDate="2013-05-21T01:38:54.560" Score="1" Body="&lt;p&gt;In DFT-FFT operation the N stands for Number of samples you have in that Sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example If you have matrix function like with 3*3 order then It means in the first sequence you got 3 Samples and in the second sequence you got 3 samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here stood for the number of samples in the given function sequence.&lt;/p&gt;&#xA;" OwnerUserId="4580" LastActivityDate="2013-05-21T01:38:54.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9223" PostTypeId="1" AcceptedAnswerId="9227" CreationDate="2013-05-21T03:09:34.830" Score="2" ViewCount="1391" Body="&lt;p&gt;I would like to ask about this function  in OpenCV:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cvTermCriteria( CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, .3 )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I get more accurate results - do I need to increase the value of &lt;code&gt;epsilon&lt;/code&gt; or decrease it?&lt;/p&gt;&#xA;" OwnerUserId="4463" LastEditorUserId="39" LastEditDate="2013-05-21T12:55:40.390" LastActivityDate="2013-05-21T12:55:40.390" Title="How to get more accurate results with OpenCV" Tags="|opencv|tracking|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9225" PostTypeId="2" ParentId="9133" CreationDate="2013-05-21T08:26:03.307" Score="1" Body="&lt;p&gt;This is just an idea. Don't know if it will work. In cubic spline interpolation a curve is constructed by piece-wise cubic polynomials&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P(x) = a + bx + cx^2 + dx^3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients for the $j^{th}$ cubic (which extends from the $j^{th}$  to the $(j+1)^{th}$ point) are found by directly specifying the first derivatives at the nodes and also specifying that the curve must pass through the points. I'm no where near an expert in this but it goes something like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_j(x_j) = P_{j-1}(x_j) \\&#xA;P_j(x_{j+1}) = P_{j+1}(x_{j+1}) \\&#xA;P'_j(x_j) = P'_{j-1}(x_j) \\&#xA;P'_j(x_{j+1}) = P'_{j+1}(x_{j+1})$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now using this idea to your problem maybe you could use $5^{th}$ order polynomials on this form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P(x) = x^2(a + bx + cx^2 + dx^3)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and use the constraints on the second and third order derivatives like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P''_j(x_j) = P''_{j-1}(x_j) \\&#xA;P''_j(x_{j+1}) = P''_{j+1}(x_{j+1}) \\&#xA;P'''_j(x_j) = P'''_{j-1}(x_j) \\&#xA;P'''_j(x_{j+1}) = P'''_{j+1}(x_{j+1})$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: From the discrete function that represents the 1d position in space over time the acc and jerk values are computed (is that feasible in your case?). If they exceed some max value they are saturated to that max value. Then you construct a continuous 1D position function that has the acc and jerk values at the times you specified. Then this curve is evaluated at the times of interest and thereby you have a new discrete function that represents the 1d position in space over time but with the desired acc and jerk values. I don't know if this makes more sense. It takes some effort to test if it works. If you want to give it a try I suggest you search for cubic spline interpolation to learn how it works with position and velocity. Then use the same principles but just on acc and jerk. If I have to be more specific I will have to read up on cubic spline interpolation myself. &lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2013-05-21T19:16:48.930" LastActivityDate="2013-05-21T19:16:48.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9226" PostTypeId="1" CreationDate="2013-05-21T09:58:55.133" Score="1" ViewCount="171" Body="&lt;p&gt;I have been looking at trying to use wavelets for multichannel audio dynamic range processor. I am in the very early stages of trying to get decomposition and reconstruction working. In &lt;a href=&quot;http://www.boemers.de/personal/thesis.pdf&quot; rel=&quot;nofollow&quot;&gt;this thesis&lt;/a&gt;, it is suggested that a multiresolution dwt can be calculated using a tree of complementary filters. Being a hands-on person, I decided to jump straight in with the following Matlab code . . .&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 31;&#xA;flipVec = [repmat([1 -1],1,floor(n/2)) 1];&#xA;&#xA;% Get analysis and reconstruction filter weights using order and sign flips&#xA;bH0 = fir1(n-1,0.5);&#xA;bH1 = fliplr(bH0).*flipVec;&#xA;bF0 = fliplr(bH0);&#xA;bF1 = fliplr(bH1);&#xA;&#xA;x = [1; zeros(1023,1)];&#xA;&#xA;y0 = fftfilt(bH0, x);&#xA;y1 = fftfilt(bH1, x);&#xA;&#xA;%skip stright to adding zeros every other sample&#xA;y0(1:2:end) = 0;&#xA;y1(1:2:end) = 0;&#xA;&#xA;y2 = fftfilt(bH0, y0);&#xA;y3 = fftfilt(bH1, y0);&#xA;&#xA;%skip stright to adding zeros every other sample&#xA;y2(1:2:end) = 0;&#xA;y3(1:2:end) = 0;&#xA;&#xA;% =============&#xA;% RECONSTRUCT&#xA;% y0 = 2*fftfilt(bF0, y2) + 2*fftfilt(bF1, y3);&#xA;z = 2*fftfilt(bF0, y0) + 2*fftfilt(bF1, y1);&#xA;&#xA;figure; freqz(z,1)&#xA;figure; plot(z)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I try to go deeper than the first level of the tree (by uncommenting the line towards the end of the snippet), I no longer get perfect reconstruction. This makes sense to me as the signal down the left-side of the tree has gone through more processing stages, so it has greater delay relative to the signals processed by the right-side of the tree. I'm obviously not using the correct type of filter, or am fundamentally misunderstanding the examples available online. A nudge in the right direction, or basic code example would be great help.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2013-05-21T09:58:55.133" Title="Multiresolution discrete wavelet transforms: First steps" Tags="|audio|filter-design|wavelet|filter-bank|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9227" PostTypeId="2" ParentId="9223" CreationDate="2013-05-21T12:25:13.050" Score="1" Body="&lt;p&gt;This termination criteria tells the algorithm to stop when it has either done &#xA;&lt;code&gt;20&lt;/code&gt; iterations or when epsilon is greater than &lt;code&gt;.3&lt;/code&gt;.  You can play with these parameters for speed vs accuracy but these values work pretty well in many situations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to improve accuracy then you will get more accurate value with more iterations but the time taken for doing such iterations will be improved , I mean speed will be reduced.&lt;/p&gt;&#xA;" OwnerUserId="4580" LastEditorUserId="80" LastEditDate="2013-05-21T12:29:43.937" LastActivityDate="2013-05-21T12:29:43.937" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9228" PostTypeId="1" AcceptedAnswerId="9240" CreationDate="2013-05-21T13:59:57.370" Score="21" ViewCount="1198" Body="&lt;p&gt;I am aware of the common types of windows, (Hamming, Hanning, Kaiser, Tukey, etc etc). However while many books describe them - almost none tell me just how exactly they were derived. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is so holy about the hamming window? What about the hanning? I understand that they all play on the ratio of mainlobe width VS sidelobe attenuation, but how exactly were they derived? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motivation for my question, is because I am trying to figure out if one can design their own windows, that also play off main lobe width and sidelobe energy. &lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="35" LastEditDate="2015-10-11T17:09:32.303" LastActivityDate="2019-03-31T12:45:58.430" Title="How were windows originally conceived?" Tags="|fourier-transform|filter-design|signals-history|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9230" PostTypeId="1" CreationDate="2013-05-21T14:43:53.547" Score="7" ViewCount="1891" Body="&lt;p&gt;In DTFT of a signal, the spectrum of a sequence is periodic with period $2\pi$ and all the information needed for derivation of the original signal from its spectrum is contained in $\pi &amp;lt;\omega &amp;lt;\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But , why do they integrate over $2\pi$ and not from $-\infty$ to $+\infty$ , as in continuous Fourier transform in inverse DTFT? After all, when you derive a &lt;em&gt;transform&lt;/em&gt; of a signal, the inverse of it is not arbitrary and to recover the original signal, you can't integrate over an other  interval because &lt;em&gt;all the information is contained in there&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastEditorUserId="4622" LastEditDate="2013-05-21T15:23:43.303" LastActivityDate="2020-04-04T22:44:36.863" Title="Why integrate over $2\pi$ in inverse DTFT?" Tags="|discrete-signals|fourier-transform|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9231" PostTypeId="2" ParentId="9228" CreationDate="2013-05-21T14:57:36.640" Score="7" Body="&lt;p&gt;Most well-known windows were designed in a more or less ad-hoc way, based on some notion of smoothness in the time-domain. As far as I know there are two windows that are optimal in some sense: The Chebyshev-window which minimizes the maximum sidelobe level (not energy!), and the prolate-spheroidal window, which maximizes the energy ratio between mainlobe and sidelobes. There is an interesting paper about window-design in the frequency domain. It discusses an algorithm which minimizes the sidelobe energy subject to constraints on the maximum sidelobe level, i.e. it is a mix between Chebyshev and prolate-spheroidal window. This is the paper: &lt;a href=&quot;https://www.researchgate.net/publication/3314204_A_new_optimal_window_signal_processing&quot; rel=&quot;nofollow noreferrer&quot;&gt;A new optimal window&lt;/a&gt; by J.W. Adams.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2019-03-31T12:45:58.430" LastActivityDate="2019-03-31T12:45:58.430" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="9232" PostTypeId="2" ParentId="9230" CreationDate="2013-05-21T15:26:19.987" Score="10" Body="&lt;p&gt;There are two reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;As you say, the sequence is periodic so all of the information is contained in the $-\pi &amp;lt; w &amp;lt;\pi$ region.  Thus, integrating over that region tells you everything that there is to be learned from the inverse transform.&lt;/li&gt;&#xA;&lt;li&gt;Integrating from $-\infty &amp;lt; w&amp;lt; \infty$ would only give answers of $0$, $\infty$, or $-\infty$.  The reason for that is that integrating over $-\pi &amp;lt; w &amp;lt;\pi$ will generally give a finite answer which can be something negative (e.g. -4), 0, or something positive (e.g. 2.5).  If you integrate over $-\infty &amp;lt; w&amp;lt; \infty$ each $2\pi$ region will give the exact same answer, so the negative results will accumulate to $-\infty$, the zeros will sum to $0$, and the positive results will sum to $\infty$.  (Note that the results are often complex, but that doesn't change the primary point.  It just increases the dimensionality of the infinities.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-05-21T15:59:52.273" LastActivityDate="2013-05-21T15:59:52.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9233" PostTypeId="2" ParentId="9230" CreationDate="2013-05-21T16:11:37.350" Score="2" Body="&lt;p&gt;Mathematically , you have to integrate over $2\pi$:&#xA;$$X(\omega) = \sum_{n=-\infty}^{\infty} x[n] \,e^{-i \omega n}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]= \frac{1}{2 \pi}\int_{2\pi} X(\omega)\cdot e^{i \omega n} d\omega= \frac{1}{2 \pi}\int_{2\pi} \sum_{k=-\infty}^{\infty} x[k] \,e^{-i \omega k}\cdot e^{i \omega n} d\omega $$&#xA;because of orthogonality of sinusoidals , this will be zero for all $k$s except $k=n$:&#xA;$$\to x[n]= \frac{1}{2 \pi}\int_{2\pi}x[n]d\omega $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a continuous Fourier transform you'll arrive at a delta function and you have to integrate over $(-\infty,\infty)$.&lt;/p&gt;&#xA;" OwnerUserId="4243" LastActivityDate="2013-05-21T16:11:37.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9234" PostTypeId="2" ParentId="2708" CreationDate="2013-05-21T18:38:09.857" Score="2" Body="&lt;p&gt;If you don't know some of the data, your best bet in not to average over it at all. Guessing it with linear regression and the like may help, but it also may introduce extra complexity and unintended bias to your data. I would say that if you're averaging over these five data points: $[a, b, c, ?, e]$, your answer should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{a+b+c+e}{4}$$&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-05-21T18:38:09.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9235" PostTypeId="1" AcceptedAnswerId="9236" CreationDate="2013-05-21T19:58:00.280" Score="11" ViewCount="4344" Body="&lt;p&gt;I recently realized that FFT's aren't perfect. Meaning if I take a signal and then take it's FFT, and then do an inverse FFT, the resulting output isn't exactly the same as the input. Here's an image to show you what I mean :&lt;img src=&quot;https://i.stack.imgur.com/2iuVj.jpg&quot; alt=&quot;FFT doesn&amp;#39;t always work&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the image is fairly self explanatory. The IFFT signal is just an inverse transform of &quot;FFT spectrum&quot; and the &quot;Difference&quot; plot is the difference between the IFFT signal and the original signal ($\text{IFFT - Original}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly there are some artefacts, although they are really small. I'd like to know why they occur in the first place. Is this because of the finite window of the fourier transform? Or because of something in the FFT algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This plot has 32 points, but I've checked with 100, 1000, 1024, 256 and 64 points, and there's always this residue in the difference of a similar magnitude (either $10^{-16}$ or $10^{-15}$).&lt;/p&gt;&#xA;" OwnerUserId="3183" LastActivityDate="2013-05-21T20:21:30.723" Title="Artifacts in FFT" Tags="|fft|fourier-transform|dft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9236" PostTypeId="2" ParentId="9235" CreationDate="2013-05-21T20:03:41.613" Score="19" Body="&lt;p&gt;The differences you see are due to numerical errors in floating point format. All operations needed to perform an FFT and an inverse FFT can only be done with finite precision and you've shown the result of this finite accuracy in your lower right plot.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-21T20:03:41.613" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9237" PostTypeId="2" ParentId="9235" CreationDate="2013-05-21T20:21:30.723" Score="8" Body="&lt;p&gt;In general a number can't be represented exactly in digital form. An error is introduced. If you are in Matlab you can write eps at the command, it gives you a number. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;EPS, with no arguments, is the distance from 1.0 to the next larger&#xA;  double&#xA;      precision number, that is EPS = 2^(-52).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The error you see in your plot is in range returned by eps (that is 2^(-52)). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though you expect real values in your output from your IFFT you might see that your imaginary part is not exactly equal to zero. Same thing.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-05-21T20:21:30.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9238" PostTypeId="1" AcceptedAnswerId="9247" CreationDate="2013-05-21T20:24:47.343" Score="1" ViewCount="292" Body="&lt;p&gt;What useful information i can take from the coefficient intensity maping after performing DCT transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5m794.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4273" LastActivityDate="2013-05-22T22:01:58.590" Title="Information i can take from coeficient intensity map in DCT transform" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9239" PostTypeId="2" ParentId="9205" CreationDate="2013-05-21T21:21:10.727" Score="11" Body="&lt;p&gt;Just to support Matt's answer and provide a few more details:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most modern ADCs do most of the hard antialiasing job in the digital domain. Reason is that digital filters tend to produce less by-products for a much lower cost. The actual chain is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Analog Input.&lt;/li&gt;&#xA;&lt;li&gt;Analog Anti-aliasing filter.&lt;/li&gt;&#xA;&lt;li&gt;Oversampling (eg, at 8x).&lt;/li&gt;&#xA;&lt;li&gt;Digital Anti-Aliasing Filter.&lt;/li&gt;&#xA;&lt;li&gt;Decimating (reduction to 1x).&lt;/li&gt;&#xA;&lt;li&gt;Digital Output.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The further illustrate, consider the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The audio is sampled at 44100Hz.&lt;/li&gt;&#xA;&lt;li&gt;This provides a Nyquist frequency of 22050 Hz.&lt;/li&gt;&#xA;&lt;li&gt;Any frequencies above 24100 Hz will alias back to the audible range (below 20kHz).&lt;/li&gt;&#xA;&lt;li&gt;20000Hz to 24100 is about quarter of an octave.&lt;/li&gt;&#xA;&lt;li&gt;Even with a steep 80dB/8ve filter you will only be reducing the aliasing frequencies by 20dB.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But with 8x oversampling:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The audio is sampled at 352.8kHz (44.1kHz x 8).&lt;/li&gt;&#xA;&lt;li&gt;Nyquist is 176.4 kHz.&lt;/li&gt;&#xA;&lt;li&gt;Only frequencies above 332.8kHz will mirror to the audible range.&lt;/li&gt;&#xA;&lt;li&gt;That's about 4 octaves.&lt;/li&gt;&#xA;&lt;li&gt;So you can apply a 24dB/8ve analog filter to reduce aliasing frequencies by 96dB.&lt;/li&gt;&#xA;&lt;li&gt;Then oversample.&lt;/li&gt;&#xA;&lt;li&gt;Then apply linear phase digital filter between 20kHz and 24.1kHz&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/141960001X&quot;&gt;following book&lt;/a&gt; is an excellent, clear resource for these sort of things.&lt;/p&gt;&#xA;" OwnerUserId="4576" LastActivityDate="2013-05-21T21:21:10.727" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9240" PostTypeId="2" ParentId="9228" CreationDate="2013-05-21T23:18:15.717" Score="14" Body="&lt;p&gt;This is only a partial answer, but there's a &lt;a href=&quot;http://www.youtube.com/watch?v=WO4XLz8wFqM&amp;amp;list=PL2FF649D0C4407B30&quot;&gt;lecture online&lt;/a&gt; where Hamming talks about how he came up with his eponymous window. Starting at roughly 15:15 gives the full context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a reasonably entertaining story, he credits &lt;a href=&quot;http://en.wikipedia.org/wiki/John_Tukey&quot;&gt;John Tukey&lt;/a&gt; with inventing the theory of windows (for spectrum analysis). However, he introduces the whole subject in the context of using &lt;a href=&quot;http://en.wikipedia.org/wiki/Sigma_approximation&quot;&gt;Lanczos sigma factors&lt;/a&gt; to reduce &lt;a href=&quot;http://en.wikipedia.org/wiki/Gibbs_phenomenon&quot;&gt;Gibbs phenomenon&lt;/a&gt;. In addition, in &lt;a href=&quot;http://books.google.com/books/about/Art_of_Doing_Science_and_Engineering.html?id=49QuCOLIJLUC&quot;&gt;The Art of Doing Science and Engineering&lt;/a&gt; (based on the same lectures), he describes how his window is a variation on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Julius_von_Hann&quot;&gt;Hann window&lt;/a&gt;, which he claims was used by von Hann in economics (long before its application in signal processing). That suggests the history goes much further back, depending on how you want to define it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book where Tukey first named the Hamming window is &lt;a href=&quot;http://books.google.com/books/about/The_measurement_of_power_spectra_from_th.html?id=4eMIAQAAIAAJ&quot;&gt;The Measurement of Power Spectra from the Point of View of Communications Engineering&lt;/a&gt;. Given Hamming's assertion that Tukey invented the theory of windows, it would probably be a good place to start for a deeper understanding of how to design new ones. I think the book is just a reprint of &lt;a href=&quot;http://www3.alcatel-lucent.com/bstj/vol37-1958/bstj-vol37-issue01.html&quot;&gt;Part I&lt;/a&gt; and &lt;a href=&quot;http://www3.alcatel-lucent.com/bstj/vol37-1958/bstj-vol37-issue02.html&quot;&gt;Part II&lt;/a&gt; of his Bell System Technical Journal article, so it's available online.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-05-21T23:18:15.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9243" PostTypeId="2" ParentId="9193" CreationDate="2013-05-22T14:06:00.937" Score="3" Body="&lt;p&gt;Prize for using &lt;code&gt;numel&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z=numel(find(img_dct));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-22T14:06:00.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9244" PostTypeId="2" ParentId="9193" CreationDate="2013-05-22T14:16:09.343" Score="2" Body="&lt;p&gt;If you are using Matlab, there is a built-in command to do just this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;nnz(y)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4202" LastActivityDate="2013-05-22T14:16:09.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9245" PostTypeId="1" AcceptedAnswerId="9260" CreationDate="2013-05-22T15:14:44.413" Score="-3" ViewCount="324" Body="&lt;p&gt;Is it true that convolving a 3x3 matrix and a Full HD (1920×1080) image is slower with FFT, than with normal for-loops? Because you have to do zeropadding to get to a power of 2? (with the traditional Cooley-Tukey FFT for example)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because when using the FFT, you have to zeropad the 3x3 kernel as well...&#xA;log(1920*1080)/log(2) is roughly 21.  That means I need 21 adds and 15.5 multiplies is 36.5 operations for each pixels. But I need to do 2 FFT and one IFFT. So, I need to multiply 36.5 by 3: 36.5*3=109.5 operations for each pixel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When calculating the convolution directly using for-loops, you need 9 multiplications and 9 additions = 18 operations for each pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I made a mistake somewhere. One of those is '21 multiplies'... Please provide a better mathmatical proof.&lt;/p&gt;&#xA;" OwnerUserId="4478" LastEditorUserId="4478" LastEditDate="2013-05-23T21:08:12.200" LastActivityDate="2013-05-23T21:08:12.200" Title="Is it true that convolving a 3x3 matrix and a Full HD image is slower with FFT?" Tags="|fft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9247" PostTypeId="2" ParentId="9238" CreationDate="2013-05-22T22:01:58.590" Score="2" Body="&lt;p&gt;The DCT is used in many places for its &quot;energy compaction&quot; properties. This is mostly useful in compression. For example, if I have a signal and I take its wavelet transform, then I can &quot;compress&quot; the signal by throwing away certain coefficients. These coefficients are not known before-hand. I have to look at the wavelet coefficients and then throw away all coefficients below a certain threshold to achieve some amount of compression with an acceptable loss in reconstruction accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the DCT however, most of the energy of a signal is collected in its &quot;low&quot; frequency coefficients. What that means is that if you only keep the first lets say N coefficients (you don't need to store the locations of which coefficients you kept), you can get decent compression. In 2D, a &quot;zonal&quot; or &quot;zig-zag&quot; pattern is used to choose the coefficients to keep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a more fundamental level, the DCT is basically a linear combination of your signal as a bunch of discrete cosine waves. If you think of each cosine wave as an elementary building block, then the DCT tells you how much contribution to your image comes from a discrete cosine of a particular frequency.&lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2013-05-22T22:01:58.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9248" PostTypeId="1" AcceptedAnswerId="9309" CreationDate="2013-05-22T23:58:21.757" Score="2" ViewCount="1002" Body="&lt;p&gt;This question is a continuation of the discussion at &lt;a href=&quot;https://dsp.stackexchange.com/questions/9191/how-can-a-linear-operator-on-dft-vector-produce-the-same-vector-using-only-half&quot;&gt;How can a linear operator on DFT vector produce the same vector using only half of the DFT vector?&lt;/a&gt;, where the higher level motivation is better explained, in case there is interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to take the positive frequencies from an hermitian symmetric DFT vector, take the IDFT of this (which is complex), multiply by a carrier to shift the spectrum, resample, take the real part of it, and obtain the same IDFT result as the result that would be obtained by the IDFT of the original hermitian symmetric symbol?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Details:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate to have my understanding and the concepts I mention checked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider that the DFT vector $\mathbf{X}$ of a certain signal is hermitian symmetric and represents a bandwidth of $B$ Hz. If I consider a signal represented by the positive frequencies (from DC to Nyquist), it is the same as shifting the positive side of the spectrum, and centralizing it at frequency 0. Now, the new spectrum is not hermitian symmetric anymore, yields a complex IDFT and represents a Bandwidth of $\frac{B}{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use a numerical example, for $N=8$, considering from DC to Nyquist, that would give 5 positive frequencies and 3 negative. Then, I would shift the 5 DFT samples (correspondent to the positive frequencies) to the center of the spectrum. In this case, the new DFT size would be odd, and the Nyquist frequency (at k= 5/2 = 2.5) wouldn't fall on a DFT sample &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, I have a signal bandlimited to $\frac{B}{2}$. Then, if I multiply this signal with a carrier of frequency $\frac{B}{2}$, I shift the spectrum again to the positive and negative side, such that the original spectrum is reconstructed. However, since this operation would increase the bandwidth back to $B$ Hz, the product $x[n]*c[n]$ would need to have its sampling frequency increased by a factor of 2, so that the frequency spectrum can actually represent the spectrum of the signal without aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The carrier should be an exponential:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;c[n] = e^{j2\pi n k_0/N}&#xA;\end{align}&#xA;where $k_0$ is the number of DFT samples to shift. In this case, $k_0 = \frac{N}{2}$, such that:&#xA;\begin{align}&#xA;c[n] = e^{j \pi n}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, after doing resampling, I should take the real part of the signal and that should be equal to the original IDFT (the one obtained by simpling taking the IDFT of the original hermitian symmetric symbol).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am confused mainly by the following issues:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;From DC to Nyquist there are 5 DFT samples. That would yield a complex IFFT with size 5, Then, I would multiply point-wise by 5 samples of the carrier and upsample by 2, resulting in 10 samples. On the other hand, the original IDFT has length 8.&lt;/li&gt;&#xA;&lt;li&gt;I'm not sure about the rationale behind taking the real part.&lt;/li&gt;&#xA;&lt;li&gt;I'm not sure if the exponential is the correct carrier.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MATLAB implementation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I'm trying to make work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=4;&#xA;A=rand(N-1,1) + j*rand(N-1,1); % Random positive carrier&#xA;X=[0; A; 0; flipud(conj(A))]; % Hermitian symmetric DFT vector&#xA;&#xA;x = ifft(X)&#xA;&#xA;% Positive side of the spectrum shifted to the center&#xA;Xp = [X((N/2 + 1):N+1); X(1:N/2);];&#xA;&#xA;% Complex IFFT:&#xA;xp = ifft(Xp);&#xA;&#xA;% Carrier&#xA;n=(0:N);&#xA;k0 = (N+1)/2;&#xA;carrier = exp(j*2*pi*k0*n/(N+1)).';&#xA;&#xA;% Modulation&#xA;x_up = xp.*carrier;&#xA;&#xA;% Increase the sampling rate by a factor of two&#xA;x_re = resample(x_up,2,1); &#xA;&#xA;real(x_re)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I basically want the two vectors that are printed to the workspace to be equal: &lt;code&gt;x and real(x_re)&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="4590" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-05-28T09:17:25.567" Title="How to implement IDFT using the positive frequencies of DFT, modulation and resampling on MATLAB?" Tags="|dft|modulation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9249" PostTypeId="2" ParentId="3039" CreationDate="2013-05-23T02:55:26.687" Score="4" Body="&lt;p&gt;You need a dynamic system to use a Kalman Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = \sum\limits_{i =0}^n a_i\, x^i $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[k+1] = a[k] + w $$&#xA;$$ cov(w) = Q$$&#xA;Measurement:&#xA;$$z = \sum\limits_{i =0}^n a_i\, x^i  = y$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of using $x$ as states, introduce the coefficient ($a$) as states&lt;/p&gt;&#xA;" OwnerUserId="4634" LastActivityDate="2013-05-23T02:55:26.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9250" PostTypeId="1" AcceptedAnswerId="9257" CreationDate="2013-05-23T05:26:51.103" Score="4" ViewCount="4237" Body="&lt;p&gt;I know this question has been asked to hell and back from many people, and that it will probably get downvoted until it's deleted, but please bear with me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am designing a sound engine for one of my projects, which needs to support low-pass filtering (no other filtering required, so no need for extremely robust equalization or high-pass filters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I'm not exactly well-versed in DSP math (as I'm more a programmer than anything else), so this has been getting tricky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've found by searching on the internet is a &quot;1-RC and C filter&quot; which is implemented as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Coefficient computation&#xA;// Cutoff and reso are [0,128) integers&#xA;c = 0.5^[(128-Cutoff) / 16.0]&#xA;r = 0.5^[( 24+Reso)   / 16.0]&#xA;&#xA;v0 = (1.0 - r*c)*v0 - c*v1 + c*input&#xA;v1 = (1.0 - r*c)*v1 + c*v0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the same website, I also found that c can be written frequency-wise with the formula&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = 2.0 * sin(Freq * pi/SampRate)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since I'm only doing variable low-pass filtering with no resonance, this leads to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = 2.0 * sin(Freq * pi/SampRate)&#xA;r = pow(0.5, 24 / 16.0) = 1 / sqrt(8) = ~0.3536&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since the sound engine is mostly MIDI-related, I've used the frequency cutoffs I've found elsewhere on the internet, which led to a relatively simple formula of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CutoffFreq = 250.0 * 32^x&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where x is bound to [0.0,1.0], which leads to a frequency range of 250Hz~8kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is where my issues start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume that we're using a maximum cutoff frequency (that is, there should be no filtering on the data) and that I'm mixing at 44.1kHz.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c   = 2.0 * sin(8000.0 * pi/44100.0) = ~1.0791&#xA;r   = 8^(-0.5)                       = ~0.3536&#xA;      1.0 - r*c                      = ~0.6184&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now let's assume the input signal is a basic triangle:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Input[] = {0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 0.8, 0.6, 0.4, 0.2}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Applying the code above leads to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Beforehand...&#xA;v0 = 0.0&#xA;v1 = 0.0&#xA;&#xA;// 1st Sample [works okay]&#xA;v0 = 0.6184*0.0 - 1.0791*0.0 + 1.0791*0.0 = 0.0&#xA;v1 = 0.6184*0.0 + 1.0791*0.0              = 0.0&#xA;&#xA;// 2nd Sample [incorrect]&#xA;v0 = 0.6184*0.0 - 1.0791*0.0 + 1.0791*0.2 = ~0.2158&#xA;v1 = 0.6184*0.0 + 1.0791*0.2158           = ~0.2329 [residual 0.0329]&#xA;&#xA;// 3rd Sample [more than doubly incorrect]&#xA;v0 = 0.6184*0.2158 - 1.0791*0.2329 + 1.0791*0.4 = ~0.3138&#xA;v1 = 0.6184*0.2329 + 1.0791*0.3138              = ~0.4826 [residual 0.0826]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, this doesn't exactly work correctly.&#xA;In fact, judging from the sound of it, it's as though I had introduced a slight high-pass filter as well as increased resonance slightly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, I was wondering if anyone could offer an explanation a more programming-related person could understand for computing low-pass filter coefficients and equations, as well as shed some light on how to properly implement this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="2039" LastActivityDate="2013-05-23T09:05:18.720" Title="Implementation of basic 2-pole low-pass filter" Tags="|filters|discrete-signals|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9251" PostTypeId="1" AcceptedAnswerId="9256" CreationDate="2013-05-23T06:44:15.207" Score="13" ViewCount="11926" Body="&lt;p&gt;I would like to convert a signal to frequency domain. The desired frequency range is &lt;code&gt;0.1 Hz&lt;/code&gt; to &lt;code&gt;1 Hz&lt;/code&gt; and the frequency resolution is &lt;code&gt;0.01 Hz&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the sampling rate of &lt;code&gt;30 Hz&lt;/code&gt;, FFT gives the frequency components up to 15 Hz. &#xA;Raising the sampling rate gives better frequency resolution. However, FFT gives wider frequency range. In my case, I just want &lt;code&gt;0.1 Hz&lt;/code&gt; to &lt;code&gt;1 Hz&lt;/code&gt;, FFT gives up to &lt;code&gt;15 Hz&lt;/code&gt; ( Extra computation ). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there anyway standard way I can compute a frequency domain of a signal with specific frequency range and high resolution? &lt;/p&gt;&#xA;" OwnerUserId="4430" LastActivityDate="2013-05-24T07:54:35.367" Title="FFT for a specific frequency range." Tags="|fft|frequency|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9252" PostTypeId="1" AcceptedAnswerId="9254" CreationDate="2013-05-22T17:32:42.680" Score="2" ViewCount="1197" Body="&lt;p&gt;There is a statement regarding the Nyquist frequency in one of my textbooks which I don't quite follow.  I would appreciate it if someone could clarify it for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the way I understand it - if we sample a signal with frequency $f_{s}$, then the highest possible signal frequency which we can reconstruct without any aliasing is half the sample frequency.  This is called the Nyquist frequency.  So we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_{Ny} = \frac{1}{2} f_{s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The statment in my textbook which confuses me is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Recall that the Sampling Theorem approximately reconstructs a signal $f$ from samples taken uniformly at intervals of length $T$.  If the signal is band-limited and its Nyquist frequency is less than $1/T$, then the reconstruction is perfect; otherwise it's an approximation&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this statement is somewhat confusing.  After all the Nyquist frequency isn't a fixed number, but changes depending on our sample rate.  So wouldn't the Nyquist frequency automatically be $\frac{1}{2T}$?  In other words, why the need to to write &quot;if the Nyquist frequency is less than $1/T$&quot;?  Wouldn't this always be the case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate it if someone could clarify this statement for me!  &lt;/p&gt;&#xA;" OwnerUserId="4637" OwnerDisplayName="user12277" LastActivityDate="2015-07-24T10:01:18.167" Title="Nyquist Frequency" Tags="|frequency|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9253" PostTypeId="2" ParentId="9252" CreationDate="2013-05-22T17:43:09.893" Score="2" Body="&lt;p&gt;Yes, in fact a more general theorem can be proven (&lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;Shannon Theorem&lt;/a&gt;), which states exactly what you wrote. You can use a frequency of sampling greater than the Nyquist rate and you wil get an exact determination of the signal.&lt;/p&gt;&#xA;" OwnerDisplayName="Ikiperu" LastActivityDate="2013-05-22T17:43:09.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9254" PostTypeId="2" ParentId="9252" CreationDate="2013-05-22T17:47:10.987" Score="4" Body="&lt;p&gt;&lt;strong&gt;Nyquist rate depends only on the bandwidth of your signal&lt;/strong&gt; and doesn't have anything to do with your sampling frequency of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are free to sample the signal with any frequency you like, but if you want to be able to reconstruct the original signal from its samples, you have to sample with a frequency more than Nyquist rate (and the Nyquist frequency will be half of that). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;Nyquist–Shannon sampling theorem&lt;/a&gt; states is that if you sample a band-limited signal with a rate &lt;em&gt;more than&lt;/em&gt; Nyquist rate you can reconstruct it exactly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; note that Nyquist frequency is a property of the sampling process, but  Nyquist rate is a property of your original (CT) signal.Although in some textbooks like Discrete-Time Signal Processing by Oppenheim &amp;amp; Schafer ,Nyquist frequency is simply taken to be the maximum frequency of a bandlimited signal.&lt;/p&gt;&#xA;" OwnerUserId="4243" OwnerDisplayName="Peasant" LastEditorUserId="4243" LastEditDate="2013-05-23T14:44:57.457" LastActivityDate="2013-05-23T14:44:57.457" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9255" PostTypeId="2" ParentId="9251" CreationDate="2013-05-23T07:53:23.510" Score="1" Body="&lt;p&gt;The frequency resolution is &#xA;$$&#xA;\Delta f = \frac{f_\mathrm{s}}{N}&#xA;$$&#xA;where $f_\mathrm{s}$ is the sampling frequency and $N$ is the FFT size. So increasing the sampling frequency in fact increases the frequency resolution (I assume by &quot;better&quot; you mean lower). You should therefore increase the FFT size $N$, i. e. the number of samples that are processed by the FFT in one block of data, in order to decrease frequency resolution. In your example you would need at least 300 samples to achieve the desired frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $N$ cannot be increased due to computational complexity, the bandlimited signal could be frequency shifted before FFT. Let $s(t)$ be the continuous signal, $f_\mathrm{c}$ its center frequency and $f_\mathrm{b}$ its bandwidth. $x(n)$ is the sampled version of $s(t)$, namely $x(n) = s(n/f_\mathrm{s})$. Then a frequency shift can be achieved by&#xA;$$&#xA;\tilde{x}(n) = x(n)e^{-j2\pi k_\mathrm{0}/N}&#xA;$$&#xA;where $k_\mathrm{0}=f_\mathrm{c}/f_\mathrm{s}$. The sampling frequency can now be reduced as the signal now has a cut-off frequency of $f_\mathrm{b}$ in contrast to the cut-off frequency $f_\mathrm{b}+f_\mathrm{c}$ it had &lt;em&gt;before&lt;/em&gt; the frequency shift. According to the sampling theorem the new sampling frequency $\tilde f_\mathrm{s}$ must be greater than or equal to $f_\mathrm{b}$ and thus $\tilde x(n)$ can be downsampled by a factor of $M = f_\mathrm{s}/f_\mathrm{b}$ thus increasing the frequency resolution while keeping $N$ constant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method only works if $s(t)$ is strictly bandlimited. If it is not, bandpass filtering to filter out the desired frequency band has to be applied in advance. Also note that downsampling by a fractional number $M$ will also introduce additional computational complexity.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-05-23T07:53:23.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9256" PostTypeId="2" ParentId="9251" CreationDate="2013-05-23T08:28:11.603" Score="5" Body="&lt;p&gt;I think the best solution to your problem is to use the chirp-DFT. It's like a magnifying glass for a certain frequency range. It is more efficient than the direct implementation of the DFT (without FFT), because an FFT algorithm can be used with some appropriate pre- and post-processing. You basically need to modulate your signal with a chirp signal, then filter using an FFT, and then again chirp-modulate your signal to get the desired frequency response. See &lt;a href=&quot;http://en.wikipedia.org/wiki/Bluestein%27s_FFT_algorithm&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www3.alcatel-lucent.com/bstj/vol48-1969/articles/bstj48-5-1249.pdf&quot;&gt;here&lt;/a&gt; for details on how to implement the chirp-DFT.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-23T08:28:11.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9257" PostTypeId="2" ParentId="9250" CreationDate="2013-05-23T09:05:18.720" Score="3" Body="&lt;p&gt;First of all, your filter is a non-typical lowpass filter. The transfer function of your filter is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = \frac{\beta^2}{1+(\beta^2-2\alpha)z^{-1}+\alpha^2z^{-2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\alpha = 1-rc$, $\beta=c$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example you use these values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c = 2\sin(8000\pi/44100)$, $r = 8^{-0.5}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They give the following frequency response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/G2RGS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example where you step-by-step process the first samples of your triangular waveform it seems that you expect that input to pass through undistorted. Is that correct? if so, why do you expect this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative you can use a 2nd order butterworth low-pass filter. Here &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&lt;/a&gt; you find the expressions for the coefficients as well as the difference equation you have to implement.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-05-23T09:05:18.720" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="9258" PostTypeId="2" ParentId="9251" CreationDate="2013-05-23T10:48:16.627" Score="2" Body="&lt;p&gt;There is also the possibility of using frequency warping (also work as a magnifying glass in that you get improved resolution in your freqency range of interest for the same size FFT at the expense of lower resolution at higher frequencies). However, you don't save any MIPS as the FFT size is not reduced and the frequency warping is far from cheap. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only want to compute certain bins in the FFT (and thus save MIPS) there are a couple of methods to do that. For instance the sliding DFT. The references in this paper gives a very nice explanation &lt;a href=&quot;http://www.comm.utoronto.ca/~dimitris/ece431/slidingdft.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.comm.utoronto.ca/~dimitris/ece431/slidingdft.pdf&lt;/a&gt;. I also think the goertzel algo does something similar but I don't know it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then there is the option of downsampling before FFT'ing. That will probably also save some MIPS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Just to clarify the comment regarding Goertzel algorithm not being useful. By directly plugging values into the expression found at the bottom of this wiki page &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Goertzel_algorithm&lt;/a&gt; then the Goertzel approach will be more complex than an FFT when the size of the FFT required is larger than 128 (assuming FFT size is a factor of 2 and a radix-2 implementation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are other factors that should be taken into account which goes in favor of the Goertzel. Just to cite the wiki page:&#xA;&quot;FFT implementations and processing platforms have a significant impact on the relative performance. Some FFT implementations[9] perform internal complex-number calculations to generate coefficients on-the-fly, significantly increasing their &quot;cost K per unit of work.&quot; FFT and DFT algorithms can use tables of pre-computed coefficient values for better numerical efficiency, but this requires more accesses to coefficient values buffered in external memory, which can lead to increased cache contention that counters some of the numerical advantage.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Both algorithms gain approximately a factor of 2 efficiency when using real-valued rather than complex-valued input data. However, these gains are natural for the Goertzel algorithm but will not be achieved for the FFT without using certain algorithm variants specialised for transforming real-valued data.&quot;&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2013-05-24T07:54:35.367" LastActivityDate="2013-05-24T07:54:35.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9260" PostTypeId="2" ParentId="9245" CreationDate="2013-05-23T12:12:17.573" Score="2" Body="&lt;p&gt;This is probably correct. Frequency domain convolution is typically only worthwhile for larger kernels. For convolution in the spatial domain the number of operations tends to increases as a square law with kernel dimension, whereas frequency domain convolution is constant time. The &quot;tipping point&quot; tends to be at kernel dimensions of the order of 10s of pixels, e.g. 31x31.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, rule of thumb: for small kernels use direct convolution, for large kernels do it in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2013-05-23T12:12:17.573" CommentCount="19" ContentLicense="CC BY-SA 3.0" />
  <row Id="9261" PostTypeId="1" CreationDate="2013-05-23T15:07:38.717" Score="4" ViewCount="1496" Body="&lt;p&gt;Right now I simply do this (pseudocode)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for freq in freqs:&#xA;    for i in len(samples):&#xA;        samples[i] += sin(...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a better way? This is for outputting to a 16-bit WAV file, using C on an ARM7 device. The frequencies are actually the centers of FFT bins for a particular bin size.&lt;/p&gt;&#xA;" OwnerUserId="3609" LastEditorUserId="3609" LastEditDate="2013-05-23T18:17:14.120" LastActivityDate="2013-05-23T18:17:14.120" Title="What is the most computationally efficient way to generate 100 sine waves layered on top of each other?" Tags="|sampling|modulation|software-implementation|performance|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9262" PostTypeId="2" ParentId="9261" CreationDate="2013-05-23T15:58:05.487" Score="1" Body="&lt;p&gt;Additive synthesis is always going to be fairly heavy on the CPU.  If you are not already I would look at using a &lt;a href=&quot;http://www.earlevel.com/main/2012/05/03/a-wavetable-oscillator%E2%80%94introduction/&quot; rel=&quot;nofollow&quot;&gt;Wavetable Oscillator&lt;/a&gt; to generate your sin waves.  It may also be worth &lt;a href=&quot;http://www.cs.umd.edu/class/fall2001/cmsc411/proj01/proja/loop.html&quot; rel=&quot;nofollow&quot;&gt;unrolling your loop&lt;/a&gt; (be sure to profile so you can see if it makes a difference).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You really need to profile your code and identify the bottlenecks unique to your program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mike&lt;/p&gt;&#xA;" OwnerUserId="4215" LastActivityDate="2013-05-23T15:58:05.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9264" PostTypeId="2" ParentId="9261" CreationDate="2013-05-23T16:25:33.557" Score="1" Body="&lt;p&gt;There are two things that you can do to speed things up:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Do frame based processing, i.e. compute 1000 or so samples at a time before writing them to the wavefile&lt;/li&gt;&#xA;&lt;li&gt;Minimize calls to transcendental functions (such as sine and cosine)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The second answer in this question &lt;a href=&quot;https://dsp.stackexchange.com/questions/971/how-to-create-a-sine-wave-generator-that-can-smoothly-transition-between-frequen&quot;&gt;How to create a sine wave generator that can smoothly transition between frequencies&lt;/a&gt; shows an algorithm that uses transcendental functions only during initialization and uses just 4 multiplies per sample and sine wave.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-05-23T16:25:33.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9266" PostTypeId="2" ParentId="9261" CreationDate="2013-05-23T17:27:53.043" Score="6" Body="&lt;p&gt;The most computationally efficient approach is to set up the data you want in the frequency domain by putting in the tones as &quot;spikes&quot; in the appropriate frequency bins, and then inverse FFT'ing it to get the time domain tones.  This approach will likely be a couple of orders of magnitude or so faster than your approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some downsides to doing it this way.  For tones whose frequencies are integer multiple of the sample frequency divided by the number of samples it is easy- just put a spike in at the appropriate frequency bin.  For all other frequencies, though, you need to put some energy into the neighboring bins as well.  I would have to think about how exactly to figure out how to do this.  I'm sure it can be done, but it's not a no-brainer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you need to just produce a block of samples with the tones this approach is ideal.  If you need to create a continuous stream, though, care would have to be taken to get the phases right from block to block.  Again, not a no-brainer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that being said, I am pretty sure that this is the most computationally efficient approach.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-05-23T17:27:53.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9267" PostTypeId="1" CreationDate="2013-05-23T14:14:30.943" Score="1" ViewCount="2530" Body="&lt;p&gt;Calculate the amount of operations you need for the Fast Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take $N=2048 \times 2048$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N\dfrac{\log(N)}{\log(2)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dfrac{\log(2048 \times 2048)}{\log(2)}$ is 22.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(2048 \times 2048) \dfrac{\log(2048 \times 2048)}{\log(2)}$ is 92274688.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But does $92274688$ stand for total operations or $92274688$ adds AND $92274688$ multiiplications?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the total amount of operations is $2\times 92274688=184549376$.&lt;/p&gt;&#xA;" OwnerUserId="4478" OwnerDisplayName="user8005" LastEditorUserId="80" LastEditDate="2013-05-23T21:43:04.247" LastActivityDate="2013-05-23T22:01:08.387" Title="FFT: Does the result of $N \log_2(N)$ stand for total operations or (complex) adds and multiplies?" Tags="|fft|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9268" PostTypeId="2" ParentId="9267" CreationDate="2013-05-23T15:07:22.623" Score="4" Body="&lt;p&gt;{EDIT: The original question concerned a $1920\times 1080$ FFT, not a $2040\times 2048$ FFT. So the parts of this answer that deal with sizes that are not powers of two are no longer relevant. I will leave them anyway. The last part of this answer, dealing with complex vs. real operations, remains relevant.}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 2-D FFT of size $N_1\times N_2$ is equivalent to performing $N_1$ FFTs of size $N_2$, and $N_2$ FFTs of size $N_1$. So the cost becomes &#xA;$$C_{2D}(N_1,N_2) = N_1C_{1D}(N_2)+N_2C_{1D}(N_1),$$ where $C_{1D}(N)$ is the cost of a single $N$-point, 1-D FFT. Your proposed calculations are correct, then, &lt;em&gt;if&lt;/em&gt; you assume $C_{1D}(N)=2N\log_2 N$, because this evaluates to $$2N_1N_2(\log_2 N_1+\log_2 N_2)=2N_1N_2\log_2(N_1N_2).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;[EDIT: This paragraph is no longer relevant; the OP has changed the FFT sizes to a power of two.]&lt;/em&gt; However, your other problem is that $C(N)$ is &lt;em&gt;not&lt;/em&gt; necessarily $kN\log_2 N$ (or close to it) unless $N$ is a power of two. In particular, if $N$ is prime, then you're going to need $kN^2$ operations. For values of $N$ that are composite prime factors, then the computational complexity is a function of the number of prime factors and their values. See &lt;a href=&quot;http://cnx.org/content/m16335/latest/&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; for a discussion of efficient prime factor FFTs. &lt;em&gt;Roughly&lt;/em&gt; speaking, if the number of prime factors is sufficiently large, then the cost is going to grow like $N\log N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even for powers of two, $C_{1D}(N)=2N\log_2 N$ is not quite right for several reasons. First of all, the standard radix-2 FFT actually requires $(N/2)\log_2 N$ complex multiplications and $N\log_2 N$ complex additions. Furthermore, you really don't want to just add these two counts together. After all, one complex addition requires 2 real additions, and one complex multiplication requires 4 multiplications and 2 additions. So if you want to combine these two operation counts, you need to do it in terms of these &lt;em&gt;real&lt;/em&gt; operations, giving you $C_{1D}=5N\log_2 N$ &lt;em&gt;real&lt;/em&gt; operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do significantly better than this, it turns out, if you take a careful accounting of &quot;trivial&quot; complex multiplications. One of the most efficient algorithms from a real operation standpoint is the &lt;em&gt;split-radix&lt;/em&gt; algorithm (which requires a power of two) requires $C_{1D}(N)=4N\log_2 N-6N+8$ real multiplications and additions for a single FFT. For a 2-D FFT of size $N_1\times N_2$, the total cost would be &#xA;$$\begin{aligned}&#xA;C_{2D}(N_1,N_2)&amp;amp;=N_1(4N_2\log_2 N_2-6N_2+8)+N_2(4N_1\log_2 N_1-6N_1+8)\\&#xA;&amp;amp;=4N_1N_2\log_2(N_1N_2)-12N_1N_2+8(N_1+N_2).&#xA;\end{aligned}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, let me add that counting floating point operations is a crude way to measure practical performance. Memory access patterns are often a more important factor in performance. Quoting &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;: &quot;In practice, actual performance on modern computers is usually dominated by factors other than the speed of arithmetic operations and the analysis is a complicated subject (see, e.g., Frigo &amp;amp; Johnson, 2005), but the overall improvement from O(N2) to O(N log N) remains.&quot;&lt;/p&gt;&#xA;" OwnerUserId="4402" OwnerDisplayName="Michael C. Grant" LastEditorUserId="4402" LastEditDate="2013-05-23T22:01:08.387" LastActivityDate="2013-05-23T22:01:08.387" CommentCount="26" ContentLicense="CC BY-SA 3.0" />
  <row Id="9269" PostTypeId="1" CreationDate="2013-05-23T18:48:04.440" Score="1" ViewCount="742" Body="&lt;p&gt;I would like to estimate the impulse response of a simple environment (room, two speakers, one microphone). I am aware of the issues/limitations of working with &quot;near&quot; LTI systems. That said, I have a rather basic question regarding the mechanics of performing cross-correlation using audio which has been recorded in my environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A: my original audio (swept sine) - 1 second in length, 16 bit, 44.1K &lt;/p&gt;&#xA;&#xA;&lt;p&gt;B: the result of recording A in my environment&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FvJoF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, my goal is to calculate the environment's impulse response, h[n], by calculating the cross-correlation of A and B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my question: I don't know if I should be doing anything to B (trimming on either end, shifting towards the left, etc.) before attempting to estimate the impulse response. The goal will be to use the IR to model what arbitrary audio will &quot;look&quot; like when played in my environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, I'm not sure how long (in # of samples) my IR should be. I've read that using a shorter IR can speed up processing without too much loss in estimating y[n] (the output of the system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the final version of this experiment the recording of B will be automated thus I'll need to know how long the recording needs to last to fully capture A's signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="4396" LastEditorUserId="4396" LastEditDate="2013-05-23T18:55:52.327" LastActivityDate="2013-05-23T20:29:56.247" Title="Calculating an impulse response in a stable environment" Tags="|cross-correlation|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9270" PostTypeId="2" ParentId="9269" CreationDate="2013-05-23T20:29:56.247" Score="1" Body="&lt;p&gt;The easiest way to calculate the impulse response is to divide the spectrum of the measured signal by the spectrum of the excitation and do an inverse FFT of the quotient. That's mathematically equivalent to the cross-correlation method but typically easier. It requires that the excitation signal has a reasonable amount of energy at all frequencies so you don't get any &quot;divide by 0&quot; problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The length of the impulse response is mostly determined by the reverberation time of the room. For most of home environments that's well below 0.5 seconds so 1s excitation should be plenty. For convenience I would chose a power of two, which makes the FFTs easier. You can still truncate after the IR has been calculated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most acoustic systems are actually strict LTI (if no one moves about), however the signal to noise ratio (SNR) tends to be poor especially at low frequencies. A good way to deal with this is to do &quot;coherent averaging&quot;. Create a periodic excitation (just keep repeating the sweep), throw away the first two frame acquisitions (long story) and then keep averaging the acquired frames. 10 averages will give you an SNR gain of 10 dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting the excitation level right is critical: if it's too low the SNR is bad and if it's too high, something will be overdriven and become non-linear. The speakers are probably the first candidate for distortion.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-05-23T20:29:56.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9271" PostTypeId="2" ParentId="9228" CreationDate="2013-05-23T22:37:04.797" Score="11" Body="&lt;p&gt;Here is another partial answer, mostly about designing custom windows. I came up with this while doing something that (as I know now but didn't then) is called &quot;windowing in the frequency domain.&quot; Then, after reading some original papers on windowing, I figured that it was probably the way that some windows were conceived in the first place, but I don't have any real background knowledge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start with a rectangular window and look at its Fourier transform, the sinc function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kicUj.png&quot; alt=&quot;sinc function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, scale and (frequency-)shift two of them so the sides lobes tend to cancel each other out when added together:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AbvoA.png&quot; alt=&quot;first step&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Result in green; sorry for the bad quality and useless legend.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, side lobes are not only reduced in general, they also roll off much more quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &quot;windowing in the frequency domain,&quot; the shifting and scaling is closely related to what actually happens in practice. But you are probably more interested in a time-domain representation, which is easy to obtain by applying appropriate formulas for the frequency shifts. It simplifies to $\cos(\pi t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Repeat this process, and you get better and better roll-off, at the cost of a wider main lobe:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zEL5P.png&quot; alt=&quot;second step&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This simplifies to $(\cos(\pi t))^2$ in the time domain, which is precisely a Hann window. In general, repeating this $n$ times yields $(\cos(\pi t))^n$. $n=4$ is a special case of a Blackman window, and all even $n$ belong to the Blackman-Harris family.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Among Blackman-Harris windows, these yield the fastest side lobe roll-off. (I started writing down a proof of this, but didn't even finish it because how to calculate roll-off and other parameters seems to be common knowledge among experts.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to optimize something else than roll-off, you can start with a window that has sufficient roll-off, then do something similar to the above, but scale and shift in a different way (usually using three terms instead of two). This will keep the roll-off exactly the same, but it allows you to reduce the first side lobes, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps. Have fun.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2013-05-23T22:37:04.797" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9272" PostTypeId="1" CreationDate="2013-05-23T22:46:17.177" Score="2" ViewCount="138" Body="&lt;p&gt;I'm looking for some suggestions and wondered if anyone had any ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have just completed a project in Speech Recognition using MFCC, Dynamic Time Warping and Hidden Markov Models etc.. (Some of you will probably remember me, and, how annoying I was!!) But I managed to complete it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's the summer now and I'm looking for project ideas, I want to keep on the signal processing and in particular speech recognition and wanted to ask if anyone had any suggestions which might challenge me, but, also give me a lot of knowledge so I can progress in this field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been thinking about Homophones and how these can be applied to speech; for example: &quot;I am going to the shop&quot;, &quot;I would like two apples please&quot; and was thinking this would require lexical analysis but I am not too sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2013-05-23T22:46:17.177" Title="Summer Projects - Suggestions" Tags="|speech-recognition|speech|project-ideas|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9273" PostTypeId="1" AcceptedAnswerId="9274" CreationDate="2013-05-23T23:03:09.027" Score="9" ViewCount="1682" Body="&lt;p&gt;I would like to ask a theoretical question concerning the Dirac function. The Fourier Transform of the Dirac function is the value 1 (DC) for every frequency. If we consider the Sampling Theorem, we have to find a maximum frequency in the signal $ \ f_{max} $, so that we can sample with $ \ f_s \ge \ 2f_{max}$. But as we can see from its Fourier Transform, the Dirac function contains every frequency, so we cannot find an appropriate $ f_s $ . My question is, from a theoretical point of view, can the Dirac function be sampled? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Thank you for your helpful answers guys!&lt;/p&gt;&#xA;" OwnerUserId="4640" LastEditorUserId="4298" LastEditDate="2023-03-16T12:51:23.077" LastActivityDate="2023-03-16T12:51:23.077" Title="Sampling the Dirac function" Tags="|sampling|dirac-delta-impulse|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9274" PostTypeId="2" ParentId="9273" CreationDate="2013-05-24T00:04:26.310" Score="7" Body="&lt;p&gt;Any &lt;em&gt;signal&lt;/em&gt; can be sampled, independently of whether the sampling theorem holds or not. The sampling theorem tells you that, if the sampling rate is enough, then the samples represent the complete original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signals with discontinuities or, even worse, distributions such as $\delta(t)$, are not band-limited, so the sampling theorem's hypothesis will never hold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that the usual demonstration of the sampling theorem involves multiplying the signal by a pulse train. I believe this rules out signals being distributions altogether, because the products of distributions &lt;a href=&quot;http://en.wikipedia.org/wiki/Distribution_%28mathematics%29#Problem_of_multiplication&quot;&gt;is not well defined&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, imagine sampling $\delta(t)$ at $t=0$. This sample has an undefined value.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2013-05-24T00:04:26.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9276" PostTypeId="1" AcceptedAnswerId="9277" CreationDate="2013-05-24T05:06:31.757" Score="10" ViewCount="97271" Body="&lt;p&gt;What are the salient differences between Lumped and Distributed systems? In what contexts are distributed systems the appropriate model and in what are lumped systems the appropriate model?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, Lumped systems are said to be described by ordinary differential equations while the latter is said to be described by partial differential equations. Can someone explain why?&lt;/p&gt;&#xA;" OwnerUserId="4638" LastEditorUserId="4346" LastEditDate="2014-09-03T15:21:01.380" LastActivityDate="2015-04-25T08:20:43.000" Title="What is the difference between Lumped and Distributed systems?" Tags="|linear-systems|system-identification|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9277" PostTypeId="2" ParentId="9276" CreationDate="2013-05-24T08:22:52.823" Score="12" Body="&lt;p&gt;The elements building a lumped system are thought of being &lt;strong&gt;concentrated at singular points&lt;/strong&gt; in space. The classical example is an electrical circuit with passive elements like resistor, inductance and capacitor. The physical quantities current and voltage are functions of &lt;strong&gt;time (only)&lt;/strong&gt;. E. g. the current at a capacitor with capacity $C$ is given by&#xA;$$&#xA;i(t) = C\frac{\mathrm d v(t)}{\mathrm d t}&#xA;$$&#xA;Where $C$ is a constant (and so are $R$ and $L$). This leads to ordinary differential equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, the elements in distributed systems are thought of being &lt;strong&gt;distributed in space&lt;/strong&gt;, so that physical quantities &lt;strong&gt;depend on both time and space&lt;/strong&gt;. The classical example is the electrical line where inductance, capacity and resistance are not constant but functions of length $x$. This leads to partial derivatives of $i(t,x)$ and $v(t,x)$ in $t$ and $x$.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="4638" LastEditDate="2013-05-24T17:04:33.583" LastActivityDate="2013-05-24T17:04:33.583" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9278" PostTypeId="2" ParentId="9273" CreationDate="2013-05-24T09:54:54.517" Score="8" Body="&lt;p&gt;I completely agree with Juancho's answer. I would just like to add a few things. I think the main problem is the misunderstanding which becomes evident in the last sentence of the question: &quot;... can the Dirac function be sampled?&quot; The Dirac impulse is NOT an ordinary function having definite values for every $t$, but it is a distribution (even though it is often called 'Dirac function'). One should therefore not try to 'evaluate' (or sample!) it. What is important about the Dirac impulse are its integral properties:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}\delta(t)dt = 1$$&#xA;and&#xA;$$\int_{-\infty}^{\infty}\delta(t-t_0)f(t)dt = f(t_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Juancho already pointed out, the square of a Dirac impulse $\delta^2(t)$ is not defined. So if you were to sample a Dirac impulse, you would get the undefined result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_n\delta(t-nT)\delta(t)=\delta^2(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dirac impulses are a convenient tool for analyzing linear time-invariant systems but they should be treated with care because common types of  processing performed on ordinary signals (such as sampling) may lead to undefined and meaningless results when applied to Dirac impulses.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-24T09:54:54.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9279" PostTypeId="2" ParentId="9276" CreationDate="2013-05-24T10:19:29.000" Score="8" Body="&lt;p&gt;It is important to realize that the terms &lt;em&gt;lumped&lt;/em&gt; or &lt;em&gt;distributed&lt;/em&gt; are not properties of the system itself. These properties are related to the size of the system &lt;em&gt;compared to&lt;/em&gt; the wavelength of the voltages and currents passing through it. So a resistor is or isn't a lumped element (even though it is usually meant to be one), depending on the frequency of the applied signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An element can be considered as &lt;em&gt;lumped&lt;/em&gt; if its size is much smaller than the wavelength of the applied voltages and currents. In this case wave propagation effects may be neglected and a lumped element can be treated as a black box which is completely described by the behavior at its terminals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I forgot to mention the differential equations. Lumped systems are described by ordinary differential equations because due to the small size of the system (compared to the wavelength), the spatial derivatives can be neglected and we only need to consider time derivatives. On the other hand, for distributed systems we need to take wave propagation phenomena into account and we get non-zero spatial as well as time derivatives, which leads to partial differential equations.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-24T13:10:44.343" LastActivityDate="2013-05-24T13:10:44.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9282" PostTypeId="1" CreationDate="2013-05-24T19:17:36.223" Score="1" ViewCount="86" Body="&lt;p&gt;I have a really simple question regarding this &lt;a href=&quot;http://mplab.ucsd.edu/tutorials/gabor.pdf&quot; rel=&quot;nofollow&quot;&gt;tutorial&lt;/a&gt; I found on Gabor filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the very beginning section, equations (1), (2), (3) and (4).  Is there any chance that equation (4) is missing an &lt;code&gt;=&lt;/code&gt; and should be written as follows?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;e^jθ * s(t) = e^j(2πfot+θ) = [sin(2πfot + θ), j cos(2πfot + θ)]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;          ^&#xA;          | &#xA;          |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is the missing &lt;code&gt;=&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And furthermore, why is the right hand-side of the equation written with the imaginary j multiplying the cosine and not on the sine as in &lt;a href=&quot;http://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;nofollow&quot;&gt;Euler's Formula&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally can anyone please help me interpret the frequency response of this filter (Sections 1.1 and 1.2)? What does it mean in terms of its frequency response that its Fourier Transform is the one of equation (8)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help!&lt;/p&gt;&#xA;" OwnerUserId="4170" LastEditorUserId="4170" LastEditDate="2013-05-28T17:36:49.327" LastActivityDate="2013-05-28T17:36:49.327" Title="Errata Corridge in Gabor Filter Documentation and Frequency Response" Tags="|image-processing|computer-vision|gabor|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9283" PostTypeId="1" CreationDate="2013-05-24T20:16:58.020" Score="3" ViewCount="169" Body="&lt;p&gt;I'm having a trouble here. I'm supposed to learn Frobenius canonical representation form for finding statespace matrices, but I found many different forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's suppose we have a system with this transfer function: $$H(s) = \frac {b_ns^n + b_{n-1}s^{n-1}+ \cdots + b_1s+b_0}{a_ns^n+a_{n-1}s^{s-1}+ \dots + a_1 s +a_0}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this system I'm able to find matrices as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A = \left| \matrix {0 &amp;amp; 1 &amp;amp; 0&amp;amp; \dots &amp;amp; 0\\0 &amp;amp; 0 &amp;amp;1&amp;amp;\dots&amp;amp;0\\ \vdots &amp;amp;&amp;amp;&amp;amp;&amp;amp; \vdots\\0&amp;amp;0&amp;amp;0&amp;amp;\cdots&amp;amp;1\\-\frac{a_0}{a_n}&amp;amp;-\frac{a_1}{a_n}&amp;amp;-\frac{a_2}{a_n}&amp;amp;\cdots&amp;amp;-\frac{a_{n-1}}{a_n}} \right|$$&#xA;$$B = \left| \matrix{0\\0\\\vdots\\\frac{1}{a_n}} \right|$$&#xA;$$C = \left|\matrix{b_0-\frac{a_0b_n}{a_n}&amp;amp;b_1-\frac{a_1b_n}{a_n}&amp;amp;\cdots&amp;amp;b_{n-1}-\frac{a_{n-1}b_n}{a_n}}\right|$$&#xA;$$D = \left|\matrix{\frac{b_n}{a_n}}\right|$$&#xA;Then matrices that look the same as this but $a_n$ is probably meant to be $1$, 'cause it's missing in every matrix. &#xA;But also:&#xA;$$A = \left| \matrix {-a_{n-1} &amp;amp; -a_{n-2} &amp;amp; \cdots &amp;amp; -a_1 &amp;amp; -a_0\\1 &amp;amp; 0 &amp;amp;\dots &amp;amp; 0&amp;amp;0\\ 0&amp;amp;1&amp;amp;\cdots&amp;amp;0&amp;amp;0\\\vdots &amp;amp;&amp;amp;&amp;amp;&amp;amp; \vdots\\0&amp;amp;0&amp;amp;\cdots&amp;amp;1&amp;amp;0} \right|$$&#xA;$$B = \left| \matrix{1\\0\\\vdots\\0} \right|$$&#xA;$$C = \left|\matrix{1&amp;amp;0&amp;amp;\cdots &amp;amp;0}\right|$$&#xA;$$D = 0$$&#xA;or:&#xA;$$A = \left| \matrix {-a_{n-1} &amp;amp; -a_{n-2} &amp;amp; \cdots &amp;amp; -a_1 &amp;amp; -a_0\\1 &amp;amp; 0 &amp;amp;\dots &amp;amp; 0&amp;amp;0\\ 0&amp;amp;1&amp;amp;\cdots&amp;amp;0&amp;amp;0\\\vdots &amp;amp;&amp;amp;&amp;amp;&amp;amp; \vdots\\0&amp;amp;0&amp;amp;\cdots&amp;amp;1&amp;amp;0} \right|$$&#xA;$$B = \left| \matrix{1\\0\\\vdots\\0} \right|$$&#xA;$$C = \left|\matrix{(b_{n-1}-b_na_{n-1})&amp;amp;(b_{n-2}-b_na_{n-2})&amp;amp;\cdots &amp;amp;(b_0-b_na_0)}\right|$$&#xA;$$D = \left|\matrix{b_n}\right|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somewhere it's shown as for &#xA;$$H(s) = \frac {b_ms^m + b_{m-1}s^{m-1}+ \cdots + b_1s+b_0}{a_ns^n+a_{n-1}s^{s-1}+ \dots + a_1 s +a_0}$$ &#xA;and  is wrote that $$D = \left|\matrix{\frac{b_m}{a_n}}\right|$$&#xA;without denote what exactly these indexes $m,n$ mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, what is the right Frobenius canonical form? &lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="4158" LastEditDate="2013-05-25T09:37:37.033" LastActivityDate="2013-05-25T09:37:37.033" Title="What is right and full Frobenius canonical form?" Tags="|state-space|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9284" PostTypeId="2" ParentId="3039" CreationDate="2013-05-24T20:58:08.027" Score="5" Body="&lt;p&gt;If I understood it correctly, you have something that is moving and you can observe the speed and this speed is noisy. From your measurements, you observe 2 kinds of variations.\&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Variations caused by the noise &lt;/li&gt;&#xA;&lt;li&gt;Variations because the object is truly changing the speed (e.g. turning)  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The reason your Kalman gain goes to zero is that you have implicitly assumed that the speed of the object is constant and all you need to do is to estimate this true speed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;em&gt;Hey, I have an object that is moving at a constant speed and I want to estimate this constant speed&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your model is like this, where $x_k$ is the speed at time $k$ and $y_k$ is the corresponding measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_k = x_{k-1} $$&#xA;$$ y_k = x_k + q_k $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But your object isn't moving that way. It's speed is changing and you don't know how and when it's going to change. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have to say instead is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&quot;&lt;em&gt;Hey, I have an object that is moving at a speed but I'm not sure about how it's changing its speed&lt;/em&gt;&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many ways you can do this: The simplest way is to add uncertainty your state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_{k} = x_{k-1} + \underbrace{v_{k-1}}_{\text{you add uncertainty}}$$&#xA;$$ y_k = x_k + q_k $$&#xA; where $q_k$ and $v_k$ are assumed to be white noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your Kalman Filter equations will look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat y_{k|k-1} = \hat x_{k|k-1} $$&#xA;$$ K_{k} = \frac{P_{k|k-1}}{P_{k|k-1} + Q^o}$$&#xA;$$ \hat x_{k|k}= \hat x_{k|k-1} + K_k(y_k - \hat y_{k|k-1})$$&#xA;$$ P_{k|k} = P_{k|k-1} - K_kP_{k|k-1}  $$&#xA;$$ P_{k+1|k} =P_{k|k} + Q^s  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case the &lt;code&gt;0.05&lt;/code&gt; value is the Observation noise covariance, $Q^o$. To make this change all you have to do is set $Q^s$, the state noise covarinace (the uncertanity in your state) to some constant value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your code the slight modification would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;stateVariance = 0.5&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;errorCovariance = (1 - kalmanGain) * priorErrVariance + stateVariance;&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By not adding the &lt;code&gt;stateVariance&lt;/code&gt; or $Q^s$ in your code you assumed that it is zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;code&gt;stateVariance&lt;/code&gt; value can be anything you want. It's based on your confidence on how much the speed will actually change. If you think the speed will remain fairly constant, set this to a small number. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way your Kalman Gain will not go to zero. &lt;/p&gt;&#xA;" OwnerUserId="4096" LastEditorUserId="4096" LastEditDate="2013-05-24T21:06:50.393" LastActivityDate="2013-05-24T21:06:50.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9285" PostTypeId="1" AcceptedAnswerId="9286" CreationDate="2013-05-25T04:31:16.727" Score="2" ViewCount="613" Body="&lt;p&gt;Define moving average process $y_t := 0.5 x_t + 0.5 x_{t-1}$ where $x_t := e^{i2 \pi t}$. Its frequency response is then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(f) = 0.5 + 0.5 e^{-i2\pi f}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that the frequency response in polar notation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(f) = G(f)e^{i \theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $G(f)$ is the gain function. We then have that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(f) = 0.5 \big( e^{-i \pi f} + e^{i \pi f} \big)e^{-i \pi f}$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;QUESTION&lt;/strong&gt;: Can someone please explain why the &lt;em&gt;last step&lt;/em&gt; is true? An explanation with some detail is much appreciated (I am new to signal analysis).&lt;/p&gt;&#xA;" OwnerUserId="4649" LastActivityDate="2013-05-25T05:37:33.907" Title="Gain function calculation (frequency response)" Tags="|fourier-transform|signal-analysis|frequency-response|moving-average|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9286" PostTypeId="2" ParentId="9285" CreationDate="2013-05-25T05:37:33.907" Score="3" Body="&lt;p&gt;One way to see the equivalence is to first factor out the $0.5$ in your initial transfer function, i.e. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(f) = 0.5(1 + e^{-i2\pi f}).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can rewrite the $1$ and $e^{-i2\pi f}$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(f) = 0.5(e^{i\pi f}e^{-i\pi f} + e^{-i\pi f}e^{-i\pi f}) = 0.5(e^{i\pi f} + e^{-i\pi f})e^{-i\pi f}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your result then follows as a trivial transform.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-05-25T05:37:33.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9287" PostTypeId="1" AcceptedAnswerId="9288" CreationDate="2013-05-25T14:09:43.900" Score="0" ViewCount="296" Body="&lt;p&gt;I am looking for Lossless compression algorithm for hyperspectral imaging. The only one that I found was LPVQ. &#xA;Do you know other algorithms? I am looking for pseudocode or matlab code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3189" LastActivityDate="2013-05-25T18:22:08.270" Title="Lossless algorithm for hyperspectral imaging" Tags="|image-processing|matlab|image-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9288" PostTypeId="2" ParentId="9287" CreationDate="2013-05-25T18:22:08.270" Score="1" Body="&lt;p&gt;I have played with SVD for 3 channel image lossy compression in the past, which prompted me to do a quick search and found the following paper which may help you out.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.hindawi.com/journals/jece/2012/409357/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Randomized SVD Methods in Hyperspectral Imaging&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Abstract&lt;/p&gt;&#xA;&lt;p&gt;We present a randomized singular value decomposition (rSVD) method for the purposes of lossless compression, reconstruction, classification, and target detection with hyperspectral (HSI) data. Recent work in low-rank matrix approximations obtained from random projections suggests that these approximations are well suited for randomized dimensionality reduction. Approximation errors for the rSVD are evaluated on HSI, and comparisons are made to deterministic techniques and as well as to other randomized low-rank matrix approximation methods involving compressive principal component analysis. Numerical tests on real HSI data suggest that the method is promising and is particularly effective for HSI data interrogation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="178" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-05-25T18:22:08.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9289" PostTypeId="2" ParentId="8297" CreationDate="2013-05-25T19:16:36.343" Score="1" Body="&lt;p&gt;I think it is evident in both cases. It follows directly from&#xA;$$ P(A|B,C,D) = P(((A|B)|C)|D)$$&#xA;.i.e.&#xA;$$P(x[k]\!=\!\hat{x}[k]|\!\hat{z}_1[k]\!=\!z_1[k],\!\hat{z}_2\![k]\!=\!z_2[k])\!=\! P\Bigg(&#xA;  \Big(&#xA;      x[k]\!=\!\hat{x}[k]|\!\hat{z}_1[k]\!=\!z_1[k]&#xA;  \Big)|\!\hat{z}_2[k]\!=\!z_2[k]&#xA;\Bigg)$$&#xA;As long as you don't do a prediction update it should be fine.&#xA;For nonlinear system, you won't get the same exact estimate, because you will end up with a new dynamics, input, measurement and feedback matrices on every &quot;single-measurement&quot; update&lt;/p&gt;&#xA;" OwnerUserId="4634" LastEditorUserId="4634" LastEditDate="2013-06-09T23:27:33.673" LastActivityDate="2013-06-09T23:27:33.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9290" PostTypeId="2" ParentId="1045" CreationDate="2013-05-25T20:46:21.430" Score="2" Body="&lt;p&gt;As best I can understand, you are interested in achieving edge-preserving denoising of the same &quot;quality&quot; given by the algorithm in the paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.132.522&quot; rel=&quot;nofollow noreferrer&quot;&gt;Giovani Gómez: Local Smoothness in terms of Variance: the Adaptive Gaussian Filter. &lt;em&gt;Proceedings of the British Machine Vision Confernce&lt;/em&gt;, 2000.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The images from that paper that you used above (&lt;a href=&quot;https://dsp.stackexchange.com/questions/1344/blurring-in-anisotropic-outputs&quot;&gt;and in the duplicate of this question that you posted a month later&lt;/a&gt;) are available in Section 4 of the &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/GOMEZ1/&quot; rel=&quot;nofollow noreferrer&quot;&gt;link you provided&lt;/a&gt;, which seems to be a later version of the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two things you should try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, as @Jean-Yves suggested to you several times, &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;median filtering&lt;/em&gt;&lt;/a&gt; is a non-linear filter that &lt;em&gt;preserves edges&lt;/em&gt; (although it tends to round off sharp corners).  Whether it does so effectively depends on the amount of noise in the image, and your example images are very noisy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the currently popular edge-preserving denoising algorithm is &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilateral_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;the bilateral filter&lt;/a&gt;.  This is implemented in photoshop, and in &lt;a href=&quot;http://www.gegl.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GEGL&lt;/a&gt; (which is available through &lt;a href=&quot;http://www.gimp.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Gnu Image Manipulation Program&lt;/a&gt; in the Tools-&gt;GEGL Operation menu).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the pinecone with a radius 1 median filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n332e.png&quot; alt=&quot;median filtered image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With GEGL's bilateral filter (gaussian radius of 4, and &quot;edge preservation&quot; set at 8%):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gdxp8.png&quot; alt=&quot;bilateral filtered image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With GEGL's bilateral filter (gaussian radius of 4, and &quot;edge preservation&quot; set at 4%):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NwkFP.png&quot; alt=&quot;bilateral filtered with less edge preservation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And with median filter of radius 1 followed by GEGL's bilateral filter with gaussian radius of 4 and &quot;edge preservation&quot; set at 50%:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PfCcu.png&quot; alt=&quot;median and bilateral filtering&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of which I prefer to the result of Gómez's adaptive filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/90zD2.gif&quot; alt=&quot;gomez adapative filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my answer to this question (and to &lt;a href=&quot;https://dsp.stackexchange.com/questions/1365/how-to-remove-gaussian-noise-without-destroying-the-edges&quot;&gt;How to remove Gaussian noise without destroying the edges?&lt;/a&gt;, which you posted on Feb 7, 2012) is: try median filtering and bilateral filtering.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-05-25T21:11:38.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9291" PostTypeId="1" CreationDate="2013-05-26T13:25:33.117" Score="1" ViewCount="76" Body="&lt;p&gt;I found out today about Google +'s &lt;a href=&quot;http://www.androidpolice.com/2013/05/21/googles-best-new-unadvertised-feature-photo-search-with-visual-recognition-try-it-on-your-own-pictures-and-be-amazed/&quot; rel=&quot;nofollow noreferrer&quot;&gt;image search feature&lt;/a&gt;. It allows users to perform a text-based search for objects within their picture library. I was instantly curious to know how this feature works. Does anyone know? Are Google using anonymous usage patterns from Google Images to build a computer vision library of CBIR object descriptors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly related is Google's 'Search by image' feature - see &lt;a href=&quot;https://dsp.stackexchange.com/questions/5995/what-algorithm-does-google-use-for-its-search-by-image-site&quot;&gt;What algorithm does Google use for its &amp;quot;Search By Image&amp;quot; site?&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3963" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-05-26T13:25:33.117" Title="How does Image Search on Google + work" Tags="|image-processing|" AnswerCount="0" CommentCount="2" ClosedDate="2013-06-05T03:18:07.903" ContentLicense="CC BY-SA 3.0" />
  <row Id="9292" PostTypeId="1" CreationDate="2013-05-26T14:08:02.797" Score="0" ViewCount="1511" Body="&lt;p&gt;The Nyquist formula for digitally sampling and recovering a continuous waveform is well known. Are there any mathematical formulas that show that it is computationally infeasible (or impossible) to reconstruct a waveform if you go below a certain sampling frequency? &lt;/p&gt;&#xA;" OwnerUserId="4660" LastEditorUserId="4298" LastEditDate="2020-10-28T13:01:26.637" LastActivityDate="2020-10-28T13:01:26.637" Title="Sampling Frequency Math" Tags="|sampling|frequency|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9293" PostTypeId="2" ParentId="9292" CreationDate="2013-05-26T17:15:50.447" Score="5" Body="&lt;p&gt;Sampling a continuous signal $x(t)$ can be modeled by multiplication with a delta pulse train:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_s(t)=x(t)\cdot\sum_{n=-\infty}^{\infty}\delta(t-nT)=&#xA;\sum_{n=-\infty}^{\infty}x(nT)\delta(t-nT)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is the sampling interval: $T=1/f_s$ ($f_s$ is the sampling frequency). Multiplication in the time-domain corresponds to convolution in the frequency domain. So the spectrum of the sampled signal can be computed by convolving the transforms of $x(t)$ and of the pulse train:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)\Longleftrightarrow X(f)\\&#xA;\sum_{n=-\infty}^{\infty}\delta(t-nT)\Longleftrightarrow&#xA;\frac{1}{T}\sum_{k=-\infty}^{\infty}\delta(f-kf_s)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution of these two Fourier transforms gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_s(t)\Longleftrightarrow X_s(f)=&#xA;\frac{1}{T}\sum_{k=-\infty}^{\infty}X(f-kf_s)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (1) shows that the spectrum of a sampled signal is composed of shifted versions of the original spectrum. The shift corresponds to multiples of the sampling frequency $f_s$. Consequently, if the spectrum $X(f)$ is exactly zero for frequencies greater than $f_s/2$, then the shifted versions do not overlap, and the original spectrum can be reconstructed by lowpass filtering the spectrum of the sampled signal. If $X(f)$ is not band-limited to $f_s/2$, i.e. it has frequency components greater than $f_s/2$, the shifted spectra in Equation (1) overlap, and the original signal can in general not be reconstructed from the sampled signal. This is what the sampling theorem states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; For non-periodic signals - i.e. if $X(f)$ does not contain Dirac impulses - it is sufficient for reconstruction that $X(f)$ does not contain frequency components above $f_s/2$. In this case it is (theoretically) possible to reconstruct $x(t)$ from its samples $x(nT)$ by applying an ideal lowpass filter with cut-off frequency $f_s/2$. The impulse response of such an ideal lowpass filter is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_{LP}(t)=\frac{\sin (\pi t/T)}{\pi t/T}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering $x_s(t)$ with this impulse response yields the original signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{n=-\infty}^{\infty}x(nT)\frac{\sin [\pi (t-nT)/T]}{\pi (t-nT)/T}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (2) is usually referred to as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&quot; rel=&quot;nofollow&quot;&gt;Whittaker-Shannon interpolation formula&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally one does not need to consider what is actually happening at the frequency $f_s/2$. The only case where this is necessary is the presence of a pure sinusoid with frequency $f_s/2$. From Equation (1) we can see that in this case the shifted spectra (for $k=\pm 1$) will also produce spectral lines at $\pm f_s/2$, which in general will make impossible the reconstruction of the sinusoid at $f_s/2$. Apart from this somewhat artificial case, it suffices to require that the signal does not contain any frequency components greater than $f_s/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above considerations are of course of a purely theoretical nature, because there exist neither ideally band-limited signals nor ideal lowpass filters. Consequently, in practice we will choose the sampling frequency such that it is well above twice the maximum signal frequency of interest. The anti-aliasing filter must pass frequencies up to this maximum frequency, then it has a finite transition bandwidth, and then we can choose a frequency in the stopband of the filter where the stopband attenuation guarantees that aliasing errors are sufficiently small for the given application. This frequency can finally be considered the &quot;bandwidth&quot; $B$, and the sampling frequency can now be chosen as $f_s\ge 2B$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-30T19:22:18.723" LastActivityDate="2013-05-30T19:22:18.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9294" PostTypeId="1" CreationDate="2013-05-27T01:37:44.940" Score="1" ViewCount="159" Body="&lt;p&gt;I have a signal sampled from a hardware, &lt;code&gt;s&lt;/code&gt;. I would like to compute the coherence of the sampled signal given a single frequency, &lt;code&gt;f&lt;/code&gt;. Below are the approaches I can think of. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Base on &lt;code&gt;f&lt;/code&gt; generate a synthetic signal and compute the coherence of &lt;code&gt;s&lt;/code&gt; and the synthetic signal.&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;SNR&lt;/code&gt; similar approach with frequency range &lt;code&gt;[f - a, f + a]&lt;/code&gt; to compute the &lt;code&gt;SNR&lt;/code&gt; of &lt;code&gt;s&lt;/code&gt; as its coherence level, where &lt;code&gt;a&lt;/code&gt; is a threshold. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know both approach are not the right way to do it. There are just the possible solutions come to my mind. I would like to know how to do it right. &lt;/p&gt;&#xA;" OwnerUserId="4430" LastEditorUserId="4430" LastEditDate="2013-05-27T13:07:39.043" LastActivityDate="2013-05-27T13:07:39.043" Title="Coherence of a single function given a single frequency" Tags="|coherence|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9298" PostTypeId="1" AcceptedAnswerId="9299" CreationDate="2013-05-27T12:09:34.263" Score="8" ViewCount="2979" Body="&lt;p&gt;I'm writing program (Qt widgets/c++) for removing noise from images. As denoising method, i selected &lt;a href=&quot;http://en.wikipedia.org/wiki/Non-local_means_filter&quot; rel=&quot;noreferrer&quot;&gt;non local means method&lt;/a&gt;. This method has incredible quality of restored images (that's why it's the only denoising method in OpenCV), but has &lt;strong&gt;huge&lt;/strong&gt; computation cost, so i made a lot of modified variants of this method (some with multithreading, some algorithmic). But, i'm having problem with the one, involving &lt;strong&gt;FFT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed all the steps of &lt;a href=&quot;http://db.tt/cwwOTcje&quot; rel=&quot;noreferrer&quot;&gt;this article&lt;/a&gt; (only one page, 1430) and all works perfectly, except for FFT part, there just 2 lines about it in the paper and i can't understand, HOW should one use fft&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem has bothered me for months, any help or insight would be greatly appriciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shortened version of question:&#xA;  How can i get summed squared difference of two arrays on the image (the one at top and one in the middle, values are colors) quickly? ( O(n^2) is huge cost, there are lots of this kind of operations, paper above states, that it can be done via FFT with O(n*log n) (says that this 2 arrays forming circular convolution somehow))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xZ03W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4668" LastActivityDate="2016-11-23T13:21:21.217" Title="How one apply correctly FFT in image denoising" Tags="|image-processing|fft|filters|fourier-transform|denoising|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9299" PostTypeId="2" ParentId="9298" CreationDate="2013-05-27T15:27:56.943" Score="5" Body="&lt;p&gt;The trick inside the paper is the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What you want to compute is $\sum_{i \in W} |I(x+i)-I(y+i)|^2$, where $I$ is an image, $x$ and $y$ two noisy pixels and $i$ is a 2D offset used to define a patch.&lt;/li&gt;&#xA;&lt;li&gt;Expanding the expression yields: $\sum_i I^2(x+i) + \sum_i I^2(y+i) - 2 \sum_i I(x+i)I(y+i) = A + B - 2C$.&lt;/li&gt;&#xA;&lt;li&gt;$A$ and $B$ are computed using a squared integral image, i.e., an integral image from the squared original image.&lt;/li&gt;&#xA;&lt;li&gt;$C$ is the convolution between the two patches centered on $x$ and $y$. Thus, it can be computed in the Fourier domain, where it becomes a multiplication. You get the value of $C$ by computing the Fourier transform of the patch around $x$, the patch around $y$, pointwise-multiplying these results and taking the inverse Fourier transform of the multplication result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform is obviously a 2D transform since you are working with 2D data. What you obtain for a given patch is a 2D array of complex values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Additional notes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion this article is not the best NL-means speedup strategy.&#xA;Experiments I did way back in 2007/2008 show that pre-selection of patches are better (both in terms of speed and quality of the results).&#xA;I have started blogging about these &lt;a href=&quot;http://www.computersdontsee.net/blog/2013/02/09/Introducing-NL-means/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but unfortunately I am looking for time to finish the posts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original NL-means papers mention blockwise implementations that can be interesting. There are fundamentally 2 ways in implementing NL-means: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;writing a denoising loop for every pixel in the image&lt;/li&gt;&#xA;&lt;li&gt;writing a denoising loop for each patch, then back-project the patches to form an image.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The first impolementation is the original approach, because in 2005 memory and multicore CPUs were expensive. I chose on the other hand number 2 on recent hardware in the past 2 years. It depends on your typical image size and if you want to be able to compute domain transforms like DFT/DCT (as in the proposed paper and in BM3D).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2016-11-23T13:21:21.217" LastActivityDate="2016-11-23T13:21:21.217" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="9301" PostTypeId="2" ParentId="1990" CreationDate="2013-05-27T16:03:57.377" Score="1" Body="&lt;p&gt;There is an interesting paper on this topic:&#xA;&lt;a href=&quot;http://link.springer.com/chapter/10.1007%2F978-3-642-17691-3_19#&quot; rel=&quot;nofollow&quot;&gt;http://link.springer.com/chapter/10.1007%2F978-3-642-17691-3_19#&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper describes a method to filter out some wrong correspondences before computing homographies in the RANSAC algorithm. &lt;/p&gt;&#xA;" OwnerUserId="4671" LastActivityDate="2013-05-27T16:03:57.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9306" PostTypeId="1" CreationDate="2013-05-28T00:23:49.647" Score="10" ViewCount="486" Body="&lt;p&gt;I do understand the mathematics behind digital beamforming but I am not sure how such systems are practically implemented. For example, in a typical wideband FMCW radar operating in S-band, the (baseband) pulse bandwidth can be as large as 500MHz. To digitize this signal, you need high-speed ADCs, typically 1GHz sampling frequency. As far as I know, these ADCs are not cheap. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you have let's say a Uniform Rectangular Array (URA) with 20 antenna elements, you need to replicate your RF frontend 20 times! This RF frontend typically will include an LNA, a mixer and the high-speed ADC. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, the sheer amount of data produced by the above system is huge requiring large memory and processing power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are thus:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does the above scenario reflect how practical beamforming systems are implemented or is it too naive? am I missing something fundamental here?&lt;/li&gt;&#xA;&lt;li&gt;Are there any hardware/signal processing tricks that can help reduce the hardware or processing requirements in such systems?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4673" LastEditorUserId="128" LastEditDate="2018-06-20T09:19:32.107" LastActivityDate="2018-07-01T06:17:15.523" Title="Practical wideband digital beamforming for large arrays in radar applications" Tags="|sampling|beamforming|array-signal-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9308" PostTypeId="2" ParentId="9156" CreationDate="2013-05-28T09:06:01.910" Score="3" Body="&lt;p&gt;For the general second order section (biquad)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2}}{1 + a_1 z^{-1} + a_2 z^{-2}} = b_0\frac{(1-qz^{-1})(1-\bar{q}^{-1}z^{-1})}{(1-pz^{-1})(1-\bar{p}^{-1}z^{-1})}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with a pair of complex conjugate zeros ($q,\bar{q}, q=R_qe^{j\theta_q}$) and poles ($p,\bar{p}, p=R_pe^{j\theta_p}$) the step response $s(n)$, if put on this form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s(n) = a_{\infty}(1+d(n))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a_{\infty}$ is the steady-state response and $d(n)$ the transient response, is governed by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_{\infty} = \frac{1-2R_q\cos(\theta_q)+R_q^2}{1-2R_p\cos(\theta_p)+R_p^2}$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$d(n) = K(\lambda_1\sin(\theta_p[n+1]) + \lambda_{-1}\sin(\theta_p[n-1]) - \lambda_{2}\sin(\theta_p[n+2])-\lambda_{0}\sin(\theta_pn))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$K = \frac{R_p^n}{\sin(\theta_p)(1-2R_q\cos(\theta_q) + R_q^2)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lambda_{-1} = R_q^2, \quad \lambda_{0} = 2R_qR_p\cos(\theta_q)+R_q^2R_p^{-1}, \quad \lambda_{1} = 2R_q\cos(\theta_q)+R_p^2, \quad \lambda_{2} = R_p$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are no zeros, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lambda_{-1} = 0, \quad \lambda_{0} = 0, \quad \lambda_{1} = R_p^2, \quad \lambda_{2} = R_p, \quad K=\frac{R_p^n}{\sin(\theta_p)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the expression for $d(n)$ reduces to the expression provided in the other post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the independent variable $n$ is treated at continuous, the letter $t$ is used instead of $n$, then the value of $t$ that maximizes $d(t)$ can be found. It is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_{max} = \frac{1}{\theta_p}\left( \tan^{-1}(-\frac{\ln(R_p)\sin(\theta_p)(\lambda_1-\lambda_{-1}) - \lambda_2\ln(R_p)\sin(2\theta_p) + \lambda_1\theta_p\cos(\theta_p) + \lambda_{-1}\theta_p\cos(\theta_p)-\lambda_2\theta_p\cos(2\theta_p) - \lambda_0\theta_p}{\ln(R_p)\cos(\theta_p)(\lambda_1+\lambda_{-1}) - \lambda_2\ln(R_p)\cos(2\theta_p) - \lambda_1\theta_p\sin(\theta_p) + \lambda_{-1}\theta_p\sin(\theta_p)\lambda_2\theta_p\sin(2\theta_p) - \lambda_0\ln(R_p)}) - k\pi\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of $t_{max}$ can then be rounded towards nearest integer and used in the response for $d(n)$. In the expression for $t_{max}$, the value of $k$ must be chosen such that $t_{max}$ is in range $0\leq t_{max} \leq \frac{\pi}{\theta_p}$ and it must be verified that $t_{max}$ is a maximum and not a minimum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the all pole case this plot illustrates the maximum overshoot as function of pole radius and angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C868F.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2013-05-28T10:30:00.000" LastActivityDate="2013-05-28T10:30:00.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9309" PostTypeId="2" ParentId="9248" CreationDate="2013-05-28T09:17:25.567" Score="1" Body="&lt;p&gt;Here is the IDFT with normal and positive only frequencies if it helps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=4;&#xA;A=rand(N-1,1) + j*rand(N-1,1);   % Random positive carrier&#xA;X=[0; A; 0; flipud(conj(A))];    % Hermitian symmetric DFT vector&#xA;Xp=[0; 2*A; 0; zeros(size(A))];  % Positive freq only DFT vector&#xA;&#xA;x = ifft(X);         % Normal IDFT&#xA;xa = ifft(Xp);       % Analytic signal&#xA;xp = real(ifft(Xp)); % Same as normal IDFT&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-28T09:17:25.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9310" PostTypeId="2" ParentId="9306" CreationDate="2013-05-28T13:04:56.223" Score="2" Body="&lt;p&gt;I've not worked on the design of such systems before, but I think your notions are on the money. Specifically, yes, beamforming arrays do have RF front ends that are replicated many times. The complexity of contemporary phased array radars is astounding in this regard; there are designs that have hundreds of individual antenna elements in them with impressive levels of control of the array response using various signal processing techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as you suspected, yes, this sort of approach is &lt;strong&gt;not&lt;/strong&gt; cheap. Gigasample-class ADCs are available commercially in the few-thousands-of-dollars range, but it's possible that the custom, low-quantity RF front ends used in systems like this would dwarf that cost. Even so, radars with this sort of capability are often found as subsystems in very expensive larger systems (like a multi-hundred-million-dollar fighter jet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as the backend digital signal processing goes, that's a pretty mature market that has developed over the past few decades. The main goal is processing density: getting the maximum number of FLOPS into the smallest volume. After all, such radars are often used in space-constrained applications like aircraft. Therefore, you'll see a lot of the processing done on custom FPGAs and/or single-board computers that can be stacked compactly into standardized chassis assemblies (like &lt;a href=&quot;http://en.wikipedia.org/wiki/VPX&quot; rel=&quot;nofollow&quot;&gt;VPX&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/CompactPCI&quot; rel=&quot;nofollow&quot;&gt;CompactPCI&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-28T13:04:56.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9312" PostTypeId="1" AcceptedAnswerId="9316" CreationDate="2013-05-28T15:52:04.720" Score="0" ViewCount="795" Body="&lt;p&gt;Sorry for the long question, but I'm struggling to implement something related to this question. Your help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notation: In the sequel, the uppercase letters represent frequency domain vectors, while lowercase represent time-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have two $N$-length hermitian symmetric DFT vectors $\mathbf{X}$ and $\mathbf{H}$, one representing a symbol and the other a channel through which the symbol goes. Thus, the received symbol in the time domain could be expressed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{y} = \mathbf{h} * \mathbf{x}&#xA;\end{align}&#xA;where $\mathbf{h}$ is the channel impulse response, $\mathbf{x}$ is the IDFT of $\mathbf{X}$ and &quot;$*$&quot; denotes the circular convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This result could also be obtained by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{y} = \tilde{H} \mathbf{x}&#xA;\end{align}&#xA;where $\tilde{H}$ is the circulant matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, considering only the positive frequencies from both $\mathbf{X}$ and $\mathbf{H}$, that is, $\mathbf{X_+} = \{\mathbf{X(1), X(2), \cdots, X(N/2+1)}\}$ and $\mathbf{H_+} = \{\mathbf{H(1), H(2), \cdots, H(N/2+1)}\}$, it is possible to obtain $\mathbf{y_+}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{y_+} = \mathbf{h_+} * \mathbf{x_+}&#xA;\end{align}&#xA;where $\mathbf{x_+}$ is the IDFT of $\mathbf{X_+}$ and $\mathbf{h_+}$ the IDFT of $\mathbf{H_+}$, both having size $(N/2 + 1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, $\mathbf{y}$ could be perfectly reconstruced from $\mathbf{y_+}$, since its IDFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{Y}_+ = \mathbf{H_+}\cdot\mathbf{X_+}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\mathbf{y_+}$ vector can also be obtained by making a circulant matrix with the IDFT of $\mathbf{H_+}$, which is a complex vector (because $\mathbf{H_+}$ does not have hermitian symmetry), and multiplying the new circulant matrix by the IDFT of $\mathbf{X_+}$, which is also complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ideal received symbol $\mathbf{y}$ is of my interest. However, I also need to know the intersymbol interference occurring when $\mathbf{x}$ is linearly convolved (not circularly) with the channel. I want to know this using $\mathbf{x_+}$ and $\mathbf{h_+}$, since I want to pre-equalize the symbols and using $(N/2 +1)$ vectors requires less operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the IDFT of the positive frequencies from the original hermitian symmetric DFT vectors  as the actual transmit symbols, how could the result of a linear convolution be recovered perfectly? &#xA;The circular convolution is perfectly recovered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently think it is not possible, because the interference will be different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sample code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circular convolution is perfectly recovered:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=8;&#xA;&#xA;x = rand(N,1); % Time-domain random symbol&#xA;h = rand(N,1); % Time-domain random channel&#xA;X = fft(x); % Symbol FFT&#xA;H = fft(h); % Channel FFT&#xA;Y = H.*X; % Ideal Received Symbol (Ideal because of circular convolution)&#xA;&#xA;% Time-domain complex vectors from positive frequencies&#xA;x_plus = ifft(X(1:(N/2 +1))); &#xA;h_plus = ifft(H(1:(N/2 +1)));&#xA;% Time-domain complex received symbol&#xA;y_plus = cconv(x_plus,h_plus,(N/2 +1));&#xA;Y_plus = fft(y_plus); % FFT of the complex received yields positive freqs.&#xA;&#xA;% Comparison&#xA;[Y_plus; flipud(conj(Y_plus(2:end-1)))]&#xA;% Should be equal to:&#xA;Y &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It doesn't work for linear convolution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=8;&#xA;&#xA;x = rand(N,1); % Time-domain random symbol&#xA;h = rand(N,1); % Time-domain random channel&#xA;X = fft(x); % Symbol FFT&#xA;H = fft(h); % Channel FFT&#xA;&#xA;y = conv(h,x); % Linear convolution&#xA;y = y(1:N); % Remove convolution tail&#xA;Y = fft(y); % Ideal Received Symbol (Ideal because of circular convolution)&#xA;&#xA;% Time-domain complex vectors from positive frequencies&#xA;x_plus = ifft(X(1:(N/2 +1))); &#xA;h_plus = ifft(H(1:(N/2 +1)));&#xA;% Time-domain complex received symbol&#xA;y_plus = conv(x_plus,h_plus); % Linear convolution&#xA;y_plus = y_plus(1:(N/2+1)); % Remove convolution tail&#xA;Y_plus = fft(y_plus); % FFT of the complex received yields positive freqs.&#xA;&#xA;% Comparison&#xA;[Y_plus; flipud(conj(Y_plus(2:end-1)))]&#xA;% Should be equal to:&#xA;Y &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4590" LastActivityDate="2013-05-29T01:14:34.357" Title="How to express linear convolution using positive frequencies from channel and symbol DFT vectors?" Tags="|convolution|dft|symmetry|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9313" PostTypeId="2" ParentId="9312" CreationDate="2013-05-28T16:31:03.153" Score="0" Body="&lt;p&gt;I think already your fist equation is potentially wrong. The output of the channel is given by LINEAR convolution signal and channel impulse response, not by circular convolution. Circular convolution can be used but only if signal and impulse response of the channel are sufficiently small and enough zero padding is applied to avoid wrap-around errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dumping the imaginary part of the spectrum is also problematic. This basically an &quot;analytic&quot; signal (at least if the negative frequencies are set to 0). This typically is a non-causal operation and it becomes very difficult to determine when you will be getting wrap around errors and when you don't. You will almost certainly end up with a non-causal impulse response of the channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What exactly are you trying to achieve and why?&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-05-28T16:31:03.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9314" PostTypeId="1" CreationDate="2013-05-28T16:46:48.490" Score="-1" ViewCount="414" Body="&lt;p&gt;I would like to compare the positions of the same object in 2 different pictures and get the difference between the positions in in terms of x and y coordinates.Suppose I have a picture with a square figure on it at the centre and then I reposition the square to the top right corner.I would like to find by what distance has the square moved.&lt;/p&gt;&#xA;" OwnerUserId="4681" LastActivityDate="2013-07-09T18:55:01.400" Title="obtain the position of an object in an image" Tags="|image-processing|object-recognition|position|" AnswerCount="2" CommentCount="1" ClosedDate="2013-07-20T22:36:11.080" ContentLicense="CC BY-SA 3.0" />
  <row Id="9315" PostTypeId="2" ParentId="9273" CreationDate="2013-05-28T21:12:07.393" Score="2" Body="&lt;p&gt;The information carried by a Dirac are its location and intensity. Vetterli et al. show how it possible to sample a signal given by the sum of N diracs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)=\sum_{i=0}^{N-1}r_i\delta(t-t_i)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling $x(t)$ in this context means recovering $r_i$ and $t_i$ for $i=0,\ldots,N-1$. In short, this is done by low-pass filtering $x(t)$ and using standard spectral estimation techniques. For more details see:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blu, Thierry, et al. &quot;Sparse sampling of signal innovations.&quot; Signal Processing Magazine, IEEE 25.2 (2008): 31-40.&lt;/p&gt;&#xA;" OwnerUserId="1696" LastActivityDate="2013-05-28T21:12:07.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9316" PostTypeId="2" ParentId="9312" CreationDate="2013-05-29T01:14:34.357" Score="0" Body="&lt;p&gt;According to wikipedia, the convolution theorem, where convolution is a multiplication in the  Fourier domain, only holds for the DFT when using circular convolution. This is because the DFT assumes the signal is periodic, but using the normal MATLAB convolution operator is basically zero-padding the signal vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the convolution tail, it is at the start and end of the output. Remove it using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;conv(x,h,'same');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x_plus = ifft(X(1:(N/2 +1))); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is not the same as IDFT of positive frequencies. What you want is to set the negative frequencies to 0&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X(end-2:end) = 0;&#xA;H(end-2:end) = 0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adjusted code: (note: I haven't figured out the exact expression so there is a lot of literal values in there)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=8;&#xA;&#xA;x = rand(N,1); % Time-domain random symbol&#xA;h = rand(N,1); % Time-domain random channel&#xA;X = fft(x); % Symbol FFT&#xA;H = fft(h); % Channel FFT&#xA;&#xA;y = cconv(h,x,8); % Circle convolution&#xA;%y = y(1:N); % Remove convolution tail&#xA;Y = fft(y); % Ideal Received Symbol (Ideal because of circular convolution)&#xA;&#xA;% Time-domain complex vectors from positive frequencies&#xA;X(end-2:end) = 0;&#xA;H(end-2:end) = 0;&#xA;x_plus = ifft(X); &#xA;h_plus = ifft(H);&#xA;% Time-domain complex received symbol&#xA;y_plus = cconv(x_plus,h_plus,8); % Circle convolution&#xA;%y_plus = y_plus(1:(N/2+1)); % Remove convolution tail&#xA;Y_plus = fft(y_plus); % FFT of the complex received yields positive freqs.&#xA;&#xA;% Comparison&#xA;[Y_plus(1:5);conj(Y_plus(4:-1:2))]&#xA;% Should be equal to:&#xA;Y &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-05-29T01:14:34.357" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9317" PostTypeId="2" ParentId="7980" CreationDate="2013-05-29T02:05:16.373" Score="2" Body="&lt;p&gt;Sure, that is one way of accomplishing your task so long as you do blending/interpolation to smooth the pixels in between. See these &lt;a href=&quot;http://www.cs.unc.edu/~lazebnik/research/fall08/lec08_faces.pdf&quot; rel=&quot;nofollow&quot;&gt;slides&lt;/a&gt; (esp. the last slide) or this &lt;a href=&quot;http://tango.andrew.cmu.edu/~gustavor/42431-intro-bioimaging/readings/ch8.pdf&quot; rel=&quot;nofollow&quot;&gt;survey&lt;/a&gt; for some literature on image warping and registration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thin-plate spline or &quot;surface spline&quot; problem&lt;/strong&gt;&lt;br/&gt;&#xA;One reasonable approach would be establish point correspondences $r_1, \ldots, r_N$ and  $w_1, \ldots, w_N$ as you have done already then solve the following problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the 2D transformation model $\mathbf{p}=\{c_1,...,c_N,A,t\}$ s.t.&#xA;$$w_i=f(r_i)=Ar_i+t+\sum_{k=1}^{N}c_k\phi(d_i),$$&#xA;where $\phi(d_i)$ are radially symmetric basis functions (RBF). An example RBF choice is $\phi(d_i) = d_i^2\ln[d_i^2]$, where $d_i$ is a distance of your choice, e.g. Euclidean $d_i=\|r_i-r_k\|_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under certain thin-plate spline conditions not detailed here, this problem can be cast as a linear system $\mathbf{L}\mathbf{p}=\mathbf{w}$:&#xA;$$\begin{bmatrix}\mathbf{K} &amp;amp; \mathbf{P}\\\mathbf{P}^T &amp;amp; \mathbf{0}\end{bmatrix}\begin{bmatrix}\mathbf{c}_{N\times2}\\\mathbf{A}_{3\times2}\end{bmatrix}=\begin{bmatrix}\mathbf{r}_{N\times2}\\\mathbf{0}_{3\times2}\end{bmatrix},$$&#xA;where $\mathbf{K}_{ij\,\,[N\times N]}=\phi\left(\left\|(r_i^x,r_j^y)-(r_j^x,r_j^y)\right\|_2\right)$ and $\mathbf{P}_{N\times3}=\begin{bmatrix}\mathbf{1}_{N\times1}\left|\mathbf{w}_{N\times2}\right.\end{bmatrix}$, and then solve for $\mathbf{p}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then apply the transformation model $\mathbf{p}$ to every pixel in the original/control image, and use 2D interpolation to get the final result.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And to answer your second question, assuming you are using OpenCV's CvPoint structure, you can just do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::Point newPoint( oldPoint.x + xoffset, oldPoint.y + yoffset )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4682" LastActivityDate="2013-05-29T02:05:16.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9318" PostTypeId="2" ParentId="5926" CreationDate="2013-05-29T02:19:30.017" Score="2" Body="&lt;p&gt;FYI... STASM uses OpenCV's face detector (albeit very slightly modified for better image-boundary detections). If you really want a better face detector then I recommend hunting down detectors from the &lt;a href=&quot;http://vis-www.cs.umass.edu/fddb/results.html&quot; rel=&quot;nofollow&quot;&gt;FDDB dataset challenge&lt;/a&gt; (most probably proprietary) or create your own custom detector to fit your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you still plan on going the route of verification via eyes, then OpenCV has a cascade for that, see &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html&quot; rel=&quot;nofollow&quot;&gt;http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4682" LastActivityDate="2013-05-29T02:19:30.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9319" PostTypeId="1" CreationDate="2013-05-29T06:08:36.200" Score="3" ViewCount="322" Body="&lt;p&gt;I am reading &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.rowan.edu/~polikar/WAVELETS/WTpart3.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Wavelet Tutorial&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part III&#xA;MULTIRESOLUTION ANALYSIS&#xA;&amp;amp;&#xA;THE CONTINUOUS WAVELET TRANSFORM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by&#xA;Robi Polikar &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author explains about the following fig and says;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note that boxes have a certain non-zero area, which implies that the&#xA;  value of a particular point in the time-frequency plane cannot be&#xA;  known. All the points in the time-frequency plane that falls into a&#xA;  box is represented by one value of the WT.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am unable to interpret this fig and also that why value of a particular point in the time-frequency plane cannot be known.   I can always intersect two lines one passing through a particular value of t and another through f. The intersecting point will give me exact location of frequency at particular time (and V.V). I am not able to understand what thsi diagram is all about and what is its significance?   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Eegv5.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2014-04-18T16:39:56.043" Title="Trying to understand WAVELET TRANSFORM Frequncy-Time diagram" Tags="|wavelet|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9320" PostTypeId="1" CreationDate="2013-05-29T06:36:04.433" Score="12" ViewCount="1336" Body="&lt;p&gt;Our current project requires us to do some analysis using Wavelet Transform. Can anybody suggest me a &lt;strong&gt;practical&lt;/strong&gt; book, preferably with MATLAB or C examples. &#xA;I am currently reading some &lt;a href=&quot;http://users.rowan.edu/~polikar/WAVELETS/WTpart3.html&quot;&gt;tutorials&lt;/a&gt;, but it is not giving me a feeling as I have for Fourier transform. I need a book having many practical examples with source code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really appreciate for your suggestions.        &lt;/p&gt;&#xA;" OwnerUserId="1598" LastEditorUserId="35" LastEditDate="2013-05-29T06:46:56.873" LastActivityDate="2013-05-29T19:22:24.990" Title="How do I get started with Wavelets" Tags="|wavelet|reference-request|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9321" PostTypeId="2" ParentId="9320" CreationDate="2013-05-29T07:51:33.720" Score="6" Body="&lt;p&gt;I think &quot;Introduction to Wavelets and Wavelet Transforms: A Primer&quot; by Sidney Burrus (et al.) is a very good and practical book. It is very clear, has exercises, and contains some Matlab programs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I forgot to mention that &lt;a href=&quot;http://infoscience.epfl.ch/record/33904/files/VetterliH92.pdf&quot;&gt;this paper&lt;/a&gt; is also a very nice introduction to wavelets.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-05-29T13:26:45.317" LastActivityDate="2013-05-29T13:26:45.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9322" PostTypeId="1" CreationDate="2013-05-29T09:02:42.470" Score="5" ViewCount="3055" Body="&lt;p&gt;The problem I have can be seen in the context of DoA estimation or blind source signal separation and similar fields, where several source signals are observed by several antennas (or by an antenna array, respectively).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic model is something like&#xA;$$\mathbf{y}(t) = \sum_{i=1}^{n_s} s_i \mathbf{a}\left(\theta _i\right) + \mathbf{n}\left(t\right),$$&#xA;where $s_i$ describes the source signals, $\mathbf{a}\left(\theta _i\right)$ the mixing vector and $\mathbf{n}\left(t\right)$ the additive noise term. Note that neither of these terms should be considered known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, I have available the sample covariance matrix&#xA;$$\mathbf{\hat{C}} = E\{\mathbf{y}(t)\mathbf{y}^H(t)\} = \frac{1}{T} \sum_{t=1}^T\mathbf{y}(t)\mathbf{y}^H(t)$$&#xA;with dimensions $N \times N $, if $N$ is the number of antennas, $n_s$ the number of source signals and $T$ the number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what I want to do is the following:&#xA;I don't want to estimate all DoAs nor all source signals. I am looking for a method that is able to reduce the covariance matrix containing information about $n_s$ source signals to a covariance matrix containing just information about the &lt;em&gt;dominant&lt;/em&gt; source. Actually, it is not even so important that it is the dominant source, the main goal is the reduction to just one signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any method to achieve this kind of &lt;em&gt;cleaning&lt;/em&gt;, of &lt;em&gt;signal elimination&lt;/em&gt;, of &lt;em&gt;source reduction&lt;/em&gt;, of &lt;em&gt;clutter elimination&lt;/em&gt; or whatever you want to call it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I think I have not made clear a very important side fact: I am not particularly interested in the amplitudes or powers $\mathbf{s}$ themselves, but more in their geometry/directions $\mathbf{\theta}$. &lt;/p&gt;&#xA;" OwnerUserId="4689" LastEditorUserId="4689" LastEditDate="2013-05-31T09:18:58.973" LastActivityDate="2013-06-04T17:39:10.550" Title="Is there a way to reduce the covariance matrix of several source signals to the dominant source signal?" Tags="|signal-detection|estimation|ica|covariance|blind-deconvolution|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9323" PostTypeId="2" ParentId="8361" CreationDate="2013-05-29T10:42:29.473" Score="0" Body="&lt;p&gt;This is not a &quot;well-cited&quot; approach or state of the art for background subtraction in any case. However, your second sentence said that &lt;em&gt;you were experimenting with different approaches&lt;/em&gt;, so I think what I have to say will still have some value.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;General on the approach:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;What I'm proposing is a &lt;strong&gt;contrast-invariant image representation&lt;/strong&gt;, called the &lt;em&gt;Tree of Shapes&lt;/em&gt;, or &lt;em&gt;Level Line Tree&lt;/em&gt; (there were more names, unfortunately, they still did not settle on a commonly accepted name).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;general idea&lt;/strong&gt; in that proposed application is to build up a contrast-invariant-ish representations of a couple of images $I_x$ and $I_y$, and then look for differences. The advantage is that &lt;strong&gt;you can get&lt;/strong&gt;, as an output, &lt;strong&gt;parts present in $I_y$ but not in $I_x$&lt;/strong&gt; (or vice versa) &lt;em&gt;as opposed to most simple image comparisons&lt;/em&gt;, where the result is &lt;strong&gt;all the differences, i.e. everything present in one of the images and not the other&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Possible way to use with security cameras:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you application is security camera, then I guess you can get a few ground-truth images in good conditions (uniformish lighting, low occlusions). Then, you could build a &lt;em&gt;Tree of Shapes&lt;/em&gt; from your ground-truth image, and then use it to detect &lt;em&gt;new objects present in current images&lt;/em&gt;. The trees should be similar, because they are not based on global gray levels of pixels, but rather on &quot;local contrast&quot;: the main question driving the tree building process is &lt;strong&gt;is it brighter/darker than the surroundings&lt;/strong&gt;, and not &lt;strong&gt;how bright/dark is it&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Literature:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Relevant for your particular application would be the last couple of pages from this paper:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=841532&quot; rel=&quot;nofollow noreferrer&quot;&gt;P. Monasse, F. Guichard: Fast Computation of Contrast-Invariant Image Representation (2000)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(relevant paper with application example)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can find some relevant &lt;a href=&quot;https://dsp.stackexchange.com/a/5999/1273&quot;&gt;references in my answer here&lt;/a&gt;, but it seems to me now that the short overview I did for that answer is far from complete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors of that particular paper also published a booklet in LNM series about that particular tree:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://link.springer.com/book/10.1007/978-3-642-04611-7/page/1&quot; rel=&quot;nofollow noreferrer&quot;&gt;V. Caselles, P. Monasse: Geometric Description of Images as Topographic Maps (2010)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(booklet with extensive details)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And finally, those approaches were more theoretical than practical until just a few days ago, because the worst-case construction time was quadratic in the number of image pixels. Just yesterday, &lt;em&gt;a quasi-linear&lt;/em&gt; algorithm was presented which finally makes the Tree of Shapes usable in various applications:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://hal.archives-ouvertes.fr/hal-00798620/&quot; rel=&quot;nofollow noreferrer&quot;&gt;T. Géraud, E. Carlinet, S. Crozet, L. Najman: A Quasi-linear Algorithm to Compute the Tree of Shapes of nD Images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(fast implementation)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-05-29T10:42:29.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9324" PostTypeId="1" CreationDate="2013-05-29T11:40:45.103" Score="2" ViewCount="41" Body="&lt;p&gt;I have an image as attached &lt;img src=&quot;https://i.stack.imgur.com/hFGLy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blue to yellow to red points are the points of interest the algorithm found, while the pink points are the radius per point. This maps pretty fine, but the issue I am having is that I need to find the area covered by this, but there are usually small holes, or when the direction changes, theres a bigger hole. How can I find the areas covered?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My vector contains x,y position of a point, radius r of how big the vessel is, and the direction o, stating in which direction the vessel orients. But I have no good idea on how to find the area in there.&lt;/p&gt;&#xA;" OwnerUserId="1269" LastActivityDate="2013-05-29T11:40:45.103" Title="Finding areas covered by features" Tags="|image-processing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9325" PostTypeId="1" CreationDate="2013-05-29T14:04:41.650" Score="-4" ViewCount="148" Body="&lt;p&gt;Assume there are 11 signals. These signals are very similar to each other in both time and frequency domains. (And the similarity between them is not random; they are similar because they have somehow a common source. Actually they are well-correlated.) All these signals have the same number of samples. And I have access to them all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of these signals is important for me. (Let's name them S_main &amp;amp; S1~S10)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Now here's the question:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;How can I combine S1 ~ S10 in order to re-generate S_main theoretically !!?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;[Note: S_main itself is available !!! But I want to re-generate it using the combination of S1~S10 , in order to compare the physically-measured S_main to the theoretically-computed S_main.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="4659" LastActivityDate="2013-05-29T17:08:44.150" Title="How to combine similar signals to generate another one?" Tags="|approximation|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9326" PostTypeId="2" ParentId="9322" CreationDate="2013-05-29T16:06:46.303" Score="2" Body="&lt;p&gt;What you want to do is &lt;em&gt;dimension reduction&lt;/em&gt;. The most basic, yet very powerful and commonly used, technique to do it is principal component analysis (PCA). PCA operates on the covariance matrix. You can look it up on Wikipedia for a throughout tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PCA decomposes your data $y$, having dimension $d$, into $d$ principal components. The first principal component explains the most variance in your data, the next component the second most variance, and so on. Throw off the last $k$ principal components $-$ and ta-daa $-$ you reduce dimension. To answer your question, take $k = d - 1$ and then you get the most dominant component (in terms of explained variance).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Tip: MATLAB and similar software usually come with an easy-to-use function to perform PCA).&lt;/p&gt;&#xA;" OwnerUserId="4692" LastActivityDate="2013-05-29T16:06:46.303" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9327" PostTypeId="2" ParentId="9320" CreationDate="2013-05-29T16:09:37.030" Score="2" Body="&lt;p&gt;I would recommend the book &quot;Wavelet Methods for Time Series Analysis&quot; by Donald Percival and Andrew Walden. All concepts are clearly explained in text and with examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't have any source code but this can be found  elsewhere i.e. the Matlab wavelet toolbox or PyWavelets.&lt;/p&gt;&#xA;" OwnerUserId="4534" LastActivityDate="2013-05-29T16:09:37.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9328" PostTypeId="2" ParentId="9319" CreationDate="2013-05-29T16:31:44.783" Score="4" Body="&lt;p&gt;I believe by the WT, you are talking about the discrete wavelet transform, DWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be thought of as a subsampling of the continuous wavelet transform, CWT. In the case of the DWT, we pick frequencies of the form $2^{j-1}$ for ($j=1,2,\dots$) and then pick times seperated by multiples of $2^j$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see this in the diagram: As frequency increases, boxes double in height and half in width.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe what the author means by the statement&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Note that boxes have a certain non-zero area, which implies that the value of a particular&#xA;point in the time-frequency plane cannot be known.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is that the DWT, is an 'averaging' of the CWT within the boxes i.e. the boxes represent only one value and that is the average of the the values within it from the CWT. Hence as the boxes have non-zero area, it is impossible to know any of the exact values making up this average, so it is impossible to know the exact value of any point in the time-frequency plane.&lt;/p&gt;&#xA;" OwnerUserId="4534" LastEditorUserId="4534" LastEditDate="2014-04-18T16:39:56.043" LastActivityDate="2014-04-18T16:39:56.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9329" PostTypeId="2" ParentId="9325" CreationDate="2013-05-29T17:08:44.150" Score="0" Body="&lt;p&gt;If the difference between signals is mostly additive Gaussian noise, you could try averaging together the 10 measured signals to estimate the original.  If there is fat-tailed shot noise, you could try applying a median filter on your 10 measured signals.  If these assumptions are incorrect, then the results may be garbage.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-05-29T17:08:44.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9330" PostTypeId="2" ParentId="9191" CreationDate="2013-05-29T18:19:50.770" Score="1" Body="&lt;p&gt;@JasonR and @MAttL. I think this problem has no solution. I tried using least squares to find a linear of operator with size $(N/2+1) \times (N/2+1)$ that minimizes the error between the positive frequencies from the set of known vectors $Y$ and the set of vectors $X$ to be linearly transformed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code to estimate the $(N/2+1) \times (N/2+1)$ is the following. Note that the norm of the error is significant.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;clc&#xA;&#xA;SET_LENGTH = 1e4;&#xA;&#xA;x =  fft(rand(8,SET_LENGTH));&#xA;N = 8;&#xA;&#xA;% Linear Operator&#xA;A = rand(N,N); %must be real-valued&#xA;w = exp(-1j*2*pi/N); % twiddle factor&#xA;W = w.^(repmat(0:N-1,N,1).*repmat(0:N-1,N,1).'); % DFT matrix&#xA;T = W*A*W';&#xA;&#xA;% Hermitian symmetric symbols&#xA;y = T*x;&#xA;&#xA;% Positive frequencies&#xA;xp = x(1:(N/2 + 1),:);&#xA;yp = y(1:(N/2 + 1),:);&#xA;&#xA;% Estimate linear operator with reduced dimensions&#xA;T_est = (yp*xp')/(xp*xp')&#xA;&#xA;% Compare results&#xA;norm(T_est*xp(:,2)-yp(:,2)) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To verify the math is right, I also estimate the $N \times N$ linear operator, which I know beforehand exists. The result is that the norm of the error is null.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SET_LENGTH = 1e4;&#xA;&#xA;x =  fft(rand(8,SET_LENGTH));&#xA;N = 8;&#xA;&#xA;% Linear Operator&#xA;A = rand(N,N); %must be real-valued&#xA;w = exp(-1j*2*pi/N); % twiddle factor&#xA;W = w.^(repmat(0:N-1,N,1).*repmat(0:N-1,N,1).'); % DFT matrix&#xA;T = W*A*W';&#xA;&#xA;% Hermitian symmetric symbols&#xA;y = T*x;&#xA;&#xA;% Estimate linear operator with reduced dimensions&#xA;T_est = (y*x')/(x*x')&#xA;&#xA;% Compare results&#xA;norm(T_est*x(:,2)-y(:,2)) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Anybody with more knowledge could state whether I can conclude or not that the problem has no solution?&lt;/p&gt;&#xA;" OwnerUserId="4590" LastActivityDate="2013-05-29T18:19:50.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9331" PostTypeId="1" AcceptedAnswerId="9333" CreationDate="2013-05-29T18:54:38.867" Score="2" ViewCount="140" Body="&lt;p&gt;From the IIR filter flow graph below i don't understand how the transfer function is calculated in every node:&lt;/p&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2014-04-22T22:42:21.870" LastActivityDate="2014-04-22T22:42:21.870" Title="Transfer Function from input to node" Tags="|filters|transfer-function|" AnswerCount="1" CommentCount="2" ClosedDate="2014-05-08T01:25:57.720" ContentLicense="CC BY-SA 3.0" />
  <row Id="9332" PostTypeId="2" ParentId="9320" CreationDate="2013-05-29T19:22:24.990" Score="8" Body="&lt;p&gt;If you're familiar with Fourier transforms, I think the bridge between the Fourier worlds and the wavelet worlds is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gabor_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gabor transform&lt;/a&gt; (a Gaussian-windowed STFT) and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Morlet_wavelet&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex Morlet wavelet transform&lt;/a&gt;.  This is historically how they developed, too.  They are basically the same thing, breaking down a signal into &quot;blips&quot; of complex sinusoids:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a5nu2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the time-frequency space occupied by the blips are spaced differently:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i7V58.png&quot; alt=&quot;Grids showing how the coefficients of the FFT and WT correspond to the time-frequency plane&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wavelet version has more frequency resolution at low frequencies and more time resolution at high frequencies, which is usually a good tradeoff (similar to the way the human ear works).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Morlet is a continuous wavelet, though, so there is overlap/redundancy in the representation, a discrete version is not a minimal representation of the signal, and does not meet the &quot;admissibility condition&quot;, which apparently means it cannot be inverted perfectly back into a signal(?), and &lt;a href=&quot;https://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Parseval's theorem&lt;/a&gt; can't be used on it.  Modifying the wavelet so these things are possible results in other types of wavelets, and you can eventually work back to things like the Haar wavelet (I think).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see &lt;a href=&quot;https://dsp.stackexchange.com/q/6266/29&quot;&gt;What&amp;#39;s the difference between the Gabor-Morlet wavelet transform and the constant-Q transform?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-05-29T19:22:24.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9333" PostTypeId="2" ParentId="9331" CreationDate="2013-05-29T20:41:56.893" Score="2" Body="&lt;p&gt;There are different ways to do this. Here is an example of the straight forward way. First write down the difference equations and corresponding z-transforms&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_n^1 = bc_2x_n -a_2y_n \Leftrightarrow  P^1(z) = bc_2X(z) - a_2Y(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_n = bx_n + p^3_{n-1} \Leftrightarrow Y(z) = bX(z) + z^{-1}P^3(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p^3_n = p^1_{n-1} + p^2_n \Leftrightarrow P^3(z) = z^{-1}P^1(z) + P^2(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p^2_n = bc_1x_n - a_1y_n \Leftrightarrow P^2(z) = bc_1X(z) - a_1Y(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then obtain an expression for $Y(z)$ that only depends on $X(z)$ and $P^1(z)$&#xA;$Y(z) = bX(z) + z^{-1}[z^{-1}P^1(z) + P^2(z)] $&#xA;$Y(z) = bX(z) + z^{-1}[z^{-1}P^1(z) + bc_1X(z) - a_1Y(z)] $&#xA;$Y(z) = bX(z) + z^{-2}P^1(z) + bc_1z^{-1}X(z) - a_1z^{-1}Y(z) $&#xA;$Y(z)[1 + a_1z^{-1}] = [b+bc_1z^{-1}]X(z) + z^{-2}P^1(z) $&#xA;$Y(z) = \frac{b+bc_1z^{-1}}{1 + a_1z^{-1}}X(z) + \frac{z^{-2}}{1 + a_1z^{-1}}P^1(z) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then eliminating $Y(z)$ in the expression for $P^1(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P^1(z) = bc_2X(z) - a_2Y(z)$&#xA;$P^1(z) = bc_2X(z) - a_2[\frac{b+bc_1z^{-1}}{1 + a_1z^{-1}}X(z) + \frac{z^{-2}}{1 + a_1z^{-1}}P^1(z) ]$&#xA;$P^1(z)[1+\frac{a_2z^{-2}}{1 + a_1z^{-1}}] = [bc_2 - \frac{a_2(b+bc_1z^{-1})}{1 + a_1z^{-1}}]X(z)$&#xA;$P^1(z)[\frac{1 + a_1z^{-1}+a_2z^{-2}}{1 + a_1z^{-1}}] = \frac{bc_2(1 + a_1z^{-1}) -a_2(b+bc_1z^{-1})}{1 + a_1z^{-1}}]X(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{P^1(z)}{X(z)} = \frac{bc_2(1 + a_1z^{-1}) -a_2(b+bc_1z^{-1})}{1 + a_1z^{-1}+a_2z^{-2}}$&#xA;$\frac{P^1(z)}{X(z)} = \frac{bc_2 + bc_2a_1z^{-1} -a_2b-a_2bc_1z^{-1}}{1 + a_1z^{-1}+a_2z^{-2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{P^1(z)}{X(z)} = b\frac{c_2 -a_2 + (c_2a_1-a_2c_1)z^{-1}}{1 + a_1z^{-1}+a_2z^{-2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your expression for the transfer function to node 1 is missing the input gain $b$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, another way to derive expressions for transfer functions is to use something called Mason's rule. See here &lt;a href=&quot;http://en.wikipedia.org/wiki/Mason%27s_gain_formula&quot; rel=&quot;nofollow&quot;&gt;wikimason&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-05-29T20:41:56.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9334" PostTypeId="1" CreationDate="2013-05-30T02:05:01.593" Score="0" ViewCount="220" Body="&lt;p&gt;I doubt because you have 9 multiplications and you are adding 9 numbers together, when using a 3x3 convolution matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding 9 numbers: 1+2+3+4+5+6+7+8+9&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are performing 8 additions  as we repeat the operation of 'adding' 8 times (8 times a '+' sign).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can say there are 9 additions as well, if you would accept a definition like: 0+1+2+3+4+5+6+7+8+9&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what does make more sense for computers: 8 adds or 9 adds?&lt;/p&gt;&#xA;" OwnerUserId="4478" LastEditorUserId="4478" LastEditDate="2013-05-30T02:26:41.153" LastActivityDate="2013-06-29T04:41:34.133" Title="A 3x3 image kernel takes 9 multiplications and 8 or 9 additions for each pixel?" Tags="|math|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9335" PostTypeId="2" ParentId="9314" CreationDate="2013-05-30T02:38:29.773" Score="0" Body="&lt;p&gt;If the only change or the main change is just the location of the square, and the background is almost the same you can subtract the two images and then use some threshold to be able to detect the two squares. then compare the $(x,y)$ value for a specific corner of the two squares. If it is $(x1,y1)$ for one and $(x2,y2)$ for the other then the distance is $$\sqrt{((x1-x2)^2 + (y1-y2)^2)}$$.&lt;/p&gt;&#xA;" OwnerUserId="1636" LastEditorUserId="1636" LastEditDate="2013-05-30T03:24:28.560" LastActivityDate="2013-05-30T03:24:28.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9336" PostTypeId="1" AcceptedAnswerId="9342" CreationDate="2013-05-30T02:39:50.640" Score="5" ViewCount="405" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform#Uncertainty_principle&quot; rel=&quot;nofollow&quot;&gt;uncertainty principle&lt;/a&gt; is usually stated as a relationship between a continuous signal and that signal's Fourier transform, and says that&#xA;$$&#xA;\int_{-\infty}^{\infty} \! x^2 f(x) \ \mathrm{dx} \int_{-\infty}^{\infty} \! \xi^2 \hat{f}(\xi) \ \mathrm{d\xi} \ge \frac{1}{16\pi^2}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently it is somewhat difficult to define an equivalent relationship for discrete time signals, but, for &quot;reasonable&quot; bandlimited signals with &quot;reasonable&quot; transforms, it is basically correct to say that the above holds true of the continuous signal reconstructed from the samples.  For a good overview I found the following non-paywalled paper useful:&#xA;&lt;a href=&quot;http://www.hindawi.com/journals/ijmms/2006/048185/abs/&quot; rel=&quot;nofollow&quot;&gt;Venkatesh, Kumar Raja, Vidyasagar: On the uncertainty inequality as applied to discrete signals&lt;/a&gt;, Int'l J. Math. and Math. Sci., 2006:48185, 2006. doi:10.1155/IJMMS/2006/48185.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I also understand what this says about FIR filters: I can treat my kernel as a signal, apply the uncertainty principle and see that if I want a very narrowband filter, I'm going to have to have a lot of taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is &lt;em&gt;what does the uncertainty principle say about an IIR filter?&lt;/em&gt;  If I have a very narrow band IIR filter it would seem that the uncertainty principle would say that I would have to trade something off.  What?  I can't figure out what the appropriate signal is that I should take the variance of.  Is it continuous reconstruction of the impulse response of my filter?  (I.e., so I should expect a very narrow-band IIR filter to have an extremely long startup transient?)&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2017-01-04T10:21:34.487" Title="What does the uncertainty principle say about recursive filters?" Tags="|discrete-signals|fourier-transform|filter-design|infinite-impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9337" PostTypeId="1" CreationDate="2013-05-30T03:42:15.400" Score="0" ViewCount="618" Body="&lt;p&gt;I want to achieve something like this &lt;a href=&quot;https://soundcloud.com/user7421656/sonicworx-isolate-preview&quot; rel=&quot;nofollow&quot;&gt;https://soundcloud.com/user7421656/sonicworx-isolate-preview&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've researched it and a few papers mention the use of &quot;descriptors&quot; on the audio and use thresholds on the descriptors to determine singing sources. But before I dive in and go hard out on how these people achieved it, I wanted to make sure it's the best way to achieve an effect similar to the above link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's an effective method to achieving singing source separation?&lt;/p&gt;&#xA;" OwnerUserId="4340" LastActivityDate="2016-05-26T09:20:14.380" Title="What's the best method to extract vocals from music?" Tags="|signal-analysis|sound|music|singing|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9338" PostTypeId="2" ParentId="9334" CreationDate="2013-05-30T03:43:57.313" Score="1" Body="&lt;p&gt;As you have 9 terms to add together, your computer will perform 8 additions as each addition needs two inputs. So you have 9 multiplications and 8 additions.&lt;/p&gt;&#xA;" OwnerUserId="1636" LastActivityDate="2013-05-30T03:43:57.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9339" PostTypeId="1" CreationDate="2013-05-30T08:40:05.487" Score="3" ViewCount="807" Body="&lt;p&gt;For the preliminary part of a lab I had to do, I was asked the following question:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nxug8.png&quot; alt=&quot;Question&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get how to do 1.1, but with 1.2, I really don't get what's going on; I really would've thought that the resolution bandwidth would be equal to the bandwidth of the low-pass filter.  Furthermore, I'm pretty sure a spectrum analyser has a variable band-pass filter in it, so I really don't get what's going on here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be much appreciated.  For the record, this isn't part of an assignment or anything like that, it's not worth anything, it's just something that's bugging me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="1146" LastActivityDate="2015-04-17T18:20:41.123" Title="Spectrum analyser and resolution bandwidth" Tags="|frequency-spectrum|lowpass-filter|bandwidth|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9340" PostTypeId="1" CreationDate="2013-05-30T10:59:16.257" Score="1" ViewCount="589" Body="&lt;p&gt;I have some (well lots) of data signals which are measurements of current pulses. The current pulses are the result of spark breakdowns (20 kV + 700 pF capacitor so quite energetic) and my problem is that noise, and displacement current signals are clouding the underlying current pulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The noise and the displacement current signals are quite high frequency. The actual pulse, is much lower so I am wanting a low pass filter. I use Origin Labs and in there I can apply a low pass FFT filter and I find that for the most part, a cut off of about 7 MHz does the trick for some of the more well defined pulses, sometimes I have to use something higher like 15 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a lot of measurements and would like to speed this process up by getting Matlab to do it for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data files should all be the same length and all the same resolution (A cursory looks says each file has 9900 points, with a time step of 4e-10 seconds, so about 4 uS of data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just don't have a clue where to start with this in Matlab. I don't need anything fancy, I merely want to pull out an approximate value of the current. I have tried something simple like performing the FFT and then making all values above a certain frequency = 0 then doing the inverse FFT but that appears to do nothing at all!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't post a picture of the signal, apparently I need some reputation on here or something first. But I may be able to host it on my Flickr page if needs be.&lt;/p&gt;&#xA;" OwnerUserId="4696" LastActivityDate="2013-05-30T10:59:16.257" Title="Building a Low-Pass FFT filter for a noisy current pulse signal" Tags="|matlab|lowpass-filter|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9341" PostTypeId="1" AcceptedAnswerId="9344" CreationDate="2013-05-30T10:59:46.217" Score="1" ViewCount="4560" Body="&lt;p&gt;I have designed 9 IIR bandpass filters (chebyshev type 1, order 4) using fdatool in Matlab. Then I use a and b filter coefficients to apply it on differential equation. So, my question is how to apply (real-time) gain of each bandpass filter using sliders? ( how to add gain or loss to certain filter?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code in C#:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public void initializeFilters(){&#xA;    filters.Clear();&#xA;    //9 Band pass filters&#xA;    for (int i = 0; i &amp;lt; 9; i++)&#xA;        filters.Add(new Filter());&#xA;&#xA;    //F1=40hz Fc=50Hz F2=60Hz&#xA;    float k = (float)Math.Pow(1.0, -5);&#xA;    filters[0].B = new float[] { k * 0.1992f, 0, k * -0.3983f, 0, k * 0.1992f }; &#xA;    filters[0].A = new float[] { 1.0000f, -3.9968f, 5.9904f, -3.9905f, 0.9969f };&#xA;&#xA;    //60Hz 80Hz 100Hz&#xA;    k = (float)Math.Pow(1.0, -4);&#xA;    filters[1].B = new float[] { k * 0.0795f, 0, k * -0.1591f, 0, k * 0.0795f };&#xA;    filters[1].A = new float[] { 1.0000f, -3.9935f, 5.9807f, -3.9810f, 0.9938f };&#xA;&#xA;    //100Hz 130Hz 160Hz&#xA;    filters[2].B = new float[] { k * 0.1787f, 0, k * -0.3574f, 0, k * 0.1787f };&#xA;    filters[2].A = new float[] { 1.0000f, -3.9899f, 5.9705f, -3.9713f, 0.9907f };&#xA;&#xA;    //160Hz 350Hz 600Hz&#xA;    filters[3].B = new float[] { 0.0009f, 0, -0.0019f, 0, 0.0009f };&#xA;    filters[3].A = new float[] { 1.0000f, -3.9255f, 5.7847f, -3.7927f, 0.9335f };&#xA;&#xA;    //600Hz 1300Hz 2000Hz&#xA;    filters[4].B = new float[] { 0.0088f, 0, -0.0176f, 0, 0.0088f };&#xA;    filters[4].A = new float[] { 1.0000f, -3.7187f, 5.2467f, -3.3315f, 0.8040f };&#xA;&#xA;    //2000Hz 4000Hz 6000Hz&#xA;    filters[5].B = new float[] { 0.0595f, 0, -0.1191f, 0, 0.0595f };&#xA;    filters[5].A = new float[] { 1.0000f, -2.8765f, 3.4528f, -2.0797f, 0.5459f };&#xA;&#xA;    //6000Hz 8000Hz 10000Hz&#xA;    filters[6].B = new float[] { 0.0595f, 0, -0.1191f, 0, 0.0595f };&#xA;    filters[6].A = new float[] { 1.0000f, -1.4273f, 1.8140f, -1.0319f, 0.5459f };&#xA;&#xA;    //10000Hz 12000Hz 14000Hz&#xA;    filters[7].B = new float[] { 0.0595f, 0, -0.1191f, 0, 0.0595f };&#xA;    filters[7].A = new float[] { 1.0000f, 0.4731f, 1.3375f, 0.3420f, 0.5459f };&#xA;&#xA;    //14000Hz 16000Hz 18000Hz&#xA;    filters[8].B = new float[] { 0.0595f, 0, -0.1191f, 0, 0.0595f };&#xA;    filters[8].A = new float[] { 1.0000f, 2.2239f, 2.5782f, 1.6078f, 0.5459f };&#xA;    }&#xA;    public override int Read(byte[] buffer, int offset, int count)&#xA;    {&#xA;    int read = sourceStream.Read(buffer, offset, count);&#xA;    float[] f_read = new float[read / 4], y = new float[read / 4];&#xA;    Buffer.BlockCopy(buffer, offset, f_read, 0, count);&#xA;&#xA;    for (int n = 0; n &amp;lt; read / 4; n++)&#xA;        y[n] = 0;&#xA;&#xA;    for (int i = 0; i &amp;lt; filters.Count; i++)&#xA;    {&#xA;        for (int n = 0; n &amp;lt; read / 4; n++)&#xA;        {&#xA;            for (int k = 0; k &amp;lt; filters[i].B.Length; k++)&#xA;            {&#xA;                if (n - k &amp;gt;= 0)&#xA;                    y[n] = y[n] + filters[i].B[k] * f_read[n - k];&#xA;            }&#xA;            for (int k = 1; k &amp;lt; filters[i].A.Length; k++)&#xA;            {&#xA;                if (n - k &amp;gt;= 0)&#xA;                    y[n] = y[n] - filters[i].A[k] * y[n - k];&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    for (int n = 0; n &amp;lt; read / 4; n++)&#xA;        y[n]= Math.Min(1, Math.Max(-1, y[n]));&#xA;&#xA;    Buffer.BlockCopy(y, 0, buffer, offset, read / 4);&#xA;    return read;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is GUI of the sliders: (0% - certain filter does not effect the signal, 100% - fully effect the signal) &lt;a href=&quot;http://shrani.si/f/v/WI/1G7iNUFX/eq.png&quot; rel=&quot;nofollow&quot;&gt;gui sliders&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 1&lt;/strong&gt;&#xA;I have redesigned my bandpass filters, using IIR chebyshev type I, order 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Fc Flow Fhigh [in Hz]&#xA;50 35 71  b = [0.0050,0,-0.0050] a= [1.0000,-1.9899,0.9900]&#xA;80 57 113 b=[0.0078,0,-0.0078] a=[1.0000,-1.9843,0.9844]&#xA;130 92 184 b=[0.0127,0,-0.0127] a=[1.0000,-1.9742,0.9746]&#xA;350 247 495 b=[0.0336,0,-0.0336] a=[1.0000,-1.9305,0.9329]&#xA;1300 919 1838 b=[0.1141,0,-0.1141] a=[1.0000,-1.7414,0.7717]&#xA;4000 2828 5657 b=[0.2865,0,-0.2865] a=[1.0000,-1.1984,0.4270]&#xA;8000 5657 11314 b=[0.4559,0,-0.4559] a=[1.0000,-0.4188,0.0882]&#xA;12000 8485 16971 b=[ 0.5758,0,-0.5758] a=[1.0000,0.2477,-0.1517]&#xA;16000 11314 22040 b=[0.6532,0,-0.6532] a=[1.0000,0.6927,-0.3063]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and here is my new code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        private void initializeFilters()&#xA;    {&#xA;        filters = new List&amp;lt;Filter&amp;gt;();&#xA;        filters.Add(new Filter(new float[] { 0.0050f, 0f, -0.0050f }, new float[] { 1.0000f, -1.9899f, 0.9900f }));&#xA;        filters.Add(new Filter(new float[] { 0.0078f, 0f, -0.0078f }, new float[] { 1.0000f, -1.9843f, 0.9844f }));&#xA;        filters.Add(new Filter(new float[] { 0.0127f, 0f, -0.0127f }, new float[] { 1.0000f, -1.9742f, 0.9746f }));&#xA;        filters.Add(new Filter(new float[] { 0.0336f, 0f, -0.0336f }, new float[] { 1.0000f, -1.9305f, 0.9329f }));&#xA;        filters.Add(new Filter(new float[] { 0.1141f, 0f, -0.1141f }, new float[] { 1.0000f, -1.7414f, 0.7717f }));&#xA;        filters.Add(new Filter(new float[] { 0.2865f, 0f, -0.2865f }, new float[] { 1.0000f, -1.1984f, 0.4270f }));&#xA;        filters.Add(new Filter(new float[] { 0.4559f, 0f, -0.4559f }, new float[] { 1.0000f, -0.4188f, 0.0882f }));&#xA;        filters.Add(new Filter(new float[] { 0.5758f, 0f, -0.5758f }, new float[] { 1.0000f, 0.2477f, -0.1517f }));&#xA;        filters.Add(new Filter(new float[] { 0.6532f, 0f, -0.6532f }, new float[] { 1.0000f, 0.6927f, -0.3063f }));&#xA;    }&#xA;    public void process(float[] x, ref float[] y, float value, int i)&#xA;    {&#xA;        float f = ((100 * value) / 20)/100; //mapping values to 0.0 - 1.0&#xA;        float[] tmp = new float[y.Length];&#xA;        for (int n = 0; n &amp;lt; x.Length; n++)&#xA;        {&#xA;            for (int k = 0; k &amp;lt; filters[i].B.Length; k++)&#xA;            {&#xA;                if (n - k &amp;gt;= 0)&#xA;                {&#xA;                    tmp[n] += filters[i].B[k] * x[n - k];&#xA;                    y[n] += f * tmp[n];&#xA;                }&#xA;            }&#xA;            for (int k = 1; k &amp;lt; filters[i].A.Length; k++)&#xA;            {&#xA;                if (n - k &amp;gt;= 0)&#xA;                {&#xA;                    tmp[n] -= filters[i].A[k] * tmp[n - k];&#xA;                    y[n] -= f * tmp[n];&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;    public override int Read(byte[] buffer, int offset, int count)&#xA;    {&#xA;        int read = sourceStream.Read(buffer, offset, count);&#xA;        float[] f_read = new float[read / 4], y = new float[read / 4];&#xA;        Buffer.BlockCopy(buffer, offset, f_read, 0, count);&#xA;&#xA;        int st = 1;&#xA;        for (int i = 0; i &amp;lt; Form1.trackBarValue.Length; i++)&#xA;        {&#xA;            if (Form1.trackBarValue[i] &amp;gt; 0)&#xA;            {&#xA;                process(f_read, ref y, Form1.trackBarValue[i], i);&#xA;                st++;&#xA;            }&#xA;        }&#xA;        if (st == 1)&#xA;           process(f_read, ref y, 20, 0); //20 is just a maximum slider value&#xA;&#xA;        for (int n = 0; n &amp;lt; read / 4; n++)&#xA;            y[n] = Math.Min(1, Math.Max(-1, y[n] / st));&#xA;&#xA;        Buffer.BlockCopy(y, 0, buffer, offset, read);&#xA;        return read;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm hearing a little noise in signal(a little bangs), can anybody tell me what am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="4695" LastEditorUserId="1081" LastEditDate="2013-12-06T14:50:28.150" LastActivityDate="2013-12-06T14:50:28.150" Title="NAudio real-time equalizer" Tags="|matlab|discrete-signals|equalizer|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9342" PostTypeId="2" ParentId="9336" CreationDate="2013-05-30T11:05:54.837" Score="3" Body="&lt;p&gt;The uncertainty principle basically says the same thing for IIR filters: &quot;the steeper the filter, the longer the Impulse Response&quot;. The only difference between FIR and IIR is that you have to use a somewhat different definition of &quot;filter length&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While all IIR filters are technically infinite, they have very different decay rates. You can define a quantity that basically describes &quot;energy decay over time&quot;. For most IIR filters this is an exponential decay (often dominated by the pole-pair closest to the unit circle) and the decay rate is directly related to the filter bandwidth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An interesting quantitative approach to determining decay rates can be found in the area of reverb time calculation, using &quot;time reversed impulse response integration&quot;. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-05-30T11:05:54.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9343" PostTypeId="1" CreationDate="2013-05-30T13:24:49.120" Score="2" ViewCount="6745" Body="&lt;p&gt;I want some data (images that have only shift) to test on &lt;a href=&quot;http://www.xuvtools.org/download&quot; rel=&quot;nofollow&quot;&gt;xuvtools&lt;/a&gt;  or &lt;a href=&quot;http://research.microsoft.com/en-us/um/redmond/groups/ivm/ice/&quot; rel=&quot;nofollow&quot;&gt;Microsoft ICE&lt;/a&gt; and my own software.&#xA;Is there any available?&lt;/p&gt;&#xA;" OwnerUserId="1781" LastActivityDate="2013-05-31T22:45:10.183" Title="data for panorama stitching testing" Tags="|stitching|panorama|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9344" PostTypeId="2" ParentId="9341" CreationDate="2013-05-30T13:27:34.460" Score="4" Body="&lt;p&gt;Bunch of things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your band definition is really odd. Some of the lower bands are really small while some of the mid bands are huge. Ideally you want octaves where the band edges are 1/sqrt(2) and sqrt(2) around the center frequency&lt;/li&gt;&#xA;&lt;li&gt;You have designed bandpass filters in parallel. These are not &quot;reconstructive&quot; so you don't end up with a flat frequency response if you add the outputs of the band passes together. &lt;/li&gt;&#xA;&lt;li&gt;You need a &quot;parametric&quot; or &quot;peaking EQ&quot; filters in cascade. These filters are defined by center frequency, gain (or cut) and Q. Q controls the bandwidth and Q=2 should give you something similar to ocatve bandwidth. See &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow&quot;&gt;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&lt;/a&gt; .&lt;/li&gt;&#xA;&lt;li&gt;You will have to update the filter coefficients every time the slider is moved. This may results in pops and clicks and there are various ways to deal with this. Post another questions if this is a problem&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;RE: EDIT 1&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You are still using parallel bandpasses, so you will never get a perfectly falt frequency response if the all the band gains are &quot;neutral&quot;&lt;/li&gt;&#xA;&lt;li&gt;The slider feels off. Typical graphical equalizers would do -15dB .. +15dB in logarithmic steps. Your slider is linear and it only provides cut&lt;/li&gt;&#xA;&lt;li&gt;You have a &quot;hard clip&quot; to prevent overflow. That will sound pretty bad if overflow actually happens. There are better ways of dealing with that.&lt;/li&gt;&#xA;&lt;li&gt;I think the main problem is your state management (or lack thereof). There is a conditional: $if (n - k &amp;gt;= 0)$. That's wrong, you always need to do the summation over the whole loop. In order to do this, you need to keep the last two input and output samples of the previous data block around. So x[n-1] for block K becomes x[-1] for block K+1. You need to keep track of x[-1], x[-2], y[-1] and y[-2]. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-06-18T12:07:56.117" LastActivityDate="2013-06-18T12:07:56.117" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9345" PostTypeId="2" ParentId="9306" CreationDate="2013-05-30T14:53:23.560" Score="1" Body="&lt;p&gt;okay - I think the technique I was looking for is formulation of a synthetic aperture as in Synthetic Aperture Radar (SAR). The 'trick', in the general case, where static target and radar platforms are involved, would probably be that all the array elements will be physically present as opposed to conventional SAR where platform motion is used to synthesize a really large aperture. Using RF switching to simulate the platform motion, one can capture SAR data sequentially and apply well-known SAR techniques to achieve desired performance i.e. fine angular resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'catch' in this case will be the extra time required for SAR data acquisition compared to a full-blown digital beamformer. Another one is that this technique can possible be valid for beamforming-on-receive-only scenarios. &lt;/p&gt;&#xA;" OwnerUserId="4673" LastActivityDate="2013-05-30T14:53:23.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9347" PostTypeId="1" CreationDate="2013-05-30T16:15:27.763" Score="4" ViewCount="945" Body="&lt;p&gt;I'm new to wave problems, so excuse my simplified words.&#xA;I have a signal consists of high range of frequencies . I applied a Band-pass filter to this signal and I have been able to separate it to bands of specific frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem that I want to solve is as follows:&#xA;Each band have a lot of individual waves of VERY, VERY close wavelengths. For instance 4.08 Hz and 4.09 Hz. even we may have 4.001 Hz and 4.002 Hz as well. The signal data is limited and I can't push the filter to any better resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question now, How I can separate the individual waves in each band? And if possible please refer me to any books which deal with such problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;" OwnerDisplayName="David Raul" LastEditorUserId="26573" LastEditDate="2018-09-04T20:48:15.380" LastActivityDate="2018-09-04T20:48:15.380" Title="Separating waves of very close wavelengths" Tags="|frequency|source-separation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9348" PostTypeId="2" ParentId="9341" CreationDate="2013-05-30T17:46:04.377" Score="1" Body="&lt;p&gt;Running 9 fifth order IIR filters in cascade can potentially have noise problems. But if you can do with floating point then maybe it is not a problem.&#xA;Then there is the potential issue of MIPS, it is not cheap to run 9 fifth order IIR filters pr channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parallel structure provides a feasible alternative to the above two problems. This paper &quot;Low-Delay Signal Processing for Digital Hearing Aids&quot; gives the explanation of designing the filters. In this parallel structure the gains sits directly on the outputs of the biquads. &lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-05-30T17:46:04.377" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9349" PostTypeId="1" CreationDate="2013-05-30T18:20:36.090" Score="6" ViewCount="5117" Body="&lt;p&gt;I have a Virtex 6 FPGA running at 200MHz with ADC/DACs on it.  I have been converting a WiFi signal (2462MHz) down to a more reasonable IF of 25MHz, sampling, running the signal through taps, tweaking them, and mixing back up.  This all works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is that since I am mixing down and sampling at a lower rate, I cannot implement RF level multipath by adjusting the delay in the taps for phase changes, instead I had to adjust it at the IF level instead.  This works OK, but it means that timing is off (things like TDOA or stuff with TOF measurements could care about that).  It seems like the best way around this (and probably the right way) is to implement a fractional delay filter (FDF), but I am not sure the best way to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like I need to come up with the coefficients for the taps, but I cannot seem to glean that out of the whitepapers I've read on FDF.  Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2013-05-31T11:14:58.283" Title="How to pick coefficients for Fractional Delay Filters?" Tags="|filters|sampling|dsp-core|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9350" PostTypeId="1" CreationDate="2013-05-30T18:28:44.600" Score="0" ViewCount="177" Body="&lt;p&gt;I wish to use trainCascadeObjectDetector to train on new objects (other than faces); I have the Computer Vision Toolkit installed; but this function trainCascadeObjectDetector seems to be missing from my system. Did I miss something during installation? Or has this been removed from R2012b?&lt;/p&gt;&#xA;" OwnerUserId="4699" LastEditorUserId="53" LastEditDate="2014-12-23T15:18:32.547" LastActivityDate="2014-12-23T15:18:32.547" Title="trainCascadeObjectDetector seems to be missing from MATLAB R2012b" Tags="|image-processing|computer-vision|matlab-cvst|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9351" PostTypeId="2" ParentId="9350" CreationDate="2013-05-30T19:28:38.193" Score="2" Body="&lt;p&gt;Looking at the &lt;a href=&quot;http://www.mathworks.com/help/vision/release-notes.html&quot; rel=&quot;nofollow&quot;&gt;release notes for the computer vision toolbox&lt;/a&gt;, it looks like that functionality was not added until the R2013a release.&lt;/p&gt;&#xA;" OwnerUserId="4344" LastActivityDate="2013-05-30T19:28:38.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9352" PostTypeId="2" ParentId="9349" CreationDate="2013-05-30T20:13:44.430" Score="10" Body="&lt;p&gt;I usually do this by creating a low pass filter that entirely passes through the signal that I want to delay.  I create the LPF &quot;manually&quot; by creating a windowed sinc function.  Something along the lines of-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filt = sinc(-80:.8:80);&#xA;filt = filt .* hamming(length(filt)).';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gets you a filter that passes about 80% of the nyquist region (the 80% is set by the .8 increment in the sinc indexing).  To get a fractional delay you simply include the fractional delay in the calculation of your filter.  Adding a constant to the sinc indexing delays the filter by $\frac{constant}{increment}$ samples.  For instance, in the case of the filter above, adding 0.1 would create a fractional delay of $\frac{0.1}{0.8}$ samples, or $0.125$ samples.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filt = sinc((-80:.8:80) + .1);&#xA;filt = filt .* hamming(length(filt)).';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works because filtering is a linear operation and delaying the filter is equivalent to convolving your original LPF with a fractionally delayed delta function.  Since linearity implies that the associative property holds, convolving your signal with the delayed LPF is equivalent to convolving your signal with a fractionally delayed delta function and then filtering it with the &quot;undelayed&quot; LPF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: When creating the &quot;undelayed&quot; LPF you must make sure that the indices are symmetric.  The easiest way to do that is to make sure the start and end points are integer multiples of your indexing increment.  That is why I used +/- 80 for an increment of 0.8.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-05-31T02:00:51.350" LastActivityDate="2013-05-31T02:00:51.350" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9353" PostTypeId="1" AcceptedAnswerId="9364" CreationDate="2013-05-30T20:25:44.297" Score="1" ViewCount="1293" Body="&lt;p&gt;I have to design an 8th-order IIR filter with the following transfer function magnitude response as a specification:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NEN3w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use &quot;ellip&quot; function from matlab to calculate the unquantised coefficient set:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/garoI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then i implement the filter using a cascade of second-order sections using &quot;tf2sos&quot; matlab function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hzZDs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then i quantize these coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kSbrA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After all these steps i take the two matrices below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ng8bP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I choose the filter representation for every second-order instance to be like below (Direct Form 2):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uXYkL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;circle with &quot;X&quot; is a multiplication&lt;/li&gt;&#xA;&lt;li&gt;circle with &quot;Σ&quot; is an addition&lt;/li&gt;&#xA;&lt;li&gt;and the triangle is a delay element&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After that i have done all of these i write some matlab code to model the structure above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Implementation of a second-order filter structure&#xA;function[y,state,pointer]=Second_Order(x,a,b,state,pointer)&#xA;&#xA;%The filter routine when fed with an input sample produce one output&#xA;%sample each time it is called&#xA;&#xA;%x=input value&#xA;%a=array containing feedback coefficients[1,a1,a2]&#xA;%b=array containing feed forward coefficients[b0,b1,b2]&#xA;%state=array(of length 2) containing old input values&#xA;%y=output value&#xA;&#xA;&#xA;%compute output value&#xA;y=b(1)*x+state(pointer+1);&#xA;pointer=rem(pointer+1,2); %update pointer in modulo form&#xA;&#xA;%Update states &#xA;state(pointer+1)=b(2)*x-a(2)*y+state(pointer+1);&#xA;pointer=rem(pointer+1,2);&#xA;&#xA;%Overwrite oldest sum with b(N-1).x&#xA;state(pointer+1)=b(3)*x-a(3)*y;&#xA;pointer=rem(pointer+1,2);%Increment pointer modulo-(N-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the end, and the point that i don't know how to do it properly is how i can display the impulse and step response of the whole filter and not for every second order section. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if i write something like that, i think i take the impulse response of the first second order section. How i can take the impulse resonse of the whole system?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Initialization&#xA;[b,a]=ellip(4,1.3,60,2*[0.2,0.3]);&#xA;[sos,q]=tf2sos(b,a);&#xA;sosq=Quantize('round',sos,2^6);&#xA;&#xA;bf=sosq(1,1:3);&#xA;af=sosq(1,4:6);&#xA;&#xA;%impulse invariant design&#xA;impsv=zeros([1,2]);%impulse response state variable&#xA;stpsv=zeros([1,2]);%step response state variable&#xA;len=20; % run length&#xA;impy=zeros([1,len]);%impulse response result&#xA;stpy=zeros([1,len]);% step response result&#xA;impp=0;&#xA;stpp=0;&#xA;&#xA;% Simulation of filter operation&#xA;&#xA;x=1;&#xA;for k=1:len&#xA;  [impy(k),impsv,impp]=Second_Order(x,af,bf,impsv,impp);&#xA;  [stpy(k),stpsv,stpp]=Second_Order(1,af,bf,stpsv,stpp);&#xA;  x=0;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4273" LastEditorUserId="4273" LastEditDate="2013-05-31T09:51:08.260" LastActivityDate="2013-06-30T10:44:26.513" Title="Impulse and step response of a system that contains cascaded second order sections" Tags="|matlab|filters|impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9354" PostTypeId="2" ParentId="9349" CreationDate="2013-05-30T23:39:07.870" Score="1" Body="&lt;p&gt;As mentioned, the farrow implementation is good for HW &amp;amp; FPGAs. If you don't have access to the IEEE paper, there is a block diagram available here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsptemplates.com/doc/classSPUC_1_1farrow.html&quot; rel=&quot;nofollow&quot;&gt;http://www.dsptemplates.com/doc/classSPUC_1_1farrow.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, spuc code at sourceforge.net should have a c++ implementation.&lt;/p&gt;&#xA;" OwnerUserId="4221" LastEditorUserId="609" LastEditDate="2013-05-31T11:14:58.283" LastActivityDate="2013-05-31T11:14:58.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9355" PostTypeId="2" ParentId="9349" CreationDate="2013-05-31T00:29:50.557" Score="1" Body="&lt;p&gt;The paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;P.J. Kootsookos and R.C. Williamson, “FIR Approximation of Fractional Sample &#xA;    Delay Systems,” &lt;em&gt;IEEE Transactions on Circuits and Systems II: Analog and &#xA;    Digital Signal Processing&lt;/em&gt;, vol. 43(3), March 1996, pp. 269-271.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;might be of interest.  It shows that three distinct approaches to fractional sample delay FIR filter design are all essentially equivalent.  &lt;a href=&quot;http://espace.library.uq.edu.au/eserv/UQ:11248/TCnSII_Fractiona.pdf&quot; rel=&quot;nofollow&quot;&gt;A preprint is available here.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-05-31T00:29:50.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9356" PostTypeId="1" AcceptedAnswerId="9383" CreationDate="2013-05-31T01:43:35.763" Score="1" ViewCount="288" Body="&lt;p&gt;My signal graph is as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have &amp;lt; 10 reputation, thus cannot post the photo... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The graph are simply roughly the series of -5, 0, +5, 0, -5, 0, +5, 0.... but with sawtooth-like small peaks around the prominent peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going to do the peak detection. But what I need to count is the &quot;prominent peaks&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. The &quot;sawtooth&quot; small peaks around the main peaks should not be counted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have known that the small peaks are due to high-freq noises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My range of interest is 0~4Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, before counting the peak number, I have to low pass filter the signal first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Being a beginner in signal processing, I have no idea which type of filter is the most proper. Chebyshev or Bessel or the classic Butterworth?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4677" LastActivityDate="2013-06-01T15:58:48.357" Title="How to choose one among different types of LPF?" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9357" PostTypeId="1" CreationDate="2013-05-31T03:35:26.103" Score="0" ViewCount="161" Body="&lt;p&gt;&quot;Using a state-of-the-art atomic force microscope, the scientists have taken the first atom-by-atom pictures, including images of the chemical bonds between atoms, clearly depicting how a molecule's structure changed during a reaction. Until now, scientists have only been able to infer this type of information from spectroscopic analysis.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.sciencedaily.com/releases/2013/05/130530142007.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.sciencedaily.com/releases/2013/05/130530142007.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any papers how this thing actually works?&lt;/p&gt;&#xA;" OwnerUserId="4478" LastActivityDate="2013-05-31T05:21:59.523" Title="How did Scientists Capture First Images of Molecules Before and After Reaction?" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9358" PostTypeId="1" CreationDate="2013-05-31T05:11:43.443" Score="10" ViewCount="8770" Body="&lt;p&gt;I've read many questions on SO, and frankly, each one of them is not describing any particular way to go about it. Some say &quot;do FFT&quot; and some say &quot;zero crossing&quot; etc. But I've only gone as far as understanding that the digital audio input consists of an array of amplitudes for a particular frequency and well.. Don't really know much beyond it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I do know Nyquist theorem, frequency, amplitude, Fourier series etc, and that's from 2-3 years ago when I did that in my university program in some semester. But back then we really weren't taught the real world usage of Fourier much, and I didn't bother to dig up more on the subject beyond learning just enough to pass the subject. But now I'm gonna have to use all that stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a snapshot of the sounds I'm trying to detect:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/THgoS.jpg&quot; alt=&quot;unique graph of finger snaps and light switch on/off&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly the sounds have unique graphs. I just want to understand how to extract their particular unique characteristics for their unique spiky lines in the graph. Like what amplitude, frequency, etc. And for how much time - although that is trivial I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want a simple step by step, un-vague instruction list - I can google the terminology I won't understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like perhaps this? --&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Get input audio data&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Plot spectogram&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Get spectogram graph for the sound you want to detect in a noiseless environment&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Study that graph - draw unique characteristics of that sound&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make some kind of function that can detect those particular characteristics in live audio feed, using the characteristics of the sound found in (4)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If a match is found, well - the job's done.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Polish the algorithm to weed out false negatives.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Where I am confused is - how do I go about 3,4,5. Particularly 3 and 4.&#xA;Because I'm making a software where in the user would be able to record any sound as a gesture input to be used later, I would want my system to be able to record any sound and match it against live audio feed to detect that sound gesture. Like say, coughing, or finger snapping, or whistling, or clapping. Or saying consonants - $A$ or $B$ or $X$ or $Z$. Just about any sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking of making the user record the sound they want to store as a gesture in a quite environment. And the user would make the sound only in between the &lt;em&gt;quiet time padding&lt;/em&gt;; 3 secs in the beginning and in the end of the recording.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So say, during the first 3 secs, my system would establish that the current input is the normal quiet background sound. And then a sudden change in the graph would be the sound input starting. And when that stops, the recording would go on for another 3 secs, the trailing &lt;em&gt;quiet time padding&lt;/em&gt;. This would be done manually by the user. It would then automatically store the characteristics of only that part during which the sudden change in the graph lasted - somewhere between the padding times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And thus the characteristics of that part would be saved as that sound's gesture data, which would be used to detect that particular sound in live audio feed later on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is, that I'm thinking all this in plain English. I need to think in maths and physics, to be able to implement it efficiently in my code. I'm just so damn clueless about what to write and where to write it in my code - even with so many libraries and questions on SO at my disposal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And sorry if this was long.&lt;/p&gt;&#xA;" OwnerUserId="4702" LastEditorUserId="13320" LastEditDate="2016-11-21T12:59:41.360" LastActivityDate="2016-11-21T12:59:41.360" Title="How do I go about detecting whistles, pops and other sounds in live audio input?" Tags="|fft|audio|speech-processing|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9359" PostTypeId="2" ParentId="9357" CreationDate="2013-05-31T05:21:59.523" Score="1" Body="&lt;p&gt;The seminal paper you're looking for is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Binnig, G., &amp;amp; Quate, C. F. (1986). Atomic force microscope. Physical Review Letters, 56(9),    930-933.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the short version, along with some speculation since I don't have their manuscript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Atomic force microscopy (AFM) is a scanning probe microscopy technique, meaning a sharp probe is scanned in a raster pattern over/in contact with the sample. A probe my look like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8Bv3t.jpg&quot; alt=&quot;AFM probe&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will refer to the point as the tip, and that is where the carbon monoxide molecule mentioned in the article resides. The substrate the tip is attached to will be referred to as the cantilever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A laser is bounced off the top of the cantilever, onto a dicrotic mirror, and finally into a photodetector, as shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pd6Gg.png&quot; alt=&quot;AFM beam bounce diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The researcher has control of the laser and mirror alignment. Alignment procedure is to place the laser centered, and as close to the end of the cantilever as possible, for the maximum deflection signal. The mirror is then adjusted to put the reflected laser on the most sensitive part of the photodetector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article mentions using non-contact AFM. That is about as meaningful as saying &quot;we can the signal through a digital filter.&quot; There are multiple non-contact modes, but my guess (without having access to the manuscript) is they used a form of tapping mode. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cantilever has a self resonant frequency, typically around 300 kHz. The cantilever is driven to resonance, and scanned over the sample. The deflection signal generated is an amplitude modulated version of the topography. It is also possible to obtain information about material properties this way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is the short version. If I get access to the manuscript or someone asks questions, I would be happy to add more information about how this system works.&lt;/p&gt;&#xA;" OwnerUserId="3495" LastActivityDate="2013-05-31T05:21:59.523" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9360" PostTypeId="1" CreationDate="2013-05-31T05:49:29.517" Score="5" ViewCount="3920" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter#Normalized_Butterworth_polynomials&quot; rel=&quot;nofollow&quot;&gt;primary source&lt;/a&gt; lists Butterworth polynomials in s-domain and provides a &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter#Digital_implementation&quot; rel=&quot;nofollow&quot;&gt;link to bilinear transform&lt;/a&gt; for digital implementation. But, who needs analog specification in our digital world? Why should everybody get involved into the quite laborious bilinear transform, which, additionally requires &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform#Frequency_warping&quot; rel=&quot;nofollow&quot;&gt;frequency pre-warping&lt;/a&gt;? Meantime, looking &lt;a href=&quot;http://www.robots.ox.ac.uk/~sjrob/Teaching/SP/l6.pdf&quot; rel=&quot;nofollow&quot;&gt;at example bilinear transform in Butterworth design&lt;/a&gt;, I see that sampling frequency, T, cancels out, leaving you with a nice polynomial, after the monstrous transform. Why nobody can just conduct those monstrous computations only once and publish the z-polynomials, likewise s-polynomials are provided? Where can I find a table of z-polynomials not to be bogged down with the terrible pre-warping technicalities? &lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="90" LastEditDate="2013-06-01T14:18:30.177" LastActivityDate="2017-09-05T13:47:36.307" Title="Where can I find a table of $z$-domain coefficients for Butterworth filters?" Tags="|filter-design|z-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9361" PostTypeId="1" CreationDate="2013-05-31T05:50:50.590" Score="4" ViewCount="2737" Body="&lt;p&gt;I need a tool or code for extract not blurry images from video (it can be used for panorama or SFM building from video)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;something like&#xA;&lt;a href=&quot;http://research.microsoft.com/en-us/um/redmond/groups/ivm/sharppanoramas/&quot; rel=&quot;nofollow&quot;&gt;http://research.microsoft.com/en-us/um/redmond/groups/ivm/sharppanoramas/&lt;/a&gt;&#xA;(It is worth noting that &lt;a href=&quot;http://hdview.wordpress.com/2011/04/05/microsoft-ice-updatevideo-to-panorama-lens-vignette-improved-blending/&quot; rel=&quot;nofollow&quot;&gt;software&lt;/a&gt; for building panorama from video is already exist, but I don't know why they don't use it for SFM)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get images from video and put them to &lt;a href=&quot;http://homes.cs.washington.edu/~ccwu/vsfm/&quot; rel=&quot;nofollow&quot;&gt;vsfm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example virtualdub gives blurry images when I try to convert video to images.&lt;/p&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="1781" LastEditDate="2013-06-21T06:27:18.083" LastActivityDate="2013-06-21T06:27:18.083" Title="Extract not blurry images from video" Tags="|panorama|video|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9362" PostTypeId="1" AcceptedAnswerId="9384" CreationDate="2013-05-31T05:57:39.260" Score="6" ViewCount="10896" Body="&lt;p&gt;I'm using a set of features extracted from a signal for classifying the data window with KNN algorithm. Since the features have different value ranges, their influence on distance calculation is different when you use euclidean distance in KNN.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To equalize the influence of these features on classification:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I can normalize features with min-max normalization and then use euclidean distance.&lt;/li&gt;&#xA;&lt;li&gt;I can use mahalanobis distance.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What are the advantages of these two approaches over eachother?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2013-06-24T23:45:14.213" Title="Mahalanobis vs Normalization+Euclidean" Tags="|classification|normalization|knn|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9363" PostTypeId="2" ParentId="9358" CreationDate="2013-05-31T06:36:37.720" Score="0" Body="&lt;p&gt;I used this &lt;a href=&quot;http://mir.cs.nthu.edu.tw/jang/books/audioSignalProcessing/paper/endPointDetection/096.PDF&quot; rel=&quot;nofollow&quot;&gt;paper on entropy based end pointing&lt;/a&gt; when I was trying to ignore these kinds of sounds in phone calls, used for computer speech recognition, if the sounds you are try to capture is speech then entropy could work really well, for music it may not be useful.&lt;/p&gt;&#xA;" OwnerUserId="1144" LastActivityDate="2013-05-31T06:36:37.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9364" PostTypeId="2" ParentId="9353" CreationDate="2013-05-31T07:26:41.387" Score="1" Body="&lt;p&gt;Not sure I follow completely, but is this the question: how to obtain the impulse and step response of a filter that is realized as a cascade of second or sections? or are you asking for working code that implements this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your 8th order filter is decomposed into 4 second order sections. The ordering is not really important here. For any input $x$ to your 8th order filter you compute the output $y$ by first filtering the input with the first second order section $SOS_1$ to get output $s_1$, that is $s_1 = SOS_1*x$ (the $*$ means processing the $x$ with a second order difference equation with coefs from $SOS$). Then that output is made input to the second SOS, that is $s_2 = SOS_2*s_1$. So now you have $s_2 = SOS_2*(SOS_1*x)$. And then continue this pattern (output from one section is input to the next) through all sections. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you understand this, then it should also be rather obvious that you obtain the impulse response or the step response by letting an impulse or a step waveform be input to your filter and the output $y$ contains the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not looked at your code. But try to start with a simpler case first just to verify your code and your understanding of the concept. &lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-05-31T07:26:41.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9365" PostTypeId="1" AcceptedAnswerId="9381" CreationDate="2013-05-31T09:33:21.280" Score="4" ViewCount="20282" Body="&lt;p&gt;related to &lt;a href=&quot;https://dsp.stackexchange.com/questions/9204/filtering-voice-signal-from-randomly-added-frequencies&quot;&gt;Filtering voice signal from randomly added frequencies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to create a simple low pass filter but i'm not sure what is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,Fs]=wavread('sound.wav');&#xA;m = length(y); %30586&#xA;Fc = 500;               %% frequency cut&#xA;n = [0:m-1];            %% kernel length / samples&#xA;Fs = Fs;    %22000      %% sample frequency / (nyquist - %2*m)&#xA;Tc = 2*pi*(Fc/Fs);      %% theta c&#xA;Hm = sin(Tc*n) ./ (pi*n);&#xA;Hm(1) = Tc/pi;&#xA;figure,plot(Hm);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LPF: How to get to the 0-500 range?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We used this code in the class but with &lt;code&gt;Fc=45,m=100,Fs=200&lt;/code&gt; and it looks ok.&#xA;but when I try this on this wav file it's not working as expected. I thought it will pass from &lt;em&gt;0-500&lt;/em&gt; but instead it returns some crowled plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;only when I set Fc to be a low number I can see the sin wave. so i've try to manipulate by setting &lt;code&gt;Fc=real(ceil(m/500))&lt;/code&gt;. it better than nothing but it's not it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;hpf = 1-lpf&lt;/code&gt;, right? well is seems not to be. my guess is that my lpf is wrong&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will deal the &lt;code&gt;ripple&lt;/code&gt; after i'll manage to do this&lt;/p&gt;&#xA;" OwnerUserId="4608" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-11-29T18:41:07.367" Title="matlab How to design lpf\bpf\hpf without builtin functions" Tags="|matlab|filter-design|lowpass-filter|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9366" PostTypeId="2" ParentId="9360" CreationDate="2013-05-31T09:46:17.900" Score="2" Body="&lt;p&gt;This has been done for biquad designs: &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow&quot;&gt;cookbook&lt;/a&gt;. Is this what you're looking for? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Let's try and make a z-transfer function table for Butterworth. We have to choose some normalized cutoff frequency $\omega_n $(in radians pr second). Let us choose e.g. $0.1\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N=2: $\frac{0.02008 + 0.04017z^{-1} + 0.02008z^{-2}}{1 - 1.561z^{-1} + 0.6414z^{-2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N=3: $\frac{0.002898 + 0.008695z^{-1} + 0.008695z^{-2}+0.002898z^{-3}}{1 - 2.374z^{-1} + 1.929z^{-2} -0.5321z^{-3}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N=4: $\frac{0.0004166 + 0.001666 ^{-1} + 0.002500 ^{-2}+0.001666 ^{-3}+0.0004166^{-4}}{1 -3.181z^{-1} + 3.861z^{-2} -2.112z^{-3} + 0.4383z^{-4}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order for this table to be useful we should be able to use it to design filters for any desired cutoff frequency. If we could linearly map the frequency variable e.g. $p = cz$, as in the analog case the table would be just as useful as the analog table. However, the mapping to be useful must be one that maps the unit circle in the complex $z$ plane onto itself. We choose the simplest mapping&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z^{-1} \rightarrow \frac{-\alpha + z^{-1}}{1 - \alpha z^{-1}} $       (1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To obtain the coefficients of the denormalized z-transfer function we have to compute  $\alpha$ in the following way&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\alpha = \frac{\sin\left(\frac{\omega_n- \omega_c}{2}\right)}{\sin\left(\frac{\omega_n+ \omega_c}{2}\right)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_c$ is the new cutoff frequency of the Butterworth LPF. In order to compute the coefficients in the denormalized z-transfer function (1) must be used in the normalized z-transfer function. If we do this for the case N=2, we obtain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\bar{b}_0 = b_0-\alpha b_1+b_2\alpha^2 \\&#xA;\bar{b}_1 = -2\alpha b_0+b_1+\alpha^2b_1-2\alpha b_2 \\&#xA;\bar{b}_2 = b_0\alpha^2-\alpha b_1+b_2 \\&#xA;\bar{a}_0 = 1-\alpha a_1+a_2 \alpha^2 \\&#xA;\bar{a}_1 = a_1+a_1\alpha^2 -2\alpha a_2-2\alpha \\&#xA;\bar{a}_2 = -\alpha a_1+a_2+\alpha^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not only is it painful to derive these expressions but the amount of computations that must be done in a design implementation seem to be not that much simpler than starting out from the analog normalized case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit2:&lt;/strong&gt; Here is a 'proof' showing that the z-transfer function table approach gives the same coefficients as the bilinear transformation from an analog prototype.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bilinear transformation to any normalized angular frequency, $\omega_c$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s \rightarrow \frac{1}{\tan(\omega_c/2)}\frac{1-z^{-1}}{1+z^{-1}} \quad (1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the z-transfer function table approach the bilinar transformation is done for one particular frequency, $\omega_n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s \rightarrow \frac{1}{\tan(\omega_n/2)}\frac{1-z^{-1}}{1+z^{-1}} \quad (2) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then frequency warping is performed to the desired cutoff frequency by frequency warping&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z^{-1} \rightarrow \frac{-\alpha+z^{-1}}{1-\alpha z^{-1}} \quad (3)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inserting (3) into (2) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s \rightarrow \frac{1}{\tan(\omega_n/2)}\frac{1+\alpha}{1-\alpha}\frac{1-z^{-1}}{1+z^{-1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substitution of $\alpha = \frac{\sin(\omega_c - \omega_n)}{\sin(\omega_c + \omega_n)}$ into the above equation gives (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will have to look at the complexity of the two methods later.&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2013-06-07T13:13:07.690" LastActivityDate="2013-06-07T13:13:07.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9367" PostTypeId="1" AcceptedAnswerId="9369" CreationDate="2013-05-31T12:22:01.883" Score="3" ViewCount="5375" Body="&lt;p&gt;Can you tell me whether the following signal is a energy or power signal?&#xA;$$&#xA;x(n) = e^{j (n \pi/2 + \pi/8) }&#xA;$$&#xA;I've solved it and found it as it was neither power nor energy signal was that right?&lt;/p&gt;&#xA;" OwnerUserId="4638" LastEditorUserId="80" LastEditDate="2013-05-31T12:27:01.673" LastActivityDate="2013-05-31T12:56:15.737" Title="Power or Energy Signal?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9368" PostTypeId="2" ParentId="9360" CreationDate="2013-05-31T12:38:36.277" Score="3" Body="&lt;p&gt;You can't find a table of $z$-domain coefficients that is analogous to the tables of Laplace-domain Butterworth transfer functions because it's impossible. For a second-order Butterworth filter, for example, there is no single corresponding $z$-domain transfer function, in contrast to the continuous-time case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason: discrete-time transfer functions don't cover an infinitely-long frequency axis like a continuous-time system does. When creating a digital approximation to an analog prototype, techniques like the bilinear transform are used to map the frequency response from the $s$-domain transfer function evaluated along the (infinitely long) $j\omega$ axis to the $z$-domain's (finite-length) unit circle. This obviously can't be done exactly, so the various methods for mapping an analog filter to a digital one are approximations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One factor that plays into the quality of the approximation is the sample rate of the target digital filter. In the paper you linked, you noted that the sampling interval $T$ cancelled out in the calculations of the digital filter coefficients, which is true. However, the sample interval is still required in order to perform the (necessary) frequency prewarping. Recall the prewarping formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\omega_p = \frac{2}{T}\tan{\left(\frac{\omega T}{2}\right)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the rest of the $T$'s may cancel out after performing the substitution $s = \frac{2}{T}\frac{z-1}{z+1}$, the $T$ in the argument to the tangent function cannot go away. Therefore, the resulting coefficients will always be a function of the sample rate $T$, so your hope of creating a simple table of digital Butterworth filter coefficients invariant of sample rate is stymied. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple other notes regarding this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The prewarping step is essential to ensure that particular frequencies of interest (i.e. the cutoff frequency for a Butterworth filter) are preserved through the approximation process. Without prewarping, then the stretching of the frequency response that occurs when mapping from an infinitely-long frequency axis to the unit circle would cause the cutoff to appear at a different frequency than desired in the digital filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The cookbook linked in niaren's answer also demonstrates the dependence upon the sample rate: you have to trudge through the equations a bit, but you'll see factors in the listed coefficients like $\cos(\omega_0)$ and so on (this is really just a way of slightly hiding the prewarping process). The cookbook defines $\omega_0$ as:&#xA;$$&#xA;\omega_0 = \frac{2\pi f_0}{F_s}&#xA;$$&#xA;so when it all comes down to it, you'll have to define your sample rate and prewarp any frequencies of interest in order to design a Butterworth filter approximation. It's not particularly difficult, as the cookbook shows; I'm not sure what the motivation for avoiding those steps is.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-05-31T12:38:36.277" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9369" PostTypeId="2" ParentId="9367" CreationDate="2013-05-31T12:56:15.737" Score="6" Body="&lt;p&gt;The energy of a discrete-time signal is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_x=\sum_{n=-\infty}^{\infty}|x(n)|^2\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its power is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_x=\lim_{N\rightarrow\infty}\frac{1}{2N+1}\sum_{n=-N}^{N}|x(n)|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $x(n) = e^{j (n \pi/2 + \pi/8) }$ we have $|x(n)|^2=1$ which implies that the sum in (1) does not converge, i.e. $x(n)$ has infinite energy. For the power we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_x=\lim_{N\rightarrow\infty}\frac{2N+1}{2N+1}=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal $x(n)$ has finite power and is consequently a &quot;power signal&quot;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-05-31T12:56:15.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9370" PostTypeId="2" ParentId="9358" CreationDate="2013-05-31T14:24:22.483" Score="2" Body="&lt;p&gt;While I agree with one of the comments that using speech recognition techniques might be a good start, these sounds are different and I'm not aware of anyone having done any research into categorizing them (the paper cited by Nathan appears only to distinguish between speech and noise), so unless someone presents something to contradict that, you are going to have to invent your own technique, and that's going to take a lot of learning and a lot of work. The best I can do is get you started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, don't expect anyone to be able to produce some magic formula. There's no equation to get from sound to what the sound is. Humans and computers must learn by incorporating data to make educated guesses about what sounds are. The reason people say in their answers &quot;use FFT&quot; or &quot;use zero crossing&quot; is because these are some of the basic DSP building blocks used in speech recognition and related algorithms. But the FFT and zero crossing rate are usually just first steps in creating a set of parameters describing the sound. These parameters are then analyzed statistically (not through some magic function) to determine which category they most likely belong to. Note that I said &quot;most likely&quot;: even the best speech detection (and the human brain!) has a high error rate at this stage and further processing using knowledge of the language and grammar is used to correct these mistakes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, some parameters you could look for include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;zero-crossing rate&lt;/li&gt;&#xA;&lt;li&gt;frequency centroid&lt;/li&gt;&#xA;&lt;li&gt;envelope (this is actually a set of parameters, including, eg attack time)&lt;/li&gt;&#xA;&lt;li&gt;spectral envelope&lt;/li&gt;&#xA;&lt;li&gt;even/odd harmonic balance&lt;/li&gt;&#xA;&lt;li&gt;voiciness&lt;/li&gt;&#xA;&lt;li&gt;fundamental pitch&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once you have a set of parameters that you think will allow you to distinguish your sounds, you will need to use some statistical method to categorize them. &lt;a href=&quot;http://en.wikipedia.org/wiki/Hidden_Markov_model&quot; rel=&quot;nofollow&quot;&gt;Hidden Markov Model&lt;/a&gt; is often used in speech. You can also look into logistic regression, K-means, and I'm sure there are other choices, but I think HMM is tried and true.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2013-05-31T14:24:22.483" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9371" PostTypeId="1" AcceptedAnswerId="9382" CreationDate="2013-05-31T15:06:18.397" Score="1" ViewCount="485" Body="&lt;p&gt;I went through this material on Sampling theorem. &lt;a href=&quot;http://www.wescottdesign.com/articles/Sampling/sampling.html&quot; rel=&quot;nofollow&quot;&gt;http://www.wescottdesign.com/articles/Sampling/sampling.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It uses a powerline signal example and concludes that if a signal is cyclic and repeating over a period N then you could sample the signal at lesser than N samples per second.In the example he shows for a 60Hz power signal he can sample and recover the signal by sampling at 19 Hz. He uses an expression&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ts = (M + P/N )*1/F where M&gt;0 and N&gt;0 where p is not equal to 0. I haven't understood it. Can anybody here tell me how it is done. &lt;/p&gt;&#xA;" OwnerUserId="4375" LastActivityDate="2013-06-01T14:26:50.270" Title="Sampling at subnyqvist frequencies" Tags="|frequency|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9372" PostTypeId="2" ParentId="9322" CreationDate="2013-05-31T16:50:29.547" Score="1" Body="&lt;p&gt;If you want to do &lt;em&gt;source separation&lt;/em&gt;, then independent component analysis (ICA) is the correct technique, which you mention in the comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ICA decomposes data as $x = As$ where $x$ are mixtures of some source signals $s$, and $A$ is the mixing matrix. Neither $A$ or $s$ is assumed to be known, ICA will find both of them given some $x$. The only assumptions for ICA are: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) the source signals $s$ are statistically independent,&lt;br/&gt;&#xA;2) the mixing matrix $A$ is stationary (does not change over time),&lt;br/&gt; &#xA;3) there can be maximally one gaussian source.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually one also assumes $A$ to be a square matrix. So, if you have more sensors than sources, you would first reduce dimension using PCA and some model order selection method (i.e. dimension estimation method), such as minimum description length (MDL).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would recommend you to use &lt;em&gt;FastICA&lt;/em&gt; by Hyvärinen and Oja. It's the most famous algorithm to do ICA (the second one would be Infomax ICA by Bell and Sejnowski).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find some nice publications at &lt;a href=&quot;http://www.cs.helsinki.fi/u/ahyvarin/papers/ICA.shtml&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.helsinki.fi/u/ahyvarin/papers/ICA.shtml&lt;/a&gt; and a MATLAB implementation of FastICA from &lt;a href=&quot;http://research.ics.aalto.fi/ica/fastica/&quot; rel=&quot;nofollow&quot;&gt;http://research.ics.aalto.fi/ica/fastica/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the model in your question has parametric $A$, which neglects the stationarity assumption, you could do ICA after taking the Fourier transform of $x$. This is called Fourier-ICA. Taking the Fourier transform effectively removes the parameter of $A$, but you will need to handle complex-valued data.&lt;/p&gt;&#xA;" OwnerUserId="4705" LastActivityDate="2013-05-31T16:50:29.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9373" PostTypeId="2" ParentId="9371" CreationDate="2013-05-31T16:51:52.603" Score="0" Body="&lt;p&gt;You only need to sample at twice the signal &lt;em&gt;bandwidth&lt;/em&gt; to satisfy Nyquist, not twice the maximum frequency. So if the powerline signal has a spectrum which only extends a few Hz either size of 60 Hz then the sampling rate can be significantly &amp;lt; 120 Hz. Of course if the signal contains any significant energy at harmonics of 60 Hz (120 Hz, 180 Hz, etc) then the sampling rate will need to be much higher.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2013-05-31T16:51:52.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9374" PostTypeId="2" ParentId="9347" CreationDate="2013-05-31T18:37:09.113" Score="3" Body="&lt;p&gt;You have an incorrect approach here. Instead of trying to design small range filters, you should just do frequency-domain analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have a signal $x$ consisting of $N$ samples, sampled at the rate of $f_s$ Hz. For simplicity, let's take an example with $N = 1000$ and $f_s$ = 1000 Hz. The Nyquist frequency is half of the sampling frequency, which is $500$ Hz in this case. This means that the signal you are sampling should not have frequencies above that (otherwise there would be aliasing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you want to know what frequencies you have in your signal, compute the discrete Fourier transform (DFT). DFT is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;X(k) = \sum_{n=0}^{N-1} x(n)e^{-2\pi k\frac{n}{N}} \quad 0 &amp;lt; k &amp;lt; N-1&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the DFT, you get two things. First, $|X|$ is called the &lt;em&gt;magnitude spectrum&lt;/em&gt;, which is of your interest. The second thing would be the &lt;em&gt;phase spectrum&lt;/em&gt;, given by $arg(X)$. DFT is symmetric from the middle for real-valued inputs, so the frequency resolution you get in our example is $1$ Hz. Now, say that you would also want to know the half frequencies. Looking at the definition of DFT, you can see it is $N$-point. If you want, you can do it likewise for $M$-points. Thus, to get the half frequencies as well, take $M=2000$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of your question, what you need is a really long DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other things to note: do not compute DFT from its definition. Use a fast Fourier transform (FFT). It's faster, and more precise.&lt;/p&gt;&#xA;" OwnerUserId="4707" LastActivityDate="2013-05-31T18:37:09.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9375" PostTypeId="2" ParentId="9361" CreationDate="2013-05-31T22:40:29.760" Score="3" Body="&lt;p&gt;One straightforward approach is to do blur detection (see &lt;a href=&quot;https://stackoverflow.com/questions/5180327/detection-of-blur-in-images-video-sequences&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/7765810/is-there-a-way-to-detect-if-an-image-is-blurry&quot;&gt;here&lt;/a&gt;) and prune the frames that are detected.&lt;/p&gt;&#xA;" OwnerUserId="4682" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-05-31T22:40:29.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9376" PostTypeId="2" ParentId="9343" CreationDate="2013-05-31T22:45:10.183" Score="2" Body="&lt;p&gt;From a simple Google search...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sourceforge.net/adobe/adobedatasets/panoramas/home/Home/&quot; rel=&quot;nofollow&quot;&gt;http://sourceforge.net/adobe/adobedatasets/panoramas/home/Home/&lt;/a&gt; &lt;br /&gt;&#xA;&lt;a href=&quot;http://www.ti.uni-bielefeld.de/html/research/avardy/index.html&quot; rel=&quot;nofollow&quot;&gt;http://www.ti.uni-bielefeld.de/html/research/avardy/index.html&lt;/a&gt; &lt;br /&gt;&#xA;&lt;a href=&quot;http://sun360.mit.edu/&quot; rel=&quot;nofollow&quot;&gt;http://sun360.mit.edu/&lt;/a&gt; &lt;br /&gt;&#xA;&lt;a href=&quot;http://www.iiia.csic.es/~aramisa/datasets/iiiapanos.html&quot; rel=&quot;nofollow&quot;&gt;http://www.iiia.csic.es/~aramisa/datasets/iiiapanos.html&lt;/a&gt; &lt;br /&gt;&#xA;&lt;a href=&quot;http://www.visualsize.com/mosaic3d/index.php&quot; rel=&quot;nofollow&quot;&gt;http://www.visualsize.com/mosaic3d/index.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4682" LastActivityDate="2013-05-31T22:45:10.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9377" PostTypeId="1" CreationDate="2013-05-31T23:59:35.433" Score="0" ViewCount="643" Body="&lt;p&gt;I want to sample two signals, S and R and later do IQ demodulation on these.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am multiplying S with R and I also want to multiply S with a 90 degree phase shifted version of R by shifting the samples in R so I get a 90 degree phase shift.&#xA;The problem I encounter with this is that unless I have a sampling rate that is 4*n of the sine signal frequency (where n is an integer) I wont be able to phase shift the R signal by 90 degrees. And this is my case as the sampling rate and the signal frequency are not in this multiple of each other. So let's say I am able to do a 82 degree phase shift. Is it then possible to correct for this somehow for the total number of periods I choose to sample?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it at all give any additional information when doing IQ demodulation when I phase shift the reference signal by shifting the samples to get a 90 degree phase shift?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Measuring range is 3k-&gt;300k Hz. S is a single frequency sine wave and R a square wave.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastEditorUserId="4290" LastEditDate="2013-06-01T21:19:16.173" LastActivityDate="2013-06-01T21:19:16.173" Title="How to correct for inperfect 90 degree phase shift before doing IQ demodulation?" Tags="|demodulation|phase|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9380" PostTypeId="1" CreationDate="2013-06-01T11:25:48.187" Score="0" ViewCount="269" Body="&lt;p&gt;suppose we have a cascade realization of a transfer function of a higher order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What difference does it make if the order of the transfer function is an Even or an Odd number? &lt;/p&gt;&#xA;" OwnerUserId="4710" LastEditorUserId="4344" LastEditDate="2013-06-01T21:06:48.840" LastActivityDate="2013-06-01T22:00:27.523" Title="Cascade Transfer Function; Odd or Even Transfer Function" Tags="|homework|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9381" PostTypeId="2" ParentId="9365" CreationDate="2013-06-01T12:32:53.040" Score="4" Body="&lt;p&gt;You seem to be confused with the time and frequency domain. Your code for an LP filter is the inverse Fourier transform of an Ideal low-pass filter. So by getting a frequency response for the function you wrote you'll get an ideal LP response you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are two mistakes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Your frequency for the ideal LP filter needs to be $[-\frac{m-1}{2} : \frac{m-1}{2}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You need to change the value for the 0-frequency only if M is an odd number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can use the function &lt;code&gt;freqz&lt;/code&gt; to get your freqency response, so your final code would be like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%[y,Fs]=wavread('sound.wav');&#xA;%m = length(y); %30586&#xA;m = 30586;&#xA;Fc = 500;               %% frequency cut&#xA;n = -(m-1)/2 : (m-1)/2;            %% kernel length / samples&#xA;%Fs = Fs;    %22000      %% sample frequency / (nyquist - %2*m)&#xA;Fs = 22000;&#xA;Tc = 2*pi*(Fc/Fs);      %% theta c&#xA;Hm = sin(Tc*n) ./ (pi*n);&#xA;if (rem(m, 2) == 1)&#xA;    index = (m+1)/2;&#xA;    Hm(index) = Tc/pi;&#xA;end&#xA;&#xA;[H w] = freqz(Hm, 1, 1024); % 1024 - or how many points you want for your Fourier Transform&#xA;&#xA;% Now your H is your frequency response, and w is digital frequency in [0,pi].&#xA;% You can now plot the amplitude response:&#xA;figure,plot(w, abs(H));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you have your Low-Pass filter. However, I'd like to suggest using the many ways to create filters in Matlab, they were made for a reason, and allow for much easier filter design :)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;One more remark, I have to suggest that you know the difference between &lt;strong&gt;analog&lt;/strong&gt; and &lt;strong&gt;digital&lt;/strong&gt; frequency, as they have different notation. Analog frequencies you write in uppercase, e.g. $F, \Omega$, and digital frequencies in lower-case, $f, \omega$. Here's a version of the code which is a little prettier:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = 30586;&#xA;Fc = 500;&#xA;Fs = 22000;&#xA;wc = 2*pi*Fc/Fs;&#xA;&#xA;n = -(M-1)/2:(M-1)/2;    &#xA;h = (sin(n*wc))./(n*pi);&#xA;if ( M-2*fix(M/2) ) &amp;gt; 0&#xA;        index = (M+1)/2;&#xA;        h(index) = wc/pi;&#xA;        display(index);&#xA;end&#xA;&#xA;[H w] = freqz(h, 1, 1024);&#xA;plot(w, abs(H));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cheers :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you use freqz, the digital frequency w can be somewhat hard to control, because it's not created in the same way, or more clearly, the points are not selected like a normal frequency we create with, for example, &lt;code&gt;F = 0 : Fs/(M-1) : Fs&lt;/code&gt;, even though it should be the &quot;same&quot; frequency. &#xA;The result is that it's &lt;strong&gt;not really&lt;/strong&gt; possible to get the output filtered signal with &lt;code&gt;Y = H .* X&lt;/code&gt;, and  &lt;code&gt;y = ifft(Y)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would suggest using the function &lt;code&gt;filter(b, a, x)&lt;/code&gt; for filtering your signal, which works good with &lt;code&gt;freqz&lt;/code&gt;. You can proceed to do just that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% ------&#xA;% Create a random signal x&#xA;n = 0:M-1;&#xA;F = -Fs/2:Fs/(M-1):Fs/2;&#xA;Fx = [2000 7000 10000];&#xA;x = cos(2*pi*Fx(1)/Fs*n) + cos(2*pi*Fx(2)/Fs*n) + cos(2*pi*Fx(3)/Fs*n);&#xA;X = abs(fftshift(fft(x, Nfft))); % fftshift because we need domain [-Fs/2, Fs/2]&#xA;% ---------&#xA;&#xA;% -------&#xA;% Now filter the signal&#xA;y = filter(H, 1, x);&#xA;Y = abs(fftshift(fft(y)));&#xA;% -------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's it :)&lt;/p&gt;&#xA;" OwnerUserId="4710" LastEditorUserId="4710" LastEditDate="2013-06-03T17:51:36.030" LastActivityDate="2013-06-03T17:51:36.030" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9382" PostTypeId="2" ParentId="9371" CreationDate="2013-06-01T14:26:50.270" Score="1" Body="&lt;p&gt;The point in the article is that you can sample the signal at lower frequencies than 60Hz by &lt;em&gt;subsampling&lt;/em&gt;. Consider the following two scenarios of sampling the 60Hz signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You sample like Nyquist wanted, at freq $\geq 120\mbox{Hz}$. In one period of your 60Hz signal, or $T=16.67\mbox{ms}$, you will have a correct representation of your signal via sampling.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You sample at a frequency even lower than the $60\mbox{Hz}$ signal freq. The trick is to sample at frequencies that do not divide the main frequency, which means you cannot use $2, 3, 6, 10, 12, 15, 20, \mbox{ or } 30 \mbox{Hz}$ frequencies, because then you'd always get the same point of the signal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Let's say you sample at $19\mbox{Hz}$ like in the article. The whole point of this is to &lt;strong&gt;save&lt;/strong&gt; the points on your graph, and get the desired signal point-by-point. So you start sampling your signal, get one point, then whole 3 periods of the signal will pass, and you get a second point, which you put on the graph, and so on until you have enough. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many points do we need? The Nyquist theorem you stated tells us the number of points we need to be sure we got 100% of the signal. $$T_s = (M + \frac{P}{N})\frac{1}{F},$$  where $F$ is our signal frequency of $60\mbox{Hz}$, $T_s = 1/F_s = 1/19\mbox{s} = 52.63\mbox{ms}$ is our sampling period, and $M, N, P$ are integers where $N$ and $P$ must have no common factors. If we try to get such integers, we can see that for $N = 19, M = 3, \mbox{ and } P = 3$ our equation holds. So, we need 19 points for our graph, in order to have the whole signal. This means we need to wait 19 times our sampling period to get our total time of sampling, so we get $$ T_{tot} = 19\cdot 52.63\mbox{ms} = 999.97\mbox{ms} $$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So we see that sampling is possible at even lower frequencies, but at much longer time :) Hope this clarified your question! :)&lt;/p&gt;&#xA;" OwnerUserId="4710" LastActivityDate="2013-06-01T14:26:50.270" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9383" PostTypeId="2" ParentId="9356" CreationDate="2013-06-01T15:58:48.357" Score="2" Body="&lt;p&gt;There are 4 main types of LP filters, Butterworth, Chebyshev1, Chebyshev2, and Elliptic filter. Each differs from the other in the oscillations it has, and in which part of the spectre it is.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Butter has the worst amplitude cutoff, eg the widest transition region, but no osclillations;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Cheb1 has better transition range, but has oscillations in the pass region;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Cheb2 is the opposite of Cheb1, has oscillations in the reject region, but not in the pass region;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Elliptic has the narrowest transition, so therefore the best, but has oscillations in both the pass and no-pass zone. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Heres a picture to help you visualize:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rJMQw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/rJMQw.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, seeing as you need a peek detector, you should use a flat filter for the pass zone, so Butter or Cheb2. I advise Cheb2, because you don't really care about the higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matlab, the function is &lt;code&gt;cheb2ap&lt;/code&gt;, and is used like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[z, p, k] = cheb2ap(N, La) &#xA;% where La is the allowed ripple in the stopband (usually around 0-1.5 dB).&#xA;&#xA;% And now the filter transfer function is acquired with:&#xA;b = k*poly(z);&#xA;a = poly(p); % b is the polynomial for zeroes, a is polynomial for poles&#xA;[H w] = freqz(b,a, N)  % N is the number of points for calculation&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you have frequency response of your filter, &lt;code&gt;H&lt;/code&gt;, and vector for its frequency, &lt;code&gt;w&lt;/code&gt;, and you can plot the filter with &lt;code&gt;plot(w, abs(H))&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps :)&lt;/p&gt;&#xA;" OwnerUserId="4710" LastActivityDate="2013-06-01T15:58:48.357" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9384" PostTypeId="2" ParentId="9362" CreationDate="2013-06-01T16:08:15.497" Score="8" Body="&lt;p&gt;Both are reasonable approaches and it is foreseeable that either one could outperform the other empirically. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Euclidean_distance&quot; rel=&quot;noreferrer&quot;&gt;Euclidean distance&lt;/a&gt; assumes the data to be isotropically Gaussian, i.e. it will treat each feature equally. On the other hand, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mahalanobis_distance&quot; rel=&quot;noreferrer&quot;&gt;Mahalanobis distance&lt;/a&gt; seeks to measure the correlation between variables and relaxes the assumption of the Euclidean distance, assuming instead an anisotropic Gaussian distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know a priori that there is some kind of correlation between your features, then I would suggest using a Mahalanobis distance over Euclidean. Also, note that Z-score feature scaling can mitigate the usefulness of choosing a Mahalanobis distance over Euclidean (less true of min-max normalization though). The major drawback of the Mahalanobis distance is that it requires the inversion of the covariance matrix which can be computationally restrictive depending on the problem.&lt;/p&gt;&#xA;" OwnerUserId="4682" LastEditorUserId="4682" LastEditDate="2013-06-24T23:45:14.213" LastActivityDate="2013-06-24T23:45:14.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9385" PostTypeId="1" AcceptedAnswerId="9387" CreationDate="2013-06-01T16:50:34.470" Score="5" ViewCount="306" Body="&lt;p&gt;I have a set of recordings sampled at 16khz, but some of them are upsampled from 11khz and some from 8khz. Quite some of the recordings are noisy. What is the best way to classify the recordings according to the original bandwidth?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know some people are using GMM classifiers for detection. A paper on the subject is &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.149.6268&quot; rel=&quot;nofollow&quot;&gt;DETECTING BANDLIMITED AUDIO IN BROADCAST TELEVISION SHOWS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've come to the following algorithm: calculate energy for 40 frequency bins for the full range from 0 to 8khz for 10ms frames, then normalize by maximum energy, then calculate maximum of normalized energy over sequence of frames. Bandwidth is detected by comparing maximum normalized energy in high-order bins compared to maximum normalized energy in middle bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any better ideas?&lt;/p&gt;&#xA;" OwnerUserId="3453" LastEditorUserId="3453" LastEditDate="2013-06-01T22:28:18.467" LastActivityDate="2013-06-01T22:28:18.467" Title="Detecting the original bandwidth of upsampled recordings" Tags="|speech|bandwidth|resampling|detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9386" PostTypeId="2" ParentId="9362" CreationDate="2013-06-01T18:11:32.343" Score="7" Body="&lt;p&gt;To complete bjou's answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A potential problem with min-max normalization is that it is very sensitive to outliers. For example, if your dataset contain 100 two-dimensional examples; and that the dataset looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1, 147&#xA;8, -252&#xA;3, 125&#xA;2, -605&#xA;...&#xA;10000, -100 &amp;lt;- outlier&#xA;4, 200&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;min-max normalization will squash almost all values of the first attribute to 0, at the exception of the last one which will be 1 - and as a result, it is unlikely that the first attribute will have any weight in the classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can instead use a robust variant of min-max normalization which uses the first and third quartile (or 1st and 9th decile) instead of the minimum and maximum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another common normalization technique consists in removing the mean and dividing by the standard deviation. You can think of it as an analogue of Mahalanobis distance in which the covariance matrix is constraint to be diagonal. It is somewhat sensitive to outliers to, but not as drastically as min/max.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A last thing worth mentioning: gaussianizing your data (for example with a box-cox transform) is often helpful - whenever you are doing things on data with the euclidean norm there's a gaussianity assumption lurking behind!&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-01T18:11:32.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9387" PostTypeId="2" ParentId="9385" CreationDate="2013-06-01T18:21:03.000" Score="6" Body="&lt;p&gt;A recording originally at 8kHz and digitally upsampled to 16kHz will have almost no energy in the 4-8kHz range (whatever is here is due to imperfections in the filters used for the upsampling process). I would just use a 4kHz and 5.5kHz high pass; and use a threshold on the signal energy at the output of these filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... Unless your recordings are affected by noise, distortion etc. after they have been upsampled to 16kHz. Is that the case? If so, please update your question and tell the whole story about your signals!&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-01T18:21:03.000" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9388" PostTypeId="2" ParentId="9380" CreationDate="2013-06-01T22:00:27.523" Score="1" Body="&lt;p&gt;If the order $N$ of the system is even, you get $N/2$ second-order sections, where each second-order section combines either a pair of complex conjugate poles and zeros, or two real-valued poles and zeros. If $N$ is odd, you get $(N-1)/2$ second-order sections and one additional first-order section for the remaining real-valued pole and zero.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-01T22:00:27.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9389" PostTypeId="2" ParentId="9094" CreationDate="2013-06-01T22:12:07.983" Score="63" Body="&lt;p&gt;Since this question has multiple sub-questions in edits, comments on answers, etc., and these have not been addressed, here goes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Matched filters&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Consider a finite-energy signal $s(t)$ that is the input to a (linear&#xA;time-invariant BIBO-stable) filter with impulse response $h(t)$, transfer function $H(f)$,&#xA;and produces the output&#xA;signal&#xA;$$y(\tau) = \int_{-\infty}^\infty s(\tau-t)h(t)\,\mathrm dt.\tag{1}$$&#xA;What choice of $h(t)$ will produce a maximum response at a given time&#xA;$t_0$? That is, we are looking for a filter such that the global maximum&#xA;of $y(\tau)$ occurs at $t_0$. This really is a very loosely phrased&#xA;(and really unanswerable) question because clearly the filter&#xA;with impulse response $2h(t)$ will have larger response than&#xA;the filter with impulse response $h(t)$, and so there is&#xA;no such thing as the filter that maximizes the response.&#xA;So, rather than compare apples and oranges, let us include the&#xA;constraint that we seek the filter that maximizes $y(t_0)$ subject&#xA;to the impulse response having a &lt;em&gt;fixed&lt;/em&gt; energy, for example, subject to&#xA;$$\int_{-\infty}^\infty |h(t)|^2\,\mathrm dt = \mathbb E &#xA;= \int_{-\infty}^\infty |s(t)|^2 \,\mathrm dt.\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Here onwards, &quot;filter&quot; shall mean a linear time-invariant filter&#xA;  whose impulse response satisfies (2).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The Cauchy-Schwarz inequality provides an answer to this question. We have&#xA;$$y(t_0) = \int_{-\infty}^\infty s(t_0-t)h(t)\,\mathrm dt&#xA;\leq \sqrt{\int_{-\infty}^\infty |s(t_0-t)|^2 \,\mathrm dt}&#xA;\sqrt{\int_{-\infty}^\infty |h(t)|^2\,\mathrm dt}&#xA;= \mathbb E$$&#xA;with equality occurring if $h(t) = \lambda s(t_0-t)$ with $\lambda &amp;gt; 0$&#xA;where from (2) we get that $\lambda = 1$, that&#xA;is, the filter with impulse response $h(t) = s(t_0-t)$ produces&#xA;the maximal response $y(t_0) = \mathbb E$ at the specified time $t_0$.&#xA;In the (non-stochastic) sense described above, this filter is&#xA;said to be  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the filter matched to $s(t)$ at time $t_0$ or&#xA;  the matched filter for $s(t)$ at time $t_0.$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are several points worth noting about this result.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The output of the matched filter has a &#xA;&lt;em&gt;unique&lt;/em&gt; global maximum value of $\mathbb E$ at $t_0$; for any other&#xA;$t$, we have $y(t) &amp;lt; y(t_0) = \mathbb E$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The impulse response $s(t_0-t) = s(-(t-t_0))$&#xA;of the matched filter for time $t_0$ is just $s(t)$ &quot;reversed in time&quot;&#xA;and moved to the right by $t_0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. If $s(t)$ has finite support, say, $[0,T]$, then the matched filter is&#xA;&lt;em&gt;noncausal&lt;/em&gt; if $t_0 &amp;lt; T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b. The filter matched to $s(t)$ at time $t_1 &amp;gt; t_0$ is just the filter&#xA;matched at time $t_0$ with an additional delay of $t_1-t_0$. For this&#xA;reason, some people call the filter with impulse response $s(-t)$,&#xA;(that is, the filter matched to $s(t)$ at $t=0$) &lt;strong&gt;the&lt;/strong&gt; matched filter for $s(t)$ with the&#xA;understanding that the exact time of match can be incorporated into&#xA;the discussion as and when needed. If $s(t) = 0$ for $t &amp;lt; 0$, then&#xA;&lt;strong&gt;the&lt;/strong&gt; matched filter is noncausal. With this, we can rephrase 1. as&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;The&lt;/strong&gt; matched filter for $s(t)$ produces a unique global maximum&#xA;value $y(0) = \mathbb E$ at time $t=0$. Furthermore, &#xA;$$y(t) = \int_{-\infty}^\infty s(t-\tau)s(-\tau)\,\mathrm d\tau&#xA;= \int_{-\infty}^\infty s(\tau-t)s(\tau)\,\mathrm d\tau = R_s(t)$$&#xA;is the &lt;em&gt;autocorrelation function&lt;/em&gt; of the signal $s(t)$. It is&#xA;well-known, of course, that $R_s(t)$ is an even function of $t$&#xA;with a unique peak at the origin.  Note that the output of the&#xA;filter matched at time $t_0$ is just $R_s(t-t_0)$, the autocorrelation&#xA;function delayed to peak at time $t_0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;No&lt;/em&gt; filter other than the&#xA;matched filter for time $t_0$ can produce an output as large &#xA;as $\mathbb E$ at $t_0$. However, for any $t_0$,&#xA;it is possible to find filters that&#xA;have outputs that exceed $R_s(t_0)$ at $t_0$. Note that $R_s(t_0) &amp;lt; \mathbb E$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;em&gt;transfer function&lt;/em&gt; of &lt;strong&gt;the&lt;/strong&gt; matched filter is $H(f)=S^*(f)$, the&#xA;complex conjugate of the spectrum of $S(f)$. &#xA;Thus, $Y(f) = \mathfrak F[y(t)]= |S(f)|^2$.&#xA;Think of this result as follows. Since $x^2 &amp;gt; x$ for $x &amp;gt; 1$ and $x^2&amp;lt; x$ for&#xA;$0 &amp;lt; x &amp;lt; 1$, the matched filter has low gain at those frequencies where&#xA;$S(f)$ is small, and high gain at those frequencies where $S(f)$ is large.&#xA;Thus, the matched filter is reducing the weak spectral components&#xA;and enhancing the strong spectral components in $S(f)$. (It is also&#xA;doing phase compensation to adjust all the &quot;sinusoids&quot; so that&#xA;they all peak at $t=0$).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;-------&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;But what about noise and SNR and stuff like that which is what the OP&#xA;was asking about?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal $s(t)$ &lt;em&gt;plus&lt;/em&gt; additive white Gaussian noise with&#xA;two-sided power spectral density $\frac{N_0}{2}$ is processed&#xA;through a filter with impulse response $h(t)$, then the output&#xA;&lt;em&gt;noise&lt;/em&gt; process is a  zero-mean stationary Gaussian process with&#xA;autocorrelation function $\frac{N_0}{2}R_s(t)$. Thus, the&#xA;variance is&#xA;$$\sigma^2 = \frac{N_0}{2} R_s(0) = \frac{N_0}{2}\int_{-\infty}^{\infty} |h(t)|^2\,\mathrm dt.$$&#xA;It is important to note that the variance is the same regardless&#xA;of when we sample the filter output.  So, what choice of $h(t)$&#xA;will maximize the SNR $y(t_0)/\sigma$ at time $t_0$?  Well, from the&#xA;Cauchy-Schwarz inequality, we have&#xA;$$\text{SNR} = \frac{y(t_0)}{\sigma}&#xA;= \frac{\int_{-\infty}^\infty s(t_0-t)h(t)\,\mathrm dt}{\sqrt{\frac{N_0}{2}\int_{-\infty}^\infty |h(t)|^2\,\mathrm dt}}&#xA;\leq \frac{\sqrt{\int_{-\infty}^\infty |s(t_0-t)|^2 \,\mathrm dt}&#xA;\sqrt{\int_{-\infty}^\infty |h(t)|^2\,\mathrm dt}}{\sqrt{\frac{N_0}{2}\int_{-\infty}^\infty |h(t)|^2\,\mathrm dt}} = \sqrt{\frac{2\mathbb E}{N_0}}$$&#xA;with equality exactly when $h(t) = s(t_0-t)$, the filter that is matched&#xA;to $s(t)$ at time $t_0$!! Note that $\sigma^2 = \mathbb EN_0/2$. &#xA;If we use this matched filter for our desired sample time, then at &lt;em&gt;other&lt;/em&gt;&#xA;times $t_1$, the SNR will be &#xA;$y(t_1)/\sigma &amp;lt; y(t_0)/\sigma = \sqrt{\frac{2\mathbb E}{N_0}}$.  Could&#xA;&lt;em&gt;another&lt;/em&gt; filter give a larger SNR at time $t_1$? Sure, because $\sigma$&#xA;is the same for all filters under consideration, and we have noted above that&#xA;it &lt;em&gt;is&lt;/em&gt; possible to have a signal output larger than $y(t_1)$ at time&#xA;$t_1$ by use of a different non-matched filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;does the matched filter maximize the SNR only at the sampling&#xA;instant, or everywhere?&quot; has the answer that the SNR is maximized only&#xA;at the sampling instant $t_0$. At other times, other filters could give &#xA;a larger SNR than what the matched filter is providing at time $t_1$,&#xA;but this still smaller than the SNR $\sqrt{\frac{2\mathbb E}{N_0}}$&#xA;that the matched filter is giving you at $t_0$, and if desired,&#xA;the matched filter could be redesigned to produce its peak at time&#xA;$t_1$ instead of $t_0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;why not make a filter that makes a really tall skinny spike at the point of decision. Wouldn't that make the SNR even better?&quot;&lt;br&gt;&#xA;The matched filter &lt;em&gt;does&lt;/em&gt; produce a spike of sorts at the sampling time&#xA;but it is constrained by the shape of the autocorrelation function. Any&#xA;&lt;em&gt;other&lt;/em&gt; filter that you can devise to produce a tall skinny (time-domain)&#xA;spike is not a matched filter and so will not give you the largest possible&#xA;SNR. Note that &lt;em&gt;increasing the amplitude of the filter impulse response&#xA;(or using a time-varying filter that boosts the gain at the time&#xA;of sampling) does not change the SNR since both the signal and the noise standard deviation increase proportionately.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;The I&amp;amp;D will basically ramp up until it gets to the sampling time and the idea is that one samples at the peak of the I&amp;amp;D because at that point, the SNR is a maximum.&quot;&lt;br&gt;&#xA;For NRZ data and rectangular pulses, the matched filter impulse response is&#xA;also a rectangular pulse. The integrate-and-dump circuit is a &lt;em&gt;correlator&lt;/em&gt;&#xA;whose output equals the matched filter output &lt;strong&gt;only at the sampling instants&lt;/strong&gt;, and not in-between.  See the figure below.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/91iAr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sample the correlator output at other times,&#xA;you get noise with smaller variance but you can't simply add up the samples&#xA;of I&amp;amp;D output taken at different times because the noise variables are highly correlated, and&#xA;the net variance works out to be much larger.  Nor should you expect to be able&#xA;to take multiple samples from the matched filter output and combine them&#xA;in any way to get a better SNR.  &lt;strong&gt;It doesn't work.&lt;/strong&gt; What you have in effect&#xA;is a &lt;em&gt;different&lt;/em&gt; filter, and you cannot do better than the (linear)&#xA;matched filter in Gaussian noise; no nonlinear processing  will give&#xA;a smaller error probability than the matched fiter.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2017-12-26T20:43:47.890" LastActivityDate="2017-12-26T20:43:47.890" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9390" PostTypeId="2" ParentId="9365" CreationDate="2013-06-02T02:38:46.483" Score="2" Body="&lt;p&gt;Vidak gives an excellent answer to your question #1, so I will just deal with #2.  No, a high pass filter is not simply 1 - LPF.  The reason why is that there is magnitude response and there is phase response.  Although &quot;1&quot; and &quot;LPF&quot; do have the same magnitude response at the pass-band frequencies (1), they do not necessarily have the same phase response, so they could constructively or destructively interfere with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to create a high-pass filter is to create a low-pass filter and then modulate it to the Nyquist frequency by multiplying it with a sinusoid whose frequency is the Nyquist frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create a band-pass filter by the same method.  Create a low-pass filter and then modulate it to the band-pass center frequency that you want.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-06-02T02:38:46.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9391" PostTypeId="1" CreationDate="2013-06-02T07:41:03.930" Score="-2" ViewCount="169" Body="&lt;p&gt;Do you guys know good DSP related websited and blog posts?&#xA;I know that for example there is this site called &lt;strong&gt;&lt;a href=&quot;http://www.minutify.com&quot; rel=&quot;nofollow&quot;&gt;Minutify&lt;/a&gt;&lt;/strong&gt;:&#xA;&lt;a href=&quot;http://www.minutify.com&quot; rel=&quot;nofollow&quot;&gt;http://www.minutify.com&lt;/a&gt;&#xA;which is blog posts regarding all areas of electrical engineering including DSP.&#xA;Do you guys know of similar resources?&lt;/p&gt;&#xA;" OwnerUserId="1636" LastActivityDate="2013-06-02T14:28:11.540" Title="DSP related websites and blog posts" Tags="|filters|discrete-signals|dsp-core|" AnswerCount="1" CommentCount="4" ClosedDate="2013-06-02T14:32:27.970" ContentLicense="CC BY-SA 3.0" />
  <row Id="9392" PostTypeId="1" CreationDate="2013-06-02T08:11:48.243" Score="0" ViewCount="90" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I am working to identify and isolate each human limb of a known person, in pose, in an image which is relatively noisy.  It should also be noted that the image is a snapshot extracted from a video (which can be utilized in this task).&lt;br&gt;&#xA;The end result ideally would be a bunch of polygon estimates of each body limb segment (i.e. torso, head, neck, upper arm, lower arm, hand, upper leg (thigh), lower leg, and feet/shoe).  I currently have results that allow me to find the contours of the image, though these include materials that are prevalent in the background (i.e. its not a clean image of only a human).  &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Note(s)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;1). I am currently using opencv to implement the task, so any answers that can be directed towards that API are greatly appreciated, though I will happily accept any general solutions that answer the question.&#xA;2). If you feel the question is lacking in clarity, please comment as to why.  I truly feel this question would add value to the community if answered completely.  &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;How can I create polygon estimates of each body part/limb that is present in an image which always contains one person?&lt;/p&gt;&#xA;" OwnerUserId="4714" LastActivityDate="2013-06-02T08:11:48.243" Title="How can I create polygon estimates of each body part/limb that is present in an image which always contains one person?" Tags="|image-processing|computer-vision|opencv|image-segmentation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9393" PostTypeId="2" ParentId="9365" CreationDate="2013-06-02T10:11:34.877" Score="1" Body="&lt;p&gt;You already got two good answers, but I'd like to clarify the point about obtaining the impulse response of a highpass filter given the response of a lowpass filter. In your case (if you take the response suggested in Vidak's answer) the lowpass impulse response is symmetric w.r.t. its maximum value. This implies that the corresponding phase response is linear:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\theta})=A(\theta)e^{-j\theta (N-1)/2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the (odd) filter length (i.e. the number of taps). In (1) it is assumed that the filter is causal and that the first non-zero filter tap is at $n=0$, i.e. the center of symmetry is at $n=(N-1)/2$ for odd $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case you can indeed obtain the response of a highpass filter by a simple subtraction if you take the linear phase response into account:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_{HP}(n)=\delta\left[ n-(N-1)/2\right ]-h_{LP}(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you shift the lowpass filter impulse response to the left such that the center of symmetry is at the point $n=0$ (and the filter taps are non-zero between $n=-(N-1)/2$ and $n=(N-1)/2$) you obtain your original formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_{HP}(n)=1-h_{LP}(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A formula of this type can be applied to all odd-length FIR filters with linear phase.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-03T12:13:52.573" LastActivityDate="2013-06-03T12:13:52.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9394" PostTypeId="2" ParentId="9391" CreationDate="2013-06-02T10:40:19.840" Score="1" Body="&lt;p&gt;If you go to comp.dsp,there is ongoing work on assembling all the dsp related sites and blogs together. It is a comprehensive list of all the available resources on DSP. The link is &lt;a href=&quot;http://www.dsprelated.com/showarticle/195.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showarticle/195.php&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4375" LastActivityDate="2013-06-02T10:40:19.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9395" PostTypeId="1" CreationDate="2013-06-02T10:54:35.007" Score="0" ViewCount="503" Body="&lt;p&gt;@Michael C. Grant wrote that &lt;a href=&quot;https://dsp.stackexchange.com/questions/9267/fft-does-the-result-of-n-log-2n-stand-for-total-operations-or-complex-ad&quot;&gt;&quot;the cost of FFTW isn't an easy formula based on log_2 anymore.&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the Wikipedia article says that the FFTW &quot;can compute transforms of real and complex-valued arrays of arbitrary size and dimension in O(n log n) time.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can it compute 1 forward FFT with the size 1920*1080? in k&lt;em&gt;N&lt;/em&gt;log(N)/log(2) =&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5*1920*1080*log(1920*1080)/log(2)=&#xA;217559066 real operations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should I perphaps take a different value for k?&lt;/p&gt;&#xA;" OwnerUserId="4478" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-06-02T13:08:42.027" Title="Does the 'FFTW' have a cost of k*N*log_2(N)?" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9396" PostTypeId="2" ParentId="9395" CreationDate="2013-06-02T12:36:56.573" Score="2" Body="&lt;p&gt;You are trying to describe a complex phenomenon with a simple formula. That gets you only a rough approximation or an estimate but depending how much accuracy you need, you will have to dive deeper into the specifics. A few points&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Any actual operation count will depend heavily on the hardware: Instruction set, pipeline, memory architecture, cache strategies, hardware accelerators, etc. In many cases the choice of the &quot;best&quot; algorithm is actually hardware dependent. Your best shot here is benchmarking and profiling on the target hardware.&lt;/li&gt;&#xA;&lt;li&gt;The good old N/2*log2(N) formula basically describes the &quot;number of butterfly operation&quot; in a standard Cooley Tuckey FFT. So a 32-point FFT has 16*5 = 80 butterfly operations. There are 5 stages of 16 butterflies each. This is typically (but not always) the bulk of the work so it's a decent estimate for the overall complexity.&lt;/li&gt;&#xA;&lt;li&gt;One butterfly has one complex multiply and two complex adds (or on&#xA;add and one subtract if you are picky about). The number of operations required will depend widely on the Hardware. An Analog Devices Sharc SIMD processor can do this with about 3 operations, an general purpose processor might take up to 20 operations.&lt;/li&gt;&#xA;&lt;li&gt;There is a lot of other stuff that isn't part of the butterflies: bit-reversing, looping &amp;amp; branching, coefficient calculation storage and retrieval. These can factor heavily into your MIPS count as well and are even more hardware dependent.&lt;/li&gt;&#xA;&lt;li&gt;The first two stages (for decimation in time) use only simple coefficients like +1, -1, +j, -j and don't need a full complex multiply. Most algorithms take advantage of this and so the first 2*log2(N) butterflies are a little cheaper. By how much depends again on the hardware.&lt;/li&gt;&#xA;&lt;li&gt;Non power of two FFTs get more complicated. Let's look at a 96 point FFT. First you need 3 FFTs of 32 points each, so that is 3*5*16 = 240 butterflies. Then you need to assemble the result which takes 2 complex multiplies and 2 complex adds per sample, so it's another 96*2=192 extra complex multiplies and 192 complex adds. Total would be 432 mpy and 672 adds. A 128 FFT would have 448 mpy and 896 adds, so it may be better just to zero pad and use the larger power-of-two FFT as it greatly simplifies coefficient calculation and storage.&lt;/li&gt;&#xA;&lt;li&gt;The more prime factors you have in the FFT length the more complicated and less efficient the algorithm gets. &lt;/li&gt;&#xA;&lt;li&gt;In your specific case, I'd zero pad the 1920 to 2048 (unless you need true circular convolution, which I don't believe you do here). It's highly unlikely that any prime factorization (128*3*5) would do better. The 1080 is awkward, since it's just a tad over 1024. I'd probably zero pad to 1280 and do a 256*5 or zero pad to 1152 and do 128*9. You can also try the 8*27*5 and see if that's better.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-02T12:36:56.573" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9397" PostTypeId="1" AcceptedAnswerId="9398" CreationDate="2013-06-02T12:44:46.103" Score="1" ViewCount="135" Body="&lt;p&gt;In the filter graph below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6VanC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;where circle with 'X' inside is a multiplication&lt;/li&gt;&#xA;&lt;li&gt;circle with 'Σ' inside addition&lt;/li&gt;&#xA;&lt;li&gt;and the triangle is a delay element&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What could be the values x(k) in this type of filter? There is a rule? There is a range? I can understand the matrix of coefficients but i don't know about the x(k) values.&lt;/p&gt;&#xA;" OwnerUserId="4273" LastActivityDate="2013-06-03T13:51:26.160" Title="Direct Form 2 IIR filter input values" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9398" PostTypeId="2" ParentId="9397" CreationDate="2013-06-02T12:59:18.743" Score="1" Body="&lt;p&gt;$x[k]$ is the input signal to the filter; it could be anything. There is no &quot;rule&quot; for what signal you can input to a linear filter. With that said, the stability of filters is usually talked about in a &lt;a href=&quot;http://en.wikipedia.org/wiki/BIBO_stability&quot; rel=&quot;nofollow&quot;&gt;bounded-in, bounded-out (BIBO)&lt;/a&gt; sense. If the input signal is unbounded, then it's likely that the output signal will be also. So if anything, the &quot;rule&quot; that you're looking for would be to only apply signals $x[k]$ whose magnitude $|x[k]|$ is bounded below some value $B &amp;lt; \infty$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-06-03T13:51:26.160" LastActivityDate="2013-06-03T13:51:26.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9399" PostTypeId="2" ParentId="9395" CreationDate="2013-06-02T13:08:42.027" Score="1" Body="&lt;p&gt;You're confusing two somewhat related but different concepts: &lt;em&gt;cost&lt;/em&gt; and &lt;em&gt;complexity&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Cost is a way of expressing the total number of computations to perform a particular transform. For the Cooley-Tukey FFT, this is often quoted as $5N \log N$ scalar operations (real multiplies and additions). This is a pretty straightforward idea.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Complexity (using &lt;a href=&quot;http://en.wikipedia.org/wiki/Big_O_notation&quot; rel=&quot;nofollow&quot;&gt;big-O notation&lt;/a&gt;) refers to how the algorithm scales asymptotically as you increase the transform length $N$. It doesn't attempt to give an exact operation count for any particular transform size; it just can be used to compare two different implementations of an algorithm to see how they will scale for larger datasets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Consider an algorithm that is $O(N \log N)$. Consider two different transform lengths: $N_1 = 2^{16}$ and $N_2 = 2^{24}$. Using the known complexity of the algorithm, we can estimate how the costs for the two transform lengths relate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{\text{cost}(N_2)}{\text{cost}(N_1)} \approx \frac{N_2 \log N_2}{N_1 \log N_1} = \frac{N_2}{N_1} \log(N_2 - N_1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, this doesn't tell us the exact cost for either transform length; instead, it just gives us a feel for approximately how much more costly it would be as one increases the algorithm's working set.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-06-02T13:08:42.027" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9401" PostTypeId="1" CreationDate="2013-06-02T14:52:28.010" Score="0" ViewCount="629" Body="&lt;p&gt;If you want to compute a convolution with a DFT/FFT, you will have to do a DFT on the image and a DFT on the kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you will need to multiply the spectrum of the image with the spectrum of the kernel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it correct that the  multiplications in the fourier domain are complex multiplications? So, that those point-wise multiplications will require 4 real multiplications and 2 real additions?&lt;/p&gt;&#xA;" OwnerUserId="4478" LastActivityDate="2013-10-25T16:39:53.920" Title="Are the DFT/FFT multiplications in the fourier domain complex multiplications?" Tags="|fft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9402" PostTypeId="1" CreationDate="2013-06-02T15:01:30.957" Score="-2" ViewCount="130" Body="&lt;p&gt;I was reading a &lt;a href=&quot;http://research.microsoft.com/pubs/119050/PASTE-sigmod10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; related to privacy where they perform fourier transformation of a time series data and retain few coefficients of the FFT. Then they apply some noise to these coefficients. These noisy coefficients are zero padded. Finally inverse DFT is applied to obtain the original data which is not exactly equal to the original since noise is added plus some of the coefficients are removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to start with something simple. I took number N=1:100. I applied DFT to these numbers and got the coefficients. I removed the last 50 coefficients and replaced them with zeros. Then I took the inverse DFT of it and tried to reconstruct the original signal of 1:100. However I got something like this &lt;/p&gt;&#xA;&#xA;&lt;p&gt;26.5000000000000 + 64.2447047766005i    25.5019732715717 + 32.4869793423559i    27.4940879728862 + 32.3616461087916i    26.5118007221575 + 21.9701324299717i    28.4803838832861 + 21.7214425428068i    27.5293273669910 + 15.7167080225067i    29.4591038528792 + 15.3485834698221i and so on&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is no where close to my original signal of 1,2,3, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached the algorithm from the paper below. I am first trying with something simple. I am not adding the noise using LPA algorithm as said in the algorithm. I am just apply DFT, selecting first 50 coefficients padding them by zeros. Then I applied Inverse DFT to try to reconstruct the original signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lVhEW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4717" LastActivityDate="2013-06-02T15:35:25.543" Title="Confusion related to DFT in a paper" Tags="|fourier-transform|" AnswerCount="1" CommentCount="4" ClosedDate="2013-06-05T03:48:57.367" ContentLicense="CC BY-SA 3.0" />
  <row Id="9403" PostTypeId="1" CreationDate="2013-06-01T22:40:14.387" Score="3" ViewCount="2743" Body="&lt;p&gt;I've built a simple device, which sends readings from a &lt;a href=&quot;http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1&quot; rel=&quot;nofollow noreferrer&quot;&gt;pulse sensor&lt;/a&gt; to a PC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get these &lt;a href=&quot;https://dl.dropboxusercontent.com/u/11776689/2013_06_02_pulse_sensor_data.ods&quot; rel=&quot;nofollow noreferrer&quot;&gt;data&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jEPNr.png&quot; alt=&quot;Pulse sensor data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What technique or algorithm can I use in order to calculate the pulse rate (beats per minute) from these data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 1 (03.06.2013 21:01 MSK):&lt;/strong&gt; The time series represents my heart beat during approx. 3 minutes. According to &lt;a href=&quot;http://en.wikipedia.org/wiki/Pulse#Normal_pulse_rates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, adults have a pulse rate &lt;strong&gt;between 60 and 100&lt;/strong&gt; beats per minute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2 (09.06.2013 23:53 MSK):&lt;/strong&gt; &lt;a href=&quot;https://dl.dropboxusercontent.com/u/11776689/2013_06_09_pulse/2013_06_09_pulse_sensor_data1.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; you can find signal values, which were measured 1000 times per second during approx. 5 minutes.&lt;/p&gt;&#xA;" OwnerUserId="4722" OwnerDisplayName="Dmitri Pisarenko" LastEditorUserId="29" LastEditDate="2013-06-20T16:12:52.573" LastActivityDate="2013-06-20T16:12:52.573" Title="How to convert raw pulse sensor data into actual pulse?" Tags="|signal-analysis|measurement|" AnswerCount="0" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="9404" PostTypeId="2" ParentId="9402" CreationDate="2013-06-02T15:35:25.543" Score="1" Body="&lt;p&gt;From your question, it seems that what you are doing is the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take FFT of real input of size 100.&lt;/li&gt;&#xA;&lt;li&gt;Truncate coefficients 51 to 100 (using one-based indexing).&lt;/li&gt;&#xA;&lt;li&gt;Take IFFT.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Unless you are using FFT functions specifically designed for real input and output (such as &lt;code&gt;numpy.fft.rfft&lt;/code&gt; and &lt;code&gt;numpy.fft.irfft&lt;/code&gt; in numpy), this is incorrect because you are affecting the bins corresponding to negative frequencies, which should kept symmetric with the corresponding positive frequency bins if you want your IDFT output to be real. With matlab or octave, the correct way to do this truncation would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = fft(x)&#xA;X(26:76) = 0;&#xA;result = ifft(X);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this zeroes 51 coefficients - this number will have to be odd if you want to preserve symmetry (and thus keep the result real). Also, note that if you alter the other coefficients, you have to make sure that coefficients 100 to 77 are always the conjugate of coefficients 2:25 for the result to be real. For example :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = fft(x)&#xA;X(26:76) = 0;&#xA;X(2:25) = X(2:25) + randn(24, 1) / 10;&#xA;X(77:100) = conj(flipud(X(2:25)));&#xA;result = ifft(X);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-02T15:35:25.543" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9405" PostTypeId="2" ParentId="471" CreationDate="2013-06-02T15:51:42.300" Score="2" Body="&lt;p&gt;The one that has just started and is good for not only signal processing but also other fields of electrical engineering is &lt;a href=&quot;http://www.minutify.com&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Minutify&lt;/strong&gt;&lt;/a&gt;.&#xA;The link to the website is: &lt;a href=&quot;http://www.minutify.com&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;http:www.munitify.com&lt;/strong&gt;&lt;/a&gt;&#xA;The sections on this website/blog are: &lt;strong&gt;DSP&lt;/strong&gt;, &lt;strong&gt;Communications&lt;/strong&gt;, &lt;strong&gt;Analog&lt;/strong&gt;, &lt;strong&gt;RF&lt;/strong&gt;, &lt;strong&gt;ASIC&lt;/strong&gt; and looks like each article is written by an expert in his/her field.&lt;/p&gt;&#xA;" OwnerUserId="1636" LastActivityDate="2013-06-02T15:51:42.300" CommentCount="0" CommunityOwnedDate="2013-06-02T15:51:42.300" ContentLicense="CC BY-SA 3.0" />
  <row Id="9406" PostTypeId="1" CreationDate="2013-06-02T17:14:37.760" Score="0" ViewCount="728" Body="&lt;p&gt;Someone wrote &quot;The algorithm that Cooley and Tukey presented in their classic paper (Math. Comp. 19 (1965), 297-301. &lt;a href=&quot;http://dx.doi.org/10.1090/S0025-5718-1965-0178586-1&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1090/S0025-5718-1965-0178586-1&lt;/a&gt;) can be applied to any composite length.  The performance advantages are greatest for highly composite lengths, of which powers-of-2 are one example, and lengths of powers-of-2 result in other advantages on binary computers, so &lt;strong&gt;it has become a common misconception that the algorithm is only applicable to signals whose length is a power of 2&lt;/strong&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that mean that when you &lt;strong&gt;DO use the Cooley-Tukey FFT&lt;/strong&gt; You don't have to zeropad to a power of 2?&#xA;Take for example an image of 1920x1080. So, if you want to use the Cooley-Tukey FFT, you don't need to zeropad that to 2048*2048?&lt;/p&gt;&#xA;" OwnerUserId="4478" LastEditorUserId="4478" LastEditDate="2013-06-02T19:14:28.530" LastActivityDate="2013-06-03T09:21:56.683" Title="Cooley-Tukey FFT: You don't have to zeropad to a power of 2?" Tags="|fft|" AnswerCount="2" CommentCount="5" ClosedDate="2013-06-08T15:21:29.783" ContentLicense="CC BY-SA 3.0" />
  <row Id="9407" PostTypeId="2" ParentId="9406" CreationDate="2013-06-02T18:02:55.727" Score="1" Body="&lt;p&gt;Yes.  If you can factor length N, Cooley-Tukey will give you an DFT computation that uses less multiplies than an unfactored DFT.  A power of 2 factorization requires less lines of text or shorter equations to explain.  But any small prime factors allows a straight forward extension to the power-of-2 explanation or proof of the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many newer FFT libraries (iOS Accelerate for one example) allow efficient composite FFT lengths with factors of 2,3,5 and maybe more, thus requiring less padding to get to the next useful composite length.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-06-02T18:09:11.110" LastActivityDate="2013-06-02T18:09:11.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9408" PostTypeId="1" AcceptedAnswerId="9413" CreationDate="2013-06-02T19:03:58.927" Score="21" ViewCount="58643" Body="&lt;p&gt;I know there are 4 types of FIR filters with linear phase, i.e. constant group delay: (M = length of impulse response)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Impulse response symmetrical, M = odd&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Imp. resp. symmetrical, M = even&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Imp. resp. anti-symmetrical, M = odd&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Imp. resp. anti-symmetrical, M = even&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;each with its traits. Which of these types is most commonly used in FIR filter with linear phase design and why? :)&lt;/p&gt;&#xA;" OwnerUserId="4710" LastActivityDate="2023-07-12T15:10:41.603" Title="FIR filter with linear phase, 4 types" Tags="|filters|filter-design|finite-impulse-response|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9409" PostTypeId="2" ParentId="9408" CreationDate="2013-06-02T23:39:30.587" Score="5" Body="&lt;p&gt;The filters with anti-symmetrical impulse response all have a zero at $z=1$ (i.e. frequency 0). So if you need to implement a high-pass filter or derivative-like filter (or even band-pass), then you must go for types 3 and 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, if your filter is a low-pass type, then types 1 and 2 apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this depends on the type of filter you need to design, and not on which is more common.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, there is also a difference between types 1 and 3 vs. 2 and 4 in terms of phase response. There will be a extra $e^{j\theta/2}$ between the two types. Even if you don't care about the actual delay introduced, this half-sample difference can be important in terms of convergence in some cases of high-pass filters (the extra phase can make your frequency response continuous at $\theta = \pi$, therefore providing much faster convergence and a need for fewer coefficients).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of implementation, all of the 4 types can be implemented efficiently without repeating the same coefficients twice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need, of course, the whole M-sized delay line. But instead of multiplying each of the tap outputs by its own coefficient, you first add (or subtract) the two corresponding outputs and then multiply only once by the coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if impulse response is $h[n] = a \delta[n] + b \delta[n-1] + a \delta[n-2]$ (type 1 filter), instead of implementing $y[n] = a x[n] + b x[n-1] + a x[n-2]$, you make it $y[n] = a (x[n] + x[n-2]) + b x[n-1]$.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2013-06-02T23:39:30.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9413" PostTypeId="2" ParentId="9408" CreationDate="2013-06-03T08:19:55.893" Score="33" Body="&lt;p&gt;When choosing one of these 4 types of linear phase filters there are mainly 3 things to consider:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;constraints on the zeros of &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$z=1$&lt;/span&gt; (DC) and &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt; (Nyquist)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;integer/half-integer group delay&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;phase shift (apart from the linear phase)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Type I&lt;/strong&gt; filters (odd number of taps, even symmetry) have no constraints on the zeros at &lt;span class=&quot;math-container&quot;&gt;$z=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt;, the phase shift is zero (apart from the linear phase), and the group delay is an integer value.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Type II&lt;/strong&gt; filters (even number of taps, even symmetry) always have a zero at &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt; (Nyquist), they have a zero phase shift, and their group delay is a half-integer.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Type III&lt;/strong&gt; filters (odd number of taps, odd symmetry) always have zeros at &lt;span class=&quot;math-container&quot;&gt;$z=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt; (i.e., at DC &lt;em&gt;and&lt;/em&gt; Nyquist), they have a 90 degrees phase shift and an integer group delay.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Type IV&lt;/strong&gt; filters (even number of taps, odd symmetry) always have a zero at &lt;span class=&quot;math-container&quot;&gt;$z=1$&lt;/span&gt; (DC), a phase shift of 90 degrees, and a half-integer group delay.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This implies (among other things) the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Type I filters are pretty universal, but they cannot be used whenever a 90 degrees phase shift is necessary, e.g. for differentiators or Hilbert transformers.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Type II filters would normally not be used for high pass or band stop filters, due to the zero at &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt;, i.e. at &lt;span class=&quot;math-container&quot;&gt;$f=f_s/2$&lt;/span&gt;. Neither can they be used for applications where a 90 degrees phase shift is necessary.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Type III filters cannot be used for standard frequency selective filters because in these cases the 90 degrees phase shift is usually undesirable. For Hilbert transformers, type III filters have a relatively bad magnitude approximation at very low and very high frequencies due to the zeros at &lt;span class=&quot;math-container&quot;&gt;$z=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt;. On the other hand, a type III Hilbert transformer can be implemented more efficiently than a type IV Hilbert transformer because for the type III Hilbert transformer every other tap is zero.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Type IV filters cannot be used for standard frequency selective filters, for the same reasons as type III filters. They are well suited for differentiators and Hilbert transformers, and their magnitude approximation is usually better because, unlike type III filters, they have no zero at &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In some applications an integer group delay is desirable. In these cases type I or type III filters are preferred.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2023-05-07T18:16:41.747" LastActivityDate="2023-05-07T18:16:41.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9414" PostTypeId="1" CreationDate="2013-06-03T08:51:49.050" Score="1" ViewCount="1754" Body="&lt;p&gt;The wavelet transform informs  what all derived wavelets (from mother wavelets) with different scales at different point of time , are present  (along with the associated strength) in my original signal.  I am not able to understand how do I now correlate it with FFT that simply gives what all sine and cosine waves are present. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now how do I make use of this information that I get from WT? I cannot say unlike as in case of FFT or STFT &quot; we have a 100hz frequency in the window of 4 seconds&quot;. I will have to say &quot;we have a db4 wavelet present  in some window&quot;. How it will make sense. How do I interpret this in a meaningful way?   &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2013-06-03T22:27:37.543" Title="Interpreting Coefficients from wavelet" Tags="|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9415" PostTypeId="2" ParentId="9406" CreationDate="2013-06-03T09:21:56.683" Score="0" Body="&lt;p&gt;According to the algorithm you can find the fft of input length which is a power of something (i.e 2^n). Because it becomes easier to combine in the end all the signals to get the final fft output. But however, there are algorithms available like radix2,radix3, radix4, which can be effectively combined to get ffts of different input lengths which are power of something. Zero padding can be way to extend your length to the input length of power of something and then apply the algorithm, but I won't suggest it because it will somehow deteriorate the frequency spectrum to some extent.&lt;/p&gt;&#xA;" OwnerUserId="3993" LastActivityDate="2013-06-03T09:21:56.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9416" PostTypeId="2" ParentId="9408" CreationDate="2013-06-03T11:10:13.533" Score="5" Body="&lt;p&gt;Since there already are two very nice answers, I will give some very basic examples from which the properties given in the other answers can be sanity checked against. Zero locations and phase responses are directly available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;symmetrical, M=odd&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = 1\pm2z^{-1}+z^{-2} = (1\pm z^{-1})^2 \\&#xA;H(e^{j\omega}) = (1\pm e^{-j\omega})^2 = (e^{-j\omega/2}(e^{j\omega/2}\pm e^{-j\omega/2}))^2 = e^{-j\omega}(e^{j\omega/2}\pm e^{-j\omega/2})^2 = 4e^{-j\omega}\cos^2(\omega/2) \quad or \quad -4e^{-j\omega}\sin^2(\omega/2) = 4e^{-j(\omega-\pi)}\sin^2(\omega/2)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = 1+z^{-2} = (1 + jz^{-1})(1 - jz^{-1}) \\&#xA;H(e^{j\omega}) = (1 + e^{-j2\omega}) = e^{-j\omega}(e^{j\omega} + e^{-j\omega}) = 2e^{-j\omega}\cos(\omega)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;symmetrical, M=even&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = 1 + z^{-1}\\&#xA;H(e^{j\omega}) = (1 + e^{-j\omega}) = e^{-j\omega/2}(e^{j\omega/2} + e^{-j\omega/2}) = 2e^{-j\omega/2}\cos(\omega/2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = 1 + z^{-3} \\&#xA;H(e^{j\omega}) = (1 + e^{-j3\omega}) = e^{-j3\omega/2}(e^{j3\omega/2} + e^{-j3\omega/2}) = 2e^{-j3\omega/2}\cos(3\omega/2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = 1 + 3z^{-1} + 3z^{-2} + z^{-3} = (1 + z^{-1})^3 = (1-e^{-2\pi/3}z^{-1})(1-e^{2\pi/3}z^{-1})(1+z^{-1})\\&#xA;H(e^{j\omega}) = (1 + e^{-j\omega})^3 = (e^{-j\omega/2}(e^{j\omega/2} + e^{-j\omega/2}))^3 = 8e^{-j3\omega/2}\cos(\omega/2)^3&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;antisymmetrical, M=odd (according to [1], $h[N/2] = 0$ for this case)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = 1 - z^{-2} = (1 + z^{-1})(1 - z^{-1}) \\&#xA;H(e^{j\omega}) = 1 - e^{-j2\omega} = e^{-j\omega}(e^{j\omega} - e^{-j\omega}) = 2je^{-j\omega}\sin(\omega)=2e^{-j(\omega-\pi/2)}\sin(\omega)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;antisymmetrical, M=even&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = 1 - z^{-1} \\&#xA;H(e^{j\omega}) = (1 - e^{-j\omega}) = e^{-j\omega/2}(e^{j\omega/2} - e^{-j\omega/2}) = 2je^{-j\omega/2}\sin(\omega/2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] a good reference &lt;a href=&quot;http://sip.cua.edu/res/docs/courses/ee515/chapter04/ch4-4.pdf&quot; rel=&quot;noreferrer&quot;&gt;mitrappt&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-06-03T11:10:13.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9417" PostTypeId="1" CreationDate="2013-06-02T11:07:56.010" Score="1" ViewCount="350" Body="&lt;p&gt;I have an audio buffer with 1024 samples per second.&#xA;The sample rate is 44100.&#xA;I am trying to identify the frequency tones.&#xA;Using the Gorzel algorithm, I can get the frequency but it's not that accurate.&#xA;I was trying some other scope program and I got better results with the same hardware.&#xA;How can I decrease the id-bandwidth (to be sharper) so the id will be accurate for the target frequency?&#xA;(I can't use FFT because it's real time and takes some memory.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float goertzel_mag(int16_t* data ,int SAMPLING_RATE ,double TARGET_FREQUENCY,int numSamples )&#xA;{&#xA;    int     k,i;&#xA;    float   floatnumSamples;&#xA;    float   omega,sine,cosine,coeff,q0,q1,q2,magnitude,real,imag;&#xA;    float   scalingFactor = numSamples / 2; // -2&#xA;&#xA;    floatnumSamples = (float) numSamples;&#xA;    k = (int) (0.5 + ((floatnumSamples * TARGET_FREQUENCY) / SAMPLING_RATE));&#xA;    omega = (2.0 * M_PI * k) / floatnumSamples;&#xA;    sine = sin(omega);&#xA;    cosine = cos(omega);&#xA;    coeff = 2.0 * cosine;&#xA;    q0=0;&#xA;    q1=0;&#xA;    q2=0;&#xA;&#xA;    for(i=0; i&amp;lt;numSamples; i++)&#xA;    {&#xA;        q0 = coeff * q1 - q2 + data[i];&#xA;        q2 = q1;&#xA;        q1 = q0;&#xA;    }&#xA;&#xA;&#xA;    real = (q1 - q2 * cosine) / scalingFactor;&#xA;    imag = (q2 * sine) / scalingFactor;&#xA;&#xA;    //double theta = atan2 ( imag, real); //PHASE&#xA;    magnitude = sqrtf(real*real + imag*imag);&#xA;    return magnitude;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17182" OwnerDisplayName="Rant" LastEditorUserId="26573" LastEditDate="2018-05-07T15:40:14.477" LastActivityDate="2018-05-07T15:40:14.477" Title="Goerzel algorithm - increasing accuracy" Tags="|frequency|algorithms|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9418" PostTypeId="2" ParentId="9417" CreationDate="2013-06-02T15:15:34.923" Score="1" Body="&lt;p&gt;There are two things you can do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use a different algorithm, like &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow&quot;&gt;autocorrelation&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Use the phase information! This technique is discussed in chapter 9 of &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470665998&quot; rel=&quot;nofollow&quot;&gt;DAFX&lt;/a&gt;. You can find &lt;a href=&quot;http://www2.hsu-hh.de/ant/dafx2002/DAFX_Book_Page_2nd_edition/chapter9.html&quot; rel=&quot;nofollow&quot;&gt;matlab source here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;DAFX discussed the phase-based technique using the FFT, but it &lt;em&gt;should&lt;/em&gt; apply to Goerzel's algorithm as well, assuming you have real data at that frequency. The key concept is that you must note how much the phase changes over time to determine the exact frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to experiment with an FFT of smaller size instead of Goerzel's algorithm to validate the assumptions.&lt;/p&gt;&#xA;" OwnerUserId="1543" OwnerDisplayName="Bjorn Roche" LastActivityDate="2013-06-02T15:15:34.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9419" PostTypeId="2" ParentId="9417" CreationDate="2013-06-03T01:50:58.803" Score="1" Body="&lt;p&gt;The bandwidth of a Goertzel filter is roughly inversely proportional to its length (there are some scalloping effects if the Goertzel length isn't an exact multiple of the resonant frequency's period).  So longer for a more accurate frequency selector.&lt;/p&gt;&#xA;" OwnerUserId="154" OwnerDisplayName="hotpaw2" LastActivityDate="2013-06-03T01:50:58.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9420" PostTypeId="2" ParentId="9401" CreationDate="2013-06-03T12:25:14.617" Score="2" Body="&lt;p&gt;Yes, this is correct - the DFT/FFT of a real signal (for example an image) is not necessarily real; so if you want to compute a convolution through multiplications in the Fourier domain, the coefficients to multiply will be complex numbers; and will thus cost 4 real multiplications and 2 real additions if a naive implementation is used (unless the architecture you are writing code for has hardware support for complex multiplications).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-03T12:25:14.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9421" PostTypeId="1" CreationDate="2013-06-03T12:37:55.710" Score="3" ViewCount="7417" Body="&lt;p&gt;I have seen many times, including in a post on this forum, that it is recommended to have unity gain at DC for a lowpass filter. I would like to now the mathematical explanation.    &lt;/p&gt;&#xA;" OwnerUserId="4159" LastActivityDate="2013-06-07T19:38:58.840" Title="Why do we need to have unity gain at DC for a lowpass filter?" Tags="|lowpass-filter|" AnswerCount="6" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9422" PostTypeId="2" ParentId="9421" CreationDate="2013-06-03T12:54:53.713" Score="5" Body="&lt;p&gt;There is no mathematical explanation and it's typically just a convenience for most applications. If you scale so that it's unity at 0 Hz, unity is also the maximum gain at any other frequency so you are less likely to clip or overdrive something in the signal chain (it's still possible though). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's often based on the assumption or requirement that &quot;frequencies below the cutoff should be unaffected&quot; by a low pass filter. The closest way to get this is to have unity gain at DC.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-03T12:54:53.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9424" PostTypeId="2" ParentId="9421" CreationDate="2013-06-03T14:04:56.557" Score="4" Body="&lt;p&gt;&lt;strong&gt;Maintain Dynamic Range While Avoiding Overflow&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fixed-point processing if your gain is less than 1 than you are losing your dynamic range.  If you do this enough you can go from a nice strong signal at the beginning of your processing to something that is lost in the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if your gain is greater than 1 then you can go from a signal that does not have numerical overflows to one that does.  Overflows are very bad.  Thus, a gain that is as near as possible to 1 is ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Consistent Scale&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maintaining a consistent magnitude scale throughout your processing allows you to look at the samples at any stage of your processing and instantly know if the samples are &quot;large&quot; (i.e. signal present) or &quot;small&quot; (i.e. probably just noise).  If your scaling is not consistent then you can only do that if you know the scale at the point you are looking at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This reason applies to both fixed-point and floating-point processing.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-06-03T20:19:26.953" LastActivityDate="2013-06-03T20:19:26.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9425" PostTypeId="1" AcceptedAnswerId="9487" CreationDate="2013-06-03T03:34:22.767" Score="0" ViewCount="9705" Body="&lt;p&gt;I am implementing a simple LPF in Java.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have problems in choosing the value of ALPHA.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public class LowPassFilter {&#xA;&#xA;    /*&#xA;     * Time smoothing constant for low-pass filter 0 ≤ α ≤ 1 ; a smaller value&#xA;     * basically means more smoothing See:&#xA;     * http://en.wikipedia.org/wiki/Low-pass_filter#Discrete-time_realization&#xA;     */&#xA;    private static final float ALPHA = 0.2f;&#xA;&#xA;    private LowPassFilter() {&#xA;    }&#xA;&#xA;    /**&#xA;     * Filter the given input against the previous values and return a low-pass&#xA;     * filtered result.&#xA;     * &#xA;     * @param input&#xA;     *            float array to smooth.&#xA;     * @param prev&#xA;     *            float array representing the previous values.&#xA;     * @return float array smoothed with a low-pass filter.&#xA;     */&#xA;    public static float[] filter(float[] input, float[] prev) {&#xA;&#xA;        if (input == null || prev == null)&#xA;            throw new NullPointerException(&quot;input and prev float arrays must be non-NULL&quot;);&#xA;        if (input.length != prev.length)&#xA;            throw new IllegalArgumentException(&quot;input and prev must be the same length&quot;);&#xA;&#xA;        for (int i = 0; i &amp;lt; input.length; i++) {&#xA;            prev[i] = prev[i] + ALPHA * (input[i] - prev[i]);&#xA;        }&#xA;&#xA;        return prev;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ALPHA is defined to be dT/(dT+RC), where dT is the event delivering rate and RC is the time-constant of LPF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the value of ALPHA, I need to know the values of dT and RC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My LPF should have a cut-off frequency of 4Hz and the sampling rate is 350Hz.&#xA;Anybody can help determine the proper ALPHA value?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4677" OwnerDisplayName="perfectionming" LastActivityDate="2013-06-06T14:52:38.060" Title="How to determine ALPHA, smoothing constant, of a LPF?" Tags="|java|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9428" PostTypeId="1" AcceptedAnswerId="9430" CreationDate="2013-06-03T18:24:07.443" Score="0" ViewCount="593" Body="&lt;p&gt;I have this confusion. I was reading this &lt;a href=&quot;http://research.microsoft.com/pubs/119050/PASTE-sigmod10.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;. It says &lt;/p&gt;&#xA;&#xA;&lt;p&gt;lets say I have a n dimensional vector X and I take its DFT i.e DFT(X). Then the n Fourier coefficients have the same L2 norm as X. How is it true? I tried on a vector &lt;/p&gt;&#xA;&#xA;&lt;p&gt;X = ones(100,1). Applied DFT to X i.e, DFT(X). But norms are not equal&lt;/p&gt;&#xA;" OwnerUserId="4717" LastActivityDate="2013-06-03T19:12:25.640" Title="Confusion related to norm of dft" Tags="|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9430" PostTypeId="2" ParentId="9428" CreationDate="2013-06-03T18:44:17.843" Score="3" Body="&lt;p&gt;Check the scaling factors used in your DFT/IDFT implementation. There is an arbitrary scaling factor that differs by implementation. Specifically, if you take an input vector $x$ and round-trip it via a DFT followed by an IDFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y = IDFT(DFT(x))&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you may see a couple different results in common implementations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$y = x$&lt;/li&gt;&#xA;&lt;li&gt;$y = Nx$, where $N$ is the transform length&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Other cases that I wouldn't be too surprised to see:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$y = \sqrt{N}x$&lt;/li&gt;&#xA;&lt;li&gt;$y = \frac{1}{N}x$&lt;/li&gt;&#xA;&lt;li&gt;$y = \frac{1}{\sqrt{N}}x$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Which one of these that you see depends on which scaling factors are used in the forward and reverse transforms. If you want the norm of the DFT of $x$ and the norm of $x$ to be the same, then you want the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_unitary_DFT&quot; rel=&quot;nofollow&quot;&gt;unitary DFT&lt;/a&gt; definition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \frac{1}{\sqrt{N}} \sum_{n=0}^{N-1}x[n]e^{\frac{-j2\pi k n}{N}}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-06-03T18:44:17.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9431" PostTypeId="2" ParentId="9428" CreationDate="2013-06-03T19:12:25.640" Score="1" Body="&lt;p&gt;I think the authors refer to &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's theorem&lt;/a&gt;, the DFT version of which is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}|x(n)|^2=\frac{1}{N}\sum_{k=0}^{N-1}|X(k)|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $X(k)$ is the DFT of $x(n)$. So apart from the scaling factor $1/N$ both $x(n)$ and $X(k)$ have the same norm. You should be able to reproduce this result in Matlab or Octave.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-03T19:12:25.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9432" PostTypeId="1" CreationDate="2013-06-03T21:57:18.467" Score="2" ViewCount="2224" Body="&lt;p&gt;I have more general question about the extended Kalman filter usage. What is not clear to me is why the EKF uses non-linear functions $f$ and $h$ for state prediction and estimate, while in other places the Jacobian of these functions is used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the following is never used? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First calculate the linearized state and measurement models at previous estimate point using Jacobian. Use the linearized state transition and measurements matrix everywhere instead of non-linear in this specific iteration. &lt;/p&gt;&#xA;" OwnerUserId="4729" LastEditorUserId="128" LastEditDate="2020-08-11T16:03:42.603" LastActivityDate="2020-08-11T16:03:42.603" Title="Extended Kalman Filter (EKF) Linearization of Non Linear Functions" Tags="|kalman-filters|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9433" PostTypeId="1" AcceptedAnswerId="9442" CreationDate="2013-06-03T22:16:06.710" Score="3" ViewCount="233" Body="&lt;p&gt;For seismological application, I am playing with an elliptical filter, and once I have both sets of feedback and feedforward co-efficients, how do I make it so that I can plot the frequency response of the system? Can I also use the same technique to make the frequency response for a bessel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I can take the FFT for an FIR filter and I can get its transfer function, but for a non-FIR, is there a way also using the FFT? &lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="1329" LastEditDate="2013-06-03T22:23:29.157" LastActivityDate="2013-06-04T07:27:33.870" Title="Frequency response of system with feedback and feedforward co-efficients?" Tags="|filters|frequency-spectrum|frequency-response|linear-systems|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9434" PostTypeId="2" ParentId="9414" CreationDate="2013-06-03T22:27:37.543" Score="2" Body="&lt;p&gt;Wavelets are used for time-scale, or time-frequency, analysis, just like STFT. You can map the coefficients of CWT to frequencies through the center frequency of the wavelet. See for example &lt;a href=&quot;http://www.mathworks.se/help/wavelet/ref/scal2frq.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.se/help/wavelet/ref/scal2frq.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4730" LastActivityDate="2013-06-03T22:27:37.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9435" PostTypeId="1" CreationDate="2013-06-04T01:10:07.453" Score="0" ViewCount="54" Body="&lt;p&gt;I am watching the following video on software defined radio and at the beginning the narrator points out some &quot;whistlers&quot; on the spectrum display and says maybe they are caused by an &quot;annason&quot;. He goes on to say that he knows &quot;commercial annasons scan at a slower rate than the whistlers&quot;. What is an &quot;annason&quot;. I don't know the spelling because it is verbal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=ZuRcaxpbYCw&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=ZuRcaxpbYCw&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4731" LastActivityDate="2013-06-08T15:16:50.437" Title="What is an &quot;annason&quot; (VLF whistler)?" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9436" PostTypeId="2" ParentId="9435" CreationDate="2013-06-04T01:42:23.357" Score="4" Body="&lt;p&gt;I figured out the answer. It is an &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Ionosonde&quot; rel=&quot;nofollow&quot;&gt;ionosondes&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="4731" LastEditorUserId="80" LastEditDate="2013-06-08T15:16:50.437" LastActivityDate="2013-06-08T15:16:50.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9437" PostTypeId="2" ParentId="9433" CreationDate="2013-06-04T01:44:18.723" Score="2" Body="&lt;p&gt;This is covered in pretty much every text book on digital signal processing. Try &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/&lt;/a&gt; or &lt;a href=&quot;http://www.eas.uccs.edu/wickert/ece2610/lecture_notes/ece2610_chap8.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.eas.uccs.edu/wickert/ece2610/lecture_notes/ece2610_chap8.pdf&lt;/a&gt; for starters.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-04T01:44:18.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9439" PostTypeId="1" CreationDate="2013-06-02T23:58:29.333" Score="1" ViewCount="916" Body="&lt;p&gt;The frequency domain is allegedly preferred because it replaces convolution of complexity $n^2$ with a diagonal matrix multiplication. Yet, I see that in z-domain we have multiplication of polynomials, $(a_0z+a_1z^{-1}+a_2z^{-2}+\ldots)(b_0z+b_1z^{-1}+b_2z^{-2}+\ldots)$, which is, despite its name, is nothing more than convolution with $n^2$ operations: you need multiply one polynomial with every term of the other and combine the terms. This looks like square convolution matrix rather than diagonal one. What is the benefit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this regards, I recalled my old question: why nobody speaks about eigenfunctions of the s- and z-domains? Everybody speaks that transfer function is linear and diagonal in the frequency (s- and z-domains). But, when you speak about linear operators, you must bring up their natural basis, especially when speak about diagonalization. How do eigenvectors look like in the Laplace and z-domain? What is the basis of this domain? Might be you do not need to &lt;a href=&quot;https://math.stackexchange.com/questions/377496/why-matrix-representation-of-convolution-cannot-explain-the-convolution-theorem&quot;&gt;prove the convolution theorem&lt;/a&gt; then?&lt;/p&gt;&#xA;" OwnerUserId="4701" OwnerDisplayName="Val" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-11-01T21:50:07.847" Title="z-space replaces multiplication with convolution and frequency eigenvectors" Tags="|convolution|transfer-function|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9440" PostTypeId="1" CreationDate="2013-06-04T05:57:54.327" Score="1" ViewCount="59" Body="&lt;p&gt;I am working in digital image restoration field, recently i am studying a paper &lt;strong&gt;Blur-Kernel Estimation from Spectral Irregularities&lt;/strong&gt;, in this paper i have got some terms, which i am unable to understand, can anyone please provide me specific description of these terms. [i have already google it, but i didn't get satisfactory answer]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;four-point Laplacian filter&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Wiener−Khinchin theorem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Power Spectrum of an image&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;autocorrelation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fourier slice theorem&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4444" LastActivityDate="2013-06-04T05:57:54.327" Title="what is the meaning of these terms" Tags="|image-processing|" AnswerCount="0" CommentCount="2" ClosedDate="2013-06-05T03:18:23.343" ContentLicense="CC BY-SA 3.0" />
  <row Id="9441" PostTypeId="1" AcceptedAnswerId="9444" CreationDate="2013-06-04T07:10:27.463" Score="2" ViewCount="1675" Body="&lt;p&gt;What does it mean by leakage in case of digital filters? My specific question is about the frequency domain adaptive filter function provided in the Matlab DSP toolkit, accessed as adaptfilt.fdaf. It has a parameter called LEAKAGE, but I am not sure what exactly does it represent or how it affects the filter response.&lt;br&gt;&#xA;The filter created as h = adaptfilt.fdaf can be used as&lt;br&gt;&#xA;[y, e] = filter(h, x, d)&lt;br&gt;&#xA;which filters the data in x. Studying the source code of the filter function provided shows how leakage has been used, but the theory on which this filter function is based does not include the leakage component. What does it do and why is it there, if the paper on which this function is based does not have it?&lt;/p&gt;&#xA;" OwnerUserId="3121" LastActivityDate="2013-06-04T09:09:29.813" Title="What is leakage in frequency domain adaptive filters?" Tags="|matlab|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9442" PostTypeId="2" ParentId="9433" CreationDate="2013-06-04T07:27:33.870" Score="3" Body="&lt;p&gt;Yes, you can always use the FFT to compute the frequency response of a discrete-time system at discrete frequencies. For an IIR filter you get the following transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{\sum_{m=0}^{M}b_mz^{-m}}{\sum_{n=0}^{N}a_nz^{-n}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, $a_0$ is normalized to 1. In order to evaluate $H(z)$ on the unit circle $z=e^{j\theta}$ you can compute the FFTs of the numerator and of the denominator of (1) separately and then divide to get the frequency response of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use Matlab or Octave, you can simply use the command &lt;a href=&quot;http://www.mathworks.nl/help/signal/ref/freqz.html&quot; rel=&quot;nofollow&quot;&gt;$\tt{freqz}$&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-04T07:27:33.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9443" PostTypeId="1" CreationDate="2013-06-04T07:31:11.283" Score="1" ViewCount="25" Body="&lt;p&gt;I'm trying to do global registration algorithm for panorama like described &#xA;&lt;a href=&quot;http://scien.stanford.edu/pages/labsite/2000/ee368/projects2000/project13/global.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. But I don't understand how they deal with false pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if expand the system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;u1*I*P1=u1*I =&gt; P1=I&lt;/p&gt;&#xA;&#xA;&lt;p&gt;u2*I*P2=u2*A21*P1 =&gt;P2=A21*P1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;u(i) coefficients are reduced? Or I interpret system of equations wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dmSsR.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1781" LastActivityDate="2013-06-04T07:31:11.283" Title="Panorama global registration" Tags="|linear-systems|linear-algebra|stitching|panorama|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9444" PostTypeId="2" ParentId="9441" CreationDate="2013-06-04T09:09:29.813" Score="3" Body="&lt;p&gt;In adaptive filtering, leakage is a stabilization method which may be useful if the covariance matrix is close to singular (i.e. at least one of the eigenvalues is very small), or if there are finite-precision effects in the implementation of the adaptive filter. Leakage changes the update formula such that not only the mean squared error but also the norm of the filter taps is minimized. This prevents unbounded growth of the filter coefficients in cases of numerical ill-conditioning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For you this simply means that you initially use a leakage factor of 1 (i.e. no leakage) if the FDAF works properly with your input signals. If you encounter coefficient drift (large fluctuation about the optimum solution), you can start by slightly decreasing the leakage factor until the coefficient fluctuation becomes sufficiently small. Note that leakage achieves stabilization at the expense of performance degradation because due to the changed update formula it introduces some bias in the filter taps.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-04T09:09:29.813" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9445" PostTypeId="1" AcceptedAnswerId="9449" CreationDate="2013-06-04T10:23:57.793" Score="0" ViewCount="9648" Body="&lt;p&gt;I try to work out the simplest system, whose response is $H(z) = 1 + cz + c^2z^2 + c^3z^3 + \cdots = 1 / (1-cz)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;a href=&quot;http://fgiesen.wordpress.com/2012/08/26/z-transform-done-quick/&quot; rel=&quot;nofollow&quot;&gt;Z-transform done quick (Fourier connection)&lt;/a&gt; and &lt;a href=&quot;http://dea.brunel.ac.uk/cmsp/Home_Saeed_Vaseghi/Chapter04-Z-Transform.pdf&quot; rel=&quot;nofollow&quot;&gt;4.5 Transfer Function, Poles and Zeros&lt;/a&gt; say that we just need to plug $z =&amp;gt; e^{iw}$ to get the frequency response. I am getting single pole at $w = i \ln c$. It is complex. What is the frequency response? The second link says that real coefficients must generate complex poles in pairs. Where is the second pair?&lt;/p&gt;&#xA;" OwnerUserId="4701" LastActivityDate="2013-06-04T13:44:24.040" Title="what is the frequency response?" Tags="|frequency-response|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9446" PostTypeId="2" ParentId="9445" CreationDate="2013-06-04T10:33:30.403" Score="2" Body="&lt;p&gt;You need to evaluate $H(z)$ on the unit circle $z=e^{iw}$ in order to get the frequency response (assuming that the system is stable, i.e. the region of convergence contains the unit circle). But your $\mathcal{Z}$-transform looks a bit unusual because for causal signals (or filter impulse responses) you should get negative powers of $z$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\sum_{n=0}^{\infty}x(n)z^{-n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case $x(n)=c^n$, $n\ge 0$, so you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{1-cz^{-1}}=\frac{z}{z-c}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) you see that the pole is at $z_{\infty}=c$. Note that you need to determine the poles of $H(z)$ for general $z$, not on the unit circle $z=e^{iw}$ because stable systems cannot have poles on the unit circle (this is also why you got a complex frequency, which does not make sense). The frequency response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{iw})=\frac{1}{1-ce^{-iw}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is true that for real filter coefficients you get complex conjugate pairs of poles and zeros. But this is not the whole truth. You can also get real-valued poles and zeros, and for a first-order system like yours, this must be the case. You need at least a second-order system to get a complex pole pair. In your case you simply got one real pole (assuming that $c$ is a real-valued constant).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-04T10:42:03.580" LastActivityDate="2013-06-04T10:42:03.580" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9447" PostTypeId="2" ParentId="9421" CreationDate="2013-06-04T10:37:16.653" Score="0" Body="&lt;p&gt;Low-pass means that low frequencies are not affected while high spectrum is supressed. This is what &lt;strong&gt;&quot;pass&quot;&lt;/strong&gt; stands for. If you change its amplitude, the pass will be not exact. Right? The issue of clipping is also important, as others pointed out. But, I do not believe that it is a primary. Because, your filter may half the low-frequency signal and clipping is not and issue here. Nevertheless, normalization is performed always, as you say. So, there is another reason.&lt;/p&gt;&#xA;" OwnerUserId="4701" LastActivityDate="2013-06-04T10:37:16.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9448" PostTypeId="2" ParentId="1676" CreationDate="2013-06-04T12:24:15.410" Score="5" Body="&lt;p&gt;&quot;As a cheap alternative, one can simply pretend that the data points &lt;em&gt;are&lt;/em&gt;&#xA;equally spaced ...&lt;br&gt;&#xA;if the change in $f$ across the full width of the $N$ point window&#xA;is less than $\sqrt{N/2}$ times the measurement noise on a single point,&#xA;then the cheap method can be used.&quot;&lt;br&gt;&#xA;$\qquad -$ &lt;a href=&quot;http://apps.nrbook.com/empanel/index.html?pg=772&quot; rel=&quot;noreferrer&quot;&gt;Numerical Recipes&lt;/a&gt; pp. 771-772  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(derivation anyone ?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&quot;Pretend equally spaced&quot; means:&lt;br&gt;&#xA;take the nearest $\pm N/2$ points&#xA;around each $t$ where you want SavGol($t$),&lt;br&gt;&#xA;not snap all $t_i \to i$ .&#xA;That may be obvious, but got me for a while.)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="4389" LastEditDate="2013-06-04T12:37:12.643" LastActivityDate="2013-06-04T12:37:12.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9449" PostTypeId="2" ParentId="9445" CreationDate="2013-06-04T13:08:12.947" Score="3" Body="&lt;p&gt;Frequency response is $1/(1−ce^{iw})$, if you want to get amplitude information you just need to get the magnitude of this complex function and its phase will be the inverse of the phase of $1/(1−ce^{iw})$ or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-\arctan (-c\sin w/(1-c\cos w))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can compute the magnitude of the transfer function by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 1 / sqrt( (-c\sin w)^2 + (1-c\cos w)^2 )$$&lt;/p&gt;&#xA;" OwnerUserId="4737" LastEditorUserId="4737" LastEditDate="2013-06-04T13:44:24.040" LastActivityDate="2013-06-04T13:44:24.040" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9450" PostTypeId="2" ParentId="9439" CreationDate="2013-06-04T14:54:54.887" Score="1" Body="&lt;p&gt;There may be a confusion here about how to cascade filters versus how to actual perform filtering. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There many different ways to implement linear time invariant filtering. If the filter can be represented as an FIR filter than two of the choices are time-domain convolution or frequency domain filtering such as overlap add. The later does indeed just require complex multiplication in the frequency domain (plus the actuall FFTs as well). For large filter length frequency domain processing is a lot more efficient but induces significant latency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many, many other ways to implement filters as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what you mean by &quot;diagonal matrix multiplication&quot;. For a system with a single input and a single output, this is just a simple vector multiply and there is no need for a matrix. While you can express time domain convolution as a matrix multiplication, it's not particularly efficient to actually implement it this way, so the matrix representation is mainly used for mathematical analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: Lets use a specific example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have a real signal of 1024 points and a  real FIR filter of 1024 taps. &#xA;Doing a direct convolution takes (roughly) 1024*1024 multiply-add operations for a total ca. 2.1 million scalar operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing it in the frequency domain requires a forward FFT, complex multiplication in the frequency domain and an inverse FFT. A forward FFT of length 1024 takes about 5*1024*log2(1024)= 51200 scalar operations. A complex multiply takes about 6 scalar operations. So the total would be 2*51200+6*1024 or roughly 110k operations. In this particular example the frequency domain multiplication is about 20 times more efficient than the time domain convolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;DISCLAIMER: This example glosses over a lot of details of the frequency domain method, in particular zero-padding, doing efficiently complex FFTs of real valued signals and overlap handling. However, in terms of computational complexity these mostly cancel each other and don't make a big difference in total operation count.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-06-04T19:49:30.443" LastActivityDate="2013-06-04T19:49:30.443" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9451" PostTypeId="2" ParentId="9358" CreationDate="2013-06-04T16:26:53.847" Score="0" Body="&lt;p&gt;I think Bjorn's recommendations are very good, but I want to provide some additional information. From your description, this sounds a lot like a timbre identification problem. There is some research in this area in computer music contexts (identifying different instruments is a useful thing to be able to do and telling the difference between a snap and clap is because of the sound's timbre). &lt;a href=&quot;http://williambrent.conflations.com/pages/research.html&quot; rel=&quot;nofollow&quot;&gt;William Brent&lt;/a&gt; has done some research in this area (look for timbreID on his page) and created some software to use in Pure Data. In each of the situations you're looking for specific events, so doing some automatic segmentation by onset detection would be a good idea. Since you're already taking an STFT, determining an onset wouldn't require too much additional work (look into Spectral Flux onset detection). A system outline could be as such:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Training&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Determine appropriate features (e.g. zero-crossing rate, spectral centroid, MFCC's)&lt;/li&gt;&#xA;&lt;li&gt;Detect an onset&lt;/li&gt;&#xA;&lt;li&gt;Calculate these features on input audio (your gesture recordings)&lt;/li&gt;&#xA;&lt;li&gt;Keep a database of feature calculations. You will need to determine whether this is a supervised or unsupervised training situation. For example, do users specify beforehand that a snap is &quot;sound 1&quot; and a clap is &quot;sound 2&quot;, or does your system try to cluster these after training.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Classification&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Detect an onset in real-time and calculate features on incoming audio&lt;/li&gt;&#xA;&lt;li&gt;Use a distance metric (euclidean distance or another Lp distance) to do a nearest neighbor or K-nearest neighbor classification to determine the &quot;closest&quot; sound from your database&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://williambrent.conflations.com/papers/features.pdf&quot; rel=&quot;nofollow&quot; title=&quot;paper&quot;&gt;paper on percussive timbre identification&lt;/a&gt; could be of some use. It outlines definitions for potential features to calculate on the incoming sound and the author's classification method. This will work fairly well for percussive sounds, but might not work as well for something like speech (multiple syllables), in that case an HMM method would be more suitable. Similarly, your onset detection's accuracy will vary depending on the types of sounds you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're particularly concerned about snaps vs. light switches, then spend some time figuring out which features could accurately discriminate between the two sounds.&lt;/p&gt;&#xA;" OwnerUserId="4531" LastActivityDate="2013-06-04T16:26:53.847" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9452" PostTypeId="1" AcceptedAnswerId="9458" CreationDate="2013-06-04T16:32:47.110" Score="3" ViewCount="299" Body="&lt;p&gt;Suppose we know the DFT of a discrete limited sequence, some $X[k],\  k = 0, 1,\dots ,N-1$. How can we calculate the Fourier Transform of the same signal for a random frequency $\Omega$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How about this, we can get the starting signal with inverse DFT, like: $$x[n] = \frac{1}{N}\sum\limits_{k=0}^{N-1} X[k]e^{j\frac{2\pi}{N}kn}$$&#xA;and then get the Fourier Transform normally with:&#xA;$$\begin{align}&#xA;X(e^{j\Omega}) &amp;amp;= \sum\limits_{n = -\infty}^{+\infty} x[n]e^{-j\Omega n}\\ &amp;amp;= \frac{1}{N}\sum\limits_{n = -\infty}^{+\infty} e^{-j\Omega n}\sum\limits_{k=0}^{N-1}X[k]e^{j\frac{2\pi}{N}kn} \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT2:&lt;/strong&gt;&#xA;As @Matt L. correctly states, I want the Discrete-time Fourier transform rather than the normal Fourier Transform, of course. In my native-language textbook Fourier Transform means both FT for continuous signals and DTFT for discrete signals. I hoped that that was clear from the edit. :)&lt;/p&gt;&#xA;" OwnerUserId="4710" LastEditorUserId="4710" LastEditDate="2013-06-04T17:57:01.400" LastActivityDate="2013-06-04T17:57:01.400" Title="Evaluating regular Fourier Transform from DFT" Tags="|fourier-transform|dft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9453" PostTypeId="2" ParentId="9452" CreationDate="2013-06-04T16:38:02.970" Score="0" Body="&lt;p&gt;If the frequency, f, is an integer multiple of SampleRate, fs, divided by N than it's simply the X[f/fs]. If not you have to do an sin(x)/x interpolation (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-04T16:38:02.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9454" PostTypeId="1" AcceptedAnswerId="9463" CreationDate="2013-06-04T16:51:52.940" Score="1" ViewCount="6647" Body="&lt;p&gt;I'm having 2 signals which have different sampling rates i.e., 1ms(A) and 4ms(B) and I've tried to upsample/downsample either of the signals based on the code snippet &lt;a href=&quot;http://www.dsprelated.com/showcode/54.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Resampling based on FFT&lt;/a&gt; which I believe is equivalent of what is descriped in &lt;a href=&quot;https://dsp.stackexchange.com/questions/2962/how-to-resample-audio-using-fft-or-dft&quot;&gt;How to resample audio using fft or dft&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% FFTRESAMPLE Resample a real signal by the ratio p/q&#xA;function y = fftResample(x,p,q)&#xA;&#xA;% --- take FFT of signal ---&#xA;f = fft(x);&#xA;&#xA;% --- resize in the FFT domain ---&#xA;% add/remove the highest frequency components such that len(f) = len2&#xA;len1 = length(f);&#xA;len2 = round(len1*p/q);&#xA;lby2 = 1+len1/2;&#xA;if len2 &amp;lt; len1&#xA;  % remove some high frequency samples&#xA;  d = len1-len2;&#xA;  f = f(:);&#xA;  f(floor(lby2-(d-1)/2:lby2+(d-1)/2)) = [];&#xA;elseif len2 &amp;gt; len1&#xA;  % add some high frequency zero samples&#xA;  d = len2-len1;&#xA;  lby2 = floor(lby2);&#xA;  f = f(:);&#xA;  f = [f(1:lby2); zeros(d,1); f(lby2+1:end)];&#xA;end&#xA;&#xA;% --- take the IFFT ---&#xA;% odd number of sample removal/addition may make the FFT of a real signal&#xA;% asymmetric and artificially introduce imaginary components - we take the&#xA;% real value of the IFFT to remove these, at the cost of not being able to&#xA;% reample complex signals&#xA;y = real(ifft(f));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i.e., reimplemented the fftResample in C++ using FFTW libraries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the output is distorted because of the zero-padding. &#xA;I'm relatively new to Singal processing and I would appreciate if users can help me understand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;if I'm using the right code snippet to upsample/downsample? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;highlight the benefits of upsampling(A to 4ms) compared to&#xA;    downsampling(B to 1ms)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4738" LastEditorUserId="128" LastEditDate="2021-05-29T10:45:09.383" LastActivityDate="2021-05-29T10:45:09.383" Title="Downsampling and Upsampling Using FFTW" Tags="|fft|downsampling|resampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9455" PostTypeId="2" ParentId="9454" CreationDate="2013-06-04T17:20:54.730" Score="2" Body="&lt;p&gt;When you downsample a signal you must make sure that the Nyquist condition remains satisfied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say that signal $x$ has frequencies between $0-25$ Hz, and that the sampling frequency of $x$ is $100$ Hz. The Nyquist frequency is $100/2 = 50$ Hz, thus you could downsample $x$ by a factor of two with no problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, say that you would like to downsample $x$ by a factor of $4$ instead of $2$. This would mean that the new sampling frequency would be $25$ Hz. Since the new sampling frequency is $25$ Hz, it must not contain frequencies above $25/2=12.5$ Hz. However, $x$ had frequencies between $0-25$ so there would be &lt;em&gt;aliasing&lt;/em&gt;. In order to avoid that, you must low-pass filter $x$ first between $0-12.5$ Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process of low-pass filtering + downsampling is called &lt;em&gt;decimation&lt;/em&gt;. You can find more information about it on Wikipedia.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upsampling would be basicly &lt;em&gt;interpolation&lt;/em&gt;, so I would avoid that where possible. I did not look at the URLs you provided, please phrase your problem in full here.&lt;/p&gt;&#xA;" OwnerUserId="4740" LastActivityDate="2013-06-04T17:20:54.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9456" PostTypeId="2" ParentId="9452" CreationDate="2013-06-04T17:37:05.513" Score="1" Body="&lt;p&gt;There are an infinite number of continuous waveforms that have the same DFT after sampling, which then have different FTs.  So you need to specify more.  If some continuous signal you want is strictly band-limited, then Sinc interpolation will give you one smaller family of possible solutions from which you might be able to derive an FT.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-06-04T17:37:05.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9458" PostTypeId="2" ParentId="9452" CreationDate="2013-06-04T17:56:36.680" Score="2" Body="&lt;p&gt;Your question makes perfect sense, yet your solution will not work. Note that the expression for $x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;x[n]=\frac{1}{N}\sum\limits_{k=0}^{N-1}X[k]e^{j\frac{2\pi}{N}kn} \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is periodic with period $N$. This means that the sum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{1}{N}\sum\limits_{n = -\infty}^{+\infty} e^{-j\Omega n}\sum\limits_{k=0}^{N-1}X[k]e^{j\frac{2\pi}{N}kn}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;does not converge. Let's assume that $x[n]$ is defined for $0\le n&amp;lt; N$ and is zero otherwise. Then we get for the discrete-time Fourier transform of $x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\Omega})=\sum_{n=0}^{N-1}x[n]e^{-jn\Omega}=&#xA;\frac{1}{N}\sum_{n=0}^{N-1}\sum\limits_{k=0}^{N-1}X[k]e^{j\frac{2\pi}{N}kn}e^{-jn\Omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This formula actually works and can be used if only the DFT $X[k]$ is given. Of course this only works for finite length signals $x[n]$. Equation (1) simply means that the DFT contains the complete information about the (finite-length) signal $x[n]$ and any frequency point $\Omega$ of the DTFT can be evaluated using the discrete values $X[k]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-04T17:56:36.680" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9461" PostTypeId="1" CreationDate="2013-06-04T22:32:40.320" Score="1" ViewCount="1328" Body="&lt;p&gt;What would be a decent formula for approximating the connection between voltage and decibel output for a typical set of unpowered in-ear headphones?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm generating sine waves from the computer: an array of floats between -1.0 and +1.0 gets sent out through the speaker:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X_out = h * sin( f * 2π * t ); // h is the amplitude&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's say we assume the user to ramp up their volume so that h=1 corresponds to a loud  but comfortable listening level.  So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h=1 ~ dB_out=80dB&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, how can I mathematically connect h and dB_out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v_out ~ h&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Somewhere I have seen the formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SPL = 20 * Log10( v_out / v_ref )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, rearranging: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v_out = v_ref * 10 ^ ( SPL / 20 )&#xA;k * h = v_ref * 10 ^ ( SPL / 20 )&#xA;h = k' * 10 ^ (SPL / 20 )&#xA;  = A * exp( SPL ) + B,  for suitable A, B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this working valid?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the alternative formulation of the question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Given a frequency f, and a desired decibel level,  what h do I need to generate that decibel level?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2013-06-05T11:53:42.133" LastActivityDate="2013-06-11T17:45:15.680" Title="Transfer function between voltage and decibel output for in-ear headphones" Tags="|transfer-function|amplitude|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9462" PostTypeId="2" ParentId="9461" CreationDate="2013-06-04T23:21:51.210" Score="5" Body="&lt;p&gt;That depends to a very large degree on the type &amp;amp; sensitivity on the headset, the gain of the amplifier and the frequency. I don't think there is a reasonable rule of thumb, this will be all over the place.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-04T23:21:51.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9463" PostTypeId="2" ParentId="9454" CreationDate="2013-06-05T04:10:17.110" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The problem is that the output is distorted because&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your method is not quite correct. You have good reference in your question - &lt;a href=&quot;https://dsp.stackexchange.com/questions/2962/how-to-resample-audio-using-fft-or-dft&quot;&gt;How to resample audio using fft or dft&lt;/a&gt;. Please, read comment of Bjorn Roche to this question. And read  answer of Jim Clay. Especially point 2). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually it is bad idea to use frequency filtration in frequency domain. There is good blog of Bjorg. See - &lt;a href=&quot;http://blog.bjornroche.com/2012/08/why-eq-is-done-in-time-domain.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Why EQ Is Done In the Time Domain&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-06-05T04:10:17.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9464" PostTypeId="2" ParentId="9461" CreationDate="2013-06-05T05:04:54.193" Score="1" Body="&lt;p&gt;Here, the point is that, the power of the two sine waves with different frequencies but with same amplitudes will give the same signal power. However, human ear have different sensitivities to different frequencies and when tuning your decibel level, you may need to take this into consideration.&lt;img src=&quot;https://i.stack.imgur.com/Y4rVm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/9461/transfer-function-between-voltage-and-decibel-output-for-in-ear-headphones&quot;&gt;Transfer function between voltage and decibel output for in-ear headphones&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4737" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-06-05T05:20:49.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9465" PostTypeId="1" CreationDate="2013-06-05T08:09:45.673" Score="2" ViewCount="77979" Body="&lt;p&gt;I am new in matlab and signal processing. The time series that have been used are obtained from accelerometer in a building. As far as I understand both the time series' length and window function length(hamming or hanning) should be same. But for smoothing the fourier amplitude spectrum, optimum window length can vary. How this procedure should be apply in matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can apply a window function that is shorter than my time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading!&lt;/p&gt;&#xA;" OwnerUserId="4743" LastEditorUserId="4743" LastEditDate="2013-06-05T08:57:30.863" LastActivityDate="2016-11-21T17:18:57.640" Title="How to apply Hamming Window?" Tags="|fft|matlab|discrete-signals|smoothing|window-functions|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9466" PostTypeId="1" CreationDate="2013-06-05T08:17:11.560" Score="0" ViewCount="153" Body="&lt;p&gt;I've just come across a paper that interrelates the covariance matrix of time discrete signals to their autocorrelation function (or a time-delay, respectively), i.e.&#xA;$$\mathbf{C} = E\{\mathbf{x}\left(t\right)\mathbf{x}^H\left(t-\tau\right)\}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming from the image processing field, I have usually just worked for the $\tau = 0$ case, whereas $t$ was just the pixel index instead of a time stamp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am wondering how I can transfer the concept of this time delay $\tau$ to image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Side-note: Since I don't use box-car based image processing and determine the pixels for this covariance matrix estimation adaptively, what I have basically is a $\left(K\times N\right)$ data matrix containing $N$ pixels with $K$ &quot;measurements&quot; each.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I calculate the time-delayed covariance matrix described in the formula above in my case?&lt;/p&gt;&#xA;" OwnerUserId="4689" LastActivityDate="2013-06-05T08:17:11.560" Title="Transfering the concept of time delay to image processing" Tags="|image-processing|autocorrelation|covariance|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9467" PostTypeId="1" AcceptedAnswerId="9468" CreationDate="2013-06-05T09:36:47.667" Score="38" ViewCount="43267" Body="&lt;p&gt;MATLAB's &lt;code&gt;filtfilt&lt;/code&gt; does a forward-backward filtering, i.e., filter, reverse the signal, filter again and then reverse again. Apparently this done to reduce phase lags? What are the advantages/disadvantages of using such a filtering (I guess it would result in an effective increase in filter order).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be preferable to use &lt;code&gt;filtfilt&lt;/code&gt; always instead of &lt;code&gt;filter&lt;/code&gt; (i.e., only forward filtering)? Are there any applications where it is necessary to use this and where it shouldn't be used? &lt;/p&gt;&#xA;" OwnerDisplayName="user4744" LastEditorUserId="4298" LastEditDate="2020-11-01T18:10:27.000" LastActivityDate="2023-07-12T14:55:55.897" Title="What is the advantage of MATLAB's filtfilt" Tags="|matlab|filters|infinite-impulse-response|theory|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9468" PostTypeId="2" ParentId="9467" CreationDate="2013-06-05T10:20:49.197" Score="46" Body="&lt;p&gt;You can best look at it in the frequency domain. If $x[n]$ is the input sequence and $h[n]$ is the filter's impulse response, then the result of the first filter pass is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\omega})H(e^{j\omega})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $X(e^{j\omega})$ and $H(e^{j\omega})$ the Fourier transforms of $x[n]$ and $h[n]$, respectively. Time reversal corresponds to replacing $\omega$ by $-\omega$ in the frequency domain, so after time-reversal we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{-j\omega})H(e^{-j\omega})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second filter pass corresponds to another multiplication with $H(e^{j\omega})$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{-j\omega})H(e^{j\omega})H(e^{-j\omega})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which after time-reversal finally gives for the spectrum of the output signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(e^{j\omega})=X(e^{j\omega})H(e^{j\omega})H(e^{-j\omega})=&#xA;X(e^{j\omega})|H(e^{j\omega})|^2\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because for real-valued filter coefficients we have $H(e^{-j\omega})=H^{*}(e^{j\omega})$. Equation (1) shows that the output spectrum is obtained by filtering with a filter with frequency response $|H(e^{j\omega})|^2$, which is purely real-valued, i.e. its phase is zero and consequently there are no phase distortions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the theory. In real-time processing there is of course quite a large delay because time-reversal only works if you allow a latency corresponding to the length of the input block. But this does not change the fact that there are no phase distortions, it's just an additional delay of the output data. For FIR filtering, this approach is not especially useful because you might as well define a new filter $\hat{h}[n]=h[n]*h[-n]$ and get the same result with ordinary filtering. It is more interesting to use this method with IIR filters, because they cannot have zero-phase (or linear phase, i.e. a pure delay).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if you have or need an IIR filter and you want zero phase distortion, AND processing delay is no problem then this method is useful&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if processing delay is an issue you shouldn't use it&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if you have an FIR filter, you can easily compute a new FIR filter response which is equivalent to using this method. Note that with FIR filters an exactly linear phase can always be realized.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2018-06-12T08:56:18.133" LastActivityDate="2018-06-12T08:56:18.133" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9469" PostTypeId="1" CreationDate="2013-06-05T10:37:08.143" Score="1" ViewCount="455" Body="&lt;p&gt;If I understood it right, a keypoint is a tuple $$(x,y,\sigma, r),$$ where $x,y$ define the position of the keypoint and $r$ an orientation (given by the most domiant gradiant vector around the keypoint). I'm still not sure about the intention of $\sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is done in the first part of SIFT is to consider $$L(x,y,\sigma):=G(x,y,\sigma) \ast I(x,y),$$&#xA;where $I(x,y)$ denote the value of the image at position $(x,y)$, $\ast$ the convolution and $G(x,y,\sigma)$ the gaussian filter with standard-deviation $\sigma$, evaluated at position $(x,y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now DoGs are considered, for different sizes of the image and for different blurring-values $\sigma$ and interesting points are collected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What confuses me most about this procedure is that Lowe denotes $\sigma$ as the scale of the image. However, $\sigma$ is just a blurring-parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, I define a blured image of a scaled image by &#xA;$$L(x,y,\sigma,s):=G(x,y,\sigma) \ast I_s(x,y),$$ where $I_s$ is the Image $I$ scaled by factor $s$ (So multiplying both dimensions of the image by s, and rescaling it). Thus, an interesting point in a DoG is a point $(x,y)$ in the image $L(x,y,k\sigma,s)-L(x,y,\sigma,s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Lowe's paper, he never considers the parameter 's' but just $\sigma$. Why is that possible ? How do I relate $(x,y)$ of $L(x,y,\sigma,s)$ to a position in the image $I$ and why do I save the blurring-parameter $\sigma$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In what way is the keypoint now scale (resize)-invariant ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should there be in the resized image at some DoG a keypoint, which corresponds to the former keypoint by having more or less the same orientation and magnitude of its surrounding gradiants ? Is that the invariance Lowe is talking about ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find a keypoints, a local extrema of $L(x,y,\sigma)$ around a point $(x,y,\sigma)$ is considered. What is idea behind using interpolated extrema via Tayler expansion ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks Michals&lt;/p&gt;&#xA;" OwnerUserId="4745" LastActivityDate="2013-07-06T07:49:45.983" Title="Keypoint position and scale in SIFT" Tags="|sift|scale-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9470" PostTypeId="2" ParentId="9461" CreationDate="2013-06-05T10:48:34.120" Score="5" Body="&lt;p&gt;Without an artificial ear and calibrated SPL meter your not going to obtain a valid measurement (even then the SPL will vary per earphone fitting). With earphones and a multimeter, you can only really ballpark the measurement e.g. output a full scale tone, and measure the voltage at the terminals (should be OK to do this by parallel output of the playback device e.g. jack splitter, one socket for phones, the other for multimeter). Then use the phone sensitivity (find spec) to approximate the SPL. You know then that if you vary the digital gain by x dB (from the reference measurement, here full scale), the voltage variation to the phones should be proportional (if all things in your chain are linear) and so should be the SPL. You can go a step further by trying to obtain (or have measured) the transfer function of the phones, and use the magnitude response to estimate the SPL as a function of frequency/design a digital filter with this response and use that to estimate the SPL of a complex signal. This is not an accurate methodology though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding to your updated post, here's some Python code to do what you want (note you should not exceed full scale):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;amp_cal = 1&#xA;fs = 32e3&#xA;f = 1e3&#xA;signal = amp_cal*np.sin(2*np.pi*f*np.arange(fs)/fs)&#xA;rms = 10*np.log10(np.mean(signal**2))&#xA;&#xA;SPL_cal = 80&#xA;SPL_desired = 60&#xA;dif = SPL_desired-SPL_cal&#xA;gain = 10**(dif/20.0)&#xA;signal2 = signal * gain&#xA;rms2 = 10*np.log10(np.mean(signal2**2))&#xA;print rms, rms2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4335" LastEditorUserId="4335" LastEditDate="2013-06-05T12:35:28.920" LastActivityDate="2013-06-05T12:35:28.920" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9472" PostTypeId="1" CreationDate="2013-06-05T12:37:24.147" Score="-2" ViewCount="269" Body="&lt;p&gt;I have a project in which I have to create chorus effect to an audio file. I have tried this code and i don't know weather its right or wroung. Anyway the code is below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x,fs]=wavread('ShortWAV.wav');&#xA;f=0.25;&#xA;delay_in_sampels=0.05*fs;%50 ms delay&#xA;index=1:length(x);&#xA;sincurve = 1*sin(2*pi*index*f);&#xA;y = zeros(length(x):1);&#xA;y(1:delay_in_sampels)=x(1:delay_in_sampels);&#xA;a=1;&#xA;b=5;&#xA;for i =(delay_in_sampels+1):length(x)&#xA;    i=floor(i);&#xA;    sink=abs(sincurve(i));&#xA;    delay=(delay_in_sampels+sink);&#xA;    o=ceil(i-delay);&#xA;    y(i)=(a*x(i)) + b*(x(o));&#xA;end&#xA;soundsc(y,fs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I have been asked to find its impulse response.&lt;/p&gt;&#xA;" OwnerUserId="4746" LastEditorUserId="80" LastEditDate="2013-06-05T14:33:42.520" LastActivityDate="2013-06-05T14:48:51.247" Title="Impulse Response h(t)" Tags="|impulse-response|" AnswerCount="1" CommentCount="2" ClosedDate="2013-06-08T15:20:23.690" ContentLicense="CC BY-SA 3.0" />
  <row Id="9473" PostTypeId="2" ParentId="9465" CreationDate="2013-06-05T13:42:13.690" Score="4" Body="&lt;p&gt;The window length should be equal to your &lt;em&gt;transform&lt;/em&gt; length, not necessarily the length of your entire data set.  The two are the same, of course, if you are going to transform the entire data set at once, but if you are planning to do shorter transforms then you should make the window length equal to the length of those transforms.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-06-05T13:42:13.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9474" PostTypeId="2" ParentId="9472" CreationDate="2013-06-05T14:48:51.247" Score="3" Body="&lt;p&gt;A chorus effect is achieved by adding a delayed version to the original signal and then modulating the delay. There are typically three parameters that control a chorus&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Speed: frequency of the delay modulation&lt;/li&gt;&#xA;&lt;li&gt;Depth: amplitude of delay modulation&lt;/li&gt;&#xA;&lt;li&gt;Mix: Ratio of original and delayed signal&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are a few more things to play around with: min delay, modulation shape, number of taps, etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are lots problems with your code:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The speed of your modulation is not 0.25 Hz (which you probably intended) but a quarter of the sample rate, which is way too fast for a chorus&lt;/li&gt;&#xA;&lt;li&gt;The delay needs to calculated as d[n] = dMax*(1 + sin(modFreq*t)) so it needs to be centered around a medium delay with the modulation going up and down from there&lt;/li&gt;&#xA;&lt;li&gt;You need a sub sample delay and not just round to the nearest integer&lt;/li&gt;&#xA;&lt;li&gt;The delayed signal should never be larger than the original one&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Finally, there is no impulse response. By definition the chorus is a time variant system and impulse responses can only be defined for time invariant systems.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-05T14:48:51.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9476" PostTypeId="1" AcceptedAnswerId="9477" CreationDate="2013-06-06T05:26:57.867" Score="0" ViewCount="58" Body="&lt;p&gt;i am working in digital image restoration field, recently i have studied image degradation model which is like that.&#xA;&lt;strong&gt;g(x,y) = h(x,y)*f(x,y) + n(x,y)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;g(x,y) is the degraded image&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;f(x,y) is the image that we wish to capture or its is latent image&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;h(x,y) is image degrading function, and * is convolution operator&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;n(x,y) is noise&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my question is that, can i change this particular model like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;g(x,y) = h(x,y)*{f(x,y)+n(x,y)}&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4444" LastActivityDate="2013-06-06T10:42:07.730" Title="can i decompose image deblurring model?" Tags="|image-processing|convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9477" PostTypeId="2" ParentId="9476" CreationDate="2013-06-06T06:58:23.550" Score="3" Body="&lt;p&gt;In principle you can do that. You should, however, note that the two noise signals (both of which you called $n(x,y)$) are of course not identical. The two models are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(x,y)=h(x,y)*f(x,y)+n(x,y)\\&#xA;g(x,y)=h(x,y)*\left[ f(x,y)+z(x,y)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the two noise components $n(x,y)$ and $z(x,y)$ have different properties. So you have to be careful with methods that assume certain noise properties. E.g. if it is assumed that $n(x,y)$ is white, then $z(x,y)$ is not white anymore and this has to be taken into account in the noise removal algorithm. The basic question you have to ask yourself is what you gain by changing the model.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-06T06:58:23.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9478" PostTypeId="2" ParentId="9469" CreationDate="2013-06-06T07:07:13.113" Score="4" Body="&lt;p&gt;The $\sigma$ parameter is both. The Gaussian function can generate a &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale_space&quot; rel=&quot;nofollow&quot;&gt;scale-space&lt;/a&gt; where $\sigma$ is the scale parameter. It doesn't mean the image is scaled, instead it is the scale at which the features are being evaluated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, with higher $\sigma$ the image is more blurred and therefore only larger image features contribute to the gradient histogram. SIFT is made scale-invariant by choosing the greatest feature response from a set of responses from different scales. The Gaussian function is used because with increasing scale one can guarantee no new local extrema (features) are introduced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure about the interpolated extrema, but I guess it is to obtain sub-pixel accuracy.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-06-06T07:07:13.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9479" PostTypeId="1" CreationDate="2013-06-06T09:30:48.640" Score="0" ViewCount="757" Body="&lt;p&gt;Hi I'm trying to separate sound from music using wfilters and heard each part separately using its name scale3 function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function s = scale3(q,n)&#xA;   p = length(q);&#xA;    if p==n &#xA;       s = q;&#xA;      else &#xA;      s = resample(q,n,p);&#xA;     end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the program&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; s = wavread('K:\Khaleel_3aaza (1).wav'); % whatever here&#xA; [l,h] = wfilters('sym2','d');&#xA; [z.x]=wavedec(s,2,l,h);&#xA;&#xA; -&amp;gt; p = scale3(z.x(25000:40000),45000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the function in the program I apply with wfilters and filter works well until approximately 20,000 but the values ​​of the file that I'm working it the larger, and the music begins approximately 3,000 when I ues more than 30000 or more&#xA;give me this error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;??? Error using ==&amp;gt; upfirdnmex&#xA;  Filter length is too large - reduce problem complexity.&#xA;&#xA; Error in ==&amp;gt; upfirdn at 86&#xA; Y = upfirdnmex(x,h,p,q,Lx,Lh,hCols,nChans);&#xA;&#xA; Error in ==&amp;gt; resample at 106&#xA;  y = upfirdn(x,h,p,q);&#xA;&#xA; Error in ==&amp;gt; scale3 at 6&#xA;  s = resample(q,n,p);&#xA;&#xA;  Error in ==&amp;gt; Untitled2 at 7&#xA;  p = scale3(z.x(25000:40000),45000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't understand what that means ? ang how I can fix it thank you for help&lt;/p&gt;&#xA;" OwnerUserId="4752" LastActivityDate="2013-06-06T12:00:05.380" Title="Filter is too large" Tags="|matlab|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9482" PostTypeId="2" ParentId="9476" CreationDate="2013-06-06T10:42:07.730" Score="0" Body="&lt;p&gt;they are equivalent in the sense that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ g(x,y) = h(x,y)*{f(x,y)+n(x,y)} = h(x,y)*f(x,y) + h(x,y)*n(x,y)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here $ h(x,y)*n(x,y) = N(x,y) $ is the new noise model and dependent on h(x,y). As far as I observe this will not simplify the signal estimation procedure because noise models are usually simpler in the initial model.&lt;/p&gt;&#xA;" OwnerUserId="4737" LastActivityDate="2013-06-06T10:42:07.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9483" PostTypeId="2" ParentId="9421" CreationDate="2013-06-06T10:53:11.960" Score="2" Body="&lt;p&gt;amplification and filtering are two separate concepts. a filter only change its magnitude response for the intended frequency range and introducing gains is the job of amplifiers&lt;/p&gt;&#xA;" OwnerUserId="4737" LastEditorUserId="4737" LastEditDate="2013-06-07T12:54:06.597" LastActivityDate="2013-06-07T12:54:06.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9484" PostTypeId="1" AcceptedAnswerId="9508" CreationDate="2013-06-06T11:46:58.297" Score="1" ViewCount="1928" Body="&lt;p&gt;Is there a way to make an inverse notch filter block in matlab simulink?&#xA;I have found the peak-notch block, but I need to amplify the signal instead of attenuate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4197" LastActivityDate="2013-06-08T14:06:45.330" Title="simulink inverse notch filter" Tags="|matlab|filters|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9485" PostTypeId="2" ParentId="9479" CreationDate="2013-06-06T12:00:05.380" Score="1" Body="&lt;p&gt;Matlab's resample() is a &quot;rational&quot; sample rate converter, i.e. it upsamples by n, low-pass filters and then downsamples by p. This works best, if n and p are relatively small integers. If the numbers are large and mutually prime, the up-sampled vector gets huge. In your case that would be 15001*45000 = 675,040,000 samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest work around would be to change the input length from 15001 to 15000 (i.e.  &lt;code&gt;p = scale3(z.x(25001:40000),45000);)&lt;/code&gt;. That reduces it to a trivial upsampling by 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's not possible, you need to find an &quot;irrational&quot; sample rate converter that's typically done with polyphase filter interpolation. Not sure whether there is one in the standard Matlab distribution.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-06T12:00:05.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9486" PostTypeId="2" ParentId="9484" CreationDate="2013-06-06T13:34:02.777" Score="0" Body="&lt;p&gt;peak-notch block is a two-way component. You can set the response type to peak or notch. Here is the properties page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5obu3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;int the link: &lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/peaknotchfilter.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/help/dsp/ref/peaknotchfilter.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this filter you can obtain desired output by summing input signal and output of the peak filter.&lt;/p&gt;&#xA;" OwnerUserId="4737" LastEditorUserId="4737" LastEditDate="2013-06-07T12:53:06.187" LastActivityDate="2013-06-07T12:53:06.187" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9487" PostTypeId="2" ParentId="9425" CreationDate="2013-06-06T14:52:38.060" Score="2" Body="&lt;p&gt;All formulas I'm using come from &lt;a href=&quot;http://en.wikipedia.org/wiki/Low-pass_filter&quot; rel=&quot;nofollow&quot;&gt;the wikipedia page you cite in your code&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, calculate RC. We have,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fc = 1/(2*pi*RC)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RC = 1/(2*pi*fc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, ALPHA is simply:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ALPHA = dt / ( dt + RC )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where dt is 1/samplerate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your values (samplerate=350, fc=4) I got&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ALPHA = 0.0670&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Caveat: I tried this on a few other values and the shape of the filter was what I expected, but the exact 3dB cutoff frequency was never quite where it should have been. Not sure if this indicates something wrong, or that's just the nature of the beast.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2013-06-06T14:52:38.060" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9488" PostTypeId="1" AcceptedAnswerId="9489" CreationDate="2013-06-06T15:08:31.263" Score="0" ViewCount="1078" Body="&lt;p&gt;In trying to answer &lt;a href=&quot;https://dsp.stackexchange.com/questions/9425/how-to-determine-alpha-smoothing-constant-of-a-lpf&quot;&gt;another question&lt;/a&gt;, I got stuck applying what I thought would be a valid way to answer it: using the system function. Here's what I did:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I put the question&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y[i] = Y[i-1] + ALPHA * ( X[i] + Y[i-1] )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;into DF I:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y[i] = ALPHA * X[i] - (ALPHA-1) * Y[i-1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This tells me that the system function is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H(z) = ALPHA / ( 1 + (ALPHA-1) z^-1 )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Substituting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z=e^(jw)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|H(z)| = .5 (or .707)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should allow me to calculate ALPHA, but I only get complex values for ALPHA. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="1543" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-06-06T16:15:14.057" Title="Calculating filter parameters from system response" Tags="|lowpass-filter|z-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9489" PostTypeId="2" ParentId="9488" CreationDate="2013-06-06T16:15:14.057" Score="1" Body="&lt;p&gt;Just math I think. Let's substitute g = ALPHA -1, which makes the algebra a little easier. Then you need to solve &#xA;$$\left | \frac{1+g}{1+g\cdot e^{-j\omega }} \right |^{2}=0.5$$&#xA;That means&#xA;$$\frac{1+g}{1+g\cdot e^{-j\omega }}\cdot \frac{1+g}{1+g\cdot e^{+j\omega }} = 0.5$$&#xA;Multiplying this out yields&#xA;$$\frac{(1+g)^{2}}{1+2\cdot g\cdot cos(\omega) + g^{2} }= 0.5$$&#xA;We can put this into standard quadratic equation form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g^{2}+(4-2\cdot cos(\omega))\cdot g + 1 = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solve, plug in the numbers and you get&#xA;$$g_{1} = -1.0744, g_{2} = -0.93074$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first solution doesn't make sense since it would be a pole outside the unit circle, so the second is correct and we get the expected&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha = 0.069262$$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-06T16:15:14.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9490" PostTypeId="1" CreationDate="2013-06-06T17:28:14.417" Score="2" ViewCount="90" Body="&lt;p&gt;In order to get more detail when encoding the blacks, a log LUT is going to be applied to the pixel values.  Like gamma, the logical place to do it in the image processing pipeline is after demosaicking, so the same LUT is applied to the R,G,B components.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it occurs to me that a very similar effect can be achieved by applying the LUT to the bayer pattern instead.  The motivation for this is to utilize fewer logic resources (in an FPGA), since only a single LUT is required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any fundamental reason to do this after demosaicking and not before?  What about applying it to the Y component after RGB-&gt;YUV color space conversion?&lt;/p&gt;&#xA;" OwnerUserId="4711" LastEditorUserId="13320" LastEditDate="2016-11-21T13:20:25.890" LastActivityDate="2016-11-21T13:20:25.890" Title="Log LUT applied before bebayering vs applied to RGB" Tags="|image-processing|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9491" PostTypeId="1" AcceptedAnswerId="9492" CreationDate="2013-06-06T17:37:18.697" Score="-1" ViewCount="5751" Body="&lt;p&gt;Which measure should be considered better and when ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested both the measures on some data that I have and I got mixed results i.e. some are showing better results with Pearson and some with the Normalized Squared Error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By similarity I mean similar shapes of the signals that I have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I normalized the data before applying the measures to them.&lt;/p&gt;&#xA;" OwnerUserId="4271" LastActivityDate="2018-03-09T05:38:32.283" Title="Normalized Square Error vs Pearson correlation as similarity measures of two signals" Tags="|correlation|waveform-similarity|normalization|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9492" PostTypeId="2" ParentId="9491" CreationDate="2013-06-06T21:43:18.150" Score="7" Body="&lt;p&gt;It depends on the normalization that you perform on the data. Note that for computing the Pearson correlation coefficient you subtract the means of the signals. This is normally not the case if you simply compute a mean squared error between the signals, unless mean removal is part of your normalization procedure. I assume you compute the Pearson correlation coefficient as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$r=\frac{\sum_i(x_i-m_x)(y_i-m_y)}{\sqrt{\sum_i(x_i-m_x)^2}\sqrt{\sum_i(y_i-m_y)^2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_i$ and $y_i$ are the data to be compared, and $m_x$ and $m_y$ are their sample means. If the sample means are different, this will have no influence on the correlation coefficient $r$. Different means will, however, influence the mean squared error between the signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$MSE=\frac{1}{n}\sum_{i=1}^{n}(x_i-y_i)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;unless the normalization takes care of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you assume that both signals have zero mean (or that the mean has been removed by normalization), and that both signals have been normalized to have an average power of 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{n}\sum_{i=1}^{n}x_i^2=1,\quad \frac{1}{n}\sum_{i=1}^{n}y_i^2=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then both error measures simplify to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$r=\frac{1}{n}\sum_{i=1}^{n}x_iy_i,\quad MSE=2\left (1-\frac{1}{n}\sum_{i=1}^{n}x_iy_i\right)=2(1-r)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that with an appropriate normalization which removes the mean of both signals and normalizes their power to unity, both error measures are equivalent and one can be computed from the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summarizing, in general the Pearson correlation coefficient gives you a better idea of the similarity of two signals. If you normalize the signals appropriately, then the MSE is equivalent to the correlation coefficient $r$ and there is a simple relation between them.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-06T21:43:18.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9493" PostTypeId="1" CreationDate="2013-06-06T22:49:52.980" Score="1" ViewCount="328" Body="&lt;p&gt;I want to find all occurrences of a specific phrase in a set of audio files (it's a catch-phrase in a TV show). The phrase is pronounced by different people with different speed etc. What is the best approach to this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional details: It's a one time thing. The end result should be a program that takes 30 hours of audio and produces timestamps of a particular short phrase. Obviously the training will be required. Problem is that while I'm a seasoned programmer I have pretty much no experience with speech recognition. I know that phoneme recognition engines exist will they get the job done? For now I need some pointers in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="4759" LastEditorUserId="4759" LastEditDate="2013-06-07T20:05:03.950" LastActivityDate="2013-06-07T20:05:03.950" Title="Speech recognition library for detecting phrase in file" Tags="|speech-recognition|speech|speech-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9494" PostTypeId="2" ParentId="1676" CreationDate="2013-06-07T03:51:42.250" Score="22" Body="&lt;p&gt;Because of the way the &lt;a href=&quot;http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter_for_smoothing_and_differentiation&quot;&gt;Savitzky-Golay filter&lt;/a&gt; is derived (i.e as local least-squares polynomial fits), there's a natural generalization to nonuniform sampling--it's just much more computationally expensive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Savitzky-Golay Filters in General&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the standard filter, the idea is to fit a polynomial to a local set of samples [using least squares], then replace the center sample with the value of the polynomial at the center index (i.e. at 0). That means the standard SG filter coefficients can be generated by inverting a &lt;a href=&quot;http://en.wikipedia.org/wiki/Vandermonde_matrix&quot;&gt;Vandermonde matrix&lt;/a&gt; of sample indicies. For example, to generate a local parabolic fit across five samples $y_0\dots y_4$ (with local indicies -2,-1,0,1,2), the system of design equations $Ac = y$ would be as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix}-2^0 &amp;amp; -2^1 &amp;amp; -2^2 \\ -1^0 &amp;amp; -1^1 &amp;amp; -1^2 \\ 0^0 &amp;amp; 0^1 &amp;amp; 0^2 \\ 1^0 &amp;amp; 1^1 &amp;amp; 1^2 \\ 2^0 &amp;amp; 2^1 &amp;amp; 2^2 \end{bmatrix} \begin{bmatrix} c_0 \\ c_1 \\ c_2 \end{bmatrix} = \begin{bmatrix} y_0 \\ y_1 \\ y_2 \\ y_3 \\ y_4 \end{bmatrix}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, the $c_0 \dots  c_2$ are the unknown coefficients of the least squares polynomial $c_0 + c_1x + c_2x^2$. Since the value of the polynomial at $x = 0$ is just $c_0$, computing the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pseudoinverse&quot;&gt;pseudoinverse&lt;/a&gt; of the design matrix (i.e. $c = (A^TA)^{-1}A^T y\space $) will yield the SG filter coefficients in the top row. In this case, they would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix}c_0 \\ c_1 \\ c_2 \end{bmatrix} =&#xA;\begin{bmatrix}&#xA;-3 &amp;amp; 12 &amp;amp; 17 &amp;amp; 12 &amp;amp; -3 \\&#xA;-7 &amp;amp; -4 &amp;amp; 0 &amp;amp; 4 &amp;amp; 7 \\&#xA; 5 &amp;amp; -3 &amp;amp; -5 &amp;amp; -3 &amp;amp; 5 \\&#xA;\end{bmatrix}&#xA;\begin{bmatrix} y_0 \\ y_1 \\ y_2 \\ y_3 \\ y_4 \end{bmatrix}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that since the derivative of $c_0 + c_1x + c_2x^2$ is $c_1 + 2c_2x$, the second row of the matrix (which evaluates $c_1$) will be a smoothed derivative filter. The same argument applies for successive rows--they give smoothed higher-order derivatives. Note that I scaled the matrix by 35 so the first row would match the smoothing coefficients given on Wikipedia (above). The derivative filters each differ by other scaling factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Nonuniform Sampling&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the samples are evenly spaced, the filter coefficients are translation-invariant, so the result is just an FIR filter. For nonuniform samples, the coefficients will differ based on the local sample spacing, so the design matrix will need to be constructed and inverted at each sample. If the nonuniform sample times are $x_n$, and we construct local coordinates $t_n$ with each center sample time fixed at $0$, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;t_{-2} &amp;amp; = x_{-2} - x_0 \\&#xA;t_{-1} &amp;amp; = x_{-1} - x_0 \\ &#xA;t_0 &amp;amp; = x_0 - x_0 \\ &#xA;t_1 &amp;amp; = x_1 - x_0 \\&#xA;t_2 &amp;amp; = x_2 - x_0&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then each design matrix will be of the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;A = &#xA;\begin{bmatrix}&#xA; t_{-2}^0 &amp;amp;  t_{-2}^1 &amp;amp; t_{-2}^2 \\&#xA; t_{-1}^0 &amp;amp;  t_{-1}^1 &amp;amp; t_{-1}^2 \\&#xA; t_0^0 &amp;amp;  t_0^1 &amp;amp; t_0^2 \\&#xA; t_1^0 &amp;amp;  t_1^1 &amp;amp; t_1^2 \\&#xA; t_2^0 &amp;amp;  t_2^1 &amp;amp; t_2^2&#xA;\end{bmatrix} =&#xA;\begin{bmatrix}&#xA; 1 &amp;amp;  t_{-2} &amp;amp; t_{-2}^2 \\&#xA; 1 &amp;amp;  t_{-1} &amp;amp; t_{-1}^2 \\&#xA; 1 &amp;amp;  0 &amp;amp; 0 \\&#xA; 1 &amp;amp;  t_1 &amp;amp; t_1^2 \\&#xA; 1 &amp;amp;  t_2 &amp;amp; t_2^2&#xA;\end{bmatrix}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first row of the pseudoinverse of $A$ &lt;a href=&quot;http://en.wikipedia.org/wiki/Dot_product&quot;&gt;dotted&lt;/a&gt; with the local sample values will yield $c_0$, the smoothed value at that sample.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-06-07T03:51:42.250" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9495" PostTypeId="2" ParentId="2312" CreationDate="2013-06-07T05:53:19.427" Score="2" Body="&lt;p&gt;Nice question and enlightening answers. I wanted to share few insights as follows. There exist orthogonal polynomial bases also such as Legendre's polynomial bases (in contrast to monomial bases) which are more stable in fitting higher degree polynomials. As sinc bases used in Shannon's interpolation formula (which indeed can also be seen as a convolution operation and hence a filtering operation) are orthogonal bases for a bandlimited Hilbert space, orthogonal polynomial bases may serve to approximate a larger class of functions not in the bandlimited space together with having the power of orthogonality with them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Polynomial filtering (not interpolation) has also been there in Chemistry literature since 1960. A good lecture note on revisiting this topic has been written by R.Schafer titled, What is Savitzky-Golay Filter , link: &lt;a href=&quot;http://www-inst.eecs.berkeley.edu/~ee123/fa12/docs/SGFilter.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www-inst.eecs.berkeley.edu/~ee123/fa12/docs/SGFilter.pdf&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2013-06-07T05:53:19.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9496" PostTypeId="2" ParentId="9421" CreationDate="2013-06-07T06:43:33.620" Score="0" Body="&lt;p&gt;Consider the filter to be $h[n]$. Now give a DC input, i.e $x[n]=c$ (a constant) $\forall n$. Now the output of the filter using convolution will be,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n]=x[n]*h[n]=c\sum_{k=0}^{N-1} h[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the DC content of $h[n]$ is equal to frequency content or strength at the zeroth bin of the DFT, i.e $H(0)=\sum_{k=0}^{N-1} h[k]=1$ will enable a gain of 1 and for DC input such as $x[n]$ above we will get $x[n]$ at the output again ! hence no change in DC content. &lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2013-06-07T06:43:33.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9497" PostTypeId="2" ParentId="9493" CreationDate="2013-06-07T13:07:38.843" Score="1" Body="&lt;p&gt;The detection of a particular phrase in records sounded by different people may necessitate a complex speech recognition operation. Even if you train a good acoustic model, there is no guarantee that you will obtain a good recognition performance because you would also need some textual content which will constitute the &lt;code&gt;language model&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google speech recognition performs quite good and you can use its API instead of developing a system from scratch:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/8830203/is-there-an-api-for-googles-speech-recognition-technology&quot;&gt;https://stackoverflow.com/questions/8830203/is-there-an-api-for-googles-speech-recognition-technology&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can send segments of voice data to the API and get the recognition results.&lt;/p&gt;&#xA;" OwnerUserId="4737" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-06-07T13:07:38.843" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9498" PostTypeId="1" AcceptedAnswerId="9512" CreationDate="2013-06-07T14:56:36.260" Score="13" ViewCount="22150" Body="&lt;p&gt;This is simple i thought, but my naive approach led to a very noisy result. I have this sample times and positions in a file named t_angle.txt:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.768 -166.099892&#xA;0.837 -165.994148&#xA;0.898 -165.670052&#xA;0.958 -165.138245&#xA;1.025 -164.381218&#xA;1.084 -163.405838&#xA;1.144 -162.232704&#xA;1.213 -160.824051&#xA;1.268 -159.224854&#xA;1.337 -157.383270&#xA;1.398 -155.357666&#xA;1.458 -153.082809&#xA;1.524 -150.589943&#xA;1.584 -147.923012&#xA;1.644 -144.996872&#xA;1.713 -141.904221&#xA;1.768 -138.544807&#xA;1.837 -135.025749&#xA;1.896 -131.233063&#xA;1.957 -127.222366&#xA;2.024 -123.062325&#xA;2.084 -118.618355&#xA;2.144 -114.031906&#xA;2.212 -109.155006&#xA;2.271 -104.059753&#xA;2.332 -98.832321&#xA;2.399 -93.303795&#xA;2.459 -87.649956&#xA;2.520 -81.688499&#xA;2.588 -75.608597&#xA;2.643 -69.308281&#xA;2.706 -63.008308&#xA;2.774 -56.808586&#xA;2.833 -50.508270&#xA;2.894 -44.308548&#xA;2.962 -38.008575&#xA;3.021 -31.808510&#xA;3.082 -25.508537&#xA;3.151 -19.208565&#xA;3.210 -13.008499&#xA;3.269 -6.708527&#xA;3.337 -0.508461&#xA;3.397 5.791168&#xA;3.457 12.091141&#xA;3.525 18.291206&#xA;3.584 24.591179&#xA;3.645 30.791245&#xA;3.713 37.091217&#xA;3.768 43.291283&#xA;3.836 49.591255&#xA;3.896 55.891228&#xA;3.957 62.091293&#xA;4.026 68.391266&#xA;4.085 74.591331&#xA;4.146 80.891304&#xA;4.213 87.082100&#xA;4.268 92.961502&#xA;4.337 98.719368&#xA;4.397 104.172363&#xA;4.458 109.496956&#xA;4.518 114.523888&#xA;4.586 119.415550&#xA;4.647 124.088860&#xA;4.707 128.474464&#xA;4.775 132.714500&#xA;4.834 136.674385&#xA;4.894 140.481148&#xA;4.962 144.014626&#xA;5.017 147.388458&#xA;5.086 150.543938&#xA;5.146 153.436089&#xA;5.207 156.158638&#xA;5.276 158.624725&#xA;5.335 160.914001&#xA;5.394 162.984924&#xA;5.463 164.809685&#xA;5.519 166.447678&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and want to estimate velocity and accelerstion. I know that the accelerstion is constant, in this case about 55 degrees/sec^2 until the velocity is about 100 degrees/sec, then the acc is zero and velocity constant. At the end accelerstion is -55 deg/sec^2. Here is scilab code that gives gives very noisy and unusable estimates of especially the acceleration. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clf()&#xA;clear&#xA;M=fscanfMat('t_angle.txt');&#xA;t=M(:,1);&#xA;len=length(t);&#xA;x=M(:,2);&#xA;dt=diff(t);&#xA;dx=diff(x);&#xA;v=dx./dt;&#xA;dv=diff(v);&#xA;a=dv./dt(1:len-2);&#xA;subplot(311), title(&quot;position&quot;),&#xA;plot(t,x,'b');&#xA;subplot(312), title(&quot;velocity&quot;),&#xA;plot(t(1:len-1),v,'g');&#xA;subplot(313), title(&quot;acceleration&quot;),&#xA;plot(t(1:len-2),a,'r');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was thinking of using a kalman filter instead, to get better estimates. Is it appropriate here? Don't know how to formulate the filer equations, not very experienced with kalman filters. I think the state vector is velocity and accelertion and in-signal is position. Or is there a simpler method than KF, that give useful results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All suggestions welcome!&#xA;&lt;img src=&quot;https://i.stack.imgur.com/NhNLL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4762" LastEditorUserId="128" LastEditDate="2019-10-13T12:39:38.947" LastActivityDate="2019-10-13T12:39:38.947" Title="Given Position Measurements, How to Estimate Velocity and Acceleration" Tags="|kalman-filters|estimation|filtering|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9499" PostTypeId="2" ParentId="9498" CreationDate="2013-06-07T16:33:39.773" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/8869/80&quot;&gt;You should probably just do the same as in this question and answer,&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: removed reference to two-dimensions; the code actually only uses one (the other is the time variable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, your time samples do not appear to be evenly spaced.  That is more of an issue.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-06-07T17:26:27.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9500" PostTypeId="2" ParentId="9421" CreationDate="2013-06-07T19:38:58.840" Score="0" Body="&lt;p&gt;If your boss, supervisor, customer or whatever had a look at (or measured) your lowpass frequency response and it provides gain in the passband they would definitely lift their eyebrows and start asking questions. There can be 'internal/practical' reasons as to why your filter must have an input gain (that can be merged into the actual filter coefficients) but it is preferable to restore the gain later on. It is then possible to argue that your filter has non-zero gain at DC but externally it does not appear so.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-06-07T19:38:58.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9501" PostTypeId="1" CreationDate="2013-06-07T23:21:17.513" Score="5" ViewCount="2516" Body="&lt;p&gt;I am not very experienced in signal processing, and it seems like this should be a simple problem. I have two computers, one plays a tone a 19 kHz at a sampling rate of 44.1 kHz, and the other listens with a sampling rate of 44.1 kHz and tries to find if the 19kHz tone is present. The transmission of the signal is in a noisy environment, and I have tried to find the amplitude of the 19 kHz wave using an FFT as well as Goertzel, but neither has given me a conclusive value (the amplitudes are very small).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the FFT, I am using JTransform, running the forwardFFT, then finding the bin in which 19 kHz lies and getting the amplitude by (imaginary * imaginary + real * real) for the components of that frequency bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Goertzel, I followed the pseudo-code on this site: &lt;a href=&quot;http://www.mstarlabs.com/dsp/goertzel/goertzel.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.mstarlabs.com/dsp/goertzel/goertzel.html&lt;/a&gt;. I feel like both the FFT and Goertzel should give the same amplitude if the sample size is the same, but they give different values for that frequency bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expect the amplitude to be greater than 10, but I do not believe this is working. I believe I need to at least filter out the noise below 19 kHz as a first step, but am unsure. Maybe some highpass filtering should be done first? Any suggestions on how to detect the 19 kHz sine wave? Thank you.&#xA;Updated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot of the raw data I am getting from the microphone:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KLE47.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like this is just noise, but I am unsure.&lt;/p&gt;&#xA;" OwnerUserId="4764" LastEditorUserId="80" LastEditDate="2013-10-08T18:59:59.383" LastActivityDate="2019-08-06T21:53:11.290" Title="Detecting a single frequency in noisy data" Tags="|filters|discrete-signals|filter-design|java|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9502" PostTypeId="2" ParentId="9501" CreationDate="2013-06-08T00:00:57.773" Score="1" Body="&lt;p&gt;For a decision criteria, compare the energy in the 19 kHz FFT result bin to other adjacent frequency bins and decide whether the magnitudes are different by a statistically sufficient amount, given your noise  distribution and level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also want the determine, via other means, that the speaker response curve and microphone anti-aliasing filter in your setup don't roll off below 19 kHz.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-06-10T04:01:11.667" LastActivityDate="2013-06-10T04:01:11.667" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9503" PostTypeId="1" AcceptedAnswerId="9505" CreationDate="2013-06-08T08:29:44.200" Score="1" ViewCount="696" Body="&lt;p&gt;I'm trying to get MFCC from speech audio data. I'm using 26 Mel Filter on 0-24kHz spectrum. My MFCCs doesn't look correct to me, cause always first bins have high values and values getting smaller through the high frequency bins, even with high frequency audio data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I realized that the cos((PI/N)*(n+0.5)*k) part in the DCT &lt;strong&gt;Type II&lt;/strong&gt; formula, causes this result. Here is how the value of that cos() part changes by increasing the number of mel filter bin:&#xA;&lt;a href=&quot;http://img402.imageshack.us/img402/5994/dctresult.png&quot; rel=&quot;nofollow&quot;&gt;http://img402.imageshack.us/img402/5994/dctresult.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I multiply the mel filter bank energies with that cos() part, the MFCCs have only low frequencies and high frequencies are getting suppressed. MFCC result of a &quot;s&quot; sound has a frequency of 5khz-10khz:&#xA;&lt;a href=&quot;http://img9.imageshack.us/img9/4279/mfccresult.png&quot; rel=&quot;nofollow&quot;&gt;http://img9.imageshack.us/img9/4279/mfccresult.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code of DCT(Discrete Cosine Transform) step:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;numofMelFilters = 26;&#xA;numofMFCCs = 26;    // This ll be 12..&#xA;for(int k=0; k&amp;lt;numofMFCC; k++){&#xA;   for(int n=0; n&amp;lt;numofMelFilters; n++){&#xA;   MFCC[k] += melEnergies[n] * cos((PI / (double)numofMelFilters) * (n + 0.5) * k);&#xA;   }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can't find out what I am doing wrong, any help will be appreciated. Thanks in advance..&lt;/p&gt;&#xA;" OwnerUserId="4765" LastActivityDate="2013-06-08T10:18:33.733" Title="DCT step suppress high frequencies in MFCC extraction process" Tags="|mfcc|dct|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9504" PostTypeId="2" ParentId="9503" CreationDate="2013-06-08T09:20:39.763" Score="0" Body="&lt;p&gt;In case you are using constant energy triangular filters (with BW constant on a mel scale hence increasing with center freq. on a linear scale), then the peak value in the freq. response will decrease with center freq. for the different triangular filters. This weight the response to high frequencies by a smaller amount than the response to low frequencies.  &lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2013-06-08T09:20:39.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9505" PostTypeId="2" ParentId="9503" CreationDate="2013-06-08T10:18:33.733" Score="1" Body="&lt;p&gt;I think you misinterpret the output coefficients of the DCT. If you want to look at the frequency content of your input signal, you need to look at the output of the triangular filter bank, &lt;em&gt;before&lt;/em&gt; the DCT. So if there is a fricative, like an &quot;s&quot; sound, the outputs of the high frequency filter bank kernels will have a higher energy than when the input is a vowel. However, after the DCT you do not have this type of frequency information, because you take the DCT of a frequency-domain signal, not of a time-domain signal. So the &quot;high-frequency&quot; bins of the DCT output correspond to fast variations in the shape of the spectrum, not to high frequencies in the input (time-domain) signal. The very effect you see, is exactly what the DCT is supposed to do. It compresses the input data, in the sense that almost all information is contained in the lower DCT bins. Usually the higher DCT bins are not used, which in fact means that you are doing lossy compression of your data. Luckily it turns out the the information that is being thrown away is actually irrelevant for the performance of the speech recognizer, and neglecting this information makes the recognition even more robust.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, of course there can still be a bug in your code, but the effect you describe is actually a desired result and nothing to worry about.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-08T10:18:33.733" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9506" PostTypeId="1" CreationDate="2013-06-08T11:36:51.567" Score="1" ViewCount="3018" Body="&lt;p&gt;i am interested  if where can i find matlab code for  Prony method for frequency estimation.there is  pdf article  about prony &#xA;&lt;a href=&quot;https://www.google.ge/#site=&amp;amp;source=hp&amp;amp;q=prony+method+for+distorted+signal&amp;amp;oq=prony+method+for+distorted+signal&amp;amp;gs_l=hp.3...2187.8079.0.8365.0.0.0.0.0.0.0.0..0.0.ernk_timediscountc..0.0...1.1.16.hp.enCwRCZuhe0&amp;amp;bav=on.2,or.&amp;amp;bvm=bv.47534661,d.bGE&amp;amp;fp=79e233fb1755afd8&amp;amp;biw=1280&amp;amp;bih=675&quot; rel=&quot;nofollow&quot;&gt;https://www.google.ge/#site=&amp;amp;source=hp&amp;amp;q=prony+method+for+distorted+signal&amp;amp;oq=prony+method+for+distorted+signal&amp;amp;gs_l=hp.3...2187.8079.0.8365.0.0.0.0.0.0.0.0..0.0.ernk_timediscountc..0.0...1.1.16.hp.enCwRCZuhe0&amp;amp;bav=on.2,or.&amp;amp;bvm=bv.47534661,d.bGE&amp;amp;fp=79e233fb1755afd8&amp;amp;biw=1280&amp;amp;bih=675&lt;/a&gt;&#xA;first one is   about  prony.so what i ant is that for given  signal,prony  method should return Amplitudes,damping factor and phase shift and also this parameters should minimize  sum of squared error.in matlab webpase there is prony for filter design,but i think  this  method is not what i am looking for,please  could  you help  how to find code for prony method in matlab?&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastActivityDate="2013-06-08T11:36:51.567" Title="Prony method for frequency estimation in matlab" Tags="|signal-analysis|estimation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9507" PostTypeId="1" AcceptedAnswerId="9517" CreationDate="2013-06-08T13:48:51.690" Score="2" ViewCount="5572" Body="&lt;p&gt;I am beginner and I want a help to know how to detect hand in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I need code which detects skin and then draw a rectangle around a region so it show to me face and hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to make rectangle only around hand and the hand is away from the face, the the rectangle is drawn around the face instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I need to do to discount the face and only draw the rectangle around the hand?&lt;/p&gt;&#xA;" OwnerUserId="4766" LastEditorUserId="53" LastEditDate="2014-12-31T22:18:14.503" LastActivityDate="2014-12-31T22:18:14.503" Title="Hand detection in matlab" Tags="|image-processing|matlab|computer-vision|matlab-cvst|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9508" PostTypeId="2" ParentId="9484" CreationDate="2013-06-08T14:06:45.330" Score="0" Body="&lt;p&gt;Here is my solution. I don't know whether it is the best one but it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply, I created a transfer function with 2 resonant poles at 50Hz, and 2 zeros right after. In this way, the bode diagram is the opposite of the classical notch filter&lt;/p&gt;&#xA;" OwnerUserId="4197" LastActivityDate="2013-06-08T14:06:45.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9509" PostTypeId="1" AcceptedAnswerId="9513" CreationDate="2013-06-08T15:20:40.117" Score="1" ViewCount="1972" Body="&lt;p&gt;I am currently in need for filtering accelerometer data for an Android application.&#xA;First of all, I used a simple low-pass filter (simple infinite impulse response filter) as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i from 1 to n&#xA;   y[i] := y[i-1] + α * (x[i] - y[i-1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This helped me achieve a smoother result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I decided to play with FFTs. I used a fast-fourier transform to get the signal into frequency domain and then zeroed some of the high frequencies. Then using inverse fourier transform I recreated the signal. This all worked fine and I know that the FFT and IFT implementations are fine. However, the signal wasn't as smooth as the one that I got from before using the simple infinite impulse response filter. I tried zeroing some further frequencies but didn't give me as good of a result as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the reason behind this? I though using FFTs and IFT should technically give me a nice smooth graphs. Is this because of the sampling in FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4767" LastActivityDate="2013-06-08T19:12:20.343" Title="Low pass signal filtering using FFT or simple infinite impulse response filter" Tags="|fft|filters|fourier-transform|lowpass-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9510" PostTypeId="1" CreationDate="2013-06-08T16:18:15.620" Score="2" ViewCount="183" Body="&lt;p&gt;i'm looking for a free/opensource solution for digital image processing with reasonable performances processing quite large images (e.g. actual smartphones have resolutions of 8-10Mpx) and being ready for fast-prototyping/research.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Octave would be a good solution as it provides a lot of statistical and matrix manipulation tools. However octave is too slow when running nested loops and the provided image package is too slow when displaying images.&lt;/li&gt;&#xA;&lt;li&gt;Octave + MIJ would be a better solution but actually seems unusable and unstable because of slowness and because of the different datatype handling needs.&lt;/li&gt;&#xA;&lt;li&gt;OpenCV has excellent performances but it's not really handy for fast prototyping because i actually would need something like a scripting language (no compilation, online code/variable modification and so on...) and some tools (like octave has) for plotting functions, graphs, histograms and make statistical calculations.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any advise?&#xA;Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="4768" LastEditorUserId="5105" LastEditDate="2018-07-06T22:27:38.887" LastActivityDate="2018-07-06T22:27:38.887" Title="Digital Image Processing Framework" Tags="|discrete-signals|image-processing|matrix|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9512" PostTypeId="2" ParentId="9498" CreationDate="2013-06-08T18:02:16.527" Score="12" Body="&lt;p&gt;One approach would be to cast the problem as least-squares smoothing. The idea is to locally fit a polynomial with a moving window, then evaluate the derivative of the polynomial. &lt;a href=&quot;https://dsp.stackexchange.com/a/9494/35&quot;&gt;This answer about Savitzky-Golay filtering&lt;/a&gt; has some theoretical background on how it works for nonuniform sampling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, code is probably more illuminating as to the benefits/limitations of the technique. The following &lt;a href=&quot;http://en.wikipedia.org/wiki/NumPy&quot; rel=&quot;nofollow noreferrer&quot;&gt;numpy&lt;/a&gt; script will calculate the velocity and acceleration of a given position signal based on two parameters: 1) the size of the smoothing window, and 2) the order of the local polynomial approximation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Example Usage:&#xA;# python sg.py position.dat 7 2&#xA;&#xA;import math&#xA;import sys&#xA;&#xA;import numpy as np&#xA;import numpy.linalg&#xA;import pylab as py&#xA;&#xA;def sg_filter(x, m, k=0):&#xA;    &quot;&quot;&quot;&#xA;    x = Vector of sample times&#xA;    m = Order of the smoothing polynomial&#xA;    k = Which derivative&#xA;    &quot;&quot;&quot;&#xA;    mid = len(x) / 2        &#xA;    a = x - x[mid]&#xA;    expa = lambda x: map(lambda i: i**x, a)    &#xA;    A = np.r_[map(expa, range(0,m+1))].transpose()&#xA;    Ai = np.linalg.pinv(A)&#xA;&#xA;    return Ai[k]&#xA;&#xA;def smooth(x, y, size=5, order=2, deriv=0):&#xA;&#xA;    if deriv &amp;gt; order:&#xA;        raise Exception, &quot;deriv must be &amp;lt;= order&quot;&#xA;&#xA;    n = len(x)&#xA;    m = size&#xA;&#xA;    result = np.zeros(n)&#xA;&#xA;    for i in xrange(m, n-m):&#xA;        start, end = i - m, i + m + 1&#xA;        f = sg_filter(x[start:end], order, deriv)&#xA;        result[i] = np.dot(f, y[start:end])&#xA;&#xA;    if deriv &amp;gt; 1:&#xA;        result *= math.factorial(deriv)&#xA;&#xA;    return result&#xA;&#xA;def plot(t, plots):&#xA;    n = len(plots)&#xA;&#xA;    for i in range(0,n):&#xA;        label, data = plots[i]&#xA;&#xA;        plt = py.subplot(n, 1, i+1)&#xA;        plt.tick_params(labelsize=8)&#xA;        py.grid()&#xA;        py.xlim([t[0], t[-1]])&#xA;        py.ylabel(label)&#xA;&#xA;        py.plot(t, data, 'k-')&#xA;&#xA;    py.xlabel(&quot;Time&quot;)&#xA;&#xA;def create_figure(size, order):&#xA;    fig = py.figure(figsize=(8,6))&#xA;    nth = 'th'&#xA;    if order &amp;lt; 4:&#xA;        nth = ['st','nd','rd','th'][order-1]&#xA;&#xA;    title = &quot;%s point smoothing&quot; % size&#xA;    title += &quot;, %d%s degree polynomial&quot; % (order, nth)&#xA;&#xA;    fig.text(.5, .92, title,&#xA;             horizontalalignment='center')&#xA;&#xA;def load(name):&#xA;    f = open(name)    &#xA;    dat = [map(float, x.split(' ')) for x in f]&#xA;    f.close()&#xA;&#xA;    xs = [x[0] for x in dat]&#xA;    ys = [x[1] for x in dat]&#xA;&#xA;    return np.array(xs), np.array(ys)&#xA;&#xA;def plot_results(data, size, order):&#xA;    t, pos = load(data)&#xA;    params = (t, pos, size, order)&#xA;&#xA;    plots = [&#xA;        [&quot;Position&quot;,     pos],&#xA;        [&quot;Velocity&quot;,     smooth(*params, deriv=1)],&#xA;        [&quot;Acceleration&quot;, smooth(*params, deriv=2)]&#xA;    ]&#xA;&#xA;    create_figure(size, order)&#xA;    plot(t, plots)&#xA;&#xA;if __name__ == '__main__':&#xA;    data = sys.argv[1]&#xA;    size = int(sys.argv[2])&#xA;    order = int(sys.argv[3])&#xA;&#xA;    plot_results(data, size, order)&#xA;    py.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are some example plots (using the data you provided) for various parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/csRkF.png&quot; alt=&quot;3pt smoothing, 2nd degree polynomial&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ex6NY.png&quot; alt=&quot;7pt smoothing, 2nd degree polynomial&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7hmhF.png&quot; alt=&quot;11pt smoothing, 2nd degree polynomial&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1G3Jv.png&quot; alt=&quot;11pt smoothing, 4th degree polynomial&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/o2ypm.png&quot; alt=&quot;11pt smoothing, 10th degree polynomial&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note how the piecewise constant nature of the acceleration becomes less obvious as the window size increases, but can be recovered to some extent by using higher-order polynomials. Of course, other options involve applying a first derivative filter twice (possibly of different orders). Another thing that should be obvious is how this type of Savitzky-Golay filtering, since it uses the midpoint of the window, truncates the ends of the smoothed data more and more as the window size increases. There are various ways to solve that problem, but one of the better ones is described in the following paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;P.A. Gorry, General least-squares smoothing and differentiation by the&#xA;  convolution (Savitzky–Golay) method, Anal. Chem. 62 (1990) 570–573. (&lt;a href=&quot;http://www.google.com/#sclient=psy-ab&amp;amp;q=General+Least-Squares+Smoothing+and+Differentiation+by+the+Convolution+%28Savitzky-Golay%29+Method&quot; rel=&quot;nofollow noreferrer&quot;&gt;google&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Another paper by the same author describes a more efficient way to smooth nonuniform data than the straightforward method in the example code:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;P.A. Gorry, General least-squares smoothing and differentiation of&#xA;  nonuniformly spaced data by the convolution method, Anal. Chem. 63&#xA;  (1991) 534–536. (&lt;a href=&quot;http://www.google.com/#sclient=psy-ab&amp;amp;q=General+least-squares+smoothing+and+differentiation+of+nonuniformly+spaced+data+by+the+convolution+method&quot; rel=&quot;nofollow noreferrer&quot;&gt;google&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Finally, one more paper worth reading in this area is by Persson and &lt;a href=&quot;http://de.wikipedia.org/wiki/Gilbert_Strang&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strang&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;P.O. Persson, G. Strang, Smoothing by Savitzky–Golay and Legendre&#xA;  Filters, Comm. Comp. Finance 13 (2003) 301–316. (&lt;a href=&quot;http://persson.berkeley.edu/pub/persson03smoothing.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;pdf link&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It contains much more background theory, and concentrates on error analysis for choosing a window size.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-06-08T18:02:16.527" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9513" PostTypeId="2" ParentId="9509" CreationDate="2013-06-08T19:12:20.343" Score="7" Body="&lt;p&gt;There are three potential problems with what you are doing:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Zeroing out the high frequencies causes ringing due to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gibbs_phenomenon&quot;&gt;Gibbs phenomenon&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;You are essentially multiplying the Fourier transform with a square function, which is equivalent to circularly convolving the time-domain data with the inverse transform of the square function, which is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot;&gt;sinc function&lt;/a&gt;.  Unless you zero-pad the data before transforming it, the circular convolution will cause the data at the end of the FFT block to affect the data at the beginning, and vice versa.&lt;/li&gt;&#xA;&lt;li&gt;If you were doing multiple FFT's to process a stream of data, unless you use a technique like &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot;&gt;Overlap-Add&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot;&gt;Overlap-Save&lt;/a&gt;, there will be discontinuities at the boundaries between FFT blocks.  This problem is related to #2.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-06-08T19:12:20.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9514" PostTypeId="1" CreationDate="2013-06-08T21:29:04.957" Score="4" ViewCount="12828" Body="&lt;p&gt;Im trying to cross correlate two signals in matlab and get the phase difference between the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For cross correlation (the idea is to do it without xcorr) I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Cxx=fftshift(ifft(fft(x,N).*conj(fft(y,N))))/(norm(x) * norm(y));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the result and not sure about the reference point I have to take for phase calculation Now which point should I take as zero on time scale and how do I get the phase difference from this result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4770" LastEditorUserId="80" LastEditDate="2013-06-08T22:06:55.260" LastActivityDate="2018-03-03T11:34:16.427" Title="How do I get the phase angle from Cross Correlation?" Tags="|cross-correlation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9515" PostTypeId="2" ParentId="9514" CreationDate="2013-06-09T01:08:15.320" Score="5" Body="&lt;p&gt;There is no such thing as the phase angle between two signals unless they both consist of a single sinusoid at the same frequency, that is, $x(t) = A\cos(\omega t+\psi)$&#xA;and $y(t) = B\cos(\omega t + \phi)$.  If you have $N$ samples of these signals $x(t)$ and&#xA;$y(t)$, taken at times $0$, $T$, $2T, \ldots$, $(N-1)T$, so that&#xA;$$x[n] = x(nT), ~~ y[n] = y(nT), 0 \leq n &amp;lt; N,$$ and either $N\omega T$ is an&#xA;integer multiple of $2\pi$ or $N\omega T \gg 1$&#xA;then the phase angle between the two sinusoids is&#xA;$$\theta &#xA;= \arccos\left(\frac{\displaystyle \sum_{n=0}^{N-1} x[n]y[n]}{\sqrt{\displaystyle &#xA;\sum_{n=0}^{N-1}(x[n])^2\displaystyle \sum_{n=0}^{N-1}(y[n])^2}}\right).&#xA;\tag{1}$$&#xA;For &lt;em&gt;complex-valued&lt;/em&gt; sinusoids $x(t) = Ae^{j(\omega t+\psi)}$ and&#xA;$y(t) = BAe^{j(\omega t+\phi)}$, $(1)$ should be replaced by&#xA;$$\theta &#xA;= \arccos\left(\frac{\displaystyle \sum_{n=0}^{N-1} x[n](y[n])^*}{\sqrt{\displaystyle &#xA;\sum_{n=0}^{N-1}|x[n]|^2\displaystyle \sum_{n=0}^{N-1}|y[n]|^2}}\right).&#xA;\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, these formula can be used for &lt;em&gt;arbitrary&lt;/em&gt; signals, not just for pure sinusoids,&#xA;but then, what you get is the _angle between the two vectors &#xA;$\mathbf x = (x[0], x[1], \ldots, x[N-1])$ and &#xA;$\mathbf y =(y[0], y[1], \ldots, y[N-1])$ in the $N$-dimensional spaces&#xA;$\mathbb R^N$ or $\mathbb C^N$, and not a &lt;em&gt;phase&lt;/em&gt; angle between two sinusoids &#xA;at the same frequency.&#xA;Note that the three points $\mathbf 0 = (0,0,\ldots,0)$, $\mathbf x$ and&#xA;$\mathbf y$ lie in a (two-dimensional) plane in $N$-dimensional space and&#xA;the $\theta$ that you get is the angle between the line segments with endpoints&#xA;$\mathbf 0$ and $\mathbf x$ and endpoints $\mathbf 0$ and $\mathbf y$ which&#xA;lie in this plane. Another way to think about this is that&#xA;$$\langle\mathbf x, \mathbf y\rangle = ||\mathbf x||\cdot||\mathbf y||\cdot\cos(\theta)$$&#xA;and thus $(1)$ is obtained from&#xA;$$\cos(\theta) &#xA;= \frac{\langle\mathbf x, \mathbf y\rangle}{||\mathbf x||\cdot||\mathbf y||}&#xA;= \frac{\displaystyle \sum_{n=0}^{N-1} x[n](y[n])^*}{\sqrt{\displaystyle &#xA;\sum_{n=0}^{N-1}|x[n]|^2}\sqrt{\displaystyle \sum_{n=0}^{N-1}|y[n]|^2}}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;em&gt;must&lt;/em&gt; use FFTs because that's the way you have been told to do it, then you have&#xA;$$\theta = \arccos\left(\frac{\displaystyle \sum_{n=0}^{N-1} X[n](Y[n])^*}{\sqrt{\displaystyle &#xA;\sum_{n=0}^{N-1}|X[n]|^2\displaystyle \sum_{n=0}^{N-1}|Y[n]|^2}}\right)\tag{3}$$&#xA;so that you have the ineffable pleasure of not only needing to&#xA;compute two FFTs first, but also of using complex multiplications in $(3)$&#xA;instead of the real multiplications in $(1)$ (for real-valued&#xA;signals).  This is overkill in my estimation,&#xA;but as usual, YMMV, and what your boss insists on is always right, regardless&#xA;of what people write on Internet forums.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-06-10T13:44:52.817" LastActivityDate="2013-06-10T13:44:52.817" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9516" PostTypeId="2" ParentId="9514" CreationDate="2013-06-09T03:05:34.763" Score="1" Body="&lt;p&gt;If you can use the FFTs of x and y to get some sort of periodicity estimates from these two signals, and they are similar (or you have the periodicity a-priori), then one phase angle difference measure might be 2pi times the ratio between the cross-correlation lag and your periodicity estimate.  Note that this works even if the signals are not sine waves or even have a missing fundamental component (by using the FFTs with a pitch estimation method such a cepstral or HPS).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-06-09T03:05:34.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9517" PostTypeId="2" ParentId="9507" CreationDate="2013-06-09T04:54:33.703" Score="2" Body="&lt;p&gt;As far as I can tell, Matlab's Computer Vision toolbox provides &lt;a href=&quot;https://www.google.com.cu/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CC0QFjAA&amp;amp;url=http://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetectorclass.html&amp;amp;ei=8gK0UcKoPIG8Pf_tgNAE&amp;amp;usg=AFQjCNF4snrodCNChYWSUWK7LaICz8GHzA&amp;amp;bvm=bv.47534661,d.ZWU&quot; rel=&quot;nofollow&quot;&gt;vision.CascadeObjectDetector&lt;/a&gt; for object detection, with support only for &lt;em&gt;Frontal Face (CART),Frontal Face (LBP),Upper Body,Eye Pair,Single Eye,Single Eye (CART),Profile Face,Mouth,Nose&lt;/em&gt;. When you say:  &quot;&lt;strong&gt;&lt;em&gt;the rectangle is drawn around the face instead.&lt;/em&gt;&lt;/strong&gt;&quot;, that is happening because you are calling CascadeObjectDetector without specifying a specific object to detect, resulting in CascadeObjectDetector setting the to &lt;em&gt;FrontalFaceCART&lt;/em&gt; by default. You are probably doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;detector = vision.CascadeObjectDetector;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try doing this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;detector = vision.CascadeObjectDetector('Nose');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you'll see how the nose is detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are probably then getting excited, because it would be really easy then passing &lt;em&gt;'Hand'&lt;/em&gt; as a parameter instead of 'Nose', or anything. But unfortunately until now CascadeObjectDetector doesn't provide a model for &lt;em&gt;'Hand'&lt;/em&gt;. However, there exists a way to archieve this, the last &lt;a href=&quot;http://www.mathworks.com/help/vision/release-notes.html&quot; rel=&quot;nofollow&quot;&gt;ComputerVision&lt;/a&gt; toolbox provides the &lt;a href=&quot;https://www.google.com.cu/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CC0QFjAA&amp;amp;url=http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html&amp;amp;ei=iwi0UcieCIWkPcHLgfAF&amp;amp;usg=AFQjCNHtXw41UrzoEG_OPk4BXiR6lVsEjg&amp;amp;bvm=bv.47534661,d.ZWU&quot; rel=&quot;nofollow&quot;&gt;trainCascadeObjectDetector&lt;/a&gt; which you can use for detecting your own models(the hand for example). You'll see that this consists of a training process where you have to supply positive and negative images to develop your own detector, further explanations are given in the links. There is another useful tool you can use for this: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/39627&quot; rel=&quot;nofollow&quot;&gt;a GUI tool&lt;/a&gt; for getting easier the classification process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="3793" LastActivityDate="2013-06-09T04:54:33.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9518" PostTypeId="1" CreationDate="2013-06-09T09:19:26.853" Score="4" ViewCount="12474" Body="&lt;p&gt;Can anyone explain what are Autoregressive Coefficients? What is their meaning that is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;public double[] calculateARCoefficients(double[] inputseries, int order)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this method is called on 256 values, lets say these values represent some kind of signal, I will get an array of n numbers, where n=order. What do these numbers represent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean for example variance tells me how spread out the values of the signal are. The higher variance value is, the more spread out values are. The smaller variance is, the more unified signal is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you able to say, in a similar fashion to above paragraph about variance, what value of AR coefficients says about the signal?&lt;/p&gt;&#xA;" OwnerUserId="4772" LastEditorUserId="8202" LastEditDate="2015-06-11T08:12:12.747" LastActivityDate="2015-06-11T08:12:12.747" Title="What are Autoregressive Coefficients?" Tags="|signal-analysis|continuous-signals|autoregressive-model|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9519" PostTypeId="1" CreationDate="2013-06-09T09:51:24.823" Score="0" ViewCount="18997" Body="&lt;p&gt;I want to implement a HPF which will pass all frequencies above 150hz. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;                    % Sampling frequency&#xA;T = 1/Fs;                     % Sample time&#xA;L = 1000;                     % Length of signal&#xA;t = (0:L-1)*T;                % Time vector&#xA;% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid&#xA;x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); &#xA;&#xA;plot(Fs*t(1:50),x(1:50))&#xA;title('Signal')&#xA;xlabel('time (milliseconds)')&#xA;&#xA;pause;&#xA;&#xA;NFFT = 2^nextpow2(L); % Next power of 2 from length of y&#xA;X = fft(x,NFFT)/L;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;% Plot single-sided amplitude spectrum.&#xA;plot(f,2*abs(X(1:NFFT/2+1))) &#xA;title('Single-Sided Amplitude Spectrum of x(t)')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|X(f)|')&#xA;&#xA;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#xA;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#xA;%       Now let us see HP Filtering of this signal  &#xA;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#xA;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#xA;&#xA;&#xA;&#xA;d = fdesign.highpass('Fst,Fp,Ast,Ap,Fs', 150, 170  ,60,1, Fs);&#xA;&#xA;Hd = design(d,'equiripple');&#xA;%fvtool(Hd);&#xA;x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); &#xA;HP_Filterd_Output = filter(Hd,x);&#xA;&#xA;NFFT = 2^nextpow2(L); % Next power of 2 from length of x&#xA;HP_Filtered_Freq = fft(HP_Filterd_Output,NFFT)/L;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;% Plot single-sided amplitude spectrum of HPF.&#xA;plot(f,2*abs(HP_Filtered_Freq(1:NFFT/2+1))) &#xA;title('Single-Sided Amplitude Spectrum of HP_Filtered_Output')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|HP_Filtered_Freq_Amplitude|')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting following errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The 'Fst,Fp,Ast,Ap,Fs' enumerated value is invalid.&#xA;&#xA;Error in ==&amp;gt; C:\Program&#xA;Files\MATLAB\R2010a\toolbox\signal\signal\@fdesign\@abstracttypewspecs\schema.p&amp;gt;set_specificationtype&#xA;at 65&#xA;&#xA;&#xA;Error in ==&amp;gt; fdesign.abstracttypewspecs.abstract_setspecs at 25&#xA;    set(this, 'SpecificationType', varargin{1});&#xA;&#xA;Error in ==&amp;gt; fdesign.abstracttypewspecs.setspecs at 8&#xA;abstract_setspecs(this, varargin{:});&#xA;&#xA;Error in ==&amp;gt; fdesign.highpass.highpass at 106&#xA;this.setspecs(varargin{:});&#xA;&#xA;Error in ==&amp;gt; fftExample at 75&#xA;d = fdesign.highpass('Fst,Fp,Ast,Ap,Fs', 150, 170  ,60,1, Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess I am making some mistake in &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;d = fdesign.highpass('Fst,Fp,Ast,Ap,Fs', 150, 170  ,60,1, Fs);`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where I want to enter every thing in Hz. &lt;/p&gt;&#xA;" OwnerUserId="1598" LastActivityDate="2017-10-11T17:14:03.270" Title="Low pass filtering using MATLAB; passing frequency in Hz" Tags="|matlab|filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9521" PostTypeId="1" CreationDate="2013-06-09T15:28:42.877" Score="7" ViewCount="10533" Body="&lt;p&gt;For the purpose of controlling DIY disco lighting, I'm looking at implementing beat detection in a microcontroller with limited computing power (i.e. Arduino Uno). While detecting all beats would be a plus (for one, it would allow measuring BPM, which could be used to adjust the light to the style of music), it's not absolutely needed for this application since light setting must be typically changed at a much lower frequency than the beat. So what I'm really looking at is to detect &quot;conspicuous&quot; events in the music (beat, resume after blank, etc.) to synchronise light change, but without 100% reliability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constraints are the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Limited computing power is available. The Uno is based on a &lt;a href=&quot;http://www.atmel.com/devices/atmega328.aspx&quot; rel=&quot;noreferrer&quot;&gt;ATmega328&lt;/a&gt; 8-bit 16MHz MCU. If this is too constraining, I could consider moving to a Due, which is based on a &lt;a href=&quot;http://www.atmel.com/devices/sam3x8e.aspx&quot; rel=&quot;noreferrer&quot;&gt;AT91SAM3X8E&lt;/a&gt;, 32-bit 84MHz Cortex-M3 MCU.&lt;/li&gt;&#xA;&lt;li&gt;Noisy sound input. Ideally, the sound would be captured with a small, cheap microphone. I'm not sure yet what sampling rate can be achieved with the Uno. In any case, I expect the signal to be fairly noisy. If that proved the be required, I could possibly consider implementing a proper sound input (e.g. with the &lt;a href=&quot;http://ruggedcircuits.com/html/rugged_audio_shield.html&quot; rel=&quot;noreferrer&quot;&gt;rugged audio shield&lt;/a&gt;) but I'd rather avoid that if possible because of the constraint of hooking the music playing devices (there may be several) to the light control electronics.&lt;/li&gt;&#xA;&lt;li&gt;Ideally, the algorithm would have a parameter to adjust sensitivity to beat event detection. That way, the sensitivity could be automatically increased to make sure events are detected even in bad conditions (low music volume, noise from conversations, etc.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My questions are thus:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What (class of) algorithm would fit appropriately this application?&lt;/li&gt;&#xA;&lt;li&gt;Is there any implementation available that could be readily integrated in a Arduino project?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4773" LastEditorUserId="4773" LastEditDate="2013-06-09T17:53:25.787" LastActivityDate="2014-10-13T21:20:37.467" Title="Simple beat detection algorithm for microcontroller" Tags="|audio|algorithms|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9522" PostTypeId="1" CreationDate="2013-06-09T15:35:04.253" Score="3" ViewCount="2319" Body="&lt;p&gt;This code was working fine when I asked about it in &lt;a href=&quot;https://dsp.stackexchange.com/questions/9479/filter-is-too-large&quot;&gt;Filter is too large&lt;/a&gt; but when I tried it again on another PC it gives me this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Warning: Direct access of structure fields returned by a function call (e.g.,&#xA;                  call to Untitled2) is not allowed. See MATLAB 7.10 Release Notes, &quot;Subscripting      Into     Function Return Values&quot; for details. &#xA;    ??? Attempt to reference field of non-structure array.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This forwarded me to help about &quot;Subscripting Into Function Return Values&quot;, where if you have a function, such as the following, that returns a struct array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function structOut = getStruct&#xA;structOut = struct('fieldA', 5, 'fieldB', 10);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is no longer valid to access fields of the structure by directly dot indexing the function's return value, as shown here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;getStruct.fieldA&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead, you should first assign the returned structure to a variable, and then dot index the variable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = getStruct;&#xA;s.fieldA&#xA;ans =&#xA;     5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I apply it to multiply values?&lt;/p&gt;&#xA;" OwnerUserId="4754" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-07-05T01:35:01.080" Title="Direct access of structure fields returned by a function call" Tags="|matlab|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9524" PostTypeId="2" ParentId="9314" CreationDate="2013-06-09T18:47:16.430" Score="1" Body="&lt;p&gt;You might also use normalized cross correlation between the images&lt;/p&gt;&#xA;&#xA;&lt;p&gt;matlab has an awesome tutorial on the subject:&#xA;&lt;a href=&quot;http://www.mathworks.com/help/images/examples/registering-an-image-using-normalized-cross-correlation.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/images/examples/registering-an-image-using-normalized-cross-correlation.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its very useful to use in situations where it is not as up-front as a rectangle on a black background&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2013-06-09T18:47:16.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9525" PostTypeId="1" AcceptedAnswerId="9559" CreationDate="2013-06-09T19:02:42.143" Score="4" ViewCount="888" Body="&lt;p&gt;I am working on a university project in which I need to find a periodic net element in an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The net is a set of diagonal lines in a specific angle ( which I don't know in advance ) on a noisy image. They are hard to detect so I would like to use all the information I can get my hands on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PW5Qk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current algorithm is based on using edge detection + hough transform to find lines at specific angle range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there is any way to detect periodic signals in image? Something based on ff2 or something like that...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="4727" LastEditorUserId="4727" LastEditDate="2013-06-11T19:35:19.803" LastActivityDate="2013-06-13T02:05:58.553" Title="Detection periodic elements in image" Tags="|image-processing|computer-vision|image-segmentation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9526" PostTypeId="2" ParentId="2555" CreationDate="2013-06-09T19:46:05.370" Score="1" Body="&lt;p&gt;About pichenettes' comment, &quot;During the attack stage, the capacitor is charged with a +15V step, but the attack stage ends when a threshold of +10V has been reached. This is a design choice, though 2/3 is the &quot;magic number&quot; found in many classic envelope generator, and this might be the one musicians are familiar with.&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any envelope that's shooting for a 15v asymptote with a 10v target is, practically, creating a linear attack. It's just that 15v is the highest asymptote available easily, and it's close enough to linear. That is, there's nothing &quot;magic&quot; about it—they're just going for as linear as they can get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how many classic synths use 15v—I'd suspect there's often a diode drop or two. My old Aries modular uses 13v for a 10v envelope, and I just looked up the a Curtis ADSR chip that uses, equivalently, 6.5v for a 5v envelope.&lt;/p&gt;&#xA;" OwnerUserId="4774" LastActivityDate="2013-06-09T19:46:05.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9527" PostTypeId="2" ParentId="9518" CreationDate="2013-06-09T20:07:12.720" Score="2" Body="&lt;p&gt;The coefficients $a_i$ of an autoregressive (AR) model of a signal $x(n)$ enter the model definition in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=\sum_{i=1}^Na_ix(n-i)+e(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $e(n)$ is zero-mean white noise and $N$ is the model order. I.e. the signal is modeled as the output of a linear time-invariant filter with transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{1-\sum_{i=1}^Na_iz^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and with input signal $e(n)$. There is no simple interpretation of specific values of the coefficients $a_i$. You have to look at the whole polynomial $1-\sum_{i=1}^Na_iz^{-1}$, e.g. by computing the power spectrum of the AR model of $x(n)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_x(z)=\sigma_e^2\left|\frac{1}{1-\sum_{i=1}^Na_iz^{-1}}\right|^2,\quad z=e^{j\theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\sigma_e^2$ is the variance of $e(n)$. So the AR coefficients are the parameters of a specific signal model, and they do not have a simple interpretation comparable to mean or variance of a random process. However, in general they represent a much more detailed description of the signal than mean and variance alone.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-09T20:07:12.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9528" PostTypeId="2" ParentId="2578" CreationDate="2013-06-10T00:03:07.290" Score="2" Body="&lt;p&gt;It is important to note that $x_k$ is NOT a random variable. It is the system's state which is deterministic, which is in general, variable in $k$.&#xA;$$&#xA;E(\hat{x}_{k|k}) =  x_k&#xA;$$&#xA;which is equivalent of saying&#xA;$$&#xA;E(\hat{x}_{k|k} - x_k) = 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also,&#xA;$$Var(x_k) = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_{k|k} = Var(\hat{x}_{k|k})$$&#xA;which, given that $x_k$ is deterministic, happens to be  also equal to $Var(\hat{x}_{k|k} - x_k)$&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;$x_k$ is the system state which is deterministic. This is as opposed to the the system noise, which is represented in most literature as $w$ with variance $Q$. Even more, some literature models the system noise with a coefficents matrix; in which case the $Q$ matrix is replaced by $GQG^T$ in the propagation estimate, where $G$ is the noise coefficeint matrix. To elaborate, the system representation, in this case, is given by:&#xA;$$&#xA;x_{k+1} = Ax_k + Bu_k +Gw&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a refernce: Kalman's paper himself:&lt;code&gt;http://160.78.24.2/Public/Kalman/Kalman1960.pdf&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4634" LastEditorUserId="4634" LastEditDate="2013-06-10T13:11:39.613" LastActivityDate="2013-06-10T13:11:39.613" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="9529" PostTypeId="1" CreationDate="2013-06-10T00:45:00.310" Score="1" ViewCount="925" Body="&lt;p&gt;I am trying to make a frequency domain adaptive filter in matlab. It uses matlab adaptfilt.fdaf to create the filter parameters like step size and initializing initial filter weight values. Then I have tried to implement the overlap - save frequency domain adaaptive filter algorithm from the paper &quot;&lt;a href=&quot;http://users.isy.liu.se/en/rt/fredrik/spcourse/multirate.pdf&quot; rel=&quot;nofollow&quot;&gt;Frequency-domain and multirate adaptive filtering&lt;/a&gt;&quot; by J. J. Shynk. It is also based on the source code of the thisfilter.m script that can be found in &quot;%MATLAB_FOLDER%\R2009b\toolbox\filterdesign\flterdesign\@adaptfilt\@fdaf\thisfilter.m&quot;. I used sine wave as the desired signal and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;noisy = sinewave.*(rand(1, length(t) ).') * 0.1;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as the noisy input. At the end, I plot the difference &lt;code&gt;(output - desired)&lt;/code&gt; to see how close the filter output comes to the desired signal. For the above noisy input, if I play around witht he step size and other filter parameters, I can make this difference go closer to 0 (although it never actually becomes 0, but sort of oscillates around 0) as I process more and more blocks of the input signal. However, if I then change the input to   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;noisy = sinewave + (rand(1, length(t) ).') * 0.1;&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just can't make the difference converge towards 0 no matter what I do. Either the difference increases to very high magnitude (around the range x$10^{50}$) if the step size is too high, or the difference oscillates in a roughly sine wave pattern, but never seems to go towards 0. Can anyone provide any ideas on how this can be fixed?    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few facts that I should point out here:&lt;br&gt;&#xA;When the noisy signal is &lt;code&gt;noisy = sinewave.*(rand(1, length(t) ).') * 0.1;&lt;/code&gt;, the plot of the difference &lt;code&gt;(output - desired)&lt;/code&gt; is in the range +0.3 to -0.3 for a good value of step size, that is, one that makes this plot converge and not diverge. When the noisy signal is &lt;code&gt;noisy = sinewave + (rand(1, length(t) ).') * 0.1;&lt;/code&gt; this difference is of the range +4 to -4 when the output does not diverge.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I get some good suggestions on how I can improve this code I will post further details about the source code and output.&lt;br&gt;&#xA;Here is the current version of the Matlab code. It still has some lines of code that I used for my own trouble shooting so it's not exactly like Shynk's paper right now, but this version can be compiled. It uses the &lt;code&gt;noisy = sinewave.*(rand(1, length(t) ).') * 0.1;&lt;/code&gt; version of the noisy signal. If I get some good suggestions from here I will update the source code as well for further discussion.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc&#xA;clear all&#xA;close all&#xA;% % %  Arguments to fdaf % % %&#xA;% H = ADAPTFILT.FDAF(L,STEP,LEAKAGE,DELTA,LAMBDA,BLOCKLEN,OFFSET,COEFFS, STATES)&#xA;L = 128;            % number of filter coefficients ( = n for best results; N = Block length; default = 10)&#xA;% L is the number of samples by which shifting takes place during every&#xA;% iteration&#xA;STEP = 0.6;    % mu; default = 1; corresponds to 2*mu in paper&#xA;LEAKAGE = 1;    % filter leakage, default = 1 --&amp;gt; No leakage&#xA;DELTA = 1;      % initialize and assign FFT input signal powers; should be 1 if it's effect is to be ignored; default = 1&#xA;LAMBDA = 1;     % assign averaging factor; should be 1 if it's effect is to be ignored; default = 1&#xA;BLOCKLEN = 128; % length of block, number of samples read from the input to be filtered at one iteration --&amp;gt; N; should equal L for best efficiency&#xA;OFFSET = 0;     % should be 0 to remove it's effect; default = 0&#xA;COEFFS = zeros(L, 1);   % probably initial value for filter coefficients; should be 0; default = 0 array of length L&#xA;STATES = zeros(L, 1);   % the very first &quot;previous&quot; value for input noisy signal&#xA;&#xA;% % % % % % % % % % Define input signal % % % % % % % % % % &#xA;%% Time specifications:&#xA;Fs = 8000;                   % samples per second&#xA;dt = 1/Fs;                   % seconds per sample&#xA;StopTime = 1.6;             % seconds&#xA;t = (0:dt:StopTime-dt)';     % seconds&#xA;%% Sine wave:&#xA;Fc = 60;                     % hertz&#xA;sinewave = cos(2*pi*Fc*t);&#xA;desired = sinewave;&#xA;% load rand_seq.dat&#xA;rand_seq = (rand(1, length(t) ).') * 0.1;&#xA;noisy = sinewave.*rand_seq;   % noisy signal&#xA;&#xA;% % % % % % % % % % Creating filter % % % % % % % % % % &#xA;h = adaptfilt.fdaf(L,STEP,LEAKAGE,DELTA,LAMBDA,BLOCKLEN,OFFSET,COEFFS, STATES);&#xA;x = noisy;&#xA;d = desired;&#xA;% % % % % % % % % % Applying filter % % % % % % % % % % &#xA;ntr = length(x);            %  temporary number of iterations &#xA;N = h.BlockLength;          %  block length&#xA;L = h.FilterLength;         %  number of coefficients&#xA;ntrB = floor(length(x)/N);  %  temporary number of block iterations ; --&amp;gt; has to be exactly divisible in the original function&#xA;y = zeros(size(x));         %  initialize output signal vector&#xA;e = y;                      %  initialize error signal vector&#xA;X = zeros(L+N,1);           %  initialize temporary input signal buffer&#xA;E = zeros(L+N,1);           %  initialize temporary error signal buffer&#xA;Ef = zeros(L+N,1);          %  initialize temporary error signal buffer&#xA;nnL = 1:L;                  %  index variable used for input signal buffer&#xA;nnLpN = N+1:N+L;            %  index variable used for input signal buffer&#xA;nnNpL = L+1:L+N;            %  index variable used for input signal buffer&#xA;nnLpNr = L+N:-1:N+1;        %  index variable used for coefficient updates&#xA;FFTW = h.FFTCoefficients.'; %  initialize and assign frequency domain Coefficients&#xA;normFFTX = h.Power;         %  initialize and assign FFT input signal powers&#xA;X(nnLpNr) = h.FFTStates;    %  assign input signal buffer&#xA;mu = h.StepSize;            %  assign step size&#xA;ZN = zeros(N,1);            %  assign N-dimensional zero vector&#xA;mu_k = zeros(L+N, 1);       % use seperate mu value for each frequency bin in the fft domain&#xA;                            % mu gets multiplied to values in the FFT&#xA;                            % domain, but each element of mu is a scalar&#xA;Pest = zeros(L+N, 1);&#xA;lambda = 0.8;              &#xA;alpha = 1 - lambda;&#xA;&#xA;FFTW_sample_index = zeros(ntrB, 1);&#xA;&#xA;for n=1:ntrB,&#xA;    nn = ((n-1)*N+1):(n*N); %  index for current signal blocks&#xA;    X(nnL) = X(nnLpN);      %  shift temporary input signal buffer up&#xA;    X(nnNpL) = x(nn);       %  assign current input signal vector&#xA;    FFTX = fft(X);          %  compute FFT of input signal vector; FFTX is the result of an L+N point FFT&#xA;&#xA;%     if n == 1&#xA;%         Pest = (abs(FFTX)).^2;&#xA;%     else&#xA;%         Pest = lambda * Pest + alpha * ( (abs(FFTX)).^2 );&#xA;%     end&#xA;&#xA;%     mu_k = mu ./ Pest;&#xA;&#xA;%     if mod(n, 30) == 0&#xA;% %         mu = 0.009;&#xA;%         FFTW(:, 1) = 0;&#xA;%     end&#xA;&#xA;    mu_k = mu ./( lambda + (abs(FFTX)).^2 );&#xA;    Y = ifft(FFTW.*FFTX);   %  compute current output signal vector&#xA;    y(nn) = Y(nnNpL);       %  assign current output signal block&#xA;    e(nn) = d(nn) - y(nn);  %  assign current error signal block&#xA;%     E(nnNpL) = mu*e(nn);    %  assign current error signal vector&#xA;    E(nnNpL) = e(nn);&#xA;    FFTE = fft(E);          %  compute FFT of error signal vector&#xA;%     normFFTX = bet*normFFTX + ombet*real(FFTX.*conj(FFTX));  &#xA;                            %  update FFT input signal powers&#xA;%     G = ifft(FFTE.*conj(FFTX)./(normFFTX + Offset));  &#xA;                            %  compute gradient vector&#xA;&#xA;    FFTE_multConjFFTX = FFTE.*conj(FFTX);&#xA;    G = mu_k .* FFTE_multConjFFTX;&#xA;    G = ifft(G);&#xA;&#xA;%     G = ifft(FFTE.*conj(FFTX));&#xA;    G(nnNpL) = ZN;          %  impose gradient constraint&#xA;%     FFTW = lam*FFTW + mu * fft(G);  %  update frequency domain coefficients&#xA;%     FFTW = FFTW + mu * fft(G);    % modified to FFTW = FFTW + mu_k .* fft(G);&#xA;%       FFTW = FFTW + mu_k .* fft(G);&#xA;    FFTW = FFTW + fft(G);       % USe this equation if mu_k .* FFTE_multConjFFTX; has been used above&#xA;&#xA;    FFTW_sample = abs(FFTW(25));&#xA;%     invFFTW_index(n) = sum( invFFTW )/ntrB;&#xA;    FFTW_sample_index(n) = FFTW_sample;&#xA;% &#xA;%     if n &amp;lt; 20&#xA;%         FFTW = FFTW + fft(G);       % USe this equation if mu_k .* FFTE_multConjFFTX; has been used above&#xA;%     end&#xA;&#xA;end&#xA;&#xA;if isreal(x) &amp;amp;&amp;amp; isreal(d),&#xA;    y = real(y);            %  constrain output signal to be real-valued&#xA;    e = real(e);            %  constrain error signal to be real-valued&#xA;end&#xA;&#xA;diff_here = y - desired;&#xA;figure(1); plot(diff_here);&#xA;figure(2); plot(1:ntrB, FFTW_sample_index);&#xA;% figure(2);&#xA;% plot(1:length(noisy), noisy, 'b', 1:length(y), y/4, 'r');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3121" LastActivityDate="2016-01-09T16:44:36.510" Title="adaptive filter does not converge for all inputs" Tags="|matlab|filters|filter-design|frequency-domain|adaptive-filters|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9530" PostTypeId="2" ParentId="9432" CreationDate="2013-06-10T05:11:51.147" Score="2" Body="&lt;p&gt;Kalman filter is optimal only for a linear model. It can be extended to non-linear case because all the equations in the kalman filtering algorithm are difference equations. It is only an approximate solution for the non-linear case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of Non-linear model (i.e, where state-transition equation and measurement equation are non-linear), whenever we need state-transition matrix or measurement matrix in kalman filter equations we use the linear(first-order) approximations of non-linear state-transition and measurement functionals. The jacobian comes into play because of the first order approximation of their taylor series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the non-linear functions are not used, their linear approximations are used for state prediction and estimation in EKF.&lt;/p&gt;&#xA;" OwnerUserId="1488" LastActivityDate="2013-06-10T05:11:51.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9531" PostTypeId="1" AcceptedAnswerId="9539" CreationDate="2013-06-10T07:16:55.553" Score="3" ViewCount="10650" Body="&lt;p&gt;For an FSK modulation with coherent detection, in order to ensure orthogonality, the frequency separation between symbols is $ \Delta f=f_2 - f_1 =1/2T$. However, in case of non-coherent demodulation, which must be this value $1/2T$ or $1/T$?&lt;/p&gt;&#xA;" OwnerUserId="4776" LastActivityDate="2013-06-10T13:34:51.003" Title="Orthogonality of FSK modulation for non-coherent detection" Tags="|frequency|fsk|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9532" PostTypeId="1" AcceptedAnswerId="9543" CreationDate="2013-06-10T07:33:48.187" Score="0" ViewCount="53" Body="&lt;p&gt;Can we compare the size of two objects appearing in different images with different resolutions?&lt;/p&gt;&#xA;" OwnerUserId="4777" LastActivityDate="2013-06-10T17:34:08.557" Title="Comparison of size of an entity in different images with different resolutions?" Tags="|computer-vision|image-segmentation|" AnswerCount="1" CommentCount="1" ClosedDate="2013-09-06T21:25:02.390" ContentLicense="CC BY-SA 3.0" />
  <row Id="9533" PostTypeId="1" AcceptedAnswerId="9534" CreationDate="2013-06-10T09:23:26.823" Score="0" ViewCount="66" Body="&lt;p&gt;In this code I try to decompose music from singer sound with &lt;code&gt;wfilters&lt;/code&gt; but when I hear it it is still mixed where Iam I wrong ?  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; function s = scale3(q,n)&#xA;  p = length(q);&#xA;   if p==n &#xA;   s = q;&#xA;    else &#xA;    s = resample(q,n,p);&#xA;   end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the program&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = wavread('K:\Khaleel_3aaza (1).wav'); % whatever here&#xA;&#xA; [l,h] = wfilters('sym2','d');&#xA; [z.x]=wavedec(s,2,l,h);&#xA;&#xA;p = scale3(z.x(2245001:22350000),2245000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4754" LastActivityDate="2013-06-10T09:28:27.953" Title="fliter doesn't filter" Tags="|matlab|filters|wavelet|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9534" PostTypeId="2" ParentId="9533" CreationDate="2013-06-10T09:28:27.953" Score="3" Body="&lt;p&gt;Background music and human voice occupy the same frequency ranges, so they cannot be separated by filters. See &lt;a href=&quot;https://dsp.stackexchange.com/questions/1499/how-to-extract-vocal-part-from-stereo-audio-signal/&quot;&gt;this Q&amp;amp;A&lt;/a&gt; for a few suggestions of techniques to separate human voice from background music.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-06-10T09:28:27.953" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9536" PostTypeId="1" AcceptedAnswerId="9540" CreationDate="2013-06-10T10:45:57.503" Score="2" ViewCount="584" Body="&lt;p&gt;One of the problems in Proakis's signal processing book using Matlab asks to plot the histogram of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x3(n) = x1(n) + x1(n-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;x1(n)&lt;/code&gt; is a random sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create &lt;code&gt;x1(n)&lt;/code&gt;, I do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n1 = 1:100000;&#xA;a = 0; b = 2; % interval over which to pick random numbers.&#xA;x1 = a + (b-a)*rand(100000,1);&#xA;N1 = hist(x1,100);&#xA;figure, bar(N1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To generate x3(n), I use a couple of helper-functions defined in Proakis's book.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x31,n31] = sigshift(x1,n1,1);&#xA;[x3,n3] = sigadd(x1,n1,x31,n31);&#xA;N3 = hist(x3,nbins);&#xA;figure, bar(N3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I do not have enough points to post images. However, the histogram of the random sequence &lt;code&gt;x1(n)&lt;/code&gt; just shows that &lt;code&gt;x1&lt;/code&gt; is uniformly distributed. The &lt;code&gt;x3(n)&lt;/code&gt; however, looks more like a Gaussian distribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why this happens, and would appreciate if someone could explain this a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4780" LastEditorUserId="4682" LastEditDate="2013-07-04T16:32:00.547" LastActivityDate="2013-07-04T16:32:00.547" Title="Histogram of signal with a time shift added" Tags="|matlab|histogram|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9537" PostTypeId="1" AcceptedAnswerId="9542" CreationDate="2013-06-10T11:02:26.323" Score="3" ViewCount="920" Body="&lt;p&gt;I'd like to know what the parameters for the two-dimensional gaussian distributions are, which create this (I think) quite common image-processing filter:&#xA;$$&#xA;h_\sigma(x,y)=&#xA;\left[&#xA;\matrix&#xA;{&#xA;1&amp;amp;2&amp;amp;1\\&#xA;2&amp;amp;4&amp;amp;2\\&#xA;1&amp;amp;2&amp;amp;1    &#xA;}&#xA;\right]&#xA;$$&#xA;The two-dimensional gaussian equation looks like:&#xA;$h_\sigma(x,y)= A\cdot e^{-\frac{x^2+y^2}{2\sigma^2}}$, where $A = \frac{1}{{2\pi}\sigma^2}$, but I think $A$ is not important as it is only a factor, isn't it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $\sigma=1$ I get:&#xA;$$h_{\sigma=1}(x,y)=&#xA;\left[&#xA;\matrix&#xA;{&#xA;h(-1,-1)=0.3679&amp;amp;h(0,-1)=0.6065&amp;amp;h(1,-1)=0.3679\\&#xA;h(-1,0)=0.6065&amp;amp;h(0,0)=1.0&amp;amp;h(1,0)=0.6065\\&#xA;h(-1,1)=0.3679&amp;amp;h(0,1)=0.6065&amp;amp;h(1,1)=0.3679   &#xA;}&#xA;\right]&#xA;$$&#xA;As you see, I think the entries in the filter-matrix correspond to sampling values of the gaussian function from [-1|-1] to [1|1]. I hope that is at least right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplied $h_{\sigma=1}(x,y)$ with $4$, and then rounded gives me my desired filter, but I don't think that is the correct way, is it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mbox{round}(4\cdot h_{\sigma=1}(x,y))=&#xA;\mbox{round}(4\cdot&#xA;\left[&#xA;\matrix&#xA;{&#xA;0.3679&amp;amp;0.6065&amp;amp;0.3679\\&#xA;0.6065&amp;amp;1.0&amp;amp;0.6065\\&#xA;0.3679&amp;amp;0.6065&amp;amp;0.3679   &#xA;}&#xA;\right]&#xA;)=&#xA;$$&#xA;$$&#xA;h_{\sigma=1}(x,y)=&#xA;\mbox{round}(&#xA;\left[&#xA;\matrix&#xA;{&#xA;1.4716&amp;amp;2.4260&amp;amp;1.4716\\&#xA;2.4260&amp;amp;4.0&amp;amp;2.4260\\&#xA;1.4716&amp;amp;2.4260&amp;amp;1.4716&#xA;}&#xA;\right]&#xA;)=&#xA;$$&#xA;$$&#xA;\left[&#xA;\matrix&#xA;{&#xA;1&amp;amp;2&amp;amp;1\\&#xA;2&amp;amp;4&amp;amp;2\\&#xA;1&amp;amp;2&amp;amp;1    &#xA;}&#xA;\right]&#xA;=h_\sigma(x,y)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There must be a better solution, or mathematical explanation for creating that matrix? I especially dislike the rounding operation, as the values are all close to $.5$ and not to $.0$ which should results in a huge error...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question in other words: How do I determine the filter from scratch...&lt;/p&gt;&#xA;" OwnerUserId="4778" LastActivityDate="2013-06-10T16:53:43.370" Title="Determine Parameters of gaussian distribution to fit a certain Image-Filter" Tags="|image-processing|filters|gaussian|math|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9538" PostTypeId="2" ParentId="9525" CreationDate="2013-06-10T13:22:27.153" Score="4" Body="&lt;p&gt;You could apply a 2d FFT. You will get a frequency spectrum as z values on a 2d plane:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q3OUH.png&quot; alt=&quot;FFT of the example image&quot;&gt; ← That's &lt;code&gt;log(abs(fftshift(fft2(image)))))&lt;/code&gt; where &lt;code&gt;image&lt;/code&gt; is from the question, but with white borders trimmed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the z values you can determine the highest peak and calculate its position on the 2d plane. With some geometric calculation, you can derive wavelength, direction and phaseshift from this.&lt;/p&gt;&#xA;" OwnerUserId="4678" LastEditorUserId="29" LastEditDate="2013-06-12T14:02:18.430" LastActivityDate="2013-06-12T14:02:18.430" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9539" PostTypeId="2" ParentId="9531" CreationDate="2013-06-10T13:34:51.003" Score="8" Body="&lt;p&gt;For continuous-phase FSK, &lt;em&gt;frequencies $f_1$ and $f_2$ and phases&lt;/em&gt;&#xA;can be chosen so that a frequency spacing of $\frac{1}{2T}$ gives orthogonality.&#xA;Note that it is not sufficient to have just $\Delta f = \frac{1}{2T}$; both&#xA;$f_1$ and $f_2$ have to be integer multiples of $\frac{1}{2T}$ or $\frac{1}{4T}$ etc.&#xA;Look for Sunde's FSK and minimum-shift keying (MSK) regarded as coherent FSK.&#xA;If the &lt;em&gt;phases&lt;/em&gt; are not carefully specified (as they indeed are for Sunde's&#xA;FSK and MSK), orthogonality requires $\Delta f$ to be an integer multiple&#xA;of $\frac{1}{T}$ and so of course the minimum spacing is  $\frac{1}{T}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The theory of noncoherent detection assumes that the phase of the received&#xA;signal is arbitrary rather than carefully controlled, and it is guaranteed&#xA;to give the specified error-rate vs SNR performance regardless of signal phase&#xA;as long as the frequency-spacing is $\frac{1}{T}$. The noncoherent receiver&#xA;&lt;em&gt;will work&lt;/em&gt;  and it will provide the specified error-rate vs SNR performance&#xA;if its input is a continuous-phase FSK signal with minimum frequency spacing $\frac{1}{2T}$ etc. However, it is worth keeping in mind that if the received&#xA;signal is such that coherent detection &lt;em&gt;is&lt;/em&gt; possible, then use of noncoherent&#xA;detection in lieu of coherent detection is a suboptimal choice as far as BER&#xA;vs SNR is concerned, though it might be preferable for other reasons such as&#xA;ease of implementation, cost, weight, power consumption, etc of the receiver.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-06-10T13:34:51.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9540" PostTypeId="2" ParentId="9536" CreationDate="2013-06-10T13:39:15.150" Score="2" Body="&lt;p&gt;In your example, $x_3[n]$ is the sum of two &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables&quot; rel=&quot;nofollow&quot;&gt;iid random variables&lt;/a&gt;, $x_1[n]$ and $x_1[n-1]$. Since each is taken from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29&quot; rel=&quot;nofollow&quot;&gt;uniform distribution&lt;/a&gt;, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Probability_density_function&quot; rel=&quot;nofollow&quot;&gt;probability density function (pdf)&lt;/a&gt; of each is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_{x_1}(x) = \begin{cases}&#xA;\frac{1}{b-a}, &amp;amp; x \in [a,b] \\&#xA;0, &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just a &lt;a href=&quot;http://en.wikipedia.org/wiki/Rectangle_function&quot; rel=&quot;nofollow&quot;&gt;rectangle function&lt;/a&gt; that is scaled and shifted to lie on the interval $[a,b]$. One property of the sum of independent random variables is that the pdf of the sum is equal to the convolution of the individual random variables' pdfs. Therefore:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_{x_3}(x) = f_{x_1}(x) * f_{x_1}(x)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you convolve two rectangles together, you get a &lt;a href=&quot;http://en.wikipedia.org/wiki/Triangle_function&quot; rel=&quot;nofollow&quot;&gt;triangle function&lt;/a&gt;. Therefore, if you histogram enough samples of $x_3[n]$, you should see the plot converge to a triangular shape.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-06-10T14:48:11.447" LastActivityDate="2013-06-10T14:48:11.447" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9541" PostTypeId="1" AcceptedAnswerId="9552" CreationDate="2013-06-10T16:35:18.013" Score="17" ViewCount="7003" Body="&lt;p&gt;Although I have a solid experience in designing audio engines and such, I am fairly new to the realm of Digital Filter Design, particularly IIR and FIR filters. In other words, I'm trying to learn as much as I can on how to design filters and derive their difference equations. I'm starting from the basics, so please bear with me, like I said, I'm trying to learn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Herein is my question: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I want to design a low-pass filter with a particular cutoff - say 300 Hz. What would be the best way of mathematically deriving the transfer function and then deriving the particular difference equation to implement the filter in Direct Form I and Direct Form II (or only DF-1 for now...)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some understanding of transfer functions and how they relate to difference equations from some excellent material on the web, unfortunately some of it assumes a good bit of prior knowledge, so it is more confusing than helpful in my quest. So I guess I need a more step-by-step example which will help me connect the dots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm basically looking for help with a breakdown of the process starting from choosing the cutoff frequency up to deriving the difference equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be much appreciated. I am familiar with a lot of the concepts - impulse response, DFT's, the math behind it, I guess what I need more help with is the concept of the z-transform and the pole/zero use to design the filter's transfer function and then how does the cutoff freq. play in all this to finally derive the difference equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I tend to learn best from example, I thought I'd ask here.&#xA;Thanks a lot to anyone who finds the time to help me out.&lt;/p&gt;&#xA;" OwnerUserId="4784" LastEditorUserId="4298" LastEditDate="2020-06-15T16:13:44.337" LastActivityDate="2020-06-15T16:13:44.337" Title="Digital filter design basic principles (IIR/FIR)" Tags="|filters|filter-design|finite-impulse-response|infinite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9542" PostTypeId="2" ParentId="9537" CreationDate="2013-06-10T16:53:43.370" Score="5" Body="&lt;p&gt;The filter you referenced is known as a &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.7611&quot; rel=&quot;nofollow noreferrer&quot;&gt;Binomial filter&lt;/a&gt;. It is an approximation to a Gaussian, but for smaller filters it's a very crude one. The design is oriented more toward efficiency than accuracy. Rather than sampling a Gaussian directly, the idea behind the approximation is based on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Central Limit Theorem&lt;/a&gt;. In this case, it means that a small moving average filter $[ 1 \space  1 ]$ convolved with itself over and over will become more and more Gaussian. It also happens to yield the rows of &lt;a href=&quot;https://en.wikipedia.org/wiki/Pascal%27s_triangle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pascal's Triangle&lt;/a&gt;. The coefficients for larger filters are given by the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;{N \choose k} = \frac{N!}{(N - n)!\space N!}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, for $N = 5$, taking the &lt;a href=&quot;http://en.wikipedia.org/wiki/Outer_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;outer product&lt;/a&gt; of the corresponding row of Pascal's triangle with itself yields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix} 1 \\ 4 \\ 6 \\ 4 \\ 1 \end{bmatrix}\begin{bmatrix} 1 &amp;amp; 4 &amp;amp; 6 &amp;amp; 4 &amp;amp; 1 \end{bmatrix} = &#xA;\begin{bmatrix} &#xA;1 &amp;amp;   4 &amp;amp;   6  &amp;amp;  4  &amp;amp;  1 \\&#xA;4 &amp;amp;  16 &amp;amp;  24 &amp;amp;  16  &amp;amp;  4 \\&#xA;6 &amp;amp;  24 &amp;amp;  36 &amp;amp;  24  &amp;amp;  6 \\&#xA;4 &amp;amp;  16 &amp;amp;  24 &amp;amp;  16  &amp;amp;  4 \\&#xA;1 &amp;amp;   4 &amp;amp;   6 &amp;amp;   4  &amp;amp;  1 &#xA;\end{bmatrix}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper I referenced in the first link has the following diagram which shows how the quality of the approximation increases with increasing filter order:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JZHXZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2013-06-10T16:53:43.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9543" PostTypeId="2" ParentId="9532" CreationDate="2013-06-10T17:34:08.557" Score="1" Body="&lt;p&gt;You must have some reference between the images,&#xA;either some other similar elements or the camera parameters,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the different resolutions that it is easy to calculate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;relative size = resolution ratio * object_size_ratio&lt;/p&gt;&#xA;&#xA;&lt;p&gt;otherwise you must have some other spatial reference between the images.&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2013-06-10T17:34:08.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9544" PostTypeId="2" ParentId="2099" CreationDate="2013-06-10T17:34:31.107" Score="1" Body="&lt;p&gt;Your problem is very similar to the cell-tracking problem. This has been solved quite well using tracklet based approaches, where each object (bubble, cell etc) is modeled as a Maximum-a-Posteriori (MAP) estimation. The solution to which is through linear programming. &#xA;You can get a good idea of the approaches and a &lt;a href=&quot;http://www.celltracking.ri.cmu.edu/algorithms.html&quot; rel=&quot;nofollow&quot;&gt;web-based implementation here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="632" LastActivityDate="2013-06-10T17:34:31.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9545" PostTypeId="2" ParentId="9521" CreationDate="2013-06-10T18:01:18.810" Score="4" Body="&lt;p&gt;I think you can accomplish this pretty easily:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;start with a low sample rate (simply because there is no reason for a high sample rate).&lt;/li&gt;&#xA;&lt;li&gt;use a low pass filter to eliminate signal above ~100 Hz. (You'll have to experiment to find the right cuttoff frequency).&lt;/li&gt;&#xA;&lt;li&gt;Create an envelope (optional). Doing this will help ensure that each beat looks like a single beat, rather than lots of separate hits.&lt;/li&gt;&#xA;&lt;li&gt;Threshold the signal -- anything above a certain level is a &quot;beat&quot;, below is not. Adjusting the threshold is your sensitivity control.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For more on low pass filtering, see my blog entry on the audio eq: &lt;a href=&quot;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&quot; rel=&quot;nofollow&quot;&gt;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create an envelope, you just need to take the absolute value (or square) of each sample, and do something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[i]=\lbrace\begin{matrix}x[i], x[i]&amp;gt;y[i-1]\\y[i-1]*.99,x[i]&amp;lt;=y[i-1]\end{matrix}$$&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2013-06-10T18:01:18.810" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="9546" PostTypeId="1" AcceptedAnswerId="9550" CreationDate="2013-06-10T23:27:57.160" Score="1" ViewCount="4651" Body="&lt;p&gt;I am trying to calculate an actual frequency response from a desired frequency response.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fftSize = 128;&#xA;fs = 8000;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have 2 input arrays: f[] and aDesired[], both of which are Real and length fftSize+1 (DC + Nyquist included). The f[] array is linearly spaced between 0 and fs/2 (0:4000). The aDesired[] array is either gains in dB or linear values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can easily change the length of f[] and aDesired[] as I have an interpolation function which gives any size outputs, but i thought this was a good number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to take an IFFT of ADesired[] to generate coefficients (with a configurable length), window and truncate the coeffs, and then FFT to show what the actual response would be, aActual[].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I take an IFFT/FFT of this data when the inputs are both Real? Or how do I prepare the data more?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, it doesnt matter about the phase, if its linear or not it doesnt matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there maybe a library that could be of use with my input data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summary:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Input: f[129] : linearly spaced fc's&#xA;       aDesired[129] : Real values of linearly spaced gains at fc's (either in lin or log),&#xA;&#xA;Processing:&#xA;       coeffs = IFFT(f, aDesired)&#xA;       coeff_new Truncate(window * coeff)&#xA;       aActual = FFT(f, coeff_new)&#xA;&#xA;Output: aActual[]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="4786" LastEditorUserId="4786" LastEditDate="2013-06-10T23:38:28.653" LastActivityDate="2013-06-11T18:33:13.027" Title="Frequency response &lt;-&gt; Impulse response" Tags="|fft|window-functions|ifft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9547" PostTypeId="1" CreationDate="2013-06-10T23:46:55.807" Score="2" ViewCount="413" Body="&lt;p&gt;Can one in theory achieve as high accuracy as needed by sampling a sinusoidal signal over n Periods? Is there a formula that connects the signal frequency (f), sampling frequency (fs), periods (P) and accuracy (Acc) or can someone explain how accuracy rise with number of periods? Let's say I want to know the signals amplitude with an error of less than 0.1%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say I want to sample a signal with a sampling frequency exactly four times that of the signal frequency. Let's say the first sample hit the sinusoidal signal at it's peak, the second at a zero-crossing, the third at it's negative peak and the fourth at a zero-crossing. This average will yield (1 + 0 + abs(-1) + 0)/4 = 1/2. Averaging over n periods would not change this average value in theory. Let's say the first value hits 45 degrees off the peak and the next 3 samples follows with 90 degree phase difference. The average would now be: (0,71 + abs(-0,71) + abs(-0,71) + 0,71)/4 = 0,71. Averaging over n periods would not change this average value either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have been thinking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one introduces a small phase shift of let's say 1 degree per period based on the difference between the signal frequency and the sampling frequency, one could over 360 periods have sampled along the &quot;whole&quot; sinus with samples at 360 different points on a sinusoidal signal. This of course assumes the signal is periodically (and it is in this case). This would give a pretty good estimate of the sinusoidal signals amplitude, but how much is the error here? Is this something that can be calculated easily with some sort of formula or do I have to use MATLAB?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what happens in &quot;real&quot; situations when the sampling frequency can't be exactly 1 degree off per period, but maybe 0,9384283437 and we have to sample e.g., 324986234 (just a big number to prove the point that an unrealistic number of periods have to be sampled) periods to be able to sample an integer number of periods. I understand that here there will be a trade-off between needed accuracy and number of periods needed to be sampled, but how can I calculate this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If what I have written above makes sense and is correct, it seems doable to obtain the wanted accuracy by adjusting the phase shift and number of periods to sample over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other: I can understand how some would think of this long text as more of an explanation or help to calculate different things. And this is mostly true as I have no experience or academic background in digital signal processing and therefor need to get confirmation on my idea, thought and understanding of the subject. Things I ask here are things I have not found the answers to by any text book or by googling, even though they for sure are available a lot of places, none of them have been able to &lt;em&gt;completely&lt;/em&gt; show me or make me understand this topic and I am therefor asking by writing this text above. Hopefully others may benefit from this questions and the answers provided. Thanks! =)&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2013-09-03T20:20:38.347" Title="Slow sampling of signal and averaging over n periods" Tags="|sampling|averaging|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9548" PostTypeId="1" CreationDate="2013-06-11T04:37:06.003" Score="3" ViewCount="1298" Body="&lt;p&gt;Is there any method of decoding a Manchester encoded signal (IEEE 802.3) that is independent of the bit period? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose the data I want to send is $\rm 10110$. The Manchester code of this data will be $\rm 0110010110$ (according to IEEE standard). We can see that in the $\rm 0101$ part, we need to consider the $\rm 0 \rightarrow 1$ transition (to decode a $\rm 1$) and not the $\rm 1 \rightarrow 0$ transition (falsely decoding a $\rm 0$). To do this, we need to know the bit period a priori. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there a way to do this without knowing the bit period a priori?&lt;/p&gt;&#xA;" OwnerUserId="4502" LastEditorUserId="1629" LastEditDate="2016-06-02T08:30:58.220" LastActivityDate="2016-06-02T08:30:58.220" Title="Manchester decoding" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9550" PostTypeId="2" ParentId="9546" CreationDate="2013-06-11T08:13:30.413" Score="3" Body="&lt;p&gt;As Jason R pointed out in his comment, your way of obtaining an actual frequency response is just one way of doing it. There are many other ways of determining an actual filter response. Any other frequency domain FIR filter design method could do the job, and with each method you would get a slightly different result. Having said that, let's have a look at the way you want to do it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have a real-valued desired response. This is the magnitude of the desired frequency response, because for causal (realizable) systems, the frequency response is always complex-valued. However, this is no problem since any finite length impulse response can always be made causal by adding some delay. First, we need to make the desired response symmetric, as is necessary for real-valued systems. Let the column vector D be the vector of desired magnitude values on the equidistant frequency grid between 0 and $f_s/2$, then the symmetric desired response is (using Matlab/Octave syntax):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Dsym=[D;D(N/2:-1:2)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the FFT length. We can obtain the (non-causal) impulse response by doing an inverse FFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h=real(ifft(Dsym));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that taking the real part is only necessary to remove the tiny imaginary part due to numerical errors. To make the impulse response causal, we need to shift the second half of it to the beginning:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h_c=[h(N/2+2:N); h(1:N/2+1)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The impulse response can now be multiplied with a window function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h_w = h_c.*w;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your actual frequency response is then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H=fft(h_w);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is complex valued, so in order to compare it to the desired response, you need to plot its magnitude:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(abs(H))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The phase of the actual response is linear, i.e. the system just adds some delay but does not introduce any phase distortions. &lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-11T18:33:13.027" LastActivityDate="2013-06-11T18:33:13.027" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9551" PostTypeId="1" AcceptedAnswerId="9553" CreationDate="2013-06-11T08:23:34.470" Score="1" ViewCount="919" Body="&lt;p&gt;As a rule of thumb, the bandwidth of a communication system with a complex signal must be equal to the bit-rate or symbol-rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides, after reading this &lt;a href=&quot;https://dsp.stackexchange.com/questions/6206/the-relationship-between-bandwidth-and-the-datarate&quot;&gt;post&lt;/a&gt;, it is not clear for me how a band-filter or low-filter signal can influence the maximum data rate. &lt;/p&gt;&#xA;" OwnerUserId="4776" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-06-11T11:40:13.380" Title="Bandwidth of a communication system" Tags="|digital-communications|bandwidth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9552" PostTypeId="2" ParentId="9541" CreationDate="2013-06-11T11:33:07.203" Score="27" Body="&lt;p&gt;Digital filter design is a very large and mature topic and - as you've mentioned in your question - there is a lot of material available. What I want to try here is to get you started and to make the existing material more accessible. Instead of digital filters I should actually be talking about discrete-time filters because I will not consider coefficient and signal quantization here. You know already about FIR and IIR filters, and you also know some filter structures like DF I and II. Nevertheless, let me start with some basics:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A non-recursive linear time-invariant (LTI) filter can be described by the following difference equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=h_0x(n)+h_1x(n-1)+\ldots +h_{N-1}x(n-N+1)=\sum_{k=0}^{N-1}h_kx(n-k)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y(n)$ is the output sequence, $x(n)$ is the input sequence, $n$ is the time index, $h_k$ are the filter coefficients, and $N$ is the filter length (the number of taps). The filter taps $h_k$ are also the impulse response of the filter because if the input signal is an impulse, i.e. $x(n)=\delta(n)$, then $y(n)=h_n$ (if the filter's memory has been initialized with zeros). Equation (1) describes a linear time-invariant finite impulse response (FIR) system. The sum on the right-hand side of (1) is a convolution sum, i.e. the output signal is obtained by convolving the input signal with the impulse response. This is always true, but for IIR filters we cannot explicitly compute the convolution sum because the impulse response is infinitely long, i.e. there are infinitely many coefficients $h_k$. One important advantage of FIR filters is that they are always stable, i.e. for a bounded input sequence, the output sequence is always bounded. Another advantage is that FIR filters can always be realized with an exactly linear phase, i.e. they will not add any phase distortion apart from a pure delay. Furthermore, the design problem is usually easier, as we will see later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A recursive LTI filter is described by the following difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=b_0x(n)+b_1x(n-1)+\ldots+b_Mx(n-M)-\\&#xA;-a_1y(n-1)-\ldots-a_Ny(n-N)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (2) shows that the output is not only composed of weighted and delayed input samples, but also of weighted past output samples. In general, the impulse response of such a system is infinitely long, i.e. the corresponding system is an IIR system. However, there are special cases of recursive filters with a finite impulse response. Note that the impulse response is not anymore given by either the coefficients $b_k$ or $a_k$ as in the case of FIR filters. One advantage of IIR filters is that steep filters with high stopband attenuation can be realized with much fewer coefficients (and delays) than in the FIR case, i.e. they are computationally more efficient. However, one needs to be careful with the choice of the coefficients $a_k$ because IIR filter can be unstable, i.e. their output sequence can be unbounded, even with a bounded input sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filters can be designed according to specifications either in the time (sample) domain or in the frequency domain, or both. Since you've mentioned a cut-off frequency in your question, I assume you're more interested in specifications in the frequency domain. In this case you need to have a look at the frequency responses of FIR and IIR systems. The frequency response of a system is the Fourier transform of its impulse response, assuming that it exists (which is the case for stable systems). The frequency response of an FIR filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\theta})=\sum_{k=0}^{N-1}h_ke^{-jk\theta}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta$ is the discrete-time frequency variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\theta=\frac{2\pi f}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the actual frequency $f$ and the sampling frequency $f_s$. From (3) you can see that approximating a desired frequency response by an FIR system is basically a problem of polynomial approximation. For recursive systems we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\theta})=\frac{\sum_{k=0}^Mb_ke^{-j\theta}}{1+\sum_{k=1}^Na_ke^{-j\theta}}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you get a rational approximation problem, which is usually much more difficult than the polynomial approximation problem in the case of FIR filters. From (3) and (4) you can see that the frequency response of an FIR filter is of course only a special case of the response of a recursive filter with coefficients $a_k=0$, $k=1,\dots,N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's now take a quick look at filter design methods. For FIR filters you could take an inverse Fourier transform of the desired frequency response to get the impulse response of the filter, which directly corresponds to the filter coefficients. Since you approximate the desired response by a finite length impulse response you should apply a smooth window to the obtained impulse response to minimize oscillations in the actual frequency response due to Gibbs' phenomenon. This method is called frequency-sampling method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simple standard filters like ideal lowpass, highpass, bandpass or bandstop filters (and a few others), you could even analytically calculate the exact impulse response by taking the inverse Fourier transform of the ideal desired response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_k=\frac{1}{2\pi}\int_{-\pi}^{\pi}H(e^{j\theta})e^{jk\theta}d\theta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This integral is easy to evaluate for piecewise constant desired responses, as is the case for ideal frequency-selective filters. This will give you an infinitely long, non-causal impulse response, which needs to be windowed and shifted to make it finite and causal. This method is know as window-design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are of course  many other FIR filter design methods. One important numerical method is the famous Parks-McClellan exchange algorithm which designs optimal filters with constant passband and stopband ripples. It is a numerical approximation method and there are many software implementations available, e.g. in Matlab and Octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most common IIR design method for frequency selective filters is the bilinear transformation method. This method simply uses analytical formulas for the design of optimal analog filters (such as Butterworth, Chebyshev, Cauer/elliptic, and Bessel filters), and transforms them to the discrete-time domain by applying a bilinear transformation to the complex variable $s$ (analog domain) which maps the (imaginary) frequency axis of the complex $s$-plane to the unit circle in the complex $z$-plane (discrete-time domain). Don't worry if you do not yet know much about complex transfer functions in the analog or discrete-time domain because there are good implementations available of the bilinear transform method, e.g. in Matlab or Octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are of course many more interesting and useful methods, depending on the type of specifications you have, but I hope that this will get you started and will make any material you come across more understandable. A very good (and free) book covering some basic filter design methods (and a lot more) is &lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/orfanidis-i2sp.pdf&quot;&gt;Intoduction to Signal Processing&lt;/a&gt; by Orfanidis. You can find several design examples there. Another great classic book is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0471828963&quot;&gt;Digital Filter Design&lt;/a&gt; by Parks and Burrus.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-11T11:46:48.193" LastActivityDate="2013-06-11T11:46:48.193" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9553" PostTypeId="2" ParentId="9551" CreationDate="2013-06-11T11:40:13.380" Score="4" Body="&lt;p&gt;In order to avoid inter symbol interference (ISI) the baseband transmit signal must meet Nyquist's first criterion. In frequency domain it can be formulated as follows.&#xA;$$&#xA;\omega_\mathrm{N} = \frac{v_\mathrm{s}}{2}&#xA;$$&#xA;With $v_\mathrm{s}$ the &lt;strong&gt;symbol&lt;/strong&gt; rate and $\omega_\mathrm{N}$ the 3dB frequency of a low pass filter with symmetric flank. The flank must be point symmetric with regard to $\omega_\mathrm{N}$ and zero for $\omega &amp;gt; \omega_\mathrm{N}(1 + \alpha)$. Consequently, the baseband bandwidth $B=\omega_\mathrm{N}(1 + \alpha)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After modulation the bandwidth is doubled and the radio frequency bandwidth is $2B = 2\omega_\mathrm{N}(1 + \alpha) = v_\mathrm{s}(1 + \alpha)$. For the ideal case of a rectangular low pass filter $\alpha=0$ and $2B = v_\mathrm{s}$ which corresponds to the statement that the required bandwidth is equal to the symbol rate *). Similarly, if the bandwidth $B$ is given, the symbol rate is limited by $v_\mathrm{s} \leq \frac{2B}{1+\alpha}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The required bandwidth indirectly depends on the bitrate, because a certain number of bits is transmitted per symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The lowpass mentioned above is also referred to as impulse shaper and $\alpha$ as roll-off factor.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;*) As an ideal lowpass isn't feasible, the required RF bandwidth in practice is always larger than the symbol rate.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-06-11T11:40:13.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9554" PostTypeId="2" ParentId="2578" CreationDate="2013-06-11T12:33:21.330" Score="3" Body="&lt;p&gt;The following two statements are equivalent of saying:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E(\hat{x}_{k|k} - x_k) = 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) That the estimator is &lt;em&gt;unbiased&lt;/em&gt;; and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P_{k|k} = Var(\hat{x}_{k|k} - x_k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) That the estimator is &lt;em&gt;consistent&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these conditions are necessary in order for the filter to be &lt;em&gt;optimal&lt;/em&gt; - i.e. the best possible estimate of $\mathbf{x}_{k|k}$ with respect to some criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If (1) is not true, then the mean-square error (MSE) would be the bias plus the variance (in the scalar case). Clear, this is larger than the variance only and hence suboptimal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If (2) is not true (i.e. the filter-calculated covariance is different to the true covariance) then the filter will also be suboptimal.  Since the Kalman Gain is based on the calculated state covariance, an error in the covariance will lead to an error in the gain.  Error in the gain means a suboptimal weighting of the measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(As it happens, both conditions are true for a properly modelled filter. Errors in modelling, such as the dynamic model or noise covariances will also render the filter suboptimal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/047141655X&quot; rel=&quot;nofollow&quot;&gt;Bar-Shalom&lt;/a&gt;, especially Section 5.4 on page 232-233.&lt;/p&gt;&#xA;" OwnerUserId="1904" LastActivityDate="2013-06-11T12:33:21.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9555" PostTypeId="1" AcceptedAnswerId="25351" CreationDate="2013-06-11T13:11:05.730" Score="3" ViewCount="241" Body="&lt;p&gt;I need to visualize some data as gray-scale images after contrast enhancement. The processing algorithm must be built on few samples, and then it will be applied on unseen images (suppose, the [min, max] range is given).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plan to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use sample images to estimate actual histogram &lt;code&gt;H1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Define desired histogram &lt;code&gt;H2&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Build a transformation &lt;code&gt;T&lt;/code&gt; (look-up table) that transforms &lt;code&gt;H1&lt;/code&gt; into &lt;code&gt;H2&lt;/code&gt;. &lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;code&gt;T&lt;/code&gt; on unseen images.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Question: How to build &lt;code&gt;H2&lt;/code&gt;? Are there studies in regards to the optimal gray-scale histogram for Human eye? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are two examples of different transformations, applied on the same image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Eq5E.png&quot; alt=&quot;enter image description here&quot;&gt; &#xA;&lt;img src=&quot;https://i.stack.imgur.com/kHCF1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4790" LastActivityDate="2015-08-22T13:51:16.787" Title="Optimal image histogram for Human eye" Tags="|image-processing|histogram|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9556" PostTypeId="2" ParentId="9548" CreationDate="2013-06-11T13:22:26.030" Score="2" Body="&lt;p&gt;I think what you're really asking is whether you can decode a Manchester-encoded bit stream without being &lt;em&gt;synchronized&lt;/em&gt; to a frame boundary. As you noted, a mid-symbol transition from $0$ to $1$ indicates one state (i.e. a transmitted $1$ for instance), while a transition from $1$ to $0$ would indicate the opposite state (a transmitted $0$). You seem to want to decode a Manchester-encoded bit stream without necessarily knowing where the symbol boundaries are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether you will be able to do this effectively would depend upon the bit error rate in the stream of encoded bits that you observe. Notice that for each two-bit sequence of Manchester-encoded bits, only two of the four possible states correspond to valid observations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;\text{received 01} &amp;amp;\to \text{1 transmitted} \\&#xA;\text{received 01} &amp;amp;\to \text{1 transmitted} \\&#xA;\text{received 00} &amp;amp;\to \text{invalid!} \\&#xA;\text{received 11} &amp;amp;\to \text{invalid!} \\&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, one way to get at the encoded bits in a Manchester bit stream without knowing where the symbol boundaries are would be to try both cases. Since there are two channel bits per symbol, there are only two possible alignments of the encoded symbols on the Manchester-encoded bit stream. Therefore, one approach would be to try both and select the timing offset that gives you the smallest number of &quot;invalid&quot; observations as shown above. Unless you have a lot of bit errors and are very unlucky, the correct alignment should yield a high percentage of valid sequences according to the above criteria, while you would observe a lot of invalid symbols if you were offset by one bit in the stream.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-06-11T13:22:26.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9557" PostTypeId="2" ParentId="9461" CreationDate="2013-06-11T17:45:15.680" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;SPL = 20 * Log10( v_out / v_ref )&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nope.  That's still a voltage measurement, but in dBV or dBu (depending on what v_ref is), not a sound pressure measurement in dB SPL.  To convert voltage to sound pressure, you need to know the &lt;a href=&quot;https://en.wikipedia.org/wiki/Headphones#Sensitivity&quot; rel=&quot;nofollow&quot;&gt;sensitivity of your transducer&lt;/a&gt;.  Typically this is specified in dB SPL/mW, so you also need to convert from voltage to watts, which requires you to know the impedance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;2 Vrms into 32 ohm → V^2/R = 125 mW&lt;/li&gt;&#xA;&lt;li&gt;Headphone sensitivity of 100 dB/mW&lt;/li&gt;&#xA;&lt;li&gt;So dB SPL for 2 Vrms is 100 + 10*log10(125 mW/1 mW) = 121 dB SPL&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-06-11T17:45:15.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9558" PostTypeId="1" CreationDate="2013-06-11T21:34:34.613" Score="1" ViewCount="558" Body="&lt;p&gt;What is the significance of the first zero up-crossing of a cross-correlation? The signals being correlated are cosines signals with some phase difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 1 : Cross-correlation plot attached. The signals are cosines with phase difference and may be with some low frequency components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling frequency of the measured signal is taken as 50Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross correlation obtained using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Cxx=fftshift(ifft(fft(x,N).*conj(fft(y,N))))/(norm(x) * norm(y));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1RTny.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4770" LastEditorUserId="4682" LastEditDate="2013-07-04T16:31:43.500" LastActivityDate="2013-07-04T16:31:43.500" Title="What is the significance of first zero upcrossing of a cross correlation?" Tags="|matlab|cross-correlation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9559" PostTypeId="2" ParentId="9525" CreationDate="2013-06-11T22:44:40.290" Score="3" Body="&lt;p&gt;Another approach might be to perform the Radon / Hough transform first, then detect the points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. &lt;code&gt;R = radon(I,0:179)&lt;/code&gt; in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gives this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rbNow.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The x-axis is angle (0-180 deg) and the y-axis is distance from the centre. Each local minimum represents a line. It shows 6 lines ~75 degrees, 2 around 90 degrees, and 3 around 170 degrees. (This is MATLAB angles which go clockwise from x-axis because the y-coords are upside down)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Forgot Radon and Hough transforms were roughly the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote some MATLAB code to locate the angles and mean separation between lines.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;close all&#xA;I = imread('testt.jpg');&#xA;I = rgb2gray(I);&#xA;I = I(2:end-1,:);&#xA;&#xA;% Radon transform&#xA;R = radon(I,0:179);&#xA;imagesc(R); colormap gray(256); pause;&#xA;&#xA;% Radon transform of smoothed image&#xA;Rg = radon(imgaussian(I,2),0:179);&#xA;imagesc(Rg); colormap gray(256); pause;&#xA;&#xA;% Take it away&#xA;Rf = R - Rg;&#xA;imagesc(Rf); colormap gray(256); pause;&#xA;&#xA;% Chop off out of range parts&#xA;chop = size(Rf,1) - size(I,1);&#xA;chop = ceil(chop/2);&#xA;Rf = Rf(chop+1:end-chop,:);&#xA;imagesc(Rf); colormap gray(256); pause;&#xA;&#xA;% Negative lines - threshold&#xA;Rf(Rf &gt; 0) = 0; &#xA;imagesc(Rf); colormap gray(256); pause;&#xA;&#xA;% Plot sum - peaks are angles&#xA;Rp = sum(abs(Rf));&#xA;plot(Rp);&#xA;&#xA;% Get the peaks sep by at least 15 deg&#xA;[p,a] = findpeaks(Rp,'minpeakdistance',15,'sortstr','descend');&#xA;hold on;&#xA;scatter(a,p,'r*');&#xA;hold off;&#xA;pause;&#xA;&#xA;% Iterate through peaks and find fequencies&#xA;for j = 1:numel(a)&#xA;    % Get subsection of Radon transform around angle and transpose&#xA;    vstart = max([a(j)-10,1]);&#xA;    vend = min([a(j)+10,size(Rf,2)]);&#xA;    Rsub = Rf(:,vstart:vend).';&#xA;    imagesc(Rsub); colormap gray(256); pause;&#xA;    RsubP = sum(abs(Rsub));&#xA;    plot(RsubP); pause;&#xA;&#xA;    % Find peak correlation with a bit of smoothing&#xA;    xp = xcorr(imgaussian(RsubP,2),imgaussian(RsubP,2));&#xA;    plot(xp); pause;&#xA;    [rp,rl] = findpeaks(xp,'sortstr','descend');&#xA;    wave(j) = abs(rl(1) - rl(2));&#xA;    disp(['Angle: ' num2str(a(j))]);&#xA;    disp(['Wavelength: ' num2str(wave(j))]);&#xA;    disp(['Strength: ' num2str(p(j))]);&#xA;    pause;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which results in:  (red * are possible angles)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Db0eD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Angle: 73&#xA;Wavelength: 16&#xA;Strength: 12401.356&#xA;&#xA;Angle: 92&#xA;Wavelength: 54&#xA;Strength: 9442.2545&#xA;&#xA;Angle: 175&#xA;Wavelength: 33&#xA;Strength: 9030.1877&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2013-06-13T02:05:58.553" LastActivityDate="2013-06-13T02:05:58.553" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9561" PostTypeId="1" CreationDate="2013-06-12T00:48:11.350" Score="1" ViewCount="242" Body="&lt;p&gt;I am making a pronunciation Scoring system, and I need to know how to separate the pronunciation information of an MFCC of a given spoken word, so that later i can match this MFCC with  the MFCC of the word. can that be done threw matlab or HTK ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second Question:&#xA;In the matching part, shall I used DTW or standard edit distance algorithm or a simple MSE ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="4793" LastEditorUserId="4793" LastEditDate="2013-06-13T09:03:10.527" LastActivityDate="2013-06-13T09:03:10.527" Title="Extract Word Information From MFCC" Tags="|speech-recognition|mfcc|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9564" PostTypeId="1" AcceptedAnswerId="9566" CreationDate="2013-06-12T07:20:06.653" Score="20" ViewCount="35153" Body="&lt;p&gt;I have recently &lt;a href=&quot;https://math.stackexchange.com/questions/404095/why-s-1-s-1-at-s-1-in-bode-plot&quot;&gt;fallen into fallacy&lt;/a&gt;, considering pole s=1 as there is infinite response at frequency 1. Yet, response was only 1. Now, can you derive the frequency response, given the poles? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, the theory says that a system is stable when poles are in left s-plane and, thus, decay in time. But, wait. Does'n &quot;pole&quot; mean the infinite response -- the growth in time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, is it right question in DSP? IMO, &lt;em&gt;D&lt;/em&gt; stands for digital whereas s-domain is analog. I do not find s-plane or Laplace transform tags to label my post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;update&lt;/strong&gt; Thanks for the answers. It seems that I have got it except the one minor but fundamental thing -- the relationship of poles (and zeroes) with frequency. Basically, why are eigenvalues (or, how do you call the $s$ operator/variable) related with frequency? It should be somehow related with exponential growth and Laplace transform. I quite understand that poles happen to be eigenvalues (especially for discrete recurrences). But, how is this related with frequency?&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="4298" LastEditDate="2018-07-20T20:39:12.457" LastActivityDate="2019-09-29T19:57:42.077" Title="How poles are related to frequency response" Tags="|continuous-signals|frequency-response|transfer-function|laplace-transform|poles-zeros|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9565" PostTypeId="2" ParentId="9558" CreationDate="2013-06-12T07:32:07.370" Score="3" Body="&lt;p&gt;Not sure what you are asking specifically. The cross correlation of two cosine waves is just another cosine. The triangular envelope in the picture is simply a consequence of the limited length of the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase of the cross-correlation cosine is given by the phase difference of the two input cosines. This phase difference determines the position of the zero crossings. So in effect the position of that zero crossing is some metric of the phase difference of the input signals&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-12T07:32:07.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9566" PostTypeId="2" ParentId="9564" CreationDate="2013-06-12T09:13:29.497" Score="13" Body="&lt;p&gt;I think there are actually 3 questions in your question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q1:&lt;/strong&gt; Can I derive the frequency response given the poles of a (linear time-invariant) system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, you can, up to a constant. If &lt;span class=&quot;math-container&quot;&gt;$s_{\infty,i}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i=1,\ldots,N,$&lt;/span&gt; are the poles of the transfer function, you can write the transfer function as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(s)=\frac{k}{(s-s_{\infty,1})(s-s_{\infty,2})\ldots (s-s_{\infty,N})}\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is a complex variable &lt;span class=&quot;math-container&quot;&gt;$s=\sigma+j\omega$&lt;/span&gt;, and the frequency variable &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; corresponds to the imaginary axis of the complex &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;-plane. Now we need to get the frequency response from the transfer function. For stable systems this can simply be done by evaluating the transfer function &lt;span class=&quot;math-container&quot;&gt;$H(s)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$s=j\omega$&lt;/span&gt;. So you replace &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$j\omega$&lt;/span&gt; in (1) and you're done. Note, however, that this is only true for stable systems (i.e. if the region of convergence of &lt;span class=&quot;math-container&quot;&gt;$H(s)$&lt;/span&gt; includes the &lt;span class=&quot;math-container&quot;&gt;$j\omega$&lt;/span&gt;-axis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q2:&lt;/strong&gt; How can a stable system have poles?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you already know, for causal and stable systems, all poles must lie in the left half-plane of the complex &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;-plane. Indeed, the value of the transfer function &lt;span class=&quot;math-container&quot;&gt;$H(s)$&lt;/span&gt; will go to infinity at a pole &lt;span class=&quot;math-container&quot;&gt;$s=s_{\infty}$&lt;/span&gt;, but the frequency response will be OK, because if all poles are in the left half-plane, there are no poles on the &lt;span class=&quot;math-container&quot;&gt;$j\omega$&lt;/span&gt;-axis (or to the right of it). If you look at it in the time-domain, then each (simple) pole has a contribution of &lt;span class=&quot;math-container&quot;&gt;$e^{s_{\infty}t}$&lt;/span&gt; to the system's impulse response. If the pole is located in the left half-plane, this means that &lt;span class=&quot;math-container&quot;&gt;$s_{\infty}=\sigma_{\infty}+j\omega_{\infty}$&lt;/span&gt; has a negative real part &lt;span class=&quot;math-container&quot;&gt;$\sigma_{\infty}&amp;lt;0$&lt;/span&gt;. So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{s_{\infty}t}=e^{\sigma_{\infty}}e^{j\omega_{\infty}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is an exponentially damped function and does not grow but decays, because &lt;span class=&quot;math-container&quot;&gt;$\sigma_{\infty}&amp;lt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q3:&lt;/strong&gt; Does this question belong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other community members have to judge whether this question belongs here. I think that it does. It is obviously not directly related to pure DSP, but DSP engineers very often also have to deal with analog signals and systems before AD conversion, so they also know about continuous system theory. Second, almost all DSP people (at least the ones with traditional training) got quite some exposure to general signals and systems theory, including continuous-time and discrete-time systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, for discrete-time systems you get the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform instead of the Laplace-transform, and your complex variable is now called &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. The variable &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; that you've mentioned is defined as &lt;span class=&quot;math-container&quot;&gt;$D=z^{-1}$&lt;/span&gt; and is mainly used in the coding literature. By its definition, it denotes a delay element, so &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; stands for &quot;delay&quot; (not &quot;digital&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know that the left half-plane of the complex &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;-plane maps to the region inside the unit circle of the complex &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-plane (i.e. &lt;span class=&quot;math-container&quot;&gt;$|z|&amp;lt;1$&lt;/span&gt;), and the &lt;span class=&quot;math-container&quot;&gt;$j\omega$&lt;/span&gt;-axis maps to the unit circle &lt;span class=&quot;math-container&quot;&gt;$|z|=1$&lt;/span&gt;, then almost everything you know about one of the two domains will easily carry over to the other domain.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2019-09-29T19:57:42.077" LastActivityDate="2019-09-29T19:57:42.077" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9569" PostTypeId="1" AcceptedAnswerId="9571" CreationDate="2013-06-12T11:03:57.100" Score="0" ViewCount="823" Body="&lt;p&gt;Suppose I have an FM signal with modulation index mf which is passed through a frequency tripler, then what will be the modulation index of output waveform ?.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance....&lt;/p&gt;&#xA;" OwnerUserId="4799" LastEditorUserId="4298" LastEditDate="2013-06-12T13:15:20.827" LastActivityDate="2018-05-24T03:50:18.107" Title="FM Modulation Index and Frequency trippler" Tags="|signal-analysis|modulation|homework|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9570" PostTypeId="1" AcceptedAnswerId="9572" CreationDate="2013-06-12T13:41:34.407" Score="1" ViewCount="216" Body="&lt;p&gt;I am going to start my research on digital image restoration, I just want to know that should i learn the course &lt;strong&gt;digital signal processing&lt;/strong&gt; before starting my research.&lt;/p&gt;&#xA;" OwnerUserId="4444" LastActivityDate="2013-06-12T13:48:37.120" Title="Is is necessary to learn digital signal processing before starting research in digital image restoration?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9571" PostTypeId="2" ParentId="9569" CreationDate="2013-06-12T13:42:19.007" Score="1" Body="&lt;p&gt;&lt;strong&gt;Hint:&lt;/strong&gt; The modulation index is the peak frequency deviation divided by the maximum frequency of the baseband signal. Take a look at the formula for the FM signal and see what happens if the frequency is tripled. How does the peak frequency deviation change? How does the maximum frequency of the baseband signal change? I'm sure you can take it from here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, please edit your question to let us know where you get stuck and ask a specific question (not just &quot;please solve my problem&quot;).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-12T13:42:19.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9572" PostTypeId="2" ParentId="9570" CreationDate="2013-06-12T13:48:37.120" Score="7" Body="&lt;p&gt;My advice would be: do not delay the start of your research, but integrate the study of signal processing basics in the time you have for your research. Basic signal processing knowledge is essential for a proper understanding of the methods of digital image restoration. Divide your time between learning any basic knowledge you might be missing, and studying specific literature on image restoration.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-12T13:48:37.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9573" PostTypeId="1" AcceptedAnswerId="9600" CreationDate="2013-06-12T15:05:06.497" Score="3" ViewCount="734" Body="&lt;p&gt;I am dealing with images from biological slides and want to segment out the ROI (cells) from the background. I have tried k-means clustering, otsu thresholding, adaptive thresholding, edge detection etc. Running out of ideas now.&#xA;Which other segmenting techniques can be tried for such images? Keeping in mind that the color of cells and background can change&lt;br&gt;&#xA;&lt;a href=&quot;http://radiology.uchc.edu/eatlas/images/GYN/5818b.gif&quot; rel=&quot;nofollow&quot;&gt;click here for image&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4777" LastActivityDate="2014-01-08T13:15:15.510" Title="segmenting region of interest (ROI) from background" Tags="|computer-vision|image-segmentation|background-subtraction|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9574" PostTypeId="1" CreationDate="2013-06-12T15:34:03.470" Score="4" ViewCount="742" Body="&lt;p&gt;Can anyone recommend the best references for independent subspace analysis (ISA). I have read 'Multidimensional Independent Component Analysis' by Cardoso and would like to know of any modern, solid (i.e. generally accepted to work) approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have implemented ISA before how did it perform?&lt;/p&gt;&#xA;" OwnerUserId="4534" LastActivityDate="2013-06-12T19:20:28.030" Title="Independent Subspace Analysis and Topographic ICA" Tags="|ica|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9575" PostTypeId="2" ParentId="6448" CreationDate="2013-06-12T16:22:39.207" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How to Find a Suitable Lighting? This will be the most important&#xA;  question of an engineer who has to select a right lighting set-up for&#xA;  the Machine Vision application. Probably he remembers some clever&#xA;  Machine Vision proverbs such as &quot;better to light than write&#xA;  (software)&quot;, &quot;avoid garbage in (bad lighting) that causes garbage out&#xA;  (bad result)&quot;, &quot;create the BEST image first&quot; and so forth.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Jahr, I., 2007. &lt;em&gt;Lighting in Machine Vision&lt;/em&gt; in: Alexander Hornberg, ed. &lt;em&gt;Handbook of Machine Vision&lt;/em&gt;. John Wiley &amp;amp; Sons, p.150. &lt;/p&gt;&#xA;" OwnerUserId="3573" LastActivityDate="2013-06-12T16:22:39.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9576" PostTypeId="2" ParentId="9574" CreationDate="2013-06-12T19:08:08.057" Score="1" Body="&lt;p&gt;Read this paper about ISA: &lt;a href=&quot;http://www.cs.helsinki.fi/u/ahyvarin/papers/ESANN06.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.helsinki.fi/u/ahyvarin/papers/ESANN06.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this one about topographic ICA: &lt;a href=&quot;http://www.cs.helsinki.fi/u/ahyvarin/papers/NC01_TICA.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.helsinki.fi/u/ahyvarin/papers/NC01_TICA.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hyvärinen is the author of the FastICA algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, you might want to look at ICASSO (&lt;a href=&quot;http://research.ics.aalto.fi/ica/icasso/&quot; rel=&quot;nofollow&quot;&gt;http://research.ics.aalto.fi/ica/icasso/&lt;/a&gt;), if you are not already familiar with it.&lt;/p&gt;&#xA;" OwnerUserId="4801" LastEditorUserId="4801" LastEditDate="2013-06-12T19:20:28.030" LastActivityDate="2013-06-12T19:20:28.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9577" PostTypeId="1" AcceptedAnswerId="13002" CreationDate="2013-06-12T13:05:52.920" Score="2" ViewCount="82" Body="&lt;p&gt;In a set of images taken with the same infrared camera, I have a noise signal presumably originating from the camera chip. How would I go about extracting said signal to be able to substract it from all images I have taken?&lt;/p&gt;&#xA;" OwnerUserId="5146" OwnerDisplayName="karlson" LastEditorUserId="4682" LastEditDate="2013-07-04T16:30:54.903" LastActivityDate="2013-12-04T10:45:03.000" Title="Filter common signal from image" Tags="|image-processing|noise|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9578" PostTypeId="1" CreationDate="2013-06-12T21:47:01.083" Score="0" ViewCount="277" Body="&lt;p&gt;I am programmatically generating a CPFSK encoding, and between shifting from two frequencies, there is extra noise generated by my speaker. For instance, going from 18375hz to 18900hz, there is extra noise. I am changing frequency at the point where the 18375 hz sinusoidal is at 0, and beginning at 0 for the 18900hz sinusoidal. The sample is played at 44.1kHz, and each sinusoidal is sampled 42 times before the next point is 0. Is this too rapid of a change in frequency? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should add a better example here. I tried using a memoryless CPFSK known as Sunde FSK. If you choose two frequencies which are separated by 1/T, where T is the symbol length, then you should have a memoryless FSK. So, T=42/44100, and f1 = 18900 and f2 = 19950, this should fulfill these requirements. I still have a audible tone generated when I do this, so is there any suggestions as to how to make this inaudible using these frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot of a transition from 18900hz to 19950hz. The transition occurs at point 42, and point 43 is the beginning of the 19950hz wave:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L1Hff.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think one of the issues is just a rapid change in frequency, but I could be wrong. Any thoughts on this?&lt;/p&gt;&#xA;" OwnerUserId="4764" LastEditorUserId="29" LastEditDate="2013-06-18T21:48:35.697" LastActivityDate="2013-06-18T21:48:35.697" Title="Noise from CPFSK" Tags="|fsk|java|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="9579" PostTypeId="2" ParentId="9564" CreationDate="2013-06-12T23:07:25.857" Score="19" Body="&lt;p&gt;One thing that really helped me understand poles and zeros is to visualize them as amplitude surfaces.  Several of these plots can be found in &lt;a href=&quot;http://www.maximintegrated.com/app-notes/index.mvp/id/733&quot; rel=&quot;noreferrer&quot;&gt;A Filter Primer&lt;/a&gt;.  Some notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It's probably easier to learn the analog S plane first, and after you understand it, then learn how the digital Z plane works.&lt;/li&gt;&#xA;&lt;li&gt;A zero is a point at which the gain of the transfer function is zero.&lt;/li&gt;&#xA;&lt;li&gt;A pole is a point at which the gain of the transfer function is infinite.&lt;/li&gt;&#xA;&lt;li&gt;Often there are zeros or poles at infinity, which aren't always included in descriptions of the transfer function, but are necessary to understand it.&lt;/li&gt;&#xA;&lt;li&gt;The frequency response in the S plane happens along the jω axis only.  &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The origin is 0 Hz, or DC, and the cutoff frequency of filters increases radially away from the origin.  Putting a pole at any point along a circle at a certain distance from the origin will produce the same cutoff frequency.&lt;/li&gt;&#xA;&lt;li&gt;To increase the cutoff frequency of a filter, move the poles radially outward.&lt;/li&gt;&#xA;&lt;li&gt;To increase the Q of a biquad filter, move the poles along the circle towards the jω axis, which keeps the cutoff frequency constant, but increases the effect that the pole has on the frequency response, making it more &quot;peaky&quot;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;img src=&quot;https://i.stack.imgur.com/0KRdM.png&quot; alt=&quot;Moving poles along a circle keeps cutoff frequency constant but changes Q&quot;&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;If a zero appears on the jω axis, then the frequency response will drop to zero at that frequency; if you input a sine wave at that frequency, the output will be 0.&lt;/li&gt;&#xA;&lt;li&gt;If a pole appears on the jω axis, then the impulse response is an oscillator; any impulse will cause it to ring forever at that frequency.  Impulses have finite energy, but the response of the filter has infinite energy, so it has infinite gain.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A simple example is an integrator H(s) = 1/s:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This function equals 0 when s is infinite, so it has a zero at infinity.&lt;/li&gt;&#xA;&lt;li&gt;This function equals infinity when s is zero, so it has a pole at zero.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In other words, it has infinite gain at DC (the step response of an integrator is forever-increasing), and the gain decreases as frequency increases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3uB3S.png&quot; alt=&quot;Bode plot of integrator&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving the pole away from the origin, along the imaginary axis into the left hand of the S plane, makes the gain at 0 Hz on the jw axis finite again, and now you have a low-pass filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zbPca.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-07-24T03:25:58.567" LastActivityDate="2013-07-24T03:25:58.567" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="9581" PostTypeId="1" AcceptedAnswerId="9582" CreationDate="2013-06-13T18:20:17.960" Score="0" ViewCount="322" Body="&lt;p&gt;I'm making peaking equalizer in C# using NAudio (&lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow&quot;&gt;EQ-Cookbook&lt;/a&gt;). Can anybody tell me what is wrong with this code? It gives me noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://shrani.si/f/2o/Qz/3bOWbf1i/eq.png&quot; rel=&quot;nofollow&quot;&gt;Sliders&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    class Equalizer : WaveStream&#xA;{&#xA;    float[] sFc;&#xA;    double a0, a1, a2, b0, b1, b2;&#xA;    public Equalizer(WaveStream source)&#xA;    {&#xA;        sourceStream = source;&#xA;        sFc = new float[] { 50, 80, 130, 350, 1300, 4000, 8000, 12000, 16000 };&#xA;    }&#xA;    public WaveStream sourceStream&#xA;    {&#xA;        get;&#xA;        set;&#xA;    }&#xA;    public override long Length&#xA;    {&#xA;        get { return sourceStream.Length; }&#xA;    }&#xA;    public override long Position&#xA;    {&#xA;        get&#xA;        {&#xA;            return sourceStream.Position;&#xA;        }&#xA;        set&#xA;        {&#xA;            sourceStream.Position = value;&#xA;        }&#xA;    }&#xA;    public override WaveFormat WaveFormat&#xA;    {&#xA;        get { return sourceStream.WaveFormat; }&#xA;    }&#xA;&#xA;    //x - input buffer, y - output buffer, Fc - center frequency , dbGain - gain in db&#xA;    public void PeakingEQ(float[] x,ref float[] y, float Fc, float dbGain)&#xA;    {&#xA;        //q=2, ~octave bandwith&#xA;        double w0 = 2 * Math.PI * Fc / sourceStream.WaveFormat.SampleRate;&#xA;        double cosw0 = Math.Cos(w0);&#xA;        double sinw0 = Math.Sin(w0);&#xA;        double alpha = sinw0 / 4; //sin(w0)/(2*Q) -&amp;gt;q=2    &#xA;        double A = Math.Pow(10, dbGain / 40);&#xA;        b0 = 1 + alpha * A;&#xA;        b1 = -2 * cosw0;&#xA;        b2 = 1 - alpha * A;&#xA;        a0 = 1 + alpha / A;&#xA;        a1 = -2 * cosw0;&#xA;        a2 = 1 - alpha / A;&#xA;        for (int n = 2; n &amp;lt; x.Length; n++)&#xA;        {&#xA;            y[n] += (float)((b0 / a0) * x[n] + (b1 / a0) * x[n - 1] + (b2 / a0) * x[n - 2] - (a1 / a0) * y[n - 1] - (a2 / a0) * y[n - 2]);&#xA;            y[n] = Math.Min(1, Math.Max(-1, y[n]));&#xA;        }&#xA;   }&#xA;&#xA;    public override int Read(byte[] buffer, int offset, int count)&#xA;    {&#xA;        int read = sourceStream.Read(buffer, offset, count);&#xA;        float[] f_read = new float[read / 4], y = new float[read / 4];&#xA;        Buffer.BlockCopy(buffer, offset, f_read, 0, count);&#xA;&#xA;        for (int i = 0; i &amp;lt; Form1.trackBarValue.Length; i++)&#xA;            PeakingEQ(f_read, ref y, sFc[i], Form1.trackBarValue[i]);&#xA;&#xA;        Buffer.BlockCopy(y, 0, buffer, offset, read);&#xA;        return read;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is edited code: caching last two input and output samples&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    class Equalizer : WaveStream&#xA;{&#xA;    float[] cacheInput, cacheOutput;&#xA;    float[] sFc;&#xA;    double a0, a1, a2, b0, b1, b2;&#xA;    public Equalizer(WaveStream source)&#xA;    {&#xA;        sourceStream = source;&#xA;        sFc = new float[] { 50, 80, 130, 350, 1300, 4000, 8000, 12000, 16000 };&#xA;        cacheInput = new float[2];&#xA;        cacheOutput = new float[2];&#xA;    }&#xA;    public WaveStream sourceStream&#xA;    {&#xA;        get;&#xA;        set;&#xA;    }&#xA;    public override long Length&#xA;    {&#xA;        get { return sourceStream.Length; }&#xA;    }&#xA;    public override long Position&#xA;    {&#xA;        get&#xA;        {&#xA;            return sourceStream.Position;&#xA;        }&#xA;        set&#xA;        {&#xA;            sourceStream.Position = value;&#xA;        }&#xA;    }&#xA;    public override WaveFormat WaveFormat&#xA;    {&#xA;        get { return sourceStream.WaveFormat; }&#xA;    }&#xA;&#xA;    //x - input buffer, y - output buffer, Fc - center frequency , dbGain - gain in db&#xA;    public void PeakingEQ(float[] x,ref float[] y, float Fc, float dbGain)&#xA;    {&#xA;        //q=2, ~octave bandwith&#xA;        double w0 = 2 * Math.PI * Fc / sourceStream.WaveFormat.SampleRate;&#xA;        double cosw0 = Math.Cos(w0);&#xA;        double sinw0 = Math.Sin(w0);&#xA;        double alpha = sinw0 / 4; //sin(w0)/(2*Q) -&amp;gt;q=2    &#xA;        double A = Math.Pow(10, dbGain / 40);&#xA;        b0 = 1 + alpha * A;&#xA;        b1 = -2 * cosw0;&#xA;        b2 = 1 - alpha * A;&#xA;        a0 = 1 + alpha / A;&#xA;        a1 = -2 * cosw0;&#xA;        a2 = 1 - alpha / A;&#xA;        for (int n = 0; n &amp;lt; x.Length; n++)&#xA;        {&#xA;            if (n ==0)&#xA;            {&#xA;                y[n] += (float)((b0 / a0) * x[n] + (b1 / a0) * cacheInput[0] + (b2 / a0) * cacheInput[1] - (a1 / a0) * cacheOutput[0] - (a2 / a0) * cacheOutput[1]);&#xA;            }&#xA;            else if (n == 1)&#xA;            {&#xA;                y[n] += (float)((b0 / a0) * x[n] + (b1 / a0) * x[n - 1] + (b2 / a0) * cacheInput[0] - (a1 / a0) * y[n - 1] - (a2 / a0) * cacheOutput[0]);&#xA;            }&#xA;            else&#xA;            {&#xA;                y[n] += (float)((b0 / a0) * x[n] + (b1 / a0) * x[n - 1] + (b2 / a0) * x[n - 2] - (a1 / a0) * y[n - 1] - (a2 / a0) * y[n - 2]);&#xA;            }&#xA;            y[n] = Math.Min(1, Math.Max(-1, y[n]));&#xA;        }&#xA;   }&#xA;&#xA;    public override int Read(byte[] buffer, int offset, int count)&#xA;    {&#xA;        int read = sourceStream.Read(buffer, offset, count);&#xA;        float[] f_read = new float[read / 4], y = new float[read / 4];&#xA;        Buffer.BlockCopy(buffer, offset, f_read, 0, count);&#xA;&#xA;        for (int i = 0; i &amp;lt; Form1.trackBarValue.Length; i++)&#xA;            PeakingEQ(f_read, ref y, sFc[i], Form1.trackBarValue[i]);&#xA;&#xA;        //caching last two input samples&#xA;        cacheInput[0] = f_read[f_read.Length - 1];&#xA;        cacheInput[1] = f_read[f_read.Length - 2];&#xA;&#xA;        //caching last two output samples&#xA;        cacheOutput[0] = y[y.Length - 1];&#xA;        cacheOutput[1] = y[y.Length - 2];&#xA;&#xA;        Buffer.BlockCopy(y, 0, buffer, offset, read);&#xA;        return read;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2:&lt;/strong&gt; caching output for each filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    class Equalizer : WaveStream&#xA;{&#xA;    float[] cacheInput;&#xA;    float [, ] cacheOutput;&#xA;    float[] sFc;&#xA;    double a0, a1, a2, b0, b1, b2;&#xA;    public Equalizer(WaveStream source)&#xA;    {&#xA;        sourceStream = source;&#xA;        sFc = new float[] { 50, 80, 130, 350, 1300, 4000, 8000, 12000, 16000 };&#xA;        cacheInput = new float[2];&#xA;        cacheOutput = new float[sFc.Length,2];&#xA;    }&#xA;    public WaveStream sourceStream&#xA;    {&#xA;        get;&#xA;        set;&#xA;    }&#xA;    public override long Length&#xA;    {&#xA;        get { return sourceStream.Length; }&#xA;    }&#xA;    public override long Position&#xA;    {&#xA;        get&#xA;        {&#xA;            return sourceStream.Position;&#xA;        }&#xA;        set&#xA;        {&#xA;            sourceStream.Position = value;&#xA;        }&#xA;    }&#xA;    public override WaveFormat WaveFormat&#xA;    {&#xA;        get { return sourceStream.WaveFormat; }&#xA;    }&#xA;&#xA;    //x - input buffer, y - output buffer, Fc - center frequency , dbGain - gain in db&#xA;    public void PeakingEQ(float[] x,ref float[] y, float Fc, float dbGain, int index)&#xA;    {&#xA;        //q=2, ~octave bandwith&#xA;        double w0 = 2 * Math.PI * Fc / sourceStream.WaveFormat.SampleRate;&#xA;        double cosw0 = Math.Cos(w0);&#xA;        double sinw0 = Math.Sin(w0);&#xA;        double alpha = sinw0 / 4; //sin(w0)/(2*Q) -&amp;gt;q=2    &#xA;        double A = Math.Pow(10, dbGain / 40);&#xA;        b0 = 1 + alpha * A;&#xA;        b1 = -2 * cosw0;&#xA;        b2 = 1 - alpha * A;&#xA;        a0 = 1 + alpha / A;&#xA;        a1 = -2 * cosw0;&#xA;        a2 = 1 - alpha / A;&#xA;        float tmp=0;&#xA;        for (int n = 0; n &amp;lt; x.Length; n++)&#xA;        {&#xA;            if (n ==0)&#xA;                tmp= (float)((b0 / a0) * x[n] + (b1 / a0) * cacheInput[0] + (b2 / a0) * cacheInput[1] - (a1 / a0) * cacheOutput[index, 0] - (a2 / a0) * cacheOutput[index, 1]);&#xA;            else if (n == 1)&#xA;                tmp = (float)((b0 / a0) * x[n] + (b1 / a0) * x[n - 1] + (b2 / a0) * cacheInput[0] - (a1 / a0) * cacheOutput[index, 0] - (a2 / a0) * cacheOutput[index, 1]);&#xA;            else&#xA;                tmp = (float)((b0 / a0) * x[n] + (b1 / a0) * x[n - 1] + (b2 / a0) * x[n - 2] - (a1 / a0) * cacheOutput[index, 0] - (a2 / a0) * cacheOutput[index, 1]);&#xA;&#xA;            y[n] += tmp;&#xA;            cacheOutput[index, 1] = cacheOutput[index, 0];&#xA;            cacheOutput[index, 0] = tmp;&#xA;        }&#xA;   }&#xA;&#xA;    public override int Read(byte[] buffer, int offset, int count)&#xA;    {&#xA;        int read = sourceStream.Read(buffer, offset, count);&#xA;        float[] f_read = new float[read / 4], y = new float[read / 4];&#xA;        Buffer.BlockCopy(buffer, offset, f_read, 0, count);&#xA;&#xA;        for (int i = 0; i &amp;lt; Form1.trackBarValue.Length; i++)&#xA;            PeakingEQ(f_read, ref y, sFc[i], Form1.trackBarValue[i],i);&#xA;&#xA;        for (int n = 0; n &amp;lt; read / 4; n++)&#xA;            y[n] = Math.Min(1, Math.Max(-1, y[n] / sFc.Length));&#xA;&#xA;        cacheInput[0] = f_read[f_read.Length - 1];&#xA;        cacheInput[1] = f_read[f_read.Length - 2];&#xA;&#xA;        Buffer.BlockCopy(y, 0, buffer, offset, read);&#xA;        return read;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4695" LastEditorUserId="4695" LastEditDate="2013-06-14T08:11:24.923" LastActivityDate="2013-06-14T16:18:25.643" Title="Peaking Equalizer" Tags="|discrete-signals|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9582" PostTypeId="2" ParentId="9581" CreationDate="2013-06-13T19:30:26.190" Score="0" Body="&lt;p&gt;Do you have a recording of the output? Can you describe what kind of &quot;noise&quot; you hear?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start with, you do not fill the first two samples &lt;code&gt;y[0]&lt;/code&gt; and &lt;code&gt;y[1]&lt;/code&gt; ; and the state variables &lt;code&gt;x[n-1]&lt;/code&gt;, &lt;code&gt;x[n-2]&lt;/code&gt;, &lt;code&gt;y[n-1]&lt;/code&gt;, &lt;code&gt;y[n-2]&lt;/code&gt; are reset every time &lt;code&gt;PeakingEQ&lt;/code&gt; is called. This will cause a glitch at each buffer boundary, which can be quite often if &lt;code&gt;Read&lt;/code&gt; is called on small chunks. Your class needs to store somewhere the last two input samples and last two output samples to ensure continuous rendering.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-13T19:30:26.190" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9583" PostTypeId="2" ParentId="9578" CreationDate="2013-06-13T21:32:53.510" Score="1" Body="&lt;p&gt;I think what you hear is probably some type of aliasing because your sampling frequency is too low given the FSK signal you're using. If you look at the plot you see that you do not get a constant envelope as you should. This is due to the relatively low sampling frequency. The maximum carrier frequency is almost 20kHz, and the upper limit of the FSK spectrum is not simply determined by the maximum carrier frequency, but it's higher due to the shifting between the two frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try (at least one of) the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;use much lower carrier frequencies, just to check if the (extra) tone you hear disappears. Of course you'll hear the two carriers then, but hopefully no other artifacts.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;use your original carriers but at first use a very high sampling rate, i.e. generate your signals with many more samples per period. Then use a digital lowpass filter at this high sampling frequency with a cut-off frequency of around 20kHz, and then downsample your signal to 44.1kHz. Then send the signal to your speakers and let us know how it sounds.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-13T21:32:53.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9584" PostTypeId="2" ParentId="9581" CreationDate="2013-06-13T21:42:43.667" Score="1" Body="&lt;p&gt;I won't go into more details about it - this is a programming question more than a DSP question and as such is off-topic here - but it looks like you want to sum the output of several filters to implement your EQ. To do so:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the filter equations, $y_{n-1}$ and $y_{n-2}$ refer to the past samples output by the filter. For example, when you render the 1300 Hz filter, &lt;code&gt;y[n-1]&lt;/code&gt; and &lt;code&gt;y[n-2]&lt;/code&gt; must refer to the previous samples produced by the 1300 Hz filter. In your code, these variables are storing the sum of the output of all filters. You are not accessing the past of the filter but the past of your sum of 9 filters - and this is one of the reasons why it crashes.&lt;/li&gt;&#xA;&lt;li&gt;You need to preserve the state variable of each filter, not just global state variable (which is meaningless). There are 9 filters, so you'll need to store 9 sets of past output coefficients.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So don't try to be too smart and do too many things at once. Write a &lt;code&gt;PeakingEQ&lt;/code&gt; function that works in a fresh buffer (&lt;code&gt;y[n] = ...&lt;/code&gt;) and keeps track of its own state variable. Get it to work. Then call it several times and accumulate the results in your output buffer. You can clip at the very last step. Then optimize...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you got this fixed, keep in mind also that you'll be summing the output of 9 filters - there's probably a &lt;code&gt;/9&lt;/code&gt; you'll have to add somewhere to keep the global gain unitary when the EQ is set to a flat response.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-13T21:42:43.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9585" PostTypeId="1" CreationDate="2013-06-14T01:55:07.203" Score="5" ViewCount="1842" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Prewitt_operator&quot; rel=&quot;noreferrer&quot;&gt;Prewitt operator&lt;/a&gt; is a common operator to compute &lt;em&gt;image gradient&lt;/em&gt; in &lt;em&gt;edge detection&lt;/em&gt;, and I knew that to apply this &lt;em&gt;Prewitt operator&lt;/em&gt; to an image is just to &lt;strong&gt;convolve&lt;/strong&gt; them together, say, the image is represent as &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and as the wikipedia page lays out, the Prewitt operator for *x-gradient is &lt;span class=&quot;math-container&quot;&gt;$$G_x=\pmatrix{ -1 &amp;amp; 0 &amp;amp; 1\\\ -1 &amp;amp; 0 &amp;amp; 1\\\ -1 &amp;amp; 0 &amp;amp; 1}$$&lt;/span&gt;, for &lt;em&gt;y-gradient&lt;/em&gt; is &lt;span class=&quot;math-container&quot;&gt;$$G_y=\pmatrix{1 &amp;amp; 1 &amp;amp; 1\\\ 0 &amp;amp; 0 &amp;amp; 0\\\ -1 &amp;amp; -1 &amp;amp; -1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if I want to compute the x-gradient of image &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, convolve them like this,&lt;span class=&quot;math-container&quot;&gt;$$A_x=A*G_x$$&lt;/span&gt;, but here comes my problem. &lt;span class=&quot;math-container&quot;&gt;$G_x$&lt;/span&gt; is the &lt;strong&gt;kernel&lt;/strong&gt;, when convolve it with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$G_x$&lt;/span&gt; should be &lt;strong&gt;flipped&lt;/strong&gt; which turn it into this, &lt;span class=&quot;math-container&quot;&gt;$$G_x=\pmatrix{1 &amp;amp;0 &amp;amp;-1\\\ 1 &amp;amp;0 &amp;amp;-1\\\ 1 &amp;amp;0 &amp;amp;-1}$$&lt;/span&gt;&#xA;right? If so, the &lt;em&gt;x-gradient&lt;/em&gt; will be something like this, &lt;span class=&quot;math-container&quot;&gt;$$\nabla A_x=A(x-1,y)-A(x+1,y)$$&lt;/span&gt;&#xA;, &lt;strong&gt;BUT&lt;/strong&gt; I think it should be &lt;span class=&quot;math-container&quot;&gt;$$\nabla A_x=A(x+1,y) - A(x-1,y)$$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So I presume that either &lt;span class=&quot;math-container&quot;&gt;$G_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$G_y$&lt;/span&gt; should not be flipped when convolve them with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$G_x$&lt;/span&gt; doesn't look like the above, and it should be this,&lt;span class=&quot;math-container&quot;&gt;$$G_x=\pmatrix{1&amp;amp; 0&amp;amp; -1\\\ 1&amp;amp; 0&amp;amp; -1\\\ 1&amp;amp; 0&amp;amp; -1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Anyone can help me with this?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-06-24T18:39:30.883" Title="Image Gradient - Flipping Effect of the Convolution Matrix (Kernel) for Edge Detection" Tags="|image-processing|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9586" PostTypeId="2" ParentId="2696" CreationDate="2013-06-14T03:49:08.833" Score="-3" Body="&lt;p&gt;I guess it should be this (in frequency domain, not time domain):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y, fs]=wavread(input);             % read wave file&#xA;&#xA;left=y(:,1);                        % Left channel &#xA;right=y(:,2); % Right channel&#xA;&#xA;fy = fft(left);                     % transform waveform to frequency domain&#xA;&#xA;figure;&#xA;spectrogram(fy);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4812" LastActivityDate="2013-06-14T03:49:08.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9587" PostTypeId="2" ParentId="9578" CreationDate="2013-06-14T04:35:52.607" Score="1" Body="&lt;p&gt;With things indexed from $1$ instead of $0$, $x(t)$ a sinusoid of frequency $18900$ Hz&#xA;followed by a sinusoid of frequency $19950$ Hz with each tone lasting for $42/441000$ seconds and a sampling interval of $T = 1/44100$ seconds, you sample values should be&#xA;$$x[n] = \begin{cases}&#xA;\sin\left(2\pi (18900)(n-1)T\right), &amp;amp;1 \leq n \leq 43,\\&#xA;\sin\left(2\pi (19950)(n-1)T\right), &amp;amp;43 \leq n \leq 85, &#xA;\end{cases}$$&#xA;where $x[43]$ has been defined twice, but since&#xA;$$18900\times 42/44100 = 18, ~~ 19950\times 42/44100 = 19$$&#xA;we have $x[43] = 0$ either way. In fact, $x[43]$ is the switching point where&#xA;the first sinusoid ends (after $18$ periods) and the second sinusoid begins. The&#xA;second sinusoid continues for $19$ periods and ends at $x[85]$.&#xA;Thus, $x[85]$ must also be $0$.  In your figure,&#xA;$x[43]$ appears to be $0$ while $x[85]$ is not shown. However, $x[84] &amp;lt; 0$ seems&#xA;nearly comparable in magnitude to $x[65]$ and since $x[66] &amp;gt; 0.5$, one might&#xA;expect that $x[85] &amp;gt; 0$. So, could you extend your plot by one more point and&#xA;verify that $x[85]=0$ as it should be?&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-06-14T04:35:52.607" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9588" PostTypeId="1" CreationDate="2013-06-14T05:02:37.467" Score="1" ViewCount="729" Body="&lt;p&gt;I am trying to implement a Weighted Matching Pursuit algorithm. Essentially I would like to weight the atoms of a Dictionary (redundant matrix) with a frequency masking function, like the one specified for MP3. I have read some of the papers, and theory of frequency masking, but I am still having trouble figuring out how to generate the function in Matlab. My dictionary contains frequencies ranging from -fs/2 to fs/2. fs = sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can help me out with a quick way to generate this kind of function I would be most grateful.&lt;/p&gt;&#xA;" OwnerUserId="4172" LastActivityDate="2013-06-14T15:14:52.780" Title="Psychoacoustic Masking Curve" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9589" PostTypeId="2" ParentId="9585" CreationDate="2013-06-14T06:31:23.313" Score="5" Body="&lt;p&gt;This is a common question and there are a few other answers on this site which may be helpful. What you have noticed is correct. To be clear, convolution is &lt;em&gt;defined&lt;/em&gt; by this flipping, it gives the convolution operation some nice maths properties. Non-flipping convolution is called cross-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For these kernels, the only thing flipping changes is the sign of the result. You can safely use the inverse (flip) of the kernels to get the form you desire.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-06-14T06:31:23.313" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9590" PostTypeId="1" AcceptedAnswerId="9591" CreationDate="2013-06-14T07:08:19.173" Score="0" ViewCount="4064" Body="&lt;p&gt;I am trying to smooth my discrete-time data points using the method of WMA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I am using n as the window size and the weight array, &lt;code&gt;{n/(n(n+1)/2), (n-1)/(n(n+1)/2), ... , 1/(n(n+1)/2)}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the y-value of each point is irrelevant, I can just simply randomly choose my size n.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However in my case, I hope to &lt;strong&gt;reserve the original values of the data points to the best extent&lt;/strong&gt;. Thus, I cannot choose a big window that averages everything to flat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My cut-off freq. is 3Hz and the sampling rate is 50Hz.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How may I choose the size of the window n?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="4677" LastEditorUserId="4677" LastEditDate="2013-06-14T08:42:09.497" LastActivityDate="2013-06-14T08:53:02.240" Title="How to determine the window size and weights in Weighted Moving Average (WMA), given desired cut-off frequency?" Tags="|filters|discrete-signals|lowpass-filter|moving-average|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9591" PostTypeId="2" ParentId="9590" CreationDate="2013-06-14T08:37:48.073" Score="4" Body="&lt;p&gt;Your normalized window is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w(n)=\frac{2}{N+1}\frac{N-n}{N},\quad n=0,1,\ldots,N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The window satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}w(n)=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means that the gain of the corresponding moving average filter is 1 at DC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For determining the cut-off frequency, we need to compute the frequency response of the window:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W(e^{j\theta})=\sum_{n=0}^{N-1}w(n)e^{-jn\theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some algebra you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W(e^{j\theta})=\frac{2}{N+1}\frac{1-\frac{N+1}{N}e^{-j\theta}+\frac{1}{N}e^{-j(N+1)\theta}}{(1-e^{-j\theta})^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you need to find the value of $N$ for which the magnitude of (1) at the cut-off frequency $\theta_c=2\pi\frac{3Hz}{50Hz}$ becomes $1/\sqrt{2}$ (-3dB). Since $N$ must be integer you cannot get any desired cut-off frequency, but the given cut-off is approximately achieved by $N=9$, for which $|W(e^{j\theta_c})|=0.698$ (-3.13dB).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-14T08:53:02.240" LastActivityDate="2013-06-14T08:53:02.240" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9592" PostTypeId="1" CreationDate="2013-06-14T09:59:06.870" Score="3" ViewCount="324" Body="&lt;p&gt;I have a complex data series, and I would like to fit a fixed number (in this case, two) of complex exponentials of the form $Ae^{jBn}$, where A, B are complex. Not interested in the phase (i.e. arg of A), just its magnitude, and mainly the complex frequency. Target length is maybe 100 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to be able to capture the periodic destructive interference as the addition of these two fitted complex exponential signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Complex time-series in 3D:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qssNX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked into Prony-type methods and noise subspace methods, but I'm at a loss as to what is applicable here.&lt;/p&gt;&#xA;" OwnerUserId="4814" LastEditorUserId="80" LastEditDate="2013-06-14T10:09:17.700" LastActivityDate="2013-06-14T11:30:12.397" Title="Fitting fixed number of complex exponentials to complex signal" Tags="|discrete-signals|frequency|estimation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9593" PostTypeId="2" ParentId="9592" CreationDate="2013-06-14T11:30:12.397" Score="4" Body="&lt;p&gt;Complex A and B are a bit messy. What about using the signal model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f(t) = \sum_{k=1}^{2} A_k\, e^{j(w_k t + \phi_k)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w$ is the frequency and $\phi$ is phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since sinusoids are orthogonal, probably the easiest thing to do is to Fourier transform the signal and pick out the two largest peaks in the positive part of the spectrum. These will correspond to the two main sinusoids.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-06-14T11:30:12.397" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9594" PostTypeId="2" ParentId="9588" CreationDate="2013-06-14T15:14:52.780" Score="3" Body="&lt;p&gt;Psycho acoustic masking is a VERY complicated subject. The masking thresholds (energy required to have one sound be audible in the presence of another) is a very complex function of &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Spectral content and overlap&lt;/li&gt;&#xA;&lt;li&gt;Spatial presentation (there are many books just on binaural masking alone)&lt;/li&gt;&#xA;&lt;li&gt;Time shapes of the waveforms&lt;/li&gt;&#xA;&lt;li&gt;Time alignment and envelopes of the wave forms&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Even the more advanced audio codecs (such HE AAC) use very simplified models because a more accurate one is very complicated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best choice really depends on your application and requirements, monoaural masking of simultaneous sinusoids is probably the easiest case. You may find some helpful stuff here &lt;a href=&quot;https://engineering.purdue.edu/~malcolm/interval/1998-010/&quot; rel=&quot;nofollow&quot;&gt;https://engineering.purdue.edu/~malcolm/interval/1998-010/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-14T15:14:52.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9596" PostTypeId="2" ParentId="9581" CreationDate="2013-06-14T16:18:25.643" Score="0" Body="&lt;p&gt;Instead of answering &quot;what's wrong with my code&quot; I will try to answer the probably more useful &quot;What can I do to figure out what's wrong&quot;.&#xA;There are few things that are useful in debugging these type of problems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check your coefficients against a reference for &quot;known good&quot; filter. For example 1 kHz, 6dB gain, Q =2 and sample rate 44.1 kHz should result in normalized coefficients of b = [1.0341   -1.9119    0.897] and a = [1.0000   -1.9119    0.9314]&lt;/li&gt;&#xA;&lt;li&gt;Try some simple signals where you know the answer. Try the 1kHz/+6dB filter wsith a 40 Hz sine wave. You should get input = output (or very close to that). Then try a 1 kHz sine wave. The output should be roughly twice the size of the input&lt;/li&gt;&#xA;&lt;li&gt;You can also inspect the output sine wave for any discontinuities are shape deformation&lt;/li&gt;&#xA;&lt;li&gt;Replace the filtering with a very simple operation. For example output = input*0.1. IF that doesn't work, then your problem has nothing to do with the filtering but with routing inputs and outputs.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Two more remarks&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your code is very inefficiently written. Unless you have a really good optimizing compiler this may take a lot more CPU cycles that it has to (which may or may not be a problem)&lt;/li&gt;&#xA;&lt;li&gt;You hard clip the min and max of the output to [-1,+1]. That would be probably be unacceptable for any commercial application. For a hobby project that's okay.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-14T16:18:25.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9597" PostTypeId="1" AcceptedAnswerId="9598" CreationDate="2013-06-14T10:21:44.560" Score="2" ViewCount="923" Body="&lt;p&gt;I know that both SIFT and SURF descriptor vectors are normalized with (unit vectors) to deal with illumination changes, but as far as I can see, the SIFT descriptors are also normalized with the major orientation of the keypoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if the SURF descriptor does this, as I cant find anything about this in the SURF paper by Herbet et al?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any help with this!&#xA;I am currently using SURF descriptor as included with matlab computer vision toolbox.&lt;/p&gt;&#xA;" OwnerUserId="4821" OwnerDisplayName="Alex" LastActivityDate="2013-06-14T17:08:36.787" Title="Are SURF descriptors normalized with respect to orientation?" Tags="|matlab|image-processing|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9598" PostTypeId="2" ParentId="9597" CreationDate="2013-06-14T10:33:28.060" Score="1" Body="&lt;p&gt;The SURF descriptor implicitly accounts for orientation of the interest points based on the distribution of edge intensities around it. So yes it is invariant to rotation. This is also mentioned in the description of the SURFPoints class:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Orientation   &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Describes the orientation of the detected feature. This value must be&#xA;  specified as an angle, in radians. The angle is measured from the&#xA;  X-axis with the origin at the point given by the Location property.&#xA;  Typically, this value gets set during the descriptor extraction&#xA;  process. The extractFeatures function modifies the default value of 0.&#xA;  Do not set this property manually. Rely instead on the call to&#xA;  extractFeatures to fill in this value. The Orientation is mainly&#xA;  useful for visualization purposes.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Default: 0.0&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4828" OwnerDisplayName="Zaphod" LastActivityDate="2013-06-14T10:33:28.060" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9599" PostTypeId="1" AcceptedAnswerId="22146" CreationDate="2013-06-14T17:08:42.780" Score="8" ViewCount="2442" Body="&lt;p&gt;I need to compute the eigenvalues and eigenvectors of a 3D image Laplacian. I'm trying to evaluate the heat kernel on the 3D uniform grid (the uniform structure generated by the voxelized image) at different time values, to implement a &lt;a href=&quot;http://www.cs.technion.ac.il/~ron/PAPERS/Conference/RavBroBroKim3DOR2010.pdf&quot;&gt;Volumetric Heat Kernel Signature&lt;/a&gt; (please see the &quot;Numerical computation&quot; section). The domain I'm working on is not rectangular, so I have 1s on some grid points and 0s on other points, producing a binary 3D shape. I've been reading about this for 2D: in 2D, the laplacian of every grid point is calculated and the eigenvalues and eigenvectors of the resulting matrix are then calculated. How can I do this for 3D?All the information and examples I have read are for 2D images. The specific questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can I obtain a matrix from the 3D image I obtain after applying it a (3x3x3) discrete Laplace operator?&lt;/li&gt;&#xA;&lt;li&gt;If there is no way to obtain a matrix, then I should compute the eigenvalues and eigenvectors of a 3D structured grid. What is the simplest way to do this? Could you recommend me any soft for doing this?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate any hint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="128" LastEditDate="2021-11-20T08:18:28.173" LastActivityDate="2021-11-20T08:18:28.173" Title="Eigenvalues and Eigenvectors of a 3D Image Laplacian" Tags="|image-processing|linear-algebra|3d|eigendecomposition|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9600" PostTypeId="2" ParentId="9573" CreationDate="2013-06-14T18:45:34.873" Score="1" Body="&lt;p&gt;Some very cool although a bit more time consuming options: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Active contours will try to find the best &quot;edge&quot; for the cells while maintaining smoothness.&#xA;and is implemented in matlab2013a ( &lt;a href=&quot;http://www.mathworks.com/help/images/ref/activecontour.html&quot; rel=&quot;nofollow&quot;&gt;active contour&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You might try using &lt;a href=&quot;http://www.mathworks.com/help/vision/ref/detectmserfeatures.html&quot; rel=&quot;nofollow&quot;&gt;mser&lt;/a&gt; which is an approach which detects regions which are similiar and in color and stable over the image. which means they stay about the same size over a wide array of thresholds.&#xA;I used it for a similar problem with detecting ultrasound tumors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have a good database of images ( good = covering most cases )  I would try some machine learning algorithms. for example, you could learn on the mean and variance of the objects in the image.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have trouble separating the cells after segmentation ( i.e. you have two connected cells ) I would try looking at the watershed function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2013-06-14T18:45:34.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9601" PostTypeId="2" ParentId="8757" CreationDate="2013-06-14T18:52:10.513" Score="2" Body="&lt;p&gt;Thats funny,  I was exactly trying to fill the same gap.&#xA;I found the several sites which helped me&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is one of them : &#xA;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm&quot; rel=&quot;nofollow&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover , I recommend on creating a black image and playing with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;black = false(500,500);&#xA;black(10:40:end,:) = true;&#xA;black = imrotate(black , 45 , 'crop');&#xA;ffim = fftshift ( abs ( fft2 ( black ) ) );&#xA;lffim = log ( ffim ) ;&#xA;fs(lffim,[]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2013-06-14T18:52:10.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9602" PostTypeId="1" CreationDate="2013-06-14T19:16:19.153" Score="4" ViewCount="661" Body="&lt;p&gt;I'd like to do a deconvolution of image. For example for convolution I'm using a $3\times 3$ mask with all elements $= 1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; 1 &amp;amp; 1\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a pixel $X$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{bmatrix}X_1 &amp;amp; X_2 &amp;amp; X_3 \\ X_4 &amp;amp; \ \mathbf X &amp;amp; X_5 \\ X_6 &amp;amp; X_7 &amp;amp; X_8\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is convolved by a kernel given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{bmatrix}a &amp;amp; b &amp;amp; c \\ d &amp;amp; e &amp;amp; f \\ g &amp;amp; h &amp;amp; i\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe $X$ should be determined as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X=\frac{aX_1+bX_2+cX_3+dX_4+eX+fX_5+gX_6+hX_7+iX_8}{a+b+c+d+e+f+g+h+i}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a basic convolution. Now I'd like to do a deconvolution of an image which was convolved with above mask. Does anybody know how to count that?&lt;/p&gt;&#xA;" OwnerUserId="4820" LastEditorUserId="128" LastEditDate="2020-04-08T08:22:15.953" LastActivityDate="2020-04-08T08:22:15.953" Title="Deconvolution of Images - How To?" Tags="|image-processing|matlab|convolution|deconvolution|inverse-problem|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9603" PostTypeId="2" ParentId="9602" CreationDate="2013-06-14T23:21:13.053" Score="1" Body="&lt;p&gt;Deconvolution is in the general case not possible, so it needs to be approximated with application specific constraints and requirements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at a simple 1-dimensional example that illustrates the problem. Assume you have an impulse response like your kernel, i.e. &lt;code&gt;h = [1 1 1]&lt;/code&gt;. Then let's look at the output of a signal (which you can think of a line of pixels), &lt;code&gt;x = [2 -1 -1 2 -1 -1 2 -1 -1 2 -1 -1 2 -1 -1]&lt;/code&gt;. The result of the convolution is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2   1   0   0   0   0   0   0   0   0   0   0   0   0   0  -2  -1&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So except for the overhang at the edges, the result is all zeros. Information is lost and you cannot re-construct the original image from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is equivalent to multiplication in the frequency domain, so de-convolution is basically division in the frequency domain. That's a problem when the thing you divide by is zero or very close to zero. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="80" LastEditDate="2013-06-15T23:57:03.870" LastActivityDate="2013-06-15T23:57:03.870" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9604" PostTypeId="1" AcceptedAnswerId="9606" CreationDate="2013-06-14T23:39:28.560" Score="5" ViewCount="3638" Body="&lt;p&gt;I hate this kind of questions, but I'm really stuck. I'm trying to implement &lt;strong&gt;Lucas-Kanade&lt;/strong&gt; algorithm as described in &lt;a href=&quot;http://www.ri.cmu.edu/pub_files/pub3/baker_simon_2004_1/baker_simon_2004_1.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; (see pages 4 and 5). Unlike most explanations I've seen they don't assume optical flow, but instead use affine transformation for most examples and in general refer to warp function just as $W(x, p)$, where $x$ is the point and $p = (p_1, p_2, p_3, p_4, p_5, p_6)^T$ is parameter vector of affine transformation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the beginning of page 4 authors outline their version of Lucas-Kanade algorithm. I'm stuck at steps (4) and (5), namely, evaluating the &lt;strong&gt;Jacobian&lt;/strong&gt; $\frac{\partial W}{\partial p}$ and calculating the &lt;strong&gt;steepest descent images&lt;/strong&gt; $\nabla I\frac{\partial W}{\partial p}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(As far as I can understand, $\nabla I$ is just a pair of 2 matrices $(\frac{\partial I}{\partial x}, \frac{\partial I}{\partial y})$ in this context. Please, correct me if I'm wrong). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Authors carefully describe affine warp and even provide formula for its Jacobian (Equation 8): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial W}{\partial p} = \pmatrix{x &amp;amp; 0 &amp;amp; y &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; x &amp;amp; 0 &amp;amp; y &amp;amp; 0 &amp;amp; 1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Jacobian of the warp is (not surprisingly) defined only for a single pixel and not the entire image. But in step (5) we calculate multiplication of image gradient and this Jacobian - $\nabla I \frac{\partial W}{\partial p}$, and as far as I can see from the context (see, for example, Figure 2 on page 5), it is done for the whole image and not per pixel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, &lt;strong&gt;how should I interpret&lt;/strong&gt; this multiplication and what are the real &lt;strong&gt;sizes/formats&lt;/strong&gt; of $\nabla I$ and $\frac{\partial W}{\partial p}$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that this question may require reading a lot from that paper, so I will be glad to explain any point that is not clear enough. Also feel free to refine question title or contents if you have an idea of a better wording. &lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="26573" LastEditDate="2018-05-07T15:39:59.603" LastActivityDate="2020-03-03T17:56:08.477" Title="Jacobian of affine warp in Lucas-Kanade image alignment" Tags="|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9606" PostTypeId="2" ParentId="9604" CreationDate="2013-06-15T09:51:23.700" Score="4" Body="&lt;p&gt;You're right that all the quantities are computed for a single pixel, so in the product&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\nabla I\cdot \frac{\partial W}{\partial p}\cdot\Delta p\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the sizes of the vectors and matrices are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\nabla I\quad\;\;\; 1\times 2\\&#xA;\frac{\partial W}{\partial p}\quad 2\times n\\&#xA;\Delta p\quad\;\;\;\; n\times 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of parameters. So the expression in (1) is a scalar. The total error measure given by Equation (6) in the paper is the sum of this scalar expression over all pixels.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2020-03-03T17:56:08.477" LastActivityDate="2020-03-03T17:56:08.477" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9608" PostTypeId="1" AcceptedAnswerId="9609" CreationDate="2013-06-16T01:38:53.963" Score="0" ViewCount="84" Body="&lt;p&gt;In A3E transmission, I wonder how a single antenna is used to transmit a carrier wave, upper sideband and lower sideband altogether at the same time? &lt;/p&gt;&#xA;" OwnerUserId="4826" LastActivityDate="2013-06-16T03:23:14.453" Title="Double sideband AM" Tags="|modulation|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9609" PostTypeId="2" ParentId="9608" CreationDate="2013-06-16T03:23:14.453" Score="3" Body="&lt;p&gt;The &lt;em&gt;antenna&lt;/em&gt; does not do Fourier analysis and has no idea that there is a carrier signal and an upper sideband and lower sideband. Whatever the signal applied to the antenna&#xA;via electrical wiring or coax cable or transmission line, the flow of current in the antenna causes an electromagnetic wave (coupled time-varying electrical and magnetic fields)&#xA;to be created and propagated out into the medium.  Antennas do have frequency responses&#xA;and input signals at different frequencies are not radiated equally and so&#xA;for double-sided AM the antenna is designed such that the frequency response is essentially&#xA;constant over the bandwidth of the AM signal.  In AM, the carrier frequency is usually&#xA;very much larger than the bandwidth of the &lt;em&gt;modulating signal&lt;/em&gt; and so the antenna needs to&#xA;have essentially flat frequency response over only a relatively small band of frequencies,&#xA;such as a $10$ kHz band centered at $25$ MHz.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-06-16T03:23:14.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9610" PostTypeId="1" CreationDate="2013-06-16T12:31:30.167" Score="4" ViewCount="3864" Body="&lt;p&gt;I have the original signal, a .wav file and by blind source separation, i have reconstructed the signal.&#xA;How can I calculate the SNR in this case? or is it good to use any other performance parameters? What should be an acceptable value of SNR? &lt;/p&gt;&#xA;" OwnerUserId="4829" LastEditorUserId="29" LastEditDate="2013-06-18T20:38:58.213" LastActivityDate="2013-06-19T00:34:21.420" Title="SNR calculation in audio reconstruction and what is an acceptable value" Tags="|audio|source-separation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9612" PostTypeId="2" ParentId="9610" CreationDate="2013-06-16T13:25:09.363" Score="5" Body="&lt;p&gt;The common practice in the source separation community is to report 3 metrics defined in &lt;a href=&quot;http://hal.archives-ouvertes.fr/docs/00/54/42/30/PDF/vincent_TASLP06bis.pdf&quot; rel=&quot;nofollow&quot;&gt;Vincent et al's paper&lt;/a&gt;, called SDR (signal to distortion ratio), SIR (signal to interferences ratio), and SAR (signal to artifacts ratio).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this is that in source separation applications, there can be two types of &quot;noise&quot; in the reconstructed signal: noise due to mis-separation, called &lt;em&gt;interferences&lt;/em&gt; (for example, if you want to extract the vocals from a song, this would be a residual of the background music), and noise due to the reconstruction algorithm itself, called &lt;em&gt;artifacts&lt;/em&gt; (for example, glitches due to the STFT phase estimation process). The former is sometimes referred to as &quot;crosstalk&quot; in other contexts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is usually an application-dependent trade-off between the two - for example in a Karaoke application (vocal removal), it is not a big problem if the audio accompaniment has still a few traces of the original voice (low SIR), as long as the result is pleasing to the ears and glitch-free (high SAR). Most separation algorithms have &quot;knobs&quot; that will allow you to balance SAR and SIR. For example, increasing the STFT window size tends to increase SIR but decreases SAR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The estimation of these metrics is described in the paper by Vincent et al, and implemented in the &lt;a href=&quot;http://bass-db.gforge.inria.fr/bss_eval/&quot; rel=&quot;nofollow&quot;&gt;bss_eval toolbox&lt;/a&gt;. Of course, access to the original individual sources you want to recover is necessary! You will have to evaluate your algorithm on a data-set for which the &quot;right answer&quot; (original individual track) is known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the acceptable value of the metrics, you need to compare your results with those published in the academia for the same problem you are attempting to solve. Keep in mind that these are objective metrics, and as such, do not take into account the perceptual quality of the noise. It might be possible that an algorithm with a -12dB SAR will be more pleasing to the ears than an algorithm with a -24dB SAR if the former produces artifacts well spread in time and below the masking threshold of the reconstructed signal. SDR/SIR/SAR can be used in development to rule out bad ideas and tune your algorithms, but for a commercial application, listening tests are ultimately necessary.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-06-19T00:34:21.420" LastActivityDate="2013-06-19T00:34:21.420" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9613" PostTypeId="1" AcceptedAnswerId="9614" CreationDate="2013-06-16T17:33:55.623" Score="0" ViewCount="304" Body="&lt;p&gt;I have the impression there is little added value for more than 100 dB of attenuation in a  stopband of significant width (i.e. not just a specific frequency). What is the point at which there is little practical application for more attenuation (80 dB, 100 dB, 120 dB, ...) over a stopband of significant width? Also what factor drives this point of no added value? My guess is that the highest useful attenuation is determined by the limited precision that we can measure voltage or any parameter that we might want to filter.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2013-06-16T18:46:12.547" Title="What is the highest relevant stopband attenuation for a 1-D digital filter?" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9614" PostTypeId="2" ParentId="9613" CreationDate="2013-06-16T18:46:12.547" Score="1" Body="&lt;p&gt;That really depends on the application. For example this processor: &lt;a href=&quot;http://www.analog.com/en/processors-dsp/sharc/adsp-21364/products/product.html&quot; rel=&quot;nofollow&quot;&gt;http://www.analog.com/en/processors-dsp/sharc/adsp-21364/products/product.html&lt;/a&gt;&#xA;has 140 dB SNR in it's sample rate converter. That means the stop band attenuation of the interpolation filter must be at least as high but it's more likely to be 150dB - 160dB. You need extra head room to manage the fractional indices into the poly-phase filter bank in irrational sample rate converters&lt;/p&gt;&#xA;" OwnerUserId="224" LastActivityDate="2013-06-16T18:46:12.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9616" PostTypeId="1" CreationDate="2013-06-16T19:36:57.733" Score="2" ViewCount="1959" Body="&lt;p&gt;I read various papers about the log polar transform and its application on template matching with images and have some questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In &quot;Image Registration Using Log Polar Transform and Phase Correlation to Recover Higher Scale&quot; the authors say:&#xA;&quot;In this algorithm first the sense image is downscaled by the factor of 2. Log-Polar algorithm gives best result for any value of rotation and translation but it will not work if the scale is more than 1.8 or 2, as the frequency components alters at high scale [7].&quot; In the referenced paper &quot;IMAGE REGISTRATION USING LOG-POLAR TRANSFORM AND  PHASE CORRELATION&quot; the authors only mention at the end that their results are verified with a scaling factor up to 2.0, there is no mention at all about altering frequency components at high scale.&#xA;Then I read through &lt;a href=&quot;http://cvpr.uni-muenster.de/teaching/ss08/seminarSS08/downloads/Wentker-Vortrag.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://cvpr.uni-muenster.de/teaching/ss08/seminarSS08/downloads/Wentker-Vortrag.pdf&lt;/a&gt; . He says that the polar transform is unable to detect scales &gt; 2, the log transform doesn't have it. This clearly contradicts the first paper, which says the log polar transform can only go to scales &amp;lt; 2.&#xA;So does the log polar transform normally only work up to scale 2.0?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Regarding question 1, what exactly is the reason that it only works up to a scale of 2? The altering frequency components are mentioned, but I don't know what they really mean with that and it is never explained in any of the papers I found, only that this value exists.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the presentation &lt;a href=&quot;http://cvpr.uni-muenster.de/teaching/ss08/seminarSS08/downloads/Wentker-Vortrag.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://cvpr.uni-muenster.de/teaching/ss08/seminarSS08/downloads/Wentker-Vortrag.pdf&lt;/a&gt; page 22, we have the normal, polar and log-polar transformed image. The polar image has the black areas, which are parts that can't be mapped to the original image because it would be outside of its boundaries. However, these areas have nearly disappeared in the log polar image. Why is that? I tested various Logpolar implementations using OpenCV, Python, another example is &lt;a href=&quot;https://dsp.stackexchange.com/questions/6194/scale-and-rotation-invariant-template-matching&quot;&gt;Scale and Rotation invariant Template Matching&lt;/a&gt; and all the time, the log polar images looks more like the middle image and not like the right one.&#xA;What exactly is happening here? Why does the third image look so different, compared to other log polar images which look more like the second?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope you can answer my questions.&lt;/p&gt;&#xA;" OwnerUserId="4832" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-06-18T19:29:19.507" Title="Questions about log polar transform" Tags="|computer-vision|template-matching|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9617" PostTypeId="1" AcceptedAnswerId="9619" CreationDate="2013-06-16T19:46:53.127" Score="5" ViewCount="365" Body="&lt;p&gt;I've looked at various resources about &lt;a href=&quot;http://en.wikipedia.org/wiki/Delta-sigma_modulation&quot; rel=&quot;nofollow&quot;&gt;Delta-Sigma modulators&lt;/a&gt;, and I find them fascinating.  However, I'm confused on a particular point and and am looking for an explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my understanding, the Delta-Sigma modulators operates by sampling at a very high sampling rate (much higher than the ulitmate rate) an input analog signal.  During this process the digitized signal converted back to into an analog waveform and fed back into the input signal (possibly a number of times) which has the effect of high pass filtering the quantization noise -- so-called 'Noise Shaping'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, so good.  To me, this makes sense.  However, the next stage, I find confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting digitized signal has been quantized using only single bit, and somehow, a digital filter is then applied to this signal which does two things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Filters out the shaped quantization noise and&#xA;(2) Re-quantizes the signal to a much higher resolution (e.g. 1-bit =&gt; 24-bit)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting signal is then decimated to the desired sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is about the re-quantization.  How is this performed?  Any pointers appreciated.  If you wish to poke any other holes in my understanding of DSM, that's also fine.  Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4391" LastEditorUserId="21075" LastEditDate="2020-05-01T13:36:37.910" LastActivityDate="2020-05-01T13:36:37.910" Title="How does Delta-Sigma Modulation convert a 1-bit signal to higher resolution signal?" Tags="|sampling|delta-sigma|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9619" PostTypeId="2" ParentId="9617" CreationDate="2013-06-16T23:35:39.720" Score="1" Body="&lt;p&gt;The output of the low-pass filter consists, in principle, of real numbers. This is because, unlike the input values, the filter coefficients are not quantized to one bit and several of them are added to yield one output sample, as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, there is no such thing as real numbers in a finite computer; but you may compute the filter output to any desired precision, such as 24-bit.&lt;/p&gt;&#xA;" OwnerUserId="4712" LastActivityDate="2013-06-16T23:35:39.720" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9620" PostTypeId="1" AcceptedAnswerId="9765" CreationDate="2013-06-17T00:17:55.273" Score="0" ViewCount="273" Body="&lt;p&gt;How exactly is a wavelet used digitally? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Wavelet&quot; rel=&quot;nofollow&quot;&gt;Wikipedia states&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For example, a wavelet could be created to have a frequency of Middle&#xA;  C and a short duration of roughly a 32nd note. If this wavelet was to&#xA;  be convolved with a signal created from the recording of a song, then&#xA;  the resulting signal would be useful for determining when the Middle C&#xA;  note was being played in the song.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Would this be a data structure holding e.g {sampleNumber, frequency} pairs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a wavelet is an array of these pairs, how is it applied to the audio data?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this wavelet apply to the analysis when using an FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is actually being compared to identify the signal?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="29" LastEditDate="2013-06-18T19:09:33.727" LastActivityDate="2013-07-28T13:45:12.410" Title="Programming Wavelets for Audio Identification" Tags="|audio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9623" PostTypeId="1" AcceptedAnswerId="9624" CreationDate="2013-06-17T06:41:44.860" Score="0" ViewCount="1833" Body="&lt;p&gt;I'd like to create an image classifier that takes a set of labeled images and creates a classifier to be used on some unknown images. Most of the examples I see assume all images are the same size (m x n pixels), but my training set will have pictures of various sizes. This is a problem because training my classifier will have the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Load each image into m x n array&lt;/li&gt;&#xA;&lt;li&gt;Employ some filter&lt;/li&gt;&#xA;&lt;li&gt;Transform m x n array into 1 x (m * n) array&lt;/li&gt;&#xA;&lt;li&gt;Feature selection&lt;/li&gt;&#xA;&lt;li&gt;Train classifier&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The different sized images is a problem because step 3 will yield arrays of different lengths if the images don't have the same number of pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a background in statistics, not image processing, and I haven't been able to find any general guidelines for how to handle this problem. I'll be working in Python, and it would also be nice to know if there are libraries perform image resizing.&lt;/p&gt;&#xA;" OwnerUserId="4833" LastActivityDate="2013-06-18T19:05:19.763" Title="What is the standard way to handle images of different sizes for classification?" Tags="|image-processing|classification|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9624" PostTypeId="2" ParentId="9623" CreationDate="2013-06-17T12:07:58.327" Score="0" Body="&lt;p&gt;Erik, for dealing with images of different sizes, google SIFT, Scale Invariant Feature Transform. OpenCV has an implementation of SIFT, and you are all set to go.&lt;/p&gt;&#xA;" OwnerUserId="4142" LastEditorUserId="4142" LastEditDate="2013-06-17T12:18:09.377" LastActivityDate="2013-06-17T12:18:09.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9625" PostTypeId="1" CreationDate="2013-06-17T14:10:31.483" Score="2" ViewCount="155" Body="&lt;p&gt;I'm implementing a very basic forward and inverse DWT, based on Mallat's book. Nothing fancy, simple inefficient matlab code (proof-of-concept more than runtime necessary, so I'm not focusing on optimisation). It &lt;em&gt;almost&lt;/em&gt; works. I'm getting a distortion along the top and left edges. I'll &lt;strike&gt;post&lt;/strike&gt; link to (need 10 points to post) some pictures of lichtenstein to exhibit the behaviour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://postimg.org/image/igy8cv7hn/&quot; rel=&quot;nofollow&quot;&gt;http://postimg.org/image/igy8cv7hn/&lt;/a&gt;&lt;br&gt;&#xA;From top-to-bottom:&lt;br&gt;&#xA;* After 5 iterations.&lt;br&gt;&#xA;* After some unpacking iterations, you can see the distortion along the top and left edges growing.&lt;br&gt;&#xA;* Unpacked and distorted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using symmetric boundary conditions (I've implemented both whole and half, it doesn't make much of a difference) and Haar. Although using CDF has the same effect (the distortion is a little different, but same location along the entire edge). Since the rest of the picture is transformed and inverted perfectly, there is most likely nothing wrong with the implementation as a whole. It must be some kind of index offset. It is clear that the expansion of the distortion is dyadic - it doubles in size for every step of the inverse loop. Two days and lots of index changing has led to no breakthroughs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've pasted the code &lt;a href=&quot;http://pastebin.com/WuZtfNdq&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; (I realise it's unlikely people will want to preuse 100 lines of foreign code, but I'm a little desperate). It's pretty simple to run (although like I said it's slow - can take up to a minute to run):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;runbackward(runforward(rgb2gray(imread('lichtenstein.png')), 5),5)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any code-based help or high-level diagnostic ideas would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4835" LastActivityDate="2014-01-06T09:44:20.820" Title="DWT edge/indexing problem" Tags="|wavelet|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9626" PostTypeId="2" ParentId="9625" CreationDate="2013-06-17T17:14:33.860" Score="1" Body="&lt;p&gt;Bjorne, I am not exactly sure what you are trying to do but I can assure you that the simplest of DWT code is not more than 10 lines in Matlab. Here is how to do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;approx = zeros(1, cols);&#xA;details = zeros(1, cols);&#xA;&#xA;%for Haar Wavelet, Use filterbanks in Matlab, google it!&#xA;&#xA;hi = ...&#xA;lo = ...&#xA;&#xA;for i = 1: Level&#xA;&#xA;   a = conv2(signal, lo);&#xA;   d = conv2(signal, hi);&#xA;&#xA;&#xA;   detail() =  downsample(d);&#xA;   approx() =  downsample(a);&#xA;   signal = downsample(a);&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is pretty much everything you need to compute DWT. As for the values between the parenthesis in detail and approximation, just fill in the indexes.&lt;/p&gt;&#xA;" OwnerUserId="4142" LastActivityDate="2013-06-17T17:14:33.860" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9628" PostTypeId="1" CreationDate="2013-06-17T18:48:45.223" Score="9" ViewCount="801" Body="&lt;p&gt;Define an $n\times N$ sensing matrix $A$ by $A_{ij} = 0$ with probability $p$, and $A_{ij} = 1/\sqrt{n}$ with probability $1-p$.  Does $A$ satisfy the &lt;a href=&quot;http://en.wikipedia.org/wiki/Restricted_isometry_property&quot;&gt;restricted isometry property&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, the symmetric case is answered in the following paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;R.G. Baraniuk, M.A. Davenport, R.A. DeVore, and M.B. Wakin, &quot;A simple&#xA;  proof of the restricted isometry property for random matrices,&quot;&#xA;  Constructive Approximation, 28(3) pp. 253-263, December 2008.&#xA;  (&lt;a href=&quot;http://users.ece.gatech.edu/~mdavenport/publications/bddw-ca-2008.pdf&quot;&gt;pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4840" LastEditorUserId="35" LastEditDate="2013-06-17T19:19:24.933" LastActivityDate="2014-05-08T00:09:40.187" Title="Does an asymmetric Bernoulli matrix satisfy the RIP?" Tags="|compressive-sensing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9630" PostTypeId="2" ParentId="9623" CreationDate="2013-06-17T19:23:46.053" Score="1" Body="&lt;p&gt;Not sure about your specific application, but the &lt;a href=&quot;http://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework&quot; rel=&quot;nofollow&quot;&gt;Viola Jones&lt;/a&gt; face detection algorithm successively scans the candidate picture for faces in all possible sizes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e., the algorithm search space is both the object (face) location and its size. The beauty of VJ's &quot;cascade architecture&quot; is that it rejects most hypotheses quickly, thus making the search feasible in real-time. &lt;/p&gt;&#xA;" OwnerUserId="1082" LastActivityDate="2013-06-17T19:23:46.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9631" PostTypeId="1" AcceptedAnswerId="9632" CreationDate="2013-06-17T22:39:43.060" Score="4" ViewCount="2992" Body="&lt;p&gt;I have a signal which looks something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5vwMD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 12 main round peaks is what I'd like to keep. However, the peak detection algorithm I apply is picking up the in-between noisy peaks. Any strategies I could use to get rid of this noise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried smoothing the signal, but the noisy peaks are still there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4110" LastActivityDate="2016-03-19T23:22:04.097" Title="Removing unwanted peaks from signal" Tags="|noise|signal-analysis|signal-detection|peak-detection|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9632" PostTypeId="2" ParentId="9631" CreationDate="2013-06-17T23:38:41.557" Score="4" Body="&lt;p&gt;Maybe you could tell us more about the peak picking algorithm you are using!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some ideas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use median filtering to remove noise (rather than a linear filter).&lt;/li&gt;&#xA;&lt;li&gt;If you have prior knowledge of the shape of the peaks you want to detect, use a correlator (matched filter) for this shape.&lt;/li&gt;&#xA;&lt;li&gt;Discriminate peaks according their amplitude.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-17T23:38:41.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9636" PostTypeId="2" ParentId="9631" CreationDate="2013-06-18T07:02:36.900" Score="2" Body="&lt;p&gt;A few more comments in support of pichenettes' answer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the desired peaks seem to be equidistant. If you know this to be the case then you could use this knowledge in your peak detector.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;otherwise I also believe that median filtering should help a lot.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;don't try to solve everything by a super-smart pre-processing and a dumb peak-detector, but try to combine both in a smart algorithm.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-18T07:02:36.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9638" PostTypeId="2" ParentId="9625" CreationDate="2013-06-18T09:09:46.097" Score="1" Body="&lt;p&gt;The problem was indeed indexing. Since matlab indexes things &quot;mathematically&quot; from 1, there's some disparity to the formulae that were zero-indexed. Some plus ones here and minus ones there sorted things out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm answering instead of just deleting the post for reasons of posterity. Without going through the code the problem could have been diagnosed to something along these lines, since like I said, the problem couldn't have been totally fundamental to the implementation because it was mostly successful. Moreover, it was likely not related to border conditions, since only two of the four borders were affected. Interestingly that distortion pattern was purely index-related.&lt;/p&gt;&#xA;" OwnerUserId="4835" LastActivityDate="2013-06-18T09:09:46.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9639" PostTypeId="1" AcceptedAnswerId="19970" CreationDate="2013-06-18T12:10:04.243" Score="5" ViewCount="2120" Body="&lt;p&gt;I would like to combine two images A and B in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I want to take a Fourier transform of both of them&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) For image A I want to apply a weighted filter, which gives more emphasis for low frequencies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) For image B I want to apply a weighted filter, which gives more emphasis for high frequencies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) I want to combine these frequencies and take the inverse Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone give me any guidelines where I should start (which functions etc.) to do this in Matlab? =) I'm kinda learning about Fourier transform and I want to play around with images. I was hoping if someone could give an example of code how this could be done etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that I'm new at this stuff and I'm not very familiar with all the terminology yet. I'm an amateur trying to learn about Fourier transform by doing an experiment with it :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help! =)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I would appreciate if someone could give me a minimal code snippet showing me what I need to do =) &lt;/p&gt;&#xA;" OwnerUserId="4378" LastEditorUserId="128" LastEditDate="2019-08-18T14:53:52.203" LastActivityDate="2019-08-18T14:53:52.203" Title="How to Combine Low and High Frequencies of Two Images in MATLAB?" Tags="|image-processing|matlab|discrete-signals|fourier-transform|multi-scale-analysis|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9641" PostTypeId="2" ParentId="8924" CreationDate="2013-06-18T14:32:50.277" Score="3" Body="&lt;p&gt;As the questioner refers to &lt;a href=&quot;http://github.com/r3nk/WARPLab-OFDM&quot; rel=&quot;nofollow&quot;&gt;my code at github&lt;/a&gt; in the comments, I'd like to clarify. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;There is no need to apply oversampling in OFDM, nor is oversampling required to recover input signals. However, in practical implementations you have to consider some additional constraints regarding the signal's bandwidth. The &lt;a href=&quot;http://warpproject.org&quot; rel=&quot;nofollow&quot;&gt;WARP&lt;/a&gt; v2 radio board is clocked with 40 MHz, i.e., the Nyquist frequency is 20 MHz. However, the WARP v2 architecture limits the generated baseband signal's bandwidth to ~10 MHz by TX and RX lowpass filters. This is a meaningful measure to avoid unpleasant aliasing effects. Hence, the OFDM signal's bandwidth should be limited to 10 MHz in the baseband. You can easily achieve this by padding all subcarriers above 10 MHz with zeros. This will work perfectly well. &#xA;An alternative (but probably rather uncommon) way to reduce the bandwidth is to apply 2x oversampling while using the majority of all subcarriers. I implemented oversampling in my generic (not-OFDM-related) transmission procedure and finally enabled it in my OFDM code as I could achieve a slightly higher SNR in our office environment with infrequent interference and some narrowband interference. However, you can safely disable oversampling in my code and apply zero-padding instead. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;An OFDM symbol is the time-domain representation of the symbols concurrently transmitted over all subcarriers. It consists of just as many samples as there are OFDM subcarriers since it is calculated as the IDFT of all subcarriers' symbols. When adding the cyclic prefix, you add $N_G$ samples. The duration in seconds is the number of samples times the time per sample. When oversampling, the symbol duration extends according to the oversampling factor. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Kind regards,&#xA;Robin&lt;/p&gt;&#xA;" OwnerUserId="3822" LastActivityDate="2013-06-18T14:32:50.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9642" PostTypeId="2" ParentId="9631" CreationDate="2013-06-18T14:57:43.360" Score="1" Body="&lt;p&gt;It looks like the area under each peak above the local minima is significantly greater for desired peaks than than for that under the &quot;noise spikes&quot;.  You could sum or integrate thus value over the expected pulse width and statistically test it against some threshold.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-06-18T14:57:43.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9644" PostTypeId="1" CreationDate="2013-06-18T16:36:30.893" Score="2" ViewCount="375" Body="&lt;p&gt;Ok I need to understand how some harmonic calculations work to apply some transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a periodic functiion f(x). And I have the values of that function for several values of x (say x goes from 0 to 359) so I have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;f(0)=3&#xA;f(1)=5&#xA;... etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I'm asked to take the max of those values without the first harmonic. How can I do this? and what does it mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Here is the pdf of the method I'm implementing, it's the only one I found publicaly available. There are tables of functionals on the paper which are applioed to texture analysis of images. The result of the second set of functionals is a periodic function and on the third set of functionales there are a couple of functionales where you need to get i of xi so that xi is the max or min value without the first harmonic. &lt;a href=&quot;http://pdf.aminer.org/000/067/295/texture_classification_with_thousands_of_features.pdf&quot; rel=&quot;nofollow&quot;&gt;http://pdf.aminer.org/000/067/295/texture_classification_with_thousands_of_features.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4267" LastEditorUserId="4267" LastEditDate="2013-06-18T19:50:42.130" LastActivityDate="2013-06-18T19:50:42.130" Title="Harmonics on periodic functions" Tags="|transform|" AnswerCount="0" CommentCount="16" ClosedDate="2013-09-06T21:23:50.463" ContentLicense="CC BY-SA 3.0" />
  <row Id="9645" PostTypeId="2" ParentId="9623" CreationDate="2013-06-18T19:05:19.763" Score="1" Body="&lt;p&gt;there isn't really a standard way to perform the task your describing it depends on your choice of features and possibly even your choice of classifier, the simplest answer would be just to resize the image before extracting the features, if your using opencv then this can be achieved using the cvResize function, but as I said it depends entirely on the type of features for instance if your were just using colour and creating colour histograms then you could normalise the histogram by the image size to obtain a feature vector invariant of the image size, other techniques such as bag-of-features can be used to generate scale and rotation invariant features that can be extracted from different sized images. &lt;/p&gt;&#xA;" OwnerUserId="3217" LastActivityDate="2013-06-18T19:05:19.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9646" PostTypeId="2" ParentId="9616" CreationDate="2013-06-18T19:29:19.507" Score="1" Body="&lt;p&gt;3.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The polar image has the black areas, which are parts that can't be&#xA;  mapped to the original image because it would be outside of its&#xA;  boundaries. However, these areas have nearly disappeared in the log&#xA;  polar image. Why is that?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Look at the second (polar) and third (log-polar) images.  What's different about them? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/A2sLr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the 3rd image, stuff that was on the left is now in the center.  Stuff that was in the center is now on the right.  The &quot;log&quot; in log-polar means that you're stretching the image in a logarithmic way.  So the black out-of-image scallops are still there, they've just been squished very thin against the right side of the image, while details from the left side of the image have been stretched out to take their place.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-06-18T19:29:19.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9647" PostTypeId="1" CreationDate="2013-06-18T20:03:41.510" Score="7" ViewCount="305" Body="&lt;h1&gt;The problem&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Take 50+ of Lena images, add gaussian noise to them to the point that you couldn't say it is Lena. I insist, gaussian &lt;em&gt;noise&lt;/em&gt;, &lt;strong&gt;not&lt;/strong&gt; gaussian blurring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine a cropping window randomly moving around Lena's face (like a video camera focused on this part).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have a handful of noisy pictures containing what used to be Lena's face somewhere in the image.  &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;The question&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Now I want to get back the face without knowing it in advance :)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First I have to identify overlapping parts (i.e. noisy faces here) from the set of images.&lt;/li&gt;&#xA;&lt;li&gt;Then I must superimpose the faces.&lt;/li&gt;&#xA;&lt;li&gt;And finally, add them to get back her beautiful face.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem is that I have no clue of how to do that (cross correlation, perhaps to identify the faces and the shift between them).&#xA;I've never had courses in image processing. I just need a reference or an algorithm name.&lt;/p&gt;&#xA;" OwnerDisplayName="user1637" LastActivityDate="2016-07-09T09:14:14.670" Title="How can I perform object tracking using noisy images?" Tags="|image-processing|video-processing|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9648" PostTypeId="1" AcceptedAnswerId="9652" CreationDate="2013-06-19T05:56:20.557" Score="4" ViewCount="1403" Body="&lt;p&gt;I want to simulate a multipath fading channel, different amplitude and delay is given. I want to use delay in padding style. I read that the different values for delay like [0 .6 3.1 ...] represent the delay between the first and last signal arrival? Giving the number of paths, How to simulate it?&#xA;regards&lt;/p&gt;&#xA;" OwnerUserId="4854" LastActivityDate="2013-06-19T15:03:59.230" Title="how to simulate multipath fading?" Tags="|multipath|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9649" PostTypeId="2" ParentId="9648" CreationDate="2013-06-19T07:17:32.597" Score="1" Body="&lt;p&gt;Create a copy of your signal vector for each path, add zeros to its beginning according to how much delay you have. Add noise to each of them, then add them all up.&lt;/p&gt;&#xA;" OwnerUserId="4063" LastActivityDate="2013-06-19T07:17:32.597" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9650" PostTypeId="1" CreationDate="2013-06-19T12:31:29.507" Score="1" ViewCount="3877" Body="&lt;p&gt;Having had little experience in PHP, I moved to C++ in-order to create a spectrogram, I wanted to create probably the simplest/easiest one for my first project, so easy infact I don't need reading/write to files or add settings to it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, as far as I have been learning C++ I was able to manipulate audio file, only to read and write, but the spectrogram works, by reading from a mic and this seems kind of hard to do. I have looked every link in Google, with the word spectogram and C++ in it, but I haven't gotten any useful page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if I am not mistaken, for the project I am working on, it may be good idea to use JAVA, because I read somewhere that JAVA is better than C++  &lt;code&gt;1&lt;/code&gt; in a way it manipulates sound, and &lt;code&gt;2&lt;/code&gt; it is actually easier to learn than C++&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I wanted to ask here, if JAVA is better for my project, which I will be doing in Windows7? &lt;/p&gt;&#xA;" OwnerUserId="4824" LastActivityDate="2013-06-19T14:30:09.710" Title="Programming language for sound manipulation" Tags="|audio|frequency-spectrum|frequency|spectrogram|" AnswerCount="1" CommentCount="4" ClosedDate="2013-06-20T10:17:37.077" ContentLicense="CC BY-SA 3.0" />
  <row Id="9651" PostTypeId="2" ParentId="9650" CreationDate="2013-06-19T14:22:52.217" Score="6" Body="&lt;p&gt;For the first few experiments I would recommend using a scripting language like &lt;a href=&quot;http://www.mathworks.de/products/matlab/&quot;&gt;Matlab&lt;/a&gt; or &lt;a href=&quot;http://www.python.org/&quot;&gt;Python&lt;/a&gt;. They're much easier to understand and much quicker to write than &quot;lower level programming languages&quot; like C++.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab has a &lt;a href=&quot;http://www.mathworks.de/products/signal/&quot;&gt;signal processing toolbox&lt;/a&gt; and can &lt;a href=&quot;http://www.mathworks.de/de/help/matlab/ref/wavread.html&quot;&gt;read and write audio files&lt;/a&gt;, do windowing, FFTs etc. as well as a very simple playback mechanism. Basic 2D and 3D-plotting tools are also built right into the language itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Python there is the &lt;a href=&quot;http://www.scipy.org/&quot;&gt;SciPy&lt;/a&gt; library that does all kinds of scientific computing, including wavefile handling, windowing and FFT as well. Plus, there is the &lt;a href=&quot;http://matplotlib.org/&quot;&gt;Matplotlib&lt;/a&gt; that does all of the plotting for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In C++, you would have to find a UI toolkit that works for your OS, write a drawing widget to plot stuff in and then fill it with data. Plus, obviously all the memory management; wich will probably become the biggest annoyance and time-sink if you're not experienced in doing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement live playback and recording I suggest using &lt;a href=&quot;http://www.portaudio.com/&quot;&gt;portaudio&lt;/a&gt;, a library written in C. There exists a Matlab .MEX utiliy called &lt;a href=&quot;http://www.playrec.co.uk/&quot;&gt;PlayRec&lt;/a&gt; and there are Python bindings called &lt;a href=&quot;http://people.csail.mit.edu/hubert/pyaudio/&quot;&gt;PyAudio&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my experience, if you want to use portaudio I'd suggest using Python. Compiling the .mex utility is a huge pain while Python seemed to &quot;just work&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you manage to get it to work but still want to do it in C++ you can then port the codebase (just a couple of lines in both Matlab or Python) while still using portaudio for the audio input/output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a superficial comparison of the different code-complexities you can take a look at some work I wrote last year. Each implementation does the same thing, just in a different language:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/nils-werner/ftm-cuda&quot;&gt;FTM filter written in C/CUDA (plus some benchmarking stuff)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/nils-werner/ftm-matlab&quot;&gt;FTM filter written in Matlab (plus some plotting stuff)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/nils-werner/ftm-python&quot;&gt;FTM filter written in Python (just the filter, no extras)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4063" LastEditorUserId="4063" LastEditDate="2013-06-19T14:30:09.710" LastActivityDate="2013-06-19T14:30:09.710" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9652" PostTypeId="2" ParentId="9648" CreationDate="2013-06-19T15:03:59.230" Score="3" Body="&lt;p&gt;@MohammedFatehy If you put up -exactly- what you currently know and have, we can help you more. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, let us say you have a signal x[n]. And lets say your sampling rate is 1 Hz. So you take one sample every second. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you want to construct a channel for multipath. Right off the bat, your multipath channel is going to be an FIR filter btw. Let us say someone tells you, &quot;your first echo is going to be 5 seconds away, and attenuates the amplitude by 50%. The second echo is going to be 8 seconds away, and attenuates the amplitude by 70%&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, your channel is going to be simply a vector, (call it channel), such that: channel =  [1 0 0 0 0 0.5 0 0 0.3]. (You have the 1 in the beginning, because that is the 'line of sight' co-efficient. That is, the signal without any echos). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you simply filter your signal x[n] with channel, and you have a multipath response. Does that make sense?&lt;/p&gt;&#xA;" OwnerUserId="293" LastActivityDate="2013-06-19T15:03:59.230" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9653" PostTypeId="2" ParentId="9599" CreationDate="2013-06-19T20:23:59.717" Score="0" Body="&lt;p&gt;Maybe this helps (?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.m.wikipedia.org/wiki/Kronecker_sum_of_discrete_Laplacians&quot; rel=&quot;nofollow&quot;&gt;http://en.m.wikipedia.org/wiki/Kronecker_sum_of_discrete_Laplacians&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;L = Dxx ¤ I ¤ I + I ¤ Dyy ¤ I + I ¤ I ¤ Dzz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where ¤ is the Kronecker product (it's not the proper symbol, didn't know how to get it here). I think the eigenvalues and eigenvectors are computed from the resulting matrix per voxel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tensor-concept as described in the following paper Section 4 seems related, though it's not exactly the same. It is, however, closely related to the Hessian matrix as mentioned @nikie's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Carsten Steger, Subpixel-Precise Extraction of Lines and Edges, International Archives of Photogrammetry and Remote Sensing (2000).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper can be found here:&#xA;&lt;a href=&quot;http://ias.in.tum.de/people/steger/publications&quot; rel=&quot;nofollow&quot;&gt;http://ias.in.tum.de/people/steger/publications&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1302" LastEditorUserId="1302" LastEditDate="2013-06-23T23:21:44.380" LastActivityDate="2013-06-23T23:21:44.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9654" PostTypeId="1" AcceptedAnswerId="9655" CreationDate="2013-06-19T22:03:47.917" Score="19" ViewCount="30276" Body="&lt;p&gt;In some papers, I read that the additive noise is band limited Gaussian white.&lt;br&gt;&#xA;How can I simulate this type of noise use MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="4860" LastEditorUserId="128" LastEditDate="2019-10-27T11:11:19.983" LastActivityDate="2022-01-17T17:07:35.207" Title="How to Generate Band Limited Gaussian White Noise in MATLAB?" Tags="|matlab|noise|gaussian|" AnswerCount="6" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9655" PostTypeId="2" ParentId="9654" CreationDate="2013-06-19T23:18:57.680" Score="19" Body="&lt;p&gt;You would generate bandlimited Gaussian noise by first generating white noise, then filtering it to the bandwidth that you desire. As an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% design FIR filter to filter noise to half of Nyquist rate&#xA;b = fir1(64, 0.5);&#xA;% generate Gaussian (normally-distributed) white noise&#xA;n = randn(1e4, 1);&#xA;% apply to filter to yield bandlimited noise&#xA;nb = filter(b,1,n);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="90" LastEditorUserId="29" LastEditDate="2013-06-21T00:23:34.323" LastActivityDate="2013-06-21T00:23:34.323" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9658" PostTypeId="2" ParentId="9599" CreationDate="2013-06-20T11:51:30.047" Score="0" Body="&lt;p&gt;It's not clear what you're trying to do: The Laplacian is a scalar value, not a matrix. So it has no eigenvalues. Maybe you mean the eigenvalues/-vectors of the Hessian?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate the eigenvalues and eigenvector of the Hessian, you would first calculate the Hessian (a symmetric 3x3 matrix, containing the second derivatives in each of the 3 directions) for each pixel. A simple way to do this is to apply three gradient filters (in x,y,z direction) to your 3d image. Now you have 3 images. To each of those images, you again apply three gradient filters, giving 3x3 results images, containing the 3x3 entries of the Hessian matrix for each pixel. (Since the gradient filters commute, I * gx * gy = I * gy * gx, you really only have to calculate 6 of them.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways to get the eigenvalues and -vectors of this 3x3 matrix: Either find the roots of the characteristic polynomial or use an iterative method. The characteristic polynomial is cubic, so I'm guessing iterative methods would be faster in practice (because cube roots take far longer to calculate the simple addition/multiplications).&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2013-06-20T11:51:30.047" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9659" PostTypeId="2" ParentId="9654" CreationDate="2013-06-20T12:18:19.870" Score="11" Body="&lt;p&gt;Just as a small addition to Jason's answer: usually you need to generate bandlimited noise with a given variance $\sigma^2$. You can add this code to the code given in Jason's answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var = 3.0;  % just an example  &#xA;scale = sqrt(var)/std(nb);&#xA;nb = scale*nb;  % nb has variance 'var'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you have to do the scaling after filtering, because in general the filter changes the noise variance.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-20T12:18:19.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9660" PostTypeId="1" CreationDate="2013-06-20T17:46:48.100" Score="2" ViewCount="71" Body="&lt;p&gt;I am looking for a method to find the region where a function is periodic. So, for example, I have a function that is periodic in some places and not in others, I would want to know the range of x values where it is periodic.&#xA; I'm trying to do this in matlab and I tried to use autocorrelation but I can't use it to find the original range where the signal is periodic&lt;/p&gt;&#xA;" OwnerUserId="4850" LastActivityDate="2013-06-20T17:46:48.100" Title="Finding a region where a function is periodic" Tags="|autocorrelation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9661" PostTypeId="1" AcceptedAnswerId="9663" CreationDate="2013-06-20T17:51:53.727" Score="1" ViewCount="1458" Body="&lt;p&gt;Assuming I have samples of a colored noise.&#xA;I know the empirical Variance of those samples.&#xA;I also know the bandwidth of the filter which colorized the noise (Only the bandwidth, not the actual filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to estimate the variance of the noise if I filter those samples by a (Different) given filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to estimate or bound from above and below the variance of the noise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2013-06-20T20:07:16.720" Title="Estimating Filtered Noise Variance" Tags="|noise|signal-analysis|estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9662" PostTypeId="1" AcceptedAnswerId="10011" CreationDate="2013-06-20T17:53:21.827" Score="3" ViewCount="236" Body="&lt;p&gt;I'm currently facing the following problem: I want to approximate the Fourier transform $F(\omega)$ of a (let's say, $L^2(\mathbb R)$) function $f(x)$ by calculating the discrete Fourier transform, using only a fixed number of sampling points. These points are allowed to lie arbitrarily far away from the origin. In addition, we don't care about computational costs, so the grid can be chosen completely free.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the optimal (with respect to minimizing the error) choice for the grid? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that this choice is dependent on the bandwidth $B$ of $f$. Does this mean that Nyquist-Shannon forces the grid to being broader than $2*B$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I found literature about sparse Fourier transform sampling in case of known sparsity in $F(\omega)$ (compressed sensing). But since my signal does not appear to have sparse support in the frequency domain, I don't see how these methods would be applicable in my case.&lt;/p&gt;&#xA;" OwnerUserId="4858" LastEditorUserId="4858" LastEditDate="2013-07-22T08:39:03.437" LastActivityDate="2013-07-23T00:01:24.107" Title="What is the optimal adaptive grid for calculating a DFT using a fixed number of sampling points?" Tags="|fourier-transform|dft|sampling|nonuniform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9663" PostTypeId="2" ParentId="9661" CreationDate="2013-06-20T20:07:16.720" Score="5" Body="&lt;p&gt;I assume that you have a wide-sense stationary discrete-time input noise signal $x(n)$, a linear time-invariant filter with impulse response $h(n)$, and an output noise process $y(n)$. If we assume that $x(n)$ is zero mean (which is not necessary, but makes it easier) and if we model $x(n)$ as perfectly band-limited, we get for its variance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma_x^2=\frac{1}{2\pi}\int_{-\pi}^{\pi}S_x(e^{j\theta})d\theta=&#xA;\frac{1}{\pi}\int_{\theta_1}^{\theta_2}S_x(e^{j\theta})d\theta\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $S_x(e^{j\theta})$ is the power spectral density of $x(n)$, $\theta$ is the normalized frequency $\theta=2\pi f/f_s$, and $\theta_1$ and $\theta_2$ are the lower and upper band-edges, respectively. With the frequency response of the filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\theta})=\sum_{n=-\infty}^{\infty}h(n)e^{-jn\theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can write the power spectral density of the output noise as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_y(e^{j\theta})=S_x(e^{j\theta})\left|H(e^{j\theta})\right|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its variance is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma_y^2=\frac{1}{2\pi}\int_{-\pi}^{\pi}S_y(e^{j\theta})d\theta=&#xA;\frac{1}{2\pi}\int_{-\pi}^{\pi}S_x(e^{j\theta})\left|H(e^{j\theta})\right|^2d\theta=&#xA;\frac{1}{\pi}\int_{\theta_1}^{\theta_2}S_x(e^{j\theta})\left|H(e^{j\theta})\right|^2d\theta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this equation we can get a lower and upper bound for $\sigma_y^2$ as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\min_{\theta\in [\theta_1,\theta_2]}\left|H(e^{j\theta})\right|^2&#xA;\frac{1}{\pi}\int_{\theta_1}^{\theta_2}S_x(e^{j\theta})d\theta\le\sigma_y^2\le&#xA;\max_{\theta\in [\theta_1,\theta_2]}\left|H(e^{j\theta})\right|^2&#xA;\frac{1}{\pi}\int_{\theta_1}^{\theta_2}S_x(e^{j\theta})d\theta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and from (1) we finally get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\min_{\theta\in [\theta_1,\theta_2]}\left|H(e^{j\theta})\right|^2\sigma_x^2\le&#xA;\sigma_y^2\le\max_{\theta\in [\theta_1,\theta_2]}\left|H(e^{j\theta})\right|^2&#xA;\sigma_x^2\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These bounds can be useful (i.e. relatively tight) if the noise bandwidth is small compared to the bandwidth of the filter $h(n)$. Unfortunately, they are almost useless if the filter bandwidth is small compared to the bandwidth of the input noise process $x(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the latter case, i.e. if the filter bandwidth is much smaller than the noise bandwidth, you can come up with similar bounds as in (2). You just need to estimate the minimum and maximum of the power spectral density $S_x(e^{j\theta})$ within the filter bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-20T20:07:16.720" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9664" PostTypeId="1" AcceptedAnswerId="9672" CreationDate="2013-06-20T22:34:46.263" Score="0" ViewCount="2764" Body="&lt;p&gt;I have a periodic series of 360 values. How can I use the fftw c libraries to get the amplitude and phase of the first, second, third and fourth harmonic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this for N=360&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fftw_plan_r2r_1d(N,input_array,output_array,FFTW_R2HC,FFTW_ESTIMATE);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can get the 360-point Discrete Fourier Transform (DFT) where output_array is complex Hermitian in &lt;strong&gt;half-complex&lt;/strong&gt; format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where k&lt;span class=&quot;math-container&quot;&gt;$^{th}$&lt;/span&gt; component of output_array is the real part and (N-k)&lt;span class=&quot;math-container&quot;&gt;$^{th}$&lt;/span&gt; component of output_array is the imaginary part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I want the amplitude or magnitude(??) of the first harmonic should I do this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ampl_1sth=sqrt(output_array[1]*output_array[1]+output_array[N-1]*output_array[N-1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is that correct? then the amplitude of the second harmonic will be the same but with output_array[2] and output_array[N-2] and so on right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then how can I get the phase of the first, second, third and fourth harmonic with the info from the DFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a reference to fftw see here www.fftw.org/fftw3.pdf&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4267" LastEditorUserId="8202" LastEditDate="2020-02-04T11:11:01.227" LastActivityDate="2020-02-04T11:11:01.227" Title="Getting the amplitude and phase of harmonics in C" Tags="|fft|fourier-transform|transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9665" PostTypeId="1" CreationDate="2013-06-20T22:37:44.510" Score="5" ViewCount="573" Body="&lt;p&gt;I have implemented Dutt &amp;amp; Rokhlin's FFT algorithm [1] for non-equispaced data but for some reason I am getting very large errors (&lt;span class=&quot;math-container&quot;&gt;$E_2=0.04$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_\infty=0.1$&lt;/span&gt;). I was wondering if there are any free available implementation of this method so I can compare my implementation.&lt;/p&gt;&#xA;&lt;p&gt;[1] Dutt, Alok, and Vladimir Rokhlin. &amp;quot;Fast Fourier transforms for nonequispaced data.&amp;quot; SIAM Journal on Scientific computing 14.6 (1993): 1368-1393.&lt;/p&gt;&#xA;" OwnerUserId="1696" LastEditorUserId="7092" LastEditDate="2022-01-17T17:07:21.373" LastActivityDate="2022-01-17T17:07:21.373" Title="Non Uniform DFT Algorithm by Dutt &amp; Rokhlin" Tags="|fft|dft|software-implementation|nonuniform|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9666" PostTypeId="1" CreationDate="2013-06-20T23:40:24.147" Score="1" ViewCount="1374" Body="&lt;p&gt;I am trying to make proper use of the circular convolution property of DFT.&#xA;I was taught that the DFT of &lt;code&gt;x[n]*CircularConv*y[n]&lt;/code&gt;, would be equal the product of the individual DFT's &lt;code&gt;X[k]&lt;/code&gt;,&lt;code&gt;Y[k]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the problem im trying to solve, the signal &lt;code&gt;x[n]&lt;/code&gt; is convolved (Circular convolution) with the discrete impulse response &lt;code&gt;y[n]&lt;/code&gt; to produce the output signal &lt;code&gt;z[n]&lt;/code&gt;.   (&lt;code&gt;x[n]*y[n]=z[n]&lt;/code&gt;)&#xA;Having the signals &lt;code&gt;z[n]&lt;/code&gt;,&lt;code&gt;y[n]&lt;/code&gt;+their DFT's, and using the property mentioned above,&#xA;can I conclude that &lt;code&gt;X[k]=Z[k]/Y[k]&lt;/code&gt; immediately? are there any limitations? or am I doing it totally wrong?&lt;/p&gt;&#xA;" OwnerUserId="4867" LastEditorUserId="76" LastEditDate="2013-06-21T12:44:11.477" LastActivityDate="2013-06-21T12:44:11.477" Title="Using DFT Circular convolution property" Tags="|fft|convolution|dft|deconvolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9667" PostTypeId="1" AcceptedAnswerId="13649" CreationDate="2013-06-21T00:02:43.310" Score="5" ViewCount="359" Body="&lt;p&gt;I'd like to build a color difference metric that will be invariant to small changes in lighting conditions. In other words, I should be able to tell that a red shirt is not the same as a blue shirt, even if one image is lit differently (brighter / darker, outdoors / incandescent). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving to YUV space and ignoring the luminance component I can deal with changing brightness conditions by considering the metric:&#xA;$$d = \sqrt{\Delta U^2  + \Delta V^2}$$&#xA;But this metric still gives large &quot;distances&quot; when different light sources are used, due to the change in chrominance along the Planckian locus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a color difference metric that is invariant to temperature differences? in a sense, I'm looking for a color space in which one of the three axes is temperature. Does such a space exist? &lt;/p&gt;&#xA;" OwnerUserId="3803" LastActivityDate="2014-01-08T09:37:28.387" Title="Temperature invariant color space" Tags="|image-processing|color|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9668" PostTypeId="2" ParentId="9647" CreationDate="2013-06-21T00:30:16.030" Score="2" Body="&lt;p&gt;If the noise levels added to each pixel are independent, perhaps blurring the images first and then applying a pairwise cross-correlation could do the job.&lt;/p&gt;&#xA;" OwnerUserId="3803" LastActivityDate="2013-06-21T00:30:16.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9669" PostTypeId="2" ParentId="9666" CreationDate="2013-06-21T01:55:42.063" Score="3" Body="&lt;p&gt;Yes, that conclusion would be valid. However, as you suspected, there are some limitations. Consider the case where the system's frequency response $Y[k]$ contains one or more zeros. In that case, corresponding frequency bin in your estimate of the input signal $X[k]$ would diverge to infinity (because of the division by zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're really trying to perform by doing this sort of calculation is &lt;a href=&quot;http://en.wikipedia.org/wiki/Deconvolution&quot; rel=&quot;nofollow&quot;&gt;deconvolution&lt;/a&gt;, which is a complex topic in itself, but suffice it to say that deconvolution is often difficult; you illustrated one of the reasons why. This naive approach of just dividing in the frequency domain is known as a &lt;em&gt;zero-forcing&lt;/em&gt; type of algorithm.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-06-21T01:55:42.063" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9670" PostTypeId="1" AcceptedAnswerId="9674" CreationDate="2013-06-21T07:18:36.127" Score="2" ViewCount="2962" Body="&lt;p&gt;Hello i am working in digital image restoration field, recently i have studied concept of convolution, i studied that to find the &lt;strong&gt;impulse response/point-spread function&lt;/strong&gt; of an LTI system, an unit impulse function is passed from the system and its output is considered as impulse response, My question is that, &lt;strong&gt;Why an unit impulse function is used to find the impulse response of any LTI system&lt;/strong&gt;, what is the mathematical and practical reason behind it.&lt;/p&gt;&#xA;" OwnerUserId="4444" LastEditorUserId="4298" LastEditDate="2018-07-16T19:08:27.950" LastActivityDate="2018-07-16T19:08:27.950" Title="Why unit impulse function is used to find impulse response of an LTI system?" Tags="|image-processing|convolution|linear-systems|impulse-response|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9671" PostTypeId="1" AcceptedAnswerId="9774" CreationDate="2013-06-21T07:39:45.653" Score="4" ViewCount="9283" Body="&lt;p&gt;The task that I have is to remove the annual and semiannual oscillation from a set of temperature measurements, taken over several years, by means of least squares method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the method described &lt;a href=&quot;http://books.google.hr/books?id=gYc4fp_ixmwC&amp;amp;pg=PA392&amp;amp;lpg=PA392&amp;amp;dq=harmonic%20analysis%20least%20squares&amp;amp;source=bl&amp;amp;ots=p88CpB-ISz&amp;amp;sig=66s5t33Kin801SdsV_qvzwFjnFc&amp;amp;hl=hr&amp;amp;sa=X&amp;amp;ei=4vvDUbmDBe314QTe5YDgBg&amp;amp;ved=0CDkQ6AEwAQ#v=onepage&amp;amp;q=harmonic%20analysis%20least%20squares&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and since I have to wait for my colleague to first make some analysis on the data and pass them on to me, I decided to make a test run in Matlab, using a signal with two simple sine and cosine functions and random noise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Creating the data&#xA;&#xA;g=2.5;&#xA;t=linspace(0,g,g*365*24*60);              %n-years of 1min data&#xA;o=rand(size(t));                         %random noise&#xA;p=2*sin(2*pi*t)+1.5*cos(pi*t);           %we create two sinusoids  &#xA;x=p+o;                                     %and add noise to them&#xA;&#xA;&#xA;&#xA;%% The method&#xA;&#xA;N=length(x);            %no of data&#xA;n=(1:N);&#xA;T=g*365*24*60;          %time that the data covers&#xA;f1=1/(365*24*60);       %frequency of 1 yr oscillations&#xA;f2=1/((365*24*60)/2);   %frequency of 1/2 year oscillations&#xA;&#xA;a1=f1*T;                &#xA;a2=f2*T;&#xA;&#xA;A1=(2/N)*sum(x.*cos((2*pi*a1*n)/N));&#xA;A2=(2/N)*sum(x.*cos((2*pi*a2*n)/N));&#xA;B1=(2/N)*sum(x.*sin((2*pi*a1*n)/N));&#xA;B2=(2/N)*sum(x.*sin((2*pi*a2*n)/N));&#xA;&#xA;C1=sqrt(A1^2+B1^2);                     %amplitude &#xA;C2=sqrt(A2^2+B2^2);&#xA;&#xA;fi1=atan(B1/A1);                        %phase shift&#xA;fi2=atan(B2/A2);&#xA;&#xA;v=(C1*cos(2*pi*t-fi1))+(C2*cos(2*pi*t-fi2)); %the reconstructed set of data&#xA;                                             for these two frequencies&#xA;&#xA;r=x-v;    %I wasn't sure what was meant by removing, so i just subtracted&#xA;&#xA;%% Visualization&#xA;&#xA;figure                                  %now lets plot the data&#xA;plot(t,x)&#xA;xlabel('t[min]')&#xA;ylabel('Arb. units :)')&#xA;title('Data')&#xA;&#xA;figure                           %and, original signal and noise separately&#xA;plot(t,p,'b')&#xA;hold on&#xA;plot(t,o,'-r')&#xA;xlabel('t[min]')&#xA;ylabel('Arb. units :)')&#xA;title('Data separated')&#xA;&#xA;&#xA;figure                    %and once again data (blue), reconstructed signal &#xA;plot(t,x,'b-')            %(green), and the final result afer subtraction&#xA;hold on                   %(red)&#xA;plot(t,v,'g--')&#xA;plot(t,r,'r:')&#xA;xlabel('t[min]')&#xA;ylabel('w/e')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem now is, that the reconstructed signal (v) does not resemble the original signal so much. Even when I remove the noise and work only with the pure sinusoid signal, what I get is not really a good representation of it.&#xA;So, what I'm most interested is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this at all the correct use of this method? Am I using the correct equations?&lt;/li&gt;&#xA;&lt;li&gt;Is there an error somewhere in the code? By error I mostly consider the wrong definition, or calculation of some of the variables.&lt;/li&gt;&#xA;&lt;li&gt;In this &quot;ideal case&quot; (sinusoid without noise) should the method be able to reproduce the original curve (almost) exactly?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I hope I've laid out my problem clearly and understandably, if anyone has additional questions, please ask. &#xA;I know this is rather basic stuff, but my knowledge and experience in this area is very limited (up to non-exsistant), so please bear with me.&#xA;Thank you in advance for any help.&lt;/p&gt;&#xA;" OwnerUserId="4687" LastEditorUserId="128" LastEditDate="2019-06-26T08:46:23.363" LastActivityDate="2019-06-26T08:46:23.363" Title="How to Remove the Periodic Oscillations from a Signal" Tags="|matlab|fft|signal-analysis|fourier-series|least-squares|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9672" PostTypeId="2" ParentId="9664" CreationDate="2013-06-21T08:01:44.867" Score="3" Body="&lt;p&gt;You just need to know how to compute magnitude and phase of a complex number $z=z_R+iz_I$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|z|=\sqrt{z_R^2+z_I^2}\\&#xA;\arg\{z\}=\left\{\begin{array}{ll}0,&amp;amp;z_R=z_I=0\\&#xA;\pi/2&amp;amp;z_R=0,\; z_I&amp;gt;0\\&#xA;-\pi/2&amp;amp;z_R=0,\; z_I&amp;lt;0\\&#xA;\arctan\left(\frac{z_I}{z_R}\right),&amp;amp;z_R&amp;gt;0\\&#xA;\arctan\left(\frac{z_I}{z_R}\right)+\pi,&amp;amp;z_R&amp;lt;0,\;z_I\ge0\\&#xA;\arctan\left(\frac{z_I}{z_R}\right)-\pi,&amp;amp;z_R&amp;lt;0,\;z_I&amp;lt;0\\&#xA;\end{array}\right.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily, the computation of the phase $\arg\{z\}$ is simplified by the existence of the function &lt;a href=&quot;http://en.wikipedia.org/wiki/Atan2&quot; rel=&quot;nofollow&quot;&gt;atan2&lt;/a&gt; in most programming languages. Watch out, you need to use it like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{phase = }\text{atan2}(z_I,z_R)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-21T13:27:36.110" LastActivityDate="2013-06-21T13:27:36.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9673" PostTypeId="1" CreationDate="2013-06-21T08:57:28.207" Score="1" ViewCount="7591" Body="&lt;p&gt;I would like to use a .WAV file and convert it into a spectogram. Any idea how to do this with Naudio? Basically the flow should be like this, I think:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Convert WAV file to PCM stream&lt;/li&gt;&#xA;&lt;li&gt;Convert PCM stream to double-array and applying FFT&lt;/li&gt;&#xA;&lt;li&gt;Using the result from (2) and convert it to a spectrogram&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4873" LastEditorUserId="76" LastEditDate="2013-06-23T12:50:34.813" LastActivityDate="2013-06-23T12:50:34.813" Title="Applying FFT to PCM stream" Tags="|fft|spectrogram|c#|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9674" PostTypeId="2" ParentId="9670" CreationDate="2013-06-21T12:39:38.507" Score="2" Body="&lt;p&gt;I'm not really sure what you're asking. A unit impulse is used as the input to find a system's impulse response because, by definition, an LTI system's impulse response is equal to its output for a unit impulse input. If you used any other input, then the output wouldn't be an impulse response. &lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-06-21T12:39:38.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9675" PostTypeId="2" ParentId="9670" CreationDate="2013-06-21T12:43:25.287" Score="2" Body="&lt;p&gt;The reason an impulse response is used (as a theoretical construct) is because &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform#Table_of_discrete-time_Fourier_transforms&quot; rel=&quot;nofollow&quot;&gt;the Fourier transform of the impulse $\delta[n]$ is a constant.&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because convolution in the time domain is simply multiplication in the frequency domain, that means that the frequency response of the output (to an impulse as input) will just be the &lt;em&gt;system's&lt;/em&gt; frequency response.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-06-21T12:51:21.117" LastActivityDate="2013-06-21T12:51:21.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9676" PostTypeId="2" ParentId="9670" CreationDate="2013-06-21T13:15:58.707" Score="7" Body="&lt;p&gt;It is important to realize that due to the LTI property the response to an impulse $\delta(n)$ describes the system completely, because any input signal can be written as a weighted sum of shifted impulses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=\sum_kx(k)\delta(n-k)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\mathcal{T}\{\cdot\}$ denote the system operator, so the response to a shifted impulse is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{T}\{\delta(n-k)\}=h(n-k)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) and (2), due the linearity and the time- (shift-)invariance of the system, the response to any input signal $x(n)$ can be written as a weighted sum of responses to shifted impulses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\mathcal{T}\{x(n)\}=\sum_kx(k)\mathcal{T}\{\delta(n-k)\}=&#xA;\sum_kx(k)h(n-k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This last equality is the convolution sum describing the input-output relation of a discrete LTI system.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-21T20:25:12.890" LastActivityDate="2013-06-21T20:25:12.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9677" PostTypeId="2" ParentId="6456" CreationDate="2013-06-21T13:17:41.610" Score="0" Body="&lt;p&gt;Brian, I came across your post on the Valvers site when I was trying to learn about designing filters in Octave, so thanks for putting that up. The comment submission part of the page is broken though; thats not on purpose is it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, the second filter (Hilmar's), is also what you get if you use Octave's Butterworth design routine (in package 'signal') to make a first order low pass with the values you had in for Fc and Fs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave-3.6.4:1467&amp;gt; [bb2 ba2] = butter(1,1000/4000)&#xA;bb2 =&#xA;   0.29289   0.29289&#xA;ba2 =&#xA;   1.00000  -0.41421&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've spent some time recently figuring out how to make different kind of digital filters in Octave, for implementation on an LPC cortex M3 microcontroller. I posted some notes here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://tooling-up.blogspot.com/2013/06/signal-acquisition-filtering-on-simple.html&quot; rel=&quot;nofollow&quot;&gt;http://tooling-up.blogspot.com/2013/06/signal-acquisition-filtering-on-simple.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4878" LastActivityDate="2013-06-21T13:17:41.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9678" PostTypeId="1" AcceptedAnswerId="9692" CreationDate="2013-06-21T13:32:48.557" Score="-1" ViewCount="897" Body="&lt;p&gt;Given a discrete signal $ \left\{ x[n] \right\}_{n=0}^{N-1} $ and its Discrete Fourier Transform $ X[k] = DFT \left\{ x[n] \right\}[k] $.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to effectively compute the norm &lt;strong&gt;of each sample&lt;/strong&gt; of the DFT, namely  $ \left | X[k] \right | ^ {2} ,  k \in \left\{ 0, N-1 \right\}$ as opposed to the norm of the DFT series (Which equals the norm of the original series).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could that be calculated without using complex multiplications (Since it's real)?&lt;br&gt;&#xA;Namely, I'd like to not have to go through the calculation of the DFT and then calculate the norm of each sample.&lt;br&gt;&#xA;What if $ x[n] $ is also a symmetric signal (Auto correlation for that matter), I assume then using the Cosine part makes it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-01-12T07:20:17.130" LastActivityDate="2022-01-12T07:20:17.130" Title="Calculating the Norm of Each Sample of the DFT Transform" Tags="|discrete-signals|fourier-transform|dft|norm|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9679" PostTypeId="2" ParentId="9673" CreationDate="2013-06-21T13:42:34.793" Score="2" Body="&lt;p&gt;Your description of how to create a spectrogram is correct. Here's an explanation with a little more detail:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, create a WaveChannel32, using a WaveFileReader. This will output a PCM byte stream. Then read 4 times the size of your FFT bytes from the WaveChannel32 into a buffer. Convert every four bits in the buffer into an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important at this point to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window function&lt;/a&gt; on our interval, to emphasise amplitudes closer to the current time stamp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd then suggest using &lt;a href=&quot;http://www.exocortex.org/dsp/&quot; rel=&quot;nofollow&quot;&gt;the Exocortex FFT library&lt;/a&gt; to calculate the FFT. The Fourier.FFT method will convert an array of complex numbers to its corresponding Fourier transform. Then ignore the second half of the array produced, to prevent aliasing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first half of the array corresponds to the column of the spectrogram at our current time stamp. Each number in the array corresponds to a single pixel in the spectrogram, the frequency of which is determined by the index of the array (equally spaced throughout 0 to 22050Hz). The darkness of each pixel is determined by the magnitude squared of the complex number corresponding to said pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some sample code for producing one column:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var waveChannel = new NAudio.Wave.WaveChannel32(new NAudio.Wave.WaveFileReader(&quot;file path&quot;));&#xA;&#xA;var buffer = new byte[4096*4];&#xA;&#xA;waveChannel.Read(buffer, 0, 4096*4);&#xA;&#xA;var samples = new ComplexF[4096];&#xA;&#xA;for (var i = 0; i &amp;lt; 4096, i++)&#xA;{&#xA;    samples[i].Re = BitConverter.ToSingle(buffer,i*4);&#xA;&#xA;    // Window should be pre-populated with values from your window function&#xA;    samples[i].Re *= Window[i];&#xA;}&#xA;&#xA;Fourier.FFT(samples, FourierDirection.Forward);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4877" LastActivityDate="2013-06-21T13:42:34.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9680" PostTypeId="2" ParentId="9647" CreationDate="2013-06-21T13:49:41.537" Score="2" Body="&lt;p&gt;first of all as I understand there are two separate problems&#xA;1. Piece together Lena's beautiful face in some kind of panorama&#xA;2. Denoise the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 1 - the problem you described could be easily solved using cross correlation. For example please see&#xA;&lt;a href=&quot;http://www.mathworks.com/help/images/examples/registering-an-image-using-normalized-cross-correlation.html&quot; rel=&quot;nofollow&quot;&gt;Matlab image registration example&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 2- I would use any of several denoising algorithms.&#xA;You could look at &#xA;blind deconvolution and also at wavelet denoising ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps,&#xA;May your Lean be as beautiful as the real one ,&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2013-06-21T13:49:41.537" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9681" PostTypeId="2" ParentId="9654" CreationDate="2013-06-21T14:27:43.933" Score="2" Body="&lt;p&gt;Every time you generate discrete noise samples (Using MATLAB's &lt;code&gt;randn&lt;/code&gt; / &lt;code&gt;rand&lt;/code&gt; for instance) you actually generate a band limited noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to do is the adjustment of the variance of the discrete samples to the variance of the &quot;Continuous&quot; noise those samples are allegedly taken from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a continuous White Noise (Wide Sense) with variance &lt;span class=&quot;math-container&quot;&gt;$ \sigma^{2}_{cn} \delta (t) $&lt;/span&gt; and you want sample it at rate of &lt;span class=&quot;math-container&quot;&gt;$ f_{s} $&lt;/span&gt; you should generate discrete noise samples with variance of &lt;span class=&quot;math-container&quot;&gt;$ f_{s}  \sigma^{2}_{cn} $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This result is valid assuming before sampling the continuous noise you applied an ideal LPF filter with bandwidth of &lt;span class=&quot;math-container&quot;&gt;$ f_{s} / 2 $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full description is given here - &lt;a href=&quot;https://dsp.stackexchange.com/questions/17494&quot;&gt;How to Simulate AWGN (Additive White Gaussian Noise) in Communication Systems for Specific Bandwidth&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-10-27T11:10:50.890" LastActivityDate="2019-10-27T11:10:50.890" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9682" PostTypeId="2" ParentId="9665" CreationDate="2013-06-21T14:37:05.623" Score="3" Body="&lt;p&gt;You may download the &lt;a href=&quot;https://www-user.tu-chemnitz.de/%7Epotts/nfft/&quot; rel=&quot;nofollow noreferrer&quot;&gt;NFFT Library - Non Equispaced Fast Fourier Transform&lt;/a&gt;.&lt;br /&gt;&#xA;It has interfaces for MATLAB, Octave and Julia.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="54457" LastEditDate="2021-02-12T19:08:33.313" LastActivityDate="2021-02-12T19:08:33.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9683" PostTypeId="2" ParentId="9665" CreationDate="2013-06-21T17:42:51.047" Score="1" Body="&lt;p&gt;After more testing I think I found a problem with the way the algorithm is formulated. According to Eq. (60)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{k=0}^N\alpha_k \sum_{j=-q/2}^{q/2}P_{jk}\, e^{i(\mu_k+j)x/m}=\sum_{j=-mN/2}^{mN/2-1}\tau_j\, e^{ijx/m}&#xA;$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to compute the r.h.s. using an inverse FFT. The problem with this is is that some terms of the sum on the l.h.s. are left out: I have verified that when these terms are included by explicitly computing the sum (no FFT involved), the relative approximation error goes down to 1e-3. So the question is: how does one compute the l.h.s. sum using an $m N$ points inverse DFT with kernel $e^{2\pi i k j/(m N)}$ (Eq. (62)) ?&lt;/p&gt;&#xA;" OwnerUserId="1696" LastEditorUserId="80" LastEditDate="2013-06-21T18:58:41.860" LastActivityDate="2013-06-21T18:58:41.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9692" PostTypeId="2" ParentId="9678" CreationDate="2013-06-22T12:24:53.400" Score="2" Body="&lt;p&gt;The simple answer: yes this can be done in various different ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the $a_{k}$ and $b_{k}$ coefficients of the regular&#xA;Fourier Series (&lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Fourier_series&lt;/a&gt;) and then $a_{k}^{2}+b_{k}^{2}$ is the norm at frequency k. This is equivalent of splitting the original DFT equation into it's real and imaginary parts&lt;/li&gt;&#xA;&lt;li&gt;Calculate the auto-correlation of $c_{xx}[n]$ of $x[n]$. Then calculate only the cosine coefficients $a_{k}$ of the Fourier Series of $c_{xx}[n]$. $a_{k}$ is the norm at frequency k.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, each of this methods is computationally much less efficient than simply doing the DFT and then taking the magnitude squared. Using the DFT (with complex math) is by far the most efficient way of doing this. If you worried about computationally efficiency, you can shave about 1/3 to 1/2 of the computation time by using the fact that your input signal is real. The DFT of a real function can be calculated by using DFT of a complex signal of half the length. That requires a bit if extra math, which I'll skip here.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-22T12:24:53.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9693" PostTypeId="1" CreationDate="2013-06-22T13:04:36.350" Score="1" ViewCount="218" Body="&lt;p&gt;I am using HTK to recognize which word has been said. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on 20 words and I have for each of them 10 .wav files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the steps that i followed:&#xA;1) get the MFC file for each .wav file for each word&#xA;2) for each word train it on the 10 MFCs files&#xA;3) add the grammar and dictionary and hmmlist in the HTK&#xA;4) test&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the test, i use the mfc of the training data, but  i get an error of 3.5% &#xA;when i use a new mfc (not in the training data) it never recognized it right :S &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas of what to do ?&lt;/p&gt;&#xA;" OwnerUserId="4793" LastActivityDate="2013-06-22T13:04:36.350" Title="HTK word Recognition" Tags="|hmm|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9694" PostTypeId="1" AcceptedAnswerId="9695" CreationDate="2013-06-22T14:46:52.530" Score="0" ViewCount="12315" Body="&lt;p&gt;I'm trying to come up with a formula for the average energy of the signals in a M-QAM constellation.&#xA;If $b$ is the number of bits represented by each point in the constellation, such that $M=2^b$. For $b$ even, I know the formula is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \bar{E} =  \frac{(M-1)d^2}{6} $$&#xA;where $d$ is the distance between two points in the constellation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be easily verified using the average of all QAM constellation points generated by MATLAB, whose default value for $d$ is $2$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b=4;&#xA;M=2^b;&#xA;sum(abs(qammod([0:M-1],M,0,'gray')).^2)/M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a formula for the average energy in a QAM constellation with $b$ odd?&lt;/p&gt;&#xA;" OwnerUserId="4590" LastActivityDate="2019-10-02T17:26:19.177" Title="Is there a closed form for the average energy of a QAM constellation?" Tags="|digital-communications|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9695" PostTypeId="2" ParentId="9694" CreationDate="2013-06-22T15:33:38.317" Score="2" Body="&lt;p&gt;From $\bar{E}=\frac{(M-1)d^2}{6}$ as the average energy in $M$-QAM, $M$ a perfect square and a square constellation, we have that the &lt;em&gt;total&lt;/em&gt; energy is&#xA;$$E_{\operatorname{tot}} = M\frac{(M-1)d^2}{6}$$&#xA;Now, since the $M$-QAM signal is the sum of two orthogonal $\sqrt{M}$-PAM&#xA;signals of equal energy, then, writing $N$ instead of $\sqrt{M}$,&#xA;we have each of the orthogonal signals carrying a total energy of &#xA;$$\displaystyle \frac{1}{2}\frac{M(M-1)d^2}{6}&#xA;= \frac{N^2(N^2-1)d^2}{12}.$$&#xA;Since there are $M = N^2$ constellation points, the average energy of&#xA;a $N$-PAM signal with spacing $d$ is&#xA;$\displaystyle \frac{(N^2-1)d^2}{12}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if $b$ is odd, a $2^b$-QAM signal constellation is&#xA;a rectangular grid with $2^{(b-1)/2}$ points in one direction and&#xA;$2^{(b+1)/2}$ points in the other.  Thus, the $2^b$ points contribute an&#xA;average of&#xA;$$\frac{(2^{b-1}-1)d^2}{12} +  \frac{(2^{b+1}-1)d^2}{12}&#xA;= \frac{(2.5M-2)d^2}{12}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that it is possible to use constellations other than rectangular when&#xA;$b$ is odd. For example, the $32$-CROSS constellation is a (rotated) version&#xA;of a $36$-AM square constellation with the corner points deleted. Rotation&#xA;does not change the energy and so we can get the answer for $32$-CROSS by&#xA;finding the total energy for a $36$-QAM square constellation, subtracting&#xA;off the energy of the $4$ corner points, and dividing what is left by $32$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-06-23T22:32:22.917" LastActivityDate="2013-06-23T22:32:22.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9697" PostTypeId="1" AcceptedAnswerId="9699" CreationDate="2013-06-22T20:17:36.923" Score="0" ViewCount="71" Body="&lt;p&gt;I would like to build a computer vision application capable of doing robust pedestrian tracking in potentially crowded environments from a single video source. To this end I would like to find resources in order to learn as much about the current state of the art as possible. This could be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;recent survey papers&lt;/li&gt;&#xA;&lt;li&gt;papers outlining novel approaches that have been demonstrated with success&lt;/li&gt;&#xA;&lt;li&gt;open-source applications or algorithms&lt;/li&gt;&#xA;&lt;li&gt;online courses or even course materials such as slide decks comparing different approaches&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there anything along these lines that you could point me to? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="3576" LastActivityDate="2013-06-23T14:25:52.233" Title="resources for learning more about pedestrian tracking" Tags="|computer-vision|visual-tracking|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9699" PostTypeId="2" ParentId="9697" CreationDate="2013-06-22T20:51:38.480" Score="1" Body="&lt;p&gt;What I have so far:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A Survey of Human-Sensing: Methods for Detecting Presence, Count, Location, Track, and Identity; Teixeira, Dublon and Savvides&lt;/li&gt;&#xA;&lt;li&gt;I just found the question &lt;a href=&quot;https://stackoverflow.com/questions/16673698/people-detection-and-tracking&quot;&gt;People Detection and Tracking&lt;/a&gt; on SO which also has some good leads.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3576" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-06-23T14:25:52.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9700" PostTypeId="2" ParentId="9694" CreationDate="2013-06-22T22:57:39.017" Score="0" Body="&lt;p&gt;I found an answer for odd constellation at J. Cioffi's DSP class handouts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For odd constellations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \bar{E} = \left( \frac{31}{32}M - 1 \right)\frac{d^2}{6} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See Equation 1.259 at &lt;a href=&quot;http://www.stanford.edu/group/cioffi/book/chap1.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.stanford.edu/group/cioffi/book/chap1.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4590" LastActivityDate="2013-06-22T22:57:39.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9701" PostTypeId="1" CreationDate="2013-06-23T21:48:56.470" Score="1" ViewCount="232" Body="&lt;p&gt;First of all, I'm new to DSP so excuse my simplified words.&#xA;I'm testing the performance of a digital filter on a (partly) noncontinuous signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X5ECG.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the signal is not continuous at some points (like it is stopping and starting over again) When I apply the digital filter to it, I get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4C7mj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4C7mj.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter shows ripples at the noncontinuous areas, then it starts to work again. Why does the filter show this ripple at the noncontinuous areas? How do I calculate it (to know the overshoot, etc.)?&lt;/p&gt;&#xA;" OwnerUserId="4894" LastEditorUserId="4655" LastEditDate="2013-06-23T23:54:39.300" LastActivityDate="2013-06-24T11:09:15.697" Title="Digital filter performance with noncontinuous signal?" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9702" PostTypeId="1" AcceptedAnswerId="9703" CreationDate="2013-06-24T05:50:19.193" Score="1" ViewCount="1743" Body="&lt;p&gt;What is the purpose of DFT &amp;amp; IDFT blocks which are placed after the Analysis filter bank &amp;amp; before the Synthesis filter bank.&#xA;The reason i am asking this question is because I tried to design Polyphase DFT filter bank &amp;amp; got the same output with &amp;amp; without DFT-IDFT block.&lt;/p&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2015-07-09T13:32:53.353" Title="DFT Polyphase Filter bank" Tags="|filter-design|dft|filter-bank|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9703" PostTypeId="2" ParentId="9702" CreationDate="2013-06-24T08:24:25.993" Score="1" Body="&lt;p&gt;I guess you are referring to an implementation like the one shown &lt;a href=&quot;http://cnx.org/content/m10424/latest/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. If you leave out the DFT/IDFT blocks, then you don't have the modulation step which is necessary for actually implementing a filter bank, and you will not be able to do appropriate sub-band processing between the analysis and synthesis stages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you test your analysis and synthesis stages without sub-band processing in between you will obviously get the same result if you leave out the DFT/IDFT blocks. Analysis and synthesis together are then a pure delay and you might as well replace everything by a pure delay, but this defeats the purpose of the filter bank which is to split the input signal into sub-bands for further processing, and then to reconstruct the original signal from these separate sub-bands.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-24T12:50:56.327" LastActivityDate="2013-06-24T12:50:56.327" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9704" PostTypeId="2" ParentId="9701" CreationDate="2013-06-24T11:09:15.697" Score="1" Body="&lt;p&gt;It is not surprising that the filter output resembles the filter's step response at discontinuities of the input signal. It's like applying a (modulated) step at the input. Apparently the cut-off frequency of the high-pass filter is higher than the frequency of the sinusoid, so the output goes to zero after each discontinuity. However, at each point of a discontinuity, the input signal contains frequencies above the cut-off frequency of the high-pass filter and these frequencies are passed to the output.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-24T11:09:15.697" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9705" PostTypeId="1" CreationDate="2013-06-24T13:57:17.993" Score="2" ViewCount="577" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CXJJe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above image I have created a time series (in cyan) that is a simple addition of a major cycle (in green), a minor cycle (in cyan) and a linear trend (not shown separately). What I would like to do is filter this time series to remove the minor cycle so what is left would be the trend plus major cycle (in red). In practice no information would be available about the minor cycle, although the period of the major cycle would be known from applying code for the Hilbert transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way in which I might do this is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;apply a bandpass filter set to the major cycle period, on the original data &lt;/li&gt;&#xA;&lt;li&gt;subtract this bandpass from the original series &lt;/li&gt;&#xA;&lt;li&gt;apply the Hilbert transform to the remainder to get period of minor cycle&lt;/li&gt;&#xA;&lt;li&gt;apply another bandpass filter set to this minor cycle period, on the original data&lt;/li&gt;&#xA;&lt;li&gt;subtract this second, minor cycle bandpass from the original data&lt;/li&gt;&#xA;&lt;li&gt;and hopefully end up with the desired red output&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;First off, would this be a valid approach, and secondly is there another way in which I could filter out the minor trend?&lt;/p&gt;&#xA;" OwnerUserId="260" LastActivityDate="2013-06-30T19:55:32.850" Title="Remove minor cycle from time series" Tags="|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9706" PostTypeId="2" ParentId="9705" CreationDate="2013-06-24T14:22:19.797" Score="2" Body="&lt;p&gt;Your approach seems awfully complicated. It looks like the frequencies of the &quot;minor cycle&quot; are much higher than the &quot;major cycle&quot; and the ramp so a simple lowpass filter should do the trick. If you don't know the frequencies, a simple FFT analysis can be done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtracting filtered versions of signal is tricky since you need to carefully watch time alignment and phase distortion in the filter. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-24T14:22:19.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9707" PostTypeId="1" CreationDate="2013-06-24T15:12:39.360" Score="4" ViewCount="2516" Body="&lt;p&gt;So I have the following data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[-344    13771   4600 ]&#xA; [-275.2  12478   6410 ]&#xA; [-206.4  19443    830 ]&#xA; [-137.6  69392   3830 ]&#xA; [ -68.8  143737  3780 ]&#xA; [   0    189278 16870 ]&#xA; [  68.8  184486  5090 ]&#xA; [ 137.6  188466  9380 ]&#xA; [ 206.4  185023 21680 ]&#xA; [ 275.2  128133  1460 ]&#xA; [ 344    51288   1950 ]&#xA; [ 412.8  10854   4290 ]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First column is the x value (position in microns).  Second value is the recorded data point (y), and the third column is the error (noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering how I can find the response of my device if the data I record is known to be a convolution of the response and a slit of width 83.6666 (plus noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt was to use the convolution theorem of fourier transforms and use MatLab's &lt;code&gt;fft()&lt;/code&gt; to solve for the desired function, but I could not figure out how to get everything the same length.  I also thought about being blunt and using &lt;code&gt;deconv()&lt;/code&gt; but that gave me something very strange, (with my rect function defined as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; x=-344:1:412;&#xA;&amp;gt;&amp;gt; h=zeros(size(x));&#xA;&amp;gt;&amp;gt; h(300:386)=1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I used &lt;code&gt;deconv(h,y)&lt;/code&gt; and got a very strange looking plot that was not a function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I was hoping someone could give me some advice on how to perform this mathematically (code or no code).  Especially with the addition of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="128" LastEditDate="2019-11-28T06:42:35.850" LastActivityDate="2019-11-28T06:42:35.850" Title="Performing a Deconvolution" Tags="|matlab|signal-analysis|deconvolution|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="9709" PostTypeId="1" CreationDate="2013-06-24T18:23:01.737" Score="2" ViewCount="7663" Body="&lt;p&gt;I have an x-axis which is in logarithmic scale representing frequency, I would like to have NumPoints on this axis that are equidistant on the log scale, I have the following variables:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fmin = 100&#xA;Fmax = 4000 or 8000&#xA;NumPoints = 10&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What formula should i use to calculate where the NumPoints-2 points between Fmin and Fmax should go? (Fmin and Fmax should each have a point on them)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, when i switch from Fmax = 4000 -&gt; 8000 i would like to keep the equidistant points already calculated between Fmin-&gt;4000 and add extra points between 4000 and 8000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generate NumPoints between FMan -&gt; Fmax(4000), equidistant on a log scale.&#xA;Change Fmax -&gt; 8000&#xA;Generate more points between 4000-&gt;8000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Andy&lt;/p&gt;&#xA;" OwnerUserId="4786" LastActivityDate="2021-04-30T14:06:10.267" Title="Equidistant log scale points" Tags="|frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9710" PostTypeId="2" ParentId="9709" CreationDate="2013-06-24T19:19:24.870" Score="3" Body="&lt;p&gt;Since it's a log scale the ratio between two adjacent points is constant, i.e. you get the next point by multiplication: x[n] = x[n-1]*k. After ten multiplications you need to get from 100 to 4000 so k can be determined as $k = (4000/100)^{1/(n-1)} = 1.5066$. Your x points are then simply $x[n]= 100*k^{n}$ or&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;      100&#xA;   150.66&#xA;   226.99&#xA;      342&#xA;   515.26&#xA;   776.31&#xA;   1169.6&#xA;   1762.2&#xA;   2654.9&#xA;     4000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can't get exactly to 8000 though. The next points would be 6026.5 and 9079.7. What would get you very close would be 17 points from 99.213 to 4000, the next points being 5039.7 6349.6 and 8000.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-06-24T19:19:24.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9711" PostTypeId="2" ParentId="9709" CreationDate="2013-06-24T19:20:09.633" Score="4" Body="&lt;p&gt;Take the log of your extremities, find your points as if it were on a linear scale beween these extremities, take the exponential of the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log of your extremities are $\log 100$ and $\log 4000$. Your 10 points on a linear scale between these values would be: $\log 100 + k \frac{\log 4000 - \log 100}{9}$, $k \in \{0, 1, \ldots, 9\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the exponential: $e^{\log 100 + k \frac{\log 4000 - \log 100}{9}}$. Notice that the first and last values are 100 and 4000 as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works well with &lt;code&gt;linspace&lt;/code&gt; in programming languages which have this primitive, for example with python/numpy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;numpy.exp(numpy.linspace(numpy.log(100), numpy.log(4000), 10))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second part of your question is not clear. To generate more points by preserving the same spacing, continue increasing $k$ above 9.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-24T19:20:09.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9712" PostTypeId="2" ParentId="9678" CreationDate="2013-06-25T00:50:13.363" Score="2" Body="&lt;p&gt;Norm of a single number is just its absolute value. In your case, the norm of $X[k]$ is obtained with the usual complex distance formula:&#xA; $$|X[k]| = \sqrt{\text{Re}(X[k])\times\text{Re}(X[k]) + \text{Im}(X[k]) \times \text{Im}(X[k])}$$.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-06-25T00:50:13.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9714" PostTypeId="1" CreationDate="2013-06-25T04:20:08.117" Score="2" ViewCount="90" Body="&lt;p&gt;Let $x$ be a $N \times 1$ vector in $\mathbb{R}^{N}$ where $M$ components are zero and the remaining $N-M$ components are standard normal random variables.   $x$ may not be sparse e.g. $M$ may be small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in bounding $||Ax||_{l_{2}}$ where $A$ is a $K \times N$ matrix $(K&amp;lt;N)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This made me think to look for a restricted isometry like property.   So my question is are there a class of $K \times N$ matrices $(K&amp;lt;N)$ such that  $(1-\delta) ||x||_{l_{2}} \le ||Ax||_{l_{2}} \le (1+\delta) ||x||_{l_{2}}$ with probability $\ge p$  for some prescribed $\delta&amp;gt;0$ and $0&amp;lt;p&amp;lt;1$ ?&lt;/p&gt;&#xA;" OwnerUserId="4901" LastActivityDate="2014-01-05T04:53:31.570" Title="Restricted Isometry (non-sparse)" Tags="|compressive-sensing|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9715" PostTypeId="2" ParentId="9365" CreationDate="2013-06-25T05:41:08.930" Score="0" Body="&lt;p&gt;One of the simplest methods to build a low pass filter is using fir2 function in matlab. Here is the code which i use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=70MHz % Sampling freq = 70 MHz&#xA;fc=fs/(10);   % pass band corner frequency&#xA;fc=fs/(10);   % pass band corner frequency&#xA;fc1=fs/(8);   %stop band corner frequency&#xA;%change the scaling factor according to ur cutoff frequency&#xA;lpfLength=127; % Order/Number of Filter coefficients&#xA;&#xA;% Low Pass Filterlpf=fir2(lpfLength,[0 fc fc1 fs/2]/(fs/2),[1 1 0 0]); &#xA;&#xA;FFThn=fft(lpf,NFFT);    % FFT of filter h(n) i.e H(w). NFFT can be any value like 2048&#xA;&#xA;magfhn=20*log10(abs(FFThn)).';    % Magnitude in dB&#xA;magfhn=circshift(magfhn,NFFT/2).';  %circshift is used if u want to plot it from -fs/2 to fs/2&#xA;&#xA;figure;&#xA;plot((-NFFT/2:NFFT/2-1)*fs/NFFT,magfhn); %Freq. plot of LPF, If u want to plot from 0 - fs than use 0:NFFT&#xA;xlabel('Frequency (Hz)');&#xA;ylabel('Suppression (dB)');&#xA;title('Low Pass Prototype Filter')&#xA;axis([-fs/2 fs/2 -100 5]); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2013-06-25T05:41:08.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9717" PostTypeId="1" CreationDate="2013-06-25T09:01:28.120" Score="0" ViewCount="1993" Body="&lt;p&gt;I have an FDM signal from 0 to 70 MHz. The total signal contains 4 FDM signals from (0-fs/4), (fs/4-fs/2), (fs/2-3fs/4) &amp;amp; (3fs/4-fs). &#xA;I used fvtool command in matlab to plot these signals.&#xA;Then i downsampled the total signal by 4. Downsampling is time is expansion in freq spectrum.&#xA;Thus on paper my new signal should occupy freq (0-fs), (fs-2fs), (2fs-3fs) &amp;amp; (3fs-4fs)&#xA;When i plot this downsampled signal using fvtool again, i am just able to see my 1st FDM signal ie b/w (0-fs/4) appearing in the plot. &#xA;How to view the entire spectrum from (0-4fs) in fvtool. &lt;/p&gt;&#xA;" OwnerUserId="4875" LastEditorUserId="4875" LastEditDate="2013-06-26T03:25:35.327" LastActivityDate="2013-06-26T03:31:59.740" Title="Decimation of signal. How to plot frequency spectrum" Tags="|matlab|downsampling|decimation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9721" PostTypeId="1" AcceptedAnswerId="10084" CreationDate="2013-06-25T13:47:51.183" Score="0" ViewCount="221" Body="&lt;p&gt;I have a set of signals consisting of impulses at different instant of time i.e. its not a continuous signal. What I want is a mathematically intuitive way to distinguish between any two such signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that the time of occurrence of impulses can be used to differentiate between the impulses. But what I need is like a single number that gives a measure of how different two impulse signals are for instance it could be some property of the signal that would be different for any two signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just an additional info the signals are defined on finite duration. I don't know if that info is needed or redundant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't come from a signal processing background so this question could be wrong. Also if I have tagged it wrongly please modify it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of 2 signals would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 1 1 1]&#xA;[0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 1 1 1 1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4906" LastEditorUserId="29" LastEditDate="2013-06-25T21:07:09.660" LastActivityDate="2013-07-26T20:38:34.057" Title="Is there any way to differentiate between impulses?" Tags="|discrete-signals|signal-analysis|impulse-response|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9722" PostTypeId="2" ParentId="9721" CreationDate="2013-06-25T14:19:48.137" Score="1" Body="&lt;p&gt;If you are looking at vectors $\mathbf x$ and $\mathbf y$&#xA;(presumably of the same length) in which the entries are&#xA;mostly $0$s and&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;with occasional $1$s (unit impulses), a good measure of the difference&#xA;between the vectors is the &lt;em&gt;Hamming distance&lt;/em&gt; between them, that is, the&#xA;number of samples in which $\mathbf x$ and $\mathbf y$ differ&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;with occasional non-zero entries (impulses of different amplitudes),&#xA;then we need to distinguish between impulses of different amplitudes&#xA;but the same location. If we use Hamming distance, then the measure&#xA;of the difference between&#xA;$$\cdots \quad 0\quad 0 \quad 0 \quad 1 \quad 0 \quad 0\quad 0\quad \cdots$$&#xA;$$\cdots \quad 0\quad 0 \quad 0 \quad 2 \quad 0 \quad 0\quad 0\quad \cdots$$&#xA;and&#xA;$$\cdots \quad 0\quad 0 \quad 0 \quad 1 \quad 0 \quad 0\quad 0\quad \cdots$$&#xA;$$\cdots \quad 0\quad 0 \quad 0 \quad 9 \quad 0 \quad 0\quad 0\quad \cdots$$&#xA;is the same which is not quite capturing our intuition that the two pairs&#xA;are more different than the Hamming distance is telling us. Possibilities &#xA;to consider in this case are&#xA;$$\sum_{i=1}^n |x_i - y_i|,\quad   \sum_{i=1}^n |x_i - y_i|^2,\quad &#xA;\mathrm{or}\quad \sqrt{\sum_{i=1}^n |x_i - y_i|^2}.$$&#xA;The last quantity is the Euclidean distance between the vectors. Which&#xA;measure you want to use depends on how much the measure captures the&#xA;features relevant to your application.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-06-25T14:19:48.137" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9723" PostTypeId="1" CreationDate="2013-06-25T14:19:49.433" Score="-1" ViewCount="384" Body="&lt;p&gt;I have several analog signals with constant amplitude in time. What I want is a way to convert these analog signals to an impulse signal i.e. a signal that consists of impulses occurring at different instants of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conversion should be such that it should be possible to differentiate between different analog signals just by looking at the impulse signals that they have been converted into? Also the impulse signals should be of finite duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't come from a signal processing background so my question might not have a lot of info required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if there is any other info that's needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4906" LastActivityDate="2013-06-25T14:41:36.220" Title="How to convert an analog signal to an impulse signal?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9724" PostTypeId="1" AcceptedAnswerId="9740" CreationDate="2013-06-25T14:25:53.757" Score="5" ViewCount="2980" Body="&lt;p&gt;I would like to estimate the peak-to-peak amplitude of a periodic signal whose frequency components are known. This is, I have the frequency spectrum (a peak in the fundamental frequency and other peaks in its harmonics) and I would like to compute the peak-to-peak amplitude. Is that possible without reconstructing the signal in the time domain and then detecting peaks?&lt;/p&gt;&#xA;" OwnerUserId="3607" LastActivityDate="2013-06-26T12:18:57.403" Title="Peak to peak amplitude of sum of sinusoidals (harmonic frequencies)" Tags="|frequency-spectrum|amplitude|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9725" PostTypeId="2" ParentId="9723" CreationDate="2013-06-25T14:41:36.220" Score="0" Body="&lt;p&gt;An approach for converting an analog signal into a bitstream is to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Delta-sigma_modulation&quot; rel=&quot;nofollow&quot;&gt;delta-sigma modulation&lt;/a&gt;. Intuitively, the idea is to build a sequence of binary pulses such that, when it is low-pass filtered, you recover the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not clear what you mean by &quot;differentiate&quot;. There are many conversion processes for which distinct inputs will yield distinct outputs. But I you suspect that you expect something like &quot;similar-looking inputs should yield similar-looking outputs&quot;. The question is what kind of definition of &quot;similar-looking&quot; you have in mind...&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-06-25T14:41:36.220" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9726" PostTypeId="2" ParentId="9717" CreationDate="2013-06-25T15:14:19.997" Score="4" Body="&lt;p&gt;The root of your problem is that you are not familiar with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;Nyquist Sampling Theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, I question your premise that your sample rate is 70 MHz and that you can represent your signals, which range from 0 to 70 MHz, at this rate.  The Nyquist sampling theorem indicates that you can only represent signals up to half the sample rate, which is 35 MHz in your case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you downsample by a factor of four you are reducing your sample rate by a factor of four, which in turn reduces the frequencies that you can represent by a factor of four.  You are thus &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;aliasing&lt;/a&gt; your signals, causing them to all be at the same frequency.  Thus, the one signal that you see after you downsample is really all four signals packed into one slot.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-06-25T15:14:19.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9727" PostTypeId="2" ParentId="9724" CreationDate="2013-06-25T15:23:57.127" Score="-2" Body="&lt;p&gt;Consider the linearity property of the DFT: &lt;img src=&quot;https://i.stack.imgur.com/oYMxW.gif&quot; alt=&quot;linearity&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This indicates that the DFT amplitude scales directly with the time domain amplitude of your signal.  Therefore, you should be able to deduce the time domain amplitude directly from the frequency domain amplitude empirically; find the DFT amplitude of a baseline or unity TD signal, and from that you can easily compute a scaling factor that can be applied to your spectral peaks to derive the TD amplitude.&lt;/p&gt;&#xA;" OwnerUserId="4535" LastEditorUserId="4535" LastEditDate="2013-06-25T15:30:39.497" LastActivityDate="2013-06-25T15:30:39.497" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9728" PostTypeId="1" AcceptedAnswerId="9729" CreationDate="2013-06-25T03:43:19.130" Score="1" ViewCount="1087" Body="&lt;p&gt;Let's say you have an original image and a version of the same image that may have been convoluted with a Gaussian blur. How could you demonstrate that the Gaussian blur has been applied and calculate the blur radius? &lt;/p&gt;&#xA;" OwnerUserId="5449" OwnerDisplayName="user2518532" LastEditorUserId="128" LastEditDate="2018-07-16T19:32:33.970" LastActivityDate="2018-07-16T19:32:33.970" Title="Gaussian Blur Detection" Tags="|image-processing|blur|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9729" PostTypeId="2" ParentId="9728" CreationDate="2013-06-25T05:13:54.687" Score="4" Body="&lt;p&gt;If you have the blurred and unblurred images, what I think you are asking is how you can recover the &lt;em&gt;point spread function&lt;/em&gt; (&lt;a href=&quot;http://en.wikipedia.org/wiki/Point_spread_function&quot; rel=&quot;nofollow&quot;&gt;PSF&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the absence of noise, this is theoretically possible by considering the operation in the frequency domain. The blurred was introduced by a convolution of the unblurred image with a Gaussian kernel. In Fourier space, convolution is applied by multiplication of the image with the kernel, so if you have two of the operands (the source and the result), it should be possible to recover the blur kernel by division of the respective Fourier transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is effectively what some deconvolution operations attempt to do when the PSF is unknown or is a mixture of defocus and motion blur (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Blind_deconvolution#Blind_deconvolution_in_image_processing&quot; rel=&quot;nofollow&quot;&gt;blind deconvolution&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow&quot;&gt;Wiener filter&lt;/a&gt;, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in the frequency domain, the blur can be expressed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;G(u,v) = H(u,v)F(u,v) + N(u,v)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;G&lt;/code&gt; is the Fourier transform of the blurred image, &lt;code&gt;H&lt;/code&gt; is the blurring function, &lt;code&gt;F&lt;/code&gt; is the source image and &lt;code&gt;N&lt;/code&gt; is additive noise. Assuming the noise is negligible (unrealistic in most real world situations), the blur kernel can be recovered by calculating&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;H(u,v) = G(u,v) / F(u,v)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then taking the inverse Fourier transform of &lt;code&gt;H&lt;/code&gt; to obtain the PSF as an intensity image. From this you could measure the radius.&lt;/p&gt;&#xA;" OwnerUserId="4117" OwnerDisplayName="Roger Rowland" LastActivityDate="2013-06-25T12:21:48.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9731" PostTypeId="1" AcceptedAnswerId="9738" CreationDate="2013-06-25T15:56:43.577" Score="0" ViewCount="306" Body="&lt;p&gt;Suppose a complex $(N \times N)$ matrix $\mathbf{T}$, multiplying a complex vector $\mathbf{x}$ with length $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a given application that I'm studying, which is irrelevant for this discussion, I can get the same results of $\mathbf{Tx}$ by the following operation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathbf{W_1} \Re\{ \mathbf{y} \} + \mathbf{W_2} \Im\{ \mathbf{y} \}&#xA;\end{align}&#xA;where are $\mathbf{W_1}$ and $\mathbf{W_2}$ are complex $(\frac{N}{2} \times \frac{N}{2})$ matrices, $\mathbf{y}$ is a complex vector of length $\frac{N}{2}$, $\Re$ denote the real part and $\Im$ the imaginary part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to asses which one requires more operations in a real implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My analysis is that the first ($\mathbf{Tx}$) requires $N^2$ MACs, while the second requires&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ 2(\frac{N}{2})^2 = \frac{N^2}{2}$ MACs, plus $\frac{N}{2}$ sums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not completely sure about this, neither about how a DSP deals with complex numbers.&#xA;Am I making any mistake?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd appreciate your help. &lt;/p&gt;&#xA;" OwnerUserId="4590" LastEditorUserId="4590" LastEditDate="2013-06-25T16:45:37.303" LastActivityDate="2013-06-26T03:20:10.313" Title="Complexity: Number of MAC operations on a DSP" Tags="|dsp-core|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9732" PostTypeId="2" ParentId="9731" CreationDate="2013-06-25T16:39:17.417" Score="1" Body="&lt;p&gt;It appears to me that your analysis is basically correct, except that in the second case there are $\frac{N}{2}$ sums, not $N$ sums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what you are looking for when you ask &quot;how a DSP deals with complex numbers&quot;, but generally they are represented in one of two ways: as separate real and imaginary values, or as a &quot;complex&quot; entity (structure/object/whatever- depends on the language) that contains real and imaginary members.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-06-25T16:39:17.417" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9733" PostTypeId="2" ParentId="9724" CreationDate="2013-06-25T17:39:44.727" Score="1" Body="&lt;p&gt;For periodic signals, the maximum peak-to-peak amplitude is dependent in the relative phase of each harmonic, as well as their magnitudes.  Do you have that information?  If so, you can numerically evaluate all the local maxima and minima and sort.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-06-25T17:39:44.727" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9734" PostTypeId="1" AcceptedAnswerId="9737" CreationDate="2013-06-25T19:26:22.673" Score="3" ViewCount="1555" Body="&lt;p&gt;I've always thought that image convolution is a weighted sum of the nearby pixels using the convolution kernel as weights. But from the description on Wikipedia, this is what cross correlation does. Convolution seems to be equivalent to 1) reversing the convolution kernel 2) doing cross correlation with this reversed kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand it correctly – why is image blurring called convolution? What's the point of reversing the kernel?&lt;/p&gt;&#xA;" OwnerUserId="4908" LastActivityDate="2013-06-28T13:52:49.917" Title="Why is image blurring called convolution and not cross correlation?" Tags="|convolution|cross-correlation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9735" PostTypeId="1" AcceptedAnswerId="9736" CreationDate="2013-06-25T19:58:36.227" Score="0" ViewCount="1295" Body="&lt;p&gt;I have derived the Yule-Walker equation as shown below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\hat s(n) &amp;amp;= -\sum_{k=1} ^ p a_k s(n-k)\\&#xA;e(n) &amp;amp;= s(n) - \hat s(n) = s(n) + \sum_{k=1}^pa_k s(n-k)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to minimize the power of the error: $\displaystyle&#xA;\frac{\partial E\left[\lvert e(n)\rvert^2\right]}{\partial{a_k}} = 0 \quad \text{and}\quad \lvert e(n)\rvert^2 = e(n)e^*(n)&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E\left[\left(s(n) + \sum_{k=1}^p a_k s(n-k)\right)e^*(n)\right]= E\left[s(n)e^*(n)\right] + \sum_{k=1}^p a_k E\left[s(n-k)e^*(n)\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;&amp;amp;\frac{\partial E\left[\lvert e(n)\rvert^2\right]}{\partial{a_k}} = E\left[s(n-k)e^*(n)\right]=0\\&#xA;&amp;amp;E\left[s(n-k)\left(s^*(n)+\sum_{i=1}^p a^*_is^*(n-i)\right)\right]=0\\&#xA;&amp;amp;E\left[s(n-k)s^*(n)\right]+ \sum_{i=1}^p a^*_i E\left[s(n-k)s^*(n-i)\right]=0\\&#xA;&amp;amp;\sum_{i=1}^pa^*_i r(i-k) = -r(k)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few things confuse my mind. So I have 4 questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is this derivation true?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I am not sure why we do the partial derivation in terms of $a_k$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$e^*(n)$ includes $a^*_i$ coefficients, too. Why is $e^*(n)$ not affected by the derivation operation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the meaning of all these complex conjugates here? How do they affect the numeric calculation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2024" LastEditorUserId="4298" LastEditDate="2021-02-10T13:49:25.050" LastActivityDate="2021-02-10T13:49:25.050" Title="Derivation of Yule-Walker Equation for LPC" Tags="|autocorrelation|linear-prediction|lpc|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9736" PostTypeId="2" ParentId="9735" CreationDate="2013-06-25T20:20:03.650" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;Yes, your derivation is correct.&#xA;There is just a minor inconsistency in your definition of the auto-correlation function $r(k)$. If you choose to define&#xA;$$r(k) = E[s(n-k)s^*(n)]$$&#xA;then $E[s(n-k)s^*(n-i)]$ equals $r(k-i)$ or, equivalently, $r^*(i-k)$, but not $r(i-k)$. So the last equation should read&#xA;$$\sum_{i=1}^pa^*_i r^*(i-k) = -r(k)$$&lt;/li&gt;&#xA;&lt;li&gt;You take the derivative w.r.t. to $a_k$ because these are the coefficients that you can choose as to minimize the error. They are the unknowns in your problem.&lt;/li&gt;&#xA;&lt;li&gt;The fact that $e^*(n)$ can be viewed as a constant when taking the derivative w.r.t. $a_k$ has to do with how computing the gradient w.r.t. complex variables works. It is equivalent to taking the derivatives w.r.t. to the real and imaginary part of the coefficients separately, but the complex technique is more elegant and easier (at least as soon as you understand it). I've explained this technique in &lt;a href=&quot;https://math.stackexchange.com/questions/393921/derivative-of-conjugate-transpose-of-matrix/393946#393946&quot;&gt;this answer&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The complex conjugates just pop up because you consider $|e(n)|^2$ in your optimization objective: $|e(n)|^2=e(n)e^*(n)$. You wouldn't need them at all if you only considered real-valued coefficients $a_k$ and real-valued signals $s(n)$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-06-25T21:06:47.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9737" PostTypeId="2" ParentId="9734" CreationDate="2013-06-25T23:24:36.533" Score="2" Body="&lt;p&gt;According to &lt;a href=&quot;https://scicomp.stackexchange.com/questions/6962/flipping-the-kernel-in-2d-convolution&quot;&gt;this answer&lt;/a&gt;, when doing image convolution, the kernel indeed needs to be be flipped. If the kernel is symmetric, flipping is not needed. Why is convolution used for image blurring instead of cross-correlation? Because convolution has some useful mathematical properties like commutativity and convolution theorem.&lt;/p&gt;&#xA;" OwnerUserId="4908" LastEditorUserId="-1" LastEditDate="2017-04-13T12:53:54.087" LastActivityDate="2013-06-25T23:24:36.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9738" PostTypeId="2" ParentId="9731" CreationDate="2013-06-26T03:20:10.313" Score="1" Body="&lt;p&gt;I'm getting a completely different answer.  I get the same answer for the number of total scalar operations, but the number of scalar complex operations is &lt;em&gt;not&lt;/em&gt; the same as the number of scalar real operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at how much work it takes to do a complex scalar multiplication and complex scalar addition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given two complex scalars $z_0 = \langle x_0, y_0 \rangle$ and $z_1 = \langle x_1, y_1 \rangle$ then $z_0 z_1 = \langle x_0 x_1 - y_0 y_1, x_0 y_1 + x_1 y_0\rangle$, so 4 real multiplications and 2 real additions.  $z_0 + z_1 = \langle x_0+x_1, y_0+y_1 \rangle$, so 2 scalar additions.  The computation $\mathbf{Tx}$ requires a total of $N^2$ complex scalar multiplications and $N (N-1) = N^2-N$ complex scalar additions, so $4N^2$ real multiplications and $4N^2 - 2N$ scalar additions ($2N^2$ from the complex multiplications and $2N^2-2N$ from the sums for the dot products).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the other case you seem to have some magical way of transforming to two much smaller complex matrices (perhaps your original matrix $\mathbf{T}$ was very sparse?), and your vectors are pure real (or pure imaginary) so a scalar multiplication only takes two real multiplications.  $z_0 x_1 = \langle x_0 x_1, y_0 x_1\rangle$.  So $\mathbf{W_1} \Re\{ \mathbf{y} \}$ requires $\frac{N^2}{4}$ complex times real multiplications, so $\frac{N^2}{2}$ total real multiplies, and $\frac{N}{2}(\frac{N}{2}-1)$ complex additions, so $\frac{N^2}{2}-N$ real additions.  $\mathbf{W_2}\Im\{y\}$ has the same cost, and then you need to do a final sum of the two products at a cost of $\frac{N}{2}$ complex additions, so $N$ real additions.  So your second technique takes a total of $N^2$ real multiplies and $N^2 - N$ real additions.  So your second technique should take about $\frac{1}{4}$&lt;sup&gt;th&lt;/sup&gt; the work of the original technique.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-06-26T03:20:10.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9739" PostTypeId="2" ParentId="9717" CreationDate="2013-06-26T03:31:59.740" Score="0" Body="&lt;p&gt;The problem seems to be aliasing. According to &lt;a href=&quot;http://www.mathworks.in/help/signal/ug/downsampling-aliasing.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;&#xA;if i want to downsample my signal by M then it must be band limited to fs/M.&#xA;So, if i want to build a polyphase DFT filter of order M, then to get each individual signal at each filterbank output, i must band limit my input FDM signal to fs/M. Is that correct or am i missing something&lt;/p&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2013-06-26T03:31:59.740" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9740" PostTypeId="2" ParentId="9724" CreationDate="2013-06-26T03:50:56.317" Score="5" Body="&lt;p&gt;Suppose that we have a continuous-time periodic signal&#xA;$\displaystyle s(t) = a_0 + \sum_{n=1}^N a_n \cos(n\omega_0 t + \theta_n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this mean? Do we have a  trace of $s(t)$ on some recorder chart&#xA;and the trace looks periodic?  If we did, the question to be solved would be&#xA;trivial since we could simply &lt;em&gt;measure&lt;/em&gt; the maximum and minimum values of $s(t)$ on&#xA;the chart.  So the problem of interest is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given the values of &#xA;  $\omega_0, a_0, a_1, a_2, \cdots, a_N, \theta_1, \theta_2, \cdots, \theta_N$,&#xA;  find the values of &#xA;  $$M_\max = \max s(t)\quad \operatorname{and} \quad M_\min =  \min s(t).$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The OP wants to find the &lt;em&gt;peak-to-peak amplitude&lt;/em&gt; of $s(t)$ and this is, of&#xA;course, just $M_\max-M_\min$.  It is worth noting that since $s(t)$ is periodic&#xA;with period $T = \frac{2\pi}{\omega_0}$, the maximum value and minimum value&#xA;occur (at least once) in each interval of length $T$ on the time axis.  The key&#xA;issue here is since we know the $a_i$ and the $\theta_i$ etc., we can write&#xA;down the &lt;em&gt;formula&lt;/em&gt;&#xA;$$s(t) = a_0 + \sum_{n=1}^N a_n \cos(n\omega_0 t + \theta_n)\tag{1}$$&#xA;(whether this constitutes &quot;reconstruction&quot; of the time-domain signal&#xA;is a question that I will leave to others to answer) but the&#xA;standard method for finding the maxima and minima of $s(t)$&#xA;requires us to find solutions to the &lt;em&gt;nonlinear&lt;/em&gt; equation $(2)$ below&#xA;(that is, values of $t$ for which $(2)$ holds):&#xA;$$\frac{ds(t)}{dt} = -\sum_{n=1}^N a_n\cdot n\omega_0 \sin(n\omega_0 t + \theta_n) = 0.&#xA;\tag{2}$$&#xA;Once we have &lt;em&gt;found&lt;/em&gt; the values $t_1, t_2, \ldots, t_k, \ldots$ for which&#xA;$\displaystyle \sum_{n=1}^N a_n\cdot n\omega_0 \sin(n\omega_0 t_k + \theta_n) = 0$,&#xA;we can simply calculate $s(t_1), s(t_2), \ldots, s(t_k), \ldots$ and &lt;em&gt;search&#xA;through this list of numbers&lt;/em&gt; (it is &lt;em&gt;not&lt;/em&gt; necessary to &lt;em&gt;sort&lt;/em&gt; the list&#xA;as recommended in hotpaw2's answer) to find $M_\max$ and $M_\min$.  But,&#xA;ignoring the difficulty of finding the $t_k$'s makes hotpaw's answer not&#xA;particularly useful in solving the OP's problem.  The answer by ethereal&#xA;is even worse in this regard since all it boils down to is the assertion&#xA;that (for $\alpha &amp;gt; 0$)&#xA;the maximum and minimum values of $\alpha\cdot s(t)$ are $\alpha\cdot M_\max$ &#xA;and $\alpha\cdot M_\min$ respectively. Finding the maximum and minimum&#xA;of $s(t)$ from knowledge of its Fourier series is a nontrivial task, not at&#xA;all as easy as it is made out to be by ethereal or by hotpaw2.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A related problem has received a lot of research attention in the past&#xA;thirty years or so.  For a periodic signal such as $s(t)$, the &lt;em&gt;average&lt;/em&gt; power&#xA;in the signal is readily computed as &#xA;$$\bar{P} = \frac{1}{T}\int_0^T |s(t)|^2\,\mathrm dt = a_0^2 + \frac{1}{2}\sum_{i=1}^N |a_i|^2.$$&#xA;On the other hand, the &lt;em&gt;peak&lt;/em&gt; power is $P_\max = \max\{M_\max^2, M_\min^2\}$,&#xA;and is also of interest, especially to system and power amplifier designers,&#xA;and the ratio $\frac{P_\max}{\bar{P}}$, aptly named the _peak-to-average-power &#xA;ratio (PAPR) has received much attention. It &lt;em&gt;can&lt;/em&gt; be calculated exactly for&#xA;a given $s(t)$ but only with great computational effort, and so a lot of effort&#xA;has gone into finding bounds on the PAPR.  Some of these could help in getting&#xA;bounds for the OP's problem.&#xA;only with a great deal of effort.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-06-26T12:18:57.403" LastActivityDate="2013-06-26T12:18:57.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9741" PostTypeId="1" AcceptedAnswerId="9744" CreationDate="2013-06-26T05:31:27.733" Score="-1" ViewCount="69" Body="&lt;p&gt;I am not sure if this is the right place to ask this question. I am asking it anyway..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Aircraft Airbus 320, control inputs from the pilot's sidestick are processed by two computers for different purposes. in case of failure of one computer, other computer can handle the total processing job perfectly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is ' why the processing-job is divided in the first place'? What the advantages of such division in generic systems like this one?&lt;/p&gt;&#xA;" OwnerUserId="4826" LastEditorUserId="13320" LastEditDate="2016-11-21T13:20:04.410" LastActivityDate="2016-11-21T13:20:04.410" Title="benefit of dividing the signal processing job into two computers?" Tags="|hardware-implementation|" AnswerCount="1" CommentCount="5" ClosedDate="2013-09-20T07:51:27.720" ContentLicense="CC BY-SA 3.0" />
  <row Id="9744" PostTypeId="2" ParentId="9741" CreationDate="2013-06-26T12:13:25.423" Score="2" Body="&lt;p&gt;The division of processing is to reduce the likelihood of failure.  But exact replicas have exactly the same failure modes, thus providing less redundancy.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-06-26T12:13:25.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9745" PostTypeId="1" CreationDate="2013-06-26T15:17:57.750" Score="22" ViewCount="8201" Body="&lt;p&gt;So it recently dawned on me that Bessel filters, despite being listed along with the other common types, are really an oddball that belongs in a different &quot;class&quot;, and I'm trying to learn more about it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The rectangular magnitude response represents the ideal frequency domain response, for the transition band is zero and the stopband has infinite attenuation. The Gaussian magnitude response, on the other hand, represents the ideal time-domain response, in that no overshoots occur in the impulse response and the step response. Many of the responses attained in practice are approximations to these ideal ones &lt;sup&gt; &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1884932177&quot; rel=&quot;noreferrer&quot;&gt;source&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So a &lt;a href=&quot;https://en.wikipedia.org/wiki/Sinc_filter&quot; rel=&quot;noreferrer&quot;&gt;brickwall filter&lt;/a&gt; is convolution with a sinc function, and has these frequency domain properties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Flat passband&lt;/li&gt;&#xA;&lt;li&gt;Zero stopband&lt;/li&gt;&#xA;&lt;li&gt;Infinite roll-off rate/no transition band&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's non-causal and unrealizable because of the infinite tails in both directions.  It is approximated by these IIR filters, with the approximation improving as order increases:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Butterworth (maximally flat passband)&lt;/li&gt;&#xA;&lt;li&gt;Chebyshev (maximum roll-off rate with stopband &lt;em&gt;or&lt;/em&gt; passband ripple)&lt;/li&gt;&#xA;&lt;li&gt;Elliptic (maximum roll-off rate with stopband &lt;em&gt;and&lt;/em&gt; passband ripple)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Optimum_%22L%22_filter&quot; rel=&quot;noreferrer&quot;&gt;Legendre&lt;/a&gt;  (maximum roll-off rate with monotonic passband)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tDC1l.png&quot; alt=&quot;4 filter types approaching brickwall response as order increases&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_filter&quot; rel=&quot;noreferrer&quot;&gt;Gaussian filter&lt;/a&gt; is convolution with a Gaussian function, and has these time domain properties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Zero overshoot&lt;/li&gt;&#xA;&lt;li&gt;Minimal rise and fall time&lt;/li&gt;&#xA;&lt;li&gt;Minimal group delay&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's unrealizable for the same reasons as the sinc function, and can be approximated by these IIR filters, more closely as order increases:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bessel (maximally flat group delay) &lt;sup&gt; according to &lt;a href=&quot;http://www.robots.ox.ac.uk/~sjrob/Teaching/SP/l3.pdf&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt; and &lt;a href=&quot;http://www.dsprelated.com/showmessage/130958/1.php#thread1&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's Bessel filters of increasing order along with a Gaussian dashed line I picked merely because it seemed to fit the trend ($e^{-{1 \over 2}(\pi \omega)^2}$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w53KV.png&quot; alt=&quot;Bessel filters supposedly approaching Gaussian response as order increases, with guess for Gaussian&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my questions are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is everything right so far?  If so, are there other IIR filters that approximate the Gaussian?  What are they optimized for?  Maybe one that minimizes overshoot?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you search for &quot;IIR Gaussian&quot; you can find a few things (Deriche? van Vliet?), but I don't know if they're really the same as a Bessel or if they optimize for some other property, etc.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="4298" LastEditDate="2018-08-07T22:41:50.827" LastActivityDate="2022-12-26T20:42:22.167" Title="Which IIR filters approximate a Gaussian filter?" Tags="|filters|filter-design|gaussian|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9747" PostTypeId="2" ParentId="9745" CreationDate="2013-06-26T20:24:31.060" Score="5" Body="&lt;p&gt;I think you gave a nice summary of existing analytic solutions for discrete-time IIR filters. But I would also add Bessel filters to the list of filters approximating ideal frequency-selective filter characteristics. Its magnitude response does not show as sharp a transition as the other filter types of the same order, but this is the price you pay for an almost linear phase in the passband. So the Bessel filter is a compromise between a frequency-selective magnitude response and a good phase response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For approximating a Gaussian filter with IIR filters, I do not know of any analytic solutions, apart from the Bessel filter you mentioned. But note that the Bessel filter was not meant to approximate a Gaussian filter, so I'm not sure how good it really is in approximating such a filter. If you really want an IIR filter for this purpose, I would suggest you go for numerical approximation of the Gaussian filter. There are several options how to do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try to approximate the Gaussian filter in the frequency domain. The problem is that you have to make some decision concerning the desired phase response. A pure magnitude approximation with minimum phase response will very likely result in very poor time-domain properties. If you specify a linear desired phase, then you get a complex approximation problem (because you approximate the complex frequency response with magnitude and phase). Even though such an approximation problem can be quite tough to solve, there exist methods in the literature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simpler and probably better approach is to approximate the Gaussian filter in the time domain. Prony's method would be a good starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that these are just my thoughts on the topic. I have not tried to design an IIR Gaussian filter myself. I would actually go for an FIR implementation unless there are very good reasons against it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; just a few more remarks concerning the question whether a Bessel filter approximates a Gaussian or not. I do not know of any meaningful error criterion which the Bessel filter minimizes in approximating a Gaussian filter. I would be glad to learn about it though. People may claim that the impulse response of a Bessel filter looks similar to Gaussian, or that its frequency response resembles a Gaussian, but I have not yet seen any proof that Bessel filters approximate a Gaussian in any sense, and that the approximation error goes to zero as the filter order increases. I do not deny that it is more similar to a Gaussian than the other standard filters (Butterworth, Chebyshev, etc.), but this is not important for the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See below four plots of impulse responses of Bessel filters (orders 5, 10, 15, 20), designed in Octave (function besself). As you can see, the ringing in the tail does not decrease with increasing filter order, and I do not see how these filters approximate a Gaussian, and if so, according to which optimality criterion. However, if anybody can enlighten me about this, I would be more than happy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RVFF4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-06-27T13:59:27.910" LastActivityDate="2013-06-27T13:59:27.910" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9748" PostTypeId="2" ParentId="9745" CreationDate="2013-06-26T21:22:30.693" Score="9" Body="&lt;p&gt;The &lt;a href=&quot;http://hal.inria.fr/docs/00/07/47/78/PDF/RR-1893.pdf&quot; rel=&quot;noreferrer&quot;&gt;Deriche&lt;/a&gt; and &lt;a href=&quot;http://homepage.tudelft.nl/e3q6n/publications/1998/ICPR98LVTYPV/ICPR98LVTYPV.pdf&quot; rel=&quot;noreferrer&quot;&gt;van Vliet&lt;/a&gt; filters are heuristics.  In both cases they choose the locations of poles and zeros to minimize either the RMS difference or the maximum difference of the filter's impulse response from a Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both filters are causal-anti-causal pairs.  So I think they have no phase error or group delay, but you need to be able to run them backwards on the data as well as forwards.  This makes them popular in image processing, but perhaps restricts their applicability elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That they are heuristics is evidenced by the wealth of papers that tweak them.  For example a google search (while I was looking for the link to the Deriche paper) turned up &lt;a href=&quot;http://lmi.bwh.harvard.edu/papers/pdfs/2006/farnebackMathImagingVision06.pdf&quot; rel=&quot;noreferrer&quot;&gt;this one&lt;/a&gt; that tries to solve the problem that the Deriche derivative-of-gaussian filter doesn't have an exactly 0 DC response.  There are also some &lt;a href=&quot;http://lear.inrialpes.fr/people/sdika/publis/Triggs-tsp04.pdf&quot; rel=&quot;noreferrer&quot;&gt;interesting issues about initializing the boundary conditions correctly&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found the following overview a good resource:&#xA;Dave Hale, &lt;a href=&quot;http://www.cwp.mines.edu/Meetings/Project06/cwp546.pdf&quot; rel=&quot;noreferrer&quot;&gt;Recursive Gaussian ﬁlters&lt;/a&gt;, Colorado School of Mines Center for Wave Phenomena report CWP-546.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-06-26T21:22:30.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9751" PostTypeId="1" AcceptedAnswerId="9753" CreationDate="2013-06-27T08:34:53.910" Score="14" ViewCount="8610" Body="&lt;p&gt;I am working in digital image restoration field. I have read all things about convolution, that, for an &lt;strong&gt;LTI&lt;/strong&gt; system, if we know its &lt;strong&gt;impulse response&lt;/strong&gt;, then we can find its output by just using convolution between input and impulse response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me that what is the main mathematical philosophy behind it? Your experience with will tell more to me than just internet surfing about it.&lt;/p&gt;&#xA;" OwnerUserId="4444" LastEditorDisplayName="user40095" LastEditDate="2019-03-08T01:48:41.723" LastActivityDate="2019-03-08T01:48:41.723" Title="Why convolution is required, or what is the philosophy behind convolution?" Tags="|image-processing|discrete-signals|convolution|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9752" PostTypeId="1" AcceptedAnswerId="9776" CreationDate="2013-06-27T09:12:05.810" Score="2" ViewCount="989" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What I have:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A digital signal sampled at &lt;code&gt;Fs&lt;/code&gt; composed of a QPSK modulation at &lt;code&gt;Fmod&lt;/code&gt; plus some additive white gaussian noise.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What I want:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$$ modPower/signalPower $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea behind is that I want to detect if there is a communication at Fmod on the channel or if there's just noise.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What I do:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Over the observation window &lt;code&gt;n&lt;/code&gt; I compute:&#xA;$$signalPower = \sum\limits_{i=1}^n s(i)^2$$&#xA;$$modPowerCos= \sum\limits_{i=1}^n s(i)*cos(2\pi*Fmod*i/Fs)$$&#xA;$$modPowerSin= \sum\limits_{i=1}^n s(i)*sin(2\pi*Fmod*i/Fs)$$&#xA;$$modPower = modPowerCos^2 + modPowerSin^2$$&#xA;$$ratio = modPower / signalPower$$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My code:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Ns = Number of samples per symbol&#xA;% Nsyn = Number of symbols of the window&#xA;% Nt = Length of the window&#xA;% Fmod = Modulation Frequency&#xA;% Fs = Sampling Frequency&#xA;Nt = Nsym*Ns;&#xA;signalPower = zeros(1, length(obj.signal));     % Signal Powe&#xA;modPowerCos = zeros(1, length(obj.signal));     % Fmod cos correlation&#xA;modPowerSin = zeros(1, length(obj.signal));     % Fmod sin correlation&#xA;for ii = obj.Ns:length(obj.signal)&#xA;    for jj = 0:Nt-1&#xA;        if ii-jj &amp;gt; 0 &amp;amp;&amp;amp; ii-jj &amp;lt;= length(obj.IQrx)&#xA;            signalPower(ii) = signalPower(ii) + ...&#xA;                obj.signal(ii-jj)^2;&#xA;            modPowerCos(ii) = modPowerCos(ii) + ...&#xA;                obj.signal(ii-jj) * ...&#xA;                cos(2*pi*Fmod*(ii-jj)/Fs);&#xA;            modPowerSin(ii) = modPowerSin(ii) + ...&#xA;                obj.signal(ii-jj) * ...&#xA;                sin(2*pi*Fmod*(ii-jj)/Fs);&#xA;        end&#xA;    end&#xA;    modPowerCos(ii) = abs(modPowerCos(ii));&#xA;    modPowerSin(ii) = abs(modPowerSin(ii));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My problem:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I find a ratio higher than &lt;code&gt;1&lt;/code&gt; and I think it comes from a wrong formula but I don't know which one.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Example:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the picture bellow in blue is the computed signal power &lt;code&gt;signalPower&lt;/code&gt; while in magenta is the computed Fmod power &lt;code&gt;modPowerCos + modPowerSin&lt;/code&gt;. You can see that &lt;code&gt;modPower&lt;/code&gt; is higher than &lt;code&gt;signalPower&lt;/code&gt;, which bugs me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DgVdc.png&quot; alt=&quot;Fmod power vs Signal power&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2013-06-30T14:46:19.463" Title="Frequency detection" Tags="|matlab|frequency|modulation|power-spectral-density|qpsk|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9753" PostTypeId="2" ParentId="9751" CreationDate="2013-06-27T09:28:19.687" Score="16" Body="&lt;p&gt;&lt;strong&gt;The Idea of Convolution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My favorite exposition of the topic is in one of Brad Osgood's &lt;a href=&quot;http://www.youtube.com/watch?v=wUT1huREHJM&quot; rel=&quot;noreferrer&quot;&gt;lectures on the Fourier Transform&lt;/a&gt;. The discussion of convolution begins around 36:00, but the whole lecture has additional context that's worth watching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is that, when you define something like the Fourier Transform, rather than working directly with the definition all the time, it's useful to derive higher-level properties that simplify calculations. For example, one such property is that the transform of the sum of two functions is equal to the sum of the transforms, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F\{f + g\} = F\{f\} + F\{g\}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means if you have a function with an unknown transform, and it can be decomposed as a sum of functions with known transforms, you basically get the answer for free. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since we have an identity for the sum of two transforms, it's a natural question to ask what the identity is for the product of two transforms, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F\{f\}F\{g\} = \space ?.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that when you calculate the answer, convolution is what appears. The entire derivation is given in the video, and since your question is mostly conceptual, I won't recapitulate it here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The implication of approaching convolution in this way is that it's an intrinsic part of the way the Laplace Transform (of which the Fourier Tranform is a special case) turns linear constant-coefficient ordinary differential equations (LCCODE's) into algebraic equations. That fact that such a transform is available to make LCCODE's analytically tractable is a large part of the reason why they're studied in signal processing. For example, to quote &lt;a href=&quot;http://books.google.com/books?id=vfdSAAAAMAAJ&quot; rel=&quot;noreferrer&quot;&gt;Oppenheim and Schafer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Because they are relatively easy to characterize mathematically and&#xA;  because they can be designed to perform useful signal processing&#xA;  functions, the class of linear shift-invariant systems will be studied&#xA;  extensively.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So one answer to the question, is that if you're using transform methods to analyze and/or synthesize LTI systems, sooner or later, convolution will arise (either implicitly or explicitly). Note that this approach to introducing convolution is very standard in the context of differential equations. For example, see this &lt;a href=&quot;http://www.youtube.com/watch?v=3ejfkMHr_DE&quot; rel=&quot;noreferrer&quot;&gt;MIT lecture by Arthur Mattuck&lt;/a&gt;. Most presentations either present the convolution integral without comment, then derive its properties (i.e. pull it out of a hat), or hem and haw about the strange form of the integral, talk about flipping and dragging, time-reversal, etc., etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I like Prof. Osgood's approach is that it avoids all that tsouris, as well as providing, in my opinion, deep insight into how mathematicians probably arrived at the idea in the first place. And I quote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I said, &quot;Is there a way of combining F and G in the time domain, so&#xA;  that in the frequency domain the spectrums multiply, the Fourier&#xA;  transforms multiply?&quot; And the answer is, yes, there is, by this&#xA;  complicated integral. It's not so obvious. You wouldn't get out of bed&#xA;  in the morning and write this down, and expect that this was going to&#xA;  solve that problem. How do we get it? You said, suppose the problem is&#xA;  solved, see what has to happen, and then we'd have to recognize when&#xA;  it's time to declare victory. And it's time to declare victory.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Now, being an obnoxious mathematician, you cover your tracks and say,&#xA;  &quot;Well, I'm simply going to define the convolution of two functions by&#xA;  this formula.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;LTI Systems&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most DSP texts, convolution is usually introduced in a different way (that avoids any reference to transform methods). By expressing an arbitrary input signal $x(n)$ as a sum of scaled and shifted unit impulses,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(n) = \sum_{k=-\infty}^\infty{x(k)\delta(n - k)}, \tag{1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\delta(n) = \begin{cases}&#xA;0, &amp;amp; n \ne 0 \\&#xA;1, &amp;amp; n = 0,&#xA;\end{cases} \tag{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the defining properties of &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory&quot; rel=&quot;noreferrer&quot;&gt;linear time-invariant systems&lt;/a&gt; lead directly a convolution sum involving the impulse response $h(n) = L[\space \delta(n) \space]$. If the system defined by an LTI operator $L$ is expressed as $y(n) = L[\space x(n)\space]$, then by applying the repective properties, namely linearity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\overbrace{L[\space ax_1(n) + bx_2(n)\space ]}^\text{Transform of the sum of scaled inputs} = \overbrace{aL[\space x_1(n)\space ] + bL[\space x_2(n)\space ]}^\text{Sum of scaled transforms} , \tag{3}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and time/shift invariance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;L[\space x(n) \space] = y(n) \space \xrightarrow{\text{implies}} L[\space x(n-k) \space] = y(n-k), \tag{4}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the system can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(n) = \overbrace{L\left[ \sum_{k=-\infty}^\infty{x(k)\delta(n - k)}\right]}^\text{Tranform of the sum of scaled inputs} = \overbrace{\sum_{k=-\infty}^\infty{x(k)L[\delta(n - k)]}}^\text{Sum of scaled transforms} = \overbrace{\sum_{k=-\infty}^\infty{x(k)h(n-k) }. }^\text{Convolution with the impulse response}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's a very standard way to present convolution, and it's a perfectly elegant and useful way to go about it. Similar derivations can be found in &lt;a href=&quot;http://books.google.com/books?id=vfdSAAAAMAAJ&quot; rel=&quot;noreferrer&quot;&gt;Oppenheim and Schafer&lt;/a&gt;, &lt;a href=&quot;http://books.google.com/books?id=sAcfAQAAIAAJ&quot; rel=&quot;noreferrer&quot;&gt;Proakis and Manolakis&lt;/a&gt;, &lt;a href=&quot;http://books.google.com/books?id=iAxTAAAAMAAJ&quot; rel=&quot;noreferrer&quot;&gt;Rabiner and Gold&lt;/a&gt;, and I'm sure many others. Some deeper insight [that goes further than the standard introductions] is given by Dilip in his excellent answer &lt;a href=&quot;https://dsp.stackexchange.com/a/6355/35&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, however, that this derivation is somewhat of a magic trick. Taking another look at how the signal is decomposed in $\left(1\right)$, we can see that it's already in the form of a convolution. If &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\overbrace{(f * g)(n)}^\text{f convolved with g} = \sum_{k=-\infty}^\infty{f(k)g(n-k)},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then $\left(1\right)$ is just $x * \delta$. Because the delta function is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Identity_element&quot; rel=&quot;noreferrer&quot;&gt;identity element&lt;/a&gt; for convolution, saying any signal can be expressed in that form is a lot like saying any number $n$ can be expressed as $n + 0$ or $n \times 1$. Now, choosing to describe signals that way is brilliant because it leads directly to the idea of an impulse response--it's just that the idea of convolution is already &quot;baked in&quot; to the decomposition of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this perspective, convolution is intrinsically related to the idea of a delta function (i.e. it's a binary operation that has the delta function as its identity element). Even without considering its relation to convolution, the description of the signal depends crucially on the idea of the delta function. So the question then becomes, where did we get the idea for the delta function in the first place? As far as I can tell, it goes at least as far back as &lt;a href=&quot;http://en.wikipedia.org/wiki/Delta_function#History&quot; rel=&quot;noreferrer&quot;&gt;Fourier's paper&lt;/a&gt; on the Analytical Theory of Heat, where it appears implicitly. One source for further information is &lt;a href=&quot;http://www.slideshare.net/Alexdfar/origin-adn-history-of-convolution&quot; rel=&quot;noreferrer&quot;&gt;this paper on Origin and History of Convolution&lt;/a&gt; by Alejandro Domínguez.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, those are the two of the main approaches to the idea in the context of linear systems theory. One favors analytical insight, and the other favors numerical solution. I think both are useful for a full picture of the importance of convolution. However, in the discrete case, neglecting linear systems entirely, there's a sense in which convolution is a much older idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Polynomial Multiplication&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One good presentation of the idea that discrete convolution is just polynomial multiplication is given by Gilbert Strang in &lt;a href=&quot;http://www.youtube.com/watch?v=4ctngXQrmDc#t=5m46s&quot; rel=&quot;noreferrer&quot;&gt;this lecture&lt;/a&gt; starting around 5:46. From that perspective, the idea goes all the way back to the introduction of positional number systems (which represent numbers implicitly as polynomials). Because the &lt;a href=&quot;https://en.wikipedia.org/wiki/Z-transform&quot; rel=&quot;noreferrer&quot;&gt;Z-transform&lt;/a&gt; represents signals as polynomials in z, convolution will arise in that context as well--even if the Z-transform is defined &lt;a href=&quot;http://sepwww.stanford.edu/sep/prof/fgdp/c1/paper_html/node2.html#SECTION00110000000000000000&quot; rel=&quot;noreferrer&quot;&gt;formally as a delay operator&lt;/a&gt; without recourse to &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_analysis&quot; rel=&quot;noreferrer&quot;&gt;complex analysis&lt;/a&gt; and/or as a special case of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Laplace_transform&quot; rel=&quot;noreferrer&quot;&gt;Laplace Transform&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2013-07-03T00:35:46.550" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9754" PostTypeId="2" ParentId="9751" CreationDate="2013-06-27T11:02:11.307" Score="6" Body="&lt;p&gt;I &lt;a href=&quot;http://en.wikipedia.org/wiki/Talk:Convolution#Why_the_time_inversion.3F&quot; rel=&quot;nofollow noreferrer&quot;&gt;once gave the answer in Wikipedia convolution discussion page, which asked basically the same question: &lt;strong&gt;Why the time inversion?&lt;/strong&gt;&lt;/a&gt;. The philosophy is that you apply a single pulse at time 0 to your filter and record its response at time 0,1,2,3,4,…. Basically, response will look like a function, h(t). You may plot it. If pulse was n times taller/higher, response pulses will be proportionally taller (this is because linear filter is always assumed). Now, all DSP (and not only DSP) is about what happens when you apply the filter to your signal? You know the impulse response. Your signal (especially digital) is nothing more than a series of pulses of height x(t). It has height/value $x$ at time $t$. Linear systems are cool that you can sum the outputs for each such input pulse to get the response function y(t) for input function x(t). You know that output pulse y(t=10) depends on immediate input x(10), which contributes h(0)*x(10). But there is also contribution, x(9)*h(1), to the output from the previous pulse, x(9), and contributions from even earlier input values. You see, as you add contributions from earlier inputs, one time argument decreases while another increases. You &lt;a href=&quot;https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation&quot; rel=&quot;nofollow noreferrer&quot;&gt;MAC&lt;/a&gt; all the contributions into y(10) = h(0)*x(10) + h(1)*x(9) + h(2)*x(8) + …, which is a convolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of functions y(t), h(t) and x(t) as vectors. Matrices are operators in the linear algebra. They take input vector (a series of numbers) and produce output vector (another series of numbers). In this case, the y is a product of convolution matrix with vector x, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\vec y = \begin{bmatrix}y_0\\y_1\\y_2 \\ \vdots \end{bmatrix} = \begin{bmatrix}h_0 &amp;amp; 0  &amp;amp; 0 &amp;amp; \cdots \\ h_1 &amp;amp; h_0  &amp;amp; 0 &amp;amp; \cdots \\ h_2 &amp;amp; h_1 &amp;amp; h_0  &amp;amp; \cdots \\ \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \ddots \end{bmatrix} \begin{bmatrix}x_0\\x_1\\x_2 \\ \vdots \end{bmatrix} = H \vec x$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;a href=&quot;https://math.stackexchange.com/questions/377496/why-matrix-representation-of-convolution-cannot-explain-the-convolution-theorem&quot;&gt;because convolution is a Toeplitz matrix&lt;/a&gt;, it has Fourier eigenbasis and, therefore, convolution operator (linear operators are represented by matrices, but matrix also depends on the basis) is a nice diagonal matrix in the fourier domain,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\vec Y = \begin{bmatrix}Y_0\\Y_1\\Y_2 \\ \vdots \end{bmatrix} = \begin{bmatrix} \lambda_0 &amp;amp; 0  &amp;amp; 0 &amp;amp; \cdots \\ 0 &amp;amp; \lambda_1  &amp;amp; 0 &amp;amp; \cdots \\0 &amp;amp; 0 &amp;amp; \lambda_2  &amp;amp; \cdots \\ \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \ddots \end{bmatrix} \begin{bmatrix}X_0\\X_1\\X_2 \\ \vdots \end{bmatrix} = diag(H)\vec X$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, much more zeroes and, thus, much simpler computation. This result is know as &quot;convolution theorem&quot; and, as first response answered, it is much simpler in the fourier domain. But, this is phylosophy behind the &quot;convolution theorem&quot;, fourier basis and linear operators rather than ubiquitous need for convolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, you do convolution because you have your input signal, impulse response and require output in time domain. You may transform into fourier space to optimize computation. But, it is not practical for simple filters, as I've seen in the &lt;a href=&quot;http://www.dspguide.com/pdfbook.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;DSPGuide&lt;/a&gt;. If your filter looks like $y[currentTime] = k_1 x[time-1] + k_2 x(time-2) + b * y[time-1]$, it makes no sense to fourier transform. You just do n multiplications, for computing every y. It is also natural for real-time. In real-time you compute only one y at a time. You may think of Fourier transform if you have your signal x recorded and you need to compute the whole vector y at once. This would need NxN MAC operations and Fourier can help to reduce them to N log(N).&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-06-27T17:02:56.223" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9757" PostTypeId="2" ParentId="9734" CreationDate="2013-06-27T15:41:14.417" Score="5" Body="&lt;p&gt;Broadly speaking, image blurring replaces each pixel value by a &lt;em&gt;weighted sum&lt;/em&gt; of adjacent pixel values. Now, this weighted sum can be represented as convolution or as a correlation&#xA;for the simple reason that a convolution of $I$ and $g$  (where $I$ is the image and $g$ the&#xA;kernel) is the same as the correlation of $I$ and $\hat{g}$ where $\hat{g}$ is just&#xA;$g$ &quot;flipped over&quot;. As fhucho has already pointed out, if the kernel is symmetric, the&#xA;flipping over has no effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easier to understand this idea in 1D rather than 2D.  For each $n$, suppose that&#xA;the result (weighted sum of adjacent values) that we need to get is&#xA;$$\begin{align}&#xA;\hat{I}[n] &amp;amp;= \quad I[n]a[0]\\&#xA;&amp;amp;\quad +\ I[n+1]a[1] + I[n+2]a[2] + \cdots + I[n+N]a[N]\\&#xA;&amp;amp;\quad +\ I[n-1]a[-1] + I[n-2]a[-2] + \cdots + I[n-N]a[-N]\\&#xA;&amp;amp;= \sum_{m=-N}^N I[n+m]a[m]&#xA;\end{align}$$&#xA;We readily recognize as the &lt;em&gt;correlation&lt;/em&gt; of $\mathbf I$ and the sequence&#xA;$$\mathbf a =\left(a[-N], a[-N+1], \cdots, a[0], \cdots a[N-1], a[N]\right).$$&#xA;Now, define the sequence $\mathbf g$ as $\mathbf  a$ flipped over, that is,&#xA;$g[m] = a[-m]$ for all $m$. Note that $\mathbf a$ is just $\mathbf g$ flipped&#xA;over (and is thus the $\hat{g}$ mentioned earlier). Then we have that&#xA;$$\begin{align}&#xA;\hat{I}[n] &amp;amp;= \sum_{m=-N}^N I[n+m]a[m]\\&#xA;&amp;amp;= \sum_{m=-N}^N I[n+m]g[-m]\\&#xA;&amp;amp;= \sum_{-i=-N}^N I[n-i]g[i] &amp;amp;\text{replace}~ m~\text{by} ~ -i\\&#xA;&amp;amp;= \sum_{i=-N}^N I[n-i]g[i] &amp;amp; \text{write sum in reverse order}\\&#xA;&amp;amp;= \mathbf I \star \mathbf g\bigr|_n&#xA;\end{align}$$&#xA;A similar calculation can be carried out for 2D signals (images) but&#xA;the details are messier and sometimes it is hard to see the forest&#xA;because of the trees.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, whether we choose to regard image blurring as&#xA;correlation or convolution&#xA;is entirely a matter of convenience and nomenclature.&#xA;We can convolve the image and the &quot;impulse response&quot;&#xA;or correlate the image with the &quot;esnopser eslupmi&quot;,&#xA;whichever we prefer, and in either case, we are replacing&#xA;each pixel value with the same weighted sum of adjacent pixel values.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-06-28T13:52:49.917" LastActivityDate="2013-06-28T13:52:49.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9758" PostTypeId="1" CreationDate="2013-06-27T16:03:32.803" Score="2" ViewCount="422" Body="&lt;p&gt;I am using an accelerometer to record the motion of a shake table (a rocking table) which moves forward and backward in one direction. The signal is very noisy and decided to use Extended Kalman Filter. What equation should i use for the model?&lt;/p&gt;&#xA;" OwnerUserId="4919" LastActivityDate="2013-06-27T16:03:32.803" Title="Extended kalman filter for accelerometer data on shaking table" Tags="|noise|kalman-filters|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9760" PostTypeId="1" CreationDate="2013-06-27T19:18:56.430" Score="4" ViewCount="1321" Body="&lt;p&gt;I have a list of collected data points that I need to take a DFT of, however with the problem that about one quarter of the data points in the middle are missing, and so even though the existing data points are evenly spaced their is still a large time gap that needs to be accounted for. I looked up some things on a variable sampling rate DFT, but it was first of all over my head and secondly I am not sure if it is applicable. My question then is how would I account for that time gap in my calculation. It would be best to have everything explained in as close to laymen's terms as possible as I am out of my depth in this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help.&lt;/p&gt;&#xA;" OwnerDisplayName="Patrick" LastActivityDate="2013-06-27T21:21:17.280" Title="how to compute a discrete fourier transform on fragmented data" Tags="|homework|fourier-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9761" PostTypeId="2" ParentId="9760" CreationDate="2013-06-27T20:11:10.947" Score="3" Body="&lt;p&gt;Basically, it is impossible to calculate the full DFT of your data. Take a look at the DFT matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cbpqT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of its elements are non-zeroes. Thus, each and every signal element is important for any frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at this another way, had it been possible to do what you want, you could find the DFT of the signal, do an inverse DFT transform, and get the full signal back! Obviously, this is wrong. You don't have this information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, it is possible to compute the frequencies of your data approximately. Recall that one of the possible explanations of DFT transform is that each of its coefficients is the &lt;a href=&quot;http://books.google.co.il/books?id=coq49_LRURUC&amp;amp;pg=PA44&amp;amp;lpg=PA44&amp;amp;dq=dft%20least%20squares&amp;amp;source=bl&amp;amp;ots=pLJiZck9oP&amp;amp;sig=Zd7OmPPxCrI46WZjjviUCnTPYcI&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=g6LMUf_EJIO-O6rwgZgI&amp;amp;ved=0CCoQ6AEwAA#v=onepage&amp;amp;q=dft%20least%20squares&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;best fit&lt;/a&gt; to a sum of shifted sine waves, $A* sin(w (x-x_0))$, or $a sin(wx)+b cos(wx)$, where $w$ is dependent on the coefficient index. Thus, you should do a least-squares fit to $a_i,b_i$, which are the coefficients of $a+bi$ in DFT.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2013-06-27T21:21:17.280" LastActivityDate="2013-06-27T21:21:17.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9763" PostTypeId="1" CreationDate="2013-06-28T11:56:28.923" Score="0" ViewCount="200" Body="&lt;p&gt;I need to calculate BER (bit error rate) for a system using spreading spectrum DS over ultra wideband (UWB). Modulation is bpsk. The spreading sequence lengths are not equal for all users. Receiver is matched filter. I know the equations of DS-UWB transmission signal and template signal which I should use at receiver to extract the user's data. I know that I should use convolution between the received signal (transmitted + AWGN noise) and template signal. My problem is, how to calculate the result of that convolution? is it integration or multiplication?&#xA;thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="4854" LastActivityDate="2013-11-29T08:51:52.443" Title="BER calculation in DS-UWB system" Tags="|convolution|bpsk|matched-filter|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9764" PostTypeId="2" ParentId="8365" CreationDate="2013-06-28T12:08:50.583" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;Cross correlation&lt;/a&gt; is used for comparing functions&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2013-06-28T12:08:50.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9765" PostTypeId="2" ParentId="9620" CreationDate="2013-06-28T13:27:57.460" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;Convolution&lt;/a&gt; can be used to find the note. Its best shown &lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/6/6a/Convolution_of_box_signal_with_itself2.gif&quot; rel=&quot;nofollow&quot;&gt;visually&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would this be a data structure holding e.g {sampleNumber, frequency} pairs?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, the signal would be. The wavelet can be stored as a function but it can also be {sampleNumber, frequency} pairs.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If a wavelet is an array of these pairs, how is it applied to the audio data?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f*g = \int f(x)g(t-x)dx$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is commutative so it does not matter whether f or g is wavelet or signal or vice versa.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How does this wavelet apply to the analysis when using an FFT?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In some applications in signal processing, convolution is calculated using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution_theorem&quot; rel=&quot;nofollow&quot;&gt;convolution theorem&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathcal{F}(f*g) = \mathcal{F}(f) \mathcal{F}(g)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the convolution of f and g can alternatively be calculated by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f*g = \mathcal F ^{-1}[ \mathcal{F}(f) \mathcal{F}(g)]$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is actually being compared to identify the signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The signal is being compared to the wavelet &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How exactly is a wavelet used digitally?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are many applications, besides note identification, they can be used in lossy signal compression. See the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_codec&quot; rel=&quot;nofollow&quot;&gt;Dirac&lt;/a&gt; codec. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Cross_correlation&quot; rel=&quot;nofollow&quot;&gt;Cross Correlation&lt;/a&gt; is a similar operation which can be used for identifying wavelets&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2013-06-28T13:27:57.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9767" PostTypeId="1" CreationDate="2013-06-28T19:13:14.550" Score="2" ViewCount="176" Body="&lt;p&gt;Before I start my question, I should probably mention that this question might not be the right question to ask here, but I tried academiabeta, and stackoverflow, but without getting any to-the-point responses. I also noticed that there were some questions of similar interest asked here, but mine is little different and more subject/situation-specific. Also I am afraid my question might be a little too long, pardon my slightly unnecessary detail!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my situation: I am a pure mathematician finishing Ph.D., working in Riemann surfaces, Teichmueller theory and differential geometry (with published papers in decent journals), having backgrounds in these topics and some PDE and topology and have some introductory knowledge about programming. I have been wanting to switch to little more applied areas (described below) because: 1) I believe getting posts and grants are slightly easier in there, 2) my postdoc hunting in pure mathematics have resulted in vein (despite getting shortlisted twice in Europe). I wanted to switch later anyway but reason 2) is forcing me to think of it now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By applied areas, I meant areas like medical imaging, computer vision or even theoretical biology (there are interesting works of Prof. Robert Penner on moduli spaces and protein folding, for example), where they use Riemann surface and differential geometry a lot, and I want to work in more theoretical problems, but would also like to learn more computational techniques (although secondary). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without further ado, here is my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I have not published any single papers in those applied areas, or haven't had any formal training in them, what are my chances of getting a postdoc in these areas, being a pure mathematician all my life so far? If any of you have done so before, or are working in these applied areas, I would very much appreciate if you inform me! By informal communication with some people (who are Ph.D. students) working in these areas, I was informed that my backgrounds are good, but one or two professors I have contacted already mentioned that they want somebody with actual research experience in say imaging, which I do not have. So, I am not sure where I stand compared to other applicants. Your responses and honest opinion (even though not in my favor) will be highly appreciated! Thanks a lot in advance!&lt;/p&gt;&#xA;" OwnerUserId="4927" LastActivityDate="2013-06-28T19:13:14.550" Title="How much is the chance for a pure mathematician (geometer) to get a postdoc in imaging if he switches fields after Ph.D. and apply for one?" Tags="|image-processing|computer-vision|signal-analysis|math|" AnswerCount="0" CommentCount="3" ClosedDate="2013-09-06T21:17:44.420" ContentLicense="CC BY-SA 3.0" />
  <row Id="9768" PostTypeId="1" CreationDate="2013-06-28T22:41:39.247" Score="0" ViewCount="2272" Body="&lt;p&gt;My idea is to find a word in wav/mp3 files. It is just one word.&#xA;I have a database with a few hundred songs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for pattern matching (this is not an exact pattern) it can be an word i choose but only one.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can you recommend a pre-processing algorithm. you run the algorithm on the files?&lt;/li&gt;&#xA;&lt;li&gt;Can you recommend a real-time algorithm?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have found &lt;a href=&quot;http://www.developer.nokia.com/Community/Wiki/Sound_pattern_matching_using_Fast_Fourier_Transform_in_Windows_Phone&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; online &lt;/p&gt;&#xA;" OwnerUserId="1831" LastEditorUserId="4677" LastEditDate="2013-09-21T05:03:18.047" LastActivityDate="2014-10-16T16:51:50.233" Title="voice pattern matching algorithm" Tags="|matlab|fft|algorithms|sound|voice|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9769" PostTypeId="1" CreationDate="2013-06-29T03:10:00.543" Score="-1" ViewCount="526" Body="&lt;p&gt;I have a wave file whose frequency spectrum looks like this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2rRaS.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It contains audio, which I want to keep while removing the rest. The problem is that the surround noise changes, just those distinct voice patterns remain. I marked the voice patterns for clarity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eLkBl.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could an algorithm look like / a workflow in adobe audition look like that removes everything but the voice patterns? I think that the main characteristic is the line-shaped form over time. Loudness alone is not enough as the noise is loud aswell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.google.com/file/d/0BzJ2dx-DH1K8QkNtTmhFcHlVUms/edit?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.google.com/file/d/0BzJ2dx-DH1K8QkNtTmhFcHlVUms/edit?usp=sharing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.google.com/file/d/0BzJ2dx-DH1K8Qm0wR0lVUENGV2s/edit?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.google.com/file/d/0BzJ2dx-DH1K8Qm0wR0lVUENGV2s/edit?usp=sharing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4936" OwnerDisplayName="Peak Reconstruction Wavelength" LastEditorUserId="4298" LastEditDate="2013-07-01T13:40:06.580" LastActivityDate="2013-07-01T13:48:58.360" Title="Removing surrounding noises from voice recording" Tags="|speech|denoising|speech-processing|" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="9770" PostTypeId="1" AcceptedAnswerId="9772" CreationDate="2013-06-29T19:22:45.927" Score="0" ViewCount="73" Body="&lt;p&gt;For a multivariate time series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\underline{y}(t)=[y_1(t) \dots y_n(t)]^T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the difference between the components $y_i(t)$ being spatially independent and instantaneously independent?&lt;/p&gt;&#xA;" OwnerUserId="4534" LastActivityDate="2013-07-03T11:56:45.620" Title="Difference between 'spatially' and 'instantaneously' independent" Tags="|independence|spatial|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9771" PostTypeId="2" ParentId="9671" CreationDate="2013-06-29T19:54:28.517" Score="1" Body="&lt;p&gt;You could use a Fourier transform, set the frequency you want to eliminate to zero and then inverse Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have function $f(x)$ and you FT to get function $\hat{f}(w)$, then define $\hat{g}(w) = \hat{f}(w)$ for all $w \neq 365/2\pi$ and $\hat{g}(365/2\pi)=0$. Now IFT $\hat{g}$ to get $g(x)$ which will be a function with no yearly oscillations. &lt;/p&gt;&#xA;" OwnerUserId="4534" LastActivityDate="2013-06-29T19:54:28.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9772" PostTypeId="2" ParentId="9770" CreationDate="2013-06-29T23:45:35.787" Score="2" Body="&lt;p&gt;The components are instantaneously uncorrelated if &#xA;$$&#xA;E[y_i(t_1) y_j(t_2)] = 0&#xA;$$&#xA;for all $i \not= j$ and for all $t_1,t_2$ and when $i = j$ :&#xA;$$&#xA;E[y_i(t_1) y_i(t_2)] = 0&#xA;$$&#xA;for all $t_1 \not= t_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The components are spatially uncorrelated if&#xA;$$&#xA;E[y_i(t) y_j(t)] = 0&#xA;$$&#xA;for all $i \not= j$ (assuming a change in index corresponds to a spatial change).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Correlation_and_dependence&quot; rel=&quot;nofollow&quot;&gt;Note that correlation is not quite the same thing as statistical independence.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-07-03T11:56:45.620" LastActivityDate="2013-07-03T11:56:45.620" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9773" PostTypeId="1" AcceptedAnswerId="9775" CreationDate="2013-06-30T05:43:16.570" Score="0" ViewCount="294" Body="&lt;p&gt;The Rician factor is the ratio between the mean power of the LOS path to the mean power of all other (non-LOS) paths. Increasing/decreasing this factor means increasing/decreasing the mean power of the LOS path. Does increasing the Rician factor improve or degrade transmission quality?&lt;/p&gt;&#xA;" OwnerUserId="4854" LastEditorUserId="1606" LastEditDate="2013-06-30T10:23:20.843" LastActivityDate="2013-06-30T10:23:20.843" Title="Rician factor effect" Tags="|digital-communications|multipath|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9774" PostTypeId="2" ParentId="9671" CreationDate="2013-06-30T06:41:27.763" Score="2" Body="&lt;p&gt;Their are some problems in the code and same algorithmic issues:&#xA;Code:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You are estimating the wrong frequency: &lt;code&gt;f2=1/((365*24*60)/2);&lt;/code&gt; should be &lt;code&gt;f2=1/((365*24*60))/2;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Algorithm:&#xA;Basically you are using a fourier series (&lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Fourier_series&lt;/a&gt;) with those terms corresponding to the known frequencies. But you should be aware of the limitations of that approach:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You have to estimate the dc part (frequency 0), because your signals' dc value is not zero!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In theory this approach works only for full periods of each frequency. That's why f1 is estimated quite good, but &lt;code&gt;f2&lt;/code&gt; is not. To work arround that you need either more data, because the more periods are in the data the smaller will be the estimation error. And you should use a windowing function, to get rid of some side effects by cutting the signal at the beginnig and the end.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The improved code could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear&#xA;doWindow = true;&#xA;scaleFreq = 1;&#xA;%% Creating the data&#xA;&#xA;g=2.5;&#xA;t=linspace(0,g,g*365*24*60);              %n-years of 1min data&#xA;o=rand(size(t));                         %random noise&#xA;%we create two sinusoids  &#xA;p1=2*sin(2*pi*t*scaleFreq);&#xA;p2=1.5*cos(1*pi*t*scaleFreq);&#xA;p=p1+p2;&#xA;x=p+o;                                     %and add noise to them&#xA;&#xA;%% The method&#xA;&#xA;N=length(x);            %no of data&#xA;n=(1:N);&#xA;T=g*365*24*60;          %time that the data covers&#xA;f1=scaleFreq*1/(365*24*60);       %frequency of 1 yr oscillations&#xA;f2=scaleFreq*1/((365*24*60))/2;   %frequency of 1/2 year oscillations&#xA;&#xA;a1=f1*T;                &#xA;a2=f2*T;&#xA;&#xA;if(doWindow)&#xA;    window = hanning(numel(x)).';&#xA;else&#xA;    window = ones(size(x));&#xA;end&#xA;xWin = x.*window;%windowing&#xA;xMean = mean(xWin);%calculate dc&#xA;xWin = xWin-xMean;%subtract dc&#xA;&#xA;buildFunkCos1 = cos((2*pi*a1*n)/N);&#xA;buildFunkCos2 = cos((2*pi*a2*n)/N);&#xA;buildFunkSin1 = sin((2*pi*a1*n)/N);&#xA;buildFunkSin2 = sin((2*pi*a2*n)/N);&#xA;&#xA;A1=(1/N)*sum(xWin.*buildFunkCos1)&#xA;A2=(1/N)*sum(xWin.*buildFunkCos2)&#xA;B1=(1/N)*sum(xWin.*buildFunkSin1)&#xA;B2=(1/N)*sum(xWin.*buildFunkSin2)&#xA;&#xA;if(doWindow)%do correction due to windowing&#xA;    A1 = 2*A1;&#xA;    A2 = 2*A2;&#xA;    B1 = 2*B1;&#xA;    B2 = 2*B2;&#xA;end&#xA;&#xA;C1=2*sqrt(A1^2+B1^2)%amplitude &#xA;C2=2*sqrt(A2^2+B2^2)&#xA;&#xA;fi1=atan(B1/A1)%phase shift&#xA;if(A1&amp;lt;0)&#xA;    fi1 = fi1 + pi;&#xA;end&#xA;fi2=atan(B2/A2)&#xA;if(A2&amp;lt;0)&#xA;    fi2 = fi2 + pi;&#xA;end&#xA;&#xA;%the reconstructed set of data for these two frequencies&#xA;v1=C1*cos(2*pi*t*scaleFreq-fi1);&#xA;v2=(C2*cos(1*pi*t*scaleFreq-fi2));&#xA;v=v1+v2+xMean;%sum estimates (freq 1,freq 2, dc)&#xA;r=x-v;    %I wasn't sure what was meant by removing, so i just subtracted&#xA;&#xA;%% Visualization&#xA;figure(1)                                  %now lets plot the data&#xA;plot(t,[p1;p2;p]);&#xA;legend('p1','p2','p');&#xA;title('single sine signals and sum');&#xA;&#xA;figure(2)                           %and, original signal and noise separately&#xA;hold off&#xA;plot(t,[v1;v2;v]);&#xA;legend('v1','v2','v');&#xA;title('estimated sine signals and sum');&#xA;&#xA;figure(3)                    %and once again data (blue), reconstructed signal &#xA;hold off&#xA;plot(t,x,'b-')            %(green), and the final result afer subtraction&#xA;hold on                   %(red)&#xA;plot(t,v1+v2,'g--')&#xA;plot(t,r,'r:')&#xA;xlabel('t[min]')&#xA;ylabel('w/e')&#xA;legend('measured','reconstructed','result');&#xA;&#xA;figure(4)&#xA;hold off&#xA;plot(t,[buildFunkCos1;buildFunkCos2;buildFunkSin1;buildFunkSin2]),&#xA;legend('buildFunkCos1','buildFunkCos2','buildFunkSin1','buildFunkSin2');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here you can switch the windowing and also test what happens if more periods are in the signal. Try, &lt;code&gt;scaleFrequ=10&lt;/code&gt; und &lt;code&gt;doWindow=true&lt;/code&gt; and the result should be what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="4932" LastEditorUserId="4932" LastEditDate="2013-07-02T19:59:03.903" LastActivityDate="2013-07-02T19:59:03.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9775" PostTypeId="2" ParentId="9773" CreationDate="2013-06-30T10:17:09.537" Score="1" Body="&lt;p&gt;A strong LOS component, i.e. a high Rician factor, will always improve receiver performance. If $K$ denotes the Rician factor, i.e. the ratio between the power of the LOS component and the power of the other (scattered) components, then for $K\rightarrow\infty$ you have no multipath propagation at all and you get a simple AWGN channel. For $K=0$ you have a Rayleigh fading channel (with no LOS component).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-30T10:17:09.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9776" PostTypeId="2" ParentId="9752" CreationDate="2013-06-30T14:46:19.463" Score="3" Body="&lt;p&gt;There's a problem with your method of computing powers. If you compute the signal power as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s=\sum_{i=1}^ns_i^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the quantities&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left(\sum_{i=1}^ns_i\cos(2\pi if_m/f_s)\right)^2\text{ and }&#xA;\left(\sum_{i=1}^ns_i\sin(2\pi if_m/f_s)\right)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cannot be related to $P_s$ in any way that would be meaningful for your problem of detecting the presence of the QPSK signal (even though in your program you compute the magnitudes instead of the squares shown in your question).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I think you were trying to do is demodulate the QPSK signal and measure the power of the demodulated signal. However, there are two problems in the way you did it. First, you must compute the power by taking the sum of squared values, and not by squaring the sum. And second, it is necessary to lowpass filter the signals after multiplication by sine and cosine, because the multiplication by sine and cosine does not only shift the spectrum down to DC but also up to twice the modulation frequency, and you need to get rid of that latter part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've said so far is only the explanation of what I think you were trying to do and why it didn't work. A much simpler way of achieving the same would be to apply a bandpass filter with center frequency $f_m$ to the signal, measure the power of the output, and relate it to the total signal power $P_s$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-06-30T14:46:19.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9777" PostTypeId="1" CreationDate="2013-06-30T15:56:53.030" Score="0" ViewCount="574" Body="&lt;p&gt;I am currently working on an audio watermarking project in MATLAB. I currently have a code I am using to construct a nxn 3 Band Wavelet Transform matrix. However, when I try to construct a matrix that is larger in size, I get the error &quot;Maximum variable size allowed by the program is exceeded&quot; or &quot;Out of Memory.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I was wondering if someone would be able to tell me what may be the cause of this problem and if there is an exisiting code or toolbox that could construct a 3 Band Wavelet Transform Matrix better and more efficiently. Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is the code I am trying to use. I am trying to create a matrix that is the size 3^9 X 3^9 and 3^10 X 3^10.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;prompt = {'Enter Matrix Power: '};&#xA;dlg_title = 'Matrix Power';&#xA;answer = inputdlg(prompt,dlg_title);&#xA;n = str2num(answer{1});  %#ok&amp;lt;ST2NM&amp;gt;&#xA;&#xA;A=zeros(3^(n-1),3^n);&#xA;v=[0.338386097283860 0.530836187013740 0.723286276743610 0.238964171905760 0.0465140821758900 -0.145936007553990 ];&#xA;w1=[-0.117377016134830 0.54433105395181 -0.0187057473531300 -0.699119564792890 -0.136082763487960 0.426954037816980 ];&#xA;w2=[0.403636868928920 -0.628539361054710 0.460604752521310 -0.403636868928920 -0.0785674201318500 0.246502028665230 ];&#xA;for j=1:3^(n-1)-1 &#xA;    for k=1:3^n;&#xA;        if k&amp;gt;6+3*(j-1) || k&amp;lt;=3*(j-1)&#xA;            A(j,k)=0;&#xA;        else &#xA;            A(j,k)=v(k-3*(j-1));&#xA;        end                &#xA;    end&#xA;end&#xA;j=3^(n-1);&#xA;    for k=1:3^n&#xA;        if k&amp;lt;=3&#xA;            A(j,k)=v(k+3);&#xA;        elseif k&amp;lt;=3^n-3&#xA;            A(j,k)=0;&#xA;        else &#xA;            A(j,k)=v(k-3*(j-1));&#xA;        end&#xA;    end&#xA;&#xA;B=zeros(3^(n-1),3^n);&#xA;for j=1:3^(n-1)-1&#xA;    for k=1:3^n&#xA;        if k&amp;gt;6+3*(j-1) || k&amp;lt;=3*(j-1)&#xA;            B(j,k)=0;&#xA;        else&#xA;            B(j,k)=w1(k-3*(j-1));&#xA;        end&#xA;    end&#xA;end&#xA;j=3^(n-1);&#xA;    for k=1:3^n&#xA;        if k&amp;lt;=3&#xA;            B(j,k)=w1(k+3);&#xA;        elseif k&amp;lt;=3^n-3&#xA;            B(j,k)=0;&#xA;        else&#xA;            B(j,k)=w1(k-3*(j-1));&#xA;        end&#xA;    end&#xA;C=zeros(3^(n-1),3^n);&#xA;for j=1:3^(n-1)-1&#xA;    for k=1:3^n&#xA;        if k&amp;gt;6+3*(j-1) || k&amp;lt;=3*(j-1)&#xA;            C(j,k)=0;&#xA;        else&#xA;            C(j,k)=w2(k-3*(j-1));&#xA;        end&#xA;    end&#xA;end&#xA;j=3^(n-1);&#xA;     for k=1:3^n&#xA;         if k&amp;lt;=3&#xA;             C(j,k)=w2(k+3);&#xA;         elseif k&amp;lt;=3^n-3&#xA;             C(j,k)=0;&#xA;         else&#xA;             C(j,k)=w2(k-3*(j-1));&#xA;         end&#xA;     end&#xA;W=[A;B;C];&#xA;Q=zeros(3^n,3^n);&#xA;T=zeros(3^n,3^n);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4937" LastEditorUserId="4937" LastEditDate="2013-06-30T20:51:14.913" LastActivityDate="2013-06-30T20:51:14.913" Title="3 Band Wavelet Transform In MATLAB" Tags="|matlab|audio|wavelet|transform|matrix|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9778" PostTypeId="2" ParentId="9705" CreationDate="2013-06-30T19:55:32.850" Score="0" Body="&lt;p&gt;This seems to me like a perfect application of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hilbert%E2%80%93Huang_transform&quot; rel=&quot;nofollow&quot;&gt;empirical mode decomposition&lt;/a&gt; (a.k.a Hilbert-Huang transform). &lt;a href=&quot;http://www.mql5.com/en/articles/439&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; you can find some short but good introduction. &lt;a href=&quot;http://ir.uiowa.edu/cgi/viewcontent.cgi?article=2751&amp;amp;context=etd&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; you can find a dissertation on it. &lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2013-06-30T19:55:32.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9779" PostTypeId="2" ParentId="9769" CreationDate="2013-07-01T13:48:58.360" Score="1" Body="&lt;p&gt;Judging from the recordings, the SNR is very bad and the noise characteristics are difficult to handle, because the noise is non-stationary. If you have only one microphone signal and nothing else, then the only useful method I can think of is some variant of &lt;a href=&quot;http://dsp-book.narod.ru/304.pdf&quot; rel=&quot;nofollow&quot;&gt;spectral subtraction&lt;/a&gt;. Also have a look at the references in the linked document (above all Ephraim, Malah 1984). One crucial element of the final algorithm will be the noise tracking method which must be able to track the non-stationary noise. It will depend on the application (speech perception by humans, automatic speech recognition, etc.), but your goal should probably not be to remove all the noise, because this will lead to severe distortions of the speech signal. You should rather try to improve the SNR and leave some residual noise in order to increase intelligibility or improve recognition performance.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-07-01T13:48:58.360" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9780" PostTypeId="1" CreationDate="2013-07-01T15:00:16.227" Score="4" ViewCount="3776" Body="&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;br&gt;&#xA;I've been attempting to resample a GPS signal in MATLAB. I've built a few FIR filters using &lt;code&gt;fvatool&lt;/code&gt; and from handmade transfer functions (punched out with a HP-35s). Most are kaiser-windowed LPFs, but some are least-squared LPFs. All of the filters I've built have nominal responses that should adequately filter the aliasing out of the interpolations. I've also built a FFT-Resampling tool that resamples well and very quickly. However, I've hit a strange anomoly, at least as I see it. A simple 'nearest' neighbor interpolation using &lt;code&gt;interp1&lt;/code&gt; seems to &lt;strong&gt;much&lt;/strong&gt; more accurately resample my signal than any FFT-Resampling I have done, or any upsample, filter, decimate tool I've used, to include &lt;code&gt;dsp.FIRRateConverter&lt;/code&gt;, &lt;code&gt;resample&lt;/code&gt;,&lt;code&gt;upfirdn&lt;/code&gt;, and even straight &lt;code&gt;upsample&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt;,&lt;code&gt;decimate&lt;/code&gt;. Why is this? Can anyone explain why this occurs? My theory is that when the rational integers of your sampling ratio are &lt;em&gt;very&lt;/em&gt; close to one, straight interpolation will provide more accurate results because you reduce occilations and/or other noise distortion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;br&gt;&#xA;My signal is a standard collected GPS signal, pulled from the air, sampled at 25e6 sps and saved in a binary file using signed 16-bit integers. When pulled into MATLAB (has to be done in chunks due to size) the signal is a complex row vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm upsampling to 26.25e6 sps, therefore my rational integers &lt;em&gt;p&lt;/em&gt; and &lt;em&gt;q&lt;/em&gt; are 21 and 20, respectively. To use &lt;code&gt;interp1&lt;/code&gt; I simply build two time vectors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; t0 = (0:1:numSamples - 1)*1/sampleRate;&#xA; t1 = (0:1:numResamples - 1)*1/resampleRate;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;where&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; sampleRate= 25e6;&#xA; resampleRate = 26.25e6;&#xA; samplingRatio = resampleRate/sampleRate;&#xA; numSamples = length(s0) % length of my original signal, sampled at 25e6 samples&#xA; numResamples = length(s0)*samplingRatio % length of my sampled signal; should equal length(s1)&#xA; s1 = interp1(t0,s0,t1,'nearest','extrap');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When using a FIR filter, I have used many methods. But the simpliest is to call &lt;code&gt;resample&lt;/code&gt; like this (resample is a least squares FIR filter with a kaiser window called through &lt;code&gt;firls&lt;/code&gt; that gets pushed through &lt;code&gt;upfirdn&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; s1 = resample(s0,p,q);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;where&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; [p,q] = rat(resampleRate/sampleRate,1e-12);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4483" LastEditorUserId="80" LastEditDate="2013-08-28T13:37:31.060" LastActivityDate="2013-08-28T13:37:31.060" Title="Is interpolation (interp1) better than FIR filtering when rational integers are close to 1?" Tags="|matlab|interpolation|resampling|filtering|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="9781" PostTypeId="1" AcceptedAnswerId="9788" CreationDate="2013-07-01T15:38:01.863" Score="1" ViewCount="2009" Body="&lt;p&gt;I'm trying to demodulate a QPSK communication.&#xA;For the moment I do:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Signal detection by computing the ratio between the power of the carrier wave compared to the signal power.&lt;/li&gt;&#xA;  &lt;li&gt;Initial clock synchronization with a preamble.&lt;/li&gt;&#xA;  &lt;li&gt;Initial phase recovery with the same preamble.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This works great with my signal but now I want to go further and take into consideration a clock frequency offset betweem the TX Clock and the RX Clock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made some research and a good way to do it seem to be Gardner Timing Error Detector which should be able to compensate for my clock offset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement it I do:&#xA;$$\epsilon_k = Real[(signal(t_k)-signal(t_{k-1}))*conj(signal(t_{k-1/2})]$$&#xA;$$t_k = t_{k-1}+T+\gamma*\epsilon_k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I don't know how to chose the proportional parameter.&#xA;$$\gamma$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've sometime seen it with something called the normalized narrowband noise &lt;code&gt;BlT&lt;/code&gt; but I have no idea what it is. If you could point me in the right direction any help would be very appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2013-07-02T00:45:16.533" Title="Practical Gardner timing error implementation" Tags="|matlab|algorithms|demodulation|qpsk|timing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9782" PostTypeId="1" CreationDate="2013-07-01T16:06:13.417" Score="2" ViewCount="1132" Body="&lt;p&gt;I've been driving myself absolutely crazy trying to do autocorrelation analysis on some data that I've got.  I've read from multiple sources that the ACF of a random telegraph signal / random telegraph noise is given by an exponentially decaying function where the decay constant is the average rate of switching between states (cf. Example 7.3.2 &lt;a href=&quot;http://www.cis.rit.edu/class/simg713/notes/chap7-random-process.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for example).  Since I had trouble getting anything that even resembled exponential decay with real data, I decided to generate a fake signal that telegraphs between the value 0 and 1 with lifetimes centered binomially around two characteristic values for the 0 and 1 state.  The autocorrelation function for this signal is still not at all exponential.  In each case, the ACF ends up strongly oscillating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working in Mathematica, using CorrelationFunction to get the autocorrelation function.  Based on my reading, this is a standard definition for autocorrelation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is can someone show me an example with a numerically obtained ACF from a random telegraph signal that decays exponentially?  Am I missing something stupid here?  Am I using an incorrect definition for the autocorrelation function?&lt;/p&gt;&#xA;" OwnerUserId="4929" LastActivityDate="2013-07-02T12:30:18.363" Title="Evaluating the autocorrelation function of a telegraph signal to get exponential decay?" Tags="|autocorrelation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9783" PostTypeId="1" AcceptedAnswerId="9785" CreationDate="2013-07-01T16:09:06.923" Score="1" ViewCount="209" Body="&lt;p&gt;I am looking for ANY advice anyone can give me regarding on this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to start a project on subtitles, basically, if we take a Youtube video of a breaking news story, subtitles are generated automatically without the need of physically inputting what the speaker is saying. Now, I understand the complexity of this problem, and, I am aware of the amount of training samples I would need in order to carry out such a project. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is this: I have had experience in using DTW and HMM in order to train and recognise simple words &quot;Yes&quot;, &quot;No&quot; and gained a lot of experience from this and as part of my previous findings I found that the DTW algorithm is slow and therefore would not be efficient for this. For this project, I imagine real-time processing is involved. Would it therefore be a wise thing to implement a Hidden Markov Model for such a problem, or, would another model/algorithm be more suitable? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my basic structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will upload a 3 minute video to youtube, I will then extract the raw audio from this video and then extract the features (MFCC) which will then be used in order to train the model (HMM) which will /hopefully/ identify the spoken word. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone recommend any papers that could potentially help me with tackling such a problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for taking time to read this. If anything is not understood, please let me know. &lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2013-07-01T18:52:26.077" Title="Speech Recognition - Subtitles" Tags="|speech|hmm|project-ideas|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9784" PostTypeId="1" CreationDate="2013-07-01T17:44:54.767" Score="0" ViewCount="965" Body="&lt;p&gt;I'm trying to filter some motion noise from an ECG signal. To do that I'll try to implement an adaptive filter using the LMS algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I have to calculate the MSE of this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;E[e^2 ] = E[(s + n )^2 ]+ 2E[(s + n)X ]W^T + WE[X^T X ]W^T&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in which &lt;code&gt;s+n&lt;/code&gt; is the noised &lt;code&gt;ECG&lt;/code&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;X (n) = [ 1, Accx (n), Accy (n), Accz (n)]&lt;/code&gt; are the values from the accelerometer,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;W = [w0, w1, w2, w3]&lt;/code&gt; the coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Wt +1 = Wt + 2αeX&lt;/code&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to understand how to calculate &lt;code&gt;alfa&lt;/code&gt; and minimise the MSE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/adaptfilt.lms.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/dsp/ref/adaptfilt.lms.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can anyone give me a simpler example? I'm kind of lost here.&lt;/p&gt;&#xA;" OwnerUserId="4940" LastActivityDate="2013-07-02T02:06:49.263" Title="MSE in adaptative filter" Tags="|matlab|filters|adaptive-filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9785" PostTypeId="2" ParentId="9783" CreationDate="2013-07-01T18:16:26.223" Score="5" Body="&lt;p&gt;The amount of knowledge necessary to develop such a large scale multi-language, speaker-independent, large-vocabulary speech recognition system is spread well over hundreds of papers; and each individual brick of the system (say the feature extraction front-end, the FST decoding library, the language model store) is developed by world-class expert in this specific field. Some of Google's research scientists have published papers on these topics, this might be a good place to start if you want to understand what's behind the scenes... But maybe  you should start with a smaller goal - like building a system that has a vocabulary of a dozen different words from the same speaker - using a library like HTK or Sphinx (using the &quot;canonical&quot; approach with the hierarchy GMM-&gt;phone-&gt;word-&gt;language model), and once you have all the basics right, explore deeper in one direction (try more complex feature extraction methods to handle noise, grow the vocabulary and the complexity of the grammar, try speaker adaptation).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-07-01T18:52:26.077" LastActivityDate="2013-07-01T18:52:26.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9787" PostTypeId="1" CreationDate="2013-07-01T23:16:42.243" Score="3" ViewCount="351" Body="&lt;p&gt;&lt;br&gt;&#xA;I'm going to have to give a bit of context for this question to make sense.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on a project which includes audio source localisation in 3-D space through TDoA (&lt;i&gt;Time Difference of Arrival&lt;/i&gt; - from here called $\tau_{ij}$, between sensor $i$ and $j$) measurements. In other words I have $m$ sensors that each have a slightly different recording of the audio event. Via cross-correlation methods I can estimate the TDoA (or delay) between each pair of sensors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With each pair of sensors, $i$ and $j$, we can point to the source position through the following optimization problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\delta_{ij} = v \tau_{ij}$$&#xA;$$h(P_{E},P_{i},P_{j}) = \|P_i - P_E\|_2 - \|P_j - P_E\|_2$$&#xA;$$P_E^* = {arg\,min}_{P_E}\sum\limits_{i \neq j}\left(\delta_{ij}-h(P_{E},P_{i},P_{j})\right)^2$$&#xA;where $v$ is the speed of sound in the selected medium (consider it ideally constant), $P_E^* = (x_E,y_E,z_E)$ is the source position estimate (after optimization), while $P_i = (x_i,y_i,z_i)$ and $P_j = (x_j,y_j,z_j)$ are the sensor positions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the first two equations. The first one is the distance between the two sensors, calculated from the TDoA estimate. The second one is a hyperbolic surface (see image below, in a 2-D example) that also represents the distance between the sensors. One way to see this is noting (suppose perfect measurements):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\|P_i - P_E\|_2 - \|P_j - P_E\| = v \tau_{iE} - v \tau_{jE} = v (\tau_{iE} - \tau_{jE}) = \delta_{ij}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, each pair of sensors generate a different hyperbolic surface. We then try find the position by minimizing the function (third equation), by varying $P_E$. For sure there will always be a $P_E$ where $\delta_{ij} = h(P_E,P_i,P_j)$, but it won't necessarily nullify the same equation for different $i$ and $j$. Therefore optimization is necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vQJVT.png&quot; alt=&quot;hyperbolic&quot;&gt;&lt;br&gt;&#xA;In a simpler 2-D example, the hyperbolic curves above represent points where the TDoA between two sensors is constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, my question is:&#xA;What is the best geometric arrangement of the $m$ sensors in 3-D space, so that measurements are as precise as possible? For example, a line of sensors is  probably not a good idea as the the hyperbolic curves will be parallel to each other.&lt;/p&gt;&#xA;" OwnerUserId="3831" LastEditorUserId="128" LastEditDate="2019-01-24T12:41:55.023" LastActivityDate="2019-01-24T12:41:55.023" Title="Ideal Geometric Arrangement of Microphone Array" Tags="|optimization|geometry|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="9788" PostTypeId="2" ParentId="9781" CreationDate="2013-07-02T00:45:16.533" Score="3" Body="&lt;p&gt;If you have access to Mengali's book 'Synchronization Techniques for Digital Receivers', you will find the details how to choose it for a tracking loop, be it for frequency, phase or timing. Otherwise, just read about a standard discrete-time phase locked loop and see how the choice of paramters affect the loop bandwidth, which is what you are after.&lt;/p&gt;&#xA;" OwnerUserId="4943" LastActivityDate="2013-07-02T00:45:16.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9789" PostTypeId="1" CreationDate="2013-07-02T01:19:10.543" Score="1" ViewCount="652" Body="&lt;p&gt;Just starting research in audio watermarking and have read many papers regarding audio watermarking but I am still a little confused on what exactly gets embedded into the signal. For example, one paper I read embedded an image or written signature into the audio. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what typically gets embedded in the signal using audio watermarking? Is it just random data, a picture, someone's name? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4937" LastEditorUserId="4937" LastEditDate="2013-07-02T03:31:59.123" LastActivityDate="2013-07-02T07:19:41.843" Title="Audio Watermarking - What is typically embedded?" Tags="|matlab|audio|wavelet|wave|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9790" PostTypeId="2" ParentId="9784" CreationDate="2013-07-02T02:06:49.263" Score="1" Body="&lt;p&gt;This &lt;a href=&quot;http://www.scilab.org/&quot; rel=&quot;nofollow&quot;&gt;scilab&lt;/a&gt; script implements a simple LMS adaptive filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = 50;&#xA;LMS = zeros(M,N);&#xA;LMS(:,1) = zeros(M,1);&#xA;ERR = zeros(1,N);&#xA;y = zeros(1,N);&#xA;mu = 0.0005;&#xA;&#xA;for t=M:N,&#xA;    Uwindowed = u(t - [0:M-1]');&#xA;    y(t) = LMS(:,t)'*Uwindowed.';&#xA;    ERR(t) = d(t) - y(t);&#xA;    LMS(:,t+1) = LMS(:,t) + mu*Uwindowed.'*ERR(t);&#xA;end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The inputs to it are &lt;code&gt;u(t)&lt;/code&gt;, the noisy signal and &lt;code&gt;d(t)&lt;/code&gt; the desired signal.  For the standard LMS algorithm to work, you need to have an idea of what the noiseless signal looks like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your equations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\alpha$ appears to be similar to &lt;code&gt;mu&lt;/code&gt; (or &lt;code&gt;mu/2&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;u&lt;/code&gt; is your &lt;code&gt;s+n&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I am not sure what your &lt;code&gt;d&lt;/code&gt; is.&lt;/li&gt;&#xA;&lt;li&gt;Your equation for the error is, er, erroneous. :-)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-07-02T02:06:49.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9792" PostTypeId="1" CreationDate="2013-07-02T04:54:01.373" Score="0" ViewCount="3791" Body="&lt;p&gt;I have 2 audio .wav files recorded by the the same person with the same word. Each audio file has a format of 16bit, 44.1kHz and is a mono channel. I would like to know how to compare these 2 audio files if it is by the same person. What I know is to process the files to produce a floating point result of values between -1 and 1 and apply fft on it and compare the frequency. What I would like to know is how to compare the audio files, prefably with the code which shows the comparison and if possible the steps before that(processing to become values btw 1 and -1).Thanks. Im relatively new in this area so I would appreciate If u guys would help me out. I'm currently using a metro application in vs. I would prefer not to use any library like naudio or bass.net but I would still accept any answer.&#xA;A step by step solution starting from utilizing the .wav file is much appreciated. I have been trying to search topics related to what I'm doing but what I have found are small parts of it.&lt;/p&gt;&#xA;" OwnerUserId="4946" LastActivityDate="2013-07-02T11:17:10.347" Title="comparing 2 audio files in c#" Tags="|fft|audio|c#|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9793" PostTypeId="2" ParentId="9789" CreationDate="2013-07-02T07:19:41.843" Score="1" Body="&lt;p&gt;Research papers or textbooks won't delve into the specifics - they just assume you have a stream of binary data that needs to be reliably and undetectably embedded into the audio file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this bitstream is actually going to be is application dependent. It could be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Digital rights management applications&lt;/strong&gt;: A short serial number identifying the individual transaction in which the audio file has been sold. Given the small size (a hundred bits) of this information, it is typically repeated over and over the file to maximize the probability of recovering it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Metadata management&lt;/strong&gt;: Metadata such as artist name, song title, or even lyrics.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Proper steganography&lt;/strong&gt;: Any secret data you want to share with the recipient of the audio file - without an eavesdroppers suspecting that you are exchanging anything other than music. This can be a text-file, an image - any binary data.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Informed source separation&lt;/strong&gt;: Any information about the individual sources the audio file is made of, that would subsequently help in recovering these individual sources.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Second-screen interactive TV applications&lt;/strong&gt;: These application allow a device such as a smartphone or a toy to display secondary information synchronized with a TV show. To allow the synchronization, the audio signal of the show contains a regular watermark containing a show identifier and time stamp.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-07-02T07:19:41.843" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9794" PostTypeId="2" ParentId="9763" CreationDate="2013-07-02T07:41:43.620" Score="1" Body="&lt;p&gt;Assume two discrete-time sequences: $x$ (length $L_\mathrm{x}$) and $y$ (length $L_\mathrm{y}$). Furthermore, $L_\mathrm{x} \geq L_\mathrm{y}$. To calculate the discrete-time (linear) convolution of $x$ and $y$, first pad $y$ with $L_\mathrm{x} - L_\mathrm{y}$ zeros, i.e.&#xA;$$&#xA;y'(n) =&#xA;  \begin{cases}&#xA;    y &amp;amp; 0 \leq n &amp;lt; L_\mathrm{y}\\&#xA;    0 &amp;amp; L_\mathrm{y} &amp;lt; n \leq L_\mathrm{x} - 1&#xA;  \end{cases}&#xA;$$&#xA;Then calculate the convolution of $y'$ and $x$ as described &lt;a href=&quot;https://en.wikipedia.org/wiki/Convolution#Discrete_convolution&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, for example.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-07-02T07:41:43.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9795" PostTypeId="2" ParentId="1340" CreationDate="2013-07-02T09:56:32.700" Score="0" Body="&lt;p&gt;You are clearly trying to implement DFT filter bank using polyphase structure. The filters in the diagram in analysis branch are Pk(z). U can choose whichever alphabet to represent filters. Hk(z) ie hk(n) are polyphase components of a low pass filter h(n) ie H(z). Polyphase components mean, for M=4 h0(n) will have samples [0 4 8 ...] h1(n) will have samples [1 5 9 ...] h2(n) will have samples [2 6 10...] &amp;amp; h3(n) will have samples [3 7 11...]. If u check the frequency response of each hk(n) u will get low pass response but expanded in frequency by 4 times.(Decimation in time equals expansion in frequency). All 4 responses will be similar as u are taking adjacent samples of LPF. For polyphase decompostion, the formula is hk(n)=h(nM+k) for k = 0 to M-1. Thus ur above formula represents not polyphase decomposition of low pass filter but direct implementation of DFT filterbank where each individual filters of the analysis bank are shifted versions(and not decimated versions) of low pass filter. But the diagram in ur question is of polyphase structure so that formula in ur question is not used there&lt;/p&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2013-07-02T09:56:32.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9796" PostTypeId="2" ParentId="9671" CreationDate="2013-07-02T10:52:50.413" Score="0" Body="&lt;p&gt;You can use a &lt;a href=&quot;http://www.dspguide.com/ch19.htm&quot; rel=&quot;nofollow&quot;&gt;notch filter&lt;/a&gt; implemented as a recursive filter. Computationally this is far more efficient than two Fourier transforms.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2013-07-02T10:52:50.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9797" PostTypeId="1" AcceptedAnswerId="9820" CreationDate="2013-07-02T11:15:22.980" Score="3" ViewCount="5695" Body="&lt;p&gt;How get cross-correlation peak and based on it calculate correlation score for similarity of two audio samples. SO far I've &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;FFT two samples &lt;/li&gt;&#xA;&lt;li&gt;complex conjugate second&lt;/li&gt;&#xA;&lt;li&gt;multiply results&lt;/li&gt;&#xA;&lt;li&gt;IFFT&lt;/li&gt;&#xA;&lt;li&gt;cross-correlate with itself(autocorrelate)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks for any advice&lt;/p&gt;&#xA;" OwnerUserId="4947" LastEditorUserId="4298" LastEditDate="2013-07-02T22:31:24.847" LastActivityDate="2013-07-07T17:13:29.423" Title="Cross-correlation peak" Tags="|fft|cross-correlation|autocorrelation|waveform-similarity|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9798" PostTypeId="2" ParentId="9792" CreationDate="2013-07-02T11:17:10.347" Score="-3" Body="&lt;p&gt;I'm thinking the signals could be compared by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$D = \mathcal{F}^{-1}(\mathcal{F}(A) - \mathcal{F}(B))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where A and B are the two audio files to be compared. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess after that you could come up with some criteria for deciding that the voices are different. Perhaps when $|D|$ goes over some threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also use &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;Cross correlation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using some other library to help with this would save time. But I haven't done this with audio files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://code.google.com/p/aforge/&quot; rel=&quot;nofollow&quot;&gt;AForge&lt;/a&gt; Looks like it has FFT although I haven't used it.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2013-07-02T11:17:10.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9799" PostTypeId="2" ParentId="9782" CreationDate="2013-07-02T12:30:18.363" Score="2" Body="&lt;p&gt;A &lt;em&gt;semi-random&lt;/em&gt; telegraph signal is one for which $X(0) = 0$ and $X(t)$ equals $0$ or $1$&#xA;according as there have been an &lt;em&gt;even&lt;/em&gt; number or an &lt;em&gt;odd&lt;/em&gt; number of arrivals in a Poisson Process in the interval $(0,T]$.  A simple physical model would be the least significant&#xA;bit (LSB) of a digital counter that is counting the Poisson arrivals.  A &lt;em&gt;random&lt;/em&gt; telegraph signal is almost the same except that $X(0)$ is equally likely to have value $0$ or $1$.&#xA;(Feel free to translate this to signals having values $\pm 1$ if that is more convenient&#xA;or more in accordance with your notation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this as background, you are encountering problems because your simulation is&#xA;not modeling the random telegraph signal correctly. You should instead simulate a &#xA;Poisson process and obtain the random telegraph signal from that.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-07-02T12:30:18.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9800" PostTypeId="2" ParentId="9787" CreationDate="2013-07-02T15:01:16.327" Score="1" Body="&lt;p&gt;This will somewhat depend on the spectrum and properties of the signals and what your dominant source of noise, distortion, jitter, non-linearietes etc. are. Ideally you can resolve every point in space with 3 non-coplanar microphones. A very simple solution is one with 4 microphones: one in the origin and three one unit step displaced in x, y, and z dimension. The arrival difference between X and origin pair gives you the x-coordinate, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can improve this method by a simple least square approach that takes into account all microphone pairings (6 total). The fit error is metric of how much noise you have in the system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Microphone spacing depends on spectral content of the signals you are tracking. If it's fairly narrow band you probably want them to be about half a wavelength apart so you maximize the phase difference between adjacent signals.&#xA;A good robustness metric is something like dx/dt, i.e. you wiggle the arrival time a little and see how much the calculated position moves. For almost coplanar microphones that is a large number which indicates that this setup is very sensitive to noise.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-07-02T15:01:16.327" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9802" PostTypeId="1" CreationDate="2013-07-02T22:03:25.043" Score="1" ViewCount="917" Body="&lt;p&gt;I have to find a convolution of two signals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h[n] = 0.5^nu[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n] = u[n]-u[n-3]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the final sum, which is correct is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{m=n-2}^n 0.5^mu[m] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that i replaced n-k with m, that is&#xA;$ m = n-k $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in regards to parameter n, i have to decypher the formula.&#xA;The result is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$0, n&amp;lt;0$$&#xA;$$2(1-0.5^n*0.5), 0\le n \lt 2$$&#xA;$$1.75*0.5^n/0.5^2, n \ge 2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, i don't know how to get those results.&#xA;Can you please explain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results are correct (maybe i just typed something wrong, if that's the case i'm sorry in advance)&lt;/p&gt;&#xA;" OwnerUserId="4955" LastActivityDate="2013-08-01T22:49:03.120" Title="Calculating sum of a discrete signal" Tags="|discrete-signals|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9803" PostTypeId="2" ParentId="9802" CreationDate="2013-07-02T22:28:23.037" Score="2" Body="&lt;p&gt;One way to see it is to realize that $x[n]$ can be rewritten as the sum of 3 impulses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\delta[n]+\delta[n-1]+\delta[n-2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $h[n]*\delta[n-k]=h[n-k]$ for arbitrary integer $k$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]*x[n]=h[n]+h[n-1]+h[n-2]=0.5^nu[n]+0.5^{n-1}u[n-1]+0.5^{n-2}u[n-2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluating this expression yields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{lr}0&amp;amp;\quad n&amp;lt;0\\&#xA;0.5^0=1&amp;amp;\quad n=0\\&#xA;0.5^1+0.5^0=1.5&amp;amp;\quad n=1\\&#xA;0.5^n+0.5^{n-1}+0.5^{n-2}= &amp;amp;\\&#xA;=0.5^{n-2}(0.5^2+0.5+1)=&amp;amp;\\&#xA;=1.75\cdot0.5^{n-2}&amp;amp;n\ge 2&#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is equivalent to the result you've given.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-07-02T22:28:23.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9804" PostTypeId="1" CreationDate="2013-07-03T00:23:03.153" Score="-1" ViewCount="210" Body="&lt;p&gt;I currently have a 16bit mono file. I would like to read this data to retrieve only the data chunk part and not the entire file with the headers so that I can apply fft on it. I tried finding solutions to read only the data chunk but the codes I managed to find were either not complete / seems to have errors. I am doing this in c#. &lt;/p&gt;&#xA;" OwnerUserId="4873" LastActivityDate="2013-07-03T12:25:03.993" Title="processing 16bit audio files" Tags="|fft|audio|c#|" AnswerCount="2" CommentCount="2" ClosedDate="2013-07-03T12:27:38.750" ContentLicense="CC BY-SA 3.0" />
  <row Id="9805" PostTypeId="1" AcceptedAnswerId="9806" CreationDate="2013-07-03T03:55:49.360" Score="0" ViewCount="1325" Body="&lt;p&gt;I am using &lt;code&gt;wavread&lt;/code&gt; in MATLAB, which outputs the data in a .wav file in double precision. I am wondering how this relates to binary, such as 0's and 1's. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4937" LastEditorUserId="4682" LastEditDate="2013-07-04T17:06:46.353" LastActivityDate="2013-07-26T12:24:45.893" Title="How is binary data related to double precision data?" Tags="|matlab|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9806" PostTypeId="2" ParentId="9805" CreationDate="2013-07-03T04:38:59.020" Score="7" Body="&lt;p&gt;I don't know much about Matlab's wavread, but double precision is a standard for describing a &amp;quot;floating point&amp;quot; value. That is, a value that always has the same number of (binary) digits of precision.&lt;/p&gt;&#xA;&lt;p&gt;A double precision floating point number in binary looks like this: &lt;img src=&quot;https://i.stack.imgur.com/CehvE.png&quot; alt=&quot;Floating point diagram from wikipedia&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Each of those boxes represents a bit (short for &amp;quot;binary digit&amp;quot;, or a 1 or a 0). It works like scientific notation: the exponent and fraction are both base-2 representations of numbers, and the number this represents is (with some exceptions for things like 0 and NaN) &lt;span class=&quot;math-container&quot;&gt;$$(-1)^{\text{sign}}\times 2^{\text{exponent - exponent bias}} \times 1.\text{fraction}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where the &amp;quot;exponent bias&amp;quot; is there to allow you to represent negative exponents, and the &amp;quot;.&amp;quot; in &lt;span class=&quot;math-container&quot;&gt;$1.\text{fraction}$&lt;/span&gt; is a &amp;quot;binary point&amp;quot; instead of a decimal point.&lt;/p&gt;&#xA;&lt;p&gt;You can read about the particulars of the double precision format &lt;a href=&quot;http://en.wikipedia.org/wiki/Double-precision_floating-point_format&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, which is where I got the image and formula.&lt;/p&gt;&#xA;" OwnerUserId="4956" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-07-03T04:49:08.213" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9807" PostTypeId="2" ParentId="9797" CreationDate="2013-07-03T08:56:31.527" Score="0" Body="&lt;p&gt;the autocorrelation of your sample should have a peak at t=0. the value of this peak should give you a good idea of a threshold value. The simplest apporoach to do keyword-searching in realtime data would be to divide incoming data into frames and keep cross correlating the required waveform against the frames and check whether the resultant has a peak higher than the estimated threshold ... However this is a rough method and suseptible to false peaks due to amplitude variations in incoming data&lt;/p&gt;&#xA;" OwnerUserId="4348" LastActivityDate="2013-07-03T08:56:31.527" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9808" PostTypeId="1" AcceptedAnswerId="9814" CreationDate="2013-07-03T09:45:08.707" Score="1" ViewCount="259" Body="&lt;p&gt;It's my first attempt at 3D analysis.&#xA;I am trying to segment a 3D CT data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My case study is very simple: trying to segment circular objects in my data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any suggestions on how to achieve the 3 steps:&lt;br&gt;&#xA;1. First of all I would like to visualize my data in 3D&lt;br&gt;&#xA;2. Then segment by value, e.g. all voxels whose value is between 800 and 1200 and visualize it&lt;br&gt;&#xA;3. Than find shape properties in 3D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I visualize the data now is : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id = find ( D &amp;lt; 1200 &amp;amp; D &amp;gt; 800);&#xA;[ x , y , z ] = ind2sub( id , size(D) ) ;&#xA;plot3(x,y,z,'.')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you have suggestions for a better way? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I heard about the isosurface functions but don't know how to use it for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4727" LastEditorUserId="4682" LastEditDate="2013-07-04T16:31:24.933" LastActivityDate="2013-07-04T16:31:24.933" Title="3d CT segmentation" Tags="|image-processing|matlab|computer-vision|object-recognition|3d|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9809" PostTypeId="1" CreationDate="2013-07-03T10:45:05.193" Score="0" ViewCount="730" Body="&lt;p&gt;I have a task from my boss on calculating Ballistocardiogram (BCG) with Photoplethysmogram (PPG) using MATLAB. I would like to know how it can be done. Any kind soul can guide me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for what I know about how the test will be like is that I will need to take the BCG data and compare it against the PPG (I know Matlab has comparing function). So, in short, the PPG will be like a benchmark.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally for BCG and PPG should have the same amount of data, but let's say the BCG for example 12 data and PPG only have 10. How do we compare it? because at every point it should match and I can't be removing the 2 extra data as it would be manipulating and that defeats the purpose already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BCG: Ballistocardiogram,&#xA;PPG: Photoplethysmogram&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope you guys can show me some light&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-I don't have enough reputation to upload pic-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://skydrive.live.com/embed?cid=0525DA685954952E&amp;amp;resid=525DA685954952E%21405&amp;amp;authkey=AOrI6qD7kFWV4_g&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://skydrive.live.com/embed?cid=0525DA685954952E&amp;amp;resid=525DA685954952E%21405&amp;amp;authkey=AOrI6qD7kFWV4_g&lt;/a&gt;&#xA;Diagram 1: find the differences of the corresponding data. As you can see in this diagram 1B against 2B&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;&lt;a href=&quot;https://skydrive.live.com/embed?cid=0525DA685954952E&amp;amp;resid=525DA685954952E%21406&amp;amp;authkey=ACIhYwrTqZaNnp8&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://skydrive.live.com/embed?cid=0525DA685954952E&amp;amp;resid=525DA685954952E%21406&amp;amp;authkey=ACIhYwrTqZaNnp8&lt;/a&gt;&#xA;Diagram 2: let's say BCG has 12 data and PPG only 10(hopefully this don't occur). In this diagram, should 1D correspond to 2C? or? and if we remove 1C this will be manipulating the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;if there are other suggestions please tell me also. I don't need to use Matlab to compare. As long as I can compare, anyway is ok&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4959" LastEditorUserId="47790" LastEditDate="2020-04-02T17:48:23.300" LastActivityDate="2020-04-02T17:48:23.300" Title="calculate and compare Ballistocardiogram (BCG) with Photoplethysmogram (PPG)" Tags="|matlab|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9810" PostTypeId="2" ParentId="9804" CreationDate="2013-07-03T11:49:15.467" Score="-2" Body="&lt;p&gt;You have to know the format of the header. For example, if it's a RIFF Wave file, the header is always 44 bytes long. You could simply grab every byte beyond 44 without verifying anything. If you're already assuming in your code that the file is 16 bit and mono, then you may as well hard-code the length of the header. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just hope you won't have to deal with other types of files. ;)&lt;/p&gt;&#xA;" OwnerUserId="4949" LastActivityDate="2013-07-03T11:49:15.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9811" PostTypeId="2" ParentId="9804" CreationDate="2013-07-03T12:25:03.993" Score="1" Body="&lt;p&gt;There are libraries to read audio data in many different file formats; such as &lt;a href=&quot;http://www.mega-nerd.com/libsndfile/&quot; rel=&quot;nofollow&quot;&gt;libsndfile&lt;/a&gt;, for which there is a .NET wrapper, too: &lt;a href=&quot;https://github.com/ahawker/NLibsndfile&quot; rel=&quot;nofollow&quot;&gt;NLibsndfile&lt;/a&gt;. (I don't use .NET/C# and thus have no experience with NLibsndfile.)&lt;/p&gt;&#xA;" OwnerUserId="4712" LastActivityDate="2013-07-03T12:25:03.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9812" PostTypeId="1" AcceptedAnswerId="9813" CreationDate="2013-07-03T13:16:33.037" Score="2" ViewCount="11330" Body="&lt;p&gt;Using the figure below as an example, I wonder if it is possible that the small oscillations in the signal at the time of each step shift could be caused &lt;em&gt;solely&lt;/em&gt; by the application of a low-pass filter to a pure square wave?&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WNGaS.jpg&quot; alt=&quot;Signal image&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="4961" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-07-03T23:57:13.600" Title="Does low-pass filtering a square wave cause a 'ringing' to develop in the signal?" Tags="|lowpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9813" PostTypeId="2" ParentId="9812" CreationDate="2013-07-03T13:29:23.667" Score="6" Body="&lt;p&gt;These ringing artifacts are due to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gibbs_phenomenon&quot; rel=&quot;nofollow&quot;&gt;Gibbs phenomenon&lt;/a&gt;. They are indeed caused by lowpass filtering a function with discontinuities. What you see is basically the oscillations of the step response of the lowpass filter. The oscillations can be reduced (or completely eliminated) by choosing a lowpass filter with less or no ringing in its step response. E.g. a &lt;a href=&quot;http://en.wikipedia.org/wiki/Gaussian_filter&quot; rel=&quot;nofollow&quot;&gt;Gaussian filter&lt;/a&gt; has no ringing at all. However, lowpass filters with well-behaved step responses perform worse in the frequency domain in terms of passband deviation, transition band roll-off, and stopband attenuation.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-07-03T23:57:13.600" LastActivityDate="2013-07-03T23:57:13.600" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9814" PostTypeId="2" ParentId="9808" CreationDate="2013-07-03T17:01:26.223" Score="1" Body="&lt;p&gt;Mathematica 9 features completely integrated Image3D objects. Visualization is cool and snappy (as expected), and many segmentation functions accept 3D images (&lt;code&gt;Binarize&lt;/code&gt;, &lt;code&gt;ChanVeseBinarize&lt;/code&gt;, &lt;code&gt;ClusteringComponents&lt;/code&gt;, &lt;code&gt;MorphologicalComponents&lt;/code&gt;, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for measuring properties, &lt;code&gt;ComponentMeasurements&lt;/code&gt; would be the function to go to; but as of version 9 it does not accept 3D images. So while waiting for the future version, you are on your own with your point 3. It's not always complicated, for example below I compute the centroid of the segmented shapes: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XMqo4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a fake volume with noise of intensity comprised between .1 and .5, add two solid 3D balls to it, and rescale all the values to range from 0 to 1: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;data = Rescale[ RandomReal[{.1, .5}, {200, 100, 100}] + &#xA;      Join[DiskMatrix[10, {100, 100, 100}], DiskMatrix[20, {100, 100, 100}]]];&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Construct a 3D image (which can be manipulated, whose color transfer function can be interactively edited, etc.), and segment it by looking for voxel values between .5 and 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;image3d = Image3D[data];&#xA;segmented = Binarize[image3d, {.5, 1}];&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the morphological connected components from the binary 3D image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;components = MorphologicalComponents[segmented];&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the centroid of each shape by averaging the voxel positions for each shape:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Table[&#xA;   p = N@Position[components, i];&#xA;   Mean[p],&#xA;   {i, 1, Max[components]}&#xA;]&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="602" LastEditorUserId="602" LastEditDate="2013-07-03T18:34:29.250" LastActivityDate="2013-07-03T18:34:29.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9816" PostTypeId="2" ParentId="9780" CreationDate="2013-07-03T18:34:37.620" Score="6" Body="&lt;p&gt;You are looking at the wrong metric of &quot;correctness&quot;.  Nearest neighbor is introducing significant discontinuities that are showing up as massive quantities of noise in the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that you should be comparing to &lt;em&gt;the result you would have gotten if you had sampled at 26.25MHz in the first place.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's try it (sample a 12Hz sine wave at 26 Hz for 2 seconds):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;numResamples = 52;&#xA;resampleRate = 26;&#xA;t1 = (0:1:numResamples - 1) * 1/resampleRate;&#xA;s1correct = sin(t1 * 24 * pi);&#xA;plot(t1,s1correct);&#xA;plot(t1,abs(fft(s1correct)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I1Knh.png&quot; alt=&quot;what we want&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok.  Now let's see what happened if we had sampled a 12Hz signal at 25Hz, and then interpolate up to 26Hz using matlab's &lt;em&gt;linear&lt;/em&gt; interpolation.  (Actually, I'm using Octave because I'm on a machine without matlab today) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;numSamples = 50;&#xA;sampleRate = 25;&#xA;t0 = (0:1:numSamples - 1) * 1/sampleRate;&#xA;s0 = sin(t0 * 24 * pi);&#xA;s1linear = interp1(t0, s0, t1, 'linear', 'extrap');&#xA;plot(t1,s1linear);&#xA;plot(t1,abs(fft(s1linear)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/V10D2.png&quot; alt=&quot;linear interpolation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty good.  Now let's look at nearest neighbor interpolation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s1nearest = interp1(t0, s0, t1, 'nearest', 'extrap');&#xA;plot(t1,s1nearest);&#xA;plot(t1,abs(fft(s1nearest)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ge8z5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's completely different, and filled with noise at all frequencies!!!  (The &quot;beat pattern&quot; in the nearest neighbor result is the beat pattern from sampling at 25Hz instead of 26Hz.)  The noise is because nearest neighbor is compressing the 12Hz signal to 12.48Hz, and then inserting an extra sample every 26th sample to get us back to 24 peaks.  That extra sample is the discontinuity that is creating all that extra noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you'll find that cubic interpolation is even better than linear.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-07-03T18:34:37.620" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9817" PostTypeId="2" ParentId="9665" CreationDate="2013-07-03T18:50:02.450" Score="1" Body="&lt;p&gt;The correct way to implement the sum in the previous answer is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;for&lt;/code&gt; $l=-m N/2$ &lt;code&gt;to&lt;/code&gt; $m N/2-1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad$ &lt;code&gt;for&lt;/code&gt; $k=0$ &lt;code&gt;to&lt;/code&gt; $N$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad\quad$ &lt;code&gt;for&lt;/code&gt; $j=-q/2$ &lt;code&gt;to&lt;/code&gt; $q/2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad\quad\quad$ &lt;code&gt;if&lt;/code&gt; $l==\mod(\mu_k+j+m N/2,m N)-m N/2$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad\quad\quad\quad$ $\tau_l=\tau_l+\alpha_k P_{jk}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad\quad\quad$ &lt;code&gt;end&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad\quad$ &lt;code&gt;end&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad$ &lt;code&gt;end&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way all the terms $\alpha_k P_{jk}$ are accounted for in the sum.&lt;/p&gt;&#xA;" OwnerUserId="1696" LastActivityDate="2013-07-03T18:50:02.450" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9818" PostTypeId="1" CreationDate="2013-07-03T19:09:42.663" Score="0" ViewCount="95" Body="&lt;p&gt;I am wondering if there is a formula for the period of the sum of $N$ cisoids of the form $e^{j\frac{2\pi}{N} i\, \omega_k}$ where the frequencies $\omega_k \in \left[-N/2,N/2\right]$, $k=0,\ldots,N-1$ and $\forall\, p,q,\, \omega_p \neq \omega_q$. This kernel arises, for instance, in the expression of the Non Uniform FFT (NUFFT).&lt;/p&gt;&#xA;" OwnerUserId="1696" LastActivityDate="2013-07-03T19:09:42.663" Title="Period of non-harmonic Fourier sum" Tags="|fft|nonuniform|nonharmonic|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9819" PostTypeId="2" ParentId="9812" CreationDate="2013-07-03T21:05:39.637" Score="1" Body="&lt;p&gt;I think it is worth pointing out that any lowpass filter will reshape a pure square wave to something like in your illustration, regardless of the filter being used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reason is that a pure square wave requires an infinite amount of harmonics (a square wave is made of a fundamental frequency and odd harmonics at a level of 1/h). The moment a lowpass filter is applied - you no longer have infinite amount of harmonics, thus these ripples start popping out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following illustration, only 5 sine harmonics are shown, but the sum (resembling square wave) is that of 60. You can see the ripples there as well. The way to get rid of them is to carry on adding harmonics ad infinitum. If you do so and then apply a lowpass just above the 60th harmonic - you'll get something similar to the square in this illustration:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9NRrR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4576" LastActivityDate="2013-07-03T21:05:39.637" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9820" PostTypeId="2" ParentId="9797" CreationDate="2013-07-03T21:40:38.777" Score="3" Body="&lt;p&gt;As Matt stated, you should use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient#For_a_sample&quot; rel=&quot;nofollow&quot;&gt;correlation coefficient&lt;/a&gt;!.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Points 1 to 4 calculate the crosscorrelation. From that you have to find the highest peak (or lowest, if it has a higher absolute value). This value is the value of the nominator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The denominator consists of the two autocorrelation values. Those are obtained by using the same algorithm where both signals are the equal. Here the peak should be in the middle (t=0) as already stated by &lt;em&gt;welcomedungeon&lt;/em&gt;. Taking the square root of both autocorrelation values and multiplying them, gives the denominator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Maybe this description is more clear:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{max(abs(ifft(fft(x_1)*fft(x_2)')))}{sqrt(max(abs(ifft(fft(x_1)*fft(x_1)'))))*sqrt(max(abs(ifft(fft(x_2)*fft(x_2)'))))}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The apostroph means conjugate complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Two examples with Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the same signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1000,1)-0.5;&#xA;max(abs(ifft(fft(x).*fft(x)')))/(sqrt(max(abs(ifft(fft(x).*fft(x)')))).*sqrt(max(abs(ifft(fft(x).*fft(x)')))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives &lt;code&gt;1&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a sine and a cosine, should also give &lt;code&gt;1&lt;/code&gt; because they are delayed versions of each other:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = sin([0:pi/100:10*pi]);&#xA;y = cos([0:pi/100:10*pi]);&#xA;max(abs(ifft(fft(x).*fft(y)')))/(sqrt(max(abs(ifft(fft(x).*fft(x)')))).*sqrt(max(abs(ifft(fft(y).*fft(y)')))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives approximately &lt;code&gt;1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using windowing before transformation to frequency domain should improve results.&lt;/p&gt;&#xA;" OwnerUserId="4932" LastEditorUserId="4932" LastEditDate="2013-07-07T17:13:29.423" LastActivityDate="2013-07-07T17:13:29.423" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9821" PostTypeId="1" CreationDate="2013-07-04T01:32:05.917" Score="1" ViewCount="208" Body="&lt;p&gt;I am trying to find a specific block of data that should hold valid audio data that I want to process. For instance, I record at 44.1kHz, but I only transmit a .5s of content. Since the buffer I store the recordings in contains both the recording as well as background noise, is there a way to isolate the sample I desire? Is this a simple filtering problem? I know the range of frequencies I need in the sample, so would a bandpass filter solve this issue? My ultimate goal is to run the time series data through an FFT to see which of the desired frequencies were transmitted. Note that this is being done in software. Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="4764" LastActivityDate="2013-07-05T23:11:53.187" Title="Finding audio data in recording" Tags="|fft|audio|bandpass|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9822" PostTypeId="1" CreationDate="2013-07-02T22:53:45.603" Score="2" ViewCount="512" Body="&lt;p&gt;I'm trying to write a correlation function on an embedded device. Because its embedded, I need to make sure that the memory/CPU usage is minimum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the deal:&#xA;- I have a saved waveform sampled at 1 MHz &#xA;- I have timing info for the waveform&#xA;- I am going to be taking a new waveform at 200 kHz with new timing info&#xA;- The timing info for both waveforms is comparable, neither of them start at zero&#xA;- I want to determine the delay between one waveform and the next precise to 1 us. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I was going to use to do this was:&#xA;- Find the maximum of each waveform (there should only be 1 peak in each, and they should match up)&#xA;- Set the indexes of each array so that the maximums of the waveforms match up. I'll save the amount of clock cycles that I am shifting in order to do this. &#xA;- Then I will correlate this and shift a few samples in each direction and correlate as well. The highest correlation value corresponds to the correct amount of delay, and I will keep this value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that my array manipulation skills are limited. I'm struggling when trying to implement this algorithm, especially because one of the waveforms is sampled at 5X the other. Does anybody have any references for this or knows how I can achieve this easily?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The specific problems I'm running into are:&#xA;- How do I set the indexes differently so that the maximums match up? I don't want to write a new register because this takes up memory and takes a long time in terms of read/write cycles.&#xA;- How do I compensate for the different sampling frequencies? I could fill the 200 kHz waveform with zeros (which won't affect the correlation) but this will take up more memory with no real purpose. &#xA;- The timing info isn't precise, in that they don't necessarily line up perfectly. For example, the timing numbers &quot;10000, 10020, 10040, 10060, 10080, and 10100&quot; for the 1MHz signal  doesn't necessarily match up with &quot;10000, 10100&quot; for the 200 kHz signal. So I can't rely on using the timing numbers as an index very easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If what I am asking isn't very clear, I can try to embellish a little on requests, but I don't want this to be too long. &lt;/p&gt;&#xA;" OwnerUserId="8304" OwnerDisplayName="user2525288" LastActivityDate="2013-07-04T01:48:07.170" Title="Embedded Correlation Function" Tags="|c|cross-correlation|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9823" PostTypeId="2" ParentId="9822" CreationDate="2013-07-03T16:23:56.700" Score="1" Body="&lt;p&gt;How fast is the signal you are trying to analyze? The maximum &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist-Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;theoretical&lt;/a&gt; frequency you can handle is going to be 100KHz (sampling rate / 2). Giving a &quot;true&quot; answer with 1 usec resolution is not possible with a 1MHz sampling rate. Practically this may not matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without specific timing constraints it is hard to give a good answer. To get your signals to have the same sampling rate you can do linear interpolation between the points of your slow data or average your fast data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend averaging your fast data. If you are working in counts from an ADC summing 5 of the fast samples and dividing by 5 will be fast. Your compiler will likely use &lt;a href=&quot;http://homepage.cs.uiowa.edu/~jones/bcd/divide.html&quot; rel=&quot;nofollow&quot;&gt;reciprocal multiplication&lt;/a&gt; to avoid the division operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to line up the signals based on a single peak is likely to give incorrect results. &#xA;An alternative method is to maintain an auxiliary array with a selection of the N highest peaks stored. Do not simply get the N largest points; they will likely be clustered together and will not give a good result. Instead track the largest point and do not allow a new peak unless the signal has dropped below some threshold value (say 90% of the peak) to introduce hysteresis. The exact number of peaks should be chosen on based on the shape of your data and the desired level of &lt;a href=&quot;https://en.wikipedia.org/wiki/Statistical_significance&quot; rel=&quot;nofollow&quot;&gt;confidence&lt;/a&gt; as well as memory and CPU time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To match the peaks scan through the second data set maintaining a best fit offset. When you find a possible match to the first peak (a value within some tolerance) you can then compare the &quot;future&quot; peaks. Finding the offset with minimal error for the N peak points is not too onerous (sqrt((x_1 - xbar)^2 + ... (x_n - xbar)^2)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be done in only one pass through each of the data sets with only the extra memory required being the auxiliary array that keeps the N peak points.&lt;/p&gt;&#xA;" OwnerUserId="45930" OwnerDisplayName="LogicG8" LastActivityDate="2013-07-03T17:13:20.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9824" PostTypeId="2" ParentId="9821" CreationDate="2013-07-04T04:14:42.793" Score="1" Body="&lt;p&gt;Knowing the range of frequencies is a good start and yes a bandwidth filter will certainly help you isolate them but you must consider the overall level of background noise vs signal noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performing an FFT on filtered (bandwidth or otherwise) data will only yield results on the frequencies that are left over! This will either be of use to you or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the number of frequencies that you are after are not that numerous, a collection of IIR (infinite impulse response) filters might be a better choice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider DTMF tones used by telephones and cellphones, typically IIR filters have found their way in software based detection of these dual-tone based signals. There are online resources for calculating each of the  filter's co-efficients. You must use one filter per frequency that you are after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dreadtech-dtmf-decoder.googlecode.com/svn/trunk/&quot; rel=&quot;nofollow&quot;&gt;Here is an iPhone version of source code for DTMF decoding using IIR filters&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The file &lt;strong&gt;DTMFDecoder.m&lt;/strong&gt; contains the bulk of the code with the co-efficients defined near the top.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without knowing any further detail, this is all I am able to help you with.&lt;/p&gt;&#xA;" OwnerUserId="4963" LastActivityDate="2013-07-04T04:14:42.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9825" PostTypeId="2" ParentId="9194" CreationDate="2013-07-04T05:41:37.630" Score="9" Body="&lt;p&gt;I don't think there is any point diving into the complexity of DFT / FFT / IIR / FIR and wavelets without first understanding what audio is fundamentally and what the various ways of representing audio digitally are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is audio in general (in air, not water or other materials):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Audio is composed of sound pressure waves&lt;/li&gt;&#xA;&lt;li&gt;They cause compression and rarefaction of the air&lt;/li&gt;&#xA;&lt;li&gt;These waves propagate outwards from the point of source&lt;/li&gt;&#xA;&lt;li&gt;Waves can interfere with each other causing peaks and troughs&lt;/li&gt;&#xA;&lt;li&gt;Waves can be absorbed and reflected by materials&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How is audio represented electrically:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A microphone and pre-amplifier converts the sound pressure waves into an electrical signal&lt;/li&gt;&#xA;&lt;li&gt;Typically this signal has both a positive and negative voltage (like AC voltages)&lt;/li&gt;&#xA;&lt;li&gt;Magnetic tapes store these differences as they appear, hence the term analogue&lt;/li&gt;&#xA;&lt;li&gt;Saturation occurs when the input signal's strength is equal to the limits of the system (any more increases in voltage cannot be accurately be represented)&lt;/li&gt;&#xA;&lt;li&gt;Clipping occurs when the input signal is higher than can be represented by the system, so the signal becomes clipped (or capped at the extremities)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How is audio represented digitally:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Audio must first be sampled using an ADC (analog to digital convertor)&lt;/li&gt;&#xA;&lt;li&gt;Sampling comprises of electrically measuring an audio signal periodically&lt;/li&gt;&#xA;&lt;li&gt;This period is called the sample rate and it determines the highest frequency that can be represented (nyquist limit)&lt;/li&gt;&#xA;&lt;li&gt;The nyquist limit is the sample rate / 2 (the closer to get to the limit, the more poorly represented the signal becomes)&lt;/li&gt;&#xA;&lt;li&gt;The bitrange determines the noise floor, (-96dB for 16 bit vs -48dB for 8 bit)&lt;/li&gt;&#xA;&lt;li&gt;A single 16 bit sample of audio can be a (signed) value between -32768 to 32767 (this can represent both the negative and positive swing of the analog signal)&lt;/li&gt;&#xA;&lt;li&gt;There are only 8 Bits allowed per byte (in terms of computer storage) so a 16 bit sample must be represented by at least 2 bytes&lt;/li&gt;&#xA;&lt;li&gt;The order in which these bytes are stored are referred to as their endian type (big or small)&lt;/li&gt;&#xA;&lt;li&gt;Stereo samples require a separate sample for each channel, one for left and another for right&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What different ways are used to store digital audio:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;PCM (pulse code modulated) is the most common uncompressed way of storing audio digitally&lt;/li&gt;&#xA;&lt;li&gt;Many compression exist to reduce the amount of data used, some are lossless, some are lossy&lt;/li&gt;&#xA;&lt;li&gt;WAV files are uncompressed and can be mono or stereo (interleaved samples)&lt;/li&gt;&#xA;&lt;li&gt;MP3 files are compressed, lossy and employ psychoacoustics to achieve very high data compression rates&lt;/li&gt;&#xA;&lt;li&gt;Even the lowest bit range (1 bit) can be useful depending on their usage, typically gift cards that play audio that is stored as 1 bit&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How to become more familiar with audio in the digital realm:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do do and do more! Download a program such as audacity and create different audio files using different sample rates and bit ranges&lt;/li&gt;&#xA;&lt;li&gt;Create sine / triangular / square and sawtooth tones and hear the differences&lt;/li&gt;&#xA;&lt;li&gt;Learn to hear the difference between types such as an 8 bit 10KHz file and a 16 bit 44.1KHz file (CD quality)&lt;/li&gt;&#xA;&lt;li&gt;Experiment with high-pass / low-pass / band-pass filters and hear the differences&lt;/li&gt;&#xA;&lt;li&gt;Push signals beyond their saturation limit to understand how clipping affects the audio signal&lt;/li&gt;&#xA;&lt;li&gt;Apply envelopes to signals if your software has this capability&lt;/li&gt;&#xA;&lt;li&gt;There is a difference between inharmonic and harmonic distortion, experiment with both&lt;/li&gt;&#xA;&lt;li&gt;Use a spectrogram (FFT) to see these and other signals to become familiar with them&lt;/li&gt;&#xA;&lt;li&gt;Use both linear and logarithmic plots to see the differences&lt;/li&gt;&#xA;&lt;li&gt;Downsample and upsample signals and hear how this affects the audio&lt;/li&gt;&#xA;&lt;li&gt;Use different dithering methods (when converting bit ranges) and hear the differences&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This will hopefully give you a sense of what digitally represented audio is and what the differences sound like prior to attempting any DSP. It's always easier to know that something is wrong with your FFT analysis if you can recognise that you have inputed an 8 bit signal vs a 16 bit signal for example or that the sample rate has been corrupted by a faulty miscalculation in a transform.&lt;/p&gt;&#xA;" OwnerUserId="4963" LastEditorUserId="4963" LastEditDate="2013-07-04T05:47:25.373" LastActivityDate="2013-07-04T05:47:25.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9826" PostTypeId="1" AcceptedAnswerId="9831" CreationDate="2013-07-04T06:38:02.033" Score="1" ViewCount="12272" Body="&lt;p&gt;How to compute Image gradients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In X Direction - Kernel : -1 0 1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Y Direction - Kernel : &#xA;-1 &#xA;0 &#xA;1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume my input image is: &lt;code&gt;unsigned char* imgImage;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could any one please share code. I am newbie to image processing.&#xA;Is it possible to do in OpenCV with this same kernel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance!&lt;/p&gt;&#xA;" OwnerUserId="1376" LastEditorUserId="128" LastEditDate="2019-06-24T08:46:47.870" LastActivityDate="2019-06-24T08:46:47.870" Title="How to Compute Image Gradients?" Tags="|image-processing|opencv|gradient|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9827" PostTypeId="1" AcceptedAnswerId="9833" CreationDate="2013-07-04T08:36:39.613" Score="1" ViewCount="1126" Body="&lt;p&gt;I'm trying to figure out how to implement a continuous EQ filter.  I have in the past built a parametric EQ and then built a 10 channel EQ using 10 of these parametric filters.  This gave nice results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'm now trying to create a continuous EQ filter.  Is this possible with a parametric EQ?  By selecting the Q factor, perhaps?  If so how would I fit the Q factors to the curve?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Failing that is there another better way to implement continuous EQ?  Could it be implemented from an FFT by extending the magnitude of each r,i bin based on the curve?  Or would this produce rather nasty EQ'ing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Edit&lt;/em&gt;&lt;/strong&gt;: To answer the comment and add a bit more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been experimenting with trying to define an FFT filter.  Basically I define an arbitrary curve.  The curve defines dB increase or decrease.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently building my own FFT by looking up the y intercept on the curve for each frequency bin. (Well i'm converting from dB to a multiplicative factor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, later, I'm FFT'ing a block of audio and then I'm multiplying it by the values in the &quot;filter&quot; FFT.  When the multiplicative factor is purely 1 then I get the audio passing through fine.  As I increase the multiplicative factor for a given bin I get a nasty crackling (though I do hear the correct frequency boosted).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surely there must be a way of doing this in the fourier domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Btw, please don't give me matlab functions unless you can explain how they work because I'm trying to implement this on a mobile device so I can't use matlab.&lt;/p&gt;&#xA;" OwnerUserId="333" LastEditorUserId="333" LastEditDate="2013-07-06T09:13:04.927" LastActivityDate="2013-07-08T16:15:02.647" Title="Continuous EQ defined by a curve" Tags="|fft|parametric-eq|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9830" PostTypeId="2" ParentId="9826" CreationDate="2013-07-04T10:03:33.510" Score="1" Body="&lt;p&gt;In Matlab, there is a simple function called imfilter that does this job. I am sure there is a similar function, probably with a similar name in OpenCV.&lt;/p&gt;&#xA;" OwnerUserId="4966" LastActivityDate="2013-07-04T10:03:33.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9831" PostTypeId="2" ParentId="9826" CreationDate="2013-07-04T10:05:01.513" Score="2" Body="&lt;p&gt;You can create your own custom kernel filter using something similar to &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/filter_2d/filter_2d.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you just want to find image gradients there are other options such as &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.html&quot; rel=&quot;nofollow&quot;&gt;sobel&lt;/a&gt; and &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/laplace_operator/laplace_operator.html&quot; rel=&quot;nofollow&quot;&gt;laplace&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your aim is edge detection, I find canny is best for this in most cases.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2013-07-04T10:05:01.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9833" PostTypeId="2" ParentId="9827" CreationDate="2013-07-04T12:38:44.170" Score="3" Body="&lt;p&gt;This is a very complicated topic. A good overview on how to do this in MATLAB is here:&#xA;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/vguitar/Fitting_Filters_Matlab.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/vguitar/Fitting_Filters_Matlab.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FIR fit can typically done by interpolating up to a full FFT grid and adding either a minimum or a zero phase and then doing an inverse FFT to get the impulse response. You can then try different filter lengths to determine which lengths is required to create an acceptable fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IIR fitting is much more tricky. The above example uses MATLAB's invfreqz() which in some cases gives good results and in other only works very poorly. In general the methods are iterative, i.e. there are many design cycles and there are small modifications between design steps that are supposed to &quot;improve&quot; things. These often use &quot;gradient&quot; methods, i.e. you need to evaluate the derivatives of the error function with respect to zeros and poles (or whatever other representation you may choose). They also involve least square error methods. A lot of care has to be taken to correctly formulate the error criteria in terms of frequency spacing, weight functions, relative vs. absolute error etc. The formulation of the error function is a direct representation of what the specific application can tolerate (or not).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT based on OPs question edit:&#xA;If you want to do frequency domain filtering, (i.e. FFT-&gt;mpy with Filter-&gt;inverse FFT) then you need to get all the framing, zero-padding and overlap handling correct. This due to the difference of circular vs. linear convolution and that the FFT &quot;as is&quot; assumes by definition periodic signals. Google &quot;overlap-add&quot; for more info. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You still need to decide on the phase for your filter. Leaving the phase zero creates a non-causal filter that will create lots of wrap-around problem. At the very minimum you need to shift the impulse response so it's causal.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-07-06T10:33:35.760" LastActivityDate="2013-07-06T10:33:35.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9834" PostTypeId="1" AcceptedAnswerId="9837" CreationDate="2013-07-04T14:15:50.353" Score="0" ViewCount="2418" Body="&lt;p&gt;Okay, this might be a very basic question, but I'm completely new to the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a $40$ Hz sine wave ($1000$ samples, $fs = 1$ kHz), which I have amplitude modulated to a $4$ Hz sine wave ($1000$ samples, $fs = 1$ kHz). In the time-domain, the result looks like I expected. However, when I calculate the FFT, there are $2$ sidebands but nothing at $40$ Hz anymore. If I increase the FFT resolution with zero-padding I can see something there, but very modest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected behaviour? Can someone explain what is happening here and why. Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: to clarify, I get two peaks which are at 16 Hz and 24 Hz.&lt;/p&gt;&#xA;" OwnerUserId="4967" LastEditorUserId="4967" LastEditDate="2013-07-04T14:45:20.407" LastActivityDate="2013-07-04T15:39:07.033" Title="Why the carrier frequency does not appear after AM modulation?" Tags="|fft|discrete-signals|modulation|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9836" PostTypeId="2" ParentId="9834" CreationDate="2013-07-04T15:17:07.037" Score="1" Body="&lt;p&gt;From the code, it appears that you are multiplying both signals, i.e. $c(t)\cdot s(t)$. However, regular amplitude modulation with 100% depth is $c(t)\cdot (0.5+0.5\cdot s(t))$.&lt;/p&gt;&#xA;" OwnerUserId="4712" LastActivityDate="2013-07-04T15:17:07.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9837" PostTypeId="2" ParentId="9834" CreationDate="2013-07-04T15:32:49.290" Score="3" Body="&lt;p&gt;What you did is multiply two sinusoids with each other:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z(n)=\sin(n\theta_1)\cdot\sin(n\theta_2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta_1=2\pi\cdot 40/1000$ and $\theta_2=2\pi\cdot 4/1000$.&#xA;The result $z(n)$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z(n)=\frac{1}{2}\left[\cos(n(\theta_1-\theta_2))-\cos(n(\theta_1+\theta_2))\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you get two sinusoids with the sum and the difference of the two original frequencies, i.e. one with $40-4=36Hz$, and the other one with $40+4=44Hz$. This is exactly what you see in your FFT plot. You use a 1000-point FFT, i.e. the frequency at index $i$, ($i=1,2,\ldots,1000)$, is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i=\frac{f_s}{1000}(i-1)=i-1,\quad i=1,\ldots,1000$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s=1000Hz$ is the sampling frequency. You get peaks at $i=37$ and $i=45$, which correspond to frequencies $f_{37}=36Hz$ and $f_{45}=44Hz$, exactly as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you made a mistake in the mapping of FFT indices to frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, with standard amplitude modulation you indeed get the carrier in the spectrum because the modulated signal looks like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(n)=[1+mx(n)]\sin(n\theta_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x(n)$ is your message, $m$ is a scaling factor, $\theta_0$ is the carrier frequency, and the term $1$ which is added to the signal results in the carrier wave in addition to the sidebands. You just multiplied two sinusoids without this constant term, that's why you don't see any carrier. This was already correctly pointed out in chirlu's answer.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2013-07-04T15:39:07.033" LastActivityDate="2013-07-04T15:39:07.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9839" PostTypeId="2" ParentId="9707" CreationDate="2013-07-04T21:10:00.003" Score="-1" Body="&lt;p&gt;The functions you want to process have different sample rates. The measured data is sampled every 68.8 microns and the slit data is sampled every 1 micron. So you have to &lt;a href=&quot;http://en.wikipedia.org/wiki/Downsampling&quot; rel=&quot;nofollow&quot;&gt;downsample&lt;/a&gt; the slit data to the same sample rate, or even better &lt;a href=&quot;http://en.wikipedia.org/wiki/Upsampling&quot; rel=&quot;nofollow&quot;&gt;upsample&lt;/a&gt; the measured data, to prevent loss of information. Then both signals will have equal lenght and the deconvolution should look something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ifft(fft(y)./fft(h))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4932" LastActivityDate="2013-07-04T21:10:00.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9842" PostTypeId="1" AcceptedAnswerId="9845" CreationDate="2013-07-05T13:11:13.940" Score="2" ViewCount="3868" Body="&lt;p&gt;Everybody explains that white noise has all frequencies equally strong. But, this immediately means that &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Ultraviolet_catastrophe&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ultraviolet catastrofe&lt;/a&gt; inevitably happens if power &gt; 0 stays constant at any frequency and, what is similarly unacceptable,&lt;/li&gt;&#xA;&lt;li&gt;White noise is identical to single Dirac impulse since &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirac_delta_function#Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;delta pulse is a constant in the Fourier basis&lt;/a&gt;). Note that &lt;em&gt;constant&lt;/em&gt; is the opposite to the notion of &lt;em&gt;noise&lt;/em&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is average over time is implied, like you obtain uniform distribution, or what? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why answers are not satisfactory&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answers say that white noise does not mean that signal spectrum is limited. It means that that power spectrum is flat, which also means that there is no correlation between samples so that it is correlation matrix, which is delta function (and I do not know what is its fourier transform is, which has the infinite spectrum). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see a several problems with that. At first, the power spectrum is simple a square of the spectrum. If you say that you prevent the Utraviolet catastrophe by cutting all frequencies above some threshold $f_{max},$ you cannot have a flat spectrum anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, I understand that you can have a mean and variance of a uniform distribution which has value $v$ in $[a,b]$ and 0 outside. But what is a mean and variance of a &lt;code&gt;perfectly flat power spectrum&lt;/code&gt;? Ok, mean might be zero if you admit negative frequencies. But you say that variance is $\sigma^2$. How is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, &lt;a href=&quot;https://dsp.stackexchange.com/a/13153/4701&quot;&gt;I have determined that rapid changes are less likely in the the limited spectrum signal, which means that samples tend to each other, which means that they are correlated&lt;/a&gt;. Ok, might be you say that they are correlated but pink nose does not say if they are positively or negatively correlated, so samples are not correlated in case of pink noise. Ok, this is great. But we have just concluded that pink noise is white (or can be white). Is it right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also see Wikipedia saying that white noise can be Gaussian, which means that the samples are normally distributed. This means that they will tend to each other, like in the pink noise.&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-12-12T16:25:16.303" Title="White noise vs. delta pulse and Ultraviolet catastrofe" Tags="|noise|impulse-response|power-spectral-density|terminology|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="9844" PostTypeId="2" ParentId="9842" CreationDate="2013-07-05T16:45:49.290" Score="5" Body="&lt;p&gt;As Jason was saying in the comments, the &lt;em&gt;power spectral density&lt;/em&gt; of white noise is flat.  This is equivalent to saying that the autocorrelation of white noise is a delta dirac function (i.e. that there is no correlation, positive or negative, between one noise sample and another), not that the noise itself is a delta dirac function.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-05T16:45:49.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9845" PostTypeId="2" ParentId="9842" CreationDate="2013-07-05T17:22:08.773" Score="0" Body="&lt;p&gt;The difference between both signals is the phase of the spectral components. The phase of the noise signal is completely random. The phase of the dirac is zero (in case of an dirac at t=0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take for example a noise signal, transform it to the frequency domain, change phase to zero, transform back, and you will obtain an approximate dirac.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1000,1)-0.5; %random signal&#xA;y = real(ifft(abs(fft(x)))); %abs() removes the phase&#xA;plot([x y]);&#xA;legend('x','y');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit: trying to clear things up&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example x is a realization of a band limited white noise, as can be seen by plotting the magnitude of its spectrum via &lt;code&gt;plot(abs(x))&lt;/code&gt;.&#xA;The next step is &lt;strong&gt;not&lt;/strong&gt; calculating its autocorrelation function, that would be &lt;code&gt;ifft(fft(x).*conj(fft(x)))&lt;/code&gt; and result in a band limited approximativ dirac function. Instead it takes the magnitude, which is effektively setting the phase of the complex spectrum to zero and transforms that signal back into time domain, and the result is also a band limited appromximative dirac function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of this example is answering this part of the question: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I cannot find any intelligible explanation what makes white noise&#xA;  different from both dirac and resolves the frequency limit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Noting that the theoretical signals white noise and dirac impulse are not bandlimited, therefore they do not exist in real world. I am just giving a descriptive example using real world approximizations, what features have to be altered to convert a noise signal with a flat amplitude spektrum into an impulse signal.&lt;/p&gt;&#xA;" OwnerUserId="4932" LastEditorUserId="4932" LastEditDate="2013-07-06T15:03:08.057" LastActivityDate="2013-07-06T15:03:08.057" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="9847" PostTypeId="1" AcceptedAnswerId="9850" CreationDate="2013-07-05T18:05:09.997" Score="0" ViewCount="2086" Body="&lt;p&gt;I see the following expression from &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quadratic Taylor expansion of the Difference-of-Gaussian scale-space function,  with the candidate keypoint as the origin is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D(\textbf{x}) = D + \frac{\partial D^T}{\partial \textbf{x}}\textbf{x} + \frac{1}{2}\textbf{x}^T \frac{\partial^2 D}{\partial \textbf{x}^2} \textbf{x}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where D and its derivatives are evaluated at the candidate keypoint and $\textbf x = (x,y,\sigma)$  is the offset from this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm very confused about this expression. I don't know why $D^T$ appears and don't understand everything. Is there someone to help me?&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="4682" LastEditDate="2013-07-05T18:41:50.027" LastActivityDate="2018-08-31T03:52:53.397" Title="taylor expansion of scale space function" Tags="|sift|scale-space|taylor-expansion|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9848" PostTypeId="2" ParentId="9547" CreationDate="2013-07-05T19:04:38.737" Score="2" Body="&lt;p&gt;Accuracy is independent of the sampling frequency and frequency, as long as your signals frequency is smaller than half of the sampling frequency. In the noiseless case its also independent of the number of periods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your calculation of the mean of the sample values has no connection to calculating the amplitude of the signal. To calculate the amplitude one would normaly use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a sample Matlab code using your examples, and showing that both give the same amplitude:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x1 = abs(fft(cos([0:pi/2:3/2*pi])));&#xA;x2 = abs(fft(cos([0:pi/2:3/2*pi]+pi/4)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both signals show the same amplitude (which must be scaled properly to get the exact value).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of noise, using multiple periods is kind of averaging, where the following rule holds (for uncorrelated noise): doubling the number of averages (periods) gives 3 dB more SNR (signal to noise ratio).&lt;/p&gt;&#xA;" OwnerUserId="4932" LastActivityDate="2013-07-05T19:04:38.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9850" PostTypeId="2" ParentId="9847" CreationDate="2013-07-05T21:33:26.563" Score="1" Body="&lt;p&gt;The quantity $\frac{\partial D}{\partial \textbf{x}}$ is a vector, since it is the derivative of the scalar function $D(\textbf{x})$ w.r.t. all the elements of $\textbf{x}$. In the formula it is assumed that all vectors are column vectors, so in order to compute the dot product of the derivative $\frac{\partial D}{\partial \textbf{x}}$ and the vector $\textbf{x}$, you need to transpose one of them, which gives you a matrix product row times column (= scalar). The expression $\frac{\partial D^T}{\partial \textbf{x}}$ is simply the transpose of the vector of derivatives. Maybe it would have been clearer to write it as $\left(\frac{\partial D}{\partial \textbf{x}}\right)^T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for the last term you have a row vector times a matrix (second derivative of $D$ w.r.t. $\textbf{x}$) times a column vector, which again results in a scalar value.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2013-07-05T21:33:26.563" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9851" PostTypeId="2" ParentId="9821" CreationDate="2013-07-05T23:11:53.187" Score="1" Body="&lt;p&gt;An IIR is an infinite impulse response filter. If you are monitoring 160 or so frequencies don't use IIRs. FFT will be more suitable for your purposes. Recording at 44.1KHz (CD quality) will allow you to record frequencies of up to a theoretical limit of half of this, so frequencies up to 22.05KHz. However, the closer you approach this limit, the more poorly represented the frequencies will be. You will need to choose an appropriate bin width to be able to discern each frequency accurately. For example, an FFT width of 1024 @ 44.1KHz will give approx 21.53Hz resolution: 22050 / 1024. This means that the FFT can yield information on your frequency range, in 21.53Hz steps. If you then consider your range of interest, 14KHz and above, then this yields the following: 22050 - 14000 = 8050Hz bandwidth; 8050 / 21.53 = 373.9. So you would be able to detect the amplitude and phase of about 373 frequencies between 14KHz and 22.05KHz using an FFT with a width of 1024. Frequencies that fall between these discrete steps of 21.53Hz will muddy your results and may appear to be two neighboring frequencies instead of the one clean frequency. You can increase the FFT width to give you more finer results but it does come at a computational cost. Modern smart phones are able to do an FFT at a width of 1024 in realtime. If you can, I suggest recording the signal at a higher sample rate to give you better signal accuracy first, then pick an FFT width with sufficient resolution for your needs. If the desired signals are pure enough, then the FFT should give you clear results that you can work with. Also my favourite windowing function is: Blackman-Harris, I find it gives the best main lobe to side lobe compromise but you may have to experiment here depending on the results you get. Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4963" LastActivityDate="2013-07-05T23:11:53.187" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9852" PostTypeId="1" AcceptedAnswerId="9853" CreationDate="2013-07-06T08:00:27.410" Score="2" ViewCount="2069" Body="&lt;p&gt;A bit of background information:&#xA;I plan to start experimenting with digital signal processing on microcontrollers. The particular microcontroller I plan to use (TI Stellaris LM4F230H5QR, from the Stellaris Launchpad) has a 12 bit ADC integrated on it, while on the other hand, all DACs I that look like possible candidates for me to use are 8 bit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, before getting the output, I'll have to reduce the bit depth somehow. I could just get an 8 bit ADC and avoid the issue altogether, but I'd like to keep as much of the signal processing line at 12 bits as I can. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions: &#xA;First, am I right in my assumption that by keeping 12 bits for as long as I can, I'll get better results?&lt;br&gt;&#xA;Second, is there a smarter way of turning those 12 bits into 8 bits than just shifting everything to the right four times?&lt;/p&gt;&#xA;" OwnerUserId="4977" LastEditorUserId="4977" LastEditDate="2013-07-06T09:25:34.180" LastActivityDate="2013-07-06T15:45:45.250" Title="12 bit ADC to 8 bit DAC" Tags="|audio|algorithms|sampling|real-time|conversion|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9853" PostTypeId="2" ParentId="9852" CreationDate="2013-07-06T10:29:07.210" Score="3" Body="&lt;p&gt;The first thing I would enjoin you to do is to measure the actual accuracy of your ADC. The 12-bit performance announced by the manufacturer can often be reached only in ideal conditions, such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Using an external precision voltage reference rather than the built-in one.&lt;/li&gt;&#xA;&lt;li&gt;Using a distinct power supply for the analog section of the MCU.&lt;/li&gt;&#xA;&lt;li&gt;Using all the necessary EMI isolation/filtering parts as specified in the app notes... that your target dev. board might not have because of cost cutting (it can be as simple as a ferrite between VCC and AVCC).&lt;/li&gt;&#xA;&lt;li&gt;Using slow sample rates.&lt;/li&gt;&#xA;&lt;li&gt;Preventing any I/O pin to switch during acquisition (eg, disabling a SPI or UART spitting data in the background, disabling interrupts causing a GPIO to be toggled, disabling PWM peripherals..), or even putting the entire chip in sleep mode during acquisition.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In non-ideal conditions, I have seen ADCs lose up to 3 bit of precision. All this to say that your assumption that doing the processing with 12-bit data all along is correct as long as you truly have a resolution of 12-bit on your input; but if it's actually 8 bits because you are far away form the &quot;sweet spot&quot; of the ADC, there's no point keeping and processing 4 bits of noise all the way - you can just do the reduction at the source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Converting from 12 bits to 8 bits through rounding or shifting is going to cause quantization noise correlated with your input signal. &lt;a href=&quot;http://en.wikipedia.org/wiki/Dither&quot; rel=&quot;nofollow&quot;&gt;Dithering&lt;/a&gt; algorithms can be used to solve this problem and spread the quantization error. You also have the option of shifting the quantization noise in a frequency band where it is less harmful, through &lt;a href=&quot;http://en.wikipedia.org/wiki/Noise_shaping&quot; rel=&quot;nofollow&quot;&gt;noise shaping&lt;/a&gt; methods.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-07-06T10:29:07.210" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9854" PostTypeId="2" ParentId="9852" CreationDate="2013-07-06T15:45:45.250" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Questions: First, am I right in my assumption that by keeping 12 bits for as long as I can, I'll get better results?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, you are correct.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Second, is there a smarter way of turning those 12 bits into 8 bits than just shifting everything to the right four times?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sometimes.  Signed shifting to the right four times is the safest way to go, because you are guaranteed not to cause any numerical overflow problems.  Let's say, though, that due to processing gains or starting signal level that you know that the absolute value of the final 12-bit signal will either never be greater than 1023 or that it will happen seldom enough that you are willing to take the distortion hit that will come by saturating the signal when it does happen.  Then you can get rid of the most significant bit (saturating when you need to to avoid numerical overflows) and shifting over three bits.  This introduces less quantization noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note, though, that it is better to use as much of your dynamic range as possible (i.e. use all 12 bits) through AGC's and setting up the processing gain to be as close to 1 as possible at every stage and then shift down by four bits at the end rather than using less dynamic range and shifting less at the end.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-06T15:45:45.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9855" PostTypeId="1" CreationDate="2013-07-06T21:43:23.763" Score="1" ViewCount="3321" Body="&lt;p&gt;I'm doing research on how we can do matching between 2 audio files using Android to see if they have the same content or not. After doing lots of research, I have concluded that I must do 2 main things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;FFT &lt;/li&gt;&#xA;&lt;li&gt;Correlation&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Am I on the right track?&lt;/p&gt;&#xA;" OwnerUserId="4978" LastEditorUserId="76" LastEditDate="2013-07-08T05:29:43.940" LastActivityDate="2014-09-24T16:21:18.023" Title="Matching 2 audio files" Tags="|audio|discrete-signals|fourier-transform|cross-correlation|java|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9857" PostTypeId="2" ParentId="9855" CreationDate="2013-07-07T03:09:19.313" Score="3" Body="&lt;p&gt;It really depends on which application you have...the algorithms for speech recognition are different from speech indentification for example. Based on what you need, just look for an open source library for Java. Getting into the theory is definitely desired but as a first step you can just look for a software block that has inputs/outputs, later you can drill into it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some info on speech recog: &lt;a href=&quot;https://stackoverflow.com/questions/3018418/open-source-simple-speech-recognition-in-c-in-windows&quot;&gt;https://stackoverflow.com/questions/3018418/open-source-simple-speech-recognition-in-c-in-windows&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1468" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-07-07T03:09:19.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9858" PostTypeId="1" CreationDate="2013-07-07T11:26:56.513" Score="1" ViewCount="145" Body="&lt;p&gt;I have a file which is a recorded voice of a single word. The format of this audio file for me is unknown. Could you help me to decode or figure out how it is compressed?&#xA;I was trying to open it as a PCM (8/16 bits), VOX, uLaw, aLaw, but it does not work.. all I can hear is a loud noise.&#xA;Audio file example is at: &#xA;&lt;a href=&quot;http://www45.zippyshare.com/v/91135513/file.html&quot; rel=&quot;nofollow&quot;&gt;http://www45.zippyshare.com/v/91135513/file.html&lt;/a&gt;&#xA;It contains hearable word in english: &quot;approaching&quot;, but I don't know how to decode this.&#xA;Have you ever seen something like this?&lt;/p&gt;&#xA;" OwnerUserId="4979" LastActivityDate="2013-07-07T11:26:56.513" Title="ANS (.raw) audio format" Tags="|audio|" AnswerCount="0" CommentCount="0" ClosedDate="2013-09-18T17:03:08.290" ContentLicense="CC BY-SA 3.0" />
  <row Id="9859" PostTypeId="2" ParentId="9827" CreationDate="2013-07-07T13:53:20.413" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;Remember that FFT always adds delay of the window size, while parametric EQ only adds delay of the number of poles.  FFT filtering is like an N-sized graphic EQ, but with poor resolution at low frequencies and excessive resolution at high frequencies.  (FFT is linear spacing while real graphic EQ is log spacing.) Are you sure you really need that?  Parametric or graphic EQ is usually better.&lt;/li&gt;&#xA;&lt;li&gt;Your problem is most likely due to breaking the signal into blocks and doing FFT filter on each one, which causes the ends of each block to not line up with each other. Diagnosing problems like this requires plotting the waveform and looking at it.  You'll see glitches at every frame boundary.  To fix it, you need to learn about windowing functions, overlapping neighboring windows, etc&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-07-08T16:15:02.647" LastActivityDate="2013-07-08T16:15:02.647" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9860" PostTypeId="1" CreationDate="2013-07-07T17:56:48.243" Score="2" ViewCount="1005" Body="&lt;p&gt;Is it possible to compare two audio samples(meaning find word from one in another) realtime with cross-correlation?&lt;/p&gt;&#xA;" OwnerUserId="4947" LastActivityDate="2013-07-08T04:20:23.387" Title="Is possible to compare to audio samples with cross-correlation" Tags="|fft|cross-correlation|" AnswerCount="3" CommentCount="1" ClosedDate="2013-09-19T13:23:04.527" ContentLicense="CC BY-SA 3.0" />
  <row Id="9861" PostTypeId="2" ParentId="9860" CreationDate="2013-07-07T19:39:37.980" Score="7" Body="&lt;p&gt;No. If the words are pronounced with a different speed or intonation (prosody), or by different speakers, the cross-correlation won't have any significance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A solution more robust to changes in prosody is to use audio features which are less dependent on pitch (such as MFCCs), and a comparison method that is robust to local time stretching (such as DTW or a distance between HMMs). It will still perform poorly when comparing a recording of two different persons saying the same word.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-07-07T19:39:37.980" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9862" PostTypeId="2" ParentId="9860" CreationDate="2013-07-08T01:45:36.483" Score="0" Body="&lt;p&gt;Not possible... what @pichenettes says was right.. &lt;em&gt;&quot;People are not record players - every utterance of a word, even by the same person, has differences in timing, pitch, timbre which can alter the shape of the signal&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;unless @user4947 is saying that it is the same audio file but maybe 1 is a cut out version while the other is full audio file..&lt;/p&gt;&#xA;" OwnerUserId="4959" LastActivityDate="2013-07-08T01:45:36.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9863" PostTypeId="1" CreationDate="2013-07-08T02:11:06.010" Score="2" ViewCount="196" Body="&lt;p&gt;I am reading several papers applying anisotropic diffusion in the transform domain like Shearlet, curvelet. All of them have got excellent results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physical meaning and principle of applying anisotropic diffusion in space domain is quiet straightforward -- the gradient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused as to the physical meaning and principle of applying anisotropic diffusion in the transform domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Papers, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=04717218&quot; rel=&quot;nofollow&quot;&gt;Shearlet-Based Total Variation Diffusion for Denoising&#xA;Glenn R. Easley, Member, IEEE, Demetrio Labate, and Flavia Colonna&#xA;IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 18, NO. 2, FEBRUARY 2009&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4813" LastEditorUserId="76" LastEditDate="2013-07-08T05:22:04.803" LastActivityDate="2013-09-06T15:21:06.733" Title="What's the physical meanning and principle of applying anisotropic diffusion in transform domain？" Tags="|image-processing|wavelet|anisotropic-diffusion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9864" PostTypeId="2" ParentId="9863" CreationDate="2013-07-08T03:02:39.283" Score="1" Body="&lt;p&gt;Physically, there is usually not much implied meaning (but this may depend on a case-by-case basis). Transforms like shearlets are actually used to embed the data into anisotropic or edge-aware transform domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, it may make more sense. Isotropic diffusion tends to create blur (smear) in whatever domain it is applied. Thus, if you want to obtain a result that is compact in the considered domain, be it transformed or not, applying non-isotropic diffusion is very tempting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to see it mathematically, is to understand that &lt;strong&gt;isotropic diffusion&lt;/strong&gt; corresponds to solving a &lt;strong&gt;least square problem&lt;/strong&gt; that will create many small non-zero coefficients by trying to spread the error everywhere. However, a helpful and widely available assumption about signal is their &lt;strong&gt;sparsity&lt;/strong&gt; in the transform domain, i.e., they have few non-zero coefficients in a suitably chosen transform domain that concentrate the energy. This corresponds to solving problems where the exponent of the norm of the prior term is less than 2 (typically 1) and thus the use of anisotropic diffusion to find a solution.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-07-08T14:50:16.850" LastActivityDate="2013-07-08T14:50:16.850" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9865" PostTypeId="2" ParentId="9860" CreationDate="2013-07-08T04:14:33.083" Score="3" Body="&lt;p&gt;No.  Human word recognition is a very complex psycho-perceptual phenomena.  Things that sound like the same word to a human can have completely different waveforms with near zero correlation (different pitch frequencies and tonal modulations, timings, formant centers, surrounding context, etc.etc.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-08T04:20:23.387" LastActivityDate="2013-07-08T04:20:23.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9866" PostTypeId="1" AcceptedAnswerId="9981" CreationDate="2013-07-08T08:05:57.187" Score="4" ViewCount="2309" Body="&lt;p&gt;Let's say I have two images that are parts of the same bigger image, cut using two masks (for simplicity, let's assume that the masks are just rectangles of the same size). The images are presumed to overlap. The concrete examples are: image stabilization (two different views of the same background) and object tracking (matching the object on two images).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read this excellent article &lt;a href=&quot;http://werner.yellowcouch.org/Papers/subimg/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://werner.yellowcouch.org/Papers/subimg/&lt;/a&gt;, but it deals with finding the displacement of a small image which is a part of a large one, while I want to find displacement between the images of the same size. My images intersect, but don't contain each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the coefficients of the translation transform which correctly overlaps the matching parts of the images.&#xA;I want to use something like FFT-based correlation matching. I have the following problems with simply using FFT-correlation:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The edges of the image frames are strong features. If the algorithm searches the displacement $[dx, dy]$ that maximizes something like $\sum_{x,y}{a[x, y]}b[x + dx, y + dy]$, it would just snap the images so that their frames match, disregarding the content. I heard about windowing, but I don't understand how to apply it here. If each image is tapered at the edges, the images would no longer match when positioned correctly.&lt;/li&gt;&#xA;&lt;li&gt;If we use a correlation function that normalizes the result by dividing it by the area of intersection resulting from the displaced matching, the algorithm would just try to keep the intersection to a minimum (~1x1 pixel; the smaller the intersection area is, the easier it is to find a nearly perfect match.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How to solve this matching problem using windowing or some other techniques?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I know that the problem can be partially eliminated by discarding the low-frequency information (taking gradient or applying the Sobel operator). I'm trying to solve the problem without discarding the low frequency information.&#xA;Also, leaving only high-frequency features still doesn't solve the outlined problem: Imagine an image with a bright thin horizontal beam and a bleak square. These features are high-frequency and thus will remain after the filter is applied. Cross-correlation will than match the bright beam parts ignoring the square.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the example which shows the matching problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Full image with frame borders:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vd0w0.png&quot; alt=&quot;Full image with frame borders&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Frames 1 and 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pSDJm.png&quot; alt=&quot;Frame 1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4FpSc.png&quot; alt=&quot;Frame 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Correlation-based incorrect frame matching:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cd7Ho.png&quot; alt=&quot;Correlation-based incorrect matching&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4980" LastEditorUserId="4980" LastEditDate="2013-07-18T10:50:15.153" LastActivityDate="2013-07-20T00:06:09.657" Title="Matching masked images" Tags="|image-processing|fft|window-functions|correlation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9868" PostTypeId="2" ParentId="124" CreationDate="2013-07-08T12:54:51.867" Score="8" Body="&lt;p&gt;What you have is a very good and efficient oscillator. The potential numerical drift problem can actually be solved. Your state variable v has two parts, one is eseentially the real part and the other the imaginary part. Let's call then r and i. We know that r^2+i^2 = 1. Over time this may drift up and down, however that can easily be corrected by multiplication with a gain correction factor like this &lt;span class=&quot;math-container&quot;&gt;$$g = \frac{1}{\sqrt{r^{2}+i^{2}}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this is very expensive, however we know that the gain correction is very close to unity and we can approximate this with a simple Taylor expansion to &#xA;&lt;span class=&quot;math-container&quot;&gt;$$g = \frac{1}{\sqrt{r^{2}+i^{2}}}\approx \frac{1}{2}\cdot \left ( 3-(r^{2}+i^{2}) \right )$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover we don't need to do this on every single sample, but once every 100 or 1000 samples is more than enough to keep this stable. This is particularly useful if you do frame based processing. Updating once per frame is just fine. Here is a quick Matlab calculates 10,000,000 samples. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% seed the oscillator&#xA;% set parameters&#xA;f0 = single(100); % say 100 Hz&#xA;fs = single(44100); % sample rate = 44100;&#xA;nf = 1024; % frame size&#xA;&#xA;% initialize phasor and state&#xA;ph =  single(exp(-j*2*pi*f0/fs));&#xA;state = single(1 + 0i); % real part 1, imaginary part 0&#xA;&#xA;% try it&#xA;x = zeros(nf,1,'single');&#xA;testRuns = 10000;&#xA;for k = 1:testRuns&#xA;  % overall frames&#xA;  % sample: loop&#xA;  for i= 1:nf&#xA;    % phasor multiply&#xA;    state = state *ph;&#xA;    % take real part for cosine, or imaginary for sine&#xA;    x(i) = real(state);&#xA;  end&#xA;  % amplitude corrections through a taylor exansion aroud&#xA;  % abs(state) very close to 1&#xA;  g = single(.5)*(single(3)-real(state)*real(state)-imag(state)*imag(state) );&#xA;  state = state*g;&#xA;end&#xA;fprintf('Deviation from unity amplitude = %f\n',g-1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="18819" LastEditDate="2019-12-06T22:06:47.947" LastActivityDate="2019-12-06T22:06:47.947" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9870" PostTypeId="2" ParentId="471" CreationDate="2013-07-08T16:53:35.867" Score="4" Body="&lt;p&gt;Image Processing with Matlab, &lt;a href=&quot;http://imageprocessingblog.com/&quot; rel=&quot;nofollow&quot;&gt;Open Blog&lt;/a&gt;.&#xA;hands-on, with the Matlab code of the problem and with clear, easy to follow documentation.&#xA;Open for people to present their work in image processing with Matlab.&lt;/p&gt;&#xA;" OwnerUserId="4984" LastActivityDate="2013-07-08T16:53:35.867" CommentCount="0" CommunityOwnedDate="2013-07-08T16:53:35.867" ContentLicense="CC BY-SA 3.0" />
  <row Id="9872" PostTypeId="1" CreationDate="2013-07-09T00:53:09.223" Score="1" ViewCount="523" Body="&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This question is purely theoretical and should not account for any psychoacoustic effects, or practical implementations.&lt;/li&gt;&#xA;&lt;li&gt;Perhaps the question should be rephrased to &amp;quot;How long will it take to apply the smoothest possible fade, in a single precision system&amp;quot;?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;A sine wave is generated within a 32-bit float system, with a sample rate of 44.1 kHz. The task in hand is to fade out this sine with as little digital distortion as possible (this is the meaning of 'properly'), without using dither. The maths below resolves to approximately 6 minutes and 20 seconds to do so. Is this correct?&lt;/p&gt;&#xA;&lt;h1&gt;Axioms&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Digital audio within a 32-bit float system is represented with the values -1.0 to 1.0&lt;/li&gt;&#xA;&lt;li&gt;All the values within this range are normalized&lt;/li&gt;&#xA;&lt;li&gt;The sine wave peaks at 1.0 and -1.0&lt;/li&gt;&#xA;&lt;li&gt;The audio resolution is &lt;span class=&quot;math-container&quot;&gt;$2^{25}$&lt;/span&gt;, made of 23 bit mantissa + 1 implied (normalized) bit + 1 sign bit.&lt;/li&gt;&#xA;&lt;li&gt;The possible gain coefficients are &lt;span class=&quot;math-container&quot;&gt;$2^{24}$&lt;/span&gt;, with values ranging between 0.0 to 1.0&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;Fading out&lt;/h1&gt;&#xA;&lt;p&gt;Any fade will create distortion due to quantisation of the gain values.&lt;/p&gt;&#xA;&lt;p&gt;For instance, a fade from unity gain (1.0) to silence (0.0), if happens between two consecutive samples, is similar to 1-bit reduction (this will generate high and low frequency distortion correlated to the phase of the sine). If the fade is performed over 4 samples, there will be 4 gain steps; 8 samples mean 8 gain steps; and so forth.&lt;/p&gt;&#xA;&lt;p&gt;It follows that the smoothest fade possible is that where between each sample the gain changes by the minimum possible amount, which is &lt;span class=&quot;math-container&quot;&gt;$1/2^{24}$&lt;/span&gt;. This gives &lt;span class=&quot;math-container&quot;&gt;$2^{24}$&lt;/span&gt; gain steps.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$2^{24} = 16,777,216$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Meaning 16,777,216 samples are needed for the fade. If the system sample rate is 44,100 Hz:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$16,777,216 / 44,100 = ~380.4$&lt;/span&gt; seconds.&lt;/p&gt;&#xA;&lt;p&gt;Which equals approximately 6 minutes and 20 seconds.&lt;/p&gt;&#xA;&lt;p&gt;This seems unreasonable. So where is the calculation wrong?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Just to further demonstrate what distortion I am talking about.&lt;/p&gt;&#xA;&lt;p&gt;The original sine and its frequency analysis:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xLhNx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;With a long fade:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PyeqW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;With a medium fade (50 samples):&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nbLzt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;And with a 1-sample fade:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e171Q.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="4576" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-07-09T22:45:56.380" Title="Does it really take 6 minutes and 20 seconds to properly fade-out a single precision audio signal?" Tags="|audio|floating-point|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9874" PostTypeId="2" ParentId="9872" CreationDate="2013-07-09T04:43:23.237" Score="10" Body="&lt;p&gt;You start off with wrong assumptions, so your result is nonsensical.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your definition of good and bad should be based on some psychoacoustic understanding of what type if distortion and artifact is actually audible and/or objectionable&lt;/li&gt;&#xA;&lt;li&gt;The 24-bit mantissa argument (it if were valid at all) would only hold a fixed point number. In floating point you can apply pretty much any gain you want. The smallest non-zero gain is actually 1.1755e-38.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are various different ways to design a fade: linear, quasi-log, &quot;half-window&quot; functions, all kinds of continous derivative functions etc. They all sound slightly different and the best choice really depends on your application: musical fade, cross-fade between two signals, emergency fade out that needs to be fast, etc.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-07-09T05:00:07.603" LastActivityDate="2013-07-09T05:00:07.603" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9875" PostTypeId="1" CreationDate="2013-07-09T06:33:33.060" Score="1" ViewCount="121" Body="&lt;p&gt;I have a device with an accelerometer and I want to make it as precise as possible (using algorithms). Currently no DSP algorithm is running - I am reading values as they are. I've made 3 tests - in each I rotated the device around one of the axes and recorded the values coming out from accelerometer. It would be perfect if each of the tests would produce a perfect circle; this would mean no further calibration is needed. &lt;strong&gt;The desired precision is +- 10mg (+- 1%). For example, the mean value when Z axis is maximal is 1024mg. 1010mg would be acceptable.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are the results of tests (&lt;a href=&quot;http://pastebin.com/raw.php?i=kw0UmtHP&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab copy-paste to display&lt;/a&gt;). Is it enough to test the three axes or should I also test the cases where the gravity gets distributed in all of the axes? Further; what approach would you suggest considering calibration to 1% precision (please be specific).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a thorough answer on this topic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Rotation around X axis:&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kMvMA.jpg&quot; alt=&quot;X-axis&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Round Y axis:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KgQbf.jpg&quot; alt=&quot;Y-axis&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Round Z axis:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bB0x8.jpg&quot; alt=&quot;Z-axis&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1798" LastEditorUserId="1798" LastEditDate="2013-07-09T08:28:34.267" LastActivityDate="2013-07-09T16:43:41.177" Title="Is my accelerometer precise enough?" Tags="|noise|signal-analysis|software-implementation|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9876" PostTypeId="1" CreationDate="2013-07-09T10:12:58.477" Score="2" ViewCount="2814" Body="&lt;p&gt;i have a problem in ofdm modulation .... there is a stream of bits that is converted from serial to parallel and is applied to an IFFT block. based on the definition of IFFT the output should be an complex valued number. how does it represent the real and imaginary parts in the digital domain( bits 0,1) ? &lt;/p&gt;&#xA;" OwnerUserId="4989" LastEditorUserId="1606" LastEditDate="2013-07-12T06:35:00.243" LastActivityDate="2023-10-09T22:54:08.237" Title="what does the output of ifft in ofdm look like?" Tags="|ofdm|ifft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9877" PostTypeId="1" CreationDate="2013-07-09T11:47:46.853" Score="24" ViewCount="32790" Body="&lt;p&gt;I have a set of songs for which I extracted the magnitude spectrogram using a Hamming Window with 50% overlap. After extracting the spectrogram, I did some dimensionality reduction using Principal Components Analysis (PCA). After reducing it to lower dimensionality, I reconstructed the spectrograms from lower dimensions. So now, there would be some error between the original spectrogram and the reconstructed spectrogram. I would like to convert this spectrogram back to the audio signal and play it, so that I would be able to know when reconstructed from lower dimensions, how does the audio sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any function available in say Matlab. to convert a magnitude Spectrogram to an audio signal ??&lt;/p&gt;&#xA;" OwnerUserId="4990" LastEditorUserId="4990" LastEditDate="2013-07-09T11:55:18.950" LastActivityDate="2018-11-22T13:52:46.217" Title="Reconstruction of audio signal from Spectrogram" Tags="|audio|spectrogram|ifft|" AnswerCount="4" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9878" PostTypeId="1" AcceptedAnswerId="9885" CreationDate="2013-07-09T12:02:51.307" Score="0" ViewCount="109" Body="&lt;p&gt;I'm trying to reproduce this &lt;strong&gt;!!!WARNING LOUDNESS!!!&lt;/strong&gt; &lt;a href=&quot;http://music.columbia.edu/cmc/musicandcomputers/sounds/chapter4/vib2.mp3&quot; rel=&quot;nofollow&quot;&gt;sound&lt;/a&gt; in C. In the website, it says to use &lt;em&gt;Carrier: 500 Hz, modulator frequency: 1 Hz, modulator index: 500&lt;/em&gt;, however I'm getting lots of clicks and fuzzing (along with the right sound) with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;#include &amp;lt;string.h&amp;gt;&#xA;&#xA;#define DURATION    20&#xA;#define RATE        44100&#xA;#define NUMCHANS 1&#xA;&#xA;#define NUMSAMPLES  (DURATION*RATE)&#xA;#define NUMSAMPLESC (NUMSAMPLES*NUMCHANS)&#xA;&#xA;#define BYTES_IN_HEADER (11*sizeof(int))&#xA;#define BYTES_IN_BUFFER (NUMSAMPLESC*sizeof(short) + BYTES_IN_HEADER)&#xA;&#xA;#define DELTAT (1.0/RATE)&#xA;&#xA;#define M_PI 3.14159265359&#xA;&#xA;static const int wavHeader[] = {&#xA;0x46464952, &#xA;NUMSAMPLESC*2+36, &#xA;0x45564157, &#xA;0x20746D66, &#xA;16, &#xA;1|(NUMCHANS&amp;lt;&amp;lt;16), &#xA;RATE, &#xA;RATE*NUMCHANS*sizeof(short), &#xA;(NUMCHANS*sizeof(short))|((8*sizeof(short))&amp;lt;&amp;lt;16),&#xA;0x61746164, &#xA;NUMSAMPLES*sizeof(short)&#xA;};&#xA;&#xA;static short buffer[BYTES_IN_BUFFER/sizeof(short)];&#xA;&#xA;int main(void) {&#xA;&#xA; unsigned int i;&#xA; double t = 0.0;&#xA; FILE *fp;&#xA;&#xA; memcpy(buffer, wavHeader, BYTES_IN_HEADER);&#xA;&#xA;for(i = BYTES_IN_HEADER/sizeof(short); i &amp;lt; BYTES_IN_BUFFER/sizeof(short); i++, t += DELTAT) {&#xA;    buffer[i] = 100 * sin(2*M_PI*500*t + 500*sin(t*2*M_PI*1));&#xA;}&#xA;&#xA; fp = fopen(&quot;test.wav&quot;, &quot;w&quot;);&#xA; fwrite(buffer, 1, BYTES_IN_BUFFER, fp);&#xA;&#xA;fclose(fp);&#xA;&#xA;return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried using single precision floats, reversing endianness, but with the same result. The only thing that seems to remove the clicks and fuzzing to a certain extent (but they're still there) is if i copy the lower 8 bits of each sample into the upper 8 bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My sound card is integrated from a P43DE3 motherboard and can handle audio CDs well, and my OS is Windows 8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I reproduce that sound without noise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to produce the correct output when I run it on a Mac. Perhaps and endianness error? Will investigate further.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="4991" LastEditDate="2013-07-09T21:16:33.663" LastActivityDate="2013-07-09T21:53:06.710" Title="FM synthesis fuzzy sound" Tags="|frequency|modulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9879" PostTypeId="1" AcceptedAnswerId="9894" CreationDate="2013-07-09T13:09:26.947" Score="3" ViewCount="304" Body="&lt;p&gt;Say you want to compute the least squares estimate of $w$ from a data-set:&#xA;$$&#xA;\begin{bmatrix}d_1 \\d_2 \\\vdots\\d_N \end{bmatrix} =\begin{bmatrix} x_1 \\x_2 \\ \vdots \\x_N\end{bmatrix}w + \begin{bmatrix} q_1 \\q_2 \\ \vdots \\q_N\end{bmatrix}&#xA;$$&#xA;Note: $q$ is white noise. &#xA;This can be compactly written as &#xA;$$&#xA;\mathbf{d}= \mathbf{H}w + \mathbf{q} &#xA;$$&#xA;The least squares estimate of $w$ which I shall call $w^*$ is given by&#xA;\begin{align}&#xA;w^* =&amp;amp;  (\mathbf{H}^T\mathbf{H})^{-1}\mathbf{H}\mathbf{d}\\&#xA;   =  &amp;amp; \Big(\sum_{i =1} ^{N}x_i^2 \Big) ^{-1} \Big(\sum_{i =1} ^{N}x_id_i \Big)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have $N/2$ of the sample and my friend has the other half of the data set. We compute the least squares estimate separately. How do we now combine our estimates of $w^*$ besides 'averaging' it? &lt;/p&gt;&#xA;" OwnerUserId="4096" LastEditorUserId="128" LastEditDate="2019-06-26T08:46:59.183" LastActivityDate="2019-06-26T08:46:59.183" Title="How to Combine / Fuse 2 Least Squares Estimates?" Tags="|estimation|kalman-filters|least-squares|" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9880" PostTypeId="2" ParentId="9876" CreationDate="2013-07-09T15:02:27.583" Score="3" Body="&lt;p&gt;You are correct that the output of the IFFT will normally have both a real and imaginary component.  That is fine and normal.  When the signal is modulated from baseband to the carrier frequency the real part is typically modulated by a sine wave and the imaginary part by a cosine (or vice versa).  This allows both parts to coexist without interfering with each other, since sines and cosines have zero cross-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding how the numbers are represented digitally, they are represented the exact same way that real numbers are represented.  The only difference is that there is an extra set of numbers for the imaginary part of the signal.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-09T15:02:27.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9881" PostTypeId="2" ParentId="9879" CreationDate="2013-07-09T15:05:17.513" Score="0" Body="&lt;p&gt;A variant of the averaging would be to add the data sets before solving for w. This would automatically weight the result by favoring the data with more signal power.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-09T15:05:17.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9882" PostTypeId="2" ParentId="9872" CreationDate="2013-07-09T16:17:33.923" Score="0" Body="&lt;p&gt;Okay, let's try this again based on the edits: In order to determine the &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;least distorted signal&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;you have to first precisely define a distortion metric. A fading sine wave is by definition not a sine wave any more and has certain spectral properties which are related to the fading function (shape and length). This is completely independent of the quantization and would happen regardless of precision. How is an &quot;undistorted faded sine wave&quot; supposed to look like?&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-07-09T16:17:33.923" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9883" PostTypeId="2" ParentId="9875" CreationDate="2013-07-09T16:43:41.177" Score="4" Body="&lt;p&gt;Typically you can improve performance by analyzing the data that you want and analyzing the data that you don't want. I would assume that a plane can't turn infinitely fast so the actual &quot;want&quot; data is properly fairly band limited. Depending on how fast you are sampling the accelerometer you may pick up a lot of &quot;out of bandwidth&quot; noise. This could easily be improved with a low pass filter or some moving average contraption.  The more you know about the properties of the actual signal and the properties of the noise, the better you can separate the two.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-07-09T16:43:41.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9884" PostTypeId="2" ParentId="9877" CreationDate="2013-07-09T20:08:15.087" Score="2" Body="&lt;p&gt;You can use the reconstructed spectrogram versus the original spectrogram to design a filter whose magnitude response transforms one spectrogram to the other.  You can then apply this filter to the original time domain data, or to the original FFTs for overlap add/save fast convolution filtering.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-07-09T20:08:15.087" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="9885" PostTypeId="2" ParentId="9878" CreationDate="2013-07-09T21:53:06.710" Score="1" Body="&lt;p&gt;OK, I figured out what the problem was using a hex editor. The compiler on Windows was seemingly introducing random 0x0D throughout the file. That's because of the mode I was opening the file with, &quot;w&quot;. fwrite converted every instance of '\n' into &quot;\r\n&quot;. All I had to do was change the file opening mode to &quot;wb+&quot;, and it sounds exactly like the linked audio file, after changing the carrier amplitude to 2e5.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2013-07-09T21:53:06.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9886" PostTypeId="2" ParentId="9876" CreationDate="2013-07-10T06:15:54.393" Score="1" Body="&lt;p&gt;Your question is somewhat ambiguous but i'll try to answer it according to my understanding of it.&lt;br&gt;&#xA;You have an OFDM system, a serial input say s(n). &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing#Transmitter&quot; rel=&quot;nofollow&quot;&gt;Your block diagram will look like this&lt;/a&gt;.&lt;br&gt;&#xA;The signal is converted from serial to parallel. The number of parallel channels depend on N point IFFT block. ie. an 8 pt IFFT will have 8 parallel channels &amp;amp; hence the input will be represented in 8 PSK constellation. As seen from the diagram, IFFT separates real &amp;amp; imaginary parts.&lt;br&gt;&#xA;If your question is how these 2 signals are represented in digital domain then the answer is since you used 8 PSK constellation to represent them before IFFT, they are represented as 8 PSK only. Both Real &amp;amp; Imaginary parts.&lt;br&gt;&#xA;Real &amp;amp; Imaginary parts are just numbers when they are separated. It is when they are combined that they have magnitude &amp;amp; phase information.&lt;br&gt;&#xA;These are then converted to Analog signals(continuous time) &amp;amp; modulated using cos &amp;amp; sin(orthogonal carriers).&lt;br&gt;&#xA;Then they are added to form s(t). This signal s(t) is transmitted.&lt;br&gt;&#xA;If your question is how this signal is represented in digital then the answer is it can either be PCM-ed or PSK-ed depending on transmitting media. It is represented as a bunch of 1 &amp;amp; 0 but order depends on coding&lt;/p&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2013-07-10T06:15:54.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9887" PostTypeId="1" CreationDate="2013-07-10T09:06:49.597" Score="0" ViewCount="658" Body="&lt;p&gt;I have an irregular shaped 3D image that I want to do frequency domain filtering on. Currently I simply zero-pad the data to make it a cube, then do an fft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if this was a valid approach and what effects this may have. Are there any alternate (better ways) to do this, and if so could you point me in the direction of some literature?&lt;/p&gt;&#xA;" OwnerUserId="4996" LastActivityDate="2013-07-10T09:06:49.597" Title="FFT of irregular shaped data" Tags="|fft|algorithms|frequency-domain|filtering|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="9890" PostTypeId="2" ParentId="5947" CreationDate="2013-07-10T15:23:56.743" Score="0" Body="&lt;p&gt;I think you need some kind of &quot;resolution&quot; in the data. Think you have to convert it to a regular grid. I would say: &quot;no periodicity analysis without data, that has a periodic grid&quot;. Correct me if I'm wrong, but I think the fft needs a lower boundary, which is the resolution and a higher boundary, which is the total colums and rows. If you work with points on a 2d plane, whose positions are set by floating point numbers, the fft would have to search for infinitesimal small frequencys. But follow &lt;a href=&quot;https://dsp.stackexchange.com/questions/9887/fft-of-irregular-shaped-data&quot;&gt;this question&lt;/a&gt; about fft of irregular shaped data. Maybe someone comes up with an idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example you could do a 2d histogram with bins that are so small that they hold only one or two values. This way you get a rectangular grid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did 2D fft on a rectangular grid with data that is distributed in a similar way as yours and got a very fuzzy 2D spectrograph like posted in my question &lt;a href=&quot;https://stackoverflow.com/questions/17022379/image-smoothing-in-r/17061688#17061688&quot;&gt;here&lt;/a&gt; with still some peaks that standout a bit more. I think your spectrograph should also show many frequencys distributed all over the 2D plane, so I think your method to derive it is not quite right. Unfortunately I can't help you with matlab.&lt;/p&gt;&#xA;" OwnerUserId="4678" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-07-10T15:23:56.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9891" PostTypeId="2" ParentId="8586" CreationDate="2013-07-10T15:48:59.063" Score="0" Body="&lt;p&gt;I would probably combine a few approaches. First I would smooth both waveforms or do a spline interpolation to remove the large scale variations. You might want to combine another step after that of a cross-correlation to line them up, supposing time bias doesn't matter to you. Once you've got the cross-correlation peak you could even interpolate that peak on a parabola shape and then re-sample one waveform to match the other. I'd compute the RMSE between the two waveforms at that point and produce one metric indicating the slowly varying delta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that I'd subtract the interpolated value from the original so the deviations on small time scales are normalized. From there you could try to RMSE them against each other or even just compute a variance of each, to get a notion of how much &quot;noise&quot; you have about the slowly varying waveform, depending on what you need and what you're actually trying to measure.&lt;/p&gt;&#xA;" OwnerUserId="1678" LastActivityDate="2013-07-10T15:48:59.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9892" PostTypeId="1" CreationDate="2013-07-10T15:53:22.380" Score="2" ViewCount="115" Body="&lt;p&gt;during Zimmerman trial, each camp claimed the yell for help recorded belonged to their side.  given that Zimmerman is still aside and the recording still exist, could there be some scientific way to tell which way?&lt;/p&gt;&#xA;" OwnerUserId="4999" LastActivityDate="2013-07-11T00:34:06.337" Title="voice recognition" Tags="|speech-recognition|voice|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9894" PostTypeId="2" ParentId="9879" CreationDate="2013-07-09T13:57:06.907" Score="5" Body="&lt;p&gt;I'm unsure if this is the answer you are looking for, but why not save and share $|H_i|^2$ in addition to the least squares estimates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have $w_1^*=\frac 1 {|H_1|^2} H_1^t d_1$, $w_2^*=\frac 1 {|H_2|^2} H_2^t d_2$, and also know $|H_1|^2$ and $|H_2|^2$, you get the total least squares estimate with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w^*=\frac 1 {|H_1|^2+|H_2|^2} (H_1^t d_1 + H_2^t d_2)=\frac{|H_1|^2}{|H_1|^2+|H_2|^2}w_1^*+\frac{|H_2|^2}{|H_1|^2+|H_2|^2}w_2^*$.&lt;/p&gt;&#xA;" OwnerUserId="5002" OwnerDisplayName="Wolf" LastActivityDate="2013-07-09T13:57:06.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9895" PostTypeId="1" CreationDate="2013-07-10T16:22:25.793" Score="3" ViewCount="705" Body="&lt;p&gt;Savitzky-Golay smoothing filters of polynomial degrees 4 and 6&#xA;have frequency response with ripples of roughly opposite signs.&#xA;Thus averaging the coefficients of two filters of degrees d and d+2&#xA;is an easy way to attenuate the stopband:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lX8Od.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain the roughly opposite ripples &amp;mdash;&#xA;or are they just a lucky coincidence ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The coefficients were generated with this python:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def savgol_coef( N=33, d=4 ):&#xA;    &quot;&quot;&quot; Savitzky-Golay filter coefficients&#xA;        see e.g. Numerical Recipes http://apps.nrbook.com/empanel/index.html?pg=772&#xA;        d odd, e.g. 5 -&amp;gt; av 4, 6: cutoff between, stopband lower&#xA;    &quot;&quot;&quot;&#xA;    assert N % 2 == 1, &quot;filter width N must be odd, not %d&quot; % N&#xA;    if d % 2 == 1:&#xA;        return (savgol_coef( N, d - 1 )&#xA;            +   savgol_coef( N, d + 1 )) / 2  # roughly opposite ripples ?&#xA;    x = np.arange( - (N//2), N//2 + 1. )&#xA;    A = np.array([ x**k for k in range( d+1 )]) .T  # Ajk = basisk( xj )&#xA;    # print A&#xA;    return np.linalg.pinv( A )[0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4389" LastActivityDate="2013-07-10T16:22:25.793" Title="Why do Savitzky-Golay filters of degrees 4 and 6 have roughly opposite ripples?" Tags="|filters|lowpass-filter|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9896" PostTypeId="2" ParentId="9892" CreationDate="2013-07-10T17:00:17.190" Score="2" Body="&lt;p&gt;There exist DSP techniques to estimate anatomical differences in head resonance (vowel formant centers, etc.) and glottal fold characteristics (e.g. Tenor vs Bass, etc.) used in music, speech and audiology research.  However there may or may not be sufficient statistical difference is these areas between the two possible vocalization sources, or the mic response may not been sufficient to pick up and record the frequency bands and transients of interest with sufficient detail (too low S/N, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If sufficient recordings of one of the voice sources do not exist, the vocal production might have to be estimated from MRI data reconstruction of the vocal tract, which introduces its own set of estimation errors.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-11T00:34:06.337" LastActivityDate="2013-07-11T00:34:06.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9898" PostTypeId="1" CreationDate="2013-07-10T17:59:55.863" Score="1" ViewCount="42" Body="&lt;p&gt;I have three orthogonal accelerometers that give accelerations in x,y and z dimensions. I'm trying to detect directional vibrations between certain frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, my input is 3d vector and I would like detect signal coming from unknown direction, filter out noise from other directions and turn the signal into normal scalar for further processing.&lt;/p&gt;&#xA;" OwnerUserId="5000" LastActivityDate="2013-07-10T17:59:55.863" Title="How to detect directional signal in three dimensions?" Tags="|filters|3d|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9899" PostTypeId="1" AcceptedAnswerId="10076" CreationDate="2013-07-10T18:15:50.847" Score="0" ViewCount="510" Body="&lt;p&gt;Hello I am trying to computer the Complex Cepstral Transform of an audio signal. I am using &lt;code&gt;wavread&lt;/code&gt; to get an array of data type double precision. However, when I try to use &lt;code&gt;cceps&lt;/code&gt; to do the Complex Cepstral Transform, I get the following error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error using cceps&amp;gt;chkinput (line 157)&#xA;The input signal X must be real.&#xA;&#xA;Error in cceps (line 73)&#xA;chkinput(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something I am doing wrong or is there another way to do this transform? Thank you! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I tried computing this manually using the definition of the complex cepstral transform as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;C=ifft(ln(fft(f)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where f is the array of double precision audio data. However, this returns the error: &lt;code&gt;&#xA;Undefined function 'ln' for input arguments of type 'double'.&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4937" LastActivityDate="2013-07-26T12:15:44.083" Title="Complex Cepstral Transform on Audio in MATLAB" Tags="|matlab|audio|wavelet|signal-analysis|transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9900" PostTypeId="1" CreationDate="2013-07-10T18:29:14.963" Score="3" ViewCount="150" Body="&lt;p&gt;I'm looking for literature or other information that covers iteratively estimating the auto- and cross-correlation vectors and the auto-correlation matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially, I can assume the signal is wide-sense stationary, but I also have to deal with changing signals and statistics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what it's worth, I looked at two simple algorithms in the matlab code below, showing the variance calculation (red) and a leaky integrator (blue). I also have a boxcar filter (green). The code is shown below, along with a plot of the results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, except for the variance calculation in red, the results vary a lot from one run to another. I'm reluctant to get too creative without examining any papers on the subject to get a more rigorous and analytical understanding of how to go about this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the long run, this gets implemented into an FPGA, so hardware resources are limited and I need to take that into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where can I find information specifically on this topic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Also, help with the tags on this would be appreciated.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 10;&#xA;historyLength = 200;&#xA;mu = 1/historyLength;&#xA;p1 = conj(referenceSignal(n))*referenceSignal(1:n);&#xA;p2 = p1;&#xA;&#xA;pBox = zeros(historyLength,n);&#xA;pBox(1,:) = p1;&#xA;pBox(1,:) = p1;&#xA;pBoxIndex = 2;&#xA;pBoxFillLevel = 1;&#xA;&#xA;figure(100);&#xA;hold on;&#xA;for index = n+1:sampleCount&#xA;    X = referenceSignal(index+1-n:index);&#xA;    d = conj(referenceSignal(index));&#xA;    deltaP = d*X;&#xA;    p1 = (p1*(index-n-1) + deltaP)/(index-n);&#xA;    p2 = (1-mu)*p2 + mu*deltaP;&#xA;    pBox(pBoxIndex,:) = deltaP;&#xA;    p3 = sum(pBox,1)/pBoxFillLevel;&#xA;    plot(index, p1(n),'r');&#xA;    plot(index, p2(n), 'b');&#xA;    plot(index, p3(n), 'g');&#xA;&#xA;    if pBoxFillLevel &amp;lt; historyLength&#xA;        pBoxFillLevel = pBoxFillLevel+1;&#xA;    end;&#xA;&#xA;    pBoxIndex = pBoxIndex+1;&#xA;    if pBoxIndex &amp;gt; historyLength&#xA;        pBoxIndex = 1;&#xA;    end;&#xA;&#xA;end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Za7eB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3378" LastActivityDate="2013-07-10T18:29:14.963" Title="Iterative Auto and Cross Correleation Estimates" Tags="|cross-correlation|autocorrelation|estimation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9901" PostTypeId="1" CreationDate="2013-07-10T18:40:09.743" Score="1" ViewCount="810" Body="&lt;p&gt;Hello I am working on audio watermarking in MATLAB and am trying to choose specific frames of the audio signal where the watermark will be embedded. Through research, I have read that the best way to do this is to choose parts/samples of the audio signal that are the loudest, or above a certain threshold. By using &lt;code&gt;wavread&lt;/code&gt; in MATLAB, the result is an array of the audio data in type double precision, which represent the sound pressure at a given sample. My question is, since the numbers represent sound pressure, will the loudest portions of the audio signal be the largest numbers? If not, is there another way to achieve what I am trying to do? Thank you! &lt;/p&gt;&#xA;" OwnerUserId="4937" LastEditorUserId="1543" LastEditDate="2013-07-10T21:30:13.043" LastActivityDate="2013-10-09T11:55:19.730" Title="Audio Watermarking in MATLAB - How to choose frames to embed in?" Tags="|matlab|audio|signal-analysis|wave|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9902" PostTypeId="2" ParentId="9901" CreationDate="2013-07-10T21:30:18.870" Score="1" Body="&lt;p&gt;Loudness is defined as human perception of volume. In general, there is a very good correspondence between the two. Therefore, you can often use one as a proxy for the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, you can easily measure volume: the portions of the audio signal with the highest signal intensity (or volume) correspond to the parts with the greatest absolute value (or, if you prefer, square value). With a few assumptions, you can say that the loud sections are also the sections with high volume.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2013-07-10T21:30:18.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9903" PostTypeId="1" AcceptedAnswerId="9941" CreationDate="2013-07-10T22:57:41.487" Score="1" ViewCount="387" Body="&lt;p&gt;After calculating the principal component analysis (PCA) of a given data set, we are normally left with a matrix containing the eigenvectors sorted in order of the size of the eigenvalues. Now, in pattern recognition which eigenvector should we choose: the first eigenvector or do we have to do further processing of the eigenvector in order to choose the desired eigenvector?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="1606" LastEditDate="2013-07-15T07:11:03.527" LastActivityDate="2013-07-15T07:48:49.883" Title="Which eigenvector to choose after calculating PCA" Tags="|computer-vision|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9904" PostTypeId="1" CreationDate="2013-07-11T09:10:36.530" Score="1" ViewCount="177" Body="&lt;p&gt;I'm analyzing speech signal for identifying voiced and unvoiced regions. Voiced regions are supposed to have a &quot;pitch&quot;, which can be estimated using &lt;a href=&quot;http://sound.eti.pg.gda.pl/student/eim/synteza/leszczyna/index_ang.htm#a3&quot; rel=&quot;nofollow&quot;&gt;auto-correlation function&lt;/a&gt; (ACF). Basically, one estimates ACF for each frame of speech (say 20ms) and then finds the time lag between peaks in ACF output. If all the significant peaks in ACF output are equidistant, I can say that the signal is very much periodic. If the peaks have random spacing between the, that would indicate aperiodicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on this, what measure can I use to find out HOW MUCH periodic a signal is? If I denote time lag between successive peaks as lag1,lag2...lagN; the deviation from mean of these values can tell how much periodic the signal is. Any better ideas? &lt;/p&gt;&#xA;" OwnerUserId="4206" LastActivityDate="2013-07-11T09:27:58.657" Title="Measure of harmonicity in a time-series" Tags="|autocorrelation|voice|pitch|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9905" PostTypeId="2" ParentId="9904" CreationDate="2013-07-11T09:27:58.657" Score="2" Body="&lt;p&gt;Using the standard deviation of time lags is not a bad idea - the problem is that for very noisy signals such as consonants you won't really get a pattern with peaks. Your suggestion would be more useful in the context of musical instruments sound (for example to measure the inharmonicity of a sound, from violin to piano to bell...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look at the ratio between the value taken at the highest peak in the vocal range (say 80-400 Hz), and the value of the ACF at 0 - this is a common criterion used for voiced/unvoiced classification. Another simple metric that works relatively well with clean recordings is the zero-crossing rate.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-07-11T09:27:58.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9906" PostTypeId="2" ParentId="9903" CreationDate="2013-07-11T11:42:49.677" Score="4" Body="&lt;p&gt;The eigenvectors are in the order of explained &lt;em&gt;variance&lt;/em&gt;. Usually one uses PCA for dimension reduction, that is, selects some N first components. The problem of choosing appropriate N is called &lt;em&gt;dimension estimation&lt;/em&gt;. Easiest way would be to take such N that the selected PCs explain 90% or 95% of the variance in the original data. Alternatively, you could use some information-theoric method such as minimum description length (MDL).&lt;/p&gt;&#xA;" OwnerUserId="5004" LastActivityDate="2013-07-11T11:42:49.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9907" PostTypeId="1" CreationDate="2013-07-11T16:04:11.017" Score="1" ViewCount="200" Body="&lt;p&gt;I have gigabytes worth of seismic ground data, that I wish to upsample by a factor of 2 or 3. I wanted to ask what efficient way might there be for me to upsample such a big file? Is there a way to break it down and do it in mini-files? (I am using MATLAB for my software, I think the resample command might take too long though). Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2013-07-11T16:04:11.017" Title="Upsampling very large data sets efficiently" Tags="|filters|resampling|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9908" PostTypeId="1" CreationDate="2013-07-11T23:53:29.833" Score="0" ViewCount="278" Body="&lt;p&gt;I am not sure if this question suits this site, but I want to convert humming into notes or relative values to analyse melodies, word of &quot;Signal Processing&quot; looks suit for this. I am planning to use Flash AS3, and &lt;a href=&quot;http://en.wikipedia.org/wiki/Cycle_detection&quot; rel=&quot;nofollow&quot;&gt;Tortoise and Hare&lt;/a&gt; for Cycle Detection. I need very simple script implementation. All I want is find notes more easily with my bass. Is that possible? Or is there any frameworks that already makes this?&lt;/p&gt;&#xA;" OwnerUserId="3767" LastActivityDate="2013-07-12T07:28:12.897" Title="How to covert hummming into pitches?" Tags="|frequency-spectrum|music|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9909" PostTypeId="2" ParentId="9908" CreationDate="2013-07-12T02:34:22.637" Score="3" Body="&lt;p&gt;You can try using a Pitch Track for monophonic signal, you need track low pitches!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a wide range of algorithms to find Pitches in time domain (zero crossing, AMDF, YIN, MPM, ASDF, autocorrelation ....) or Frequency domain (shs, hps, cepstrum ....)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each one of them possess advantages or disadvantages !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the Pitch Track you can convert one frequency to note.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I never used Flash AS3 to DSP, one fast and easy way are the autocorrelation based algorithms.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-07-12T02:34:22.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9910" PostTypeId="2" ParentId="9908" CreationDate="2013-07-12T07:28:12.897" Score="1" Body="&lt;p&gt;Pitch estimation of humming sounds will likely require more than a simple script implementation for reliable results.  If you look at the waveform of humming sounds with an oscilloscope, you will probably find that the periodic waveform is usually not a simple mapping function suitable for the tortoise and hare algorithm.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-07-12T07:28:12.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9911" PostTypeId="1" AcceptedAnswerId="9928" CreationDate="2013-07-12T08:50:31.313" Score="1" ViewCount="325" Body="&lt;p&gt;I am currently frequency filtering a 3D image in matlab, with x,y,z dimensions of different lengths. The matlab filter takes normalised frequency as an argument. What does this mean for an image and how do I calculate it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note : the distance between each pixel is 2mm &lt;/p&gt;&#xA;" OwnerUserId="4996" LastEditorUserId="4996" LastEditDate="2013-07-12T09:57:59.710" LastActivityDate="2013-07-13T15:16:55.577" Title="3D image sample frequency" Tags="|image-processing|matlab|fft|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9912" PostTypeId="1" AcceptedAnswerId="9916" CreationDate="2013-07-12T10:05:40.747" Score="2" ViewCount="1782" Body="&lt;p&gt;I was reading a couple of &lt;a href=&quot;https://dsp.stackexchange.com/questions/7788/setup-frequency-array-properly&quot;&gt;these&lt;/a&gt; &lt;a href=&quot;https://stackoverflow.com/questions/4364823/how-to-get-frequency-from-fft-result&quot;&gt;threads&lt;/a&gt; and I was wondering:&#xA;Is it possible for an FFT signal to include frequencies less than $1/N$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a time-series of length $N$, and I perform an FFT on it. In the zero-th bin of the FFT is the DC signal, and first bin is frequency $1/N$, in the second bin is frequency $2/N$ etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean that the smallest frequency accounted for is a signal where one full period fits in the data length? Or can there also exist frequency where only half/quarter periods will fit in the given length?&lt;/p&gt;&#xA;" OwnerUserId="3183" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2013-07-12T20:14:54.110" Title="Frequency Components of an FFT" Tags="|fft|frequency-spectrum|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9913" PostTypeId="2" ParentId="9912" CreationDate="2013-07-12T10:42:04.713" Score="1" Body="&lt;p&gt;Each bin in the FFT actually corresponds to energy in a &lt;em&gt;range&lt;/em&gt; of frequencies, so while the notional &lt;em&gt;center&lt;/em&gt; frequency of bin &lt;code&gt;i&lt;/code&gt; corresponds to a frequency &lt;code&gt;Fs * i / N&lt;/code&gt;, the bin will represent energy either side of this notional center frequency. So to answer you question, energy below a frequency of &lt;code&gt;Fs / N&lt;/code&gt; will be represented in bin 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;N&lt;/code&gt; just determines the &lt;em&gt;resolution&lt;/em&gt; of your FFT, i.e. how close together in frequency two distinct components can be while still appearing in two different FFT output bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that a suitable window function is assumed to have been applied prior to the FFT, which is nearly always the case in practical FFT-based applications.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2013-07-12T17:01:48.030" LastActivityDate="2013-07-12T17:01:48.030" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9914" PostTypeId="2" ParentId="9912" CreationDate="2013-07-12T12:56:03.280" Score="1" Body="&lt;p&gt;If you are really asking about the discrete fourier transform (DFT) then the answer is no, because &lt;em&gt;it is not possible for a signal that repeats every $N$&lt;sup&gt;th&lt;/sup&gt; sample to contain a frequency of less than $1/N$.&lt;/em&gt;  If your original signal was longer than $N$ samples and you are chopping it to $N$ samples to do the DFT then what you are DFTing is not the original signal, it is a signal that repeats every $N$&lt;sup&gt;th&lt;/sup&gt; sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT converts your $N$ samples into the exact set of $N$ complex exponentials that when added together will reproduce your $N$ samples.  But if you extend those complex exponentials beyond the $N$ samples you will see that you get an exact repeat of the original $N$ samples.  So the DFT really only tells you something about the frequencies of signals that are infinitely repeating with a period of $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:  Suppose you had a triangle wave of period 8 samples: $[-1, -\frac{1}{2}, 0, \frac{1}{2}, 1, \frac{1}{2}, 0, -\frac{1}{2}]$, but you take the DFT of only the first 4 samples.  You will get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;-\frac{1}{4}&#xA;    (1 +&#xA;    (1 + i) e^{-\frac{1}{2} i \pi  k} +&#xA;    e^{-i \pi  k} +&#xA;    (1 - i) e^{-\frac{3}{2} i \pi  k})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this function produces the sequence: $[-1, -\frac{1}{2}, 0, \frac{1}{2}, -1, -\frac{1}{2}, 0, \frac{1}{2}]$.  That's a sawtooth not a triangle wave, and has a large discontinuity every 4&lt;sup&gt;th&lt;/sup&gt; sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you took the DFT of $N$ samples you were implicitly stating that you wanted the transform of a signal that repeats every $N$&lt;sup&gt;th&lt;/sup&gt; sample.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="3764" LastEditDate="2013-07-12T20:14:54.110" LastActivityDate="2013-07-12T20:14:54.110" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9915" PostTypeId="1" CreationDate="2013-07-12T13:20:42.327" Score="5" ViewCount="100" Body="&lt;p&gt;Hi: I'm new to this list but I had a question that's not exactly related to dsp but maybe in a slight way and I didn't know where else to send it.  So, here goes and my apologies if this is totally the wrong place to send it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following describes the background as far as number generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose have a series of positive numbers coming in sequentially ( regularly spaced ) that are generated by some invisible machine or oracle. no distribution is assumed for these numbers ( except that they are positive ) and they are generated at t1, ... tn. they are labelled as $x_1, x_2, ... x_n, x_{n+1}$. at each time $t$, the moving average with window size $n$ of the log of the $x_i$ is calculated and is labelled $mavelogx_t$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the parameters of  are $n$ and $d$. $n$ is the length of the moving average calculated at each time $t$. $d$  is positive and will be explained below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following describes the game for a player who decides to play given the above ( assuming that atleast n numbers have been generated by now so a moving average can be calculated ). It doesn't cost anything to play this game.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The player of the game sees a new number at time $tstar$, $x_{tstar}$, and if $log(x_{tstar})$ is $d$ less than the current moving average, $mavelogx_{tstar}$, then $x_{tstar}$ is marked as the player's &quot;initial&quot; number. like 36.83 or whatever. the game works so the next time $log(x_t)$ crosses the moving average, $mavelogx_{t}$, from below at say $t = tstarstar$, then $x_{tstarstar}$ is marked as the player's ending number and the game ends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The game rule is such that at $t = tstarstar$, the game ends and the player receives $winnum$ = $log(tstarstar) - log(tstar)$ ( winnum could be negative in which the player of course pays ). Of course it could happen that the player never get an initial number or that the player gets an initial number and never gets an ending number but let's make the assumption that the player plays and the game both starts and ends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I claim ( and think I proved ) the following two things. ( really one because it's an if and only if ) are true for the player playing the game.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A) if $(tstarstar - tstar)$ turns out to be less than $n$, then $winnum$ has to be positive. similarly if $(tstarstar - tstar)$ turns out to be greater than or equal to $n$, then $winnum$ has to be non-positive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and conversely&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B) if $winnum$ is positive, then $(tstarstar - tstar)$ has to be less than $n$. similarly, if $winnum$ is not positive , then $(tstarstar - tstar)$ has to be greater than or equal to $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could send the proof to anyone who is interested but my questions were :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A) does anyone have a counter-example to disprove what I'm saying in A) or B).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B) if A) and B) are true ( my proof is correct ), then is this a well known result in the literature ( any literature. doesn't have to be DSP ) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks a lot. &#xA;                                                   Mark&lt;/p&gt;&#xA;" OwnerUserId="5007" LastActivityDate="2013-07-12T13:20:42.327" Title="a moving average relation that I can't find a counter-example to" Tags="|algorithms|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9916" PostTypeId="2" ParentId="9912" CreationDate="2013-07-12T14:59:34.503" Score="4" Body="&lt;p&gt;A DFT will convert a segment of a periodic waveform of any frequency (uniquely below Nyquist)  into an orthogonal set of frequency results.  The problem is that if the signal is not periodic in the FFT length, the result will not be in one result bin, but be smeared into all the FFT result bins, due to convolution with the transform of the rectangular or other window function, making it difficult to separate the periodic signal from narrowband + wideband noise (or DC + ramp + noise for spectrum below the 1st bin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another potential problem with estimating non-periodic real spectrum very near DC (or Fs/2) is interference from its own negative frequency image in the DFT/FFT result, which can be constructive or destructive depending on phase, and thus non-trivial to account for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So yes, the low frequency, below Fs/N, will &quot;exist&quot; in the DFT/FFT complex result, but be more difficult to impossible to find or estimate, depending on the signal to noise ratio.  But in zero noise, you theoretically need only 3 or 4 non-aliased samples to find a single pure sinusoid of any frequency, so it will be represented in the transformed N samples, for N &gt;= 4, just not clearly in only 1 or 2 DFT/FFT result bins.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-12T15:58:18.607" LastActivityDate="2013-07-12T15:58:18.607" CommentCount="2" CommunityOwnedDate="2013-07-12T15:19:16.513" ContentLicense="CC BY-SA 3.0" />
  <row Id="9917" PostTypeId="1" AcceptedAnswerId="9918" CreationDate="2013-07-12T18:44:45.350" Score="0" ViewCount="943" Body="&lt;p&gt;I have an application that displays several signals from different sensors at various sample rates.  In order to display the data, I &quot;stretch&quot; the signal by repeating samples to match the highest sample rate.  For example: if I display a 500 Hz signal and a 100 Hz signal at the same time, every sample in the 100 Hz signal will be repeated 5 times so it appears to have a 500 Hz sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I apply filters to the signals (all second-order IIRs: LPF, HPF, notch) I use filters designed for the highest sample rate.  In my example here, I'm using 500 Hz filters on an upsampled 100 Hz signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How &quot;bad&quot; is this?  Is my only option to design an interpolation filter during upsampling, and if so, can anyone lead me to good references on how to design such a filter?&lt;/p&gt;&#xA;" OwnerUserId="5010" LastActivityDate="2013-07-12T21:18:17.140" Title="What are the effects on filtering upsampled data without interpolation?" Tags="|filters|filter-design|interpolation|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9918" PostTypeId="2" ParentId="9917" CreationDate="2013-07-12T21:18:17.140" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How &quot;bad&quot; is this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's not too good.  What you are doing is equivalent to upsampling by a factor of five (i.e. inserting four zeros in between every sample), and then filtering it with a filter that has the impulse response [1, 1, 1, 1, 1].  The picture below shows the frequency response of this filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7raGX.png&quot; alt=&quot;Averaging frequency response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal aliases introduced by the upsampling are centered at 0.4 and 0.8, so the good news is that the filter has a null at the center of the aliases.  The bad news is that unless the signal has a really narrow bandwidth, the signal aliases will be much wider than the nulls, and a lot of alias energy will distort your signal.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is my only option to design an interpolation filter during upsampling, and if so, can anyone lead me to good references on how to design such a filter?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you want to understand how to design a low-pass filter then I would suggest learning about &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;windowed&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;sinc functions&lt;/a&gt;.  If you just want to get a filter that works then I would recommend installing Octave and using the &lt;a href=&quot;http://octave.sourceforge.net/signal/function/fir1.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;fir1&lt;/a&gt; function to design the filter.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-12T21:18:17.140" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="9919" PostTypeId="2" ParentId="9521" CreationDate="2013-07-12T21:22:04.303" Score="6" Body="&lt;p&gt;I did one very simple bpm calculation in matlab and maybe it can help you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/ederwander/Beat-Track&quot; rel=&quot;noreferrer&quot;&gt;source&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decompose the signal in six frequency bands (six level) using DWT&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extrac the Envelope from all sub-bands&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;To make the Envelope Calculation do you need:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply Full Wave Rectification&lt;/li&gt;&#xA;&lt;li&gt;Apply Low Pass Filter&lt;/li&gt;&#xA;&lt;li&gt;Apply Downsample&lt;/li&gt;&#xA;&lt;li&gt;Apply Mean Removal&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Autocorrelation&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-07-12T21:22:04.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9922" PostTypeId="1" AcceptedAnswerId="9936" CreationDate="2013-07-13T03:11:33.157" Score="1" ViewCount="184" Body="&lt;p&gt;I am reading a paper on SIFT by Lowe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In it, gradient magnitudes and orientations are calculated using these formulae:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4o3ng.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;$$$$&#xA;I don't know why m(x,y) is calculated above. I heard that gradient magnitude is usually calculated like the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sqrt{f_x ^2 + f_y^2}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="4367" LastActivityDate="2013-07-15T04:28:45.110" Title="I have a question on SIFT" Tags="|sift|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9924" PostTypeId="2" ParentId="2875" CreationDate="2013-07-13T09:47:46.457" Score="0" Body="&lt;p&gt;I think you can plot the spectral cyclic density function of the modulated signal to extract out vital parameters.&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2013-07-13T09:47:46.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9925" PostTypeId="1" CreationDate="2013-07-13T12:07:17.567" Score="1" ViewCount="187" Body="&lt;p&gt;i want to design a filter that can effectively detect the QRS complex in ECG signal(whose Fs=360Hz) and reduce high frequency noise components. i want to know as to how the center frequency is detected so as to design a digital lowpass differentiator filter with bandwidth equal to the center frequency of the QRS complex.&lt;/p&gt;&#xA;" OwnerUserId="5015" LastEditorUserId="5015" LastEditDate="2013-07-13T12:22:20.383" LastActivityDate="2013-07-13T12:22:20.383" Title="how to detect the center frequency of a QRS complex in an ECG signal?" Tags="|filters|discrete-signals|noise|signal-detection|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9926" PostTypeId="1" CreationDate="2013-07-13T13:21:17.430" Score="3" ViewCount="6653" Body="&lt;p&gt;Suppose I have some amplitude modulated carrier wave $x$. If I have no access to the original message wave nor the unmodulated carrier, is it some how possible to calculate what is the modulation depth of $x$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have understood this correctly, amplitude modulation depth is given by&#xA;$M/A$, where $M$ is peak amplitude of the message wave and $A$ is the peak amplitude of the carrier wave. From $x$ I will know that $M/A$ equals to some $\lambda$ (when I check its peak amplitude), but M and A could be anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please correct me if I have understood something incorrectly.&lt;/p&gt;&#xA;" OwnerUserId="5016" LastActivityDate="2013-07-14T21:36:30.313" Title="Is there a way to calculate modulation depth after the modulation process?" Tags="|modulation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9927" PostTypeId="1" CreationDate="2013-07-13T14:09:01.550" Score="2" ViewCount="527" Body="&lt;p&gt;This is the first time that I post a question  here so excuse me for asking such a beginner question.&lt;br&gt;&#xA;&lt;strong&gt;what &lt;code&gt;free&lt;/code&gt; &lt;code&gt;open source&lt;/code&gt; &lt;code&gt;3rd party&lt;/code&gt; libraries &lt;code&gt;which have good documentation&lt;/code&gt;(because I'm new to using 3rd party libraries) would you suggest me for fourier transform,inverse fourier transform , meshgrids , dynamic arrays and etc to have a better performance and higher speed in visualC++ when implementing image processing filters?&lt;/strong&gt; &#xA;&lt;em&gt;Note that I'm not permitted to use openCV. In fact I'm going to compare the results of my code with results of openCV&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5009" LastActivityDate="2013-08-22T10:13:00.097" Title="Image processing free open source libraries" Tags="|image-processing|fft|ifft|dynamic-programming|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9928" PostTypeId="2" ParentId="9911" CreationDate="2013-07-13T15:16:55.577" Score="0" Body="&lt;p&gt;2 mm period between samples is 500 samples per meter.  That's your sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/analog-filters.html&quot; rel=&quot;nofollow&quot;&gt;Matlab's digital filter design functions&lt;/a&gt; (is that what you're using?) take a normalized frequency from 0 to 1, where 1 is the Nyquist frequency (1/2 the sampling frequency; the highest spatial frequency you can measure at that sample rate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you wanted to filter at a spatial frequency of 100 cycles per meter (features that cycle every 1 cm), for instance, you would note that the Nyquist frequency is 250 cycles per meter, and enter a value of 100/250 = &lt;strong&gt;0.4&lt;/strong&gt; for the normalized frequency.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-07-13T15:16:55.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9929" PostTypeId="2" ParentId="9927" CreationDate="2013-07-13T16:46:13.893" Score="2" Body="&lt;p&gt;For Fourier transforms go get &lt;a href=&quot;http://www.fftw.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;fftw&lt;/a&gt;.  I don't know what meshgrids are, so I can't answer that.  For dynamic arrays: that's what &lt;code&gt;std::vector&lt;/code&gt; is, it's built into the language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a wider variety of image transformations you might look at &lt;a href=&quot;http://www.gegl.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GEGL&lt;/a&gt; and the library underlying &lt;a href=&quot;http://www.imagemagick.org/script/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Imagemagick&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also this question about filtering software: &lt;a href=&quot;https://dsp.stackexchange.com/questions/6475/use-butterworth-and-chebychev-filters&quot;&gt;Use Butterworth and Chebychev filters&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-07-13T16:46:13.893" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9930" PostTypeId="1" CreationDate="2013-07-13T18:37:13.893" Score="0" ViewCount="2477" Body="&lt;p&gt;I am trying to transfer text data via sound wave between two android phones. I am a newbie and would like to know how to proceed with it. I am stuck at the very first step on how to modulate text data as FSK or PCM raw data ? As I shall be implementing it on Android any Java pointers will be of great help&lt;/p&gt;&#xA;" OwnerUserId="5017" LastActivityDate="2013-07-13T21:38:21.977" Title="How to convert text into wave" Tags="|sound|" AnswerCount="1" CommentCount="1" ClosedDate="2013-09-06T21:25:41.517" ContentLicense="CC BY-SA 3.0" />
  <row Id="9932" PostTypeId="2" ParentId="9926" CreationDate="2013-07-13T21:23:38.900" Score="2" Body="&lt;p&gt;If you look at the envelope of an AM signal then for 100% modulation the amplitude of the envelope will vary between 0 and 2 * Ac, where Ac is the amplitude of the carrier. It's a linear relationship, so for e.g. 50% modulation the amplitude will vary between 0.5 * Ac and 1.5 * Ac. So as long as you know that you have a full scale modulation signal then you can derive Ac from the max and min envelope amplitude (mean of Amax and Amin) and from there you can calculate the modulation depth (Amax / Ac).&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2013-07-13T21:23:38.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9933" PostTypeId="2" ParentId="9930" CreationDate="2013-07-13T21:32:58.887" Score="3" Body="&lt;p&gt;Text is just a string of bytes, and each byte is just a string of bits (typically 7 or 8), so the question boils down to: how to I send and receive a string of 1s and 0s using audio ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might consider using a simple &lt;a href=&quot;https://en.wikipedia.org/wiki/Frequency-shift_keying#Audio_FSK&quot; rel=&quot;nofollow&quot;&gt;AFSK&lt;/a&gt; scheme, where e.g. a 1 is represented by 2 cycles of a 2400 Hz sine wave and 0 is represented by 1 cycle of a 1200 Hz sine wave. So each bit period is the same length (8.14 ms) and the frequency for that bit period determines whether it's a 1 or a 0. Typically you would use a software &lt;a href=&quot;https://en.wikipedia.org/wiki/Uart&quot; rel=&quot;nofollow&quot;&gt;UART&lt;/a&gt; to frame each character and handle the problem of synchronization between transmitter and receiver. This would allow you to send 1 ASCII character in around 10 bit periods. The bit rate is 1200 bps so you would be able to send around 120 characters of uncompressed text per second.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2013-07-13T21:38:21.977" LastActivityDate="2013-07-13T21:38:21.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9934" PostTypeId="2" ParentId="9926" CreationDate="2013-07-14T14:51:43.883" Score="2" Body="&lt;p&gt;For a sinusoidal signal $x(t) = B\sin(\omega t + \theta)$, the envelope of the AM signal&#xA;has maximum and minimum values&#xA;$$A_{\max} = A_c(1+mB), \qquad A_{\min} = A_c(1-mB)\tag{1}$$ where $m \leq B^{-1}$ to ensure that&#xA;$A_{\min} \geq 0$, and the modulation index (commonly expressed as a percentage)&#xA;is $M = 100mB\%$.  It follows straightforwardly that&#xA;$$A_c = \frac{A_\max + A_\min}{2}, \qquad mB = \frac{A_\max  -A_\min}{A_\max + A_\min}.&#xA;\tag{2}$$&#xA;If $x(t)$ is a sum of sinusoids, then $(1)$ and $(2)$ still apply with the obvious&#xA;change that $B$ is replaced by $x_\max$, the maximum value of $x(t)$. Note that&#xA;$x_\min = -B$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is all fine and dandy for the typical modulating&#xA;signals that are encountered in AM applications.&#xA;However, things get more complicated if we consider arbitrary &#xA;(not necessarily sums-of-sinusoids) signals $x(t)$ &#xA;as modulating signals. If $x(t)$ has a DC component, &#xA;then there is effectively an increase (or perhaps worse, a decrease)&#xA;in the nominal carrier amplitude and carrier power.  Similarly, &#xA;if $x_\max \neq |x_\min|$,&#xA;or $x_\max &amp;lt; 0$ or $x_\min &amp;gt; 0$ (note that the last two cases&#xA;also mean that $x(t)$ has a DC component), the meaning of modulation&#xA;index is less clear.  Note also that for arbitrary signals, it is not&#xA;necessarily true that the DC component has value $\frac{x_\max+x_\min}{2}$,&#xA;and so measuring just $A_\max$ and $A_\min$ is not necessarily&#xA;going to provide all the information needed to determine the modulation&#xA;index.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-07-14T21:36:30.313" LastActivityDate="2013-07-14T21:36:30.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9935" PostTypeId="2" ParentId="2456" CreationDate="2013-07-14T19:22:24.363" Score="1" Body="&lt;p&gt;Perhaps this &lt;a href=&quot;https://dl.dropboxusercontent.com/u/6174770/aliasing2.wmv&quot; rel=&quot;nofollow&quot;&gt;animation&lt;/a&gt; (warning: 100MB file!) may help. I made it for a friend of mine to explain what aliasing is. I set the sampling frequency $fs = 10\text{Hz}$. Then I run a signal from $0$ up to $30\text{Hz}$. The concept that Dilip Sarwate explains in the above answer is I believe visible in this animation (at least I hope it is :) ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if the signal is of $f = 21\text{Hz}$ and is sampled with $fs = 10\text{Hz}$, then the resulting (aliased) frequency would be $|n*fs - f| = |2*10 - 21| = 1\text{Hz}$. In animation, this is like a full 1 cycle of a $\text{cos}$ function (in animation), exactly as if the signal was of $f = 1\text{Hz}$. The exact same effect occurs when frequency $f$ is e.g.: 9Hz, 11Hz, 19Hz, and 29Hz, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In animation, the green line represents original signal whereas the red dashed line is the result due to aliasing. There's also a dotted cos function at 5Hz. It simply represents the $\text{cos}$ at its maximal frequency 5Hz. The red points are where sampling occurs. I have chosen the $\text{cos}$ but it can work for a $\text{sin}$ function, either. The only difference is that, when $\text{sin}$ is aliased, signal is phase shifted by $180 ^\circ$ because $\text{sin}$ is an odd whereas $\text{cos}$ is an even function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope, it will help to understand the formulae.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. If you cannot open the &lt;a href=&quot;https://dl.dropboxusercontent.com/u/6174770/aliasing2.wmv&quot; rel=&quot;nofollow&quot;&gt;animation&lt;/a&gt;, please try to download this &lt;a href=&quot;https://dl.dropboxusercontent.com/u/6174770/alinasing_with_movie.m&quot; rel=&quot;nofollow&quot;&gt;MATLAB script&lt;/a&gt;. It will produce a number of frames in TIFF format in folder &lt;code&gt;./animation&lt;/code&gt;--I think this folder has to exist. It uses &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/imwrite.html&quot; rel=&quot;nofollow&quot;&gt;imwrite&lt;/a&gt; function just in case someone would like to make some changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS2. I wanted to put more links but I could not. I wanted to give you a link to MATLAB script and &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/imwrite.html&quot; rel=&quot;nofollow&quot;&gt;imwrite&lt;/a&gt; function I used when I was making this animation but SE does not let me do it. I will edit this answer when I am able to :)&lt;/p&gt;&#xA;" OwnerUserId="4721" LastEditorUserId="4721" LastEditDate="2013-07-16T07:56:32.337" LastActivityDate="2013-07-16T07:56:32.337" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9936" PostTypeId="2" ParentId="9922" CreationDate="2013-07-15T04:28:45.110" Score="2" Body="&lt;p&gt;Horizontal and vertical gradients are computed by taking neighbor pixel differences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g_{x}=L(x+1,y)-L(x-1,y)\\g_{y}=L(x,y+1)-L(x,y-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gradient magnitude is computed the same way as in your formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$m(x,y)=\sqrt{g_x^2+g_y^{2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replacing $g_{x}$ and $g_{y}$ with above will give you the original formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gradients are usually computed by forward or &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_difference#Forward.2C_backward.2C_and_central_differences&quot; rel=&quot;nofollow&quot;&gt;central difference formula&lt;/a&gt;, but I think in this case the above is still accurate enough since the image $L$ is smoothed.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-07-15T04:28:45.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9937" PostTypeId="1" CreationDate="2013-07-15T04:37:20.300" Score="5" ViewCount="611" Body="&lt;p&gt;The best standard may be varying from PSNR to human's visual feeling. Any one is OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tested J.Weickert's tensor diffusion and P&amp;amp;M's, they all can't satisfy me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any anisotropic diffusion method now is best for denoising, especially in tensor diffusion, others like the KAD, MAD and so on is ok as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading~&lt;/p&gt;&#xA;" OwnerUserId="4813" LastEditorUserId="128" LastEditDate="2018-07-02T08:32:07.927" LastActivityDate="2022-05-26T19:44:40.363" Title="Which Anisotropic Diffusion Method is Best for Denoising Now?" Tags="|image-processing|denoising|anisotropic-diffusion|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9938" PostTypeId="1" AcceptedAnswerId="9944" CreationDate="2013-07-15T05:44:18.643" Score="12" ViewCount="16467" Body="&lt;p&gt;Is a radix-4 implementation faster than a equivalently well coded radix-2 FFT?  And if so, why would it be faster?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2023-11-13T09:51:29.883" Title="Radix-4 FFT versus Radix-2" Tags="|fft|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9939" PostTypeId="2" ParentId="9937" CreationDate="2013-07-15T06:36:10.147" Score="2" Body="&lt;p&gt;I think &amp;quot;&lt;a href=&quot;https://hal.archives-ouvertes.fr/inria-00315835/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Anisotropic Smoothing of Multi-Valued Images using Curvature Preserving PDE’s&lt;/a&gt;&amp;quot; by David Tschumperlé is really good.&lt;/p&gt;&#xA;&lt;p&gt;I started implementing it using MATLAB once, yet I didn't finish.&#xA;If you do implement it, it will be great if you updated us.&lt;/p&gt;&#xA;&lt;h3&gt;Update&lt;/h3&gt;&#xA;&lt;p&gt;Have a look on my implementation at &lt;a href=&quot;https://github.com/RoyiAvital/FastAnisotropicCurvaturePreservingSmoothing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Anisotropic Curvature Preserving Smoothing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="60971" LastEditDate="2022-05-26T19:44:40.363" LastActivityDate="2022-05-26T19:44:40.363" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9941" PostTypeId="2" ParentId="9903" CreationDate="2013-07-15T07:48:49.883" Score="1" Body="&lt;p&gt;I think my answer is pretty aptly given here :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ufldl.stanford.edu/wiki/index.php/PCA#Number_of_components_to_retain&quot; rel=&quot;nofollow&quot;&gt;http://ufldl.stanford.edu/wiki/index.php/PCA#Number_of_components_to_retain&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2013-07-15T07:48:49.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9944" PostTypeId="2" ParentId="9938" CreationDate="2013-07-15T13:09:04.837" Score="8" Body="&lt;p&gt;It depends. Theoretically you can save a few multiplies with a radix-4 as radix-4 has a 1/4th the number of butterflies and 3 mpy + 8 adds per butterfly (if properly structured) and the radix 2 has 1 mpy + 2 adds per butterfly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in terms of multiplies it's a bit better, however there is higher complexity in terms of code structure, exception handling, coefficient management, register management, digit-reverse addressing, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's only an advantage if the number of mpy is the limiting factor which for most hardware these days is not the case.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-07-15T13:09:04.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9945" PostTypeId="1" CreationDate="2013-07-15T18:03:16.900" Score="9" ViewCount="260" Body="&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to kick up a discussion on how people set algorithmic parameters when no validation against groundtruth is possible (maybe because groundtruth just cannot be obtained or is very hard/tedious to obtain). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read numerous papers and implemented the underlying algorithms wherein --- a set of parameters are said to have been set &quot;empirically&quot; --- and often i found that these are the ones that affect the generality of the algorithm (even though the theory underlying the method is elegant, enticing and sound).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate it if you could share your thoughts. And, there is no right or wrong answer for this question. I just want to know, how everybody else deals with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background/Source-of-question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a computer scientist working in the areas of image analysis, computer vision, and machine learning and this question has been on the back of my mind for a while as i have faced this dilemma time and again whenever i design a new algorithm and i found myself spending a considerable amount of time tuning the parameters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I think, my question here is more general to any area where in computational algorithms are heavily involved, and i want to invite the thoughts of people from all concerned areas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to give you some concrete example, just so it helps you think:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- Take the case of feature detection (lets say circular blobs or salient points). You run some filters (needs parameters) at different scales (scale parameters) and probably threshold the response (threshold parameter). Its usually not possible to get a groundtruth to validate against and thereby automatically tune your parameters in such scenarios.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- Take any computational framework which involves a lot of signal processing components. There are always parameters to tune and usually there is no groundtruth and when you tune them subjectively on a small random subset of your dataset you will someday encounter the case to which it doesnt generalize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This parameter devil is more troublesome when you are setting parameters for some intermediate steps in your algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I often found, it is not possible to cast the problem of finding good values for these parameters as an optimization problem with an objective function of which you can take a derivative and thereby use standard optimization algorithms to find good values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in many scenarios exposing these parameters to an end-user is not an option, as we often develop applications/software for non-computational end-users (lets say biologists, doctors) and they usually go clueless when you ask them to tune it unless its very intuitive (like approx object size).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please share your thoughts.&lt;/p&gt;&#xA;" OwnerUserId="4155" LastEditorUserId="698" LastEditDate="2013-07-28T08:55:31.397" LastActivityDate="2013-07-28T17:27:02.883" Title="The Parameter Devil — How to set them when no validation against groundtruth is possible" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="1" ClosedDate="2013-09-19T13:24:37.207" ContentLicense="CC BY-SA 3.0" />
  <row Id="9946" PostTypeId="2" ParentId="9945" CreationDate="2013-07-15T21:52:13.780" Score="2" Body="&lt;p&gt;Assuming that there &lt;em&gt;is&lt;/em&gt; a ground truth, (&lt;em&gt;at least theoretically&lt;/em&gt;) one of the possible ways to overcome the &quot;tediousness&quot; problem is a &quot;bootstrap&quot; ground truth creation. If you already have a decent algorithm that does the job in about, say 80%-90% of the cases, you can run your algorithm on a large set of instances and ask a user to mark only the mistakes. This approach has its own flaws, such as bias towards your algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are some cases in which there is no ground truth at all, only different system trade-offs. For instance, an image processing system is required to output a sharp, color-accurate, non-noisy image. Obviously, you can't have them all at the same time. In such case you should use objective metrics that can be calculated on the result of your system. (See &lt;a href=&quot;http://www.imatest.com/&quot; rel=&quot;nofollow&quot;&gt;Imatest&lt;/a&gt;, &lt;a href=&quot;http://www.dxo.com/intl/image-quality-evaluation/dxo-analyzer&quot; rel=&quot;nofollow&quot;&gt;DXO analyzer&lt;/a&gt; for image processing). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have these, there are methods of multi-objective optimization that can create a mapping from the trade-offs (which are clear to the user) to the intrinsic parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, you should never give the user a parameter that he cannot understand. If all fails, simply hard-code the parameter.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2013-07-15T21:58:11.680" LastActivityDate="2013-07-15T21:58:11.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9947" PostTypeId="1" AcceptedAnswerId="9951" CreationDate="2013-07-16T08:15:36.237" Score="0" ViewCount="1055" Body="&lt;p&gt;I'm trying to implement a QPSK burst modulation and demodulation through a channel and I'm now considering the synchronization part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read that Barker sequence were excellent option for this as their autocorellation looks like a dirac.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I know that they're composed of &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;-1&lt;/code&gt; and that the longest found is 13 characters long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some adaptation of a Barker sequence for QPSK to make use of&#xA;the complex representation or do you simply send a classic sequence&#xA;using only &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;-1&lt;/code&gt; while you could use also &lt;code&gt;i&lt;/code&gt; and &lt;code&gt;-i&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2013-07-16T20:47:10.587" Title="Barker Sequence for QPSK" Tags="|matlab|modulation|digital-communications|qpsk|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9948" PostTypeId="2" ParentId="8667" CreationDate="2013-07-16T12:24:07.437" Score="3" Body="&lt;p&gt;&lt;em&gt;Variance&lt;/em&gt; is defined as $V(x)=\frac{\sum_{i=1}^n(x_i-\mu)^2}{n}$. Just in case for you, mean $\mu$ is defined as $\mu=\frac{\sum_{i=1}^nx}{n}$. &lt;em&gt;Covariance&lt;/em&gt; between two random variables $x$ and $y$ (or columns of a matrix) is defined as $Cov(x,y)=\frac{\sum_{i=1}^n[(x_i-\mu_x)(y_i-\mu_y)]}{n}$ and $Cov(x,x)=V(x)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term &lt;em&gt;covariance matrix&lt;/em&gt; may be misleading to you. It is not any sort of a special matrix. It is simply set of variances and covariances between pairs of columns. A position of any element in the covariance matrix corresponds to variance/covariance between a pair of two columns, e.g. a number located in 3rd row and 2nd column in the covariance matrix represents covariance between 3rd and 2nd columns of matrix $\textbf{A}$. $Cov(x,y)=Cov(y,x)$, therefore covariance matrix is symmetric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a matrix $\textbf{A}=\{\textbf{x}\;\textbf{y}\;\textbf{z}\}$ while $\textbf{x}$, $\textbf{y}$, and $\textbf{z}$ are column vectors of length $n$, &lt;em&gt;covariance matrix&lt;/em&gt; can be calculated as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Cov(A)=\begin{bmatrix}&#xA;\frac{\sum_{i=1}^n(x_{i}-\mu_x)^2}{n} &amp;amp; \frac{\sum_{i=1}^n(x_{i}-\mu_x)(y_{i}-\mu_y)}{n} &amp;amp; \frac{\sum_{i=1}^n(x_{i}-\mu_x)(z_{i}-\mu_z)}{n} \\&#xA;\frac{\sum_{i=1}^n(y_{i}-\mu_y)(x_{i}-\mu_x)}{n} &amp;amp; \frac{\sum_{i=1}^n(y_{i}-\mu_y)^2}{n} &amp;amp; \frac{\sum_{i=1}^n(y_{i}-\mu_y)(z_{i}-\mu_z)}{n} \\&#xA;\frac{\sum_{i=1}^n(z_{i}-\mu_z)(x_{i}-\mu_x)}{n} &amp;amp; \frac{\sum_{i=1}^n(z_{i}-\mu_z)(y_{i}-\mu_y)}{n} &amp;amp; \frac{\sum_{i=1}^n(z_{i}-\mu_z)^2}{n}\\&#xA;\end{bmatrix}=$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Cov(A)=\begin{bmatrix}&#xA;V(x,x) &amp;amp; Cov(x,y) &amp;amp; Cov(x,z) \\ \\&#xA;Cov(y,x) &amp;amp; V(y,y) &amp;amp; Cov(y,z) \\ \\&#xA;Cov(z,x) &amp;amp; Cov(z,y) &amp;amp; V(z,z) \\ \\&#xA;\end{bmatrix}$&lt;/p&gt;&#xA;" OwnerUserId="4721" LastActivityDate="2013-07-16T12:24:07.437" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9949" PostTypeId="2" ParentId="9780" CreationDate="2013-07-16T14:06:09.463" Score="3" Body="&lt;p&gt;I'll start by saying I don't know anything about GPS, but I believe WanderingLogic has answered the question correctly and I'll see if I can illustrate this with a simplified problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say the original transmitted signal is a simple sine wave of 1Hz.  This will analogous to the transmitted signal from the GPS satellite, and by the way this is the continuous signal that WanderingLogic is referring to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have 2 receivers, one samples the transmitted signal at 5Hz, the other samples the signal at 6Hz.  Both of these signals are now discrete representations of that continuous 1Hz signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the fundamental sample timing is different, you cannot compare the 5Hz discrete samples to the 6Hz samples, none of them were taken at the same point in time and therefore (except for 0) none of the 5Hz values are in the 6Hz data and vice versa.   You could upsample the 5Hz waveform to 6Hz, but because of the discontinuities that WL described and showed above, the resampled 5Hz waveform will be noisier than if you had just sampled at 6Hz.  I know that part is not what you asked, but it's just for some clarification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are doing with the upsampling of your 25MHz signal to 26.25 is the correct way to do it, but I think your comparison of 25 to upsampled 26.25 waveform is where you are getting crossed up.  The continuous signal that was transmitted is ultimately what you are trying to match, not your original 25MHz sampled waveform.&lt;/p&gt;&#xA;" OwnerUserId="5026" LastActivityDate="2013-07-16T14:06:09.463" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9950" PostTypeId="1" CreationDate="2013-07-16T16:08:45.227" Score="0" ViewCount="1022" Body="&lt;p&gt;I just have a quick question. I'm a second year computer science major with a background in C# and C++. I'm interested in studying neuroscience after graduation, and I've been researching some subjects on my own in my free time. I'm thinking of purchasing a Neurobit Optima 4 and writing some applications for it (specifically I want to convert unspoken speech into commands an application can understand and execute), but while I'm still in the research stage, I was wondering if anyone knows about any text books or websites that discuss the analysis of EEG data or cover topics such as Discrete Wavelet Transforms that offer programming examples?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance to anyone who can help&lt;/p&gt;&#xA;" OwnerUserId="5033" LastActivityDate="2013-07-20T05:55:14.220" Title="Are there any good texts on EEG analysis geared towards programmers" Tags="|matlab|wavelet|eeg|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9951" PostTypeId="2" ParentId="9947" CreationDate="2013-07-16T20:47:10.587" Score="4" Body="&lt;p&gt;&lt;a href=&quot;http://cgi.cecm.sfu.ca/~pborwein/PAPERS/P178.pdf&quot; rel=&quot;nofollow&quot;&gt;Polyphase Barker sequences&lt;/a&gt; have been studied (Google throws up multiple hits), but from a practical viewpoint, it is usually simpler to use binary Barker sequences on the I and Q channels. &lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-07-16T20:47:10.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9952" PostTypeId="1" CreationDate="2013-07-17T05:06:04.737" Score="0" ViewCount="175" Body="&lt;p&gt;I want to check the effect of this channel model on my signal transmitted with &quot;impulse response-Ultra Wide Band&quot; transmission (use very short pulses ~0.5 ns each), but i don't know where to find this channel impulse response or how can I generate it?&#xA;if there is only one line of sight (LOS) path and one non-line of sight (NLOS) path, if I assume the channel impulse response something like h=[1 0 0 0 .4 0 0] and then filter(h,tx signal), it would be correct?&#xA;best regards&lt;/p&gt;&#xA;" OwnerUserId="4854" LastActivityDate="2013-10-16T11:16:51.237" Title="what does &quot;fixed multipath channel model&quot; means?" Tags="|noise|multipath|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9953" PostTypeId="1" AcceptedAnswerId="9955" CreationDate="2013-07-17T07:30:55.383" Score="0" ViewCount="738" Body="&lt;p&gt;For this question purposes a function, $ f \left( t \right) $ is said to hold the Partition of Unity if:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \forall t, \ \sum_{n \in \mathbb{Z}} f \left ( t - n \right ) = 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the Poisson Summation Formula the Partition of Unity is equivalent of $ F \left( 2 \pi k \right ) = \delta \left ( k \right ) $ where $ F \left ( \omega \right ) $ is the Fourier Transform of $ f \left ( t \right ) $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at&#xA;$$ \frac{ \operatorname{sinc}^{p} \left ( pt \right ) }{\int_{-\infty}^{\infty} \operatorname{sinc}^{p} \left ( pt \right ) } $$&#xA;Does it holds the Partition of Unity for $ p \geq 2 $?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I thought it does, since the Fourier Transform equivalent property will hold.&lt;br&gt;&#xA;Yet it seems I'm missing something.&lt;br&gt;&#xA;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-06-30T20:58:07.400" LastActivityDate="2018-06-30T20:58:07.400" Title="The Sinc Function and the Partition of Unity Property" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9954" PostTypeId="2" ParentId="9950" CreationDate="2013-07-17T10:11:57.317" Score="2" Body="&lt;p&gt;Your application is not something that can be done very easily. The project would be well-suited for a PhD topic to be done over 4-5 years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to work towards it, learn&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Signal processing. Knowing just one technique (like the DWT) will not get you anywhere. Get a &lt;em&gt;thick&lt;/em&gt; book on the basics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Machine learning (supervised and unsupervised). Your application will need classifiers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Basics of EEG. Again, get a thick book. Focus on continuous-data analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Start reading publications in your field. Try sciencedirect.com, ieeexplore.org, google scholar, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Offer to work as a research/teaching assistant with neuroscientists at your local university.&lt;/p&gt;&#xA;" OwnerUserId="5040" LastActivityDate="2013-07-17T10:11:57.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9955" PostTypeId="2" ParentId="9953" CreationDate="2013-07-17T13:00:13.973" Score="5" Body="&lt;p&gt;For &lt;em&gt;any&lt;/em&gt; finite-energy signal $x(t)$, the function &#xA;$$y(t) = \sum_{n=-\infty}^\infty x(t-nT), -\infty &amp;lt; t &amp;lt; \infty$$&#xA;is a &lt;em&gt;periodic&lt;/em&gt; function of $t$ with period $T$, that is, $y(t-T) = y(t), -\infty &amp;lt; t &amp;lt; \infty$. Note that $T$ is not necessarily the &lt;em&gt;least&lt;/em&gt; period of $y(t)$.  Now, a periodic&#xA;function can be expressed as a Fourier series &#xA;$$y(t) = \sum_{m=-\infty}^\infty c_m \exp(j2\pi mt/T)$$ where&#xA;$$\begin{align}&#xA;c_m &amp;amp;= \frac{1}{T}\int_0^T y(t)\exp(-j2\pi mt/T)\,\mathrm dt\\&#xA;&amp;amp;= \frac{1}{T}\int_0^T \sum_{n=-\infty}^\infty x(t-nT)\exp(-j2\pi mt/T)\,\mathrm dt\\&#xA;&amp;amp;= \frac{1}{T}\sum_{n=-\infty}^\infty \int_0^T  x(t-nT)\exp(-j2\pi mt/T)\,\mathrm dt\\&#xA;&amp;amp;= \frac{1}{T}\sum_{n=-\infty}^\infty \int_{-nT}^{-(n-1)T}  x(s)\exp(-j2\pi ms/T)\,\mathrm ds\\&#xA;&amp;amp;=  \frac{1}{T}\int_{-\infty}^{\infty}  x(s)\exp(-j2\pi ms/T)\,\mathrm ds\\&#xA;&amp;amp;= \frac{1}{T}X\left(\frac{m}{T}\right)&#xA;\end{align}$$&#xA;where $X(f)$ is the Fourier transform of $x(t)$.&#xA;Now, for the case $T = 1$, &#xA;if $y(t) = 1$ for all $t$ as the OP desires, then it must be that $c_0 = 1$&#xA;and $c_m = 0$ for all $m\neq 0$, and therefore the Fourier transform of $x(t)$&#xA;must have the property that&#xA;$$X(m) = \begin{cases} 1, &amp;amp; m = 0,\\ 0, &amp;amp;m \neq 0,\end{cases}\tag{1}$$&#xA;that is, $X(f)$ is what is sometimes referred to as a &lt;em&gt;Nyquist pulse&lt;/em&gt; (in the&#xA;frequency domain). We are familiar with Nyquist pulses in the time domain,&#xA;with $\operatorname{sinc}(t) = \frac{\sin(\pi t)}{\pi t}$ being the most&#xA;familiar one,  but there are many others, including as a special case&#xA;$[\operatorname{sinc}(t)]^k$. Applying duality, &#xA;$X(f) = [\operatorname{sinc}(f)]^k$ is a Nyquist&#xA;pulse in the frequency domain, and its inverse Fourier transform $x(t)$ is&#xA;a signal with the property that&#xA;$$\sum_{n=-\infty}^\infty x(t-nT) = 1, -\infty &amp;lt; t &amp;lt; \infty.$$&#xA;Note that $x(t)$ is the $k$-fold convolution of $\operatorname{rect}(t)$&#xA;with itself. For example, with $k = 2$,&#xA;$$x(t) = \begin{cases}1 - |t|, &amp;amp;-1 &amp;lt; t &amp;lt; 1,\\&#xA;0, &amp;amp; \text{otherwise.}\end{cases}$$&#xA;What about the other way around?  Well, $\operatorname{sinc}(t)$ has&#xA;Fourier transform $\operatorname{rect}(f)$ which has the Nyquist pulse&#xA;property $(1)$ in the frequency domain as does $[\operatorname{sinc}(t)]^2$&#xA;whose Fourier transform&#xA;$$X(f) = \begin{cases}1 - |f|, &amp;amp;-1 &amp;lt; f &amp;lt; 1,\\&#xA;0, &amp;amp; \text{otherwise,}\end{cases}$$&#xA;also satisfies $(1)$.  However, for $k &amp;gt; 2$, &#xA;the Fourier transform of $[\operatorname{sinc}(t)]^k$ &lt;strong&gt;does not&lt;/strong&gt;&#xA;have the Nyquist pulse property $(1)$ because the three-fold (or more&#xA;generally $k$-fold convolution of $\operatorname{rect}(f)$ with itself&#xA;does not satisfy $(1)$: the $k$-fold convolution &quot;bulges&quot; outside&#xA;the interval $(-1,1)$.  See for, example, the &#xA;&lt;em&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Irwin%E2%80%93Hall_distribution&quot; rel=&quot;noreferrer&quot;&gt;Irwin-Hall distribution&lt;/a&gt;&lt;/em&gt;&#xA;for details of the exact values of the convolution results.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-07-17T17:55:00.777" LastActivityDate="2013-07-17T17:55:00.777" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9956" PostTypeId="2" ParentId="9927" CreationDate="2013-07-17T13:08:05.523" Score="1" Body="&lt;p&gt;There's &lt;a href=&quot;http://cimg.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;CImg&lt;/a&gt; for image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its been around for years now and has grown to have many features. Its a mature, open source  project and its well documented. The CImg license is similar to LGPL. Of course I'd still prefer opencv but it seems you cant use that.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastEditorUserId="4283" LastEditDate="2013-07-23T09:33:34.470" LastActivityDate="2013-07-23T09:33:34.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9957" PostTypeId="2" ParentId="9952" CreationDate="2013-07-17T14:10:54.047" Score="1" Body="&lt;p&gt;Your &quot;h&quot; is a valid multipath channel impulse response.  It is a special case, though, in that it represents a multipath delay that is an exact multiple of your sample period.  Usually the delay will not be an exact multiple of the sample period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not an expert on multipath channels, so hopefully someone else can chime in, but I think that the easiest way to generalize your multipath channel is to make the gain of the multipath complex rather than real.  The phase of the gain would alter the phase of your signal, simulating a non-integer delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really wanted to be hardcore about it you could use &lt;a href=&quot;https://dsp.stackexchange.com/a/9352/923&quot;&gt;this answer&lt;/a&gt; on how to make fractional delay filters to create a filter that delays the signal by as much or as little as you want, and then add it to [1 0 0 0 0...] (the LOS channel) to get the complete multipath channel.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-07-17T14:10:54.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9958" PostTypeId="1" AcceptedAnswerId="9959" CreationDate="2013-07-16T18:37:43.057" Score="2" ViewCount="1923" Body="&lt;p&gt;I need to compare FFT result from audio files,&#xA;I have 2 FFT result from 2 audio files..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT 1 (sample)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-0.16314493488504767 - 0.103707391105263i&#xA;0.07863935536550609 - 0.30111206509352917i&#xA;0.06753127619272284 + 0.02837438103569126i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;FFT 2 (sample)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-0.006953384463464084 + 0.0291883094944081i&#xA;-0.09447919915711694 - 0.22676541801892i&#xA;-0.23493813662827812 - 0.07765408995141115i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I need to calculate the deviation of each real-part point (without imaginer part) from the FFT result then make the result absolute, something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-0.16314493488504767 - (-0.006953384463464084) &#xA;--&amp;gt; then use Math.abs to get absolute value&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then sum all the deviation point, and use &lt;a href=&quot;https://en.wikipedia.org/wiki/Root_mean_square&quot; rel=&quot;nofollow noreferrer&quot;&gt;Root Mean Square&lt;/a&gt; formula to follow with to get the difference value... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UKKV7.png&quot; alt=&quot;Root Mean Square Formula&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where N is my numbeofFFTPoint and the following x is the sum value of my deviation result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then, someone told me to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Zero-crossing_rate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zero crossing rate&lt;/a&gt; formula to get more accurate result&#xA;&lt;img src=&quot;https://i.stack.imgur.com/W0ais.png&quot; alt=&quot;Zero Crossing rate&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Honestly I don't really understand about Zero Crossing Rate,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;what have I tried :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I compare the exact same 2 audio files, then get the deviation and sum result --&gt; 0.0  and of course the Root Mean Square Formula result is 0.0 too.. &#xA;since there's no difference between the files the it would return 0.0 right ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;question&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;is it possible just to user Root Mean Square ??&#xA;Any advice which formula should I use for this case ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks :) (&lt;em&gt;sorry 4 bad explaining&lt;/em&gt;)&lt;/p&gt;&#xA;" OwnerUserId="5037" OwnerDisplayName="Sylvie Yunjae" LastActivityDate="2013-07-17T17:50:49.597" Title="is root mean square possible to calculate similarity of FFT result?" Tags="|java|fft|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="9959" PostTypeId="2" ParentId="9958" CreationDate="2013-07-17T17:50:49.597" Score="2" Body="&lt;p&gt;The Discrete Fourier Transform is a unitary transform (maybe scaled).  As such, it preserves the Frobenius norm of the signal.  That is essentially the same as the Root Mean Square calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; rms( x - y ) == C * norm( fft(x) - fft(y) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for an appropriate constant C depending on your fft implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab or octave, C=1/nfft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; n=8192;&#xA; x=randn(n,2)*[1;j];&#xA; y=randn(n,2)*[1;j];&#xA; sqrt( mean( abs(x-y).^2 ) ) - norm(fft(x) - fft(y)) / n&#xA;&#xA; ans = -5.3291e-15&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastActivityDate="2013-07-17T17:50:49.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9961" PostTypeId="2" ParentId="6135" CreationDate="2013-07-18T04:04:37.520" Score="2" Body="&lt;p&gt;As the frequency response of the system is asked, the RoC woulbe be $|z|&amp;gt;\frac{1}{2}$. Thus, the impulse response is right sided and is given by $$h[n] = \left(\frac{1}{2}\right)^n u[n]$$ We obtain the frequency response by replacing $z = e^{j\omega}$ in $H(z)$. Thus, $$H(e^{j\omega}) = \dfrac{1}{1-\frac{1}{2}e^{-j\omega}}$$&lt;/p&gt;&#xA;" OwnerUserId="5045" LastActivityDate="2013-07-18T04:04:37.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9962" PostTypeId="1" CreationDate="2013-07-18T05:58:48.970" Score="0" ViewCount="928" Body="&lt;p&gt;I'm decoding a pulse amplitude modulation encoded digital signal. The goal is to detect the individual pulse against a background noise floor. The amplitude of the pulses varies depending on the signal strength and quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My sampling rate is 2x the bit width such that one bit fits into sample. Thus a single bit is the large value amongst the noise floor (8-bit unsigned values):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;6, 1, 18, 100, 9, 4, 7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Detecting the bit is simply looking for the large value relative to its neighbors (100 in the above example). This would be easy if the noise and pulses had known constant thresholds, but in real life they vary. What I actually see is varying noise and pulse amplitude depending on the quality of the signal. Consider these samples (&lt;code&gt;47&lt;/code&gt; and &lt;code&gt;52&lt;/code&gt; are the bits I'm trying to detect):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2, 8, 12, 47, 19, 13, 10&#xA;23, 11, 30, 52, 17, 9, 11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been struggling with developing an algorithm that can dynamically determine the threshold and thus pick-out the bits. I'm approaching this with a general computer science background with little to no DSP knowledge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are some software techniques to reliability detect a pulse against varying background noise?&lt;/p&gt;&#xA;" OwnerUserId="5046" LastActivityDate="2013-07-19T15:36:06.360" Title="Pulse detection against various noise floors" Tags="|discrete-signals|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9964" PostTypeId="1" CreationDate="2013-07-18T07:56:21.747" Score="0" ViewCount="479" Body="&lt;p&gt;I'm having a lot of problems with my project:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I added salt and pepper noise by inbuilt function&lt;/li&gt;&#xA;&lt;li&gt;I DWT function with Haar family &lt;/li&gt;&#xA;&lt;li&gt;Now I want to remove noise from original speech signal.&lt;/li&gt;&#xA;&lt;li&gt;I don't know how to do this &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&#xA;" OwnerUserId="5047" LastEditorUserId="29" LastEditDate="2013-07-18T19:53:26.257" LastActivityDate="2013-07-19T12:47:58.693" Title="How to remove salt &amp; pepper noise from speech signal?" Tags="|speech-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9966" PostTypeId="1" AcceptedAnswerId="9970" CreationDate="2013-07-18T09:52:02.450" Score="33" ViewCount="61632" Body="&lt;p&gt;I need to design a moving average filter that has a cut-off frequency of 7.8 Hz. I have used moving average filters before, but as far as I'm aware, the only parameter that can be fed in is the number of points to be averaged... How can this relate to a cut-off frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse of 7.8 Hz is ~130 ms, and I'm working with data that are sampled at 1000 Hz. Does this imply that I ought to be using a moving average filter window size of 130 samples, or is there something else that I'm missing here?&lt;/p&gt;&#xA;" OwnerUserId="4961" LastEditorUserId="36718" LastEditDate="2020-10-20T19:47:22.457" LastActivityDate="2020-10-20T19:47:22.457" Title="What is the cut-off frequency of a moving average filter?" Tags="|filter-design|finite-impulse-response|moving-average|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9967" PostTypeId="1" CreationDate="2013-07-18T10:52:37.640" Score="10" ViewCount="10542" Body="&lt;p&gt;Given a frequency response obtained with FFT, I would like to apply a 1/n octave smoothing. What filter should I be using and how? Maybe someone could point to a good reference (a paper or book on the subject).&lt;/p&gt;&#xA;" OwnerUserId="5050" LastActivityDate="2013-07-22T00:06:46.367" Title="1/n octave smoothing" Tags="|fft|audio|smoothing|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="9968" PostTypeId="1" CreationDate="2013-07-18T11:24:37.117" Score="2" ViewCount="154" Body="&lt;p&gt;White noise has infinite variance, whereas Gaussian random variable must have some finite-variance to exist. How do two disjoint phenomena co-exist?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help will be highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5049" LastActivityDate="2013-07-18T11:24:37.117" Title="White Gaussian Noise: a reality or fantasy?" Tags="|signal-detection|estimation|" AnswerCount="0" CommentCount="2" ClosedDate="2013-07-19T03:27:05.467" ContentLicense="CC BY-SA 3.0" />
  <row Id="9969" PostTypeId="1" CreationDate="2013-07-18T13:29:02.453" Score="1" ViewCount="223" Body="&lt;p&gt;I'm looking for a way to visually inspect the amplitude of frequency components in a 3D image that I have taken the fftn of in matlab. Does anyone have any idea how to go about this?&lt;/p&gt;&#xA;" OwnerUserId="4996" LastActivityDate="2024-04-03T02:04:40.547" Title="Analysing 3D image FFT" Tags="|image-processing|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9970" PostTypeId="2" ParentId="9966" CreationDate="2013-07-18T14:09:38.287" Score="38" Body="&lt;p&gt;The moving average filter (sometimes known colloquially as a &lt;em&gt;boxcar filter&lt;/em&gt;) has a rectangular impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h[n] = \frac{1}{N}\sum_{k=0}^{N-1} \delta[n-k]&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, stated differently:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h[n] = \begin{cases}&#xA;\frac{1}{N}, &amp;amp;&amp;amp; 0 \le n &amp;lt; N \\&#xA;0, &amp;amp;&amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remembering that a discrete-time system's frequency response is equal to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_time_fourier_transform&quot;&gt;discrete-time Fourier transform&lt;/a&gt; of its impulse response, we can calculate it as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;H(\omega) &amp;amp;= \sum_{n=-\infty}^{\infty} x[n] e^{-j\omega n} \\&#xA;&amp;amp;= \frac{1}{N}\sum_{n=0}^{N-1} e^{-j\omega n}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To simplify this, we can use the known formula for the &lt;a href=&quot;http://en.wikipedia.org/wiki/Geometric_progression#Geometric_series&quot;&gt;sum of the first $N$ terms of a geometric series&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{n=0}^{N-1} e^{-j\omega n} = \frac{1-e^{-j \omega N}}{1 - e^{-j\omega}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we're most interested in for your case is the magnitude response of the filter, $|H(\omega)|$. Using a couple simple manipulations, we can get that in an easier-to-comprehend form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;H(\omega) &amp;amp;= \frac{1}{N}\sum_{n=0}^{N-1} e^{-j\omega n} \\&#xA;&amp;amp;= \frac{1}{N} \frac{1-e^{-j \omega N}}{1 - e^{-j\omega}} \\&#xA;&amp;amp;= \frac{1}{N} \frac{e^{-j \omega N/2}}{e^{-j \omega/2}} \frac{e^{j\omega N/2} - e^{-j\omega N/2}}{e^{j\omega /2} - e^{-j\omega /2}}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may not look any easier to understand. However, due to &lt;a href=&quot;http://en.wikipedia.org/wiki/Euler%27s_identity&quot;&gt;Euler's identity&lt;/a&gt;, recall that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sin(\omega) = \frac{e^{j\omega} - e^{-j\omega}}{j2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, we can write the above as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;H(\omega) &amp;amp;= \frac{1}{N} \frac{e^{-j \omega N/2}}{e^{-j \omega/2}} \frac{j2 \sin\left(\frac{\omega N}{2}\right)}{j2 \sin\left(\frac{\omega}{2}\right)} \\&#xA;&amp;amp;= \frac{1}{N} \frac{e^{-j \omega N/2}}{e^{-j \omega/2}} \frac{\sin\left(\frac{\omega N}{2}\right)}{\sin\left(\frac{\omega}{2}\right)}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I stated before, what you're really concerned about is the magnitude of the frequency response. So, we can take the magnitude of the above to simplify it further:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|H(\omega)| = \frac{1}{N} \left|\frac{\sin\left(\frac{\omega N}{2}\right)}{\sin\left(\frac{\omega}{2}\right)}\right|&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; We are able to drop the exponential terms out because they don't affect the magnitude of the result; $|e^{j\omega}| = 1$ for all values of $\omega$. Since $|xy| = |x||y|$ for any two finite complex numbers $x$ and $y$, we can conclude that the presence of the exponential terms don't affect the overall magnitude response (instead, they affect the system's phase response).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting function inside the magnitude brackets is a form of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirichlet_kernel&quot;&gt;Dirichlet kernel&lt;/a&gt;. It is sometimes called a &lt;em&gt;periodic sinc&lt;/em&gt; function, because it resembles the &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot;&gt;sinc function&lt;/a&gt; somewhat in appearance, but is periodic instead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, since the definition of cutoff frequency is somewhat underspecified (-3 dB point? -6 dB point? first sidelobe null?), you can use the above equation to solve for whatever you need. Specifically, you can do the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Set $|H(\omega)|$ to the value corresponding to the filter response that you want at the cutoff frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set $\omega$ equal to the cutoff frequency. To map a continuous-time frequency to the discrete-time domain, remember that $\omega = 2\pi \frac{f}{f_s}$, where $f_s$ is your sample rate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the value of $N$ that gives you the best agreement between the left and right hand sides of the equation. That should be the length of your moving average.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2013-07-18T15:14:53.607" LastActivityDate="2013-07-18T15:14:53.607" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9971" PostTypeId="1" CreationDate="2013-07-18T17:16:48.513" Score="2" ViewCount="118" Body="&lt;p&gt;I am doing research in audio watermarking and have come across the paper that uses the complex transform to embed the watermark in order to improve the robustness and inaudibility of the embedded watermarks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is done by embedding the watermark into the complex cepstral components of the audio coefficients transformed by the complex cepstrum. The Complex Cepstral transform is defined by:&lt;code&gt;c(n) = ifft{ln[fft[z(n)]]}&lt;/code&gt; and the inverse is defined by: &lt;code&gt;z(n) = ifft{exp [fft[c(n)]]}&lt;/code&gt;.This is the formula I am using in MATLAB, where z(n) is my nx1 audio signal array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is do you normally embed the watermark into only the complex part of the values or into the entire values? I am trying to embed in MATLAB using the formula &lt;code&gt;c'(n) = c(n)(1+αW)&lt;/code&gt;, where α is embedding strength (I am using &lt;code&gt;α=.02&lt;/code&gt;), and W is the watermark data. However after embedding and reversing the Cepstral Transform, I am ending up with really large and strange data so I must be doing something wrong. Any help would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I might not have done the best job at explaining my problem so please ask any questions and I can edit this post to make it clearer. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4937" LastActivityDate="2013-07-18T17:16:48.513" Title="Complex Cepstral Transform and Audio Watermarking" Tags="|matlab|fft|audio|signal-analysis|transform|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9972" PostTypeId="1" CreationDate="2013-07-18T17:52:06.723" Score="1" ViewCount="37" Body="&lt;p&gt;I realize that this might not be the most well-formulated question, but I figured I'd throw it out there as an open-ended discussion that could turn up some interesting input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm relatively new to speech processing, and came across the statement &quot;invariance to transformation is important in many speech engineering tasks&quot; in a paper I'm reading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if anyone could provide any specific examples that could illustrate what exactly this means. The word transformation to me is a bit ambiguous, maybe because I'm relatively new to this particular field, but I was hoping that this statement is a little more obvious to someone else out there who is more familiar with the field.&lt;/p&gt;&#xA;" OwnerUserId="5054" LastActivityDate="2013-07-18T17:52:06.723" Title="Examples of cases where &quot;invariance to transformation&quot; on signal is important" Tags="|speech|speech-processing|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9974" PostTypeId="2" ParentId="9964" CreationDate="2013-07-18T20:18:20.740" Score="1" Body="&lt;p&gt;If you are forced to use the Discrete Haar Transform, then note that the Discrete Haar Mother Wavelet is nothing but a [1 -1], or in other words, a discrete differentiator, as shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n8X9g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, it can/will severely accentuate sudden transitions in your waveform, ie, salt and pepper noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, that the first dyadic scale of the DHT will be composed of coefficients computed from the signal correlated with the Haar Mother wavelet. At this level, salt&amp;amp;pepper noise will correlate very well, and will give you large wavelet co-efficients in the wavelet space. One can then simply null the large values out, and then perform an inverse Discrete Haar Wavelet Transform, (IDHT). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is strange that you would be required to use the &lt;em&gt;Discrete&lt;/em&gt; Haar Wavelet Transform, (over, say, the Stationary Wavelet Transform), because nulling co-efficients in the DWT space and inverse transforming can lead to aliasing. This effect might be small for the problem you describe however. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possibility would be to simply perform the DWT, identify the large wavelet co-efficients within the last half of the DWT transform, (corresponding to high correlations between SP noise and the Haar Mother Wavelet), identify those large co-efficients, and simply null them out in the time domain, without doing an inversion. This will get around the problem of aliasing in the inverse transform.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-07-19T12:47:58.693" LastActivityDate="2013-07-19T12:47:58.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9975" PostTypeId="2" ParentId="9964" CreationDate="2013-07-18T22:08:26.860" Score="1" Body="&lt;p&gt;What's this for? How complex of a solution do you need? A simple solution (a moving average) or a complex solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a whole field dedicated to complex solutions: compressed sensing. It sounds like you're reconstructing from uniform projections. There's a PhD thesis called &lt;a href=&quot;http://nowak.ece.wisc.edu/infth.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;reconstructing from noisy random projections&lt;/a&gt; that might help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any algorithm in compressed sensing is viable with wavelet transforms. Any function where the signal of interest is sparse is workable, since Candes proved (back in 2004) that any signal of mostly 0's is reconstructable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know for a fact that iterative soft thresholding works via &lt;em&gt;some&lt;/em&gt; measurements, but I'm unsure about if noise is included in those measurements, so I tested it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used a 2D case, since that's what I had on hand. The noise is a uniform distribution from 0 to 25 (so +/- 5% of the maximum). The first graph is the results, and the second the reconstruction (only taking ~3 seconds on my machine).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iFQIr.jpg&quot; alt=&quot;A reconstruction.&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2013-07-18T22:08:26.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9976" PostTypeId="1" AcceptedAnswerId="10034" CreationDate="2013-07-19T06:30:04.643" Score="4" ViewCount="6546" Body="&lt;p&gt;I've been studying sift very hard for two weeks.&#xA;I found much materials about scale space.&#xA;It is very hard to understand scale space depthly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've found and confusing things are that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'scale' in scale space means the sigma of gaussian function.&#xA;'octave' is used to represent images that are reduced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In paper by Lowe, for each octave, images are represented. Is it not necessary? In other words, is only scale space sufficient?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen many web sites as well as here, but scale space is very hard. Is there anyone who can explain in detail?&lt;/p&gt;&#xA;" OwnerUserId="4367" LastActivityDate="2017-04-20T00:38:04.033" Title="Why is it necessary to implement octaves in sift" Tags="|sift|scale-space|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9979" PostTypeId="2" ParentId="9962" CreationDate="2013-07-19T15:20:15.220" Score="1" Body="&lt;p&gt;I cannot comment on your question, so I am writing an answer here instead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware that any time you mention 'threshold', you are implicitly making a statement that you are comfortable with those three probabilities:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Certain probability of false alarms, (PFA). &lt;/li&gt;&#xA;&lt;li&gt;Certain probability of detection, (PD).&lt;/li&gt;&#xA;&lt;li&gt;Certain probability of misses, (PM). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iV0dm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put another way, every time you set a threshold, those three numbers will change accordingly. This is inescapable, in &lt;em&gt;any&lt;/em&gt; detection problem. Typically one can set the probability of false-alarm that they are willing to 'live with', and go from there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your problem, you mention changing noise variance. One way to circumvent this is to &lt;a href=&quot;http://en.wikipedia.org/wiki/Standard_score&quot; rel=&quot;nofollow noreferrer&quot;&gt;Z-Standardize&lt;/a&gt; your data vector before attempting anything. This then centers your data, (de-meaning), and forces the variance to unity. This take care of the problem of you having to re-compute thresholds all the time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this pre-processing step out of the way, you can now focus on your &lt;a href=&quot;http://en.wikipedia.org/wiki/Test_statistic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Test-Statistic&lt;/a&gt;, and your Threshold. For example, a test-statistic can simply be each sample. Or, it can be the average of three samples. Or the average of 10 samples. Either way, you will be comparing your test-statistic, against your threshold. Again, you pick a threshold you &quot;can live with&quot;, that is to say, one that gives you false-alarms at a rate that your application deems acceptable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if a doctor has a false alarm rate of 10% in informing you that you have a cold, that might be acceptable for this application, because it is not the end of the world, and the worst thing that can happen is you drink more orange juice than usual. If on the other hand you are designing a fraud detection system for your bank and you false alarm in detecting fraud 10% of the time, you are going to have some very, very angry customers swearing at your representatives all day for locking their credit cards. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back to your application: It seems that those bits are the result of a demodulated PAM receiver system, so you probably already have a significant amount of averaging gain. This means that a test-statistic of one sample is good enough to go off of. All you need to do now, is set your threshold (of your standardized data), such that you false alarm as some rate you are comfortable with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Remember, that you are dealing with standardized data, so you need only set this threshold once, and then forget about it. As a practical note to assist you in determining the threshold, try to plot the histogram of your data without signal, after you have standardized it. This will be your 'noise PDF'. This can assist you in estimating the optimal threshold ala &lt;a href=&quot;http://en.wikipedia.org/wiki/Neyman%E2%80%93Pearson_lemma&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neyman_Pearson detector&lt;/a&gt;.) &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-07-19T15:36:06.360" LastActivityDate="2013-07-19T15:36:06.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9980" PostTypeId="1" AcceptedAnswerId="9985" CreationDate="2013-07-19T15:37:47.340" Score="2" ViewCount="371" Body="&lt;p&gt;I'm trying to implement a speaker recognition system and want to make sure I'm aware of the latest trends in speech segmentation. I've read a number of very different methods at a higher level but I'm not sure which one would be best for my particular situation. I'll list what I found so far and I'd appreciate either (a) comments on the research I've done so far or (b) popular methods that I didn't mention that I should know about. Then I'll take it from there in terms of determining what will work best for my situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Techniques for Speech Segmentation&lt;/strong&gt;&#xA;(that I've identified so far)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I've read that strong &lt;em&gt;long-term modulation frequencies&lt;/em&gt; between 1-16 Hz are indicative of speech activity, but haven't been able to find any good explanations of what exactly these are. What I've been able to determine so far is that they are the temporal spectrum of specific frequency bands. (&lt;em&gt;Unsupervised speech/non-speech detection for automatic speech recognition in meeting rooms&lt;/em&gt; by Maganti et al)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using energy variance (high variance implies speech-like segments) independently or with other methods to build a &lt;em&gt;Gaussian mixture model&lt;/em&gt; with two components: one for speech and one for noise, and then re-classifying windows as either speech or non-speech. (&lt;em&gt;An unsupervised, sequential learning algorithm for the segmentation of speech waveforms with multiple speakers&lt;/em&gt; by Siu et al)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using the Voting Experts algorithm, which utilizes iter- and intra- window entropy (a window in this sense is a 'window of windows') to determine where &quot;chunks&quot; are using a feature that has high inter-segment entropy, and then to classify these chunks as either speech or non-speech using 2-means clustering, where each cluster of chunks contains all chunks of one of the two classes. (&lt;em&gt;Voting Experts: an unsupervised algorithm for segmenting sequences&lt;/em&gt; Cohen et al)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The short version of my question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, I'd really like to know what is standard in the industry as of right now.  Then I can determine what will work best for my particular situation once I have a little more base knowledge.&lt;/p&gt;&#xA;" OwnerUserId="5054" LastEditorUserId="5054" LastEditDate="2013-07-20T19:46:26.813" LastActivityDate="2013-07-20T19:50:32.173" Title="Speech segmentation for speaker recognition" Tags="|speech|segmentation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9981" PostTypeId="2" ParentId="9866" CreationDate="2013-07-19T23:57:49.860" Score="2" Body="&lt;p&gt;Ok, here's the simple method illustrated in Python:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Correlation is convolution with one input reversed&#xA;corr = fftconvolve(img1, img2[::-1, ::-1])&#xA;&#xA;# Get coordinates of peak in x, y pixels&#xA;peak = unravel_index(corr.argmax(), corr.shape)&#xA;# peak = (199, 189)&#xA;# Calculate offset from center point&#xA;print array(peak) - 199 # Offset is [  0 -10]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it finds the vertical offset (10 pixels), but not the horizontal, as you've shown (bottom left output below).  This is because the cross-correlation output is stronger in the center when more of the input images are overlapping (gets dark toward the edges even if the inputs are identical).  (The found peak is shown with the red cross.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's the method I described in the comments.  I have no idea if there's a mathematically rigorous foundation for this or if it has a name, but it produces the right results.  It may or may not be the same thing as &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation#Normalized_cross-correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;normalized cross-correlation&lt;/a&gt; (I haven't bothered to decipher what Wikipedia is saying):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;weighting = fftconvolve(ones(shape(img1)), ones(shape(img2)))&#xA;corr = corr / weighting # Normalize&#xA;peak = unravel_index(corr.argmax(), corr.shape)[::-1]&#xA;# peak = (224, 189)&#xA;print array(peak)-199 # Offset of [ 25 -10]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So this method works.  It normalizes every element of the output array by the number of overlapping pixels that were used to calculate that element, so that when only the thin edges of the images are overlapped, it still produces a strong output.  Now the offset from the dim square is not swamped by the white bar (lower right of image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that while this works perfectly with your example images, this method doesn't work as well for real images, since the edges of the output tend to vary wildly compared to the middle, and can produce spurious peaks, but if you know the offset is constrained to less than the image width, you can look for the peak only in realistic locations near the center, ignore the edges, and it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XYmq4.png&quot; alt=&quot;weighted method&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Phase_correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia suggests a method using windowed images&lt;/a&gt; which I thought might improve on this, but unless I'm doing it wrong, it doesn't:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = hamming(shape(img1)[0]) # 1D Hamming window&#xA;ham2d = outer(h, h) # 2D Hamming window&#xA;&#xA;h1 = img1 * ham2d&#xA;h2 = img2 * ham2d&#xA;&#xA;corr = fftconvolve(h1, h2[::-1,::-1])&#xA;peak = unravel_index(corr.argmax(), corr.shape)[::-1]&#xA;# peak = (216, 189)&#xA;print array(peak) - 199 # Offset is [ 17 -10]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The windowing does too much, and causes it to find an erroneous peak that's in between the previous two results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N77bc.png&quot; alt=&quot;windowed method&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-07-20T00:06:09.657" LastActivityDate="2013-07-20T00:06:09.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="9982" PostTypeId="2" ParentId="9950" CreationDate="2013-07-20T05:49:57.727" Score="0" Body="&lt;p&gt;Can't comment yet due to insufficient privileges, but I highly recommend studying time series in general. EEG signals are at their core, time series. IMHO, the 'authority' on time series analysis and processing is &lt;a href=&quot;http://www.cs.ucr.edu/~eamonn/&quot; rel=&quot;nofollow&quot;&gt;Prof. Eamonn Keogh&lt;/a&gt;. If you check the 'my tutorials' link on his page, you'll be able to download an &lt;strong&gt;excellent&lt;/strong&gt; tutorial on time series as well, to get you quickly started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I would refrain from purchasing a ton of books all at once.&#xA;Also check &lt;a href=&quot;http://cnx.org/&quot; rel=&quot;nofollow&quot;&gt;http://cnx.org/&lt;/a&gt; , you'll find a lot of free courseware-materials or even books, written by reputable professors &lt;/p&gt;&#xA;" OwnerDisplayName="user5011" LastEditorDisplayName="user5011" LastEditDate="2013-07-20T05:55:14.220" LastActivityDate="2013-07-20T05:55:14.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9983" PostTypeId="2" ParentId="2965" CreationDate="2013-07-20T06:14:56.850" Score="1" Body="&lt;p&gt;I don't have enough privileges to comment yet, but you can find the original paper of what later came to be called the 'Wang Transform' here: &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.197.337&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.197.337&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply click on the pdf icon under Cached, you'll get a prompt for downloading an apparently broken document, called something like &lt;code&gt;download;jsessionid=AB4D9EB3C11BCA7269B430931924512F&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After saving it, just rename it to whatever you want, with the .pdf extension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper is called &lt;strong&gt;'A class of distortion operators for pricing financial and insurance risks'&lt;/strong&gt; authored by Shaun S. Wang, originally published in the The Journal of Risk and Insurance, 2000, Vol. 67, No. 1, 15-36.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want a 2nd paper from &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.112.5957&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.112.5957&lt;/a&gt; (you'll need to rename the file again).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper is called &lt;strong&gt;'A universal framework for pricing financial and insurance risks'&lt;/strong&gt;, by the same author, published in the ASTIN Bulletin, 2002, Vol. 32, 213-234&lt;/p&gt;&#xA;" OwnerDisplayName="user5011" LastActivityDate="2013-07-20T06:14:56.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9984" PostTypeId="1" AcceptedAnswerId="10032" CreationDate="2013-07-20T13:39:38.243" Score="0" ViewCount="287" Body="&lt;p&gt;I am new learner in the field of speech analysis. I am wondering there are so many resources which explaiins principles of speech recognition. Most of them are advanced topics. I am curious to know the methods behind the speech recognition. If any one can explain it or if any one have easy helpful resource expaining it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="4926" LastActivityDate="2017-03-26T14:00:43.537" Title="Speech Recognition" Tags="|speech-recognition|mfcc|" AnswerCount="1" CommentCount="1" ClosedDate="2013-09-06T21:25:53.627" ContentLicense="CC BY-SA 3.0" />
  <row Id="9985" PostTypeId="2" ParentId="9980" CreationDate="2013-07-20T19:50:32.173" Score="2" Body="&lt;p&gt;I'm going to answer my own question, for those who are looking for the same information as I was. Adaptive Thresholding is the most common way to segment audio, and it gives you the most bang for the buck. While there are more accurate methods out there for segmenting, adaptive thresholding is fast and very accurate, and uses simple features such as zero-crossings, energy, and entropy. I'm going to have to look into this more myself but this should be enough to get started.&lt;/p&gt;&#xA;" OwnerUserId="5054" LastActivityDate="2013-07-20T19:50:32.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9986" PostTypeId="1" AcceptedAnswerId="61094" CreationDate="2013-07-20T23:26:28.947" Score="3" ViewCount="677" Body="&lt;p&gt;I presume we are all here well aware about &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow noreferrer&quot;&gt;foldback aliasing&lt;/a&gt; when sampling signals above the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nyquist frequency&lt;/a&gt;; i.e. half the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By contrast, the phenomenon of &lt;a href=&quot;http://en.wikipedia.org/wiki/Beat_%28acoustics%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;beating&lt;/strong&gt;&lt;/a&gt; occurs when sampling a signal with a frequency slightly &lt;em&gt;below&lt;/em&gt; the Nyquist frequency. You can see and hear some beats &lt;a href=&quot;http://www.animations.physics.unsw.edu.au/jw/beats.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;on this educational site&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of a 60Hz signal sampled at 128Hz resulting in a 4Hz beat tone with a 8Hz beat. The beat tone frequency is calculated as follows: $f_{t}=\frac{f_{s}}{2}-f_{m}=\frac{128}{2}-60=4\,Hz$. The beat has a frequency twice this tone frequency.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9reKZ.png&quot; alt=&quot;60Hz signal sampled at 128Hz resulting in a 4Hz beat tone with a 8Hz beat&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In preparation of a paper, I am looking for a peer-reviewed or textbook reference about beating. I browsed through almost 20 DSP textbooks and found nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the web, I only found a &lt;em&gt;Proceedings of the 2003 American Society for Engineering Education Annual Conference &amp;amp; Exposition&lt;/em&gt; &lt;a href=&quot;http://www.kostic.niu.edu/ASEE03Kostic.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;session paper by Kostic&lt;/a&gt; which included the nice explanatory figure shown below. I am looking for something more authoritative though; peer-reviewed or textbook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wOZXi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4805" LastActivityDate="2019-10-06T11:23:43.423" Title="Where can I find an authoritative (peer-reviewed or textbook) reference to sampling-induced beating?" Tags="|sampling|reference-request|nyquist|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="9987" PostTypeId="1" AcceptedAnswerId="9989" CreationDate="2013-07-21T05:12:20.650" Score="0" ViewCount="2092" Body="&lt;p&gt;The following image is from robert collins' ppt from &lt;a href=&quot;http://www.cse.psu.edu/~rcollins/CSE486/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cse.psu.edu/~rcollins/CSE486/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to calculate sigma ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shows [1 4 6 4 1] is corresponding to sigma=1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I learned that usually 3*sigma is best to represent. So kernel size is 7*7 is suited. But its size is 5*5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know why [1 4 6 4 1] is matched to sigma=1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MrgZC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/scKQ8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4367" LastActivityDate="2013-07-21T14:41:31.457" Title="gaussian kernel and bionomial coefficients" Tags="|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9988" PostTypeId="2" ParentId="9967" CreationDate="2013-07-21T14:31:00.233" Score="9" Body="&lt;p&gt;Typically &quot;smoothing&quot; means &quot;replace the current value with average over the neighboring ones&quot;. Most common is energy smoothing, where the smoothing results in the energy average over the smoothing interval and the phase information is lost. Complex smoothing can be done as well but it's tricky business because of phase wrapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Energy smoothing can be expressed as &#xA;$$Y(k)=\sqrt{\frac{1}{N}\cdot \sum_{i=0}^{N-1}X(i)\cdot X^{*}(i)\cdot W_{k}(i)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $W_{k}(i)$ is some suitable window function. In the case of, say, third-octave smoothing this could be derived as the the magnitude squared of the transfer function of a third octave band pass filter around frequency k. This also means that for a, say, 1024 point FFT you need to design 1024 different bandpass filters, so that's a fair bit of work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things can be simplified if the exact shape of the smoothing filter is flexible. Rectangular smoothing can be done as &#xA;$$Y(k)=\sqrt{\frac{1}{b-a+1}\cdot \sum_{i=a}^{b}X(i)\cdot X^{*}(i)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&#xA;$$a = round(k*2^{-\frac{1}{2\cdot n}}), b = round(k*2^{\frac{1}{2\cdot n}})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;are simply the indices of the band edges for $n^{th}$ octave smoothing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few more methods that are in between in the arbitrary window and the rectangular one in terms of complexity.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-07-22T00:06:46.367" LastActivityDate="2013-07-22T00:06:46.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9989" PostTypeId="2" ParentId="9987" CreationDate="2013-07-21T14:41:31.457" Score="1" Body="&lt;p&gt;The well-known twentieth-century American columnist Dorothy Parker once reviewed a book &#xA;saying &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;This is not a book to be put down lightly; it should be thrown with great force.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Be that as it may, Professor Collins is suggesting that a bar plot of the binomial&#xA;coefficients on the $n$-th row of Pacal's triangle, after suitable normalization,&#xA;will look from far away like a Gaussian distribution with mean $n/2$ and standard&#xA;deviation $\sqrt{n}/2$.  He then further obfuscates this by using the fact that for&#xA;&lt;em&gt;even&lt;/em&gt; values of $n$, we can write the standard deviation as $\sqrt{k/2}$&#xA;where $k = n/2$&#xA;while for &lt;em&gt;odd&lt;/em&gt; $n$, it is simply $\sqrt{n}/2$, inviting the reader to arrive at&#xA;the mistaken conclusion that there is a fundamental difference between the odd&#xA;and even rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a better understanding of where the $n/2$ and $\sqrt{n}/2$&#xA;comes from, look for reading material on the &lt;em&gt;DeMoivre-LaPlace approximation&lt;/em&gt;&#xA;which is a special case of the &lt;em&gt;Central Limit Theorem&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-07-21T14:41:31.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="9990" PostTypeId="2" ParentId="9986" CreationDate="2013-07-22T00:31:58.253" Score="6" Body="&lt;p&gt;I think you are mixing two things that are actually not related. &quot;Beating&quot; happens if you add two sine waves that are close in frequency. What you describe is sampling sine wave close to the Nyquist Frequeny. If you plot the samples, it looks like there is beating going on, but that's not actually the case. All information is properly preserved and if you were to properly reconstruct the analog signal you would see a perfectly good sine wave with no beats at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The somewhat tricky issue here is &quot;proper&quot; reconstruction. Since your signal is very close to the Nyquist frequency you need a very steep anti-aliasing filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a code example of how to reconstruct the sine wave with no beats. Any residual beating is simply an artifact of an insufficient anti-aliasing or interpolation filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% create a 60 Hz sine wave sampled at 128 Hz&#xA;fs = 128;&#xA;n = 256;&#xA;x = sin(2*pi*(0:n-1)'*60/fs);&#xA;figure(1); clf;&#xA;plot(x); &#xA;% this looks like beating but it isn't&#xA;&#xA;% let's upsampe to 32kHz so we can actually listen to it. We need a very&#xA;% steep anti-aliasing filter, so we go with a 64 tab Kaiser Window and a&#xA;% beta of 15&#xA;y = resample(x,250,1,64,15);&#xA;% plot a few periods from the steady state portion&#xA;figure(2); clf;&#xA;plot(y(10000:20000,:));&#xA;% looks like a perfectly good sine wave&#xA;sound(.9*y, 32000);&#xA;% sounds like one too.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-07-22T00:31:58.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9993" PostTypeId="1" AcceptedAnswerId="9999" CreationDate="2013-07-22T09:39:18.663" Score="1" ViewCount="1095" Body="&lt;p&gt;I am working on Pedestrian dead Reckoning using Particle filtering. I am using mobile accelerometer sensor to detect number of steps and stride length and calculating the total distance traveled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use particle filter to enhance accuracy in my results. I have read the theory of particle filter but stuck at the point that how to apply the model to my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In particular my problem, I have the following questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How to determine the initial position &lt;code&gt;pdf&lt;/code&gt; distribution? I have a Bluetooth beacon to detect the starting position. Particle filter requires a cluster of point at the start, right? I don't think in my case the distribution is Gaussian. Then what should it be?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Should I do the particle filtering on the smartphone or pass the data back and do it on the computer using Matlab? Will the computation very intense.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4677" LastActivityDate="2013-07-22T13:43:19.067" Title="How to enhance Pedestrian Dead Reckoning using Particle filter?" Tags="|particle-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9994" PostTypeId="1" AcceptedAnswerId="9998" CreationDate="2013-07-22T10:43:26.717" Score="1" ViewCount="2088" Body="&lt;p&gt;I'm reading Schaum's DSP book, and in Fig 1-3 they demonstrate why shifting and reversal are order-dependent, showing a couple of simple systems, 1) delay followed by reversal, and 2) reversal followed by delay. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gIl4x.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equations they present as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) (Time delay -&gt; Reversal)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n) \rightarrow x(n-n_0) \rightarrow x(-n-n_0)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) (Reversal -&gt; Time delay)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n) \rightarrow x(-n) \rightarrow x(-n+n_0)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fine with shifting and reversal not being commutative due to the different results above, but shouldn't the results be opposite? I.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) (Time delay -&gt; Reversal)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n) \rightarrow x(n-n_0) \rightarrow x(-(n-n_0)) = x(-n + n_0)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) (Reversal -&gt; Time delay)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n) \rightarrow x(-n) \rightarrow x(-n - n_0)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't find this in the errata for the book which is why I'm thoroughly confused. Which is correct?&lt;/p&gt;&#xA;" OwnerUserId="5067" LastEditorUserId="80" LastEditDate="2013-07-22T11:39:33.753" LastActivityDate="2021-12-15T00:34:58.587" Title="Time-reversal and delay commutativity and resulting signals" Tags="|discrete-signals|dsp-core|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9995" PostTypeId="1" AcceptedAnswerId="9997" CreationDate="2013-07-22T13:00:41.340" Score="3" ViewCount="400" Body="&lt;p&gt;When we apply pulse-width modulation (PWM) on controlling the brightness of a LED or the speed of a DC motor, is it the lag in our eyes that is responsible for the feeling of a continuous powering or the inertia of the devices?&lt;/p&gt;&#xA;" OwnerUserId="4599" LastEditorUserId="90" LastEditDate="2013-07-22T13:45:41.263" LastActivityDate="2013-07-22T18:57:28.907" Title="Why does pulse-width modulation work?" Tags="|discrete-signals|signal-detection|continuous-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9996" PostTypeId="1" AcceptedAnswerId="10003" CreationDate="2013-07-22T13:07:21.937" Score="1" ViewCount="2213" Body="&lt;p&gt;i will use matlab code just for convenience, i get the same behavior using a C++ code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two signals:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fp=5;&#xA;A=0.00025;&#xA;Phi=0;&#xA;Off=0.5;&#xA;KADC_5VOLT=5.0/32768.0;&#xA;&#xA;tc=250e-6;&#xA;tmax=30;&#xA;t=0:tc:tmax;&#xA;&#xA;Buf1= int32 ((A*cos(2.0*pi*t*Fp+ Phi*pi/180.0)+Off)/(KADC_5VOLT));&#xA;Buf2= int32 ((A*cos(2.0*pi*t*Fp+ Phi*pi/180.0)+0)/(KADC_5VOLT));&#xA;&#xA;Buf1=double(Buf1);&#xA;Buf2=double(Buf2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;performing a FFT on Buf1 i get amplitude 2.4246e-04 for the 5 Hz component ((this values seems to change randomly as a function of A, while A is small); while for Buf2 i get amplitude 2.6287e-04 for the 5 Hz component. If i set A &gt; 0.0015, performing a FFT on Buf1 and Buf2 i get amplitude 0.0015 for the 5 Hz component; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if i use just:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Buf1= ((A*cos(2.0*pi*t*Fp+ Phi*pi/180.0)+Off)/(KADC_5VOLT));&#xA;Buf2= ((A*cos(2.0*pi*t*Fp+ Phi*pi/180.0)+0)/(KADC_5VOLT));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;performing a FFT on Buf1 and Buf2 i get amplitude 2.5000e-04 for the 5 Hz component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the reason of that? is seems that the problem is related to a quantization error, but why is the offset so important? Also: how can i get rid of it?&lt;/p&gt;&#xA;" OwnerUserId="4235" LastEditorUserId="4235" LastEditDate="2013-07-22T13:49:52.943" LastActivityDate="2013-07-22T23:46:14.040" Title="Offset effect in FFT magnitude" Tags="|fft|sampling|resolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="9997" PostTypeId="2" ParentId="9995" CreationDate="2013-07-22T13:31:44.860" Score="11" Body="&lt;p&gt;Depends on what you are controlling. For DC-motors it is the inertia of the device that acts as a low-pass filter of the PWM modulated signal resulting in a continuous motion. For most LEDs it is the human eyes that do the apparent low-pass filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the PWM-frequency is not very high you can actually see this by moving your head from left to right while looking at the PWM modulated LED. The light will appear on and off while the LED is moving through your field of vision (this can get very annoying with LED car taillights).&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-07-22T13:31:44.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="9998" PostTypeId="2" ParentId="9994" CreationDate="2013-07-22T13:40:36.653" Score="5" Body="&lt;p&gt;Your counterexample to the book's assertion&#xA;is confusing between two different uses for $n$.  There was a question earlier&#xA;in which some user (endolith? datageist?) gave an answer containing&#xA;a detailed description of what exactly&#xA;this confusion is and how to interpret the results correctly. My cursory search&#xA;has not found this great answer, and so I will just exhibit&#xA;a simple example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that &#xA;$x[n] = \begin{cases}1, &amp;amp;n=0,\\2, &amp;amp; n = 1,\\0, &amp;amp;\text{otherwise,}\end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Delaying $x[n]$ by one unit gives&#xA;$x_d[n] = \begin{cases}1, &amp;amp;n=1,\\2, &amp;amp; n = 2,\\0, &amp;amp;\text{otherwise,}\end{cases}$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and time-reversing this gives&#xA;$x_{d,r}[n] = \begin{cases}1, &amp;amp;n=-1,\\2, &amp;amp; n = -2,\\0, &amp;amp;\text{otherwise,}\end{cases}$  which &lt;em&gt;equals&lt;/em&gt; $x[-n-1]$ exactly as the book says it does. Don't believe this?&#xA;Here is a table of values for the two functions:&#xA;$$\begin{array}{|l|c|c|c|c|c|c|c|c|c|}&#xA;\hline\\n&amp;amp;\cdots&amp;amp;-3&amp;amp;-2&amp;amp;-1&amp;amp;0&amp;amp;1&amp;amp;2&amp;amp;3&amp;amp;\cdots\\&#xA;\hline\\&#xA;x[n]&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;2&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;\hline\\x_{d,r}[n]&amp;amp;0&amp;amp;0&amp;amp;2&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;\hline\\&#xA;-n-1&amp;amp;\cdots&amp;amp;2&amp;amp;1&amp;amp;0&amp;amp;-1&amp;amp;-2&amp;amp;-3&amp;amp;-4&amp;amp;\cdots\\&#xA;\hline\\&#xA;x[-n-1]&amp;amp;\cdots&amp;amp;0&amp;amp;2&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;\hline\\&#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, thus far?  On  the other hand,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Time-reversing $x[n]$ gives&#xA;$x_r[n] = \begin{cases}1, &amp;amp;n=0,\\2, &amp;amp; n = -1,\\0, &amp;amp;\text{otherwise,}\end{cases}$&lt;br&gt;&#xA;and delaying this by one time unit gives&#xA;$x_{r,d}[n] = \begin{cases}2, &amp;amp; n = 0,\\1, &amp;amp;n=1,\\0, &amp;amp;\text{otherwise,}\end{cases}$&lt;br&gt;&#xA;which equals $x[-n+1]$ exactly as the book says it does. Don't believe this either? Here&#xA;is the table for it. &#xA;$$\begin{array}{|l|c|c|c|c|c|c|c|c|c|}&#xA;\hline\\n&amp;amp;\cdots&amp;amp;-3&amp;amp;-2&amp;amp;-1&amp;amp;0&amp;amp;1&amp;amp;2&amp;amp;3&amp;amp;\cdots\\&#xA;\hline\\&#xA;x[n]&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;2&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;\hline\\x_{r,d}[n]&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;2&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;\hline\\&#xA;-n+1&amp;amp;\cdots&amp;amp;4&amp;amp;3&amp;amp;2&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;2&amp;amp;\cdots\\&#xA;\hline\\&#xA;x[-n+1]&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;2&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;\hline\\&#xA;\end{array}$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So how can we establish these results without setting up tables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, $x_d$ is a sequence whose $n$-th term $x_d[n]$ equals $x[n-n_0]$&#xA;for all choices of $n$; in other words, take whatever is inside the square brackets&#xA;after $x_d$, subtract $n_0$ from it, and stick it in as the argument/index&#xA;for $x$. Now, for&#xA;&lt;em&gt;any&lt;/em&gt; sequence $y$, its time-reversal $y_r$ is a sequence for which&#xA;$y_r[k] = y[-k]$ for all choices of $k$ (negate the argument of $y_r$ and&#xA;stick it in as the argument for $y$. Thus, the time-reversal of&#xA;$x_d$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_{d,r}[k] = (x_d)_r[k] = x_d[-k] = x[(-k)-n_0] = x[-k-n_0]$$&#xA;as the book says, and not $x[-k+n_0]$ as the OP claims it should be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, $x_r[n] = x[-n]$ and so&#xA;$$x_{r,d}[k] = (x_r)_d[k] = x_r[k-n_0] = x[-k+n_0]$$&#xA;as the book says it should be, and not $x[-k-n_0]$ as the OP&#xA;claims it should be.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-07-22T22:27:56.173" LastActivityDate="2013-07-22T22:27:56.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="9999" PostTypeId="2" ParentId="9993" CreationDate="2013-07-22T13:43:19.067" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How to determine the initial position pdf distribution? I have a Bluetooth beacon to detect the starting position. Particle filter requires a cluster of point at the start, right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, the distribution of a particle filter does not need to be a cluster when it starts.  A classic case is for a robot to figure out where it is.  At first it does not know where it is.  It takes sensor readings wherever it happens to be at, but that is usually not enough to localize it (if all you needed was a single set of readings, you wouldn't need a particle filter).  Instead, it moves around and takes more readings.  All of the many spread out particles represent possible positions.  As it moves and takes more readings more and more of the possible positions become highly unlikely, until the distribution collapses to a single cluster.  At that point the robot &quot;knows&quot; (or at least thinks it knows) where it's at.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't think in my case the distribution is Gaussian. Then what should it be?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Without giving us more information there is no way to answer that question.  Since it sounds like your initial estimate comes solely from your bluetooth beacon, you will probably need to generate an empirical data-based model of its accuracy.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Should I do the particle filtering on the smartphone or pass the data back and do it on the computer using Matlab? Will the computation very intense.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Either way.  The computational load will largely depend on how many particles you use.  There is no right answer as to how many particles you need.  More particles means more computation but also lower chance of getting a wrong answer.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-22T13:43:19.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10000" PostTypeId="2" ParentId="9996" CreationDate="2013-07-22T13:44:31.357" Score="2" Body="&lt;p&gt;Firstly you didn't mention your sample rate and how your time vector is defined. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, this is a quantization problem. The maximum amplitude in Buf2 is 1.6. If you quantize that to integers you only end up with the values -2,-1,0,1,2 so you have massive amounts of quantization noise. You are only quantizing this two 2 or 3 bits.&#xA;The correct way to turn this into fixed point would be the apply proper scaling, i.e using fractionals, Q notation or some reasonable normalization scheme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding the offset just shifts the problem around. The only numbers that you get will be 3275, 3276, 3277 and 3278. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bigger amplitude in Buf1 is simply just quantization noise from the very large added DC component.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-07-22T15:17:14.397" LastActivityDate="2013-07-22T15:17:14.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10001" PostTypeId="1" AcceptedAnswerId="10002" CreationDate="2013-07-22T14:13:16.540" Score="1" ViewCount="445" Body="&lt;p&gt;I'm a little confused on how frame based high dimensional features such as mfcc's and bfcc's are applied in the classification of musical instruments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are statistical measures of the features used e.g. using the standard deviation across the frames used as a feature? Or is each frame of coefficients used as independent features e.g. 2 frames, 13 coefficients --&gt; 26 features? a combination of both or something completely different?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3296" LastActivityDate="2013-07-22T14:37:00.253" Title="Music/Speech Classification: How are frame based features used in a feature vector?" Tags="|classification|music|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10002" PostTypeId="2" ParentId="10001" CreationDate="2013-07-22T14:37:00.253" Score="1" Body="&lt;p&gt;Let us say you have a set of songs you want to classify by genre.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two approaches if the classification algorithm you use works on unidimensional vectors (eg: neural networks, SVM...):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Either you have one feature vector per song; and your feature vector contains statistics (mean, standard deviation, etc.) summarizing all the MFCCs computed at the frame level. In this case, your training set contains one vector per song; and during classification, the classification algorithm is run once per song.&lt;/li&gt;&#xA;&lt;li&gt;Or you have one feature vector per frame. In this case, your training set is made of frames; and the classification algorithm is run once per frame. Voting is used to select the label for the whole songs. It is common to weight the votes to give more important to the middle of the signal (for example, for musical genre classification, the song might start with a slow/soft intro which might bias the classification).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A particularity of both solutions (the so-called &quot;bag of frames&quot; representation) is that they are invariant to permutations in the sequence of MFCC vectors - they do not take into account the temporal structure of the signal. Another approach is to use machine learning algorithms or models (such as HMMs) which can intrinsically deal with time-series - in which case your representation is the sequence of feature vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach you describe in which MFCC vectors for each frame are concatenated to yield a gigantic feature vector is not practical: the large feature vectors would make the learning task computationally extensive, it would yield feature vectors of different dimensions for signals of different durations; and two signals identical modulo a delay would have very different feature vectors.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-07-22T14:37:00.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10003" PostTypeId="2" ParentId="9996" CreationDate="2013-07-22T15:11:23.837" Score="3" Body="&lt;p&gt;Since your offset is 3/5ths (plus some integer), the truncation fractions will be different, resulting in a different sum of quantization noise.  You can get rid of this difference by using an integer offset (including/after scaling) before truncation or rounding.  (e.g. not (2^N)/5)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if your signal is not exactly periodic in your FFT aperture, then the result magnitude of very low frequencies will have a small dependence on phase, relative to the window (edge or center), and thus not exactly match the input amplitude.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-22T23:46:14.040" LastActivityDate="2013-07-22T23:46:14.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10004" PostTypeId="1" CreationDate="2013-07-22T15:49:24.277" Score="3" ViewCount="1142" Body="&lt;p&gt;Does the following code properly implement a phase-neutral band-pass filter using SciPy?  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freq_fraction = FREQ / (SAMPLE_RATE/2)&#xA;sharpness = 0.1&#xA;filter_length=128&#xA;fir = sig.firwin(filter_length, [freq_fraction*(1-sharpness),freq_fraction*(1+sharpness)], pass_zero=False )&#xA;filtered = sig.lfilter( fir, 1, data_to_filter )&#xA;filtered = sig.lfilter( fir, 1,filtered[::-1] )[::-1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code is based on the answer to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/3182/is-it-correct-to-subtract-a-low-pass-filtered-signal-from-the-original-signal-an/3250#3250&quot;&gt;Is it correct to subtract a low-pass filtered signal from the original signal and use the result as a &amp;quot;high-pass&amp;quot;?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which doesn't give a final code listing for how to maintain phase neutrality.  I'm assuming it's just a matter of running the filter forward and backwards but want to double-check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if there are better/different ways of doing this (other than the remez and firwin2 methods listed in the other question) I'd love to know.&lt;/p&gt;&#xA;" OwnerUserId="3435" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-12-21T13:14:20.043" Title="Implementing a phase-neutral band-pass filter using SciPy" Tags="|filters|filter-design|python|bandpass|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10006" PostTypeId="2" ParentId="10004" CreationDate="2013-07-22T17:53:53.717" Score="-1" Body="&lt;p&gt;Calculate the frequency response (&lt;a href=&quot;https://en.wikipedia.org/wiki/Frequency_response&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Frequency_response&lt;/a&gt;) of the filter and see yourself.&lt;/p&gt;&#xA;" OwnerUserId="5072" LastActivityDate="2013-07-22T17:53:53.717" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10007" PostTypeId="2" ParentId="9995" CreationDate="2013-07-22T18:57:28.907" Score="3" Body="&lt;p&gt;For LEDs the filtering can be done by the eye.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an electric motor there are 2 sources of smoothing. The first is due to a motor being an inductive load. In an inductor the applied voltage is proportional to the rate of change of the current. This means a PWM voltage will result in some sort of triangle wave in the current (which requires a freewheeling diode for when the switch is off). Motor torque is generally proportional to motor current, so you may actually be applying a continuous torque with some ripply. Then the inertia of the motor helps smooth the speed even in the presence of a non-uniform torque.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also reduce the actual flicker of an LED by putting an inductor in series with it with a freewheeling diode but this is not usually practical at the frequency one might PWM an LED.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may also be informative to read about &lt;a href=&quot;http://en.wikipedia.org/wiki/Buck_converter&quot; rel=&quot;nofollow&quot;&gt;buck converters&lt;/a&gt; - particularly in continuous conduction mode. One can think of a DC motor as a speed dependent voltage source, which will allow you to consider it a buck converter that can transfer energy in either direction if it's moving - i.e. regenerative braking.&lt;/p&gt;&#xA;" OwnerUserId="5073" LastActivityDate="2013-07-22T18:57:28.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10011" PostTypeId="2" ParentId="9662" CreationDate="2013-07-23T00:01:24.107" Score="2" Body="&lt;p&gt;This can be split up in two questions for the sampling frequency and the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The required sampling frequency is given by the Nyquist theorem to be $f_s&amp;gt;2*f_{max}$ with $f_{max}$ being the largest frequency in your signal. When sampling actual signals with an ADC there is usually a low pass filter to ensure an upper frequency limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The function $f(x)$ is usually defined to $-\infty&amp;lt;x&amp;lt;\infty$. However, you can only pass a finite portion to the DFT. The DFT is not a time-discrete Fourier Transform but a Fourier Series. Hence, it is defined on periodic signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is actually periodic then it is favorable to perform the DFT over whole periods. From the DFT's point of view, the signal you hand to it is repeated infinitely and when you pass it an incomplete period, there will be border effects resulting in frequencies showing up that are not in the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is time limited, all of it should be contained in the vector you pass to the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal is neither time limited nor periodic you would theoretically need a DFT with infinite length, simular to the actual Fourier Transform which is defined for $-\infty&amp;lt;x&amp;lt;\infty$. Since this is not possible, Spectral Density Estimation techniques can be employed. The data can then be visualized with Spectogram plots showing the frequency content over time. It depends on what you are trying to achieve, really.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-07-23T00:01:24.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10012" PostTypeId="1" AcceptedAnswerId="10640" CreationDate="2013-07-23T00:48:49.690" Score="10" ViewCount="4111" Body="&lt;p&gt;I have to calculate the magnitude-squared coherence (MSC) between two signal. However, using a routine that uses only one taper (or no tapers at all) my result is always 1, despite the signals are clearly different. This doesn't happen if I use more than one taper. Searching a explication for this abnormal result, I come with a confusing characteristic of the MSC itself. The definition that I'm using is this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\gamma^2(\omega)=\frac{ |X(\omega)\overline{Y(\omega)}| ^2}{(X(\omega)\overline{X(\omega)}).(Y(\omega)\overline{Y(\omega)}) }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;X&lt;/em&gt; and &lt;em&gt;Y&lt;/em&gt; are the Fourier tranformed signals that depends on the frequency $\omega$. However, if you take any two complex numbers as the value of these functions in some fixed frequency, the result is always 1. Knowing that $|z|^2=z\overline{z} $ then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\gamma^2=\frac{(X\overline{Y})\overline{(X\overline{Y})} }{X\overline{X}Y\overline{Y}}=\frac{(X\overline{Y})(\overline{X}Y) }{X\overline{X}Y\overline{Y}}=\frac{X\overline{X}Y\overline{Y} }{X\overline{X}Y\overline{Y}}=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Certainly there must be something I must be misunderstanding but I can't see what it is. Can anyone explain to me what is the catch?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I'm gonna use some matlab links as trustable sources.&#xA;Definition of MS-coherence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/ref/mscohere.html&quot;&gt;http://www.mathworks.com/help/signal/ref/mscohere.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;definition of cross power spectral density&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/ref/cpsd.html&quot;&gt;http://www.mathworks.com/help/signal/ref/cpsd.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(the power spectral density is the &quot; &lt;em&gt;auto&lt;/em&gt; -cross&quot; spectral density, i.e. the Fourier transform of the autocorrelation)&#xA;A important property of the Fourier transform of the cross correlation can be found on wikipedia under &quot;properties&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another source can be found googling under the name &quot;Coherence function in biomedical signal processing&quot;. Sorry i didn't post the direct links here, I don't have enough &quot;reputation&quot;&lt;/p&gt;&#xA;" OwnerUserId="5074" LastEditorUserId="5074" LastEditDate="2013-07-23T15:55:46.600" LastActivityDate="2023-09-01T18:49:47.223" Title="Magnitude-squared Coherence calculation inconsistence" Tags="|discrete-signals|signal-analysis|statistics|coherence|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10014" PostTypeId="1" CreationDate="2013-07-22T19:17:54.347" Score="1" ViewCount="1246" Body="&lt;p&gt;making pink noise (1/f) using list of frequencies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to see what type of noise I would get if I used just the frequency in my voice.  I created a matlab array using fft to get the&#xA;[frequency,amplitude,phase] to reproduce my vocal signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to take this file/data and use it to create pink noise (1/f).  Of course when I use 1/f for the frequency the numbers become very small does anyone have any ideas how to use my own vocal frequencies that I get from doing a fft in matlab from my voice to create pink noise (1/f).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="1894" OwnerDisplayName="Rick T" LastEditorUserId="1894" LastEditDate="2013-07-23T11:02:38.790" LastActivityDate="2013-07-23T11:02:38.790" Title="making pink noise (1/f) using list of frequencies" Tags="|matlab|noise|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10015" PostTypeId="2" ParentId="10014" CreationDate="2013-07-22T21:39:33.003" Score="-4" Body="&lt;p&gt;Pink noise, as you know, has contributing amplitudes inversely proportional to each corresponding frequency. It appears more sinusoidal than white noise (constant power spectrum) because the low frequency components have large amplitudes. The high frequency components do not contribute that much to the overall noise amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To recreate pink noise in MATLAB, I would use the following technique:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.) Generate a square wave (ones(n) will create a square wave of width n).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.) Take the Fourier Transform of the signal (fft(x)). This will give you the sinc function. The DC component will be 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.) In a for loop, add noise to the amplitude of each frequency of the FFT sinc function. The range of values of the noise will be dependent on 1/f.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4.) Take the inverse Fourier Transform of the noisy FFT. Then subtract 1 to yield a pink noise vector of length n centered around $0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rBhli.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user14069" LastActivityDate="2013-07-22T21:39:33.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10016" PostTypeId="1" AcceptedAnswerId="10031" CreationDate="2013-07-23T07:52:34.457" Score="3" ViewCount="9256" Body="&lt;p&gt;I am working in the field of digital image processing and currently i am reading &lt;a href=&quot;https://www.dropbox.com/s/htndvwedmyd7ec1/paper.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; and I have two questions about it....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying a gaussian filter to a histogram, will the pixel values of the new histogram be changed or not?&#xA;And will the sum of pixels in new histogram be the same or not?&lt;/p&gt;&#xA;" OwnerUserId="5077" LastEditorUserId="4344" LastEditDate="2013-07-24T00:33:03.300" LastActivityDate="2013-07-24T05:35:42.703" Title="What is use of a gaussian filter over histogram?" Tags="|image-processing|filters|gaussian|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10017" PostTypeId="1" CreationDate="2013-07-23T08:30:57.397" Score="1" ViewCount="246" Body="&lt;p&gt;I am using an adaptive RLS adaptive filter for noise cancellation. My sampling freq. is 500 Hz, but I am interested in only frequencies of up to 60 Hz. I filter the input and the reference signal to the desired frequency range and then apply the adaptive filter. The adaptive filter does a good job at removing the noise. But, since I do not need such a high sampling freq. when my highest freq. is 60 Hz. I decimate by a factor of 4 after running an anti-aliasing filter and before applying the adaptive filter. Even if the input and the reference signal still display high correlation at the decimated rate, the adaptive filter does not perform well and produces spikes in the output. I wonder what the reason could be? Would it help if I use conditioning on the input, i.e. add some white noise before adaptive filtering (I am thinking in eigen value analogy and the smallest corresponding to white noise)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2013-07-23T08:30:57.397" Title="RLS adaptive filter" Tags="|adaptive-filters|decimation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10021" PostTypeId="1" AcceptedAnswerId="10037" CreationDate="2013-07-23T12:06:05.343" Score="0" ViewCount="126" Body="&lt;p&gt;I have created a frequency domain image filter and would like to test it against some images where it is known that the frequencies only occur within a given band. Trouble is, I don't know how to go about creating such images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have though about making an image that consists of intensities varying about the x and y axes as a function of sine waves of frequencies within the band. I don't know if this would be good enough though. Another method (don't know about the practicality of this) might be to define a matrix in the Fourier domain and then do an iDFT. Does anyone have any thoughts on the best way to proceed?&lt;/p&gt;&#xA;" OwnerUserId="4996" LastActivityDate="2013-07-24T10:58:06.633" Title="Image with specific frequencies" Tags="|filters|frequency|image-processing|frequency-domain|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10022" PostTypeId="1" AcceptedAnswerId="10025" CreationDate="2013-07-23T12:49:17.353" Score="0" ViewCount="685" Body="&lt;p&gt;My aim is to find cluster phonemes from a wav file. I would like to go through the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I am calculating spectrogram.&lt;/li&gt;&#xA;&lt;li&gt;Calculate energy of each frame.&lt;/li&gt;&#xA;&lt;li&gt;Cluster the frames using k-means clustering.&lt;/li&gt;&#xA;&lt;li&gt;save the clustered frames as wav file.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now I am in confusion, what should be the critarion to find the similarities among the spectrogram vectors? Is it possible to use euclidian distance or something else(co-relation)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expecting your suggestions. Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="4926" LastEditorUserId="128" LastEditDate="2019-09-15T18:51:49.530" LastActivityDate="2019-09-15T18:51:49.530" Title="Phoneme Clustering" Tags="|spectrogram|clustering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10025" PostTypeId="2" ParentId="10022" CreationDate="2013-07-23T13:39:13.363" Score="1" Body="&lt;p&gt;Comparing the raw spectrogram slices is not a good idea. For example, the spectrum of an &quot;aaa&quot; with a fundamental frequency of 100 Hz has no common peak with the spectrum of an &quot;aaa&quot; with a fundamental frequency of 105 Hz - the distance is likely to be very high - while it is the same phoneme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem is amplitude scaling - two instances of the same phoneme with a different amplitude would yield drastically different spectrogram - but yet, they are the same phonemes!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to use a representation like the first cepstral coefficients, or the MFCCs. These representations are invariant to moderate fundamental frequency changes, and by discarding the first coefficient you can make them invariant to amplitude changes too.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-07-23T13:39:13.363" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10026" PostTypeId="1" CreationDate="2013-07-23T14:36:40.880" Score="3" ViewCount="505" Body="&lt;p&gt;I'm using cross-correlation to look for a Barker code in a BPSK signal.  It occurred to me that if I send out a zero DC valued signal proceeding the barker code, it won't affect the correlation because a zero DC signal has zero correlation with any other signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This made me wonder if there's an alternative to cross-correlation which would work properly for a zero valued signal.  As an example, it seems intuitive that a signal such as [0,0,0,0,0] is closer to [.5,.5,.5,.5,.5] than it is to [1,1,1,1,1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, it seems like correlation is throwing away information that would be useful for doing better matching and I'm wondering how to fix this.&lt;/p&gt;&#xA;" OwnerUserId="3435" LastActivityDate="2013-07-23T16:39:52.113" Title="How do you find signal similarity when one signal has zero values? Correlation alternative?" Tags="|signal-detection|cross-correlation|correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10028" PostTypeId="2" ParentId="10026" CreationDate="2013-07-23T15:00:14.423" Score="1" Body="&lt;p&gt;The Correlator is really just a &lt;a href=&quot;http://en.wikipedia.org/wiki/Maximum_likelihood&quot; rel=&quot;nofollow&quot;&gt;Maximum Likelihood&lt;/a&gt; detector. If your noise is AWGN, (Additive White Gaussian Noise), then the correlator is optimal in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_squares&quot; rel=&quot;nofollow&quot;&gt;Least-squares sense&lt;/a&gt;. This is because a correlator is doing a match filtering with your incoming signal, and in this sense, will only consider &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt; bands where SNR is the highest, or rather, only consider DFT bands where your signal energy exists. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;This made me wonder if there's an alternative to cross-correlation&#xA;  which would work properly &lt;strong&gt;for a zero valued signal&lt;/strong&gt;.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Regarding the second paragraph, the 'signal' you are trying to 'correlate' against, [0 0 0 0 0], has zero energy, so the above would not apply. It does not have to do with its mean (DC band of the DFT is null), it has to do with the fact that it has no energy. (&lt;em&gt;All&lt;/em&gt; DFT bands are null). In a special case such as this, then you could perform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e[n] = \sum_{n=0}^{N-1} |x[n] - y[n]|&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is your known signal, and $y[n]$ is your given signal. In effect, this is nothing but the L1-&lt;a href=&quot;http://en.wikipedia.org/wiki/Norm_%28mathematics%29&quot; rel=&quot;nofollow&quot;&gt;norm&lt;/a&gt; of the difference of vectors. You would then pick the $y[n]$ vector that minimizes this error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that if your 'known signal' is always the zero vector, then this collapses to simply the L1-norm of your given vector. The one with the lowest L1-norm is the one closest to the zero vector).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast with the matched filter, this metric will not suffer if your 'signal' has no energy.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-07-23T16:39:52.113" LastActivityDate="2013-07-23T16:39:52.113" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10029" PostTypeId="1" CreationDate="2013-07-23T15:55:53.577" Score="0" ViewCount="2267" Body="&lt;p&gt;I am quite familiar with signal processing using Matlab. Now I am working in its open source alternative 'Scilab.' In Matlab, cconv() function is used to perform circular convolution between two sequences. I want to do circular convolution in Scilab. But I could not find an equivalent function for circular convolution in Scilab. Are there any other methods to perform circular convolution in Scilab (or, is there really a function for circular convolution in Scilab)?&lt;/p&gt;&#xA;" OwnerUserId="5082" LastActivityDate="2013-07-23T17:39:52.160" Title="Circular Convolution in Scilab" Tags="|matlab|convolution|" AnswerCount="1" CommentCount="2" ClosedDate="2013-09-18T17:02:08.507" ContentLicense="CC BY-SA 3.0" />
  <row Id="10030" PostTypeId="2" ParentId="10029" CreationDate="2013-07-23T17:39:52.160" Score="2" Body="&lt;p&gt;I can't tell about SciLab but if it is not implemented, you can always get the circular convolution by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IDFT(DFT(x1) * DFT(x2))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where x1 and x2 are your signal vectors and the multiplication is element-wise. If the signals have a different length, zeropad the shorter one to the length of the longer one. This assumes that you want to do circular convolution with a modulus equal to the length of the longer vector.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-07-23T17:39:52.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10031" PostTypeId="2" ParentId="10016" CreationDate="2013-07-23T19:18:16.843" Score="7" Body="&lt;p&gt;For you questions:&#xA;1. After applying gaussian filter on a histogram, the pixel value of new histogram will be changed. &#xA;2. The sum of pixels in new histogram is almost impossible to remain unchanged. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Visually speaking, after your applying the gaussian filter (low pass), the histogram shall become more smooth than before. Thus, the new histogram is definitely changed. With regards to the sum of pixels in new histogram, you may consider the problem a little bit differently. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that you have a normalized image histogram $$p(x) = {\# {\rm pixels\,\, of\,\, value\,\,} x\over N},$$where $N$ is the total number of pixels in an image. Then $p(x)$ is also a p.m.f., because $\sum_{x}p(x)=1$. Then the sum of pixels $$S=E[x]\times N,$$&#xA;where $E[x]=\sum_{x}xp(x)$ is the mean pixel value over the entire image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say your have a 1D gaussian filter as &#xA;$$f(y)={1\over \sqrt{2\pi}\sigma_y}\exp\left(-{(y-\mu_y)^2\over 2\sigma_y^2}\right).$$ Commonly, people set $\mu_y=0$ as a zero-mean gaussian, and $\sigma_y^2$ is the variance.  As a result, the new histogram after applying the gaussian filter can be written as &#xA;$$p'(x) = \sum_zp(z)f(x-z),$$&#xA;which can be considered as the gaussian weighted sum of the original neighbor histogram stems. Alternative, you may consider the relationship among the new histogram, the old histogram and the gaussian filter as &#xA;$$p'(x) = p(x)*f(x)$$&#xA;where $*$ denotes the convolution operator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This notation then brings out an alternative interpretation from random variables (r.v.). Assume r.v. $a\sim p(a)$, and r.v. $b\sim f(b)$, then r.v. $$c=a+b \,\sim\, p'(c),$$&#xA;when $a$ and $b$ are independent. Though it is somewhat hard to believe at the first glance, this interpretation tells you that the theoretical histogram of a noisy image (which is corrupt by the noise following the same gaussian distribution you used in filtering) is the identical to the histogram that you filtering the original histogram with that gaussian filter. One thing that I need to point out here is that even though $c\sim p'(c)$ doesnot mean that you will see the exact same distribution, because all what you can see is realizations of this distribution, but not itself directly.  Please see the following figures for details. As you can see, red and green curves match very well, but they are still slightly different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, we are ready to answer your second questions whether the sum of pixels changes before and after filtering. Using our previous derivations, you will see this question is equivalent to ask whether &#xA;$$E[c] =E[a] ?$$&#xA;where $c\sim p'(c)$ and $a\sim p(a)$. If $b$ follows a zero-mean gaussian, then $E[c]=E[a]+E[b]=E[a]$. Otherwise, they are not equal. Once again, you may not expect to see these values are identical, because $E[c]$ is only a theoretical value, and the actual observed mean value can be deviate from this theoretical value (the degree of how much the observed mean deviate from the theoretical one depends on the number of pixels, the more pixels the closer these two means). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5zFCR.png&quot; alt=&quot;images&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/R6qRC.png&quot; alt=&quot;histograms&quot;&gt;&#xA;Here is some Matlab code that generates the above figures. Play this demo, and you will see what I mean.   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('cameraman.tif');&#xA;[p,val] = imhist(I);&#xA;p = p./numel(I); % &amp;lt;== p(x) original histogram&#xA;figure,plot(p)&#xA;sigma = 5;&#xA;f = normpdf(-20:20,0,sigma); % &amp;lt;== f(x) gaussian distribution&#xA;p1 = conv(p,f); % &amp;lt;== p'(x) new histogram after applying gaussian filtering&#xA;hold on, plot(val(1)-20:val(end)+20,p1,'r--','Marker','o')&#xA;&#xA;% alternative interpreation &#xA;N = randn(256)*sigma; % &amp;lt;== white gaussian noise following p.d.f f(x)&#xA;I2 = N+double(I); % &amp;lt;== a noisy observation by adding noise to the original image&#xA;[p2,val] = hist(I2(:),val(1)-20:val(end)+20); % &amp;lt;== p''(x) the hisogram of the noisy image&#xA;p2 = p2./numel(I);&#xA;hold on, plot(val,p2,'g-.','Marker','*')&#xA;legend('original histogram', 'histogram after applying gaussian filter', 'histogram after adding gaussian noise')&#xA;&#xA;figure,&#xA;subplot(131),imagesc(I),axis image,colormap(gray),title('original image I');&#xA;subplot(132),imagesc(N),axis image,colormap(gray),title('white gausian noise N');&#xA;subplot(133),imagesc(I2),axis image,colormap(gray),title('noisy image I2 = I+N');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="1849" LastEditDate="2013-07-24T05:35:42.703" LastActivityDate="2013-07-24T05:35:42.703" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10032" PostTypeId="2" ParentId="9984" CreationDate="2013-07-23T20:02:24.567" Score="1" Body="&lt;p&gt;This is a very broad question, and certainly too broad to be comprehensively answered here. Broadly though you can consider the following steps as important in speech recognition/natural language processing (NLP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Analog to digital conversion. This encompasses issues such as sampling the speech, filtering/noise reduction, and segmentation of the signal into chunks that can be processed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Representing natural language. That is, somehow modelling the language so that you can understand how it is constructed. Typically for this both language and acoustic models are used (&lt;a href=&quot;https://www.youtube.com/watch?v=K1tBjg503uU&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=K1tBjg503uU&lt;/a&gt;). These are statistical representations of common patterns and models of structures in language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Infering the most likely translation. This is the process of actually 'translating' the speech to text (or whatever output you expect from your speech recognition). Typically a machine learning/statistical step. Unsurprisingly numerous algorithms have been employed to achieve this, with the most prominent that I have seen being the hidden Markov Model (&lt;a href=&quot;https://www.youtube.com/watch?v=TPRoLreU9lA&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=TPRoLreU9lA&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I say, this is very broad and there are a number of issues to deal with. For a good introduction to the latter 2 issues I highly recommend taking a free course such as the &lt;a href=&quot;https://www.coursera.org/learn/natural-language-processing&quot; rel=&quot;nofollow noreferrer&quot;&gt;NLP course on Corsera&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also note that NLP is a computationally difficult problem and one that is an active area of research spanning a number of fields (e.g computing science, linguistics, mathematics, statistics). Therefore, if you intend to seriously understand contemporary methods then you should be prepared to do a lot of reading - as there is no &lt;em&gt;easy&lt;/em&gt; solution. That being said, there are plenty of kind people out there who have helpfully made excellent software that can be used (e.g &lt;a href=&quot;http://cmusphinx.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://cmusphinx.sourceforge.net/&lt;/a&gt;). So with a basic grasp of the issues I mentioned you should be able to use such software effectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best of luck in delving into what is a challenging but fascinating area of active research.&lt;/p&gt;&#xA;" OwnerUserId="4996" LastEditorUserId="25707" LastEditDate="2017-03-26T14:00:43.537" LastActivityDate="2017-03-26T14:00:43.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10033" PostTypeId="2" ParentId="8721" CreationDate="2013-07-23T20:34:03.150" Score="2" Body="&lt;p&gt;As mentioned the object counting problem is very challenging. A good account of some common approaches is given in &lt;a href=&quot;http://www.robots.ox.ac.uk/%7Evilem/NIPS2010.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Learning To Count Objects in Images&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Creating a SIFT feature database on training images would appear to be the natural path to go down. That in combination with some image segmentation may be the way to go.&lt;/p&gt;&#xA;&lt;p&gt;Another path might be to look at HOG &lt;a href=&quot;http://chrisjmccormick.wordpress.com/2013/05/09/hog-person-detector-tutorial/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chris McCormick - HOG Person Detector Tutorial&lt;/a&gt;, which is similarly a feature detection algorithm, could be adapted for cars.&lt;/p&gt;&#xA;" OwnerUserId="4996" LastEditorUserId="7092" LastEditDate="2022-05-16T15:59:04.090" LastActivityDate="2022-05-16T15:59:04.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10034" PostTypeId="2" ParentId="9976" CreationDate="2013-07-23T21:21:35.137" Score="2" Body="&lt;p&gt;I don't know if I completely understand your question, but I will have a go at clarifying the scale space, multi-resolution ocataves and why they are important for SIFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand the scale space it is helpful to consider how you recognise images at different distances (e.g far away you may be able to distinguish the shape of a person. As that person moves closer more specific details may become apparent and thus you may recognise them). So, the spacial scale is important when attempting to recognise features in an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when we are processing an image we do not know the spacial scale at which the important features for recognition will be present. Therefore by blurring the image with a Gaussian filter, each image represents a different spacial scale. It is important to note that when a distinctive feature appears at a given scale, it will persist in images that have been smoothed with a smaller kernel. An interesting question is then if we can identify which spatial scale a given feature presents itself at. This can be done by taking the difference of two Gaussian filters. This is termed the difference of Gaussians (DOG). This is precisely what is done in the SIFT algorithm - and is thought to approximate the human visual system to some degree. SIFT achieves scale invariance by looking for extrema across different spatial bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is here the multi-resolution pyramid comes into play. Because blurred images represent lower frequency information it is computationally more concise to downscale the image at each frequency band. This allows for a uniform method to explore the spacial scale of the information. Remember, the purpose of SIFT is to find features which are as invariant as possible across different scales. So being able to explore the spacial scales at which features occur is important. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps. You may also find &lt;a href=&quot;http://www.aishack.in/2010/05/sift-scale-invariant-feature-transform/&quot; rel=&quot;nofollow&quot;&gt;http://www.aishack.in/2010/05/sift-scale-invariant-feature-transform/&lt;/a&gt; useful. &lt;/p&gt;&#xA;" OwnerUserId="4996" LastEditorUserId="4996" LastEditDate="2013-07-23T21:54:18.880" LastActivityDate="2013-07-23T21:54:18.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10036" PostTypeId="1" CreationDate="2013-07-23T12:26:07.643" Score="2" ViewCount="1872" Body="&lt;p&gt;I've been using F-K Filter, for a while, but I guess I never had good basic understanding about it Math. Someone asked me what is the cause of frequency wrap around in F-K Spectra plot ? I know it's because of aliasing. But if somebody please elaborate more on the cause of this wrap around? Simple Math explanation perhaps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;&#xA;&lt;p&gt;:)&lt;/p&gt;&#xA;" OwnerDisplayName="fhd104" LastEditorUserId="-1" LastEditDate="2013-07-24T14:58:07.930" LastActivityDate="2017-06-20T19:26:42.073" Title="Spatial Aliasing - Wrap Around F-K Spectra" Tags="|fourier-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10037" PostTypeId="2" ParentId="10021" CreationDate="2013-07-24T10:58:06.633" Score="0" Body="&lt;p&gt;Your second option is the most common: choose a frequency of interest, set the corresponding coefficient in the Fourier domain then take the inverse transform.&#xA;You have to pay attention to the correct scaling of the non-zero coefficient and to the particular FFT coefficient arrangement (continuous frequency in the middle or in one corner of the Fourier matrix).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-07-24T10:58:06.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10038" PostTypeId="2" ParentId="10036" CreationDate="2013-07-24T12:38:33.767" Score="0" Body="&lt;p&gt;@Dimension10,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of aliasing in FK is the ambiguous/wrong interpretation of apparent velocity and direction of arrival. If you see a clear line in your FK plot, the ratio of F and K (assuming K_x, a regular linear array) anywhere along the line gives you the apparent velocity for the plane wave crossing the array. If you know the actual velocity of the medium in which the wave propagates, you can find the azimuth, or the direction of wave arrival. Now, if the distance between the neighbouring sensors on your array is larger than half the wavelength, you will get aliasing as there are not enough spatial samples to uniquely identify the wave.&#xA;In my field, seismic, this would give rise to wrong interpretation of the dip, that is which way the reflector (a geological layer) is tilting. Of course, in seismic analysis the medium velocity is not homogeneous which makes the interpretation more difficult. &lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2013-07-24T12:38:33.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10039" PostTypeId="1" CreationDate="2013-07-24T12:39:11.017" Score="1" ViewCount="158" Body="&lt;p&gt;This question is theoretical. Let's say you have three different highly compressed images of a same source image, each compressed with a different algorithm and thus &quot;lossy&quot; in different ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the possible techniques to recover the best possible image, using the three different compressed versions ?&lt;/p&gt;&#xA;" OwnerUserId="5087" LastActivityDate="2013-07-24T15:03:28.577" Title="What are some techniques to recover an original image from three different compressed versions?" Tags="|image-processing|compression|image-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10040" PostTypeId="1" AcceptedAnswerId="10041" CreationDate="2013-07-24T12:47:13.633" Score="3" ViewCount="652" Body="&lt;p&gt;I've been trying to model some radio signal properties of wireless networks wrt its usefulness. For example, most WiFi network adapters would decrease their transmission rate if the overall quality of the signal is bad so as to avoid re-transmission, errors, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the relationship of the received signal strength (measured in dBm) and the signal-to-noise ratio (SNR) wrt the overall signal quality? Ideally, I am looking for an equation or paper reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5086" LastActivityDate="2016-08-19T08:12:03.493" Title="Relationship between SNR and link speed" Tags="|snr|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10041" PostTypeId="2" ParentId="10040" CreationDate="2013-07-24T13:34:01.163" Score="3" Body="&lt;p&gt;Signal strength is only important in determining signal quality insofar as it affects the signal-to-noise ratio (SNR).  As the name implies, SNR is determined by dividing the signal power by the noise power in the same bandwidth ($\frac SN$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Claude Shannon, the pioneer of information theory, came up with a formula that gives an upper limit to how much information (you can think of this as bits) can be transmitted for a given SNR and bandwidth $B$ (I will note, though, that Wikipedia calls it the &lt;a href=&quot;http://en.wikipedia.org/wiki/Shannon%E2%80%93Hartley_theorem&quot; rel=&quot;nofollow&quot;&gt;Shannon-Hartley theorem&lt;/a&gt;).  The formula is as follows-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C = B\log_2\left(1 + \frac{S}{N}\right)&#xA;$$&#xA;where $C$ is the channel capacity in bits/s, $B$ is the bandwidth, and $\frac{S}{N}$ is the SNR.  Modern transmitters/receivers try to get as close to this limit as they can through a number of means.  One way is to increase the bits per symbol as the SNR improves (e.g. going from QPSK to 16-QAM).  Another is to reduce the error correction coding as the SNR improves, and increase it when it worsens.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="1629" LastEditDate="2016-08-19T08:12:03.493" LastActivityDate="2016-08-19T08:12:03.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10042" PostTypeId="2" ParentId="10039" CreationDate="2013-07-24T15:03:28.577" Score="2" Body="&lt;p&gt;First of all, there are many solutions. Something better under one measure may be worse under another measure. So first you need to think about what is your quality measure(s) to evaluate a restored image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commonly, people use the &quot;mean square error (MSE)&quot; (or its log version, known as the peak signal noise ratio). Assume the ground-truth image is $X$, and the recovered image is $\hat{X}$. Then MSE is defined as &#xA;$${\rm{MSE}}(X,\hat{X}) = \sum_{i,j}(X[i,j]-\hat{X}[i,j])^2/N$$&#xA;where $N$ is the number of pixels in $X$, and $X[i,j]$ denotes a pixels located at $i$th row and $j$th column in $X$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without loss of generality, say we have $n$ compressed counterparts are $C_1,C_2,\cdots,C_n$, and we reconstruct $\hat{X}$ as &#xA;$$\hat{X}=f(C_1,C_2,\cdots,C_n)$$&#xA;where $f(\cdot)$ is a method to recover the original image from its compressed counterparts. And your objective is to find an appropriate function $f(\cdot)$ and minimizes the MSE. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To simplify the problem, people often restrict the function $f(\cdot)$ to some fixed type but with parameters to be learned from training data. For example, one simplest function can be the linear combination i.e.&#xA;$$f(C_1,C_2,\cdots,C_n) = \sum_{k}w_kC_k$$&#xA;where $w_k$ is the weight of using the $k$th compressed image in the recovered image. This is a classic regression problem and can be solved easily (go and check the normal equation, which gives the closed form solution to find all $w_k$s). However, you should note the following things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1). if you donot have any training data, the above method does not&#xA;work&lt;/li&gt;&#xA;&lt;li&gt;2). if your image is very large or your have many training images,&#xA;computing the closed form solution is not a good idea, because of too&#xA;many computations. Instead, you shall seek for methods like the&#xA;stochastic gradient descent or similar ones.&lt;/li&gt;&#xA;&lt;li&gt;3). if I were you, I will go and read more about linear regression&#xA;stuff. You will see interesting topics like how to prevent overfit by&#xA;adding regularization, and how to include the Bayesian idea in this&#xA;regression problem.&lt;/li&gt;&#xA;&lt;li&gt;4). my guess says the linear regression method is not the best way,&#xA;but it is a very good start point. Later your may try other&#xA;$f(\cdot)$, like kernel regressions, or adding more terms, e.g. the&#xA;total variation term.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-07-24T15:03:28.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10043" PostTypeId="1" AcceptedAnswerId="10044" CreationDate="2013-07-24T15:33:45.250" Score="10" ViewCount="20292" Body="&lt;p&gt;Here is the problem. I have a 2D array of data, first column represents the time data and the second column represents the sinusoidal response data, based on the time data. I apply fft and I get my frequency (that I started with) in a specific bin as I expected and I find the amplitude and phase angle from that bin. Now the problem is I have the same set up but with more data points, I apply the fft again and the bin number changes (which is normal and it is where I expect it to be), the amplitude is the same but the phase angle is different) first is this normal? second, what approach should I take? Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: neither of the set ups (mentioned above) give data of length of power of 2, say the first one gives 1620 data points and the second one gives 1745 data points, so should be taking the next power of 2 for both from the beginning?&lt;/p&gt;&#xA;" OwnerUserId="5088" LastActivityDate="2018-03-01T09:15:31.573" Title="How important is it to use power of 2 when using FFT?" Tags="|fft|phase|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10044" PostTypeId="2" ParentId="10043" CreationDate="2013-07-24T16:20:21.517" Score="5" Body="&lt;p&gt;Modern FFT libraries, such as FFTW and Apple's Accelerate framework can do non-power-of-2 FFTs very efficiently, as long as all the prime divisors of the composite length are fairly small (2,3,5,etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A power of 2 makes it simpler (about 1 page of source code) if you have to code your own FFT for some reason, or are otherwise constrained as to max program length (or FPGA gates, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For phase measurement, it might be easier to do an fftshift (pre-rotate the data by N/2) to reference FFT phase to the center of the data window, where the evenness/oddness ratio, and thus the phase won't change or alternate with bin number (for phase that is the same at the center of that data window) even for signals that are non-periodic in the FFT length, as you vary the length.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2018-03-01T09:15:31.573" LastActivityDate="2018-03-01T09:15:31.573" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10045" PostTypeId="2" ParentId="10043" CreationDate="2013-07-24T16:24:33.873" Score="6" Body="&lt;p&gt;There is nothing inherently 'magical' about performing a power of 2 DFT, other than the fact that performing a power of 2 DFT allows one to perform the DFT in $O(Nlog(N))$ instead of $O(N^2)$. So the power of 2 DFT, (The &lt;em&gt;algorithm&lt;/em&gt; that does this is known as the FFT), allows you to simply speed up your DFT computation by a huge factor.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I apply the fft again and the bin number changes (which is normal and&#xA;  it is where I expect it to be), the amplitude is the same but the&#xA;  phase angle is different) first is this normal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you do a larger DFT than your data vector, you are essentially going to be interpolating in the frequency domain. Thus, your new peak might not be the old equivalent peak that you first detected, before you took a larger DFT. And since it is not the same, you are essentially choosing a different complex exponential (sine plus cosine) basis this time around, meaning you would likely have a different phase value, yes. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;PS: neither of the set ups (mentioned above) give data of length of&#xA;  power of 2, say the first one gives 1620 data points and the second&#xA;  one gives 1745 data points, so should be taking the next power of 2&#xA;  for both from the beginning?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, if you want to take a power of 2 FFT, then you would simply chose the next power of 2 length FFT that is larger than your data record length.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;i dont necessarily want or not want to take the power of 2 FFT (time&#xA;  performance is not my issue at all), more like, do I need to?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You should never take an FFT of length less than your record length, unless you want to discard data. The question of &quot;How big does my FFT need to be&quot;, &lt;em&gt;assuming&lt;/em&gt; the FFT length is larger than your data record length, then quickly becomes application dependent. Usually you can get away with an FFT length the same as your record length. However, sometimes you want to pick a peak from a 'smoother' FFT. In this case, you can take a larger FFT length, (2 times more, 3 times more, 10 times more, etc), and you would have interpolated your peak in the frequency domain. There is no magic number, however. Remember that the granularity of your FFT result is always $\frac{f_s}{N}$.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-07-24T17:35:47.880" LastActivityDate="2013-07-24T17:35:47.880" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10047" PostTypeId="2" ParentId="10043" CreationDate="2013-07-24T20:50:05.037" Score="3" Body="&lt;p&gt;Showing @user4619's answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using IPython, which is similar to Matlab&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In[1]: fft(arange(2**22))&#xA;1 loops, best of 3: 354 ms per loop&#xA;&#xA;In[2]: fft(arange(4*1000*90*12)) # close to 2**22&#xA;# equal to 2*2 * 2*5*2*5*2*5 * 3*3*2*5 * 2*2*3&#xA;1 loops, best of 3: 295 ms per loop&#xA;&#xA;In[2]: fft(arange(2**22+1))&#xA;1 loops, best of 3: 14 s per loop&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you're using really prime numbers, rather important (a factor of 50!). If you're using numbers that have low factors, not important. But doing it with only prime numbers only does it faster -- it doesn't change the answer at all.&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2013-07-24T20:50:05.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10048" PostTypeId="1" CreationDate="2013-07-24T22:11:12.780" Score="0" ViewCount="2563" Body="&lt;p&gt;I have asked the same question in stackoverflow ,&lt;a href=&quot;https://stackoverflow.com/questions/17794772/steps-for-successful-image-recognition/17840975?noredirect=1#17840975&quot;&gt;https://stackoverflow.com/questions/17794772/steps-for-successful-image-recognition/17840975?noredirect=1#17840975&lt;/a&gt;,  but since I am not getting considerable responses , I'm going to ask it again here .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to do successful image recognition what are the steps one has to follow ,for example denoising , use of LDA , PCA , then use of neural network . I am not looking for any algorithm , just a brief outline of each of the steps from capturing an image to test an input image for similarity.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-07-25T01:33:33.013" Title="Steps for successful image recognition" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10049" PostTypeId="1" AcceptedAnswerId="10086" CreationDate="2013-07-24T22:30:50.133" Score="2" ViewCount="430" Body="&lt;p&gt;What I'm trying to do is, given some experimental data and it's (magnitude normalized to 1) FFT, match the FFT with one of say 1000 other (magnitude normalized to 1) FFT plots. Please note that the experimental/generated plots all have the same bin width/count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially what I'm doing is taking the normalized cross correlation between the experimental FFT plot and each of the generated FFT plots, and then saving only the zero lag value. Then the highest of these values is found at the end which tells which plot correlated best..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This actually works pretty well, but it doesn't seem like something that is done often.. so&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does this make sense? Is it something that's ever done in the DSP community? Are there better methods of doing this which I'm oblivious to? (Note I have tried an &lt;a href=&quot;https://en.wikipedia.org/wiki/Mean_squared_error&quot; rel=&quot;nofollow&quot;&gt;MSE&lt;/a&gt; metric with limited success).&lt;/li&gt;&#xA;&lt;li&gt;If what I'm doing is okay, are there any improvements I can make to it. I have two small problems. The first is computational time, I can compute the zero lag correlation by hand in Matlab as sum(x.*y)/scalefactor (scalefactor = sqrt(sum(x.^2).*sum(y.^2)) ) or I can use xcorr(x,y,0,'coeff') to grab the zero lag value. I'm not sure if these are optimized as well as they could be...  The second issue is that if any of the set of generated FFT's are large, say a constant 1 over f=0 to 0.5, the cross correlation metric will be large despite the experimental FFT being much &quot;different&quot;.  This actually makes me think cross correlation is not the right metric to use, so, any thoughts?  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;UPDATE: So thinking about this some more, I determined what I was doing was equivalent to just taking the two sequences and performing a circular convolution on them and saving the maximum value. This is the same as computing the FFT of the sequences and then cross correlating them and saving the zero lag value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this method I end up doing something like ifft(fft(x).*conj(fft(y))) to do the circular correlation quickly, although I'm still trying to determine if this is more efficient than what i was doing before...&lt;/p&gt;&#xA;" OwnerUserId="4794" LastEditorUserId="4794" LastEditDate="2013-07-25T23:10:15.517" LastActivityDate="2013-07-27T01:12:01.893" Title="Given an experimental FFT plot, how to find the best match from a set of generated FFT plots?" Tags="|matlab|fft|frequency-spectrum|cross-correlation|estimation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10050" PostTypeId="2" ParentId="10048" CreationDate="2013-07-25T01:33:33.013" Score="2" Body="&lt;p&gt;First of all, your question is board and it is hard to be answered thoughtfully. In general, image recognition itself is a wide topic. It might refer to classify a given image into a topic, or to recognize faces, objects, or text information in an image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the objective of image recognition, you may use completely different processing steps. However, you may write the following general steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Training&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;get training data set&lt;/li&gt;&#xA;&lt;li&gt;preprocessing (e.g. denoising, normalization, scaling, contrast&#xA;equalization, binarization)&lt;/li&gt;&#xA;&lt;li&gt;feature extraction (e.g. sift, hog, lbp, raw pixels, contours, edge&#xA;map, DCT, DFT)&lt;/li&gt;&#xA;&lt;li&gt;machine learning (e.g. logistic regression, neural network, svm)&lt;/li&gt;&#xA;&lt;li&gt;parameter tuning (need a dev. set)&lt;/li&gt;&#xA;&lt;li&gt;check results on how good you are, and see whether you need more data. If so, go to step 1 and repeat the process again. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Recognition:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the same preprocessing in training&lt;/li&gt;&#xA;&lt;li&gt;the same feature extraction in training&lt;/li&gt;&#xA;&lt;li&gt;feed your features into the trained classifier&lt;/li&gt;&#xA;&lt;li&gt;output classification results. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note: depending on your objective, preprocessing and selected features can be very different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Asking someone to mark data manually is expensive. So people often use free dataset, each of which is often created for a specific purpose. Thus, these dataset may or may not satisfy your needs. Meanwhile, images from different dataset are often inconsistent, e.g. one set maybe of small grayscale images, while another maybe of large color images. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-07-25T01:33:33.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10052" PostTypeId="1" AcceptedAnswerId="10079" CreationDate="2013-07-25T02:57:26.100" Score="7" ViewCount="399" Body="&lt;p&gt;I'm not sure if I'm on right place to ask a simple suggestion, so please be kind and don't downvote my question. I'm not asking someone to do it for me, I just need short guidance how should I proceed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm writing a study of Blind source separation using eigenvalue decomposition. Since I'm not good at writing, I have done so far the needed programming part in Matlab. The study must be composed of ~50 pages theory about the problem. Theory should be in terms of explaining the BSS, BSS methods, ICA, and EVD which is the main topic. Can you suggest what to include in my writing since BSS has a lot of methods and it is difficult for me to decide and follow what to write and what not write. Can someone outline the order of things I should write and mention in my study?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stuck at what should I write next, so far I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Introduction to BSS&#xA;Definition of Independence of signals&#xA;Independence and correlation&#xA;PCA and other prewhitening methods: &#xA;        1. centering &#xA;        2. whitening&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using books like: Independent Component Analysis - A Tutorial Introduction Handbook of Blind Source Separation Independent Component Analysis and Applications 2010 - Pierre Comon, Christian Jutten&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&lt;/p&gt;&#xA;" OwnerUserId="5093" LastEditorUserId="90" LastEditDate="2013-07-26T12:59:26.983" LastActivityDate="2017-03-26T13:20:08.453" Title="Which sections to cover for my graduation thesis on blind source separation?" Tags="|matlab|signal-analysis|ica|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10055" PostTypeId="1" CreationDate="2013-07-25T11:47:12.677" Score="5" ViewCount="10685" Body="&lt;p&gt;I've read that OFDM normally uses a one-tap equalizer.  It seems that a one-tap equalizer could only scale and delay a signal.  Why is this useful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought multipath was handled through the cyclic-prefix and by choosing a symbol width that is large compared to the delay spread.  Why is an equalizer needed at all?&lt;/p&gt;&#xA;" OwnerUserId="3435" LastActivityDate="2023-09-25T12:01:41.340" Title="What does the one-tap equalizer used with OFDM accomplish?" Tags="|digital-communications|ofdm|multipath|equalization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10056" PostTypeId="1" AcceptedAnswerId="10058" CreationDate="2013-07-25T13:39:48.103" Score="3" ViewCount="1330" Body="&lt;p&gt;I'm currently using MATLAB's fdatool for filter design. Using that tool, I can easily design different kind of filters. For example, let's take a band-pass FIR filter with 10-40 Hz passband, and 5-10 Hz and 40-45 Hz transition bands. Usually, I design the filter with the selection &quot;least-squares&quot;, which, if I understand correctly, uses the aforementioned method to find the best impulse response according to filter spesifications. To actually filter the signal, I use the command &lt;em&gt;filtfilt&lt;/em&gt;, which does zero-phase FIR filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, an alternative way to implement the filter would be to take the FFT of my signal, set frequencies outside the range 10-40 Hz as zeros, and then take the IDFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there &lt;em&gt;any&lt;/em&gt; practical/theoretical difference between these two approaches? Will the frequency responses (magnitude and phase) be the same?&lt;/p&gt;&#xA;" OwnerUserId="5097" LastActivityDate="2013-07-26T18:40:36.813" Title="About designing digital filters" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="0" ClosedDate="2013-09-06T21:20:30.683" ContentLicense="CC BY-SA 3.0" />
  <row Id="10057" PostTypeId="1" AcceptedAnswerId="10063" CreationDate="2013-07-25T14:03:51.540" Score="29" ViewCount="107510" Body="&lt;p&gt;I've implemented a gaussian blur fragment shader in GLSL. I understand the main concepts behind all of it: convolution, separation of x and y using linearity, multiple passes to increase radius...&lt;/p&gt;&#xA;&lt;p&gt;I still have a few questions though:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What's the relationship between sigma and radius?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've read that sigma is equivalent to radius, I don't see how sigma is expressed in pixels. Or is &amp;quot;radius&amp;quot; just a name for sigma, not related to pixels?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;How do I choose sigma?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Considering I use multiple passes to increase sigma, how do I choose a good sigma to obtain the sigma I want at any given pass? If the resulting sigma is equal to &lt;em&gt;the square root of the sum of the squares of the sigmas&lt;/em&gt; and sigma is equivalent to radius, what's an easy way to get any desired radius?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What's the good size for a kernel, and how does it relate to sigma?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've seen most implementations use a 5x5 kernel. This is probably a good choice for a fast implementation with decent quality, but is there another reason to choose another kernel size? How does sigma relate to the kernel size? Should I find the best sigma so that coefficients outside my kernel are negligible and just normalize?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5098" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2021-03-30T22:22:41.030" Title="Gaussian Blur - Standard Deviation, Radius and Kernel Size" Tags="|image-processing|gaussian|blur|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10058" PostTypeId="2" ParentId="10056" CreationDate="2013-07-25T14:19:44.467" Score="2" Body="&lt;p&gt;Filtering can be done in the frequency domain which is actually a very efficient technique (and it can very well be, that Matlab does this internally). However, for very long signals it's not as straight-forward as &quot;taking the FFT and applying a frequency response&quot;. You can read up on overlap-add filtering which is a possibility to filter in frequency domain. However, this is mainly done because it can be faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this question is independent from filter design which is a completely different thing. Every FIR filter has a corresponding frequency response and it does not matter whether you convolve in time domain or apply the frequency response in frequency domain. So your approach becomes a question of filter design and the consequences it has.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just setting unwanted frequencies to zero might completely eliminate those frequencies but it usually comes at the price of a significant ringing in the time domain which is usually unwanted (&lt;a href=&quot;http://en.wikipedia.org/wiki/Ringing_artifacts&quot; rel=&quot;nofollow&quot;&gt;Wikipedia on ringing&lt;/a&gt;). So in fact, what you are proposing is just one way to design a filter and frankly not a good one in most cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By allowing a transition band in which the frequency response can gradually go from passband to stopband, degrees of freedom are gained that can be used to improve other properties of the resulting filter (for example eliminate the ringing or obtain a shorter impulse response). That's why Matlab implements so many different filter types, they all have different properties and selecting the most suited one is actually part of designing your signal processing system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This topic is actually quite complicated and I suggest to read up on filter design. Whole books can be filled with this.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastEditorUserId="5069" LastEditDate="2013-07-25T14:32:05.957" LastActivityDate="2013-07-25T14:32:05.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10059" PostTypeId="2" ParentId="10055" CreationDate="2013-07-25T14:55:03.180" Score="7" Body="&lt;p&gt;The OFDM signal as a whole is affected by frequency selective filtering. It is usually designed such that the subcarrier bandwidth is smaller than the channel coherence bandwidth. This yields you frequency flat fading for each subcarrier which can be described by a single complex multiplication and equalization can equally done with just one tap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equalization in OFDM usually happens in the frequency domain. Let $X$ be the vector of subcarriers in the frequency domain and $x=IDFT(X)$ the corresponding time domain signal. Then, if the impulse response of your channel is a vector $h$, the received signal $y$ will be $y=x*h$ where $*$ referes to convolution. Then $Y=DFT(Y)=X \cdot H$ with $H=DFT(h)$ and $\cdot$ refering to element-wise multiplication. However, this is only true if $y$ is the circular convolution of $x$ and $h$ while in reality the convolution is linear. Therefore, the cyclic prefix is prepended (it needs to be at least as long as $h$) so that the linear convolution contains the circular convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, $Y=DFT(Y)=X \cdot H$ with $H=DFT(h)$ and $\cdot$ as stated before. Since each element of $Y$ and $X$ refers to one subcarrier it can be seen that each subcarrier is multiplied with just one complex element from $H$ and hence equalization just becomes $Z=Y/H$ where again $/$ referes to element-wise division. This describes zero-forcing equalization which might not be the best choice if additive noise and interferers are present but it transports the idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is nothing else but one-tap equalization for each individual subcarrier.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-07-25T14:55:03.180" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10060" PostTypeId="1" CreationDate="2013-07-25T15:01:29.510" Score="3" ViewCount="154" Body="&lt;p&gt;As the title suggests , I'm looking for good books on medical imaging . It would be a great help if you can provide a link to the books website .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2013-07-25T20:55:45.573" Title="Books on medical imaging" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ClosedDate="2013-09-06T21:18:27.220" CommunityOwnedDate="2013-07-25T20:56:15.387" ContentLicense="CC BY-SA 3.0" />
  <row Id="10061" PostTypeId="1" CreationDate="2013-07-25T16:03:34.050" Score="7" ViewCount="15293" Body="&lt;p&gt;If I have a signal that has 740 samples, the sampling frequency is 1000 Hz, and I take an FFT of length 1024, are the frequencies I get now 0, fs/1024, 2*fs/1000, ..., 511*fs/1024? I mean, do I get this correctly: the frequency resolution does not depend on the number of samples I have, only FFT length and sampling frequency. If I had 1480 samples, the resolution would be still the same? This makes my head hurt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, suppose that the signal I have has an interesting frequency at 26 Hz (strictly that one frequency). How do I get it appear properly in the frequency spectrum (my frequency bins are spaced 1000/1024 = 0.9766 Hz apart, so am I at dead end?).&lt;/p&gt;&#xA;" OwnerUserId="5099" LastEditorUserId="5099" LastEditDate="2013-07-25T16:09:14.607" LastActivityDate="2018-06-11T13:37:39.043" Title="Does the number of samples matter for FFT, and how to get a specific frequency visible?" Tags="|fft|frequency|frequency-domain|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10062" PostTypeId="1" AcceptedAnswerId="10064" CreationDate="2013-07-25T16:30:28.050" Score="14" ViewCount="14927" Body="&lt;p&gt;I have a thirty-second speech signal that was sampled at 44.1 kHz. Now, I would like to show what frequencies the speech has. However, I'm not sure what would be the best way to do that. It seems sometimes one calculates the absolute value of a Fourier transform, and sometimes power spectral density. If I understand correctly, the latter works so that I divide my signal into parts, do FFT part-by-part and somehow sum these. Window functions are somehow involved. Can you clarify this a bit for me? I'm new to DSP.&lt;/p&gt;&#xA;" OwnerUserId="5100" LastActivityDate="2013-07-26T17:22:33.657" Title="When should I calculate PSD instead of plain FFT magnitude spectrum?" Tags="|fft|frequency-spectrum|dft|speech|frequency-domain|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10063" PostTypeId="2" ParentId="10057" CreationDate="2013-07-25T16:51:10.713" Score="27" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What's the relationship between sigma and radius? I've read that sigma is equivalent to radius, I don't see how sigma is expressed in pixels. Or is &quot;radius&quot; just a name for sigma, not related to pixels?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are three things at play here. The variance, ($\sigma^2$), the radius, and the number of pixels. Since this is a 2-dimensional gaussian function, it makes sense to talk of the covariance matrix $\boldsymbol{\Sigma}$ instead. Be that as it may however, those three concepts are weakly related. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, the 2-D gaussian is given by the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;g({\bf z}) = \frac{1}{\sqrt{(2 \pi)^2 |\boldsymbol{\Sigma}|}} e^{-\frac{1}{2} ({\bf z}-\boldsymbol{\mu})^T \boldsymbol{\Sigma}^{-1} \ ({\bf z}-\boldsymbol{\mu})}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where ${\bf z}$ is a column vector containing the $x$ and $y$ coordinate in your image. So, ${\bf z} = \begin{bmatrix} x \\ y\end{bmatrix}$, and $\boldsymbol{\mu}$ is a column vector codifying the mean of your gaussian function, in the $x$ and $y$ directions $\boldsymbol{\mu} = \begin{bmatrix} \mu_x \\ \mu_y\end{bmatrix}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let us say that we set the covariance matrix $\boldsymbol{\Sigma} = \begin{bmatrix} 1   &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix}$, and $\boldsymbol{\mu} = \begin{bmatrix} 0 \\ 0\end{bmatrix}$. I will also set the number of pixels to be $100$ x $100$. Furthermore, my 'grid', where I evaluate this PDF, is going to be going from $-10$ to $10$, in both $x$ and $y$. This means I have a grid resolution of $\frac{10 - (-10)}{100} = 0.2$. But this is completely arbitrary. With those settings, I will get the probability density function image on the left. Now, if I change the 'variance', (really, the covariance), such that $\boldsymbol{\Sigma} = \begin{bmatrix} 9   &amp;amp; 0 \\ 0 &amp;amp; 9\end{bmatrix}$ and keep everything else the same, I get the image on the right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CQiM7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of pixels are still the same for both, $100$ x $100$, but we changed the variance. Suppose instead we do the same experiment, but use $20$ x $20$ pixels instead, but I &lt;em&gt;still&lt;/em&gt; ran from $-10$ to $10$. Then, my grid has a resolution of $\frac{10-(-10)}{20} = 1$. If I use the same covariances as before, I get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OdN8J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are how you must understand the interplay between those variables. If you would like the code, I can post that here as well.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I choose sigma?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The choice of the variance/covariance-matrix of your gaussian filter is extremely application dependent. There is no 'right' answer. That is like asking what bandwidth should one choose for a filter. Again, it depends on your application. Typically, you want to choose a gaussian filter such that you are nulling out a considerable amount of high frequency components in your image. One thing you can do to get a good measure, is compute the 2D DFT of your image, and overlay its co-efficients with your 2D gaussian image. This will tell you what co-efficients are being heavily penalized. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your gaussian image has a covariance so wide that it is encompassing many high frequency coefficients of your image, then you need to make its covariance elements smaller.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="3242" LastEditDate="2017-10-30T00:10:01.267" LastActivityDate="2017-10-30T00:10:01.267" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10064" PostTypeId="2" ParentId="10062" CreationDate="2013-07-25T17:28:45.717" Score="10" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Now, I would like to show what frequencies the speech has. However,&#xA;  I'm not sure what would be the best way to do that. It seems sometimes&#xA;  one calculates the absolute value of a Fourier transform, and&#xA;  sometimes power spectral density.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you want to attach physical meaning to your analysis, then go with the power spectral density, (PSD). This is because this will simply give you the power of your signal, in each frequency band. On the other hand if you do not want/care about a physical meaning, but want to know how the fourier amplitudes of each band vary relative to each other, you can stick to absolute magnitude. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, you can compute the PSD as simply the absolute magnitude of the fourier transform squared. For example, if your signal is $x[n]$, and its DFT is $X(f)$, then the absolute magnitude of the DFT is $|X(f)|$, while the PSD is $|X(f)|^2$. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I understand correctly, the latter works so that I divide my signal&#xA;  into parts, do FFT part-by-part and somehow sum these. Window&#xA;  functions are somehow involved. Can you clarify this a bit for me? I'm&#xA;  new to DSP.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, this is not true. What you are talking about here refers to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Short Time Fourier Transform&lt;/a&gt;, (STFT). This is simply chopping up your time domain signal, widowing it, and then taking the fourier trnasform. At the end of the day though, you will still have a complex matrix. If you choose to take its absolute magnitude, you will have an absolute magnitude fourier transform matrix. If you take its absolute magnitude squared, you will have a power spectral density matrix. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-07-26T03:41:03.510" LastActivityDate="2013-07-26T03:41:03.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10065" PostTypeId="2" ParentId="10061" CreationDate="2013-07-25T17:32:41.720" Score="0" Body="&lt;p&gt;Regarding your first question, your frequency granularity is simply $\frac{f_s}{N}$, where $f_s$ is your sampling frequency in Hz, and $N$ is the length of your FFT. (Remember that you always want to take an FFT length of at least equal to your data record length).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Next, suppose that the signal I have has an interesting frequency at&#xA;  26 Hz (strictly that one frequency). How do I get it appear properly&#xA;  in the frequency spectrum (my frequency bins are spaced 1000/1024 =&#xA;  0.9766 Hz apart, so am I at dead end?).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can simply zero-pad your signal, and this will have the effect of smoothing out your fourier transform estimate. It wont give you better resolution in the engineering sense, but it will give you better &quot;visual resolution&quot; so to speak, so that you can better ascertain a peak.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastActivityDate="2013-07-25T17:32:41.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10066" PostTypeId="2" ParentId="10060" CreationDate="2013-07-25T20:55:45.573" Score="3" Body="&lt;p&gt;I quite like the &lt;a href=&quot;http://www.mypearsonstore.com/bookstore/medical-imaging-signals-and-systems-9780130653536&quot; rel=&quot;nofollow&quot;&gt;Medical Imaging Signals and Systems&lt;/a&gt; by Jerry L. Prince and Jonathan Links. If you're looking for a DSP approach to medical imaging, this is a good start. It's also quite good on the physics of medical imaging. the format of the book follows one medical imaging modality at a time. It first teaches you the &lt;em&gt;relevant&lt;/em&gt; physics of how the imaging itself works for that modality, and then goes into the signal processing side of things in the following chapter.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-07-25T20:55:45.573" CommentCount="0" CommunityOwnedDate="2013-07-25T20:56:15.387" ContentLicense="CC BY-SA 3.0" />
  <row Id="10067" PostTypeId="2" ParentId="10057" CreationDate="2013-07-25T22:20:58.627" Score="10" Body="&lt;p&gt;The parameter sigma is enough to define the Gaussian blur from a continuous point of view. In practice however, images and convolution kernels are discrete.  How to choose an optimal discrete approximation of the continuous Gaussian kernel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete approximation will be closer to the continuous Gaussian kernel when using a larger radius. But this may come at the cost of added computation duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, one would select a value for sigma, then compute a radius that allows to represent faithfully the corresponding continuous Gaussian kernel. For a given approximation error, the bigger sigma is, the larger the radius must be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, this can become very complicated to get it right. &#xA;When constructing the Gaussian matrix, is the best solution to sample the continuous kernel or are there better approximations? &#xA;How to normalize the computed discrete kernel to account for truncation? etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a reference, in Mathematica the function &lt;a href=&quot;http://reference.wolfram.com/mathematica/ref/GaussianMatrix.html&quot; rel=&quot;noreferrer&quot;&gt;GaussianMatrix&lt;/a&gt; features several ways to compute a Gaussian discrete matrix, e.g. using discrete Bessel approximation. By default, radius = 2 * sigma, which means that with sigma = 1, the matrix will be 5x5.   &lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2013-07-25T22:20:58.627" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10068" PostTypeId="2" ParentId="10052" CreationDate="2013-07-25T22:46:28.817" Score="2" Body="&lt;p&gt;I'm not a BSS expert, but it seems like a section on experimental results should probably follow. Once you've described PCA and other pre-whitening methods theoretically, it's good to show an example. It may be the case that you will include more subsections in your theoretical description, and that may prompt for more examples. Maybe someone else could comment on the actual BSS methods you may want to include in addition to those you already have.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-07-25T22:46:28.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10069" PostTypeId="2" ParentId="10049" CreationDate="2013-07-26T02:34:46.933" Score="-1" Body="&lt;p&gt;If the signals do not have any dominating harmonics in them and they all look similar in envelope and smooth enough, maybe you can try sampling the FFTs and performing the same(correlation metrics). It might save you some amount of computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as for your question as to if you're doing something out of the ordinary, I don't think so. Cross correlation at zero lag is the best metric that can give you the closest answer.&lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-07-26T02:34:46.933" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10070" PostTypeId="2" ParentId="10061" CreationDate="2013-07-26T04:46:36.930" Score="1" Body="&lt;p&gt;The &quot;information content&quot; is related to the number of samples.  The length of the FFT merely interpolates the spectral frequency curve represented by the number of samples.  If an FFT result bin doesn't end up exactly centered on some desired frequency, you can interpolate it from the nearest bins, using a high-quality (Sinc kernel, et.al.) interpolator, since FFT bins have a greater-than-zero bandwidth (the shape of the transform of the default rectangular or other window).  Using a longer zero-padded FFT gives you more interpolation points, and thus a denser looking point plot, but no better spectral separation resolution than provided by the number of actual samples.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-26T05:00:38.467" LastActivityDate="2013-07-26T05:00:38.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10071" PostTypeId="1" AcceptedAnswerId="10078" CreationDate="2013-07-26T08:59:54.807" Score="2" ViewCount="3668" Body="&lt;p&gt;I' trying to implement a QPSK modulation/demodulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At one point I have to decimate my signal by 4 for an easier implementation. I've read everywhere that the best way to do it is to use a CIC filter followed by a decimator. So I've read some more and I decided to use the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;CIC Filter Length: 2&lt;/li&gt;&#xA;&lt;li&gt;CIC Filter Order: 5&lt;/li&gt;&#xA;&lt;li&gt;CIC Filter Decimator: 2&lt;/li&gt;&#xA;&lt;li&gt;CIC Filter Stages: 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So basically what I do is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Filter the signal with a FIR filter and coefficients [1 5 10 10 5 1].&lt;/li&gt;&#xA;&lt;li&gt;Downsample by 2.&lt;/li&gt;&#xA;&lt;li&gt;Filter the signal with a FIR filter and coefficients [1 5 10 10 5 1].&lt;/li&gt;&#xA;&lt;li&gt;Downsample by 2.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the benefits of a CIC Decimator compared to directly downsampling by 4 and thus disregarding 3 samples out of 4?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I simulated this in order to find what the difference in performance was. As you can see in the two figures below the CIC filter seems to have a strong degrading impact on the BER which makes me wonder why it is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tiZYV.png&quot; alt=&quot;QPSK Bit Error Rate with Downsampler&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/02P6z.png&quot; alt=&quot;QPSK Bit Error Rate with CIC Decimator&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2013-07-26T12:56:54.170" Title="CIC Filter vs Simple Downsampler" Tags="|matlab|filters|downsampling|decimation|theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10072" PostTypeId="2" ParentId="10052" CreationDate="2013-07-26T10:06:03.487" Score="3" Body="&lt;p&gt;I've taken this course.&#xA;I think using these two papers plus those books you mentioned would be so useful in writing a report, thesis , ... .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://web.archive.org/web/20150529011418/http://distancecovariance.googlecode.com/svn-history/r35/trunk/References/blind_signal_separation_statistical_principles.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Blind signal separation: statistical principles&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/e6820/papers/HyvO00-icatut.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Independent Component Analysis (A Tutorial)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also you could download my professor's thesis which is available online &lt;a href=&quot;https://web.archive.org/web/20140930110223/http://sharif.edu/~mbzadeh/Publications.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;in this page&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5104" LastEditorUserId="25707" LastEditDate="2017-03-26T13:20:08.453" LastActivityDate="2017-03-26T13:20:08.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10074" PostTypeId="1" AcceptedAnswerId="10163" CreationDate="2013-07-26T11:39:50.580" Score="6" ViewCount="2247" Body="&lt;p&gt;I have a problem with SIFT that I do not understand. Lowe [1] proposed in his work the &lt;code&gt;s=3&lt;/code&gt; levels of scale are enough for one octave. Afterwards, he mentioned that you need to compute &lt;code&gt;s+3&lt;/code&gt; levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why there are 3 and not 2 additional levels required. I understand that you require one additional level above and one additional level below the scales since you search for extrema in neighbored scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what is the third additional level of scale?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1] Distinctive Image Features from Scale-Invariant Keypoints&#xA;    D. G. Lowe&#xA;    Int. Journal of Computer Vision 60(2) (2004), pp. 91--110&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5032" LastActivityDate="2013-08-01T14:11:54.717" Title="SIFT - why s+3 scales per octave?" Tags="|sift|scale-space|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10075" PostTypeId="2" ParentId="10052" CreationDate="2013-07-26T12:08:59.273" Score="3" Body="&lt;p&gt;You need to start as broad as possible and work your way towards your practical work. Your writing should make the case for the practical EVD work that you've done in matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the start you posted you're going to need to need to cover bits about optimisation algorithms as well. &lt;a href=&quot;http://www.cs.helsinki.fi/u/ahyvarin/papers/NN00new.pdf&quot; rel=&quot;nofollow&quot;&gt;FastICA&lt;/a&gt;, Infomax etc. Also different measures of independence: entropy, kurtosis etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My starting point for ICA work is &lt;a href=&quot;http://www.inf.fu-berlin.de/lehre/WS05/Mustererkennung/infomax/infomax.pdf&quot; rel=&quot;nofollow&quot;&gt;Naik &amp;amp; Kumar 2011&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2013-07-26T12:08:59.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10076" PostTypeId="2" ParentId="9899" CreationDate="2013-07-26T12:15:44.083" Score="0" Body="&lt;p&gt;Natural log in matlab is 'log(x)' and log to the base 10 is 'log10(x)'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information on &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/log.html&quot; rel=&quot;nofollow&quot;&gt;Mathworks&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2013-07-26T12:15:44.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10077" PostTypeId="2" ParentId="9805" CreationDate="2013-07-26T12:24:45.893" Score="1" Body="&lt;p&gt;Wavread scales it's output to be between -1 and 1. How the relates to your binary signal depends on its bit depth. You can return the bit depth when you read the file like so &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[y, Fs, nbits] = wavread(filename) %returns the number of bits per sample (nbits)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To scale the signal you can then multiply by 2^(nbits-1). This will give you the decimal equivalent of the binary signal representation, which you can then convert, should you wish to. &lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2013-07-26T12:24:45.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10078" PostTypeId="2" ParentId="10071" CreationDate="2013-07-26T12:56:54.170" Score="3" Body="&lt;p&gt;If you are only decimating by four, then a CIC filter is &lt;em&gt;not&lt;/em&gt; the way to go.  CIC filters have two advantages and one big disadvantage.  The advantages are that they don't require any multipliers, just (large) adders, and they can efficiently decimate by really large factors.  The no-multipliers advantage was a big deal years ago when multipliers were expensive and not always available, but they are cheap now.  And since you are only decimating by a factor of 4, the ability to decimate by large factors does not help you either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one big disadvantage of CIC filters is that their frequency response is not flat in the pass-band, so designers usually put a FIR filter after the CIC filter whose primary purpose is to compensate for the CIC filter's non-flatness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My advice would be to continue decimating with one or two FIR filters, though I would recommend using a better filter than [1 5 10 10 5 1].  Try using Matlab's fdatool or Matlab/Octave's &quot;fir1&quot; command to design a better filter.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-26T12:56:54.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10079" PostTypeId="2" ParentId="10052" CreationDate="2013-07-26T13:10:13.663" Score="3" Body="&lt;p&gt;I would structure the thesis like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Introduction/Problem Statement (i.e. whatever problem BSS solves)&#xA;How BSS solves that problem (high level)&#xA;Theory behind BSS&#xA;    1) Definition of Independence of signals&#xA;    2) Independence and correlation&#xA;    3) PCA and other prewhitening methods: &#xA;        1. centering &#xA;        2. whitening&#xA;Your implementation&#xA;Your results&#xA;    1) How those results compare to what the theory says should be achievable&#xA;Possible Improvements&#xA;Conclusion&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &quot;Possible Improvements&quot; section should have ideas on how you or the reader could take what you have done and improve upon it, by (for example) improving the implementation, testing it in new ways, or applying the implementation to different problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Conclusion should summarize the paper, and in particular the problem statement, how your implementation solves that problem, and what results you achieved.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-26T13:10:13.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10080" PostTypeId="2" ParentId="10062" CreationDate="2013-07-26T17:05:23.010" Score="4" Body="&lt;p&gt;The important thing to understand about something like a speech signal is that its frequency components are &lt;em&gt;time-varying&lt;/em&gt;. In order to represent speech in the frequency domain we usually take a short enough &lt;em&gt;window&lt;/em&gt; of the signal within which we can assume that the spectrum of the speech does not vary significantly (typically 10 ms). So we calculate the power spectrum for each successive 10 ms window using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;STFT&lt;/a&gt; (often with some overlap between windows) and treat each successive spectrum as a &quot;snapshot&quot; of the frequency components of the speech at that particular time. Often the successive spectra are plotted in a 3D plot such as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;nofollow&quot;&gt;spectrogram&lt;/a&gt;, with time on the X axis, frequency on the Y axis, and magnitude plotted as a false colour or grey scale intensity at each X,Y location.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2013-07-26T17:22:33.657" LastActivityDate="2013-07-26T17:22:33.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10081" PostTypeId="2" ParentId="10056" CreationDate="2013-07-26T18:40:36.813" Score="0" Body="&lt;p&gt;Regarding your idea of doing an FFT, zeroing out the undesired frequency components, and then doing an inverse FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a practical matter, this would require an impractical amount of computing for most applications. A real time signal could extend for more than a million samples. Very few applications could afford to do two ffts on this much data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from this however, there is an important aspect to filtering that you need to understand. Zeroing out frequency components is essentially the same as implementing a brick wall filter. Brick wall filters may sound great, but that is only because you don't understand the effects these filters have on the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brick wall filters can render a signal useless. For example, filtering a square wave with a brick wall low pass will introduce severe ringing into the square wave. About the only good use for brick wall filters (or zeroing out frequency components), would be to filter the noise out of a sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key to filter design is to know both what you want to remove from the signal, and also knowing what you need to preserve in the signal. Preserving the signal's integrity is paramount; otherwise you might as well discard it completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to gain an understanding of the detrimental effects of brick wall filters is to run your signal through a 15 pole elliptic, or something similar. There are some free FIR and IIR filter design programs at &lt;a href=&quot;http://www.iowahills.com&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com&lt;/a&gt; that make it quite easy to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you are working with some incredibly simple signals, it isn't likely that you will be able to tolerate brick wall filters, or equivalently, zeroing out frequency components.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-07-26T18:40:36.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10084" PostTypeId="2" ParentId="9721" CreationDate="2013-07-26T20:38:34.057" Score="0" Body="&lt;p&gt;You may search for the Morphological Gradient. In addition, if you have some marked data, i.e. you've known the types of these signals, then you can simply train a system using the logistic regression, neural network etc, to differentiate these two types. The advantage of these machine learning methods is that you can encode whatever information that you are interested in the system as an additional feature.  &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-07-26T20:38:34.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10085" PostTypeId="2" ParentId="10074" CreationDate="2013-07-26T21:13:53.280" Score="1" Body="&lt;p&gt;I can only find this is the paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As this graph shows, the highest repeatability is obtained when&#xA;  sampling 3 scales per octave, and this is the number of scale samples&#xA;  used for all other experiments throughout this paper. It might seem&#xA;  surprising that the repeatability does not continue to improve as more&#xA;  scales are sampled. The reason is that this results in many more local&#xA;  extrema being detected, but these extrema are on average less stable&#xA;  and therefore are less likely to be detected in the transformed image.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where are you referring to when he says s+3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it also depends on the ratio of DOG filters you are using. I've seen DOGupper/DOGlower = 1.6 as it is pretty stable (D. Marr &amp;amp; E. Hildreth, &quot;Theory of Edge Detection&quot;, 1980). This also approach a LOG filter.&lt;/p&gt;&#xA;" OwnerUserId="4996" LastEditorUserId="4996" LastEditDate="2013-07-26T21:23:13.530" LastActivityDate="2013-07-26T21:23:13.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10086" PostTypeId="2" ParentId="10049" CreationDate="2013-07-27T01:12:01.893" Score="3" Body="&lt;p&gt;Regarding the problem with high correlation values, this happens when both signals are not zero-mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume two signals $x[k]$ and $y[k]$ of length $N$ each. Each signal can be decomposed into the sum of a constant and a mean-free signal as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[k] = \overline{x} + x_0[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\overline{x}$ being the mean&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\overline{x} = \frac{1}{N} \sum_{k=0}^{N-1}x[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $x_0[k] = x[k] - \overline{x}$. Do the same to get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[k] = \overline{y} + y_0[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlating both sequences at zero lag yields (ignoring scaling here, but this does not change the issue)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c = \sum_{k=0}^{N-1}x[k] \cdot y[k] = \sum_{k=0}^{N-1}\overline{x} \cdot \overline{y} + \overline{x} \cdot y_0[k] + \overline{y} \cdot x_0[k] + x_0[k] \cdot y_0[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $x_0[k]$ and $y_0[k]$ are zero-mean, the cross-terms cancel out so the final result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c = N \cdot \overline{x} \cdot \overline{y} + \sum_{k=0}^{N}x_0[k] \cdot y_0[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if both correlated signals are not mean-free, the correlation will always contain the product of both means times the amount of samples. If you don't want this and the mean is not relevant, you should subtract it prior to correlating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the Matlab question. You can pack all reference signals next to each other in a matrix and then correlate with all at once at zero-lag. If you have $M$ reference signals of length $N$ each, you could do (assuming 'signal' as a column vector and the reference signals saved in columns of 'ref' as well)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = sum(repmat(signal, 1, M) .* ref)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to obtain a vector row vector c containing the correlations of your experimental signal with all the reference signals ref. No need to calculate the whole correlation or convolutions which is indeed a huge overhead. If you do not want to use repmat, you can also have a look at bsxfun which can achieve the same result and is generally interesting when you want to do element-wise operations with a vector on each row or column of a matrix.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-07-27T01:12:01.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10087" PostTypeId="1" CreationDate="2013-07-27T12:41:20.263" Score="1" ViewCount="162" Body="&lt;p&gt;I'm gonna implement multiple frequency estimation by summing harmonics amplitude!&#xA;I've read Anssi Klapuri paper but i can't understand him.&#xA;first of all he said spectral whitening i did it by i don't know whether it's true! after that i have to implement this formula:&lt;br/&gt;&#xA;$$s(\tau)=\sum_{m=0}^Mg(\tau,m)max_{}|Y(k)|$$‎&#xA;i can't understand what this $\tau$ is!&lt;br/&gt;&#xA;please give some hint to implement it or some other method for implementation.&lt;/p&gt;&#xA;" OwnerUserId="5023" LastActivityDate="2013-07-29T14:00:39.590" Title="chord recogination by multiple fundamental frequency estimation" Tags="|audio|pitch|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10088" PostTypeId="1" AcceptedAnswerId="10122" CreationDate="2013-07-27T18:10:18.993" Score="1" ViewCount="1658" Body="&lt;p&gt;I want to estimate the direction of arrival of sound (angle in a 2d plane) using a microphone array. I'm hoping to follow a time-delay based method using a 4 mic array. The method requires me to find the time delay of the signal upon arriving at the different microphones. For example, in the 4 mic array, I'm required to find the time delay of the signal between mics 1 and 2, 1 and 3, and 1 and 4 and so on for all other pairs. It would be very convenient if I could have a 4 mic array that could simply be plugged into my laptop and I guess an NI Labview algorithm would take care of the rest. And some one somewhere suggested that the microphone array can be created by using 4 usb (mini) mic and connecting them to a USB hub. First of all, can this be done? Secondly, since its a USB mic, the signal will already be digitized right? Any suggestions regarding how to extract information about time from this? I do not have any prior experience with signal/sound processing.&lt;/p&gt;&#xA;" OwnerUserId="5116" LastActivityDate="2018-03-27T06:24:22.070" Title="Direction of sound using microphone array" Tags="|sound|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10089" PostTypeId="1" CreationDate="2013-07-27T21:05:34.150" Score="-1" ViewCount="361" Body="&lt;p&gt;Suppose you have a transmission line carrying a digital signal and the line is picking up random noise such that half the bits in the original signal are randomly flipped before they reach the receiver. What techniques are available to recover such a corrupted signal?&lt;/p&gt;&#xA;" OwnerUserId="4660" LastActivityDate="2013-07-28T00:13:08.890" Title="Recovering signals in the presence of noise" Tags="|noise|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10091" PostTypeId="2" ParentId="10089" CreationDate="2013-07-27T22:18:05.663" Score="-1" Body="&lt;p&gt;Repeat the message. &lt;a href=&quot;https://en.wikipedia.org/wiki/Signal_averaging&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Signal_averaging&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blablabla, answer was too short. :-)&lt;/p&gt;&#xA;" OwnerUserId="5118" LastActivityDate="2013-07-27T22:18:05.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10092" PostTypeId="2" ParentId="10089" CreationDate="2013-07-28T00:13:08.890" Score="0" Body="&lt;p&gt;Information will have been lost due to the noise.  You either need to know enough about the lost information (or the exact noise sequence) via other means (resend, side channel or a priori, etc.), or via massive redundancy that you know was originally in the signal in a known encoding (ECC), to have some good statistical chance of reconstructing (some of) the lost data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-07-28T00:13:08.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10093" PostTypeId="1" AcceptedAnswerId="10098" CreationDate="2013-07-28T04:03:34.517" Score="2" ViewCount="541" Body="&lt;p&gt;for the (7,4) Hamming code, I know how to decode a codeword using the syndrome decoding method, by just using the 3 parity bits, and it is correctable if there is just 1 error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for the (8,4) extended Hamming code, I know how to decode the codewords correctly when there is no error or 1 error respectively. However, can we do that for the case of 2 errors?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2013-08-27T13:17:34.290" Title="extended hamming code" Tags="|forward-error-correction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10095" PostTypeId="1" CreationDate="2013-07-28T06:36:03.280" Score="9" ViewCount="394" Body="&lt;p&gt;The following is from Lowe 2004 paper ( &lt;a href=&quot;http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf&lt;/a&gt; ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One obvious approach would be to sample the local image intensities around the keypoint at the appropriate scale, and to match these using a normalized correlation measure.&#xA;However, simple correlation of image patches is highly sensitive to changes that cause misregistration of samples, such as afﬁne or 3D viewpoint change or non-rigid deformations. A&#xA;better approach has been demonstrated by Edelman, Intrator, and Poggio (1997). Their proposed representation was based upon a model of biological vision, in particular of complex&#xA;neurons in primary visual cortex. &lt;strong&gt;These complex neurons respond to a gradient at a particular&#xA;orientation and spatial frequency, but the location of the gradient on the retina is allowed to&#xA;shift over a small receptive ﬁeld rather than being precisely localized. Edelman et al. hypothesized that the function of these complex neurons was to allow for matching and recognition&#xA;of 3D objects from a range of viewpoints.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand SIFT descriptor. I understand the previous stage (keypoint detector).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know why it is implemented that way. I want to know the story behind the story.&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="4367" LastEditDate="2013-08-22T01:59:44.983" LastActivityDate="2018-05-22T01:19:46.310" Title="What is the story behind the story about SIFT descriptor?" Tags="|sift|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10096" PostTypeId="1" AcceptedAnswerId="10099" CreationDate="2013-07-28T06:45:06.830" Score="3" ViewCount="193" Body="&lt;p&gt;I'm trying to create two tones at different frequencies. So I have one tone at 15000 Hz and one at 15400 Hz using Audacity. The problem i'm running into is there is a third tone created at a much lower frequency I can tell exists from both my ears and a spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get rid of the lower tone? Where does it come from? I only have two tracks&lt;/p&gt;&#xA;" OwnerUserId="5120" LastEditorUserId="5120" LastEditDate="2013-07-28T07:18:58.303" LastActivityDate="2013-07-28T16:06:16.853" Title="Two generated tones creates a side tone - how to avoid the side tone" Tags="|sound|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10097" PostTypeId="2" ParentId="10096" CreationDate="2013-07-28T09:01:24.083" Score="1" Body="&lt;p&gt;As far as hearing goes, there are non-linearities in the human cochlea that can produce perceived difference tones at certain volume levels and frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantization noise in small enough digital signals might also create enough non-linear mixing to show up in FFT results.  Noise shaping in the quantization could help reduce this possibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other non-linearities in the system are also potential difference/sum intermodulation/beat tone sources.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-28T16:06:16.853" LastActivityDate="2013-07-28T16:06:16.853" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10098" PostTypeId="2" ParentId="10093" CreationDate="2013-07-28T12:34:54.517" Score="1" Body="&lt;p&gt;Suppose the transmitted codeword is $\mathbf C$. If no errors occurred, or one error occurred, then $\mathbf C$ is the &lt;em&gt;unique&lt;/em&gt; codeword&#xA;that is at distance $1$ or less from the received word $\mathbf R$, and the decoding algorithm produces $\mathbf C$ as its output. When there are two errors, there is not a&#xA;&lt;em&gt;unique&lt;/em&gt; codeword that is at distance $2$ or less from the received word. &lt;em&gt;One&lt;/em&gt;&#xA;of the codewords at distance $2$ is $\mathbf C$, but there is &lt;em&gt;at least one other&#xA;such codeword&lt;/em&gt;. So,&#xA;the decoding algorithm must be devised to handle this case. The possible options&#xA;are&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Declare a decoding &lt;strong&gt;failure&lt;/strong&gt;, that is, tell the world that an &lt;em&gt;uncorrectable&#xA;error pattern&lt;/em&gt; has been detected. A less shameful alternative is used in ARQ &#xA;(automatic-repeat-request) systems in which the receiver sends back a&#xA;NACK signal to the transmitter which then retransmits $\mathbf C$. Thus, &#xA;the outside world is not told that the transmission is being repeated&#xA;over and over till the decoder is able to successfully decode, though the&#xA;outside world may be able to infer this because it has to wait extra long&#xA;for the next data bits to come out of the decoder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Choose &lt;em&gt;one&lt;/em&gt; of the codewords nearest to $\mathbf R$ and produce this as&#xA;the decoder output. In this instance, the decoding might be &lt;em&gt;correct&lt;/em&gt; because&#xA;the decoder fortuitously chose $\mathbf C$, or it might be &lt;em&gt;incorrect&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is important to remember that decoding algorithms &lt;em&gt;can&lt;/em&gt; output a&#xA;wrong codeword even when they are fairly certain they got it right.&#xA;If $\mathbf C$ is transmitted and the channel error pattern $\mathbf E$&#xA;is such that $\mathbf C + \mathbf E = \mathbf R$ happens to be &lt;em&gt;another&lt;/em&gt;&#xA;codeword $\hat{\mathbf C}$, then the decoder output will be &#xA;$\hat{\mathbf C}$ and the decoder might even declare that it is&#xA;confident that it has found the right codeword because it did&#xA;not find any errors in $\mathbf R$; it matched $\hat{\mathbf C}$&#xA;in every bit! Pride, as we are told, goeth before a fall. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Finally, turning to the OP's specific question about the&#xA;$(8,4)$ extended Hamming code, the decoder can&#xA;tell that an &lt;em&gt;even number&lt;/em&gt; of errors have occurred if the &#xA;XOR sum of the $8$ received bits is $0$ &lt;em&gt;and&lt;/em&gt; the rest of the&#xA;syndrome (the part that is exactly the same as in the &#xA;$(7,4)$ Hamming code)  is nonzero. So, whenever this&#xA;happens, the decoder can declare a decoding failure&#xA;or send a NACK to the transmitter, or output a codeword.&#xA;An easy way out in this last case&#xA;is to assume that the overall parity bit&#xA;is in error (and thus flip it) and then use the rest of&#xA;the nonzero syndrome to correct one error in the other&#xA;$7$ bits exactly as if they were from a $(7,4)$ (non-extended)&#xA;Hamming code. This will give a codeword $\hat{\mathbf C}$&#xA;that is at distance $2$ from $\mathbf R$ and it will even&#xA;be the transmitted codeword $\mathbf C$ if there were exactly&#xA;two transmission errors, one in the $7$ bits and one in the&#xA;overall parity&#xA;bit.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-07-28T12:50:28.207" LastActivityDate="2013-07-28T12:50:28.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10099" PostTypeId="2" ParentId="10096" CreationDate="2013-07-28T14:17:52.087" Score="5" Body="&lt;p&gt;I have tried the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Launch Audacity.&lt;/li&gt;&#xA;&lt;li&gt;Generate a 15000 Hz tone in the track created by default.&lt;/li&gt;&#xA;&lt;li&gt;Add a new track.&lt;/li&gt;&#xA;&lt;li&gt;Generate a 15400 Hz tone in the new track.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A lower frequency tone appears during playback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that both tracks have high levels, so their sum exceeds 1.0; and Audacity applies clipping or limiting. This non-linear operation is what creates the overtone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply decrease the level of both tracks to -6dB (or use an amplitude of 0.5 during signal generation) to make the overtone disappear.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-07-28T14:17:52.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10100" PostTypeId="1" CreationDate="2013-07-18T07:11:50.990" Score="3" ViewCount="68" Body="&lt;p&gt;There is a &lt;em&gt;Dirac pulse train&lt;/em&gt; following the scheme of the &lt;em&gt;Shah function&lt;/em&gt; (or &lt;em&gt;$\delta$-cumb function&lt;/em&gt;) with its Fourier series of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\varsigma(t,T)=\sum_{n=-\infty}^{\infty}\delta (t-nT)=\frac{1}{T}\sum_{n=-\infty}^{\infty}\exp\left(\frac{i 2\pi n t}{T}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here $n\in \Bbb Z$; $t$ time and $T(\in \Bbb N)$ the period between the pulses, which occur exactly at the levels of the integers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sum of $\varsigma(t,T)$ over $T$ in a given range $[1,T_{\max}]$ and $n$ in a range $[1,T]$ (instead) is accordingly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(t,T_{\max})=\sum_{T=1}^{T_{\max}}\varsigma(t,T)=\sum_{T=1}^{T_{\max}}\frac{1}{T}\sum_{n=1}^{T}\exp\left(\frac{i 2\pi n t}{T}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the zeros (at the level of some integers) of this function with respect to $t$, hence:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{T=1}^{T_{\max}}\frac{1}{T}\sum_{n=1}^{T}\exp\left(\frac{i 2\pi n t_0}{T}\right)=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;The Question&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;is to identify the number of such zeros $\mathcal Z$ in a range of $t\in[T_{\max},T_{\max}^2]$ by applying &lt;a href=&quot;http://en.wikipedia.org/wiki/Rice%27s_formula#cite_note-barnett-6&quot; rel=&quot;nofollow&quot;&gt;Rice's formula&lt;/a&gt;, while assuming that the frequencies $1/T$ are rationally independent?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5112" OwnerDisplayName="al-Hwarizmi" LastActivityDate="2013-07-28T16:48:26.033" Title="Number of zeros of a sum of Shah functions by applying Rice's formula?" Tags="|fourier-series|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="10101" PostTypeId="2" ParentId="10100" CreationDate="2013-07-26T18:24:20.550" Score="1" Body="&lt;p&gt;This is &lt;strong&gt;&lt;em&gt;not a complete answer&lt;/em&gt;&lt;/strong&gt; in that it does not apply Rice's formula although it does derive the formula for the counting function $\mathcal{Z}(T_{max})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $t,t_0,T,T_{max}\in \mathbb{N}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{T}\sum_{n=1}^{T}\exp\left(\frac{i 2\pi n t}{T}\right)=\cases{1&amp;amp;$T|t$\cr 0 &amp;amp;otherwise\cr}$$&#xA;so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(t,T_{\max})=\sum_{T=1}^{T_{\max}}\frac{1}{T}\sum_{n=1}^{T}\exp\left(\frac{i 2\pi n t}{T}\right)$$&#xA;counts the number of divisors of $t$ that are $\le T_{max}$ and $t_0$ is defined to be a zero if it satisfies: &#xA;$$\sum_{T=1}^{T_{\max}}\frac{1}{T}\sum_{n=1}^{T}\exp\left(\frac{i 2\pi n t_0}{T}\right)=\sum_{T=1}^{T_{\max}}\cases{1&amp;amp;$T|t_0$\cr 0 &amp;amp;otherwise\cr}=0 \tag{1}$$&#xA;which holds iff $t_0$ is not divisible by any integer $1\le T\le T_{max}$. However $t_0$ is always divisible by $1$ so the sum in $(1)$ must always evaluate to something $\ge1$ for any $T_{max}$. In which case we are forced to say&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;there are no integers $t_0,\,T_{max}$ such that $(1)$ holds and thus:&lt;/em&gt;&#xA;$$\mathcal{Z}(T_{max})=0, \,\forall T_{max}\in \mathbb{N}.\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if we chose to exclude the trivial case in which $1$ divides all integers by beginning the outer sum in $(1)$ at $T=2$ we may find a less trivial outcome. Define $t_0$ with $2\le T_{max}\le  t_0\le T_{max}^2$ to be a solution to the equation:&#xA;$$\sum_{T=2}^{T_{\max}}\frac{1}{T}\sum_{n=1}^{T}\exp\left(\frac{i 2\pi n t_0}{T}\right)=0$$&#xA;then $\mathcal{Z}$ counts the number of integers $t_0 \in \left[T_{max},T_{max}^2\right]$ such that $T\nmid t_0 \forall\, 2\le T \le T_{max}$, in which case:&#xA;$$\mathcal{Z}=\pi(T_{max}^2)-\pi(T_{max}) \tag{3}$$&#xA;where $\pi(x)$ is the prime counting function.&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Proof&lt;/em&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If: $$\exists t_0 \,\, \text{such that} \,\,\,T\nmid t_0 \,\forall\, 2\le T \le T_{max},$$ but $t_0$ is not prime, then: $$\exists k&amp;gt;T_{max}\,\, \text{such that} \,\,k|t_0,$$ and:&#xA; $$\exists n=\dfrac{t_0}{k}&amp;gt;T_{max},n\in \mathbb{N},$$&#xA;which implies:&#xA;$$t_0=nk&amp;gt;T_{max}^2,$$&#xA;from which we conclude that $t_0 \in \left[T_{max},T_{max}^2\right]$ is not a solution when $t_0$ is not prime. It is clear that if $t_0$ $\left(2\le T_{max}\le  t_0\le T_{max}^2\right)$ is prime, it is not divisible by $2\le T \le T_{max}$ and is therefore a solution, unless $T_{max}$ is itself prime. From this we conclude that all $t_0$ are primes such that $T_{max}&amp;lt;t_0\le T_{max}^2$ and $(3)$ follows.&lt;/p&gt;&#xA;" OwnerDisplayName="Graham Hesketh" LastActivityDate="2013-07-27T09:30:20.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10102" PostTypeId="2" ParentId="9945" CreationDate="2013-07-28T17:27:02.883" Score="2" Body="&lt;p&gt;This is a really, really hard problem, but there is a good deal of work in the area.  For one example, have a look at &lt;a href=&quot;http://web.eecs.umich.edu/~fessler/papers/files/jour/12/pre/ramani-12-rps.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; by Ramani &amp;amp; Fessler on the SURE approach.  The introduction has a great overview of parameter selection methods, be sure to check out their references.&lt;/p&gt;&#xA;" OwnerUserId="4202" LastActivityDate="2013-07-28T17:27:02.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10103" PostTypeId="1" AcceptedAnswerId="10105" CreationDate="2013-07-28T23:42:01.517" Score="1" ViewCount="469" Body="&lt;p&gt;If I have a sound recording with a sinusodial frequency with a constant amplitude and I do an FFT on the time domain of this recording to get the frequency back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were to ignore the imaginary part and just watched the amplitude (real part) would there be anything different about it? Would it also be constant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to do an FFT and I notice that the frequency spike oscillates up and down as if it were a sine wave, I have ignored the imaginary part on my FFT.&lt;/p&gt;&#xA;" OwnerUserId="5120" LastActivityDate="2013-07-29T00:51:07.757" Title="What would the behavior be of an FFT without the phase (imaginary part)" Tags="|fft|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10104" PostTypeId="1" AcceptedAnswerId="10106" CreationDate="2013-07-29T00:06:24.947" Score="8" ViewCount="5160" Body="&lt;p&gt;In Harris corner detection, as I see, the goal is to find out those points $(x,y)$ which makes $S(x,y)$ a large value for any direction of shifting, $$ S(x,y) = [\Delta x , \Delta y]M\left[ \begin{array}{c}&#xA;\Delta x \\&#xA;\Delta y \\&#xA;\end{array} \right]$$, while $$M = \sum_{(x,y)}\left[ \begin{array}{cc}&#xA;I_x(x,y)^2,&amp;amp; I_x(x,y)I_y(x,y) \\&#xA;I_x(x,y)I_y(x,y),&amp;amp; I_y(x,y)^2 \\&#xA;\end{array} \right]$$.&#xA;Here is my problem, as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Corner_detection#The_Harris_.26_Stephens_.2F_Plessey_.2F_Shi.E2.80.93Tomasi_corner_detection_algorithm&quot; rel=&quot;noreferrer&quot;&gt;wiki&lt;/a&gt; tells me that $M$ should have 2 &lt;em&gt;large&lt;/em&gt; eigenvalues in order to make $S(x,y)$ large in any direction. WHY large eigenvalue? HOW?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastActivityDate="2013-07-29T08:41:17.253" Title="why eigenvalues concerned in Harris corner detection?" Tags="|computer-vision|linear-algebra|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10105" PostTypeId="2" ParentId="10103" CreationDate="2013-07-29T00:51:07.757" Score="2" Body="&lt;p&gt;The real part isn't the amplitude.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imaginary part is the sine wave part of the FFT.  Thus exactly periodic- in-aperture sine waves (with a phase of zero at the window start) won't show up on the real part, and the FFT real part will see a zero signal.  Only sinusoids with a periodic cosine wave (with a phase of zero at the window start) component will show up at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;beating&quot; you are seeing is your signal alternating between being in and out of phase compared to a cosine basis vector.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-07-29T00:51:07.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10106" PostTypeId="2" ParentId="10104" CreationDate="2013-07-29T08:41:17.253" Score="10" Body="&lt;p&gt;Basic linear algebra. M is a symmetric matrix, so there's a decomposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M=Q^{\mathsf{T}} \Lambda  Q$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where Q is a rotation and $\Lambda$ is a diagonal matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can rotate $[\text{$\Delta $x},\text{$\Delta $y}]$ by $Q^{\mathsf{T}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Q^{\mathsf{T}} [\text{$\Delta $x},\text{$\Delta $y}]^{\mathsf{T}}=\left[\text{$\Delta $x}',\text{$\Delta $y}'\right]^{\mathsf{T}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;giving &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S(x,y)=\left[\text{$\Delta $x}',\text{$\Delta $y}'\right]\Lambda \left[\text{$\Delta $x}',\text{$\Delta $y}'\right]^{\mathsf{T}}=\Lambda _{1,1} \left(\text{$\Delta $x}'\right)^2+\Lambda _{2,2} \left(\text{$\Delta $y}'\right)^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $S(x,y)$ is large in both directions $\text{$\Delta $x}'$ and $\text{$\Delta $y}'$, if both eigenvalues are large.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2013-07-29T08:41:17.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10107" PostTypeId="1" AcceptedAnswerId="10109" CreationDate="2013-07-29T08:50:58.673" Score="2" ViewCount="1253" Body="&lt;p&gt;I begin to study how codec works, and I found a &quot;summary-diagram&quot; for DCT-codec (DCT stands for Discrete Cosine Transform). On this diagram, there are of course two steps: the encoding step and the decoding one. I try to make a reproduction of this diagram herebelow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ENCODING STEP Image (8*8 blocks) --&gt;| FDCT |--&gt;| Quantizer |--&gt;| Entropy Encoder |--&gt; Compressed data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DECODING STEP Compressed data --&gt;| Entropy Decoder |--&gt;| Dequantizer |--&gt;| IDCT |--&gt; Image (8*8 blocks)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The diagram seems clear to me, except the &quot;Dequantizer&quot;. I don't understand how the quantification step can be reversed, since it is this step that causes information loss. What does this &quot;block&quot; do? Can someone give me more precisions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks'.&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2013-07-29T13:57:16.177" Title="Image-processing - Dequantizer" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10108" PostTypeId="1" CreationDate="2013-07-29T08:59:43.317" Score="1" ViewCount="541" Body="&lt;p&gt;I have a set of &lt;strong&gt;3D data points&lt;/strong&gt;, indicated by the &lt;strong&gt;blue&lt;/strong&gt; color in the picture below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then &lt;strong&gt;project them onto the x-y plane&lt;/strong&gt;, i.e. setting z values of all the points to 0, shown by the &lt;strong&gt;yellow&lt;/strong&gt; color below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I perform PCA on the 2D data points (the yellow ones).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I end up with the &lt;strong&gt;1st Principal Component&lt;/strong&gt; being the &lt;strong&gt;green&lt;/strong&gt; line, and the 2nd being the yellow line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oCrLl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I am a newbie in PCA, I am not sure whether I have done something wrong or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because in my intuitive, the 1st Principal Component should be like in the picture below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uYaTv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I mean unlike the above picture given in wiki, my 1st component is NOT obvious and seems to make no sense.&lt;/em&gt; &lt;strong&gt;Did I do something wrong?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid the confusion, the 2D view from the above is as follows: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/ypFVh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4677" LastEditorUserId="4677" LastEditDate="2013-07-29T09:24:08.710" LastActivityDate="2013-10-30T17:46:53.300" Title="Has this Principal Component Analysis (PCA) been done correctly?" Tags="|signal-analysis|python|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10109" PostTypeId="2" ParentId="10107" CreationDate="2013-07-29T09:39:40.563" Score="2" Body="&lt;p&gt;Formally, the quantization is a mapping from a partitioned interval $[-A, A] = \cup_{k=1}^N I_k$ to the set of integers $\{1, \ldots, k\}$. The dequantization is the mapping from the quantization indices to a set of values $x_k$ chosen from each $I_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the quantizer used is uniform without any scaling (that is to say, when it is a simple rounding), the dequantizer is the identity. But when the quantizer is non-uniform, the integer passed into the entropy coder is not just a &quot;rounded&quot; value of the coefficient - an exponent, scaling factor, or any other monotonous transformation might have been applied to it. The dequantizer will have to reverse all the reversible steps in the quantification operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the AAC codec, the quantized value sent to the entropy coder is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Q(x_i) = \text{sgn}(x) \left[\left(\frac{|x_i|}{s_i}\right)^\frac{3}{4} + 0.4054\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the dequantizer will have to apply a $\frac{4}{3}$ exponent and multiply by the scale factor $s_i$ to recover the value.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-07-29T13:57:16.177" LastActivityDate="2013-07-29T13:57:16.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10110" PostTypeId="1" CreationDate="2013-07-29T10:23:22.393" Score="10" ViewCount="5219" Body="&lt;p&gt;I have a set of songs for which I extracted the STFT (Short-Time Fourier Transform) and used the magnitude spectrum $|S|$ to calculate the mel spectrogram by using a mel filterbank matrix $M$, so $X=\log(M\times |S|)$. I want to know is there any method to reverse this process, i.e. convert from the mel spectrogram back to the spectrogram. I performed some dimensionality reduction on the mel spectrogram, and reconstructed the mel spectrogram from lower dimensions. Now I want to regenerate the audio signal from the reconstructed mel spectrogram, so I guess first reconstruct the spectrogram and then the audio signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the mel filter bank matrix is not a square matrix, since we the reduce the no of frequency bins, so inverse of $M$ cant be used like this : $ \hat{S}=M^{-1}\exp(X)$. So is there any way to generate the inverse mapping, like some inverse transfer function that can convert from $X$ to $S$?&lt;/p&gt;&#xA;" OwnerUserId="4990" LastEditorUserId="1629" LastEditDate="2016-05-22T17:07:19.017" LastActivityDate="2019-12-04T12:45:21.327" Title="Converting mel spectrogram to spectrogram" Tags="|transfer-function|spectrogram|filter-bank|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10111" PostTypeId="1" CreationDate="2013-07-29T10:46:36.293" Score="6" ViewCount="150" Body="&lt;p&gt;I am looking for a way to completely describe which kind of digital filters I used to process my data, although it seems only few publications in general report all the details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I should describe at least&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Which type of filter was applied (low-pass, high-pass, etc).&lt;/li&gt;&#xA;&lt;li&gt;Cutoff frequencies&lt;/li&gt;&#xA;&lt;li&gt;IIR / FIR&lt;/li&gt;&#xA;&lt;li&gt;Phase response? &lt;/li&gt;&#xA;&lt;li&gt;How the filter was designed?&lt;/li&gt;&#xA;&lt;li&gt;Transition bands&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, I would like to know the attenuation is reported? Sometimes it is written that attenuation was x dB per octave, how does one calculate that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using MATLAB's fdatool for filter design + command filtfilt (zero-phase) to do the filtering. Basicly I would like to cover all the selections I made.&lt;/p&gt;&#xA;" OwnerUserId="5127" LastActivityDate="2013-08-28T16:31:12.363" Title="How to report how a filter was designed (scientific papers) + how to calculate filter attenuation?" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10112" PostTypeId="1" CreationDate="2013-07-29T11:23:56.193" Score="1" ViewCount="63" Body="&lt;p&gt;For a current project I need to implement an algorithm that needs the autocorrelation sequence of the channel, as part of a key step. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're measuring the frequency utilisation in our local area - simply be scanning the spectrum (from 440 MHz to 780MHz) with an SDR and collecting the power at each frequency. The goal of the algorithm is to determine how the spectrum may be split into bands to transmit on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to ask, is this data sufficient for what we need to do or is there anything else we would need to collect?&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-07-29T13:23:49.507" Title="What data should be collected to determine the autocorrelation sequence?" Tags="|autocorrelation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10113" PostTypeId="2" ParentId="10112" CreationDate="2013-07-29T13:23:49.507" Score="1" Body="&lt;p&gt;All you need to do an autocorrelation is a number of evenly spaced samples at a given frequency, so you will need some dwell time at each frequency (which I assume that you are doing already).  That is all you need.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-07-29T13:23:49.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10114" PostTypeId="2" ParentId="10111" CreationDate="2013-07-29T13:30:19.973" Score="3" Body="&lt;p&gt;Five of those (low/high-pass, cutoff freq, and IIR/FIR, how the filter was designed, attenuation) can be easily described using words or numbers.  The others (phase response, transition bands) are often better described with a picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would recommend describing those five &quot;describable&quot; characteristics and, if appropriate, put pictures of the phase and magnitude response along with the actual filter taps in an appendix or something.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-08-28T16:31:12.363" LastActivityDate="2013-08-28T16:31:12.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10115" PostTypeId="2" ParentId="10087" CreationDate="2013-07-29T14:00:39.590" Score="3" Body="&lt;p&gt;$g(\tau,m)$ is the weighting function used in the paper. Equation (7) tells you how to calculate its value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\tau$ is the fundamental period which is the reciprocal of the fundamental frequency, $f_0$. If the fundamental frequency is 440 Hz then $\tau$ is $1/440 = 2.27$ ms.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2013-07-29T14:00:39.590" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10116" PostTypeId="2" ParentId="10088" CreationDate="2013-07-29T14:30:03.327" Score="1" Body="&lt;p&gt;If you connect four discrete USB microphones a challenge will be to synchronize them. Even when you start them simultaneously (from a programming point of view) you cannot be sure that they all start the audio acquisition at exactly the same time so there will be an inherent unknown time delay between the microphones. This can be solved by having a reference signal coming from a known direction. Then, by comparing the expected delays with the actual delays, synchronization can be achieved. With your setup I would expect the synchronization delays to be slightly different every time the system is started so that calibration needs to be done every time.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-07-29T14:30:03.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10117" PostTypeId="2" ParentId="8280" CreationDate="2013-07-29T14:31:18.640" Score="0" Body="&lt;p&gt;Check the &lt;a href=&quot;http://www.littleendian.com/developers/&quot; rel=&quot;nofollow&quot;&gt;Melodify SDK&lt;/a&gt;, does the same thing.&lt;/p&gt;&#xA;" OwnerUserId="5128" LastActivityDate="2013-07-29T14:31:18.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10118" PostTypeId="1" CreationDate="2013-07-29T14:35:44.380" Score="2" ViewCount="1644" Body="&lt;p&gt;I am new to signal processing and im trying my best to figure out how to build a high pass filter then later on implement it. (in c#)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I rewrote the question with math notation,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if someting is still wrong i will try to correct it. It is my first time to write a question in math notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is to learn and for my private work, no school related :P&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i don't understand is how to calculate a high pass filter, the math is from a frend&#xA;that i work with everyting except the result calculation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//MaxPeriod and MinPeriod are (2, 10)&#xA;wight = (cos(.707 * 360 / MaxPeriod) + sin(.707 * 360 / 20) - 1) / cos(.707 * 360 / 20)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&quot;i&quot; is the currently input and &quot;o&quot; is the stored calculations of previous finalResults&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//High Pass calculation&#xA;result = i - (o + wight * (i - o))&#xA;&#xA;//Lets all spectrala components over a period of 10 get analyzed&#xA;//It is mainly used to make the data smooth and responsive&#xA;a1 = exp(-1.414 * 3.14159 / MinPeriod)&#xA;b1 = 2 * a1 * cos(1.414 * 180 / MinPeriod)&#xA;c2 = b1&#xA;c3 = -a1 * a1&#xA;c1 = 1 - c2 - c3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;prevResult and prevResult2 is the stored calculation of result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;finalResult = c1 * (result * 2) / 2 + c2 * prevResult + c3 * prevResult2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5129" LastEditorUserId="5129" LastEditDate="2013-08-05T08:02:44.597" LastActivityDate="2013-08-05T08:02:44.597" Title="High Pass filter" Tags="|highpass-filter|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10119" PostTypeId="2" ParentId="10110" CreationDate="2013-07-29T14:37:56.700" Score="5" Body="&lt;p&gt;Both taking a magnitude spectrogram and a Mel filter bank are lossy processes.  Important information needed to reconstruct the original will have been lost.  Thus you need to go back and use the original audio samples to do the reconstruction by determining a time or frequency domain filter equivalent to your dimensionality reduction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can make assumptions about the lost information, but those assumptions themselves usually sound inaccurate, artificial and/or robotic.  Or you can use only specially synthesized input, where the assumptions will be correct by design of that input.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-29T21:26:32.333" LastActivityDate="2013-07-29T21:26:32.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10120" PostTypeId="1" AcceptedAnswerId="10121" CreationDate="2013-07-29T17:36:31.253" Score="19" ViewCount="24301" Body="&lt;p&gt;I've tried googling and wikipedia-ing it, but I haven't gotten any answers beyond 'it's because the frequency of the input signal is sitting between two bins'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that this is the reason, but what I can't understand is why the leakage seems to extend to several adjacent bins rather than only one adjacent bin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate what I'm talking about, here's some simulated data (code at the end of the post) :&#xA;&lt;img src=&quot;https://i.stack.imgur.com/43SsG.png&quot; alt=&quot;Freq_10&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above is the FFT spectrum (plotted on a log scale) of a sine wave of frequency 10. The sampling rate is one, and the number of samples is 100. The graph has been FFT-shifted. There's clearly only a peak at bin 10, and the rest is on the order of numerical error, or there about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zwFq1.png&quot; alt=&quot;Freq_10_1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the frequency spectrum at a generated frequency of 10.1.&#xA;Clearly there is 'leakage' into more bins than just the immediately adjacent bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/F6D7G.png&quot; alt=&quot;freq_10_5&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the plot for a frequency of 10.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Why is there this leakage, and why does it extend to all the other bins, rather than the immediate adjacent bin?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Code, for anyone who's interested (Python code)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;xFreq = 10.5&#xA;xSize = 100.0&#xA;xPeriod = xSize/xFreq&#xA;x = np.linspace(1,xSize,xSize)&#xA;&#xA;data = np.sin(2*np.pi*x/xPeriod)&#xA;fft = np.fft.fft(data)&#xA;fft = np.fft.fftshift(fft)&#xA;&#xA;fig = plt.figure()&#xA;ax = fig.add_subplot(111)&#xA;ax.plot(abs(fft), &quot;o&quot;)&#xA;ax.set_yscale('log')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I changed the &lt;code&gt;xFreq&lt;/code&gt; value from &lt;code&gt;10.0&lt;/code&gt; to &lt;code&gt;10.5&lt;/code&gt;, etc.   &lt;/p&gt;&#xA;" OwnerUserId="3183" LastActivityDate="2016-09-17T01:37:06.680" Title="Why does spectral leakage arise in an FFT?" Tags="|fft|frequency-spectrum|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10121" PostTypeId="2" ParentId="10120" CreationDate="2013-07-29T17:51:57.123" Score="15" Body="&lt;p&gt;An FFT has finite length, and thus constitutes a default rectangular window on a data stream.  A window in the time domain results in a convolution in the frequency domain with the transform of the window.  Note that the transform of a rectangular window is a Sinc function (sin(x)/x), which has infinite width.  It's not just 2 bins in width.  Thus the ripples of the Sinc function will show up as &quot;leakage&quot; far from any spectral peak that is not perfectly periodic in the FFT's length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture below shows part of the frequency response of the sinc function.  When the tone is centered on one of the bins all of the other points are lined up with the nulls in the frequency response.  If it isn't centered on a bin then it's like shifting the whole frequency response, which causes the other bins to fall on non-null portions of the frequency respoonse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EYjnD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to look at it is that an FFT is just a filter bank, where each filter stop-band floor has lots of ripples, and is certainly not infinite in attenuation more than 1 bin away from center frequency.  Some windows (von Hann,etc.) other than rectangular have lower stop bands, which is one reason for their popular use.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="923" LastEditDate="2013-07-29T18:39:44.217" LastActivityDate="2013-07-29T18:39:44.217" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10122" PostTypeId="2" ParentId="10088" CreationDate="2013-07-29T17:57:51.340" Score="1" Body="&lt;h2&gt;Disclaimer&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is an interesting project, that I started some work on but did not complete. My adviser suggested that this project was tangential to my official project goals. I have spent a lot of time thinking about this problem and hopefully my insights will provide some value.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Array Setup&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Four microphones will provide more information than required. The direction in a two dimensional plane can be provided with 3 microphones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only need direction over a 180 degree field of view, only two microphones are required. Humans provide an example- we have two ears and determine if the sound is in front or behind by using another sensor such as our forward facing eyes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ysPBN.png&quot; alt=&quot;triangular array of microphones with speaker in center&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Implementation Notes&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Using separate USB microphones, as mentioned will have lots of synchronization problems. There are devices with multiple channels which will remove this problem. A periodic pulse from a central speaker could be used to deal with synchronization. This pulse must be periodic for each microphone will have a separate clock source and will drift with respect to the other microphones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest running a two microphone algorithm on each two microphone pair in the three microphone array. Checking the results against each other will allow the direction to be discerned. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Development testing will also require the production of a sound source that can create sharp pings (or continuous waves of a known frequency) that will be easy to distinguish.&lt;/p&gt;&#xA;" OwnerUserId="1693" LastActivityDate="2013-07-29T17:57:51.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10123" PostTypeId="2" ParentId="8280" CreationDate="2013-07-29T19:09:35.170" Score="2" Body="&lt;p&gt;Songify seems use Prosodic Modification (Pitch, Time) for monophonic signals:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;First you need get the pitch contour and pitch duration from musics you want to follow&#xA;(use one pitch track for monophonic signal like YIN,&#xA;AMDF, Auto-Correlation)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Split your imput signal in voiced/unvoiced&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply Pitch Scale Modification in voiced parts to match your extracted pitch contour (you can use PSOLA technique here)      &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply Time stretch to match your extracted pitch duration (you can use PSOLA technique here)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-07-29T19:09:35.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10124" PostTypeId="1" AcceptedAnswerId="10125" CreationDate="2013-07-29T20:06:33.090" Score="12" ViewCount="16959" Body="&lt;p&gt;I have seen this be mentioned a couple of times in some books I read, so I want to make sure. Is the complex envelope simply the summation of the real and quadrature components of a signal, whereby the absolute value is the (real) envelope? I have read this &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot;&gt;wiki&lt;/a&gt; page but I am not sure I completely understand. Is the complex envelope simply the real and imaginary parts of a passband signal combined? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="1329" LastEditDate="2013-07-29T20:45:12.993" LastActivityDate="2013-08-28T21:19:57.623" Title="What exactly is a complex envelope?" Tags="|fourier-transform|hilbert-transform|quadrature|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10125" PostTypeId="2" ParentId="10124" CreationDate="2013-07-29T20:49:46.207" Score="5" Body="&lt;p&gt;Depends on context.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For strictly real-valued signals it sometimes refers to creating an analytic signal (see: &lt;a href=&quot;http://en.m.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;noreferrer&quot;&gt;http://en.m.wikipedia.org/wiki/Analytic_signal&lt;/a&gt; ) from a signal with no imaginary component, and taking the magnitude (or complex with both magnitude and phase) envelope of that hypothetical now complex creation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-29T20:59:37.277" LastActivityDate="2013-07-29T20:59:37.277" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10127" PostTypeId="1" AcceptedAnswerId="10145" CreationDate="2013-07-29T23:39:49.720" Score="16" ViewCount="21219" Body="&lt;p&gt;I am running Morlet continuous wavelet transform. I have got &lt;code&gt;wscalogram&lt;/code&gt; of signal and now I want to plot freq-magnitude like the following picture., but I don't know how to do it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GPYpl.jpg&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used &lt;code&gt;scal2freq&lt;/code&gt; MATLAB function to convert scales to pseudo frequencies. Also I have some frequencies in my signal that have a large damping ratio(4%) so they are not well visible in plot. How can I exaggerate these highly damped modes?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using MATLAB, here is my codes: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Import the text4.txt to matlab workspace. and save it under name &quot;data&quot;&#xA;t=linspace(0,30,301);&#xA;Fs=ceil(inv(t(2)-t(1)));&#xA;x=data(:,4); % use x=data(:,3),x=data(:,5) too. first column is time,second is refrence&#xA;wname = 'morl';&#xA;scales = 1:1:256;&#xA;coefs = cwt(x,scales,wname,'lvlabs');&#xA;freq = scal2frq(scales,wname,1/Fs);&#xA;surf(t,freq,abs(coefs));shading('interp');&#xA;axis tight; xlabel('Seconds'); ylabel('Pseudo-Frequency (Hz)');&#xA;axis([0 30 0 1 0 60])&#xA;xlabel('Time'); ylabel('Frequency');&#xA;figure;&#xA;sc=wscalogram('image',coefs,'scales',freq,'ydata',x);&#xA;hold on &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My current plot looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ue1dY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="1629" LastEditDate="2016-05-09T12:04:42.247" LastActivityDate="2016-05-09T12:04:42.247" Title="How can I plot frequency vs magnitude of wavelet transform?" Tags="|frequency-spectrum|frequency|wavelet|" AnswerCount="3" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="10128" PostTypeId="1" AcceptedAnswerId="11458" CreationDate="2013-07-29T23:56:43.800" Score="1" ViewCount="523" Body="&lt;p&gt;I'm trying to write a perona malik filter in HLSL&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;texture2D Input0;&#xA;sampler2D Input0Sampler = sampler_state&#xA;{&#xA;    Texture = &amp;lt;Input0&amp;gt;;&#xA;    MinFilter = Point;&#xA;    MagFilter = Point;&#xA;    MipFilter = Point;&#xA;    AddressU = Clamp;&#xA;    AddressV = Clamp;&#xA;};&#xA;&#xA;struct VertexShaderInput&#xA;{&#xA;    float4 Position : POSITION0;&#xA;    float2 TextureCoordinate : TEXCOORD0;&#xA;};&#xA;&#xA;struct VertexShaderOutput&#xA;{&#xA;    float4 Position : POSITION0;&#xA;    float2 TextureCoordinate : TEXCOORD0;&#xA;};&#xA;&#xA;struct PixelShaderOutput&#xA;{&#xA;    float4 Index0 : COLOR0;&#xA;};&#xA;&#xA;// input texture dimensions&#xA;static float w = 1920 - 8;&#xA;static float h = 1080 - 8;&#xA;&#xA;static const float2 pixel = float2(1.0 / w, 1.0 / h);&#xA;static const float2 halfPixel = float2(pixel.x / 2, pixel.y / 2);&#xA;&#xA;static const float3x3 hN =&#xA;{&#xA;    0,  1, 0,&#xA;    0, -1, 0,&#xA;    0,  0, 0&#xA;};&#xA;static const float3x3 hS =&#xA;{&#xA;    0,  0, 0,&#xA;    0, -1, 0,&#xA;    0,  1, 0&#xA;};&#xA;static const float3x3 hE =&#xA;{&#xA;    0,  0, 0,&#xA;    0, -1, 1,&#xA;    0,  0, 0&#xA;};&#xA;static const float3x3 hW =&#xA;{&#xA;    0,  0, 0,&#xA;    1, -1, 0,&#xA;    0,  0, 0&#xA;};&#xA;static const float3x3 hNE =&#xA;{&#xA;    0,  0, 1,&#xA;    0, -1, 0,&#xA;    0,  0, 0&#xA;};&#xA;static const float3x3 hSE =&#xA;{&#xA;    0,  0, 0,&#xA;    0, -1, 0,&#xA;    0,  0, 1&#xA;};&#xA;static const float3x3 hSW =&#xA;{&#xA;    0,  0, 0,&#xA;    0, -1, 0,&#xA;    1,  0, 0&#xA;};&#xA;static const float3x3 hNW =&#xA;{&#xA;    1,  0, 0,&#xA;    0, -1, 0,&#xA;    0,  0, 0&#xA;};&#xA;&#xA;VertexShaderOutput VertexShaderFunction(VertexShaderInput vsInput)&#xA;{&#xA;    VertexShaderOutput output;&#xA;    vsInput.Position.x =  vsInput.Position.x - 2*halfPixel.x;&#xA;    vsInput.Position.y =  vsInput.Position.y + 2*halfPixel.y;&#xA;    output.Position = vsInput.Position;&#xA;    output.TextureCoordinate = vsInput.TextureCoordinate ;&#xA;    return output;&#xA;}&#xA;&#xA;float4 Convolution(VertexShaderOutput input, float3x3 kernel)&#xA;{&#xA;    float4 pixel = float4(0.0f, 0.0f, 0.0f, 0.0f);&#xA;&#xA;    for (int i = -1; i &amp;lt;= 1; ++i)&#xA;    {&#xA;        for (int j = -1; j &amp;lt;= 1; ++j)&#xA;        {&#xA;            pixel += kernel[i+1][j+1] * tex2D(Input0Sampler, input.TextureCoordinate + float2(i,j));&#xA;        };&#xA;    };&#xA;&#xA;    return pixel;&#xA;}&#xA;&#xA;PixelShaderOutput PixelShaderFunction(VertexShaderOutput psInput)&#xA;{       &#xA;    PixelShaderOutput output;&#xA;    output.Index0 = tex2D(Input0Sampler, psInput.TextureCoordinate);&#xA;&#xA;    float dx, dy, dd;&#xA;    dx = 1; dy = 1; dd = pow(2, 0.5);&#xA;    float delta_t = 1/7;&#xA;    float k = 30;&#xA;&#xA;    float4 nablaN = Convolution(psInput, hN);&#xA;    float4 nablaS = Convolution(psInput, hS);&#xA;    float4 nablaW = Convolution(psInput, hW);&#xA;    float4 nablaE = Convolution(psInput, hE);&#xA;    float4 nablaNE = Convolution(psInput, hNE);&#xA;    float4 nablaSE = Convolution(psInput, hSE);&#xA;    float4 nablaSW = Convolution(psInput, hSW);&#xA;    float4 nablaNW = Convolution(psInput, hNW);&#xA;&#xA;    /*&#xA;    float4 cN  = 1 / pow( 1 + (nablaN / k), 2);&#xA;    float4 cS  = 1 / pow( 1 + (nablaS / k), 2);&#xA;    float4 cW  = 1 / pow( 1 + (nablaW / k), 2);&#xA;    float4 cE  = 1 / pow( 1 + (nablaE / k), 2);&#xA;    float4 cNE = 1 / pow( 1 + (nablaNE / k), 2);&#xA;    float4 cSE = 1 / pow( 1 + (nablaSE / k), 2);&#xA;    float4 cSW = 1 / pow( 1 + (nablaSW / k), 2);&#xA;    float4 cNW = 1 / pow( 1 + (nablaNW / k), 2);&#xA;    */&#xA;    float4 cN  = exp(-(nablaN/k)*(nablaN/k));&#xA;    float4 cS  = exp(-(nablaS/k)*(nablaS/k));&#xA;    float4 cW  = exp(-(nablaW/k)*(nablaW/k));&#xA;    float4 cE  = exp(-(nablaE/k)*(nablaE/k));&#xA;    float4 cNE = exp(-(nablaNE/k)*(nablaNE/k));&#xA;    float4 cSE = exp(-(nablaSE/k)*(nablaSE/k));&#xA;    float4 cSW = exp(-(nablaSW/k)*(nablaSW/k));&#xA;    float4 cNW = exp(-(nablaNW/k)*(nablaNW/k));&#xA;&#xA;    output.Index0 += delta_t * &#xA;    (&#xA;        (mul(cN, nablaN)/(dy*dy)) + (mul(cS, nablaS)/(dy*dy)) + (mul(cW, nablaW)/(dx*dx)) + (mul(cE, nablaE)/(dx*dx)) + (dd*dd)*(mul(cNE, nablaNE) + mul(cSE, nablaSE) + mul(cSW, nablaSW) + mul(cNW, nablaNW))&#xA;    );&#xA;&#xA;    return output;&#xA;}&#xA;&#xA;technique PeronaMalik&#xA;{&#xA;    pass pass1&#xA;    {&#xA;        VertexShader = compile vs_3_0 VertexShaderFunction();&#xA;        PixelShader  = compile ps_3_0 PixelShaderFunction();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that when I apply this filter, I end up with the same image I had before the filter was applied. The problem seems to be that for some reason cN, cS, cW, cE, cNE, cSE, cSW, cNW all contain zeros. I've addapted the code from &lt;a href=&quot;http://www.mathworks.com.au/matlabcentral/fileexchange/14995-anisotropic-diffusion-perona-malik&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2013-11-04T06:19:03.057" Title="Perona Malik Anisotropic Diffusion Filter in HLSL" Tags="|anisotropic-diffusion|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10130" PostTypeId="1" AcceptedAnswerId="10132" CreationDate="2013-07-30T03:15:26.017" Score="1" ViewCount="113" Body="&lt;p&gt;I want to simulate a direct sequence spread spectrum (DSSS) system and the receiver works with matched filter. I want the received power to be different for each user, in other words, SINR shouldn't be 0. Is there any idea how to do that in matlab? &lt;/p&gt;&#xA;" OwnerUserId="4854" LastActivityDate="2013-07-30T09:45:05.030" Title="imperfect power control" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10132" PostTypeId="2" ParentId="10130" CreationDate="2013-07-30T09:21:29.097" Score="1" Body="&lt;p&gt;I'm assuming this is the uplink channel since you want the received power to be different for each user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A DSSS has a chip sequence that modulates the incoming signal. Basically the chips are just +1 and -1 and hence your &lt;code&gt;TX&lt;/code&gt; signal power still is determined only by the incoming signal. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Generate random bits - A simple function &lt;code&gt;randint&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Modulate them however you want - You can use &lt;code&gt;qammod&lt;/code&gt;. - Check out the book &quot;Fundamentals of Digital Communications&quot; by Proakis - Chapter 3 for intricacies regarding energy Normalization for constellations. &lt;/li&gt;&#xA;&lt;li&gt;Pass them through a Pulse Shaping filter of sufficient length. Check this link out for the same: &lt;a href=&quot;http://www.mathworks.com/help/dsp/examples/pulse-shaping-filter-design.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/dsp/examples/pulse-shaping-filter-design.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Multiply with the Chip Sequence. The way DSSS works is each user will have a Spreading code that is almost perfectly orthogonal to each other user. I think &lt;code&gt;MATLAB&lt;/code&gt; can generate spreading sequences you might want to see: &lt;a href=&quot;http://www.mathworks.com/help/comm/examples/spreading-sequences.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/comm/examples/spreading-sequences.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Once you've generated the signals for all users, pass them each through a Flat fading Channel(you can consider different average received energy and generate the fade vector with variances appropriately - this will give you different &lt;code&gt;SINRs&lt;/code&gt;) - You'd want your Chip period &lt;code&gt;Tc&lt;/code&gt; to be very small compared to the &lt;code&gt;DelaySpread&lt;/code&gt; of the channel and you can assume this which will hold the Flat Fading condition to be true. Multiply the fade vector for each user symbol by symbol with their corresponding signal points. &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Receiver receives the Linearly combined signal and then you need to generate an equivalent length &lt;code&gt;AWGN&lt;/code&gt; vector considering the average TX energy as the average TX energy you generated at the each user but the signals from each user suffered independent and different fades with different paths leading to different &lt;code&gt;SINRs&lt;/code&gt;. &#xA;or &lt;strong&gt;AN ALTERNATIVE&lt;/strong&gt; FOR (5,6): After spreading the sequences, alternatively you can multiply the whole signal for each user by a constant at the Transmitters before the fading channel leading to different energies(equivalent to different Path Losses for each signal) and linearly combine them all, Transmit and Receive on just one Fading Channel. Further you'd need to add &lt;code&gt;AWGN&lt;/code&gt; considering the Average Signal energy of the signal you generated at the output of the Modulator(essentially the average energy of the Constellation).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The receiver now is like a Multi-User detector; you need to create copies of the received signal(as many number of users) and correlate with the Spreading sequences for each user.  You will essentially now remove the spreading code(Since synchronization is perfect) and you'll have the received signals for each user with different &lt;code&gt;SINRs&lt;/code&gt; and so you can proceed to Matched Filtering using the same Filter you used for Pulse shaping at the Transmitter, Sampling, Demodulation using &lt;code&gt;qamdemod&lt;/code&gt; and Detection using Maximal Likelihood(Minimum Distance). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can refer to &quot;Wireless Communications&quot; by Andreas Goldsmith on further technical details in Chapter 3 for Fading and Chapter 13 and 15 for Multiuser Spread Spectrum Systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Since you've titled this as Imperfect Power Control, I'd say the alternatives for 5,6 make more senes - the TXs are having bad knowledge about the channel and are not transmitting according to proper Powers.&lt;/p&gt;&#xA;" OwnerUserId="5102" LastEditorUserId="5102" LastEditDate="2013-07-30T09:45:05.030" LastActivityDate="2013-07-30T09:45:05.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10133" PostTypeId="1" AcceptedAnswerId="10135" CreationDate="2013-07-30T12:54:31.903" Score="3" ViewCount="856" Body="&lt;p&gt;I'm currently implementing a voice recognition algorithm using FFT and now some questions came up to me:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Spectral Leakage&lt;/strong&gt;: I know what it is, why it appears and how to solve it using a Windowing Function, but is there another work around for this issue?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Phase&lt;/strong&gt;: I know what it is, but where can I use it and how?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Getting the real amplitude&lt;/strong&gt; (I know it has something to do with spectral leakage, but I will ask this separately): Let's say I have a frequency spectrum with a frequency resolution of &lt;code&gt;250&lt;/code&gt; (&lt;code&gt;sampling rate = 32000 Hz&lt;/code&gt;, &lt;code&gt;frame size = 128&lt;/code&gt;) and the input I sent to FFT is a sinusoidal function whose frequency is &lt;code&gt;567.5 Hz&lt;/code&gt; (thus, the number of cycles are non-integer, causing the spectral leakage). My spectrum would be something like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RVZat.png&quot; alt=&quot;Spectrum&quot;&gt;&#xA;So my question is: How can I retrieve the original amplitude of the frequency &lt;code&gt;567.5 Hz&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5136" LastEditorUserId="5136" LastEditDate="2013-07-30T13:43:50.717" LastActivityDate="2013-07-30T14:37:58.310" Title="Spectral Leakage, Phase and other questions about FFT" Tags="|fft|frequency-spectrum|frequency|phase|frequency-domain|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10134" PostTypeId="1" CreationDate="2013-07-30T13:18:14.307" Score="3" ViewCount="1030" Body="&lt;p&gt;In general, &lt;em&gt;correlation-based image matching&lt;/em&gt; can be referred to as &#xA;$$c(I_1,I_2) = \sum_{x \in patch} f(I_1(x), I_2(x))$$&#xA;, I do think &lt;strong&gt;normalized cross-correlation&lt;/strong&gt; like&#xA;$$ncc(I_1, I_2) = \sum_{x \in patch}\frac{(I_1(x) - \mu_1)(I_2(x) - \mu_2)}{\delta_1\delta_2}$$.&#xA;is a good indicator to show if 2 patches match or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT my problem is that, if &#xA;$$\begin{eqnarray*}&#xA;f(I_1(x), I_2(x)) &amp;amp;=&amp;amp; \sum_{x \in patch}I_1(x) \cdot I_2(x)&#xA;\end{eqnarray*}&#xA;$$&#xA;, then I don't think $c(I_1, I_2)$ will be a good, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, this type of correlation-based matching techniques won't work well if one of the images rotates, right?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="4811" LastEditDate="2013-07-30T13:23:26.263" LastActivityDate="2013-08-16T20:46:23.343" Title="how could correlation-based image patches matching works?" Tags="|computer-vision|cross-correlation|template-matching|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10135" PostTypeId="2" ParentId="10133" CreationDate="2013-07-30T14:24:29.760" Score="4" Body="&lt;p&gt;Windowing artifacts can be considered as due to a loss of information about a larger data set (e.g.what the window cut out or zeroed).  The &quot;spread&quot; of the Sync is related to the shortness of the data window (what's left after the information loss).  Thus other information about the original data from outside the FFT results can be used to help &quot;solve&quot; this problem (more data, perhaps used with longer FFTs, results in a narrower Sync main &quot;hump&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase information within each FFT aperture plus the distance between adjacent or overlapped frames of FFT data is used in to refine phase vocoder frequency estimates or to aid in signal reconstruction.  Phase differences between frames taken from differently placed microphones can be used to help triangulate sound source location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak amplitude can be estimated by interpolation equations, such as parabolic interpolation from 3 points, or better, from (windowed) Sinc kernel interpolation with successive approximation to find the zero derivative point.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-30T14:37:58.310" LastActivityDate="2013-07-30T14:37:58.310" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10137" PostTypeId="1" CreationDate="2013-07-30T15:38:57.177" Score="9" ViewCount="15349" Body="&lt;p&gt;How do I calculate the Spectral Entropy of a signal in MATLAB ? I know the basic steps but it would be nice if someone can help,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the power spectrum of the signal using FFT command in MATLAB.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the Power Spectral Density using the power spectrum or using any other technique.&lt;/li&gt;&#xA;&lt;li&gt;Normalize the Power Spectral Density  between $[0, 1]$, so that it can be treated as a probability density function $p_i $.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the Entropy $H(s) = -\sum p_i\log_2\left(p_i\right)$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1896" LastEditorUserId="1629" LastEditDate="2016-06-14T01:18:44.950" LastActivityDate="2016-06-14T01:18:44.950" Title="Spectral Entropy Calculation in MATLAB" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10138" PostTypeId="2" ParentId="10137" CreationDate="2013-07-30T15:59:01.397" Score="8" Body="&lt;p&gt;Technically this is not a MATLAB-esque forum, but I can explain the steps in more detail for you: Suppose your input signal is $x[n]$, and its DFT is $X(f)$. For real signals you may use the one-sided DFT, since the other half would be redundant when you look at its Power Spectral Density. (PSD). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you compute the DFT of your signal, the PSD is simply $|X(f)|^2$. That is, you need to take the absolute magnitude of your DFT result, squared. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You now need to normalize the PSD such that it can be viewed as a Probability Density Function, (PDF). Thus, a normalized PSD, (let us call it $PSD_n$) will simply be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;PSD_n(f) = \frac{PSD(f)}{\sum_{f=\frac{-fs}{2}}^{f = \frac{f_s}{2}} PSD(f)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, your spectral entropy will be: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E = -\sum_{f=\frac{-fs}{2}}^{f = \frac{f_s}{2}} PSD_n(f) log_2[PSD_n(f)]&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-07-30T17:09:45.717" LastActivityDate="2013-07-30T17:09:45.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10139" PostTypeId="1" CreationDate="2013-07-30T16:03:42.567" Score="2" ViewCount="2489" Body="&lt;p&gt;As a follow up to &lt;a href=&quot;https://dsp.stackexchange.com/questions/10120/why-does-spectral-leakage-arise-in-an-fft&quot;&gt;this&lt;/a&gt; question - &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way that I can calculate the amount of spectral leakage in a given bin, i.e., given an input amplitude, what percentage of the amplitude is present in the adjacent bins? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or given an input frequency and the frequency range of each bin, can I calculate the amplitude present in each bin?&lt;/p&gt;&#xA;" OwnerUserId="3183" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2018-05-09T04:16:47.153" Title="Calculating the extent of spectral leakage" Tags="|fft|frequency-spectrum|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10140" PostTypeId="2" ParentId="10137" CreationDate="2013-07-30T16:09:59.483" Score="5" Body="&lt;p&gt;I Just do here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My source code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    [x, Fs, nbits] = wavread('ederwander.wav'); &#xA;&#xA;&#xA;    winSize = 2048;&#xA;&#xA;    n_samples = length(x);&#xA;&#xA;&#xA;    %50% overlap or 0 to not use overlap&#xA;    OverlapStep = 50;&#xA;&#xA;    if OverlapStep &amp;gt; 0&#xA;&#xA;        Overlap = floor((OverlapStep*winSize) / 100); &#xA;        nFrames=floor(n_samples/Overlap)-1; &#xA;    else&#xA;        Overlap= winSize;&#xA;        nFrames=floor(n_samples/Overlap)-1;&#xA;    end&#xA;&#xA;    Entropy = zeros(nFrames,1);&#xA;&#xA;    k=1;&#xA;    inc=1;&#xA;&#xA;    while ( (k+winSize-1) &amp;lt;= n_samples )&#xA;&#xA;        FrameSignal = x(k:k+winSize-1);&#xA;&#xA;        v = FrameSignal .* hann(length(FrameSignal));           &#xA;&#xA;        N = length(v);&#xA;&#xA;        Y=fft(v);&#xA;&#xA;        % Compute the Power Spectrum&#xA;        sqrtPyy = ((sqrt(abs(Y).*abs(Y)) * 2 )/N);&#xA;        sqrtPyy = sqrtPyy(1:winSize/2);&#xA;&#xA;&#xA;&#xA;       %Normalization&#xA;       d=sqrtPyy(:);&#xA;       d=d/sum(d+ 1e-12);&#xA;&#xA;       %Entropy Calculation&#xA;       logd = log2(d + 1e-12);&#xA;       Entropy(inc) = -sum(d.*logd)/log2(length(d));&#xA;&#xA;&#xA;       k=k+Overlap;&#xA;       inc=inc+1;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This source code does Spectral Entropy calculation from every framed block ...&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2013-07-30T18:16:23.260" LastActivityDate="2013-07-30T18:16:23.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10141" PostTypeId="2" ParentId="10139" CreationDate="2013-07-30T17:34:48.290" Score="0" Body="&lt;p&gt;I think the best solution of your problem is to use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;Windowing Function&lt;/a&gt; like &lt;a href=&quot;http://en.wikipedia.org/wiki/Hann_window&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hann Function&lt;/a&gt;, which reduce the spectral leakage:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Not windowed&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/r7xXP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Windowed with Hann Window&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VyXLc.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;This method, however, won't let you recover the original amplitude of that frequency bin (Notice that, in this case, the windowed signal lost about 40% of its energy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also have a look to &lt;a href=&quot;http://www.katjaas.nl/pitchshift/pitchshift.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://www.katjaas.nl/FFTwindow/FFTwindow.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; articles&lt;/p&gt;&#xA;" OwnerUserId="5136" LastActivityDate="2013-07-30T17:34:48.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10142" PostTypeId="1" CreationDate="2013-07-30T18:49:59.660" Score="1" ViewCount="209" Body="&lt;p&gt;I'm working on Cognitive Radio in TV Band Spectrum.  I need to sense the presence of signal in a particular spectrum. I have to sample the incoming signal (say 1000 samples) and I have to find the auto correlation strength for a smoothing factor L(means my sample will be 0 to L-1 samples delayed). I have assumed a smoothing factor of 10. How to find the autocorrelation strength. Gamma L.&lt;/p&gt;&#xA;" OwnerUserId="5141" LastActivityDate="2013-07-30T18:49:59.660" Title="Evaluating auto correlation strength (Gamma)" Tags="|autocorrelation|correlation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10143" PostTypeId="2" ParentId="10127" CreationDate="2013-07-30T19:18:19.927" Score="3" Body="&lt;p&gt;Continuous wavelet transform (CWT) is a method for &lt;em&gt;time-scale analysis&lt;/em&gt;. Yes, you read it correctly, &lt;em&gt;scale&lt;/em&gt;, not &lt;em&gt;frequency&lt;/em&gt;. However, it is possible to map the scales to frequencies, and even quite easily. Since you are a MATLAB user, you will probably want to use &lt;a href=&quot;http://www.mathworks.se/help/wavelet/ref/scal2frq.html&quot; rel=&quot;nofollow&quot;&gt;this function&lt;/a&gt;, which does the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;F = scal2frq(A,'wname',DELTA) returns the pseudo-frequencies corresponding to the scales given by A, the wavelet function 'wname' (see wavefun for more information) and the sampling period DELTA.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As you can read, the frequencies are not the real frequencies in the signal, but approximations. If you want the real frequencies, you should be using the short-time Fourier transform (STFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, when should one use the CWT? As a general principle, wavelets work well when the signals are &lt;em&gt;transient&lt;/em&gt; (i.e. have quick changes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: haha, I don't know what I'm doing here. sorry :-D completely missed the point of your question. Just read the title....&lt;/p&gt;&#xA;" OwnerUserId="5142" LastActivityDate="2013-07-30T19:18:19.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10144" PostTypeId="2" ParentId="10139" CreationDate="2013-07-30T19:25:27.257" Score="2" Body="&lt;p&gt;Windowing in the time domain results in a convolution with the transform of that window in the frequency domain.  So you need to compute the result of this convolution to see the effect (which some call &quot;leakage&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can sample the transform of the window function used (rectangular, Von Hann, etc.) to determine the FFT frequency response of a windowed pure single frequency sinusoid.  For a rectangular window, the magnitude of the apparent &quot;leakage&quot; in an FFT result will be samples of a normalized Sinc function (more precisely a pair of normalized periodic Sincs or Dirichlet kernels), sampled at integer offsets from the frequency bin center offset, multiplied by the sinusoid's magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An attempt at the equation for the full Dirichlet pair frequency response result is on my dsp web page here: &lt;a href=&quot;http://www.nicholson.com/rhn/dsp.html#4&quot; rel=&quot;nofollow&quot;&gt;http://www.nicholson.com/rhn/dsp.html#4&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But using just a normalized Sinc as the window transform equation is usually close enough, except for the bins right next to DC or 0 Hz and to bin N/2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For windows other that rectangular, use their transform instead of a Sinc function, up-sampled and/or interpolated if needed.  &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-07-30T19:52:28.750" LastActivityDate="2013-07-30T19:52:28.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10145" PostTypeId="2" ParentId="10127" CreationDate="2013-07-30T19:26:24.880" Score="5" Body="&lt;p&gt;Modifying your code a little bit, but no major changes, and I get correct results either way. Use this template code here, and you should not see any problems. I get the correct results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; &#xA;t=linspace(0,30,301); &#xA;Fs = (inv(t(2)-t(1))); &#xA;x=randn(100,1);  &#xA;wname = 'morl'; &#xA;scales = 1:1:256; &#xA;chefs = cwt(x,scales,wname,'lvlabs');&#xA;&#xA;freq = scal2frq(scales,wname,1/Fs);&#xA;&#xA;figure; &#xA;coefsSquared = abs(coefs).^2; &#xA;imagesc(coefsSquared); &#xA;grid off;&#xA;&#xA;%Pick one of the columsn to plot: &#xA;figure; &#xA;plot(coefsSquared(:,47))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the figure on the right hand side of the first image you put up, that is simply the time-slice spectrum. In other words, one column of your frequency-time matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we might get the following squared-coefficient matrix, in frequency vs. time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ECWoH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us then suppose we wish to look at the spectrum for the time-slice at column 47. Then, this is given here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hfVBH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, you then see the power of the coefficients, vs. frequency, for the time-slice corresponding to column 47. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="1629" LastEditDate="2016-05-09T11:52:48.987" LastActivityDate="2016-05-09T11:52:48.987" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10146" PostTypeId="1" AcceptedAnswerId="10149" CreationDate="2013-07-30T20:07:35.623" Score="7" ViewCount="1956" Body="&lt;p&gt;Is there a simple or potentially intuitive explanation for, with the DFT, vector multiplication in one domain being equivalent to circular convolution of the transforms of the vectors in the other domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since a DFT is just multiplication by a (special) square matrix, what about this matrix and matrix multiply allows the above duality?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2019-08-27T20:43:13.987" Title="DFT and multiplication/convolution equivalence" Tags="|fft|fourier-transform|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10147" PostTypeId="1" AcceptedAnswerId="10169" CreationDate="2013-07-30T22:17:14.227" Score="6" ViewCount="693" Body="&lt;p&gt;I am working on a project that employs a linear array sensor that provides data from the same object at two different energies.  Collected in time, I end up with two images (16-bit sensor values, MxM image), call one HIGH the other LOW.  My engineering background is Material Science and metallurgy, so I am coming up to speed on DSP, image analysis, and all of the bits that bring all of that together.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been researching &quot;image fusion&quot; and have been working from Gonzalez's fabulous Digital Image Processing (3rd ed.) text.  I have developed an understanding of DWT and have successfully written code to replicate the 3-scale DWT transforms in the text (major accomplishment for me).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am trying to understand how to &quot;fuse&quot; the DWT coefficients from the LOW and HIGH images.  From the IEEE Xplore database, I pulled several papers on the topic; one of the more useful is by Zhiyu Chen, et.al. &quot;A Combinational Approach to the Fusion, De-noising and Enhancement of Dual-Energy X-Ray Luggage Images&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Succinctly, they recommend &quot;averaging the corresponding approximation coefficients of L and H&quot; (sigma)... and &quot;summing the corresponding detail coefficients of L and H&quot; (psi).  But, that is all of what is said on the matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have several other sources, but they must presume some obvious bit of understanding that I am lacking!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, in order to successfully fuse the HIGH and LOW images: what does this mean?  In the case of a 3-scale DWT, do I average or sum the 3-rd scale approximation/detail coefficients?  Do I somehow average across each scale, despite the fact that the size of the coefficient matrices are different by powers of 2?&lt;/p&gt;&#xA;" OwnerUserId="5143" LastActivityDate="2013-08-01T17:26:01.707" Title="Data fusion using 2d discrete wavelet transform (DWT)" Tags="|image-processing|wavelet|2d|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10148" PostTypeId="1" CreationDate="2013-07-30T23:10:49.343" Score="12" ViewCount="25080" Body="&lt;p&gt;I read the following &lt;a href=&quot;http://en.wikipedia.org/wiki/Power_spectral_density#Power_spectral_density&quot; rel=&quot;nofollow&quot;&gt;on Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Power spectral density:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The above definition of energy spectral density is most suitable for&#xA;  &lt;strong&gt;transients&lt;/strong&gt;, i.e., pulse-like signals, &lt;strong&gt;for which the Fourier transforms&#xA;  of the signals exist&lt;/strong&gt;. For continued signals that describe, for example, stationary physical processes, it makes more sense to define a power spectral density (PSD), which describes how the power of a signal or time series is distributed over the different frequencies, as in the simple example given previously.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't quite understand that paragraph. The first part says that &quot;&lt;em&gt;for some signals .. the Fourier transform does not exist&lt;/em&gt;&quot;. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For which signals (in the context that we are discussing) does the Fourier transform not exist, and we therefore need to resort to the  PSD  rather than using the energy spectral density?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When obtaining the power spectral density, why can't we compute it directly? Why do we need to &lt;strong&gt;estimate&lt;/strong&gt; it? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, on this topic, I have read about methods that use Kayser-windows when computing the PSD over time. What is the purpose of these windows in PSD estimation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1026" LastEditorUserId="1629" LastEditDate="2016-09-09T18:58:29.717" LastActivityDate="2016-09-09T18:58:29.717" Title="Power spectral density vs Energy spectral density" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10149" PostTypeId="2" ParentId="10146" CreationDate="2013-07-31T04:08:07.453" Score="5" Body="&lt;p&gt;As you correctly say, the DFT can be represented by a matrix multiplication, namely the Fourier matrix $\mathbf{F}$. On the other hand the DFT &quot;transforms&quot; a cyclic convolution in a multiplication (as all Fourier transform variant as DFT, DTFT, FT have a similar property of transforming convolution to multiplication) and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand this in the matrix picture, note that also (circular) convolution with a certain sequence can be represented by a matrix multiplication. More specifically this is a circulant matrix, a special kind of a Toeplitz matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so $\mathbf{y} = \mathbf{c} * \mathbf{x}$ with $*$ the cyclic convolution can be written as &#xA;$\mathbf{y} = \mathbf{C}(\mathbf{c}) \mathbf{x}$ with $\mathbf{C}$ denoting the circulant matrix formed from entries of vector $\mathbf{c}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we &quot;transform&quot; this equation with the DFT (i.e. multiplication by $\mathbf{F}$) we obtain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\widehat{\mathbf{y}} = \mathbf{F} \, \mathbf{C}(\mathbf{c}) \,\mathbf{F}^H\, \widehat{\mathbf{x}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\widehat{\mathbf{y}}  =\mathbf{F}\mathbf{y}$ and $\widehat{\mathbf{x}}  =\mathbf{F}\mathbf{x}$ the respective DFTs (note $\mathbf{F}^H$ represents the IDFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is now that $\mathbf{F} \mathbf{C}(\mathbf{c}) \,\mathbf{F}^H$ is always a diagonal matrix, because all circulant matrices are diagonalized by the Fourier matrix. This means that the eigenvectors of circulant matrices are just given by the rows of the Fourier matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is of course consistent with the convolution picture, &#xA;because the DFT transforms the convolution to an elementwide multiplication. Moreover the diagonal elements of this matrix are just the DFT of $\mathbf{c}$, or, eqivalently, the eigenvalues of the circulant matrix formed from $\mathbf{c}$.&lt;/p&gt;&#xA;" OwnerUserId="5145" LastActivityDate="2013-07-31T04:08:07.453" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10150" PostTypeId="1" CreationDate="2013-07-31T04:28:05.007" Score="3" ViewCount="188" Body="&lt;p&gt;I have two images – mannequin &lt;strong&gt;with&lt;/strong&gt; and &lt;strong&gt;without&lt;/strong&gt; garment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please refer sample images below. Ignore the jewels, footwear on the mannequin, imagine the second mannequin has &lt;strong&gt;only dress&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vmv9T.png&quot; alt=&quot;enter image description here&quot;&gt; &#xA;&lt;img src=&quot;https://i.stack.imgur.com/2jaU0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to &lt;strong&gt;extract&lt;/strong&gt; only the &lt;strong&gt;garment&lt;/strong&gt; from the two images for further processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complexity is that there is &lt;strong&gt;slight displacement&lt;/strong&gt; in the position of camera when taking the two pictures. Due to this simple subtraction to generate the garment mask will not work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can anyone tell me how to handle it?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I need to do &lt;strong&gt;registration&lt;/strong&gt; between the two images so that I can extract only the garment from the image? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any references to blogs, articles and codes is highly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="3147" LastActivityDate="2014-06-23T14:32:38.520" Title="Garment Cropping from mannequin" Tags="|image-processing|matlab|computer-vision|opencv|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10152" PostTypeId="1" AcceptedAnswerId="10154" CreationDate="2013-07-31T09:56:19.343" Score="1" ViewCount="6093" Body="&lt;p&gt;I am calculating spectrogram of a audio file of 36 second using the following code snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;window = np.hamming(window_width)&#xA;length = signal.size&#xA;count = 0&#xA;for i in range(0, length-window_width, window_overlap):&#xA;    cur_frame = signal[i:i+window_width]&#xA;    window_frame = cur_frame*window&#xA;    spec = sp.fft(window_frame)&#xA;    if(i == 0):&#xA;        width = int(length/window_overlap)&#xA;        height = int(spec.size)&#xA;        specgram = np.empty([height, width])&#xA;        energy = np.empty(width)&#xA;    energy[count] = getEnergy(spec)&#xA;    for j in range(height):&#xA;        val = spec[j]       &#xA;        specgram[j, count] = math.sqrt(math.pow(val.real, 2)+math.pow(val.imag, 2))&#xA;    count = count+1&#xA;print abs(specgram).max()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get a ndarray of shape (4000L, 1008L)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when i calculate spectrogram using Pylab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Pxx, freqs, bins, im=pylab.specgram(sound_info, Fs=frame_rate)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get ndarray of dimension: (129L, 125999L).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually I need to get the spectrogram which is the dimension of (frequency,nframes)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="4926" LastActivityDate="2013-07-31T13:36:20.243" Title="Spectrogram of wav file" Tags="|python|spectrogram|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10154" PostTypeId="2" ParentId="10152" CreationDate="2013-07-31T13:36:20.243" Score="2" Body="&lt;p&gt;How @Pichenettes said, we need more information to help properly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll take a guess:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your Frame Rate are 44100, you will have 1587600 samples for 36 second of audio (36*44100), for the calculation example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Pxx, freqs, bins, im=pylab.specgram(sound_info, Fs=frame_rate)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;pylab.specgram&lt;/strong&gt; seems use FFT Size = 256 and Overlap = 128 (50%) its give me the follow dimensional array:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;floor(1587600 /  128) = 12403 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(128, 12403)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need set properly FFT Size and Overlap in your souce code.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-07-31T13:36:20.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10155" PostTypeId="1" AcceptedAnswerId="10156" CreationDate="2013-07-31T13:54:08.803" Score="8" ViewCount="2123" Body="&lt;p&gt;I got curious based on this question &lt;a href=&quot;https://dsp.stackexchange.com/questions/10148/power-spectral-density-vs-energy-spectral-density&quot;&gt;here&lt;/a&gt;, but basically, is there ever a real-life signal that exists where its Fourier transform does not exist? If a signal is not finite energy, then its Fourier Transform does not exist, so what might be an example, (if any), of such a signal in real-life?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-05-06T09:39:22.970" Title="Example of Fourier Transform not existing for real-life signals?" Tags="|fft|fourier-transform|fourier|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10156" PostTypeId="2" ParentId="10155" CreationDate="2013-07-31T16:07:54.580" Score="8" Body="&lt;p&gt;All real-life signals are finite energy. The universe contains a fixed (and finite) quantity of energy, which has been unchanged since it came into being. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal's energy is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E =\int_{-\infty}^{\infty}|x(t)|^2dt$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the only way to make a signal's energy go to infinity is to allow it to continue for infinite time or reach an infinite peak level. While useful in mathematical and/or physics theory, neither of these is possible in reality.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastEditorUserId="1497" LastEditDate="2013-08-12T11:53:27.513" LastActivityDate="2013-08-12T11:53:27.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10157" PostTypeId="2" ParentId="10150" CreationDate="2013-07-31T17:11:50.947" Score="1" Body="&lt;p&gt;The approach you are alluding to involves a) first registering the images and b) using a subtraction operation to remove the background (which is the mannequin). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First on (a) (registration): Image registration deals with figuring out the displacement of corresponding pixels in two images. The problem with real-world images is that the world is 3D and because of the depth in the scene, nearer surfaces will move more than surfaces deeper in the scene. Also, a surface can &lt;em&gt;self-occlude&lt;/em&gt; certain parts of the scene. I only state these so that you are aware of the complexities involved. Having said that, in the scenario you have posted above, you might be able to do very well with a simple &lt;em&gt;translation&lt;/em&gt; model for the displacement. In other words, you can assume that all pixel in the second image move by $(\delta{x}, \delta{y})$ from its original position. So if a pixel was located at $(x,y)$ in $I_1$, then its location in $I_2$ will be $(x+\delta{x}, y+\delta{y})$. This can be assumed to be true for every pixel (global translation). You now need to estimate the horizontal shift $\delta_x$ and the vertical shift $\delta_y$. There are many approaches to this problem. Here is an academic reference to registration methods (may be TMI) &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0262885603001379&quot; rel=&quot;nofollow&quot; title=&quot;Zitova &amp;amp; Flusser&quot;&gt;Zitova and Flusser&lt;/a&gt;. You may wish to start off by trying the ITK toolkit and try using the &lt;a href=&quot;http://www.itk.org/Wiki/ITK/Examples/SimpleOperations/TranslationTransform&quot; rel=&quot;nofollow&quot;&gt;&quot;translation transform&quot;&lt;/a&gt;. If you find that after accounting for a translation transform, the image subtraction still leaves parts of the mannequins, you might want to try some more advanced transforms. For example, the camera may have rotated slightly in your hand. So in addition to a shift, you can also introduce a rotation. Also, you might have taken one shot closer to the other, so there may be a difference in scale. This necessitates the use of an affine transform which is also included in ITK. Barring these &quot;global&quot; methods which assumes that every pixel moved in the same way, you can also use local methods. For example, you can estimate a $(\delta_x, \delta_y)$ for every patch in the image. You can divide up the image in patches of $7 \times 7$ pixels and search for the best corresponding patch in the other image. Every pixel within this $7 \times 7$ window is assumed to have moved in the same manner as the motion that was estimated for the patch. A last resort, but the most general is to compute dense optical flow for every pixel in the image. This gives you a shift for every pixel in the image. You can find an optical flow implementation in the popular &lt;a href=&quot;http://www.opencv.org&quot; rel=&quot;nofollow&quot;&gt;OpenCV&lt;/a&gt; software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, on (b) (occlusion): You will inevitably end up with some pixels without a valid shift because they simply aren't present on the other image. Or some pixels are uncovered in the second image which were covered on the first. See these paper for clues &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=2321618&quot; rel=&quot;nofollow&quot;&gt;Occlusion aware optical flow&lt;/a&gt; and &lt;a href=&quot;http://www.dtic.upf.edu/~cballester/DAGM2012.pdf&quot; rel=&quot;nofollow&quot;&gt;TV-L1 Optical Flow with Occlusion Detection&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2013-07-31T17:11:50.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10158" PostTypeId="2" ParentId="8173" CreationDate="2013-07-31T23:08:17.073" Score="1" Body="&lt;p&gt;Spectral coverage, I assume, means the Bandwidth required to transmit the incoming signal. A simple formula(approximate) for the Spectral Efficiency of Memoryless Modulation Schemes(MSK is not one) which gives the ratio between Data Rate and Bandwidth required is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R/W = (2*logM)/N&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where R is the incoming Data Rate and W is the required Bandwidth; log is in Base 2, M is the number of points on the Signal Constellation and N is the number of dimensions required to use the particular signalling.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;FSK requires as many as Dimensions as the number of Points you want to transmit.&lt;/li&gt;&#xA;&lt;li&gt;ASK is one-dimensional.&lt;/li&gt;&#xA;&lt;li&gt;QPSK is two-dimensional.&lt;/li&gt;&#xA;&lt;li&gt;MSK is more spectrally efficient than the other 3 and I think the formula for it's Power Spectral Density and its 3dB value can be found in all Digital Communication Texts.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-07-31T23:08:17.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10159" PostTypeId="1" AcceptedAnswerId="10162" CreationDate="2013-08-01T03:02:30.180" Score="1" ViewCount="1176" Body="&lt;p&gt;I started learning audio dsp and the book I am working through is loaded with formulas and most of the time expects the reader to know what the relation is between these functions and why they are being used in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd reading a section on spectral shape, which includes sub sections on rolloff, flux, centroid, spread etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On what data are the functions actually applied starting from the audio source?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im trying to get a grip on the actual process behind extracting information from audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book also mentions &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;It is also common to use the power spectrum instead of the magnitude&#xA;  spectrum&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How does one change between spectrums and when is it done in the extraction process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are they all applied to data in the frequency bins after running a Fourier transform? &lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2013-08-01T12:47:40.403" Title="Spectral Shape and properties" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="0" ClosedDate="2013-10-09T12:26:05.653" ContentLicense="CC BY-SA 3.0" />
  <row Id="10161" PostTypeId="2" ParentId="10148" CreationDate="2013-08-01T12:21:14.487" Score="2" Body="&lt;p&gt;Random process is never ending, non-periodic phenomenon, so taking Fourier transform of its realizations makes no sense, not possible either. However if random process is stationary, then it is for sure that it has some finite power over some band of frequencies. Now, here the question arises that how to compute the power of this stationary random process, (fourier tranform is not possible to be taken directly)? So, what to do? we find the auto-correlation function of the given random process, whose fourier transform always exist. Finally, we take the fourier tranform of this autocorrelation function to get the power spectral density of the given stationary process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you integrate the power spectral density of a given stationary process over the interval from -$\infty$ to $\infty$ you ll get the total power contained in the given random process.&lt;/p&gt;&#xA;" OwnerUserId="5049" LastActivityDate="2013-08-01T12:21:14.487" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10162" PostTypeId="2" ParentId="10159" CreationDate="2013-08-01T12:47:40.403" Score="1" Body="&lt;p&gt;For spectral features like roll-off, flux, centroid, etc, the process is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before delving into the extraction process, a pre-processing phase is sometimes necessary, this includes:&#xA;* Converting stereo signals to mono by summing both channels.&#xA;* Resampling the signal to a target sample rate (if a collection of signal of heterogenous sample rates are used).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we can assume that we are dealing with a mono signal of known sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At each time $t = 0, \Delta, 2\Delta...$ at which the feature has to be calculated (for example, $\Delta = 0.04s$ if 25 values of the feature are to be extracted per second of audio):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Extract the block of signal in the range $[t, t+l]$. $l$ is the analysis window duration and must be greater or equal than $\Delta$. There is a compromise to be found between using short $\Delta$ and $l$ (good temporal resolution) and using a long $l$ (good frequency resolution).&lt;/li&gt;&#xA;&lt;li&gt;Multiply this signal chunk by a windowing function such as the Hann window. This prevents spectral leakage which might cause unwanted results (for example, report abnormally high values of spectral spread for a purely sinusoidal signal).&lt;/li&gt;&#xA;&lt;li&gt;Eventually, pad the resulting signal with zeros. The purpose is twofold: make sure the number of samples processed at the next step is a power of 2 (in case the FFT library you use is rustic and does not handle other sizes); and in some applications, artificially boost the frequency resolution through spectral interpolation.&lt;/li&gt;&#xA;&lt;li&gt;Compute the FFT of the windowed, padded, block of signal.&lt;/li&gt;&#xA;&lt;li&gt;Discard the upper half of the coefficients returned by the FFT function (they correspond to &quot;negative frequencies&quot; and are of no interest).&lt;/li&gt;&#xA;&lt;li&gt;Compute either the magnitude or square magnitude of the remaining coefficients. This gives the spectrum on which spectral features are computed.&lt;/li&gt;&#xA;&lt;li&gt;From there, use whatever formula describes the feature to be extracted. The formulas usually involve $A(k)$ (squared magnitude or magnitude in the $k^{th}$ FFT bin) and $f(k) = \frac{k . \text{sample rate}}{\text{FFT size}}$ (Center frequency of the $k^{th}$ FFT bin).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There is little consensus in the audio signal processing community as to whether the magnitude or power spectrum should be used for spectral features - I have routinely seen both used in research code.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-01T12:47:40.403" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10163" PostTypeId="2" ParentId="10074" CreationDate="2013-08-01T14:11:54.717" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;We must produce s + 3 images in the stack of blurred images for each&#xA;  octave, so that ﬁnal extrema detection covers a complete octave.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For $s=3$ this means you will have $s + 3 = 6$ blurred images (the Gaussian images shown in the paper in Figure 1 on the left). Having $6$ Gaussian images will result in $5$ DoG images (shown in Figure 1 on the right). This will allow you to do the extrema detection on $s=3$ scales (using the method shown in Figure 2).&lt;/p&gt;&#xA;" OwnerUserId="3298" LastActivityDate="2013-08-01T14:11:54.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10164" PostTypeId="1" CreationDate="2013-08-01T15:53:29.010" Score="1" ViewCount="308" Body="&lt;p&gt;I need for an algorithm which do steps, displayed on image below.&#xA;Are solutions for doing this exist? (Preferably on C# or JavaScript).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rwVdv.jpg&quot; alt=&quot;Skyline alignment algorithm steps&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2011" LastActivityDate="2013-08-01T16:39:30.093" Title="Automatical skyline alignment on image" Tags="|computer-vision|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10165" PostTypeId="2" ParentId="10164" CreationDate="2013-08-01T16:26:41.750" Score="0" Body="&lt;p&gt;I'm not expert in image processing, but if I had to try something I would &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) convert the image to grayscale&lt;br/&gt;&#xA;2) do some denoising (maybe with a median filter) and thresholding&lt;br /&gt;&#xA;3) use principal component analysis to find the orientation&lt;/p&gt;&#xA;" OwnerUserId="5150" LastActivityDate="2013-08-01T16:26:41.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10166" PostTypeId="2" ParentId="10164" CreationDate="2013-08-01T16:39:30.093" Score="2" Body="&lt;p&gt;You could try detecting line segments in the image for example using hough transform, or maybe &lt;a href=&quot;http://marcosnietoblog.wordpress.com/2012/04/28/line-segment-detection-opencv-c-source-code/&quot; rel=&quot;nofollow&quot;&gt;lswms&lt;/a&gt;, &lt;a href=&quot;http://ceng.anadolu.edu.tr/cv/EDLines/&quot; rel=&quot;nofollow&quot;&gt;edlines&lt;/a&gt; or &lt;a href=&quot;http://www.ipol.im/pub/art/2012/gjmr-lsd/&quot; rel=&quot;nofollow&quot;&gt;lsd&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After detecting the lines, you can compute their length and angle and find the longest almost horizontal line. If you are lucky, this line will be the horizon and you can rotate the whole image in the opposite direction to get the aligned image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might work but it will depend on how good the horizon is visible and how well it is detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you could find a number of potential horizon lines and have the user select the best one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On second thought, if you involve users into this, just let them draw the horizon and then rotate the image. That's not really what you were asking for, but it will probably work better than what I suggested above. :)&lt;/p&gt;&#xA;" OwnerUserId="3298" LastActivityDate="2013-08-01T16:39:30.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10167" PostTypeId="2" ParentId="10108" CreationDate="2013-08-01T16:57:58.360" Score="1" Body="&lt;p&gt;If the PCA was correct, than green and yellow line would be perpendicular. So something is wrong with your result.&lt;/p&gt;&#xA;" OwnerUserId="4932" LastActivityDate="2013-08-01T16:57:58.360" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10169" PostTypeId="2" ParentId="10147" CreationDate="2013-08-01T17:26:01.707" Score="2" Body="&lt;p&gt;If I remember my wavelet transform correctly, this is what happens. Let's imagine that we are working with only the LOW image at the moment. I perform the first-scale decomposition which gives me the LOW_A0 (approximation) and the three detail coefficient images which are LOW_H0, LOW_V0 and LOW_D0. Then, to perform the second scale decomposition, you take the approximation image LOW_A0 and obtain LOW_A0_A1 (approximation) and the corresponding three detail coefficient images LOW_A0_H1, LOW_A0_V1 and LOW_A0_D1. Finally, in the last scale decomposition, you will split LOW_A0_A1 into its corresponding approximation coefficients LOW_A0_A1_A2 and the final detail coefficient images LOW_A0_A1_H2, LOW_A0_A1_V2 and LOW_A0_A1_D2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at the end you are left with the following:&#xA;1) The lowest approximation coefficients LOW_A0_A1_A2&#xA;2) The detail coefficients at each level which are 9 in number (LOW_H0, LOW_V0, LOW_D0, LOW_A0_H1, LOW_A0_V1, LOW_A0_D1, LOW_A0_A1_H2, LOW_A0_A1_V2 and LOW_A0_A1_D2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, also consider that in parallel you have also performed the wavelet decomposition for the HIGH image and you have the same end stage products which are:&#xA;1) The lowest approximation coefficients HIGH_A0_A1_A2&#xA;2) The detail coefficients at each level which are 9 in number (HIGH_H0, HIGH_V0, HIGH_D0, HIGH_A0_H1, HIGH_A0_V1, HIGH_A0_D1, HIGH_A0_A1_H2, HIGH_A0_A1_V2 and HIGH_A0_A1_D2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to now reconstruct a FUSED image which contains information from both the LOW and the HIGH images. At this stage, you would apply the fusion algorithm. Average the lowest approximation coefficients k*LOW_A0_A1_A2 + (1-k)*HIGH_A0_A1_A2, where k= 0.5 for equal weighting (you may want to weight one more than the other). Then, sum the detail coefficients at each of the corresponding LOW and HIGH detail coefficients. For example, &#xA;LOW_H0 + HIGH_H0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now take these approximation coefficient and detail coefficients and do the wavelet synthesis to get the final result. Does this make sense? I haven't read the paper/thesis you pointed out to though.&lt;/p&gt;&#xA;" OwnerUserId="867" LastActivityDate="2013-08-01T17:26:01.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10170" PostTypeId="1" CreationDate="2013-08-01T19:18:11.187" Score="2" ViewCount="426" Body="&lt;p&gt;I designed a 2nd type Chebyshev bandpass filter with passband between 1 and 6 Hz and 30 dB attenuation in the stopband. When I looked at its Bode plot in &lt;em&gt;Mathematica&lt;/em&gt;, I noticed &quot;stability margins&quot; (black lines) on the plot. I'm not familiar with this concept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the stability margin have any impact on the stability of the IIR filter? For instance, will using the following filter on data (that is sampled at the appropriate sampling rate) cause stability issues?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OYfFp.png&quot; alt=&quot;https://i.stack.imgur.com/OYfFp.png&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The x-axis in both plots is the frequency (Hz) and the top plot is the magnitude response (dB) and the bottom is the unwrapped phase (radians).&lt;/p&gt;&#xA;" OwnerDisplayName="user5153" LastEditorUserId="29" LastEditDate="2013-08-29T21:46:31.647" LastActivityDate="2013-08-29T21:46:31.647" Title="What does the stability margin have to do with the quality of a filter?" Tags="|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10171" PostTypeId="1" CreationDate="2013-08-01T20:11:22.173" Score="2" ViewCount="632" Body="&lt;p&gt;hmm any one can help please? I have a signal that contains some modes in it. I've run a CWT transform but I haven't got my desired results. so I implement a test signal that contains freqs [0.1,0.3,0.6] Hz to see whats the problem with my codes. but the result was accurate. once I change the freqs to [0.1,0.4,0.6] or [0.1,0.5,0.6]Hz,The results wasn't accurate anymore on the plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see the plot here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cWtaq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be for the damping effect of the 0.6Hz mode or ... I don't know actually :(&#xA;I think I must fix why this happening first to get my actual signal modes. here's my codes.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    t=linspace(0,30,300);&#xA;Fs=ceil(inv(t(2)-t(1)));                               % sampling freq&#xA; x=sin(2*pi*t*0.1).*(t&amp;lt;10)+sin(2*pi*t*0.3).*... &#xA;     (t&amp;lt;30)+sin(2*pi*t*0.6).*(t&amp;lt;10).*exp(-t*.1);       % my signal[0.1Hz,0.3Hz,0.6Hz] &#xA;wname = 'morl';                                        % define wavelet name&#xA;scales = 1:1:128;                                      % scales range&#xA;coefs = cwt(x,scales,wname,'lvlabs');                  % Get coefs of x&#xA;freq = scal2frq(scales,wname,1/Fs);                    %convert scales to freq range&#xA;surf(t,freq,abs(coefs));shading('interp');             % 3D surface plot&#xA;axis tight; xlabel('Seconds'); ylabel...               % seting the axis 3D surface&#xA;    ('Pseudo-Frequency (Hz)');                         % seting the axis 3D surface&#xA;axis([0 length(t)/Fs 0 1 0 max(coefs(:))*1.1])         % seting the axis 3D surface&#xA;figure;&#xA;sc=wscalogram('image',coefs,'scales',freq,'ydata',x);  % get scalograme of x&#xA;xlabel('Time'); ylabel('Frequency of gen');            % set axis&#xA;hold on&#xA;abscof=abs(coefs)';                                    % |coefs|' &#xA;modI=max(abscof);                                      % get  max |coefs| coresponde to freqs of x &#xA;modI=modI/max(modI);                                   % scale each clumn 0-1&#xA;figure;&#xA;plot(freq,modI)                                        % Plot all modes. contain all &#xA;grid on&#xA;axis([0 1 0 max(modI)*1.1])                            % seting the axis&#xA;xlabel('Pseudo-Frequency (Hz)'); ylabel('abs(coefs)'); % seting the axis&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for your respond. &lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-08-05T15:01:15.750" LastActivityDate="2013-08-05T15:01:15.750" Title="why wavelet (CWT) doesn't show accurate results always?" Tags="|frequency-spectrum|frequency|wavelet|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10172" PostTypeId="2" ParentId="10170" CreationDate="2013-08-01T20:27:21.183" Score="2" Body="&lt;p&gt;Even though you might have designed your filter to be stable, Stability Margin is a concept which is used to estimate how far we are away from becoming Marginally stable/unstable both in terms of Gain and Phase. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;This would mean then at Unity Gain(&lt;code&gt;0 dB&lt;/code&gt;) any phase rotation of &lt;code&gt;-180&lt;/code&gt; degrees or ODD multiples of it is bound to make your system unstable and thus comes Phase Margin, the amount of rotation on the Pole Zero plot which would bring the Root Locus plot to intersect the point -1(or rather how far you're away from the 180 degree line on a Bode Plot when your Gain Magnitude is Unity).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Likewise we can state the same in terms of Gain. The amount of Gain that'd be necessary for the same Nyquist plot to expand and hit the point -1 (or how far you're away from the Unity magnitude gain when the phase response is &lt;code&gt;-180 degrees&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Practical consequences of system implementation always require you to have some Margin because you're never guaranteed that the Gain and the Phase plots are exactly replicated when the system is actually working. So these parameters will tell you if you're safe or not. Theoretically, even being away from 1 degree away from -180 Degree line at Unity gain is stable; but practically there are things that can happen which will push it away easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can learn a lot about these at&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;:&lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_margin&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Phase_margin&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.facstaff.bucknell.edu/mastascu/econtrolhtml/Freq/Nyquist4.html&quot; rel=&quot;nofollow&quot;&gt;http://www.facstaff.bucknell.edu/mastascu/econtrolhtml/Freq/Nyquist4.html&lt;/a&gt; (a good simulation is shown here).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Stability Margin doesn't have any impact on the Stability of the Filter, it'll just indicate if your filter is Stable or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Phase plot is actually shown in Degrees. Your filter looks like it is Marginally stable because at a few multiples of -180 degrees, the Gain is 0dB(oscillatory), and that too within the frequencies you've designed the filter to operate, it looks not promising at all. The Black Lines on the gain plot should appear at every multiples of -180 degrees. Also coming to the phase plot, there are no Black lines in this case because at least one Unity Gain crossover point has a Phase rotation that is an Integral odd multiple of -180 Degrees. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastEditorUserId="5102" LastEditDate="2013-08-01T20:33:15.177" LastActivityDate="2013-08-01T20:33:15.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10173" PostTypeId="1" AcceptedAnswerId="10175" CreationDate="2013-08-01T20:36:18.880" Score="0" ViewCount="208" Body="&lt;p&gt;My data is sampled at $f_s$, and I'm interested in analyzing certain frequencies $0&amp;lt;f_1&amp;lt;\ldots&amp;lt;f_N&amp;lt;\frac{f_s}{4}$. I then take $T$ samples of data, $\{x_1,\ldots\,x_T\}$ where $T\gg \frac{1}{f_s}$, FFT it after padding to the next power of 2 after $T$ and then pick the FFT bins closest to my $f_i$ of interest to proceed with the next step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Is it necessary to (or is there any advantage if I) bandpass filter (BPF) my data between $f_1$ and $f_N$? I figured that since there was no downsampling involved, there won't be any aliasing and I needn't BPF it. Besides, a well designed filter should not modify the frequencies of interest, so it makes no difference. Am I missing something or is filtering a necessary step before FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I won't be inverting it back to the time domain. I'm just interested in the specific bins (but several that FFT is much faster than Goertzel).&lt;/p&gt;&#xA;" OwnerDisplayName="user5154" LastActivityDate="2013-08-02T03:16:43.167" Title="Is filtering necessary if I'm not downsampling?" Tags="|fft|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10174" PostTypeId="1" CreationDate="2013-08-02T01:29:07.683" Score="2" ViewCount="1455" Body="&lt;p&gt;How can I compare the way that word is pronounced with a sample? For example, most of dictionaries have sample word pronunciation recorded. The goal is to provide feedback to the user so that he or she can improve pronunciation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if there are API available for such task or existing programs that are able to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found similar question here &lt;a href=&quot;https://dsp.stackexchange.com/questions/1867/how-do-i-compare-2-audio-files-returning-a-percentage-of-difference&quot;&gt;How do I compare 2 audio files, returning a percentage of difference&lt;/a&gt; , but I am providing a definition what actual difference is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Eugene&lt;/p&gt;&#xA;" OwnerUserId="5155" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-10-06T16:51:21.447" Title="Automated accent detection" Tags="|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10175" PostTypeId="2" ParentId="10173" CreationDate="2013-08-02T03:16:43.167" Score="2" Body="&lt;p&gt;Filtering is not necessary as it would only effect those frequency bins outside of the passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, depending on how small your passband is, you could potentially save yourelf a lot of FFT processing by low-pass filtering and then downsampling before your perform your FFT.  For example, if you downsample by 4, the resulting FFT could be 4 times shorter and still have the same frequency resolution.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-08-02T03:16:43.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10177" PostTypeId="1" AcceptedAnswerId="10186" CreationDate="2013-08-02T12:27:39.630" Score="0" ViewCount="195" Body="&lt;p&gt;I'm trying to do an FFT on live audio to see its spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have a sampling rate of 44100 Hz and from this take out 1024 bins on my FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to test it I play a continuous tone at 15000 Hz and another one at 16000 Hz and look for it on my spectrum. I try to use higher ones to cut out noise from around. I have made the sound in a way there is no clipping&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is when I look at the individual frames of the FFT in each 2048 byte block of data I can see the peaks at these frequencies but some frames won't have the peaks, yet the others would.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this happen? How can I avoid it or what can I do to the way I'm reading the audio so that I can see the two tones in every frame?&lt;/p&gt;&#xA;" OwnerUserId="5120" LastActivityDate="2014-03-07T15:03:09.897" Title="FFT doesn't always have frequency in all frames" Tags="|fft|audio|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10178" PostTypeId="1" CreationDate="2013-08-02T12:42:01.117" Score="0" ViewCount="100" Body="&lt;p&gt;Please excuse me for asking such a basic question. I was having a look at how AM radio works. So there is a carrier frequency and a higher frequency inside that that carries the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean that there would be two frequencies, one high and one low?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about for stuff like 3G/GSM when stuff is sent over EM would it create noise at other frequencies, say out of their licensed spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not how do they squeeze it all into such a tiny band of frequencies?&lt;/p&gt;&#xA;" OwnerUserId="5120" LastActivityDate="2013-09-01T14:20:31.193" Title="Do high frequency oscillations use more than one bandwidth" Tags="|frequency-spectrum|frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10179" PostTypeId="2" ParentId="10177" CreationDate="2013-08-02T13:51:09.883" Score="2" Body="&lt;p&gt;You might be looking only at the cosine component (sometimes called the even or real component) of the FFT result, instead of the magnitude of each entire complex FFT result vector.  The real component will vary as your test signal goes in and out of phase with the cosine basis vectors (always even functions) of each frame, even if the complex bin magnitude stays constant (or varies only slightly due to windowing scalloping).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mag[i] = sqrt(real[i]*real[i] * imag[i]*imag[i]);&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-02T13:51:09.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10180" PostTypeId="2" ParentId="10178" CreationDate="2013-08-02T14:04:35.453" Score="2" Body="&lt;p&gt;A modulated radio signal has non-zero bandwidth.  The modulation signal that carries the information has a much lower max frequency compared with the carrier frequency, keeping the total bandwidth (carrier plus both modulation sidebands) of an AM signal within FCC legal limits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other modulation schemes are used for GSM/3G, such as OFDM, that create more widely spaced sidebands, but the carrier frequency is so much higher (GHz range) than the modulation sideband width, that the resulting signal bandwidth is only a tiny fractional slice of the total RF spectrum.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-02T14:10:55.167" LastActivityDate="2013-08-02T14:10:55.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10181" PostTypeId="1" CreationDate="2013-08-02T16:04:05.187" Score="0" ViewCount="74" Body="&lt;p&gt;I require an image processor which compares an image with a set of images and finds the equivalent image out of them.&lt;/p&gt;&#xA;" OwnerUserId="5158" LastActivityDate="2013-08-02T17:32:43.343" Title="do i have an image processor to compare an image with a number of images and choose the identical image??" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ClosedDate="2013-09-06T21:18:16.300" ContentLicense="CC BY-SA 3.0" />
  <row Id="10182" PostTypeId="2" ParentId="10181" CreationDate="2013-08-02T17:32:43.343" Score="2" Body="&lt;p&gt;This is a very broad question and to be honest there are a multitude of ways to go about this. I highly recommend that you read more into imaging processing literature in general. From this you could perhaps suggest an approach that we could base our answers on, and help hone in on a good method for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, a common approach to your problem is the SIFT algorithm. This algorithm will give back a set of features for a given image. From this you could construct a way to recognise images. However, this might not be the simplest solution if you are just a beginner at this game. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best of luck! &lt;/p&gt;&#xA;" OwnerUserId="4996" LastActivityDate="2013-08-02T17:32:43.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10183" PostTypeId="1" AcceptedAnswerId="10588" CreationDate="2013-08-02T19:29:23.413" Score="12" ViewCount="24952" Body="&lt;p&gt;What is meant by &quot;spectral whitening&quot; in DSP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What effect does spectral whitening have when used in image processing?  (visually or otherwise...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where might spectral whitening be useful in audio processing or analysis?  What would a spectrally whitened audio signal sound like?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2021-11-02T18:35:04.333" Title="What is spectral whitening?" Tags="|filters|frequency-spectrum|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10184" PostTypeId="2" ParentId="10183" CreationDate="2013-08-02T19:40:55.723" Score="3" Body="&lt;p&gt;Spectral Whitening is the process of making the Magnitude spectrum &lt;code&gt;Uniform&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an image it makes the Magnitude Spectrum more continuous rather than having few frequencies jumping around here and there. Basically the word &quot;Whitening&quot; comes from White Process whose spectrum is just a constant at all frequencies. But if you do that to an image it'll make no sense. So in effect you'd want a rather jumpy and jittery Spectrum to look more smooth without overly inducing noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how it'll affect an image but I can give an example of where this is applied. Consider an LTI channel in a communication system(or an audio system which has a rather not so &quot;white&quot; frequency response to all frequencies. An audio system will not reciprocate all frequencies at the same magnitude and there comes equalization). At the end of the receiver(as the output of the speaker, or the &lt;code&gt;RX&lt;/code&gt; of the communication system) what you receive is the distorted version of the Input signal. So what you'd want to theoretically do before sending the signal over the system is to modify the shape of the signal so that when the system distorts it, it makes it flat enough. This is called pre-emphasis or equalization typically. I guess I'm not sure where Spectral Whitening would be applied in Image Processing(as I haven't done it before) but it'll have equal usage and applications as I've explained here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might then think of the &quot;Spectral Whitener&quot; or an Equalizer (in the case of a Communication System) as just an inverse of the System that distorts it. If the frequency response of the system is $H(z)$, the whitener will be just $1/H(z)$. But care should be taken if you do this after your signal has been crippled with noise because you might enhance the noise levels at some places where its magnitude was previously very low.&lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-08-02T19:40:55.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10185" PostTypeId="2" ParentId="10174" CreationDate="2013-08-02T20:12:14.570" Score="0" Body="&lt;p&gt;You have stated a problem roughly similar to speaker-independent isolated speech recognition into a dictionary of one word, where instead of searching for the closest word in the dictionary, you just want the multi-dimensional distance vector and/or match statistics. This is a non-trivial technology involving many thousands of research papers and books.  You might want to try a basic textbook on computer speech recognition to get started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There does seem to  exist commercial software for automated accent analysis and improvement, but I am unfamiliar with them or whether any offer a public API.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-02T20:12:14.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10186" PostTypeId="2" ParentId="10177" CreationDate="2013-08-02T22:16:07.823" Score="-1" Body="&lt;p&gt;Not sure I understand your question exactly, but make sure to take the magnitude not just the real/imaginary components. Also, it will probably help to window your incoming data, and it sounds like you aren't doing that. For further detail and even some sample code, see here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html&quot; rel=&quot;nofollow&quot;&gt;http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2013-08-02T22:16:07.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10187" PostTypeId="1" AcceptedAnswerId="10188" CreationDate="2013-08-02T22:39:19.443" Score="1" ViewCount="1203" Body="&lt;p&gt;I'm having some trouble understanding &lt;code&gt;FFT&lt;/code&gt; plots and measures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qawmK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to this, this will give me the magnitude plot of &lt;code&gt;FFT&lt;/code&gt;, but I want the area under from &lt;code&gt;1 to 10 Hz&lt;/code&gt; for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this next formula I made right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TdnOE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My doubt is, what's the relation between &lt;code&gt;Hz&lt;/code&gt; and &lt;code&gt;rad/s&lt;/code&gt;, &lt;code&gt;f&lt;/code&gt; and &lt;code&gt;w&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4940" LastActivityDate="2013-08-02T23:15:05.127" Title="Units of FFT frequency" Tags="|fft|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10188" PostTypeId="2" ParentId="10187" CreationDate="2013-08-02T23:15:05.127" Score="3" Body="&lt;p&gt;The formula you made will work if what you are after is simply &quot;the area under the the magnitude plot from $\omega_i$ to $\omega_f$.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many cases you can think of &lt;code&gt;Hz&lt;/code&gt; as meaning &quot;rotations per second.&quot;  In that case, it becomes more obvious that 1 rotation = 2$\pi$ radians.  Since $f$ has units of &lt;code&gt;Hz&lt;/code&gt; and $\omega$ has units of radians, the conversion is simply:&#xA;$$&#xA;1 \, \text{Hz} = 2 \pi \, \frac{\text{rad}}{\text{s}}&#xA;$$&#xA;So evaluate your integration from $\frac{1}{2\pi}$ to $\frac{10}{2\pi}$ and you should have the result you are after.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-08-02T23:15:05.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10190" PostTypeId="1" CreationDate="2013-08-03T14:34:19.640" Score="1" ViewCount="1072" Body="&lt;p&gt;I'm looking for wavelets that are both:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;causal&lt;/strong&gt; (a wavelet coefficient $W(j,k)$, where $j$ is scale and $k$ is translation, does not use data from $t &amp;gt; k$ to be estimated).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;complex&lt;/strong&gt; (such as the Morlet wavelet, to analyze phase differences between two time-series).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Do any exist?&lt;/p&gt;&#xA;" OwnerUserId="4649" LastActivityDate="2013-11-18T17:07:25.940" Title="Examples of Causal and Complex Wavelets?" Tags="|frequency|wavelet|frequency-domain|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10191" PostTypeId="1" CreationDate="2013-08-03T20:11:46.297" Score="4" ViewCount="1396" Body="&lt;p&gt;I am really sorry if it is wrong place to ask this question but i couldn't not find any stackexchange website appropriate.&#xA;i have some reflectance values of a material which are measured in 10.5 and 12.5 micrometers interval. This spectra is extracted from a spectral library. Then by using Kirchhoff's Radiation Law i calculated the emissivity values in each wavelength. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that, Here is the spectral response of Landsat5 TM thermal band. --&gt; &lt;a href=&quot;http://atmcorr.gsfc.nasa.gov/L5_handbook.rsp&quot; rel=&quot;nofollow&quot;&gt;http://atmcorr.gsfc.nasa.gov/L5_handbook.rsp&lt;/a&gt;&#xA;I have to convolve these emissivities to the spectral response above. Bu i dont have any idea. How can i do it?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Thanks alot for your helps&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I found the solution after searching in articles,&#xA;Here is the convolution = &#xA;$$e_{i} = \frac{\int_{\lambda =\lambda _{1}}^{\lambda _{2}}f_{i}\varepsilon \left ( \lambda  \right )\partial\lambda }{\int_{\lambda =\lambda _{1}}^{\lambda _{2}}f_{i}\partial\lambda}$$&#xA;Where i = channel  number, $\lambda$ is wavelength, $\varepsilon \left ( \lambda  \right )$ spectral emissivity optained from spectral library, $f_{i}$ sensors spectral function and $e_{i}$ is channel emissivity that we want to find. $\lambda _{1}$ and $\lambda _{2}$ are upper and lower bounds of thermal band.&lt;/p&gt;&#xA;" OwnerDisplayName="user5162" LastEditorDisplayName="user5162" LastEditDate="2013-08-05T16:34:44.860" LastActivityDate="2022-08-12T10:08:35.823" Title="Convolution of spectra to sensor response function?" Tags="|filters|frequency-spectrum|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10192" PostTypeId="2" ParentId="811" CreationDate="2013-08-03T22:39:36.027" Score="3" Body="&lt;p&gt;Similar to the preferred answer above (Jason S.), and also derived from the formula taken from Knut (Vol.2, p 232), one can also derive a formula to replace a value, i.e. remove and add a value in one step. According to my tests, replace delivers better precision than the two-step remove/add version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below is in Java, &lt;code&gt;mean&lt;/code&gt; and &lt;code&gt;s&lt;/code&gt; get updated (&quot;global&quot; member variables), same as &lt;code&gt;m&lt;/code&gt; and &lt;code&gt;s&lt;/code&gt; above in Jason's post. The value &lt;code&gt;count&lt;/code&gt; refers to the window size &lt;code&gt;n&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Replaces the value {@code x} currently present in this sample with the&#xA; * new value {@code y}. In a sliding window, {@code x} is the value that&#xA; * drops out and {@code y} is the new value entering the window. The sample&#xA; * count remains constant with this operation.&#xA; * &#xA; * @param x&#xA; *            the value to remove&#xA; * @param y&#xA; *            the value to add&#xA; */&#xA;public void replace(double x, double y) {&#xA;    final double deltaYX = y - x;&#xA;    final double deltaX = x - mean;&#xA;    final double deltaY = y - mean;&#xA;    mean = mean + deltaYX / count;&#xA;    final double deltaYp = y - mean;&#xA;    final double countMinus1 = count - 1;&#xA;    s = s - count / countMinus1 * (deltaX * deltaX - deltaY * deltaYp) - deltaYX * deltaYp / countMinus1;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5163" LastActivityDate="2013-08-03T22:39:36.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10193" PostTypeId="1" AcceptedAnswerId="10216" CreationDate="2013-08-04T02:13:52.707" Score="3" ViewCount="1181" Body="&lt;p&gt;Glottal Closure Instants (GCIs) are referred to the instances of signiﬁcant excitation of the vocal tract.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen in some papers that I can measure instant of glottal closure in a voiced segment directly from speech waveforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tayCe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone provide me information how detect GCIs ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How Glottal Closure Instants can be estimated ?&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2013-08-05T12:35:29.160" LastActivityDate="2022-07-30T14:35:25.530" Title="Estimation of Glottal Closure Instant" Tags="|audio|speech|voice|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10194" PostTypeId="1" AcceptedAnswerId="10198" CreationDate="2013-08-04T07:11:28.563" Score="0" ViewCount="1962" Body="&lt;p&gt;How is it possible to go from time domain amplitude values in floating point to frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the DFT is used, but what exactly is happening for it to be able to extract frequencies from amplitude values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is amplitude between -1 and 1 mapped from pressure levels? How are different frequencies detected in a block of amplitude values? What if two files have the exact same amplitude values but completely different frequencies?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2013-08-04T15:41:43.223" Title="From time domain to frequency domain" Tags="|audio|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10195" PostTypeId="2" ParentId="10194" CreationDate="2013-08-04T08:24:28.870" Score="1" Body="&lt;p&gt;The Mathematical structure of all Transforms can be understood by simply first seeing what a Fourier Series Representation is. In Continuous Time Domain, Fourier established that all periodic waveforms can be expressed as sum of Complex exponentials of some magnitude(which are the coefficients in a Fourier Series). The same can actually be applied for an aperiodic waveform assuming a periodic extension of it. So what the underlying Transform Relationships give us are nothing but the Analysis and Synthesis equations for what frequencies are present in a signal and what are their magnitudes. Rather, you can view these magnitudes as the Projections of the signal on the complex exponentials as to trying to figure out how much of a particular frequency is present in a signal. (You might want to remember the Analysis and Synthesis equations to see what I've said here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for a certain set of functions(L2 functions or rather Limited Energy functions $\int_{-\infty}^{\infty}|x^{2}(t)|dt$ being finite and a set of conditions called Dirchlet's conditions being satisfied) have a special and easily identifiable Analysis equation called the Fourier Transform which comes straight from Fourier Representation of Series coefficients. Now in real world, we rarely encounter functions that violate these properties. If a function were to blow up to infinity in Energy we can never use it anyway. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caution must be exercised because the Fourier representations involve a lot of intricacies which are rather ignored in daily life problem solving. One might learn a lot by looking at Existence, Measurability, Riemann Integrability etc. of functions and their energies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've tackled the problem of continuous time(both in terms of Series and Transforms) Discrete is just extrapolations right from Nyquist Shannon's sampling theorem. Now what exactly is a digital signal? It is just the sampled version of it. How quickly sampled is what determines the frequency content that you get  in the Sampled version. If you look at the formula of a DFT it is nothing but the Analysis equation of Fourier Series represented in $0,1...N-1$ points which are called &quot;Bins&quot;. It is nothing but the Discrete version of the Fourier Series(think of Integral in the Analysis equation being replaced by Summation and the $\exp(-j\omega t)$ term in the transform being written as $exp(-2*pi*j*k/N)$ where k represents the number of points that you have from the sampled signal and $2*pi/N$ is nothing but the analogous term in the series which is the Fundamental Angular Frequency. I hope this explains much about how exactly DFT is able to get the Frequencies from a Time domain wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for the last part, for 2 files to have exactly the same amplitude values at exactly the same points of time, it is impossible for them to differ in their frequency content because the Math behind it sees just the values. Maybe I'm misinterpreting your question or your phrasing is not proper. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-08-04T08:24:28.870" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10196" PostTypeId="1" AcceptedAnswerId="10206" CreationDate="2013-08-04T08:49:53.253" Score="8" ViewCount="8033" Body="&lt;p&gt;I am using Cmor-Fb-FC wavelet transform in matlab environment. Fb is bandwidth and Fc is center frequency parameters. with trail and error procedure I select Fb-Fc as 5-1, and I've got rational output. But I want to know whats the rule of selecting proper value for Fb-Fc parameters? Imagine I am using 300 samples over 30 sec. so my sampling frequency is 10 Hz.Here is my signal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=sin(2*pi*t*.1).*(t&amp;lt;10)+sin(2*pi*t*0.3).*... &#xA;    (t&amp;lt;30)+sin(2*pi*t*0.6).*(t&amp;lt;10).*exp(-t*.1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-08-05T15:00:20.987" LastActivityDate="2014-02-11T11:38:32.067" Title="what is proper setting for Fb,Fc in Complex morlet wavelet (cmor)?" Tags="|matlab|wavelet|bandwidth|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10198" PostTypeId="2" ParentId="10194" CreationDate="2013-08-04T15:28:57.160" Score="1" Body="&lt;p&gt;The time domain signal is just samples of some data (for instance, air pressure, or microphone diaphragm displacement,etc.) taken at different points in time.  If the audio signal is created by something vibrating at some frequency, that will effect how the sampled data changes between each sample.  So normally, one has to look at a whole bunch of samples (enough to plot a waveform) to determine if there is something vibrating and at what frequency.  A single time domain sample can tell you nothing about how the waveform is changing, thus nothing about the frequency.  You need enough samples to plot some points on a graph.  A DFT is a good way to count (correlate) how many well rounded periodic &quot;wiggles&quot; per length of that graph, and their shape if not sinusoidal.  A different number or shape of wiggles corresponds to a different main frequency, usually mixed with a bunch of overtone or harmonic frequencies.  But since small variations in air pressure are very close to linear (additive), multiple frequency sources just sum (like adding two waveforms, sample by sample, in time).  A DFT can also be good at unmixing this kind of  stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that since frequency (other than 0Hz) indicates change, a single sample for a single frequency can have almost any value, depending on when you start taking samples.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-04T15:41:43.223" LastActivityDate="2013-08-04T15:41:43.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10199" PostTypeId="1" CreationDate="2013-08-04T18:14:25.710" Score="1" ViewCount="2566" Body="&lt;p&gt;With Python/Scipy, if I have a simply BPSK signal sequence &lt;code&gt;[1, -1, -1, 1, ...]&lt;/code&gt;, how can I generate a real-valued baseband waveforms with oversampling rate &lt;code&gt;m&lt;/code&gt;, and common pulse shapes such as &lt;code&gt;root raised cosine&lt;/code&gt;, &lt;code&gt;Nyquist&lt;/code&gt;, etc.?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab I found this &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/fdesign.pulseshaping.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fdesign.pulseshaping&lt;/code&gt; function&lt;/a&gt;, is there an equivalent function in SciPy? If not how can I implement this myself?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think in other words, how can I find filter coefficient &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;a&lt;/code&gt; of root raised cosine or Nyquist filters so I use &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html#scipy-signal-filtfilt&quot; rel=&quot;nofollow&quot;&gt;signal.filtfilt&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4083" LastEditorUserId="29" LastEditDate="2013-08-07T13:44:40.703" LastActivityDate="2013-08-07T13:44:40.703" Title="with SciPy, how to generate waveform with common pulse shapes?" Tags="|filters|filter-design|lowpass-filter|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10201" PostTypeId="2" ParentId="10190" CreationDate="2013-08-04T19:15:54.970" Score="1" Body="&lt;p&gt;You can always just &lt;em&gt;build&lt;/em&gt; your own, for instance by taking the Morlet wavelet shift it to the right until, say, 99% of the area below the function is on the positive axis and then set everything on the negative axis to zero. But bear in mind that it's impossible to build a wavelet (or filter which is the same) that is causal and analytic, i.e., a filter that erases all negative frequencies, which you actually need to get that property you need (separation of phase and amplitude). However a pretty good approximation is always possible.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2013-08-04T19:15:54.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10202" PostTypeId="1" AcceptedAnswerId="10203" CreationDate="2013-08-05T06:02:36.043" Score="0" ViewCount="1562" Body="&lt;p&gt;I have a DS-CDMA system and the chip width is fixed but every user have a different spreading code length. I want to have a simulation of signal to interference noise ratio (SINR) VS. bit error rate (BER). If I assumed that SINR is given like -25:0 dB. How can I calculate noise power (it is thermal noise)  and the interference power?&lt;/p&gt;&#xA;" OwnerUserId="4854" LastActivityDate="2013-08-05T06:54:05.513" Title="simulation with SINR" Tags="|matlab|snr|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10203" PostTypeId="2" ParentId="10202" CreationDate="2013-08-05T06:54:05.513" Score="1" Body="&lt;p&gt;The SINR characteristics of a DSSS Multiuser Communication are very difficult to approximate theoretically. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For the Downlink at least, it is easy enough to characterize it with lesser parameters, but still difficult to obtain any particular derivation. It depends heavily upon the Spreading Sequences(their auto-correlations and cross-correlations), symbols of the interfering users(their average Energy) and so on. As a very decent approximation, $SINR$ is usually computed using random spreading sequences assumption. According to Andreas Goldsmith's textbook &quot;Wireless Communications&quot;, for a $K$-user system with $N$ chips per symbol, the $SINR$(assuming Random signal transmissions for every user, again a probabilistic assumption) is given by $SINR = (\frac{N_{o}}{E_{s}}+\frac{K-1}{G})^{-1}$ where $G=N$ approximately.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For the Uplink it is even more a difficult task to analyze this. If all users' signals are received with the same power($AWGN$), it can be shown that for those Asynchronous users assuming Random Spreading codes with $N$ Chips per symbol, random start times and random carrier phases, $SINR = (\frac{K-1}{3N}+\frac{N_{0}}{E_{s}})^{-1}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For simple simulations, usually people assume that the $SINR$ can be calculated as, $SINR = \frac{E_{s}}{N_{0}+\sum_{i=1}^{K-1}\frac{E_{si}}{G}}$ where G is the processing gain which can be roughly taken to be as $K$. This factor of $G$ applies if the codes are perfectly orthogonal and its approximation to $N$ is usually justified assuming the properties of Spreading codes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all the above formulae, $N_{0}$ is the Noise Power which is equal to $2*\sigma^{2}$&#xA;for 2-Dimensional Signalling and $E_{s}$ is the average Received Energy of the signal. You can refer to Goldsmith if you to learn any further on the math behind it all. Now you can straight away plugin your numerical value on the LHS of the expressions that are stated above and you can go about calculating the Thermal Noise Power since you know the Received Powers $E_{s}$ for every user's signal. And all these formulae are for $AWGN$ conditions. The difficulty comes from the fact that Interferers cannot be approximated as Random Gaussian Noise. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-08-05T06:54:05.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10204" PostTypeId="1" AcceptedAnswerId="10210" CreationDate="2013-08-05T11:05:32.323" Score="9" ViewCount="19842" Body="&lt;p&gt;I read that an &quot;improper system&quot; &lt;a href=&quot;http://csd.newcastle.edu.au/chapters/chapter4.html&quot; rel=&quot;noreferrer&quot;&gt;&quot;has more zeros than poles; it is not causal, cannot be implemented, has a strictly proper inverse and has infinite high-frequency gain.&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does causality fail due to instant signal change? I try to make up a recurrence, where $x_n$ depends on both $x_{n-1}$ as well as $x_{n+1}$ but they all can be interpreted as $x_{n+1}$ dependence on $x_{n}$ and $x_{n-1}$ and, thus, are causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it related with solving recurrent relations saying that P(x) in generating function $f(x) = f_0 + f_1 x + f_2 x^2 + \cdots = P(x)/R(x) \ \ \ \ \ $ must have degree less than R(x) as Miguel A. &lt;a href=&quot;http://www.math.northwestern.edu/~mlerma/problem_solving/results/gen_func.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lerma says&lt;/a&gt; in Generating function of Linear Homogenous Recurrence. Here, $R(x) = 1 + r_1 x^1 + r_2 x^2 + \cdots$ is a reciprocal of the characteristic polynomial of our recurrence $x_n + c_1 x_{n+1} + \cdots = 0.$ This indeed seems to happen whenever which R(x) I try. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Existence_Z_Transform.html&quot; rel=&quot;noreferrer&quot;&gt;https://ccrma.stanford.edu/~jos/fp/Existence_Z_Transform.html&lt;/a&gt; seem to identify causality with pole values (if your pole &gt; 1 then series does not converge, which means anticausality) rather than their number and &lt;a href=&quot;https://math.stackexchange.com/a/881232/39930&quot;&gt;others&lt;/a&gt; say that causality is $x_n = 0$ for all $n &amp;lt; 0.$ I do not see how this is related with poles/zeros ratio and my guess that &lt;code&gt;poles &amp;gt; zeroes = causality&lt;/code&gt; may be wrong. I have asked to relate various kinds of causality &lt;a href=&quot;https://math.stackexchange.com/questions/883646&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2023-04-12T03:01:56.160" Title="Why more poles than zeroes?" Tags="|transfer-function|zeros|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10206" PostTypeId="2" ParentId="10196" CreationDate="2013-08-05T16:30:10.530" Score="10" Body="&lt;p&gt;Remember that Wavelet Transforms are nothing but &lt;em&gt;time-localized&lt;/em&gt; filtering/correlation operations. The wavelet transforms provide a unified framework for getting around the &lt;a href=&quot;http://en.wikipedia.org/wiki/Uncertainty_principle&quot; rel=&quot;noreferrer&quot;&gt;Heisenberg Uncertainly Principle&lt;/a&gt; that the Fourier Transform suffers from. So when you ask &quot;what should my settings be for bandwidth, and center frequency&quot;, you are asking for &lt;em&gt;filter parameters&lt;/em&gt; to be given to you. No one can give you filter parameters but yourself, and your application. This is why they are parameters. :-) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More concretely, how to pick your $F_c$ and $F_b$ have to do with the nature of your signal. First, some pre-liminaries:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelet Transforms are nothing but matched filters that you construct, such that you have the best match to the 'features' in your signal of interest. One set of 'features' that you might consider would be the neighbourhood of center frequency, and the neighbourhood of bandwidth. Again, &lt;em&gt;no one can pick those for you&lt;/em&gt;, because you need to know what you are looking for. However, you can pick a range commensurate with what you expect. (This is actually one of features that make Wavelet Transforms very powerful).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The morlet wavelet is given by the following function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Psi(t,f_c,T_p) = \frac{1}{\sqrt{\pi T_p}} \ e^{\frac{-t^2}{T_p}} \ e^{-j2 \pi f_ct}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $t$ is the time index in seconds, $f_c$ is your center frequency, and $T_p$ represents what I have called a &quot;Period Parameter&quot;. Inspect the above equation. Notice how the morlet wavelet is in fact nothing but a complex exponential centered at frequency $f_c$, windowed by a zero-mean gaussian function, with $\sigma = \sqrt{\frac{T_p}{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, to answer your first question, the $F_c$ parameter, must be chosen such that it is at or near the frequency you wish to interrogate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the wavelet bandwidth: What I have called $T_p$ here is your &quot;Period Parameter&quot;, and this is directly related to your bandwidth. Go back to the Morlet Wavelet equation, and consider a scenario where instead of a gaussian window, we used a rectangular window. In the Fourier Domain, we attain a sinc function due to this type of window, and we can say that the Null-To-Null Bandwidth, $B$, is simply: $B = \frac{2}{T_{period}}$, (in the passband).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figure below illustrates this for a complex exponential located at $f_c = 2$ Hz, with varying $T_{period}$ values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/64lLj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can clearly see that as the period extent is increased, the bandwidth decreases. This is the inverse nature of the time-frequency relationship. If you wanted to use this pseudo-wavelet, what would you pick the $T_{period}$ to be? The answer would be &quot;Whatever $T_{period}$ my signal-of-interest hangs around at&quot;. In fact, this is &lt;em&gt;exactly&lt;/em&gt; what is done in the Short-Time-Fourier-Transform, (STFT), although one would pick a smarter window instead of the boxcar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let us re-inspect the Morlet Wavelet Equation, and re-insert the gaussian windowing function, with $\sigma = \sqrt{\frac{T_p}{2}}$. If we do this, we get the following time-domain plots, and the corresponding Discrete Fourier Transform (DFT)s of the Morlet Wavelets:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LBmyg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once again, notice how as the extent - as the variance of the gaussian window shading the complex exponential increases, the bandwidth in the Fourier Domain decreases. (In this case, we have much nicer side-lobe behavior, but this is tangential). In any case, You can once again see how we have an &lt;em&gt;inverse&lt;/em&gt; relationship between the $T_p$ parameter, (or the standard deviation parameter of your gaussian, whichever suits you), and the bandwidth of the corresponding filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What to do with this knowledge: Now you understand how bandwidth is related to the gaussian shading function embedded within the Morlet Wavelet. Thus, for any signal $x[n]$ you have, you may simply take the DFT of your signal, and observe its bandwidths at various center frequencies. Then, adjust the $\sigma$ and $f_c$ parameters of your Morlet Wavelet accordingly, such that the DFT function of the Morlet filter directly overlaps the DFT function of your template signal. This is how you can set your parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code to generate the above plots is here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;fS = 500;&#xA;tStart = -4;&#xA;tStop = 4;&#xA;timeVector = linspace(tStart,tStop, (tStop-tStart)*fS );&#xA;fCenter = 2;&#xA;tP = [0.2 1 3];&#xA;exps = length(tP);&#xA;&#xA;figure(1); clf(1);&#xA;figure(2); clf(2);&#xA;for ii = 1:exps&#xA;&#xA;    tPeriod = tP(ii);&#xA;    timeMask = zeros(1,length(timeVector));&#xA;    timeMask((timeVector &amp;gt;= -tPeriod/2) &amp;amp; (timeVector &amp;lt;= tPeriod/2)) = 1;&#xA;&#xA;    psiFakeWavelet = exp(2*1i*pi*fCenter.*timeVector).*timeMask;&#xA;    psiWavelet = ((pi*tP(ii))^(-0.5)).*exp(2*1i*pi*fCenter.*timeVector).*exp(-timeVector.^2/tP(ii));&#xA;&#xA;    %Demonstrating the Rectangular Window&#xA;    figure(1);&#xA;    subplot(3,2,2*ii-1);&#xA;    plot(timeVector,real(psiFakeWavelet), timeVector,imag(psiFakeWavelet));&#xA;    ylim([-1.2 1.2])&#xA;    xlabel('Time / Seconds');&#xA;    title(sprintf('Morlet Wavelet, T_{period} = %2.2f, f_c = %2.2f Hz', tPeriod, fCenter));&#xA;&#xA;    input = psiFakeWavelet;&#xA;    Nfft = 10 * 2^nextpow2(length(input));&#xA;    psd = 20.*log10(fftshift(abs(fft(input,Nfft))));&#xA;    freqs = [0:Nfft - 1].*(fS/Nfft);&#xA;    freqs(freqs &amp;gt;= fS/2) = freqs(freqs &amp;gt;= fS/2) - fS;&#xA;    freqs = fftshift(freqs);&#xA;    figure(1);&#xA;    subplot(exps,2,2*ii);&#xA;    plot(freqs, psd); &#xA;    xlim([-10  15]);&#xA;    xlabel('Frequency / Hz');&#xA;    title (sprintf('PSD, Null-Null-BW = %2.2f Hz', 2/tPeriod));&#xA;&#xA;    %Demonstrating the Morlet Wavelet&#xA;    figure(2);&#xA;    subplot(3,2,2*ii-1);&#xA;    plot(timeVector,real(psiWavelet), timeVector,imag(psiWavelet));&#xA;    ylim([-1.2 1.2])&#xA;    xlabel('Time / Seconds');&#xA;    title(sprintf('Morlet Wavelet, T_{period} = %2.2f, f_c = %2.2f Hz', tPeriod, fCenter));&#xA;&#xA;    input = psiWavelet;&#xA;    Nfft = 10 * 2^nextpow2(length(input));&#xA;    psd = 20.*log10(fftshift(abs(fft(input,Nfft))));&#xA;    freqs = [0:Nfft - 1].*(fS/Nfft);&#xA;    freqs(freqs &amp;gt;= fS/2) = freqs(freqs &amp;gt;= fS/2) - fS;&#xA;    freqs = fftshift(freqs);&#xA;    figure(2);&#xA;    subplot(exps,2,2*ii);&#xA;    plot(freqs, psd); &#xA;    xlim([-10  15]);&#xA;    xlabel('Frequency / Hz');&#xA;    title ('Wavelet PSD');&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-09-08T00:01:46.463" LastActivityDate="2013-09-08T00:01:46.463" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="10207" PostTypeId="1" CreationDate="2013-08-05T16:38:57.570" Score="3" ViewCount="142" Body="&lt;p&gt;I have data from a LIDAR unit that I would like to get the spectral density of. Unfortunately, the only thing I remember from my Fourier analysis class are the methods that I know will not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data comes from a 1D LIDAR scan of a (mostly flat) surface, which returns radial distance at evenly spaced $d\theta$'s. I can convert this data to x-y data which looks distinct depending on the type of surface (e.g. grass looks a lot choppier than concrete). I think Fourier analysis would be a good way to distinguish between the different types. Unfortunately the data has some problems that makes it difficult to analyze:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It is unevenly spaced in x.&lt;/li&gt;&#xA;&lt;li&gt;It has some missing values.&lt;/li&gt;&#xA;&lt;li&gt;It is not strictly a function in x (if there is some overhang, an earlier part of the sweep might hit under the overhang to get a distant x value, and a later part could strike the overhang, to get a closer value.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It has occurred to me to do a Fourier analysis on the original $r-\theta$ data, but since I am concerned with the deviations around perfectly flat ground, I am not sure how I could use it.&lt;/p&gt;&#xA;" OwnerUserId="5173" LastEditorUserId="29" LastEditDate="2013-08-06T16:24:35.300" LastActivityDate="2013-08-13T21:40:55.337" Title="Right algorithm for fourier transform on physical heights" Tags="|fourier-transform|signal-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10208" PostTypeId="2" ParentId="8437" CreationDate="2013-08-05T17:37:51.523" Score="3" Body="&lt;p&gt;I have eventually found a simple idea for the solution on the paper called &quot;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.10.8109&quot; rel=&quot;nofollow&quot;&gt;Blending Images for Texturing 3D Models&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is not doing the complete blending for each new image added to canvas, but rather build separate lowpass and highpass canvas (for two-band blending). These are then merged as a final step of the rendering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding seam is still a bit tricky and not used in the paper. It requires reprojecting data from canvas to image, computing the seam and then projecting the blending mask to the canvas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method described in the paper is simple and does not leave any blending artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only drawback is that more data have to be kept in memory.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This solution does not work if the rendered canvas is smaller than original image. Furthermore gradient-domain blending is not easily applicable as well.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2013-10-05T22:55:51.057" LastActivityDate="2013-10-05T22:55:51.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10209" PostTypeId="1" CreationDate="2013-08-05T19:00:04.533" Score="2" ViewCount="761" Body="&lt;p&gt;I know that to downsample by a factor of 2.5x one can upsample a signal by a factor of 2 and downsample by a factor of 5. I am wondering what is the best and more efficient way of downsampling by a factor of 2.5x?&lt;/p&gt;&#xA;" OwnerUserId="1636" LastActivityDate="2013-08-05T19:00:04.533" Title="Most efficient way to downsample a signal by a factor of 2.5x" Tags="|downsampling|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10210" PostTypeId="2" ParentId="10204" CreationDate="2013-08-05T20:37:27.713" Score="2" Body="&lt;p&gt;I think the system is always non-causal if it has more zeros than poles. @Hilmar, your implementation might be possible digitally but if you see a transfer function like this:&#xA;$H(z) = \frac{(z-1)(z-2)}{(z-3)}$, taking the inverse Z-Transform,&#xA;$y(n-1)-3y(n-2) = x(n)-3x(n-1)+2x(n-2)$ is clearly non-causal and cannot be implemented real-time(of course you can store the signals and do processing offline, but real time implementation is impossible). So I guess Non-Causality is the answer, apart from the infinite high-frequency gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update by Val&lt;/strong&gt;&#xA;Ok, I understand now. In wikipedia, we see that $$a_0 y_n + a_1 y_{n-1} + a_2 y_{n-2} + \cdots = b_0 + b_1 x_{n-1} + b_2 x_{n-2} + \cdots$$ is identical to $$H(z) = {b_0 + b_1 z^{-1} + b_2 z^{-2} + \cdots \over a_0 z^{0} + a_1 z^{-1} +\cdots}.$$ I have finally noted that there are no positive powers. That is, $a_0$ corresponds to the current output, $z^0 = y[n]$, and $\cdots = a_{-2} = a_{-1} = \mathbf{0} = b_{-1} = b_{-2} = \cdots$. If we had more zeroes then we have more power in the nominator and, after normalizing $H(z)$ so that $a_0$ has $z^0$, we still have a positive power of z in the nominator, which means that output depends on future input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the simplest case, $Y(z) = zX(z)-x_0$ corresponds to $y[i] = x[i+1]$, that is output depends on future input (we can also drop $x_0$ assuming our sequences are &lt;a href=&quot;https://math.stackexchange.com/a/881232/39930&quot;&gt;causal&lt;/a&gt;, i.e. $0 = y_{-1} = x_0$ aka $z^{-1}Y = X$ or $Y = zX$). It is curious that causal is an example of non-causal. Could anybody clarify it further?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also worth noting that $(1-az^{-1})(1-bz^{-1})$ is not a zero of order two. It has equal number of zeroes and poles, since it is equal to $(z-a)(z-b)\over z^2.$&lt;/p&gt;&#xA;" OwnerUserId="5102" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2014-07-31T13:53:30.337" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10211" PostTypeId="2" ParentId="10207" CreationDate="2013-08-05T22:41:43.063" Score="5" Body="&lt;p&gt;Your question seems to have a couple of nested issues: First off, the computation of the Power-Spectral-Density is as straight forward as the computation of the signals' &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Discrete Fourier Transform&lt;/a&gt;, (DFT), followed by its absolute magnitude squared. The computation of the $O(N^2)$ DFT is accomplished very efficiently using the $O(NlogN)$ &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;FFT&lt;/a&gt; algorithm, that comes in canned form from many different libraries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if $x[n]$ is your original domain signal, (sampled in space, time, or whatever other quantity), the PSD is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;PSD[k] = |\sum_{n=o}^{N-1} x[n] \ e^{\frac{-j \ 2 \pi n k}{N}}|^2 = |X[k]|^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Where $X[k]$ is the Discrete Fourier Transform (DFT) of $x[n]$). (Also note, the above formula is for same-length DFTs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second aspect of your quandary seems to rest on:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What domain to best represent your orignal &lt;a href=&quot;http://en.wikipedia.org/wiki/Lidar&quot; rel=&quot;nofollow&quot;&gt;LIDAR&lt;/a&gt; measurements in.&lt;/li&gt;&#xA;&lt;li&gt;How to deal with non-evenly spaced samples.&lt;/li&gt;&#xA;&lt;li&gt;How to deal with missing samples.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding (1):&lt;/strong&gt; I do not see why you cannot retain the data in its original $r - d \theta$ form. You are after all after radial distance per spatial sample, and this is exactly what LIDARs do for you. You want to then use the DFT as a transformation that will ostensibly magnify and separate different surfaces for you, by virtue of the repetitiveness in the spatial domain, corresponding to particular deltas in the Fourier domain. (Grass with high spatial repetitivity, VS concrete with low repetitivity). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding (2) &amp;amp; (3):&lt;/strong&gt; Both those problems can easily be solved using linear regression, and/or interpolation, whichever one suits your fancy. That is, you would collect all your $r- d \theta$ data, replete with missing samples and non-even ones. What you seek however is a uniformly spaced sampling on a $d \theta$ grid. You can do a simple polynomial fit via &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_least_squares_%28mathematics%29&quot; rel=&quot;nofollow&quot;&gt;Least-Squares-Estimation&lt;/a&gt;, (LSE). That is, your objective will be to decipher the co-efficients of a best-fit polynomial (of degree constrained by the LIDAR physics and spatial bandwidth of the target surface), that best fits your data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let $d \theta$ be the LIDAR independent variable. You have elected to use a degree-2 polynomial ($D = 2$) to best fit your data in the Least Squared (LS) sense. You have collected a bunch of points from your LIDAR, at some given $d \theta$'s and corresponding radial distances $r$. You would like to find the co-efficients $p_i$, that give you the line of best fit. That is, you would like to find the $p_i$'s in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;r = p_0 + p_1 \ (d \theta) + p_2 \ (d \theta)^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus let $\bf{r}$ be a $1$ x $N$ vector of recorded radial distances to the scanned surface. Let $\boldsymbol{d \Theta}$ be a $(D+1)$ x $N$ data matrix, such that the first row is all $1$s, the second row is composed of each $d \theta$ for each value of $n$, the third row is composed of each $(d \theta)^2$ for each value of $n$, etc. $N$ of course, is the total number of data points from the LIDAR scan of the surface. Finally, let $\bf{p}$ be the $(D+1)$ x $1$ vector of co-efficients to be solved for. Then, the LSE solution is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\bf{p} = (\boldsymbol{d \Theta} \ \boldsymbol{d \Theta}^T)^{-1} \boldsymbol{d \Theta} \ \bf{r}^T &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the coefficient vector $\bf{p}$ in hand, you can now go back and solve for $r$'s at any $d \theta$ grid. That is, simply construct a uniformly spaced $d \theta$ grid, and solve for corresponding $r$'s. Then, you will be ready to transform this regressed result into the Fourier domain, and look for characteristic spatial periodicity corresponding to different materials. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-08-13T21:40:55.337" LastActivityDate="2013-08-13T21:40:55.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10212" PostTypeId="2" ParentId="10204" CreationDate="2013-08-05T22:48:50.693" Score="1" Body="&lt;p&gt;In a causal discrete time system, the poles delay the impulse response so that no future samples are required.  If you don't have enough poles, you may instead need a time machine (or do processing offline or with a &quot;hidden&quot; delay).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the phase represented by walking CCW around a pole well inside the unit circle is about one sample time delay.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-05T22:55:11.417" LastActivityDate="2013-08-05T22:55:11.417" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10215" PostTypeId="2" ParentId="10199" CreationDate="2013-08-06T13:06:48.393" Score="1" Body="&lt;p&gt;You have to write your own method to generate the root raised cosine pulse shape. This link might help you: &lt;a href=&quot;http://en.wikipedia.org/wiki/Raised-cosine_filter&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Raised-cosine_filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you have to select the parameters for creating one pulse shape and then you can create pulse stream for your base band signal.&lt;/p&gt;&#xA;" OwnerUserId="5068" LastActivityDate="2013-08-06T13:06:48.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10216" PostTypeId="2" ParentId="10193" CreationDate="2013-08-06T15:29:06.483" Score="2" Body="&lt;p&gt;There are many ways to estimate the instant of glottal closure (GCI).  &lt;a href=&quot;https://web.archive.org/web/20170622133334/tcts.fpms.ac.be/~drugman/files/TASLP-GCI.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here (PDF link)&lt;/a&gt; is a recent journal article that reviews many of them.  The freely-available &lt;a href=&quot;http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;VOICEBOX toolbox&lt;/a&gt; for Matlab includes a couple GCI estimation techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For most approaches, the fundamental idea is the same: the speech signal is can be viewed as an excitation signal resonating an all-pole filter, and the location of the excitation instants is the instant of glottal closure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple GCI estimation algorithm might work like this.  The all-pole filter (encapsulating the contributions of the vocal tract and glottal source) can be estimated using linear prediction.  Inverse filtering the speech signal with this (time-varying) filter will give the linear predictive residual signal, which is an estimate of the excitation signal.  For normal voices, this signal will look like a noise impulse train.  Peak-picking this signal will give good results for these voices during sustained vowels.  Voice offsets and onsets will be more troublesome, as well as voices that are very breathy or irregular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(A quick note about your figure: the signal marked as the residual seems to include glottal source signal, and so it not a linear prediction residual in the same sense as what I refer to in the above.)&lt;/p&gt;&#xA;" OwnerUserId="4391" LastEditorUserId="-1" LastEditDate="2020-03-15T20:55:58.713" LastActivityDate="2020-03-15T20:55:58.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10219" PostTypeId="1" CreationDate="2013-08-06T23:48:55.360" Score="3" ViewCount="631" Body="&lt;p&gt;I have a few questions regarding the implementation of Bark scale filter banks for the calculation of bark frequency cepstral coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Which filter shape is most commonly used and why?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Triangular band pass similar to the mfcc's as seen here:- &lt;a href=&quot;https://maxwell.ict.griffith.edu.au/spl/publications/papers/merc03_ben.pdf&quot; rel=&quot;nofollow&quot;&gt;A Comparative Study of Filter Bank Spacing for&#xA;Speech Recognition&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Trapazoidal type shape as seen here:- &lt;a href=&quot;http://homepages.engineering.auckland.ac.nz/~wabd002/Technical%20Reports/Technical%20Report%20621_Octavian.pdf&quot; rel=&quot;nofollow&quot;&gt;Performance Evaluation of Front-end &#xA;Processing for Speech Recognition &#xA;Systems&lt;/a&gt; and here:- &lt;a href=&quot;http://www.ece.gatech.edu/research/labs/asat/slides/meet-111204/Auditory-lrr.pdf&quot; rel=&quot;nofollow&quot;&gt;Auditory Models for Speech &#xA;Analysis&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;4th order elliptical bandpass filters used by the &lt;a href=&quot;https://www.jyu.fi/hum/laitokset/musiikki/en/research/coe/materials/mirtoolbox/MIRtoolbox1.4.1Guide&quot; rel=&quot;nofollow&quot;&gt;Mir toolbox&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;2) How should the filters be laid out?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;No overlap with centre frequencies 1 bark apart?&lt;/li&gt;&#xA;&lt;li&gt;Half a bark overlap and a length of 1 bark?&lt;/li&gt;&#xA;&lt;li&gt;Linearly divided on the bark scale between a predefined frequency range and number of filters? If so how is a suitable number of filters chosen e.g. 40Hz to fs/2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help provided, I've become pretty confused from reading the literature &lt;/p&gt;&#xA;" OwnerUserId="3296" LastActivityDate="2013-08-06T23:48:55.360" Title="Questions about Bark scale filter bank implementation for bfcc's" Tags="|music|mfcc|cepstral-analysis|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10220" PostTypeId="1" CreationDate="2013-08-07T05:58:16.183" Score="2" ViewCount="1123" Body="&lt;p&gt;I know that the Complementary Filter has the functions of both LPF and HPF. But I think my understanding on the principal behind it is still unclear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am quite new on digital signal processing, and maybe some very fundamental explanations will help a lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have a Complementary Filter as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y =a\times y+(1-a)\times x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then my parameter $a$ may be calculated by $$a=\frac{time\ constant}{time\ constant+sample\ period}$$&#xA;where the $sample\ period$ is simply the reciprocal of the $sampling\ frequency$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $time\ constant$ seems to be at my own choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the theory behind this calculation?&lt;/li&gt;&#xA;&lt;li&gt;How do we choose the $time\ constant$ properly?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4677" LastActivityDate="2013-09-04T09:07:14.993" Title="How to determine the parameter of a Complementary Filter?" Tags="|filters|lowpass-filter|highpass-filter|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10221" PostTypeId="1" AcceptedAnswerId="10226" CreationDate="2013-08-07T11:43:15.527" Score="3" ViewCount="5686" Body="&lt;p&gt;This is my first question at this site, please excuse me if I'm not asking the question properly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an acoustic signal of a test and I want to remove the &quot;thin&quot; peaks, because they don't really affect the structure that I'm studying. For that I've thought of a Low pass filter in order to retain only frequencies below 300 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to count the peaks of the filtered signal above 3 sigma (Standard Deviation).&#xA;I'm programming in C# and I don't know if there is a direct (and simpler way) of doing this but what I'm doing now is&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Discrete Fourier Transform to my signal (SPL/s -&gt; SPL/Hz)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;rescale what I obtain (bins = sampling frequency)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Cut frequencies above 300 Hz&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Inverse DFT&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It seems logical to me but I'm not sure if I'm doing it correctly. &#xA;I have this little problem while doing the FT, is that I don't know how to scale properly the magnitude axis (y): if I transform and then I do the inverse transform I don't get the original signal but an attenuated one. What's happening here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And my other question is about the symmetric nature of a FT. If I do a Fourier Transform to my signal I get a mirrored spectrum that goes till 8000 Hz, can I simply cut at my desired frequency (is what I'm doing now)? Thanks for your time.&lt;/p&gt;&#xA;" OwnerUserId="5160" LastActivityDate="2013-08-07T23:15:30.960" Title="Low pass filter with DFT" Tags="|fft|lowpass-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10222" PostTypeId="1" AcceptedAnswerId="10225" CreationDate="2013-08-07T12:11:58.113" Score="4" ViewCount="4343" Body="&lt;p&gt;I'm trying to decode a &lt;a href=&quot;http://en.wikipedia.org/wiki/Hamming_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamming Block Code&lt;/a&gt; transmitted using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase-shift_keying#Quadrature_phase-shift_keying_.28QPSK.29&quot; rel=&quot;nofollow noreferrer&quot;&gt;QPSK modulation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the moment I can sucessfully decode it using hard decision but in order to improve performance I'd like to use soft decision. I've read some online courses about the &lt;a href=&quot;http://en.wikipedia.org/wiki/Viterbi_decoder&quot; rel=&quot;nofollow noreferrer&quot;&gt;Viterbi decoder&lt;/a&gt; and I think I understand how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is that I'm not sure of how to go from a QPSK symbol to a soft-bit pair. I've tried looking around to find some information about this precise step but couldn't find anything of interest. Thus I'd like to know if what I'm doing is right or wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also mention that I use the constellation &lt;code&gt;[1 i -1 -i]&lt;/code&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Gray_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gray encoding&lt;/a&gt; so the hard decision patern is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RQLuK.png&quot; alt=&quot;Symbol to bit pair pattern for hard decision&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that the two soft bits should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$b_0=real(IQ(t_i)*e^{3i\pi/8}$$&#xA;$$b_1=-imag(IQ(t_i)*e^{3i\pi/8}$$&#xA;With b0 being the left bit and b1 the right bit. For instance:&#xA;$$01:b_0=0, b_1=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any confirmation or contradiction would be really appreciated as it could help me to move on. Also if you have any good source on the subject I'll take them too!&lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2013-08-07T14:40:57.967" Title="QPSK soft decoding" Tags="|discrete-signals|algorithms|qpsk|forward-error-correction|viterbi-algorithm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10223" PostTypeId="2" ParentId="10221" CreationDate="2013-08-07T12:32:39.803" Score="2" Body="&lt;p&gt;Is there any specific reason as to why you implement your low-pass filter using an FFT? Unless you have some good reasons for doing the FFT direct filtering will be easier for you I think. I also believe it will be significantly more efficient computationally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regards to your FFT-&gt;iFFF scaling issue, can't you see if it is a fixed scaling that is not accounted for? If this is not the case it might be an issue with the way you provide your arguments to the FFT or some other issue that is hard to figure out unless you provide example code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also an issue with the way you implement the low-pass filter. You can't just zero out the bins and do an inverse IFFT. Maybe it will work for you but your output is time-aliased (your circular convolution wraps around).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway much more info on how you to the FFT filtering would help in providing more useful feedback.&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-08-07T12:32:39.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10224" PostTypeId="1" AcceptedAnswerId="10232" CreationDate="2013-08-07T12:42:27.510" Score="2" ViewCount="2312" Body="&lt;p&gt;From a book, I learned that image interpolation (or upsampling) can be written as a convolution like this:&#xA;$$g(i,j) = \sum_{(x,y)}f(x,y)h(i-rx,j-ry)$$&#xA;while $r$ is the upsampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have a time understanding this formula, since AFAIK, the basic idea of image interpolation is to bring near-by pixels into consideration, so I thought a convolution like below might suffice:&#xA;$$g(i,j) = \sum_{(x,y)}f(x,y)h(i-x,j-y)$$&#xA;What is the point of $r$ in the formula?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="128" LastEditDate="2019-06-24T08:52:35.963" LastActivityDate="2019-06-24T08:52:35.963" Title="Convolution Based Image Interpolation" Tags="|image-processing|convolution|interpolation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10225" PostTypeId="2" ParentId="10222" CreationDate="2013-08-07T14:40:57.967" Score="7" Body="&lt;p&gt;Unfortunately you did not mention what your channel is so I assume that merely AWGN is present. Furthermore I assume symbol-by-symbol detection is desired since a decoder for the Hammingcode is following later. So a single symbol $x$ is received as $y = x + n$ where $x \in [1,j,-j,-1]$ and $n$ is distributed according to a zero-mean complex normal distribution, i.e. $n \to CN(0, \sigma_n^2)$ so that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;p(n) = \frac{1}{\pi \sigma_n^2} \exp\left(-\frac{n n^*}{\sigma_n^2} \right)&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know the conditional density $p(y|x)$ of the received symbol $y$ if the transmitted symbol $x$ is known. It is a non zero-mean complex normal distribution, i.e. $(y|x) \to CN(x, \sigma_n^2)$ and:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;p(y|x) = \frac{1}{\pi \sigma_n^2} \exp\left(-\frac{(y-x) (y-x)^*}{\sigma_n^2} \right)&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we know $y$ and want to know the likelihood of $x$, so we utilize the bayes theorem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;p(x|y) = \frac{p(y|x) \cdot p(x)}{p(y)}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p(y|x)$ is already given above, $p(x)$ is the prior density of your transmit symbols. Often the systems are designed so that all symbols have equal probability so that $p(x) = \frac{1}{N_s}$ with $N_s$ being the amount of symbols in your alphabet. It is 0.25 in your case. Ignore $p(y)$ for the moment, it will cancel out later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a softbit is usually defined in terms of it's log-likelihood, so that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;l_0 = \log \frac{p(b_0=0|y)}{p(b_0=1|y)}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logarithm is mainly used since the calculations become more numerically stable since very often the probabilities will be either very close to zero or very close to one and quickly reach the precision limits of floating point processors, especially when multiplying many of those probabilities together. So now how can we express $p(b_0=0|y)$ in terms of $p(x_k|y)$? Assume the following bit mapping (use your own here):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b0 b1 -&amp;gt; x&#xA; 0  0 -&amp;gt; 1&#xA; 0  1 -&amp;gt; j&#xA; 1  1 -&amp;gt; -1&#xA; 1  0 -&amp;gt; -j&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So we can see that for example $b_0=0$ if the transmitted symbol was a $1$ or a $j$ and hence:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;p(b_0=0|y) = p(x=1|y) + p(x=j|y)&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and similar for $p(b_0=1|y)$. So the final softbit value for $l_0$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;l_0 = \log \frac{p(x=1|y) + p(x=j|y)}{p(x=-1|y) + p(x=-j|y)}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the bayes theorem under the assumption that the prior $p(x)$ is equal for all symbols, we finally get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;l_0 = \log \frac{p(y|x=1) + p(y|x=j)}{p(y|x=-1) + p(y|x=-j)}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be calculated using the definition of $p(y|x)$ given above. Similarly the softbit for $l_1$ can be calculated. The softbit will be positive if the bit is more likely to be zero and negative if it is more likely to be one. So you can get a hard decision just by looking at its sign. The magnitude of the log-likelihood corresponds to how much is known about the bit. If it is large, the bit is likely to be a zero or one. If it is close to zero, there is a higher chance the bit is wrong. If it is exactly zero, nothing is known about the bits value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lots of optimizations can be utilized to make this code run very fast but this would be a little much for an answer here.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-08-07T14:40:57.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10226" PostTypeId="2" ParentId="10221" CreationDate="2013-08-07T15:19:25.870" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I have an acoustic signal of a test and I want to remove the &quot;thin&quot;&#xA;  peaks, because they don't really affect the structure that I'm&#xA;  studying. For that I've thought of a Low pass filter in order to&#xA;  retain only frequencies below 300 Hz.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If this is accurate, that is, you have an acoustic signal that exists from baseband to 300 Hz, then yes, what you want to do is a digital low-pass filtering operation to retain all energy below 300 Hz, and discard energies above that. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My aim is to count the peaks of the filtered signal above 3 sigma&#xA;  (Standard Deviation). I'm programming in C# and I don't know if there&#xA;  is a direct (and simpler way) of doing this but what I'm doing now is&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your intuition is correct - you want to remove frequencies below 300 Hz, so naturally you think to transform your signal into the Fourier domain, clobber unwanted frequencies, and then transform back. There are some issues with this method:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Firstly, this method is taboo in the DSP community, (and for decent reasons), although there are cases where you can get away with it, depending on your application. Some background: Nulling out unwanted co-efficients in a transform domain and inverse transforming back into the original domain is used in denoising especially in wavelets, and it also makes intuitive sense, (and correctly so). The problem with doing this in the Fourier domain is that the basis function of the DFT are &lt;em&gt;global&lt;/em&gt;, and not local like they are in wavelets. In other words, you can clobber our wavelet co-efficients and affect only local areas in your signal (ie, small parts of your signal) - but doing so in the Fourier domain affects &lt;em&gt;all&lt;/em&gt; your signal. &lt;/li&gt;&#xA;&lt;li&gt;Expanding on the above background, when you &quot;boxcar&quot; your frequency domain, (ie, mask it with 1s and 0s that either allow or disallow certain frequencies), this is the same as convolving your time-domain signal with a sinc function, that carries on forever. This is why simply culling out unwanted frequencies - while acceptable in some applications - will introduce 'ringing/smearing' in the time domain. &lt;/li&gt;&#xA;&lt;li&gt;Instead what is usually done, is that people create filters (masks in the frequency domain that are not sharp 1s and 0s, but more graceful), such that their equivalent transform back into the time-domain does not have the effective infinite extent of sinc function, (that is, the decay of the sidelobes is much faster than that of a sinc). This then provides a nice trade-off between removing unwanted frequencies, and not having to pay the price of extreme ringing/smearing in the time domain.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Armed with this task at hand, what you need to do is the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a digital low pass filter in some other software such as MATLAB or Python. You can create a simple FIR filter for your purposes. (Do not use an IIR because you are working with an audio application and default IIR filters will warp your phase, but thats another story). When you make your filter, you will simply have a vector of numbers, of a length you chose. The larger the length of the filter, the sharper the transitions in the frequency domain, but also the larger the delay, so this is a trade-off you can experiment with. At the end of the say though, you will $1$ by $N$ vector of numbers. This is your filter. Let us call it $h[n]$&lt;/li&gt;&#xA;&lt;li&gt;You have your audio signal, let us call that $s[n]$. The planets are not aligned, so most likely your audio signal is of a different length than your filter, and let us say it is of length $M$. So your signal $s[n]$ is simply a $1$ by $M$ vector of numbers.&lt;/li&gt;&#xA;&lt;li&gt;Your objective is to filter $s[n]$ by $h[n]$. There are a number of ways to do this. Since you already seem to have access to the FFT in C#, we will use the FFT method. In the FFT method, you want to multiply the Fourier transform of your filter, (call it $H(f)$), with the Fourier Transform of your signal, (call it $S(f)$). &lt;/li&gt;&#xA;&lt;li&gt;We doing a linear convolution, (as opposed to a circular one), but in the frequency domain, so we have to take extra care when it comes to FFT sizes. If you did the linear convolution in the time domain, the resulting filtered signal would be of length $N + M -1$. This is then the FFT size you need to use.&lt;/li&gt;&#xA;&lt;li&gt;You are almost done. All you need to do now is take the $N+M-1$ length FFT of your filter, $h[n]$. Take the $N+M-1$ length FFT of your signal, $s[n]$. Multiply them together. Then take the $N+M-1$ length IFFT of this element-by-element product, and viola, you have filtered your signal. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope this helped.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-08-07T23:15:30.960" LastActivityDate="2013-08-07T23:15:30.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10229" PostTypeId="1" AcceptedAnswerId="10230" CreationDate="2013-08-07T17:50:11.620" Score="3" ViewCount="117" Body="&lt;p&gt;I am attempting a project and I have been given bat calls (in .wav format) which are not ultra-sound navigation calls. I'm looking to isolate the different species of bats and monitor their activity.&lt;/p&gt;&#xA;&lt;p&gt;The problem I am having is that I do not have a prior training set to be able to feature matching on the samples to try and identify them. I have been doing part research and I have looked at the following &lt;a href=&quot;http://www.durhambats.org.uk/bat_calls.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; which gives details of the species of bats, their rep rate, FM/CF and Peak power.&lt;/p&gt;&#xA;&lt;p&gt;From the link above, I am assuming that I can have some kind of array which contains the species of the bats, as well as their frequency (range) or &amp;quot;Peak Power&amp;quot; and then using an FFT algorithm, convert the samples that I have obtained and then match the output of the FFT against the pre-set array and therefore enable a platform to monitor their activity.&lt;/p&gt;&#xA;&lt;p&gt;Here are the 2 questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Based on the above, does would this be an ideal solution in order to isolate the bats and therefore monitor their activity or would I need to implement further algorithms in order to isolate the bats calls?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have only ever had experience of using the Cooley-Tukey FFT algorithm. Would this be sufficient enough for this type of project?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="7092" LastEditDate="2022-03-23T04:43:57.673" LastActivityDate="2022-03-23T04:43:57.673" Title="Isolating bat species without prior training base" Tags="|fft|audio|wave|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10230" PostTypeId="2" ParentId="10229" CreationDate="2013-08-07T18:25:38.920" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Based on the above, does would this be an ideal solution in order&#xA;  to isolate the bats and therefore monitor their activity or would I&#xA;  need to implement further algorithms in order to isolate the bats&#xA;  calls?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The short answer is no, this would be no where near ideal. This type of work strongly overlaps with speech/voice recognition, and the algorithms (or more so, the features) involved are not trivial. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are certainly frequency features that one can extract from audio signals of species to try and cluster them, and the DFT would certainly be the transform of choice for this type of raw feature. However the DFT will only give you frequency scores, although it where one would start. Other frequency metrics and features can be more complex. (Look at cepstral analysis, MFCC, etc).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) I have only ever had experience of using the Cooley-Tukey FFT&#xA;  algorithm, would this be sufficient enough for this type of project?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Remember that the DFT is a Transform, whilst the FFT is an efficient algorithm for this transform. Furthermore, the Cooley-Tukey Algorithm is one way of implementing an FFT. In your work, you will use canned libraries that have the FFT. You don't need to implement an FFT in the 21st century, just as you would not be expected to implement the square root function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I strongly suspect that you will need to compute the &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Short-Time-Fourier-Transform&lt;/a&gt; (STFT) for this type of project. In anticipation of your next needs, please see the wiki link on the STFT, as well as this &lt;a href=&quot;https://dsp.stackexchange.com/questions/10062/when-should-i-calculate-psd-instead-of-plain-fft-magnitude-spectrum/10064#10064&quot;&gt;post here&lt;/a&gt;. The STFT allows you to analyse signals in the dual time-frequency domain. You will most likely want to start your feature extraction in that space.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;let's assume I have computed the STFT and the MFCC and extracted the&#xA;  features, how would I therefore identify the species of the bats?&#xA;  Would I therefore need some kind of training in order to complete this&#xA;  task?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Once you have decided on what sets of features you need to use, you will of course need a learning algorithm to discriminate them properly. Since you do not have a training set, there are two options. The first obvious is to attain a training set, and/or meticulously label your data based on what you know to be true. Once you have your labels, then you can use supervised training techniques like logistic regression or a simple perceptron to come up with separating hyperplanes in feature space that disjoint your data. The second option however, would be for you to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Unsupervised_learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;unsupervised learning techniques&lt;/a&gt; (such as K-means for example). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use something like K-means, you will need to know apriori how many different bat species you are trying to discriminate against. This is the value of your hyper-parameter $k$. The output of K-means will be $k$ vectors, each of them being in $N$-dimensional points in feature space, representing your cluster centroids. Now, every time you get a new audio sample, you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Compute $N$ features and place this into a feature vector.&lt;/li&gt;&#xA;&lt;li&gt;Compute the L2 vector norm, (aka, the Euclidean distance) between the given feature vector, and the $k$ centroid vectors you pre-computed from using $k$-means. &lt;/li&gt;&#xA;&lt;li&gt;Pick the $i$th centroid out of the $k$ cetroids that corresponds to the closest distance to your point. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Mathematically, you want to declare a bat of type $i$, among $k$ type bats by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;{arg\,min}_{i \in (1, 2, ...k) }  \sqrt{\sum_{n = 1}^{N} (\mathbf{x} - \mathbf{f_i})^2 } &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{x}$ is an $N$ x $1$ feature vector of your unclassified audio sample, and $\mathbf{f_i}$ is the $i$th $N$ x $1$ cluster centroid found by $k$-means.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-08-07T19:48:45.757" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="10231" PostTypeId="1" CreationDate="2013-08-07T18:50:28.370" Score="1" ViewCount="810" Body="&lt;p&gt;I read several papers which proposed a method to identify modal parameters. such as natural frequency and damping ratio.I've tried to implement those methods by Matlab.but I couldn't get the result.It seems I missed something.anyway it must be some problem with my codes.Please check it and see what's the problem. &lt;a href=&quot;https://ieeexplore.ieee.org/document/5708194&quot; rel=&quot;nofollow noreferrer&quot;&gt;here you can access to the paper which I've tried to implement its method&lt;/a&gt;.&#xA;here you can see the brief relationships to identify damping and frequency.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2s0nl.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;and here is the code. please look and see if I am doing these relationships right or not.also if you have another method to extract the damping of a mode,please do tell me.&#xA;Best regards.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;t=linspace(0,30,300);&#xA;Fs=ceil(inv(t(2)-t(1)));                               % sampling freq&#xA;x=sin(2*pi*t*0.1).*(t&amp;lt;10)+sin(2*pi*t*0.3).*... &#xA; (t&amp;lt;30)+sin(2*pi*t*0.6).*(t&amp;lt;10).*exp(-t*.1);           % my signal[0.1Hz,0.3Hz,0.6Hz]&#xA;wname = 'cmor20-1';                                    % define wavelet name&#xA;scales = 1:1:256;                                     % scales range&#xA;freq = scal2frq(scales,wname,1/Fs);&#xA;coefs = cwt(x,scales,wname,'lvlabs');                  % Get coefs of x&#xA;abscof=abs(coefs);                                     % |coefs|' &#xA;logcof=log(abscof);                                    % Ln|Wx(a,b)|&#xA;argcof=angle(coefs);                                   % arg[Wx(a,b)]&#xA;%--calculating linear regression to get alpha &amp;amp; omega--&#xA;for j=1:256                                            % for all scales&#xA;n=length(t);&#xA;aa(j)=-((n*sum(t.*logcof(j,:))-sum(t)*...              % its alpha&#xA;sum(logcof(j,:))))/(n*sum(t.^2)-(sum(t))^2);&#xA;ba(j)=mean(logcof(j,:))-aa(j)*mean(t);&#xA;aw(j)=-((n*sum(t.*argcof(j,:))-sum(t)*...              %its omega&#xA;sum(argcof(j,:))))/(n*sum(t.^2)-(sum(t))^2);            &#xA;bw(j)=mean(argcof(j,:))-aw(j)*mean(t);&#xA;f(j)=aw(j)/(2*pi);&#xA;dmp(j)=-aa(j)/sqrt(aa(j).^2+aw(j).^2);&#xA;end&#xA;%%&#xA;% this bit will give me freq of all modes in the signal.but i must get these&#xA;%information with f(j) too. however my main problem is getting the damping. &#xA;figure;&#xA;modI=max(abscof');                                      % get  max |coefs| coresponde to freqs of x &#xA;modI=modI/max(modI);                                   % scale each clumn 0-1&#xA;plot(freq,modI)                                        % Plot all modes. contain all &#xA;grid on&#xA;axis([0 3 0 max(modI)*1.1])                            % seting the axis&#xA;xlabel('Pseudo-Frequency (Hz)'); ylabel('abs(coefs)'); % seting the axis&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="26573" LastEditDate="2022-04-27T14:19:20.857" LastActivityDate="2022-04-27T14:19:20.857" Title="How can I identify the damping of the modes in a signal by Cmor wavelet method?" Tags="|matlab|frequency|wavelet|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10232" PostTypeId="2" ParentId="10224" CreationDate="2013-08-07T18:53:47.490" Score="1" Body="&lt;p&gt;Image interpolation is not (exactly) the same as upsampling. Suppose that you have a grid $\Lambda$ which is a $640 \times 480$ grid of pixels. Each pixel has a location $(x,y) \in \Lambda$. Each pixel also has an intensity $I(x,y)$. This could be a gray-scale value or an RGB triplet. Now suppose that you want to know the intensity of a location that is not centered on one of the pixels. For example, suppose that you wanted the intensity at location $(17.35, 188.42)$. In this case, you would use the neighboring integer pixel intensities in an appropriate interpolation scheme (nearest neighbor, bilinear, bicubic, Lanczos etc.) to get the sub-pixel intensity. This is image interpolation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image upsampling is when you want to go from a grid $\Lambda$ that is $640 \times 480$ to a larger grid $\Gamma$ that is for example, $1280 \times 960$ pixels. In such a case, a simple algorithm is create the new grid filled with zeros. Then, if there is a pixel value in the original image at $(x,y)$, then take its intensity I(x,y) and fill it in the upsampled image at $I'(2x,2y)$. The $2$ is the $r$ (rate) referred in your formula. Then, we use an appropriate kernel (the $h$ in your formula) to filter the image and complete the upsampling. NOTE: This is a simple explanation. Please see Gozalez, Woods and Eddins, Digital Image Processing for a better treatment.&lt;/p&gt;&#xA;" OwnerUserId="867" LastEditorUserId="867" LastEditDate="2013-08-07T20:52:59.690" LastActivityDate="2013-08-07T20:52:59.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10233" PostTypeId="1" AcceptedAnswerId="10234" CreationDate="2013-08-07T20:00:41.080" Score="3" ViewCount="297" Body="&lt;p&gt;Remember that Christopher Walken skit on Saturday Night live where he told the band “it needs more cowbell” &lt;a href=&quot;https://en.wikipedia.org/wiki/More_cowbell&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/More_cowbell&lt;/a&gt; ?  This site automated it &lt;a href=&quot;http://www.morecowbell.dj/&quot; rel=&quot;nofollow&quot;&gt;http://www.morecowbell.dj/&lt;/a&gt; using echonest &lt;a href=&quot;http://developer.echonest.com/&quot; rel=&quot;nofollow&quot;&gt;http://developer.echonest.com/&lt;/a&gt; .  That’s all fine.  Question is: “What is the actual algorithm behind the beat detection and cowbell insertion?”&lt;/p&gt;&#xA;" OwnerUserId="3602" LastActivityDate="2013-08-07T20:17:09.143" Title="How to add more cowbell?" Tags="|audio|algorithms|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10234" PostTypeId="2" ParentId="10233" CreationDate="2013-08-07T20:17:09.143" Score="7" Body="&lt;p&gt;The beat and onset detection algorithms used at the Echo Nest are probably variants/improvements of the techniques developed by Tristan Jehan &lt;a href=&quot;http://web.media.mit.edu/~tristan/phd/dissertation/index.html&quot;&gt;in his Ph.D&lt;/a&gt;. This is not the only approach, and I would recommend you to try first:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Getting an onset detection function using spectral flux or &lt;a href=&quot;http://www.eecs.qmul.ac.uk/legacy/dafx03/proceedings/pdfs/dafx81.pdf&quot;&gt;complex amplitude&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Using &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/pubs/Ellis07-beattrack.pdf&quot;&gt;this algorithm&lt;/a&gt; to detect beats (you can improve it using the &quot;comb template&quot; method described &lt;a href=&quot;http://www.eecs.qmul.ac.uk/~markp/2007/DaviesPlumbley07-taslp.pdf&quot;&gt;here&lt;/a&gt; to score tempo candidates - I believe this combination of Ellis' dynamic programming approach with a more sophisticated candidate scoring function is what is used in Sonic Visualizer's default beat detection vamp plug-in).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As for adding the cowbell, I think there are a bunch of heuristics that could work. First of all, you can use the breaking down of the song into sections (as provided by the EN analyzer or by &lt;a href=&quot;http://www.violconsort.com/mark/IEEEASLP.pdf&quot;&gt;an algorithm like this&lt;/a&gt;), and process each section individually - to have changes in the cowbell pattern coincide with changes into chorus/verse. For each section, you can align the detected onsets on a grid of 16 or 32 sixteenth note to get a discrete representation of the onsets (a bit similar to what you would see on a drum machine or sequencer); and then average these patterns to get a summary of the rhythmic structure of the section. If the section is too chaotic - use a cowbell hit on each 4th or 8th note... Possible refinements: tune the cowbell so that it matches the key of the song, stop it in the sections that have a very low loudness...&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-07T20:17:09.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10235" PostTypeId="1" CreationDate="2013-08-07T20:54:22.477" Score="1" ViewCount="1372" Body="&lt;p&gt;I have two electric signals from different sources and I think that are similar.&#xA;I have the FFT of the signals and I have their spectrums of frequency  in separate arrays. &#xA;How should I proceed to find the percentual of similarity the two signals? &lt;/p&gt;&#xA;" OwnerUserId="5183" LastEditorUserId="4619" LastEditDate="2013-08-07T21:27:43.770" LastActivityDate="2013-08-08T05:22:47.497" Title="How to calculate the similarity of two electric waves" Tags="|fft|algorithms|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10236" PostTypeId="1" AcceptedAnswerId="10239" CreationDate="2013-08-07T22:04:56.010" Score="14" ViewCount="30721" Body="&lt;p&gt;I'm having some problems understanding the FFT. Is the frequency resolution in the spectrum calculated as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{\textrm{sampling rate}}{\textrm{number of FFT points}}$ or $\frac{\textrm{sampling rate}}{\textrm{0.5 * number of FFT points}}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Asking this because the spectrum is symmetric for real-valued inputs. So, say I have $f_s = 1000$ Hz and $N$ = 1024, where $N$ is the number of FFT points. Now, is the frequency resolution $\frac{1000 \textrm{ Hz}}{1024} = 0.9766$ Hz or $\frac{1000 \textrm{ Hz}}{0.5 * 1024} = 1.9531$ Hz?&lt;/p&gt;&#xA;" OwnerUserId="5184" LastActivityDate="2018-05-02T16:43:46.733" Title="FFT frequency resolution" Tags="|fft|frequency-spectrum|frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10237" PostTypeId="1" CreationDate="2013-08-07T22:10:34.863" Score="3" ViewCount="246" Body="&lt;p&gt;I have some biomedical signals. If I calculate their magnitude spectrums, I see power-line interference at 50 Hz. I was excepting a harmonic at 100 Hz, but it turns out there is none. However, there is a harmonic at 150 Hz. Is this common or should I worry that I have done something wrong?&lt;/p&gt;&#xA;" OwnerUserId="5184" LastActivityDate="2013-08-07T23:25:36.420" Title="Missing harmonics (power-line)" Tags="|fft|frequency-spectrum|frequency|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10238" PostTypeId="2" ParentId="10236" CreationDate="2013-08-07T22:38:41.290" Score="2" Body="&lt;p&gt;The term &quot;resolution&quot; has multiple meanings.  In optics, two lines are resolved only if you can see a gap between them.  In graphics, resolution might be related to plot points per inch (or other linear measure).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to see, say, a 3 dB drop between two spectral peaks in an FFT result, they would have to be more than 1 FFT result bin apart.   Around 2 bins, or a bit more depending on the window function used, are needed to clearly separate 2 adjacent equal magnitude frequency peaks with a clear gap between them.  Around 2 Hz resolution, by this measure, for your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you want to estimate or plot the location of just one frequency peak which is far apart from any other spectral peaks and well above the noise floor, you can often get much finer resolution, than 1 FFT result bin separation, by appropriate interpolation (polynomial, or better yet Sinc).  Likely sub 0.5 Hz in your example, but only with a suitably high S/N and separation from any other peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the answer is yes... depending.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2018-05-02T16:43:46.733" LastActivityDate="2018-05-02T16:43:46.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10239" PostTypeId="2" ParentId="10236" CreationDate="2013-08-07T23:07:14.017" Score="6" Body="&lt;p&gt;Suppose you have a signal $x[n]$, with $n \in {0, 1, ... N - 1} $. The &lt;em&gt;same-size&lt;/em&gt; DFT is defined by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \sum_{n = 0}^{N-1} x[n] e^{-j\frac{\Large{2 \ \pi n k}}{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency &lt;em&gt;resolution&lt;/em&gt; is going to be how many Hz each DFT &lt;em&gt;bin&lt;/em&gt; represents. This is, as you have noted, given by $\frac{f_s}{N}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If on the other hand you had zero-padded your signal, such that $N_{zp}$ is greater than  $N$, then a more apt term of frequency &lt;em&gt;granularity&lt;/em&gt; is given by $\frac{f_s}{N_{zp}}$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Asking this because the spectrum is symmetric for real-valued inputs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That is irrelevant. The frequency resolutions/granularities are given by the above. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;o, say I have fs=1000 Hz and N = 1024, where N is the number of FFT&#xA;  points. Now, is the frequency resolution 1000 Hz1024=0.9766 Hz or 1000&#xA;  Hz0.5∗1024=1.9531 Hz?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If your sampling frequency $f_s = 1000$ Hz, and you are taking an $N=1024$ (same-sized) FFT, then your frequency &lt;strong&gt;&lt;em&gt;resolution&lt;/em&gt;&lt;/strong&gt; is $\frac{1000}{1024}$, which is equal to 0.9766 Hz/bin. If your $N_{zp} = 1024$ (FFT length after zero-padding), then your frequency &lt;strong&gt;&lt;em&gt;granularity&lt;/em&gt;&lt;/strong&gt; is 0.9766 Hz/bin.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-08-07T23:23:03.803" LastActivityDate="2013-08-07T23:23:03.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10240" PostTypeId="2" ParentId="10237" CreationDate="2013-08-07T23:25:36.420" Score="2" Body="&lt;p&gt;Yes, this is common. Common non-linearities (such as op-amp clipping) preserve the symmetry of the upper and lower section of the waveform; and as such, they do not introduce even harmonics - just odd harmonics.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-07T23:25:36.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10241" PostTypeId="2" ParentId="10235" CreationDate="2013-08-08T05:22:47.497" Score="1" Body="&lt;p&gt;You could measure the Cross-Correlation between the two signals.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an almost identical thread, with a filling answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar&quot;&gt;How do I implement cross-correlation to prove two audio files are similar?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some general info on cross-correlation from wiki:&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Cross-correlation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. &lt;/p&gt;&#xA;" OwnerUserId="5186" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-08-08T05:22:47.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10242" PostTypeId="1" CreationDate="2013-08-08T07:35:18.743" Score="1" ViewCount="441" Body="&lt;p&gt;As the title suggests , I want to know how noise cancellation is achieved by adding multiple images together . I know the theory behind it , but simple adding the pixel values of 100 noisy images of the same sample would simply produce a white image . Can anybody elaborate , how it is normally done.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2013-08-08T07:54:54.020" Title="Noise cancellation by averaging multiple images together" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10243" PostTypeId="2" ParentId="10242" CreationDate="2013-08-08T07:54:54.020" Score="1" Body="&lt;p&gt;This works simply by virtue of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow&quot;&gt;central limit theorem&lt;/a&gt;. For a given pixel, you are given 100 observations of its true value + random noise; and if you assume that the noise has zero mean, then the average of these will have a normal distribution centered at the true pixel value, with a variance decreasing as more observations are added. The central limit theorem also tells you that this is a rather terrible denoising method: for a gain in SNR of $6dB$ (reducing noise by a factor of 2) you have to increase the number of averaged samples by a factor of 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your problem, are you sure that you are averaging (dividing by the number of images) rather than just summing? And are you sure that you are using the correct data type for your computations? These are implementation/programming questions and are out of topic here.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-08T07:54:54.020" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10244" PostTypeId="1" AcceptedAnswerId="10246" CreationDate="2013-08-08T10:27:11.920" Score="1" ViewCount="325" Body="&lt;p&gt;What exactly is one looking for in audio data to find different instruments or energy sources?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the FFT can extract frequencies, but how can e.g. percussion be detected alongside e.g. a bass line?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the frequency bins be checked into a frequency mapping of instruments? This would lead to collisions in possible instruments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are the frequencies of a FFT output directly mappable to pitch frequency charts or should there be a conversion first?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2013-08-08T10:43:35.227" LastActivityDate="2013-08-08T16:29:35.190" Title="Determining instruments in audio data" Tags="|audio|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10245" PostTypeId="1" AcceptedAnswerId="10257" CreationDate="2013-08-08T11:07:11.690" Score="2" ViewCount="146" Body="&lt;p&gt;As a beginner in signal processing, i'll try to explain my problem most thoroughly.&#xA;I'll firstly explain the idea of the transformation the real valued data has undergone.&#xA;This includes the ideas and reasons why it does work and the way to revert the procedure. Then i'll explain my difficulties in reverting it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all a property of the FFT of a real signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given an $N$ data point real valued signal $x(t)$, it has $\frac{N}{2} + 1$ unique Fourrier coefficients $X(f_i)$ with  $i \in {0,..,N-1}$. The other $\frac{N}{2}-1$ coefficients can be retrieved by inverting the spectrum of the coefficients $X(f_1)$ to $X(f_{\frac{N}{2}})$.&#xA;So in some sense all the information of my signal is stored in the first $\frac{N}{2}+1$ of it Fourrier coefficients. Keep that in mind, because this property i'm going to exploit to retrieve the original signal from it's analytic representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to the theory of the procedure the data has undergone:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $X_a (f_i)$ be the analytic representation of the Fourrier coefficients $X(f_i)$ of $x(t)$.&#xA;Then $X_a(f_i)=0$,  if $f_i &amp;lt; 0$, and for the Fourrier Coefficients of the original signal $x(t)$ we know that $X(f_i)= \frac{X_a(F_i)}{2}$with $i \in 1,...\frac{N}{2}$. So $\frac{N}{2}-1$ coefficients carry no additional information about the signal. This allows a downsampling to $\frac{N}{2}+1$ frequencies, by cutting those $X_a(f_i)$ off, with $f_i &amp;lt;0$. And no information is lost, as the original signal was real. To make sure you can follow me &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Analytic_signal&lt;/a&gt; explains it in detail. Let's call the resulting complex signal of length $\frac{N}{2} +1$ $x_c(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to retrieve the original real signal would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i'd want to retrieve my original signal all i'd have to do is invert the Fourrier Cofficient vector $[X_a(f_i)]$, $i \in 1,N-1$ and append them to my frequency spectrum. &#xA;Resulting in the spectrum: $[X_a(f_0),...X_a(f_{\frac{N}{2}+1}), X_a(f_{\frac{N}{2}}),X_a(f_{\frac{N}{2}-1}), X_a(f_{\frac{N}{2}-2}),...X_a(f_1)]=FFT(x(t))$ of my original signal $x(t)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to my situation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do get something similar to the results of above modification of signals.&#xA;The major difference is that i don't get all $\frac{N}{2}+1$ coefficients of the complex signal $x_c(t)$. But what i do get is the complex signal from $0$ to $\frac{N}{2}-1$. So what i'm lacking is the coefficient $X_a(f_{\frac{N}{2}})= \sum_{k=0}^{N} e^{i\pi k}x_a(k)$ of the Fourrier transform of my Fourrier pair $(X_a(f_i),x_a(t))$. This is a real valued Fouerrier coefficient of the signal $x(t)$ at the nyquist frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what way i would be able to get the best approximation of my original signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: Hope this format is way better than before.&lt;/p&gt;&#xA;" OwnerUserId="5187" LastEditorUserId="5187" LastEditDate="2013-08-09T12:23:33.067" LastActivityDate="2013-08-09T12:23:33.067" Title="Revert anayltic signal(length(N/2)) to real signal (length(N))" Tags="|fft|analytic-signal|conversion|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10246" PostTypeId="2" ParentId="10244" CreationDate="2013-08-08T13:02:49.323" Score="2" Body="&lt;p&gt;There seem to be four questions here. I can't give complete answers for each of them but let me address them in turn. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What exactly is one looking for in audio data to find different instruments or energy sources?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's not really a single answer to this. There's lots of research into many closely related but ultimately different problems. In general instruments vary in the way their spectral properties vary over time. Tracking the changes of all the harmonic and inharmonic components of a note amongst other sounds is no small task. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So the FFT can extract frequencies, but how can e.g. percussion be detected alongside e.g. a bass line?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally you'd use a &lt;a href=&quot;http://en.wikipedia.org/wiki/STFT&quot; rel=&quot;nofollow&quot;&gt;Short-time Fourier transform&lt;/a&gt; so that there's time data as well as the spectral information. From here you've got a few problems to think about:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source separation: look up techniques such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow&quot;&gt;ICA&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/NMF&quot; rel=&quot;nofollow&quot;&gt;NMF&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Computational_auditory_scene_analysis&quot; rel=&quot;nofollow&quot;&gt;CASA&lt;/a&gt;.This will divide up the energy between the detected sources allowing you to detect the separate instruments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fundamental frequency detection: I recommend summary auto-correlation of frequency bands rather than purely time or frequency domain methods. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;also Source identification (which I don't know much about).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would the frequency bins be checked into a frequency mapping of instruments? This would lead to collisions in possible instruments.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You need to apportion the frequency information not just assign it all to one instrument.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are the frequencies of a FFT output directly mappable to pitch frequency charts or should there be a conversion first?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The fundamental frequency, which is given on a pitch-frequency chart, may not actually present in a note ('the missing fundamental problem'). So a fundamental frequency detection algorithm such as the one I suggest above will be needed before you can use the chart.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2013-08-08T13:02:49.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10247" PostTypeId="2" ParentId="10244" CreationDate="2013-08-08T16:29:35.190" Score="1" Body="&lt;p&gt;Some of the frequencies (often the vast majority), in an FFT of audio data, represent some overtone of a musical pitch.  Perhaps even a combination of different overtone numbers of different pitch sources.  One needs to figure out which overtone of which pitch source(s) a frequency represents before any note pitch mapping can take place.  Since the overtones of many instruments can overlap, you may need to figure out how to unmix them as part of the process as well.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-08T16:29:35.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10249" PostTypeId="1" AcceptedAnswerId="10252" CreationDate="2013-08-09T02:55:07.473" Score="0" ViewCount="260" Body="&lt;p&gt;Is there any approximate relation in FFT coefficients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider time domain signal $x_n$. Its $N$ point (assume $N$ to be even) DFT is given as $X_0,X_1,...,X_{N-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I say something about the nature of $abs(X_1)/abs(X_0)$? I am trying to see the variation in DFT coeffcients and for that I thught one can sonsider the ratio of successive coefficients. My motivation is to see how similar the magnitude spectrogram at frequency $f1$ is to spectrogram at frequency $f1+1$ and $f1-1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to simplify the expanded equation but got stuck after a step -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$abs(X_0) = \Sigma_0^{N-1} x_n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$abs(X_1) = abs(x_0+x_{N/2}+2(x_1.e^{-j.2\pi/N} + x_2.e^{-j.2\pi.2/N}+..+x_{N/2-1}.e^{-j.2\pi.(N/2-1)/N}))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I (approximately) simplify $abs(X_1)/abs(X_0)$?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="4206" LastEditDate="2013-08-09T03:02:06.283" LastActivityDate="2013-08-09T06:34:42.957" Title="Similarity in absolute value of nearby DFT coefficients" Tags="|fft|fourier-transform|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10250" PostTypeId="1" AcceptedAnswerId="10251" CreationDate="2013-08-09T03:03:04.053" Score="26" ViewCount="8726" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Shift_theorem&quot; rel=&quot;noreferrer&quot;&gt;shift theorem says&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Multiplying $x_n$ by a &lt;em&gt;linear phase&lt;/em&gt; $e^{\frac{2\pi i}{N}n m}$ for some integer &lt;em&gt;m&lt;/em&gt; corresponds to a &lt;em&gt;circular shift&lt;/em&gt; of the output $X_k$: $X_k$ is replaced by $X_{k-m}$, where the subscript is interpreted modulo &lt;em&gt;N&lt;/em&gt; (i.e., periodically).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Ok, that works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot a&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S65Z0.png&quot; alt=&quot;arbitrary 9-sample signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 9&#xA;k = [0, 1, 2, 3, 4, 5, 6, 7, 8]&#xA;plot ifft(fft(a)*exp(-1j*2*pi*3*k/N))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WZ8Kw.png&quot; alt=&quot;signal shifted by 3 samples in the frequency domain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shifted by 3 samples, as I expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought you could also do this to shift by &lt;em&gt;fractions&lt;/em&gt; of a sample, but when I try it, my signal becomes imaginary and not at all like the original:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot real(ifft(fft(a)*exp(-1j*2*pi*3.5*k/N)))&#xA;plot imag(ifft(fft(a)*exp(-1j*2*pi*3.5*k/N))), 'b--'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zdnkW.png&quot; alt=&quot;signal after multiplying by 3.5 complex exponential&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't expect this at all.  Isn't this equivalent to convolving with a real impulse that's been shifted by 3.5 samples?  So the impulse should still be real, and the result should still be real?  And it should have more or less the same shape as the original, but sinc interpolated?&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-08-09T14:34:54.687" LastActivityDate="2017-08-25T13:42:09.263" Title="How to circularly shift a signal by a fraction of a sample?" Tags="|fourier-transform|convolution|phase|frequency-domain|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10251" PostTypeId="2" ParentId="10250" CreationDate="2013-08-09T06:21:22.297" Score="16" Body="&lt;p&gt;If you want the shifted output of the IFFT to be real, the phase twist/rotation in the frequency domain has to be conjugate symmetric, as well as the data.  This can be accomplished by adding an appropriate offset to your complex exp()'s exponent, for the given phase slope, so that the phase of the upper (or negative) half, modulo 2 Pi, mirrors the lower half in the FFT aperture.  The complex exponential shift function can also be made conjugate symmetric by indexing it from -N/2 to N/2 with a phase of zero at index 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It just so happens that the appropriate offset for phase twists or spirals, that complete an exact integer multiples of 2 Pi rotations in aperture, to be conjugate symmetric in aperture, is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a conjugate symmetric phase twist vector, the result should then end up as a circular Sinc interpolation for non-integer shifts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Elaboration by OP:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your choice of k = [0, 1, 2, 3, 4, 5, 6, 7, 8] is producing an asymmetrical complex exponential:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NuQG6.png&quot; alt=&quot;asymmetrical complex exponential 0.5 sample shift attempt, with imaginary part as dashed line&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use k = [0, 1, 2, 3, 4, -4, -3, -2, -1] instead, you get a Hermite-symmetric complex exponential:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(fftshift(exp(-1j * 2*pi * 0.5/N * k)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gHlsg.png&quot; alt=&quot;Hermite-symmetric complex exponential for 0.5 sample shift, with imaginary part as dashed line&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and now when you use the same exponential formula to shift by 0.5 or 3.5 samples, you get a real result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot ifft(fft(a)*exp(-1j * 2 * pi * 0.5/N *k))&#xA;plot ifft(fft(a)*exp(-1j * 2 * pi * 3.5/N *k))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a3LcK.png&quot; alt=&quot;shift by 0.5 and 3.5 samples, with original as dotted line&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-09T18:32:48.083" LastActivityDate="2013-08-09T18:32:48.083" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="10252" PostTypeId="2" ParentId="10249" CreationDate="2013-08-09T06:34:42.957" Score="3" Body="&lt;p&gt;Because the basis vectors for adjacent DFT bins are absolutely orthogonal, the values in the adjacent DFT result bins can be completely unrelated, and thus their ratio can be anything, depending on the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use a non-rectangular window function, then there will be some leakage of spectral peaks into adjacent bins due to convolution with the transform of the window.  But this depends on the window chosen.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-09T06:34:42.957" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10254" PostTypeId="1" AcceptedAnswerId="10255" CreationDate="2013-08-09T10:38:28.483" Score="4" ViewCount="3525" Body="&lt;p&gt;Why exactly is  X(0) the DC component of a signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is it equal to N times x(n)'s average value and why it is at X(0)?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2013-08-09T10:48:14.193" Title="Why is X(0) the DC component" Tags="|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10255" PostTypeId="2" ParentId="10254" CreationDate="2013-08-09T10:48:14.193" Score="8" Body="&lt;p&gt;Follows from the DFT definition. It's defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;X(k) = \sum_{n=0}^{N-1} x(n) e^{-j2\pi \frac{kn}{N}}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $X(0)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;X(0) = \sum_{n=0}^{N-1} x(n) e^{-j2\pi \frac{0 \cdot n}{N}}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having $k=0$ gives $e^0=1$ all the time so that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;X(0) = \sum_{n=0}^{N-1} x(n) 1&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing this to the average&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\overline{x} = \frac{1}{N} \sum_{n=0}^{N-1} x(n)&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;shows that $X(0) = N \overline{x}$&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-08-09T10:48:14.193" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10256" PostTypeId="1" CreationDate="2013-08-09T12:04:32.663" Score="2" ViewCount="153" Body="&lt;p&gt;I'm fairly new to digital signal processing. I've been trying with limited success to apply a time-varying bandpass filter to a signal (question at &lt;a href=&quot;https://stackoverflow.com/questions/18128057/applying-time-variant-filter-in-python&quot;&gt;stackoverflow&lt;/a&gt;). Instead I thought I'd try a different approach. Say I have a function which approximates the data I'm trying to filter from my signal. Is there a technique -- perhaps some sort of optimisation -- that can take this estimation as a &quot;template&quot; for a filter design, rather than specifying strict filter parameters, as when one designs a Butterworth filter, for example.&lt;/p&gt;&#xA;" OwnerUserId="5192" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-09-08T19:21:17.870" Title="Apply a filter according to some function" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10257" PostTypeId="2" ParentId="10245" CreationDate="2013-08-09T12:14:42.687" Score="3" Body="&lt;p&gt;First answer deleted since I completely misunderstood the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem here is that apparently you are missing one frequency point. From the question it's not clear what is missing. You say you have the points from 0 to N/2. That's actually N/2+1 (if 0 and N/2 are included) and all you need. If that's not the case, there are gew possibilities&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Go to the person who provided the data and ask them to fix it&lt;/li&gt;&#xA;&lt;li&gt;X(0) and X(N/2) are actually real valued. Sometimes people pack the X(N/2) value into the imaginary part of X(0) to save space and create a symmetrical representation. Check your X(0) and figure out whether it's imaginary part is actually 0 or not&lt;/li&gt;&#xA;&lt;li&gt;There is a way to represent a N-point real sequence with exactly N/2 complex coefficients that involves a  half sample rotation in the frequency domain. That's pretty esoteric and unlikely in this case (but works quite well).&lt;/li&gt;&#xA;&lt;li&gt;If the high frequency energy in your original signal is sufficiently low, you can set the Nyquist coefficients simply to zero. According to the sampling theorem, that should be zero anyway. In practice this will add some noise to the reconstructed signal but if it's small enough that may be tolerable.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-08-09T12:14:42.687" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10258" PostTypeId="2" ParentId="9432" CreationDate="2013-08-09T14:40:36.210" Score="3" Body="&lt;p&gt;We can't use the initial linearized-model of non-linear system again and again in each iteration because linear-model approximates the nonlinear model only around some small neighbourhood of the starting point. In other words, linear model is good(i-e approximates the nonlinear model) only around some small-interval around the point. As, we need to estimate the current state again and again, if we don't linearlize the non-linear model around the current estimate in each iteration, we would we getting worse and worse (in terms of linear model) and consequently we will no longer correctly estimate the state. &lt;/p&gt;&#xA;" OwnerUserId="5049" LastActivityDate="2013-08-09T14:40:36.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10259" PostTypeId="2" ParentId="10256" CreationDate="2013-08-09T15:21:56.500" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Say I have a function which approximates the data I'm trying to filter&#xA;  from my signal. Is there a technique -- perhaps some sort of&#xA;  optimisation --&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let us say that you have a model of your data, in the form of a polynomial fit of certain order. In this case you will have co-efficients that produce a polynomial that best fits your data in the Least Squares Sense. Thus, you would have already solved the LSE problem via optimization routines, which would yield the co-efficients $p_i$. for a $m$ degree polynomial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = p_0x^0[n] + p_1x[n] + p_2x^2[n] ... p_mx^m[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;that can take this estimation as a &quot;template&quot; for a filter design,&#xA;  rather than specifying strict filter parameters, as when one designs a&#xA;  Butterworth filter, for example.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Technically yes, you can do this. Once you have your polynomial co-efficients, you can generate a polynomial at sample spacing commensurate with your sampling rate, and perform a DFT on it and inspect the absolute magnitude of your result, in order to get a frequency domain representation of your 'template'. This is certainly do-able. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, this is precisely the theory behind &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;matched filters&lt;/a&gt;. Matched filters work optimally (in AWGN) because they take into account frequency bins where your signal resides, and ignore other bins with noise only. This is how they maximize SNR when performing active detection of (obviously known) signals. (This is also closely related to the technique of Empirical filtering in the frequency domain). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I say the above is doable, however the wisdom of doing it would depend heavily on your application, which your question does not really delve into. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Based on the new information you have provided in your comments: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, note that the Hilbert Spectrum (instantaneous frequency) is not defined for signals with more than one complex exponential. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, the way you have described it, you may be over-thinking this. You want to perform a narrow-band filtering operation on a frequency-varying signal over time. One basic solution for this is to simply use an &lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_filter&quot; rel=&quot;nofollow&quot;&gt;Adaptive Filter&lt;/a&gt;, whereby the weights of your (adaptive) filter are constantly updated so as to minimize the error between your estimate and the empirical data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One implementation of an LSE Adaptive filter will seek to minimize the cost function, defined by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C[n] = \Big[y[n] -  \mathbf{h}^T[n]\mathbf{x}[n]\Big]^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\mathbf{h}^T[n]$ is the $M$ length adaptive weight vector at instant $n$, $\mathbf{x}[n]$ is the $M$ length data vector taken as column vectors of the Toeplitz data matrix $\mathbf{X}$, and $y[n]$ is the desired signal at instant $n$. A filter structure such as this will 'track' your signal as it changes frequencies.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-08-09T17:41:48.303" LastActivityDate="2013-08-09T17:41:48.303" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10260" PostTypeId="1" CreationDate="2013-08-09T16:02:59.530" Score="2" ViewCount="652" Body="&lt;p&gt;I have a sinusoidal signal embedded in noise, and I would like to estimate it's amplitude and frequency, so I can subtract it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize that an FFT can do the job for me, and that's what I've been doing - I took an FFT of the input signal, and looked at the frequency bin with the highest amplitude, used that as an estimate for the frequency of the wave, and then subtract it out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the problem is that the frequency is accurate to only half a bin, and the bin size can be fairly large (since my sample size is typically ~ 100 points), and hence the error in wavelength is big. This leaves fairly large residuals once I subtract.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as step two, I used the frequency from the FFT as an estimate, and I used the Levenberg-Marquardt algorithm to fit for the frequency, phase and amplitude. This solution worked wonderfully for toy data that I generated, but it fails quite frequently on real data, because of the noise. The amplitude of the noise can be as large (at most) as the amplitude of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figured that I can estimate the wavelength using an autocorrelation, but I'm not sure how to interpret the results in the case of more than one frequency component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Are there any methods of estimating the wavelength of the wave that aren't FFT? I figure since fitting for the frequency is failing with noise, I could try fitting for the wavelength, but any other suggestions are welcome!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I haven't really tried padding with zeros while performing the FFT because the noise seems to go up in the fourier plane if I do, but I'll try it and report the success here.&lt;/p&gt;&#xA;" OwnerUserId="3183" LastActivityDate="2013-08-09T16:28:27.127" Title="Estimating the wavelength of a sinusoid" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10261" PostTypeId="2" ParentId="10260" CreationDate="2013-08-09T16:23:20.980" Score="1" Body="&lt;p&gt;The first thing to note is that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm&quot; rel=&quot;nofollow&quot;&gt;LMA algorithm&lt;/a&gt; is an estimator, and tries to minimize error in the least squares sense, between your data, and a model function of variable parameters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typical of LSE based frequency estimators, you need to seed them at values close to the global minima of the cost function, otherwise they will find another local minimum to lock on to, and hence they need to be seeded properly, or 'in the ball park', ostensibly using some apriori information. How to attain this a-priori information? See below.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This solution worked wonderfully for toy data that I generated, but it&#xA;  fails quite frequently on real data, because of the noise. The&#xA;  amplitude of the noise can be as large (at most) as the amplitude of&#xA;  the signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;LMA will provide you with an amplitude, phase, and frequency estimate in the LS sense. Of course, the more noise there is in your data, the worse off this estimate is. This is why you will need to pre-process your data to remove as much noise as possible, &lt;em&gt;before&lt;/em&gt; the application of the LMA. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention zero-padding your data, and while this will not increase your frequency resolution, this will certainly increase your frequency granularity. (Interpolation in the frequency domain). With those facts, I would attempt the following solution:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pre-Process the data via an (FIR) Band-Pass Filter centered around my frequency of interest. &lt;/li&gt;&#xA;&lt;li&gt;Perfrom a zero-padded FFT so as to ascertain the peak frequency of interest within the BPF'd data's band. &lt;/li&gt;&#xA;&lt;li&gt;From this peak, ascertain the frequency, amplitude, and phase, with which to seed LMA with. (Note, make sure to remove the phase offset the BPF filter added for the seeding value).&lt;/li&gt;&#xA;&lt;li&gt;Run the LMA.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm guessing you mean throw away the highest frequency components etc?&#xA;  Would the statistics of my noise matter in that case? I can assume&#xA;  it's gaussian, but that may not be strictly true in all cases&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The statistics of the noise does not matter in this case. All you are doing is removing frequency &lt;em&gt;bands&lt;/em&gt; where noise exists, independent of their statistics. In this way, you are not utilizing DFT bands where your signal does not exist, and retaining the DFT bands where your signal exists. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-08-09T16:28:27.127" LastActivityDate="2013-08-09T16:28:27.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10262" PostTypeId="1" CreationDate="2013-08-09T16:33:30.773" Score="7" ViewCount="2536" Body="&lt;p&gt;I'm new to image processing, and I'm trying to get my feet wet. I have taken a picture of some jigsaw puzzle pieces and I want to isolate the pieces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oSx77.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the Python SimpleCV library to do this, and so far I've managed to get pretty decent results using &lt;code&gt;findBlobs()&lt;/code&gt;, &lt;code&gt;hueDistance()&lt;/code&gt;, and &lt;code&gt;drawMinRect()&lt;/code&gt;. Here's what I've got so far&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/63FDj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pretty good, honestly. The only place it's wrong is with those two pieces touching slightly to the right of center.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried dilating the image, but that seems to exacerbate the problem. How can I &quot;shrink&quot; these blobs to eliminate the overlap?&lt;/p&gt;&#xA;" OwnerUserId="5193" LastEditorUserId="698" LastEditDate="2013-08-09T18:47:19.213" LastActivityDate="2014-01-30T15:15:30.717" Title="Jigsaw puzzle: isolating the pieces (separating &quot;stuck&quot; blobs)" Tags="|image-processing|opencv|image-segmentation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10263" PostTypeId="1" AcceptedAnswerId="10264" CreationDate="2013-08-10T06:45:29.167" Score="1" ViewCount="109" Body="&lt;p&gt;I am reading a book on filter design and the author mentions to evaluate a transfer function, let 2 * PI * f (w) vary from 0 to PI to get the first half of the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly is this done in code and what is meant by vary in terms of actual values? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should f not change as well to get the response of different frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do the calculations look if there is a varying f and a varying 0 to PI?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2013-08-10T07:32:34.077" Title="Let 2 * PI * f vary from 0 to PI" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10264" PostTypeId="2" ParentId="10263" CreationDate="2013-08-10T07:32:34.077" Score="1" Body="&lt;p&gt;It's best to see the original text, but I assume $f$ here is the normalized frequency (actual frequency divided by the sample rate), so we have $\omega = 2 \pi f$. This means that if you need to evaluate the transfer function from DC ($f = 0$) to Nyquist frequency ($f = \frac{1}{2}$), you need to evaluate the transfer function with $\omega$ varying from 0 to $\pi$. Practically, you decide on a grid size $N$ (say $N=100$ points) and evaluate the transfer function at the points $\omega_k = \frac{k \pi}{N - 1}$ for $k = 0, 1, \ldots, N - 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You make it sound like there are two independent variables but there is only one, $\omega$ - the other one, $f$ is just the same thing with different units.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-10T07:32:34.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10265" PostTypeId="1" AcceptedAnswerId="10276" CreationDate="2013-08-10T09:44:10.897" Score="1" ViewCount="775" Body="&lt;p&gt;what would be the most efficient (&quot;cheap&quot; in terms of system resources etc.) way to compare 2 sound files? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the scenario. Sound A comes as an input. There is sound B stored in memory. We need to see if sound A is identical to sound B. We know that both sounds can be copies of the same sound file, but there is a chance that sound B was processed to reduce the size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the most efficient ways to compare these sounds and see if they are similar (or rather the same).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ADDED&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Cheap&quot;, architecture is Cortex ARM M0. 16kb ram, 256kb flash.&lt;/li&gt;&#xA;&lt;li&gt;&quot;Identical&quot; means that these 2 sounds come from the same sound file&#xA;(same exact sound effect). THe difference may be that sound B (stored&#xA;on the microcontroller side) may be processed to reduced size.&#xA;Basically imagine we have 10 sound files, we copy N7 to MCU (maybe&#xA;process it to reduce size) and then play them and expect MCU to&#xA;recognize the sound file when it's played.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The kind of sound - technically it can be any sound (within the frequencies recognizable by humans). Sound effects (explosions, weapons firing, tires screeching), people saying words, melodies played by musical instruments. But the common thing is that they are all identical (instruments playing melodies would be same instruments same room, same time, recorded with the same microphone etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Worth mentioning (to avoid confusion), that the sound is being sent to MCU from a sound output, not as a file.&lt;/p&gt;&#xA;" OwnerUserId="5196" LastEditorUserId="5196" LastEditDate="2013-08-11T07:30:17.783" LastActivityDate="2013-08-11T17:59:53.990" Title="Comparing two sound files in embedded-systems (C language)" Tags="|sound|c|embedded-systems|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10267" PostTypeId="1" CreationDate="2013-08-10T19:53:14.723" Score="14" ViewCount="22584" Body="&lt;p&gt;I am new to the topic of compressed sensing. I read a few papers about it by R.Baranuik, Y.Eldar, Terence Tao etc. All these papers basically provide the mathematical details behind it, i.e., Sparsity, RIP, L1 norm minimisation etc. However, can anyone provide the MATLAB codes that achieve compressive sensing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help.&lt;/p&gt;&#xA;" OwnerUserId="5198" LastEditorUserId="128" LastEditDate="2018-07-07T22:17:36.077" LastActivityDate="2022-06-12T22:23:21.293" Title="Compressive Sensing Through MATLAB Codes" Tags="|matlab|compressive-sensing|optimization|" AnswerCount="6" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10268" PostTypeId="1" AcceptedAnswerId="10305" CreationDate="2013-08-11T02:58:52.217" Score="5" ViewCount="7735" Body="&lt;p&gt;I am in need of an open source library for computing Fast wavelet transforms (FWT) and Inverse fast wavelet transforms (IFWT) - this is to be part of a bigger code I am currently writing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The things I am looking for in the library:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Contains a good variety of wavelet families (Daub,Haar, Coif etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Ability to run in parallel - VERY IMPORTANT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Reasonable documentation, so that I can include new wavelets of my own without having to modify the complete source ( Maybe an OOPS based approach would help?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am flexible about the language - C/C++/Fortran90/Fortran77/Python .... Any language would do for me, though I would prefer something which is optimized for &lt;em&gt;speed&lt;/em&gt; and in &lt;em&gt;parallel&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I have found PyWavelets - it looks good, but it is in Python ( therefore considerably slow) and it doesn't run in parallel. I am going to use the DWT for processing really huge datasets, so speed is an important concern for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its understandable there may not be anything with &lt;em&gt;all&lt;/em&gt; the requirements I mentioned. But I wanted to hear from the community if they have any suggestions.&lt;/p&gt;&#xA;" OwnerUserId="5190" LastActivityDate="2023-04-12T08:16:12.217" Title="Any Open Source Fast Wavelet transform libraries?" Tags="|wavelet|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10269" PostTypeId="1" CreationDate="2013-08-11T07:30:45.317" Score="2" ViewCount="211" Body="&lt;p&gt;I have a signal which consists of an &lt;em&gt;onset&lt;/em&gt; and a &lt;em&gt;release&lt;/em&gt; period. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The onset, sounding like a thud, excites frequencies across the entire frequency range (0-22 kHz). It lasts for about 0.1 s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The release, sounding like a ring, excites 2-5 specific narrow frequency bands. Their amplitudes decay exponentially, albeit at slightly different rates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the &lt;em&gt;end&lt;/em&gt; of these narrow peak tracks. The method I am using now tracks the max amplitude in the narrow frequency bands and takes a windowed derivative. When this derivative passes through a threshold value, the end of the peak track is marked. This doesn't seem to be working consistently for particularly noisy signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second idea was to track the amplitude of the peak tracks and compare them to the noise level. As soon as they reach the noise level, mark it as the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I estimate the noise level if there is no non-signal segment? The segment  before the strike, is often very short or has some ramp in amplitude making it unsuitable as an average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Here's the spectrogram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JOUa6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5199" LastEditorUserId="29" LastEditDate="2013-08-27T21:49:31.740" LastActivityDate="2013-08-27T21:49:31.740" Title="Estimating noise level without 'quiet' segment" Tags="|noise|spectrogram|snr|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10271" PostTypeId="1" CreationDate="2013-08-11T11:13:18.523" Score="3" ViewCount="404" Body="&lt;p&gt;Wireless networks operate on a high frequency, say some several gigahertz. Are the signals really sampled at that high frequencies? If I got it correctly there's some modulating/demodulating in signal transmit, does that effect the situation somehow?&lt;/p&gt;&#xA;" OwnerUserId="5204" LastActivityDate="2013-08-11T12:23:02.790" Title="About sampling and wireless networks" Tags="|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10272" PostTypeId="2" ParentId="10271" CreationDate="2013-08-11T12:19:38.493" Score="2" Body="&lt;p&gt;What you describe is a direct-sampling architecture. Those are practically available for radio amateurs using frequencies up to 30MHz. They are also actively researched to open up their usage for much higher frequencies. Many interesting topics (e.g. using the aliasing effect to your advantage and undersample the signal) are investigated here and the possibilities of these receivers are large. However, it will probably take a long time until those are practically available for the WiFi frequency range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, your WiFi transceiver is most likely a direct-conversion architecture. In the digital domain of it, the data-carrying signal is generated. In case of 802.11n it is an OFDM modulated signal with up to 20/40MHz bandwidth. This signal is centered around 0Hz and hence cannot be transmitted as it is. This signal is called the baseband signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Digital/Analog-conversion, in a stage called a mixer, this signal is then upconverted to the final carrier frequency around 2.4GHz. In the spectrum, the signal is literally shifted from a center frequency of 0Hz to a center frequency of 2.4GHz. At this point, the signal is called a passband (or bandpass) signal. After amplification, this signal is then transmitted via the antenna.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the receiver side, the same happens the other way around. There is another mixer that downconverts the passband signal from 2.4GHz center frequency to a baseband signal at 0Hz center frequency. At this point, the signal has just a bandwidth of 20/40MHz and can easily be sampled in an A/D converter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What follows is demodulation, error correction and other digital processing to eventually show you pictures of cute kittens in your browser.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-08-11T12:19:38.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10273" PostTypeId="2" ParentId="10271" CreationDate="2013-08-11T12:23:02.790" Score="1" Body="&lt;p&gt;As you suggest, most wireless systems incorporate modulation at the transmitter side and demodulation at the receiver side. Modulation shifts the baseband signal $x(t)$ with (two-sided) bandwidth $B$ to the desired carrier frequency $\omega_0$:&#xA;$$&#xA;y(t) = x(t)cos(\omega_0t)&#xA;$$&#xA;Directly sampling the received signal $y(t)$ would require a sampling frequency $f_s \geq \omega_0/(2\pi) + B/2$ which is impractically high in many systems where the carrier frequency is in the Gigahertz range. Therefore demodulation is applied before sampling the receive signal:&#xA;$$&#xA;r(t)=y(t)cos(\omega_0t) = \frac{1}{2}x(t) + \frac{1}{2}cos(2\omega_0t)x(t)&#xA;$$&#xA;Note that $r(t)$ has to be lowpass filtered before sampling to remove the radio frequency part and to avoid aliasing. The resulting signal has a bandwidth of $B/2$ and can be sampled at a rate $f_s \geq B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the capabilities of digital-to-analog and analog-to-digital converters continously improve, the analog modulation and demodulation is replaced by a digital creation of $y(t)$ at tx side and sampling at a high rate at rx side in some systems. Especially so-called software defined radio (SDR) systems use this technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Analog mod/demod introduces some further requirements: the carrier frequency $\omega_0$ has to be recovered at transmitter side as the two oscillators in tx and rx will never run at the exact same frequency. In phase modulated systems also a phase recovery is required. Of course, the same is true for the sampling frequency in SDR systems.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-08-11T12:23:02.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10274" PostTypeId="2" ParentId="10269" CreationDate="2013-08-11T16:52:36.980" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;If you want to determine if the 2-5 narrowband frequencies are present use a matched filter with a threshold to determine their presence. In matlab the function is xcorr.&lt;/li&gt;&#xA;&lt;li&gt;If you want to determine what the noise level is when only signal is present, try filtering out the signal. Create a filter for each frequency then convolve the filters together to get a final filter.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2013-08-11T19:24:01.053" LastActivityDate="2013-08-11T19:24:01.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10275" PostTypeId="1" CreationDate="2013-08-11T17:51:44.347" Score="3" ViewCount="2652" Body="&lt;p&gt;I'm trying to recreate a gassuain pyramid using the following scales:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0chqr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seems to be two concepts used here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) When an image is halved, applying a gaussian kernel of σ will apply as 2σ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) When an image has a scale of σ, and a gaussian kernel of σ is applied, then the resulting image will have a scale of sqrt(2)*σ. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when I'm constructing the above scale space, I do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/77mKc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the sigmas shown are the sigma of the gaussian kernel applied to the image at the specified scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I implemented this in matlab with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i = 0:3 % Cycle over octaves - 4 total                    &#xA;    for j = 0:4 % Cycle over scales - 5 total&#xA;        if(i == 0 &amp;amp;&amp;amp; j == 0)&#xA;            % This is the first octave and first octave&#xA;            obj.gaussianpyramid{i+1,j+1} = blob_class_image.filt_gaussian(obj.gs,1/sqrt(2));&#xA;        elseif(i &amp;gt; 0 &amp;amp;&amp;amp; j == 0)&#xA;            % This is the first scale after the first&#xA;            % octave, take 3rd image from previous row&#xA;            obj.gaussianpyramid{i+1,j+1} = obj.gaussianpyramid{i,3}(1:2:end,1:2:end);&#xA;        else&#xA;            % These are second + scales. Take image from&#xA;            % previous column and apply the same scale&#xA;            obj.gaussianpyramid{i+1,j+1} = blob_class_image.filt_gaussian(obj.gaussianpyramid{i+1,j},sqrt(2)^(j-2));   &#xA;&#xA;            % Store logpyramid&#xA;            obj.logpyramid{i+1,j} = obj.gaussianpyramid{i+1,j+1} - obj.gaussianpyramid{i+1,j};&#xA;        end                        &#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the correct line of thinking? I've implemented this and when I look at the laplacian of guassian pyramid, it seems to skip over some scales. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: After some tests it appears I'm not able to implement #2) listed above, where two guassian convolutions with σ is the same as a single guassian convolution with sqrt(2)*σ. When I test it out and then substract the images, they are not the same...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT2: Also made a small mistake on calculating the sigmas. The above idea should be correct now. I double checked by comparing the scale obtained at σ = 22.627 by convolving the original image with a gaussian kernel of σ = 22.627 and then down sampling and comparing the two images and they appear to be the same.&lt;/p&gt;&#xA;" OwnerUserId="5206" LastEditorUserId="128" LastEditDate="2019-08-18T14:50:56.387" LastActivityDate="2019-08-18T14:50:56.387" Title="Creating a Gaussian Pyramid" Tags="|image-processing|matlab|sift|multi-scale-analysis|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10276" PostTypeId="2" ParentId="10265" CreationDate="2013-08-11T17:59:53.990" Score="2" Body="&lt;p&gt;Matched filtering, or cross-correlation, is a pretty cheap and easy way to determine the similarity between signals. Otherwise you could try implementing the algorithm &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf&quot; rel=&quot;nofollow&quot;&gt;Shazam&lt;/a&gt; uses.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-08-11T17:59:53.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10277" PostTypeId="2" ParentId="10267" CreationDate="2013-08-11T18:25:35.210" Score="8" Body="&lt;p&gt;I suppose I am answering off-topic here then, but for L1-optimization approaches, I find YALL1 (&lt;a href=&quot;http://yall1.blogs.rice.edu/&quot; rel=&quot;noreferrer&quot;&gt;http://yall1.blogs.rice.edu/&lt;/a&gt;) and SPGL1 (&lt;a href=&quot;http://www.cs.ubc.ca/~mpf/spgl1/&quot; rel=&quot;noreferrer&quot;&gt;http://www.cs.ubc.ca/~mpf/spgl1/&lt;/a&gt;) very useful and efficient packages. TFOCS (&lt;a href=&quot;http://cvxr.com/tfocs/&quot; rel=&quot;noreferrer&quot;&gt;http://cvxr.com/tfocs/&lt;/a&gt;) is probably a bit harder to use, but should be quite flexible. There is also CVX (&lt;a href=&quot;http://cvxr.com/cvx/&quot; rel=&quot;noreferrer&quot;&gt;http://cvxr.com/cvx/&lt;/a&gt;) which makes it very easy to type convex optimization problems directly into the code, but it is considerably slower for solving the compressed sensing-specific kind of problems since it is a very general solver. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also some reconstruction algorithms available in Sparselab (&lt;a href=&quot;http://sparselab.stanford.edu/&quot; rel=&quot;noreferrer&quot;&gt;http://sparselab.stanford.edu/&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A larger list of sparse reconstruction codes is listed here: &lt;a href=&quot;https://sites.google.com/site/igorcarron2/cs#reconstruction&quot; rel=&quot;noreferrer&quot;&gt;https://sites.google.com/site/igorcarron2/cs#reconstruction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1464" LastEditorUserId="-1" LastEditDate="2013-08-12T10:02:57.563" LastActivityDate="2013-08-12T10:02:57.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10278" PostTypeId="1" CreationDate="2013-08-11T19:00:57.443" Score="5" ViewCount="2818" Body="&lt;p&gt;I need to analyze some vibration data from accelerometers (g-Hz) but I don't quite understand the meaning of each component that the registered signal contains. Basically it is Magnitude and Phase. I'm able to get the Real/Imaginary parts from those two as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today I plotted Real vs Imaginary parts (Nyquist plot/diagram, correct me if I'm wrong). These are the results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/47y9S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vz0Bu.png&quot; alt=&quot;Magnitude&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dI6vX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ckHPe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Nyquist shows like a circular pattern, sometimes there are spirals, sometimes just random points. What could this mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second picture displays the Magnitude of this particular accelerometer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the third the raw Real/Imaginary parts are included. The Magnitude is the RSS of Re/Im parts. I've realized that I need to compare (divide by) this channel to the reference (the input or control channel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last one shows the chaotic Phase, it gets better if I do the same as at Re/Im parts: compare to the reference, in this case I subtract in order to get the gap between the input and my channel (output).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xLzW9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pink and green dashed lines are the Re/Im parts divided by the Re/Im parts of the reference (the input). The blue is the same but with Magnitude&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z6TNI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;The blue line is the subtraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be great if someone could help me to have some better understanding and interpretation of this kind of data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, is Argand diagram the same in essence as Nyquist?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: The vibration signal comes from a UFF (Universal File Format) dataset 58, the test consists in measuring the response of 50-100 accelerometers attached all around the structure to a sinusoidal motion (varying in frequency). There is an accelerometer situated in the base, so it is measuring the real input to the system (in g-Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hardware of the test transforms internally the response from g-s (time) to g-Hz with some kind of Fourier Transform algorithm I believe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the vibration may not be in phase with the input motion the gap between them is also measured. For example: a gap of 180 degrees between an accelerometer and the base means that if the shaker is going up in a particular instant, this accelerometer is going down.&lt;/p&gt;&#xA;" OwnerUserId="5160" LastEditorUserId="5160" LastEditDate="2013-08-14T19:07:25.967" LastActivityDate="2013-08-15T01:00:34.923" Title="What is the meaning of a Nyquist diagram in a vibration signal" Tags="|signal-analysis|frequency-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10279" PostTypeId="1" CreationDate="2013-08-11T19:43:28.790" Score="5" ViewCount="526" Body="&lt;p&gt;I am making a software model of an existing digital synthesiser and I have made audio recordings of single notes with particular parameter settings. I made a program in C++ which sends a MIDI sysex message to change the parameter in question, then triggers a MIDI noteon and noteoff message. The sound is recorded to a wav file. So I have several collections of 100 wav files for each parameter (the parameters in question have 100 steps).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the (easier) parameters I am looking at is LFO depth. The LFO is applied to the oscillator pitch. So I have 100 wav files with a square wave LFO modulating the oscillator pitch between a base pitch and another pitch that goes between base pitch (zero modulation) and base pitch+1 octave. I would like to write a script to work out precisely how many semitones/cents modulation occurs in each wav file. So I would like to end up with 100 numbers that I can use to map to modulation depth in my software model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone recommend a tool/and or libraries for doing this task? &lt;/p&gt;&#xA;" OwnerUserId="5207" LastActivityDate="2015-03-05T14:35:09.873" Title="how can I calculate pitch deviation in a large collection of audio files?" Tags="|matlab|python|pitch|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10280" PostTypeId="2" ParentId="10279" CreationDate="2013-08-11T20:16:35.240" Score="1" Body="&lt;p&gt;Use a very slow LFO to get very long segments of uniform pitch (this will allow you to use long analysis windows and counter 'border' effects), and use the simplest possible waveform for the oscillator to prevent octave errors in pitch detection. &lt;a href=&quot;http://aubio.org/&quot; rel=&quot;nofollow&quot;&gt;Aubio&lt;/a&gt; provides an implementation of the YIN algorithm which is fairly accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I personally doubt there's anything fancy going on here - it is very likely that the relationship between the LFO modulation depth and the pitch deviation in cents is linear.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-11T20:16:35.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10281" PostTypeId="2" ParentId="10269" CreationDate="2013-08-11T20:31:09.127" Score="2" Body="&lt;p&gt;Some possible approaches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Compute the DFT of the decay segment, locate the 2-5 partials, eliminate them, and sum the energy in the remaining bands to get the noise level.&lt;/li&gt;&#xA;&lt;li&gt;Fit a &quot;sum of exponentially damped sinusoids + noise&quot; model to your signal. This will actually give you the exponential decay factor for each partial, which I believe is the actual information you want to extract. And if you are only interested in the noise level, you don't even have to estimate all parameters of the model - just project on the noise subspace.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-11T20:31:09.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10282" PostTypeId="2" ParentId="10267" CreationDate="2013-08-11T21:46:32.283" Score="5" Body="&lt;p&gt;You may also want to check the Matlab UNLocBox: &lt;a href=&quot;http://unlocbox.sourceforge.net&quot; rel=&quot;noreferrer&quot;&gt;http://unlocbox.sourceforge.net&lt;/a&gt;&#xA;There are 4 compressive sensing scripts on the demo page: &lt;a href=&quot;http://unlocbox.sourceforge.net/doc/demos/index.php&quot; rel=&quot;noreferrer&quot;&gt;http://unlocbox.sourceforge.net/doc/demos/index.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5208" LastActivityDate="2013-08-11T21:46:32.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10283" PostTypeId="2" ParentId="10267" CreationDate="2013-08-12T03:42:02.490" Score="19" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://users.ece.gatech.edu/%7Ejustin/l1magic/&quot; rel=&quot;nofollow noreferrer&quot;&gt;L1magic&lt;/a&gt;. This is the toolbox associated with the &lt;a href=&quot;https://ieeexplore.ieee.org/document/1580791&quot; rel=&quot;nofollow noreferrer&quot;&gt;original paper.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://web.archive.org/web/20140829082731/https://www.cgran.org/wiki/CompSens&quot; rel=&quot;nofollow noreferrer&quot;&gt;CompSens&lt;/a&gt;. This looks like it's in C, but you could possibly call it with &lt;code&gt;mex&lt;/code&gt; -- not sure.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://web.archive.org/web/20161220213423/http://dsp.rice.edu/software/model-based-compressive-sensing-toolbox&quot; rel=&quot;nofollow noreferrer&quot;&gt;Model-based compressive sensing toolbox.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Most of the code is plain Matlab code&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Each folder in the package consists of a CS recovery algorithm based on a particular signal model, and a script that tests that recovery algorithm. The names of the scripts typically end with '_example.m'&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.manopt.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Manopt&lt;/a&gt;. Possibly what you use to actually make the algorithms included in other toolboxes.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Optimization on manifolds is a powerful paradigm to address nonlinear optimization problems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Some &lt;a href=&quot;https://web.archive.org/web/20210507003127/http://compsens.eecs.umich.edu/sensing_tutorial.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;examples&lt;/a&gt; from UMich.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.ceremade.dauphine.fr/%7Epeyre/matlab/sparsity/content.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sparsity&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;This toolbox implements several algorithms to compute sparse expansion in redundant dictionaries and to solve inverse problems with sparse regularization (and also TV regularization).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;But all of that, and more, is included in &lt;a href=&quot;http://thesisconcepts.com/compressed-sensing&quot; rel=&quot;nofollow noreferrer&quot;&gt;this list of toolboxes&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I've found the hard part is finding psuedocode -- that's where they actually describe the algorithm. Here are some examples of algorithms that included the psuedocode:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://conservancy.umn.edu/bitstream/150248/1/Sievert.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;one paper&lt;/a&gt; that includes the actual algorithm (and the actual code available &lt;a href=&quot;https://github.com/scottsievert/IRcamera/blob/master/IST.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; in the function &lt;code&gt;IST&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://web.archive.org/web/20150318234738/http://control.mines.edu:80/mediawiki/upload/f/f4/Beginners_code.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;a beginners guide to compressed sensing.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;ftp://ftp.math.ucla.edu/pub/camreport/cam11-08.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Orthogonal matching pursuit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.eecs.harvard.edu/%7Ehtk/publication/2012-globecom-gwon-kung-vlah.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;CS-KLT&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.microsoft.com/en-us/research/people/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Some more algorithms from Microsoft&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://people.engr.ncsu.edu/dzbaron/pdf/SignalRecoveryUniversalPriors.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;MCMC for universal CS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://infoscience.epfl.ch/record/179383/files/TamaRISC-CS_subVt_ASIP_VLSI-SoC_2012.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;An example&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://people.csail.mit.edu/chinmay/files/papers/cssp_twocol.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Compressive sensing of streams of pulses&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://web.archive.org/web/20210507010839/http://www.gaga4cs.org/GAGACS.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;GPU Accelerated Greedy Algorithms for Compressed Sensing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.spiedigitallibrary.org/conference-proceedings-of-spie/8750/1/Adaptive-compressive-sensing-camera/10.1117/12.2017881.short?SSO=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adaptive sensing camera&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cs.princeton.edu/%7Eschapire/papers/compress-game.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Compressive sensing meets game theory&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4112" LastEditorUserId="26573" LastEditDate="2022-06-12T22:23:21.293" LastActivityDate="2022-06-12T22:23:21.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10286" PostTypeId="1" CreationDate="2013-08-12T07:02:20.097" Score="1" ViewCount="188" Body="&lt;p&gt;I have two power plots. I am trying to normalize it for comparing them . So , do we normalize it after converting to db scale? or do we normalize the power as such?&lt;/p&gt;&#xA;" OwnerUserId="5210" LastActivityDate="2013-08-12T07:02:20.097" Title="when trying to nomalize a power plot , do we normalize it after converting it to db scale or before it?" Tags="|power-spectral-density|normalization|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10287" PostTypeId="1" AcceptedAnswerId="10291" CreationDate="2013-08-12T12:45:15.283" Score="4" ViewCount="236" Body="&lt;p&gt;Is there a formula to calculate the frequency of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Missing_fundamental&quot; rel=&quot;nofollow&quot;&gt;phantom fundamental&lt;/a&gt; based on the harmonics, and would this formula be applied directly to the energy bins of an FFT?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="29" LastEditDate="2013-08-19T21:57:26.093" LastActivityDate="2013-08-20T02:46:55.957" Title="Processing signals with phantom fundamentals" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10289" PostTypeId="1" AcceptedAnswerId="10294" CreationDate="2013-08-12T13:32:00.337" Score="3" ViewCount="115" Body="&lt;p&gt;Firstly I should state that my maths knowledge is limited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently designing an acoustics modelling application which uses a rectilinear &lt;a href=&quot;https://en.wikipedia.org/wiki/Finite-difference_time-domain_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;FDTD&lt;/a&gt; grid for modelling pressure variations - but I've become stuck upon trying to implement a fibrous layer boundary.  From &lt;a href=&quot;http://www.somasa.qub.ac.uk/~mvanwalstijn/reports/kkowalczyk.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kowalcyzk 2008&lt;/a&gt;, the fibrous boundary model is defined as a frequency domain continuous impedance filter $\xi_w(\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA; \rho(\omega) = 1.2 + [-0.0364({{\rho f} \over {\sigma}})^{-2} - j0.01144({{\rho f } \over {\sigma}})^{-1}]^{{1} \over {2}}&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA; K(\omega) = 101320{{j29.64 + [2.82({{\rho f} \over {\sigma}})^{-2} + j24.9({{\rho f } \over {\sigma}})^{-1}]^{{1} \over {2}}} \over {j21.17 + [2.82({{\rho f} \over {\sigma}})^{-2} + j24.9({{\rho f } \over {\sigma}})^{-1}]^{{1} \over {2}}}}&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA; Z _w(\omega) = [\rho(\omega)K(\omega)]^{{1} \over {2}}&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA; \Gamma(\omega) = j2\pi f[{{\rho(\omega)} \over {K(\omega)}}]^{{1} \over{2}}&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA; \xi _w(\omega) = {{Z_w(\omega)} \over {\rho c}} \coth [\Gamma(\omega)d]&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Boundaries are implemented in the grid edge nodes as discrete time domain IIR filters of arbitrary order.  The few resources I've read on the subject have transfer functions that consist of a ratio of polynomials in terms of $s$ or $z$ - so I have no idea where to start on converting this filter, any clues?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read this &lt;a href=&quot;https://dsp.stackexchange.com/questions/2445/how-to-estimate-a-transfer-function-from-a-magnitude-only-frequency-response&quot;&gt;post&lt;/a&gt;, but I don't know if there's simpler solution for my circumstance.&lt;/p&gt;&#xA;" OwnerUserId="5213" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-08-19T17:58:50.473" Title="Build discrete IIR from a transfer function which is not in terms of $s$" Tags="|filter-design|transfer-function|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10290" PostTypeId="1" CreationDate="2013-08-12T13:45:46.643" Score="2" ViewCount="1350" Body="&lt;p&gt;I have got a txt file which contains voltage and time data. When I did fourier transform using fft function in matlab I got complex numbers. I understand that the real part is the magnitude and the imiginary part is phase. How can I determine whether there is any aliasing by looking at that complex numbers? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question I would like to ask is whether there is any relation between third harmonic and aliasing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks...&lt;/p&gt;&#xA;" OwnerUserId="5215" LastEditorUserId="5215" LastEditDate="2013-08-12T13:54:50.180" LastActivityDate="2013-08-12T15:09:10.633" Title="FFT and aliasing" Tags="|fft|sampling|aliasing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10291" PostTypeId="2" ParentId="10287" CreationDate="2013-08-12T14:36:17.107" Score="5" Body="&lt;p&gt;Methods for estimating a fundamental pitch frequency (missing or not) from an FFT result containing a series of harmonics include finding maxima in a cepstrum, the harmonic product  spectrum method, and looking for clusters in histograms of the distances between frequency pairs of higher order frequency peaks that fit within psycho-acoustic filter bandwidths..  These are all more estimation algorithms that post-process an FFT result, rather than a simple formula.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-13T18:59:49.390" LastActivityDate="2013-08-13T18:59:49.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10292" PostTypeId="2" ParentId="10290" CreationDate="2013-08-12T15:09:10.633" Score="2" Body="&lt;p&gt;Both the real (even or cosine correlation) and the imaginary (odd or sine correlation) components of an FFT result are required to calculate the 2D vector magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, you can't determined if a set of samples contains aliasing without knowing something about the signal before it was sampled, such as the signal's bandwidth vs. the sample rate and the cutoff frequency of any pre-filtering.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-12T15:09:10.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10293" PostTypeId="1" CreationDate="2013-08-12T15:14:23.307" Score="7" ViewCount="10554" Body="&lt;p&gt;whats is the effect of pading zeroes to a sequence in FFT?&#xA;for eg: x[n]=[2 3 4 5] corresponds to X[K]=[14 -2+2i -2 -2-2i]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while x[n]=[2 3 4 5 0 0 0 0] corresponds to X[K]=[14 0.58-9.65i -2+2i -3.414+1.65i -2 3.414-1.65i -2-2i 0.58+9.65i]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so what is the relation between X[0] , X[1] and X[2] in the new sequence?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;please help&lt;/p&gt;&#xA;" OwnerUserId="5216" LastActivityDate="2013-08-13T21:10:11.827" Title="Zero Padding in FFT" Tags="|zero-padding|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10294" PostTypeId="2" ParentId="10289" CreationDate="2013-08-12T15:23:47.050" Score="2" Body="&lt;p&gt;There exist genetic and evolutionary algorithms that attempt to guess and optimize a set of pole/zero placements that approximate an arbitrary frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a algorithm called Frequency Domain Least Squares : &lt;a href=&quot;http://www2.units.it/ramponi/teaching/DSP/materiale/ES_5_2.m&quot; rel=&quot;nofollow&quot;&gt;http://www2.units.it/ramponi/teaching/DSP/materiale/ES_5_2.m&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The poles and zeros found can then be used to create an IIR recurance function.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-12T15:23:47.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10295" PostTypeId="2" ParentId="10293" CreationDate="2013-08-12T15:28:38.267" Score="17" Body="&lt;p&gt;All that is happening when you zero-pad the input signal prior to a DFT, is that you are interpolating the frequency domain representation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you might get a certain shape as the output of your absolute magnitude of the DFT, and this shape has 10 points. If you zero-padded the input of your DFT to say, 100 points, you will get the same shape as before, but it will have more points, and will look smoother. That is all a zero-padding does for you. One may ask what type of relationship, and this relationship is simply a sinc-interpolation relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A picture is worth a thousand words, so here you go: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oy4Kh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the shape of the DFT output (magnitude in this case) remains the same, but the granularity increases. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;People will usually zero-pad for a variety of reasons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Peak picking: A smoother DFT output allows a peak-picking algorithm to gain more accuracy as to the frequency of the actual peak.&lt;/li&gt;&#xA;&lt;li&gt;Interpolation in the frequency domain for further processing downstream&lt;/li&gt;&#xA;&lt;li&gt;Linear Convolution: If linear convolution is sought, then performing it as a multiplication of two spectra in the frequency domain means that the DFT outputs must be of length $N+M-1$, where $N$ is the length of the first signal, and $M$ is the length of the second signal it is being convolved with.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-08-13T21:10:11.827" LastActivityDate="2013-08-13T21:10:11.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10296" PostTypeId="2" ParentId="10293" CreationDate="2013-08-12T15:30:49.060" Score="0" Body="&lt;p&gt;They are more closely spaced high quality interpolations of the non-zero padded FFT result.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-12T15:30:49.060" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10298" PostTypeId="2" ParentId="10293" CreationDate="2013-08-12T17:22:32.160" Score="3" Body="&lt;p&gt;Zero padding in the time domain corresponds to interpolation in the frequency domain (and vice versa). The specific relationship is sync interpolation, sometimes also known as Whittaker-Shannon interpolation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of the FFT the linear integral/sum has to be replaced with a circular sum. The formula works for both real and complex numbers.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-08-12T17:22:32.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10300" PostTypeId="1" AcceptedAnswerId="10302" CreationDate="2013-08-12T23:59:27.600" Score="1" ViewCount="437" Body="&lt;p&gt;I have a signal with 262144 samples and &quot;sampled&quot; with 200Msps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use the cwt (Continuous Wavelet Transform), for making a time-frequency scalogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I worked in some scripts in python and Matlab, but it's very hard for the machine for make the process and empty the memory of the computer with 262144 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The codes and examples than I run, only work with 1024 samples... 512 samples, and it's very simple for the computer to work with it. But for 262144 SAMPLES !, a 1D signal, it's impossible to work well and output a great scalogram (It's the target).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal has frequencies around 10KHz, 20KHz... 200KHz, 1MHz... 2MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really comfortable with Python language, very powerfull and great for data mining, also Matlab, but not eficient in memory use... I think...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards and I waiting any suggestions or code in Python, also toolboxes in Python.&lt;/p&gt;&#xA;" OwnerUserId="5218" LastActivityDate="2013-08-13T04:25:28.303" Title="Impossible to make a scalogram of a signal with 262144 samples" Tags="|wavelet|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10301" PostTypeId="1" CreationDate="2013-08-13T02:48:52.563" Score="3" ViewCount="303" Body="&lt;p&gt;I'm working on improving the modem communication speed that can be achieved over a 10km cable. The current modem achieves a speed of 9600 bps via hardware (phase locked loop) and I'm looking for ways to at least double this, and do it all in firmware. Here are some specs for the project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Cable characteristics&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Length: 10,000m &lt;/li&gt;&#xA;&lt;li&gt;Capacitance: 1.48μF (148pF/M) &lt;/li&gt;&#xA;&lt;li&gt;Resistance: 320 Ω (32 Ω/km)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Driver signal&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;10 Vpp (+10 V to -10 V) @ 250 mA&lt;/li&gt;&#xA;&lt;li&gt;Can be used for Amplitude and Frequency modulation&lt;/li&gt;&#xA;&lt;li&gt;Currently cannot perform phase modulation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Available bandwidth on cable&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;30 KHz to 100 KHz&lt;/li&gt;&#xA;&lt;li&gt;Attenuation: 100KHz signal results in a third of the amplitude of the 30KHz signal&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Current method of modem communications (want to improve)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A hardware implemented Phase Locked Loop (PLL)&lt;/li&gt;&#xA;&lt;li&gt;Achieves a speed of 9600 bps&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The aim is to improve the 9600 bps speed and also to implement the modem in firmware. The firmware target is an &lt;a href=&quot;http://www.infineon.com/cms/en/product/microcontrollers/32-bit-xmc-industrial-microcontrollers-arm%C2%AE-cortex%E2%84%A2-m4/channel.html?channel=db3a30433580b3710135a03abaf9385e&quot; rel=&quot;nofollow&quot;&gt;ARM based 32-bit microcontroller - Infineon's XMC4500 with onboard ADC&lt;/a&gt; (firmware to be written in C). I have a working prototype, but the best I can achieve so far is 10,500 bps which is only a small improvement over the current system. The method used was to implement FSK demodulation using the &lt;a href=&quot;http://www.cs.washington.edu/education/courses/cse466/12au/calendar/Goertzel-EETimes.pdf&quot; rel=&quot;nofollow&quot;&gt;Goertzel algorithm&lt;/a&gt;. I was detecting 4 frequencies in the range of 40KHz to 80Khz, which gives 2 bits per signalling period. On the microcontroller performance, I've found that 4 frequencies is the maximum number that can be attempted using the Goertzel method. Also the microcontroller ADC's practical maximum sampling rate is 700 KHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a suggestion how to achieve a decent speed improvement using frequency and/or amplitude modulation with such limitations as these? I'm new to DSP so I've likely missed some other better techniques that could be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PROGRESS UPDATE (10/10/2013)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since posting this question and after some simulation and testing, the communications scheme has been changed to be asymmetrical since only the downlink side actually needed to be upgraded. The uplink speed remains as is - a PLL running at 9600 bps, but the downlink speed ends up being a faster ~64,000 bps, with the downlink demodulator hardware running on something equivalent to PC level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This hardware upgrade enables the use of an FFT and an 8-bit symbol using 8 frequencies. The FFT parameters being used are a sample rate of 512,000 SPS and a number of bins of 64. The frequencies being detected are in the range of 32,000 Hz and upwards, with a spacing of 8,000 Hz. The ADC is 12-bit. I've also implemented Reed-Solomon forward error correction, which may be used to reduce error rates.&lt;/p&gt;&#xA;" OwnerUserId="5211" LastEditorUserId="5211" LastEditDate="2013-10-10T07:38:09.117" LastActivityDate="2013-10-10T07:38:09.117" Title="Improving the communication speed on a 10km cable (with high capacitance)" Tags="|algorithms|modulation|demodulation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10302" PostTypeId="2" ParentId="10300" CreationDate="2013-08-13T04:25:28.303" Score="0" Body="&lt;p&gt;Usually this is done by chopping a long signal into shorter windows, doing the transform on each window, then recombining the results.  For finding 10 kHz signals from 200 Msps data, you will need either longer windows than 1k samples, or to downsample the data before doing the transform.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-13T04:25:28.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10303" PostTypeId="1" CreationDate="2013-08-13T06:33:26.780" Score="4" ViewCount="241" Body="&lt;p&gt;I know there are lots of papers proposing algorithms for the problem of reconstructing a signal from modulus of its Fourier Transform (so-called &lt;em&gt;Phase Retrieval&lt;/em&gt; Problem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, recently it is studied for the case of sparse signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know whether there is any paper or survey working on &quot;reconstruction of signal from modulus of its DFT&quot; or equivalently, reconstruction of signal from its circular auto-correlation ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there a way we can relate these two problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: The prior information I have is :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Time-domain signal is positive-valued.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Time domain signal is zero in some points, i.e. signal has a support $P \subset \{0,1,2,\cdots,N-1\}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5104" LastEditorUserId="5104" LastEditDate="2013-08-15T04:26:15.060" LastActivityDate="2013-08-15T04:26:15.060" Title="A kind of Phase Retrieval problem" Tags="|discrete-signals|fourier-transform|dft|compressive-sensing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10305" PostTypeId="2" ParentId="10268" CreationDate="2013-08-13T09:58:04.340" Score="6" Body="&lt;p&gt;you can have a look at the LTFAT's wavelet module&#xA;&lt;a href=&quot;http://ltfat.sourceforge.net/doc/wavelets/index.php&quot; rel=&quot;noreferrer&quot;&gt;http://ltfat.sourceforge.net/doc/wavelets/index.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it runs in Matlab/Octave with backend written in C. It has fairly large database of wavelet filters and new ones can be added easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What exactly do you mean by &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) Ability to run in parallel - VERY IMPORTANT&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Should the computation itself be somewhat parallelized or that it should be possible to run several batches of FWT calculations? I guess that running several instances of Octave should do the trick in the latter case.&lt;/p&gt;&#xA;" OwnerUserId="5222" LastActivityDate="2013-08-13T09:58:04.340" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10306" PostTypeId="1" CreationDate="2013-08-13T16:39:35.063" Score="12" ViewCount="2702" Body="&lt;p&gt;This is probably off-topic since it isn't really a question, but I thought that this GIF of the fourier series of a square wave was too cool not to share.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GfyoT.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-11-15T11:12:01.127" Title="Graphical fourier series of a square wave" Tags="|fourier-series|" AnswerCount="1" CommentCount="7" CommunityOwnedDate="2013-11-15T19:14:56.183" ContentLicense="CC BY-SA 3.0" />
  <row Id="10308" PostTypeId="2" ParentId="10303" CreationDate="2013-08-13T18:47:40.053" Score="4" Body="&lt;p&gt;Problems such as those are closely related to &quot;inverse problems&quot;, whereby one attempts to reconstruct a signal from an under-determined system of equations, (ill-posed problems) given some &lt;em&gt;apriori&lt;/em&gt; information. As @Hilmar mentioned, you cannot reconstruct phase information from the absolute magnitude of a DFT, unless you have prior information that constrains you. For example, in the paper you mention, the author states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Both the problem of phase&#xA;  retrieval from &lt;strong&gt;two&lt;/strong&gt; intensity measurements (in electron microscopy or&#xA;  wave front sensing) and the problem of phase retrieval from a single&#xA;  intensity measurement &lt;strong&gt;plus a non-negativity constraint&lt;/strong&gt; (in astronomy)&#xA;  are considered, with emphasis on the latter. It is shown [...]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The bold is mine. Even in the paper you allude to, there are constraints that then allow for a Maximum Likelihood framework to be applied, or one where sparsity is rewarded, etc. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Edit: The prior information I have is : Time-domain signal is&#xA;  positive-valued. Time domain signal is zero for in some points, i.e.&#xA;  signal has a support P⊂{0,1,2,⋯,N−1}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All your signal being positive valued is irrelevant to the phase information of the entire DFT spectrum. To see this, consider this following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that having an all positive signal $x[n]$ means you are guaranteed to have a DC bias. This means that the first bin in the absolute magnitude of you DFT corresponding to $|X(0)|$ will be strictly positive. Let us split the input signal into its zero-mean partition, ($z[n]$) plus the mean value, $m$. Then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = z[n] + m$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT of the result is, (exploiting the linearity property of the DFT):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \sum_{n=0}^{N-1} x[n] \ e^{-j \frac{ \Large 2 \pi n k }{N}} = \sum_{n=0}^{N-1} \Big[z[n] + m \Big] \ e^{-j \frac{ \Large 2 \pi n k }{N}} = \sum_{n=0}^{N-1} z[n] \ e^{-j \frac{ \Large 2 \pi n k }{N}} + \sum_{n=0}^{N-1} m \ e^{-j \frac{ \Large 2 \pi n k }{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that the DFT is nothing but a projection of your signal $x[n]$ onto an orthogonal basis set composed of complex exponentials. Save for the DC component at $k=0$, all the complex sinusoids have mean $0$. Thus the second term $\sum_{n=0}^{N-1} m \ e^{-j \frac{ \Large 2 \pi n k }{N}}$ completely vanishes for all $k \ne 0$. Hence, we can now write the DFT of $x[n]$ as being:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \left\{ &#xA;  \begin{array}{l l}&#xA;     \sum_{n=0}^{N-1} z[n] \ e^{-j \frac{ \Large 2 \pi n k }{N}} + mN = mN &amp;amp; ,k = 0\\&#xA;    \sum_{n=0}^{N-1} z[n] \ e^{-j \frac{ \Large 2 \pi n k }{N}} &amp;amp; , k \ne 0&#xA;  \end{array} \right. &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This then shows that your signal always being positive is completely irrelevant to the phase signal spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, this prior information ($x[n] \ge 0, n \in 0, 1, ... N-1$) is irrelevant, and no recovery is possible given $|X[k]|$, with only this constraint.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You are right in that these types of problems have some solutions to them, but it is also important for you to also remember that you have to define your constraints before you can solve for your unknown entities. That is, you have to give prior information that you can utilize. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a simple example, given the absolute magnitude vector $|X(f)|$, there is an infinite number of possible solutions to what values $\angle X(f)$ can take on. However, if you &quot;know&quot; before hand that, say, all the imaginary co-efficients of $X(f) \in \mathfrak{C} $ are zero, then we can easily recover what the real co-efficients are up to a sign ambiguity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The take home message however, is what prior information do you have, and how is it related to the DFT. Hope this helped.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-08-14T18:49:26.733" LastActivityDate="2013-08-14T18:49:26.733" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10309" PostTypeId="1" AcceptedAnswerId="10313" CreationDate="2013-08-14T00:40:28.967" Score="1" ViewCount="3464" Body="&lt;p&gt;I hope this isn't a dublicate . I checked but maybe didn't see everything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here goes : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been scratching my head over some EQ related questions. I read a lot of papers but my limited math and DSP knowledge prevents me from fully understanding them, so I thought I'd ask the experts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hghave a good library (&lt;a href=&quot;http://www.kvraudio.com/forum/viewtopic.php?t=249926&quot; rel=&quot;nofollow&quot;&gt;http://www.kvraudio.com/forum/viewtopic.php?t=249926&lt;/a&gt; in case you wonder) of standalone filters. There are biquad filters and higher order filters. From that, I'd like to create an equalizer. This is C++ but I don't think it's relevant;. My questions refer to the signal processing side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Can I just casacade the filters : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;input signal -&gt; processed through f1 -&gt; ... -&gt; processed through fn -&gt; output signal ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Given that filters are not perfect, does the order matters ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Do you know how I can calculate the transfer curve of the EQ, from each filter's transfer curve ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Finally, what kind of filter is best ? From what I read, I think it's better to use high order filters instead of quadratic, so I think I should use Butterworth or Chebyshev filters. Am I right ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently a bit lost so thanks for ANY insight ! What I would like is to maximize the sound quality 9i.e : make a transparent eq, nothing too fancy) , even if the CPU cost is high, or even better, provide options like optimise for speed/optimise for quality&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. : If you've got what it takes to create this, and you're interested in contract work, please feel free to contact me.&lt;/p&gt;&#xA;" OwnerUserId="710" LastActivityDate="2021-11-27T23:09:13.177" Title="Making an EQ from cascading filters" Tags="|filter-design|equalization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10310" PostTypeId="1" AcceptedAnswerId="10314" CreationDate="2013-08-14T00:40:32.957" Score="4" ViewCount="1319" Body="&lt;p&gt;I'm reading an article about &lt;code&gt;multi-scale&lt;/code&gt; representation of image, and it is said that, convolving the image with a &lt;em&gt;Gaussian&lt;/em&gt; kernel at different $\sigma$, then different scale representation is created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This really confuses me, because I think the image is just blurred by &lt;em&gt;Gaussian&lt;/em&gt; with different $\sigma$, each blurred version still has the same image size, so I don't think they're scaled, unless each blurred is &lt;strong&gt;downsampled&lt;/strong&gt; to a smaller image size, which means I think different &lt;strong&gt;size&lt;/strong&gt; representation is truely the &lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="128" LastEditDate="2018-06-01T16:12:06.990" LastActivityDate="2018-06-01T16:12:06.990" Title="What Does Multi Scale Image Analysis Mean?" Tags="|image-processing|image-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10312" PostTypeId="2" ParentId="10309" CreationDate="2013-08-14T01:27:23.093" Score="3" Body="&lt;p&gt;The answer depends a bit on how fancy you want to get. Let's say you want to do a quick and dirty octave band graphic EQ: The easiest way to do this is to cascade individual filters. Using the &amp;quot;peakingEQ&amp;quot; type described in &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.w3.org/TR/audio-eq-cookbook/&lt;/a&gt; you can actually get a fairly decent octave band filter with a Q of about 2.8 (2*sqrt(2)). If you want to support 10 bands, you need to cascade 10 biquads. one for each band. Whenever a gain gets updated you then re-calculate the filter coefficients for that particular biquad as described in the cookbook. The nice thing about the structure is that for every band that's &amp;quot;neutral&amp;quot; the amplitude is completely flat and there is no phase distortion. It's also very cheap in terms of CPU.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="4346" LastEditDate="2021-11-27T23:09:13.177" LastActivityDate="2021-11-27T23:09:13.177" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10313" PostTypeId="2" ParentId="10309" CreationDate="2013-08-14T01:39:43.073" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Can I just casacade the filters :&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;input signal -&gt; processed through f1 -&gt; ... -&gt; processed through fn -&gt; output signal ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yep, that's how you do it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) Given that filters are not perfect, does the order matters ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Probably not.  You're probably working with ≥32-bit floats on a computer processor?  So you don't really need to worry about clipping or noise floor issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hardware DSPs are often in fixed-point formats, so they can clip and then it matters because you don't want to boost a frequency to the point of clipping and then attenuate it with a subsequent filter, or cut a frequency down into the noise floor and then boost it back up, dragging the noise up with it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;3) Do you know how I can calculate the transfer curve of the EQ, from each filter's transfer curve ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you mean &quot;frequency response&quot;, just multiply them together.  Or convert them to dB and then add them together. dB is logarithmic, so it converts multiplication into addition.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;4) Finally, what kind of filter is best ? From what I read, I think it's better to use high order filters instead of quadratic, so I think I should use Butterworth or Chebyshev filters. Am I right ? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, you should always use biquad filters and combine them in cascade to make higher-order filters.  If you search for &quot;second-order sections&quot; you can find instructions for making higher-order Butterworth and Chebyshev filters this way.  This minimizes numerical error from some intermediate numbers being extremely large while others are extremely small.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-08-14T01:39:43.073" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10314" PostTypeId="2" ParentId="10310" CreationDate="2013-08-14T02:21:06.473" Score="2" Body="&lt;p&gt;The larger the σ of the blur kernel, beyond an amount intrinsic to the image, the more the image is low-pass filtered and thus suitable for downsampling with little additional loss of information due to aliasing.  This use of the term &quot;scale&quot;  seems to relate to the remaining information content or to the size to which an image is suitable for downsampling without significant additional filtering.  Here, scale is not just the current number of pixels, which may be larger (but carry little additional information).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-14T02:21:06.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10316" PostTypeId="1" AcceptedAnswerId="10317" CreationDate="2013-08-14T10:37:47.290" Score="2" ViewCount="2485" Body="&lt;p&gt;I'm new to signal processing and I'm learning on my own. Therefore I might ask questions not worthwhile your time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I'm trying to figure out the concept of a lowpass filter.&#xA;Using matlab I created a complex signal x:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1,1000)+rand(1,1000) .* 1i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And i created a filter Num with the fdatool, the specifications of Num are :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;  % Sampling Frequency&#xA;&#xA;Fpass = 460;             % Passband Frequency&#xA;Fstop = 500;             % Stopband Frequency&#xA;Dpass = 0.057501127785;  % Passband Ripple&#xA;Dstop = 0.0001;          % Stopband Attenuation&#xA;dens  = 20;              % Density Factor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From what I understood I had to do now. I tried to do the Convolution of Num and x in the frequency domain by multiplication of the vectors.  Step by Step I did this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First I padded Num to the same length that x has.&lt;/li&gt;&#xA;&lt;li&gt;Then I multiplied x and Num, to get y= Num * x;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now y should have nearly no frequencies above 500, right?&#xA;If I check the signal there doesn't seem have happened a lowpass filtering.&lt;/p&gt;&#xA;" OwnerUserId="5187" LastEditorUserId="29" LastEditDate="2013-08-16T13:38:00.430" LastActivityDate="2013-08-16T13:38:00.430" Title="low pass filter after fft in matlab" Tags="|matlab|convolution|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10317" PostTypeId="2" ParentId="10316" CreationDate="2013-08-14T11:21:27.197" Score="4" Body="&lt;p&gt;It appears you're getting a bit lost between the time and frequency domains. If &quot;Num&quot; is the numerator of an FIR filter (as it appears), these are the coefficients (or impulse response) of your filter. The impulse response as a signal exists in the time domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to perform a filtering operation using this impulse response (or filter kernel as some call it), you should perform a convolution (conv) between it and the signal you wish to filter in the &lt;strong&gt;time domain&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impulse response you've created has an equivalent frequency domain response (which you will have seen in fdatool).  The time domain convolution described above is equivalent to &lt;strong&gt;multiplying&lt;/strong&gt; this frequency-domain response by the frequency-domain representation of your input signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your signal x is complex I assume you mean it to a frequency-domain representation of some 'noise' signal. This representation in itself is strange, and it doesn't represent a 'white' noise signal, but a purely random arrangement of frequency and phase that I find it difficult to conceive.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to observe low pass filtering I would suggest the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a pure real (no 'i' component) noise signal in the &lt;strong&gt;time domain&lt;/strong&gt; using rand (remember that rand produces values in the range 0-&gt;1, you will need to scale and shift it to create a signal in the range -1 -&gt; 1).  This signal will in theory be purely white, and hence have a flat magnitude response in the frequency domain (i.e. it would be a straight line).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Convolve this signal with your filter impulse response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could consider this operation to be equivalent to multiplying the response of your filter (that you saw in FDATool..) by the frequency domain of the input signal (which is effectively constant). The result should be a scaled version of your familiar low-pass filter response (although some other effects such as the trade-offs in your filter design come into play).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The output of this procedure is still in the time domain, so if you perform an FFT or some other transform to convert to the frequency domain, you can then plot it, and observe the low-pass filtering effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck for your learning :)&lt;/p&gt;&#xA;" OwnerUserId="369" LastActivityDate="2013-08-14T11:21:27.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10318" PostTypeId="1" CreationDate="2013-08-14T12:58:44.383" Score="1" ViewCount="102" Body="&lt;p&gt;i have my output as vector of 60000 complex number representing 10 sequence in frequency domain , each of length 6000. i need to plot the phase and amplitude of intermodulation distortion from this output. can anyone suggest me how it can be done. i tried with magnitude and angle unwrap in matlab selecting particular bins in a particular sequence where the IMD tones are located but it seems its not working. Can anyone offer a different approach? ITS urgent :(&lt;/p&gt;&#xA;" OwnerUserId="5226" LastEditorUserId="5226" LastEditDate="2013-08-14T13:19:35.063" LastActivityDate="2013-08-14T13:19:35.063" Title="how to plot amplitude and phase of IMDs from their fft values?" Tags="|fft|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10319" PostTypeId="1" AcceptedAnswerId="10323" CreationDate="2013-08-14T13:21:44.197" Score="4" ViewCount="914" Body="&lt;p&gt;I recently read that with compressive Sensing it possible to sample the signal at a rate lesser than that suggested by Nyquist Criterion. However, I am still not getting how this is possible. Can someone suggest an intuitive way of understanding this concept of sampling at lower rates? And if this is possible, do modern communication techniques use this concept?&lt;/p&gt;&#xA;" OwnerUserId="4708" LastEditorUserId="1464" LastEditDate="2013-08-26T12:33:06.870" LastActivityDate="2015-10-15T20:09:21.220" Title="Regarding the Nyquist Criterion" Tags="|sampling|compressive-sensing|nyquist|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10320" PostTypeId="2" ParentId="10319" CreationDate="2013-08-14T14:07:48.660" Score="3" Body="&lt;p&gt;Yes, it is possible to sample and reconstruct a signal at sampling frequency lower than the Nyquist Criteria. For that, the signal has to be sparse in some representation basis. Then it is absolutely possible to reconstruct the signal with a certain probability in having an error in reconstruction. Please refer to Terrence Tao's work in this regard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, CS ( Compressive Sampling ) has already been used for recovering MRI images, and also EPFL has done real-time CS sampling and reconstruction of ECG signals. Please refer to &lt;a href=&quot;http://nuit-blanche.blogspot.nl/&quot; rel=&quot;nofollow&quot;&gt;Igor Carron's blog&lt;/a&gt; for more such applications. &lt;/p&gt;&#xA;" OwnerUserId="4902" LastActivityDate="2013-08-14T14:07:48.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10321" PostTypeId="1" AcceptedAnswerId="10322" CreationDate="2013-08-14T15:19:31.660" Score="3" ViewCount="4130" Body="&lt;p&gt;I'm wondering if someone can clear the following up for me as I'm having a difficult time understanding the concept. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to implement and learn about the processes and uses using short-time Fourier transforms. I have had experience using DFT's and wanted to expand my knowledge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From research that I have read online, as well as in some text books I understand that the STFT is calculated by the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Take the inputted signal of $x[n]$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiply $x[n]$ by a window function (e.g. Hamming, Hanning, Triangular, .., Barlett) by sliding the block size over the time axis &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the DFT for the resulting values of step 2&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is this correct? I know the following steps above are for usually a continuous-time STFT and in the case of a Discrete-time STFT the data can be broken up into chunks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other thing that is confusing me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a project last year, I had to implement a MFCC algorithm. Inside this algorithm I computed the &quot;Mel Scale&quot; in Triangular filter bank and then multiplied each of these values against the FFT (DFT) computed on the inputted signal in Discrete-Time. Is this therefore a use of the STFT, just using the Mel-Frame over Hamming etc.. Or, would I still need to multiply the result of the FFT (DFT) with the Triangular filter bank if I was to use a STFT in order to calculate the MFCC values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank yo for reading. &lt;/p&gt;&#xA;" OwnerUserId="1810" LastEditorUserId="1629" LastEditDate="2016-08-23T10:58:00.450" LastActivityDate="2016-08-23T10:58:00.450" Title="Confusion with regards to STFT and MFCCs" Tags="|discrete-signals|dft|continuous-signals|stft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10322" PostTypeId="2" ParentId="10321" CreationDate="2013-08-14T15:46:12.020" Score="7" Body="&lt;p&gt;I am going to break down this answer into two main parts, one for a step-by-step computation of the STFT, and the other in regards to how to compute the MFCC's, once you have the STFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;STFT:&lt;/strong&gt; Let us say you wanted to compute the STFT of your signal $x[n]$, of total length $N=100$, and block size $M = 10$, with $50$% overlap, and using a hamming window. I will give you a step by step, (and redundant) flow, to get you started:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take the first $M=10$ samples out, that is, samples $x[0], x[1], x[2] ...  x[9]$.&lt;/li&gt;&#xA;&lt;li&gt;Window them, by multiplying them, element by element, with your window coefficients.&lt;/li&gt;&#xA;&lt;li&gt;Take the DFT of this result. &lt;/li&gt;&#xA;&lt;li&gt;Take the next $M=10$ samples out, that is, samples $x[5], x[6], x[7], ... x[14]$.&lt;/li&gt;&#xA;&lt;li&gt;Window them, by multiplying them, element by element, with your window coefficients.&lt;/li&gt;&#xA;&lt;li&gt;Take the DFT of this result. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;etc, etc. You get the idea. Let us say that you took a (same size) DFT in the above example. Then, you will end up with a $10$ x $19$ complex matrix. If you then simply take the absolute magnitude of the above matrix, you will end up with a real matrix, corresponding to the absolute magnitude of your complex matrix. This is called the Short-Time-Fourier-Transform, or STFT. We will use the STFT as the input into computation of the MFCCs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before that, let us get some formulas and terminology straight: Let us call our STFT matrix $S$. This matrix is composed of $B=19$ blocks, or columns, and $K=10$ frequency bands, or rows. To refer to a time-frequency point in $S$, we will say $S[k,b]$, where $b \in 1, 2, ... B$, temporal blocks, (columns) and $k \in 1, 2, ... K$ sub-bands, (rows). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MFCC:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the STFT computed, you can go ahead and use that as a stepping stone for computing the MFCC's. Regarding your question, you seem to be confusing the &lt;em&gt;time domain&lt;/em&gt; windowing done on each block for the STFT, and the &lt;em&gt;frequency domain&lt;/em&gt; windowing done in the MFCC. They are completely separate and unrelated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us say that you computed your STFT using a hamming window, and you have a $K=500$ x $B=1000$ real matrix. Thus using our prior terminology, you have a real matrix $S_{K \text x B}$.  Thus, you have $500$ sub-bands, (frequencies), and $1000$ blocks, (time). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $Y_{b}[k] = |S[k,b]|^2$. That is, we are letting $Y_{b}[k]$ represent the power-spectral density of a particular column/block of the STFT matrix $S$. Obviously, each $Y_{b}[k]$ is a $500$ x $1$ column vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, we have $1000$ $Y$'s. That is, we have $Y_{1}[k], Y_{2}[k], Y_{3}[k], ... Y_{1000}[k]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you want to compute the MFCC of &lt;em&gt;each&lt;/em&gt; column. Take the first column. This is $Y_{1}[k]$. &lt;strong&gt;Forget about all the other columns, and forget about the hamming window&lt;/strong&gt;. The first column is now used in your MFCC algorithm. The first step in MFCC was getting a PSD column, which you have, because we have $Y_{1}[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second step is the computation of, say, 10 power estimates. This is computed by windowing &lt;strong&gt;this column&lt;/strong&gt;, by 10 overlapping windows, as per the mel-scale, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aFAWI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note how each (triangular) window is mostly zeros. So now you literally do a dot product of each window, with $Y_{1}[k]$. You will get $10$ numbers, &lt;strong&gt;for this column&lt;/strong&gt;. Now take the log of those $10$ numbers. Now take the DCT of this result. Congratulations! You just computed the MFCC for &lt;strong&gt;this column&lt;/strong&gt;. You just computed the MFCCs for $Y_{1}[k]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, go back, and repeat for all the other $Y_{2}[k]$. Then repeat for $Y_{3}[k]$, etc.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-08-15T01:39:34.197" LastActivityDate="2013-08-15T01:39:34.197" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10323" PostTypeId="2" ParentId="10319" CreationDate="2013-08-14T16:41:26.023" Score="7" Body="&lt;p&gt;The Nyquist criteria refers not to the frequency, but to the bandwidth, which is related to information density in a signal.  A very high frequency signal, of approximately known frequency, with a sufficiently small bandwidth, will still be aliased or folded down with baseband frequencies by undersampling.  But if the bandwidth (or other known characteristics) of the signal is known to rule out other aliased frequencies (such as the non-existence of baseband spectrum content), that knowledge in conjunction with the undersampled samples may still provide enough information to reconstruct the signal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-14T16:41:26.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10326" PostTypeId="2" ParentId="10268" CreationDate="2013-08-14T20:44:46.287" Score="1" Body="&lt;p&gt;It's really good the LTFAT ToolBox but for few samples like 1024, 2048 (I think...). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 262144 samples it's different. It's my case !. I have a huge signal with 262144 samples and sampled with 200Msps, 1D signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use the cwt for making an scalogram and looking for frequencies around 10KHz, 20KHz, 100-500KHz, 1MHz and 2MHz. I thinks it's very hard to compute this type of signal, first for the lenght of it, and second the processing and time of processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use Python and Matlab. I like python and Matlab. Also I worked with some scripts than I searched on the web but for few samples like 1024... 512... etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Waiting for your response and thanks in advance !. ;-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PD: In your case search python scripts like Scipy (A Phyton librarie for math and processing), the MLPY (Machine Learning Python), with a cwt routine. I search for Matlab, but I think to expand to another programming languages and also, types of data processing. &lt;/p&gt;&#xA;" OwnerUserId="5218" LastActivityDate="2013-08-14T20:44:46.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10328" PostTypeId="2" ParentId="10278" CreationDate="2013-08-15T01:00:34.923" Score="1" Body="&lt;p&gt;The &quot;Nyquist plot&quot; you have is really just the Fourier transform of the vibration data.  That the plot is &quot;circular&quot; doesn't mean much: it just means that the phase of the signal is continually increasing and that the magnitude is (roughly) constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wouldn't call such a plot a &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist_plot&quot; rel=&quot;nofollow&quot;&gt;Nyquist plot&lt;/a&gt;.  Nyquist plots are plots of the transfer function of a system. You may be able to use your measured signal and the reference to attempt to generate a Nyquist plot, but it's probably not going to be just a matter of multiplying / dividing Fourier transforms of the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, plotting the Fourier transform of a signal on the complex plane doesn't show much useful information.  More useful is to plot the magnitude against frequency, as this shows the dominant frequencies in the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason the phase plots are &quot;chaotic&quot; (sic) is that the signal is noisy.  Taking the argument of a noisy complex signal will nearly always generate discontinuous phase plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe an &lt;a href=&quot;http://mathworld.wolfram.com/ArgandDiagram.html&quot; rel=&quot;nofollow&quot;&gt;Argand diagram&lt;/a&gt; is the same as your &quot;Nyquist plot&quot;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-08-15T01:00:34.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10332" PostTypeId="1" CreationDate="2013-08-15T17:02:48.647" Score="1" ViewCount="1679" Body="&lt;p&gt;First of all I apologize for the long question. I am working with a 3-axis accelerometer and a 3-axis gyroscope and I need to calculate the correlation between the different signals (acceleration in x,y,z and the quaternion x,y,z,w). In the end, I need to get 21 correlations, one for each pair. I was thinking of using the standard &lt;a href=&quot;http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pearson product moment correlation coefficient&lt;/a&gt;. Particularly the second formula in the &quot;for a sample&quot; section that uses the standard score, sample mean, and sample standard deviation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am computing these correlations as features for a classifier. I am computing these features over a window size. I will now introduce some MATLAB code that will help illustrate what I am trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First we have a discrete sine and a cosine. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = [0:1:600]; %time samples&#xA;f = 1/2; %input signal frequency&#xA;fs = 100; %sampling frequency&#xA;x = sin(2*pi*f/fs*t); %generate sine&#xA;figure(1);&#xA;stem(t,x,'r');&#xA;figure(2);&#xA;stem(t*1/fs*1000,x,'r');&#xA;hold on;&#xA;plot(t*1/fs*1000,x);&#xA;y = cos(2*pi*f/fs*t); %generate cosine&#xA;figure(3);&#xA;stem(t,y,'r');&#xA;figure(4);&#xA;stem(t*1/fs*1000,y,'r');&#xA;hold on;&#xA;plot(t*1/fs*1000,y);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I get Pearson's coefficient for a window of 50 measurements (notice this is equivalent to a quarter of a cycle) with the following code. This can easily be changed for windows of different sizes but I will leave at the moment in 50 for the sake of simplicity.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xMean = sum(x(1:50))/50;&#xA;yMean = sum(y(1:50))/50;&#xA;tmpX = x(1:50) - xMean;&#xA;tmpY = y(1:50) - yMean;&#xA;stdDevX = sqrt((sum(tmpX .* tmpX)) / 49);&#xA;stdDevY = sqrt((sum(tmpY .* tmpY)) / 49);&#xA;stdScoreX = tmpX ./ stdDevX;&#xA;stdScoreY = tmpY ./ stdDevY;&#xA;stdScores = stdScoreX .* stdScoreY;&#xA;r = sum(stdScores)/49 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives an r(Pearson's coefficient) equivalent to -0.9183. This makes sense from the scatter plot of x vs y:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/55eLe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the scatter plot with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure(5);&#xA;scatter(x(1:50),y(1:50));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Different windows have different Pearson's coefficients, either a value close to 1 or a value close to -1, which makes sense from the scatter plots of x vs y in the other windows. The second window has an r = 0.9183. The third window will have a value again close to -1. This windows are with no overlap whatsoever. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if I change the window size to 100 samples, things change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ukQUR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same story with a window of size 200, but now it looks like a circle. Now it is visible (and calculations also confirmed it) that the correlation is 0 or a value very close to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question after all this is… what is the correct way of calculating a correlation for this type of periodic signals? Or are both of these ways correct? Preferrably I would like to obtain a number close to -1, 0, or 1 (discrete) since these numbers will be input features in a classifier. I know that, for example, two sinusoidal functions that are in phase will have a correlation close to 1 (or 1, depending on noise but that is another issue). My main problem is the correlation in the example I showed. So, probably I should calculate over a window size that is the length of at least a period in order to get either a 0 or a 1, but I am not entirely sure.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5235" LastEditorUserId="5235" LastEditDate="2013-08-15T21:37:39.793" LastActivityDate="2013-08-15T21:37:39.793" Title="Calculation of the correlation of two sinusoidals" Tags="|matlab|signal-analysis|correlation|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10333" PostTypeId="1" CreationDate="2013-08-15T17:16:57.767" Score="0" ViewCount="37" Body="&lt;p&gt;I am stuck on a research problem and do not know what kind of methods to use. I hope people in this forum can give me some good ideas, I've always had good brainstorming sessions here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I have a laser and a stack of thin films made up of three different materials. If I shoot the laser at these thin films I get a circular image of the reflected light from the laser scattering on the films. However, the fourth layer is added and I want to measure the change in thickness of the fourth layer, similarly by shooting a laser at this stack. The other three bottom layers are &quot;nuisance&quot; parameters, but their thickness variations are also captured in the pupil image. How do I filter out the observed pupil image so that the information of the three base stacks are eliminated and only the variations of the fourth critical stack are captured? I have 1000 sets (1000 for 3-stack and 1000 for 4-stack) such that for each data point, the 3-stack and 4-stack films have gone through identical process conditions and there is an image for both these stacks. I've thought of maybe signal transforms? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;------- edit --------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each image pixel of the pupil of the film stack is a nonlinear function of the thicknesses but the gradients at each parameter (as well as the image at a certain parameter value) point can be calculated via an optical simulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$pix_i(i = 1...n) = f(h_1,h_2,h_3) + \epsilon_i$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $pix_i$ is a pixel point of the acquired image and $h1,h2,h3$ are the film thicknesses of a 3-film stack. This can now be linearized around $h10,h20,h30$ to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$pix_i(i=1...n) \sim f(h_{10},h_{20},h_{30}) + \frac{df}{dh_i}(h_i = h_{i0}) + \epsilon_i$&lt;/p&gt;&#xA;" OwnerUserId="5236" LastActivityDate="2013-08-15T17:16:57.767" Title="decorrelating two image maps -- reflected images from laser scattering" Tags="|discrete-signals|signal-detection|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10334" PostTypeId="1" AcceptedAnswerId="10357" CreationDate="2013-08-15T17:34:29.610" Score="3" ViewCount="1433" Body="&lt;p&gt;I want to do sample rate conversion by subsequently upsampling with factor I=5, and then downsampling with factor D=9.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have designed a nyquist sample rate conversion filter h() of length M, with matlab's filterbuilder tool for interpolation factor I=5, and decimation factor D=9. Since D &gt; I, I have chosen the normalized cutoff frequency of the filter to be at 1/9, by setting &quot;Band&quot; under filter specifications to 9.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I compute I polyphase filters pk(n), which have length K=M/I by sampling h() according to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pk(n) = h(k + n*I),   for    k=0,...,I-1    and     n=0,...,K-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I only compute the output samples for each polyphase filter, which are sampled by the downsampling operation. In other words, I compute the output y[m], by sampling the outputs of the polyphase filters yk[] according to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[m] =   yk[ floor( m * D / I  ) ]&#xA;k    =   ( m * D ) modulo I&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus, I do not compute samples of yk[] that are not used in the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apply these polyphase filter's first to do sample rate conversion for the rows of the image. Then I apply the same filters to do sample rate conversion for the columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I get a distorted output image which still, clearly contains alias: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BPSEm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know If I'm conceptually doing anything wrong?&lt;/p&gt;&#xA;" OwnerUserId="5234" LastEditorUserId="80" LastEditDate="2013-08-18T21:50:55.930" LastActivityDate="2013-08-19T02:18:54.377" Title="polyphase sample rate conversion with non-integer factor" Tags="|image-processing|matlab|filter-design|interpolation|nyquist|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10335" PostTypeId="2" ParentId="10334" CreationDate="2013-08-15T18:01:55.467" Score="4" Body="&lt;p&gt;Your approach seems conceptually sound.  I suspect that the problem is one of two things: 1) you have implemented it incorrectly, 2) Your filter bandwidth is too wide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are implementing the &quot;smart&quot; approach in that you are doing it the computationally efficient way.  I would try doing it the dumb way (insert I-1 zeroes between every sample, filtering with the entire filter, get rid of the extra samples) to verify your implementation and to see if the filter itself is the problem.  You can verify your implementation by comparing your resulting samples against the samples produced by the dumb approach.  After you have filtered the upsampled data one of the sample &quot;phases&quot; (there are &quot;D&quot; phases whose start samples are samples 0...D-1) should be the same as the smart approach's results.  If not, something is wrong in your implementation of either the smart or dumb approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the results do match, then the problem is your filter.  You need to look closely at the bandwidth to make sure that it isn't too wide.  Since D &gt; I the ideal filter bandwidth, assuming a perfect brick wall filter, is $\frac{I}{2D}$, where the factor of two comes from the Nyquist rate.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-08-15T18:01:55.467" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10336" PostTypeId="1" AcceptedAnswerId="10360" CreationDate="2013-08-15T18:46:10.953" Score="3" ViewCount="589" Body="&lt;p&gt;I've found good literature for offline proccesses, and I've gotten good results. However, when it comes to online applications, I've found nothing good. Applying any filter without a linear phase response will give me too much distortion once I get to displacement. However, any filter I've used with linear phase response gives me way too much &quot;time lag&quot; (apart that it's very high order). Below is the proccess most people apply:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Raw Acc --&gt; [High Pass Filter (HPF)] --&gt; [Integrate (Int)] --&gt; [HPF] --&gt; [Int] --&gt; [HPF] --&gt; Displacement Signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can imagine, this procces is trivial if you use non-causal filters... But I've not gotten a good solution for the online proccess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current conclusion is that I need a &quot;low order, linear phase, causal filter.&quot; There is active research in these types of filters, but they are somewhat complicated to apply. So before I start making leeway, I decided to ask this in a forum to see if anybody could give some input or fresh ideas.&lt;/p&gt;&#xA;" OwnerUserId="5237" LastActivityDate="2014-01-16T06:44:45.147" Title="Anybody with experience with online double integration of acceleration?" Tags="|highpass-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10337" PostTypeId="1" AcceptedAnswerId="10340" CreationDate="2013-08-15T21:35:54.110" Score="2" ViewCount="901" Body="&lt;p&gt;I understand that sampling rate should be twice the signal bandwidth for successful reconstruction. But what I don't get is how this translates in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a sine wave pulse with frequency 100MHz and duration of say 50ns. This signal has a bandwidth of 20MHz (1/50ns = 20MHz). Theoretically, I can sample this signal at any frequency above 40Mhz. Let's say I sample at 50MHz, then I only get 2 samples per pulse!! Now what can you possibly do with those 2 samples is my question. In other words, although Nyquist criterion is satisfied in this example, there's not enough data points to proceed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This kind of signals are common in radar and generally you want to run some sort of matched filtering/correlation once you have digitized the pulse. But you can't run any descent signal processing on just two samples? am I missing something here?   &lt;/p&gt;&#xA;" OwnerUserId="4673" LastActivityDate="2013-08-16T16:21:32.290" Title="minimum sampling rate for very short duration signals" Tags="|sampling|correlation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10339" PostTypeId="2" ParentId="10337" CreationDate="2013-08-15T23:37:27.690" Score="2" Body="&lt;p&gt;Any signal of finite extent (duration) in one domain (time) has infinite extent (bandwidth) in the other (frequency).  The bandwidth of a short pulse above some noise floor can be extremely high, due to the pulse window's transform convolved with the carrier frequency.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sharp edges or cutoffs imply very high bandwidths.  Thus in practice, most designed pulses are shaped closer to Gaussian, with much wider tails than the main pulse lobe (in both domains).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even so, if you know the exact frequency of an unmodulated fragment of a pure sine wave, then in zero noise, 2 or 3 non-aliased points are theoretically enough to solve the equations for the sinewave's  amplitude and phase.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-15T23:54:29.550" LastActivityDate="2013-08-15T23:54:29.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10340" PostTypeId="2" ParentId="10337" CreationDate="2013-08-16T01:59:32.440" Score="2" Body="&lt;p&gt;In many pulsed radar applications, one pulse is not enough to be informative, mainly for the reason you mention.  However, coherent processing of multiple pulses can be used to extract useful information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, take a time-domain signal of sufficient length to accurately extract frequency information. Now multiply (not convolve) that signal with a rectangular pulse train in the time domain.  In effect, you are taking a large number of your samples, and setting them to zero. Now consider the result in the frequency-domain.  It will look like the convolution of the original spectrum with the spectrum of the pulse train.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a MATLAB example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;K = 3;                              % Samples per pulse&#xA;N = 50;                             % Number of pulses&#xA;duty = 0.1;                         % Duty Cycle&#xA;Fs = 48e3;                          % Sampling Frequency&#xA;f0 = 13e3;                          % Center frequency&#xA;fd = f0*(1+0.03);                   % Doppler shifted frequency &#xA;SNR = 10;                           % Signal/Noise Ratio (dB)&#xA;&#xA;% Helper function for plotting FFTs&#xA;plotFFT=@(x,Fs) plot(Fs*(0:length(x)-1)/length(x)-Fs/2, abs(fftshift(fft(x))));&#xA;&#xA;% Create a train of rectangular pulses&#xA;rect_pulse_train = repmat([ones(1,K), zeros(1,K*(1/duty-1))],1,N);&#xA;figure(1); plotFFT(rect_pulse_train,Fs); title('Spectrum of pulse train');&#xA;&#xA;% Create a carrier signal plus a doppler shifted version&#xA;t = (0:length(rect_pulse_train)-1)/Fs;&#xA;x = cos(2*pi*f0*t) + 0.7*cos(2*pi*fd*t);&#xA;&#xA;% Add Gaussian noise&#xA;nstd = norm(x) / sqrt(2 * length(x) * 10^(SNR/10));&#xA;x_noisy = x + nstd*(randn(size(x)) + 1j*randn(size(x)));&#xA;x_pulse = [x_noisy(1:K), zeros(1,length(x)-K)];&#xA;figure(2); plotFFT(x_pulse,Fs); title('Spectrum of single pulse');&#xA;&#xA;% Capture a coherently-pulsed version of the signal&#xA;y = rect_pulse_train.*x_noisy;&#xA;figure(3); plotFFT(y,Fs); title('Spectrum of coherently pulsed signal');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you try various values of &lt;code&gt;K&lt;/code&gt;, you can see how it affects your frequency resolution.  Even though the peaks are spectrally smeared, it is still possible to identify small frequency shifted copies of the carrier when using coherent doppler processing.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastEditorUserId="5156" LastEditDate="2013-08-16T16:21:32.290" LastActivityDate="2013-08-16T16:21:32.290" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10341" PostTypeId="1" AcceptedAnswerId="10342" CreationDate="2013-08-16T12:15:34.557" Score="2" ViewCount="306" Body="&lt;p&gt;I'm studing about Kalman Filter and Particle Filter in multiple target tracking in computer vision (tracking pedestrians). Reading sientific papers I'm colliding with a lot of sentences like:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The assumptions of linearity and Gaussianity of the Kalman Filter&#xA;  cannote manage complex scenario.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now.. I'd like to find some real example of scenario where those assumptions are exceeded. Because I don't really understand where I should use Kalman Filter or not. Can anyone give me some example?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real videos (like youtube or similar) are very good example.&lt;/p&gt;&#xA;" OwnerUserId="1063" LastActivityDate="2013-08-17T18:22:08.157" Title="Situations where complexity is too big to exceed linearity and gaussianity" Tags="|kalman-filters|linear-systems|gaussian|tracking|particle-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10342" PostTypeId="2" ParentId="10341" CreationDate="2013-08-16T13:54:02.840" Score="5" Body="&lt;p&gt;Well, let's look at the two issues: 1) linearity and 2) Gaussianity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Linearity&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're imaging moving 3D objects (people) with a single camera, then you're working with a 2D projection of those 3D objects.  That dimensionality reduction can cause non-linearities to appear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a 2D to 1D example:  an object moving in a circle in 2D.  The object is moving with constant velocity and constant acceleration.  All nice and linear.  Project that object onto a 1D surface (a line) and the velocity and acceleration are now (co)sinusoidal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the underlying assumptions in Kalman filtering (well, the sort usually presented) is that the system you're modeling is linear.  When dimensionality reduction (3D $\rightarrow$ 2D) is involved, this may not be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Gaussianity&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a system is linear, any noises tend to be additive.  When Gaussian noise is added to Gaussian noise (or, for enough samples, noise of just about any distribution is added to noise of just about any distribution), the result is also Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the system is non-linear, then the operations involved cause Gaussian noise to be transformed into potentially non-Gaussian noise.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you divide one Gaussian variable with another, &lt;a href=&quot;http://en.wikipedia.org/wiki/Cauchy_distribution&quot;&gt;the distribution of the result is Cauchy&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's so bad about that?  The mean (average) of a Cauchy random variable does not exist.  The variance of a Cauchy random variable does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Kalman filter is all about tracking means and variances of variables in the system.  If the system is non-linear, it's possible that the relevant quantities' means and variances do not exist, so application of a Kalman filter is meaningless.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-08-16T13:54:02.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10344" PostTypeId="2" ParentId="10341" CreationDate="2013-08-16T15:25:06.257" Score="5" Body="&lt;p&gt;In addition to Peter's answer, if you have a nonlinear system that is well-behaved in a sense of being only mildly nonlinear or at least exhibiting no discontinuities, special variants of the Kalman filter can still be applied.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Extended Kalman Filter&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This filter linearizes the system at the current state of the system using a first order Taylor Series Approximation. However, this fails for strongly nonlinear systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue with the extended Kalman Filter is that the posterior distributions (if nonlinearities are in the system) are no longer Gaussian and cannot be accurately described by just means and variances. The EKF now linearizes the perfectly known nonlinear system and introduces further errors.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Unscented Kalman Filter&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;A different approach is used by the Unscented Kalman Filter (UKF) and it's central element, the unscented transformation. Here, a discrete distribution is constructed that exhibits the same mean and variance of the current Kalman Filter state. This distribution is very easy to transform with the exact nonlinear system. The mean and variance of the resulting discrete distribution are then calculated and are again assumed to stem from a Gaussian distribution by the rest of the Kalman filter (hence, there is still inaccuracies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you have a strongly nonlinear system with discontinuities (think about a navigation algorithm that has a map with obstacles, the transition between allowed and blocked areas are discontinuous), all of these algorithms will most likely fail.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Particle Filter&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Here you can use particle filters. Each particle represents a point in your state space and is usually associated with a weight that represents how much believe that particle has (though there's a lot of different variants of the PF). In the prediction step, the particle is &quot;moved&quot; according to your system model and as long as you can sample from the distributions, they can be arbitrarily complex. So, instead of tracking a mean and variance, you actually move the particle by a possible realization or your system model. That is the reason why you need so many particles, to get a good coverage of the complete distribution. In the update step, the weight of the particle is updated by comparing it's state with the measurements and other information (think the floor-map again in the robot example) that can again, be highly nonlinear. In the end, unlikely particles are usually erased and replaced by particles in more likely areas. The particles are then representing your posterior distribution. Areas with many particles are more likely to contain the actual state and areas without particles are highly unlikely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at this video of an indoor/outdoor navigation system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=2NfSHNurOAc&quot; rel=&quot;nofollow&quot;&gt;Youtube Video&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shows a comparison of a Kalman Filter and a Particle Filter. As long as the user is outside and has a GPS navigation, both systems perform similarly well. However, when the user goes inside the building and the GPS positioning is lost, the Kalman Filter looses all absolute reference and needs to rely solely on the IMU. The IMU has measurement errors that eventually add up and the Kalman estimate slowly drifts away, eventually even moving outside the screen. It cannot use the floorplan as information since this results in a highly non-gaussian distribution that cannot be usefully expressed merely in terms of means and variances. The particle filter on the other hand has no problem with this scenario and keeps tracking the position very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, particle filters have downsides. Sampling from complicated distributions can be an expensive operation. It is usually not trivial to decide on the number of particles or when to annihilate a particle due to low likelihood. So quite a bit of tweaking is usually required. Tracking all those particles requires a lot of memory and a lot of particles are required especially for high-dimensional problem. And finally, their performance will not be better for linear systems involving Gaussian distributions as for this case the Kalman Filter is optimal.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastEditorUserId="5069" LastEditDate="2013-08-17T18:22:08.157" LastActivityDate="2013-08-17T18:22:08.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10345" PostTypeId="2" ParentId="10134" CreationDate="2013-08-16T20:46:23.343" Score="2" Body="&lt;p&gt;Normalized is preferred to regular correlation to handle variation in brightness, or intensity, between images if nothing else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your second comment, the correlation is going to be lower if the shape rotates (unless it happens to be symmetrical in all four directions).  There are other features you can consider that are rotation invariant as well.  See &lt;a href=&quot;https://dsp.stackexchange.com/questions/1288/what-are-some-free-alternatives-to-sift-surf-that-can-be-used-in-commercial-app&quot;&gt;this post&lt;/a&gt; for some examples.&lt;/p&gt;&#xA;" OwnerUserId="5244" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-08-16T20:46:23.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10347" PostTypeId="1" CreationDate="2013-08-17T09:27:41.377" Score="5" ViewCount="2442" Body="&lt;p&gt;We call the conversion from a continuous time signal $f(t)$ to a discrete time signal $f_s[k]$ &quot;sampling&quot;. Is there a name for the reverse operation, i.e. creating a continuous time signal from a discrete time signal?&lt;/p&gt;&#xA;" OwnerUserId="5248" LastActivityDate="2014-08-04T08:23:31.880" Title="What is the opposite of sampling called?" Tags="|discrete-signals|sampling|continuous-signals|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10348" PostTypeId="2" ParentId="10347" CreationDate="2013-08-17T09:29:55.707" Score="15" Body="&lt;p&gt;This is called reconstruction.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-17T09:29:55.707" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10349" PostTypeId="2" ParentId="10347" CreationDate="2013-08-17T10:59:47.210" Score="3" Body="&lt;p&gt;The process of creating a Continuous time signal from Discrete time signal is called (in plain Signal processing terminology) as &quot;Reconstruction&quot;. Another term you will find associated with this process is &quot;Low Pass Filtering&quot; as it's the process used for conversion&lt;/p&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2013-08-17T10:59:47.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10350" PostTypeId="1" AcceptedAnswerId="10351" CreationDate="2013-08-17T15:32:15.590" Score="1" ViewCount="874" Body="&lt;p&gt;I'm looking for your opinions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have obtained a Speech Signal and computed a STFT on this signal. I have split the signal into blocks of (100 x 256) and computed the STFT based on different Windowing functions. But, they all bring back similar results (outputted on the same block) I know this might make sense, but, I assumed that because I was using different Windowing functions, it would have a major impact on the results.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Barlett:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/00Wxs.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lMEIo.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hamming ^^&#xA;Note how the block contains no actual speech, just white noise as it's the first block. Does this look normal, or, is there something wrong here?&lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2013-08-17T16:05:36.297" Title="STFT - Window Functions" Tags="|window-functions|stft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10351" PostTypeId="2" ParentId="10350" CreationDate="2013-08-17T16:05:36.297" Score="5" Body="&lt;p&gt;This is a rather general answer : I would say that, although each window function has specific characteristics that make it more or less suitable for specific situations, in this context you're not going to see a huge difference in the STFT of a windowed speech signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, the two windows that you're comparing are quite similar, so I'd expect that you'd get pretty similar STFT results. You might try two windows that are quite different, like a rectangular and a Hamming or something like that, to see just how much difference those make in your STFT, and then use that difference as a sort of upper bound on the difference that you're likely to see from other windows.&lt;/p&gt;&#xA;" OwnerUserId="5209" LastActivityDate="2013-08-17T16:05:36.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10352" PostTypeId="1" CreationDate="2013-08-17T17:36:36.193" Score="1" ViewCount="262" Body="&lt;p&gt;I would like to improve my knowledge about &lt;em&gt;Fourier Transform&lt;/em&gt; and related subjects.&lt;/p&gt;&#xA;&lt;p&gt;What are the recommended resources in order to self study about it?&lt;/p&gt;&#xA;" OwnerUserId="5251" LastEditorUserId="7092" LastEditDate="2021-07-25T20:08:26.870" LastActivityDate="2021-07-25T20:08:26.870" Title="What Are the Suggested Resources for Extensive Knowledge About the Fourier Transform (DFT, FFT, etc...)?" Tags="|matlab|fft|fourier-transform|dft|self-study|" AnswerCount="1" CommentCount="3" ClosedDate="2013-08-17T20:15:51.620" ContentLicense="CC BY-SA 4.0" />
  <row Id="10353" PostTypeId="2" ParentId="10352" CreationDate="2013-08-17T18:18:40.647" Score="6" Body="&lt;p&gt;Get, Read and Solve the following books:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0138147574&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Signals and Systems&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0137549202&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Discrete Time Signal Processing&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0132146355&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Signal Processing&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Take the following courses:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.coursera.org/learn/dsp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coursera - Digital Signal Processing&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.edx.org/course/discrete-time-signal-processing-mitx-6-341x-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;edX - Discrete Time Signal Processing&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;edX - Signals and Systems: &lt;a href=&quot;https://www.edx.org/course/signals-and-systems-part-1-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Part I&lt;/a&gt;, &lt;a href=&quot;https://www.edx.org/course/signals-systems-part-2-iitbombayx-ee210-2x-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Part II&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;edx - Discrete Time Signals and Systems: &lt;a href=&quot;https://www.edx.org/course/discrete-time-signals-systems-part-1-ricex-elec301-1x&quot; rel=&quot;nofollow noreferrer&quot;&gt;Part 1: Time Domain&lt;/a&gt;, &lt;a href=&quot;https://www.edx.org/course/discrete-time-signals-systems-part-2-ricex-elec301-2x&quot; rel=&quot;nofollow noreferrer&quot;&gt;Part 2: Frequency Domain&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.edx.org/course/differential-equations-fourier-series-and-partial-differential-equations-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;edX - Differential Equations: Fourier Series and Partial Differential Equations&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once you have specific questions, come back here and we'll assist you.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-08-18T10:17:48.500" LastActivityDate="2019-08-18T10:17:48.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10354" PostTypeId="1" CreationDate="2013-08-17T19:22:19.937" Score="1" ViewCount="1200" Body="&lt;p&gt;To start with, I'm pretty new to DSP, so forgive me failing to understand any basic concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with an iOS app that depends on the input from the analog audio jack whilst monitoring the signal through output (headphones, etc). Unfortunately, iOS devices suffer from crosstalk given a high enough volume due to the proximity of the output and input leads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Garageband on iOS provides something called &quot;Crosstalk prevention&quot; for monitoring guitar audio playback through its amp modelling. I've no idea how they do it but it's something I'd like to do in my app.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've access to the output signal, and I perform a FFT on the input signal (to perform spectral noise gating) anyways, so anything that uses fourier transforms might be good since I'm doing that operation. It's difficult for me to find any solutions as DSP is pretty new to me.&lt;/p&gt;&#xA;" OwnerUserId="5245" LastActivityDate="2015-04-13T05:06:39.063" Title="Simple crosstalk cancellation (or signal separation)?" Tags="|audio|source-separation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10355" PostTypeId="1" CreationDate="2013-08-18T02:39:27.840" Score="0" ViewCount="85" Body="&lt;p&gt;I am trying to form an approximation of the wavelet transform from a partially sampled image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reconstruction in the 1D case is easy. We have $w = h x$, with $w$ as the wavelet coefficients, $h$ as the inverse of the Haar matrix and $x$ our signal. $w$ and $x$ are $n \times 1$ and $h$ is $n \times n$. Where we don't sample the signal, we delete those columns from $h$ and those rows/elements from the full signal, $x$. Since we have to have as many equations as unknowns, we sample at $m$ locations and approximate the first $m$ wavelet coefficients. All we do is delete the corresponding columns of where we do not sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have $w = c x r$, where $c$ is the matrix that performs the wavelet transform on the columns, and $r$ the rows. I am having a hard time forming in approximation in this 2D case. I know this is a simple solution and am having a hard time getting the math behind it. I know it's just solving a linear system of equations, but am having a hard time coming up with the matrix to represent that linear system.&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2013-08-18T02:39:27.840" Title="Reconstructing a partially deleted image through wavelets" Tags="|wavelet|reconstruction|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10357" PostTypeId="2" ParentId="10334" CreationDate="2013-08-18T20:48:48.483" Score="3" Body="&lt;p&gt;I solved my problem. The design methodology as described above is sound. However, there was an error in my implementation of the FIR filter. For symmetrical filters you can replace convolution by correlation, and that's what I did. However, since the polyphase filters are asymmetrical this led to incorrect results. I implemented the FIR filter by convolution and now my sample rate converter works like a charm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below you can see the correctly resampled image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l76ew.png&quot; alt=&quot;The correctly resampled image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's the original input image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ghcvb.png&quot; alt=&quot;original image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5234" LastEditorUserId="4712" LastEditDate="2013-08-19T02:18:54.377" LastActivityDate="2013-08-19T02:18:54.377" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10358" PostTypeId="1" AcceptedAnswerId="10524" CreationDate="2013-08-18T22:39:59.787" Score="17" ViewCount="4798" Body="&lt;p&gt;I would like to recognize the &lt;em&gt;boundaries of a hexagonal tiling&lt;/em&gt; in a photograph, like in  image below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KWI7e.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me, that a standard approach at a square grid is to first detect corners (e.g. canny) and then extract the longest lines via a &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;noreferrer&quot;&gt;Hough transform&lt;/a&gt; or something similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not look as optimal solution with hex tiling, because the length of outer lines is shorter and it's hard to separate them from other lines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any algorithm to adress this problem? It would be particulary nice to have a solution in opencv, but I am also interested in general ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With python and opencv I was able to receive this result:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6t6Fy.jpg&quot; alt=&quot;contours&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cv2&#xA;import numpy as np&#xA;&#xA;imgOrig = &quot;test1&quot;;&#xA;img = cv2.imread(imgOrig+&quot;.jpg&quot;);  &#xA;lap = cv2.Laplacian(img, cv2.IPL_DEPTH_32F, ksize = 3)  &#xA;imgray = cv2.cvtColor(lap,cv2.COLOR_BGR2GRAY)  &#xA;ret,thresh = cv2.threshold(imgray,127,255,0)&#xA;contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)&#xA;size = img.shape&#xA;m = np.zeros(size, dtype=np.uint8)&#xA;for i, cnt in enumerate(contours):&#xA;    if cv2.contourArea(cnt) &amp;gt;= 1:&#xA;        color = (255,255,255)&#xA;        cv2.drawContours(m, cnt, -1, color, -1)&#xA;cv2.imwrite(str(imgOrig)+&quot;contours.jpg&quot;, m);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Laplacian of image looks like:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rBzIY.jpg&quot; alt=&quot;laplacian&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will try to optimate the parameters of this approach and then try to interpolate the boundaries of the four sections.&lt;/p&gt;&#xA;" OwnerUserId="5089" LastEditorUserId="5089" LastEditDate="2013-08-24T12:28:56.677" LastActivityDate="2013-08-28T22:14:32.803" Title="How to recognize hexagonal tiling in boardgame?" Tags="|image-processing|opencv|image-segmentation|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="10359" PostTypeId="1" CreationDate="2013-08-19T03:32:46.570" Score="10" ViewCount="628" Body="&lt;p&gt;I am trying to create a program that can count the number of nuclei in such an image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/umPJe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've already done is the following, step by step:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Apply an Alternating Sequential Filter (closing and opening the image with gradually bigger structuring elements)&lt;/li&gt;&#xA;&lt;li&gt;Apply a distance transform&lt;/li&gt;&#xA;&lt;li&gt;Apply watershed segmentation using the distance transformed image to detect minima&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Which yields the following result (where each color represents a new nucleus counted):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/31gcM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we can see, there are lots of imperfections, specifically, overcounted nuclei. I'd say that the reason for that problem is the way I imposed minima for the Watershed Transform (using the distance transform), but I really have no other ideas for imposing minima in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the Distance Transform generates minima based on the roundness of objects, I would like to know a better alternative to round up the nuclei than the Alternating Sequential Filter (looking at the image above, we can infer that most of the &quot;overcounts&quot; came from the less rounded nuclei). I would also like to know better ways to impose minima for the Watershed Transform.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastEditorUserId="29" LastEditDate="2013-08-19T14:04:03.790" LastActivityDate="2013-11-19T21:53:36.310" Title="Image Processing - Counting nuclei" Tags="|image-processing|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10360" PostTypeId="2" ParentId="10336" CreationDate="2013-08-19T05:16:01.500" Score="2" Body="&lt;p&gt;Any filter within your chain can remove useful information. The kalman filter way is applicable when you have/use a good model of the error, and you have some auxiliary sensor (like GPS, or images) to confront to the result of the double integration (DI). I dont know how good your acc is, but a military one, for example, can drift so few after the DI, that it doesnt need any auxiliary sensor. However, you cannot expect the same result using this cell-phone acc, though. The limit of goodness is defined by your application and the type of sensor you have.&lt;/p&gt;&#xA;" OwnerUserId="4869" LastActivityDate="2013-08-19T05:16:01.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10361" PostTypeId="1" AcceptedAnswerId="10362" CreationDate="2013-08-19T09:08:45.477" Score="4" ViewCount="596" Body="&lt;p&gt;Matlab says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;x = hilbert(xr) returns a complex helical sequence, sometimes called the analytic signal, from a real data sequence.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How did the name &lt;code&gt;complex helical&lt;/code&gt; come about? How is it related to analytic signal?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="4206" LastEditDate="2013-08-19T10:01:56.993" LastActivityDate="2013-08-19T10:56:51.937" Title="What is a complex helical sequence?" Tags="|hilbert-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10362" PostTypeId="2" ParentId="10361" CreationDate="2013-08-19T09:30:36.707" Score="7" Body="&lt;p&gt;The description &lt;em&gt;complex helical sequence&lt;/em&gt; indicates that it is a sequence of &lt;a href=&quot;http://en.wikipedia.org/wiki/Complex_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex numbers&lt;/a&gt; that, when plotted in three dimensions (real part, imaginary part, position in the sequence), resembles a screw, or &lt;a href=&quot;http://en.wikipedia.org/wiki/Helix&quot; rel=&quot;nofollow noreferrer&quot;&gt;helix&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this illustration (by RobHar, on Wikimedia Commons):&#xA;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/2/29/Helix.svg&quot; alt=&quot;helix shape&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a mathematical point of view, all signals can be decomposed into complex &lt;em&gt;sinusoids&lt;/em&gt; (sine waves), which are terms of the form $A(x) = e^{(\omega x +\phi)i}$. This is an often useful perspective. As $x$ is varied, $A(x)$ describes a circle in the complex plane; plotted in three dimensions, it is the helix from above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real-life signals normally consist of real numbers only, i.e. the imaginary part is always zero. This means that the complex sinusoids of which it is composed come in mirror pairs, where one runs clockwise and one anticlockwise; otherwise (frequency, amplitude, phase), they are identical. In such a pair, the imaginary parts cancel, and the result is a real-only signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An &lt;em&gt;analytic signal&lt;/em&gt; is made from a real signal by removing one half from each of those pairs so that all remaining sinusoids move in the same direction. It is no longer real-valued, i.e. the imaginary part is in general non-zero, but the real part is identical to the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Technically, the sense of rotation is considered the sign of the frequency $\omega$, and an analytic signal only contains sinusoids with non-negative frequency.)&lt;/p&gt;&#xA;" OwnerUserId="4712" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.933" LastActivityDate="2013-08-19T10:56:51.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10363" PostTypeId="1" CreationDate="2013-08-19T13:30:41.543" Score="1" ViewCount="18028" Body="&lt;p&gt;I've seen some other questions on here about zero padding (like &lt;a href=&quot;https://dsp.stackexchange.com/questions/2962/how-to-resample-audio-using-fft-or-dft/&quot;&gt;this&lt;/a&gt; one) but I'm still a little confused about my situation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm attempting to zero pad my input time series data, so I get an interpolated frequency spectrum. I had initially tried this with NumPy's FFT package, and I checked my algorithm on generated data to see if it works. I generated sine waves of known frequencies, and checked to see what the differences were between the actual, unpadded and padded estimates for frequencies. For frequencies that sat exactly in an FFT bin, the unpadded and padded estimates agreed exactly (as they should).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I need to implement this in C (using the FFTW library), but the same test fails in the algorithm I implemented. What I'm doing is -&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Read in time series (generated data)&lt;/li&gt;&#xA;&lt;li&gt;Perform unpadded FFT, obtain frequency estimate (by looking at the bin with the maximum amplitude)&lt;/li&gt;&#xA;&lt;li&gt;To the end of the time series, add zeros (I'm using 10 times as many zeros).&lt;/li&gt;&#xA;&lt;li&gt;Take an FFT of the padded array, and obtain frequency estimate.&lt;/li&gt;&#xA;&lt;li&gt;Compare the two frequency estimates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Turns out the two frequency estimates are very different. This is because in my C code, there seem to be multiple places where the value of the FFT matches the maximum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is because of how I'm padding zeros to the array.&#xA;&lt;strong&gt;Question:&lt;/strong&gt; How does one correctly pad zeros to an array such that the FFT yields similar results to the unpadded array?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Relevant code (Python and C)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Python:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#! /usr/bin/env python&#xA;&#xA;import numpy as np&#xA;PI = np.pi&#xA;&#xA;ixFreq = 10.0    # This is the bin that will have the max&#xA;iyFreq = 10.0    # amplitude in the fourier plane&#xA;&#xA;xSize  = 24      # Define the size of the array&#xA;ySize  = 60&#xA;&#xA;xPeriod = xSize/ixFreq # Calculate what the period needs to be &#xA;yPeriod = ySize/iyFreq&#xA;&#xA;xxFreq  = 1./xPeriod # This is the *actual* frequency.&#xA;yyFreq  = 1./yPeriod&#xA;&#xA;padFac  = 10         # Padding factor&#xA;xPad    = padFac * xSize&#xA;yPad    = padFac * ySize&#xA;&#xA;npt     = xSize * ySize&#xA;padnpt  = xPad * yPad&#xA;&#xA;xy      = np.mgrid[0:ySize,0:xSize] # 2D grid to generate the sine wave&#xA;&#xA;data    = np.sin(2.0*PI * (xy[0]/yPeriod + xy[1]/xPeriod)) # Sine wave&#xA;&#xA;dFFT    = np.fft.fft2(data) # Regular (unpadded) FFT&#xA;padFFT  = np.fft.fft2(data, s=[yPad,xPad]) # Padded FFT&#xA;&#xA;freqArr = np.fft.fftfreq(ySize) # Frequency bins&#xA;freqPad = np.fft.fftfreq(yPad)&#xA;&#xA;datmax  = np.amax(np.abs(dFFT[:,:xSize/2])) # Find magnitude and pos of max val&#xA;datwhere = np.where(np.abs(dFFT[:,:xSize/2]) == datmax)&#xA;padmax  = np.amax(np.abs(padFFT[:,:xPad/2]))&#xA;padwhere = np.where(np.abs(padFFT[:,:xPad/2]) == padmax)&#xA;&#xA;freqD = freqArr[datwhere[0][0]]&#xA;freqP = freqPad[padwhere[0][0]]&#xA;&#xA;print &quot;Actual Freq: % 5.5lf&quot; % yyFreq # Print everything out&#xA;print &quot;Data Max: % 5.5lf&quot; % (np.amax(data))&#xA;print &quot;FFT Max: % 5.5lf  Where: % 5.5lf\n&quot; % (datmax/np.sqrt(npt), freqD)&#xA;print &quot;Pad Max: % 5.5lf  Where: % 5.5lf\n&quot; % (padmax/np.sqrt(npt), freqP)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;C:&#xA;Note - I've used a few user written functions, but I've tested them and I'm fairly certain that they're not the problem. I'm including them in here so you guys have a working piece of code, though.&#xA;How I compiled it - &lt;code&gt;gcc -Wall -o &quot;fftwTest&quot; fftwTest.c -lfftw3 -lm&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# include &amp;lt;stdio.h&amp;gt;&#xA;# include &amp;lt;stdlib.h&amp;gt;&#xA;# include &amp;lt;math.h&amp;gt;&#xA;# include &amp;lt;complex.h&amp;gt;&#xA;# include &amp;lt;fftw3.h&amp;gt;&#xA;&#xA;#define LARGENUMBER 9999999&#xA;#define BADDATA -999999&#xA;&#xA;void fftFreqD(int len, double d, double *freqArr)&#xA;{&#xA;   // Calculate given the bin, what the frequency is. Equivalent of &#xA;   // numpy's fftfreq function&#xA;   int      ii;&#xA;&#xA;   freqArr[0] = 0.;            //zero bin is always DC component&#xA;&#xA;   if (len % 2 == 0){          // If length of even size&#xA;      for(ii = 1; ii &amp;lt; len/2; ii++)&#xA;         freqArr[ii] = ii/(d*len);&#xA;      for(ii = len/2; ii &amp;lt; len; ii++)&#xA;         freqArr[ii] = -(len-ii)/(d*len);&#xA;   }&#xA;   else{                      // Else if odd size&#xA;      for(ii = 1; ii &amp;lt; (floor(len/2)+1); ii++)&#xA;         freqArr[ii] = ii/(d*len);&#xA;      for(ii = (floor(len/2)+1); ii &amp;lt; len; ii++)&#xA;         freqArr[ii] = -(len-ii)/(d*len);&#xA;   }&#xA;&#xA;   return;&#xA;}&#xA;&#xA;&#xA;void minmaxArrayC(int indx1, int indx2, complex *data, double *mindata,&#xA;                                                              double *maxdata)&#xA;{&#xA;   // Find the minimum and maximum value of a complex array, by taking&#xA;   // the absolute value&#xA;   int ii;&#xA;&#xA;   *mindata = LARGENUMBER;&#xA;   *maxdata = BADDATA;&#xA;   for (ii = indx1; ii &amp;lt; indx2; ii++) {&#xA;      if (*mindata &amp;gt; cabs(data[ii]))&#xA;          *mindata = cabs(data[ii]);&#xA;      if (*maxdata &amp;lt; cabs(data[ii]))&#xA;          *maxdata = cabs(data[ii]);&#xA;   }&#xA;}   &#xA;&#xA;void generate2DSin(double *outarr,double amp,double freqx, double freqy, &#xA;                                              double phase,int lenx, int leny)&#xA;{&#xA;   int ii, jj, index=0;&#xA;   for(ii = 0; ii &amp;lt; lenx; ii++){&#xA;      for(jj = 0; jj &amp;lt; leny; jj++) &#xA;         index = ii*leny + jj;&#xA;         outarr[index] = amp * sin(2.0*M_PI*(freqx*ii+freqy*jj) + phase);&#xA;   }&#xA;   return;&#xA;}&#xA;int main(int argc, char *argv[])&#xA;{&#xA;&#xA;   int              xSize = 24, ySize = 60;&#xA;   int              padx, pady, padfac;&#xA;   int              npt, padnpt;&#xA;   int              ii, jj, index;&#xA;&#xA;   double           *data, maxfft, maxpad, posmax=0, posmaxpad=0;&#xA;   double           *paddata;&#xA;   double           dum;&#xA;   double           xf, yf, ixf, iyf, xpd, ypd;&#xA;   double           *freqArr, *freqArrPad;&#xA;&#xA;   fftw_complex     *fftdata, *padfft;&#xA;   fftw_plan        t2f, t2pad;&#xA;&#xA;   ixf       = 10.0; // The bin that will have max amplitude in the fourier&#xA;   iyf       = 10.0; // plane. &#xA;&#xA;   xpd       = xSize/ixf; // The period of the wave, in the x and y directions&#xA;   ypd       = ySize/iyf;&#xA;&#xA;   xf       = 1./xpd; // The actual frequency of the wave&#xA;   yf       = 1./ypd;&#xA;&#xA;   padfac    = 32;&#xA;   pady   = padfac * ySize;&#xA;   padx   = padfac * xSize;&#xA;&#xA;   padnpt    = pady * padx;&#xA;   npt       = xSize * ySize;&#xA;   data      = calloc(npt, sizeof(*data));&#xA;   fftdata   = calloc(npt, sizeof(*fftdata));&#xA;   freqArr   = calloc(npt, sizeof(*freqArr));&#xA;   padfft    = calloc(padnpt, sizeof(*padfft));&#xA;   paddata   = calloc(padnpt, sizeof(*paddata));&#xA;   freqArrPad = calloc(padnpt, sizeof(*freqArrPad));&#xA;&#xA;   t2f     = fftw_plan_dft_r2c_2d(xSize, ySize, data, fftdata, FFTW_ESTIMATE);&#xA;   t2pad   = fftw_plan_dft_r2c_2d(padx,pady,paddata,padfft,FFTW_ESTIMATE);&#xA;&#xA;   generate2DSin(data, 1., xf, yf, 0., xSize, ySize);&#xA;&#xA;   for(ii = 0; ii &amp;lt; ySize; ii++) {&#xA;      for(jj = 0; jj &amp;lt; xSize; jj++) {&#xA;         index = ii * xSize + jj;&#xA;         paddata[index] = data[index];&#xA;      }&#xA;   }&#xA;   for(ii = ySize; ii &amp;lt; pady; ii++) {&#xA;      for(jj = xSize; jj &amp;lt; padx; jj++) {&#xA;         index = ii*padx + jj;&#xA;         paddata[index] = 0.;&#xA;      }&#xA;   }&#xA;&#xA;   fftw_execute(t2f);&#xA;   fftw_execute(t2pad);&#xA;&#xA;   minmaxArrayC(0, npt, fftdata, &amp;amp;dum, &amp;amp;maxfft);&#xA;   minmaxArrayC(0, padnpt, padfft, &amp;amp;dum, &amp;amp;maxpad);&#xA;&#xA;   fftFreqD(ySize, 1, freqArr);&#xA;   fftFreqD(pady, 1, freqArrPad);&#xA;&#xA;   for(ii = 0; ii &amp;lt; ySize; ii++){&#xA;      for(jj = 0; jj &amp;lt; xSize; jj++) {&#xA;         index = ii*xSize + jj;&#xA;         if(cabs(fftdata[index]) == maxfft){&#xA;            posmax = freqArr[ii];&#xA;         }&#xA;      }&#xA;   }&#xA;   for(ii = 0; ii &amp;lt; pady; ii++){&#xA;      for(jj = 0; jj &amp;lt; padx; jj++) {&#xA;         index = ii*padx + jj;&#xA;         if(cabs(padfft[index]) == maxpad)&#xA;            posmaxpad = freqArrPad[ii];&#xA;      }&#xA;   }&#xA;&#xA;   printf(&quot;FFT Max: % 5.5lf Where: % 5.5lf\n&quot;, maxfft, posmax);&#xA;   printf(&quot;pad Max: % 5.5lf Where: % 5.5lf\n&quot;, maxpad, posmaxpad);&#xA;&#xA;   return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3183" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-08-20T04:14:56.397" Title="Algorithm to zero pad data before FFT" Tags="|fft|algorithms|python|c|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="10364" PostTypeId="1" CreationDate="2013-08-18T22:38:16.273" Score="5" ViewCount="14818" Body="&lt;p&gt;I'm wondering if anyone knows of any &lt;strong&gt;open source&lt;/strong&gt; solutions to note recognition. I'm planning on building a program for online sheet music, which recognizes your notes, and tries to tell you what you can improve, and how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for piano for example, I don't even know if it's possible to have software that detects various notes at once, with very high speed. If anyone knows anything like this, please let me know!&lt;/p&gt;&#xA;" OwnerDisplayName="Marianos" LastEditorUserId="5209" LastEditDate="2013-09-18T17:00:59.907" LastActivityDate="2018-12-11T22:07:49.540" Title="Note Recognition Software" Tags="|audio|pitch|detection|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10365" PostTypeId="2" ParentId="10364" CreationDate="2013-08-19T14:20:27.770" Score="0" Body="&lt;p&gt;Something called MuseScore will recognise notes from keyboard/MIDI inputs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.osalt.com/musescore&quot; rel=&quot;nofollow&quot;&gt;http://www.osalt.com/musescore&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://musescore.org/&quot; rel=&quot;nofollow&quot;&gt;http://musescore.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's an open source alternative to Sibelius. &lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-08-19T14:20:27.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10366" PostTypeId="1" CreationDate="2013-08-19T14:48:20.237" Score="2" ViewCount="1322" Body="&lt;p&gt;&lt;a href=&quot;http://www.ece.umd.edu/~tpruthi/reports/projenee624.PDF&quot; rel=&quot;nofollow noreferrer&quot;&gt;I am referring to this report on pitch estimation.&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author does envelope extraction using Hilbert transform before applying AMDF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FvBiv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the advantage of doing that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is speech a narrowband or wideband signal? I read somewhere that hilbert envelope extraction works better for narrowband signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I extracted envelope of a speech signal using Hilbert transform, in some places the envelope was almost the same as the original waveform(Figure 1), whereas in other places it tracked the upper portions of waveforms (Figure 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Red curve is the Hilbert envelope, blue curve is the speech waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fig 1&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uAlux.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fig 2&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4EWhr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="80" LastEditDate="2013-08-19T16:33:33.227" LastActivityDate="2013-08-21T00:27:54.153" Title="Why do envelope extraction before pitch detection?" Tags="|speech|pitch|hilbert-transform|preprocessing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10367" PostTypeId="2" ParentId="10363" CreationDate="2013-08-19T17:04:37.393" Score="1" Body="&lt;p&gt;There are instances when some care must be taken when zero padding (ie preservation of signal parity).  However, it doesn't seem like it should make a difference in your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two things I can think of that might affect your result, or at least your interpretation of the result. The first is scaling; zero padding will affect the average power of your signal. The second is that depending on the number of zeros you choose to add to the end, you can alter the locations of the bin centers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MATLAB code below shows an example of what one might expect to see when zero-padding to improve FFT granularity.  Notice that both the peak location and peak amplitude become &lt;em&gt;more accurate&lt;/em&gt; in the zero-padded version.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 48e3;                          % Sampling rate (Hz)&#xA;f0 = 5e3;                           % Center frequency&#xA;N = 2^7;                            % Samples in time series&#xA;K = 8;                              % Zero-pad factor&#xA;&#xA;% Generate N time indices&#xA;t = (0:N-1)/Fs;&#xA;&#xA;% Create a sinusoid signal of length N*Fs at f0 Hz&#xA;x = cos(2*pi*f0*t)/N;&#xA;&#xA;% Create a zero-padded version of x&#xA;xpad = [x, zeros(1,(K-1)*length(x))];&#xA;&#xA;% Helper function for plotting FFT&#xA;plotFFT=@(x,N,Fs,spec) plot(Fs*(0:N-1)/N-Fs/2, abs(fftshift(fft(x))),spec);&#xA;&#xA;% Plot padded FFT vs unpadded FFT&#xA;figure(1);&#xA;plotFFT(xpad,length(xpad),Fs,'b'); hold on;&#xA;plotFFT(x,length(x),Fs,'-ro'); hold off;&#xA;title('Padded vs. Unpadded FFT'); legend('Padded FFT','Unpadded FFT');&#xA;xlabel('Frequency (Hz)'); ylabel('abs( X(f) )');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZVq5B.png&quot; alt=&quot;Padded vs. Unpadded FFT&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5156" LastEditorUserId="5156" LastEditDate="2013-08-19T18:59:11.907" LastActivityDate="2013-08-19T18:59:11.907" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="10369" PostTypeId="1" AcceptedAnswerId="11355" CreationDate="2013-08-19T18:23:59.730" Score="22" ViewCount="39228" Body="&lt;p&gt;I asked a question earlier but I didn't get any answer for it. So now I am simplifying it: what are &lt;em&gt;Cross-Spectral Density&lt;/em&gt; (CSD) and &lt;em&gt;Power-Spectral Sensity&lt;/em&gt; (PSD)? What is their application? How can I get them in MATLAB?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$S_{kl}(\omega)=\lim_{T\to\infty}\frac{1}{T}E\{Y_k^*(\omega)Y_l(\omega)\} $$&#xA;  $$S_{kk}(\omega)=\lim_{T\to\infty}\frac{1}{T}E\{Y_k^*(\omega)Y_k(\omega)\} $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$S_{kl}(\omega)$ is the cross-spectral density (CSD) function between&#xA;  general signals $y_k(t)$ and $y_l(t)$, $S_{kk}(\omega)$ is the&#xA;  power-spectral density (PSD) of signal $y_k(t)$, $Y_k(\omega)$ is the&#xA;  finite Fourier transform of signal $y_k(t)$ at frequency $\omega$,&#xA;  $Y_k^*(\omega)$ is the complex conjugate of $Y_k(\omega)$, and&#xA;  $E\{\cdot\}$ is the expectation operator.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My earlier question was: &#xA;What does 'wavelet power spectrum', 'Auto-power spectrum','cross-power spectrum' means in wavelet application? I was studying about mode shape identification with wavelet method and these terms confused me.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="8202" LastEditDate="2016-04-05T17:50:21.507" LastActivityDate="2023-02-21T15:48:37.527" Title="What is cross-spectral density- CSD?" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10370" PostTypeId="2" ParentId="10363" CreationDate="2013-08-19T20:12:18.983" Score="2" Body="&lt;p&gt;Zero-padding data (that has not been previously non-rectangularly windowed) adds more visible rectangular window artifacts to non-periodic-in-aperture signals.  You might be looking at all the local maxima of the ripples of the resulting Sinc function, which are alongside a main lobe maxima.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-19T20:12:18.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10371" PostTypeId="2" ParentId="10366" CreationDate="2013-08-19T20:27:32.670" Score="1" Body="&lt;p&gt;In a generic 1st order resonant system, energy is usually continually being exchanged between 2 quantities, such as displacement vs. momentum (etc.), with the combined energy changing at a much slower rate.   The Hilbert transformer, after the bandpass, is trying to estimate one quantity (not being measured) from the other (say local air pressure, or displacement of a resonator surface) that is actually measured.  If the energy of the sum of the two varying quantities stays about the same over time, then there might be energy at that frequency worth being measured.  Otherwise it might be just a measurement transient having not much to do with some resonant happening at that frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Vocalizations usually involve several different vocal tract resonances.  It's usually easier to try to detect and/or measure each potential resonance separately when trying to characterize what's going on with a mix of multiple simultaneous energy exchange systems, than to try and solve for the entire mix all at once.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-21T00:27:54.153" LastActivityDate="2013-08-21T00:27:54.153" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10372" PostTypeId="1" AcceptedAnswerId="10373" CreationDate="2013-08-20T01:29:38.000" Score="2" ViewCount="7199" Body="&lt;p&gt;I'm learning &lt;code&gt;feature-detectors&lt;/code&gt; from this &lt;a href=&quot;http://campar.in.tum.de/twiki/pub/Chair/TeachingWs09MATDCV/feature_detectors2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt;, and I don't quite understand the &lt;code&gt;Normalized Laplacian of Gaussian&lt;/code&gt; filtered image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the original image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8rLG8.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is the output presented in the lecture notes, filtered by &lt;em&gt;Normalized Laplacian of Gaussian&lt;/em&gt; with $\sigma=2.502$:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vlBbV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and here is mine, using &lt;code&gt;scipy.ndimage.filters.gaussian_laplace&lt;/code&gt; with $\sigma=2.502$:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/pJj2o.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, my output image is quite different from the one in the lecture notes. The background of the lecture's output is totally black, even if I did some thresholding, my output is still different from the lecture's. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, I noticed that edges almost disappeared in the lecture's output, and around each detected blob, there seems to be a ring surrounding it, like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Wo2zD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is that? Am I using &lt;code&gt;Laplacian of Gaussian&lt;/code&gt; wrong?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="4811" LastEditDate="2013-08-20T01:48:55.793" LastActivityDate="2013-08-20T02:10:37.207" Title="blob detection using Laplacian of Gaussian filter" Tags="|image-processing|local-features|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10373" PostTypeId="2" ParentId="10372" CreationDate="2013-08-20T02:10:37.207" Score="4" Body="&lt;p&gt;Most likely your images look different from the ones in the lectures because of scaling. Note that the result of the convolution with a Laplacian filter will have positive and negative values. What the resulting image looks like depends on the data type of the array, and on the range to which the values are scaled.  For example, if you store your filtered image in uint8, without doing any scaling yourself, the negative values will be truncated to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, when an image has negative values, it is scaled so that 0 corresponds to a neutral gray, the minimum value to black, and the maximum to white. It looks like this is what is happening in your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, in this particular case you are probably interested in both maxima and minima of the Laplacian (dark on bright and bright on dark blobs), so you may as well just take the absolute value of the filtered image.  Then you will not have any negative values, which makes the scaling easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as your question about the edges, this is exactly what should be happening. The value of the Laplacian at an edge should be close to zero. This property is used for very precise edge localization by &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/zeros.htm&quot; rel=&quot;nofollow&quot;&gt;finding the zero-crossings of the Laplacian of Gaussian&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-08-20T02:10:37.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10374" PostTypeId="2" ParentId="10287" CreationDate="2013-08-20T02:46:55.957" Score="2" Body="&lt;p&gt;AMDF, ASDF, and autocorrelation (all in the time domain) make no assumption about any energy at the fundamental, even though they make some assumption about periodicity.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-08-20T02:46:55.957" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10375" PostTypeId="1" CreationDate="2013-08-20T04:21:41.990" Score="3" ViewCount="3357" Body="&lt;p&gt;I believe that I read, for digital modulation with multiple levels, that the AGC makes use of the fact that the symbol sequence, before noise etc., can be modeled as a uniform distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{Source $\rightarrow$source-coding $\rightarrow$FEC$\rightarrow$ interleaving $\rightarrow$ bit-scrambling $\rightarrow$ modulation $\rightarrow$ channel}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What other advantages are there to bit scrambling (not for privacy/security).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chris.&lt;/p&gt;&#xA;" OwnerUserId="5269" LastEditorUserId="1629" LastEditDate="2016-05-19T08:16:02.870" LastActivityDate="2016-05-19T08:16:02.870" Title="Bit scrambling as last state of transmitter - what advantages are there?" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10377" PostTypeId="2" ParentId="10375" CreationDate="2013-08-20T06:14:38.487" Score="7" Body="&lt;p&gt;In normal usage, scrambling is used for two reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;It is used to remove the possibility of a long sequence of 1's and 0's in the bit sequence. The long sequence of 1's and 0's make timing synchronisation and clock synchronisation tougher at the receiver as regular transitions  help in working  of adaptive circuits like AGC and phase locked loop.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It eliminates the dependence of signal's power spectrum on the transmitted information sequence thereby keeping it below the maximum power spectral density requirement. If scrambling is not done, power might be concentrated in a narrow frequency band thereby causing intermodulation and crossmodulation distortion to adjacent channels.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Reference:&#xA;&lt;a href=&quot;http://www.princeton.edu/~achaney/tmve/wiki100k/docs/Scrambler.html&quot;&gt;http://www.princeton.edu/~achaney/tmve/wiki100k/docs/Scrambler.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4375" LastActivityDate="2013-08-20T06:14:38.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10380" PostTypeId="2" ParentId="10366" CreationDate="2013-08-20T09:31:31.560" Score="2" Body="&lt;p&gt;My guess is that the Hilbert Transform is a pre-processing step which attempts to make the actual pitch detection stage (AMDF, in this case) more robust.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic reasoning is this: pitch detection of speech is made more difficult by the time-varying spectral characteristics of the signal.  On the other hand, pitch detection of an impulse train is easy: just count the number of samples between each pulse (or look for the first peak of the auto-correlation function/the first dip of the AMDF etc). Pre-processing the speech signal to make it more pulse-like therefore improves the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your diagrams, the Hilbert transform does make the speech pulses more impulsive, though I think that other pre-processing steps (e.g. inverse-filtering by the estimated spectral envelope) is likely to yield better results.&lt;/p&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2013-08-20T09:31:31.560" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10381" PostTypeId="1" CreationDate="2013-08-20T09:55:17.513" Score="0" ViewCount="118" Body="&lt;p&gt;I am using complex morlet wavelet to estimate frequencies and damping ratios in a 1-D signal. I have done it so far, and the results are accurate enough. Now my question is how can I modify or optimize my method to get better result. like mixing it with other method such as Neural networks or anything else. I know this question is a bit weird But I need to modify my method somehow.&lt;br&gt;&#xA;Kind regards.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-08-20T13:25:58.450" LastActivityDate="2013-08-20T13:25:58.450" Title="How to optimize a wavelet transform?" Tags="|frequency-spectrum|frequency|wavelet|frequency-domain|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10382" PostTypeId="1" AcceptedAnswerId="10407" CreationDate="2013-08-20T08:36:02.913" Score="2" ViewCount="348" Body="&lt;p&gt;Say I am trying to measure a exponentially decaying signal ($S_y$), that constitutes a portion $\gamma$ (about 5% so $\gamma=\frac{1}{20}$) of total signal measured($S=S_y+S_b$ and $S_b=S_0 \beta e^{\frac{-t}{C_b}}$ and $S_y=S_0 \gamma e^{\frac{-t}{C_y}}$). Where $\gamma+\beta=1$ and $C_Y$ is about $\frac{1}{4}$ of $C_b$. I want to determine the least Signal-to-Noise Ratio (SNR) needed to be able to discern that signal. The noise in our signal is additive white noise. Should the SNR be $&amp;gt;\gamma=\frac{1}{20}$ or is there a better more formal way to decide the SNR limit? $$S(t)=S_0(\gamma e^{\frac{-t}{C_y}}+\beta e^{\frac{-t}{C_b}}) + n(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is &lt;code&gt;how&lt;/code&gt; do I determine the minimal SNR when I measure signal $S$ over time $t$, but the thing I am interested in is fluctuation (max 10%) in $S_y$. All constants are known to me, however i only know the mean of $C_y$, as it fluctuates and so $S_y$ does too. Thanks for any help. If I need to clarify any details please tell me and I will do so.&lt;/p&gt;&#xA;" OwnerUserId="5273" OwnerDisplayName="Leo" LastEditorUserId="5273" LastEditDate="2013-08-23T09:30:59.307" LastActivityDate="2013-08-23T09:30:59.307" Title="Signal-to-Noise Ratio (SNR) needed to discern two superimposed signals" Tags="|homework|noise|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="10383" PostTypeId="1" AcceptedAnswerId="10385" CreationDate="2013-08-20T11:49:32.193" Score="4" ViewCount="8181" Body="&lt;p&gt;I am trying to speed up some of my code and for physical reasons I need to do an FFT shift to get the FFT data in the standard DFT fourier representation. In Matlab this is performed in the frequency domain, with a data swap. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had believed that I found a numerical trick, by performing the shift in the time domain, before transformation I was able to save a reasonable amount of computation time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that for some reason the results are slightly different. I am curious as to why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matlab code is as follows for a 1K signal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%1khz&#xA;f=1000;&#xA;t=0:.0001:5;&#xA;x=sin(2*pi*f*t);&#xA;%Wave&#xA;subplot(4,1,1);&#xA;plot(x)&#xA;%FFT&#xA;subplot(4,1,2)&#xA;ffted=fft(x);&#xA;plot(real(ffted));&#xA;%FFT Shifted&#xA;subplot(4,1,3)&#xA;shifted=fftshift(ffted);&#xA;plot(real(shifted));&#xA;%FFT Shifted by preshifting&#xA;subplot(4,1,4)&#xA;s=zeros(1,length(x));%In languages like C++ this is computationally inexpesnive&#xA;for i=1:length(x)&#xA;    if (bitget(i,1))%odd evens, works for real signal&#xA;        s(i)=-1;&#xA;    else&#xA;        s(i)=1;&#xA;    end&#xA;end&#xA;chirpshifted=fft(s.*x);&#xA;plot(real(chirpshifted));&#xA;%Difference&#xA;A=sum(real(chirpshifted));&#xA;B=sum(real(shifted));&#xA;A&#xA;B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="941" LastEditorUserId="941" LastEditDate="2013-08-20T12:34:53.060" LastActivityDate="2013-08-20T13:40:58.473" Title="Why does an fftshift in the time domain give a different result compared to the frequency domain?" Tags="|matlab|fft|discrete-signals|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10384" PostTypeId="1" AcceptedAnswerId="10392" CreationDate="2013-08-20T13:14:42.647" Score="1" ViewCount="2822" Body="&lt;p&gt;A bit of noob question, but can't find a definite answer anywhere:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the difference between &lt;strong&gt;Gray-scale resolution&lt;/strong&gt; of an image and the &lt;strong&gt;Image contrast&lt;/strong&gt;.&#xA;Are they different terminology for the same thing?&lt;/p&gt;&#xA;" OwnerUserId="4530" LastActivityDate="2022-06-15T12:16:48.387" Title="Grayscale/Brightness Resolution vs Contrast" Tags="|computer-vision|image-processing|resolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10385" PostTypeId="2" ParentId="10383" CreationDate="2013-08-20T13:40:58.473" Score="6" Body="&lt;p&gt;There are a couple issues with your code. First, let's talk about why you can do what you're trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're trying to take advantage of is the duality between a multiplication in the time domain and convolution in the frequency domain. The &lt;code&gt;fftshift()&lt;/code&gt; function simply swaps the two halves of a vector (which is assumed to be the result of a call to &lt;code&gt;fft()&lt;/code&gt;). This operation is equivalent to a circular rotation of half of the vector length in the frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can accomplish the same operation by multiplying by a complex exponential function in the time domain before the FFT, as you noted. To get an $M$-sample shift, you need to multiply by a complex exponential that looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s[n] = e^{\frac{j2\pi nM}{N} }&#xA; $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the case where $M = \frac{N}{2}$, this simplifies to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s[n] = e^{j\pi n} = [1, -1, 1, -1, \ldots]&#xA; $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This illustrates problem #1 with your script: it multiplies by the inverse of the above: $-s[n]$. You need to invert the sense of the &lt;code&gt;if&lt;/code&gt; statement in the for loop to ensure that the vector &lt;code&gt;s&lt;/code&gt; has the appropriate value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem #2 stems from another simple MATLAB mistake: all of the vectors in your simulation are length &lt;code&gt;50001&lt;/code&gt;. So, the time-domain rotation that you're doing by multiplying by the $s[n]$ illustrated above actually results in an effective frequency domain shift of &lt;code&gt;25000.5&lt;/code&gt; bins (instead of the &lt;code&gt;25000&lt;/code&gt;-bin shift implemented by &lt;code&gt;fftshift()&lt;/code&gt;). The mismatch in results is due to this extra half-bin shift. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can fix this problem in two ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Change the time-domain multiplication to multiply by an actual complex exponential vector at the appropriate frequency (i.e. set $M=25000$ and $N=50001$ in the first equation). The resulting signal at the input to the FFT will be complex.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Change your simulation to use even-length vectors (i.e. chop off the last element of the &lt;code&gt;t&lt;/code&gt; vector that you initialize at the beginning).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I tweaked your simulation to fix the generation of &lt;code&gt;s&lt;/code&gt; and truncate the vector length to &lt;code&gt;50000&lt;/code&gt;. It is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%1khz&#xA;f=1000;&#xA;t=0:.0001:5;&#xA;t=t(1:length(t)-1);&#xA;x=sin(2*pi*f*t);&#xA;%Wave&#xA;subplot(4,1,1);&#xA;plot(x)&#xA;%FFT&#xA;subplot(4,1,2)&#xA;ffted=fft(x);&#xA;plot(real(ffted));&#xA;%FFT Shifted&#xA;subplot(4,1,3)&#xA;shifted=fftshift(ffted);&#xA;plot(real(shifted));&#xA;%FFT Shifted by preshifting&#xA;subplot(4,1,4)&#xA;s=zeros(1,length(x));%In languages like C++ this is computationally inexpesnive&#xA;for i=1:length(x)&#xA;    if (~bitget(i,1))%odd evens, works for real signal&#xA;        s(i)=-1;&#xA;    else&#xA;        s(i)=1;&#xA;    end&#xA;end&#xA;chirpshifted=fft(s.*x);&#xA;plot(real(chirpshifted));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then compare the results of the two methods:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; diff = abs(chirpshifted-shifted);&#xA;&amp;gt;&amp;gt; sum(diff)&#xA;ans =&#xA;&#xA;   3.3406e-21&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, the results agree as perfectly as you would expect from floating-point math.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-08-20T13:40:58.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10386" PostTypeId="1" CreationDate="2013-08-20T13:57:44.570" Score="1" ViewCount="325" Body="&lt;p&gt;I have Digital Image processing (DIP)  in my academics and I am looking for some reliable and daily updating sources for learning DIP Filters for Enhancements,color conversions, Filtering purposes through MATLAB , please suggest me some websites or tutorials which can help me. Thank you.   &lt;/p&gt;&#xA;" OwnerUserId="4580" LastEditorUserId="4580" LastEditDate="2013-09-07T00:13:54.387" LastActivityDate="2013-09-07T00:13:54.387" Title="sources for learning Image processing with MATLAB?" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="2" ClosedDate="2013-09-06T21:19:23.553" ContentLicense="CC BY-SA 3.0" />
  <row Id="10387" PostTypeId="1" AcceptedAnswerId="10390" CreationDate="2013-08-20T13:58:13.233" Score="5" ViewCount="5763" Body="&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a newbie in DSP. I am implementing a simple Kalman Filter that estimates the heading direction of a robot. The robot is equipped with a compass and a gyroscope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Understanding:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking about representing my state as a 2D vector $(x, \dot{x})$, where $x$ is the current heading direction and  $\dot{x}$ is the rotation rate reported by the gyroscope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If my understanding is correct, there will be no control term, $u$ in my filter. Is it true? What if I take the state as a 1D vector $(x)$? Then does my $\dot{x}$becomes the control term $u$? Will these two methods yield different results?&lt;/li&gt;&#xA;&lt;li&gt;As we know, the main noise source comes from the compass when the compass is in a distorted magnetic field. Here, I suppose the Gaussian noise is less significant. But the magnetic distortion is totally unpredictable. How do we model it in the Kalman Filter?&lt;/li&gt;&#xA;&lt;li&gt;In Kalman Filter, is the assumption that &quot;all the noises are white&quot; necessary? Say, if my noise distribution is actually a Laplacian distribution, can I still use a Kalman Filter? Or I have to switch to another filter, like Extended Kalman Filter?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4677" LastActivityDate="2013-08-20T15:38:51.467" Title="How to model the noise in Kalman Filter?" Tags="|kalman-filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10388" PostTypeId="2" ParentId="10386" CreationDate="2013-08-20T14:34:09.297" Score="1" Body="&lt;p&gt;It does not update daily, but &lt;a href=&quot;http://blogs.mathworks.com/steve/&quot; rel=&quot;nofollow&quot;&gt;Steve Eddins' blog on image processing&lt;/a&gt; is an excellent source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steve is a co-author of &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0982085400&quot; rel=&quot;nofollow&quot;&gt;Digital Image Processing using MATLAB&lt;/a&gt;, which is also a great source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another excellent source on image processing in general (not MATLAB-specific) are the &lt;a href=&quot;http://archive.org/details/Lectures_on_Image_Processing&quot; rel=&quot;nofollow&quot;&gt;lecture notes of Prof. Alan Peters&lt;/a&gt; from Vanderbuilt University.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-08-20T14:34:09.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10389" PostTypeId="2" ParentId="10387" CreationDate="2013-08-20T15:10:14.440" Score="3" Body="&lt;p&gt;Some quick answers:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You are correct; there would be no control term in your filter, unless you have some component on your robot (e.g. a motor) that is attempting to apply some known change to the robot's orientation. If you do have something like this, then you can add its contribution to your robot's orientation into the Kalman filter model pretty simply, and you should get better state estimates.&lt;/p&gt;&#xA;&lt;p&gt;I would recommend reading the &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple example on the Wikipedia page for Kalman filters&lt;/a&gt;, if you haven't already. It is a similar problem to yours, with a body undergoing one-dimensional motion (although it is linear), with the goal being to estimate the body's position and velocity versus time while only measuring its position. Yours is slightly different since you can measure the angular velocity also using the gyroscope, but it's a good starting point.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I'm not familiar with the physics underlying the effects of magnetic distortion on your compass, so I'm not sure what to recommend for that aspect of your problem.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Nitpick: it's possible to have non-white Gaussian noise. &amp;quot;White&amp;quot; noise just refers to a noise process whose realizations are all independent of one another. You could have non-Gaussian white noise, for example. Additive Gaussian white noise (AWGN) is a very common assumption, which is why you might think they go together.&lt;/p&gt;&#xA;&lt;p&gt;Kalman filters inherently make the assumption that all noise processes are Gaussian, which often is a good assumption even when it's not strictly true. If your system is sufficiently non-Gaussian for KFs to not be a good approach, then something like a &lt;a href=&quot;http://en.wikipedia.org/wiki/Particle_filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;particle filter&lt;/a&gt; (which I have no real expertise with) might be able to help you.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-08-20T15:10:14.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10390" PostTypeId="2" ParentId="10387" CreationDate="2013-08-20T15:32:52.113" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You are most likely not having a control vector $u$. Maybe you can somehow model it into the filter, but it is not required in your case and uncommon. Furthermore $\overset{.}{x}$ is not your gyro input but it is the Kalman filtered rotation rate calculated after using all your measurements.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Usually, the main effects on a magnetometer are hard iron and soft iron effects. There is a lot of articles out there that describe the cause and how to mitigate those. I would probably do this in a preprocessing step and leave it out of the Kalman filter entirely. Furthermore, if you have some means to detect if you are in a strongly distorted field (e.g. because the absolute strength is going up), you can increase the measurement noise you report to the Kalman filter for those measurements. This will indicate to the filter to not trust the values coming from the magnetometer anymore. So if you know the total strength of the earth's magnetic field and you suddenly measure a much stronger field, you could use this technique. This is also commonly done with accelerometers to put less trust on values measured when the vehicle is actually accelerating and hence, the measurement is not pointing &quot;down&quot;. &lt;a href=&quot;http://www.convict.lu/htm/rob/imperfect_data_in_a_noisy_world.htm&quot; rel=&quot;nofollow&quot;&gt;See here for an example&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your noise has to be white and it has to be Gaussian or near Gaussian. You can only have correlation between the different measurements of one time step but not between multiple time steps. If you search around in the academic world, there are many papers presenting adapted Kalman filters for other noise types that work more or less well (see &lt;a href=&quot;http://espace.library.curtin.edu.au/R/?func=dbin-jump-full&amp;amp;object_id=167832&amp;amp;local_base=GEN01-ERA02&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for example, haven't tested this, though). EKF and UKF approaches don't help here, either. You use those, when you have a nonlinear system model. As already said, if your noise is very non-white and non-gaussian that you get big estimation errors, then a particle filter is an option.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5069" LastEditorUserId="5069" LastEditDate="2013-08-20T15:38:51.467" LastActivityDate="2013-08-20T15:38:51.467" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10391" PostTypeId="2" ParentId="10190" CreationDate="2013-08-20T16:07:37.467" Score="1" Body="&lt;p&gt;How about the &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_wavelet_transform#Dual-tree_complex_wavelet_transform&quot; rel=&quot;nofollow&quot;&gt;dual-tree complex wavelet transform&lt;/a&gt;. You essentially have a complex wavelet, the real and imaginary parts of which comprise a (approximate) Hilbert pair, so you get something quite akin to the Fourier transform, in which displacement in the time domain manifests as a phase change in the DTCWT domain, with a slowly varying amplitude.&lt;/p&gt;&#xA;" OwnerUserId="1263" LastActivityDate="2013-08-20T16:07:37.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10392" PostTypeId="2" ParentId="10384" CreationDate="2013-08-20T16:31:24.757" Score="3" Body="&lt;p&gt;Gray-scale resolution and image contrast are different.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/962727&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gray-scale resolution&lt;/a&gt; looks at &lt;em&gt;how many&lt;/em&gt; gray scales are being used to present the image.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Contrast_(vision)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image contrast&lt;/a&gt;, on the other hand, looks at the difference between the maximum and minimum values of the gray scales used to present an image.&lt;/p&gt;&#xA;&lt;p&gt;For example, a low gray-scale resolution, low contrast image might only use #000000 and #010101 (#RRGGBB where RR = red value, GG = green value, BB = blue value).&lt;/p&gt;&#xA;&lt;p&gt;A low gray-scale resolution, &lt;strong&gt;high&lt;/strong&gt; contrast image might only use #000000 and #FFFFFF (and only those two gray-scale values).&lt;/p&gt;&#xA;&lt;p&gt;A &lt;strong&gt;high&lt;/strong&gt; gray-scale resolution, low contrast image might have a maximum gray scale value of #1F1F1F (5 bits) and a minimum of #000000, but use all gray scales in between.&lt;/p&gt;&#xA;&lt;p&gt;A &lt;strong&gt;high&lt;/strong&gt; gray-scale resolution, &lt;strong&gt;high&lt;/strong&gt; contrast image might have a maximum gray scale value of #FFFFFF (8 bits) and a minimum of #000000 (and use all gray scales in between).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="7092" LastEditDate="2022-06-15T12:16:48.387" LastActivityDate="2022-06-15T12:16:48.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10394" PostTypeId="2" ParentId="10386" CreationDate="2013-08-20T18:49:49.347" Score="1" Body="&lt;p&gt;You can also search for &lt;code&gt;Image Processing Toolbox User's Guide&lt;/code&gt; which is a user's guide to Image Processing Toolbox of MATLAB, which is available online.&lt;/p&gt;&#xA;" OwnerUserId="5104" LastActivityDate="2013-08-20T18:49:49.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10395" PostTypeId="1" AcceptedAnswerId="10397" CreationDate="2013-08-20T20:37:05.593" Score="0" ViewCount="152" Body="&lt;p&gt;This is primarily a question about how to name my filter.  Suppose that I have a photon detector, and that I want to measure the rate at which photons arrive, with a simple gated counter (because this is the only hardware I have).  The photon rate is just the counter value divided by the gate interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that the counter is an integrator: so by opening the gate for, say, 1 second, I have made a first-order low pass filter (LPF).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose that I take the mean of, say, 10 such measurements.  Have I now built a second-order LPF? Or merely a first-order LPF with a longer time-constant?  Does the answer change if the measurements are not consecutive?  &lt;/p&gt;&#xA;" OwnerUserId="3820" LastEditorUserId="13320" LastEditDate="2017-04-17T17:46:12.703" LastActivityDate="2017-04-17T17:46:12.703" Title="How does one &quot;count&quot; filter order?" Tags="|lowpass-filter|integration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10396" PostTypeId="1" AcceptedAnswerId="10406" CreationDate="2013-08-20T21:27:25.443" Score="4" ViewCount="1596" Body="&lt;p&gt;I am using Q1.15 fixed-point values to represent a 12-bit signed integer value. I was wondering if it matters if I use the  11 MSB or LSB of the fractional part to represent my 11 magnitude bits? Only thing I can think of is using LSB might in some cases reduces the chance of overflow errors and maybe allow me to use larger fixed-point FIR coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am using the ARM CMSIS-DSP FIR filtering functions and from what I understand the Q15 set of functions expects Q15 coefficients, Q15 state variables, Q15 result and of course Q15 input data. So in this case I will not be able to increase the precision on my Q15 filter coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there then any difference?&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2016-10-19T09:08:49.447" Title="Fixed-point and ARM CMSIS-DSP FIR filters" Tags="|filters|fixed-point|arm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10397" PostTypeId="2" ParentId="10395" CreationDate="2013-08-20T21:35:02.230" Score="1" Body="&lt;p&gt;The easiest way to understand the concept of filter order is to look at the Laplace (continuous time) or Z-transform (discrete time) of the filter.  The filter order is the order of the transform's denominator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the Laplace transform of an integrator is $\frac{1}{s}$.  Extending the time of the integration does not change that it is an integrator, it just changes the bounds of the integration.  If you were to make it a double integration, though (two integrators in series), then the Laplace transform would be $\frac{1}{s^2}$ and you would have a 2nd order filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Averaging can be considered a partial integration with a gain factor, so your integrator with averaging would be a variant of a double integrator, making it a second order filter.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-08-21T01:25:35.490" LastActivityDate="2013-08-21T01:25:35.490" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10398" PostTypeId="1" AcceptedAnswerId="10418" CreationDate="2013-08-21T00:51:01.380" Score="1" ViewCount="7844" Body="&lt;p&gt;As I understand aliasing is because you sample a high frequency with a low sample rate, and the sample points don't have enough information about the high frequency component. Here is an example of aliasing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w = 5.0;(*signal frequency*) &#xA;dt = 0.66125;(*sampling rate*)&#xA;f[x_] := Sin[w x]&#xA;ls = Table[f[x], {x, dt, 200 dt, dt}];(*sample points*)&#xA;&#xA;ListPlot[ls, PlotRange -&amp;gt; All, Joined -&amp;gt; True, &#xA; DataRange -&amp;gt; {dt, 200 dt}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J3f6S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can see in the plot that there is beating. &#xA;And the Fourier transform gives only one frequency(except the symmetric negative frequency one).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DFT[A_, ht_] := &#xA; RotateRight[&#xA;  ht/Sqrt[2 \[Pi]]*&#xA;   Fourier[RotateLeft[A, Length[A]/2 - 1], &#xA;    FourierParameters -&amp;gt; {1, 1}], Length[A]/2 - 1]&#xA;&#xA;ListPlot[Abs[DFT[ls, dt]]^2, PlotRange -&amp;gt; All, Joined -&amp;gt; True, &#xA; DataRange -&amp;gt; {-1/dt/2, 1/dt/2}, Axes -&amp;gt; False, Frame -&amp;gt; True]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JVnfs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why there is the beating but only one peak in the Fourier transform? Since there is only one frequency in the sample, what is it beating against?&lt;/li&gt;&#xA;&lt;li&gt;How to calculate the beating frequency and the aliasing frequency?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As chirlu points out there is not beating, if it is the beating because of adjacent frequencies, we would expect to see two separated peaks if we increase the Fourier transform resolution. Here I increase the frequency resolution by including more sample points, and we can see it is a single peak, not adjacent peaks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ls = Table[f[x], {x, dt, 800 dt, dt}];(*sample points*)ListPlot[ls, &#xA; PlotRange -&amp;gt; All, Joined -&amp;gt; True, DataRange -&amp;gt; {dt, 200 dt}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2QiRt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7RTx6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example using sound:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Play[Sin[3000 t], {t, 0, 2}, SampleRate -&amp;gt; 6000]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7pLia.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Play[Sin[3000 t], {t, 0, 2}, SampleRate -&amp;gt; 950]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uvNOk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So use a lower sample rate, we can actually hear the beating!&lt;/p&gt;&#xA;" OwnerUserId="5278" LastEditorUserId="5278" LastEditDate="2013-08-21T21:27:47.933" LastActivityDate="2017-09-20T18:45:13.033" Title="Aliasing beating frequency" Tags="|sampling|aliasing|" AnswerCount="4" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="10399" PostTypeId="1" CreationDate="2013-08-21T03:49:34.763" Score="0" ViewCount="520" Body="&lt;p&gt;I'm trying to get the average frequency response of an entire piece of audio by splitting it into segments, doing an FFT on each one, and averaging the magnitudes together. Its working great until I get to the last segment, which nearly always is shorter than my FFT size, so I pad it with zeros until its the right size. This gives me the right response, but it is reduced in magnitude. I compensate for this by multiplying each value by the square root of my dft length divided by the last segment's length. This seems to give me the correct rms value for a sine wave and very nearly the same peak as the other segments. The problem occurs when i average this last segment with the others. The average rms and peak comes out significantly off. It gets better the greater the ratio of signal to zero padding there is in the last segment, but of course i'd like it to work for any amount of signal to zero padding. Any idea what might be happening?&lt;/p&gt;&#xA;" OwnerUserId="5281" LastActivityDate="2013-08-21T03:49:34.763" Title="FFT frequency domain averaging and zero padding" Tags="|fft|frequency-domain|zero-padding|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10400" PostTypeId="1" AcceptedAnswerId="10408" CreationDate="2013-08-21T05:45:23.430" Score="1" ViewCount="242" Body="&lt;p&gt;suppose $x_n$ is an $N$-point sequence with periodic auto-correlation &#xA;$$&#xA;c_n=\sum_m x_m x_{(n+m) mod N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to find $N$-point sequence $y_n$ with periodic auto-correlation $d_n = c_n - A$, where $A$ is a constant?&lt;/p&gt;&#xA;" OwnerUserId="5104" LastEditorUserId="5104" LastEditDate="2013-08-21T18:04:44.257" LastActivityDate="2013-08-25T22:17:30.573" Title="What happens to signal, if we offset periodic auto-correlation?" Tags="|dft|autocorrelation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10401" PostTypeId="2" ParentId="10398" CreationDate="2013-08-21T06:07:05.793" Score="0" Body="&lt;p&gt;If there is apparent beating in the time domain, and you zoom into your apparent one peak in the frequency domain, you will find the main lobe or skirt around that peak is slightly fatter than if there is no beating.  This is because there is really a second peak (and potentially more peaks) hidden inside and/or under that wider main lobe or it's skirts. It's not always one pure sinusoid frequency causing a peak in a zoomed-out FFT result.  And two adjacent frequency sinusoids can cause an amplitude modulation in the envelope of the linear sum (beating).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-21T06:12:38.407" LastActivityDate="2013-08-21T06:12:38.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10402" PostTypeId="1" CreationDate="2013-08-21T09:35:52.793" Score="0" ViewCount="134" Body="&lt;p&gt;I'm developing an application which one of its capabilities is peak detection. &#xA;I expect to handle three types of the similar data (Acceleration vs Frequency) but measured in different laboratories and with different sampling and noise. The data is not equally spaced in frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the plot of each of them:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hFO1M.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4xOPs.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Detail of the previous one&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FqgHS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OdR0E.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first contains about 2000 points and there are a lot of local maxima detected. I can't use an average-smooth because the last one contains only 100 points and if I do so I will be missing important peaks (each peak occupy only 3-7 points).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do to improve the detection of peaks and how it could be done? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="5160" LastEditorUserId="5160" LastEditDate="2013-08-21T09:43:57.953" LastActivityDate="2013-08-21T17:45:31.870" Title="What technique could I use to smooth the right amount these signals?" Tags="|smoothing|peak-detection|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10403" PostTypeId="1" AcceptedAnswerId="10415" CreationDate="2013-08-21T10:20:10.120" Score="2" ViewCount="6103" Body="&lt;p&gt;I'm trying to implement SIFT algorithm.&#xA;After I found the min/max points in DOG images I need to find the real min/max subpixels by taylor exapnsion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{equation}&#xA;D(\mathbf{x}) = D + \frac{\partial D^T}{\partial \mathbf{x}}\mathbf{x} + \frac{1}{2}\mathbf{x}^T\frac{\partial^2D}{\partial \mathbf{x}^2}\mathbf{x}&#xA;\end{equation}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how I do it.&#xA;I understand the idea behind using taylor expansion.&lt;/p&gt;&#xA;" OwnerUserId="5283" LastEditorUserId="80" LastEditDate="2013-08-21T18:36:26.603" LastActivityDate="2019-03-02T02:22:13.663" Title="SIFT - Taylor Expansion" Tags="|image-processing|sift|taylor-expansion|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10404" PostTypeId="1" CreationDate="2013-08-21T11:17:06.837" Score="1" ViewCount="388" Body="&lt;p&gt;First of all excuse me for asking a seemingly vague question. But i am going nowhere in the problem i am trying to solve. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on a powerline communication system where i need to upconvert in 28-56Mhz range and later downconvert it to 0-28Mhz so that it works in the coupler range.So i need to design a band pass filter in 28-56Mhz and a low pass filter in the 0-28Mhz range. I need to design an analog filter for the same. I have no experience of filter design. I have been looking online for resources but wherever i go there is an explanation on chebyshev, butterworth and  elliptic filters.Then you have 1st order,2nd order and higher order filters equations. My problem is from all this i am  unable to decide which type of filter to use and what order to use. So i need to understand practical design constraints and examples of how to design given certain constraints and then boiling down to a solution. So could anybody help me in how to approach the filter design problem and suggest either examples or resources to go forward.  &lt;/p&gt;&#xA;" OwnerUserId="4375" LastActivityDate="2013-10-18T13:41:27.657" Title="Filter design for frequencies in range 0-60Mhz" Tags="|filters|filter-design|lowpass-filter|digital-communications|bandpass|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10405" PostTypeId="2" ParentId="10404" CreationDate="2013-08-21T12:06:39.343" Score="4" Body="&lt;p&gt;As you stated there are some parameters associated with filters such as type of filter (butterworth, elliptic, chebyshev I,chebyshev II, bessel,...), order of filter, etc. (Note that there are lots of considerations in filter design bases on the application)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's first talk about the order of filters:&#xA;Filters with higher orders let you have a filter with better quality. For example in lowpass filter if you want to have a sharper transition band you need to design a filter with high order filers. Order of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Analog_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;passive analog filter&lt;/a&gt; is determined by the number of elements you use in filter (resistor, inductor, capacitors). This was all I knew about the order of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's talk about the most applicable kinds of filter types. The most important difference between filter types is the band they have ripples. Note that the priority of filters is due to the application and when we say one filter is better than the other we must state that in what aspects (order, ripples, poles, zeros, stability, group delay, phase response, minimum phase, ...) this is better than that one. Picture below compares 4 important types of filters designed with the same order. As you can see, Elliptic filter has ripples both in pass-band and stop-band while it has the sharpest transition, and butterwoth filter has no ripples but has least sharpness among filters of the same order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Electronic_linear_filters.svg/500px-Electronic_linear_filters.svg.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5104" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.950" LastActivityDate="2013-08-21T12:06:39.343" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10406" PostTypeId="2" ParentId="10396" CreationDate="2013-08-21T12:57:45.757" Score="3" Body="&lt;p&gt;I don't think either will increase your precision as such, although there are benefits to each approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the lower 11 bits of 1.15 would provide you with 24dB of extra headroom (obviously being careful to sign extend properly). Alternatively, using the upper 11 bits could potentially lower the power in your quantisation error after 1.15 * 1.15 multiplication (for example). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The design is a compromise being headroom and dynamic range, and hence the best route probably depends on the magnitude of your coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following example shows how extra headroom can be useful:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have an FIR filter (1.15 fractional binary) with 2 coefficients, which are both 0.8 (for some reason). If your input was 0.9 for two samples in a row, your output would be (0.8 * 0.9) + (0.8 * 0.9) = 1.44. This value would lead to an overflow or hard clipping since it doesn't fit into 1.15 (fractional). To avoid this you could first shift the input down by 1 bit, to give yourself 6dB of headroom. This would change the sum to be (0.4 * 0.9) + (0.4 * 0.9) = 0.72, which now safely fits into a 1.15 container.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a normal system where you're using all 16 bits you'd then have to worry about (or just remember!) the fact that your signal is halved in amplitude. In your case you don't need to worry about this, as your full scale signal is only 12 bits to start with.&lt;/p&gt;&#xA;" OwnerUserId="369" LastEditorUserId="369" LastEditDate="2016-10-19T09:08:49.447" LastActivityDate="2016-10-19T09:08:49.447" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10407" PostTypeId="2" ParentId="10382" CreationDate="2013-08-21T14:33:38.200" Score="2" Body="&lt;p&gt;This is a work-in-progress until more information is added to the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I'm assuming that you know the magnitudes of your decaying exponentials, but you don't know their time constants (either $C_x$ or $C_y$) or your signal level $S_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you say that there is Gaussian noise, but not whether it's additive. I'm going to assume it's additive. That means your signal is really:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;S(t)=S_0(\frac{1}{20}e^{\frac{-t}{C_y}}+\frac{19}{20}e^{\frac{-t}{C_x}}) + n(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n(t)$ is additive, white, Gaussian noise with zero mean and variance $\sigma^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, to set up the problem, we need to postulate the estimated values of $\hat{C}_x$, $\hat{C}_y$, $\hat{S}_0$, and $\sigma^2$ in $\hat{S}(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{S}(t; \hat{C}_x, \hat{C}_y, \hat{S}_0)=\hat{S}_0(\frac{1}{20}e^{\frac{-t}{\hat{C}_y}}+\frac{19}{20}e^{\frac{-t}{\hat{C}_x}})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then a least squares approach to solving it would define the error, $E$, as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E(\hat{C}_x, \hat{C}_y, \hat{S}_0) = \int_{I} \left| S(t) - \hat{S(t)}\right|^2 dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $I$ is your time interval of interest, and minimize this with respect to $\hat{C}_x$, $\hat{C}_y$,  and $\hat{S}_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I interpret your question as asking: what value $\frac{S_0^2}{\sigma^2}$ does this work over?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is: it depends on what you mean by &quot;work&quot;.  You can get &lt;em&gt;an&lt;/em&gt; estimate for any noise level.  The question is, what error can you tolerate in that estimate.  Also, it will depend somewhat on your integration length ($I$).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, I see you've changed notation so it's $C_b$ and $C_y$ now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've written a short &lt;code&gt;scilab&lt;/code&gt; script to try to see how things change with noise level. I've assumed EVERYTHING is precisely known except the $C_y$ parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error in estimating the parameter versus the value of $\sigma$ is shown in the plot below.  Code below generates it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0pBQr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; S0 = 1;&#xA; Cb = 201;&#xA; Cy = 100;&#xA; sigma = 0.1;&#xA; mb = 1/20;&#xA; my = 19/20;&#xA;&#xA; T=1000;&#xA; t=[0:T-1];&#xA; Sb = mb*exp(-t/Cb);&#xA; Sy = my*exp(-t/Cy);&#xA;&#xA; clf&#xA; subplot(311)&#xA; plot(Sb)&#xA; plot(Sy,'g')&#xA; plot(S,'r')&#xA;&#xA; ERRORS = [];&#xA; sigmaRange = [0.0 0.1 0.2 0.5 1 2 5 10];&#xA; for sigma=sigmaRange,&#xA; CyhatRange = 90:.01:110;&#xA; estimates=[]&#xA; NRuns = 100;&#xA; for n=1:NRuns&#xA;     S = S0*(Sb + Sy) + sigma*rand(1,T,'normal');&#xA;&#xA;     ERR= [];&#xA;     for Cyhat = CyhatRange,&#xA;         S_hat = S0*(Sb + my*exp(-t/Cyhat))&#xA;&#xA;         ERR = [ERR; sum((S-S_hat).^2)];&#xA;     end&#xA;&#xA;     [mx,ix] = min(ERR);&#xA;&#xA;     CyhatEst = CyhatRange(ix);&#xA;     //disp(CyhatEst);&#xA;     estimates = [estimates; CyhatEst];&#xA;&#xA;     subplot(312);&#xA;     plot(CyhatRange,ERR)&#xA; end&#xA;&#xA; disp(mean((estimates-Cy).^2))&#xA;&#xA; ERRORS = [ERRORS; mean((estimates-Cy).^2)];&#xA; end&#xA;&#xA; subplot(313)&#xA; plot(sigmaRange,ERRORS);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-08-22T15:21:41.517" LastActivityDate="2013-08-22T15:21:41.517" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10408" PostTypeId="2" ParentId="10400" CreationDate="2013-08-21T17:27:19.973" Score="3" Body="&lt;p&gt;The periodic autocorrelation function is not defined correctly in the OP's question: it should be&#xA;$$c_n = \sum_m x_m x_{(m+n) \bmod N} ~~\text{or} ~~ \sum_m x_m x_{(m-n) \bmod N}$$ depending on taste and &lt;strong&gt;not&lt;/strong&gt; $c_n = \sum_m x_mx_{(n-m)\bmod N}$ which is a &lt;em&gt;convolution&lt;/em&gt; not a correlation operation.  Note also that there is an&#xA;implicit assumption that $\mathbf x = (x_0, x_1, \ldots, x_{N-1})$&#xA;is a &lt;em&gt;real-valued&lt;/em&gt; sequence, not a complex-valued sequence. Of course,&#xA;the &lt;em&gt;autocorrelation sequence&lt;/em&gt; $\mathbf c = (c_0, c_1, \ldots, c_{N-1})$ is also a real-valued&#xA;sequence with the additional property that $c_0 \geq \max_n |c_n|$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this correction, consider the sequence &#xA;$\mathbf d = (c_0-A, c_1-A, \ldots, c_{N-1}-A)$,&#xA;that is, $d_n = c_n-A$ for $0 \leq n &amp;lt; N$.&#xA;Let the DFT of $\mathbf c$ be&#xA;$\mathbf C = (C_0, C_1, \ldots, C_{N-1})$ where the $C_n = |X_n|^2$ are &#xA;&lt;strong&gt;nonnegative&lt;/strong&gt; real numbers.  Note that the DFT of &lt;em&gt;any&lt;/em&gt;&#xA;autocorrelation sequence cannot have negative values.&#xA;Now, the DFT of $\mathbf d$ is obviously&#xA;$\mathbf D = \mathbf C - (NA,0,0,\ldots, 0)$ and so we see easily that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\mathbf D$ cannot be the DFT of an autocorrelation function &#xA;  if $D_0 = C_0 -NA &amp;lt; 0$, that is, if $A &amp;gt; N^{-1}C_0$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Note that $\displaystyle X_0 = \sum_{n=0}^{N-1} x_n$ and&#xA;$\displaystyle C_0 = |X_0|^2 = \left|\sum_{n=0}^{N-1} x_n \right|^2.$&#xA;Let $\displaystyle \bar{x} = \frac{1}{N}\sum_{n=0}^{N-1} x_n = \frac{1}{N}X_0$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;So, let us assume from this point on that $A \leq N^{-1}C_0 = N\left|\bar{x}\right|^2$&lt;/strong&gt;.&lt;br&gt;&#xA;  Is there&#xA;  a sequence&#xA;  $\mathbf y = (y_0, y_1, \ldots, y_{N-1})$ with&#xA;  autocorrelation function $\mathbf d$ whose DFT is $\mathbf D$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer is &lt;strong&gt;Yes&lt;/strong&gt;,  Consider a sequence $\mathbf y$ with&#xA;$n$-th term $y_n = x_n - a$. Its autocorrelation function&#xA;is&#xA;$$\sum_m y_m y_{(m+n)\bmod N} = \sum_m (x_m-a) (x_{(m+n)\bmod N} - a) &#xA;= c_n + Na^2 - 2aX_0.$$&#xA;We want the quantity on the right to have value $c_n-A$, and so if&#xA;we can find an $a$ such that $A = 2aX_0- Na^2$, we are done.&#xA;Solving for $a$, we get that&#xA;$$a = \frac{2X_0\pm \sqrt{ 4\left|X_0\right|^2-4NA}}{2N}&#xA;= \frac{1}{N}X_0 \pm \sqrt{\left|\bar{x}\right|^2-A/N}&#xA;= \bar{x} \pm \sqrt{\left|\bar{x}\right|^2-A/N}$$&#xA;Note that the quantity in the radical is nonnegative since&#xA;we have assumed that $\frac AN \leq \left|\bar{x}\right|^2$&#xA;and so we do obtain a real-valued $\mathbf y$ as long as&#xA;$A$ does not exceed its maximum value $N\left|\bar{x}\right|^2$.&#xA;When $A$ does have its maximum possible&#xA;value, $\mathbf y$ whose&#xA;$n$-th term is $y_n = x_n - \bar{x}$ is just $\mathbf x$ &quot;centered&quot;&#xA;to have &quot;DC value&quot; $0$ since we are subtracting off the average&#xA;value of $\mathbf x$ from each component.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-08-25T22:17:30.573" LastActivityDate="2013-08-25T22:17:30.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10410" PostTypeId="2" ParentId="10402" CreationDate="2013-08-21T17:45:31.870" Score="2" Body="&lt;p&gt;If you come up with a set of criteria that define what makes a local maximum become a &quot;peak of interest&quot;, then you could test whether each local maximum meets the criteria you set. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A local maximum at $X(f)$ is considered a peak of interest if for some chosen small value $\epsilon$ and some chosen height $\mu$ , we can satisfy the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\exists \, \delta_1 , \delta_2 \lt \epsilon \quad s.t. \quad X(f)-X(f-\delta_1) &amp;gt; \mu \quad \text{and} \quad X(f)-X(f+\delta_2) &amp;gt; \mu$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one such criterion is not sufficient to describe your concept of a peak of interest, then you can logically combine multiple criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could approach the problem from a filtering and smoothing perspective as you mention, but notice that each filter or smoothing operation has an implicit criteria that it is enforcing.  No matter how you implement your peak detection, realize that there is no &quot;right answer&quot; as to what defines a peak of interest. So before you can achieve the desired result you must first decide what that result should look like.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-08-21T17:45:31.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10412" PostTypeId="1" CreationDate="2013-08-21T21:08:10.313" Score="2" ViewCount="337" Body="&lt;p&gt;I am trying to analysis a system by Fourier Transform. my system has 3 dominant modes. (1,0.05) (0.51,0.01),(0.46,0.01) the pairs are defined as (freq,damping_ratio)&lt;br&gt;&#xA;I've got those result with eigenvalue analysis.the system contains 3 signal.so these frequency[1,0.51,0.46] must be find in these three signals too. so I've run FFT but I didn't see these frequency in the plot. what is the problem in your mind? why these frequencies do not exist in FFT plots?&lt;br&gt;&#xA; &lt;a href=&quot;http://www.fileswap.com/dl/kwXJFaHyA4/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here you can get the signal&lt;/a&gt; this txt file contain 3 signal in it. I put last signal FFT(PSD) here.  Tnx&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ysQli.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5MDrn.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;as you see those frequencies don't exist in the 3rd-signal. its same for other 2 signals too. Also I will put my codes here.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=linspace(0,30,3012);&#xA;fS=ceil(inv(t(2)-t(1))); &#xA;x=data(:,3);&#xA; Nfft = 10 * 2^nextpow2(length(t));&#xA;    psd = 20.*log10(fftshift(abs(fft(x,Nfft))));&#xA;    freqs=[0:Nfft - 1].*(fS/Nfft);&#xA;    freqs(freqs &amp;gt;= fS/2) = freqs(freqs &amp;gt;= fS/2) - fS;&#xA;    freqs=fftshift(freqs);&#xA;    figure(1);&#xA;    plot(freqs, psd); &#xA;    xlim([-1.5  1.5]);&#xA;    xlabel('Frequency / Hz');&#xA;    title (sprintf('PSD'));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2013-08-21T21:08:10.313" Title="Is there any problem with my FFT method?" Tags="|fft|frequency|dft|signal-analysis|power-spectral-density|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="10413" PostTypeId="1" CreationDate="2013-08-21T22:02:32.713" Score="15" ViewCount="146597" Body="&lt;p&gt;I have some basic understanding of signals and convolution. As far as I know it shows the similarities of two signals. Could I get some explanation in plain English of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;what are the linear and circular convolution&lt;/li&gt;&#xA;&lt;li&gt;why they are important&lt;/li&gt;&#xA;&lt;li&gt;practical situation where they are used&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5160" LastEditorUserId="128" LastEditDate="2019-03-29T12:53:57.517" LastActivityDate="2022-01-26T18:43:23.933" Title="What Are Linear and Circular Convolution?" Tags="|convolution|linear-systems|" AnswerCount="6" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10414" PostTypeId="2" ParentId="10413" CreationDate="2013-08-22T00:24:22.280" Score="9" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Linear convolution is the basic operation to calculate the output for any linear time invariant system given its input and its impulse response.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Circular convolution is the same thing but considering that the support of the signal is periodic (as in a circle, hence the name).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Most often it is considered because it is a mathematical consequence of the discrete Fourier transform (or discrete Fourier series to be precise):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One of the most efficient ways to implement convolution is by doing multiplication in the frequency.&lt;/li&gt;&#xA;&lt;li&gt;Sampling in the frequency requires periodicity in the time domain.&lt;/li&gt;&#xA;&lt;li&gt;However, due to the mathematical properties of the FFT this results in circular convolution.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The method needs to be properly modified so that linear convolution can be done (e.g. overlap-add method).&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="7092" LastEditDate="2021-03-12T12:31:51.827" LastActivityDate="2021-03-12T12:31:51.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10415" PostTypeId="2" ParentId="10403" CreationDate="2013-08-22T01:35:49.343" Score="2" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fVXry.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider one-dimensional function $f(x)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first order taylor expansion is $f(x_0+h) \approx f(x_0) + f'(x_0)h$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second order taylor exapnsion is $f(x_0+h) \approx f(x_0) + f'(x_0)h + \frac 1 2 f''(x_0)h^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we expand three-dimensional function.&#xA;$$ D(\mathbf{x_0}+\mathbf h) \approx D(\mathbf{X_0}) + \bigg(\frac{ \partial D}{\partial \mathbf x}\bigg)^T\bigg|_{\mathbf x=\mathbf x_0}\mathbf h + \frac 1 2 \mathbf h^TH(\mathbf x)\mathbf h $$&#xA;, where&#xA;$$&#xA;\frac {\partial D}{\partial \mathbf x} = \begin{bmatrix} \frac {\partial D}{\partial x} \\ \frac {\partial D}{\partial y} \\ \frac {\partial D}{\partial \sigma}\end{bmatrix} = &#xA;\begin{bmatrix} \frac {D(x+1,y,\sigma) - D(x-1,y,\sigma)}{2} \\ \frac {D(x,y+1,\sigma)-D(x,y-1,\sigma}{2} \\ \frac {D(x,y,\sigma+1) - D(x,y,\sigma-1)}{2} \end{bmatrix}&#xA;$$&#xA;$$ H(\mathbf x) = \begin{bmatrix} D_{xx} &amp;amp; D_{xy} &amp;amp; D_{x\sigma} \\&#xA;D_{yx} &amp;amp; D_{yy} &amp;amp; D_{y\sigma} \\&#xA;D_{\sigma x} &amp;amp; D_{\sigma y} &amp;amp; D_{\sigma\sigma} \end{bmatrix} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, $D_{xy}$&#xA;$$= \frac { \frac{D(x+1,y+1,s)-D(x-1,y+1,s)}{2} - \frac{D(x+1,y-1,s)-D(x-1,y-1,s)}{2} } 2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's go back.&#xA;$$D' = \bigg ( \frac{ \partial D}{ \partial \mathbf x} \bigg ) ^T + H(\mathbf x) \mathbf h = 0 $$ $$\mathbf h = - H^{-1}(\mathbf x) \bigg ( \frac{ \partial D }{\partial \mathbf x} \bigg ) ^T $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that $\mathbf{x_0}$ is discrete feature point. Iteratively we can get $\mathbf h$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $\mathbf{x_0}$ is the closest point to $\mathbf h$, then we select $\mathbf{x_0}+\mathbf h$. (Imagine that 3-dimensional space)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My english ability is poor and there may be some errors.&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="25812" LastEditDate="2017-01-08T07:48:41.160" LastActivityDate="2017-01-08T07:48:41.160" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10416" PostTypeId="2" ParentId="9768" CreationDate="2013-08-22T03:04:41.070" Score="0" Body="&lt;p&gt;The problem statement has large amount of data for processing. In order to get the exact pattern matching, Artificial Neural Networks/Adaptive Neuro Fuzzy Inference System tool can be used for training this large amount of data and the network will optimize the result while testing.&lt;/p&gt;&#xA;" OwnerUserId="5288" LastActivityDate="2013-08-22T03:04:41.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10417" PostTypeId="1" CreationDate="2013-08-22T04:21:51.730" Score="0" ViewCount="3128" Body="&lt;p&gt;I'd like to have your overview if what I'm doing is OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to plot the BER vs Eb/No. So the noise power which I should generate should be related to Eb/No.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;bits are encoded into 1/2 rate encoder. &lt;/li&gt;&#xA;&lt;li&gt;the output of the encoder is converted to +1 and -1 symbols &lt;/li&gt;&#xA;&lt;li&gt;symbols are oversampled by OS ratio. &lt;/li&gt;&#xA;&lt;li&gt;the oversampled symbols are passed through Gaussian filter and this is the data which i send to the channel.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;now i need to generate AWGN: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;EbNo_dB_bit_list = -2:0.25:2; &#xA;EsNo_dB_no_code = EbNo_dB_bit_list - 10*log10(OS); &#xA;dec_EsNo_dB_no_code=10.^(-EsNo_dB_no_code/10); &#xA;sigma2 = 1/(2*Rate)*dec_EsNo_dB_no_code; % to include the code rate &#xA;&#xA;ni = randn(1,length(modulated)); &#xA;nq =randn(1,length(modulated)); &#xA;noise=(ni+1j*nq)*sqrt(sigma2(k)); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5289" LastActivityDate="2013-08-22T04:21:51.730" Title="generating AWGN in matlab" Tags="|matlab|noise|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10418" PostTypeId="2" ParentId="10398" CreationDate="2013-08-22T06:42:50.960" Score="5" Body="&lt;p&gt;Let’s look at an example. I’m going to use a sample rate of 50 throughout this post (i.e. the functions are sampled at 0, 0.02, 0.04, 0.06, …) and simple sine waves of the form $f_a(t) = \sin (2\pi\cdot a\cdot t)$, where $a$ is the frequency of the sine wave. For example, this is a plot of $f_3$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/K3LMe.png&quot; alt=&quot;sine wave of frequency 3, sampled and continuous&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red impulses indicate the sample values. The green line, on the other hand, is the continuous function that is being sampled. The sample values all lie on this curve, and it goes through three complete cycles, as one would expect.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Aliasing&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Because the sample rate is 50, anything above the Nyquist frequency of 25 is going to alias. As an example, here is a plot of $f_{53}$; mind the axes, I zoomed in to one tenth of the above, because otherwise the image would have become quite crowded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vWufI.png&quot; alt=&quot;sine wave of frequency 53, sampled and continuous&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is slightly less than one sample per cycle, so the sampled values don’t follow the continuous waveform very closely. Actually, if all you saw were the sample values without the green curve, like so …&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0MBGp.png&quot; alt=&quot;sine wave of frequency 53, sampled&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;… you might be tempted to draw a much slower wave. Here is what happens when we plot not only $f_{53}$, but $f_3$ at the same time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2ofsP.png&quot; alt=&quot;sine waves of frequencies 3 and 53, sampled and continuous&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the two sine waves are quite dissimilar in appearance, they happen to coincide at each and every sample point. There is absolutely no way to tell them apart given only the sample values. That’s aliasing. In fact, not only the samples of $f_{53}$ are exactly the same as those of $f_3$, but $f_{103}$, $f_{153}$, $f_{-47}$ etc. alias in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put differently, due to sampling at a frequency of 50, the ranges 0–25, 50–75, 100–125, etc. collapse. What about the “upper half”, from the Nyquist frequency to the sampling frequency? It is mirrored; $f_{47}$ is the same as $-f_3$, and in general the frequency range 25–50 aliases to 25–0, with the samples inverted (or, equivalently, a phase shift by $\pi$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means, for your question, that the effect you are observing is not due to you using signals that exceed the Nyquist frequency; you can replace any higher-than-Nyquist-frequency signal with its alias in the Nyquist range and will get exactly the same results.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;The “beating”&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;So what causes the apparent “beating”? Here is the very first plot of $f_3$ again, but this time it shows the sample values and linear interpolation between them (i.e. straight line segments from each sample point to the next), not the actual continuous waveform that was sampled:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qfjT6.png&quot; alt=&quot;sine wave of frequency 3, sampled, and linear interpolation of the sample values&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interpolated waveform is a bit edgy, but overall a good approximation of the original sine wave. Unfortunately, this is only because the frequency is very low relative to the sample rate. Here is $f_7$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ESLTi.png&quot; alt=&quot;sine wave of frequency 7, sampled, and linear interpolation of the sample values&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Urgh. It worsens as we get to higher frequencies, closer to the Nyquist frequency; this is $f_{23}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WgwUQ.png&quot; alt=&quot;sine wave of frequency 23, sampled, and linear interpolation of the sample values&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, even if we don’t draw those straight lines, our eye will try to connect the dots all on its own, and the impression is similar: It looks like a slow oscillation modulated onto a fast one. And that impression actually isn’t completely beside the point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MIfat.png&quot; alt=&quot;sine wave of frequency 23, sampled, and ring modulation of two sine waves of frequencies 2 and 25, continuous&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same sample values, from $f_{23}$, can equally well explained by a ring modulation of $f_2$ and $f_{25}$ (with some phase adjustment), namely, $g(t) = -f_2(t)\cdot f_{25}(t+0.01)$. Thus, $g$ and $f_{23}$ are aliases, when sampled at a rate of 50. Here is a close-up again, showing that $g$ and $f_{23}$ in fact meet at 0, 0.02, 0.04 etc.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0PcHU.png&quot; alt=&quot;sine wave of frequency 23, sampled and continuous, and ring modulation as above&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A different way to write $g$ is $g(t) = 0.5 f_{23}(t) - 0.5 f_{27}(t)$, a sum of two sine waves of similar frequency, exactly the case where beating could be expected to happen. So it &lt;em&gt;is&lt;/em&gt; beating after all, isn’t it? Not really, because $f_{27}$ is beyond the Nyquist frequency; as outlined above, it is an alias of $-f_{50-27}=-f_{23}$, and so $g(t)$ becomes $0.5 f_{23}(t) - 0.5 f_{27}(t) = 0.5 f_{23}(t) + 0.5 f_{23}(t) = f_{23}(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is, &lt;em&gt;within the baseband from 0 to 25&lt;/em&gt;, the only possible interpretation of those sample values.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Conclusion&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Watch out for improper interpolation! When reconstructing a continuous signal from samples, the limited bandwidth must be taken into account (band-limited interpolation). Unfortunately, our eyes are not good at this; and many software waveform editors and resamplers aren’t, either.&lt;/p&gt;&#xA;" OwnerUserId="4712" LastActivityDate="2013-08-22T06:42:50.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10423" PostTypeId="1" AcceptedAnswerId="10424" CreationDate="2013-08-22T08:23:46.377" Score="22" ViewCount="24667" Body="&lt;p&gt;I just studied about SURF and I'm going for its implementation, but I still didn't understand why we use descriptors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand what keypoints are and their purpose, but when we extract the keypoints than why do we need to use descriptors ? What is their importance and role in recognition?&lt;/p&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="1273" LastEditDate="2013-08-22T09:38:21.603" LastActivityDate="2013-08-22T12:22:54.683" Title="Why do we use keypoint descriptors?" Tags="|image-processing|computer-vision|opencv|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10424" PostTypeId="2" ParentId="10423" CreationDate="2013-08-22T09:33:51.353" Score="29" Body="&lt;p&gt;One important thing to understand is that after extracting the keypoints, you only obtain information about &lt;em&gt;their position&lt;/em&gt;, and sometimes &lt;em&gt;their coverage area&lt;/em&gt; (usually approximated by a circle or ellipse) in the image. While the information about keypoint &lt;em&gt;position&lt;/em&gt; might sometimes be useful, it does not say much about the keypoints themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the algorithm used to extract keypoint (SIFT, Harris corners, MSER), you will know some &lt;em&gt;general characteristics&lt;/em&gt; of the extracted keypoints (e.g. they are centered around blobs, edges, prominent corners...) but &lt;em&gt;you will not know how different or similar one keypoint is to the other.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's two simple examples where only the position and keypoint area will not help us:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have an image A (of a bear on a white background), and another image B, exact copy of A but translated for a few pixels: the extracted keypoints will be the same (on the same part of that bear). Those two images should be recognized as same, or similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, if the only information we have is their position, and that changed because of the translation, you can not compare the images.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have an image A (let's say, of a duck this time), and another image B, exactly the same duck as in A except twice the size: the extracted keypoints will be the same (same parts of the duck). Those are also same (similar) images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But all their sizes (areas) will be different: all the keypoints from the image B will be twice the size of those from image A.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, &lt;strong&gt;here come descriptors&lt;/strong&gt;: they are the way to compare the keypoints. They summarize, &lt;em&gt;in vector format&lt;/em&gt; (of constant length) some characteristics about the keypoints. For example, it could be their intensity in the direction of their most pronounced orientation. &lt;strong&gt;It's assigning a numerical description to the area of the image the keypoint refers to.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some important things for descriptors are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;they should be &lt;strong&gt;independent of keypoint position&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the same keypoint is extracted at different positions (e.g. because of translation) the descriptor should be the same.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;they should be &lt;strong&gt;robust against image transformations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some examples are changes of contrast (e.g. image of the same place during a sunny and cloudy day) and changes of perspective (image of a building from center-right and center-left, we would still like to recognize it as a same building).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, no descriptor is completely robust against all transformations (nor against any single one if it is strong, e.g. big change in perspective).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Different descriptors are designed to be robust against different transformations which is sometimes opposed to the speed it takes to calculate them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;they should be &lt;strong&gt;scale independent&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The descriptors should take scale in to account. If the &quot;prominent&quot; part of the one keypoint is a vertical line of 10px (inside a circular area with radius of 8px), and the prominent part of another a vertical line of 5px (inside a circular area with radius of 4px) -- these keypoints should be assigned similar descriptors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, that you calculated descriptors for all the keypoinst, &lt;strong&gt;you have a way to compare those keypoints&lt;/strong&gt;. For a simple example of &lt;em&gt;image matching&lt;/em&gt; (when you know the images are of the same object, and would like to identify the parts in different images that depict the same part of the scene, or would like to identify the perspective change between two images), you would compare every keypoint descriptor of one image to every keypoint descriptor of the other image. As the &lt;strong&gt;descriptors&lt;/strong&gt; are &lt;strong&gt;vectors of numbers, you can compare them with something as simple as Euclidian distance&lt;/strong&gt;. There are some more complex distances that can be used as a similarity measure, of course. But, in the end, you would say that &lt;strong&gt;the keypoints whose descriptors have the smallest distance between them&lt;/strong&gt; are &lt;strong&gt;matches&lt;/strong&gt;, e.g. same &quot;places&quot; or &quot;parts of objects&quot; in different images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;em&gt;more complex&lt;/em&gt; use of keypoints/descriptors, you should take a look at &lt;a href=&quot;https://dsp.stackexchange.com/q/5995/1273&quot;&gt;this question&lt;/a&gt; -- especially the &quot;low-level local approach&quot; in &lt;a href=&quot;https://dsp.stackexchange.com/a/5999/1273&quot;&gt;my answer&lt;/a&gt; and &quot;Bag-of-words&quot; approach in &lt;a href=&quot;https://dsp.stackexchange.com/a/6008/1273&quot;&gt;@Maurits&lt;/a&gt; answer. Also, links provided in those answers are useful.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-08-22T12:22:54.683" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10425" PostTypeId="2" ParentId="10423" CreationDate="2013-08-22T10:45:00.307" Score="3" Body="&lt;p&gt;Let's think of the ideal descriptor to understand the idea. An ideal descriptor is a function from pixel space to some other space, such that &lt;strong&gt;same objects have the same outcome&lt;/strong&gt;, whereas different objects have different outcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you shot two images with the same object but with different exposure level, you would get a multiplied version of image. A descriptor that will take the pixels and normalize them by their mean and standard deviation level would have same outcome, saying that these two objects are the same. That is good, because it allows us correct matching&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yW1iA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/P1g3v.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, your descriptor is needed to correctly match same objects.&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2013-08-22T10:45:00.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10426" PostTypeId="1" AcceptedAnswerId="10427" CreationDate="2013-08-22T11:12:34.327" Score="1" ViewCount="2329" Body="&lt;p&gt;Sorry if this question is too simplistic, but I am new to image processing and after successfully writing two programs, a convolution program and a low pass filtering program, I noticed that for approximately the same output, the low pass filtering method takes 4 times the time!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets assume that the image is a square of side &lt;code&gt;N&lt;/code&gt;. When convolving we can use an arbitrarily small kernel (out to $3\sigma$ for example) and put a Gaussian in it, say of size &lt;code&gt;M&lt;/code&gt;=$3\sigma$. We then have to simply pad the image and the kernel into an &lt;code&gt;N+M-1&lt;/code&gt; side square array and run DFT onit, multiply it and run IDFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for low pass filtering we have to create a padded square array of width &lt;code&gt;2*N&lt;/code&gt;. There is one less DFT required, but the one DFT and the IDFT on the array with 4 times the elements will take a significantly longer amount of time because the padded array is huge (look at Gonzalez&amp;amp;Woods Fig.4.36 as an example)! Since the DFT of a Gaussian kernel is also a Gaussian, then why should we use a Gaussian low pass filtering at all when it takes nearly 4 times the time (look below)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Source code:&lt;/strong&gt; I have put the source code &lt;a href=&quot;https://github.com/makhlaghi/freqdomain&quot; rel=&quot;nofollow&quot;&gt;in github&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am adding some timings in my program to show what I mean. The image was 233*233 pixels. My &lt;code&gt;CPU&lt;/code&gt; is clocked at 3.07GHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a low pass filter, note that the FFTs and IFFTs are done on an array of size 466*466:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Gaussian low pass filter timing:&#xA;&#xA;Padding:                0.002564 (seconds)&#xA;FFT:                    0.018210 (seconds)&#xA;Applying filter:        0.006686 (seconds)&#xA;IFFT:                   0.017254 (seconds)&#xA;Time for final step:    0.000550 (seconds)&#xA;&#xA;Total:                  0.047424 (seconds)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a convolution of the same image with a kernel of size 9*9, note that the three FFTs and IFFTs are done on arrays of size 241*241:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Gaussian convolution timing:&#xA;&#xA;Making the kernel:      0.000077 (seconds)&#xA;Pad both to same size:  0.001389 (seconds)&#xA;Padded image FFT:       0.002699 (seconds)&#xA;Padded kernel FFT:      0.001866 (seconds)&#xA;Multiplying:            0.000384 (seconds)&#xA;IFFT:                   0.002241 (seconds)&#xA;Crop from padded:       0.000574 (seconds)&#xA;&#xA;Total:          0.011149 (seconds)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5290" LastEditorUserId="5290" LastEditDate="2013-08-23T09:14:29.937" LastActivityDate="2013-08-23T12:14:36.013" Title="Why use a gaussian low pass filter, when we can convolve with gaussian kernel" Tags="|image-processing|fft|convolution|lowpass-filter|" AnswerCount="1" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="10427" PostTypeId="2" ParentId="10426" CreationDate="2013-08-22T11:45:36.903" Score="4" Body="&lt;p&gt;In practice gaussian low-pass filters are written using F.I.R. or I.I.R. filters, first the filter runs left then right on each horizontal line, then the filter runs up then down on each vertical line.  It's much cheaper than doing FFTs and IFFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your two operations are not performing the same operation.  The effects of the filtering around the edges will be very different.  You are doing a &lt;em&gt;circular&lt;/em&gt; convolution.  For the Discrete Fourier Transform the convolution theorem says that the multiplication of fourier transforms is equivalent to convolving the image infinitely repeated/tiled in the plane.  So around the left edge, for example you are blurring together some components from the right side of the picture.  (For example try performing your operations on a picture that is black on the left half and white on the right half.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your &quot;low pass&quot; filter is padding the image and the kernel to try to reduce some of the edge effects.  It's more expensive, but it is closer to what you would get if you did a &quot;real&quot; convolution of a gaussian with your image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your application the circular convolution effect of blurring in data from the other side of the image may be okay, but in many application it is unacceptable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to the reason that the FFT of an $N\times N$ image is 10 times faster than the FFT of a $2N \times 2N$ image.  A 2d FFT is done by taking 1d FFTs of each horizontal line, then 1d FFTs of each vertical line.  So in the $N \times N$ case you are doing $2N$ 1-d FFTs, each of which take $O(N \log N)$ for a total of $O(2N^2 \log N)$.  In the $2 N \times 2 N$ case you are doing $4N$ 1-d FFTs each of which take $O(2N \log 2N)$ for a total of (a little more than) $O(8N^2 \log N)$.  Add in cache effects for the larger image and 10x slower seems quite reasonable.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="3764" LastEditDate="2013-08-23T12:14:36.013" LastActivityDate="2013-08-23T12:14:36.013" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="10428" PostTypeId="1" CreationDate="2013-08-22T12:21:39.433" Score="3" ViewCount="1334" Body="&lt;p&gt;I'm trying to use &lt;a href=&quot;http://apollo.ee.columbia.edu/spm/external/tipsandtricks/files/TandT_Jan2007.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;Berchin's FDLS&lt;/a&gt; methods (for those that don't know what it is, it's a way to design arbitrary magnitude and phase of an IIR Eq)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried different things but neither gave me what i asked:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I tried to design an allpass filter with arbitrary phase response (nothing fancy just a linear phase and a short deviation for 5 points) and it didn't worked as planned. Actually what i want to do is to counter the phase change of an IIR filter&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I tried a linear phase response for a $-12\textrm{ dB}$ notch and the same way it didn't worked (in black the desired response)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iGpuP.jpg&quot; alt=&quot;Example Plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used a samplerate of $316$, $M=158$ points and a filter order of around $50$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Do I need to use more points to increase the filter order or is it just impossible to design my filters using that algorithm?&lt;/p&gt;&#xA;" OwnerUserId="5292" LastEditorUserId="1629" LastEditDate="2016-12-06T13:23:17.597" LastActivityDate="2016-12-06T13:23:17.597" Title="Berchin's FDLS arbitrary filter design algorithm" Tags="|frequency-response|infinite-impulse-response|equalization|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10429" PostTypeId="1" CreationDate="2013-08-22T13:42:06.597" Score="14" ViewCount="2447" Body="&lt;p&gt;So the Gaussian function is an eigenfunction of the Fourier transform because it transforms into itself, right?&lt;/p&gt;&#xA;&lt;p&gt;But this isn't true for the sampled Gaussian in the DFT because the tails of the function are truncated, right?&lt;/p&gt;&#xA;&lt;p&gt;Wikipedia describes a &lt;em&gt;discrete Gaussian kernel&lt;/em&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_function#Discrete_Gaussian&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Scale_space_implementation#The_discrete_Gaussian_kernel&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; (solid lines), which is different from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Scale_space_implementation#The_sampled_Gaussian_kernel&quot; rel=&quot;noreferrer&quot;&gt;discretely-sampled Gaussian&lt;/a&gt; (dashed lines):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;the discrete counterpart of the continuous Gaussian in that it is the solution to the discrete diffusion equation (discrete space, continuous time), just as the continuous Gaussian is the solution to the continuous diffusion equation&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E0tIk.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E0tIk.png&quot; alt=&quot;The ideal discrete Gaussian kernel (solid) compared with sampled ordinary Gaussian (dashed), for scales t = [0.5, 1, 2, 4]&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Does that mean it also DFT transforms exactly into itself?  If not, is there a similar Gaussian-like function that does?&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2020-08-17T14:31:55.647" LastActivityDate="2023-03-01T06:35:27.890" Title="Is the discrete Gaussian kernel an eigenfunction of the DFT?" Tags="|fourier-transform|dft|gaussian|window-functions|" AnswerCount="4" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="10430" PostTypeId="1" AcceptedAnswerId="10431" CreationDate="2013-08-22T14:00:39.960" Score="0" ViewCount="234" Body="&lt;p&gt;I've got a high-resolution image segmentation, which I'm downsampling (and non-linearly deforming) to fit on an ROI image. I typically blur the high-res image before downsampling with a Gaussian-fwhm related to the downsampling factor. The result is high-res and low-res images with the same mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like now for my high-res and low-res images to have the same sum. If I scale up the low-res image by the downsampling factor, will local sums be preserved across the image? Is there a better way to downsample and preserving local sums?&lt;/p&gt;&#xA;" OwnerUserId="3715" LastActivityDate="2013-08-22T15:24:17.310" Title="Preserving integral through downsampling" Tags="|image-processing|downsampling|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10431" PostTypeId="2" ParentId="10430" CreationDate="2013-08-22T15:24:17.310" Score="1" Body="&lt;p&gt;Increase the gain of your filter by the downsampling factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do this by multiplying the filter taps by the downsampling factor.  This is equivalent to doing exactly what you have done before and then multiplying the results by the downsampling factor.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-08-22T15:24:17.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10432" PostTypeId="2" ParentId="10429" CreationDate="2013-08-22T15:32:17.483" Score="10" Body="&lt;p&gt;Since the DFT is representable by multiplication with the Fourier matrix, your question is equivalent to asking what the eigenvectors of the Fourier matrix are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, Wikipedia provides the answer (&lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Eigenvalues_and_eigenvectors&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Eigenvalues_and_eigenvectors&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since the eigenvalues ($1, -1, i, -i$) are not simple, the eigenvectors are not unique (i.e. linear combinations are also eigenvectors). Also no simple closed formula exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One formula for an eigenvector close to what you ask is provided by Wikipedia&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_m = \sum_{k = -\infty}^\infty \exp\left(-\frac{\pi\cdot(m+N\cdot k)^2}{N}\right) \quad\quad\quad m = 0,\ldots,N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So concluding, the Gaussian function itself is not an eigenvector, but an infinite sum of Gaussians. &#xA;The infinite sum can probably be interpreted as equivalent to the discretization of the frequency and time domain when we going from the FT to the DFT. So it is not as simple, as just truncating the discrete Gaussian.&lt;/p&gt;&#xA;" OwnerUserId="5145" LastEditorUserId="80" LastEditDate="2017-05-31T15:25:30.490" LastActivityDate="2017-05-31T15:25:30.490" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="10433" PostTypeId="1" CreationDate="2013-08-22T15:46:37.993" Score="1" ViewCount="790" Body="&lt;p&gt;Consider x(n) as input, y(n) as output &amp;amp; h(n) as filter coefficient. The filter is of 16 taps(N=16) from 0 to 15. The decimation factor of the filter is 4.&lt;br&gt;&#xA;When I apply x(n) to this 16 tap decimation filter with decimation factor 4, what is the output that i should get?&lt;br&gt;&#xA;What is the general relation(give formula) between x(n) &amp;amp; y(n)?&lt;br&gt;&#xA;Also, if you can simplify that formula by giving what y(0), y(1), y(2) will be in terms of x(n) &amp;amp; h(n).&lt;br&gt;&#xA;This is the decimation filter using DSP 48 slice of xilinx&#xA;&lt;img src=&quot;https://i.stack.imgur.com/99nsm.jpg&quot; alt=&quot;This is the decimation filter architecture using DSP48 slice of Xilinx&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4875" LastEditorUserId="4875" LastEditDate="2013-08-26T04:35:56.563" LastActivityDate="2013-08-26T04:35:56.563" Title="What is the output sequence of a Decimation filter" Tags="|filters|decimation|" AnswerCount="0" CommentCount="6" ClosedDate="2013-09-06T21:19:47.307" ContentLicense="CC BY-SA 3.0" />
  <row Id="10434" PostTypeId="1" AcceptedAnswerId="10436" CreationDate="2013-08-22T15:53:52.547" Score="4" ViewCount="676" Body="&lt;p&gt;I'm finally making some headway in understanding data whitening, but I have a question now relating what I think of as &quot;data-based&quot; whitening to the situation where there are time-varying signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the &quot;data-based&quot; world, suppose I have a mean-centered column matrix $X$ with covariance $\Sigma = \mathbb{E}[XX^\top]$. This data matrix can be transformed into a whitened dataset $W$ by computing $W=\Lambda^{-1/2}EX$, where $\Lambda$ and $E$ are the eigenvalues and eigenvectors of $\Sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, so good. What I'm curious about is, what if my data vectors are a bunch of windowed snippets of audio (for example) ? I could use the DFT to compute a mean power spectrum for these snippets, and then rescale each snippet by the inverse of the spectrum at each frequency. If I understand correctly, this would whiten the power spectrum of my dataset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this process equate to whitening in the &quot;data-based&quot; world above ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, are the eigenvalues of the data covariance (which I understand are also referred to as a spectrum) directly related to the mean power spectrum of my signals ? How ? Any pointers to good reading on the subject would be very welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if this is an elementary question, but I haven't had much signal processing background and find this to be really fascinating.&lt;/p&gt;&#xA;" OwnerUserId="5209" LastActivityDate="2018-03-15T08:44:39.393" Title="Does whitening with PCA correspond to power spectrum flattening?" Tags="|frequency-spectrum|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10435" PostTypeId="1" CreationDate="2013-08-22T15:56:01.060" Score="0" ViewCount="140" Body="&lt;p&gt;I have two sets of MFCC coeficients which I get with fftExtract utility from two wav audio files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I compare this sets (matrix 271x13 and 551x13) if they are similar ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably I should use EMD distance ...  But Im sligthly lost in all this math and I dont&#xA;know how to interpret its results . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make from this distance matrix if both audio signals are similar or not - (Yes/Not)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used following code for EMD :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function D = distEmd( X, Y )&#xA;&#xA;Xcdf = cumsum(X,2);&#xA;Ycdf = cumsum(Y,2);&#xA;&#xA;m = size(X,1);  n = size(Y,1);&#xA;mOnes = ones(1,m); D = zeros(m,n);&#xA;for i=1:n&#xA;  ycdf = Ycdf(i,:);&#xA;  ycdfRep = ycdf( mOnes, : );&#xA;  D(:,i) = sum(abs(Xcdf - ycdfRep),2);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;fftExtract&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://digitalmusics.dartmouth.edu/wiki/index.php/Music103_Tutorial&quot; rel=&quot;nofollow&quot;&gt;http://digitalmusics.dartmouth.edu/wiki/index.php/Music103_Tutorial&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5291" LastActivityDate="2013-08-22T15:56:01.060" Title="MFCC coeficient comparision" Tags="|audio|speech-recognition|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10436" PostTypeId="2" ParentId="10434" CreationDate="2013-08-22T16:44:50.420" Score="1" Body="&lt;p&gt;I believe the answer here is no. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember what 'whitening' is really doing: It is ensuring that the power/variance that correspond to each of your &lt;em&gt;basis&lt;/em&gt; vectors are the same. Which basis vectors? The ones you chose. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the DFT, you are choosing basis vectors comprised of complex exponential functions. In PCA, you are determining the basis vectors empirically. What is the relationship between complex exponential bases and empirical bases? You cannot say. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, when you say you whitened in the spectral domain, you are really saying &quot;I made sure the power/variance associated with all my &lt;strong&gt;complex exponential basis vectors&lt;/strong&gt; representing my data are the same&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you say you whitened in the PCA domain, you are really saying &quot;I made sure the power/variance associated with of all my &lt;strong&gt;empirically derived basis vectors&lt;/strong&gt; are the same&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are your empirically derived basis vectors complex exponentials? There is no guarantee. Thus, whitening in either domain is not equivalent to whitening in the other.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If so, are the eigenvalues of the data covariance (which I understand&#xA;  are also referred to as a spectrum) directly related to the mean power&#xA;  spectrum of my signals ? How ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I understand your question correctly, then the answer to this is a simple yes, for the simple reason of energy conservation. All the eigenvalues together will give you the total energy/variance in your data. The average of this energy, will have to correspond to your mean power in &lt;em&gt;any&lt;/em&gt; domain, including the spectral. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Projecting your data onto either the DFT or PCA (empirical) bases dones not add/remove energy, but simply redistributes it. Thus, your average power has to always be the same. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-10-24T22:41:29.333" LastActivityDate="2013-10-24T22:41:29.333" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10437" PostTypeId="2" ParentId="8206" CreationDate="2013-08-22T16:53:40.100" Score="3" Body="&lt;p&gt;Since the comments on the question and the OP's responses&#xA;don't seem to be converging, here goes.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Pick a data rate $R$ bits/second (e.g. $10$ kilobits/second)&#xA;that is acceptable to your client or boss.&lt;br&gt;&#xA;The FSK signal&#xA;will then convey one bit every $R^{-1} = T$ seconds (every&#xA;$T= 100$ microseconds if you chose the $R =10$ kbps data rate&#xA;suggested as an example), and the $16$ bits that you need to&#xA;transmit will be transmitted by an FSK signal $x(t)$ that will&#xA;have a total duration $16T$ seconds ($1600$ microseconds for the&#xA;example).  Specifically, let us assume that you need to define&#xA;what $x(t)$ is for all $t$ in the interval $[0, 16T]$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Number the $16$ bits typed in by the user as $a_0, a_1, \ldots, a_{15}$&#xA;where each $a_i$ can have value $0$ or $1$. Include in your&#xA;program a snarky error message to be sent to the user if any of&#xA;the $a_i$ have value other than $0$ or $1$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Pick two positive integers $m_0$ and $m_1$. The FSK signal&#xA;described below will use frequencies $m_0/T$ Hz and $m_1/T$ Hz.&#xA;It is convenient, and possibly might even please your client or&#xA;boss, if you choose &lt;em&gt;consecutive&lt;/em&gt; integers as $m_0$ and $m_1$ such&#xA;that the FSK signal fits in the frequency band allocated to the system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Define the signal $x(t)$ as follows.  For $i = 0, 1, 2, \ldots, 15$,&#xA;$$x(t) = A \sin\left(2\pi\left[(1-a_i)m_0 + a_i m_1\left]\frac{t}{T}\right.\right.\right),~~~&#xA;iT \leq t &amp;lt; (i+1)T.$$&#xA;Several points need to be noticed with respect to this definition:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The quantity in square brackets has value $m_0$ if $a_i = 0$ and value $m_1$ if $a_i = 1$ and so during the time interval $[iT, (i+1)T)$, the signal&#xA;consists of either $m_0$ periods or $m_1$ periods of a sinusoid. At the&#xA;endpoints of the interval, the signal has value $0$. The signal thus has&#xA;the &lt;em&gt;phase continuity&lt;/em&gt; that is desirable in an FSK signal as noted&#xA;by @JasonR in a comment.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are using some programming language to create an array of&#xA;$16$ gazillion points that you will then pass to a graphics package to display&#xA;as a graph of values of $x(t)$ as a function of $t$, then note that the&#xA;formulas used to create the first gazillion points will differ from the&#xA;formula used to create the next gazillion points etc.. The &#xA;formula needs to use $a_i$ to compute the values of the $i$-th&#xA;subset of gazillion points. If you want&#xA;to have a nice smooth graph of the sinusoids, it is necessary &#xA;to have $m_0$ and $m_1$ be onsiderably smaller than a gazillion&#xA;so that you get plenty of points&#xA;per period of each sinusoid.  Your graph will also have a &lt;em&gt;long&lt;/em&gt;&#xA;horizontal axis that will likely extend past one page even if printed in&#xA;landscape mode on legal-size paper.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-08-23T01:21:11.973" LastActivityDate="2013-08-23T01:21:11.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10438" PostTypeId="1" AcceptedAnswerId="10459" CreationDate="2013-08-22T17:09:40.227" Score="6" ViewCount="472" Body="&lt;p&gt;The DFT of a real signal is Hermite-symmetric, so you can roughly halve the computation time/memory by not bothering to calculate half the values of the spectrum (and complex conjugating the existing values and copying them to the second half if needed).  So the &lt;a href=&quot;http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.fft.rfft.html&quot;&gt;rfft operation&lt;/a&gt; takes N samples and outputs N/2 spectrum bins in half the time, for instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signals which are even-symmetrical and real have even-symmetrical and real spectra (and real spectra take half the memory to store as complex spectra), so for symmetrical input, can the calculation be halved again by only using the first half of the signal (N/2) to generate the first half of the spectrum (N/2)?  How?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to take the regular FFT of the N/2 half-signal and manipulate the output to produce the N/2 half-spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(real/odd ⇔ imaginary/odd would work, too, but real/even ⇔ real/even case is simpler to follow.)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-08-23T19:05:48.847" Title="Can you quarter the processing time for real, symmetric FFTs?" Tags="|fft|dft|symmetry|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10439" PostTypeId="1" AcceptedAnswerId="10440" CreationDate="2013-08-22T17:12:28.367" Score="0" ViewCount="5414" Body="&lt;p&gt;I have a signal and from that I want to extract a specific frequency range, e.g. 10Hz to 15Hz. Now I heard that I should use Fast Fourier Transformation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to do that in Matlab, but I have no idea where to start. Is there any good example how I can do this by passing the original signal and the frequency band as parameter?&lt;/p&gt;&#xA;" OwnerUserId="4476" LastActivityDate="2013-08-22T17:41:15.537" Title="Using FFT to extract a specific frequency range in Matlab?" Tags="|matlab|fft|frequency-spectrum|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10440" PostTypeId="2" ParentId="10439" CreationDate="2013-08-22T17:34:33.967" Score="1" Body="&lt;p&gt;To analyze a certain frequency band, you first have to know the sampling frequency $f_\mathrm{S}$ that has been used to acquire your signal $x$. To compute the discrete Fourier transform (DFT) in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;y = fft(x);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of Matlab's FFT function has length $N$ and begins with frequency 0, $N$ beeing the length of $x$. The frequency range you're looking for therefore lies in the index range&#xA;$$&#xA;N\frac{f_1}{f_\mathrm{S}} + 1\ldots N\frac{f_2}{f_\mathrm{S}} +1&#xA;$$&#xA;Where $f_1$ is the lower and $f_2$ is the upper limit of your frequency range and $f_1 \leq f_2 \leq f_\mathrm{S}/2$ must hold. The addition of 1 accounts for Matlab indices beginning at 1, not at 0. Also note that in general the above expressions are non-integer numbers.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-08-22T17:41:15.537" LastActivityDate="2013-08-22T17:41:15.537" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10441" PostTypeId="1" CreationDate="2013-08-22T17:54:46.447" Score="2" ViewCount="498" Body="&lt;p&gt;There is an example of inverse filtering in my textbook which I don't fully understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the two filters v(t) = (1,-0.5) and w(t) = (-0.5,1).  The inverse of these filters are given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for v:  1:(1,-0.5) = (1, 0.5, 0.25, . . .)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for w:  1:(-0.5,1) = (-2, -4, -8, . . .)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is no mathematical illustration for how these inverse filters are calculated, and I don't see the intuition here.  Of course I know that the inverse of a filter v is 1/v, but why these two filters yield these different series puzzles me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can explain this to me, I would be very grateful!&lt;/p&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2013-08-22T20:02:42.367" Title="Inverse filtering" Tags="|filters|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10442" PostTypeId="1" AcceptedAnswerId="10450" CreationDate="2013-08-22T18:03:45.477" Score="1" ViewCount="325" Body="&lt;p&gt;What is meant  by Least square plus Gaussian method of estimating the parameters of an unknown system? I am aware of least squares  in general but some works refer it as least square+gaussian method. What is the role of Gaussian here? Is it for some kind of assumption of the distribution of the residual errors? please clarify&lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="128" LastEditDate="2018-06-19T11:41:48.370" LastActivityDate="2018-06-19T11:41:48.370" Title="Conceptual Question on Least Squares Estimation Method" Tags="|signal-detection|estimation|least-squares|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10443" PostTypeId="2" ParentId="10428" CreationDate="2013-08-22T19:21:39.747" Score="1" Body="&lt;p&gt;With FDLS, another parameter to play with to find alternate solutions is the ratio of zeros to poles, as well as the total.  IIRC, more of both isn't always better (possibly for numerical reasons).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-22T19:21:39.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10444" PostTypeId="2" ParentId="10441" CreationDate="2013-08-22T20:02:42.367" Score="2" Body="&lt;p&gt;Hint: try to write your inverse filter on the form $H(z) = \frac{1}{1-0.5z^-1}$, then write the corresponding difference equation and find the impulse response. What does that give you?&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-08-22T20:02:42.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10445" PostTypeId="2" ParentId="9064" CreationDate="2013-08-22T20:31:23.897" Score="1" Body="&lt;p&gt;You only need to find and report positions of nine specific symbols.  You can do this by computing correlations (done quickly by multiplying in Fourier space) with samples of the nine digits snipped from a typical puzzle image, blurred as it is.  All blurred '9' will look the same, and likewise all other digits.  I'm assuming puzzle images are taken with the same camera the same way.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might work better working on high-pass filtered versions of the input puzzle image and image snips, by subtracting from each a more-blurred copy.  &lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2013-08-22T20:31:23.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10446" PostTypeId="2" ParentId="10438" CreationDate="2013-08-22T20:44:29.093" Score="1" Body="&lt;p&gt;I'm not sure about quartering the process time but this is what I can think of for now. N point DFT of x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X_k = \sum_{n=0}^{N-1}x_nW_N^{kn}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the even symmetry assumption&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X_k = \sum_{n=0}^{N/2-1}x_n(W_N^{kn}+W_N^{k(N-1-n)})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we simplify&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X_k = W_N^{k(N-1)/2}\sum_{n=0}^{N/2-1}x_n(W_N^{kn}W_N^{-k(N-1)/2}+W_N^{-kn}W_N^{k(N-1)/2})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X_k = 2W_N^{k(N-1)/2}\sum_{n=0}^{N/2-1}x_n\cos(2\pi k\frac{n-(N-1)/2}{N})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are probably some errors but if simplifications are valid the 'FFT' size is reduced by a factor of 2 and the twiddle factors are real (this maybe corresponds to your quartering). As in normal FFT the symmetry and periodicity can be exploited to decompose the 'symmetric FFT' into radix-2 steps for instnace. &lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2013-08-22T20:44:29.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10447" PostTypeId="2" ParentId="9510" CreationDate="2013-08-22T20:48:37.793" Score="1" Body="&lt;p&gt;My first and second choices are Python and IDL, not necessarily in any order.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Python is popular with scientists, engineers and artists, well-known, on all platforms, free and open.  You need Numpy and PIL (Python Imaging Library).  Python is more and more commonly used in many places where Matlab used to rule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IDL from IIT-VIS (I think it's a different name now) is similar to Matlab and the like, but nicer syntax for multidimensional arrays. Very popular with astronomers, geologists, and various others.  It has flaws.  IDL costs $$ but luckily there's a free version named Fawlty Language. It's not open source, but is free (last time I checked.) I don't have the link handy, but google it.   There's also GDL which is a Gnu attempt to create an IDL-compatible interpreter, but last time I tried it, it wasn't so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't like Octave because it's clumsy for three dimensional and higher arrays.  Images are only 2D, but I often need to process a stack of them, and also may have RGB or other types of channels.  &lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2013-08-22T20:48:37.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10449" PostTypeId="1" CreationDate="2013-08-22T23:00:49.103" Score="2" ViewCount="512" Body="&lt;p&gt;I am averaging several FFT results together in an attempt to get the average frequency spectrum of a track of audio. I'm attempting to use Parseval's Relation to get the RMS of the audio from the resulting average spectrum, but i've noticed the RMS i get is wrong, usually only by a couple dB. Why does this happen? Does it mean i am averaging the spectra together incorrectly? Is it more complicated than simply adding the corresponding N magnitudes together and dividing by N? When i get the RMS from a single FFT using Parseval's Relation it is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code i am using to average the FFTs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    int N = pow(2, resolution);&#xA;&#xA;    //temporary buffers&#xA;    vector&amp;lt; array&amp;lt;double,2&amp;gt; &amp;gt; RXT; &#xA;    vector&amp;lt; array&amp;lt;double,2&amp;gt; &amp;gt; IXT;&#xA;&#xA;    //final signals&#xA;    REX.assign(N, array&amp;lt;double,2&amp;gt;() );&#xA;    IMX.assign(N, array&amp;lt;double,2&amp;gt;() );&#xA;    magnitude.assign( N, array&amp;lt;double,2&amp;gt;() ); &#xA;    phase.assign( N, array&amp;lt;double,2&amp;gt;() );&#xA;&#xA;    int start;&#xA;    bool lastSeg = false;&#xA;    int seg = 0;&#xA;    //double radians = 2 * PI / N; //used for windowing functions&#xA;&#xA;    while ( !lastSeg ) {&#xA;&#xA;        start = seg * N;&#xA;&#xA;        if (X.size() &amp;gt;= start + N) {&#xA;            RXT.assign(X.begin()+start,X.begin()+start+N);&#xA;        } else {&#xA;            RXT.assign(X.begin()+start,X.end());&#xA;            for ( int n = 0; n &amp;lt; RXT.size(); n++ ) {&#xA;                for ( int chan = 0; chan &amp;lt; channels; chan++ ) {&#xA;&#xA;                    RXT.at(n).at(chan) *= (double)N / RXT.size();&#xA;&#xA;                }&#xA;            }&#xA;            RXT.resize( N, array&amp;lt;double,2&amp;gt;() );&#xA;            lastSeg = true;&#xA;        }&#xA;&#xA;        IXT.assign( N, array&amp;lt;double,2&amp;gt;() );&#xA;&#xA;        FFT(RXT, IXT);&#xA;&#xA;        for ( int n = 0; n &amp;lt; N; n++ ) {&#xA;            for ( int chan = 0; chan &amp;lt; channels; chan++ ) {&#xA;&#xA;                magnitude.at(n).at(chan) += getMag( RXT.at(n).at(chan), IXT.at(n).at(chan) );&#xA;&#xA;            }&#xA;        }&#xA;&#xA;        seg++;&#xA;&#xA;    }&#xA;&#xA;    for ( int n = 0; n &amp;lt; N; n++ ) {&#xA;        for ( int chan = 0; chan &amp;lt; channels; chan++ ) {&#xA;&#xA;            magnitude.at(n).at(chan) /= seg;&#xA;&#xA;            REX.at(n).at(chan) = getReal(magnitude.at(n).at(chan), phase.at(n).at(chan));&#xA;            IMX.at(n).at(chan) = getImag(magnitude.at(n).at(chan), phase.at(n).at(chan));&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5281" LastEditorUserId="5281" LastEditDate="2013-08-23T04:15:05.497" LastActivityDate="2013-08-23T04:15:05.497" Title="Averaging frequency spectra gives incorrect RMS" Tags="|fft|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10450" PostTypeId="2" ParentId="10442" CreationDate="2013-08-22T23:24:54.200" Score="2" Body="&lt;p&gt;Gauss did a two-way proof.  In rough terms, he not only showed that least squares gives the best fit to data containing a standard normal distribution of errors, but that if least squares is always giving the best fit, that implies that the distribution is indeed standard normal (also now called Gaussian).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correlation coefficient, often computed in conjunction with a least square fit, is usually assumed to be parameterizing an underlying Gaussian distribution.  If the distribution is otherwise, it may well infer nonsense.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-22T23:24:54.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10451" PostTypeId="1" AcceptedAnswerId="10452" CreationDate="2013-08-22T23:39:32.217" Score="3" ViewCount="1968" Body="&lt;p&gt;I'm new at Fourier Transforms. I'm using AForge.Math FFT/DFT algorithm (C#). Said that I have this situation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vBgfs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;1.4 + sin(2\pi t) + 0.4sin(5·2\pi t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling: 100 samples each second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the spectrum. The DFT finds the frequencies of my signal: 1Hz and 5Hz (and the constant component: 0Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/d7zIJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SHXDx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qVxwo.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Here is the inverse transform. As you can see the result is similar in shape to the original but obviously something is happening there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What parameters can I change to get better results.&lt;/li&gt;&#xA;&lt;li&gt;Should I expect to completely be able to regenerate the signal in time domain from the spectrum?&lt;/li&gt;&#xA;&lt;li&gt;Can the IDFT be used as a signal generator? It's very easy to create the peaks at the desired frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Maybe I need to go to the books, but, why there is always a mirrored frequencies in the DFT and how should I interpret them? I don't have any frequencies at 95Hz nor 99Hz. Is it a flaw of the DFT?&lt;/li&gt;&#xA;&lt;li&gt;Why the initial point is not mirrored?&lt;/li&gt;&#xA;&lt;li&gt;The amplitudes of the peaks in the spectrum are not correct: the first one should be 1 and the second 0.4. I've heard that the amplitudes in a spectrum are not important, is that truth, if so why? Anyway, I think it's very useful to know what is the amplitude of the sinusoids, is there a way to do that?&lt;/li&gt;&#xA;&lt;li&gt;Can I throw away the symmetric part?&lt;/li&gt;&#xA;&lt;li&gt;If so, can I throw away the almost null values till the first frequency from the middle to start? (in my case from 50Hz to almost 5 Hz).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As pointed &lt;a href=&quot;http://www.dspguide.com/ch12/1.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; I needed to, first keep the real/imaginary data from the direct transform and, second, adapt that data because I'm using an complex inverse DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B1Xa7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In cyan/purple : Re/Im parts&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EC8og.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;In red: final result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The X spacing is wrong but that's a story for another day. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks everyone.&lt;/p&gt;&#xA;" OwnerUserId="5160" LastEditorUserId="5160" LastEditDate="2013-08-23T09:30:55.507" LastActivityDate="2013-08-23T09:30:55.507" Title="DFT and then IDFT does not provide the same signal" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10452" PostTypeId="2" ParentId="10451" CreationDate="2013-08-23T02:39:30.190" Score="5" Body="&lt;p&gt;If you want your IFFT result to match the input to the FFT, don't throw away either the &quot;imaginary&quot; (or sine correlation) components, or the &quot;upper half&quot; of the spectrum, before the IFFT.  Also make sure the input to the IFFT is exactly conjugate symmetric, so that all the imaginary components in the IFFT results get cancelled out (except for rounding errors or quantization noise).  The length of the IFFT has to be the same as that of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your 99 and 95 Hz components are also the -1 and -5 Hz components needed (in complex conjugate symmetry) to cancel out any rotation of the time domain data into the imaginary plane.  Since the FFT is a complex to complex transform, you can't just ignore these components even when dealing with strictly real data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 0 Hz or DC component of an FFT result appears double height because it includes it's own mirrored value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless your sinewave's are exactly periodic within the FFT length, you will need to interpolate the true amplitudes, since their peaks will be between the FFT result bin centers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The IDFT and IFFT can be used as signal generators, although great care must be taken with phase for any frequencies that are not exactly periodic in the FFTs length.  See Phase Vocoder analysis/synthesis for details.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-23T05:36:50.680" LastActivityDate="2013-08-23T05:36:50.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10453" PostTypeId="1" AcceptedAnswerId="10454" CreationDate="2013-08-23T06:15:29.503" Score="6" ViewCount="16090" Body="&lt;p&gt;Suppose that I have two signals $x[n] = \left\{2,4,1\right\}$ and $p[n] = \left\{5,1,8\right\}$ and I want to multiply them.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How do you do that?&lt;/li&gt;&#xA;&lt;li&gt;How different is it from convolving two signals?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I understand that multiplication in one domain is equal to convolution in other domain. How do you choose as to what to use : multiplication or convolution?&lt;/p&gt;&#xA;" OwnerUserId="5299" LastEditorUserId="1629" LastEditDate="2016-03-05T14:32:58.873" LastActivityDate="2016-03-05T14:32:58.873" Title="How are two signals multiplied? And how is it different from convolving two signals?" Tags="|convolution|filtering|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10454" PostTypeId="2" ParentId="10453" CreationDate="2013-08-23T06:54:35.387" Score="10" Body="&lt;p&gt;Yes, you are correct. Multiplication in time domain means convolution in frequency domain and vice versa.  Multiplying your signals $x[n]$ and $y[n]$ will give an output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;z[n]&amp;amp;=\{2\cdot 5, 4\cdot 1, 1\cdot 8\}\\ &amp;amp;= \{10, 4, 8\}\end{align} &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that this output is in time domain. When you convolve $x[n]$ and $y[n]$, you will get $z[n]$ in time domain as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;z[n]&amp;amp;=\{5\cdot 2, 5\cdot 4+1\cdot 2, 5\cdot 1+1\cdot 4+8\cdot 2, 1\cdot 1+8\cdot 4, 8\cdot 1\}\\ &amp;amp;= \{10,22,25,33,8\}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just flip one of the signals around zero and start moving right one place at a time. Multiply the corresponding points as you go along. The output has a larger sequence because convolution output has ${\rm length}(x)+{\rm length}(y)-1$ points.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your query about where to use multiplication &amp;amp; convolution, assume you want to pass signal $x(n)$ through filter $y(n)$. The output of the filter $z(n)$ will be convolution of $x(n)$ and $y(n)$.&lt;br&gt;&#xA;Now assume that you first converted from time to frequency domain, i.e. $X(e^{i\omega})$ and $Y(e^{i\omega})$ are frequency domain representation of $x(n)$ and $y(n)$. Now, to find $Z(e^{i\omega})$(output in frequency domain), you have to multiply $X(e^{i\omega})$ and $Y(e^{i\omega})$. To get the output in time domain i.e. $z(n)$ you have to apply inverse transform.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that's how you use convolution and multiplication.&lt;/p&gt;&#xA;" OwnerUserId="4875" LastEditorUserId="1629" LastEditDate="2016-03-05T14:30:46.770" LastActivityDate="2016-03-05T14:30:46.770" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10455" PostTypeId="1" AcceptedAnswerId="10457" CreationDate="2013-08-23T14:11:49.857" Score="4" ViewCount="1506" Body="&lt;p&gt;I'm studying the IIR filter design that is described in the book: &lt;a href=&quot;http://www.nt.tuwien.ac.at/fileadmin/users/gerhard/diss_Lang.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Algorithms for the constrained design of digital filters with arbitrary phase and magnitude responses&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the code at page 171 (at least the main function), and here is an example of a filter design :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M=4;&#xA;N=4;&#xA;tau=5;&#xA;om=pi*[linspace(0,0.2,20),linspace(0.4,1,60)];&#xA;D=[exp(-1i*om(1:20)*tau),zeros(1,60)];&#xA;W=ones(1,80);&#xA;[b,a,e]=mpiir_l2(M,N,om,D,W,0.98);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the design of a pass-band linear phase lowpass filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bj26y.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is something I don't understand in this code: &lt;code&gt;exp(-1i*om(1:20)*tau)&lt;/code&gt; is a way to create regularly spaced points with constant phase change and magnitude = 1. But I don't understand the parameter &lt;code&gt;tau&lt;/code&gt;. I tried to change that parameter and I had totally different results: like a notch instead of a lowpass.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How do you choose that number ? &lt;/li&gt;&#xA;&lt;li&gt;I have to design my filters according to the user desire but how to guess that parameter? &lt;/li&gt;&#xA;&lt;li&gt;And also how to you choose the phase angles shift ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;" OwnerUserId="5292" LastEditorUserId="1629" LastEditDate="2016-04-06T19:14:54.033" LastActivityDate="2016-04-06T19:14:54.033" Title="Least-squares digital IIR filter design (with arbitrary responses)" Tags="|matlab|filter-design|frequency-response|infinite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10456" PostTypeId="2" ParentId="10455" CreationDate="2013-08-23T16:58:19.087" Score="3" Body="&lt;p&gt;Well, let's decode it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;om=pi*[linspace(0,0.2,20),linspace(0.4,1,60)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;om&lt;/code&gt; is a variable that ranges from 0 to pi with two different spacings (one from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;0.2*pi&lt;/code&gt; and one from &lt;code&gt;0.4*pi&lt;/code&gt; to &lt;code&gt;pi&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, to find &lt;code&gt;D&lt;/code&gt; (the desired response), we do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-1i*om(1:20)*tau&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This takes the first twenty entries in &lt;code&gt;om&lt;/code&gt; and multiplies them by &lt;code&gt;tau&lt;/code&gt; and &lt;code&gt;-i1&lt;/code&gt; = $-\sqrt{-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That makes the frequency range (&lt;code&gt;D&lt;/code&gt; in the above) from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;0.2*pi*tau&lt;/code&gt; (i.e. &lt;code&gt;pi&lt;/code&gt; since &lt;code&gt;tau&lt;/code&gt; is &lt;code&gt;5&lt;/code&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checking page 171, we see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;om frequency grid 0&amp;lt;=om&amp;lt;= pi&#xA;D complex desired frequency response on the grid om&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which means that &lt;code&gt;om&lt;/code&gt; has to be between 0 and &lt;code&gt;pi&lt;/code&gt;, and &lt;code&gt;D&lt;/code&gt; is the desired response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've changed &lt;code&gt;tau&lt;/code&gt;, causing &lt;code&gt;D&lt;/code&gt; to have a greater phase (more delay).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I suspect is happening is that the phase (and, therefore, the delay) you've changed it to cannot easily be approximated by a $4^{\rm th}$ order filter (&lt;code&gt;N&lt;/code&gt; or &lt;code&gt;M&lt;/code&gt; in your script).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-08-23T18:51:30.697" LastActivityDate="2013-08-23T18:51:30.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10457" PostTypeId="2" ParentId="10455" CreationDate="2013-08-23T17:30:47.203" Score="2" Body="&lt;p&gt;The variable &lt;code&gt;tau&lt;/code&gt; was chosen so that the phase of &lt;code&gt;D&lt;/code&gt; at $om = 0.2$ is $-\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easier to understanding what is going on if you plot &lt;code&gt;D&lt;/code&gt;, which is the desired magnitude/phase response of the filter. Add the following code to help you visualize what is going on:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure(1);&#xA;subplot(2,1,1);&#xA;  plot(om/pi,10*log10(abs(D)+realmin));&#xA;  title('Magnitude Response');&#xA;  xlabel('Frequency (normalized)');&#xA;  ylabel('Magnitude (dB)');&#xA;  axis([0, 1, -80, 10]);&#xA;subplot(2,1,2);&#xA;  plot(om/pi,angle(D)*180/pi);&#xA;  title('Phase Response');&#xA;  xlabel('Frequency (normalized)');&#xA;  ylabel('Phase (degrees)');&#xA;  axis([0, 1, -180, 180]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When you look at the resulting plot, you can see that the current value of tau gives a phase response which dips down to $-180^\circ$ at the cutoff frequency.  Notice that the phase will wrap back around from $-180^\circ$ to $180^\circ$.  This will almost always lead to undesired results in a system.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-08-23T17:30:47.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10459" PostTypeId="2" ParentId="10438" CreationDate="2013-08-23T19:05:48.847" Score="1" Body="&lt;p&gt;There are many possible reductions in the number of computations for the DFT for constrained inputs. Looking closer at what well known DFT libraries do (FFTW for example) should be a good resource for how one can exploit these constraints. For your case, I would look at the discrete cosine transform (DCT). The discrete cosine transform enforces even symmetry. The &quot;fast&quot; DCT algorithms employ FFT structures that are optimized for these input constraints. The types of implicit even-symmetry mirroring that the DCT perform are what differentiate the various DCT types (Type I, Type II, ...). If your sequence is truly even-symmetric, then you could use a fast DCT algorithm (one based on FFT structures) with half of your data knowing the algorithm is assuming the other half is equivalent (albeit time-reversed). This should result in a reduction in the number of overall operations, as it would require a DFT of twice this length if you went the normal route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also pack a length N sequence into N/2 complex samples and for not much added complexity you can recover a length N FFT. So you can sort of attack it from the other angle of doing a half-length complex FFT. While this seems less efficient, for a typical FFT structure you are complex after the first stage anyways, and so for large DFT sizes this becomes very efficient.&lt;/p&gt;&#xA;" OwnerUserId="1279" LastActivityDate="2013-08-23T19:05:48.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10460" PostTypeId="1" AcceptedAnswerId="10470" CreationDate="2013-08-23T19:19:36.023" Score="1" ViewCount="757" Body="&lt;p&gt;I am multiplying two sine waves with the same frequency (f), but might have a phase difference 0 &amp;lt;-&gt; 90 degrees. The product is a two frequency sinusoidal wave with f1 = f-f = DC and f2 = f+f = 2f. I now want to filter out the 2f component. I am currently sampling at Fs = 32 x f. I get a 40th order equiripple FIR filter in Matlab which is ok, but if I later am to increase the sampling rate to 64xf, 128xf etc the filter order gets very high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume however that f1 will not be 0 Hz exactly but somewhere close to 0 Hz. Over this region the ripple in the passband might be unwanted. Can the ripple change that much over such a narrow range? (within whatever limit one has set as the maximum ripple in the passband).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the Filter Design &amp;amp; Analysis tool in Matlab and saw that it does not seem like an equiripple filter has any ripple close to DC (0&amp;lt;-&gt;1Hz)? Is this correct? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a filter that can attenuate the 2f component with 60dB and need as little computing power as possible. (working on a MCU without FPU using fixed-point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other filter that can do a better job than equiripple for what I described? I am open for other types of filters as IIR if someone can convince me of their advantages.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastEditorUserId="4290" LastEditDate="2013-08-24T10:51:49.073" LastActivityDate="2013-08-24T18:54:34.163" Title="How does a FIR equiripple filter behave close to DC?" Tags="|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10461" PostTypeId="2" ParentId="10460" CreationDate="2013-08-23T21:09:10.203" Score="6" Body="&lt;p&gt;If you want to know the exact DC gain of your filter take the sum of the coefficients. This is true for an equiripple filter as well as any other FIR filter.  There is no such thing as ripple at DC, because &quot;ripple&quot; is a term used to describe a magnitude variation over some range of frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If what you are looking for is a &lt;em&gt;flat passband&lt;/em&gt; then equiripple can fit the bill.  When using the &lt;code&gt;fdatool&lt;/code&gt; in Matlab, notice that the equiripple FIR filter allows you to specify a parameter &lt;code&gt;Apass&lt;/code&gt;.  This paramter lets you adjust the maximum allowable amplitude of the ripples in the passband as shown below.  By default it is set to 1, which means that you will have a maximum ripple of 1 dB in the passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SxgpV.png&quot; alt=&quot;MATLAB Filter Specification Diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not constrained to FIR filters, then you might want to consider an IIR filter, depending on your needs.  You can usually achieve the desired result with a lower filter order when using IIR.  This means less computation and less delay.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-08-23T21:09:10.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10462" PostTypeId="1" AcceptedAnswerId="10464" CreationDate="2013-08-24T00:15:43.197" Score="1" ViewCount="1146" Body="&lt;p&gt;I understand that digital audio has both a sample rate (time &quot;discretization&quot;) and a bit depth (&quot;amplitude&quot; discretization). Also, it can have multiple channels (stereo would be 2 channels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But things that I can't find readily in the internet:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the range that is discretized in the bit depth? My experience is in motions, so I know if I have an accelerometer with a range of +-10 g's, and I discretize it in 8bit, well I would have a resolution of 20g/256. What would be the equivalence in audio?&lt;/li&gt;&#xA;&lt;li&gt;Matlab's Simulink has a block for reading audio. It's output has the dimensions of MxN(xTime), where M is the number of &quot;consecutive samples&quot; and N the number of channels. What is &quot;consecutive samples&quot; (also called in the same help file as &quot;Frame Size (samples)&quot;). If I set this value to one, I would get what I would expect from a Mono sound, just a time history of amplitudes. But if I set it to two, it's almost as if they are both the same with minor differences in fast transitions. Is this meant for to get a average of the signals to be somewhat more &quot;true to sound&quot;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is the link for Simulink's block: &lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/fromaudiodevice.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/dsp/ref/fromaudiodevice.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5237" LastActivityDate="2013-08-24T05:24:14.717" Title="Understanding Digital Audio - &quot;From Audio Device&quot; in Matlab" Tags="|matlab|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10464" PostTypeId="2" ParentId="10462" CreationDate="2013-08-24T03:52:13.147" Score="2" Body="&lt;p&gt;1) The microphone converts the audio signal to an electrical signal, and then that electrical signal often goes through an amplifier and then to the ADC.  The ADC usually samples the voltage of the electrical signal, which is directly analogous to the pressure of the audio signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to think of it in audio terms, probably the most useful way to think of it is that your microphone/amp/something saturates at a certain dB level.  Let's call that &quot;X&quot; dB.  That is where your signal maxes out.  If you have 16-bit sampling then you can span a decibel range of $20log_{10}(2^{16})$ = 96 dB.  That means that, in an ideal world, you could cover audio signals from &quot;X&quot; dB to &quot;X&quot; - 96 dB.  Since the world is not ideal you would probably not get that entire range, but you would probably get pretty close.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &quot;Consecutive samples&quot; just means the number of samples.  They throw &quot;consecutive&quot; in there just to say that they are not skipping samples.  If you set that value to 1 you will only get one sample per channel, which is probably not what you want to do.  The number of channels refers to the number of audio sources.  For mono you would set that to 1.  For stereo you would set it to 2.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-08-24T03:52:13.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10465" PostTypeId="2" ParentId="10462" CreationDate="2013-08-24T05:12:33.733" Score="2" Body="&lt;p&gt;Normally, audio samples are measured every unit of time discretization (every about 22.676 uS at a 44100 samples-oer-second sample rate, consecutive means that this is done without skipping any of those discrete time units), and analyzed in blocks, so as to amortize any fixed per block overhead (interrupt latency, subroutine call overhead, etc.). For instance, one might use a block size of M = 4096 so as to process audio samples using an FFT of that length, with O(MLogM) efficiency..  Since the samples in a block are taken consecutively, they all each don't need to be individually time stamped, as relative time can be inferred from each samples position in the block array, and the sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless there is high frequency content in the audio, two adjacent consecutive samples won't have time to change much.  That might be why they look similar in value when you look at 2 in a row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude units are arbitrary, depending on the gain of the microphone, pre-amp, AGC and ADC, etc., they could be almost anything unless you calibrate against some known source.  Usually one tries not to fiddle with the gain after it has previously been set so that values will not be too small or too large for the amplitude quantization and number size (16 bits, etc.) in use.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-24T05:24:14.717" LastActivityDate="2013-08-24T05:24:14.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10466" PostTypeId="1" AcceptedAnswerId="10468" CreationDate="2013-08-24T10:40:12.700" Score="0" ViewCount="224" Body="&lt;p&gt;i would like to add even harmonics from the data of FFT of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do i do that ? do i have to search for higher magnitude frequencies then add the $2f$ then $4f$ etc ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand how to do it from a sin wave for example but not from a noisier signal.&lt;/p&gt;&#xA;" OwnerUserId="5292" LastEditorUserId="5292" LastEditDate="2013-08-24T12:30:05.180" LastActivityDate="2013-08-24T13:51:56.507" Title="Add harmonics to a FFT decomposed signal" Tags="|fft|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10467" PostTypeId="1" AcceptedAnswerId="10473" CreationDate="2013-08-24T12:28:53.987" Score="2" ViewCount="6722" Body="&lt;p&gt;I need to scan an image in OpenCV and obtain the lines. For this I use the canny edge detector and then the propabilistic Hough transform, with which I actually get the lines.&lt;br&gt; &#xA;The problem now is that I get many short lines instead of a few continuous ones. The image I am analyzing has the size 1024x768 and I am wondering if this could be an error source. Theoretically making the image smaller should lead to fewer lines. Might that help me in my task? Or are there any other factors which I should take into account when extracting lines?&lt;/p&gt;&#xA;" OwnerUserId="5295" LastActivityDate="2013-08-25T13:12:38.460" Title="Influence of image size to edge detection in OpenCV" Tags="|opencv|hough-transform|canny-edge-detector|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10468" PostTypeId="2" ParentId="10466" CreationDate="2013-08-24T13:51:56.507" Score="1" Body="&lt;p&gt;For each added harmonic, for each bin number below N/2, you could divide by the harmonic ratio, then use that resulting number to interpolate a point below in the FFT, unless the division results in an integer, in which case you could just use the value from a lower FFT bin.  Use a high-quality interpolator, such as a windowed Sinc or other polyphase upsampling filter kernel.  For a strictly real result from an IFFT, make sure the values above N/2 in your harmonic frequency synthesis remain conjugate symmetric with those below N/2.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-24T13:51:56.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10470" PostTypeId="2" ParentId="10460" CreationDate="2013-08-24T18:54:34.163" Score="5" Body="&lt;p&gt;You're correct; if the signal that you're applying to the input of the filter isn't exactly at DC (0 Hz), then you might see a slight difference in the amplitude of the output due to the filter's passband ripple. I would assert that for most applications, this is either imperceptible or negligible for typical values of passband ripple (1 dB or less). Are you sure that your application requires such insertion loss consistency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are sure, then there are some things you can do to mitigate the problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Design a better equiripple filter.&lt;/strong&gt; If 1 dB of passband ripple is too much, try designing one that has 0.5 dB. If that's too much, think about 0.1 dB. You see where I'm going here. True, there will be some limit beyond which it will be difficult to generate a numerically-realizable filter that has little enough ripple, but again, I would expect that it's quite unlikely that your application is intolerant of 0.1 dB of passband ripple. Also, ratcheting down the allowed ripple is going to have a direct impact on the required filter order, possibly to the point where it's no longer feasible to implement given your system's constraints.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Don't use an equiripple filter.&lt;/strong&gt; With your latest edit to the question, you state that your goal is to attenuate your $2f$ frequency component by a minimum of 60 dB with as little processing power as possible. In that case, this might be a good application for an &lt;a href=&quot;http://en.wikipedia.org/wiki/Infinite_impulse_response&quot;&gt;IIR filter&lt;/a&gt;. Digital IIR filters are usually realized as approximations to one of a few standard classes of analog prototype filters. Specifically, for your application, you might look at a &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter&quot;&gt;Butterworth&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Chebyshev_filter&quot;&gt;Chebyshev type II&lt;/a&gt; structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these classes of filters offer no ripple across their passband, so they may be more amenable to your appilcation if you're picky about how much attenuation you see near DC. Plus, you can meet the same filter performance specifications (i.e. attenuate the unwanted component by at least 60 dB) with a much lower-order filter when compared to the equiripple FIR approach. If computational speed is a limiting factor in your system, this could be attractive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you give up with an IIR structure? FIR filters are nice because they are always BIBO stable. Plus, they are easier to implement robustly in finite-precision arithmetic (IIR implementations might need to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Noise_shaping&quot;&gt;noise-shaping&lt;/a&gt; techniques to mitigate the effects of quantization error that is fed back into the filter). Lastly, symmetric FIR filters offer &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_phase&quot;&gt;linear phase response&lt;/a&gt;, which can be nice for some applications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linear phase response means that for a sinusoidal input, the phase lag induced by the filter is equal to a constant time delay, no matter what the sinusoid frequency is. This can be useful if you care about the phase of the filter output with respect to some other unfiltered signal. While it is possible to design linear-phase IIR filters, in general they do not have this property.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-08-24T18:54:34.163" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10473" PostTypeId="2" ParentId="10467" CreationDate="2013-08-25T13:12:38.460" Score="2" Body="&lt;p&gt;You should play around with the many parameters of the &lt;code&gt;Canny()&lt;/code&gt; and &lt;code&gt;HoughLinesP()&lt;/code&gt; functions before resorting to changing the image size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The prototype for &lt;code&gt;Canny()&lt;/code&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void Canny(InputArray image, OutputArray edges,&#xA;           double threshold1, double threshold2,&#xA;           int apertureSize=3, bool L2gradient=false )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should play with the &lt;code&gt;threshold1&lt;/code&gt;, &lt;code&gt;threshold2&lt;/code&gt;, &lt;code&gt;aperturSize&lt;/code&gt; and &lt;code&gt;L2gradient&lt;/code&gt; parameters until you get an output from &lt;code&gt;Canny()&lt;/code&gt; that accurately marks the pixel involved in the lines in your image.  The &lt;code&gt;threshold2&lt;/code&gt; parameter controls the intensity above which a gradient value will be considered definitely part of an edge.  Setting it higher will give you fewer edges.  The &lt;code&gt;threshold1&lt;/code&gt; parameter controls the intensity above which a pixel will be considered to continue an edge from a neighboring pixel.  Setting it lower will give you longer edges.  The ratio &lt;code&gt;threshold2&lt;/code&gt;/&lt;code&gt;threshold1&lt;/code&gt; should be at least 2.0 and can be as large as 3.0, and maybe larger.  Setting &lt;code&gt;L2gradient&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; will make the algorithm slightly slower but will use a more accurate gradient calculation from the first derivatives.  Setting &lt;code&gt;apertureSize&lt;/code&gt; to 5 or 7 might smooth out some noise in the first derivative calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only once you have &lt;code&gt;Canny()&lt;/code&gt; accurately finding the edges in your image should you move on to running &lt;code&gt;HoughLinesP()&lt;/code&gt;.  &lt;code&gt;HoughLinesP()&lt;/code&gt; also has a bunch of knobs that you need to tune to get decent results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void HoughLinesP(InputArray image, OutputArray lines,&#xA;                 double rho, double theta,&#xA;                 int threshold,&#xA;                 double minLineLength=0,&#xA;                 double maxLineGap=0 )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;rho&lt;/code&gt; and &lt;code&gt;theta&lt;/code&gt; can be set larger and smaller depending on how many lengths and angles you want to allow.  Setting &lt;code&gt;rho&lt;/code&gt; and &lt;code&gt;theta&lt;/code&gt; larger will give you fewer line segments, but they will be less accurate.  &lt;code&gt;threshold&lt;/code&gt; can be increased to reduce the number of line segments that you get.  &lt;code&gt;minLineLength&lt;/code&gt; can be increased to reject short line segments and &lt;code&gt;maxLineGap&lt;/code&gt; can be increased to make it easier for short lines to get connected together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting &lt;code&gt;Canny()&lt;/code&gt;'s &lt;code&gt;apertureSize&lt;/code&gt; parameter larger is somewhat like working with a smaller image, because a larger aperture is doing more blurring/smoothing of the details of the image.  Setting &lt;code&gt;HoughLinesP()&lt;/code&gt;'s &lt;code&gt;rho&lt;/code&gt; and &lt;code&gt;theta&lt;/code&gt; parameters larger is somewhat like working with a smaller image because you are lumping together small differences in angle or length that would be indistinguishable in the smaller image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://docs.opencv.org/modules/imgproc/doc/feature_detection.html?highlight=houghlinesp#houghlinesp&quot; rel=&quot;nofollow&quot;&gt;OpenCV documentation for &lt;code&gt;HoughLinesP()&lt;/code&gt;&lt;/a&gt; has an example with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Canny( src, dst, 50, 200, 3 );&#xA;...&#xA;HoughLinesP( dst, lines, 1, CV_PI/180, 80, 30, 10 );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-08-25T13:12:38.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10474" PostTypeId="1" CreationDate="2013-08-25T14:52:52.490" Score="3" ViewCount="1433" Body="&lt;p&gt;I extracted features from an image using SIFT and SURF. Then I applied few transforms on the image and again calculated the features. While matching the features, I noticed that there are some erroneous matches. For example, if using image of a face, some points on face are matched with points not on face in the transformed image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to detect those false positives ? &lt;/p&gt;&#xA;" OwnerUserId="1115" LastEditorUserId="53" LastEditDate="2013-08-26T01:11:04.560" LastActivityDate="2013-08-26T01:22:50.833" Title="Determining false positives in feature matching" Tags="|computer-vision|local-features|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10475" PostTypeId="1" CreationDate="2013-08-25T15:24:16.327" Score="1" ViewCount="92" Body="&lt;p&gt;I saw the following sentence from &lt;a href=&quot;http://books.google.co.kr/books?id=Td7b0lKum-AC&amp;amp;pg=PA256&amp;amp;lpg=PA256&amp;amp;dq=thus+the+mapping+defines+the+trace+of+a+hypersurface+in+a+5d+space&amp;amp;source=bl&amp;amp;ots=lNR6hf2ti4&amp;amp;sig=dZsWAOHIhwlOo18cUgPUNUp3TuU&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=gBgaUvH-CuawiQfdkoDwBA&amp;amp;redir_esc=y#v=onepage&amp;amp;q=thus%20the%20mapping%20defines%20the%20trace%20of%20a%20hypersurface%20in%20a%205d%20space&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;Feature Extraction &amp;amp; Image Processing, 2nd Edition&#xA;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$&#xA;x = a_0 + a_x\cos(\theta)+b_x\sin(\theta)&#xA;$$ $$&#xA;y = b_0 + a_y\cos(\theta)+b_y\sin(\theta) $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This equation corresponds to the polar representation of an ellipse.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't know this meaning. If you need extra information, I'll add it.&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="80" LastEditDate="2013-08-26T00:17:37.123" LastActivityDate="2013-08-28T13:38:56.773" Title="Confusion about hough transformation for ellipse" Tags="|hough-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10477" PostTypeId="2" ParentId="1522" CreationDate="2013-08-25T21:56:48.777" Score="4" Body="&lt;p&gt;I have written an activity detector class in Java. It's part of my open-source &lt;a href=&quot;http://www.source-code.biz/dsp/java/&quot; rel=&quot;nofollow&quot;&gt;Java DSP collection&lt;/a&gt;. You can use the test program WavSplitter.java to check it out with a WAV file as input.&lt;/p&gt;&#xA;" OwnerUserId="5034" LastActivityDate="2013-08-25T21:56:48.777" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10478" PostTypeId="2" ParentId="10475" CreationDate="2013-08-26T00:23:25.540" Score="2" Body="&lt;p&gt;It's a little mis-leading and confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual way to describe an ellipse is &lt;a href=&quot;http://en.wikipedia.org/wiki/Ellipse#Equations&quot; rel=&quot;nofollow&quot;&gt;using cartesian ($x,y$) coordinates&lt;/a&gt;.  &lt;a href=&quot;http://en.wikipedia.org/wiki/Ellipse#Polar_form_relative_to_center&quot; rel=&quot;nofollow&quot;&gt;Another way to represent an ellipse is using polar coordinates&lt;/a&gt; ($r,\theta$) (where $r$ is the distance (radius) from the origin, and $\theta$ is the angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the equation is saying is that the &lt;em&gt;cartesian&lt;/em&gt; coordinates of the ellipse are parameterized by $\theta$ in the two equations. That is, as you change $\theta$ from 0 to $2\pi$, the values for $x$ and $y$ will lie on the ellipse, for constants ($a_0,b_0,a_x,b_x,a_y,b_y$).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-08-28T13:38:56.773" LastActivityDate="2013-08-28T13:38:56.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10479" PostTypeId="2" ParentId="10474" CreationDate="2013-08-26T01:10:39.403" Score="1" Body="&lt;p&gt;A simple way to reduce the number of erroneous matches is to tweak matching parameters, including trying different matching strategies. If you are using a simple distance threshold to determine what is a match, you can tighten that. Alternatively, you can use the ratio test (used in David Lowe's demo SIFT implementation) to eliminate ambiguous matches. There you can tightened both the distance threshold and the ratio threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the world is not perfect, so even if you tweak every parameter, you will still have some false matches. Then you need to use additional information and/or make additional assumptions about your problem. For example, you can assume that the images are related by a rigid transformation (e. g. affine). You can estimate the parameters of this transformation from your matches using an algorithm like RANSAC. Then you can reject the matches that do not fit this transformation as erroneous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/find-image-rotation-and-scale-using-automated-feature-matching.html&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; of removing erroneous matches by assuming a similarity transformation, using the Computer Vision System Toolbox for MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2013-08-26T01:22:50.833" LastActivityDate="2013-08-26T01:22:50.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10481" PostTypeId="1" CreationDate="2013-08-26T05:19:09.567" Score="2" ViewCount="112" Body="&lt;p&gt;There are several kinds of detectors and descriptors, like &lt;code&gt;SIFT, SURF, FAST&lt;/code&gt;.&#xA;I wonder are they all eligible for real-time applications? Which is the best or better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And furthermore, is &lt;code&gt;Harris-Laplacian&lt;/code&gt; dectector still useful when we already have the above three? Is it better than them?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastActivityDate="2013-08-26T11:23:55.100" Title="feature detectors and descriptors comparison" Tags="|local-features|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10482" PostTypeId="1" CreationDate="2013-08-26T06:35:05.933" Score="5" ViewCount="1901" Body="&lt;p&gt;Does anyone know about different adaptive filtering implementations (LMS, RLS ...) in 2D or even 3D ? I have sequences of 2D images and 3D volumes with repeating patterns but small differences. I was thinking of using one as my reference input and extract differences between the pair (A simple subtraction doesn't work as every little random difference is magnfied in the result). I cannot find any Matlab implementation and using 1D on columns or rows of the images doesn't seem to work. Thought perhaps a 2D version using a 2D neighbourhood would do a better job. The noise I am trying to remove is not white noise but rather coherent noise. New images are produced every second. The differences between two successive ones are small but gets larger over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N0Eut.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4036" LastEditorUserId="4036" LastEditDate="2013-08-26T07:10:51.057" LastActivityDate="2013-10-24T10:39:09.987" Title="2D adaptive filters" Tags="|adaptive-filters|2d|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10483" PostTypeId="1" CreationDate="2013-08-26T08:28:10.253" Score="4" ViewCount="833" Body="&lt;p&gt;In &lt;strong&gt;scale-adapted&lt;/strong&gt; Harris detector, the scale adapted second moment matrix is defined by:&#xA;$$\mu(x, \sigma_I, \sigma_D) = \sigma_D^2\ g(\sigma_I) *\left[ \begin{array}{cc}&#xA;L_x^2(x, \sigma_D) &amp;amp;L_xL_y(x, \sigma_D) \\&#xA;L_xL_y(x, \sigma_D) &amp;amp;L_y^2(x, \sigma_D)&#xA;\end{array} \right]$$,&#xA;while $\sigma_I$ is the &lt;strong&gt;integration scale&lt;/strong&gt;, and $\sigma_D$ is the &lt;strong&gt;differentiation scale&lt;/strong&gt;. What are they? Why use them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to @Dima's answer, I think $\mu(x,\sigma_I, \sigma_D)$ is actually something like this,&#xA;$$\mu(x,\sigma_I,\sigma_D) = \sigma_D^2\cdot g(\sigma_I)*\left(g(\sigma_D)*\begin{bmatrix}I_x^2(x) &amp;amp;I_xI_y(x) \\&#xA;I_xI_y(x) &amp;amp;I_y^2(x)\end{bmatrix}\right)$$, where $I_x,I_y$ are the 1st order derivatives. Is it right? If so, why bother convolving twice? And why multiply $\sigma_D^2$?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="4811" LastEditDate="2013-09-07T07:06:17.287" LastActivityDate="2017-02-16T15:35:20.893" Title="What are integration scale and differentiation scale?" Tags="|image-processing|local-features|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10484" PostTypeId="2" ParentId="10483" CreationDate="2013-08-26T10:33:19.030" Score="2" Body="&lt;p&gt;Such scale parameters identify the resolution at which features of interest are detected. With decreasing scale parameters, finer features are detected. The integration parameter determines the scale of the Gaussian smoothing function (used to attenuate finer features). The differentiation parameter specifies the scale of the derivative operators (used to detect rapid image intensity changes) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parameter values are determined empirically and can be set using iterative procedures.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-08-26T13:33:27.397" LastActivityDate="2013-08-26T13:33:27.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10485" PostTypeId="2" ParentId="10481" CreationDate="2013-08-26T11:23:55.100" Score="1" Body="&lt;p&gt;I think SURF is better than all , as its clear from its name , Speed Up robust Feature Detector , but its not free to use , its a patent , so you can't use it for your commercial uses , you can only use it for your studies and knowledge purpose , but i think its also depend on your app that algo to use , but surf is better with speed&lt;/p&gt;&#xA;" OwnerUserId="5057" LastActivityDate="2013-08-26T11:23:55.100" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10486" PostTypeId="1" AcceptedAnswerId="10490" CreationDate="2013-08-26T12:09:48.607" Score="1" ViewCount="279" Body="&lt;p&gt;I am working with phoneme clustering. I have been using $k$-means clustering have done $k$-means on 2 different data: spectrogram vector and MFCCs. I would like to know how I can evaluate the result of clustering quality? I mean I need to know standard ways to validate the clustering. It would great if someone explains their experience.&lt;/p&gt;&#xA;" OwnerUserId="4926" LastEditorUserId="128" LastEditDate="2019-09-15T18:51:14.073" LastActivityDate="2021-10-28T17:08:35.843" Title="Evaluating clustering result" Tags="|mfcc|clustering|k-means|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10487" PostTypeId="2" ParentId="10358" CreationDate="2013-08-26T12:25:07.377" Score="6" Body="&lt;h1&gt;1st Approach:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Use the haartraining methods of opencv according to this tutorial &lt;a href=&quot;http://note.sonots.com/SciSoftware/haartraining.html&quot;&gt;http://note.sonots.com/SciSoftware/haartraining.html&lt;/a&gt; -- this should give the best results, but I haven't worked with haartraining myself so far...&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;2nd Approach:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I would suggest to use methods of &quot;markerless tracking&quot; of the individual tiles of the board. You can implement this using OpenCV, too..&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Preparation&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For this purpose you'll need some photos of each type of tile. Take a picture of all tile types (each one as one picture), with a homogeneous background from top-down-view tile in the middle of the picture.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then use some feature detector (OpenCV has multiple algorithms for this, but SIFT/SURF are non-free algorithms; I would suggest to use &quot;FAST&quot;) to find distinctive points in the images.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use a feature descriptor to describe the feature found in the image (use e.g. &quot;BRIEF&quot;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Detection&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Now you can detect the tiles in an image by applying the same feature detector/descriptor algorithms to this image. When you've acquired the features/descriptors you can apply the FlannBasedMatcher to find the tiles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a code example / tutorial from OpenCV:&#xA;&lt;a href=&quot;http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography&quot;&gt;http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Notes&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The Matcher Method will give you only one match and will possibly have problems if there is more than one tile of that type found on the board. You could work around that problem by masking out only some parts of the input image. I suggest to do this using the pixel coordinates of the detected features. If you - somehow - detect the outline and size of the tiles first, you can roughly estimate the tile positions and size on the picture. Filter your detected feature-list (e.g. only features within x-pixel radius from expected midpoint of the tile) before matching and then use the strongest match. As a result you'll be given the exact position of the tile on the image (including it's orientation). If it's too complicated to detect the map outline, you can let the user &quot;point&quot; at the corner tiles to mark the outline manually...&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Alternative Approach&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;You can also use this method to find just any of the tiles by its outline. Draw a sample &quot;schematic&quot; grayscale picture of a tile (hexagon) without any image on it. Note that the &quot;dark&quot; and &quot;light&quot; regions in this image need to be correct in the schematic, not just some &quot;lines&quot;.&#xA;You'll probably need to experiment with this. You could try to average multiple photographs of different tiles to generate an &quot;average&quot; image of a tile. Make sure the corners are at the same position (move/scale pictures accordingly) and sharpen the picture when finished (clear corners/edges should be visible) and adjust the contrast a bit, if needed.&lt;/p&gt;&#xA;" OwnerUserId="5316" LastEditorUserId="5316" LastEditDate="2013-08-26T12:37:53.677" LastActivityDate="2013-08-26T12:37:53.677" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10488" PostTypeId="1" CreationDate="2013-08-26T12:32:06.303" Score="2" ViewCount="154" Body="&lt;p&gt;I have two sets of data of given Field of view, one of them only covers a subset of the FOV of the other. I therefore want to upsample the one with the larger FOV to combine it with the other one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is: &lt;strong&gt;In the context of X-ray computed tomography, where the x-rays projections are backprojected to obtain a 3D reconstruction of the object, what is the best upsampling method for the purposes mentioned above?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or to put it differently, &lt;strong&gt;what are the features in an x-ray image that ideally we don't want to damage too much&lt;/strong&gt;... &lt;strong&gt;is it the contrast, the sharpness of the edges, etc.&lt;/strong&gt; keep in mind, that as in many application of digital imaging, anti aliasing filters, Gaussian blurrings, etc. are performed on the images before them being processed for reconstruction purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that each upsampling method has its merits, so considering the nature of the x-ray reconstruction methods, is there any way of deciding on one upsampling method based on the a-priori information of the object.&lt;/p&gt;&#xA;" OwnerUserId="4530" LastEditorUserId="4530" LastEditDate="2013-08-27T20:08:47.377" LastActivityDate="2013-08-27T20:08:47.377" Title="Upsampling Methods for Computed-Tomography" Tags="|sampling|interpolation|3d|2d|reconstruction|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10489" PostTypeId="2" ParentId="7650" CreationDate="2013-08-26T12:33:26.993" Score="1" Body="&lt;p&gt;From your description, it looks like the log operation will have the effect of shrinking the amplitude range at different frequencies. Generating the cepstrum by taking the IFFT of the log(FFT) should generate a sharper signal. You can experiment with using different log bases and nth roots to understand the effect. &lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-08-26T12:39:55.703" LastActivityDate="2013-08-26T12:39:55.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10490" PostTypeId="2" ParentId="10486" CreationDate="2013-08-26T12:43:53.277" Score="2" Body="&lt;p&gt;One standard way to evaluate the quality of such techniques is to look at the distribution of correct clusterings versus incorrect clusterings.&lt;/p&gt;&#xA;&lt;p&gt;This can be quantified by looking at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Precision_and_recall&quot; rel=&quot;nofollow noreferrer&quot;&gt;precision, recall and quality of the clusterings&lt;/a&gt;... but assumes that you have a &amp;quot;ground truth&amp;quot; (i.e. that you know the real cluster the data point belongs to).&lt;/p&gt;&#xA;&lt;p&gt;Precision: &lt;span class=&quot;math-container&quot;&gt;$p = \frac{TP}{TP + FP}$&lt;/span&gt;, the percentage of positives that are true positives (and not mis-classified negatives).&lt;/p&gt;&#xA;&lt;p&gt;Recall: &lt;span class=&quot;math-container&quot;&gt;$r = \frac{TP}{TP + FN}$&lt;/span&gt;, the percentage of true positives that were correctly identified.&lt;/p&gt;&#xA;&lt;p&gt;Quality (AKA accuracy) = &lt;span class=&quot;math-container&quot;&gt;$q = \frac{TP + TN}{TP + TN + FP + FN}$&lt;/span&gt;, the percentage of correctly classified items from all classified items.&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$TP$&lt;/span&gt; is the number of true positives, &lt;span class=&quot;math-container&quot;&gt;$TN$&lt;/span&gt; the number of true negatives, &lt;span class=&quot;math-container&quot;&gt;$FP$&lt;/span&gt; the number of false positives, &lt;span class=&quot;math-container&quot;&gt;$FN$&lt;/span&gt; is the number of false negatives.&lt;/p&gt;&#xA;&lt;p&gt;If you have many clusters and need to evaluate their interaction, then &lt;a href=&quot;http://en.wikipedia.org/wiki/Confusion_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;a confusion matrix may be more useful.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you want to go into this in even more detail, I'd suggest reading the paper:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Andrew P. Bradley, The use of the area under the ROC curve in the evaluation of machine learning algorithms, Pattern Recognition, Volume 30, Issue 7, July 1997, Pages 1145-1159, ISSN 0031-3203, &lt;a href=&quot;http://dx.doi.org/10.1016/S0031-3203(96)00142-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://dx.doi.org/10.1016/S0031-3203(96)00142-2&lt;/a&gt;.&#xA;(&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0031320396001422&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.sciencedirect.com/science/article/pii/S0031320396001422&lt;/a&gt;)&#xA;Keywords: The ROC curve; The area under the ROC curve (AUC); Accuracy measures; Cross-validation; Wilcoxon statistic; Standard error&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://espace.library.uq.edu.au/view/UQ:8925&quot; rel=&quot;nofollow noreferrer&quot;&gt;A pre-publication copy of which is available.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2021-10-28T17:08:35.843" LastActivityDate="2021-10-28T17:08:35.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10491" PostTypeId="2" ParentId="10483" CreationDate="2013-08-26T14:19:32.320" Score="3" Body="&lt;p&gt;The $\sigma_I$ determines the scale level at which the Harris corners are computed. Coarser scales (higher values of $\sigma_I$) correspond to larger corners.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\sigma_D$ is effectively the window size, over which the derivatives are summed to generate the entries of the matrix. If $\sigma_D$ is too small, then the detector will be seriously affected by noise.  If it is too large, then small corners may wash out.  In the original non-scale-adapted Harris detector you only have $\sigma_D$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, this is the first time I see the terms &quot;integration scale&quot; and &quot;differentiation scale&quot;, and I am not sure I like them. The &quot;differentiation scale&quot; is actually the Gaussian envelope, over which the derivatives are &lt;em&gt;integrated&lt;/em&gt;. :)&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2017-02-16T15:35:20.893" LastActivityDate="2017-02-16T15:35:20.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10492" PostTypeId="1" CreationDate="2013-08-26T15:33:05.530" Score="6" ViewCount="1217" Body="&lt;p&gt;i'm trying to implement an arbitrary IIR filter design. I'm decomposing all the algorithm into smaller pieces that i can test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently am on the part where it designs a FIR filter from an arbitrary response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab's main function is here : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function h = lslevin (N ,om, D, W)&#xA;% Complex Least Squares FIR filter design using Levinson' s algorithm&#xA;%&#xA;% h filter impulse response&#xA;% N filter length&#xA;% om frequency grid (0 &amp;lt;= om &amp;lt;= pi)&#xA;% D complex desired frequenccy response on the grid om&#xA;% W positive weighting function on the grid om&#xA;om = om(:);&#xA;D = D(:); &#xA;W = W(:); &#xA;L = length(om);&#xA;DR = real(D) ;&#xA;DI = imag(D);&#xA; a = zeros(N,1); &#xA; b = a;&#xA;% Set up vectors for quadratic objective function&#xA;% (avoid building matrices)&#xA;dvec = D;&#xA;evec = ones(L, 1); &#xA;e1 = exp(j*om);&#xA;for i=1:N,&#xA;    a(i) = W.'*real (evec);&#xA;    b(i) = W.'*real (dvec);&#xA;    evec = evec.*e1; &#xA;    dvec = dvec.*e1;&#xA;end&#xA;a=a/L;&#xA;b=b/L;&#xA;% Compute weighted l2 solution&#xA;h = levin(a, b) ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and levin function :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function x = levin(a ,b)&#xA;% function x = levin(a ,b)&#xA;% solves system of complex linear equations toeplitz (a)*x = b&#xA;% using Levinson's algorithm&#xA;% a ... first row of positive definite Hermitian Toeplitz matrix&#xA;% b ... right hand side vector&#xA;%&#xA;% Author: Mathias C. Lang, Vienna University of Technology, AUSTRIA&#xA;% 9-97&#xA;a = a(:);&#xA;b = b(:); &#xA;n = length(a);&#xA;t = 1; &#xA;alpha = a(1); &#xA;x = b(1) / a(1);&#xA;for i = 1:n-1,&#xA;    k = -(a(i+1 :-1: 2)' * t)/alpha;&#xA;    t = [t;0] + k*flipud( [conj(t);0]);&#xA;    alpha = alpha*( 1 - abs(k)^2);&#xA;    k = (b(i+1) - a(i+1:-1: 2)' * x) /alpha;&#xA;    x = [x;0] + k*flipud(conj(t));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;an example function can be done here (it should be a simple bandpass):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;om1=pi*[linspace(0,0.23,230),linspace(0.3,0.5,200),linspace(0.57,1,430)];&#xA;D1=[zeros(1,230), exp(-j*om1(231:430) *2), zeros(1,430)]; % zeros are bandstop others bandpass&#xA;W1=[10* ones(1,230), ones(1,200), 10 *ones(1,430) ];%weight function&#xA;h = lslevin(61,om1, D1, W1) ;&#xA;wavwrite(h, 44100,  'e:\tmp2.wav'); % write the impulse response&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xSDKJ.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when i compute the Impulse Response, i have something like that :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jFI8U.jpg&quot; alt=&quot;&quot;&gt;&#xA;which is far from the original design&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can you help me pinpoint the errors in the code ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks a lot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT1 : here is the final FFT of the IR from the answer given below:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eGjVm.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5292" LastEditorUserId="26573" LastEditDate="2019-01-04T14:24:27.387" LastActivityDate="2019-01-04T14:24:27.387" Title="Complex Least Squares FIR filter design using Levinson' s algorithm" Tags="|matlab|filters|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10493" PostTypeId="1" AcceptedAnswerId="10494" CreationDate="2013-08-26T15:40:04.640" Score="2" ViewCount="185" Body="&lt;p&gt;I'm developping a people tracking with nearest neighbour data association technique and kalman filter for smoothing/predicting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tracker works quite good but sometimes it mismatch objects if they cross them-self.. (I think it is a common problem for a tracker).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really believe that this tracker could be strongly improved with also histogram matching (I'm using OpenCV and I've seen an easy implementation of Bhattacharyya distance that seems quite popular in this field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact is that I'd like to keep an average histogram of the tracked objects (because objects slightly changes their appearance if they rotate for example) and I'm a little bit confused on that: how to continuously adapt the average-histogram-object when new observation arrives?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;observations could be different in size.. how can I handle this situation? using the same bins for each observation (even if they are 10 pixels or 100 pixels?) and sum up the histograms? using a num of bins proportional to the number of pixels?  and what about doing the average of two histograms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I need all histograms with the same num of bins, and maybe use a weighted average where the weight is proportional to the num of pixels, but I'd like to ask for some more accurate advice from you!&lt;/p&gt;&#xA;" OwnerUserId="1063" LastActivityDate="2013-08-26T15:57:03.893" Title="Histogram operation for improving visual object tracking" Tags="|computer-vision|tracking|histogram|visual-tracking|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10494" PostTypeId="2" ParentId="10493" CreationDate="2013-08-26T15:57:03.893" Score="2" Body="&lt;p&gt;I don't think you have any choice other than to use the same number of bins for each observation.  Otherwise not only will you not be able to average the histograms, you will also not be able to compare them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you definitely need to change the histogram slowly, i. e.&#xA;$$h = (1 - \alpha)h + \alpha h_{obs}$$ where $h$ is your &quot;moving average&quot; histogram, $h_{obs}$ is the histogram of the current observation, and $\alpha$ is a small factor, whose value you will have to tune experimentally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as different sizes of observations, the simplest thing to do is to impose a hard constraint saying that the size of the object cannot change too much from frame to frame.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-08-26T15:57:03.893" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10496" PostTypeId="2" ParentId="10492" CreationDate="2013-08-26T18:27:39.747" Score="2" Body="&lt;p&gt;From this term in &lt;code&gt;D1&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;exp(-j*om1(231:430) *2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it looks like you're asking it for a filter with a group delay of &lt;code&gt;2&lt;/code&gt; samples even though the number of taps is &lt;code&gt;61&lt;/code&gt;.  Try setting this to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;exp(-j*om1(231:430) * 61/2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i.e. set a desired group delay of about half the filter length.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-08-26T18:27:39.747" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10497" PostTypeId="2" ParentId="10319" CreationDate="2013-08-26T19:50:49.287" Score="3" Body="&lt;p&gt;As @hotpaw2 &lt;a href=&quot;https://dsp.stackexchange.com/questions/10319/regarding-the-nyquist-criterion#10323&quot;&gt;explains&lt;/a&gt;, the Nyquist criterion has to do with the bandwidth of the signal, not the highest frequency as such. But if you do not know the exact frequency of the sampled signal (e.g. 40Hz) and only know that it is somewhere in a frequency range (e.g. 0-1000Hz), you in principle have to sample above 2000Hz (according to Nyquist) in order to be sure that you sample the signal correctly. The essence of compressed sensing is that you can still sample this signal only knowing the frequency range (the 0-1000Hz), but at a significantly lower sampling rate (perhaps 200Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is generally done by &quot;mixing together&quot; what you would think of as the corresponding Nyquist-rate samples before actually sampling them, forming linear combinations of the Nyquist-rate samples and then only sampling a few of these combinations. Strikingly, the theory even suggests that it is best to do this combination randomly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get back to (reconstruct) a Nyquist-rate representation of the signal, you need to solve a non-linear optimization problem that &quot;disentangles&quot; the mentioned sampled linear combinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the second part of your question: employing compressed sensing in communication systems is still at a fairly immature research level. What we have found in our research at Aalborg University (&lt;a href=&quot;http://vbn.aau.dk/en/persons/thomas-arildsen%28334e2ddc-15ec-4123-82b7-de85132ae371%29/publications.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://vbn.aau.dk/en/persons/thomas-arildsen%28334e2ddc-15ec-4123-82b7-de85132ae371%29/publications.html&lt;/a&gt;) is that it is very hard to implement in a useful way directly on the communication signals, but it is also being investigated, e.g. at the network level or in channel modelling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Regarding @talasila's comment, the classic example of a non-linear optimization problem reconstructing the signal is (9) or (11) in &lt;a href=&quot;http://www-stat.stanford.edu/~candes/papers/spm-robustcs-v05.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www-stat.stanford.edu/~candes/papers/spm-robustcs-v05.pdf&lt;/a&gt; - (the noiseless or noisy case, respectively). In general, the mixing of the samples is just multiplication of a vector of the Nyquist-rate samples by a fat matrix obeying certain properties (see the above paper by Candès and Wakin). As an example of this operation implemented in hardware, see for example &lt;a href=&quot;http://www.ece.rice.edu/~jnl5066/papers/DCAS2006_randmod.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.ece.rice.edu/~jnl5066/papers/DCAS2006_randmod.pdf&lt;/a&gt; (random demodulator).&lt;/p&gt;&#xA;" OwnerUserId="1464" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-08-28T20:15:19.657" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10498" PostTypeId="1" CreationDate="2013-08-26T20:00:08.963" Score="4" ViewCount="262" Body="&lt;p&gt;I am trying to make program in matlab that counts the number of times the accelerometer was lifted up and down (a rep counter for exercise). Basically my phone is getting accelerometer data on all three axes and then i import this data into matlab. I have tried to filter the data using a simple filter &lt;code&gt;a = [1 -0.9]&lt;/code&gt; &lt;code&gt;b=0.1&lt;/code&gt; &lt;code&gt;filter(b,a,data)&lt;/code&gt; but that doesn't really get rid of all the high frequency noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem i am running into is that when i apply certain filters to the data the data gets shifted so i can no longer integrate it to get velocity (my original plan was to simple filter out high frequencies and then integrate the data to get velocity and then count the number of times it crosses zero and divide by two (which would correspond to the number of times it was at a peak and trough - divided by two for number of cycles).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the data is so noisy that when i apply a filter not only does it get shifted away from the x axis making it impossible to integrate it, it also still has noise which would give me incorrect zero-crossings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a good beginner introduction to signal processing and accelerometer data processing? What techniques should i be aware of?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to try to give the data a go here is some sample data, the rep count should be 5, The data was all taken at a 50Hz sample rate. I have to put data in the comments because SE doesnt allow posting multiple links a new poster&lt;/p&gt;&#xA;" OwnerUserId="5320" LastActivityDate="2022-07-13T05:04:20.550" Title="New to DSP and having trouble filtering data" Tags="|matlab|filters|discrete-signals|lowpass-filter|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10499" PostTypeId="2" ParentId="5926" CreationDate="2013-08-27T08:34:54.630" Score="0" Body="&lt;p&gt;Your plan to use eyes (and you could also add mouth) in addition to the face detection seems quite reasonable. I've seen several research papers in face recognition where the faces in the database are first registered so that the triangle eyes + mouth is aligned throughout the whole database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your need, you can obviously validate a face detection if there is at least one visible eye. You can also add some logic to reject face detections when the eyes are very close to the face bounding box for example. &lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-08-27T08:34:54.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10500" PostTypeId="1" AcceptedAnswerId="10507" CreationDate="2013-08-27T10:59:22.753" Score="2" ViewCount="382" Body="&lt;p&gt;I need to create a diagonal matrix containing the Fourier coefficients of the Gaussian wavelet function, but I'm unsure of what to do.&lt;/p&gt;&#xA;&lt;p&gt;Currently, I'm using function &lt;a href=&quot;https://uk.mathworks.com/matlabcentral/fileexchange/33625-haar-wavelet-transformation-matrix-implementation&quot; rel=&quot;nofollow noreferrer&quot;&gt;ConstructHaarWaveletTransformationMatrix&lt;/a&gt; to generate the &lt;a href=&quot;https://en.wikipedia.org/wiki/Haar_wavelet&quot; rel=&quot;nofollow noreferrer&quot;&gt;Haar wavelet&lt;/a&gt; matrix and am taking the rows at dyadic scales (2, 4, 8, and 16) as the transform:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;M = 256&#xA;H = ConstructHaarWaveletTransformationMatrix(M);&#xA;fi = conj(dftmtx(M))/M;&#xA;H = fi*H;&#xA;H = H(4,:);&#xA;H = diag(H);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&lt;p&gt;How do I repeat this for Gaussian wavelets? Is there a built-in &lt;a href=&quot;https://en.wikipedia.org/wiki/MATLAB&quot; rel=&quot;nofollow noreferrer&quot;&gt;MATLAB&lt;/a&gt; function which will do this for me?&lt;/p&gt;&#xA;&lt;p&gt;For reference, I'm implementing the algorithm in section 4 of the paper in &lt;em&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/4218361&quot; rel=&quot;nofollow noreferrer&quot;&gt;Compressed Sensing for Wideband Cognitive Radios&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I need to do edge detection on a 1D signal, which is constructed like so:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;edges = [50, 120, 170, 200, 220, 224, 256];&#xA;levels = [24,3,30,0,36,0,0];&#xA;idxs = zeros(1,max(edges));&#xA;idxs(edges(1:end-1)+1) = 1;&#xA;psd = levels(cumsum(idxs)+1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I just &lt;code&gt;wavdec&lt;/code&gt; and the differentiation matrix:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[y1,y2] = wavedec(psd, 0, 'haar');&#xA;z0 = gamma*y1.';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get exactly what I want.&lt;/p&gt;&#xA;&lt;p&gt;The point, however, is that I want to recreate this edge information compressively (that is, by solving a linear program).&lt;/p&gt;&#xA;&lt;p&gt;The fact that using the matrix above creates gibberish is my current sticking point. I want to replace it with something else and see if it still works.&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="7092" LastEditDate="2022-04-30T11:54:24.673" LastActivityDate="2022-04-30T11:54:24.673" Title="Creating a matrix of Gaussian wavelets at dyadic scales" Tags="|matlab|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10501" PostTypeId="2" ParentId="10498" CreationDate="2013-08-27T11:06:16.640" Score="-1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You should try with implementing your own linear filter. It is not really difficult, and you will have more control about what's going on behind the scene and it will make it easier for you to tune the filter bandwidth.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Speaking of bandwidth, you can try to plot the frequency analysis of your data using Fourier transform, that will help you in finding a suitable cutoff frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A linear filter implements the equations $\sum_{i=1}^n a_i y[i] = \sum_{j=1}^m b_i x[i]$. As long as you normalize the weights $(a_i), (b_i)$ to sum to 1, you should preserve the range of the data.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-08-27T11:06:16.640" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10502" PostTypeId="1" CreationDate="2013-08-27T11:13:07.567" Score="3" ViewCount="113" Body="&lt;p&gt;If I have a 2D scalar image, it's trivial to display it with MATLAB or matplotlib type tools with the pixel values mapped via a color map, and there is any amount of literature (&lt;a href=&quot;http://dx.doi.org/10.1109/MCG.2007.323435&quot; rel=&quot;nofollow&quot;&gt;one example&lt;/a&gt;, &lt;a href=&quot;http://earthobservatory.nasa.gov/blogs/elegantfigures/2013/08/06/subtleties-of-color-part-2-of-6/&quot; rel=&quot;nofollow&quot;&gt;another one&lt;/a&gt;) describing the perils of those tools' default &quot;rainbow&quot; colour-maps and the advantages of various other schemes (color ramps constructed to be more suitable for the significant proportion of the population which is colorblind, for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I have &lt;em&gt;two&lt;/em&gt; 2D scalar images and want to fuse/overlay them in some useful way (rather than just displaying them side by side), it's less clear what the best approach is.  The naive approach of using one channel as red and one channel as green in a combined image kind of works, but is pretty ugly looking.  Mapping one channel to luminance and one to hue in an HSV color space also kind of works, but it becomes impossible to identify the hue of the dimmest pixels (unless luminance is kept quite high, but that destroys contrast). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: is there some recognized and generally considered good/best way of visualizing such fused image pairs?  Or does it all depend on the details of the data and the specifics of the &quot;visualization problem&quot; to be solved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NB I'm not considering the case of visualizing images of vector quantities or complex numbers; this is more about independent but spatially registered scalar image data from different sensors/&quot;modalities&quot; or GIS/mapping systems where the viewer wants to get some insight into spatial correlations between the imaged quantities.&lt;/p&gt;&#xA;" OwnerUserId="1828" LastEditorUserId="1828" LastEditDate="2013-12-30T14:42:19.150" LastActivityDate="2014-01-02T15:06:34.727" Title="What is state of the art in multivariate 2D image display?" Tags="|image-processing|color|visualization|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10503" PostTypeId="1" CreationDate="2013-08-27T11:19:38.590" Score="4" ViewCount="7843" Body="&lt;p&gt;I'm trying to figure out how to convert any phase response to the corresponding group delay response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do that, and vice-versa if possible?&lt;/p&gt;&#xA;" OwnerUserId="5292" LastEditorUserId="76" LastEditDate="2013-10-06T12:49:18.840" LastActivityDate="2017-11-20T12:58:57.263" Title="Converting from a phase response to a group delay response and vice-versa" Tags="|filters|phase|group-delay|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10504" PostTypeId="1" CreationDate="2013-08-27T11:25:56.290" Score="2" ViewCount="2959" Body="&lt;p&gt;could you tell me step by step the algorithm to design an arbitrary phase response IIR allpass filter design ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know &lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/iirgrpdelay.html&quot; rel=&quot;nofollow&quot;&gt;Matlab uses a &quot;brute force&quot; algorithm to find an arbitrary group delay response&lt;/a&gt; but how do they do that?&lt;/p&gt;&#xA;" OwnerUserId="5292" LastEditorUserId="29" LastEditDate="2014-03-15T02:08:13.110" LastActivityDate="2014-03-15T02:08:13.110" Title="Designing an allpass IIR filter with arbitrary phase response" Tags="|filter-design|infinite-impulse-response|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10505" PostTypeId="2" ParentId="10502" CreationDate="2013-08-27T11:26:03.203" Score="1" Body="&lt;p&gt;Image fusion algorithm could assist you here. You can try &lt;a href=&quot;http://www.mathworks.co.uk/help/wavelet/ref/wfusimg.html&quot; rel=&quot;nofollow&quot;&gt;wfusimg in Matlab&lt;/a&gt; for fusion using wavelet coefficients. &lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="1828" LastEditDate="2014-01-02T15:06:34.727" LastActivityDate="2014-01-02T15:06:34.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10506" PostTypeId="1" AcceptedAnswerId="10748" CreationDate="2013-08-27T11:38:29.083" Score="2" ViewCount="4106" Body="&lt;p&gt;Are there any good published approach for designing parametric EQs as FIR filters.  The standard techniques discussed in DSP textbooks are frequency-domain-sampling or using Parks-McClellan, which this involves passband, stopband, transition band, etc.  This is nice for rejecting a certain portion of the frequency spectrum, or mimicking and existing analog/digital filter.  However what if I want to design a filter directly as an FIR filter, for example a peaking/notching/shelving/low-pass/high-pass filter which takes frequency, gain, and bandwidth parameters?  Is there a standard technique for designing parametric EQs directly as FIR filters?&lt;/p&gt;&#xA;" OwnerUserId="5321" LastActivityDate="2013-09-16T22:09:21.613" Title="parametric eq with FIR filters" Tags="|filter-design|finite-impulse-response|parametric-eq|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10507" PostTypeId="2" ParentId="10500" CreationDate="2013-08-27T11:55:14.227" Score="1" Body="&lt;p&gt;In this case the problem was that I was working in the frequency domain, but implementing an algorithm in the time domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've removed the pre-multiplications of the Fourier matrix in the time domain and everything works fine.&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-08-27T11:55:14.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10508" PostTypeId="2" ParentId="10503" CreationDate="2013-08-27T13:27:29.763" Score="7" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Group_delay_and_phase_delay&quot; rel=&quot;nofollow&quot;&gt;group delay&lt;/a&gt; of a filter is defined as minus the change in the phase response with respect to frequency.  If the phase response of a filter is $\Phi(\omega)$, the corresponding group delay $\tau_g$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\tau_g = -\frac{d\Phi(\omega)}{d\omega}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab code, the group delay of a 4th order Butterworth filter can be calculated like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b a] = butter( 4, 0.25 ); % design the filter&#xA;[Hz fVec] = freqz( b, a ); % compute the frequency response and angular frequencies&#xA;phi  = unwrap(angle(Hz)); % extract phase response&#xA;taug = -diff(unwrap(angle(Hz)))/((fVec(2))); % compute group delay&#xA;figure; plot( fVec(2:end), taug );  % plot the result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The phase response must be unwrapped to avoid $\pi$ to $-\pi$ discontinuities.  Because the difference between adjacent frequency bins is the same, we need only scale the -diff(phi) by 1/fVec(2).  Finally, because the diff command produces a vector one less than its input, the group delay values are plotted against fVec(2:end) and not fVec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could use the matlab command grpdelay, though you're likely to learn more from the previous!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure; grpdelay(b,a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4391" LastEditorUserId="4391" LastEditDate="2013-08-29T14:40:35.527" LastActivityDate="2013-08-29T14:40:35.527" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10509" PostTypeId="2" ParentId="10506" CreationDate="2013-08-27T14:50:55.330" Score="-2" Body="&lt;p&gt;Matlab's documentation for filter design should have the references you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/fir2.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fir2&lt;/code&gt;&lt;/a&gt; might do it.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="80" LastEditDate="2013-08-27T15:24:07.443" LastActivityDate="2013-08-27T15:24:07.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10510" PostTypeId="2" ParentId="10506" CreationDate="2013-08-27T17:44:21.440" Score="2" Body="&lt;p&gt;These filter types are well covered here &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow&quot;&gt;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However these are all single biquad IIR implementations. To turn this into an FIR, you could simply calculate the impulse response of these filters and window to a finite size with the desired amount of accuracy. Another option is to design the filter as IIR, sample the frequency response and then do any of the many FIR fitting techniques. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general you will find that FIR filters are not well suited for this and the number of taps required will heavily depend on the relationship between the corner frequency and the sample rate and also on the Q of the filter. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-08-27T17:44:21.440" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10511" PostTypeId="2" ParentId="10504" CreationDate="2013-08-27T17:50:03.903" Score="2" Body="&lt;p&gt;Depends a bit on what exactly you are trying to do. Generally, strict all-pass filters have reciprocal zeros and poles. This will always result in 180 phase shift per filter order so an arbitrary phase response that's strictly allpass cannot be designed. Example: let's say you want something that's in phase at DC,  sits at -90 degrees in the band and then goes slowly back to zero at Nyquist: this can't be implemented using strict all-passes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course you can always approximate but the best method tends to depend on the specifics of your design problems and what types of errors you can tolerate.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-08-27T17:50:03.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10512" PostTypeId="1" AcceptedAnswerId="10518" CreationDate="2013-08-28T00:05:49.387" Score="1" ViewCount="534" Body="&lt;p&gt;I have successfully extracts all Pitch Markers from waveforms, I used autocorrelation to find my pitch periods, The markers can be observed in the figure below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yuj45.png&quot; alt=&quot;https://i.stack.imgur.com/yuj45.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want change my signal (Pitch or Speed) using PSOLA, I need find the synthesized Marks, for example if I choose change my Pitch one octave UP(0.5), for it I need find the new markers to synthesize my signal, you can see in this figure below one example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J1xJx.png&quot; alt=&quot;https://i.stack.imgur.com/J1xJx.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I calculate the new marks to be synthesized (as Synthesized markers)?&lt;/p&gt;&#xA;" OwnerUserId="5325" LastEditorUserId="76" LastEditDate="2013-08-28T20:09:24.677" LastActivityDate="2013-08-28T20:09:24.677" Title="PSOLA how to calculate synthesized Marks" Tags="|speech|speech-synthesis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10513" PostTypeId="1" CreationDate="2013-08-28T03:05:03.127" Score="3" ViewCount="276" Body="&lt;p&gt;First of all thanks for your patience: it is the first time for me posting a question in this forum. I am not a DSP expert, but I should get by if you give me in depth explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example of my raw data &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lqtUx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;a href=&quot;http://www.dropbox.com/s/2uxv4h9bmm3nutm/acc.dat&quot; rel=&quot;nofollow noreferrer&quot;&gt;a link to the actual dataset (time=t0, acceleration=acc)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is the following: I am measuring accelerometer data for an experiment, but I am having a hard time filtering out the raw acceleration data for double integration of velocity and position. The first thing that I do is to remove the dc component of the data via&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#python code&#xA;func = interp1d(t0,acc)&#xA;dt = 10./1000. # [secs]&#xA;ta = np.arange(t0[0],t0[-1],dt)&#xA;a = func(ta)&#xA;n = len(a)&#xA;freq = np.fft.fftfreq(n, d=dt)&#xA;freq[0]=1e-16&#xA;F = np.fft.fft(a) &#xA;F[0]=0&#xA;new_acc = np.real(np.fft.ifft(F))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In particular, I have the physical constraint the integrated velocity should be always positive, or equal to zero where the acceleration is equal to zero. &#xA;However, when I integrate the &lt;code&gt;new_acc&lt;/code&gt;, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = cumtrapz(new_acc)*dt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this is what I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OBEol.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Leaving alone for a minute the position (which is ultimately really what I am interested in)&lt;br&gt;&#xA;&lt;strong&gt;my question is:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;is there any way to design a filter such that the integral of the filtered signal is always &gt;=0 ?&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you believe that the one above is the wrong question to ask: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;what is the best way to integrate (twice) this dataset?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5285" LastEditorUserId="80" LastEditDate="2013-08-28T13:33:30.597" LastActivityDate="2013-08-28T18:37:10.720" Title="Constraint on a filter" Tags="|python|filtering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10514" PostTypeId="2" ParentId="10512" CreationDate="2013-08-28T04:15:46.180" Score="0" Body="&lt;p&gt;Bresenham's algorithm (usually used in 2D graphics) can be used to quantize the relationship between two sets of points increasing at different ratios.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-28T04:15:46.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10515" PostTypeId="1" AcceptedAnswerId="10520" CreationDate="2013-08-28T04:28:21.203" Score="3" ViewCount="4226" Body="&lt;p&gt;I come from Fluid Mechanics domain so pardon me for asking a naive and fundamental question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to perform high pass filtering on a set of positive real numbers (~Energy) using FFT. However, the result I obtain has a lot of negative values. I tried to quantify how many of them are negative and it seems $\sim50\%$ of these values are negative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried looking up for an answer and I saw a general approach used in Image processing domain, where people offset these negative values or use some threshold. But in my case, I can't use either of these techniques because I need to look at some statistical quantities after the filtering process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I want to ask why do these negative numbers appear for a purely positive input and if so, are there any solutions for it? &lt;/p&gt;&#xA;" OwnerUserId="5326" LastActivityDate="2013-08-28T19:48:41.633" Title="Negative values from High Pass filtering" Tags="|filters|highpass-filter|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10516" PostTypeId="2" ParentId="10515" CreationDate="2013-08-28T05:15:22.300" Score="7" Body="&lt;p&gt;A high pass filter will remove a large portion to all of the 0 Hz component or DC offset from a signal.  That's similar to subtracting the mean average, which for a normally distributed signal will make around half of the signal negative (since it was below the original average mean).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the mean to be the same after a high pass filter, you could always add it back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't care about the actual mean value, you could also add an arbitrarily large positive offset to make sure the sum was always positive.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-28T19:48:41.633" LastActivityDate="2013-08-28T19:48:41.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10517" PostTypeId="2" ParentId="10513" CreationDate="2013-08-28T05:39:25.530" Score="2" Body="&lt;p&gt;Beware.  A Gaussian random walk has a non-zero distribution width that increases with time.  Thus the double integral of that random walk will likely very quickly zoom off the edge of your solution space.  A linear filtering of that random walk won't behave any better.  Whether or not mixed with the &quot;real&quot; acceleration signal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-28T18:37:10.720" LastActivityDate="2013-08-28T18:37:10.720" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10518" PostTypeId="2" ParentId="10512" CreationDate="2013-08-28T07:06:10.500" Score="1" Body="&lt;p&gt;Let $t_a(n)$ be the time of the n-th analysis mark (&quot;Pitch marker&quot;), $P_a(n)$ the period at the n-th analysis mark (it can be defined as $t_a(n+1) - t_a(n)$, $t_s(n)$ be the time of the n-th synthesis mark, $n_s(k)$ is a number whose integer part is the index of analysis segment to be overlapped-added when processing the n-th synthesis mark (it can also represent a weighted interpolation between two consecutive analysis marks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The synthesis marks will be defined by the recurrence:&#xA;$$n_s(0) = 0$$&#xA;$$t_s(0) = t_a(0)$$&#xA;$$t_s(k) = t_s(k-1) + \alpha(n) P_a([n_s(k)])$$&#xA;$$n_s(k) = n_s(k-1) + \alpha(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\alpha(n)$ is a stretch factor. It is 0.5 if you want to double the frequency. If you want unvoiced frames to be processed naturally (no stretching for them), you can actually make it dependent on the voiced/unvoiced analysis. In this case: it is 1 if the analysis mark $[n_s(k)]$ is unvoiced, and 0.5 or whatever is your pitch-shift factor when it is voiced.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-08-28T07:06:10.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10519" PostTypeId="2" ParentId="10515" CreationDate="2013-08-28T07:40:20.657" Score="0" Body="&lt;p&gt;You can try to perform a band-pass filter instead, between some value very near to 0 (very large period of the sinusoidal) and your current cutoff frequency.&lt;/p&gt;&#xA;" OwnerUserId="5160" LastActivityDate="2013-08-28T07:40:20.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10520" PostTypeId="2" ParentId="10515" CreationDate="2013-08-28T12:36:43.077" Score="6" Body="&lt;p&gt;A high pass filter has some properties that are similar to taking a derivative.  The derivative of a function that is always positive will be negative wherever the slope is negative.  There's nothing you can do about it.  For example, take the function $f(t) = 400 + \sin \omega t$.  This wiggles around between 399 and 401 (very positive), yet the derivative is $\omega \cos \omega t$.  So the derivative (i.e., high-pass filter), will wiggle between $-\omega$ and $\omega$.  &lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2013-08-28T12:36:43.077" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10522" PostTypeId="1" CreationDate="2013-08-28T20:57:53.177" Score="4" ViewCount="305" Body="&lt;p&gt;I'm quite new to machine learning/data mining and I'm struggling to find the correct path for my problem and would appreciate some guidance or criticism of my proposed solution i.e. is there a better/simpler algorithm for the problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a number of features that describe a particular type (label) of wave (frame of audio) at a predetermined level 'v'. I want to be able to identify the level of an unknown wave and distinguish it from other types of waves that fall under the same higher level category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Assumptions&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A group in a test set should be in increasing order of level v&lt;/li&gt;&#xA;&lt;li&gt;The type of wave in the group should be the same and known&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proposed Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Stage one: Level Selection&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For a given type of wave compute the features at each level for N number of samples&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each level calculate the mean/median of each feature the N samples to create a feature vector for each level.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Normalise the feature set by subtracting the empirical mean and dividing by the variance.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take the Euclidean/Manhattan distance of an incoming vector with the feature set and choose the closest level.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For a group with assigned levels, compare levels with neighbours and report negative differences (should be ascending)  or large differences.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Stage two: type selection&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take the Euclidean/Manhattan distance of an incoming vector with the&#xA;feature set for each type at a specific level or maybe across all levels choose closest type.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Extension of Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Features evolve over time as well as level&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proposed Solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Repeat the stages of the above solution for each frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*&lt;strong&gt;&lt;em&gt;Update&lt;/em&gt;&lt;/strong&gt;&#xA;I cannot guarantee that the levels v are equivalent across the data I can only guarantee that the order is increasing. i.e. Sample A may have 5 levels v= 1,..,5 and they correspond to {1,..,5} and sample B has 10 samples v = 1,2,..10  and they correspond to {.5,1,1.5,...,10}. How can I capture this without knowing the relationship between levels and identify those which do not follow this pattern. Pleas let me know if this is not clear&lt;/p&gt;&#xA;" OwnerUserId="3296" LastEditorUserId="3296" LastEditDate="2013-08-29T11:58:50.323" LastActivityDate="2022-08-15T00:07:25.803" Title="Guidance/Brainstorming for a mapping/classification problem" Tags="|classification|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10523" PostTypeId="1" CreationDate="2013-08-28T20:58:09.933" Score="0" ViewCount="8682" Body="&lt;p&gt;First of all I'm new to DSP so excuse my simplified words &amp;amp; I'm sorry if it's a duplicated question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I'm trying to filter a signal but as you all know, the filter step response overshoot the filtered signal at the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it's the signal. It begins with zeros then the signal comes up&#xA;&lt;img src=&quot;https://i.stack.imgur.com/bYzXS.png&quot; alt=&quot;the signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there any accurate solution to remove this overshoot completely?&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kNGT0.png&quot; alt=&quot;the question&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;** And if there is references or any direct command in Matlab, I would be grateful to know it.**&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thanks in advance..&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4894" LastActivityDate="2013-08-29T21:27:16.100" Title="Removing the overshoot in step response" Tags="|filters|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10524" PostTypeId="2" ParentId="10358" CreationDate="2013-08-28T22:14:32.803" Score="3" Body="&lt;p&gt;I will describe my current approach, which is an combination of exploiting game rules, image processing and feature detection.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Relevant game rules&lt;/h1&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;location tiles, castles and mountains can not be taken by game token (houses)&lt;/li&gt;&#xA;&lt;li&gt;in 7 out of 8 cases water can also not be taken&lt;/li&gt;&#xA;&lt;li&gt;there are 8 different (unique) kinds of sections, plus 8 through rotation by 180 degrees (see &lt;a href=&quot;http://sodaklady.files.wordpress.com/2012/01/p1010414.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;picture of possible sections&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://4p.hrejsi.cz/index.php/download_file/view/31/109/&quot; rel=&quot;nofollow noreferrer&quot;&gt;complete game rules can be found here&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h1&gt;Realisation&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;At first I use Hough transform to extract position of game board. Source image looks similar to final image in question, but with thicker lines and I filtered the smaller boundaries. I use only detect very long lines (order of magnitude: about 60 percent of image width/height) and very small threshold for line matching. I also just look at lines at the outer 40 percent of image and take the median of detected lines at top, bottom, left and right. Result is shown in image below:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Wn1kU.jpg&quot; alt=&quot;Hough transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only need a rough approximation, so this is just fine. From now on I only examine image inside the Houghlines, plus some extra space due to uncertainty of Hough transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I use feature detection, as proposed by Stefan K. in his answer, to detect the features in image, that can not be taken by the players, i.e. castles, location tiles and mountains. I use the ORB algorithm in opencv-python to do that and BruteForce-Hamming-Matcher (I was not yet able to get FlannBased matcher running). ORB is scale and rotation invariant. In order to detect multiple occurrences of same features (e.g. castles) I split image in parts, that overlap. This works fine as long image resolution is big enough and picture is taken directly from top (still needs some tests). It is also kind of slow. Detection of location tile (tavern) is shown as an example in image below&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nfpLl.jpg&quot; alt=&quot;castle feature detection&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I try to find the homographyTransform to extract exact position and orientation of detected features. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope to be able to reconstruct the grid out of this information (position of mountains, castle, location tiles and in most cases water). Currents experiments look promising, though a lot of fine tuning and proper preparation of feature images has to be done. &lt;/p&gt;&#xA;" OwnerUserId="5089" LastActivityDate="2013-08-28T22:14:32.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10525" PostTypeId="2" ParentId="10523" CreationDate="2013-08-28T22:17:53.617" Score="4" Body="&lt;p&gt;You said you were new to DSP, but in reality, anyone new to filtering (analog or digital) has the same problem. In other words, we all learn about filtering in the frequency domain but pay little attention to what is taught about the effects of filtering in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem you are showing, excessive overshoot and ringing, is most easily solved by choosing a diffrent type of filter. You don't say say what type of filter you are using, but it most certainly has a very sharp transition band, and a flat pass band, or a ripple in the pass band, which allows for a sharper transition band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An extreme example of just the oppisite of your filter is the Gaussian response, which has roll off in the pass band and a wide transition band. Its time domain response will have no overshoot or ringing, but also has &quot;poor&quot; attenuation characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution then, is to design a filter that gives as much filtering as needed, but doesn't cause any more overshoot and ringing than your application can tolerate. You need to learn that with filters, you can have sharp filters, or you can have minimal distortion (overshoot and ringing), but not both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not a MatLab user, so I can't suggest a specific MatLab function to use. Might I suggest some free FIR and IIR software that will clearly and easily demonstrate what I have said here. Both the FIR and IIR programs allow you to adjust the filter's response in the freqency domain, and quickly see the effects in the time domain. In the IIR program, experiment with the Gauss and Elliptic responses as extreme oppisites of one another. The programs are available at  &lt;a href=&quot;http://www.iowahills.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you need to pay attention to the filter's group delay. For 2 filters with essentially the same magnitude response, the filter with the more linear phase (flatter group delay) will cause less distortion.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastEditorUserId="5108" LastEditDate="2013-08-29T01:00:23.520" LastActivityDate="2013-08-29T01:00:23.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10526" PostTypeId="1" CreationDate="2013-08-28T22:37:07.310" Score="1" ViewCount="3848" Body="&lt;p&gt;Let $x[n]$ and $y[n]$ be two orthogonal baseband signals, with bandwidth B. Check if the following signals are orthogonal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u[n] = x[n]*\cos(2*\pi*f_c*n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v[n] = y[n]*\cos(2*\pi*f_c*n)$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what the problem asks to be honest. &#xA;1) What exactly does he mean by bandwidth?? I only know the definition of a bandwidth of a sinc function, but how can I think of it generally?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I assumed the case for a rectangular function and reduced the problem to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{n=-\frac{1}{B}}^{n=\frac{1}{B}}\frac{1}{2}\cdot x[n]\cdot y[n]\cdot \cos(4\cdot \pi\cdot f_c\cdot n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't know where to go from there. It's also weird for me to evaluate since $\frac{1}{B}$ is likely not an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: also, $f_c$ &gt;&gt; B&lt;/p&gt;&#xA;" OwnerUserId="5330" LastEditorUserId="80" LastEditDate="2013-08-29T01:40:58.797" LastActivityDate="2014-02-17T21:48:23.547" Title="Checking if u[n] and v[n] are orthogonal" Tags="|signal-analysis|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10527" PostTypeId="1" AcceptedAnswerId="10552" CreationDate="2013-08-29T02:23:07.577" Score="1" ViewCount="710" Body="&lt;p&gt;Suppose we have filter $h[n]$, length $N$. If I use it to do convolution in the time domain, then there will be $N$ multiplications each time during the sliding. (Ignore border conditions for now). However if say $h[n]$ had zeros every other sample, then there would be &lt;em&gt;half&lt;/em&gt; that number of multiplications, so ostensibly I save in computational load, since I have half the number of multiplies to do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then in conclusion the speed of convolution in the time domain is related to the number of zeros. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose I did this convolution via the multiplication in the frequency domain using the FFT instead. It seems that I would undo any gains I could have had, zeros or no zeros, because when we do it via the FFT method, it is agnostic to the actual values of the samples of the signal and filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a correct assessment? If so, might there then be cases where a good old fashioned convolution in the time domain is in fact &lt;em&gt;much faster&lt;/em&gt; than an FFT?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2013-08-31T19:43:24.360" Title="Does convolution done via the FFT _undo_ computational gains when signal has zeros every other sample?" Tags="|fft|filters|frequency-spectrum|dft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10529" PostTypeId="1" CreationDate="2013-08-29T03:41:30.763" Score="0" ViewCount="4893" Body="&lt;p&gt;My signal oscillates back and forth on the interval [-1, 1] at varying frequencies, with some added higher frequency noise components (example data shown below). I want to to estimate the phase of the slow oscillation at any given time. This means I would like to filter out some of the high frequency noise, and then calculate the phase at each time for the smoothed signal. However, my method isn't working so I'd really appreciate any ideas about how to do this properly!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've attempted to do this with the Short Time Fourier Transform (FTST). The method I've tried is to calculate the Fourier transform for a sliding window across my signal, choose the frequency component with the highest magnitude, and then use the phase from that component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm having trouble getting the result to match up with the slowly oscillating component that I can see in the signal. I've tried two methods and neither looks good: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;using just the phase shift from the complex value of the fourier transform computed using Matlab's spectrogram() function&lt;/li&gt;&#xA;&lt;li&gt;using the total phase based on the time and frequency return variables from the STFT plus the phase shift&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Am I missing something? I'm new to signal processing, so it might be a conceptual misunderstanding or just an error in my implementation. I would really appreciate any help or suggestions! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nSEnz.png&quot; alt=&quot;example of my data and my failed attempt to extract phase from the low frequency oscillations&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Matlab code I'm using to generate the figure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% define STFT options&#xA;window = 50;&#xA;num_overlap = window - 1; % because we need phase at every position&#xA;signal_length = length(signal);&#xA;&#xA;% pad signal with zeros on both sides&#xA;pad_left = floor(num_overlap/2);&#xA;pad_right = num_overlap - pad_left;&#xA;padded_signal = [zeros(1,pad_left) signal zeros(1,pad_right)];&#xA;&#xA;% calculate STFT&#xA;[S,F,T] = spectrogram(padded_signal,window,num_overlap);&#xA;component_magnitude = abs(S); &#xA;[m max_index] = max(component_magnitude); % get the frequency with maximal amplitude&#xA;&#xA;% calculate the phase when the frequency components are maximized&#xA;for ti = 1:size(S,2)&#xA;   phase_shift(ti) = phase(S(max_index(ti), ti));&#xA;   signal_phase_total(ti) =  T(max_index(ti))*F(max_index(ti))+phase_shift(ti);&#xA;end  &#xA;&#xA;num_plots = 5;&#xA;% plot the initial signal&#xA;subplot(num_plots,1,1)&#xA;plot(signal, 'LineWidth', 2);&#xA;title('signal', 'FontSize', 18)&#xA;axis tight&#xA;&#xA;% plot the STFT&#xA;subplot(num_plots,1,2)&#xA;imagesc(component_magnitude); &#xA;hold on&#xA;plot(1:length(max_index), max_index, 'y', 'LineWidth', 2) &#xA;hold off&#xA;colormap(bone); &#xA;title('STFT magnitudes with max component in yellow', 'FontSize', 18)&#xA;&#xA;% plot the phase info&#xA;subplot(num_plots,1,3)&#xA;plot(phase_shift, 'k');&#xA;title('phase shift of maximal component', 'FontSize', 18)&#xA;axis tight&#xA;&#xA;% try to superimpose the phase shift onto original signal&#xA;subplot(num_plots,1,4)           &#xA;hs = plot(signal, 'LineWidth', 2);&#xA;hold on&#xA;% plot the phase of the max component&#xA;hp = plot(real(cos(phase_shift)), 'r');&#xA;lh = legend([hs hp], 'Signal', 'Phase');&#xA;set(lh, 'FontSize', 12);&#xA;axis tight&#xA;hold off&#xA;title('phase shift of max component superimposed onto signal', 'FontSize', 18)        &#xA;&#xA;% try to superimpose the total phase onto original signal&#xA;subplot(num_plots,1,5)           &#xA;hs = plot(signal, 'LineWidth', 2);&#xA;hold on&#xA;% plot the total phase&#xA;hp = plot(real(cos(signal_phase_total)), 'r');&#xA;lh = legend([hs hp], 'Signal', 'Phase');&#xA;set(lh, 'FontSize', 12);&#xA;axis tight&#xA;hold off&#xA;title('total phase superimposed onto signal', 'FontSize', 18)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5329" LastEditorUserId="5329" LastEditDate="2013-08-29T05:23:09.167" LastActivityDate="2022-07-13T13:04:20.643" Title="Estimate phase using STFT in Matlab?" Tags="|matlab|fourier-transform|phase|stft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10530" PostTypeId="2" ParentId="10527" CreationDate="2013-08-29T04:46:30.440" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Is this a correct assessment? If so, might there then be cases where a good old fashioned convolution in the time domain is in fact much&#xA;  faster than an FFT?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You're right. Convolution in the time domain with small N is always faster than FFT convolution. I researched this issue for Intel IPP library. I run calculation of convolution in 3 mode:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;auto&lt;/strong&gt; - select the optimal algorithm automatically.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;direct&lt;/strong&gt; - use direct algorithm&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;FFT&lt;/strong&gt; - use FFT-based algorithm implementation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In “auto” mode IPP uses a convolution in the time domain for small N and a FFT convolution for large N. In table below: N - size of filter, M - size of data array. Data type was float32. Processor - Intel i5-2500.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+------+------+------+--------+------+  &#xA;|   M  |   N  |         time         |   &#xA;|      |      | auto | direct |  FFT |  &#xA;|------+------+------+--------+------|  &#xA;| 1024 |  15  |  6.2 |   6.2  |  8.4 |  &#xA;| 1024 |  65  |  9.9 |  10.2  | 10.2 |  &#xA;| 1024 | 319  | 24.5 |  28.8  | 25.1 |  &#xA;| 8192 |  15  | 48.4 |  48.1  | 62.0 |  &#xA;| 8192 |  65  | 60.5 |  77.8  | 60.8 |  &#xA;| 8192 | 319  | 82.2 | 257.   | 82.8 |  &#xA;+------+------+------+--------+------+  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So if N is small then use calculation in time domain. You can get an extra boost if your filter has some additional properties which you can use in time domain (symmetry, a lot of zeros, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote the experimental data above. There is a simple and well known theoretical explanation. The number of operations for time-domain convolution is O (M * N). A number of operations for FFT convolution is O ((M + N) * log (M + N)). It is easy to check that the FFT convolution better only for sufficiently large M, N. For IPP library, this boundary is located in the N ~ 50 for M=1024&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add timing for time-domain convolution&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2013-08-30T03:01:32.960" LastActivityDate="2013-08-30T03:01:32.960" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10531" PostTypeId="1" AcceptedAnswerId="17833" CreationDate="2013-08-29T05:12:05.877" Score="1" ViewCount="2900" Body="&lt;p&gt;I am trying to write a connected component labelling program, I have done the first part to create a label based on the neighbours. For simplicity I am using a 4-connectivity. I am using &lt;code&gt;ANSI C&lt;/code&gt; and to create the equivalence table I am using two linked lists with structures defined like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;struct T2_node&#xA;{&#xA;    size_t value;    &#xA;    struct T2_node *next;&#xA;};&#xA;&#xA;struct T1_node&#xA;{&#xA;     struct T2_node *T2;    &#xA;     struct T1_node *next;&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Every newly found object has a T1_node which links to a T2_node linked list that keeps the labels of the objects that particular label is connected to. As an example you can see this thresholded image (very noisy!) I am trying to find the connected components of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rr5Ex.png&quot; alt=&quot;threshold image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A section of the equivalence table for this image is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;label id: connected labels (including its self).&#xA;&#xA;835: 847, 835, &#xA;834: 846, 834, &#xA;833: 820, 833, &#xA;832: 812, 832, &#xA;831: 831, &#xA;830: 830, &#xA;829: 818, 829, &#xA;828: 828, &#xA;827: 929, 778, 840, 783, 827, &#xA;826: 826, &#xA;825: 825, &#xA;824: 993, 944, 904, 916, 839, 824, &#xA;823: 823, &#xA;822: 957, 794, 837, 822, &#xA;821: 956, 912, 888, 848, 821, &#xA;820: 1021, 997, 915, 924, 887, 812, 833, 820, &#xA;819: 819, &#xA;818: 829, 818, &#xA;817: 817, &#xA;816: 816, &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A grey scale image of the labels of the same image can be seen below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lgfzi.png&quot; alt=&quot;labels&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you see, the labelled regions within a connected component do not all touch! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My final question is: What algorithm should I use to effectively merge the labels? In other words, how can I find which labels belong to one connected object? I am a graduate student in Astronomy, so I do not know the details of graph theory and set theory or how to implement them in a computer program, take &lt;code&gt;C&lt;/code&gt; for example! (although I am interested to learn). So if there is a specific method to do this, please also introduce a reference I can learn that method from, thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5290" LastEditorUserId="128" LastEditDate="2020-04-03T07:01:58.507" LastActivityDate="2020-04-03T07:01:58.507" Title="Connected Component Labeling - Equivalence Table" Tags="|image-processing|image-segmentation|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10532" PostTypeId="2" ParentId="10529" CreationDate="2013-08-29T05:33:06.133" Score="-1" Body="&lt;p&gt;Jumping between bins of STFTs will lead to the discontinuities seen in your phase estimates.  Interpolating both frequency and phase from a sequence of STFTs is possible, but requires non-standard techniques, such as fftshifts and 2D interpolators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the frequency range of your desired slow oscillation, then a bandpass filter in conjunction with a PLL follower might provide a better looking phase result using more standard DSP techniques.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-08-29T05:33:06.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10533" PostTypeId="2" ParentId="10502" CreationDate="2013-08-29T07:38:55.770" Score="1" Body="&lt;p&gt;If &quot;kind of works&quot; but slightly less ugly is acceptable, than any two not-too-near-to-co-linear RGB color space vectors will do, and you or the user can just play with them to get a preferred combination of differentiation and non-ugliness (say, from a suitable artistic palate coordinated with other artwork color schemes in or around the data presentation, etc.) for the particular data sets.  Perhaps let the user choose one color vector, and auto rotate the other color vector to some roughly orthogonal point in the color space if it's too close to co-linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you invert the data vector (or use a subtractive color vector) and thus fade to white, the lighter pastel version of some color vectors may blend better, but this depends on the mean and distribution of the data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-29T07:51:21.490" LastActivityDate="2013-08-29T07:51:21.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10535" PostTypeId="2" ParentId="10522" CreationDate="2013-08-29T09:12:02.007" Score="0" Body="&lt;ul&gt;&#xA;&lt;li&gt;You need to be certain that your feature vector is capturing the properties you are looking for. Using the mean and median for &lt;a href=&quot;http://en.wikipedia.org/wiki/Dimensionality_reduction&quot; rel=&quot;nofollow&quot;&gt;dimension reduction&lt;/a&gt; (i.e. extracting the features) is not a good choice unless your problem is really simple. Better choices are: PCA, ICA, and SVM's. Capturing the features in the frequency domain can also be a great tool if your signal is sparse in the FFT or DCT domain.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-08-29T09:12:02.007" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10536" PostTypeId="1" CreationDate="2013-08-29T10:48:13.917" Score="8" ViewCount="10968" Body="&lt;p&gt;I am trying to implement audio dynamic range compression in JavaScript (not using web audio API).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a lot of articles for sound technicians, and some high level documentation, but I couldn't find any helpful reference for actually implementing digital dynamic range compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand, there is at least 3 steps in calculating the rectified signal.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;computing the input level&lt;/li&gt;&#xA;&lt;li&gt;computing the gain to apply to the signal&lt;/li&gt;&#xA;&lt;li&gt;applying the gain&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I process the audio in blocks, so for 1) I was thinking of computing the RMS of one block&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers to a good reference? Or anybody willing to explain me a bit the steps required to implement this?&lt;/p&gt;&#xA;" OwnerUserId="1169" LastEditorUserId="29" LastEditDate="2016-01-30T03:39:59.163" LastActivityDate="2016-01-30T03:39:59.163" Title="Help implementing audio dynamic range compression" Tags="|audio|dynamic-range-compression|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10537" PostTypeId="1" AcceptedAnswerId="10540" CreationDate="2013-08-29T11:09:53.770" Score="2" ViewCount="5344" Body="&lt;p&gt;I'm new to this multiple view geometry issues and I'm a little bit lost, and some concept are not clear at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a calibrated camera ( = I have distortion coefficents, field of view, and with those I can find what is called &lt;strong&gt;intrinsic&lt;/strong&gt; matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this camera I'd like to make an application that can estimate the ground plane from a picture. I have those constrains:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the picture there is no chessboard (or other kind of known pattern used in computer vision for calibrating cameras)&lt;/li&gt;&#xA;&lt;li&gt;I can manually define some coplanar points (like points that I know are the projection of a square) or some &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I need something that take the 2D coordinate of a trapezoid in the picture, knowing that in the real world it is a unit-square on the ground plane in the 3D real world coordinates and give me the transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I have understand this is procedure is &quot;computation of extrinsic parameter given given intrinsic parameters, a few 3D points, and their projections&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible?&lt;/li&gt;&#xA;&lt;li&gt;Are 4 points enough?&lt;/li&gt;&#xA;&lt;li&gt;This is not related with homography, right? (because homography is not related with 3d points but only with 2d).. but how can homography help me? (I can find the homography that transform the trapezoid in a square)&lt;/li&gt;&#xA;&lt;li&gt;Is there an alternative way to do it (like with triangles and normals)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For the sake of curiosity I'm using openCV for the implementation.&lt;/p&gt;&#xA;" OwnerUserId="1063" LastActivityDate="2014-02-25T14:30:43.793" Title="Ground plane estimation from a single image (was: confusion about homography and calibration camera parameters)" Tags="|computer-vision|transform|camera-pose|homography|geometry|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10538" PostTypeId="2" ParentId="10536" CreationDate="2013-08-29T14:01:07.323" Score="2" Body="&lt;p&gt;For a simple start I would use a non-linear characteristic $g(x)$ that compresses your input signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y = g\left(x\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where (as pointed out by endolith in the comments) $x$ is the &lt;em&gt;envelope&lt;/em&gt; of the input audio signal and $y$ is the output envelope that is applied to the actual audio signal. $g(x)$ can be any function that attenuates large input values stronger than small input values. The &lt;a href=&quot;https://en.wikipedia.org/wiki/A-law&quot; rel=&quot;nofollow&quot;&gt;A-Law&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/%CE%9C-law_algorithm&quot; rel=&quot;nofollow&quot;&gt;$\mu$-Law&lt;/a&gt; functions have been developed to compress speech signals for telephony, for example. I don't know how good this sounds for music, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another, very simple compression function would be to attenuate all amplitudes above a certain threshold $\delta$:&#xA;$$&#xA;g(x) = \begin{cases}&#xA;x &amp;amp; \text{for} &amp;amp; x \leq \delta \\&#xA;ax + (1-a)\delta &amp;amp; \text{for} &amp;amp; x &amp;gt; \delta&#xA;\end{cases}&#xA;$$&#xA;where $a &amp;lt; 1$ is attenuation. But this won't work very well as our sense of hearing is logarithmic so that the attenuation might be much too strong. This is why audio compressors work on a logarithmic scale and it leads to the same function as above, but all values taken logarithmic and with respect to the maximum possible value. For $x &amp;gt; 0$:&#xA;$$&#xA;\log(g(x)) = \begin{cases}&#xA;\log(x) &amp;amp; \text{for} &amp;amp; x \leq \delta \\&#xA;\frac{1}{r}\log(x) + \left(1-\frac{1}{r}\right)\log(\delta) &amp;amp; \text{for} &amp;amp; x &amp;gt; \delta&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For audio compressors, $\delta$ is usually given in dB and $r$ is expressed as some ratio, e.g. 3:1 (i.e. $r=3$). This yields an exponential function, when linearly expressed (hope it's correct, please check it, also $x&amp;gt;0$):&#xA;$$&#xA;g(x) = \begin{cases}&#xA;x &amp;amp; \text{for} &amp;amp; x \leq \delta \\&#xA;\delta^{1 - 1/r}x^{1/r} &amp;amp; \text{for} &amp;amp; x &amp;gt; \delta&#xA;\end{cases}&#xA;$$&#xA;This function has a &quot;hard knee&quot;, meaning that the function $\log g(x)$ is not differentiable at $x = \delta$. For a &quot;soft knee&quot; you would need some smooth transition at that point. The extension of the above functions for negative $x$ is straightforward, just multiply with the signum function and take the absolute value of $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attack and release have an impact on different sounds like kicks, snares and vocal. They determine how long before the threshold is reached the compressor should start working and how long it should still be working after the signal has fallen below the threshold. To implement this you will have to use some sort of look-ahead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As all amplitudes below $\delta$ are attenuated, the available dynamic range ist not fully exploited. This is corrected for by the so-called &quot;make up gain&quot; which is just a simple multiplication of the compressed signal with a gain factor $G&amp;gt;1$. By first reducing the dynamic range and then amplifiying the signal compressors can make music appear &quot;louder&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2013-09-01T11:45:55.680" LastActivityDate="2013-09-01T11:45:55.680" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10539" PostTypeId="2" ParentId="10536" CreationDate="2013-08-29T14:12:29.383" Score="4" Body="&lt;p&gt;Here are some suggestions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There are plenty of opensource implementations (Sox, Audacity, etc). Even if you don't understand them, you might be able to translate the code from C to javascript.&lt;/li&gt;&#xA;&lt;li&gt;I'm not aware of a good explanation of the process online, but there are plenty of books on the subject:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470680024&quot; rel=&quot;nofollow&quot;&gt;Digital audio signal processing&lt;/a&gt; covers this topic and is well written. (As does &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/B005HF2HFE&quot; rel=&quot;nofollow&quot;&gt;DAFX&lt;/a&gt;, but DAFX is poorly organized and the coverage is less straightforward)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0130876763&quot; rel=&quot;nofollow&quot;&gt;Digital Audio with Java&lt;/a&gt; also covers this topic and comes with working Java code that should be easy to translate to other languages, such as javascript. This book has many many flaws, but it is good for someone with no audio programming experience.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The principle is to create an envelope of the signal (controlled by attack and release), shape that envelope using using some transfer function (controlled by ratio, threshold and knee), and then apply that result back to the original signal. A makeup gain stage often follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Deve's answer suggests some possible transfer functions.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2013-08-29T14:12:29.383" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10540" PostTypeId="2" ParentId="10537" CreationDate="2013-08-29T14:39:21.867" Score="2" Body="&lt;p&gt;Yes it is possible to compute the extrinsics given the intrisics, some points in 3D and their projections in the image.  If all your 3D points are in the same plane, then the math for computing the extrinsics is explained in the &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/zhang/Papers/TR98-71.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; by Zhengyou Zhang, which is the basis for the camera calibration code in OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your 3D points are not co-planar, then you need to use a different algorithm that is described in Hartley and Zisserman.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-08-29T14:39:21.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10541" PostTypeId="1" AcceptedAnswerId="10543" CreationDate="2013-08-29T14:57:18.897" Score="18" ViewCount="18843" Body="&lt;p&gt;In many of my readings, whenever some author speaks about working in the frequency (transform) domain (of a digital signal), they often times take the DFT, or the DTFT, (and of course their corresponding inverses). Different authors will tend to work with one or the other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not been able to really ascertain a particular pattern regarding this. In that, why would you pick the DTFT over the DFT or vice versa in explaining algorithms? Where does one help you over the other? &lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2014-03-31T14:19:14.203" Title="When to use the DTFT vs the DFT (and their inverses) in analysis?" Tags="|fft|fourier-transform|dft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10542" PostTypeId="2" ParentId="10522" CreationDate="2013-08-29T16:02:04.360" Score="1" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;To link feature vectors with levels 'v', you can use GP's.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assuming the 'v' levels are determined by the feature vectors, I can't see why you need to model each group separately... Adding the location of the frame within the audio segment should also not be necessary.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the GP model fails then one can try adding an element to the feature vector describing the location of the audio frame in the group.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Good luck.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-08-29T16:34:18.617" LastActivityDate="2013-08-29T16:34:18.617" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="10543" PostTypeId="2" ParentId="10541" CreationDate="2013-08-29T16:16:54.563" Score="21" Body="&lt;p&gt;DFT and DTFT are obviously similar as they both generate the fourier spectrum of time-discrete signals. However, while the DTFT is defined to process an infinitely long signal (sum from -infinity to infinity), the DFT is defined to process a periodic signal (the periodic part being of finite length).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that the number of frequency bins in your spectrum is always equal to the number of samples processed, so this also gives a difference in the spectrums they produce: the DFT spectrum is discrete while the DTFT spectrum is continuous (but both are periodic with respect to the Nyquist frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is impossible to process an infinite number of samples the DTFT is of less importance for actual computational processing; it mainly exists for analytical purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT however, with its finite input vector length, is perfectly suitable for processing. The fact that the input signal is supposed to be an excerpt of a periodic signal however is disregarded most of the time: When you transform a DFT-spectrum back to the time-domain you will get the same signal of wich you calculated the spectrum in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So while it does not matter for the computations you should note that what you are seeing there &lt;strong&gt;is not the actual spectrum of your signal&lt;/strong&gt;. It is the spectrum of a theoretical signal that you would get if you periodically repeated the input vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would assume in the literature you were mentioning, every time it is important that the spectrum you're working with is actually the spectrum and disregarding the computation side of things, the author would pick the DTFT.&lt;/p&gt;&#xA;" OwnerUserId="4063" LastEditorUserId="4063" LastEditDate="2013-08-29T16:45:45.003" LastActivityDate="2013-08-29T16:45:45.003" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10544" PostTypeId="1" AcceptedAnswerId="10556" CreationDate="2013-08-29T16:54:16.800" Score="0" ViewCount="4906" Body="&lt;p&gt;I have been studying about exponential average.  There are enough explanations about this at Internet, but they do not explain about the time constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have one channel with a $T$ seconds time signal with sampling frequency $f_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to do average of this time signal, we need to use either linear or exponential method.  Linear average method is quite simple so there is no trouble for applying.  However, if I try to apply exponential average method, there are some problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If time signal varies quickly, we prefer to use fast time constant 125 ms.  Also, the time signal varies slowly, using 1000 ms of slow time constant is better, but in this situation, I do not know how can I apply this time constant with time signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any explanation or any example for doing exponential average with time constant?&lt;/p&gt;&#xA;" OwnerUserId="4639" LastEditorUserId="80" LastEditDate="2013-08-30T12:35:44.633" LastActivityDate="2013-08-30T18:23:16.763" Title="Exponential average with time constant of slow, fast and impulse" Tags="|convolution|moving-average|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10546" PostTypeId="2" ParentId="10139" CreationDate="2013-08-29T21:02:23.033" Score="2" Body="&lt;p&gt;There are several measures that &lt;a href=&quot;http://en.wikipedia.org/wiki/Fredric_J._Harris&quot; rel=&quot;nofollow noreferrer&quot;&gt;fred harris&lt;/a&gt; used in his 1978 paper &lt;a href=&quot;http://www.cs.cmu.edu/afs/cs/user/bhiksha/WWW/courses/dsp/spring2013/WWW/schedule/readings/windows_comparison2_harris.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Use of Windows for Harmonic Analysis&lt;/em&gt;.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Highest Sidelobe Level (dB)&lt;/li&gt;&#xA;&lt;li&gt;Sidelobe falloff (dB/octave)&lt;/li&gt;&#xA;&lt;li&gt;Coherent Gain (unitless)&lt;/li&gt;&#xA;&lt;li&gt;Equivalent Noise Bandwidth (bins)&lt;/li&gt;&#xA;&lt;li&gt;3.0 dB Bandwidth (bins)&lt;/li&gt;&#xA;&lt;li&gt;Scallop Loss (dB)&lt;/li&gt;&#xA;&lt;li&gt;Worst Case Process Loss (dB)&lt;/li&gt;&#xA;&lt;li&gt;6.0 db Bandwidth (bins)&lt;/li&gt;&#xA;&lt;li&gt;Overlap correlation (%)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A screenshot of Table 1, comparing several different windows on these measures is below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lfz9i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="23139" LastEditDate="2018-05-09T04:16:47.153" LastActivityDate="2018-05-09T04:16:47.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10547" PostTypeId="1" AcceptedAnswerId="10559" CreationDate="2013-08-29T21:19:25.363" Score="2" ViewCount="86" Body="&lt;p&gt;I have been doing some research into modelling acoustic spaces, and (with help from this site) I've managed to take the frequency response of fibrous layer model, convert it to a reflection response as a target for an IIR, and then find the polynomial coefficients for it using FDLS.  All good so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I performed the usual BIBO stability test of finding the magnitude of the IIR denominator roots, and with a 4th order filter everything was fine (&amp;lt;=1.0).  But increasing the order, even by just one, then it became unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: What does the order actually represent response-wise?  I always assumed it determined the sharpest change in direction of the frequency response i.e. the 'jagged-ness' or complexity of the response curve.  If that's true, then my filter is unstable, but the few poles I've calculated just happen to be inside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is that true?&lt;/p&gt;&#xA;" OwnerUserId="5213" LastActivityDate="2013-08-30T18:29:55.977" Title="Stability varying with order" Tags="|infinite-impulse-response|frequency-response|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10548" PostTypeId="2" ParentId="10523" CreationDate="2013-08-29T21:27:16.100" Score="1" Body="&lt;p&gt;There are a couple of subtle issues here.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first one is: what are you trying to achieve?  The first image above (unfiltered signal) already has &quot;overshoot&quot;.  Are you trying to remove the oscillations about $1$ after about $t=0.13$ ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second one is: the filter you appear to have used has a very large delay, which means the rise in value has moved from $t=0.13$ to $t=0.37$ or so.  That suggests that you've used a very long filter (for the size of data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest using a shorter (lower order) filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some scilab code that tries two approaches:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = [zeros(130,1);&#xA;  1.2*ones(370,1) + 0.2*cos(2*%pi*[0:369]'/90)];&#xA;&#xA;&#xA;y = x + 0.1*rand(500,1,'normal');&#xA;&#xA;[h,hm,fr]=wfir(&quot;lp&quot;,33,[.05 0],&quot;hm&quot;,[0 0])&#xA;&#xA;z = filter(h,1,y);&#xA;&#xA;alpha = 0.98;&#xA;zz = filter(1-alpha, [1 -alpha], y);&#xA;&#xA;clf&#xA;plot(x);&#xA;plot(y,'r.');&#xA;plot(z,'g');    &#xA;plot(zz,'m');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first, &lt;code&gt;z&lt;/code&gt;, uses a relatively short FIR filter. This does not resolve issue #1 (removing the oscillation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second, &lt;code&gt;zz&lt;/code&gt;, uses a first order IIR filter (exponential forgetter). This has the advantages of simplicity and reducing the amount of oscillation. The disadvantage is that it takes a while for the filtered value to reach $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oj2kv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The noiseless signal is blue, the noisy signal is plotted as red dots, the FIR filtered noisy signal is in green and the first-order filtered noisy signal is in magenta.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-08-29T21:27:16.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10549" PostTypeId="1" CreationDate="2013-08-29T22:04:51.120" Score="2" ViewCount="6661" Body="&lt;p&gt;I need to get the lines from a photographie of a sheet of paper. While recherching, I came along &lt;a href=&quot;https://stackoverflow.com/questions/16665742/a-good-approach-for-detecting-lines-in-an-image&quot;&gt;this&lt;/a&gt;, where one answer referred to &lt;a href=&quot;http://felix.abecassis.me/2011/09/opencv-morphological-skeleton/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog entry&lt;/a&gt;.&lt;br&gt;&#xA;Now I am having trouble with this approach. I have implemented it as follows (with the c++-interface of OpenCV:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// the image has to be grayscale&#xA;if (image.channels() != 1)&#xA;{&#xA;    cv::cvtColor(image, image, cv::COLOR_BGR2GRAY);&#xA;}&#xA;&#xA;// we need to enhance the lighting before we can threshold the photography&#xA;cv::equalizeHist(image, image);&#xA;// a binary image is needed&#xA;cv::threshold(image, image, threshold, 255, cv::THRESH_BINARY);&#xA;cv::imwrite(&quot;thresholdedImage.jpg&quot;, image);&#xA;&#xA;// the resulting skeleton&#xA;cv::Mat skeleton(image.size(), CV_8UC1, cv::Scalar(0,0,0));&#xA;// needed if in-place processing is not possible&#xA;cv::Mat temp(image.size(), CV_8UC1);&#xA;// eroded image is saved here&#xA;cv::Mat eroded;&#xA;// needed for morphological transforms (erodation, dilation)&#xA;cv::Mat element = cv::getStructuringElement(cv::MORPH_CROSS, cv::Size(3,3));&#xA;&#xA;bool done = true;&#xA;int i = 0;&#xA;while(done)&#xA;{&#xA;    // eroding + dilating = opening&#xA;    cv::erode(image, eroded, element);&#xA;    cv::dilate(eroded, temp, element);&#xA;    cv::subtract(image, temp, temp);&#xA;    cv::bitwise_or(skeleton, temp, skeleton);&#xA;    eroded.copyTo(image);&#xA;&#xA;    done = (cv::countNonZero(image) == 0);&#xA;    ++i;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For proof of concept, I decide to use a computer-made drawing for testing purposes, to eliminate issues with lighting at this early stage. This can be seen here:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ktGvQ.png&quot; alt=&quot;Created with GIMP&quot;&gt;&#xA;The threshold is correct, but unfortunately the skeleton looks very strange: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/cAcNe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;I have drawn the skeleton after 100 iterations, where it looked like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OtU60.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;Do you have any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="5295" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2015-11-28T05:14:57.290" Title="OpenCV: Problem at creating a Skeleton of Lines" Tags="|computer-vision|opencv|morphological-operations|morphology|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10550" PostTypeId="2" ParentId="10541" CreationDate="2013-08-30T00:00:20.813" Score="10" Body="&lt;p&gt;The DTFT is used when the math for proving some point is easier (saves on paper and/or chalk) when assuming an infinite number of samples.  Meaning that's it's actually useless in the real world (you'll be dead long before you find you have enough samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT is when you pick a useful finite number of samples to work with (giving you a nice finite size square matrix multiply exact equivalent), whether or not they are periodic (assuming periodicity of frame length is another delusion in the minds of some people to again make the math more tractable).  Using a DFT thus usually implies a window (rectangular, if not something else) which is not necessary in the DTFT.  This window comes with sometimes nasty artifacts, as well as the obvious loss of information about the signal outside the window, which is a downside of the DFT.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-30T17:51:42.020" LastActivityDate="2013-08-30T17:51:42.020" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10551" PostTypeId="1" CreationDate="2013-08-30T01:53:38.810" Score="1" ViewCount="413" Body="&lt;p&gt;I'm trying to compute the the interference that one OFDM user with beamforming causes to another user. The two systems are fully overlapped in frequency and time. I know how to generate an OFDM signal in MATLAB and compute its BER in AWGN and fading channels, I just don't know how to implement beamforming. The beamform is a circular sinc, I believe I need multiply my signal with the gain of the main lobe of the sinc function. I don't know how to calculate the interference caused on the other user. I'm not asking for anyone to provide me with a code, I'm just hoping that someone here can provide some directions on how to approach this or if there are any other resources that I can check.&lt;/p&gt;&#xA;" OwnerUserId="4259" LastActivityDate="2013-09-05T15:55:16.247" Title="OFDM with beamforming" Tags="|matlab|ofdm|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10552" PostTypeId="2" ParentId="10527" CreationDate="2013-08-30T02:48:42.273" Score="6" Body="&lt;p&gt;If you &lt;em&gt;know&lt;/em&gt; ahead of time that your filter pulse response has zeroes in alternation, then you can use a &lt;em&gt;different&lt;/em&gt; FFT routine to speed up the convolution. On the other hand, if you simply pass the filter input and the pulse response to a generic computational subroutine that will spit out the filter output given $x[n]$ and $h[n]$, then yes, the zeroes will be handled no differently than any other inputs and will not save any computation at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;&#xA;Suppose that the (FIR) filter pulse response is $\mathbf h = 1 \quad 0 \quad 1 \quad 0 \quad 1$.  Then, the filter output is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = x[n] + x[n-2] + x[n-4]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so the filter output is &lt;em&gt;alternately&lt;/em&gt;&#xA;the sum of three successive even-numbered inputs and &#xA;the sum of three successive odd-numbered inputs.  So, &lt;strong&gt;knowing&lt;/strong&gt; that&#xA;$\mathbf h$ has alternate zeroes, we could proceed as follows.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a filter $\hat{\mathbf h}$ by decimating $\mathbf h$ &#xA;(or downsampling) by a factor of $2$. Thus, $\hat{\mathbf h} = 1 \quad 1 \quad 1$ in the example.&lt;/li&gt;&#xA;&lt;li&gt;Decimate $\mathbf x$ to create two input streams &#xA;$$\mathbf x_e = x[0]\quad x[2]\quad x[4] \quad \cdots ~~\text{and}~~&#xA;x_o = x[1]\quad x[3]\quad x[5] \quad \cdots$$&lt;/li&gt;&#xA;&lt;li&gt;Apply $\hat{\mathbf h}$ to the two streams to get $\mathbf y_e$ and $\mathbf y_o$.&lt;/li&gt;&#xA;&lt;li&gt;Recombine $\mathbf y_e$ and $\mathbf y_o$ to get $\mathbf y$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If FFTs are used anywhere in doing the needed convolutions, note that the&#xA;FFT of $\hat{\mathbf h}$ needs to be computed only once, and various tricks&#xA;such as overlap-and-add etc will have to be applied separately to the two&#xA;data streams. Note also that the FFTs can be shorter (though we have to&#xA;do two of them), and a crude comparison&#xA;says that &#xA;$$2\left[\frac{N}{2}\log_2\left(\frac{N}{2}\right)\right] = N\log_2\left(\frac{N}{2}\right) &amp;lt; N\log_2 N.$$&#xA;More exact comparisons with actual numbers may reveal a different tradeoff.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-08-30T02:48:42.273" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10553" PostTypeId="1" CreationDate="2013-08-30T10:38:35.953" Score="0" ViewCount="3352" Body="&lt;p&gt;I would like to calculate the total SINR of a IQ modulation system in time domain.&#xA;$$ SINR = \frac{P}{N+I}$$&#xA;The blocks of the system are.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bit generation &lt;/li&gt;&#xA;&lt;li&gt;QAM modulation &lt;/li&gt;&#xA;&lt;li&gt;pulse shaper (sq root raised cosine f) &lt;/li&gt;&#xA;&lt;li&gt;IQ mod&lt;/li&gt;&#xA;&lt;li&gt;IQ dem&lt;/li&gt;&#xA;&lt;li&gt;filter (root raised)&lt;/li&gt;&#xA;&lt;li&gt;QAM demodulation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MVYzT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a simulation of a IQ modulation system in time domain, with a recovery of the signal, but unfortunately I dunno how to calculate the SNIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mediafire.com/download/l263s1o2n2ln3n6/IQ_transmission.rar&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here is the file, thanks for your help.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main file is &lt;code&gt;my_modem.m&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you can see the outputs!&#xA;&lt;a href=&quot;http://matlabonline.p.ht/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://matlabonline.p.ht/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5337" LastEditorUserId="5337" LastEditDate="2013-09-01T21:19:43.837" LastActivityDate="2013-10-05T07:33:33.880" Title="SINR calculation" Tags="|matlab|modulation|real-time|snr|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10554" PostTypeId="2" ParentId="10319" CreationDate="2013-08-30T13:07:30.927" Score="1" Body="&lt;p&gt;Signal sampled at Nyquist frequency can be perfectly reconstructed. But that does not mean that the information content of that signal is always evenly distributed across the bandwidth (which is limited by Nyquist frequency). Compressed sensing tries to exploit this trade off. Signal encoded with compressed sensing is able to encode enough information to be able to reconstruct the desired signal which may or may not be as perfect as signal encoded by sampling at Nyquist frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I quote from Wikipedia article on &lt;a href=&quot;http://en.wikipedia.org/wiki/Compressed_sensing&quot; rel=&quot;nofollow&quot;&gt;Compressed Sensing&lt;/a&gt;.&#xA;&quot;At first glance, compressed sensing, because it depends on the sparsity of the signal in question and not its highest frequency, might seem to violate the sampling theorem. This is a misconception, because the sampling theorem guaranties perfect reconstruction given sufficient, not necessary, conditions. A sampling method different from the classical fixed-rate sampling therefore can not &quot;violate&quot; the sampling theorem. Sparse signals with high frequency components can be highly under-sampled using compressed sensing compared to classical fixed-rate sampling.&quot;&lt;/p&gt;&#xA;" OwnerUserId="5338" LastActivityDate="2013-08-30T13:07:30.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10555" PostTypeId="1" CreationDate="2013-08-30T13:11:50.250" Score="0" ViewCount="1050" Body="&lt;p&gt;I would like to implement a HOG descriptor in C++.&#xA;I found an implementation of this code in &lt;a href=&quot;https://web.archive.org/web/20211128054758/http://www.openpr.org.cn/index.php/Code-of-Individual-Algorithms/9-Histograms-of-Oriented-Gradients-HOG-Feature-Extraction/View-details.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Open Pattern Recognition Project - Histograms of Oriented Gradients (HOG) Feature Extraction&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An extract of the code follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;//extract HOG features from a group of key points&#xA;void HOGExtractor::extract(ublas::matrix&amp;lt;float&amp;gt; &amp;amp;dscr_list, const &#xA;ublas::matrix&amp;lt;int&amp;gt; &amp;amp;bbox_list, const IntegralHistogram &amp;amp;inthist)&#xA;{&#xA;    unsigned int length = _param.xgrid * _param.ygrid * inthist.dirnum();&#xA;        if (dscr_list.size1() != bbox_list.size1() || dscr_list.size2() != &#xA;length)&#xA;    throw std::runtime_error( boost::str(&#xA;                boost::format(&amp;quot;Allocate proper memory for dscr_list [%1% %2%] != [%3% %4%]&amp;quot;) % dscr_list.size1() % dscr_list.size2() % dscr_list.size2() % length) );&#xA;&#xA;ublas::matrix&amp;lt;float&amp;gt;::iterator1 idscr_list;&#xA;ublas::matrix&amp;lt;int&amp;gt;::const_iterator1 ibbox_list;&#xA;ublas::matrix&amp;lt;int&amp;gt;::const_iterator1 ibbox_list_end(bbox_list.end1());&#xA;ublas::vector&amp;lt;int&amp;gt; bbox_grids( _param.xgrid * _param.ygrid * 4 );&#xA;for ( ibbox_list = bbox_list.begin1(), idscr_list = dscr_list.begin1(); ibbox_list != ibbox_list_end; ++ibbox_list, ++idscr_list)&#xA;{&#xA;    ublas::matrix&amp;lt;int&amp;gt;::const_iterator2 ibbox = ibbox_list.begin();&#xA;    float x0 = std::max( *ibbox++, 0 );&#xA;    float y0 = std::max( *ibbox++, 0 );&#xA;    float x1 = std::min( *ibbox++, inthist.width() - 1 );&#xA;    float y1 = std::min( *ibbox++, inthist.height() - 1 );&#xA;    if ( x1 - x0 &amp;lt; _param.xgrid || y1 - y0 &amp;lt; _param.ygrid )&#xA;        throw std::runtime_error( boost::str(boost::format(&amp;quot;Grid number should be less than bbox width/height [%1% %2% %3% %4%]/[%5% %6%]&amp;quot;) % x0 % y0 % x1 % y1 % _param.xgrid % _param.ygrid) );&#xA;&#xA;    float xstep = (x1 - x0 + 1) / _param.xgrid;&#xA;    float ystep = (y1 - y0 + 1) / _param.ygrid;&#xA;    for (int i = 0; i &amp;lt; _param.xgrid; ++i)&#xA;        for (int j = 0; j &amp;lt; _param.ygrid; ++j)&#xA;        {&#xA;            bbox_grids( (i * _param.ygrid + j)*4 + 0) = static_cast&amp;lt;int&amp;gt;(x0 + xstep*i);    //x0 &#xA;            bbox_grids( (i * _param.ygrid + j)*4 + 1) = static_cast&amp;lt;int&amp;gt;(y0 + ystep*j);    //y0 &#xA;            bbox_grids( (i * _param.ygrid + j)*4 + 2) = static_cast&amp;lt;int&amp;gt;(x0 + xstep*(i + 1) - 1);    //x1 &#xA;            bbox_grids( (i * _param.ygrid + j)*4 + 3) = static_cast&amp;lt;int&amp;gt;(y0 + ystep*(j + 1) - 1);    //y1 &#xA;        }&#xA;    inthist.get_hist&amp;lt; ublas::matrix&amp;lt;float&amp;gt;::iterator2, ublas::vector&amp;lt;int&amp;gt;::const_iterator&amp;gt;( idscr_list.begin(), bbox_grids.begin(), bbox_grids.end(), _param.normalize);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;key points&amp;quot; it is referred to here are (if I'm not mistaken) the coordinates of the box containing an object we want to extract the features.&lt;/p&gt;&#xA;&lt;p&gt;However, I am wondering how I can get these coordinates in a image? (Given an image and an object I want to extract the features, how can I know the values of x0, x1, y0, y1?)&lt;/p&gt;&#xA;" OwnerUserId="5335" LastEditorUserId="7092" LastEditDate="2023-07-14T19:03:23.170" LastActivityDate="2023-12-11T22:07:20.900" Title="HOG descriptor algorithm" Tags="|image-processing|computer-vision|algorithms|software-implementation|local-features|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10556" PostTypeId="2" ParentId="10544" CreationDate="2013-08-30T13:49:59.583" Score="5" Body="&lt;p&gt;Exponential averaging is performed using a first order IIR filter according to the difference equation:&#xA;\begin{equation}&#xA;y[n] = (1-\alpha)\;x[n]+\alpha \; y[n-1]&#xA;\end{equation}&#xA;where $x[n]$ and $y[n]$ are the input and output signals at time $n$ and the value of the single coefficient $\alpha$ is given by the equation:&#xA;\begin{equation}&#xA;\alpha = \exp( \frac{-1}{f_s \tau} )&#xA;\end{equation}&#xA;where $f_s$ is the sampling frequency and $\tau$ is the time constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this light, it can be seen that exponential averaging filters are simply low-pass filters, the roll-off of which is -6dB/oct.  The only free parameter is the cut-off frequency, which is specified by the time constant.  Longer time constants will yield a lower cut-off frequency, as can be see in the Matlab code and plot below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure; hold all&#xA;fs = 8000;&#xA;tau = 10.^(-1:-1:-4);&#xA;alpha = exp(-1/fs./tau);&#xA;color = 'brgc';&#xA;for index = 1 : length( alpha )&#xA;    [Hz fVec] = freqz( [1-alpha(index)], [1 -alpha(index)], 8192, fs );&#xA;    plot( fVec, 20*log10(abs(Hz)), color(index), 'LineWidth', 2 );    &#xA;    legText{index} = sprintf( '$\\tau = 10^{%d}$', log10(tau(index)) );    &#xA;end&#xA;hLeg = legend(legText,3);&#xA;set( hLeg, 'interpreter', 'latex' );&#xA;axis( [8000/8192 4000 -70 10] )&#xA;ylabel('Amplitude [dB]')&#xA;xlabel('Frequency [Hz]')&#xA;set( gca, 'xscale', 'log' )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pLaz9.png&quot; alt=&quot;Different exponential averaging filters.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the parallel -6dB/oct slopes (characteristic of single pole filters) and the falling cut-off frequency with lengthening time constants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct choice of time constant depends on how fast the variation of the desired average is.  In order to capture a quickly varying mean, only signal content above the fastest frequency of variation should be attenuated -- the time constant should be chosen accordingly.  This means that if the signal mean varies very slowly, long time constants are needed, and vice versa.  I find that trial and error works best to determine the optimal value, but formulas to calculate the cut-off frequency do exist, e.g. see &lt;a href=&quot;http://www.dsprelated.com/showarticle/182.php&quot; rel=&quot;noreferrer&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4391" LastEditorUserId="4391" LastEditDate="2013-08-30T18:23:16.763" LastActivityDate="2013-08-30T18:23:16.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10557" PostTypeId="2" ParentId="10551" CreationDate="2013-08-30T17:34:46.837" Score="1" Body="&lt;p&gt;The interference you cause to the other user is determined by:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The total transmit power of your transmitter&lt;/li&gt;&#xA;&lt;li&gt;The gain of your beampattern in the direction of the other user&lt;/li&gt;&#xA;&lt;li&gt;The path loss to the other user&lt;/li&gt;&#xA;&lt;li&gt;If the other user uses receive beamforming, then also by the gain of its beampattern in the direction of the transmitter&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So if you transmit with a power of 10dBm, have a gain in the users direction of -20dB and a pathloss of 60dB, the other user receives -70dBm of interference power from the transmitter. Whether or not this is bad then depends also on how powerful the useful signal of the other user is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information is required here for a more detailled answer.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-08-30T17:34:46.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10559" PostTypeId="2" ParentId="10547" CreationDate="2013-08-30T18:24:54.710" Score="2" Body="&lt;p&gt;FDLS is similar to rational polynomial interpolation in that the interpolation quickly becomes unstable if the target polynomial degree is set too high.  (e.g. just a tiny amount of variation or noise in the spec at a sub-optimal grid spacing can cause extremely wild excursions in the graph of a high order polynomial).  Thus it is usually better if the FDLS order you choose is overdetermined by your specification points to some degree (usually selected by trial-and-error).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The jagged-ness of a frequency response is more related to how close a group of poles or zeros are to the unit circle and each other, rather than to their absolute number.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-08-30T18:29:55.977" LastActivityDate="2013-08-30T18:29:55.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10560" PostTypeId="1" CreationDate="2013-08-30T19:20:02.693" Score="7" ViewCount="1977" Body="&lt;p&gt;After investigating signal analysis methods based on empirical mode decomposition (EMD), I found that recent developments are mostly related to the Hilbert Huang transform (HHT) and the Local Mean Decomposition (LMD) method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been reading a few articles on the subject and I would like to have your opinion regarding HHT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EMD leads to intrinsic mode functions that are particularly well suited for Hilbert transform. HHT seems to be really widely used for many distinct types of industrial or academic applications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right to think that HHT is essentially EMD + Hilbert transform? Do you consider the specificity of the HHT lies in the sifting process based on spline interpolation (to the contrary of the LMD using a moving average algorithm for instance)? &lt;/p&gt;&#xA;" OwnerUserId="5341" LastEditorUserId="76" LastEditDate="2013-09-08T12:04:36.793" LastActivityDate="2019-04-25T19:18:58.937" Title="Precisions on Hilbert Huang transform" Tags="|hilbert-transform|non-linear|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10561" PostTypeId="1" CreationDate="2013-08-30T19:40:35.150" Score="0" ViewCount="210" Body="&lt;p&gt;I have to apply some kind of adaptive filter to my function $f(x).$ I present each point of my signal as a Gaussian, whose bandwidth depends on its location &lt;strong&gt;(not the point of observation $\textbf{x}$)&lt;/strong&gt; as $h(t),$ which is a known pre-calculated function. The final output function $s(x)$ is a superposition of the influence of all Gaussians (of all points).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(x)=\int\limits_{-\infty}^{+\infty}f(t)g(h(t),x-t)dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$g(h(t),x)$ is a $NormPDF(\sigma, x_0, x)$ with $\sigma=h(t)$, $x_0=0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NB: the diameter of each Gaussian depends on the location of each Gaussian $t$, not on the location of observation point $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gives a good look of $s(x)$, but is calculates a bit too slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I had a fixed-bandwidth filter, I could perform the well-known fast convolution algorithm via FFT. Or I could drop the faraway points and have the convolution as:&#xA;$$s(x)=\int\limits_{x-\Delta x}^{x+\Delta x}f(t)g(h(t),x-t)dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for the adaptive filter I should take my $\Delta x$ at least twice as large, as the maximum bandwidth is (in my case it is nearly 30% of all x area), so it cannot give a big profit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I don't know any algorithms of fast convolutions for such types of filters.&lt;/p&gt;&#xA;" OwnerUserId="5343" LastEditorUserId="76" LastEditDate="2013-09-08T12:04:49.857" LastActivityDate="2013-09-08T12:04:49.857" Title="Need a fast algorithm of adaptive convolution" Tags="|filters|convolution|adaptive-filters|adaptive-algorithms|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10564" PostTypeId="1" CreationDate="2013-08-30T20:44:41.173" Score="0" ViewCount="891" Body="&lt;p&gt;I am detecting the object from the live camera through feature detection with svm , and it read every frame from camera while predicting which affect its speed , i just want that it should select the frame which contain the object and ignore other frames which have no object like empty street or standing car's , it should only detect the moving object&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example , If the object came into camera in 6th frame , it contain into the camera till many frames until it goes out from camera's range , so it should not recount the same object and ignore that frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Explanation :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am detecting the vehicle from video , i want to ignore the empty frames , but how to ignore them ? i only want to check the frames which contain object like vehicle , but if the vehicle is passing from video it take approximately lets assume 5 sec , than it mean same object take 10 frames , so the program count it as 10 vehicles , one from each frame , i want to count it as 1 , because its the one (SAME) vehicle which use 10 frames&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My video is already in Background subtraction form , i used SURF/BOW with SVM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I explore two techniques :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Entropy ( Frame subtraction )&#xA;2- Keyframe extraction&lt;/p&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="5057" LastEditDate="2013-08-31T21:12:15.583" LastActivityDate="2022-04-15T04:10:00.913" Title="How to select the specific frame with object" Tags="|computer-vision|opencv|image-processing|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10565" PostTypeId="2" ParentId="10564" CreationDate="2013-08-30T21:23:22.347" Score="1" Body="&lt;p&gt;I'm seeing two issues here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Frames with no activity: You can check the gradient between successive frames and only do object detection when the gradient information passes a certain threshold.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Counting the same object: The vehicle location information can be useful for this task. If the gradient change occurs in the location of a detected object in the previous frame then it is the same vehicle. If necessary, you can also use object color and object size parameters to account for varying speeds.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-08-30T21:23:22.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10568" PostTypeId="1" CreationDate="2013-08-31T02:26:52.957" Score="-1" ViewCount="552" Body="&lt;p&gt;Is a dirac comb a Linear and a shift Invariant System? I could prove the linearity, but I do not think it is shift invariant. How do do I prove it is shift variant?&lt;/p&gt;&#xA;" OwnerUserId="5348" LastActivityDate="2018-02-28T03:17:53.807" Title="Shift-Invariance of Dirac Comb?" Tags="|discrete-signals|impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10570" PostTypeId="2" ParentId="10568" CreationDate="2013-08-31T08:01:41.220" Score="0" Body="&lt;p&gt;If by dirac comb you mean a system with $y(t) = \sum_kx(t-kT)$ equation:&#xA;$$&#xA;y(t) = \sum_kx(t-kT) = \sum_kx(t)\ast \delta(t-kT) = x(t) \ast \underbrace{\sum_k\delta(t-kT)}_{h(t)}&#xA;$$&#xA;Therefore $h(t)$ is impluse response of the system and the system is Linear Time Invariant (LTI).&lt;/p&gt;&#xA;" OwnerUserId="5104" LastActivityDate="2013-08-31T08:01:41.220" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10571" PostTypeId="1" AcceptedAnswerId="10573" CreationDate="2013-08-31T12:52:18.927" Score="1" ViewCount="308" Body="&lt;p&gt;Is it possible to make one IIR filter from various cascading IIR filters of different orders?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it is possible to do it from filters of the same order, but what about filters with different orders?&lt;/p&gt;&#xA;" OwnerUserId="5349" LastEditorUserId="76" LastEditDate="2013-09-08T12:04:28.513" LastActivityDate="2013-09-08T12:04:28.513" Title="Group cascading IIR filters of different orders" Tags="|filters|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10572" PostTypeId="2" ParentId="10527" CreationDate="2013-08-31T13:25:17.477" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If so, might there then be cases where a good old fashioned convolution in the time domain is in fact &lt;em&gt;much faster&lt;/em&gt; than an FFT?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.  Direct convolution is always faster when N is small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can halve the computation time for half zeros, then that changes the point at which N becomes &quot;small&quot;, but the FFT method will always be faster for &quot;large N&quot; and slower for &quot;small N&quot;, no matter how many zeros there are or other shortcuts you take, since the FFT takes O(N log N) (actually 8N log 2N?) time and the direct convolution takes O(N&lt;sup&gt;2&lt;/sup&gt;) time (actually 2N&lt;sup&gt;2&lt;/sup&gt; time, or in your case N&lt;sup&gt;2&lt;/sup&gt; time?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a graph of number of operations vs N.  The numbers are arbitrary, but they scale correctly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lPnEu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at N = 40, the FFT convolution is faster than the direct convolution, but the direct convolution with halved time because of zeros is faster than the FFT.  At some N the FFT always wins, though.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It seems that I would undo any gains I could have had&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It sounds like you're thinking that FFT halves the computation time.  It doesn't.  It does far better than halving.  For a crude example, at N = 10000, yours takes something like 100,000,000 operations, while the original would take 200,000,000 operations, saving half the time.  Meanwhile, the FFT takes something like 344,082 operations, orders of magnitude less.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At some N, the FFT will always become faster, but there are certainly cases where direct is faster.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-08-31T19:43:24.360" LastActivityDate="2013-08-31T19:43:24.360" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10573" PostTypeId="2" ParentId="10571" CreationDate="2013-08-31T14:09:33.830" Score="4" Body="&lt;p&gt;You certainly can. In theory you can cascade any type of linear time invariant filter (FIR, IIR, overlap-add, warped allpass, etc.) of any filter order in any sequence and happily mix them up. The transfer function of the cascade is simply the product of all the individual transfer functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, especially for fixed point systems, you need to watch gain, stability and noise, so depending on your application there may be some practical constraints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most common IIR implementation is cascaded biquad filters (also known as second order sections) since they are the easiest to manage in terms of noise, gain and stability.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-08-31T14:09:33.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10574" PostTypeId="1" CreationDate="2013-08-31T14:56:17.720" Score="0" ViewCount="42" Body="&lt;p&gt;Please excuse me if this is not the proper place to ask this. I just need some general advice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have set up a very basic homemade motion capture system where I put three TrackIR cameras from NaturalPoint in a three fixed positions. I want to capture movement of a single object in three axis. So I laid out two of the cameras on both sides of my working area, plus the third camera above the object, pointing downwards. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then use reflective markers to track the position of my object in the cameras.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't do any calculations on my system aside from a simple coordinate transformation from that of the real world to that of my virtual world. I do this separately, for each of the cameras. Since they are in fixed positions I already know how movements translate from one &quot;world&quot; to the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way that I can improve my mo-cap system? Should I apply some kind of triangulation (isn't triangulation implicit in my system already, given that Im using fixed positions for my cameras)? What filtering could I use to account for punctual lost of tracking elements?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I want (ie. need) to stick to my current hardware.&lt;/p&gt;&#xA;" OwnerUserId="5350" LastActivityDate="2013-08-31T14:56:17.720" Title="How can I improve my motion capture system?" Tags="|video-processing|motion|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10575" PostTypeId="1" CreationDate="2013-08-31T18:43:21.740" Score="3" ViewCount="179" Body="&lt;p&gt;Excuse my ignorance...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a digital image of a label I'd like to&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Requirement: Match it to the closest pre-existing image in a datastore&lt;/li&gt;&#xA;&lt;li&gt;Optional: OCR it, if possible (only necessary if step 1 fails)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm a programmer but not an engineer. I have no idea where to begin or where to look into solving this problem. I don't even know the right terminology; &quot;Image Processing&quot; is best I could come up with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting here, on DSP (beta); apologies in advance to the forum police if this type of inquiry is not considered to be 'in scope'. Before you vote me off the 'island' hopefully someone can comment with a better site/forum for my education.&lt;/p&gt;&#xA;" OwnerUserId="5352" LastEditorUserId="5352" LastEditDate="2013-08-31T19:44:00.560" LastActivityDate="2013-08-31T19:55:59.550" Title="Match (OCR?) a digital image of a product label to similar" Tags="|image-processing|ocr|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10576" PostTypeId="2" ParentId="10575" CreationDate="2013-08-31T19:55:59.550" Score="5" Body="&lt;p&gt;First, you will need an image processing algorithm to detect local features of the digital images you have. &lt;a href=&quot;http://www.cs.utexas.edu/~grauman/courses/fall2009/papers/local_features_synthesis_draft.pdf&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt; and &lt;a href=&quot;http://www.ics.uci.edu/~dramanan/teaching/cs116_fall08/lec/features.ppt&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt; provide good reviews of such algorithms.:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After extracting the local features, a matching process between the extracted features and your set of labels is used to link the labels with acquired images. The second references goes over few matching techniques and performance metrics.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-08-31T19:55:59.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10579" PostTypeId="1" AcceptedAnswerId="11241" CreationDate="2013-09-01T05:19:30.300" Score="11" ViewCount="21190" Body="&lt;p&gt;I know about Harris corner detector, and I understand the basic idea of its &lt;strong&gt;second moment matrix&lt;/strong&gt;,&#xA;$$M = \left[ \begin{array}{cc}&#xA;I_x^2 &amp;amp; I_xI_y \\&#xA;I_xI_y &amp;amp; I_y^2&#xA;\end{array} \right]$$,&#xA; edges and other unstable points can be removed via $M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But about Hessian detector, it uses Hessian matrix to detect key points and remove edges,&#xA;$$\mathcal{H} = \left[ \begin{array}{cc}&#xA;I_{xx} &amp;amp; I_{xy} \\&#xA;I_{xy} &amp;amp; I_{yy}&#xA;\end{array} \right]$$,&#xA;and I don't understand how could $\mathcal{H}$ remove edge and detect stable points? What's the intuitive basic idea behind it?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="53" LastEditDate="2013-09-04T00:42:51.457" LastActivityDate="2021-02-09T18:54:10.267" Title="How Hessian feature detector works?" Tags="|image-processing|computer-vision|local-features|peak-detection|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10581" PostTypeId="1" AcceptedAnswerId="10582" CreationDate="2013-09-01T13:11:14.747" Score="8" ViewCount="3463" Body="&lt;p&gt;I recently received some scanned pictures which are in a pretty good state, with OK resolution, but they are randomly spattered with a bunch of black dots. These cover everything (clothes, faces, walls, windows, and so on) except for a few very bright areas. I also have no idea how they got there. Here is a sample:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eleXQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From an information content perspective, I would expect that these dots could probably be removed as they likely have a quite distinct signature. (If they were evenly distributed, for example, I know that a spatial mask on their Fourier transform would do wonders.) &lt;strong&gt;Is there some algorithm to remove these artifacts?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5355" LastActivityDate="2020-04-14T06:47:09.337" Title="How can I remove random dots from an image?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10582" PostTypeId="2" ParentId="10581" CreationDate="2013-09-01T13:11:14.747" Score="12" Body="&lt;p&gt;OK, thanks to the fantastic Stack Exchange Ask a Question page, I have now a good idea of what they are and how to remove them. This is what I would describe as &quot;pepper noise&quot;, as opposed to the traditional &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_noise#Salt-and-pepper_noise&quot;&gt;salt and peper noise&lt;/a&gt;. It can be removed by using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot;&gt;median filter&lt;/a&gt;, which essentially replaces each pixel by the median of the values of the pixels in some suitable neighbourhood around it. This is available directly in Photoshop, and as part of the Despeckle filter in the &lt;a href=&quot;http://www.gimp.org/&quot;&gt;GIMP&lt;/a&gt; (see e.g. &lt;a href=&quot;http://dossy.org/2007/08/what-is-gimps-equivalent-of-photoshops-median-filter/&quot;&gt;this resource&lt;/a&gt;). I hope this Q&amp;amp;A will be useful for other people with the same problem. &lt;/p&gt;&#xA;" OwnerUserId="5355" LastActivityDate="2013-09-01T13:11:14.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10583" PostTypeId="1" CreationDate="2013-09-01T14:11:20.607" Score="1" ViewCount="200" Body="&lt;p&gt;I am running a wavelet transform (cmor) to estimate damping and frequencies that exists in a signal.cmor has 2 parameters that I can change them to get more accurate results. center frequency(Fc) and bandwidth frequency(Fb). If I construct a signal with few freqs and damping then I can measure the error of my estimation(fig 2). but in actual case I have a signal and I don't know its freqs and dampings so I can't measure the error.so a friend in here suggested me to reconstruct the signal and find error by measuring the difference between the original and reconstructed signal e(t)=|x(t)−x^(t)|. &#xA;so my question is:&lt;br&gt;&#xA;Does anyone know a better function to find the error between reconstructed and original signal,rather than e(t)=|x(t)−x^(t)|.&lt;br&gt;&#xA;can I use GA to search for Fb and Fc? or do you know a better search method?&lt;br&gt;&#xA;Hope this picture shows what I mean, the actual case is last one. others are for explanations&lt;img src=&quot;https://i.stack.imgur.com/qmRGk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-09-02T20:26:30.573" LastActivityDate="2013-09-02T20:26:30.573" Title="Can I run a GA to optimize wavelet transform?" Tags="|frequency|wavelet|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="10585" PostTypeId="2" ParentId="143" CreationDate="2013-09-02T13:46:09.857" Score="1" Body="&lt;p&gt;Not really an answer (hence this is community wiki), but I thought we should capture @Mohammad's code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Mohammad Z&#xA;&#xA;%Teager-Kaiser Non-Linear Energy Operator. &#xA;function [out] = TKEO(x)&#xA;    N = length(x);&#xA;    x = x(:).';&#xA;    temp = x(2:N-1).^2 - x(3:N).*x(1:N-2);&#xA;    out = [temp(1) temp temp(end)];    &#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-09-02T13:46:09.857" CommentCount="0" CommunityOwnedDate="2013-09-02T13:46:09.857" ContentLicense="CC BY-SA 3.0" />
  <row Id="10586" PostTypeId="2" ParentId="10583" CreationDate="2013-09-02T14:39:45.837" Score="1" Body="&lt;p&gt;You should be able to use GA or any other derivative-free optimization methods to solve your problem&lt;a href=&quot;http://www2.peq.coppe.ufrj.br/Pessoal/Professores/Arge/COQ897/dfo-Sahinidis.pdf&quot; rel=&quot;nofollow&quot;&gt; [1]&lt;/a&gt;. The correct parameter values can be determined using your application. If I'm trying to optimize for compression then I will look into the entropy of the resultant coefficients. Deciding on the actual values for your parameters will depend on how you plan to use them. The correct parameter values are simply the ones that work better. &lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-09-02T14:39:45.837" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10587" PostTypeId="2" ParentId="10531" CreationDate="2013-09-02T15:55:24.600" Score="1" Body="&lt;p&gt;As I've said in my comment to question, you can use function &lt;code&gt;pixConnComp&lt;/code&gt; from &lt;code&gt;leptonica&lt;/code&gt; library. Another variant is to use one of a common known algorithm for &lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling&quot; rel=&quot;nofollow&quot;&gt;connected components labeling&lt;/a&gt;. For example you can use &lt;a href=&quot;https://sourceforge.net/p/eddyssnippets/code/ci/default/tree/erosion-dilation/binmorph.c&quot; rel=&quot;nofollow&quot;&gt;my realisation&lt;/a&gt; (from line 385) of conncomp labeling algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most algorithms use two or three passes over image. My version have three passes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Mark neighbours in each line: you just assign labels to each connected set of pixels line by line (labels are saving in matrix with image size).&lt;/li&gt;&#xA;&lt;li&gt;Fill associative array with remarking: we assign a new labels to labels that we've get at step 1. For this operation we check neighbours of non-zero labels on image and assign to it a smallest value.&lt;/li&gt;&#xA;&lt;li&gt;Rename markers due to associative array. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We can combine steps 2 and 3, but in that case algorithm would be more difficult.&lt;/p&gt;&#xA;" OwnerUserId="3766" LastActivityDate="2013-09-02T15:55:24.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10588" PostTypeId="2" ParentId="10183" CreationDate="2013-09-02T16:49:49.090" Score="10" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;What is meant by &amp;quot;spectral whitening&amp;quot; in DSP?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Spectral whitening is usually an attempt to make the spectrum of the signal &amp;quot;more uniform&amp;quot;.  One reason this might be a good thing to do is that it can have the effect of making the autocorrelation of the signal &amp;quot;narrower&amp;quot; (and closer to a Kronecker delta, for discrete-time signals). This can help localize in time.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What effect does spectral whitening have when used in image processing? (visually or otherwise...)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It's generally not pretty.  Most images are &amp;quot;low pass&amp;quot; (most of the information is in the low frequency part of the spectrum).  One simplistic approach to whitening in images is to do a column-wise (or row-wise) difference (i.e. &lt;code&gt;diff&lt;/code&gt; in matlab).&lt;/p&gt;&#xA;&lt;p&gt;This will mean negative pixel values, which generally do not map to anything sensible with standard images.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://sites.google.com/site/kootsoop/prewhitening&quot; rel=&quot;nofollow noreferrer&quot;&gt;This example shows how prewhitening can improve localization in image processing template matching.&lt;/a&gt; The picture from that link is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bbdb1.jpg&quot; alt=&quot;Localizing patch in an image, with and without prewhitening.&quot; /&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Where might spectral whitening be useful in audio processing or analysis?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If you are trying to localize (in time) the onset of a sound, then it's possible that spectral whitening can improve this.  It's also possible that it can reduce (disimprove) the SNR.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What would a spectrally whitened audio signal sound like?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For audio of speech or music, it will tend to bring in more higher frequencies.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2021-11-02T18:35:04.333" LastActivityDate="2021-11-02T18:35:04.333" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="10590" PostTypeId="1" AcceptedAnswerId="42553" CreationDate="2013-09-02T19:13:32.847" Score="9" ViewCount="170" Body="&lt;p&gt;I am starting with a typical $\ell_1$ basis pursuit problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\min_{\mathbf{x}} \Vert \mathbf{x} \Vert_1 \quad \mathrm{s.t.} \quad \Vert \mathbf{ERx} - \mathbf{y} \Vert_2 \leq \epsilon,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{R}\in\mathbb{C}^{M \times P}$, and $\mathbf{E}$ is an $M' \times M$ row selection matrix that randomly chooses $M'&amp;lt;P$ rows from $\mathbf{R}$. It is also known that $\operatorname{rank}(\mathbf{ER})=M'$, so that the constraint system is full-rank but under-determined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since both $M$ and $P$ are on the order of $10^7$, the above problem is impractical because of memory and computational limitations. An algorithm exists that will let me efficiently compute $\mathbf{R^{\mathrm{H}}}\mathbf{E^{\mathrm{H}}}\mathbf{y}$, so I would like to see if I can combine this with a sparse approximation (described below) to solve the following equivalent problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\min_{\mathbf{x}} \Vert \mathbf{x} \Vert_1 \quad \mathrm{s.t.} \quad \Vert \mathbf{R^{\mathrm{H}}}\mathbf{E^{\mathrm{H}}}\mathbf{ERx} - \mathbf{R^{\mathrm{H}}}\mathbf{E^{\mathrm{H}}}\mathbf{y} \Vert_2 \leq \epsilon,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $\mathbf{E}$ is a row-selection matrix, the product $\mathbf{E^{\mathrm{H}}}\mathbf{E}$ is a diagonal matrix with a $1$ at element $(i,i)$ if row $i$ was selected and $0$ otherwise. Furthermore, given the nature of $\mathbf{R}$, even though the product $\mathbf{R^{\mathrm{H}}}\mathbf{E^{\mathrm{H}}}\mathbf{ER}$ is rather large at $P \times P$, it is also approximately sparse with only a relatively small number of terms with significant modulus per row/column. This makes me think that the above form is doable since I could compute just the sparse approximation and avoid the unrealistic memory and computation requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, $\mathbf{R^{\mathrm{H}}}\mathbf{E^{\mathrm{H}}}\mathbf{ER}$ has size $P \times P$ but is only of rank $M'$ and this is causing problems with the  basis pursuit algorithms as they expect the rows of the constraint matrix to be&#xA;linearly independent. Hence, my solicitation for input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any factorizations and/or transformations that could turn the constraints of the second form of the problem into under-determined yet full-rank system? Please do keep in mind the large sizes of these matrices. Any other suggestions/comments are also welcome. We can assume that $\mathbf{R}$ has rank $M$ or $P$, as there is freedom in its design.&lt;/p&gt;&#xA;" OwnerUserId="5134" LastEditorUserId="128" LastEditDate="2018-07-07T22:27:09.443" LastActivityDate="2022-03-04T20:32:30.637" Title="Ideas on Matrix Factorization / Transformations for $ {L}_{1} $ Minimization" Tags="|linear-systems|optimization|linear-algebra|convex-optimization|matrix-factorization|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10591" PostTypeId="1" CreationDate="2013-09-03T00:33:40.253" Score="2" ViewCount="244" Body="&lt;p&gt;I have a time series that has been measured after convolution with a moving average filter. Knowing the parameters of the moving average filter, is it possible to reconstruct/constrain the values of the original? When considering deconvolution, there is much discussion in the literature of the form and magnitude of measurement error, but the variation in signal due to this component is much less than the non-stationary component (generated by the physical process generating the signal), if that knowledge helps in the analysis. This is not my primary domain of expertise so my apologies if it is a simple question (even getting a gauge of whether this is simple or difficult would be helpful). I wonder if I need to look into Gabor deconvolution or other topics that would help me understand an approach to this problem. Thanks very much.&lt;/p&gt;&#xA;" OwnerUserId="5362" LastEditorUserId="5362" LastEditDate="2013-09-03T00:42:41.613" LastActivityDate="2013-09-03T00:42:41.613" Title="Deconvolution of non-stationary, 1-D signal?" Tags="|filters|convolution|moving-average|deconvolution|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10593" PostTypeId="1" AcceptedAnswerId="10651" CreationDate="2013-09-03T05:20:29.890" Score="0" ViewCount="1132" Body="&lt;p&gt;what is '&lt;code&gt;parm&lt;/code&gt;' means when you set the name of wavelet function in &lt;code&gt;cwtft&lt;/code&gt; or &lt;code&gt;icwtft&lt;/code&gt;. &lt;code&gt;wave = {wname,[7.6]}&lt;/code&gt;. also can I change Fb and Fc when I use '&lt;code&gt;morl&lt;/code&gt;' function in &lt;code&gt;cwtft&lt;/code&gt; or &lt;code&gt;icwtft&lt;/code&gt; transform? and If not, then how can I reconstruct my signal with &lt;code&gt;cwt&lt;/code&gt; transform? cause cwt let me to select optional value for fb and fc (&lt;code&gt;cmorfb-fc&lt;/code&gt;). Matlab doesn't have direct function for inverse wavelet transform.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 1024;&#xA;t = linspace(0,1,N);&#xA;y = sin(2*pi*8*t).*(t&amp;lt;=0.5)+sin(2*pi*16*t).*(t&amp;gt;0.5);&#xA;dt = 0.05;s0 = 2*dt;ds = 0.4875;NbSc = 20;&#xA;wname = 'morl';sig = {y,dt};sca = {s0,ds,NbSc};&#xA;wave = {wname,[7.6]};&#xA;cwtsig = cwtft(sig,'scales',sca,'wavelet',wave);&#xA;sigrec = icwtft(cwtsig,'signal',sig,'plot'); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-09-06T19:34:25.397" LastActivityDate="2013-09-07T16:50:33.617" Title="inverse continuous wavelet transform and [Parm] in cwtft" Tags="|matlab|wavelet|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10594" PostTypeId="2" ParentId="2386" CreationDate="2013-09-03T10:07:32.913" Score="4" Body="&lt;p&gt;Voice Activity Detection using Adaptive Threshold is very easy and handy to implement on any platform &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you can have a algorithm which is &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.176.6740&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Adaptive Energy based&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Small addition to above algorithm when you are calculating for very first time go for taking Mean of Energy and mark as Emin &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this the frame you pass is divided in to sub-frames and further you can examine each sub-frame for its activity &lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can overcome further problems with overlapped frames &lt;/p&gt;&#xA;" OwnerUserId="4513" LastActivityDate="2013-09-03T10:07:32.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10595" PostTypeId="1" AcceptedAnswerId="10598" CreationDate="2013-09-03T10:22:41.633" Score="23" ViewCount="16643" Body="&lt;p&gt;I'm trying to get an understanding of the relationship between an FIR filter designed from &quot;first principles&quot; using a filter kernel with convolution, and a filter designed in one of two ways using FFT (see below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I understand, the impulse response of an FIR filter is the same thing as the filter's convolution kernel. (Correct me if I'm wrong.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in my understanding, the component frequencies (i.e. Fourier transform) of an FIR filter's impulse response is the same thing as the filter's frequency response. And, therefore, the inverse fourier transform will give me back the impulse response.(Again, correct me if I'm wrong).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leads me to two conclusions (ignoring phase response, or assuming linear phase response):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I should be able to design an FIR filter of arbitrary frequency response by &quot;drawing&quot; my desired frequency response, taking an IFFT to get the impulse response, and using that as my convolution kernel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alternatively, I should be able to create a filter by taking the FFT of the input signal, multiplying by my desired arbitrary frequency response in the frequency domain, and taking an IFFT of the result to produce the output signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Intuitively, it feels like 1 &amp;amp; 2 are equivalent, but I'm not sure if I could prove that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like people (and DSP literature) go to great lengths to design FIR kernels with predefined responses, using complicated (to me) algorithms like Chebyshev or Remez (I'm throwing out some names I've read, without really understanding them).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why go to these lengths, when an FFT/IFFT transform exists for every possible FIR kernel? &lt;/li&gt;&#xA;&lt;li&gt;Why not simply draw the exact frequency response you desire, take an IFFT, and there's your FIR kernel (method 1 above)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2076" LastEditorUserId="1629" LastEditDate="2016-05-30T11:45:45.647" LastActivityDate="2023-05-03T12:14:46.723" Title="What are the problems with designing an FIR filter using FFT?" Tags="|fft|filters|discrete-signals|convolution|" AnswerCount="6" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10596" PostTypeId="2" ParentId="10482" CreationDate="2013-09-03T10:28:17.973" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Unsharp_masking#Local_contrast_enhancement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Local contrast enhancement&lt;/a&gt;&#xA;a.k.a. Unsharp masking&#xA;is a simple, fast method for modeling, then removing, smooth (low-frequency) background noise.&#xA;In a nutshell,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;extract a smooth background image with a wide-radius lowpass filter&lt;/li&gt;&#xA;&lt;li&gt;sharper_image = image + c * (image - background), c ~ 10 % or so: highpass&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Using&#xA;&lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/tutorial/ndimage.html#smoothing-filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;scipy.ndimage&lt;/a&gt;, this is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def sharpen( image, radius, howfar, background ):&#xA;    &quot;&quot;&quot; in: greyscale image, a 2d, 3d ...  numpy array&#xA;        out = extrapolated highpass&#xA;        background: lowpass the image, in time ~ Npixel * (2 radius + 1) * ndim&#xA;        then highpass: background ---&amp;gt; image ---&amp;gt; sharpened image, in time ~ Npixel&#xA;            howfar     -1              0          .5 ...&#xA;    &quot;&quot;&quot;&#xA;    sigma = int( radius / 4. + .5 )  # r = int( 4 * sigma + .5 )&#xA;    ndimage.gaussian_filter( image, output=background, sigma=sigma, mode=&quot;nearest&quot; )&#xA;    return image + howfar * (image - background)  # clip &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some notes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course you'll have to experiment with &lt;code&gt;radius&lt;/code&gt; and &lt;code&gt;howfar&lt;/code&gt; for your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the smoothing filter (1d) outside the loop, then do &lt;code&gt;convolve&lt;/code&gt; or &lt;code&gt;convolve_1d&lt;/code&gt;&#xA;for each frame. &#xA;If the background changes slowly, update only 1/2 or 1/10 of it on each frame.&#xA;For example, alternate &lt;code&gt;convolve_1d&lt;/code&gt; ( horizontal lines, vertical lines, horizontal ... )&lt;br&gt;&#xA;or ( every 5 th H line, every 5 th V line, next 5 th H ... ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Experts may know of smarter ways of tracking &lt;code&gt;background&lt;/code&gt; only where it's changing.&lt;br&gt;&#xA;(As I undersand it, that's your original question, but LMS seems to me, non-expert, overkill for that;&#xA;here we have a fast simple inner loop.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Color: you don't want to interpolate colors in RGB space, much less extrapolate,&#xA;because &quot;between&quot; gets screwy colors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Some follow-up questions, maybe enough for a wiki:&lt;br&gt;&#xA;What C++ image libraries have fast 2d / 3d gaussian_filter / fast extrpolation&lt;br&gt;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;and&lt;/em&gt; reasonable doc, clean, small, opensource, bindings for Python ... ?&lt;br&gt;&#xA;Is there a constant-time 2d / 3d gaussian filter, independent of radius ?&lt;br&gt;&#xA;Color: RGB -&gt; Lab or YIQ -&gt; sharpen luma only, leave color asis ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also:&lt;br&gt;&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/2938162/how-does-an-unsharp-mask-work&quot;&gt;how-does-an-unsharp-mask-work&lt;/a&gt; on SO&lt;br&gt;&#xA;Haeberli and Voorhies,&#xA;&lt;a href=&quot;http://www.graficaobscura.com/interp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Processing By Interp and Extrapolation&lt;/a&gt;, 1994, 3p.&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-09-05T11:55:49.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10597" PostTypeId="1" CreationDate="2013-09-03T10:44:35.953" Score="4" ViewCount="6651" Body="&lt;p&gt;A classical technique in still images (e.g. fluorescence microscopy images) to remove uneven illumination and isolate bright blobs is to use morphological operation such as the top-hat transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance the Rolling-ball algorithm[1] uses a ball as a structuring element and performs the top-hat transform[2].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The structuring element is a grayscale element that extends the disk structuring element in 3D. For instance in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;se2 = strel('ball', 3, 3);&#xA;     0    0.4999    0.9997    1.4996    0.9997    0.4999         0&#xA;0.4999    0.9997    1.4996    1.9995    1.4996    0.9997    0.4999&#xA;0.9997    1.4996    1.9995    2.4994    1.9995    1.4996    0.9997&#xA;1.4996    1.9995    2.4994    2.9992    2.4994    1.9995    1.4996&#xA;0.9997    1.4996    1.9995    2.4994    1.9995    1.4996    0.9997&#xA;0.4999    0.9997    1.4996    1.9995    1.4996    0.9997    0.4999&#xA;     0    0.4999    0.9997    1.4996    0.9997    0.4999         0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My question is: Is it so much better than simply using a binary disk as a structuring element? What are the use cases where a rolling ball is way better, or even required? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My experiments with comparing the outputs of the two do not show a striking difference between the two, but the literature behind the Rolling ball is very abundant. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1] Stanley Sternberg, &quot;Biomedical Image Processing&quot;, IEEE Computer, January 1983&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Here is the source code for a Java implementation in ImageJ: &lt;a href=&quot;http://rsbweb.nih.gov/ij/plugins/download/Rolling_Ball_Background.java&quot; rel=&quot;nofollow&quot;&gt;http://rsbweb.nih.gov/ij/plugins/download/Rolling_Ball_Background.java&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="756" LastActivityDate="2013-11-24T13:32:22.033" Title="Uneven background subtraction: Rolling ball vs Disk tophat" Tags="|morphological-operations|background-subtraction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10598" PostTypeId="2" ParentId="10595" CreationDate="2013-09-03T11:57:30.883" Score="13" Body="&lt;p&gt;One reason you see people designing FIR filters, rather than taking a direct approach (like both 1 and 2) is that the direct approach usually fails to take into account the periodicity in the frequency domain, and the fact that convolution implemented using &lt;a href=&quot;http://en.wikipedia.org/wiki/Circular_convolution&quot;&gt;an FFT is &lt;em&gt;circular&lt;/em&gt; convolution&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you have a signal $x = [ 1, 2, 3, 4]$ and a filter impulse response (convolution kernel; you are correct they are the same) $h = [ 1, 1 ]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convolution $y = x *h$ is $[1, 3, 5, 7, 4]$, a 5-length vector.  If you use the FFT (of the wrong length, 4) then the answer you get is $[3, 5, 7, 5]$.  The reason for the difference is that the result of linear convolution of these two is length 5, but the result of circular convolution is whatever the FFT length was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the FFT length is greater than or equal to the length of the result of linear convolution, then the two are the same.  Otherwise, the two are not the same (unless the data somehow conspires to make it so, e.g. if one signal was zero).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-09-03T11:57:30.883" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10599" PostTypeId="2" ParentId="10595" CreationDate="2013-09-03T12:58:27.423" Score="6" Body="&lt;p&gt;Re 1): Yes, you can design an FIR filter by &quot;drawing&quot; the frequency response (in both magnitude and phase. However, this tends to be very inefficient: the length of the impulse response (and the filter order) is simply pre-determined by your FFT length. If you chose a 128 point FFT you get 128 taps for impulse response and if you chose 4096 point FFT you get 4096 filter taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Re 2): Yes, you can filter by multiplication in the frequency domain and that's indeed the only way to do it efficiently for large impulse responses. However, as Peter K has pointed out, multiplication in the frequency domain corresponds to circular convolution. The most common way to implement linear convolution are &quot;overlap add&quot; or &quot;overlap save&quot; algorithms (easily googled).&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-09-03T12:58:27.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10600" PostTypeId="2" ParentId="10595" CreationDate="2013-09-03T13:07:57.867" Score="10" Body="&lt;p&gt;One problem is dealing with infinite length transforms that wrap-around when using a finite length FFT.  The Fourier transform of a finite length frequency response is an infinite length impulse response or filter kernel.  Most people would like their filter to finish before they die or run out of computer memory, so need tricks to produce shorter FIR filters.  Just letting the tail of the infinite impulse response wrap-around the FFT, or truncating it short to some generic length, may produce an inferior FIR filter for your desired frequency spec compared against one of the &quot;classical&quot; filter prototypes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem is that a random &quot;drawn&quot; frequency response very often has an awful response (wild overshoots) between the drawn points at any finite resolution.  Convert to a FIR filter, and it rings like crazy.  The classical filter prototypes are designed to have frequency response functions that are smooth between the sample points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your (2) is called fast convolution, and commonly used if the FFT is longer than the length of the data window plus the filter kernel combined, and proper overlap add/save is used to take care of the start/end of each convolution segment or window (since FFTs are usually blocky in length).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-09-04T01:15:49.080" LastActivityDate="2013-09-04T01:15:49.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10601" PostTypeId="2" ParentId="10581" CreationDate="2013-09-03T15:46:36.683" Score="4" Body="&lt;p&gt;A drawback of median filtering is that it erodes the edges of the image. &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_variation_denoising&quot; rel=&quot;nofollow&quot;&gt;TV denoising&lt;/a&gt; is often preferrable, albeit more complex.  Dunno if the GIMP has anything like that.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2013-09-03T15:46:36.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10603" PostTypeId="1" CreationDate="2013-09-03T18:29:39.057" Score="2" ViewCount="1349" Body="&lt;p&gt;Ok, this is leaving me increasingly frustrated. This builds on a previous question &lt;a href=&quot;https://math.stackexchange.com/questions/481772/why-is-this-convolution-true&quot;&gt;here&lt;/a&gt; but I am still not getting the indexing, although I learned from that question all the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Case 1: First convolution equation example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h[k] * h^*[-k] = \sum_{n=-\infty}^{\infty} h[n] \ h^*[n+k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I got the right hand side, was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Make the $h$'s have dummy variables, so $h[n]$ and $h^*[-n]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Flip one of them around, so now I get $h[n]$ and $h^*[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Add the delay $k$ into the one that way flipped, so finally I have $\sum_{n=-\infty}^{\infty} h[n] \ h^*[n+k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great, I have a convolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Case 2: Second convolution example: (Unrelated to first)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{i=-\infty}^{\infty} h[i-m] \ R_{xx}[i].&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here we want to try and find out what convolution this corresponds to. The way to solve this, (apparently), is to make the assumption that another variable $g[n]=h[-n]$, and call it a day. Then we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{i=-\infty}^{\infty} h[i-m] \ R_{xx}[i] = \sum_{i=-\infty}^{\infty} g[-(i-m)] \ R_{xx}[i] = \sum_{i=-\infty}^{\infty} g[m-i] \ R_{xx}[i] = g[m] * R_{xx}[m] = h[-m] * R_{xx}[m]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Case3: The problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my problem. Case 1 showed the steps for how to do a normal convolution. Case 2 showed how the method of substitution works. However, if I try to solve Case 1 using this substitution method, I get the wrong answer, even though it worked on case 2. Why is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To wit - where am I going wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h[k] * h^*[-k] = h[k] * g^*[k] = \sum_{n=-\infty}^{\infty} h[n] \ g^*[k-n] = \sum_{n=-\infty}^{\infty} h[n] \ h^*[-(k-n)] = \sum_{n=-\infty}^{\infty} h[n] \ h^*[n-k] &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is **clearly* the wrong answer! What am I doing wrong here?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-09-06T03:00:52.010" Title="Need help understanding convolution indexing" Tags="|convolution|correlation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10604" PostTypeId="2" ParentId="10597" CreationDate="2013-09-04T00:52:54.200" Score="1" Body="&lt;p&gt;Though I didnot play with the rolling ball algorithm, I guess based on your comparison results it is quite obvious that the two algorithms you are interested in donot have a big difference. This is often the results, when you tried to compare some algorithm which is claimed to be better with some classic algorithm: a paper method is often no better than the classic one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I donot want to frustrate you to implement new methods, but one tip is not to implement a very old paper methods, because if it is useful, it should be implemented somewhere, and you only need to find where it is, otherwise this is a useless method and it is not worthy to use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may try some low-rank approximation based method to remove the illumination difference. This method works quite well on background removal problems. &lt;a href=&quot;http://www.research.rutgers.edu/~shaoting/paper/ECCV12-background.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.research.rutgers.edu/~shaoting/paper/ECCV12-background.pdf&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-09-04T00:52:54.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10605" PostTypeId="1" AcceptedAnswerId="10622" CreationDate="2013-09-04T02:47:33.787" Score="8" ViewCount="19422" Body="&lt;p&gt;For an image $I$, its first order derivatives can be computed using several oprators, such as &#xA;$$K_{sobel} = \left[ \begin{array}{ccc} -1 &amp;amp;0 &amp;amp;1 \\ -2 &amp;amp;0 &amp;amp;2 \\ -1 &amp;amp;0 &amp;amp;1 \end{array}\right]$$&#xA;$$I_{x} = I * K_{sobel},\ I_{y} = I * K_{sobel}.T$$.&#xA;And to compute the second order derivatives $(I_{xx}, I_{yy}, I_{xy})$, I can apply $K_{sobel}$ twice on $I$, however, I wonder are there any kernels which can be applied once to get the second order derivatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I tried, I made up 2 kernels,&#xA;$$K_{xx} = \left[ \begin{array}{ccc} 0 &amp;amp;0 &amp;amp;0 \\ 2 &amp;amp;-4 &amp;amp;2 \\ 0 &amp;amp;0 &amp;amp;0 \end{array}\right]$$ &#xA;$$K_{yy} = \left[ \begin{array}{ccc} 0 &amp;amp;2 &amp;amp;0 \\ 0 &amp;amp;-4 &amp;amp;0 \\ 0 &amp;amp;2 &amp;amp;0 \end{array}\right]$$ &#xA;and $I_{xx} = I * K_{xx},\ I_{yy} = I * K_{yy}$, they look pretty much the same as twice-applied-sobel results, but I failed to find a good kernel for $I_{xy}$, I need your help, any idea is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4811" LastActivityDate="2020-11-20T16:42:19.370" Title="kernels to compute second order derivative of digital image" Tags="|image-processing|gradient|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10606" PostTypeId="2" ParentId="2807" CreationDate="2013-09-04T02:51:08.113" Score="31" Body="&lt;p&gt;I've been reading about this and there are multiple ways to do it, using different size N.  My Matlab is rusty, so here they are in Python (&lt;code&gt;N&lt;/code&gt; is length of input signal &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;k&lt;/code&gt; is &lt;code&gt;arange(N)&lt;/code&gt; = $[0, 1, 2, ..., N-1]$):&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Type 2 DCT using 4N FFT and no shifts&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Signal &lt;code&gt;[a, b, c, d]&lt;/code&gt; becomes &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[0, a, 0, b, 0,  c,  0,  d,  0,  d,  0,  c, 0, b, 0, a]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then take the FFT to get the spectrum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[A, B, C, D, 0, -D, -C, -B, -A, -B, -C, -D, 0, D, C, B]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then throw away everything but the first &lt;code&gt;[A, B, C, D]&lt;/code&gt;, and you're done:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u = zeros(4 * N)&#xA;u[1:2*N:2] = x&#xA;u[2*N+1::2] = x[::-1]&#xA;&#xA;U = fft(u)[:N]&#xA;return U.real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Type 2 DCT using 2N FFT mirrored (Makhoul)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[a, b, c, d]&lt;/code&gt; becomes &lt;code&gt;[a, b, c, d, d, c, b, a]&lt;/code&gt;.  Take the FFT of that to get&#xA;&lt;code&gt;[A, B, C, D, 0, D*, C*, B*]&lt;/code&gt;, then throw away everything but &lt;code&gt;[A, B, C, D]&lt;/code&gt; and multiply it by $e^{-j \pi k \over 2 N}$ (&lt;a href=&quot;https://dsp.stackexchange.com/q/10250/29&quot;&gt;half-sample shift&lt;/a&gt;) to get the DCT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = empty(2*N)&#xA;y[:N] = x&#xA;y[N:] = x[::-1]&#xA;&#xA;Y = fft(y)[:N]&#xA;&#xA;Y *= exp(-1j*pi*k/(2*N))&#xA;return Y.real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Type 2 DCT using 2N FFT padded (Makhoul)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[a, b, c, d]&lt;/code&gt; becomes &lt;code&gt;[a, b, c, d, 0, 0, 0, 0]&lt;/code&gt;.  Take the FFT of that to get&#xA;&lt;code&gt;[A, B, C, D, E, D*, C*, B*]&lt;/code&gt;, then throw away everything but &lt;code&gt;[A, B, C, D]&lt;/code&gt; and multiply it by $2e^{-j \pi k \over 2 N}$ to get the DCT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = zeros(2*N)&#xA;y[:N] = x&#xA;&#xA;Y = fft(y)[:N]&#xA;&#xA;Y *= 2 * exp(-1j*pi*k/(2*N))&#xA;return Y.real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Type 2 DCT using N FFT (Makhoul)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Signal &lt;code&gt;[a, b, c, d, e, f]&lt;/code&gt; becomes &lt;code&gt;[a, c, e, f, d, b]&lt;/code&gt;, then take the FFT to get &lt;code&gt;[A, B, C, D, C*, B*]&lt;/code&gt;.  Multiply by $2 e^{-j \pi k \over 2N}$ and then take the real part:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = empty_like(x)&#xA;v[:(N-1)//2+1] = x[::2]&#xA;&#xA;if N % 2: # odd length&#xA;    v[(N-1)//2+1:] = x[-2::-2]&#xA;else: # even length&#xA;    v[(N-1)//2+1:] = x[::-2]&#xA;&#xA;V = fft(v)&#xA;&#xA;V *= 2 * exp(-1j*pi*k/(2*N))&#xA;return V.real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On my machine, these are all roughly the same speed, since generating &lt;code&gt;exp(-1j*pi*k/(2*N))&lt;/code&gt; takes longer than the FFT.  :D&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In [99]: timeit dct2_4nfft(a)&#xA;10 loops, best of 3: 23.6 ms per loop&#xA;&#xA;In [100]: timeit dct2_2nfft_1(a)&#xA;10 loops, best of 3: 20.1 ms per loop&#xA;&#xA;In [101]: timeit dct2_2nfft_2(a)&#xA;10 loops, best of 3: 20.8 ms per loop&#xA;&#xA;In [102]: timeit dct2_nfft(a)&#xA;100 loops, best of 3: 16.4 ms per loop&#xA;&#xA;In [103]: timeit scipy.fftpack.dct(a, 2)&#xA;100 loops, best of 3: 3 ms per loop&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-09-04T02:51:08.113" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="10607" PostTypeId="2" ParentId="10603" CreationDate="2013-09-04T02:58:03.823" Score="3" Body="&lt;p&gt;This question is plagued by bad notation that the OP is unwilling to abandon because, unfortunately, his book uses it. This greatly&#xA;impedes his understanding of the concepts.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Case 1: First convolution equation example:&lt;/strong&gt;&#xA;  $$&#xA;h[k] * h^*[-k] = \sum_{n=-\infty}^{\infty} h[n] \ h^*[n+k]&#xA;$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The way I got the right hand side, was:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1) Make the $h$'s have dummy variables, so $h[n]$ and $h^*[-n]$. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2) Flip one of them around, so now I get $h[n]$ and $h^*[n]$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;3) Add the delay $k$ into the one that way flipped, so finally I have $\sum_{n=-\infty}^{\infty} h[n] \ h^*[n+k]$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;${}{}{}{}{}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No. 3) is not correct. When convolving, you flip one signal and then move it to&#xA;the &lt;em&gt;right&lt;/em&gt; by $k$ which will give you $h^*[n-k]$, not $h^*[n+k]$.  Thus you end&#xA;up with $\sum_n h[n]h^*[n-k]$ as in the leftmost sum in $(2)$ below.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Great, I have a convolution.&lt;/strong&gt;  (emphasis added)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The right side of the last equation is &lt;em&gt;not&lt;/em&gt; generally called&#xA;a convolution; it is called the &lt;em&gt;autocorrelation&lt;/em&gt; function of $h$.&#xA;If $h$ and $g$ are two finite-energy sequences (meaning $\sum_n |g[n]|^2$&#xA;and&#xA;$\sum_n |h[n]|^2$ are finite), then the &lt;strong&gt;$k$-th term of&#xA;their convolution&lt;/strong&gt; is&#xA;$$\sum_{n=-\infty}^\infty h[n]g[k-n] = \sum_{n=-\infty}^\infty h[k-n]g[n].&#xA;\tag{1}$$&#xA;It is &lt;strong&gt;not&lt;/strong&gt; a good idea to use $h[k]\star g[k]$ to denote the&#xA;convolution in general or its $k$-th term in particular&#xA;-- far better to write&#xA;$h\star g$ in general and $(h\star g)[k]$ in particular -- as the&#xA;OP has already been told repeatedly on math.SE. Be that as it may,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;for the case when $g[n] = h^*[-n]$ for &lt;em&gt;all&lt;/em&gt; $n$, we can write $(1)$ as&#xA;  $$\sum_{n=-\infty}^\infty h[n]h^*[n-k] = \sum_{n=-\infty}^\infty h[k-n]h^*[-n]&#xA;= \sum_{m=-\infty}^\infty h[m+k]h^*[m]&#xA;\tag{2}$$&#xA;  where the last equality was obtained by replacing $n$ by $-m$.&#xA;  Notice the difference from the OP's result. For complex-valued&#xA;  sequences, there are two different ways of defining the autocorrelation&#xA;  function $R_{hh}[\cdot]$ depending on which sequence we choose&#xA;  to conjugate, but both ways give the same conjugate symmetry&#xA;  property $R_{hh}[-n] = (R_{hh}[n])^*$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;${}{}{}$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Case3: The problem:&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This is my problem. &lt;strong&gt;Case 1 showed the steps for how to do a normal convolution.&lt;/strong&gt; (emphasis added)&#xA;  Case 2 showed how the method of substitution works. However, if I try to solve Case 1 using this substitution method, I get the wrong answer, even though it worked on case 2. Why is that?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;To wit - where am I going wrong here?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where you are going wrong is that your analysis&#xA;of Case 1 is not quite correct&#xA;as explained above, while your Case 2 is not a convolution at all,&#xA;and is not an autocorrelation or cross-correlation of &lt;em&gt;complex-valued&lt;/em&gt;&#xA;sequences either, because these require conjugation of one of the&#xA;terms.  So you are really mixing up things and then complaining that&#xA;the answers are not the same.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-09-06T03:00:52.010" LastActivityDate="2013-09-06T03:00:52.010" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10609" PostTypeId="1" AcceptedAnswerId="10611" CreationDate="2013-09-04T05:05:04.833" Score="2" ViewCount="4583" Body="&lt;p&gt;Having found some unofficial sources on &lt;strong&gt;Complementary Filter&lt;/strong&gt; (&lt;a href=&quot;http://www.thousand-thoughts.com/2012/03/android-sensor-fusion-tutorial/&quot; rel=&quot;nofollow&quot;&gt;Thousand Thoughts Sensor Fusion&lt;/a&gt; and &lt;a href=&quot;http://www.filedump.net/dumped/filter1285099462.pdf&quot; rel=&quot;nofollow&quot;&gt;The Balance Filter by Shane Colton&lt;/a&gt;), I wish to work out its rigorous mathematical proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;Complementary Filter&lt;/strong&gt;,&#xA;$$y=\alpha \times y+(1-\alpha) \times x$$&#xA;where $\alpha$ is the filter parameter, usually chosen to be ~0.98, is named as such, because effectively the filter highpasses $y$ and lowpasses $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this setup ($\alpha=0.98$), man claims that the filter can filter out the low-frequency part of $y$ and meanwhile the high-frequency part of $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the mathematical proof here?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no rigorous proof so far available. All the sources simply take it as granted and validates it with experiment data, which is unacceptable in scientific validation.&lt;/p&gt;&#xA;" OwnerUserId="4677" LastActivityDate="2015-06-20T13:46:15.287" Title="Mathematical Proof of Complementary Filter？" Tags="|filters|filter-design|lowpass-filter|highpass-filter|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10610" PostTypeId="1" CreationDate="2013-09-04T06:46:24.213" Score="1" ViewCount="822" Body="&lt;p&gt;I know that a function &lt;span class=&quot;math-container&quot;&gt;$f_a\in \text{L}^2(\mathrm{R})$&lt;/span&gt; is an &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;analytic signal&lt;/em&gt;&lt;/a&gt; if its Fourier transform is 0 for negative frequencies, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{f_a}(\omega)=0$ if $\omega&amp;lt;0 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can characterize an analytic function by its real part &lt;span class=&quot;math-container&quot;&gt;$f = \text{Re}[f_a]$&lt;/span&gt;, and the Fourier transform of this function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{f_a}(\omega)=\left\{\begin{matrix}&#xA;2\hat{f}(\omega) &amp;amp; \text{if }\omega\geq0 \\ &#xA;0 &amp;amp; \text{if }\omega&amp;lt;0&#xA;\end{matrix}\right. $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if we have a discrete signal &lt;span class=&quot;math-container&quot;&gt;$f[n]$&lt;/span&gt; of size &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, we can also compute &lt;span class=&quot;math-container&quot;&gt;$f_a[n]$&lt;/span&gt; by setting the negative frequency components of its discrete Fourier transform to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now why is it that if we want &lt;span class=&quot;math-container&quot;&gt;$\text{Re}[f_a]=f$&lt;/span&gt;, then we must have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{f_a}[k]=\left\{\begin{matrix}&#xA;\hat{f}[k] &amp;amp;&amp;amp; \text{if }k=0,N/2\\   &#xA;2\hat{f}[k] &amp;amp;&amp;amp; \text{if }0&amp;lt;k&amp;lt;N/2\\ &#xA;0 &amp;amp;&amp;amp; \text{if } N/2&amp;lt;k&amp;lt;N&#xA;\end{matrix}\right. $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could that be explained?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="128" LastEditDate="2020-03-16T06:18:16.327" LastActivityDate="2020-03-16T06:18:16.327" Title="Understanding Analytic Signals" Tags="|discrete-signals|analytic-signal|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10611" PostTypeId="2" ParentId="10609" CreationDate="2013-09-04T08:50:46.063" Score="5" Body="&lt;p&gt;This is a first order, low pass infinite impulse response filter (IIR).  It is some times called the exponentially weighted moving average.  &lt;a href=&quot;http://en.wikipedia.org/wiki/Low-pass_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;You can find the derivation on Wikipedia.&lt;/a&gt; &lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Orfanidis' Introduction to Signal Processing gives a nice description as well.&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zwaov.png&quot; alt=&quot;Picture from Orfanidis, page 573.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't think of it as high passing y and low passing x, this will lead to confusion.  It is weighting y more heavily than x, the consequence is short time variations of x have a small effect on y, therefore removing higher frequencies.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also looking at your other questions, it appears that you think that this is a high pass filter as well.  This is not the case.  α is valid from 0 to 1, so you can see that you will get a lot of low pass filtering (High time constant, limited by your digital precision) or no filtering where y = x ( In the case of x = 0).  Read up on high pass filters if you need one, wikipedia gives the difference equation (you have provided the low pass one) for a single order high pass filter.  &lt;/p&gt;&#xA;" OwnerUserId="4487" LastEditorUserId="80" LastEditDate="2013-09-04T12:08:35.223" LastActivityDate="2013-09-04T12:08:35.223" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10612" PostTypeId="2" ParentId="10610" CreationDate="2013-09-04T09:04:46.367" Score="1" Body="&lt;p&gt;It's not clear what you're asking, but I think you want to know why the DFT of a signal has extra conditions for it to real. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the continuous case: the 2 is there because we need a function to be symmetric to have a real Fourier transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the discrete case, the DFT obey the symmtery: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_{N-k} = X_{-k} = X_k^* &#xA;$$&#xA;i.e. conjugate symmetry (half the values are just complex conjugates of the other half). Thus $X_0$ and $X_{N/2}$ are real numbers whilst the remainder of the DFT is specified by $N/2-1$ complex numbers (hence the 2 in the second line). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://math.stackexchange.com/questions/5696/is-a-function-analytical-on-c-iff-its-fourier-transform-vanishes-for-negative-fr&quot;&gt;Also, the answers to this question.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;offer counterexamples to your first statement - that analytic functions have vanishing negative frequencies.&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-11-03T23:15:23.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10613" PostTypeId="2" ParentId="10220" CreationDate="2013-09-04T09:07:14.993" Score="1" Body="&lt;p&gt;This is the difference equation for a low pass filter.  Five time constants (5 * 1 time constant) is the time it will take to for the output, to reach 99.33% of the value of the input, from when the input changes from 0 to its final value, and stays there (a step response).  This comes from 1-e^(-5).  As you are specifying time constants, it implies you want a time domain definition for use as a moving average filter, so specify the period of averaging you would like, assume that as 5 time constants and divide by 5 five to get one time constant for use in the equation you have quoted above.  &lt;/p&gt;&#xA;" OwnerUserId="4487" LastActivityDate="2013-09-04T09:07:14.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10614" PostTypeId="2" ParentId="10593" CreationDate="2013-09-04T09:27:08.557" Score="0" Body="&lt;p&gt;Why won't cmorwavf work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.co.uk/help/wavelet/ref/cmorwavf.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.co.uk/help/wavelet/ref/cmorwavf.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you then construct a matrix of (complex) Morlet wavelet co-efficients (suitably dilated and translated) and simply invert it for the inverse wavelet transform?&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-09-04T09:27:08.557" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="10615" PostTypeId="2" ParentId="10603" CreationDate="2013-09-04T11:54:38.907" Score="2" Body="&lt;p&gt;Case 1 is an autocorrelation (in this case of the impulse response of your systems), which your book clearly states. It measures the similarity between two sequences, whereas the convolution measures the overlap of two sequences. A convolution would have a negative delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second case, I'm not sure is a convolution at all. You're trying to convolve the impulse response of a channel with the autocorrelation matrix - but you only give a single index for the matrix. I think you've missed out an implicit sum over one of the indices here. Either way, I'm not sure what it would represent in a statistical signal processing context. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the third case, when you flip the 'g' function you need the delay should go the other way i.e. g[-k-n], to be consistent with the substitution you've made. This will end up with an autocorrelation. However, as has been noted, this isn't a convolution - but what you've written above is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that convolutions and correlations are &lt;em&gt;not&lt;/em&gt; quite the same thing just with different signs. For instance, blur on an image is a convolution with a blurring operator and the un-blurred image. The correlation of those two sequences will be different.&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-09-04T11:54:38.907" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10618" PostTypeId="2" ParentId="10605" CreationDate="2013-09-04T14:58:28.503" Score="1" Body="&lt;p&gt;What you are looking for is the so-called &quot;Laplacian operator&quot; (&lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_operator&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Laplace_operator&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Laplace_operator&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Discrete_Laplace_operator&lt;/a&gt;). In image processing, people often use the Laplacian of Gaussian, which is simply the difference between the two results of convolving one input image with two different Gaussian kernels. You may check details here (&lt;a href=&quot;http://fourier.eng.hmc.edu/e161/lectures/gradient/node9.html&quot; rel=&quot;nofollow&quot;&gt;http://fourier.eng.hmc.edu/e161/lectures/gradient/node9.html&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2013-09-04T14:58:28.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10619" PostTypeId="1" CreationDate="2013-09-04T16:48:41.130" Score="3" ViewCount="1168" Body="&lt;p&gt;By using Python (numpy/sklearn/opencv) I'm trying to process images with hand-written digits, and after all my main problem turns to be connected digits. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/56gyU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I crop the digits by hand I get expected output, by taking advantage from NIST dataset, and sklearn SVC classifier, but segmenting the digits seems like impossible task to me.&#xA;Does anyone know of programmatic approach (like library or similar) for this task, regardless programming language, but preferable in Python?&lt;/p&gt;&#xA;" OwnerUserId="719" LastActivityDate="2013-09-04T16:48:41.130" Title="Segmenting connected hand-written digits" Tags="|image-segmentation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10620" PostTypeId="1" AcceptedAnswerId="10623" CreationDate="2013-09-04T16:59:04.903" Score="1" ViewCount="975" Body="&lt;p&gt;I have 6.4 sec recording of a discrete signal on 40Hz frequency (256 values).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I compute the variance of the signal?&#xA;Please, share an algorithm in pseudo-code or in an actual programming language.&lt;/p&gt;&#xA;" OwnerUserId="5375" LastActivityDate="2013-09-04T22:57:42.137" Title="Algorithm to compute the Variance of the signal?" Tags="|discrete-signals|algorithms|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10621" PostTypeId="2" ParentId="10620" CreationDate="2013-09-04T17:21:41.233" Score="0" Body="&lt;p&gt;Here is an article on what is &lt;a href=&quot;http://en.wikipedia.org/wiki/Variance&quot; rel=&quot;nofollow&quot;&gt;Variance&lt;/a&gt; and how to calculate it. If you are using Matlab then you can form a column matrix consisting of the 256 values and send it to the &lt;a href=&quot;http://www.mathworks.nl/help/matlab/ref/var.html&quot; rel=&quot;nofollow&quot;&gt;var&lt;/a&gt; function in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="4902" LastActivityDate="2013-09-04T17:21:41.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10622" PostTypeId="2" ParentId="10605" CreationDate="2013-09-04T18:02:51.837" Score="15" Body="&lt;p&gt;Convolution &lt;span class=&quot;math-container&quot;&gt;$(*)$&lt;/span&gt; is associative, so&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I_{xx} = K_{sobel} * (K_{sobel} * I) = (K_{sobel} * K_{sobel}) * I$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;meaning the convolution of a 1st order Sobel filter kernel with another 1st order Sobel filter gives the filter kernel for a second order filter. So e.g. a 2nd order horizontal Sobel filter kernel is:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left(&#xA;\begin{array}{ccc}&#xA; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA; -2 &amp;amp; 0 &amp;amp; 2 \\&#xA; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right) * \left(&#xA;\begin{array}{ccc}&#xA; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA; -2 &amp;amp; 0 &amp;amp; 2 \\&#xA; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)=\left(&#xA;\begin{array}{ccccc}&#xA; 1 &amp;amp; 0 &amp;amp; -2 &amp;amp; 0 &amp;amp; 1 \\&#xA; 4 &amp;amp; 0 &amp;amp; -8 &amp;amp; 0 &amp;amp; 4 \\&#xA; 6 &amp;amp; 0 &amp;amp; -12 &amp;amp; 0 &amp;amp; 6 \\&#xA; 4 &amp;amp; 0 &amp;amp; -8 &amp;amp; 0 &amp;amp; 4 \\&#xA; 1 &amp;amp; 0 &amp;amp; -2 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;And for &lt;span class=&quot;math-container&quot;&gt;$I_{xy}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left(&#xA;\begin{array}{ccc}&#xA; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA; -2 &amp;amp; 0 &amp;amp; 2 \\&#xA; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right) * \left(&#xA;\begin{array}{ccc}&#xA; -1 &amp;amp; -2 &amp;amp; -1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 1 &amp;amp; 2 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)=\left(&#xA;\begin{array}{ccccc}&#xA; 1 &amp;amp; 2 &amp;amp; 0 &amp;amp; -2 &amp;amp; -1 \\&#xA; 2 &amp;amp; 4 &amp;amp; 0 &amp;amp; -4 &amp;amp; -2 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; -2 &amp;amp; -4 &amp;amp; 0 &amp;amp; 4 &amp;amp; 2 \\&#xA; -1 &amp;amp; -2 &amp;amp; 0 &amp;amp; 2 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If you want a 3x3 kernel, you can use the 1st order derivative filter &lt;span class=&quot;math-container&quot;&gt;$\left(&#xA;\begin{array}{cc}&#xA; -1 &amp;amp; 1 \\&#xA; -1 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)$&lt;/span&gt;, which leads to the second order filters:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left(&#xA;\begin{array}{cc}&#xA; -1 &amp;amp; 1 \\&#xA; -1 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)*\left(&#xA;\begin{array}{cc}&#xA; -1 &amp;amp; 1 \\&#xA; -1 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)=\left(&#xA;\begin{array}{ccc}&#xA; 1 &amp;amp; -2 &amp;amp; 1 \\&#xA; 2 &amp;amp; -4 &amp;amp; 2 \\&#xA; 1 &amp;amp; -2 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left(&#xA;\begin{array}{cc}&#xA; -1 &amp;amp; -1 \\&#xA; 1 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)*\left(&#xA;\begin{array}{cc}&#xA; -1 &amp;amp; 1 \\&#xA; -1 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)=\left(&#xA;\begin{array}{ccc}&#xA; 1 &amp;amp; 0 &amp;amp; -1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="291" LastEditorUserId="11599" LastEditDate="2020-11-20T16:42:19.370" LastActivityDate="2020-11-20T16:42:19.370" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10623" PostTypeId="2" ParentId="10620" CreationDate="2013-09-04T19:15:55.883" Score="3" Body="&lt;p&gt;You want the &lt;a href=&quot;http://en.wikipedia.org/wiki/Variance#Sample_variance&quot; rel=&quot;nofollow&quot;&gt;sample variance&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s^2 = \frac{1}{N-1} \sum_{n=0}^{N-1} (x_n - \mu_x)^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the mean, $\mu_x$, is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mu_x = \frac{1}{N} \sum_{n=0}^{N-1} x_n.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\frac{1}{N-1}$ factor should be used to account for the bias that is otherwise there if $\frac{1}{N}$ is used. One way to think about this is the sample variance is computed from $N-1$ &lt;em&gt;differences&lt;/em&gt; between samples, rather than $N$ samples.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-09-04T19:15:55.883" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10624" PostTypeId="2" ParentId="10620" CreationDate="2013-09-04T20:26:49.153" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Variance#Sample_variance&quot; rel=&quot;nofollow&quot;&gt;Sample Variance&lt;/a&gt; $s^2$ of a signal $\mathbf{y}$ with sample average $\mu$ may be computed as:&#xA;$$&#xA;\begin{align*}&#xA;s^2 &amp;amp;= \frac{1}{N-1} \sum_{i=1}^N (y_i - \mu)^2 \\&#xA;&amp;amp;= \frac{1}{N-1} \sum_{i=1}^N \left( \mu^2 - 2 \mu y_i + y_i^2 \right) \\&#xA;&amp;amp;= \frac{1}{N-1} \left[ N \mu^2 - 2 \mu \sum_{i=1}^N y_i + \sum_{i=1}^N y_i^2 \right] \\&#xA;&amp;amp;= \frac{1}{N-1} \left[ N \left(\frac{1}{N} \sum_{i=1}^N y_i \right)^2 - 2 \left(\frac{1}{N} \sum_{i=1}^N y_i \right) \sum_{i=1}^N y_i + \sum_{i=1}^N y_i^2 \right] &amp;amp;\left( \mu = \frac{1}{N} \sum_{i=1}^N y_i \right) \\&#xA;&amp;amp;= \frac{1}{N-1} \left[ N \left(\frac{1}{N} \sum_{i=1}^N y_i \right)^2 - 2 N \left(\frac{1}{N} \sum_{i=1}^N y_i \right)^2 + \sum_{i=1}^N y_i^2 \right] \\&#xA;&amp;amp;= \frac{1}{N-1} \left[ -N \left(\frac{1}{N} \sum_{i=1}^N y_i \right)^2 + \sum_{i=1}^N y_i^2 \right] \\&#xA;&amp;amp;= \frac{1}{N-1} \left[ -\frac{1}{N} \left(\sum_{i=1}^N y_i \right)^2 + \sum_{i=1}^N y_i^2 \right]&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is an example in C++ code that implements the above equation.  It may not be completely optimized, but it should be fairly efficient:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double sample_variance(double *signal, unsigned int signal_length)&#xA;{&#xA;  double sum = 0.0;&#xA;  double sum2 = 0.0;&#xA;  for (unsigned int i=0; i&amp;lt;signal_length; i++)&#xA;  {&#xA;    sum += signal[i];&#xA;    sum2 += signal[i]*signal[i];&#xA;  }&#xA;&#xA;  double N = (double)signal_length;&#xA;  return (sum2 - sum*sum/N)/(N-1.0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5156" LastEditorUserId="5156" LastEditDate="2013-09-04T22:57:42.137" LastActivityDate="2013-09-04T22:57:42.137" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10625" PostTypeId="1" AcceptedAnswerId="10626" CreationDate="2013-09-04T23:24:49.390" Score="2" ViewCount="98" Body="&lt;p&gt;Given that $|a|&amp;lt;1$, then which of those inverse-Z-transform equations are we to use? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QSJXY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am leaning towards the first because (as I understand it), $z$ is merely a complex number that is evaluated on the unit circle, and thus $|z|$ must always equal 1? I guess my question is, when is $|z|=1$? Always?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="80" LastEditDate="2013-09-05T00:18:26.603" LastActivityDate="2013-09-05T01:16:46.230" Title="Choosing inverse Z-transform equation, given that $|a|&lt;1$" Tags="|infinite-impulse-response|linear-systems|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10626" PostTypeId="2" ParentId="10625" CreationDate="2013-09-05T01:16:46.230" Score="3" Body="&lt;p&gt;Which one you choose is quite arbitrary: it depends on which &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Region_of_convergence&quot; rel=&quot;nofollow&quot;&gt;region of convergence&lt;/a&gt; (ROC) you choose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Example_2_.28causal_ROC.29&quot; rel=&quot;nofollow&quot;&gt;Example 2&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Example_3_.28anticausal_ROC.29&quot; rel=&quot;nofollow&quot;&gt;Example 3&lt;/a&gt; of that wikipedia page shows, if you want the signal to be causal, then choose the first one. If you want the signal to be anti-causal, choose the second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to think about it is what happens when $|z| = 1$. On the unit circle is where the Fourier transform of the signal is defined. If you want that to be finite, then you need to choose the inverse that includes the unit circle.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-09-05T01:16:46.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10627" PostTypeId="2" ParentId="10553" CreationDate="2013-09-05T06:48:08.057" Score="1" Body="&lt;p&gt;If there &lt;em&gt;was&lt;/em&gt; intersymbol interference or additive noise in your simulation you could calculate the noise term by taking the difference of the transmit signal $x(k)$ (before pulse shaper) and the received signal $r(k)$ (after sampler):&#xA;$$&#xA;n(k) = r(k) - x(k),&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k$ is the discrete time and is omitted in the following. Computation of the signal to interference and noise ratio (SINR) is then straightforward:&#xA;$$&#xA;\gamma_\mathrm{SINR} = \frac{\mathrm E[|x|^2]}{\mathrm E[|n|^2]} = \frac{\sum_{k} |x|^2}{\sum_{k} |n|^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathrm E[]$ is the expectation operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your simulation, $x$ corresponds to &lt;em&gt;input signal&lt;/em&gt; and $r$ to &lt;em&gt;filtered signal&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-09-05T06:48:08.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10628" PostTypeId="1" AcceptedAnswerId="10636" CreationDate="2013-09-05T13:40:25.210" Score="0" ViewCount="666" Body="&lt;p&gt;I have one and only one frequency signal, a sine signal at f = 10 kHz that is sampled at Fs = 320 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read about applying a simple analog anti aliasing (AAA) filter then oversample, do some digital anti aliasing (DAA) and decimate to get the correct signal frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand how this is useful if signals of interest are close to Fs/2 as it might be hard to find an AAA filter that has sharp enough roll-off, low cost, simplicity etc. And therefore DAA filter in combination with a simple AAA filter is often preferred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in my case I don't have a signal close to Fs/2 at all. So I was thinking maybe I can get a slower/cheaper ADC and do no oversampling, since I might be able to properly attenuate frequencies that might alias even using a simple AAA? Is what I am thinking correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Additional related question:&lt;/strong&gt;&#xA;How would this work if I was to apply equivalent time sampling (ETS) technique? This means that the signal is 10 kHz and the sampling frequency appears to be 320 kHz as well, but 32 samples are taken over 32 periods of the 10 kHz signal to produce 1 period. So the sampling rate is actually 10 kHz + (10 kHz / 32) = 10.3125 kHz. What I am not able to wrap my head around: will Fs = 10.3125 kHz or 320 kHz? Will the same filter work for both cases? I assume Fs = 10.3125 kHz thus giving a problem as the transition area will be relatively very small: Fs - f = 3125 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Other thoughts:&lt;/strong&gt;&#xA;I am using a DDS to generate the sine signal, it should be quite pure and maybe AAA is not &quot;needed&quot; / very important?&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2013-09-06T13:34:43.360" Title="Simple analog anti aliasing filter good enough if signal frequency is far from sampling frequency ? What about equivalent time sampling?" Tags="|filters|aliasing|analog|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10630" PostTypeId="1" AcceptedAnswerId="10632" CreationDate="2013-09-05T15:56:02.330" Score="4" ViewCount="3447" Body="&lt;p&gt;Sorry if this sounds elementary but I am struggling to grasp the physical idea behind ARMA (auto-regressive, moving average) process. The &quot;AR&quot; part is intuitive and so is &quot;MA&quot;, but put together?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I model my time series using &quot;AR&quot;, I can predict the next sample using linear terms of the previous samples and the difference between the predicted and the real one should then have a normal distribution provided the noise was guassian white (the unpredictable).&#xA;But what does it mean to say that my time series can be ARMA modelled? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2013-09-05T16:31:00.217" Title="ARMA vs. AR and then what?" Tags="|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10632" PostTypeId="2" ParentId="10630" CreationDate="2013-09-05T16:31:00.217" Score="4" Body="&lt;p&gt;The arma approach is to model the current output of the system as the sum of past outputs and past inputs explicitly. The assumption of gaussian model for the noise statistics still can be used for the unpredictable signal which cannot be modeled as arma.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From system's frequency response spectrum modeling aspect: an ar model is able to model only the spectrum peaks as it fits the peaks better (using poles) and the ma model is able to model the valleys better (using zeros) in the spectrum. Hence, by using an arma model we will be better enable both peaks and valleys using a reasonable order for both ar and ma. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is always possible to model a zero (in z-domain) using a infinite number of poles so an approximation to an arma model (whose parameter estimation is relatively involved) is to use a high order ar model (whose paramter estimation is relatively easy).&lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2013-09-05T16:31:00.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10633" PostTypeId="1" CreationDate="2013-09-05T16:46:23.397" Score="6" ViewCount="1373" Body="&lt;p&gt;I'm not a signal processing person at all so hopefully I'm not asking an obvious question (if I am, I'd appreciate any resources that would help give more context).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a 1D vector where the values give temperature at some position. I want to find out where the regions of greatest change are and then mark off those regions for future sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current method is to take the gradient of the signal and either convolve that gradient with some window or average past signals (in time) with this current one. Both approaches are in an effort to reduce noise and/or overfitting to one particular signal in time. Once I get this smoothed signal, I fit a Gaussian function to it and mark off the regions that are within 4 standard deviations of the mean. (If there are multiple peaks, the hope is that the smoothing or convolution will make it smoothed enough so that the Gaussian will capture both peaks, but this fails sometimes which is why I'm looking for something more robust. An extension to this would be to try and fit multiple Gaussians as well, if it is a sensible idea in general.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a quick plot I was using to compare the different smoothing windows (the original signal is real data that I'm working with, which usually only has one large peak but may have more).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6i5cS.png&quot; alt=&quot;Plot of original signal and convolution with multiple different windows.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Also, the convolution seems to center the peaks away from where they actually are. If there are no better solutions, how can I stop that from happening? &lt;strong&gt;EDIT:&lt;/strong&gt; Peter K.'s comment helped me fix this silly error.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this is a pretty noob approach that I just came up with. Is there a better way? The places I want to sample around are obviously regions around local maxima, but defining what local maxima means seems to be tricky, and it doesn't always give great results. In general, though, I will want to sample continuously around the regions of peaks, i.e. if I have two peaks, one at 5m and one at 10m, I want to sample between, say, 2m and 13m, not chopping it in the middle. It may be worth noting that these signals are a snapshot in time, so perhaps I can take advantage of past signals as well somehow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; As per @Phonon's suggestion, I thought I'd add some more detail about the problem. The signal is actually coming from a sensor that samples along a water column in a lake (the x-axis of the graph is depth, up to 40 meters). Seasonal changes and other variables (like wind speed, humidity, etc.) will create changes in this water column. What I'm trying to do is to figure out how to catch the most pertinent information using the least amount of energy (the sensor has to move up and down). So hence the approach to find the maximum gradient and threshold around it for sampling. However, I wonder if there is a better way. Another one I can think of is to look at how much the signal varies at various depths over time, and sample those regions. I was mainly wondering if there existed some standard methods to do this sort of thing already.&lt;/p&gt;&#xA;" OwnerUserId="5377" LastEditorUserId="128" LastEditDate="2020-03-18T17:23:15.150" LastActivityDate="2024-04-01T07:01:15.117" Title="How Can I Detect Peaks and Regions of Highest Variance in a 1D Signal?" Tags="|discrete-signals|signal-analysis|smoothing|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="10636" PostTypeId="2" ParentId="10628" CreationDate="2013-09-05T22:51:46.573" Score="1" Body="&lt;p&gt;The sampling theorem states that you need at least &quot;two samples per one Hz of bandwidth&quot;. Anti-aliasing filters are required when the bandwidth of the original analog signal is not well defined and a finite bandwidth needs to be enforced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your application that doesn't seem to be the case. If all you want to sample is really just an unmodulated steady-state sine wave, the bandwidth or your original signal is already limited. No anti aliasing filter is needed and you can simply sample at any rate slightly larger than twice the sine wave frequency. 22.05 kHz or 24 kHz in your case would work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ETS is a bit tricky since you need some sort of a trigger mechanism and then a variable delay off that trigger. The equivalent sample rate depends on your delay steps and the whole process depends on the signal being periodic with high precision. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You actually CAN sample at a much lower rate. The theorem requires 2 samples per Hz of bandwidth. For a pures sine wave the actual bandwidth is almost zero so you can sample with a very low sample rate and still don't have any loss of information. You just need to manage the mirror spectra properly, i.e. your application needs to be aware of a frequency offset.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-09-06T13:34:43.360" LastActivityDate="2013-09-06T13:34:43.360" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10638" PostTypeId="1" CreationDate="2013-09-06T15:10:33.520" Score="0" ViewCount="6140" Body="&lt;p&gt;I'm trying to wrap my mind about what happens in Matlab/Octave when you compute the fft of a sine function. Theoretically, the Fourier Transform of a sine is given by two delta functions multiplied by the imaginary unit (one placed at the frequency of the sine and another at minus the frequency). I can see that in the modulus of the FFT (not exactly a delta because of the frequency leakage due to the windowing), but when I check the phase I get a signal that is non-zero over all the support (from 0 to the sampling frequency). I'm playing with this toy example in Octave:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 200,t=-10:(1/fs):10;&#xA;x = sin(2*pi*30*t);&#xA;f = linspace(0,1,length(x))*fs;&#xA;fourierTrans = fft(x);&#xA;figure,plot(f,abs(fourierTrans))&#xA;figure,plot(f,angle(fourierTrans))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the picture I get for the phase is:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WRbvv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it that I don't see two deltas in the picture for phase of amplitude pi/2 and -pi/2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="5385" LastEditorUserId="80" LastEditDate="2013-09-06T15:40:09.943" LastActivityDate="2013-09-06T18:20:43.880" Title="Phase of the FFT of a sine function" Tags="|fft|discrete-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10639" PostTypeId="2" ParentId="10638" CreationDate="2013-09-06T16:45:13.610" Score="1" Body="&lt;p&gt;The phase of a sinewave that is not exactly periodic relative to the FFT aperture length is discontinuous at the edges.  If you want a sane/visualizable phase (not the phase of a discontinuity) for non-periodic frequencies, try generating your sinewave with a known phase at the center of the FFT (sin(2*pi*foo*(t-N/2))), and use an fftshift to re-reference the reported phase result of the FFT to the center of the FFT aperture as well.  Then the oddness/evenness ratio of your test function, and thus the phase result will remain stable as frequency is swept between FFT bin center frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase of a non-periodic-in-aperture sinewave will contain the phase of the convolution of the signal with the transform of the FFT window (something like a Sinc, which ends up spanning the full width of the FFT), which will also have a phase related to that of the signal.  Even a computed FFT of an exactly periodic sinewave will also produce some values that aren't exactly zero in all the other bins due to quantization noise in the computer arithmetic; thus those essentially zero, but not quite zero, magnitudes will have a phase that may or may not be zero.  And the phase of an actual zero magnitude vector is indeterminate, not necessarily zero.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-09-06T17:06:41.143" LastActivityDate="2013-09-06T17:06:41.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10640" PostTypeId="2" ParentId="10012" CreationDate="2013-09-06T17:21:18.850" Score="9" Body="&lt;p&gt;For any single chunk (window) of data the coherence will, as you observed, be 1. In order to properly estimate coherence you must average the spectra and cross-spectra for multiple windows, and THEN calculate coherence. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The auto-spectra XX and YY can be averaged the conventional way. For the cross-spectrum XY you must average the real and imaginary components first before calculating XY = sqrt( XY[imag]^2 + XY[real]^2 ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that help? Averaging over 8 windows usually yields reliable estimates.&lt;/p&gt;&#xA;" OwnerUserId="5386" LastActivityDate="2013-09-06T17:21:18.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10642" PostTypeId="2" ParentId="10638" CreationDate="2013-09-06T18:20:43.880" Score="2" Body="&lt;p&gt;For an ideal sine wave the magnitude of the spectrum is zero at all frequencies except the on of the sine wave itself. Since the magnitude at the other frequencies is 0, the phase is undefined (not zero) and could be anything. In practice it will be determined by noise in the signal or the numerical computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect that you are seeing is related to the fact that your frequency sampling grid (determined by sample rate and FFT length) doesn't line up exactly with the actual sine wave frequency so you have some frequency smearing. Hence the magnitude at the FFT frequencies are not 0 and hence you get a phase. This phase is really just a function of how well (or not) your sine wave lines up with the frequency sampling grid.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-09-06T18:20:43.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10644" PostTypeId="1" CreationDate="2013-09-06T20:22:58.837" Score="3" ViewCount="212" Body="&lt;p&gt;I'm looking for advice or references on how to implement a &quot;type I&quot; compensation network of digitally.  An analog example is shown in the following diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DfnRx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am familiar with the basics of digital signal processing, and have read about digital integrators.  Would it be possible to use something like a first order IIR digital integrator, and just flip the sign of the output depending upon whether the input is above or below VREF? The goal is to drive a PWM output of a microprocessor, so there may be a better way to do this in the digital domain than attempting to copy the analog implementation.  Any advice would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="777" LastActivityDate="2013-09-17T10:37:43.230" Title="Digital implementation of type I compensation network" Tags="|filter-design|feedback|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10646" PostTypeId="1" AcceptedAnswerId="10655" CreationDate="2013-09-07T07:10:50.213" Score="3" ViewCount="19003" Body="&lt;p&gt;I have a vector of signal x(t) with its time vector. I want to obtain a frequency representation of the signal, in particular the energy spectrum of x(t).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Can someone please show some light into obtaining the energy spectrum ?&#xA;Is energy spectrum and energy spectral density ,ESD produce the same result ?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Any help is much appreciated !&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; t = 0:.001:.25;&#xA;x = 5*sin(2*pi*50*t) + 1.2*sin(2*pi*120*t);&#xA;y = x + 2*randn(size(t));&#xA;y=y';&#xA;Fs = 1000; % Sampling frequency&#xA;&#xA;% Fast Fourier Transform &#xA;    L = length (y); % Window Length of FFT&#xA;    nfft = 2^nextpow2(L); % Transform length , Next power of 2 from length of signal&#xA;                          %  Exactly same as nfft = pow2(nextpow2(L)) &#xA;&#xA;% Take fft, padding with zeros so that length(input) is equal to nfft     &#xA;    Ydft = fft(y,nfft)/L;&#xA;&#xA;    y_HamWnd = y.*hamming(L);           %hamming window fft&#xA;    Ydft_HamWnd = fft(y_HamWnd,nfft)/L;&#xA;&#xA;%FFT is symmetric, throw away second half&#xA;&#xA;    % Take the magnitude of fft of x&#xA;%Amplitude Spectrum 01 (Single Sided)&#xA;mY = 2*abs(Ydft(1:nfft/2+1)) ;&#xA;&#xA;%Amplitude Spectrum 02 (Single Sided HamWmd)&#xA;mY_HamWnd = 2*abs(Ydft_HamWnd(1:nfft/2+1));&#xA;&#xA;%Amplitude Spectrum 03 (Single Sided; Exclude DC-- FoldingFreq)&#xA;mY2 = abs(Ydft);&#xA;mY2= mY2(1:nfft/2+1);&#xA;mY2 (2:end-1) = 2* mY2 (2:end-1); &#xA;&#xA;&#xA;    %To get the Power&#xA;% P ; single sided; then coefficient square**********Multiply by 2 ?&#xA;YdftCoeffi_Sqr = Ydft(1:nfft/2+1).^2;   &#xA;&#xA;% P = y*(conj y) == y^2  ;     %********DO WE NEED TO MUL 2 ?&#xA;Pyy_NormNfft = Ydft.*conj(Ydft);   &#xA;&#xA;% P ; single sided; First square, then Multiply by 2&#xA;m1YL = abs(Ydft(1:nfft/2+1));  &#xA;mSqrYL = m1YL.^2;  &#xA;m2YL = mSqrYL*2; &#xA;&#xA;% Frequency vector&#xA;f1 = Fs /2 * linspace(0,1, nfft/2 + 1);&#xA;f2 = (0:nfft-1)*(Fs/nfft);    &#xA;&#xA;% Generate the plot, title and labels. &#xA;&#xA;figure;&#xA;plot(t,y); title('Time Domain'); xlabel('Time(s)'); &#xA;&#xA;figure;&#xA;subplot(3,1,1)&#xA;plot(f1,mY)&#xA;title('Amp Spec 01 --mY = 2*abs(Ydft(1:nfft/2+1)) /L; '); xlabel('Frequency (Hz)'); ylabel('|mY|')&#xA;        %axis ([0 500 0 5]); %Zoom in &#xA;subplot(3,1,2)&#xA;plot(f1,mY_HamWnd)&#xA;title('Amp Spec 02 -- mYHamWnd =2*abs(YdftHamWnd(1:nfft/2+1))/L;'); xlabel('Frequency (Hz)'); ylabel('|mY_HamWnd|')&#xA;        %axis ([0 500 0 5]); %Zoom in &#xA;subplot(3,1,3)&#xA;plot(f1,mY2)&#xA;title('Amp Spec 03 DC-- FoldingFreq -- mY2 ;First, single sided; then square, lastly Multiply by 2'); xlabel('Frequency (Hz)'); ylabel('|mY2|')&#xA;        %axis ([0 500 0 5]); %Zoom in &#xA;&#xA;figure;&#xA;subplot(3,1,1)&#xA;plot(f1,YdftCoeffi_Sqr); &#xA;title('Ydft Complex Coefficient Square; Single Sided-- YdftCoeffi_Sqr = Ydft(1:nfft/2+1).^2');  xlabel('Frequency (Hz)'); ylabel('YdftCoeffi_Sqr');&#xA;subplot(3,1,2)&#xA;plot(f1,m2YL); &#xA;title('Ydft Complex Coefficient Magnitude Square; Single sided; then Multiply by 2'); &#xA;xlabel('Frequency (Hz)'); &#xA;ylabel('Power m2YL');&#xA;        %axis ([0 500 0 5]); %Zoom in &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5327" LastEditorUserId="5327" LastEditDate="2015-03-27T13:58:20.603" LastActivityDate="2015-03-27T13:58:20.603" Title="Energy Spectrum of a signal after FFT in Matlab" Tags="|matlab|fft|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10647" PostTypeId="1" CreationDate="2013-09-07T09:18:53.867" Score="2" ViewCount="8587" Body="&lt;p&gt;Laplacian of Gaussian formula for 2d case is&#xA;$$\operatorname{LoG}(x,y) = \frac{1}{\pi\sigma^4}\left(\frac{x^2+y^2}{2\sigma^2} - 1\right)e^{-\frac{x^2+y^2}{2\sigma^2}},$$ in &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale_space#Scale_selection&quot; rel=&quot;nofollow&quot;&gt;scale-space&lt;/a&gt; related processing of digital images, to make the Laplacian of Gaussian operator invariant to scales, it is always said to normalize $LoG$ by multiplying $\sigma^2$, that is&#xA;$$\operatorname{LoG}_\text{normalized}(x,y) = \sigma^2\cdot \operatorname{LoG}(x,y) = \frac{1}{\pi\sigma^2}\left(\frac{x^2+y^2}{2\sigma^2} - 1\right)e^{-\frac{x^2+y^2}{2\sigma^2}}.$$ I wonder why multiply by $\sigma^2$ not $\sigma^4$ or anything else?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastActivityDate="2021-05-14T08:58:13.353" Title="normalized Laplacian of Gaussian" Tags="|image-processing|local-features|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10651" PostTypeId="2" ParentId="10593" CreationDate="2013-09-07T16:50:33.617" Score="0" Body="&lt;p&gt;&lt;code&gt;cwtft&lt;/code&gt; and &lt;code&gt;icwtft&lt;/code&gt; use Fourier transform of wavelet function to reconstruct the signal. The ‘&lt;code&gt;morl&lt;/code&gt;’ in &lt;code&gt;wname&lt;/code&gt; is analytic morlet function. So it’s exactly &lt;strong&gt;complex morlet&lt;/strong&gt; and will give you phase and magnitude information about signal. The ‘&lt;code&gt;parm&lt;/code&gt;’ in &lt;code&gt;wave={‘morl’,[parm]}&lt;/code&gt; is wo or 2*pi*fc. So it’s corresponded to center frequency. Default value of ‘parm’ is 6 so fc=6/2*pi.molet wavelet function is psi(t,fc)=exp(j*2*pi*fc*t)*exp(-t^2/2) and its Fourier transform is psi^(k)=sqrt(2*pi)exp(-0.5(2*pi*k-ko)^2). &lt;code&gt;ko= parm = 2*pi*fc&lt;/code&gt;. so you can config fc of morlet wavelet with changing parm. &lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2013-09-07T16:50:33.617" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10653" PostTypeId="2" ParentId="10647" CreationDate="2013-09-07T22:46:51.497" Score="1" Body="&lt;p&gt;Laplacian response decays as $\sigma$ increases, and it is the second Gaussian derivative so it is multiplied by $\sigma^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LOG is defined as $\bigtriangledown^2G$ so the scale normalized LOG would be $\sigma^2\bigtriangledown^2G$. You need to get rid of the scaling factor of the Gaussian which is $\sigma^2$.&lt;/p&gt;&#xA;" OwnerUserId="5247" LastEditorUserId="5247" LastEditDate="2013-09-08T15:38:06.053" LastActivityDate="2013-09-08T15:38:06.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10654" PostTypeId="1" CreationDate="2013-09-08T02:43:11.770" Score="3" ViewCount="250" Body="&lt;p&gt;I am studying my Oppenheim and Shaffer book, (New Edition), and the last chapter deals with something called homomorphic filtering. I have read the wiki and some other websites about it, but they do not really delve into details on applications. Moreover, I have almost never heard of it be brought up in discussions or recent papers, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what are some applications of this processing, and why/how is it so quiet out there in regards to it? Is it because it has been overtaken by more advanced techniques, or is it just too clunky or some other reason? Have you used it before, if so, for what purpose?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2013-09-08T04:59:40.703" Title="Where does homomorphic filtering stand in regards to DSP applications?" Tags="|discrete-signals|fourier-transform|dft|filtering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10655" PostTypeId="2" ParentId="10646" CreationDate="2013-09-08T02:54:05.210" Score="3" Body="&lt;p&gt;The cited passage gives a method for obtaining the energy in the harmonics of a specific frequency.  If your frequency of interest is $f_0$, then take a section of samples of length $N$ where $N = \frac{4 F_s}{f_0}$ and compute the $N$-point FFT.  Now you can find the energy of the second harmonic by squaring the magnitude of the $4k+1 = 9$th FFT bin. To account for errors in estimating $f0$ you can sum the squared magnitudes of bins 7 through 11.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is some example code that might give an idea of what the algorithm in question does:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Generate an example signal&#xA;Fs = 5e3;                     % Sampling rate&#xA;f0 = 151;                     % Frequency of interest&#xA;t = (0:Fs-1)/Fs;              % Time samples&#xA;x = cos(2*pi*f0*t);           % Pure sinusoid @ f0&#xA;noise = 0.1*randn(size(x));   % Gaussian noise&#xA;y = (x&amp;gt;0)-(x&amp;lt;0) + noise;      % Introduce harmonics and noise&#xA;&#xA;%% Compute energy in the harmonics of f0&#xA;N = round(4*Fs/f0);           % Determine record length&#xA;Y = fft(y(1:N))/N;            % Compute N-FFT (normalized)&#xA;Y2 = Y.*conj(Y);              % Magnitude squared&#xA;K = floor(N/2/4);             % Number of harmonic &quot;bins&quot;&#xA;for k = 1:K&#xA;    idx =  4*k+1+(-2:2);      % Five indices centered at 4k+1&#xA;    Pyk(k) = sum(Y2(idx));    % Sum of energies around 4k+1&#xA;end&#xA;&#xA;%% Plot the results&#xA;[Pyy,Fyy] = pwelch(y,[],[],[],Fs);&#xA;plot(Fyy,10*log10(Pyy));&#xA;hold on;&#xA;F = linspace(0,Fs-Fs/N,N);&#xA;Fk = F(1+4*(1:K));&#xA;plot(Fk,10*log10(Pyk),'ro');&#xA;title('Power Spectral Density');&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('Power/Frequency (dB/rad/sample)')&#xA;data2 = sprintf('Energy in Harmonics of %d Hz',f0);&#xA;legend('Power Spectral Density Estimate', data2);&#xA;hold off;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P0VIj.png&quot; alt=&quot;Example plot from Matlab code&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as finding a &quot;signature&quot; in the data, you can see that the algorithm could be very useful for that.  However, it is very important to note that the algorithm presumes some fundamental frequency of the signal in question.  If the signal in question has a fixed period, but the shape of the signal over that period changes with time, then this algorithm would be useful.  However, if the frequency varies with time, then this algorithm is not a good fit for your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are simply looking to estimate the spectrum of a signal, then maybe this page will be of help: &lt;a href=&quot;http://www.mathworks.com/products/matlab/examples.html?file=/products/demos/shipping/matlab/fftdemo.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;FFT for Spectral Analysis (mathworks.com)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5156" LastEditorUserId="5156" LastEditDate="2013-09-09T19:43:01.793" LastActivityDate="2013-09-09T19:43:01.793" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10656" PostTypeId="2" ParentId="10654" CreationDate="2013-09-08T04:53:41.243" Score="1" Body="&lt;p&gt;The cepstrum, or cepstral analysis, which is one form of homomorphic processing, has been used in music and speech analysis to estimate the deconvolution of source (exciter) pitch and vocal tract (and/or other) resonances; sometimes just used as a music/speech pitch detection/estimation method, but also useful for formant tracking as well.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-09-08T04:59:40.703" LastActivityDate="2013-09-08T04:59:40.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10659" PostTypeId="1" AcceptedAnswerId="11317" CreationDate="2013-09-08T11:51:53.320" Score="1" ViewCount="622" Body="&lt;p&gt;The impulse is given as a sequence: $x: {10; -3; -1}$. To determine if it is minimum-phase I compute the $Z$-transform (the &lt;code&gt;geophysical&lt;/code&gt; case, positive powers of $z$) of it: $X(z)=10-3z-z^2$. Then I factor $X(z)$ into dipoles $(a_0+a_1 z)$: $X(z)=10-3z-z^2=(5+z)(2-z)$. Then I observe that all the dipoles satisfy the $|a_0|&amp;gt;|a_1|$ thus being minimum phase, so the whole sequence $x$ is minimum phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I'm stuck about the zero-phase equivalent. I can evaluate the spectrum and it's magnitude by evaluating $X(z_k)$ at $z_k=e^{2 \pi i \frac{k}{N}}$, where $k=\{0,1,\dots,N-1\}$, and $N$ - length of the impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this point on how can I find the respective zero-phase impulse that has the same spectrum magnitude $|X(z_k)|$?&lt;/p&gt;&#xA;" OwnerUserId="745" LastActivityDate="2013-10-27T05:11:21.947" Title="Determine if an impulse is minimum phase and compute a zero-phase equivalent" Tags="|frequency-spectrum|homework|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10660" PostTypeId="1" CreationDate="2013-09-08T13:44:12.640" Score="1" ViewCount="356" Body="&lt;p&gt;For the 2D discrete Gabor transform, why is it that we cannot use a set of orthonormal basis for its representation, instead we have to use frames for representing it?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="5014" LastEditDate="2013-09-08T14:01:36.417" LastActivityDate="2016-04-12T15:44:02.630" Title="understanding bases and frames for Gabor transform" Tags="|transform|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10661" PostTypeId="2" ParentId="2654" CreationDate="2013-09-08T15:16:04.803" Score="2" Body="&lt;p&gt;Here's a visualization of the two in case it helps with intuition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=Ma0YONjMZLI&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=Ma0YONjMZLI&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5396" LastActivityDate="2013-09-08T15:16:04.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10662" PostTypeId="1" CreationDate="2013-09-08T15:32:15.533" Score="1" ViewCount="2205" Body="&lt;p&gt;I am trying to filter a sinusoid ($f_{sample}=50 Hz$) ,, i need to remove all frequencies above 10 Hz with accepted transition region 2 Hz (stop band freq=12 Hz)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the question is why after filtering this signal is the 20 Hz still appearing in the FFT? is there something wrong ? I know results should be the same in frequency and time domain filtering but the first in multiplication and the 2nd in convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is the code :  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; t=[0:1/50:1];  &#xA; y=cos(2*pi*20*t)+0.5*sin(2*pi*5*t);  &#xA; fsamp=50;      &#xA; frange=[10 12];    &#xA; mag=[1 0];  &#xA; devs=[0.02 0.02];  &#xA; frange=[10 12];  &#xA; [n,fo,ao,w] = firpmord(frange,mag,devs,fsamp);  &#xA; n = n + rem(n,2);  &#xA; b=firpm(n,fo,ao,w,'hilbert');  &#xA; %%% filter in time domain&#xA; final1=filter(b,1,y);  &#xA; finalfft=abs(fft(final1));&#xA; t=[0:1/50:(length(finalfft)-1)/50];  &#xA; f=[(t/t(end))*50];  &#xA; figure(1);plot(f,abs(fft(y)));   &#xA; figure(2);plot(f,finalfft);    &#xA;&#xA; %%% filter in freq domain &#xA; paddedfft=fft(y);  &#xA; bfft=fft(b,length(y));  &#xA; finalfft=paddedfft.*bfft;  &#xA; final1=ifft(finalfft);  &#xA; t=[0:1/50:(length(finalfft)-1)/50];  &#xA; f=[(t/t(end))*50];  &#xA; t=[0:1/50:(length(final1)-1)/50];  &#xA; figure(3);plot(f,abs(fft(final1))); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bsu5W.jpg&quot; alt=&quot;input signal signal fft &quot;&gt;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gSjCw.jpg&quot; alt=&quot;fft of the filtered signal ,, filtered in time domain&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YQhSH.jpg&quot; alt=&quot;fft of the filtered signal ,, filtered in frequency domian&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5397" LastEditorUserId="76" LastEditDate="2013-09-28T18:44:31.393" LastActivityDate="2013-11-28T18:17:03.243" Title="Filtering in frequency and time domain" Tags="|fft|discrete-signals|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10666" PostTypeId="1" AcceptedAnswerId="10668" CreationDate="2013-09-09T01:53:29.637" Score="1" ViewCount="3313" Body="&lt;p&gt;For a signal sampled at $f_s$, the frequency resolution (or &quot;bin width&quot;) for an $N$ point FFT is $f_s/N$. Does this mean that the $k$th bin will contain energy from sinusoids within $0.5f_s/N$ on either side of the center frequency of that bin (ignoring spectral leakage for now)? Is this energy averaged? Is it the same as taking a $2N$ point FFT and then averaging every two bins? &lt;/p&gt;&#xA;" OwnerDisplayName="user5400" LastActivityDate="2013-09-09T15:20:59.510" Title="Understanding FFT bin resolution" Tags="|fft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10667" PostTypeId="1" CreationDate="2013-09-09T01:17:54.927" Score="1" ViewCount="894" Body="&lt;p&gt;I've been using &lt;code&gt;Thinning&lt;/code&gt; recently on line-like structures in an attempt to generate skeleton-like chains of pixels connected through their Moore neighborhoods.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The description of &lt;code&gt;Thinning&lt;/code&gt; says that the algorithm &quot;finds the skeletons of foreground regions in image by applying morphological thinning until convergence&quot;.  What does &quot;convergence&quot; mean?  If I start with a cluster of pixels connected through their Moore neighborhoods, what am I guaranteed after &quot;convergence&quot;?  Will the product always be a chain of pixels also connected through their Moore neighborhoods?&lt;/p&gt;&#xA;" OwnerDisplayName="LCook" LastActivityDate="2013-09-09T07:23:27.750" Title="What does &quot;convergence&quot; mean for Thinning?" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10668" PostTypeId="2" ParentId="10666" CreationDate="2013-09-09T04:15:18.693" Score="2" Body="&lt;p&gt;The energy bin &quot;width&quot; of an FFT is the width of the transform of the window used (a rectangular window by default).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transform of a rectangle the width of the FFT is a Sinc function (sin(x)/x) with a main lobe width equal to twice the DFT/FFT bin spacing, plus smaller ripples extending the full width of the FFT result (and actually circling around forever making it technically a Dirichlet function).  Note that the frequency response of each bin filter overlaps with others except at exact bin centers (representing exactly periodic-in-aperture pure sinusoids).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the default rectangular window, only about 87% of a bin's passband is within 0.5 of a bin width from the bin center frequency, which is why ignoring so-called leakage might not be a good idea.  A longer FFT has a narrower main lobe bin response, with the ripples (&quot;leakage&quot;) dying out faster.  But 2 half width Sinc functions do not sum to a single Sinc, so averaging a longer FFT will not produce identical results (except for sinusoids that are exactly periodic in both FFT lengths.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A window other than rectangular (von Hann, etc.) will have a main lobe wider that 2 bin spacings, but, in return, far smaller ripples away from the main lobe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT/FFT resolution depends on whether you are trying to resolve closely spaced peaks as clearly separate peaks (requiring around double or more the bin spacing), or estimating the frequency of a single isolated peak with a relatively high local S/N ratio (sometimes in low noise allowing a fraction of a bin spacing in resolution after high quality interpolation).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-09-09T15:20:59.510" LastActivityDate="2013-09-09T15:20:59.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10669" PostTypeId="2" ParentId="10667" CreationDate="2013-09-09T07:23:27.750" Score="3" Body="&lt;p&gt;The thinning operation become &lt;a href=&quot;http://en.wikipedia.org/wiki/Idempotence&quot; rel=&quot;nofollow&quot;&gt;idempotent&lt;/a&gt; after a number of iterations, which means the result does not change anymore - in other word, the algorithm have converged to a solution.&lt;/p&gt;&#xA;" OwnerUserId="215" LastActivityDate="2013-09-09T07:23:27.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10670" PostTypeId="1" CreationDate="2013-09-09T08:10:40.233" Score="1" ViewCount="335" Body="&lt;p&gt;How could I know the best size of the board for my camera?&#xA;My camera is Canon D-100 It's 18 megapix&#xA;I have created a board consist of 14*10 squares &#xA;the length of each square is 7*7cm&#xA;I need to know what the step of choosing the number of squares ?&#xA;and How could I know the best dimension for each square ?&#xA;Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="5401" LastEditorUserId="53" LastEditDate="2014-12-23T15:20:35.103" LastActivityDate="2014-12-23T15:20:35.103" Title="create a Calibration Board" Tags="|image-processing|matlab|computer-vision|matlab-cvst|camera-calibration|" AnswerCount="1" CommentCount="1" ClosedDate="2013-10-09T12:25:02.930" ContentLicense="CC BY-SA 3.0" />
  <row Id="10672" PostTypeId="1" CreationDate="2013-09-09T10:10:19.383" Score="0" ViewCount="842" Body="&lt;p&gt;I'm sorry if my question might be simple, but I don't have a strong background on signal processing. I have a csv file of a 8 MHz bandwidth, sampled with a resolution bandwidth of 100 KHz. What I want to do is to compute the PSD over the 8 MHz bandwidth, but I'm not sure if I am doing this correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a &quot;stable&quot; signal, I multiply the received power over the 100 KHz sample, and then average it at the end over 8 MHz. Is that correct? Does this give me a rough estimation of the PSD?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there tools like octave or even python programming that can help in this process? I looked on the internet but didn't had luck.&lt;/p&gt;&#xA;" OwnerUserId="5402" LastActivityDate="2013-10-22T17:39:20.540" Title="Compute PSD from a CSV file" Tags="|sampling|python|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10673" PostTypeId="1" CreationDate="2013-09-09T12:17:47.340" Score="0" ViewCount="104" Body="&lt;p&gt;I'm trying find authoritative references for &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Which analyzing techniques (time/frequency domain) i should use for determining the quality of a speech signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Which algorithms i should run for improving speech signals( As &quot;cheaply&quot; as possible)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no constraints for the first requirement as it will be done &quot;offline&quot;. But I'm inteding to do the second &quot;on the fly&quot;, So i need algorithms which will do its job as economically as possible. In the second case, dedicated DSP hardware may or may not be available. I've to explore both options.&lt;/p&gt;&#xA;" OwnerUserId="5398" LastActivityDate="2013-09-09T12:17:47.340" Title="Speech signal Quality &amp; Speech signal improvement" Tags="|speech|speech-processing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10674" PostTypeId="1" CreationDate="2013-09-09T13:01:08.090" Score="1" ViewCount="104" Body="&lt;p&gt;I need to take the wavelet transform of an image (for reference, I will be using Debauchies wavelets, and the test image will either be Lenna or matlabs default woman image),and plot the coefficients in order of their magnitude. This is as an example for a document on compressive sensing I'm writing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a little unsure of of which wavelet function to use, and then what to plot to best show that many of the coefficients are zero. So far I've got:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;load woman&#xA;[c,s] = wavedec2(X,2,'db1');&#xA;a = sort(c)&#xA;plot(a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which does have a nice power law distribution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S01Ho.png&quot; alt=&quot;Sorted coefficients&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm still a little confused and unsure if this image shows what I think it shows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone suggest an alternative?&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="29" LastEditDate="2013-09-11T18:14:01.497" LastActivityDate="2013-09-12T19:49:58.757" Title="Plotting wavelet co-efficients" Tags="|wavelet|compressive-sensing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10675" PostTypeId="1" AcceptedAnswerId="10700" CreationDate="2013-09-09T13:04:36.780" Score="8" ViewCount="12905" Body="&lt;p&gt;I'm confused about the difference between a wavelet transform and a wavelet decomposition is. For example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;load woman &#xA;[cA1,cH1,cV1,cD1] = dwt2(X,'db1');&#xA;[c,s] = wavedec2(X,2,'db1');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the difference between these two matlab commands, and when would you want to do one over the other?&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2014-03-09T04:08:46.183" Title="Difference between a wavelet transform and a wavelet decomposition" Tags="|wavelet|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10676" PostTypeId="1" CreationDate="2013-09-09T17:31:16.267" Score="0" ViewCount="280" Body="&lt;p&gt;Actually i am in  search of a Voice Activity Detection Algorithm which could distinguish between voice and non-voice&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Roughly speaking it must not detect even a bullet sound,even a foot stepping and other non speech activity should only detect people conversation  or any one shouting&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in that search this question arises in my mind and i want know the effect of noise and distance between speaker and microphone on the speech features like pitch,frequency,cepstrum,zerocrossing rate,power spectral density,entropy  etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if some component wont get distorted i would like to extract that feature and do the activity decision on that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can any one help me in extracting dominant parameter of speech which would differentiate it from other common sounds even in Lower SNR conditions &amp;lt;0dB&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note:my algorithm  expects voice activity happens at a distance of at least 10m away from microphone and continuous generator hum as background noise &lt;/p&gt;&#xA;" OwnerUserId="4513" LastActivityDate="2013-10-10T11:45:22.327" Title="In Search of Voice Activity Detection Algorithms - What happens to the frequency or pitch or speech features as speaker moves away from microphone" Tags="|voice|pitch|snr|power-spectral-density|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10677" PostTypeId="2" ParentId="10676" CreationDate="2013-09-09T17:53:26.137" Score="0" Body="&lt;p&gt;There is likely no one dominant parameter that is absolutely accurate.  One possibility may be to extract a large number of parameters (as per your list, and more) from a very large corpus of example sounds that your detector might hear, and feed this data to a machine learning algorithm.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-09-09T17:53:26.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10679" PostTypeId="1" CreationDate="2013-09-09T20:25:43.567" Score="0" ViewCount="1113" Body="&lt;p&gt;I am working on speech segeration and each source I am reading , spectograms are being made by filterbanks which uses gammatone filters . I can't find a proper c++ source code which would make me understand process behind gammafilters, completely. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am curious what is its difference than 2d FFT, I mean why all sources prefer that way(gammatone filters), but not taking FFT for a time period ? &lt;/p&gt;&#xA;" OwnerUserId="5392" LastActivityDate="2013-09-10T00:35:34.710" Title="Gammatone filter vs 2D FFT for spectograms" Tags="|fft|filters|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10680" PostTypeId="1" CreationDate="2013-09-09T21:00:29.303" Score="2" ViewCount="695" Body="&lt;p&gt;I'm looking for a DSP, around 500MHz, with an in-chip ADC (preferably 2 but 1 will suffice) that samples around 20MSPS. Does any such DSP exist or do I have to use external ADCs?&lt;/p&gt;&#xA;" OwnerUserId="5404" LastActivityDate="2013-09-09T21:00:29.303" Title="Fast DSP with in-chip ADCs" Tags="|sampling|dsp-core|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10682" PostTypeId="2" ParentId="10679" CreationDate="2013-09-10T00:35:34.710" Score="1" Body="&lt;p&gt;An FFT is a linearly spaced frequency filter bank of fixed length.  To characterize speech more like the human ear-brain combination, a log or MEL frequency spaced filter bank, with differing filter response lengths for different frequency/pitch wavelengths, is a better match.  An array of gamma tone filter kernels is more like the latter than is an FFT.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-09-10T00:35:34.710" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10684" PostTypeId="1" AcceptedAnswerId="10688" CreationDate="2013-09-10T08:18:24.670" Score="0" ViewCount="413" Body="&lt;p&gt;I am trying to further reduce the following expression (if there's a nicer way to write it):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{k=-\infty}^{+\infty}\sum_{p=-\infty}^{+\infty} \sum_{l=-\infty}^{+\infty} w(k) \varphi_\mathrm{y}(l-p)\varphi_\mathrm{x}(k-n-l+p)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\varphi_\mathrm{y}$ and $\varphi_\mathrm{x}$ are the autocorrelations of the signals $y(i)$ and $x(i)$, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can express $\sum_{k=-\infty}^{+\infty} w(k) \varphi_\mathrm{x}(k-n-l+p)$ as a convolution (or a correlation, using the evenness of $\varphi_\mathrm{x}$) but I left the expression expanded in case it can help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If necessary, I could take the simplified case of finite (M-samples-)length signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="5408" LastActivityDate="2013-09-11T07:54:03.057" Title="Simplification of a convolution-like expression" Tags="|convolution|autocorrelation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10685" PostTypeId="1" CreationDate="2013-09-10T14:59:03.043" Score="1" ViewCount="104" Body="&lt;p&gt;If my signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f(t)=\exp[i\phi(t)],&#xA;$$&#xA;how do I show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{-\infty}^{\infty} {\xi}\left|S_f(u,\xi)\right|^2 d\xi = 2\pi\int_{-\infty}^{\infty} {\phi'(t)}\left|g(t-u)\right|^2 dt,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &#xA;$$&#xA;S_f(u,\xi)=\int_{-\infty}^{\infty}f(t)g(t-u)\exp{(-i\xi t)} dt&#xA;$$&#xA;is the short-time Fourier transform of $f(t)$?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="80" LastEditDate="2013-09-10T16:16:41.057" LastActivityDate="2013-09-10T16:16:41.057" Title="instantaneous frequency" Tags="|frequency|window-functions|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10686" PostTypeId="1" AcceptedAnswerId="10732" CreationDate="2013-09-10T15:54:30.823" Score="2" ViewCount="717" Body="&lt;p&gt;Say I have a function, $C=C\left(x\right)$, whose fourier transform is denoted by $c=c\left(k\right)$, i.e. $C\left(x\right)=\sum_{k=-\infty}^{\infty}c\left(k\right)\chi\left(x\right)$, where $\chi\left(x\right)$ is some complex valued basis function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the autocorrelation is given by $M\left(\Delta x\right)=\sum_{k=-\infty}^{\infty}m\left(k\right)\chi\left(\Delta x\right)$, where $\Delta x = x_2-x_1$ and by the convolution theorem I know that $m\left(k\right)=\left(c\left(k\right)\right)^*c\left(k\right)$. This means that knowing the coefficients of the autocorrelation immediately gives me the squared magnitude of the original coefficients. This implies that any two functions $C'\left(x\right)=C\left(x-x'\right)$, that differ only by a translation, will possess the same autocorrelation, $M\left(\Delta x\right)$, and so if I am trying to obtain the $c\left(k\right)$ from the $m\left(k\right)$, then I can choose an arbitrary phase for the $c\left(k\right)$. However, I don't think I can choose the phase of $c\left(k\right)$ independently for each $k$, it seems like there needs to be some way to consistently choose the phase for all $k$ (which corresponds to specifying a translation for $C\left(x\right)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is: How do I choose a consistent phase for each of the coefficients for the original function, i.e. for all $k$?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5409" LastActivityDate="2020-02-06T23:12:13.883" Title="How to choose a phase for the deconvolution of an autocorrelation?" Tags="|fourier-transform|autocorrelation|deconvolution|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10687" PostTypeId="1" CreationDate="2013-09-10T16:49:39.670" Score="1" ViewCount="418" Body="&lt;p&gt;I'm looking for a way to implement a Speech Separation from a .wav file. Let's say I have a .wav signal containing the following words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&quot;The cat flew away&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I don't really want to do the speech separation after I've split the signal inside blocks of size NxM because I feel as though I could miss parts of the word. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have thought about the following algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) When the wave signal is being processed, I process the signal and remove any signals that do not warrant consideration &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) When the signal starts to increase, we can therefore infer that this is a word and this get's counted. When the signal begins to decrease, stop counting as this could be white-noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm above would therefore infer that there is three words and then I can perform all of the actions needed on the signal..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you think this is an appropriate algorithm OR could anyone recommend any papers etc.. Which would enable me to do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that I have a signal that contains &quot;calls&quot; from different bats. These signals have been recorded. What I basically need to do isolate the different bat calls from a signal. So, I would have the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt; Bat1 -&gt; Bat2 -&gt; Bat3, ....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it would work like speech segmentation. But, instead of segmenting for words, I would segment for Bat calls. Because, from what I believe, each &quot;bat call&quot; will be of a different or similar frequency. So therefore, would it be possible to some how &quot;split the signal into blocks&quot; and then calculate the frequency of the block, see if this matches with the frequency vector, and, if it does.. Keep it, otherwise remove it? &lt;/p&gt;&#xA;" OwnerUserId="1810" LastEditorUserId="5209" LastEditDate="2013-09-12T15:14:58.340" LastActivityDate="2013-10-12T15:37:08.017" Title="Speech / Audio Separation" Tags="|audio|discrete-signals|speech-processing|segmentation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10688" PostTypeId="2" ParentId="10684" CreationDate="2013-09-10T17:55:06.103" Score="2" Body="&lt;p&gt;As you say, since $\varphi_x$ is an autocorrelation we have that&#xA;$$\sum_{k=-\infty}^{\infty} w(k) \varphi_\mathrm{x}(k-n-l+p) = &#xA;(w \star \varphi)\bigr |_{n+l-p} = g(n+l-p)$$&#xA;where $g = w \star \varphi$.&#xA;So, since $\varphi_y$ is also an autocorrelation, we have&#xA;$$\begin{align}&#xA;\sum_{l=-\infty}^{\infty} g(n+l-p)\varphi_y(l-p)&#xA;&amp;amp;= \sum_{l=-\infty}^{\infty} g(l+n-p)\varphi_y(p-l)\\&#xA;&amp;amp;=\sum_{m=-\infty}^{\infty} g(m)\varphi_y(n-m) &amp;amp;&#xA;\text{upon setting}~l+n-p=m,\\&#xA;&amp;amp;= g \star \varphi_y\bigr|_n = h(n)&#xA;\end{align}$$&#xA;where $h = g\star\varphi_y = w\star\varphi_x \star\varphi_y$.&#xA;So now you are left with $\displaystyle \sum_{p=-\infty}^\infty h(n)$ which&#xA;is unbounded. Are you sure that this last sum is with respect to $p$&#xA;and not with respect to $n$?&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-09-10T17:55:06.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10689" PostTypeId="2" ParentId="10687" CreationDate="2013-09-10T18:20:42.457" Score="1" Body="&lt;p&gt;I can advice this ones :&#xA;&lt;a href=&quot;http://www.cse.ohio-state.edu/pnl/software.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cse.ohio-state.edu/pnl/software.html&lt;/a&gt;&#xA;There are papers and codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speech seperation is not an easy issue I advice you read some books before. &#xA;This book which you can check its examples in the book is helping me much: &#xA;&lt;a href=&quot;http://auditoryneuroscience.com/&quot; rel=&quot;nofollow&quot;&gt;http://auditoryneuroscience.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing you said when the signal start can be one feature ,but Speech sounds change&#xA;constantly in a manner that is fast, but not too fast, and somewhat unpredictable yet&#xA;not entirely irregular. What I mean you will get false negatives with only this feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other things like periodicity, amplitude, pitch etc... &#xA;I think trying draw a spectrogram of speech and examining it is the best start. &lt;/p&gt;&#xA;" OwnerUserId="5392" LastActivityDate="2013-09-10T18:20:42.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10690" PostTypeId="2" ParentId="10670" CreationDate="2013-09-10T19:35:14.293" Score="1" Body="&lt;p&gt;You should position the board at roughly the same distance from the camera as the distance between the camera and your objects of interest. The board should be big enough to cover a good portion of the field of view at that distance.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another point: ideally, your board should have an even number of squares along one side, and an odd number of squares along the other.  Then the orientation of the board can be detected unambiguously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, since you have a &quot;matlab&quot; tag on your question, please check out the &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/find-camera-parameters-with-the-camera-calibrator.html&quot; rel=&quot;nofollow&quot;&gt;Camera Calibrator app&lt;/a&gt;, which is a part of the latest release of the Computer Vision System Toolbox for MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-09-10T19:35:14.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10691" PostTypeId="1" CreationDate="2013-09-11T02:19:54.380" Score="0" ViewCount="134" Body="&lt;p&gt;I am studying windowed Fourier ridges for my project. I know that it computes the instantaneous frequencies and amplitudes from the spectrogram. But I don't really know how it relates to signal processing, can anyone explain this concept to me?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2013-09-11T02:19:54.380" Title="understanding windowed fourier ridges" Tags="|signal-analysis|fourier|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10692" PostTypeId="2" ParentId="10684" CreationDate="2013-09-11T07:54:03.057" Score="0" Body="&lt;p&gt;Thanks for the reply Dilip.&#xA;I can contextualize the starting point of my answer showing how I ended up there. It reads like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;r(n) &amp;amp;= \mathbb{E}\left\{\left[w(i)\ast y(i) \ast x(i)\right]\left[y(i-n)\ast x(i-n)\right]\right\}\\&#xA;     &amp;amp;= \mathbb{E}\left\{\left[\sum_{k=-\infty}^{\infty}\sum_{p=-\infty}^{\infty}w(k)y(p)x(i-k-p)\right]\left[\sum_{l=-\infty}^{\infty}y(l)x(i-n-l)\right]\right\}\\&#xA;     &amp;amp;= \sum_{k=-\infty}^{\infty}\sum_{p=-\infty}^{\infty}\sum_{l=-\infty}^{\infty}w(k)\mathbb{E}\left\{\left[y(p)x(i-k-p)\right]\left[y(l)x(i-n-l)\right]\right\}\\&#xA;     &amp;amp;= \sum_{k=-\infty}^{\infty}\sum_{p=-\infty}^{\infty}\sum_{l=-\infty}^{\infty}w(k)\mathbb{E}\left\{y(p)y(l)\right\}\mathbb{E}\left\{x(i-k-p)x(i-n-l)\right\}\\&#xA;     &amp;amp;= \sum_{k=-\infty}^{\infty}\sum_{p=-\infty}^{\infty}\sum_{l=-\infty}^{\infty}w(k)\varphi_\mathrm{y}(l-p)\varphi_\mathrm{x}(-n-l+p+k)\\     &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbb{E}\left\{\cdot\right\}$ represent the expectation operator and the random signals $x(i)$ and $y(i)$ are statistically independent and have zero mean (these properties allow the expression of the expected value as a product) and autocorrelations $\varphi_\mathrm{x}$ and $\varphi_\mathrm{y}$, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, $p$ is the dummy variable of one of the convolutions, while $n$ is the actual time-lag and it's the only parameter that should remain in the final expression (given that we get rid of $i$ through the expectation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I mentioned in the original question, I was trying to derive the expression for the general case of infinite-length signals, but given the unbounded summation I think I need to directly restrict it to the finite-length case (the signals are processed in $M$-length chunks), thus obtaining:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{p=-\infty}^{\infty}h(n) = \sum_{p=-M}^{M-1}h(n) = 2M\cdot h(n)$$&lt;/p&gt;&#xA;" OwnerUserId="5408" LastActivityDate="2013-09-11T07:54:03.057" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10693" PostTypeId="2" ParentId="10647" CreationDate="2013-09-11T08:06:38.137" Score="1" Body="&lt;p&gt;What @bruvel says is right, but there's a much simpler way to understand this. Imagine you have a single white dot convolved with a gaussian with size &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(x,y)=\frac{e^{-\frac{x^2+y^2}{2 \sigma }}}{2 \pi  \sqrt{\sigma ^2}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Now, if you convolve this with a LoG with sigma &lt;span class=&quot;math-container&quot;&gt;$scale$&lt;/span&gt;, you get at x/y=0:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }f(x,y) \log (x,y)dydx$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= -\frac{1}{\pi  (\sigma +\text{scale})^2}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Obviously, for a dot convolved with a gaussian with size &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, we would like to have a scale space maximum at &lt;span class=&quot;math-container&quot;&gt;$scale = \sigma$&lt;/span&gt;. If you multiply the LoG output with &lt;span class=&quot;math-container&quot;&gt;$scale$&lt;/span&gt;, you get just that:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{\partial \frac{-\text{scale}}{\pi  (\sigma +\text{scale})^2}}{\partial \text{scale}}=0\Longrightarrow \text{scale}=\sigma$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So if you want to detect &amp;quot;dot-like&amp;quot; features at the right location in scale space (e.g. for keypoint detection), multiplying the LoG result with &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; gives the right results. (But this is &lt;em&gt;not&lt;/em&gt; necessarily true for line or step-edge features! For those, multiplying with &lt;span class=&quot;math-container&quot;&gt;$\sigma ^ k$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$k&amp;gt;0$&lt;/span&gt; might give more accurate results.)&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-09-11T08:06:38.137" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10694" PostTypeId="1" CreationDate="2013-09-11T12:30:57.833" Score="4" ViewCount="318" Body="&lt;p&gt;Given a 2D image where each row of pixels is shifted by some amount horizontally in a sinusoid fashion, is it possible to recover the original image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i4yOk.png&quot; alt=&quot;lena-wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine a camera that can capture one row at a time, and is moved vertically to capture the whole image. While it is moved, the camera vibrates, resulting in noise similar to above picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a known reference object that spans the entire height of the picture, such as a vertical bar, this is simple enough to solve.&#xA;But can you detect and correct this sort of noise if there is no fixed object in the picture?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is not possible, what if you assume some limits for the noise: the approximate amplitude and frequency can be known, but not the phase. Is there a solution under these constraints?&lt;/p&gt;&#xA;" OwnerUserId="3799" LastActivityDate="2013-10-13T12:50:48.623" Title="remove spatial sinusoid noise from 2d image" Tags="|image-processing|noise|opencv|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10695" PostTypeId="2" ParentId="10595" CreationDate="2013-09-11T12:44:51.023" Score="3" Body="&lt;p&gt;I am not sure I understand everything that was said here, but I would like to make the case for the Fourier Transform method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, it is an incredibly flexible and straightforward way to design FIR filters. As you said, all that needs to be done is to define the magnitude and phase responses. However, as was said, you do need to be a bit careful how you define the response. An arbitrary response may require an inordinately large number of taps to implement and give a terrible time domain response. So be careful how you define it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, it is truly the case that the Parks McClellan method for example, can generate a better filter than the Fourier method for some specific requirements, but its not easy to control tap count and also define the magnitude, phase, and step response with that method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose you want to design an FIR filter with characteristics similar to a 10 pole IIR Bessel, but you want to narrow up the transition band a bit (at the expense of step response overshoot). Then the Fourier method makes this an easy problem to solve with about 22 taps, depending on how much the transition band is narrowed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see what the Fourier method is capable of, try this FIR program  &lt;a href=&quot;http://www.iowahills.com/5FIRFiltersPage.html&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/5FIRFiltersPage.html&lt;/a&gt; (it's free). It can, for example, design IIR equivalents to the Gauss, Bessel, Butterworth, and Inverse Chebyshev filters. In general, it allows you to adjust a filter's response to almost anything, which is the Fourier method's strong point. On the down side, the filters are probably not optimal for some specific requirements. &lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-09-11T12:44:51.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10697" PostTypeId="2" ParentId="10694" CreationDate="2013-09-11T14:58:15.837" Score="1" Body="&lt;p&gt;Here is one approach to try:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem is about finding the correct re-indexing algorithm for pixel values at every raw. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each raw we can search for possible shifts optimizing some cost function that represent the correct alignment. The cost function will take the raw intensities and two neighboring raw's (upper and lower raw's) as input parameters.  The output of the cost function should represent a smoothness/continuity measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible cost function to experiment with: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Minimizing total variation &lt;/li&gt;&#xA;&lt;li&gt;$l_{1}$ norm minimization in some transform basis.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Constraints on the sine function can be used to improve the optimization algorithm. If you assume a narrow range for pixel shifts you should be able to use a brute-force approach ( searching for all possible shifts). &lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-10-13T12:50:48.623" LastActivityDate="2013-10-13T12:50:48.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10698" PostTypeId="1" CreationDate="2013-09-11T15:35:37.210" Score="1" ViewCount="1562" Body="&lt;p&gt;I am trying to implement a Savitzky-Golay filter by following &lt;a href=&quot;https://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_smoothing_filter&quot; rel=&quot;nofollow&quot;&gt;this Wikipedia&lt;/a&gt; page and in the first instance I have written the following Octave software code to create the convolution coefficients&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;&#xA;m = input( 'Enter number of bars (must be an odd number): ' ) ;&#xA;&#xA;% check no_bars is odd&#xA;if mod( m , 2 ) == 0 % is even, report error&#xA;&#xA;fprintf( '\nYou have entered an even number: try again.\n\n' ) ;&#xA;&#xA;else % is odd&#xA;&#xA;% create z &#xA;z = ( ( 1 - m ) / 2 : 1 : ( m - 1 ) / 2 )' ;&#xA;&#xA;% create Jacobian matrix J for a cubic polynomial&#xA;J = ones( m , 4 ) ;&#xA;J( : , 2 ) = z ;&#xA;J( : , 3 ) = z .* z ;&#xA;J( : , 4 ) = z .* z .* z ;&#xA;&#xA;% create convolution matrix C &amp;amp; show in terminal&#xA;C = inv( J' * J ) * J'&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which gives a matrix output where the first line are the coefficients for the smooth, second line are coefficients for the 1st derivative, third line are coefficients for the 2nd derivative etc. However, when I check this program's output with the selected coefficients given in the Wikipedia page appendix there is disagreement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this check I take the normalisation figures given in the tables, e.g. 35 for smoothing coefficients for a window of length 5 for a cubic fit, and multiply the matrix by this number, which will then transform the relevant row of the matrix into the coefficients given in the tables. Following this procedure I see that for the actual smoothing coefficients and the coefficients for the 1st derivative for window lengths 5, 7 and 9 for a cubic fit there is agreement. However, for the 2nd and 3rd derivatives there is no agreement. In fact to get agreement the normalisation figures in the table would need to be changed thus:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;window length 5 - 2nd deriv = 14, 3rd deriv = 12&lt;/li&gt;&#xA;&lt;li&gt;window length 7 - 2nd deriv = 84, 3rd deriv = 36&lt;/li&gt;&#xA;&lt;li&gt;window length 9 - 2nd deriv = 924, 3rd deriv = 1188&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Therefore I am now uncertain whether I have understood the Wikipedia page and have correctly implemented the above code, or whether in fact the Wikipedia page is wrong in this regard. Can anyone point out where the problem is?&lt;/p&gt;&#xA;" OwnerUserId="260" LastActivityDate="2013-10-27T04:33:59.673" Title="Savitzky-Golay Filter Coefficients and Wikipedia" Tags="|filters|convolution|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10699" PostTypeId="1" CreationDate="2013-09-11T17:18:48.307" Score="2" ViewCount="576" Body="&lt;p&gt;What is the reason that a periodogram is not a consistent method for obtaining information about frequency response of a system? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more precise, why even after increasing number of samples doesn't the variance of the estimator decrease?&lt;/p&gt;&#xA;" OwnerUserId="5412" LastEditorUserId="76" LastEditDate="2013-09-28T18:45:38.240" LastActivityDate="2013-10-28T20:56:43.100" Title="Periodogram: an inconsistent estimator" Tags="|system-identification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10700" PostTypeId="2" ParentId="10675" CreationDate="2013-09-11T18:17:04.337" Score="7" Body="&lt;p&gt;I don't think there is any difference.  The documentation for &lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/dwt2.html&quot; rel=&quot;noreferrer&quot;&gt;dwt2&lt;/a&gt; says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Single-level discrete 2-D wavelet transform&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The dwt2 command performs a single-level two-dimensional wavelet decomposition...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While the documentation for &lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/wavedec2.html&quot; rel=&quot;noreferrer&quot;&gt;wavedec2&lt;/a&gt; says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Multilevel 2-D wavelet decomposition&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The difference is that &lt;code&gt;dwt2&lt;/code&gt; is single-level (produces a single A, H, V, D output):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/dwt2.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gCbV6.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;code&gt;wavedec2&lt;/code&gt; is multilevel (produces array C output, which contains multiple A, H, V, D inside it):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/27375-plot-wavelet-image-2d-decomposition&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dondL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-09-11T21:41:46.203" LastActivityDate="2013-09-11T21:41:46.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10701" PostTypeId="1" CreationDate="2013-09-11T18:21:50.073" Score="1" ViewCount="36" Body="&lt;p&gt;I have some data that was collected at irregular intervals, and I want to estimate the values on a regularly spaced time grid, so that I can take FFTs etc. I've not had to do this much before, and I'm wondering if there is an &quot;industry standard&quot; or best algorithm to use? I'm currently using the Matlab function pchip, but that's only because that's the first function I found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it matter how my data is distributed, or is there a one size fits all function?&lt;/p&gt;&#xA;" OwnerUserId="5415" LastActivityDate="2013-09-11T18:21:50.073" Title="What is the preferred way to regularly space data?" Tags="|algorithms|sampling|" AnswerCount="0" CommentCount="1" ClosedDate="2013-09-12T08:19:40.273" ContentLicense="CC BY-SA 3.0" />
  <row Id="10703" PostTypeId="2" ParentId="10675" CreationDate="2013-09-11T21:02:34.543" Score="3" Body="&lt;p&gt;I think DWT is wavelet tree decomposition while wavedec2 is wavelet packet decomposition. the wavelet packet analysis is similar to the DWT with the only difference that in addition to the decomposition of the wavelet approximation component at each level, the wavelet detail component is also decomposed to obtain its own approximation and detail components as shown in Figure2.the wavelet packet analysis provides better control of frequency resolution for the decomposition of the signal in contrast with DWT. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/dlv8n.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-09-11T21:11:05.940" LastActivityDate="2013-09-11T21:11:05.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10705" PostTypeId="1" CreationDate="2013-09-11T18:49:42.090" Score="0" ViewCount="150" Body="&lt;p&gt;Consider  a static AWGN channel &#xA;$$&#xA;Y = hX+N&#xA;$$&#xA;where $h$ is a constant channel gain and the noise $N(0,N_1)$ is independent of the input $X$.  The input is from a 2-PAM constellation, i.e., $X \in \ \left\{+√p,-√p \right\}$ with equal probability where $X= +√p$ is used to send a bit at 1 and $X=-√p$ is used to send a bit at 0.  The decision rule is follows: decide that 1 was sent if $Y&amp;gt;0$ and 0 otherwise.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the probability of error as a function of $SNR:=\left|h\right|^2 P/N_1$ (express it through the $Q$ function).&lt;/li&gt;&#xA;&lt;li&gt;what is approximately the behavior of the average probability of error when $SNR&amp;gt;&amp;gt;1$?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5620" OwnerDisplayName="engineer" LastEditorUserId="80" LastEditDate="2013-09-12T08:18:29.893" LastActivityDate="2013-09-12T08:18:29.893" Title="a static AWGN channel" Tags="|homework|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10706" PostTypeId="1" AcceptedAnswerId="10707" CreationDate="2013-09-12T07:35:01.947" Score="7" ViewCount="15319" Body="&lt;p&gt;I have some misunderstandings with Q format. Please help me in understanding this.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If I say Q8 [unsigned] then there will be $8$ fractional bits. Is it ? How can I represent a $1$ and $1.5$ in this case?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I say Q8 [ signed ] then there will be $1$ sign bit and $7$ fractional bits. Here how can I represent a $1$ and $1.5$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When I say Q1.7 means I have $1$ integer bit and $7$ fractional bits. And the minimum number I can store in Q1.7 is $-1$ and maximum number is $1-1/2^7$. Is this understanding is correct ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3638" LastEditorUserId="1629" LastEditDate="2016-11-30T14:14:57.007" LastActivityDate="2016-11-30T14:14:57.007" Title="Understanding Q formats" Tags="|fixed-point|floating-point|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10707" PostTypeId="2" ParentId="10706" CreationDate="2013-09-12T14:35:19.113" Score="7" Body="&lt;p&gt;I prefer to use a more explicit notation that consists of the number of integer and fractional bits, like in your last question. I'll take them one at a time:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;By Q8, I assume you mean unsigned Q0.8 (no integer bits, 8 fractional bits). In this format, there is no representation for the numbers $1.0$ or $1.5$. The largest value that an 8-bit unsigned integer can hold is $255$, which in this representation would correspond to a fixed-point value of $\frac{255}{256} = 0.9961$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Similarly to the above, in signed Q0.7 format, there is no representation for $1.0$ or $1.5$. The largest 8-bit signed number is $127$, which would represent $\frac{127}{128} = 0.9922$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You need to be explicit about whether your number is signed or unsigned. If you have a signed Q1.7 format, that would imply that your values are 9 bits long (1 sign bit, 1 integer bit, 7 fractional bits), which is unlikely. However, assuming that you had such a 9-bit signed number with 1 integer bit and 7 fractional bits, you can represent fixed-point numbers in the range $-2$ to $(2 - 2^{-7})$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that the conversion between the integer value and the corresponding fixed-point representation is merely a division by two raised to the number of fractional bits. A 9-bit signed integer can hold values in the range $-256$ to $255$, which leads to the fixed-point range I described above.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-09-12T14:35:19.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10708" PostTypeId="1" AcceptedAnswerId="10714" CreationDate="2013-09-12T14:36:13.267" Score="2" ViewCount="86" Body="&lt;p&gt;The idea is to get three classifications for crowd: High, low and medium based on an image captured inside a train compartment. Something like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ysbts.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gets classified in the 'High' category&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.spiceflair.com/wp-content/uploads/2012/05/14a.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.spiceflair.com/wp-content/uploads/2012/05/14a.jpg&lt;/a&gt; &#xA;This perhaps in the 'Medium' &amp;amp; so on. &lt;/p&gt;&#xA;" OwnerUserId="4466" LastActivityDate="2013-09-12T20:28:41.630" Title="Is it feasible to try and classify an enclosed space as being a. Very crowded b. Less crowded &amp; c. Sparsely crowded using image processing?" Tags="|image-processing|edge-detection|face-detection|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10710" PostTypeId="2" ParentId="10708" CreationDate="2013-09-12T18:25:48.013" Score="0" Body="&lt;p&gt;This sounds feasible (and fun!), but it will be hard to get very accurate.  My guess is that, like your tags suggest, this would be a combination of edge detection / space detection to get a measure of density and face/hand detection to get a measure of human content.  You could then train up an SVM or RandomForest model on the data, tweak, and repeat.  &lt;/p&gt;&#xA;" OwnerUserId="5420" LastActivityDate="2013-09-12T18:25:48.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10711" PostTypeId="2" ParentId="2103" CreationDate="2013-09-12T19:00:45.003" Score="0" Body="&lt;p&gt;It does sound like your &quot;signals&quot; are not the type suited for ICA.  However, it seems you might benefit from clustering algorithms, especially if you know the distinct signal (energy level or wavelength) expected from each fluorophore type.  You could create the ideal synthetic clusters and co-cluster the observational data with it.  By varying the amount of clusters and other parameters, you should be able to pop out the spill over of each fluorophore into each other as additional clusters.  Spectral or hierarchical clustering methods might be best for this (as opposed to k-means).&lt;/p&gt;&#xA;" OwnerUserId="5420" LastActivityDate="2013-09-12T19:00:45.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10712" PostTypeId="2" ParentId="10674" CreationDate="2013-09-12T19:49:58.757" Score="1" Body="&lt;p&gt;You are on the right track but need perhaps to quantify your goal in mathematical terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sorted coefficients is incidently also the inverse of the cumulative function (see for instance the eq 6 of this &lt;a href=&quot;http://hal.archives-ouvertes.fr/docs/00/49/46/09/PDF/perrinet10shl.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then to quantify the sparsity of your signal you could &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;compute some measure using the cumulative distribution function, such as the ratio of coefficients above a threshold (the 5% max quantile),&lt;/li&gt;&#xA;&lt;li&gt;and compare with a control condition, like doing the same process&#xA;with a random signal&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2013-09-12T19:49:58.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10714" PostTypeId="2" ParentId="10708" CreationDate="2013-09-12T20:28:41.630" Score="0" Body="&lt;p&gt;There is research being done on crowd monitoring/crowd counting, which is similar to what you are looking for. The &lt;a href=&quot;http://www.svcl.ucsd.edu/&quot; rel=&quot;nofollow&quot;&gt;UCSD Vision Lab&lt;/a&gt; is doing work on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a paper from this lab that estimates the size of crowds [&lt;a href=&quot;http://www.svcl.ucsd.edu/publications/conference/2008/cvpr08/cvpr08_peoplecnt.pdf&quot; rel=&quot;nofollow&quot;&gt;PDF&lt;/a&gt;].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not exactly the same as your train scenario, but the idea is something that could be used for this problem.&lt;/p&gt;&#xA;" OwnerUserId="5247" LastActivityDate="2013-09-12T20:28:41.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10716" PostTypeId="1" AcceptedAnswerId="10719" CreationDate="2013-09-12T21:50:05.233" Score="0" ViewCount="50" Body="&lt;p&gt;I have a piece of code that I am translating and I am trying to understand the reasoning behind it.  The application here is thresholding medical (cellular) images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function in question takes a histogram and returns the lower threshold value.  The bit of code that I am translating mutates the histogram in a way that I do not fully understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It first finds the mode of the histogram.  It then finds the signal which appears most often which is &lt;em&gt;not&lt;/em&gt; the mode (i.e., the signal which appears most often behind the mode). I'll just call that the &quot;secondary signal&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the modal value appears more than twice the number of times as secondary signal, the modal value is scaled down to 1.5 times the modal value.  For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mode = find_mode(hist);&#xA;second_max = 0;&#xA;for(int i = 0; i &amp;lt; hist.length; ++i) {&#xA;    if(hist[i] &amp;gt; second_max &amp;amp;&amp;amp; i != mode) {&#xA;        second_max = hist[i];&#xA;    }&#xA;}&#xA;&#xA;max = hist[mode];&#xA;if(max &amp;gt; secondary_max * 2 &amp;amp;&amp;amp; secondary_max &amp;gt; 0) {&#xA;    hist[mode] = secondary_max * 1.5;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is the &quot;magic&quot; behind that 1.5 number as well as the logic behind scaling only when the modal value is &gt; 2 times the secondary signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize that this results in a higher threshold value and I assume that it is to compensate for noise (move the floor and next signal closer together), but I just don't know if these constants are well understood or if they were just chosen via experimentation on some unknown data set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, the developer is unreachable and I'm the only one here who knows anything about image processing... but I'm no expert, hence me coming here.&lt;/p&gt;&#xA;" OwnerUserId="5429" LastEditorUserId="5429" LastEditDate="2013-09-12T22:46:43.587" LastActivityDate="2013-09-13T06:35:37.853" Title="Scaling down the modal value when thresholding" Tags="|image-processing|thresholding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10717" PostTypeId="2" ParentId="10699" CreationDate="2013-09-12T21:50:47.907" Score="3" Body="&lt;p&gt;The Periodogram implicitly uses a window to get an idea of the spectrum. Implicitly this is either a rectangular window, with frequency response which is like $\dfrac{\sin(\omega n)}{N\sin(\omega)}$, or a triangular window $(N-k)/N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Roughly, the variance of the periodogram is the square of the Fourier transform multiplied by the square of the window. Note that neither windows decrease as N goes to infinity, so the periodogram isn't a consistent estimator.&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="6" LastEditDate="2013-10-28T20:56:43.100" LastActivityDate="2013-10-28T20:56:43.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10718" PostTypeId="2" ParentId="3451" CreationDate="2013-09-13T00:35:44.157" Score="1" Body="&lt;p&gt;Pattern Recognition by Theodoridis and Koutroumbas (Suggested above) has a companion Matlab book which has lot of Matlab exercises and goes along with the main text book. Check it out&gt;&gt;&#xA;&lt;a href=&quot;http://books.google.com/books/about/Introduction_to_Pattern_Recognition_A_Ma.html?id=9ysEF1OMuycC&quot; rel=&quot;nofollow&quot;&gt;Introduction to Pattern Recognition: A Matlab Approach&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5432" LastActivityDate="2013-09-13T00:35:44.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10719" PostTypeId="2" ParentId="10716" CreationDate="2013-09-13T06:23:24.810" Score="1" Body="&lt;p&gt;Most likely this is chosen by experimental results. Seems like for the algorithm to scceed it needs a value that is lower than the modal value. But not significantly lower (this is where the 1.5 scaling factor comes in). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest trying the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mid-range&quot; rel=&quot;nofollow&quot;&gt;mid-range&lt;/a&gt; value and its variants to see how that works. You might be able to skip the scaling procedure.&#xA;mid-range = (max value + min value)/2&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-09-13T06:35:37.853" LastActivityDate="2013-09-13T06:35:37.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10720" PostTypeId="1" CreationDate="2013-09-13T06:46:04.663" Score="0" ViewCount="288" Body="&lt;p&gt;In a direct sampling RF front-end, we can get real samples.&#xA;But when we sample the signal with two ADC with a sampling delay $ \frac{4n+1}{4fc}$ where $n$ can be $0,1,2 \dots$&#xA;Then we have In phase(I) and Quadrature phase(Q) samples outs of two ADC.&#xA;But there is a problem when we sample &quot;I&quot; before symbol transition and &quot;Q&quot; after transition.&#xA;This creates a mismatch in correlation with a known signal(local code).&#xA;As we increase the n value the probability of error samples becomes more.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a way to predict the probability of happening?&lt;/li&gt;&#xA;&lt;li&gt;How can I correct the error pairs?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5433" LastEditorUserId="76" LastEditDate="2013-09-27T05:59:59.607" LastActivityDate="2013-09-27T05:59:59.607" Title="Direct IQ sampling symbol transition problem" Tags="|sampling|downsampling|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10721" PostTypeId="1" AcceptedAnswerId="10722" CreationDate="2013-09-13T08:12:01.447" Score="1" ViewCount="1878" Body="&lt;p&gt;The LP-PSOLAR algorithm uses a the Linear Prediciton Coding (LPC) to calculate an error vector from a signal. This error vector is used to calculate the pitch markers. What do these pitch markers represent in the original signal in generall? Do they represent a change in fundamental frequency or a change in phoneme (I think both assumptions are wrong)? The following figure depicts the error vector (red) and the signal (green). The second picture depicts an additional example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eDFUv.png&quot; alt=&quot;Error vector(red), signal(green)&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7IEZ8.png&quot; alt=&quot;Are the red points pitch marker?&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5434" LastEditorUserId="5434" LastEditDate="2013-09-13T12:35:24.337" LastActivityDate="2013-09-13T15:28:52.397" Title="What is the &quot;pitch marker&quot; in the LP-PSOLA algorithm?" Tags="|audio|pitch|lpc|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10722" PostTypeId="2" ParentId="10721" CreationDate="2013-09-13T09:03:23.490" Score="2" Body="&lt;p&gt;The pitch marker indicates the beginning of each cycle of the waveform - or from a more physiological point of view the point at each the periodical motion of the glottis causes a sudden change in air flow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A stable sound (in pitch and phoneme) will still have a marker every cycle - so these markers do not indicate any change.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-09-13T09:03:23.490" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10723" PostTypeId="1" AcceptedAnswerId="10724" CreationDate="2013-09-13T09:22:20.103" Score="2" ViewCount="9878" Body="&lt;p&gt;Consider the measurements of two modulated AC signals (voltage and current) which may have noise, harmonics and a DC bias. Each measured signal consists of a list for the time and a list for the corresponding values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to find out the phase shift in degrees between these two signals in a robust way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to realize this in the frequency domain perhaps by calculating and evaluating the fundamental waves of the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or sample code (MATLAB) would be very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5416" LastActivityDate="2014-09-02T13:47:29.707" Title="Calculate phase shift between two signals" Tags="|matlab|fft|discrete-signals|noise|phase|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10724" PostTypeId="2" ParentId="10723" CreationDate="2013-09-13T10:50:38.373" Score="1" Body="&lt;p&gt;Do this procedure on both signals, and subtract the results to get what you want (it would be a nearly constant sequence whose value is phase shift in radians)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform FFT on the signal to obtain its spectrum.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the dominant harmonic of the signal : $f_c$ (where the peak of FFT occurs).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Filter the signal with a narrow-band linear phase filter (center = $f_c$, bandwidth as less as possible).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Again, perform FFT on the signal and extract its phase.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note : It is assumed that the signal has a dominant frequency otherwise a phase shift is pointless&lt;/p&gt;&#xA;" OwnerUserId="5104" LastEditorUserId="-1" LastEditDate="2014-09-02T13:47:29.707" LastActivityDate="2014-09-02T13:47:29.707" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10725" PostTypeId="1" AcceptedAnswerId="10730" CreationDate="2013-09-13T12:26:54.713" Score="0" ViewCount="940" Body="&lt;p&gt;I have floating point data signal. I apply lossy control to it and I need some kind of metric to determine its quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In image processing, there is PSNR (or MSE). I tried to use the same for it, It gives me some kind of result. But is there anything better (or any standard used for this kind or problem) ?&lt;/p&gt;&#xA;" OwnerUserId="5435" LastActivityDate="2014-08-03T09:48:23.037" Title="Signal quality metric" Tags="|compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10726" PostTypeId="2" ParentId="10721" CreationDate="2013-09-13T13:00:49.217" Score="1" Body="&lt;p&gt;Interesting post, I'm working on the same, your plot seems to be catching the valeys Marks, I did the same using Pitch Track based in autocorrelation, but my marks are in Peaks (Maximum excitation of signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my first test I'm using &quot;Kara.segment1.aiff&quot; from &lt;a href=&quot;http://recherche.ircam.fr/anasyn/peeters/PSOLA/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peeter's&lt;/a&gt; page, here my plot marks :&lt;img src=&quot;https://i.stack.imgur.com/UU5Wq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you speech there is a moment where your glottis are closed and other instant where it is open, this moments are find by Pitch Markers, is interesting see how glottis have relation witch Pitch Period, you can get near values of pitch using Pitch Markers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see how near they are, for this plot I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Period extracted from Pitch Track (Autocorerlation Based):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;395&#xA;   379&#xA;   365&#xA;   359&#xA;   355&#xA;   349&#xA;   342&#xA;   337&#xA;   332&#xA;   329&#xA;   325&#xA;   322&#xA;   319&#xA;   316&#xA;   314&#xA;   312&#xA;   310&#xA;   306&#xA;   302&#xA;   304&#xA;   311&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Period extracted from Pitch Mark using Peaks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;393&#xA;   381&#xA;   368&#xA;   364&#xA;   343&#xA;   348&#xA;   345&#xA;   340&#xA;   327&#xA;   328&#xA;   325&#xA;   323&#xA;   320&#xA;   316&#xA;   317&#xA;   198&#xA;   312&#xA;   426&#xA;   297&#xA;   329&#xA;   299&lt;/p&gt;&#xA;" OwnerUserId="5325" LastEditorUserId="5325" LastEditDate="2013-09-13T15:28:52.397" LastActivityDate="2013-09-13T15:28:52.397" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10727" PostTypeId="2" ParentId="3451" CreationDate="2013-09-13T14:35:11.273" Score="1" Body="&lt;p&gt;The most popular choices seem to be&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cs.ubc.ca/~murphyk/MLbook/&quot; rel=&quot;nofollow&quot;&gt;Machine Learning: a Probabilistic Perspective&lt;/a&gt; by Murphy&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0471056693&quot; rel=&quot;nofollow&quot;&gt;Pattern classification&lt;/a&gt; by Duda et all&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www-stat.stanford.edu/~tibs/ElemStatLearn/&quot; rel=&quot;nofollow&quot;&gt;The Elements of Statistical Learning&lt;/a&gt; by Hastie et all. It is free from Stanford.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://infolab.stanford.edu/~ullman/mmds.html&quot; rel=&quot;nofollow&quot;&gt;Mining of Massive Datasets&lt;/a&gt;, free from Stanford. &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://web4.cs.ucl.ac.uk/staff/D.Barber/pmwiki/pmwiki.php?n=Brml.HomePage&quot; rel=&quot;nofollow&quot;&gt;Bayesian Reasoning and Machine Learning&lt;/a&gt;, free available online.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1600490069&quot; rel=&quot;nofollow&quot;&gt;Learning from data&lt;/a&gt;. by Abu-Mostafa. It comes with Caltech &lt;a href=&quot;http://work.caltech.edu/telecourse.html&quot; rel=&quot;nofollow&quot;&gt;video lectures&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also noteworthy&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.inference.phy.cam.ac.uk/itprnn/book.html&quot; rel=&quot;nofollow&quot;&gt;Information Theory, Inference, and Learning Algorithms&lt;/a&gt; by Mackay, free. &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470090138&quot; rel=&quot;nofollow&quot;&gt;Classification, Parameter Estimation and State Estimation&lt;/a&gt; by van der Heijden. &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1107011795&quot; rel=&quot;nofollow&quot;&gt;Computer Vision: Models, Learning, and Inference&lt;/a&gt;, by Prince&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0262013193&quot; rel=&quot;nofollow&quot;&gt;Probabilistic Graphical Models&lt;/a&gt;&#xA;by Koller. Has an accompanying course on Coursera. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="420" LastEditorUserId="420" LastEditDate="2014-02-16T16:53:05.923" LastActivityDate="2014-02-16T16:53:05.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10730" PostTypeId="2" ParentId="10725" CreationDate="2013-09-13T15:55:43.467" Score="2" Body="&lt;p&gt;What kind of result ? Are all the floating point data positive ? Anyway, I will list down some of the Quality Metrics and when to use them for which quality of data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$1$. SNR - If the difference between the original signal and the reconstructed signal can be interpreted as a zero-mean noise process. SNR measurements relating to signal power or energy are less usual, because the result will be biased by the mean signal value. For audio and speech, zero-mean property applies anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;SNR[dB] = 10 \log\frac{\mathcal{E}(s(\textbf{n})-m_{s})^{2}}{\mathcal{E}(s(\textbf{n})-\tilde s(\textbf{n}))^{2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sensitive against phase shifts ( whereas linear phase shift are uncritical for high visual quality ). For example, an observer would hardly find any disturbance in an image shifted by half a pixel using a high quality interpolator while the SNR criterion might indicate&#xA;a poor reconstruction quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$2$. PSNR - For image and video signals which are strictly positive and bounded within a maximum value $A_{max}$. PSNR is widely used for image and motion distortion comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;PSNR[dB] = 10 \log\Sigma \frac{A_{max}^{2}}{(s(\textbf{n})-\tilde s(\textbf{n}))^{2}}&#xA;$$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$3$. Weighted SNR -  A more general form of SNR which additionally allows individual position-dependent weighting of errors is the weighted SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;PSNR[dB] = 10 \log\Sigma \frac{r(\textbf{n})w(\textbf{n})}{w(\textbf{n})(s(\textbf{n})-\tilde s(\textbf{n}))^{2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weight $w(\textbf{n})$ could be used dependent on local structure (e.g. different weights for edge pixels or textured areas). It has value of one for relevant and &#xA;zero for irrelevant positions and allows comparison of two images over an arbitrary-shaped area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then there is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$4$ Segmental SNR - &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;SNR criteria are average measures, which do not take into account  fluctuations of quality. Often, a signal with only one highly distorted segment or region will be judged to be of bad quality, while the SNR computed over the entire signal may be extremely high. As possible workaround solutions, additional criteria such as SNR measurements over smaller segments, computation of minima, maxima or other criteria which  express fluctuations have &#xA;  been proposed. The  segmental SNR, which is the mean or expected value of SNR results from equal-size segments [Jayant, Noll 1984], penalizes fluctuations in SNR. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And also there is Perceptually Weighted Criteria.&lt;/p&gt;&#xA;" OwnerUserId="4902" LastEditorUserId="8202" LastEditDate="2014-08-03T09:48:23.037" LastActivityDate="2014-08-03T09:48:23.037" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10731" PostTypeId="1" CreationDate="2013-09-13T20:21:54.003" Score="0" ViewCount="586" Body="&lt;p&gt;What I am attempting to do is take a signal (.wav audio file) which contains calls from different Bat species. Here is a graph representation of the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GMqlb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have done so far is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Emphasise the signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Compress the signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the output I got plotted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oqEga.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to remove the signals that do not warrent consideration. At the moment, the signal is in a 1D representation, and, after the Separation has been completed the signal will be a 2D representation containing JUST the calls, thus I can perform analysis on each of the calls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my suggested methodology to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Split the signal into blocks of: 256x100 (so they overlap)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Calculate the RMS (Root-mean-square) of each of the blocks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Compare (2) to a threshold value, and, if the block warrants consideration then this can be classed as a call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the problem is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Will splitting the signal into blocks of 256x100 go over the calls and thus making some of the calls lost when calculating the RMS?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) How do I therefore pick a suitable threshold value? Would finding the peaks in the signal be an accurate assumption for this?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope someone can help me :)&lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2013-10-17T06:38:54.940" Title="Audio Separation of .wav signal" Tags="|audio|discrete-signals|source-separation|" AnswerCount="2" CommentCount="8" ClosedDate="2013-10-21T12:34:18.113" ContentLicense="CC BY-SA 3.0" />
  <row Id="10732" PostTypeId="2" ParentId="10686" CreationDate="2013-09-14T03:29:45.043" Score="4" Body="&lt;p&gt;For a real-valued signal $C$, the autocorrelation function $M$ is a real-valued even&#xA;function and the power spectral density $m$ (Fourier transform of $M$) is a real-valued&#xA;nonnegative even function.  Now, $m(k) = c(k)c^*(k)$ where $c$ is the Fourier transform&#xA;of $C$, as you correctly assert, but given only $m$ and no other&#xA;information about $c$ (or $C$),&#xA;it is not possible to determine $c$ at all.  Note that $m(k)$ &lt;em&gt;also&lt;/em&gt; equals $[c(k)e^{j\theta_k}][c(k)e^{j\theta_k}]^* = c(k)c^*(k) e^{j\theta_k}e^{-j\theta_k}$ for&#xA;&lt;em&gt;arbitrary&lt;/em&gt; choice of $\theta_k$, and the inverse Fourier transform of $c(k)e^{j\theta_k}$&#xA;is also a real-valued signal if we are careful to preserve conjugate symmetry so&#xA;that we choose $\theta_{-k}$ as $-\theta_k$. In other words, there are infinitely many&#xA;quite different signals that share the same autocorrelation function, and it is &lt;em&gt;not&lt;/em&gt;&#xA;the case that only $C$ and its time-delayed versions have autocorrelation function $M$.&#xA;As an example, all PN signals, that is, pulse trains generated from a maximal-length&#xA;linear feedback shift register (LFSR), have an inverted thumbtack autocorrelation,&#xA;and the distinct PN signals (from different LFSRs)&#xA;are even two-level signals, a property not shared&#xA;by all of the infinitely many real signals that have inverted&#xA;thumbtack autocorrelation.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-09-14T12:42:14.973" LastActivityDate="2013-09-14T12:42:14.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10736" PostTypeId="1" AcceptedAnswerId="13773" CreationDate="2013-09-14T21:07:36.130" Score="3" ViewCount="8377" Body="&lt;p&gt;I know that in many edge detection algorithm the first step is choosing a scale to work on. &#xA;We actually operate on the chosen scale by applying a gaussian blur on the original image. &#xA;I wanted to know , what is the relation between the detected edge's width to the sigma.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. If I want to detect lines 5 pixel wide , which sigma should I use? &#xA;How should I change it if I want to find a line 10 pixels wide? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, &lt;/p&gt;&#xA;" OwnerUserId="4727" LastEditorUserId="1273" LastEditDate="2014-01-14T09:58:53.980" LastActivityDate="2014-01-14T09:58:53.980" Title="Which sigma to use for edge detection" Tags="|image-processing|edge-detection|gaussian|scale-space|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10737" PostTypeId="1" AcceptedAnswerId="11439" CreationDate="2013-09-15T09:04:04.297" Score="4" ViewCount="10109" Body="&lt;p&gt;I just studied the Algorithm of ANPR (Automatic Number Plate Recognition) from the chp 5 of book Packtpub.Mastering.OpenCV.with.Practical.Computer.Vision.Projects in which they detect the vehicle licence plate , but their are some restriction in that algorithm , i call it restriction because its specific for one country and can not be used in my country , well in that algorithm they use the following algorithms to detect the licence plate area&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sobel filter&#xA;Threshold operation (otsu)&#xA;Close Morphological operation&#xA;Mask of one filled area&#xA;Svm classifier&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the thing they used is the background color of licence plate as their keypoint for the recognition and detection , but in my area licence plate have different backgrounds , most common are black , white and green , green is not much common but rarely used , black background used white number and white contain black numbers , they use floodfill algorithm for white background , but what should i use for 2 different backgrounds ? Size of the licence plate and size of character matter in any case ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the sample images of my regional vehicle's liecence plate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/afnQZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DpPLV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="5057" LastEditDate="2013-11-02T19:49:58.380" LastActivityDate="2021-03-15T14:26:25.237" Title="Licence plate detection with different backgrounds" Tags="|image-processing|computer-vision|opencv|ocr|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10738" PostTypeId="2" ParentId="1227" CreationDate="2013-09-15T15:14:52.583" Score="5" Body="&lt;p&gt;(Years later)&#xA;piecewise-linear functions are splines of degree 1, which most spline fitters can be told to do.&#xA;&lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.UnivariateSpline.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;scipy.interpolate.UnivariateSpline&lt;/a&gt;&#xA;for example can be run with &lt;code&gt;k=1&lt;/code&gt;&#xA;and a smoothing parameter &lt;code&gt;s&lt;/code&gt;, &#xA;which you'll have to play with -- see&#xA;&lt;a href=&quot;https://scicomp.stackexchange.com/questions/6971/scipy-interpolation-with-univariate-splines&quot;&gt;scipy-interpolation-with-univariate-splines&lt;/a&gt; .&lt;br&gt;&#xA;In Matlab, see&#xA;&lt;a href=&quot;http://www.mathworks.de/de/help/curvefit/examples/how-to-choose-knots.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;how-to-choose-knots&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added: finding optimal knots is not easy, because there can be many local optima. &#xA;Instead, you give UnivariateSpline a target &lt;code&gt;s&lt;/code&gt;, sum of error^2,&#xA;and let it determine the number of knots. &#xA;After fitting, &lt;code&gt;get_residual()&lt;/code&gt; will get the actual sum of error^2,&#xA;and &lt;code&gt;get_knots()&lt;/code&gt; the knots.&#xA;A small change in &lt;code&gt;s&lt;/code&gt; may change the knots a lot, especially in high noise -- ymmv.&lt;br&gt;&#xA;The plot shows fits to a random piecewise-linear function + noise for various &lt;code&gt;s&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fitting piecewise constants, see&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Step_detection&quot; rel=&quot;nofollow noreferrer&quot;&gt;Step detection&lt;/a&gt;.&#xA;Can that be used for pw linear ? Don't know; starting off by differentiating noisy data&#xA;will increase the noise, wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other testfunctions, and/or links to papers or code, would be welcome.&#xA;A couple of links:&lt;br&gt;&#xA;&lt;a href=&quot;https://stats.stackexchange.com/questions/65129/piecewise-linear-regression-with-knots-as-parameters&quot;&gt;piecewise-linear-regression-with-knots-as-parameters&lt;/a&gt;&lt;br&gt;&#xA;$\qquad$ Linear splines are very sensitive to where the knots are placed&lt;br&gt;&#xA;&lt;a href=&quot;https://stats.stackexchange.com/questions/5826/knot-selection-for-cubic-regression-splines&quot;&gt;knot-selection-for-cubic-regression-splines&lt;/a&gt;&lt;br&gt;&#xA;$\qquad$ This is a tricky problem and most people just select the knots by trial and error.&lt;br&gt;&#xA;$\qquad$ One approach which is growing in popularity is to use penalized regression splines instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;Added March 2014:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_programming&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic programming&lt;/a&gt;&#xA;is a general method for problems with nested subproblems like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;optimal k lines&#xA;    = optimal k - 1 lines up to some x&#xA;    + cost of the last line x to the end&#xA;over x  (all x in theory, nearby x in practice)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Dynamic programming is very clever, but can it beat brute force + heuristics for this task ?&lt;br&gt;&#xA;See the excellent course notes by Erik Demaine under&#xA;&lt;a href=&quot;http://stellar.mit.edu/S/course/6/fa13/6.006/materials.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIT 6.006 Intro to algorithms&lt;/a&gt;&lt;br&gt;&#xA;also google &lt;a href=&quot;https://www.google.com/search?q=%22segmented%20linear%20regression%22&quot; rel=&quot;nofollow noreferrer&quot;&gt;segmented linear regression&lt;/a&gt;&lt;br&gt;&#xA;also John Henry syndrome.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;  &#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/b6Pqj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="-1" LastEditDate="2017-04-13T12:53:54.087" LastActivityDate="2014-03-10T10:31:15.343" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10739" PostTypeId="1" CreationDate="2013-09-15T18:19:12.317" Score="1" ViewCount="12312" Body="&lt;p&gt;I am trying to find out how can I count the number of people in a room using the feed coming in from a CCTV camera fixed in one of the top corners of the room. The number of cameras can be 2 at max but 1 for now. The objective is to only be able to tell how many persons are present in the room, in real time. The precision of it is not too important, for e.g. the system could suggest a range like &quot;there are more than 5 people right now&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon browsing and researching, I came across a lot of very complex algorithms and terms related to Computer Vision and Image Processing that I have not understood at all like OpenCV, HOG, Blob Detection/Tracking, Foreground/Background Subtractions etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a design student. I do not have a background in programming. But, about a week back I got introduced to Processing. So, if some could help me out here with some tutorials/references/code to have it work in a language like Processing for prototyping purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5447" LastEditorUserId="13320" LastEditDate="2017-04-17T17:46:32.240" LastActivityDate="2017-10-14T08:40:43.217" Title="How to Count the number of People in a room using CCTV Camera feed?" Tags="|computer-vision|video-processing|detection|visual-tracking|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10740" PostTypeId="1" AcceptedAnswerId="10741" CreationDate="2013-09-15T21:05:39.880" Score="1" ViewCount="4921" Body="&lt;p&gt;I am reading a nice book on DSP &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Scientist and Engineer's Guide to Digital Signal Processing&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It mentions &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In electronics, the mean is commonly called the DC (direct current) value.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can a signal have no DC component if the mean is the DC component? Surely every signal's values can be averaged?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2013-09-16T06:29:34.137" Title="How can a signal have no DC component" Tags="|statistics|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10741" PostTypeId="2" ParentId="10740" CreationDate="2013-09-15T21:32:36.137" Score="11" Body="&lt;p&gt;A signal having a mean-value or DC component of zero is commonly referred to as mean-free or as having no DC component. It does not mean that it cannot be averaged, just that the average comes out as zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might be a little inexact but it is very common.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-09-15T21:32:36.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10742" PostTypeId="2" ParentId="10740" CreationDate="2013-09-15T22:25:04.963" Score="0" Body="&lt;p&gt;To put in &quot;Frequency&quot; terms, the value of zero frequency corresponds to &quot;DC&quot; by name and it has nothing to do with Direct current actually. The fourier transform at zero frequency is simply an integration of a signal throughout its existence (dividing by the length of the time interval gives the mean value of the signal). Now if the Integration(in the case of continuous time domain) or the summation(discrete time domain) turns out to be zero, essentially you won't have any zero frequency component, and hence the average will also be zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also you have to be careful with the fact that the transforms exist only if the signals don't blow up. Eg. a signal that's just a constant from $-\infty$ to $+\infty$ will blow up at zero frequency. In real world we deal with time limited signals and the signals that don't blow up so it's not an issue. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-09-15T22:25:04.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10743" PostTypeId="1" AcceptedAnswerId="10763" CreationDate="2013-09-16T03:40:29.007" Score="4" ViewCount="14539" Body="&lt;p&gt;I'm trying to do something similar to Shazam (&lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper here&lt;/a&gt;) in Python. Basically the idea is to use FFT with sliding window to transform both WAV files and recorded audio to the same spectral representations for recognition purposes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only problem is the spectrograms I extract from certain songs just seem to generate lots of useless peaks that become false positives when heard in other songs. They look a lot like noise. Examples below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrogram of SONG_1 [channel 1]:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QCVn8.png&quot; alt=&quot;song 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrogram of SONG_2 (dominates and generates WAY more peaks) [channel 1]:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XvtLl.png&quot; alt=&quot;song 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrogram of SONG_3 [channel 1]:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xrQ51.png&quot; alt=&quot;song 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrogram of SONG_1, recorded through my laptop mic (looks like noise) [channel 1]:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KSWbI.png&quot; alt=&quot;recorded song 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code I use to generate the spectrograms:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pylab&#xA;from scipy.io import wavfile&#xA;&#xA;fs, frames = wavfile.read(&quot;song1.wav&quot;)&#xA;&#xA;channels = [&#xA;    np.array(frames[:, 0]),&#xA;    np.array(frames[:, 1])&#xA;]&#xA;&#xA;# generate specgram&#xA;Pxx, freqs, t, plot = pylab.specgram(&#xA;    channels[0],&#xA;    NFFT=4096, &#xA;    Fs=44100, &#xA;    detrend=pylab.detrend_none,&#xA;    window=pylab.window_hanning,&#xA;    noverlap=int(4096 * 0.5))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've implemented the hashing, storage, recognition, etc as well but they are rather useless unless the extracted peaks are distinct to the song heard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should mention my peak extraction algorithm is not just a threshold - I find points in &lt;code&gt;Pxx&lt;/code&gt; that are the highest value in a neighborhood of around 15-20 adjacent points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? How can I get more distinctive spectrograms out of audio sample channels?&lt;/p&gt;&#xA;" OwnerUserId="5351" LastEditorUserId="5351" LastEditDate="2013-09-16T03:48:29.273" LastActivityDate="2014-09-02T00:25:42.977" Title="generating spectrograms in python with less noise" Tags="|fft|audio|python|spectrogram|" AnswerCount="5" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="10744" PostTypeId="2" ParentId="10740" CreationDate="2013-09-16T05:30:22.390" Score="1" Body="&lt;p&gt;I will paste a link of a similar question asked in dsp stack exchange a month back. It clearly explains why X(0) is called the dc component and why X(0) is the summation of all the samples x[n] of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/10254/why-is-x0-the-dc-component/10255#10255&quot;&gt;Why is X(0) the DC component&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for your question on how the signal can have no dc component or mean, you can make the signal mean free by subtracting the average of the signal samples from every time domain sample thereby making the signal mean free both in the time domain and frequency domain. Professor Dilip Sarwate has written a clear comment about the same in the comments section of the link i posted. &lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-09-16T06:29:34.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10746" PostTypeId="2" ParentId="10739" CreationDate="2013-09-16T10:48:37.217" Score="1" Body="&lt;p&gt;OpenCV is a open source computer vision library that is based and can be used in most languages. It provides a quick way to compute Computer vision. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, this problem is very complex, if you do not have any real experience in image processing and of course, programming! You want to identify how many people are in the room, so yes, foreground / background subtraction is going to come in useful in this problem domain. The main concern would be to identify a person from an object in the room. Ask yourself: How would/could I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I was you, I would take this work and base it on a &quot;still image&quot; and gain knowledge and experience in identifying people that are in a room. Stay away from programming languages (such as C/C++ -- for now!) concentrate on something like Python + OpenCV alternatively use Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps a bit. &lt;/p&gt;&#xA;" OwnerUserId="1810" LastActivityDate="2013-09-16T10:48:37.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10747" PostTypeId="1" CreationDate="2013-09-16T13:14:20.467" Score="7" ViewCount="5706" Body="&lt;p&gt;In image processing, &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale_space&quot; rel=&quot;noreferrer&quot;&gt;scale-space&lt;/a&gt; is a technique to represent an image at different scales. But this really confuses me, since I always think that the word &lt;em&gt;scale&lt;/em&gt; just means the &lt;em&gt;size&lt;/em&gt; of an object, so the &lt;em&gt;scale-space&lt;/em&gt; representation of an image shall have &lt;em&gt;different sizes of the same image&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it turns out that the &lt;em&gt;scale-space&lt;/em&gt; representation is composed of Gaussian-convolved images with different $\sigma$, the image size doesn't change at all, why? And further, how $\sigma$ in the Gaussian function determines the scale of the convolved image ?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastActivityDate="2018-04-05T18:09:12.363" Title="what exactly does scale mean in scale-space theory?" Tags="|image-processing|scale-space|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10748" PostTypeId="2" ParentId="10506" CreationDate="2013-09-16T15:10:26.697" Score="1" Body="&lt;p&gt;Well to answer my own question, I have found one reference to designing FIR filters on the wonderful page from Julius Smith: &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Two_Zero.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/Two_Zero.html&lt;/a&gt;.  (It was naive of me to not check there first).  It's not exactly what I was going for, but much closer to a parametric design then using IR or freq-domain sampling of IIR filters.&lt;/p&gt;&#xA;" OwnerUserId="5321" LastActivityDate="2013-09-16T15:10:26.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10749" PostTypeId="2" ParentId="10743" CreationDate="2013-09-16T21:42:13.080" Score="2" Body="&lt;p&gt;I think there's an underlying issue with how you're generating the spectogram. From the looks of things you are FFTing data that has a disconinuity, or jump, resulting in large amounts of broadband noise. It's subtle in SONG_1, but very prominant in SONG_2/3. This would be equivalent to either having a sequence of zeros somewhere in your data. Something like fft([data (20 zeros) data]). I know it's a lot of data to plot (44.1KHz), but you can either scroll through the raw audio and look for patches of zeros or compute derivative of the audio, plot, and look for peaks. This is equivalent to y[n] = x[n] - x[n-1] and plot y[n]. That is also a pretty cheap lowpass filter, but I digress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another easy way to test this would be to record about 10 seconds of audio of you saying something like &quot;Test one two three&quot; etc. When plotting the spectogram (depending on your window size and overlap) you should see somewhat discrete areas of frequency content. Here's a pretty good &lt;a href=&quot;http://cnx.org/content/m0505/latest/&quot; rel=&quot;nofollow&quot;&gt;image&lt;/a&gt; of what the sample of your voice should look like. If you again see broadband spectral leakage, that just so happens to look periodic, something else is going on.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-09-16T21:42:13.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10750" PostTypeId="2" ParentId="1227" CreationDate="2013-09-16T21:49:47.117" Score="0" Body="&lt;p&gt;Take the derivative and look for areas of nearly constant value. You would need to create the algorithm to search for those areas with ideally some level of +/- slope and that would give you the slope of the line for that section. You might want to perform some smoothing, like a sliding mean, prior to doing the sectional classification. The next step would be to get the y-intersection, which should be trivial at that point.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-09-16T21:49:47.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10751" PostTypeId="2" ParentId="10506" CreationDate="2013-09-16T22:09:21.613" Score="0" Body="&lt;p&gt;I would just partition the frequency domain into something like 4 areas and create 4 low order filters so there's some nice smooth overlap between them. That would require you to create 1 lowpass, 1 highpass, and two bandpasss filters where you scale the gain of each filter independently. Run the data through each filter and sum the results. Here's some MATLAB code to illustrate what I'm talking about run on some random data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = randn(1,65536);&#xA;b1 = fir2(12, [0 0.25 0.5 1], [1 1 0 0]);&#xA;b2 = fir2(12, [0 0.24 0.51 1], [0 1 1 0]);&#xA;b3 = fir2(12, [0 0.49 0.75 1], [0 1 1 0]);&#xA;b4 = fir2(12, [0 0.5 0.75 1], [0 0 1 1]);&#xA;g1 = 1.0;&#xA;g2 = 0.5;&#xA;g3 = 0.2;&#xA;g4 = 0.2;&#xA;y = g1*filter(b1, 1, x) + g2*filter(b2, 1, x) + ...&#xA;    g3*filter(b3, 1, x) + g4*filter(b4, 1, x);&#xA;plot(20*log10(abs(fft(y))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-09-16T22:09:21.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10752" PostTypeId="2" ParentId="10731" CreationDate="2013-09-16T22:18:22.727" Score="0" Body="&lt;p&gt;If you are using Matlab, the plots looks like Matlab, you can use indexing directly to get a threshold value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% 'time' is the time series&#xA;% 'signal' is the signal itself&#xA;idx = signal &amp;gt; 0.2;&#xA;plot(time(idx), signal(idx));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You are not clear on what you're trying to achieve, but there could be some information found in the frequency spectrum, so that you could do for example a fourier transform on the signal.&lt;/p&gt;&#xA;" OwnerUserId="5452" LastActivityDate="2013-09-16T22:18:22.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10753" PostTypeId="1" AcceptedAnswerId="10755" CreationDate="2013-09-16T23:25:41.390" Score="0" ViewCount="220" Body="&lt;p&gt;We can describe a BPSK signal, x, as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x=cos(2\pi f_c t+n\pi),\;n\in \{ 0,1 \}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The BPSK signal is then transmitted through a narrow band frequency flat Rayleigh channel, described by a single complex exponential $h=Ae^{i\theta}$. $A$ has Rayleigh distribution and $\theta\sim\mathrm{Unif}(0,2\pi)$. The received signal at the destination is given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y=hx=Ae^{i\theta}[cos(2\pi f_c t+n\pi)].$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what does the exponential term of the channel $e^{i\theta}$ represent? Clearly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y\neq A[cos(2\pi f_c t+n\pi + \theta)].$$ This can be verified by expanding the sinusoids terms into their complex exponential forms.&lt;/p&gt;&#xA;" OwnerUserId="5453" LastActivityDate="2013-09-17T16:53:03.617" Title="Complex Exponential Narrow Band Channel" Tags="|modulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10754" PostTypeId="1" AcceptedAnswerId="10772" CreationDate="2013-09-16T23:56:56.323" Score="4" ViewCount="326" Body="&lt;p&gt;Section 13.2 of &lt;a href=&quot;http://www.nrscstandards.org/SG/NRSC-5-C/1012sf.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the HD Radio standard for AM&lt;/a&gt; defines a pulse shaping function that appears to be some strange variant on a raised cosine filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X8CNS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xWIzX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, H(ξ) is a raised cosine filter with total width (1+α)T, and W(ξ) appears to be a &quot;stretched&quot; version. Why do they do this?&lt;/p&gt;&#xA;" OwnerUserId="5454" LastEditorUserId="5454" LastEditDate="2013-10-06T23:51:11.230" LastActivityDate="2021-11-17T00:33:45.953" Title="What's the rationale behind this pulse shaping function?" Tags="|ofdm|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10755" PostTypeId="2" ParentId="10753" CreationDate="2013-09-17T01:25:51.970" Score="0" Body="&lt;p&gt;The equations are a bit wrong. For a signal $x=cos(2\pi f_{c}t+n\pi), n\in \left\{0,1\right\}$ transmitted through a complex exponential channel $h=Ae^{i\theta}$, the received signal $y$ is not $hx$. $h$ is in the complex baseband notation and your signal $x$ is in the bandpass notation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your actual question first, $\theta$ is the phase change that is incurred by the signal when it passes through the channel i.e. the delay. And the actual received signal is $y=Re\left\{x_{l}Ae^{i\theta}e^{i2\pi f_ct}\right\}$, where $x_{l}$ is the baseband representation of our signal $x$ which in our case would be something like $x_{l} = e^{i2\pi\frac{(n-1)}{2}}$, where $n\in \left\{0,1\right\}$.&lt;/p&gt;&#xA;" OwnerUserId="5102" LastEditorUserId="5102" LastEditDate="2013-09-17T16:53:03.617" LastActivityDate="2013-09-17T16:53:03.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10756" PostTypeId="2" ParentId="10754" CreationDate="2013-09-17T02:36:21.140" Score="1" Body="&lt;p&gt;It may be to constrain a symbol within the period to mitigate ISI. There may be other properties that become apparent in practical application over more traditional tapers. It could be the result of research combined with analysis of real world data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the paper doesn't cite any source, you may have to do some more research on pulse-shaping and OFDM in scholarly publications. Maybe there's a paper out there that has more information or a comparison of windowing functions.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-09-17T02:36:21.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10757" PostTypeId="2" ParentId="10747" CreationDate="2013-09-17T04:37:42.060" Score="3" Body="&lt;p&gt;There's an image processing algorithm called Retinex that uses scales to perform local contrast enhancement. Here's an OK &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;ved=0CEcQFjAC&amp;amp;url=http://classes.soe.ucsc.edu/ee264/Winter02/yan.ppt&amp;amp;ei=eto3Urz8IJHD4AOXt4HwAQ&amp;amp;usg=AFQjCNHAD0uuZMynKpAPnRqFCS-odStEXQ&amp;amp;sig2=U6pW4EoFra9HDV-7pL4Vkg&amp;amp;bvm=bv.52164340,d.dmg&quot; rel=&quot;nofollow&quot;&gt;presentation&lt;/a&gt; on the Multi-Scale Retinex algorithm for more detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image size doesn't change because you are performing convolution of a Guassian kernel with the image. In practice this is generally accomplished in the frequency domain and the image is padded to avoid the effects of circular convolution. This is standard stuff in image processing where you convolve a 'kernel' against an image. It's a just averaging surround pixels with a 2-D Gaussian function instead of something like a block of ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen the choice of sigma be a somewhat adhoc &quot;This looks good to me&quot; selection process. There are ranges published in a few papers that seem to work well for most images. Essentially small values preserve the detail in the image, medium values provide a mix of general detail and global energy, and large values provide more global representations of the image energy. I think something like small is 1-25, medium 25-75, and large is +75. When you convolve and sum all of the scales, with a bit more light math, you get a local contrast enhanced image. The results are pretty good. You can try it out on some images to see the result of each to get a better feel for it.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-09-17T04:37:42.060" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10758" PostTypeId="2" ParentId="10644" CreationDate="2013-09-17T05:20:41.290" Score="1" Body="&lt;p&gt;The integrator is unstable, so it will probably just blow up. There's such a thing as a leaky integrator that does an OK job of getting pretty close. Have a look at the algorithm listed &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/filter.html#f83-1015962&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; on how you would go about implementing it using code. The math is pretty straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The differentiator uses b1=1, b2=-1. The integrator is just the inverse, but what you'll find is you need to modify (decrease) the filter coefficient by a subtle amount to make it 'leak'. For the integrator use something like a1=1, a2=-0.99. The closer a2 gets to 1.0 the greater the risk you run on it going unstable. Decreasing a2 to something like -0.95 will result in something that looks less and less like an integrator. Play around with it.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-09-17T05:20:41.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10759" PostTypeId="2" ParentId="10743" CreationDate="2013-09-17T05:34:00.140" Score="1" Body="&lt;p&gt;There are several things you can do to alleviate or characterize the noise you see, both in generating the spectrogram and in cleaning it up afterward.  Changing your widowing function and size, adding multitapers, various normalizations, etc., might help uncover or mitigate the saturation and noise you see.  Can you share the files you used to generate the spectrograms for us to play with?&lt;/p&gt;&#xA;" OwnerUserId="5420" LastActivityDate="2013-09-17T05:34:00.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10761" PostTypeId="2" ParentId="10731" CreationDate="2013-09-17T05:48:41.517" Score="0" Body="&lt;p&gt;This sounds like you are trying to separate noise from signal, and subsequently separate various mixed signals.  This is a good candidate for independent component analysis (ICA) with a caveat.  It is unclear how you got from your first signal to the second, and it is unclear if the bat signals are individual chirps/bleats at one time point or if they constitute a time series of various magnitudes and durations.  If the the latter, you can use ICA to decompose the spectrogram of the original mixed signal (your figure 1). I doubt RMS of overlapping windows will give you good signal indicators unless you are simply looking to characterize particular magnitudes of very small duration.&lt;/p&gt;&#xA;" OwnerUserId="5420" LastActivityDate="2013-09-17T05:48:41.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10762" PostTypeId="2" ParentId="10644" CreationDate="2013-09-17T10:37:43.230" Score="0" Body="&lt;p&gt;The leaky integrator suitable for part of your solution.  See these links for more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/10609/mathematical-proof-of-complementary-filter/10611#10611&quot;&gt;Mathematical Proof of Complementary Filter？&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/10220/how-to-determine-the-parameter-of-a-complementary-filter/10613#10613&quot;&gt;How to determine the parameter of a Complementary Filter?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4487" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-09-17T10:37:43.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10763" PostTypeId="2" ParentId="10743" CreationDate="2013-09-17T12:19:13.207" Score="4" Body="&lt;p&gt;None of these spectrograms show music. I would validate your algorithms by substituting a known signal, e.g. a 440 Hz pure tone. That should be a single line in your spectrogram. Audacity can generate that as a .wav file, but you can also numerically generate the signal in Python. Next, mix two known tones and check if your spectrogram is lineair (i.e. showing two lines).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Audacity can also show you what the spectrogram &lt;em&gt;should&lt;/em&gt; be for your inputs.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2013-09-17T12:19:13.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10764" PostTypeId="1" CreationDate="2013-09-17T12:31:38.167" Score="3" ViewCount="173" Body="&lt;p&gt;I was reading section 4.3.3 from chapter 4 of &quot;A Wavelet Tour of Signal Processing&quot;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;...Let $\bar{f}(t)$ be a continuous time signal defined over $[0,1]$. Let $f[n]$ be the discrete signal obtained by a low-pass filtering of $\bar{f}$ and uniform sampling at intervals $N^{-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its discrete wavelet transform can only be calculated at scales $N^{-1}&amp;lt;s&amp;lt;1$,...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this so? I don't understand&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2013-09-17T12:31:38.167" Title="understanding discrete wavelets" Tags="|discrete-signals|wavelet|sampling|signal-analysis|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10765" PostTypeId="2" ParentId="10743" CreationDate="2013-09-17T14:23:21.167" Score="1" Body="&lt;p&gt;It seems like your data file is corrupt. Can you post that somewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;f = 10.&#xA;w = 2. * np.pi * f&#xA;time_interval = 100&#xA;samples = 5000&#xA;t = np.linspace(0, time_interval, samples)&#xA;y1 = np.sin(w * t )&#xA;y2 = np.sin(2. * w * t)&#xA;&#xA;&#xA;y1c = np.array(y1[:])&#xA;y2c = np.array(y2[:])&#xA;&#xA;yc = np.concatenate(y1c,y2c)&#xA;&#xA;&#xA;Pxx, freqs, t, plot = pylab.specgram(&#xA;    yc,&#xA;    NFFT=128, &#xA;    Fs=44100, &#xA;    detrend=pylab.detrend_none,&#xA;    window=pylab.window_hanning,&#xA;    noverlap=int(128 * 0.5))&#xA;&#xA;show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;generates this plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iEQjB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is doing the right thing, as far as I can see.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-09-17T14:23:21.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10766" PostTypeId="1" AcceptedAnswerId="10800" CreationDate="2013-09-17T15:17:43.583" Score="0" ViewCount="11421" Body="&lt;p&gt;So, in my class I have to learn how to derive the power relation in a &lt;code&gt;Double Side Band, Full Carrier Amplitude Modulated Wave&lt;/code&gt; However, I have hit a wall somewhere.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic equation is this : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{total} = P_{carrier} + P_{lower-side-band} + P_{upper-side-band}$&lt;br&gt;&#xA;Then, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{carrier} = \frac{E_c^{2}}{R}$ where $E_c$ is amplitude of carrier.&lt;br&gt;&#xA;Now , when converting to R.M.S, I divide the numerator by $\sqrt2$   and I get: $\frac{E_c^2}{2R}$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{lower-side-band} = P_{upper-side-band} = \frac{(\frac{mE_c}{2})^2}{R} = \frac{m^2E_c^2}{4R}$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the notes provided to me by my teacher state the numerator is $8R$ and I do not know why. Can someone please tell me if I have made a mistake somewhere.&lt;/p&gt;&#xA;" OwnerUserId="5462" LastEditorUserId="80" LastEditDate="2013-10-11T03:38:12.647" LastActivityDate="2013-10-11T03:38:12.647" Title="Power Relation in DSB-FC AM" Tags="|modulation|homework|amplitude|" AnswerCount="1" CommentCount="2" ClosedDate="2013-10-11T03:38:50.837" ContentLicense="CC BY-SA 3.0" />
  <row Id="10767" PostTypeId="1" AcceptedAnswerId="10784" CreationDate="2013-09-17T15:25:15.413" Score="4" ViewCount="2374" Body="&lt;p&gt;I asked this question here: &lt;a href=&quot;https://dsp.stackexchange.com/questions/10731/audio-separation-of-wav-signal&quot;&gt;Audio Separation of .wav signal&lt;/a&gt; but it wasn't clear, so, here is my second attempt:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, assume that I have a .wav file containing a sentence as follows: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;My name is Michael&quot; I would like to extract, from this, the following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;My&quot; -&gt; Phoneme (1) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Name&quot; -&gt; Phoneme (2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Is&quot; -&gt; Phoneme (3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Michael&quot; -&gt; Phoneme (4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that I have taken my 1D signal, and split it into a 2D signal (vector) that contains these particular words/phonemes which I can then analyse and identify. I would therefore, like to compute this in the time domain and not the frequency domain. Just to clarify again:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take in a 1D signal containing a sentence, split this sentence up into different parts which contain this data: &lt;code&gt;vect[0], vect[1]&lt;/code&gt;, .... &lt;code&gt;vect[4]&lt;/code&gt; Let's say in matlab I did the following command &lt;code&gt;wavwrite(vect[0], ....)&lt;/code&gt; then it would output the word &quot;My&quot; and putting all the blocks together would give me the full sentence back. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my &quot;real-world problem&quot; instead of Phonemes, I have bat calls, the length of each bat call is unknown at this stage. But here is a typical sample of a bat call: &lt;a href=&quot;http://www.surreybats.org.uk/BatsWork/SeroWeb.wav&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; and for each of these bat calls, these need to be separated from the inputted signal and stored inside a vector (Just like the example above), this, then allows me to identify each of the bats and perform analysis on them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This, like, the sample would give me a 2D vector containing each of the bat calls: &quot;Bat1&quot;, &quot;Bat2&quot; ..... &quot;Bat[n]&quot; it is unknown the amount of time the bats have been recorded for, or, what the length of each of the bat call therefore is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have done so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have obtained the bat signal, processed it and I am given the following (Which is plotted):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8PCEL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also Emphasised the signal using the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;rawSignal[i] = rawSignal[i] - (0.95 * rawSignal[i-1]);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then I have Compressed the signal using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    float param = 1.0;&#xA;for(unsigned i=0; (i &amp;lt; rawSignal.size()); i++)&#xA;{&#xA;    int sign = getSignOf(rawSignal[i]);&#xA;    float norm = normalise_abs_value(rawSignal[i]);&#xA;    norm = 1.0 - pow(1.0 - norm, param);&#xA;    rawSignal[i] = denormalize_value(norm, sign);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which then gives me an output of the following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kXayX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unclear to where I should go from here in identifying single elements (&quot;calls&quot;) from this signal. Since, if I use zero-crossing and/or calculating the total energy of the signal and thus using a threshold then it will just remove the noise and I'm left with a compressed version of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speaking to someone, they suggested that I should try and use the &lt;code&gt;Cochleagram domain&lt;/code&gt; however, I'm not familiar with this and there is very little research on this available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has any suggestions, or the algorithms that I could use then please suggest them. &lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-10-19T08:39:03.960" Title="Audio Signal Separation - Identifying Interest points" Tags="|signal-analysis|wave|source-separation|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="10768" PostTypeId="1" AcceptedAnswerId="10777" CreationDate="2013-09-17T16:55:40.223" Score="0" ViewCount="326" Body="&lt;p&gt;This might be more of a statistical question, but let us assume that we take a spectrogram, or STFT, where time is on the x-axis, and frequency is on the y-axis in this matrix. What information might be lost - or 'changed', if we decide to normalize each column by its own standard deviation, so that the variance of each column is equal to 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that we would not be able to see sudden changes in overall power changes over time, etc, that is obvious, but what other features might be contorted and/or lost if we did this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="1329" LastEditDate="2013-09-19T21:30:06.673" LastActivityDate="2013-09-19T21:30:06.673" Title="What information is lost, if any, in normalizing Seismic/Earthquake time-frames in an STFT to equal variance?" Tags="|fourier-transform|frequency-spectrum|spectrogram|stft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10769" PostTypeId="1" CreationDate="2013-09-17T17:17:44.560" Score="4" ViewCount="2253" Body="&lt;p&gt;Given this problem&#xA;&lt;img src=&quot;https://i.stack.imgur.com/pS99Q.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the autcorrelation and power spectrum are fourier pairs, so when taking taking fourier transform of Rxx, one should end up with Sxx &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I take the transform of $R_{xx}(m)$, I end up with $S_{xx}(\omega)=\frac{2\alpha }{\alpha ^{2} + \omega ^{2}}$, which also matches up with fourier transform pairs in the book. Here's by hand: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S_{xx}(\omega )= \int_{-\infty}^{\infty} R_{xx}(m)e^{-i\omega m} dm=\widehat{R}_{xx}(\omega)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=\int_{-\infty}^{\infty} R_{xx}(m)e^{-i\omega m} dm=\int_{-\infty}^{\infty} e^{-\alpha |m|}e^{-i\omega m} dm=$&#xA;$=\int_{-\infty}^{0} e^{\alpha m}e^{-i\omega m} dm + \int_{0}^{\infty} e^{-\alpha m}e^{-i\omega m} dm=$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ =\int_{-\infty}^{0} e^{m(\alpha -i\omega)} dm + \int_{0}^{\infty} e^{-m(\alpha +i\omega )} dm=$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=\frac{1}{(\alpha -i\omega)} - \frac{0}{(\alpha -i\omega)}+\frac{0}{(\alpha +i\omega)}-\frac{1}{(\alpha +i\omega)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=\frac{1}{(\alpha -i\omega)}+\frac{1}{(\alpha +i\omega)}=\frac{\alpha +i\omega+\alpha -i\omega}{(\alpha -i\omega)(\alpha +i\omega)}=\frac{2\alpha}{\alpha^{2} +\omega^{2}} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which doesn't look like equation given in the problem, unless I'm missing some identities or something here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, as for problem h), that should be pretty straight forward. Avg. power of $X=R_{xx}(0)$ right? &lt;/p&gt;&#xA;" OwnerUserId="5186" LastActivityDate="2013-11-18T20:30:50.880" Title="Fourier transform of Autocorrelation function, what am I missing here? (Power spectrum)" Tags="|autocorrelation|power-spectral-density|fourier|" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10770" PostTypeId="2" ParentId="6146" CreationDate="2013-09-17T17:26:13.133" Score="1" Body="&lt;p&gt;This can be a tricky problem for complex-valued data samples. If you have MATLAB, the &lt;code&gt;interpft()&lt;/code&gt; function, whose code is viewable with &lt;code&gt;edit interpft&lt;/code&gt;, shows how to interpolate. Be careful though, it assumes your data are periodic, just as the DFT/FFT do.&lt;/p&gt;&#xA;" OwnerUserId="5463" LastEditorUserId="80" LastEditDate="2013-09-19T20:54:32.643" LastActivityDate="2013-09-19T20:54:32.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10772" PostTypeId="2" ParentId="10754" CreationDate="2013-09-17T21:28:09.690" Score="3" Body="&lt;p&gt;The pulse envelope is convolved with a Gaussian function to soften the transition between the symbols. If the standard pulse envelope were used without any softening, it would be audible to an AM detector (it runs at ~172 Hz).&lt;/p&gt;&#xA;&lt;p&gt;Source: Chapter 8 of The IBOC Handbook: Understanding HD Radio (TM) Technology by David P. Maxson&lt;/p&gt;&#xA;" OwnerUserId="5454" LastEditorUserId="5454" LastEditDate="2021-11-17T00:33:45.953" LastActivityDate="2021-11-17T00:33:45.953" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10774" PostTypeId="1" AcceptedAnswerId="10775" CreationDate="2013-09-17T23:45:52.633" Score="2" ViewCount="994" Body="&lt;p&gt;For a real signal, the power spectrum will have Hermitian symmetry. If I consider the one-sided spectrum (as negative frequencies, or anything above the Nyquist frequency are redundant) must I then multiply my power spectrum by a factor of 2? I have seen this done but I can't understand why the &quot;redundant&quot;, symmetrical portion of the spectrum should factor into the power density? Maybe this is a matter of convention? Please correct my assumptions if necessary.&lt;/p&gt;&#xA;" OwnerUserId="5466" LastActivityDate="2013-09-18T00:00:43.950" Title="Clarification Needed: Power Spectral Density of Real Signal" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10775" PostTypeId="2" ParentId="10774" CreationDate="2013-09-17T23:53:11.407" Score="3" Body="&lt;p&gt;This stems from Parseval's theorem. For any signal, $\int_{-\infty}^{+\infty}|x(t)|^{2}\mathrm dt = \int_{-\infty}^{+\infty}|X(f)|^{2}\mathrm df$ and hence for a real signal, the one sided PSD must be multiplied by a factor of 2 because of Symmetry. Intuitively, the Fourier Analysis of any signal provides us with a spectrum which has Negative frequencies too because of the fact that Sines and Cosines can be constructed using Euler's theorem of using Complex Exponentials of positive and negative frequencies; and it so happens for any real signal that all you need are complex exponentials which are conjugates of each other to construct them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The negative portion is not exactly &quot;redundant&quot;. The signal still owns those &quot;negative&quot; frequencies and hence anything present there accounts to its energy. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-09-17T23:53:11.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10776" PostTypeId="2" ParentId="10774" CreationDate="2013-09-18T00:00:43.950" Score="1" Body="&lt;p&gt;I've found this paper on &lt;a href=&quot;http://edoc.mpg.de/395068&quot; rel=&quot;nofollow&quot;&gt;Spectrum and spectral density estimation&lt;/a&gt; to be a great resource in understanding some of these subtle points when dealing with the spectrum, windowing, and overlap. Refer to section 9 for a discussion on the scaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long story short, efficient FFT routines don't compute the redundant frequencies, so in order to properly represent the spectrum for the first half you must multiply by a factor of 2 to make up for that energy. Also, depending on if you want the power spectrum or power spectral density there are other scaling factors required.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-09-18T00:00:43.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10777" PostTypeId="2" ParentId="10768" CreationDate="2013-09-18T15:39:21.610" Score="1" Body="&lt;p&gt;Although the specifics of your data will be the ultimate factor in how this sort of normalization will impact what you're trying to measure, I think it's useful to look at extreme cases to get a sense of what might go wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose the time samples of your STFT just happened to come out one-hot, with 1s in either the highest-frequency or lowest-frequency bins and 0s everywhere else :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;STFT = [[1, 0, 0, 0, 0],&#xA;        [0, 0, 0, 0, 1],&#xA;        [1, 0, 0, 0, 0],&#xA;        ...&#xA;        ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you subtracted out the mean values from each time sample, then clearly you'd get some &quot;bleeding&quot; of the power information across frequencies. In particular, the middle-frequency bin would get some nonzero value, even though in your unnormalized STFT values, that bin never has any power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about just dividing each time sample by its standard deviation, like you're asking about ? In this case you'll just be changing the value of the nonzero frequency bin. This would certainly impact the mean value across time of each frequency bin, since all nonzero values in your spectrogram would now be 1+$\epsilon$ rather than just 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just one possible thought experiment that you could do to explore these effects. I'd say in general that the statistics of the frequency bins across time would definitely be affected by normalizing each time frame independently, but again that the specifics will depend heavily on the data that you're analyzing.&lt;/p&gt;&#xA;" OwnerUserId="5209" LastActivityDate="2013-09-18T15:39:21.610" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10779" PostTypeId="2" ParentId="206" CreationDate="2013-09-18T16:42:06.813" Score="13" Body="&lt;p&gt;For those who still cannot chalk the difference here is an simple example &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take long transmission line with simple quasi-sinusoidal signal with an amplitude envelope, &lt;span class=&quot;math-container&quot;&gt;$a(t)$&lt;/span&gt;, at its input&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x(t) = a(t) \cdot \sin(\omega t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measure this signal at the transmission line end, &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt;, it might come somewhere like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA; y(t) &amp;amp;= a(t-\tau_g) \cdot \sin(\omega t + \phi) \\&#xA; &amp;amp;= a(t-\tau_g) \cdot \sin \big(\omega (t - \tau_\phi) \big) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is phase difference from input to output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want how much time in it takes the &lt;strong&gt;phase&lt;/strong&gt; of the sinusoid, &lt;span class=&quot;math-container&quot;&gt;$\sin(\omega t)$&lt;/span&gt; transmission from input to output then &lt;span class=&quot;math-container&quot;&gt;$\tau_\phi = -\tfrac{\phi}{\omega}$&lt;/span&gt; is your answer in seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want how much time in it takes the &lt;strong&gt;envelope&lt;/strong&gt;, &lt;span class=&quot;math-container&quot;&gt;$a(t)$&lt;/span&gt;, of the sinusoid transmission from input to output then &lt;span class=&quot;math-container&quot;&gt;$\tau_g = -\tfrac{d\,\phi}{d\,\omega}$&lt;/span&gt; is your answer in seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase delay is just traveling time for a single frequency while group delay is  measure of amplitude distortion if array of multiple frequencies are applied.&lt;/p&gt;&#xA;" OwnerUserId="5470" LastEditorUserId="4346" LastEditDate="2020-03-17T17:12:14.130" LastActivityDate="2020-03-17T17:12:14.130" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10780" PostTypeId="1" CreationDate="2013-09-18T16:56:04.000" Score="1" ViewCount="64" Body="&lt;p&gt;Consider the $m$-dimensional VAR process&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\bf x}_t = \sum_{l=1}^{P} A_l{\bf x}_{t-l} + {\bf e}_t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the componenets of ${\bf e}_t$ are spatially and temporally independent and follow a generalised Gaussian distribution i.e. $e_{i,t} \sim GGD(\alpha_i, \beta_i)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given my data $X$, I am trying to estimate the VAR coefficients $A_l$ and GGD parameters $\alpha_i, \beta_i$. I have tried to use Newton-Raphson optimisation with the vector &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[\alpha_1, ..., \alpha_M, \beta_1, ..., \beta_M, A_1(1,1), ..., A_1(1,M), A_1(2,1), ..., A_P(M,M)]^T$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it is painfully slow and not very robust.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to tackle this model fitting problem? &lt;/p&gt;&#xA;" OwnerUserId="4534" LastActivityDate="2013-10-19T17:39:03.537" Title="Fitting VAR Process with Generalised Gaussian Noise" Tags="|gaussian|autoregressive-model|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10781" PostTypeId="2" ParentId="10364" CreationDate="2013-09-18T23:38:47.913" Score="2" Body="&lt;p&gt;Although it looks like it's not being actively maintained, you might check out &quot;aubio&quot; to see if it will meet your needs : &lt;a href=&quot;http://aubio.org/&quot; rel=&quot;nofollow&quot;&gt;http://aubio.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;aubio is a tool designed for the extraction of annotations from audio signals. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5209" LastActivityDate="2013-09-18T23:38:47.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10782" PostTypeId="2" ParentId="10767" CreationDate="2013-09-19T00:02:07.130" Score="0" Body="&lt;p&gt;This seems like an excellent opportunity to apply ideas from &lt;em&gt;feature learning&lt;/em&gt;. You have a signal that's assumed to be a sum of a small set of distinct calls, each with a different temporal offset, and you'd like to learn from the signal alone what the calls look like ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In math, if your signal is $x$, then the assumption is that $x$ can be expressed as&#xA;$$ x(t) = \sum_{\tau, \alpha, i\, \in\, Z} \alpha\phi_i(t - \tau) $$&#xA;where $\Phi = \{\phi_1, \dots, \phi_k\}$ is a &quot;codebook&quot; or &quot;dictionary&quot; of &quot;basis signals&quot; and $Z$ is an &lt;em&gt;encoding&lt;/em&gt; that specifies which basis signal $\phi_i$ is applied at time offset $\tau$ with magnitude $\alpha$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this describes your situation, then you might find an excellent paper by Smith &amp;amp; Lewicki [1] to be of interest. Basically, the approach they take is to apply the Matching Pursuit [MP; 2] sparse coding algorithm to an effectively extremely long audio recording of &quot;natural sounds&quot; (as opposed to sinusoids or triangle waves or the like) using convolution to do the encoding. In general, MP can be used to compute $Z$ given $x$ and $\Phi$, and Smith &amp;amp; Lewicki extend this coding algorithm with a learning approach that uses gradient descent to compute $\Phi$ as well. They show that the learned basis signals $\Phi$ closely match the auditory receptive fields from cat cochlear neurons, much like the celebrated sparse coding result from Olshausen &amp;amp; Field [3] in vision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you already know $\Phi$ (e.g., you already have recordings of the bat calls you know are in $x$) then you could just use the MP variant that Smith &amp;amp; Lewicki use to derive $Z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Smith, E &amp;amp; Lewicki, M. &quot;Efficient auditory coding.&quot; Nature, 2006.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Mallat, S &amp;amp; Zhang, Z. &quot;Matching pursuits with time-frequency dictionaries.&quot; IEEE Transactions on Signal Processing, 1993.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] Olshausen, B &amp;amp; Field, D. &quot;Emergence of simple-cell receptive field properties by learning a sparse code for natural images.&quot; Nature, 1994.&lt;/p&gt;&#xA;" OwnerUserId="5209" LastActivityDate="2013-09-19T00:02:07.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10783" PostTypeId="1" AcceptedAnswerId="10785" CreationDate="2013-09-19T06:32:31.090" Score="1" ViewCount="481" Body="&lt;p&gt;Say I have a signal that is not x-indexed. That is, the x-axis of the signal is the distance traversed by car and the y-axis is the heading direction of the car at the corresponding distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I apply the Fourier Transform to this signal?&#xA;If so, what is the physical meaning of this transformation? I believe that the horizontal axis is no longer frequency any more. What is it in this case?&lt;/p&gt;&#xA;" OwnerUserId="4677" LastActivityDate="2013-09-19T07:49:57.863" Title="Can I apply Fourier Transform to a non-time-indexed signal?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10784" PostTypeId="2" ParentId="10767" CreationDate="2013-09-19T07:48:03.933" Score="1" Body="&lt;p&gt;(a follow-up to my suggestion on the &lt;a href=&quot;https://dsp.stackexchange.com/questions/10731/audio-separation-of-wav-signal&quot;&gt;previous question&lt;/a&gt;), you can use the spectrogram and ICA to help:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar shorter sound file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import wave, struct, numpy as np, matplotlib.mlab as mlab, pylab as pl&#xA;def wavToArr(wavefile):&#xA;    w = wave.open(wavefile,&quot;rb&quot;)&#xA;    p = w.getparams()&#xA;    s = w.readframes(p[3])&#xA;    w.close()&#xA;    sd = np.fromstring(s, np.int16)&#xA;    return sd,p&#xA;&#xA;def wavToSpec(wavefile,log=False,norm=False):&#xA;    wavArr,wavParams = wavToArr(wavefile)&#xA;    print wavParams&#xA;    return  mlab.specgram(wavArr, NFFT=256,Fs=wavParams[2],detrend=detrend_mean,window=window_hanning,noverlap=128,sides='onesided',scale_by_freq=True)&#xA;&#xA;wavArr,wavParams = wavToArr(&quot;bat_speech.wav&quot;)&#xA;hf = pl.figure(); ax=hf.add_subplot(1,1,1)&#xA;ax.plot(wavArr)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q01JL.png&quot; alt=&quot;Plot of wav file data&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now take a look at the spectrogram:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Pxx, freqs, bins = wavToSpec(&quot;bat_speech.wav&quot;)&#xA;Pxx += 0.0001&#xA;freqs += (len(wavArr) / wavParams[2]) / 2.&#xA;hf=pl.figure(figsize=(12,12));&#xA;ax = hf.add_subplot(2,1,1);&#xA;#plot spectrogram as decibals&#xA;hm = ax.imshow(10*np.log10(Pxx),interpolation='nearest',origin='lower',aspect='auto')&#xA;hf.colorbar(hm)&#xA;ylcnt = len(ax.get_yticklabels())&#xA;ycnt = len(freqs)&#xA;ylstep = int(ycnt / ylcnt)&#xA;ax.set_yticklabels([ int(freqs[f]) for f in xrange(0,ycnt,ylstep) ])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/obBaa.png&quot; alt=&quot;Power spectrogram (decibals)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can clip this at 8000Hz or so it looks like, or don't bother cleaning it up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have frequencies which can proxy for multiple sources in BSS, so you can play with PCA, ICA, normalization, etc.  For example, see if you have some components you can isolate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from sklearn.decomposition import PCA, FastICA&#xA;ncomps = 7&#xA;# reduce dimensionality with PCA&#xA;pca = PCA(n_components=ncomps)&#xA;y = Pxx.copy().T&#xA;pc = pca.fit(y).transform(y)&#xA;# run ICA &#xA;ica = FastICA(n_components=ncomps,random_state=42)&#xA;z = ica.fit(pc).transform(pc).T&#xA;hf = pl.figure()&#xA;for p in xrange(ncomps):&#xA;    ax = hf.add_subplot(ncomps,1,p+1)&#xA;    ax.plot(z[p])    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qMDxr.png&quot; alt=&quot;ICA of spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or see if the spectrogram is enough to let you do your segmentation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hf = pl.figure()&#xA;ax = hf.add_subplot(1,1,1)&#xA;ax.plot(np.sum(Pxx,axis=0))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DO608.png&quot; alt=&quot;Power sum of spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:  Just realized you said you didn't want to use the frequency domain&lt;/strong&gt;, but it may help you isolate your phonemes which you can extract.  Anyway, running on your SeroWeb.wav I get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kRqx5.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FvoHf.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rQZKe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5420" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2013-09-19T08:01:27.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10785" PostTypeId="2" ParentId="10783" CreationDate="2013-09-19T07:49:57.863" Score="5" Body="&lt;p&gt;Yes you can. The unit of the &quot;frequency&quot; axis after the transform will be $m^{-1}$, and is known as &lt;a href=&quot;http://en.wikipedia.org/wiki/Spatial_frequency&quot; rel=&quot;noreferrer&quot;&gt;spatial frequency&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if there is a strong peak in the Fourier transform at $3.10^{-4} m^{-1}$, it means that your original curve exhibits a strong pattern that repeats at a scale of every $3.3km$, and from that you could infer that maybe the signal was recorded from a vehicle doing laps at the Monaco Grand Prix. The harmonics of this spatial frequency would contain a &quot;signature&quot; of the shape of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A practical application of this is handwriting recognition - looking at shapes in the Fourier domain yields representations invariant to scaling, rotations, or more robust to deformations than the original data.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-09-19T07:49:57.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10787" PostTypeId="1" CreationDate="2013-09-19T09:37:17.057" Score="3" ViewCount="1314" Body="&lt;p&gt;I have gone through the below related posts of filtering noise from the signals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2785/matlab-how-to-filter-a-discrete-signal&quot;&gt;MATLAB, How to filter a discrete signal?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/1773542/matlab-filter-noisy-ekg-signal&quot;&gt;MATLAB: Filter a noisy EKG signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the signal I want to filter contains noise which is not periodic as shown in the images below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xQGXd.png&quot; alt=&quot;http://imageshack.us/photo/my-images/824/2q9d.png/&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JcIuU.png&quot; alt=&quot;http://imageshack.us/photo/my-images/692/dwmq.png/&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest a filtering technique for the noise labeled with red colour in the image?&lt;/p&gt;&#xA;" OwnerUserId="5472" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2022-06-18T12:44:40.330" Title="MATLAB: filter nonperiodic noise in the signal" Tags="|matlab|filter-design|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10788" PostTypeId="2" ParentId="10787" CreationDate="2013-09-19T10:00:45.407" Score="1" Body="&lt;p&gt;You can do a non-decimated one dimensional wavelet transform on the image. Since the data is more or less homogeneous within a certain range, the outliers will be denoted by spikes in the wavelet coefficients. You can then use a threshold and remove those coefficients and perform inverse non-decimated wavelet transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check &lt;a href=&quot;http://computation.llnl.gov/casc/sapphire/pubs/150931.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you mind sharing a copy of the data in &lt;em&gt;.mat&lt;/em&gt; ? I would like to test it out in order to be sure.&lt;/p&gt;&#xA;" OwnerUserId="4902" LastActivityDate="2013-09-19T10:00:45.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10789" PostTypeId="1" CreationDate="2013-09-19T10:53:33.817" Score="2" ViewCount="535" Body="&lt;p&gt;I am in a intention of Porting Voice Activity Detection algorithm in real time hardware,so i was successful in classifying speech and silence/noise but now the problem is replacement of silence frames with comfort noise(preferebly any stationary noise)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so can any one suggest any opensource CNG algorithms or how a comfort noise can be of any type(pink,white etc) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;to do this usually we use a rand() functions but where as these type of functions are not available with real time DSP so how to port such type of Algorithms?&lt;/p&gt;&#xA;" OwnerUserId="4513" LastActivityDate="2013-12-26T09:28:28.283" Title="Comfort Noise Insertion in VAD algorithms" Tags="|dsp-core|voice|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10790" PostTypeId="1" CreationDate="2013-08-13T22:19:32.707" Score="2" ViewCount="3967" Body="&lt;p&gt;I am new to signal processing and I am trying to get the basic concepts right.&#xA;I have a signal and I performed the &lt;code&gt;FFT&lt;/code&gt; of the signal in MATLAB. I also did the &lt;code&gt;PSD&lt;/code&gt; of the signal in MATLAB using the &lt;code&gt;psd&lt;/code&gt; command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am confused about:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) When we get the &lt;code&gt;FFT&lt;/code&gt; of the signal, It's basically showing what frequency components are inside the signal. So it's a plot of frequency against what? It is amplitude in volt right(took the abs value of the signal)? What if I want to plot dbV against frequency should I just do a mag2dB conversion on the abs value? Is the following right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 16000;&#xA;t = 0: 1/Fs : 2*(Fs-1)/Fs;&#xA;y1 = sin(2*pi*500*t );&#xA;fshift = (fftshift(fft(y1)));&#xA;f = -8000 : 1/2 : 7999;&#xA;figure;&#xA;plot(f,mag2db(abs(fshift)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2)Now for the &lt;code&gt;PSD&lt;/code&gt;, I used the dspdata.psd of MATLAB and I get a plot. On the plot, I get my frequency component but the max amplitude (in dB) is not the same as the max amplitude (in dB) of the &lt;code&gt;FFT&lt;/code&gt; plot. Why is that? Is it because &lt;code&gt;dsp&lt;/code&gt; is using 10log 10 and mag2dB is using 20 log 10?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) In the &lt;code&gt;PSD&lt;/code&gt; plot I am getting two plots one blue one which is quite visible and a green one, smaller in amplitude, what is this green one? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 16000;&#xA;t = 0: 1/Fs : 2*(Fs-1)/Fs;&#xA;y1 = sin(2*pi*500*t );&#xA;psd1=spectrum(y1,1024);&#xA;hpsd = dspdata.psd(psd1,'Fs',Fs); % Create a PSD data object.&#xA;figure;&#xA;plot(hpsd); % Plot the PSD&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user2441667" LastEditorUserId="5132" LastEditDate="2013-11-18T16:52:01.043" LastActivityDate="2014-07-16T21:53:23.557" Title="Power Spectral Density and Fast Fourier Transform basic question" Tags="|matlab|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10791" PostTypeId="2" ParentId="10790" CreationDate="2013-08-20T02:17:49.800" Score="1" Body="&lt;p&gt;The second trace is probably the phase. You can express the spectral density either as a sine term and a cosine term (in phase and out of phase terms) or as a magnitude and phase angle.  In your first example, for your plot you have converted the sin/cos terms into a magnitude, and discarded the phase information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, log power differs from log voltage by a factor of two.  $ 2 \log{(V)} = \log{(V^2)} $. But different ways of calculating FT and inverse FT, or PSD and inverse PSD, put a constant value of $ \pi $ in different places: If you use different methods of calculation, you sometimes find that you have choosen to normalize the FT differently.&lt;/p&gt;&#xA;" OwnerUserId="4886" OwnerDisplayName="david" LastEditorUserId="80" LastEditDate="2013-11-18T17:56:47.547" LastActivityDate="2013-11-18T17:56:47.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10794" PostTypeId="1" AcceptedAnswerId="10795" CreationDate="2013-09-19T16:39:57.730" Score="0" ViewCount="681" Body="&lt;p&gt;There are various types of ADC in used, like,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ramp-compare ADC&lt;/li&gt;&#xA;&lt;li&gt;Wilkinson ADC&lt;/li&gt;&#xA;&lt;li&gt;pipeline ADC&lt;/li&gt;&#xA;&lt;li&gt;Flash ADCs&lt;/li&gt;&#xA;&lt;li&gt;Sub-Ranging ADCs&lt;/li&gt;&#xA;&lt;li&gt;Folding ADCs&lt;/li&gt;&#xA;&lt;li&gt;Pipelined ADCs&lt;/li&gt;&#xA;&lt;li&gt;Successive Approximation (Algorithmic) ADCs&lt;/li&gt;&#xA;&lt;li&gt;Integrating (serial) ADCs&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;but  Successive Approximation (Algorithmic) ADCs (ADC0808) is most commonly used.&#xA;I do not understand the reason as why it is better than any other ADC ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to this comparison,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/95UIf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is absolutely nothing so special about it as compared to other, then why it is most commonly used for education purpose and small electronic projects etc ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2013-09-19T16:56:00.663" Title="Why Successive Approximation, Analog to Digital converter is most commonly used?" Tags="|analog|digital|" AnswerCount="1" CommentCount="3" ClosedDate="2013-10-11T03:36:59.720" ContentLicense="CC BY-SA 3.0" />
  <row Id="10795" PostTypeId="2" ParentId="10794" CreationDate="2013-09-19T16:56:00.663" Score="3" Body="&lt;p&gt;For many applications, the technology often selected is the lowest cost one that meets the most common requirements (audio sample rates, etc.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-09-19T16:56:00.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10796" PostTypeId="1" AcceptedAnswerId="10906" CreationDate="2013-09-19T17:10:41.073" Score="1" ViewCount="1434" Body="&lt;p&gt;I have the following system:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qVBHE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;br /&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$ {H}_{1} \left( f \right) = {H}_{2} \left( f \right) $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \theta \sim U[0, 2\pi]$&lt;/span&gt; independent of any other factor in the system.&lt;/p&gt;&#xA;&lt;p&gt;Given the input is identical, Is this an LTI system?&lt;br /&gt;&#xA;Could you prove it?&lt;/p&gt;&#xA;&lt;p&gt;Otherwise I don't have explanation why if the input is White Gaussian Noise with the same Variance to each of the inputs (Same statistics, not the same signal) &lt;span class=&quot;math-container&quot;&gt;$ {Y}_{1} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ {Y}_{2} $&lt;/span&gt; aren't Gaussian Process yet &lt;span class=&quot;math-container&quot;&gt;$ r(t) $&lt;/span&gt; is a Gaussian Process.&lt;/p&gt;&#xA;&lt;p&gt;I have the feeling the random phase is offset by the sum of the Sine and Cosine.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="60971" LastEditDate="2022-05-24T07:08:05.347" LastActivityDate="2022-05-24T07:08:05.347" Title="Sum of Sine and Cosine with Random Phase as LTI System" Tags="|continuous-signals|linear-systems|random-process|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10798" PostTypeId="2" ParentId="3261" CreationDate="2013-09-19T23:19:51.827" Score="0" Body="&lt;p&gt;In your case, you are not simulating a continuous time signal. In general, however, if you simulate a continuous time signal, you have to increase the resolution of the arrays/vectors in MATLAB that are &quot;continuous&quot; signals so that these signals actually behave more like real-world continuous signals, e.g. to represent a continuous signal between say 0 and 32 on the time scale, your simulating vector/&quot;continuous&quot; signal could be between 0 and 2048 inclusive on an array as a representative of 0-32 on a continuous time scale. This would give a time resolution of 1/64. You could then approximately simulate sampling by taking samples out, but only after band-limiting first. &lt;/p&gt;&#xA;" OwnerUserId="5478" LastEditorUserId="5478" LastEditDate="2013-09-21T01:02:46.307" LastActivityDate="2013-09-21T01:02:46.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10799" PostTypeId="2" ParentId="10787" CreationDate="2013-09-20T04:05:50.773" Score="1" Body="&lt;p&gt;This type of noise shouldn't be difficult to remove.&lt;/p&gt;&#xA;&lt;p&gt;One approach to try is to have a moving window computing the mean and variance. Which are then used to select a clipping value &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As the window moves signal values that are higher or lower than &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; are labeled as noise.&lt;/p&gt;&#xA;&lt;p&gt;The method assumes a window clean from noise at the beginning of the signal.&lt;/p&gt;&#xA;&lt;p&gt;A somewhat similar type of noise can be found with partial discharge data, this &lt;a href=&quot;https://ieeexplore.ieee.org/document/5568200&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; shows another approach, based on the correlation function, that can be adapted to your application&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="7092" LastEditDate="2022-06-18T12:44:40.330" LastActivityDate="2022-06-18T12:44:40.330" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10800" PostTypeId="2" ParentId="10766" CreationDate="2013-09-20T08:10:12.357" Score="2" Body="&lt;p&gt;Consider your carrier signal as $E_c\cos W_{ct}$ and your message signal is $E_m \cos W_{mt}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The double side band plus carrier signal is, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ E_c\cos(W_{ct})+(E_c\cos(W_{ct})E_m\cos(W_{mt})) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ E_c\cos(W_{ct})+\frac{1}{2}(E_cE_m[\cos(W_{ct}+W_{mt})+\cos(W_{ct}-W_{mt})]) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ Ec*Cos(W_{ct})+\frac{1}{2}E_cE_m\cos(W_{ct}+W_{mt})+\frac{1}{2}*Ec*Em*Cos(W_{ct}-W_{mt}) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Carrier being $E_c\cos(W_{ct})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upper Side band being $\frac{1}{2}E_cE_m\cos(W_{ct}+W_{mt})$ and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lower Side band being $\frac{1}{2}E_cE_m\cos(W_{ct}-W_{mt})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a signal $A\cos W_t$, the average power is $(\frac{A^2}{R}T)*(\int^T_0 \cos^2 W_t) = \frac{{A_c}^2}{2R}.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Average Power of Carrier is $\frac{{E_c}^2}{2R}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Average Power of Upper Side band is $\frac{{E_cE_m}^2}{8R}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Average Power of Upper Side band is $\frac{{Ec*Em}^2}{8R}$&lt;/p&gt;&#xA;" OwnerUserId="4898" LastEditorUserId="1273" LastEditDate="2013-10-04T15:37:41.797" LastActivityDate="2013-10-04T15:37:41.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10801" PostTypeId="1" CreationDate="2013-09-20T11:25:27.927" Score="1" ViewCount="105" Body="&lt;p&gt;I am dealing with a complicated optimization problem with two parameters $N, K$. Setting $K =$ constant and finding the minimum for different $N$'s lead to a set of function values. I can do this for $K = 2,3,\cdots,8$ and $N = 5,6,\cdots,40$. Larger $K$'s or $N$'s take more time to calculate (e.g. 1 hour).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've plotted what I get (blue) and a lower bound (green) for it, which is described by $L(N,K) = \sqrt{\frac{N-K}{K(N-1)}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$K = 3$&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4XRa2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$K = 4$&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qxvQj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any of these two are desired :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;An expression with respect to $(N,K)$ which best approximates the values I'm getting.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A tighter lower bound (for larger $N$'s)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What methods do you suggest?&lt;/p&gt;&#xA;" OwnerUserId="5104" LastEditorUserId="128" LastEditDate="2019-06-26T08:49:29.107" LastActivityDate="2019-06-26T08:49:29.107" Title="How to Approximate / Fit a Function and a Lower Bound on It?" Tags="|approximation|least-squares|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10802" PostTypeId="2" ParentId="10796" CreationDate="2013-09-20T12:23:11.570" Score="4" Body="&lt;p&gt;So let's just look at it from a linear systems perspective:&#xA;$$&#xA;\begin{array}{ccl}&#xA;r(t) &amp;amp;=&amp;amp; Y_1(t) + Y_2(t)\\&#xA;&amp;amp;=&amp;amp; Z_1(t) \cos(2\pi f_0 t + \theta) + Z_2(t) \sin(2\pi f_0 t + \theta)\\&#xA;&amp;amp;=&amp;amp; [ X_1(t) * H_1(t) ] \cos(2\pi f_0 t + \theta) + [ X_2(t) * H_1(t)] \sin(2\pi f_0 t + \theta)&#xA;\end{array} &#xA;$$&#xA;where $X_1$ and $X_2$ are the respective (unlabeled) inputs, $H_1$ and $H_2$ are the impulse responses of the filters, and $*$ is convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You appear to be asking whether the system is LTI when $H_1 = H_2 = H$ and $X_1 = X_2 = X$.  In that case, we get&#xA;$$&#xA;\begin{array}{ccl}&#xA;r(t) &amp;amp;=&amp;amp; [ X(t) * H(t) ] [\cos(2\pi f_0 t + \theta) + \sin(2\pi f_0 t + \theta)]\\&#xA;&amp;amp;=&amp;amp; \sqrt{2} [ X(t) * H(t) ] \cos(2\pi f_0 t + \theta - \pi/4)&#xA;\end{array} &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's linear: &#xA;$$&#xA;\begin{array}{ccl}&#xA;r_a(t) &amp;amp;=&amp;amp; \sqrt{2} [ a(t) * H(t) ] \cos(2\pi f_0 t + \theta - \pi/4)\\&#xA;r_b(t) &amp;amp;=&amp;amp; \sqrt{2} [ b(t) * H(t) ] \cos(2\pi f_0 t + \theta - \pi/4)\\&#xA;r_{a+b}(t) &amp;amp;=&amp;amp; \sqrt{2} [ (a(t) + b(t)) * H(t) ] \cos(2\pi f_0 t + \theta - \pi/4) = r_a(t) + r_b(t)\\&#xA;\end{array} &#xA;$$&#xA;But it's not time-invariant:&#xA;$$&#xA;\begin{array}{ccl}&#xA;r(t) &amp;amp;=&amp;amp; \sqrt{2} [ X(t) * H(t) ] \cos(2\pi f_0 t + \theta - \pi/4)\\&#xA;r_\delta(t) &amp;amp;=&amp;amp; \sqrt{2} [ X(t-\delta) * H(t) ] \cos(2\pi f_0 t + \theta - \pi/4)\\&#xA;r(t-\delta) &amp;amp;=&amp;amp; \sqrt{2} [ X(t-\delta) * H(t) ] \cos(2\pi f_0 (t-\delta) + \theta - \pi/4)\\&#xA;\end{array} &#xA;$$&#xA;as $r_\delta(t) \not = r(t-\delta)$.  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what happens if $X_1 = X_2 = X$ and $X\ \tilde{\ }\ N(0,\sigma^2)$ and $\theta\ \tilde{\ }\ U[0,2\pi)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see why $Y_1(t) = [ X(t) * H(t) ] \cos(2\pi f_0 t + \theta)$ might be non-Gaussian.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I cannot see why $Y_1 + Y_2 = \sqrt{2} [ X(t) * H(t) ] \cos(2\pi f_0 t + \theta - \pi/4)$ will be Gaussian?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please update your question to explain?&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-09-23T15:12:14.063" LastActivityDate="2013-09-23T15:12:14.063" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="10803" PostTypeId="1" CreationDate="2013-09-20T15:47:45.653" Score="1" ViewCount="116" Body="&lt;p&gt;i've read that it is possible to interpolate between two sets of filter coefficients (if they are close of course), but how to interpolate between two sets of coefficients which are of different orders? Is it possible ? If not what is the possible way to fade between two IIR filters ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;" OwnerUserId="5349" LastEditorUserId="5349" LastEditDate="2013-09-20T15:55:35.910" LastActivityDate="2013-09-20T15:55:35.910" Title="interpolation of filter coefficients" Tags="|infinite-impulse-response|interpolation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10804" PostTypeId="1" AcceptedAnswerId="10819" CreationDate="2013-09-20T19:53:07.483" Score="4" ViewCount="380" Body="&lt;p&gt;Are there any known methods to use existing keypoint detectors (which generally work on grayscale images) on color images? of course, one could always add the results of the detector on all three channels to get $3N$ keypoints, but I was wondering if there exist other established methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I am looking to use a FAST like detector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, that I am not looking for a color based descriptor, but rather for a color based detector. &lt;/p&gt;&#xA;" OwnerUserId="3803" LastActivityDate="2013-09-23T06:40:09.483" Title="Keypoint detection with color images" Tags="|image-processing|corners|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10806" PostTypeId="1" CreationDate="2013-09-21T07:50:18.827" Score="0" ViewCount="62" Body="&lt;p&gt;I am working in image cryptography using an ICA algorithm like JADE. To evaluate my work, I am used the SDR and PSNR. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know what the acceptable values of the SDR and PSNR in image blind separation are.&lt;/p&gt;&#xA;" OwnerUserId="5484" LastEditorUserId="76" LastEditDate="2013-09-28T18:43:47.967" LastActivityDate="2013-10-28T19:43:48.253" Title="Image blind separation" Tags="|noise|ica|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10807" PostTypeId="1" AcceptedAnswerId="10809" CreationDate="2013-09-21T18:25:59.470" Score="1" ViewCount="5592" Body="&lt;p&gt;Which one is better for frequency detection? In what circumstances? Advantages and disadvantages of both? Which would be better for a Voice Activation Detection algorithm? Which would be better for an instrument tuner? How would one detect pitch user an HHT transform? Is it faster than FFT? How would one implement HHT?&lt;/p&gt;&#xA;" OwnerUserId="5485" LastActivityDate="2013-09-22T08:29:50.287" Title="Advantages and disadvantages of Hilbert-Huang Transform versus Fast Fourier Transform?" Tags="|fft|frequency-spectrum|speech-recognition|pitch|speech-processing|" AnswerCount="1" CommentCount="1" ClosedDate="2013-10-04T12:15:29.237" ContentLicense="CC BY-SA 3.0" />
  <row Id="10808" PostTypeId="2" ParentId="10806" CreationDate="2013-09-21T18:27:40.637" Score="1" Body="&lt;p&gt;The best way to compare your method to others is to run the algorithms on a common data set. Quntative measures such as PSNR vary significantly across images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also important to consider subjective analysis. After all, your research is aiming for improvements in &lt;strong&gt;appearance&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-09-21T18:27:40.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10809" PostTypeId="2" ParentId="10807" CreationDate="2013-09-22T08:29:50.287" Score="0" Body="&lt;p&gt;Fourier algorithm is actually a global transform that can not reflect the damping and local specialty. Unfortunately, these features are fundamental and important for characterize a nonstationary signal. on the other hand in the Fourier algorithm the estimation of frequencies are sensitive to noise. so HHT is better in your case if you are going to deal with noisy signals.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2013-09-22T08:29:50.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10812" PostTypeId="2" ParentId="10442" CreationDate="2013-09-22T14:05:07.050" Score="0" Body="&lt;p&gt;Least-squares estimator is a maximum likelihood estimator when the errors are have normal (i.e. Gaussian) distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you mean &lt;a href=&quot;http://www.imagingshop.com/articles/least-squares#nonlinear-gn&quot; rel=&quot;nofollow&quot;&gt;Gauss-Newton method&lt;/a&gt; for solving nonlinear least squares problems.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-09-22T14:05:07.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10813" PostTypeId="1" AcceptedAnswerId="10814" CreationDate="2013-09-22T14:16:48.280" Score="1" ViewCount="113" Body="&lt;p&gt;I work with images in &lt;a href=&quot;http://xeds.eu/clone/poisson.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;gradient domain&lt;/a&gt; because I sometimes need to manipulate image gradients (i.e. Laplacian filter responses) rather than intensity values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I need to apply a geometric transform (distortion) to an image already in gradient domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is is then meaningful to reintegrate the distorted image back to spatial domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my earlier question related to &lt;a href=&quot;https://dsp.stackexchange.com/questions/6223/gradient-domain-reconstruction-scaling-problem&quot;&gt;gradient domain reconstruction&lt;/a&gt; with some images.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-09-23T07:07:06.440" Title="Geometric Transformation in Gradient Domain Possible?" Tags="|image-processing|transform|gradient-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10814" PostTypeId="2" ParentId="10813" CreationDate="2013-09-22T15:08:43.297" Score="1" Body="&lt;p&gt;The geometric transformation needs to be independent from the pixel coordinates $x$ and $y$. assume that $G$ is your transformation matrix:&#xA;$$&#xA;\int\frac{d^{2} (G I)}{dx dy}  = G \int\frac{d^{2} (I)}{dx dy} &#xA;$$&#xA;is true only when $G$ is independent from the coordinates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The restoration will succeed with constant (&lt;em&gt;i.e.&lt;/em&gt; global) image rotations, scalings, and shifts.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-09-23T07:07:06.440" LastActivityDate="2013-09-23T07:07:06.440" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10816" PostTypeId="2" ParentId="10672" CreationDate="2013-09-22T17:00:45.567" Score="2" Body="&lt;p&gt;I don't understand what exactly you are doing, and &lt;strong&gt;your Nyquist frequency is only 50KHz if you're sampling at 100KHz (so you won't get 1MHz resolution)&lt;/strong&gt;.  Please clarify if you need a better answer.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, Python has several ways to compute a PSD.  One is with &lt;a href=&quot;http://matplotlib.org/api/pyplot_api.html#module-matplotlib.pyplot&quot; rel=&quot;nofollow noreferrer&quot;&gt;matplotlib&lt;/a&gt;.  For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;matplotlib.pyplot as pl&#xA;# ...load in your data to dataArr...&#xA;sampFreq = 100000&#xA;Pxx, freqs = pl.psd(dataArr, NFFT=256,Fs=samplFreq,detrend=detrend_mean,window=window_hanning,noverlap=128,sides='onesided',scale_by_freq=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you get a nice plot, along with the PSD data in &lt;code&gt;Pxx&lt;/code&gt; and the frequencies in &lt;code&gt;freqs&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Je00A.png&quot; alt=&quot;Example PSD&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5420" LastActivityDate="2013-09-22T17:00:45.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10817" PostTypeId="2" ParentId="10789" CreationDate="2013-09-22T17:21:40.677" Score="2" Body="&lt;p&gt;You may want to try a two-pronged approach.  First, have a standard pre-packaged CN to inject (like jan and Jason R suggest) at the start of the conversation/exchange.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the conversation progresses, gather low-volume data, perhaps as part of your noise reduction algorithm I assume you already have, by sampling the lowest volume signal coming in between VAD end and start points. Compare your low-volume samples to your standard CN, and replace (or convolve to simply dilute your synthetic CN) if it matches some threshold or characteristic you established. All you need is some rand and normalization functions, and perhaps FFT, all of which are readily available in C (and assembly).&lt;/p&gt;&#xA;" OwnerUserId="5420" LastActivityDate="2013-09-22T17:21:40.677" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10819" PostTypeId="2" ParentId="10804" CreationDate="2013-09-23T06:40:09.483" Score="4" Body="&lt;p&gt;Short answer is &lt;strong&gt;no&lt;/strong&gt;, there are none, or maybe none that made it until becoming a de facto standard like FAST or SIFT.&#xA;This is still an open area of research by the way if you plan to work in this field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mostly, the issues are linked to the &lt;em&gt;fragility of color representation&lt;/em&gt; in digital images. The common &lt;a href=&quot;http://en.wikipedia.org/wiki/RGB_color_space&quot; rel=&quot;nofollow&quot;&gt;RGB color space&lt;/a&gt; is not really relevant (distances between colors in RGB do not match the perceptual intuition of color distance), so you probably have to go &lt;a href=&quot;http://en.wikipedia.org/wiki/Lab_color_space&quot; rel=&quot;nofollow&quot;&gt;Lab&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/YCbCr&quot; rel=&quot;nofollow&quot;&gt;YCbCr&lt;/a&gt; first, then work on the luminance channel. Also, be aware of the &lt;a href=&quot;http://en.wikipedia.org/wiki/White_balance&quot; rel=&quot;nofollow&quot;&gt;white balance&lt;/a&gt; that can vary a lot between different cameras, or with a given camera but varying light conditions (sunlight, artificial light...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, in most cases the detection and/or description have good reasons to be color agnostic. For example, when you watch a black-and-white movie, your brain can still recognize objects although they have lost their color.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-09-23T06:40:09.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10820" PostTypeId="2" ParentId="10796" CreationDate="2013-09-23T08:35:19.080" Score="3" Body="&lt;p&gt;Just a different way of proofing time variance. Not nearly as neat and thorough as Dilip's but a lot quicker :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the input is x(t) = 1 (a constant) and H1(f) = H2(f) = 1 (flat, basically a wire. Output is then r(t) = sin(om+phi)+cos(om+phi) which is sqrt(2)*sin(om +phi + pi/4). So we have DC in and a different frequency out. The output is a function of time when the input isn't, so it's necessarily time variant.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-09-23T08:35:19.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10821" PostTypeId="1" AcceptedAnswerId="10822" CreationDate="2013-09-23T10:16:55.870" Score="0" ViewCount="663" Body="&lt;p&gt;Sorry if this is elementary. If I add a small sinusoidal signal to my data and then take FFT of both my original and the modified one and then inverse FFT the division of the two, I should then be left with the sinusoid. But when I do the above, I get a shift in my output, as if the phase is lost. What am I doing wrong ? thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FS = 500;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MODIFIED=fft(inp(512:1023)+sinus); %inp = data + tapered sinsus &lt;/p&gt;&#xA;&#xA;&lt;p&gt;INP=fft(inp);          &lt;/p&gt;&#xA;&#xA;&lt;p&gt;out=ifft(MODIFIED./(INP+eps))/FS;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/82vmw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7sIwr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2013-09-23T12:38:00.123" Title="spectral division" Tags="|fft|phase|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10822" PostTypeId="2" ParentId="10821" CreationDate="2013-09-23T12:38:00.123" Score="3" Body="&lt;p&gt;Why are you performing division? That's just an incorrect assumption. Since the DFT is a linear operation, if you add the sinusoid before the DFT, then if you wanted to cancel it out in the frequency domain, you would &lt;em&gt;subtract&lt;/em&gt; the DFT of the sinusoid. Still not a very practical approach, but it would work for your example. There are very few cases where you would want to divide spectra; one problem is that if the denominator spectra has any nulls in it, your result ends up as infinite, which is unlikely to be desirable. &lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-09-23T12:38:00.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10823" PostTypeId="1" AcceptedAnswerId="10866" CreationDate="2013-09-23T14:02:41.770" Score="2" ViewCount="1033" Body="&lt;p&gt;I am trying to understand one simple thing in wavelets and I searched a lot, but did not get any idea. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to perform Multilevel 1-D wavelet decomposition on my signal. I have arrays     &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal[] and time[]  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;( time[x] corresponds to the time at which signal[x] occurs ) . After I perform &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wavedec(signal,level=1,'wname')) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to plot cA1 vs the time signal. But how do I know which time points should I select. If i change the 'wname' , I get different length cA1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, for a signal of length 9285, when I do &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[cA1,cD1]=pywt.wavedec(signal,db1, level=1,mode=pywt.MODES.zpd)&#xA;length of cA1=4643&#xA;&#xA;[cA1,cD1]=pywt.wavedec(signal,db2, level=1,mode=pywt.MODES.zpd)&#xA;length of cA1 = 4644&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can we determine the variation of cA1 and how can we select the corresponding time. I use pywavelet&lt;/p&gt;&#xA;" OwnerUserId="5496" LastEditorUserId="5496" LastEditDate="2013-09-23T14:36:08.587" LastActivityDate="2013-09-26T21:11:56.630" Title="Wavelet time extraction" Tags="|wavelet|python|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10824" PostTypeId="2" ParentId="10428" CreationDate="2013-09-23T14:59:01.517" Score="2" Body="&lt;p&gt;I haven't used the technique, but an IIR filter order of 50 sounds remarkably high, and possibly prone to numerical problems.  Try starting out with much smaller values for M and filter order, and slowly ramping them up.  The paper you quote uses $M=8$ and $N=9$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-09-23T14:59:01.517" CommentCount="0" CommunityOwnedDate="2013-09-23T14:59:01.517" ContentLicense="CC BY-SA 3.0" />
  <row Id="10825" PostTypeId="2" ParentId="10739" CreationDate="2013-09-23T15:23:20.780" Score="2" Body="&lt;p&gt;This is clearly not an easy task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, if you want a more-or-less accurate count, then you need to turn to advanced algorithms (and maybe use 2 cameras, or a kinect).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't afford to take this path, then you need to try simpler options. Personally, I would try the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;detecting skin pixels, segmenting the image with respect to that, then count the blobs (complexity medium);&lt;/li&gt;&#xA;&lt;li&gt;detect faces, then count them. Obviously, people have to be facing the camera, but you can find any implementations of face detection with different libraries (complexity low);&lt;/li&gt;&#xA;&lt;li&gt;use background subtraction (after some careful tuning to take into account natural illumination changes) and guess a count based on the number of pixels that belong to the foreground (complexity low, but expect poor results);&lt;/li&gt;&#xA;&lt;li&gt;apply some existing pedestrian detection algorithm (complexity medium to high).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You don't have to implement all that by yourself. In your case, checking what OpenCV can do (or if your algorithm of choice is implemented in OpenCV) seems a good choice because:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Processing and openFrameworks have wrappers to OpenCV;&lt;/li&gt;&#xA;&lt;li&gt;OpenCV usually has a good runtime performance;&lt;/li&gt;&#xA;&lt;li&gt;many computer vision algorithms that will interest you are developed with OpenCV (face detection, background subtraction, probably pedestrian detection).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-09-23T15:23:20.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10826" PostTypeId="1" CreationDate="2013-09-23T15:29:06.347" Score="3" ViewCount="1756" Body="&lt;p&gt;I am doing my project on speaker recognition. One of my friends is doing his project on speech recognition. Both of us need to calculate the MFCC for feature extraction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the MFCC going to be the same one for both of us? Is there any difference between the algorithm of MFCC for speech and that for speaker recognition?&lt;/p&gt;&#xA;" OwnerUserId="5497" LastEditorUserId="76" LastEditDate="2013-09-27T06:00:42.390" LastActivityDate="2017-05-24T22:14:06.677" Title="Difference Between MFCC of speech and speaker recognition" Tags="|matlab|audio|speech-recognition|mfcc|speech-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10827" PostTypeId="2" ParentId="10826" CreationDate="2013-09-23T18:57:20.850" Score="2" Body="&lt;p&gt;Both speech recognition and speaker recognition require some set of features to distinguish one speaker (or speech section) from another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you have two speakers $S_1$ and $S_2$  and two words $w_1$ and $w_2$. Let's call $u_{ij}$ the utterance of speaker $i$ of word $j$.  Then the MFCC's of the speech are $M(u_{ij})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to pose the speaker recognition problem is to determine which speaker said a new utterance, $u_{\rm new}$. Assume that the utterance is word $J$. To do this, we just select the speaker such that&#xA;$$&#xA;I = \arg\min_{\forall i} \lVert u_{iJ} - u_{\rm new}\rVert&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How this works will be determined by the inter-speaker variation (i.e. how much the MFCCs of different speakers saying the same word differ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to pose the speech recognition problem is to select:&#xA;$$&#xA;J = \arg\min_{\forall j} \lVert \bar{u}_{j} - u_{\rm new} \rVert&#xA;$$ &#xA;where $\bar{u}_{j}$ is the &lt;em&gt;average&lt;/em&gt; MFCC of all speakers saying word $j$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How this works will be determined by the inter-word variation (i.e. how much the MFCCs of different words being said by different speakers differ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, yes, the MFCCs for both applications are (or can be) the same.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2017-05-24T22:14:06.677" LastActivityDate="2017-05-24T22:14:06.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10828" PostTypeId="2" ParentId="10826" CreationDate="2013-09-23T19:02:42.320" Score="2" Body="&lt;p&gt;The features are the same. You might encounter differences in some of the implementation details (window sizes, number of mel filters, number of extracted coefficients) reported in research papers, but these are not significant.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-09-23T19:02:42.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10829" PostTypeId="1" AcceptedAnswerId="10830" CreationDate="2013-09-24T02:28:30.503" Score="2" ViewCount="4704" Body="&lt;p&gt;Let the function be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f(t) = e^{-3t} u(t -1)&#xA;$$&#xA;The criterion is set at 70% of the total signal energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to find total energy, but not how to find the the $W$ (or frequency) at which the signal is a certain amount.&lt;/p&gt;&#xA;" OwnerUserId="5380" LastEditorUserId="80" LastEditDate="2013-09-24T18:00:35.343" LastActivityDate="2013-09-24T18:00:35.343" Title="What is the essential bandwidth with the given function?" Tags="|fourier-transform|frequency-spectrum|bandwidth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10830" PostTypeId="2" ParentId="10829" CreationDate="2013-09-24T02:34:08.093" Score="3" Body="&lt;p&gt;Find the Fourier Transform $F(\omega)$ and perform the following integration.$\frac{1}{2\pi}\int_{-W}^{W}|F(\omega)|^2\mathrm{d}\omega=0.7E$, where $E$ is the total Energy of the function given by: $E=\frac{1}{2\pi}\int_{-\infty}^{+\infty}|F(\omega)|^{2}\mathrm{d}\omega$.&lt;br&gt;&lt;br&gt;The value of $W$ is the 70% Bandwidth. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastEditorUserId="5102" LastEditDate="2013-09-24T17:05:48.273" LastActivityDate="2013-09-24T17:05:48.273" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10831" PostTypeId="1" CreationDate="2013-09-24T09:09:41.623" Score="7" ViewCount="277" Body="&lt;p&gt;I have worked with state space models in relation to Kalman estimation. Here I have always seen state space models with fixed state size over time, i.e. the state transition matrix is square.&#xA;Let us for example define:&#xA;$$x_{t+1} = A_t x_t + B_t u_t\\&#xA;y_t = C_t x_t + D_t v_t$$&#xA;Then $A_t$ is $n \times n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose I could easily allow the state to change size at time $t_\text{change}$ by allowing $A_{t_\text{change}}$ to be of size $m \times n$ where $m\neq n$. Is this &quot;allowed&quot; in state space models in general? And does this entail any problems in applying a Kalman filter to estimate the state $x_t$ for $t$ &quot;across&quot; the point $t_\text{change}$?&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2014-12-16T21:06:45.070" Title="Can a state space model have changing state size over time?" Tags="|kalman-filters|state-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10832" PostTypeId="1" CreationDate="2013-09-24T10:55:59.500" Score="2" ViewCount="201" Body="&lt;p&gt;Camera setup: We have setup some stereo cameras in a living apartment. That is, the indoor environment is monitored. With the stereo cameras, wide lens (3.5mm) are used to cover a big volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The height from the floor is around 2.8 meters. The objects (such as mug, bottle, telephone) are at least 3 meters away. For instance, an object (75mmx102mm), which located 3 meters away from the camera, is represented by 15x20px in the camera image. Thus, the images are getting smaller in the far field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have around 30 different objects to be recognized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not use the depth information, because it is not so accurate. I just use RGB values from a single camera. Image resolution is 1360 x 1024 pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approaches: 1. Point detectors/descriptors, matches (some models in the database, and check the match one by one) 2. Bag of visual worlds + SVM classification (5 object categories)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had experiences with Haar-cascade but I never tried for my current issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What methods/approaches should I try to investigate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance,&lt;/p&gt;&#xA;" OwnerUserId="5506" LastActivityDate="2013-11-26T08:44:50.323" Title="Recognition of household objects ( image processing, pattern recognition ) using wide lens?" Tags="|object-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10833" PostTypeId="1" CreationDate="2013-09-24T12:21:30.357" Score="0" ViewCount="59" Body="&lt;p&gt;I know there are methods to determine the degree of polarization of multi-dimensional signals, say [Bx(t), By(t)] -&gt; DOP(f). Is there any way to extract a DOP for given vector time series in the time domain? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5508" LastActivityDate="2013-10-25T08:39:37.693" Title="How to determine degree of polarization in time domain!" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10834" PostTypeId="1" CreationDate="2013-09-24T12:58:33.833" Score="2" ViewCount="1744" Body="&lt;p&gt;In image processing, up to which value of mean and variance can a Wiener filter be used to denoise the image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wiener filtering can be used when variance of the noisy image is low, but I don't know the specific values of variance and mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are limitations of the Wiener filter?&lt;/p&gt;&#xA;" OwnerUserId="5511" LastEditorUserId="76" LastEditDate="2013-09-27T05:59:43.653" LastActivityDate="2023-12-04T22:03:20.410" Title="Limitation of Wiener filter in image denoising" Tags="|image-processing|denoising|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10835" PostTypeId="1" CreationDate="2013-09-24T15:29:43.083" Score="4" ViewCount="1926" Body="&lt;p&gt;We know that the square window gives the lowest main lobe width possible, and that other windows after that trade main lobe width for side lobe height. I also understand that the main lobe width is inversely proportional to the length of the DFT aperature. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this, is there then a physical limit to how narrow a main-lobe can be, for a fixed aperture length? For example, can we ever hope to have main lobes that are narrower than that given by a square window, (for a fixed aperture length again), via windowing or any other method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A second related question I have here has to do with energy conservation - is the interpretation that windows trade side lobe height for main lobe width, because energy must be conserved? Thus any reduction in side lobe height means the energy &quot;has to go somewhere&quot; and ends up in the main lobe? Would this be a correct interpretation?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2013-09-24T21:18:45.917" Title="What is the physics behind the width of a main lobe?" Tags="|fourier-transform|window-functions|fourier-series|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="10836" PostTypeId="1" CreationDate="2013-09-24T15:54:53.230" Score="2" ViewCount="1205" Body="&lt;p&gt;I have signals captured from two channels of a measurement system. There is phase and magnitude differences between these two signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to apply nonlinear smoothing to the magnitude, but the phases should remain the same after the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have done both channels:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Perform FFT&lt;/li&gt;&#xA;&lt;li&gt;calculate magnitude&lt;/li&gt;&#xA;&lt;li&gt;calculate phase&lt;/li&gt;&#xA;&lt;li&gt;apply nonlinear smoothing to the magnitude&lt;/li&gt;&#xA;&lt;li&gt;get real and imaginary part from smoothed magnitude and phase&lt;/li&gt;&#xA;&lt;li&gt;perform inverse FFT.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However the resultant signal is not as desired. It appears as a two sided time signal or has some additional signals in the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution to this problem?&lt;/p&gt;&#xA;" OwnerUserId="5512" LastActivityDate="2013-09-24T19:27:32.343" Title="How to do smoothing without affecting phase" Tags="|fft|phase|smoothing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10837" PostTypeId="1" AcceptedAnswerId="10969" CreationDate="2013-09-24T16:21:17.347" Score="2" ViewCount="6231" Body="&lt;p&gt;I am looking for a implementation of Hilbert-Huang Transformation. Ideally, in Java, but any language with similar syntax would prove useful. Could someone point me to a specific implementation, preferably in Java?&lt;/p&gt;&#xA;" OwnerUserId="5485" LastActivityDate="2017-11-20T12:53:26.783" Title="Hilbert-Huang Transform Implementation" Tags="|frequency|transform|real-time|hilbert-transform|java|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10839" PostTypeId="2" ParentId="10835" CreationDate="2013-09-24T18:57:40.437" Score="1" Body="&lt;p&gt;A non-rectangular bell-shaped window reduces information magnitude at the edges of the window.  This either is, or acts like, information loss.  Thus the main lobe gets fatter to indicate a greater uncertainty with respect to its peak due to information loss. (relative to the noise floor, etc. etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The concepts of information theory seem to be used in both physics and signal analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The side lobes get lower because the high frequency energy related to producing any discontinuities between the FFT's 2 sides using circular basis vectors is reduced by a bell shaped window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two effects are similarly opposite in term of energy trade-off, but not exactly opposite, as different windows have differing areas under the curve, thus producing another degree-of-freedom in the trade-off between main lobe and side lobe energy, even given Parseval's theorem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The width of the main lobe is inversely related to the length of the information and S/N of the information fed to the FFT.  In absolutely zero noise, just 3 or 4 non-aliased points can be used to calculate the exact frequency of a single pure sinusoid in the time domain (e.g. equivalent to an interpolated main lobe width of zero in the frequency domain).  Additional information outside the DFT data can also be used to estimate a narrower main lobe: For instance, many FFT post-processing frequency estimation methods assume a-priori that the data is stationary outside the widow and thus make use of the results from other offset windows, etc.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-09-24T21:18:45.917" LastActivityDate="2013-09-24T21:18:45.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10840" PostTypeId="2" ParentId="10836" CreationDate="2013-09-24T19:27:32.343" Score="2" Body="&lt;p&gt;Any smoothing in the frequency domain is similar to convolution filtering.  And convolution filtering (with anything other an impulse or zero) will spread the width of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a real result, you may need to check to make sure the input to your IFFT is conjugate symmetric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want any phase shift, you could try copying the phase from before your filter into the result after your filtering and before the IFFT.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-09-24T19:27:32.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10841" PostTypeId="1" AcceptedAnswerId="10842" CreationDate="2013-09-23T01:29:26.427" Score="3" ViewCount="222" Body="&lt;p&gt;&lt;a href=&quot;http://www.google.com/search?q=databending&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.google.com/search?q=databending&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is, from what I understand, opening images as audio, applying effects, exporting back as image and voila! &lt;a href=&quot;http://en.wikipedia.org/wiki/Glitch_art&quot; rel=&quot;nofollow noreferrer&quot;&gt;glitch-art&lt;/a&gt;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TJK4Y.jpg&quot; alt=&quot;big image&quot;&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://www.reddit.com/r/glitch_art/comments/18rd6s/opened_image_as_audio_data_applied_audio_effects/&quot; rel=&quot;nofollow noreferrer&quot;&gt;credit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how does it really work? How/what change in frequencies(?) affect the pixels? It can't be totally random since some of them aren't completely distorted..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does time(in audio) relate to the dimensions and colors of the image?&lt;/p&gt;&#xA;" OwnerUserId="5499" OwnerDisplayName="laggingreflex" LastActivityDate="2013-09-24T19:57:03.500" Title="What is databending and how does it actually work?" Tags="|digital|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10842" PostTypeId="2" ParentId="10841" CreationDate="2013-09-23T06:34:39.143" Score="5" Body="&lt;p&gt;It's pretty simple, really.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, this relies on the fact that the images must be saved in an uncompressed file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think about how an image is stored, it's functionally a bunch of sequential numbers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(PX 0,0 - R:x, G:y, B:z)&#xA;(PX 1,0 - R:x, G:y, B:z)&#xA;(PX 2,0 - R:x, G:y, B:z)&#xA;(PX 3,0 - R:x, G:y, B:z)&#xA;....&#xA;(PX 639,0 - R:x, G:y, B:z)&#xA;(PX 0,1 - R:x, G:y, B:z)&#xA;(PX 1,1 - R:x, G:y, B:z)&#xA;....&#xA;(PX 639,479 - R:x, G:y, B:z)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For most bitmaps, R, G, B are either 8 or 16 bit values (1 or 2 bytes). Therefore, the &quot;image&quot; is really just a very long sequence of numbers, with some agreed-upon way of mapping those numbers into pixel-positions and colors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how is an uncompressed audio file represented? Very, very similarly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(Sample 0 - R:x, L:y)&#xA;(Sample 1 - R:x, L:y)&#xA;(Sample 2 - R:x, L:y)&#xA;(Sample 3 - R:x, L:y)&#xA;....&#xA;(Sample z-1 - R:x, L:y)&#xA;(Sample z - R:x, L:y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Most audio samples are 16 bit (some are 24, it can vary) per sample. However, again, the audio file is really just a whole bunch of numbers, with a agreed-upon method for translating the sequences of numbers back into an audio stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that you understand how the files are structured, you can start to see how the audio effects relate to the images. First, since uncompressed images are generally stored in a raster-scanned topology, audio effects are primarily going to have a horizontal &quot;smearing&quot; effect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you can see that basically the effects are going to permute the images based on the effective horizontal frequency components of each horizontal row of pixels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;Random EQ&quot; setting boosts some the frequency components of the horizontal edges in the image, and the rippling that surrounds each edge is a function of the impulse-response of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;Distortion&quot; image looks to be adding some high-frequency noise, in addition to some apparent posterization, which makes me think it may decimate the internal sample-values in some manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;Bass-Boot&quot; is clearly exaggerating the swings between wide areas of low-values (e.g. black) and high-values (e.g. light colours). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what exactly the phazer is doing (I don't know what it would sound like, so I can't extrapolate to the DSP it involves). &lt;/p&gt;&#xA;" OwnerUserId="467" OwnerDisplayName="Fake Name" LastActivityDate="2013-09-23T06:40:37.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10843" PostTypeId="1" CreationDate="2013-09-25T00:56:57.390" Score="0" ViewCount="251" Body="&lt;p&gt;I have a dataset which contains a large number of time-series which have been filtered with acausal Butterworth filters. For a real-time application, I can only use causally filtered data.&#xA;Is it possible to turn the output of an acausal Butterworth filter into what would have been obtained if the original time-series had been run through a causal Butterworth filter?&#xA;(I do not have the original, unfiltered, time-series)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do know the order of the filter that was applied, the corner freuquencies, and some parameter 'nroll' of which I don't know what it is ... (nroll is usually equal 2.5) &lt;/p&gt;&#xA;" OwnerUserId="5516" LastEditorUserId="5516" LastEditDate="2013-09-29T01:09:51.123" LastActivityDate="2013-10-29T01:44:04.393" Title="Turn acausal Butterworth output into output of a causal Butterworth without input signal" Tags="|filters|filter-design|lowpass-filter|bandpass|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10844" PostTypeId="1" CreationDate="2013-09-25T06:59:39.337" Score="3" ViewCount="1017" Body="&lt;p&gt;How do I estimate PSD in matlab ? There are lots of methods to estimate, depending on application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using an experimental data to identify faults ( e.g. interturn fault of electric motor), which gives periodic/regular waveforms (pre-fault) but erratically different (or could have some periodicity) waveforms (post-fault).&#xA;In this application, my voltage signal, v(t) is sampled and collected using DAQ systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can v(t) be considered a wide-sense-stationary random process (WSS-RP) ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I understand that there are multiple ways to get PSD. &#xA; What is the best suggestion ? Is it ...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;By fourier transform the autocorrelation, if only v(t) is WSS-RP. [as described by Wiener-Khintichine Theorem]&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;splitting the signal,v(t) into multiple frames( or segments)&lt;/li&gt;&#xA;&lt;li&gt;applying window function : multiply each segment by a hamming window (i.e. convolution in freq. domain )&lt;/li&gt;&#xA;&lt;li&gt;FFT each of the windowed signal&lt;/li&gt;&#xA;&lt;li&gt;either multiply its conjugate or absolute square, to get the spectral density of the segment&lt;/li&gt;&#xA;&lt;li&gt;resulting spectra are averaged to get the ultimate averaged spectrum&#xA;Just like the explanation here &lt;a href=&quot;http://www.dspguide.com/ch9/1.htm&quot; rel=&quot;nofollow&quot;&gt;Fig 9.1&lt;/a&gt;, &lt;a href=&quot;http://www.ti.com/lit/an/snoa719/snoa719.pdf&quot; rel=&quot;nofollow&quot;&gt;Sect.11: Averaging Periodograms, pg14&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What is the difference in the mathworks' application note in (www.mathworks.com/help/signal/ref/spectrum.html) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please guide in the codings ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel grateful in the midst of dsp gurus !&#xA;kit &lt;/p&gt;&#xA;" OwnerUserId="5327" LastActivityDate="2020-04-08T15:59:10.100" Title="Matlab: Estimating power spectral density of an experimental data?" Tags="|matlab|fft|power-spectral-density|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10845" PostTypeId="2" ParentId="10843" CreationDate="2013-09-25T07:37:50.897" Score="1" Body="&lt;p&gt;This is possible, as long as you know the filter which was applied to the data in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that the original acausal filter is $H_a(\omega)$ and your filtered data is $Y_a(\omega)$, then the original data $X(\omega)$ can be retrieved by inversely applying the filter to the data:&#xA;\begin{equation}&#xA;X(\omega) = \frac{Y_a(\omega)}{H_a(\omega)}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is simply a re-arrangement of the equation which can be used to describe the initial  filtering operation:&#xA;\begin{equation}&#xA;Y_a(\omega) = X(\omega) H_a(\omega)&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've illustrated the concept using frequency domain notation, but the concept is the same for the time domain.  Depending upon your acausal filter, you may encounter some problems inverting it, I don't think this will be an issue in this case.&lt;/p&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2013-09-25T07:37:50.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10846" PostTypeId="2" ParentId="10833" CreationDate="2013-09-25T07:41:56.883" Score="1" Body="&lt;p&gt;You should probably use one of the algorithms for primary component (PCA) or independent component (ICA) investigation. They heavily relay on covatiance matrices and their eigenvalue-eigenvector decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your time series represent an oscillation with dominant direction, the eigenvector for the maximum magnitude eigenvalue would represent that direction. If the signal is some kind of elliptic, the basis of eigenvectors would represent the oscillation ellipsoid dimensions. Degree of polarization is then easily yielded from relations of main-to-other eigenvectors magnitudes.&lt;/p&gt;&#xA;" OwnerUserId="745" LastActivityDate="2013-09-25T07:41:56.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10847" PostTypeId="2" ParentId="9465" CreationDate="2013-09-25T09:21:10.260" Score="5" Body="&lt;p&gt;Just like what Jim says, unless you are FFT-ing the entire data set at once, without splitting the data into shorter frames, then you will most likely use the length of data set. A quick example is shown below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ts = 50e-6;                  % Sampling Time(s)&#xA;Fs = 1/Ts;                   % Sampling rate, Sampling Freq (Hz)&#xA;f0 = 50;                     % Frequency of interest (Hz)&#xA;duraT = 1;&#xA;&#xA;%Calculate time axis&#xA;dt = 1/Fs;&#xA;tAxis = dt:dt:(duraT-dt);&#xA;&#xA;y = cos(2*pi*f0*tAxis) +  2*sin(2*pi*10*tAxis);   y=y';&#xA;&#xA;L = length (y); % Window Length of FFT    &#xA;nfft = 2^nextpow2(L); % Transform length&#xA;&#xA;y_HannWnd = y.*hanning(L);            &#xA;Ydft_HannWnd = fft(y_HannWnd,nfft)/L;&#xA;&#xA;   % at all frequencies except zero and the Nyquist&#xA;   mYdft = abs(Ydft_HannWnd);&#xA;   mYdft = mYdft (1:nfft/2+1);&#xA;   mYdft (2:end-1) = 2* mYdft(2:end-1);&#xA;&#xA;f = Fs/2*linspace(0,1,nfft/2+1); &#xA;&#xA;  figure(1),&#xA;  subplot(2,1,1)&#xA;  plot(tAxis,y)&#xA;  title('Time Domain y(t)');&#xA;  xlabel('Time,s'); &#xA;  ylabel('y');&#xA;  subplot(2,1,2)  &#xA;  plot(f,2*mYdft); % why need *2 ? Bcoz, Hanning Wnd Amplitude Correction Factor = 2&#xA;  axis ([0 500 0 5]); %Zoom in &#xA;  title('Amplitude Spectrum with Hann Wnd');&#xA;  xlabel('Frequency (Hz)with hanning window'); &#xA;  ylabel('|Y(f)|');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5327" LastActivityDate="2013-09-25T09:21:10.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10848" PostTypeId="1" AcceptedAnswerId="10878" CreationDate="2013-09-25T10:47:26.493" Score="0" ViewCount="498" Body="&lt;p&gt;I am trying to implement the STFT by MATLAB, and I read somewhere that we must do zeropadding to the subsequence of the signal before windowing it with a Gaussian window. What happens if we don't do any windowing?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2013-09-27T19:01:51.333" Title="STFT zeropadding" Tags="|matlab|discrete-signals|dft|window-functions|stft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10851" PostTypeId="1" AcceptedAnswerId="49938" CreationDate="2013-09-25T15:30:47.830" Score="3" ViewCount="225" Body="&lt;p&gt;Suppose $h(n)$ is a finite impulse response which is unknown. We can feed any input signal $x(n)$ into the system and observe the corresponding output signal $y(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, is it possible to estimate the input signal $x^*(n)$ which when passed through the filter gives the desired output signal $y^*(n)$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think a Least Mean Squares filter could be used here. Could anyone point out how one proceeds doing this ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks !&lt;/p&gt;&#xA;" OwnerUserId="3216" LastEditorUserId="128" LastEditDate="2018-06-16T22:07:20.633" LastActivityDate="2018-06-16T22:07:20.633" Title="Estimation of Input Signal to Obtain the Desired Output Signal for an Unknown Filter" Tags="|filters|estimation|adaptive-filters|deconvolution|least-squares|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10852" PostTypeId="1" CreationDate="2013-09-25T18:08:56.403" Score="2" ViewCount="581" Body="&lt;p&gt;I am making my way through &lt;a href=&quot;https://dl.dropboxusercontent.com/u/4724281/maxds.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper here&lt;/a&gt;, and I understand everything up to equation 16, and I am stuck here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long story short, the vector $\mathbf{x}[i]$ here is an $N$ by 1 vector, consisting of the complex envelopes of signal + noise + interference across $N$ different sensors, taken at some time index $i$. We have a desired signal, an interference signal, and AWGN noise at each sensor. Naturally, the desired and interference signals at each sensor are delayed versions of each other, but the AWGN at each sensor is independent of the AWGN at another sensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do not understand, is the author's claim, where he states that since the desired and/or interference signals are just delayed copies of each other, &quot;the circular symmetry of the complex envelopes thus implies that:&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbb{E} \Big[\mathbf{x}[i] \mathbf{x}^T[i]  \Big] = \mathbf{0}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Circular symmetry of the complex envelopes? What does that mean, and why do we get the above equation from that?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="1329" LastEditDate="2013-09-25T18:34:36.663" LastActivityDate="2013-09-27T00:17:52.023" Title="Why does circular symmetry of complex envelopes mean that $\mathbb{E} \Big[\mathbf{x}[i] \mathbf{x}^T[i] \Big] = \mathbf{0}$?" Tags="|discrete-signals|fourier-transform|noise|statistics|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10853" PostTypeId="1" CreationDate="2013-09-25T20:52:38.810" Score="4" ViewCount="1304" Body="&lt;p&gt;What I'm looking for is the mathematical proof of why we can calculate derivatives as a simple convolution of a mask, and how do we get that mask?&#xA;I know it has something to do with how the derivative is approximated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone direct me to some book or anything? &lt;/p&gt;&#xA;" OwnerUserId="5523" LastEditorUserId="128" LastEditDate="2021-11-20T08:14:12.953" LastActivityDate="2022-01-02T11:33:15.350" Title="The Mathematical Relationship Between Derivative and Convolution" Tags="|convolution|math|approximation|gradient|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10854" PostTypeId="2" ParentId="10853" CreationDate="2013-09-26T01:03:20.613" Score="5" Body="&lt;p&gt;There's no mathematical proof &lt;em&gt;per se&lt;/em&gt;; the fact is that &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_difference#Higher-order_differences&quot; rel=&quot;noreferrer&quot;&gt;finite differences are one method of approximating derivatives&lt;/a&gt;. Remember the definition of a derivative:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f'(x) = \lim_{\Delta x \to 0} \frac{f(x+\Delta x) - f(x)}{\Delta x}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above equation states that to calculate the derivative of a function $f$ at position $x$, one takes the difference between the function evaluated at $x$ and the function evaluated at some small distance $\Delta x$ away. The ratio of the difference in the function value between the two points and the distance traveled along the $x$-axis is defined to be the derivative, as the distance between the two points becomes infinitesimally small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A finite-difference derivative method, then, is just a way of approximating the above relationship using some finite spacing instead of the infinitely-small spacing implied by the limit. This type of approach makes sense for real-world applications where you might not analytically know the function $f(x)$  (and therefore can't evaluate its behavior across arbitrarily-small intervals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, there are a number of ways to approximate the derivative of a signal in this way; one example is the causal first-order difference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x'(t) \approx \frac{x(t) - x(t-T)}{T}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is simple to implement, but performs best if $T$ is small relative to the inverse of the signal's bandwidth. A slightly more complicated method can provide better results in some cases (the second-order difference):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x'(t) \approx \frac{x(t) - 2x(t-T) +x(t-2T)}{T^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used the &quot;backward second-order difference&quot; form above to show how they could be applied using causal filters, but note that they will have a resulting delay commensurate with the order of the approximation.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-09-26T01:03:20.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10856" PostTypeId="2" ParentId="10851" CreationDate="2013-09-26T07:18:55.123" Score="1" Body="&lt;p&gt;An excellent resource for reading about deconvolution and its implementation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://workspace.imperial.ac.uk/earthscienceandengineering/Public/lecture%20handout%2019Jan09.pdf&quot; rel=&quot;nofollow&quot;&gt;https://workspace.imperial.ac.uk/earthscienceandengineering/Public/lecture%20handout%2019Jan09.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5527" LastActivityDate="2013-09-26T07:18:55.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10858" PostTypeId="1" AcceptedAnswerId="10860" CreationDate="2013-09-26T10:41:16.107" Score="3" ViewCount="6539" Body="&lt;p&gt;I have a chunk of data (samples) that need to do autocorrelation using FFT method. All data are real and lies between -1 and +1. What I have done follows: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Zero pad the window with the length equals the samples' length.&lt;/li&gt;&#xA;&lt;li&gt;FFT of result from 1&lt;/li&gt;&#xA;&lt;li&gt;Result from 2 has Real and Imaginary parts. I used them to find Power Spectral Density by taking Re*Re + Im*Im. &lt;/li&gt;&#xA;&lt;li&gt;Take the inverse Fast Fourier Transform.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now here is my question: The result from part 4 contains Real and Imaginary parts. Is the magnitude of it equals the autocorrelation result? If so, since my input contains positive and negative values, the magnitude of Result from part 4 means the autocorrelation result cannot be negative, which doesn't make sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or should I take only the Real part of result from Part 4 as the autocorrelation result? My input is real and so the autocorrelation shouldn't have any imaginary part, right? &lt;/p&gt;&#xA;" OwnerUserId="5530" LastEditorUserId="76" LastEditDate="2013-09-27T06:00:17.967" LastActivityDate="2015-11-23T19:30:56.460" Title="AutoCorrelation using FFT of power spectrum" Tags="|fft|autocorrelation|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10859" PostTypeId="2" ParentId="10832" CreationDate="2013-09-26T11:57:38.013" Score="2" Body="&lt;p&gt;I share your assumption about depth being useless here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;approach #1&lt;/strong&gt; based on point detectors seems also useless, because there is probably a difference in scale between your reference (learning) images and the representation of objects in the real pictures that is so big that point detection becomes useless. Information is not present at the same level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you're left with &lt;strong&gt;approach #2&lt;/strong&gt;, which sounds reasonable since it's also more-or-less the state-of-the-art in object detection benchmarks.&#xA;You may improve the performance of your system by using a training set of pictures that have the size of the objects in the real (test) images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you will use only the &lt;strong&gt;descriptor part&lt;/strong&gt; of the existing keypoints and apply it in sliding windows. Since oyu have a very poor resolution on objects, I believe that SIFT-like descriptors (e.g., HoG) will have poor performance, while binary descriptors (LBPs, BRISK, FREAK, ORB) will probably behave better (they are less dependant on pixel accurate resolution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if your objects are very different, you may try a simple image correlation (using again learning images downscaled to the actual size of the objects in the test pictures).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-09-27T08:01:36.907" LastActivityDate="2013-09-27T08:01:36.907" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="10860" PostTypeId="2" ParentId="10858" CreationDate="2013-09-26T13:01:05.723" Score="5" Body="&lt;p&gt;In principle you are doing the right thing. Step 4 should produce a real result unless there is a coding error. Sometimes you add up some residual imaginary part due to numerical noise but, if any, that should be very small. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% random signal of length n&#xA;n = 128;&#xA;x = rand(n,1);&#xA;% zero pad&#xA;x = [x; zeros(n,1)];&#xA;% fft&#xA;fx = fft(x);&#xA;% mag sqaured&#xA;fa = fx.*conj(fx);&#xA;% inverse FFT&#xA;a = ifft(fa);&#xA;% plot&#xA;plot(-n+(1:2*n),circshift(a,-n));&#xA;answer = {'no','yes'};&#xA;fprintf('Is a Real?: %s \n',answer{isreal(a)+1});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-09-26T13:01:05.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10861" PostTypeId="2" ParentId="10853" CreationDate="2013-09-26T15:20:20.357" Score="0" Body="&lt;p&gt;Assuming you want the derivative of a continuous band-limited (below Fs/2) signal represented by some sample points, then the sampling/reconstruction theorem can be used to demonstrate that an infinite convolution can be used to reconstruct the derivative of the signal as well as the signal.  More realistically, a windowed convolution, using the same window as you would use for Sinc reconstruction or filtering, can be used for derivative-of-Sinc reconstruction.  This finite length convolution kernel would then produce the derivative of the reconstructed signal at the sample points (and a poly-phase version could also estimate the derivative between sample points).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A mask can be created by computing the derivative of the Sinc reconstruction function, sampling that, and windowing it.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-09-26T15:20:20.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10862" PostTypeId="1" CreationDate="2013-09-26T16:48:25.513" Score="1" ViewCount="84" Body="&lt;p&gt;I posted &lt;a href=&quot;https://math.stackexchange.com/questions/493918/is-this-a-universal-relation-between-signal-power-and-period-frequency&quot;&gt;this question&lt;/a&gt; at Math Stack Exchange a few weeks ago without any luck.  It occurred to me I might have more luck by posting it here.  The basic question is whether there exists a known relationship between the period of a signal (i.e. the inverse of the frequency) and its corresponding power, such as that depicted in the graph in the linked post.&lt;/p&gt;&#xA;" OwnerUserId="5531" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2013-10-26T19:41:31.307" Title="Is there a general relation between mean power and period" Tags="|fft|discrete-signals|frequency-spectrum|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10863" PostTypeId="2" ParentId="10862" CreationDate="2013-09-26T19:29:21.240" Score="1" Body="&lt;p&gt;There is no universal relationship between power and period length. These are two unrelated, yet completely independent, concepts (see amplitude vs. frequency). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what your plot might be referring to is a digital CMOS circuit. Such a circuit consumes a certain amount of energy per clock cycle. Hence for this kind of device, power consumption is (approximately) proportional to clock frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it depends on the origin of the data. There is no universal relation, but there might be one for specific situations.&lt;/p&gt;&#xA;" OwnerUserId="5145" LastActivityDate="2013-09-26T19:29:21.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10866" PostTypeId="2" ParentId="10823" CreationDate="2013-09-26T21:11:56.630" Score="0" Body="&lt;p&gt;The length of the arrays you get back depends on the &lt;a href=&quot;http://www.pybytes.com/pywavelets/ref/signal-extension-modes.html#ref-modes&quot; rel=&quot;nofollow&quot;&gt;mode&lt;/a&gt; you use to do the decomposition and the wavelet length, which can vary like you see between db1 and db2:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;len(cA) == len(cD) == floor((len(data) + wavelet.dec_len - 1) / 2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you switch to periodization mode &lt;code&gt;mode='per'&lt;/code&gt;, you get a different calculation that may be more consistent for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;len(cA) == len(cD) == ceil(len(data) / 2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Regardless, decomposition is generally dyadic, so your dyad width is &lt;code&gt;len(signal)/len(cAn)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you go muiltilevel (use level='2', etc.), you'll have small variations in length as well. To account for this, use &lt;a href=&quot;http://www.pybytes.com/pywavelets/ref/idwt-inverse-discrete-wavelet-transform.html&quot; rel=&quot;nofollow&quot;&gt;IDWT&lt;/a&gt; to reconstruct.&lt;/p&gt;&#xA;" OwnerUserId="5420" LastActivityDate="2013-09-26T21:11:56.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10867" PostTypeId="1" CreationDate="2013-09-26T21:39:07.167" Score="2" ViewCount="461" Body="&lt;p&gt;A sampled single dimensional signal is a vector.&#xA;A sampled image is a matrix.&#xA;Is video considered a rank-3 tensor since it is a set of images stacked on top of each other?&lt;/p&gt;&#xA;" OwnerUserId="5535" LastEditorUserId="13320" LastEditDate="2016-11-21T13:03:14.303" LastActivityDate="2016-11-21T13:03:14.303" Title="Is video considered a Tensor?" Tags="|video|tensor|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10869" PostTypeId="2" ParentId="10852" CreationDate="2013-09-27T00:17:52.023" Score="2" Body="&lt;p&gt;A complex random variable with dimension being 2 $Z=X+jY$ can be defined as a Random vector with components $X$ and $Y$ which take values along 2 different dimensions. The Probability Density Function of $Z$ is defined using the PDFs of $X$ and $Y$. The Expectation is defined as $\mathrm{E}(Z)=\mathrm{E}(X)+j\mathrm{E}(Y)$ and the variance is defined the usual way as $Z$ being a complex function of $X$ and $Y$ and the Variance is $\mathrm{VAR}(Z)=\mathrm{E}(|Z^2|)-|\mathrm{E}(Z)|^2$. Intuitively speaking, $Z$ is a complex function of two random variables which just assumes value $X+jY, \forall x,\forall y$. The PDF is written as follows: Write the 2-dimensional Random variable as $$\tilde{Z}=\left[\begin{array}{ccc}X \\Y\end{array}\right]$$where $\tilde{Z}$ is a Real random vector. The PDF of $Z$ is the PDF of $\tilde{Z}$.&lt;br&gt;&lt;br&gt;&#xA;Now with Complex Random vectors, $\mathbf{Z}=\mathbf{X}+j\mathbf{Y}$ is a vector of Complex Random variables which has a lot of interesting properties in a sense that it has more to offer than a Vector of Real Random Variables. Particularly of importance are the Covariance, Pseudocovariance(this is something new) and the Expectation. In our situation, we have a special Complex Random vector called the &lt;b&gt;Symmetric &lt;/b&gt; Random Vector $\mathbf{Z}$.&lt;br&gt;&lt;br&gt;&#xA;Define the $2n$-dimensional Complex Random Vector as $$\tilde{\mathbf{Z}}=\left[\begin{array}{ccc}\mathbf{X} \\\mathbf{Y}\end{array}\right]$$ where $\mathbf{X}$ and $\mathbf{Y}$ are $n$-dimensional real random vectors. The PDF definition follows the same from Complex Random Variable. You can look up what the Pseudocovariance and Variance mean for a Complex Random Vector. I'm referring to &lt;b&gt;Digital Communications by Proakis&lt;/b&gt; here in my definitions and notations. &lt;br&gt;&#xA;&lt;br&gt;&#xA;Now as in the comments, if $\mathbf{Z}$ is a Symmetric i.e the PDF doesn't change on rotation, we can say that $\mathrm{E}(\mathbf{ZZ^\mathrm{T}})=0$. This is a consequence of the following. Since $\mathbf{Z}$ and $\mathbf{Z}e^{j\theta}$ have the same PDF, $$\mathrm{E}(\mathbf{Z})=\mathrm{E}(e^{j\theta}\mathbf{Z})=e^{j\theta}\mathrm{E}(\mathbf{Z}), \forall \theta$$ If we had $\theta=\pi$ (the condition has to be satisfied for all $\pi$), we can see that $$\mathrm{E}(\mathbf{Z})=\mathrm{E}(-\mathbf{Z})=-\mathrm{E}(\mathbf{Z})$$ which clearly says that $\mathrm{E}(\mathbf{Z})=0$. Going further, we can prove that $\mathrm{E}(\mathbf{Z}\mathbf{Z}^\mathrm{T})=0$ the same way assuming a special case of $\theta=\frac{\pi}{2}$. And hence Circularly Symmetric Complex Random Vectors are Zero-mean and &lt;i&gt;Proper&lt;/i&gt;. The last equation left unproven here is the definition of being proper. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-09-27T00:17:52.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10870" PostTypeId="1" CreationDate="2013-09-27T00:39:57.210" Score="1" ViewCount="312" Body="&lt;p&gt;When we design a discrete Gabor filter for a 1D signal, how do we determine the variance of the filter, depending on the time step of the signal? Is there any empirical theorem/result that we should know about the Discrete Gabor Transform?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="8202" LastEditDate="2014-05-16T22:31:18.937" LastActivityDate="2022-04-07T00:05:40.513" Title="Variance of the Discrete Gabor Transform for practical implementation" Tags="|discrete-signals|time-frequency|gabor|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10871" PostTypeId="1" AcceptedAnswerId="10872" CreationDate="2013-09-27T05:02:07.527" Score="0" ViewCount="3603" Body="&lt;p&gt;While reading Estimation of Symbol Timing Offset, i came across an equation like multiplying a signal with its conjugate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{\delta} = \arg \max_{\delta} \sum_{i=\delta}^{N_g-1+\delta} \left|y^*(n+i) y(n+N+i)\right|^2&#xA;$$&#xA;I know multiplying&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(5+4i) X (5-4i) = 25 - 20i + 20i + 16 = 25 + 16 = 41. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But am not getting the meaning of this 41. What it represents ???&lt;/p&gt;&#xA;" OwnerUserId="3638" LastEditorUserId="80" LastEditDate="2013-09-28T00:37:58.923" LastActivityDate="2013-09-28T00:37:58.923" Title="Meaning of Multiplying a complex number with its conjugate" Tags="|conjugate|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10872" PostTypeId="2" ParentId="10871" CreationDate="2013-09-27T05:27:10.313" Score="4" Body="&lt;p&gt;Multiplying a complex number with it's conjugate yields the squared magnitude of that complex number. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in your formula, you are multplying the signal with the conjugate of the N samples delayed signal, take the squared magnitude of that (thus dropping phase differences between the signal and delayed signal, which would result from a frequency offset) and average it over &lt;code&gt;Ng&lt;/code&gt; sample times. This means you are calculating the autocorrelation of the signal at a time delay of &lt;code&gt;N&lt;/code&gt; sample times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume the formula is from an algorithm for coarse symbol timing estimation for OFDM signals. The pseudo-random pilot sequence of length N is repeated twice. It's autocorrelation thus has a peak at &lt;code&gt;N&lt;/code&gt;. Now, if you want to estimate the timing offset, you just take the time index of this peak.&lt;/p&gt;&#xA;" OwnerUserId="1877" LastActivityDate="2013-09-27T05:27:10.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10873" PostTypeId="1" CreationDate="2013-09-27T09:35:59.823" Score="3" ViewCount="2459" Body="&lt;p&gt;Musical residual noise is created when a noisy signal passes through a noise reduction algorithm. For instance, please see the paper:  &lt;a href=&quot;http://www.ind.rwth-aachen.de/fileadmin/publications/esch09.pdf&quot; rel=&quot;nofollow&quot;&gt;Esch, T; Vary, P: &quot;Efficient Musical Noise Suppression for Speech Enhancement Systems&quot;, &lt;em&gt;IEEE Intl Conf Acoustics, Speech and Signal Proc&lt;/em&gt;, (ICASSP): 4409-4412, 2009&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Noise reduction techniques that are relying on spectral weighting&#xA;  rules often generate annoying musical noise artifacts in the processed&#xA;  signal.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What exactly does it sound like? Are there any sample clips available (for example, a wav file before passing through a noise reduction algorithm routine and a wav file after noise reduction with musical noise) for comparison?&lt;/p&gt;&#xA;" OwnerUserId="3121" LastEditorUserId="3121" LastEditDate="2013-09-30T01:59:27.127" LastActivityDate="2013-12-17T13:03:35.830" Title="what does musical noise sound like and is there a sample clip for it?" Tags="|audio|noise|speech-processing|denoising|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10874" PostTypeId="2" ParentId="10870" CreationDate="2013-09-27T10:57:54.117" Score="-1" Body="&lt;p&gt;What I look for in such parameter choice problems is empirical experiments. Whatever works best for my application is the correct value to use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can develop a parameter search algorithm looking for the optimal values in some training data set. Keep in mind that what works for one application may not perform well in others. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of mathematical arguments estimating  gabor's $\theta$. These estimates are typically conservative anyway.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-09-27T10:57:54.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10876" PostTypeId="2" ParentId="6313" CreationDate="2013-09-27T18:20:47.530" Score="0" Body="&lt;p&gt;For the case $s=1/\sqrt{2}$, the classic Gaussian kernel in 2D is of the form:&#xA;$$[1, 2, 1]^T[1, 2, 1]$$&lt;/p&gt;&#xA;" OwnerUserId="3803" LastActivityDate="2013-09-27T18:20:47.530" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10877" PostTypeId="1" CreationDate="2013-09-27T18:26:27.983" Score="0" ViewCount="2444" Body="&lt;p&gt;While I was going through the short time processing of speech signals, I got stuck at the relationship between the frame rate and the sampling frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any relationship between them for an audio signal so that the change in sampling frequency will have an effect in the frame rate? If yes, what is mathematical relationship between them for given values of &lt;strong&gt;window length (L), window shift (R), Sampling frequency (Fs) and Frame Rate (FR)?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5363" LastEditorUserId="76" LastEditDate="2013-09-28T17:16:32.370" LastActivityDate="2013-09-28T17:16:32.370" Title="Relationship between frame rate and sampling frequency in speech signal processing?" Tags="|speech|window-functions|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10878" PostTypeId="2" ParentId="10848" CreationDate="2013-09-27T19:01:51.333" Score="5" Body="&lt;p&gt;You don't HAVE to zero pad, ever, unless there are constraints on the length of data required by the FFT algorithm - often it's a case of speed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many FFT's (like the Numerical Recipes code) require a power-of-two length series, some (like Kiss-FFT) only require it to be an even number, but being a multiple of 2,3 and 5 makes it run much faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab's case the algorithm is optimized for dealing with power-of-two length data. It usually pads the data to achieve this for you, though you control how many powers-of-two you wish to pad up to. &lt;/p&gt;&#xA;" OwnerUserId="5386" LastActivityDate="2013-09-27T19:01:51.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10879" PostTypeId="1" CreationDate="2013-09-28T00:43:11.610" Score="2" ViewCount="560" Body="&lt;p&gt;I have a question regarding the &lt;code&gt;wavdec&lt;/code&gt;and &lt;code&gt;dwt&lt;/code&gt; functions in MATLAB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;code&gt;wavdec(y,3,db4)&lt;/code&gt; on a size 1024 signal, which means I am trying to compute the third level &lt;code&gt;db4&lt;/code&gt; transform of the size 1024 signal &lt;code&gt;y&lt;/code&gt;. If I am thinking about this correctly, theoretically the returned matrix after the transform should also be of size 1024. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I perform the transform, the matrix I get returned is size 1044, which is 20 samples bigger than my original matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would anyone please be able to explain to me why this is happening?&lt;/p&gt;&#xA;" OwnerUserId="4937" LastEditorUserId="76" LastEditDate="2013-09-28T16:18:28.913" LastActivityDate="2013-12-20T07:27:12.597" Title="Wavelet transform wavdec returns matrix of the wrong size" Tags="|matlab|wavelet|signal-analysis|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10882" PostTypeId="2" ParentId="10529" CreationDate="2013-09-28T06:37:00.250" Score="-1" Body="&lt;p&gt;Filter the signal using a bandpass filter centred on the frequency of interest, then create the &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;analytic signal&lt;/a&gt;. In MATLAB this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal_analytic = hilbert(signal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The amplitude and phase of the signal are then given by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;amplitude = abs(signal_analytic);&#xA;phase = angle(signal_analytic);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-09-28T06:37:00.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10884" PostTypeId="1" AcceptedAnswerId="10895" CreationDate="2013-09-28T08:46:54.320" Score="1" ViewCount="1223" Body="&lt;p&gt;I am using CMOR(complex morlet) wavelet in Fourier space in order to reconstruct my signal and also estimate damping and frequencies of the embedded modes. there are two main parameters in cmor. the Fb and Fc. bandwidth and center frequency, with increasing the Fb i get better result for frequency estimation, but i cant get a good damping estimation with high Fb. is it sth to do with Heisenberg Uncertainly Principle? and if yes, would you explain the role of fb and fc in the accuracy of frequency and damping estimations?&#xA; The wavelet transforms provide a unified framework for getting around the Heisenberg Uncertainly Principle. &lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2013-10-04T11:33:35.210" Title="Heisenberg Uncertainly Principle and wavelet transform" Tags="|frequency|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10885" PostTypeId="1" AcceptedAnswerId="10940" CreationDate="2013-09-28T09:44:20.123" Score="1" ViewCount="156" Body="&lt;p&gt;I trained the data using BOG with SVM , i trained it , now i just want to open it through &lt;code&gt;xml&lt;/code&gt; , i don't want to train it again and again on every run ,&#xA;I trained the svm and now loading it using its loading function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CvSVM svm;&#xA;svm.load( &quot;trainsvm.xml&quot; );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how to do the same with vocabulary file which i use for clustering using BOG algorithm , below is my code , which is training the data , but i want to open it now like &lt;code&gt;svm&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (i = all_names.begin(); i != all_names.end(); ++i)&#xA;{&#xA;    Dir=( (count &amp;lt; files.size() ) ? YourImagesDirectory : YourImagesDirectory_2);&#xA;&#xA;    Mat row_img = cv::imread( Dir +*i, 0 );&#xA;&#xA;    detector.detect( row_img, keypoints);&#xA;&#xA;    RetainBestKeypoints(keypoints, 20);&#xA;&#xA;    extractor-&amp;gt;compute( row_img, keypoints, descriptors_1);&#xA;&#xA;    descriptors_1.reshape(1,1);&#xA;&#xA;    bow.add(descriptors_1);&#xA;&#xA;    ++count;&#xA;}&#xA;&#xA;vector&amp;lt;string&amp;gt;::const_iterator k;&#xA;&#xA;cout&amp;lt;&amp;lt;&quot;CLUSTERING&quot;&amp;lt;&amp;lt;endl;&#xA;Mat vocabulary = bow.cluster();&#xA;&#xA;dextract.setVocabulary(vocabulary);&#xA;&#xA;cv::Mat training_mat(num_img , dictionarySize,CV_32FC1);&#xA;cv::Mat labels(num_img,1,CV_32FC1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is clustering the data , now i don't want to run it again and again because it takes too much time , when it trained once , i just want to use it , so that i can speed up my program&lt;/p&gt;&#xA;" OwnerUserId="5057" LastActivityDate="2013-10-01T20:42:13.963" Title="How to use clustering file after training" Tags="|computer-vision|opencv|image-processing|c|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10886" PostTypeId="2" ParentId="10877" CreationDate="2013-09-28T10:00:40.030" Score="1" Body="&lt;p&gt;The sample rate divided by the frame rate will give you the window shift in samples.  The ratio of the window (length - shift) to the window length will give you an overlap factor.  The sample rate divided by the window length in samples will give you the FFT result bin spacing.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-09-28T10:00:40.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10887" PostTypeId="1" AcceptedAnswerId="10907" CreationDate="2013-09-28T10:45:51.597" Score="10" ViewCount="11776" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Direct_linear_transformation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Direct Linear Transform&lt;/a&gt; (DLT for short) is a method of homography estimation, it solves the overdetermined linear system via SVD &lt;span class=&quot;math-container&quot;&gt;$$Ah=b$$&lt;/span&gt;to find a solution &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; under constraint &lt;span class=&quot;math-container&quot;&gt;$\|h\|=1$&lt;/span&gt;. Actually it finds the least square solution which minimize &lt;span class=&quot;math-container&quot;&gt;$\|Ah - b\|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the basic idea of this algorithm, but it is recommended to &lt;strong&gt;normalize the data set&lt;/strong&gt; before applying DLT on it, and &lt;a href=&quot;https://web.archive.org/web/20150929063658/http://www.ele.puc-rio.br/~visao/Topicos/Homographies.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; is a intro about how to do the normalization. It is lectured that data normalization is important to DLT, without normalization the results from DLT is not stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder why? Just because DLT involves solving the linear system using SVD and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; might be singular?&lt;/p&gt;&#xA;" OwnerUserId="4811" LastEditorUserId="49423" LastEditDate="2020-03-29T17:11:12.850" LastActivityDate="2020-03-29T17:11:12.850" Title="Why normalize the data set before applying Direct Linear Transform" Tags="|image-processing|homography|normalization|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10889" PostTypeId="1" AcceptedAnswerId="10890" CreationDate="2013-09-28T13:00:23.470" Score="2" ViewCount="1103" Body="&lt;p&gt;The question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Weight and height measurements of a child taken every month&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classify this signal as:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;one/multidimensional&lt;/li&gt;&#xA;&lt;li&gt;single/multichannel&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm not understanding how this can be described as a signal and hence how can it be classified.&lt;/p&gt;&#xA;" OwnerUserId="5513" LastEditorUserId="76" LastEditDate="2013-09-29T09:43:09.063" LastActivityDate="2013-09-29T09:43:09.063" Title="Classifying this signal in dimension and number of channels" Tags="|signal-analysis|homework|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10890" PostTypeId="2" ParentId="10889" CreationDate="2013-09-28T13:14:29.030" Score="5" Body="&lt;p&gt;I don't feel like it's a very well-posed question, as multi-channel signals are sometimes represented as vector-valued, which would make them multidimensional. However, I assume the answer that is being fished for is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a one-dimensional, two-channel setup. The two channels are the child's height and weight. Each signal is one-dimensional, measured across time. The sample rate of each signal is $1\text{ month}^{-1}$. You could state them mathematically as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h[n] \equiv \text{ height of child at month } n&#xA;$$&#xA;$$&#xA;w[n] \equiv \text{ weight of child at month } n&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-09-28T13:14:29.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10891" PostTypeId="2" ParentId="10889" CreationDate="2013-09-28T13:23:26.273" Score="1" Body="&lt;p&gt;The dimension is how many coordinated you need to specify a particular measurement. For example, say you had a GPS:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GPS speed is 1D&lt;/li&gt;&#xA;&lt;li&gt;GPS ground position is 2D [latitude, longitude]&lt;/li&gt;&#xA;&lt;li&gt;GPS absolute position is 3D [latitude, longitude, height]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The number of channels is how many measurement you make at one time. E.g. if you are taking speed and position measurements then that is multi-channel. But like @JasonR said, depending on how you define the measurements a signal could be multidimensional or multichannel. If operations such as norms or rotations make sense on a set of individual measurements then they should be grouped into a vector (multidimensional) signal.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-09-28T13:23:26.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10892" PostTypeId="2" ParentId="10887" CreationDate="2013-09-28T13:46:01.913" Score="2" Body="&lt;p&gt;The Wikipedia article states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;What makes the direct linear transformation problem distinct..is the fact that the left [X] and right [AY] sides of the defining equation [X = AY] can differ by an unknown multiplicative factor which is dependent on k&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above X, A, Y are matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to avoid having to estimate the factor, you simply normalise all the data you have.&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-09-28T13:46:01.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10894" PostTypeId="1" CreationDate="2013-09-28T14:00:50.283" Score="2" ViewCount="1542" Body="&lt;p&gt;I was wondering whether we can recover a signal $x(t)$ from its power spectral density using signal processing techniques. &lt;/p&gt;&#xA;" OwnerUserId="5507" LastEditorUserId="76" LastEditDate="2013-09-29T09:43:17.097" LastActivityDate="2016-05-07T08:42:04.680" Title="Recover signal from its power spectral density" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10895" PostTypeId="2" ParentId="10884" CreationDate="2013-09-28T14:06:59.263" Score="7" Body="&lt;p&gt;The HUP follows directly from the properties of the Fourier Transform, because time and frequency are orthogonal bases in which we can expand the co-efficient sequence of our signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact all pairs of orthonormal bases will have some kind of Uncertainty Principle associated with them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In traditional Fourier analysis, the either the time axis or the frequency axis will be split into identical sized and spaced regions which permit us to gain information about the signal:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/bR1GA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelets allow you to analyse signals by splitting up the time-frequency plane into regions of different sizes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are increasing the bandwidth (i.e. frequency), you will necessarily have worse resolution in time.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jZSoC.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="5132" LastEditDate="2013-10-04T11:33:35.210" LastActivityDate="2013-10-04T11:33:35.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10896" PostTypeId="2" ParentId="10894" CreationDate="2013-09-28T14:30:48.443" Score="4" Body="&lt;p&gt;Generally (in the absence of prior knowledge) , I don't think this could be done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The PSD is the absolute value  squared of the DFT of the signal, and the abs function is not 1-to-1. For example abs(x) could be produced by f=x and f=-x. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you have some prior knowledge about the signal then you could reconstruct it from the PSD. Without more knowledge of what you're trying to do I don't think I could help you.&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="805" LastEditDate="2013-09-30T09:37:23.457" LastActivityDate="2013-09-30T09:37:23.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10897" PostTypeId="1" CreationDate="2013-09-28T14:59:55.733" Score="0" ViewCount="711" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XvDeN.png&quot; alt=&quot;enter image description here&quot;&gt;I am facing a trouble implementing the fft and appreciate your advice. My data structured as follow: &#xA;The data are retrieved from the share market for one day change in the share price. The time range from (11:00:00 to 15:00:00) this means 16200 Sec. In matlab its represented as serial so it will be from 0.4584 to 0.6458. Data are not sampled in fixed freqency. Price is sampled only when there is a change in price. For example ( it can be sampled in each second and sometimes in 30 Seconds interval).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RRwvI.png&quot; alt=&quot;Sample of Data&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5546" LastEditorUserId="5546" LastEditDate="2013-10-05T10:47:25.650" LastActivityDate="2013-10-05T10:47:25.650" Title="Implementing FFT in Matlab" Tags="|fft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10898" PostTypeId="2" ParentId="10897" CreationDate="2013-09-28T15:22:56.733" Score="1" Body="&lt;p&gt;You can write an algorithm that fills the time gaps with the fixed price. Now you have the price/second. I can't see issues with taking the FFT of this new time series (1:16200). &lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-09-28T15:22:56.733" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10899" PostTypeId="1" CreationDate="2013-09-14T23:37:02.397" Score="1" ViewCount="89" Body="&lt;p&gt;I am Fourier analyzing at a bunch of signals of equal length and find that $$\frac{d\ln({E[P]})}{d\ln({PT'})}$$ is constant across the dataset, where $T$ is a vector of the periods (inverse of frequencies) of each signal, and $P$ is the vector of the power corresponding to each of those periods.  $E[P]$ is the mean power of the given signal.  I include a graph to illustrate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I expect this relation in any signal?  Or does this point to something unique about the signals I am dealing with?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rC5y7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5531" OwnerDisplayName="ben" LastEditorUserId="26573" LastEditDate="2018-09-08T20:21:24.150" LastActivityDate="2018-09-08T20:21:24.150" Title="Is this a universal relation between signal power and period (frequency)?" Tags="|frequency|signal-power|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10900" PostTypeId="2" ParentId="10887" CreationDate="2013-09-28T20:43:59.537" Score="1" Body="&lt;p&gt;It's a matter of numerical accuracy. By normalizing the data set, you center your data and give it unit variance. These conditions are better handled by the solbver then.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-09-28T20:43:59.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10901" PostTypeId="2" ParentId="10662" CreationDate="2013-09-29T01:45:35.457" Score="1" Body="&lt;p&gt;Your passband ripple value is very wrong. It is just &lt;code&gt;0.3dB&lt;/code&gt;(=0.02) which is a very stringent requirement from the filter. Your problem will be solved if you used something like a &lt;code&gt;3dB&lt;/code&gt;. Also you could decrease your stopband attenuation by a further &lt;code&gt;6dB&lt;/code&gt;(now it is at &lt;code&gt;34dB&lt;/code&gt;). With a passband ripple of 3dB and a stopband attenuation of 40dB, the filter will be designed as:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fsamp=50;      &#xA;frange=[10 12];    &#xA;mag=[1 0];  &#xA;devs=[0.170997357 0.01];  &#xA;frange=[10 12];  &#xA;[n,fo,ao,w] = firpmord(frange,mag,devs,fsamp);  &#xA;n = n + rem(n,2);  &#xA;b=firpm(n,fo,ao,w,'hilbert');  &amp;lt;br&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the change in the values of &quot;devs&quot;. The filter will work perfectly now. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-09-29T01:45:35.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10902" PostTypeId="1" CreationDate="2013-09-29T04:49:46.633" Score="3" ViewCount="774" Body="&lt;p&gt;First, I apologize for the vague title, to be honest, I'm not even sure how to describe my question in a title. If someone would like to edit it so its more reflective of what I'm asking, then please do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have simulink model running in real time gathering data and doing stuff in real time (1ms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the things its doing is reading a signal from an external source. When the signal comes in, its in pretty bad shape, but if you look carefully, you can see that it &quot;kinda&quot; resembles the signal we are expecting. So some filtering should take care of it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I collected some data and then started playing with the various filter options that matlab has, and I found one in the signal processing toolbox called filtfilt that works wonders. It pretty much pulls out the signal im looking for from the messy input signal. And it closely matches what the reference signal is. Win! (All this was done through a script).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since our model is in simulink, I'd like to be able to simulate how the filter would work in a simulink environment so I created a function block with a tapped delay to &quot;simulate&quot; data coming in one sample at a time, it...does not work. Meaning the output does not look like my filter when ran through a script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get my simulink to behave like my script ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is actually my first time using simulink. I have used matlab in the past before for scripts but never simulink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My filter is just &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fc = 32; %cutoff freq&#xA;fs = 1000; %sample freq&#xA;fn = fc /(fs /2 ); %nyquist freq&#xA;pole = 12; %pole &#xA;Av =7.6; %gain for butteworth&#xA;[b,a] = butter(pole,fn,'low'); %10 pole butterworth&#xA;lpf_out = Av*filtfilt(b,a,data); %apply filter&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FHLJX.png&quot; alt=&quot;Reference Signal&quot;&gt;&#xA;Reference Signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eobGL.png&quot; alt=&quot;Input Signal &quot;&gt;&#xA;Input signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zQw9g.png&quot; alt=&quot;Filtered signal&quot;&gt;&#xA;Filtered Signal&lt;/p&gt;&#xA;" OwnerUserId="4985" LastEditorUserId="4985" LastEditDate="2013-09-29T04:57:18.337" LastActivityDate="2013-09-29T04:57:18.337" Title="Matlab Simulink Sampling" Tags="|matlab|filters|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10903" PostTypeId="1" AcceptedAnswerId="10904" CreationDate="2013-09-29T05:50:05.127" Score="2" ViewCount="60" Body="&lt;p&gt;I have a before/after image pair with pixel transformations only (for example, grayscale, or a hue shift. No blur, border, sharpen, etc.). I'm trying to find a function such that for every pixel &lt;code&gt;(r, g, b)&lt;/code&gt; in the original image, &lt;code&gt;f(r, g, b) = (r', g', b')&lt;/code&gt;, &lt;code&gt;(r', g', b')&lt;/code&gt; being the pixel in the &quot;after&quot; image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking about a polyfit function, but I couldn't find one that works in 3D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd appreciate any help with this, or another method of achieving what I need.&lt;/p&gt;&#xA;" OwnerUserId="5550" LastActivityDate="2013-09-29T08:26:35.913" Title="How to find f given that f(some_image) = processed_image" Tags="|image-processing|algorithms|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10904" PostTypeId="2" ParentId="10903" CreationDate="2013-09-29T08:26:35.913" Score="3" Body="&lt;p&gt;Fit 3 polynoms (or any other model) using the individual channels of the output image: r' as a function of (r, g, b), g' as a function of (r, g, b), b' as a function of (r, g, b). I would also suggest not including in the data set all pixels with a 0 or 255 value (if your image is 8-bit) - these values might have been clipped.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-09-29T08:26:35.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10905" PostTypeId="2" ParentId="10897" CreationDate="2013-09-29T11:24:03.133" Score="4" Body="&lt;p&gt;For calculating the frequency spectrum of an non-uniformly sampled signal I see two options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Interpolate the data in order to obtain evenly spaced samples before taking the FFT as suggested by Hasan. Use the Matlab function &lt;code&gt;interp1&lt;/code&gt;. If you have the Data Analysis toolbox, the &lt;code&gt;resample&lt;/code&gt; function of the &lt;code&gt;timeseries&lt;/code&gt; class might be worth a look.&lt;/li&gt;&#xA;&lt;li&gt;Use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Least-squares_spectral_analysis&quot; rel=&quot;nofollow&quot;&gt;Lomb–Scargle periodogram&lt;/a&gt;. There's no builtin Matlab function but an implementation from &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/20004-lomb-lomb-scargle-periodogram&quot; rel=&quot;nofollow&quot;&gt;Matlab File Exchange&lt;/a&gt; exists.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-09-29T11:24:03.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10906" PostTypeId="2" ParentId="10796" CreationDate="2013-09-29T14:52:43.580" Score="-2" Body="&lt;p&gt;Solution:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The processes $ {Y}_{1} $ and $ {Y}_{2} $ are dependent.&lt;br&gt;&#xA;$ {Y}_{1} $ and $ {Y}_{2} $ are dependent intuitively by looking at the problem from a different angle.&lt;br&gt;&#xA;Given a uniformly distributed random variable $ \theta $ the random variables $ sin(\theta) $ and $ cos(\theta) $ are clearly dependent. Multiplying them by a Gaussian Random Variable doesn't decorrelate them.&lt;/li&gt;&#xA;&lt;li&gt;The processes $ {Y}_{1} $ and $ {Y}_{2} $ aren't Gaussian (And not Ergodic).&lt;br&gt;&#xA;Clearly over time (The Phase is constant) the process $ {Y}_{i} $ is Gaussian. Yet the ensemble isn't Gaussian since each of its realization is retrieved from Gaussian Distribution with different parameters.&lt;/li&gt;&#xA;&lt;li&gt;The process $ r(t) $ is indeed Gaussian.&lt;br&gt;&#xA;This could be proved by using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Characteristic_function_%28probability_theory%29&quot; rel=&quot;nofollow&quot;&gt;Characteristic Function&lt;/a&gt; of the random process.&lt;br&gt;&#xA;$ X \sim N(0, 1) $, $ Y \sim N(0, 1) $, $ \theta \sim U(0, 2\pi) $ all are independent.&lt;br&gt;&#xA;Let $ Z = X sin(\theta) + Y cos(\theta) $.  Looking at its Characteristic Function and applying the &lt;a href=&quot;http://en.wikipedia.org/wiki/Law_of_total_expectation&quot; rel=&quot;nofollow&quot;&gt;Smoothing Theorem&lt;/a&gt; yields:&#xA;\begin{align}&#xA;{ \varphi }_{Z}(t) &amp;amp; = &amp;amp; \mathbb{E}[{e}^{itZ}] \\&#xA;&amp;amp; = &amp;amp; \mathbb{E} [ \mathbb{E}[{e}^{itZ} | \theta] ] \\&#xA;&amp;amp; = &amp;amp; \mathbb{E} [ \mathbb{E}[{e}^{it(X cos(\theta) + Y sin(\theta))} | \theta] ]&#xA;\end{align}&lt;br&gt;&#xA;Looking at the last equation per realization of $ \theta $:&lt;br&gt;&#xA;$$ \mathbb{E}[{e}^{it(X cos(\theta) + Y sin(\theta))} | \Theta = \theta] = \mathbb{E}[{e}^{itX sin(\theta)}] \mathbb{E}[{e}^{itY cos(\theta)}] $$&#xA;Each of the item is the Characteristic Function of a scaled Normally Distributed Random Process:&#xA;$$ \mathbb{E}[{e}^{itX sin(\theta)}] \mathbb{E}[{e}^{itY cos(\theta)}] = {e}^{-\frac{{t}^{2}}{2} ({sin}^{2}(\theta) + {cos}^{2}(\theta))} = {e}^{-\frac{{t}^{2}}{2}} $$&#xA;Hence we get:&#xA;$$ { \varphi }_{Z}(t) = \mathbb{E} [ \mathbb{E}[{e}^{itZ} | \Theta = \theta] ] = \mathbb{E} [{e}^{-\frac{{t}^{2}}{2}}] = {e}^{-\frac{{t}^{2}}{2}} $$&#xA;Namely, it has the Characteristic Function of a Normalized Gaussian Variable -&gt; $ Z \sim N(0, 1) $.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastActivityDate="2013-09-29T14:52:43.580" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10907" PostTypeId="2" ParentId="10887" CreationDate="2013-09-29T18:22:05.013" Score="14" Body="&lt;p&gt;The normalization is basically a &lt;a href=&quot;http://en.wikipedia.org/wiki/Preconditioning#Preconditioning_for_linear_systems&quot;&gt;preconditioning&lt;/a&gt; to decrease condition number of the matrix $A$ (the larger the condition number, the nearer the matrix is to the singular matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The normalizing transform is also represented by a matrix in the case of homography estimation, and this happens to be usable as a good preconditioner matrix. The reason why is that is more elaborate and is explained briefly in &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot;&gt;H&amp;amp;Z book&lt;/a&gt; (4.4.4, p. 107: &lt;em&gt;Why is normalization essential?&lt;/em&gt;) or in more detail in the paper &quot;&lt;a href=&quot;http://www.cse.unr.edu/~bebis/CS485/Handouts/hartley.pdf&quot;&gt;In Defense of the Eight-point Algorithm&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put it simply, the matrix $A$ consists of products of image coordinates which can have different scale. If the scale differs by factor of $10$, the products differ by a factor of $10^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source and target coordinate data are usually &lt;strong&gt;noisy&lt;/strong&gt;. Without normalization, the data from source would can have two orders of magnitude larger variance than from target (or vice versa).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The homography estimation usually finds parameters in a least-squares sense - hence the best statistical estimate is found only if variances of the parameters are the same (or known beforehand, but it is more practical just to normalize the input).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Direct solvers do not like poorly scaled problems because numerical instabilities appear (e.g. dividing very large number by a very small number easily leads to numerical overflow).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Iterative solvers struggle with badly conditioned matrices by needing more iterations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So normalization is essential not only for numerical stability, but also for more accurate estimation in presence of noise and faster solution (in case of iterative solver).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2013-09-29T18:22:05.013" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10908" PostTypeId="1" CreationDate="2013-09-30T03:18:44.057" Score="1" ViewCount="4728" Body="&lt;p&gt;Let $g[n] = f[-n]$(n is the time index). Then what will be expression for $g[n+k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is $g[n+k] = f[-n + k]$ or $g[n+k] = f[-n - k]$. Which one is true and Why?&lt;/p&gt;&#xA;" OwnerUserId="4434" LastActivityDate="2013-10-01T22:26:36.553" Title="Combined signal folding and shifting" Tags="|discrete-signals|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10909" PostTypeId="1" CreationDate="2013-09-30T05:58:57.130" Score="1" ViewCount="111" Body="&lt;p&gt;Here i will first try to put my application agenda&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Typically i am sampling at 8Khz rate and filtering speech components using a BPF(digital)&#xA;  now i have got the 0-4Khz components in which essentially &amp;lt;250Hz are not speech so i will eliminate them also&#xA;  now i am trying to find out entropy of frame and trying to mark respective frames as voice or non voice if they belong to band 250&amp;lt;=f&amp;lt;=3750 Hz &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;so now the problem is while i was doing this at my realtime application side there also non human sounds like birds sound or a ringing of a bell which again fall in to the frequency band i am flagging as speech&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so this causes a false alarm of speech even in case of bird sound and bell ringing how to really over come this problem &lt;/p&gt;&#xA;&#xA;&lt;p&gt;what else i can try to do for effectvie speech activity detection&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="4513" LastEditDate="2013-09-30T09:11:32.103" LastActivityDate="2022-06-21T12:10:45.297" Title="Speech Activity Detection- Adhoc Problem with multi source sounds(birds,trees,heavy air) and how to eliminate them completely" Tags="|speech-recognition|dsp-core|voice|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10910" PostTypeId="1" AcceptedAnswerId="10914" CreationDate="2013-09-30T07:14:05.040" Score="1" ViewCount="785" Body="&lt;p&gt;I've been doing FFT's (on sound) for a while and usually use the highest intensity or the ones above average to get the spikes in an FFT result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a good method to get all the 'spikes' in an FFT. I can't use averages or peaks because the frequency response drops off. Visually its quite obvious there is a spike but I can't get a way extract the frequency from the spike.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low frequencies always tend to have a higher itensity than higher ones but don't necessarily have any spikes in them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any good reliable techniques for this?&lt;/p&gt;&#xA;" OwnerUserId="5553" LastActivityDate="2013-09-30T11:24:14.087" Title="Algorithm to find spike" Tags="|fft|peak-detection|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10911" PostTypeId="1" AcceptedAnswerId="10925" CreationDate="2013-09-30T09:16:05.753" Score="3" ViewCount="1037" Body="&lt;p&gt;I used the measured position to estimate the velocity using a Kalman filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in simulations, the Kalman gain changes quickly and then remains constant when position and velocity continue to change. For example, position and velocity change at times  0 to 0.5(s) and 3 to 4(s), respectively. But the Kalman gain only changes  0 to 0.1(s) and then remain constant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Why is the Kalman gain constant when position and velocity change? &lt;/p&gt;&#xA;" OwnerUserId="5554" LastEditorUserId="53" LastEditDate="2013-09-30T21:21:23.890" LastActivityDate="2013-10-01T08:44:54.507" Title="Why is the Kalman gain constant when position and velocity change?" Tags="|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10912" PostTypeId="2" ParentId="10908" CreationDate="2013-09-30T09:25:39.193" Score="-1" Body="&lt;p&gt;The answer is f[-n+k].  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try to explain this with example. Let the signals be discrete &amp;amp; k=2. The bold numbers indicate sample at time 0(I am not well versed with editing here)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let f[n] = {&lt;strong&gt;1&lt;/strong&gt;,1,1,1}&lt;br&gt;&#xA;Thus f[-n] = {1,1,1,&lt;strong&gt;1&lt;/strong&gt;} = g[n]&lt;br&gt;&#xA;Now g[n+2] = {1,1,1,1,0,&lt;strong&gt;0&lt;/strong&gt;}  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now how can you obtain the same answer from f[n]&lt;br&gt;&#xA;f[n-2] = {&lt;strong&gt;0&lt;/strong&gt;,0,1,1,1,1}&lt;br&gt;&#xA;And if we invert this signal ie f[-(n-2)], we get {1,1,1,1,0,&lt;strong&gt;0&lt;/strong&gt;} which is g[n+2].&lt;br&gt;&#xA;Thus g[n+2] = f[-(n-2)] = f[-n+2]&lt;br&gt;&#xA;Hence proved.&lt;br&gt;&#xA;The theoretical answer are the rules followed in Shift &amp;amp; Scale&lt;br&gt;&#xA;y[n] = x[an+b]&lt;br&gt;&#xA;If you shift first &amp;amp; then scale, then&lt;br&gt;&#xA;1) y[n] = x[n+k]&lt;br&gt;&#xA;2) Then scale y[n] by a  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you scale first &amp;amp; then shift, then&lt;br&gt;&#xA;1) y[n] = x[a(n+(b/a))] ie scale x[n] by a first&lt;br&gt;&#xA;2) Shift y[n] by (b/a)  &lt;/p&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2013-09-30T09:25:39.193" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10913" PostTypeId="1" AcceptedAnswerId="10918" CreationDate="2013-09-30T09:58:24.720" Score="5" ViewCount="1081" Body="&lt;p&gt;I am trying to understand the motivation for the above question for signal processing and image processing? Can anyone answer this question, or provide me with resources for this?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="1877" LastEditDate="2013-09-30T14:17:17.990" LastActivityDate="2013-09-30T14:17:17.990" Title="Motivation for using gabor transform instead of fourier transform" Tags="|discrete-signals|transform|time-frequency|gabor|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10914" PostTypeId="2" ParentId="10910" CreationDate="2013-09-30T11:24:14.087" Score="1" Body="&lt;p&gt;A statistical test might be appropriate.  For instance, if you assume the noise floor is Gaussian, then you could compute the standard deviation in any particular octave (or other appropriate sub-band), and look for maxima that are whatever multiple of standard deviations above the local average that you might consider to be statistically significant for your application.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-09-30T11:24:14.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10916" PostTypeId="2" ParentId="1671" CreationDate="2013-09-30T12:15:20.007" Score="3" Body="&lt;p&gt;The way this is done on phase (correlation) meters in audio equipment is rather simple:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Phase = arctan(L/R)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;With phase of 45 or 225 = 1, and phase of 135 and 315 (-45) is -1.&lt;/p&gt;&#xA;&lt;p&gt;Essentially, the Y Axis is the L, and the X axis is the R. The phase is simply the polar angle of the vector between the two.&lt;/p&gt;&#xA;&lt;p&gt;This type of meters will show 1 if the signal is mono, and -1 if the left and right are perfectly phase inverted.&lt;/p&gt;&#xA;&lt;p&gt;Notice however, that phase meters of this type also account for the magnitude in the polar coordinates. So:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Magnitude = (L^2 + R^2)^1/2&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Thus the actual meter display is a normalised version of:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Correlation = Phase * Magnitude&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I'm not sure that satisfies your requirements, but this answers the question in the subject.&lt;/p&gt;&#xA;&lt;h1&gt;The Meter&lt;/h1&gt;&#xA;&lt;p&gt;The calculation described above is for a common meter found in many audio production products. It's prime purpose is to ensure that the programme material doesn't suffer for phase inversion between the left and right channels, which can cause issues when the material is cut to vinyl or transmitted over the FM radio medium (essentially, any system that uses MS by mechanical or transmission means.&lt;/p&gt;&#xA;&lt;p&gt;Such is the vertical meter at the bottom of this screenshot:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kZfs1.jpg&quot; alt=&quot;A photo showing the correlation meter in Logic&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;From the manual:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A correlation of +1 (the far right position) means that the left and right channels correlate 100%—they are completely in phase.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A correlation of 0 (the center position) indicates the widest permissible left/right divergence, often audible as an extremely wide stereo effect.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Correlation values lower than 0 indicate that out-of-phase material is present, which can lead to phase cancellations if the stereo signal is combined into a monaural signal.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;How it Works&lt;/h1&gt;&#xA;&lt;p&gt;It the content of the left and right channel is identical (so both sample values are X) the phase meter shows 1. If the content is perfectly out of phase (so L = X, R = -X), the phase meter shows -1.&lt;/p&gt;&#xA;&lt;p&gt;Looking at the graph below, the green arrow represents perfect in-phase relationship between the left and right channels, and the red one perfect out-of-phase relationship between the two. In this type of meter, if one of the channels carries silence (but not the other) the meter goes to 0 (so 0, 90, 180, 270 degrees).&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WPW2D.png&quot; alt=&quot;A graph with L as Y and R as X&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="4576" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-09-30T18:20:44.053" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10917" PostTypeId="2" ParentId="88" CreationDate="2013-09-30T13:39:27.677" Score="2" Body="&lt;p&gt;Here is another source for the Parks McClellan algorithm in C. This code is different from the SciPy code mentioned above in that it has 61 of the original 69 goto statements removed (the SciPy code still has about 37 goto's). It also fixes the code in 3 places where divide by zero can occur and it has some additional code that range checks the band edge values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.iowahills.com/A7ExampleCodePage.html&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/A7ExampleCodePage.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-09-30T13:39:27.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10918" PostTypeId="2" ParentId="10913" CreationDate="2013-09-30T14:10:49.877" Score="7" Body="&lt;p&gt;The fourier transform gives you very fine resolution in the frequency domain, but during the transformation, you loose all the information about &lt;strong&gt;when&lt;/strong&gt; (for time signals) or &lt;strong&gt;where&lt;/strong&gt; (for images) these frequencies occur in your input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Gabor transform alleviates this problem by windowing the base functions of the fourier transform with a Gaussian impulse. The transform gives the similarity between the signal and the &lt;strong&gt;time- and frequency-shifted&lt;/strong&gt; window, so you may get a sense when/where certain frequencies occur in your input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the windowing comes at the cost of losing some of the frequency resolution. The Gabor  transform is optimum in the sense that it's windowing function yields the &lt;strong&gt;minimum product between time and frequency resolution&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1877" LastActivityDate="2013-09-30T14:10:49.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10921" PostTypeId="1" CreationDate="2013-09-30T17:33:23.797" Score="0" ViewCount="8080" Body="&lt;p&gt;I am trying to Frequency modulate a sine signal using Matlab. I have written the following code for the same:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;Fc = 5000; %Carrier Signal&#xA;fs = 20000; %Sampling Rate&#xA;t = 0:0.00001:0.002;&#xA;freqdev = 50; %Frequency Deviation&#xA;x = sin(2*pi*1000*t);&#xA;subplot(3,1,1);&#xA;plot(t,x);&#xA;y = fmmod(x,Fc,fs,freqdev,0);&#xA;subplot(3,1,2);&#xA;plot(t,y);&#xA;z = fmdemod(y,Fc,fs,freqdev,0);&#xA;subplot(3,1,3);&#xA;plot(t,z);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code gives me the following output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZfXom.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The first plot shows the modulating (sine) signal.&lt;/li&gt;&#xA;&lt;li&gt;The second plot shows the FM modulated signal.&lt;/li&gt;&#xA;&lt;li&gt;The third plot shows the demodulated signal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But the second and third plots doesn't look like a FM modulated signal and demodulated signals respectively. What is wrong with my code?&lt;/p&gt;&#xA;" OwnerUserId="5082" LastActivityDate="2013-09-30T17:33:23.797" Title="MATLAB - FM Modulation" Tags="|matlab|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10923" PostTypeId="2" ParentId="10873" CreationDate="2013-09-30T20:45:14.000" Score="2" Body="&lt;p&gt;Here's one example: &lt;a href=&quot;http://www.izotope.com/tech/aes_suppr/&quot; rel=&quot;nofollow&quot;&gt;http://www.izotope.com/tech/aes_suppr/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Googling &quot;Musical Noise&quot; certainly turns up a lot of noise music, so I'd suggest looking for academic papers that have web links to sound examples.&lt;/p&gt;&#xA;" OwnerUserId="5559" LastActivityDate="2013-09-30T20:45:14.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10924" PostTypeId="1" CreationDate="2013-10-01T07:43:28.720" Score="0" ViewCount="899" Body="&lt;p&gt;I have a question concerning methods to find different aspects of &quot;similarity&quot; of signals. So, first, I'd like to characterize the signals to be dealt with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a number of close to rectangular signals between values 0 and 1, starting and ending with some distinct flanks; furthermore, the signals are subject to some noise. Some of the signals are more like peaks which would not reach 1 (2 flanks meeting in the middle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have two sets X and Y of such signals containing n vectors each. The vectors in Y are ideally identical to the vectors in X, but time shifted. This is for the ideal case though, in the real application, the signals are not likely to be identical, but we suppose to find some similarities between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is now: how could i find the time shift between the two sets? First, I need a method to somehow estimate the similarity of the signals in sets X and Y; afterwards, one can find the time-shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about cross-correlation first. The issue is, that those peak signals deliver bigger cross correlation coefficients when correlated with long rectangular signals. So, could you think of solution by normalizing the cross correlation coefficients with some other characteristic value of the signal (I didn't find a meaningful one yet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, we thought that probably dynamic time warping techniques could help - I'm still familiarizing with that one. Do you think this could be a good way to go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally: do you have another technique that could be used and helpful for this problem? I'm not an expert in signal processing (I'm just a mechanical engineer), so don't be too cruel to me.&lt;/p&gt;&#xA;" OwnerUserId="5555" LastEditorUserId="76" LastEditDate="2013-10-01T23:55:47.093" LastActivityDate="2013-10-01T23:55:47.093" Title="Similarity of signals" Tags="|discrete-signals|cross-correlation|waveform-similarity|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10925" PostTypeId="2" ParentId="10911" CreationDate="2013-10-01T08:44:54.507" Score="4" Body="&lt;p&gt;The Kalman Gain $K_k$ for a discrete, linear system is computed using the state covariance matrix $P_k$, measurement matrix $H_k$ and measurement noise covariance matrix $R_k$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;K_k = P_kH_k^T(H_kP_kH_k^T+R_k)^{-1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the measurement matrix and the measurement noise covariance matrix are constant and the state covariance matrix converges to a steady-state value $P_\infty$, the Kalman Gain also converges to a steady-state value $K_\infty$, regardless of actual measurements or state.&lt;/p&gt;&#xA;" OwnerUserId="1877" LastActivityDate="2013-10-01T08:44:54.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10926" PostTypeId="2" ParentId="2914" CreationDate="2013-10-01T09:42:12.690" Score="1" Body="&lt;p&gt;Previous answers (from @Hilmar, @RickLyons, and @hotpaw2) are very informative. Hope I can also provide some.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;First of all, there are more than one way to construct an complex signal based on a real one. Think about &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)=\cos(2\pi f_1 t)\cos(2\pi f_2 t)$, where $f_1&amp;lt;f_2$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;one can define either &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z(t)=\cos(2\pi f_1 t)e^{j2\pi f_2 t}$, or $z(t)=\cos(2\pi f_2 t)e^{j2\pi f_1 t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Hilbert transform only generates one analytic signal (the first one). According to &lt;a href=&quot;http://en.wikipedia.org/wiki/Hilbert_transform#Bedrosian.27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Bedrosian's product theorem&lt;/a&gt;, for real signal $x(t)=a(t)\cos\phi(t)$, its Hilbert transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H\{a(t)\cos\phi(t)\}=a(t)H\{\cos\phi(t)\}=a(t)\sin\phi(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $|F\{a(t)\}|=|A(\omega)|&amp;gt;0$ only for $\omega&amp;lt;\omega_{critical}$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;while $|F\{\cos\phi(t)\}|&amp;gt;0$ only for $\omega&amp;gt;\omega_{critical}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, $a_z(t)=|x(t)+jH\{x(t)\}|=a(t)$ will be the desirable envelope. Otherwise, $a_z(t)\ne a(t)$ and might be hard to interpret. Please refer to [2] for more details.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[I'm not quite sure about my following reasoning...]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The analytic signal associated with any real bandpass ($\omega_a&amp;lt;\omega&amp;lt;\omega_b$) signal can be expressed as&#xA;$z(t)=A(t)e^{j(\omega_a+\phi(t))}=A(t)e^{j\phi(t)}e^{j\omega_a}=z_{base}(t)e^{j\omega_a}$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the spectrum of $z_{base}(t)$ and thus $A(t)$ is upper bounded by $\Delta\omega=\omega_b-\omega_a$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while the spectrum of $e^{j\phi(t)}e^{j\omega_a}$ is lower bounded by $\omega_a$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $\omega_b&amp;lt;2\omega_a$ (or $\Delta\omega&amp;lt;\omega_a$), then $H\{A(t)\cos(\omega_a+\phi(t))\}=A(t)\sin(\omega_a+\phi(t))$, &#xA;and Hilbert transform will provide reasonable envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is why to bandpass a broadband signal (e.g., music audio) in a series of octaves before applying Hilbert transform results in reasonable outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2]: Boashash, B. (1992). Estimating and interpreting the instantaneous frequency of a signal. I. Fundamentals. Proceedings of the IEEE, 80(4).&lt;/p&gt;&#xA;" OwnerUserId="5537" LastActivityDate="2013-10-01T09:42:12.690" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="10927" PostTypeId="1" AcceptedAnswerId="10928" CreationDate="2013-10-01T12:48:57.810" Score="8" ViewCount="8276" Body="&lt;p&gt;I noticed that spline interpolation with a degree higher than 3 (everything beyond cubic splines) have a very high interpolation error, hence the prediction is mostly awful. I've come across various lecture notes, slides and Youtube videos that simply indicate that cubic splines (3rd degree) are optimal and that anything beyond that is a bad idea. These sources however never mention why this is the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain to me why this is the case and maybe give me a title/link to a journal/conference paper that explains this or maybe even gives a proof.&lt;/p&gt;&#xA;" OwnerUserId="3605" LastActivityDate="2013-10-25T13:31:46.423" Title="Higher order spline interpolation" Tags="|interpolation|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10928" PostTypeId="2" ParentId="10927" CreationDate="2013-10-01T13:21:30.000" Score="12" Body="&lt;p&gt;There is no such proof because it's not always true.  It's a rule of thumb, because I guarantee that you could come up with a situation- an infinite number of situations actually- where higher order splines would do better than cubic splines.  The optimal spline order for any given situation is the exact same order as the system you are trying to model.  If the order is the same and your data points are error free (never the case, of course, except for in theoretical problems), then you should be able to model the system perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason they recommend not to go higher than cubic splines is because &lt;a href=&quot;http://en.wikipedia.org/wiki/Overfitting&quot; rel=&quot;noreferrer&quot;&gt;overfitting&lt;/a&gt; is really, really bad.  Overfitting can greatly magnify errors, while &quot;underfitting&quot; (choosing a spline method with an order lower than the order of the system you are modelling) introduces some low pass filtering that is either not that bad or sometimes even beneficial.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2013-10-25T13:31:46.423" LastActivityDate="2013-10-25T13:31:46.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10929" PostTypeId="2" ParentId="10927" CreationDate="2013-10-01T13:28:31.297" Score="3" Body="&lt;p&gt;Here is a rough outline (which may or may not be correct). Spline is a polynomial interpolation, i.e. every section of the curve between to neighboring support points is a polynomial. A polynomial of order N has N+1 coefficients (degrees of freedom) and hence can satisfy 4 boundary conditions per section. The choice of boundary conditions determines the type of interpolation. For a spline that is hitting the supporting points exactly and creating a continuous first and second derivatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For higher order splines you can get higher order derivatives to be continuous as well but that tends to add a lot of high frequency content at sharper transitions and often results in &quot;ringing&quot; or excessive oscillation. The original words &quot;spline&quot; stems from a flexible ruler that people used to make &quot;mechanical&quot; interpolations. I think you can actually show by analyzing the ruler mechanics the cubic spline matches that behavior.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As with most things, it depends on your application and what you want to do. An interesting alternative to cubic splines are hermitian interpolations which can guarantee monotony and make sure that the interpolation never swings outside the supporting points. From the MATLAB help function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Tips&#xA;&#xA;spline constructs  in almost the same way pchip constructs . However, spline chooses the slopes at the  differently, namely to make even  continuous. This has the following effects:&#xA;&#xA;   - spline produces a smoother result, i.e.  is continuous.    &#xA;   - spline produces a more accurate result if the data consists of values of a smooth function.    &#xA;   - pchip has no overshoots and less oscillation if the data are not smooth.    &#xA;   - pchip is less expensive to set up.&#xA;   - The two are equally expensive to evaluate.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-01T13:28:31.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10930" PostTypeId="1" AcceptedAnswerId="10976" CreationDate="2013-10-01T13:54:18.737" Score="4" ViewCount="512" Body="&lt;p&gt;I am working in digital image processing field, recently I am studying about Image Noise, I just want to know that whether this noise removal is part of image enhancement or image restoration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read some papers on it, at some points authors are saying that image enhancement from a given noisy image, and on the other hand in some papers authors are saying that noise removal is image restoration process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please explain what is correct?.&lt;/p&gt;&#xA;" OwnerUserId="4444" LastEditorUserId="128" LastEditDate="2018-07-02T08:37:16.730" LastActivityDate="2021-02-23T05:46:29.463" Title="Is Image Noise Removal Image Enhancement or Image Restoration Operation?" Tags="|noise|image-processing|denoising|" AnswerCount="2" CommentCount="3" ClosedDate="2013-10-09T12:24:18.520" ContentLicense="CC BY-SA 4.0" />
  <row Id="10932" PostTypeId="1" AcceptedAnswerId="10936" CreationDate="2013-10-01T14:12:11.327" Score="0" ViewCount="6950" Body="&lt;p&gt;In the following example I have used various examples found on the web to understand fft and detecting signals with matlab.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 1000; &#xA;t = 0:1/fs:1.5-1/fs; &#xA;&#xA;x = 3*cos(2*pi*20*t + 0.2) + 1*cos(2*pi*30*t + 0.3) + 2*cos(2*pi*40*t + 2.4);&#xA;N = length(x);&#xA;&#xA;% define the frequency components of the series &#xA;freq = 0:N-1;&#xA;freq = freq*fs/N;&#xA;&#xA;% normalise the data and compute the fourier transform&#xA;X = fft(x)./N; &#xA;cutOff = ceil(N/2);&#xA;X = X(1:cutOff);&#xA;freq = freq(1:cutOff);&#xA;&#xA;figure;&#xA;stem(freq,abs(X));&#xA;xlabel('frequency');&#xA;ylabel('amplitude');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Resulting in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/95ZDB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T283G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it that the amplitude of the final plot are 1.5, 0.5, and 1 respectively? The initial amplitudes were 3, 1, and 2 so why is the amplitude of the signal half of that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, could someone explain the section &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% define the frequency components of the series &#xA;freq = 0:N-1;&#xA;freq = freq*fs/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't quite understand how this works. &lt;/p&gt;&#xA;" OwnerUserId="3774" LastActivityDate="2013-10-01T16:15:06.530" Title="defining the frequency range with fast fourier transform" Tags="|matlab|fft|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10933" PostTypeId="1" CreationDate="2013-10-01T15:11:09.497" Score="0" ViewCount="837" Body="&lt;p&gt;Could someone explain to me why the computation speed for the fast Fourier transform increases by padding the series with zeros to the point that its length is close to a power of 2? This is common in the matlab environment, for example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/fft.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.co.uk/help/matlab/ref/fft.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3774" LastActivityDate="2013-10-01T16:20:32.193" Title="fourier transform to the power of two" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10935" PostTypeId="2" ParentId="10927" CreationDate="2013-10-01T16:01:16.700" Score="-1" Body="&lt;p&gt;Another way to look at this is by noticing that most interesting images and data sets are &quot;smooth&quot; to a certain degree. Interpolating gaussian noise, for example, should work better with higher order splines.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-10-01T16:01:16.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10936" PostTypeId="2" ParentId="10932" CreationDate="2013-10-01T16:15:06.530" Score="5" Body="&lt;p&gt;There are a few things going on here.  First, one of the fundamental properties of the Fourier transform is that it conserves energy, i.e. the energy of the time domain is exactly equal to the energy of its Fourier transform.  What is the power of a sinusoid?  Assuming we restrict the calculation to integer multiples of cycles it is as follows (I suggest working out this equation for yourself if you are not sure about it):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P(Asin(ft)) = \frac{A^2}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The energy of a sinusoid is thus $\frac{A^2}{2}T$, or, in the case of discrete data, $\frac{A^2}{2}N$.  The purpose of the following line of code-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = fft(x)./N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is to change the FFT output from an &lt;em&gt;energy&lt;/em&gt;-based measure to a &lt;em&gt;power&lt;/em&gt;-based measure (&quot;based&quot; because you have to square the transform results, just like you would in the time domain, to get the actual energy or power).  Power is usually more interesting since it is an inherent characteristic of the signal, whereas energy is dependent on the number of samples that you are using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the power of your sinusoids is, according to the equation, 4.5, 2, and 0.5.  You got 1.5, 1, and 0.5, which, if you square them, become 2.25, 1, and 0.25.  You will notice that those results are exactly one half your expected power.  The reason for the halving is that you are only showing the positive frequencies from your Fourier transform.  That is what the following lines of code are doing-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cutOff = ceil(N/2);&#xA;X = X(1:cutOff);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They are cutting off the negative frequency part of the spectrum.  If you plotted the entire set of results it would look like the following-&#xA;&lt;img src=&quot;https://i.stack.imgur.com/R051n.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spikes on the left are the positive frequencies that you saw before.  The spikes on the right are the negative frequency components of the sinusoids.  Note that they have the exact same magnitude as their positive frequency partners, and thus comprise the missing factor of two in the power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, you ask the following-&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also, could someone explain the section&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% define the frequency components of the series &#xA;freq = 0:N-1;&#xA;freq = freq*fs/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Samples sampled at frequency $f_s$ can represent frequencies from $-\frac{f_s}{2}$ to $\frac{f_s}{2}$ (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;noreferrer&quot;&gt;Nyquist Sampling Theorem&lt;/a&gt;), or, equivalently, frequencies from $0$ to $f_s$ (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;noreferrer&quot;&gt;aliasing&lt;/a&gt;).  The code implicitly assumes that the samples represent from $0$ to $f_s$.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-10-01T16:15:06.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10937" PostTypeId="2" ParentId="10933" CreationDate="2013-10-01T16:20:32.193" Score="3" Body="&lt;p&gt;Firstly the terminology: The thing that you are trying to compute is the Discrete Fourier Series (DFS). This the only flavor for Fourier Transforms that is discrete in both time and frequency and can thus be represented numerically inside a computer. The Fast Fourier Transform is a specific algorithm to computer the DFS (see for example &lt;a href=&quot;http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm&lt;/a&gt; ). The term FFT is often used to refer to the DFS but that's actually somewhat wrong and often confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can always calculate the DFS directly using it's definition but this will require $N^{2}$ complex multiplies. The FFT speeds this up by breaking splitting the vector N into smaller sub vectors and then using the symmetry properties of the transform coefficient (often referred to as &quot;twiddle factors&quot;). The vector needs to be split in equal pieces though and that works better the more prime factors N has. A power of two is the best since it has the most prime factors and the factors themselves are the smallest possible. Worst case are N's that are prime themselves.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume you want to calculate the DFS of sequence of 1021 points. Since it's a prime number you need to use the direct formula which requires 1021*1021 multiples, roughly a million. If you zero pad to 1024, you can use the most efficient FFT version and the number of complex multiplies is 2*log2(N)*N is only about 20000. Hence that's a lot faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT is efficient if your DFS length can be broken down into lots of small prime numbers. Large prime numbers are slower. In practice you can typically find a spot made our of 2s and 3s that's fairly close to where you want to be so there is no need to always go to a power of 2.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-01T16:20:32.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10938" PostTypeId="1" AcceptedAnswerId="10939" CreationDate="2013-10-01T17:29:22.573" Score="3" ViewCount="4743" Body="&lt;p&gt;Usually the filters for detecting edges have the sum of all the values in the filter matrix equal to 0.&#xA;For example: [-1 -2 -1, 0 0 0, 1 2 1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it so ?&lt;/p&gt;&#xA;" OwnerUserId="1115" LastEditorUserId="53" LastEditDate="2013-10-01T20:51:12.577" LastActivityDate="2013-10-01T20:55:20.563" Title="Why is sum of values of an edge detection filter zero?" Tags="|image-processing|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10939" PostTypeId="2" ParentId="10938" CreationDate="2013-10-01T17:52:48.737" Score="7" Body="&lt;p&gt;An edge detection filter is, by definition, a high-pass filter.  It is looking for quick changes (i.e. high frequencies), not slow trends.  Thus, a good edge detection filter will have a response of 0 at DC.  A FIR filter whose taps sum to 0 has a response of 0 at DC.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-10-01T17:52:48.737" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10940" PostTypeId="2" ParentId="10885" CreationDate="2013-10-01T20:42:13.963" Score="0" Body="&lt;p&gt;You can use cv::FileStorage. You can follow this post &lt;a href=&quot;https://stackoverflow.com/questions/16312904/how-to-write-a-float-mat-to-a-file-in-opencv&quot;&gt;here&lt;/a&gt; and this documentation &lt;a href=&quot;http://docs.opencv.org/modules/core/doc/xml_yaml_persistence.html#filestorage&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-10-01T20:42:13.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10941" PostTypeId="2" ParentId="10938" CreationDate="2013-10-01T20:55:20.563" Score="5" Body="&lt;p&gt;An edge detection filter computes a derivative. A derivative of a discrete image is approximated by finite differences, i.e. you subtract the left pixel from the right pixel. If your filter did not sum up to 0, then you would be weighing the value of one pixel more than the value of the other, and that would be wrong.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-10-01T20:55:20.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10942" PostTypeId="2" ParentId="10908" CreationDate="2013-10-01T22:26:36.553" Score="2" Body="&lt;p&gt;The statement $g[n]=f[-n]$ is meaningless unless you assign some numerical value to $n$, e.g. $g[3]=f[-3]$, and if you do say that $n=3$, then the equality&#xA;$g[3] = f[-3]$ tells you nothing about the relationship between $g[n+k]=g[3+k]$&#xA;to the value taken on $f[\cdot]$ for any choice of argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you really meant to say is that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$\text{For all integers } n, g[n]=f[-n]$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which asserts that the &lt;em&gt;equality holds for all choices of&lt;/em&gt; $n$, and in&#xA;this case, it follows &lt;em&gt;by definition&lt;/em&gt; that $g[n+k] = f[-n-k]$;&#xA;you just need to negate the argument $n+k$ of $g$ (to get $-n-k$)&#xA;and use it (it meaning $-n-k$) as the argument of $f$ exactly as &#xA;the definition says you should.  The &#xA;complicated arguments in another answer that claim that $g[n+k]=f[-n+k]$&#xA;are wrong, as discussed in the comments following that answer.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-10-01T22:26:36.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10943" PostTypeId="1" AcceptedAnswerId="10944" CreationDate="2013-10-01T22:59:54.610" Score="1" ViewCount="784" Body="&lt;p&gt;I'm not sure how to approach this problem.  I will describe what I am trying to do, and what some of my matlab outputs look like.  I'm not trained in signal processing or anything, so please be patient reading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a fourier transform of some signal, and its frequency domain covariance matrix.  For example, say my signal $x[f]$ is $100$ points long.  Its covariance matrix $\Sigma$ is $100 \times 100$.  I noticed that its diagonal is real, and when I plot it, it looks like a PSD.  All the off diagonal elements are complex.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I wish to do, is take the IFFT of the signal $x[f] \rightarrow x[t]$, and then plot $x[t]$ with error bars from the covariance $\Sigma$.  Is this possible?  After I take the IFFT of $x[f]$, what do I need to do to $\Sigma?$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for reading!   &lt;/p&gt;&#xA;" OwnerUserId="4141" LastActivityDate="2013-10-02T00:09:14.083" Title="Error Propagation through an IFFT" Tags="|matlab|fourier-transform|statistics|covariance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10944" PostTypeId="2" ParentId="10943" CreationDate="2013-10-01T23:50:29.773" Score="2" Body="&lt;p&gt;Maybe it helps you to note that the FFT or IFFT with length $N$ can be realized by multiplication with the Fourier matrix $F$, or its conjugate transpose divided by $N$ respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the covariance matrix $\Sigma$ of your signal in frequency domain, the covariance matrix of the signal after IFFT (or multiplication with $F^H/N$) is then given by the usual way to compute the covariance matrix of a linear transform, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Sigma' = 1/N^2 \; F^H \Sigma F$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the prefactor $1/N^2$ is just because the IFFT is given by $F^H / N$.&lt;/p&gt;&#xA;" OwnerUserId="5145" LastEditorUserId="5145" LastEditDate="2013-10-02T00:09:14.083" LastActivityDate="2013-10-02T00:09:14.083" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10946" PostTypeId="1" AcceptedAnswerId="10948" CreationDate="2013-10-02T08:59:36.520" Score="3" ViewCount="498" Body="&lt;p&gt;I'm working on a device that produces a signal with sampling rate of 100 kHz. Every 40 ms, I receive 16000 points, from which I have to extract a frequency close to 3.55 kHz. I have developed a method that extracts the frequency of the signal very close to the Cramér-Rao lower bound, but I need to extract the amplitude of the signal at that frequency very precisely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first idea that occured to me was using a digital implementation of a lock-in amplifier, but the problem is that a lock-in amplifier needs a low-pass filter. And I'm trying to avoid using filters as much as I could, because filters introduce a systematic shift in my readings, while I need extremely high precission and accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best amplitude estimation algorithm I should use?&lt;/p&gt;&#xA;" OwnerUserId="5565" LastEditorUserId="5565" LastEditDate="2013-10-02T10:33:53.317" LastActivityDate="2013-10-02T15:41:50.563" Title="Estimation of the amplitude of a frequency component in a signal" Tags="|frequency-spectrum|frequency|estimation|estimators|amplitude|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="10947" PostTypeId="1" CreationDate="2013-10-02T12:13:31.477" Score="0" ViewCount="335" Body="&lt;p&gt;i'm trying to plot 1)the magnitude and 2)the phase response of an IIR eq with only its coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i've found somewhere that one can find the magnitude response starting with the transfer function :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ex: y(n) = a1*y(n-1) + b0*x(n) + b1*x(n-1) + b2*x(n-2)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;... has the transfer function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       Y(Z)    b0 + b1 Z^-1 + b2 Z^-2 &#xA;H(Z) = ---- = ----------------------&#xA;       X(Z)     1 - a1 Z^-1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;To find the frequency response at theta=pi (folding frequency)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Recall Z = exp( j*theta )&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Z = exp(j*pi) = -1&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;         b0 + b1*(-1) + b2*1 &#xA;H(-1) = ----------------------&#xA;            1 - a1*(-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;let's try with a frequency of 0.25*Pi&lt;/p&gt;&#xA;&#xA;&lt;p&gt;exp(0.25*j*pi) = 1 + j*sin(0.25*pi) ~= 1 + 0.72*j&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but after some calculations i end up with a complex division:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     (b0 + b1 + 0,52*b2) + j*0.72*b1 &#xA;  =  -------------------------------------&#xA;      (1 - a1) + a1*0.72*j&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so where do i go from there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and how to compute the phase ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks a  lot!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff    &lt;/p&gt;&#xA;" OwnerUserId="5349" LastActivityDate="2013-10-02T12:13:31.477" Title="IIR: get magnitude and phase from coefficients" Tags="|frequency|infinite-impulse-response|frequency-response|phase|magnitude|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10948" PostTypeId="2" ParentId="10946" CreationDate="2013-10-02T15:41:50.563" Score="4" Body="&lt;p&gt;Generally, the frequency estimation problem decouples from the amplitude + phase estimation problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said in the comments, you could just do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{A} = \left|\sum_{n=0}^{N-1} x_n e^{-j 2\pi\hat{f} n} \right|&#xA;$$&#xA;where $\hat{f}$ is your frequency estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your issues:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;because the number of points isn't high enough to hit the right resolution&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what you mean by &quot;resolution&quot; here? Resolving the &lt;em&gt;amplitude&lt;/em&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;second is that I need a really fast way&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The suggested technique will only take $N$ complex multiplications and $N-1$ complex additions, plus whatever you need to calculate the absolute value (two complex multiplications and one addition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's pretty fast, and linear in $N$.  And certainly faster than an FFT (which would be $N\log_2 N$).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-10-02T15:41:50.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10949" PostTypeId="2" ParentId="10930" CreationDate="2013-10-02T16:29:37.113" Score="1" Body="&lt;p&gt;It depends on the final goal and the model used.&lt;br /&gt;&#xA;If we assume we have an image - &lt;span class=&quot;math-container&quot;&gt;$ I $&lt;/span&gt; which is a result of a sum on of an image &lt;span class=&quot;math-container&quot;&gt;$ W $&lt;/span&gt; with noise &lt;span class=&quot;math-container&quot;&gt;$ n $&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$I = W + n$&lt;/span&gt; and our goal by reducing the noise is estimating &lt;span class=&quot;math-container&quot;&gt;$ W $&lt;/span&gt; than this process is restoration.&lt;/p&gt;&#xA;&lt;p&gt;Yet I could try achieving a different goal by denoising, such as making it look better (Subjective target) or use prior such as Piecewise Constant image which means the denoising process if more of an enhancement to the image.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="7092" LastEditDate="2021-02-23T05:46:29.463" LastActivityDate="2021-02-23T05:46:29.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10951" PostTypeId="1" CreationDate="2013-10-02T18:30:31.650" Score="5" ViewCount="192" Body="&lt;p&gt;Consider a set $U$. My signal is a piece-wise constant &quot;function&quot;&#xA;$Sig: t \mapsto s$, i.e. the signal at time $t$ equals to some subset&#xA;$s \subset U$. One can see $Sig(t)$ as a stochastic process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given sequence of time points $\{t_i\}$, we have sequence of&#xA;partial observations $\{ Ob(t_i) \}$. Each observation $Ob(t_i)$ is&#xA;not a noised value of $Sig(t_t)$, but rather a &quot;random&quot; part of the &quot;real&quot;&#xA;signal. I mean:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Ob(t_i) \subset Sig(t_i) \,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(For example, $Sig(t_i)$ can be a graph, and $Ob(t_i)$ will result in a random subgraph of $Sig(t_i)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a theory that describes such partially observed stochastic&#xA;processes?  In particular, is there a method to infer (estimate) the&#xA;parameters of the underlying stochastic process $Sig(t)$ using only a&#xA;given sequence of observations $\{Ob(t_i)\}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to add some addition properties (constraints) to $Sig(t)$ or to $Ob(t)$, you are welcome.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Update:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;For example, a very simple problem from this class is considered here: &lt;a href=&quot;https://stats.stackexchange.com/questions/83998/if-maria-performs-more-observations-per-unit-of-time-than-maximilien-how-can-he&quot;&gt;https://stats.stackexchange.com/questions/83998/if-maria-performs-more-observations-per-unit-of-time-than-maximilien-how-can-he&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5570" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2014-01-31T16:16:19.133" Title="Stochastic process inference from partial observations" Tags="|sampling|estimation|statistics|reconstruction|random|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10952" PostTypeId="2" ParentId="2694" CreationDate="2013-10-02T20:42:32.330" Score="0" Body="&lt;p&gt;If your signal is multi-dimensional, then parallelizing the FFT can be accomplished fairly easily; keep one dimension contiguous in an MPI process, perform the FFT, and transpose (altoall) to work on the next dimension.  FFTW does this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the data is 1D, the problem is much more difficult.  FFTW, for example, did not write a 1D FFT using MPI.  If one uses a radix-2 decimation-in-frequency algorithm, then the first few stages can be performed as a naive DFT, allowing one to use 2 or 4 nodes without any loss of precision (this is because the roots of unity for the first stages are either -1 or i, which are nice with which to work).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, what are you planning on doing with the data once you've transformed it?  It might be do something if one knows what happens to the output (i.e. a convolution, low-pass filter, etc).&lt;/p&gt;&#xA;" OwnerUserId="5571" LastActivityDate="2013-10-02T20:42:32.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10953" PostTypeId="2" ParentId="9707" CreationDate="2013-10-02T23:31:39.520" Score="1" Body="&lt;p&gt;en.wikipedia.org/wiki/Wiener_filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what you are looking for is a Weiner  filter  that takes into account the standard deviations of your data. See &lt;a href=&quot;http://www.astroml.org/book_figures/chapter10/fig_wiener_filter.html&quot; rel=&quot;nofollow&quot;&gt;http://www.astroml.org/book_figures/chapter10/fig_wiener_filter.html&lt;/a&gt; &#xA; and the description in Wikipedia  for implementation.  Basically you will do what you were suggesting,  but with an additional term in the denominator of the ratio of fft's  that is the fft  of the noise.&lt;/p&gt;&#xA;" OwnerUserId="5572" LastActivityDate="2013-10-02T23:31:39.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10956" PostTypeId="1" CreationDate="2013-10-03T07:21:33.537" Score="-1" ViewCount="299" Body="&lt;p&gt;What I'll get if I take FFT of a frequency domain data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions related to this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For ex, x is a time domain data where X = fft(x), now fft(X)= what i'll get ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;While reading SCFDMA, data is first DFT'd  and a subcarrier mapping happens then we are taking an IFFT which will transmitted using a radio. According to my knowledge the input to radio is a time domain data.But in SCFDMA  taking DDT itself converts my time domain data to Frequency domain then again if i take IFFT the frequency domain data converted back to time domain which is fed to radio. How this works ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3638" LastActivityDate="2013-10-03T10:54:55.177" Title="what I'll get if I take FFT of a frequency domain data" Tags="|fft|dft|frequency-domain|ifft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10957" PostTypeId="2" ParentId="9365" CreationDate="2013-10-03T07:36:42.380" Score="-1" Body="&lt;pre&gt;&lt;code&gt;fs=70MHz % Sampling freq = 70 MHz&#xA;fc=fs/(10);   % pass band corner frequency&#xA;fc=fs/(10);   % pass band corner frequency&#xA;fc1=fs/(8);   %stop band corner frequency&#xA;%change the scaling factor according to ur cutoff frequency&#xA;lpfLength=127; % Order/Number of Filter coefficients&#xA;&#xA;% Low Pass Filterlpf=fir2(lpfLength,[0 fc fc1 fs/2]/(fs/2),[1 1 0 0]); &#xA;&#xA;FFThn=fft(lpf,NFFT);    % FFT of filter h(n) i.e H(w). NFFT can be any value like 2048&#xA;&#xA;magfhn=20*log10(abs(FFThn)).';    % Magnitude in dB&#xA;magfhn=circshift(magfhn,NFFT/2).';  %circshift is used if u want to plot it from -fs/2 to fs/2&#xA;&#xA;figure;&#xA;plot((-NFFT/2:NFFT/2-1)*fs/NFFT,magfhn); %Freq. plot of LPF, If u want to plot from 0 - fs than use 0:NFFT&#xA;xlabel('Frequency (Hz)');&#xA;ylabel('Suppression (dB)');&#xA;title('Low Pass Prototype Filter')&#xA;axis([-fs/2 fs/2 -100 5]); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5575" LastEditorUserId="1849" LastEditDate="2013-10-03T13:31:42.157" LastActivityDate="2013-10-03T13:31:42.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10960" PostTypeId="2" ParentId="10956" CreationDate="2013-10-03T10:54:55.177" Score="6" Body="&lt;p&gt;The FFT of the FFT bascially gets you the original signal again, it's just scaled and time flipped, i.e.&#xA;$$FFT\left \{ FFT \left \{ x(n) \right \} \right \} = N \cdot x(-n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's a simple consequence of the fact that the forward and inverse Fourier Transforms are almost the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea what all the acronyms in the second question mean.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-03T10:54:55.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10961" PostTypeId="1" CreationDate="2013-10-03T13:09:17.347" Score="2" ViewCount="197" Body="&lt;p&gt;Price/volume data from financial markets are like signals. Can these information be applied to signal processing to generate profits successfully?&lt;/p&gt;&#xA;" OwnerUserId="5577" LastActivityDate="2013-10-03T15:52:01.207" Title="Can signal processing be applied successfully to price data from financial markets?" Tags="|analytic-signal|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10962" PostTypeId="2" ParentId="10961" CreationDate="2013-10-03T13:37:57.980" Score="5" Body="&lt;p&gt;The financial market data normally available does not comply with the Nyquist sampling criteria.  Any information potentially in the data samples available to high frequency traders has to be taken advantage of before it is reflected in the prices, which leads to some profits in making exotic FPGA-based custom signal processing hardware.  According to theories of Talib and Mandlebrot, all the entities attempting to rapidly act on any of this information processing contributes to the non-Gaussian/&quot;fat-tailed&quot;/chaotic behavior, which may or may not be good for market stability in the opinion of some. Signal processing algorithms that assume the underlying model might be a stationary composite of Gaussian and linear low order differential equations are likely unsuitable for extracting usable information from data with the above behaviors.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-10-03T13:58:52.997" LastActivityDate="2013-10-03T13:58:52.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10964" PostTypeId="2" ParentId="10961" CreationDate="2013-10-03T15:52:01.207" Score="6" Body="&lt;p&gt;Well of course you can apply it and many people try. If anyone has been really successful in doing this they probably are sitting now on a nice warm beach sipping Martinis, so this information may not be easy to come by.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-03T15:52:01.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10965" PostTypeId="1" AcceptedAnswerId="10968" CreationDate="2013-10-03T16:05:37.550" Score="0" ViewCount="1161" Body="&lt;p&gt;I am developing C++ code to do some modeling that will take as input a parametric model of the complex frequency response (amplitude, phase) and produce as output an impulse response, e.g. using the iFFT. I would like to compare this to a &quot;windowed&quot; impulse response that I have measured for a loudspeaker in a room. The measured impulse can be characterized by an initial portion that corresponds to sound traveling directly through the air to the microphone that lasts a few millisecond, after which sounds that reflect off of the surfaces in the room (floor, walls, etc.) contaminates the signal. The uncontaminated portion is only 3% of the total measured impulse. For instance if I record 16k points at 96kHz, its only the first 470 points of the impulse. I want to compare the impulse response that the iFFT generates from the frequency response model to ONLY the uncontaminated portion of the measured impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could calculate the entire impulse response from the frequency response and then just throw away 97% of the result but this seems to be very inefficient. The iFFT will be calculated many, many times (thousands probably) while my model is being optimized so I want to make sure that I can make it as efficient as possible. At this point my only option seems to be using FFTW and then just throwing away the data that is not needed (for lack of a better idea).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a fast way to calculate the inverse FFT only for those 470 time points of interest, e.g. not for the entire time span that the FFT can access? I am not intimately familiar with the computation of the FFT and iFFT, so I don't have insight on the answer to this question.&lt;/p&gt;&#xA;" OwnerUserId="5580" LastActivityDate="2013-10-05T19:07:41.667" Title="inverse FFT when only a few time points are needed" Tags="|audio|frequency-response|impulse-response|ifft|performance|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10966" PostTypeId="2" ParentId="10965" CreationDate="2013-10-03T16:42:17.253" Score="5" Body="&lt;p&gt;What you're looking for is called a &lt;em&gt;pruned DFT&lt;/em&gt;. In principle, it is possible to calculate a subset of outputs from a DFT using fewer mathematical operations. In practice, however, existing highly-optimized FFT implementations like FFTW are designed for full-output transforms. You'll find in many cases, unless you're only concerned with a very small proportion of the transform outputs, it is fastest to just calculate the entire thing and throw away what you don't want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it turns out, &lt;a href=&quot;http://www.fftw.org/pruned.html&quot;&gt;FFTW has a page in their documentation that talks about this specifically&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to put in a lot of work, it is possible that you could obtain some performance gain by rolling your own FFT implementation for your specific case. FFTW is a general-purpose, any-size-transform library that works well in a variety of conditions, but it's possible that you could beat it if you tune something specifically for your application. Before expending this effort, I would think long and hard about whether it is truly a limiting factor in your system's performance.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-10-03T16:42:17.253" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10967" PostTypeId="1" CreationDate="2013-10-03T18:49:55.757" Score="4" ViewCount="205" Body="&lt;p&gt;If one has a 2-D array and would like to take the 1-D Fourier transform along a direction $\theta$ degrees off the horizontal, is there a better/faster way to do this rather than rotating the image by $-\theta$ degrees, taking the 1-D FT across the columns, and then rotating the result back by $\theta$ degrees?&lt;/p&gt;&#xA;" OwnerUserId="5134" LastEditorUserId="5134" LastEditDate="2013-10-03T19:02:02.503" LastActivityDate="2014-02-01T13:17:08.680" Title="1-D Fourier Transform Of A 2-D Image But At An Arbitrary Orientation" Tags="|image-processing|fft|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10968" PostTypeId="2" ParentId="10965" CreationDate="2013-10-03T19:34:25.733" Score="0" Body="&lt;p&gt;If your inverse FFT is producing a time series that is N times longer than you need, downsample your frequency domain signal by N and then take the IFFT.  Try it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;As has been pointed out, this method will produce undesired time aliasing unless the content after the window of interest is very small or non-existent.  This method may still be favorable in cases where the system response decays exponentially.  However, if your window ends before the response has decayed by say, 20 or 30 dB, you should consider another method that will be free of aliasing.  Either that, or scale your window down only to the point where you are not negatively affected by aliasing, and then throw out any un-needed samples from there.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastEditorUserId="5156" LastEditDate="2013-10-05T18:24:51.440" LastActivityDate="2013-10-05T18:24:51.440" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10969" PostTypeId="2" ParentId="10837" CreationDate="2013-10-04T03:10:32.760" Score="2" Body="&lt;p&gt;Hilbert-Huang starts with empirical mode decomposition (EMD). I know one HHT code is available on Matlab central but I personally find it not very robust and extremely sensitive to edge effects. A more robust solution may be found here : &lt;a href=&quot;http://perso.ens-lyon.fr/patrick.flandrin/emd.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://perso.ens-lyon.fr/patrick.flandrin/emd.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the EMD is performed, the missing step to complete HHT is the Hilbert transform which is fairly straight forward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More details and links are mentioned in &lt;a href=&quot;https://dsp.stackexchange.com/questions/10560/precisions-on-hilbert-huang-transform&quot;&gt;this post&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5342" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-10-07T20:17:39.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10971" PostTypeId="1" AcceptedAnswerId="10978" CreationDate="2013-10-04T06:43:17.373" Score="1" ViewCount="714" Body="&lt;p&gt;Recently I read about image noise. I read about noise characteristics, but I am unable to understand the following two points:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sources of noise in digital images arise during image acquisition&#xA;(digitization) and transmission.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Imaging sensors can be affected by ambient conditions&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Interference can be added to an image during transmission&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4444" LastEditorUserId="76" LastEditDate="2013-10-05T08:07:27.680" LastActivityDate="2013-10-05T08:07:27.680" Title="How is noise added in an image during image acquisition or image transmission?" Tags="|image-processing|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10972" PostTypeId="1" CreationDate="2013-10-04T07:41:20.993" Score="1" ViewCount="103" Body="&lt;p&gt;I have a time series of data with columns labeled Months and Rows labeled Years. So, my data looks as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1900    -5     8    8    6    15   ......&#xA;1901    -3     8    8    6    15   ......&#xA;1902    -12    4    8    6    15   ......&#xA;1903    -34    1    8    6    15   ......&#xA;1904    -5     8    8    6    15   ......&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above data is just dummy and for illustration purpose only. My matrix is for period 1900 to 1950 hence the matrix size is 1950x12. The data is for flow in a river and hence there would be some correlation between flows of consecutive months.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to predict data for year 1951 based on data from 1900 to 1950. What algorithm is best suggested for this purpose. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use Kalman Filter kind of method but that gives me only 1 step ahead forecast. I need to predict flow for 12 months. So, a Fourier analysis can be of use here as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other ideas ?&lt;/p&gt;&#xA;" OwnerUserId="5584" LastActivityDate="2014-01-02T13:45:32.573" Title="12 step ahead prediction desired" Tags="|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10973" PostTypeId="2" ParentId="10972" CreationDate="2013-10-04T08:56:03.630" Score="0" Body="&lt;p&gt;Do you have a model for the flow?  It would be best to optimize model parameters w.r.t. some error criteria rather than just use any old prediction algorithm.  But if you just want to throw data at the problem, try linear prediction.&lt;/p&gt;&#xA;" OwnerUserId="5559" LastActivityDate="2013-10-04T08:56:03.630" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10974" PostTypeId="2" ParentId="10967" CreationDate="2013-10-04T10:05:06.457" Score="1" Body="&lt;p&gt;You can take the 1D IFFT using a pseudo-polar grid. Fig. 2 in this &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.63.7390&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; shows an example of such grid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible choices for the angle $\theta$ are going to be limited. but the transform will be free from interpolation artifacts introduced by the rotation algorithm.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-10-04T10:05:06.457" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10976" PostTypeId="2" ParentId="10930" CreationDate="2013-10-04T11:30:57.643" Score="3" Body="&lt;p&gt;If you want work in the &lt;em&gt;image processing&lt;/em&gt; field, my first advice would be to &lt;em&gt;try and understand various techniques, tools and algorithms used&lt;/em&gt;, understand &lt;em&gt;how they work&lt;/em&gt;, &lt;em&gt;where and why they are applied&lt;/em&gt; and &lt;em&gt;what you can achieve by applying each of them to your input&lt;/em&gt; &lt;strong&gt;without&lt;/strong&gt; actually &lt;strong&gt;trying to classify them into &lt;em&gt;labeled&lt;/em&gt; boxes&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, terminology is not perfect and it is hard to reach a naming consensus even concerning &lt;a href=&quot;https://dsp.stackexchange.com/q/2665/1273&quot;&gt;high level concepts&lt;/a&gt;, let alone detailed techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, about &lt;strong&gt;noise&lt;/strong&gt; and &lt;strong&gt;noise removal&lt;/strong&gt;: First, it is important to understand that &lt;em&gt;noise can appear&lt;/em&gt; in the image &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_noise&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;for various reasons&lt;/em&gt;&lt;/a&gt; most of which could be classified to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;noise introduced by the sensor (camera, film, circuitry)&lt;/li&gt;&#xA;&lt;li&gt;&quot;digitally&quot; introduced noise (errors in transmission, lossy compression)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And I would say that &lt;em&gt;noise removal&lt;/em&gt; could be part of &lt;em&gt;both&lt;/em&gt; processes of &lt;em&gt;image enhancement&lt;/em&gt; and &lt;em&gt;image restoration&lt;/em&gt;. The opinions are based on my own intuition as somebody who's been working in image processing for a few years now, but:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Image enhancement&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I got an image from a bad-quality sensor, or simply wanted to increase the details on any image &lt;em&gt;obtained directly from a camera&lt;/em&gt;, I would call it &lt;em&gt;image enhancement&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example I saw and would probably classify as such is processing of satellite images. Usually, before processing the image, you want to enhance the contours and remove small intensity variations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Image restoration&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If something &lt;em&gt;corrupted&lt;/em&gt; the image you got from the sensor and you want to revert back and obtain an image as close to the original, sensor-returned image, I would call it &lt;em&gt;image restoration&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example could maybe be trying to correct the images (frames) while video streaming, where you would want to handle the losses as much as possible and still display a (good) video.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-10-04T11:30:57.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10978" PostTypeId="2" ParentId="10971" CreationDate="2013-10-04T11:52:52.790" Score="2" Body="&lt;p&gt;If you assume the &quot;ideal&quot; image is what you see with your eyes (okay, this is a bit of a stretch, none of our eyes are perfect), then you can classify the noise based on &lt;strong&gt;where&lt;/strong&gt; or &lt;strong&gt;how the differences were introduced&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Noise caused by sensors&lt;/strong&gt; (some examples of this could be:)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if you aim your camera at the sun, you'll just have a very bright spot and &quot;flash&quot; on your image (which you do not see with your eyes)&lt;/li&gt;&#xA;&lt;li&gt;you've seen this when trying to take an photo of a starry sky: your eyes can see the stars perfectly, but most cameras will just produce dark/black images with no starts&lt;/li&gt;&#xA;&lt;li&gt;some modern sensors have an in-build brightness normalization (e.g. my laptop camera): if taking a picture/video with a bright object in the background (e.g. sitting in front of a light or a window when video-chatting) can sometimes make the foreground object (e.g. the person) overly dark&lt;/li&gt;&#xA;&lt;li&gt;the camera lens has it's &lt;a href=&quot;http://en.wikipedia.org/wiki/Camera_resectioning#Intrinsic_parameters&quot; rel=&quot;nofollow&quot;&gt;intrinsic parameters&lt;/a&gt; which introduce distortions in comparison to what we would expect&lt;/li&gt;&#xA;&lt;li&gt;anything related to the environment and camera characteristics (more good examples &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_noise&quot; rel=&quot;nofollow&quot;&gt;on wiki&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Noise introduced &quot;digitally&quot;&lt;/strong&gt; (I would say that transmission is just one example):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if an image is being transmitted between two computers on the network, losses/errors can occur. Especially when dealing with transmission with no error detection/correction, some bits can change. If you consider the image that was sent as the &lt;em&gt;ground truth&lt;/em&gt;, the changed bits will be &lt;em&gt;noise&lt;/em&gt; in the received image.&lt;/li&gt;&#xA;&lt;li&gt;another example could be lossy image compression. A simple example would be if you decided to represent your pixels by 4-bits instead of 8-bits of grey levels. And suddenly you only have 16 gray levels available instead of 255, and noise gets introduced.&lt;/li&gt;&#xA;&lt;li&gt;any noise (digitally)introduced to the image that makes it different from what was initially acquired by the sensor would go to this category.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2013-10-04T11:52:52.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10980" PostTypeId="2" ParentId="10971" CreationDate="2013-10-04T13:14:11.377" Score="4" Body="&lt;p&gt;Imaging sensors are just electronic devices that receive photons (light) and turn them in to electrons (electric signal). As such, they are affected by ambient conditions such as temperature.&#xA;For example, you will have some noise coming from the electronic agitation (false currents due to freely moving electrons, without incoming light) that grows with the sensor temperature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do also have non-linear responses in the sensor that cause other noise patterns. A pixel needs to receive enough light before providing a reliable measurement. Before that threshold, it will be affected by Poisson noise (a noise whose distribution depends on the value of the pixel). On the other side of the per-pixel energy, it can get saturated (too much light), and its energy will &quot;spread&quot; onto neighboring pixels, thus modifying their value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, since you have a digital device, then you have an analog-to-digital conversion step that is likely to introduce further quantization noise, i.e., the recorded values will not be the &quot;real&quot; ones but something close up to the measurement precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outside your imaging device, there is light transmission in the atmosphere (turbulence is very likely to be a disturbance cause here, but it's usually not considered as noise), and image transmission over communication channels where packet losses (and thus pixel loss!) can happen.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-10-04T13:14:11.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10981" PostTypeId="2" ParentId="10560" CreationDate="2013-10-04T14:22:46.140" Score="3" Body="&lt;p&gt;After going through the literature regarding HHT and EMD, I found that the &quot;Huang&quot; part of HHT comes from the fact that he is the one who proposed EMD in the first place. That explains the name of the method...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more developments regarding EMD and HHT, I recommend the papers by Rilling et al. &quot;On empirical mode decomposition and its algorithms&quot;. For the lucky ones who speak French, Rilling's PhD. thesis on EMD no longer seems to be available online; the document seems very complete and contains a very detailed mathematical analysis of EMD. Related articles are also available &lt;a href=&quot;https://scholar.google.fr/citations?hl=en&amp;amp;user=BY6cK9UAAAAJ&amp;amp;view_op=list_works&amp;amp;citft=1&amp;amp;email_for_op=kootsoop%40gmail.com&amp;amp;gmla=AJsN-F4YPqXmkSrMP4ruhHYclah71W1d4glIyPe5o3AcRGIhMjZPOmf6hO6ID9XhWI9xZSrkFQIyPPGwLnWJPVVjoFMLCXSeo5BOT8Oq37TJAmpiVnqfUeHVA7pzg9F9Z-Tsl_HNvzFzPRBBVVtDyGeeiweQEBkHd9BlDNBGUg57FhZcGo8sTO98ewG2VkS5jPP8SZHrXYyNZbOLP9qDfLMv3uBz0v1SR0mDTzLl2EpMIf7tSVLlRpZNYtbQnh6_2wc6dKh7aR1ZoawZXx1svhJXyQ0d9JFeHfUgMzvrR1Io81jDti6j7xeCW4cPsReYf8T2K_SgfnDnUPJjA5MvtcSlp8qeWmyUCA&quot; rel=&quot;nofollow noreferrer&quot;&gt;in English here on Google Scholar.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One may sum-up HHT this way:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;EMD&lt;/strong&gt;: decomposes the initial signal as a list of Intrinsic Mode Functions (IMF);&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Hilbert tranform&lt;/strong&gt; computes the instantaneous frequencies associated to the IMF (which are precisely well suited for such transformation)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Hilbert spectrum&lt;/strong&gt;, meaning a representation of the amplitude of the IMF in a frequency/time domain using the instantaneous frequencies.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is a simple example based on the time signal: &lt;span class=&quot;math-container&quot;&gt;$y(t)=t^2sin(t^2)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$t\in[0;~16]$&lt;/span&gt;s. This signal features a quadratic growth of its amplitude combined with a linear growth of its frequency. Here is what a HHT of the signal leads to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;signal of interest&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C4ghv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;IMF obtained from EMD&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7jLVv.png&quot; alt=&quot;first IMF, very similar to &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lW2k2.png&quot; alt=&quot;second IMF, almost 0 in this example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;instantaneous frequencies&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZlZJv.png&quot; alt=&quot;instantaneous frequency associated with IMF 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hilbert spectrum&lt;/strong&gt; (white to black from 0 to maximum amplitude)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pXac3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some peaople see the HHT as a generalized Fourier Transform in the sense that the decomposition of the signal interest by HHT leads to both amplitude and frequency varying time signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signifiant drawback of HHT lies in its sensitivity to edge effects (what happens for the signal close to its left and right boundaries in 1D). Several techniques exist in order to mitigate these effects. Articles by Rilling mentioned above go with mirroring strategies while other engineering oriented strategies may involve waveform matching techniques.&lt;/p&gt;&#xA;" OwnerUserId="5342" LastEditorUserId="80" LastEditDate="2019-04-25T19:18:58.937" LastActivityDate="2019-04-25T19:18:58.937" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="10982" PostTypeId="2" ParentId="10610" CreationDate="2013-10-04T15:38:58.357" Score="1" Body="&lt;p&gt;Analytic signals to get a but more tricky in the discrete domain because of the periodicity in the time domain and the circular nature of the convolution. This article treats that fairly well &lt;a href=&quot;http://www.andrewduncan.ws/air/&quot; rel=&quot;nofollow&quot;&gt;http://www.andrewduncan.ws/air/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-04T15:38:58.357" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10984" PostTypeId="1" AcceptedAnswerId="10985" CreationDate="2013-10-04T18:08:48.193" Score="-2" ViewCount="100" Body="&lt;p&gt;what kind of filtering is it? How signal/noise ratio in the output mix of the duration of accumulation would look like, knowing &#xA; Signal/noise ratio=0.1&#xA; ,The number of cycles of accumulation of up to 200 &#xA; ,Limits of change in the signal/noise ratio of 0.1-3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/G3aid.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5589" LastActivityDate="2013-10-04T22:48:26.810" Title="Can you help me determine what section of digital signal processing discussed in this screenshot?" Tags="|filters|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10985" PostTypeId="2" ParentId="10984" CreationDate="2013-10-04T22:39:23.783" Score="0" Body="&lt;p&gt;Firstly, I think, you should translate the original screenshot into English.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, your filter looks like a kind of moving average filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally, if I understood correctly, the signal-noise ratio will be equal to $\frac{signal_{old}}{noise_{old}} \times n$, where $n$ is the number of cycles of accumulation.&lt;/p&gt;&#xA;" OwnerUserId="5570" LastEditorUserId="5570" LastEditDate="2013-10-04T22:48:26.810" LastActivityDate="2013-10-04T22:48:26.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10986" PostTypeId="1" CreationDate="2013-10-05T04:48:03.100" Score="0" ViewCount="525" Body="&lt;p&gt;Since Fourier transforms are applicable to only periodic functions, and unit impulse function{..0,0,1,0,0..} doesn't seem periodic, is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it like we are considering unit impulse function to be periodic in the range $(-\infty,+\infty)$?&lt;/p&gt;&#xA;" OwnerUserId="5513" LastEditorUserId="76" LastEditDate="2013-10-05T08:07:43.183" LastActivityDate="2013-10-05T08:07:43.183" Title="How is it possible to find the Fourier transform of unit impulse function?" Tags="|fourier-transform|homework|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10987" PostTypeId="2" ParentId="10965" CreationDate="2013-10-05T19:07:41.667" Score="0" Body="&lt;p&gt;You might also look at the sparse FFT (sFFT), which, given an integer k, finds the k dominant modes in the transform of length N. It is efficient if k &amp;lt;&amp;lt; N.  If your data fits this problem, it might be a way to go if the modes that you are looking for are the dominant modes.  It has been mentioned before: &lt;a href=&quot;https://dsp.stackexchange.com/questions/2317/what-is-the-sparse-fourier-transform&quot;&gt;What is the sparse Fourier transform?&lt;/a&gt; and has its own website now: &lt;a href=&quot;http://groups.csail.mit.edu/netmit/sFFT/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://groups.csail.mit.edu/netmit/sFFT/index.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your data is complex and you are looking for a convolution, you might also look at &lt;a href=&quot;http://fftwpp.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://fftwpp.sourceforge.net/&lt;/a&gt;, which both wraps FFTW into C++ for you and has implicitly dealiased convolution routines, which basically perform a pruned FFT with the appropriate padding to eliminate aliases.  I'm a developer for FFTW++; if you are interested in cross-correlations on real-valued data, let us know, as there are large performance advantages to be had using implicit padding on multidemsional data.&lt;/p&gt;&#xA;" OwnerUserId="5571" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-10-05T19:07:41.667" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="10989" PostTypeId="1" AcceptedAnswerId="10990" CreationDate="2013-10-05T22:18:56.440" Score="2" ViewCount="323" Body="&lt;p&gt;I'm surveying for feasibility techniques for a potential future project that's rather out of my past areas of expertise, and I have a fairly basic question. Of course if it looks feasible I will have to learn a whole lot more on the topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the equation to compute the number of FFTs/IFFTs per sample required, given the number of samples in the FFT n, the number of samples in the FIR m, and the number of samples of audio data this is applied to at a time x?&lt;/p&gt;&#xA;" OwnerUserId="5592" LastActivityDate="2013-10-05T23:50:49.690" Title="Basic Convolution Reverb Question" Tags="|audio|convolution|real-time|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10990" PostTypeId="2" ParentId="10989" CreationDate="2013-10-05T23:44:19.180" Score="2" Body="&lt;p&gt;Depends on your algorithm. Assuming overlap add/save and a filter length of N we would get: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Zero pad to 2*N and forward FFT: 4*N*log2(2*N) multiplies&lt;/li&gt;&#xA;&lt;li&gt;Spectrum multiply: 8*N multiplies (4*N if input and filter are real)&lt;/li&gt;&#xA;&lt;li&gt;Inverse FFT: same as 1&lt;/li&gt;&#xA;&lt;li&gt;Overhead for padding, overlap handling, house keeping etc.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are between 1 and 1.5 times the number of adds. There are also various ways to optimize this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, convolution is not always the best way to create reverb. It is computationally expensive, it adds a lot of latency, and it is very difficult to update or modify in real time.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-10-05T23:50:49.690" LastActivityDate="2013-10-05T23:50:49.690" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10991" PostTypeId="1" CreationDate="2013-10-06T00:04:01.333" Score="0" ViewCount="145" Body="&lt;p&gt;I'm currently working on a project that involves in Speech and recognising Phonemes (in kind of real-time). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current algorithm works by always listening for input from the Mic, and input that is above a specific threshold then this is recorded to a .wav file and sent to the server for processing. E.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;listening...&#xA;listening...&#xA;listening.. (max &amp;gt; threshold)&#xA;recording..&#xA;recording..&#xA;etc..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to do is therefore have it recording when a specific name has been said. Someone basically speaks to it.. I.e. (let's assume it's called iris) so the algorithm would therefore work like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;listening...&#xA;listening..&#xA;listening.. (max &amp;gt; threshold)&#xA;  // determine if the input is &quot;iris&quot;&#xA;  // if true: &#xA;     begin recording the sentence &#xA;  // else:&#xA;listening..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to do this in the time-domain, then, process the sentences in the frequency domain. I've read an article, and, a paper that describes this process using &lt;strong&gt;Total number of Zero-crossings (using a specific threshold)&lt;/strong&gt; my questions is whether or not this would be a good measure? I only need to identify one word, that is &quot;Iris&quot; and then everything else can be done using algorithms such as: MFCC, HMM's etc.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? :) &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2013-10-06T23:10:52.607" Title="Concepts / Algorithms for recognising words in the Time-Domain" Tags="|speech-recognition|speech-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="10992" PostTypeId="2" ParentId="10174" CreationDate="2013-10-06T08:53:10.247" Score="3" Body="&lt;p&gt;That was the same topic of my Graduation Project, I am not yet sure of the best way to do it as this matter is still a research matter, but what my team and I did was as follow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Provide a database representing the &lt;strong&gt;features&lt;/strong&gt; of the right pronunciation of each word. This database contains for each word around 10 different features for 10 different people reading this word.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Get the &lt;strong&gt;features&lt;/strong&gt; of the input word ie. a .wav file representing the word&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- compare the features of the input word with the 10 features representing the right pronunciation of the word &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the features, you will need to get the MFCC file a .wav file containing the word pronounced&#xA;The MFCC is a matrix of numbers, so to compare 2 MFCCs, you will need to use dynamic programming algorithm, in our case we've use Dynamic Time Wrapping algorithm.&#xA;You might also need to make a filtering on the input words to filter them from noise.&#xA;You might also need to check for the following programs:&#xA;Praat  &gt;&gt; to make a filtering if needed, and also can be used to make MFCC file &#xA;SPPAS  &gt;&gt; to get the feature of the .wav file (MFCC)&#xA;Matlab &gt;&gt; to compare 2 MFCC files&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this can help &lt;/p&gt;&#xA;" OwnerUserId="5593" LastEditorUserId="5593" LastEditDate="2013-10-06T16:51:21.447" LastActivityDate="2013-10-06T16:51:21.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10993" PostTypeId="2" ParentId="10991" CreationDate="2013-10-06T09:35:04.633" Score="4" Body="&lt;p&gt;I highly doubt that something as complex as recognizing a word can be done directly in the time domain using features as basic as zero-crossing rate.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-10-06T09:35:04.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10994" PostTypeId="1" AcceptedAnswerId="11093" CreationDate="2013-10-06T14:21:13.850" Score="2" ViewCount="1411" Body="&lt;p&gt;I am trying to understand the MACE correlation filter as per the paper&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Mahalanobis, A., Kumar, B.V.K.V., Casasent, D.: Minimum average correlation&#xA;  energy ﬁlters. Appl. Opt. 26, 3630–3633 (1987)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The equation to train the MACE filter is this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gFU3i.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I however am abit confused about what values you use for u.  From my reading u, is an N x 1 vector containing the desired peak values for the training images.  Is this something I would just set to 1, could someone offer some suggested values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found a basic implementation in matlab from &lt;a href=&quot;https://dsp.stackexchange.com/questions/2604/correlation-filter-output-range-normalization&quot;&gt;here&lt;/a&gt; (code posted below) but it does not give any definition to how I would go about deciding what u is?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D = diag(mean(abs(X),2));&#xA;% inv(A) * B = A \ B&#xA;XDX = ctranspose(X) * (D \ X);&#xA;h = (D \ X) * (XDX \ u);&#xA;H = reshape(h, size(I));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I will appreciate any help with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4821" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-11-21T05:36:01.983" Title="MACE correlation filter - any suggested values of of u?" Tags="|fourier-transform|filter-design|correlation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10995" PostTypeId="1" CreationDate="2013-10-06T15:34:46.603" Score="0" ViewCount="271" Body="&lt;p&gt;Investigation of the method of suppression of random noise by coherent signal accumulation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Purpose - to identify opportunities for the coherent accumulation for cases of stationary and quasi-stationary signal.&#xA;Suppose that the input is the mixture of observed signal and a random white noise (i.e. noise with uniform spectral density). The signal is stationary and is described from sample to sample by constant function (for example, a sinusoidal signal with a constant frequency and constant initial phase). In this case, the input noise in it amplitude is several times greater than the amplitude of the signal. By coherent accumulation of the input mix for a number of samples it possible to increase the signal/noise ratio.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;According to the results of modeling build a relationship:&#xA;a) The signal/noise ratio in the output mix with respect to duration of accumulation, ie accumulated number of samples at a constant signal/noise ratio at the input , ( the number of samples of accumulation varies )&#xA;b) the signal/noise ratio at the output with respect to signal/noise ratio at the input for a fixed number of samples (M = 10, 25 , 50 ) (SNR at the input vary)&lt;/li&gt;&#xA;&lt;li&gt;Repeat item &quot;1&quot; for the case of quasi-stationary signals.&#xA;As a useful signal you should set a rectangular pulse of constant duration, which offset from the origin varies from sample to sample by a linear law.&lt;/li&gt;&#xA;&lt;li&gt;To develop a functional diagram of a device that filters the signal by accumulation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Type of signal: The sum of two harmonic signals; &#xA;S/N ratio: 0.2;&#xA;The number of cycles of accumulation: up to 500; &#xA;Limits of change in the signal / noise ratio: 0.1-2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;THEORY&#xA;The method of accumulation is applicable if the useful signal during the reception time constant or a periodic function. The method is consist of many times repeated signal and summation of its individual realizations in the  receiver.&#xA;Let the transmission of the desired signal implemented in two levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TEibF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the interval Tx signal is constant.&#xA;In the observation interval Tx sample values ​​of the received signal are accumulated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y1=x+r1&#xA;y2=x+r2&#xA;...............&#xA;yn=x+rn&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and these values ​​are summed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kO4gL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We introduce two assumptions:&#xA;1) counts of interference ri are independent of each other;&#xA;2) The obstacle is stationary (its characteristics do not depend on time)&#xA;and lets find (Px/Pr)out on the output of the accumulator, ie&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AKcnt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*вых -output&lt;/p&gt;&#xA;" OwnerUserId="5589" LastEditorUserId="5589" LastEditDate="2013-10-08T01:55:50.627" LastActivityDate="2013-10-08T01:55:50.627" Title="Can somebody help me solve this signal accumulation problem?" Tags="|sampling|filtering|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="10996" PostTypeId="1" AcceptedAnswerId="11004" CreationDate="2013-10-06T16:09:39.553" Score="0" ViewCount="3309" Body="&lt;p&gt;Goal: I have a video stream from a webcam. I need get frequency of the green color changes on the video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Video color space is RGB&#xA;The signal looks sinusoidal with a frequency range 0.5 - 2.4 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I performed the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Capture Video frames into collection.&lt;/li&gt;&#xA;&lt;li&gt;Processing frames by Gaussian pyramid down level 4. (frame size now is ~ 37x32)&lt;/li&gt;&#xA;&lt;li&gt;use DFT/FFT with sample rate 30&lt;/li&gt;&#xA;&lt;li&gt;get spectrum&lt;/li&gt;&#xA;&lt;li&gt;calculate frequency&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;on DFT I put data from each frame:&#xA;video frames quantity = 60&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Method 1:&lt;/strong&gt;&#xA;I collect green channel from frame and join with the green channel from a next frame, in result I have a big data array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;37*32=1184&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1184*60=71040 the size of the sample buffer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one long array with 71040 data point of all pixels in the green channel of each frame.&#xA;(all green pixels from one frame + from next frame)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Method 2:&lt;/strong&gt;&#xA;I collect the green channel from an each pixel on the frame and join with the same green channel pixel from a next frame, as a result I have a big data array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1184 arrays with 60 data points&#xA;(each green pixel from one frame + from next frame)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which method is the correct one? &lt;/p&gt;&#xA;" OwnerUserId="5581" LastEditorUserId="76" LastEditDate="2013-10-07T08:46:06.740" LastActivityDate="2013-10-07T09:46:08.320" Title="How to process video with DFT/FFT - getting the frequency of green color changes?" Tags="|fft|dft|video-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10997" PostTypeId="1" CreationDate="2013-10-06T17:00:58.220" Score="1" ViewCount="1999" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0NR6Q.jpg&quot; alt=&quot;gain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7HszP.jpg&quot; alt=&quot;estimated&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi everybody. I'm very new in Kalman filter. Today I try to design Kalman filter to get estimated postion, velocity and acceleration from measurement position (by linear encoder). I don't use optimal input $u_k$ and my Kalman equations are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;\hat x_k^- = A\hat x_{k-1}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;P_k^- = AP_{k-1}A^T+Q&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;K_k = P_k^-H^T(HP_k^-H^T+R)^{-1}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;\hat x_k = \hat x_k^- + K_k(z_k-H\hat x_k^-)&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;P_k = (I-K_kH)P_k^-&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A=&#xA;\left[&#xA;\begin{array}{ccc}&#xA;  1 &amp;amp; T_s &amp;amp; 0.5T_s^2 \\&#xA;  0 &amp;amp; 1 &amp;amp; T_s\\&#xA;  0 &amp;amp; 0 &amp;amp; 1\\&#xA;\end{array}&#xA;\right]$, $Q=&#xA;\left[&#xA;\begin{array}{ccc}&#xA; 5.08*10^{-8} &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0.00033 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0.48796\\&#xA;\end{array}&#xA;\right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R=Q_{11}=5.08*10^{-8}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T_s$ is sampling time. The results of estimated value and Kalman gain were showed in top. The estimated position, velocity and accleleration seem correctly. But about Kalman gain, why it still constant when position, velocity and acceleration change ($t = 1.8\rightarrow 2.3s $)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I have mistake when assume acceleration $a_k = a_{k-1}$ (look at matrix $A$) because it change by time? I hear that extended Kalman filter can solve this problem. Can someone give me some advice for my system? &lt;/p&gt;&#xA;" OwnerUserId="5554" LastEditorUserId="80" LastEditDate="2015-02-05T19:44:09.737" LastActivityDate="2015-02-05T19:44:09.737" Title="about Kalman gain" Tags="|kalman-filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10998" PostTypeId="2" ParentId="1167" CreationDate="2013-10-06T19:02:11.033" Score="0" Body="&lt;p&gt;as I underestand, example below shows a ergodic and stationary process&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; X1 X2 X3  | mean var ...&#xA; 1  2  3   | 2    1&#xA; 2  3  1   | 2&#xA; 3  1  2   | 2&#xA; ----------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;mean 2  2  2 &#xA;var  1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because the mean and variance of every column is constant along the time&#xA;and mean and variance of every row is constant along the time&lt;/p&gt;&#xA;" OwnerUserId="5597" LastActivityDate="2013-10-06T19:02:11.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="10999" PostTypeId="2" ParentId="10997" CreationDate="2013-10-06T20:54:02.707" Score="2" Body="&lt;p&gt;Have a look at how the gain is calculated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;P_k^- = AP_{k-1}A^T+Q&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;K_k = P_k^-H^T(HP_k^-H^T+R)^{-1}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is zero dependence on the state estimate, the input nor the output of the Kalman filter.  This is one reason that sometimes Kalman filter implementations just ignore $k \le \infty$ and just use $P_\infty$ and $K_\infty$ from the start: they can be pre-calculated (known) before running the filter at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing that needs to happen is that $P_k$ and $K_k$ converge as $k \rightarrow \infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; this assumes that $A$, $H$, &#xA;$Q$, and $R$ are constant (not time-varying).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The $A$ matrix you're using is the standard one for one dimensional state of position, velocity and acceleration.  Why do you think it should change with time? Unless you sampling rate is variable, or something else is changing, the system looks correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say &lt;code&gt;The estimated position, velocity and accleleration seem correctly.&lt;/code&gt; : that sounds like everything is working as it should. What is wrong (or disturbing you) that you're asking the question?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;See this reference&lt;/a&gt; for the following paragraph:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vhEcp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-10-08T03:04:03.460" LastActivityDate="2013-10-08T03:04:03.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11000" PostTypeId="2" ParentId="10991" CreationDate="2013-10-06T23:10:52.607" Score="2" Body="&lt;p&gt;Zero crossing rate is not a good approach indeed, you can use any keyword spotting software to spot for the word, keyword spotting is based on HMM too and statistical hypothesis testing.&lt;/p&gt;&#xA;&lt;p&gt;You can try keyword spotting with &lt;a href=&quot;http://cmusphinx.sourceforge.net&quot; rel=&quot;nofollow noreferrer&quot;&gt;CMUSphinx&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3453" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-10-06T23:10:52.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11001" PostTypeId="1" CreationDate="2013-10-07T03:04:39.543" Score="0" ViewCount="1143" Body="&lt;p&gt;I have to compare two .wav files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am converting the wav file to an MFCC file. Why am I getting different MFCC matrices when using different Matlab toolboxes (one of them is giving a matrix having 20 rows while the other two are giving matrices having 13 rows, and even those two matrices are not same)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are the two matrices different? I have heard that there are 13 MFC coefficients. Does it have something to do with the number of rows?&lt;/p&gt;&#xA;" OwnerUserId="5598" LastEditorUserId="76" LastEditDate="2013-10-07T10:08:06.457" LastActivityDate="2013-10-07T10:31:31.160" Title="Confusion regarding wav to MFCC conversion" Tags="|matlab|speech-recognition|mfcc|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11003" PostTypeId="1" CreationDate="2013-10-07T06:12:37.767" Score="2" ViewCount="155" Body="&lt;p&gt;I need to append (not add) a bandlimited signal F(b) to a bandlimited signal F(a) and keep the result bandlimited without modifying the part that corresponds to F(a).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both are bandlimited to the same frequency (for example to 1/4 the Nyquist frequency). If F(a) is 100 samples long and F(b) is 100 samples long, the result F(c) is 200 samples in length and the first 100 samples of F(c) are identical to F(a).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An obvious &quot;solution&quot; is to filter the boundary so that the discontinuity can be made bandlimited, but in this case, I am restricted from modifying the samples in F(a).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I filter (or manipulate) F(b) such that the result of appending the two signals is also bandlimited to the same frequency and preserves the integrity of F(b) as much as possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: For context, here's the problem I'm trying to solve. I am performing procedural terrain generation using 2D heightmaps and need to add a tile of terrain to a pre-existing landscape that may or may not have been procedurally generated. I'm looking for an algorithm that will &quot;smooth&quot; the borders of the tiles so that the tile boundaries are not noticeable.&lt;/p&gt;&#xA;" OwnerUserId="5599" LastEditorUserId="5599" LastEditDate="2013-10-09T04:08:28.583" LastActivityDate="2013-10-09T04:08:28.583" Title="How to append two bandlimited signals and make the result bandlimited without modifying the first signal" Tags="|filters|discrete-signals|lowpass-filter|frequency-response|smoothing|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11004" PostTypeId="2" ParentId="10996" CreationDate="2013-10-07T06:41:40.863" Score="0" Body="&lt;p&gt;If you need to track changes in time, then the most natural and obvious way is to form one temporal (green data) vector per pixel that you want to observe, then take its DFT (it's way 2, but with more than 2 frames). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual vector length and DFT function that you should use will depend on the actual case you are working on. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Suppose you work from a recorder video. Then, you can take the 1D DFT of the vector formed with the value of one pixel of interest in the whole sequence.&lt;/li&gt;&#xA;&lt;li&gt;On the other hand, if you work from a live feed, then you need to use a FIFO data vector and probably apply a windowed 1D Fourier transform to avoid artifacts, see &lt;a href=&quot;http://en.wikipedia.org/wiki/STFT&quot; rel=&quot;nofollow&quot;&gt;short-time Fourier transform&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-10-07T09:46:08.320" LastActivityDate="2013-10-07T09:46:08.320" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11005" PostTypeId="1" CreationDate="2013-10-07T08:51:15.293" Score="2" ViewCount="968" Body="&lt;p&gt;I have a current signal represented by an array in python, which I would like to add shot noise to. Shot noise is defined as&#xA;$$ &#xA;σ_i = \sqrt{2qI \Delta f} &#xA;$$&#xA;where $q$ is the elementary charge, $I$ the current and $\Delta f$ is the bandwidth of interest. I guess the simplest way to add the noise would be to to add it in the time domain, using the &lt;code&gt;np.random.normal&lt;/code&gt; function in python and simply adding it element-wise to the signal array. The frequency is needed to calculate the shot noise, so I would calculate $\Delta f = \frac{1}{2\Delta t}$ where $\Delta t$ is the time between two consecutive samples in the array (correct me if I'm wrong!). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how can I add this noise in the frequency domain? I would expect to be able to express the shot noise in $\frac{A}{\sqrt{Hz}}$, and therefore make the magnitude independent of the frequency. &lt;a href=&quot;https://dsp.stackexchange.com/questions/8418/what-is-the-phase-and-magnitude-response-of-white-noise&quot;&gt;This post&lt;/a&gt; explains the relationship of the magnitude of white noise in time and frequency domain, but if I use that simple equation ($\frac{\sigma^2 M}{2}$ ) it doesn't become independent on the frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="4186" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-10-07T08:51:15.293" Title="Adding shot noise in frequency domain" Tags="|frequency-spectrum|noise|frequency-domain|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11007" PostTypeId="2" ParentId="11001" CreationDate="2013-10-07T10:31:31.160" Score="1" Body="&lt;p&gt;There are many variations in the ways MFCCs can be extracted. The most common ones are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;STFT parameters like frame rate, FFT size, FFT window.&lt;/li&gt;&#xA;&lt;li&gt;Filter bank parameters like number of bands, whether filter normalization is used, and whether the filters are applied to the magnitude or power spectra.&lt;/li&gt;&#xA;&lt;li&gt;Subtle variants in the definition of the discrete cosine transform.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And it is actually not correct to say that there are 13 MFCC - it is indeed very common to keep the 13 first coefficients, but you could very well use a larger cosine transform matrix and get more coefficients. The farther you go, the less information the coefficients will capture (since they will correspond to dimensions of decreasing variance - assuming the discrete cosine transform is a good approximation of a PCA on the mel coefficients data, which it is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://labrosa.ee.columbia.edu/matlab/rastamat/mfccs.html&quot; rel=&quot;nofollow&quot;&gt;Check this&lt;/a&gt; to learn more about all the subtle differences between several &quot;famous&quot; MFCC extraction toolboxes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, such or such combination of MFCC extraction parameters might give you a difference of at most one or two percentage points at whatever task you are using the MFCC for (for example speech recognition), but there are more interesting things to try to tweak and improve than these parameters.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-10-07T10:31:31.160" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11008" PostTypeId="1" AcceptedAnswerId="11032" CreationDate="2013-10-07T12:50:14.833" Score="11" ViewCount="7012" Body="&lt;p&gt;So I am getting to grasps with Fourier transforms. Intuitively now I definately understand what it does and will soon follow some classes on the mathematics (so the actual subject). But then I go on reading about the laplace transform and there I kind of lose it. What is the moment of a signal? Why is the fourier transform a special case of the laplace transform? How can I come to grips with the Laplace transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ive looked at these sources before I asked this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/536/what-is-meant-by-a-systems-impulse-response-and-frequency-response/539#539&quot;&gt;What is meant by a system&amp;#39;s &amp;quot;impulse response&amp;quot; and &amp;quot;frequency response?&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8769/how-to-distinguish-between-the-different-frequency-domains/8770#8770&quot;&gt;How to distinguish between the different frequency domains?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2721/amplitude-vs-frequency-response&quot;&gt;Amplitude vs Frequency Response&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/69/why-is-the-fourier-transform-so-important/70#70&quot;&gt;Why is the Fourier transform so important?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_transform&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Laplace_transform&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2021-03-16T16:18:59.480" Title="Intuitive interpretation of Laplace transform" Tags="|fourier-transform|homework|z-transform|reference-request|laplace-transform|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11009" PostTypeId="2" ParentId="2577" CreationDate="2013-10-07T13:34:47.003" Score="-1" Body="&lt;p&gt;Fourier transform of GG is also a Gaussian. Using the convolution theorem, the FT(Gaussian \times Gaussian) = FT(Gaussian) \conv FT(Gaussian) = Gaussian \conv Gaussian = Gaussian. Hope that helped!&lt;/p&gt;&#xA;" OwnerUserId="5601" LastActivityDate="2013-10-07T13:34:47.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11010" PostTypeId="1" CreationDate="2013-10-07T13:38:28.597" Score="-1" ViewCount="280" Body="&lt;ol&gt;&#xA;&lt;li&gt;How can we determine whether the receive filter is optimal or not in a digital receiver?&lt;/li&gt;&#xA;&lt;li&gt;For a decision region, how can we choose a noise value zk?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5215" LastEditorUserId="39" LastEditDate="2013-10-07T13:39:32.477" LastActivityDate="2013-10-07T13:53:41.080" Title="Digital Communication System" Tags="|digital-communications|" AnswerCount="1" CommentCount="1" ClosedDate="2013-11-17T18:55:59.683" ContentLicense="CC BY-SA 3.0" />
  <row Id="11011" PostTypeId="2" ParentId="11010" CreationDate="2013-10-07T13:53:41.080" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;It depends upon the modulation scheme that is being used. You calculate the probability of a bit error using your receiver of choice, then based on the characteristics of the systems in use, you calculate or bound the best probability of error that you could possibly get, then compare the two answers. For linear modulation on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Additive_white_Gaussian_noise&quot; rel=&quot;nofollow&quot;&gt;additive-white-Gaussian-noise (AWGN)&lt;/a&gt; channel, the optimum receiver filter is one whose impulse response is &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;matched to the pulse shape used at the transmitter&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It's not clear what you're asking. Noise values aren't typically something that you choose; nature does.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-10-07T13:53:41.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11012" PostTypeId="1" AcceptedAnswerId="11019" CreationDate="2013-10-07T14:35:19.743" Score="0" ViewCount="78" Body="&lt;p&gt;Could it bring any meaning? Is this kind of convolution be useful is solving anything?&lt;/p&gt;&#xA;" OwnerUserId="5513" LastActivityDate="2013-10-07T20:17:48.247" Title="Is it meaningful to find linear convolution of just two random sequences?" Tags="|convolution|" AnswerCount="1" CommentCount="1" ClosedDate="2013-10-08T12:20:39.693" ContentLicense="CC BY-SA 3.0" />
  <row Id="11013" PostTypeId="1" AcceptedAnswerId="11014" CreationDate="2013-10-07T14:35:31.177" Score="2" ViewCount="276" Body="&lt;p&gt;I have an ADC that will have a guitar track as an input. I want to find which notes are hitting via the frequency domain. Given that guitar frequency range is from 82Hz to 1046Hz which sample rate (window) should I choose? I had read on an article about some kind of rule but I can't find it..&lt;/p&gt;&#xA;" OwnerUserId="5602" LastActivityDate="2013-10-07T23:43:52.537" Title="What sample rate should I use on my ADC?" Tags="|frequency-spectrum|sampling|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11014" PostTypeId="2" ParentId="11013" CreationDate="2013-10-07T14:52:12.153" Score="3" Body="&lt;p&gt;Strictly speaking, according to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;sampling theorem&lt;/a&gt;, you would need to sample at a rate that is at least twice the bandwidth of your signal (which is around 960 Hz in your example). The low end of your band is close to zero, so you'd probably want to sample at 2092 Hz at least. In practice, you'll want to give some additional headroom to allow rolloff of your analog &lt;a href=&quot;http://en.wikipedia.org/wiki/Anti-aliasing_filter&quot; rel=&quot;nofollow&quot;&gt;antialiasing filter&lt;/a&gt;, so that might put you in the 2500-3000 Hz range. Depending upon what hardware you're using for analog-to-digital conversion, there may be some restrictions as to what rates it supports; you'll need to take this into account as well.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-10-07T14:52:12.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11015" PostTypeId="2" ParentId="11013" CreationDate="2013-10-07T15:33:00.230" Score="5" Body="&lt;p&gt;Depends on your specific application. First of all the guitar has a lot bigger frequency range than you indicate. While the fundamentals are in this range, the guitar has a lot of harmonics and in fact the bulk of the energy is in the harmonics, not the fundamental. So when you plug the low E string at 80 Hz, there is actually not that much energy at 80 Hz but way more at 160Hz, 240Hz, 320 Hz, etc. Same for the higher strings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case it may be simplest to take an off the shelf audio ADC that operates at some standard rate (8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000). The exact choice  depends on the requirements for your application. For ,say, a tuner, I'd do at least 16k.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-07T15:33:00.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11016" PostTypeId="2" ParentId="11003" CreationDate="2013-10-07T15:40:44.737" Score="3" Body="&lt;p&gt;That's a tricky problem. First you will need to define how to design &quot;integrity&quot;. What do you value more: time domain shape, spectrum, phase, envelope, short term Fourier spectrum envelope, etc. You will probably have to trade between those, so prioritizing would be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general this is done bu doing &quot;cross fades&quot;, i.e. you overlap the two signals for a small time period and then you fade out F(a) while at the same time fading in F(b). The time and shape of the fade can be controlled to satisfy the limited bandwidth requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it seems you can't do this, since you can't modify F(a) at all. One potential work around would be to either extrapolate F(a) or use a  circular repetition of F(a) to create enough data for a cross fade. This depends on the exact properties of F(a)&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-07T15:40:44.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11017" PostTypeId="1" AcceptedAnswerId="11018" CreationDate="2013-10-07T19:10:27.283" Score="1" ViewCount="1506" Body="&lt;p&gt;I am trying to implement an EKF to estimate my position and velocity states by using accelerometer measurements as well as periodic GPS (position) measurements.  Basically I want to use the constantly use the accelerometer and re-calibrate it for every position measurement that is available.  When there is GPS dropouts, the estimates rely solely on the accelerometer readings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I have it working if all measurements are available.  Since my acceleration is not one of my states, my accelerometer measurements are used in the predict side of my filter.  The position measurements are in the update side like normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a position measurement is unavailable, what do I do during my update?  Without a position measurement, am I basically just saying that a priori estimate is equal to my posteriori? (i.e. my &quot;pretend&quot; position measurement is just my estimated position).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there something fancier that has to be done?  Is there issues with the system not being &quot;observable&quot; (i.e. observability matrix not full rank) when the position measurements are not available?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance! &lt;/p&gt;&#xA;" OwnerUserId="5605" LastActivityDate="2016-04-21T01:36:58.717" Title="Kalman Filter - Position/Velocity from Accelerometer and periodic position measurements" Tags="|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11018" PostTypeId="2" ParentId="11017" CreationDate="2013-10-07T19:26:11.250" Score="1" Body="&lt;p&gt;I'm not sure how well it works, but one way to tweak the model is to set the measurement noise variance for the missing position measurement to a large value (meaning high uncertainty of the measurement), just for that missing time instant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting it to be &quot;infinite&quot; should have the same effect as what you're doing now: just equate &lt;em&gt;a priori&lt;/em&gt; and &lt;em&gt;a posteriori&lt;/em&gt; estimates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What setting the variance to some smaller value might give is a way to keep &quot;momentum&quot; in the position change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've not tried this approach, so please take with a grain of salt! &lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-10-07T19:43:18.963" LastActivityDate="2013-10-07T19:43:18.963" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11019" PostTypeId="2" ParentId="11012" CreationDate="2013-10-07T20:17:48.247" Score="0" Body="&lt;p&gt;No, if the two sequences are random then convolving them is not useful.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-10-07T20:17:48.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11021" PostTypeId="1" CreationDate="2013-10-07T20:42:39.603" Score="0" ViewCount="967" Body="&lt;p&gt;I delved into the state of the art of algorithms for Poisson noise estimation in order to estimate the variance, I found that the Expectation Maximization algorithm is very used and it is very effective and easy to use,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have not found the matlab code, I found only one that is was used for classification,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can you give me the code or the algorithm for estimating and not for classification please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be grateful if you answer me&lt;/p&gt;&#xA;" OwnerUserId="5607" LastActivityDate="2013-10-08T17:25:41.157" Title="How to use Expectation maximization to estimate poisson noise matlab" Tags="|image-processing|matlab|approximation|" AnswerCount="1" CommentCount="3" ClosedDate="2013-10-09T12:25:31.073" ContentLicense="CC BY-SA 3.0" />
  <row Id="11022" PostTypeId="2" ParentId="10413" CreationDate="2013-10-07T20:49:32.460" Score="3" Body="&lt;p&gt;I think you mistake &lt;em&gt;convolution&lt;/em&gt; for &lt;em&gt;cross-correlation&lt;/em&gt;. They have similar forms, but convolution is more general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correlation of two signals $f$ and $g$ could be calculated as:&#xA;$$\text{corr}(f,g)=\int_{-\infty}^{\infty}f(\tau)^*g(t+\tau)d\tau=(f\star(-g))$$&#xA;The convolution of the same signals is:&#xA;$$(f\star g)=\int_{-\infty}^{\infty}f(\tau)g(t-\tau)d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution could be used to calculate the response of an LTI system, and (normalized) cross-correlation could be used for pattern matching: the maxima of the cross-correlation function is &lt;em&gt;at the offset&lt;/em&gt; where pattern g is most likely to be situated in the signal f. If you know this offset you could use a similarity measure (such as the euclidean distance) to quantify similarity.&lt;/p&gt;&#xA;" OwnerUserId="215" LastActivityDate="2013-10-07T20:49:32.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11023" PostTypeId="2" ParentId="11013" CreationDate="2013-10-07T23:38:18.447" Score="2" Body="&lt;p&gt;A guitar's actual spectral frequency range is not what you stated.  Guitar strings often put out sounds consisting of a lot of higher harmonics of the note pitch that are sometimes more useful in determining the pitch than trying to estimate pitch from a weak or even missing fundamental in the spectrum.  Thus a sample rate significantly higher than 2X the highest pitch may prove to greatly increase the reliability of your pitch detection/estimation algorithm.  You will also need to sample at above 2X the cutoff frequency of the required anti-aliasing low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For guitar sound, using just the magnitude peak from a windowed FFT (for any window length) is unlikely to be a reliable estimator.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-10-07T23:43:52.537" LastActivityDate="2013-10-07T23:43:52.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11024" PostTypeId="1" AcceptedAnswerId="11027" CreationDate="2013-10-08T01:57:01.217" Score="8" ViewCount="3527" Body="&lt;p&gt;I'm a new guy in image processing and computer vision, so this question might be stupid to you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just learned some feature detection and description algorithms, such as &lt;em&gt;Harris, Hessian, SIFT, SURF&lt;/em&gt;, they process images to find out those &lt;em&gt;keypoints&lt;/em&gt; and then compute a &lt;em&gt;descriptor&lt;/em&gt; for each, the descriptor will be used for feature matching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried SIFT and SURF, found that they are not so robust as I thought, since for 2 images (one is rotated and affined a little), they don't match the features well, among almost 100 feature points, only 10 matches are good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I wonder &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What can we use these feature detection algorithms for in practice? Is there any more robust algorithms for feature detection and matching? Or SIFT and SURF is already good, I just need to refine it for further use?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another problem is that I thought these algorithms are not quite for real-time application (without considering multi-core implementation), but there are some commercial products (such as Kinect) which work and response in real-time! I assume these products also detect and match feature from what they &lt;em&gt;see&lt;/em&gt;, do they use the algorithms such as &lt;em&gt;SIFT&lt;/em&gt;? How could they detect features so well?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With my limited knowledge, I know feature matching can be used to find out same objects in two images, or estimate homographies, but any other purpose for feature matching?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4811" LastActivityDate="2013-10-24T11:31:39.153" Title="Purpose of image feature detection and matching" Tags="|image-processing|computer-vision|local-features|visual-tracking|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11026" PostTypeId="1" CreationDate="2013-10-08T08:35:12.057" Score="1" ViewCount="10490" Body="&lt;p&gt;First off: I'm really new in the signal processing department and MatLab as well, so please bear with me here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to achieve is to split my audio signal into smaller 25ms frames, where the frames overlap with 50%, apply a window function, thus the overlapping (probably &lt;code&gt;Hamming&lt;/code&gt; or &lt;code&gt;Hann&lt;/code&gt;), and then add it together again (write out a new sound file), so that I basically get the original signal back. Someone mentioned &lt;code&gt;overlap-add&lt;/code&gt;, but I'm not quite sure if convolution is correct here, as mentioned, I'm new to all this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have a sound file that I read like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function output = readSoundFile(filename, channels)&#xA;&#xA;if isscalar(channels)&#xA;    chN=channels;&#xA;    channels=ones(1,chN);&#xA;else&#xA;    chN=length(channels);&#xA;end&#xA;&#xA;fid=fopen(filename,'r','n');&#xA;[output, elementCount] = fread(fid,[chN,inf], '*int16');&#xA;fclose(fid);&#xA;&#xA;for i=chN:-1:1&#xA;    if channels(i) == 0&#xA;        output(i,:)=[];&#xA;    end&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In another &lt;code&gt;MatLab&lt;/code&gt; file, I use the &lt;code&gt;readSoundFile&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fileUrl = 'whatever/file.format';&#xA;sound = readSoundFile(file);&#xA;soundsc(double(sound), 16000); % sound is sampled with 16kHz. Don't know, if this information is needed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I split the resulting data into 25ms frames with an overlap of 50%, apply a window function, and write out a new file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should it help, I can convert the file into a &lt;code&gt;wav&lt;/code&gt; file, if &lt;code&gt;wavread&lt;/code&gt;/&lt;code&gt;audioread&lt;/code&gt; would be any easier.&lt;/p&gt;&#xA;" OwnerUserId="5612" LastActivityDate="2016-09-04T23:57:32.927" Title="Split audio signal into frames, apply window function and merge again" Tags="|matlab|window-functions|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11027" PostTypeId="2" ParentId="11024" CreationDate="2013-10-08T09:06:56.897" Score="9" Body="&lt;p&gt;Image keypoints are a key feature in many Image and Video processing softwares, both industrial and academic. The principle behind is always the same:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;detect some meaningful points in some images;&lt;/li&gt;&#xA;&lt;li&gt;[optional] compute a stable description of the image part surrounding each keypoint;&lt;/li&gt;&#xA;&lt;li&gt;match keypoints from an image (the template) to another (the query).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, some more detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why detecting points?&lt;/strong&gt; Basically, because a point is an intersection of two lines. As such, it is detected much more accurately (and in a more stable way) as lines or other features (area, etc.). This has been common knowledge in Computer Vision later proved in a &lt;a href=&quot;http://hal.inria.fr/inria-00548528/en&quot;&gt;paper&lt;/a&gt; by Mikolajczyk. This is rooted deeply in any point detector: for example, Harris point detector relies on the Hessian matrix to check that there are two crossing lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is the description part optional?&lt;/strong&gt; Basic point detectors (Harris, SUSAN, Moravec, FAST) do not come with a descriptor. The process of matching them is purely location-based. Thus, they are mostly used for video processing. The intuition behind is that you can have many many points, then a robust estimation process (e.g., RANSAC). Recent keypoints however (SIFT and the ones that came after) embed an image patch descriptor, because they are meant to be used in more complex situations (object detection, large baseline matching...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's he difference between Harris/Hessian and SIFT/SURF?&lt;/strong&gt; Besides the descriptor part, SIFT/SURF also include a localization in &lt;em&gt;scale&lt;/em&gt;. Thus, when you detectd a SIFT/SURF point, you expect to find it again even if your image has been zoomed in/out, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's the difference between SIF and SURF?&lt;/strong&gt; Well, SURF is actually mostly an approximated version of SIFT that is better suited for fast computations (by using integral images). Consequently, SURF is not as stable (as &quot;good&quot;) as SIFT under affine transforms, but it comes at something like 1/10th of the computational cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Are they suited for realtime software?&lt;/strong&gt; Yes, fore sure for Harris. SURF was designed to be fast, so a good implementation should be fast too. SIFT was not designed for speed, but you can find GPU implementations. But if you really want to be fast even on lower-end devices, then you need to check recent points such as FAST (detector), BRIEF, ORB, BRISK, FREAK (binary descriptors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What can you do with them?&lt;/strong&gt; Well, many things. By tracking points in videos then you can stablize them, augment them with objects, track objects. By matching points between cameras, you can automate the calibration process of 3D reconstruction pipelines. By matching points on parts of object, you can detect objects. And probably much more...&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-10-08T09:06:56.897" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11028" PostTypeId="2" ParentId="10301" CreationDate="2013-10-08T11:20:38.633" Score="2" Body="&lt;p&gt;It seems your hardware is limited. If you can't detect more finite frequencies and you can't implement another method of modulation you might have reached your maximum in physical bits with your hardware. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;May I suggest a bit of coding theory? Implement LZW compression. The data rate will vary and it might not give you double the speed but will definitely increase the data rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its already produced in c, try it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://marknelson.us/attachments/1989/lzw-data-compression/lzw.c&quot; rel=&quot;nofollow&quot;&gt;http://marknelson.us/attachments/1989/lzw-data-compression/lzw.c&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5615" LastActivityDate="2013-10-08T11:20:38.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11029" PostTypeId="2" ParentId="11024" CreationDate="2013-10-08T11:20:49.960" Score="2" Body="&lt;p&gt;Well, that's a great answer by @sansuiso, so I'll just concentrate on various possible uses of detected keypoints, and describe some examples for you. There are certainly more uses, the ones listed are just based on what I came in touch with until now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Content based image retrieval (CBIR)&lt;/strong&gt; You treat the features (the feature vectors you get after applying feature descriptors to the detected points) as &lt;em&gt;visual words&lt;/em&gt;. On those visual words, you apply &lt;em&gt;bag-of-words&lt;/em&gt; techniques, that were first introduced for text retrieval (think Google). I gave a quite detailed answer on that &lt;a href=&quot;https://dsp.stackexchange.com/a/5999/1273&quot;&gt;here&lt;/a&gt; (also look at references therein). This will allow you to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;find similar images in the database&lt;/li&gt;&#xA;&lt;li&gt;detect the presence of a certain object throughout database pictures&lt;/li&gt;&#xA;&lt;li&gt;&quot;cluster&quot; and organize the database automatically&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(&quot;Coarse&quot;) Homography estimation on image pairs&lt;/strong&gt; Detect features, do matching, chose the most robust matches, and then estimate the homography based on those matches. There are some techniques to improve performance: in addition to just matching descriptors, spatial information can be used as well (e.g. a match can be rejected if its neighbors from image A are not matched in the same neighborhood in the image B - example technique near the end of &lt;a href=&quot;http://web.cs.swarthmore.edu/~turnbull/cs97/f08/paper/sivic03.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; Can be used for example in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;image stitching&lt;/strong&gt; - e.g. to connect multiple &quot;panorama pictures&quot; in to one picture&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;coarse pose estimation&lt;/strong&gt; - we used this in a project where we had to navigate a robotic car automatically through a recorded course (based on human navigation). The only information we had was &quot;key&quot; images taken at certain distances along the path. First we used CBIR to find the closest key image, and then initial localization and positioning was done based on image matching between the current view and the database image.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;video stabilization&lt;/strong&gt; - I've seen a very nice example of footage of a road-crossing taken with a camera hanging from a helicopter. The idea was to &quot;neutralize&quot; the swinging of the camera -- and the final result was a very nice, steady-looking video.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Feature tracking&lt;/strong&gt; I can't tell you as much about &lt;em&gt;how&lt;/em&gt; this is done since I didn't do much tracking myself, but I can give you some examples of when this might be useful. The idea is to select some points of interest and then follow their position in the video from frame to frame. Examples (I've seen):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;traffic sign following: Could be an aid in driving, e.g. if there's a view of the road ahead, and the driver can get a processed image, it could be useful to detect, mark, and track the position of a traffic sign showing up in front of the driver (maybe alerting the driver to the location/distance of the sign, and meaning)&lt;/li&gt;&#xA;&lt;li&gt;fine localization and positioning: in the same automated navigation of the robotic car I mentioned above, it was much more precise to do fine localization based on &lt;em&gt;tracked features&lt;/em&gt;. In order to update the current position and give the command on further movement, certain features were tracked in the frame (so, no matching needed), and homography was estimated based on those features.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-10-08T11:20:49.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11031" PostTypeId="2" ParentId="11026" CreationDate="2013-10-08T17:00:13.663" Score="1" Body="&lt;p&gt;Von Hann (but not Hamming) windows with a 50% overlap sum to unity (except possibly at the very start or end of a file).  If you do any processing, rather than just analysis, in the frequency domain, you may find overlap add or overlap save with a rectangular window to be more appropriate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-08T17:00:13.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11032" PostTypeId="2" ParentId="11008" CreationDate="2013-10-08T17:00:52.587" Score="5" Body="&lt;p&gt;If you have an understanding of Fourier transforms then you probably already have a conceptual model of transforming signals into the frequency domain. The Laplace transform provides an alternative frequency domain representation of the signal - usually referred to as the &quot;S domain&quot; to differentiate it from other frequency domain transforms (such as the Z transform - which is essentially a descretised equivalent of the Laplace transform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the moment of a signal?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you are no doubt aware the Laplace transform gives us a description of a signal from it's moments, similar to how the Fourier transform gives us a description from phase and amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Broadly speaking a moment can be considered how a sample diverges from the mean value of a signal - the first moment is actually the mean, the second is the variance etc... (these are known collectively as &quot;moments of a distribution&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given our function F(t) we can calculate the n'th derivative at t=0 to give our n'th moment. Just as a signal can be described completely using phase and amplitude, it can be described completely by all of its derivatives. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is the fourier transform a special case of the laplace transform?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at the bilateral laplace transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\int_{-\infty}^\infty}e^{-st}f(t)dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be quite apparent that a substitution $s=i\omega$ will yield the familiar Fourier transform equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\int_{-\infty}^\infty}e^{-i\omega t}f(t)dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some notes about this relationship (&lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_transform#Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Laplace_transform#Fourier_transform&lt;/a&gt;) but the mathematics should be quite transparent.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-10-08T17:00:52.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11033" PostTypeId="2" ParentId="11021" CreationDate="2013-10-08T17:25:41.157" Score="1" Body="&lt;p&gt;Explanations of the Expectation Maximisation algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.nature.com/nbt/journal/v26/n8/full/nbt1406.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nature.com ( Nature Biotechnology 26, 897 - 899 (2008) )&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Expectation–maximization algorithm &lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/11808074/what-is-an-intuitive-explanation-of-expectation-maximization-technique&quot;&gt;Stack Overflow - What is an intuitive explanation of Expectation Maximization technique?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3546" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-10-08T17:25:41.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11036" PostTypeId="1" CreationDate="2013-10-09T05:56:38.790" Score="0" ViewCount="338" Body="&lt;p&gt;i am looking for discrimination of speech from animal sound if you take a 150ms frame of speech and bird as shown below, what feature can i extract from them so that i can effectively state the difference &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ktrde.png&quot; alt=&quot;1st is speech 2nd is animal(bird)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;zero crossings ?&#xA;cross correlation of successive frames seems high in bird sound ? isn't it &#xA;any other feature from your side ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/52c4k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one more example in above fig black-speeches,yellow siren,red bird,safron heavy wind the spikes are foot steps &lt;/p&gt;&#xA;&#xA;&lt;p&gt;above figure shows the difference in formant positions on spectrogram&#xA;in bird sounds the formants are differently spaced and less formants &lt;/p&gt;&#xA;&#xA;&lt;p&gt;will anything could be extracted from this analysis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the reason is i am looking for unsupervised(with out any training or SVM) speech discrimination form animal sounds because both are voice but computers cant classify the difference unless they are trained by any nueral network which need huge memroy and training database&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="4513" LastEditDate="2013-10-09T09:03:24.400" LastActivityDate="2014-06-07T19:57:03.303" Title="Speech discrimination from animal sound" Tags="|cross-correlation|speech-recognition|autocorrelation|speech|speech-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11037" PostTypeId="2" ParentId="7748" CreationDate="2013-10-09T09:03:34.960" Score="7" Body="&lt;p&gt;I do not know about many segmentation techniques, but I have been dealing with structures that offer a &quot;choice&quot; of segmentation pieces that can be further examined to produce a satisfying segmentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully somebody else can write about some different state-of-the-art segmentation method that I don't know much about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A small introduction as to why it is nice to have choices, or levels, of segmentation for a different image: segmentation is an &lt;em&gt;ill defined&lt;/em&gt; problem. The &lt;em&gt;ground truth&lt;/em&gt; does not exist: the desired results always depend on the user requirements and specifications. A nice quote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Even for a fixed image, &lt;em&gt;there may be more than one &quot;best&quot; segmentation&lt;/em&gt; because the criteria defining the quality of a segmentation are application dependent. This motivated us to focus our research on &lt;strong&gt;image-partitioning techniques delivering &quot;puzzle pieces&quot;&lt;/strong&gt; that can be used (...) to generate a segmentation satisfying specific user requirements&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;&lt;a href=&quot;http://cvl.ice.cycu.edu.tw/meeting/2008.09.23.pdf&quot;&gt;P. Soille: Constrained Connectivity for Hierarchical Image Partitioning and Simplification (2008)&lt;/a&gt;&lt;/strong&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;strong&gt;hierarchical structures&lt;/strong&gt;, hierarchical &lt;em&gt;image decompositions&lt;/em&gt; that propose image partitions with varying complexities. These structures are most simply represented as tree structures, where each node represents a region in the image. The idea with the structures:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the leaves of the structure are regions of a fine partition, or &lt;em&gt;over-segmentation&lt;/em&gt; of an image (e.g. pixels, flat zones - connected regions of same intensity, &lt;a href=&quot;http://en.wikipedia.org/wiki/Watershed_%28image_processing%29&quot;&gt;watershed&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;the links in the tree represent &lt;em&gt;merging&lt;/em&gt; or &lt;em&gt;union&lt;/em&gt; of (neighboring) regions and forming a more complex region, and are constructed in a way &lt;em&gt;most likely to produce regions corresponding to objects&lt;/em&gt; (hopefully :) )&lt;/li&gt;&#xA;&lt;li&gt;the complexity of the regions increases along each branch from nodes towards the root of the tree&lt;/li&gt;&#xA;&lt;li&gt;every level of the tree (also, every cut) is a partitioning/segmentation of an image (coarser the closer to the root it is)&lt;/li&gt;&#xA;&lt;li&gt;the root of the tree covers the whole image domain&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;segmentation than consists&lt;/strong&gt; of examining the regions and their proposed unions, to &lt;strong&gt;determine the &lt;em&gt;regions in the tree&lt;/em&gt; or the &lt;em&gt;cut of the tree&lt;/em&gt; corresponding to the required&lt;/strong&gt; precision, or some known properties about object of interest, or other pre-defined user specifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trees (that is, hierarchical image decompositions) with such properties are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4362825&quot;&gt;$\alpha$-trees&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4378395&quot;&gt;$(\omega)$-trees&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Binary partition trees (aimed at &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=841934&quot;&gt;segmentation&lt;/a&gt;, and &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4637886&quot;&gt;object detection&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In addition to links to papers already provided, some more specific and less specific current papers on these kind of segmentation techniques:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-21569-8_24&quot;&gt;Cousty, J., Najman, L.: Incremental Algorithm for Hierarchical Minimum Spanning Forests and Saliency of Watershed Cuts (2011)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-03613-2_6&quot;&gt;Soille, P., Grazzini, J.: Constrained Connectivity and Transition Regions (2009)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(more practical):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-38294-9_18&quot;&gt;Serna, A., Marcotegui, B.: Attribute Controlled Reconstruction and Adaptive Mathematical Morphology (2013)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6395114&quot;&gt;Merciol, F., Lefèvre, S.: Fast image and video segmentation based on alpha-tree multiscale representation (2012)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="1273" LastEditDate="2013-10-09T09:20:38.203" LastActivityDate="2013-10-09T09:20:38.203" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11038" PostTypeId="2" ParentId="9901" CreationDate="2013-10-09T11:55:19.730" Score="1" Body="&lt;p&gt;As a general rule the parts of the signal containing the largest numbers will correspond to the parts of the signal with the greatest perceived loudness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you inspect individual samples within the signal you are measuring the instantaneous peak amplitude - this is useful but not the most robust way to determine perceived loudness. A better approach is to measure the power or energy of the signal - for example by calculating the &lt;a href=&quot;http://en.wikipedia.org/wiki/RMS_power&quot; rel=&quot;nofollow&quot;&gt;RMS Power&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To demonstrate the difference consider signal with 1000 samples, in which 999 samples have a value of 0.0 and one sample has a normalised value of 1.0 - the peak amplitude of this signal is very high, whereas the power of this signal is extremely low.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-10-09T11:55:19.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11042" PostTypeId="1" AcceptedAnswerId="11050" CreationDate="2013-10-09T18:05:45.497" Score="0" ViewCount="8989" Body="&lt;p&gt;Is there a function in MatLab to scale a given signal to a specific range, like how &lt;code&gt;soundsc&lt;/code&gt; does it with the input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to signals, one is a &lt;code&gt;wave&lt;/code&gt; file, using &lt;code&gt;wavreader&lt;/code&gt; (I know one should use &lt;code&gt;audioreader&lt;/code&gt; now) to load the file, and another file that is being read using &lt;code&gt;fopen&lt;/code&gt; and &lt;code&gt;fread&lt;/code&gt;.&#xA;Now I want to compare those to signals, but the values of &lt;code&gt;wavreader&lt;/code&gt; seems to be between -1 and 0, but the other file's signal goes anywhere between -5000 and 0.&lt;/p&gt;&#xA;" OwnerUserId="5612" LastActivityDate="2013-10-09T23:22:22.307" Title="Scale signal to a given range" Tags="|matlab|signal-analysis|" AnswerCount="2" CommentCount="1" ClosedDate="2013-11-20T00:48:15.573" ContentLicense="CC BY-SA 3.0" />
  <row Id="11043" PostTypeId="2" ParentId="10909" CreationDate="2013-10-09T18:26:05.333" Score="2" Body="&lt;p&gt;This is not aliasing this is not any phenomenon, there are number of birds whose vocal fall in speech range even a frog vocal falls in speech range so essentially a training based speech detection is required to classify whether a given frame is speech or a non speech&lt;/p&gt;&#xA;&lt;p&gt;one such implementation is shown here&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/1621204&quot; rel=&quot;nofollow noreferrer&quot;&gt;Speech Discrimination based on multi-scale spectro-temporal modulations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="7092" LastEditDate="2022-06-21T12:10:45.297" LastActivityDate="2022-06-21T12:10:45.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11045" PostTypeId="1" AcceptedAnswerId="11047" CreationDate="2013-10-09T21:10:39.747" Score="4" ViewCount="2756" Body="&lt;p&gt;Image registration algorithms can be classified into intensity-based and feature-based algorithms, I want to know When and Why should i choose intensity or feature based algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another question Is there a difference between image registration and optical flow? &lt;/p&gt;&#xA;" OwnerUserId="1380" LastActivityDate="2013-10-09T22:20:51.200" Title="Image Registration and optical flow" Tags="|image-processing|image-registration|motion-detection|optical-flow|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11046" PostTypeId="2" ParentId="11042" CreationDate="2013-10-09T22:09:15.390" Score="2" Body="&lt;p&gt;Given the signal $\mathbf{x}$, you can scale the values of $\mathbf{x}$ to fall on the interval $[a,b]$ with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x_scaled = (x-min(x))*(b-a)/(max(x)-min(x)) + a;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Be aware that this is a very naive scaling, but it is the best you can do without any extra information.  When I say naive, I mean that it assumes that the scaled signal should always have a minimum value of $a$ and a maximum value of $b$.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-10-09T22:09:15.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11047" PostTypeId="2" ParentId="11045" CreationDate="2013-10-09T22:14:52.800" Score="7" Body="&lt;p&gt;Second question is easy: optical flow, more specifically dense optical flow, is an algorithm that takes two consecutive video frames and returns a vector field. For every pixel in frame 1 you get a vector showing where it moved to in frame 2.  You can also have sparse optical flow, which only computes the motion vectors for certain pixels, such as the feature-based approaches you've mentioned. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, image registration is the general problem of aligning two images.  The problem of image registration can be solved using an optical flow algorithm. However, it can also be solved by other methods, such as template matching or phase correlation. Optical flow, on the other hand, can be used to solve other problems, such as detecting and tracking moving objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first question is less clear cut, because there are situations when either approach will work. However, generally intensity-based methods are not applicable in the presence of a large scale change or a lot of motion between the frames.  Also, intensity-based methods tend to be slower.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2013-10-09T22:20:51.200" LastActivityDate="2013-10-09T22:20:51.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11048" PostTypeId="1" AcceptedAnswerId="11068" CreationDate="2013-10-09T22:21:01.997" Score="1" ViewCount="305" Body="&lt;p&gt;Suppose the input signal is represented as $$y=x+w$$ where $x$ is the signal to be estimated and $w$ is AWGN. I design a high pass filter $H$. What does $$H^{T}Hw$$ represent? Will it be just AWGN but attenuated or will it AWGN completely distorted. We can also assume that $\sigma_w = 0.2$&lt;/p&gt;&#xA;" OwnerUserId="5608" LastActivityDate="2013-10-11T11:10:09.213" Title="Highpass filter applied to noise" Tags="|filters|noise|gaussian|highpass-filter|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11049" PostTypeId="1" CreationDate="2013-10-09T22:21:54.420" Score="0" ViewCount="435" Body="&lt;p&gt;I am looking for -or trying to create- a filter with a piece-wise monotonic second derivative in such a way that when placed on a non-periodic input signal, changes in sign of the second derivative happen as soon as possible and piece-wise monotonicity of the second derivative (so also of the first derivative and the filter itself) is kept intact at all time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me explain:&#xA;I have a non-periodic, stationary signal. On this signal, I calculate a Triangular Weighted Moving Average (SWMA): the impulse response vector looks like the positive part of a sinusoid, the weights of the moving average add up to 1. It's a FIR filter, I think a low-pass filter. What I like about this filter is that its changes in sign of its second derivative (&quot;bending points&quot;) coincide roughly with the local extrema of my signal (like it's switching from &quot;convex&quot; to &quot;concave&quot;): if I would place a spline on it, the spline's stationary points would more or less coincide with these &quot;second derivative sign switching points&quot; or bending points of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to predict up/down segments using the 1st and 2nd derivative of the filter: if the SWMA was declining and the second derivative is also negative, I wait for the second derivative to turn positive and that is where my predictor turns positive for the signal, then later, when the SWMA is going up, I wait for a deceleration: for the second derivative of the SWMA to go from positive to negative: that is when my prediction turns negative for the signal. It is a causal / real-time system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This filter (SWMA) has a lag, but because its second derivative is either going up for a while, or going down for some time (=piece-wise monotonic) I can use the bending points: look at a change in the sign of the second derivative, instead of simply looking at the slope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue with my SWMA is that its second derivative is not exactly piece-wise monotonic: there's a bit of noise around turning points. Instead of filtering this second derivative with a low-pass filter, do you know any other filters that score better on this property? Or how would you construct a filter with the desired behavior?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at this image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s951E.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purple line in the upper panel is a smoothing spline, the thin gray line is my signal, and the yellow line is a sine-weighted moving average (window length 14). The red circles on the yellow line are where the momentum starts to slow: if the filter is rising, then that's where the acceleration stops and the rising starts to slow, if the filter is decreasing, the red circle is where the acceleration in the decline stops and the decrease starts to go slower. You see that these points coincide with the turning points of the smoothing spline. Now this is a hand-picked example, showing ideal behavior of what I want to achieve. In reality, the transition between an increasing momentum and a decreasing momentum section of the filter is not so abrupt: it is noisier. If you looked at a sinusoid with period 2pi, these transitions would also be very strict (at pi/4, 3pi/4, 5pi/4 and 7pi/4). Is there a causal filter that also has this property?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any feedback.&lt;/p&gt;&#xA;" OwnerUserId="735" LastEditorUserId="735" LastEditDate="2013-10-12T22:48:20.697" LastActivityDate="2013-10-12T22:48:20.697" Title="Sine-weighted moving average on non-periodic, stationary signal" Tags="|filters|filter-design|lowpass-filter|denoising|finite-impulse-response|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11050" PostTypeId="2" ParentId="11042" CreationDate="2013-10-09T23:22:22.307" Score="1" Body="&lt;p&gt;Assuming you mean the MATLAB function wavread(), use the 'native' option to specify the output format. See &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/wavread.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/matlab/ref/wavread.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That'll give the raw integers.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-09T23:22:22.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11051" PostTypeId="1" AcceptedAnswerId="11052" CreationDate="2013-10-10T07:28:23.477" Score="4" ViewCount="13946" Body="&lt;p&gt;In various software defined radios, there are three important parameters to set when receiving: frequency, bandwidth and MSPS (million samples per second?). What does it mean to receive with a triple of parameters $(freq, b, s)$ (freq-frequency, b-bandwidth, s-MSPS)? Radio listens to frequencies in $[f-b/2,f+b/2]$ range, divides this range into $s$ chunks and transmits the sampled data to the PC? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to calculate $s$ for a given $b$, to avoid aliasing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right that MSPS has nothing to do with the Nyquist theorem? &lt;/p&gt;&#xA;" OwnerUserId="5631" LastActivityDate="2013-10-10T12:32:45.790" Title="How are signal bandwidth and MSPS related?" Tags="|bandwidth|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11052" PostTypeId="2" ParentId="11051" CreationDate="2013-10-10T08:15:06.580" Score="4" Body="&lt;p&gt;&lt;strong&gt;The need for modulation:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your voice signals generally lies in the frequency range 1kHz to 4kHz and music lies in the &#xA;range 20Hz to 20Khz. Say your locality has 4-5 AM broadcast stations. Now all the AM broadcast stations cannot transmit their content as is because if all the stations transmit at the same time there will be signal interference. Also, for efficient radiation of electromagnetic energy the radiating antenna should be of the order of the wavelength of signal radiated. If the signal is 20Hz-20kHz the length of antenna has to be of the size of kilometers. So, they place the information carried by 20Hz-20kHz at higher frequencies. Every station places its their content in their own band of frequencies. Like one AM station will operate on 100Mhz with their band of operation being 100Mhz - 20Hz and 100Mhz+20Khz and the second one at 105Mhz with their band of operation being 105Mhz - 20Hz and 105Mhz+20Khz and so and so forth. The process of placing the frequency content from one spectrum on to another is called modulations. Now this information is radiated in to free space by an antenna at the station.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Receiver:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The receiver has a tuning knob, which lets you select a band of frequencies. Say, you have tuned your receiver to receive station 3 which is operating at 110 Mhz. You will select all the frequencies  in the range 110Mhz - 20Hz and 110Mhz+20Khz. The signal being present in the spectrum 110Mhz - 20Hz and 110Mhz+20Khz is brought back to 20 Hz to 20kHz using a process which reverses the operation in encoder side. This is called demodulation. This signal is ready to hear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Double-sideband_suppressed-carrier_transmission&quot; rel=&quot;nofollow&quot;&gt;For a simple modulation-demodulation read this&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if you want to post-process the signal before listening like reducing the noise, increasing bass/treble, you have to filter the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Software-Defined Radio:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a software defined radio, there will be a RF receiver which does the job of the receiver mentioned above. The message signal that was recovered is then converted to digital samples using an analog-to-digital converter. The analog to digital converter has 2 steps, 1: Sampling at rate above or equal to Nyquist and 2. Quantization. These digital samples are processed using a software on a pc/embedded system. You can apply filters on these samples. These digital/discrete samples is then converted to analog using a D/A Converter. Main step of a D/A converter is interpolation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theoretically, in an ideal system, it is sufficient to sample the signal at Nyquist rate. Before play back, an ideal low pass filter will recover the message/baseband signal with out any information loss. But such a design is not feasible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At a low sampling rate, the interpolation filter (low-pass filter) will not be able to interpolate intermediate samples effectively. However if  the sampling rate is increased you can have better reconstructed message signal. Hence at higher msps you must receive a better quality signal than at low msps. However, the quality you perceive will become negligible after certain point as your ear might not be able to negotiate the difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe lowering the msps below Nyquist can introduce cross talk. That doesn't mean that you will receive neighbor radio stations because they got clipped at the RF receiver stage. The cross talk you receive is because of frequency warping. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above description i am speculating  that sampling happens on the demodulated signal not on the modulated signal. Because demodulation can be easily achieved via an envelope detector for AM or a phase locked loop for FM. Demodulation in digital domain can be costly as sampling a high frequency signal at nyquist rate and operating at such high bandwidths can be resource consuming. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also no FM station operates at Ghz. Giga is for satellite. 100 Mhz for FM. and Khz for AM.&lt;/p&gt;&#xA;" OwnerUserId="4898" LastEditorUserId="4898" LastEditDate="2013-10-10T12:32:45.790" LastActivityDate="2013-10-10T12:32:45.790" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="11053" PostTypeId="2" ParentId="2708" CreationDate="2013-10-10T08:56:54.157" Score="1" Body="&lt;p&gt;i think the simplest way would be to &quot;predict&quot; the date for the &quot;whole&quot; in the time series using the data that came before. then you can use this timeseries for parameter estimation. (you could then proceed and repredict the missing values using your estimated parameters from the whole (completed) timeseries and repeat this until they converge).&#xA;you should derive the confidence bounds from the number of real datapoints you have, though, and not from the length of the completed dataseries.&lt;/p&gt;&#xA;" OwnerUserId="5632" LastActivityDate="2013-10-10T08:56:54.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11054" PostTypeId="2" ParentId="10676" CreationDate="2013-10-10T11:45:22.327" Score="1" Body="&lt;p&gt;The intrinsic fundamental frequency (pitch) of a speech signal do not change when the speaker moves away from the microphone (unless it moves away quite fast in which case it's a case of Doppler effect!) - it would be strange if we heard people's voice transposed up or down as they move away or as ambient noise increases!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as the distance from the microphone increases, the signal to noise ratio will increase, and this might affect the reliability of a naive pitch detector, so you might indeed get different result when estimating the f0 of a speech signal and the same signal with more noise. It doesn't mean that the f0 is different, just that the noise makes the estimate unreliable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not aware of any naive feature which allows noise-robust speech/non-speech discrimination with a simple threshold rule. I think supervised machine learning would be the way to go for your problem.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-10-10T11:45:22.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11056" PostTypeId="2" ParentId="11036" CreationDate="2013-10-10T15:59:40.523" Score="1" Body="&lt;p&gt;The essence of your problem is one of &lt;a href=&quot;http://en.wikipedia.org/wiki/Voice_activity_detection&quot; rel=&quot;nofollow&quot;&gt;Voice Activity Detection&lt;/a&gt; (VAD). This is a well researched topic and you should investigate the available algorithms - there are many papers available online, &lt;a href=&quot;http://www-stat.stanford.edu/~dlsun/papers/voice_activity_detection_full.pdf&quot; rel=&quot;nofollow&quot;&gt;here for example&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should apply a VAD algorithm to the signal and replace non-speech areas with silence, you can then look at the specific edge cases which are concerning you, such as animal sounds have being incorrectly considered speech.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the case of animal sounds you may want to investigate Formant Detection (for example &lt;a href=&quot;http://www.ai.rug.nl/~tjeerd/publications/valkenier09.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;) since as you pointed out there is a distinction between them. You may also want to consider developing a heuristic based on your own empirical data about the differences. You can take many signal features such as the fundamental frequency, the signal power/amplitude, peakedness etc... and weight these appropriately to give you a confidence rating about the likelyhood of it being animal rather than human speech. This is a fuzzy approach, you would need to iterate a lot on the weightings and metrics.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-10-10T15:59:40.523" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11058" PostTypeId="1" AcceptedAnswerId="11060" CreationDate="2013-10-10T17:54:29.477" Score="2" ViewCount="194" Body="&lt;p&gt;I want to program a microcontroller in C but I am asking about the theoretical aspect of it. I think I've got an idea what I am going to do but there is one thing I can't quite get. To begin with, I will use a guitar, so there is a 82Hz-987Hz range. So roughly, I'm going to low-pass the data on 1KHz, &quot;window&quot; them and apply FFT. Supposedly, I am going to have a good estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since highest frequency is ~1KHz, I decided my sample rate to be 2KHz (haven't tested yet if it works).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a 2 seconds track with 1 note each second. If the first note is C, my result would be 2000 C notes for the first second right? We can say that every time there is a note change, that's when you recognize a note, so if the second note is D, the program will acknowledge C, then D (and not 2000 times C and 2000 times D). The problem I see, is that if the second note is also C, how would I know that indeed there is a note hitting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I need an extra step to the process but I can't quite find what would that be. Might be that I have to go a different route though.. (if this is the case just mention the method, no need to elaborate on it and lose your time, I will read about it).&lt;/p&gt;&#xA;" OwnerUserId="5602" LastActivityDate="2013-10-11T00:07:32.907" Title="Pitch detection when successive notes are the same" Tags="|audio|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11059" PostTypeId="2" ParentId="11058" CreationDate="2013-10-10T20:32:39.030" Score="3" Body="&lt;p&gt;Usually, the envelope of a note will decay.  A new note pluck will start (add or replace) a new amplitude envelope with an attack transient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you might add envelope tracking to your spectral frequency analysis (which may or may not be appropriate for correct pitch estimation).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-10T20:32:39.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11060" PostTypeId="2" ParentId="11058" CreationDate="2013-10-11T00:07:32.907" Score="2" Body="&lt;p&gt;Hotpaw2's reply addressed the note boundary detection problem (envelope tracking is a solution, though they are more robust solutions, look for &quot;onset detection&quot;). A few more comments on your plan:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Sampling your signal at 2kHz is going to cause more problems than it is going to solve. The signal from the guitar is not a pure sine wave, so there are harmonics above 1kHz that will be aliased if not filtered properly. This would require very steep anti-aliasing filters, with a very narrow transition band.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have not explained how you intend to compute pitch, but it is very unlikely that your pitch detection method is going to yield a result for every single input sample. More likely, you'll have to find a trade-off (for example through the choice of a FFT or autocorrelation size; or a bandpass filter Q factor) between how often you get a pitch estimate, and how accurate this estimate is.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-10-11T00:07:32.907" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11062" PostTypeId="1" CreationDate="2013-10-11T03:42:34.653" Score="0" ViewCount="2669" Body="&lt;p&gt;I am making preparations to implement FFT on a wav &lt;strong&gt;File.wav&lt;/strong&gt; Only Java.&#xA;I'm reluctant to use matlab&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a File wav stereo, 16 bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to calculate the FFT, but I have confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My File has a Frequency of 44100, the samples in bytes are 10 minuts -&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(10 minuts)*(60 seconds)*(44100 sample rate)*(2 bytes because are 16 bits)&#xA;= 52920000 &amp;gt;~ 52MB per channel.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see it's a big file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt;. Question.&#xA;Can I to split my file in order to make smaller calculus?&#xA;If yes, My file can be variable, How I can calculate a moderate lenght working in function of frequency (greater frequency will need greater length FFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2&lt;/strong&gt;. Question.&#xA;According to FFT the size need to have a lenght = mantissa = Pow(2, Integer).&#xA;Can I to fill with zeros to reach Pow(2, Integer), Example I have a file with a lenght of 65000 samples, then I will need a FFT with order of 16 -&gt; mantissa = 65536, Can i to fill with zeros the others 536 samples?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5639" LastEditorUserId="5639" LastEditDate="2013-10-11T15:36:43.567" LastActivityDate="2013-10-11T16:57:12.447" Title="Preparations to implement FFT on a wav file (code Java, not Library)" Tags="|fft|sampling|java|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11064" PostTypeId="1" AcceptedAnswerId="11065" CreationDate="2013-10-11T07:40:34.143" Score="0" ViewCount="160" Body="&lt;p&gt;I am looking at working broadly in the area of Speech Signal Processing, and would be grateful if someone can clarify these doubts!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Are there any differences between Processing and Analysis of Speech Signals, in terms of the scope they provide for research? Arent both of them concerned in detecting the spoken language from signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What are the tools that one will be using in these areas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5641" LastActivityDate="2013-10-11T08:34:44.797" Title="Speech Signals - Recognition vs Analysis" Tags="|speech-recognition|speech-processing|" AnswerCount="1" CommentCount="1" ClosedDate="2013-11-14T22:05:03.320" ContentLicense="CC BY-SA 3.0" />
  <row Id="11065" PostTypeId="2" ParentId="11064" CreationDate="2013-10-11T08:34:44.797" Score="1" Body="&lt;p&gt;1) Questions of terminology like that are always debatable! I would say that the term &quot;analysis&quot; describes techniques to convert the speech signal into another representation, closer to the semantic level than a raw list of samples (such as a written transcription in the case of speech recognition, a visualization of the tone curve in the case of a system assisting Mandarin learner, the identity of the speaker in case of speaker identification system, a category of emotion in case of an emotion detection system) ; while &quot;processing&quot; describes problems in which both the input and the output are speech (speech denoising/enhancement, coding and decoding, source separation, 'creative' effects like pitch/timing modifications). Of course, there are contexts in which &quot;processing&quot; describes the whole field, analysis included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Deterministic signal processing (filtering, transforms), statistical signal processing (auto-regressive models, sinusoidal model estimation), statistical modeling and machine learning, psychoacoustics,  knowledge of how humans produce speech... If you venture into recognition: language theory (finite state machines), natural language processing, some elements of distributed computing (for large model training), data structures/algorithms. If you venture into speech coding or enhancement applications: information theory, experiment design (for subjective evaluation campaign), DSPs/embedded systems with hardware acceleration or even in some cases hardware design. Tools and language: mostly matlab or scipy for research, mostly C/C++ for implementation; and a scripting language (perl, python) is always helpful when you have to deal with texts/annotations.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-10-11T08:34:44.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11066" PostTypeId="2" ParentId="7748" CreationDate="2013-10-11T08:50:42.470" Score="6" Body="&lt;p&gt;As an addendum to &lt;a href=&quot;https://dsp.stackexchange.com/users/1273/penelope&quot;&gt;Penelope&lt;/a&gt;'s answer, two popular families (and trendy) of algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Superpixels&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very popular family of algorithms called &lt;a href=&quot;http://ttic.uchicago.edu/~xren/research/superpixel/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superpixels&lt;/a&gt; is very trendy right now (there are even some Superpixel sessions in CV conferences). Superpixels are a lot like over-segmentation (like what watershed gives you), so some post-processing is required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superpixels can be seen as &lt;em&gt;small homogeneous images regions&lt;/em&gt;. The distance between pixels is evaluated as in bilateral filtering, i.e., it is a mix between their spatial distance and their visual similarity that goes to 0 when they are close and similar and to some bigger value otherwise.&lt;br /&gt;&#xA;Then, superpixels methods try various criteria to form small homogeneous regions with respect to this measure. There is many of them (graph-based, mode seeking / clustering based...), so I guess it's best to refer you to &lt;a href=&quot;http://infoscience.epfl.ch/record/149300/files/SLIC_Superpixels_TR_2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tech report&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(edit:)&lt;/em&gt; In case somebody is looking for a published peer-reviewed work, this article is by the same authors and covers the same material as the tech report:&#xA;&lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=6205760&quot; rel=&quot;nofollow noreferrer&quot;&gt;R. Achanta, A. Shaji, K. Smith, A. Lucchi, P. Fua, S. Susstrunk: &lt;em&gt;SLIC Superpixels Compared to State-of-the-Art Superpixel Methods&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note as I wrote the first version of the answer that visually the results is very similar to what watershed over-segmentation provides you. This is confirmed by the authors of the tech report who include watersheds in the related work part. Thus, you also need to do the same post-processing: while superpixels can be handy features to use instead of pixels, they still need to be grouped in order to form higher-level regions if you need to track / detect objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Graph based segmentation methods&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another popular family of algorithms comes from the analysis of pixel relationship, i.e., how pixels are close in their appearance. This yields a graph-theory based family of segmentation methods such as the &lt;a href=&quot;http://www.cs.berkeley.edu/~malik/papers/SM-ncut.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;normalized cut (J. Shi, J. Malik: &lt;em&gt;Normalized Cuts and Image Segmentation&lt;/em&gt;)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the intuition for this approach: suppose your pixels are now points (vertices) of an high-dimensional graph. &lt;br /&gt;&#xA;In the graph, two vertices can be connected by an &lt;em&gt;edge&lt;/em&gt;, whose &lt;em&gt;weight&lt;/em&gt; is inversely proportional to some distance between the vertices. Typically, the weight function will be some reciprocal of a mix between their spatial distance and their visual similarity 8as in bilateral filtering). &lt;br /&gt;&#xA;Then, given this graph, segmentation algorithms can look for the best clusters of vertices, i.e., groups of vertices that have a small &lt;em&gt;intra-group&lt;/em&gt; distance and a large &lt;em&gt;extra-group&lt;/em&gt; distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Normalized Cut approach, some additional care is taken in order to avoid any bias introduced by the different population sizes of the clusters. Furthermore, graph exploration can be avoided by computing the SVD of the weights matrix, also known as &lt;em&gt;connectivity matrix&lt;/em&gt; in graph theory.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-01-13T16:39:14.437" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11068" PostTypeId="2" ParentId="11048" CreationDate="2013-10-11T11:10:09.213" Score="1" Body="&lt;p&gt;The formula represents noise component of the output signal. AWGN stands for additive white gaussian noise, than after passing through the filter the noise will still be additive and gaussian but NOT white.&lt;/p&gt;&#xA;" OwnerUserId="5643" LastActivityDate="2013-10-11T11:10:09.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11069" PostTypeId="1" AcceptedAnswerId="11080" CreationDate="2013-10-11T11:11:47.720" Score="4" ViewCount="1833" Body="&lt;p&gt;I am reading about different integral transforms. Fourier transform being a subject I will soon take a class on. Looking at the wavelet transform there is one term that I do not understand, that is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Noiselet&quot; rel=&quot;nofollow&quot;&gt;noiselet&lt;/a&gt;. What would a noiselet look like and how is it defined? Is it some basis of the wavelet transform? It is hard to find information about this subject. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5273" LastEditorUserId="5273" LastEditDate="2013-10-11T13:50:13.917" LastActivityDate="2013-10-12T18:31:59.253" Title="What is the definition of a noiselet?" Tags="|wavelet|transform|reference-request|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11070" PostTypeId="1" AcceptedAnswerId="11123" CreationDate="2013-10-11T11:24:59.733" Score="5" ViewCount="7691" Body="&lt;p&gt;What is the minimum period P (in samples) of the signal &lt;span class=&quot;math-container&quot;&gt;$e^{j(\frac{M}{N} )*2πn}$&lt;/span&gt; for the following values of M and N?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;M=1,N=3&lt;/p&gt;&#xA;&lt;p&gt;M=5,N=7&lt;/p&gt;&#xA;&lt;p&gt;M=35,N=15&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I have got the answer for the first pair of values, which is 3. But I could not get the other two correct. Please help.&lt;/p&gt;&#xA;" OwnerUserId="7676" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2018-04-15T19:42:11.007" Title="Minimum period of a signal" Tags="|sampling|homework|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11072" PostTypeId="2" ParentId="11062" CreationDate="2013-10-11T16:57:12.447" Score="2" Body="&lt;p&gt;Simply taking the Fourier transform of a ten minute signal is unlikely to provide you with any useful information - I suspect what is actually of interest to you is the spectral information at intervals throughout the signal, e.g. 600 frequency plots at 1 second intervals, which if you so desire can be combined into a spectographic image for analysis. This can be achieved by performing multiple windowed Short Time Fourier Transforms (STFT) and storing the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can I to split my file in order to make smaller [calculations]?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, it is up to you what granularity of frequency information you wish to obtain. Small FFT lengths will afford you a better time resolution, longer FFT lengths will afford you a better frequency resolution. For purely visualisation purposes an FFT length of 1024 is generally sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can I to fill with zeros to reach Pow(2, Integer) [for my FFT length]?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, if you do not have sufficient samples to reach a power of two length for your FFT then you should zero pad the input. This will introduce the minimal amount of spectral error into your frequency domain results.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-10-11T16:57:12.447" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11073" PostTypeId="1" CreationDate="2013-10-12T06:10:41.970" Score="3" ViewCount="4732" Body="&lt;p&gt;In a soundfile, I'd like to &lt;strong&gt;remove a frequency and all its harmonics&lt;/strong&gt;. What is the best solution in your opinion ?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Do a loop with 20 notch filters, one after another. &lt;pre&gt;&#xA;// f is the fundamental frequency&#xA;for (i=0; i++; i&amp;lt;21)&#xA;{&#xA;file.notchfilter(f*i);&#xA;}&#xA;&lt;/pre&gt;&#xA;Question : does each notch filter create some &lt;strong&gt;unwanted side-effects&lt;/strong&gt;, and the fact that we use 20 filters one after another will create very high unwanted artefacts?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible to design a filter that will remove 20 frequencies in ONE STEP ?&#xA;Then we wouldn't need to do a loop, just one pass wil be okay?&#xA;Is it called a &lt;a href=&quot;http://en.wikipedia.org/wiki/Comb_filter&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Comb&lt;/em&gt; filter&lt;/a&gt; ? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Other method ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="1629" LastEditDate="2016-05-16T13:19:19.207" LastActivityDate="2017-05-07T00:20:41.967" Title="Remove a frequency and all its multiple (harmonics)" Tags="|filters|audio|frequency-spectrum|frequency|equalization|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11074" PostTypeId="1" AcceptedAnswerId="11082" CreationDate="2013-10-12T12:30:16.583" Score="0" ViewCount="2161" Body="&lt;p&gt;I was reading &lt;a href=&quot;http://www.cs.toronto.edu/~hinton/absps/esann-deep-final.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; paper for a project work.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We train on 1.6 million 32*32 color images that have been preprocessed&#xA;  by subtracting from each pixel its mean value over all images and then&#xA;  dividing by the standard deviation of all pixels over all images.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've trouble distinguishing between &quot;from each pixel its mean value over all images&quot; and &quot;standard deviation of all pixels over all images&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since, I'm dealing with color images, can I just take rgb values of each pixel as one value or should I calculate the mean and SD for every color differently?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if I have r=255, g=255, b=255, can I take pixel value as (in binary), (r&amp;lt;&amp;lt;16)+(g&amp;lt;&amp;lt;8)+b ?&lt;/p&gt;&#xA;" OwnerUserId="5653" LastEditorUserId="5653" LastEditDate="2013-10-12T12:35:16.733" LastActivityDate="2013-10-14T17:56:38.263" Title="Should I consider rgb values of a pixel as one value?" Tags="|image-processing|preprocessing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11075" PostTypeId="2" ParentId="11074" CreationDate="2013-10-12T13:23:44.773" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;For example if I have r=255, g=255, b=255, can I take pixel value as (in binary), (r&amp;lt;&amp;lt;16)+(g&amp;lt;&amp;lt;8)+b ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While this number would identify the colour, it would not help with a mean or standard deviation. e.g. pure blue would be 255 but pure red would be 16711680&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper is unclear so you have a few choices:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Process each channel individually&lt;/li&gt;&#xA;&lt;li&gt;Convert the image to grayscale, find the mean and std dev, and use this for each channel.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There may be other methods that use different colour spaces.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-10-12T13:23:44.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11077" PostTypeId="1" AcceptedAnswerId="11099" CreationDate="2013-10-12T16:08:28.717" Score="2" ViewCount="243" Body="&lt;p&gt;I have got this question: let's suppose that I have three signals, representative of the same variable, but taken on three different component of a same device; in my case, three load signals, representative of the out-of-plane bending moment Mx of each of the blade of a wind turbine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it any possible to effectively and efficiently detect the degree of &lt;strong&gt;imbalance&lt;/strong&gt; or &lt;strong&gt;asymmetry&lt;/strong&gt; of such signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;asymmetry&lt;/code&gt; and &lt;code&gt;imbalance&lt;/code&gt; I mean a single parameter/variable which gives information about how the three signals differ from each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would then set-up a threshold value to this degree of difference, in order to further trigger a certain process when the threshold has been overcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first idea I came up with is &lt;strong&gt;multiple correlation&lt;/strong&gt;, but perhaps there exist tons of better methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Each signal coming from each blade;&lt;/li&gt;&#xA;&lt;li&gt;Blades placed with 120 deg phase shift;&lt;/li&gt;&#xA;&lt;li&gt;Azimuth angle vs. Time available. &lt;/li&gt;&#xA;&lt;li&gt;Regarding balance vs. unbalanced, I only know that unbalanced condition leads to higher loads on blades. In general, the three signals will always be unbalanced: what I would like to ascertain is the degree of imbalance; is it over a defined allowed limit or not?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3666" LastEditorUserId="3666" LastEditDate="2013-10-13T16:35:31.103" LastActivityDate="2013-10-14T14:58:33.043" Title="Detect signals degree of imbalance" Tags="|discrete-signals|signal-analysis|signal-detection|continuous-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11078" PostTypeId="1" CreationDate="2013-10-12T17:18:35.437" Score="5" ViewCount="4364" Body="&lt;p&gt;I have the following inverse system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(s)= s^2 + 2s + 3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I implement it in Simulink? Note that the transfer function is only accepted if and only if the order of the numerator is less than the order of denominator.&lt;/p&gt;&#xA;" OwnerUserId="5554" LastEditorUserId="21075" LastEditDate="2018-01-16T13:00:58.040" LastActivityDate="2018-09-13T20:00:32.120" Title="Inverse system in Simulink" Tags="|matlab|transfer-function|control-systems|simulink|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11080" PostTypeId="2" ParentId="11069" CreationDate="2013-10-12T17:54:46.760" Score="3" Body="&lt;p&gt;The wavelet transform has the desired property of presenting most images as a sparse signal where most of the signal energy is concentrated in few coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A noiselet is structured to take such sparse representation and generate a noise-like signal from it. The coefficients resulting from the noiselet transform are spread out to almost equal magnitudes across the whole signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are they useful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;noiselets are are highly 'incoherent' with the signal representation in the wavelets domain. This means that noiselets can be used as a sensing matrix to recover sparse signals with high probability of success. Section 2.2 in this &lt;a href=&quot;http://www-stat.stanford.edu/~candes/papers/PartialMeasurements.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; provides some mathematical details and an image recovery application.   &lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-10-12T18:31:59.253" LastActivityDate="2013-10-12T18:31:59.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11081" PostTypeId="2" ParentId="11078" CreationDate="2013-10-12T22:20:02.123" Score="1" Body="&lt;p&gt;You will have to implement the transfer function in pieces, rather than as a single LTI block.  See &lt;a href=&quot;http://www.mathworks.com/support/solutions/en/data/1-VPJDU&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/support/solutions/en/data/1-VPJDU&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-10-12T22:20:02.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11082" PostTypeId="2" ParentId="11074" CreationDate="2013-10-13T00:02:28.997" Score="2" Body="&lt;p&gt;I believe that you will want to process each channel separately over all of the images.  Otherwise a mean and variance will have very little meaning.  And if you convert to grayscale before training, then the network can only retrieve grayscale images, which doesn't seem to match with what the paper describes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I've trouble distinguishing between &quot;from each pixel its mean value over all images&quot; and &quot;standard deviation of all pixels over all images&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This processing will requires two passes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On The first pass, you will compute the mean pixel values of each channel, and the variance over the entire set of pixels in a channel.  When you are finished, you should have 3075 values: one mean value per pixel per channel (32*32*3=3072), and one variance per channel (3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the second pass you will modify the images by taking the subtracting from each pixel the mean you found in the first pass, and dividing by the standard deviation from the first pass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\mu_r,i,j$ be the mean value of the red channel at the $i,j$-th pixel, and let $\sigma_r^2$ be the variance of the red channel over all pixels in all images. Then the new value corresponding to the red channel of the $i,j$-th  pixel in the $k$-th image $r_{i,j,k}$ becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tilde{r}_{i,j,k} = \left(r_{i,j,k} - \mu_{r,i,j}\right)/\sqrt{\sigma_r^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mu_{r,i,j} = \frac{1}{K}\sum_k r_{i,j,k}$$&#xA;$$\sigma_r^2 = \frac{1}{IJK-1}\sum_{i,j,k} r_{i,j,k}^2 - \frac{1}{IJK-1}\sum_{i,j,k} r_{i,j,k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my interpretation of the paper.  However, since the focus of the paper is on autoencoders and deep belief networks, the image preprocessing step is only mentioned in passing. Like most academic papers, it gives enough details for the reader to understand what was done without necessarily giving enough details to reproduce the result without lots of reading between the lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck to you!&lt;/p&gt;&#xA;" OwnerUserId="5156" LastEditorUserId="5156" LastEditDate="2013-10-14T17:56:38.263" LastActivityDate="2013-10-14T17:56:38.263" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11083" PostTypeId="1" CreationDate="2013-10-13T06:20:17.007" Score="0" ViewCount="2366" Body="&lt;p&gt;I do not seem to know how to extract from a Matlab plot. For example in the plot given below, I have a simulated $P_b$ for Rayleigh fading and theoretical AWGN channel Pb plot against SNR ($\large \frac{E_b}{N_o}$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how do I get the value of $\large \frac{E_b}{N_o}$ for a particular value of $P_b$. For example, if I want the read the $\large \frac{E_b}{N_o}$ from the graph to get a probability bit error for the Rayleigh channel, what code can I use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lPmME.jpg&quot; alt=&quot;Rayleigh fading &quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5507" LastEditorUserId="76" LastEditDate="2013-10-13T09:32:38.950" LastActivityDate="2013-10-14T14:24:20.030" Title="Extracting data from matlab graph" Tags="|matlab|" AnswerCount="1" CommentCount="4" ClosedDate="2013-11-17T18:52:03.677" ContentLicense="CC BY-SA 3.0" />
  <row Id="11084" PostTypeId="1" AcceptedAnswerId="11122" CreationDate="2013-10-13T17:03:12.397" Score="0" ViewCount="1051" Body="&lt;p&gt;I am trying to recreate the following results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/muMxX.jpg&quot; alt=&quot;Spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...from the following data: &lt;a href=&quot;https://www.dropbox.com/s/mi3szqgzgku29rn/FS40.dat&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dropbox Link (FS40.dat)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The time is in milliseconds (frequency is 40000 Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article state that they used Complex Morlet wavelet to create the spectrogram:&#xA;&quot;Power estimates from the averaged LFPs were calculated from&#xA;time–frequency spectrograms of the data from 1–88 Hz by convolving the signals with a complex Morlet wavelet of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;w(t,f_{0})=Ae^{(\frac{-t^2}{2\omega^2})}e^{(2i{\pi}f_{0}t)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for each frequency of interest $f_{0}$, where $\omega=\frac{m}{2{\pi}f_{0}}$, and $i$ is the imaginary unit. The normalization factor was $A=\frac{1}{\omega(2{\pi})^0.5}$, and the constant $m$ defining the compromise between time and frequency resolution was 7.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only managed to get some &quot;good&quot; results using spectrogram function in matlab.&#xA;But I dont have much idea of how to use the morlet complex wavelet.&#xA;I got bad result when trying to use &lt;a href=&quot;http://www.mathworks.com/help/wavelet/gs/continuous-wavelet-transform.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;cwt&lt;/a&gt; with 'morl' window&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to recreate this article:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computational modeling of distinct neocortical oscillations driven by cell-type selective optogenetic drive: separable resonant circuits controlled by low-threshold spiking and fast-spiking interneurons.&lt;/p&gt;&#xA;" OwnerUserId="5656" LastEditorUserId="3546" LastEditDate="2013-11-05T23:50:41.610" LastActivityDate="2013-11-05T23:50:41.610" Title="Spectrogram from Complex Morlet wavelet ( recreating article result from data)" Tags="|matlab|wavelet|spectrogram|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11085" PostTypeId="1" CreationDate="2013-10-13T18:11:28.920" Score="2" ViewCount="427" Body="&lt;p&gt;I am learning Fourier analysis and without any teacher, just trying to read books on my own. I think I have made some decent progress but they are a couple of points which are still very unclear to me and that I can't find explained in any of the books I have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the sources that I found in &lt;a href=&quot;http://www.analog.com/static/imported-files/tech_docs/dsp_book_Ch8.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this document&lt;/a&gt;, which is great because it teaches DFT without really using complex numbers. I shall say that I understand complex numbers and I am aware of Euler's Formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what they say in this PDF/document is that in fact, in the simple case you can create a DFT by just using $N/2$ coefficients. I thought the choice of $N/2$ was related to the Nyquist frequency. If the signal contains $N$ samples then the Nyquist sampling theorem says that the signal can't contain a wave whose frequency is higher than half of the sampling frequency (hence the $N/2$ harmonics in the DFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to me, explained that way everything made a lot of sense and in the simplest case you just needed to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align} &#xA;a[k] &amp;amp;= \sum_{x = 0}^{N-1} s[x] \cos\left(2 \pi k {1 \over N } x\right), \quad \text{ for } k = \left\{ 1, 2, ..., \frac N2\right\},\\&#xA;b[k] &amp;amp;= \sum_{x = 0}^{N-1} s[x] \sin\left(2 \pi k {1 \over N } x\right), \quad \text{ for } k = \left\{ 1, 2, ..., \frac N2\right\}.&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this seemed simple. Now it says that when $k = 0$ and when $k = N/2$ then we need to divide $a$ and $b$ by $N$ or multiply them by $2/N$ otherwise. I understand why when $k = 0$, because it's the DC offset, but didn't really understand why you had to do the same thing when $k = N/2$ until I read &lt;a href=&quot;https://dsp.stackexchange.com/questions/4825/why-is-the-fft-mirrored&quot;&gt;this post&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;QUESTION 1: It seems to indicate that when you use the exponential form of the DFT then when $k = N/2$ then you have $\exp(\pi)$ which is equal to 1. Then it seems that in that situation the coefficient $a[N/2]$ has a particular meaning by I don't know which one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this is where I am lost. In the &quot;complete&quot; equation for the DFT you don't compute $N/2$ coefficients by $N$ coefficients. That means that has soon as $k &amp;gt; N/2$ then the frequency of the harmonics is greater than the Nyquist frequency. I have illustrated this with the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SvPcC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have $N=8$ samples, thus the fundamental frequency is $\frac 18$ and we have harmonics: $1\cdot \frac 18, \ 2\cdot \frac 18, \ 3\cdot \frac 18, \ 4\cdot \frac 18$. However as soon as go above that then the harmonics go beyond the Nyquist frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;QUESTION 2: why do we test the signal with harmonics whose frequency go beyond the Nyquist frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, and I think this is actually related to question 2, I keep reading about positive and negative frequencies, but I just can make sense of this at all? This is my question 3.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;QUESTION 3: could you please briefly explained if that's possible why we do speak and need positive and negative frequencies? Why do we need to care for negative frequencies?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5657" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2022-07-13T08:03:45.337" Title="General question about DFT" Tags="|discrete-signals|fourier-transform|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11086" PostTypeId="1" CreationDate="2013-10-13T18:35:05.197" Score="0" ViewCount="217" Body="&lt;p&gt;Is it possible to detect if a sample of human voice by smartphone/computer(&lt;code&gt;44Khz&lt;/code&gt;) is sourced from another electrical device or originated  from a human being&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to build a model in matlab such that, samples a vocal signal and decides whether it is a real human being talks a live or recorded, is it even possible?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2013-10-14T20:56:50.983" LastActivityDate="2013-10-14T20:56:50.983" Title="How to distinguish between recorded and a live vocal signals?" Tags="|matlab|signal-analysis|voice|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11087" PostTypeId="1" CreationDate="2013-10-13T18:42:51.313" Score="3" ViewCount="4189" Body="&lt;p&gt;I need some information about Stockwell transform (also known as the S-transform):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can I implement it in MATLAB?&lt;/li&gt;&#xA;&lt;li&gt;*Does it give you the damping ratio $\zeta$ of a signal like the complex Morlet continuous wavelet? $$x(t)= e^{-\omega_{n}\zeta}\sin(\omega_{d}t+\theta )$$&lt;/li&gt;&#xA;&lt;li&gt;What are its advantages compared to CWT?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The S-transform defined as follows: &#xA;$$s( \tau ,f)= \int_{-\infty}^\infty h(t) \frac{\ |f|}{\ \sqrt{2 \pi } } e^{ \frac{-(t- \tau )^{2} f^{2}}{2}  }    e^{-j 2 \pi f} dt$$ (&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;ved=0CDUQFjAB&amp;amp;url=http://djj.ee.ntu.edu.tw/S%2520transform.pdf&amp;amp;ei=v-haUuK4J4GEiQLe3YDACw&amp;amp;usg=AFQjCNF60y8azpGczbv1QCDlCmUbriItkg&amp;amp;sig2=aEtFHmLdVPZSFBY-I4BPVA&amp;amp;bvm=bv.53899372,d.cGE&quot; rel=&quot;nofollow&quot;&gt;This is a good tutorial about the S-Transform&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the first few question that I can think about at the moment. It seems no one asked about the S-transform before, so put your questions in this post by editing it, and answer them if you know them. Someone with enough reputation put a tag for S-transform please. Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="8202" LastEditDate="2015-01-21T19:05:05.923" LastActivityDate="2022-07-12T12:48:05.727" Title="infomation about Stockwell Transform" Tags="|signal-analysis|frequency-spectrum|wavelet|s-transform|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11088" PostTypeId="2" ParentId="11085" CreationDate="2013-10-13T21:27:29.273" Score="-1" Body="&lt;p&gt;The need for all these coefficients may not be obvious if you are looking at only real number input to the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But a complex vector input of length N will have twice the degrees of freedom compared to a strictly real input of that length.  The DFT, as an invertible linear transform therefore must therefore retain that same number of degrees of freedom, which for complex input ends up in the relationship between the positive and &quot;negative&quot; frequencies, or upper half of the transform, to produce complex exponential frequency results, instead of just strictly real cosine and sine functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For strictly real valued input, you don't really need to &quot;care&quot; about the other half, as it is duplicated information in the form of a complex conjugate (where the imaginary components of positive and &quot;negative&quot; frequency bins all cancel out to zero).  Thus the &quot;mirroring&quot; reduces the number of degrees of freedom to match that of the strictly real-valued input.  But one might still use the other half for computational purposes, as it makes the matrix math more regular and symmetric, and thus optimizable in the form of some FFT algorithms.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus the negative frequency coefficients don't need to be computed because they are redundant (unless the input is complex and not strictly real valued). In that case, the frequency coefficients above N/2 don't need to be computed because they are identical to the negative coefficients that don't need to be computed&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-10-13T23:24:35.213" LastActivityDate="2013-10-13T23:24:35.213" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11089" PostTypeId="2" ParentId="11086" CreationDate="2013-10-13T23:21:10.883" Score="1" Body="&lt;p&gt;On a smartphone, flat out no. The microphones are so poor that you're lucky to get any approximation of the actual audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On high-quality hardware, perhaps. Barely. If you're lucky. Check for MP3 compression artifacts. If the source is not compressed with a lossy codec, you're out of luck.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2013-10-13T23:21:10.883" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="11091" PostTypeId="2" ParentId="8137" CreationDate="2013-10-14T00:33:05.620" Score="1" Body="&lt;p&gt;The masked area hidden by leaves is very large and while the border and shading seems to imply what is hidden to a human being it is unsuited to &quot;inpainting&quot; which relies on pretty consistent boundary, such as where a foreground object temporarily obscures something continuing behind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The branch orientation is a start but not enough data on its own to imply how the twigs extend without having some external concept of an oak tree versus a willow, poplar or pine.  That is more about 3d fractal modeling than about image restoration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The least obviously visible algorithms for in-painting involve texture synthesis called &quot;Healing&quot; in Photoshop.  &lt;strong&gt;G'MIC&lt;/strong&gt; and &lt;strong&gt;Resynth&lt;/strong&gt; are popular open-source tools for that available as plug-ins for GIMP.  While visual continuity is quite good they have no concept of a tree or depth, just 2-d patch statistics so would need input from an artist as well in the example given.  The mask is white background on the outer edges and thick branches on the inside .. so texture interpolation gives a weird unnatural result.&lt;/p&gt;&#xA;" OwnerUserId="5659" LastActivityDate="2013-10-14T00:33:05.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11092" PostTypeId="1" AcceptedAnswerId="17429" CreationDate="2013-10-14T05:52:00.960" Score="1" ViewCount="3633" Body="&lt;p&gt;How to find bandwidth of a composite signal that can be decomposed into five sine waves with given frequencies and having all peak amplitudes same ?&lt;/p&gt;&#xA;" OwnerUserId="5661" LastActivityDate="2014-07-22T12:50:24.303" Title="Bandwidth of a composite signal" Tags="|bandwidth|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11093" PostTypeId="2" ParentId="10994" CreationDate="2013-10-14T06:54:03.100" Score="1" Body="&lt;p&gt;The nth entry in the u vector corresponds to the value of the desired correlation peak of the nth training image. Typically you set u to be all ones if you have only images from the positive class. Entries corresponding to negative class example images are typically set to zero.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-10-14T06:54:03.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11094" PostTypeId="2" ParentId="9094" CreationDate="2013-10-14T07:02:30.777" Score="1" Body="&lt;p&gt;Sometimes it is more useful to have a filter with a small tiny spike in the middle like you said. One such filter is called the MACE filter. This is the original paper&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Mahalanobis, A., Kumar, B.V.K.V., Casasent, D.: Minimum average correlation energy ﬁlters. Appl. Opt. 26, 3630–3633 (1987) &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-10-14T07:02:30.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11095" PostTypeId="1" CreationDate="2013-10-14T10:21:56.457" Score="0" ViewCount="2032" Body="&lt;p&gt;I am involved in designing a 10th order high pass filter with cutoff frequency 300Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My hardware AIC3204 has a 5 biquads of direct form I, 24bit coefficient&#xA;so I have chosen the FDA (filter design and anylysis) tool of MATLAB to design a 10th order filter and convert it to SOS sections 5 such and realize coefficients from it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my procedure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CCQKJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and realization of direct form I&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PBvW9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Coefficients obtained as a file:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%&#xA;% Generated by MATLAB(R) 7.12 and the Signal Processing Toolbox 6.15.&#xA;%&#xA;% Generated on: 05-Aug-2013 15:26:23&#xA;%&#xA;&#xA;% Coefficient Format: Hexadecimal&#xA;&#xA;% Discrete-Time IIR Filter (real) &#xA;% ------------------------------- &#xA;% Filter Structure : Direct-Form I, Second-Order Sections&#xA;% Number of Sections : 5 &#xA;% Stable : Yes &#xA;% Linear Phase : No &#xA;% Arithmetic : fixed &#xA;% Numerator : s24,22 -&amp;gt; [-2 2) &#xA;% Denominator : s24,22 -&amp;gt; [-2 2) &#xA;% Scale Values : s24,23 -&amp;gt; [-1 1) &#xA;% Input : s16,15 -&amp;gt; [-1 1) &#xA;% Output : s16,11 -&amp;gt; [-16 16) &#xA;% Numerator State : s16,15 -&amp;gt; [-1 1) &#xA;% Denominator State : s16,15 -&amp;gt; [-1 1) &#xA;% Numerator Prod : s40,37 -&amp;gt; [-4 4) &#xA;% Denominator Prod : s40,37 -&amp;gt; [-4 4) &#xA;% Numerator Accum : s40,35 -&amp;gt; [-16 16) &#xA;% Denominator Accum : s40,35 -&amp;gt; [-16 16) &#xA;% Round Mode : convergent &#xA;% Overflow Mode : wrap &#xA;% Cast Before Sum : true&#xA;&#xA;&#xA;SOS matrix: &#xA;400000 000000 c00000 400000 7ab444 3b9018 &#xA;400000 000000 c00000 400000 8bd4b8 377a90 &#xA;400000 000000 c00000 400000 7404d3 34d7f8 &#xA;400000 000000 c00000 400000 976d93 2b9955 &#xA;400000 000000 c00000 400000 067eae d364fd &#xA;&#xA;Scale Values: &#xA;77c3b6 &#xA;77c3b6 &#xA;6f5fe0 &#xA;6f5fe0 &#xA;6c9b03&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is my approach correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can these higher order SOS filters be realised?&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="76" LastEditDate="2013-10-15T12:40:45.230" LastActivityDate="2013-10-15T12:40:45.230" Title="Design of 10th order high pass filter using 2nd order biquads with Matlab and further substitution on to TI AIC3204" Tags="|filter-design|infinite-impulse-response|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11096" PostTypeId="1" CreationDate="2013-10-14T12:04:37.410" Score="1" ViewCount="469" Body="&lt;p&gt;I have a signal. I applied Gaussian smoothing to it and then for baseline reduction I appied Tophat filter to the smoothed version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the original signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PoduB.png&quot; alt=&quot;Original&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the final signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hf2Ka.png&quot; alt=&quot;New&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read that KL Divergence helps in finding the information loss between two signals but then again a condition was that the elements of the two distributions must be 1 i.e. There are two distributions P &amp;amp; Q then &lt;code&gt;Pi + Qi = 1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there any other way by which I can do that ?&lt;/p&gt;&#xA;" OwnerUserId="4271" LastActivityDate="2013-10-14T16:28:49.347" Title="Calculating information loss in a signal after smoothing?" Tags="|discrete-signals|smoothing|gaussian|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11097" PostTypeId="2" ParentId="11095" CreationDate="2013-10-14T13:59:46.980" Score="1" Body="&lt;p&gt;Your basic approach seems correct so far.&#xA;To implement your 2nd order filters you have to cascade the biquad filters, so that the output of the first feeds into the input of the next and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is due to the theorem that the overall transfer function $H(z)$ of $n$ cascaded subsystems is the multiplication of the transfer functions of the respective subsystems $H_i(z)$ like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = H_1(z) \cdot H_2(z) \cdot \,\, ... \, \cdot H_n(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what Matlab gives you, are the coefficients $a_j$ and $b_j$ for the biquad filter transfer functions (called SOS matrix in your result):&#xA;$$ H_{biquad}(z) = \frac{b_0 + b_1z^{-1} + b_2 z^{-2}}{1 + a_1z^{-1} + a_2 z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement it you should use the Direct Form I in time domain - its just the inverse Z-transform of the transfer function above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = b_0 x[n] + b_1 x[n-1] + b_2x[n-2] - a_1y[n-1]-a_2y[n-2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you just have to cascade the filters, so that the output $y[n]$ of the first feeds into the input $x[n]$ of the next biquad and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to check a similar question asked here: &lt;a href=&quot;https://dsp.stackexchange.com/q/199/5545&quot;&gt;How does cascading biquad sections for higher order filters work?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also the documentation of the Matlab biquad filter where it tells you how the SOSMatrix and ScaleValues are defined:&#xA;&lt;a href=&quot;http://www.mathworks.de/de/help/dsp/ref/dsp.biquadfilterclass.html&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Matlab Biquad Documentation&quot;&gt;Matlab Biquad Documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5545" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2013-10-14T13:59:46.980" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11098" PostTypeId="2" ParentId="11083" CreationDate="2013-10-14T14:24:20.030" Score="2" Body="&lt;p&gt;The data that is used to create the curves in the plot are stored in the axes object of the figure that contains the plot. You can obtain the underlying data by retrieving the axes' &lt;code&gt;xdata&lt;/code&gt; and &lt;code&gt;ydata&lt;/code&gt; properties. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;h_axes = gca;&#xA;x_data = get(h_axes, 'xdata');&#xA;y_data = get(h_axes, 'ydata');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After extracting the data you can use interpolation (see e.g. &lt;code&gt;interp1()&lt;/code&gt;)to find the value that you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this what you meant? If not, please let me know and I'll try to explain better...&lt;/p&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2013-10-14T14:24:20.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11099" PostTypeId="2" ParentId="11077" CreationDate="2013-10-14T14:58:33.043" Score="2" Body="&lt;p&gt;One thing that can be useful in condition monitoring of rotating machines when rotation angle is important is to look at using &lt;a href=&quot;http://en.wikipedia.org/wiki/Directional_statistics&quot; rel=&quot;nofollow&quot;&gt;circular or directional statistics&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose your measurements are:&#xA;$$&#xA;m_1(n), m_2(n), m_3(n)&#xA;$$&#xA;for the three moments $m_i(n)$ for $i=1,2,3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the instantaneous directional mean of the moments:&#xA;$$&#xA;m_{\rm tot}(n) = \left ( m_1(n) + m_2(n) e^{j2\pi/3} + m_3(n) e^{j4\pi/3} \right)\\&#xA;\bar{\phi}(n) = \arg \left(  m_{\rm tot}(n) \right)&#xA;$$&#xA;assuming that the first blade is your reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This direction, $\bar{\phi}$, is the direction of the average moment.  If it's always aligned (or &quot;anti-aligned&quot;) with one particular blade of your turbine, then that can indicate your &quot;problem blade&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the magnitude &#xA;$$&#xA;\left| m_{\rm tot} \right|&#xA;$$&#xA;as a measure of how &quot;out of balance&quot; the turbine is, as this should be (close to) zero most of the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the azimuth angle, $\theta$, then you can get fancier. It may be that you need to angle-align (rather than time-align) your measurements to pick the faulty blade.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-10-14T14:58:33.043" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11100" PostTypeId="1" AcceptedAnswerId="11112" CreationDate="2013-10-14T15:09:15.040" Score="1" ViewCount="94" Body="&lt;p&gt;Reading up on causality, I understand the mathematical definition, in so far as that a causal system, is one where the output depends only on the current time, and possibly the past time, but never the future times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also seen that we can 'make a (transfer) system causal' by 'shifting it in time by an appropriate amount'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not necessarily understand the above statement, and would like to see a simple example of two of such a thing happening. (That is, plot it when its non-causal, and re-plot it when it is causal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I have a length $N$ impulse response, stored in a vector on my machine, how does it 'know' that this is causal or non-causal? It seems as though the time-axis would always start at $n=0$, where the first point in my vector is. &lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2013-10-15T15:05:44.477" Title="Is any time-domain vector stored on a digital machine always intrinsically causal?" Tags="|filters|frequency-spectrum|transfer-function|" AnswerCount="1" CommentCount="6" ClosedDate="2013-11-14T22:04:40.413" ContentLicense="CC BY-SA 3.0" />
  <row Id="11101" PostTypeId="1" AcceptedAnswerId="11105" CreationDate="2013-10-14T15:38:25.677" Score="0" ViewCount="1165" Body="&lt;p&gt;I need to explore the algorithm of the digital guitar tuner or the digital guitar effects algorithms.&#xA;Is there any Book or articles that you recommend of?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I know is that relate to DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="5665" LastActivityDate="2013-10-14T16:46:46.553" Title="Guitar Tuner or Guitar effects Algorithms?" Tags="|fft|algorithms|digital|" AnswerCount="1" CommentCount="4" ClosedDate="2013-11-17T19:00:38.910" ContentLicense="CC BY-SA 3.0" />
  <row Id="11102" PostTypeId="2" ParentId="11096" CreationDate="2013-10-14T16:13:48.090" Score="3" Body="&lt;p&gt;For measuring the difference between a signal and an estimation/modification of that signal I usually just take the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mean_square_error&quot; rel=&quot;nofollow&quot;&gt;Mean Square Error&lt;/a&gt; or Root Mean Square Error. It is simple to calculate and provides a single metric to describe how far your signal deviates (or technically, variates) from the original.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-10-14T16:13:48.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11103" PostTypeId="1" CreationDate="2013-10-14T16:22:30.030" Score="0" ViewCount="2722" Body="&lt;p&gt;Black rectangles on these charts show same signal, which is actually color sequence from a image, taken from different positions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MDJEa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LDopt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8hDb8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LYVDE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy to see that all images contain same pattern. Is here some algorithm which can detect these similarities, ideally implemented in Python ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about cut signals in multiple windows and try computing cross corelation on them ?&lt;/p&gt;&#xA;" OwnerUserId="5666" LastActivityDate="2013-10-15T08:00:48.090" Title="Find similar patterns in a signal" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11104" PostTypeId="2" ParentId="11096" CreationDate="2013-10-14T16:28:49.347" Score="4" Body="&lt;p&gt;Information loss and KL Divergence are functions that describe the behavior of random variables, in other words a set of random signals from some distribution. When you only have one signal, like you do in this case, calculating the information loss doesn't make sense. You can calculate mean squared error like the other comment suggests.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-10-14T16:28:49.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11105" PostTypeId="2" ParentId="11101" CreationDate="2013-10-14T16:46:46.553" Score="3" Body="&lt;p&gt;Best book on the topic is probably &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470665998&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/DAFX-Digital-Udo-ouml-lzer/dp/0470665998&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is some freeware stuff (very mixed quality) here: &lt;a href=&quot;http://www.musicdsp.org/&quot; rel=&quot;nofollow&quot;&gt;http://www.musicdsp.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many companies spend a lot of effort in making good sounding effects and well working tuners to make money with it, so access to &quot;good&quot; non-commercial sources if fairly limited. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-14T16:46:46.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11106" PostTypeId="2" ParentId="11103" CreationDate="2013-10-14T18:16:46.507" Score="0" Body="&lt;p&gt;The cross correlation idea may work well, but you will have to perform it with varying levels of stretching. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cross correlation will be computed using a 2D window of length L and height H representing the activity. Choose a moderate length L that resembles the expected length of the activity. Assume that in the 'white regions' the function value is a constant that is different from the values representing the activity filled regions. This way your 2D window can have up to 4 different function values representing the r,g,b, and w segments. .  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cross correlation will be taken between the signal and this window for &lt;em&gt;n&lt;/em&gt; iterations where in each iteration the enlarging/shrinking factor takes a new value. You probably won't need the three channels.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-10-14T18:49:03.940" LastActivityDate="2013-10-14T18:49:03.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11108" PostTypeId="1" CreationDate="2013-10-14T18:43:57.883" Score="0" ViewCount="332" Body="&lt;p&gt;Let's say I have an IIR filter that is a notch type with a peak at -20db. How do I modify the coefficients of the filter so that the peak is at -10 db for example?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can scale the denominator coefficients so that the global peak amplitude can be set, but it affects the whole filter, which I don't want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I want :&#xA;&lt;img src=&quot;https://i.stack.imgur.com/u6sMD.jpg&quot; alt=&quot;a&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5349" LastEditorUserId="26573" LastEditDate="2019-01-06T17:51:45.920" LastActivityDate="2019-01-06T17:51:45.920" Title="Scaling of a notch filter" Tags="|matlab|filters|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11109" PostTypeId="1" CreationDate="2013-10-14T20:01:23.323" Score="0" ViewCount="111" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Sound_localization&quot; rel=&quot;nofollow&quot;&gt;Wikipedia page on sound localisation&lt;/a&gt; states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Localization accuracy is 1 degree for sources in front of the listener&#xA;  and 15 degrees for sources to the sides. Humans can discern interaural&#xA;  time differences of 10 microseconds or less.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, I can't find any more detailed information on localisation accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm after is a plot of accuracy (Y) against azimuth (X).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone get me one step towards this information?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2013-10-17T13:49:02.517" Title="Auditory receptive field mapping" Tags="|sound|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11111" PostTypeId="2" ParentId="11109" CreationDate="2013-10-14T21:05:29.843" Score="1" Body="&lt;p&gt;There are a number of factors at play when it comes to localization of sound.  The primary factors are known as Interaural Intensity Difference (IID) and &lt;a href=&quot;http://en.wikipedia.org/wiki/Interaural_time_difference&quot; rel=&quot;nofollow&quot;&gt;Interaural Time Difference&lt;/a&gt; (ITD).  In addition to those factors, the brain infers additional localization information from spectral cues encoded by the outer ear, or pinna.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these factors together form what is know as a Head-Related Transfer Function (HRTF).  Because of varying head shapes, head sizes, hairstyles (believe it or not) and ear shape and placement, each person's HRTF is unique.  As a result, the way that each person's brain infers localization information from auditory cues is also unique.  For this reason, any data that you may see about localization accuracy is almost certainly a statistical value, rather than an exact measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If acoustical wave propagation was the only factor, it would be easy to generate a plot like you are talking about.  The problem is that our brains play a large role in the process.  For example, your brain has more neurons dedicated to localization of sounds in front of you than to your sides.  A google search for &quot;ITD IID&quot; returns a number of very informative tutorials and lecture notes that might help to understand the various phenomena at play in sound localization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said all of that, you might be able to achieve a very rough estimation by simply plotting ITD as a function of azimuth angle.  That would probably be the most tractable starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also an online database of Head-Related Impulse Responses (HRIR) available here:  &lt;a href=&quot;http://recherche.ircam.fr/equipes/salles/listen/download.html&quot; rel=&quot;nofollow&quot;&gt;http://recherche.ircam.fr/equipes/salles/listen/download.html&lt;/a&gt;  These HRIRs are measured by inserting &lt;a href=&quot;http://recherche.ircam.fr/equipes/salles/listen/system_protocol.html&quot; rel=&quot;nofollow&quot;&gt;tiny microphones&lt;/a&gt; into the ear canals of about fifty test subjects and playing a sound stimulus from predetermined locations all around the head.  These impulse responses are essentially measuring the HRTF of each of the individual test subjects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully you can find something that will work for you.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-10-14T21:05:29.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11112" PostTypeId="2" ParentId="11100" CreationDate="2013-10-14T21:49:18.960" Score="5" Body="&lt;p&gt;Causality is not so much a characteristic of a signal as it is a characteristic of a system.  For example, a non-causal system can have an output at time $t$ which depends on the input at time $t+1$.  When thinking in terms of time, a non-causal system breaks our intuition because it has to &quot;see the future&quot; in order to operate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that I want to create an audio effect that is a sort of &quot;reverse echo.&quot;  In other words, I want to hear an echo of the sound before the sound event actually occurs.  This would be an example of non-causal processing because at any given time, the output depends on input which has not yet occurred. This is not a problem in the case of a recorded audio signal because we already have all of the time samples available to us, so we can &quot;look ahead&quot; and use this &quot;future information&quot; right now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if I wanted to implement this &quot;reverse echo&quot; effect in a live performance?  I obviously can't &quot;look ahead&quot; to grab samples out of the future, but I can wait until all of the samples I need are available to me, and then apply the processing.  This would produce the exact same output signal as if I had done the non-causal processing mentioned above, but with one significant difference: my output would be delayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a signal $y$ which depends on input $x$ as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = a_2 x[n-1] + a_1 x[n] + a_0 x[n+1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can make a causal version of $y$, which we will call $y^\prime$, by simply delaying $y$ by one time step:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y^\prime[n] = y[n-1] = a_2 x[n-2] + a_1 x[n-1] + a_0 x[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have not altered the signal in any way, besides to shift its time indexing. Any shift in phase can be seen as a direct result of the delay, and cannot be reversed by multiplying some phase term.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastEditorUserId="5156" LastEditDate="2013-10-15T15:05:44.477" LastActivityDate="2013-10-15T15:05:44.477" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11113" PostTypeId="2" ParentId="11109" CreationDate="2013-10-15T00:16:34.823" Score="2" Body="&lt;p&gt;The ultimate book on the topic is probably &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0262024136&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Spatial-Hearing-Revised-Psychophysics-Localization/dp/0262024136&lt;/a&gt; . It's a bit dated but contains and excellent review of the main psycho-acoustic research on spatial hearing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a very complicated topic. For example azimuth and elevation perception work completely different and hence azimuth resolution is quite a bit better than elevation resolution. The actually resolution (or jnd for just noticeable difference) depends heavily on the actual and the properties of the signal.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-15T00:16:34.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11114" PostTypeId="1" CreationDate="2013-10-15T07:34:42.167" Score="1" ViewCount="333" Body="&lt;p&gt;I'm an undergraduate student and I am currently trying to find suitable topic for my bachelor thesis. The broader topic I've selected is &quot;Image processing on GPU&quot;, so basically I'll be developing image processing algorithms specifically for GPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, I need to do a novel approach, not reinvent a wheel.  There's so much going on in image processing, lately on GPUs as well, that I'm having trouble finding a suitable area that hasn't been researched in this way and which isn't above my capabilities as an undergraduate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, can you point me in a direction what are current research areas in image processing that could benefit from GPU implementation? I'd love to do something for medical or astrophysical applications, but I'm open to other areas as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5671" LastActivityDate="2013-10-15T10:52:36.837" Title="Image processing research areas using GPU" Tags="|image-processing|filters|computer-vision|algorithms|" AnswerCount="1" CommentCount="1" ClosedDate="2013-10-21T12:33:44.187" ContentLicense="CC BY-SA 3.0" />
  <row Id="11115" PostTypeId="2" ParentId="11103" CreationDate="2013-10-15T07:41:09.933" Score="1" Body="&lt;p&gt;More detail like PAK-9 asks, and example images with the pattern indicated, would help get better answers.  If you update your question with details and data, you're also more likely to get example implementations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, this looks to be a candidate for a wavelet transform (like with &lt;a href=&quot;http://www.pybytes.com/pywavelets/&quot; rel=&quot;nofollow&quot;&gt;pywavelets&lt;/a&gt;), which would allow for the stretching and scaling that you need to capture the variations of the pattern. Pre-computed wavelets can be browsed &lt;a href=&quot;http://wavelets.pybytes.com/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, or you can roll your own (like the fast &lt;a href=&quot;http://www.olhovsky.com/2009/03/2d-cdf-97-wavelet-transform-in-python/&quot; rel=&quot;nofollow&quot;&gt;2D CDF 9/7 lifting transform&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You suggested cross-correlation, which might be good for a first pass (see &lt;a href=&quot;http://scikit-image.org/docs/dev/auto_examples/plot_template.html#example-plot-template-py&quot; rel=&quot;nofollow&quot;&gt;scikit-image template matching&lt;/a&gt; for ideas).  You might modify this to loop through windows to account for the stretching and scaling, but you'll want to normalize them if you intend to subsequently use a classifier.  Also, the relative width and spacing of the peaks seem conserved, which would lend itself to windowed supervised classification by many means, like SVM or Random Forests (&lt;a href=&quot;http://scikit-learn.org/stable/supervised_learning.html#supervised-learning&quot; rel=&quot;nofollow&quot;&gt;scikit-learn&lt;/a&gt; has plenty of classifiers and examples for you).    &lt;/p&gt;&#xA;" OwnerUserId="5420" LastEditorUserId="5420" LastEditDate="2013-10-15T08:00:48.090" LastActivityDate="2013-10-15T08:00:48.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11116" PostTypeId="1" CreationDate="2013-10-15T09:40:26.127" Score="0" ViewCount="305" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/clF6R.jpg&quot; alt=&quot;EOG Waveform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this is a picture of saccadic eye movement reflected by an EOG. How can I determine if the eye movement system is linear, causal, memoryless, and time invariant from this displayed waveform? Please explain. &lt;/p&gt;&#xA;" OwnerUserId="5673" LastActivityDate="2013-10-15T12:27:34.317" Title="Determining linearity, causality, memory, and time invariability from a picture of the signal" Tags="|convolution|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11117" PostTypeId="2" ParentId="11114" CreationDate="2013-10-15T10:52:36.837" Score="2" Body="&lt;p&gt;I've done a bit of GPGPU (for optical flow) during my PhD, so here are a few hints to help you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;choose a computation intensive task. You're very likely to find them in variational inverse problems (especially when expressed images instead of sparse feature sets). They are very common tasks: image deconvolution, compressed sensing, dense optical flow (and more broadly dense image registration...), dense 3D reconstruction, image segmentation... ;&lt;/li&gt;&#xA;&lt;li&gt;from my point of view, non-local image denoising (using non-local means) is very easy to understand, and it's computation-intensive enough to have been included in NVidia's Cuda examples for quite a while. It really deserves a new, better GPU implementation (such as the GPU-based kd-trees proposed a few years ago). However, it may prove challenging for an undergrad;&lt;/li&gt;&#xA;&lt;li&gt;a useful site to see what Image Processing tasks can be done on GPUs: the Austrian (T.U. Graz) lab &lt;a href=&quot;http://gpu4vision.icg.tugraz.at/&quot; rel=&quot;nofollow&quot;&gt;GPU4Vision&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-10-15T10:52:36.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11119" PostTypeId="1" CreationDate="2013-10-15T12:03:41.300" Score="0" ViewCount="53" Body="&lt;p&gt;I have position $\theta(s) = \frac{s^2+1}{s^4+2s^3+3s^2+4s+5}$ and velocity $\dot\theta(s) = \frac{s(s^2+1)}{s^4+2s^3+3s^2+4s+5}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I construct 2-state-observer with sampling time $T_s$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left[&#xA;\begin{array}{c}&#xA;  \theta_{k+1}\\&#xA;  \dot\theta_{k+1}\\&#xA;\end{array}&#xA;\right]&#xA;=A\left[&#xA;\begin{array}{c}&#xA;  \theta_{k}\\&#xA;  \dot\theta_{k}\\&#xA;\end{array}&#xA;\right]$&lt;/p&gt;&#xA;" OwnerUserId="5554" LastActivityDate="2013-10-15T12:03:41.300" Title="construct 2-state observer" Tags="|control-systems|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11120" PostTypeId="2" ParentId="11116" CreationDate="2013-10-15T12:27:34.317" Score="5" Body="&lt;p&gt;Basically you can't. In basic information theory a system has an input and output and the terms you are asking about are defined in terms of the relationship between output and input. It's difficult to determine what the input to saccadic eye movements would be. It's mostly an unconscious process controlled by the neural periphery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to answer your question you would first define an appropriate input signal and than look at a screen shot that shows both input and output simultaneously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW you could potentially argue that it's causal simply because it is a real physical system and all physcial systems are causal.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-15T12:27:34.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11121" PostTypeId="2" ParentId="11108" CreationDate="2013-10-15T13:15:48.647" Score="1" Body="&lt;p&gt;You show a pretty narrow notch, are you trying to notch out a tone? If so, maybe you could use an Inverse Chebyshev, and move the -10 dB pt in the notch to your tone frequency.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/G84eF.png&quot; alt=&quot;Plot of 2 Pole Inverse Chebyshev Notch&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-10-15T13:15:48.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11122" PostTypeId="2" ParentId="11084" CreationDate="2013-10-15T15:27:33.713" Score="2" Body="&lt;p&gt;Well I managed to find this MATLAB package &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://sites.google.com/site/rwfwuwx/Home/mfeeg&quot; rel=&quot;nofollow&quot;&gt;https://sites.google.com/site/rwfwuwx/Home/mfeeg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does almost the same operation that as been done in the paper..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the related files in the package are:&#xA;mf_tfcm.m &amp;amp; mf_cmorlet.m&lt;/p&gt;&#xA;" OwnerUserId="5656" LastActivityDate="2013-10-15T15:27:33.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11123" PostTypeId="2" ParentId="11070" CreationDate="2013-10-15T17:21:30.633" Score="4" Body="&lt;p&gt;It's already answered in the comments so just to close it out: the answers are 3, 7 and 3. The periodicity is basically given by the denominator of the fraction in front of 2*pi*n after the fraction has been simplified (no common divisors between nominator and denominator).  The simplified fractions for the cases are 1/3, 5/7 and 7/3 so the periodicity is 3, 7 and 3 respectively. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-15T17:21:30.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11124" PostTypeId="1" AcceptedAnswerId="11126" CreationDate="2013-10-15T21:24:50.000" Score="2" ViewCount="2482" Body="&lt;p&gt;What do you think of this notch / band reject filter for a very very narrow band ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Original signal x[n] &#xA;--&amp;gt; FFT&#xA;--&amp;gt; then I just put &quot;0&quot; in the FFT bin of the frequency I need to reject (notch filter)&#xA;--&amp;gt; inverse FFT &#xA;--&amp;gt; output signal y[n].&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How is called such a filter ? Does it really work, or is it too simple to be true ?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-10-15T22:49:06.110" Title="simplest Notch filter in the world" Tags="|fft|filters|filter-design|dft|infinite-impulse-response|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11125" PostTypeId="1" CreationDate="2013-10-15T22:02:39.650" Score="3" ViewCount="1245" Body="&lt;p&gt;I have an application that I must use a complex Morlet wavelet function (&lt;code&gt;cmorfb-fc&lt;/code&gt;), I can run &lt;code&gt;CWT&lt;/code&gt; (continuous wavelet transform) and it's fine, but I want to run &lt;code&gt;DWT&lt;/code&gt;(Discrete wavelet transform) with this complex Morlet(&lt;code&gt;cmorfb-fc&lt;/code&gt;) function too. then I want to compare the DWT and CWT results.&lt;br&gt;&#xA;&lt;em&gt;so Does anyone can help and explain, how can I implement DWT of complex Morlet (with the known Mallat filters)?&lt;/em&gt;   &lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="15892" LastEditDate="2017-07-10T17:02:11.657" LastActivityDate="2017-08-09T19:41:47.000" Title="Complex Morlet function and DWT" Tags="|frequency-spectrum|wavelet|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11126" PostTypeId="2" ParentId="11124" CreationDate="2013-10-15T22:39:15.457" Score="8" Body="&lt;p&gt;The frequency response of a single FFT bin filter looks like a Sinc function, which has a massive amount of overshoot or ripple at frequencies between FFT bins.  So your filter is only useful if you can strictly guarantee that the input to the FFT only contains unmodulated frequencies that are strictly and exactly periodic in the FFT aperture length (e.g. not a window on longer data of unknown periodicity or a non-periodic stream).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A notch filter is equivalent to adding the inverse of the equivalent bandpass filter to the signal.  If the bandpass has ripples, they will get added to the result of the notch, thus potentially adding a lot of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you end up with a not-so-simple (as it requires pairs of FFT computations) that likely produces terrible results.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-10-15T22:49:06.110" LastActivityDate="2013-10-15T22:49:06.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11127" PostTypeId="1" AcceptedAnswerId="11134" CreationDate="2013-10-16T09:49:47.010" Score="3" ViewCount="52398" Body="&lt;p&gt;What's the simplest way to implement a FIR filter in C/C++ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I don't want to have to use a third-party software like Matlab or Octave in order to compute the coefficiens because I have to use different filters on thousand of files, with different frequencies for each file.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, &lt;strong&gt;is there a ready-to-use C/C++ DSP library&lt;/strong&gt; with functions like &lt;code&gt;file.FIR_NotchFilter(frequency,Qfactor)&lt;/code&gt; ? or something similar ?&#xA;(commercial or opensource) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS1 : I see that there is &lt;a href=&quot;http://aquila-dsp.org&quot; rel=&quot;nofollow&quot;&gt;http://aquila-dsp.org&lt;/a&gt;, but there are no binary releases yet, and for older version, it seems difficult to use it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS2 : A really &lt;strong&gt;ready-to-use&lt;/strong&gt; solution exists for IIR filters : &lt;a href=&quot;https://github.com/vinniefalco/DSPFilters&quot; rel=&quot;nofollow&quot;&gt;https://github.com/vinniefalco/DSPFilters&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Create a Chebyshev type I Band Stop filter of order 3&#xA;Dsp::SimpleFilter &amp;lt;Dsp::ChebyshevI::BandStop &amp;lt;3&amp;gt;, 2&amp;gt; f;&#xA;f.setup (3,    // order&#xA;     44100,// sample rate&#xA;     4000, // center frequency&#xA;     880,  // band width&#xA;     1);   // ripple dB&#xA;f.process (numSamples, arrayOfChannels);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-10-16T14:20:19.313" LastActivityDate="2017-09-05T14:46:26.723" Title="Simplest way to implement FIR filter in C/C++" Tags="|filters|filter-design|signal-analysis|c|" AnswerCount="6" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11128" PostTypeId="2" ParentId="9952" CreationDate="2013-10-16T11:16:51.237" Score="1" Body="&lt;p&gt;I'm not sure Jim's answer is quite correct here: My understanding is that &quot;fixed&quot; refers to a situation where the transfer function is time-invariant, i.e. transmitter and receiver are stationary and the environment doesn't change. An example for that would be a radio station and a home radio receiver. The opposite of fixed would be variable, such as a car radio receiver or a cell phone. These are moving about so the transfer function and associated multi-path changes all the time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Modelling of the channel paths as a simple delay (be it integer or fractional) is a gross simplification which only works if the signal itself is very narrow band. For an ultra wide band system that's probably not accurate and you will the frequency dependencies of the paths either in the frequency domain through properly capturing the impulse responses&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-16T11:16:51.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11129" PostTypeId="2" ParentId="6223" CreationDate="2013-10-16T12:53:42.480" Score="0" Body="&lt;p&gt;this one: &lt;a href=&quot;http://web.media.mit.edu/~raskar/photo/code.pdf&quot; rel=&quot;nofollow&quot;&gt;http://web.media.mit.edu/~raskar/photo/code.pdf&lt;/a&gt; has a Matlab Code for Poisson Image Reconstruction from Image Gradients. Maybe it can help you. &lt;/p&gt;&#xA;" OwnerUserId="5682" LastActivityDate="2013-10-16T12:53:42.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11130" PostTypeId="2" ParentId="11127" CreationDate="2013-10-16T14:02:19.330" Score="2" Body="&lt;p&gt;Since you are interested in designing your own FIR filters, you could start with windowed sinc filters. If you &quot;window&quot; a &quot;sinc&quot;, you basically get a lowpass filter's impulse response. And since filtering is linear, you can mix multiple lowpass filters' impolse responses and the unit impulse to do all sorts of things (highpass, bandpass, notch). The filter's impulse response's extent in samples basically controls the transition bandwidts at the corner frequencies: &quot;longer&quot; filters = &quot;sharper cutoffs&quot;. The actual window function is another trade off between sharp cutoff and strong rejection. Check out Wikipedia's article on window functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://www.dspguide.com/ch16.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch16.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But a low-order IIR filter can be a nice and fast notch for some specific frequency, too. Designing those is trickier, though. One way to attack this is to do the design offline for some arbitrary notch frequency like Nyquist/2 and then to do &quot;frequency warping&quot; at run-time to shift the notch frequency up- or downwards. Frequency warping is actually not that hard if you factor your filter into a sequence of second order sections before. Frequency warping can be applied independently (with the same parameter) to each of the sections.&lt;/p&gt;&#xA;" OwnerUserId="1961" LastEditorUserId="1961" LastEditDate="2013-10-16T14:16:46.287" LastActivityDate="2013-10-16T14:16:46.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11131" PostTypeId="1" CreationDate="2013-10-16T14:40:30.023" Score="0" ViewCount="93" Body="&lt;p&gt;So I am Designing a system which would be able to send and receive stereo voice signals.( like a telephone but with full-band stereo voice signals)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is an example to make my question clearer. &#xA;In a music recording studio two microphones are foreseen, one for singer's voice and the other for the guitar's sound. The combination of these two voice signals will result into a Stereo signal.At the same time there is a live conversation with another end which is supposed to receive music studio's signals as stereo and be also able to send back stereo signals.&#xA;If Bluetooth were to be used to transmit voice signals to CE Device( smartphone) and VoIP to transmit between two sides of conversation . I have done some studies but apparently Bluetooth has some limitations in case of synchronous transmissions.&#xA;what factors should be taken into account to choose a transmission method?&lt;/p&gt;&#xA;" OwnerUserId="5677" LastEditorUserId="5677" LastEditDate="2013-10-16T14:52:53.380" LastActivityDate="2013-10-16T16:38:16.077" Title="What factors determine synchronous signal transmission ability of a channel?" Tags="|audio|voice|bandwidth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11132" PostTypeId="2" ParentId="11131" CreationDate="2013-10-16T16:38:16.077" Score="1" Body="&lt;p&gt;Not sure what exactly you mean by &quot;synchronous&quot;. Most digital transport mechanism (such as Ethernet or 802.11) are &quot;asynchronous&quot;, i.e. a continuous data streams  are chopped up in packets, the packets are transmitted whenever the connection allows it, the packets are assembled in the correct order at the receiving end and then turned into a continuous data stream again. Since it's not known when exactly the packet can be transmitted, there has to some buffering at the receiving end so there is some data available even if the next packet comes in late. This results in a certain amount of &quot;latency&quot;. In the case of Bluetooth + VoIP you are probably looking at several 100 milliseconds to a few seconds of overall latency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also be concerned about inter-channel sync, i.e. do both channels of the stereo stream stay time aligned. This can easily be achieved by interlacing the channels to create a single stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all depends heavily on the specific implementation: Bluetooth supports many profiles. For your application you probably want the A2DP profile. This uses the SBC codec and there are dozens of ways to configure the codec ranging anywhere from high quality to totally unusable. Both parts of the interface need to agree on the codec implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also many different VoiP protocols and codecs out there. Most operate in the 10kb/s-40kb/s range which seems way too low for you application, so you may need to create a custom protocol.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-16T16:38:16.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11134" PostTypeId="2" ParentId="11127" CreationDate="2013-10-16T20:45:59.800" Score="2" Body="&lt;p&gt;If you are filtering in non-realtime (such as when the data is already in a file) and need a linear phase notch, then a suitable IIR filter fed the data both forwards and then backwards will give you both linear phase and a deeper notch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In C code, you could just reverse the array after each vector IIR function call.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-16T20:45:59.800" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="11137" PostTypeId="1" AcceptedAnswerId="11228" CreationDate="2013-10-17T03:50:30.160" Score="3" ViewCount="160" Body="&lt;p&gt;I have a digital on/off signal sampled at a regular interval.  There was a problem with the sensor that produced the signal which has sometimes caused a regular on/off ticking when the sensor should be in the off state.  I.e. sometimes when the readings should be zero, there is a square wave instead (but with an unequal mark:space).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about designing a filter to remove this square wave (i.e. output a zero if there is this regular ticking occurring, output the input value otherwise)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ticking has a frequency of around 16 minutes, the events that the sensor was observing might last anything from one minute to a few hours.  I expect that this means that perfect recovery of the correct data is impossible, but I’d like to get as close as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would think some kind of notch filter is what I need, but everything I’ve found so far seems to be about filtering analogue signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(My memory of signal processing courses is a bit patchy, hopefully I’ve used the right terms here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your comments so far.  I've attached an image illustrating what I am trying to achieve.  Also I wrote the wrong frequency for the regular ticking - it's actually 16 minutes, not 8, but I doubt that affects the overall approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Jan - yes, ideally I would just have a better sensor, but this is the data I have for now, I don't currently have the option of switching to a different sensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data processing is happening offline, so non causal solutions are fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CQciM.png&quot; alt=&quot;Sample data&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5689" LastEditorUserId="5689" LastEditDate="2013-10-22T23:58:31.477" LastActivityDate="2013-10-22T23:58:31.477" Title="How to filter a regular ticking out of a digital (on/off) signal?" Tags="|filters|digital|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11138" PostTypeId="2" ParentId="11127" CreationDate="2013-10-17T03:56:40.027" Score="0" Body="&lt;p&gt;If you do not have to do the calculation FIR coefficients in real time, you can use any off-line tools to calculate coefficients and add it to your program code. Simple function for doing FIR filtering is trivial. Matlab (or its free analog Octave) are almost standart tool for designing FIR coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to calculate FIR coefficients in real time and/or you want to make data filtering very fast, you can use Intel Integrated Performance Primitives library &lt;a href=&quot;http://software.intel.com/en-us/node/439278&quot; rel=&quot;nofollow&quot;&gt;(&quot;IPP Filtering Functions)&quot;&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2013-10-17T03:56:40.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11139" PostTypeId="1" CreationDate="2013-10-17T05:48:11.040" Score="1" ViewCount="1408" Body="&lt;p&gt;How edges of the triangle get on both sides of fs? What is their purpose? Why fs in the center? (from Lyons Understanding DSP)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Wq4L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5589" LastEditorUserId="6" LastEditDate="2014-05-30T23:57:39.003" LastActivityDate="2014-05-31T02:16:52.800" Title="What do triangles mean in frequency aliasing depiction?" Tags="|frequency-spectrum|sampling|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11140" PostTypeId="2" ParentId="11070" CreationDate="2013-10-17T08:51:13.437" Score="1" Body="&lt;p&gt;I cannot ask a question in the comment section therefore I decided to add my question here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website provided by Yicheng Ye somehow gives something and I believe people who know this stuff understand all of it but I still find it confusing. I don't understand how to work out the fundamental frequency or minimum period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried my own workaround but I am not sure if I am right. Please correct me if I am wrong. Thanks. Fundamental frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\omega_0n=2\pi\frac{M}{N}n$, ..... dividing by n gives&lt;br /&gt;&#xA;$\omega_0=2\pi\frac{M}{N}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate minimum period, I have rearranged the formula $\frac{\omega_0}{2\pi{}M}=\frac{1}{N}$ and then got the answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N=\frac{2\pi{}M}{\omega_0}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which means that $N$ is a minimum period. I don't feel if this is correct. Perhaps I don't because cannot really understand what $M$ represents here or what it does correspond to. I will be grateful for explanation. Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4721" LastActivityDate="2013-10-17T08:51:13.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11141" PostTypeId="1" CreationDate="2013-10-17T09:20:42.430" Score="0" ViewCount="209" Body="&lt;p&gt;is that possible to find SNR of an environment ? ie., i have a outdoor environment where i cannot find the clean speech ,if so i want to measure the signal power to noise power how to do that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can i do some thing like put a voice activity detection and find voice frames and find the voice frames power to non voice frames power will that be SNR of that environment ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have seen some tools like &lt;a href=&quot;http://www.baudline.com/&quot; rel=&quot;nofollow&quot;&gt;baudline&lt;/a&gt; giving segmental SNR will they follow the same method i have mentioned or how this actually happen i have also listened to tools like &lt;a href=&quot;http://sox.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;SOX&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4513" LastActivityDate="2014-04-15T14:56:33.973" Title="Estimating SNR of an Environment where obtaining clean speech is not possible" Tags="|snr|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11143" PostTypeId="2" ParentId="11127" CreationDate="2013-10-17T09:59:10.177" Score="4" Body="&lt;p&gt;Have you considered using the Parks McClellan algorithm to generate your FIR filters. The source code for it is available on several sites in Fortran or C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original Fortran code is &lt;a href=&quot;http://en.wikipedia.org/wiki/Parks%E2%80%93McClellan_filter_design_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;available on Wikipedia.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two sources for C code&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/scipy/scipy/blob/master/scipy/signal/sigtoolsmodule.c&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github/scipy&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.iowahills.com/A7ExampleCodePage.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Iowa Hills&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You said you were trying to understand filters, so let me explain that the Parks McClellan algorithm is a classic. It was developed in the early 70's, and is still considered to be one of the best FIR design algorithms available. &lt;/p&gt;&#xA;" OwnerUserId="5108" LastEditorUserId="80" LastEditDate="2017-09-05T11:52:15.193" LastActivityDate="2017-09-05T11:52:15.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11145" PostTypeId="2" ParentId="11141" CreationDate="2013-10-17T12:49:42.330" Score="1" Body="&lt;p&gt;I think it all depends on the SNR region that you are dealing with. Using a voice activity detector (VAD) seems to be worth an attempt, but consider that VADs fail if the SNR is too low. The most simple approach might be using quantiles of the power distribution. Some lower quantiles will probably not contain power that is caused by the speech signal part while high quantiles will contain power resulting from the speech signal. Choosing the right quantiles might be a challenge, but due to the straight forward approach it might by worth a try...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, by reinterpreting your problem to noise floor estimation, you might succeed by using some noise floor estimation algorithm (e.g. Minimum-Statistics by Rainer Martin [1, 2]) and calculating the SNR from that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Rainer Martin, “Spectral Subtraction Based on Minimum Statistics,” presented at the EUSIPCO, 1994.&#xA;[2] Rainer Martin, “Noise Power Spectral Density Estimation Based on Optimal Smoothing and Minimum Statistics,” IEEE Transactions on Speech and Audio Processing, vol. 9, no. 5, pp. 504–512, Jul. 2001.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2013-10-17T12:49:42.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11146" PostTypeId="2" ParentId="11139" CreationDate="2013-10-17T13:17:55.370" Score="0" Body="&lt;p&gt;As a short first answer: The triangles indicate the extent of the frequency content of the signal ($\rightarrow$ &lt;em&gt;bandwidth&lt;/em&gt;). Aliasing results if the triangles overlap.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastEditorUserId="5664" LastEditDate="2014-04-28T18:33:59.207" LastActivityDate="2014-04-28T18:33:59.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11147" PostTypeId="2" ParentId="11109" CreationDate="2013-10-17T13:21:33.100" Score="1" Body="&lt;p&gt;The keyword is &quot;minimum audible angle&quot; -- throwing this into Google gives results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, from &lt;a href=&quot;http://www.cpt.univ-mrs.fr/~briolle/9thISH.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;, I got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/217U9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also from &lt;a href=&quot;https://fedora.kug.ac.at/fedora/get/o:6537/bdef:Content/get&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fDXS0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2013-10-17T13:49:02.517" LastActivityDate="2013-10-17T13:49:02.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11151" PostTypeId="1" CreationDate="2013-10-17T16:15:55.560" Score="6" ViewCount="8657" Body="&lt;p&gt;I've got an impulse response of a hall, it's 10 seconds long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now say I want to apply this reverb to a wav file of some singing. I would perform a convolution of the data in two wav files and that the result would be a third lot of data, this time with the reverb. Great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how would this actually work in a real time setting, in a program like GarageBand, using a live input like an electric guitar?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Garageband can't convolve the full guitar track because it doesn't yet exist (because it's being played live!) One way that I thought of, was if the program performed the convolution on say, the 256 most recent samples of guitar input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this raises 2 issues:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the computer be able to perform so many convolutions every second?&#xA;And surely this introduces some sort of delay while waiting for the calculations to be processed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could help explain, that would be great.&lt;/p&gt;&#xA;" OwnerDisplayName="user5695" LastActivityDate="2015-03-20T23:40:56.490" Title="Conceptually, how does real time convolution reverb work?" Tags="|convolution|impulse-response|real-time|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11152" PostTypeId="2" ParentId="11151" CreationDate="2013-10-17T16:47:31.107" Score="5" Body="&lt;p&gt;It comes down to latency vs. complexity. If your filter is 10 seconds long, you need to store the audio data of the last ten seconds and then you are able to calculate the current output audio sample with a latency of basically zero (ignoring the time required for calculations here) simply by doing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[0] = \sum_{k=0}^{l} x[-k] \dot h[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $l$ is the length of the impulse response $h$ and $x[0]$ is always assumed to be the current sample. While this gives you basically zero lag, it boils down to the performance of naive convolution which can easily be too much especially if the impulse response is very long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you could use techniques such as overlap-save which already perform convolution of very long signals by splitting the signal up and performing the convolution in chunks. However, to be able to calculate the output you first need to capture all the input samples for one chunk so this defines your latency (again ignoring the calculation time). The efficiency of these algorithms is usually in between the direct convolution method and the pure FFT method and the amount of calculations per sample will be less for longer chunks at the cost of latency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with overlap-save is that the chunk needs to be at least the size of the impulse response so for a 10 second response, the latency will be at least 10 seconds, hardly real-time. For this case so-called partitioned convolution algorithms have been developed that split both, the impulse response and the incoming signal. I've found a very good paper describing these techniques here &lt;a href=&quot;http://cnmat.berkeley.edu/system/files/attachments/main.pdf&quot; rel=&quot;noreferrer&quot;&gt;(Click me)&lt;/a&gt; so I will just link it. I can hardly describe it better than they do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I heard, there should be no more than 3-5ms latency or a good musician will notice the delay.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-10-17T16:47:31.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11153" PostTypeId="1" CreationDate="2013-10-17T18:00:09.070" Score="9" ViewCount="242" Body="&lt;p&gt;This is a photo of our homeworld, taken by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Juno_(spacecraft)&quot; rel=&quot;noreferrer&quot;&gt;Juno&lt;/a&gt; spacecraft recently, sling-shotting on its way to Jupiter. What it gained in speed, we lost in ours, however thankfully we will not be falling into the sun. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X2SZj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the South American continent is on the left. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we can notice that there is a sort of artifact across the image, a faint sort of blue bar that exists across the image. I am curious as to what may have caused that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would really like to know though, is what image processing techniques us puny humans might muster in order to remove this artifact?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="1329" LastEditDate="2013-10-17T21:32:26.683" LastActivityDate="2013-10-29T23:45:59.803" Title="Remove artifact from space probe image" Tags="|filters|image-processing|denoising|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11154" PostTypeId="2" ParentId="11151" CreationDate="2013-10-17T21:49:20.900" Score="4" Body="&lt;p&gt;To add to jan's answer: Most commercial reverb effects (plug ins or hardware) are NOT based on  convolution with an impulse response but are based parametric algorithms in some network configuration. This has a bunch of advantages:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Less memory&lt;/li&gt;&#xA;&lt;li&gt;Less MIPS&lt;/li&gt;&#xA;&lt;li&gt;It's parametric, so different parameters like &quot;room size&quot;, &quot;reverb time&quot; , &quot;color&quot;, etc. can be adjusted continuously and in real time.&lt;/li&gt;&#xA;&lt;li&gt;If done well, it actually sounds better&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-17T21:49:20.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11155" PostTypeId="1" AcceptedAnswerId="11157" CreationDate="2013-10-17T23:48:35.397" Score="2" ViewCount="1385" Body="&lt;p&gt;I am doing a personal project which aims to detect infant cry. I have an infant cry audio database and extracted the MFCC from these files using MATLAB. I've come up with 12 coefficients for each frame the audio was divided into.&#xA;My goal is to compare audio obtained from a microphone with the training data (MFCC from the samples). I figured I would split the audio input data into frames and then compare each frame with the training data using a k-NN classifier. My question is how to, in fact, train the k-NN classifier, since I have many samples to compare with. I mean, what should I compare the frames from the input data to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="5699" LastActivityDate="2016-12-13T05:44:10.193" Title="Training k-NN classifier with MFCC data" Tags="|audio|mfcc|knn|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11157" PostTypeId="2" ParentId="11155" CreationDate="2013-10-18T08:14:50.123" Score="1" Body="&lt;p&gt;Your problem here is not a discriminative problem in which you have two (or more) classes you want to recognize. If it had been the case - for example discriminate infant cry with recording of bird songs, you would have compared each MFCC vector from the incoming audio stream to a massive set of frames either labelled as &quot;bird song&quot; or &quot;infant cry&quot; depending on the recording from which they came from. Note that the datasets would have been absolutely massive if your training sets had more than seconds of audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your problem consists in measuring how similar your data is to a given category; or how well it fits a model trained on the example data - it is a &quot;one-class&quot; problem. In a Bayesian framework, this is equivalent to evaluating the probability of the &quot;infant cry&quot; hypothesis given the MFCC frame as evidence. I recommend you to frame your problem in Bayesian terms because it is likely that for your application, there are probably different costs involved in a false alarms or in missing the detection of a cry; so you'd like to work with a method which can balance them. Working in a probabilistic frameworks implies that you'll need to pick a model for the distribution of MFCC vectors on your training data. The simplest, but most computationally expensive approach is to use  &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_density_estimation&quot; rel=&quot;nofollow&quot;&gt;Kernel density estimation&lt;/a&gt; - this is like a one-class, statistical cousin of k-NN (equally computationally intensive); but a more sensible approach given the amount of data would be gaussian mixture models.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-10-18T08:14:50.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11158" PostTypeId="2" ParentId="10404" CreationDate="2013-10-18T13:25:45.773" Score="1" Body="&lt;p&gt;First, you are trying to design an RF filter. So when you Google for filters, try searching on terms like &quot;Direct Coupled Filters&quot; or &quot;RF Filters&quot; or &quot;Norton Transform Filters&quot; or &quot;Seymor Cohn&quot;. Cohn authored the most important RF fiter design paper ever published (around 1950).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, don't worry about the prototype. With these sorts of filters, you essentially have one choice, the Butterworth. The reason for this is that the filter's response will be governed more by the components you use than the prototype. It is virtually impossible to obtain a true Chebyshev response from a filter constructed with inductors that typically have a Q of less than 30. You can't achieve a true Butterworth response either, but it is the best place to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third, if you are going to do this, you need an RF circuit simulator. You absolutely must simulate these circuits using accurate component models. Once you do, you will quickly understand what I said about the prototype. You will also find that, depending on the bandwidth of your bandpass filters, you can't implement more than about 3 poles. The component losses will destroy the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forth, if you are designing an up converter and down converter, you need to make some careful decisions regarding the frequencies you use. i.e. Whether to use low side or high side injection. It can have a significant affect on the filter requirements. So to get started, you should first understand your filtering limitations, and then decide on a mixing strategy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps, but the task you describe is a great deal of work, even for experienced professionals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to consider using either a crystal, SAW, or ceramic filter, rather than trying to design your own.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastEditorUserId="5108" LastEditDate="2013-10-18T13:41:27.657" LastActivityDate="2013-10-18T13:41:27.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11159" PostTypeId="2" ParentId="2937" CreationDate="2013-10-18T13:56:13.043" Score="3" Body="&lt;p&gt;It's been a while, but if anyone would like a working fixed-point implementation (no floats/doubles) in C you might take a look at: &lt;a href=&quot;http://www.ti.com/ww/cn/uprogram/share/ppt/c6000/Chapter17.ppt&quot; rel=&quot;nofollow&quot;&gt;http://www.ti.com/ww/cn/uprogram/share/ppt/c6000/Chapter17.ppt&lt;/a&gt;‎&#xA;– Slide 14.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like it will work beautifully and efficiently in even a low-powered micro-controller.&#xA;(In which case some of the ‘int’ variables in that TI C code may need to become ‘longs’ to be 32-bit.)&lt;/p&gt;&#xA;" OwnerUserId="5708" LastActivityDate="2013-10-18T13:56:13.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11160" PostTypeId="2" ParentId="11087" CreationDate="2013-10-18T14:17:29.233" Score="4" Body="&lt;p&gt;The Matlab code of the S-transform can be found here for example: &lt;a href=&quot;http://en.verysource.com/code/1180181_1/st.m.html&quot; rel=&quot;nofollow&quot;&gt;http://en.verysource.com/code/1180181_1/st.m.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main advantage compared to CWT is its simplicity. In fact, it can be seen as equivalent to a Morlet wavelet, see for example paper by Ventosa, Schimmel, Simon, Dañobeitia and Mànuel &quot;The S-transform from a wavelet point of view&quot;, IEEE Trans on Signal Processing, 2008.&lt;/p&gt;&#xA;" OwnerUserId="5710" LastActivityDate="2013-10-18T14:17:29.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11161" PostTypeId="1" CreationDate="2013-10-18T18:01:31.543" Score="0" ViewCount="500" Body="&lt;p&gt;I am using impulse responses from &lt;a href=&quot;http://sound.media.mit.edu/resources/KEMAR.html&quot; rel=&quot;nofollow&quot;&gt;http://sound.media.mit.edu/resources/KEMAR.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are available as either raw or diffuse-field equalized HRTFs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Which do I want? Raw, or diffuse-field equalized?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using these IRs to project single notes (generated synthetically using a ring resonator) to 12 locations around the listeners head.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2013-10-18T22:04:40.237" Title="What is diffuse field equalisation?" Tags="|impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11162" PostTypeId="1" CreationDate="2013-10-18T18:17:50.013" Score="0" ViewCount="176" Body="&lt;p&gt;I am experimenting with HRTFs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically I'm trying to create 12 impulse responses that the brain can easily differentiate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more distinct they are from one another the better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm trying to figure out ways of making them as distinct as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My best attempt so far is to use HRIRs on the horizontal plane with varying azimuths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use HRIRs for 12 equally-spaced points (i.e. azimuth 0 30 60 90 ... degrees),  but human beings can perceive tiny differences in angle directly in front (as opposed to the sides), so a more sensible spacing would be something like 0 10 20 45 90 135 160 170 180.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the sort of thing I'm looking into...  I give it as an example as I would be grateful for guidance in this more general enquiry, and also it shows my motivation for this question: maybe I should drop this line of enquiry as it won't help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, I'm wondering whether HRIRs from an echoic environment may present more cues, and hence provide better localisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if this is the case, is there any shortcut to actually recording the HRIRs in a cathedral (which has actually been done: &lt;a href=&quot;http://www.ind.rwth-aachen.de/en/research/tools-downloads/aachen-impulse-response-database/&quot; rel=&quot;nofollow&quot;&gt;http://www.ind.rwth-aachen.de/en/research/tools-downloads/aachen-impulse-response-database/&lt;/a&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. is it possible to take an impulse response for a cathedral,  and convolve it with each HRTF?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2013-10-18T22:48:00.337" Title="Combining HRTF with echo" Tags="|audio|impulse-response|source-separation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11163" PostTypeId="1" AcceptedAnswerId="11166" CreationDate="2013-10-18T18:25:43.583" Score="2" ViewCount="1892" Body="&lt;p&gt;Thanks to all the people who helped me here, I finally achieved to implement a notch filter (*), with coefficients given by :&#xA;&lt;a href=&quot;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&quot; rel=&quot;nofollow&quot;&gt;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do &lt;strong&gt;order=2&lt;/strong&gt; (number of poles=4, according to this website), all is working very well with :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[n] = a0*x[n-4] + a1*x[n-3] + a2*x[n-2] + a3*x[n-1] + a4*x[n] &#xA;       + b0*y[n-4] + b1*y[n-3] + b2*y[n-2] + b3*y[n-1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Great!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to increase order (example : order=4 or even order=3 =&gt; number of poles=6), then the filter doesn't work anymore. Very quickly (after &lt;code&gt;n=10&lt;/code&gt; or &lt;code&gt;100&lt;/code&gt;), the signal is saturated to the max value : overflow !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Nota : I work in &lt;code&gt;double&lt;/code&gt; (64 bits) floating point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somebody told that &lt;em&gt;the higher the order, the more unstable&lt;/em&gt; ! What to do then to solve this problem ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(*) The IIR filter is even ... linear-phase ... thanks to the trick that someone gave me (apply the filter on the signal, then reverse the signal, then apply the filter again, then reverse the signal) !&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-10-19T14:32:13.837" Title="IIR issues when order is high" Tags="|filters|filter-design|signal-analysis|infinite-impulse-response|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="11164" PostTypeId="1" CreationDate="2013-10-18T18:53:08.207" Score="0" ViewCount="406" Body="&lt;p&gt;This document on HRTFs, &lt;a href=&quot;http://www.audiogroup.web.fh-koeln.de/FILES/AIA-DAGA2013_HRIRs.pdf&quot; rel=&quot;nofollow&quot;&gt;A Spherical Far Field HRIR/HRTF Compilation, of the Neumann KU 100&lt;/a&gt;, talks about headphone compensation filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Searching Google returns &lt;a href=&quot;http://www.ak.tu-berlin.de/fileadmin/a0135/Publikationen/2010/Brinkmann_2010_On_the_effect_of_individual_headphone_compensation_in_binaural_synthesis.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ak.tu-berlin.de/fileadmin/a0135/Publikationen/2010/Brinkmann_2010_On_the_effect_of_individual_headphone_compensation_in_binaural_synthesis.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are technical documents, and I am not an expert in the field, I have no training in signals processing, so it is difficult for me to see what is being said.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean that I could improve my HRIRs by getting hold of a HPTF filter suited for my headphones, and convolving them with it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any chance such a transfer function might be available for these particular headphones (&lt;a href=&quot;http://store.apple.com/uk/product/MD827ZM/A/apple-earpods-with-remote-and-mic&quot; rel=&quot;nofollow&quot;&gt;Apple EarPods&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2013-10-18T21:47:44.620" Title="Implementing headphone transfer function (HPTF)" Tags="|impulse-response|transfer-function|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11165" PostTypeId="2" ParentId="11164" CreationDate="2013-10-18T21:47:44.620" Score="2" Body="&lt;p&gt;Properly equalization improves the spectral accuracy of a binaural playback. It does not improve the spatial properties of the HRTFs other than that vertical localization is heavily dependent on proper spectral playback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best headphones for binaural playback tend to be diffuse field equalized and &quot;acoustically open&quot;. This means that the headphone itself doesn't change the acoustic radiation impedance as seen from the ear canal into the outside world. It can actually be shown that headsets that are &quot;acoustically open&quot; do not require specific headphone equalization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not very optimistic about using Apple EarPods for this application. There is a huge amount of placement variability just through the way how deep and how hard you shove them into the ear canal. Small leaks between the pod and the walls of the ear canal make big changes in the frequency response and these vary greatly from person to person and even from placement to placement. So even if there was a set of functions published, it would not be a good fit for a specific person and placement.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-18T21:47:44.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11166" PostTypeId="2" ParentId="11163" CreationDate="2013-10-18T21:52:30.560" Score="2" Body="&lt;p&gt;Break higher order filters down into cascaded second order sections (or biquads). This is covered in every text book on DSP such as &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-18T21:52:30.560" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11167" PostTypeId="2" ParentId="11162" CreationDate="2013-10-18T22:02:07.553" Score="2" Body="&lt;p&gt;Choosing points in the horizontal plane with proper spacing seems like the right approach. Aneochic HRTFs are probably the easiest but typically lead to &quot;inside the head&quot; localization. Depending on your application this may or may not be a good thing. If you want externalization it's best to use binaural room impulse responses measured in a space that's similar to where the actual playback happens (there are psychological reasons for that). However these binuaral room impulse responses are a lot more complicated and require significantly more computational effort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You cannot binauralize a measured monaural impulse response after the fact. A real binaural room impulse response consists of the direct sound plus many reflections that all come from different directions. So each part of the room impulse response contains many different anechoic HRTFs. There are however computer programs that allow you to put in a geometry, acoustic properties and then they will calculate a binaural room impulse response.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-18T22:02:07.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11168" PostTypeId="2" ParentId="11161" CreationDate="2013-10-18T22:04:40.237" Score="1" Body="&lt;p&gt;Depends mostly on your playback headset. If it's diffuse field equalized, use the diffuse field set. For most headsets, this will be the best choice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference is overall equalization, so you can turn one into the other with a simple filter that gets applied to all HRTFs&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-18T22:04:40.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11169" PostTypeId="2" ParentId="11162" CreationDate="2013-10-18T22:48:00.337" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm wondering whether HRIRs from an echoic environment may present more cues, and hence provide better localisation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not likely.  Remember that it is your brain and not your ears that is doing all the work when it comes to localization.  What I mean to say is, in order for this type of localization to be effective, you need to trick the brain into thinking that &lt;em&gt;the surfaces in the room you are in&lt;/em&gt; caused the echo.  Otherwise the auditory cues will be more confusing than helpful.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;is it possible to take an impulse response for a cathedral, and convolve it with each HRTF?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is definitely not the right approach.  Any extra information that might be gleaned from the echo is lost when you assume that the echo is the same coming from all directions.  In other words, you are encoding the exact same information into every HRTF, which means that you have not done anything to make each HRTF more distinguishable from the others. If you had a &lt;em&gt;unique&lt;/em&gt; cathedral response per HRTF, then it might be worth trying.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-10-18T22:48:00.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11170" PostTypeId="1" CreationDate="2013-10-18T23:29:30.600" Score="2" ViewCount="42" Body="&lt;p&gt;I am trying to create or find a sound that localises well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read that emergency vehicles are changing their sirens; people found it difficult to localise the sound of the old siren (a sinusoidal sweep), and apparently this led to a lot of accidents. Apparently a single frequency is difficult to localise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've experimented using harmonic tones — I found that my brain can resolve higher frequencies, say &gt; 600Hz, much better than lower frequencies,  say &amp;lt; 150Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately this is no good to me — I'm building a musical trainer game, and it's important that I communicate a direction without suggesting a pitch, so I need something else, maybe something like the sound of glass breaking or a clap -- anything that doesn't suggest a pitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've experimented with static bursts, and found they don't localise nearly as well as the tones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone suggest a good sample sound source?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder whether something like a twig snapping would trigger some sort of primal reflex :)&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="4655" LastEditDate="2013-10-19T04:46:11.647" LastActivityDate="2013-10-19T13:11:25.093" Title="Designing a sound that localises well" Tags="|spatial|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11173" PostTypeId="1" CreationDate="2013-10-19T03:02:56.170" Score="2" ViewCount="12733" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eCpbp.gif&quot; alt=&quot;enter image description here&quot;&gt;&#xA;So I found this answer on one of the questions. I wanted to ask how the complex part can be related with the phase shift. I wanted to ask this on the same question but it didn't allow me. Could anyone please help me understand this concept. Even if I imagine this as a spiral with the value of the imaginary part changing, the starting time of the wave remains the same doesn't it? So how is it related to phase shift?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Negative frequency doesn't make much sense for sinusoids, but the Fourier transform doesn't break up a signal into sinusoids, it breaks it up into complex exponentials:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F(\omega)=\int_{-\infty}^{\infty} f(t)e^{−jωt}dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are actually spirals, spinning around in the complex plane:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;complex exponential showing time and real and imaginary axes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spirals can be either left-handed or right-handed (rotating clockwise or counterclockwise), which is where the concept of negative frequency comes from. You can also think of it as the phase angle going forward or backward in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of real signals, there are always two equal-amplitude complex exponentials, rotating in opposite directions, so that their real parts combine and imaginary parts cancel out, leaving only a real sinusoid as the result. This is why the spectrum of a sine wave always has 2 spikes, one positive frequency and one negative. Depending on the phase of the two spirals, they could cancel out leaving a purely real sine wave or a real cosine wave or a purely imaginary sine wave, etc.&quot;&lt;/p&gt;&#xA;" OwnerUserId="5706" LastEditorUserId="76" LastEditDate="2013-10-20T05:31:57.983" LastActivityDate="2013-12-19T13:25:54.680" Title="How do you relate imaginary numbers with phase shift? How to imagine this?" Tags="|frequency-spectrum|phase|fourier|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11174" PostTypeId="2" ParentId="11173" CreationDate="2013-10-19T05:04:57.803" Score="0" Body="&lt;p&gt;The way I understand it is with a equation like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=sin(x)*cos(n)+cos(x)*sin(n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;plotting y vs x, if you change the value of n from [0, π/2], you will see a sine wave move in phase from [0,-π/2] as cos(n) goes from [1, 0] and sin(n) goes the opposite way from [0, 1], so you are varying the amount to sine component vs cosine component to generate a phase shifting sine wave. This comes from the trig identities&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sin(x+y) = sin(x)*cos(y)+cos(x)*sin(y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform performs a series of correlations with sine wave and cosine wave giving you an amount of sine correlation vs cosine correlation for each frequency. The sine and cosine represent orthogonal components of the signal and so to determine the amplitude you need to sum the two vectors that are at right angles to each other, the angle of the resulting vector is the phase and the amplitude of the resulting vector is the amplitude.&lt;/p&gt;&#xA;" OwnerUserId="1144" LastActivityDate="2013-10-19T05:04:57.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11175" PostTypeId="1" AcceptedAnswerId="11188" CreationDate="2013-10-19T11:27:23.623" Score="3" ViewCount="1542" Body="&lt;p&gt;In error correction for example for Reed-Solomon codes there are computed syndromes for received data in decoding process. What is intuitively a syndrome (I don't mean the mathematical expression for it)?&lt;/p&gt;&#xA;" OwnerUserId="109" LastActivityDate="2013-10-20T01:12:45.830" Title="What is intuitively a syndrome in error correction?" Tags="|reed-solomon|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11176" PostTypeId="2" ParentId="11170" CreationDate="2013-10-19T13:11:25.093" Score="3" Body="&lt;p&gt;You want something that has lots of features in the spectral domain and in the time domain. However you have to be careful what other content or meaning you would like to convey or not. Spectra conveys pitch and/or coloration and timbre. Time transients convey rhythms and/or patterns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example you could do band limited noise burst with different center frequencies and patterns. That would allow yo to vary localization, spectrum and rhythm without directly conveying pitch. You could also use different percussion samples with different rhythms.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-19T13:11:25.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11177" PostTypeId="1" AcceptedAnswerId="58283" CreationDate="2013-10-19T13:52:15.613" Score="9" ViewCount="5341" Body="&lt;p&gt;Related question: &lt;a href=&quot;https://dsp.stackexchange.com/questions/707/what-are-the-practically-relevant-differences-between-various-image-resampling-m&quot;&gt;What are the practically relevant differences between various image resampling methods?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bilinear and bicubic interpolation for image resampling seem to be fairly common, but biquadratic is in my experience rarely heard of. To be sure, it's available in some programs and libraries, but generally it doesn't seem to be popular. This is further evidenced by there being Wikipedia articles for bilinear and bicubic interpolation, but none for biquadratic. Why is this the case?&lt;/p&gt;&#xA;" OwnerUserId="5713" LastEditorUserId="128" LastEditDate="2018-08-26T06:11:47.123" LastActivityDate="2019-05-12T16:32:44.877" Title="Why Is Bi Quadratic Interpolation for Image Resampling / Interpolation Rarely Done?" Tags="|image-processing|interpolation|resampling|biquad|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11178" PostTypeId="1" CreationDate="2013-10-19T14:31:33.713" Score="1" ViewCount="78" Body="&lt;p&gt;I have two signals, one whisper data and one normal voice data of the same sentence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to build a voice conversion, but just want to start off with some simple signal manipulations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to get the excitation of several vowels first to apply the excitation to the whispered data; basically to get a Electrolarynx kinda robotic sound. Therefore, I splitted the signal into smaller signals with only vowels. So now I have, e.g. an 'i' signal in whispered data and normal voice data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get the excitation now? These are some buzz words I heard concerning this topic: &#xA;- calculating the &lt;code&gt;fft&lt;/code&gt; of both signals&#xA;- inverse fft&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty clueless here, so any help/tip is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5612" LastActivityDate="2013-10-19T14:31:33.713" Title="Get excitation from two signals" Tags="|matlab|fft|voice|ifft|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11179" PostTypeId="2" ParentId="11163" CreationDate="2013-10-19T14:32:13.837" Score="1" Body="&lt;p&gt;Try this link, its a bit easier to use than an online program. It can generate notch filters up to 20 poles (even if it is a bit absurd).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.iowahills.com/4IIRFilterPage.html&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/4IIRFilterPage.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The program gives both 2nd order coefficients (biquads) and Nth order polynomial coefficients. There is also example C code on the site that shows how to implement the filter in either form.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-10-19T14:32:13.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11180" PostTypeId="1" CreationDate="2013-10-19T15:01:27.377" Score="0" ViewCount="38" Body="&lt;p&gt;This question follows from &lt;a href=&quot;https://dsp.stackexchange.com/questions/11170/designing-a-sound-that-localises-well&quot;&gt;Designing a sound that localises well&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am developing an experimental system for pitch training.  I am giving each of the 12 pitch-classes {C CD D DE E F FG G GA A AB B } an associated consonant phoneme: {d b r ng m v sh z h l k t }&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I could sing a chromatic scale 'da ba ra nga ... etc'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:  could I decouple the consonant from the vowel? So that the computer just gives the consonant as a cue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'k', for example, would be easy: I can just 'k' into a microphone,  but others like 'ma' would be harder as it is a half vowel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, would there be any way to communicate &quot;m&quot; without suggesting pitch?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for the less tricky consonants, like 'b',  how to separate the 'b'-ness from the 'a'-ness?  maybe I could sing 'ba' at 440Hz, and look at it on the frequency domain and just remove spectral components at 440, 880, 1320, ... ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or even better, I could take a slice half a second into the track which consist of pure 'aaa', convert it to the frequency domain,  and then take the beginning of the track and just subtract on the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I could even do this on the time domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would this work with 'maaaa'?  I don't think so, I think for half-vowels I might need to follow Hilmar's answer to the linked question, and construct my own set of transients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I could use a speech synthesiser to get my biphones 'da' 'ba' 'ra', and then work with that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-10-19T18:51:07.983" Title="Decoupling consonant phoneme" Tags="|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11181" PostTypeId="2" ParentId="11180" CreationDate="2013-10-19T18:51:07.983" Score="1" Body="&lt;p&gt;Consonants come in various types and classes. One major differentiation is voiced vs unvoiced (in German: &quot;stimmhaft&quot; vs. &quot;stimmlos&quot;, not sure I have the proper English words here). Voiced means that the vocal cords are moving which usually also results in a pitch perception (such as &quot;mmm&quot;). Unvoiced means the vocal cords do not move and there is not pitch (&quot;s&quot;, &quot;t&quot; for example).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks to me that most unvoiced consonants should do the trick. Not sure though whether your language has 12 of those. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further classifications of consonants and vowels see for example: &lt;a href=&quot;http://www.zompist.com/kitlong.html&quot; rel=&quot;nofollow&quot;&gt;http://www.zompist.com/kitlong.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-19T18:51:07.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11182" PostTypeId="1" AcceptedAnswerId="11187" CreationDate="2013-10-19T19:32:13.607" Score="1" ViewCount="2688" Body="&lt;p&gt;How is it possible to draw an &lt;strong&gt;audio frequency response graph&lt;/strong&gt; (x-axis : freq from 20 to 20 000hz, y-axis : dB)  from a simple equation like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[n] = x[n] - x[n-486]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Example: with this equation I get a nice &lt;code&gt;comb filter&lt;/code&gt; that removes frequency 197,5Hz and all its harmonics, for an audio file with sampling rate 96 Khz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to turn such an equation into a graphical interpretation like this&#xA;&lt;a href=&quot;http://downloadfreesamples.com/wp-content/uploads/2013/08/EQ-Four-CIS-DSP_3.jpg&quot; rel=&quot;nofollow&quot;&gt;http://downloadfreesamples.com/wp-content/uploads/2013/08/EQ-Four-CIS-DSP_3.jpg&lt;/a&gt; ?&#xA;Then I could see how deep / steep the filtering is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(PS : I continue to read references and online books about filter design that were given to me in previous questions, thanks for these references by the way.)&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-10-20T08:21:19.533" Title="Draw a frequency response graph from a simple equation" Tags="|filters|filter-design|signal-analysis|lowpass-filter|frequency-response|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11183" PostTypeId="2" ParentId="11182" CreationDate="2013-10-19T20:38:56.977" Score="-1" Body="&lt;p&gt;I finally found a solution (probably not the best, but ...) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Generate a 10 seconds white noise (which has flat frequency spectrum on 10 seconds average)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Apply the filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Display the spectrum in a Sound editor software (e.g. Sound forge) with averaging on the 10 seconds.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FMfjC.png&quot; alt=&quot;Frequency response of comb filter&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-10-19T20:38:56.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11184" PostTypeId="2" ParentId="11173" CreationDate="2013-10-19T21:53:47.780" Score="1" Body="&lt;p&gt;Paint a red dot on the blue complex spiral at t=0, where the value is 1.0.  Now roll the spiral upside-down until the red dot is at -1.0, still at t=0.  This roll would be equivalent to a phase shift of Pi.  Note that the real part no longer corresponds to a cosine wave that starts at t=0.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the real part of the rolled spiral does correspond to a cosine wave that starts (with value 1.0) at +Pi or -Pi, which is a different starting time, contradicting one of your assumptions above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus phase is related to starting time.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-19T21:53:47.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11185" PostTypeId="1" AcceptedAnswerId="11225" CreationDate="2013-10-19T21:55:48.143" Score="7" ViewCount="27913" Body="&lt;p&gt;I will try to explain what is my level of understanding of this problem, please correct me if I'm wrong:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;RMS is the Root Mean Square, it represent the mean value of the input signal.&lt;/li&gt;&#xA;&lt;li&gt;PSD is the measurement of the responses that shows me at which frequencies most of the energy is concentrated.&lt;/li&gt;&#xA;&lt;li&gt;The area below a curve is the integration of that function.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My situation is that several random vibration tests are performed. These tests are called random tests because of the input signal. In contrast to a sine test where the structure is excited with a sinusoidal input, only one frequency is excited at a time, here 'all' frequencies are excited at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case PSD is measured in ${{g^2}/{Hz}}$ and RMS in ${g_{RMS}}$. Armed with that it easy to see that if you multiply PSD per the frequency range and you take the root of the result you will get something in ${g}$'s, but I don't know how exactly derive the famous relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;{g_{RMS}=\sqrt{\int_{f_1}^{f_2}PSD(f)df}}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The understanding that I have is very basic and it would be great if someone give me a clear idea of the relations among the RMS, PSD and the real signal. Thank you very much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the figure I have plotted a standard random signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YP76C.jpg&quot; alt=&quot;Standard random signal&quot;&gt;  &lt;/p&gt;&#xA;" OwnerUserId="5160" LastEditorUserId="5160" LastEditDate="2013-10-22T16:18:51.483" LastActivityDate="2023-02-24T16:50:48.360" Title="Why the RMS of a PSD curve is the root of the area below" Tags="|power-spectral-density|random|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11186" PostTypeId="2" ParentId="11182" CreationDate="2013-10-19T22:06:00.533" Score="1" Body="&lt;p&gt;Factor 1-x^486 in the complex domain.  You will get a bunch of zeros on the unit circle.  Calculate the product of the distances to all these zeros as you travel around the unit circle from pi*(20/96000) to pi*(20/96).  Plot.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-19T22:06:00.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11187" PostTypeId="2" ParentId="11182" CreationDate="2013-10-19T22:20:17.750" Score="3" Body="&lt;p&gt;The tool of choice here is the z-transform, which is applied to your equation. It transforms sequences of complex numbers to functions in the complex plane. Its most useful properties are that it takes delays to powers of the argument z, and for &lt;code&gt;z = exp(i omega)&lt;/code&gt; we get the fourier transform of the transformed sequence. Look up the details, I'll just show you how it works here. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[n] = x[n] - x[n-486]  ---&amp;gt; Y(z) = X(z) - X(z)*z^(-486)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The equation in z-domain factors on the right hand side to give &lt;code&gt;Y(z) = X(z) ( 1 - z^(-486) )&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Y(z) is the output and X(z) is the input, for linear systems we define the transfer function to be &lt;code&gt;Y(z)/X(z) = H(z)&lt;/code&gt; and the above equation becomes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H(z) = Y(z)/X(z) = 1 - z^(-486)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now if we substitute z = exp(i omega) we get the frequency response of your system, which is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H_f(omega) = 1 - exp(i omega)^(-486)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and with the properties of exp() it simplifies to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H_f(omega) = 1 - exp(- 486 i omega)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need actual frequency f instead angular frequency omega, just substitute &lt;code&gt;omega = 2 pi f/fs&lt;/code&gt;, with sampling rate fs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you'll probably want to know just the magnitude of the response, so look at abs(H_f).&#xA;In this specific case it's very simple to calculate because &lt;code&gt;abs(H_f) = sqrt( H_f * conj(H_f) )&lt;/code&gt; and &lt;code&gt;conj(H_f) = 1 - exp(+ 486 i omega)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As requested, some code. Here's what you can do in matlab/octave to get the magnitude frequency response with a logarithmic frequency axis and magnitude axis in dB.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Create a logarithmically spaced frequency axis with range 20Hz to 20kHz&#xA;&#xA;fAxis = logspace( log10( 20 ) , log10( 20000) , 10000);&#xA;&#xA;% calculate the complex frequency response at these frequencies&#xA;&#xA;% Set SampleRate before calling this, like SampleRate = 44100;&#xA;&#xA;Hf = 1 - exp(1i*486*2*pi*fAxis/SampleRate);&#xA;&#xA;% plot the magnitude spectrum&#xA;&#xA;semilogx(fAxis,10*log10(Hf.*conj(Hf)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="39" LastEditDate="2013-10-20T08:21:19.533" LastActivityDate="2013-10-20T08:21:19.533" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11188" PostTypeId="2" ParentId="11175" CreationDate="2013-10-19T23:20:23.787" Score="4" Body="&lt;p&gt;The word &lt;em&gt;syndrome&lt;/em&gt; was introduced into error-control coding theory &#xA;and practice (by Hagelbarger) very early on. It is a term borrowed from&#xA;medicine: a syndrome is a &lt;em&gt;group of symptoms&lt;/em&gt;, e.g. stomachache, nausea,&#xA;fever, lack of appetite, which &lt;em&gt;together&lt;/em&gt; are diagnostic (or highly suggestive)&#xA;of the presence of a &lt;em&gt;specific&lt;/em&gt; disease or condition -- in this instance, appendicitis.  Note that the presence of a single symptom is usually not&#xA;considered diagnostic of a specific disease, it is the presence of the&#xA;syndrome or a collection of symptoms.&#xA;This notion in medicine is almost exactly mirrored in&#xA;the error-control coding world. If the syndrome is identically&#xA;zero (there are no symptoms whatsoever), nothing needs to be&#xA;done, and the received word is accepted as correct (no disease&#xA;is diagnosed and no treatment is prescribed).&#xA;A nonzero syndrome indicates that the received word has errors&#xA;in it (the presence of symptoms means that something is not right&#xA;with the patient), and in most cases, the syndrome is also diagnostic&#xA;of the locations of the errors and what needs to be done to correct them&#xA;with the (Reed-Solomon) decoder substituting for the physician's&#xA;thought processes (from syndrome, find the error locations and values)&#xA;and actions such as prescribing medicines or performing surgery&#xA;(correct the errors, fill in the erasures, etc.).  In some&#xA;cases, the fact that the syndrome is nonzero indicates the presence&#xA;of errors but the decoder is not able  to determine the error &#xA;locations and values (and so is unable to correct the errors).&#xA;This is called &lt;em&gt;decoder failure.&lt;/em&gt;  In even fewer cases, the syndrome&#xA;indicates a specific error pattern as the most likely cause but in fact the&#xA;actual error pattern is something else. Correcting what the decoder&#xA;thinks is the error pattern introduces more errors into the&#xA;received word, thus making it &quot;wronger&quot; than before, but&#xA;this is not detectable at the receiver. This is not called decoder&#xA;malpractice but &lt;em&gt;decoder error&lt;/em&gt; or &lt;em&gt;undetected error&lt;/em&gt;, and is,&#xA;fortunately, a very rare event, much rarer than decoder failure.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-10-20T01:12:45.830" LastActivityDate="2013-10-20T01:12:45.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11189" PostTypeId="1" CreationDate="2013-10-20T04:19:49.493" Score="2" ViewCount="6415" Body="&lt;p&gt;In this question, we consider the Hilbert space of vectors in $\mathbb{R}^4$ with one of its basis $\{v_0, v_1, v_2, v_3\}$.&#xA;Given the first three basis vectors&#xA;$$v_0=\left[\begin{array}{c}&#xA;1/2\\&#xA;1/2\\&#xA;1/2\\&#xA;1/2&#xA;\end{array}\right]v_1=\left[\begin{array}{c}&#xA;1/2\\&#xA;1/2\\&#xA;-1/2\\&#xA;-1/2&#xA;\end{array}\right]&#xA;v_2=\left[\begin{array}{c}&#xA;1/2\\&#xA;-1/2\\&#xA;1/2\\&#xA;-1/2&#xA;\end{array}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many possibilit(y/ies) are there for $v_3$, such that $\{v_0, v_1, v_2, v_3\}$ is an orthogonal basis of $\mathbb{R}^4$? Give one example of $v_3$ please.&lt;/p&gt;&#xA;" OwnerUserId="7676" LastEditorUserId="80" LastEditDate="2018-01-22T12:46:26.757" LastActivityDate="2020-12-02T22:28:09.127" Title="Find $v_3$ such that $\{v_0, v_1, v_2, v_3\}$ is an orthogonal basis of $\mathbb{R}^4$?" Tags="|homework|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11192" PostTypeId="2" ParentId="11177" CreationDate="2013-10-20T06:10:41.987" Score="3" Body="&lt;p&gt;More expensive computationally with marginal results. Most images don't require such interpolation technique. You can also look at this question: &lt;a href=&quot;https://dsp.stackexchange.com/questions/10927/higher-order-spline-interpolation&quot;&gt;Higher order spline interpolation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-10-20T06:10:41.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11193" PostTypeId="1" CreationDate="2013-10-20T08:15:06.533" Score="2" ViewCount="94" Body="&lt;p&gt;Does any one of you know what topic to teach people related to signal processing.&#xA;The audience is mainly for a group of software programmer working on a telecommunication product who have limited knowledge of signal processing.&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5717" LastActivityDate="2013-10-20T13:30:02.407" Title="DSP Topic for Newcomers" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11194" PostTypeId="2" ParentId="11189" CreationDate="2013-10-20T09:27:33.800" Score="3" Body="&lt;p&gt;let $v_3 = \left[\begin{array}{vector}&#xA;a\\&#xA;b\\&#xA;c\\&#xA;d\end{array}\right]$, then $&amp;lt;v_0, v_3&amp;gt;=0, &amp;lt;v_1, v_3&amp;gt;=0, &amp;lt;v_2, v_3&amp;gt;=0, &amp;lt;v_3, v_3&amp;gt;=1$,&#xA;reduce to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a+b=0 &#xA;a+c=0&#xA;a-d=0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and $a^2+b^2+c^2+d^2 = 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so there are many solutions, one example can be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \left[\begin{array}{arr}&#xA; \frac{1}{2}\\&#xA; -\frac{1}{2}\\&#xA; -\frac{1}{2}\\&#xA; \frac{1}{2}\end&#xA;{array} \right]$&lt;/p&gt;&#xA;" OwnerUserId="7676" LastEditorUserId="7676" LastEditDate="2013-10-20T09:35:44.133" LastActivityDate="2013-10-20T09:35:44.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11195" PostTypeId="2" ParentId="11193" CreationDate="2013-10-20T09:59:17.990" Score="1" Body="&lt;p&gt;I think the  most fundamental things that anybody trying to understand DSP should know are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Nyqvist Sampling Theorem and Effects of Aliasing&lt;/li&gt;&#xA;&lt;li&gt;Need for DFT and the use of FFT to achieve the same.&lt;/li&gt;&#xA;&lt;li&gt;Basics of Digital Filters.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You have mentioned the audience as telecommunication engineers. So you could also add a lecture on the  need for modulation,some basic modulation and demodulation techniques and need for interpolation and decimation.&lt;/p&gt;&#xA;" OwnerUserId="4375" LastActivityDate="2013-10-20T09:59:17.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11198" PostTypeId="1" CreationDate="2013-10-20T11:48:34.520" Score="1" ViewCount="7703" Body="&lt;p&gt;I am trying to find the amplitude and phase plots of the saw tooth waveform pictured.I have already computed the Fourier series of the waveform but I don't know how to derive the amplitude and phase plots from the sawtooth's Fourier series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YGfyx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;   x(t) = \begin{cases}&#xA;          \frac{V}{T}t + V &amp;amp; \text{$-T &amp;lt; t &amp;lt; 0$} \\ \\ \\ \\&#xA;          \frac{V}{T}t &amp;amp; \text{$0 &amp;lt; t &amp;lt; T $ } \\&#xA;         \end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Complex Fourier series of this waveform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  x(t) = \sum_{n=-\infty}^{n = \infty} C_n e^{jnw_0t}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = \sum_{n=\infty}^{n=\infty}\left[ \frac{jV}{nw_0T} e^{jnw_0t} &#xA;      + \left( \frac{jV}{2nw_0T} - \frac{V}{n^2w_0^2T^2} \right) e^{jnw_0(t + \frac{T}{2})} &#xA;      + \left( \frac{V}{n^2w_0^2T^2} + \frac{jV}{nw_0T}   \right) e^{jnw_0(t - \frac{T}{2})}      &#xA;\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    w_0 = 2 \pi f_0 = \frac{2 \pi}{T}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the amplitude plot is $|C_n|$ vs Frequency and the phase plot is $Arg(C_n)$ vs frequency but how would I do the get the amplitudes and phases from a fourier series such as this one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Addition:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simplifying x(t) by replacing $w_0T = 2\pi$ and $e^{j\pi} = -1$ gives me&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  x(t) = \sum_{n=-\infty}^{n=\infty} &#xA;        \begin{cases}&#xA;      \frac{V}{2\pi n}\left( \frac{2 + 3(-1)^n}{2} \right) e^{j \left( \frac{2 \pi n t}{T} + \frac{\pi}{2} \right)} &amp;amp;  \text{if n $\ne$ 0} \\ \\ \\ \\ \\&#xA;      C_0 = \frac{VT}{2} &amp;amp; \text{ if n = 0 }&#xA;         \end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still not sure how I can interpret this, but it seems for $f = 0$, amplitude = $\frac{VT}{2}$ and phase = 0, and for f = $\frac{n}{T}$, amplitude = $\frac{5V}{4 \pi n}$ ( for even n ) and $\frac{V}{4 \pi n}$ (for odd n), with the phase = $\frac{2 \pi nt}{T} + \frac{\pi}{2}$ for both even and odd cases, is that right?&lt;/p&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="4376" LastEditDate="2013-10-21T10:18:42.617" LastActivityDate="2013-10-21T10:18:42.617" Title="The Fourier Series, Amplitude and Phase Plot of a Saw Tooth Waveform" Tags="|frequency-spectrum|homework|fourier-series|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11199" PostTypeId="2" ParentId="11173" CreationDate="2013-10-20T12:17:05.080" Score="-1" Body="&lt;p&gt;I think the 3D plot is making this concept more difficult than it really is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is f(t) = cos(2πft), then the phase of f(t) is simply 2πft. The real part of the vector is cos(2πft) and the imaginary part is sin(2πft).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure why someone would use a 3D plot to describe this. These concepts remain on the complex plane, and the angle of the vector (its phase) is simply 2πft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3D plot you show is how we explain the phase of a propagating plane wave. Then the distance between each loop of the spiral is called the wavelength and is equal to c*T where c is the speed of light and T is the period of the signal. These concepts are important to RF engineers for example, who need to understand the phase of the voltage and current at each point in space as the signal propagates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you will have less difficulty if you stay on the complex plane.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-10-20T12:17:05.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11200" PostTypeId="2" ParentId="11193" CreationDate="2013-10-20T13:30:02.407" Score="0" Body="&lt;p&gt;&quot;Limited knowledge&quot; could take on quite a range of values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would try to relate DSP topics to concepts they are familiar with. For example, they surely understand the concept of a histogram, so relate that to an FFT. Or relate a moving average to a low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply some filtering to a popular musical clip so they can hear the effects. Or take an FFT of some data they are familiar with, preferably some data with a cyclical event occurring, and show how that event appears in the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-10-20T13:30:02.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11202" PostTypeId="2" ParentId="10359" CreationDate="2013-10-20T16:59:50.190" Score="0" Body="&lt;p&gt;You can try &quot;extended maxima transform&quot; which is a morphological reconstruction method. It detects maxima points given a contrast criterion which you can invert and impose. It is implemented in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="4150" LastActivityDate="2013-10-20T16:59:50.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11203" PostTypeId="1" CreationDate="2013-10-20T19:13:10.037" Score="2" ViewCount="696" Body="&lt;p&gt;Currently I'm working out plotting biquads in a VST/AU plugin and have problems with the graphics part. I posted in several forums but haven't got a really useful answer for this case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, tell me if I'm right how to get the magnitude response. For this I use this equation&#xA;&lt;a href=&quot;http://rs-met.com/documents/dsp/BasicDigitalFilters.pdf&quot; rel=&quot;nofollow&quot;&gt;http://rs-met.com/documents/dsp/BasicDigitalFilters.pdf&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right that I have to get an array of values, the &quot;points&quot; which are my Y-axis values in my filter plot?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, so good. Now, how should I move on to plot this magnitude on screen? I'm really on a point I don't know how to go on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the WDL/IPlug framework in which I can use DrawPoints(x,y) and DrawLine (x,y,x1,y1) classes for drawing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated, especially code examples/snippets (I'm learning easier when I can see it...)! &lt;/p&gt;&#xA;" OwnerUserId="5729" LastEditorUserId="29" LastEditDate="2016-01-26T00:22:01.087" LastActivityDate="2016-01-26T00:22:01.087" Title="Plot Magnitude from RBJ Biquad" Tags="|biquad|magnitude|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11204" PostTypeId="1" CreationDate="2013-10-20T21:25:13.403" Score="0" ViewCount="898" Body="&lt;p&gt;It seems that 2D Wigner-Ville has been used to test the compression of data.&#xA;The interference is however a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can someone send me a link to a code where this has been done?&lt;/strong&gt;&#xA;I want to study the code and change it little study the compression and Wigner distribution.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ece.rice.edu/~wakin/images/&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt;, seems to be basic steps to make 512x512 matrix out of the picture.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;So it is now only the application of the distribution to the image.&lt;/li&gt;&#xA;&lt;li&gt;Then, JPEG2000 compression of the resulted image to test.&lt;/li&gt;&#xA;&lt;li&gt;And make a plot PSNR(dB) as a function of Coding Rate (bits per pixel).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Where and how can you apply Wigner-Ville to the image?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to apply the function and Fourier transformation to every single pixel of the picture, &lt;a href=&quot;http://optica.csic.es/papers/ipwig.rev.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the Lena picture in 512x512 in Matlab, done by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lena512 = imread('lena512.bmp');&#xA;lena512 = double(lena512);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am reading the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/35092-wavelet-scale-spectra/content/Wavelets/Wavelab850/Datasets/lenna.txt&quot; rel=&quot;nofollow&quot;&gt;package&lt;/a&gt; here and thinking where Wigner has been possibly been applied.&#xA;Not sure if used at all.&#xA;However, it speaks there something about autocorrelation so it can be possibly applied in code:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The long-range correlations in the original series are eliminated by&#xA;  the wavelet transform, and that the wavelet coefficients form series&#xA;  with virtually no autocorrelation or cross-correlation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Where Wigner Distribution has been applied to the Lena picture?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5633" LastEditorUserId="5633" LastEditDate="2013-10-20T22:18:20.483" LastActivityDate="2014-01-30T22:21:43.493" Title="Applying discrete Wigner-Ville distribution to Lena picture?" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11205" PostTypeId="1" AcceptedAnswerId="11210" CreationDate="2013-10-21T03:06:37.660" Score="7" ViewCount="3032" Body="&lt;p&gt;I've recently started playing with the Kalman filter for a simple 2D (x,y,dx,dy) tracking toy problem. But I seem to have some misunderstanding on what I can expect from the filter. I'm interested in plotting the uncertainty ellipse from the corrected covariance matrix but noticed a few observations:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The covariance decreases to a steady state regardless of how much error I introduce into the measurement.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The variance for x and y are exactly the same even though I introduce more measurement errors in y.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Staring at the maths for a bit it seems that this is how the vanilla Kalman Filter works. What I'm expecting is the opposite of the two points mentioned above. In the end I want to plot an uncertainty ellipse that reflects the error I'm observing. Is this possible at all? Do I have to do some post processing on the covariance matrix?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;ANSWER:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It occurred to me what I needed was a Kalman Filter that has the ability to adapt its covariance. I found this paper that details a few different methods to do this.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Evaluating the performances of adaptive Kalman filter methods in GPS/INS integration by Ali Almagbile, Jinling Wang, and Weidong Ding, 2010&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5733" LastEditorUserId="5733" LastEditDate="2021-02-24T06:11:21.667" LastActivityDate="2021-02-24T06:11:21.667" Title="Kalman Filter Covariance" Tags="|kalman-filters|bayesian-estimation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11206" PostTypeId="1" AcceptedAnswerId="11209" CreationDate="2013-10-21T04:13:33.900" Score="3" ViewCount="5300" Body="&lt;p&gt;For a system such that $y[n]=\cos(x[n])$, I'd like to determine whether the system is causal or not.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Definition 1: A system is causal if and only if the output $y[n]$ is a function of a linear combination of inputs $x[n-k]$ such that $k \ge0 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see that the system is causal by this definition because $y[n]$ only ever depends on $x[n]$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Definition 2: A system is causal if and only if the impulse response $h[n]=0$ for all $n&amp;lt;0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response of the system to $\delta[n]$ is $h[n]=\cos(\delta[n])$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[-1]=\cos(0)=1 \ne 0 \quad \therefore\text{The system is not causal.}$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Have I hit a paradox? Am I missing something here?&lt;/p&gt;&#xA;" OwnerUserId="3747" LastEditorUserId="1629" LastEditDate="2016-09-03T15:16:39.547" LastActivityDate="2020-10-13T17:05:32.380" Title="Causal systems - Paradox? Confusion of definition?" Tags="|linear-systems|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11207" PostTypeId="2" ParentId="8302" CreationDate="2013-10-21T04:42:52.130" Score="0" Body="&lt;p&gt;Q3 When it comes to Baseband Sampling ( Low pass Sampling ) sampling theorem states that &quot; Fs &gt; twice the Highest frequency Component&quot; and for Bandpass Sampling, sampling theorem says Fs &gt; twice the Bandwidth of the signal. why two different sampling statements for the same signal of B hertz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both  statements are same, how? highest frequency of baseband signal defines the bandwidth of that signal because signal starts form zero frequency (bandwidth= highest frequency-zero =highest frequency ) so both are same things in Baseband Sampling ( Low pass Sampling ) sampling theorem, either you say Fs&gt;twice the Highest frequency Component or Fs &gt; twice the Bandwidth of the signal.&lt;/p&gt;&#xA;" OwnerUserId="5734" LastActivityDate="2013-10-21T04:42:52.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11208" PostTypeId="1" CreationDate="2013-10-21T06:07:49.163" Score="6" ViewCount="3113" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Wiener Deconvolution&lt;/a&gt; shows this formula:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ G(f) = \frac{H^*(f)S(f)}{ |H(f)|^2 S(f) + N(f) }&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Could someone explain the derivation?&lt;br /&gt;&#xA;Specifically, where does the squaring (&lt;span class=&quot;math-container&quot;&gt;$|H(f)|^2$&lt;/span&gt;) come from?&lt;/p&gt;&#xA;" OwnerUserId="5723" LastEditorUserId="128" LastEditDate="2020-11-17T07:44:13.653" LastActivityDate="2023-04-04T16:56:10.923" Title="How Is the Formula for the Wiener Deconvolution Derived?" Tags="|estimation|deconvolution|inverse-problem|wiener-filter|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11209" PostTypeId="2" ParentId="11206" CreationDate="2013-10-21T06:23:51.037" Score="7" Body="&lt;p&gt;You have your definition of causality wrong. It's actually much simpler and much more intuitive. A causal system is a system in which the output does not depend on future values of the input. This property is not exclusive linear systems and can apply to systems in general. Here are a few examples to illustrate the point:&lt;/p&gt;&#xA;&lt;h3&gt;Causal linear time-invariant system:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = x[n] - 2x[n-1] + 0.5y[n-1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; only depends on current and previous values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h3&gt;Non-causal linear time-invariant system:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = \frac{1}{2}x[n-1] + \frac{1}{2}x[n+1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also known as a central moving average, this function is non-causal because for output &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$x[n+1]$&lt;/span&gt; term peeks into the future of our input.&lt;/p&gt;&#xA;&lt;h3&gt;Causal non-linear time-invariant system:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = \cos(x[n])$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the example you provided. As you may have guessed by now, since we never look at a future input, this system is causal. In fact, it's even more special than that. Because the current output is a function only of the current input (not past or future inputs) this system is called a &lt;em&gt;memoryless&lt;/em&gt; system.&lt;/p&gt;&#xA;&lt;h3&gt;Causal linear time-varying system:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = (n+1)x[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I made this one up to be somewhat of a brainteaser. At the first glance, it may seem like this system is non-causal because there's this &lt;span class=&quot;math-container&quot;&gt;$(n+1)$&lt;/span&gt; term. But this doesn't mater because it's not a time index of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. We still only look at the current value of the input and are not peeking ahead. This is also an example of a memoryless system.&lt;/p&gt;&#xA;&lt;h3&gt;A tricky causal non-linear time-varying system:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = e^nx[n] + \ln\left(\left|x[n-1]\right|+1\right) - \pi y[n+1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Clearly, clearly this is a non-causal system because of the &lt;span class=&quot;math-container&quot;&gt;$y[n+1]$&lt;/span&gt; term, right? Wrong! This is a classic definition of a recursive causal system with a few terms rearranged. We proceed to bring it into a more standard form in three steps:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = e^nx[n] + \ln\left(\left|x[n-1]\right|+1\right) - \pi y[n+1]$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\pi y[n+1] = e^nx[n] + \ln\left(\left|x[n-1]\right|+1\right) - y[n]$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\pi y[k] = e^nx[k-1] + \ln\left(\left|x[k-2]\right|+1\right) - y[k-1]$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$y[k] = \frac{e^nx[k-1] + \ln\left(\left|x[k-2]\right|+1\right) - y[k-1]}{\pi}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Second to last line was achieved by substituting &lt;span class=&quot;math-container&quot;&gt;$k=n+1$&lt;/span&gt;. The trick here is that there is a relationships between outputs at different times. But once you work it out, no &lt;em&gt;output&lt;/em&gt; ever depends on future value of an &lt;em&gt;input&lt;/em&gt; relative to itself. Non-linearity and time-variance were thrown in to make it more fun and challenging. Make sure you understand what this one says.&lt;/p&gt;&#xA;&lt;p&gt;As you can see causality can be a property of all sorts of systems and there are many more fun and bizarre examples one can come up with.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now let's get to resolving your paradox. The key lies in realizing that your definitions of causality and linearity (and perhaps time-invariance, too) a bit entangled and confused. Solving the paradox amusingly is as easy as adding the word &lt;em&gt;linear&lt;/em&gt; into both of your definitions (time-invariance will also play a subtle role). Here's how.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Definition 1: A &lt;em&gt;&lt;strong&gt;linear&lt;/strong&gt;&lt;/em&gt; system is causal if and only if the output &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; is a&#xA;function of a linear combination of inputs &lt;span class=&quot;math-container&quot;&gt;$x[n-k]$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$k \ge0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is because not all systems are linear combinations of inputs. Linear systems are. A causal system depends only on past and current inputs, therefore a &lt;em&gt;causal linear&lt;/em&gt; system is a linear combination of current and previous inputs. Actually, to be accurate with the definition, linear systems are linear combinations of both inputs and outputs, and in causal linear systems outputs at time &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; cannot depend on an input at time &lt;span class=&quot;math-container&quot;&gt;$m \gt n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Definition 2: A &lt;em&gt;&lt;strong&gt;linear time-invariant&lt;/strong&gt;&lt;/em&gt; system is causal if and only if the impulse response&#xA;&lt;span class=&quot;math-container&quot;&gt;$h[n]=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$n&amp;lt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This one is also quite intuitive. All entries of &lt;span class=&quot;math-container&quot;&gt;$h[n-k]$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k \ge 0$&lt;/span&gt; are the coefficients with which you multiply current and past values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to get the current output (whether the system is recursive is irrelevant for this case). Notice that this definition &lt;strong&gt;only makes sense for linear time-invariant systems&lt;/strong&gt;! This is because convolution only exists for those. Let's see why linearity is necessary. If you have &lt;span class=&quot;math-container&quot;&gt;$h[n+1] \ne 0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$x[n+1]$&lt;/span&gt; is contributing to &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; and that's what makes it non-causal. This is true because in linear systems, if nothing goes in then nothing goes out. This is not generally true for non-linear systems (like in the example you gave), so this definition wouldn't apply.&lt;/p&gt;&#xA;&lt;p&gt;The system also needs to be time-invariant because it cannot be completely defined by its impulse response unless it's full on LTI. If you run a impulse function &lt;span class=&quot;math-container&quot;&gt;$\delta [n]$&lt;/span&gt; through the system&#xA;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = x[n] + (n+1)x[n+1],$$&lt;/span&gt;&#xA;you're going to get an output which is an impulse itself (causal... right?). However, the system is clearly non-causal. This is why time-invariance is important. When you run a shifted impulse function &lt;span class=&quot;math-container&quot;&gt;$\delta[n-m]$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$m \ne 0$&lt;/span&gt;, its non-causal nature starts manifesting itself.&lt;/p&gt;&#xA;&lt;p&gt;So, all talking aside, your system is perfectly causal, but your definitions only apply to linear systems, while your system is non-linear. The correct definition of a causal system is that any output &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; cannot depend on input &lt;span class=&quot;math-container&quot;&gt;$x[n+k]$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$k \gt 0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-10-23T17:58:34.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11210" PostTypeId="2" ParentId="11205" CreationDate="2013-10-21T08:07:32.820" Score="3" Body="&lt;p&gt;The covariance matrix of a Kalman filter is a function of the $ Q $ and $ R $ matrices of the model.&lt;br&gt;&#xA;If you use a model where $ R $ and $ Q $ are time invariant or known in prior then the calculation of the covariance matrix $ P $ can be done offline and isn't a function of the measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases, advanced implementations of Kalman Filter estimate the covariances $ R $ and $ Q $ on line according to some data gathered in the process of calculating the result.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-07-02T08:39:44.827" LastActivityDate="2018-07-02T08:39:44.827" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11211" PostTypeId="2" ParentId="11204" CreationDate="2013-10-21T08:42:23.857" Score="1" Body="&lt;p&gt;The developers of &lt;a href=&quot;http://qualvisual.net/Lucid.php&quot; rel=&quot;nofollow&quot;&gt;Lucid&lt;/a&gt;, which is based on time-frequency analysis, report interesting results. Technical details are provided in this &lt;a href=&quot;https://www.google.ae/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CDIQFjAA&amp;amp;url=http://www.qualvisual.net/DownLoadTime.php&amp;amp;ei=mOhkUtCtEfD50gXlwIHQAQ&amp;amp;usg=AFQjCNGgxTqkZ9ktiSwKkq_-vHY6RKUlYg&amp;amp;sig2=FophIyrnzUGE5yWidn96AQ&amp;amp;bvm=bv.54934254,d.d2k&quot; rel=&quot;nofollow&quot;&gt;PowerPoint file&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-10-21T08:42:23.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11213" PostTypeId="1" CreationDate="2013-10-21T10:59:53.700" Score="1" ViewCount="749" Body="&lt;p&gt;Can anyone suggest an introduction to speech processing,&#xA;class notes or books&#xA;accompanied by programs that can be run to see what the algorithms do ?&lt;br&gt;&#xA;For example, in Burrus et al., &lt;a href=&quot;http://books.google.com/books?isbn=0132198258&quot; rel=&quot;nofollow&quot;&gt;Computer-Based Exercises for Signal Processing Using Matlab&lt;/a&gt;,&#xA;20 of the 400 pages are on speech processing. But it's from 1994;&#xA;there must be other hands-on books ?&lt;br&gt;&#xA;Books with reviews like the following may have their uses, but are not what I'm looking for:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I found this book comprehensive but incomprehensible, primarily because of the&#xA;  lack of real-world examples. It would benefit from a series of programming exercises&#xA;  with training sets&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(This question may be a tall order &amp;mdash; not many people ar good at theory &lt;em&gt;and&lt;/em&gt; practice &lt;em&gt;and&lt;/em&gt; explaining.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Should this be a community wiki ?)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="4389" LastEditDate="2013-10-22T18:27:47.313" LastActivityDate="2013-10-23T02:42:30.807" Title="Introduction to speech processing with code and examples?" Tags="|speech-recognition|reference-request|speech-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11215" PostTypeId="2" ParentId="11205" CreationDate="2013-10-21T12:26:27.073" Score="2" Body="&lt;p&gt;&lt;code&gt;The covariance decreases to a steady state regardless of how much error I introduce into the measurement.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, as @Drazick notes, if the $Q$ and $R$ matrices are time invariant, then the $P$ matrix will converge to a steady state that does not depend on the data (measurements).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;The variance for x and y are exactly the same even though I introduce more measurement errors in y.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you did that, did you change the $R$ matrix to take account of this extra error in one component over the other? (I'm assuming you just used $x$ and $y$ as the measurements).  If the $R$ matrix was chosen to be $\sigma I$, then you will not see any difference between $x$ and $y$ state variances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter#Estimation_of_the_noise_covariances_Qk_and_Rk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Even the Wikipedia page on Kalman filtering&lt;/a&gt; mentions what you can do if you need to estimate $Q$ and $R$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2017-06-30T10:41:11.913" LastActivityDate="2017-06-30T10:41:11.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11217" PostTypeId="1" AcceptedAnswerId="11221" CreationDate="2013-10-21T13:42:00.433" Score="2" ViewCount="436" Body="&lt;p&gt;Does the entropy of a symbol represent the most optimal average number of bits that can be used to represent a symbol? For example take the example of tossing a coin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;   H_{source} = -p_{head} log_2 p_{head} - p_{tail} log_2 p_{tail} &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    p_{head} = p_{tail} = \frac{1}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then H = 1 bit, but if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;   p_{head} = \frac{9}{10} , p_{tail} = \frac{1}{10}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then H = 0.468993 bits, meaning that if wanted to transmit the outcome of 10 coin tosses then I would know I use the most optimal coding scheme if my average number of bits I use to represent the outcome of the 10 coin tosses is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;   \text { Optimal Average Bits that would to be transmitted = Information } = NH&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is 10 bits in the first case but 4.7 bits in the second case.Is this right?&lt;/p&gt;&#xA;" OwnerUserId="4376" LastActivityDate="2013-10-21T16:03:14.157" Title="Entropy Of A Symbol" Tags="|digital-communications|information-theory|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11218" PostTypeId="1" CreationDate="2013-10-21T15:44:14.037" Score="2" ViewCount="171" Body="&lt;p&gt;I'm new to audio (and signal processing in general), and I've been learning about the AAC codec. I've read that it supports 1-48 synchronous channels in a single stream. My question is: what need is there for 48 channels in a single audio stream? I understand that if you have a 7.1 speaker setup you can send a separate channel to each speaker, but what is the need for 48 separate channels?&lt;/p&gt;&#xA;" OwnerUserId="5740" LastActivityDate="2013-12-10T11:17:14.763" Title="Reason for &gt;8 channels in an audio codec" Tags="|audio|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11219" PostTypeId="2" ParentId="11217" CreationDate="2013-10-21T15:48:35.037" Score="0" Body="&lt;p&gt;My understanding of entropy (as it applies to a system) is that it represents the number of different states a system can have. In the case of a coin toss, there's only one bit of entropy to represent which side of the coin it lands on (Assuming it always lands flat on one side). In a series of 10 coin tosses, you would have 10 bits of entropy to represent the 10 outcomes of the coin toss. You can think of tossing the coin as the active process of determining the state of the coin toss. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In regards to entropy representing the &quot;most optimal average number&quot; of bits to represent something, I wouldn't say that it is. What is &quot;most optimal?&quot; &lt;/p&gt;&#xA;" OwnerUserId="5739" LastActivityDate="2013-10-21T15:48:35.037" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11220" PostTypeId="2" ParentId="11218" CreationDate="2013-10-21T15:57:50.657" Score="4" Body="&lt;p&gt;Since it will most likely not hurt to have the possibility for more streams, this might for one be just to future-proof the system. Nothing would be more stupid than to specify for 8 channels and suddenly 9.1-systems become the next big thing and your codec is not suitable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that I can imagine bigger scenarios with much more channels such as recording all the voices in an orchestra. But I honestly don't know whether or not AAC is of any importance there.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-10-21T15:57:50.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11221" PostTypeId="2" ParentId="11217" CreationDate="2013-10-21T16:03:14.157" Score="4" Body="&lt;p&gt;Shannon's Lossless Source Coding theorem states that the expected length of any code is lower bounded by the entropy of the probability distribution over the symbols for that code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H\left(X\right) \leq \mathbb{E}_{P_{X}}\left(l \circ f\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\circ$ denotes the function composition operation, and $l$ is the length of the codeword assigned by the encoding function $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So any code you choose for your sequences of coin tosses should have its expected length greater than the entropy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a sequence of equally probable independent coin tosses, there is only one code we can choose (up to a permutation): encode H as 0 and T as 1. That is, we must use $n$ bits to encode the coin tosses. Since there is only a single encoding, it is optimal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a sequence of coin tosses, where a coin biased in favour  of heads is used, then we could also encode H as 0 and T as 1 - but we would be wasting space as we know that sequences containing heads are more likely. We could save space by assigning more probable sequences (HHHHHHHTTT for example) shorter codewords. One such encoding strategy is Huffman Coding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An optimal encoding, would be one where $\mathbb{E}_{P_{X}}\left(l \circ f\right)$ met $H\left(X\right)$ with equality - in your example where only 4.7 bits of space was needed to encode all 0/1 sequences of length 10. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shannon's theorem says, we can't possibly do better than the entropy (with zero error), but we can do a lot worse. In the biased coin case, mapping H to 0 and T to 1 wasted 5.3 bits!&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2013-10-21T16:03:14.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11222" PostTypeId="1" CreationDate="2013-10-21T16:11:18.667" Score="0" ViewCount="274" Body="&lt;p&gt;FFT of some signal $x$ has two parts: $|x|$, which is the magnitude spectrum and $arg(x)$, which is the phase spectrum. I want each frequency to have the same phase. Is there a way to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="5741" LastActivityDate="2013-10-21T16:11:18.667" Title="Constant phase for each frequency?" Tags="|fft|frequency-spectrum|signal-analysis|phase|magnitude|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11223" PostTypeId="2" ParentId="11218" CreationDate="2013-10-21T19:35:29.307" Score="2" Body="&lt;p&gt;As I understand it, codecs are used for much more than storing files on a hard drive. They are widely used in broadcasting and other multi-stream audio/video delivery applications where you may want to send more several channels of non-interrelated content.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-10-21T19:35:29.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11224" PostTypeId="2" ParentId="11203" CreationDate="2013-10-21T20:44:59.317" Score="1" Body="&lt;p&gt;Equation (18) in the pdf is correct to calculate the magnitude response for biquad filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you might know the magnitude response is plotted over the frequency. So you will need to define your points on your x-axis, which resembles the frequency $f$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In digital systems your frequency will go up to $f_s/2$, where $f_s$ is the sample rate. The $\omega$ is just $2\pi f$. So you just have to subsitute $\omega=2\pi f$ in Eq.(18) and calculate the magnitude response $|H(e^{j 2\pi f})|$ (y-axis) for desired frequency points (x-axis). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will end up with two vectors. One is the vector of frequencies $\mathbb{f}$ that you define. And the other vector is your calculated magnitude response $|H(e^{j 2\pi f})|$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not used WDL/IPlug frameworks, but I guess you can then just plot your graph using the DrawPoints(x,y) function, using the calculated value pairs. You may have to look into the documentation of the frameworks for further hints.&#xA;Depending on the resolution of the plot, you may want to increase the step size of your frequency vector, to increase performance.&lt;/p&gt;&#xA;" OwnerUserId="5545" LastActivityDate="2013-10-21T20:44:59.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11225" PostTypeId="2" ParentId="11185" CreationDate="2013-10-21T23:34:08.350" Score="8" Body="&lt;p&gt;I think this is simply an aspect of Parseval's Theorem (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;click me&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;It simply says: sum of squares in the discrete (digital) time domain equals sum of squares in the discrete frequency domain. Substitute &amp;quot;sum&amp;quot; for &amp;quot;integral&amp;quot; if using the continuous (analog) domain. In other words: total energy in the time domain equals total energy in the frequency domain.&lt;/p&gt;&#xA;&lt;p&gt;This can easily reproduce your formula, &lt;span class=&quot;math-container&quot;&gt;$g_{RMS}$&lt;/span&gt; represents the  time domain energy and the integral on the right represents the energy in the frequency domain. The exact scaling depends on the details like length of the signal, periodicity, sample rate, etc.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="17077" LastEditDate="2023-02-24T16:50:48.360" LastActivityDate="2023-02-24T16:50:48.360" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11226" PostTypeId="1" CreationDate="2013-10-22T08:08:00.187" Score="6" ViewCount="324" Body="&lt;p&gt;I was not quite sure what the right SE for this was, so I posted this also &lt;a href=&quot;https://scicomp.stackexchange.com/questions/8828/how-to-detect-specific-behavior-in-time-series&quot;&gt;here&lt;/a&gt; on SciComp. Please tell me which one to remove :)  &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Problem statement&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have a few hundred unrelated time series, say $P_i(t)$, with $i=1,2,...,N$. The sample times are all unequally spaced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is known that during certain (unknown) intervals, the trend in some of the time series is well-approximated by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    P_i(t) \approx \alpha - \beta \left(t_f-t\right)^\gamma\left(1 + \delta\cos\left(\omega\ln\left(t_f-t\right)+\phi\right)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;t_0 \leq t &amp;lt; t_f\\&#xA;\alpha,\beta &amp;gt; 0\\&#xA;0\leq\gamma,\delta\leq1\\&#xA;0\leq\phi&amp;lt;2\pi&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $\omega&amp;gt;0$ usually &quot;small&quot;, but not really restricted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of what such a function looks like: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mh4EY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this interval ($t &amp;gt; t_f$), there is nearly always a rapid decline, after which the signal continues as it did before the interval ($t&amp;lt;t_0$). Of course, each series also has zero-mean, normally distributed noise of varying strength superimposed on it, hence the approximate sign. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My task: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;to determine the intervals where this behavior occurs,&lt;/li&gt;&#xA;&lt;li&gt;find best-estimates for all the parameters listed above. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;My first stab at it&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Since each of these time series can be quite long and voluminous, and I have quite many series to analyze (and that number will likely grow over time), visual inspection is out of the question. Moreover: often, it is quite easy to miss this pattern by just looking at the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pattern consists of two main components:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a power-law (the $(t_f-t)^\gamma$-term)&lt;/li&gt;&#xA;&lt;li&gt;an oscillation with logarithmically varying period (the $\cos\left(\omega\ln\left(t_f-t\right)\right)$-term)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To detect the power law, I thought of the following procedure: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;smooth the signal to get rid of the noise and the periodic component&lt;/li&gt;&#xA;&lt;li&gt;take the first two derivatives numerically.&lt;/li&gt;&#xA;&lt;li&gt;Periods of consecutive positive first derivative are a necessary condition for the given power law -- continue analyzing only these periods ($t_0$ estimated)&lt;/li&gt;&#xA;&lt;li&gt;The division of the first derivative by the second makes it possible to estimate $t_f$. &lt;/li&gt;&#xA;&lt;li&gt;The standard deviation and mean of each element's estimate for $t_f$, as well as the demand that $t_f &amp;gt; t$ and $t &amp;lt; t_E$ (the final time at which the first derivative is positive), give a measure for the reliability for this estimate.&lt;/li&gt;&#xA;&lt;li&gt;If it is reliable enough, it is fairly straightforward to backtrack everything and come up with estimates for $\gamma$, $\beta$ and $\alpha$ (in that order).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To detect the oscillating component, I came up with the following: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take an initial $t_f^{\text{trial}} &amp;gt; t_B$, so some time after the beginning of the time series.&lt;/li&gt;&#xA;&lt;li&gt;Compute $\ln(t_f^{\text{trial}}-t)$, from $t=t_B$ to just before $t_f^{\text{trial}}$. &lt;/li&gt;&#xA;&lt;li&gt;Compute the Fourier transform of the transformed time series $P_T(t) = P_i(\ln(t_f^{\text{trial}}-t))$ (via &lt;a href=&quot;http://en.wikipedia.org/wiki/Least-squares_spectral_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lomb/Scargle&lt;/a&gt;, because the new sample times are unequally and logarithmically spaced).&lt;/li&gt;&#xA;&lt;li&gt;Determine all the peaks in the frequency domain and save them. &lt;/li&gt;&#xA;&lt;li&gt;Repeat from the top with $t_f^{\text{trial}} \leftarrow t_f^{\text{trial}} + \Delta t$&lt;/li&gt;&#xA;&lt;li&gt;The progression of the peaks will roughly follow a parabola-shaped path in the frequency domain if there is a periodic component somewhere. The &quot;right&quot; $t_f$ will be found when the maximum power in the frequency has been found. &lt;/li&gt;&#xA;&lt;li&gt;For all peaks and $t_f$ thus found, find the corresponding interval that maximizes the power in the peak ($t_0$ estimated). &lt;/li&gt;&#xA;&lt;li&gt;with all this information, it is fairly straightforward to come up with initial estimates of $t_f$, $\omega$ and $\phi$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then, these two approaches are to be combined:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The estimates for $t_0$ and $t_f$ from both approaches will generally differ. determine the smallest overlapping interval $(t_0, t_f)$.&lt;/li&gt;&#xA;&lt;li&gt;Throw the data from this interval, as well as all the initial estimates, into a non-linear least squares fitter to improve the fit.&lt;/li&gt;&#xA;&lt;li&gt;Compute a couple of measures related to the goodness of fit, which will accompany the results. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Why I'm looking for another approach&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Well, that all sure &lt;em&gt;sounds&lt;/em&gt; very nice, but of course I wouldn't be asking a question here if it all worked as well as it sounds :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I use to detect the presence and parameters of the power law: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;seems to be &lt;em&gt;extremely&lt;/em&gt; sensitive to noise&lt;/li&gt;&#xA;&lt;li&gt;I don't know how to determine automatically what a &quot;good enough&quot; smoothing is&lt;/li&gt;&#xA;&lt;li&gt;All smoothing algorithms I have tried are not very good at removing the periodic component, throwing all the estimates &lt;em&gt;way&lt;/em&gt; off. Moreover, the (log-)periodic component can make the derivatives &lt;em&gt;negative&lt;/em&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I could take the log of the data and detect linearity, but that suffers from the same problem -- the periodic component (as well as the unknown offset $t_f$) seems to make that unreliable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I use to detect the periodic component: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;is &lt;em&gt;very&lt;/em&gt; computationally intensive; Lomb/Scargle is certainly not as fast as an FFT would be. And as I mentioned earlier, each time series can be quite long, so the number of times the Fourier transform needs to be computed can also be quite large &lt;/li&gt;&#xA;&lt;li&gt;detecting which peak correspond to which other peak from one estimate for $t_f$ to the next, is rather difficult to automate.&lt;/li&gt;&#xA;&lt;li&gt;transforming the sample times into (roughly) logarithmically-spaced sampling times makes it very hard to detect the start/end of the interval with a decent accuracy.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm kind of stuck, and I need some new inspiration. Any suggestions? &lt;/p&gt;&#xA;" OwnerUserId="5743" LastEditorUserId="-1" LastEditDate="2017-04-13T12:53:54.087" LastActivityDate="2013-10-31T17:58:06.750" Title="How to detect specific behavior in time series?" Tags="|fft|algorithms|estimation|estimators|nonharmonic|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11228" PostTypeId="2" ParentId="11137" CreationDate="2013-10-22T13:53:00.853" Score="2" Body="&lt;p&gt;Are you processing this data offline or in real time? If you're doing offline processing, or can live with a significant delay, then you could apply a simple filter as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;From each input sample, check to see if the sensor reported &quot;on&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If it did, search for a &quot;few&quot; 16-minute periods in each direction and see whether the sensor reported &quot;on&quot; there as well. This is a noncausal operation; if you're processing data in real time, you can search in both directions by first applying a large enough delay to the signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If there are &quot;enough&quot; consecutive &quot;on&quot; samples at the spurious period in either direction, suppress the &quot;on&quot; indication from the sensor.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This should suppress the unwanted square wave of &quot;on&quot; indications, but as indicated in the comments, it also could possibly suppress valid &quot;on&quot; reports. The &quot;few&quot; and &quot;enough&quot; parameters you'll have to select yourself based upon what is reasonable given the overall behavior of your system. Basically, you want to set &quot;few&quot; so that you're looking at enough spurious periods to make a good decision. You'll want to set &quot;enough&quot; small enough to suppress short bursts of the spurious period, but large enough to avoid suppressing too many valid &quot;on&quot; indications that happen to be separated by 16 minutes.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-10-22T13:53:00.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11229" PostTypeId="1" AcceptedAnswerId="11230" CreationDate="2013-10-22T15:49:33.857" Score="4" ViewCount="202" Body="&lt;p&gt;I have a processing unit that does a nice EQ filtering on soundfiles.&#xA;&lt;em&gt;The only thing I can do is : I give the original .wav file, and the processing unit gives me back the filtered .wav.&lt;/em&gt; I have no other information than this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to know the &lt;strong&gt;frequency response graph&lt;/strong&gt; of this processing unit. How to do it ?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;1) feed the unit with a &quot;flat spectrum white noise&quot;, and see the spectrum of the filtered file? It works but it is not very accurate&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;2) feed the unit with sinewaves soundfile with frequency = 20, 30, 40, 50, etc... 20 000 Hz.&#xA;Then I examine the response for each file... and I can draw a &lt;strong&gt;frequency response graph&lt;/strong&gt; after 10 hours of work :)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;3) feed the unit with a frequency sweep ?  and then try to see what's the unit's reponse to this sweep ? How to decode the response into a nice &lt;strong&gt;frequency response graph&lt;/strong&gt;  ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;4) I imagine that there is another better solution?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-10-22T16:55:56.853" LastActivityDate="2013-10-22T16:55:56.853" Title="Guess the frequency response of a filter with little information" Tags="|filters|filter-design|signal-analysis|impulse-response|frequency-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11230" PostTypeId="2" ParentId="11229" CreationDate="2013-10-22T16:19:02.250" Score="7" Body="&lt;p&gt;If you know that the system is linear and time invariant, the easiest method (assuming that you have no noise added in the process) is to let the system act on an impulse function. The Fourier transform of the output is the frequency response of the system.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-10-22T16:19:02.250" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11231" PostTypeId="1" CreationDate="2013-10-22T17:51:05.220" Score="0" ViewCount="732" Body="&lt;p&gt;I just have a small theoretical question that buggers me to be honest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a sound file that I found its spectrum on linear and on logarithmic scale. Alright, I have done this, it's a plain standard procedure. The problem is that I cant really understand the plot on logarithmic scale. (it just looks like a typical logarithmic plot with dB, and it is correct by the way) . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, the visual differences are obvious, the linear plot frequencies are quite scattered and they peak in a non homogenous way, while I notice that on log scale the frequencies peaks are very close to each other and they don't seem to have so many extreme values. Could someone explain me this a bit ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZmTQ0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OGa1o.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="5747" LastEditorUserId="6" LastEditDate="2013-10-22T19:13:41.577" LastActivityDate="2013-10-22T20:03:39.653" Title="Logarithmic Scale Question" Tags="|discrete-signals|frequency-spectrum|signal-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11232" PostTypeId="2" ParentId="1256" CreationDate="2013-10-22T18:34:15.287" Score="1" Body="&lt;p&gt;I think that is better to use Shi and Tomasi, you can use them with the same function goodfeaturestotrack, it gave better results than the harris corners&lt;/p&gt;&#xA;" OwnerUserId="5749" LastActivityDate="2013-10-22T18:34:15.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11233" PostTypeId="1" AcceptedAnswerId="11238" CreationDate="2013-10-22T18:35:20.030" Score="1" ViewCount="1420" Body="&lt;p&gt;I am trying to understand how you use an FFT in matlab to measure/retrieve the magnitude of the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my understanding I have put this script together, creating a 15Hz sine wave with a sampling frequency of 1kHz.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fftsize    = 2048;            % How many samples for FFT&#xA;fs         = 1000;            % Sampling frequency (Hz)&#xA;sim_length = fftsize/fs ;     % run sim for this time&#xA;t          = 0:1/fs:sim_length-1/fs;                &#xA;x          = (0.5)*sin(2*pi*15*t); % 15 Hz component, 0.5 magnitude&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Window and FFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Windowed FFT&#xA;data                  = x'; % Assign input data&#xA;window                = blackman(fftsize);&#xA;windowed_data         = window.*data;&#xA;&#xA;% Perform FFT and take magnitude (of complex result)&#xA;fftd_data             = abs( fft(windowed_data, fftsize) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The input frequency was not coherent, add in the windowing and there is going to be some spectral leakage, therefore I need to sum the power over a few bins around where I expect the fundamental to be.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Each bin represents&#xA;bin_freq = fs/fftsize ;&#xA;&#xA;% 15 Hz fundamental is centred in bin &#xA;fundamental_bin = ceil( 15/bin_freq );&#xA;&#xA;% Allow spectral spreading of +-4 bins&#xA;lower_limit = fundamental_bin - 4;&#xA;upper_limit = fundamental_bin + 4; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sum of values from fft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sum( fftd_data(lower_limit:upper_limit) )&#xA;&#xA;ans =&#xA;&#xA;  512.3738&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is not the 0.5 I was looking for. What is the best way to get the (0.5) input magnitude from the fft result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some digging about I have come up with the following but not quite sure why it works or if I have named the calculations appropriately.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;incoherent_power_gain = sum(window.^2);&#xA;power_spectrum        = fftd_data.^2 ;&#xA;power_fftd_data       = (4 * power_spectrum) / (incoherent_power_gain * fftsize);&#xA;&#xA;sum_fundamental_power = sum( power_fftd_data(lower_limit:upper_limit) )&#xA;&#xA;sum_fundamental_power =&#xA;&#xA;    0.2500&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We converted to Power so we can take the square root to get back to a signal level.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sqrt( sum_fundamental_power )&#xA;&#xA;ans =&#xA;&#xA;    0.5000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Great, but is there a better way or can some one explain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If power spectrum is the correct name for &lt;code&gt;fftd_data.^2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also unsure what is happening in &lt;code&gt;(4 * power_spectrum) / (incoherent_power_gain * fftsize)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1603" LastEditorUserId="1603" LastEditDate="2013-10-22T19:23:48.040" LastActivityDate="2013-10-22T22:21:14.743" Title="Using fft in matlab to retrieve input signal magnitude" Tags="|matlab|fft|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11234" PostTypeId="1" AcceptedAnswerId="11294" CreationDate="2013-10-22T18:51:57.667" Score="6" ViewCount="1584" Body="&lt;p&gt;I'm trying to code the Haar wavelet approximation of a function.&lt;br&gt;&#xA;I'm a complete newbie. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;Below is a pseudo-code of my algorithm for $f: [0,10] \to \mathbb R$, $f(x)=x$.&lt;br&gt;&#xA;I picked it here and there on google.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Haar wave formula of order $N$  for $x \in [0, \infty)$&#xA;$$&#xA;\psi_{N,j}(x) = \frac{1}{\sqrt{N}} \cdot\begin{cases}&#xA;1 &amp;amp; j =0 \\&#xA;+2^{p/2} &amp;amp; a \le x - \left \lfloor \frac{x-a}{L}\right\rfloor L&amp;lt; b \\&#xA;-2^{p/2} &amp;amp; b  \le x - \left \lfloor \frac{x-a}{L} \right\rfloor L &amp;lt; c\\&#xA;0 &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&#xA;where &#xA;\begin{align}&#xA;a &amp;amp;= \frac{q-1}{2^p}, &#xA;b = \frac{q-0.5}{2^p}, &#xA;c = \frac{q}{2^p}, &#xA;L = c-a, \\&#xA;p &amp;amp;= \left\lfloor \log_2(j+1) \right\rfloor, &#xA;q = j +1 - p.&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Haar series coefficients&#xA;$$&#xA;\hat \psi_{N,j} = \int_0^{10} f(t) \psi_{N,j}(t) dt&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Haar series&#xA;$$&#xA;f(x) \approx \sum_{j=0}^N \hat \psi_{N,j} \cdot \psi_{N,j}(x) &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) For $N=4$, this gives the graph&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mw6zd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user5746" LastEditorDisplayName="user5746" LastEditDate="2013-10-23T00:04:49.207" LastActivityDate="2019-06-19T20:17:14.793" Title="Haar series approximation of a function?" Tags="|wavelet|python|transform|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11235" PostTypeId="2" ParentId="11231" CreationDate="2013-10-22T19:29:48.750" Score="1" Body="&lt;p&gt;The meaning of the logarithmic plot is that the signal power above 250 Hz is about ${10^{-10}}$ times less that the starting values (most of the power is concentrated at the lowest frequencies), so it's almost zero. The capability of a logarithmic plot is to show both, the high and low values at the same time, specially useful in acoustic field. The negative aspect is the visual distortion of the signal, you must always keep in mind that what are you looking at is a logarithmic plot.&lt;/p&gt;&#xA;" OwnerUserId="5160" LastActivityDate="2013-10-22T19:29:48.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11236" PostTypeId="2" ParentId="11231" CreationDate="2013-10-22T20:03:39.653" Score="0" Body="&lt;p&gt;I have a little addition to Sturm's response you can use as a rule of thumb to better imagine what is happening in the logarithmic domain. When looking at powers, you can say that -3dB means half the power, -10dB means 1/10th of power etc. Or, vice versa, 3dB means double, 10dB means ten times the power and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will give you a way better impression of how low the powers really are.&lt;/p&gt;&#xA;" OwnerUserId="5545" LastActivityDate="2013-10-22T20:03:39.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11237" PostTypeId="1" CreationDate="2013-10-22T21:19:03.037" Score="0" ViewCount="489" Body="&lt;p&gt;How might one model the propagation of a sound wave through a 3D environment with obstacles in it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial thought would be to use freely moving particles that repel one another; with sufficiently many particles I see no reason why the simulation wouldn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if any particle could collide with any other then this introduces a huge complexity hit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm wondering whether the particles could be effectively anchored on a sphere packed lattice (dodecahedron?), so each particle has 18 neighbours. (you could think of placing one tennis ball on the table, then six fitting around it, now 6 can be fitted on top, and by symmetry 6 could be fitted underneath. so the original ball has 18 neighbours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then shockwaves could propagate through this mesh, and at each iteration each particle just needs to calculate the resultant force of its 18 neighbours acting on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see whether this model would work or not.  I suspect it is going to model sound propagating through a diamond rather than sound propagating through air, but isn't it going to be essentially the same?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this isn't quite on topic for DSP, my apologies. Can anyone recommend a more suitable place to ask this question?&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2013-10-23T11:38:08.423" Title="Modelling propagation of sound wave by particle simulation" Tags="|sound|wave|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11238" PostTypeId="2" ParentId="11233" CreationDate="2013-10-22T22:21:14.743" Score="1" Body="&lt;p&gt;I just fixed 3 things in your code and added comments where I did. The reason is basicly just the way the FFT is defined/implemented in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs         = 1024;            &#xA;fftsize    = 2048;           % Choose as a power of 2 of the sample rate       &#xA;&#xA;sim_length = fftsize/fs ;     &#xA;t          = 0:1/fs:sim_length-1/fs;                &#xA;x          = 0.5*sin(2*pi*15*t);&#xA;&#xA;data                  = x';&#xA;window                = blackman(fftsize);&#xA;windowed_data         = window.*data;&#xA;&#xA;&#xA;fftd_data   = abs( fft(windowed_data, fftsize)/length(x) ); % Normalize the fft&#xA;&#xA;bin_freq = fs/(fftsize) ;&#xA;&#xA;fundamental_bin = ceil( 15/bin_freq );&#xA;&#xA;lower_limit = fundamental_bin-4;&#xA;upper_limit = fundamental_bin+4; &#xA;&#xA;2*sum( fftd_data(lower_limit:upper_limit) ) % Multiply by 2, because of the DFT-symmetry&#xA;&#xA;ans =&#xA;&#xA;    0.5000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a more detailed explanation, check out &lt;a href=&quot;http://www.mathworks.de/matlabcentral/newsreader/view_thread/136400&quot; rel=&quot;nofollow&quot;&gt;this thread&lt;/a&gt; at Mathworks forum.&lt;/p&gt;&#xA;" OwnerUserId="5545" LastActivityDate="2013-10-22T22:21:14.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11239" PostTypeId="2" ParentId="11213" CreationDate="2013-10-23T02:42:30.807" Score="2" Body="&lt;p&gt;You can try Prof. Rabiner's slides at &lt;a href=&quot;http://www.ece.ucsb.edu/Faculty/Rabiner/ece259/&quot; rel=&quot;nofollow&quot;&gt;http://www.ece.ucsb.edu/Faculty/Rabiner/ece259/&lt;/a&gt; . They also have some matlab code examples which you can try. &lt;/p&gt;&#xA;" OwnerUserId="5751" LastActivityDate="2013-10-23T02:42:30.807" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11240" PostTypeId="1" CreationDate="2013-10-23T04:37:46.933" Score="2" ViewCount="243" Body="&lt;p&gt;I have a 3D data set sampled on a regular grid shown in the Figure below. This data can be interpreted as an image where the point altitude is equivalent to the pixel intensity value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the middle of my 3D data, I have a peak, that becomes a bright spot when the data is interpreted as an image.&#xA;My goal is to remove this hot spot from my data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was told to try some image inpainting techniques to remove it without introducing too many artifacts. After searching available implementations, I've found two algorithms already implemented in the &lt;a href=&quot;http://docs.opencv.org/master/modules/photo/doc/inpainting.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;opencv&lt;/a&gt; library:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;one is the &lt;em&gt;Navier-Stokes Inpainting&lt;/em&gt; by Bertalmio &lt;em&gt;et al.&lt;/em&gt;;&lt;/li&gt;&#xA;&lt;li&gt;the other one is a &lt;em&gt;fast marching based&lt;/em&gt; approach by Telea;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;but I don't know which one to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is any of these methods suitable for my task? Which of these methods (if any) should I use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vqHYs.png&quot; alt=&quot;my image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5690" LastEditorUserId="1355" LastEditDate="2013-10-24T07:30:58.653" LastActivityDate="2013-10-24T07:30:58.653" Title="Inpainting: which algorithm should I choose?" Tags="|image-processing|python|" AnswerCount="0" CommentCount="2" ClosedDate="2013-10-24T00:35:30.393" ContentLicense="CC BY-SA 3.0" />
  <row Id="11241" PostTypeId="2" ParentId="10579" CreationDate="2013-10-23T10:01:35.130" Score="11" Body="&lt;p&gt;I will try to avoid math, because math and &quot;how to do it&quot; tutorials can be easily found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I start by pointing out one VERY important thing: One does not compute Harris for a single pixel, but for a vicinity (a patch of image) around that pixel! Let $I(i)_{xx}, I(i)_{xy} ...$ be your derivatives for a point $i_0$, then, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H = \left[ &#xA;\begin{array}{cc}&#xA;\sum_{i\in V}I(i)_{xx} w (i-i_0) &amp;amp; \sum_{i\in V}I(i)_{xy}w (i-i_0) \\&#xA;\sum_{i\in V}I(i)_{xy} w (i-i_0)&amp;amp; \sum_{i\in V}I(i)_{yy} w (i-i_0)\\&#xA;\end{array}&#xA;  \right] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $w(t)$ is a Gaussian kernel.&#xA;The previous eq tells you to integrate the derivative values over vicinity $V$ around current pixel. Each value of the neighbors is multiplied with a value that shrinks as the distance increases. The law of decreasing follows a Gaussian, because $w(t)$ is Gaussian centred at $i_0$. And that's it with math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, back to the empirical observations. If you use solely the derivatives, and that pixel is part of a linear structure (edge), then, you get a strong response for the derivatives. &#xA;On the other hand, if the pixel is at a corner (an intersection of two edges) then, the derivative responses will cancel themselves off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saying that, the the Hessian is able to capture the local structure in that vicinity without &quot;cancelling&quot; effect. BUT very important, you have to integrate in order to get a proper Hessian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having a Hessian, obtained using Harris method or by other means, one might want to extract information about the vicinity. There are methods to get numerical values on how likely is to have an edge at current pixel, a corner, etc. Check the corner detection theory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, about &quot;stable points&quot; or salient points. Picture that you are in a foreign town with no GPS and only with a good map. If you are &quot;teleported&quot; in a middle of a street, you might locate the street on the map, but you cannot tell where exactly are you on that street or in what direction you should go to move left or right (wrt to the map).&#xA;Imagine now that you are at a intersection. Then, you precisely can point your position on the map!. (Of course, assume that two streets doesn't intersect more than once).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine now that you must match two images. One acts as a map, and the other as the city. You must find pixels that can be uniquely described, so you can do the matching. Check images on this &lt;a href=&quot;https://stackoverflow.com/a/14909358/2662454&quot;&gt;post&lt;/a&gt; for example of matching. These points are called salient points. Moreover, the corner points tend not to change their 'cornerness' properties when the image is scaled, translated, rotated, skewed, etc. (affine transforms) This is why they are called &quot;stable&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some points in the image allows you to uniquely identify them. These pixels are located at corners or at intersection of lines. Imagine that your vicinity $V$ is on a line. Except for the orientation of the line, you cannot find anything else from that vicinity. But if $V$ is on a corner, than, you can find out the directions of the lines that intersect, maybe the angle, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not all corner points are salient, but only corner points have great chances of being salient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.s. How to find if a point is corner or not, take a look at Harris paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.p.s. More on matching, search for SIFT or SURF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.p.p.s. There is a &quot;generalization&quot; of the Harris method, called Structure Tensor. Check &lt;a href=&quot;http://www.diva-portal.org/smash/get/diva2:536938/FULLTEXT01.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Knutsson&lt;/a&gt; seminal work!&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-10-24T16:03:03.337" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11242" PostTypeId="1" AcceptedAnswerId="11267" CreationDate="2013-10-23T10:20:45.107" Score="3" ViewCount="2419" Body="&lt;p&gt;Ok, so the situation is that I have a DFII biquad with some filter coefficients:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;\begin{align}&#xA;w[n] &amp;amp;= x[n] - a_1*w[n-1] - a_2*w[n-2]\\&#xA;y[n] &amp;amp;= b_0*w[n] + b_1*w[n-1] + b_2*w[n-2]&#xA;\end{align}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While the filter is running, I change the coefficients and I believe my filter is going unstable.  I want to build in a check that it is going to be stable.  Currently, I simply check that the poles lie inside the unit circle by checking my $a_n$ coefficients.  But it doesn't work.  I believe that the problem is that I have non-zero values in my states (i.e. $w[-1]$ and $w[-2]$) and my stability check doesn't even consider this.  I cannot reset my states while the filter is running without producing an audible click.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The questions: &lt;strong&gt;How do I check for stability of a filter with non-zero initial conditions?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a couple thoughts for solutions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Simply take the $\mathcal Z$-tranform of the impulse response (of the feedback portion), which looks something like this:&#xA;$$&#xA;h[n] = &#xA;\begin{cases}&#xA;    0 &amp;amp; n &amp;lt; 0\\&#xA;    1 - a_1*K_1 - a_2*K_2    &amp;amp; n = 0\\&#xA;    0 - a_1*h[0] - a_2*K_1   &amp;amp; n = 1\\&#xA;    - a_1*h[n-1] - a_2*h[n-2] &amp;amp; n \ge 2&#xA;\end{cases}&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Solve the difference equation à la differential equations:&#xA;$$&#xA;h[n] + a_1*h[n-1] + a_2*h[n-2] = 0, n \ge 2&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Or prove that the sequence $h[n]$ (from above) converges&#xA;$$ \sum_{n=0}^{\infty}\lvert h[n]\rvert  &amp;lt; \infty $$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Am I on the right track? I can't seem to figure out the solution for any of these methods.&lt;/p&gt;&#xA;" OwnerUserId="5321" LastEditorUserId="1629" LastEditDate="2016-06-25T15:45:03.563" LastActivityDate="2016-06-25T15:45:03.563" Title="How can I prove stability of a biquad filter with non-zero initial conditions" Tags="|infinite-impulse-response|z-transform|biquad|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11243" PostTypeId="2" ParentId="11242" CreationDate="2013-10-23T11:00:52.373" Score="5" Body="&lt;p&gt;Tricky problem. Not sure I can answer this but here are a few pointers:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Direct Form II is the worst biquad for audio processing. The transfer function between the input and the state is given just by the poles. The gain can be really large, I have seen gains of in excess of a 100 dB for reasonable audio filters.&lt;/li&gt;&#xA;&lt;li&gt;This makes real time switching of Direct Form II very tricky. The magnitude of your state can change 10s of dB with seemingly small overall filter changes. This creates massive clicks and pops and occasionally unstable filters.&lt;/li&gt;&#xA;&lt;li&gt;Much better choices are Direct Form I or transposed Form II. For these filter types the state variables are always in the same order of magnitude than input and output. Much less potential for loud pops and clicks or instability&lt;/li&gt;&#xA;&lt;li&gt;There is not &quot;sure fire&quot; way of updating an IIR filter in real time without the potential for audible artifacts. Some potential methods are running two filters in parallel and slowly cross fading the output or updating pole and zero locations really slowly with very small steps at the time&lt;/li&gt;&#xA;&lt;li&gt;If you must update in real time, make sure that you don't update one coefficient at a time but ideally both poles and zeros in one go. At least do the poles all at ones (i.e. always update a1 and a2 at the same time)&lt;/li&gt;&#xA;&lt;li&gt;Update lower gain first. If the pole section of the new filter has lower gain, update the poles first and then the zeros. If the pole section of the filter has higher gain, update zeros first and then poles&lt;/li&gt;&#xA;&lt;li&gt;If you need to stick with Direct Form II, it's probably best to zero out the state during update. This will still create an artifact but it's probably less than if you don't and at least it guarantees stability.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-23T11:00:52.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11244" PostTypeId="2" ParentId="11237" CreationDate="2013-10-23T11:38:08.423" Score="4" Body="&lt;p&gt;There is a huge body of research and commercial work on doing acoustic simulation. There are a two basic classes of simulation systems: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Finite element or finite boundary: these model the actual physics by dividing air and or/surfaces into small patches and modelling step by step the interaction between the patches by locally solving the wave equations given the boundary and initial conditions of the patches near by&lt;/li&gt;&#xA;&lt;li&gt;Approximation methods: Ray tracing, particle tracing, mirror image method, etc. These are macroscopic models that use certain simplifying assumptions such as specular reflections, simplified diffusion models, no diffraction, etc.  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is a very complicated problem and it takes many person years to create a modelling system that actually produces useful results. There are commercial systems out there that you can buy. They vary greatly in complexity, capability, cost, and training required so it all depends on your specific application. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-23T11:38:08.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11246" PostTypeId="1" CreationDate="2013-10-23T12:31:09.593" Score="0" ViewCount="188" Body="&lt;p&gt;I have the image below.  This image contains sets of points that are aligned horizontally and vertically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i find these sets of points? based &lt;strong&gt;1) on their alignment&lt;/strong&gt; and  &lt;strong&gt;2) on the ** **inter-line&lt;/strong&gt; and &lt;strong&gt;Inter-word distances.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to use these 2 arguments, alignment and distance? or is one of them sufficient?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to use the Hough transform? or another algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DnCE4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5755" LastEditorUserId="76" LastEditDate="2013-10-24T00:34:52.000" LastActivityDate="2013-10-24T15:17:31.917" Title="Find horizontally and vertically aligned sets of points" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11247" PostTypeId="2" ParentId="11242" CreationDate="2013-10-23T13:40:13.997" Score="0" Body="&lt;p&gt;As Hilmar says in 4., reloading will cause clicks. An output sample is basically the inner product between a vector of previous samples and a vector of filter coefficients. An abrupt change in the filter vector causes just as much clicks as an abrupt change in the sample vector. A possibly simpler solution, that is equivalent to cross fading two filter channels, is to over time reload interpolated versions of the old and new filter vectors.&lt;/p&gt;&#xA;" OwnerUserId="5745" LastActivityDate="2013-10-23T13:40:13.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11248" PostTypeId="1" AcceptedAnswerId="11249" CreationDate="2013-10-23T14:25:24.817" Score="2" ViewCount="896" Body="&lt;p&gt;I use a simple biquad IIR filter  :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (n &amp;gt;= 2)&#xA;   y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2]&#xA;                    - (a1/a0)*y[n-1] - (a2/a0)*y[n-2] &#xA;else&#xA;   y[n] = x[n]     // here it probably needs to be modified&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(thanks to &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow&quot;&gt;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that the filtered signal sometimes explodes in the first milliseconds, and then returns to normal after a few milliseconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I initiallize the first values of y[n] ? I have done this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[n] = x[n]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for &lt;code&gt;n=0,1&lt;/code&gt;, but probably the problem comes from here ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem (it explodes in the first milliseconds) is important when I do 2, 3, or more passes of the same filter in cascade.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-10-23T15:19:14.887" Title="Very first values of y[n] in an IIR filter" Tags="|filters|filter-design|signal-analysis|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11249" PostTypeId="2" ParentId="11248" CreationDate="2013-10-23T15:19:14.887" Score="5" Body="&lt;p&gt;Typically, you would initialize the filter state (which in your example includes $x[-1]$, $x[-2]$, $y[-1]$, and $y[-2]$) with zeros. This is equivalent to assuming that the filter is &lt;a href=&quot;http://en.wikipedia.org/wiki/Causal_system&quot;&gt;causal&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-10-23T15:19:14.887" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11250" PostTypeId="1" AcceptedAnswerId="16818" CreationDate="2013-10-23T19:18:43.567" Score="1" ViewCount="1336" Body="&lt;p&gt;This question follows from &lt;a href=&quot;https://dsp.stackexchange.com/questions/11237/modelling-propagation-of-sound-wave-by-particle-simulation&quot;&gt;Modelling propagation of sound wave by particle simulation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This last fortnight I have started experimenting with Binaural audio; it really blows everything else out of the water.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main reason it hasn't taken off, I think, is that every individual needs to get their own HRTF calculated, which consists of sitting in a soundproof room with microphones in your ear canals, while something makes popping noises at thousands of locations around you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm only aware of one service provider that &lt;em&gt;may&lt;/em&gt; calculate your HRTF: &lt;a href=&quot;http://www.physiol.usyd.edu.au/~simonc/hrtf_rec.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.physiol.usyd.edu.au/~simonc/hrtf_rec.htm&lt;/a&gt;  and they are in Australia!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering whether a more practical method may emerge, which would involve taking a 3-D scan of one's head (maybe using something like &lt;a href=&quot;http://www.david-3d.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.david-3d.com/&lt;/a&gt;) and shipping it off for a heavy dose of distributed computing which would return HRTFs for that individual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if we may see a day where people have their own HRTF data stored in the cloud, and can enjoy binaural sound on their iPods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How far away is such a technology?  And other any other contenders for measuring HRTF?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS could we possibly have some more tags like &quot;binaural&quot;, &quot;hrtf/hrir&quot;&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-11-10T14:00:13.677" Title="Getting HRTF from 3-D scan + acoustic simulation" Tags="|audio|3d|spatial|hrtf|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11251" PostTypeId="5" CreationDate="2013-10-23T20:27:08.860" Score="0" Body="&lt;p&gt;HRTF stands for head-related transfer function. &lt;a href=&quot;http://en.wikipedia.org/wiki/Head-related_transfer_function&quot; rel=&quot;nofollow&quot;&gt;It is a way of expressing how the ear hears sounds spatially.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-10-23T20:27:08.860" LastActivityDate="2013-10-23T20:27:08.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11252" PostTypeId="4" CreationDate="2013-10-23T20:27:08.860" Score="0" Body="HRTF stands for head-related transfer function." OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-10-23T20:27:08.860" LastActivityDate="2013-10-23T20:27:08.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11253" PostTypeId="1" CreationDate="2013-10-23T21:44:45.637" Score="0" ViewCount="233" Body="&lt;p&gt;I would like to map the envelope of a sound (which has max dB level = dbmax, and min dB level = dbmin)   from &lt;code&gt;[dbmin,dbmax]&lt;/code&gt; to &lt;code&gt;[-inf,dbmax]&lt;/code&gt;.&#xA;Here is an example :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DO6dh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's like some sort of dynamic compression (or rather dynamic range 'expansion' to be precise), but here the mapping is linear from &lt;code&gt;[dbmin,dbmax]&lt;/code&gt; to &lt;code&gt;[-inf,dbmax]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the simplest way to do this with an  &lt;code&gt;x[n]&lt;/code&gt; array? (my input is a soundfile, not an envelope. Is there a simple method for working on envelope (envelope follower ?))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS : &lt;em&gt;not&lt;/em&gt; realtime processing. Thus I can pre-compute dbmax, dbmin.&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="29" LastEditDate="2016-01-30T03:39:43.357" LastActivityDate="2016-04-29T06:56:18.590" Title="Map the Amplitude Envelope from [dbmin,dbmax] to [-inf,dbmax]" Tags="|signal-analysis|sampling|amplitude|dynamic-range-compression|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11254" PostTypeId="1" CreationDate="2013-10-24T01:14:45.577" Score="0" ViewCount="387" Body="&lt;p&gt;I just want to ask, whenever you reduce a bandwidth of signal by filtering, I wonder why do you need to improve the number of bits used to represent that signal.&#xA;The number of bit growth is &#xA;$$\frac{1}{2}\log_2\left(\frac{BW_{in}}{BW_{out}}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it to represent to small noise due to filtering.&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5717" LastEditorUserId="6" LastEditDate="2013-10-24T01:51:43.270" LastActivityDate="2013-10-25T00:40:32.233" Title="Effect of bandwidth reduction in bit growth" Tags="|noise|bandwidth|filtering|hardware-implementation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11255" PostTypeId="2" ParentId="11253" CreationDate="2013-10-24T04:07:37.403" Score="1" Body="&lt;p&gt;May be you can try the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; dbnew = dbmax * (1 + log((db-dbmin)/(dbmax-dbmin)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;dbnew = -inf when db = dbmin and dbnew = dbmax when db = dbmax. Please let me know if it works.&lt;/p&gt;&#xA;" OwnerUserId="5751" LastActivityDate="2013-10-24T04:07:37.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11256" PostTypeId="2" ParentId="11092" CreationDate="2013-10-24T04:12:25.397" Score="-1" Body="&lt;p&gt;The bandwidth in this case would be the maximum frequency of the five sine waves. There is no problem if you know the five frequencies a priori. However, if that information is not available, you can do a DFT to find out the frequency content and find the index upto which the frequency content is non zero. That would give you your bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="5751" LastActivityDate="2013-10-24T04:12:25.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11257" PostTypeId="2" ParentId="11208" CreationDate="2013-10-24T04:16:16.587" Score="1" Body="&lt;p&gt;As Jan pointed out, the wikipedia article very lucidly explains the derivation of the weiner filter. The goal of the weiner filter is to reduce the mean of the error in prediction. Hence, you would do the same. Write down the estimate of the error and then differentiate it with respect to G(f) to obtain the optimum G(f)&lt;/p&gt;&#xA;" OwnerUserId="5751" LastActivityDate="2013-10-24T04:16:16.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11258" PostTypeId="1" CreationDate="2013-10-24T04:19:53.497" Score="1" ViewCount="1481" Body="&lt;p&gt;I'm trying to use the goertzel algorithm to detect a pair of frequencies in a signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sample rate I'm using is 8000 hz, and the size of the incoming sample buffer is 60 samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a large array of 600 samples in size, so each time a new buffer comes in I move the data 60 samples to the right in the large buffer to make room for the new buffer, which I put at the front of the array (from index 0). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[ buffer0 | ... | buffer9 ]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apply the goertzel algo to this large array. I'm looking for the frequencies 133.33 and 333.33 hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My algorithm gives me normalized magnitude. For the first frequency, I get a more or less stable detected magnitude around 0.5, which is also the amplitude of the original signal (I'm responsible for generating the signal myself). So that seems correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second frequency, I get a wildly varying normalized magnitude which seems to vary between 0.0 and 0.50, almost in a sine-like fashion. I know that the amplitude of this sine wave is 0.5. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I save the generated signals and analyze them using audacity's spectrum feature I can see the correct frequencies in the spectrum, so it looks like the signal is being generated correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) the algorithm seems to have a hard time detecting the second frequency. Why?&#xA;2) what is the relationship between the number of samples used for running the goertzel algo, and the detected frequencies? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to detect 64 unique combinations, so I was thinking of generating one frequency from a set of 16 and another one from a set of 4 and then just adding the two signals with 0.5 amplitude. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;B&lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2014-05-30T18:33:53.850" Title="relationship between block size and detected frequencies in goertzel algorithm" Tags="|fft|frequency-spectrum|dft|signal-analysis|signal-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11259" PostTypeId="1" CreationDate="2013-10-24T04:27:21.750" Score="0" ViewCount="209" Body="&lt;p&gt;I am working on an accelerometer on a mobile device. When an event occurs, I record around 30 acceleration values. The accelerometer, being extremely noisy is very unreliable. What makes it worse is that my motion during the acquisition time is also of the same order as the noise. Is there a good method to estimate the curve the mobile goes through with a decent accuracy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I am trying to estimate the position of the mobile. Further, the amplitudes of acceleration are of the same order as the noise(I logged the accelerometer values when the mobile was stationary and made this estimate). Further, The noise is approximately gaussian.&lt;/p&gt;&#xA;" OwnerUserId="5751" LastEditorUserId="5751" LastEditDate="2013-10-28T07:28:32.850" LastActivityDate="2013-10-28T07:28:32.850" Title="Cleaning accelerometer output" Tags="|noise|estimation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11261" PostTypeId="1" CreationDate="2013-10-24T10:11:49.143" Score="0" ViewCount="1872" Body="&lt;p&gt;With the following code, I get the &quot;envelope&quot; of a sound signal.&#xA;However in the &quot;envelope&quot; there are small oscillations (high frequency) : it is not smooth enough...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PYl15.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine that it's possible to apply a low-pass to the &quot;envelope signal&quot; in order to  remove the high frequencies oscillations, but I also imagine it's probably better to do it directly by modifying this code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double attack_coef = Math.Exp(Math.Log(0.01)/( 10 * 44100 * 0.001));   // 10 ms&#xA;double release_coef = Math.Exp(Math.Log(0.01)/( 100 * 44100 * 0.001));  // 100 ms&#xA;double envelope = 0.0;&#xA;&#xA;for (int n = 0; n &amp;lt; file.Length; ++n) &#xA;{&#xA; double tmp = Math.Abs(x[n]);&#xA; if (tmp &amp;gt; envelope)&#xA;  envelope = attack_coef * (envelope - tmp) + tmp;&#xA; else&#xA;  envelope = release_coef * (envelope - tmp) + tmp;&#xA;&#xA; env[n] = envelope;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do you have an idea for that ?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-10-25T21:37:55.533" Title="Envelope follower not smooth enough" Tags="|filters|sampling|signal-analysis|lowpass-filter|signal-detection|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11262" PostTypeId="1" AcceptedAnswerId="11264" CreationDate="2013-10-24T10:31:27.783" Score="4" ViewCount="977" Body="&lt;p&gt;Suppose $x[n]$ and $y[n]$ are two nonzero signals(i.e., $x[n] \neq 0$ for at least one value of n and similarly for $y[n]$).Can the convolution between  $x[n]$ and $y[n]$ result in an identically zero signal? In other words, is it possible that $\displaystyle\sum_{k = -\infty}^{k = +\infty}x[k]y[n-k] = 0$ for all n.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="4434" LastEditDate="2013-10-24T10:50:29.120" LastActivityDate="2013-10-24T11:21:04.570" Title="Can two nonzero signals $x[n]$ and $y[n]$ give a zero convolution" Tags="|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11264" PostTypeId="2" ParentId="11262" CreationDate="2013-10-24T11:21:04.570" Score="5" Body="&lt;p&gt;Yes, for example let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[k]=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for all $k$ and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[k] = \begin{cases}1 &amp;amp; k=0\\-1 &amp;amp; k=1\\0 &amp;amp; otherwise \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy to see that in case of a convolution, the result will be zero for all values of $n$.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-10-24T11:21:04.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11265" PostTypeId="1" CreationDate="2013-10-24T11:22:50.440" Score="0" ViewCount="2387" Body="&lt;p&gt;I have just started learning some DSP, I keep seeing things like memory in regard to filters.  I am unsure exactly what this means and why it is useful.  I understand that increasing the number of taps increases the memory etc.. and a tap is essentially just a coefficient for changing the signal.&lt;/p&gt;&#xA;" OwnerUserId="5766" LastActivityDate="2013-10-25T07:10:50.107" Title="What is filter memory?" Tags="|filters|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11266" PostTypeId="2" ParentId="11024" CreationDate="2013-10-24T11:31:39.153" Score="1" Body="&lt;p&gt;There is a website which will give you a lot of information about your queries:&#xA;&lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/research/affine/&quot; rel=&quot;nofollow&quot;&gt;http://www.robots.ox.ac.uk/~vgg/research/affine/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It contains information about feature detectors and descriptor, their current performance and which one is best in which scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This field has still a lot to go on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example when you want to go for  stereo reconstruction these algorithms usually fail in case of multi-view point images. You can try something of that.&lt;/p&gt;&#xA;" OwnerUserId="5767" LastActivityDate="2013-10-24T11:31:39.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11267" PostTypeId="2" ParentId="11242" CreationDate="2013-10-24T11:33:23.997" Score="1" Body="&lt;p&gt;I found a solution that I believe is the proper math I was looking for.  Although Hilmar's answer is also quite accurate and helpful.  I found information in my old DSP textbook about the &quot;Unilateral Z-Transform&quot;, which is briefly defined here: &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Z_Transform.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/Z_Transform.html&lt;/a&gt;.  The important part is the properties some of which are described here: &lt;a href=&quot;http://web.eecs.umich.edu/~aey/eecs451/lectures/zir.pdf&quot; rel=&quot;nofollow&quot;&gt;http://web.eecs.umich.edu/~aey/eecs451/lectures/zir.pdf&lt;/a&gt;.  The important property is the delay property:&#xA;$$&#xA;x[n-1] \overset{\mathcal{UZ}}{\iff} z^{-1}\mathcal{X}^+(z)+x[-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was critical for my needs because it can be used to serve initial conditions.  The next thing the book shows me is the application of this property for a two-sample delay:&#xA;$$&#xA;w[n] = y[n-1] = x[n-2] \\&#xA;\mathcal{W}^+(z) = x[-2] + x[-1]z^{-1} + z^{-2}\mathcal{X^+(z)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying this to the general form a 2nd order feedback filter I get&#xA;$$&#xA;y[n] - a_1y[n-1] - a_2y[n-2] = x[n] \\&#xA;h[n] - a_1h[n-1] - a_2h[n-2] = \delta[n] \\&#xA;\mathcal{H}^+(z) - a_1 \left( z^{-1}\mathcal{H}^+(z) + h[-1] \right) - a_2\left( z^{-2}\mathcal{H}^+(z) + z^{-1}h[-1] + h[-2] \right) = 1 \\&#xA;\mathcal{H}^+(z) \left(1 - a_1z^{-1} - a_2z^{-2} \right) = 1 - \left(a_1h[-1] + a_2h[-2] + a_2h[-1]z^{-1} \right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives me a formula with two parts, which my textbook refers to as the zero-state response + zero-input response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{H}^+(z) = \frac{1}{1 - a_1z^{-1} - a_2z^{-2}} - \frac{a_1h[-1] + a_2h[-2] + a_2h[-1]z^{-1}}{1 - a_1z^{-1} - a_2z^{-2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that means the general equation for for any causal biquad with initial conditions is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{H}^+(z) = \frac{b_0 + b_1z^{-1} + b_2z^{-2}}{ 1 - a_1z^{-1} - a_2z^{-2}} - \frac{a_1h[-1] + a_2h[-2] + a_2h[-1]z^{-1}}{1 - a_1z^{-1} - a_2z^{-2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is that the feedback coefficients are the only things that can cause instability.  However, maybe the initial conditions cause audio to go outside of a (stable) bound.&lt;/p&gt;&#xA;" OwnerUserId="5321" LastActivityDate="2013-10-24T11:33:23.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11268" PostTypeId="2" ParentId="11265" CreationDate="2013-10-24T11:34:44.437" Score="5" Body="&lt;p&gt;Filter memory refers to the effect of past input on the current input. Infinite impulse response (IIR) filters and finite impulse response (FIR) filters are fundamentally different from the perspective of their memory. The memory of an FIR will essentially be the number of taps, while IIR has theoretically infinite memory (although when they are stable, the memory passes under the numerical accuracy of the system beyond a certain point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More on this &lt;a href=&quot;http://gregstanleyandassociates.com/whitepapers/FaultDiagnosis/Filtering/Filter-Memory/filter-memory.htm&quot; rel=&quot;noreferrer&quot;&gt;http://gregstanleyandassociates.com/whitepapers/FaultDiagnosis/Filtering/Filter-Memory/filter-memory.htm&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="548" LastActivityDate="2013-10-24T11:34:44.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11269" PostTypeId="2" ParentId="11250" CreationDate="2013-10-24T12:37:50.247" Score="3" Body="&lt;p&gt;There are various school of thoughts about this. A German guy named Klaus Genuit came up with a parametric model of HRTFs that's based on the actual physcial geometry of head, shoulder, pinna, etc. He actually now runs a company that craeates binaural products and measurement gear, see for example&#xA;&lt;a href=&quot;http://www.head-acoustics.de/downloads/publications/binaural_technology/DAGA_99_Physical_Modeling_of_individual_HRTFs.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.head-acoustics.de/downloads/publications/binaural_technology/DAGA_99_Physical_Modeling_of_individual_HRTFs.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on this work you could potentially create individual HRTFs using a some 3D scanning scheme. I do vaguely remember a company coming doing exactly that for a bunch of people at my employer at the time. I didn't think the HRTFs that came out that way were particularly good but I didn't do a lot of work with them either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Individualized HRTFs only help to a certain extent. Let's say you want to record a concert. You can do this binaurally using a dummy head. However, there is currently no way to convert this recording to your individual HRTFs after the fact, even if you have them. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-24T12:37:50.247" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11270" PostTypeId="1" AcceptedAnswerId="11285" CreationDate="2013-10-24T13:52:50.807" Score="5" ViewCount="7805" Body="&lt;p&gt;What are the advantages / disadvantages of bilateral filter and anisotropic diffusion for noise reduction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: To be more specific - what are the practical differences in terms of quality, speed or flexibility? How should I choose whether to use AD or BF for noise reduction?&lt;/p&gt;&#xA;" OwnerUserId="4908" LastEditorUserId="128" LastEditDate="2018-08-23T08:47:08.093" LastActivityDate="2018-08-23T08:47:08.093" Title="Comparison of Bilateral Filter and Anisotropic Diffusion" Tags="|image-processing|filters|noise|anisotropic-diffusion|edge-preserving-filter|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11273" PostTypeId="2" ParentId="11246" CreationDate="2013-10-24T15:17:31.917" Score="1" Body="&lt;p&gt;Using alignment, it's mostly a matter of heuristic (sweeping horizontally and vertically). You can also work out something similar to Hough transform here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using inter and intra-dot distances is also known as linkage. What you want to do can be obtained through &lt;a href=&quot;http://en.wikipedia.org/wiki/Hierarchical_clustering&quot; rel=&quot;nofollow&quot;&gt;hierarchical clustering&lt;/a&gt; using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Single-linkage_clustering&quot; rel=&quot;nofollow&quot;&gt;single linkage&lt;/a&gt; distance computation. It works as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;you start with all your dots as (unconnected) leaves in a tree;&lt;/li&gt;&#xA;&lt;li&gt;you test all the leaves pairs, compute their spatial distance, and connect the two leaves that yield the smallest distance;&lt;/li&gt;&#xA;&lt;li&gt;replace these 2 leaves by only 1 leave that represents the cluster;&lt;/li&gt;&#xA;&lt;li&gt;go back to 2 and repeat until you have only 1 leave left.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The last leave is the root of a tree that represents the hierarchical clustering result, which is also called a &lt;a href=&quot;http://en.wikipedia.org/wiki/Dendrogram&quot; rel=&quot;nofollow&quot;&gt;dendrogram&lt;/a&gt;.&#xA;By using single linkage, you connect each dot to the closest dot, then recursively all closest pairs of dots, etc. You can finally discard the hierarchical tree part that corresponds to the smallest distance between two different lines.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-10-24T15:17:31.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11274" PostTypeId="2" ParentId="2445" CreationDate="2013-10-24T16:53:30.770" Score="0" Body="&lt;p&gt;Another approach:  plot the frequency response and fit a Bode plot to it as best as possible.  This could be done very quickly for an approximate solution, or in some elaborate least squares sense for a better fit.&#xA;GTH&lt;/p&gt;&#xA;" OwnerUserId="5772" LastActivityDate="2013-10-24T16:53:30.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11275" PostTypeId="2" ParentId="2498" CreationDate="2013-10-24T17:13:18.407" Score="1" Body="&lt;p&gt;No there is nothing wrong with the formulas in the paper.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;MI(S) is the &lt;em&gt;average&lt;/em&gt; mutual information of set S over all classes c in C. It is NOT a reformulation of the formula for MI(W,C).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;MI(w) is identical to your formula for I(Wi,C)  (except it uses slightly different notation).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2013-10-24T17:13:18.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11276" PostTypeId="2" ParentId="10927" CreationDate="2013-10-24T17:21:52.907" Score="2" Body="&lt;p&gt;There are several kinds of splines, with conflicting goals:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;go near the input data points&lt;/li&gt;&#xA;&lt;li&gt;smooth curves vs. wiggly&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For a few data points, you may want to interpolate exactly;&#xA;but for thousands of points, or even a dozen with noise,&#xA;interpolating exactly will wiggle.&#xA;Most spline fitters have parameters to tradeoff nearness of fit vs. overall smoothness.&#xA;Here's a plot of degree 1 splines (piecewise linear, connect-the-dots)&#xA;with data = line + noise.&#xA;You see that fitting the data exactly zig-zags up and down,&#xA;while maximum smoothing gives a straight line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/u4owv.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;There are splines for different jobs, depending on&#xA;the input data and the new points in between:&#xA;tens / millions of points, how noisy, scattered / on a grid, 1d 2d 3d ...&#xA;On a regular grid in 3d for example, a spline of degree $d$&#xA;will look at $(d + 1)^3$ neighbors of each query point:&#xA;1 (nearest neighbour), 8 (trilinear), 27, 64 ... Can you afford 64 ? Do you need 64 ? It depends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Very briefly, B-splines smooth;&lt;br&gt;&#xA;Catmull-Rom splines interpolate, e.g. frames of movies;&lt;br&gt;&#xA;mixtures like 1/3 B + 2/3 CR are usefully in between.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does polynomial degree affect wiggliness ?&#xA;See &lt;a href=&quot;http://en.wikipedia.org/wiki/Runge%27s_phenomenon&quot; rel=&quot;nofollow noreferrer&quot;&gt;Runge's phenomenon&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On overshoot in 1d 2d 3d ... see (ahem)&#xA;&lt;a href=&quot;https://math.stackexchange.com/questions/450328/what-is-the-maximum-overshoot-of-interpolating-splines-in-d-dimensions&quot;&gt;this question&lt;/a&gt;&#xA;on math.stackexchange.&lt;br&gt;&#xA;On the dangers of EXtrapolation with splines beyond linear,&#xA;see &lt;a href=&quot;https://stackoverflow.com/questions/1599754/is-there-easy-way-in-python-to-extrapolate-data-points-to-the-future&quot;&gt;this&lt;/a&gt; on SO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/tagged/spline&quot;&gt;stackoverflow.com/questions/tagged/spline&lt;/a&gt; .&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2013-10-25T10:20:57.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11277" PostTypeId="1" CreationDate="2013-10-24T21:48:24.503" Score="1" ViewCount="1263" Body="&lt;p&gt;I am running Wavelet packet analysis for a 1-D signal. I want to estimate dominate frequencies in the original signal.&#xA;Imagine I have following signal:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fn=[0.4 0.6 1.0];E=[0.03 0.05 0.1];A=[1.0 2.0 3.0];  &#xA;wn=2*pi.*fn;a=E.*wn;wd=wn.*sqrt(1-E.^2);  &#xA;y=A(1)*exp(-a(1)*t).*sin(wd(1)*t)+A(2)*exp(-a(2)*t).*...&#xA; sin(wd(2)*t)+A(3)*exp(-a(3)*t).*sin(wd(3)*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so it contains these frequencies  $\big\{0.4Hz,0.6Hz, 1Hz\big\}$&lt;br&gt;&#xA;My question is what is the best level of decomposition to see these frequencies?&lt;br&gt;&#xA;I select $10Hz$ for sampling rate.&lt;br&gt;&#xA;So my question, what sampling rate should I select for this case to identify these 3 freq? &#xA;(I've select 10Hz for sampling rate)&#xA;and what level of decomposition should I select to see all of these 3 frequencies?&lt;br&gt;&#xA;Here is my little scrip for this signal with wavelet packet  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;df=30;N=300;                            //df:final time,N:segments&#xA;t=linspace(0,df,N); dt=t(3)-t(2);      // dt: time intervals&#xA;fs=ceil(inv(t(2)-t(1)));              // fs: sampling freq&#xA;fn=[0.4 0.6 1.0];E=[0.03 0.05 0.1];   //fn:freq, E:damping&#xA; A=[1.0 2.0 3.0];wn=2*pi.*fn;a=E.*wn;wd=wn.*sqrt(1-E.^2);  // A:Amplitude.&#xA;y=A(1)*exp(-a(1)*t).*sin(wd(1)*t)+A(2)*exp(-a(2)*t).*...&#xA;      sin(wd(2)*t)+A(3)*exp(-a(3)*t).*sin(wd(3)*t);&#xA;level = 3;&#xA;wpt = wpdec(y,level,'coif5');&#xA;[Spec,Time,Freq] = wpspectrum(wpt,fs,'plot'); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;here are result for Level 3,4,5,6 decompositions.&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ap1R2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA; as you see even in level 6 it does not show accurate frequencies. ans If I increase the level to 10 I will observe higher freq that are not exist in the actual signal.&#xA;for level 10: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/KDh7U.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-10-29T21:40:36.357" LastActivityDate="2014-08-26T02:58:30.300" Title="Wavelet packet analysis, Sampling rate, Decomposition level" Tags="|frequency-spectrum|frequency|wavelet|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11278" PostTypeId="2" ParentId="11265" CreationDate="2013-10-24T23:30:39.623" Score="1" Body="&lt;p&gt;Energy stored in capacitors and inductors, lumped or distributed, within the filter, whose current state constrains what could have happened in the past to allow said current state, which thus can be called a form of memory of that past.  Or the digital state equivalent.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-24T23:30:39.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11279" PostTypeId="2" ParentId="11254" CreationDate="2013-10-25T00:40:32.233" Score="1" Body="&lt;p&gt;Consider a two-sample moving average of one-bit data with values {0,1}. The bandwidth is reduced by a factor of two. The possible outputs are {0,0.5,1}. You have gained half a bit, as predicted by the formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;John&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2013-10-25T00:40:32.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11280" PostTypeId="2" ParentId="11277" CreationDate="2013-10-25T05:09:45.603" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;My question is what is the best level of decomposition to see these frequencies?&quot; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can achieve this through separation of the three components you have into different bands. Since the inner most level is a low passed version of the signal, you should try using at least 3+1 decomposition levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With dyadic scaling (the decomposition method typically used with wavelets) outer decomposition level covers the range of frequencies from F/2 to F .. The next level covers F/4 to F/2.. and the next level covers F/8 to F/4....etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LrR62.png&quot; alt=&quot;1D Wavelet Dyadic Scaling&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume a signal of two sinusoids (0.4Hz and 1 Hz) with 10Hz sampling rate you get the following plot for its frequency content decomposition into 5 scales dyadic wavelet scales. by changing the sampling ratio, the location of the peaks in wavelets subbands change   &lt;img src=&quot;https://i.stack.imgur.com/m8h4H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-10-25T14:29:04.320" LastActivityDate="2013-10-25T14:29:04.320" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11281" PostTypeId="1" CreationDate="2013-10-25T06:15:39.820" Score="14" ViewCount="16211" Body="&lt;p&gt;What is the difference between the Fourier transform, short-time Fourier transform and wavelets?&lt;/p&gt;&#xA;" OwnerUserId="5778" LastEditorUserId="1629" LastEditDate="2021-01-17T16:00:19.777" LastActivityDate="2021-01-18T12:29:44.263" Title="Comparison between Fourier transform, short-time Fourier transform and wavelets" Tags="|fourier-transform|wavelet|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11282" PostTypeId="1" AcceptedAnswerId="11293" CreationDate="2013-10-25T06:42:27.047" Score="11" ViewCount="21014" Body="&lt;p&gt;I know that for a given system, the Fourier transform of its impulse response gives its frequency response.&#xA;I want to find where this property comes from, but haven't been able to find if it's a definition or if there's a mathematical proof available, for both continuous and discrete-time systems.&lt;/p&gt;&#xA;" OwnerUserId="5779" LastEditorUserId="5779" LastEditDate="2017-06-13T09:44:11.813" LastActivityDate="2021-10-06T03:44:49.883" Title="For an LTI system, why does the Fourier transform of the impulse response give the frequency response?" Tags="|discrete-signals|continuous-signals|impulse-response|frequency-response|fourier|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11283" PostTypeId="2" ParentId="11265" CreationDate="2013-10-25T06:47:17.720" Score="0" Body="&lt;p&gt;The output of a FIR filter depends on how many coefficients it has. For example, a 64-tap filter's output will be calculated from its 64 coefficients, and the latest input sample + the 63 ones before, so we can say it has 63 memory units.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is related to the use of shift registers in digital filters (one per coefficient), who effectively are memories.&lt;/p&gt;&#xA;" OwnerUserId="5779" LastEditorUserId="5779" LastEditDate="2013-10-25T07:10:50.107" LastActivityDate="2013-10-25T07:10:50.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11285" PostTypeId="2" ParentId="11270" CreationDate="2013-10-25T07:12:08.847" Score="13" Body="&lt;p&gt;Your question is a bit harsh, because it's kind of vague. I will give you a few points, maybe it will help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's the same?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intuitions behind both bilateral filtering and anisotropic diffusion are the same:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;averaging is good&lt;/em&gt; to remove random noise;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;averaging&lt;/em&gt; should only concern &lt;em&gt;pixels that belong to the same region&lt;/em&gt; (in the sense that they are pixels of a given color of a given object):&#xA;&lt;ol&gt;&#xA;&lt;li&gt;to avoid artifacts at the borders between regions (most notably, blur)&lt;/li&gt;&#xA;&lt;li&gt;to improve the denoising efficiency (without outliers inside, averaging is more efficient).&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's different?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bilateral filtering and anisotropic diffusion will differ by how they achieve these two goals (under the constraint that an image segmentation is not available).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, &lt;strong&gt;anisotropic diffusion&lt;/strong&gt; is expressed in a &lt;em&gt;variational framework&lt;/em&gt;, where some image functional is minimized. These functionals usually include a term that depends on the gradient of the image to be denoised, because this term allows to trigger the anisotropy property. The solutions to these problems are usually obtained &lt;em&gt;iteratively&lt;/em&gt; via some gradient descent, but not always (in image morphology inspired frameworks such as mean curvature motion for example, image level lines are moved according to their curvature). &lt;br /&gt;&#xA;Basically, the solutions to these functionals correspond with isotropic diffusion inside homogeneous areas, and diffusion across image edges is stopped by a weight depending on the image gradient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bilateral filtering&lt;/strong&gt; is a &lt;em&gt;pixel-based&lt;/em&gt; approach. For a given pixel, its denoised counterpart is obtained by the weighted average of its neighbours, where the weights are given by some function that depends on their color similarity and image distance.&#xA;Unlike anisotropic diffusion then, the problem is not solved globally over the image but over each a neighbourhood surrounding each pixel.&#xA;Furthermore, there is no explicit gradient-based barrier at a given pixel: this effect will be more or less pronounced by the value of the decay put in the visual distance function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that when the bilateral neighborhood of a pixel goes infinite, you have a new algorithm called &lt;a href=&quot;http://www.computersdontsee.net/index.php/post/2013/04/13/NL-means%3a-some-math&quot;&gt;nonlocal means&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;And now.. the speed&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of quality, I would consider that either approach is good. Anisotropic diffusion has some caveat though:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;since it's usually implemented as some gradient descent or PDE solver, a quick-and-dirty implementation can run into numerical issues;&lt;/li&gt;&#xA;&lt;li&gt;in my opinion, it's easier to tune the decay of the distance function in bilateral filtering than the data term in anisotropic diffusion functionals.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Remains the speed... This part depends a lot on the practical implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When bilateral neighborhood size gets large (OpenCV claims large is above 5 pixels) then bilateral filtering is slow.&#xA;You can use some tricks (Gaussian approximated by boxes, pre-selection criterion...) to accelerate the code. In fact, there's even a significant part of the literature on bilateral filtering that is dedicated to speeding it up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anisotropic diffusion, it depends in the numerical scheme implemented to solve the problem. Some are better (faster and more stable) than others: typically, TV regularized constraint is nowadays implemented with Chambolle's projectors (fast) or with Nesterov's acceleration (see &lt;a href=&quot;http://mechroom.technion.ac.il/~becka/papers/71654.pdf&quot;&gt;FISTA&lt;/a&gt; -- faster).&#xA;Furthermore, these schemes are well suited to massively parallel implementations (GPGPU, data parallel multithreading) that reduce greatly the computation time.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2013-10-25T11:17:54.083" LastActivityDate="2013-10-25T11:17:54.083" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11286" PostTypeId="2" ParentId="11282" CreationDate="2013-10-25T09:47:51.640" Score="3" Body="&lt;p&gt;The key ingredient is that the base functions of the Fourier transform $\exp(i \omega t)$ are eigenfunctions of LTI systems. That means the LTI system can be represented as a diagonal linear operator in the Fourier basis. Or in other words: To apply an LTI system in frequency domain, you just multiply their frequency responses. And applying an LTI system to a signal means multiplying the system frequency response with the Fourier transform of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to measure the frequency response of a system, we can let the system act on a signal with a known nowhere-vanishing Fourier transform, ideally even one with constant unit Fourier transform $F\{s(t)\}(\omega)=1$, and that is the unit impulse function in time domain. The resulting Fourier transform is then 1 multiplied with the LTI frequency response, so it's the frequency response of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not precisely what you asked for, because the calculation happened in frequency domain. But we can switch between time and frequency domain at any point during the calculation. So you can run your unit impulse signal through the system in time domain to get the &lt;em&gt;impulse response&lt;/em&gt; of the system, and only then take the Fourier transform in the end. That's why the Fourier transform of the impulse response is the frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All this can be spelled out mathematically and more rigorously, but I think you should be able to see the connection even with this slightly superficial description. If you need more details, let me know.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-10-25T09:47:51.640" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11287" PostTypeId="1" AcceptedAnswerId="11288" CreationDate="2013-10-25T11:53:03.113" Score="3" ViewCount="1294" Body="&lt;p&gt;I'm using a C# library that has the FIR filter implemented and I'd like to know what's the meaning of the ${z^{-1}}$ operation (delay) mathematically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lA1Ck.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The triangle is multiplication, the circle is a sum, but what does the delay means in terms of mathematical operations?&lt;/p&gt;&#xA;" OwnerUserId="5160" LastActivityDate="2013-10-25T19:36:20.507" Title="What is the meaning of the delay in a FIR filter" Tags="|filters|finite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11288" PostTypeId="2" ParentId="11287" CreationDate="2013-10-25T12:14:33.347" Score="3" Body="&lt;p&gt;In mathematical terms, time discrete systems are are most often expressed in terms of difference equations. A delay is simply $y[n]=x[n-1]$ so the difference equation for your FIR filter would be $$y[n]=\sum_{i=0}^{M}b_{i}\cdot x[n-i]$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/&lt;/a&gt; for a good primer&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-25T12:14:33.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11289" PostTypeId="2" ParentId="8436" CreationDate="2013-10-25T13:28:45.347" Score="3" Body="&lt;p&gt;I'm a DSP student and perhaps this is not the most complete answer. I have to answer the same question in a partial work and this is what I got so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As said by André pure stationary signal is a signal in which mean and variance does not change in time. In nature (real life, man interpreted music, etc.) this is very hard to find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you may:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Visualize the signal in an spectrogram. If the signal is stationary the signal will appear as horizontal bars of same intensity in the spectrogram:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mmc79.png&quot; alt=&quot;,&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even in this signal, made from a filtered white noise and a tone the media and the variance changes a little in time.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;So, split the segments of your signal under test to find the whether the media and variance doesn't change 'much'. How 'much' depends on you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% test for stationary B&#xA;&#xA;xnbf = buffer(signal,100);&#xA;&#xA;mxn = mean(xnbf);&#xA;&#xA;sxn = std(xnbf);&#xA;&#xA;figure; errorbar(mxn, sxn, 'o'); title('Signal A')&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, check this link, which includes a comprehensive list of methods to test whether a process is stationary or not:&#xA;&lt;a href=&quot;https://quant.stackexchange.com/questions/2372/how-to-check-if-a-timeseries-is-stationary&quot;&gt;https://quant.stackexchange.com/questions/2372/how-to-check-if-a-timeseries-is-stationary&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5748" LastEditorUserId="-1" LastEditDate="2017-04-13T12:46:24.070" LastActivityDate="2015-01-29T13:15:18.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11290" PostTypeId="1" CreationDate="2013-10-12T12:15:10.433" Score="4" ViewCount="14864" Body="&lt;p&gt;I'd like to implement a digital notch filter, which has linear phase, in C++ or C#.&#xA;Example : a notch filter that removes 400hz frequency on a .wav file (16 bit, 44.1 Khz, stereo).&#xA;I'm a bit lost with many examples, I don't achieve to implement them.&#xA;Maybe some of you has a working example?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="5648" OwnerDisplayName="Jos Bas" LastActivityDate="2016-04-27T21:27:20.670" Title="Linear phase Notch filter / Band reject filter implementation in C++" Tags="|filters|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11291" PostTypeId="2" ParentId="11290" CreationDate="2013-10-12T20:53:18.390" Score="5" Body="&lt;p&gt;You can implement a simple recursive filter to process blocks of samples like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void filter(const int *x, int *y, int n)&#xA;{&#xA;    static float x_2 = 0.0f;                    // delayed x, y samples&#xA;    static float x_1 = 0.0f;&#xA;    static float y_2 = 0.0f;&#xA;    static float y_1 = 0.0f;&#xA;&#xA;    for (i = 0; i &amp;lt; n; ++i)&#xA;    {&#xA;        y[i] = a0 * x[i] + a1 * x_1 + a2 * x_2  // IIR difference equation&#xA;                         + b1 * y_1 + b2 * y_2;&#xA;        x_2 = x_1;                              // shift delayed x, y samples&#xA;        x_1 = x[i];&#xA;        y_2 = y_1;&#xA;        y_1 = y[i];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notch filter coefficients a0, a1, a2, b1, b2 can be calculated using eq 19-8 on this page: &lt;a href=&quot;http://dspguide.com/ch19/3.htm&quot; rel=&quot;nofollow&quot;&gt;http://dspguide.com/ch19/3.htm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastEditorUserId="39" LastEditDate="2016-04-27T21:27:20.670" LastActivityDate="2016-04-27T21:27:20.670" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="11292" PostTypeId="2" ParentId="11290" CreationDate="2013-10-12T20:53:52.480" Score="2" Body="&lt;p&gt;If you usually use Matlab for analysis the files, you might want to consider using Simulink and then just generate the code of the filter. Especially if this is something you run in real time (ie inputting audio and processing it on the fly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach is using the coefficients as was suggested above.Once you have those you can use the following formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output[i] = A[0] * in[2] + A[1] * in[1] + A[2] * in[0] - B[1] * out[1] - B[2] * out[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where A/B are you coefficients, in[0,1,2] are 3 points of you original file and out [0,1,2] is the filtered one. Of-course for the first few points there are no values of out[0,1] and you should erase them after filtration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By running this formula and shifting both in and out at each point you will result in your filtered signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/297133&quot; rel=&quot;nofollow&quot;&gt;this thread&lt;/a&gt; for further explanation&lt;/p&gt;&#xA;" OwnerDisplayName="PolinaK" LastActivityDate="2013-10-12T21:18:38.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11293" PostTypeId="2" ParentId="11282" CreationDate="2013-10-25T13:48:00.357" Score="15" Body="&lt;p&gt;Let $h(t)$ denote the impulse response of an LTI system. Then, for any input $x(t)$,&#xA;the output is $$y(t) = \int_{-\infty}^\infty h(\tau)x(t-\tau)\,\mathrm d\tau.$$&#xA;In particular, the response to the input $x(t) = \exp(j2\pi ft)$ is &#xA;$$\begin{align}&#xA;y(t) &amp;amp;= \int_{-\infty}^\infty h(\tau)\exp(j2\pi f(t-\tau))\,\mathrm d\tau\\&#xA;&amp;amp;= \exp(j2\pi ft)\int_{-\infty}^\infty h(\tau)\exp(-j2\pi f\tau)\,\mathrm d\tau\\&#xA;&amp;amp;= H(f)\exp(j2\pi ft),\tag{1}&#xA;\end{align}$$&#xA;where $H(f)$ is the Fourier transform of the impulse response&#xA;$h(t)$.  In words, for an LTI system with impulse response $h(t)$, the&#xA;input $\exp(j2\pi ft)$ produces output $H(f)\exp(j2\pi ft)$.&#xA;This is precisely what we have as the definition of the&#xA;&lt;em&gt;frequency response&lt;/em&gt; of an LTI system (call&#xA;this $FR(f)$ for now): &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;for every frequency $f$, the response&#xA;  to $\exp(j2\pi ft)$ is $FR(f)\exp(j2\pi ft)$ which is just&#xA;  a (complex) constant times the input complex exponential.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But $(1)$ shows that $FR(f)$ is just $H(f)$, the Fourier&#xA;transform of the impulse response $h(t)$, which is what you&#xA;wanted to prove.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-10-25T13:48:00.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11294" PostTypeId="2" ParentId="11234" CreationDate="2013-10-25T14:04:14.917" Score="2" Body="&lt;p&gt;Thanks to &lt;a href=&quot;https://scicomp.stackexchange.com/a/8869/729&quot;&gt;Jan&lt;/a&gt;'s code. I made my implementation work.&lt;br&gt;&#xA;The code below compare: Haar vs Fourier vs Chebyshev.&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RXAl3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from __future__ import division&#xA;from mpmath import *&#xA;&#xA;# --------- Haar wavelet approximation of a function&#xA;# algorithm from : http://fourier.eng.hmc.edu/e161/lectures/wavelets/node5.html&#xA;# implementation only handle [0,1] for the moment: scaling and wavelet fcts need to be periodice&#xA;&#xA;phi = lambda x : (0 &amp;lt;= x &amp;lt; 1) #scaling fct&#xA;psi = lambda x : (0 &amp;lt;= x &amp;lt; .5) - (.5 &amp;lt;= x &amp;lt; 1) #wavelet fct&#xA;phi_j_k = lambda x, j, k : 2**(j/2) * phi(2**j * x - k)&#xA;psi_j_k = lambda x, j, k : 2**(j/2) * psi(2**j * x - k)&#xA;&#xA;def haar(f, interval, level):&#xA;    c0 = quadgl(  lambda t : f(t) * phi_j_k(t, 0, 0), interval  )&#xA;&#xA;    coef = []&#xA;    for j in xrange(0, level):&#xA;        for k in xrange(0, 2**j):&#xA;                djk = quadgl(  lambda t: f(t) * psi_j_k(t, j, k), interval  )&#xA;                coef.append( (j, k, djk) )&#xA;&#xA;    return c0, coef&#xA;&#xA;def haarval(haar_coef, x):&#xA;    c0, coef = haar_coef&#xA;    s = c0 * phi_j_k(x, 0, 0)&#xA;    for j, k ,djk in coef:&#xA;            s += djk * psi_j_k(x, j, k)&#xA;    return s&#xA;&#xA;# --------- to plot an Haar wave&#xA;interval = [0, 1]&#xA;plot([lambda x : phi_j_k(x,1,1)],interval)&#xA;&#xA;# ---------- main&#xA;# below is code to compate : Haar vs Fourier vs Chebyshev&#xA;&#xA;nb_coeff = 5&#xA;interval = [0, 1] # haar only handle [0,1] for the moment: scaling and wavelet fcts need to be periodice&#xA;&#xA;fct = lambda x : x&#xA;&#xA;haar_coef = haar(fct, interval, nb_coeff)&#xA;haar_series_apx = lambda x : haarval(haar_coef, x)&#xA;&#xA;fourier_coef = fourier(fct, interval, nb_coeff)&#xA;fourier_series_apx = lambda x: fourierval(fourier_coef, interval, x)&#xA;chebyshev_coef = chebyfit(fct, interval, nb_coeff)&#xA;chebyshev_series_apx = lambda x : polyval(chebyshev_coef, x)&#xA;&#xA;&#xA;print 'fourier %d chebyshev %d haar %d' % ( len(fourier_coef[0]) + len(fourier_coef[1]),len(chebyshev_coef), 1 + len(haar_coef[1]))&#xA;print 'error:'&#xA;print 'fourier', quadgl(  lambda x : abs( fct(x) - fourier_series_apx(x) ), interval  )&#xA;print 'chebyshev', quadgl(  lambda x : abs( fct(x) - chebyshev_series_apx(x) ), interval  )&#xA;print 'haar', quadgl(  lambda x : abs( fct(x) - haar_series_apx(x) ), interval  )&#xA;&#xA;plot([fct, fourier_series_apx, chebyshev_series_apx, haar_series_apx], interval) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user5746" LastEditorUserId="-1" LastEditorDisplayName="user5746" LastEditDate="2017-04-13T12:53:54.087" LastActivityDate="2013-10-25T14:36:38.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11297" PostTypeId="2" ParentId="11281" CreationDate="2013-10-25T16:54:18.627" Score="18" Body="&lt;p&gt;All three transforms are inner product transforms, meaning the output is the inner product of a family of basis functions with a signal. The parametrization and form of the basis functions determine the properties of the transforms.The number of basis functions for a complete picture (i.e. a result that contains enough information to reconstruct the original signal) is  the same for all three cases. That is a result of the Heisenberg uncertainty or a bit more general, conservation of information.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For the standard Fourier transform the basis functions are simply the complex oscillations&#xA;&lt;span class=&quot;math-container&quot;&gt;$$b_\omega(t) := \exp(i \omega t)$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is the time axis of the signal and &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; is the single frequency parameter that determines the basis function in the family. There is one basis function for every &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;. The fourier transform of the signal &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt; is then simply the inner product written as an integral:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{F}\left\{s(t)\right\}(\omega)=\langle b(\omega,t),s(t)\rangle=\int_{-\infty}^\infty \exp(-i \omega \tau) s(\tau)d\tau$$&lt;/span&gt;&#xA;The negative sign in the exponential comes from the complex conjugation in the general inner product definition &lt;span class=&quot;math-container&quot;&gt;$$\langle a(t),b(t)\rangle=\int_{-\infty}^\infty a(\tau)^*b(\tau) d\tau$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The short time fourier transform adds a time dimension to the base function parameters by multiplying the infinitely long complex exponential with a window to localize it. The base functions are then something like &lt;span class=&quot;math-container&quot;&gt;$$b_{(\omega,t_0)}(t):= w(t-t_0)\exp(i \omega t)$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$w(t)$&lt;/span&gt; is the window functions that vanishes outside some interval and &lt;span class=&quot;math-container&quot;&gt;$(\omega,t_0)$&lt;/span&gt; are the time-frequency coordinates of the base function in the family. The inner product becomes then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{S}\left\{s(t)\right\}(\omega,t_0) = \int_{-\infty}^\infty w(\tau)^* \exp(-i\omega \tau) s(\tau)d\tau$$&lt;/span&gt;&#xA;and gives you time and frequency information. The actual tradeoff between time and frequency is determined by the choice of the window function. The result of this transform can also be regarded as a filterbank with bandpass filters that have the fourier transform as the window &lt;span class=&quot;math-container&quot;&gt;$w(t)$&lt;/span&gt; as frequency response, but shifted to the center frequency &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;. All the filters therefore have the same bandwidth.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The wavelet transform does away with the constant bandwidth constraint and adapts the window size to the frequency. And that happens in a specific scale invariant way that doesn't even need the complex modulation anymore. You start with a generic base function that is localized and oscillates, and it also has zero mean (i.e. the integral over the complete space is 0). That is your wavelet. Now if you scale the wavelet in time direction the oscillation frequency changes as well, so you can control localization and oscillation with a single parameter that links the two. The family of base functions is therefore something like &lt;span class=&quot;math-container&quot;&gt;$$b_{(\sigma,t_0)}(t) = w\left(\frac{t-t_0}{\sigma}\right)$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; is the original wavelet and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; the scale parameter. The inner product becomes then &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{W}\left\{s(t)\right\}(\sigma,t_0)=\int_{-\infty}^\infty w\left(\frac{t-t_0}{\sigma}\right)^* s(t)$$&lt;/span&gt;&#xA;Again this gives you a 2-dimensionally parametrized result that can also be seen as a filterbank, but this time the bandwidth of the filters is proportional to the center frequency of the bands. The time-frequency plane is therefore partitioned non-uniformly and more suitable to many real-world signals where the typical time constants of processes is naturally scale dependent.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="1629" LastEditDate="2021-01-18T12:29:44.263" LastActivityDate="2021-01-18T12:29:44.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11298" PostTypeId="2" ParentId="11287" CreationDate="2013-10-25T19:36:20.507" Score="2" Body="&lt;p&gt;The $z^{-1}$ notation comes from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Definition&quot; rel=&quot;nofollow&quot;&gt;Z-transform&lt;/a&gt; which is the discrete-time equivalent of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_transform&quot; rel=&quot;nofollow&quot;&gt;Laplace transform&lt;/a&gt;.  On it's own, the only mathematical meaning that multiplying by $z^{-1}$ holds is a delay of one sample. However, as part of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Linear_constant-coefficient_difference_equation&quot; rel=&quot;nofollow&quot;&gt;transfer function&lt;/a&gt; it is a very powerful notation which allows you to study the frequency response of the system based on its zeros and poles.  Transfer functions expressed in this way can be useful for both system analysis &lt;em&gt;and&lt;/em&gt; system design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are just trying to implement a specific FIR filter with given coefficients, the only thing you need to know about $z^{-1}$ is that it represents a delay. You could just as easily represent the filter in your question by representing the whole row of $z^{-1}$ elements as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Shift_register#Serial-in.2C_parallel-out_.28SIPO.29&quot; rel=&quot;nofollow&quot;&gt;serial-in, parallel-out shift register&lt;/a&gt;. At each cycle of the &quot;clock,&quot; the delay elements accept a new value on their inputs and &lt;a href=&quot;http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29#D_flip-flop&quot; rel=&quot;nofollow&quot;&gt;hold that value&lt;/a&gt; until the next clock cycle.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-10-25T19:36:20.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11299" PostTypeId="2" ParentId="11261" CreationDate="2013-10-25T20:21:41.993" Score="2" Body="&lt;p&gt;You are &lt;em&gt;already&lt;/em&gt; just low-pass filtering the magnitude of the input signal. Right now, your envelope detection &quot;circuit&quot; is just a single-pole filter. Let $f[n]$ be the input to your system and, for simplicity sake, assume that &lt;code&gt;attack_coef&lt;/code&gt; $=$ &lt;code&gt;release_coef&lt;/code&gt; $ = a_1$. Then we can express the output $y$ of your system as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = a_1 \left(y[n-1] - |f[n]|\ \right) + |f[n]|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which we can rearrange as a transfer function $h$ as follows:&#xA;$$y = a_1 \left(y\,z^{-1} - |f|\right) + f$$&#xA;$$h = \frac{y}{|f|} = \frac{1 - a_1}{1 - a_1 z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use this information to either adjust your coefficients to get the desired cutoff frequency, or you could add another pole if you want a steeper roll-off.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastEditorUserId="5156" LastEditDate="2013-10-25T21:37:55.533" LastActivityDate="2013-10-25T21:37:55.533" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11300" PostTypeId="1" AcceptedAnswerId="11301" CreationDate="2013-10-25T21:31:13.340" Score="0" ViewCount="527" Body="&lt;p&gt;I have a set of data in excel like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3uDDT.jpg&quot; alt=&quot;excel data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;column A is time in ns and column B is the electric field strength.&#xA;now I want to convert the time-domain signal from these data to a frequency-domain signal with DSP toolbox in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to calculate Fs (sampling frequency) in order to use in signal analyse i use this formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time = T(:,1);      &#xA;L=2033;       &#xA;Ts = mean(diff(time));&#xA;Fs = 1/Ts;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which leads to :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs= 5e+09&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I import the signal (E) with sampling frequency Fs in signal analyze toolbox.&#xA;my signal is like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2Hn94.jpg&quot; alt=&quot;Signal in Matlab&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now i want to apply a bandpass filter in 16-32 MHZ range , so :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GV1pZ.jpg&quot; alt=&quot;Out of memory&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've increased the paging file to maximum on my system with no success!&#xA;I should say that my system configuration is like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i5 CPU at 2.5 GHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;8 GB R3 Ram at 1600 MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I have two specific questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1- what should I do? Is there any thing that I should do to to be able to design the filter on my system?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2- if I change the time to second and the frequency to hz , how much does the results change?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5787" LastActivityDate="2013-10-25T21:55:53.443" Title="Out of memory problem with filter design tool in Matlab" Tags="|matlab|filters|bandpass|" AnswerCount="1" CommentCount="1" ClosedDate="2013-11-17T18:57:23.173" ContentLicense="CC BY-SA 3.0" />
  <row Id="11301" PostTypeId="2" ParentId="11300" CreationDate="2013-10-25T21:55:53.443" Score="1" Body="&lt;p&gt;Your sampling frequency is currently set to 5000000000 MHz, which is 5000 terahertz!  Notice that the units on the frequency specification should all be in MHz. Change the Fs value to be 5000 (MHz) and you will be much better off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, even once you fix this problem, you still may run into trouble.  You are specifying transition bands that have a width of less than 0.01% of your sampling rate.  This is not going to be practical, especially as an FIR filter.  I recommend that you consider a good low-pass filter followed by lots of down sampling.  Then you will be able to realistically extract the band of interest.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-10-25T21:55:53.443" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11302" PostTypeId="1" CreationDate="2013-10-25T23:10:10.477" Score="0" ViewCount="858" Body="&lt;p&gt;I have a signal in matlab like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Au5q3.jpg&quot; alt=&quot;Signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have designed a band-pass filter in 16-32 MHz range:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r8uxe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and applied the filter to the signal,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aQRQe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the result is like this :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TwQlU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;what is the easiest way to convert this time-domain signal into a frequency based signal?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can I export the signal into workspace and use the data variable?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fWFku.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bMbfo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1ctkr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5787" LastActivityDate="2013-10-26T15:41:57.247" Title="How to convert a filtered time-domain signal into frequency one?" Tags="|fft|filters|bandpass|" AnswerCount="1" CommentCount="3" ClosedDate="2013-11-14T22:04:27.367" ContentLicense="CC BY-SA 3.0" />
  <row Id="11303" PostTypeId="2" ParentId="2847" CreationDate="2013-10-26T05:43:38.123" Score="1" Body="&lt;p&gt;Equation 11.1 shows the equation for $A$:&#xA;$$A(\tau,\omega) = A_0 \exp\left(-\frac{\omega \tau}{2Q}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We see that $A$ really only depends on the product of $\tau$ and $\omega$, therefore by defining a new variable $\chi = \omega \tau$ we can rewrite this expression as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(\chi) = A_0 \exp\left(-\frac{\chi}{2Q}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps this helps.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-10-26T05:43:38.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11305" PostTypeId="2" ParentId="6088" CreationDate="2013-10-26T06:06:53.360" Score="1" Body="&lt;p&gt;The &lt;code&gt;wavdec&lt;/code&gt; function does not produce a DWT which is non-redundant. Instead, &lt;code&gt;wavdec&lt;/code&gt; takes you &lt;em&gt;N&lt;/em&gt; levels down the decomposition process. In other words, you shouldn't expect to get 8 coefficients back.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2014-02-21T19:55:06.057" LastActivityDate="2014-02-21T19:55:06.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11307" PostTypeId="1" CreationDate="2013-10-26T08:22:23.420" Score="2" ViewCount="2615" Body="&lt;p&gt;Why I get a different response from the same system (e.g. three phase inverter with LC filter) in state space form and in transfer function (Laplace) form when using the same PI controller values ($K_p$ and $T_i$)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I start with differential equations for each phase $a$, $b$ and $c$ to get state space model &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}\frac{dx}{dt}&amp;amp;=Ax+Bu\\y&amp;amp;=Cx+Du\end{align} &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Than an $abc/dq$ transformation is applied (to get coupled relationship between $d$ and $q$ frame). Finally separate equations for $d$ and $q$ frame can be written and transformed to Laplace. From there I can get control scheme and calculate $K_p$ and $T_i$ to get desired overshoot and settling time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I use the same $K_p$ and $T_i$ in the state space model I get extremely noisy and oscillatory response. My question is why is that? I read previous similar question “&lt;a href=&quot;http://www.physicsforums.com/showthread.php?t=265934&quot; rel=&quot;nofollow&quot;&gt;Control theory: Laplace versus state space representation&lt;/a&gt;” and the difference is that the transfer function neglects initial states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional question: how to then calculate PI controller values when using state space form to get desired overshoot and settling time?&lt;/p&gt;&#xA;" OwnerUserId="5789" LastEditorUserId="1629" LastEditDate="2016-06-07T22:57:10.267" LastActivityDate="2016-06-07T22:57:10.267" Title="Difference between state space and transfer function model response (in Simulink)" Tags="|matlab|filter-design|transfer-function|state-space|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11309" PostTypeId="2" ParentId="11302" CreationDate="2013-10-26T15:41:57.247" Score="2" Body="&lt;p&gt;Taking the FFT will give you a frequency representation of the data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y=fft(sig3.data);&lt;/p&gt;&#xA;" OwnerUserId="5315" LastActivityDate="2013-10-26T15:41:57.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11312" PostTypeId="1" AcceptedAnswerId="11323" CreationDate="2013-10-26T20:59:37.520" Score="8" ViewCount="25610" Body="&lt;p&gt;So I just revised my pitch calculation algorithm using a harmonic product spectrum algorithm. I was just curious about why this explanation of Harmonic Product Spectrum states that you need to implement a Hanning Window to the data set. What would be the effect of implementing other Window functions on a data set (and then FFTing it)? Which Windowing function is actually the best for frequency detection? Here are the relevant methods I have used in my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Calculates the Frequency based off of the byte array,&#xA; * @param bytes The audioData you want to analyze&#xA; * @return The calculated frequency in Hertz.&#xA; */&#xA;private int getFrequency(byte[] bytes){&#xA;    double[] audioData = this.bytesToDoubleArray(bytes);&#xA;    audioData = applyHanningWindow(audioData);&#xA;    Complex[] complex = new Complex[audioData.length];&#xA;    for(int i = 0; i&amp;lt;complex.length; i++){&#xA;        complex[i] = new Complex(audioData[i], 0);&#xA;    }&#xA;    Complex[] fftTransformed = FFT.fft(complex);&#xA;    //return calculateFrequency(fftTransformed);&#xA;    System.out.println(&quot;Max size:&quot; + (fftTransformed.length*getFFTBinSize(fftTransformed.length)/4));&#xA;    return calculateFundamentalFrequency(fftTransformed,4);&#xA;}&#xA;&#xA;private double[] applyHanningWindow(double[] data){&#xA;    return applyHanningWindow(data, 0, data.length);&#xA;}&#xA;&#xA;private double[] applyHanningWindow(double[] signal_in, int pos, int size)&#xA;{&#xA;    for (int i = pos; i &amp;lt; pos + size; i++)&#xA;    {&#xA;        int j = i - pos; // j = index into Hann window function&#xA;        signal_in[i] = (double)(signal_in[i] * 0.5 * (1.0 - Math.cos(2.0 * Math.PI * j / size)));&#xA;    }&#xA;    return signal_in;&#xA;}&#xA;&#xA;&#xA;/**&#xA; * Harmonic Product Spectrum&#xA; * @param fftData&#xA; * @param n&#xA; * @return&#xA; */&#xA;private int calculateFundamentalFrequency(Complex[] fftData, int n){&#xA;    Complex[][] data = new Complex[n][fftData.length/n];&#xA;    for(int i = 0; i&amp;lt;n; i++){&#xA;        for(int j = 0; j&amp;lt;data[0].length; j++){&#xA;            data[i][j] = fftData[j*(i+1)];&#xA;        }&#xA;    }&#xA;    Complex[] result = new Complex[fftData.length/n];//Combines the arrays&#xA;    for(int i = 0; i&amp;lt;result.length; i++){&#xA;        Complex tmp = new Complex(1,0);&#xA;        for(int j = 0; j&amp;lt;n; j++){&#xA;            tmp = tmp.times(data[j][i]);&#xA;        }&#xA;        result[i] = tmp;&#xA;    }&#xA;    //Calculates Maximum Magnitude of the array&#xA;    double max = Double.MIN_VALUE;&#xA;    int index = -1;&#xA;    for(int i = 0; i&amp;lt;result.length; i++){&#xA;        Complex c = result[i];&#xA;        double tmp = c.getMagnitude();&#xA;        if(tmp&amp;gt;max){&#xA;            max = tmp;;&#xA;            index = i;&#xA;        }&#xA;    }&#xA;    return index*getFFTBinSize(fftData.length);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5485" LastEditorUserId="5485" LastEditDate="2013-10-26T21:13:48.867" LastActivityDate="2021-08-05T14:44:34.847" Title="Why should one use windowing functions for FFT?" Tags="|fft|frequency|sound|window-functions|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11313" PostTypeId="1" CreationDate="2013-10-27T01:50:22.750" Score="3" ViewCount="1672" Body="&lt;p&gt;I am programming a voice activity detection algorithm and I found a paper that recommends the use of HHT. I have been trying to program it and understand how to calculate $m1(x)$, but the shifting process confuses me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone explain what exactly I need to do after I calculate the mean value between the two splines of the original data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I found at this website: &#xA;&lt;a href=&quot;https://www.clear.rice.edu/elec301/Projects02/empiricalMode/process.html&quot; rel=&quot;nofollow&quot;&gt;https://www.clear.rice.edu/elec301/Projects02/empiricalMode/process.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first component h1 is computed:&#xA;$h_1=X(t)-m_1$&#xA;In the second sifting process, $h_1$ is treated as the data, and m11 is the mean of $h_1$'s upper and lower envelopes:&#xA;$h_{11}=h_1-m_{11}$&#xA;This sifting procedure is repeated $k$ times, until $h_{1k}$ is an IMF, that is:&#xA;$h_{1(k-1)}-m_{1k}=h_{1k}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does it go from $h_1$ to $h_{11}$? I am really confused by this. &lt;/p&gt;&#xA;" OwnerUserId="5485" LastEditorUserId="128" LastEditDate="2023-06-24T09:27:35.697" LastActivityDate="2023-06-24T09:27:35.697" Title="How do I perform the sifting process in empirical mode decomposition?" Tags="|signal-analysis|frequency|decomposition|empirical-mode-decomposition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11314" PostTypeId="1" CreationDate="2013-10-27T02:38:08.520" Score="2" ViewCount="68" Body="&lt;p&gt;The top answer to this question: &lt;a href=&quot;https://dsp.stackexchange.com/questions/10148/power-spectral-density-vs-energy-spectral-density&quot;&gt;Power spectral density vs Energy spectral density&lt;/a&gt; states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However if random process is stationary, then it is for sure that it&#xA;  has some finite power over some band of frequencies&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is that? Also, is stationarity a necessary condition for a process to have finite power over a band of frequencies?&lt;/p&gt;&#xA;" OwnerUserId="1026" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-10-27T02:38:08.520" Title="Stationary processes and their power" Tags="|fourier-transform|power-spectral-density|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11315" PostTypeId="2" ParentId="11313" CreationDate="2013-10-27T02:43:44.267" Score="5" Body="&lt;p&gt;It's not &lt;em&gt;s&lt;/em&gt;&lt;strong&gt;&lt;em&gt;h&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;ifting&lt;/em&gt;, it's &lt;em&gt;&lt;a href=&quot;http://www.wordnik.com/words/sift&quot; rel=&quot;nofollow&quot;&gt;sifting&lt;/a&gt;&lt;/em&gt;. After you find the $m_1$ curve, your subtract it from your signal $X$ to get $h_1= X(t) - m_1$. You're essentially taking away that signal component and are left with $h_1$, which is your new starting point of your next iteration. I assume you were confused by the terminology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sifting is a general term in signal processing related to separating out components of a signal one at a time. It is frequently used in context of wavelet decomposition since this process is very similar in this respect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason the next function is $h_{11}$ and not $h_2$ is because you have to keep going with this process until the resulting $h_{1k}$ is an IMF function (criteria given on the top of the page). Once you've reached that point, you get your first IMF basis function $c_1$. Only at this point have you reached your first empirical mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you start over by finding $m_2$ and so on.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2014-01-13T19:03:17.733" LastActivityDate="2014-01-13T19:03:17.733" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11316" PostTypeId="1" AcceptedAnswerId="11321" CreationDate="2013-10-27T03:02:40.310" Score="5" ViewCount="4975" Body="&lt;p&gt;On one hand, there is the statistical definition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R_x(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} - \mu)]}{\sigma^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and on the other hand, there is this other definition (e.g. see Dilip's comment &lt;a href=&quot;https://dsp.stackexchange.com/a/2342/1026&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R_x (\tau) = \int_{-\infty}^{\infty} x(t) x(t+\tau) {\rm d}t$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are these two definitions different? Is the first one defined for &lt;strong&gt;stochastic processes&lt;/strong&gt;, while the second one defined for &lt;strong&gt;deterministic signals&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, does the Wiener-Khinichin theorem hold for the deterministic variant? (&lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Wikipedia article&lt;/a&gt; only discusses it in the context of a stochastic process) &lt;/p&gt;&#xA;" OwnerUserId="1026" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-10-27T17:26:43.213" Title="Autocorrelation - Stochastic vs deterministic processes" Tags="|autocorrelation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11317" PostTypeId="2" ParentId="10659" CreationDate="2013-10-27T05:11:21.947" Score="1" Body="&lt;p&gt;To find the zero-phase impulse response, simply take the Fourier transform of your signal, find magnitude and find the inverse Fourier transform of that. Mathematically speaking,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathscr{F}^{-1}\{\text{abs}\left(\mathscr{F}\{x[n]\}\right)\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This essentially says that the entire Fourier transform of your new sequence is real-valued. All real-valued numbers have zero phase.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-10-27T05:11:21.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11318" PostTypeId="2" ParentId="10526" CreationDate="2013-10-27T05:47:42.120" Score="1" Body="&lt;p&gt;It's essentially asking you to show that two signals that are orthogonal in the baseband (their original form) remain orthogonal after amplitude modulation process. In other words, amplitude modulation preserves orthogonality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about the question this way. You have two signals that are orthogonal, meaning that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sum_{m=-\infty}^{\infty}x[m]y[m] = 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a bit ugly, since we have to deal with infinities. However, your problem also says that they both have bandwidth $B$, which means that in frequency domain they will have finite width.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's define $\mathscr{B}$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathscr{B} = \frac{B}{F_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means that in your discrete Fourier transform signals $X[k]$ and $Y[k]$, the only non-zero samples exist for $-\frac{\mathscr{B}}{2} \le k \le \frac{\mathscr{B}}{2}$. Since DFT is an &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Orthogonality&quot; rel=&quot;nofollow&quot;&gt;orthogonal transform&lt;/a&gt;, signals orthogonal in time domain will remain orthogonal in frequency domain, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sum_{l=-\infty}^{\infty}X[l]Y[l] =\sum_{l=-\mathscr{B}/2}^{\mathscr{B}/2}X[l]Y[l] = \sum_{m=-\infty}^{\infty}x[m]y[m] = 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that multiplying a signal by a cosine shifts is away from DC in frequency domain, and the fact that the modulating frequency $f_c$ is larger than $B$ means that this won't cause any problems with overlapping modulated bands (think about what would happen if this weren't the case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this gives you enough hits to take it from here.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-10-27T05:47:42.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11319" PostTypeId="2" ParentId="10660" CreationDate="2013-10-27T06:40:01.607" Score="1" Body="&lt;p&gt;The frames end up giving you an orthogonal representation, just not exactly a basis representation that you're talking about. Simply by definition that's not what a Gabor filter does. It's a time-frequency representation of your signal, while &quot;orthogonal basis vectors&quot; wouldn't have a time-specific property -- they stretch for as long as your signal stretches. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use orthogonal basis transforms, use Fourier, cosine, empirical mode decomposition and similar transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want time-frequency representation, your can use short-time Fourier transform, wavelet transforms (of which Gabor can be considered a special case) and other similar transforms.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-10-27T06:40:01.607" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11320" PostTypeId="1" CreationDate="2013-10-27T11:04:01.150" Score="9" ViewCount="11490" Body="&lt;p&gt;I am trying to write an algorithm that would automatically segment a piece of audio with bird calls recordings. My input data are 1 minute-long wave files and on the output I would like to get separate calls for further analysis. Problem is that signal-to-noise ratio is quite terrible due to environmental conditions and poor quality of a microphone (mono, 8 kHz sampling). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be most grateful for any advice on how to proceed further with noise reduction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of my input, one minute audio recording in wave format: &lt;a href=&quot;http://goo.gl/16fG8P&quot; rel=&quot;noreferrer&quot;&gt;http://goo.gl/16fG8P&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how the signal looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EgtHn.png&quot; alt=&quot;My input signal (8 kHz). Marked areas indicate bird calls&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Band-pass filtering, in which I am keeping only anything in between 1500 - 2500 Hz, does improve situation, but still it is far from expectations. In this spectrum still a lot of noise is present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cdN1D.png&quot; alt=&quot;Spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also plotted long-term (over 32-sample intervals) average energy and removed some clicks from it. Here is the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zK0jj.png&quot; alt=&quot;Long-term average energy&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With all the remaining noise I have to set a very low threshold to the onset detection algorithm to pick last 10 seconds of bird calls. Problem is if I tweak it in such a way then in next recording I can get load of false positives. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving average filter helps a bit with wind noise. Any other ideas? I was thinking of &quot;Spectral Subtraction&quot;, but here it seems to me I have sort of chicken and egg problem - to find noise-only area I have to segment the audio and to segment the audio I need to remove the noise. Do you know of any libraries that have this algorithm or some implementations in pseudo-code? Methinks Audacity uses such a method to remove noise. It is very effective, but it is left to the user to mark noise-only area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am writing in Python and it is a free, open-source project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading!&lt;/p&gt;&#xA;" OwnerUserId="5785" LastActivityDate="2013-12-22T16:34:58.263" Title="Noise reduction from very noisy audio" Tags="|audio|signal-detection|denoising|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11321" PostTypeId="2" ParentId="11316" CreationDate="2013-10-27T12:06:28.920" Score="3" Body="&lt;p&gt;You are correct that these two definitions are for different processes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R_x\left(\tau\right) = \frac{1}{\sigma^2} \mathbb{E}\left[\left(X_t - \mu\right)\left(X_{t+\tau} - \mu\right)\right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is defined for a stochastic process $X$ distributed according to a law $\nu$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whilst for a deterministic, finite-energy signal, $x\left(t\right)$ the autocorrelation is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R_x\left(\tau\right) = \int_{-\infty}^\infty x\left(\tau+t\right)x\left(\tau\right)dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Wiener-Khinchin theorem will hold for any square-integrable deterministic $x\left(t\right)$ that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\int_{-\infty}^\infty |x\left(\omega\right)|^2 d\omega &amp;lt; \infty$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that the Fouier integral exists and converges in the $L^2$ sense (i.e. signals with finite energy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two definitions are different because the integrals used in the definitions are different. The deterministic case implicitly assumes a Riemann integral - that the process is nice in some way - it is continuous, and if differentiable the derivatives are bounded etc. However for random processes, $dt$ is difficult to define - the process could jump from $-\infty$ to $\infty$ over any inteval I could possibly define, so the Riemann limit isn't appropriate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead we use the Lebesgue integral, where we can define the expectation of a random process: all that's required is that the range is smooth (for example $\mathbb{R}$), and we can still take the expectation with respect to some measure, modulo some restrictions on the random process (so that the integral converges in a monotone or dominated sense). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integration of Random Process is a tricky business, and the definitions are written differently to keep people mindful of what they are working with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other note - the deterministic case isn't so interesting, as we can take the FT of a deterministic signal: the whole point of the WK theorem is for random processes - where the Fourier integral may not exist. I find it a particularly satisfying theorem, and the work to understand it definitely worthwhile. &lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="1026" LastEditDate="2013-10-27T17:26:43.213" LastActivityDate="2013-10-27T17:26:43.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11322" PostTypeId="1" CreationDate="2013-10-27T13:37:55.893" Score="2" ViewCount="3012" Body="&lt;p&gt;The following picture is amplitude and phase of an image filtered using Gabor filter in the frequency domain. I'm trying to reproduce the results, I'm getting valid results for the amplitude I think, but I'm struggling with the the phase, I'm just getting a noisy image that does not resemble the picture. I'm referencing this paper &lt;a href=&quot;http://people.csail.mit.edu/nwadhwa/phase-video/&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code looks roughly like this (Python + OpenCV):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# DFT of the source image&#xA;dft = cv2.dft(...)&#xA;# DFT of the Gabor filter&#xA;kernel_dft = cv2.dft(...)&#xA;filtered = dft * kernel_dft # using cv2.mulSpectrums()&#xA;image = cv2.idft(filtered)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;image&lt;/code&gt; is then complex array so i use &lt;code&gt;cv2.cartToPolar()&lt;/code&gt; to extract magnitude and phase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm struggling what the following paragraph exactly means (from the paper):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The resulting spatial frequency band is localized in space, scale and orientation (see [Portilla and Simoncelli 2000] for filter design steps). The transfer functions of a complex steerable pyramid only contain the positive frequencies of the corresponding real steerable pyramid’s filter. That is, the response of 2 cos(!x) = e^(iwx) + e^(iwx) is e^(iwx) so that there is a notion of both amplitude and phase.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to proceed, as I'm not an expert in this matter, so if anybody could offer some clarification I'd be very happy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JAEDL.png&quot; alt=&quot;Amplitude and Phase&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5768" LastEditorUserId="5768" LastEditDate="2013-10-27T14:20:41.997" LastActivityDate="2016-07-05T08:17:06.007" Title="Phase of an image in the frequency domain" Tags="|image-processing|fft|phase|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11323" PostTypeId="2" ParentId="11312" CreationDate="2013-10-27T15:05:25.563" Score="13" Body="&lt;p&gt;The FFT can only be performed over a limited chunk of data. The basic math is based on the assumption that the time domain signal is periodic, i.e. your chunk of data is repeated in time. That typically results in a major discontinuity at the edges of the chunk.&lt;/p&gt;&#xA;&lt;p&gt;Let's look at a quick example: FFT size = 1000 points, Sample Rate = 1000 Hz, Frequency resolution = 1Hz. If you have a 10 Hz sine wave you don't have a discontinuity since exactly 10 periods fit into your FFT window and the values (and derivatives) at the edges are the same. The FFT of this signal will be zero except for a single value in bin #10. This also works for a 11 Hz sine wave just as well.&lt;/p&gt;&#xA;&lt;p&gt;However, for 10.3 HZ sine wave you end up with a lot of discontinuity and the FFT will have energy in all bins with maximum around 10 or 11 and then &amp;quot;skirts&amp;quot; that roll trail off to the sides. So a small change in frequency results in a massive change in the FFT picture.&lt;/p&gt;&#xA;&lt;p&gt;Windowing is used to avoid this. Windows make sure that the data at the edges are zero, so there is no discontinuity. However multiplication in the time domain is convolution in the frequency domain and that results in widening of spectral lines and also in side lobes. The choice of window controls the trade offs between main lobe width and side lobe spacing and height. Your application specific requirements determine what window to use and there are dozens of choices. Hanning is just one of them. It's basically &amp;quot;the window of choice if you don't have any better ideas&amp;quot;. Personally, I prefer Kaiser windows as they have a continuous parameter that can control the window behavior over a wide range.&lt;/p&gt;&#xA;&lt;p&gt;In general, FFT is not a great method for pitch detection. For most audio signals the maximum in the spectrum is NOT the fundamental (typically harmonics have higher energy), in order to get decent resolution you need a long pieces of data but that makes the algorithm very slow and sluggish to respond to changes. Much better options are phase looked loops, delay looked loops, autocorrelations, max/min tracker, zero  crossing tracker, etc.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="7092" LastEditDate="2021-08-05T14:44:34.847" LastActivityDate="2021-08-05T14:44:34.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11324" PostTypeId="1" CreationDate="2013-10-27T15:41:54.353" Score="1" ViewCount="678" Body="&lt;p&gt;I am programming a Voice Activity Detection algorithm. After researching several methods, I implemented a simple method that determines whether or not the person is speaking based off the RMS of the signal. However, I want to improve the algorithm to determine whether the sound coming into the microphone is actually a human voice and I thought the best way to do that would be to calculate the frequency of the signal. I used an FFT to do so, but upon further research others have suggested that other methods may be more effective. As such, which would be the best method to use? EG: Auto-correlation, zero crossing, etc...? Or is examining the frequency not even a good method of VAD? If it isn't, what is the best method by which to determine whether or not someone is talking?&lt;/p&gt;&#xA;" OwnerUserId="5485" LastActivityDate="2013-10-27T15:41:54.353" Title="What is the best pitch (frequency detector) for a Voice Activity Detection Algorithim?" Tags="|fft|frequency|signal-analysis|speech-recognition|autocorrelation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11325" PostTypeId="1" AcceptedAnswerId="11327" CreationDate="2013-10-27T17:51:43.173" Score="5" ViewCount="506" Body="&lt;p&gt;I apologize if this comes as a basic question, but I am struggling to understand why the PSD can only be &lt;strong&gt;estimated&lt;/strong&gt; and not directly &lt;strong&gt;computed&lt;/strong&gt;. For example, &lt;a href=&quot;https://dsp.stackexchange.com/questions/2096/why-so-many-methods-of-computing-psd&quot;&gt;this thread&lt;/a&gt; discusses several such PSD &lt;strong&gt;estimation methods&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a deterministic signal with a fixed number of samples, shouldn't I be able to directly determine its spectral information?  Also, it is well known that PSD can be defined as the &lt;strong&gt;Fourier transform of the auto-correlation&lt;/strong&gt; function. Isn't this calculation deterministic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, in &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;ved=0CEEQFjAC&amp;amp;url=http://mts.hindawi.com/utils/getacceptedmsfile.aspx?msid=406391&amp;amp;vnum=4&amp;amp;ftype=manuscript&amp;amp;ei=zFFtUv_GJJGGkQfh2YCwAQ&amp;amp;usg=AFQjCNE0_wfmuspnqVF3ULWcmpsTQbutiw&amp;amp;sig2=KIwirA2zOWV5jNEQA-pLdg&amp;amp;bvm=bv.55123115,d.eW0&amp;amp;cad=rja&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; the authors &lt;strong&gt;compute the PSI  &lt;em&gt;directly&lt;/em&gt; from the FFT coefficients&lt;/strong&gt; as shown below. There doesn't seem to be anything stochastic about the computation, and the computation of FFT coefficients is not really an estimation, to the best of my understanding. What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;img src=&quot;https://i.stack.imgur.com/UgTo4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5798" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-10-28T04:56:02.637" Title="Why is PSD estimated, and not simply computed?" Tags="|power-spectral-density|estimation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11326" PostTypeId="1" AcceptedAnswerId="11329" CreationDate="2013-10-27T18:58:06.140" Score="20" ViewCount="34333" Body="&lt;p&gt;I understood that SNR is the ratio of signal power to the noise power. In terms of images, how the original image is affected by the added noise. In PSNR, we take the square of the peak value in the image (in case of an 8 bit image, the peak value is 255) and divide it by the mean square error. The SNR and PSNR are used to measure the quality of an image after the reconstruction. I understand that higher the SNR or PSNR, the reconstruction is good. What I don't understand is how SNR and PSNR differs in terms of their conclusion about the reconstructed image. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What the PSNR of an image concludes that the SNR of the same image can't conclude ? &lt;/li&gt;&#xA;&lt;li&gt;Simply how the conclusion of PSNR differs from the conclusion of SNR? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="1629" LastEditDate="2016-07-14T22:13:51.767" LastActivityDate="2019-06-26T11:37:42.020" Title="Difference between SNR and PSNR" Tags="|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11327" PostTypeId="2" ParentId="11325" CreationDate="2013-10-27T19:18:04.850" Score="6" Body="&lt;p&gt;Well, because in a lot of real world problems this&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I have a deterministic signal with a fixed number of samples, shouldn't I be able to directly determine its spectral information?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;is just not the case. Very often, measured signals are more of a random process. A simple and common case would be to have the desired signal and some additive noise, very often Gaussian in nature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you can capture the signal for a while and then deterministically calculate the PSD of those samples, what you get is the instantaneous PSD of these samples which may or may not be close to the actual PSD of the whole random process that you are sampling. It all boils down to what you want to do but in a lot of cases you want the PSD of the random process that you are sampling and also very often, just capturing some samples and calculating the instantaneous PSD just does not come close to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a lot of different methods for PSD estimation. Some may work better in some cases than other, maybe some are more computationally expensive than others. Or possibly some reach a better estimate with fewer samples as input data. In the end it boils down to select the most appropriate method for your given scenario.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-10-27T19:18:04.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11329" PostTypeId="2" ParentId="11326" CreationDate="2013-10-27T20:17:42.730" Score="20" Body="&lt;p&gt;Let's start with the mathematical definitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Discrete signal power is defined as&#xA;$$P_s = \sum_{-\infty}^{\infty}s^2[n] = \left|s[n]\right|^2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can apply this notion to noise $w$ on top of some signal to calculate $P_w$ in the same way. The signal to noise ratio (SNR) is then simply&#xA;$$P_{SNR}=\frac{P_s}{P_w}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we've received a noise corrupted signal $x[n] = s[n]+w[n]$ then we compute the SNR as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_{SNR}=\frac{P_s}{P_w} = \frac{P_s}{\left|x[n]-s[n]\right|^2}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $\left|x[n]-s[n]\right|^2$ is simply the squared error between original and corrupted signals. Note that if we scaled the definition of power by the number of points in the signal,  this would have been the &lt;em&gt;mean&lt;/em&gt; squared error (MSE) but since we're dealing with ratios of powers, the result stays the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us now interpret this result. This is the ratio of the power of signal to the power of noise. Power is in some sense the squared norm of your signal. It shows how much squared deviation you have from zero on average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also note that we can extend this notion to images by simply summing twice of rows and columns of your image vector, or simply stretching your entire image into a single vector of pixels and apply the one-dimensional definition. You can see that no spacial information is encoded into the definition of power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's look at peak signal to noise ratio. This definition is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_{PSNR}=\frac{\text{max}(s^2[n])}{\text{MSE}}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you stare at this for long enough you will realize that this definition is really the same as that of $P_{SNR}$ except that the numerator of the ratio is now the &lt;em&gt;maximum&lt;/em&gt; squared intensity of the signal, not the &lt;em&gt;average&lt;/em&gt; one. This makes this criterion less strict. You can see that $P_{PSNR} \ge P_{SNR}$ and that they will only be equal to each other if your original clean signal is constant everywhere, and with maximum amplitude. Notice that although the variance of a constant signal is null, its power is not; the level of such constant signal does make a difference in SNR but not in PSNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, why does this definition make sense? It makes sense because the case of SNR we're looking at how strong the signal is and to how strong the noise is. We assume that there are no special circumstances. In fact, this definition is adapted directly from the physical definition of electrical power. In case of PSNR, we're interested in signal peak because we can be  interested in things like the bandwidth of the signal, or number of bits we need to represent it. This is much more content-specific than pure SNR and can find many reasonable applications, image compression being on of them. Here we're saying that what matters is how well high-intensity regions of the image come through the noise, and we're paying much less attention to how we're performing under low intensity.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="-1" LastEditDate="2014-02-14T22:14:02.687" LastActivityDate="2014-02-14T22:14:02.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11331" PostTypeId="1" CreationDate="2013-10-28T04:24:01.540" Score="7" ViewCount="1768" Body="&lt;p&gt;Sensor fusion algorithms can give a more precise 3D orientation (and possibly postion?) of a device by combining readings from an accelerometer, gyroscope, and magnetometer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain, or provide links, explaining the details behind this? I want to understand the math and physics, such that if I have raw 9-DOF sensor data, I might be able to implement sensor fusion. Assume I have sufficient background of linear algebra, calculus, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="3595" LastActivityDate="2020-01-14T07:22:07.307" Title="How does sensor fusion work? I want to understand the math/physics/algorithms" Tags="|filters|algorithms|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11332" PostTypeId="2" ParentId="11325" CreationDate="2013-10-28T04:56:02.637" Score="2" Body="&lt;p&gt;If you are performing a finite computation, then what you are missing is the assumption that the PSD of the longer or infinite signal outside of the samples you are using in the computation is or us not identical to that of your finite sample set, as well as assumptions about the possibility that there was or was not some non-zero probability distribution of sampling errors.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-28T04:56:02.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11333" PostTypeId="1" AcceptedAnswerId="11334" CreationDate="2013-10-28T05:12:54.873" Score="5" ViewCount="792" Body="&lt;p&gt;I am trying to understand how the Windowed Fourier transform works, so I used Matlab to create an artificial signal, and plotted the Windowed Fourier transform using a gaussian window. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t) = \left\{\begin{matrix}&#xA; \sin(2\pi100t)&amp;amp; \text{for }0\leq{t}&amp;lt;\frac{1}{4}\\ &#xA; \sin(2\pi50t)&amp;amp; \text{for }\frac{1}{4}\leq{t}&amp;lt;\frac{1}{2}\\ &#xA; \sin(2\pi25t)&amp;amp; \text{for }\frac{1}{2}\leq{t}&amp;lt;\frac{3}{4}\\ &#xA; \sin(2\pi10t)&amp;amp; \text{for }\frac{3}{4}\leq{t}\leq1&#xA;\end{matrix}\right.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $f_s=500$, i.e. the data points are sampled at every 1/500 second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have obtained for my plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DqM4z.png&quot; alt=&quot;plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for the last 2 intervals, $\frac{1}{2}\leq{t}&amp;lt;\frac{3}{4}$, and $\frac{3}{4}\leq{t}\leq1$, we can see some form of bifurcating phenomenon (vertically). Why is this so?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="50076" LastEditDate="2023-03-15T15:14:18.260" LastActivityDate="2023-07-20T22:19:40.810" Title="Why are there beats in spectrogram / Windowed Fourier Transform of sines?" Tags="|discrete-signals|signal-analysis|spectrogram|stft|time-frequency|" AnswerCount="4" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11334" PostTypeId="2" ParentId="11333" CreationDate="2013-10-28T05:36:12.217" Score="6" Body="&lt;p&gt;This happens because your window is too short. I don't have access to a plotting tool right now, but imagine for a second a slowly varying sinusoid that you chop up into pieces, and these pieces are shorter than the period of your sinusoid. If you take the Fourier transform of each of these pieces, some of your chunks will capture more energy of this sinusoid than others because they will contain crest or through of the function, while others will contain regions close to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you increase your window size, you'll be able to catch several cycles of your slow sinusoids inside each window, and the periodicity will go away. The tradeoff is that your windows will capture larger lengths of time, so boundaries between events will be more blurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this still doesn't make sense, I'll try to include some plots later.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-10-28T05:36:12.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11337" PostTypeId="1" CreationDate="2013-10-28T09:15:01.660" Score="0" ViewCount="165" Body="&lt;p&gt;I have a general task of discriminating images of shaded cylinders that significantly vary in 3d orientation, and almost insignificantly in size and shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have treated it as a regression problem on a dataset of these oriented cylinders, but my problem is with feature computation for each sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, what is a good way to estimate the gradient orientation from the shading of cylinders on these images?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having limited experience, I have trouble understanding what linear or non-linear filters I should apply, so that they would be gradient-sensitive and compute orientation discriminatively for this task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sample image is given here(each cylinder image in a dataset is distinct): &lt;img src=&quot;https://i.stack.imgur.com/iIrg9.png&quot; alt=&quot;http://i.imgur.com/7GpbSE7.png&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5803" LastEditorUserId="76" LastEditDate="2013-10-29T11:53:41.720" LastActivityDate="2013-10-29T11:53:41.720" Title="How to estimate gradient orientation?" Tags="|computer-vision|gradient|shape-analysis|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11338" PostTypeId="2" ParentId="11333" CreationDate="2013-10-28T09:35:56.707" Score="12" Body="&lt;p&gt;In discrete signal processing the frequency domain axis topology is surprisingly not a straight line, but a closed circle. Therefore the upper and lower edge of your image are really &quot;identified&quot;, meaning they are connected and direct neighbors. The modulation you're seeing is the &lt;strong&gt;beating&lt;/strong&gt; of the two interfering components coming closer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The window size has an effect on this as it controls the frequency resolution. If you take an (effectively) longer window, then the beating will be reduced because the fourier transforms of the window centered at the sinusoidal components' frequencies will overlap less.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2013-10-28T10:55:01.233" LastActivityDate="2013-10-28T10:55:01.233" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11339" PostTypeId="2" ParentId="3465" CreationDate="2013-10-28T10:35:16.800" Score="3" Body="&lt;p&gt;Added: if $f(x) = \ell_1(x) = \sum |x_i|$, the terms are all independent &amp;mdash;&#xA;as @Alejandro points out, you can just minimize each term by itself.&#xA;It's more interesting to minimize&lt;br&gt;&#xA;    $\qquad\qquad$ $\| Ax - b \|_2^2 + \lambda \|x\|_1 $&lt;br&gt;&#xA;where $\|x\|_1$ instead of $\|x\|_2$&#xA;is intended to push many $x_i$ to 0.&lt;br&gt;&#xA;The following notes are for this case.&#xA;(I call the variables $x$, not $y$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;(A year later) another name for this for the case $f(x) = \ell_1$ norm is&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Elastic_net_regularization&quot; rel=&quot;nofollow&quot;&gt;Elastic net regularization&lt;/a&gt;.&lt;br&gt;&#xA;Hastie et al.,&#xA;&lt;a href=&quot;http://www-stat.stanford.edu/~tibs/ElemStatLearn&quot; rel=&quot;nofollow&quot;&gt;Elements of Statistical Learning&lt;/a&gt; &#xA;p. 661 ff. discuss this for classification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fast simple way to get an approximate solution with many $x_i = 0$ is to alternate&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;minimize $\|Ax - b\|$ by plain least squares&lt;/li&gt;&#xA;&lt;li&gt;shrink a.k.a. soft-threshold: set small $x_i = 0$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is a form of &lt;a href=&quot;http://en.wikipedia.org/wiki/IRLS&quot; rel=&quot;nofollow&quot;&gt;Iteratively reweighted least squares&lt;/a&gt;, with weights 0 or 1.&#xA;I'd expect that methods in papers cited in previous answers will give better results; this is simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(When minimizing a sum $f() + \lambda g()$,&#xA;it's a good idea to plot $f()$ and $\lambda g()$ on a log-log scale for iter 1 2 3 ...&#xA;Otherwise, one term may swamp the other, and you won't even notice &amp;mdash;&lt;br&gt;&#xA;especially when they scale differently.)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="4389" LastEditDate="2013-10-30T16:13:34.500" LastActivityDate="2013-10-30T16:13:34.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11340" PostTypeId="1" CreationDate="2013-10-28T14:37:02.927" Score="2" ViewCount="370" Body="&lt;p&gt;I have a dozen source sound waves; each is about one second duration. I want to put each one through a digital filter (I'm truncating it to 128 taps).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm doing this with a bog standard convolution. It is chewing up a lot of CPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to switch to fast convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone outline the steps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware that the basic technique is iFFT ( FFT(src) * FFT(filter) ), but the source and the filter are different lengths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I'm imagining doing is this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each (source, filter) pair: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Truncate each filter at 512 taps  and  FFT it to give 256 frequency bins.  &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now step through the source at 128-sample increments using a window size of 512.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each step,&lt;br&gt;&#xA;    * multiply by a (Hanning?) window,&lt;br&gt;&#xA;    * FFT&lt;br&gt;&#xA;    * multiply FFT with FFT of filter (complex multiplication on each bin)&lt;br&gt;&#xA;    * add to destination buffer  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Divide amplitude of destination buffer by 4, as we did 4 x overlap&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Questions I have at this point are:&#xA;1. Is the basic method right?&#xA;2. Do I need to zero-pad my filter?&#xA;3. Is 4x overlap appropriate / optimal?&#xA;4. is that windowing correct?  Is there any way to optimise out the windowing step?&#xA;5. how good will this output be compared with standard convolution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I've just noticed that dividing by 4 at the end is probably wrong, shouldn't it be using the area under the windowing function A_w?  So  multiplying everything by A_w / 4.  Would that be correct?&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="4346" LastEditDate="2017-01-05T03:55:45.953" LastActivityDate="2017-01-05T03:55:45.953" Title="Using Fast Convolution to apply HRIR to soundwave" Tags="|fft|convolution|fast-convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11342" PostTypeId="2" ParentId="11340" CreationDate="2013-10-28T16:49:56.750" Score="3" Body="&lt;p&gt;Google &quot;overlap add&quot;. Quick outline&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;zero pad filter to 256 taps, do an FFT&lt;/li&gt;&#xA;&lt;li&gt;Initialize and &quot;overlap&quot; buffer of length 128 taps to all zeros&lt;/li&gt;&#xA;&lt;li&gt;Initialize an input pointer to 0&lt;/li&gt;&#xA;&lt;li&gt;Loop starts here&lt;/li&gt;&#xA;&lt;li&gt;Take 128 samples from your input starting at input pointer. Zero pad to 256, FFT&lt;/li&gt;&#xA;&lt;li&gt;Multiply the FFTs&lt;/li&gt;&#xA;&lt;li&gt;Inverse FFT, add overlap buffer to the first 128 samples, output these samples. Put the second 128 samples into the overlap buffer&lt;/li&gt;&#xA;&lt;li&gt;Advance your input pointer by 128 samples and go back to step 5. Repeat until the input is all done&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Some quick tips:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Overlap save is slightly faster but a little less intuitive.&lt;/li&gt;&#xA;&lt;li&gt;If filters and signals are all real valued you can speed things up further by either implementing a real valued FFT that's based on an N/2 complex FFT or by combining filters and/or signals in pairs&lt;/li&gt;&#xA;&lt;li&gt;128 is probably close to the break even point between FFT based and direct FIR filtering. I wouldn't expect huge gains. Depending hardware and level of code optimization it may actually be slower.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-28T16:49:56.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11344" PostTypeId="1" AcceptedAnswerId="35143" CreationDate="2013-10-28T17:47:05.287" Score="1" ViewCount="386" Body="&lt;p&gt;I'm struggling to implement a sampling scheme where arithmetic decoding is used to generate the samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is based on excercise 6.3 from David MacKay's book, where you compare rejection sampling with arithmetic decoding sampling. For each symbol you want to generate with rejection sampling you have to generate an (uniformly distributed) integer from $1$ to $2^{32}$, rescale it to be in $\left(0,1\right)$ and then if your random number is less than 0.99 emit a 0 (or 1 accordingly). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To generate symbols by arithmetic coding, you feed standard random bits into an arithmetic decoder equipped with the appropriate model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note: I think this works because when we compress data we go from symbols generated under P to symbols under Q - P,Q are probability distributions - and decompression works the opposite way. If we choose Q to be an easy distribution to sample from then by decoding symbols from Q we can generate symbols from P.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented the methods in the code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;pdist = [0.99 0.01] ;&#xA;counts = [99 1];&#xA;N=100;&#xA;U = randi(2^32, [1 N]);&#xA;U = U/2^32;&#xA;rejection_samples(1:N) = 0;&#xA;&#xA;for i=1:N&#xA;    if U(i) &amp;lt; pdist(1) ;&#xA;       rejection_samples(i) = 0;&#xA;    else&#xA;       rejection_samples(i) = 1;&#xA;    end&#xA;end&#xA;&#xA;seq = randsrc(1, N, [0 1;0.5 0.5]);&#xA;arith_samples = arithdeco(seq, counts, N);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm confused becuase the arith_samples variable sometimes contains a 2 (but I guess this just maps onto (0,1) as the output never seems to contain a 0 - just 1 and 2). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answers say that the rejection sampling method takes 32 bits per generated symbol, but that arithmetic coding only takes 0.081 = $H_2\left(0.01\right)$. I can't really see that from my code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way I could measure 'bits used'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also this seems a bit too good to be true - surely there are better ways of generating random numbers than just rejection sampling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant chapter is found here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cs.toronto.edu/~mackay/itprnn/ps/105.124.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.toronto.edu/~mackay/itprnn/ps/105.124.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2016-10-28T17:17:34.437" Title="Sampling from a distribution with arithmetic coding" Tags="|compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11345" PostTypeId="1" AcceptedAnswerId="11384" CreationDate="2013-10-28T17:59:56.750" Score="2" ViewCount="9954" Body="&lt;p&gt;I'm trying to create a digital filter from a first order analog filter with transfer function &#xA;$$H(s)=\frac{1}{1+\tau s}$$&#xA;with time constant $\tau=.1\text{s}$, and  sampling rate $f_s=1000\text{Hz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the bilinear transform in Matlab however appears to yield a filter with the a different 3dB point than expected. I expect the 3dB point to be at $\frac{1}{\tau}=10\text{Hz}$, but it appears to be around $1.6\text{Hz}$. Any idea what I could be doing incorrectly?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mXRXo.png&quot; alt=&quot;frequency response of low pass filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 1000;&#xA;tau = .1;&#xA;&#xA;num = 1;&#xA;den = [tau, 1];&#xA;[numd,dend]=bilinear(num,den,fs);&#xA;&#xA;[h, f] = freqz(numd,dend,4096, fs);&#xA;&#xA;figure(1); clf();&#xA;subplot(211); semilogx(f,20*log10(abs(h))); hold on&#xA;plot([.1, 1000], [-3 -3],'r'); &#xA;grid on; ylim([-40,1]); ylabel('gain (db)'); xlim([.1, fs/2]);&#xA;subplot(212); semilogx(f, angle(h)*180/pi); &#xA;grid on; ylabel('phase(rad)'); xlim([.1, fs/2]); xlabel('frequency(Hz)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5808" LastActivityDate="2014-04-24T23:16:13.540" Title="Digital implementation of first order analog filter using bilinear transformation" Tags="|matlab|filters|lowpass-filter|frequency-response|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11346" PostTypeId="1" CreationDate="2013-10-28T19:19:29.480" Score="1" ViewCount="83" Body="&lt;p&gt;I am going to be straight forward and say this is one of the problem sheets and I am stuck on one of the questions.  I already know the answer as I have been given them but I am trying to work backwards to see how to derive from the answer.  so the question is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Find another cosine y(t), whose frequency is as close as possible to that of x(t),&#xA; which when sampled with T=1ms yields the same sample values as x(t). &#xA; Write the equation and sketch y(t) vs. t. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where $x(t) = 10\cos(500\pi t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is the answer &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jEGTG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the question is I don't quite understand why $10\cos(1500\pi t)$ would go through those points and not $10\cos(1000\pi t)$.&lt;/p&gt;&#xA;" OwnerUserId="5811" LastEditorUserId="80" LastEditDate="2013-10-28T19:36:51.387" LastActivityDate="2013-10-28T19:36:51.387" Title="Find another cosine y(t), whose frequency is as close as possible to that of x(t)," Tags="|discrete-signals|homework|continuous-signals|digital|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11347" PostTypeId="2" ParentId="11345" CreationDate="2013-10-28T20:14:34.860" Score="0" Body="&lt;p&gt;I was able to play around with the frequency warping parameter to get a result close to what you're looking for. The parameter value didn't turn out to be what I expected it to be, but I got a decent shape out of it anyway:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[numd,dend]=bilinear(num,den,fs, 470);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pFNdZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-10-28T20:14:34.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11348" PostTypeId="1" AcceptedAnswerId="11447" CreationDate="2013-10-28T23:09:25.450" Score="1" ViewCount="1423" Body="&lt;p&gt;Are the results of applying  &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot; rel=&quot;nofollow&quot;&gt;Kalman filter&lt;/a&gt; and  &lt;a href=&quot;http://en.wikipedia.org/wiki/Minimum_mean_square_error&quot; rel=&quot;nofollow&quot;&gt;recursive linear MMSE estimation process&lt;/a&gt; the same ?&lt;/p&gt;&#xA;" OwnerUserId="5809" LastActivityDate="2013-11-03T20:24:52.023" Title="Relation between Kalman filter and Sequential linear MMSE estimation" Tags="|kalman-filters|estimation|soft-question|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11349" PostTypeId="1" CreationDate="2013-10-29T02:57:25.187" Score="2" ViewCount="5838" Body="&lt;p&gt;While studying an OFDM system, I have encountered statements like coherence bandwidth is the reciprocal of delay spread and coherence time is the reciprocal of the Doppler spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody help me to understand this mathematically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is coherence bandwidth related to delay spread, and how is coherence time related to Doppler spread? &lt;/p&gt;&#xA;" OwnerUserId="3638" LastEditorUserId="76" LastEditDate="2014-01-02T16:43:41.070" LastActivityDate="2017-11-10T01:02:26.530" Title="Coherence bandwidth and coherence time in an OFDM system" Tags="|ofdm|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11350" PostTypeId="2" ParentId="11349" CreationDate="2013-10-29T03:19:13.697" Score="3" Body="&lt;p&gt;This diagram (from &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470741864&quot; rel=&quot;nofollow noreferrer&quot;&gt;Molisch&lt;/a&gt;) shows the various Fourier relationships between measurements in wireless systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4DFiO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-10-29T03:19:13.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11351" PostTypeId="1" CreationDate="2013-10-29T03:55:20.530" Score="1" ViewCount="2380" Body="&lt;p&gt;I'm trying to use Savitzky-Golay Filter to smooth experimental data. Savitzky-Golay computes $c_{n}$ in the following equation &#xA;$$ g_{i} = \displaystyle\sum\limits_{n=-n_{L}}^{n_{R}} c_{n}f_{i}+n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Numerical Recipes book by William H. Press. I've bought the library. The next step to calculate $g_{0}$ which represents the smoothed data. To fulfil that, we need to convolute $c_{n}$ with $f_{i}+n$. Luckily, there is a function to do so namely &quot;convlv()&quot;. I'm passing 17 points of the stream data ( nl = 7, nr = 7, m = 4 ). To compute $c_{n}$, I'm using &quot;savgol()&quot;. The sample rate of the experimental data is 1KHz ( 0.001 second ). After smoothing the data, the sample rate decreased to 100Hz &lt;strong&gt;WHY?&lt;/strong&gt;.&#xA;The unsmoothed data is  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h9r8i.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;and the smoothed data is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fmNvO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    #include &amp;lt;iostream&amp;gt;&#xA;#include &amp;lt;fstream&amp;gt;&#xA;#include &amp;lt;vector&amp;gt;&#xA;#include &quot;nr3.h&quot;&#xA;#include &quot;ludcmp.h&quot;&#xA;#include &quot;savgol.h&quot;&#xA;#include &quot;fourier.h&quot;&#xA;#include &quot;convlv.h&quot;&#xA;&#xA;&#xA;&#xA;int main(void)&#xA;{&#xA;    std::ifstream raw_data;&#xA;    std::ofstream smoothed_data;&#xA;    std::vector&amp;lt;double&amp;gt; x;&#xA;&#xA;    raw_data.open(&quot;data.txt&quot;);&#xA;    smoothed_data.open(&quot;smoothed.txt&quot;);&#xA;&#xA;    VecDoub_IO ans(17);&#xA;    VecDoub_IO data(17);&#xA;    VecDoub_IO respns(17);&#xA;&#xA;    const Int np(17), nl(8), nr(8), ld(0), m(4);&#xA;     savgol(respns, np, nl, nr, ld,  m);&#xA;    for (int i = 0; i &amp;lt; 17; ++i)&#xA;    {&#xA;    std::cout &amp;lt;&amp;lt; respns[i] &amp;lt;&amp;lt; &quot; &quot;;&#xA;    }&#xA;&#xA;    if (raw_data.fail())&#xA;    {&#xA;        std::cout &amp;lt;&amp;lt; &quot;Error in open xdata file&quot;;&#xA;    }&#xA;    if (smoothed_data.fail())&#xA;    {&#xA;        std::cout &amp;lt;&amp;lt; &quot;Error in Opening xdot file&quot;;&#xA;    }&#xA;    double line(0);&#xA;    while ( raw_data &amp;gt;&amp;gt; line )&#xA;    {&#xA;        x.push_back(line);&#xA;    }&#xA;&#xA;&#xA;    int xdata_counter(0);&#xA;&#xA;    // void convlv(VecDoub_I &amp;amp;data, VecDoub_I &amp;amp;respns, const Int isign, VecDoub_O &amp;amp;ans) &#xA;&#xA;    while ( xdata_counter &amp;lt; (x.size() - 25) )&#xA;    {&#xA;        for (int i = 8; i &amp;lt;= 17; ++i)&#xA;        {&#xA;            data[i] = x[xdata_counter];&#xA;            ++xdata_counter;&#xA;&#xA;        }&#xA;        //four1(&amp;amp;data[0],data.size()/2,isign);&#xA;        convlv(data, respns, 1, ans);&#xA;        smoothed_data &amp;lt;&amp;lt; ans[0] &amp;lt;&amp;lt; std::endl;&#xA;&#xA;        for (int i = 0; i &amp;lt; 8; ++i)&#xA;        {&#xA;            data[i] = data[i+1];&#xA;        }&#xA;    }&#xA;&#xA;    raw_data.close();&#xA;    smoothed_data.close();&#xA;&#xA;&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5788" LastActivityDate="2013-10-29T03:55:20.530" Title="Problem with Smoothing experimental data (Savitzky-Golay &amp; C++)?" Tags="|filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11353" PostTypeId="1" CreationDate="2013-10-28T17:28:22.500" Score="4" ViewCount="303" Body="&lt;p&gt;I have a problem that is similar to the state space model in Kalman filter but the observation matrix $G_t$ of $$y_t=G_tx_t +w_t,$$ is random. The elements of $G_t$ are i.i.d. random variables with a given distribution. Is it possible to use the Kalman filter to this problem? If it has already been used please provide a reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above $w_t$ is noise vector of Gaussian distribution with known covariance matrix, $x_t$ is the state of the system at time $t$ and $y_t$ is the observation at time $t$. The state tarnsision is given by $x_{t+1}=F_tx_t+B_tu_t+v_t$ where $F_t$ is a known matrix and $v_t$ is Gaussian noise with known covariance, $B_t$ is also a known matrix and $u_t$ is Gaussian distributed random input. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="5809" OwnerDisplayName="triomphe" LastEditorUserId="6" LastEditDate="2013-10-29T04:32:31.253" LastActivityDate="2013-10-29T21:56:51.170" Title="Kalman filter for random observation matrix $G_t$" Tags="|kalman-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11355" PostTypeId="2" ParentId="10369" CreationDate="2013-10-29T06:43:10.270" Score="16" Body="&lt;p&gt;Power-Spectral Density (PSD) is the distribution of power along the frequency axis. It is generally used for non-finite energy signals (mostly not limited in time signals), who aren't square-summable.&#xA;The signal's PSD is the Fourier Transform of the signal's autocorrelation, as stated by the Wiener–Khinchin theorem.&#xA;In Matlab:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;N = length(S);&#xA;F = fft(S);&#xA;F = F(1:N/2+1);&#xA;PSD = (1/(2*pi*N)) * abs(F).^2;&#xA;PSD(2:end-1) = 2*PSD(2:end-1);&#xA;freq = 0:(2*pi)/N:pi;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://de.mathworks.com/help/signal/ug/power-spectral-density-estimates-using-fft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://de.mathworks.com/help/signal/ug/power-spectral-density-estimates-using-fft.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Cross-Spectral Density is the same, but using cross-correlation, so you can find the power shared by a given frequency for the two signals using its squared module, and the phase shift between the two signals at that frequency using its argument.&lt;/p&gt;&#xA;&lt;p&gt;Cross-Spectral Density can be used to identify the frequency response of a noisy LTI system : if the noise is not correlated to the input or output of the system, its frequency response can be found from the CSD of the input and output.&lt;/p&gt;&#xA;" OwnerUserId="5779" LastEditorUserId="7092" LastEditDate="2023-02-21T15:48:37.527" LastActivityDate="2023-02-21T15:48:37.527" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="11356" PostTypeId="1" AcceptedAnswerId="11366" CreationDate="2013-10-29T06:50:49.070" Score="0" ViewCount="661" Body="&lt;p&gt;I'm just beginning to study Fourier transforms and I'm having trouble getting this concept down.&#xA;I know what a low/high pass filter does to a signal.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the relationship between Fourier magnitudes (dB) and frequency (Hz)? &lt;/li&gt;&#xA;&lt;li&gt;How would Fourier magnitudes get affected when a low/high pass filter is passed on a signal? &lt;/li&gt;&#xA;&lt;li&gt;How about an all pass filter?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5815" LastEditorUserId="76" LastEditDate="2013-10-29T11:53:24.297" LastActivityDate="2013-10-29T15:00:14.713" Title="Relationship between filters, Fourier magnitude, and frequency" Tags="|filters|fourier-transform|frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11357" PostTypeId="2" ParentId="11356" CreationDate="2013-10-29T07:17:10.637" Score="0" Body="&lt;p&gt;fourier magnitudes in dB is just the logarithm of the fourier transform of the signal of interest. For example, Let's say you have an ideal low pass filter which looks like a square function centered at 0, and between -f and f in the fourier domain. (Note: f and -f are the frequencies). Now the fourier magnitudes in db will be 0 between f and -f and -$\inf$ outside that interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in practice we cannot design an ideal filter so we wouldn't necessarily be having -$\inf$ outside the bounds and mainly we cannot have a square function in fourier domain.&lt;/p&gt;&#xA;" OwnerUserId="5816" LastActivityDate="2013-10-29T07:17:10.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11358" PostTypeId="1" CreationDate="2013-10-29T07:45:19.693" Score="1" ViewCount="384" Body="&lt;p&gt;I am confused between symbol rate offset, symbol timing offset and sampling clock offset. Can anyone tell be the difference between these terms.&lt;/p&gt;&#xA;" OwnerUserId="5817" LastActivityDate="2013-10-30T00:45:59.260" Title="Symbol rate offset estimation" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11359" PostTypeId="1" AcceptedAnswerId="11360" CreationDate="2013-10-29T08:26:31.987" Score="1" ViewCount="107" Body="&lt;p&gt;Professor asked me what filter is better -1/3 2/3 -1/3 or -1/4 1/2 -1/4, the answer was second. But what those coefficients means? It was during discussion of linear filter but i'm not sure was it about it.&lt;/p&gt;&#xA;" OwnerUserId="5589" LastEditorUserId="5589" LastEditDate="2013-10-29T09:07:02.023" LastActivityDate="2013-10-29T09:53:13.080" Title="What filter is better with -1/3 2/3 -1/3 or with -1/4 1/2 -1/4 coefficients?" Tags="|filters|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11360" PostTypeId="2" ParentId="11359" CreationDate="2013-10-29T09:53:13.080" Score="6" Body="&lt;p&gt;Both filters can be re-written in the form:&#xA;\begin{equation}&#xA;H(z) = \alpha ( 1 -2z^{-1} +z^{-2} )&#xA;\end{equation}&#xA;Clearly, in the first case, $\alpha=-\frac{1}{3}$ and in the second $\alpha=-\frac{1}{4}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the shape of the filter's frequency response is the same, the only difference is the scaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of two reasons of why the second filter may be preferred.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In the case of the second filter, the maximum gain of the filter (occuring at the Nyquist frequency) is normalized to $1$, whereas the first filter has a maximum gain of $\frac{4}{3}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The other more compelling reason however, is probably that the coefficients of the second filter can be expressed as powers of two ($\frac{1}{4}=2^{-2}$, $\frac{1}{2}=2^{-1}$) and therefore multiplication by these coefficients can be quickly implemented as bitwise operations on a computer or digital signal processor.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2013-10-29T09:53:13.080" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11363" PostTypeId="1" AcceptedAnswerId="11364" CreationDate="2013-10-29T13:05:06.420" Score="2" ViewCount="177" Body="&lt;p&gt;What are filter banks and what's their application? What's the meaning of $H(z)$ in descriptions of filter banks?&lt;/p&gt;&#xA;" OwnerUserId="5631" LastActivityDate="2013-10-29T14:03:33.753" Title="What are filter banks" Tags="|filters|lowpass-filter|bandpass|filtering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11364" PostTypeId="2" ParentId="11363" CreationDate="2013-10-29T14:03:33.753" Score="4" Body="&lt;p&gt;A filter bank is a collection of bandpass filters designed to split a signal into a number of bands. The centre frequencies of the band pass filters can be spaced linearly or according to a non-linear spacing depending on the intended application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z)$ denotes the $z$-domain transfer function of a filter in the bank.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2013-10-29T14:03:33.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11366" PostTypeId="2" ParentId="11356" CreationDate="2013-10-29T14:36:48.537" Score="1" Body="&lt;p&gt;(This explanation is going to be rough around the edges so that I can build your intuition. There are subtleties involved, but this should be good enough to start you off).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forget about the dB scale for a moment. Let us take a step back: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine that you have some signal that occupies a bandwidth from say, 50 Hz to 100 Hz. Its spectrum is flat across this band. That is, it has the same power at 50 Hz, as it does at 51 Hz, as it does at 52 Hz, etc etc. In this example, we say that it has a constant (flat) power-spectral-density within this band. Let us say that the value of the PSD in this band is 1 Watts / Hz. This means that across 1 Hz of frequency, we will measure 1 Watt in power. Across 50 to 100 Hz, we would measure of course, 50 Watts in power. (To compute your PSD values, they are simply the absolute value of your fourier amplitudes, squared). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, imagine a filter, that removes frequencies above 75 Hz and also removes frequencies below 50 Hz. It however keeps frequencies between 50 and 75 Hz. To &quot;keep&quot; a frequency, means it multiplies the power of a signal &lt;em&gt;at that frequency&lt;/em&gt; by 1. To &quot;remove&quot; a frequency, means it multiplies the power of a signal &lt;em&gt;at that frequency&lt;/em&gt; by 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you have a signal that is 1 Watt/Hz from 50 to 100 Hz. And you pass it through a filter that multiplies all frequency powers from 50 to 75 by 1, (&quot;keeps them&quot;), and it also multiplies all frequency powers less than 50 and above 75 Hz by 0. (&quot;removes them&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you pass your signal through this filter, what might you get? Well, you just removed all the energy of your signal from 75 to 100 Hz. Previously those frequencies had a power spectral density of 1 Wattage/Hz, however now they are 0. You have just &lt;em&gt;filtered&lt;/em&gt; your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I asked you at this point, &quot;Plot for me, the PSD of your signal after your filtering&quot;, you would draw 1's for frequencies in the 50 to 75 Hz range, and draw 0's for all other frequencies. Now if I said, &quot;I dont like this linear scale. I want you to draw this for me on a dB scale. A log scale.&quot; This means that you now simply take the log &lt;em&gt;of the PSD axis&lt;/em&gt;. So everywhere we had 0 watts/Hz, they are now -infinity watts/Hz dBW/Hz, (db Watts), and everywhere you had 1 Watt/Hz, we now have 0 dBW /Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking it so dB scale doesn't change your frequency axis, only your fourier amplitude/power axis.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-10-29T15:00:14.713" LastActivityDate="2013-10-29T15:00:14.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11367" PostTypeId="1" AcceptedAnswerId="11373" CreationDate="2013-10-29T14:39:05.593" Score="2" ViewCount="1270" Body="&lt;p&gt;I have implemented a QPSK modulator and demodulator using classic text-book examples: Square Root Raised Cosine Impulse shaping and Matched Filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I've been told that I could only used square waves for the modulation instead of sine waves on the emitter side (only +/-Vmod) and this really degrades the performance of the communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After further investigation it seems that the root cause of the lack of performance is not really the use of square wave but the change of impulse shaping/matched filtering implied by it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically my question is the following: Using only +/-Vmod (and 0V if necessary) on the emitter side, am I wrong in assuming that the best case scenario is using a Rectangular Impulse Shaping with the according Matched Filter or is there some other combination that could provide better results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any ideas or links I could learn from don't hesitate! I'm struggling because I don't know if my reasoning is wrong or if its my implementation.&lt;/p&gt;&#xA;" OwnerUserId="4783" LastActivityDate="2013-10-29T16:10:29.947" Title="QPSK, from Square Root Raised Cosine to Rectangular Impulse Shaping" Tags="|matlab|modulation|qpsk|theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11368" PostTypeId="1" CreationDate="2013-10-29T14:41:26.550" Score="3" ViewCount="386" Body="&lt;p&gt;What happens if I ignore Nyquist?  I have a 16.368MHz digital signal coming out of a GPS front-end chip.  My microcontroller (which is reading that digital stream of data) operates at a maximum of 32MHz so sampling at ~16MHz seems unlikely.  If I undersample my signal with say M = 3, then I have a 5.456MHz signal which I can sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Intermediate Frequency of the digital signal coming from the GPS chip is at 4.092MHz, it has a bandwidth of about 2MHz but there does seem to be noise at all frequencies.  So clearly, downsampling shouldn't destroy my signal.  When I simulate the downsampling, even values of M seem to completely corrupt the data (frequency domain looks like pure noise) however odd values of M give a recoverable spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what if I do undersample my signal without filtering it first?  Is there any way to quantify the extra loss this will add to my signal without ever recovering the full 16.368MHz digital signal?  Also, are there any tricks I could use here to avoid this problem completely?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Here is a frequency domain representation of the 16.368MHz signal (and yes it's a Real signal, despite me plotting both sides of the spectrum):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/06MPX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="5806" LastEditDate="2013-10-30T01:54:28.910" LastActivityDate="2013-10-30T01:54:28.910" Title="Ignoring Nyquist" Tags="|nyquist|digital|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11369" PostTypeId="1" AcceptedAnswerId="11371" CreationDate="2013-10-29T14:56:14.537" Score="0" ViewCount="714" Body="&lt;p&gt;I'm trying to create a spectrogram of a complex signal 'y', but I'm running into a problem where the spectrogram that I create appears to have its spectral features &quot;displaced&quot; in frequency space, and I think that it has something to do with not having pre-processed the signal correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the signal's:&lt;br&gt;&#xA;sampling rate (Fs = 400 KHz)&lt;br&gt;&#xA;bits/sample (Nbits = 16)&lt;br&gt;&#xA;frequency that the signal is centered on (Fc = 5.60 MHz)&lt;br&gt;&#xA;total time that the signal elapses (dT ~ 145 sec).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use matlab's built-in spectrogram function with the following arguments:&lt;br&gt;&#xA;[S, F, T] = spectrogram(y, num_pts_win, num_pts_overlap, num_pts_fft, Fs);&lt;br&gt;&#xA;where:&lt;br&gt;&#xA;num_pts_win = num_pts_fft = 2^14&lt;br&gt;&#xA;and:&lt;br&gt;&#xA;num_pts_overlap = 1/2 num_pts_win = 2^13  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After subtracting Fs/2 from F to get a frequency axis from -Fs/2 -&gt; Fs/2 rather than from 0-&gt;Fs, I plotted the spectrogram of the log(S) and obtained:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/NjqlA.jpg&quot; alt=&quot;my spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while I was expecting to get something like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YRNs9.jpg&quot; alt=&quot;correct spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that this displacement of the spectral features has resulted from not accounting for the central/carrier frequency (Fc) anywhere, but as I'm sort of new at this, I don't really understand exactly how I should account for it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, I suspect that the spectral features I'm seeing in the first graph are actually aliases of the true spectral features, and I think this aliasing is happening because I haven't accounted for the central/carrier frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2:&#xA;After FFTSHIFT'ing over the frequency dimension I think I've cleaned things up nicely!&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0VCbT.jpg&quot; alt=&quot;spectrogram after fftshift&amp;#39;ing&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5821" LastEditorUserId="5821" LastEditDate="2013-10-29T15:49:26.040" LastActivityDate="2013-10-29T15:49:26.040" Title="I can't figure out why spectral features are &quot;displaced&quot; on a spectrogram" Tags="|matlab|modulation|demodulation|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11371" PostTypeId="2" ParentId="11369" CreationDate="2013-10-29T15:19:48.593" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;After subtracting Fs/2 from F to get a frequency axis from -Fs/2 -&gt; Fs/2 rather than from 0-&gt;Fs&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can't center the frequency by changing the labels on the x-axis. Use 'fftshift' instead.&lt;/p&gt;&#xA;" OwnerUserId="5315" LastEditorUserId="5315" LastEditDate="2013-10-29T15:25:57.290" LastActivityDate="2013-10-29T15:25:57.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11372" PostTypeId="2" ParentId="11368" CreationDate="2013-10-29T16:00:56.130" Score="3" Body="&lt;p&gt;You should never &lt;em&gt;ignore&lt;/em&gt; Nyquist, but you can successfully sample bandpass signals at a rate lower than Nyquist if you are careful.  This is often called undersampling or &lt;a href=&quot;http://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow&quot;&gt;bandpass sampling&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main thing to keep in mind when undersampling is that, not only does the signal of interest alias down to baseband, but so does much of the out-of-band noise.  The filtering that precedes downsampling is not usually meant to condition the signal itself, it is meant to squash all of the noise that would otherwise alias on top of your downsampled signal. The more you downsample (higher values of &lt;code&gt;M&lt;/code&gt;), the more this effect will bite you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other thing to remember when undersampling is that a real signal has positive and negative frequency support.  Ignoring this fact can cause your negative frequency aliases to land on top of your positive frequency aliases. This might explain what you are seeing with even-parity vs. odd-parity values of &lt;code&gt;M&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-10-29T16:00:56.130" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11373" PostTypeId="2" ParentId="11367" CreationDate="2013-10-29T16:10:29.947" Score="2" Body="&lt;p&gt;You can use rectangular pulses, but it is not necessary to do so.  Rectangular pulses have advantages and disadvantages.  The advantage is that they are very simple and easy to use, both for the modulator and the demodulator.  It makes life easier for the demodulator because it makes symbol timing very forgiving- you can be off on where you sample the symbol and still get a good measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two disadvantages to using rectangular pulses.  The first is that it uses a lot of bandwidth.  The Fourier transform of a rectangular pulse is a sinc function, which drops off very slowly.  The second disadvantage is related to the first- very few real world solutions use rectangular pulses &lt;em&gt;because&lt;/em&gt; they use a lot of bandwidth.  If you want something realistic, in terms of what most designers would do professionally, you should not use rectangular pulses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could, perhaps, get it working with rectangular pulses, and then when it is solid reintroduce the root raised cosine pulses.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-10-29T16:10:29.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11374" PostTypeId="1" CreationDate="2013-10-29T19:08:23.400" Score="2" ViewCount="1592" Body="&lt;p&gt;I went through the answer &lt;a href=&quot;https://dsp.stackexchange.com/questions/3255/kalman-filter-in-practice&quot;&gt;Kalman filter in practice&lt;/a&gt; and it seems we must know all the first and second order properties of random variables to apply the Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I only have a set of data $y_1,\dots,y_n$ and a given model $G$ and $F$ with assumed noise processes, could someone please explain to me how to apply Kalman filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="5809" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-10-29T21:40:05.793" Title="Applying Kalman filter to a data set" Tags="|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11375" PostTypeId="2" ParentId="11374" CreationDate="2013-10-29T20:11:22.843" Score="2" Body="&lt;p&gt;&lt;strong&gt;Signal Model&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing you really need when you start to use a Kalman filter is what I would call the &quot;signal model&quot;.  That means, you need to take a guess (and sometimes that's all it is, though usually you can have an &lt;em&gt;educated&lt;/em&gt; guess) at how the signal you're measuring, $y$, was generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual signal model comprises $F$, $G$, $H$, $Q$ and $R$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_{k+1} = F x_k + G u_k + w_k\\&#xA;y_k = H x_k + v_k&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Q$ is the covariance of $w_k$ and $R$ is the covariance of $v_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are you trying to achieve?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implicit in the signal model is that you've chose the &quot;state variables&quot; (the components of $x_k$) that you are working with.  Usually, what you are trying to achieve is to measure something and, from that, infer the value of one or more of the state variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's missing?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on what you've said, the only thing that seems to be missing is how you get from the states $x_k$ to your measurements $y$ (i.e. $H$). &lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-10-29T21:40:05.793" LastActivityDate="2013-10-29T21:40:05.793" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11376" PostTypeId="1" AcceptedAnswerId="12653" CreationDate="2013-10-29T20:52:13.270" Score="20" ViewCount="9489" Body="&lt;p&gt;In most examples and FFT code that I've seen, the output (frequency magnitudes) of the forward DFT operation is scaled by N -- i.e. instead of giving you the magnitude of each frequency bin, it gives you N times the magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Operationally, this is simply because the DFT is calculated by taking the inner product of the signal with each basis sine (i.e. un-normalised correlation). However, that doesn't answer the philosophical question of &lt;em&gt;why don't we just divide by N before returning the output?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, most algorithms divide by N when re-synthesising.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems counter-intuitive to me, and (unless I'm missing something) it makes all explanations of the DFT very confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In every scenario I can dream up, the actual magnitude (not the magnitude * N) is the value I need from a DFT operation, and the normalised magnitude is the value I want to input into an IDFT operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why isn't the DFT defined as DFT/N, and the IDFT defined as a simple sum of normalised-magnitude sinusoids?&lt;/p&gt;&#xA;" OwnerUserId="2076" LastActivityDate="2013-11-27T07:27:07.917" Title="Why are magnitudes normalised during synthesis (IDFT), not analysis (DFT)?" Tags="|fft|dft|magnitude|normalization|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11377" PostTypeId="2" ParentId="11353" CreationDate="2013-10-29T21:56:51.170" Score="1" Body="&lt;p&gt;Very interesting question!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know of any reason why you can't do this, but I have had a hard time finding an example.  I finally found &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.76.3801&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, which does an analysis of what happens when the measurements are randomly lost due to transport delays / errors in communication systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main problem that they report is that the error covariance matrix iteration is now stochastic rather than deterministic (as in the usual Kalman filter formulation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kgf8N.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-10-29T21:56:51.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11378" PostTypeId="2" ParentId="11376" CreationDate="2013-10-29T22:17:49.073" Score="7" Body="&lt;p&gt;Actually, 3 different ways to put the scale factors are common in various and different FFT/IFFT implementations: 1.0 forward and 1.0/N back, 1.0/N forward and 1.0 back, and 1.0/sqrt(N) both forward and back.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These 3 scaling variations all allow an IFFT(FFT(x)) round trip, using generic unscaled sin() and cos() trig functions for the twiddle factors, to be an identity transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that preserving sinusoidal magnitude on the forward FFT does not preserve total energy (as in Parseval's theorem).  Pick the one you prefer.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-10-29T22:23:18.257" LastActivityDate="2013-10-29T22:23:18.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11379" PostTypeId="2" ParentId="11376" CreationDate="2013-10-29T22:42:22.490" Score="9" Body="&lt;p&gt;I can think of several reasons involving computational precision issues, but that probably would not do justice because mathematically we're defining it the same way no matter what, and mathematics knows no precision issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my take on it. Let's conceptually think about what DFT means in signal processing sense, not just purely as a transform. In this case, it seems to me that applying DFT to a signal and to a system makes us wish to see different results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's apply the DFT to a constant signal of value 1. Let's also suppose that this signal is finite in length and is 16 taps long. What do we want from DFT in this case? Obviously, we want it to tell us what amplitude each frequency component of the signal has. Clearly, our signal has a single component of frequency 0 and amplitude 1. But the DFT gives us a single peak at bin 0 and height 16! In this case, your frustration with the definition of the DFT makes perfect sense. We should scale the analysis coefficients, not the synthesis coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay, now let's analyze the same number array, namely our string of 16 ones, but in this case as a system. What do we conceptually want the frequency response of a system to mean? Most people will say that it is the amplitude of the output compared to that of the input, i.e. the transfer function. It this case, suppose that we feed a unity amplitude DC signal into our system and look at the amplitude of the steady-state response. Well, convolve two constant 16-tap signals together and you get a transient ramp followed by a steady state output which is a DC signal of amplitude (check-this-out!) 16! In this case our definition of non-scaling analysis transform makes more sense than otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of the day, it's all about what you're trying to represent. There are many reasons for considering this system-centric definition of the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, however, we look at the transform from a purely mathematical perspective, neither of these make the most sense, since we can make this transform &lt;a href=&quot;https://en.wikipedia.org/wiki/Orthonormal&quot; rel=&quot;nofollow&quot;&gt;orthonormal&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_transformation&quot; rel=&quot;nofollow&quot;&gt;unitary&lt;/a&gt; by scaling &lt;em&gt;both&lt;/em&gt; analysis and synthesis transformations &lt;a href=&quot;https://en.wikipedia.org/wiki/DFT_matrix&quot; rel=&quot;nofollow&quot;&gt;by $\frac{1}{\sqrt{(N)}}$&lt;/a&gt;. This will also preserve power of both time and frequency representation such that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's theorem&lt;/a&gt; always holds. &lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2013-11-27T07:27:07.917" LastActivityDate="2013-11-27T07:27:07.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11380" PostTypeId="2" ParentId="11368" CreationDate="2013-10-29T23:09:36.153" Score="2" Body="&lt;p&gt;The Nyquist limit is not in regards to the highest frequency of the signal, but in regards to the total bandwidth of the signal being sampled.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can under-sample a signal much higher in frequency than Fs/2, without filtering, as long as the contiguous frequency band of the signal does not touch or cross any of the folding frequencies (N * Fs/2 for all integer N).  (Or, if the signal spectrum is sparse, as long as there is no overlap of any spectrum frequencies with non-zero energy after folding).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But note that any jitter in the sampling clock creates a lot more sampling noise if the frequency band being sampled is above Fs/2.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-29T23:09:36.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11381" PostTypeId="2" ParentId="11153" CreationDate="2013-10-29T23:45:59.803" Score="1" Body="&lt;p&gt;There is both a hue shift and a saturation shift from the full color image to the band artifact. Converting the color image to grayscale generates an image that still has an artifact, but that is less obtrusive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &quot;image inpainting&quot; algorithms that you might try to correct the artifact, though it would help to first isolate the affected region. Here are a few thoughts on identifying the artifact:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Run Hough or RANSAC line fits for horizontal and vertical lines in the image. For a natural scene, and especially in a scene of the Earth, it would be odd to have horizontal or vertical lines corresponding to real features. Even the structures visible from space such as canals and large constructions tend to meander.&lt;/li&gt;&#xA;&lt;li&gt;Try a form of image subtraction that subtracts a grayscale image from the original color image. Since the artifact is more grayscale-like and desaturated, you should be able to detect a region of hue and saturation differences. I would recommend working in HSV space for this operation. Run an algorithm in the vertical direction to look for a peak or valley in the resulting (color HSV - gray HSV) image.&lt;/li&gt;&#xA;&lt;li&gt;Test row-by-row cumulative changes in Hue and Saturation. From row N to row N+1, the same X pixel generally won't change much in H, S, or V. However, you should notice a significant difference between the row just before the artifact and the row at the artifact. The difference might be as simple as the root mean square of H and S differences at each pixel, or even just the sum of differences. Or whatever. Pick a metric that is simple and that works.&lt;/li&gt;&#xA;&lt;li&gt;Double check the original, raw image to determine whether the horizontal artifact extends into the black region of space on the left side of the image. In the copy of the image I downloaded, it appeared that the artifact did not extend into the black region.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here are specs for JunoCam:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/JunoCam&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/JunoCam&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The camera uses a Kodak image sensor, the KODAK KAI-2020, capable of color imaging at 1600 x 1200 pixels. It has a field of view of 18 x 3.4 degrees with three filters to provide color imaging.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That sensor should give a nice color image without weird artifacts when used on earth in gentler circumstances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the artifact did not appear to extend into the black region of space at left, that could be a matter of dynamic range/windowing: there may be some difference in the charge on those pixels, but perhaps that difference is clipped to zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that this is a readout problem as the image rows are dumped. With older analog cameras we could see all sorts of crazy artifacts related to EM interference. With digital cameras that's usually much less of a concern, but one possibility is that some short, localized EM event occurred that somehow affected just certain rows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you zoom in to the top of the band artifact, you'll see desaturated rainbow artifacts. There are two non-adjacent rows that are brighter than their neighbors, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the artifact is lined up so nicely with the horizontal rows of the image, I would expect the problem is some internal electronics problem rather than a problem with lensing, color filters, flaring, or anything like that. Unless the camera became damaged by a particularly strong EM event, I would guess that the artifact would occur only rarely.&lt;/p&gt;&#xA;" OwnerUserId="742" LastActivityDate="2013-10-29T23:45:59.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11382" PostTypeId="1" CreationDate="2013-10-29T23:54:23.917" Score="1" ViewCount="153" Body="&lt;p&gt;I have a vector of zeros and ones with length ~2000. I need to detect and filter out the once, that appear periodically. There may be none to 3 such periodic signal's components. Typical periods are in range 10-90, but due to measuring noise, some spikes may be shifted by 1-3 steps in any direction.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume there is a technique that I can set a threshold on the energy of periodical spikes, and filter them out causally. I'm not asking for a ready solution (though it would be very nice), but I would be grateful for a link to a relevant and simple example, preferably in Matlab and using FFT.&lt;/p&gt;&#xA;" OwnerUserId="4790" LastActivityDate="2013-10-29T23:54:23.917" Title="Causal bandstop filter" Tags="|matlab|fft|filter-design|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11383" PostTypeId="2" ParentId="11358" CreationDate="2013-10-30T00:45:59.260" Score="1" Body="&lt;p&gt;I'm not sure if there are clear definitions for each term but here are my suggestions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Symbol rate offset is the difference between the symbol rate entering a receiver and the symbol rate used by the demodulator. It could be measured in Hertz or parts per million (ppm).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Symbol timing offset is the difference between the time that a symbol should have been sampled and when it was sampled. It could be measured in seconds or fractions of the nominal baud duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling clock offset is symbol rate offset multiplied by samples per symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;John &lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2013-10-30T00:45:59.260" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11384" PostTypeId="2" ParentId="11345" CreationDate="2013-10-30T01:23:41.033" Score="3" Body="&lt;p&gt;The expected 3dB frequency is wrong because of radian conversion. With $s=j\omega$,&#xA;$$H(j\omega) = \frac{1}{1+\tau j\omega} $$&#xA;and $20\log_{10}|H(j\omega)|\approx-3$&#xA;when $\omega=\omega_{3dB}=\frac{1}{\tau}$. However $\omega=2\pi f$, so &#xA;$$f_{3dB}=\frac{\omega_{3dB}}{2\pi}=\frac{1}{2\pi\tau}.$$&#xA;With $\tau=0.1\text{s}$, $\ f_{3dB}=1.59\text{Hz}$ as on the original plots.&lt;/p&gt;&#xA;" OwnerUserId="5808" LastActivityDate="2013-10-30T01:23:41.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11385" PostTypeId="2" ParentId="10787" CreationDate="2013-10-30T05:48:51.270" Score="0" Body="&lt;p&gt;It looks like the noise, while not perfectly periodic, is concentrated about one specific frequency. I would guess that this noise is caused by electrical power frequency (usually 50 Hz or 60 Hz depending on your location). If you plot the spectrum of the signal you have, you should be able to find a strong component in this frequency range. You can then remove most of it with a simple notch filter.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-10-30T05:48:51.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11386" PostTypeId="1" CreationDate="2013-10-30T09:25:20.467" Score="0" ViewCount="61" Body="&lt;p&gt;I'm trying to simulate the damping of the hand on a guitarstring on an already recorded/sampled open guitarstring sound. I've been trying to use low pass filter and had a moving frequency range but that didn't make it sound like a palm muted string, just the loss of higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone help me find good material on this, that a human could atleast grasp a bit? It's going to be implemented in C++ and I have been searching and found almoust everything about the karplus-strong string algorithm, but that's not what I want.. I do want the damping part implemented on a sample of an already recorded real played string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question was first asked here.. I hope that will not be considered as crosslinking now?? &lt;a href=&quot;https://stackoverflow.com/questions/19667049/algorithm-to-change-an-already-sampled-guitarstring-to-sound-like-it-was-a-bit-d&quot;&gt;https://stackoverflow.com/questions/19667049/algorithm-to-change-an-already-sampled-guitarstring-to-sound-like-it-was-a-bit-d&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5828" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-10-30T10:55:03.183" Title="Algorithm to change an already sampled guitarstring to sound like it was a bit damped by the hand" Tags="|filters|audio|algorithms|modulation|sound|" AnswerCount="1" CommentCount="1" ClosedDate="2013-11-16T19:50:48.330" ContentLicense="CC BY-SA 3.0" />
  <row Id="11387" PostTypeId="2" ParentId="11386" CreationDate="2013-10-30T10:55:03.183" Score="1" Body="&lt;p&gt;Here is one thing to try: Guitar wave form typically has a sharp on set (the &quot;pluck&quot;), followed by some ringing. You could write an onset or transient detector that finds these onsets. Once you have one, apply a fast exponential decay to the waveform to make the ringing a lot shorter. Find the next onset and repeat. You probably also want a mild low pass filter, just something with negative frequency slope to simulate that the palm damps higher harmonics more than lower harmonics.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-30T10:55:03.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11388" PostTypeId="1" CreationDate="2013-10-30T10:59:18.307" Score="3" ViewCount="310" Body="&lt;p&gt;I want to implement a Time-Freqency analysis by wavelet packets. I don't know what level and sampling rate should I use. I've tried different value for level(3,4,5,6,). but I couldn't get an accurate frequency identification. here is my little scrip and results, hope one can say whats the problem, Thanks in advance.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f=30;N=300;                            %df:final time,N:segments&#xA;t=linspace(0,df,N); dt=t(3)-t(2);      % dt: time intervals&#xA;fs=ceil(inv(t(2)-t(1)));              % fs: sampling freq&#xA;fn=[0.4 0.6 1.0];E=[0.03 0.05 0.1];   %fn:freq, E:damping&#xA; A=[1.0 2.0 3.0];wn=2*pi.*fn;a=E.*wn;wd=wn.*sqrt(1-E.^2);  % A:Amplitude.&#xA;y=A(1)*exp(-a(1)*t).*sin(wd(1)*t)+A(2)*exp(-a(2)*t).*...&#xA;      sin(wd(2)*t)+A(3)*exp(-a(3)*t).*sin(wd(3)*t);&#xA;level = 3;&#xA;wpt = wpdec(y,level,'coif5');&#xA;[Spec,Time,Freq] = wpspectrum(wpt,fs,'plot');    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;here are result for Level 3,4,5,6 decompositions.&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ap1R2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;as you can see in the pictures, It doesn't show fn=[0.4 0.6 1.0] values accurately.&#xA;Then I have run another little scrip to see which frequencies,WP identified.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;absSpec=abs(Spec);&#xA;modI=max(absSpec');          % get  max |Spec| correspond to freq of signal&#xA;modI=modI/max(modI);         % normalize each column 0-1&#xA;fig=1;fig=fig+1;figure(fig)&#xA;Freq=fliplr(Freq);            % the frequency order must be reverse. idk why, i fount-&#xA;                              % out by trail and error. very strange but true.&#xA;plot(Freq,modI)              % Plot all modes(freq).&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the frequency plot for level 3,4,5,6.&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cz655.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;As you can see it doesn't show [0.4,0.6,1]Hz frequencies at level 3,4,5. but in level 6 it shows something(why?). but not accurate though. it represent a range of frequency specially for 0.6 and 1 Hz.(the peak is flat) why this is happening?&lt;br&gt;&#xA;moreover, I got the plot for level 8,9,10,11 too. in here I can see a better results, but still it represent 2 or more peaks for each frequencies(why?)(plot is small here so you may barely see it).&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/b154Q.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;so my questions are:    &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;what sampling rate($f_s$)should i select in this case?(now it's&#xA;10)&lt;/li&gt;&#xA;&lt;li&gt;why frequency plot doesn't show any result in level 3,4,5?  &lt;/li&gt;&#xA;&lt;li&gt;It shows some result in level 6 for all frequencies. but what is&#xA;its range? I can understand it is representing a range of&#xA;frequencies for every components(0.4,0.6,1Hz) of my signal.&#xA;Afterward, what is the error for detected range in this level(or any&#xA;level)?&lt;/li&gt;&#xA;&lt;li&gt;In level 8,9,10,11 frequency plot has a narrower range so its&#xA;more accurate, but what is other smaller peaks around detected&#xA;frequencies?&lt;/li&gt;&#xA;&lt;li&gt;for a time series with size of M what is WPT computational&#xA;complexity in terms of big O(), I thought its faster than CWT but it&#xA;is definitely not (I just can feel it by Tic_Toc function). so would&#xA;anyone compare WPT with CWT in computational complexity (big O)&#xA;terms?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in Advance for your ideas and answers.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-11-06T16:35:45.780" LastActivityDate="2013-11-06T16:35:45.780" Title="Hints and helps to implement an accurate wavelet packet transfrom" Tags="|wavelet|frequency-response|time-frequency|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11389" PostTypeId="1" CreationDate="2013-10-30T13:15:43.010" Score="4" ViewCount="1334" Body="&lt;p&gt;Is there a method in order to compute some sort of &lt;strong&gt;edge detection&lt;/strong&gt; / &lt;strong&gt;convex hull&lt;/strong&gt; of a signal &lt;code&gt;x[n]&lt;/code&gt; (in orange here). Here of course the orange signal is not convex nor concave, but only piecewise...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I would like to know if this could be an alternative way of computing the &lt;strong&gt;envelope&lt;/strong&gt; of a signal, alternative to the traditional method &lt;code&gt;input -&amp;gt; abs() -&amp;gt; low pass filter&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CcVFg.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-10-30T13:39:42.523" LastActivityDate="2013-10-30T18:06:19.430" Title="Envelope of a signal via Convex hull / Edge detection" Tags="|filters|signal-analysis|lowpass-filter|amplitude|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11390" PostTypeId="1" CreationDate="2013-10-30T14:13:06.213" Score="2" ViewCount="385" Body="&lt;p&gt;I’m trying to figure out how to go about differentiating between a single-voice speech and a multiple-voice conversation in which voices overlap. In other words – the moment of overlap is what I’m interested in. I want to be able to listen to a vocal conversation between two people, and detect when voices collide/overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that spectrum-wise there’s a major difference between a speech-based conversation with no overlaps compared with a conversation with speech overlaps, so perhaps one direction to look at is detecting sudden spectral changes?&lt;/p&gt;&#xA;" OwnerUserId="5831" LastEditorUserId="76" LastEditDate="2013-10-31T09:49:29.290" LastActivityDate="2016-01-05T06:52:37.007" Title="Speech Overlap Detection" Tags="|signal-detection|speech|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11391" PostTypeId="1" AcceptedAnswerId="11393" CreationDate="2013-10-30T17:42:39.847" Score="0" ViewCount="908" Body="&lt;p&gt;I have found several sources describing how to use Doppler velocimetry/anemometry to measure the Doppler shift with analog signals, but i cannot find much about using this method for digital signals such as Bluetooth.  I was wondering if it were possible to use Doppler velocimetry/anemometry with digital signals? If so i was wondering if I could use it with the Bluetooth capabilities(2400 MHz – 2483.5 MHz) of an iPhone?  &lt;/p&gt;&#xA;" OwnerUserId="5832" LastActivityDate="2013-10-30T18:54:32.263" Title="Using Doppler velocimetry with digital signals such as Bluetooth" Tags="|frequency|digital-communications|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11392" PostTypeId="2" ParentId="11389" CreationDate="2013-10-30T18:06:19.430" Score="1" Body="&lt;p&gt;You can use the Hilbert transform to get the &lt;a href=&quot;https://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;analytic signal&lt;/a&gt;.  The absolute value of the analytic signal is the envelope.  It's available in &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.hilbert.html&quot; rel=&quot;nofollow&quot;&gt;SciPy&lt;/a&gt; and many other software suites, though it's usually poorly named.&lt;/p&gt;&#xA;" OwnerUserId="5833" LastActivityDate="2013-10-30T18:06:19.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11393" PostTypeId="2" ParentId="11391" CreationDate="2013-10-30T18:54:32.263" Score="2" Body="&lt;p&gt;If your question is whether you could ever use the Bluetooth radio in an iPhone to perform doppler velocimetry, I'm going to go out on a limb here and say no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most mobile devices are incredibly  modular. This means that the BT/WiFi radio (they are often combined into a single chip these days) is designed to handle all of the RF signal processing necessary, and then hand over only the &lt;strong&gt;digital data&lt;/strong&gt; received, but never the &lt;strong&gt;analog signals&lt;/strong&gt;.  By the time the signal is turned into digital data, any effects of multipath, channel noise, doppler shift, and other analog phenomena has been removed.  It is highly unlikely that any mass-produced cell phone would have access to the analog signal being received by the individual radios.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-10-30T18:54:32.263" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="11394" PostTypeId="1" CreationDate="2013-10-30T21:33:49.770" Score="2" ViewCount="224" Body="&lt;p&gt;I am dealing with a problem similar to principal component analysis. Aka, I have a matrix and i want to recover the 'most efficient basis' to exaplin the matrix variability. With a square matrix these are the eigenvectors, weighted by the eigenvalues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Originally, I was dealing with square matrices, and I used eigendecomposition to recover the eigenvectors, as explained above. Now however, I am dealing with rectangular matrices and using SVD to recover the efficient basis, ie A=USV' where the vectors of U are the recovered basis weighted by S, the singular values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my particular application, the sign of the eigenvalues/singular values makes a difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my question: with eigendecomposition and square matrices, the eigenvalues will be positive/negative. With SVD, the singular values re contrained to be the absolute value of the eigenvalues, ie s_i = |lamba_i|.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to recover the 'sign' of the eigenvalues through SVD?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4550" LastActivityDate="2013-10-30T21:33:49.770" Title="Recovering eigenvalues from singular values" Tags="|compression|linear-algebra|" AnswerCount="0" CommentCount="2" FavoriteCount="0" ClosedDate="2013-11-02T22:47:42.570" ContentLicense="CC BY-SA 3.0" />
  <row Id="11395" PostTypeId="2" ParentId="11390" CreationDate="2013-10-30T22:55:02.230" Score="1" Body="&lt;p&gt;Most human vowels produces a series of harmonic spectral peaks that resolve to a single F0 pitch (plus some broad spectrum noise).  If you can't fit a single F0 pitch to the series of the spectral peaks, then you might try testing the hypothesis that the spectrum resolves to 2 or more f0 pitches, which would imply more than one speaker talking with an overlap of vowel sounds in their words.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Detecting an overlap between a vowel and someone else's consonant, without lots of false positives, seems like it might be far more difficult.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-30T22:55:02.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11397" PostTypeId="2" ParentId="2577" CreationDate="2013-10-31T05:19:48.713" Score="1" Body="&lt;p&gt;A single example to refute GG is its own transform.  p = 0.5 gives an ordinary back-to-back exponential which has a transform of 2a/(s^2 + a^2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for DC block, it is. in the frequency domain Fdcx(w) = 1 - F(w).  This will put the reject around DC with the near-DC in w becoming non-optimized in the now passband.  So I would only use Dolph for this to make the wideband passband become equal ripple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is am impulse minus the original window function back in the time domain.  How big for the impulse? it must force the sum of the sequence to zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Warning, the even length sequence forces a zero at the Nyquist frequency, so you will want to avoid that.&lt;/p&gt;&#xA;" OwnerUserId="5837" LastActivityDate="2013-10-31T05:19:48.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11399" PostTypeId="1" AcceptedAnswerId="11400" CreationDate="2013-10-31T09:23:44.807" Score="0" ViewCount="711" Body="&lt;p&gt;I'm an absolute beginner.&#xA;I'm doing a project that involves estimating the time delays between the sound signal arriving at different microphones in an array (the project is a bit complicated but I'll find my way through). I'm planning to use a panda board and connect the microphone array to it. But before going about implementing the array, I thought I should first learn how to do some DSP on an analog input. Basically, how would I connect ONE microphone to the panda board and do, for eg, an FFT on the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The panda board has an audio in port but that wouldn't help much when I have to use multiple microphones. Can I connect the condenser mic (the really cheap one ) using 2 wires to a general input pin? How would I read input from it? Will I be able to record sound using such a setup? And I understand that I have to do the Analog to digital conversion (In fact I WANT to do it by myself, so that I would better understand how stuff work).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now the million dollar question : If I connect a few more microphones to different input pins of the panda board and give them the same sampling rate (I have no idea how but I'll learn it) will that make a microphone array?&lt;/p&gt;&#xA;" OwnerUserId="5116" LastActivityDate="2013-10-31T10:00:15.007" Title="Signal processing using panda board" Tags="|signal-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11400" PostTypeId="2" ParentId="11399" CreationDate="2013-10-31T10:00:15.007" Score="1" Body="&lt;p&gt;To connect one microphone to the &lt;a href=&quot;http://pandaboard.org/&quot; rel=&quot;nofollow&quot;&gt;Panda board&lt;/a&gt;, use its audio input. The homepage says it's a stereo input, so yo can actually connect two microphones assuming your microphones are mono. To apply any DSP on the analog signal it must first be converted to a digital signal, of course. For that you need an analog-to-digital converter (ADC). It's an electronic device. You cannot do analog-to-digital conversion by yourself. I suspect the Panda board audio input to have a dual-channel ADC, otherwise it would be quite useless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't dived into the technical specs of the Panda board but I'd be very surprised if its general input pins were made for analog signals. So you cannot use those for recording audio, because they're lacking ADCs (unless you manage to use the ADCs of the RF interfaces present on the &lt;a href=&quot;http://www.ti.com/general/docs/wtbu/wtbuproductcontent.tsp?contentId=53243&amp;amp;navigationId=12843&amp;amp;templateId=6123&quot; rel=&quot;nofollow&quot;&gt;OMAP platform&lt;/a&gt;). For each microphone you need an ADC and an interface to the Panda board. Any selfmade solution will be a real hassle here, I would not recommend it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possible alternative solution is to use a professional audio interface that has multiple microphone inputs and a USB output. Then connect this audio interface to the Panda board via USB. The challenge here is to get a driver running on the Panda board. But I think it should be feasible. Keep Linux support in mind when choosing an audio interface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've managed that, and you arrange your microphones in a reasonable way you have a microphone array.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-10-31T10:00:15.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11401" PostTypeId="1" CreationDate="2013-10-31T11:45:27.877" Score="1" ViewCount="231" Body="&lt;p&gt;I'm trying to calculate symbol error probability of variant of pulse position modulation considering only AWGN channel. The decoder is maximum likelihood so the implementation of the detector is by using vector correlators.&#xA;$$&#xA;\arg \max_{x} &amp;lt;y,x&amp;gt;.&#xA;$$&#xA;Attached is the waveforms vector representation of the transceiver &amp;amp; receiver. I didn't find any general term for the inner product that will lead me to solve the probability problem and from there to find the analytic solution. Any help will be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oe9Tc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5674" LastEditorUserId="5674" LastEditDate="2013-10-31T15:34:43.540" LastActivityDate="2013-10-31T19:11:43.837" Title="PPM Variant - Analytic symbol error probability" Tags="|modulation|digital-communications|demodulation|self-study|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="11403" PostTypeId="1" AcceptedAnswerId="11406" CreationDate="2013-10-31T15:57:26.357" Score="1" ViewCount="6440" Body="&lt;p&gt;I have data that is sampled at 12 kHz. The &lt;code&gt;downsample&lt;/code&gt; function in software such as MATLAB only allow you to downsample by an integer factor, i.e. from $12\to{6,4,3,2,1,\ldots}$ kHz. How would I downsample by a non-integer factor, say, from $12\to{10,9,8,7,5,...}$ kHz (pseudocode/description is fine)? You can assume that the signal has been appropriately lowpass filtered prior to downsampling. Also, the desired new sampling rate (after downsampling) is a &quot;nice&quot; number (i.e., I'm not trying to do $12 \to 9.7432$ or something like that).&lt;/p&gt;&#xA;" OwnerDisplayName="user5839" LastActivityDate="2016-09-13T22:02:31.627" Title="Reducing sampling rate by a non-integer factor" Tags="|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11404" PostTypeId="1" CreationDate="2013-10-31T16:07:41.527" Score="9" ViewCount="768" Body="&lt;p&gt;I found a very interesting piece of code for MDFT polyphase filter bank &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/15813-near-perfect-reconstruction-polyphase-filterbank&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&#xA;Unfortunately, there doesn't seem to be a paper describing the theory. Does anyone know some reference for the code?&#xA;I'm especially interested in these 3 topics:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What are the data in the channels exactly? Are they supposed to be real, imaginary or complex?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The code computes only half of the number of bands. Is that due to real-valued signals used?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The result of the synthesis stage is build as a channel-wise difference of the outcome of the two synthesis filter banks. Why is it done like that? I can't find any paper describing this idea.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5841" LastEditorUserId="76" LastEditDate="2013-11-02T01:14:44.360" LastActivityDate="2022-11-04T00:00:09.293" Title="Can anyone explain me this MDFT polyphase filter bank?" Tags="|filters|filter-bank|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11405" PostTypeId="1" CreationDate="2013-10-31T16:26:17.870" Score="3" ViewCount="1823" Body="&lt;p&gt;Hey guys so I have an input sequence that are real values that represent intensity of a column of an image. I also have the transfer function in the Z domain of a 2nd order high pass filter. I have the following transfer function using the bi-linear transform estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XEv2q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say my input signal is defined as &lt;strong&gt;x[n] = 27, 588, 1013, 255, 38.&lt;/strong&gt; How can I determine the output y[n]?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two options, one being I determine X[z] then multiply it by H[z] and take the inverse transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other being I transform H[z] into h[n] and then I convolve it with x[n] using the following scheme &lt;img src=&quot;https://i.stack.imgur.com/krtuv.png&quot; alt=&quot;enter image description here&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I implement either of these solutions in code (eg. coding an automatic way to generate X[z] from an arbitrary x[n] OR programming a convolution function that implements FOIL for the second option)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is one easier than the other? Keep in mind that my signal is 512 samples in length as well, so convolution may be very expensive.&lt;/p&gt;&#xA;" OwnerUserId="4360" LastEditorUserId="4360" LastEditDate="2013-10-31T17:37:22.913" LastActivityDate="2013-12-31T02:17:24.527" Title="Find output of digital filter given input and transfer function?" Tags="|filters|discrete-signals|convolution|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11406" PostTypeId="2" ParentId="11403" CreationDate="2013-10-31T16:36:50.117" Score="3" Body="&lt;p&gt;I can recommend the resample command in MATLAB. It's a combination of up- and down-sampling. To get from 12kHz to a sampling rate of 9kHz, you upsample by 3 and downsample by 4. resample just needs your signal and the two factors for up- and down-sampling.  Remember, when downsampling, to first low-pass filter out everything between 4.5 kHz and 6 kHz. Very little energy should exist above the resulting Nyquist frequency.&lt;/p&gt;&#xA;" OwnerUserId="5841" LastEditorUserId="4346" LastEditDate="2016-09-13T22:02:31.627" LastActivityDate="2016-09-13T22:02:31.627" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11407" PostTypeId="2" ParentId="11405" CreationDate="2013-10-31T16:52:15.757" Score="3" Body="&lt;p&gt;Standard difference equation of a biquad: y[n] = b0*x[n]+b1*x[n-1]+b2*x[n-2]-a1*y[n-1]-a2*y[n-2];&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initialize all x[n], y[n]  to 0 for n &amp;lt; -1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b0,b1,b2 are 0.86 -1.72 0.86 (numerator) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a0,a1,a2 are 1 -1.71 0.73 (denominator)&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-10-31T16:52:15.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11408" PostTypeId="2" ParentId="11226" CreationDate="2013-10-31T17:58:06.750" Score="3" Body="&lt;p&gt;An approach that might be worthwhile investigating is some sort of on-line method.  Because of the highly non-linear nature of your signal model, the standard Kalman filter is out, but an Extended Kalman filter (or, perhaps, a particle filter) might be worth looking at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is that you set up your signal model state to be:&#xA;$$&#xA;x_t = \left[ &#xA;\alpha\ &#xA;\beta\ &#xA;\gamma\ &#xA;\delta\ &#xA;\phi\ &#xA;\omega\ &#xA;t_f&#xA;\right]^T&#xA;$$&#xA;with appropriate possible changes to the parameters modeled by the process noise covariance:&#xA;$$&#xA;x_{t+1} = x_t + w_k&#xA;$$&#xA;with $Q_k$ being the covariance of $w_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output equation would be where all the nonlinearities are encoded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick will be to see how the (Extended) Kalman filter's error covariance  differs between when you have this signal present, and when you don't.  The CUSUM algorithm applied to some statistic you will need to define might work. &lt;a href=&quot;ftp://ftp.irisa.fr/local/as/mb/k11.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;See Basseville and Nikiforov for details of that and other change detection algorithms.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not exactly the same thing, but &lt;a href=&quot;http://www.plosone.org/article/info:doi/10.1371/journal.pone.0003758&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; suggests that the approach may be feasible.  Their first example has a somewhat nonlinear system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qoFxu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-10-31T17:58:06.750" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11409" PostTypeId="1" AcceptedAnswerId="11410" CreationDate="2013-10-31T20:10:47.177" Score="3" ViewCount="448" Body="&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Considering that $1\over{2\pi}$ is the frequency of $\cos x$ and also of $\cos x - 2\cos 2x$, what is the frequency of $\cos x - \sqrt 2\cos\sqrt 2 x$?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Thoughts&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Perhaps &quot;frequency&quot; isn't the interesting quantity. I think the period is infinite. That would make the frequency zero. Maybe what I want to know is bandwidth?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the additive combination (superposition) of the two waves produces a component at the higher frequency $1/(2\pi(\sqrt 2-1))$. I would hope that sampling at a frequency of $1/(\sqrt 2\pi -\pi)$ would be sufficient to reveal as many zero-crossings as we may wish. Is that correct? Is it the best answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understood Fourier series and partial differential equations when I took that course and I still get the general idea, but it has been a long time.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Motivation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Mistakenly, I devised and posed this question for my colleagues as a weekly math challenge before I realized that I don't know how to get the answer myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll provide additionally just some background about my motive for asking this particular question. Maybe it can help you give an answer that is relevant to me. However, this background information in itself is not part of my question. So, I came up with the question about frequency hoping to move us nearer to another question that Mark Kac used in order to elucidate stochastic independence. That is, given any particular value $-2 &amp;lt;\alpha &amp;lt; 2$, in what fraction of the interval $0\leq x &amp;lt; 100$ (just to choose some arbitrary bounds) is $f(x) &amp;lt;\alpha$ where $f(x) = \sin x - \sin\sqrt 2 x$? The interesting destination that I want to reach is that the answer to this further question is (somehow related to) the normal distribution function, yet there is nothing &quot;random&quot; involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course $f'(x) =\cos x -\sqrt 2\cos\sqrt 2 x$. If I know the &quot;frequency&quot; (or something) of $f'(x)$ then I hope I can find, at least numerically, its zero-crossings. Those include all of the local extrema of $f(x)$. Then, knowing that the sum-to-product formula gives $f(x) = 2\cos(x/2+x/\sqrt 2)\sin(x/2-x/\sqrt 2)$, I think that my favorite computer algebra system and I can find, at least numerically, where $f(x) &amp;lt;\alpha$.&lt;/p&gt;&#xA;" OwnerUserId="5840" LastEditorUserId="5840" LastEditDate="2013-11-01T13:19:13.860" LastActivityDate="2013-11-01T13:27:23.370" Title="What is the frequency of $\cos x -\sqrt 2\cos\sqrt 2 x$?" Tags="|fourier-transform|frequency|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11410" PostTypeId="2" ParentId="11409" CreationDate="2013-10-31T20:51:55.863" Score="3" Body="&lt;p&gt;Not sure, whether it's really your question. The signal for which you asked for the frequency actually has two frequencies. There are two components, the two cosines. And each component has a frequency. Assume your frequency is called $f$. So, the signal looks like $\cos(2\pi f x)$. So, getting the frequency of a component is quite easy. Just take everything from it between the brackets and divide it by $2\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably, you already got the frequencies of your signal. But just to be sure, it's: $\frac{1}{2\pi}$ and $\frac{\sqrt{2}}{2\pi}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope, it was the answer, you're looking for...&lt;/p&gt;&#xA;" OwnerUserId="5841" LastEditorUserId="80" LastEditDate="2013-11-01T13:27:23.370" LastActivityDate="2013-11-01T13:27:23.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11411" PostTypeId="1" AcceptedAnswerId="11519" CreationDate="2013-10-31T20:56:03.787" Score="0" ViewCount="4977" Body="&lt;p&gt;What are the formulas for signal and noise power gain of digital filters (FIR and IIR)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a FIR, I've seen &lt;a href=&quot;http://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow&quot;&gt;in Harris' windowing paper&lt;/a&gt; that the DC gain is the sum of the filter weights. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G = \sum_{i=0}^{N-1} w_i&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a FIR, I've seen that the noise gain is the square root of the sum of the square of the weights.&#xA;$$&#xA;G = (\sum_{k=0}^{N-1} w_i^2 )^\frac{1}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What about an IIR?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2013-11-06T21:07:43.740" LastActivityDate="2013-11-06T21:39:17.477" Title="Gain of FIR/IIR filters" Tags="|filters|noise|infinite-impulse-response|finite-impulse-response|digital|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11414" PostTypeId="1" CreationDate="2013-10-31T21:56:53.283" Score="1" ViewCount="368" Body="&lt;p&gt;How does one choose the proper windowing function to apply in an FFT? What are the benefits of larger sizes and smaller ones? Which would be the best for pitch estimation? Also which window function would be best for pitch estimation?&lt;/p&gt;&#xA;" OwnerUserId="5485" LastActivityDate="2013-10-31T23:52:30.027" Title="How do you choose a size for a windowing function in FFT?" Tags="|fft|window-functions|voice|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11415" PostTypeId="2" ParentId="11414" CreationDate="2013-10-31T23:52:30.027" Score="1" Body="&lt;p&gt;Depending on the pitch source (voice? Instrument?), the magnitude peak from a windowed FFT may not even be good for pitch estimation.  If you are post processing FFTs as a sub-component of a more complicated pitch estimation method, then the type of post processing (parabolic log magnitude interpolation, complex Sinc interpolation, phase vocoder estimation, cepstrum, etc.) may alter the choice of more optimal windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A shorter FFT window provides better temporal localization for changing pitches.  A longer FFT window provides more frequency resolution, providing the spectrum stays stationary for the duration of the window width.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-10-31T23:52:30.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11416" PostTypeId="2" ParentId="11403" CreationDate="2013-11-01T04:25:10.293" Score="3" Body="&lt;p&gt;Another common method of downsampling is low-pass filtering followed by Sinc interpolation of the new sample point set.  These methods can be approximated and combined by choosing an appropriate width windowed Sinc as the interpolation kernel.  For a rational downsampling ratio, this interpolation kernel can be precalculated into a polyphase FIR filter bank.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-01T04:25:10.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11418" PostTypeId="1" CreationDate="2013-11-01T10:37:21.640" Score="5" ViewCount="586" Body="&lt;p&gt;Does anybody know if natural waterfalls generate &lt;a href=&quot;https://en.wikipedia.org/wiki/1/f_noise&quot; rel=&quot;nofollow&quot;&gt;pink noise&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Brownian_noise&quot; rel=&quot;nofollow&quot;&gt;brownian noise&lt;/a&gt;? I have tried to search about this but the matches are non-scientific and contradictory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.livescience.com/38547-what-is-brown-noise.html&quot; rel=&quot;nofollow&quot;&gt;Livescience.com&lt;/a&gt; mention Brownian noise to resemble big waterfall.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.soundonsound.com/sos/Oct04/articles/qa1004-3.htm&quot; rel=&quot;nofollow&quot;&gt;Soundonsound.com magazine&lt;/a&gt; says Pink noise to occur in nature, e.g. waterfall.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Even though it feels weird, it could be that the type of noise is dependent on the size of waterfall, for example by affecting to alpha of the power spectral density of the broad definition of pink noise: $S(f) = 1 / f^{\alpha}.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="5847" LastEditorUserId="6" LastEditDate="2013-11-02T22:41:07.777" LastActivityDate="2013-11-02T22:41:07.777" Title="Do waterfalls generate pink (1/f) or brownian (1/f^2) noise?" Tags="|noise|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11419" PostTypeId="2" ParentId="11418" CreationDate="2013-11-01T12:34:09.520" Score="6" Body="&lt;p&gt;Interesting question. I juts happen to live right outside a waterfall so I can relate some hands on experience.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The sound depends A LOT and water flow and weather conditions. Water flow is the main engine but wind can generate significant modulations&lt;/li&gt;&#xA;&lt;li&gt;Depending on conditions you can get strong harmonics in the signal. Sometimes you can actually see standing waves running up and down the fall. These tend to be very low in frequency: maybe around 1 Hz or so.&lt;/li&gt;&#xA;&lt;li&gt;The fall is pretty wide and has strong directivity. So the spectrum heavily depends where you are.&lt;/li&gt;&#xA;&lt;li&gt;Overall it sounds more brown than pink&lt;/li&gt;&#xA;&lt;li&gt;Fun fact: if the fall hits the right resonance, it noticeably shakes the house and the dishes in the kitchen cabinet start to rattle.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is just for one specific fall and I'm sure others behave quite differently. So all in all any simple model would be a gross over-simplification. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-01T12:34:09.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11420" PostTypeId="1" AcceptedAnswerId="11427" CreationDate="2013-11-01T12:39:02.690" Score="2" ViewCount="270" Body="&lt;p&gt;I've been reading about Super Resolution Image reconstruction (Reconstruction of high resolution image from multiple low resolution aliased images contain sub pixel shifts), and i want to know why SR is possible? this &lt;a href=&quot;http://www.mediafire.com/view/epo73vcq5xzhxw8/Aggelos_Katsaggelos-Super_Resolution_of_Images_and_Video_%28Synthesis_Lectures_on_Image,_Video,_and_Multimedia_Processing%29-Morgan.pdfg&quot; rel=&quot;nofollow&quot;&gt;document&lt;/a&gt; explains why SR is possible, but i didn't understand completely!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;please can you explain more clearly.&lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="128" LastEditDate="2018-07-12T14:00:59.610" LastActivityDate="2018-07-12T14:00:59.610" Title="Why Is Super Resolution (SR) Possible?" Tags="|image-processing|fourier-transform|superresolution|inverse-problem|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11421" PostTypeId="2" ParentId="11420" CreationDate="2013-11-01T13:24:35.263" Score="1" Body="&lt;p&gt;The fundamental reason this works is because you are using $p$ times as many (hopefully independent) samples as any individual low-resolution image to form the high resolution image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;How&lt;/em&gt; you generate the high resolution image is a harder problem. The reason it works is easy.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-01T13:24:35.263" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="11422" PostTypeId="1" AcceptedAnswerId="11436" CreationDate="2013-11-01T13:24:51.253" Score="1" ViewCount="1312" Body="&lt;p&gt;I want to extrapolate a signal &lt;strong&gt;X&lt;/strong&gt; of length 11, using the weiner filter coefficients &lt;strong&gt;&lt;em&gt;W&lt;/em&gt;&lt;/strong&gt; of length 7. The procedure I am using is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute the autocorrelation matrix upto lag 8 .&lt;/li&gt;&#xA;&lt;li&gt;Using Levinson recursion, invert the autocorrelation matrix &lt;strong&gt;&lt;em&gt;A&lt;/em&gt;&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Multiply the matrix of cross-correlations with the &lt;strong&gt;&lt;em&gt;inv(A)&lt;/em&gt;&lt;/strong&gt; to get &lt;strong&gt;&lt;em&gt;W&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Obtain &lt;strong&gt;Extrapolated Sample=Sum(W.*Signal)&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My questions is that, if now I have a new signal &lt;strong&gt;Y&lt;/strong&gt; of length &lt;strong&gt;15&lt;/strong&gt; as:&#xA;&lt;strong&gt;Y&lt;/strong&gt;=[&lt;strong&gt;X&lt;/strong&gt; (4 new samples)]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the Signal &lt;strong&gt;Y&lt;/strong&gt; has first 11 samples of &lt;strong&gt;X&lt;/strong&gt; and 4 new samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to compute weiner coefficients of this signal, given that I have already computed those for the signal &lt;strong&gt;X&lt;/strong&gt;, can you recommend any possible approach to 'update' the filter co-efficients &lt;strong&gt;&lt;em&gt;W&lt;/em&gt;&lt;/strong&gt; given the 4 new samples, without having to do the whole weiner filter computation again thus saving some computational time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have written the code for LMS Algorithm to iteratively 'adapt', when a new sample arrives, the filter co-efficients which were initially derived by Weiner Prediction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is not same as the Weiner coefficients derived on the whole input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;    `FilterOrder=7;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Window=7;&#xA;&#xA;Filter=zeros(1,FilterOrder);&#xA;&#xA;x = -20*%pi:0.1:20*%pi; &#xA;&#xA;m=length(x);&#xA;&#xA;StepSize=2.3e-4/1000000;&#xA;&#xA;data=[cos(2*x(1:floor(m/2))) cos(3.3*x(floor(m/2)+1:m))];&#xA;&#xA;Filter=WeinerCtrace(data(1:Window+1),FilterOrder);   // Initial Co-efficients&#xA;&#xA;for i=1:50&#xA;&#xA;Input=data(1+i:Window+i);               // Sliding Window of Filter Input&#xA;&#xA;DesiredOutput=data(Window+1+i);         // New sample value &#xA;&#xA;ActualOutput=Input(Window:-1:1)*Filter';&#xA;&#xA;Error=DesiredOutput-ActualOutput;&#xA;&#xA;while(1)&#xA;&#xA;    NewFilter=Filter+StepSize*Error*Input;     // Gradient Descent &#xA;&#xA;&#xA;    if(sum((NewFilter-Filter).^2)&amp;lt;1e-20)&#xA;&#xA;        break;&#xA;&#xA;    end&#xA;&#xA;    Filter=NewFilter;&#xA;&#xA;end&#xA;&#xA;Filter=NewFilter;&#xA;&#xA;end&#xA;WCoefficients=WeinerCtrace(data(1:Window+i+1),FilterOrder)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, according to my opinion the values of &lt;strong&gt;WCoefficients&lt;/strong&gt; and &lt;strong&gt;Filter&lt;/strong&gt; should match as the &lt;strong&gt;WCoefficients&lt;/strong&gt; are computed by applying Weiner Prediction on all the arrived data, while &lt;strong&gt;Filter&lt;/strong&gt; is computed iteratively on introduction of every new sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2:&lt;/strong&gt;&#xA;I have also implemented the RLS algorithm code given below, but the output of RLS still does not match the output of Weiner Prediction Coefficients for the same window:&#xA;&lt;code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;FilterOrder=11;&#xA;Window=11;&#xA;t=0:1:1000;&#xA;f=linspace(.5,5,length(t));&#xA;fs=100;&#xA;data=cos((%pi/fs)*(f.*t));&#xA;[Filter,P]=WeinerCtrace(data(1:Window+1),FilterOrder);&#xA;w=1;&#xA;plot(data,'-r');&#xA;for i=1:500&#xA;    Input=data(Window+i:-1:1+i)';           // Sliding Window of Filter Input&#xA;    DesiredOutput=data(Window+1+i);         // New sample value &#xA;    ActualOutput=Input'*Filter;&#xA;    Error=DesiredOutput-ActualOutput;&#xA;    K=(P*Input)/(w+(Input'*P*Input));&#xA;    P=(P-(K*Input'*P))/w;&#xA;    Filter=Filter+(K*Error);&#xA;end&#xA;inp=data(i+1:Window+i+1);&#xA;WC=WeinerCtrace(inp,FilterOrder)&#xA;inp=data(i+1:Window+i);&#xA;for j=1:100&#xA;   NextValue=inp(11+j-1:-1:j)*WC;&#xA;   inp=[inp NextValue];&#xA;   plot(Window+1+i+j,NextValue,'r+')&#xA;end&#xA;inp=data(Window+i:-1:1+i);&#xA;for j=1:100&#xA;   NextValue=inp(1:Window)*Filter;&#xA;   inp=[NextValue inp];&#xA;   plot(Window+1+i+j,NextValue,'b*')&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point out what am I doing wrong in the code or in anything else ?&#xA;Any suggestions/idea is welcome. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5527" LastEditorUserId="5527" LastEditDate="2013-11-06T05:35:38.397" LastActivityDate="2013-11-06T05:35:38.397" Title="Adaptive Wiener Filter Coefficients Calculation" Tags="|linear-prediction|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11423" PostTypeId="1" CreationDate="2013-11-01T15:18:13.373" Score="0" ViewCount="102" Body="&lt;p&gt;So I have discrete pixel values in the image and each row or column would make a signal. I would like to filter some of the rows or columns to remove high frequency components from them. Should I use the Z transform (difference equations) or work with the FFT of the data to perform the filtering?&lt;/p&gt;&#xA;" OwnerUserId="4360" LastEditorUserId="4360" LastEditDate="2013-11-01T17:13:46.783" LastActivityDate="2013-11-01T17:13:46.783" Title="If I want to apply a filter to an Image should I use the IIR or FIR filters?" Tags="|image-processing|fft|discrete-signals|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11424" PostTypeId="2" ParentId="11423" CreationDate="2013-11-01T15:45:59.257" Score="2" Body="&lt;p&gt;Some important vocabulary first to get the terminology right:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt; - Discrete Fourier Transform. This is a transform. It is quite computationally intensive. ($O(N^2)$).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Fft&quot; rel=&quot;nofollow&quot;&gt;FFT&lt;/a&gt; - This is an &lt;em&gt;algorithm&lt;/em&gt; that makes computing the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt; very fast. ($O(N \log N)$) &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform&quot; rel=&quot;nofollow&quot;&gt;Z-transform&lt;/a&gt;: This is just a mathematical generalization of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DTFT&lt;/a&gt; - it is not an algorithm. When $z = e^{jw}$, then we have the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DTFT&lt;/a&gt;. Moreover, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt; is a (uniform) sampling of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DTFT&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So from a practitioner's standpoint, what you will use in your filtering technique is the FFT - at least with a lot of classical techniques. This is because as stated above, the FFT is an algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In relation to implementing actual difference equation VS doing your filtering via FFT: Most of the time, implementing a convolution is done via the FFT, because of the computational simplicity. There is a point however at which it becomes most efficient to perform a convolution directly, but that is only if your image/signal sizes/lengths are really small. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-11-01T16:40:07.313" LastActivityDate="2013-11-01T16:40:07.313" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11425" PostTypeId="1" CreationDate="2013-11-01T15:46:53.347" Score="9" ViewCount="591" Body="&lt;p&gt;Wigner transform and continuous wavelet transform are both some kind of time-frequency representation of a signal.&lt;/p&gt;&#xA;&lt;p&gt;What are the similarities and differences between them? Could you give some comparison between them? Let's restrict ourselves in 1D signal at the moment.&lt;/p&gt;&#xA;" OwnerUserId="5278" LastEditorUserId="7092" LastEditDate="2021-02-03T20:10:49.060" LastActivityDate="2021-03-05T21:02:35.240" Title="What's the similarities and differences between Wigner transform and wavelet transform?" Tags="|signal-analysis|wavelet|time-frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11426" PostTypeId="1" CreationDate="2013-11-01T16:34:38.653" Score="1" ViewCount="156" Body="&lt;p&gt;if we pad any signal with enough zeros we can get the same result as linear &#xA;convolution whilst using the fft function we compute circular convolution. &#xA;Why?&lt;/p&gt;&#xA;" OwnerUserId="5849" LastEditorUserId="5849" LastEditDate="2013-11-06T18:24:26.230" LastActivityDate="2013-11-06T19:35:38.923" Title="why if we pad any signal with enough zeros we can get the same result" Tags="|fft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11427" PostTypeId="2" ParentId="11420" CreationDate="2013-11-01T19:20:41.787" Score="3" Body="&lt;p&gt;The more independent data you have, the more constrained are the possible solution sets that could produce that data, usually.  If any higher frequency content in the possible solution sets is constrained to not be completely arbitrary (which data derived from sub-pixel shifted sampling might so constrain), then the solution sets could possibly becomes sharper due to the steeper edges that can be reproduced using said higher frequency content.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-01T19:20:41.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11430" PostTypeId="1" AcceptedAnswerId="11482" CreationDate="2013-11-02T09:25:42.830" Score="4" ViewCount="620" Body="&lt;p&gt;I'm currently trying to develop an algorithm to control the camera characteristic of a camera (the camera characteristic can be controlled to adopt it to the different lightning situation which can occur)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case I need a good measurement of the exposure/lightning on the current image taken (i.e., if it's under/overexposed, well-exposed, maybe low/high contrast etc). And I'm therefore looking for a measurement on how to decide that. So far I couldn't find much about it. I found only ONE paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's called &quot;An optimal measure for camera focus and exposure&quot; (&lt;a href=&quot;http://dx.doi.org/10.1109/SSST.2004.1295702&quot; rel=&quot;nofollow&quot;&gt;DOI&lt;/a&gt;) from 2004 which describes some measurements like mean-values, entropy, standard deviation etc. based on the histogram to somehow measure the image quality (concerning focus and exposure). I also found many other papers which try to measure the image quality concerning things like blur, distortion etc etc but I don't need that obviously as I only want to control the camera characteristic to get a good contrast and exposure of my image -&gt; thus, a well-balanced histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know any other measures which could help me with that or do you maybe have another idea on how solve that issue and how to build a good controller of my camera characteristic?&lt;/p&gt;&#xA;" OwnerUserId="5856" LastEditorUserId="5856" LastEditDate="2014-03-20T16:29:32.103" LastActivityDate="2014-03-20T16:29:32.103" Title="Histogram evaluation for image quality concerning illumination" Tags="|algorithms|image-processing|camera|histogram|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11432" PostTypeId="1" AcceptedAnswerId="11444" CreationDate="2013-11-02T16:30:49.337" Score="1" ViewCount="1544" Body="&lt;p&gt;I have been working on a Harmonic Product Spectrum Algorithm. Now, all the literature I've read about the subject tells me to downsample an N amount of times. How does one determine what this N value should be? Here is my implementation of Harmonic Product Spectrum so far. Feel free to tell me if I have gone wrong somewhere.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private int HarmonicProductSpectrum(Complex[] fftData, int n){&#xA;    Complex[][] data = new Complex[n][fftData.length/n];&#xA;    for(int i = 0; i&amp;lt;n; i++){&#xA;        for(int j = 0; j&amp;lt;data[0].length; j++){&#xA;            data[i][j] = fftData[j*(i+1)];&#xA;        }&#xA;    }&#xA;    Complex[] result = new Complex[fftData.length/n];//Combines the arrays&#xA;    for(int i = 0; i&amp;lt;result.length; i++){&#xA;        Complex tmp = new Complex(1,0);&#xA;        for(int j = 0; j&amp;lt;n; j++){//multiplies arrays together&#xA;            tmp = tmp.times(data[j][i]);&#xA;        }&#xA;        result[i] = tmp;&#xA;    }&#xA;    //Calculates Maximum Magnitude of the array&#xA;    double max = Double.MIN_VALUE;&#xA;    int index = -1;&#xA;    for(int i = 0; i&amp;lt;result.length; i++){&#xA;        Complex c = result[i];&#xA;        double tmp = c.getMagnitude();&#xA;        if(tmp&amp;gt;max){&#xA;            max = tmp;;&#xA;            index = i;&#xA;        }&#xA;    }&#xA;    return index*getFFTBinSize(fftData.length);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5485" LastActivityDate="2013-11-03T12:53:47.357" Title="How does one know how many times to downsample in Harmonic Product Spectrum?" Tags="|fft|frequency|signal-analysis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11433" PostTypeId="1" CreationDate="2013-11-02T18:31:13.617" Score="5" ViewCount="8993" Body="&lt;p&gt;I build application witch will be transform piano sound to musical notes. I found some pitch detection algorithms with implementations (mainly based on autocorrelation or fft), but chord recognition, of course is  not working. &#xA;What is best method for instrument as piano(both hands + chords)? &#xA;Is there any implementation of this problem?&lt;/p&gt;&#xA;" OwnerUserId="5857" LastActivityDate="2023-07-26T21:26:19.093" Title="Polyphonic detection/Mulit-pitch detection/Chord recognition" Tags="|signal-detection|pitch|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11434" PostTypeId="2" ParentId="11433" CreationDate="2013-11-02T22:39:29.153" Score="3" Body="&lt;p&gt;As @jan pointed out, you're probably asking for a little too much, especially if you're looking for a ready implementation. Doing a quick search on Google, I came across several papers that may be a helpful start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this paper called &lt;a href=&quot;http://www.docstoc.com/docs/30200926/Multi-pitch-Detection-Algorithm-Using-Constrained-Gaussian-Mixture&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-pitch Detection Algorithm Using Constrained Gaussian Mixture&lt;/a&gt;, the authors use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Expectation-maximization_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Expectation Maximization&lt;/a&gt; algorithm to solve a &lt;a href=&quot;https://en.wikipedia.org/wiki/Mixture_model#Gaussian_mixture_model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian Mixture Model&lt;/a&gt; to detect multiple tones. This is most likely not a very computationally efficient algorithm, since mixture models are normally &lt;a href=&quot;https://en.wikipedia.org/wiki/Analysis_of_algorithms#Evaluating_run-time_complexity&quot; rel=&quot;nofollow noreferrer&quot;&gt;very hard&lt;/a&gt; to solve, and have to be primarily done offline (no real-time version).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking for a moderately robust, but potentially fast algorithm, look at this &lt;a href=&quot;https://stackoverflow.com/a/9626849/573432&quot;&gt;Stack Overflow answer&lt;/a&gt;. The author recommends &lt;a href=&quot;http://en.wikipedia.org/wiki/Multiple_signal_classification&quot; rel=&quot;nofollow noreferrer&quot;&gt;MUSIC&lt;/a&gt; and &lt;a href=&quot;http://www.wiley.com/legacy/wileychi/molisch/supp/appendices/Chapter_8_Appendix.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;ESPRIT&lt;/a&gt; algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best thing to do is to give something a try and come back to us with specific DSP and algorithms questions and sites like &lt;a href=&quot;https://stackoverflow.com/&quot;&gt;Stack Overflow&lt;/a&gt; for specific implementation questions.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2013-11-02T22:39:29.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11435" PostTypeId="2" ParentId="11432" CreationDate="2013-11-02T23:18:30.997" Score="2" Body="&lt;p&gt;Take a look at &lt;a href=&quot;http://www.hjortgaard.net/projects/4/download&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; on page 4. It has a great graphical representation of the algorithm. I'll try to write up some pseudocode here that you can adapt to your language (looks like Java to me) as necessary.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* Harmonic Product spectrum PSEUDOCODE&#xA; * @param fftData Discrete Fourier transform of data&#xA; * @param N Number of times we downsample the spectrum to get HPS&#xA; */&#xA;int HPS( Complex[] fftData, int N )&#xA;{&#xA;    // Find magnitude of the FFT&#xA;    Real fullSpectrum[] = absOfComplex(fftData);&#xA;&#xA;    // Keep only the positive frequencies (DC to Nyquist)&#xA;    Real spectrum[] = discardNegativeFrequencies(fullSpectrum);&#xA;&#xA;    // Make a new array to store HPS&#xA;    Real hps[] = copyOf(spectrum);&#xA;&#xA;    // Perfrom HPS:&#xA;    // Go through each downsampling factor&#xA;    for (int downsamplingFactor = 1; downsamplingFactor &amp;lt;= N; downsamplingFactor++)&#xA;    {&#xA;        // Go through samples of the downsampled signal and compute HPS at this iteration&#xA;        for(int idx = 0; idx &amp;lt; spectrum.length()/downsamplingFactor; idx++)&#xA;        {&#xA;            hps[idx] *= spectrum[idx * downsamplingFactor];&#xA;        }&#xA;    }&#xA;&#xA;    return findIndexOfMax(hps);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This isn't bug-proof but it should get you started.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2013-11-02T23:56:10.710" LastActivityDate="2013-11-02T23:56:10.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11436" PostTypeId="2" ParentId="11422" CreationDate="2013-11-02T23:53:14.340" Score="1" Body="&lt;p&gt;The Wiener filter is, by definition &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) not adaptive and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) not FIR / AR. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You seem to want an adaptive FIR filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many variants of this: &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_mean_squares_filter&quot; rel=&quot;nofollow&quot;&gt;LMS&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_mean_squares_filter#Normalised_least_mean_squares_filter_.28NLMS.29&quot; rel=&quot;nofollow&quot;&gt;NLMS&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Recursive_least_squares&quot; rel=&quot;nofollow&quot;&gt;RLS&lt;/a&gt; (as you say), or the &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot; rel=&quot;nofollow&quot;&gt;Kalman filter&lt;/a&gt;. Choose your poison! :-) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;ALL of them are (generally) less computationally intensive that the Wiener filter.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-02T23:53:14.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11439" PostTypeId="2" ParentId="10737" CreationDate="2013-11-03T02:01:18.083" Score="6" Body="&lt;p&gt;Here are a few ideas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First convert from color to grayscale. It looks like you have fairly good contrast already. There are various methods to perform this conversion; choose the simplest at first: gray = (red + green + blue)/3. Quite often you don't need anything better than that. For some applications, using just the green color plane is sufficient.&lt;/li&gt;&#xA;&lt;li&gt;If you want the algorithm to operate on black text, but if some images have white or light text on a dark background, reverse the polarity of the grayscale image by swapping grayscale 255 for 0, 254 for 1, and so on until all images have black text on a light-color background. You'll need an algorithm to detect when this is necessary, OR you can run an algorithm on the original grayscale image and on the negative (reversed brightness) image and choose the better result. Keep in mind that the &quot;close&quot; morphological operation has a different meaning for light-on-dark text versus dark-on-light text.&lt;/li&gt;&#xA;&lt;li&gt;Investigate some adaptive thresholding methods. Using a global Otsu threshold can be problematic--if possible, you should first have some sort of method to detect regions that are likely to be license plates, and then threshold and binarize those regions only. Thresholding an entire image will likely cause trouble.&lt;/li&gt;&#xA;&lt;li&gt;Look into the Stroke Width Transform and improvements upon it. The SWT or equivalent can help either with segmentation, or with identifying likely license plate regions, or possibly even with providing edges useful for identification.&lt;/li&gt;&#xA;&lt;li&gt;Since in your region there are only a few color combinations, you might be able to create some method that would could a template for every possible color combination and then try to find a match at each of several image scales. The license plate might be 400 x 250 pixels, or 100 x 65 pixels, or whatever.&lt;/li&gt;&#xA;&lt;li&gt;For multiscale operations, consider holding an image pyramid in memory. In some cases you can perform an initial match in the smallest image of the pyramid and work your way down. With some modification you could create an image pyramid has a scaling factor of less than 2 from level to level. &lt;/li&gt;&#xA;&lt;li&gt;Pull the sample images into Photoshop or GIMP and play around with the filters. You may be surprised to find a filter that is helpful. &lt;/li&gt;&#xA;&lt;li&gt;Whenever possible, work on raw, uncompressed images rather than on JPEGs or other compressed images. &lt;/li&gt;&#xA;&lt;li&gt;You may not have much of a choice in hardware, but given the fuzzy look of your &quot;LEA 1956&quot; sample, it'd be nice to have more resolution (more pixels per image) and/or sharper optics and/or a raw image instead of a JPEG.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Try to generate the best possible images that you can with pre-processing before your SVM goes to work. Thresholding is often the weak link here. Thresholding and binarization is a common approach, but when you see how noisy a binary image can be you should think very hard whether that is the kind of image you actually want to process (no matter how many people may claim that this is the standard method and hence the best). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you're already starting with a framework and/or algorithms, I recommend doing a little background reading to gain an understanding of both human reading and the many approaches to OCR:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Character Recognition Systems&lt;/strong&gt; by Cheriet and others is a good reference (though a few years old now) of the various techniques for Optical Character Recognition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reading in the Brain&lt;/strong&gt; by Stanislas Dehaene gives a good high-level overview of human reading, and covers the range of scripts. It's a relatively fast read, and has references to academic works that are useful.&lt;/p&gt;&#xA;" OwnerUserId="742" LastActivityDate="2013-11-03T02:01:18.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11441" PostTypeId="1" CreationDate="2013-11-03T08:49:25.437" Score="2" ViewCount="2214" Body="&lt;p&gt;When I was studying spatial frequency and entropy, it occured to me that &quot;is there a relationship between entropy and frequency?&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, if we consider only horizontal line, the frequency of (a) is lower than (b).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, I think that magnitude of frequency is proportional to entropy. But Google said nothing. Am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each entropy is the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_a = -0.842\log_20.842 -0.157\log_20.157 = 0.209 + 0.419 = 0.628$$&#xA;$$H_b = -0.6\log_20.6 -0.4\log_20.4 = 0.442 + 0.529 = 0.971$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ngD1C.png&quot; alt=&quot;(a)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(a)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/14jMQ.png&quot; alt=&quot;(b)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(b)&lt;/p&gt;&#xA;" OwnerUserId="4367" LastActivityDate="2013-11-07T12:20:31.670" Title="What is relationship between entropy and frequency in image" Tags="|image-processing|frequency-domain|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11442" PostTypeId="1" CreationDate="2013-11-03T09:17:20.937" Score="1" ViewCount="77" Body="&lt;p&gt;I would like to do research on automatic music composition. At the lowest level , I would like to start from discrete frequency levels as states. Here I would like to know the mathematical tools I can use for this? I have heard of markov chains and chaos theory etc used in this purpose. But one professor recently told that graph theory will be helpful in automated music composition. Is it so? Can someone recommend me the books required for starting such a research.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2014-11-03T21:36:09.550" Title="What are the mathematical tools that I can employ for automatic music composition?" Tags="|music|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11443" PostTypeId="2" ParentId="11441" CreationDate="2013-11-03T12:15:44.460" Score="4" Body="&lt;p&gt;If I understand correctly, you are taking the entropy in the image from the distribution of black and white pixels. In image (a) you have 50% black, 50% white, so the entropy is 1 bit. In image (b) you have 85% black, 15% white, so the entropy is 0.6 bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you make another image (c) with black and white stripes equal in width to the black stripes in image (a), you will have 50% black, 50% white again, i.e. entropy 1. But the frequency will be less than image (a).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for this notion of entropy, the answer is: No, in general there is no relation between entropy and frequency in an arbitrary image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in real world images energy is more concentrated in low frequencies than in high frequencies. So if you define entropy in terms of the distribution of such images, you will find a relationship between frequency and entropy.&lt;/p&gt;&#xA;" OwnerUserId="5863" LastActivityDate="2013-11-03T12:15:44.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11444" PostTypeId="2" ParentId="11432" CreationDate="2013-11-03T12:53:47.357" Score="2" Body="&lt;p&gt;Depends on the pitch source spectrum, the lowest pitch possible, and the FFT length. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If N is too small, the algorithm might miss some higher harmonics that contain a significant fraction of a pitch spectrums energy.  So you need to know how many overtones might be important in your particular pitch source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if N is too large, multiple overtones of a single low pitch could end up in the same bin after downsampling the spectrum, confusing the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For very low pitches with extremely rich higher harmonics, these 2 constraints may overlap and thus indicate the need for a longer FFT window for HPS, or even the need for a completely different pitch estimation method.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-03T12:53:47.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11445" PostTypeId="1" AcceptedAnswerId="12610" CreationDate="2013-11-03T17:03:54.813" Score="1" ViewCount="11323" Body="&lt;p&gt;I want to remove the background from image. Let's say I have this background:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1GHmW.png&quot; alt=&quot;sample background image&quot;&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I put pen drive and tippex on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h65Pv.png&quot; alt=&quot;image with objects&quot;&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to remove the background image from second image? If so, then how can I do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the AForge.NET Framework.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to remove background like in &lt;a href=&quot;http://www.iaeng.org/IJCS/issues_v35/issue_3/IJCS_35_3_16.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this research paper&lt;/a&gt;. Is there any library for this kind of work?.&lt;/p&gt;&#xA;" OwnerUserId="5868" LastEditorUserId="5868" LastEditDate="2013-11-10T06:19:00.490" LastActivityDate="2013-11-11T19:38:25.907" Title="Remove background from image" Tags="|image-processing|video-processing|c#|background-subtraction|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11447" PostTypeId="2" ParentId="11348" CreationDate="2013-11-03T18:01:03.470" Score="2" Body="&lt;p&gt;The system model for the &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter%20Kalman%20filter&quot; rel=&quot;nofollow&quot;&gt;Kalman filter&lt;/a&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;x_k = F_k x_{k-1} + B_k u_{k-1} + w_k \\&#xA;z_k = H_k x_k + v_k&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system model for sequential linear MMSE estimation might be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;x_k = x_{k-1} \\&#xA;z_k = H_k x_k + v_k&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those are equivalent if $F_k$ is the identity, $B_k=0$ and $w_k=0$ and I believe the estimators turn out to be the same in that case. If $F_k$ is not the identity, or if either $B_k$ or $w_k$ are non-zero, then I see no immediate way to match sequential linear MMSE estimation to the Kalman filter system model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, let's consider the system equations for $k=1$, $k=2$ jointly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;z_1 = H_1 F_1 x_0 + F_1 B_1 u_0 + F_1 w_0 + v_1 \\&#xA;z_2 = H_2 F_2 (F_1 x_0 + B_1 u_0 + w_0) + F_2 B_2 u_1 + F_2 w_1 + v_2&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be stacked into one equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;z = A x_0 + \tilde{v} \,,&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $z$ is a column vector stacking $z_1$ and $z_2$. $A$ contains $H_1, F_1, H_2, F_2$, and $\tilde{v}$ contains $H_2, F_2, B_1, u_0, u_1, w_0, w_1, v_1, v_2$. Both the Kalman filter and the linear MMSE estimator can be applied to this linear model, and I would expect them to produce the same result. The Wikipedia article assumes that the error covariance for $\tilde{v}$ is zero, but we can trivially fix that by subtracting the error mean (which arises from the known inputs $u_0, u_1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we model the system with joint equations, rather than sequential, iterative equations, then linear MMSE estimation applies directly to the general model, and Kalman filtering gives no improvement for this more general problem.&lt;/p&gt;&#xA;" OwnerUserId="5863" LastEditorUserId="5863" LastEditDate="2013-11-03T20:24:52.023" LastActivityDate="2013-11-03T20:24:52.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11449" PostTypeId="1" CreationDate="2013-11-03T18:15:32.110" Score="1" ViewCount="301" Body="&lt;p&gt;I have a signal that I want to make it sound like a whisper. This is probably better than using a voice conversion system, but I was just want to do some experimenting before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking maybe try to reduce the frequency of the signal? Maybe downsampling? Does anyone have a idea how to get closer to a whisper/unvoiced signal from a voiced signal?&lt;/p&gt;&#xA;" OwnerUserId="5612" LastActivityDate="2013-11-03T18:15:32.110" Title="Reducing frequency of a signal" Tags="|matlab|frequency|speech-processing|downsampling|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11452" PostTypeId="1" AcceptedAnswerId="11455" CreationDate="2013-11-04T00:28:31.893" Score="10" ViewCount="1886" Body="&lt;p&gt;In continuous time it was possible;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;u(t){\longrightarrow} \boxed{\quad\textrm{system}\quad} {\longrightarrow} y(t)\implies&#xA;\delta(t)=\frac{du(t)}{dt}{\longrightarrow}\boxed{\quad\textrm{system}\quad}{\longrightarrow} \frac{dy(t)}{dt}=h(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the same apply for discrete time system i.e.&lt;br&gt;&#xA;$$&#xA;\delta[t]=\frac{du[t]}{dt} \quad\textrm{where:}\begin{cases} \delta[t] &amp;amp;\textrm{is the discrete time delta}\\&#xA;u[t] &amp;amp; \textrm{is the discrete time unit step function}\end{cases}&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to obtain the impulse response of a discrete system by just knowing the response of the discrete unit step?&lt;/p&gt;&#xA;" OwnerUserId="5590" LastEditorUserId="1629" LastEditDate="2016-08-06T18:37:07.607" LastActivityDate="2016-08-08T13:52:33.437" Title="Is there a way to obtain the impulse response of a discrete system by just knowing it's response to the discrete unit step function?" Tags="|discrete-signals|linear-systems|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11453" PostTypeId="2" ParentId="11452" CreationDate="2013-11-04T00:58:38.313" Score="6" Body="&lt;p&gt;Yes, this is equally true in the discrete systems case. The differentiation operation in this case is replaced to by first order difference. It don't think it has a universal symbol, but let's call it $D(\cdot)$. This operation is equivalent to filtering your signal with $y[n] = x[n] - x[n-1]$. Let's call this filter $d[n]$. I'm going to denote convolution that the $*$ symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's now apply what we know about convolution to this operator. We know that we obtain $u[n]$  with a running sum (discrete integrator) on $\delta[n]$. In fact, the system represented by $u[n]$ itself turns out to be this discrete integrator. Also note that these two operators are inverses of each other, and that specifically $u[n] * d[n] = \delta[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we know that convolution is commutative, that is&#xA;$$a[n]*b[n] = b[n]*a[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and associative, that is&#xA;$$\left(a[n] * b[n]\right) * c[n] = a[n] * \left(b[n] * c[n]\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &#xA;$$x[n] = \delta[n] * x[n] = u[n] * d[n] * x[n] = d[n] * u[n] * x[n] = d[n] * \left(u[n] * x[n]\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you can see that you can recover $x[n]$ from $\left(u[n] * x[n]\right)$ by applying the first order difference, just like in the continuous case.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-11-04T00:58:38.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11455" PostTypeId="2" ParentId="11452" CreationDate="2013-11-04T01:50:32.550" Score="7" Body="&lt;p&gt;A simpler version of Phonon's answer is as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that $y$ denotes the response of the system to the unit step function.&#xA;Then, as discussed in &lt;a href=&quot;https://dsp.stackexchange.com/a/6355/235&quot;&gt;this answer&lt;/a&gt;,&#xA;&lt;em&gt;in general,&lt;/em&gt; $y$ is the sum of &lt;em&gt;scaled&lt;/em&gt; and time-delayed copies of the impulse&#xA;response, and in this particular case, no scaling is required; only time&#xA;delays.  Thus,&#xA;$$\begin{align}&#xA;y[0] &amp;amp;= h[0]\\&#xA;y[1] &amp;amp;= h[1] + h[0]\\&#xA;y[2] &amp;amp;= h[2] + h[1] + h[0]\\&#xA;y[3] &amp;amp;= h[3] + h[2] + h[1] + h[0]\\&#xA;\vdots~ &amp;amp;= ~\vdots&#xA;\end{align}$$&#xA;where each column on the right is a (unscaled and) time-delayed &#xA;impulse response.&#xA;Thus, we easily get that&#xA;$$\begin{align}&#xA;h[0] &amp;amp;= y[0]\\&#xA;h[1] &amp;amp;= y[1]-y[0]\\&#xA;h[2] &amp;amp;= y[2]-y[1]\\&#xA;\vdots~ &amp;amp;= ~\vdots\\&#xA;h[n] &amp;amp;~= y[n] - y[n-1]\\&#xA;\vdots~ &amp;amp;= ~\vdots&#xA;\end{align}$$&#xA;with nary a mention of filters, inverses, convolutions, integration, operators&#xA;and the like, just simple consequences of&#xA;the definition of linear time-invariant system.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-11-04T13:42:42.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11458" PostTypeId="2" ParentId="10128" CreationDate="2013-11-04T06:19:03.057" Score="0" Body="&lt;p&gt;It turned out the problem had nothing to do with the shader. There was a problem with the way I was scaling the image data before it reached the shader. &lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2013-11-04T06:19:03.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11464" PostTypeId="1" CreationDate="2013-11-04T14:50:03.160" Score="1" ViewCount="164" Body="&lt;p&gt;Let $\Omega &amp;gt; 0$ and denote by $\mathcal{B}_\Omega$ the subspace of $L^2(\Bbb R)$ consisting of signals that are bandlimited to $(-\Omega, \Omega)$.  Denote $\mathcal{L}_{\Omega} : L^2(\Bbb R) \rightarrow L^2(\Bbb R)$ the ideal lowpass filter that projects signals $x \in L^2(\Bbb R)$ into $\mathcal{B}_\Omega$: i.e., $\mathcal{L}_\Omega$ takes $x$ to the signal $y$ with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\hat{y} =\begin{cases}&#xA;    \hat{x} &amp;amp; \text{for } |\omega| &amp;lt; \Omega\\&#xA;    0 &amp;amp; \text{otherwise}&#xA;  \end{cases}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A function $\gamma: \Bbb R \rightarrow \Bbb R$ is monotone increasing if $\gamma (t_2) &amp;gt; \gamma (t_1)$.  The companding of a signal $x: \Bbb R \rightarrow \Bbb R$ by $\gamma$ is the signal $[\gamma \circ  x](t) = \gamma(x(t))$.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Denote $u(t) = sinc(2\Omega t)$.  Find an explicit expression of $\mathcal{L}_\Omega (u)(t)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $x \in \mathcal{B}_\Omega$ and $\gamma$ is monotone increasing, then $\gamma \circ x$ is generally not bandlimited.  In particular, $\mathcal{L}_\Omega (\gamma \circ x) \neq \gamma \circ x$.  Suppose $x_1, x_2 \in \mathcal{B}_\Omega$ and $\mathcal{L}_\Omega (\gamma \circ x_1) = (\gamma \circ x_2)$.  Show that $x_1 = x_2$ almost everywhere on $\Bbb R$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Attempt/Input&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first part,  since the sinc function is a low pass filter in the time domain, are they essentially just asking for its corresponding rectangular function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the second part, I know I start with the integral of the product of $(x_1 - x_2)$ with $(\gamma \circ x_1 - \gamma \circ x_2)$ but not sure how to go about it.  &lt;/p&gt;&#xA;" OwnerUserId="5858" LastEditorUserId="5858" LastEditDate="2013-11-04T15:47:43.403" LastActivityDate="2013-11-04T15:47:43.403" Title="Recovery of Bandlimited Signals after Companding and Low Pass Filter" Tags="|filters|lowpass-filter|math|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11466" PostTypeId="1" AcceptedAnswerId="11486" CreationDate="2013-11-04T17:23:16.717" Score="8" ViewCount="14484" Body="&lt;p&gt;I'm trying to port some MATLAB code to Python and am running into some strange behaviour. I am implementing a 5th order Butterworth bandpass filter. The sampling rate is 30 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running MATLAB R2012b, Spyder 2.2.0 with Python 2.7, SciPy 0.12.0 on Windows 7 x64.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = butter(5, [0.75*2/30, 5.0*2/30], 'bandpass');&#xA;y = filtfilt(b, a, input_signal)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the raw signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jswao.jpg&quot; alt=&quot;raw signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the filtered signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z41kv.jpg&quot; alt=&quot;MATLAB filtered signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its power spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JlmoD.jpg&quot; alt=&quot;MATLAB power spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which makes sense since the normalized bandpass frequencies are 0.05 - 0.33.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found before that SciPy's butter function does not give the same coefficients as MATLAB so I exported the filter coefficients from MATLAB to Python using hdf5write (see here: &lt;a href=&quot;https://stackoverflow.com/questions/7117797/export-matlab-variable-to-text-for-python-usage&quot;&gt;https://stackoverflow.com/questions/7117797/export-matlab-variable-to-text-for-python-usage&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Python:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = signal.filtfilt(b, a, input_signal, padtype = None)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the output is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gqXUw.png&quot; alt=&quot;Python filtered signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its power spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3gkim.jpg&quot; alt=&quot;Python power spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used padtype = None because by default it is padtype = 'odd'. However, I've tried all the different padding options and they all look more or less the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not entirely sure what's going wrong...any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Added graph for padtype = &quot;odd&quot; and b and a filter coefficients used&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal with padtype = &quot;odd&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4uz8Q.png&quot; alt=&quot;padtype = odd signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like there is some underlying signal so I don't think it's the impulse response although that large transient at the beginning is strange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Python filter coefficients (5th order Butterworth filter):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;passband = [0.75*2/30, 5.0*2/30]&#xA;b, a = scipy.signal.butter(5, passband, 'bandpass')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;b, a are arrays of type float64.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = array([  5.49209388e-03,   0.00000000e+00,  -2.74604694e-02,&#xA;    -1.97776791e-17,   5.49209388e-02,   2.47220989e-17,&#xA;    -5.49209388e-02,  -1.97776791e-17,   2.74604694e-02,&#xA;     0.00000000e+00,  -5.49209388e-03])&#xA;a = array([  1.        ,  -6.52098852,  19.50384534, -35.47189804,&#xA;    43.65758795, -38.07760914,  23.83047021, -10.55670367,&#xA;     3.16710078,  -0.58122912,   0.04945954])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MATLAB filter coefficients&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b =   0.0055, 0, -0.0275, 0, 0.0549, 0, -0.0549, 0, 0.0275, 0, -0.0055&#xA;a =   1.0000, -6.5210, 19.5038, -35.4719, 43.6576, -38.0776, 23.8305, &#xA;      -10.5567, 3.1671, -0.5812, 0.0495&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Turns out the coefficients are about the same, I believe the issues I had before were due to the frequency being much higher (coefficients must be generated differently in MATLAB and Python).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input signal is a list of float32, although I've tried converting to array with numpy.array and the result is the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; More information about padtypes and Python vs. MATLAB&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Python SciPy's filtfilt function includes a parameter called padtype which indicates the type of padding extended on both sides of the signal. This padding serves to reduce transients. Odd and even are descriptors of the type of symmetry these extensions have with the endpoints (&lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some illustrations of the difference in padtypes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;padtype = &quot;even&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/35akl.png&quot; alt=&quot;even padding&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;padtype = &quot;odd&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HV1Lz.png&quot; alt=&quot;odd padding&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;padtype = None&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OwVBF.png&quot; alt=&quot;no padding&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the results, it appears that MATLAB uses odd padding (which is also the default for Python):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kpEhp.jpg&quot; alt=&quot;MATLAB&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5873" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2022-01-08T13:18:17.213" Title="Differences between Python and MATLAB filtfilt function" Tags="|matlab|filters|python|" AnswerCount="4" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="11467" PostTypeId="1" CreationDate="2013-11-04T20:23:02.980" Score="11" ViewCount="23103" Body="&lt;p&gt;I tried to apply a Gabor filter with a specific scale (according to my values of lambda and sigma, so it is (&lt;strong&gt;7x7&lt;/strong&gt;) and for &lt;strong&gt;4 orientations&lt;/strong&gt; (0, $\frac{\pi}{4}$, $\frac{\pi}{2}$ and $\frac{3\pi}{4}$) to a input gray scale image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my code, three steps are achieved:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a Gabor Filter &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Read an RGB image, then convert it to gray scale and finaly to double.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply the created gabor to the input image (&lt;strong&gt;here, i am not sure if my code is true, that's why i need your opinion&lt;/strong&gt; )&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;1) -------------- create the Gabor filter (size=7x7 and 4 orientations)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%define the five parameters&#xA;theta=....; %either 0 or pi/4 or pi/2 or 3pi/4&#xA;lambda=3.5;&#xA;gamma=0.3;&#xA;sigma=2.8;&#xA;psi=0;&#xA;&#xA;sigma_x = sigma;&#xA;sigma_y = sigma/gamma;&#xA;&#xA;nstds = 5;&#xA;xmax = max(abs(nstds*sigma_x*cos(theta)),abs(nstds*sigma_y*sin(theta)));&#xA;xmax = ceil(max(1,xmax));&#xA;ymax = max(abs(nstds*sigma_x*sin(theta)),abs(nstds*sigma_y*cos(theta)));&#xA;ymax = ceil(max(1,ymax));&#xA;xmin = -xmax; ymin = -ymax;&#xA;[x,y] = meshgrid(xmin:xmax,ymin:ymax);&#xA;&#xA;x_theta=x*cos(theta)+y*sin(theta);&#xA;y_theta=-x*sin(theta)+y*cos(theta);&#xA;&#xA;gb= exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi);&#xA;&#xA;figure(2);&#xA;imshow(gb);&#xA;title('theta=...');&#xA;%imagesc(gb);&#xA;%colormap(gray);&#xA;%title('theta=...');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3IOLs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;2)------------Read the input image&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I=imread('piano.jpg');&#xA;image_resize=imresize(I, [160,160]);&#xA;image_gray=rgb2gray(image_resize);&#xA;image_double=im2double(image_gray);&#xA;figure(1);&#xA;imshow(image_double);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2EKtp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;3) -----apply the created above gabor to the input image (recall that i am not sure if the code in this step is 100% true, that's why i need your opinion and your help if you have the correct answer.)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure(3);&#xA;filtered = conv2(image_double,gb);&#xA;imagesc(filtered);&#xA;colormap(gray);&#xA;title('theta=....');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KOWMI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5287" LastEditorUserId="17817" LastEditDate="2016-02-12T22:47:42.160" LastActivityDate="2020-11-13T04:14:30.653" Title="Apply a Gabor filter to an input image" Tags="|image-processing|matlab|filters|convolution|object-recognition|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11468" PostTypeId="1" AcceptedAnswerId="11469" CreationDate="2013-11-04T21:05:07.573" Score="1" ViewCount="490" Body="&lt;p&gt;Suppose you have N samples of a sinusoid of frequency $f_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = A\sin[2\pi (f_0/f_s)n ]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you take an M-point FFT (where M may be greater than N) of your N samples of x. What will the amplitude of the peak of the spectrum be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;http://www.designnews.com/author.asp?section_id=1419&amp;amp;doc_id=236273&amp;amp;print=yes&quot; rel=&quot;nofollow&quot;&gt;http://www.designnews.com/author.asp?section_id=1419&amp;amp;doc_id=236273&amp;amp;print=yes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2013-11-05T19:34:27.483" LastActivityDate="2013-11-05T19:34:27.483" Title="M-point FFT Amplitude of N-samples of a sinusoid" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11469" PostTypeId="2" ParentId="11468" CreationDate="2013-11-04T22:08:02.387" Score="6" Body="&lt;p&gt;In general the FFT of a sinusoid function is NOT a delta function. The FFT's maximum will be around the sine frequency but the exact value will be dependent on how well the frequency of the sine lines up with the FFT grid and there will be non-zero values for most other frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only get a delta function if the sine frequency is an integer multiple of your FFT bin spacing (= sample rate divided by FFT length). In this case the amplitude will N/2 (for conventional FFT scaling) for both the positive and the negative bin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your FFT length is shorter than the sine wave you have to truncate and the above considerations apply. If the FFT length is longer, you will probably zero pad. This will often result in substantial increase of the energy at the &quot;other&quot; frequencies and the effects depend heavily on the details of the zero padding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all cases Parseval's Theorem holds: total energy in the time domain equals total energy in the frequency domain. That's how you can derive an amplitude of N/2 for the special case that the sine wave frequency falls on an FFT bin: A sine wave of amplitude 1 has an RMS value of sqrt(.5). A buffer of N samples has a total energy of sqrt(.5)*N. This is the total energy. In the frequency domain this gets split between the bins at +f and at -f. Each bin receives have of the total energy which is sqrt(.5)*sqrt(.5)*N = N/2.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-04T22:08:02.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11471" PostTypeId="1" AcceptedAnswerId="11473" CreationDate="2013-11-05T04:17:57.787" Score="3" ViewCount="2805" Body="&lt;p&gt;I've recently come across &lt;a href=&quot;https://www.youtube.com/watch?v=Wu5zd5fCaPA&quot; rel=&quot;nofollow&quot;&gt;this YouTube video&lt;/a&gt; that shows a PCM stream being played back via the 1-bit internal &quot;PC Speaker&quot;, and after hours of googling I've come to think this is done via Sigma-Delta modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, what I gather from the process is that it takes the original digital signal, oversamples and approximates it via PWM while applying a low-pass filter to the 1-bit output. I'm not quite sure if this is right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not having a background in DSP, I'm wondering:&lt;br&gt;&#xA;How could this process be implemented in software?&lt;/p&gt;&#xA;" OwnerUserId="5877" LastEditorUserId="21075" LastEditDate="2020-05-01T13:10:20.213" LastActivityDate="2020-11-27T18:36:40.507" Title="How would sigma-delta modulation work in software?" Tags="|audio|modulation|software-implementation|delta-sigma|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11472" PostTypeId="1" AcceptedAnswerId="11474" CreationDate="2013-11-05T07:05:29.113" Score="1" ViewCount="853" Body="&lt;p&gt;I want to create a microphone array that can be connected to my laptop. Previous discussions in stack exchange and other forums suggested me to get a USB audio interface. I would want to do a lot of real time signal processing on the sound arriving at the microphones (To be precise, I want to calculate the time delay of arrival of sound at the different microphones). But from what I saw, the audio interfaces are a bit expensive. But external sound cards are not! Here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ebay.com/bhp/external-sound-card-for-laptop&quot; rel=&quot;nofollow&quot;&gt;http://www.ebay.com/bhp/external-sound-card-for-laptop&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I use an external sound card to receive input from multiple microphone (create an array, that is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will require 4 mics, but right now I need to do it with only 2 mics to test the algorithms. Sampling rate would be around 40Khz.&lt;/p&gt;&#xA;" OwnerUserId="5116" LastEditorUserId="5116" LastEditDate="2013-11-18T06:40:17.257" LastActivityDate="2013-11-20T00:50:03.817" Title="Audio interface or External sound card?" Tags="|sound|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11473" PostTypeId="2" ParentId="11471" CreationDate="2013-11-05T09:54:25.280" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Upsample the signal to desired frequency. You can use linear interpolation (poor quality but simple and fast) or sinc interpolation (good quality but slow). For example of library dedicated to good quality resampling, see libsoxr: &lt;a href=&quot;http://sourceforge.net/p/soxr/wiki/Home/&quot; rel=&quot;nofollow&quot;&gt;http://sourceforge.net/p/soxr/wiki/Home/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform dithering with noise shaping. You need to filter the dithering signal to minimize noise within 0-20000 Hz range while increasing it in ultrasonic range. For details on noise shaping, see this excellent document: &lt;a href=&quot;http://www.beis.de/Elektronik/DeltaSigma/DeltaSigma.html&quot; rel=&quot;nofollow&quot;&gt;http://www.beis.de/Elektronik/DeltaSigma/DeltaSigma.html&lt;/a&gt; especially Figure 9 which shows adding noise in feedback loop.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's how delta-sigma DACs work and this can certainly be implemented in software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PWM would require upsampling 65536× for 16-bit audio so it isn't used. PDM (Pulse Density Modulation) is used instead and is essentially the same as delta-sigma modulation. And it requires only 64× upsampling for Hi-Fi audio.&lt;/p&gt;&#xA;" OwnerUserId="5879" LastActivityDate="2013-11-05T09:54:25.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11474" PostTypeId="2" ParentId="11472" CreationDate="2013-11-05T10:26:44.987" Score="1" Body="&lt;p&gt;Sound card == audio interface&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference is that the name &quot;audio interface&quot; is usually used for pro audio equipment. On the other hand, &quot;sound card&quot; usually refers to consumer audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently there are no cheap multi-input audio interfaces. You may want to check out second hand market, but even there USB and 1394 interfaces are expensive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only cheap solution that comes to my mind is to use multiple stereo-input interfaces and synchronize theirs clocks using SPDIF. Then you can link them on Linux (in asoundrc) or Mac OS. I don't know if it's possible on Windows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have never tried synchronizing clocks using SPDIF myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without synchronizing clocks you need to use resampling which is computationally expensive and can degrade quality. alsa_in and alsa_out tools for Linux/JACK can do this. But they're usable only if you don't need accurate timing as they don't do latency compensation.&lt;/p&gt;&#xA;" OwnerUserId="5879" LastActivityDate="2013-11-05T10:26:44.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11475" PostTypeId="1" CreationDate="2013-11-05T10:29:17.177" Score="0" ViewCount="146" Body="&lt;p&gt;Suppose,I have an input of length of lenght 100. data=[x0...x99];&#xA;I take a window of lenght 11 from x0 to x10.&#xA;windowed data=[x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10], &#xA;now, I compute 7 wiener coefficients which are &#xA;[w0 w1 w2 w3 w4 w5 w6];&#xA;next I will move by window one sample forward, &#xA;new windowed data= [x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11],&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question how can I use the previously calculated wiener coefficients to calculate the new wiener coefficients for the new windowed data? Also I want this to be done in the shortest possible time.&lt;/p&gt;&#xA;" OwnerUserId="5880" LastEditorUserId="3546" LastEditDate="2013-11-06T01:35:26.507" LastActivityDate="2013-11-06T01:35:26.507" Title="Adaptive calculations of Wiener filter coefficients" Tags="|filters|linear-prediction|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11476" PostTypeId="1" AcceptedAnswerId="11480" CreationDate="2013-11-05T10:45:43.820" Score="0" ViewCount="406" Body="&lt;p&gt;We can capture frequency response, phase response and reverb in recording of impulse response. Then we can use it to simulate audio system and/or space by convolving it with dry audio signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there similar technique for measuring and simulating non-linear distortion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of measuring how the amplitude of output signal corresponds to amplitude of input signal. Then I could simulate this system by waveshaping. Will it work? Is there any better method?&lt;/p&gt;&#xA;" OwnerUserId="5879" LastEditorUserId="5879" LastEditDate="2013-11-05T15:54:32.230" LastActivityDate="2013-11-05T15:54:32.230" Title="Measure and simulate non-linear distortion" Tags="|audio|discrete-signals|sound|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11477" PostTypeId="2" ParentId="11472" CreationDate="2013-11-05T12:08:14.140" Score="1" Body="&lt;p&gt;You can get pretty good and cheap multi-channel audio interfaces from the home-recording industry. Check out websites like sweetwater.com, musiciansfriend.com, zzounds.com etc. (no endorsement or product placement implied). Many of those come with low-latency ASIO drivers and you can integrate them with audio recording and processing software like VST, ProTools etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One step up from there are semi-pro setups like RME (&lt;a href=&quot;http://www.rme-audio.de/en_index.php&quot; rel=&quot;nofollow&quot;&gt;http://www.rme-audio.de/en_index.php&lt;/a&gt;) which have many different high quality interfaces and programming platforms. (again: not an endorsement).&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-05T12:08:14.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11478" PostTypeId="2" ParentId="11476" CreationDate="2013-11-05T12:12:02.700" Score="1" Body="&lt;p&gt;Modelling non-linear systems is VERY complicated since the whole concept of impulse response and transfer function doesn't apply any more. Typically it requires very detailed models of the actual non-linearity. Examples for non-linear transducer modeling are &lt;a href=&quot;http://www.klippel.de/&quot; rel=&quot;nofollow&quot;&gt;http://www.klippel.de/&lt;/a&gt; and for non-linear amp/speaker modeling are &lt;a href=&quot;http://www.line6.com&quot; rel=&quot;nofollow&quot;&gt;http://www.line6.com&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-05T12:12:02.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11479" PostTypeId="2" ParentId="11467" CreationDate="2013-11-05T12:15:33.440" Score="0" Body="&lt;p&gt;Your code is correct. You simply need to do the 2-D convolution with the filter kernel which you are doing very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good Luck&lt;/p&gt;&#xA;" OwnerUserId="3566" LastActivityDate="2013-11-05T12:15:33.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11480" PostTypeId="2" ParentId="11476" CreationDate="2013-11-05T12:20:51.953" Score="6" Body="&lt;p&gt;Nonlinear systems are very hard to classify and there's no unified theory like for linear systems. In general, you cannot measure/identify non-linear systems in finite time. There are  some specific classes of nonlinear systems which allow for identification or at least approximation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You already named a trivial one: The memoryless nonlinear system. In this case you can learn the nonlinear transfer function (i.e. your waveshaping function) by just looking at the map from input to output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any interesting real system does have memory however, and there we can start with a specific model for the system and adapt the parameters until the model output and the real output match. There are nonlinear optimization techniques that will help to find the proper set of parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know little about the internals of the system you want to simulate, then you can use a generic model. The most popular such model is described by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Volterra_series&quot;&gt;Volterra series&lt;/a&gt; and requires that the system is expandable in a series similar to the taylor series but involving convolution terms and that this series converges quickly enough (and in the entire domain you're interested in) to be practically useful. The theory of Volterra kernels delivers the mathematical tool to find the series expansion from input/output observations without the need for non-deterministic optimization techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So summing up, your best chance to really capture the behavior of a nonlinear system is to understand the system in detail and model its components. The black box approach is very difficult and only works under very specific conditions.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-11-05T12:20:51.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11481" PostTypeId="2" ParentId="11441" CreationDate="2013-11-05T12:41:39.077" Score="1" Body="&lt;p&gt;&lt;strong&gt;Spatial Frequency&lt;/strong&gt;  in an image can be looked at from two perspectives :-&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Global&lt;/strong&gt; :- This comes through the notion of Fourier Transform which gives a global description of the frequency content of an image.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Local&lt;/strong&gt; :- This comes through the idea of &lt;strong&gt;&lt;em&gt;Time-Frequency Analysis&lt;/em&gt;&lt;/strong&gt; which aims at giving a local description of the frequency content of an image.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you talk about the global frequency content and global entropy, then there exists no relationship between them (&lt;strong&gt;&lt;em&gt;this is the best we know as of yet&lt;/em&gt;&lt;/strong&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you talk about the local frequency content, then a relationship can be observed. Infact this relationship turns out to be exactly the one you are alluding to:-&lt;br&gt;&#xA;         &lt;strong&gt;Frequency Content $\varpropto$ Entropy&lt;/strong&gt; (&lt;strong&gt;Local Of Course!!!)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very simple explanation to this is the following :-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entropy is proportional to disturbance. Greater the variations in a local path of an image, greater will be the frequency content of that patch (&lt;strong&gt;&lt;em&gt;follows easily from the definition of frequency)&lt;/em&gt;&lt;/strong&gt; . In exactly the same way the entropy of the patch would also be higher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a smooth region of an image where there is absolutely no imaging variations, entropy will be $0$ and so will be the frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this answers your question.&lt;/p&gt;&#xA;" OwnerUserId="3566" LastEditorUserId="3566" LastEditDate="2013-11-07T12:20:31.670" LastActivityDate="2013-11-07T12:20:31.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11482" PostTypeId="2" ParentId="11430" CreationDate="2013-11-05T12:51:47.183" Score="1" Body="&lt;p&gt;I understand that what you are looking for is a contrast measure. Since, I am not sure as to which different research papers you have looked at, I am giving here links to some important and good papers in this area. Refer to them. If you are unable to make sense of them, reply back, and I would try my best to help &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S1047320312000211#&quot; rel=&quot;nofollow&quot;&gt;Measuring pereptual contrast in color images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.eri.harvard.edu/faculty/peli/papers/Haun_SID_2011.pdf&quot; rel=&quot;nofollow&quot;&gt;Measuring the perceived contrast of natural images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="3566" LastActivityDate="2013-11-05T12:51:47.183" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11483" PostTypeId="1" CreationDate="2013-11-05T13:19:09.533" Score="4" ViewCount="3998" Body="&lt;p&gt;I am new to signal processing, and was reading about filters. I came upon the Sobel filter which has the following forms,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\textbf{G}_x = \begin{bmatrix}+1 &amp;amp; 0 &amp;amp; -1\\+2 &amp;amp; 0 &amp;amp; -2\\+1 &amp;amp; 0 &amp;amp; -1&#xA;\end{bmatrix} * \textbf{A}$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$\textbf{G}_y = \begin{bmatrix}+1 &amp;amp; +2 &amp;amp; +1\\0 &amp;amp; 0 &amp;amp; 0\\-1 &amp;amp; -2 &amp;amp; -1&#xA;\end{bmatrix} * \textbf{A}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From what I understand to apply this filter to a 2-d signal, place the filter's center on the correct point and multiply the coefficients with the signal at the points of overlap and add them together. So for the following example signal, applying the horizontal sobel filter from above would give:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Signal                 Output (edges are left alone)&#xA;|100|100|100|100|      |100| 100| 100|100|&#xA;| 10| 10| 10| 10|      | 10| 360| 360| 10|&#xA;| 10| 10| 10| 10|      | 10|-360|-360| 10|&#xA;|100|100|100|100|      |100| 100| 100|100|&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Separable filters are more computationally efficient and the Sobel filter is one of them. My problem is I can't figure out how the separable filter is applied. So, what I want to ask is how would the Sobel filter be applied separably?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}1 &amp;amp; 2 &amp;amp; 1\\0 &amp;amp; 0 &amp;amp; 0\\-1 &amp;amp; -2 &amp;amp; -1\end{bmatrix} =&#xA;\begin{bmatrix}1\\0\\-1\end{bmatrix}\begin{bmatrix}1 &amp;amp; 2 &amp;amp; 1\end{bmatrix} =&#xA;\begin{bmatrix}1\\1\end{bmatrix} * \begin{bmatrix}1\\-1\end{bmatrix} \begin{bmatrix}1 &amp;amp; 1\end{bmatrix} * \begin{bmatrix}1 &amp;amp; 1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5579" LastEditorUserId="7092" LastEditDate="2023-02-10T13:21:55.997" LastActivityDate="2023-02-10T13:21:55.997" Title="How Does a Separable Filter Work?" Tags="|image-processing|filters|separability|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11484" PostTypeId="2" ParentId="11483" CreationDate="2013-11-05T14:25:53.957" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://blogs.mathworks.com/steve/2006/10/04/separable-convolution/&quot; rel=&quot;noreferrer&quot;&gt;Steve Eddins has a nice page that explains it.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It comes down to being able to do a separate 1-D filters in each direction (requiring $MN(P + Q)$ multiplies and adds), rather than a single 2-D convolution ($MNPQ$ multiplies and adds).  Here the image is assumed to be $M \times N$ and the convolution kernel $P \times Q$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this assumes you're doing everything in the time domain, and not using FFTs.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-05T14:25:53.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11485" PostTypeId="1" CreationDate="2013-11-05T15:54:41.870" Score="0" ViewCount="132" Body="&lt;p&gt;I have a program which takes in data from an oscilloscope, and due to reflections in the medium, we will get random signals at random intervals. The two grey windows at the right bottom show the original data (below red line), and after FFT forward and backward (above red line). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data set is originally 10,000 points, so the FFT has 20000 doubles stored. You can see in the command shell that the backwards FFT uses 19000 of those 20000 values. My issue is at the green rectangle I get waves before and after the real signal, which means I can hardly denoise it due to the signal itself being a rather sharp and high frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would I first find and extract the areas where the signal itself is present, and then run the FFT on that subset, or how would I go with denoising such an area?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The noise itself is not visible, since the 10k data points are scaled to 500 pixel, but its random electric noise coming from the oscilloscope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link to the image in big: &lt;a href=&quot;https://i.stack.imgur.com/pQ7Qu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/pQ7Qu.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other two images show the similar data being captured, once being averaged 128 times, one a single set. I need to find a way to denoise the single capture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XUIgb.png&quot; alt=&quot;Dataset and current settings&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rzlqe.jpg&quot; alt=&quot;Data non-average&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FDrHk.jpg&quot; alt=&quot;Data averaged&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1269" LastEditorUserId="1269" LastEditDate="2013-11-06T14:38:32.837" LastActivityDate="2013-11-06T14:38:32.837" Title="Denoise a randomly occuring signal" Tags="|fft|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11486" PostTypeId="2" ParentId="11466" CreationDate="2013-11-05T16:09:01.413" Score="3" Body="&lt;p&gt;It works for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy.io import loadmat&#xA;from scipy.signal import butter, filtfilt&#xA;from matplotlib.pyplot import plot&#xA;&#xA;signaldata = loadmat('signaldata.mat')&#xA;&#xA;input_signal = signaldata['input_signal'][0]&#xA;&#xA;passband = [0.75*2/30, 5.0*2/30]&#xA;b, a = butter(5, passband, 'bandpass')&#xA;&#xA;y = filtfilt(b, a, input_signal)&#xA;plot(y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ItUv3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what your issue is but maybe you can figure it out from here.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2013-11-05T16:21:22.257" LastActivityDate="2013-11-05T16:21:22.257" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11487" PostTypeId="1" AcceptedAnswerId="11493" CreationDate="2013-11-05T16:30:38.243" Score="5" ViewCount="5190" Body="&lt;p&gt;I don't quite understand why the textbooks say it is impossible to implement an ideal low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I was to take the FFT of a discrete signal x[n], with Matlab's fft function I'd be returned with a complex sequence X[n] which represents the magnitude of each frequency from 0 to n/2 and is repeated. If I was to then say simply make all the lower frequency bins equal to zero and keep the remaining the same aren't I applying an ideal low pass filter. I am excluding all the frequencies I don't want and keeping the ones I do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example say I have the signal below&lt;img src=&quot;https://i.stack.imgur.com/eMdiz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the fft, with the lower frequencies towards the ends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JatJV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pFTvg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I selectively remove the bins I do not want and keep the ones I do, note I don't actually have Matlab all the images are from a html page.&lt;/p&gt;&#xA;" OwnerUserId="4360" LastEditorUserId="4360" LastEditDate="2013-11-05T16:39:24.560" LastActivityDate="2017-05-31T07:54:12.823" Title="Removing values from FFT result same as filtering?" Tags="|fft|discrete-signals|fourier-transform|lowpass-filter|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11488" PostTypeId="2" ParentId="11487" CreationDate="2013-11-05T16:52:38.693" Score="3" Body="&lt;p&gt;Every FFT has only limited frequency resolution. An ideal lowpass filter requires an FFT of infinite length. Along the same lines: the impulse response of an ideal lowpass filters is a sin(x)/x function which is also infinitely long in time.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-05T16:52:38.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11490" PostTypeId="1" AcceptedAnswerId="11501" CreationDate="2013-11-05T17:27:32.767" Score="0" ViewCount="736" Body="&lt;p&gt;Suppose you have N samples of a sine wave of frequency $f_0$ sampled at $f_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = A\sin[2\pi(f_0 /f_s)n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How do you get a delta function in the frequency domain (i.e. all of the energy is in the center one bin of the FFT)?&lt;/li&gt;&#xA;&lt;li&gt;Does the number of samples (N) need to be a prime number of cycles of $f_0$? If so, why?&lt;/li&gt;&#xA;&lt;li&gt;Does $f_s$ need to be an integer multiple of $f_0$? If so, why?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2013-11-05T19:37:21.387" LastActivityDate="2013-11-06T11:58:52.870" Title="FFT of a periodic function" Tags="|fft|frequency-spectrum|" AnswerCount="3" CommentCount="2" ClosedDate="2015-05-05T01:44:06.797" ContentLicense="CC BY-SA 3.0" />
  <row Id="11491" PostTypeId="2" ParentId="11490" CreationDate="2013-11-05T18:45:10.593" Score="0" Body="&lt;p&gt;In reverse order,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes the sampling frequency needs to be a multiple of $f_0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The number of &lt;em&gt;cycles&lt;/em&gt; of the sinusoid in $N$ samples needs to be an&#xA;integer, not necessarily a prime number.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you do 3. and 2., all the energy will be concentrated in two bins&#xA;(corresponding to $100$ Hz and $-100$ Hz. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Be careful, though. If you have a sinusoid $x(t)=\sin(2\pi (100) t)$ at 100 Hz&#xA;and you sample it at 1000 Hz, you will have $10$ samples per cycle of the&#xA;waveform. With $x[0] = 0$ and $x[9] \neq 0$, you can do an &quot;FFT&quot;&#xA;of length $10$ if you like, and all the energy will be in $X[1]$ and $X[9]$.&#xA;I put FFT in quotation marks because at such short lengths, a plain&#xA;vanilla brute-force DFT calculation might be almost as fast. Note also&#xA;that $x[10] = 0$ is &lt;strong&gt;not&lt;/strong&gt; part of the DFT calculation.&#xA;Alternatively, you can use $N = 10n$ samples and do an FFT of length $1000$  (say) on samples $x[0]$ through $x[999]$.  In this case, the &#xA;energy will all be in $X[10]$ and $X[1014]$.&#xA;Regardless of what some other answers will likely tell you,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;DO NOT zero-pad the length $1000$ FFT to length $1024$ to get an&#xA;  &quot;efficient&quot; implementation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you do follow the advice on zero-padding, your length-$1024$ FFT&#xA;will NOT have the energy concentrated in two bins as you desire.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-11-05T18:45:10.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11492" PostTypeId="2" ParentId="11487" CreationDate="2013-11-05T18:52:49.677" Score="7" Body="&lt;p&gt;&lt;em&gt;Is removing values from FFT result same as filtering?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Yes&lt;/strong&gt;, as one would expect intuitively. Taking the FFT of a signal will give you a frequency domain interpretation of the signal, if you then modify the magnitude of frequency bins and take the inverse FFT you will have a signal which is 'filtered'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Why is this not an 'ideal' (low pass) filter?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the time domain representation of a brick wall (rectangular) filter in the frequency domain. If we take the inverse Fourier transform of a perfectly rectangular frequency response we get a time domain signal which stretches from -inf to +inf. We cannot take the FFT of a signal which has infinite length, or if we did we would have a frequency domain representation with an infinite number of bins - therefore a rectangular signal that is described by a finite number of bins in the frequency domain is &lt;em&gt;not&lt;/em&gt; an 'ideal' filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more samples we have in our original time domain signal the better our frequency resolution will become when we take the Fourier transform, so a brick wall filter will be increasingly close to an ideal filter as the number of time domain samples approaches infinity. &lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2013-11-05T18:52:49.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11493" PostTypeId="2" ParentId="11487" CreationDate="2013-11-05T19:13:06.360" Score="12" Body="&lt;p&gt;If you only have a finite number of samples and are using a finite length FFT, then you will end up with a finite number of FFT frequency result bins.  Each bin has a one-to-one relationship ONLY with frequencies that are exactly integer periodic in the FFT length.  Any other spectrum frequencies that are not exactly periodic in the FFT aperture will not have that one-to-one relationship, but instead will have their energy spattered across the entire FFT result (a sampled periodic Sinc or Dirichlet function).  Thus, zero-ing just the nearest neighbor frequency bin will not have the effect you think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero-ing a bin is the same as &lt;strong&gt;adding&lt;/strong&gt; an exactly periodic sinusoid of the same magnitude but of the opposite phase.  If what you are trying to filter out is spectrum of a very slightly different frequency from that of the bin center, then instead of zero-ing it out by exact cancellation, the result will be an added beat pattern.  Which is not the same as (FIR, IIR) filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDED (in regards to ideal filtering) : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basis vectors of a DFT are all orthogonal to one another.  Any other sinusoid (non-periodic-in-aperture) will be orthogonal to &lt;strong&gt;none&lt;/strong&gt; of the basis vectors.  Which means it that that sinusoid will be represented, or have some energy end up in &lt;strong&gt;every&lt;/strong&gt; DFT bin (because of not being orthogonal to any bin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore no &lt;strong&gt;subset&lt;/strong&gt; of all the bins (a sequence of lower FFT/DFT bins for example) can exactly represent that signal.  Therefore zero-ing only a sequence of lower bins in an attempt to create a canceling signal will be imperfect, or non-ideal for that signal.  Thus a filter created by such a method cannot be ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One might be able to get close for a signal near the center of a large sequence of filter bins.  But not for a signal near the edges of any sequence of bins, as a large portion of the signal's energy will be represented by those bins just outside the sharp edge of the filter rectangle.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2017-05-31T07:54:12.823" LastActivityDate="2017-05-31T07:54:12.823" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="11494" PostTypeId="1" CreationDate="2013-11-05T19:21:49.637" Score="1" ViewCount="76" Body="&lt;p&gt;I have designed a simple 3-state $[x\ \dot{x}\ \ddot{x}]$ Kalman filter which is updated by measurements for $x$ and $\dot{x}$. The filter is tracking a peak on a surface in the $x/\dot{x}$ plane. At each iteration, I detect a number of peaks on the surface, each with an $x/\dot{x}$ measurement pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to select the peak which is closest to the current state as input for the next filter iteration. At the moment I am simply finding the difference in the $x$ and $\dot{x}$ dimensions, scaling them so they are similar in scale, and then computing the 2-D distance. This has been working fine for me, but I know it is not the &quot;right&quot; way to calculate the distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use the Kalman variables to determine which measurement is closest to the current estimate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure where this belongs, so I have this posted in stack, dsp, math, and stats exchanges.&lt;/p&gt;&#xA;" OwnerUserId="4439" LastEditorUserId="80" LastEditDate="2013-11-05T20:16:18.463" LastActivityDate="2013-12-05T21:54:40.857" Title="2-D Distance for Kalman measurements" Tags="|matlab|kalman-filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11495" PostTypeId="2" ParentId="11490" CreationDate="2013-11-05T19:26:17.573" Score="0" Body="&lt;p&gt;For any length of FFT and sample rate Fs, you can calculate the entire set of (positive) frequencies for which a pure sinusoid will produce a delta function in the FFT result.  They are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k * Fs / FFTLength &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for integer k = 0 to infinity.  (Or to FFTLength/2 if you don't want aliases.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other frequency sinusoid will not produce a delta, but instead a sampled periodic Sinc or Dirichlet function (conjugate mirrored for strictly real input).  So you can answer your own 3 questions by process of elimination.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-11-05T19:31:42.360" LastActivityDate="2013-11-05T19:31:42.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11496" PostTypeId="2" ParentId="11487" CreationDate="2013-11-05T20:00:13.590" Score="3" Body="&lt;p&gt;In practice, I think you will find that you &lt;em&gt;can&lt;/em&gt; in fact implement a low-pass filter in the way you specify, and that it will do quite well in terms of filtering out high frequency content.  The main reason that this approach is not practical is that it is not suited for real-time processing. In order to even attempt this in real time, I would have to take my signal in chunks, which inherently &lt;em&gt;adds high-frequency content&lt;/em&gt;. You could mitigate this effect to some degree with clever windowing, but you can not avoid the fact that a finite-length window has high-frequency content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other major setback is computational complexity.  Imagine the number of floating-point operations required to do an N-FFT followed by an N-IFFT, with an N as small as 1024.  Compare that to the performance you will get out of a &lt;strong&gt;&lt;em&gt;much&lt;/em&gt;&lt;/strong&gt; simpler IIR filter which can be run in real time and requires many orders of magnitude less compute power.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-11-05T20:00:13.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11497" PostTypeId="1" AcceptedAnswerId="11510" CreationDate="2013-11-05T20:08:03.527" Score="1" ViewCount="789" Body="&lt;p&gt;In Harris Corner detection, is there any particular reason why this function is chosen:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R=det(M)-k*trace(M)^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to a function to evaluate how fast E(u,v) fluctuate accross different direction, but can't we use other function such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R=1-(\lambda_1+\lambda_2)^2$&lt;/p&gt;&#xA;" OwnerUserId="3802" LastEditorUserId="3802" LastEditDate="2013-11-06T23:38:08.093" LastActivityDate="2013-11-06T23:38:08.093" Title="Harris Corner Detection" Tags="|computer-vision|corners|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11498" PostTypeId="2" ParentId="11494" CreationDate="2013-11-05T21:06:20.443" Score="1" Body="&lt;p&gt;I thought about it a bit more (power of posting), and decided the best way to scale $x$ and $\dot{x}$ is by the standard deviation, which is being tracked within the covariance matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;errX = (x_n - x_n-1)/sqrt(var(x));&#xA;errXdot = (xdot_n - xdot_n-1)/sqrt(var(xdot));&#xA;err2D = sqrt(errX^2 + errXdot^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4439" LastEditorUserId="80" LastEditDate="2013-11-05T21:54:10.480" LastActivityDate="2013-11-05T21:54:10.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11499" PostTypeId="2" ParentId="11497" CreationDate="2013-11-05T21:28:06.650" Score="1" Body="&lt;p&gt;$M$ is the structure tensor. The points where the signal changes in two directions are the points for which both eigenvalues of $M$ are large. $R = det(M) - k*trace^2(M) = \lambda_1\lambda_2 - k(\lambda_1 + \lambda_2)^2$, so $R$ is large when both $\lambda_1$ and $\lambda_2$ are large.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-11-05T21:28:06.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11501" PostTypeId="2" ParentId="11490" CreationDate="2013-11-05T23:42:45.980" Score="0" Body="&lt;p&gt;I think it's easier to look at exponentials. The reasoning is exactly the same, but if a sine or cosine were used, we would need two exponentials. So first let's say that $$x[n]=e^{j2\pi\frac{f_0}{fs}n} $$&#xA;Then the DFT is $$\begin{align}&#xA;X_N[k]&amp;amp;=\sum_{n=0}^{N-1}e^{-j\frac{2\pi}{N}kn}e^{j2\pi\frac{f_0}{fs}n} \\&#xA;&amp;amp;=\sum_{n=0}^{N-1}e^{-j2\pi n\left ( \frac{k}{N}-\frac{f_0}{f_s} \right)} \\&#xA;&amp;amp;=\frac{1-e^{-j2\pi N\left(\frac{k}{N} -\frac{f_0}{f_s}\right)}}{1-e^{-j2\pi \left(\frac{k}{N} -\frac{f_0}{f_s}\right)}} \mbox{, where } k=0,\ldots,N-1&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this to be a delta, we need the following condition to be satisfied:&#xA;$$&#xA;N\left(\frac{k}{N}-\frac{f_0}{f_s}\right) \in \mathbb{Z} \Rightarrow k-N\frac{f_0}{f_s} \in \mathbb{Z}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this condition, the numerator is always zero. The denominator will be zero if $$ \frac{k}{N}-\left.\frac{f_0}{f_s}\right\vert_{k=k_0}=0 \mbox{, or } k_0=N\frac{f_0}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At that particular $k_0$, you will need to use L'Hospital's Rule.&#xA;This will give you the complete DFT as $$X_N[k]=\begin{cases} N &amp;amp;\mbox{ if } k=N\frac{f_0}{f_s} \\ 0 &amp;amp;\mbox { else} \end{cases} \mbox{, } k=0,\ldots,N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what conditions did we impose to get this result? Just that $k-N\frac{f_0}{f_s} \in \mathbb{Z}$. Since $k$ is already an integer, we need only check $N\frac{f_0}{f_s}$. Define $f_s=af_0$. Therefore $a$ is the number of points in a cycle. Then we need $$\frac{N}{a} \in \mathbb{Z}$$&#xA;This can only be satisfied if $a$ is an integer, and $N$ is an integer multiple of $a$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting all this together, if the sampling frequency is an integer multiple of the input's frequency, and $N$ is an integer number of points in a cycle of the sampled exponential, then the DFT of $x[n]$ will be a delta with height $N$.&lt;/p&gt;&#xA;" OwnerUserId="5884" LastEditorUserId="5884" LastEditDate="2013-11-06T11:58:52.870" LastActivityDate="2013-11-06T11:58:52.870" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11503" PostTypeId="1" CreationDate="2013-11-06T00:20:50.923" Score="1" ViewCount="4219" Body="&lt;p&gt;MATLAB has a &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow&quot;&gt;spectrogram&lt;/a&gt; function for the time-frequency analysis of a single signal. It also has a &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/cpsd.html&quot; rel=&quot;nofollow&quot;&gt;cpsd&lt;/a&gt; function for estimating the cross-frequency spectrum for two signals. However, cpsd averages across windows, collapsing the time axis into a single estimate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a function in this same family that does not average, but returns a time-frequency cross-spectrum instead? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I want to use this in a step-by-step tutorial for teaching purposes, I'd like to avoid the following two possible solutions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;http://chronux.org/Documentation/chronux/spectral_analysis/continuous/cohgramc.html&quot; rel=&quot;nofollow&quot;&gt;cohgramc&lt;/a&gt; function from the Chronux toolbox (uses a multitaper spectral estimation method I don't want to get into)&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;http://www.mathworks.com/help/wavelet/examples/wavelet-coherence.html&quot; rel=&quot;nofollow&quot;&gt;wcoher&lt;/a&gt; function from the Wavelet toolbox (uses wavelets, idem)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Both of these methods return nice time-frequency cross-spectra, but I would like just to have a basic version with the familiar windowing parameters that spectrogram and cpsd use. Does this exist?&lt;/p&gt;&#xA;" OwnerUserId="5558" LastActivityDate="2013-12-19T12:08:26.280" Title="How can I compute a time-frequency cross-spectrum in MATLAB?" Tags="|matlab|frequency-spectrum|cross-correlation|spectrogram|coherence|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11505" PostTypeId="1" AcceptedAnswerId="11511" CreationDate="2013-11-06T00:51:45.480" Score="2" ViewCount="1034" Body="&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/fdesign.arbmagnphase.html&quot; rel=&quot;nofollow&quot;&gt;fdesign.arbmagnphase&lt;/a&gt; is a MATLAB built-in function that will create a filter that best fits the frequency-response that it is given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to implement a similar function in Python. What algorithms are used to synthesize filters based on an arbitrary frequency response?&lt;/p&gt;&#xA;" OwnerUserId="5843" LastActivityDate="2023-01-18T05:19:31.247" Title="Synthesize Digital Filter with Arbitrary Frequency-Response" Tags="|matlab|filter-design|python|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11506" PostTypeId="1" CreationDate="2013-11-06T00:54:38.227" Score="3" ViewCount="2528" Body="&lt;p&gt;Goal: For a particle moving uniaxially, to estimate position ($d$) and velocity ($v$) from noisy acceleration ($a$) and very noisy position (GPS) measurements using a Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Catch: The accelerometer has a DC offset, i.e. its zero is not zero but some number $\Omega$ such that the &quot;true&quot; acceleration $a^{true}$ is obtained from the measured acceleration coming out of the sensor $a^{obs}$ as:&#xA;$$&#xA;a^{true}=a^{obs}-\Omega&#xA;$$&#xA;My system states and transitions, note I've added the accelerometer bias or DC offset as a state are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{x}_{k+1}=\left[\begin{array}{cccc}&#xA;d_{k+1} \\&#xA;v_{k+1} \\&#xA;a_{k+1}^{true} \\&#xA;\Omega &#xA;\end{array}\right]=\left[\begin{array}{cccc}&#xA;1 &amp;amp; dt &amp;amp; dt^2/2 &amp;amp; 0       \\&#xA;0 &amp;amp; 1 &amp;amp; dt &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right]\cdot\left[\begin{array}{cccc}&#xA;d_k \\&#xA;v_k \\&#xA;a_k^{true} \\&#xA;\Omega &#xA;\end{array}\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then the measurements are (notice I've used $a^{obs}$ instead of $a^{true}$):&#xA;$$&#xA;z_k=\left[\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1       \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{array}\right]\cdot\left[\begin{array}{cccc}&#xA;d_k \\&#xA;0 \\&#xA;a_k^{obs} \\&#xA;0 &#xA;\end{array}\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 1: Does this look right and/or feasible and,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2: How do I determine the process noise and measurement noise matrices $Q$ and $R$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="5888" LastEditorUserId="128" LastEditDate="2020-03-16T06:19:02.060" LastActivityDate="2020-03-16T06:19:02.060" Title="Kalman Filter with Accelerometer with DC Offset" Tags="|discrete-signals|kalman-filters|control-systems|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11507" PostTypeId="1" AcceptedAnswerId="11514" CreationDate="2013-11-06T00:54:54.520" Score="3" ViewCount="8109" Body="&lt;p&gt;Please explain me the concept of Orthogonality and Orthonormality. I understand that the mathematical definition of orthogonality between two vectors is that their dot product is zero. It means that there is no correlation between the two vectors. And in case of Orthonormality the vector length would be 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to understand the concepts clearly. Please explain me the concept of Orthogonality and Orthonormality in terms of Image Processing. &lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2013-11-06T13:17:35.923" Title="Concept of Orthogonality and Orthonormality" Tags="|image-processing|signal-analysis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11510" PostTypeId="2" ParentId="11497" CreationDate="2013-11-06T07:57:11.090" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;can't we use other function such as: $R=1-(\lambda_1+\lambda_2)^2$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This formula isn't as useful, because it doesn't differentiate between two equally large eigenvalues (a corner) and one twice as large eigenvalue plus one very small one (a straight line). So for example $\lambda_1 = 2, \lambda_2 = 0$ will give the same result as $\lambda_1 = 1, \lambda_2 = 1$, although the former is probably not a corner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But generally speaking: Yes, the Harris formula isn't the only one. You can for example use the harmonic mean between the eigenvalues, i.e. $2/(1/\lambda_1 + 1/\lambda_2) = 2 det(M)/trace(M)$. Or you can use the smaller eigenvalue directly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Harris corner detector was developed at a time when floating point division and square root were still expensive operations. I'd guess that was one reason why a detector that only uses multiplications was preferred. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These days, on a PC, I'm quite sure you can divide floating point numbers faster than you can get them to the CPU or GPU, so it makes sense to consider other corner detectors. On other hardware, like mobile devices or smart cameras the lower cost can still be an important advantage of the Harris corner detector.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2013-11-06T07:57:11.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11511" PostTypeId="2" ParentId="11505" CreationDate="2013-11-06T08:57:19.270" Score="2" Body="&lt;p&gt;For FIR filter design, common algorithms include Remez exchange or Parks-McClellan :&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/220/what-is-the-difference-between-remez-exchange-and-parks-mcclellan-filter-design&quot;&gt;What is the difference between Remez exchange and Parks-McClellan filter design?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For IIR filters, one possibility is the Differential Evolution algorithm, as described in some IEEE journals.  If you have a realistic desired phase response and can guess the filter order, then &lt;a href=&quot;https://github.com/blair3sat/fdls&quot; rel=&quot;nofollow noreferrer&quot;&gt;Berchin's FDLS method&lt;/a&gt; may be suitable.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2023-01-18T05:19:31.247" LastActivityDate="2023-01-18T05:19:31.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11512" PostTypeId="2" ParentId="3557" CreationDate="2013-11-06T10:56:56.360" Score="1" Body="&lt;p&gt;The asymmetric structuring elements produce a translation dilation on the original set or image. The size of the translation is determined by the offset in the center of the structuring element. For example you could try this using &lt;a href=&quot;http://www.mathworks.fr/fr/help/images/ref/translate.html&quot; rel=&quot;nofollow&quot;&gt;matlab&lt;/a&gt; for the dilation operator: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('circles.png');&#xA;se = strel('disk',10); %you could see it with se = strel('line',5,180) &#xA;%too but have to make sure that the origin still lies in the se.&#xA;se2 = translate(se,[-5,-5]) %offset the center by 5 pixels&#xA;figure, imshow(imdilate(I,se))&#xA;figure, imshow(imdilate(I,se2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;One avoids this since it introduces anisotropy using the asymmetric structuring element.&#xA;But one can use this for applications in edge detection i guess.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastActivityDate="2013-11-06T10:56:56.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11513" PostTypeId="1" AcceptedAnswerId="11516" CreationDate="2013-11-06T12:40:56.053" Score="2" ViewCount="4017" Body="&lt;p&gt;How can I find out frequency and peak value of a signal's fundamental?&#xA;Please do consider the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The peak value of some harmonics might be higher than that one of the fundamental&lt;/li&gt;&#xA;&lt;li&gt;The frequency of the harmonic is not an integer (e.g. 3.45  Hz)&lt;/li&gt;&#xA;&lt;li&gt;I have information about where to search for the frequency (3.45 +- 0.5 Hz).&lt;/li&gt;&#xA;&lt;li&gt;I need to estimate frequency and peak value as accurate as possible&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any response or sample code (MATLAB) is highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5416" LastActivityDate="2013-11-08T10:35:22.163" Title="Estimate frequency and peak value of a signal's fundamental" Tags="|fft|discrete-signals|frequency|signal-analysis|peak-detection|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11514" PostTypeId="2" ParentId="11507" CreationDate="2013-11-06T13:17:35.923" Score="3" Body="&lt;p&gt;Orthogonal means that the inner product is zero. For example, in the case of using dot product as your inner product, two perpendicular vectors are orthogonal. Orthonormal means these vectors have been normalized so that their length is 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Orthogonal vectors are useful for creating a basis for a space. This is because every point in the space can be represented as a (linear) combination of the vectors. So for example in 3D space, x=[0,0,1]  y=[0,1,0] and z=[1,0,0] form an orthornormal basis. No component of x can be represented with a component of the other vectors. This is because they are &lt;strong&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_independence&quot; rel=&quot;nofollow&quot;&gt;linearly independent&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a different type of independence to &lt;a href=&quot;http://en.wikipedia.org/wiki/Correlation_and_dependence&quot; rel=&quot;nofollow&quot;&gt;statistical dependence&lt;/a&gt; however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlation is a different notion. There are different ways of representing the correlation of two vectors (random variables X and Y).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$corr(X,Y) = \frac{cov(X,Y)}{\sigma_x \sigma_y} = \frac{E[X - \mu_x]E[Y - \mu_y]}{\sigma_x \sigma_y}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Covariance&quot; rel=&quot;nofollow&quot;&gt;Covariance&lt;/a&gt; is a measure of how two variables change together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another measure of correlation is &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;cross-correlation&lt;/a&gt;. This is measure of the similarity of two functions (or vectors). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These concepts ares used in many different ways in image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example cross-correlation is used in template matching. When looking for a small image inside a much larger image, the small template image is 'slided' over the large image and the cross-correlation is computed for each position. Locations with a high cross-correlation are likely to contain the image we are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The concept of Linearly independent component vectors is used in principal component analysis (PCA). PCA takes a cloud of points in space and calculates a set of orthogonal basis vectors to represent them.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Independent component analysis (ICA) is used for separating mixed signals. ie: separating a speaker at a noisy cocktail party. ICA uses properties of the signal correlation to separate the signals.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2013-11-06T13:17:35.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11516" PostTypeId="2" ParentId="11513" CreationDate="2013-11-06T13:40:16.153" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms&quot; rel=&quot;nofollow&quot;&gt;There are a few Matlab implementations of various frequency estimators here.&lt;/a&gt;  However, they will probably be &quot;tricked&quot; by the higher harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ericjacobsen.org/fe2/fe2.htm&quot; rel=&quot;nofollow&quot;&gt;That you know a range, perhaps the best technique is one of Eric Jacobsen's estimators. Have a look at his page.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In essence, Eric's estimators use the FFT bin at $X(k)$, and on either side of ($X(k+1), X(k-1)$) the peak.  If you choose your FFT length to match your known range (so that $k \rightarrow 3.45$ and $k+1 \rightarrow 3.50$ and $k-1 \rightarrow 3.4$, then you should be good to go.  &lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-06T13:40:16.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11517" PostTypeId="2" ParentId="11513" CreationDate="2013-11-06T14:11:58.290" Score="1" Body="&lt;p&gt;Harmonic product Spectrum (HPS) seems be useful for you, a feature of the HPS algorithm is multiply a number of harmonics, this give you a peak of your fundamental frequency, I believe that you will need a big FFT points like 12288 for signals sampled at 44100hz, for it the first  bin are in 3.5889hz.&#xA;HPS source code example here:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/19765486/matlab-code-for-harmonic-product-spectrum&quot;&gt;https://stackoverflow.com/questions/19765486/matlab-code-for-harmonic-product-spectrum&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2013-11-06T14:11:58.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11518" PostTypeId="1" AcceptedAnswerId="12930" CreationDate="2013-11-06T15:35:53.827" Score="2" ViewCount="1301" Body="&lt;p&gt;I am asked to find a pair of sequences, each one of which contains three distinct values and where the convolution is an all-zero sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've came to the conclusion that one of the sequences must be infinite but just can't think of any examples...&lt;/p&gt;&#xA;" OwnerUserId="5897" LastActivityDate="2019-02-16T19:09:00.657" Title="Convolution that results in an all-zero sequence" Tags="|convolution|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="11519" PostTypeId="2" ParentId="11411" CreationDate="2013-11-06T16:14:05.507" Score="2" Body="&lt;p&gt;Is there a reason you don't think that the general formulae are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G = \sum_{k=0}^{\infty} h[k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G = (\sum_{k=0}^{\infty} h^2[k] )^\frac{1}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These will work, provided the system is linear and time-invariant (and BIBO stable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To work with a rational transfer function:&#xA;$$&#xA;H(z) = \frac{\displaystyle\sum_{m=0}^{M} b_m z^{-m}}{\displaystyle\sum_{n=0}^{N} a_n z^{-n}}&#xA;$$&#xA;then the DC gain (at $z = e^{j0}$) will be:&#xA;$$&#xA;G_{DC} = \left. H(z) \right|_{z=1 = e^{j0}} = \frac{\displaystyle\sum_{m=0}^{M} b_m}{\displaystyle\sum_{n=0}^{N} a_n }&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll have to think a bit more about the second gain in your question.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-11-06T21:39:17.477" LastActivityDate="2013-11-06T21:39:17.477" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11520" PostTypeId="1" AcceptedAnswerId="11523" CreationDate="2013-11-06T18:25:36.290" Score="3" ViewCount="2813" Body="&lt;p&gt;If I have a time domain array of N samples, and swap the final half with initial half, then perform an FFT, what will be the effects on the frequency domain? Will the frequencies' magnitudes remain the same as the ones in the frequency domain of the original array?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if instead of swapping halves, I just circle 1/10th, or 1/5th, of the full array?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know this because I am trying to take the frequencies' magnitudes at real time, and as new sample data arrives, I thought of simply updating my frequency domain data (subtracting the old samples and adding the new ones) instead of redoing the whole FFT every time.&lt;/p&gt;&#xA;" OwnerUserId="5882" LastEditorUserId="29" LastEditDate="2013-11-08T22:22:24.640" LastActivityDate="2013-11-08T22:22:24.640" Title="What happens to frequency domain components if I circular-shift the time domain samples?" Tags="|discrete-signals|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11521" PostTypeId="1" AcceptedAnswerId="11522" CreationDate="2013-11-06T18:48:39.067" Score="0" ViewCount="657" Body="&lt;ol&gt;&#xA;&lt;li&gt;I have a signal with length of $N$.&lt;/li&gt;&#xA;&lt;li&gt;The sampling frequency is $f_s$.&lt;/li&gt;&#xA;&lt;li&gt;Window size is $w$&lt;/li&gt;&#xA;&lt;li&gt;The noverlap size is set to $m$.&lt;/li&gt;&#xA;&lt;li&gt;And $nfft$ is selected for frequency resolutions.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am running a STFT with matlab &lt;code&gt;spectrogram&lt;/code&gt; function.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[S,F,T,P]=spectrogram(x,window,noverlap,nfft,fs)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;what is the effect of &lt;em&gt;nfft&lt;/em&gt; , $f_s$ and  noverlap on STFT&#xA;computational burden?&lt;/li&gt;&#xA;&lt;li&gt;what is computation complexity of STFT with these parameters size?&#xA;{in term of big &lt;code&gt;O()&lt;/code&gt; }&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note: The &lt;code&gt;FFT&lt;/code&gt; computational complexity for a signal with length of $N$ is $Nlog(N)$&lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2013-11-06T19:27:46.993" Title="STFT computational burden" Tags="|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11522" PostTypeId="2" ParentId="11521" CreationDate="2013-11-06T19:27:46.993" Score="3" Body="&lt;p&gt;The number of FFTs is roughly N/(w-m). An fft costs you nfft*log2(nfft) so the total is proportional to N/(w-m)*nfft*log2(nfft). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical application would make nfft = w and m = w/2, so this would come out to be proportional to N*log2(nfft). So it's proportional to the length or you data set (obviously) and the log of the FFT size.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-06T19:27:46.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11523" PostTypeId="2" ParentId="11520" CreationDate="2013-11-06T19:29:38.233" Score="5" Body="&lt;p&gt;If you &lt;em&gt;circularly&lt;/em&gt; shift the array in the time domain, the DFT of the shifted sequence will have the same &lt;em&gt;magnitudes&lt;/em&gt; in each bin, but the &lt;em&gt;phases&lt;/em&gt; will be different, with $X[k]$ being transformed to $X[k]e^{jk\theta}$, &#xA;$k = 0, 1, \ldots, N-1$, for a fixed value of $\theta$ that I will leave for&#xA;you to figure out.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-11-06T19:29:38.233" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11524" PostTypeId="2" ParentId="11426" CreationDate="2013-11-06T19:35:38.923" Score="2" Body="&lt;p&gt;Hint:  try computing the linear convolution of $~[1\quad 1\quad  1]~$ and &#xA;$~[0\quad 1 \quad 1]~$ by hand and the circular convolution of the zero-padded&#xA;versions&#xA;$~[1\quad 1\quad  1 \quad 0\quad 0\quad 0]~$ and $~[0\quad 1 \quad 1\quad 0\quad 0\quad 0]~$ also by hand (or via FFTs if you are desperate enough).&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-11-06T19:35:38.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11525" PostTypeId="1" AcceptedAnswerId="25019" CreationDate="2013-11-06T20:17:11.633" Score="4" ViewCount="1287" Body="&lt;ul&gt;&#xA;&lt;li&gt;What is computational complexity of continuous wavelet transform&#xA;&lt;code&gt;cwt&lt;/code&gt; ?&lt;/li&gt;&#xA;&lt;li&gt;What is computational complexity of wavelet packet transform &lt;code&gt;wpt&lt;/code&gt; ?&lt;/li&gt;&#xA;&lt;li&gt;What is computational complexity of Stockwell transform transform &lt;code&gt;wpt&lt;/code&gt; ?&lt;/li&gt;&#xA;&lt;li&gt;for the &lt;code&gt;cwt&lt;/code&gt; : imagine I have a signal with length of $N$ and I&#xA;scale vector is &lt;code&gt;0:1:s&lt;/code&gt;&lt;br&gt;&#xA;what will happen if I discretize scale vector to &lt;code&gt;0:dj:s&lt;/code&gt; for better accuracy?  &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;for the WPT : Imagine signal size is $N$ and I am decomposing it in&#xA;$L$ levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;for Continuous case I guess its $O(S\times N^{2})$ and for &lt;code&gt;0:dj:S&lt;/code&gt;, It must be $O(\frac{S}{dj}\times N^{2})$ , Am I right?&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;for WPT transform it must be $O(2^{L}\times NLogN )$ . Is that right?&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;For S transfrom I think it is $O(N^{2}Log N)$&lt;/em&gt; . Is it true?&lt;br&gt;&#xA;I have calculated the running time of Stockwell and Continuous wavelet transforms. but the time results are strange.&lt;br&gt;&#xA;N=3000;            $O(Stockwell)=1.039\times 10^{8}$  it takes 2.5 sec&lt;br&gt;&#xA;N=3000, scale=300; $O(cwt)=2.7\times 10^{9}$ it takes 0.58 sec&lt;br&gt;&#xA;why this is happening here ? [P.S I have run them 100 times and got the time average]&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-11-08T21:05:38.297" LastActivityDate="2016-05-28T15:09:03.843" Title="what is continuous wavelet (cwt) ,wavelet packet (wpt) and stockwell (S-T) computational complexity?" Tags="|wavelet|time-frequency|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11526" PostTypeId="2" ParentId="11513" CreationDate="2013-11-06T20:41:00.253" Score="1" Body="&lt;p&gt;Thanks a lot, that looks promising.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used Erics code (Macleod's algorithm) to implement the following snipped:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Amplitude of signal.&#xA;ACW=1;&#xA;&#xA;% Specify signal.&#xA;Fs = 8000;                   % samples per second&#xA;dt = 1/Fs;                   % seconds per sample&#xA;nHarmonic = 7;               % order of harmonic&#xA;Fc = 21.5;                   % Hz&#xA;StopTime = 0.25;             % seconds&#xA;t = (0:dt:StopTime-dt)';     % seconds&#xA;&#xA;% Specify evaluation tolerance&#xA;Tol = 0.01;&#xA;&#xA;% Effective length of test vector.&#xA;tstlen=length(t);&#xA;&#xA;% Generate signal&#xA;cw = ACW * sin(2*pi*(1:tstlen)*Fc/tstlen) + 1.5 * ACW * sin(2*pi*(1:tstlen)*(Fc/tstlen) * 3) ...&#xA;  + 2.5 * ACW * sin(2*pi*(1:tstlen)*(Fc/tstlen) * 5)+ 0.3 * ACW * sin(2*pi*(1:tstlen)*(Fc/tstlen) * 7);&#xA;&#xA;% Number of trials in test.&#xA;N=10000;           &#xA;&#xA;% Desired bin number of tone relative to long test length.&#xA;bin=Fc; &#xA;&#xA;% Allocate vector for results.&#xA;macldest=zeros(size(1:N));&#xA;&#xA;% Calculate desired target result for comparison.&#xA;target=bin;&#xA;&#xA;fprintf('Peak is at %f.\n',bin);&#xA;&#xA;for I = 1:N,        % Run trials.&#xA;% Calculate signal power.&#xA;sigp=sum(abs(cw(1:tstlen).^2));         &#xA;&#xA;% DFT.&#xA;dftshrt(1:tstlen)=fft(cw(1:tstlen));&#xA;&#xA;% DFT magnitude.&#xA;magshrt(1:tstlen)=abs(dftshrt);&#xA;&#xA;% Find raw peak magnitude and location.&#xA;[rawmag,rawind]=max(magshrt);           &#xA;&#xA;% Isolated 3 samples around peak.&#xA;pk3vect(1:3)=dftshrt(rawind-1:rawind+1);    &#xA;&#xA;%Do Macleod's estimation.&#xA;ref = pk3vect(2);                               % Isolate phase reference.&#xA;R = real(pk3vect.*conj(ref));                   % Generate phase corrected coefficient vector.&#xA;gamma = (R(1)-R(3))/((2*R(2))+R(1)+R(3));       % Calculate offset.&#xA;delta = (sqrt(1 + 8*gamma*gamma)-1)/(4*gamma);  % Final estimate.&#xA;macldest=rawind-1+delta;        &#xA;end&#xA;&#xA;% Calculate average result.&#xA;macldr=mean(macldest)&#xA;&#xA;% Evaluate estimated frequency&#xA;Factor = round(macldr/Fc)&#xA;&#xA;if (macldr &amp;gt; (Fc-Tol) &amp;amp; macldr&amp;lt;(Fc+Tol) )&#xA;  result=macldr&#xA;elseif ((macldr/Factor)&amp;gt;(Fc-Tol) &amp;amp; (macldr/Factor)&amp;lt;(Fc+Tol))&#xA;  result=macldr/Factor&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what is the most accurate method now to estimate the fundamentals peak value?&lt;/p&gt;&#xA;" OwnerUserId="5416" LastEditorUserId="5416" LastEditDate="2013-11-08T10:35:22.163" LastActivityDate="2013-11-08T10:35:22.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11527" PostTypeId="2" ParentId="11506" CreationDate="2013-11-06T20:50:03.227" Score="3" Body="&lt;p&gt;Q1: Without actually implementing it and seeing that it works, your formulation looks pretty good... except that I do not understand your final equation:&#xA;$$&#xA;z_k=\left[\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1       \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{array}\right]\cdot\left[\begin{array}{cccc}&#xA;d_k \\&#xA;0 \\&#xA;a_k^{obs} \\&#xA;0 &#xA;\end{array}\right]&#xA;$$&#xA;That doesn't make sense because a) the output matrix is too big and b) $a_k^{obs}$ does not form part of the state, $a_k^{true}$ does. It should look more like:&#xA;$$&#xA;z_k=\left[\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; +1       \\&#xA;\end{array}\right]\cdot\left[\begin{array}{cccc}&#xA;d_k \\&#xA;v_k \\&#xA;a_k^{true} \\&#xA;\Omega &#xA;\end{array}\right] = \left[\begin{array}{cccc}&#xA;d_k\\&#xA;a_k^{true} + \Omega&#xA;\end{array}\right]&#xA;$$&#xA;Notice the change in sign to get the expression for the acceleration measurement to come out correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: What noise is driving your system? Is it just the acceleration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your state update equation should look more like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{x}_{k+1}=\left[\begin{array}{cccc}&#xA;1 &amp;amp; dt &amp;amp; dt^2/2 &amp;amp; 0       \\&#xA;0 &amp;amp; 1 &amp;amp; dt &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0       \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right]\cdot\left[\begin{array}{cccc}&#xA;d_k \\&#xA;v_k \\&#xA;a_k^{true} \\&#xA;\Omega &#xA;\end{array}\right]&#xA;+ &#xA;Gw_k&#xA;$$&#xA;where $G$ determines which part of the state is driven by the noise process $w_k$.  The dimension of $w_k$ (is it a scalar or a vector?) will determine whether, if more than one part of the state is being driven, whether those drivers are different for each part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the driver is just acceleration, then choose:&#xA;$$&#xA;G = \left[\begin{array}{cccc}&#xA;0 \\&#xA;0 \\&#xA;1 \\&#xA;0 &#xA;\end{array}\right]&#xA;$$&#xA;assuming that the offset in acceleration is not changing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the question of what the covariance of $Q$ is boils down to: how quickly does your acceleration change?  That will really depend on your precise system. In this case, $w_k$ is just a scalar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to the covariance of $R$, that will depend on how different your measurements are form reality. I'd need more information to make a stab at that.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-06T20:50:03.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11528" PostTypeId="2" ParentId="2738" CreationDate="2013-11-07T00:52:03.307" Score="1" Body="&lt;p&gt;It seems from the initial area based filtering that results might not be satisfactory since it removes components which are linear but not so large in area. Looking at the structure of the foreground to be extracted, we can see that they are long thing structures. One could consider using linear structuring elements. But here the image consists of various angles and branchings. I suggest reading the following &lt;a href=&quot;http://www.gipsa-lab.grenoble-inp.fr/~jocelyn.chanussot/publis/patrecletters_10_valero_path_operators_roads.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; which presents the path opening which is demonstarted of area photos of road networks.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastActivityDate="2013-11-07T00:52:03.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11530" PostTypeId="1" CreationDate="2013-11-07T08:45:43.003" Score="1" ViewCount="765" Body="&lt;p&gt;When we implement the 1D-short time fourier transform, the formula is as such:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Sf[m,l]=\sum_{n=0}^{N-1}f[n]g[n-m]\exp\left(\frac{-i2\pi l n}{N}\right).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the window $g$ used is normally symmetric, why is this so? (Hint: Use the phase of Short time fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="5014" LastEditDate="2013-11-19T09:04:09.773" LastActivityDate="2013-11-19T09:04:09.773" Title="window for short time fourier transform" Tags="|discrete-signals|fourier-transform|signal-analysis|gabor|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11531" PostTypeId="2" ParentId="3036" CreationDate="2013-11-07T09:27:43.673" Score="0" Body="&lt;p&gt;The constellation you should use depends on the characteristics of channel, Triangular, Square or Hexagonal could all be &quot;the best&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculating the actual BER/SER is a tough problem that, as Dilip said, relies on how many other constellations fall within the decision boundary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the theoretical calculation please refer to this excellent paper that compares different arrangements of the constellation and compares them against each other with a fantastic summary.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;CONCLUSION: It was shown that, TQAM achieves approximately the minimum&#xA;  SER over the whole range of SNRs and that it is an efficient&#xA;  solution when the choice of the modulation is based on the&#xA;  SER minimization. On the other hand, the minimum BER&#xA;  is achieved for an angle different from =60 (TQAM).&#xA;  Furthermore, it was shown that in fading channels, SQAM is&#xA;  the optimum constellation in terms of BER. (&lt;a href=&quot;http://users.auth.gr/geokarag/pdf/Theta.pdf&quot; rel=&quot;nofollow&quot;&gt;http://users.auth.gr/geokarag/pdf/Theta.pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5902" LastActivityDate="2013-11-07T09:27:43.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11533" PostTypeId="2" ParentId="11525" CreationDate="2013-11-07T12:01:05.810" Score="0" Body="&lt;p&gt;For a dsicretized signal with N samples. In terms of complexity for the DWT it is O(N) and for WPT its O(Nlog(N)) &lt;a href=&quot;https://www.math.ucdavis.edu/~saito/courses/ACHA.suppl/wavelet_faq.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;REFER&lt;/a&gt;. For each scale one calculates a convolution and not a single correlation value and the scale values need to be integral values. They can be constrained by using the iterative structure of quadrature mirror LP and HP filters, which is basically a explicit way of coding the scaling function. This is basically because one needs a finite number of scalings of the wavelet to represent the signal (wavelet is overcomplete frame). &lt;a href=&quot;http://math.ecnu.edu.cn/~qgu/friendintro.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;REFER2&lt;/a&gt;. For the wavelet packet tree the extra cost is due to the encoding of the residue/detail coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;You are right the discretization of the scale function in the CWT parameter decides the number of levels of decomposition. &lt;a href=&quot;http://www.mathworks.fr/fr/help/wavelet/ref/cwtft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab&lt;/a&gt; implements the CWT and describes that the &lt;a href=&quot;http://www.mathworks.fr/fr/help/wavelet/gs/continuous-wavelet-transform.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DFT&lt;/a&gt; can be used in calculating the CWT by zeropadding the wavelet and performing circular convolutions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5THAY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here Δt is the sampling interval (period) which basically discretizes the signal and the wavelet. So i guess you are right about the complexities for both the CWT and the WPT versions! Sorry about the mix up!&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="5886" LastEditDate="2013-11-09T15:15:16.380" LastActivityDate="2013-11-09T15:15:16.380" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11534" PostTypeId="2" ParentId="11530" CreationDate="2013-11-07T12:15:57.183" Score="-2" Body="&lt;p&gt;You are talking about symmetry in two contexts :-&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Gaussian&lt;/li&gt;&#xA;&lt;li&gt;Window&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I will talk about these two contexts one by one&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Gaussian&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A symmetric 2-D gaussian &lt;em&gt;(I assume 1-D as in 1-D the question of symmetry does not arise)&lt;/em&gt; means that it does not have any directional preference (&lt;em&gt;dictated by equal variances $\sigma_x$ and $\sigma_y$&lt;/em&gt;) . Now the job of &lt;a href=&quot;http://en.wikipedia.org/wiki/Gabor_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gabor Transform&lt;/a&gt; is to give us a joint time-frequency distribution &lt;em&gt;(i.e telling us about frequency and phase content of a local image patch)&lt;/em&gt;&#xA;Now consider the following two cases :-&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Symmetric Guassian ($\sigma_x$ = $\sigma_y$)&lt;/strong&gt;&#xA;In this case the gaussian does not have any directional preference.&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WYFmF.jpg&quot; alt=&quot;&quot;&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In the above image, suppose you are centered on the central pixel and consider a patch around it which is indicated in the above image by a black rectangle in the center. Following points are important for this image :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Doing a Gabor Transform over that patch would yield a time-frequency representation, which involves all the pixels in the patch accordingly weighted by the symmetric gaussian.&lt;/li&gt;&#xA;&lt;li&gt;All the directions at a certain distance from the origin get the same weigthage.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, if a gaussian oriented at an angle of $135^{\circ}$, then :- &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the white principle diagonal pixels would get almost all the weightage while the other pixels will get little weightage.  &lt;/li&gt;&#xA;&lt;li&gt;The time-frequency representation will be mainly a time-frequency representation around the principle diagonal.&lt;/li&gt;&#xA;&lt;li&gt;If the values of $\sigma_x$ and $\sigma_y$ are sufficiently small, the gabor transform will be very very close to the time-frequency representation for the straight line which marks the principle diagonal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thus, for the Gaussian function,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Symmetric gaussian is non-directional.&lt;/li&gt;&#xA;&lt;li&gt;Non-Symmetric gaussian is directionally oriented.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Non-Symmetric gaussian will be useful in cases where the time-frequency analysis of a directionally oriented feature in a patch has to be carried out.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Window&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Window size basically represents the time-resolution (or space-resolution in the case of 2-D signals like images). A narrow window means that the focus on some local patch of the image is high and hence a more faithful time resolution of the Time-frequency analysis will be possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is limited by the Heisenberg's Uncertainty principle. Although, Gabor Transform attains the &lt;a href=&quot;http://www.opticsinfobase.org/josaa/abstract.cfm?uri=josaa-2-7-1160&quot; rel=&quot;nofollow noreferrer&quot;&gt;theoretical lower bound&lt;/a&gt; for the uncertainty principle, it stays within the bounds of the principle. Thus, changing the window size is akin to changing your time resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Non-symmetrical window (like $3\times7$) is generally not chosen because generally we do not have a reason or a preference for changing our space-resolution in one direction (x or y) relative to other. In case there is a concern for the same, it can be done. However, I have never till now seen such a situation.&lt;/p&gt;&#xA;" OwnerUserId="3566" LastEditorUserId="3566" LastEditDate="2013-11-07T12:22:30.213" LastActivityDate="2013-11-07T12:22:30.213" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="11535" PostTypeId="1" CreationDate="2013-11-07T14:36:10.470" Score="0" ViewCount="916" Body="&lt;p&gt;I have to implement a complete receiver in digital communications.  The transmitter gives me an output vector which has real and imaginary values.  It uses 16psk for modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I demodulate that signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was assuming the output with constant amplitude with different phases, but the magnitude of the whole vector is variable and also when I plot the real and imaginary parts of that vector they are also variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know what is happening in the transmitter because it is an executable file.  So can anybody help me in understanding what is actually happening and how to demodulate that signal. &lt;/p&gt;&#xA;" OwnerUserId="5904" LastEditorUserId="76" LastEditDate="2013-11-07T20:57:43.377" LastActivityDate="2013-11-07T20:57:43.377" Title="16 psk demodulation" Tags="|matlab|modulation|digital-communications|phase|demodulation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11536" PostTypeId="2" ParentId="11535" CreationDate="2013-11-07T16:16:55.557" Score="0" Body="&lt;p&gt;Try looking at (plotting) the phase angle or atan2() of the real and imaginary parts.  You may need to subtract a constant slope, unwrap, and low pass filter.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-07T16:16:55.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11537" PostTypeId="2" ParentId="11518" CreationDate="2013-11-07T16:17:38.967" Score="4" Body="&lt;p&gt;Expanding on my comment when this question was closed, suppose that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x[n]=e^{j2\pi n/3},~\forall n,\quad y[n]=\begin{cases}e^{j4\pi n/3}&amp;amp; n=0,1,2,\\0, &amp;amp;\text{otherwise.}\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;$\displaystyle \sum_{n=-\infty}^\infty x[k−n]y[n]= \sum_{n=0}^2 e^{j2\pi (k−n)/3}e^{j4\pi n/3}&#xA;= e^{j2\pi k/3}\sum_{n=0}^2 e^{j2\pi n/3}=0.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally,   &lt;span class=&quot;math-container&quot;&gt;$\displaystyle x[n]=e^{j2\pi n/N},~\forall n,\quad y[n]=\begin{cases}e^{j2\pi (N-n)/N}&amp;amp; n=0,1,2,\ldots, N-1\\0, &amp;amp;\text{otherwise,}\end{cases}$&lt;/span&gt;&#xA;works as a solution for sequences taking on &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; values.&#xA;Of course, nitpickers might argue that y takes on &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; values, not &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;&#xA;as required by the OP, but in the case &lt;span class=&quot;math-container&quot;&gt;$N = 3$&lt;/span&gt;, there is an easy workaround.&#xA;Define &#xA;&lt;span class=&quot;math-container&quot;&gt;$$z[n] = \begin{cases}1, &amp;amp; n = 0,\\&#xA;-e^{j2\pi/3}, &amp;amp; n = 1,\\0, &amp;amp;\text{otherwise,}\end{cases}$$&lt;/span&gt;&#xA;which is clearly a three-valued sequence, and note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\displaystyle \sum_{n=-\infty}^\infty x[k−n]z[n]= &#xA;\sum_{n=0}^1 e^{j2\pi (k-n)/3}z(n) = e^{j2\pi k/3}\cdot 1&#xA;+ e^{j2\pi (k-1)/3}\cdot (-e^{j2\pi/3})&#xA;= e^{j2\pi k/3} - e^{j2\pi k/3} = 0.$$&lt;/span&gt; The real pezzonovante nitpickers&#xA;who wish to complain that the three values that &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; takes on are&#xA;not the same three values that &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; takes on are invited to work out&#xA;a more satisfactory solution for themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is tempting to extend &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; periodically&#xA;to be nonzero for all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; so as to totally avoid the nitpick, but unfortunately,&#xA;the infinite sum &lt;span class=&quot;math-container&quot;&gt;$\sum_{n=-\infty}^\infty e^{j2\pi n/3}$&lt;/span&gt; that is the&#xA;result of the convolution is not absolutely&#xA;convergent.  Of course, since both sequences are of period &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;, their&#xA; convolution could also be &lt;em&gt;defined&lt;/em&gt; as a periodic convolution,&#xA;which is the sum of just &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; terms, and we are back in business.&#xA;More generally, note that the periodic&#xA;convolution of any two rows of the &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; DFT matrix is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;,&#xA;and so we can extend this notion to sequences that take on &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;&#xA;distinct values for any &lt;span class=&quot;math-container&quot;&gt;$N \geq 3$&lt;/span&gt;.  For another viewpoint on this&#xA;approach, see the answer by @Hilmar.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2019-02-16T19:09:00.657" LastActivityDate="2019-02-16T19:09:00.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11538" PostTypeId="2" ParentId="11535" CreationDate="2013-11-07T16:19:50.070" Score="2" Body="&lt;p&gt;Take a relatively lengthy snapshot of the signal and make the sample rate an integer multiple of the symbol rate.  Work with the snapshot in Matlab or Octave and figure out how to demodulate it there.  That will involve eliminating the carrier offset and phase, and finding the correct symbol timing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you are able to do it by hand, you will be in much better shape to create a demodulator that can do it automatically.  There will still be a lot of things that you will need to learn, but you will at least have a better grasp on what questions to ask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/8462/923&quot;&gt;This answer&lt;/a&gt; may help too.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-11-07T16:19:50.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11539" PostTypeId="2" ParentId="11518" CreationDate="2013-11-07T17:05:41.347" Score="2" Body="&lt;p&gt;Here is two example that actually works with 3 distinct values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x1 = [0 0.866 .866 0 -.866 -.866 0 0.866 .866 0 -.866 -.866]   etc (periodic)&#xA;x2 = [1 -.5 0.5 .5]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x1 = [0 0.866 -.866 0.866 -.866 0 .866 -.866]   etc (periodic)&#xA;x2 = [1 1.5 1.5 .5]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.866 is short for  sqrt(3/4). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the reasoning behind this: Convolution in the time domain is multiplication in the frequency domain. In order to get a zero result, the two signals must be spectrally &quot;disjointed&quot;, i.e. at least one of the spectra must be zero at any one frequency. Now finite time domain signals have continuous spectra. They may have discrete zeros in the spectra but two continuous spectra can not be disjointed at all frequencies and so we can conclude that at least one signal needs to be periodic (and hence infinite). Periodic signals have discrete spectra. As Dilip has pointed out, if both signals are periodic, the standard convolution is periodic as well and the sum doesn't converge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the best way to do this is to make one signal that's periodic and a second finite signal that is an FIR filter that has it's zeros at the discrete frequencies of the periodic signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;three distinct value&quot; constraint adds an extra complication. We can certainly make a periodic signal that has only three distinct values by picking any three numbers and just repeat them. However that makes for a complicated spectrum so let's stick with sine waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some choices are: 2*pi/3 with any phase, 2*pi/4 with 0 phase, or 2*pi/6 with 0 phase. Each of this will only have three distinct values. We can construct the matching FIR filter by simply putting a conjugate pair of zeros on the unit circle at these frequencies. We get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2*pi/3 -&amp;gt; [ 1 1 1]&#xA;2*pi/4 -&amp;gt; [ 1 0 1]&#xA;2*pi/6 -&amp;gt; [1 -1 1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These FIR filters have zeros for matching frequencies. However they don't have three distinct values. In order to fix this we can arbitrarily throw in a another real zero anywhere just to shuffle the values around. As it turns out an added zero at -0.5 does the trick for 2*pi/3 and 2*pi/6. This zero doesn't do anything useful other than garbling up the FIR filter numbers a bit to satisfy the really arbitrary &quot;3 distinct numbers&quot; constraint.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2013-11-07T21:25:29.973" LastActivityDate="2013-11-07T21:25:29.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11540" PostTypeId="2" ParentId="8492" CreationDate="2013-11-07T17:17:29.560" Score="2" Body="&lt;p&gt;Unfortunately I can't come up with an intuitive explanation for this, but lemme try to prove this. During reading please be very careful with indexes as they can be confusing! I use zero-based indexing. And please correct me if I'm wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;img src=&quot;https://i.stack.imgur.com/avQqr.gif&quot; alt=&quot;eq1&quot;&gt; be our undiluted time domain of N elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, diluted vector looks like this: &lt;img src=&quot;https://i.stack.imgur.com/Fvjct.gif&quot; alt=&quot;eq2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency spectrum of &lt;strong&gt;x&lt;/strong&gt; is given by &lt;img src=&quot;https://i.stack.imgur.com/TiBaX.gif&quot; alt=&quot;eq3&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency spectrum of &lt;strong&gt;y&lt;/strong&gt;, teh diluted x is &lt;img src=&quot;https://i.stack.imgur.com/70pXD.gif&quot; alt=&quot;eq4&quot;&gt;. Note the length of Y equals 2N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'd like to prove that the right half of the diluted frequency domain is &quot;copied&quot; from the left half, that is &lt;img src=&quot;https://i.stack.imgur.com/e2wWO.gif&quot; alt=&quot;eq5&quot;&gt;. I guess it's sufficent to prove only the last equation, but the first two are good for grasping the idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By expanding a sum for Y[0] and Y[N] we get: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HboL1.gif&quot; alt=&quot;eq6&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wHFcL.gif&quot; alt=&quot;eq7&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that Y[0] and Y[N] are equal can easily be seen by noticing that &lt;img src=&quot;https://i.stack.imgur.com/CkTAk.gif&quot; alt=&quot;eq8&quot;&gt; because of it's periodic nature- see Euler's relation: &lt;img src=&quot;https://i.stack.imgur.com/AdQcN.gif&quot; alt=&quot;euler&amp;#39;s relation&quot;&gt;. Later we will exploit this property of exp(j*phi) to &quot;move&quot; exponent back or forward by 2nPi.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next (unnecessary, but good to examine) step is to prove that Y[1] = Y[N+1]. Let's expand:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Sykqw.gif&quot; alt=&quot;eq10&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9F4hI.gif&quot; alt=&quot;eq11&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because Y[1] = Y[N+1] must hold regardless of &lt;strong&gt;x&lt;/strong&gt; values, the only way that it can do so is when exponents next to proper xn's are equal. Let's prove that &lt;img src=&quot;https://i.stack.imgur.com/3a1rU.gif&quot; alt=&quot;eq12&quot;&gt;. If we can do this, then when a=0, we prove that exponents next to x0 in Y[1] and Y[N+1] are equal. When a=1, exponents near x1 are proven to be equal and so on, until a=N-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sGN6o.gif&quot; alt=&quot;eq13&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, it was not hard. It's more like showing than proving. If you are wondering why did 2pi*a dissapear, look again at the Euler's relation and maybe rewrite the middle step of the proof in cos - isin form. It should be clearer now that you can add or subtract 2pi from argument of the sine or cosine function without affecting it's value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay, let's move on to the next, (the only necessary) part. Y[k]=Y[k+N].&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4qYiT.gif&quot; alt=&quot;eq14&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/787NB.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like the last time, let's show equality of exponentials near xn's:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/oDpzz.gif&quot; alt=&quot;eq16&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is the same, only the last point has the least numbers and the most variables, making it the most general case. It's general enough that I think it's the end of the proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps :)&lt;/p&gt;&#xA;" OwnerUserId="5900" LastActivityDate="2013-11-07T17:17:29.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11541" PostTypeId="1" CreationDate="2013-11-07T17:54:52.863" Score="3" ViewCount="648" Body="&lt;p&gt;I have a half second audio data sampled at $44.1\textrm{ kHz}$. If I FFT it I get frequency components in $2\textrm{ Hz}$ increments. Now suppose I want the component of an arbitrary frequency, like $32.45\textrm{ Hz}$, how can I get it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the DFT formula from Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X_k = \sum_{n=0}^{N-1} x_n e^{-i 2 \pi k n / N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wondered, what if I calculate the relevant $k$ and plug it into the equation? Like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;{32.45 \times 22050 \over 44100} = 16.225\quad \textrm{then}\quad X_{16.225} = \sum_{n=0}^{N-1} x_n e^{-i 2\pi \times 16.225 n / N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;would that get me what I want?&lt;/p&gt;&#xA;" OwnerUserId="5882" LastEditorUserId="1629" LastEditDate="2016-08-06T17:58:20.623" LastActivityDate="2016-08-06T19:48:18.300" Title="Getting an specific frequency component from sampled audio" Tags="|discrete-signals|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11542" PostTypeId="2" ParentId="11541" CreationDate="2013-11-07T18:37:58.963" Score="5" Body="&lt;p&gt;The commonly used Goertzel filter (or algorithm) used to detect a single frequency component is essentially a computational optimization of computing 1 bin of a DFT this way.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a both a Goertzel filter and 1 bin of an un-windowed (or rectangular windowed) DFT don't just respond to a single frequency, but have a non-zero bandwidth filter response in the shape of a Sinc function, with most of the main lobe response on the order of Fs/N wide.  So the 32 Hz bin of your half-second-long FFT will contain most of a 32.45 Hz component, as well as vice versa with the Goertzel result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if the k is fractional, or not integer, which corresponds to a Goertzel filter length that is not an exact integer multiple of the period of the frequency in question, there will be some dependency of the magnitude result on the phase of the frequency component with respect to some point in the sampling window (say, the start).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, unlike with a full FFT, 1 bin of a DFT won't tell you whether the measured component is significant compared to adjacent frequencies (is a peak), or to the rest of the signal (is above the noise floor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But otherwise, yes.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-08-06T19:48:18.300" LastActivityDate="2016-08-06T19:48:18.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11544" PostTypeId="1" CreationDate="2013-11-07T20:08:40.633" Score="3" ViewCount="7714" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;A band limited signal of $5$ kHz is observed at the output node whose sampling frequency is $600$ kHz. What is the minimum order of the filter?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does it mean:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;a signal that is from $0$ to $5$ kHz on the frequency axis when drawn&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a signal from $-2.5$ kHz to $2.5$ kHz&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a signal with bandwidth of $5$ kHz centered anywhere&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5905" LastEditorUserId="13309" LastEditDate="2017-08-19T22:13:27.183" LastActivityDate="2017-08-19T22:13:27.183" Title="what does the statement &quot;band limited signal of 5 KHz&quot; mean" Tags="|signal-analysis|bandpass|bandwidth|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11545" PostTypeId="2" ParentId="11513" CreationDate="2013-11-07T20:14:16.027" Score="1" Body="&lt;p&gt;If the harmonics are exactly harmonic (and not slightly inharmonic as produced by many physical systems), and you have a good frequency estimate of a strong harmonic, such that that harmonic frequency estimate fits within a unique integer multiple of the search range of the fundamental frequency, then you can just divide by that integer multiple to get a frequency estimate of the fundamental.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have a frequency estimate, you can then compute a magnitude estimate using 1 bin of a DFT or a Goertzel filter with a length that is exactly an integer multiple of the period of that frequency estimate. (... or 3 very close lengths followed by parabolic peak interpolation.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-07T20:14:16.027" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11546" PostTypeId="1" CreationDate="2013-11-07T21:24:46.797" Score="7" ViewCount="3548" Body="&lt;p&gt;I am trying to code a simple algorithm in MATLAB that would be used to detect a single word.  The goal would be to have a user record the word one time to act as a template, then make the user repeat the same word to try and detect it. Searching on this website has answered many of my questions, but I still have some interrogations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far my algorithm calculates the MFCC's in the following way:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Extract the data from a .wav file (recorded at $8000\textrm{ Hz}$)&lt;/li&gt;&#xA;&lt;li&gt;Build frames of $64\textrm{ ms}$ with a $50\%$ overlap, applying a Hann window&lt;/li&gt;&#xA;&lt;li&gt;Calculate the FFT of all these frames&lt;/li&gt;&#xA;&lt;li&gt;Calculate the Power Spectrum using the FFT results ($P(k) = \lvert X(k)\rvert^2$)&lt;/li&gt;&#xA;&lt;li&gt;For each frame, extract 26 coefficients by multiplying the Power Spectrums with the 26 Mel filters and summing the results for a given Mel filter&lt;/li&gt;&#xA;&lt;li&gt;Calculate the $\log_{10}$ of the coefficients&lt;/li&gt;&#xA;&lt;li&gt;Apply a dct on a frame's 26 coefficients&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My goal was to use the MFCC's of the template as well as the MFCC's of the repeated work and compare them using a DWT algorithm. My DWT algorithm is already programmed and functional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, my algorithm does not work very well and it seems like certain parameters affect the results quite a lot. Here are my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Are these steps enough to detect a spoken word? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Would it be better to use a large number of fixed templates instead of having the user pre-record a template? Which method should result in better recognition performance?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the person repeats the word using a different distance from the microphone, the increased/decreased values of the MFCC's are enough to mess up the DTW results. Is there a smart way to normalize the MFCCs to try and cancel the effect of the microphone distance?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Some websites recommend using only the 13 MFCC's with the smallest values. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why is that? &lt;/li&gt;&#xA;&lt;li&gt;Also, are they talking about the smallest magnitudes, or the smallest values? &lt;/li&gt;&#xA;&lt;li&gt;Assuming 13 MFCC's are very big negative numbers, while 13 other MFCC's are small positive numbers, which set would I keep?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Also, the first coefficient of each frame is always much bigger than the other coefficients. I would say it's magnitude is bigger my a factor of 100. Obviously, when I caculate the DTW using Euclidian distance, I'd say this coefficient is the only relevant one since it is so much bigger than all the other values. Should it be discarded?&lt;/p&gt;&#xA;" OwnerUserId="5907" LastEditorUserId="1629" LastEditDate="2016-11-14T23:45:24.613" LastActivityDate="2016-11-14T23:45:24.613" Title="Using DTW on the MFCC's to match a spoken word to a template" Tags="|speech|mfcc|template-matching|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11547" PostTypeId="1" AcceptedAnswerId="11550" CreationDate="2013-11-07T23:03:29.833" Score="3" ViewCount="1298" Body="&lt;p&gt;What this relation on picture mean? Why response for a digital low-pass filter exists on &quot;-&quot; side of x axis? Impulse starts at 0 as i can understand and goes to infinity... &#xA;Please use phrases starting with &quot;think of it this way...&quot; or &quot;it's like...&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t8cYz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5589" LastActivityDate="2013-11-08T03:13:11.460" Title="Why sinc function defined on minus side?" Tags="|filters|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11549" PostTypeId="2" ParentId="11547" CreationDate="2013-11-08T01:06:57.493" Score="0" Body="&lt;p&gt;If you want a linear phase filter, then the impulse response has to be symmetric (or anti-symmetric), starting, not at zero on your graph, but at -10.  You can apply it as a FIR kernel in non-real-time, or in real time with a 10 unit or greater delay.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-08T01:06:57.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11550" PostTypeId="2" ParentId="11547" CreationDate="2013-11-08T03:13:11.460" Score="4" Body="&lt;p&gt;As it relates to &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_filter&quot; rel=&quot;nofollow&quot;&gt;linear filtering&lt;/a&gt;, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow&quot;&gt;sinc function&lt;/a&gt; often comes up because it is &lt;a href=&quot;http://en.wikipedia.org/wiki/Impulse_response&quot; rel=&quot;nofollow&quot;&gt;impulse response&lt;/a&gt; of an ideal &lt;a href=&quot;http://en.wikipedia.org/wiki/Lowpass_filter&quot; rel=&quot;nofollow&quot;&gt;lowpass filter&lt;/a&gt; (i.e. one that has a perfectly flat &lt;a href=&quot;http://en.wikipedia.org/wiki/Passband&quot; rel=&quot;nofollow&quot;&gt;passband&lt;/a&gt; and a &lt;a href=&quot;http://en.wikipedia.org/wiki/Transition_band&quot; rel=&quot;nofollow&quot;&gt;transition region&lt;/a&gt; of zero width). In many applications, having such a filter response would be a great tool, as you could perfectly excise any out-of-band interference without disturbing a signal's passband &lt;em&gt;at all&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;, there's a problem, as you noted in your question: $\text{sinc}(t)$ has infinite support! In other words, the impulse response of an ideal lowpass filter is infinitely long. That's not necessarily an issue (a lot of filters have infinitely-long impulse responses), but the big problem is that if the filter is &lt;a href=&quot;http://en.wikipedia.org/wiki/Causal_filter&quot; rel=&quot;nofollow&quot;&gt;causal&lt;/a&gt; (which it certainly must be in order to be realizable), then it will have infinite delay. So, if you were clever enough to build such a contraption, you would find that you would need to wait an infinite amount of time in order to see the filter's response for a given input signal. That tends to make such an idealized filter less useful in practice (even if you could build it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, while an ideal filter may not be practical, an &lt;em&gt;approximation&lt;/em&gt; to an ideal filter can be. One simple way of designing filters, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_design_method#Window_design_method&quot; rel=&quot;nofollow&quot;&gt;window method&lt;/a&gt;, relies upon taking some filter prototype (an ideal lowpass filter, for instance) and multiplying its impulse response by a finite-length &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window function&lt;/a&gt;. The specific window function used will affect the properties of the resulting filter, but the typical goal is to approximate the prototype filter's response with something that is actually realizable.  As a result, a windowed ideal lowpass filter will still have an impulse response that looks $\text{sinc}$-like over some finite-length interval. Since a causal filter's impulse response starts at $t=0$, the main lobe of the impulse response won't occur until some later time; this is what manifests itself as filter delay. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot that you showed is for $\text{sinc}(t)$, which is the ideal, noncausal ideal lowpass filter's impulse response. Translating that to an implementable approximation requires truncating its response to a finite length (i.e. through windowing it) and shifting its response along the time axis so that the filter is causal (after shifting, its response would begin at $t=0$ as you expect).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-11-08T03:13:11.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11552" PostTypeId="2" ParentId="11544" CreationDate="2013-11-08T05:27:05.433" Score="1" Body="&lt;p&gt;The nature of the words in the question is slightly ambiguous.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A Band-limited signal of bandwidth 5Khz means that the signal can be centered at any frequency but its extent around that frequency is 5Khz.&lt;/li&gt;&#xA;&lt;li&gt;A Band-limited signal of 5Khz is also used to represent a signal which is having a center frequency of 5Khz but which has a fixed band-width.&lt;/li&gt;&#xA;&lt;li&gt;It surely does not mean -2.5 to 2.5 because when mentioning the band-width usually the positive frequencies alone are counted.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would advice you to revisit the text and look with respect to the above points.&lt;/p&gt;&#xA;" OwnerUserId="3566" LastActivityDate="2013-11-08T05:27:05.433" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11553" PostTypeId="2" ParentId="11541" CreationDate="2013-11-08T06:19:19.133" Score="0" Body="&lt;p&gt;Yes, you can compute a single-bin DFT at ANY frequency, as mentioned in &lt;a href=&quot;https://dsp.stackexchange.com/questions/3301/is-there-an-algorithm-to-compute-the-phase-for-a-single-frequecy/&quot; title=&quot;this post&quot;&gt;this post&lt;/a&gt;, and a &lt;a href=&quot;https://dsp.stackexchange.com/questions/7535/best-window-for-close-frequency-components/7592#7592&quot;&gt;related post&lt;/a&gt;.  After all, F = k*f_s/N, where f_s is the sampling frequency and N is the number of points.  Since f_s and N are known, just compute the value of k you need to get the frequency you want.  It's basically putting down a single bin DFT centered at frequency F.  And the 'bin width' is the same as what you'd get with any other DFT bin based on N points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the advent of FFT, people have become accustomed to thinking of the parameter 'k' (the frequency index) as being an integer.  However, if you think of a DFT calculation as being like a correlation, then you can think of it as answering the question: does my time record look like a sine or cosine wave of a specific frequency?  So, no matter what the value of 'k' is, and no matter if you have an integer number of cycles in your input or not - for example, 3.7825 cycles in your input will correlate quite well with 3.7825 cycles of the sine and cosine wave of your DFT bin.  You just have to figure out what value of 'k' to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for phase - well, whether for a full DFT, single-bin DFT or FFT - you've DEFINED the time = 0 point (you have a data point x(0), don't you?), and phase will be relative to that point.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-11-08T06:19:19.133" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11554" PostTypeId="1" AcceptedAnswerId="11558" CreationDate="2013-11-08T08:55:04.757" Score="13" ViewCount="44439" Body="&lt;p&gt;In &lt;a href=&quot;https://dsp.stackexchange.com/questions/6038/fourier-transform-of-cosine-to-the-power-of-3&quot;&gt;this&lt;/a&gt; answer, Jim Clay writes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... use the fact that $\mathcal F\{\cos(x)\} = \frac{\delta(w - 1) + \delta(w + 1)}{2}$ ...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The expression above is not too different from $\mathcal F\{{\cos(2\pi f_0t)\}=\frac{1}{2}(\delta(f-f_0)+\delta(f+f_0))}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying to obtain the later expression by using the standard definition of the Fourier transform $X(f)=\int_{-\infty}^{+\infty}x(t)e^{-j2\pi ft}dt$ but all I end up with is an expression so different from what's apparently the answer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;x(t)&amp;amp;=\cos(2\pi f_0t)\\&#xA;\Longrightarrow \mathcal F\left\{x(t)\right\}&amp;amp;=\int_{-\infty}^{+\infty}\cos(2\pi f_0t)e^{-j2\pi ft}dt\\&#xA;&amp;amp;=\int_{-\infty}^{+\infty}\frac 12 \left(e^{-j2\pi f_0t}+e^{j2\pi f_0t}\right)e^{-j2\pi ft}dt\\&#xA;&amp;amp;=\frac{1}{2}\int_{-\infty}^{+\infty}\left(e^{-j2\pi f_0t}e^{-j2\pi ft}+e^{j2\pi f_0t}e^{-j2\pi ft}\right)dt\\&#xA;&amp;amp;=\frac{1}{2}\int_{-\infty}^{+\infty}\left(e^{-j2\pi t\left(f_0+f\right)}+e^{-j2\pi t\left(f-f_0\right)}\right)dt\\&#xA;&amp;amp;=\frac{1}{2}\left(\int_{-\infty}^{+\infty}\left(e^{-j2\pi t(f_0+f)}\right)dt+\int_{-\infty}^{+\infty}\left(e^{-j2\pi t(f-f_0)}\right)\right) dt&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where I'm stuck.&lt;/p&gt;&#xA;" OwnerUserId="5590" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2021-08-25T02:27:05.857" Title="Deriving the Fourier transform of cosine and sine" Tags="|continuous-signals|fourier|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11556" PostTypeId="1" CreationDate="2013-11-08T10:42:38.480" Score="1" ViewCount="341" Body="&lt;p&gt;I am trying to implement the symbol timing recovery loop and for that I have chosen two algorithm to compare my results one is feedforward and Gardner TED. One thing that is confusing me is smoothing of error after finding timing error and finding the right sampler. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I use the sampler after matched filter or before matched filter?&#xA;how the new timing is computed from the timing error?&lt;/p&gt;&#xA;" OwnerUserId="5817" LastEditorUserId="13320" LastEditDate="2016-05-13T10:39:05.723" LastActivityDate="2016-05-13T10:39:05.723" Title="Symbol timing recovery algorithms" Tags="|estimation|decimation|synchronization|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="11557" PostTypeId="2" ParentId="11554" CreationDate="2013-11-08T12:39:47.867" Score="3" Body="&lt;p&gt;Then just use a table of &lt;a href=&quot;http://uspas.fnal.gov/materials/11ODU/FourierTransformPairs.pdf&quot; rel=&quot;nofollow&quot;&gt;Fourier transform pairs&lt;/a&gt; to see that $\delta(t) \leftrightarrow 1$, and variable substitution ($f_1 = f+f_0$ and $f_2 = f-f_0$), to get what you need.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-08T12:39:47.867" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11558" PostTypeId="2" ParentId="11554" CreationDate="2013-11-08T13:46:51.873" Score="19" Body="&lt;p&gt;Your work is OK except for the problem that the Fourier transform of &#xA;$\cos(2\pi f_0 t)$ does not exist in the usual sense of a &lt;em&gt;function&lt;/em&gt; of $f$,&#xA;and we have to extend the notion to include what are called distributions,&#xA;or impulses, or Dirac deltas, or (as we engineers are wont to do, much&#xA;to the disgust of mathematicians) delta &lt;em&gt;functions.&lt;/em&gt;  Read&#xA;about the conditions that must be satisfied in order for the Fourier &#xA;transform $X(f)$ of the signal $x(t)$ to exist (in the usual sense)&#xA;and you will see that $\cos(2\pi f_0 t)$ does not have a Fourier transform&#xA;in the usual sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning to your specific question, once you understand that impulses&#xA;are defined only in terms of how they behave as integrands in an&#xA;integral, that is, for $a &amp;lt; x_0 &amp;lt; b$,&#xA;$$\int_{a}^{b} \delta(x-x_0)g(x)\,\mathrm dx = g(x_0)$$&#xA;provided that $g(x)$ is continuous at $x_0$, then&#xA;it is easier to &lt;em&gt;deduce&lt;/em&gt; the Fourier transform of &#xA;$$\cos(2\pi f_0 t) &#xA;= \left.\left.\frac{1}{2}\right[e^{j2\pi f_0 t} + e^{-j2\pi f_0 t}\right]$$&#xA;by musing on the fact that&#xA;$$\int_{-\infty}^\infty \delta(f-f_0)e^{j2\pi ft}\,\mathrm df = e^{j2\pi f_0t}$$&#xA;and so it must be that $\cos(2\pi f_0 t)$ is the &lt;em&gt;inverse&lt;/em&gt;&#xA;Fourier transform of $\displaystyle \left.\left.\frac{1}{2}\right[\delta(f-f_0) + \delta(f+f_0)\right]$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-11-08T15:06:43.790" LastActivityDate="2013-11-08T15:06:43.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11559" PostTypeId="1" AcceptedAnswerId="11563" CreationDate="2013-11-08T15:35:01.543" Score="1" ViewCount="8091" Body="&lt;p&gt;I am studying wavelets in image processing. I would like to learn how to downsample a matrix in columns using MATLAB. I have used the &lt;code&gt;downsample(x,n)&lt;/code&gt; command to downsample the given matrix in rows. But how to do the same in columns? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;x =&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 1     2     3&#xA; 4     5     6&#xA; 7     8     9&#xA;10    11    12&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;y = downsample(x,2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y =&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 1     2     3&#xA; 7     8     9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I would like to get the following result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=&#xA;     1       3&#xA;     4       6&#xA;     7       9&#xA;    10      12&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to do it in MATLAB? Please help.&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="5800" LastEditDate="2013-11-08T16:34:07.713" LastActivityDate="2014-12-13T10:41:16.230" Title="How to downsample a matrix in columns ? MATLAB" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="0" ClosedDate="2014-12-13T19:23:29.117" ContentLicense="CC BY-SA 3.0" />
  <row Id="11560" PostTypeId="1" AcceptedAnswerId="11562" CreationDate="2013-11-08T16:12:03.697" Score="19" ViewCount="18410" Body="&lt;p&gt;Here is a sinusoid of frequency &lt;code&gt;f = 236.4 Hz&lt;/code&gt; (it is 10 milliseconds long; it has &lt;code&gt;N=441&lt;/code&gt; points at sampling rate &lt;code&gt;fs=44100Hz&lt;/code&gt;) and its DFT, &lt;strong&gt;without zero-padding&lt;/strong&gt; :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qSUV6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only conclusion we can give by looking at the DFT is: &quot;The frequency is approximatively 200Hz&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the signal and its DFT, &lt;strong&gt;with a large zero-padding&lt;/strong&gt; :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/b3k87.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now we can give a much more precise conclusion&lt;/strong&gt; : &quot;By looking carefully at the maximum of the spectrum, I can estimate the frequency 236Hz&quot; (I zoomed and found the maximum is near 236).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is : &lt;strong&gt;why do we say that &quot;zero-padding doesn't increase resolution&quot;&lt;/strong&gt; ? (I have seen this sentence very often, then they say &quot;it only adds interpolation&quot;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;=&gt; With my example, zero-padding helped me to find the right frequency with a more precise resolution !&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2018-07-21T17:34:21.547" LastActivityDate="2018-07-23T23:52:18.620" Title="Why do we say that &quot;zero-padding doesn't really increase frequency resolution&quot;" Tags="|fft|fourier-transform|signal-analysis|dft|zero-padding|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11561" PostTypeId="1" AcceptedAnswerId="11564" CreationDate="2013-11-08T16:14:21.247" Score="0" ViewCount="171" Body="&lt;p&gt;I need to record sound using 2 (or 4, eventually) microphones and then calculate the time delay of arrival of sound at the different microphone pairs. But first, I need a microphone array. And since I'm just starting out, I would like to connect just 2 mics first and calculate the time at which sound arrives at them.&#xA;Can I do this using a sound card?&#xA;And I heard sound cards will have typically one or two input channels. What are these then? &lt;a href=&quot;http://www.ebay.com/bhp/external-sound-card-for-laptop&quot; rel=&quot;nofollow&quot;&gt;http://www.ebay.com/bhp/external-sound-card-for-laptop&lt;/a&gt;&#xA;The 'channels' mentioned along with the above devices are not exactly input channels?&lt;/p&gt;&#xA;" OwnerUserId="5116" LastActivityDate="2013-11-08T17:22:27.273" Title="Sound card for recording audio" Tags="|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11562" PostTypeId="2" ParentId="11560" CreationDate="2013-11-08T16:21:49.913" Score="24" Body="&lt;p&gt;&lt;em&gt;Resolution&lt;/em&gt; has a very specific definition in this context. It refers to your ability to &lt;em&gt;resolve&lt;/em&gt; two separate tones at nearby frequencies. You have increased the sample rate of your spectrum estimate, but you haven't gained any ability to discriminate between two tones that might be at, for instance, 236 Hz and 237 Hz. Instead, they will &quot;melt together&quot; into a single blob, no matter how much zero-padding you apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution to increasing resolution is to observe the signal for a longer time period, then use a larger DFT. This will result in main lobes whose width are inversely proportional to the DFT size, so if you observe for long enough, you can actually resolve the frequencies of multiple tones that are nearby one another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see how this plays out, here's a plot of the zoomed-in FFT of the addition of two signals: your original sinusoid, and one that differs in frequency from it by 0 to 100 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's only towards the 100Hz difference end of the plot (left-hand side here) that you can distinguish (resolve) the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scilab code for generating the plot below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gdFVI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = 236.4;&#xA;d = 10;&#xA;N=441;&#xA;fs=44100;&#xA;extra_padding = 10000; &#xA;&#xA;t=[0:1/fs:(d/1000-1/fs)]&#xA;ff = [0:(N+extra_padding-1)]*fs/(N+extra_padding);&#xA;&#xA;x = sin(2*%pi*f*t);&#xA;&#xA;XX = [];&#xA;&#xA;for delta_f = [0:100];&#xA;    y = sin(2*%pi*(f+delta_f)*t);&#xA;    FFTX = abs(fft([x+y zeros(1,extra_padding)]));&#xA;    XX = [XX; FFTX];&#xA;end&#xA;&#xA;mtlb_axis([0 1300 0 500])&#xA;&#xA;figure(1);&#xA;clf&#xA;[XXX,YYY] = meshgrid(ff,0:100);&#xA;mesh(XXX(1:100,[50:90]),YYY(1:100,[50:90]),XX(1:100,[50:90]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="90" LastEditorUserId="80" LastEditDate="2013-11-08T21:29:41.340" LastActivityDate="2013-11-08T21:29:41.340" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="11563" PostTypeId="2" ParentId="11559" CreationDate="2013-11-08T16:37:53.453" Score="3" Body="&lt;p&gt;Maybe Off-Topic here, but anyway !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try it  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = downsample(x',2)'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-11-08T16:37:53.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11564" PostTypeId="2" ParentId="11561" CreationDate="2013-11-08T17:22:27.273" Score="1" Body="&lt;p&gt;The number of channels mentioned in the products you linked refer to output channels. A Dolby 5.1 system has 6 speakers (center, rear R/L, front R/L, subwoofer), thus 6 channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're looking for ist usually called &lt;em&gt;audio interface&lt;/em&gt; and mostly used in music production studios. Manufacturers are M-Audio, Roland, Behringer (cheap), Focusrite and many more. You can get an overview &lt;a href=&quot;http://www.thomann.de/gb/audio_interfaces1.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. From your previous question I assume that your application is speaker localization. Therefore you probalby don't need high-class converters and pre-amplifiers. If you're planning to use Linux it will reduce your choice.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-11-08T17:22:27.273" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11565" PostTypeId="2" ParentId="11506" CreationDate="2013-11-08T18:43:41.243" Score="2" Body="&lt;p&gt;@Peter K &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm replying here because I ran out of space in the comments:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yeah that change you propose to the measurement equations makes perfect sense to me, thanks for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, as for the addition of $Gw_k$ to the state update I have some comments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was under the impression this is added if you assume there are unmodeled dynamics, i.e. your physics are imperfect. In my case I think the only unmodeled dynamic is that the offset will actually change very slowly, so perhaps I could add that in there with a very small variance to account for slow changes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see the need to add it for any of the other states. Let me tell you about my problem: I have an accelerometer and a GPS (permanent sites) and I'm looking at ground motion (shaking) during earthquakes, so I know the noise characteristics of each sensor very well from analyzing quiescent periods, i.e. when there is no shaking. So I could just add that into $R$ no?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Kalman filter is cool because each sensor alone only records in a limited frequency band and the combination of the two produces very broadband recordings of shaking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate your help.&lt;/p&gt;&#xA;" OwnerUserId="5888" LastActivityDate="2013-11-08T18:43:41.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="11566" PostTypeId="2" ParentId="11560" CreationDate="2013-11-08T19:05:37.087" Score="16" Body="&lt;p&gt;The term &quot;resolution&quot; has multiple meanings, which can confuse people trying to communicate when using two different meanings.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the optical sense, of being able to resolve two nearby clearly separated points (or two adjacent peaks in the spectrum) instead of one blurry blob, zero-padding won't help.  This is the meaning most likely being used when stating that zero-padding does not increase resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one's requirement for resolution requires a dip (for instance a minimum 3 dB lowering) between spectral peaks, then the resolution will be even lower than the FFT bin spacing, e.g. not even Fs/N, but 2X to 3X that, or more, depending on the windowing used.  A weaker requirement for resolution might be just the frequency spacing of the DFT's orthogonal basis vectors, e.g. Fs/N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of plotting points, yes, zero-padding will give you more points to plot, as in DPI (plot points per inch) resolution.  That may make it easier to pick out extrema by eyeball.  However they are the same points you would get by doing a very high quality plot interpolation (Sinc interpolation) without any zero-padding, so they really add no information that could not be calculated otherwise without the zero-padding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of pitch tracking, parabolic or Sinc interpolation (interpolation between FFT result bins) of a windowed non-zero-padded FFT result might give you just as good a result as from a more computationally intensive longer zero-padded FFT plot.  Thus zero-padding gives you a &quot;better&quot; pitch tracking result than non-zero-padded and non-interpolated peak picking, but often a lot less efficiently than just using interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you add noise to your example, but slightly less than the signal, you will find that the zero-padded peak can be just as inaccurate as the non-zero padded peak.  So, in the more general case, you may not have found the &quot;right&quot; frequency with any more accuracy than before.  Zero-padding only interpolates the inaccurate result due to noise, which another reason why it is said to not increase resolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2018-07-23T23:52:18.620" LastActivityDate="2018-07-23T23:52:18.620" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="11567" PostTypeId="2" ParentId="6492" CreationDate="2013-11-08T20:01:10.233" Score="2" Body="&lt;p&gt;Recursive sinusoids is the basic principle of FM synthesis (used in famous Yamaha DX7 etc.) : with such synthesis, oscillators (named &quot;operators&quot;) can be added but also embedded like this : &lt;code&gt;sin(sin(t+sin(...))+...)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k0jUX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-11-08T20:01:10.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11568" PostTypeId="1" AcceptedAnswerId="11570" CreationDate="2013-11-09T00:52:32.277" Score="4" ViewCount="9374" Body="&lt;p&gt;Please help me understand the following MATLAB code for Ideal Low pass filter. I am unable to understand the Part2 in the below code. Please explain me why we are doing like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read the Rafael C. Gonzalez's Digital Image Processing Using Matlab 2E which explains my question but I couldn't understand properly. It states that DFTUV Computes meshgrid frequency matrices. I don't understand this &lt;strong&gt;&quot;meshgrid frequency matrices&quot;&lt;/strong&gt;.It will be very much helpful if someone could explain me clearly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; %IDEAL LOW-PASS FILTER&#xA;&#xA;%Part 1&#xA;        function idealfilter(X,P) % X is the input image and P is the cut-off freq&#xA;        f=imread(X);  % reading an image X&#xA;        [M,N]=size(f); % Saving the the rows of X in M and columns in N&#xA;        F=fft2(double(f)); % Taking Fourier transform to the input image&#xA;%Part 2 % I don't understand this part&#xA;        u=0:(M-1);&#xA;        v=0:(N-1);&#xA;        idx=find(u&amp;gt;M/2);&#xA;        u(idx)=u(idx)-M;&#xA;        idy=find(v&amp;gt;N/2);&#xA;        v(idy)=v(idy)-N;&#xA;        [V,U]=meshgrid(v,u);&#xA;        D=sqrt(U.^2+V.^2);&#xA;&#xA;%Part 3&#xA;        H=double(D&amp;lt;=P);       % Comparing with the cut-off frequency &#xA;        G=H.*F;               % Multiplying the Fourier transformed image with H&#xA;        g=real(ifft2(double(G))); % Inverse Fourier transform&#xA;        imshow(f),figure,imshow(g,[ ]); % Displaying input and output image&#xA;        end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to run each commands in Part2 individually for M= 8 and N=8. I get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u=0:(M-1); ==&amp;gt; u = 0 1 2 3 4 5 6 7&#xA;&#xA;v=0:(N-1); ==&amp;gt; v = 0 1 2 3 4 5 6 7&#xA;&#xA;idx=find(u&amp;gt;M/2); ==&amp;gt; idx = 6 7 8 &#xA;&#xA;u(idx)=u(idx)-M; ==&amp;gt; 0 1 2 3 4 -3 -2 -1&#xA;&#xA;idy=find(v&amp;gt;N/2); ==&amp;gt; idy = 6 7 8 &#xA;&#xA;v(idy)=v(idy)-N; ==&amp;gt; 0 1 2 3 4 -3 -2 -1&#xA;&#xA;[V,U]=meshgrid(v,u); ==&amp;gt; &#xA;&#xA;V=&#xA;&#xA;     0     1     2     3     4    -3    -2    -1&#xA;     0     1     2     3     4    -3    -2    -1&#xA;     0     1     2     3     4    -3    -2    -1&#xA;     0     1     2     3     4    -3    -2    -1&#xA;     0     1     2     3     4    -3    -2    -1&#xA;     0     1     2     3     4    -3    -2    -1&#xA;     0     1     2     3     4    -3    -2    -1&#xA;     0     1     2     3     4    -3    -2    -1&#xA;&#xA;U =&#xA;&#xA;     0     0     0     0     0     0     0     0&#xA;     1     1     1     1     1     1     1     1&#xA;     2     2     2     2     2     2     2     2&#xA;     3     3     3     3     3     3     3     3&#xA;     4     4     4     4     4     4     4     4&#xA;    -3    -3    -3    -3    -3    -3    -3    -3&#xA;    -2    -2    -2    -2    -2    -2    -2    -2&#xA;    -1    -1    -1    -1    -1    -1    -1    -1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am unsure why they are doing like this. How it affects the image.Please help me understand. The &lt;code&gt;fftshift&lt;/code&gt; is used to avoid the wraparound error. Is the above operation anyway related to &lt;code&gt;fftshift&lt;/code&gt; command? My understanding is that they are doing this to avoid using the &lt;code&gt;fftshift&lt;/code&gt; command. Thanks in advance. Help me learn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: Rafael C. Gonzalez's Digital Image Processing Using Matlab 2E&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ISXUA.jpg&quot; alt=&quot;DFTUV Computes meshgrid frequency matrices&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="5800" LastEditDate="2013-11-09T01:01:20.763" LastActivityDate="2013-11-09T02:12:21.803" Title="Ideal Low Pass Filter Concept in MATLAB" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11569" PostTypeId="2" ParentId="11568" CreationDate="2013-11-09T02:10:27.487" Score="1" Body="&lt;p&gt;That code is a bit convoluted in its approach. The purpose of all of part 2 is to create the matrix D. The minus signs in matrices U and V end up being irrelevant due to the squaring operation that happens latter. D is a matrix of the squared 'distances' of U and V.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Print out matrix D and take a look at it. Also print out matrix H and look at this, as this is the matrix after it has been filtered. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operation G=H.*F performs the task of filtering certain parts of the Fourier transformed image F. Pixels in a location of the image F will correspond to certain frequencies. Cutting out the lower frequencies around the edges fill have the effect of a low pass filter when the transform is inverted.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2013-11-09T02:10:27.487" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11570" PostTypeId="2" ParentId="11568" CreationDate="2013-11-09T02:12:21.803" Score="3" Body="&lt;p&gt;&lt;code&gt;meshgrid&lt;/code&gt; is simply a way to create a discrete grid. If you think of a regular MATLAB matrix of size MxN, it defines indices from 1 to N in x and from 1 to M in y, with the step size of 1. But let's say you want to evaluate some function f(x,y) on the x-interval [-3, 1] and the y-interval [-1, 2], and you want your step size to be .2.  The &lt;code&gt;meshgrid&lt;/code&gt; helps you create a matrix of all the x-values and a matrix of all the y-values.  If you do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[X,Y] = meshgrid(-3:0.2:1, -1:0.2:2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then easily evaluate your function f(x,y).  For example f(X(1),Y(1)) = f(-3, -1). Of if &lt;code&gt;f&lt;/code&gt; is a vectorized MATLAB function, you should be able to evaluate it on your entire grid with one line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Z = f(X(:), Y(:));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this particular example, the meshgrids contain the indices of the frequency coefficients in the same order used by &lt;code&gt;fft2&lt;/code&gt; function. Remember, the Fourier transform of an image is periodic, it wraps around. For calculations it is convenient to have the zero frequency at (0,0), then the positive frequencies, and then the negative &#xA;frequencies wrapping around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, for visualization it is convenient to have the zero frequency in the center.  This is what the &lt;code&gt;fftshift&lt;/code&gt; function does.  It is used purely for visualization.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-11-09T02:12:21.803" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="11571" PostTypeId="1" CreationDate="2013-11-09T02:54:13.037" Score="0" ViewCount="608" Body="&lt;p&gt;Some methods&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;#1&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;YData = YData / max(abs(YData));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;#2&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;maxYdataAbs = abs(max(YData));&#xA;minYdataAbs = abs(min(YData));&#xA;YData = YData / (0.5*(maxYdataAbs + minYdataAbs));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not happy with neither one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that you have the following data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pn5lV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only one or two sharp peaks.&#xA;I am not happy with #1 or #2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure anymore if the best way is to normalise to the range $[-1,1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How should you normalise such a data?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5633" LastActivityDate="2013-11-09T21:22:54.347" Title="Normalise data which has peaks" Tags="|peak-detection|normalization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11572" PostTypeId="1" AcceptedAnswerId="11574" CreationDate="2013-11-09T05:08:18.603" Score="2" ViewCount="1558" Body="&lt;p&gt;I am on a project of vehicle type Identification (MUV,jeep,Sedan,etc) from images and Here is what I have done up-to now on &lt;code&gt;matlab&lt;/code&gt;.&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working only on the sideview of images.&#xA;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input Image :  Masked image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vqo9g.png&quot; alt=&quot;Input and Masked Images&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&#xA;Then I detected the corners easily&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ucMVO.png&quot; alt=&quot;Corners Detected by harris method&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&#xA;Now I got a matrix &lt;code&gt;C&lt;/code&gt; with &lt;code&gt;40&lt;/code&gt; corner coordinates thus I got a matrix of &lt;code&gt;C=[40x2]&lt;/code&gt;&#xA;&lt;br/&gt;&#xA;I converted it to a linear form using &lt;code&gt;C=C(:);&lt;/code&gt; so I got &lt;code&gt;C=[1x80]&lt;/code&gt; (as Neural Network destroys coordinates information itself) for 1 image&lt;br/&gt;&#xA;But I have about 9 image for each class(MUV,Jeep,Sedan) so I made a matrix using C matrix to form a new matrix say &lt;code&gt;MAT=[9x80]&lt;/code&gt;&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have a corner feature of &lt;code&gt;MAT=[9x80]&lt;/code&gt;&#xA;&lt;br/&gt;&#xA;1. What Other features could I use or the corner feature would itself be fine enough.(may be SURF features)&#xA;&lt;br/&gt;&#xA;2. The Input Format of NN is &lt;code&gt;inMAT=[nxm]&lt;/code&gt; where &lt;code&gt;n=number of features&lt;/code&gt; and &lt;code&gt;m=total images&lt;/code&gt; and target Format is &lt;code&gt;tgMAT=[cxm]&lt;/code&gt; where &lt;code&gt;c=number of classes&lt;/code&gt; (MUV,Sedan,jeep) and 'm=total images'. Am I right here?&#xA;&lt;br/&gt;&lt;/p&gt;&#xA;" OwnerUserId="5265" LastEditorUserId="5265" LastEditDate="2013-11-09T12:15:08.287" LastActivityDate="2013-11-09T14:18:13.360" Title="Using Principal Component Analysis for corner feature extraction" Tags="|image-processing|matlab|computer-vision|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11573" PostTypeId="2" ParentId="6448" CreationDate="2013-11-09T07:43:37.693" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Two important rules should always be followed when designing&#xA;  inspection systems:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;When designing the optical subsystem, try to reduce the demands on the&#xA;  image processor to a trivial level, by giving it the best possible&#xA;  images to analyse.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;When designing the image processor, assume that it will not be&#xA;  possible to obtain images of the same quality in the factory as those&#xA;  produced in the laboratory. Never rely on a 'fragile' algorithm.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;It is almost always cheaper to improve the lighting than the image&#xA;  processing. The effects of varying the lighting can be quite&#xA;  spectacular.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Batchelor, B.G., 1985. &lt;em&gt;Lighting and Viewing Techniques&lt;/em&gt;, in: B.G. Batchelor, D.A. Hill, D.C. Hodgson, ed. &lt;em&gt;Automated visual inspection&lt;/em&gt;. IFS (Publications) Ltd, UK North-Holland. p.104.&lt;/p&gt;&#xA;" OwnerUserId="3573" LastActivityDate="2013-11-09T07:43:37.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11574" PostTypeId="2" ParentId="11572" CreationDate="2013-11-09T14:18:13.360" Score="0" Body="&lt;p&gt;Neural networks can cope with not linearly separable classes, but they're not magic either. They still assume smooth decision boundaries, and I don't think your data would have those. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And before you try to feed the same data to an SVM, RVM, random forest, or any other classifier: I don't think the corner coordinates are good features for any off-the-shelf classification algorithm. The typical input vector in machine learning is something like &lt;em&gt;{age,weight,height,eye color}&lt;/em&gt;, where for every input vector, index 2 means &quot;weight&quot;. In your input vector, index 2 can sometimes be a corner somewhere near the front wheel of the car, and in another case it's a corner near the roof. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you tried simpler shape descriptors, like Fourier descriptors or maybe Hu moments?&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2013-11-09T14:18:13.360" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="11575" PostTypeId="1" AcceptedAnswerId="11578" CreationDate="2013-11-09T14:39:10.297" Score="0" ViewCount="116" Body="&lt;p&gt;I am not very good at mathematics&lt;br/&gt;&#xA;I was doing some image processing so I came to know about &lt;code&gt;FFT&lt;/code&gt; and &lt;code&gt;IFFT&lt;/code&gt;&lt;br/&gt;&#xA;I was learning about them but the mathematics involved seems to be too dense&lt;br/&gt;&#xA;So can someone tell me about what are &lt;code&gt;FFT&lt;/code&gt; and &lt;code&gt;IFFT&lt;/code&gt; and their general application in short in &lt;strong&gt;LayMan's Language&lt;/strong&gt;&lt;br/&gt;&#xA;So that again when I go to learn it I get it a little easier.&lt;br/&gt;&#xA;thanks&lt;/p&gt;&#xA;" OwnerUserId="5265" LastActivityDate="2013-11-10T06:41:24.207" Title="Reason of Fast Fourier and Inverse Fast Fourier" Tags="|image-processing|fourier-transform|fourier-series|" AnswerCount="2" CommentCount="1" ClosedDate="2013-11-14T22:03:20.797" ContentLicense="CC BY-SA 3.0" />
  <row Id="11576" PostTypeId="1" CreationDate="2013-11-09T14:58:16.753" Score="4" ViewCount="3105" Body="&lt;p&gt;I want to write continuous wavelet transform  codes manually by matlab. And I want to use complex morlet function. Here are some background:&lt;br&gt;&#xA;Continuous wavelet transform definition: $C(S,T;f(t),\psi (t))=\frac{1}{\sqrt{S}}\int_{S}^{b}f(t)\psi^{\ast }(\frac{t-T}{S})$&lt;br&gt;&#xA;S is scale vector.for example &lt;code&gt;1:60;&lt;/code&gt;$T$ is time slid. &#xA;And $\psi(t)= \frac{1}{\sqrt{\pi f_{b}}}e^{2\pi f_{c} t}e^{\frac{-t^{2}}{f_{b}}}$ &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;psi = ((pi*fb)^(-0.5)).*exp(2*1i*pi*fc.*t).*exp(-t.^2/fb); % for example fb=15;fc=1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my discrete signal has $N$ points. discrete version of that integral for the first element in the scale vector  is:  &lt;code&gt;for s(i)&lt;/code&gt;&lt;br&gt;&#xA;$C_{T}(s)=\sum_{n=0}^{N-1}f(n)\psi^{*}(\frac{T-n}{S})$ this must calculate for all scales,&lt;code&gt;1:60;&lt;/code&gt;&lt;br&gt;&#xA;at the end it must return me a complex matrix with $N\times S$ size.&#xA;I am confused about wrting this codes. Anyone can help?&lt;br&gt;&#xA;P.S I don't want to uses matlab function &lt;code&gt;conv2&lt;/code&gt; to calculate that convolution.&lt;br&gt;&#xA;Thanks in advance.&#xA; here is my first attempt, but it's not working at all. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% user CWT&#xA;clear all&#xA;N=300;                %sample point numbers&#xA;t=linspace(0,30,N);&#xA;%% signal&#xA;x=5*sin(2*pi*0.5*t);  % signal with freq of 0.5 HZ&#xA;%% cwt&#xA;    fc=1;fb=15;&#xA;% psi=((pi*fb)^(-0.5)).*exp(2*1i*pi*fc.*...&#xA;%     t).*exp(-t.^2/fb);&#xA;%% convolution Psi([N-n]/S)*x(n) so we calculate convolution(psi(n/s),x(n))&#xA;    for s=1:60   %scale vector s=[1:1:60]&#xA;for i = 1:N      % number of discrete times&#xA;       for k = 1:i &#xA;               if ((i-k+1)&amp;lt;N+1) &amp;amp;&amp;amp; (k &amp;lt;N+1)&#xA;                PSI = ((pi*fb)^(-0.5)).*exp(2*1i*pi*fc.*...&#xA;       (t/s)).*exp(-(t/s).^2/fb);   &#xA;                        c(i,s) = c(i)+ x(k)*PSI(i-k+1);&#xA;                end&#xA;       end&#xA;end&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-11-09T18:02:32.640" LastActivityDate="2013-11-25T21:18:11.123" Title="inquiries for writing continuous wavelet transform codes manually" Tags="|matlab|frequency-spectrum|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11577" PostTypeId="1" CreationDate="2013-11-09T15:15:55.037" Score="1" ViewCount="707" Body="&lt;p&gt;I'm trying to find the fundamental frequencies present in a piano recording using MATLAB. These are the steps I've followed;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the envelop of the signal&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the note onsets&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;perform FFT between each onset&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Harmonic product spectrum.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It's when I try to implement the HPS algorithm that I face a &quot;dimensions don't agree&quot; error. This is the whole code that implements the HPS algorithm .&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;**% In harmonic prodcut spectrum, you downsample the fft data several times and multiply all those with the original fft data to get the maximum peak. &#xA;    %HPS&#xA;    seg_fft = seg_fft(1 : size(seg_fft,1)/2 );  &#xA;    seg_fft = abs(seg_fft);&#xA;&#xA;%HPS: downsampling&#xA;for i = 1:length(seg_fft)&#xA;    seg_fft2(i,1) = 1;&#xA;    seg_fft3(i,1) = 1;&#xA;    seg_fft4(i,1) = 1;&#xA;%   seg_fft5(i,1) = 1;&#xA;end&#xA;for i = 1:floor((length(seg_fft)-1)/2)&#xA;    seg_fft2(i,1) = (seg_fft(2*i,1) + seg_fft((2*i)+1,1))/2;&#xA;end&#xA;for i = 1:floor((length(seg_fft)-2)/3)&#xA;    seg_fft3(i,1) = (seg_fft(3*i,1) + seg_fft((3*i)+1,1) + seg_fft((3*i)+2,1))/3;    &#xA;end&#xA;&#xA;for i = 1:floor((length(seg_fft)-3)/4)&#xA;    seg_fft4(i,1) = (seg_fft(4*i,1) + seg_fft((4*i)+1,1) + seg_fft((4*i)+2,1) + seg_fft((4*i)+3,1))/4;&#xA;end&#xA;&#xA;%HPS, PartII: calculate product&#xA;p1 = (seg_fft3)  .* (seg_fft4);&#xA;p2 = p1.* (seg_fft2);&#xA;p3 = p2.* (seg_fft);&#xA;&#xA;&#xA;HPS, PartIII: find max&#xA;[f_y1,I] = max(p3)&#xA;&#xA; for c = 1 : length(p3)&#xA;     if(p3(c,1) == f_y1)&#xA;         index = c;&#xA;     end&#xA; end&#xA;&#xA; % Convert that to a frequency&#xA; f_y(h) = (index / NFFT) * FS;&#xA;&#xA; h = 1;&#xA; h=h+1;&#xA;f_y = abs(f_y)';&#xA;&#xA; end**&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before implementing &lt;code&gt;p3 = p2.* (seg_fft);&lt;/code&gt; the sizes of &lt;strong&gt;seg_fft, seg_fft2, seg_fft3, seg_fft4&lt;/strong&gt; all have the same dimensions of &lt;strong&gt;16384 1&lt;/strong&gt;. Then when I DO implement &lt;code&gt;p3 = p2.* (seg_fft);&lt;/code&gt; the size of &lt;code&gt;seg_fft&lt;/code&gt; changes to &lt;strong&gt;8192 1&lt;/strong&gt; while the sizes of rest remain at &lt;strong&gt;16384 1&lt;/strong&gt; thus causing an error in multiplication as the dimensions aren't the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really confused as to why this keeps happening and nothing I try seems to work out. Would really REALLY appreciate some help here... If someone could fix this code it'd be a GREAT help... Thanx in advance.. I'm real desperate here......&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2013-11-09T16:04:06.283" LastActivityDate="2014-04-09T10:31:50.227" Title="Error implementing Harmonic Product Spectrum algorithm" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="11578" PostTypeId="2" ParentId="11575" CreationDate="2013-11-09T17:39:46.740" Score="4" Body="&lt;p&gt;&lt;code&gt;FFT&lt;/code&gt; and &lt;code&gt;IFFT&lt;/code&gt; are algorithms that implement the (inverse) discrete Fourier transform (DFT). These transforms convert a signal into another representation, namely the frequency domain, and back. This other representation allows us to analyze certain properties of the signal and also to change these properites which would be hard to do in the original representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a digital audio signal: it's a sequence of samples that represent amplitude over time. This representation is useful to study the temporal properties of the signal and to play it back to make it audible. We can hear that the audio signal contains low and high sounds (frequencies) but from looking at the signal it's impossible to tell what frequencies exactly. After applying the DFT to the signal we can analyse what frequencies it contains and how strong they are. We can even amplifiy or attenuate certain frequencies and then apply the inverse DFT (IDFT) to make the signal audible again. In this way we have built a filter. The application of IDFT is necessary in this case, because the frequency domain representation of the audio signal is useless for playback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image processing deals with two-dimensional signals and therefore two-dimensional (I)DFT. The concept of frequencies with images is not so illustrative as with audio signals. Edges, i. e. sudden changes of intensity are represented by high frequencies whereas smooth gradients are represented by low frequencies. This allows us to do edge detection, for example. If high frequencies are attenuated this will result in a smoothed image after application of IDFT. Again, for just looking at the image, the frequency domain representation is useless but it allows analysis and filtering.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-11-09T17:39:46.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12578" PostTypeId="2" ParentId="10747" CreationDate="2013-11-09T18:48:08.520" Score="2" Body="&lt;p&gt;The basic idea in scale space is to parametrize the image value/function space with a single parameter so that one can localize or select interesting variations of the this parameter. The various images produced for different values of the parameter can represent different things, in image analysis they are simplifications of an input image. One can perform smoothing, bandpass filtering and various kinds of frequency based operations using linear scale spaces - this has been well &lt;a href=&quot;http://cs.haifa.ac.il/hagit/courses/ip/Lectures/Ip11_MultiscaleRepx4.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;studied&lt;/a&gt;.&#xA;For a more general view on scale &lt;a href=&quot;http://en.wikiversity.org/wiki/Scale_dimension&quot; rel=&quot;nofollow noreferrer&quot;&gt;see&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of Gaussians, morpholigcal operators like erosions/dilations one produces simpler functions based on the concept of causality - we dont introduce new extrema. This is mathematically fixed by the semi-group structure. The space or family of functions produced is the scale space. One should note here that the scale parameter could actually be changed with a parameter for a dynamical system or even a parameter for diffusion schemes. Its the &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-space_axioms&quot; rel=&quot;nofollow noreferrer&quot;&gt;axioms&lt;/a&gt; that make this definition specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Gaussian we have two parameters the kernel size and standard deviation of the gaussian. Now the scale intuition is more or less right - we search different scales (simplifications) to find an object, like in &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;SIFT&lt;/a&gt; and other algorithms. Thus the scale is representing the structure of the image, while the object (like in detection algorithms) is something being search for in this space.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="24536" LastEditDate="2018-04-05T18:09:12.363" LastActivityDate="2018-04-05T18:09:12.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12579" PostTypeId="2" ParentId="11571" CreationDate="2013-11-09T21:22:54.347" Score="2" Body="&lt;p&gt;You could normalize the average amplitude, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;YData = YData / mean(abs(YData));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you could normalize the signal power to one, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;YData = YData / sqrt(mean(abs(YData).^2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If just the peaks are bothering you, you could use dynamic range compression, but that would introduce nonlinear distortions. As Phonon hinted, please tell us why you are not happy with the results and why you want to normalize your data in the first place. That would allow for a more precise answer.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-11-09T21:22:54.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12580" PostTypeId="1" AcceptedAnswerId="12583" CreationDate="2013-11-09T21:50:09.260" Score="13" ViewCount="5535" Body="&lt;p&gt;Please suppose the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The frequency of a signal's fundamental has been estimated using FFT&#xA;and some frequency estimation methods and is lying between two bin&#xA;centers&lt;/li&gt;&#xA;&lt;li&gt;The sampling frequency is fixed&lt;/li&gt;&#xA;&lt;li&gt;Computational effort is not an issue&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Knowing the frequency, what is the most accurate way to estimate the corresponding peak value of the signals fundamental?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way might be to zero-pad the time signal to increase FFT resolution such that the bin center will be closer to the estimated frequency. In this scenario, one point I am not sure about is if I can zero-pad as much as I want or if there are some drawbacks in doing so. Another one is which bin center I should select after zero padding as the one I am obtaining the peak value from (because one may not hit the frequency of interest exactly, even after zero padding). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am also wondering whether there is another method which may deliver better results, f.e. an estimator which uses the peak values of the surrounding two bin centers to estimate the peak value at the frequency of interest.&lt;/p&gt;&#xA;" OwnerUserId="5416" LastActivityDate="2017-09-12T18:57:55.713" Title="Obtain a signal's peak value if it's frequency lies between two bin centers" Tags="|fft|discrete-signals|signal-analysis|estimation|peak-detection|" AnswerCount="7" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12581" PostTypeId="1" CreationDate="2013-11-09T21:54:34.687" Score="0" ViewCount="1044" Body="&lt;p&gt;I've often seen i my DSP book, that when they record a sound, they use a sample rate at 10khz or 8 khz, which makes sense since the fs is 2 times bigger than the sampling signals max freq.&lt;br&gt;&#xA;What i don't understand is why they only take 205 samples, rather than 10000 samples or 8000 samples, wouldn't each sample be &quot;unperiodic&quot;??.. &#xA;What is the magic behind the number 205 ???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;I know they aren't able to sample 8000 times here, but why not take 320 samples then?? than just 205??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Estimating DTMF Tones with the Goertzel Algorithm&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The minimum duration of a DTMF signal defined by the ITU standard is&#xA;  40 ms. Therefore, there are at most 0.04 x 8000 = 320 samples&#xA;  available for estimation and detection. The DTMF decoder needs to&#xA;  estimate the frequencies contained in these short signals.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;One common approach to this estimation problem is to compute the&#xA;  Discrete-Time Fourier Transform (DFT) samples close to the seven&#xA;  fundamental tones. For a DFT-based solution, it has been shown that&#xA;  using 205 samples in the frequency domain minimizes the error between&#xA;  the original frequencies and the points at which the DFT is estimated.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Nt = 205; original_f = [lfg(:);hfg(:)]  % Original frequencies&#xA;  original_f =&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     697&#xA;     770&#xA;     852&#xA;     941&#xA;    1209&#xA;    1336&#xA;    1477&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;k = round(original_f/Fs*Nt);  % Indices of the DFT estim_f =&#xA;  round(k*Fs/Nt)      % Frequencies at which the DFT is estimated&#xA;  estim_f =&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     702&#xA;     780&#xA;     859&#xA;     937&#xA;    1210&#xA;    1327&#xA;    1483&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;To minimize the error between the original frequencies and the points&#xA;  at which the DFT is estimated, we truncate the tones, keeping only 205&#xA;  samples or 25.6 ms for further processing.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;tones = tones(1:205,:);&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="6921" LastEditorUserId="6921" LastEditDate="2013-11-10T00:13:31.777" LastActivityDate="2013-11-10T06:15:16.120" Title="Why only take 205 sample when using a sample rate of 10khz or 8khz?" Tags="|sampling|dft|sound|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12582" PostTypeId="1" CreationDate="2013-11-10T00:18:12.003" Score="3" ViewCount="7330" Body="&lt;p&gt;Can you please explain in simple terms what do the input parameters indicate in the &lt;a href=&quot;http://www.mathworks.com/help/images/ref/ordfilt2.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;ordfilt2&lt;/code&gt;&lt;/a&gt; function in matlab?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B=ordfilt2(A,Order,Domain)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have seen people use this function as &lt;code&gt;J = ordfilt2(I, 9, true(5))&lt;/code&gt; or &lt;code&gt;J=ordfilt2(I,25,ones(3,3))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I do not understand what each input does to the image &lt;code&gt;I&lt;/code&gt; to give &lt;code&gt;J&lt;/code&gt; as output..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance&lt;/p&gt;&#xA;" OwnerUserId="6922" LastEditorUserId="80" LastEditDate="2013-11-10T01:32:09.340" LastActivityDate="2015-09-20T11:54:19.477" Title="What exactly does ordfilt2 do?" Tags="|matlab|filtering|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12583" PostTypeId="2" ParentId="12580" CreationDate="2013-11-10T01:48:14.317" Score="6" Body="&lt;p&gt;The first algorithm that springs to mind is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Goertzel Algorithm&lt;/a&gt;. That algorithm usually assumes that the frequency of interest is an integer multiple of the fundamental frequency. &lt;a href=&quot;https://asp-eurasipjournals.springeropen.com/articles/10.1186/1687-6180-2012-56&quot; rel=&quot;nofollow noreferrer&quot;&gt;However, this paper applies the (generalized) algorithm to the case you are interested in.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another problem is that the signal model is incorrect.  It uses &lt;code&gt;2*%pi*(1:siglen)*(Fc/siglen)&lt;/code&gt;. It should use &lt;code&gt;2*%pi*(0:siglen-1)*(Fc/siglen)&lt;/code&gt; for the phase to come out correctly.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also think there is a problem with the frequency &lt;code&gt;Fc=21.3&lt;/code&gt; being very low. Low-frequency real-valued signals tend to exhibit bias when it comes to phase/frequency estimation problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried a coarse grid search for the phase estimate, and it gives the same answer as the Goertzel algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a plot that shows the bias in both estimates (Goertzel:blue, Coarse:red) for two different frequencies: &lt;code&gt;Fc=21.3&lt;/code&gt; (solid) and &lt;code&gt;Fc=210.3&lt;/code&gt; (dashed).  As you can see the bias for the higher frequency is much less.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot $x$-axis is the initial phase changing from 0 to $2\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GBuHU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="26479" LastEditDate="2017-09-12T18:57:55.713" LastActivityDate="2017-09-12T18:57:55.713" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="12584" PostTypeId="1" CreationDate="2013-11-10T03:15:14.623" Score="0" ViewCount="1010" Body="&lt;p&gt;I need to convert 150 Frequency domain samples to the time domain. The problem is, I have been provided with 250 time domain samples for comparing my results.  How am I supposed to relate the 150 samples to 250 samples? I can't find any relationship like interpolation/decimation between the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this have anything to do with windowing (hamming,hanning,etc), sampling frequency, min and max frequency in the original signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Jim: I have 150 frequency domain samples and i need to get 250 time domain samples using them. If I do a normal iFFT, I would get only 150 TD samples. So I tried to append 100 zeros to the FD samples and then did the iFFT. But then, my samples are different from the original answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input set I have is : 150 TD samples, sampling frequency=10GHZ, Min and Max frequency of the original signal = 500MHZ and 3050 MHZ, Window= Kaiser (beta=6)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that I have been provided with either insufficient or incorrect data.&#xA;Am i right?&lt;/p&gt;&#xA;" OwnerUserId="6923" LastEditorUserId="80" LastEditDate="2013-11-11T01:24:49.157" LastActivityDate="2014-02-10T04:21:52.030" Title="Frequency domain to time domain conversion-(varying sample count)" Tags="|discrete-signals|frequency-domain|conversion|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12585" PostTypeId="2" ParentId="12581" CreationDate="2013-11-10T06:09:03.923" Score="1" Body="&lt;p&gt;The frequency of DFT bin centers is i*Fs/N, for integer i.  Thus different N will create different arrays of frequencies.  For some N, this will produce an array that has the lowest nearest bin center distance from the frequency set that you wish to measure (in thus case, a vector of DFT frequencies).  According to the referenced document, for some standard sample rate, N=205 will produce that vector with the closest DFT bin centers to DFT frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since each DFT bin has a Sinc shaped roll-off, the closer a bin frequency is to a desired measurement frequency, the lower the magnitude measurement error will be without needing further interpolation computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For N greater than 320, the DFT will have greater frequency resolution, but the time resolution gets worse and will overlap multiple tones, which creates greater ambiguity in which tone is being detected.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-11-10T06:15:16.120" LastActivityDate="2013-11-10T06:15:16.120" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12586" PostTypeId="2" ParentId="12580" CreationDate="2013-11-10T06:23:49.200" Score="4" Body="&lt;p&gt;If you are willing to use multiple neighboring FFT bins, not just 2, then windowed Sinc interpolation between the complex bin results can produce a very accurate estimate, depending on the width of the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowed Sinc interpolation is commonly found in high quality audio upsamplers, so papers on that subject will have suitable interpolation formulas with error analysis.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-10T06:23:49.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12587" PostTypeId="2" ParentId="11577" CreationDate="2013-11-10T06:31:50.793" Score="1" Body="&lt;p&gt;Pad the high frequency portions of all the down-sampled vectors with either zeros, or some noise floor estimate, depending on your desired frequency search range, to make them all the same length or dimension.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-10T06:31:50.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12588" PostTypeId="2" ParentId="11575" CreationDate="2013-11-10T06:41:24.207" Score="1" Body="&lt;p&gt;Recent article with a nice non-math FFT explanation: &lt;a href=&quot;http://nautil.us/blog/the-math-trick-behind-mp3s-jpegs-and-homer-simpsons-face&quot; rel=&quot;nofollow&quot;&gt;http://nautil.us/blog/the-math-trick-behind-mp3s-jpegs-and-homer-simpsons-face&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-10T06:41:24.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12589" PostTypeId="1" CreationDate="2013-11-10T14:58:53.057" Score="5" ViewCount="3452" Body="&lt;p&gt;I have researched a bit into DSP filters for the problem of finding the angular velocity from X/Y acceleration measured by a rotating accelerometer. Essentially I need more help in picking the best type of filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of the type of data I can measure can be seen in this image (ignore the y-axis as values are scaled and offset):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fN09D.png&quot; alt=&quot;Raw x/y data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The model for the ideal signal without noise and with a constant angular velocity (w) is fairly simple (Scilab code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Signal Model&#xA;DeltaT = 0.01;          // 100Hz sampling&#xA;w = (50 / 60) * 2*%pi;  // 50 RPM -&amp;gt; radians/sec&#xA;L = 8/100;              // 8 cm -&amp;gt; meters&#xA;g = 9.81;               // Earth gravity in ms^-2&#xA;&#xA;N = 1000; // Number of samples&#xA;for i = 1:N&#xA;    x_val(i) = g * cos(w * (i-1)*DeltaT);&#xA;    y_val(i) = g * sin(w * (i-1)*DeltaT) + w*w * L;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Update: Here we ignore the linear acceleration/brake of the entire system along the road. This becomes a (significant) noise adder.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Shown here as a plot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IF36L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample rate is 100 Hz. The accelerometer is mounted on a crank arm of a bike (between the crank and the pedal). The Y-axis of the accelerometer points away from the center of the rotation and is mounted 8 cm away from the center, so this sine wave is offset a bit by the centripetal acceleration (red curve). The ideal result/filter output here would be a flat line with the angular velocity (w).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The noise can change any second. The angular velocity can change any second – both slowly and abruptly. The quest is to find the best estimate for the angular velocity at any time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first attempts involved using a running average filter to reduce noise and digitizing with hysteresis to find two points on the rotation. This works, but is obviously too crude as we want to estimate the velocity at every sample point. One such attempt is shown here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dq4cR.png&quot; alt=&quot;Example of simple algorithm&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Red and blue as before (ignore scale/offset). Black is the output in RPM. As can be seen this is VERY crude. Lot's of things can be improved (curve does not go to zero when the accelerometer is clearly not moving; staircase effect from only calculating angular velocity once per revolution etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know DSP filtering techniques like Kalman (probably not good, as this is not a linear problem?), Total Variation (probably not good as the piecewise constant regions are more ramps than plateaus?) etc. can do wonders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what exactly is a good/&quot;the best&quot; method to use for this type of signals?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Applying the 1st answer&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Trying to run real data though Peter K's filter (see answer below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can create a measured version of &quot;z&quot; like this (scilab code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; // Read in the measured accelerometer data from datalogger&#xA; ACCM = fscanfMat(&quot;C:\_work\2et\pedal-acc\LOG05.txt&quot;)&#xA; [nr, nc] = size (ACCM);&#xA; x_avg = sum(ACCM(:, 1))/nr; // Use average as 0g&#xA; xacc_meas = g * (ACCM(:, 1) - x_avg) / 93; // 300mV/g; 3.3V~1024 ADC steps&#xA; yacc_meas = g * (ACCM(:, 2) - x_avg) / 93;&#xA;&#xA; // Use an intersting section as input to the filter&#xA; first_sample = 60000;&#xA; xacc_meas = xacc_meas(first_sample:first_sample+N-1);&#xA; yacc_meas = yacc_meas(first_sample:first_sample+N-1);&#xA;&#xA; // Construct a measured version of the &quot;z&quot; vector&#xA; z_meas = zeros(2, N);&#xA; z_meas(1, :) = matrix(xacc_meas, 1, N); // x-acceleration&#xA; z_meas(2, :) = matrix(yacc_meas, 1, N); // y-acceleration&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Comparing the measured data to the (fake) &quot;z&quot; values in Peter K's simulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6SjMO.png&quot; alt=&quot;Comparing simulated and real data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note there is no time correlation - just looking at how data &quot;looks&quot;. The noise factor sig_v needs to be increased to about 4-5 for similar noise level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I change the two noise factors like this (assuming this is how we &quot;tune&quot; the filter):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; sig_w = 0.0001; // Was: 0.00001;&#xA; sig_v = 4;      // Was: 1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And construct a very rough reference using my previous crude method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; // Make a rough reference from measured data called &quot;w_ref&quot;&#xA; // Functions not shown - ask if you want to see them&#xA; xacc_temp = running_avgws(xacc_meas, 15);&#xA; xacc_temp = running_avgws(xacc_temp, 15);&#xA; xacc_hyst = hysthresis(xacc_temp, 2.5);&#xA; w_ref = cadence_rpm(xacc_hyst)*2*%pi/60;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can now run the EKF on real measured data and get the following results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Upi2u.png&quot; alt=&quot;Results 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4cimP.png&quot; alt=&quot;Results 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly not there yet. I expected the middle plot to match somewhat (blue is the output of the filter for angular velocity and red is my crude reference - note that the middle section really should be zero). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't seem to find any value of sig_w that will make it &quot;lock&quot;. What have I done wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the changes proposed it works, but I am not impressed. Look at a fairly simple stretch of real world samples and how the EKF works on this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ApiF1.png&quot; alt=&quot;Easy data with questionable result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The green shows the samples after two times running average with a window size of 15. That looks so nice and clean. The red curve shows my very crude algorithm doing a reasonable fine job by just looking at the zero-crossings. The blue is the estimate by the EKF. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was expecting the EKF would come to a much cleaner result as it has built-in knowledge about the physical model with sine waves and all. Is this really all we can get out of it? Or is there something wrong in the way we do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I accept that there &lt;em&gt;may&lt;/em&gt; be a systematic variation in the angular velocity per rotation that I have a hard time verifying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I have ignored this line of the code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; xhatkkm1(:,1) = x(:,1); // Seeding with an initial condition (cheating)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6926" LastEditorUserId="6926" LastEditDate="2013-11-13T07:42:26.183" LastActivityDate="2017-10-08T17:32:06.400" Title="Correct filter to find angular velocity from a rotating accelerometer?" Tags="|filters|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12590" PostTypeId="2" ParentId="857" CreationDate="2013-11-10T16:43:25.147" Score="0" Body="&lt;p&gt;Contours are not necessarily open consider that you have used canny to detect them. The problems with Canny were already disccused &lt;a href=&quot;https://dsp.stackexchange.com/questions/1708/what-are-the-limitations-of-a-canny-edge-detector&quot;&gt;here&lt;/a&gt;. The &lt;a href=&quot;http://www.itu.dk/stud/speciale/segmentering/Litteratur/On%20the%20Canny%20edge%20detector.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;discussion&lt;/a&gt; on canny gives you the basic idea that there is still operations like closing and dilation that are require on top of canny to evaluated closed contours. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also depends on whether we are looking for &lt;strong&gt;contours&lt;/strong&gt; or &lt;strong&gt;segmentations&lt;/strong&gt; (Canny versus methods like &lt;a href=&quot;http://en.wikipedia.org/wiki/Graph_cuts_in_computer_vision&quot; rel=&quot;nofollow noreferrer&quot;&gt;Graphcuts&lt;/a&gt;). So i guess looking for robust solution depends on your final application.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-11-10T16:43:25.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12591" PostTypeId="1" CreationDate="2013-11-10T16:45:20.440" Score="1" ViewCount="286" Body="&lt;p&gt;Text present in captured images is high frequency or low frequency component?Why?&lt;/p&gt;&#xA;" OwnerUserId="6927" LastActivityDate="2013-11-15T13:36:50.933" Title="Text in image is low or high frequency component?" Tags="|image-processing|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12592" PostTypeId="2" ParentId="12591" CreationDate="2013-11-10T16:54:53.263" Score="1" Body="&lt;p&gt;The edges of the words will probably contribute to a high frequency, the background of the text and the portion within the boundaries of the letters of the text will be otherwise.&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2013-11-10T16:54:53.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12593" PostTypeId="2" ParentId="12591" CreationDate="2013-11-10T17:21:48.373" Score="1" Body="&lt;p&gt;When text is more, it is a high frequency image. If the image has only one or few letters in larger font size it is a low frequency image. This is because of following reasons:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do frequencies mean in an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an image has large values at high frequency components then the data is changing rapidly on a short distance scale. e.g. a page of text&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the image has large low frequency components then the large scale features of the picture are more important. e.g. a single fairly simple object which occupies most of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, High &lt;a href=&quot;http://en.wikipedia.org/wiki/Spatial_frequency&quot; rel=&quot;nofollow&quot;&gt;Spatial Frequencies&lt;/a&gt; represent abrupt spatial changes in the image, such as edges, and generally correspond to featural information and fine detail. Low spatial frequencies, on the other hand, represent global information about the shape, such as general orientation and proportions.&lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2013-11-10T17:21:48.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12596" PostTypeId="1" CreationDate="2013-11-11T01:50:36.650" Score="1" ViewCount="864" Body="&lt;p&gt;I'm building my own MIDI synth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to create a decent sounding tone for every note on the piano keyboard (A-1 through C7, or MIDI 21 through 21+88=109)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been using a basic ring resonator, where I create a ring of the right size (for example, sampling at 44.1 kHz the ring for A440 a.k.a. concert pitch would be 44100/440 i.e. 100.25 ~ 100 samples), fill it with static (values between -1 and +1) and then walk through it, averaging consecutive values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that A-1 rumbles for 30 seconds, whereas C7 dies almost instantly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I never noticed this problem before as I was working with a much smaller range; &amp;lt; two octaves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attempting to balance out the decays by multiplying by a suitable decay constant, say X[n] = .995*(X[n-1] + X[n-2])/2, where I choose the constant carefully for each note, is also failing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem here is that even with decay=1.0, a high note still disappears almost instantly.  And it makes sense thinking about it; if the ring is only 10 samples,  even in 1/100sec we have covered 440 samples i.e. 44 revolutions, which will have smeared everything pretty close to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One method I tried is feeding energy into the ring; creating a buffer of static enveloped by an exponential decay, and feeding this buffer into the ring.   It isn't working very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I found works better is linear interpolation, so instead of doing ( X[n-1] + X[n-2] ) / 2, I do maybe:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.98 * X[n-1]  +  0.02 * X[n-2] for a high note,  and &#xA;0.6 * X[n-1]  +  0.4 * X[n-2]  for a note lower down&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now the question is: how to choose the interpolation factor depending on the note?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a much better model to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I also need to implement fractional delay; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Samp[ N ] += k *  Samp[ N - L ], &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and if L = 10.2 say, I would have to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Samp[ N ] += k * ( 0.8 * Samp[10]  +  0.2 * Samp[ 11 ] )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so that is a completely different linear interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my main question is: How to mathematically determine the necessary interpolation factor for a given note, so that all notes have an equal decay?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supplementary questions are:&lt;br&gt;&#xA; - do I need to use a decay constant in addition to adjusting the interpolation?&#xA; - is my understanding of fractional delay sufficient to get a working result?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone knows of any resource for simulating a harmonic tone that is reasonably accessible, please do put it in as an answer. I've looked through JOS's resources, but he writes at a very advanced level, and I have difficulty understanding the material.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS I can't find an appropriate tag;  pitch, note, gen*, tone, synth*, none of these are available.&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2013-11-11T23:46:19.537" LastActivityDate="2013-11-12T08:34:22.213" Title="Synthesizing harmonic tones with Karplus Strong" Tags="|pitch|signal-synthesis|tone-generation|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12597" PostTypeId="1" AcceptedAnswerId="12601" CreationDate="2013-11-11T05:13:25.380" Score="14" ViewCount="4522" Body="&lt;p&gt;Is there an example of an eigenfunction of a linear time invariant (LTI) system that is &lt;strong&gt;not&lt;/strong&gt; a complex exponential? Justin Romberg's &lt;a href=&quot;http://cnx.org/content/m10500/latest/&quot; rel=&quot;noreferrer&quot;&gt;Eigenfunctions of LTI Systems&lt;/a&gt; says such eigenfuctions do exist, but I am not able to find one.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="21075" LastEditDate="2018-04-05T18:08:56.723" LastActivityDate="2018-04-06T01:41:28.067" Title="Are complex exponentials the only eigenfunctions of LTI systems?" Tags="|linear-systems|theory|eigendecomposition|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12598" PostTypeId="2" ParentId="12596" CreationDate="2013-11-11T06:17:05.317" Score="2" Body="&lt;p&gt;First, note that the behaviour in which high-pitched notes disappear faster than low-pitched notes is found in many musical instruments. You might better not totally compensate for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way I got the behaviour I wanted out of Karplus-Strong was the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I add an additional exponential decay for the lowest notes - a &quot;loss&quot; factor so that x[n] = loss * (x[n] + x[n - 1]) / 2&lt;/li&gt;&#xA;&lt;li&gt;For the highest notes, I randomly decide whether I will do a buffer update or not ; with an increasingly high probability for the &quot;no update&quot; event as pitch increases.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To avoid dealing with fractional delays - and to get any kind of pitch modulation I want (but also to simplify the code), I use a ring buffer of the nearest power of 2 (for example, 128 samples for A4) and then do a linearly interpolated read from it. One can see this as a wavetable oscillator whose lookup table is dynamically modified/refreshed as the phase increment counter moves through it.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-11-11T06:17:05.317" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12599" PostTypeId="1" AcceptedAnswerId="12602" CreationDate="2013-11-11T07:37:24.200" Score="1" ViewCount="3071" Body="&lt;p&gt;I'm trying to combine two filters into a single filter command for a homework problem and was looking for advice. I don't necessarily need an explicit answer as long as someone can point me in the right direction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following code, assume that 'y' is a sound file that has been pre-loaded (10kHz). Also, both the hlpf and hnotch filters work together separately to produce an audio signal with noise and a beeping tone removed. However, when I try to combine the two into a single filter, I do not achieve this result. Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 10000;&#xA;f0 = 1000;                %#notch frequency&#xA;fn = Fs/2;              %#Nyquist frequency&#xA;freqRatio = f0/fn;      %#ratio of notch freq. to Nyquist freq.&#xA;notchWidth = 0.1;       %#width of the notch&#xA;&#xA;%Compute zeros&#xA;zeros = [exp( sqrt(-1)*pi*freqRatio ), exp( -sqrt(-1)*pi*freqRatio )];&#xA;&#xA;%Compute poles&#xA;poles = (1-notchWidth) * zeros;&#xA;b = poly( zeros ); %# Get moving average filter coefficients&#xA;a = poly( poles ); %# Get autoregressive filter coefficients&#xA;&#xA;hnotch = [poly(poles)];&#xA;alpha = 0.42;&#xA;hlpf = fir1(100, alpha);&#xA;hcombo = conv(hlpf,hnotch);&#xA;s2 = filter(hcombo,1,y);&#xA;soundsc(s2,Fs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6930" LastActivityDate="2013-11-11T11:35:54.703" Title="Combining two filters (audio processing)" Tags="|matlab|filters|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12600" PostTypeId="2" ParentId="11546" CreationDate="2013-11-11T09:14:47.563" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, this should be enough for a basic isolated word recognition system. Probably not something for a commercial product, but good enough for a university project or demo...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It would be better to ask the user to record a word and match against this, rather than attempt to match against a large database of utterances of the same word by different speakers. The larger the database the more likely you'd find an utterance matching the user's voice, but matching against a large database would be computationally expensive!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The first MFCC captures the signal energy - you might try to remove it when doing the matching (your feature vector will thus contain MFCC #2 to 13) - this will make recognition more robust to changes in amplitude.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You might have misunderstood something. Do you have a link to such a website?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A general proporty of MFCC is that as the coefficient index increases, the standard deviation of this coefficient decreases (the DCT can be thought of as an approximation of a PCA) - so the lower coefficients will have greater magnitude. You can compensate for that by estimating the standard deviation of each MFCC coefficient on a training set, once and for all, and dividing each coefficient by its standard deviation (or a power of it &amp;lt; 1.0) prior to the DTW step.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-11-11T09:14:47.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12601" PostTypeId="2" ParentId="12597" CreationDate="2013-11-11T09:23:56.137" Score="10" Body="&lt;p&gt;All eigenfunctions of an LTI system can be described in terms of complex exponentials, and complex exponentials form a complete basis of the signal space. However, if you have a system that is &lt;em&gt;degenerate&lt;/em&gt;, meaning you have eigensubspaces of dimension &gt;1, then the eigenvectors to the corresponding eigenvalue are all linear combination of vectors from the subspace. And linear combinations of complex exponentials of different frequencies are not complex exponentials anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very simple example: The identity operator 1 as an LTI system has the whole signal space as eigensubspace with eigenvalue 1. That implies ALL functions are eigenfunctions.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2013-11-11T15:44:16.703" LastActivityDate="2013-11-11T15:44:16.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12602" PostTypeId="2" ParentId="12599" CreationDate="2013-11-11T11:10:24.193" Score="2" Body="&lt;p&gt;In order to combine two filters, you need to convolve their impulse responses, and you haven't done that in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, according to this code snippet, the notch filter is incorrectly built.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure once you review it you'll figure out your errors. Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2013-11-11T11:10:24.193" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12603" PostTypeId="2" ParentId="12599" CreationDate="2013-11-11T11:35:54.703" Score="1" Body="&lt;p&gt;Hint: build, test and verify the two filters individually first. If that all checks out, stare at the code and figure out what's the same and what's different between the filters and the filter operation.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-11T11:35:54.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12604" PostTypeId="2" ParentId="3595" CreationDate="2013-11-11T12:55:23.387" Score="0" Body="&lt;p&gt;I would suggest using the Hough transform, which is a very robust algorithm for finding simple parametric shapes e.g. lines, circles etc. Detection of lines would be best in your case. You could find the sides of the long white sripes at least; then, with any corner extractor algorithm (Harris or maybe even SIFT or SURF) you could find corners along those lines, even using the fact that the squares are approximately equally spaced. &lt;/p&gt;&#xA;" OwnerUserId="6933" LastActivityDate="2013-11-11T12:55:23.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12605" PostTypeId="2" ParentId="12589" CreationDate="2013-11-11T15:39:00.720" Score="5" Body="&lt;p&gt;As you say, the Kalman filter is probably not the best due to the nonlinear nature of the dynamics.  &lt;a href=&quot;https://robotics.stackexchange.com/a/386/1100&quot;&gt;However this post over on a sister SE site suggests&lt;/a&gt; that the next step might just be an &lt;a href=&quot;http://en.wikipedia.org/wiki/Extended_Kalman_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Extended Kalman Filter&lt;/a&gt;, which is really just a Kalman filter applied to the first order Taylor series expansion of the nonlinear dynamics.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I cannot say how well this will work, but let's see if we can write down the equations for the signal model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's use the states as:&#xA;$$&#xA;x_k = [ \theta_k\ \omega_k \ a_k ]^T&#xA;$$&#xA;and let's use the state update equation:&#xA;$$&#xA;x_{k+1} = \left[ \begin{array}{ccc}&#xA;1 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}&#xA;\right] x_k + w_k = \left[ \begin{array}{c}&#xA;\theta_k + \omega_k\\&#xA;\omega_k + a_k\\&#xA;a_k&#xA;\end{array}&#xA;\right] + w_k&#xA;$$&#xA;where $w_k$ is the process noise of covariance $Q$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output equation could then be:&#xA;$$&#xA;z_k =  \left[ \begin{array}{cc}&#xA;g \cos(\theta_k) \\&#xA;g \sin(\theta_k) + \omega_k^2 L&#xA;\end{array}&#xA;\right] + v_k&#xA;$$&#xA;where $v_k$ is the measurement noise with covariance $R$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I've probably made some mistake in the code below (feel free to correct it or at least point out the problem!), but this signal model seems to generate a reasonable EKF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code assumes a reasonably constant omega, except for a quarter of the way through until half-way through, where I'm just setting it to zero arbitrarily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The EKF estimate and the actual estimate are shown here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ny7VO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the state estimates for $\theta$, $\omega$ and $a$ do not seem too bad:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rs7ky.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, there are FOUR problems:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The model that I used was rotating the wrong way compared with your data. This means I had to change the two functions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function h = output_equation(theta, omega, g, L)&#xA;    h = [g*cos(theta); -g*sin(theta) + omega.*omega*L];&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function h = cap_hk(theta, omega, g,L)&#xA;    h = [-g*sin(theta) 0 0; -g*cos(theta) 2*omega*L 0]'&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note the minus signs on the $\sin$ term in the first one and the $\cos$ term in the second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The second problem is that the &lt;code&gt;w_ref&lt;/code&gt; variable and the &lt;code&gt;xhatkk(2,:)&lt;/code&gt; variable are on different scales.  I had to scale &lt;code&gt;xhatkk(2,:)&lt;/code&gt; by (one on) &lt;code&gt;DeltaT&lt;/code&gt; to get them to align. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) The third issue is that &lt;code&gt;xhatkk(2,:)&lt;/code&gt; is not very smooth. If I run the &lt;code&gt;running_avgws&lt;/code&gt; function over it a couple of times, things look a little better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) I had to revert to &lt;code&gt;sig_w = 0.00001;&lt;/code&gt; to get lock to happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot below shows the &lt;code&gt;w_ref&lt;/code&gt; value in red. The top plot is the raw &lt;code&gt;xhatkk(2,:)&lt;/code&gt; value.  The bottom plot shows the smoothed version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/G8QhU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code to generate the plot&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sm = running_avgws(xhatkk(2,:)'/DeltaT,15);&#xA;sm2 = running_avgws(sm,15);&#xA;&#xA;figure(3);&#xA;clf;&#xA;subplot(211)&#xA;plot(w_ref,'r');&#xA;plot(xhatkk(2,:)/DeltaT,'k:');&#xA;mtlb_axis([0 1000 0 10]);&#xA;subplot(212)&#xA;plot(w_ref,'r');&#xA;plot(sm2,'k:');&#xA;mtlb_axis([0 1000 0 10]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Scilab code to generate plots&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Constants&#xA;DeltaT = 0.01;          // 100Hz sampling&#xA;w = (50 / 60) * 2*%pi;  // 50 RPM -&amp;gt; radians/sec&#xA;L = 8/100;              // 8 cm -&amp;gt; meters&#xA;g = 9.81;               // Earth gravity in ms^-2&#xA;N = 1000;               // Number of samples&#xA;&#xA;sig_w = 0.00001;&#xA;sig_v = 1;&#xA;ww = sig_w*rand(3,N,'normal');&#xA;vv = sig_v*rand(2,N,'normal');&#xA;&#xA;x = zeros(3,N);&#xA;x(:,1) = [0,w*DeltaT,0]'; &#xA;&#xA;z = zeros(2,N);&#xA;&#xA;F = [1 1 0; 0 1 1; 0 0 1];&#xA;&#xA;// All nonlinearities are in the output equation&#xA;function h = output_equation(theta, omega, g, L)&#xA;    h = [g*cos(theta); g*sin(theta) + omega.*omega*L];&#xA;endfunction&#xA;&#xA;&#xA;for i=2:N,&#xA;    x(:,i) = F*x(:,i-1) + ww(:,i);&#xA;    if (i&amp;gt;N/4) &amp;amp; (i&amp;lt;N/2) then&#xA;        x(2,i) = 0;&#xA;    end&#xA;    th = x(1,i);&#xA;    om = x(2,i);&#xA;    z(:,i) = output_equation(th, om, g, L) + vv(:,i);&#xA;end&#xA;&#xA;// Extended Kalman Filter&#xA;Q = sig_w*eye(3,3);&#xA;R = sig_v*eye(2,2);&#xA;&#xA;G = eye(3,3);&#xA;&#xA;function h = cap_hk(theta, omega, g,L)&#xA;    h = [-g*sin(theta) 0 0; g*cos(theta) 2*omega*L 0]'&#xA;endfunction&#xA;&#xA;F_k = F;&#xA;&#xA;Sigma_kkm1 = 1*eye(3,3);&#xA;xhatkk = zeros(3,N);&#xA;xhatkkm1 = zeros(3,N);&#xA;xhatkkm1(:,1) = x(:,1);&#xA;&#xA;HH = [];&#xA;&#xA;for i=1:N,&#xA;    H_k = cap_hk(xhatkkm1(1,i),xhatkkm1(2,i),g,L);&#xA;    HH = [HH; H_k];&#xA;    Omega_k = H_k'*Sigma_kkm1*H_k + R;&#xA;    L_k = Sigma_kkm1*H_k*pinv(Omega_k);&#xA;    xhatkk(:,i) = xhatkkm1(:,i) + L_k*(z(:,i) - output_equation(xhatkkm1(1,i),xhatkkm1(2,i),g,L));&#xA;    xhatkkm1(:,i+1) = F_k*xhatkk(:,i);&#xA;    Sigma_kk = Sigma_kkm1 - Sigma_kkm1*H_k*pinv(H_k'*Sigma_kkm1*H_k + R)*H_k'*Sigma_kkm1;&#xA;    Sigma_kkm1 = F_k*Sigma_kk*F_k' + G*Q*G';&#xA;end&#xA;&#xA;XXX = output_equation(xhatkkm1(1,:),xhatkkm1(2,:),g,L);&#xA;&#xA;figure(1);&#xA;clf&#xA;subplot(311)&#xA;plot(x(1,:),'r')&#xA;plot(xhatkk(1,:),':')&#xA;title('Cumulative phase: truth (red) and estimate (blue)')&#xA;subplot(312)&#xA;plot(x(2,:),'r')&#xA;plot(xhatkk(2,:),':')&#xA;title('Frequency: truth (red) and estimate (blue)')&#xA;subplot(313);&#xA;plot(x(3,:),'r')&#xA;plot(xhatkk(3,:),':')&#xA;title('Acceleration: truth (red) and estimate (blue)')&#xA;&#xA;figure(2);&#xA;clf;&#xA;subplot(211)&#xA;plot(z')&#xA;plot(XXX','.')&#xA;title('Measurements (line) and estimages (dots)');&#xA;subplot(212)&#xA;plot(z'-XXX(:,1:1000)');&#xA;title('Error between estimate and measurement')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:49:17.937" LastActivityDate="2013-11-12T22:23:39.647" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="12606" PostTypeId="1" CreationDate="2013-11-11T17:02:55.297" Score="0" ViewCount="3766" Body="&lt;p&gt;In a problem I'm working on, I have a signal that is sampled 256 times for 3.5 microseconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After performing a Discrete Fourier Transform on the data, what is the frequency step between the calculated values of Cn? The prompt states that this is also called the bandwidth of each point in the power spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I go about solving this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6935" LastActivityDate="2024-01-13T12:13:03.253" Title="Discrete Fourier Transform bandwidth?" Tags="|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12607" PostTypeId="2" ParentId="12606" CreationDate="2013-11-11T17:41:08.687" Score="2" Body="&lt;p&gt;Your specification of the particulars for your situation aren't clear to me, but I'll explain how you can arrive at the answer.&lt;/p&gt;&#xA;&lt;p&gt;The DFT is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X[k] = \sum_{n=0}^{N-1}x[n] e^{-j2 \pi \frac{k}{N}n}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The (normalized) frequency associated with the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th bin is &lt;span class=&quot;math-container&quot;&gt;$\frac{2\pi k}{N}$&lt;/span&gt;. Therefore, the spacing between the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th and &lt;span class=&quot;math-container&quot;&gt;$(k+1)$&lt;/span&gt;-th bins is &lt;span class=&quot;math-container&quot;&gt;$\frac{2\pi}{N}$&lt;/span&gt;. Recall that the conversion between unnormalized frequencies (i.e. before sampling) and the normalized angular frequency &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; used in the DTFT is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\omega = \frac{2\pi f}{f_s}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That is, a time-referenced frequency &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; before sampling maps to &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; in the normalized frequency domain, where &lt;span class=&quot;math-container&quot;&gt;$f_s$&lt;/span&gt; is the sample rate of the signal (i.e. how many samples are taken of the signal per second). You can then map the bin spacing above into unnormalized frequency:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Delta f = \frac{2\pi}{N} \frac{f_s}{2\pi} = \frac{f_s}{N}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This simple relationship just says that the spacing between bins is equal to your signal's sample rate divided by the DFT length. It's unclear from your question whether the interval between each sample is 3.5 microseconds or whether your block of 256 samples covers an overall duration of 3.5 microseconds. Based on whichever is true, you can calculate the appropriate value.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="7092" LastEditDate="2024-01-13T12:13:03.253" LastActivityDate="2024-01-13T12:13:03.253" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12608" PostTypeId="2" ParentId="11445" CreationDate="2013-11-11T17:52:23.283" Score="2" Body="&lt;p&gt;From an algorithm perspective, subtraction is the simplest method.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Run a &lt;a href=&quot;http://docs.opencv.org/modules/nonfree/doc/feature_detection.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature detection algorithm&lt;/a&gt; (like SIFT or SURF) on both images to align them&lt;/li&gt;&#xA;&lt;li&gt;Apply any enhancement operations at this stage, such as lens distortion removal, lighting correction, or others.&lt;/li&gt;&#xA;&lt;li&gt;Do a simple subtraction of the background image from the test image.&lt;/li&gt;&#xA;&lt;li&gt;Perform a blur or median filter on the subtracted image.  This will mitigate noise from the subtraction.&lt;/li&gt;&#xA;&lt;li&gt;Run a threshold tool on this image to generate a foreground mask.&lt;/li&gt;&#xA;&lt;li&gt;Optionally blur the foreground mask to smooth out the edges.&lt;/li&gt;&#xA;&lt;li&gt;Apply the mask to your test image and only the foreground will be visible.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The following is some ugly code that accomplished this crudely.  If I have time I will clean up the code, or perhaps someone else can for me.  I used OpenCV, which is very capable for doing what you want, though you would need to use the .NET bindings.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cv&#xA;import cv2&#xA;import numpy as np&#xA;import sys&#xA;&#xA;# Align images with cv2&#xA;imgBack = cv2.imread(&quot;Background.png&quot;)&#xA;imgTest = cv2.imread(&quot;Test.png&quot;)&#xA;&#xA;detector = cv2.FeatureDetector_create(&quot;SURF&quot;)&#xA;descriptor = cv2.DescriptorExtractor_create(&quot;BRIEF&quot;)&#xA;matcher = cv2.DescriptorMatcher_create(&quot;BruteForce-Hamming&quot;)&#xA;&#xA;# the matcher works on single channel images&#xA;grayBack = cv2.cvtColor(imgBack, cv2.COLOR_RGB2GRAY)&#xA;grayTest = cv2.cvtColor(imgTest, cv2.COLOR_RGB2GRAY)&#xA;&#xA;# Compute magic (I found this code elsewhere &#xA;kp1 = detector.detect(grayBack)&#xA;kp2 = detector.detect(grayTest)&#xA;&#xA;k1, d1 = descriptor.compute(grayBack, kp1)&#xA;k2, d2 = descriptor.compute(grayTest, kp2)&#xA;&#xA;matches = matcher.match(d1, d2)&#xA;&#xA;dist = [m.distance for m in matches]&#xA;if len(dist) == 0:&#xA;    print &quot;No Suitable matches found!&quot;&#xA;    sys.exit(1)&#xA;&#xA;mean_dist = sum(dist) / len(dist)&#xA;threshold_dist = mean_dist * 0.5&#xA;&#xA;good_matches = [m for m in matches if m.distance &amp;lt; threshold_dist]&#xA;&#xA;h1, w1 = grayBack.shape[:2]&#xA;&#xA;matches = []&#xA;for m in good_matches:&#xA;    matches.append((m.queryIdx, m.trainIdx))&#xA;&#xA;if len(good_matches) &amp;gt; 0:&#xA;    p1 = np.float32( [k1[i].pt for i, j in matches] )&#xA;    p0 = np.float32( [k2[j].pt for i, j in matches] )&#xA;    H, mask = cv2.findHomography(p0, p1, cv2.RANSAC)&#xA;&#xA;    output = cv2.warpPerspective(imgTest, H, (w1, h1))&#xA;# End Magic&#xA;&#xA;cv2.imwrite(&quot;Test-Warped.png&quot;, output)&#xA;&#xA;imgBack = cv.LoadImage(&quot;Background.png&quot;)&#xA;imgTest = cv.LoadImage(&quot;Test-Warped.png&quot;)&#xA;&#xA;diff = cv.CloneImage(imgBack)&#xA;grayDiff = cv.CreateImage(cv.GetSize(imgBack), cv.IPL_DEPTH_8U, 1)&#xA;&#xA;# Perform simple substraction    &#xA;cv.AbsDiff(imgBack, imgTest, diff)&#xA;cv.CvtColor(diff, grayDiff, cv.CV_RGB2GRAY)&#xA;&#xA;# Get our threshold and expand it a little to clean the edges&#xA;cv.Threshold(grayDiff, grayDiff, 40, 255, cv.CV_THRESH_BINARY)&#xA;cv.Dilate(grayDiff, grayDiff, None, 6)&#xA;cv.Erode(grayDiff, grayDiff, None, 2)&#xA;&#xA;# Copy the test image and mask with our threshold&#xA;fore = cv.CreateImage(cv.GetSize(imgBack), cv.IPL_DEPTH_8U, 3)&#xA;cv.Copy(imgTest, fore, grayDiff)&#xA;&#xA;cv.SaveImage(&quot;Threshold.png&quot;, grayDiff)&#xA;cv.SaveImage(&quot;Foreground.png&quot;, fore)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CuYdT.png&quot; alt=&quot;Intermediate threshold found by algorithm&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hsOhx.png&quot; alt=&quot;Final (crude) extracted foreground&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="6936" LastEditorUserId="6936" LastEditDate="2013-11-11T19:38:25.907" LastActivityDate="2013-11-11T19:38:25.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12609" PostTypeId="2" ParentId="12584" CreationDate="2013-11-11T18:47:04.160" Score="1" Body="&lt;p&gt;Consider the DTFT of an N-sequence $x_n$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;X(e^{j\omega}) &amp;amp;= \sum_{n=0}^{N-1} x_n e^{-j\omega n} &amp;amp; \text{(DTFT)} \\&#xA;&amp;amp;= \sum_n \left ( \frac{1}{N} \sum_{k=0}^{N-1} X_k W_N^{-kn} \right ) e^{-j \omega n} &amp;amp; \text{(subs. IDFT)}&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $X_k = X(e^{j\frac{2\pi}{N}k}), \, W_N = e^{-j\frac{2\pi}{N}}$, and let $\omega_k = \frac{2\pi}{N} k$, then rearrange:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;X(e^{j\omega}) = \sum_{k=0}^{N-1} X_k \left ( \frac{1}{N} \sum_{n=0}^{N-1} e^{j(\omega_k - \omega) n} \right )&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the DTFT of an N-sequence is uniquely determined by N frequency samples uniformly spaced between $0$ and $2\pi$. The term in the parentheses is an interpolation function (it's actually the digital sinc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check whether your $x_n$ is periodic to 150 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens when you zero pad the DFT to length $P &amp;gt; N$ (add $P-N$ more $X_k = 0$ terms), and take the IDFT? You interpolate to a higher sampling rate (since $\omega_k = \frac{2\pi}{P}k$ is less than before).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you're adding points after the first $N/2$ samples, explained &lt;a href=&quot;http://www.dspguru.com/dsp/howtos/how-to-interpolate-in-time-domain-by-zero-padding-in-frequency-domain&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6934" LastEditorUserId="6934" LastEditDate="2013-11-12T02:44:42.233" LastActivityDate="2013-11-12T02:44:42.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12610" PostTypeId="2" ParentId="11445" CreationDate="2013-11-11T19:17:36.003" Score="3" Body="&lt;p&gt;Since you already know your background image beforehand, it should be simple. I done many background subtraction before. Here is an example of removal of background by comparison.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if (newBitmap.Width == backgroundBitmap.Width &amp;amp;&amp;amp; newBitmap.Height == backgroundBitmap.Height)&#xA;    {&#xA;        for(int x = 0; x &amp;lt; newBitmap.Width; x++)&#xA;        {&#xA;            for (int y = 0; y &amp;lt; newBitmap.Height; y++)&#xA;            {&#xA;                Color firstPixel = newBitmap.GetPixel(x, y);&#xA;                Color SecondPixel = backgroundBitmap.GetPixel(x, y);  &#xA;&#xA;                int Totalfirst = (int)((firstPixel.R * .3) + (firstPixel.G * .59) + (firstPixel.B * .11));&#xA;                int Totalsecond = (int)((SecondPixel.R * .3) + (SecondPixel.G * .59) + (SecondPixel.B * .11));&#xA;                if (Totalfirst &amp;lt; Totalsecond )&#xA;                {&#xA;&#xA;                    Color WhiteColor = Color.FromArgb(0, 0, 0);&#xA;                    newBitmap.SetPixel(x, y, WhiteColor);&#xA;                }&#xA;                else&#xA;                {&#xA;                    Color SameColor = Color.FromArgb(firstPixel.R, firstPixel.G, firstPixel.B);&#xA;                    newBitmap.SetPixel(x, y, SameColor);&#xA;                }&#xA;&#xA;            }&#xA;        }&#xA;    }&#xA;    FinalImage = newBitmap; // after substaction of back ground.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code is just a copy and paste from one of the program I did back then. Note that newBitmap is the image of the object and the background, your second picture. While the backgroundBitmap is well, the background. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use this as your reference on how your code should look like for this segment. Should be good enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I am new to this website(my first post here), but I think for image processing questions, you can post it to &lt;a href=&quot;https://stackoverflow.com/questions&quot;&gt;https://stackoverflow.com/questions&lt;/a&gt; next time, there will be more people to help you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this method doesn't work, let me know, cause I still got some other methods. But from you question, this should be sufficient. &lt;/p&gt;&#xA;" OwnerUserId="6937" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2013-11-11T19:17:36.003" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="12611" PostTypeId="1" AcceptedAnswerId="12612" CreationDate="2013-11-11T19:54:29.500" Score="0" ViewCount="560" Body="&lt;p&gt;How do you calculate the noise equivalent bandwidth for an IIR or FIR filter? &lt;/p&gt;&#xA;" OwnerUserId="5843" LastActivityDate="2013-11-11T23:55:55.303" Title="Noise Equivalent Bandwith of IIR and FIR Filters?" Tags="|noise|infinite-impulse-response|bandwidth|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12612" PostTypeId="2" ParentId="12611" CreationDate="2013-11-11T20:11:36.453" Score="1" Body="&lt;p&gt;Hm, isn't it the same as for any filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;B_\text{eq} = \frac{1}{|H(e^{j\omega_0})|^2} \int_0^\infty |H(e^{j\omega})|^2 d\omega&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(e^{j\omega})$ is the frequency response, and $\omega_0$ is the max-abs frequency. For FIR filters, you can just use e.g. &lt;code&gt;freqz&lt;/code&gt; in MATLAB/Octave. For IIR filters, you'd have to do analysis or take measurements (or see if you can get away with truncating) &lt;/p&gt;&#xA;" OwnerUserId="6934" LastEditorUserId="6934" LastEditDate="2013-11-11T23:55:55.303" LastActivityDate="2013-11-11T23:55:55.303" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12613" PostTypeId="2" ParentId="12596" CreationDate="2013-11-12T03:35:12.587" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/realsimple/faust_strings/faust_strings.pdf&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/realsimple/faust_strings/faust_strings.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks like a very good resource; I'm guessing it will take me a couple of weeks to work through...&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2013-11-12T03:35:12.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12615" PostTypeId="1" AcceptedAnswerId="12616" CreationDate="2013-11-12T06:35:40.210" Score="4" ViewCount="10059" Body="&lt;p&gt;I am doing a project on image classification and I don't know where to get the data-set collection for cars and bikes.Any suggestions to sites for this purpose is welcome.Also please suggest the general size of images to act as a database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and regards in advance.&lt;/p&gt;&#xA;" OwnerUserId="6941" LastEditorUserId="53" LastEditDate="2013-11-13T16:52:34.047" LastActivityDate="2019-11-27T07:24:38.683" Title="Where to get a proper dataset collection for bikes and cars" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12616" PostTypeId="2" ParentId="12615" CreationDate="2013-11-12T07:10:13.940" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://www.emt.tugraz.at/~pinz/data/GRAZ_02/&quot; rel=&quot;nofollow&quot;&gt;Bike and Cars database&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.emt.tugraz.at/~pinz/data/GRAZ_02/&quot; rel=&quot;nofollow&quot;&gt;http://www.emt.tugraz.at/~pinz/data/GRAZ_02/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/Imagedbase.htm&quot; rel=&quot;nofollow&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/CVonline/Imagedbase.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps .. Download the bike.zip and cars.zip files and extract it.. If it is correct, click the tick mark to accept the answer.&lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2013-11-12T07:10:13.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12617" PostTypeId="2" ParentId="12596" CreationDate="2013-11-12T08:27:59.063" Score="1" Body="&lt;p&gt;Using a loss filter, G(w), each harmonic (really, the overtones will be nearly harmonic) will decay by G(w) over each pass.  So, when you use a lowpass filter (e.g., .995*(X[n-1] + X[n-2])/2), higher harmonics are attenuated more than lower ones.  Also, since higher notes use shorter delay lines (or rings), these losses will occur more often per time unit.  Hence, the higher notes decay especially fast. So, if you want to stick with the moving average loss filter, you need to design that loss filter's magnitude response toward getting the desired decay time for each harmonic, given the delay (ring) length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you have some harmonic at frequency, w1, and you want it to decay with envelope  A1(t) = exp(-alpha*t)  where t = 0,1,2... , you need to solve for G(w1) where exp(-alpha*t) = [G(w1)]^(t/L) where L is the delay length for the note.  Please note that -1 &amp;lt; G(w1) &amp;lt; 1 for stability. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your purposes, I'd suggest setting the fundamental to some desired decay, and tweaking from there.  Using a two-tap filter doesn't give you a lot of control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what you're looking to do, I'd recommend you start with the Extended KS paper: &lt;a href=&quot;http://www.music.mcgill.ca/~gary/courses/papers/Jaffe-Extensions-CMJ-1983.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.music.mcgill.ca/~gary/courses/papers/Jaffe-Extensions-CMJ-1983.pdf&lt;/a&gt;&#xA;If you're just trying to do some simple KS stuff, it has everything you need.&lt;/p&gt;&#xA;" OwnerUserId="5559" LastEditorUserId="5559" LastEditDate="2013-11-12T08:34:22.213" LastActivityDate="2013-11-12T08:34:22.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12618" PostTypeId="1" CreationDate="2013-11-12T09:09:07.270" Score="1" ViewCount="149" Body="&lt;p&gt;I was reading about active sonar and couldn't quite understand how the echos are recognized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My doubt is, when the sound signal is reflected back, it is greatly attenuated and distorted due to many factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do they use MFCC(which I think is only good for audible range) for identifying the echo or are there any other better techniques? I feel that the problem is modeled and the echo data is fit to the model but I am not sure.&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="13320" LastEditDate="2016-08-13T13:06:02.660" LastActivityDate="2016-10-12T14:08:12.360" Title="Echo detection for localization" Tags="|acoustics|sonar|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12619" PostTypeId="1" AcceptedAnswerId="12631" CreationDate="2013-11-12T09:12:02.297" Score="0" ViewCount="1704" Body="&lt;p&gt;I'm working on my own implementation of the discrete Haar wavelet transform, I understand the wavelet theory and how to construct the Haar matrix of size N to perform the transform, but obviously there is a problem using the Haar matrix in application - it's simply too big.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on an application that applies the Haar transform to an audio signal. If I sample the signal at 44.1 kHz, even a one second recording would require a 2^16 by 2^16 Haar matrix to do the transform in one step, which is obviously impractical and a hardware constrained machine such as a phone wouldn't have the capability to hold such a matrix in memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other method I've seen used is that a 2X2 Haar matrix is applied to the entire signal iteratively, and the results are stored in two arrays - one array holding the &quot;average&quot; Haar coefficients (first element of the output vector) and the other holding the &quot;difference&quot; coefficients (second element of the output vector). The process is then repeated over the &quot;average&quot; coefficients - as these coefficients are essentially the result of a lowpass filter.  Each time the process is repeated the number of elements needed to process in the following step is halved, until only one lowpass coefficient is left. This seems fine, and definitely works but when I started to think about it, it just seems that it would be really slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main question is, what's a good way to implement a fast and efficient haar transform? Or a practical way to apply one of these two methods?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I've been learning about this completely on my own, so if I made some mistakes in my explanation or way of thinking about this stuff let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PSS: I've never done any kind of audio processing before, so if you know about some other filters that I should apply to the raw signal before doing a wavelet transform let me know!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PSSS: I know that the Haar wavelet may not be the best for this type of signal processing, but when I tried to learn about using other DWTs such as the Daubechies wavelets, the literature seemed very confusing, or at least was directed at more advanced readers. If anyone could point me in the direction of how to implement other DWTs, that would be great. &lt;/p&gt;&#xA;" OwnerUserId="6944" LastActivityDate="2013-11-13T01:41:41.720" Title="discrete Haar wavelet transform, fast and efficient method?" Tags="|filters|audio|algorithms|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12621" PostTypeId="1" AcceptedAnswerId="12623" CreationDate="2013-11-12T12:42:54.557" Score="0" ViewCount="730" Body="&lt;p&gt;Here I have a MATLAB code for Ideal Low pass filtering an Image. In the below code they have used &lt;code&gt;D=sqrt(U.^2+V.^2);&lt;/code&gt; which finds some distances. Then this distance matrix D is compared with the cut-off frequency to create a filter function H ( &lt;code&gt;H=double(D&amp;lt;=P);&lt;/code&gt; ) that has be multiplied with the fourier transformed image F. i.e, &lt;code&gt;G=H.*F;&lt;/code&gt; to get the output image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions: What is this distance ? Why we need this distance matrix D ? What information this gives to us? &lt;strong&gt;How it helps in Low Pass Filter an Image? (I understood that it helps to create the filter function H) but Why we need the distances to create the filter function? I need to it understand clearly. This may be a simple question but could anyone please explain me this with little patience.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for reading my question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;http://www.mathworks.in/matlabcentral/fileexchange/13586-ideal-low-pass-filter/content/idealfilter.m&quot; rel=&quot;nofollow&quot;&gt;MATHWORKS:IDEAL LOW PASS FILTER&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;%IDEAL LOW-PASS FILTER&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    function idealfilter(X,P) % X is the input image and P is the cut-off freq&#xA;    f=imread(X);  % reading an image X&#xA;    [M,N]=size(f); % Saving the the rows of X in M and columns in N&#xA;    F=fft2(double(f)); % Taking Fourier transform to the input image&#xA;&#xA;    u=0:(M-1);&#xA;    v=0:(N-1);&#xA;    idx=find(u&amp;gt;M/2);&#xA;    u(idx)=u(idx)-M;&#xA;    idy=find(v&amp;gt;N/2);&#xA;    v(idy)=v(idy)-N;&#xA;    [V,U]=meshgrid(v,u);&#xA;    D=sqrt(U.^2+V.^2);   % finding out the distance &#xA;&#xA;   H=double(D&amp;lt;=P);       % Comparing with the cut-off frequency &#xA;    G=H.*F;               % Multiplying the Fourier transformed image with H&#xA;    g=real(ifft2(double(G))); % Inverse Fourier transform&#xA;    imshow(f),figure,imshow(g,[ ]); % Displaying input and output image&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2013-11-12T23:31:58.300" Title="Why we need distances in Ideal LPF?" Tags="|image-processing|matlab|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12622" PostTypeId="1" CreationDate="2013-11-12T13:33:44.297" Score="1" ViewCount="145" Body="&lt;p&gt;I have a device (whose behaviour I can't change) which does the following signal processing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The incomming signal contains two frequencies $f_1$ and $f_2$. One has a huge amplitude, the other a smaller one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_1 = X_{01} \cdot cos(2\pi f_1 \cdot t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_2 = X_{02} \cdot cos(2\pi f_2 \cdot t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with (for example):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_1 = 20.02e6, f_2 = 20e6, X_{01} &amp;gt;&amp;gt; X_{02}$ (Actually $f_2$ is an interfering signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example for this signal (only the beating envelope is visible) is depicted below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/i9J7N.png&quot; alt=&quot;time signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first, phase durations are calculated by &quot;measuring&quot; the duration between two zero crossings. Then the phase duration of $f_1$ is subtracted - so if $f_2$ wouldn't be there, the phase duration signal would always be zero.&#xA;But since there is $f_2$ also, the phase duration signal contains a new periodic signal, beeing periodic with $f = f_1-f_2 = 20kHz$. I get the following signal:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/auxCc.png&quot; alt=&quot;phase signal - complete&quot;&gt;&#xA;With zoom&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VQ5s5.png&quot; alt=&quot;phase signal - zoom&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is: This signal is not a pure sine wave but it contains some additional frequencies - as already visible in the zoomed phase signal. The DFT shows the containing frequencies (which are harmonics). They are depicted below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/r0F3s.png&quot; alt=&quot;DFT of the complete phase signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know an equation for the amplitudes of those frequencies as a function of the amplitude and frequency of $X_{01}$ and $X_{02}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it more complex, I unfortunaly have a second interfering signal at $f_3=19.08e6$. Is there an equation for this case, too?&lt;/p&gt;&#xA;" OwnerUserId="5434" LastEditorUserId="128" LastEditDate="2018-07-06T11:42:10.573" LastActivityDate="2018-07-06T11:42:10.573" Title="Calculate a Kind of Equivalent Baseband Signal by Examining the Zero Crossing" Tags="|discrete-signals|signal-analysis|modulation|phase|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12623" PostTypeId="2" ParentId="12621" CreationDate="2013-11-12T13:43:12.417" Score="3" Body="&lt;p&gt;In the Fourier domain, the frequency increases with the distance from origo. So an ideal low-pass filter in the Fourier domain is shaped like a disk centered at the origo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here they work with only one quadrant of the Fourier domain. Therefore, they create a pie-shaped mask &lt;code&gt;H&lt;/code&gt; for the quadrant by computing the Euclidean distance from the quadrant corner and store the distance values in &lt;code&gt;D&lt;/code&gt;. The mask &lt;code&gt;H&lt;/code&gt; is then chosen as all elements in &lt;code&gt;D&lt;/code&gt; with values less than the parameter &lt;code&gt;P&lt;/code&gt; (which is the radius of the disk).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the answer to your question(s) is that the distance computation helps the method compute the filter shape. The key is that a constant Euclidean distance from a point defines the shape of a circle, and all elements inside that circle form the disk that is used as filter mask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, naturally, after filtering, only the low-frequency components of the image are left in the Fourier domain. Then the low-pass filtered image is retrieved by inverse transforming the filtered image back from the Fourier domain to the spatial domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an illustrated example to clarify the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical way of illustrating filtering in the Fourier domain is to show the input image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kNf1y.jpg&quot; alt=&quot;cam1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we show the Fourier transform of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p6gBP.jpg&quot; alt=&quot;cam1_fourier&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the origo of the Fourier space is in the center. Since the frequencies increase with the distance from origo, the ideal filter is a disk with its center at the origo. Here we see the disk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tfltm.jpg&quot; alt=&quot;filter_mask&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The disk radius is the input parameter &lt;code&gt;P&lt;/code&gt;. We use the disk to filter the image by multiplying the filter with the transformed image. We then get the filtered transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/x8uBr.jpg&quot; alt=&quot;filtered_cam1_fourier&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the filtered image we take the inverse transform of the filtered result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NTpcl.jpg&quot; alt=&quot;filtered_cam1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good. As I said, this is usually how low-pass filtering in the Fourier domain is explained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what I was trying to explain when talking about quadrants of the Fourier domain, which got a bit confusing, is that &lt;strong&gt;the result from the Fourier transform in the MATLAB code provided does not have origo centered&lt;/strong&gt; as in the second image in the example above (the image showing the unfiltered Fourier transform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead the result from the Fourier transform &lt;code&gt;F=fft2(double(f))&lt;/code&gt; looks like this (we refer to it as the &lt;em&gt;transform image&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lgWV7.jpg&quot; alt=&quot;cam1_fourier_real&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that since the filter is a disk with its center in origo, the disk must be placed in the corner of the transform image. Since the Fourier transform is cyclic, the filter should wrap around to cover all four corners of the transform image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hNCZS.jpg&quot; alt=&quot;filter_mask_real&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is where the distance matrix &lt;code&gt;D&lt;/code&gt; comes in. It is used to compute the filter mask above. &lt;code&gt;D&lt;/code&gt; is computed by taking the Euclidean distance from each corner (using a neat trick with &lt;code&gt;meshgrid&lt;/code&gt;). So &lt;code&gt;D&lt;/code&gt;is the Euclidean distance map looking like this,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QeLgZ.jpg&quot; alt=&quot;D&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where blue values represent low distances and red values represent high.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Top left corner of D&#xA;0.00000   1.00000   2.00000   3.00000   4.00000   5.00000&#xA;1.00000   1.41421   2.23607   3.16228   4.12311   5.09902&#xA;2.00000   2.23607   2.82843   3.60555   4.47214   5.38516&#xA;3.00000   3.16228   3.60555   4.24264   5.00000   5.83095&#xA;4.00000   4.12311   4.47214   5.00000   5.65685   6.40312&#xA;5.00000   5.09902   5.38516   5.83095   6.40312   7.07107&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The filter mask can therefore simply be acquired by selecting the elements in &lt;code&gt;D&lt;/code&gt; that have a distance value less than or equal to &lt;code&gt;P&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest of the code works as in the example described above. That is, the filter mask is multiplied by the transform image, and the result is inverse transformed to get the low-pass filtered image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this clarifies what role the distance computation has for creating the filter.&lt;/p&gt;&#xA;" OwnerUserId="6949" LastEditorUserId="6949" LastEditDate="2013-11-12T23:31:58.300" LastActivityDate="2013-11-12T23:31:58.300" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12624" PostTypeId="1" CreationDate="2013-11-12T14:57:27.560" Score="4" ViewCount="1379" Body="&lt;p&gt;We can often read that Hilbert transform is useful for envelope detection (e.g.&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/424/hilbert-transform-to-compute-signal-envelope&quot;&gt;Hilbert transform to compute signal envelope?&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done some tests with various soundfiles, and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x[n] -&amp;gt; absolue value -&amp;gt; 1-pole low pass filter -&amp;gt; envelope&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x[n] -&amp;gt; Hilbert transform -&amp;gt; absolute value -&amp;gt; 1-pole low pass filter -&amp;gt; envelope&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives the same kind of result, it's not better with a Hilbert transform (top : envelope computed with hilbert, bottom : envelope computed without hilbert) :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sNCEA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, I know that computing the Hilbert transform is very time-consuming (big FIR filters involved).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it is really a good method for envelope detection ?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-11-12T15:11:58.713" Title="Why do we read that Hilbert transform can be used for envelope detection?" Tags="|filters|signal-analysis|sampling|hilbert-transform|amplitude|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12625" PostTypeId="2" ParentId="12624" CreationDate="2013-11-12T15:11:58.713" Score="1" Body="&lt;p&gt;Using a Hilbert transform with a sufficiently narrow-band signal, the low pass filter may not be needed even for continuous envelope estimation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-12T15:11:58.713" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12626" PostTypeId="1" AcceptedAnswerId="12627" CreationDate="2013-11-12T15:53:57.207" Score="0" ViewCount="1308" Body="&lt;p&gt;Given a an IIR lowpass-filter in z-space:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ H(z) = \frac{\sum_{i=0}^P b_{i} z^{-i}}{1+\sum_{j=1}^Q a_{j} z^{-j}} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to calculate it's 3dB cut-off frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I about evaluating it's fourier transform (as long it exits) and take it's magnitude:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1}{\sqrt{2}} = \frac{|H(e^{j\omega_c)}|}{|H(e^{j0})|}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is then transformed to calculate $\omega_c$. Is this correct? Are there other ways to do that?&lt;/p&gt;&#xA;" OwnerUserId="6951" LastEditorUserId="6951" LastEditDate="2013-11-12T22:29:56.120" LastActivityDate="2013-11-12T22:29:56.120" Title="Calculate cut-off frequency of lowpass IIR-filter" Tags="|fourier-transform|lowpass-filter|infinite-impulse-response|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12627" PostTypeId="2" ParentId="12626" CreationDate="2013-11-12T16:56:47.167" Score="2" Body="&lt;p&gt;This will work but only if the it's actually a low pass filter. Your formula describes any possible IIR filter so it could really be anything.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-12T16:56:47.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12628" PostTypeId="2" ParentId="2565" CreationDate="2013-11-12T17:56:19.080" Score="2" Body="&lt;p&gt;try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;''' Detect human skin tone and draw a boundary around it.&#xA;Useful for gesture recognition and motion tracking.&#xA;&#xA;Inspired by: http://stackoverflow.com/a/14756351/1463143&#xA;&#xA;Date: 08 June 2013&#xA;'''&#xA;&#xA;# Required moduls&#xA;import cv2&#xA;import numpy&#xA;&#xA;# Constants for finding range of skin color in YCrCb&#xA;min_YCrCb = numpy.array([0,133,77],numpy.uint8)&#xA;max_YCrCb = numpy.array([255,173,127],numpy.uint8)&#xA;&#xA;# Create a window to display the camera feed&#xA;cv2.namedWindow('Camera Output')&#xA;&#xA;# Get pointer to video frames from primary device&#xA;videoFrame = cv2.VideoCapture(0)&#xA;&#xA;# Process the video frames&#xA;keyPressed = -1 # -1 indicates no key pressed&#xA;&#xA;while(keyPressed &amp;lt; 0): # any key pressed has a value &amp;gt;= 0&#xA;&#xA;    # Grab video frame, decode it and return next video frame&#xA;    readSucsess, sourceImage = videoFrame.read()&#xA;&#xA;    # Convert image to YCrCb&#xA;    imageYCrCb = cv2.cvtColor(sourceImage,cv2.COLOR_BGR2YCR_CB)&#xA;&#xA;    # Find region with skin tone in YCrCb image&#xA;    skinRegion = cv2.inRange(imageYCrCb,min_YCrCb,max_YCrCb)&#xA;&#xA;    # Do contour detection on skin region&#xA;    contours, hierarchy = cv2.findContours(skinRegion, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)&#xA;&#xA;    # Draw the contour on the source image&#xA;    for i, c in enumerate(contours):&#xA;        area = cv2.contourArea(c)&#xA;        if area &amp;gt; 1000:&#xA;            cv2.drawContours(sourceImage, contours, i, (0, 255, 0), 3)&#xA;&#xA;    # Display the source image&#xA;    cv2.imshow('Camera Output',sourceImage)&#xA;&#xA;    # Check for user input to close program&#xA;    keyPressed = cv2.waitKey(1) # wait 1 milisecond in each iteration of while loop&#xA;&#xA;# Close window and camera after exiting the while loop&#xA;cv2.destroyWindow('Camera Output')&#xA;videoFrame.release()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6952" LastActivityDate="2013-11-12T17:56:19.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12629" PostTypeId="2" ParentId="12580" CreationDate="2013-11-12T22:55:07.890" Score="1" Body="&lt;pre&gt;&lt;code&gt;clear all&#xA;clc&#xA;&#xA;for phase_orig = 0:pi/18:pi,&#xA;&#xA;%% Specify and generate signal&#xA;Amp = 1;                     % Amplitude of signal&#xA;Fs = 8000;                   % samples per second&#xA;dt = 1/Fs;                   % seconds per sample&#xA;Fc = 21.3;                   % Hz&#xA;StopTime = 0.25;             % seconds&#xA;t = (0:dt:StopTime-dt)';     % seconds&#xA;&#xA;siglen = length(t);&#xA;sig = Amp * 1.5 * sin(2*pi*(0:siglen-1)*(Fc/siglen) + phase_orig) + 1.5 * Amp * sin(2*pi*(0:siglen-1)*(Fc/siglen) * 3) ...&#xA;  + 1.5 * Amp * sin(2*pi*(0:siglen-1)*(Fc/siglen) * 5)+ 0.3 * Amp * sin(2*pi*(0:siglen-1)*(Fc/siglen) * 7) ...&#xA;  + 1.3 * Amp * sin(2*pi*(0:siglen-1)*(Fc/siglen) * 9)+ 1.4 * Amp * sin(2*pi*(0:siglen-1)*(Fc/siglen) * 11);&#xA;&#xA;%% Estimate the peak value of the signals fundamental using Goertzel algorithm&#xA;peak = 0;&#xA;indvec = [Fc-1 Fc Fc+1];&#xA;&#xA;% Check the input data&#xA;if ~isvector(sig) || isempty(sig)&#xA;  error('X must be a nonempty vector')&#xA;end&#xA;&#xA;if ~isvector(indvec) || isempty(indvec)&#xA;  error('INDVEC must be a nonempty vector')&#xA;end&#xA;if ~isreal(indvec)&#xA;  error('INDVEC must contain real numbers')&#xA;end&#xA;&#xA;% forcing x to be column&#xA;sig = reshape(sig,siglen,1);&#xA;&#xA;% initialization&#xA;no_freq = length(indvec); %number of frequencies to compute&#xA;y = zeros(no_freq,1); %memory allocation for the output coefficients&#xA;&#xA;% Computation via second-order system&#xA;% loop over the particular frequencies&#xA;for cnt_freq = 1:no_freq&#xA;  %for a single frequency:&#xA;  %a/ precompute the constants&#xA;  pik_term = 2*pi*(indvec(cnt_freq))/(siglen);&#xA;  cos_pik_term2 = cos(pik_term) * 2;&#xA;  cc = exp(-1i*pik_term); % complex constant&#xA;  %b/ state variables&#xA;  s0 = 0;&#xA;  s1 = 0;&#xA;  s2 = 0;&#xA;  %c/ 'main' loop&#xA;  for ind = 1:siglen-1 %number of iterations is (by one) less than the length of signal&#xA;    %new state&#xA;    s0 = sig(ind) + cos_pik_term2 * s1 - s2;  % (*)&#xA;    %shifting the state variables&#xA;    s2 = s1;&#xA;    s1 = s0;&#xA;  end&#xA;  %d/ final computations&#xA;  s0 = sig(siglen) + cos_pik_term2 * s1 - s2; %correspond to one extra performing of (*)&#xA;  y(cnt_freq) = s0 - s1*cc; %resultant complex coefficient&#xA;&#xA;  %complex multiplication substituting the last iterationA&#xA;  %and correcting the phase for (potentially) non-integer valued&#xA;  %frequencies at the same time&#xA;  y(cnt_freq) = y(cnt_freq) * exp(-1i*pik_term*(siglen-1));&#xA;end&#xA;&#xA;  % perfom amplitude scaling&#xA;  peak = abs(y(2)) * 2 / siglen&#xA;&#xA;% perform parabolic interpolation to get the phase estimate&#xA;phase_orig=phase_orig*180/pi&#xA;ym1 = angle(unwrap(y(1)));&#xA;y0 = angle(unwrap(y(2)));&#xA;yp1 = angle(unwrap(y(3)));&#xA;&#xA;p = (yp1 - ym1)/(2*(2*y0 - yp1 - ym1)); &#xA;phase = y0 - 0.25*(ym1-yp1)*p;&#xA;phase_est = phase * 180/pi + 90;&#xA;phase_est = mod(phase_est+180,360)-180&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The frequencies you are dealing with (21.3Hz sampled at 8kHz) are very low.  Because these are real-valued signals, they will exhibit a bias in phase estimation for ** any** frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This picture shows a plot of the bias (&lt;code&gt;phase_est - phase_orig&lt;/code&gt;) for &lt;code&gt;Fc = 210.3;&lt;/code&gt; (in red) versus the bias for &lt;code&gt;Fc = 21.3;&lt;/code&gt;.  As you can see, the offset is much more significant for the &lt;code&gt;21.3&lt;/code&gt; case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to reduce your sampling rate.  The green curve shows the bias for &lt;code&gt;Fs = 800&lt;/code&gt; instead of &lt;code&gt;8000&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2Dg4h.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5416" LastEditorUserId="80" LastEditDate="2013-11-15T13:46:32.153" LastActivityDate="2013-11-15T13:46:32.153" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="12630" PostTypeId="1" AcceptedAnswerId="12635" CreationDate="2013-11-13T01:27:03.627" Score="4" ViewCount="20963" Body="&lt;p&gt;When I calculate the cross correlation between two vectors with the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = [1 2 3 4 5];&#xA;b = [6 9 8 9 10];&#xA;&#xA;% correlation using convolution&#xA;conv(a,conj(flipdim(b,2)))&#xA;% correlation using FFT&#xA;ifft(fft(a,9).*conj(fft(b,9)))&#xA;fftshift(ans)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when I use the FFT i need to fftshift the output in order to get the correct cross correlation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ans = 10    29    56    92   134   116    94    69    30&#xA;&#xA;ans = 134.0000  116.0000   94.0000   69.0000   30.0000   10.0000   29.0000   56.0000   92.0000&#xA;&#xA;ans = 10.0000   29.0000   56.0000   92.0000  134.0000  116.0000   94.0000   69.0000   30.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, if i just calculate the convolution of the two vectors using the FFT I don't need to apply the ffshift&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; conv(a,b)&#xA; ifft(fft(a,9).*fft(b,9))&#xA;&#xA;ans = 6    21    44    76   118   124   106    85    50&#xA;&#xA;ans = 6.0000   21.0000   44.0000   76.0000  118.0000  124.0000  106.0000   85.0000   50.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why do I need to do a fftshift when calculating the cross correlation? I guess it must be very obvious but I just don't see it right now and I've been googling for hours.&lt;/p&gt;&#xA;" OwnerUserId="3865" LastEditorUserId="3865" LastEditDate="2013-11-13T12:52:58.077" LastActivityDate="2013-11-13T13:52:25.427" Title="Cross correlation with FFT and fftshift" Tags="|matlab|fft|correlation|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12631" PostTypeId="2" ParentId="12619" CreationDate="2013-11-13T01:41:41.720" Score="0" Body="&lt;p&gt;The Haar wavelet is actually a part of the Daubechies wavelet, for the case D=2. There's some example code &lt;a href=&quot;https://en.wikipedia.org/wiki/Daubechies_wavelet&quot; rel=&quot;nofollow&quot;&gt;on wikipedia&lt;/a&gt; that shows the Daubachies transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Haar transform is just a low pass filter combined with a high pass filter, with the coefficients being placed in the first and second halves of the signal. Then, this iteratively (or recursively) keep going.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The low pass filter is just the sum of two components while the high pass filter is their difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Haar wavelet case, you can check out &lt;a href=&quot;https://github.com/scottsievert/iSparse/blob/master/UROPv6/dwt.c&quot; rel=&quot;nofollow&quot;&gt;my vectorized code on Github&lt;/a&gt;. Here, &lt;code&gt;idwt2&lt;/code&gt; stands for &quot;Inverse Discrete Wavelet Transform 2D.&quot;&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2013-11-13T01:41:41.720" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="12633" PostTypeId="2" ParentId="7748" CreationDate="2013-11-13T03:06:23.207" Score="3" Body="&lt;p&gt;I guess for a global overview of the state of the art algorithms for segmentation one needs to look for the latest surveys. A good global overview with challenges are presented in &lt;a href=&quot;http://szeliski.org/Book/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Szeliski's Book&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/u84l6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="1273" LastEditDate="2013-11-13T16:01:01.890" LastActivityDate="2013-11-13T16:01:01.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12634" PostTypeId="2" ParentId="11270" CreationDate="2013-11-13T03:23:49.073" Score="5" Body="&lt;p&gt;Following the intuitive answer from @sansuiso, it's important to remember the parameters for the two methods and what kind of filtering they produce:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BF:&lt;/strong&gt; $\sigma_s$ (space), $\sigma_r$ (intensity range) (geometrical interpretation the geodesic distance, to be set) usually $\sigma_s$ is fixed and $\sigma_r$ is chosen to be the gradient function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NLmeans:&lt;/strong&gt; The NL-means algorithm estimates the value of pixel $x$ as an average of the values of all the pixels whose Gaussian neighborhood looks like the neighborhood of $x$, thus resolving the problem of find a good kernel size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;AD:&lt;/strong&gt; The non local diffusivity constant $c$ and the time constant/stopping criterion for the diffusion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For certain conditions a single iteration of the BF produces multiple iterations of various weighted filters and variational schemes given a good choice of the &lt;a href=&quot;ftp://ldvsrv.ldv.e-technik.tu-muenchen.de/pub/Motion_Estimation/Papers/Bilateral%20filter/bilateral_filters_improve.pdf&quot; rel=&quot;nofollow&quot;&gt;penalty function&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://123seminarsonly.com/Seminar-Reports/029/42184313-10-1-1-100-81.pdf&quot; rel=&quot;nofollow&quot;&gt;report&lt;/a&gt; contains a good overview of the different variational filters, penalty functions, iterative thresholding methods (like &lt;em&gt;FISTA&lt;/em&gt;)&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="7988" LastEditDate="2014-02-21T11:06:29.653" LastActivityDate="2014-02-21T11:06:29.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12635" PostTypeId="2" ParentId="12630" CreationDate="2013-11-13T13:52:25.427" Score="8" Body="&lt;p&gt;The (linear or aperiodic) convolution of two vectors $\mathbf x = (x[0], x[1], \ldots, x[N-1])$ and $\mathbf y = (y[0], y[1], \ldots, y[N-1])$ is a vector $$\mathbf z = {\mathbf x}\star {\mathbf y} = (z[0], z[1], \ldots, z[2N-1]).$$&#xA;On the other hand, their cross-correlation is a vector&#xA;$$\mathbf w = {\mathbf x}\otimes {\mathbf y} = (w[-(N-1)], w[-(N-2)], \ldots,&#xA;w[-1], w[0], w[1], \ldots, w[N-2], w[N-1]).$$&#xA;Now, the FFT method for computing convolutions computes the cyclic (a.k.a. periodic&#xA;or circular) convolution of the two vectors.  To compute the linear or&#xA;aperiodic convolution via FFTs, you zero-pad the&#xA;vectors to length $2N-1$ so that the cyclic convolution of the zero-padded&#xA;vectors is exactly the linear convolution you are looking for.&#xA;Thus, after FFTing, term-by-term multiplying, and inverse-FFTing,&#xA;what you get is $\mathbf z$. This is &lt;em&gt;exactly&lt;/em&gt; what you have done as per&#xA;your question. However, when you use the FFT method to compute the&#xA;cross-correlation, what you get is the cyclic cross-correlation of&#xA;the two zero-padded vectors, and this cyclic cross-correlation is not&#xA;$\mathbf w$ but instead&#xA;$$\hat{\mathbf w} = (w[0], w[1], \ldots, w[N-1], w[-(N-1)], w[-(N-2)], \ldots,&#xA;w[-2], w[-1])$$ so that to get the $\mathbf w$ that you want, you need&#xA;to circularly rotate $\hat{\mathbf w}$ so that $w[0]$ appear in the middle&#xA;of the vector.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-11-13T13:52:25.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12636" PostTypeId="1" AcceptedAnswerId="13650" CreationDate="2013-11-13T14:00:59.887" Score="10" ViewCount="10151" Body="&lt;p&gt;My knowledge of wavelets is less than epsilon. Bear with me.&#xA;If I have a signal of two well separated sinusoids (15 and 48 Hz) plus some random noise, I can clearly make out the two in a spectrogram (the two stripes in my picture);&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=0:0.002:1;   % fs = 500 Hz&#xA;x=4*sin(2*pi*15*t)+2*cos(2*pi*48*t);&#xA;xn = x + randn(size(x));&#xA;figure(1);&#xA;plot(xn);&#xA;figure(2);&#xA;spectrogram(xn, 64, 60, [], 500);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wpVuY.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zk2cu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;but, using 'wscalogram', I cant say I can tell the components apart:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    coefs = cwt(xn,1:64,'db8','scalCNT');&#xA;    wscalogram('image',coefs,'scales',1:64,'ydata',xn);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3hatX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to read from the scalogram that there are 2 distinct sinusoids and if so, how can I separate them using wavelet decomposition and filtering? I thought that perhaps my choice of wavelet ('db8') is not optimal but I can't see much difference using other types ad larger (or smaller) number of scales. Clearly I am missing something about where and when and on what to apply wavelets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2020-04-27T21:53:33.730" Title="interpret wavelet scalogram" Tags="|wavelet|spectrogram|filtering|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12637" PostTypeId="2" ParentId="12582" CreationDate="2013-11-13T16:59:40.217" Score="6" Body="&lt;p&gt;I'm pretty new to this myself, so please correct me if I get this wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using your example, &lt;code&gt;J = ordfilt2(I, 9, true(5))&lt;/code&gt;.&#xA;&lt;code&gt;ordfilt2&lt;/code&gt; will move over the 2d array &lt;code&gt;I&lt;/code&gt; in blocks of the same size as &lt;code&gt;true(5)&lt;/code&gt;. For each of these 5x5 blocks, sort all the elements from smallest to largest. Now fill in the corresponding block in &lt;code&gt;J&lt;/code&gt; with a bunch of copies of the 9th smallest element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use a smaller example, so I have room to type it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = [ 1 2 4 5 ;&#xA;      5 3 5 1 ;&#xA;      0 3 5 2 ;&#xA;      2 1 7 7 ];&#xA;J = ordfilt2(I,3, ones(2,2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, let's go through a few blocks one at a time. The first &lt;code&gt;ones(2,2)&lt;/code&gt; block is &lt;code&gt;[1 2; 5 3]&lt;/code&gt; in the top left corner. If we sort these elements, we get &lt;code&gt;[1 2 3 5]&lt;/code&gt;, and since we're looking for the 3rd smallest, we receive a value of 3 for the (1,1) position of &lt;code&gt;J&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;J = [ 3 ? ? ? ;&#xA;      ? ? ? ? ;&#xA;      ? ? ? ? ;&#xA;      ? ? ? ? ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;next up is the &lt;code&gt;I(1:2,2:3)&lt;/code&gt; block. Ordering those elements gives &lt;code&gt;[2 3 4 5]&lt;/code&gt;, so the third smallest is 4. Now we replace &lt;code&gt;J(1,2)&lt;/code&gt; with a 4. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;J = [ 3 4 ? ? ;&#xA;      ? ? ? ? ;&#xA;      ? ? ? ? ;&#xA;      ? ? ? ? ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Go ahead and run this command and compare I, J to understand what's happening. One other thing to know is that the input matrix is padded by default with zeros at the lower and right sides. So the &lt;code&gt;I(4:5,4:5)&lt;/code&gt; block is &lt;code&gt;[ 7 0; 0 0]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6962" LastActivityDate="2013-11-13T16:59:40.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12639" PostTypeId="2" ParentId="12580" CreationDate="2013-11-13T18:50:13.797" Score="3" Body="&lt;p&gt;One method is to find the maximum and fit a parabola about it, and then use the parabola's maximum as the frequency and magnitude estimate.  You can read all about here: &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Sinusoidal_Peak_Interpolation.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/sasp/Sinusoidal_Peak_Interpolation.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5559" LastActivityDate="2013-11-13T18:50:13.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12640" PostTypeId="2" ParentId="12580" CreationDate="2013-11-13T22:04:55.483" Score="3" Body="&lt;p&gt;I had a lot of difficulty with this exact problem a couple of years ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I posted this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/4633203/extracting-precise-frequencies-from-fft-bins-using-phase-change-between-frames&quot;&gt;https://stackoverflow.com/questions/4633203/extracting-precise-frequencies-from-fft-bins-using-phase-change-between-frames&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up doing the calculations from scratch, and posted an answer to my own question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm surprised that I was not able to find any similar exposition on the Internet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will post the answer again here; note that the code is designed for a scenario in which I am overlapping my FFT window by 4x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This puzzle takes two keys to unlock it.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The first key is to understand how overlapping the FFT window introduces a rotation on bin phase.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.dspdimension.com/admin/pitch-shifting-using-the-ft/&quot; rel=&quot;nofollow noreferrer&quot;&gt;The second key comes from Graph 3.3 &amp;amp; 3.4 here (thanks to Stephan Bernsee for permission to copy the pics here).&lt;/a&gt;     &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Graph 3.3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9mQM2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graph 3.4:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lMYlA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code:    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int k = 0; k &amp;lt;= fftFrameSize/2; k++) &#xA;{&#xA;    // compute magnitude and phase &#xA;    bins[k].mag = 2.*sqrt(fftBins[k].real*fftBins[k].real + fftBins[k].imag*fftBins[k].imag);&#xA;    bins[k].phase = atan2(fftBins[k].imag, fftBins[k].real);&#xA;&#xA;    // Compute phase difference Δϕ fo bin[k]&#xA;    double deltaPhase;&#xA;    {&#xA;        double measuredPhaseDiff = bins[k].phase - gLastPhase[k];&#xA;        gLastPhase[k] = bins[k].phase;&#xA;&#xA;        // Subtract expected phase difference &amp;lt;-- FIRST KEY&#xA;        // Think of a single wave in a 1024 float frame, with osamp = 4&#xA;        //   if the first sample catches it at phase = 0, the next will &#xA;        //   catch it at pi/2 ie 1/4 * 2pi&#xA;        double binPhaseExpectedDiscrepancy = M_TWOPI * (double)k / (double)osamp;&#xA;        deltaPhase = measuredPhaseDiff - binPhaseExpectedDiscrepancy;&#xA;&#xA;        // Wrap delta phase into [-Pi, Pi) interval &#xA;        deltaPhase -= M_TWOPI * floor(deltaPhase / M_TWOPI + .5);&#xA;    }&#xA;&#xA;    // say sampleRate = 40K samps/sec, fftFrameSize = 1024 samps in FFT giving bin[0] thru bin[512]&#xA;    // then bin[1] holds one whole wave in the frame, ie 44 waves in 1s ie 44Hz ie sampleRate / fftFrameSize&#xA;    double bin1Freq = (double)sampleRate / (double)fftFrameSize;&#xA;    bins[k].idealFreq = (double)k * bin1Freq;&#xA;&#xA;    // Consider Δϕ for bin[k] between hops.&#xA;    // write as 2π / m.&#xA;    // so after m hops, Δϕ = 2π, ie 1 extra cycle has occurred   &amp;lt;-- SECOND KEY&#xA;    double m = M_TWOPI / deltaPhase;&#xA;&#xA;    // so, m hops should have bin[k].idealFreq * t_mHops cycles.  plus this extra 1.&#xA;    // &#xA;    // bin[k].idealFreq * t_mHops + 1 cycles in t_mHops seconds &#xA;    //   =&amp;gt; bins[k].actualFreq = bin[k].idealFreq + 1 / t_mHops&#xA;    double tFrame = fftFrameSize / sampleRate;&#xA;    double tHop = tFrame / osamp;&#xA;    double t_mHops = m * tHop;&#xA;&#xA;    bins[k].freq = bins[k].idealFreq + 1. / t_mHops;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-11-14T13:20:28.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12641" PostTypeId="2" ParentId="11333" CreationDate="2013-11-13T22:14:27.610" Score="9" Body="&lt;p&gt;To illustrate what both @Jazzmaniac and @Phonon are telling you, let's look at the same plot, but for different window lengths.  Another change is to look at the plots using the &lt;code&gt;fftshift&lt;/code&gt; view --- so that it's clearer that the low positive frequency peaks are close to the low negative frequency peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture below plots the contour plot of the data you have (see &lt;code&gt;scilab&lt;/code&gt; code below) for window lengths of 32, 64, 128 and 256.  Even at the 256 window length, the effect of the &quot;beating&quot; is still somewhat present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GQnLQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Code only below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 500;&#xA;t1 = [0:1/fs:(0.25-1/fs)]&#xA;t2 = [0.25:1/fs:(0.5-1/fs)]&#xA;t3 = [0.5:1/fs:(0.75-1/fs)]&#xA;t4 = [0.75:1/fs:(1-1/fs)]&#xA;T = [t1 t2 t3 t4];&#xA;&#xA;x = [sin(2*%pi*100*t1) sin(2*%pi*50*t2) sin(2*%pi*25*t3) sin(2*%pi*10*t4)];&#xA;&#xA;N = length(x);&#xA;figNo = 1;&#xA;&#xA;figure(1)&#xA;clf&#xA;subplot(221)&#xA;xset(&quot;fpf&quot;,&quot;   &quot;)&#xA;for window_length = 2.^[5:8];&#xA;&#xA;    Z = [];&#xA;    X = [];&#xA;    Y = (([1:window_length]-1)/window_length*fs - fs/2);&#xA;    for k=1:10:N&#xA;        last_index = min(N,k+window_length-1);&#xA;        disp(last_index)&#xA;        padding = window_length - length(k:last_index);&#xA;        disp(padding)&#xA;        X = [X; k];&#xA;        Z = [Z; fftshift(abs(fft([x(k:last_index) zeros(1,padding)])))];&#xA;    end&#xA;&#xA;    subplot(2,2,figNo);&#xA;    figNo = figNo + 1;&#xA;    contour(T(X),Y,Z,4,flag=[2,0,4])&#xA;    title(&quot;Window Length = &quot; + string(window_length) )&#xA;    xlabel('Time');&#xA;    ylabel(&quot;Frequency (Hz)&quot;)&#xA;    //plot3d(X,Y,Z/max(Z)*10,alpha=60,theta=50,flag=[2,3,0],ebox=[0 N -fs/2 fs/2 0 10])&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-13T22:14:27.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12643" PostTypeId="2" ParentId="12580" CreationDate="2013-11-13T23:12:13.403" Score="2" Body="&lt;p&gt;This python code will give you a very accurate result (I used it for lots of musical notes and obtained errors less than 0,01% of semitone) with &lt;strong&gt;parabolic interpolation&lt;/strong&gt; (method successfuly used by McAulay Quatieri, Serra, etc.  in harmonic+residual separation techniques)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;from scipy.io.wavfile import read&#xA;from scipy.fftpack import fft, ifft&#xA;import math&#xA;&#xA;(fs, x) = read('test.wav')&#xA;if (len(x.shape) == 2):    # if stereo we keep left channel only&#xA; x = x[:,1]&#xA;&#xA;n=x.size&#xA;freq = np.arange(n)*1.0/n*fs &#xA;xfft = abs(fft(x))&#xA;&#xA;imax=np.argmax(xfft)  &#xA;p=1.0/2*(xfft[imax-1]/xfft[imax]-xfft[imax+1]/xfft[imax])/(xfft[imax-1]/xfft[imax]-2+xfft[imax+1]/xfft[imax])   # parabolic interpolation &#xA;print 'Frequence detectee avec interpolation parabolique :',(imax+p)*1.0/n*fs, 'Hz'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-11-13T23:17:20.627" LastActivityDate="2013-11-13T23:17:20.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12644" PostTypeId="1" CreationDate="2013-11-13T23:25:37.907" Score="2" ViewCount="246" Body="&lt;p&gt;I'd like to do a &lt;strong&gt;fade out&lt;/strong&gt; of a sound in a few seconds, but in a &quot;spectral way&quot;, with a special curve : &#xA;&lt;img src=&quot;https://i.stack.imgur.com/pl6rF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(here x-axis is time, y-axis is frequency from a few hz to 20khz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the part &quot;to be removed&quot; has to be removed !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know how to do this ? (an EQ / simple IIR/FIR filter  won't work for this, etc.)&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-11-14T14:11:42.090" Title="How to do a spectral fade out?" Tags="|fft|filters|frequency-spectrum|filter-design|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12645" PostTypeId="1" CreationDate="2013-11-14T01:21:17.933" Score="3" ViewCount="686" Body="&lt;p&gt;This question follows from: &lt;a href=&quot;https://dsp.stackexchange.com/questions/12596/synthesizing-harmonic-tones-with-karplus-strong&quot;&gt;Synthesizing harmonic tones with Karplus Strong&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am attempting to generate a full soundbank of 88 notes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can see my three options are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using samples&lt;/li&gt;&#xA;&lt;li&gt;Using something like Karplus Strong (as linked above)&lt;/li&gt;&#xA;&lt;li&gt;Synthesising each harmonic and combining them&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(1) does not give much flexibility and (2) is difficult: to gain any kind of control requires a sophisticated level of understanding of control systems, and I don't have any training. I've been looking through an online MIT lecture series, and I'm daunted. This would take me months or even years to understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One disadvantage of (3) is that it may not handle real-time composition as well as (2); it may be heavier to process. For me that's not a problem, I don't need real-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think (3) should be much easier than (2). It should be possible to construct a formula for the amplitude A(t) of a particular harmonic.  But I imagine there must be some science of shaping these harmonics; I'm sure many people have experimented with this, and there must be publicly available literature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I'm guessing there are some techniques for improving the quality of the sound, for example maybe giving some A * exp( kt ) sin( wt ) wobble to each harmonic, and maybe a note that is struck louder could have a correspondingly higher value for A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: what is the parameter space? i.e.  what are the best things to tweak?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Links to relevant resources are gratefully received!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;π&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS please note that I'm not after any particular timbre, certainly I'm not try to emulate a piano, I'm simply after a harmonic tone that is pleasing to the ear.&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-12-14T19:13:18.493" Title="Constructing a tone through additive synthesis" Tags="|tone-generation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12646" PostTypeId="1" AcceptedAnswerId="12658" CreationDate="2013-11-14T02:35:16.057" Score="3" ViewCount="15119" Body="&lt;p&gt;I've been googling for a while and came across the audio cookbook and Bjorn's blog explaining it further &lt;a href=&quot;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link Here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background info: I've modified the rtl-sdr open source code to tune to a VOR station (transmits heading, typically used for aircraft). I tune to 113.1 MHz which is the the frequency the nearby VOR station transmist data. Inside that 113.1 MHz frequency, there are 3 signals; &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Morse Code at 1020Hz&lt;/li&gt;&#xA;&lt;li&gt;Reference Signal (9960Hz +- 480Hz) (FM this signal, inside this there is another 30Hz signal)&lt;/li&gt;&#xA;&lt;li&gt;Variable Signal (30Hz) &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm trying to isolate these signals. Now when I tune to the station (113.1MHz) and perform amplitude modulation, I can hear the Morse code signal from the speaker with lots of noise in the background. I followed the audio cookbook guide along with Bjorn's implementation to write a BPF function (pasted below) to isolate the Morse code signal (1020Hz) to hear only the morse code with very little to no noise in the background. However, I just about hear nothing, it's like someone just really lowered the volume almost to mute. I'm starting with this because if I can actually hear the morse code signal, then that proves that the BPF works and now I can use that function to isolate the other two signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The values I used to compute a0 to b2: I also did normalize the a0 to b2 values.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sample Rate: 24KHz&lt;/li&gt;&#xA;&lt;li&gt;Center Freq: 1020Hz&lt;/li&gt;&#xA;&lt;li&gt;BW (in octaves): 1 (don't really understand this)&lt;/li&gt;&#xA;&lt;li&gt;gain: 1 (assuming 1 should be ok but again not really sure)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;BPF Function in C Language:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int band_pass_fir(struct morse *_m, int16_t *_signal, int _len)&#xA;{&#xA;  // _m-&amp;gt;signal (int16 array) is my desired output&#xA;  // _signal (int16 array) contains the actual amplitude modulated data received from the signal&#xA;  // _len is the length of _signal&#xA;&#xA;  int i = 2;&#xA;&#xA;  const float b0 = 0.1205498139,&#xA;              b1 = 0,&#xA;              b2 = -0.1205498139,&#xA;              a1 = -1.7626236142,&#xA;              a2 = 0.8273910712;&#xA;&#xA;  while (i &amp;lt; _len)&#xA;  {&#xA;    _m-&amp;gt;signal[i] = (int16_t)(b0 * _signal[i]) +&#xA;                    (int16_t)(b1 * _signal[i-1]) +&#xA;                    (int16_t)(b2 * _signal[i-2]) -&#xA;                    (int16_t)(a1 * _m-&amp;gt;signal[i-1]) -&#xA;                    (int16_t)(a2 * _m-&amp;gt;signal[i-2]);&#xA;&#xA;    _m-&amp;gt;signal[i-2] = _m-&amp;gt;signal[i-1];&#xA;    _m-&amp;gt;signal[i-1] = _m-&amp;gt;signal[i];&#xA;&#xA;    i++;&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;To isolate this 1020Hz signal, is it safe to assume I need a BPF? or do I need some other type of filter?&lt;/li&gt;&#xA;&lt;li&gt;Assuming whatever type of filter I need to isolate the 1020Hz would be the same type of filter I would need to isolate the 30Hz signal (variable signal) ? Is that correct?&lt;/li&gt;&#xA;&lt;li&gt;Do you see if I'm doing anything wrong with my above method?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6965" LastEditorUserId="26407" LastEditDate="2018-12-19T06:16:55.820" LastActivityDate="2018-12-19T06:16:55.820" Title="Bandpass Filter Implementation in C" Tags="|frequency|bandpass|c|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12647" PostTypeId="2" ParentId="12646" CreationDate="2013-11-14T04:35:19.043" Score="1" Body="&lt;p&gt;Just as a quick suggestion, try moving the two _m-&gt;signal[i-2] and _m-&gt;signal[i-1] assignments above the _m-&gt;signal[i] assignment.  It's unlikely that you want _m-&gt;signal[i-1] to be equal to _m-&gt;signal[i] at the end of that routine.&lt;/p&gt;&#xA;" OwnerUserId="572" LastActivityDate="2013-11-14T04:35:19.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12649" PostTypeId="1" CreationDate="2013-11-14T07:41:27.630" Score="2" ViewCount="3793" Body="&lt;p&gt;I want to model a &quot;negative dispersion&quot; in waveguides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to design an all pass filter with inverted phase response? (e.g. -pi at 0 and pi at Nyquist)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel :) this could be possible in complex domain (but don't know how). I could use a Hilbert transformer to complexity real signal at first.&lt;/p&gt;&#xA;" OwnerUserId="6968" LastActivityDate="2013-11-16T05:42:41.893" Title="How to design an all pass type filter with inverted phase response?" Tags="|filters|allpass|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12651" PostTypeId="2" ParentId="12644" CreationDate="2013-11-14T12:22:23.503" Score="3" Body="&lt;p&gt;You want a time-varying low pass filter, automated so that the cutoff frequency follows your curve. For such slow modulations most IIR low pass filters are stable, so you can just find a steep enough low pass filter and update its coefficients while filtering while keeping the filter state.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-11-14T12:22:23.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12652" PostTypeId="2" ParentId="12580" CreationDate="2013-11-14T12:39:22.450" Score="4" Body="&lt;p&gt;If you use Flanagan [1] it is computed from the phase difference of successive phase spectra Δϕ (Instantaneous Frequency) and if you reconstruct the magnitude using a correct factor (Instantaneous Magnitude) [2] use a normalized sinc function:&#xA; $$ \frac{\sin( \pi x ) }{ (\pi x)}$$ And at the end use Parabolic interpolation around the peak magnitude you can get amazing results, today I consider it is the best way, I have been used it and the results are always very solid :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]  J. L. Flanagan and R. M. Golden, “Phase vocoder,” Bell Systems&#xA;Technical Journal, vol. 45, pp. 1493–1509, 1966.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] K. Dressler, “Sinusoidal extraction using an efﬁcient implementation of&#xA;a multi-resolution FFT,” in Proc. 9th Int. Conf. on Digital Audio Effects&#xA;(DAFx-06), Montreal, Canada, Sep. 2006, pp. 247–252.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="80" LastEditDate="2013-11-14T13:21:54.687" LastActivityDate="2013-11-14T13:21:54.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12653" PostTypeId="2" ParentId="11376" CreationDate="2013-11-14T13:30:07.107" Score="12" Body="&lt;p&gt;Whether you scale the output of your DFT, forward or inverse, has nothing to do with convention or what is mathematically convenient. It has everything to do with the input to the DFT. Allow me to show some examples where scaling is either required or not required for both the forward and inverse transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Must scale a forward transform by 1/N.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start with, it ought to be clear that to analyze a simple sine wave, the length of the transform should be irrelevant, mathematically speaking. Suppose N=1024, Freq=100 and your signal is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;f(n) = cos(Freq * 2*Pi * n/N)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take a 1024 point DFT of f(n), you will find that bin[100] = 512. But this isn't a meaningful value until you scale it by N. 512/1024 = 1/2 and of course, the other 1/2 is in the negative spectrum in bin[924]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you double the length of the DFT, N=2048, the output values would be twice those of the 1024 point DFT, which again, makes the results meaningless unless we scale by 1/N. The length of the DFT should not be a factor in these sorts of analysis. So in this example, you must scale scale the DFT by 1/N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Must not scale a forward transform.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose you have the impulse response of a 32 tap FIR filter and want to know its frequency response. For convenience, we will assume a low pass filter with a gain of 1. We know that for this filter, the DC component of the DFT must be 1. And it should be clear that this will be the case no matter the size of the DFT because the DC component is simply the sum of the input values (i.e. the sum of the FIR coefficients). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, for this input, the DFT is not scaled by 1/N to get a meaningful answer. This is why you can zero pad an impulse response as much as you want without affecting the outcome of the transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the fundamental difference between these two examples?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is simple. In the first case, we supplied energy for every input sample. In other words, the sine wave was present for all 1024 samples, so we needed to scale the DFT's output by 1/1024.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second example, by definition, we only supplied energy for 1 sample (the impulse at n=0). It took 32 samples for the impulse to work its way through the 32 tap filter, but this delay is irrelevant. Since we supplied energy for 1 sample, we scale the DFT's output by 1. If an impulse were defined with 2 units of energy instead of 1, we would scale the output by 1/2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Must not scale an inverse transform.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's consider an inverse DFT. As with the forward DFT, we must consider the number of samples we are supplying energy to. Of course, we have to be a bit more careful here because we must fill both the positive and negative frequency bins appropriately. However, if we place an impulse (i.e. a 1) in two appropriate bins, then the resulting output of the inverse DFT will be a cosine wave with an amplitude of 2 no matter how many points we use in the inverse DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, as with the forward DFT, we don't scale the inverse DFT's output if the input is an impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Must scale an inverse transform.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the case where you know the frequency response of a low pass filter and want to do an inverse DFT to get its impulse response. In this case, since we are supplying energy at all points, we must scale the DFT's output by 1/N to get a meaningful answer. This isn't quite as obvious because the input values will be complex, but if you work through an example, you will see that this is true. If you don't scale by 1/N you will have peak impulse response values on the order of N which can't be the case if the gain is 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The four situations I've just detailed are end point examples where it is clear how to scale the DFT's output. However, there is a lot of gray area between the end points. So let’s consider another simple example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have the following signal, with N=1024, Freq=100:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f(n) = 6 * cos(1*Freq * 2*Pi * n/N)  n = 0 - 127&#xA;f(n) = 1 * cos(2*Freq * 2*Pi * n/N)  n = 128 - 895&#xA;f(n) = 6 * cos(4*Freq * 2*Pi * n/N)  n = 896 - 1023&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bERGH.png&quot; alt=&quot;Time Domain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the amplitude, frequency, and duration differences for the three components. Unfortunately, the DFT of this signal will show all three components at the same power level, even though the 2nd component has 1/36 the power level of the other two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sFKtI.png&quot; alt=&quot;UnWindowed Freq Domain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that all three components are supplying the same amount of energy is obvious, which explains the DFT results, but there is an important point to be made here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we know the duration for the various frequency components, then we can scale the various frequency bins accordingly. In this case, we would do this to accurately scale the DFT's output:&#xA;bin[100] /= 128; bin[200] /= 768; bin[400] /= 128;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which brings me to my final point; in general, we have no idea how long a particular frequency component is present at the input to our DFT, so we can't possibly do this sort of scaling. In general however, we do supply energy for every sample point, which is why we should scale the forward DFT by 1/N when analyzing a signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To complicate matters, we would almost certainly apply a window to this signal to improve the DFT's spectral resolution. Since the first and third frequency components are at the beginning and end of the signal, they get attenuated by 27 dB while the center component gets attenuated by only 4 dB (Hanning window).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o46Af.png&quot; alt=&quot;Windowed Spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, the output of the DFT &lt;strong&gt;can be&lt;/strong&gt; a pretty poor representation of the input, scaled or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the inverse DFT, which is usually a pure mathematics problem, as opposed to the analysis of an unknown signal, the input to the DFT is clearly defined, so you know how to scale the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When analyzing a signal with a spectrum analyzer, analog or FFT, the problems are similar. You don't know the power of the signal displayed unless you also know its duty cycle. But even then, the windowing, span, sweep rates, filtering, the detector type, and other factors all work to goof the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, you have to be quite careful when moving between the time and frequency domains. The question you asked regarding scaling is important, so I hope I have made it clear that you must understand the input to the DFT to know how to scale the output. If the input isn't clearly defined, the DFT's output has to be regarded with a great deal of skepticism, whether you scale it or not.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-11-14T13:30:07.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12654" PostTypeId="2" ParentId="12645" CreationDate="2013-11-14T13:40:50.693" Score="2" Body="&lt;p&gt;You say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm not after any particular timbre, certainly I'm not try to emulate a&#xA;       piano, I'm simply after a harmonic tone that is pleasing to the ear.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but I think something that is &lt;em&gt;pleasing to the ear&lt;/em&gt; is probably harder to quantify than &lt;em&gt;emulate a piano&lt;/em&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bill Sethares has done lots of good work (both theoretically in signal processing and practically as a musician).  &lt;a href=&quot;http://sethares.engr.wisc.edu/prelude.html&quot; rel=&quot;nofollow&quot;&gt;Bill wrote a book specifically about these ideas.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can hear an example of his work, called &lt;a href=&quot;http://homepages.cae.wisc.edu/~sethares/C2ShiningC.mp3&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;C to shining C&lt;/strong&gt; here&lt;/a&gt;. &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_tonality#Example%3a_C2ShiningC&quot; rel=&quot;nofollow&quot;&gt;There is a discussion about it on Wikipedia.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The central idea is that consonance and dissonance are related to psychoacoustics: how the brain perceives sound.  As Bill says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For instance, the perception of &quot;timbre&quot; is closely related to (but also quite distinct from) the physical notion of the spectrum of a sound. Similarly, the perception of &quot;in-tuneness&quot; parallels the measurable idea of sensory consonance. The key idea is that consonance and dissonance are not inherent qualities of intervals, but are dependent on the spectrum, timbre, or tonal quality of the sound. To demonstrate this, the first audio track on the accompanying CD plays an example where the octave has been made dissonant by devious choice of timbre, even though other, non-octave intervals remain consonant. In fact, almost any interval can be made dissonant or consonant by proper sculpting of the timbre.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, now that I've said it's too hard to answer your question, I'll try to give some pointers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main parameters to look at are the amplitudes ($A_k$), decay parameter ($\alpha_k$), (relative) phases ($\phi_k$) and frequency ($\omega_k$) relationships between your tones:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s(t) = \sum_{k=0}^{K-1} A_k e^{\alpha_k t} \sin( \omega_k t + \phi_k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a harmonic sound, you probably want to select $\omega_k = (k+1) \omega$ where $\omega$ is your fundamental frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &quot;brighter&quot; sounds, you want $A_k$ for $k&amp;gt;1$ to be larger (i.e. the higher harmonics have greater amplitude).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do &lt;a href=&quot;http://en.wikipedia.org/wiki/Flanging&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;flanging&lt;/em&gt;&lt;/a&gt; or &lt;strong&gt;phasing&lt;/strong&gt; by modulating the phase:&#xA;$$&#xA;\phi_k(t) = \Phi_k \sin(\omega_\phi t)&#xA;$$&#xA;where $\omega_\phi$ is much lower frequency than $\omega_0$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-14T13:40:50.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12655" PostTypeId="2" ParentId="12644" CreationDate="2013-11-14T14:11:42.090" Score="1" Body="&lt;p&gt;In the same way that an low pass filter can cutoff frequency following your curve, an EQ too can be used with the same idea of time-varying&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-11-14T14:11:42.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12656" PostTypeId="2" ParentId="12649" CreationDate="2013-11-14T15:00:59.620" Score="3" Body="&lt;p&gt;Sort of. The inverse of an allpass filter is also an allpass filter and can simply be calculated by time flipping the impulse response. However that makes the filter non-causal. So you need to add bulk delay to make it causal again. As long as you don't need to do real time processing, that's typically not a problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: add a specific example. The key is to do the filtering in the time domain. You need to truncate the IIR response to an FIR response using &quot;enough&quot; samples. &lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% create an arbitrary allpass filter&#xA;b = [-.5 1]; a = [1 -.5];&#xA;&#xA;% calculate the impulse response&#xA;n = 128; d0 = zeros(n,1); d0(1)= 1;&#xA;h1 = filter(b,a,d0);&#xA;&#xA;% time flip and shift by 1 to keep the first sample in the same spot&#xA;h2 = circshift(flipud(h1),1);&#xA;&#xA;% plot frequency responses&#xA;fh1 = fft(h1);&#xA;fh2 = fft(h2);&#xA;phases = unwrap([angle(fh1(1:n/2+1,:)) angle(fh2(1:n/2+1,:))]);&#xA;plot(phases);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="29" LastEditDate="2013-11-15T02:00:19.707" LastActivityDate="2013-11-15T02:00:19.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12657" PostTypeId="2" ParentId="12645" CreationDate="2013-11-14T15:15:28.370" Score="1" Body="&lt;p&gt;4) Use any other sound synthesis method!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additive synthesis is both computationally expensive and quite difficult to control (any modification of timbre involves simultaneous modification of all harmonics - so many parameters, none of them solely linked to a meaningful property of sound...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your goal is not clear (what kind of realism do you expect, and what kind of control do you want on the sound) but it seems to me that something much simpler from a computational point of view and with less parameters would do. For example, a wavetable oscillator + a filter + an envelope; or a 2-op FM synth.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-11-14T15:43:57.377" LastActivityDate="2013-11-14T15:43:57.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12658" PostTypeId="2" ParentId="12646" CreationDate="2013-11-14T15:51:10.277" Score="2" Body="&lt;p&gt;There are a few potential issues:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your code doesn't compute a full output vector, you just keep the last three samples (often referred to as &quot;state variables&quot;. Your output should be a vector of the same length as the input&lt;/li&gt;&#xA;&lt;li&gt;This is only a second order filter. Depending on the exact properties of your signal, this  may not be enough to isolate the component that you want. I'd recommended a Butterworth bandpass filter. In this case you can independently control the lower cutoff and the higher cutoff of your bandpass and also the steepness of the slopes. There are butterworth design tools in &quot;Octave&quot;, see &lt;a href=&quot;http://octave.sourceforge.net/signal/function/butter.html&quot; rel=&quot;nofollow&quot;&gt;http://octave.sourceforge.net/signal/function/butter.html&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;If you need to go to higher order filters, they should be implemented as &quot;cascaded biquads&quot; or &quot;cascaded second order sections&quot;. There are tons of code examples to be found through google&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-14T15:51:10.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12659" PostTypeId="1" CreationDate="2013-11-14T17:28:33.490" Score="5" ViewCount="1583" Body="&lt;p&gt;I have a guitar music signal and I want to detect the onset points via energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the signal example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cdhNA.png&quot; alt=&quot;Signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the energy plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YAacj.png&quot; alt=&quot;Energy&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what would be the best method defining the threshold and consequently finding the peaks. I reckon I will have to set a window length and a window step (I am thinking 1000 and 100 samples respectively on a 44.1KHz sampling rate) and then every loop defining a new threshold (adaptive/local threshold). Every loop I would have to find the window average and compare it to the threshold. I have these questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Does window length = 1000 samples and window step = 100 seems reasonable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) How the threshold would be defined each loop and in relation to what?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) If a window is above length which samples in it would I consider peaks? I think it would be somewhere in the middle but what range around it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe, window middle - window step &amp;lt; peak samples &amp;lt; window middle + window step  ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help.&lt;/p&gt;&#xA;" OwnerUserId="5602" LastEditorUserId="5069" LastEditDate="2013-11-16T16:59:08.147" LastActivityDate="2014-11-13T04:58:28.480" Title="Onset Detection Peak Picking" Tags="|audio|peak-detection|thresholding|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12660" PostTypeId="1" CreationDate="2013-11-14T17:30:18.690" Score="1" ViewCount="284" Body="&lt;p&gt;What is currently the most accurate Voice Activity Detection algorithm with high levels of background noise? I would also appreciate if it does not require any manual calibration. Bonus points for examples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I am referring to accuracy as yielding the lowest amount of false positives and negatives.&lt;/p&gt;&#xA;" OwnerUserId="5485" LastEditorUserId="5485" LastEditDate="2013-11-17T19:06:35.637" LastActivityDate="2013-11-27T13:54:25.833" Title="Most accurate method of Voice Activity Detection?" Tags="|noise|signal-analysis|signal-detection|voice|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12661" PostTypeId="2" ParentId="2565" CreationDate="2013-11-14T17:55:53.383" Score="2" Body="&lt;p&gt;For this special case, I recommend reading up on LAB Color model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in regard to the LAB Color model, read up on Delta E. The distance between 2 colors. More details about color space can be found here: &lt;a href=&quot;http://www.codeproject.com/Articles/613798/Colorspaces-and-Conversions&quot; rel=&quot;nofollow&quot;&gt;http://www.codeproject.com/Articles/613798/Colorspaces-and-Conversions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have never attempted the LAB color model via OpenCV as it's is a hassle to convert from RGB to LAB and back(requires an immediate step). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have explored Delta E on MatLab to great success. You have to select the skin first, draw a small ROI on the video/picture and the program will find all the exact same color tone as the skin you selected via the ROI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is also look into the texture. &#xA;A short preview here: &lt;a href=&quot;http://books.google.com.sg/books?id=bRlk_WjfITIC&amp;amp;pg=PA598&amp;amp;lpg=PA598&amp;amp;dq=skin+thresholding+from+texture&amp;amp;source=bl&amp;amp;ots=28fE0livyh&amp;amp;sig=8EeQTLFCc-JB979_-ccyrhDJlqA&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=aAuFUsHhJoWJrQfpkoCgBg&amp;amp;ved=0CDUQ6AEwAQ#v=onepage&amp;amp;q=skin%20thresholding%20from%20texture&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;http://books.google.com.sg/books?id=bRlk_WjfITIC&amp;amp;pg=PA598&amp;amp;lpg=PA598&amp;amp;dq=skin+thresholding+from+texture&amp;amp;source=bl&amp;amp;ots=28fE0livyh&amp;amp;sig=8EeQTLFCc-JB979_-ccyrhDJlqA&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=aAuFUsHhJoWJrQfpkoCgBg&amp;amp;ved=0CDUQ6AEwAQ#v=onepage&amp;amp;q=skin%20thresholding%20from%20texture&amp;amp;f=false&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is basically training a image database. Comment here if you need help to training the image database or conversion of ColorSpace. A little busy, so the answer is just suggestions that you can do. Cheers.&lt;/p&gt;&#xA;" OwnerUserId="6937" LastActivityDate="2013-11-14T17:55:53.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12662" PostTypeId="1" CreationDate="2013-11-14T19:41:09.503" Score="2" ViewCount="1171" Body="&lt;p&gt;I am working on a project that requires me to detect and track a human in a live video from a webcam connected to a Beagleboard xm. I have completed this task using Opencv in pixel domain. The results on the board are very accurate but extremely slow. Many people have suggested me to leave pixel domain and do the same task in an h.264/MPEG-4 compressed video as it would extremely reduce the computational overhead. I have read many research papers but failed to discover any software platform or a library that I can use to analyze and process h.264 compressed videos. I will be thankful if someone can suggest me some library for h.264 compressed video analysis and guide me further.&#xA;I know about P and I frames but don't know how to extract them and use which programming software or language to process them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and Regards.&lt;/p&gt;&#xA;" OwnerUserId="6975" LastActivityDate="2015-04-29T21:07:41.960" Title="object tracking in raw h.264 compressed video" Tags="|computer-vision|video|" AnswerCount="0" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="12663" PostTypeId="1" AcceptedAnswerId="13223" CreationDate="2013-11-14T21:25:14.467" Score="0" ViewCount="6810" Body="&lt;p&gt;Does some have an example of what a Wiener filter (that can be used directly with &lt;code&gt;scipy.signal.wiener&lt;/code&gt;) can be useful for, in sound processing (it seems that such adaptive filters can be useful for noise reduction, etc.) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried with various (noisy + sinusoids) soundfiles (read into an array &lt;code&gt;x&lt;/code&gt;) with the command&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = wiener(x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it doesn't give such great result... (Normal : I cannot expect something magical with just a simple function that doesn't take any parameter!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just wondered what this function could be useful for (sound processing).&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-12-17T12:46:32.963" Title="scipy.signal.wiener for audio processing" Tags="|filters|audio|signal-analysis|python|adaptive-filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12664" PostTypeId="2" ParentId="12663" CreationDate="2013-11-14T21:48:10.043" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/tutorial/signal.html&quot; rel=&quot;nofollow&quot;&gt;This page has some relevant information.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Wiener filter is a simple deblurring filter for denoising images. This is not the Wiener filter commonly described in image reconstruction problems but instead it is a simple, local-mean filter. Let $x$ be the input signal, then the output is&#xA;  $$&#xA;y = \left\{  \begin{array}{cl} \frac{\sigma^2}{\sigma_x^2} m_x + ( 1 - \frac{\sigma^2}{\sigma_x^2}) x &amp;amp; \sigma_x^2 \ge \sigma^2\\  &#xA;m_x &amp;amp; \sigma_x^2 \lt \sigma^2&#xA;\end{array} \right.&#xA;$$&#xA;  where $m_{x}$ is the local estimate of the mean and $\sigma_{x}^{2}$ is the local estimate of the variance. The window for these estimates is an optional input parameter (default is $3\times3$ ). The parameter $\sigma^{2}$ is a threshold noise parameter. If $\sigma$ is not given then it is estimated as the average of the local variances.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-14T21:48:10.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12666" PostTypeId="1" CreationDate="2013-11-15T04:10:05.980" Score="2" ViewCount="304" Body="&lt;p&gt;I am working and researching on Image watermarking/steganography and I'm stuck at a point and want to know which technique is better in image processing for data hiding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bit Plane Complexity Segmentation OR CDMA Spread spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can some experts give their opinion on both techniques and which one is better and why? like advantages and disadvantages or comparison of both&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I just want to hide some text in a color or grayscale image using wavelet trasform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use either bpcs or cdma spread spectrum technique. I want to know which one should go for and why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for learning purpose and no particular application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. Please let me know if u need any specific info.&lt;/p&gt;&#xA;" OwnerUserId="6957" LastEditorUserId="21075" LastEditDate="2020-05-10T17:04:14.640" LastActivityDate="2022-05-30T23:05:05.527" Title="Image watermarking in wavelet domain (data hiding in images)" Tags="|image-processing|wavelet|image-segmentation|steganography|" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12667" PostTypeId="2" ParentId="12591" CreationDate="2013-11-15T08:08:00.517" Score="-1" Body="&lt;p&gt;Actually this is very general. It can also depends on the clarity of the text.&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2013-11-15T08:08:00.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12668" PostTypeId="1" CreationDate="2013-11-15T09:58:23.463" Score="3" ViewCount="289" Body="&lt;p&gt;I am new to the field of image compression. While going through various texts, I read about how transforming the image to another domain using, for example, the wavelet transform, or the DCT, makes it suitable for lossy compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying to play around with wavelet transforms on a sample bmp in MATLAB. Using the MATLAB library function, I created transform coefficients using Daubechies wavelets. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a given pixel when read from bmp is in &lt;code&gt;uint8&lt;/code&gt; format, i.e., it uses up 1 byte of memory. This is because in most image formats the range of values a pixel can take is from 0 to 255. After wavelet transformation however, one gets double precision floating point for each element of the transformed matrix. This would typically consume about 4 bytes for each element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal was to try out some very basic compression using quantization and entropy coding of quantized elements. Quantizing the low magnitude values of the transformed elements to zero does give good compression. But trouble is I have to still use double precision floating point. The moment I convert all the wavelet coefficients to some integer format, the reconstructed image becomes very poor in quality as compared to the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In standard compression techniques, how are the transformed coefficients handled, given that they are not integer in format? Each transformed coefficient, due to its double precision nature, takes up more bytes than the original. Can you point out resources where this issue has been explained?&lt;/p&gt;&#xA;" OwnerUserId="6984" LastEditorUserId="21075" LastEditDate="2016-10-14T09:14:53.543" LastActivityDate="2016-10-14T09:14:53.543" Title="In image compression using transforms, how to deal with the transformed coefficients as they are not integers?" Tags="|wavelet|compression|image-compression|quantization|floating-point|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12670" PostTypeId="2" ParentId="10306" CreationDate="2013-11-15T11:12:01.127" Score="2" Body="&lt;p&gt;Here is an interactive version of the GIF, where you can test how partials add up to shape a certain wave: &lt;a href=&quot;http://toxicdump.org/stuff/FourierToy.swf&quot; rel=&quot;nofollow&quot;&gt;http://toxicdump.org/stuff/FourierToy.swf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5909" LastActivityDate="2013-11-15T11:12:01.127" CommentCount="0" CommunityOwnedDate="2013-11-15T19:14:56.183" ContentLicense="CC BY-SA 3.0" />
  <row Id="12671" PostTypeId="2" ParentId="12591" CreationDate="2013-11-15T12:24:09.577" Score="0" Body="&lt;p&gt;The letter boundaries are high frequencies and the letter interiors are low frequencies. So, thicker fonts mean more low frequencies and thinner fonts means more high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this applies only if the text color is constant and the text contrast is high (e.g., black test on white background). If the color varies for a letter, then the variation will determine the frequency response of the letter interior. And if the text has low contrast, the high frequency components of the boundary will not be as prominent as for black text on white background.&lt;/p&gt;&#xA;" OwnerUserId="6949" LastEditorUserId="6949" LastEditDate="2013-11-15T13:36:50.933" LastActivityDate="2013-11-15T13:36:50.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12672" PostTypeId="1" AcceptedAnswerId="12676" CreationDate="2013-11-15T13:35:14.240" Score="3" ViewCount="3875" Body="&lt;p&gt;Given the signal shown below, what is the best way to remove the steps and local maximas it contains. The signal contains some steps which can last up to 100 Samples before they return to about the same value as before the step (Marked with red circles). There are also some peaks which last only for one sample which should also be removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First Dataset: On this set, the median Filter works as expected (not shown here). &lt;img src=&quot;https://i.stack.imgur.com/32H4e.png&quot; alt=&quot;Sample Signal, all peaks should be removed, also the ones wich are marked red.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the following Dataset, the Medianfilter with the same settings fails. To many samples are replaced by the median value.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/REhYy.png&quot; alt=&quot;Sample Signal, green: Median filter from one of the Answers&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've tried already:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Work with a moving average. Advantage: Small peaks have less influence and are nicely removed. Disadvantage: Long lasting steps remain in the signal.&lt;/li&gt;&#xA;&lt;li&gt;Get the first difference of the signal (&lt;code&gt;diff(X)&lt;/code&gt;) and correct the value in X if a big positive change is followed by a negative change immediately. Advantages and disadvatages are the same as above.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What are some good methods to remove/correct these unwanted values?&lt;/p&gt;&#xA;" OwnerUserId="3481" LastEditorUserId="3481" LastEditDate="2013-11-18T11:38:41.307" LastActivityDate="2013-11-18T11:38:41.307" Title="Detecting &amp; Removing steps in signal" Tags="|matlab|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12673" PostTypeId="5" CreationDate="2013-11-15T13:48:42.550" Score="0" Body="&lt;p&gt;Super-resolution relates to sets of techniques  that allow to access to information beyond the actual data sampling chain, for instance of signals, images, videos. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such techniques can (somehow) bypass diffraction, sampling or quantization limits for example. Known usages include: Super-resolution imaging or microscopy.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="80" LastEditDate="2016-11-18T10:17:05.713" LastActivityDate="2016-11-18T10:17:05.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12674" PostTypeId="4" CreationDate="2013-11-15T13:48:42.550" Score="0" Body="Super-resolution refers to a class of techniques to enhance the resolution of a (digital) signal." OwnerUserId="6960" LastEditorUserId="15892" LastEditDate="2016-11-18T10:16:23.850" LastActivityDate="2016-11-18T10:16:23.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12675" PostTypeId="1" AcceptedAnswerId="12857" CreationDate="2013-11-15T13:57:59.243" Score="1" ViewCount="771" Body="&lt;p&gt;I am struggling to implement a mathematical morphology toolset in an image processing package. I base my implementation on what I saw in MATLAB, and on several papers on the subject. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seems to be abundant literature on morphological operation optimization through structuring element (strel) decomposition. For instance, one can get a tremendous speed bonus by using two orthogonal lines instead of a square as structuring element for dilation. Several papers give methods for optimization through strel decomposition:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Rolf Adams, &quot;Radial Decomposition of Discs and Spheres,&quot; CVGIP:&#xA;         Graphical Models and Image Processing, vol. 55, no. 5, September&#xA;         1993, pp. 325-332.&lt;/li&gt;&#xA;&lt;li&gt;Rein van den Boomgard and Richard van Balen, Methods for&#xA;       Fast Morphological Image Transforms Using Bitmapped Binary&#xA;       Images, CVGIP: Models and Image Processing, vol. 54, no. 3, May&#xA;       1992, pp. 252-254&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, all these publications are about &lt;strong&gt;2D&lt;/strong&gt; structuring elements. I could not find much on &lt;strong&gt;3D&lt;/strong&gt; decompositions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any clues on how to decompose:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a 3D sphere. Not a ball that is used in 2D grayscale morphology, but an actual flat 3D sphere;&lt;/li&gt;&#xA;&lt;li&gt;a 3D diamond?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="756" LastActivityDate="2017-07-24T09:10:19.813" Title="Decomposition of **3D** structuring elements for morphological operations" Tags="|3d|morphological-operations|decomposition|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12676" PostTypeId="2" ParentId="12672" CreationDate="2013-11-15T14:11:03.503" Score="9" Body="&lt;p&gt;The problem with the moving average is that the average is not robust to the presence of the outliers - so you would need a very large window size to &quot;dilute&quot; the outliers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try a non-linear filter instead, like a median filter: Apply a median filter on your signal - you would need a window size of at least 300 samples. Compute the difference between the original signal and the median-filtered version. If the difference is above a threshold, replace the signal by the median-filtered version.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here is some &lt;code&gt;scilab&lt;/code&gt; code that attempts to implement this suggestion.  The results are plotted here; it seems to work nicely on the fabricated data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kQyMD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function sm = smooth(x,len)&#xA;    sm = filter(ones(1,len)/len,1,x);&#xA;endfunction&#xA;&#xA;N = 6000;&#xA;x = 0.1*rand(1,N,'normal');&#xA;y = cumsum(x);&#xA;y = smooth(y,100);&#xA;&#xA;clf&#xA;subplot(211);&#xA;plot(y)&#xA;&#xA;&#xA;Njumps = 20;&#xA;&#xA;jump_indices = round(rand(1,Njumps)*N);&#xA;&#xA;jump_length = 0;&#xA;&#xA;y2 = y;&#xA;&#xA;for idx = jump_indices,&#xA;    y2(min(N,idx:(idx+jump_length))) = y(min(N,idx:(idx+jump_length))) + 1;&#xA;    //plot(min(N,idx:(idx+jump_length)),y2(min(N,idx:(idx+jump_length))),'r')&#xA;    jump_length = jump_length + 1;&#xA;end&#xA;&#xA;plot(y2,'g');&#xA;&#xA;filter_length = 10;&#xA;y3 = y;&#xA;for k = 1:N,&#xA;    y3(k) = median(y3(max(1,min(N,(k-filter_length/2):(k+filter_length/2)))));&#xA;end&#xA;&#xA;plot(y3,'k')&#xA;&#xA;subplot(212);&#xA;plot(y-y2);&#xA;plot(y-y3,'r');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="943" LastEditorUserId="80" LastEditDate="2013-11-15T17:38:27.160" LastActivityDate="2013-11-15T17:38:27.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12677" PostTypeId="2" ParentId="12672" CreationDate="2013-11-15T14:11:52.687" Score="3" Body="&lt;p&gt;Using the &lt;code&gt;diff&lt;/code&gt; approach, you could correct big positive changes and big negative changes separately, i.e. drop the condition that the second has to follow the first immediately. Compute the &lt;code&gt;diff&lt;/code&gt;, detect outliers using a threshold, replace them by zero or by the mean of the non-outlier differences, compute the cumulative sum of the differences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result won't be perfect though. If you need a better result, I'd recommend investigating where the steps and peaks come from, and either avoid them from the start or design a correction method tailored to their properties.&lt;/p&gt;&#xA;" OwnerUserId="5834" LastActivityDate="2013-11-15T14:11:52.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12678" PostTypeId="5" CreationDate="2013-11-15T14:29:39.860" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-15T14:29:39.860" LastActivityDate="2013-11-15T14:29:39.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12679" PostTypeId="4" CreationDate="2013-11-15T14:29:39.860" Score="0" Body="C# is a programming language from Microsoft for .NET/CLR" OwnerUserId="6960" LastEditorUserId="6960" LastEditDate="2013-11-15T15:06:51.520" LastActivityDate="2013-11-15T15:06:51.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12681" PostTypeId="1" CreationDate="2013-11-15T21:22:55.437" Score="2" ViewCount="3709" Body="&lt;p&gt;If i have two images of the same scene, reference image and a shifted image, the shift can be in x or y directions, i want to estimate the shift using the shift property of the fourier transform. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;S1 = fftshift(fft2(im1)); % Fourier transform of the reference image&#xA;S2 = fftshift(fft2(im2)); % Fourier transform of the image to be registered&#xA;Q = S1./S2;&#xA;A = angle(Q);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can i use the phase shift &lt;code&gt;A&lt;/code&gt;to estimate the shift in both directions? &lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="1380" LastEditDate="2013-11-16T11:49:17.453" LastActivityDate="2017-02-20T20:11:41.870" Title="Shift estimation using fourier transform" Tags="|matlab|fft|fourier-transform|phase|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12682" PostTypeId="1" CreationDate="2013-11-15T21:46:52.413" Score="1" ViewCount="2179" Body="&lt;p&gt;My question here is in regards to implicit information/terminology. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, whenever we say that &quot;a shift in time means a change of phase in fourier space&quot;, is it implicit that the shift is &lt;strong&gt;always&lt;/strong&gt; circular? Are there any exceptions to this? Caveats? etc?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2013-11-15T22:28:43.687" Title="Time shifts and change in phase" Tags="|frequency-spectrum|frequency|phase|time-frequency|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12683" PostTypeId="2" ParentId="12682" CreationDate="2013-11-15T22:28:43.687" Score="4" Body="&lt;p&gt;For a continuous-time signal $x(t)$ with Fourier Transform $X(f)$, the &#xA;Fourier transform of $x(t-t_0)$ is $e^{-j2\pi ft_0}X(f)$, that is, the value&#xA;of $X(3)$, say, gets changed to $e^{-j2\pi 3t_0}X(3)$ which has the same&#xA;&lt;em&gt;magnitude&lt;/em&gt; as $X(3)$ but a different phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a discrete-time continuous-amplitude signal $x[n]$ with DFT $X[k]$&#xA;of length $N$, you have essentially discarded every piece of information&#xA;conveyed to you by $x[-1], x[-2], \ldots $ and by $x[N], x[N+1], x[N+2], \ldots$&#xA;and have retained only $x[0], x[1], \ldots, x[N-1]$. If you phase-shift&#xA;the DFT appropriately, then yes, you will get a circular shift of the $x[n]$&#xA;values. The result &lt;em&gt;will&lt;/em&gt; be the &lt;em&gt;linear&lt;/em&gt; shift of the $x[n]$ values only&#xA;in the fortuitous circumstance that the sequence $x[n]$ is itself periodic&#xA;with period $N$, and so the untrained observer such as myself cannot tell&#xA;if that symbol that just shifted into my DFT wndow is $x[-1]$ coming from&#xA;the left (linear shift) or $x[N-1]$ from the right (circular shift)&#xA;because by golly they look exactly the same to me.  Savvier denizens&#xA;of this forum will give you more elaborate answers explaining how you&#xA;can tell the difference between the two cases.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-11-15T22:28:43.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12684" PostTypeId="1" AcceptedAnswerId="12686" CreationDate="2013-11-15T22:38:16.557" Score="22" ViewCount="45254" Body="&lt;p&gt;Could you please clearly explain what is the difference between correlation and convolution that is done by a filter on an image? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean in terms of signal processing definition I know that convolution describes the output of an LTI system, that is if an LTI system produces an output due to convolution with an input system then the output signal can be described as the result of convolution of the input signal and the impulse response of the LTI system. As for the correlation, it describes the similarities between to signals. But how does convolution and correlation effect on a image and how different are they in terms of effects?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="6990" LastEditorUserId="128" LastEditDate="2020-03-30T10:59:38.180" LastActivityDate="2020-03-30T10:59:38.180" Title="Difference Between Correlation and Convolution in the Context of Image Processing" Tags="|convolution|image-processing|correlation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12685" PostTypeId="1" AcceptedAnswerId="12687" CreationDate="2013-11-16T00:20:24.327" Score="1" ViewCount="99" Body="&lt;p&gt;I have a question regarding Discrete Fourier Transform and Discrete Time Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that we have a sequence $x(n)= \{1,2,3,3,2,1\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is it possible to reconstruct the Discrete Time Fourier Transform $X(e^{j\omega})$ from the Discrete Fourier Transform $X(k)$ ? And how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion , it is possible, although I am not sure if something like this would be any good. But in order to reconstruct it we probably need as much Discrete Fourier Transform samples as possible, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you people think on this matter? &lt;/p&gt;&#xA;" OwnerUserId="6980" LastEditorUserId="5014" LastEditDate="2013-11-16T05:07:54.103" LastActivityDate="2013-11-16T05:07:54.103" Title="Theoretical question on Fast Fourier" Tags="|fft|fourier-transform|signal-analysis|dft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12686" PostTypeId="2" ParentId="12684" CreationDate="2013-11-16T00:35:28.650" Score="46" Body="&lt;p&gt;Convolution is correlation with the filter rotated 180 degrees. This makes no difference, if the filter is symmetric, like a Gaussian, or a Laplacian.  But it makes a whole lot of difference, when the filter is not symmetric, like a derivative.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason we need convolution is that it is associative, while correlation, in general, is not. To see why this is true, remember that convolution is multiplication in the frequency domain, which is obviously associative. On the other hand, correlation in the frequency domain is multiplication by the complex conjugate, which is not associative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The associativity of convolution is what allows you to &quot;pre-convolve&quot; the filters, so that you only need to convolve the image with a single filter. For example, let's say you have an image $f$, which you need to convolve with $g$ and then with $h$.  $f * g * h = f * (g * h)$. That means you can convolve $g$ and $h$ first into a single filter, and then convolve $f$ with it. This is useful, if you need to convolve many images with $g$ and $h$. You can pre-compute $k = g * h$, and then reuse $k$ multple times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you are doing &lt;a href=&quot;http://en.wikipedia.org/wiki/Template_matching&quot;&gt;template matching&lt;/a&gt;, i. e. looking for a single template, correlation is sufficient. But if you need to use multiple filters in succession, and you need to perform this operation on multiple images, it makes sense to convolve the multiple filters into a single filter ahead of time.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2015-10-09T11:25:13.333" LastActivityDate="2015-10-09T11:25:13.333" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="12687" PostTypeId="2" ParentId="12685" CreationDate="2013-11-16T02:33:13.033" Score="2" Body="&lt;p&gt;This is (trivially) possible because all Fourier transform like operations are ideally invertible. So what you ask for is actually easily realized by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(e^{j\Omega}) = DTFT\{ IDFT\{X(k)\} \}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In formulae this is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(e^{j\Omega}) = \sum_{l=0}^{N-1} \sum_{k=0}^{N-1} X(k)e^{2 \pi j kl/N} e^{-j\Omega l}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be a bit simplified to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(e^{j\Omega}) = \sum_{k=0}^{N-1} X(k) \sum_{l=0}^{N-1} e^{jl (2 \pi k/N-\Omega)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or, finally&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(e^{j\Omega}) = \sum_{k=0}^{N-1} X(k) \frac{e^{2 \pi j k- jN\Omega}-1}{e^{2 \pi j k/N-\Omega}-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: The question on whether you need all samples X(k) lies in the behavior of the interpolation function $I(x) = \frac{e^{j N x}-1}{e^{j x}-1}$. This is because the above result is then equal to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(e^{j\Omega}) = \sum_{k=0}^{N-1} X(k) \, I(2 \pi k/N - \Omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I(x) has some &quot;sinc like&quot; behavior, so the question on how many X(k) you need, is really when I(x) has decayed to a value &quot;small enough&quot;.&lt;/p&gt;&#xA;" OwnerUserId="5145" LastEditorUserId="5145" LastEditDate="2013-11-16T02:46:02.567" LastActivityDate="2013-11-16T02:46:02.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12688" PostTypeId="2" ParentId="12649" CreationDate="2013-11-16T05:42:41.893" Score="1" Body="&lt;p&gt;Assuming by &quot;negative dispersion&quot; you mean that lower frequencies travel faster, don't try to invert the phase, this will be like trying to have a time-traveling dispersion filter.  Rather, design an allpass filter with phase delay that increases (rather than decreases) with frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're doing a 1st-order allpass, for example,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D1(z) = (-0.9 + z^-1)/(1 - 0.9z^-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will have a phase delay that decreaes with frequency.  And&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D2(z) = (0.9 + z^-1)/(1 + 0.9z^-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will have a phase delay that increases with frequency.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only real drawback is you can't as cheaply or easily get comparatively large phase delays at higher frequencies.&lt;/p&gt;&#xA;" OwnerUserId="5559" LastActivityDate="2013-11-16T05:42:41.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12690" PostTypeId="1" AcceptedAnswerId="12697" CreationDate="2013-11-16T10:54:35.233" Score="1" ViewCount="633" Body="&lt;p&gt;Question 3.1 d from Chapter 3 of Oppenheim's Signals &amp;amp; Systems&#xA;I have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=(-1)^n{u[-n]-u[-n-8]}$$&#xA;$$h[n]=u[n]-u[n-8]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the question asks for $y[n]$ which is the convolution of $x[n]$ and $h[n]$ namely &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]\star h[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stuck with the limits on the sum &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{k=-\infty}^{\infty}{\left((-1)^{k}(u[-k]-u[-k-8])\right)\left(u[n-k]-u[(n-8)-k]\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should the limit be '$0$' or '$n-k$' or '$n-8$'?&lt;/p&gt;&#xA;" OwnerUserId="5590" LastEditorUserId="5590" LastEditDate="2013-11-18T02:07:55.977" LastActivityDate="2013-11-18T02:07:55.977" Title="Convolving time reversed discrete input with time reversed discrete impulse response" Tags="|discrete-signals|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12691" PostTypeId="1" CreationDate="2013-11-16T13:30:30.157" Score="1" ViewCount="203" Body="&lt;p&gt;As I understand, the overall colour average can be obtained by summing the individual r, g, b values of all pixels within and image and dividing by the number of pixels to produce a new tri-vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the applications of such techniques?&lt;/p&gt;&#xA;" OwnerUserId="6993" LastActivityDate="2015-02-25T23:02:14.347" Title="What are some uses of the overall colour average of an image?" Tags="|image-processing|color|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12692" PostTypeId="1" CreationDate="2013-11-16T14:05:50.163" Score="0" ViewCount="1669" Body="&lt;p&gt;I have to compute an HSV histogram of a colored image.  Is it same as an H-S histogram? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found H-S histogram computation code everywhere. What is the method to change an H-S histogram to an HSV?&lt;/p&gt;&#xA;" OwnerUserId="6994" LastEditorUserId="76" LastEditDate="2013-11-17T03:10:53.273" LastActivityDate="2019-08-23T17:09:02.290" Title="Calculating an HSV histogram" Tags="|opencv|histogram|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12693" PostTypeId="1" CreationDate="2013-11-16T14:37:53.930" Score="8" ViewCount="1103" Body="&lt;p&gt;I have a blurred and noisy image $X$, I want to apply the Wiener filter on it and get a deblurred and denoised image $Y$ (i.e apply inverse of blurring filter while at the same time reducing some noise, if not accentuating it). I'd like to measure the SNR in both in order to evaluate the quantity of noise deleted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the formula to calculate the SNR is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$SNR = \frac{P_{signal}}{P_{noise}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, how do I estimate the SNR in the real world, given just the noisy image $X$?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="1629" LastEditDate="2016-05-25T13:36:51.157" LastActivityDate="2020-08-04T05:03:45.347" Title="Calculating the SNR of a blurred image" Tags="|filters|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12694" PostTypeId="1" CreationDate="2013-11-16T21:39:49.003" Score="14" ViewCount="5381" Body="&lt;p&gt;STFT can be successfully used on sound data (with a .wav soundfile for example) in order to do some frequency-domain modifications (example : noise removal).&lt;br&gt;&#xA;With &lt;code&gt;N=441000&lt;/code&gt; (i.e. 10 seconds at sampling rate &lt;code&gt;fs=44100&lt;/code&gt;), &lt;code&gt;windowsize=4096&lt;/code&gt;, &lt;code&gt;overlap=4&lt;/code&gt;, STFT produces approximatively a &lt;code&gt;430x4096&lt;/code&gt; array (first coordinate : time frame, second coordinate : frequency bin). Modifications can be done on this array, and reconstruction can be done with &lt;em&gt;overlap-add&lt;/em&gt; (*).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How is it possible to do a similar thing with wavelets&lt;/strong&gt; ? (DWT), i.e. get a similar  array  of shape &lt;code&gt;a x b&lt;/code&gt;, with &lt;code&gt;a&lt;/code&gt; time frames, and &lt;code&gt;b&lt;/code&gt; frequency bins,  do some modification on this array, and at the end, recover a signal ? How ? What is the wavelet equivalent to &lt;em&gt;overlap-add&lt;/em&gt; ?&#xA;What would be the Python functions involved here (I haven't found an easy example of audio modification with &lt;code&gt;pyWavelets&lt;/code&gt;...) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(*) : Here is the STFT framework that can be used :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal = stft.Stft(x, 4096, 4)    # x is the input&#xA;modified_signal = np.zeros(signal.shape, dtype=np.complex)&#xA;&#xA;for i in xrange(signal.shape[0]):    # Process each STFT frame&#xA;    modified_signal[i, :] =  signal[i, :] * .....  # here do something in order to&#xA;                                                   # modify the signal in frequency domain !&#xA;y = stft.OverlapAdd(modified_signal, 4)   # y is the output&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The goal is to find a similar framework with wavelets.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-11-18T22:30:39.027" LastActivityDate="2015-10-06T17:53:23.547" Title="STFT and DWT (Wavelets)" Tags="|fft|wavelet|dft|python|stft|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12695" PostTypeId="2" ParentId="12668" CreationDate="2013-11-16T22:20:42.227" Score="2" Body="&lt;p&gt;Oftentimes some rounding occurs in storing the coefficients. This is why many image compression algorithms are lossy, i.e. they lose information when converting the floating point coefficients to integer format. The process of rounding is called quantization. See this wikipedia article for an example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/JPEG#Quantization&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/JPEG#Quantization&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-11-16T22:20:42.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12696" PostTypeId="2" ParentId="12659" CreationDate="2013-11-17T00:47:42.823" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;compute RMS from audio signal to get power&lt;/li&gt;&#xA;&lt;li&gt;do AGC (automatic gain control)&lt;/li&gt;&#xA;&lt;li&gt;perform &quot;discrete differentiation&quot; (the simplest is 1st order: $y[i] = x[i] - x[i-1]$)&lt;/li&gt;&#xA;&lt;li&gt;if the value is greater than certain threshold, it means we have an onset. You have to determinate the threshold experimentally or use adaptive algorithm. Obviously you also need some kind of lowpass filter to filter the noise.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You may want to swap steps 2 and 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can use software libraries, check out &lt;a href=&quot;http://aubio.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;aubio&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible duplicate of &lt;a href=&quot;https://stackoverflow.com/questions/294468/note-onset-detection&quot;&gt;https://stackoverflow.com/questions/294468/note-onset-detection&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5879" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-05-16T22:24:19.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12697" PostTypeId="2" ParentId="12690" CreationDate="2013-11-17T03:01:24.797" Score="1" Body="&lt;p&gt;Here is another example of how incredibly poor choice of notation misleads students everywhere. I do not possess a copy of any of the various tomes on signal processing that seem to be revered as the fifth Gospel on this site, and so&#xA;I do not know if the book cited by the OP actually has written $(1)$,&#xA;but I assert that it is against mathematical common sense to write things like&#xA;$$y[n] = x[n] \star h[n].\tag{1}$$&#xA;It is generally accepted mathematical convention that is a symbol&#xA;has the same meaning everywhere it appears in an equation or expression. &#xA;For example, when we write&#xA;$$y(t) = x(t)h(t),~ -\infty &amp;lt; t &amp;lt; \infty, \tag{2}$$&#xA;we mean by this that for &lt;em&gt;every&lt;/em&gt; choice of real number $t$, the value&#xA;of $y(t)$ is the same as the product of the values of $x(t)$ and $h(t)$;&#xA;for example, $y(3) = x(3)h(3)$, and $y(313.012) = x(313.012)h(313.012)$,&#xA;ans so on and so forth.&#xA;So how are we supposed to make sense of this monstrosity $(1)$?&#xA;Clearly $y[3]$ is &lt;em&gt;not&lt;/em&gt; $x[3]\star h[3]$ whatever meaning we might&#xA;ascribe to the latter quantity; the value of $y[3]$ depends on&#xA;a &lt;em&gt;lot&lt;/em&gt; of other values of $x$ and $h$.  The poor notation misleads&#xA;students into writing things like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{k=-\infty}^{\infty}{\left((-1)^{k}(u[-k]-u[-k-8])\right)\left(u[-n-k]-u[(-n-8)-k]\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is not the correct expression for the convolution (or the correlation,&#xA;for that matter) of &#xA;$$x[n]=(-1)^n{u[-n]-u[-n-8]}\quad \text{and} \quad&#xA;h[n]=u[n]-u[n-8]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct way to do this is write&#xA;$$y[n] = (x\star h)[n] = \sum_{k=-\infty}^\infty x[k]h[n-k]$$&#xA;and &lt;em&gt;then&lt;/em&gt; substitute $n-k$ for $n$ in $h[n]=u[n]-u[n-8]$ &#xA;to&#xA;get $h[n-k] = u[n-k]- u[n-k-8]$ and not $u[-n-k]-u[(-n-8)-k]$&#xA;the way that the OP has it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some initial thought might have&#xA;shown that (assuming that $u[n]$ is the unit step),&#xA;that $h[n]$ is $0$ for $n &amp;lt; 0$ (since then both $u[n]$ and $u[n-8]$&#xA;are $0$, and that $h[n] = 0$ for $n \geq 8$ (since then&#xA;both $u[n]$ and $u[n-8]$ are $1$. Consequently for any given &#xA;fixed integer $n$, $h[n-k]$ is nonzero only for&#xA;$$0 \leq n-k \leq 7 \Rightarrow n-7 \leq k \leq n$$&#xA;and so the limits on the sum could be reduced from&#xA;$-\infty$ and $\infty$ to $n-7$ and $n$ (cf. my comment&#xA;on the OP's question).  I will leave it to the OP to figure&#xA;out whether the fact that $x[n]$ is &lt;em&gt;also&lt;/em&gt; time-limited&#xA;can be used to further reduce the limits on the sum.&#xA;Hint: the answer to this might depend on the specific&#xA;value of $n$, and you may need to try several different&#xA;values of $n$, e.g. $0, 3, 8, 10, -40$ etc to see if you&#xA;can discern a pattern.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-11-17T03:01:24.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12698" PostTypeId="1" AcceptedAnswerId="12702" CreationDate="2013-11-17T07:36:48.260" Score="-1" ViewCount="3899" Body="&lt;p&gt;I'm studying for a test and I can't really explain this question very well.&lt;/p&gt;&#xA;&lt;p&gt;What will happen If we convolve a discrete signal signal with itself?&#xA;(Output signal )&#xA;I'll appreciate it if someone can explain this concept to me. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5815" LastEditorUserId="-1" LastEditDate="2020-11-12T19:00:03.833" LastActivityDate="2020-11-12T19:00:03.833" Title="Convolution of a signal by itself" Tags="|signal-analysis|linear-systems|" AnswerCount="1" CommentCount="1" ClosedDate="2015-02-17T20:50:53.657" ContentLicense="CC BY-SA 4.0" />
  <row Id="12699" PostTypeId="1" AcceptedAnswerId="12703" CreationDate="2013-11-17T08:33:48.773" Score="1" ViewCount="79" Body="&lt;p&gt;We used to classify signals as 1D and 2D etc ie one dimensional and two dimensional. For example a periodic square wave signal is 1D and an image is a 2D signal etc (reference - Signals and systems by Simon Haykin and Barry Van Veen, 2nd edition , page 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the same periodic square wave signal can be decomposed using fourier series to infinite sinusoids with different frequencies. In the linear algebra terms these infinite orthogonal sinusoids forms the basis and the the dimension of a periodic square wave is infinite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So actually which is the actual dimension or what is dimension?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2013-11-19T04:00:37.487" Title="Ambiguity in the term 'dimension'?" Tags="|fourier-series|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12700" PostTypeId="1" CreationDate="2013-11-17T10:35:45.203" Score="1" ViewCount="215" Body="&lt;p&gt;I'm trying to add up a few black &amp;amp; white images of the same object in order to amplify the SNR. I'm working on relatively low SNR images (about 1.1) and I wish to amplify it somehow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first try was to add up the images grey-levels while removing the noise through a simple threshold but this isn't really working since this threshold isn't quite well defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any known algorithms for this kind of task? If so is there any pseudocode or even open source code somewhere?&lt;/p&gt;&#xA;" OwnerUserId="6998" LastEditorUserId="76" LastEditDate="2013-11-17T23:04:50.370" LastActivityDate="2013-11-22T12:03:04.520" Title="Signal amplification when summing low SNR images" Tags="|image-processing|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12701" PostTypeId="1" AcceptedAnswerId="14281" CreationDate="2013-11-17T11:27:52.657" Score="1" ViewCount="737" Body="&lt;p&gt;I recently was studying gabor filters and came to know that they have a shortcoming that they do have a minimum but some reasonable dc component.&lt;br/&gt;&#xA;now my question is why is it necessary to remove the dc component (using log gabor).&#xA;&lt;br/&gt;&#xA;If there are any other limitation of gabor filters then please do tell me.&lt;br/&gt;&#xA;thanks..&lt;/p&gt;&#xA;" OwnerUserId="5265" LastEditorUserId="128" LastEditDate="2019-06-24T18:00:06.163" LastActivityDate="2019-06-24T18:00:06.163" Title="Removal the DC Component of Gabor Filters" Tags="|image-processing|gabor|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12702" PostTypeId="2" ParentId="12698" CreationDate="2013-11-17T14:17:05.003" Score="6" Body="&lt;p&gt;A &lt;strong&gt;signal&lt;/strong&gt; does not have the properties &lt;em&gt;time-invariant, linear, stable, casual&lt;/em&gt;&#xA;that you wish to ascribe to it; these are properties of &lt;em&gt;systems.&lt;/em&gt;  Properties&#xA;of signals that might be of interest include &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;bounded amplitude versus unbounded amplitude&lt;/li&gt;&#xA;&lt;li&gt;discrete amplitude versus continuous amplitude&lt;/li&gt;&#xA;&lt;li&gt;discrete-time versus continuous-time&lt;/li&gt;&#xA;&lt;li&gt;periodic versus nonperiodic&lt;/li&gt;&#xA;&lt;li&gt;finite energy or finite power or neither&lt;/li&gt;&#xA;&lt;li&gt;single frequency versus multi-frequency&lt;/li&gt;&#xA;&lt;li&gt;finite bandwidth versus infinite bandwidth&lt;/li&gt;&#xA;&lt;li&gt;baseband versus passband&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and possibly others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, your question is pretty much unanswerable.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-11-17T14:17:05.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12703" PostTypeId="2" ParentId="12699" CreationDate="2013-11-17T16:21:31.770" Score="3" Body="&lt;p&gt;Dimension in mathematics is defined as the number of independent components of a structure (with some generalizations, like fractal dimensions). Now which number of dimensions you assign to e.g a discrete image (as in picture) depends on what aspect of the image you are describing. As a vector space where each pixel is a component, you get as many dimensions as pixels. The same for a discrete signal, the number of samples is your dimension of the vector space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, sometimes you're rather interested in the manifold the object is a function on. The real line is a 1-dimensional real manifold, and a real function on it would be a signal. So you can call the signal &quot;one dimensional&quot;, explicitly referring to this property. Sometimes your function may map to the complex numbers or to R^2 (still from the real line!) instead, and you might want to call that a &quot;two dimensional signal&quot;, and that's also correct. However, a two dimensional signal may also just be a function on a two dimensional manifold, like a plane. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there's a lot ambiguity in verbal descriptions, which is why to be clear you should use exact mathematical notation. Opposite to common belief it was not just invented to torture students.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-11-17T16:21:31.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12704" PostTypeId="2" ParentId="12699" CreationDate="2013-11-17T16:26:21.380" Score="0" Body="&lt;p&gt;When you say dimension you're referring to the  axis of the signal space, e.g., a 2D signal with time and amplitude axis. When you want to refer to transforms such as Fourier or Laplace you should say domain instead since what you're doing is a transform of the signal from one domain to another. For example, when applying the Fourier transform you go from the time domain to the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Time_domain&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Time_domain&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_domain&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Frequency_domain&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3865" LastActivityDate="2013-11-17T16:26:21.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12705" PostTypeId="1" AcceptedAnswerId="12824" CreationDate="2013-11-17T18:10:05.847" Score="0" ViewCount="263" Body="&lt;p&gt;I have read in many papers that time complexity of WPT is &lt;span class=&quot;math-container&quot;&gt;$O(N \log(N))$&lt;/span&gt;, but I would like to know what is the effect of Levels in the time complexity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Must it be one of the following ?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$O(2^{L} ~N~ \log(N))$&lt;/span&gt;  &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$O(2^{L+1} ~N~ \log(N))$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$O(L ~N ~\log(N))$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ L$&lt;/span&gt; is the number of decomposition levels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone helps which is true?&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="13309" LastEditDate="2019-07-27T22:49:25.483" LastActivityDate="2019-07-27T22:49:25.483" Title="What is Wavelet packet transform (WPT) time complexity" Tags="|discrete-signals|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12706" PostTypeId="1" CreationDate="2013-11-17T19:44:32.413" Score="2" ViewCount="432" Body="&lt;p&gt;I have an array $A$ having the next 145 values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to calculate the $\frac{dA}{dX}$, having a 1D grid, $x$: 1:286:41468 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the function gradient:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DA_DX = gradient(A, 41468/145)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand why the $\frac{dA}{dX}$ output graph has peaks which cause problems to my code. Please, do you see something wrong in my steps? Is any other way to calculate the $\frac{dA}{dX}$ without gradient function?&lt;/p&gt;&#xA;" OwnerUserId="7002" LastEditorUserId="7002" LastEditDate="2013-11-18T00:40:07.437" LastActivityDate="2013-11-18T00:40:07.437" Title="MATLAB gradient derivative troubleshooting" Tags="|matlab|noise|smoothing|gradient|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12707" PostTypeId="2" ParentId="12706" CreationDate="2013-11-17T19:57:32.333" Score="1" Body="&lt;p&gt;You can calculate the derivative using the diff function and then dividing by the time interval between the &quot;samples&quot; in your vector like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dA = diff(A) / 286&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The diff() function calculates the difference between an element and the previous one in the vector. With this you'll be calculating the derivative for each element in the vector as the increment in A divided by the increment in x. Check out the help for the diff() for more info.&lt;/p&gt;&#xA;" OwnerUserId="3865" LastActivityDate="2013-11-17T19:57:32.333" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12708" PostTypeId="1" AcceptedAnswerId="12711" CreationDate="2013-11-17T20:13:13.450" Score="0" ViewCount="1205" Body="&lt;p&gt;Let's say that a stochastic process is defined as &#xA;$$X(t) = \sum_{n = -\infty}^{+\infty} X_n * f(t- nT)$$ &#xA;where $X_n$ is the $n$-th symbol among independent random symbols. I have proved that $\mathbb E[X(t)] = 0$.  But, I want to prove that this stochastic process is Wide Sense Stationary(WSS) which means by definition that its autocorrelation function $R_{xx}(t+k,t) = \mathbb E[X(t+k)*X(t)] = R_x(k)$ i.e. the auto-correlation function of $X(t)$ depends only on $k$, which is the time difference between $t+k$ and $k$. What I have proved is that the auto-correlation function of $X(t)$ is zero but I am not sure that this proves that this stochastic process is WSS. I have attached a picture of the problem and what I have done so far in order to be clearer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FXNdF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7001" LastEditorUserId="80" LastEditDate="2013-11-17T23:10:37.103" LastActivityDate="2013-11-18T13:43:58.867" Title="Autocorrelation of a stochastic process which is a sum" Tags="|continuous-signals|autocorrelation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12709" PostTypeId="2" ParentId="12681" CreationDate="2013-11-17T22:38:02.110" Score="1" Body="&lt;p&gt;Assume the image is 256x256, The shift in spatial domain corresponds to a linear phase in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u=-128:127;&#xA;v=-128:127;&#xA;u=repmat(u,size(u,2),1);&#xA;v=repmat(v',1,size(v,2));&#xA;&#xA;linear_phase= exp(-2*pi*1i.*(((v).*dy)+((u).*dx)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;dx&lt;/code&gt; shift in $x$ and &lt;code&gt;dy&lt;/code&gt; shift in $y$, and &lt;code&gt;A&lt;/code&gt; equals &lt;code&gt;linear_phase&lt;/code&gt;so i can get a lot of equations to solve for &lt;code&gt;dx&lt;/code&gt; and &lt;code&gt;dy&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;dx&lt;/code&gt; or &lt;code&gt;dy&lt;/code&gt; is $0.5/128$ the shift is one pixel in $x$ or $y$&lt;/p&gt;&#xA;" OwnerUserId="1380" LastActivityDate="2013-11-17T22:38:02.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12710" PostTypeId="1" CreationDate="2013-11-17T23:00:50.403" Score="2" ViewCount="1988" Body="&lt;p&gt;I'm reading a biology article (full text &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2695983/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) that analyzed the variation of a cell parameter over time at different stimulus intensities (calcium concentration). The frequency of peaks increases at increasing calcium concentrations, while their duration remains constant, fitting a gamma distribution. Here are the bursts duration distributions for two different calcium concentrations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CKN4k.png&quot; alt=&quot;gamma&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By eye those bursts were classified in isolated bursts (with duration $\tau_{burst}$) and clustered bursts (with duration $\tau_{cluster}$). Here are typical traces of two different cells:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n7iiv.png&quot; alt=&quot;bursts&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors computed the autocorrelation from the traces and then estimated $\tau_{burst}$ and $\tau_{cluster}$. Moreover, they estimated the relative weight of the two types of burst at varying calcium concentrations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their method was as follow: (1) they calculated the mean autocorrelation function (for every calcium concentration); (2) they described the curve with an exponential decay function; (3) they estimated the weight of the two types of bursts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, below are shown two mean autocorrelation functions: one of the tracks obtained at 50mM calcium concentration (blue), the other at 200mM (red).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fwvI2.png&quot; alt=&quot;autocorrelation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is well fitted by a single decaying exponential with time constant $\tau=70s$; the second is fitted by the sum of two exponentials: $c(t)=a_1e^{-t/\tau_1}+a_2e^{-t/\tau_2}$ with $\tau_1=70s$ and $\tau_2=720s$. They concluded that $\tau=\tau_1=\tau_{burst}$ and $\tau_2=\tau_{cluster}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the supplemental document (&lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2695983/bin/NIHMS70624-supplement-Supplementary.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) they say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The autocorrelation function was computed from the thresholded traces and provided an unbiased estimate of the size of the isolated bursts and clusters, which correspond to the two time scale of the exponential decay in the fit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My question is: &lt;strong&gt;how are the time scales of the exponential decay of the autocorrelations related to the duration of bursts and their relative frequencies?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="7003" LastEditorUserId="7003" LastEditDate="2013-11-20T14:34:00.667" LastActivityDate="2013-11-20T14:34:00.667" Title="How are the time scales of an exponential decaying autocorrelation related to the duration of peaks?" Tags="|frequency|autocorrelation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12711" PostTypeId="2" ParentId="12708" CreationDate="2013-11-17T23:12:08.363" Score="2" Body="&lt;p&gt;Your proof is incorrect.  the step indicated below is not true, i.e.:&#xA;$$&#xA;E[X_n X_m] \not = E[X_n] E[X_m]&#xA;$$&#xA;in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JV6d0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-11-18T13:43:58.867" LastActivityDate="2013-11-18T13:43:58.867" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12712" PostTypeId="1" CreationDate="2013-11-17T23:14:23.027" Score="1" ViewCount="202" Body="&lt;p&gt;I want to build a detector of sorts. Say I have a bunch of signals and they all share some patterns, like some peaks in frequency or something more complicated that I can't bother to calculate by hand. I do however have plenty of these signals, so maybe I could &quot;model&quot; statistically, and more importantly, numerically through Matlab, their behavior. I'm familiar with the concepts of auto correlation and spectral density, but I'm not sure how to infer them from of the samples. I know Matlab has a function called &lt;code&gt;autocorr&lt;/code&gt; that calculates the autocorrelation of the sample, but I'm not sure I understand how it works. In any case, I don't know how to get the &lt;em&gt;best&lt;/em&gt; autocorrelation model out of all the autocorrelations calculated for each sample. Taking an average seems a bit too easy and I'm not sure how it would work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="5731" LastActivityDate="2013-11-17T23:14:23.027" Title="Random signal modeling with Matlab" Tags="|matlab|autocorrelation|statistics|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12713" PostTypeId="1" CreationDate="2013-11-18T01:52:18.343" Score="0" ViewCount="147" Body="&lt;p&gt;When we are do a discrete Gabor transform on a 1D signal, we apply a Gaussian window on a segment of the signal. However, due to the tapering ends of the Gaussian window, the magnitude of the data points will be reduced more towards the ends, This implies that the the frequency components of the segment of the signal will be suppressed when we apply FFT to it. After performing some experiments, I found that at least 2 periods of the signals is required, so that no misjudgement of the behaviour of the signal will happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the range of frequencies in which the magnitude of the FFT is still representative of the frequencies of windowed signal?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="5014" LastEditDate="2013-12-05T14:17:10.217" LastActivityDate="2013-12-05T14:17:10.217" Title="frequency components of discrete Gaussian-windowed signal" Tags="|frequency-spectrum|window-functions|gaussian|gabor|stft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12714" PostTypeId="1" CreationDate="2013-11-18T06:43:10.917" Score="3" ViewCount="4761" Body="&lt;p&gt;What does the term &lt;code&gt;spatial correlation&lt;/code&gt; and &lt;code&gt;spatial convolution&lt;/code&gt; mean with respect to &lt;em&gt;digital image processing&lt;/em&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="7006" LastActivityDate="2013-11-18T18:11:27.767" Title="What is spatial correlation and spatial convolution?" Tags="|image-processing|convolution|correlation|digital|spatial|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12715" PostTypeId="1" AcceptedAnswerId="12716" CreationDate="2013-11-18T07:09:19.123" Score="0" ViewCount="589" Body="&lt;p&gt;In my final year project, we are using a SIFT feature descriptor to classify and recognize objects, but I have never come across segmentation in the process of image classification/categorization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isn't this step necessary?&lt;/p&gt;&#xA;" OwnerUserId="6941" LastEditorUserId="76" LastEditDate="2014-01-02T16:44:35.373" LastActivityDate="2014-01-02T18:18:10.963" Title="Segmentation step when using feature descriptors" Tags="|computer-vision|image-segmentation|sift|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12716" PostTypeId="2" ParentId="12715" CreationDate="2013-11-18T09:35:34.957" Score="1" Body="&lt;p&gt;SIFT works on points in an image while segmentation is about dividing up the image into regions. So, no, segmentation is not necessary when using SIFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In segmentation you divide up the image into regions so classification can be done by extracting features from each region and see if you can recognize your object. A downside to this approach is that producing a good segmentation is a difficult problem. Many segmentation techniques are sensitive to various circumstances, such as lighting, contrast, colors etc. These difficult situations often result in regions that do not represent your objects very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In SIFT you focus on specific points (&lt;em&gt;keypoints&lt;/em&gt;) in the image instead of entire regions. If you want to recognize an object in an image using SIFT, you extract keypoints from an image of your object and give each keypoint a description (&lt;em&gt;keypoint descriptor&lt;/em&gt;) based on its local neighborhood. Then you check if similar keypoints exist in the image you want to analyze. By matching the keypoints between your object image and the image you want to analyze you can do object recognition without segmentation.&lt;/p&gt;&#xA;" OwnerUserId="6949" LastEditorUserId="6949" LastEditDate="2013-11-18T09:51:25.423" LastActivityDate="2013-11-18T09:51:25.423" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12717" PostTypeId="2" ParentId="12691" CreationDate="2013-11-18T09:43:52.347" Score="1" Body="&lt;p&gt;Well, I can't honestly say that I ever used it, there was a moment when I was considering doing something similar for some quick-and-dirty &quot;shadow&quot; correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My friends showed me a flight video, where in the middle of the video there was some dark patches in every frame due to their propeller. To me it looked like a patch in very dark shadow (I never actually got to play with the video so I can't be certain - if the patches actually were the way I suppose or if this would work).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I didn't want to do any serious correction technique but just spend a bit of time on it for myself, here's what I would do:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;calculate the color average of the image $avg_{img}$&lt;/li&gt;&#xA;&lt;li&gt;find the darker connected areas (the &quot;shadowed&quot; part in each frame) and calculate their average $avg_{dark}$&lt;/li&gt;&#xA;&lt;li&gt;for all the pixels in the darker area, take their difference from $avg_{dark}$  and add it to $avg_{img}$ and replace their value with this new one&lt;/li&gt;&#xA;&lt;li&gt;hopefully, result would be a video that's still flawed but somewhat easier to watch than the one with dark propeller-patches flying around in the middle&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2013-11-18T09:43:52.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12718" PostTypeId="1" CreationDate="2013-11-18T10:08:07.983" Score="3" ViewCount="1354" Body="&lt;p&gt;I am working different types of filters to remove speckle noise in ultrasound image. I have taken the below paper as my base paper and trying to reproduce the results of this paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.researchgate.net/publication/222566794_Finding_out_general_tendencies_in_speckle_noise_reduction_in_ultrasound_images&quot; rel=&quot;nofollow noreferrer&quot;&gt;My Base Paper&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I designed all the filters and tested with the default matlab images. I was happy with the results. The Mean Square Error (MSE) of filtered image is less than that of Noisy image and the Signal to Noise Ratio (SNR) and Peak Signal to Noise Ratio (PSNR) of the filtered image is greater than that of Noisy image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But Sadly, When I tried it for ultrasound images the results are opposite. That is the MSE of filtered image is greater than that of Noisy Image and the SNR &amp;amp; PSNR of the filtered image is lesser than that of Noisy Image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried for many other ultrasound images but unable to get it right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Results for Lena.jpg&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fCxnO.jpg&quot; alt=&quot;Lena&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******Quality Measurements***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******Noisy Image***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mean Square Error = &lt;strong&gt;0.0080186&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to Noise Ratio (SNR) = 69.4875&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal-to-Noise Ratio(PSNR) = 69.0898&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******3 x 3 Median filter***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mean Square Error = &lt;strong&gt;0.00257916&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to Noise Ratio (SNR) = 74.4137&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal-to-Noise Ratio(PSNR) = 74.016&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******5 x 5 Median filter***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mean Square Error = 0.00188434&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to Noise Ratio (SNR) = 75.7769&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal-to-Noise Ratio(PSNR) = 75.3792&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******7 x 7 Median filter***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mean Square Error = 0.00208378&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to Noise Ratio (SNR) = 75.34&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal-to-Noise Ratio(PSNR) = 74.9423&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Results for ultrasound.jpg&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NPuLX.jpg&quot; alt=&quot;Results for ultrasound image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******Quality Measurements***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******Noisy Image***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mean Square Error = &lt;strong&gt;0.00153502&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to Noise Ratio (SNR) = 64.8881&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal-to-Noise Ratio(PSNR) = 76.2697&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******3 x 3 Median filter***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mean Square Error = &lt;strong&gt;0.00770785&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to Noise Ratio (SNR) = 57.8799&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal-to-Noise Ratio(PSNR) = 69.2615&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******5 x 5 Median filter***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mean Square Error = 0.00810142&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to Noise Ratio (SNR) = 57.6637&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal-to-Noise Ratio(PSNR) = 69.0452&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*******7 x 7 Median filter***********&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mean Square Error = 0.00853159&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to Noise Ratio (SNR) = 57.439&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal-to-Noise Ratio(PSNR) = 68.8205&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am unsure why I am getting results like this. I  have added code that I have used for quality measures. Please correct me If I have done anything wrong.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function metrics = Metrics1(Orig_Image,Esti_Image)&#xA;&#xA;&#xA;    %---Mean-Square Error(MSE) Calculation&#xA;    Orig_Image = im2double(Orig_Image);%---Convert image to double class&#xA;    Esti_Image = im2double(Esti_Image);%---Convert image to double class&#xA;    [M N] = size(Orig_Image);%---Size of Original Image&#xA;    err = Orig_Image - Esti_Image;%---Difference between two images&#xA;    metrics.M_SE = (sum(sum(err .* err)))/(M * N);&#xA;&#xA;    %---Signal-to-Noise Ratio(SNR) Calculation&#xA;    metrics.SNR = 10*log10((1/M*N)*sum(sum(Orig_Image.*Orig_Image))/(metrics.M_SE));&#xA;&#xA;    %---Peak Signal-to-Noise Ratio(PSNR) Calculation &#xA;    if(metrics.M_SE &amp;gt; 0)&#xA;        metrics.PSNR = 10*log10(255*255/metrics.M_SE);&#xA;    else&#xA;        metrics.PSNR = 99;&#xA;    end&#xA;&#xA;     %---Mean and Standard Deviation&#xA;&#xA;    %---Beta Calculation&#xA;    h = fspecial('laplacian');&#xA;    I1 = imfilter(Orig_Image,h);&#xA;    I2 = imfilter(Esti_Image,h);&#xA;    I_1 = mean2(I1);&#xA;    I_2 = mean2(I2);&#xA;    metrics.Beta = sum(sum((I1 - I_1).*(I2 - I_2)))./(sqrt(sum(((I1 - I_1).^2).*((I2 - I_2).^2))));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2013-11-18T10:08:07.983" Title="Why PSNR decreases for Ultrasound Images?" Tags="|image-processing|matlab|noise|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12719" PostTypeId="1" CreationDate="2013-11-18T10:54:35.627" Score="2" ViewCount="3594" Body="&lt;p&gt;I am just trying to classify images using kNN algorithm with the aid of MATLAB. So now I am in need of some collection of images of peoples' faces. Where can I get some open database of faces (both females and males).&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2019-03-17T12:13:37.647" Title="Where can I get passport size face photo database for my image classification experiment?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12720" PostTypeId="2" ParentId="12719" CreationDate="2013-11-18T11:12:36.363" Score="0" Body="&lt;p&gt;Try this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html&quot; rel=&quot;nofollow&quot;&gt;Face Database1&lt;/a&gt; Download link available on 4th paragraph &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/Imagedbase.htm#face&quot; rel=&quot;nofollow&quot;&gt;Face Database2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps .. Download the compressed files and extract it.. If it is helpful, click the tick mark to accept the answer.&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="5800" LastEditDate="2013-11-18T11:37:18.277" LastActivityDate="2013-11-18T11:37:18.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12721" PostTypeId="1" CreationDate="2013-11-18T11:39:22.650" Score="5" ViewCount="241" Body="&lt;p&gt;I have a project in which I have to recognize 2 lines in different &quot;position&quot;, the lines are orthogonal but can be projected on different surfaces. I'm using opencv. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QCADD.jpg&quot; alt=&quot;ilnes on straight surface&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n6VCl.jpg&quot; alt=&quot;deformed lines&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I'm not asking for  code&lt;/strong&gt;, but only for hints about how can I solve this? I tried &lt;code&gt;houghlines&lt;/code&gt; function but it works only for straight surfaces. &#xA;thanks in advance ! &lt;/p&gt;&#xA;" OwnerUserId="1785" LastActivityDate="2014-01-09T11:03:41.360" Title="detecting &quot;deformed&quot; lines" Tags="|image-processing|image-segmentation|edge-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12722" PostTypeId="2" ParentId="12719" CreationDate="2013-11-18T12:21:03.040" Score="2" Body="&lt;p&gt;Here is an up-to-date index of face image databases commonly used by researchers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.face-rec.org/databases/&quot; rel=&quot;nofollow&quot;&gt;http://www.face-rec.org/databases/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It contains links to the common datasets such as The Yale Face Database (regular and &quot;B&quot;), The Color FERET Database, The AT&amp;amp;T Database of Faces, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should cover your needs.&lt;/p&gt;&#xA;" OwnerUserId="6949" LastEditorUserId="6949" LastEditDate="2013-11-18T12:28:08.693" LastActivityDate="2013-11-18T12:28:08.693" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12723" PostTypeId="1" CreationDate="2013-11-18T13:04:44.497" Score="0" ViewCount="65" Body="&lt;p&gt;A graylevel reference image is transformed displacing each pixel. The magnitude of the displacement follows a bidimensional gaussian distribution. When two pixels in the reference image fall in the same pixel in the transformed image, the resulting graylevel of the transformed image is the sum of graylevels of both pixels in the reference image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to calculate the most likely bidimensional gaussian distribution of the transformation? Do you know any research paper about it?&lt;/p&gt;&#xA;" OwnerUserId="7008" LastEditorUserId="7008" LastEditDate="2013-11-18T13:11:38.893" LastActivityDate="2013-11-18T13:11:38.893" Title="Most likely transformation of an image" Tags="|image-processing|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12724" PostTypeId="2" ParentId="12700" CreationDate="2013-11-18T13:08:31.590" Score="1" Body="&lt;p&gt;Are the images properly aligned? Then you can usually add them all up and (for normalization) divide each pixel value by the amount of images that were added together. For $N$ images this will give you an SNR gain of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$SNR_{+} = 10\cdot \log_{10}(N) \text{dB.}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is under the assumption that the &quot;signal&quot; part of the images is always the same and that the noise in each image has the same power and is perfectly independent from the noise in other images. Hence, it is probably an upper bound on what you are actually going to achieve.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-11-18T13:08:31.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12727" PostTypeId="2" ParentId="12668" CreationDate="2013-11-18T15:30:04.760" Score="1" Body="&lt;p&gt;It's often possible to come up with a scale factor such that the largest coefficient has the value &lt;code&gt;255&lt;/code&gt;. You'd need to store this scale factor once per set of coefficients. This saves 3 bytes per coefficient. Usually you can live without coefficients smaller than 1/255th of the largest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DC is of course an exception and should be treated separately. The DC components may have quite some spatial correlation and could possibly benefit from a higher level DCT. I.e. if you have 8x8 DCT transforms, each of 8x8 pixels (total 64x64 pixels) then you also have 8x8 DC components that you can feed to your DCT again.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2013-11-18T15:30:04.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12728" PostTypeId="2" ParentId="12713" CreationDate="2013-11-18T15:57:22.767" Score="1" Body="&lt;p&gt;No window will give you zero processing (coherent) gain. &lt;a href=&quot;http://web.mit.edu/xiphmont/Public/windows.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Check out the table in fred harris's paper.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The table says there is a processing gain of $0.37$ to $0.51$ depending on your $\alpha$ parameter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wsmjB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MrWLg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-18T15:57:22.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12729" PostTypeId="2" ParentId="12714" CreationDate="2013-11-18T18:11:27.767" Score="3" Body="&lt;p&gt;These terms exist mainly for historical reasons. In signal processing the signal is a one-dimensional function of time.  So people talk about the &lt;em&gt;time domain&lt;/em&gt; vs. the &lt;em&gt;frequency domain&lt;/em&gt;.  On the other hand, in image processing you are looking at a 2D function of $x$ and $y$, and there is no notion of time.  Instead your are talking about &lt;em&gt;spatial frequencies&lt;/em&gt;.  Hence, &lt;em&gt;spatial correlation&lt;/em&gt; and &lt;em&gt;spatial convolution&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, in image processing you simply talk about &lt;em&gt;convolution&lt;/em&gt; and &lt;em&gt;correlation&lt;/em&gt;.  The term &lt;em&gt;spatial&lt;/em&gt; usually shows up when 2-D convolution and correlation are introduced to people with background in signal processing.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2013-11-18T18:11:27.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12730" PostTypeId="2" ParentId="10769" CreationDate="2013-11-18T20:30:50.880" Score="2" Body="&lt;p&gt;That question was posted quite some time ago! Have you tried the discrete time Fourier transform of $R_{XX}[m]$, instead of the Fourier transform? I believe this is what was meant, there (the text talks about a &quot;sequence&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An &quot;easy&quot; way to solve this, according to me, is to compute the Z-transform, then identify $S_{XX}(\omega) = Z[R_{XX}](z=e^{j\omega})$. The Z-transform is given as:&#xA;\begin{align}&#xA;Z[R_{XX}](z) &amp;amp;= \sum_{m=-\infty}^{\infty} R_{XX}[m] z^{-m} \\&#xA;   &amp;amp;= \sum_m e^{-\alpha |m|} z^{-m} \\&#xA;   &amp;amp;= \frac{1 - e^{-2\alpha}}{(1-e^{-\alpha}z^{-1})(1 - e^{-\alpha}z)} &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that still helps!&lt;/p&gt;&#xA;" OwnerUserId="1301" LastActivityDate="2013-11-18T20:30:50.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12732" PostTypeId="2" ParentId="12693" CreationDate="2013-11-18T22:32:30.040" Score="1" Body="&lt;p&gt;Estimating the noise power is difficult because it involves separating the signal from the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good way to proceed is to take a measurement where you know the correct answer, and subtract. For example, you could photograph a grey rectangle, and look for pixels that are not the right level of grey.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only have the one image, you need to be a bit more imaginative. Maybe there is a patch of sky, or something, which you suspect to be very simple. Then you can form a mathematical model of the signal in that region, and fit its parameters to the image. For example, if you think the colour is constant in the region, you can estimate it by averaging over the region. Or if you think the region is a long way out of focus, you can estimate the signal using a low-pass filter. The goal is to obtain a low-entropy estimate of the true signal. Then you can subtract it off to obtain an estimate of the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the noise level and the signal level can both vary across an image. Cheap digital cameras have a noise level that depends on the brightness of the pixel, due to the way the detectors work, and also on the position of the pixel, due to in-camera compensation of optical artifacts. You might therefore want to estimate the noise using a variety of different patches of the image.&lt;/p&gt;&#xA;" OwnerUserId="7012" LastActivityDate="2013-11-18T22:32:30.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12733" PostTypeId="2" ParentId="12694" CreationDate="2013-11-18T23:16:26.990" Score="1" Body="&lt;p&gt;There are many ways of defining a wavelet basis. Typically a wavelet looks something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w_{x_0,k_0}(x) = A\exp(ik_0x)e(k_0(x-x_0))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In which $x_0$ is the centre in time, $k_0$ is the centre in frequency, and $e$ is a window function. $A$ absorbs the phase and normalisation. The main way in which this differs from your STFT is that the width of the window depends on $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually one uses discrete points $(x_0,k_0)$ to limit the number of wavelets. As in your STFT, it is often good to use a larger number of points than the dimensionality of the signal. The aim is to approximate the answer you'd get by using all possible $(x_0,k_0)$, but with reasonable computational resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the dimensionality of the transformed data exceeds that of the signal, the wavelet basis will not be orthonormal. I.e. the following will be false:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left\langle w_{k_0, x_0} | w_{k_0',x_0'} \right\rangle = \delta(x_0,x_0')\delta(k_0,k_0')$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for suitable $A$ and $w$, you can arrange for the basis to be overcomplete:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{x_0,k_0} \left| w_{x_0,k_0} \right\rangle \frac{1}{\sqrt{k_0}} \left\langle w_{x_0,k_0} \right| = \text{identity}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, you can reconstruct the signal perfectly just by adding up its constituent wavelets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your &quot;modification&quot; can simply be inserted in the above sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{my_filter} = \sum_{x_0,k_0} \left| w_{x_0,k_0} \right\rangle f(x_0,k_0) \left\langle w_{x_0,k_0} \right|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update 2013-11-19: Adding implementation details below as requested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some signal $f(x)$, we wish to compute coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_{x_0,k_0} = \left\langle w_{x_0,k_0} | f \right\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a fixed $k_0$, $c{x_0,k_0}$ may be viewed as a function of $x_0$, and this function is simply a filtered version of $f$. Specifically, it is a convolution of $f$ with $w_{0,k_0}$, which we can compute efficiently using a Fourier method. Thus, we may efficiently compute all the $c_{x_0,k_0}$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply a Fourier transform to $f$ to obtain $\hat f$. Probably you want to do this a window at a time, with enough overlap to be able to throw away the windowing artifacts, etc, but for simplicity let's suppose you do the whole signal at once, and that its length is a power of two.&lt;/li&gt;&#xA;&lt;li&gt;For each $k_0$ in some geometric progression with spacing about $1/4$ the filter bandwidth (or finer if you want):&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Form the product of $\hat f$ with $\hat w_{0,k_0}$.&lt;/li&gt;&#xA;&lt;li&gt;Truncate the spectrum to some interval $[k_l,k_r)$ whose length is a power of two, and that contains the non-zero portion of $\hat w_{0,k_0}$.&lt;/li&gt;&#xA;&lt;li&gt;Apply an inverse Fourier transform to that.&lt;/li&gt;&#xA;&lt;li&gt;Multiply that by $exp(ix\frac{k_l+k_r}{2})$ to correct the phase. The result is $c_{x_0,k_0}$ viewed as a function of $x_0$.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This computes all the wavelet coefficients. You can choose the resolution in $k_0$ by tuning the ratio in the geometric progression. The resolution in $x_0$ is set by the length of the truncated spectrum, and will change depending on the bandwidth of $w_{0,k_0}$, which in turn depends on $k_0$. The computational effort is one Fourier transform at high time resolution, plus one inverse Fourier transform for each $k_0$ value at much lower time resolution. It works out about the same as STFT - maybe slower by some small factor that depends on the resolution you choose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then modify the $c_{x_0,k_0}$ as you see fit, and you can reconstruct the signal by reversing the above process, summing the spectra over $k_0$ before finally doing an overall inverse Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Truncating spectra sometimes introduces normalisation problems, depending on precisely how your FFT is defined. I will not attempt to cover all the possibilities here. Normalisation is basically an easy problem. ;-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only part that remains is to choose a suitable wavelet envelope. It turns out it is easier to get $\hat w_{x_0,k_0}(k)$ right than to get $w_{x_0,k_0}(x)$ right. A suitable definition (from many possibilities) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat w_{x0,k0} = A exp(-i(k-k_0)x_0) exp(-(Q log(k/k_0))^2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in which $Q$ is a dimensionless constant that selects the bandwidth of your filter, i.e. the frequency resolution of your wavelets, and $A$ is chosen as necessary for normalisation. With this definition and sufficiently high resolution for $k_0$, the overcompleteness condition holds, and the signal reconstruction will work.&lt;/p&gt;&#xA;" OwnerUserId="7012" LastEditorUserId="7012" LastEditDate="2013-11-19T16:17:15.630" LastActivityDate="2013-11-19T16:17:15.630" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="12734" PostTypeId="1" CreationDate="2013-11-19T01:29:13.143" Score="2" ViewCount="124" Body="&lt;p&gt;I always wondered why transmission capacity depends on bandwidth. For example, let us say that there is an isolated island. In this island, people decide that all wireless networks use frequencies that are positive integer multiples of one base frequency. Then when we do Fourier transform, we can just use least common multiples of all used frequencies and data in each frequency will exactly be determined except background noises. Or am I wrong here? In this sense, bandwidth seems just to be useless....&lt;/p&gt;&#xA;" OwnerUserId="7015" LastActivityDate="2013-11-19T16:32:22.490" Title="Why can't we just make all wireless networks use integer multiples of base frequency?" Tags="|fourier-transform|bandwidth|fourier-series|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12735" PostTypeId="1" CreationDate="2013-11-19T02:28:49.663" Score="2" ViewCount="198" Body="&lt;p&gt;I've done research and could not find any resources on this topic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have &lt;em&gt;message signal&lt;/em&gt; composed of more sinusoids. Then I preform &lt;strong&gt;amplitude modulation&lt;/strong&gt;, that is multiply that signal with higher frequency carrier signal, and obtain &lt;em&gt;modulated signal&lt;/em&gt;. Then to demodulate that signal, I multiply the signal with same carrier signal, and obtain &lt;em&gt;demodulated version of signal&lt;/em&gt;. Then I should pass the signal through low pass filter, to obtain signal identical to message signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this by matlab using &lt;code&gt;fdesing.lowpass&lt;/code&gt; it is fine I get good output, but how to do this low pass filter &lt;strong&gt;by hand on paper&lt;/strong&gt;, if I just ignore frequencies higher than the maximum frequency in message signal I don't get same amplitudes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I multiply signals by using inverse Euler formula for $\cos$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any link or help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I didn't make myself clear, let me now and I will try to write an example (which I omit for now because I don't see here any latex support for writing mathematical equations). &lt;/p&gt;&#xA;" OwnerUserId="7014" LastEditorUserId="80" LastEditDate="2013-11-19T16:51:27.147" LastActivityDate="2013-11-19T16:51:27.147" Title="Perform lowpass filter by hand" Tags="|lowpass-filter|amplitude|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12736" PostTypeId="2" ParentId="12699" CreationDate="2013-11-19T04:00:37.487" Score="0" Body="&lt;p&gt;I would like to share this answer from &lt;a href=&quot;http://www.physicsforums.com/&quot; rel=&quot;nofollow&quot;&gt;physicsforum&lt;/a&gt; too. I felt the answer by PSarkar in this &lt;a href=&quot;http://www.physicsforums.com/showthread.php?p=4576902#post4576902&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; as a good one.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2013-11-19T04:00:37.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12737" PostTypeId="2" ParentId="12735" CreationDate="2013-11-19T04:28:44.960" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;how to do this low pass filter by hand on paper? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can use very simple low pass filter - &lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average#Simple_moving_average&quot; rel=&quot;nofollow&quot;&gt;Moving average&lt;/a&gt;. Filter is quite simple - it is sum of &lt;strong&gt;N&lt;/strong&gt; sample of signal divided by &lt;strong&gt;N&lt;/strong&gt;. If length of filter will be equal to   period of carrier signal then performance of this filter will be good.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2013-11-19T16:16:40.680" LastActivityDate="2013-11-19T16:16:40.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12738" PostTypeId="2" ParentId="12734" CreationDate="2013-11-19T05:54:30.403" Score="2" Body="&lt;p&gt;It's not that easy to distinguish different frequencies when they are close to each other so you'll need to make sure that there is sufficient spacing between the frequencies. Also, you can't just keep transmitting higher and higher frequencies. At some point there will be a limit of the highest frequency that can go through a wire or whatever transmission mechanism you are using and also the fastest computer that you have to process it. So once you cap the highest allowed frequency your method comes down to dividing up the remaining space among a finite set of frequencies. In other words, you are proposing to allot a uniform bandwidth to each of your channels, which is exactly what you said you were trying to avoid.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-11-19T05:54:30.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12740" PostTypeId="1" AcceptedAnswerId="12743" CreationDate="2013-11-19T10:07:16.157" Score="3" ViewCount="2043" Body="&lt;p&gt;Let's say I have a signal sampled at 976 Hz and I want to remove network interference noise, i.e. 50 Hz and all the harmonics. Is it possible theoretically to design a comb filter to do that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at how to do this in MATLAB but the problem is that the order of the comb filter -which defines the fundamental frequency to be filtered out- must equal fs/fo, and of course this needs to be an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7019" LastActivityDate="2013-11-19T17:15:51.337" Title="Design a comb notch filter when sampling rate is not an integer multiplicative of the cutoff frequency" Tags="|matlab|filter-design|filtering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12742" PostTypeId="2" ParentId="12694" CreationDate="2013-11-19T11:40:28.183" Score="3" Body="&lt;p&gt;The reason you need overlap add / overlap save for filtering with the short time Fourier transform is basically, that the basis functions associated with the coefficients that you get are are defined over a certain time range (as opposed to a single point in time). The Fourier transform you use to calculate the expansion coefficients also implements convolution on a circular domain defined by your signal frame length. That means the two end points of the frame are really identified and closed in a circle. That is why you have to make sure that the  basis functions of the coefficients you edit are never affecting both ends of the frame by wrapping around. This is a complication solely associated with discrete frame based Fourier transform methods and related to the convolution theorem and the fact that the discrete Fourier basis are the eigenvectors of time translations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelets are neither time translation eigenvectors nor are they calculated using circular convolution. This means you don't need overlap add or save or any other methods dealing with the side effects of circular convolution. Instead, the wavelet basis vectors are just a possible basis to describe your signal. The (complete, discrete, possibly orthogonal) wavelet transform is therefore nothing but a basis change from the time domain basis to the wavelet domain basis. Basis changes can be inverted (by applying the inverse of the basis change matrix that got you there) and you can switch back to time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameters you gave as window size, overlap, sampling rate are all not applicable to the wavelet transform. The only thing you need is a mother wavelet. If you want to compare the results to your STFT output you can pick any of the STFT basis vectors (i.e your window multiplied by a complex exponential carrier) as the wavelet prototype. Then you apply the fast wavelet transform, which will decompose your signal into a tree of high and low pass filtered and decimated signals which ultimately become your coefficients. Each coefficient is associated with a wavelet basis vector and its parameters (scale,time) or (frequeny,time). You can manipulate the coefficients and then apply the inverse discrete wavelet transform. It will take your coefficients and run them through a resynthesis filter bank to produce a signal again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These processes are not trivial and possibly hard to digest for a beginner. But you should be able to find libraries/toolboxes for your platform of choice that implement the fast wavelet transform and its inverse. However, if you want to realize your own wavelet basis, you will have to derive the filter coefficients for the decomposition and synthesis filter banks. That requires some deep theory, and you will probably have to study it first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other flavors of the wavelet transform, namely the continuous wavelet transform which works with an overcomplete basis. It is both much slower to calculate and much harder to invert, so that it's not currently an option for what you want to do.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-11-19T11:40:28.183" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12743" PostTypeId="2" ParentId="12740" CreationDate="2013-11-19T12:41:29.643" Score="4" Body="&lt;p&gt;You can design that filter manually without problems. Matlab just uses a very simplistic approach to comb filtering with a delay line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to keeps things as simple as possible I would recommend you use a series of notch filters to remove each partial of your harmonic noise separately. That also gives you more control over how much of each harmonic really has to be removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple notch filter is one with unit gain at DC, i.e. $H(1) = 1$, and the zeros on the unit circle at the desired notch frequency, positive and negative. The poles have to be inside the unit circle, close to the zeros to cancel their effect farther away from the notch frequency. We can design this directly in the z-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{(z-\exp(i\omega))(z-\exp(-i\omega)}{(z-r\exp(i\omega))(z-r\exp(-i\omega))}\times\frac{(1-r\exp(i\omega))(1-r\exp(-i\omega)}{(1-\exp(i\omega))(1-\exp(-i\omega))}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $\omega$ is the normalized frequency, meaning $\omega=2 \pi \frac{f_0}{f_s}$ where $f_0$ is your notch frequency and $f_s$ the sampling frequency. The parameter $r\in]0,1[$ controls the width of the notch. The second fraction makes sure we get a unit response at $\omega=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the coefficients for a recursive filter implementation, we have to simplify the transfer function and cancel $z^2$ to turn it into a rational function of $z^{-1}$. The result is &#xA;$$H(z) = \frac{\left(1+r^2-2r\cos(\omega)\right)\left(z^{-2}+1-2z^{-1}\cos(\omega)\right)\csc(\omega/2)^2}{4\left(r^2 z^{-2}+1-2rz^{-1}\cos(\omega) \right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can read off your filter coefficients to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ A[n]=\left(1,-2r\cos\omega,r^2 \right)$$&#xA;$$ B[n]=\left(1,-2\cos\omega,1 \right)\cdot\frac{1}{4}\left(1+r^2-2r\cos\omega\right)\cdot\csc(\frac{\omega}{2})^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last open question is how exactly the parameter $r$ controls the notch behavior. Near the zero the transfer function on the unit circle &lt;em&gt;locally&lt;/em&gt; behaves like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = \frac{x}{x-i(1-r)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;around $x=0$. For $r=1$ we get a singularity at $x=0$ and an ill-defined transfer function. For values $r&amp;lt;1$ but close to $1$ we can see that for both $x\to-\infty$ and $x\to\infty$ the transfer function becomes $1$. The interesting question is, how far does the effective influence of the pole reach on the x-axis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The square magnitude of $f(x)$ is $$|f(x)|^2=f(x)\cdot f(x)^*=\frac{x^2}{x^2+(1-r)^2}$$&#xA;which is always real and positive. We can easily equate it to a threshold and solve for $x$.The most common threshold for filter cutoffs in signal processing is $1/\sqrt{2}$, and if we solve $|f(\Delta x/2)|^2==1/\sqrt{2}$ we get the effective bandwidth of the notch to be&#xA;$$\Delta x = 2(1-r)\sqrt{1+\sqrt{2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we can use the equivalence of our problem to the original pole/zero placement to conclude&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ r = 1-\frac{\Delta \omega}{2\sqrt{1+\sqrt{2}}} $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the natural frequency bandwidth $\Delta \omega$. If you want this as a true frequency then again $\Delta \omega=2\pi\frac{\Delta f}{f_s}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this bandwidth calculation used a local approximation, so it is strictly only true for $(1-r)&amp;lt;&amp;lt;1$, or small bandwidths compared to the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this gives you a notch filter for one single harmonic of your harmonic noise. Just apply one filter at a time, one after the other, with the parameters matched to the harmonic you would like to cancel, up to fs/2. The matlab filter() function readily takes the coefficients A[n] and B[n] given above.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;An attempt to implement this in &lt;code&gt;scilab&lt;/code&gt; seems to work nicely.  Plot of before and after spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lGFex.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 12740&#xA;fs = 1000;&#xA;f = 101.89798;&#xA;omega = 2*%pi*f/fs;&#xA;delta_omega = omega/2;&#xA;N= 1000;&#xA;t = [0:N];&#xA;f = [0:N]/N*fs-fs/2&#xA;&#xA;r = 1 - delta_omega/(2*sqrt(1+sqrt(2)));&#xA;&#xA;num = [1 -2*cos(omega) 1]*1/4*(1+r.^2-2*r*cos(omega))*csc(omega/2).^2;&#xA;den = [ 1 -2*r*cos(omega) r.^2];&#xA;&#xA;X = sin(omega/2*t) + sin(omega*t) + sin(2*omega*t);&#xA;Y = filter(num,den,X);&#xA;&#xA;figure(1)&#xA;clf;&#xA;plot(f,log(fftshift(abs(fft(X)))+0.01))&#xA;plot(f,log(fftshift(abs(fft(Y)))+0.01),'k:')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="80" LastEditDate="2013-11-19T17:15:51.337" LastActivityDate="2013-11-19T17:15:51.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12744" PostTypeId="2" ParentId="12734" CreationDate="2013-11-19T16:32:22.490" Score="1" Body="&lt;p&gt;Each frequency carrier will still have to be modulated to carry any information (as in bits per second), and that modulation will take up some finite bandwidth in the spectrum.  Imperfect clock synchronization and stability will also cause any signal to take up more bandwidth than zero.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-19T16:32:22.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12745" PostTypeId="1" CreationDate="2013-11-19T16:51:06.837" Score="1" ViewCount="420" Body="&lt;p&gt;The topic of zeroing frequency bins before IFFT has been discussed here : &lt;a href=&quot;https://dsp.stackexchange.com/questions/6220/why-is-it-a-bad-idea-to-filter-by-zeroing-out-fft-bins&quot;&gt;Why is it a bad idea to filter by zeroing out FFT bins?&lt;/a&gt;&#xA;It was very helpful to understand why it is a bad idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think about, instead of zeroing, multiplying by a window (in the frequency domain!) which is 0 at the centre and smoothly goes to 1 outside of a small interval ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0, 1, 256, endpoint=False)&#xA;x = sin(2 * pi * 3 * t) + cos(2 * pi * 100 * t)&#xA;X = fft(x)&#xA;window = 1 - scipy.hamming(128)&#xA;X[64:192] *= window&#xA;y = ifft(X)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then it would not be a &quot;rectangular&quot; zeroing, but a &quot;smoothed zeroing&quot; in the frequency domain. What do you think about such a filter ?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2013-11-19T17:47:36.833" Title="A little bit better than zeroing bins in order to filter" Tags="|fft|filters|fourier-transform|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12747" PostTypeId="2" ParentId="12745" CreationDate="2013-11-19T17:47:36.833" Score="1" Body="&lt;p&gt;The Fourier transform of your window-shaped frequency response is its impulse response.  Evaluate the transform of your window function, look at its length above your desired noise floor, adjust the filter response as required to make the impulse length appropriately short, add zero-padding of this length to your original signal before the FFT, and you approach classic convolution filtering.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The added zero-padding is required to remove or reduce artifacts due to circular convolution using FFT/IFFT fast convolution.  Knowing the length of the impulse response is required to know how much zero padding is needed.  Smoother (with wider transition bands) frequency responses tend to produce shorter impulse responses.  And using smooth window shaped functions tends to imply smoother wider transition bands (although there are many other methods that may do better).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-19T17:47:36.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12753" PostTypeId="2" ParentId="10359" CreationDate="2013-11-19T21:53:36.310" Score="1" Body="&lt;p&gt;There are numerous articles on how to handle the oversegmentation problem of watershed, but I think you should read &lt;a href=&quot;http://www.cb.uu.se/~joakim/publications/PRIA_2004_E_Bengtsson.pdf&quot; rel=&quot;nofollow&quot;&gt;Robust Cell Image Segmentation Methods&lt;/a&gt; (scientific article from 2004 by Bengtsson et al).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It covers various methods for segmenting cell images and includes real-world examples that show how to handle oversegmentation from watershed on fluorescence microscopy images similar to yours (it also has examples for bright-field images and confocal microscopy images). It uses seeds from the distance transform, similar to your approach, and merges regions with weak borders. The article reads well and the concepts are pretty straight-forward to implement in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an even more current approach, you can read &lt;a href=&quot;http://perso.telecom-paristech.fr/~bloch/P6/IREC/PRL07.pdf&quot; rel=&quot;nofollow&quot;&gt;A Decomposition Scheme for 3D Fuzzy Objects Based on Fuzzy Distance Information&lt;/a&gt; by Svensson. It uses a similar method as in Bengtsson et al, but works on the &lt;em&gt;fuzzy distance transform&lt;/em&gt; which gives a better density representation for the objects used in the article.&lt;/p&gt;&#xA;" OwnerUserId="6949" LastActivityDate="2013-11-19T21:53:36.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12754" PostTypeId="1" AcceptedAnswerId="12883" CreationDate="2013-11-20T00:31:15.590" Score="1" ViewCount="450" Body="&lt;p&gt;I'm trying to create a simple NFC/RFID software simulator and am having a hard time understanding the math fully. I know that NFC tags respond by load modulating the 13.56 MHz wave that the reader is sending it. I'm pretty sure NFC tags use a subcarrier wave with a frequency of ~847 kHz. Where I'm getting confused is how to model the result of the load modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I simply take the 13.56 MHz wave and do a point-wise multiplication with the 847 kHz wave? Using the Manchester Encoder, this nets me a signal that looks like this: &lt;img src=&quot;https://i.stack.imgur.com/E0Rvk.png&quot; alt=&quot;Image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7021" LastActivityDate="2013-11-26T02:16:02.233" Title="Modeling Load Modulation" Tags="|modulation|software-implementation|math|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12756" PostTypeId="1" CreationDate="2013-11-20T03:15:38.407" Score="-1" ViewCount="143" Body="&lt;p&gt;i need to find the frequency response of the following equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t) = e^{-3t} u(t)$$&#xA;$$x(t) = 1+\cos\left(\frac{4\pi}{3}t\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;find $y(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However i am quite confused on how to do this, please explain and show every step so i can learn&lt;/p&gt;&#xA;" OwnerUserId="7022" LastEditorUserId="7022" LastEditDate="2013-11-20T19:03:39.247" LastActivityDate="2013-12-21T19:04:58.640" Title="Frequency response using fourier" Tags="|frequency-response|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12757" PostTypeId="1" AcceptedAnswerId="12763" CreationDate="2013-11-20T06:38:55.693" Score="2" ViewCount="1329" Body="&lt;p&gt;Does there exist a discrete low-pass filter algorithm that is greatly more computationally efficient for high-order (e.g. greater than 10) low-pass filters than straightforward methods like series of IIR Butterworth filters?&lt;/p&gt;&#xA;" OwnerUserId="5592" LastActivityDate="2013-11-20T11:46:53.683" Title="A Better High-Order Low-Pass Filter?" Tags="|discrete-signals|lowpass-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12758" PostTypeId="1" CreationDate="2013-11-20T07:19:35.670" Score="3" ViewCount="2006" Body="&lt;p&gt;For a classification sort of experiment using Matlab, I am in need of a database of male and female voices. So where can I get links of such open databases.  &lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2013-12-20T10:26:22.163" Title="Where can I get a database of speech signals?" Tags="|speech-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12759" PostTypeId="2" ParentId="12758" CreationDate="2013-11-20T08:40:42.957" Score="2" Body="&lt;p&gt;Check out &lt;a href=&quot;http://festvox.org/cmu_arctic/&quot; rel=&quot;nofollow&quot;&gt;http://festvox.org/cmu_arctic/&lt;/a&gt; where you'll find a few voices of different genders and accents.  Some even have simultaneously recorded electroglottograph data too.&lt;/p&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2013-11-20T08:40:42.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12760" PostTypeId="1" CreationDate="2013-11-20T08:46:25.847" Score="0" ViewCount="254" Body="&lt;p&gt;In case a symbol encodes a non-integer number of bits, how is done the bit-symbol pairing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we have a 3-levels FSK with bit rate of 1Mbps and a sequence 01011001. What is the symbol period? What is the sequence of symbols?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: My guess is that the actual bit period and symbol period are the same. Hence, the use of 3-levels only helps to increase somehow the robustness of the error detection (similar to Hamming coding or 8b/10b encoding). Thus, we apply a bipolar AMI (Alternate Mark Inversion) to the bit sequence to obtain {0,+1,0,-1,+1,0,0,-1}. Finally, in the receiver, we demodulate every symbol 0 as a bit 0, and every symbol +1 and -1 as a bit 1.&lt;/p&gt;&#xA;" OwnerUserId="4776" LastActivityDate="2020-10-08T00:50:09.673" Title="Line coding for a modulation order that is not power of 2" Tags="|modulation|digital-communications|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12762" PostTypeId="1" AcceptedAnswerId="12768" CreationDate="2013-11-20T10:35:34.333" Score="0" ViewCount="1285" Body="&lt;p&gt;from my DSP book,i am reading that  exponential signal $x(t)=e^{-a*t}$ has some time constant value $c$ let say if $e^{-a*t}=e^{-t/c}$ which means that $a=1/c$,but i want to understand   what is general formula to find  time constant for other signals and also what does it express?i meant what is real mining of time constant in signal?clearly it cant be value where signal repeats itself,because  in this case we call this number period,thanks in advance&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastActivityDate="2013-11-20T14:24:31.157" Title="understanding time constant meaning in signal processing" Tags="|discrete-signals|signal-analysis|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12763" PostTypeId="2" ParentId="12757" CreationDate="2013-11-20T11:22:29.063" Score="3" Body="&lt;p&gt;You can implement very efficient high order low pass filter using cumulative summing. The theory is as follows. A perfect integrator has the recursive definition &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = y[n-1]+x[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take the delayed difference of the output as in&#xA;$$y'[n] = y[n] - y[n-d]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you are realizing a boxcar filter of length $d-1$, as can be seen from explicitly resolving the recursion for $y[n]$ in $y'[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y'[n] = (y[n-1]+x[n]) - y[n-d]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y'[n] = ((y[n-2] + x[n-1]) + x[n]) - y[n-d]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \dots$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y'[n] = y[n-d] + \sum_{k=1}^{d-1}x[n-k] - y[n-d] = \sum_{k=1}^{d-1}x[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means you have a low pass filter of effective order $d-1$ from just one addition and one subtraction per sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, boxcars are only useful up to a certain point. But the same idea can be &lt;em&gt;generalized&lt;/em&gt;  to a larger class of filters with a trade off between filter shape and computational effort. And that is done by concatenating several integrator-difference stages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two in series will generate a triangular impulse response, three a parabolic one, and so on. Each stage convolves the output with yet another boxcar. In the frequency domain the original sinc() shaped response is taken to the n-th power (or if you have different delay lengths for the different stages, multiplied by other differently scaled sincs). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But both response sequences in time and frequency domain behave very predictably, because the &lt;em&gt;central limit theorem&lt;/em&gt; of statistics predicts that the time domain response quickly approaches a Gaussian distribution. And because the fourier transform of a Gaussian is also Gaussian, you'll get a very good approximation of a Gaussian frequency response low pass filter after only a few stages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One note about numerical precision though. Because you are integrating, the content of the delay buffer can be become very large and the difference precision suffers. This can be resolved by making the integrator leaky, so that it doesn't accumulate a constant function up to infinity. The leaky integrator difference equation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = (1-\epsilon) y[n-1] + x[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for some sufficiently small positive $\epsilon$.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-11-20T11:22:29.063" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12764" PostTypeId="2" ParentId="12757" CreationDate="2013-11-20T11:46:53.683" Score="1" Body="&lt;p&gt;Depends on the requirement for your low pass filter. For anything that needs to be steep, an IIR filter is the way to go. Typically you get the lowest order with an elliptic filter: you can trade off pass band ripple, stop band attenuation and steepness. Let's say you want a audio (sample rate = 44100 Hz) filter that's not more than 1 dB down at 1kHz but 60 dB down at 2 kHz and above. With a Butterworth that requires roughly 11th order. You can get the same thing with a 5th order elliptic filter. Reducing the passband ripple to 0.1dB increases the elliptic order to 6. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-20T11:46:53.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12766" PostTypeId="2" ParentId="12756" CreationDate="2013-11-20T13:37:08.527" Score="0" Body="&lt;p&gt;Hint #1: look up the definition of signals and systems. &quot;Calculating the frequency response&quot; and &quot;finding y(t)&quot; which presumably is x convolved with h are two different things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hint #2: This looks like a typo. It's most likely $h(t)=e^{-3t}u(t)$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-20T13:37:08.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12767" PostTypeId="1" AcceptedAnswerId="12804" CreationDate="2013-11-20T14:13:26.513" Score="3" ViewCount="145" Body="&lt;p&gt;I would like to make an acoustic measure of one room, so I can compare it with a acoustic measure of some other room. Then compare these data. So when I take an acoustic measure of the first room again, I could recognize that i am in the first room again. Next downside is that I would try to use my iPhone's microphone and the build speakers for that task. &#xA;Is this even remotely possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can please someone point me in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="7026" LastEditorUserId="80" LastEditDate="2013-11-20T15:47:55.417" LastActivityDate="2013-11-20T20:21:50.333" Title="Acoustic measure of a specific room" Tags="|fft|sound|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12768" PostTypeId="2" ParentId="12762" CreationDate="2013-11-20T14:24:31.157" Score="3" Body="&lt;p&gt;There is no general formula to calculate time constants for all signals. Time constants are defined for some signals. For your exponential signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;e^{-a \cdot t} = e^{-t / c}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it just means that always after the time $c$ has passed, the value of the function has been reduced by $1 / e$. A more common interpretation is half-life defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$t_{1/2} = \frac{ln(2)}{a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the time after the function has gone from 1 (at time zero) to 1/2 (at time $t_{1/2}$) and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is no general time constant that can be applied to any signal, because, as you already mentioned, it is unclear what it represents.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-11-20T14:24:31.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12769" PostTypeId="5" CreationDate="2013-11-20T15:35:59.133" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T15:35:59.133" LastActivityDate="2013-11-20T15:35:59.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12770" PostTypeId="4" CreationDate="2013-11-20T15:35:59.133" Score="0" Body="A quantity representing the fraction of cycle of a periodic signal, usually represented as an angle." OwnerUserId="17850" LastEditorUserId="80" LastEditDate="2022-08-16T00:27:20.183" LastActivityDate="2022-08-16T00:27:20.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12771" PostTypeId="1" CreationDate="2013-11-20T15:36:26.533" Score="0" ViewCount="2919" Body="&lt;p&gt;I have set of HRIR( Head related impulse response) downloaded. I want to convolve it with an audio signal to generate 3D signal in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to this field. Is there any tutorials or can any one help me how to start&lt;/p&gt;&#xA;" OwnerUserId="7027" LastEditorUserId="3546" LastEditDate="2013-11-20T21:06:39.317" LastActivityDate="2014-04-04T23:34:03.240" Title="HRTF implementation in matlab" Tags="|hrtf|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12772" PostTypeId="5" CreationDate="2013-11-20T15:39:44.183" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T15:39:44.183" LastActivityDate="2013-11-20T15:39:44.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12773" PostTypeId="4" CreationDate="2013-11-20T15:39:44.183" Score="0" Body="is a system of grouping objects of study or observation in accordance with their common features.&#xD;&#xA;The classification problem is a formalized task in which a set of objects (cases), separated in some way to classes." OwnerUserId="6960" LastEditorUserId="6960" LastEditDate="2013-11-20T15:41:43.650" LastActivityDate="2013-11-20T15:41:43.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12774" PostTypeId="1" AcceptedAnswerId="12853" CreationDate="2013-11-20T15:41:23.227" Score="2" ViewCount="2222" Body="&lt;p&gt;By reading some books about wavelets, it seems that Discretized CWT is not the same thing as DWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can we give a classification of Discretized CWT vs DWT vs FWT etc. ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few remarks :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;All I read about DWT or MRA (multi-resolution analysis) involves a dyadic factor (2)  for $a$ in $\frac{1}{\sqrt{a}} \Psi(\frac{t-b}{a})$, ie $a=2^m$. Is it always true ?&#xA;Remark : This is good in order to have a &lt;em&gt;non-redondant&lt;/em&gt; transform (see B Z's answer here &lt;a href=&quot;https://dsp.stackexchange.com/questions/7626/scalogram-and-related-nomenclatures-for-dwt&quot;&gt;Scalogram (and related nomenclatures) for DWT?&lt;/a&gt;), but the graphical representation of such a transform isn't very satisfying for visual analysis of a signal.&#xA;The fact that there is $ a=2^m$ involved implies that the frequency bands studied [in the case where the mother-wavelet has a narrow-band fourier transform, e.g. Morlet wavelet &lt;a href=&quot;http://ieeexplore.ieee.org/ieee_pilot/articles/06/ttg2009061375/assets/img/article_1/fig_3/large.gif]&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ieeexplore.ieee.org/ieee_pilot/articles/06/ttg2009061375/assets/img/article_1/fig_3/large.gif]&lt;/a&gt; are things like [20hz,40hz], [40hz,80hz], [80hz, 160hz], etc.&#xA;Thus we cannot hope a good graphical representation with precise frequency resolution. It seems that this kind of transform is more suited for &quot;approximation + details&quot; than for visual frequency analysis (scalogram, etc.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;On the other hand, a discretization of Continuous wavelet transform allows to take $a=1.0004^m$ for example, and thus have a more precise frequency resolution, for one who wants to do a graphical representation (scalogram).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-12-28T10:41:03.673" Title="Discretized CWT vs. DWT vs. FWT vs. MRA" Tags="|discrete-signals|signal-analysis|wavelet|stft|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12775" PostTypeId="5" CreationDate="2013-11-20T15:41:55.927" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Data_compression&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Data_compression&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="29" LastEditDate="2016-01-30T03:41:20.040" LastActivityDate="2016-01-30T03:41:20.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12776" PostTypeId="4" CreationDate="2013-11-20T15:41:55.927" Score="0" Body="This is for reducing the amount of data required to store a signal, whether lossy or lossless." OwnerUserId="6960" LastEditorUserId="29" LastEditDate="2016-01-30T03:41:20.040" LastActivityDate="2016-01-30T03:41:20.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12777" PostTypeId="5" CreationDate="2013-11-20T15:48:31.117" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T15:48:31.117" LastActivityDate="2013-11-20T15:48:31.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12778" PostTypeId="4" CreationDate="2013-11-20T15:48:31.117" Score="0" Body="in mathematics, the inverse operation of convolution signals. &#xD;&#xA;In general, the purpose of deconvolution is to find solutions of the convolution equation defined as: f * g = x.&#xD;&#xA;Where h is the recorded signal, and f is a signal that you want to recover, and we know that the first signal is obtained by convolution of the second with some known signal g. If the signal g is unknown, it has to be estimated (eg. statistical estimation)." OwnerUserId="6960" LastEditorUserId="6960" LastEditDate="2013-11-20T21:14:43.930" LastActivityDate="2013-11-20T21:14:43.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12779" PostTypeId="5" CreationDate="2013-11-20T15:54:21.583" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T15:54:21.583" LastActivityDate="2013-11-20T15:54:21.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12780" PostTypeId="4" CreationDate="2013-11-20T15:54:21.583" Score="0" Body="is a branch of algebra, concerning linear nature of objects: vector or vector spaces, linear transformations, systems of linear equations, quadratic and bi-linear forms, among the main tools used in linear algebra is the determinants of the matrix pair. The theory of invariants and tensor calculus is usually considered as integral parts of linear algebra." OwnerUserId="6960" LastEditorUserId="6960" LastEditDate="2013-11-20T21:14:52.407" LastActivityDate="2013-11-20T21:14:52.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12781" PostTypeId="5" CreationDate="2013-11-20T16:03:56.520" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T16:03:56.520" LastActivityDate="2013-11-20T16:03:56.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12782" PostTypeId="4" CreationDate="2013-11-20T16:03:56.520" Score="0" Body="is a mathematical object to be recorded in a [usually] rectangular array of elements of ring or field, which (table) is a set of rows and columns are located at the intersection of its elements. The number of rows and columns specify the size of the matrix." OwnerUserId="6960" LastEditorUserId="6960" LastEditDate="2013-11-20T21:06:28.363" LastActivityDate="2013-11-20T21:06:28.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12783" PostTypeId="5" CreationDate="2013-11-20T16:29:47.650" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T16:29:47.650" LastActivityDate="2013-11-20T16:29:47.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12784" PostTypeId="4" CreationDate="2013-11-20T16:29:47.650" Score="0" Body="Non-linear operators in Mathematical Morphology is the theory of using algebraic structure of lattices and geometrical analysis of structures, based on set theory, topology, and random functions.&#xD;&#xA;operators: Erosion, Dilation, Opening and Closing. Reconstruction filters, Connected filters, granulometries, watershed transformation, levelling, alternating sequential filters(ASFS), Duality, Idempotent filters, hierarchical analysis." OwnerUserId="6960" LastEditorUserId="5886" LastEditDate="2013-12-23T14:02:45.057" LastActivityDate="2013-12-23T14:02:45.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12785" PostTypeId="5" CreationDate="2013-11-20T16:32:31.353" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T16:32:31.353" LastActivityDate="2013-11-20T16:32:31.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12786" PostTypeId="4" CreationDate="2013-11-20T16:32:31.353" Score="0" Body="is a multiplatform computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. " OwnerUserId="6960" LastEditorUserId="6960" LastEditDate="2013-11-20T21:15:03.517" LastActivityDate="2013-11-20T21:15:03.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12787" PostTypeId="5" CreationDate="2013-11-20T16:34:36.300" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T16:34:36.300" LastActivityDate="2013-11-20T16:34:36.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12788" PostTypeId="4" CreationDate="2013-11-20T16:34:36.300" Score="0" Body="Optical Character Recognition is mechanical or electronic translation of images of handwritten, typewritten or printed text into text data (a sequence of codes used to represent characters in the computer)." OwnerUserId="6960" LastEditorUserId="6960" LastEditDate="2013-11-20T21:14:57.427" LastActivityDate="2013-11-20T21:14:57.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12789" PostTypeId="5" CreationDate="2013-11-20T16:44:59.133" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2013-11-20T16:44:59.133" LastActivityDate="2013-11-20T16:44:59.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12790" PostTypeId="4" CreationDate="2013-11-20T16:44:59.133" Score="0" Body="is a set of methods aimed to solve the problem of recovering (reconstructing) precise version of a distorted (transformed) signal, where the distortion (transform) matrix (kernel) or the Point Spread Function (PSF) is unknown." OwnerUserId="6960" LastEditorUserId="80" LastEditDate="2013-11-20T20:36:14.513" LastActivityDate="2013-11-20T20:36:14.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12792" PostTypeId="1" AcceptedAnswerId="12796" CreationDate="2013-11-20T17:27:40.760" Score="6" ViewCount="1853" Body="&lt;p&gt;Now I', wondering how to best implement a control algorithm for it. I tried using a PID controler but started with a simple P-control first. The problem is, that when using the equation &lt;code&gt;delta_exposure = k*e&lt;/code&gt; whereas &lt;code&gt;e = mean_grey_is - mean_grey_want = mean_grey_is - 127&lt;/code&gt; and with &lt;code&gt;k&lt;/code&gt; as a fixed value it is hard to define a good value for &lt;code&gt;k&lt;/code&gt; because it depends on how big &lt;code&gt;e&lt;/code&gt; is and on how big the actual &lt;code&gt;mean_grey_is&lt;/code&gt; is. Assuming &lt;code&gt;mean_grey_is&lt;/code&gt; is something like 150 (e=23) I'd only need a certain small change of my current ExposureTime. But when &lt;code&gt;mean_grey_is&lt;/code&gt; something like 173 (&lt;code&gt;e&lt;/code&gt; is twice as big) and I'm using the same k-value, the change of the ExposureTime obviously would also be twice as big, but to get a fast and quick controlling response, the change of ExposureTime would need to be a lot larger as you could see in the matlab figure above :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT2&lt;/strong&gt;&#xA;@Jazzmaniac: believe me, I don't want you to get frustrated and I really tried and try to describe all the necessary information with completely detailed. Sorry if it wasn't enough so far... The camera has NO auto-exposure or auto-parameter calibration itself, thus does NOT change any parameters itself. I MYSELF did all the measurement above to measure the camera response depending on the different built-in camera parameters. I changed the parameters to a fixed set (v1_0,v2_0,t1_0,t2_0), then varied the ExposureTime while capturing a fixed/constant scene at constant illumination. After that I changed the camera parameters again to a different set (v1_1,v2_1,t1_1,t2_1) and again varied the ExposureTime while capturing the same constant scene at same illumination. That's how I got the different camera responses plotted above (you can clearly see that they heavily depend on the 4 parameters v1,v2,t1,t2 (I plotted for t1=t2=constant)). And still I believe that the camera response varies even for a constant set of parameters (v1,v2,t1,t2)=const with the illumination. And that's exactly the point I was asking about: When I capture the frames with varying ExposureTime in a rather dark room, clearly I need (starting at small exposuretimes) high ExposureTimes to reach the saturation at the mean greylevel 255 in the image. When I keep &lt;strong&gt;everything&lt;/strong&gt; constant, turn on the lights in the room and do the SAME measurement again, then I clearly need much smaller ExposureTimes then before to reach the saturation in the image. Therefore, as stated and asked above already, the two camera responses are different concerning the x-axis-scaling. I know you did already state: &quot;Regarding your question with the different x-axis scalings. That doesn't matter,[...]&quot; -&gt; That's what I'm constantly asking about: WHY doesn't it matter? When using the camera response model and calculating the inverse F^(-1)(Vmn) I get complete different values. Was this description detailed enough? I hope so because I tried my hardest to make my question understandable...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT3&lt;/strong&gt;:&#xA;@Jazzmaniac: I tried to solve the optimization but I simply couldn't get it working. First of all: I neglected the coefficient $\frac{4}{MN}$ just to simplify it. Shouldn't be a problem I suppose. Therefore I can take the gradient as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{\partial P[V]}{\partial T} = 2 \sum_{m,n} \left(V_{m,n}-\frac{1}{2} \right)\cdot\left(F'(F^{-1}(V_{m,n}))\cdot F^{-1}(V_{m,n})\frac{1}{T} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stuck with different things about it:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the value of $V_{m,n}$ really only the actual value (because actually the value does iteratively depend on the exposuretime itself via $F(T*A_{m,n})$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the gradient meant as a function of $T$ as $\frac{\partial P[V]}{\partial T} = g(T)$ or is the $T$ in the gradient the &lt;em&gt;current&lt;/em&gt; ExposureTime?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And how to optimize this now? Sorry I'm not that fit about numerical optimizations. I first thought usually (symbolic maths) you would try to calculate the minimum by solving the equation $\frac{\partial P[V]}{\partial T} = 0 \Leftrightarrow T = ...$ but that's obviously not simply possible is it?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Currently I have the following MATLAB Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;obj = videoinput('gige', 1, 'Mono8');&#xA;src = getselectedsource(obj);&#xA;src.set('ExposureTime', 5000)&#xA;&#xA;% Functionhandles (camera response f, its inverse f_inv and derivative f_diff)&#xA;f = @(x) polyval(fit.coeff, x);&#xA;f_inv = @(x) polyval(fit_inv.coeff, x);&#xA;f_diff = @(x) (f(x+2)-f(x-2))/4;&#xA;&#xA;% Get image &amp;amp; normalize greyvalues to [0, 1]&#xA;IMG = getsnapshotfcn(obj);&#xA;IMGnorm = double(IMG(:))/255;&#xA;&#xA;% The total penalty:&#xA;P = sum((IMGnorm-0.5).^2);&#xA;&#xA;% The gradient of P in dependance of T as a function handle dPdT = g(T)&#xA;dPdT = @(T) 2*sum((IMGnorm-0.5).*f_diff(f_inv(IMGnorm)).*1/T.*f_inv(IMGnorm));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5856" LastEditorUserId="5856" LastEditDate="2014-03-20T16:29:56.370" LastActivityDate="2014-03-20T16:29:56.370" Title="AutoExposure with nonlinear camera: Non linear proportional PID?" Tags="|algorithms|control-systems|camera|" AnswerCount="1" CommentCount="19" ContentLicense="CC BY-SA 3.0" />
  <row Id="12793" PostTypeId="2" ParentId="12767" CreationDate="2013-11-20T17:30:57.300" Score="2" Body="&lt;p&gt;Tricky problem. Any speaker to mic path in a room is actually a linear time invariant system so they can be fully described by impulse response or transfer function. However the transfer functions are very complicated (1000s of degrees of freedom) and vary tremendously with position in the room. The room is also a very effective de-correlator. Signals from the same speaker recorded at two different location will seem mostly uncorrelated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try to use some statistical room acoustical properties: diffuse field power, reverb time, early decay time, reflection density, mean free path lengths etc. However, these are difficult to determine and not that much different between most rooms in the same house. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So unless you can deploy some significant constraints (control the excitation, control location of source and microphone), this will be very hard to do.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-20T17:30:57.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12794" PostTypeId="1" CreationDate="2013-11-20T17:35:18.797" Score="0" ViewCount="830" Body="&lt;p&gt;I am wondering why is the linear phase property of filters with symmetric coefficients important for some practical applications of short time fourier transform, such as image processing? I have read that the linear phase property will ensure that there will be no phase distortion of the signal by the filter? Can anyone explain the reason?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="5014" LastEditDate="2013-12-13T07:59:08.463" LastActivityDate="2013-12-13T07:59:08.463" Title="importance of symmetric windows for STFT for practical applications" Tags="|image-processing|filters|stft|distortion|linear-phase|" AnswerCount="3" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12796" PostTypeId="2" ParentId="12792" CreationDate="2013-11-20T18:21:48.817" Score="4" Body="&lt;p&gt;If you know the exact response of the camera, you can convert the brightness samples of each pixel to a linear intensity scale and perform the averaging there. That will make your whole problem intensity linear and should solve all your problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would strongly recommend using a more advanced exposure algorithm. For example you could introduce a penalty function that gets large for very low intensities and very high intensities. Summing up the penalty of all pixels gives you a total penalty that you can minimize by changing the exposure time. If the penalty is nicely behaved (smooth, etc) then you can use fast converging optimization algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As requested I will briefly describe a possible implementation of the penalty method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your variables are the &lt;em&gt;exposure time&lt;/em&gt; $T$, the &lt;em&gt;pixel values&lt;/em&gt; $V_{m,n}\in [0,1]$ for $m\in 1.. M$ and $n \in 1..N$. You also have the invertible transfer function $F$ of the camera that maps real physical intensities to pixel values. This function is also differentiable and its derivative is $F'$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this we can express the pixel values in terms of the physical intensities $A_{m,n}$ and the exposure time $T$ as:&#xA;$$V_{m,n} = F\left(T A_{m,n} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next we introduce a penalty functional that assigns high scores to very dark and very bright regions and low scores to well lit regions. Note that you can have more than just one free parameter (here exposure time) and a more complicated penalty model. I'll just go for the simplest sensible one. The penalty functional is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ P[V] = \frac{4}{MN}\sum_{m,n} \left(V_{m,n}-\frac{1}{2}\right)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can plug in our exposure model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ P[V] = \frac{4}{MN}\sum_{m,n} \left(F(TA_{m,n})-\frac{1}{2}\right)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and see how the penalty changes with the exposure time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{\partial P[V]}{\partial T} = \frac{4}{MN} \sum_{m,n} 2\left(F(TA_{m,n})-\frac{1}{2} \right)\cdot\left(F'(TA_{m,n})\cdot A_{m,n} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This expression unfortunately depends on the unknown physical intensities $A$. But we can use the exposure model again, but inverted, to estimate those from the pixel values we have. That means with $T A_{m,n} = F^{-1}(V_{m,n})$ and therefore also $A_{m,n}=F^{-1}(V_{m,n})/T$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{\partial P[V]}{\partial T} = \frac{8}{MN} \sum_{m,n} \left(V_{m,n}-\frac{1}{2} \right)\cdot\left(F'(F^{-1}(V_{m,n}))\cdot F^{-1}(V_{m,n})\frac{1}{T} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summing up, you can use the pixel values $V_{m,n}$ from just one measurement to calculate both the penalty and its gradient, using even just an approximate model of your camera. With value and slope you can then start to iteratively search for the minimum penalty by descending the gradient in some clever way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly you do that is a matter of experimentation and taste. But with the square based model here I would suggest you use a &lt;em&gt;parabolic approximation&lt;/em&gt; of the penalty function to guess the minimum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that I chose the penalty so that it is normalized between 0 and 1. So you can use that scale to decide if a found minimum is well exposed absolutely or not. This could be useful as a quality indicator for your images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Addendum&lt;/strong&gt;: For sake of completeness let me quickly show how this model generalizes your approach as described in the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that the camera is in fact linear, and that the response function is therefore&#xA;$$F(A)=s A$$ for some proportionality factor $s$. The derivative is then $F'(A)=s$ and the inverse $F^{-1}(V)=\frac{V}{s}$. With this special case, the gradient of the penalty becomes $$\frac{\partial P[V]}{\partial T}=\frac{8}{MN} \sum_{m,n}\left(V_{m,n}-\frac{1}{2} \right)\cdot \left( \frac{V_{m,n}}{T}\right)$$&#xA;and the intensity scaling factor $s$ cancels. Finding an extremum of this penalty function corresponds to choosing $T$ so that the gradient vanishes.&#xA;$$\sum_{m,n}\left(V_{m,n}-\frac{1}{2} \right)\cdot V_{m,n}=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let us quickly consider the trivial case where all $V_{m,n}=V$ are constant and not equal to zero. Then we can divide by $V$ and get that $V-1/2=0$ or $V=1/2$. With our convention of $V$ being in $[0,1]$ that means the solution is a constant flat image of 50% gray.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course all $V_{m,n}$ being identical is a very non practical assumption. So let's look at the more general case and expand the product in the sum.&#xA;$$\sum_{m,n}V_{m,n}^2-\frac{1}{2} V_{m,n}=0$$&#xA;or written slightly different&#xA;$$\sum_{m,n} \left( V_{m,n}-\frac{1}{2} \right)^2 + V_{m,n} - \frac{1}{4} - \frac{1}{2} V_{m,n}=0$$&#xA;and after collecting and scaling&#xA;$$\sum_{m,n} 2\left( V_{m,n}-\frac{1}{2} \right)^2 + V_{m,n} = \frac{1}{2}$$&#xA;We can express that with the mean brightness $\langle V \rangle$ and the quadratic deviation from the 50% brightness $\Delta V$ as &#xA;$$ 2 \Delta V + \langle V \rangle = \frac{1}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For very small deviations $\Delta V$ we get the solution you proposed in your question, namely $\langle V \rangle = \frac{1}{2}$. But the more brightness variations you have in the picture the bigger the (strictly positive) deviation becomes, and the mean brightness must drop below $\frac{1}{2}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this model generalizes your proposal for greater brightness variations, and that is very important. Because a picture that is black almost everywhere but has some small area with very high intensity would still be over exposed if you just make the mean brightness equal to 1/2. The huge variation will however make sure that the mean brightness will be chosen to be significantly lower, and save your result from over exposure!&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2013-11-27T15:45:36.700" LastActivityDate="2013-11-27T15:45:36.700" CommentCount="21" ContentLicense="CC BY-SA 3.0" />
  <row Id="12797" PostTypeId="1" CreationDate="2013-11-20T18:22:58.560" Score="1" ViewCount="511" Body="&lt;p&gt;In the &lt;a href=&quot;http://web.iitd.ac.in/~sumeet/Slaney2008-LSHTutorial.pdf&quot; rel=&quot;nofollow&quot;&gt;LSH Tutorial by Slaney&lt;/a&gt;, it is written that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Increasing the quantization bucket width w will increase the number of&#xA;  points that fall into each bucket. To obtain our final nearest&#xA;  neighbor result we will have to perform a linear search through all&#xA;  the points that fall into the same bucket as the query, &lt;strong&gt;&lt;em&gt;so varying w&#xA;  effects a trade-off between a larger table with a smaller final linear&#xA;  search, or a more compact table with more points to consider in the&#xA;  final search.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As per my understanding, if the bucket size is large, then there should be less number of tables (each bucket is a table right ? ). Since, each point is hashed to a cuket. If a query is hashed to a bucket, then with a linear scan on a larger table, wouldn't it encounter more points than a compact table ?&lt;/p&gt;&#xA;" OwnerUserId="1115" LastActivityDate="2014-07-20T16:16:49.530" Title="What is the effect of quantization bucket width in Locality Sensitive Hashing?" Tags="|computer-vision|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12798" PostTypeId="2" ParentId="2552" CreationDate="2013-11-20T18:49:02.677" Score="-1" Body="&lt;p&gt;Even though the 20*log(ratio of arbitrary quantities) form is almost ubiquitously used when defining SNR in the DSP realm, I maintain it is incorrect, and the 10*log(ratio) should always be used. The definition of dB is 10*log(ratio of powers). In the analog realm, power is V^2/R, where V and R are voltage and impedence across that voltage respectively, so we have dB = 10*log((V1^2/R1) / (V2^2/R2)) = 20*log(V1/V2) + 10*log(R2/R1). Especially at high frequencies (radar, communications, etc), it is generally desirable to match impedences for maximum transfer of power, meaning that R2 = R1. If that is the case then the second term vanishes and we're left with this definition of dB: 20*log(V1/V2). Perfectly acceptable when dealing with analog circuits. But when working with software in the DSP realm, what is an impedence? What is a voltage? Those concepts have no meaning, they do not exist in software, they are HARDWARE concepts. Once we have converted an analog signal to digital, the concepts of voltage and impedence are meaningless. So we can hardly say that impedences match (what would that even mean? the impedence of the circuit sourcing the ADC matches the input impedence of the ADC? LUDICROUS!!), meaning we have no basis for saying that the second term vanishes, and thus no basis for defining a dB as 20*log(ratio of arbitrary quantities). Therefore, it makes most sense to revert to the definition of a dB and use the 10*log(ratio of arbitrary quantities) form.&lt;/p&gt;&#xA;" OwnerUserId="7029" LastEditorUserId="7029" LastEditDate="2013-11-20T18:57:54.930" LastActivityDate="2013-11-20T18:57:54.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12799" PostTypeId="1" CreationDate="2013-11-20T19:07:58.093" Score="-1" ViewCount="553" Body="&lt;p&gt;i need to find the frequency response of the following equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t) = \delta(t) +e^{-2(t-1)} u(t-1)$$&#xA;$$x(t) = \cos\left(\frac{pi}{4}t\right)+2\cos\left(\frac{pi}{2}t\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;find $y(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However i am quite confused on how to do this, please explain and show every step so i can learn&lt;/p&gt;&#xA;" OwnerUserId="7022" LastActivityDate="2013-11-20T20:29:56.943" Title="Frequency response using fourier transform" Tags="|frequency-response|" AnswerCount="1" CommentCount="0" ClosedDate="2013-11-21T15:22:14.153" ContentLicense="CC BY-SA 3.0" />
  <row Id="12800" PostTypeId="2" ParentId="12771" CreationDate="2013-11-20T19:39:05.990" Score="2" Body="&lt;p&gt;Each HRIR is meant to represent the acoustic impulse response from an audio source at a specified angle (relative to the head) to the ear canal.  There is no such thing as a 3D signal, but if you want to simulate audio from a given azimuth and elevation angle, just convolve your audio source with the corresponding HRIR as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;left_channel = conv(audio_signal,hrir_left_az_elev)&#xA;right_channel = conv(audio_signal,hrir_right_az_elev)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case, I am using &lt;code&gt;hrir_left_az_elev&lt;/code&gt; to signify the HRIR that corresponds to the left-ear impulse response to a sound event at azimuth angle &lt;code&gt;az&lt;/code&gt; and elevation angle &lt;code&gt;elev&lt;/code&gt;.  How you actually code this up will depend completely upon the format of your HRIR data.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-11-20T19:39:05.990" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12801" PostTypeId="1" AcceptedAnswerId="12802" CreationDate="2013-11-20T19:39:18.717" Score="0" ViewCount="786" Body="&lt;p&gt;I would like to ask if I should use &lt;strong&gt;&lt;em&gt;2-PAM&lt;/em&gt;&lt;/strong&gt; modulation or &lt;strong&gt;&lt;em&gt;4-PAM&lt;/em&gt;&lt;/strong&gt; modulationif I want to send data as fast as possible given that in each case I have the same frequency spectrum available.&lt;/p&gt;&#xA;" OwnerUserId="7001" LastActivityDate="2013-11-20T20:02:07.220" Title="2-PAM or 4-PAM if I want to send data as fast as possible?" Tags="|frequency-spectrum|modulation|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12802" PostTypeId="2" ParentId="12801" CreationDate="2013-11-20T20:02:07.220" Score="5" Body="&lt;p&gt;4-PAM transfers 2 bits ($log_2(4) = 2$) per symbol, while 2-PAM transfers 1 bit per symbol ($log_2(2) = 1$), so 4-PAM definitely transfers data faster.  The catch is that you need higher SNR to get the same bit-error rate (BER) that you would get with 2-PAM.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-11-20T20:02:07.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12803" PostTypeId="1" CreationDate="2013-11-20T20:02:09.597" Score="0" ViewCount="6867" Body="&lt;p&gt;I have a signal in Malab, and I need a matrix, probably transposed specgram matrix without using specgram tool. Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="7031" LastEditorUserId="1081" LastEditDate="2013-11-22T22:12:05.297" LastActivityDate="2015-06-22T12:05:13.963" Title="Get spectrogram matrix without specgram in MatLab" Tags="|matlab|frequency-spectrum|spectrogram|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12804" PostTypeId="2" ParentId="12767" CreationDate="2013-11-20T20:21:50.333" Score="1" Body="&lt;p&gt;It sounds like you want your iPhone to be able to determine what room you are in by emitting some audio signal and listening to the response.  You would like to train your iPhone by performing this &quot;training&quot; once in each room.  After that, your phone will be able to periodically check which room it is in by comparing the current acoustic response with the list of known room responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think that this is going to work.  Hilmar's answer contains a great explanation of some of the nuances that you will run into.  In general, I think there are only a few conditions under which you might expect results from such a system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;li&gt;In any given room, the phone must be in the same position and orientation as when it was trained on that room.  Also, the room must be in a very similar state (doors/windows open vs. closed, etc.). I don't imagine that this is a practical solution if you are casually moving from room to room, and you want your phone to &quot;know&quot; what room you are in at any given time.&lt;/li&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;li&gt;Your phone is given an accurate acoustical model of the room such that it can identify the room at many locations.  This approach is prohibitively difficult to train and calibrate, and may also prove to be computational impractical. Your probability of error will depend to a great degree on the acoustical similarities between the rooms. If you are trying to distinguish between two bedrooms of roughly the same size and shape, you may never achieve the result you are after.&lt;/li&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;li&gt;If each of the rooms is &lt;em&gt;sufficiently different&lt;/em&gt;, you could hone in on certain parameters such as reverb time and reflection density. However, this is still much easier said than done unless we can also assume that the phone is in roughly the same position and orientation as when it was &quot;trained&quot; on that room.&lt;/li&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, I don't think that you have posed an &lt;em&gt;impossible&lt;/em&gt; problem, but it is most likely an &lt;em&gt;impractical&lt;/em&gt; one for what you are trying to achieve.&lt;/p&gt;&#xA;" OwnerUserId="5156" LastActivityDate="2013-11-20T20:21:50.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12805" PostTypeId="2" ParentId="12799" CreationDate="2013-11-20T20:29:56.943" Score="0" Body="&lt;p&gt;This looks like a homework problem, so I'm not going to give you the answer, rather I will try to point you in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H(t) is the impulse response of the filter.  X(t) is the input.  The response of a filter in the time domain (i.e. y(t)) can be calculated by convolving h(t) and x(t).  Convolution is a linear process so you can do it by convolving all of h(t) with all of x(t), or you can break h(t) up into two pieces- $\delta(t)$ and $e^{-2(t-1)}u(t-1)$- and/or break x(t) into two pieces- $cos(\frac{\pi}{4}t)$ and $2cos(\frac{\pi}{2}t)$- then convolve the individual pieces and add up the results to get the total result.  Breaking the input and filter into simpler pieces is usually the way to go because it is easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An even easier way is to do it in the frequency domain.  Convolution in the time domain is equivalent to multiplication in the frequency domain, so the process is to 1) calculate the Fourier transform of the input and the filter impulse response, 2) multiply the transforms together, and 3) inverse transform the result back to the time domain.  All of these steps are linear operations, so once again you can break up the filter impulse response and the input into pieces and run the process on the individual pieces.  You will find that that is a much easier way to do things, particularly because you can make good use of the &lt;a href=&quot;http://www.dip.ee.uct.ac.za/~nicolls/lectures/eee2035f/handouts/eee2035f_infosheet.pdf&quot; rel=&quot;nofollow&quot;&gt;Fourier identities/properties&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-11-20T20:29:56.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12807" PostTypeId="1" CreationDate="2013-11-20T22:14:45.523" Score="2" ViewCount="641" Body="&lt;p&gt;This question must be basic for this forum, but I'm only start working with &lt;code&gt;DWT&lt;/code&gt; recently, and I was working with &lt;code&gt;CWT&lt;/code&gt; before.&lt;br&gt;&#xA;I think I can decompose my signal to L level and then get the &lt;code&gt;scalogram&lt;/code&gt; with the following scripts.&lt;br&gt;&#xA; my question is how can I reconstruct the signal for each details&lt;code&gt;{cD1,cD2,cD3}&lt;/code&gt; and approximation &lt;code&gt;CA3&lt;/code&gt;?&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PoUSV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;Here is what I have tried so far!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=0:0.1:300;&#xA;f=[0.4 0.6 1];&#xA;y=sin(2*pi*f(2)*t)+sin(2*pi*f(2)*t)+sin(2*pi*f(3)*t);&#xA;len=length(y);level=10;&#xA;[c,l]=wavedec(y,level,'coif5');&#xA;cfd=zeros(level,len);&#xA;for k=1:level&#xA;    d=detcoef(c,l,k);&#xA;    d=d(ones(1,2^k),:);&#xA;    cfd(k,:)=wkeep(d(:)',len);&#xA;end&#xA;image(flipud(wcodemat(cfd,255,'row')));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;P.S: Actually I want to estimate the frequency components in a signal, so I thought I must decompose my signal to few levels then take FFT from the details to estimate the components that involve is the main signal. Is that right? or a better idea?&lt;br&gt;&#xA;for the CWT case I was estimating the frequency components directly.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="80" LastEditDate="2013-11-23T15:07:09.567" LastActivityDate="2013-11-23T15:07:09.567" Title="Reconstruct DWT for each cD1,cD2,cD3 and cA3 signals" Tags="|fft|frequency-spectrum|wavelet|reconstruction|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12808" PostTypeId="1" CreationDate="2013-11-21T04:43:15.043" Score="0" ViewCount="144" Body="&lt;p&gt;I read somewhere the below two line and got confused what is the actual difference between the two line. These two lines are related to CAN&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.Maximum Signal frequency used is 1 Mbit/sec&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.Typical maximum data rate achievable is 40KBytes/sec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone knows about it please share the answer. &lt;/p&gt;&#xA;" OwnerUserId="7036" LastActivityDate="2013-11-21T11:28:11.557" Title="What is difference between Signal frequency and data rate" Tags="|frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12809" PostTypeId="1" CreationDate="2013-11-21T06:02:29.010" Score="-2" ViewCount="544" Body="&lt;p&gt;We know that the signal attenuates out with distance and according to the channel transfer function or frequency response, the signal frequency components attenuate to different values based on frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect of distance is widely acknowledged &amp;amp; used in practice as a path-loss model which is exponentially decreasing in distance but frequency component is relatively less discussed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is very embarrassing to find that the everyday used wireless channel's transfer function is not known to most of us!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I searched all over the web with all naive keywords but it seems the spectrum of the channel transfer function is not there anywhere not even in many text books!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the similar lines, what is the typical conclusion about the spectrum? are high frequencies better for some reason, so that we always modulate to higher frequencies or it is just that we have available bands there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--P.S.--&lt;br/&gt;&#xA;After a fundamental clarification by user5108_Dan,&#xA;It seems to be widely acknowledged that very-high-frequency communication is highly-challenging (I am not sure if is it just the dsp/hardware challenge!). &#xA;See for eg, &lt;a href=&quot;http://en.wikipedia.org/wiki/Extremely_high_frequency&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Extremely_high_frequency&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking that the channel transfer function if exists, becomes crucial to know before we decide our band of transmission and transmit power. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR, Is this freq. response completely application specific that it includes antenna characteristics and other hardware in the chain? Even in that case, it appears to me that it helps the designer in choosing the right hardware. is n't it?&lt;/p&gt;&#xA;" OwnerUserId="5672" LastEditorUserId="5672" LastEditDate="2013-11-22T05:21:06.633" LastActivityDate="2013-11-22T05:21:06.633" Title="WIDELY UNKNOWN?? Wireless Channel Transfer Function or freq response - frequency vs attenuation" Tags="|frequency-spectrum|digital-communications|frequency-response|transfer-function|frequency-domain|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12810" PostTypeId="1" AcceptedAnswerId="12811" CreationDate="2013-11-21T06:04:16.497" Score="2" ViewCount="2402" Body="&lt;p&gt;I'm working on a DSP-based senior project, and we'd like to allow the user to provide a 20-20kHz cutoff specification for IIR/FIR high and low-pass filters on the fly.  This would be a simple problem on a desktop, but we're working on a TI 5535 DSP chip.  So we're looking for a C library for generating coefficients.  We're currently looking at adapting &lt;a href=&quot;http://www-users.cs.york.ac.uk/~fisher/software/mkfilter/current/&quot; rel=&quot;nofollow&quot;&gt;this code&lt;/a&gt; from C++ to C and cutting out the input stuff, but if there's a better solution we'd love to hear it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For IIR - Any of Butterworth / Bessel / Chebyshev would work.  Whatever has the fastest runtime / lowest complexity is optimal.  Accuracy is not important (educational product, so as long as the output changes when they change the cutoff, we're fine).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For FIR - not really sure what to do here.  Raised cosine for the lowpass, ?? for the highpass.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're sampling stereo audio at 44.1kHz/channel.  I'm unsure what other parameters we can set constant to make calculations simpler.  The number of poles can be held constant, and the rolloff and other specifications aren't terribly important to us. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question - what are some existing methods or C libraries for generating filter coefficients from a cutoff frequency in the auditory range?   &lt;/p&gt;&#xA;" OwnerUserId="7037" LastActivityDate="2013-12-06T19:28:35.480" Title="Cheaply generating coefficients for IIR/FIR given a cutoff frequency" Tags="|filters|" AnswerCount="2" CommentCount="1" ClosedDate="2013-11-23T19:21:34.370" ContentLicense="CC BY-SA 3.0" />
  <row Id="12811" PostTypeId="2" ParentId="12810" CreationDate="2013-11-21T08:30:14.010" Score="4" Body="&lt;p&gt;A computationally cheap way to generate quick &amp;amp; dirty FIR filter coefficients is to evaluate a windowed Sinc function.  Any rectangle in the frequency domain (low/high/bandpass) has a Sinc impulse response in the time domain, which can be windowed to a length roughly proportionally inverse in size to the desired width of the transition bands, and then sampled for some FIR coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About a dozen lines of BASIC pseudo code on my web page to do this should be trivial to convert to plain C : &lt;a href=&quot;http://www.nicholson.com/rhn/dsp.html#2&quot; rel=&quot;nofollow&quot;&gt;http://www.nicholson.com/rhn/dsp.html#2&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-21T08:30:14.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12812" PostTypeId="1" CreationDate="2013-11-21T09:57:26.817" Score="3" ViewCount="14046" Body="&lt;p&gt;I've got a project and need to calculate MFCCs. I tried to read some tutorials and then make a MATLAB function but I seem to have wrong answers. I'd like to feed MFCCs to one of the classification model--my choice would probably be NN or SVM. I am going to classify sound samples that either belong to one of many categories or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate MFCC, the process currently looks like below:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Process signal by using pre-emphasis filter: &lt;code&gt;x = x - 0.95*[0;x(1:N-1)];&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Take windows of 430 samples that overlap by 215 samples (equvalence of ~ 50ms window)&lt;/li&gt;&#xA;&lt;li&gt;Apply Hamming window to a segment&lt;/li&gt;&#xA;&lt;li&gt;Calculate FFT: &lt;code&gt;X = fft(x);&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate energy excluding the negative frequency part (the second half), therefore I take only frequencies between 0-4kHz&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;N2 = max([floor(N+1)/2 floor(N/2)+1]);&#xA;P = 1/N*abs(X(1:N2)).^2;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Get a bank of 40 triangularly shaped filters with centres spread over mel frequency between 20Hz and 4kHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5eguH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5eguH.png&quot; alt=&quot;Triangular filter banks&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply filters on the vector of energy, sum the vectors and take natural logarithm: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;L = log(mfccShapes'*P);&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply DCT and take13 coefficients:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;All_MFCC = cos( (pi/N*((0:N-1) + 0.5)).'*(0:N-1) )'*L;&#xA;MFCC = All_MFCC(1:13);&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have two problems in calculation of this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, in calculation in the tutorial I have read, the energy is divided by length of the frequency vector. Is that the correct step?&lt;/li&gt;&#xA;&lt;li&gt;The second problem is the &lt;strong&gt;DCT&lt;/strong&gt;. I understand that by taking DCT, we calculate cepstrum of the frequency. But I take the DCT on summed and filters energy vectors. I have applied &lt;strong&gt;DCT-II&lt;/strong&gt;, in a vectorized from, and I think it is calculated correctly. The problem is I have always very low negative value of the first coefficient.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/12a7Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/12a7Y.png&quot; alt=&quot;MFCC high energy sound&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the shape of and MFCC of low energy seem to be very similar. I realised that it is similar after I take DCT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Q1XEc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q1XEc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is the my mistake in calculation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&#xA;Celdor&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand now why the first MFCC coeficient is very low. If I look at DCT II, its first component is just a straight line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IiTiP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IiTiP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is equivalent of just summing all energy log coefficients. As all of them are negative, the overall sum becomes very low.&lt;/p&gt;&#xA;" OwnerUserId="4721" LastEditorUserId="8202" LastEditDate="2016-03-24T08:12:34.447" LastActivityDate="2016-03-24T08:12:34.447" Title="MFCC calculation" Tags="|speech-recognition|speech|mfcc|speech-processing|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12813" PostTypeId="2" ParentId="12808" CreationDate="2013-11-21T11:28:11.557" Score="1" Body="&lt;p&gt;There is a mistake. The units of frequency is cycles/second and not Mbit/second. I noticed this mistake in one of the online links on CAN. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what it means is  that the maximum theoretically possible data rate is 1Mbps and the typical real life maximum data rate is 320Kbps(40KBytes/sec). The standard says that for network lengths below 40m, 1Mbps can be achieved but for network lengths of 500m the data rate achieved is around 125kbps. So I think that's reason typical data rate is given as 40KBytes/sec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/CAN_bus&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/CAN_bus&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.computer-solutions.co.uk/info/Embedded_tutorials/can_tutorial.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.computer-solutions.co.uk/info/Embedded_tutorials/can_tutorial.htm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4375" LastActivityDate="2013-11-21T11:28:11.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12814" PostTypeId="2" ParentId="12794" CreationDate="2013-11-21T13:30:24.657" Score="0" Body="&lt;p&gt;You've already explained the reason. A filter with linear phase, or a constant group delay, will delay all frequencies equally in time. The easiest example is using a filter with a group delay that is not linear on an audio track. You'll find that high or low frequencies will be advanced or delayed independent of each other resulting in a somewhat funny sounding result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For images this would manifest itself, although not as pronounced, as periodic components being shifted around, so you would see some sort of blurring.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-11-21T13:30:24.657" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12815" PostTypeId="2" ParentId="12803" CreationDate="2013-11-21T13:42:24.653" Score="3" Body="&lt;p&gt;Yes, the easiest way to do this is using reshape and FFT, since reshape will give you a matrix and the FFT will operate along a dimension of the matrix. I've applied a 1024 rectangular window on a data set of 65536 points, sampling frequency Fs (1024), and signal frequency (100).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = randn(1, 65536) + cos(2*pi*100/1024*(0:65536-1));&#xA;z = reshape(x, 1024, []);&#xA;y = 20*log10(abs(fft(z)));&#xA;imagesc(y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This example doesn't have any overlap, but all you would need to do is shift z then concatenate it with z prior to taking the FFT. This all depends on your overlap percentage.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z = [z; circhift(z, [0 -1])];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is not complete given the first column is now at the end, so you would have to omit that column, but you get the idea.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-11-21T13:42:24.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12816" PostTypeId="2" ParentId="12809" CreationDate="2013-11-21T14:36:57.990" Score="3" Body="&lt;p&gt;Let me try to clarify something that I suspect you misunderstand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms free space propagation, there is nothing in the laws of physics that say a high frequency signal will attenuate more than a low frequency signal. In free space, a 1 MHz signal attenuates at the same rate as visible light. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here on earth, the atmosphere, moisture in particular, will cause high frequencies to attenuate more, but in general, atmospheric affects are minimal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is certainly true however than when calculating the path loss for a wireless link, the Friis Transmission Equation predicts that the &quot;loss&quot; is proportional the square of the frequency.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Friis_transmission_equation&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Friis_transmission_equation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand this apparent contradiction, you need to understand how the Friis equation was developed. The basic idea is that if you have a perfect isotropic radiator at the center of a sphere, then each square meter of that sphere will receive the same amount of energy, regardless of frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the amount of energy an antenna can receive, is a strong function of its physical size, which is what the Friis equation is all about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Friis equation predicts the amount of energy that will pass through a square on the surface of that sphere, but the size of that square is one wavelength, not 1 meter. Consequently, less energy passes through the square at high frequencies because the square is smaller. This is a way to normalize, if you will, the effects of antenna size. Everything is based on a wavelength.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Said a bit differently, if you could build an ideal antenna with infinite bandwidth, then the gain of that antenna would be proportional to frequency, which would cancel out the path &quot;losses&quot; due to frequency. Antennas however are inherently narrow band devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your question as to whether high frequencies are better. There is nothing better about higher frequencies. The attenuation due to moisture is worse, the loss through building walls is worse, the hardware is more expensive and more difficult to design, and the interference due to multipath propagation is worse, but that is where the available spectrum is.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2013-11-21T14:36:57.990" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12817" PostTypeId="1" CreationDate="2013-11-21T14:59:55.597" Score="1" ViewCount="2023" Body="&lt;p&gt;I am trying to understand panorama stitching. I've come to a conclusion that homography is one of the fundamental parts in the process. Now I am trying to make sense of all the information from literature across the web concerning about solving for homography. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read about Direct Linear Transform, Least Squares method and RANSAC. However, from what I've read I'd say DLT and RANSAC are the methods to solve homography while Least Squares is just used as additional step in DLT when there are more than 4 correspondence points. Is this right? I feel like I have things mixed up.&lt;/p&gt;&#xA;" OwnerUserId="1798" LastActivityDate="2013-11-22T10:07:20.817" Title="What methods can be used to compute homography" Tags="|image-processing|homography|stitching|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12818" PostTypeId="1" CreationDate="2013-11-21T16:49:39.923" Score="2" ViewCount="518" Body="&lt;p&gt;I'm developing an audio watermarking algorithm which embeds text (binary form) in DWT-DCT coefficients. The goal of the algorithm is to hide song information (like artist, song, album,...). Everything works fine the text is recovered using another algorithm which extracts the hidden text. However my algorithm doesn't resist attacks, I use Stirmark for Audio v02 which I found &lt;a href=&quot;http://wwwiti.cs.uni-magdeburg.de/~alang/smba.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. The quality of the audio is not really affected, in fact I get good values when using the Normalized Cross-Correlation, the problem is when recovering the text which is highly affected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said before the text is binarized so when I perform an attack it is very likely that some bits representing the text are flipped. If this were a binary image and not text, the extraction would be almost imperceptible to human eye but when dealing with text everything screws up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question are: do you there another way to embed text different from binarization? Do you know any other algorithm to hide text on audio that resists common audio attacks? Any other recommendation to hide same data on audio file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="4222" LastActivityDate="2017-02-06T19:44:53.233" Title="Audio watermark embedding text attack resistant" Tags="|matlab|audio|wavelet|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="12819" PostTypeId="1" AcceptedAnswerId="12820" CreationDate="2013-11-21T18:23:07.443" Score="2" ViewCount="352" Body="&lt;p&gt;I heard that it is important to have all oscillator clocks at different places be synchronized for example in a geographically distributed system such a telecommunication network. Of course to some error margin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They fix GPS receivers in the base stations to synchronize the oscillators. I know GPS transmits time, as in our watches. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please explain what does this time of the day has to do with synchronizing oscillators?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="5809" LastActivityDate="2013-11-21T20:07:07.413" Title="How is GPS used to synchronize oscillators in a distributed system?" Tags="|discrete-signals|digital-communications|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12820" PostTypeId="2" ParentId="12819" CreationDate="2013-11-21T19:39:42.907" Score="3" Body="&lt;p&gt;Part of the GPS signal is a 1 pulse per second clock that can be used in distributed systems for timing synchronization.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.faqs.org/patents/app/20120188125&quot; rel=&quot;nofollow noreferrer&quot;&gt;This patent&lt;/a&gt; has some diagrams that might help, e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ulsnq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding how accurate it is, I'm not sure. &lt;a href=&quot;http://www2.iee.or.jp/ver2/honbu/14-magazine/log/2005/2005_08c_08.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; has the following graph... which seems pretty good to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/K9J9q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-11-21T20:07:07.413" LastActivityDate="2013-11-21T20:07:07.413" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12821" PostTypeId="1" AcceptedAnswerId="12822" CreationDate="2013-11-21T20:06:31.553" Score="2" ViewCount="3636" Body="&lt;p&gt;How would I detect an edge oriented at 22.5&amp;deg; using a spatial filter?&lt;/p&gt;&#xA;" OwnerUserId="7041" LastEditorUserId="76" LastEditDate="2013-11-22T00:18:37.700" LastActivityDate="2013-11-22T00:18:37.700" Title="Detecting edges oriented at certain angle" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12822" PostTypeId="2" ParentId="12821" CreationDate="2013-11-21T20:14:05.990" Score="8" Body="&lt;p&gt;You can use &lt;a href=&quot;http://en.wikipedia.org/wiki/Steerable_filter&quot; rel=&quot;noreferrer&quot;&gt;steerable filters&lt;/a&gt;.  To detect an edge at a specific orientation you need to compute the derivative in the direction normal to the edge. To do that, you first compute the x-derivative and the y-derivative. Then the oriented derivative $I_{\theta} = I_x cos(\theta) + I_y sin(\theta)$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Doing this with a simple &lt;a href=&quot;http://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;noreferrer&quot;&gt;Sobel filter&lt;/a&gt;  generates the following images. The top left is a contour plot of the test image. The top right is the contour plot of the result of the steerable filter.  The bottom two show the contour plots of the original horizontal and vertical filters applied to the test image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ox3gm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;scilab&lt;/code&gt; code below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ix =  [1 2 1; 0 0 0; -1 -2 -1];//Sobel horizontal edge kernel;&#xA;Iy =  [1 0 -1; 2 0 -2; 1 0 -1];//Sobel vertical edge kernel;&#xA;&#xA;theta = 22.5/180*%pi;&#xA;&#xA;I_theta = Ix*cos(theta) + Iy*sin(theta);&#xA;&#xA;test_image = zeros(100,100);    &#xA;test_image(1:100,1:100) = (([1:100]-50.5)'*ones(1,100)).^2 + (ones(100,1)*([1:100]-50.5)).^2 &amp;lt; 100;&#xA;&#xA;&#xA;output_image = conv2(test_image, I_theta,&quot;same&quot;);&#xA;xset(&quot;fpf&quot;,&quot; &quot;)&#xA;&#xA;levels = [0:0.5:1];&#xA;axes = [0 100 0 100];&#xA;&#xA;&#xA;clf;&#xA;subplot(221);&#xA;contour(1:100,1:100,abs(test_image),levels)&#xA;a = gca();&#xA;a.isoview = &quot;on&quot;;&#xA;a.title.font_size = 5;&#xA;mtlb_axis(axes);&#xA;title('Test image');&#xA;&#xA;&#xA;subplot(222);&#xA;contour(1:100,1:100,abs(output_image),levels)&#xA;a = gca();&#xA;a.isoview = &quot;on&quot;;&#xA;a.title.font_size = 5;&#xA;mtlb_axis(axes);&#xA;xtitle('${\rm Steered\ in\ direction\ }\theta$');&#xA;&#xA;subplot(223);&#xA;contour(1:100,1:100,abs(conv2(test_image,Ix,&quot;same&quot;)),levels)&#xA;a = gca();&#xA;a.isoview = &quot;on&quot;;&#xA;a.title.font_size = 5;&#xA;mtlb_axis(axes);&#xA;title('Horizontal filter')&#xA;&#xA;subplot(224);&#xA;contour(1:100,1:100,abs(conv2(test_image,Iy,&quot;same&quot;)),levels)&#xA;a = gca();&#xA;a.isoview = &quot;on&quot;;&#xA;a.title.font_size = 5;&#xA;mtlb_axis(axes);&#xA;title('Vertical filter')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="53" LastEditorUserId="80" LastEditDate="2013-11-21T22:11:11.827" LastActivityDate="2013-11-21T22:11:11.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12823" PostTypeId="2" ParentId="12810" CreationDate="2013-11-21T21:07:49.120" Score="1" Body="&lt;p&gt;I am not familiar with the TI 5535, so I am not sure how cheap your definition of cheap is :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems however that a Kaiser filter would be considered reasonably cheap, especially if you separate the window code from the ideal impulse code. In other words, if your tap count remains the same, and you don't change the side lobe levels, then the window values can be pre-computed and stored. Then only the ideal low pass, band pass, high pass, or notch impulse values needs to be computed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code for a low pass impulse. The high pass and other code is similar.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double LPF_Impulse(int m, int M, double Omega)&#xA;{&#xA; double Arg;&#xA; Arg = (double)m - (double)(M-1) / 2.0;&#xA; return( Omega * Sinc(Omega * Arg * M_PI) );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is just textbook code. The rest of it is here:&#xA;&lt;a href=&quot;http://www.iowahills.com/A7ExampleCodePage.html&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/A7ExampleCodePage.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also Bilinear Transform code here to compute IIR coefficients from the normalized 2nd order coefficients of H(s). &lt;/p&gt;&#xA;" OwnerUserId="5108" LastEditorUserId="5108" LastEditDate="2013-12-06T19:28:35.480" LastActivityDate="2013-12-06T19:28:35.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12824" PostTypeId="2" ParentId="12705" CreationDate="2013-11-21T22:00:23.977" Score="0" Body="&lt;p&gt;I just found the answer in a paper. so thought it might be useful for someone.&lt;br&gt;&#xA;If we decompose a signal with length of $N$ to $L$ level then time complexity is&lt;br&gt;&#xA;$O(L\times Nlog_{2}N)$&lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2013-11-21T22:00:23.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12825" PostTypeId="1" CreationDate="2013-11-22T03:56:40.180" Score="2" ViewCount="1221" Body="&lt;p&gt;I am implementing visual bag of words through these steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find interest points using SIFT&lt;/li&gt;&#xA;&lt;li&gt;Calculate SIFT descriptor&lt;/li&gt;&#xA;&lt;li&gt;Build codebook through kmeans clustering of SIFT descriptors.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How can I visualize these visual words? For example in the following lecture, how do they get those patches?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bpaz6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3802" LastEditorUserId="1355" LastEditDate="2013-11-26T07:19:51.487" LastActivityDate="2018-03-12T11:35:29.167" Title="Visualize visual words in bag of words model" Tags="|computer-vision|sift|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12827" PostTypeId="1" AcceptedAnswerId="12910" CreationDate="2013-11-22T07:01:44.573" Score="0" ViewCount="411" Body="&lt;p&gt;I am very much interested in pattern classification experiments and its theory etc. So I am trying some home brew experiments using MATLAB. As a first major experiment, I would like to classify persons based on sex from facial images. My doubt is basically is it worth attempting it, because right now I don't have idea on what are the basic facial features to extract and how to do that? I want basic facial features to distinguish between males and females. I am using kNN classifier.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="5253" LastEditDate="2013-11-22T14:56:18.983" LastActivityDate="2013-11-27T02:36:32.483" Title="Pattern classifier experiment for determining sex from face image of persons using kNN?" Tags="|image-processing|machine-learning|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12828" PostTypeId="1" CreationDate="2013-11-22T07:03:38.913" Score="0" ViewCount="403" Body="&lt;p&gt;I want to estimate sampling clock offset. I am currently referring this paper&#xA;&quot; CRAMER-RAO BOUNDS FOR DATA-AIDED SAMPLING CLOCK OFFSET AND CHANNEL ESTIMATION &quot;. Is there any other method to estimate? I also referred Lee's method, but it gives symbol timing. Is there a way to estimate sampling clock offset from timing error estimate?&lt;/p&gt;&#xA;" OwnerUserId="5817" LastEditorUserId="13320" LastEditDate="2016-05-13T10:38:54.113" LastActivityDate="2016-05-13T10:38:54.113" Title="Sampling Clock Offset estimation" Tags="|sampling|estimation|synchronization|timing|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12829" PostTypeId="1" CreationDate="2013-11-22T08:48:52.137" Score="2" ViewCount="270" Body="&lt;p&gt;I am hoping to create an application that would listen to ambient sound and detect if music is being played. It is not important to identify the music being played; just detecting that some music is being played is enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked around for existing solutions but couldn't find any. Does anyone know algorithms that I can use to solve this problem? If source code is available, all the better. I found a couple of academic papers and implemented solutions suggested in them. But the results I obtained were not satisfactory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: i) It would be a bonus if the algorithm is not computationally intensive; if algorithm is completely in time-domain that would be wonderful. ii) It is okay if the solution is not very accurate; occasional false-positives are okay.&lt;/p&gt;&#xA;" OwnerUserId="7045" LastEditorUserId="7045" LastEditDate="2013-11-22T13:44:13.420" LastActivityDate="2013-11-22T13:44:13.420" Title="Detecting presence of music in ambient sound" Tags="|audio|signal-analysis|signal-detection|sound|music|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12830" PostTypeId="1" AcceptedAnswerId="12915" CreationDate="2013-11-22T09:52:58.637" Score="1" ViewCount="5843" Body="&lt;p&gt;I want a relatively easy to implement but relatively reliable algorithm for detecting beat locations in an audio file.What I am aiming to do is get the location of the closest beat to a particular time instant i.e if given current playtime, how can I get the location of next beat.Does anyone know of any algorithms that could help me solve this problem?&lt;/p&gt;&#xA;" OwnerUserId="4376" LastActivityDate="2016-11-26T19:07:46.277" Title="Easiest Beat Tracking Algorithim" Tags="|audio|discrete-signals|sound|music|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12831" PostTypeId="2" ParentId="12817" CreationDate="2013-11-22T10:07:20.817" Score="2" Body="&lt;p&gt;I've never actually done Panorama Stitching, but I was talking to people who were, and I was involved in a project where we had to estimate the homography for fine localization for visual navigation, so here it goes.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Basic approach&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Rough outline of the approach using RANSAC &lt;sub&gt;&lt;sup&gt;(you can read more of the approach in &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/culjak12ms.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Master thesis&lt;/a&gt;, page 12,13 - unfortunately, in Croatian)&lt;/sup&gt;&lt;/sub&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;estimate pairs of corresponding points for two images $A$ and $B$ (lot of them) and get rid of the obviously bad correspondences&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&lt;sup&gt;(detailed summary of a feature matching approach in &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/bosilj12ms.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;my Master Thesis&lt;/a&gt;, pages 13-20 - In English)&lt;/sub&gt;&lt;/sup&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;pick any four points for the initial estimate of homography $H$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&lt;sup&gt;(most details on the numerical methods used to estimate the homography can be probably be found in &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/bosilj10bs.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;my Bachelor Thesis&lt;/a&gt; (in Croatian), but there should also be some details in &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/culjak12ms.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Master Thesis&lt;/a&gt; (Cro) and &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/trbojevic12ms.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; (Eng))&lt;/sub&gt;&lt;/sup&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;project all points from the image $A$ onto the image $B$ using the first estimation of the homography $H$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;compare the projected points from $A$ to the actual points present in $B$ (using Euclidian distance)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;discard all the point pairs&lt;/em&gt; where the distance between &lt;em&gt;projected point from $A$&lt;/em&gt; and &lt;em&gt;corresponding point from $B$&lt;/em&gt; is greater than a threshold $t$ -- those points are &lt;strong&gt;outliers&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(this can be repeated several times, possibly with a more constrictive &lt;em&gt;threshold $t$&lt;/em&gt; every time, to get rid of more outliers)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the points that are left are our &lt;strong&gt;population points&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;using only the &lt;em&gt;population points&lt;/em&gt;, do the final estimation of homography $H_{final}$ just from those points&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Some additional info&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Coincidentally, if &lt;strong&gt;you have the initial rough matching&lt;/strong&gt; results, the &lt;strong&gt;rest of this is implemented&lt;/strong&gt; in OpenCV, it's a function called &lt;code&gt;findHomography&lt;/code&gt; and there is a &lt;a href=&quot;https://stackoverflow.com/q/11237948/884412&quot;&gt;good StackOverflow post on that&lt;/a&gt;. It includes RANSAC (and from what I can read from that post, Least Squares method should have a similar goal as RANSAC, but RANSAC gives better results).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you &lt;strong&gt;need better estimates&lt;/strong&gt;, you can find references for methods other than RANSAC in &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/trbojevic12ms.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Master thesis&lt;/a&gt; (Eng) - pure RANSAC approach is compared to something called MLESAC, and RANSAC coupled with Least Median of Squares method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggestions on an &lt;strong&gt;efficient implementation of Homography&lt;/strong&gt; estimate from points (presuming that you do not want to use OpenCV or some other available implementation) can be found in &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/bosilj10bs.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;my Bachelor Thesis&lt;/a&gt; (Cro).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To estimate the initial (not-very-precise) pairs of correspondences, you should use &lt;strong&gt;matching methods&lt;/strong&gt;. Those methods are based on:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;detecting feature points&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(there's a lot about that &lt;a href=&quot;https://dsp.stackexchange.com/questions/11024/purpose-of-image-feature-detection-and-matching/11029#11029&quot;&gt;in this DSP question&lt;/a&gt;, and especially in &lt;a href=&quot;https://dsp.stackexchange.com/a/11266/1273&quot;&gt;this answer&lt;/a&gt; you will find a link to the current widely used framework for comparing feature detectors)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;using appropriate feature descriptors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(nice info in &lt;a href=&quot;https://dsp.stackexchange.com/q/10423/1273&quot;&gt;this DSP question&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;doing matching between those points and possibly some kind of filtering to further better the matches obtained&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matching a point from an image $A$, $x_{A}$ with a descriptor $d(x_{A})$ is usually done just by finding the point in the image $B$, $x_{B}$ with the most similar descriptor $d(x_{B})$ according to Euclidian distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most simple (and surprisingly efficient) filtering method is to compare the distance from $d(x_{A})$ to the &lt;em&gt;closest descriptor&lt;/em&gt; $d(x_{B_1})$ and &lt;em&gt;second closest descriptor&lt;/em&gt; $d(x_{B_2})$. If $\frac{D_{eucl}(d(x_{A}), d(x_{B_1}))}{D_{eucl}(d(x_{A}),d(x_{B_2})}$ is greater than some coefficient $k \in [0,1]$ (typically $k = 0.6$), the match is rejected. First introduced by &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDAQFjAA&amp;amp;url=http%3A%2F%2Fwww.cs.ubc.ca%2F~lowe%2Fpapers%2Fijcv04.pdf&amp;amp;ei=kCuPUt21MsOZ0AXTrYCoDQ&amp;amp;usg=AFQjCNExaFk5YsadEaL01y1K6FRDDh5u3g&amp;amp;sig2=lxW7QrcHdAEmksUZH25YdQ&amp;amp;bvm=bv.56988011,d.d2k&quot; rel=&quot;nofollow noreferrer&quot;&gt;D.G. Lowe: &lt;em&gt;Distinctive image features from scale-invariant keypoints&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional filtering can be done according to spatial arrangement of the corresponding points. One such interesting method was described in &lt;a href=&quot;http://web.cs.swarthmore.edu/~turnbull/cs97/f08/paper/sivic03.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;J. Sivic, A. Zisserman: &lt;em&gt;Video Google: A Text Retrieval Approach to Object Matching in Videos&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2013-11-22T10:07:20.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12832" PostTypeId="1" CreationDate="2013-11-22T11:44:07.443" Score="4" ViewCount="1421" Body="&lt;p&gt;I would like to be able to compute the so-called &quot;free distance&quot; for a TCM with a rate 2/3 convolutional code (two inputs, three outputs) inside that I plan to use for 8PSK. My previous assumption was that I could simply compute distance between the &quot;null sequence&quot; and the next closest sequence because the code is linear. But that does not seem to work because this computation gives me a squared free distance of supposedly 5.17157 for an 8-state code that actually performs worse in AWGN channel simulations than the 8-state recursive Ungerboeck code for which I compute the squared free distance to be 4.58579 (which is correct in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointers on how to compute the free distance for TCM would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The TCM for which my free distance calculation seems to fail is this one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;in1 ----------*---------------*-- out2&#xA;              |               |&#xA;              |               V&#xA;in0 -*--------|--------*----&amp;gt;(+)- out1      (+) is a binary plus (xor)&#xA;     |        |        |&#xA;     V        V        V                    [D] is a delay element/flip-flop&#xA;    (+)-&amp;gt;[D]-(+)-&amp;gt;[D]-(+)-&amp;gt;[D]-*- out0&#xA;     A                 A       |            V and A are supposed to be&#xA;     |                 |       |            arrow heads&#xA;     `-----------------*-------´&#xA;&#xA;symbol mapping:&#xA;binary &quot;out2 out1 out0&quot; -&amp;gt; exp(2i*pi*out/8)&#xA;where out_k is the k-th bit of out counting from zero as the LSB&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1961" LastEditorUserId="90" LastEditDate="2015-05-17T18:47:31.900" LastActivityDate="2015-05-17T18:47:31.900" Title="How to compute the free distance in TCM (Trellis-Coded Modulation)?" Tags="|digital-communications|modulation|" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12833" PostTypeId="2" ParentId="12700" CreationDate="2013-11-22T12:03:04.520" Score="0" Body="&lt;p&gt;If the noise is independant from the signal and your images are well-aligned, you can simply average your images. Very basic probability arguments show that averaging $N$ samples of a variable $y = x + n$ (where $x$ is the true value and $n$ the independant noise) yields a noise variance reduction equal to $\sqrt{N}$ and thus improves the SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way, you avoid any threshold and already get better images. They may look blurred if the noise is strong or if the images are misaligned, so additional processing steps might be required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative to using an averaging operation is to stack all your images, then choose as denoised pixel value the median of the given pixel in the stack (i.e., among all the observations). This technique handles better salt-and-pepper shaped noises than the previous one and remains simple to implement.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-11-22T12:03:04.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12834" PostTypeId="2" ParentId="12797" CreationDate="2013-11-22T13:04:15.737" Score="2" Body="&lt;p&gt;I think you've got the point, but that you are getting confused by the additional tables that you think should be used to implement buckets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's rephrase the quote from the tutorial first:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In LSH, you create a partition of the entire space. If you use a large&#xA;  bucket width $w$, then obviously you need less buckets to span the&#xA;  entire space and thus you get shorter codes. Since you have less&#xA;  buckets, your hash table has less slots (obvious) but there are also&#xA;  more points per bucket.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Note that by definition of LSH all the points $x$ that fall into a given bucket $B$ have the same binary code:&#xA;$$\forall x \in B, \text{LSH}(x) = b,$$&#xA;where $b$ is some constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's consider what happens when you make a query on the hash table: if you use $b$ as query to the hash table, you will get all the points $x$ in the above formula.&#xA;The only information that you have on these points is that their binary code is equal to $b$, you do not have additional information: they may be all around the bucket, or in its center, etc. So, you can't avoid comparing your exact query point with each of them (using their real coordinates) if you want to find a special neighbour (usually the closest one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you need to loop over all the points inside the bucket, this search is linear, and here comes the trade-off mentioned in the tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you implement some LSH, you are free to use whatever technique you want for both the hash table and the buckets.&#xA;In my hashing implementation, the hash table was actually a table (for simplicity, because finding a bucket becomes then a simple table lookup), but the buckets themselves were implemented as lists for memory efficiency (you allocate a slot only when you add a point to the bucket).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question implies that you would implement the buckets themselves as arrays, but this may not always be desirable when you do not know anything about the distribution of the points in your data set or when your programming framework (in my case, vanilla C/C++) does not allow you to easily resize arrays.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-11-22T13:04:15.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12835" PostTypeId="2" ParentId="12829" CreationDate="2013-11-22T13:04:56.767" Score="1" Body="&lt;p&gt;This is a tough problem. The music identification service &lt;a href=&quot;http://en.wikipedia.org/wiki/Shazam_%28service%29&quot; rel=&quot;nofollow&quot;&gt;Shazam&lt;/a&gt; actually has a database of acoustic fingerprints for songs. Music is composed of many variable acoustic components and there are a slew of algorithms that may be used to estimate several components. One simple example would be the zero crossing rate, which is a time domain algorithm. I would refer to this &lt;a href=&quot;http://en.wikipedia.org/wiki/Pitch_detection_algorithm&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; on the subject for a brief overview of pitch detection algorithms and go from there.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-11-22T13:04:56.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12836" PostTypeId="1" AcceptedAnswerId="12837" CreationDate="2013-11-22T14:34:24.080" Score="0" ViewCount="182" Body="&lt;p&gt;I'm reading &quot;Digital Signal Processing&quot;, written by Michael Weeks. In section Representing a Digital Signal as a Sum of Sinusoids, there is this Matlab code that I cannot understand. (code given below)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't get is what does the term inside cos argument 1/Xsize mean (in part &lt;code&gt;%Do the sinusoids as discrete points only&lt;/code&gt;, I guess it is fundamental frequency, but how can we conclude it). And why is the whole function divided by Xsize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same thing with smooth0, smooth1, smooth2... I also don't get this smoothing process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any explanations, or links to helpful stuff.   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%sum_of_sins.m&#xA;%Show a random signal as a sum of sins&#xA;%&#xA;&#xA;%Make our x signal&#xA;x=round(rand(1,8)*10);&#xA;Xsize=length(x);&#xA;&#xA;%Get FFT of x&#xA;X=fft(x);&#xA;Xmag=abs(X);&#xA;Xphase=angle(X);&#xA;&#xA;%Show the freq-domain info as sum of sinusoids&#xA;%Find the IFFT (the hard way) part 1&#xA;n=0:Xsize-1;&#xA;%Do the sinusoids as discrete points only&#xA;s0=Xmag(1)*cos(2*pi*0*n/Xsize+Xphase(1))/Xsize;&#xA;s1=Xmag(2)*cos(2*pi*1*n/Xsize+Xphase(2))/Xsize;&#xA;s2=Xmag(3)*cos(2*pi*2*n/Xsize+Xphase(3))/Xsize;&#xA;s3=Xmag(4)*cos(2*pi*3*n/Xsize+Xphase(4))/Xsize;&#xA;s4=Xmag(5)*cos(2*pi*4*n/Xsize+Xphase(5))/Xsize;&#xA;s5=Xmag(6)*cos(2*pi*5*n/Xsize+Xphase(6))/Xsize;&#xA;s6=Xmag(7)*cos(2*pi*6*n/Xsize+Xphase(7))/Xsize;&#xA;s7=Xmag(8)*cos(2*pi*7*n/Xsize+Xphase(8))/Xsize;&#xA;%Redo the sinusoids as smooth curves&#xA;t=0:0.05:Xsize-1;&#xA;smooth0=Xmag(1)*cos(2*pi*0*t/Xsize+Xphase(1))/Xsize;&#xA;smooth1=Xmag(2)*cos(2*pi*1*t/Xsize+Xphase(2))/Xsize;&#xA;smooth2=Xmag(3)*cos(2*pi*2*t/Xsize+Xphase(3))/Xsize;&#xA;smooth3=Xmag(4)*cos(2*pi*3*t/Xsize+Xphase(4))/Xsize;&#xA;smooth4=Xmag(5)*cos(2*pi*4*t/Xsize+Xphase(5))/Xsize;&#xA;smooth5=Xmag(6)*cos(2*pi*5*t/Xsize+Xphase(6))/Xsize;&#xA;smooth6=Xmag(7)*cos(2*pi*6*t/Xsize+Xphase(7))/Xsize;&#xA;smooth7=Xmag(8)*cos(2*pi*7*t/Xsize+Xphase(8))/Xsize;&#xA;%Find the IFFT (the hard way) part 2&#xA;my_sum_of_sins=s0+s1+s2+s3+s4+s5+s6+s7;&#xA;smooth_sum=smooth0+smooth1+smooth2+smooth3+smooth4+smooth5+smooth6+smooth7;&#xA;&#xA;%Show both discrete points and smooth curves together&#xA;xaxis1=(0:length(smooth0)-1)/20; %for 8 points&#xA;xaxis2=(0:length(s0)-1);&#xA;&#xA;figure(1);&#xA;subplot(4,1,1); plot(xaxis1, smooth0, 'g', xaxis2, s0,'r*');&#xA;subplot(4,1,2); plot(xaxis1, smooth1, 'g', xaxis2, s1,'r*');&#xA;subplot(4,1,3); plot(xaxis1, smooth2, 'g', xaxis2, s2,'r*');&#xA;subplot(4,1,4); plot(xaxis1, smooth3, 'g', xaxis2, s3,'r*');&#xA;&#xA;figure(2);&#xA;subplot(4,1,1); plot(xaxis1, smooth4, 'g', xaxis2, s4, 'r*');&#xA;subplot(4,1,2); plot(xaxis1, smooth5, 'g', xaxis2, s5, 'r*');&#xA;subplot(4,1,3); plot(xaxis1, smooth6, 'g', xaxis2, s6, 'r*');&#xA;subplot(4,1,4); plot(xaxis1, smooth7, 'g', xaxis2, s7, 'r*');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7014" LastEditorUserId="7014" LastEditDate="2013-11-22T15:53:58.043" LastActivityDate="2013-11-22T17:24:01.680" Title="Inverse Fast Fourier Transform Hard Way" Tags="|matlab|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12837" PostTypeId="2" ParentId="12836" CreationDate="2013-11-22T16:37:37.650" Score="1" Body="&lt;p&gt;Effectively &lt;code&gt;Xsize&lt;/code&gt; is allows the sampling frequency to be set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just used &lt;code&gt;2*pi*0*n+Xphase(1)&lt;/code&gt; as the argument of $\cos(\cdot)$ or $\sin(\cdot)$ then you'd just get $\cos({\tt Xphase(1)})$ or $\sin({\tt Xphase(1)})$ for all terms... because then the &lt;code&gt;2*pi*0*n&lt;/code&gt; terms would be an integer multiple of &lt;code&gt;2*pi&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;With respect to the &lt;code&gt;Xsize&lt;/code&gt; terms at the end:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;s0=Xmag(1)*cos(2*pi*0*n/Xsize+Xphase(1))/&lt;strong&gt;Xsize&lt;/strong&gt;;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Check out the definition of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#equation_Eq.2&quot; rel=&quot;nofollow&quot;&gt;inverse DFT&lt;/a&gt;, particularly equation 2:&#xA;$$&#xA;x_n = \frac{1}{N} \sum_{k=0}^{N-1} X_k e^{i2\pi k n / N}&#xA;$$&#xA;for your code, &lt;code&gt;N = XSize&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-11-22T17:24:01.680" LastActivityDate="2013-11-22T17:24:01.680" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12838" PostTypeId="1" AcceptedAnswerId="12839" CreationDate="2013-11-22T18:32:12.477" Score="2" ViewCount="1640" Body="&lt;p&gt;I want to store a small amount of data in a sound file recorded by a microphone but I know nearly nothing about signal processing. I managed to demodulate my data encoded using binary phase shift keying with this schema:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9KzSv.png&quot; alt=&quot;Demodulation of DPSK&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(From here: &lt;a href=&quot;http://courses.cs.washington.edu/courses/cse561/10sp/project_files/FinalReport_FCI_YH.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://courses.cs.washington.edu/courses/cse561/10sp/project_files/FinalReport_FCI_YH.pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the beginning of the signal I tried searching for the time where the strength of my carrier frequency in the signal exceeds a certain threshold but this is way too unreliable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a good way to solve this?&lt;/p&gt;&#xA;" OwnerUserId="7048" LastActivityDate="2013-11-22T19:33:28.237" Title="Find beginning of signal for BPSK Demodulation" Tags="|demodulation|bpsk|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12839" PostTypeId="2" ParentId="12838" CreationDate="2013-11-22T19:33:28.237" Score="3" Body="&lt;p&gt;This problem is typically solved by preceding your actual payload data with a synchronization pattern, or &lt;a href=&quot;http://en.wikipedia.org/wiki/Syncword&quot; rel=&quot;nofollow&quot;&gt;sync word&lt;/a&gt;. This is a sequence of symbols that are known to the receiver ahead of time and are used to aid synchronization with the payload data frame. It could be detected in a couple ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sync pattern matched filtering:&lt;/strong&gt; When looking for the synchronization marker, instead of just integrating over one data bit, you could create a matched filter that represents the entire modulated sync word. This has the advantage that the SNR at the output of the sequence matched filter is higher than you would have otherwise, by a factor of the number of bits in the pattern. This can help if you're trying to detect the frame start in a very low-SNR environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disadvantages of this approach are that it is more computationally complex (because you're correlating against an entire sequence of bits), and also more sensitive to frequency offset between the transmitter and receiver.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hard decision pattern matching:&lt;/strong&gt; Instead of the &quot;soft-decoding&quot; approach of correlating against the entire modulated sync sequence, you could instead just look for the pattern's sequence of symbols at the output of your existing receiver. As an example, you could decide that all of your frames will begin with the sequence 01001100101010 (I make no warranty that this is a good choice). You would then slide through the bits that come out of your BPSK decoder and declare the start of a frame when you see the sync pattern. It may also help to allow some small number of bit errors in the pattern when looking for the sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compared to coherent integration across the entire sync sequence, this technique will not perform as well in low-SNR environments. However, it is much simpler and may work just fine for your application.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-11-22T19:33:28.237" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12841" PostTypeId="1" CreationDate="2013-11-22T20:45:36.833" Score="0" ViewCount="140" Body="&lt;p&gt;in the past couple of years I've always been using Laplace transform for system responses, but today tried to do it with Fourier transform and failed. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have a signal $x(t) = 1 + \cos(\frac{4\pi}{3}t)$ and system impulse response $h(t) = e^{-3t}u(t)$, getting $y(t)$ with $y(t) = \mathscr{F}^{-1}(X(j\omega)\cdot H(j\omega))$ should be easy, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, if we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle H(j\omega) = F(e^{-3t}u(t)) = \frac{i}{\sqrt{2\pi}(\omega + 3i)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle X(j\omega) = F(1 + \cos{(\frac{4\pi}{3} t)} = 3\sqrt{\frac{\pi}{2}} \delta(4 \pi-3 \omega)+\sqrt{2 \pi} \delta(\omega)+3 \sqrt{\frac{\pi}{2}} \delta(3 \omega+4 \pi)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The product is an ugly mess, even if we recognize that only the values at frequencies $0$, $4\pi/3$, and $-4\pi/3$ exist, and once we get the inverse Fourier transform, the time solution is complex, which cannot be right, right? :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong? &lt;/p&gt;&#xA;" OwnerUserId="4710" LastEditorUserId="4710" LastEditDate="2013-11-22T21:27:40.137" LastActivityDate="2013-11-22T21:27:40.137" Title="Fourier Transform &amp; Convolution to get response - confused" Tags="|fourier-transform|convolution|continuous-signals|frequency-response|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12842" PostTypeId="2" ParentId="12803" CreationDate="2013-11-22T21:52:58.293" Score="2" Body="&lt;p&gt;Do you need choose one chunk size, one window type, overlap percentage and of course use the matlab function FFT to returns the discrete Fourier transform, here a simple spectrogram using chunk = 2048, 50% of overlap and a hann window.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x,Fs]=wavread('ederwander.wav');&#xA;&#xA;CHUNK = 2048&#xA;OVERLAP = CHUNK / 2&#xA;&#xA;NFFT = CHUNK&#xA;&#xA;num = [CHUNK : OVERLAP :length(x)];&#xA;&#xA;SPEC = zeros( length(num), NFFT/2 );&#xA;&#xA;&#xA;for i=length(num):-1:1,&#xA;    framed = x( (num(i)-CHUNK) + 1 : num(i) );&#xA;    windowed = framed .* hann(length(framed));&#xA;    Fourrier = fft(windowed, NFFT);&#xA;    SPEC(i,:) = log(abs(Fourrier(1:NFFT/2)));&#xA;&#xA;end&#xA;&#xA;imagesc(flipud(SPEC'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a little explanation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do &lt;code&gt;windowed = framed .* hann(length(framed))&lt;/code&gt; Im applying a window over the signal, this step decreasing the amplitude component of the ends, this is used to avoid the appearance of spurious high frequency components of the Fourier transform, if you plot a Hann window you can see a  similar Gaussian format !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;CHUNK&quot; is the slice cut audio, for this example I'm getting 2048 samples, and at each slice I'm overlapping 50% of samples!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;num&quot; are the linear calc of the position when cut the signal to analyses&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2013-11-25T15:11:03.307" LastActivityDate="2013-11-25T15:11:03.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12843" PostTypeId="1" CreationDate="2013-11-22T21:57:39.230" Score="1" ViewCount="358" Body="&lt;p&gt;Is there an application where it is required to predict turning-points of a signal that&#xA;is like a sinusoid with constant frequency, variable amplitude and some noise (Gaussian additive noise)? The amplitude of the noise should be less than 10% of the amplitude of the original sinusoid every &quot;oscillation&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reason I ask is that I think I found an interesting causal filter for this very specific&#xA;situation, but I have no imagination for the moment on how it could be usefull.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My causal band-pass filter turns earlier than the turning point of the clean sinusoid, &#xA;so it's like the filter has a negative lag. And the computation time is short, less than my code using FFT (in R: statistics software).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a hobiest in DSP so please excuse my ignorance. My knowledge about filters comes mainly&#xA;from finance (econometrics).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To the man with a hammer, the entire world looks like a nail..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any suggestions.&lt;/p&gt;&#xA;" OwnerUserId="735" LastActivityDate="2017-12-08T06:36:30.077" Title="Bandpass filter on noisy sinusoid that predicts turning points" Tags="|bandpass|wave|denoising|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12844" PostTypeId="2" ParentId="12832" CreationDate="2013-11-23T01:02:23.243" Score="1" Body="&lt;p&gt;The free distance of a Trellis Coded Modulation system implemented either on BPSK or QPSK is a straightforward calculation. You'd have to compute the free distance $d_{free}$ of the convolutional code which is known as the Minimum Squared Euclidean Distance (MSED). Now, if the code has set-partitioned labeling to achieve coding gains over conventional labeling, then the minimum distance is given as $$\text{min}(d_{free},d_{ic})$$&#xA;where $d_{ic}$ is the minimum squared Intra-coset distance which can be calculated from the mapping. Having said this, the MSED of the convolutional code can be computed the same way its $d_f$ (the hamming free distance) is computed. You need to do a trellis search and replace hamming weights with squared euclidean minimum distances with the all zero-sequence mapping (this is valid because any convolutional code is linear and if the mapping is BPSK or QPSK, every symbol has a decoding Voronoi region that has the same area and the same shape as every other sequence). I believe you've implemented your trellis search perfectly. Having said this, the Ungerboeck code cannot be performing better than a code which has a higher Euclidean $d_{min}$. Suggestions: &lt;br&gt; 1. Either you're computing one of the distances wrongly&lt;br&gt;2. Are you sure about the minimum distance of the Ungerboeck code?&lt;br&gt;&lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2013-11-23T01:02:23.243" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12845" PostTypeId="1" AcceptedAnswerId="12848" CreationDate="2013-11-23T01:03:12.897" Score="0" ViewCount="80" Body="&lt;p&gt;I am doing my final year project on Image Processing.I want to know about the Support Vector Machine.Please suggest some links for the former.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and regards in Advance&lt;/p&gt;&#xA;" OwnerUserId="6941" LastActivityDate="2013-11-23T08:14:52.450" Title="Online materials on Support Vector Machine" Tags="|image-processing|algorithms|" AnswerCount="1" CommentCount="1" ClosedDate="2013-11-24T16:57:01.490" ContentLicense="CC BY-SA 3.0" />
  <row Id="12846" PostTypeId="2" ParentId="12825" CreationDate="2013-11-23T04:46:28.230" Score="2" Body="&lt;p&gt;Each SIFT descriptor corresponds to a region of the image. You take these from a bunch of images and group them into some number of clusters. I think what he's showing in the slide there is just a few samples from each cluster where he chose human-meaningful names for the clusters after the fact.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-11-23T04:46:28.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12847" PostTypeId="2" ParentId="12807" CreationDate="2013-11-23T06:29:57.733" Score="2" Body="&lt;p&gt;Alright, I'll try to take a shot at giving you an explanation of what's going on with the DWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the CWT, basically what you are doing is you are generating the wavelet coefficients by convolving the signal with each scale and shift of the mother wavelet function. However, the problem with doing this is that when you analyze the low frequency components of the signal, you are oversampling, or performing the wavelet analysis too often. Also, the relationship between time and frequency localization is much like the relationship between velocity and position localization in quantum mechanics, and when you perform the CWT this inequality is violated for some time/frequency scales. Essentially, with regard to the CWT, the transform is redundant at low frequency scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the DWT doesn't have this problem because the DWT effectively &lt;em&gt;downsamples&lt;/em&gt; the signal at each level. The DWT is basically just two filters, a highpass and a lowpass filter. The highpass filter produces the &quot;detail&quot; coefficients, and the lowpass filter produces the &quot;average&quot; coefficients. However, keep in mind that calculating the moving average of a signal &lt;em&gt;is a form of lowpass filtering&lt;/em&gt;. Thus when we perform the lowpass filter and get the &quot;average&quot; DWT coefficients, those coefficients are basically just the low frequency components of the signal. And, since we know they are lower in frequency, we know that in the digital case we need less data points to represent a signal lower frequencies. The lowpass and highpass filtering is then repeated for each level of the DWT that can be computed. The level is dependent on the length of the signal. If a signal has $$k$$ data points, where $$k = 2^N$$&#xA;then the DWT can be computed to &lt;code&gt;N&lt;/code&gt; levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try to give a real life example. Lets say you have a signal of 1024 samples, sampled at a rate of $$4\pi \text{ Hz.}$$ Based on the Nyquist criterion, the highest frequency that can be resolved by the signal is $$2\pi \text{ Hz.}$$Computing the first level of the DWT will result in two vectors, each of length 512. One is from the highpass filter, the other from the lowpass (these vectors are sometimes called high/lowpass filter banks). The highpass coefficients are the &lt;code&gt;cD1&lt;/code&gt; coefficients, representing frequencies in the range of one to two pi, and the lowpass coefficients are the &lt;code&gt;cA1&lt;/code&gt; coefficients representing frequencies in the range of zero to one pi. The DWT is applied again to the lowpass coefficients resulting in two vectors each of length 256, and this time the lowpass filter bank represents frequencies in the range 0 to 1/2 pi. This process is repeated 10 times (for this case, 2^10 = 1024), as the last time will result in lowpass and highpass filter banks each of length 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically at higher scales of the DWT, we get better frequency resolution, but poorer time resolution. Lower scales have better time resolution but poorer frequency resolution. I'll also give you the link to a good tutorial on this stuff by Polikar : &lt;a href=&quot;http://person.hst.aau.dk/enk/ST8/wavelet_tutotial.pdf&quot; rel=&quot;nofollow&quot;&gt;http://person.hst.aau.dk/enk/ST8/wavelet_tutotial.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To reconstruct the signal, simply apply the inverse DWT for the number of levels which you want to reconstruct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Forgot to mention that the FFT is not needed, you are already filtering based on frequencies.&lt;/p&gt;&#xA;" OwnerUserId="6944" LastActivityDate="2013-11-23T06:29:57.733" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="12848" PostTypeId="2" ParentId="12845" CreationDate="2013-11-23T08:14:52.450" Score="1" Body="&lt;p&gt;Video Lectures : &lt;a href=&quot;http://nptel.iitm.ac.in/courses/117108048/&quot; rel=&quot;nofollow&quot;&gt;http://nptel.iitm.ac.in/courses/117108048/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes : &lt;a href=&quot;http://www.nptel.iitm.ac.in/courses/106108057/&quot; rel=&quot;nofollow&quot;&gt;http://www.nptel.iitm.ac.in/courses/106108057/&lt;/a&gt; (Read from Lesson 25. These notes helped me very much)&lt;/p&gt;&#xA;" OwnerUserId="818" LastActivityDate="2013-11-23T08:14:52.450" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12849" PostTypeId="1" AcceptedAnswerId="12884" CreationDate="2013-11-23T12:00:07.797" Score="0" ViewCount="204" Body="&lt;p&gt;I'm studying book about digital filter by Richard Hamming. And there is exercise to get odd and even expansion of g(x)=x where x is from 0 to $\pi$. I understood even expansion, but can't get into odd expansion:&#xA;$\pi$ - $2$*(${\rm sin} x$ +  $\frac{1}{2}$${\rm sin} 2x$ + $\frac{1}{3}$${\rm sin} 3x$...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody explain odd expansion of this function g(x)=x?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&#xA;Let me be more clear. The exersise is: show that g(x) = x has two expansions (0 &amp;lt; x &amp;lt; $\pi$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x$ =$\begin{cases}\pi - 2*(\sin(x)+\sin(2x)/2+\sin(3x)/3+...)&#xA;\\\pi/2 - 4/\pi*(\cos(x)+\cos(3x)/3^2+\cos(5x)/5^2+...)\end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I merely understand cosine expansion, but I don't understand sine expansion...&lt;/p&gt;&#xA;" OwnerUserId="7052" LastEditorUserId="7052" LastEditDate="2013-11-25T21:42:44.997" LastActivityDate="2013-11-26T02:22:49.063" Title="g(x)=x odd and even expansions" Tags="|fourier-series|fourier|digital|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12851" PostTypeId="1" AcceptedAnswerId="12855" CreationDate="2013-11-23T16:02:05.470" Score="0" ViewCount="124" Body="&lt;p&gt;I was given this question on a job interview and think I really messed up. I was wondering how others would go about it so I could learn from this experience.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You have one image from a surveillance video located at an airport which includes line of people waiting for check-in. You have to assess if the line is big/crowded and therefore additional clerks are necessary. You can assume anything that may help your answer. What would you do? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I told them I would try to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Segment the area containing people from the rest by edge detection&lt;/li&gt;&#xA;&lt;li&gt;Use assumptions on body contour such as relative height/width to denoise unwanted edges&lt;/li&gt;&#xA;&lt;li&gt;Use color knowledge; but then they asked how to do that and I didn't know&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7054" LastEditorUserId="76" LastEditDate="2013-11-24T15:56:25.537" LastActivityDate="2013-11-24T15:56:25.537" Title="Image processing on a surveillance image" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12852" PostTypeId="1" AcceptedAnswerId="12854" CreationDate="2013-11-23T21:19:03.357" Score="0" ViewCount="260" Body="&lt;p&gt;With a signal &lt;code&gt;x&lt;/code&gt; of length $2^{16}$,  the DWT (computed for example with pyWavelet's &lt;code&gt;wavedec&lt;/code&gt;) has only 16 or 17 rows (the wavelet &lt;em&gt;scale&lt;/em&gt; is dyadic).&#xA;Is there a DWT with more scales? (ex : 1024 rows instead of 16!)&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2013-11-24T02:30:47.073" Title="DWT with more precise scale" Tags="|discrete-signals|wavelet|python|time-frequency|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12853" PostTypeId="2" ParentId="12774" CreationDate="2013-11-24T02:19:10.257" Score="1" Body="&lt;p&gt;For the CWT the values in your definition can be any $a\in \mathbb R^+$ and $b\in \mathbb R$ if applied to functions. The CWT can also be applied to discrete signals (discretized CWT) with $b$ restricted to appropriate discrete values (and any $a$, but typically $2^{j/v}$ where $v$ is the &quot;voices/octave&quot; of the transformation). Now when we restrict $a$ to some discrete values $2^j$ we get the DWT, which is an orthogonal transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Small edit to correct the scale : $2^{j/v}$ instead of $a^{j/v}$)&lt;/p&gt;&#xA;" OwnerUserId="7058" LastEditorUserId="5648" LastEditDate="2013-11-24T16:35:35.640" LastActivityDate="2013-11-24T16:35:35.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12854" PostTypeId="2" ParentId="12852" CreationDate="2013-11-24T02:30:47.073" Score="2" Body="&lt;p&gt;You will need to use a continues wavelet transform (cwt) where you can specify the resolution of the scales (as done in the image you posted mathworks.fr/help/releases/R2013b/wavelet/ref/cwt.gif). The DWT only has $J$ scales by definition for $2^J$ signals.&lt;/p&gt;&#xA;" OwnerUserId="7058" LastActivityDate="2013-11-24T02:30:47.073" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12855" PostTypeId="2" ParentId="12851" CreationDate="2013-11-24T10:53:46.890" Score="0" Body="&lt;p&gt;Thanks for sharing your experience. It's a bit off-topic, but my my first advice for a job interview would be to check the company's technology and products. This usually helps a lot in finding answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this general case of crowd surveillance in a closed place, I would check the following items first:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;get a reference image of the empty location in order to be able to detect people's location (even inaccurate) by background subtraction. This gives a rough estimate of the queue length;&lt;/li&gt;&#xA;&lt;li&gt;check if the camera is facing the line, in which case I would run a face detector to get an approximate count of people in line. This provides a second estimate;&lt;/li&gt;&#xA;&lt;li&gt;if necessary, learn (from the detected faces) the skin color in the image, then again segment the image based on skin color.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are more advanced techniques available, but I think it would be overkill here.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-11-24T10:53:46.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12856" PostTypeId="1" CreationDate="2013-11-24T12:35:28.493" Score="2" ViewCount="165" Body="&lt;p&gt;I'm recently doing research on &lt;a href=&quot;https://en.wikipedia.org/wiki/Electromagnetic_interference&quot; rel=&quot;nofollow&quot;&gt;EMI&lt;/a&gt;, and I want to seperate the mixing signals. However, the data given is in frequency domain. As I have used &lt;a href=&quot;https://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow&quot;&gt;ICA&lt;/a&gt; to solve blind source separation problem in time domain, can this be used to solve &lt;a href=&quot;https://en.wikipedia.org/wiki/Blind_signal_separation&quot; rel=&quot;nofollow&quot;&gt;BSS&lt;/a&gt; in frequency domain? And how? I can not imagine how this would work. I would appreciate if you could provide me some extra materials on this subjects!&lt;/p&gt;&#xA;" OwnerUserId="7059" LastEditorUserId="29" LastEditDate="2013-11-26T15:25:49.553" LastActivityDate="2013-11-26T15:25:49.553" Title="Can ICA be applied to solve BSS problem in frequency domain?" Tags="|signal-analysis|ica|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12857" PostTypeId="2" ParentId="12675" CreationDate="2013-11-24T13:12:44.197" Score="2" Body="&lt;p&gt;I guess this depends on the digital distance transform that one is approximating on the 3d grid and there are various local connectivities &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S107731429690065X&quot; rel=&quot;nofollow noreferrer&quot;&gt;possible&lt;/a&gt;. There is an implementation in ImageJ &lt;a href=&quot;http://fiji.sc/Distance_Transform_3D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would also be good to verify if you are using a non-flat structuring element or a correct 3d structuring element. Read &lt;a href=&quot;http://www.mathworks.com/matlabcentral/answers/98729&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab&lt;/a&gt; reference here. In the place of euclidean distance &lt;em&gt;sqrt(x.^2 + y.^2 + z.^2)&lt;/em&gt; one could add the Manhattan distance using &lt;a href=&quot;http://heuristicswiki.wikispaces.com/3D+Manhattan+distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;. Quick 3d distance &lt;a href=&quot;https://stackoverflow.com/questions/3693514/very-fast-3d-distance-check&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 3d structuring element decomposition one can &lt;a href=&quot;http://link.springer.com/chapter/10.1007%2F11556121_79&quot; rel=&quot;nofollow noreferrer&quot;&gt;see&lt;/a&gt;. But the 3d decompositions of a convex shapes like sphere into separable 2d lines is non-trivial, certain shapes are easier than others like the cube. One can refer &lt;a href=&quot;http://ismm.dpi.inpe.br/col/dpi.inpe.br/ismm@80/2007/03.20.04.48/doc/ISMM2007fullpaper/fullpaper.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for efficient algorithms for spheres.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-11-24T13:12:44.197" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12858" PostTypeId="2" ParentId="10597" CreationDate="2013-11-24T13:32:22.033" Score="4" Body="&lt;p&gt;I guess the basic question here becomes - what difference does non-flat structuring elements make w.r.t flat structuring elements ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the definition of dilation one can see that the structuring element can define a support (like in flat structuring elements) or another function itself (gray scale structuring elements). Look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Dilation_%28morphology%29&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt; which defines the dilation operations. The &lt;a href=&quot;http://www.mmorph.com/html/morph/mmdil.html&quot; rel=&quot;nofollow&quot;&gt;grayscale&lt;/a&gt; or numerical version performs a Minkowski Sum. The dilation operation here basically looks for the max on the sum of the two functions. With grayscale dimension one is basically looking at the topographical features of the image level. Its called the rolling ball algorithm since it shaves off non smooth parts of the image which are less convex that the sphere structuring element one defines. The top hat is non flat and basically removes features in each level set and has no effect on the topographical height directly. It depends on the image and problem how these 2 operations are used. One can also write structuring elements to look for connected maximas or minimas(Jump connection), smooth regions(Smooth Connection) &lt;a href=&quot;http://cmm.ensmp.fr/~serra/communications_pdf/C-75.pdf&quot; rel=&quot;nofollow&quot;&gt;refer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastActivityDate="2013-11-24T13:32:22.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12859" PostTypeId="2" ParentId="9347" CreationDate="2013-11-24T17:27:19.747" Score="0" Body="&lt;p&gt;You probably have answers since May, but here are a couple of comments anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several related questions:&lt;br&gt;&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/9251/fft-for-a-specific-frequency-range&quot;&gt;FFT-for-a-specific-frequency-range&lt;/a&gt;&#xA;mentions&lt;br&gt;&#xA;$\quad$&lt;a href=&quot;http://arc.id.au/ZoomFFT.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;ZoomFFT&lt;/a&gt; &amp;mdash; a clear 9-page tutorial, with nice pictures&lt;br&gt;&#xA;$\quad$chirp-DFT like a magnifying glass for a certain frequency range&lt;br&gt;&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/129/how-can-i-compute-a-log-spaced-power-spectrum&quot;&gt;how-can-i-compute-a-log-spaced-power-spectrum&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;A quite different method is to make a matrix with columns sin-cos&#xA;on a fine grid of frequencies&#xA;$$\quad\quad A = [&#xA;\cos\ (2 \pi\, f_0),&#xA;\sin\ (2 \pi\, f_0),&#xA;\cos\ (2 \pi\, f_1),&#xA;\sin\ (2 \pi\, f_1) ... ]$$&#xA;and solve&#xA;$\quad A x = \text{data}\quad $  by least squares.&lt;br&gt;&#xA;Some advantages of this approach:&lt;br&gt;&#xA;a) you can choose any frequency grid you like,&#xA;   and any basis you like: sin-cos, wavelets ...&lt;br&gt;&#xA;b) simple to program, a tiny wrapper around SVD&lt;br&gt;&#xA;c) SVD is &lt;strong&gt;robust&lt;/strong&gt;&lt;br&gt;&#xA;d) it's easy to add smoothing constraints, i.e. regularize $x$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disadvantages ? don't know &amp;mdash; experts please comment.&#xA;It does seem to be well-known to those who know it well:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Least-squares_spectral_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Least-squares spectral analysis&lt;/a&gt;&#xA;has links to 20-odd papers and books, sigh.&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-11-26T09:57:15.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12860" PostTypeId="1" AcceptedAnswerId="12864" CreationDate="2013-11-24T18:46:57.417" Score="2" ViewCount="101" Body="&lt;p&gt;Which signals or set of signals is the most predictable or in other words most self-correlated (autocorrelation)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think one of them is $x(t)=c$, for all $t$, where $c$ is a scalar constant. The other one can be $x(t)=c$, for $t=t_0$ and $x(t)=0$, otherwise (a discrete signal with only one value). $t_0$ is a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://books.google.com/books?id=LmQ7ZR2ijp0C&amp;amp;pg=PA19&amp;amp;lpg=PA19&quot; rel=&quot;nofollow&quot; title=&quot;Moreau, Nicolas, Tools for Signal Compression: Applications to Speech and Audio Coding, page 19. In Google books.&quot;&gt;Here&lt;/a&gt; the book says: &quot;the most predictable signal&quot; is the sum of discrete cosine functions with random phases. Why? My two examples above seem to me more predictable!&lt;/p&gt;&#xA;" OwnerUserId="7064" LastEditorUserId="76" LastEditDate="2013-11-24T20:47:08.897" LastActivityDate="2013-11-25T20:52:00.743" Title="What is the set of most predictable or in other words most self-correlated signals?" Tags="|autocorrelation|estimation|correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12861" PostTypeId="1" CreationDate="2013-11-24T19:19:30.490" Score="-1" ViewCount="587" Body="&lt;p&gt;I have a sinusoidal time domain signal with few damped exponential components.&lt;br&gt;&#xA;i.e.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fn=[0.4 0.6 1.0];E=[0.03 0.05 0.1];A=[1.0 2.0 3.0];&#xA;wn=2*pi.*fn;a=E.*wn;wd=wn.*sqrt(1-E.^2); &#xA;x=A(1)*exp(-a(1)*t).*sin(wd(1)*t)+A(2)*exp(-a(2)*t).*...&#xA;sin(wd(2)*t)+A(3)*exp(-a(3)*t).*sin(wd(3)*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I extract the damping ratios and frequency components of this signal by &lt;strong&gt;Prony&lt;/strong&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Your help is much appreciated.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2014-05-02T17:02:18.057" LastActivityDate="2014-07-31T18:04:13.253" Title="Frequency and damping estimation with Prony method?" Tags="|frequency|estimation|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12862" PostTypeId="1" AcceptedAnswerId="12863" CreationDate="2013-11-24T20:05:37.097" Score="8" ViewCount="2641" Body="&lt;p&gt;I started a DSP course online and quickly discovered that as much as some people say that it is possible to avoid the more advanced mathematics of signal processing, this didn't seem the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like a solid understanding of Calculus and Probability Theory is needed to properly grasp the subject and to be able to be creative with it in the audio field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which parts of Calculus are mainly used for dsp? Are there any parts than can be excluded?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2013-11-24T20:28:56.057" LastActivityDate="2013-11-24T21:25:59.367" Title="Prerequisites for audio signal processing" Tags="|audio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12863" PostTypeId="2" ParentId="12862" CreationDate="2013-11-24T21:10:33.073" Score="15" Body="&lt;p&gt;DSP is indeed a very mathematical discipline, but not completely. The amount of mathematical knowledge you need to operate DSP concepts comfortably is luckily limited to a particular fairly small subset. I would say that you need the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Complex variables&lt;/strong&gt;. DSP deals with oscillating signals and systems, and those are very conveniently represented using &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula&quot;&gt;Euler's complex exponential formulas&lt;/a&gt;. This includes knowledge of polynomials over complex variables, and so on.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Simple differential calculus&lt;/strong&gt;. I would say that you need to know how to take derivatives of polynomials and other common functions such as exponentials and logarithms. Knowing &lt;a href=&quot;https://en.wikipedia.org/wiki/L%27H%C3%B4pital%27s_rule&quot;&gt;l'Hôpital's rule&lt;/a&gt; also occasionally comes in handy. Taking derivatives is primarily required for &lt;a href=&quot;http://www.math.hmc.edu/calculus/tutorials/extrema/&quot;&gt;finding minima and maxima&lt;/a&gt; of functions. Note that you need to be able to do this for complex variables as well, but at this stage there is practically no difference in concepts between real and complex differentiation.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Linear algebra&lt;/strong&gt;. I put linear algebra before integration because it is much more useful, and since integration is a linear operation, a lot of it can be replaced by linear algebra concepts. I can't exaggerate how important linear algebra is, so go and learn it. I highly recommend Gilbert's &lt;a href=&quot;http://ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/video-lectures/&quot;&gt;MIT Open Courseware linear algebra&lt;/a&gt; class. No one teaches it better than this guy. Just watch the lectures.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Integral calculus&lt;/strong&gt;. I'm not quite sure how to approach describing the importance of integration in DSP. If linear algebra was a moderately easy, fun and useful topic to learn, integration, especially complex integration, takes a lot of commitment and intuition, both of which require lots of time. Even though I usually advocate for in-depth mathematical knowledge, here's what you can very easily get away with. Learn about integration concepts, what it means and how integration is related to derivatives. Since most integrals are difficult to work out by hand, people use &lt;a href=&quot;http://integral-table.com/&quot;&gt;integration tables&lt;/a&gt; to look up answers instead. This will get you through most integration you need to know for DSP.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Infinite series&lt;/strong&gt;. This is the one part of calculus that everyone forgets the minute they take that final exam, but it actually comes in handy in DSP. Specifically, when analyzing recursive systems, i.e. those that take their output and reuse it as input creating a feedback loop, you need to be able to spot several types of infinite number patterns that appear and point to a single formula that produces every single term in that infinite string of numbers or polynomial coefficients.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Probability&lt;/strong&gt;. I hesitate a little to write about this one, because not all DSP courses strictly require probability, but if the one you're looking at does, it wouldn't hurt to know it. Not be be lost, you need to know expressions and concepts of means and variances, as well as &lt;a href=&quot;http://betterexplained.com/articles/an-intuitive-and-short-explanation-of-bayes-theorem/&quot;&gt;Bayes' rule&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Obviously, what I've given above are the minimal requirements, but you may need to learn more as you go.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2013-11-24T21:25:59.367" LastActivityDate="2013-11-24T21:25:59.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12864" PostTypeId="2" ParentId="12860" CreationDate="2013-11-24T21:20:26.747" Score="3" Body="&lt;p&gt;Sums of discrete cosines are good candidates because they're bound to repeat after a finite number of samples. In fact,  anything that repeats after some finite number of samples is the most predictable thing in the world because you can predict the entire thing from just a handful of samples. In fact, the converse of this statement is true, i.e. anything that repeats after a finite number of samples can be written down as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_cosine_transform&quot; rel=&quot;nofollow&quot;&gt;sum of discrete cosines&lt;/a&gt; with different phases. In fact, so can your own candidate:&#xA;$$c = \sum_{k=0}^{\infty}c_k\cos(\omega_k + \phi_k)$$&#xA;where $c_k=c\delta(k)$, $\omega_0=0$, $\phi_0=0$. In other words a constant signal is just a cosine of zero frequency. So there's no tautology here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may say of course, that your example is still better, but if we're trying to establish &lt;em&gt;classes&lt;/em&gt; of predictability, then both your example and the generic form fall into the same class. I don't see a contradiction here.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2013-11-25T20:52:00.743" LastActivityDate="2013-11-25T20:52:00.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12865" PostTypeId="2" ParentId="12861" CreationDate="2013-11-24T21:22:07.833" Score="0" Body="&lt;p&gt;A quick Google search reveals the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/3955-prony-toolbox&quot; rel=&quot;nofollow&quot;&gt;Prony Toolbox&lt;/a&gt; on Mathworks file exchange.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2013-11-24T21:22:07.833" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12869" PostTypeId="1" CreationDate="2013-11-25T10:13:05.270" Score="1" ViewCount="55" Body="&lt;p&gt;i want to understand ,how to find out Discrete wavelet transform of image 4 by 4 size using Haar wavelet on paper ?&lt;/p&gt;&#xA;" OwnerUserId="7072" LastActivityDate="2024-04-03T16:01:45.220" Title="Need to understand how wavelet is applied on Image matrix?" Tags="|wavelet|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12871" PostTypeId="1" CreationDate="2013-11-25T17:48:40.973" Score="2" ViewCount="734" Body="&lt;p&gt;My requirements are these:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fast classification of vectors of length 100 to one of 30000 classes&lt;/li&gt;&#xA;&lt;li&gt;Iterative learning (can improve the model after it was first learnt)&lt;/li&gt;&#xA;&lt;li&gt;Preferably available implementations in Matlab and Java&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="519" LastEditorUserId="7338" LastEditDate="2015-08-15T11:27:09.573" LastActivityDate="2018-01-02T13:37:35.283" Title="What's a good classification algorithm for a large amount of classes?" Tags="|classification|machine-learning|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12872" PostTypeId="1" CreationDate="2013-11-25T19:28:16.660" Score="2" ViewCount="3877" Body="&lt;p&gt;I am doing a project on panoramic stitching of Images using Emgu CV (Open CV for C#). Till now I have done some work that stitches images but the output is kinda weird. This is what I am getting: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My panorama:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/N7S70.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what the Emgu CV Stitcher.stitch method gives: &#xA;Stiched by inbuilt stitcher&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YSbER.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly I am missing something. Moreover if I add more images, the output gets more stretchy like this one: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R6wrf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not able to figure out what am i missing. Here is my code till now: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://pastebin.com/Ke2Zz4m9&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/Ke2Zz4m9&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using System;&#xA;using System.Collections.Generic;&#xA;using System.ComponentModel;&#xA;using System.Data;&#xA;using System.Drawing;&#xA;using System.Linq;&#xA;using System.Text;&#xA;using System.Threading.Tasks;&#xA;using System.Windows.Forms;&#xA;using Emgu.CV;&#xA;using Emgu.CV.CvEnum;&#xA;using Emgu.CV.Features2D;&#xA;using Emgu.CV.Structure;&#xA;using Emgu.CV.UI;&#xA;using Emgu.CV.Util;&#xA;using Emgu.CV.GPU;&#xA;&#xA;&#xA;namespace Project&#xA;{&#xA;    public partial class Form1 : Form&#xA;    {&#xA;        public Form1()&#xA;        {&#xA;            InitializeComponent();&#xA;        }&#xA;&#xA;        private void Form1_Load(object sender, EventArgs e)&#xA;        {&#xA;            Image&amp;lt;Bgr, float&amp;gt; one = new Image&amp;lt;Bgr, float&amp;gt;(&quot;D:\\Venice_panorama_part_01.jpg&quot;);&#xA;            Image&amp;lt;Bgr, float&amp;gt; two = new Image&amp;lt;Bgr, float&amp;gt;(&quot;D:\\Venice_panorama_part_02.jpg&quot;);&#xA;            Image&amp;lt;Bgr, float&amp;gt; third = new Image&amp;lt;Bgr, float&amp;gt;(&quot;D:\\Venice_panorama_part_03.jpg&quot;);&#xA;            Image&amp;lt;Bgr, float&amp;gt; fourth = new Image&amp;lt;Bgr, float&amp;gt;(&quot;D:\\Venice_panorama_part_04.jpg&quot;);&#xA;            Image&amp;lt;Bgr, float&amp;gt; fifth = new Image&amp;lt;Bgr, float&amp;gt;(&quot;D:\\Venice_panorama_part_05.jpg&quot;);&#xA;            Image&amp;lt;Bgr, float&amp;gt; sixth = new Image&amp;lt;Bgr, float&amp;gt;(&quot;D:\\Venice_panorama_part_06.jpg&quot;);&#xA;            Image&amp;lt;Bgr, float&amp;gt; seventh = new Image&amp;lt;Bgr, float&amp;gt;(&quot;D:\\Venice_panorama_part_07.jpg&quot;);&#xA;            Image&amp;lt;Bgr, float&amp;gt; eighth = new Image&amp;lt;Bgr, float&amp;gt;(&quot;D:\\Venice_panorama_part_08.jpg&quot;);&#xA;&#xA;&#xA;&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; result = FindMatch(two, third);&#xA;            result = convert(result);&#xA;            Image&amp;lt;Bgr, float&amp;gt; twoPlusThree = result.Convert&amp;lt;Bgr, float&amp;gt;();&#xA;&#xA;&#xA;&#xA;&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; result2 = FindMatch(fourth, fifth);&#xA;            result2 = convert(result2);&#xA;            Image&amp;lt;Bgr, float&amp;gt; fourPlusFive = result2.Convert&amp;lt;Bgr, float&amp;gt;();&#xA;&#xA;&#xA;&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; result3 = FindMatch(sixth, seventh);&#xA;            result3 = convert(result3);&#xA;            Image&amp;lt;Bgr, float&amp;gt; sixPlusSeven = result3.Convert&amp;lt;Bgr, float&amp;gt;();&#xA;&#xA;&#xA;&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; result4 = FindMatch(one, twoPlusThree);&#xA;            result4 = convert(result4);&#xA;            Image&amp;lt;Bgr, float&amp;gt; oneTwoThree = result4.Convert&amp;lt;Bgr, float&amp;gt;();&#xA;&#xA;&#xA;&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; result5 = FindMatch(oneTwoThree, fourPlusFive);&#xA;            result5 = convert(result5);&#xA;            Image&amp;lt;Bgr, float&amp;gt; oneTwoThreeFourFive = result5.Convert&amp;lt;Bgr, float&amp;gt;();&#xA;&#xA;&#xA;&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; result6 = FindMatch(sixPlusSeven, eighth);&#xA;            result6 = convert(result6);&#xA;            Image&amp;lt;Bgr, float&amp;gt; sixSevenEigth = result6.Convert&amp;lt;Bgr, float&amp;gt;();&#xA;&#xA;&#xA;&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; result7 = FindMatch(oneTwoThreeFourFive, sixSevenEigth);&#xA;&#xA;            result7 = convert(result7);&#xA;&#xA;            result.Save(&quot;D:\\result1.jpg&quot;);&#xA;            result2.Save(&quot;D:\\result2.jpg&quot;);&#xA;            result3.Save(&quot;D:\\result3.jpg&quot;);&#xA;            result4.Save(&quot;D:\\result4.jpg&quot;);&#xA;            result5.Save(&quot;D:\\result5.jpg&quot;);&#xA;            result6.Save(&quot;D:\\result6.jpg&quot;);&#xA;            result7.Save(&quot;D:\\result7.jpg&quot;);&#xA;            this.Close();&#xA;&#xA;        }&#xA;&#xA;        public static Image&amp;lt;Bgr, Byte&amp;gt; FindMatch(Image&amp;lt;Bgr, float&amp;gt; fImage, Image&amp;lt;Bgr, float&amp;gt; lImage)&#xA;        {&#xA;            HomographyMatrix homography = null;&#xA;            SURFDetector surfCPU = new SURFDetector(500, false);&#xA;&#xA;&#xA;            int k = 2;&#xA;            double uniquenessThreshold = 0.8;&#xA;            Matrix&amp;lt;int&amp;gt; indices;&#xA;&#xA;            Matrix&amp;lt;byte&amp;gt; mask;&#xA;&#xA;            VectorOfKeyPoint modelKeyPoints;&#xA;            VectorOfKeyPoint observedKeyPoints;&#xA;            Image&amp;lt;Gray, Byte&amp;gt; fImageG = fImage.Convert&amp;lt;Gray, Byte&amp;gt;();&#xA;            Image&amp;lt;Gray, Byte&amp;gt; lImageG = lImage.Convert&amp;lt;Gray, Byte&amp;gt;();&#xA;&#xA;            if (GpuInvoke.HasCuda)&#xA;            {&#xA;                GpuSURFDetector surfGPU = new GpuSURFDetector(surfCPU.SURFParams, 0.01f);&#xA;                using (GpuImage&amp;lt;Gray, Byte&amp;gt; gpuModelImage = new GpuImage&amp;lt;Gray, byte&amp;gt;(fImageG))&#xA;                //extract features from the object image&#xA;                using (GpuMat&amp;lt;float&amp;gt; gpuModelKeyPoints = surfGPU.DetectKeyPointsRaw(gpuModelImage, null))&#xA;                using (GpuMat&amp;lt;float&amp;gt; gpuModelDescriptors = surfGPU.ComputeDescriptorsRaw(gpuModelImage, null, gpuModelKeyPoints))&#xA;                using (GpuBruteForceMatcher&amp;lt;float&amp;gt; matcher = new GpuBruteForceMatcher&amp;lt;float&amp;gt;(DistanceType.L2))&#xA;                {&#xA;                    modelKeyPoints = new VectorOfKeyPoint();&#xA;                    surfGPU.DownloadKeypoints(gpuModelKeyPoints, modelKeyPoints);&#xA;&#xA;                    // extract features from the observed image&#xA;                    using (GpuImage&amp;lt;Gray, Byte&amp;gt; gpuObservedImage = new GpuImage&amp;lt;Gray, byte&amp;gt;(lImageG))&#xA;                    using (GpuMat&amp;lt;float&amp;gt; gpuObservedKeyPoints = surfGPU.DetectKeyPointsRaw(gpuObservedImage, null))&#xA;                    using (GpuMat&amp;lt;float&amp;gt; gpuObservedDescriptors = surfGPU.ComputeDescriptorsRaw(gpuObservedImage, null, gpuObservedKeyPoints))&#xA;                    using (GpuMat&amp;lt;int&amp;gt; gpuMatchIndices = new GpuMat&amp;lt;int&amp;gt;(gpuObservedDescriptors.Size.Height, k, 1, true))&#xA;                    using (GpuMat&amp;lt;float&amp;gt; gpuMatchDist = new GpuMat&amp;lt;float&amp;gt;(gpuObservedDescriptors.Size.Height, k, 1, true))&#xA;                    using (GpuMat&amp;lt;Byte&amp;gt; gpuMask = new GpuMat&amp;lt;byte&amp;gt;(gpuMatchIndices.Size.Height, 1, 1))&#xA;                    using (Stream stream = new Stream())&#xA;                    {&#xA;                        matcher.KnnMatchSingle(gpuObservedDescriptors, gpuModelDescriptors, gpuMatchIndices, gpuMatchDist, k, null, stream);&#xA;                        indices = new Matrix&amp;lt;int&amp;gt;(gpuMatchIndices.Size);&#xA;                        mask = new Matrix&amp;lt;byte&amp;gt;(gpuMask.Size);&#xA;&#xA;                        //gpu implementation of voteForUniquess&#xA;                        using (GpuMat&amp;lt;float&amp;gt; col0 = gpuMatchDist.Col(0))&#xA;                        using (GpuMat&amp;lt;float&amp;gt; col1 = gpuMatchDist.Col(1))&#xA;                        {&#xA;                            GpuInvoke.Multiply(col1, new MCvScalar(uniquenessThreshold), col1, stream);&#xA;                            GpuInvoke.Compare(col0, col1, gpuMask, CMP_TYPE.CV_CMP_LE, stream);&#xA;                        }&#xA;&#xA;                        observedKeyPoints = new VectorOfKeyPoint();&#xA;                        surfGPU.DownloadKeypoints(gpuObservedKeyPoints, observedKeyPoints);&#xA;&#xA;                        //wait for the stream to complete its tasks&#xA;                        //We can perform some other CPU intesive stuffs here while we are waiting for the stream to complete.&#xA;                        stream.WaitForCompletion();&#xA;&#xA;                        gpuMask.Download(mask);&#xA;                        gpuMatchIndices.Download(indices);&#xA;&#xA;                        if (GpuInvoke.CountNonZero(gpuMask) &amp;gt;= 4)&#xA;                        {&#xA;                            int nonZeroCount = Features2DToolbox.VoteForSizeAndOrientation(modelKeyPoints, observedKeyPoints, indices, mask, 1.5, 20);&#xA;                            if (nonZeroCount &amp;gt;= 4)&#xA;                                homography = Features2DToolbox.GetHomographyMatrixFromMatchedFeatures(modelKeyPoints, observedKeyPoints, indices, mask, 2);&#xA;                        }&#xA;&#xA;                    }&#xA;                }&#xA;            }&#xA;            else&#xA;            {&#xA;&#xA;&#xA;&#xA;                //extract features from the object image&#xA;                modelKeyPoints = new VectorOfKeyPoint();&#xA;                Matrix&amp;lt;float&amp;gt; modelDescriptors = surfCPU.DetectAndCompute(fImageG, null, modelKeyPoints);&#xA;&#xA;&#xA;                // extract features from the observed image&#xA;                observedKeyPoints = new VectorOfKeyPoint();&#xA;                Matrix&amp;lt;float&amp;gt; observedDescriptors = surfCPU.DetectAndCompute(lImageG, null, observedKeyPoints);&#xA;                BruteForceMatcher&amp;lt;float&amp;gt; matcher = new BruteForceMatcher&amp;lt;float&amp;gt;(DistanceType.L2);&#xA;                matcher.Add(modelDescriptors);&#xA;&#xA;                indices = new Matrix&amp;lt;int&amp;gt;(observedDescriptors.Rows, k);&#xA;                using (Matrix&amp;lt;float&amp;gt; dist = new Matrix&amp;lt;float&amp;gt;(observedDescriptors.Rows, k))&#xA;                {&#xA;                    matcher.KnnMatch(observedDescriptors, indices, dist, k, null);&#xA;                    mask = new Matrix&amp;lt;byte&amp;gt;(dist.Rows, 1);&#xA;                    mask.SetValue(255);&#xA;                    Features2DToolbox.VoteForUniqueness(dist, uniquenessThreshold, mask);&#xA;                }&#xA;&#xA;                int nonZeroCount = CvInvoke.cvCountNonZero(mask);&#xA;                if (nonZeroCount &amp;gt;= 4)&#xA;                {&#xA;                    nonZeroCount = Features2DToolbox.VoteForSizeAndOrientation(modelKeyPoints, observedKeyPoints, indices, mask, 1.5, 20);&#xA;                    if (nonZeroCount &amp;gt;= 4)&#xA;                        homography = Features2DToolbox.GetHomographyMatrixFromMatchedFeatures(modelKeyPoints, observedKeyPoints, indices, mask, 2);&#xA;                }&#xA;            }&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; mImage = fImage.Convert&amp;lt;Bgr, Byte&amp;gt;();&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; oImage = lImage.Convert&amp;lt;Bgr, Byte&amp;gt;();&#xA;            Image&amp;lt;Bgr, Byte&amp;gt; result = new Image&amp;lt;Bgr, byte&amp;gt;(mImage.Width + oImage.Width, mImage.Height);&#xA;&#xA;            if (homography != null)&#xA;            {  //draw a rectangle along the projected model&#xA;                Rectangle rect = fImage.ROI;&#xA;                PointF[] pts = new PointF[] {&#xA;               new PointF(rect.Left, rect.Bottom),&#xA;               new PointF(rect.Right, rect.Bottom),&#xA;               new PointF(rect.Right, rect.Top),&#xA;               new PointF(rect.Left, rect.Top)};&#xA;                homography.ProjectPoints(pts);&#xA;&#xA;                HomographyMatrix origin = new HomographyMatrix();                //I perform a copy of the left image with a not real shift operation on the origin&#xA;                origin.SetIdentity();&#xA;                origin.Data[0, 2] = 0;&#xA;                origin.Data[1, 2] = 0;&#xA;                Image&amp;lt;Bgr, Byte&amp;gt; mosaic = new Image&amp;lt;Bgr, byte&amp;gt;(mImage.Width + oImage.Width + 2000, mImage.Height*2);&#xA;&#xA;                Image&amp;lt;Bgr, byte&amp;gt; warp_image = mosaic.Clone();&#xA;&#xA;                mosaic = mImage.WarpPerspective(origin, mosaic.Width, mosaic.Height, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR, Emgu.CV.CvEnum.WARP.CV_WARP_DEFAULT, new Bgr(0, 0, 0));&#xA;&#xA;&#xA;                warp_image = oImage.WarpPerspective(homography, warp_image.Width, warp_image.Height, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR, Emgu.CV.CvEnum.WARP.CV_WARP_INVERSE_MAP, new Bgr(200, 0, 0));&#xA;                Image&amp;lt;Gray, byte&amp;gt; warp_image_mask = oImage.Convert&amp;lt;Gray, byte&amp;gt;();&#xA;                warp_image_mask.SetValue(new Gray(255));&#xA;                Image&amp;lt;Gray, byte&amp;gt; warp_mosaic_mask = mosaic.Convert&amp;lt;Gray, byte&amp;gt;();&#xA;                warp_mosaic_mask.SetZero();&#xA;                warp_mosaic_mask = warp_image_mask.WarpPerspective(homography, warp_mosaic_mask.Width, warp_mosaic_mask.Height, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR, Emgu.CV.CvEnum.WARP.CV_WARP_INVERSE_MAP, new Gray(0));&#xA;                warp_image.Copy(mosaic, warp_mosaic_mask);&#xA;&#xA;                return mosaic;&#xA;            }&#xA;            return null;&#xA;        }&#xA;&#xA;        private Image&amp;lt;Bgr, Byte&amp;gt; convert(Image&amp;lt;Bgr, Byte&amp;gt; img)&#xA;        {&#xA;            Image&amp;lt;Gray, byte&amp;gt; imgGray = img.Convert&amp;lt;Gray, byte&amp;gt;();&#xA;            Image&amp;lt;Gray, byte&amp;gt; mask = imgGray.CopyBlank();&#xA;&#xA;            Contour&amp;lt;Point&amp;gt; largestContour = null;&#xA;            double largestarea = 0;&#xA;&#xA;            for (var contours = imgGray.FindContours(CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE,&#xA;                RETR_TYPE.CV_RETR_EXTERNAL); contours != null; contours = contours.HNext)&#xA;            {&#xA;                if (contours.Area &amp;gt; largestarea)&#xA;                {&#xA;                    largestarea = contours.Area;&#xA;                    largestContour = contours;&#xA;                }&#xA;            }&#xA;            CvInvoke.cvSetImageROI(img, largestContour.BoundingRectangle);&#xA;            return img;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7074" LastEditorUserId="76" LastEditDate="2013-11-26T01:22:06.320" LastActivityDate="2017-10-29T19:26:59.033" Title="Need help in panoramic image stitching using emgu cv" Tags="|opencv|stitching|panorama|" AnswerCount="0" CommentCount="1" ClosedDate="2017-10-31T19:08:52.343" ContentLicense="CC BY-SA 3.0" />
  <row Id="12873" PostTypeId="1" AcceptedAnswerId="12878" CreationDate="2013-11-25T19:40:56.743" Score="0" ViewCount="188" Body="&lt;p&gt;This is a problem I have had to deal with in several different contexts now.  Given a real time signal which you expect to act as a noisy step function (periods of stability separated by quick changes in magnitude).  How does one identify when the signal has stabilized?  The tension in this problem is between identifying stability as fast as possible and reporting a new stable value with as much accuracy as possible.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My solutions have varied depending on which of those I felt was more important and on how good my transition model was.  I have taken to calling this the stable deltas problem but have been unable to find any references on how to approach it.  Is this a studied problem in signal processing?  Does it have a name?&lt;/p&gt;&#xA;" OwnerUserId="1722" LastActivityDate="2013-11-25T20:36:39.683" Title="How to identify stable deltas in a noisy signal" Tags="|discrete-signals|signal-analysis|estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12874" PostTypeId="1" CreationDate="2013-11-25T20:03:10.517" Score="2" ViewCount="1236" Body="&lt;p&gt;I have some images of a background, and of steam that I am subtracting to extract just the steam. Unfortunately, because the camera conditions are not perfect the differenced image is always a few pixels off generating sharp lines where features in the background don't match up pixel-by-pixel like so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wbWhZ.png&quot; alt=&quot;Sharp lines and some noise&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in segmenting out the steam (foreground noise), from the background. I think if I can automatically remove the continuous lines from this image it would be sufficient for my purposes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately it's been almost ten years since my image analysis work and I don't remember what you do to detect continuous lines. What are some simple well preforming algorithms to do this?&lt;/p&gt;&#xA;" OwnerUserId="7076" LastActivityDate="2023-01-22T20:01:18.590" Title="Simple way to detect continuous lines" Tags="|image-processing|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12876" PostTypeId="2" ParentId="12794" CreationDate="2013-11-25T20:18:23.387" Score="1" Body="&lt;p&gt;This example may help you to understand this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot below shows the step response for two filters that have the same magnitude response, but the first has non constant group delay (non linear phase) while the second has constant group delay (linear phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first filter is a minimum phase version of the second filter.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/V9hOm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5108" LastEditorUserId="5108" LastEditDate="2013-11-25T20:57:41.037" LastActivityDate="2013-11-25T20:57:41.037" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12877" PostTypeId="2" ParentId="12874" CreationDate="2013-11-25T20:33:47.840" Score="2" Body="&lt;p&gt;I have two methods to suggest:&#xA;1. Use the erosion (morphological operator) (you can also use other operators like closing/opening). But i think it will destroy the steam data also...&#xA;2. A better solution is to detect the lines using hough transform. Google it and you'll find tons of info about it (if your'e using MATLAB, there is a guide how to do it in their website)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have fun...&lt;/p&gt;&#xA;" OwnerUserId="3487" LastActivityDate="2013-11-25T20:33:47.840" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12878" PostTypeId="2" ParentId="12873" CreationDate="2013-11-25T20:36:39.683" Score="2" Body="&lt;p&gt;This sounds like the &quot;change detection&quot; problem of &lt;a href=&quot;ftp://ftp.irisa.fr/local/as/mb/k11.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Basseville and Nikiforov&lt;/a&gt;, with the parameter after the change unknown (see section 2.4) of the linked PDF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See, for instance, example 2.4.3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IW1d5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual algorithm for dealing with this, and the one analyzed in the above-linked book is the &lt;a href=&quot;http://en.wikipedia.org/wiki/CUSUM&quot; rel=&quot;nofollow noreferrer&quot;&gt;CUSUM (Cumulative Sum) algorithm.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-25T20:36:39.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12879" PostTypeId="2" ParentId="12871" CreationDate="2013-11-25T20:44:30.133" Score="0" Body="&lt;p&gt;Well, it depends on the nature of the classes. &#xA;Personally, I prefer the SVM because it's easy to work with and it works (Not that fast)!&#xA;You can also use the k-means method (but it really slooooooooooooooooow especially with this number of classes).&#xA;Another classifier worth looking into is the Adaboost, they say it's fast :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have fun...!&lt;/p&gt;&#xA;" OwnerUserId="3487" LastActivityDate="2013-11-25T20:44:30.133" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12880" PostTypeId="2" ParentId="11576" CreationDate="2013-11-25T21:09:47.577" Score="2" Body="&lt;p&gt;Here is the Python code that I use for CWT. You'll need a short 16bit mono 44.1Khz &lt;code&gt;test.wav&lt;/code&gt; soundfile as input. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to compute the CWT, we need to compute the convolution between the input &lt;code&gt;x[n]&lt;/code&gt; and the morlet wavelet. An efficient way to do this is to do &lt;code&gt;ifft(x_ft * morlet_ft)&lt;/code&gt;&#xA;( I understand this as $f * g(t) =\frac{1}{2 \pi} \int_{-\infty}^{+\infty} \hat{f}(w) \hat{g}(w) e^{i t w} d w$ : it is more efficient to do a &lt;strong&gt;multiplication&lt;/strong&gt; of the fourier transforms and THEN to do an inverse fourier transform, than to compute a convolution directly)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy.io.wavfile import read&#xA;from pylab import *&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;import scipy&#xA;&#xA;# read the file                              &#xA;(sr, samples) = read('test.wav')    &#xA;x = (np.float32(samples)/((2 ** 15)-1))&#xA;N = len(x)&#xA;x_fft = np.fft.fft(x)&#xA;&#xA;# scales&#xA;J = 200    &#xA;scales = np.asarray([2**(i * 0.1) for i in range(J)])&#xA;&#xA;# pre-compute the Fourier transform of the Morlet wavelet &#xA;morletft = np.zeros((J, N))&#xA;for i in range(J):&#xA;  morletft[i][:N/2] = sqrt(2 * pi * scales[i]) * exp(-(scales[i] * 2 * pi * scipy.array(range(N/2)) / N - 2)**2 / 2.0)&#xA;&#xA;# compute the CWT &#xA;X = empty((J, N), dtype=complex128)&#xA;for i in range(J):&#xA;  X[i] = np.fft.ifft(x_fft * morletft[i])&#xA;&#xA;# plot&#xA;plt.imshow(abs(X[:,scipy.arange(0,N,100)]), interpolation='none', aspect='auto')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the scalogram plot that this code gives :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AONAo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-11-25T21:18:11.123" LastActivityDate="2013-11-25T21:18:11.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12881" PostTypeId="2" ParentId="2552" CreationDate="2013-11-25T21:40:15.463" Score="0" Body="&lt;p&gt;A direct answer to your first question: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Energy in a sequence $x[n] = \sum\lvert x[n]\rvert^2$. Which is, according to Parseval's theorem, the same as $\frac{\sum\lvert X(f)\rvert^2}{N}$, where $X(f)$ is the discrete Fourier transform of the length-$N$ sequence $x[n]$. &lt;/p&gt;&#xA;" OwnerUserId="7029" LastEditorUserId="76" LastEditDate="2013-11-26T01:21:38.770" LastActivityDate="2013-11-26T01:21:38.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12883" PostTypeId="2" ParentId="12754" CreationDate="2013-11-26T02:16:02.233" Score="0" Body="&lt;p&gt;After measuring a NFC tag with a USRP and making a couple of simulations in octave and python, it seems like I was incorrect regarding the point-wise multiplication. As it stands, I believe the best simulation is to do an addition of the carrier wave (13.56 MHz) and the subcarrier wave (847 kHz), with the subcarrier wave's amplitude set at 0.1x the amplitude of the carrier wave.&lt;/p&gt;&#xA;" OwnerUserId="7021" LastActivityDate="2013-11-26T02:16:02.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12884" PostTypeId="2" ParentId="12849" CreationDate="2013-11-26T02:22:49.063" Score="0" Body="&lt;p&gt;We want to find a representation in terms of sines and cosines for the function&#xA;$g(x)$ which has value $x$ for $x \in [0,\pi]$. We don't really care if this&#xA;representation does not work well outside the interval $[0,\pi]$, but &#xA;inside the interval, the representation better work perfectly.  This seems&#xA;to be crying out for a Fourier series approach, and so that's what we will&#xA;use.  The standard approach begins with functions that are periodic with&#xA;period $2\pi$ and so let us extend the definition of $g(x)$ to cover&#xA;one period $[0,2\pi]$.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If we &lt;em&gt;choose&lt;/em&gt; $g(x)$ to have value $2\pi-x$ for&#xA;$x \in [\pi, 2\pi]$, then, when repeated periodically,&#xA;this extended $g(x)$ is an &lt;em&gt;even&lt;/em&gt; function of $x$ with average value $\pi/2$.&#xA;Furthermore, as is the case with all even functions, the sine terms all &#xA;have $0$ coefficients.  Thus, the Fourier series works out to &#xA;have only cosines in it, and the DC term is $\pi/2$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If we choose $g(x)$ to have value $x$ for $x \in [\pi, 2\pi]$, then&#xA;when repeated periodically,&#xA;this extended $g(x)$ is not an &lt;em&gt;odd&lt;/em&gt; function of $x$, but nonetheless&#xA;it is true that all the cosine terms in the Fourier series&#xA;turn out to be $0$ &lt;em&gt;except&lt;/em&gt; the DC term which has value $\pi$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-11-26T02:22:49.063" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12885" PostTypeId="2" ParentId="12794" CreationDate="2013-11-26T03:47:59.013" Score="0" Body="&lt;p&gt;Application of a window in the time domain means that the spectrum is convolved with the Fourier transform of the window. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at applying three different windows to a simple sine wave:  &lt;a href=&quot;http://en.wikipedia.org/wiki/Hann_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;a Hann window&lt;/a&gt;, a Hann window modulated randomly, and a Hann window that is made anti-symmetric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7Gatj.png&quot; alt=&quot;Hann Window&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p8YOh.png&quot; alt=&quot;Randomly Modulated Hann Window&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qfpKl.png&quot; alt=&quot;Anti-symmetric Hann Window&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitude of the FFT of each window:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/knW3H.png&quot; alt=&quot;FFT of each window&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the only option that gives any benefit is the Hann window: it reduces spectral leakage (though at the cost of broadening the peak slightly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other two windows just much up the spectrum to no real benefit.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Source code in &lt;code&gt;scilab&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WN = 100;&#xA;SN =  100;&#xA;omega = 2*%pi*9.887423;&#xA;t = [0:SN-1]/SN;&#xA;phi = rand(1,1)*2*%pi;&#xA;&#xA;X = sin(omega*t+phi);&#xA;W = window('hn',WN);&#xA;W2 = W.*rand(1,WN);&#xA;W3 = W.*(bool2s((t-0.5) &amp;gt; 0) - 0.5)*2;&#xA;&#xA;function plot_it(X,W,fig)&#xA;figure(fig)&#xA;clf&#xA;subplot(221)&#xA;plot(X);&#xA;title('Signal')&#xA;&#xA;subplot(222)&#xA;plot(W);&#xA;title('Window')&#xA;&#xA;subplot(223);&#xA;plot(abs(fft(X)))&#xA;title('FFT of signal without window')&#xA;&#xA;subplot(224);&#xA;plot(abs(fft(X.*W)))&#xA;title('FFT of signal WITH window')&#xA;endfunction&#xA;&#xA;plot_it(X,W,1)&#xA;plot_it(X,W2,2)&#xA;plot_it(X,W3,3)&#xA;&#xA;figure(4)&#xA;clf&#xA;subplot(311);&#xA;plot(fftshift(abs(fft(W))))&#xA;subplot(312);&#xA;plot(fftshift(abs(fft(W2))))&#xA;subplot(313);&#xA;plot(fftshift(abs(fft(W3))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2013-11-26T03:47:59.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12887" PostTypeId="1" AcceptedAnswerId="12904" CreationDate="2013-11-26T07:09:45.220" Score="3" ViewCount="572" Body="&lt;p&gt;I am a civil engineer and am analyzing traffic data recorded by capturing vehicle movements over a highway for a specified time period. The database I am dealing with contains observations at every 0.1 seconds (total about 4 million rows) and has some 'noise' in position (lateral and longitudinal) columns. A research paper suggests to 'smooth' the velocity and acceleration data (derived from position) by using following formula: &lt;img src=&quot;https://i.stack.imgur.com/yqmvK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone told me it is a 'convolution'. Since I have no background in electronics/ DSP, I had no idea what convolution is. After studying some online resources I can understand a little about the concept but I need a thorough understanding of this topic from a resource which is targeted towards people who have no background in DSP. Could anyone please guide me to the required resources? I am using R for analysis.&lt;/p&gt;&#xA;" OwnerUserId="7079" LastActivityDate="2013-11-27T14:39:28.470" Title="Convolution for non-signal-processing background" Tags="|filters|noise|convolution|smoothing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12889" PostTypeId="1" CreationDate="2013-11-26T11:31:19.923" Score="1" ViewCount="89" Body="&lt;p&gt;I was asked to find a way to analyse/process a particular set of data collected by oil drilling rigs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Among these real-time collected data we have the &quot;mudflow&quot;, BUT, as the rig is floating it moves up and down due to waves and tides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the rig moves up the mudflow is slightly lower and when it moves down it's slightly higher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know which approach to choose to solve the problem and get rid of the &quot;wave/tide&quot; in the data collected to obtain a more accurate mudflow chart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The person who gave me this task talked about Fourier transforms but I'm not sure if it's the right way to do after spending 2 days thinking/searching on this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you guys have a beginning of an answer it would be a great help for me.&lt;/p&gt;&#xA;" OwnerUserId="7083" LastEditorUserId="76" LastEditDate="2013-11-26T16:00:48.143" LastActivityDate="2013-11-26T16:00:48.143" Title="Oil rig real-time data processing, waves/tides elimination" Tags="|filters|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12890" PostTypeId="1" CreationDate="2013-11-26T11:53:54.207" Score="0" ViewCount="149" Body="&lt;p&gt;I want to use the L*a*b color model for recognition of a particular colored object by calculating the euclidean distance between the desired color in current image and the same color in next image frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the LAB color space was designed in keeping with human vision, I think it can be used for the purpose.  Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="76" LastEditDate="2013-11-26T14:05:56.337" LastActivityDate="2013-11-27T02:41:20.377" Title="Object recognition using color information" Tags="|image-processing|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12891" PostTypeId="1" CreationDate="2013-11-26T12:31:13.150" Score="0" ViewCount="32" Body="&lt;p&gt;I have the edge information of the signal. I need to find if it's a Clock or Data type signal without iterating through all the points in edge vector...&#xA;Please provide your valuable inputs&lt;/p&gt;&#xA;" OwnerUserId="7087" LastEditorUserId="7087" LastEditDate="2013-11-26T12:37:04.037" LastActivityDate="2013-11-26T13:27:25.463" Title="How to detect if the given signal is Data or Clock signal type?" Tags="|filter-design|signal-analysis|signal-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12892" PostTypeId="1" CreationDate="2013-11-26T12:32:48.673" Score="1" ViewCount="377" Body="&lt;p&gt;I just started a project in the Smart Grids area. It involves the recognition and quick extinction of earth faults in a medium voltage system. The system works automatically and pretty much gets rid of earth faults very quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My task is to make and algorithm to also know where the earth fault happened along the network. For that, the system is programmed to send a rectangular pulse train in the line, which modulates the neutral current (which is close to zero much of the time). Once the current is modulated with the pulse train, the work I have to do is to recognize the pulse train by analyzing the neutral current. Once the pulse train is recognized at a given substation I know where the fault happened.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ox0m1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pulse train that is sent is always the same and has known amplitude, frequency and number of pulses (6 amperes, t_on=t_off=1s and 5 pulses, for example) and cannot be changed for this project. Right now the system has an algorithm running to locate the fault by doing an FFT on each pulse it encounters and measures the harmonics energy in order to see if it is in fact a rectangular pulse or not (since the FFT of a rectangular pulse has a know spectrum). Once the five pulses are positively recognized one after the other, the Earth Fault Detected flag is raised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that outside pulses can also come on the line randomly, from say a wash machine being turned on and off or a blender, for example. This leads to false earth faults being detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial solution and recommendation is to use the cross-correlation and auto-correlation function on the whole pulse train in order to check periodicity of the signal. Once that's done I can know if the signal does in fact have this particular pulse train or not. I did a small Matlab simulation to see the ACF of my pulse train and of a random set of pulses to further cement my hypothesis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross Correlation:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eczmo.png&quot; alt=&quot;CrossCorrelation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Autocorrelation:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VHpYa.jpg&quot; alt=&quot;ACF&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this though process make sense? Does anyone have any other recommendations to accomplish this?&lt;/p&gt;&#xA;" OwnerUserId="7085" LastActivityDate="2013-11-26T12:32:48.673" Title="Train Pulse Recognition in Medium Voltage Networks" Tags="|signal-detection|autocorrelation|cross-correlation|object-recognition|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12893" PostTypeId="1" CreationDate="2013-11-26T12:41:40.327" Score="2" ViewCount="186" Body="&lt;p&gt;I am trying to recognize the wood chips in the image shown below. The ultimate goal is to try and recognize the width and length of each wood chip.&#xA;Currently, I am using an approach that involves bilateral filtering on a grey-level image + Canny edge detection + Hough line transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Results are somewhat iffy - can you recommend other algorithms to try out or is this a problem more suited to a statistical / machine learning approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QhSpK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7086" LastEditorUserId="7086" LastEditDate="2013-11-27T13:12:41.927" LastActivityDate="2013-12-19T18:48:04.007" Title="Segmenting wood chips in an image" Tags="|computer-vision|image-segmentation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12894" PostTypeId="2" ParentId="12891" CreationDate="2013-11-26T13:27:25.463" Score="1" Body="&lt;p&gt;Clocks are very regular, i.e. all the up and down transitions are equally spaced. Data tends  to more irregular, i.e. spacing between transitions varies.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-11-26T13:27:25.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12895" PostTypeId="1" CreationDate="2013-11-26T14:08:49.477" Score="2" ViewCount="986" Body="&lt;p&gt;I would like to synchronize two different music tracks (and maintain synchronization) as a DJ would with two records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I have the beats mapped for each song, so I am able to adjust their rates and time align them accordingly.  What I've found though, with many sample tracks, is that the two tracks will drift out of sync after a while due to the tempos of the songs not remaining constant. I've tried compensating for this by periodically checking the tempos of the songs and re-adjusting their rates so that they are synchronized again by the start of the following measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a common (or better) approach of synchronizing two music tracks?&lt;/p&gt;&#xA;" OwnerUserId="7088" LastEditorUserId="13320" LastEditDate="2016-05-13T10:38:38.957" LastActivityDate="2016-05-13T10:38:38.957" Title="synchronizing two music tracks" Tags="|audio|music|synchronization|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12896" PostTypeId="2" ParentId="1676" CreationDate="2013-11-26T15:01:39.710" Score="2" Body="&lt;p&gt;I found out, that there are two ways to use the savitzky-golay algorithm in Matlab. Once as a filter, and once as a smoothing function, but basically they should do the same.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;yy = sgolayfilt(y,k,f): Here, the values y=y(x) are assumed to be equally spaced in x.&lt;/li&gt;&#xA;&lt;li&gt;yy = smooth(x,y,span,'sgolay',degree): Here you can have x as an extra input and referring to the Matlab help x does not have to be equally spaced!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7089" LastActivityDate="2013-11-26T15:01:39.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12897" PostTypeId="1" AcceptedAnswerId="12898" CreationDate="2013-11-26T15:38:32.820" Score="0" ViewCount="206" Body="&lt;p&gt;Let &lt;code&gt;x[n]&lt;/code&gt; and &lt;code&gt;y[n]&lt;/code&gt; be defined for &lt;code&gt;n=0,1, ..., N-1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This (for example with Python's scipy fft / ifft)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = ifft (fft(x) * fft(y))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should give the convolution &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[k] = (x * y)[k] = \sum_{n=0}^{N-1} x[n] y[k-n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is it done with &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;y[i] = 0&lt;/code&gt; if $i&amp;lt;0$  ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;y[i] = y[N+i]&lt;/code&gt; if $i&amp;lt;0$ ?  (ex : &lt;code&gt;y[-3] = y[N-3]&lt;/code&gt; )     (in this case do we call it &lt;strong&gt;circular convolution&lt;/strong&gt;?)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note : More generally, I have good books about signal processing / Fourier transform in general, but they are not really handy handbooks for discrete finite signals (&lt;code&gt;x[n]&lt;/code&gt; for  &lt;code&gt;n=0,1, ..., N-1&lt;/code&gt;). Do you have a good reference of handbook for this case (discrete finite signals) ?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-11-26T15:51:50.997" LastActivityDate="2013-11-26T16:05:06.793" Title="What kind of discrete convolution is this?" Tags="|fft|discrete-signals|signal-analysis|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12898" PostTypeId="2" ParentId="12897" CreationDate="2013-11-26T16:05:06.793" Score="3" Body="&lt;p&gt;Fast (FFT/IFFT) convolution results in circular convolution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(But if sufficient zero-padding is explicitly added before the initial FFTs, circular and linear convolution would then produce identical results.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-26T16:05:06.793" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12899" PostTypeId="1" AcceptedAnswerId="12918" CreationDate="2013-11-26T16:22:47.000" Score="4" ViewCount="36163" Body="&lt;p&gt;I am wanting to compute the Z-transform of $f(n) = a^{|n|}$ . 'a' is a positive constant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the transform table, I found that Z-transform for $a^n u(n)$&#xA;is available from the tables and is $\frac{Z}{Z-a}$. Where $u(n)$ is the unit step function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to decompose $f(n)$ as --&#xA;$f(n) = a^n u(n)  +  a^{-n} u(-n) + \delta(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then using the table to find $Z( f(n) )$ as --&#xA;$\frac{Z}{Z-a} + \frac{Z^{-1}}{Z^{-1} - a} + 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me if this approach is correct and/or suggest an alternate way. &#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="3184" LastActivityDate="2017-12-10T12:49:39.410" Title="Z-Transform of a^|n|" Tags="|z-transform|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12900" PostTypeId="2" ParentId="12887" CreationDate="2013-11-26T16:42:50.637" Score="2" Body="&lt;p&gt;That's not convolution, but its close. Its technically non-causal, so it is actually a complicated beast from an analysis standpoint. Basically what its doing is taking the a single point and creating a weighted average from D points ahead and D points behind a single measurement. The weights are the terms in the second sum. Z is simply the normalization factor. In a normal average you'd divide by the number of elements, in a weighted average you divide by the sum of the weights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure I'd recommend doing that if you've got position data to work with directly already. If I was you, without a background in DSP, I'd look at doing an alpha-beta-gamma filter to start with, and if you want something better, your problem works well with a Kalman filter. These use the basic position/velocity/acceleration equations in their estimation, but rely on data that comes before your current measurement. If you want to use the data that comes afterwards, Rauch-Taung-Striebel smoothing is an extension of Kalman filtering that takes all of your data as well as physical models to estimate position, velocity and acceleration over time from a set of position measurements. I do recommend starting with Alpha-Beta-Gamma filtering though, its easy to understand, quick to program and is oftentimes good enough.&lt;/p&gt;&#xA;" OwnerUserId="7090" LastActivityDate="2013-11-26T16:42:50.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12901" PostTypeId="2" ParentId="12895" CreationDate="2013-11-26T20:52:14.863" Score="1" Body="&lt;p&gt;You may need to find out the lowest common denominator, not only the tempo, but also the chord progressions and melodies. You can do a cross-correlation on the two track vectors that you extract from them.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2013-11-26T20:52:14.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12903" PostTypeId="1" CreationDate="2013-11-26T22:10:03.343" Score="0" ViewCount="126" Body="&lt;p&gt;I am just begining learning about DFT and I am bit unsure on what is happening mathematically during DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've sampled a signal , a sine wave sin(1000*2*pi*t). And performed DFT to calculate the Ck-coefficients, by plotting the Ck coefficients with different k values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency resolution is 8000/205&#xA;where 205 is the amount of datapoint/samples and 8000 sample frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can by using the plot read, where |Ck| is highest and then using my frequency resolution, detemine the frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that the amount  of samples have alot to say about determining the frequency. &#xA;If i use a lower amount of samples, or does not use all the samples, will the estimated frequency either be lower, or higher. Why does is do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ex.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k := Round[1/((8000/100)/1000)]&#xA;freqres := 8000/100 // N&#xA;estimated freq = 468.293&#xA;&#xA;k := Round[1/((8000/205)/1000)]&#xA;freqres := 8000/205// N&#xA;estimated freq = 992&#xA;&#xA;k := Round[1/((8000/500)/1000)]&#xA;freqres := 8000/500 &#xA;estimated freq = 992&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6921" LastEditorUserId="6" LastEditDate="2013-11-26T22:10:47.510" LastActivityDate="2013-11-27T00:10:58.647" Title="DFT detemine frequencies" Tags="|frequency|dft|estimation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12904" PostTypeId="2" ParentId="12887" CreationDate="2013-11-26T22:54:24.800" Score="3" Body="&lt;p&gt;I disagree with the assertion in the answer by user7090 that the calculation in question is not a convolution; it is indeed a convolution.  Let us consider the case $D=2$. Ignoring $Z$ for now,&#xA;the five terms in that sum &#xA;$\displaystyle \sum_{k = i-2}^{i+2} x(t_k)e^{-|i-k|/\Delta}$ on the left in the OP's question are&#xA;$$\begin{align}&#xA;x(t_{i-2})e^{-|i - (i-2))|/\Delta} &amp;amp;= x(t_{i-2})e^{-2/\Delta}\\&#xA;x(t_{i-1})e^{-|i - (i-1))|/\Delta} &amp;amp;= x(t_{i-1})e^{-1/\Delta}\\ &#xA;x(t_{i-0})e^{-|i - (i-0))|/\Delta} &amp;amp;= x(t_i)e^{-0/\Delta} = x(t_i)\\&#xA;x(t_{i+1})e^{-|i - (i+1))|/\Delta} &amp;amp;= x(t_{i+1})e^{-1/\Delta}\\&#xA;x(t_{i+2})e^{-|i - (i-2))|/\Delta} &amp;amp;= x(t_{i+2})e^{-2/\Delta}&#xA;\end{align}$$&#xA;and so the sum is very much a convolution of the  sequence $x$&#xA;whose $i$-th term is $x(t_i)$&#xA;with a length-$5$ sequence $h$ whose $n$-th term is $e^{-|n|/\Delta}$&#xA;for $|n| \leq 2$ in this case (and a length-$(2D+1)$ sequence&#xA; with $|n| \leq D$ more generally).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you, the OP, need to understand is the following (and don't&#xA;get bogged down in words like convolution).  You are doing a&#xA;&lt;em&gt;smoothing&lt;/em&gt; of the data that you have collected.  Each $x(t_i)$ of the&#xA;original data is being replaced by a $\tilde{x}(t_i)$ which is formed&#xA;as a &lt;em&gt;weighted&lt;/em&gt; sum of $x(t_i)$ and its immediate neighbors.  The&#xA;weights assigned to $x(t_i)$ is the largest, the weight assigned to&#xA;its nearest neighbors $x(t_{i+1})$ and $x(t_{i-1})$ are smaller (but equal),&#xA;the weights assigned to slightly more distant neighbors $x(t_{i+2})$ and $x(t_{i-2})$ is yet smaller, and so on, till the we get to $x(t_{i+D})$ and $x(t_{i-D})$ which get the smallest weights of all. Anything more&#xA;than $D$ away gets a weight of $0$.  The weights in question are&#xA;&lt;em&gt;normalized&lt;/em&gt; in the sense that the total &lt;em&gt;weight&lt;/em&gt; is $1$, but let&#xA;us look at the raw weights which are alleged to be those $e^{-|i-k|/\Delta}$.&#xA;What you really have (before normalization of the weights) is&#xA;that sum (let us use $D = 3$ for simplicity) which is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t_i) + \left.\left.e^{-1/\Delta}\right[x(t_{i+1}) + x(t_{i-1)}\right]&#xA;+ \left.\left.e^{-2/\Delta}\right[x(t_{i+2}) + x(t_{i-2})\right]&#xA;+ \left.\left.e^{-3/\Delta}\right[x(t_{i+3}) + x(t_{i-3})\right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$= e^{-3/\Delta}x(t_{i-3}) + e^{-2/\Delta}x(t_{i-2}) + &#xA;e^{-1/\Delta}x(t_{i-1}) + x(t_i) + e^{-1/\Delta}x(t_{i+1}) + e^{-2/\Delta}x(t_{i+2})&#xA;+ e^{-3/\Delta}x(t_{i+3})\quad (1)$&#xA;where on the right side we have the elements occurring in the&#xA;natural order, flanking the central element $x(t_i)$ on both sides.&#xA;Now, the &lt;em&gt;sum&lt;/em&gt; of the raw weights exhibited in $(1)$ is&#xA;$$e^{-3/\Delta} + e^{-2/\Delta} + &#xA;e^{-1/\Delta} + 1 + e^{-1/\Delta} + e^{-2/\Delta}&#xA;+ e^{-3/\Delta} \tag{2}$$&#xA;which is just the element $Z$ in the question, and so the&#xA;&lt;em&gt;normalized&lt;/em&gt; weights are just the ones exhibited in $(2)$&#xA;divided by $Z$. A better way of writing $Z$ might be&#xA;$$Z = \sum_{k=-D}^D e^{-|k|/\Delta} = 1 + 2\sum_{k=1}^De^{-k/\Delta}&#xA;\tag{3}$$&#xA;and perhaps a better way of expressing the first sum might be&#xA;$$\tilde{x}(t_i) = \frac{1}{Z}\sum_{k=-D}^D x(t_{i-k})e^{-|k|/\Delta}$$ &#xA;which expresses more clearly that we are forming a weighted sum&#xA;of $x(t_i)$ and its nearest neighbors and that the weights assigned&#xA;to neighbors at distance $k$ decrease exponentially as a function&#xA;of $k$ (here $k \geq 0$ of course since we are not distinguishing&#xA;between the directions of separation).&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-11-27T14:39:28.470" LastActivityDate="2013-11-27T14:39:28.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12905" PostTypeId="2" ParentId="12903" CreationDate="2013-11-26T23:23:50.927" Score="1" Body="&lt;p&gt;The FFT get a discrete spectrum, as a result do you have a finite number of frequency or bins, this means that FFT resolves a time waveform into its sinusoidal components, the frequency resolution is explicitly linked to the FFT size and the sample rate, the resolution frequency is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{Fs}{ N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where Fs is your sample rate and N is the size of your FFT, The larger the size of the FFT more spectral component you have and it makes its results more accurate, this tells me that to get lower frequency resolution you need a large size FFT (2048, 4096).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Follow your example 8000/205 this tells me that for each FFT bin returned you may be losing precision in order 39.02439024390244Hz&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-11-26T23:23:50.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12906" PostTypeId="2" ParentId="12825" CreationDate="2013-11-26T23:35:43.717" Score="0" Body="&lt;p&gt;For anyone might be interested in my question, this is how the patches are created:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) For each codebook, find the closest interest point that has SIFT descriptor closest to the codebook&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Simply print out a window around that interest point.&lt;/p&gt;&#xA;" OwnerUserId="3802" LastActivityDate="2013-11-26T23:35:43.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12907" PostTypeId="2" ParentId="12903" CreationDate="2013-11-27T00:10:58.647" Score="1" Body="&lt;p&gt;If you are estimating the location of a spectral frequency peak, then, depending on the S/N ratio, interpolation of the DFT result may provide a finer frequency resolution of a peak than just the DFT bin spacing.  (Parabolic, spline, or Sinc kernel interpolation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, the more samples fed to DFTs, the more &quot;information&quot; there is to use for spectral estimations.  Thus, for stationary signals, greater resolution usually comes with greater lengths of data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-27T00:10:58.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12908" PostTypeId="1" AcceptedAnswerId="13671" CreationDate="2013-11-27T01:57:22.127" Score="2" ViewCount="1037" Body="&lt;p&gt;I'm implementing a baseline system that uses a Vocabulary Tree, i.e. a BoF model based on HKM, for images classification. Currently I'm obtaining low quality recognition due to the poor quality of the quantization structure resulting from the HKM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm obtaining 100.000 words in my final vocabulary in a tree of depth 6 and branch factor 10 where the theoretical number of words is 10^6 = 1'000.000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In several papers, like those of Zisserman related to Large Scale Landmark recognition, they claim to be using a 1'000.000 words vocabulary, something I found difficult to understand since this number is theoretical while in practice there is no guarantee to obtain it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I understanding something wrong? If not, what should I do to increase the vocabulary size despite of using more descriptors to train the tree?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: my only hint so far is using a different seeding algorithm for clusters initialization like k-means++ or gonzales&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, any suggestion is welcome.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;After reading @penelope's answer I came back to report my findings. The configuration of my implementation for building the vocabulary tree is: depth 6, branch factor 10, maximum 10 iterations, and random seeding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addressing some of the spots:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Severely underpopulated clusters at early levels&lt;/strong&gt;: I checked clusters at first level and they were kind of uniformly distributed, e.g. the first cluster was typically  10% of the whole set.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;K-means termination criteria&lt;/strong&gt;: I'm running the clustering process until convergence or until reaching 10 iterations. I took this parameter from the experiments of Neister 2006 where the performance will not improve farther than ~12 iterations while doing so could affect the overall algorithm duration.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Uniform coverage of feature space&lt;/strong&gt;: I am seeding centers using random selection, as I said in the question using other algorithm like k-means++ or gonzalez would become in a more uniform coverage of the feature space.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Number of training features should be considerably bigger than the expected number of clusters&lt;/strong&gt;: with &quot;expected number of cluster&quot; I understand &quot;expected number of words&quot;, being it so, this is very likely the root cause of my problem. I'm training a 1 million words vocabulary using 3 million descriptors while the experiments of Zisserman use ~17 million descriptors from the Oxford Buildings dataset and those of Marc Pollefeys team use ~16 million from the San Francisco Landmark dataset.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pairing several detectors and descriptors&lt;/strong&gt;: I have the restriction of comparing my approach which uses binary features against a baseline using DoG/MSER and SIFT descriptors. In the near future I plan to evaluate performance as well using other detectors like AGAST which produce more keypoints of similar quality to those produced by DoG.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;HKM termination conditions&lt;/strong&gt;: in @penelope's answer it was mentioned that obtaining a vocabulary tree of expected size was not a problem. I was wondering if such a thing was truly possible and started to think about HKM termination conditions. In my implementation they are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reaching last level.&lt;/li&gt;&#xA;&lt;li&gt;Having less data than clusters.&lt;/li&gt;&#xA;&lt;li&gt;Obtaining, at clustering initialization time, centers which are too close one another so there is a big chance they represent the same word, hence not very distinctive.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The first two conditions are enough and necessary but the third one isn't, I included it because the vocabulary might result more distinctive, at least in theory. I borrowed it from the hierarchical k-means index implementation in OpenCV. Could it be convenient removing it?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4373" LastEditorUserId="35" LastEditDate="2013-12-17T06:20:57.850" LastActivityDate="2014-01-09T02:05:27.057" Title="How to achieve full number of words in a Bag-of-Features model based on Hierarchical K-Means?" Tags="|computer-vision|machine-learning|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12910" PostTypeId="2" ParentId="12827" CreationDate="2013-11-27T02:36:32.483" Score="2" Body="&lt;p&gt;At your first stage, which classifier to use is not that important, you may need to make your code run first. There was a very famous paper on &lt;a href=&quot;http://cogprints.org/1485/2/95_WisFelKrue+.pdf&quot; rel=&quot;nofollow&quot;&gt;Face Recognition and Gender Determination&lt;/a&gt;, in which a very complex transform was implemented to represent each node on the face. The used gabor kernal based wavelet transform to get set of coefficients for each node(refers to jet), and use sparse jets to represent the face. They also consider the template matching to ensure that each face can be decomposed of the jets. They built a look-up table to record the correlation between each jet and the gender. When a new image comes, the gender is determined by the pooling result of the jet sets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But most approaches nowadays won't be that complicated. Basically the image intensity is used as the face input (or RGB color components but they are intensity equivalently). Each image matrix is reshaped into a long vector, and all the images from training set will form a large M X N matrix where M is the image pixel size and N is the sample number. Then Principal Component Analysis is used on the matrix to extract the core components, and project them onto a sub-space. Intra-class and inter-class scatter difference is calculated, then Linear Discriminant Analysis is applied to maximize the ratio of the determinant of Inter-class scatter and intra-class scatter. Please refer to this &lt;a href=&quot;http://bytefish.de/blog/fisherfaces/&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; to see more details (The algorithm is implemented by Python though).   &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2013-11-27T02:36:32.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12911" PostTypeId="2" ParentId="12890" CreationDate="2013-11-27T02:41:20.377" Score="3" Body="&lt;p&gt;Yes Lab color is designed to approximate human vision. But there are also RGB and CMYK color models, and their transforms like HSL and HSV. Which color base can best make your object feature distinguishable needs your experiment to validate.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2013-11-27T02:41:20.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12912" PostTypeId="2" ParentId="12843" CreationDate="2013-11-27T02:48:46.463" Score="1" Body="&lt;p&gt;Assuming your change of amplitude is very slow when compared to the frequency of the sinusoid, this problem can be posed as finding frequency of a noisy sinusoid. You can take small windows of the signal and then take it's fourier transform. Since we know that the amplitude is almost constant and that there is only one sinusoid, we can look for two peaks in the DFT of the signal with some side lobes(Due to windowing). Your goal would be to find those two peaks, which would reduce the error energy in your estimate. Once you have the frequency and the phase information, finding turning points is very easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="5751" LastActivityDate="2013-11-27T02:48:46.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12913" PostTypeId="1" AcceptedAnswerId="12990" CreationDate="2013-11-27T04:48:07.717" Score="4" ViewCount="3886" Body="&lt;p&gt;I want to make image processing programs which talk about homomorphic filter. But when I read some articles, I can't get it. Maybe can anyone help it. I very need this. Sorry about my english.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I change spatial domain image to frequency domain with discrete Fourier transform. Right?&#xA;Formula Forward DFT: &lt;img src=&quot;https://i.stack.imgur.com/4v0Rq.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What are M and N? Width and height of image?&lt;/li&gt;&#xA;&lt;li&gt;and then, the output from forward formula, real and imaginary part? like &quot;a+bj&quot;?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When I try to inverse the Fourier transform with the formula: &lt;img src=&quot;https://i.stack.imgur.com/yLzAU.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;F(u,v) is the result from forward dft? but it has 2 part real and imaginary? if, &#xA;F(u,v) = (a+bj) and result euler theorem e^... = cos(x)+j sin(x).&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So, F(u,v).e^... = (a+bj).( cos(x)+j sin(x) ) = a.cos(x) + j(a.sin(x) + b.cos(x)) - b.sin(x)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;my equation correct ?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the result of inverse real and imaginary part again? because have &quot;j&quot;.&lt;/li&gt;&#xA;&lt;li&gt;how can i get my original image? take the real part, just make my image get blurred&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;THX for reply..&lt;/p&gt;&#xA;" OwnerUserId="7096" LastActivityDate="2013-12-05T08:59:51.153" Title="Discrete Fourier Transform for beginners" Tags="|image-processing|dft|c|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12914" PostTypeId="1" AcceptedAnswerId="12925" CreationDate="2013-11-27T04:59:15.073" Score="3" ViewCount="795" Body="&lt;p&gt;I'm a computer science student and I have an assignment requiring me to implement the algorithm proposed by this paper but I'm hitting a roadblock trying to understand the implementation of one of the methods proposed in the paper. I'm not sure if I understand Section IIIB well. &#xA;This is what I understand so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to separate the histograms into subregions, we must first obtain the histogram of the intensity levels. Once achieved, we calculate the density of the histogram (equation 7). &#xA;Furthermore we have to sort the density function values in descending order. How is this implemented? I assume its only in the following paragraph in the paper that goes on to describe this but I'm having a hard time understanding what the authors are trying to convey.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we find the groups of high density areas, we extend a group area surrounding these values. The paper talks about momentary changes. I'm not sure what this means, anyone have an idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The page is located at&#xA;&lt;a href=&quot;http://www.waset.org/journals/ijeee/v3/v3-6-53.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.waset.org/journals/ijeee/v3/v3-6-53.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7097" LastEditorUserId="7097" LastEditDate="2013-11-27T13:52:56.427" LastActivityDate="2013-11-28T07:52:44.373" Title="Image Contrast Enhancement based Sub-histogram Equalization Technique without Over-equalization Noise" Tags="|image-processing|matlab|histogram|equalization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12915" PostTypeId="2" ParentId="12830" CreationDate="2013-11-27T06:39:45.670" Score="6" Body="&lt;p&gt;The matlab codes that implemented D. Ellis's algorithm are on their website: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://labrosa.ee.columbia.edu/projects/beattrack/&quot;&gt;http://labrosa.ee.columbia.edu/projects/beattrack/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2013-11-27T06:39:45.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12916" PostTypeId="2" ParentId="12893" CreationDate="2013-11-27T08:52:45.767" Score="2" Body="&lt;p&gt;It's a tough problem!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the exact meaning of &lt;em&gt;recognize the wood chips&lt;/em&gt; in this case please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you want to separate the wood from the container, I would propose the following processing pipe-line:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;for pre-processing, bilateral filtering is a good choice if it fits in your time budget since it will preserve the edges&lt;/li&gt;&#xA;&lt;li&gt;detect the enclosing circle by using a generalized Hough transform. If you implement your process with OpenCV, you don't even need to compute the gradient of the image before&lt;/li&gt;&#xA;&lt;li&gt;inside the container, apply some local contrast enhancement to get information up to the borders&lt;/li&gt;&#xA;&lt;li&gt;compute the image gradient inside the container, and finally segment it based on the gradient orientation (I can't really guess a better clue for segmenting the different chips inside).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope this helps...&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-11-27T08:52:45.767" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12917" PostTypeId="1" CreationDate="2013-11-27T10:28:32.297" Score="3" ViewCount="355" Body="&lt;p&gt;Suppose that we have some peaks of a signal and we know the time lag between dominant peaks. How is it possible to remove the extra peaks by applying time lag ?&#xA;Lets say it in MATLAB&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[corr]=xcorr(signal,signal);&#xA;[val1 ind1]=max(corr);&#xA;corr(ind1:length(corr))=0; % symetric properties of correlation&#xA;[val2 ind2]=max(corr);&#xA;lag=ind1-ind2;&#xA;[pks ind]=findpeaks(signal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Actually, I would like to remove the spurious peaks by using time-lag but maybe some dominant peaks a little less or more than exact time-lag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JKCpB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7100" LastEditorUserId="7100" LastEditDate="2013-11-28T02:34:04.810" LastActivityDate="2013-11-28T02:34:04.810" Title="Remove the extra peaks by lag" Tags="|matlab|noise|autocorrelation|peak-detection|lpc|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12918" PostTypeId="2" ParentId="12899" CreationDate="2013-11-27T12:27:15.643" Score="2" Body="&lt;p&gt;I believe the right way to decompose this function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(n) = a^n u(n)  +  a^{-n} u(-n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the answer for your question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Z( f(n) ) = \frac{Z}{Z-a} + \frac{Z^{-1}}{Z^{-1} - a}$&#xA;EDIT: Looks like it is wrong answer. :(&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Ok, let's start from the beggining and try to find right answer step by step&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given sequence is $f(n) = a^{|n|}$ . 'a' is a positive constant.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Let's  decompose it into sum of 2 sequences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(n) = a^n u(n)  +  a^{-n} u(-n-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If we define $f_1(n) = a^n u(n)$  and $f_2(n) = a^{-n} u(-n-1)$&#xA;Then $Z( f(n) ) = Z( f_1(n) )+Z( f_2(n) )$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;3) $Z( f_1(n) ) = \sum_{n=-\infty}^{\infty} a^n u(n) z^{-n} = \sum_{n=0}^{\infty} (az^{-1})^n = \frac{1}{1-az^{-1}} = \frac{z}{z-a}  $&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;4) $Z( f_2(n) ) = \sum_{n=-\infty}^{\infty}  a^{-n} u(-n-1) z^{-n} = \sum_{n=-\infty}^{-1} (az)^{-n} = \sum_{n=1}^{\infty} (az)^{n} = -1+1+\sum_{n=1}^{\infty} (az)^{n} = -1+\sum_{n=0}^{\infty} (az)^{n} = -1 + \frac{1}{1-az} = \frac{-1+az+1}{1-az} = \frac{az}{1-az} $&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;5) $Z( f(n) ) = Z( f_1(n) )+Z( f_2(n) ) = \frac{z}{z-a} + \frac{az}{1-az} = \frac{z}{z-a} - \frac{z}{z-\frac{1}{a}} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is anything unclear or wrong in this derivation, please comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for wolfram answer - I don't know why it is so. I never used wolfram before. &#xA;But it perfoms symbolic computations and you must be sure that your assumptions about range of n (does $n\in[-\infty,\infty]$  or $ n\in[0,\infty]$ ) for example should coinside with wolfram assumptions.&lt;/p&gt;&#xA;" OwnerUserId="7102" LastEditorUserId="7102" LastEditDate="2013-11-28T14:29:56.490" LastActivityDate="2013-11-28T14:29:56.490" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12919" PostTypeId="2" ParentId="12660" CreationDate="2013-11-27T13:54:25.833" Score="1" Body="&lt;p&gt;If you have more than 1 detectors, you may try blind separation based on the power spectrum difference of voice and background noise&lt;/p&gt;&#xA;" OwnerUserId="7103" LastActivityDate="2013-11-27T13:54:25.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12920" PostTypeId="2" ParentId="3471" CreationDate="2013-11-27T14:04:29.107" Score="1" Body="&lt;p&gt;Try to get a spectrogram with the overlap of pure white noise signal and your every column of your image, compare them in frequency domain. Remove the DC signal in your image before such operation.&lt;/p&gt;&#xA;" OwnerUserId="7103" LastActivityDate="2013-11-27T14:04:29.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12922" PostTypeId="2" ParentId="12825" CreationDate="2013-11-27T20:07:56.633" Score="0" Body="&lt;p&gt;In reply to your self-answer, the codebook is only one for the whole training set, it describes a set of visual words which might have some Human interpretation but it is not guaranteed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding on how to extract the patches of each keypoint I would say you have to consider as well the scale at which it was extracted (if a scale invariant descriptor was used) or the relevant path size of the descriptor itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As side comment, don't use the visualization of keypoints assigned to visual words as a measure of quality of your BoF model, several factors influence it and what the computer grants as similar might not have human interpretation as said before.&lt;/p&gt;&#xA;" OwnerUserId="4373" LastEditorUserId="4373" LastEditDate="2013-11-27T20:13:44.103" LastActivityDate="2013-11-27T20:13:44.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12923" PostTypeId="2" ParentId="11442" CreationDate="2013-11-28T01:00:13.383" Score="2" Body="&lt;p&gt;There is an open source on the similar project you may be interested: &lt;a href=&quot;http://sourceforge.net/projects/amc/&quot; rel=&quot;nofollow&quot;&gt;http://sourceforge.net/projects/amc/&lt;/a&gt;&#xA;The program generated chords and bass lines from .wav or .midi input.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2013-11-28T01:00:13.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12924" PostTypeId="1" CreationDate="2013-11-28T01:21:12.743" Score="6" ViewCount="1095" Body="&lt;p&gt;First, I just want to start off by saying that I am a programmer, and am no expert in complex algorithms, and will probably not be able to apply complex pseudo-code or other descriptions of a solution. I have already asked a similar question on one of the programming SE forums in hope of finding a code sample, but no one there had a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a stream of data that I get at around 10 snapshots per second. I wrote a (C#) controller that takes this data and adjusts some data-gathering parameters based on the distance away from the expected result. Currently, I just do a linear scale operation on my data so that the farther away I am from the expected result the more it corrects. The problem is that the incoming data stream is delayed by somewhere between 0.5 and 2 seconds (I can calculate that at runtime). Because of this delay, it is correcting for results from a while ago and is constantly overcorrecting and even sometimes correcting in the wrong direction. &#xA;I am looking for an algorithm to do the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Implement a correction algorithm (I'd prefer PID) that will attempt&lt;br&gt;&#xA;to hone-in on the optimal value &lt;/li&gt;&#xA;&lt;li&gt;Predict a certain amount of time (or &#xA;number of datasets) in advance based on the history of corrections and results; the values won't be exactly linear, but they will probably be close&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What options do I have in terms of algorithms that can accomplish this? As I said earlier, I am a programmer and therefore code samples would be appreciated; I am not great at converting complex pseudo-code in to a working implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;To address some questions in the comments...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I did make a small abstraction in my question. What's actually happening is I get a stream of data, calculate 3 (separate) numbers based on that data, and try to optimize those separately; each of them having their own output parameters. What I need from this algorithm is to be able to operate on a single number and optimize that. I would give it the history and a result and it would modify it's own output parameter. I can then just use the algorithm 3 times for each parameter.&lt;/li&gt;&#xA;&lt;li&gt;The rate does change slightly (usually at a slow pace), though I should be able to calculate the change if needed. But I don't need exact enough numbers to require variable prediction times; I can just pick an arbitrary number of snapshots to predict in advance and it should get me close enough to my result.&lt;/li&gt;&#xA;&lt;li&gt;It is a physical process and is noisy and generally not very accurate. I am taking my data stream and doing a bunch of estimations and tracking and things like that, so there are often outliers. There are many factors that make a basic model relatively easy, but anything more accurate would be completely off. Basically, I can't really model it to the extent of being useful. Just a note, the output values that this algorithm has to control are the 'drift', or rate of change. Currently I just scale the values so that the farther away the input is from the ideal the higher the output is (pretty simple).&lt;/li&gt;&#xA;&lt;li&gt;Are you asking for me to provide a sample of my data? I should be able to at some point, but it may take a few days for me to get the chance. To test it, I was (and am still) planning to just put the algorithm in a test program with a slider and a noise generator and see what happens.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7109" LastEditorUserId="7109" LastEditDate="2013-12-01T04:00:38.563" LastActivityDate="2014-01-03T05:45:48.860" Title="PID With Prediction" Tags="|algorithms|c#|non-linear|machine-learning|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12925" PostTypeId="2" ParentId="12914" CreationDate="2013-11-28T07:52:44.373" Score="1" Body="&lt;p&gt;The paper is not really well written, so it's not surprising that you're having a hard time. These are a few hints to guide you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the authors try to do some &lt;em&gt;mode detection&lt;/em&gt; on the image brightness histogram in order to segment it between common values in the image (= high density in their terminology) and rare values in the image (= low density);&lt;/li&gt;&#xA;&lt;li&gt;in order to segment the histogram, they fix a window width (i.e., a number of bin of the histogram), apply this window over all possible positions in the histogram and sum the populations of the bins inside the window ($Eq. (7)$). This gives the density of a histogram bin (or equivalently of a brightness level);&lt;/li&gt;&#xA;&lt;li&gt;their segmentation process consists then in going from the peaks of the histogram and merging neighbouring bins into it as long as the difference between the border bin and its neighbour (= the momentary change) is less than the average of the momentary changes in the region. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-11-28T07:52:44.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12926" PostTypeId="1" AcceptedAnswerId="12927" CreationDate="2013-11-28T10:31:34.113" Score="1" ViewCount="1419" Body="&lt;p&gt;Is wavelet a Nonlinear transform, or Not?&lt;br&gt;&#xA;specifically, continuous wavelet transform with morlet function.&lt;br&gt;&#xA;I am studying behavior of a dynamic system, and it has nonlinear behaviour. can I employ wavelet transform?   &lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2013-11-28T11:00:58.853" Title="Nonlinear wavelets transform?" Tags="|wavelet|non-linear|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12927" PostTypeId="2" ParentId="12926" CreationDate="2013-11-28T11:00:58.853" Score="4" Body="&lt;p&gt;A transform being linear has very little to do with its ability to analyze linear or nonlinear systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wavelet transform $W[s(t)]$ of a signal $s(t)$ is linear because $$W[a s_1(t) + b s_2(t)]=a W[s_1(t)]+b W[s_2(t)]$$ for real or complex $a$ and $b$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal you're analyzing is just a signal, it has no concept of linearity. However, if you try to come to conclusions about system properties of a nonlinear system, then you cannot break the analysis down to just a set of base signals to understand the system. In the worst case you would have to look at every possible intput/output pair. Often this can be simplified using known system properties like symmetries (i.e. time invariance).&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-11-28T11:00:58.853" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="12928" PostTypeId="1" CreationDate="2013-11-28T12:24:21.947" Score="1" ViewCount="83" Body="&lt;p&gt;Consider the stationary VAR process&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\bf X}_t = \sum_{\tau = 1}^{L} A_\tau {\bf X}_{t-\tau} +{\bf \epsilon}_t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the innovations $\epsilon_t \sim MVN({\bf 0},\Sigma)$ then is ${\bf X}_t$ a Gaussian stationary process? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it correct that due to the invertibility of the VAR into an MA and observing that ${\bf X}_t$ is the sum of zero mean MVN random variables the above is true, or is there a flaw somewhere in this.&lt;/p&gt;&#xA;" OwnerUserId="4534" LastActivityDate="2013-11-28T12:24:21.947" Title="Is a Stationary VAR Process with Zero Mean Gaussian Innovations a Gaussian Stationary Process?" Tags="|gaussian|autoregressive-model|stationary|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12929" PostTypeId="1" CreationDate="2013-11-28T12:29:57.150" Score="1" ViewCount="152" Body="&lt;p&gt;I'm trying implement in Java cubic spline interpolation based on this document:&#xA;&lt;a href=&quot;http://www.geos.ed.ac.uk/~yliu23/docs/lect_spline.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.geos.ed.ac.uk/~yliu23/docs/lect_spline.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first they show how to do linear spline and it's pretty easy. I create functions that calculate A and B coefficients. Then they extend linear spline by adding second derivative. C and D coefficients is easy co calculate too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But problems starts when I should calculate second derivative. I do not understand how they calculate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain that to me?&lt;/p&gt;&#xA;" OwnerUserId="5688" LastActivityDate="2013-11-28T12:29:57.150" Title="Extend linear spline interpolation to cubic spline interpolation - how calculate derivative" Tags="|interpolation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12930" PostTypeId="2" ParentId="11518" CreationDate="2013-11-28T15:32:18.200" Score="1" Body="&lt;p&gt;thanks for the input. I found a simple solution: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;sequence A: {...1,0,-1,0,1,0,-1,0...} (i.e. 1,0,-1,0 periodic) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sequence B: {0,x,y,x,y,0}&lt;/p&gt;&#xA;" OwnerUserId="5897" LastEditorUserId="5897" LastEditDate="2013-11-28T22:34:56.137" LastActivityDate="2013-11-28T22:34:56.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12931" PostTypeId="1" CreationDate="2013-11-28T16:36:53.473" Score="0" ViewCount="1695" Body="&lt;p&gt;I have just started working on FFT and its related phase factors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read for an N=2 point FFT, We have two phase factors, one on the positive axis and one on negative axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;similarly for an 4 point FFT, we have 4 phase factors as theta=(pi/2), at &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0'  W 40=1&#xA;-90' W 41=-j&#xA;180' W 42=-1&#xA; 90' W 43= j&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;here we can see the values that are 180 degree apart are negative to each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I wanted to know how it works for an 32 point FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As theta=(pi/16) do we have 16 phase factors on the positive axis and 16 phase factors on the negative axis with the interval of (pi/16) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so will it follow the pattern as I mentioned below?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0'       W16 0 =1&#xA;-11.25'   W16 1 =0.98 -j0.195&#xA;-22.5'    W16 2 =0.92 -j-0.38&#xA;and so on&#xA;....&#xA;....&#xA;till&#xA;-168.75'  W16 15=&#xA;and the negative parts of the above values from **W16 16** to **W16 32**&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I correct? please verify the above details and let me know how the phase factors works for an 32 point FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7114" LastEditorUserId="7114" LastEditDate="2013-11-28T17:19:33.637" LastActivityDate="2014-01-28T14:14:44.717" Title="Phase factors for an 32 point fft" Tags="|fft|dft|phase|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12933" PostTypeId="2" ParentId="10662" CreationDate="2013-11-28T18:10:41.840" Score="2" Body="&lt;p&gt;Some time ago I wrote some codes just to test some filters methods, and i could see how can be hard make certain frequencies disappear completely, some methods cause ripple effects in the signal and when you apply FFT on the filtred signal to see the frequency response, you note that the frequency you want to eliminate still be there, attenuated, but you can still see!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets go, three(3)  sinusoidal concatenated at 250 hz, 400 hz and 900hz sampled in 8000hz and I will try to eliminate 900hz from the original signal!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My First test, &lt;strong&gt;AKA a very simple equalizer in Frequency Domain&lt;/strong&gt;, calculate the dB attenuation &lt;strong&gt;10.^(dB/20)&lt;/strong&gt; and multiply by the FFT bin that you want eliminate, for dB attenuation -24dB my result was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3mlcd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Second test &lt;strong&gt;EQ biquad filter by Robert Bristow-Johnson (time domain)&lt;/strong&gt;, for dB attenuation -24dB my result was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PuApJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Third test &lt;strong&gt;biquad LPF by Robert Bristow-Johnson (time domain)&lt;/strong&gt;, my result was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L8ybe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And my last test using &lt;strong&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sinc Filter&lt;/a&gt; (Frequency Domain)&lt;/strong&gt;, my result was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EQOkx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that's all, in short, everything depends on what you really need !&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2013-11-28T18:17:03.243" LastActivityDate="2013-11-28T18:17:03.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12934" PostTypeId="1" AcceptedAnswerId="12936" CreationDate="2013-11-28T21:42:41.483" Score="0" ViewCount="239" Body="&lt;p&gt;In visual bag of words model, I have been able to construct the visual codebook through kmeans clustering of SIFT descriptors. How to calculate the feature vector for an image then?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P/S:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each image, we can find interesting SIFT points, and for each points we have a SIFT descriptor (which is usually a 128 length vector).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;im1 ==&gt; SIFT feature f1 (10 by 128) (here 10 is an abitrary number)&#xA;im2 ==&gt; SIFT feature f2 (20 by 128)&#xA;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we combine all SIFT features, f=[f1; f2; ..] and perform kmeans clustering we will get the codebook c=[c1; c2; .. c10] which is bow codebooks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the codebook how can we find the feature vectore, represent image im1?&lt;/p&gt;&#xA;" OwnerUserId="3802" LastEditorUserId="3802" LastEditDate="2013-11-29T06:07:46.960" LastActivityDate="2013-11-29T07:04:37.277" Title="Calculate bag of words feature vector" Tags="|computer-vision|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12935" PostTypeId="1" CreationDate="2013-11-28T22:17:32.130" Score="4" ViewCount="698" Body="&lt;p&gt;I have a differential equation that has been proven to be correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function obtained by Laplace domain analysis and Matlab freqs match up and all is well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is somewhere in my attempt to digitize the differential equation. I am required to do this using the trapezium rule to approximate the analog signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal is to get a digitized equation in the form of..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Vo^n+1 = alpha1(Vi^n+1) + alpha2(Vi^n) + alpha3(Vo^n)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where each alpha value is made up of a different combination of T, R1, R2 and&#xA;C all numerical parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am following some guidelines set by my lecturer but if the approach seems wrong please let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current incomplete solution..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YbCf1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QBAox.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I am trying to convert that equation to the Z domain and therefore use the freqz tool in Matlab. Please see the working out below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KlEJc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Matlab plot that shows what has gone wrong. The reason for the multiple lines are varying values of capacitance for C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/an1Jd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blue lines represent the validated analogue freqs(laplace domain transfer function) frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The green lines show my attempt at using the freqz(z domain discrete transfer function) frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is of any further interest, the code to generate those plots can be found below as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be sincerely appreciated, clutching at straws and the occasional hair at the moment!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Comparing the impulse amlitude response using two different methods&#xA;%&#xA;%  Basically checking if freqs matches freqz&#xA;&#xA;clc; clear all;&#xA;&#xA;% Circuit Parameters&#xA;R1 = 2.2e3;&#xA;C = 0.01e-6;&#xA;R2 = 10e3;&#xA;&#xA;fs = 10000;   % Sampling frequency (Hz)&#xA;T = 1/fs;     % Timestep&#xA;&#xA;% Coefficients&#xA;den = (T*R1 + T*R2 + 2*R1*R2*C);&#xA;&#xA;N = 1000;&#xA;&#xA;% Digital parameters&#xA;y = zeros(N,1);&#xA;y(1) = 1;&#xA;result = zeros(N,1);&#xA;&#xA;% Analogue parameters&#xA;fa = 0:fs/N:fs-fs/N;&#xA;w = 2*pi*fa;&#xA;j =sqrt(-1);&#xA;&#xA;&#xA;lastValue = 0;&#xA;&#xA;clf;&#xA;figure(1);&#xA;&#xA;hold on;&#xA;&#xA;for i=1:5&#xA;&#xA;% Analogue Recalculations&#xA;b = 1/(R1*C);&#xA;a = (R1 + R2)/(R1*R2*C);&#xA;Ha = freqs(b,[1 a], w);&#xA;&#xA;% Digital Recalculations&#xA;alpha1 = (T*R2)/den;&#xA;alpha2 = alpha1;&#xA;alpha3 = (2*R1*R2*C - T*R1 - T*R2)/den;&#xA;&#xA;[Hd,fd] = freqz([alpha1 alpha1],[1 alpha3],N,fs);&#xA;&#xA;for n=1:N-1&#xA;&#xA; currentValue = alpha1*y(n+1) + alpha2*y(n) - alpha3*lastValue;&#xA; result(n) = currentValue;&#xA; lastValue = currentValue; &#xA;end&#xA;&#xA;C = 1.5*C;&#xA;&#xA;plot(fa,abs(Ha),fd,abs(Hd)),xlabel('Frequency'),ylabel('H(s)');&#xA;&#xA;end&#xA;&#xA;hold off;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7116" LastEditorUserId="7116" LastEditDate="2013-11-28T23:48:10.837" LastActivityDate="2020-07-01T19:20:17.967" Title="Attempting to use the trapezoidal rule to form a difference equation representing a circuit" Tags="|matlab|filters|frequency-response|transfer-function|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12936" PostTypeId="2" ParentId="12934" CreationDate="2013-11-29T07:04:37.277" Score="1" Body="&lt;p&gt;The feature vector is just the histogram of how many times a feature from each cluster appeared in the image.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-11-29T07:04:37.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12937" PostTypeId="2" ParentId="12908" CreationDate="2013-11-29T08:42:48.393" Score="1" Body="&lt;p&gt;Unfortunately, I think what causes the problems is most probably the training set of images you're using to construct the tree. (or, more in general, the database you're working on). Without a way to inspect the concrete images, I can only give a few vague guesses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First, I would diagnose &lt;em&gt;where&lt;/em&gt; it goes wrong&lt;/strong&gt;, by simply inspecting the tree and looking at the first branches which become severely underpopulated and consequently don't branch any more in the lower levels. I would look at those features and... &lt;em&gt;think&lt;/em&gt;. But, since I can't actually do that since I don't have your dataset, let me try further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're afraid that it's the K-means that is going wrong, not because the features aren't (more-or-less) uniformly distributed over the feature space, but simply because of the way that algorithm works, before implementing a fancier algorithm, you might first try &lt;strong&gt;running K-means several times&lt;/strong&gt; for each branching and picking the best result (e.g. the one that divides the feature space in most equal parts). This will probably be too slow for the final implementation, but &lt;strong&gt;it could be a fast, minimum-effort way do diagnose the problem&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say, in order for HKM to work, your &lt;strong&gt;initial number of features should be several orders of magnitude greater than the expected number of clusters&lt;/strong&gt;. So, if that's not the case, you &lt;em&gt;know&lt;/em&gt; you're doing something wrong. I don't know how many is enough, but I would say &lt;em&gt;minimum $100$ times&lt;/em&gt;, but &lt;em&gt;better at least $1000$ times&lt;/em&gt; more features than expected clusters. This might be caused by two (related) issues:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Maybe &lt;strong&gt;your training set is just too small&lt;/strong&gt;, or maybe it is a bad representation of the database, &lt;strong&gt;containing images that are too similar&lt;/strong&gt;? Try increasing the size of the training set, and maybe (just for testing purposes), cherry pick the training set by selecting very different, representative images. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Maybe &lt;strong&gt;your feature detector performs badly on the image set you're using&lt;/strong&gt;. For some images, some detectors just do not detect enough features. Problematic images usually contain large single-colored areas (e.g. white wall, blue sky). &lt;strong&gt;Try combining several feature detectors&lt;/strong&gt;. (e.g. in &lt;a href=&quot;http://www.zemris.fer.hr/~ssegvic/project/pubs/bosilj12ms.pdf&quot; rel=&quot;nofollow&quot;&gt;my thesis&lt;/a&gt; I was working with DoG and MSER features). You can always do that, since you can finally describe all the features from several detectors with the same descriptor.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, there's no more ideas I can think of based on so little information. &lt;strong&gt;You might simply have an implementation error sometimes&lt;/strong&gt;. I know it's not easy to here, and it's not a most helpful diagnosis, but as somebody who actually implemented such a CBIR system, I have to tell you, I never had any problem in constructing a vocabulary tree of expected size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you give any more info, or updates, or whatever, I can try and think of other ways this might have gone wrong. Until then, I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2013-11-29T08:42:48.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12938" PostTypeId="2" ParentId="12931" CreationDate="2013-11-29T13:33:31.410" Score="1" Body="&lt;p&gt;The base functions of the discrete time Fourier transform takes on values from the set $$\{z\in\mathbb{C}:z^N=1\}$$ where $N$ is the dimension of the vector space. The solutions can be parametrized to be in the form $$z_k = \exp(2 \pi i \frac{k}{N})$$ for $k=0..N-1$ because $$z_k^N = \exp(2 \pi i k \frac{N}{N}) = \exp(2\pi i k) = 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the values the base functions components are chosen from are the $N$ non-identical $N$-th roots of 1, which are equidistantly distributed on the unit circle and include $1$ itself.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-11-29T13:33:31.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12939" PostTypeId="1" AcceptedAnswerId="12948" CreationDate="2013-11-29T13:56:33.103" Score="1" ViewCount="5435" Body="&lt;p&gt;I don't have background knowledge about signal processing before and new at Matlab too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have EEG data (with noise removed) 1x128; sampling rate = 128 Hz, It's means that I have 1 sec. data right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, I need to extracted to 5 frequency bands that are Delta (0-4 Hz), Theta (4-8 Hz), Alpha (8-16 Hz), Beta (16- 32 Hz) and Gamma (32-64 Hz) by Wavelet Transform (using Matlab), What is/are function--commands should I use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then, I need to compute the power spectrum (PSD) for each band, What is/are function--commands should I use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Input: X = [1:128] and I need&#xA;Output: Y = [psdOfDelta, psdOfTheta, psdOfAlpha, psdOfBeta, psdOfGamma]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7121" LastEditorUserId="7092" LastEditDate="2014-02-10T17:45:44.917" LastActivityDate="2014-02-10T17:45:44.917" Title="Wavelet Transfrom + Power Spectral Density (using Matlab)" Tags="|matlab|fft|power-spectral-density|eeg|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12940" PostTypeId="1" CreationDate="2013-11-29T14:57:52.197" Score="8" ViewCount="26009" Body="&lt;p&gt;I have a slight confusion differentiating between object recognition and object detection. Some people say object detection is a sub-topic of object recognition? Can someone clarify the the difference between these two topics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To the best of my knowledge:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Object Recognition is responding to the question &quot;What is the object in the image&quot; Whereas, Object detection is answering the question &quot;Where is that object&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope someone can illustrate the difference by also generously providing an example for each.&lt;/p&gt;&#xA;" OwnerUserId="7122" LastEditorUserId="76" LastEditDate="2013-11-30T01:26:55.800" LastActivityDate="2019-08-27T05:46:01.833" Title="Object detection versus object recognition" Tags="|image-processing|computer-vision|object-recognition|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12941" PostTypeId="2" ParentId="12940" CreationDate="2013-11-29T15:34:00.077" Score="12" Body="&lt;p&gt;You kind of answered your own question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Object Recognition:&lt;/strong&gt; which object is depicted in the image?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;input&lt;/em&gt;: an image containing unknown object(s)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly, the position of the object can be marked in the input, or the input might be only a clear image of (not-occluded) object.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;output&lt;/em&gt;: position(s) and label(s) (names) of the objects in the image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The positions of objects are either acquired form the input, or determined based on the input image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When labeling objects, there is usually a set of categories/labels which the system &quot;knows&quot; and between which the system can differentiate (e.g. object is either dog, car, horse, cow or bird).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Object detection:&lt;/strong&gt; where is &lt;em&gt;this&lt;/em&gt; object in the image?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;input:&lt;/em&gt; a clear image of an object, or some kind of model of an object (e.g. duck) and an image (possibly) containing the object of interest&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;output: position, or a bounding box of the input object if it exists in the image (e.g. the duck is in the upper left corner of the image)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2013-11-29T15:34:00.077" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12943" PostTypeId="1" CreationDate="2013-11-30T07:01:40.283" Score="0" ViewCount="65" Body="&lt;p&gt;I am working on blood vessel extraction, i want to know whether we can extract blood vessel using machine learning algorithm? which algorithm i can use to yield good results?&lt;/p&gt;&#xA;" OwnerUserId="5914" LastActivityDate="2013-11-30T07:01:40.283" Title="can we use machine learning concepts to extract blood vessel from retinal image?" Tags="|machine-learning|knn|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12944" PostTypeId="1" AcceptedAnswerId="12947" CreationDate="2013-11-30T08:10:27.130" Score="1" ViewCount="96" Body="&lt;p&gt;I have an IIR routine in C++ I'm trying to speed up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm using a DF2 implementation. Since my input signal will always be either 1.0 or -1.0 is it possible for me to optimize the algorithm, removing some calculations or precomputing values for given blocks of input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7125" LastActivityDate="2013-11-30T17:15:11.367" Title="Can I compute my IIR faster given limited possible input values?" Tags="|infinite-impulse-response|c|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12945" PostTypeId="1" CreationDate="2013-11-30T09:08:05.863" Score="0" ViewCount="323" Body="&lt;p&gt;I have read a signal in Matlab, resampled and implemented an FFT of each frame on it, now I want to rotate the domain of phase in each frame 90 degrees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a vector of FFT and used the function named &lt;code&gt;rot90(matrix)&lt;/code&gt;, that rotates a matrix 90 degrees, but I'm not sure it is what I wanted to work correctly on my function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do that in some other way?  Or does the &lt;code&gt;rot90&lt;/code&gt; correctly work on changing the phase of domain in FFT which has been imported into a vector?&lt;/p&gt;&#xA;" OwnerUserId="7070" LastEditorUserId="76" LastEditDate="2013-12-04T12:58:31.010" LastActivityDate="2013-12-04T12:58:31.010" Title="How to change the FFT phase domain of each frame by 90 degrees" Tags="|fft|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="12946" PostTypeId="2" ParentId="12945" CreationDate="2013-11-30T17:09:13.797" Score="0" Body="&lt;p&gt;For a spectrogram you don't usually want to rotate the phase of each FFT result by 90 degrees (although one might do something similar for a Hilbert transformer).  Instead you want to rotate each FFT complex result so that it is strictly real, which is identical to calculating the FFT bin magnitudes, and mapping a row vector of magnitudes onto a column inside a 2D spectrogram matrix.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-30T17:09:13.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12947" PostTypeId="2" ParentId="12944" CreationDate="2013-11-30T17:15:11.367" Score="1" Body="&lt;p&gt;Depends on the hardware running your C++ code.  If you have a slow multiply unit and fast branching, then you might be able to replace a few slower multiply-adds with faster adds or subtracts.  But on most modern GHz CPUs, the add/sub branch penalty will likely be slower than a floating-point mul-add by +-1.0.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-11-30T17:15:11.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12948" PostTypeId="2" ParentId="12939" CreationDate="2013-11-30T18:49:56.430" Score="1" Body="&lt;p&gt;You need to do 1-Dimensional wavelet package decomposition. &lt;a href=&quot;http://www.mathworks.de/de/help/wavelet/ref/wpdec.html&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is the matlab documentation for the command to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some example code based on what you've described above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wpt = wpdec(X, 2, 'db1', 'shannon')&#xA;plot(wpt)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will provide a nice clickable graph. As you'll see in the documentation, you can provide a lot of different parameters for the decomposition.&lt;/p&gt;&#xA;" OwnerUserId="7088" LastActivityDate="2013-11-30T18:49:56.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12949" PostTypeId="1" CreationDate="2013-11-30T18:57:50.623" Score="1" ViewCount="232" Body="&lt;p&gt;I have a signal I'm getting from a sensor (shown below in the photo of an excel plot) and I need to process it to get it to look something like the red line I've overdrawn on it.  Sort of a moving average type process that doesn't fall too quickly unless the overall signal is actually falling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any ideas as to what the best method(algo) would be to approach this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on directions I could look towards would be helpful as well, it's been years since I took signal processing in school and I don't remember what methods are even out there that could be tried.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jonathan&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AzJtR.png&quot; alt=&quot;Signal from sensor&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7126" LastEditorUserId="128" LastEditDate="2019-06-26T08:51:03.773" LastActivityDate="2019-06-26T08:51:03.773" Title="Building a Signal Model for Samples from a Sensor" Tags="|frequency-spectrum|adaptive-algorithms|least-squares|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12950" PostTypeId="2" ParentId="12945" CreationDate="2013-12-01T05:35:52.270" Score="1" Body="&lt;p&gt;It sounds like you're trying to plot the FFT such that the result is centered at 0, instead of at Fs. Matlab has a function for this &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/fftshift.html&quot; rel=&quot;nofollow&quot;&gt;fftshift&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a simple example when trying to plot either the onesided or twosided FFT.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = 100; % Signal frequency (Hz)&#xA;fs = 1024; % Sampling frequency (Hz)&#xA;N = 1024; % Number of samples&#xA;Nfft = 1024; % FFT size&#xA;&#xA;xf = 20*log10(abs(fft(x, Nfft))); % Compute the PSD&#xA;&#xA;fw1 = fs * (0:Nfft/2)./Nfft; % Onesided domain&#xA;fw2 = fs * (-Nfft/2:Nfft/2-1)./Nfft; % Twosided domain&#xA;&#xA;figure&#xA;subplot(211), plot(fw1, xf(1:Nfft/2+1)), title('Onesided')&#xA;subplot(212), plot(fw2, fftshift(xf)), title('Twosided')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-12-01T05:35:52.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12951" PostTypeId="2" ParentId="12949" CreationDate="2013-12-01T06:46:35.313" Score="-2" Body="&lt;p&gt;Looks like you're looking for the envelope of that signal. You can actually go back to your original audio signal, load it into Matlab, or something that has the necessary functions, and take the sum of the signal and [imaginary unit] times it's Hilbert transform to get a complex-valued &quot;analytic signal&quot;. The magnitude of the analytic signal is the envelope, and should be pretty close to what you are drawing for a red line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read up on it here: &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Analytic_signal&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7090" LastActivityDate="2013-12-01T06:46:35.313" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12952" PostTypeId="2" ParentId="12874" CreationDate="2013-12-01T13:42:39.943" Score="2" Body="&lt;p&gt;One approach is find all contours in your source image and compute the area of each contour. And finally ignore the contours who have area greater than a threshold. You can refer to &lt;a href=&quot;http://www.imageprocessingplace.com/downloads_V3/root_downloads/tutorials/contour_tracing_Abeer_George_Ghuneim/connectivity.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Processing Place: Contour tracing - Defining connectivity&lt;/a&gt; to know more about contour processing.&lt;/p&gt;&#xA;" OwnerUserId="4799" LastEditorUserId="7092" LastEditDate="2023-01-22T20:01:18.590" LastActivityDate="2023-01-22T20:01:18.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12955" PostTypeId="2" ParentId="12949" CreationDate="2013-12-01T18:23:19.903" Score="2" Body="&lt;p&gt;A simple exponential average has the following difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(n) = (1-alpha) * x(n) + alpha * y(n-1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a different rise and fall rate, you can dynamically choose alpha depending on whether x(n) is larger than y(n-1). For example, you could build have alpha = 0 when x(n) &gt; y(n-1), and alpha = 0.99 otherwise. This could accomplish the &quot;peak hold&quot; goal, and the second value of alpha would let you control the decay after each peak.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2013-12-01T18:23:19.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12956" PostTypeId="1" CreationDate="2013-12-01T20:11:03.050" Score="1" ViewCount="65" Body="&lt;p&gt;I have an application which creates a Gaussian model of the background based on consecutive frame difference and auto-generates a threshold for separating no-changes to movements. The application works perfectly for artificial lighting. But when daylight is present alongside artificial light, I get something like ths &lt;img src=&quot;https://i.stack.imgur.com/DY4Vm.jpg&quot; alt=&quot;following image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red dots corresponds to some scalar quantity under steady lighting conditions, and the green ones correspond to the sudden changes in illumination levels. As a result of the green spikes, selecting a threshold at the red-level would mean a lot of false positives where as selecting a threshold at the green level essentially means that detection probability falls because the small movements are not detected. What I tried was selecting separate thresholds for the green region and the red region but still the detector performance barely improved. Is there any known approach for tackling this problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;False corresponds to the False Alarms. My model was if $RedMean-maxR\times RedVariance &amp;lt; val &amp;lt; RedMean + maxR\times RedVariance$ &#xA;then no movement where $maxR =  max(\frac{RedElement_{i} -RedMean}{RedVariance})$ and likewise for the green region and anything lying between the red and green would be classified as small movement.&lt;/p&gt;&#xA;" OwnerUserId="4902" LastActivityDate="2013-12-01T20:11:03.050" Title="Thresholding for Movement Classification" Tags="|image-processing|image-segmentation|gaussian|thresholding|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12958" PostTypeId="1" AcceptedAnswerId="54896" CreationDate="2013-12-02T03:52:13.643" Score="5" ViewCount="1402" Body="&lt;p&gt;I've been playing with DTMF frequencies and the Goertzel algorithm, and would like to know exactly HOW the DTMF frequencies were determined. I understand that they were chosen such that none of the frequencies would be equal to sum and difference frequencies, or intermodulation products, but I can't find any information on whether the frequencies were simply determined through experimentation, mathematical calculation, etc… does anyone know more about this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I would like to understand how to extend the two sets of frequencies to two sets of 8 frequencies, or 3 sets of 4 frequencies, such that it's possible to represent 64 keys. I'm not sure whether it would be easier to work with 3 sets of 4 versus 2 sets of 8 each. I guess the analysis would be easier if just using 2 sets of 8? There would be less intermodulation products to keep in mind … &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&#xA;B&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: if it's too difficult to track back how this was achieved, i would like to know what the best way is to find 2 sets of frequencies, giving 64 unique combinations, and such that if you pick 2 frequencies from each of the 2 sets randomly, and mix the sine waves together, and put them through some non linear distortion, they are still easily detectable using goertzel, and the other frequencies are not &quot;hit&quot; (their bins remain at a normal background noise level) &lt;/p&gt;&#xA;" OwnerUserId="5762" LastEditorUserId="-1" LastEditDate="2013-12-03T18:15:44.077" LastActivityDate="2020-11-18T15:11:17.940" Title="how were DTMF frequencies determined exactly and how can I extend them?" Tags="|fft|frequency-spectrum|signal-analysis|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12959" PostTypeId="1" CreationDate="2013-12-02T05:51:27.883" Score="2" ViewCount="264" Body="&lt;p&gt;I am working on a SLAM algorithm as part of my research and I am having issues reliably  extracting landmarks from sensor (Kinect) data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I've never dealt with machine vision before.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking to detect corners and their range/heading in real-time (close to 100 Hz if possible?).&#xA;The main control software runs on Matlab.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;My current method does the following:&#xA;1) Median filter on depth data&#xA;2) Get middle horizontal depth frame (1x640 vector)&#xA;3) `clusterdata` to segment&#xA;4) least squares line fit segments&#xA;5) merge segments that are adjacent with similar slopes&#xA;6) find intersections of /good/ data&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My results are mediore at best. &lt;a href=&quot;http://pastebin.com/qCwAGsh6&quot; rel=&quot;nofollow noreferrer&quot;&gt;Current CornerDetection.m&lt;/a&gt; if anybody is curious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fuwHY.png&quot; alt=&quot;Corner Detection&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I approaching this wrong? Should I be looking at full frames instead of a single row? Should I be using any /big-boy/ of the methods I keep reading about? (Hough transform, Harris, Canny, LSD) Are there real-time methods for doing these kinds of processing operations on typical (intel i3) laptop? I've been shying away from them due to their (percieved) processing requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The landmark extraction is not the focus of the project, and the method need not be original at all. Any required reading or pointers or Matlab functions I should look at would be very helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full Disclosure: I have a similar question over at &lt;a href=&quot;https://stackoverflow.com/questions/20316793/corner-detection-in-2d-vector-data&quot;&gt;StackOverflow&lt;/a&gt; but a friend mentioned that this SE does the /real/ MV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I should add, the environment is highly structured and is almost entirely square hallways on flat floors.&lt;/p&gt;&#xA;" OwnerUserId="7131" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-12-02T06:15:31.310" Title="Landmark Extraction via Kinect" Tags="|image-processing|matlab|computer-vision|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12960" PostTypeId="1" CreationDate="2013-12-02T08:19:58.123" Score="0" ViewCount="729" Body="&lt;p&gt;I need to propose a masters degree topic, and I'd like it to be in digital image processing. What are currently relevant topics in this area? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose that I'm looking for some kind of optimization, either in hardware (like parallel processor architecture for image processing maybe) or software (image processing alogrithms optimization of some sort, maybe even in signal processing domain). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm leaning towards a software topic, because I think I can manage mathematics and algorithms better than computer engineering, compared to other people I guess. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please suggest some contemporary topics and areas you believe are suitable for possible optimization, that could be achieved in a masters program :) &lt;/p&gt;&#xA;" OwnerUserId="4710" LastActivityDate="2013-12-02T08:19:58.123" Title="Digital Image Processing - Contemporary Research Topics" Tags="|image-processing|algorithms|optimization|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12962" PostTypeId="1" AcceptedAnswerId="12964" CreationDate="2013-12-02T21:51:03.263" Score="0" ViewCount="246" Body="&lt;p&gt;I am trying to implement the algorithm described in &lt;a href=&quot;http://www.nhchau.com/files/AudioFingerprint-02-FP04-2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper. However, I am having trouble understanding the last part where I need to find the energy differences of bands. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In another paper, this process is described as shown below. Also, I am not sure I understand that either. What exactly I should do in this part of the algorithm ? Any hints or tips would be really appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wb7W7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7139" LastActivityDate="2013-12-03T20:35:29.860" Title="Audio fingerprinting - 2D (time - frequency) filter / Energy differences" Tags="|filters|audio|frequency-spectrum|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12963" PostTypeId="1" CreationDate="2013-12-02T23:59:34.547" Score="0" ViewCount="74" Body="&lt;p&gt;I have trouble to distinguish these two concepts namely ergodic process and strict-sense stationary process. I look at one of the books about the signal processing that says an ergodic process must be a strict-sense stationary one. So how to show this property?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Victor&lt;/p&gt;&#xA;" OwnerUserId="7141" LastActivityDate="2013-12-02T23:59:34.547" Title="How to show that an ergodic process must be a strict-sense stationary one?" Tags="|ergodic|stationary|" AnswerCount="0" CommentCount="4" ClosedDate="2013-12-04T14:17:03.697" ContentLicense="CC BY-SA 3.0" />
  <row Id="12964" PostTypeId="2" ParentId="12962" CreationDate="2013-12-03T00:45:29.007" Score="2" Body="&lt;p&gt;If you split the signal in 33 Frequency bands for every frame you will have a vector &lt;code&gt;band&lt;/code&gt; containing all subbands, all right, and now to compute the Energy Difference from each Band you just need to do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E(x)=\sum_{k=1}^{32}band(k) - \sum_{k=1}^{32}band(k+1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first frame compute the equation above, and for all others frames block, You can do something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E2(x)=\sum_{k=1}^{32}band(k) - \sum_{k=1}^{32}band(k+1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(n,m)= 1 if(E2 -E)&amp;gt;0$$&#xA;$$F(n,m)= 0 if(E2 -E)&amp;lt;=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E(x) = E2(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will generate a 32 bits array (0's and 1's) in $F$, Your end result should be a matrix of dimension 32x256, and it is your fingerprint !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answering your other question, if you are following the article exactly as described, the frame rate used in the paper is 5000hz, then each sub-fingerprints 32x1 is equivalent at 0,0116ms of audio its give you an analyze of &lt;code&gt;58 Frames = 0,0116 * 5000&lt;/code&gt;, it does not contain enough information to make a fingerprint, you'll need something comes close to 3 seconds and 256 comes very close look, &lt;code&gt;0,0116 * 256 = 2,9696&lt;/code&gt;, Ok you need do one fingerprint for ever 256 sub-fingerprints and it will create a lot of 32x256 matrix for your audio :-)    &lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2013-12-03T20:35:29.860" LastActivityDate="2013-12-03T20:35:29.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12966" PostTypeId="1" AcceptedAnswerId="12967" CreationDate="2013-12-03T03:40:46.860" Score="1" ViewCount="4712" Body="&lt;p&gt;I would like to clarify one doubt regarding autocorrelation function $R_x (\tau)$ of a process $X(t)$. Suppose $R_x (\tau) = \Pi (\tau)$, where $\Pi (\tau)$ is the rectangular function. Then is the process $X(t)$ deterministic.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2013-12-03T09:24:33.647" Title="If an autocorrelation function of a process is a rectangular function, then is the process deterministic?" Tags="|autocorrelation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12967" PostTypeId="2" ParentId="12966" CreationDate="2013-12-03T09:24:33.647" Score="4" Body="&lt;p&gt;An autocorrelation function like that is not possible for ordinary signals. The autocorrelation function is the Fourier transform of the power spectral density, which is a strictly positive quantity. However, to get a rectangular function as Fourier transform you need to have negative values. That is in conflict with the strictly positive power spectrum.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-12-03T09:24:33.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12968" PostTypeId="1" AcceptedAnswerId="12986" CreationDate="2013-12-03T10:42:49.873" Score="0" ViewCount="1185" Body="&lt;p&gt;I'm trying to implement a normalized cross-correlation algorithm but I don't get what in fact is this measure. What confuses is the wikipedia definition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1}{n} \sum \frac{(f(x,y)- \overline{f})(t(x,y)- \overline{t}) }{\sigma_{f}\sigma_{t}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which result is an scalar (AFAIK)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then adds other way to measure it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left \langle \frac{F}{\left \| F \right \|},\frac{T}{\left \| T \right \|} \right \rangle $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $F$ and $T$ are normalized vectors and $\left \langle . , . \right \rangle$ is the inner product. But the output will be a vector, isn't? Isn't supposed to give me a scalar as well? Am I getting something wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to implement this formula and use it with matrices with same dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="4222" LastActivityDate="2013-12-03T20:34:31.857" Title="Normalized cross-correlation in detail" Tags="|image-processing|cross-correlation|statistics|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12969" PostTypeId="1" CreationDate="2013-12-03T10:59:33.283" Score="1" ViewCount="237" Body="&lt;p&gt;I need to find the timedelay between two signals.  I guess MSE is the best approach. How to find that MSE?  I am writing the code and I have access to the autocorrelation matrix of one signal and the crosscorrelation of both signals plus the power of the signal.  Is this enough information to calculate the MSE?  Any tips on how that would be done? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7145" LastActivityDate="2021-08-10T14:50:16.080" Title="Delay Search of two signals" Tags="|peak-detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12970" PostTypeId="2" ParentId="10972" CreationDate="2013-12-03T12:39:57.630" Score="1" Body="&lt;p&gt;If you don't have a model, you need to make one up. For example if your data indicates that the flow is more of a function of the month than the year, you could simply predict the flow in say, March, as the average of the flows in March from 1900-1950.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now there may be also variation in the yearly flow. You can check whether the yearly average varies randomly (and is such unpredictable other than by mean)or whether there is correlation between neighboring years. If there is correlation you could try linear prediction and/or auto regression or polynomial extrapolation to refine your number for the average flow in 1951.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good way to test and tweak your model is to use the data from 1900 to for example 1940 to predict the data for 1941 and then compare to the actual data. You can repeat for the last 10 or 20 years of actual data.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-03T12:39:57.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12971" PostTypeId="2" ParentId="12969" CreationDate="2013-12-03T12:52:40.083" Score="2" Body="&lt;p&gt;As long as the two signals are simply delayed versions of each  other the delay is simply given by the point in time where maximum of the cross correlation occurs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signals are uncorrelated, then the question is meaningless. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tricky part is when the two signals are partially correlated or are filtered versions of the same original signal. In this case you will first need to define what exactly you mean by &quot;delay&quot;. One possible way to approach this would be to time shift the signals against each other, subtract them and sum the squares. The shift that results in the minimum energy in the difference would be considered the delay. Something like $d = min[sum((x(n)-y(n-d))^{2})]$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-03T12:52:40.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12972" PostTypeId="1" AcceptedAnswerId="12973" CreationDate="2013-12-03T09:04:55.090" Score="21" ViewCount="50711" Body="&lt;p&gt;I am currently toying around with the Discrete Fourier Transform (DFT) in Matlab to extract features from images. I like to fully understand the concepts that I use. I have read several explanations, such as &lt;a href=&quot;http://cns-alumni.bu.edu/~slehar/fourier/fourier.html&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;, but so far, none really explained the meaning of the &quot;DC term&quot;. All I know is that the k'the term of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Definition&quot; rel=&quot;noreferrer&quot;&gt;DFT&lt;/a&gt; can be written as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://latex.codecogs.com/png.latex?F_k%3d%5csum_%7bj%3d0%7d%5e%7bN-1%7d%7bx_j%5comega%5e%7bk%5c%2cj%7d%7d&quot; alt=&quot;DFT&quot;&gt;&#xA;where &#xA;&lt;img src=&quot;https://latex.codecogs.com/png.latex?%5comega&quot; alt=&quot;DFT&quot;&gt; is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Twiddle_factor&quot; rel=&quot;noreferrer&quot;&gt;twiddle factor&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that the first term (the DC term), &lt;img src=&quot;https://latex.codecogs.com/png.latex?F_0%3d%5csum_%7bj%3d0%7d%5e%7bN-1%7d%7bx_j%7d&quot; alt=&quot;DFT&quot;&gt;, is an amplitude without frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain why is it called the DC term? What is it's relation to &quot;Direct Current&quot;? And what is the relevance of the DC term? When is it useful, and for what?&lt;/p&gt;&#xA;" OwnerUserId="7156" OwnerDisplayName="Domi" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:35.963" LastActivityDate="2021-12-28T02:01:43.837" Title="Discrete Fourier Transform: What is the DC Term really?" Tags="|image-processing|matlab|fft|dft|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12973" PostTypeId="2" ParentId="12972" CreationDate="2013-12-03T09:13:38.053" Score="15" Body="&lt;p&gt;The DC term is the 0 Hz term and is equivalent to the average of all the samples in the window (hence it's always purely real for a real signal). The terminology does indeed come from AC/DC electricity - all the non-zero bins correspond to non-zero frequencies, i.e. &quot;AC components&quot; in an electrical context, whereas the zero bin corresponds to a fixed value, the mean of the signal, or &quot;DC component&quot; in electrical terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as practical applications go, the DC or 0 Hz term is not particularly useful. In many cases it will be close to zero, as most signal processing applications will tend to filter out any DC component at the analogue level. In cases where you might be interested it can be calculated directly as an average in the usual way, without resorting to a DFT/FFT.&lt;/p&gt;&#xA;" OwnerUserId="39" OwnerDisplayName="Paul R" LastEditorUserId="39" LastEditDate="2013-12-04T09:41:04.550" LastActivityDate="2013-12-04T09:41:04.550" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12974" PostTypeId="2" ParentId="12972" CreationDate="2013-12-03T09:13:56.477" Score="9" Body="&lt;p&gt;The term &quot;DC&quot; comes from the field of signal processing back when signals were actually small currents on a copper wire... An electrical signal was usually transmited as a small modulation  (&quot;AC&quot;) over a strong and fixed current/volatage (&quot;DC&quot;). The strong fixed current usually determined the electrical properties of the analog components of the circuit designed to &quot;process&quot; the signal. For example, an amplifier composed of several transistors will have different resistance/delays values depending on the input DC. Thus the designer of the analog circuit will specify a certain DC over which the signal can be &quot;processed&quot; properly by the device.&lt;/p&gt;&#xA;" OwnerUserId="7146" OwnerDisplayName="Shai" LastActivityDate="2013-12-03T09:13:56.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12975" PostTypeId="1" AcceptedAnswerId="12976" CreationDate="2013-12-03T13:50:00.617" Score="0" ViewCount="127" Body="&lt;p&gt;I am trying to filter a signal using a given FIR band stop filter. I have to implement a band pass filter.  Assuming I want to get the signal between normalized cutoff frequencies [0.2,0.3] - can I use two band stop filters over the same signal - one for the range [0,0.2) and second for the range (0.3,1] ?&lt;/p&gt;&#xA;" OwnerUserId="5846" LastEditorUserId="76" LastEditDate="2013-12-04T02:45:26.630" LastActivityDate="2013-12-04T02:45:26.630" Title="Is it possible to implement FIR band pass filter using two FIR band stop filters?" Tags="|infinite-impulse-response|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12976" PostTypeId="2" ParentId="12975" CreationDate="2013-12-03T14:15:49.190" Score="2" Body="&lt;p&gt;Yes, there's no reason why you couldn't do that. If you cascade two systems in series, the overall transfer function (and therefore frequency response) is the product of the two systems' individual responses. Therefore, you can apply the first filter to attenuate frequencies in the range $[0,0.2\pi]$, then the second will attenuate frequencies in the range $[0.3\pi, \pi]$. The result is that all frequencies except for those in the range $(0.2\pi, 0.3\pi)$ are attenuated, which looks a lot like a bandpass filter response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Don't take the choices of brackets/parentheses in the intervals above too seriously. Any realizable filter has a finite-width transition region, not instant transitions between passband and stopband.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-12-03T14:15:49.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12977" PostTypeId="2" ParentId="12968" CreationDate="2013-12-03T14:32:55.520" Score="1" Body="&lt;p&gt;The inner product or dot product or scalar product will not output a vector, it will output a scalar which is (with exception of the $1/n$ in front of the sum) the same as the first equation that you gave. &lt;a href=&quot;http://en.wikipedia.org/wiki/Dot_product&quot; rel=&quot;nofollow&quot;&gt;See here for details&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2013-12-03T14:32:55.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12978" PostTypeId="1" CreationDate="2013-12-03T14:45:33.947" Score="0" ViewCount="217" Body="&lt;p&gt;I have a low-voltage amplifier with an analog LPF of ~106 Hz and a HPF of 0.482 Hz (both first-order RC).  I can choose to apply a calibration pulse that will shut off the input and send a 500uV, 5Hz square wave across this analog filter band.  The amplifier is followed by an ADC and I'm receiving all values in code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to use this calibration signal?  Is it possible to &quot;reverse&quot; the effects of the analog filters if I know what the input signal is, so that I could then calculate gain values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I will add that I have the basic calibration idea down... I am averaging the top and bottom values of the square wave (ignoring the transition values) and scaling to the expected 500uV.  I am looking for a way to account for the settling of the square wave due to the HPF.&lt;/p&gt;&#xA;" OwnerUserId="5010" LastEditorUserId="5010" LastEditDate="2013-12-03T14:50:46.077" LastActivityDate="2013-12-03T14:50:46.077" Title="How to reverse the effect of analog RC filters on calibration pulse?" Tags="|bandpass|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12979" PostTypeId="1" CreationDate="2013-12-03T15:50:24.470" Score="4" ViewCount="4512" Body="&lt;p&gt;I have sucessfully implemented a STFT (+inverseSTFT with perfect reconstruction of original signal, with overlap add, etc.) in order to work on audio files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this STFT / iSTFT framework, I have tested :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Basic &quot;noise reduction&quot; algorithm that works by spectral subtraction of a noise template -&gt; it works very well !&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hi-pass filtering by zeroing the lowest bins (or, better idea : multiplying these lowest bins by a smooth window, like Hann).  It works (the filtering is good to my ears), but the spectrogram is not what I want : &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rTTQq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would prefer (for the low frequency 0hz-300hz) something like :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QJXon.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What should I do in the STFT array in order to do a good hi-pass filtering?&lt;/strong&gt; (i.e. having a clean spectrogram in the low frequencies like the second picture here)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS : here is the STFT scheme I use in Python :  &lt;a href=&quot;http://pastebin.com/MdycVLQk&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/MdycVLQk&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-12-03T19:55:25.913" LastActivityDate="2013-12-03T21:51:04.397" Title="Filtering with STFT" Tags="|fft|filters|filter-design|signal-analysis|stft|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="12980" PostTypeId="1" CreationDate="2013-12-03T15:54:26.257" Score="1" ViewCount="3649" Body="&lt;p&gt;Can somebody provide me with the mathematical equation to calculate relative and absolute power of a signal (continuous) from FFT. &lt;/p&gt;&#xA;" OwnerUserId="7148" LastActivityDate="2013-12-03T15:54:26.257" Title="Mathematical equation for 'Relative and absolute power' of a signal" Tags="|continuous-signals|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12981" PostTypeId="1" CreationDate="2013-12-03T15:59:38.470" Score="0" ViewCount="72" Body="&lt;p&gt;Contextual knowledge (CK) is used in some AI application, Can someone give me a concrete definition of this term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on ontologies( a set of concepts and relationships among them) and computer vision. I basically aim at integrating knowledge (ontologies) and visual features extracted from images to leverage machine vision techniques.  I crossed one of the scientific research paper and I encountered the term &quot;Contextual Knowledge&quot; and they give no explicit or even abstract description of it and that makes me wonder about it. Intuitively, I believe, it is used in knowledge representation or knowledge based construction and it must have something to do with databases... But unfortunately, I couldnt find the concrete and informative information about it or even its use in different disciplines&lt;/p&gt;&#xA;" OwnerUserId="7122" LastEditorUserId="7122" LastEditDate="2013-12-04T17:03:58.967" LastActivityDate="2013-12-04T17:03:58.967" Title="What is contextual Knowledge?" Tags="|computer-vision|machine-learning|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="12983" PostTypeId="2" ParentId="12979" CreationDate="2013-12-03T17:35:30.960" Score="0" Body="&lt;p&gt;You cannot just multiply the STFT frames with your filter response and invert the fourier transform to get a filtered signal. Any multiplication in frequency domain is a convolution in time domain. And the frequency response you use has a certain time domain kernel associated with it. This kernel will wrap around at the two frame boundaries when you convolve like that, because FFT convolution is inherently circular. Specifically steep filters like your high pass will have a rather long range effect on samples and introduce the artifacts you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is to use overlap add or overlap save convolution schemes that turn the circular convolution into linear convolution.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-12-03T17:35:30.960" CommentCount="32" ContentLicense="CC BY-SA 3.0" />
  <row Id="12984" PostTypeId="2" ParentId="12969" CreationDate="2013-12-03T19:02:48.743" Score="2" Body="&lt;p&gt;Hilmar's answer is perfectly correct though incomplete in some sense.&lt;/p&gt;&#xA;&lt;p&gt;For any two finite-energy signals both having the same energy,&#xA;one criterion for measurement of&#xA;how similar they are is the energy in the difference signal which&#xA;energy is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=-\infty}^\infty  |x[n]-y[n]|^2 \qquad\text{or}&#xA;\qquad \int_{-\infty}^\infty |x(t)-y(t)|^2 \textrm{d}t$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;depending on whether discrete-time or continuous-time signals are under&#xA;consideration.&#xA;For periodic signals, the sum or integration should be carried&#xA;out over the common period.&lt;/p&gt;&#xA;&lt;p&gt;But note that upon expanding &lt;span class=&quot;math-container&quot;&gt;$|x-y|^2 = (x-y)(x-y)^* = |x|^2 + |y|^2 -2\operatorname{Re}\left(xy^*\right)$&lt;/span&gt; and noting that&#xA;the first two terms, upon summation or integration, will give us&#xA;just the energy of the two signals, and so the criterion for&#xA;similarity is essentially the &lt;em&gt;inner product&lt;/em&gt; of the two signals;&#xA;the larger the inner product, the more similar the two signals.&lt;/p&gt;&#xA;&lt;p&gt;A  more general question would be not how similar &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;&#xA;are, but rather,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Which &lt;em&gt;delayed&lt;/em&gt; version (or time-advanced version) of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;&#xA;is most similar to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;We can construct measures of similarity&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=-\infty}^\infty  |x[n]-y[n-m]|^2 \qquad\text{or}&#xA;\qquad \int_{-\infty}^\infty |x(t)-y(t-\tau)|^2 \textrm{d}t$$&lt;/span&gt;&#xA;regarded as functions of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, and find the&#xA;value of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; for which the two signals are the&#xA;most similar.  Using the same arguments as before,&#xA;we arrive at the conclusion that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The delay (&lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;) for which the &lt;em&gt;cross-correlation&lt;/em&gt;&#xA;function &lt;span class=&quot;math-container&quot;&gt;$R_{x,y}[m]$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$R_{x,y}(\tau)$&lt;/span&gt; achieves its maximum&#xA;value is the delay for which &lt;span class=&quot;math-container&quot;&gt;$y[n-m]$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$y(t-\tau)$&lt;/span&gt;) is&#xA;the most similar to &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In short, the OP is perfectly correct in trying to use&#xA;mean-square error as the criterion for determining the&#xA;similarity of signals. However, upon further development&#xA;of the idea, we arrive at the solution provided by Hilmar:&#xA;look at the peak of the cross-correlation function&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="55891" LastEditDate="2021-08-10T14:50:16.080" LastActivityDate="2021-08-10T14:50:16.080" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12985" PostTypeId="2" ParentId="12979" CreationDate="2013-12-03T19:23:56.663" Score="3" Body="&lt;p&gt;The techniques you are referring to advanced techniques, and are generally known as &quot;Denoising via STFT-masking&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you create an STFT matrix, and mask its modulus (that is, the absolute magnitude of the STFT matrix) by whatever weights you chose. You can pick binary masks, (null out Time-Frequency bins you do not want while retaining Time-Frequency bins you do want), or you can perform soft-masking, in which the weights are not binary, but follow some metric commensurate with your data in the Time-Frequency plane. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, you apply an inverse STFT, and this can be done by finding the Least Squares Estimate of a time-domain signal, that would give the modified (complex) STFT after you have performed the masking. (See this paper &lt;a href=&quot;http://recherche.ircam.fr/anasyn/roebel/amt_audiosignale/VL2.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://musicweb.ucsd.edu/~sdubnov/catbox/Reader/GriffinLimMSTFT.pdf&quot; rel=&quot;nofollow&quot;&gt;Equation 6 of Griffin and Lin&lt;/a&gt; for a Least-Squares treatment of inverse STFT transforms via Time-Frequency bin nulling). (In your STFT inversion, you must also make sure that the sum of the window co-efficients across summed frames add up to unity, so often times half cycle sin window is used with 50% overlap in the STFT analysis. This is not the only solution however).   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore in its simplest incarnation, filtering out high-frequency components in the STFT domain means simply setting those STFT bins to zero, and then applying the Least-Squares Optimization algorithm to re-synthesizing your time-domain vector. (Similarly, if you want to do a high &lt;em&gt;pass&lt;/em&gt;, you can null out, or softly change, the STFT coefficients  in the low bands of the matrix). Note that the LSE will be intrinsic to the ISTFT if you use the Griffin paper.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-12-03T19:29:47.323" LastActivityDate="2013-12-03T19:29:47.323" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="12986" PostTypeId="2" ParentId="12968" CreationDate="2013-12-03T20:34:31.857" Score="3" Body="&lt;p&gt;An individual inner product does produce a scalar, but often when a cross correlation is calculated multiple individual cross correlations (i.e. dot products) are calculated at different time offsets.  These individual scalar results form a vector that is indexed by the relative time offset.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-12-03T20:34:31.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12987" PostTypeId="1" CreationDate="2013-12-03T20:43:56.833" Score="0" ViewCount="2162" Body="&lt;p&gt;I'm trying to design a MATLAB audio player that includes something like a 31-band equalizer. Right now I have the filters working by using the &lt;code&gt;FIR1()&lt;/code&gt; function to create an FIR bandpass filter at each frequency specified on the bands. This is great except that it's not exactly what I'm wanting to do. I want to either boost or cut the desired frequency, not isolate the frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about using these FIR filters in parallel to boost or cut the signal instead of just isolating the signal?&lt;/p&gt;&#xA;" OwnerUserId="7151" LastEditorUserId="76" LastEditDate="2013-12-04T04:35:48.210" LastActivityDate="2013-12-04T12:34:46.443" Title="28-Band Graphic Equalizer in Matlab" Tags="|matlab|filters|audio|filter-design|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12988" PostTypeId="2" ParentId="12987" CreationDate="2013-12-03T21:04:46.100" Score="2" Body="&lt;p&gt;I would suggest the peakingEQ biquad filter by &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow&quot;&gt;Robert Bristow-Johnson&lt;/a&gt;, you can use it to increase or attenuate one frequency or band-frequency, this can be easy to implement in matlab, I used to test and compare some filters, and it seems to work very well to equalizer, you can choose one dB input to do the work ! &lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-12-03T21:04:46.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12989" PostTypeId="2" ParentId="12979" CreationDate="2013-12-03T21:51:04.397" Score="2" Body="&lt;p&gt;You need to analyze the impulse response of your frequency domain modifications (treat it as a filter), and make sure the length of your overlap (using overlap save/add) is at least as long as the significant portion of this impulse response (above your desired noise level).  This may require a longer FFT, or a frequency domain modification with wider &quot;softer&quot; transition-bands (or both).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-12-03T21:51:04.397" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="12990" PostTypeId="2" ParentId="12913" CreationDate="2013-12-03T21:57:19.507" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, m and n are the dimensions of the image.  F(u,v) will be a complex-valued (real and imaginary) function of u and v.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes your equation is correct and F(u,v) is the result of the forward DFT. It is correct that F(u,v) has real and imaginary parts, and the multiplication of that into the complex sinusoid will result in a quantity that also has real and imaginary parts.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So how do you get back a real valued image if each of the numbers in the sum over u and v is complex? The key is that F(u,v) has certain symmetry properties due to f(i,k) being real valued.  This symmetry results in the sum over u and v adding up to a real number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same thing happens with the one-dimensional DFT.  In that case a real valued signal f(t) produces a conjugate symmetric DFT F(u) (F(u) = F*(N-u)). The symmetry is a bit more complicated in 2D, but that is why this works out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I often see students manipulate the DFT coefficients and accidentally destroy the conjugate symmetry. Then when they take the inverse DFT the result is complex valued when it should have been real valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that numerical errors will sometimes produce an inverse DFT that has a very small imaginary part, even though the symmetry is correctly preserved.  In these cases it is best to just take the real part as your result.&lt;/p&gt;&#xA;" OwnerUserId="7152" LastActivityDate="2013-12-03T21:57:19.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12991" PostTypeId="1" AcceptedAnswerId="12995" CreationDate="2013-12-03T22:16:19.233" Score="0" ViewCount="312" Body="&lt;p&gt;Assuming I have a set of frequencies $\mathbf F$, and I pick 2 frequencies $f_1$ and $f_2$ randomly from the set, generate sine waves for them, and pass the signals through a non-linear distortion process while adding them. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there any way for the harmonics or intermodulation distortion products to have a magnitude larger than the magnitude of any of the two frequencies, when calculating an FFT? &lt;/li&gt;&#xA;&lt;li&gt;If yes, under what conditions, and how can I avoid that this happens?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5762" LastEditorUserId="1629" LastEditDate="2016-03-16T19:38:00.217" LastActivityDate="2016-03-16T19:38:00.217" Title="Magnitude of intermodulation distortion products?" Tags="|fft|frequency-spectrum|frequency|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12992" PostTypeId="2" ParentId="2610" CreationDate="2013-12-03T23:17:28.550" Score="2" Body="&lt;p&gt;It seems that Python is a popular language for this with some good toolsets based on the fact that well... I've seen it in use in some music tech grad departments &amp;amp; companies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In academia, it is very common to see this type of work done in Matlab, since it brings together many powerful toolkits (Signal Processing, Parallel Computing, graphing, Database utilities, Machine Learning, AI) in an easy-to-probe IDE. However it costs money and has some drawbacks (not the best programming language in terms of application design &amp;amp; performance, so it is mainly a prototyping tool but can compile down to C). Octave is the free alternative but I can't vouch for the quality of the signal processing tools or the software itself since I have not used it.&lt;/p&gt;&#xA;" OwnerUserId="7153" LastActivityDate="2013-12-03T23:17:28.550" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12993" PostTypeId="2" ParentId="7895" CreationDate="2013-12-03T23:31:08.917" Score="1" Body="&lt;p&gt;The answer provided by Jason R in the comments --&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;dB values&quot; are really just a way of representing values on a logarithmic scale. Arithmetic-averaging values on a logarithmic scale is equivalent to geometrically averaging the original values (in linear scale). This probably isn't what you want. You probably would like a measure of total power in each band, which you would get by just summing the power spectrum bins across each band. You could divide by the number of bins, but if the bands aren't equal-width, that will add some bias to the result.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;does a good job of identifying the problem but I'm not sure it is a correct solution (or maybe I'm just reading it wrong). If a summation is to occur, it should occur on the raw magnitudes of the bins (before conversion to dB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;3dB + 3dB != 6dB&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to do a summation on the decibel scale is more complex than simply adding the values together. It can be done but if so you should do some reading on the dB scale and the nature of adding relative power. Doing the addition when still in a linear domain is easiest.&lt;/p&gt;&#xA;" OwnerUserId="7153" LastActivityDate="2013-12-03T23:31:08.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12995" PostTypeId="2" ParentId="12991" CreationDate="2013-12-04T04:32:15.787" Score="2" Body="&lt;p&gt;Certainly the amplitude of a harmonic can exceed the amplitude of the fundamental,&#xA;or the amplitude of an intermodulation product can exceed the amplitudes of the individual signals.   But this occurs when the system is so nonlinear that it would&#xA;make no sense to use it as an approximation to a linear system.&#xA;Indeed, the very&#xA;fact that such a nonlinear system &lt;em&gt;is&lt;/em&gt; being used (intentionally) &#xA;means that it has some properties&#xA;that are useful in the application at hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; If the system is a squarer that produces output $x^2(t)$, then&#xA;with $x(t) = \cos(2\pi f_c t)$, the output is &lt;em&gt;entirely&lt;/em&gt; the&#xA;second harmonic (and a DC term). Since the fundamental is entirely&#xA;absent from the output, the harmonic amplitude is infinitely larger&#xA;than the fundamental.  If two sinusoidal inputs of frequencies $f_1$ and&#xA;$f_2$ are added together before the&#xA;squaring operation, then the output has second harmonics at frequencies&#xA;$2f_1$ and $2f_2$, intermodulation distortion products at frequencies&#xA;$f_1+f_2$ and $|f_1-f_2|$ and &lt;em&gt;no&lt;/em&gt; fundamentals at frequencies $f_1$ and&#xA;$f_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Moral:&lt;/strong&gt; Don't use a squarer and pretend it is a linear addition circuit&#xA;or linear amplfier. If you &lt;em&gt;are&lt;/em&gt; knowingly using a squarer, it is for&#xA;some other useful properties (e.g. frequency doubler) of the circuit that&#xA;are important to you right now.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-12-04T04:32:15.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="12996" PostTypeId="2" ParentId="12924" CreationDate="2013-12-04T04:53:33.320" Score="1" Body="&lt;p&gt;This is just a start, because I am not sure I fully understand the problem yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot of what I think is happening. The blue curve is the &quot;truth&quot; of your quantity and the red curve is a delayed, noisy, measured version of it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this look like your problem? If not, how should it be changed to make it look more like it?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kRRwj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that a modified Kalman filter (a Kalman predictor) will be able to give you something, but I want to understand what your data looks like first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question: How do you know that there's a delay between the &quot;truth&quot; and your measurement?  I'm trying to get a handle on what numbers we have to play with to correct for the time delay.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Scilab code to generate the figure.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Q 12924&#xA;N = 1000;&#xA;process_noise = rand(1,N,'norm');&#xA;mid = filter(ones(1,20)/20,1,process_noise);&#xA;alpha = 0.99;&#xA;truth = filter(1-alpha,[1 -alpha], mid);&#xA;&#xA;clf;&#xA;plot(truth);&#xA;&#xA;max_delay = 50;&#xA;true_delay = floor(rand(1,1,'uniform')*max_delay);&#xA;&#xA;sigma = 0.01;&#xA;measurement_noise = rand(1,N,'norm')*sigma;&#xA;&#xA;measurements = truth(max(1,[1:N]-true_delay)) + measurement_noise;&#xA;&#xA;plot(measurements,'r:')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2013-12-04T05:07:09.957" LastActivityDate="2013-12-04T05:07:09.957" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="12998" PostTypeId="1" CreationDate="2013-12-04T09:41:33.537" Score="0" ViewCount="180" Body="&lt;p&gt;Suppose I have an instrument which is out of tune. For example lets say, as an example, the notes it plays are as follows: C+20 cents, C#+20 cents, D+20 cents D#+20cents etc. In other words, it plays all its notes 20 cents too high. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then record this instrument, having played polyphonic music on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What algorithm can I use to tune the track so that the notes become: C+0 cents, C#+0 cents, D+0 cents, D#+0 cents. I wish to solve this in the frequency domain and I have implemented an FFT and IFFT in this regard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that the algorithm should work out the 20 cent offset by itself without me having to supply it. I might later record another instrument with a -35 cent offset. All I know is that the notes are relatively in tune, but the instrument itself relative to other instruments might be out of tune by x cents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in human voice, but also other instruments like violin, flute, guitar, piano and analog synth.&lt;/p&gt;&#xA;" OwnerUserId="1142" LastEditorUserId="1142" LastEditDate="2013-12-04T20:16:07.213" LastActivityDate="2014-11-03T21:41:14.467" Title="Tune a piece of music" Tags="|audio|music|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="12999" PostTypeId="2" ParentId="12998" CreationDate="2013-12-04T10:10:42.137" Score="2" Body="&lt;p&gt;Essentially what you'll need to do it adjust the pitch of the audio data such that your slightly sharp notes are 20 cents flatter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By far the easiest way to do this would be to play the audio at a lower sampling rate, which will lower the pitch accordingly.  However, this approach will also slow down the original tempo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A solution in which the signal retains its speed would be to use a time-scale modification algorithm to speed up the audio while retaining the pitch, followed by playing at a lower sampling rate, which returns the audio to the original tempo, with the desired lower pitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, the factor by which you adjust the time scale and pitch adjustment factor must be carefully chosen to yield the desired results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of implementation, playing back a reduced sampling frequency is (relatively) trivial.  A frequency domain algorithm which can perform the time-scaling for you is the phase vocoder.  You might check out the following links to help you implement it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://homes.esat.kuleuven.be/~bdefraen/Laroche.pdf&quot; rel=&quot;nofollow&quot;&gt;http://homes.esat.kuleuven.be/~bdefraen/Laroche.pdf&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.ee.columbia.edu/ln/labrosa/matlab/pvoc/&quot; rel=&quot;nofollow&quot;&gt;http://www.ee.columbia.edu/ln/labrosa/matlab/pvoc/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2013-12-04T10:10:42.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13001" PostTypeId="1" CreationDate="2013-12-04T10:22:32.737" Score="2" ViewCount="464" Body="&lt;p&gt;I am new to the wavelet field, and I am working with ultrasound signal. For my study, I needed to measure material using the pulse echo reflection method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, when the transducer transmits the signal, the signal will reflected back to the transducer. If material has a thickness, the signal will reflected for two sides which are the front and back. After receiving both signals, I need to differentiate both of them, however the received signals are overlayed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think by using a wavelet method, I can differentiate the signal, but the result that I got is unclear.  Can anyone explain about this result?  Is it that both signals can be differentiated? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1uLVL.jpg&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="7161" LastEditorUserId="7092" LastEditDate="2014-01-05T01:24:02.450" LastActivityDate="2014-01-05T01:24:02.450" Title="Wavelet signal analysis for ultrasound echo" Tags="|image-processing|wavelet|ultrasound|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13002" PostTypeId="2" ParentId="9577" CreationDate="2013-12-04T10:45:03.000" Score="1" Body="&lt;p&gt;Basically you have to do a shading correction. This process removes known artifacts from an image (or a series of images) based on a reference image (or &quot;compensation image&quot; as it is sometimes called) containing only those artifacts. Such a reference images can be obtained by photographing a uniform object (i.e. a perfectly white wall or perfectly black darkness) under good conditions so that only the signal from the defect camera chip is recorded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done this example with Mathematica, the basic principle can be implemented anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a set of images (I used grayscale images since I have no infrared images) without the defective signal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img1=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PC1tg.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img2=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w1Ga9.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img3=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cZqWZ.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and an artificial defect camera chip signal aka the reference image (I pulled this out of my hat).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;noise = GaussianFilter[Binarize[Image[RandomReal[1, {299, 499}]], 0.95], 5]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wmuoa.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we generate the noisy images.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img1n = ImageAdd[img1, noise]&#xA;img2n = ImageAdd[img2, noise]&#xA;img3n = ImageAdd[img3, noise]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hu9FY.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/n3qfV.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TUNLG.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we simply subtract the reference image from the noisy images and get the actual images without the noise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ImageSubtract[img1n, noise]&#xA;ImageSubtract[img2n, noise]&#xA;ImageSubtract[img3n, noise]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PC1tg.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/w1Ga9.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cZqWZ.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you happen to have a noisy image and a perfectly fine image with exactly the same scene (and of course image sizes)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img1n =&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hu9FY.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img1=&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PC1tg.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then you can simply generate the reference image yourself by subtracting the latter from the former.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ImageSubtract[img1n, img1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wmuoa.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="6928" LastActivityDate="2013-12-04T10:45:03.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13003" PostTypeId="2" ParentId="12998" CreationDate="2013-12-04T11:29:08.607" Score="1" Body="&lt;p&gt;If you want to keep in the frequency domain, do you need to do a phase vocoder pitch shift !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you will need a very strong Pitch Track extraction method to find the frequency notes for then pass to your pitch shift what is the scale factor to be changed(tuned) in your signal, for example the midle C (c4), in a lot of documentions you will find the frequency &lt;code&gt;261.6&lt;/code&gt;, but its is a bit detune C4 note in -0.16 cents, follow this example the exactly C4 frequency must be &lt;code&gt;261.6256&lt;/code&gt;, to know the real C4 frequency just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 440*(2^(1/12))^-9 = 261.6256 = 0 cents&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;C4 is the nine key to the left of A4 then &lt;code&gt;-9&lt;/code&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you said +20cents, for this example C4 + 20cents is 264.666hz, we a talkin about 3.0404hz difference !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is important say that when you apply a pitch scale factor in your signal this can produce a bit artificial results, how high you need pitch scale more artificial may seem !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase vocoder can be implemented to change the pitch directly, without need change the tempo and then resample, for it see the code from &lt;a href=&quot;http://www.dspdimension.com/admin/pitch-shifting-using-the-ft/&quot; rel=&quot;nofollow&quot;&gt;Stephan M. Bernsee&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summarizing you have a big challenge ahead :-)&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2013-12-04T11:53:29.577" LastActivityDate="2013-12-04T11:53:29.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13004" PostTypeId="1" CreationDate="2013-12-04T11:51:22.467" Score="2" ViewCount="3489" Body="&lt;p&gt;I a recent topic, it has been told that zero-padding in the STFT can improve it, and avoid some circular convolution related things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my Python code for STFT : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fftsize = 8192;  overlap = 4;  hop = fftsize / overlap  # ie hop = 2048 here&#xA;w = scipy.hamming(fftsize)       # hamming window&#xA;&#xA;# x is the input signal, I assume it is already of length 2^k, ie no zero padding required for x&#xA;&#xA;# STFT&#xA;x_stft = scipy.array([scipy.fft(w*x[i:i+fftsize]) for i in range(0, len(x)-fftsize, hop)])&#xA;&#xA;# ISTFT&#xA;y = scipy.zeros(len(x))&#xA;for n,i in enumerate(range(0, len(x)-fftsize, hop)):&#xA;  y[i:i+fftsize] += scipy.real(scipy.ifft(x_stft[n])) * w    # overlap-add&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I do the zero padding with this code ?&lt;/strong&gt; Which array should I enlarge ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;PS : in order to simplify the code, I haven't normalized the window, so for perfect reconstruction, one has to add a multiplying constant, etc. (it's not important here)&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2013-12-04T17:24:38.927" LastActivityDate="2015-09-23T00:32:42.373" Title="Zero-padding in STFT" Tags="|fft|discrete-signals|signal-analysis|python|stft|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13005" PostTypeId="2" ParentId="12998" CreationDate="2013-12-04T12:24:02.010" Score="0" Body="&lt;p&gt;In case you don't need to write an algorithm: There are simple freeware tools that can do this for you. For example &quot;Audacity&quot; &lt;a href=&quot;http://audacity.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;http://audacity.sourceforge.net/&lt;/a&gt; has a very good pitch shifter.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-04T12:24:02.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13006" PostTypeId="2" ParentId="13004" CreationDate="2013-12-04T12:31:05.070" Score="1" Body="&lt;p&gt;For linear time invariant filtering, the best methods are overlap add (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&lt;/a&gt;) or overlap save. If latency is an issue that can be improved with &quot;block convolvers&quot; or &quot;segmented overlap add&quot; (e.g. &lt;a href=&quot;http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF&lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the processing is time variant, things get a lot more complicated and the right choice of FFT length, analysis window, step size &amp;amp; synthesis window really depends on the specific of the application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to do any processing but just data analysis, the only thing that zero padding does is interpolation in the frequency domain. You get graphs with higher resolution but not more information.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-04T12:31:05.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13007" PostTypeId="2" ParentId="12987" CreationDate="2013-12-04T12:34:46.443" Score="0" Body="&lt;p&gt;Best choice for a graphical EQ are the aforementioned biquad filters in cascade NOT in parallel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parallel bandpass filter create lots of interference at the band edges and a very non uniform group delay even in the &quot;flat&quot; setting. There is no way to implement a flat transfer function with parallel band passes. The cascaded are perfectly flat in both amplitude and phase when the gain of every stage is 0 dB. It's also computationally a lot more efficient. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-04T12:34:46.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13009" PostTypeId="1" CreationDate="2013-12-04T13:31:21.560" Score="3" ViewCount="2221" Body="&lt;p&gt;I want to take a real signal on my FPGA and create a complex one.  I have FIR core implemted for a Hilbert Transform, and Xilinx's datasheet on it shows coefficients of: (-819,0,-1365,0,-4096,0,4096,0,1365,0,819) as an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to add more taps, so as practice I used the matlab fdesign function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;d=fdesign.hilbert(11,0.1);&#xA;hd=design(d,'firls');&#xA;coef=hd.Numerator&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The coefficients seem reasonable (though I will need to multiply by 10000 to get integers).  What I don't understand is the 0.1 transition width variable (I took the 0.1 from an example online), nor if I need to tune this filter for a frequency range, or if they are generic enough.&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2014-06-23T21:27:42.063" Title="How to determine Hilbert coefficients" Tags="|filters|filter-design|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13010" PostTypeId="2" ParentId="13001" CreationDate="2013-12-04T14:24:07.287" Score="2" Body="&lt;p&gt;From what I can see you are not trying to detect defects. For defect detection  (CM,Inspection) wavelets are really popular and they had and still has been used extensively. I am working in the same field for a while but from what I can understand, you are trying to measure the thickness of the material.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, I couldnt quite understand your problem but I strongly advise you to go for spectrogram first. Scalogram is inherently better in terms of resolution (both in time and frequency) but it might be a bit tricky to understand scale-frequency relation as opposed to spectrogram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your plots, wavelet transform is picking up quite a few of wavelets. This probably is due to the fact that your signals are overlayed. You might want to seperate them. You might also want to go for different wavelets and decomposition levels, I personally know mexican hat and db mother wavelets can provide good results for NDT applications, both for denoising and transforms. &lt;/p&gt;&#xA;" OwnerUserId="7113" LastActivityDate="2013-12-04T14:24:07.287" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13011" PostTypeId="1" CreationDate="2013-12-04T04:06:33.563" Score="0" ViewCount="132" Body="&lt;p&gt;For example, I have an image &lt;img src=&quot;https://i.stack.imgur.com/1sa4s.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 7 people in the image and one apple and a bird. &#xA;How can I extract every person and every object from this image and put the 7 people and 2 objects into 9 different new images? How can I also identify which is person and which is object?&lt;/p&gt;&#xA;" OwnerUserId="7162" OwnerDisplayName="KathyLL" LastActivityDate="2013-12-04T15:55:01.477" Title="How to extract the people and objects from an image separately?" Tags="|image-processing|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13012" PostTypeId="2" ParentId="13011" CreationDate="2013-12-04T07:23:48.490" Score="5" Body="&lt;p&gt;I think what you're looking for is called &quot;category level object recognition&quot;. As far as I know, it's still an active research subject. Meaning you can't expect to find high-quality libraries that you can use out of the box without understanding the magic behind. And even state-of-the art research code only achieves around 90% correct classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A common approach is the so called &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Bag-of-words_model_in_computer_vision&quot;&gt;bag of (visual) words&lt;/a&gt;&quot; model. Meaning: You take a lot of labeled training images containing various objects. You use a keypoint detector&amp;amp;descriptor like SIFT or SURF to find the &quot;visual words&quot;, i.e. similar-looking patches in the training examples, and you train a machine learning algorithm (like a support vector machine) to recognize the category labels based on the presence or absence of these words in each training image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you again use the same keypoint descriptor, e.g. using a sliding window-technique on your test image, find the closest visual words, feed that information to your learning algorithm and you get an object classification for the sliding window (if you're lucky, that is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sadly, if you want to do that with Mathematica, you'll have to reinvent the wheel a lot. The SURF keypoint detector/descriptor is included in the &lt;code&gt;ImageKeypoints&lt;/code&gt; function, but I don't think you can make it use sliding windows. And there is no machine learning functionality to speak of.&lt;/p&gt;&#xA;" OwnerUserId="291" OwnerDisplayName="nikie" LastActivityDate="2013-12-04T07:23:48.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13013" PostTypeId="1" AcceptedAnswerId="13020" CreationDate="2013-12-04T16:03:09.773" Score="3" ViewCount="1262" Body="&lt;p&gt;I know that the Fourier Transform of the autocorrelation function is &#xA;the Power Spectral Density. But how can we arrive at such a result intuitively? &#xA;Is it just a theorem?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="235" LastEditDate="2013-12-05T14:47:21.313" LastActivityDate="2013-12-05T14:47:21.313" Title="How do we know that CTFT of the autocorrelation function is the PSD?" Tags="|fourier-transform|autocorrelation|power-spectral-density|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13014" PostTypeId="2" ParentId="13013" CreationDate="2013-12-04T21:07:53.970" Score="3" Body="&lt;p&gt;Here's the story up to constant factors. Correlation is the same as convolution with a time reversed kernel. Autocorrelation is therefore convolution with the time reversed function itself. Convolution can be represented as a product in frequency domain, time reversal as complex conjugation. That means the autocorrelation function of a signal $s(t)$ can be written as $$ ACF[s(t)] = \mathcal{F}^{-1}\{\mathcal{F}\{s(t)\}\cdot \mathcal{F}\{s(t)\}^*\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now power spectral density. It is (roughly) defined as the squared magnitude of the frequeny domain representation of the signal. So $PSD[s(t)]=|\mathcal{F}\{s(t)\}|^2$ which we can write using complex conjugation as in $|z|^2=zz^*$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ PSD[s(t)] = \mathcal{F}\{s(t)\}\cdot\mathcal{F}\{s(t)\}^*$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can see that $ACF[s(t)]=\mathcal{F}^{-1}\{PSD[s(t)]\}$, or $$\mathcal{F}\{ACF[s(t)]\}=PSD[s(t)] $$ which is what you asked for. &lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2013-12-04T21:32:47.887" LastActivityDate="2013-12-04T21:32:47.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13015" PostTypeId="1" AcceptedAnswerId="13017" CreationDate="2013-12-04T21:37:29.010" Score="6" ViewCount="2916" Body="&lt;p&gt;As people acquainted with Compressive Sensing would know, incoherence and sparsity are two main principles. I've been reading about compressive sampling and developed an interest into the topic. What I'm about to ask might be quite basic so sorry for that in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As incoherence principle states, sensing basis and sparsifying basis must be incoherent. I can understand why it is so and I also understand why a random i.i.d. matrix would in fact give us a good incoherence. My question is, how would one determine it programmatically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say my sparse basis is the frequency domain. When one says sensing basis, is it actually the sensing matrix? Assuming that the signal is x, and sensing matrix is A, would I just calculate the coherence between fft of x and my sensing matrix? If yes, how would one do that, say, in MATLAB?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="7113" LastEditorUserId="128" LastEditDate="2019-06-03T04:25:13.997" LastActivityDate="2019-06-03T04:25:13.997" Title="Compressive Sensing Incoherence Principle" Tags="|matlab|signal-analysis|fourier-transform|compressive-sensing|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13016" PostTypeId="1" CreationDate="2013-12-04T22:14:38.110" Score="2" ViewCount="1159" Body="&lt;p&gt;I'm trying to calculate the short term energy of a digital signal&#xA;in python, using a rectangular window, but don't understand&#xA;the basics of how this works, a pointer to any good explanation would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specific things I'm confused about:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Where do I initialise the window? (at position 0,window_length,&#xA;or -window_length,0, and then work through the signal? ...)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I sum up the squares of all samples at every position inside the window,&#xA;don't I end up with a 'square signal', where all the values are the&#xA;same for the length of the window step?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerDisplayName="user7166" LastActivityDate="2016-05-20T09:29:08.107" Title="Short term energy signal explanation" Tags="|audio|signal-analysis|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13017" PostTypeId="2" ParentId="13015" CreationDate="2013-12-04T22:21:31.280" Score="4" Body="&lt;p&gt;Say you have measurements $y=Ax$, with a basis $\Psi$, and $A\in\mathbb R^{M\times N}$. Then we can write $y=A\Psi\hat x=\Phi\hat x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then believe direct computation of the coherence requires us to solve&#xA;\begin{equation}&#xA;\mu = \max_{i&amp;lt;j} \frac{| \langle \Phi_i,\Phi_j\rangle |}{\| \Phi_i\|\| \Phi_j\|}&#xA;\end{equation}&#xA;where $\Phi_i$ is the $i$-th column of $\Phi$, which I think is of order $\mathcal O(N^3)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assuming the above is correct you can compute $\Psi_i =\text{ifft}(e_i)$, where $e_i$ is a unit vector, construct $\Phi=A\Psi$, and then with a double for loop find $\mu$.&lt;/p&gt;&#xA;" OwnerUserId="7058" LastEditorUserId="7058" LastEditDate="2013-12-04T22:29:42.263" LastActivityDate="2013-12-04T22:29:42.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13018" PostTypeId="1" CreationDate="2013-12-04T22:56:56.663" Score="2" ViewCount="301" Body="&lt;p&gt;I have the RLS algorithm implemented in two different ways - transversal and lattice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was expecting them both to behave the same way, but they don't! Transversal seems to converge faster than lattice does. I'm not sure why. I plotted them together here:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qIMnL.png&quot; alt=&quot;Lattice is red, Transversal is blue&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lattice is shown in red, transversal is in blue. This is MSE. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The lattice is actually a joint process estimator, so I calculate the error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my implementation just wrong and they should be the same, or is this actually supposed to happen? I mean it could probably make sense because reflection coefficients are limited to 1 in magnitude, but I'm not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, in the RLS transversal implementation (with the tap weights), the filter response is symmetrical, so I know what the delay of the filter is. But I don't know what the lattice implementation delay would be like, because the regression coefficients do not look symmetrical to me.&lt;/p&gt;&#xA;" OwnerUserId="7167" LastActivityDate="2014-12-12T02:43:19.063" Title="RLS Lattice vs Transversal" Tags="|filters|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13020" PostTypeId="2" ParentId="13013" CreationDate="2013-12-05T03:20:32.257" Score="7" Body="&lt;p&gt;$$\begin{align}&#xA;R_x(\tau) &amp;amp;=\int_{-\infty}^\infty x(t)x^*(t-\tau)\,\mathrm dt\\&#xA;&amp;amp;= \int_{-\infty}^\infty \left[\int_{-\infty}^\infty X(f)e^{j2\pi ft}\,\mathrm df\right]x^*(t-\tau)\,\mathrm dt\\&#xA;&amp;amp;= \int_{-\infty}^\infty X(f) \left[\int_{-\infty}^\infty x^*(t-\tau) e^{j2\pi ft}\,\mathrm dt\right]\,\mathrm df\\&#xA;&amp;amp;= \int_{-\infty}^\infty X(f) \left[\int_{-\infty}^\infty x^*(t-\tau) e^{j2\pi f(t-\tau)}\,\mathrm dt\right]e^{j2\pi f\tau}\,\mathrm df\\&#xA;&amp;amp;= \int_{-\infty}^\infty X(f) \left[\int_{-\infty}^\infty x^*(\lambda) e^{j2\pi f\lambda}\,\mathrm d\lambda\right]e^{j2\pi f\tau}\,\mathrm df\\&#xA;&amp;amp;= \int_{-\infty}^\infty X(f) \left[\int_{-\infty}^\infty x(\lambda) e^{-j2\pi f\lambda}\,\mathrm d\lambda\right]^*e^{j2\pi f\tau}\,\mathrm df\\&#xA;&amp;amp;= \int_{-\infty}^\infty X(f)X^*(f) e^{j2\pi f\tau}\,\mathrm df\\&#xA;&amp;amp;= \int_{-\infty}^\infty |X(f)|^2 e^{j2\pi f\tau}\,\mathrm df&#xA;\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-12-05T03:20:32.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13021" PostTypeId="1" CreationDate="2013-12-05T04:03:47.770" Score="0" ViewCount="174" Body="&lt;p&gt;I have a time series file which starts with 1 and then quickly tends to oscillating about 0.001. The time series has a resolution of 0.01s and has 10^6 sequential points starting from t=0. The goal is to study the divergence of the fourier transform at Zero frequency. Is there any trick that can be employed to improve the accuracy in the low frequency sector?&lt;/p&gt;&#xA;" OwnerUserId="7171" LastActivityDate="2013-12-05T04:03:47.770" Title="Estimating and Improving the accuracy of fourier transform in the low frequency sector" Tags="|fft|fourier-transform|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13022" PostTypeId="2" ParentId="12913" CreationDate="2013-12-05T04:36:40.250" Score="1" Body="&lt;p&gt;Yes, a discrete Fourier transform (DFT) is often used to transform a spatial domain image to a frequency domain image.&#xA;Usually this is implemented using a 1-dimensional fast Fourier transform FFT independently applied along each row of the original image to produce an intermediate image,&#xA;then a 1-dimensional FFT independently applied along each column of the intermediate image to produce the frequency domain image.&#xA;The FFT and the inverse FFT give exactly the same results as the equations you wrote, but they execute much faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, complex multiplication works just as you stated,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;F(u,v) . e^(jx) = (a+bj) . (cos x + j sin x) = (a cos x - b sin x) + j( a sin x + b cos x)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Traditionally we re-arrange the frequency domain image so the zero-frequency bin of the frequency domain image is in the middle of that image (&quot;centered format&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes a person takes a Fourier transform of some image an immediately throws away half the data, taking only the real part or taking only the absolute value.&#xA;That throws away half the information -- any later attempts to recover the image by taking the inverse Fourier transform of the real part (or the absolute value) only give a big blur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Barry Van Veen pointed out, if you preserve both the real and imaginary parts,&#xA;you find that every real valued image produces a frequency domain image with a certain symmetry in frequency space.&#xA;(Also, you will find that even though you may start with a black-and-white image with values from 0 to 255, the frequency domain image often has both positive and negative real values, positive and negative imaginary values, and values with amplitudes of many thousand).&#xA;And as he also pointed out, if you preserve that symmetry when you do your filtering, then when you do the inverse transform, the result should be very close to real valued again --&#xA;it's often OK to take just the real part as your result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, F(u,v) is the result from the forward DFT.&#xA;Yes, for each integer u and each integer v, F(u,v) is a 2-part number with a real and imaginary part, F(u,v) = (a+bj).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might find the following links relevant:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;Kevin Cowtan's Picture Book of Fourier Transforms&quot;&#xA;&lt;a href=&quot;http://www.ysbl.york.ac.uk/~cowtan/fourier/fourier.html&quot; rel=&quot;nofollow&quot;&gt;http://www.ysbl.york.ac.uk/~cowtan/fourier/fourier.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&quot;Steve on Image Processing&quot;&#xA;&lt;a href=&quot;http://blogs.mathworks.com/steve/2013/06/25/homomorphic-filtering-part-1/&quot; rel=&quot;nofollow&quot;&gt;http://blogs.mathworks.com/steve/2013/06/25/homomorphic-filtering-part-1/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&quot;Basic Physics of Nuclear Medicine/Fourier Methods&quot;&#xA;&lt;a href=&quot;https://en.wikibooks.org/wiki/Basic_Physics_of_Nuclear_Medicine/Fourier_Methods&quot; rel=&quot;nofollow&quot;&gt;https://en.wikibooks.org/wiki/Basic_Physics_of_Nuclear_Medicine/Fourier_Methods&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&quot;Multidimensional FFTs&quot;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fast_Fourier_transform#Multidimensional_FFTs&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Fast_Fourier_transform#Multidimensional_FFTs&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&quot;Multidimensional DFT&quot;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Multidimensional_DFT&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Multidimensional_DFT&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&quot;Fourier Transform and Frequency Domain Filter Design&quot;&#xA;&lt;a href=&quot;http://www.gergltd.com/cse485/project3/&quot; rel=&quot;nofollow&quot;&gt;http://www.gergltd.com/cse485/project3/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Paul Bourke &quot;2 Dimensional FFT&quot; (has 2D FFT source code in C)&#xA;&lt;a href=&quot;http://paulbourke.net/miscellaneous/dft/&quot; rel=&quot;nofollow&quot;&gt;http://paulbourke.net/miscellaneous/dft/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&quot;FFT Source Code&quot; &lt;a href=&quot;http://www.fftw.org/links.html&quot; rel=&quot;nofollow&quot;&gt;http://www.fftw.org/links.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As you probably already know, most programmers that need to sort something use a standard off-the-shelf sorting library rather than carefully crafting yet another sort() routine from scratch.&#xA;Also, most programmers that need to do a DFT use a standard off-the-shelf FFT library.&lt;/p&gt;&#xA;" OwnerUserId="484" LastEditorUserId="484" LastEditDate="2013-12-05T08:59:51.153" LastActivityDate="2013-12-05T08:59:51.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13024" PostTypeId="1" CreationDate="2013-12-05T07:17:15.870" Score="1" ViewCount="706" Body="&lt;p&gt;Given a blob of an image (representing an object), &lt;a href=&quot;https://en.wikipedia.org/wiki/Image_moment#Examples_2&quot; rel=&quot;nofollow&quot;&gt;according to Wikipedia&lt;/a&gt;, we can compute the co-variance matrix using the image moments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that the eigenvectors of that matrix can be used to represent the principal axes of an &lt;a href=&quot;https://en.wikipedia.org/wiki/Oriented_bounding_box&quot; rel=&quot;nofollow&quot;&gt;oriented bounding box (OBB)&lt;/a&gt;, but what are the guarantees for that particular orientation? Is the OBB the one with minimal area? And, are the eigenvectors always orthogonal?&lt;/p&gt;&#xA;" OwnerUserId="7156" LastActivityDate="2013-12-05T22:41:17.557" Title="Purpose of eigenspace of covariance matrix of a blob?" Tags="|image-processing|covariance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13025" PostTypeId="1" CreationDate="2013-12-05T07:56:11.710" Score="0" ViewCount="131" Body="&lt;p&gt;I have a video (in webm format), and I want to produce a graph that shows the degree of motion in this video as a function of video time. I'm sure there are many different ways to define &quot;degree of motion&quot;, but I envisaged something that could be based on the average difference between pixels in consecutive frames, or something like that (suggestions are welcome). Essentially what I need is a graph whose magnitude is large in cases where there is a very big change in the frames and small when most of the frame stays the same except for a small section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What tools might I use to achieve this? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7175" LastActivityDate="2013-12-11T09:04:30.113" Title="Estimating degree of motion in video frames" Tags="|video-processing|motion-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13026" PostTypeId="2" ParentId="13025" CreationDate="2013-12-05T14:10:42.377" Score="1" Body="&lt;p&gt;Probably you could try optical flow with some key-points not pixels if your purpose is to estimate motion. I thing meaningful thing would count average values of keypoints, overcomes some threshhold or filter (to eliminate barelly moving keypoints). However there would be some problems with having constant amount of meaningfull keypoints (keypoints tend to dissapear over time and very little chance that same amount newly generated keypoints are on moving objects). If that is what you want. You can estimate amplitudes of moving keypoints. &#xA;Tools could be any CV library like OpenCV. Pixels are not easily trackable without being extracted as keypoints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand if you want to estimate how much pixels moving on image and estimate movement results from codec movement compression you could extract frame by frame and ignore I type frames and count how much pixels are on B and P type frames (I am recalling from h264 not sure how these frames are expressed in vp8), which are just moving picture parts from previous/next frame. You then can have estimate how much pixels are moving. Your call how you will implement this.&lt;/p&gt;&#xA;" OwnerUserId="7158" LastEditorUserId="7158" LastEditDate="2013-12-11T09:04:30.113" LastActivityDate="2013-12-11T09:04:30.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13027" PostTypeId="1" CreationDate="2013-12-05T14:57:43.643" Score="0" ViewCount="175" Body="&lt;p&gt;Why, when I have to calculate some types of noise (for example shot noise and others which are in the denominator of SNR ratio) or attenuation from turbulence, I have to use variance of the of the density probability and not the mean value? In all of the formulas they use  variance (the second moment) and this is not clear for me.&lt;/p&gt;&#xA;" OwnerUserId="7180" LastEditorUserId="76" LastEditDate="2013-12-06T14:50:13.083" LastActivityDate="2013-12-06T14:50:13.083" Title="Why do I have to use variance and not mean value to calculate noise?" Tags="|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13028" PostTypeId="1" CreationDate="2013-12-05T15:19:30.783" Score="3" ViewCount="286" Body="&lt;p&gt;I know the basic working principle of sinusoidal oscillators. But I have a doubt on this matter when I came across Gram-Schmidt orthogonalization procedure. I have read that the source for sinusoid signal output from an oscillator is the noise. Due to controlled positive feedback a single frequency component is selected and amplified, right? If the noise is a white noise, we say it has all frequency components. We think in terms of all possible sinusoids with different frequencies. When coming to frequency response too, we think in terms of sinusoids. Why can't we think in terms of other orthogonal basis set? Although it makes life difficult, I would like to know the justification for thinking in terms of sinusoids. &lt;strong&gt;&lt;em&gt;Is sinusoids the nature's default signals?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2013-12-06T05:59:57.497" Title="Is sinusoids the nature's default signals?" Tags="|fourier|oscillator|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13029" PostTypeId="2" ParentId="13027" CreationDate="2013-12-05T15:27:48.580" Score="2" Body="&lt;p&gt;Typically the first moment (mean) is zero and therefore contains (relatively) no information. The most obvious thing then, to distinguish different levels of noise, is to look at the variance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if the variance happens to be zero, then surely there is no noise at all.&lt;/p&gt;&#xA;" OwnerUserId="7058" LastActivityDate="2013-12-05T15:27:48.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13030" PostTypeId="2" ParentId="13028" CreationDate="2013-12-05T15:35:51.510" Score="8" Body="&lt;p&gt;Complex exponentials (with decaying sinusoids being the real part) are the solutions to certain types of low-order linear differential equations.  Modeling simple natural phenomena with these low-order linear differential equations turns out to be surprisingly useful.  &quot;Why did the real world turn out this way?&quot; might be a good question for philosophers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mandlebrot and Talib might claim that believing that these simplified models actually accurately apply to real-world systems bigger than can fit in a freshman physics lab is just a trick of the human mind.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-12-05T15:55:07.517" LastActivityDate="2013-12-05T15:55:07.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13031" PostTypeId="2" ParentId="13028" CreationDate="2013-12-05T15:54:05.790" Score="9" Body="&lt;p&gt;Time invariance plays a huge role in nature. Most systems (including your ear/brain) don't have an absolute time reference but treat all points in time equally. That results in a preference for the description of these systems with essentially time invariant basis functions, which is what (complex) sinusoids are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;em&gt;linear&lt;/em&gt; time invariant systems, the complex exponentials are even eigenfunctions of the system and allow you to describe the system as a &quot;diagonal&quot; operator, i.e. in a very simple way. That even includes a system that just performs a time delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nonlinear time invariant systems can also be described in terms of sinusoids, but it gets way more complicated there. A nonlinear time invariant system excited by a periodic input will produce a periodic output in general, and you can analyze both in terms of sinusoids. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can also perform a more mathematical rigorous analysis by looking at the nonlinear system response to small disturbances of any input signal. And taking sinusoids to describe these disturbances gives you a local description in a time invariant way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all in all, if you have a system that is time invariant, no matter of what nature, time shift invariant basis functions are helpful, and complex sinusoids are precisely that.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-12-05T15:54:05.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13032" PostTypeId="1" CreationDate="2013-12-05T16:35:37.407" Score="0" ViewCount="1955" Body="&lt;p&gt;We as a group are new to signal processing and speech recognition. We have stored .wav sounds of three different words and we are trying to record a new .wav sound and have the system compare the sound to these three pre-recorded sounds to see which one correlates the most to the newly generated sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have altered the .wav sounds in various ways trying to figure out how we should tackle this problem. Thus far, we have been stuck on this issue for a while now and are only able to achieve sound comparisons with just two different sounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should we tackle this problem? We would be very grateful for some general directions, thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7182" LastActivityDate="2014-01-04T18:40:36.393" Title="How to compare vocal words in matlab" Tags="|matlab|speech-recognition|speech|voice|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13034" PostTypeId="1" CreationDate="2013-12-05T17:04:38.423" Score="1" ViewCount="116" Body="&lt;p&gt;Is there a rule of thumb for how many coefficients to choose for a fractional delay filter?  I figure there might be a trade off based on the signal frequency as well as my sample rate (this is running on an FPGA), but I can't seem to find a good rule of thumb.&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2018-11-04T16:19:00.773" Title="What are the tradeoffs for more coefficients for fractional delay filter?" Tags="|filters|filter-design|dsp-core|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13035" PostTypeId="2" ParentId="13034" CreationDate="2013-12-05T18:04:55.340" Score="0" Body="&lt;p&gt;That really depends on your requirements and your specific application. For audio I have used anywhere between 4 and 128 depending on what the application was.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-05T18:04:55.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13036" PostTypeId="2" ParentId="13032" CreationDate="2013-12-05T18:05:10.750" Score="2" Body="&lt;p&gt;Dan Ellis has some neat Matlab scripts that allow you to pull audio features from files . . .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://labrosa.ee.columbia.edu/matlab/&quot; rel=&quot;nofollow&quot;&gt;http://labrosa.ee.columbia.edu/matlab/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dynamic time warp might be a good starting point for the task you describe.&lt;/p&gt;&#xA;" OwnerUserId="1024" LastActivityDate="2013-12-05T18:05:10.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13038" PostTypeId="1" CreationDate="2013-12-05T20:26:07.003" Score="0" ViewCount="2932" Body="&lt;p&gt;How would you reliably detect scene transitions in a video? The simplest case wouldn't be too hard, but sometimes it might be a fast moving scene, or there might be an effect like lightning that would throw it off.&lt;/p&gt;&#xA;" OwnerUserId="7184" LastActivityDate="2014-08-03T13:06:18.433" Title="Detecting scene transitions in a video" Tags="|video-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13040" PostTypeId="1" AcceptedAnswerId="13046" CreationDate="2013-12-05T21:40:04.253" Score="0" ViewCount="466" Body="&lt;p&gt;Let us say we have a signal $y(k)$ that is of length $K$. I can compute its PSD, also of length $K$. Let us say that this length was not good for finding peaks, so I computed a PSD that was of length $10 \ K$ instead, by doing a zero-padding in the time-domain. I understand that this is equivalent to interpolating the frequency domain result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, at this point, if I resample the actual $10 \ K$ length PSD back to be $K$ samples long, would it give me the same result as if I took a $K$ length PSD to begin with? If not, is there any advantage to doing it this way, or would I just be better off sticking to taking a length $K$ PSD to begin with?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2013-12-06T02:08:30.133" Title="Downsampling a PSD that was generated by zero-padding - worth it?" Tags="|fourier-transform|frequency-spectrum|downsampling|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13041" PostTypeId="1" AcceptedAnswerId="13043" CreationDate="2013-12-05T22:23:46.890" Score="0" ViewCount="120" Body="&lt;p&gt;In signal processing, when you sampling an analog signal, &#xA;the sampling theory says that the sampling frequency needs to be at least twice the maximum frequency in the analog signal content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that if the sampling frequency is smaller, then it can cause&#xA;a data loss, but what if the sampling frequency will be exactly as the maximum frequency&#xA;of the analog signal? Why should it be twice as great as the maximum frequency of the &#xA;analog signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I know what the maximum frequency of the analog signal is?&lt;/p&gt;&#xA;" OwnerUserId="5665" LastEditorUserId="76" LastEditDate="2013-12-05T23:00:21.863" LastActivityDate="2013-12-06T00:51:40.320" Title="Sampling Theory in Signal Processing" Tags="|discrete-signals|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13042" PostTypeId="2" ParentId="13024" CreationDate="2013-12-05T22:41:17.557" Score="1" Body="&lt;p&gt;The eigenvectors will always be orthogonal. There is no guarantee that the eigenvectors will give you the bounding box with minimal area.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-05T22:41:17.557" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13043" PostTypeId="2" ParentId="13041" CreationDate="2013-12-06T00:46:07.750" Score="3" Body="&lt;p&gt;Incorrect initial statement.  The sampling rate must be greater-than (not just at-least or equal-to) twice the highest frequency present in a band-limited base-band signal, for aliasing (and thus potential information mixing/corruption/ loss) not to occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maximum frequency present is usually by design, by putting a (estimated  or assumed to be sufficient) low-pass filter before the sampling mechanism.  (Or the mechanism of the signal or sampler itself includes such a low-pass frequency response.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-12-06T00:51:40.320" LastActivityDate="2013-12-06T00:51:40.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13044" PostTypeId="1" AcceptedAnswerId="13050" CreationDate="2013-12-06T01:09:11.553" Score="1" ViewCount="1079" Body="&lt;p&gt;I was reading a paper about finding optimal morlet wavelet function for CWT, and they were minimizing Shannon entropy.&lt;br&gt;&#xA;what is Shannon entropy and it uses?&lt;br&gt;&#xA;(specially on continuous wavelet transform)&lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2013-12-06T04:08:26.467" Title="what is Shannon entropy?" Tags="|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13046" PostTypeId="2" ParentId="13040" CreationDate="2013-12-06T02:08:30.133" Score="2" Body="&lt;p&gt;Consider these two cases where you operate on a signal $y[k], K = 0, \ldots K-1$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You take the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt; of the signal $y[k]$ to obtain a length-K frequency-domain signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You first zero-pad $y[k]$ to obtain a longer signal $y_p[k], k = 0, \ldots, 10K-1$. You then take its DFT. Finally, you downsample the DFT by discarding all but the first of every 10 samples (i.e. you keep the first, tenth, twentieth, and so on).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The two processes will yield the exact&lt;sup&gt;1&lt;/sup&gt; same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; In practice, that is, when using finite-precision arithmetic, it's likely that you won't arrive at results that are identical bit for bit. However, in theory, and with the use of infinite arithmetic precision, the two approaches are equivalent.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-12-06T02:08:30.133" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13048" PostTypeId="1" AcceptedAnswerId="13049" CreationDate="2013-12-06T03:54:51.783" Score="0" ViewCount="905" Body="&lt;p&gt;I am doing research on images using gabor filter. &#xA;I have read the following post:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/11467/apply-a-gabor-filter-to-an-input-image&quot;&gt;Apply a Gabor filter to an input image&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There must be some formula to determine the value for gamma,sigma,lambda,psi...can i know how to determine it?&lt;/p&gt;&#xA;" OwnerUserId="7186" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2013-12-06T04:05:17.153" Title="Gabor Filter Parameter" Tags="|matlab|gabor|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13049" PostTypeId="2" ParentId="13048" CreationDate="2013-12-06T04:05:17.153" Score="0" Body="&lt;p&gt;The best values for these parameters depend on your application. You should probably try different values on a validation set to find out which ones work best for you.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-06T04:05:17.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13050" PostTypeId="2" ParentId="13044" CreationDate="2013-12-06T04:08:26.467" Score="4" Body="&lt;p&gt;Shannon entropy is a way of measuring the degree of unexpectedness or unpredictability of a random variable. For example rolling a die has higher entropy than flipping a coin because the die has more possible outcomes making it harder to predict. Same goes for a biased coin versus a fair coin. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-06T04:08:26.467" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13051" PostTypeId="1" AcceptedAnswerId="13179" CreationDate="2013-12-06T04:27:06.850" Score="1" ViewCount="1254" Body="&lt;p&gt;I'm struggling to validate that my C++ implementation of a filter I designed in Matlab is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first issue is to make sure I'm implementing the sections in the right order. This is the output of the SOS matrix from fdatool:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.5961   -1.1815    0.5961    1.0000   -1.9792    0.9884&#xA;0.5793   -1.1475    0.5793    1.0000   -1.9555    0.9649&#xA;0.6200   -1.2266    0.6200    1.0000   -1.9300    0.9398&#xA;0.5658   -1.1167    0.5658    1.0000   -1.9013    0.9119&#xA;0.4348   -0.8542    0.4348    1.0000   -1.8689    0.8806&#xA;0.3066   -0.5967    0.3066    1.0000   -1.8330    0.8459&#xA;0.1814   -0.3451    0.1814    1.0000   -1.7960    0.8104&#xA;0.0735   -0.1285    0.0735    1.0000   -1.7637    0.7794&#xA;0.0168   -0.0087    0.0168    1.0000   -1.7443    0.7609&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm assuming that the sections should be processed from top to bottom, is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second question is to do with scaling. I was scaling my filters using scale(Hd) directly, but I'm noticing that I get inconsistent results in my program. I have generated multiple filters that should output roughly the same data but the peak values are quite different. I noticed there is a ScaleValues property on the filter object, after scaling the values are mostly 1.0:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.1047&#xA;1.0000&#xA;1.0000&#xA;1.0000&#xA;1.0000&#xA;1.0000&#xA;1.0000&#xA;1.0000&#xA;1.0000&#xA;1.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was all ready to assume these are applied to the output of each section, then I noticed there is 1 more scaling value than section. How are these values used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Final question, given the options to scale, not to scale, various ways to scale, if I'm targeting a 64-bit CPU or maybe GPU doing my math in double-precision floats, is there an optimal way to configure scaling?&lt;/p&gt;&#xA;" OwnerUserId="7125" LastActivityDate="2013-12-13T21:27:40.927" Title="Matlab SOS Filter in C++" Tags="|matlab|infinite-impulse-response|c|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13053" PostTypeId="2" ParentId="13028" CreationDate="2013-12-06T05:59:57.497" Score="1" Body="&lt;p&gt;Sinusoids is just a different way of looking at what we have here (since frequency analysis is equivalent to time analysis) - it only is more useful in some cases.&#xA;It's a model though, and that's why we often add noise models - because they help describe what sinusoids don't describe in an efficient way. And since we use the noise models so often, it's not that perfect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to look at mathematical relationships between frequency and time analysis to see why we often consider sinusoids.&lt;/p&gt;&#xA;" OwnerUserId="5779" LastActivityDate="2013-12-06T05:59:57.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13054" PostTypeId="2" ParentId="13038" CreationDate="2013-12-06T06:09:47.877" Score="1" Body="&lt;p&gt;What about computing the sum of squared differences or the correlation between the current frame and the previous frame?&#xA;For fast moving scenes, you could compute phase correlation via Discrete Fourier Transform, but I think that computation would be too expensive for video processing, especially if there's a real-time requirement.&lt;/p&gt;&#xA;" OwnerUserId="5779" LastActivityDate="2013-12-06T06:09:47.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13055" PostTypeId="1" AcceptedAnswerId="13415" CreationDate="2013-12-06T14:13:05.260" Score="0" ViewCount="3185" Body="&lt;p&gt;I am trying to calculate shannon entropy of &lt;code&gt;CWT&lt;/code&gt;. I am not sure if I am doing it right. &#xA;Assume that $W(a_i,t), i=1;2;...;M$ is a set of wavelet coefficients. The Shannon wavelet entropy is calculated by:&lt;br&gt;&#xA;$E=-\sum_{i=1}^{M}d_i log(d_i)$ $\rightarrow$   where $d_i=\frac{|W(a_i,t)|}{\sum_{j=1}^{M}W(a_j,t)}$&lt;br&gt;&#xA;I am confused how to calculate $E$. for example I have a coefficient matrix with size of $M\times N$, $M$ is scales number and $N$  is time segments. first I have to calulate $d_i$, this is my main problem. this is the wavelet coefficient matrix :&lt;br&gt;&#xA; $W_{M\times N} =&#xA; \begin{pmatrix}&#xA;  w_{a_1,1} &amp;amp; w_{a_1,2} &amp;amp; \cdots &amp;amp; w_{a_1,N} \\&#xA;  w_{a_2,1} &amp;amp; w_{a_2,2} &amp;amp; \cdots &amp;amp; w_{a_2,N} \\&#xA;  \vdots  &amp;amp; \vdots  &amp;amp; \ddots &amp;amp; \vdots  \\&#xA;  w_{a_M,1} &amp;amp; w_{a_M,2} &amp;amp; \cdots &amp;amp; w_{a_M,N}&#xA; \end{pmatrix}$   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;hmm i am pretty sure i am wrong, can anyone help? &#xA;for example tell me how can i calculate $d_4$?&lt;br&gt;&#xA;Here I have right a little Matlab script to calculate shannon entropy of CWT.&lt;br&gt;&#xA;Is it right or wrong? and what should I do?  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; [M,N]=size(coeffs);&#xA;for js=1:M     &#xA;Ej(js)=sum(abs(coeffs(js,:)));&#xA;end;&#xA;Etot=sum(Ej);&#xA;Pj=Ej./Etot;&#xA;%shannon entropy&#xA;shan_entr=-sum(Pj.*log(Pj));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-12-28T08:15:22.917" LastActivityDate="2017-06-23T08:23:32.477" Title="How to calculate CWT shannon entropy?" Tags="|wavelet|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13056" PostTypeId="1" AcceptedAnswerId="13088" CreationDate="2013-12-06T15:04:48.943" Score="6" ViewCount="4145" Body="&lt;p&gt;If I understand what &lt;strong&gt;LPC&lt;/strong&gt; does, I think. It predicts the next sample by taking into account previous $p$ samples. I don't understand why it is useful in DPS and speech recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also came across &lt;strong&gt;LPCC&lt;/strong&gt; that can be derived from &lt;strong&gt;LPC&lt;/strong&gt; and are related to sound frequency. I also find it hard to follow the idea why cepstrum coefficients are useful or even better for speech recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did read about MFCC, though. I understood that before DCT, the coefficients (no MFCC yet) are simply energies at particular frequency range of a signal that is filtered by a triangle band pass filter. &lt;em&gt;I do not have a problem with MFCC apart from the last step when DCT is applied&lt;/em&gt;. I think it also has something to do with cepstrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do you think cepstrum is so useful for speech, speaker and music recognition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd be grateful for some words on that :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT. I have found a typo. Instead of &quot;&lt;em&gt;I have a problem with MFCC apart from at the last step when DCT is applied&lt;/em&gt;&quot; I really meant &quot;&lt;em&gt;I do not have a problem with MFCC apart from the last step when DCT is applied&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please add a tag &quot;LPCC&quot; to this topic? It is one of the techniques in speech I think and deserves to be tagged. I cannot do it at the moment. Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4721" LastEditorUserId="4721" LastEditDate="2013-12-09T10:40:15.227" LastActivityDate="2013-12-09T10:42:36.557" Title="Gentle request for explanation on LPC and LPCC coefficients :)" Tags="|mfcc|lpc|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13057" PostTypeId="2" ParentId="630" CreationDate="2013-12-06T17:00:19.957" Score="0" Body="&lt;p&gt;If it's just about how to filter the low energy parts in the signal, could you use a lowpass filter? There are some implementations about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this his helpful: This &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/LainKA94-wlp.pdf&quot; rel=&quot;nofollow&quot;&gt;article&lt;/a&gt; from Karjalaien et. al is about the whitening filter and the method of warped linear prediction, which is used by the filter.&lt;/p&gt;&#xA;" OwnerUserId="7189" LastEditorUserId="76" LastEditDate="2013-12-09T11:10:32.853" LastActivityDate="2013-12-09T11:10:32.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13058" PostTypeId="1" CreationDate="2013-12-06T18:22:29.627" Score="0" ViewCount="870" Body="&lt;p&gt;I have been working on an assignment for university in which I have to compress an 80K message consisting of only two symbols, 'a' and 'b', having probability values of 0.6 and 0.4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have successfully written my code in Matlab and it is working efficiently for 10-20 symbols. However when I pass my 80k symbol message through my code it stops updating at the 1057th value due to the Range parameter, which achieves a value of 10^-324 (the theoretical limit of type double float).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is this the limitation of arithmetic coding when the range becomes so small that we cannot work with it or am doing something wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on arithmetic encoder, so no answers related to range decoding will work.&lt;/p&gt;&#xA;" OwnerUserId="7190" LastEditorUserId="76" LastEditDate="2013-12-09T11:10:27.103" LastActivityDate="2013-12-09T11:10:27.103" Title="Limitations of Arithmetic coding?" Tags="|compression|channelcoding|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13059" PostTypeId="2" ParentId="13058" CreationDate="2013-12-06T20:52:25.357" Score="-1" Body="&lt;p&gt;You should not be using floats or doubles to store your message. You need to write your compressed message in binary.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-06T20:52:25.357" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13060" PostTypeId="1" AcceptedAnswerId="13061" CreationDate="2013-12-06T23:40:39.107" Score="1" ViewCount="1156" Body="&lt;p&gt;I was making a plot to show side lobes for different spectral windows and I noticed if I take a simple fft of a rectangle window, I don't see any side lobes. I think I'm just making a simple mistake.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Python code I ran:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from matplotlib import pyplot as plt&#xA;import numpy as np&#xA;fAxis = np.linspace(-1/2,1/2,100)&#xA;rect = np.ones( 100 )&#xA;specWindow = abs(np.fft.fftshift(np.fft.fft(rect)))&#xA;plt.plot(specWindow)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eFqG0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone explain how to change my code slightly to see the side lobes I'd expect. I expect a discrete FT of a rectangle function to give me the Dirichlet kernel.&lt;/p&gt;&#xA;" OwnerUserId="2007" LastActivityDate="2013-12-07T03:19:20.390" Title="Side lobes not visible in FFT of rect function" Tags="|fourier-transform|frequency-spectrum|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13061" PostTypeId="2" ParentId="13060" CreationDate="2013-12-06T23:48:19.220" Score="3" Body="&lt;p&gt;You have to imagine your signal as being periodically extended forever in both directions. Since you square window is constant over the whole interval when it is periodically extended it becomes flat everywhere. In other words, you don't have a square window. You just have a flat line. That's why only the zero frequency band on the fft has any amplitude. Try doing it again with some zeros on either side of your square window.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-06T23:48:19.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13062" PostTypeId="2" ParentId="13060" CreationDate="2013-12-06T23:56:26.150" Score="1" Body="&lt;p&gt;Zero-pad your rectangle (keep the rectangle the same length) and use a much longer (say 10X or 16X longer) FFT to increase the FFT frequency bin resolution enough to see the side lobes of the Sinc function.  Make sure to plot the complex components, not just the magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Increase the zero-padding even more for more resolution on the transform of your window.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-12-07T01:55:18.697" LastActivityDate="2013-12-07T01:55:18.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13063" PostTypeId="2" ParentId="13060" CreationDate="2013-12-07T01:48:22.240" Score="2" Body="&lt;p&gt;Zero pad your input and use a larger FFT.  This has the effect of interpolating your frequency domain points.  Then use 10*log10(magnitude_squared_of_fft_outputs).  This approach worked fine for me in duplicating the results shown in the classic 1978 windows paper by Harris [ &lt;a href=&quot;http://web.mit.edu/xiphmont/Public/windows.pdf&quot; rel=&quot;nofollow&quot;&gt;http://web.mit.edu/xiphmont/Public/windows.pdf&lt;/a&gt; ].&lt;/p&gt;&#xA;" OwnerUserId="1926" LastEditorUserId="1926" LastEditDate="2013-12-07T03:19:20.390" LastActivityDate="2013-12-07T03:19:20.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13065" PostTypeId="1" CreationDate="2013-12-07T04:21:42.123" Score="0" ViewCount="131" Body="&lt;p&gt;I have written a bit of code to upsample and interpolate a sample waveform in MATLAB. It's at the point where I have taken a signal, upsampled it 2x and filled in the gaps with 0's, and then I found the fourier series coefficients. I know I need to choose which coefficients to multiply by 0 and which to multiply by 1 in order to get a low-passed signal which I will then perform an inverse Fourier Transform on, and this will give me back my interpolated upsampled signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all - why do I need to low pass this signal? I suppose I kind of added period information my bringing in those 0's and upsampling the signal, but I don't understand how to find a cutoff for this ideal lowpass I need, and how to translate that cutoff frequency into 0's and 1's scaling my FS coefficients. I heard I need to multiply every other sample by 0, but I don't know why this would be correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [a] = UpSampler(x)&#xA;N=length(x);&#xA;Nu = 2*N;&#xA;xt=zeros(1,Nu);&#xA;&#xA;for n=1:Nu&#xA;    if(mod(n-1,2)==0)&#xA;        xt(n)=x(1+(n-1)/2);&#xA;    end&#xA;    if(mod(n-1,2)==1)&#xA;        xt(n)=0;&#xA;    end&#xA;end&#xA;&#xA;a = getDTFS(xt);&#xA;&#xA;%multiply a coefficients by 0 or 1&#xA;%Perform Inverse FT to get interpolated signal&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7194" LastActivityDate="2013-12-07T07:19:35.510" Title="Multiply FS Coefficients by 0 or 1 to get Low Pass Filter?" Tags="|matlab|fourier-transform|lowpass-filter|fourier-series|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13066" PostTypeId="2" ParentId="13065" CreationDate="2013-12-07T07:13:38.480" Score="1" Body="&lt;p&gt;This is generally better visualized graphically. When you upsample a signal by inserting zeros between samples you get replicas of the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take a simple bandpass signal and plot it. All I'm doing is taking noise and lowpass filtering it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = filter(fir1(255, 0.2), 1, randn(1, 1024));&#xA;plot(20*log10(abs(fft(y))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xpbj0m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's plot an upsampled version. Usually L is used to denote the integer amount of upsampling in some texts, let's go with L = 2 &amp;amp; 4.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subplot(211)&#xA;plot(20*log10(abs(fft(upsample(y, 2)))))&#xA;subplot(212)                            &#xA;plot(20*log10(abs(fft(upsample(y, 4)))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nD4rcm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how we now have 2 &amp;amp; 4 replicas of the original spectrum. This is effectively what happens when you upsample a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the problem is I have spectral content in places that it shouldn't be. This is where lowpass filtering is used. In the time domain I'm filling in the zeros with interpolated data and in the frequency domain I'm trying to reduce that unwanted spectral content to finally arrive at these plots. Notice how the new filter cutoff frequencies are at fc/L since I've effectively increased the sample rate by fs*L. The original bandpass signal went up to 0.2*fs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subplot(211)&#xA;plot(20*log10(abs(fft(filter(fir1(255, 0.10), 1, upsample(y, 2))))))&#xA;subplot(212)                                                       &#xA;plot(20*log10(abs(fft(filter(fir1(255, 0.05), 1, upsample(y, 4))))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q8xPrm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2013-12-07T07:19:35.510" LastActivityDate="2013-12-07T07:19:35.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13067" PostTypeId="1" AcceptedAnswerId="13074" CreationDate="2013-12-07T10:01:25.963" Score="0" ViewCount="1671" Body="&lt;p&gt;i have to implement a function in matlab,for labeling silenced,voiced and unvoiced frames in signal.&#xA;I mean i want to specify each frame as a voiced or unvoiced or silenced frame by using &#xA;pitch frequency and zero processing rate and energy.&#xA;how can i calculate pitch frequency?&#xA;where should i start from?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7070" LastEditorUserId="7070" LastEditDate="2013-12-31T17:53:16.753" LastActivityDate="2013-12-31T17:53:16.753" Title="recognizing frames as voiced/unvoiced/silence" Tags="|pitch|zero-padding|" AnswerCount="1" CommentCount="0" ClosedDate="2014-01-17T18:14:25.677" ContentLicense="CC BY-SA 3.0" />
  <row Id="13068" PostTypeId="1" CreationDate="2013-12-07T13:51:45.257" Score="0" ViewCount="4340" Body="&lt;p&gt;I would like to compute the minimum sampling frequency for the signal $x(t)$ given below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)= sinc ^3(300t) * sinc ^5(600t)$ and  $ *$ stands for convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the sinc function is defined as $sinc (w t) = sin (\pi wt)/(\pi wt)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried like this  : $sinc^3(300t)$ will correspond convolution of 3 rectangular functions in frequency domain which results in a frequency limited function to 3 times 150 Hz ie 450 Hz. And the other function corresponding to maximum of frequency 5 times 300 Hz which is 1500 Hz. Now finally convolution operator get transformed to multiplication in frequency domain , is the maximum frequency content limited to 450 Hz and minimum sampling frequency 900 Hz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be helpful if someone shows me the derivation of fourier transform of sinc function for this purpose.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2013-12-08T22:05:43.397" Title="Minimum Sampling frequency for this signal to avoid aliasing" Tags="|sampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13074" PostTypeId="2" ParentId="13067" CreationDate="2013-12-07T20:19:52.033" Score="1" Body="&lt;p&gt;I think that when you said &quot;&lt;code&gt;zero processing rate&lt;/code&gt;&quot; you meant  &quot;&lt;code&gt;zero crossing rate&lt;/code&gt;&quot;, are a lot of way to find the pitch frequency, autocorrelation based methods is one choice, if your signal is always monophonic you can try AMDF (Average Magnitude Difference Function), AMDF is calculated  by the difference between the waveform summing a lagged version of itself, I like to use AMDF, work fine in monophonic signals, this can be defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$AMDF(m)=\sum_{i=0}^{n-1-m}|x(i) - x(i+m)|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=your signal&#xA;n=length(x)-1&#xA;i = 0 ... n&#xA;m = time lag block size&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Together Pitch Frequency + Zero Crossing Rate + Energy, can track if your frame is voiced/unvoiced/silenced&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The pitch Frequency say if exist periodicity in your frame &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Zero Crossing Rate say the times that amplitude of the signal changes&#xA;(crosses the x-axis)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Energy says how high or low is your frame&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;now you need to make decisions based in some threshold, and based in this decisions you can label your frames&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2013-12-07T21:00:18.967" LastActivityDate="2013-12-07T21:00:18.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13075" PostTypeId="1" CreationDate="2013-12-07T20:21:45.057" Score="-1" ViewCount="5271" Body="&lt;p&gt;I am trying to make a spectrogram viewer without using the spectrogram command. For this purpose, I used a sin function. I broke up the input signal into 256 segments, multiplied each segment with the Hamming window, took the FFT of each slice and then stored them to obtain spectra of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I couldn't get the exact spectrum. It is probably due to the fact that I could not divide input signal into overlapping segments? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code: Can someone help me where I am doing it wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;                    % Sampling frequency&#xA;T = 1/Fs;                     % Sample time&#xA;L = 10240;                     % Length of signal&#xA;NFFT=10240;                   % number of fft points&#xA;t = (0:L-1)*T;                % Time vector&#xA;x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);   &#xA;X = hann(L).*x';&#xA;figure&#xA;plot(X)&#xA;k=256;&#xA;&#xA;&#xA;for idx = 1:length(x)/k&#xA;     %take a slice from the input vector&#xA;    slice =  x(1+(idx-1)*k:idx*k);&#xA;    %multiply it with the window and transform it into frequency domain&#xA;    spectrum =  fft(slice'.*hamming(k),k);&#xA;    %get the spectrum magnitude at each of the 256 frequency points and store it&#xA;    mag_spectrum(:,idx*1024) = abs(spectrum).^2;&#xA;&#xA;end&#xA;&#xA;&#xA;&#xA;figure &#xA;w=hamming(k);&#xA;plot(w)&#xA;figure&#xA;plot(t,X,'k');&#xA;xlabel('Time (sec)','FontSize',14);&#xA;ylabel('\it{x(t)}','FontSize',14);&#xA;&#xA;&#xA;% spectrogram(x,128); &#xA;% SET PARAMETERS&#xA;&#xA;figure &#xA;plot(slice); % To look for it is windowed or not which is not in my case?&#xA;&#xA;%figure&#xA;%plot(mag_spectrum);&#xA;figure&#xA;spectrogram(X,256); % Real spectogram&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7195" LastEditorUserId="943" LastEditDate="2013-12-19T20:44:20.223" LastActivityDate="2022-07-13T03:06:55.747" Title="Re-implementing the &quot;spectrogram&quot; function from matlab" Tags="|matlab|kalman-filters|zero-padding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13076" PostTypeId="1" CreationDate="2013-12-07T23:59:40.307" Score="2" ViewCount="4011" Body="&lt;p&gt;I am a little unsure about the generation of a additive white Gaussian noise, so I would appreciate to hear from you if I`m doing it correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to generate the time-domain noise correspondent to a noise floor of -135 dbm/Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The procedure I`m adopting is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Convert the noise floor in dbm/Hz to Watts/Hz&lt;br&gt;&#xA;2 - Get the average total power from the PSD.&lt;br&gt;&#xA;3 - Generate the Gaussian noise with this average total power&lt;br&gt;&#xA;4 - Take the FFT of the Gaussian noise and estimate the periodogram to verify whether it is indeed generating the noise with the correct PSD&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how I do the 4 steps above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - &#xA;\begin{align} S_\text{watts} = \left(10^{\frac{S_\text{dBm}}{10}}\right)10^{-3} \end{align}&#xA;where $S_\text{watts}$ is the PSD in Watts/Hz and $S_\text{dBm}$ is the PSD in dBm/Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Average total power is given by $$ P_n = S_\text{watts} B ,$$ where $B$ is the Bandwidth&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - Generate the &lt;em&gt;randn&lt;/em&gt; MATLAB function multiplied by $\sqrt{P_n}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 -&lt;br&gt;&#xA;4.1 Take the FFT of the signal, let`s say, $X(k)$.&lt;br&gt;&#xA;4.2 Get the Energy Spectral Density (ESD) as $\frac{\left| X(k) \right|^2}{N}$&lt;br&gt;&#xA;4.3 Get the PSD by simply dividing the ESD by $N$ (the FFT length)&#xA;4.4 I do not simply plot the $10 \log_{10}\left(\text{PSD} 10^3\right)$, since I believe this would plot the PSD in dBm/subcarrier. Instead of this, I plot $10 \log_{10}\left(\frac{\text{PSD}}{\text{tone spacing}} 10^3\right)$, in attempt to get the plot as dBm/Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below is what I am using. Please, indicate if I`m doing any mistake.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;clc&#xA;&#xA;bandwidth = 106e6;                          % in Hz&#xA;sampleFrequency = 2*bandwidth;              % in Hz&#xA;noiseFloor = -135;                          % in dBm/Hz&#xA;awgnPsd = (10.^(noiseFloor/10))*1e-3;       % in Watts/Hz&#xA;noisePower = awgnPsd*2*bandwidth;           % in Watts&#xA;&#xA;% Generate noise signal:&#xA;N = 4096;           % signal length&#xA;nSymbols = 1000;     % number of symbols with length N to be generated&#xA;noise = randn(N,nSymbols)*sqrt(noisePower);&#xA;&#xA;% Verify PSD&#xA;toneSpacing = sampleFrequency/N;        % DFT tone spacing           &#xA;ESD = mean(abs(fft(noise,N)).^2)/N;     % Energy spectral density&#xA;PSD = ESD/N; &#xA;&#xA;&#xA;% plot PSD&#xA;figure&#xA;plot(10*log10((PSD/toneSpacing)*1e3))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4590" LastActivityDate="2017-06-19T18:27:38.690" Title="How to generate AWGN with given power spectral density" Tags="|power-spectral-density|gaussian|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13077" PostTypeId="2" ParentId="13075" CreationDate="2013-12-08T03:43:50.817" Score="0" Body="&lt;p&gt;Differences between your implementation and what the spectogram function is displaying.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;This looks wrong and you don't preallocate the mag_spectrum matrix (which is bad practice).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mag_spectrum(:,idx*1024) = abs(spectrum).^2;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mag_spectrum(idx, :) = abs(spectrum).^2; % Use this instead&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mag_spectrum(:, idx) = abs(spectrum).^2; % Or this... depending on how you want the data to 'waterfall'&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You don't have the proper scaling (see reference paper and code below). Also, I believe the spectogram is displayed in dB.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You're saving the two-sided FFT. This is unnecessary and the spectogram defaults to the one-sided FFT. Use the proper scaling accordingly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here's some code used to compute the average PSD of an input sequence using a provided window and some other parameters. You can modify the last few lines to return the entire spectogram by getting rid of the call to 'mean' and properly handling the last step of reindexing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performing the overlap is pretty easy if you convert the data vector into a matrix using reshape, and then proceed to concatenate that matrix with a shifted version of itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good explanation of some of the subtleties of the PSD is presented in this &lt;a href=&quot;http://edoc.mpg.de/395068&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;, especially regarding scaling.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[px f] = welch(randn(1,32768), 1024, ones(1,1024), 512, 1024, 0);&#xA;plot(f, 10*log10(abs(px)))&#xA;&#xA;function [Px, f] = welch(x, fs, win, overlap, Nfft, oneside)&#xA;% x=vector of data samples&#xA;% fs=sampling frequency (in Hz)&#xA;% win=vector containing the window&#xA;% overlap=number of points to overlap&#xA;% Nfft=length of FFT to use&#xA;% oneside=a logical variable indicating whether &#xA;%    scaling is for 1-sided or 2-sided PSD (true if 1-sided)&#xA;% Px=estimate of the power spectral density&#xA;% f=vector of frequencies (in Hz) for plotting&#xA;if nargin &amp;lt; 6&#xA;  error('Insufficient input arguments')&#xA;end&#xA;&#xA;x = x(:);&#xA;win = win(:);&#xA;&#xA;Nw = length(win);&#xA;Ns = length(x);&#xA;&#xA;% Compute the frequency vector and scale factor&#xA;if oneside == true&#xA;  sfactor = 2 ./ (fs * sum(win.^2));&#xA;  f = fs * (0:Nfft/2).'./Nfft;&#xA;else&#xA;  sfactor = 1 ./ (fs * sum(win.^2));&#xA;  f = fs * (-Nfft/2:Nfft/2-1).'./Nfft;&#xA;end&#xA;&#xA;% Clip excess data&#xA;x = x(1:floor(Ns/(Nw-overlap)) * (Nw-overlap));&#xA;&#xA;% Perform overlap by appending a shifted version&#xA;% of the data matrix&#xA;y = reshape(x, Nw-overlap, []);&#xA;y = [y; circshift(y(1:overlap, :), [0 -1])];&#xA;y = bsxfun(@times, y, win);&#xA;&#xA;% get rid of last column&#xA;if size(y, 2) &amp;gt; 1&#xA;  y = y(:,1:end-1);&#xA;end&#xA;&#xA;% Compute the PSD&#xA;Px = sfactor * mean( abs(fft(y, Nfft)).^2, 2);&#xA;&#xA;% Return full or onesided result&#xA;if oneside == true&#xA;  Px = Px(1:end/2+1);&#xA;else&#xA;  Px = fftshift(Px);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2013-12-09T17:54:10.030" LastActivityDate="2013-12-09T17:54:10.030" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13078" PostTypeId="1" CreationDate="2013-12-08T08:36:35.340" Score="1" ViewCount="3396" Body="&lt;p&gt;I have a question regarding an alternating pulse train signal, $p(t)$, and a system which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7Imtp.png&quot; alt=&quot;Alternating Pulse Train&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0EGpe.png&quot; alt=&quot;System&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Immediately, I'm supposed to be able to extrapolate that &#xA;$$&#xA;P_t = P_1(t)-P_1(t-\Delta)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How do you obtain this? &lt;/li&gt;&#xA;&lt;li&gt;How would you get the Fourier transform of this pulse train from there?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7194" LastEditorUserId="1629" LastEditDate="2017-02-23T15:50:07.770" LastActivityDate="2019-02-02T12:44:33.230" Title="Expression to represent alternating pulse train?" Tags="|fourier-transform|sampling|homework|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13080" PostTypeId="1" CreationDate="2013-12-08T20:54:50.157" Score="0" ViewCount="2897" Body="&lt;p&gt;I need compare two signals. Signals have simliar shapes but completely different values (as on picture):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tQ2jJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think cross corelation in frequency domain should gave me a number that shows me how the signals are similar. But I have no idea how to do that in matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I can find code to do it?&lt;/p&gt;&#xA;" OwnerUserId="5688" LastActivityDate="2022-07-13T15:02:50.273" Title="Signal compare - cross corelation in frequency domain matlab" Tags="|matlab|frequency-spectrum|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13081" PostTypeId="2" ParentId="13080" CreationDate="2013-12-08T21:51:37.123" Score="1" Body="&lt;p&gt;Yes, cross-correlation will provide some information on the similarity of the two waveforms. See the function reference for &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/xcorr.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;xcorr&lt;/a&gt;. Look into proper normalization so that the result is between something like 0 and 1 or -1 and 1. As a matter of fact, this is pretty well discussed in another stackexchange &lt;a href=&quot;https://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar&quot;&gt;question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for frequency domain cross-correlation, I don't think that's what you want to do. Doing time-domain cross-correlation results in multiplication in the frequency domain, so you're looking to maximize the total energy in F(x)*F(y), where F(x) is the FFT of x.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2013-12-08T21:51:37.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13082" PostTypeId="2" ParentId="13068" CreationDate="2013-12-08T22:05:43.397" Score="1" Body="&lt;p&gt;There's several different ways you can go about solving this problem just in the time domain. Use trig &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_trigonometric_identities&quot; rel=&quot;nofollow&quot;&gt;identities&lt;/a&gt; or Eulers &lt;a href=&quot;http://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;nofollow&quot;&gt;formula&lt;/a&gt; to reduce the equation. Both are simple enough and just require some time to work through. Feel free to use &lt;a href=&quot;http://www.wolframalpha.com/input/?i=sin%28300x%29%5E3%2asin%28600x%29%5E5&quot; rel=&quot;nofollow&quot;&gt;WolframAlpha&lt;/a&gt; to check your work. I find it sometimes helpful for tedious algebra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, the Fourier transform of a sinc function is a rectangular function, so you will have what you've described as convolved rectangular functions. This is more work than is necessary as after you've simplified the time-domain expression you will be able to find the maximum frequency, and subsequently the required sampling rate, for that signal.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-12-08T22:05:43.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13083" PostTypeId="1" CreationDate="2013-12-08T23:43:12.400" Score="1" ViewCount="8892" Body="&lt;h2&gt;Reference&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Second&lt;/strong&gt; post on &lt;a href=&quot;http://www.edaboard.com/thread57404.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;EdaBoard.com&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Time response of a system is the time evolution of the variables. In&#xA;circuits, this would be the waveforms of voltage and current versus&#xA;time.&lt;/p&gt;&#xA;&lt;p&gt;Natural response is the system's response to initial conditions with&#xA;all external forces set to zero. In circuits, this would be the&#xA;response of the circuit with initial conditions (initial currents on&#xA;inductors and initial voltage on capacitors for example) with all the&#xA;independent voltages set to zero volts (short circuit) and current&#xA;sources set to zero amps (open circuit). The natural response of the&#xA;circuit will be dictated by the time constants of the circuit and in&#xA;general roots of the characteristics equation (poles).&lt;/p&gt;&#xA;&lt;p&gt;Forced response is the system's response to an external stimulus with&#xA;zero initial conditions. In circuits, this would just be the response&#xA;of the circuit to external voltage and current source forcing&#xA;function... &lt;strong&gt;&lt;a href=&quot;http://www.edaboard.com/thread57404.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;continue reading&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2&gt;Questions&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How can there be even a natural response? Something has to be inputted to create an output? The way I see it is like turning of the main water line and then turning on your faucet and expecting water to come out.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can we &lt;code&gt;v(t)&lt;/code&gt; (from the link above) be solved for if we don't know &lt;code&gt;dv(dt)&lt;/code&gt; in order to find the natural response?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you can please expand on the 2 concepts (natural response and forced response) by explaining their differences in Layman's terms, it would be lovely.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5380" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-12-08T23:43:12.400" Title="Difference between natural response and forced response?" Tags="|impulse-response|transfer-function|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13084" PostTypeId="2" ParentId="13076" CreationDate="2013-12-09T00:20:39.813" Score="2" Body="&lt;p&gt;Here is a Matlab snippet that might help. You should be able to apply the result to your favorite PSD routine to see the dbm/Hz in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% create complex noise with a desired dBm/Hz&#xA;fs=1e6;             % whatever you want&#xA;N=1e5;              % # samples of noise&#xA;R=50;               % ohms&#xA;dbm_hz = -135;      % goal&#xA;bw = fs;            % complex noise with BW = sample rate&#xA;dbm = dbm_hz + 10*log10(bw);&#xA;dbw = dbm - 30;&#xA;watts = 10^(dbw/10);&#xA;vrms = sqrt(watts * R);&#xA;n = randn(N,1) + j*randn(N,1);&#xA;n = vrms * n / std(n);&#xA;meas_dbm_hz = 10*log10(sqrt(mean(n.*conj(n)))^2 / R) - 10*log10(bw) + 30&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3434" LastEditorUserId="1825" LastEditDate="2017-06-19T18:27:38.690" LastActivityDate="2017-06-19T18:27:38.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13086" PostTypeId="1" CreationDate="2013-12-09T08:34:04.340" Score="0" ViewCount="198" Body="&lt;p&gt;Does anyone know how to write arg min code in matlab with explanation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am referring to a paper for my research. I am not sure whether I can paste the paper link here. At first, I try to do feature extraction of finger using Gabor Filter. According to the paper, after feature extraction level, I need to do the following using formula to get my desired image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OriCode(x, y) = arg j min {I(x, y) ∗ G(x, y, θj)}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;∗ stands for convolution,&#xA;I(x,y) stands for input image,&#xA;G(x,y,θj) stands for gabor filtered image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is actually a small j between arg and min. OriCode ranges from 0 to J-1 &#xA;whereby j ranges from 0 to J. Here,J is set to 6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to use conv2 to convolute my original input image and gabor filtered image. End up I am getting a blank white image. And what is the arg min used for? Please help me. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7186" LastEditorUserId="128" LastEditDate="2019-06-24T09:01:01.133" LastActivityDate="2019-06-24T09:01:01.133" Title="Convolution in Image Processing" Tags="|image-processing|convolution|gabor|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13087" PostTypeId="2" ParentId="13056" CreationDate="2013-12-09T09:58:22.147" Score="2" Body="&lt;p&gt;As you mention, linear prediction attempts to estimate the next signal sample from a linear combination of the previous P outputs.  Mathematically, we can then express the $n^{th}$ sample of our signal $x[n]$ like this:&#xA;\begin{equation}&#xA;x[n] = \sum^{P}_{k=1} a_k x[n-k]+e[n]&#xA;\end{equation}&#xA;where $e[n]$ is the error signal.  Applying linear prediction to a frame of our signal of, say, length $N$ samples ($N\gg P$) gives us the linear prediction coefficients ${a_1,a_2,\cdots,a_P}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For signals where this model is valid, the error signal $e[n]$ contains very little information compared to $x[n]$.  The linear prediction operation then has given us $P$ numbers which represents most of the signal, as opposed to $N$ of them; in other words, we've been able to &lt;em&gt;code&lt;/em&gt; the signal, hence linear predictive coding.  This coding of the signal is enormously useful for many different applications.  (Your mobile phone determines the linear prediction coefficients of your voice hundreds of times a second while you call your friends!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, the linear predictive coefficients are essentially the coefficients of the optimal all-pole filter which describes $x[n]$. (In what sense of optimality depends on the algorithm used to determine them, but it's generally some form of time-domain least mean squares).  This means that we have an estimate of the frequency-domain envelope of $x[n]$, which we can derive from our coefficients.  Speech recognition generally operates from a frequency-domain perspective, and so linear prediction coefficients can be useful for that application too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For improved recognition performance, it is useful to represent the frequency spectrum in other forms more closely linked with the way that we hear, i.e. some kind of perceptual domain. MFCCs and other similar signal representations (I assume that LPCCs do something similar, as I'm not familiar with them) do just that and warp the linear frequency domain in a way such that perceptual differences will be more apparent.&lt;/p&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2013-12-09T09:58:22.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13088" PostTypeId="2" ParentId="13056" CreationDate="2013-12-09T10:42:36.557" Score="2" Body="&lt;p&gt;Speech - along with the sounds produced by most musical instruments - can be described by a source-filter model. In the case of speech, the source is the glottis - producing a periodical pulse train - and the filter is the vocal tract - acting like a filter with several narrow peaks (formants) shaping the pulse train. When articulating different phonemes (try saying &quot;a o i&quot;...) what changes is the reponse of this filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The outcome of linear prediction analysis is a set of coefficients describing a filter, and a residual signal - such that the analyzed signal is the result of filtering the residual signal by an all-pole filter having the estimated coefficients. In other words, this &quot;reverse-engineers&quot; the process of speech production, with the contribution of the vocal tract explained by the coefficients, and the contribution of the glottis explained by the residual signal. What determines which phoneme is spoken is mostly the configuration of the vocal tract during speech production - hence the usefulness of linear prediction coefficients for speech recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, cepstral analysis is good at isolating the contributions of the source and the filter in a signal produced according to the source/filter model. The very first cepstral coefficients capture the contribution of the filter, the higher coefficients make easy to detect the periodicity of the source.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-12-09T10:42:36.557" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13090" PostTypeId="1" AcceptedAnswerId="13101" CreationDate="2013-12-09T11:44:20.950" Score="0" ViewCount="4012" Body="&lt;p&gt;I am using IPP for FIR filtering over 1D data. I want to use the same input and filter it using two band pass filters. This is how I do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output1 = doFIRBandPassFilter(input,low1,high1);&#xA;output2 = doFIRBandPassFilter(input,low2,high2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to combine those outputs so that the end result will show BOTH (low1,high1) and (low2,high2) filtered data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If output1 and output2 are arrays - should I add them? multiply them? convolve them?&lt;/p&gt;&#xA;" OwnerUserId="5846" LastEditorUserId="39" LastEditDate="2013-12-09T15:13:46.297" LastActivityDate="2013-12-10T16:02:40.463" Title="Combining two FIR band-pass filters" Tags="|finite-impulse-response|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13091" PostTypeId="2" ParentId="13090" CreationDate="2013-12-09T12:45:21.503" Score="2" Body="&lt;p&gt;Just use the output of the first filter as input into the second&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output1 = doFIRBandPassFilter(input,low1,high1);&#xA;output2 = doFIRBandPassFilter(output1,low2,high2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-09T12:45:21.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13092" PostTypeId="1" CreationDate="2013-12-09T13:30:19.343" Score="1" ViewCount="165" Body="&lt;p&gt;I have applied a complex wavelet transform on two signals :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a first one&lt;/li&gt;&#xA;&lt;li&gt;a second one that is a concatenation of the first signal and another one&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For the 4th coefficient (as an example, i've got the same problem for all of them), i get the following graph for its module (1- is blue, 2- is green) :&lt;img src=&quot;https://i.stack.imgur.com/6uVUJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could explain the differences observed between the two signals ? Seems like the coefficients don't have the same spectral width ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Jazzmaniac&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two graphs are (almost) generated as follow in python (i've generalized to sinus signals, and plotted every coefficients).&#xA;In reality, not all the coefficients are different : only those in relation with signal frequencies.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;import pylab&#xA;import dtcwt&#xA;&#xA;f1 = 10.&#xA;f2 = 15&#xA;w1 = numpy.pi * f1&#xA;w2 = numpy.pi * f2&#xA;&#xA;time_interval = 100&#xA;samples = 50000&#xA;t = numpy.linspace(0, time_interval, samples)&#xA;&#xA;x1 = numpy.sin(w1 * t)&#xA;x2 = numpy.sin(w2 * t)*1.5&#xA;&#xA;x12 = numpy.array(list(x1)+list(x2))&#xA;&#xA;y1 = numpy.abs(dtcwt.dtwavexfm(x1,8)[1])&#xA;y2 = numpy.abs(dtcwt.dtwavexfm(x12,8)[1])&#xA;&#xA;for i in range(8):&#xA;    pylab.figure()&#xA;    pylab.plot(y1[i][50:150], '-x')&#xA;    pylab.plot(y2[i][50:150], '-x')&#xA;    pylab.grid()&#xA;    pylab.title('yh'+str(i))&#xA;    pylab.legend(('Coil alone','2 coils'))&#xA;pylab.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When i change x1 in :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x1 = numpy.array(list(x1)+list(x1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get exactly the same coefficients (ie. when x1 and x2 have the same length and x1 is &quot;substantial&quot; : filling the difference with zeros doesn't work).&lt;/p&gt;&#xA;" OwnerUserId="7206" OwnerDisplayName="Xavier R." LastEditorUserId="7206" LastEditDate="2013-12-10T16:14:53.570" LastActivityDate="2013-12-10T16:14:53.570" Title="Differences observed on the complex wavelet transform applied on the same signal" Tags="|wavelet|" AnswerCount="0" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13093" PostTypeId="1" CreationDate="2013-12-09T14:32:07.863" Score="-1" ViewCount="655" Body="&lt;p&gt;I want to separate out the components that I need to evaluate the pronunciation of a user,  so I am dealing with the energy/stress/volume and intonation or pitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Focusing first on the pitch, is there any way to get the average pitch of the wave file? I would like to get the average of the user's input with respect to the reference and make a percentage match.&lt;/p&gt;&#xA;" OwnerUserId="7207" LastEditorUserId="76" LastEditDate="2013-12-10T11:33:42.587" LastActivityDate="2013-12-10T11:33:42.587" Title="Getting the average pitch of a wave in C#" Tags="|audio|pitch|c#|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13094" PostTypeId="2" ParentId="13093" CreationDate="2013-12-09T15:11:41.043" Score="1" Body="&lt;p&gt;I think if you want to evaluate pronunciation, comparing the average pitch of two utterances is a terrible idea. It does not make sense because:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Unless you are working with a tone language (like Chinese or Vietnamese), or something specifically related to prosody (english stress patterns), pitch is of lesser importance than other parameters.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;An utterance can have exactly the same prosody parameters as another, but be spoken a few semitones or even an octave higher than the reference (for example because both speakers are not of the same gender). The average pitch will differ but this is not an error.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Two utterances can wildly differ on every conceivable metric, but their pitches can average out to the same value &quot;by chance&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The very least thing you could do is to extract pitch contours, compute their derivate or quantize their variations coarsely (to remove the transposition problem 2.), and align them through DTW.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-12-09T15:11:41.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13095" PostTypeId="2" ParentId="13086" CreationDate="2013-12-09T17:22:24.953" Score="2" Body="&lt;p&gt;I'm going to use a grayscale image for simplicity. Suppose you have a 3D matrix and each slice is the result of filtering the image with the Gabor filter for that angle.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = randn(256, 256); % Just some random image&#xA;G = gabor_filter; % Assume G is 256x256xNum_Angles, e.g. 256x256x6 if you had 6 angles&#xA;Y = zeros(256, 256, size(G, 3)); % Preallocate a temporary matrix&#xA;&#xA;for idx = 1:size(G, 3)&#xA;    Y(:, :, idx) = conv2(I, G(:, :, idx), 'same');&#xA;end&#xA;&#xA;Ymin = min(Y, [], 3); % This takes the minimum along the 3rd dimension&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-12-09T17:22:24.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13096" PostTypeId="1" CreationDate="2013-12-09T19:39:10.083" Score="1" ViewCount="1635" Body="&lt;p&gt;I`m confused on how to calculate a signal power. For example, suppose I generate a complex: signal $$x[n] = (1 + j3)e^{j2 \pi k n/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DSP theory says the average power of a periodic signal with period $N$ is:&#xA;$$ \frac{1}{N} \sum \limits_{n=0}^{N-1} \left| x[n] \right|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that mean the signal power is independent of its sampling frequency? For example, suppose I have these $N$ samples within 2ms and another signal with these $N$ samples within $1ms$. The above formula for average power yields the same result, although from a continuous time perspective the second signal would present the same energy in less time, which would mean more power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose a want to generate a signal with a given power in Watts and assume the sampling frequency is given, how should I control the signal power (through normalization), using the discrete signal average power formula or considering symbol period (in seconds)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="4590" LastEditorUserId="4590" LastEditDate="2013-12-09T20:21:42.413" LastActivityDate="2013-12-09T20:21:42.413" Title="Discrete signal power. Does it depend on sampling frequency?" Tags="|discrete-signals|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13097" PostTypeId="1" AcceptedAnswerId="13098" CreationDate="2013-12-09T20:41:20.230" Score="0" ViewCount="121" Body="&lt;p&gt;I have just started my first proper course in DSP, and am a little confused about a statement in my textbook.  The book states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Notice that when the Nyqust-frequency is &lt;strong&gt;defined&lt;/strong&gt; as $\pi/\Delta t$, we will with $\omega_m = 2 \pi m/N \Delta t$ where $m = 0, \pm 1, \pm2, ...$ have $\omega_m \neq \pi/ \Delta t$, unless $N$ is even.  If we are working with symmetric functions, it can be wise to use an odd number of sampling points.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see the logic in the first sentence here, but don't understand how it follows from this that it is wise to use an odd number of sampling points for a symmetric function. This statement is not elaborated upon further. Can anyone explain this logic to me?  Why it is wise to use an odd number of sampling points for a symmetric function?  If anyone could explain this, I would greatly appreciate it!&lt;/p&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2013-12-09T20:58:41.410" Title="Odd sampling for symmetric functions?" Tags="|sampling|symmetry|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13098" PostTypeId="2" ParentId="13097" CreationDate="2013-12-09T20:58:41.410" Score="2" Body="&lt;p&gt;It is because it is symmetric about m = 0. So if you have an odd number of points then you can also sample at +/-1, +/-2, and so on. Thus each of the points has it's counterpart except for zero. This only works with an odd number of points.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-09T20:58:41.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13099" PostTypeId="2" ParentId="2625" CreationDate="2013-12-09T21:00:14.073" Score="2" Body="&lt;p&gt;BBC discovered the way by decoding colour dots to restore a formerly colour movie to which only the black and white copy is available. They are able to restore the colour back to the original colour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://www.youtube.com/watch?v=CjK-b4x9ZmQ&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=CjK-b4x9ZmQ&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7211" LastActivityDate="2013-12-09T21:00:14.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13100" PostTypeId="1" CreationDate="2013-12-09T21:19:37.237" Score="0" ViewCount="895" Body="&lt;p&gt;I need help with iris localization. I have applied the &lt;code&gt;imfincircle&lt;/code&gt; function to locate it, but it only locates the inner boundary of the pupil and does not find outer boundary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I locate the outer boundary?&lt;/p&gt;&#xA;" OwnerUserId="7212" LastEditorUserId="76" LastEditDate="2013-12-10T11:30:02.870" LastActivityDate="2013-12-20T14:14:16.457" Title="Locating the outer boundary of the iris" Tags="|image-processing|matlab|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13101" PostTypeId="2" ParentId="13090" CreationDate="2013-12-09T21:22:56.683" Score="3" Body="&lt;p&gt;As you've indicated there may be some mismatching in the filter bands resulting in undesirable results. If one of the filters is heavily attenuating the frequencies of the other filter, there's little you can do to reconcile this by just cascading the filters together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given you'd like to maintain the response of both filters independent of the other, you need to add the filter outputs together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some code that shows the result of one filter heavily attenuating the frequencies of the other. It also shows the equivalence of cascading two filters either by connecting the output to the input of the next stage or just convolving the filter taps.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b1 = fir2(2048, [0 0.1 0.15 0.3 0.35 1], [0 0 1 1 0 0]);&#xA;b2 = fir2(128, [0 0.4 0.45 0.6 0.65 1], [0 0 1 1 0 0]);&#xA;&#xA;x = randn(1, 32768);&#xA;&#xA;% Parallel sum&#xA;y1 = filter(b1, 1, x) + filter(b2, 1, x);&#xA;&#xA;% Cascade&#xA;y2 = filter(b2, 1, filter(b1, 1, x));&#xA;&#xA;% Equivalent cascade&#xA;y3 = filter(conv(b1, b2), 1, x);&#xA;&#xA;figure, hold all&#xA;subplot(311), plot(20*log10(abs(fft(y1))))&#xA;subplot(312), plot(20*log10(abs(fft(y2))))&#xA;subplot(313), plot(20*log10(abs(fft(y3))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cnlc5m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2013-12-10T16:02:40.463" LastActivityDate="2013-12-10T16:02:40.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13102" PostTypeId="2" ParentId="13090" CreationDate="2013-12-09T22:30:37.117" Score="2" Body="&lt;p&gt;I'm assuming that the two bandpass regions do not overlap.  If that is the case you can combine the output of both by simply adding the two outputs together.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-12-09T22:30:37.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13105" PostTypeId="1" CreationDate="2013-12-10T06:14:06.577" Score="0" ViewCount="212" Body="&lt;p&gt;I'm asked to design FIR filter, an ideal low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm given with pass band frequency (wp) and stop band frequency (ws). Now, I have to choose Ns points from stop band and Np points from pass band. Taking the inverse will give me impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, Ns points are equally spaced and Np points are equally spaced. But the spacing of the points in pass band and stop band differ. How do I find the filter coefficients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7041" LastActivityDate="2013-12-12T20:59:20.127" Title="Designing FIR filter" Tags="|filters|discrete-signals|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13106" PostTypeId="1" CreationDate="2013-12-10T08:02:09.097" Score="0" ViewCount="315" Body="&lt;p&gt;Let's say we have 2 signals of frequencies 4 kHz and 8 kHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we sample both signals with sampling frequency 10 kHz and pass the signal through a low pass filter with cut off frequency of 10 kHz, what frequencies will be present in the output signal?&lt;/p&gt;&#xA;" OwnerUserId="7218" LastEditorUserId="76" LastEditDate="2013-12-10T11:33:19.867" LastActivityDate="2016-03-14T08:26:58.080" Title="Filtering of a sampled signal" Tags="|sampling|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13107" PostTypeId="1" CreationDate="2013-12-10T10:21:27.293" Score="0" ViewCount="1528" Body="&lt;p&gt;I have two wave files each containing a sample of a note. I wish to compare, using a program, each sample and present how loud the first sample is with respect to the second if each sample is played back to the listener with the same physical conditions (volume, distance from speaker etc.). For example, if the second sample is twice as loud as the first, I wish to present &quot;2&quot; to the user. I'm not interested in being very accurate. I simply want to give a reasonable estimation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say the first file contains only a 1kHz tone with an amplitude of 0.1 (0.1*sin(2*pi*1000*t)), while the second contains a 1kHz tone with an amplitude of 1.0 (1.0*sin(2*pi*1000*t)). So the difference is 10db correct? Does this mean that the second sample will be, roughly speaking, perceived as being twice as loud, with respect to the first?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EroCl.png&quot; alt=&quot;enter image description here&quot;&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that phons are with respect to spl and that therefore if I have only the two wave files to work with, I can't talk in such terms since I've no idea what spl existed at the microphone when the recordings were made - or more importantly, the spl that exists at the listeners ears when they hear the recording. However, lets say I have a 3kHz tone with an amplitude of 1.0 (1.0*sin(2*pi*3000*t)) in my first wave file, while the second file contains a 10kHz tone with an amplitude of 1.0 (1.0*sin(2*pi*10000*t)). Isn't it fair to say that the first file will be perceived as being louder? Should it be fair, based on the graph to say that the 3kHz tone will be perceived as being roughly 4 times louder? Since in the graph you have to, roughly speaking, increase the 10kHz signal by 20db to get the same loudness as that of a 3kHz signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again lets say that the first file contains a 3kHz tone with an amplitude of 0.1 (0.1*sin(2*pi*3000*t)), while the second contains a 10kHz tone with an amplitude of 1.0 (1.0*sin(2*pi*1000*t)). Is it fair to estimate that the difference in loudness is a factor of 0.5? That is, the first file will be perceived as being twice as loud as the second. &lt;/p&gt;&#xA;" OwnerUserId="1142" LastActivityDate="2018-06-02T16:06:06.360" Title="Comparing the loudness of two samples" Tags="|audio|phase|music|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13108" PostTypeId="2" ParentId="11218" CreationDate="2013-12-10T11:17:14.763" Score="0" Body="&lt;p&gt;If content is going out internationally then you can put translations in the extra channels. &lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2013-12-10T11:17:14.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13110" PostTypeId="1" CreationDate="2013-12-10T13:25:35.443" Score="1" ViewCount="135" Body="&lt;p&gt;Assume a signal $x[n]$ with $N$ samples and its $N$-point FFT $X[k]$. Assume also the simplest power spectral density estimator:&#xA;$$ S_x[k] = \frac{\left| X[k] \right|^2}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this estimator, the average total power can be evaluated as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;P_x = \sum \limits_{k=0}^{N-1} S_x[k] \Delta F&#xA;\end{align}&#xA;where $\Delta F$ is the distance between digital frequency points represented by the FFT and is equal to $\frac{1}{N}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, a first question arises, what is the unit of $S_x[k]$? Is it $\frac{V^2}{\text{subcarrier}}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of an analog frequency horizontal axis, the total power would be evaluated as:&#xA;\begin{align}&#xA;P_x = \sum \limits_{k=0}^{N-1} S_x[k] \Delta f&#xA;\end{align}&#xA;where $\Delta f$ is the distance between analog frequency points represented by the FFT and is equal to $\frac{f_s}{N}$ (FFT frequency spacing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sequentially, in order to represent the power spectral density over an analog frequency, the PSD estimator has to be modified to:&#xA;\begin{align}&#xA;S_x[k]' = \frac{S_x[k]}{f_s}&#xA;\end{align}&#xA;where $f_s$ is the sampling frency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this analysis correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a MATLAB snippet to verify this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;clc&#xA;&#xA;N = 4096;   % FFT size&#xA;fs = 200e6; % Sampling frequency in Hz&#xA;&#xA;Px = 4;     % Target total power&#xA;&#xA;x = sqrt(Px)*randn(N,1);    % Gaussian noise with power Px&#xA;&#xA;% Verify signal variance&#xA;fprintf('Signal total power: %d\n', var(x))&#xA;&#xA;X = fft(x,N);   &#xA;&#xA;Sx = (abs(X).^2)/N;  % Simplest PSD estimator&#xA;&#xA;deltaF = 1/N;        % Digital frequency spacing&#xA;&#xA;figure&#xA;plot((0:N-1)*deltaF, 10*log10(Sx))&#xA;xlabel('Digital Frequency')&#xA;grid on&#xA;&#xA;% Verify total power&#xA;Px = sum(Sx*deltaF)&#xA;&#xA;Sx_analog = Sx/fs;&#xA;&#xA;deltaf = fs/N;        % Analog frequency spacing&#xA;&#xA;figure&#xA;plot((0:N-1)*deltaf, 10*log10(Sx_analog))&#xA;xlabel('Analog Frequency (Hz)')&#xA;grid on&#xA;&#xA;% Verify total power&#xA;Px_2 = sum(Sx_analog*deltaf)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4590" LastEditorUserId="4590" LastEditDate="2013-12-10T18:49:25.770" LastActivityDate="2013-12-10T18:49:25.770" Title="How to properly express periodogram over analog frequency?" Tags="|fft|power-spectral-density|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13111" PostTypeId="2" ParentId="13107" CreationDate="2013-12-10T13:42:58.657" Score="1" Body="&lt;p&gt;This is tricky. Loudness is a very complicated perceptual phenomenon and playback of sound in a room is a very complicated physical phenomenon. To do this right, you would need calibrated sound pressure signal measurements at the listener's ears and then run these through a suitable perceptual model (here is a good overview article: &lt;a href=&quot;http://www.tcelectronic.com/media/1014016/skovenborg_2004_loudness_m.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.tcelectronic.com/media/1014016/skovenborg_2004_loudness_m.pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sine waves you could use the ISO 226 curves but with calibrated signal they are only correct for 1kHz. Let's say compare to sine waves at 200 Hz and one has ten times the amplitude: If playing back the first one 30 dB SPL the second one will be about 4 times louder. If you do this at 80 dB SPL the second will only be 3 times as loud at best. This gets even more complicated when multiple frequencies are involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things get a lot more messy if you include the playback system as well. For pure sine waves the perceived loudness (and energy at the ears) can vary by as much as 30 dB (factor of 8 or so) just by moving a few centimeters. That's a basic effect of room acoustics. Furthermore most playback systems are fairly non flat (either by design or by sloppiness). Most cheap set of computer speakers will not provide a lot of output at 10 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best shot is probably to assume the signal are &quot;normal&quot; (music, speech, something broad band), apply an A-weighting, assume some average playback level and calculate a loudness difference from there. This is a gross simplification but depending on the application this may or may not be good enough.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-10T13:42:58.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13112" PostTypeId="1" CreationDate="2013-12-10T14:05:00.287" Score="1" ViewCount="471" Body="&lt;p&gt;I want to extract Audio Features using RBM (Restricted Boltzmann Machine). For this, I am giving the spectrogram (PCA whitened) as an input to the RBM. For each audio file, The spectrogram is a matrix with no. of columns fixed but with different number of rows for each audio file. My question how can I train my RBM, or how can I extract the features from audio using RBM, given this spectrogram matrix. I read in a paper by Honglak Lee, paper title Unsupervised Feature Learning for Audio Classification using convolutional deep belief networks.&#xA;&lt;a href=&quot;http://machinelearning.wustl.edu/mlpapers/paper_files/NIPS2009_1171.pdf&quot; rel=&quot;nofollow&quot;&gt;http://machinelearning.wustl.edu/mlpapers/paper_files/NIPS2009_1171.pdf&lt;/a&gt;&#xA;&quot;We then trained 300 first layer bases with a filter length of 6 and a max-pooling ratio of 3.&quot;&#xA;First, what is meant by bases here. (They have used Convolutional Deep Belief Networks, so I guess, bases do not mean weights here).&#xA;Second, what do they mean by using a filter length of 6? How can I do it? Any hint will be appreciated. (I am new to RBM) &lt;/p&gt;&#xA;" OwnerUserId="7222" LastActivityDate="2013-12-10T14:05:00.287" Title="audio features extraction using restricted boltzmann machine" Tags="|audio|speech-recognition|speech-processing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13113" PostTypeId="1" CreationDate="2013-12-10T15:04:59.383" Score="1" ViewCount="337" Body="&lt;p&gt;The concept of frequency spectrum exists because it is possible to sum sines and cosines of various frequencies together to make any periodic signal. The frequencies of these individual sinusoids make up the spectrum of the final signal. Now when it comes to image processing we treat image as a signal similar to sound for example in that it has a bandwidth and it is possible to filter certain frequencies it to achieve various results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am not clear about is, how did people get concept of frequency in 2D? Sinusiods are 1D signals, how can we extend this concept of frequency into 2D? Is it possible to do the same in 3D and do filtering in 3D? Does anyone do that in any application?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I fully understand low pass, high pass, band pass and band stop filters. Their frequency respons curves are quite straight forward. What I do not understand is, how is this extended into 2D?&lt;/p&gt;&#xA;" OwnerUserId="4464" LastActivityDate="2014-05-09T19:22:55.960" Title="Can you explain how to imagine frequency in 2D? I need to understand how the concept of frequency exists in images" Tags="|filters|frequency-spectrum|" AnswerCount="1" CommentCount="5" ClosedDate="2014-05-09T21:03:53.367" ContentLicense="CC BY-SA 3.0" />
  <row Id="13114" PostTypeId="2" ParentId="13113" CreationDate="2013-12-10T16:15:30.600" Score="0" Body="&lt;p&gt;Frequency, by its definition, means how frequently something occurs. You can treat images as planes where you have data points, ie. the pixels of the data. In images a frequency can be thought of as how frequently the sinusoidal components of the structure repeat per unit distance (where your unit would be the distance of a pixel). &lt;/p&gt;&#xA;" OwnerUserId="7224" LastActivityDate="2013-12-10T16:15:30.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13115" PostTypeId="1" AcceptedAnswerId="13116" CreationDate="2013-12-10T19:10:29.383" Score="0" ViewCount="734" Body="&lt;p&gt;I have an image of size 160x160 of pixels. I am trying to convolve this image with two Gabor filters of different scales (7 and 9 respectively) but with the same orientation. I red in an article the following phrase :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The maps (the results of the two convolution operations) have the same dimensionality but they are the outputs of different filters.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After convolving my image (conv2) with these two gabor filters (scales 7 and 9), i got the following results :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2 maps (one image after convolving with gabor of scale 7 and the other after convolving with gabor of scale 9) have different dimensionality!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So according to the phrase 1) , why my maps have different sizes ? it is normal ? or false ? i need your opinions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, i filtered my image with a gabor filter of scale 7, then i filtered my image with another gabor with scale 9 . So i got two maps. Is these maps must have the same size or not ?&lt;/p&gt;&#xA;" OwnerUserId="6925" LastEditorUserId="6925" LastEditDate="2013-12-10T19:34:12.470" LastActivityDate="2013-12-10T21:22:41.340" Title="Filtering an image with two gabor filters" Tags="|image-processing|filters|convolution|filtering|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13116" PostTypeId="2" ParentId="13115" CreationDate="2013-12-10T19:29:06.307" Score="0" Body="&lt;p&gt;If you're using just straight 2D convolution, you will get the full output. What I think you want is conv2(A, B, 'same').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To better understand this, 1D convolution between two sequences with length N &amp;amp; M results in a final sequence of length = N + M - 1. So without any truncation your conv2 result will no longer be of size 160x160, but (160+M-1)x(160+M-1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using Matlab, see 'help &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/conv2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;conv2&lt;/a&gt;', 'help &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/filter2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;filter2&lt;/a&gt;', 'help imfilter' (if you have the image processing toolbox installed). imfilter defaults to 'same'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll add a little more discussion regarding filter sizes when they contain exponential functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given in reality were sampling a function that extends to infinity in all directions, albeit the values become insignificant at some point, the function does extend that far. The implementation you're referencing fixes the limits to 3 standard deviations, because that's good enough for them. I saw another implementation that used 8. If you're scale, or sigma, is very large, you run the possibility of the filter turning out to be larger than the image you'll be filtering against. What do you do then? Because like I stated earlier, straight convolution produces a sequence that is N + M - 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to grab only the central part of that result. The central part would also be of the same size as the image your filtering. That's what the 'same' flag does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other point I'd like to make is that there's nothing stopping you from just creating a filter that is the same size as your image. Instead of using sigma as the size controller, just specify the dimension of the filter. Given convolution is often times done in the frequency domain, you're going to be zero padding and taking a larger FFT anyway. Look for references on fast convolution using the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you're image size is 256x256 and you're filter is 32x32. Here's a simple example &lt;strong&gt;without&lt;/strong&gt; using power of 2 FFT's.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 256;&#xA;M = 32;&#xA;K = N + M - 1; % Length of full convolution&#xA;&#xA;x = randn(N, N);&#xA;y = ones(M, M);&#xA;&#xA;% Spatial domain convolution (slow)&#xA;r = conv2(x, y, 'same');&#xA;&#xA;% Spatial frequency domain convolution (fast)&#xA;z = ifft2(fft2(x, K, K).*fft2(y, K, K));&#xA;idx = round((K-N)/2+1):round((K+N)/2); % Indices of the central portion&#xA;z = z(idx, idx); % Obtaining the central part of the result&#xA;&#xA;subplot(311), imagesc(r), axis('square'), colorbar&#xA;subplot(312), imagesc(z), axis('square'), colorbar&#xA;subplot(313), imagesc(abs(r-z)), axis('square'), colorbar&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VbPQ9l.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="5205" LastEditDate="2013-12-10T21:22:41.340" LastActivityDate="2013-12-10T21:22:41.340" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="13117" PostTypeId="1" CreationDate="2013-12-10T19:33:51.190" Score="0" ViewCount="124" Body="&lt;p&gt;This is just a question out of my curiosity, normally we do not do this&#xA;I have a x(n)=[1 2 3]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(n) = fft[1 2 3 0] =  6 + 0i  -2 - 2i   2 + 0i  -2 + 2i %zero padding&#xA;y'(n) = fft([1 2 3]) = 6 + 0i  -1.5 + 0.87i  -1.5 - 0.87i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I used Matlab to generate these results.&#xA;My question is there way to obtain y'(n) from y(n)? &lt;/p&gt;&#xA;" OwnerUserId="7226" LastActivityDate="2013-12-10T23:39:25.943" Title="It is possible to obtain non-zero padding fft from zero padding fft?" Tags="|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13118" PostTypeId="2" ParentId="13106" CreationDate="2013-12-10T19:38:56.713" Score="1" Body="&lt;p&gt;The 8kHZ signal causes aliasing as we should sample at 2fmax = 2*8kHz = 16kHz (normally we should sample faster than 2fmax). It is also strange that you have 2 signal @4kHz and 8kHz but you want to use a LP at 10kHz.&lt;/p&gt;&#xA;" OwnerUserId="7226" LastActivityDate="2013-12-10T19:38:56.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13119" PostTypeId="1" CreationDate="2013-12-10T22:03:23.373" Score="1" ViewCount="5886" Body="&lt;p&gt;This is the spectrum of the signal:&lt;img src=&quot;https://i.stack.imgur.com/KyDB1.png&quot; alt=&quot;Welch method of SPD&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w17nt.png&quot; alt=&quot;Original sig&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the FFT spectrum you can notice the high amplitude peaks and I think these frequencies are the main ones in the signal:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JKQMY.png&quot; alt=&quot;FFT spectrum&quot;&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that the &quot;low&quot; harmonic must be clean, but I have the problem that low amplitude components are placed in every frequency interval.  The main problem is that I haven't got any model of the signal for a hypothesis about noise, and as result, I must detect noise components.  After this step, I must design a filter or use another method of filtering for denoising the signal.  Which methods can I apply for (1) detecting noise and (2) filtering?  &lt;/p&gt;&#xA;" OwnerUserId="7227" LastEditorUserId="76" LastEditDate="2013-12-12T08:53:38.873" LastActivityDate="2016-07-31T01:52:16.410" Title="How detect and filter noise from signal" Tags="|matlab|fft|filters|filter-design|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13122" PostTypeId="1" AcceptedAnswerId="13181" CreationDate="2013-12-10T23:28:41.410" Score="5" ViewCount="1160" Body="&lt;p&gt;I saw a lot of use of tensor in signal processing. What is the intuition behind it? Is it simply a common representation for audio (1D), image (2D) and video (3D) signals?&lt;/p&gt;&#xA;" OwnerUserId="3802" LastActivityDate="2013-12-19T23:33:23.653" Title="Tensor in signal processing" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13123" PostTypeId="2" ParentId="13117" CreationDate="2013-12-10T23:39:25.943" Score="1" Body="&lt;p&gt;Yes. Zero padding allows interpolation in the frequency domain. You can get the same result directly in the frequency domain using circular sin(x)/x interpolation. See for example&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-10T23:39:25.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13124" PostTypeId="1" CreationDate="2013-12-11T01:03:12.133" Score="0" ViewCount="136" Body="&lt;p&gt;A question asks for the energy and power of the following signal;&#xA;$$x[n]=\text{sinc}\left(\frac{n}{5}\right)$$ given that $$\Omega_c=\pi/5$$&#xA;Energy is $$E=\sum_{n=-\infty}^{\infty}{\left |\text{sinc}\left(\frac{n}{5}\right)\right|^2}\rightarrow \frac{1}{2\pi}\int_{-\pi}^{\pi}\left|X_c(\Omega)\right|^2d\Omega$$&#xA;My resulting expression is  $$E=\frac{1}{2\pi}\left(\frac{5}{\pi}\right)^2\int_{-\pi}^{\pi}\left|\frac{5}{\pi}\sum_{m=-\infty}^{\infty}{\text{p}\left(\frac{\Omega-2\pi m}{2\pi/5}\right)}\right|^2 d\Omega$$ Where p(t) is the UnitPulse function. &#xA;How to simplify this expression?&lt;/p&gt;&#xA;" OwnerUserId="5590" LastActivityDate="2013-12-11T01:03:12.133" Title="Parseval's theorem" Tags="|continuous-signals|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13125" PostTypeId="1" CreationDate="2013-12-11T02:34:05.453" Score="4" ViewCount="6644" Body="&lt;p&gt;I have got a signal in frequency domain. This is a frequency response function from software, so I can do nothing about it and have to leave it in frequency domain. I want to transfer the data to 1/3 octave spectra and I need some help on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion, I just need a couple of band pass filters which in the frequency domain is simply by using the starting and ending limit of each band to cut the data. In other words, I ignore all other data points out of a band region. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the band spectra, originally I just calculate the square of each fft point inside a band and sum them before calculating the square root. However, the result is different with direct filtering in the time domain, which I tried using a random signal. It makes sense to me because the 1/3 octave spectra should be independent of the total fft points. Obviously by simply calculating the sum of squares of fft components, the value of power in a band increases with the increase of the points included.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I tried to explore the basic theory underlining the fft based filters. This is where I got very confused. I do not know which part of FT frequency response function belongs to? It is not DFT in my opinion and not DFS either because the whole process of transferring motion equation is based on continuous FT except the frequency response function is calculated at a series of discontinuous points. My understanding is that each component of 1/3 octave spectra is a square root of the total power in that band. Therefore possibly I can get something from Parseval's theorem. However based on continuous FT transform, I could not figure out how to derive the power in a frequency range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know the way to implement the filter and underlying theory if possible. Please give me some suggestions or alternatively some references that I can refer to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="7228" LastEditorUserId="7228" LastEditDate="2013-12-12T23:41:21.493" LastActivityDate="2021-03-17T07:48:59.813" Title="1/3 octave spectra from fft" Tags="|matlab|fft|filters|dft|frequency-response|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13126" PostTypeId="2" ParentId="1919" CreationDate="2013-12-11T05:01:00.917" Score="2" Body="&lt;p&gt;The main reason for the desired output of &lt;em&gt;xcorr&lt;/em&gt; function to be not similar to that of application of &lt;em&gt;FFT&lt;/em&gt; and &lt;em&gt;IFFT&lt;/em&gt; function is because while applying these function to signals the final result is &lt;strong&gt;circularly convoluted&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main difference between Linear Convolution and Circular Convolution can be found in &lt;a href=&quot;http://www.mathworks.in/help/signal/ug/linear-and-circular-convolution.html&quot; rel=&quot;nofollow&quot;&gt;Linear and Circular Convolution&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem can be solved by Initially &lt;strong&gt;zero-padding&lt;/strong&gt; the signal and truncating final output of &lt;em&gt;IFFT&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7230" LastActivityDate="2013-12-11T05:01:00.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13127" PostTypeId="1" AcceptedAnswerId="13155" CreationDate="2013-12-11T07:16:49.367" Score="2" ViewCount="27984" Body="&lt;p&gt;I am having difficulty in calculating the SNR for the following scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a cellular network&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Transmit power=36dBm&lt;/li&gt;&#xA;&lt;li&gt;Noise spectral density=-174dBm/Hz (AWGN)&lt;/li&gt;&#xA;&lt;li&gt;Bandwidth=10MHz&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have some other parameters such as pathloss and Rayleigh fading, but I think my biggest problem is the conversion of dB to power.&lt;/p&gt;&#xA;" OwnerUserId="7231" LastEditorUserId="1273" LastEditDate="2013-12-12T09:15:21.347" LastActivityDate="2018-06-11T05:44:30.007" Title="SNR calculation with Noise Spectral Density" Tags="|noise|snr|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13128" PostTypeId="1" AcceptedAnswerId="13131" CreationDate="2013-12-11T10:57:47.597" Score="1" ViewCount="4382" Body="&lt;p&gt;I am generating a sine wave from a DAC at a constant frequency. If each full cycle is specified by N data points what is the relationship between the accuracy of the rendered sine wave and N?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N=1 will obviously be pulses. N=4 (peaks and zero crossings) will yield a triangular wave of sorts. Is there some equation that shows how good a sine wave approximation is being created? [Obviously I can put it through a post DAC filter to smooth it etc]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The kind of answer I am looking for is: &quot;Specifying a sine wave with N points yields 1:X accuracy&quot;&lt;/p&gt;&#xA;" OwnerUserId="7233" LastActivityDate="2013-12-11T11:55:27.743" Title="Minimum number of points to specify a sine wave with a given accuracy" Tags="|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13129" PostTypeId="2" ParentId="13128" CreationDate="2013-12-11T11:07:51.730" Score="1" Body="&lt;p&gt;I don't know of a formula, but I do know from experimentation that N=256 gives a sine wave with a reasonable SNR for general audio use, although if you want full 16 bit accuracy (i.e. &gt; 90 dB SNR) you'll probably need to go higher than this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're stepping through the sine wave LUT at a non-integer rate (to generate an arbitrary frequency) then using interpolation between LUT values reduces SNR such that you can use a smaller LUT than if you don't interpolate (e.g. if you just truncate the sample index).&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2013-12-11T11:07:51.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13131" PostTypeId="2" ParentId="13128" CreationDate="2013-12-11T11:55:27.743" Score="3" Body="&lt;p&gt;I think what you are asking is &quot;what is the sample rate required to sample a sine wave for a given precision&quot;. This is basically what the sampling theorem is all about (See for example &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&lt;/a&gt;). The surprising answer is (more or less): &quot;more than two&quot;. Once you meet the sampling criteria you are fine and &#xA;the accuracy does NOT increase by sampling more often.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, 3 points per period will work fine (provided your DAC has a proper anti-aliasing filter).&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-11T11:55:27.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13132" PostTypeId="1" AcceptedAnswerId="13137" CreationDate="2013-12-11T12:05:56.460" Score="0" ViewCount="3178" Body="&lt;p&gt;I have an unusual low-pass filter problem that I would like to realise with a passive RC network (Note 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's easy enough to &lt;a href=&quot;http://www.ece.utah.edu/~cfurse/ece5320/lecture/L27/Filter%20Design.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;find prototype filters&lt;/a&gt; for passive RLC networks, or for the various &lt;a href=&quot;http://www.maximintegrated.com/app-notes/index.mvp/id/1795&quot; rel=&quot;nofollow noreferrer&quot;&gt;active RC filters&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having difficulty finding prototype filters for the classic filter types (e.g. Butterworth, Chebychev, Elliptic) that are implemented using such a network.  The closest I have managed to find is &lt;a href=&quot;http://electronicdesign.com/boards/passive-rc-filters-afford-low-cost-and-high-selectivity&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; which recommends equal R and C values for each passive in the network:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ps41I.gif&quot; alt=&quot;RC network for filter implementation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, I would like to ask&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a good reference that covers this sort of design?&lt;/li&gt;&#xA;&lt;li&gt;Are there any &quot;tricks&quot; or &quot;gotchas&quot; for this design?&lt;/li&gt;&#xA;&lt;li&gt;What is the design procedure to implement one of the classic filters?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note 1 - Context:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The design is for a second-order low-pass anti-aliasing filter. A first order doesn't attenuate an annoying periodic glitch enough - and I may yet need a higher-order filter. Board space is very limited and the ADC has a built-in buffer that I would like to make use of.  The attenuation is desirable - the signal is larger than the ADC would normally accept.  Inductors are completely undesirable for the application.&lt;/p&gt;&#xA;" OwnerUserId="1904" LastActivityDate="2013-12-11T15:21:55.150" Title="Realisation of a passive RC low pass filter" Tags="|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13134" PostTypeId="1" CreationDate="2013-12-11T14:15:27.417" Score="1" ViewCount="237" Body="&lt;p&gt;I have a dataset which records the arrival time for a series of photons.&lt;br/&gt;&#xA;I am using lomb-scargle method of scipy.signal to try to find some kind of period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the arrival time is random,how to express the intensity of the signal? &lt;br/&gt;&#xA;If I bin the dataset and let the photon counts in every bins be the intensity , the dataset changes to a evenly spaced new dataset and information is lost.&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;lomb-scargle is good at finding period for unevenly spaced data.&lt;br&gt;&#xA;Is it necessary to bin the data? If I bin the data, part of the data info will be lost(?) and I can use fft directly.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5690" LastEditorUserId="5690" LastEditDate="2013-12-12T02:46:49.400" LastActivityDate="2013-12-13T08:36:05.667" Title="period detection for a series of photons" Tags="|fft|python|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13136" PostTypeId="1" CreationDate="2013-12-11T15:11:21.053" Score="3" ViewCount="3492" Body="&lt;p&gt;The Auto-Correlation function of Walsh-Hadamard codewords does not have a good characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can have more than one peak and thus, the Walsh-Hadamard codes do not have the best spreading behavior or correlation property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cross-correlation function of the Walsh-Hadamard codewords can also be non-zero for a number of time shifts and unsynchronized users can interfere with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which other codes or sequences show :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A good auto-correlation attribute?&#xA;Good Cross-correlation Property ?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7237" LastActivityDate="2013-12-11T18:31:28.950" Title="Choosing Codes or sequences with excellent Auto-Correlation properties" Tags="|autocorrelation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13137" PostTypeId="2" ParentId="13132" CreationDate="2013-12-11T15:21:55.150" Score="4" Body="&lt;p&gt;Note that your desired passive RC network is really just the cascade of multiple first-order RC filters, each of which have the transfer function $\frac{1}{1+RCs}$.  By choosing the R and C values to use in each stage, you can place pole locations where you want them in the $s$-plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the problem: recall that the pole locations occur where the denominator of the transfer function is equal to zero. Therefore, for a particular RC stage, its corresponding pole location is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s = -\frac{1}{RC}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this value is purely real. This makes such a topology infeasible for implementing a prototype such as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter&quot; rel=&quot;nofollow&quot;&gt;Butterworth filter&lt;/a&gt;. Its poles are located in a semicircle in the left half of the (complex) $s$-plane. Since you can only place poles on the real axis using your RC stage topology, you cannot implement a Butterworth network. You end up having the same problems with other types like Chebyshev or elliptic structures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is to use additional elements like inductors or amplifiers; these provide more degrees of freedom in the resulting transfer function to place poles at other places in the $s$-plane. That's why all the references you can find use them!&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-12-11T15:21:55.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13138" PostTypeId="2" ParentId="13136" CreationDate="2013-12-11T15:43:41.780" Score="6" Body="&lt;p&gt;There is a vast literature on this subject. In particular, deleting one bit&#xA;(the leading bit in one specific implementation) from each of the Walsh-Hadamard sequences and applying a permutation to the remaining $2^n-1$ bits will result&#xA;in $2^n$ sequences of length $2^n-1$ that consist of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i) the all-zeroes sequence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(ii) the $2^n-1$ cyclic shifts of a pseudonoise (PN), or maximal-length linear  feedback shift register (LFSR), sequence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A PN sequence has ideal autocorrelation properties, but the cross-correlation&#xA;between a sequence and its cyclic shift has a peak value that is the same as&#xA;the autocorrelation peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more than you probably want to know, I refer you to the paper&#xA;D.V. Sarwate and M.B. Pursley, &quot;Cross-correlation properties of pseudorandom and related sequences,&quot; &lt;em&gt;Proc. IEEE,&lt;/em&gt; vol.68, pp.593-619, May 1980.  It includes a&#xA;detailed discussion of the Gold sequences mentioned by JasonR as well as the&#xA;small sets and large sets of Kasami sequences that you will encounter in some&#xA;applications.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2013-12-11T15:43:41.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13139" PostTypeId="2" ParentId="13136" CreationDate="2013-12-11T18:31:28.950" Score="1" Body="&lt;p&gt;Barker codes are typically used in RADAR applications since they have a high correlation peak and low (sometimes constant) secondary lobes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Barker_code&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Barker_code&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3865" LastActivityDate="2013-12-11T18:31:28.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13140" PostTypeId="1" CreationDate="2013-12-11T19:02:27.823" Score="1" ViewCount="168" Body="&lt;p&gt;There seems to be a number of different ways for telecommunication. What is the most recent (and maybe standard) technique used today? It seems the simple AM/FM modulations are definitely somewhere in the past, then there are these spread spectrum systems... All hints welcome :)&lt;/p&gt;&#xA;" OwnerUserId="7241" LastActivityDate="2013-12-11T20:01:37.990" Title="State-of-art of telecommunications?" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ClosedDate="2013-12-13T01:20:23.640" ContentLicense="CC BY-SA 3.0" />
  <row Id="13141" PostTypeId="2" ParentId="13140" CreationDate="2013-12-11T20:01:37.990" Score="2" Body="&lt;p&gt;You should realize that when you say &quot;telecommunications&quot; you are talking about a huge field involving lots of different technologies.  Based on the mention of AM/FM modulations I infer that you are referring to digital (though AM/FM are actually analog) wireless transmission techniques (though I may have inferred incorrectly since wired modems can use some pretty sophisticated modulations).  Even restricting ourselves to wireless telecommunications, there are lots of different technologies that we could talk about- modulation types are just one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, back to what I think you were asking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The progression of modulation types went something like the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;AM (very simple analog)&lt;/li&gt;&#xA;&lt;li&gt;FM (more sophisticated analog- but uses more bandwidth than AM)&lt;/li&gt;&#xA;&lt;li&gt;OOK (very simple digital)&lt;/li&gt;&#xA;&lt;li&gt;FSK (digital version of FM)&lt;/li&gt;&#xA;&lt;li&gt;PSK&lt;/li&gt;&#xA;&lt;li&gt;QAM&lt;/li&gt;&#xA;&lt;li&gt;TCM&lt;/li&gt;&#xA;&lt;li&gt;DSSS&lt;/li&gt;&#xA;&lt;li&gt;OFDM&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you google any of the above terms and add &quot;modulation&quot;, you should get some useful references.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OFDM is, as far as I am aware, the latest-and-greatest modulation type.  It has the useful feature of being extremely efficient at packing data into a given amount of bandwidth.  Since bandwidth is at a premium for the telecoms, that is very important.  Many of the other modulation types are still used though, and will continue to be used because they have other useful features.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-12-11T20:01:37.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13142" PostTypeId="1" AcceptedAnswerId="13145" CreationDate="2013-12-11T21:16:56.157" Score="10" ViewCount="18160" Body="&lt;p&gt;I read the DAFX book by Udo Zölzer about the distortion effect at pages 124-125&#xA;and it says that suitable simulation of the distortion is given by the function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(x)=\frac{x}{|x|}\left(1-e^{x^2/|x|}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain this formula and what kind of signal we get? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand 'x' is the sampled signal, so this is a sequence of numbers. What does |x| mean? Does it refer to the absolute value of x for each sampled value? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I want to implement this simulation of the distortion effect, &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I need to know the length of x (It's given by the number of samples)&lt;/li&gt;&#xA;&lt;li&gt;In a loop, I need to calculate this formula for each sample value&lt;/li&gt;&#xA;&lt;li&gt;after the loop ends, I get the distorted signal (in a digital form)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;After that, I need to convert it to an analog signal so I can hear it.&lt;/p&gt;&#xA;" OwnerUserId="5665" LastEditorUserId="38547" LastEditDate="2020-02-23T16:50:44.133" LastActivityDate="2020-07-08T05:28:39.113" Title="Digital Distortion effect algorithm" Tags="|audio|algorithms|c|digital|distortion|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13143" PostTypeId="2" ParentId="2857" CreationDate="2013-12-11T23:16:32.203" Score="4" Body="&lt;p&gt;Please define &quot;specific frequency&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any signal with no frequency components above the Nyquist limit can be exactly recorded and re-constructed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the number of samples determines the frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you mean &quot;i want to be able to tell the difference between silence and a 1000hz signal, then you would need 4 samples taken less 1/2000th of a second apart - using that you can solve for the 0 frequency signal (dc offset), and the strength of the other frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you mean &quot;i want to be able to separate a 900hz signal from a 1000hz&quot;, then you need to resolve 11 frequency windows, ie, you'll need 22 samples taken at at least 2000 samples per second; then you'll have measured &quot;frequencies around 0, 100,200,300...900,1000 hz&quot;, and you can answer &quot;do i have a 900hz signal&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you want to measure to the nearest hz the frequency of a N hz signal, then you would need to take at least 2N samples, taken at atleast 2N samples/second.&lt;/p&gt;&#xA;" OwnerUserId="7245" LastActivityDate="2013-12-11T23:16:32.203" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13144" PostTypeId="1" CreationDate="2013-12-12T04:54:20.267" Score="0" ViewCount="8945" Body="&lt;p&gt;I'm trying to suppress the sidelobe of OFDM but having troubles showing its spectrum in Matlab. After IFFT, I get a time-domain signal, but in which way I can get its spectrum(or PSD)? I want to analyze the out band power emission, with rectangle window in the time domain the out of band power curve decrease slowly, so it may interference the adjacent channel user, to avoid that situation we have to apply some algorithms to suppress the out of band power emission caused by the sidelobe of OFDM signal. After apply the algorithm I have to plot some figures to demo the effect of my algorithm, so I need the whole PSD of OFDM signal and I also want the out of band part become more steep. I tried to use FFT and pwelch function of Matlab, but never get what I want. I doubt if I use them in right way. So I'm hoping someone here can help me. I know it's basic, but it really obsess for a long time. I analyze the baseband signal, so it should be after the IFFT operation.The figure that I want is below. &#xA;&lt;img src=&quot;https://v1.freep.cn/3tb_131216204513jmi1512293.jpg&quot; alt=&quot;OFDM spectrum&quot;&gt;&#xA;&lt;img src=&quot;https://v1.freep.cn/3tb_131216210025u6ku512293.jpg&quot; alt=&quot;spectrum 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  N = 64;&#xA;  over_sample_factor = 2;&#xA;  M = N*over_sample_factor;&#xA;  Mod = 16;&#xA;  symbol = 1;&#xA;  bitlength = N*log2(Mod)*symbol;&#xA;  itr_num = 1000;&#xA;  fft_len = 2*M;&#xA;  signal_freq = zeros(itr_num,fft_len);&#xA;  for itr = 1:itr_num&#xA;      bit_data = randi([0,1],bitlength,1);&#xA;      h = modem.qammod('M', Mod, 'SymbolOrder', 'Binary', 'InputType', 'Bit');&#xA;      zp_before = modulate(h,bit_data);&#xA;      after_zp = zeros(1,M);&#xA;      after_zp(1:N/2) = zp_before(N/2+1:N);&#xA;      after_zp(M-N/2+1:M) = zp_before(1:N/2);&#xA;      ofdm_symbol = ifft(after_zp);&#xA;      signal_freq(itr,:) = abs(fft(ofdm_symbol,fft_len)).^2; &#xA;  end&#xA;  PSD_mean = mean(signal_freq,1);&#xA;  plot(fftshift(10*log10(PSD_mean)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The figure is like this&#xA;&lt;img src=&quot;https://v2.freep.cn/3tb_131216215821pewb512293.jpg&quot; alt=&quot;spectrum 3&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7235" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:36.013" LastActivityDate="2017-02-01T02:42:38.533" Title="How to Show A OFDM Symbol's PSD in Matlab" Tags="|power-spectral-density|ofdm|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="13145" PostTypeId="2" ParentId="13142" CreationDate="2013-12-12T06:29:57.190" Score="5" Body="&lt;p&gt;|x| denotes the absolute value - the x / |x| bit of the formula is there to make sure that the sign of the input is preserved in the output. Regarding the implementation, yes, the steps you have listed are correct.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-12-12T06:29:57.190" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="13147" PostTypeId="1" AcceptedAnswerId="13154" CreationDate="2013-12-12T09:44:09.297" Score="1" ViewCount="1567" Body="&lt;p&gt;My understanding if a frequency in my signal doesn't line up exactly with a bin, it is smeared over a few bins to the right and left. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can the instantaneous magnitude be determined? (do I have to worry about the windowing function?)&lt;/p&gt;&#xA;" OwnerUserId="4340" LastEditorUserId="1081" LastEditDate="2013-12-14T00:14:10.597" LastActivityDate="2013-12-14T19:22:21.347" Title="How to get Instantaneous Magnitude for a Instantaneous Frequency From FFT?" Tags="|fft|frequency-spectrum|signal-analysis|frequency-domain|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13148" PostTypeId="1" CreationDate="2013-12-12T10:45:38.550" Score="2" ViewCount="175" Body="&lt;p&gt;Based on a paper in &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0022460X05003913&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, they have proposed a method to optimize morlet function parameter. I have tried to implement their technique, but I can't get rational results. any idea?&lt;br&gt;&#xA;In here you can see what they have done briefly:&#xA;Imagine you have a signal with following frequency and damping pairs :&lt;br&gt;&#xA;$(f_i ,\zeta_i), (f_{i+1},\zeta_{i+1})$ and $f_i,f_{i+1} $ are two closely spaced frequency i.e. $1.01Hz,1,09 Hz$&lt;br&gt;&#xA;now we define $f_{i,i+1}=\frac{f_i+f_{i+1}}{2}$ and $\Delta f_{i,i+1}=f_{i+1}-f_i$&lt;br&gt;&#xA;based on Heisenberg uncertainty principle the $f_c\sqrt{f_b}$ must be in range of :&lt;br&gt;&#xA;$2\alpha\frac{f_{i,i+1}}{2\pi\Delta f_{i,i+1}}\leqslant f_c\sqrt{f_b}\leqslant \frac{2\gamma}{\beta}Tf_i;[1_a] $&lt;br&gt;&#xA;for another reason $f_c \geq  \frac{5}{2\pi};[1_b]$&lt;br&gt;&#xA;which demonstrates that $f_c\sqrt{f_b}$should be chosen within an interval so that a compromise could&#xA;be made between frequency and time resolutions, Another consideration is that because $f_c\sqrt{f_b}$ is within an interval, there exist numerous pairs of $f_b$and $f_c$. Practically, it is necessary to introduce some other criteria to select optimum values of $f_b$ and $f_c$, the minimum Shannon entropy is used for criteria :&lt;br&gt;&#xA;$E=-\sum_{i=1}^{M}d_i log(d_i)[2]$,  where $d_i$ is:   $d_i=\frac{|W(a_i,t)|}{\sum_{j=1}^{M}W(a_j,t)}$ $,M$ is number of scales&lt;br&gt;&#xA;so we must minimize $E$ from equation[2] in range of [$1_a,1_b$].&lt;br&gt;&#xA;I have used &lt;code&gt;fmincon&lt;/code&gt; matlab function   to solve this non linear unequality constrain in matlab&lt;br&gt;&#xA;&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0022460X05003913&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2013-12-27T14:20:16.147" LastActivityDate="2013-12-27T14:20:16.147" Title="Any idea how can I optimize morlet wavelet parameters by Heisenberg uncertainty principal and Shannon entropy?" Tags="|wavelet|optimization|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13149" PostTypeId="1" CreationDate="2013-12-12T11:05:01.440" Score="0" ViewCount="626" Body="&lt;p&gt;To get a panning effect I know that there is a need for a Circular Matrix. &#xA;The angle is can be set as a default or I can let the user to select the angle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the angle is $\theta$, the circular matrix will be: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{pmatrix}\cos \theta &amp;amp; \sin \theta \\ -\sin \theta &amp;amp; \cos \theta\end{pmatrix}&#xA;$$&#xA;and the gain is actually set in which channel (Right or Left) the audio will be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I'm sampling the signal from a guitar and get the sequence $X$,&#xA;all I need to do is to do is to multiply each sample value with the circular matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This operation (multiply each sampled value with the circular matrix) calculates the gain right? So I will know in which channel - right or left to play the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand when the signal is converted again to analog. After the calculation of the gain? Because if you play with a panning effect, you will hear the sound in the left or the right channel very fast. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand if it's a multiplication the whole signal with the circular matrix and then just playing it back on the different channels. Or is it actually a multiplication of each sampled value of the signal by the matrix, conversion to analog and then processing of  other sampled values.&lt;/p&gt;&#xA;" OwnerUserId="5665" LastEditorUserId="8202" LastEditDate="2014-06-10T21:02:39.660" LastActivityDate="2015-02-23T16:22:06.987" Title="Digital Panning Effect" Tags="|algorithms|digital|spatial|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13150" PostTypeId="2" ParentId="13149" CreationDate="2013-12-12T13:02:26.737" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;To get a panning effect I know that there is a need for a Circular Matrix. The angle is can be set as a default or I can let the user to select the angle.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do you know this? Can you cite a source? Audio Panning is typically done with one input and two outputs. It's either done with constant energy or constant amplitude pan. Constant energy is similar to what the second column of your matrix would do if the angle goes from 0 to 90 degree with 45 degrees being &quot;centered&quot;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="29" LastEditDate="2015-02-23T16:22:06.987" LastActivityDate="2015-02-23T16:22:06.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13151" PostTypeId="1" CreationDate="2013-12-12T13:31:01.147" Score="0" ViewCount="39" Body="&lt;p&gt;I want to know if there is a generalized way to select a signal from a set of signals. Let me clarify it: I have a number of signals $S = \{S1, S2, S3,...\} $. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the signals are not important to me like, all having all zeros for data, or all same values, or only one datum comes in at the first occurrence then remains zero until the end, or the signal which is always a exactly/mostly straight line parallel to the time axis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made some heuristics but I am actually looking for a general scientific and technical methodology to do that. So, in fact I want to have a function $f(S) \rightarrow S1$, which takes a set $S$ and outputs $S1$ (a subset of $S$) after excluding S-S1 signals. &#xA;Is there any thing in signal processing or does anyone know some paper/methodology to do this?&lt;/p&gt;&#xA;" OwnerUserId="7253" LastEditorUserId="76" LastEditDate="2013-12-21T01:26:03.580" LastActivityDate="2013-12-21T01:26:03.580" Title="Screening out important signals" Tags="|signal-detection|continuous-signals|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13152" PostTypeId="1" CreationDate="2013-12-12T13:42:07.597" Score="0" ViewCount="520" Body="&lt;p&gt;&lt;a href=&quot;http://astarte.csustan.edu/~tom/SFI-CSSS/info-theory/info-lec.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://astarte.csustan.edu/~tom/SFI-CSSS/info-theory/info-lec.pdf&lt;/a&gt; compares a bacteria DNA vs a random string: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My first step was to generate for myself a &quot;random genome&quot; of&#xA;  comparable size to compare things with. In this case, I simply used&#xA;  the Unix `random' function to generate a file containing a random&#xA;  sequence of about 4 million A, C, G, T. In the actual genome, these&#xA;  letters stand for the nucleotides adenine, cytosine, guanine, and&#xA;  thymine.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;We want to find &quot;interesting&quot; sections (and features) of a genome. As a&#xA;  starting place, we can slide a &quot;window&quot; over the genome, and estimate&#xA;  the entropy within the window. The plot below shows the entropy&#xA;  estimates for the E. coli genome, within a window of size 6561 (= 3^8&#xA;  ). The window is slid in steps of size 81 (= 3^4 ). This results in&#xA;  57,194 values, one for each placement of the window. For comparison,&#xA;  the values for a &quot;random&quot; genome are also shown.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L4O5o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;At this level, we can make the simple observation that the actual&#xA;  genome values are quite different from the comparative random string.&#xA;  The values for E. coli range from about 5.8 to about&#xA;  5.96, while the random values are clustered quite closely above 5.99 (the maximum possible is log2 (64) = 6).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;There are various &quot;data massage&quot; techniques we could use. For example,&#xA;  we could take the fourier transform of the entropy estimates, and&#xA;  explore that. Below is an example of such a fourier transform. Notice&#xA;  that it has some interesting &quot;periodic&quot; features which might be worth&#xA;  exploring. It is also interesting to note that the fourier&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;transform of the entropy of a &quot;random&quot; genome has the shape of&#xA;  approximately $1/f = 1/f^1$ (not unexpected), whereas the E. coli&#xA;  data are closer to $1/f^{1.5}$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8tDeG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I must draw you attention that the fourier transform is applied to the entropy rather than to the random signal itself. Why is it expected that resulting spectrum is pink rather than absolutely random? I do not understand why it is expected that the random frequency amplitude is inverse to the frequency, why not $amplitude=1/freq^{1.5}$? The higher low frequencies mean that the next number has higher probability to be closer to the current one and random is not quite random, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also noted that, in the end of the book, author says that &quot;random&quot; is naturally band-limited by the power law, $1/f^\alpha,$  and, in SETI project, we better watch after the white noise because optimal use of the channel is a sign of intelligent life.&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="4701" LastEditDate="2013-12-15T11:16:55.817" LastActivityDate="2013-12-15T11:16:55.817" Title="Why is random noise amplitude inversely proporional to the frequency?" Tags="|frequency-spectrum|noise|random|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13153" PostTypeId="2" ParentId="13152" CreationDate="2013-12-12T15:27:59.320" Score="3" Body="&lt;p&gt;This looks like a &lt;a href=&quot;http://en.wikipedia.org/wiki/Pink_noise&quot; rel=&quot;nofollow&quot;&gt;pink noise&lt;/a&gt; model, where the power spectral density of the noise is proportional to $\frac{1}{f}$. This model is appropriate for some real-world phenomena; I can't speak to whether it's the right choice for this particular application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your interpretation of the meaning of this sort of spectrum is correct, although the noise is still considered random. Instead, we consider consecutive noise samples to be &lt;em&gt;correlated&lt;/em&gt; with one another (in contrast to white noise, where all samples are jointly uncorrelated). That doesn't mean that the signal isn't &lt;em&gt;random&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-12-12T15:27:59.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13154" PostTypeId="2" ParentId="13147" CreationDate="2013-12-12T15:31:24.177" Score="1" Body="&lt;p&gt;Frist of all you need compute the Magnitude:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;windowed = framed .* hann(length(framed))&#xA;Fourier = fft(windowed)&#xA;Mag = abs(Fourier)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you need build a Window Kernel based in your Window Function!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a Hann Window the kernel can be: &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   Wk(k) = 0.5 * (sinc(k*(M/N)) / (1 - (k*(M/N))^2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M=Window Size &#xA;N=FFT Size&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course you can use the same size for both, N and M !&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k = Bin Number from FFT / N&#xA;sinc = Normalized Sinc, visit http://en.wikipedia.org/wiki/Sinc_function&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you have already determined the Instantaneous Frequency, you need find the corresponding offsets for each Frequency and the Instantaneous Magnitude is found when you multiply the magnitude from FFT by your Hann Window Kernel index:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Offset = abs(InstFreqs(i) / (Fs/N) - i)&#xA; index = floor(abs(Offset) * N) + 1&#xA; InstMag = Mag(i) * Wk(index)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-12-12T15:31:24.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13155" PostTypeId="2" ParentId="13127" CreationDate="2013-12-12T15:42:49.707" Score="2" Body="&lt;p&gt;The comment above already gave you a roadmap to get to an answer, but I'll flesh it out a bit:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;SNR is the ratio of signal power to noise power. To calculate the signal power at your receiver, you'll need to take the path loss and fading model into account, as you noted.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The noise power at the receiver is described by a (flat) noise power spectral density and receiver bandwidth. To calculate the total noise power over that bandwidth, you simply multiply the amount of power per Hertz times the width of the band. When power is specified in logarithmic units (dB), you need to first convert it to a linear scale. Recall the relationship between mW and dBm:&#xA;$$&#xA;P|_{dBm} = 10 \log_{10}\left(\frac{P}{1\text{ mW}}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, to convert a linear-scale power quantity to dBm, take ten times the base-10 logarithm of the ratio of that power quantity to 1 milliwatt. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;30 dBm: 1 W&lt;/li&gt;&#xA;&lt;li&gt;0 dBm: 1 mW&lt;/li&gt;&#xA;&lt;li&gt;-30 dBm: 1 uW&lt;/li&gt;&#xA;&lt;li&gt;-60 dBm: 1 nW&lt;/li&gt;&#xA;&lt;li&gt;-90 dBm: 1 pW&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To go the other way, invert the calculation:&#xA;$$&#xA;P = 10^{\frac{P|_{dBm}}{10}} * 1\text{ mW}&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;So, to calculate the total noise power at your receiver, you would convert the noise power spectral density to linear units using the above equation:&#xA;$$&#xA;S_n = 10^{\frac{-174}{10}} \frac{\text{mW}}{\text{Hz}} = 3.981 * 10^{-18} \frac{\text{mW}}{\text{Hz}}&#xA;$$&#xA;then multiply by the bandwidth to get the total amount of noise power:&#xA;$$&#xA;P_n = BS_n = \left(10 * 10^{6}\text{ Hz}\right)\left(3.981 * 10^{-18} \frac{\text{mW}}{\text{Hz}}\right)&#xA;$$&#xA;$$&#xA;P_n = 3.981 * 10^{-11} \text{ mW}&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, use your model to predict the received signal power, take the ratio, and you've got your SNR.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2013-12-12T15:42:49.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13156" PostTypeId="1" AcceptedAnswerId="13157" CreationDate="2013-12-12T16:06:46.420" Score="1" ViewCount="2529" Body="&lt;p&gt;When you plucked on a string, the string is vibrate and except the fundamental frequency, &#xA;there are an integer multiple of the fundamental frequency, which are the harmonics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the HPS algorithm is a tool to find the fundamental frequency, but &#xA;I don't understand the downsample part. How can I know how many times I need to downsample&#xA;the signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read somewhere that the fundamental frequency can be given by measuring the harmonic frequencies and their GCD (greatest common division)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another source says that there's a need to use the Hanning method. &#xA;can someone please explain this algorithm?&lt;/p&gt;&#xA;" OwnerUserId="5665" LastActivityDate="2013-12-14T21:40:14.100" Title="HPS Algorithm for detecting the fundamental frequency of a guitar string" Tags="|frequency-spectrum|frequency|algorithms|peak-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13157" PostTypeId="2" ParentId="13156" CreationDate="2013-12-12T18:41:32.333" Score="4" Body="&lt;p&gt;OK Lets go!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I consider HPS a very simple algorithm, this image representation show exactly how HPS work ! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ccs0H.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yeah is highly recommended apply a hann window for every framed data !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you need to do is apply one window function over your framed signal, then apply FFT, you need just the first half absolute values from FFT, its give you the Magnitude, now downsample it for N time, Multiply all downsampled and at  the end find the peak.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I know how many times I need to downsample the signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Will depend, the more time you downsample you signal more accurate HPS can be, this has a cost that limits the frequency analysis, for example, imagine that you have a signal sampled at 44100hz, you use FFTsize = 4096 and you decide to make 5 time downsample, its tell me that you can not pick up frequencies above 4403Hz!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;floor(4096 / 5) =  819&#xA;floor(819 /2) = 409&#xA;floor((44100/4096) * 409) = 4403&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-12-12T18:41:32.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13158" PostTypeId="1" CreationDate="2013-12-12T20:06:12.863" Score="1" ViewCount="477" Body="&lt;p&gt;Is there any speech enhancement algorithm library?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to process a sound to voice recognition, and I want to remove noise from audio source.&lt;/p&gt;&#xA;" OwnerUserId="7256" LastEditorUserId="7256" LastEditDate="2013-12-12T20:13:12.923" LastActivityDate="2018-04-29T16:22:07.467" Title="Speech Enhancement Libraries" Tags="|algorithms|sound|voice|enhancement|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13159" PostTypeId="2" ParentId="13105" CreationDate="2013-12-12T20:59:20.127" Score="2" Body="&lt;p&gt;It is not a good idea to have Np and Ns as constraints, for the exact reason you mention- it will usually cause unequal spacing.  Instead, make N, the total number of points, a constraint, and then you will have the equal spacing that you need.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-12-12T20:59:20.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13160" PostTypeId="2" ParentId="13144" CreationDate="2013-12-12T21:04:02.890" Score="1" Body="&lt;p&gt;If you are looking at the sidelobes in particular then you will probably want to oversample, as Deve mentioned.  x2 oversampling should be sufficient, but you can do more if you want.  I generally plot my FFT's as follows to get the energy in a dB scale (Matlab syntax)-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(20*log10(abs(fft(dataVector))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or, to center the FFT visually-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(fftshift(20*log10(abs(fft(dataVector)))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-12-12T21:04:02.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13161" PostTypeId="1" AcceptedAnswerId="13163" CreationDate="2013-12-12T21:09:39.990" Score="0" ViewCount="238" Body="&lt;p&gt;I don't know if this question is related to DSP, but I'll give a chance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&#xA;These days there are a Guitar Synthesizers which allow the guitarist&#xA;to play another instruments like: brass, drums, strings, pianos and other guitar models&#xA;from his guitar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It possible to turn any guitar with the MIDI Pickup, that sends the all data&#xA;that the synth needs. &#xA;Now, from what I understand the pickup turns the guitar into MIDI one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how a signals like those that the guitar makes can be converted into &#xA;MIDI instructions ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a sampling before this conversion? I think that it should be, because if not.&#xA;How the Synth will know in which level (volume) or duration to produce the sounds?  &lt;/p&gt;&#xA;" OwnerUserId="5665" LastEditorUserId="5665" LastEditDate="2013-12-12T22:43:26.193" LastActivityDate="2013-12-12T22:43:26.193" Title="Turn your guitar to MIDI and Guitar Synthesizer" Tags="|signal-analysis|signal-synthesis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13162" PostTypeId="2" ParentId="13158" CreationDate="2013-12-12T21:27:05.613" Score="1" Body="&lt;p&gt;Nice a Brazilian Guy lol !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a little tricky to tell you without know what language are you working ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a simple Filter can solve your problem or you can look at source code from Audacity are a cool code for noise removal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another choice is use &lt;a href=&quot;http://sox.sourceforge.net/sox.html&quot; rel=&quot;nofollow&quot;&gt;Sox&lt;/a&gt; by command line to process your voice and use noiseprof to try remove noise.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-12-12T21:27:05.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13163" PostTypeId="2" ParentId="13161" CreationDate="2013-12-12T22:19:25.197" Score="2" Body="&lt;p&gt;There is a sensor for each string which individually records the string vibration. This signal is converted to digital, analyzed for estimating its fundamental frequency and its amplitude (envelope detector). Whenever a sharp increase in amplitude is detected, a MIDI note on message is sent, at the detected frequency. Whenever the amplitude falls below a threshold, a MIDI note off message is sent.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-12-12T22:19:25.197" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13166" PostTypeId="1" AcceptedAnswerId="13173" CreationDate="2013-12-13T02:26:47.763" Score="1" ViewCount="3575" Body="&lt;p&gt;I am studying a deconvolution problem for which observations include noise. I am considering using one of several common regularization methods, including Tikhonov's solution, truncated Singular Value Decomposition (SVD), or Wiener filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A manuscript I am reading, &lt;a href=&quot;http://geophysics.geoscienceworld.org/content/50/9/1440.abstract&quot; rel=&quot;nofollow&quot;&gt;Riel and Berkhout, &quot;Resolution in seismic trace inversion by parameter estimation&quot; in &lt;em&gt;Geophysics&lt;/em&gt;, 50(9), pp. 1440-1455, 1985&lt;/a&gt;, compares analysis in the Fourier domain with general SVD analysis:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Examples where SVD-based techniques may be used while Fourier&#xA;  techniques are no longer applicable are: time-invariant filtering,&#xA;  space-variant wave field extrapolation [...], and linear parameter&#xA;  estimation problems. Furthermore, in many nonlinear problems&#xA;  linearization is meaningful, again allowing application of the SVD.&#xA;  The nonlinear problem treated is such an example. In our opinion many&#xA;  problem areas in seismic exploration stand to benefit from an analysis&#xA;  involving the SVD. However, there are some limitations compared to&#xA;  Fourier analysis. For instance, &lt;strong&gt;SVD is not applicable to time-series&#xA;  analysis&lt;/strong&gt;. Furthermore, the eigenvectors and eigenvalues do not, in&#xA;  general, have the clear physical meaning the sinusoids and their&#xA;  amplitudes in Fourier analysis do. For these reasons SVD-based&#xA;  methods should, when possible, not replace Fourier analysis methods,&#xA;  but rather be used in conjunction with them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was surprised to read that &quot;SVD is not applicable to time-series analysis.&quot; It is not clear to me that this is the case, and indeed the authors use SVD to construct an inverse filter for their convoluted time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if there is common knowledge in the DSP community regarding SVD's unsuitability for time series analysis in general or specific aspects, as this is the first time I have come across this statement. (It is also surprising to find no &lt;em&gt;SVD&lt;/em&gt; or &lt;em&gt;eigenanalysis&lt;/em&gt; tag.) Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5362" LastEditorUserId="5362" LastEditDate="2013-12-13T13:20:56.303" LastActivityDate="2013-12-13T16:14:18.627" Title="SVD is not applicable to time series analysis?" Tags="|fourier-transform|convolution|deconvolution|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13167" PostTypeId="1" AcceptedAnswerId="13905" CreationDate="2013-12-13T04:48:59.060" Score="0" ViewCount="129" Body="&lt;p&gt;I want to build a navigation system with gyroscope/odemeter and gps. I have konwn there is a famous method called kalman filter for this application. And now, I have done some experiment in matlab with kalman filter to get hide state vector which included vehicle's current postion/velocity/heading etc. But out of my expection, the result is not very good even more bad than origin data which comes from gps. May be you could guess the reason why they are so so bad. Yes, gyroscope and odemeter have uncertained error also as gps, so that's why you use kalman filter to deal with them. In some case that's useful enough.&#xA;But in some scenario case that's not working. Because the character of original data can't match with requriment of kalman filter. As I probably know, it suppose that filter works under the condition of which your data noise is white gaussian or some other types. so many artical tell me you must have good knowledge to character of this noise, but on the other hand they don't tell me how to know it. that's just my problem and ask you in here. how to do it and how to deal with it for kalman filter?&lt;/p&gt;&#xA;" OwnerUserId="7262" LastEditorUserId="5662" LastEditDate="2013-12-20T23:26:56.847" LastActivityDate="2014-01-20T08:01:28.937" Title="how to deal with signal to make it suitable for kalman filter" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13168" PostTypeId="1" AcceptedAnswerId="13171" CreationDate="2013-12-13T07:18:02.560" Score="4" ViewCount="2618" Body="&lt;p&gt;I have the following matlab code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 500;&#xA;M = 32;&#xA;K = N + M - 1; % Length of full convolution&#xA;&#xA;x = randn(N);&#xA;y = ones(M);&#xA;&#xA;% first one: convolution&#xA;r = conv(x, y, 'same');&#xA;&#xA;% second one: multiplication&#xA;z = ifft(fft(x, K, K).*fft(y, K, K));&#xA;idx = round((K-N)/2+1):round((K+N)/2); % Indices of the central portion&#xA;z = z(idx); % Obtaining the central part of the result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;May I know which opertation is faster? getting $r$ or $z$? Why is this so? Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="151" LastEditDate="2018-12-12T02:18:11.113" LastActivityDate="2018-12-12T02:18:13.537" Title="Why is `fftfilt` (i.e. `fft` of both inputs, then element-wise multiplication, then `ifft`) faster than direct convolution?" Tags="|filters|discrete-signals|fourier-transform|convolution|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13169" PostTypeId="2" ParentId="3002" CreationDate="2013-12-13T08:34:02.527" Score="4" Body="&lt;p&gt;There has been beautiful answers already, but I will add my grain of salt, ot rather a different perspective:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering at the most abstract level can be considered as applying some prior knowledge to some raw data. It means that applying some filtering algorithm is to apply this prior to find an optimum in signal to noise ratio, for instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For image, a classical prior is the smoothness of values (eg intensity) with respect to position (this can be seen as the point spread function mentioned by @Phonon). It is often modeled as a gaussian as it is the shape that you would obtain when mixing different objects with a known smoothness radius (this is called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow&quot;&gt;central limit theorem&lt;/a&gt;). This is mostly useful when you wish to make derivatives of an image: rather than differentiating on the raw signal (which would produce a noisy output), you should do that on the smoothed image. This is equivalent to apply a wavelet-like operator such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Gabor_filter&quot; rel=&quot;nofollow&quot;&gt;Gabor filters&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2013-12-13T08:34:02.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13170" PostTypeId="2" ParentId="13134" CreationDate="2013-12-13T08:36:05.667" Score="1" Body="&lt;p&gt;As discussed in the comments to your question the recorded data that consists of arrival times of photons must first be converted to photon counts $n$ for this is the light intensity. The result of this conversion will be a vector $n(k)$ (with discrete time $k$) that represents the evolution of light intensity over time and that can be analyzed in more detail with an FFT, for example. The Lomb-Scargle method won't help here as you'd like to analyse light intensity, not photon arrivals. It could be of use if your data was a sequence of unequally space light intensity values. But as I understand your question this is not the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to obtain $n(k)$ count the number of photon arrivals in every time interval $t_0 + kT$, where $t_0$ is some constant time offset (e.g. first arrival time) and $T$ is the length of the equidistant time intervals. $T$ determines the sampling frequency $f_\mathrm{s} = 1/T$ of $n(k)$ and consequently the range of any spectral analysis, that is $0 \ldots f_\mathrm{s}/2$. On the other hand $T$ should be sufficiently large to obtain a reliable photon count in each time interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To analyse the periodicity of $n(k)$ calculate its FFT and look for distinct peaks. Functions like &lt;code&gt;periodogram&lt;/code&gt; also come handy sometimes.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-12-13T08:36:05.667" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="13171" PostTypeId="2" ParentId="13168" CreationDate="2013-12-13T08:45:51.670" Score="8" Body="&lt;p&gt;Whether the direct convolution or the FFT/IFFT method is faster depends on the length of the impulse response, &lt;span class=&quot;math-container&quot;&gt;$N_\mathrm{i}$&lt;/span&gt; and the signal length &lt;span class=&quot;math-container&quot;&gt;$N_\mathrm{s}$&lt;/span&gt;. With the formulas taken from &lt;a href=&quot;http://www.music.miami.edu/programs/mue/Research/jvandekieft/jvchapter5.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; I've created a small Matlab script that calculates the required number of real multiplications and additions for the direct convolution and FFT/IFFT method, respectively. I've assumed real-valued impulse response and signal. Taking your example of &lt;span class=&quot;math-container&quot;&gt;$N_\mathrm{i}=32$&lt;/span&gt; (or the other way round, this makes no difference), the direct convolution always requires less multiplications:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AWjo6.png&quot; alt=&quot;number of multiplications for impulse response length of 32&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if we increase &lt;span class=&quot;math-container&quot;&gt;$N_\mathrm{i}$&lt;/span&gt; to 50, for example, the direct convolution requires less multiplications up to a signal length of about 60. For signal length greater than 60 the FFT/IFFT method requires less multiplications:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y1cJL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual computation time depends on some other parameters, especially the CPU architecture but the number of multplications is usually a good indicator.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The MATLAB code for the above figures for reference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ns = 1:1000; % length of signal&#xA;Ni = 50; % length of impulse response&#xA;&#xA;K = Ni + Ns - 1;&#xA;&#xA;% number of real multiplications for convolution:&#xA;M_R_conv = Ns*Ni;&#xA;% number of real multiplications for convolution:&#xA;A_R_conv = Ns*(Ni-1);&#xA;&#xA;% number of complex multiplications for freq domain conv:&#xA;M_C_dft = 3/4 * K .* (log2(K) + 1) + K;&#xA;% number of complex additions for freq domain conv:&#xA;A_C_dft = 3/2 * K .* log2(K);&#xA;&#xA;% number of real multiplications for freq domain conv:&#xA;M_R_dft = 4*M_C_dft;&#xA;% number of real additions for freq domain conv:&#xA;A_C_dft = 2 * A_C_dft + 2 * M_R_dft;&#xA;&#xA;figure('Position', [0 0 400 300]);&#xA;plot(M_R_conv, 'b');&#xA;hold on;&#xA;plot(M_R_dft, 'r');&#xA;hold off;&#xA;legend('direct', 'fft', 'location', 'Southeast');&#xA;title(['number of real multiplications. Ni: ' num2str(Ni)]);&#xA;xlabel('length of signal');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A sidenote to your code: as it stands it is not running as you're creating NxN and MxM matrices for &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt;. What you probably want to do is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1,N);&#xA;y = ones(1, M)&#xA;% ...&#xA;z = ifft(fft(x, K).*fft(y, K));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;p.s. for those of you interested in Python code instead of Matlab, here is the same code in Python: &lt;a href=&quot;https://gitlab.com/snippets/1789085&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gitlab.com/snippets/1789085&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="151" LastEditDate="2018-12-12T02:18:13.537" LastActivityDate="2018-12-12T02:18:13.537" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13173" PostTypeId="2" ParentId="13166" CreationDate="2013-12-13T16:14:18.627" Score="1" Body="&lt;p&gt;SVD of multi-variate time-series is of course very common.  The point I think the author is making is that SVD cannot meaningfully be &lt;b&gt;directly&lt;/b&gt; applied to a univariate time-series, instead it &lt;b&gt;is commonly used indirectly&lt;/b&gt; to explore the main eigenvalues of a transition matrix, estimated from observed trajectories of a certain length. see &lt;a href=&quot;http://en.wikipedia.org/wiki/Singular_spectrum_analysis&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Singular_spectrum_analysis&lt;/a&gt; .  SSA assumes the time-series is stationary and can be modeled as Markov.&lt;/p&gt;&#xA;" OwnerUserId="5659" LastActivityDate="2013-12-13T16:14:18.627" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13174" PostTypeId="1" CreationDate="2013-12-13T17:02:26.637" Score="5" ViewCount="3277" Body="&lt;p&gt;Are there any differences if you use &lt;a href=&quot;https://en.wikipedia.org/wiki/Maximum_likelihood_estimation&quot; rel=&quot;noreferrer&quot;&gt;Maximum Likelihood&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Maximum_a_posteriori_estimation&quot; rel=&quot;noreferrer&quot;&gt;Maximum a Posteriori&lt;/a&gt; to estimate the Point Spread Function for image deconvolution?&lt;/p&gt;&#xA;" OwnerUserId="7267" LastEditorUserId="128" LastEditDate="2020-03-14T09:01:08.270" LastActivityDate="2020-03-14T09:01:08.270" Title="Differences Using Maximum Likelihood or Maximum a Posteriori for Deconvolution / Deblur" Tags="|deconvolution|blind-deconvolution|inverse-problem|maximum-likelihood-estimation|maximum-a-posteriori-estimation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13175" PostTypeId="2" ParentId="13174" CreationDate="2013-12-13T17:21:43.317" Score="2" Body="&lt;p&gt;Maximum a Posteriori (MAP) is the same as Maximum Likelihood Estimation (MLE) except with a Bayesian prior distribution on whatever it is that you're trying to estimate. So if you have prior information on the distribution of point spread functions then MAP will work better.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-13T17:21:43.317" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13176" PostTypeId="2" ParentId="13168" CreationDate="2013-12-13T18:22:49.630" Score="1" Body="&lt;p&gt;I think that the question is actually not why $n$ elementary multiplications is faster than $n^2$ ones. A convolution means that you multiply a vector with a convolution matrix. The operation has complexity $O(n^2)$. Yet, you can translate the vectors into frequency domain, where the convolution is diagonal matrix and you simply multiply $n$ corresponding elements of the vectors. The question is why is it faster despite of additional foruier and inverse fourier conversions, which is applying a matrix to the vectors, which has normally overhead of $n^2$. The answer is that the Fast Fourier transform is faster. &lt;a href=&quot;http://www.youtube.com/watch?v=M0Sa8fLOajA&quot; rel=&quot;nofollow&quot;&gt;FFT takes $n\log n$ elementary multiplications&lt;/a&gt;. So, $n + 2*n\log n = n(1+2\, \log n)$ is still a way faster than $n^2.$&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="4701" LastEditDate="2013-12-14T07:23:31.717" LastActivityDate="2013-12-14T07:23:31.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13177" PostTypeId="1" CreationDate="2013-12-13T18:36:44.700" Score="1" ViewCount="372" Body="&lt;p&gt;I have an image with size $256*256$ then i get the Fourier transform of the image, If i only take the central region of the Fourier transform whose size is $64*64$ and get the inverse FT ,What is the effect on the output image$(64*64)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Down-sampling, Blurring, or both.  &lt;/p&gt;&#xA;" OwnerUserId="1380" LastActivityDate="2014-01-04T17:05:50.080" Title="Downsapled and blurred image" Tags="|image-processing|fft|fourier-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13178" PostTypeId="2" ParentId="13177" CreationDate="2013-12-13T18:54:22.113" Score="2" Body="&lt;p&gt;Have you fftshifted your results or not? The answers will be different: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you fftshift your $256$ x $256$ 2-dimensional Fourier transform result, retain only the $64$ x $64 $ central co-efficients, inverse fftshift, and then inverse fourier transform the result, the effect will be a blurring of your original image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because you have culled our your images' high frequency components, hence, the effect will be a blurring. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If however you have not fftshifted, then you are doing the opposite, and will actually be doing a high pass filtering. (Your image will certainly not be blurred).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, hard thresholding fourier co-efficients like this is certainly used, but will give you ringing effects. However, those effects might be negligible and/or removable based on your application. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-12-13T19:03:36.260" LastActivityDate="2013-12-13T19:03:36.260" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13179" PostTypeId="2" ParentId="13051" CreationDate="2013-12-13T21:27:40.927" Score="0" Body="&lt;p&gt;The &lt;code&gt;ScaleValues&lt;/code&gt; property is easy to incorporate. Multiply the entire input signal by the first scale value, then the output of each section by subsequent values.&lt;/p&gt;&#xA;" OwnerUserId="7125" LastActivityDate="2013-12-13T21:27:40.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13180" PostTypeId="2" ParentId="13147" CreationDate="2013-12-13T22:44:02.550" Score="1" Body="&lt;p&gt;Instantaneous frequency is given by the derivative of the phase of the analytic signal. The analytic signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f_A(x) = f(x) + \mathrm{i} (h \ast f)(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h(x)$ is the Hilbert transform kernel. It can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f_A(x) = A(x) e^{\mathrm{i} \phi(x)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A(x) = |f_A(x)|$ and $\phi(x) = \arg(f_A(x))$. $A(x)$ is called the instantaneous amplitude and $\phi(x)$ is called the instantaneous phase. Instantaneous frequency in radians is then given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega(x) = \frac{d}{dx} \phi(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform has an infinite impulse response and therefore uses the entire signal to compute. Typically one would bandpass the signal to localise the response. This both smears the signal in the spatial domain and removes DC and high frequency components. The values calculated as above are then called &lt;em&gt;local&lt;/em&gt; amplitude, phase and frequency. Since the Hilbert transform has a discontinuity at DC in the Fourier domain, it is good to remove this first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB to get analytic signal it is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f_A = hilbert(f);&#xA;A = abs(f_A);&#xA;phase = angle(f_A);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But now the tricky bit, how to differentiate the phase? This is discussed here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com.au/matlabcentral/newsreader/view_thread/54129&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com.au/matlabcentral/newsreader/view_thread/54129&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would try taking a section of the phase signal centred at the point of interest, fit a polynomial, then calculate the derivative from the polynomial coefficients.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-12-13T22:44:02.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13181" PostTypeId="2" ParentId="13122" CreationDate="2013-12-14T00:00:04.553" Score="8" Body="&lt;p&gt;This has little to do with intuition. Tensors are rigorously defined &lt;em&gt;mathematical&lt;/em&gt; objects, and in general simple arrays don't qualify as tensors. Specifically, signals are not tensors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the language of mathematics, and there the field of differential geometry, a tensor is a linear function with several arguments. It is therefore also called a &lt;em&gt;multi-linear form&lt;/em&gt;. It is used to describe properties of manifolds at a single point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A point on a (smooth) manifold comes with a tangent space that contains all possible &quot;direction&quot; at that point, where a direction is really just a tangent vector at that point. This tangent space at a single point is a vector space and it has the same dimension as the manifold. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tangent space has a natural so called dual space, which contains the linear functions that map tangent space vectors to real numbers. This is the &lt;em&gt;cotangent space&lt;/em&gt;, and it's also a vector space of the dimension of the manifold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A tensor is now (roughly) a linear function that maps any number of dimensions between the tangent space, the cotangent space and the real numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tensors typically don't come as singles but in so called &lt;em&gt;bundles&lt;/em&gt;, which are the disjoint union of the tensors of all points of the manifold. For example if you have a vector at every point of the manifold then the whole structure is called a vector bundle. Similarly, tensor bundles associate a tensor with every point on the manifold, usually in a smooth way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In signal processing you can encounter tensors, but usually they are called differently. For example in video processing the image is your manifold (or rather, a function on a 2-dimensional manifold giving the brightness or color for each point) and the velocity field that describes the local motion is a rank 1 tensor field (or bundle) on that manifold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tensors also show up a lot in volume data processing, where tensors can describe local properties of the volume data. For example if you have a doppler ultrasonic tomography image, then the velocity data in each voxel is a tensor field as would be mechanical stress in tomographic material analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a 1-dimensional signals tensors often come in the form of derivative operators. For example if you have a signal $s(t)$, then the operator $\frac{\partial}{\partial t}$ is a tensor field of rank 1, or just a vector field. More generally, if you multiply that operator with a smooth function $g(t)$, then all possible vector fields on the manifold the signal lives on are of the form $g(t)\frac{\partial}{\partial t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum up, tensors are a description of differential properties of manifolds. If you want to understand them, you'll have to study differential geometry.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-12-14T00:00:04.553" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13183" PostTypeId="1" CreationDate="2013-12-14T11:48:50.720" Score="5" ViewCount="14192" Body="&lt;p&gt;I'm trying to implement a QPSK Mod/DeMod system in C++. So far i have a bit generator that generates N bits and stores it into an array:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;srand(time(0));&#xA;for (int i = 0; i &amp;lt; N; i++)&#xA;{&#xA;    bitstream[i] = rand() % 2;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I parse through the array to group bits of two and send those two bits to get modulated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int j = 0; j &amp;lt; N; j++)&#xA;{&#xA;    if (bitstream[j] == 0 &amp;amp;&amp;amp; bitstream[j + 1] == 0){ Dec_Num = 0; }&#xA;    else if (bitstream[j] == 0 &amp;amp;&amp;amp; bitstream[j + 1] == 1){ Dec_Num = 1; }&#xA;    else if (bitstream[j] == 1 &amp;amp;&amp;amp; bitstream[j + 1] == 0){ Dec_Num = 2; }&#xA;    else if (bitstream[j] == 1 &amp;amp;&amp;amp; bitstream[j + 1] == 1){ Dec_Num = 3; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The variable 'Dec_Num' is just the decimal representation of the group of two bits. The decimal number is what is sent to the QPSK Modulator function and is called with: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sig_no_noise = MOD_QPSK(Dec_Num);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The QPSK modulator function looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;complex&amp;lt;double&amp;gt; MOD_QPSK(int inc_bit){  &#xA;&#xA;if (inc_bit == 0){&#xA;    complex&amp;lt;double&amp;gt; QPSK_00(-sqrt(2)/2, -sqrt(2)/2);&#xA;    return QPSK_00;&#xA;    }&#xA;else if (inc_bit == 1){&#xA;    complex&amp;lt;double&amp;gt; QPSK_01(-sqrt(2)/2, sqrt(2)/2);&#xA;    return QPSK_01;&#xA;    }&#xA;else if (inc_bit == 2){&#xA;    complex&amp;lt;double&amp;gt; QPSK_11(sqrt(2)/2, sqrt(2)/2);&#xA;    return QPSK_11;&#xA;    }&#xA;else if (inc_bit == 3){&#xA;    complex&amp;lt;double&amp;gt; QPSK_10(sqrt(2)/2, -sqrt(2)/2);&#xA;    return QPSK_10;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The QPSK modulator maps the decimal number to a constellation map using gray coding that&#xA;looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KJXDG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have normalized the signal power to one and thus each constellation point corresponds to (sqrt(2)/2 , sqrt(2)/2) or the negative depending upon which quadrant that point is in. The modulated signal is then sent through an AWGN channel to the receiver/demodulator. The AWGN channel is simulated by generating complex gaussians using the C++'s standard library normal_distribution function. Where the mean is 0 and the variance is the noise variance found from the user inputted signal to noise ratio in dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Variance generated from user-inputted SNR(dB):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cout &amp;lt;&amp;lt; &quot;Input SNR: &quot;;&#xA;cin &amp;gt;&amp;gt; SNR;&#xA;SNR_lin = pow(10, SNR / 10);&#xA;var = 1 / (SNR_lin);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The complex gaussian noise is generated with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;default_random_engine generator;&#xA;normal_distribution&amp;lt;double&amp;gt; distribution(0, (sqrt(var)));&#xA;double number = distribution(generator);&#xA;double number1 = distribution(generator);&#xA;complex&amp;lt;double&amp;gt; AWGN_noise(number, number1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the modulated signal is added to this noise to simulate the signal going through an AWGN channel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DeMOD_QPSK(sig_no_noise + noise);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The QPSK demodulator is then called. The QPSK demodulator calculates the euclidean distance between the signal and all four constellation points and finds the shortest distance. That constellation point is then returned. The QPSK demodulator looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double DeMOD_QPSK(complex&amp;lt;double&amp;gt; reciv_sig_equal) //recv_sig with noise&#xA;{&#xA;&#xA;double d[4];&#xA;double small;&#xA;int dec_bit, loc = 0;&#xA;double x2, y2;&#xA;x2 = real(reciv_sig_equal);&#xA;y2 = imag(reciv_sig_equal);&#xA;d[0] = sqrt(pow(x2 - (-sqrt(2) / 2), 2) + pow(y2 - (-sqrt(2) / 2), 2));&#xA;d[1] = sqrt(pow(x2 - (-sqrt(2) / 2), 2) + pow(y2 -   sqrt(2) / 2,  2));&#xA;d[2] = sqrt(pow(x2 - ( sqrt(2) / 2), 2) + pow(y2 - ( sqrt(2) / 2), 2));&#xA;d[3] = sqrt(pow(x2 -   sqrt(2) / 2 , 2) + pow(y2 - (-sqrt(2) / 2), 2));&#xA;&#xA;small = d[0];&#xA;for (int j = 1; j&amp;lt;4; j++){&#xA;    if (d[j]&amp;lt;small){&#xA;        small = d[j];&#xA;        loc = j;&#xA;    }&#xA;}&#xA;&#xA;if (loc == 0){ return dec_bit = 0; }&#xA;if (loc == 1){ return dec_bit = 1; }&#xA;if (loc == 2){ return dec_bit = 2; }&#xA;if (loc == 3){ return dec_bit = 3; }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once the signal is demodulated into its decimal number, it has to be decoded once more to get it back to its original form of groups of two bits. This is done with this for loop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;decoded[j] = DeMOD_QPSK(sig_no_noise + noise);&#xA;&#xA;    for (int m = 0; m &amp;lt; N; m++)&#xA;{&#xA;    if (decoded[m] == 0)&#xA;    {&#xA;        rec_bit[m] = 0;&#xA;        rec_bit[m + 1] = 0;&#xA;    }&#xA;&#xA;    else if (decoded[m] == 1)&#xA;    {&#xA;        rec_bit[m] = 0;&#xA;        rec_bit[m + 1] = 1;&#xA;    }&#xA;&#xA;    else if (decoded[m] == 2)&#xA;    {&#xA;        rec_bit[m] = 1;&#xA;        rec_bit[m + 1] = 0;&#xA;    }&#xA;&#xA;    else if (decoded[m] == 3)&#xA;    {&#xA;        rec_bit[m] = 1;&#xA;        rec_bit[m + 1] = 1;&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The rec_bit array is the array that holds the received/demodulated data bits.&#xA;The BER is then calculated by comparing the generated bits to the received bits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int i = 0; i &amp;lt; N; i++)&#xA;{&#xA;    if (bitstream[i] != rec_bit[i])&#xA;    {&#xA;        BER_count++;&#xA;    }&#xA;}&#xA;BER = (BER_count / N);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that when i go to compare my BER curve, for SNR's from 1 to 10, with the theoretical QPSK curve for the same range of SNR's, my curve is slightly off. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/ppdWQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red line is my QPSK BER curve, and the blue/lower curve is the theoretical curve. The theoretical curve was plotted/calculated with a small matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SNR_dB=[0 1 2 3 4 5 6 7 8 9 10];%In dB&#xA;SNR_lin=10.^(SNR_dB/10);%Converting to linear scale&#xA;bit_err=qfunc(sqrt(2*SNR_lin));&#xA;semilogy(SNR_dB,bit_err);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help/ideas/suggestions would be Greatly appreciated. I am an amateur at both C++ programming, and at signal processing. So please pardon my inefficient methods at modulation and my lack of technically correct terms. &lt;/p&gt;&#xA;" OwnerUserId="7274" LastActivityDate="2017-03-29T13:42:12.143" Title="QPSK Modulation/Demodulation in C++" Tags="|matlab|modulation|digital-communications|demodulation|qpsk|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13184" PostTypeId="1" CreationDate="2013-12-14T12:11:21.483" Score="2" ViewCount="85" Body="&lt;p&gt;Norbert Wiener came up with the Wiener Deconvolution in 1949 or something like that. But what happened after that? When was Richardson-Lucy deconvolution developed for example? And what happened between that and Adobe's deblur demo in Creative Cloud?&lt;/p&gt;&#xA;" OwnerUserId="7275" LastActivityDate="2013-12-14T12:11:21.483" Title="What are the historical milestones in image Deconvolution?" Tags="|deconvolution|" AnswerCount="0" CommentCount="0" ClosedDate="2014-04-18T17:22:45.253" ContentLicense="CC BY-SA 3.0" />
  <row Id="13186" PostTypeId="1" CreationDate="2013-12-14T17:21:06.717" Score="1" ViewCount="897" Body="&lt;p&gt;I am having some trouble understanding how a digital signal gets converted back to an analog signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the &quot;sample and hold&quot; effect a problem?&lt;/p&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="21075" LastEditDate="2020-04-29T12:37:19.503" LastActivityDate="2020-04-29T12:37:19.503" Title="DAC and sample and hold effect" Tags="|conversion|digital-to-analog|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13188" PostTypeId="2" ParentId="12645" CreationDate="2013-12-14T19:13:18.493" Score="1" Body="&lt;p&gt;there is a more efficient way to do additive synthesis if all of the partials are harmonic (meaning every overtone has a frequency that is very close to an integer multiple of the fundamental frequency).  it's called &quot;wavetable synthesis&quot; and is not the same as mere sample-playback &quot;synthesis&quot;, but is related to it (as well as related to additive synthesis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sometimes you can group inharmonic partials into harmonic &quot;groups&quot; and use &quot;group additive synthesis&quot;, but i don't necessarily want to complicate the discussion with that yet.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-14T19:13:18.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13189" PostTypeId="2" ParentId="13168" CreationDate="2013-12-14T19:16:29.117" Score="0" Body="&lt;p&gt;fast convolution wouldn't be faster if the &quot;fast&quot; fourier transform (FFT) was not used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, i need to figure out how to use math pasteup here.  it is LaTeX or something else?  where is the information on that?&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-14T19:16:29.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13190" PostTypeId="2" ParentId="13147" CreationDate="2013-12-14T19:22:21.347" Score="1" Body="&lt;p&gt;are you doing this for a phase vocoder or something?  are you doing the short-time fourier transform (STFT) with multiple frames?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have trouble connecting &quot;instantaneous frequency&quot; (which you get from computing the analytical signal) to &quot;bins&quot; from an FFT output.  you can calculate stuff like group delay, but to get a changing frequency, you need to have multiple frames (spaced in time) and look at the change of phase (at a variety of bins) from one frame to the next.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-14T19:22:21.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13191" PostTypeId="1" CreationDate="2013-12-14T20:14:18.180" Score="4" ViewCount="117" Body="&lt;p&gt;Why does image deconvolution still work with image without sharp edges? Take this image for example:&lt;img src=&quot;https://i.stack.imgur.com/plgA7.png&quot; alt=&quot;http://habrastorage.org/storage2/eff/36d/77a/eff36d77a583b46e461c12a3c0037063.png&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7267" LastEditorUserId="128" LastEditDate="2019-12-31T09:55:59.690" LastActivityDate="2019-12-31T09:55:59.690" Title="Why Does Image Deconvolution Still Work with Image without Sharp Edges?" Tags="|image-processing|deconvolution|inverse-problem|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13192" PostTypeId="1" CreationDate="2013-12-14T20:15:44.843" Score="1" ViewCount="1309" Body="&lt;p&gt;I capture signal (sound) in 44100hz and I need get response if there is peaks at amplitude, actually. Is this possible? How I can do this in real-time? &lt;/p&gt;&#xA;" OwnerUserId="5857" LastActivityDate="2013-12-18T17:25:24.483" Title="Real-Time peak detection (amplitude)" Tags="|peak-detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13193" PostTypeId="1" AcceptedAnswerId="13556" CreationDate="2013-12-14T21:03:32.823" Score="1" ViewCount="119" Body="&lt;p&gt;Is there an accurate way to create an aliased image from the Fourier transform of the original image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in other words, i have the Fourier coefficients of an image and i want to make down-sample in frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="1380" LastActivityDate="2014-01-05T03:20:18.337" Title="Create an aliased image in FD" Tags="|image-processing|fourier-transform|downsampling|aliasing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13194" PostTypeId="1" AcceptedAnswerId="13196" CreationDate="2013-12-14T21:25:27.110" Score="0" ViewCount="4886" Body="&lt;p&gt;I am relatively new to signal processing techniques and Matlab and need a bunch of test data in the form of white noise, as defined on the Wikipedia page, with constant, flat power spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the matlab built-ins &lt;code&gt;wgn(m,n,p)&lt;/code&gt; and &lt;code&gt;randn(m,n)&lt;/code&gt; to get vectors of white noise, and then used different combinations of the periodogram/pwelch/dspdata.psd functions to check what I believe to be the power spectrum. I cannot say I am 100% certain on the basis of documentation and other forum sourcing, so do correct me if I am mistaken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting plots I get do not look even close to a flat spectrum but instead inherit the &quot;zick zacky&quot; curve of the original random data. The question I inevitably had to ask myself: Do you even know what to expect and how to understand the results of the functions and how a flat power spectrum looks like? I don't, hence I am here, looking for clarification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for answers which go beyond the Wikipedia pages etc., as they left me confused.&lt;/p&gt;&#xA;" OwnerUserId="7279" LastEditorUserId="76" LastEditDate="2013-12-19T08:19:55.880" LastActivityDate="2013-12-19T08:19:55.880" Title="Matlab: White noise with flat/constant power spectrum" Tags="|matlab|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13195" PostTypeId="2" ParentId="13156" CreationDate="2013-12-14T21:40:14.100" Score="-2" Body="&lt;p&gt;i might suggest looking up the good ol' Average Magnitude Difference Function (AMDF) or Average Squared Difference Function (ASDF) or Autocorrelation as means of determining the period which is the reciprocal of the fundamental frequency.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-14T21:40:14.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13196" PostTypeId="2" ParentId="13194" CreationDate="2013-12-14T21:56:47.577" Score="0" Body="&lt;p&gt;You need to average a bunch of FFTs of white noise to approach the average power spectral density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see &lt;a href=&quot;https://stackoverflow.com/questions/10272402/white-noise-has-flat-power-spectral-density&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://www.dsplog.com/2012/03/25/thermal-noise-awgn/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2013-12-14T21:56:47.577" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13197" PostTypeId="1" AcceptedAnswerId="13218" CreationDate="2013-12-15T03:07:32.837" Score="1" ViewCount="191" Body="&lt;p&gt;My computer vision / image processing professor uses the term &quot;Label&quot;, to represent part of an image, but cannot explain in a way that makes any sense to me what it is. She says this is a somewhat common term, but it is not clear what it is. Its somewhat similar to a pixel, but different. I can't find a definition anywhere. Any ideas / definitions?&lt;/p&gt;&#xA;" OwnerUserId="7282" LastActivityDate="2013-12-16T10:02:45.647" Title="What is a labeler?" Tags="|computer-vision|image-processing|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13198" PostTypeId="2" ParentId="13197" CreationDate="2013-12-15T07:42:32.013" Score="2" Body="&lt;p&gt;In computer vision you are often trying to classify an image or parts of an image. The labels correspond to the class names. For example, if you were doing gender classification on an image of a face then the labels would be male and female. If you were doing segmentation then the labels could correspond to sky, car, street and so on.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-15T07:42:32.013" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13200" PostTypeId="2" ParentId="13197" CreationDate="2013-12-15T12:09:59.720" Score="5" Body="&lt;p&gt;A label is some unique ID that you attach to part of an image or to a pixel. You can have as many labels as objects (or classes) of interest for your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in connected component labeling, pixels are assigned a label that is usually just a number corresponding to the ID of the connected region the pixels belong to;&lt;/li&gt;&#xA;&lt;li&gt;in object detection/recognition, the label is the name or the index of the class that a detected object belongs to;&lt;/li&gt;&#xA;&lt;li&gt;in face recognition, the label will be the name of the identified person whose face is given as input;&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-12-15T12:09:59.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13201" PostTypeId="1" AcceptedAnswerId="13202" CreationDate="2013-12-15T12:23:57.163" Score="0" ViewCount="348" Body="&lt;p&gt;I have doubt, please clear. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A transform is said to be unitary transform when the product of the transform matrix and its conjugate transpose (Hermitian) matrix is equal to Identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DFT for N= 4 gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c =&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 4     0     0     0&#xA; 0     4     0     0&#xA; 0     0     4     0&#xA; 0     0     0     4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus, it satisfies the Unitary property &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when N=2, we have &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2      1+j&#xA;1-j     2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This doesn't satisfy unitary property right? Then how can we say the DFT is a Unitary Transform? Where I have misunderstood the concept? Help&lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2013-12-15T14:40:53.587" Title="DFT's Unitary Property" Tags="|discrete-signals|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13202" PostTypeId="2" ParentId="13201" CreationDate="2013-12-15T14:40:53.587" Score="2" Body="&lt;p&gt;Just so we're on the same page: given some sequence $x[n]$ for $n=0, \dots, N-1$, the $k$'th DFT coefficient is (forgetting the scaling factor)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k] = \sum_{n=0}^{N-1} x[n] \exp(-j 2\pi k n/N)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can get all the coefficients by writing this as $ X = Dx$, where $D$ is the $N \times N$ DFT matrix and $D_{kn} = e^{-j 2\pi k n /N}$. For the N = 2 case, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D = \begin{pmatrix} &#xA;e^{-j 2\pi (0)(0) /2} &amp;amp;  e^{-j 2\pi (0)(1)/2}\\&#xA;e^{-j 2\pi (1)(0) /2} &amp;amp;  e^{-j 2\pi (1)(1)/2}&#xA;\end{pmatrix} = &#xA;\begin{pmatrix} &#xA;e^{-j 0} &amp;amp;  e^{-j 0}\\&#xA;e^{-j 0} &amp;amp;  e^{-j \pi}&#xA;\end{pmatrix} = \begin{pmatrix} &#xA;1 &amp;amp;  1\\&#xA;1 &amp;amp;  -1&#xA;\end{pmatrix},$$&#xA;for which $D^* D = D^T D = D^2 = 2I$, so (minus the scaling factor), unitary. &lt;/p&gt;&#xA;" OwnerUserId="7286" LastActivityDate="2013-12-15T14:40:53.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13204" PostTypeId="1" CreationDate="2013-12-15T15:33:38.483" Score="3" ViewCount="10650" Body="&lt;p&gt;I am trying to implement a Chebyshev type I low-pass IIR digital filter in C. I have got the SOS Matrix and scale values from Matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the direct equation or algorithm to implement such a filter?&lt;/p&gt;&#xA;" OwnerUserId="7287" LastEditorUserId="76" LastEditDate="2013-12-20T23:27:31.507" LastActivityDate="2013-12-21T04:24:54.417" Title="Algorithm for implementing an IIR digital filter, Chebyshev type I low pass" Tags="|lowpass-filter|c|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13206" PostTypeId="2" ParentId="13192" CreationDate="2013-12-15T15:41:36.810" Score="1" Body="&lt;p&gt;On a modern Pentium computer, it is possible to do many algorithms in real-time at 44.1 kHz. I suspect that what you want to do is possible, but what isn't possible is to tell you how to do it without a better explanation of what you are trying to do, which should include a better definition of what you mean by &quot;peaks at amplitude&quot;.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2013-12-15T15:41:36.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13207" PostTypeId="2" ParentId="13197" CreationDate="2013-12-15T16:11:36.687" Score="1" Body="&lt;p&gt;I think the underlying distinction is called &amp;quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Level_of_measurement&quot; rel=&quot;nofollow noreferrer&quot;&gt;level of measuerment&lt;/a&gt;&amp;quot; in theory of science.&lt;/p&gt;&#xA;&lt;p&gt;Simply put, the question is what operations make sense for a value:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the total energy measured by a CCD sensor at some pixel is a &lt;em&gt;ratio&lt;/em&gt; quantity: You can compare two brightnesses to find out which one is brighter than the other, you can add and subtract them, you can divide two brightness values or multiply them by a scalar constant, and you will get a meaningful result&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the typical example for an &lt;em&gt;ordinal&lt;/em&gt; property is &lt;a href=&quot;http://en.wikipedia.org/wiki/Mohs_scale_of_mineral_hardness&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mohs scale of mineral hardness&lt;/a&gt;. If mineral A has a hardness value of 4 and mineral B has a hardness value of 2, then A will scratch B. You can compare hardness values. Of course, you can also add and subtract mineral hardness values, but the result is meaningless.&lt;/p&gt;&#xA;&lt;p&gt;If your camera's sensor isn't linear and you don't know the functional relationship between light energy and the resulting pixel value, you should treat the pixels as ordinal properties.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a &lt;em&gt;nominal&lt;/em&gt; property is probably what your professor means by &amp;quot;label&amp;quot;: A typical example is nationality (French, American, German, ...). Even if you &lt;em&gt;represent&lt;/em&gt; them as integers in computer memory, you can't sensibly add or multiply these values. Greater than/less than between two nationalities isn't meaningful, either. The only meaningful relation between two labels is equality/inequality.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="291" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2013-12-15T16:11:36.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13209" PostTypeId="1" CreationDate="2013-12-15T18:59:33.870" Score="3" ViewCount="282" Body="&lt;p&gt;I am having a hard time understanding why my textbook takes the squared magnitude of the calculated DFT coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know in DFT, you would normally take the magnitude to get the spectrum, how come it is the squared magnitude which gives me the spectrum when iam using goertzel? &lt;/p&gt;&#xA;" OwnerUserId="7288" LastActivityDate="2014-03-07T10:51:47.183" Title="Goertzel algorithm" Tags="|discrete-signals|frequency-spectrum|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13210" PostTypeId="1" CreationDate="2013-12-16T02:21:47.187" Score="1" ViewCount="401" Body="&lt;p&gt;If $x[n]$ is a discrete random sequence with uniform distribution having mean $\mu = 2$ and variance $\sigma^2 = 3$, if passed through a moving average filter to get an output of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{x[n] + x[n-1] + x[n-2]}{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what would be the the variance of the new signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting 2 answers like 1 and 3. Which is correct?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="1629" LastEditDate="2016-05-21T08:42:31.333" LastActivityDate="2016-05-21T08:42:31.333" Title="Variance of a random discrete sequence" Tags="|discrete-signals|random|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13211" PostTypeId="1" CreationDate="2013-12-16T02:23:13.380" Score="7" ViewCount="5371" Body="&lt;p&gt;As I understand it, in image processing, when it is desired to apply a filter of some sort to an 2D image, a kernel is applied to all the pixels of the 2D image in a process called convolution. Median, Gaussian, Bilateral, all are examples of kernel. These kernels are applied in a similar fashion to that shown in this example &lt;a href=&quot;http://www.songho.ca/dsp/convolution/convolution2d_example.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Song Ho Ahn - Example of 2D Convolution&lt;/a&gt; (which I found at StackExchange Signal Processing).&lt;/p&gt;&#xA;&lt;p&gt;Is there a good list of all/many/most kernels, there uses, and an example before/after image?&lt;/p&gt;&#xA;&lt;p&gt;Also, is it correct to say that all kernels are just matrices which get convolved against a source?&lt;/p&gt;&#xA;" OwnerUserId="7282" LastEditorUserId="7092" LastEditDate="2023-04-14T17:42:21.170" LastActivityDate="2023-04-14T17:42:21.170" Title="Convolution Kernels for Image Filtering" Tags="|image-processing|filters|computer-vision|convolution|image-segmentation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13212" PostTypeId="2" ParentId="13211" CreationDate="2013-12-16T03:28:24.170" Score="8" Body="&lt;p&gt;Be careful, a median filter cannot be expressed as a convolution, and thus is not considered a kernel in this respect. This is because the median filter is based on order statistics of an image patch, and the resulting pixel at the output of a median filter is &lt;em&gt;not&lt;/em&gt; a linear combination of other pixels within a patch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you are right, kernels are generally thought of as just other 'small images', that one would convolve with the image to be analyzed. Those kernels can be chosen for a variety of reasons. Gaussian kernels are used for smoothing, laplacians are used for edge detections, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are as many kernels as you can imagine. However usually we start with a particular application in mind, &quot;I need to blur the image&quot;, or &quot;I need to detect edges in the x-direction&quot;, and then find kernels that magnify those features we are after. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2013-12-16T07:49:31.480" LastActivityDate="2013-12-16T07:49:31.480" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13213" PostTypeId="1" CreationDate="2013-12-11T06:25:19.193" Score="3" ViewCount="412" Body="&lt;p&gt;Currently I am working on chord recognition, and get confused on several aspect. One of them is choosing windowing for reduce the spectral leakage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;from what I read, hanning/hamming function is a good choice for windowing, but currently I read about welch windowing function, and its quite good either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, can somebody explain to me which windowing function I should choose and the reason?or are there any better windowing function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank you&lt;/p&gt;&#xA;" OwnerUserId="5797" OwnerDisplayName="user2826913" LastActivityDate="2013-12-16T04:03:27.027" Title="choosing windowing function for audio signal processing" Tags="|audio|fft|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13214" PostTypeId="1" AcceptedAnswerId="13242" CreationDate="2013-12-16T06:54:06.657" Score="0" ViewCount="128" Body="&lt;p&gt;Hi guys I'm currently studying for finals and I came across a square pulse problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UoBiC.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up getting this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/naPM4.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if I can simplify this to a sin function. If so how? And please correct me if I did the problem wrong in the first place.&lt;/p&gt;&#xA;" OwnerUserId="5815" LastEditorUserId="5815" LastEditDate="2013-12-16T07:16:45.850" LastActivityDate="2013-12-17T20:53:48.340" Title="Fourier series of a square pulse (simple simplification)" Tags="|fourier-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13215" PostTypeId="1" CreationDate="2013-12-16T07:37:44.293" Score="2" ViewCount="388" Body="&lt;p&gt;I am using &lt;a href=&quot;http://www.physionet.org/physiobank/database/mitdb/&quot; rel=&quot;nofollow&quot;&gt;MIT-BIH&lt;/a&gt; arrhythmical database where I have a digital signal of 1200 Hz so 1200 samples per second.&#xA;This means that analog filters have already applied to remove the frequencies over Nyquist frequency, so no aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I want to take equispaced sampling, every two sample, simply by the following in Matlab&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data([0:2:1200]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am reading Andre Quinquils' book Digital Signal Processing Using Matlab 2008:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is always necessary to use an anti-aliasing filter before the&#xA;  sampling stage in order to avoid any spectral aliasing risk and to set&#xA;  an appropriate sampling frequency. In practice, a causal approximation&#xA;  of this ideal filter is used. Thus, depending on the chosen filter&#xA;  synthesis method, some imperfections are introduced, such as a&#xA;  passband amplitude ripple, a transition band and a stopband finite&#xA;  attenuation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Does this mean that I need to apply a new anti-aliasing filter before the sampling stage in oder to avoid aliasing?&lt;/strong&gt;&#xA;I think the sampling stage here is the equalspaced sampling.&#xA;I have not applied any new special anti-aliasing filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Which antialiasing filter can you use before equalspaced sampling stage?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5633" LastEditorUserId="5633" LastEditDate="2013-12-16T09:58:36.783" LastActivityDate="2013-12-16T09:58:36.783" Title="Which antialiasing filter before equispaced sampling" Tags="|filters|sampling|aliasing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13216" PostTypeId="2" ParentId="13215" CreationDate="2013-12-16T08:57:59.767" Score="2" Body="&lt;p&gt;Yes, you have to apply another filter before downsampling in order to avoid aliasing. Your original signal has been acquired with a sampling rate $f_\mathrm{s} = 1.2\,\text{kHz}$. Taking every second sample effectively means that you divide the sampling rate by two, so your new sampling rate $f_\mathrm{s}'= f_\mathrm{s}/2 = 600\, \text{Hz}$. To avoid aliasing you have to make sure that the signal contains no frequencies above $f_\mathrm{s}'/2 = 300\, \text{Hz}$ before you apply the downsampling. If it is certain that your signal does &lt;em&gt;not&lt;/em&gt; contain any frequencies above $f_\mathrm{s}'/2$ then you don't need a filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The anti-aliasing filter can be implemented by an FIR filter. Its properties like stopband attenuation and width of transition band depend on your signal: if you have spectral components near to 300 Hz, the filter needs to be quite steep and it will consequently have a high order. If hardware implementation is an issue, have a look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Cascaded_integrator-comb_filter&quot; rel=&quot;nofollow&quot;&gt;Cascaded Integrator-comb filters&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-12-16T08:57:59.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13217" PostTypeId="2" ParentId="13177" CreationDate="2013-12-16T09:43:38.453" Score="0" Body="&lt;p&gt;By taking an FFT, retaining a sub-spectrum, then taking the inverse FFT you do actually perform two operations: low-pass filtering then downsampling. Reducing the size of tje spectrum can be seen as first setting to 0 everything outside the 64-by-64 area, then cropping out this 64-by-64 piece.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's detail a bit what happens:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First FFT: you compute $\hat{I} = \mathcal{F}(I)$, where $I$ is the original image (256-by-256).&lt;/li&gt;&#xA;&lt;li&gt;Set to 0 the coefficients outside the 64-by-64 area: $LPF(\hat{I})(f) = \hat{I}(f)$ if $f$ is in the 64-by-64 region, 0 otherwise. This is a low-pass filter (LPF) since you are actually removing high frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Downsampling: crop out the frequency region of interest: $\hat{X} = LPF(\hat{I})_{64 \times 64}$.&lt;/li&gt;&#xA;&lt;li&gt;Invert FFT: you obtain a smaller image $X = \mathcal{F}^{-1}(\hat{X})$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This downsampling procedure is however not common because low-pass filters with smoother decays are preferred.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-12-16T09:43:38.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13218" PostTypeId="2" ParentId="13197" CreationDate="2013-12-16T10:02:45.647" Score="2" Body="&lt;p&gt;Let me try to write a bit more encompassing answer. First of all, as &lt;a href=&quot;https://dsp.stackexchange.com/users/5662/aaron&quot;&gt;@Aaron&lt;/a&gt; hinted in &lt;a href=&quot;https://dsp.stackexchange.com/a/13198/1273&quot;&gt;his answer&lt;/a&gt;, a &lt;strong&gt;label&lt;/strong&gt; can be quite a &lt;strong&gt;general term&lt;/strong&gt;. It can pertain to &lt;em&gt;different things&lt;/em&gt; depending on your &lt;em&gt;application&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, generally, it's as &lt;a href=&quot;https://dsp.stackexchange.com/users/5662/aaron&quot;&gt;@Aaron&lt;/a&gt; says: &lt;strong&gt;the labels correspond to class names&lt;/strong&gt; in any occasion when you have to &lt;em&gt;classify all or some of the image pixels&lt;/em&gt;. Also, as &lt;a href=&quot;https://dsp.stackexchange.com/users/1355/sansuiso&quot;&gt;@sansuiso&lt;/a&gt; noted, &lt;strong&gt;the exact meaning of the labels depends on the context&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Labels can be both &lt;em&gt;computer assigned&lt;/em&gt;, _computer determined / deduced _, or &lt;em&gt;human assigned&lt;/em&gt; (usually by a person considered an &quot;expert&quot; in a certain field). Let me give some examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if the application is &lt;strong&gt;image segmentation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's several possible options here. The simplest one will be from the &lt;em&gt;test sets&lt;/em&gt;, or &lt;em&gt;ground truth sets&lt;/em&gt; for the segmentation: the &quot;experts&quot; will be asked to segment the image, and then &lt;em&gt;name&lt;/em&gt; each part / segment they marked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second one is running an segmentation algorithm &lt;em&gt;without relying on test sets for learning&lt;/em&gt;. The image will be segmented somehow (maybe in to predetermined number of regions, or depending on signal to noise ration). Those regions will simply be assigned &lt;em&gt;number labels&lt;/em&gt; by the algorithm: &lt;em&gt;region 1&lt;/em&gt;, &lt;em&gt;region 2&lt;/em&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third option might come from combining the results of a segmentation algorithm with a ground truth database: the algorithm might then try to &lt;em&gt;determine&lt;/em&gt; the actual &lt;em&gt;descriptive labels&lt;/em&gt; for the image regions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;usages in &lt;strong&gt;object detection&lt;/strong&gt; or &lt;strong&gt;object classification&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For both of this, you primarily need &lt;em&gt;examples&lt;/em&gt;. Examples are ideally the images containing only the object you want to learn how to detect or classify, but sometimes can contain more objects. Each image in the database needs to be processed by a human, each object correctly marked (&quot;segmented&quot;) and labeled (e.g. &quot;bird&quot;, &quot;cat&quot;, &quot;tree&quot;, &quot;book&quot;) to create the learning sets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example of such a database is &lt;a href=&quot;http://labelme.csail.mit.edu/Release3.0/&quot; rel=&quot;nofollow noreferrer&quot;&gt;LabelMe&lt;/a&gt;, where MIT is asking people to label some images in their free time if they feel like it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using those kind of databased, you can then do &lt;em&gt;object detection&lt;/em&gt; or &lt;em&gt;classification&lt;/em&gt;. For classification, you will usually only assign &lt;em&gt;one label per image&lt;/em&gt;. You try to find the &lt;em&gt;one object&lt;/em&gt; the image represents, and then label/classify the image by that. An image might then get the label &quot;bird&quot; or &quot;dog&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For object detection, only one or several regions of your image will be &quot;marked&quot; or &quot;segmented&quot; by your algorithm. Then each of those regions is assigned a label. Optionally, you might assign a label &quot;background&quot; to all remaining image pixels.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;satellite image understanding&lt;/strong&gt; (also kind of classification)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen examples when, for a satellite image, you have a label assigned to &lt;em&gt;every pixel&lt;/em&gt; from a predetermined set of labels (usually &quot;building, vegetation, road, water, ground&quot; or something similar). You have a small example image, or maybe just 10% of your image is labeled. You then try to learn the labels for each pixel in the rest of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try and find links to the works doing this, can't remember them right now.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As you can see, you can &lt;strong&gt;label very different things:&lt;/strong&gt; &lt;em&gt;the whole image&lt;/em&gt;, &lt;em&gt;each pixel&lt;/em&gt; individually, &lt;em&gt;isolated regions&lt;/em&gt; of the image, or &lt;em&gt;all the regions in a segmentation&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, labels can be &lt;em&gt;human determined&lt;/em&gt;, &lt;em&gt;generic&lt;/em&gt; (numeric) labels &lt;em&gt;determined by an algorithm&lt;/em&gt;, or &lt;em&gt;learned&lt;/em&gt; (so that they are human-understandable) based on examples marked/labeled by humans.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2013-12-16T10:02:45.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13220" PostTypeId="2" ParentId="13193" CreationDate="2013-12-16T12:23:49.370" Score="0" Body="&lt;p&gt;Yes, there is a (simple) way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aliasing comes from the fact that the bandwidth of the recording device is smaller than the bandwidth of the signal. &#xA;Out-of-bandwidth frequencies are not zeroed-out however, but injected into the captured part of the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find into which frequency coefficient they are injected without any computation by using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Periodicity&quot; rel=&quot;nofollow&quot;&gt;periodicity&lt;/a&gt; of the DFT.&#xA;If you suppose that the bandwidth of the recorder is some rectangle in the frequency domain, then this rectangle is replicated (translated) in each direction. So, you just have to translate mentally this rectangle to see which (in-bandwidth) position corresponds to an aliased frequency.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2013-12-16T12:23:49.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13221" PostTypeId="1" CreationDate="2013-12-16T14:31:45.250" Score="3" ViewCount="4495" Body="&lt;p&gt;I am new to seismic data processing and I really have no understanding of the term 'phase'. So, could anybody give me a simple explaination of the term?&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="7294" LastEditorUserId="1606" LastEditDate="2013-12-17T09:07:14.237" LastActivityDate="2022-08-16T00:26:18.853" Title="What does the term phase actually mean?" Tags="|phase|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13222" PostTypeId="2" ParentId="13221" CreationDate="2013-12-16T14:57:43.847" Score="10" Body="&lt;p&gt;I think &lt;a href=&quot;http://en.wikipedia.org/wiki/Phase_(waves)&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia can more than adequately answer your question.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, in brief, the phase term describes the relationship between a waveform and a fixed reference point in time.&lt;/p&gt;&#xA;&lt;p&gt;For example the sinusoid &lt;span class=&quot;math-container&quot;&gt;$\sin(\omega t)$&lt;/span&gt; is zero at &lt;span class=&quot;math-container&quot;&gt;$t = 0$&lt;/span&gt; whereas &lt;span class=&quot;math-container&quot;&gt;$\sin(\omega t - \phi)$&lt;/span&gt; is zero at &lt;span class=&quot;math-container&quot;&gt;$\omega t = \phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; could be referred to here as the phase offset.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastEditorUserId="80" LastEditDate="2022-08-16T00:26:18.853" LastActivityDate="2022-08-16T00:26:18.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13223" PostTypeId="2" ParentId="12663" CreationDate="2013-12-16T15:08:16.103" Score="2" Body="&lt;p&gt;The Wiener filter can be very useful for audio processing. With an estimate of noise or an interfering signal Wiener filtering can be used for audio source separation and denoising tasks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real power of the technique comes when it's applied to a Time-Frequency representation of the signal. I'm not familiar with Python but it looks to me like you are filtering the time domain representation of the signal. If you take a Short-Time Fourier Transform (STFT) first, you can then estimate noise at each time and frequency location and then selectively filter each location accordingly.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find more information about this by looking at Time-Frequency Masking and particularly the Ideal Ratio Mask.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastEditorUserId="5105" LastEditDate="2013-12-17T12:46:32.963" LastActivityDate="2013-12-17T12:46:32.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13224" PostTypeId="2" ParentId="13186" CreationDate="2013-12-16T15:39:13.583" Score="3" Body="&lt;p&gt;so the sampling theorem says basically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let   $ \ x[n] \triangleq x(nT) \ $  where $ \ f_s = 1/T \ $   is the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then $ x(t) $ can be reconstructed from the samples $x[n]$  using &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) \ = \ \sum_{n=-\infty}^{\infty} x[n] \cdot \mathrm{sinc} \left(\frac{t-nT}{T} \right) \ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is what you get when you pass this ideally sampled signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$  T \sum_{n=-\infty}^{\infty} x[n] \cdot \delta(t-nT) \ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;through an ideal brickwall low-pass filter with cutoff at $f_s/2$ and a passband gain of 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but what comes out of a DAC is &lt;strong&gt;not&lt;/strong&gt; that, but is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$  \sum_{n=-\infty}^{\infty} x[n] \cdot \mathrm{rect} \left(\frac{t-T/2 -nT}{T} \right) \ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so it's like the DAC has a hypothetical filter with impulse response of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h(t) \ = \ \frac{1}{T} \mathrm{rect} \left(\frac{t}{T}-\frac{1}{2} \right)&#xA; = \begin{cases}&#xA;\frac{1}{T} &amp;amp; \mbox{if } 0 \le t &amp;lt; T  \\&#xA;0           &amp;amp; \mbox{otherwise}&#xA;\end{cases} \ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the &quot;sample-and-hold effect&quot; really should be called the &quot;zero-order hold effect&quot; and what the effect is, is to pass your signal through a filter with the above impulse response and this transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(s) \ = \ \frac{1 - e^{-sT}}{sT} \ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this frequency response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(j 2 \pi f) \ = \ e^{-j \pi f T} \mathrm{sinc}(f T) \ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, these equations came out of the wikipedia references, which is why i suggested to look there first.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-16T15:39:13.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13226" PostTypeId="1" CreationDate="2013-12-16T17:58:45.983" Score="7" ViewCount="1381" Body="&lt;p&gt;I am doing some post-hoc analysis of a dataset consisting of a series of movie frames that are contaminated by a strongly periodic artifact. I would like to remove this artifact from my frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For ease of plotting I've just reshaped my array &lt;code&gt;M&lt;/code&gt; of pixel values to &lt;code&gt;[nframes, npixels]&lt;/code&gt;, then averaged over all pixel values to give me a 1D vector &lt;code&gt;m&lt;/code&gt;. Here's what this signal looks like in the time domain. You can see the oscillation quite clearly in the zoomed inset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rzPfL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then made a periodogram by taking &lt;code&gt;Fm = rfft(m)&lt;/code&gt;, and plotted &lt;code&gt;abs(Fm)**2&lt;/code&gt; against frequency. I see a very sharp peak at ~1.5Hz:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mNoun.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As well as the temporal periodicity, there also seems to be a weaker spatial component to this artifact, since at the exact peak frequency value there seems to be a smooth variation in phase across the x-axis of my frames, so that pixels on the right tend to lag pixels on the left:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/esyA0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a brute force approach, I've tried just filtering each pixel in the time domain using a notch filter centred on 1.5Hz. I used an order 4 Butterworth filter with critical frequencies 1.46 and 1.52Hz (I'm not well versed in filter design, so I'm sure there may be more appropriate choices).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what the mean pixel signal looks like after filtering:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Md7TT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the corresponding periodogram:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Yb7bX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notch filter does a reasonably good job of reducing the artifact, but since it basically looks like a pure stationary sinusoid I can't help but think that I could do better than just attenuating that part of frequency space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial (very naive) idea was to do something like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get the frequency, phase and amplitude of the oscillation from the Fourier spectrum for each pixel in the movie&lt;/li&gt;&#xA;&lt;li&gt;Reconstruct the oscillation in the time domain&lt;/li&gt;&#xA;&lt;li&gt;Subtract it from the movie frames&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I realise this isn't something people usually do, since interference usually isn't so spectrally pure and temporally stationary, but I wonder if it might make sense in my case?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Data&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://mega.co.nz/#!JZ9GnboI!ALfPI3Wnu45sMa6-dJeWYS0L9Ek7zmMTEgVre1fubuw&quot; rel=&quot;nofollow noreferrer&quot;&gt;Full 16bit TIFF stack&lt;/a&gt; (~2GB uncompressed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://mega.co.nz/#!ZRkiGLYC!CV-0wmW2-ywY8tCXjKuqBhwTuDVJ2VfhLUsJJuMi2fo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spatially decimated 8bit version&lt;/a&gt; (~35MB uncompressed)&lt;/p&gt;&#xA;" OwnerUserId="4606" LastEditorUserId="4606" LastEditDate="2013-12-17T12:09:58.787" LastActivityDate="2016-03-16T10:40:39.887" Title="Removing a sinusoidal artifact from a set of movie frames" Tags="|fourier-transform|image-processing|python|phase|denoising|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="13227" PostTypeId="1" CreationDate="2013-12-16T21:17:20.387" Score="0" ViewCount="234" Body="&lt;p&gt;I am having some troubles understanding the algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My algorithm looks like this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MXVLY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;how come am i able to compute the DFT coefficient using this algoritm. &#xA;As far as i know &#xA;$$&#xA;X[k] = \sum_{i=0}^{N-1}x(n)W_N^k&#xA;$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;which using Goertzel is the same as $$X(k) = y_k(N) $$ and since $$y_k(n) = v_k(n) -W_n^kv_k(n-1)$$ and $$v_k(n) =2cos(\frac{2 \pi k}{N}v_k(n-1)-v_k(n-2)+x(n)$$ which means &#xA;$$X(k) = y_k(N) = v_k(N) -W_n^kv_k(N-1)$$ which isn't the same as $$X[k] = \sum_{i=0}^{N-1}x(n)W_N^k$$ ??&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;how come is Goertzel using $$|X(k)^2|$$ to compute the amplitude spectrum, where DFT uses $$|X(k)|$$ to compute the amplitude spectrum. ??&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7277" LastActivityDate="2014-01-06T16:59:54.357" Title="Using goertzel confuses me" Tags="|dft|infinite-impulse-response|transfer-function|bandpass|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13228" PostTypeId="1" AcceptedAnswerId="13229" CreationDate="2013-12-17T02:56:29.273" Score="1" ViewCount="437" Body="&lt;p&gt;I am studying digital signal processing and our professor gave us a task of modulation and demodulation and designing an appropriate FIR low-pass filter in Matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done the modulation and demodulation but I am stuck on the filter designing. I want to know how the coefficients of filer are determined.&lt;/p&gt;&#xA;" OwnerUserId="7303" LastEditorUserId="76" LastEditDate="2013-12-20T23:27:18.770" LastActivityDate="2013-12-20T23:27:18.770" Title="FIR filter designing in Matlab" Tags="|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13229" PostTypeId="2" ParentId="13228" CreationDate="2013-12-17T03:36:40.873" Score="0" Body="&lt;p&gt;Have a look at the examples for &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/fir1.html&quot; rel=&quot;nofollow&quot;&gt;fir1&lt;/a&gt;, &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/fir2.html&quot; rel=&quot;nofollow&quot;&gt;fir2&lt;/a&gt;, or &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/firpm.html&quot; rel=&quot;nofollow&quot;&gt;firpm&lt;/a&gt;. The first two are straightforward, while firpm is a little more complicated as it derives the minimum filter length needed to match the design criteria, but it's handy to know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a simple lowpass filter this should be enough: Feel free to play around with N or look into using firpm to get the minimum order of N.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fc = 100; fs = 1024; N = 256;&#xA;b = fir1(N, 2*fc/fs);&#xA;freqz(b, 1, 65536, fs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-12-17T03:36:40.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13230" PostTypeId="1" CreationDate="2013-12-17T07:34:00.130" Score="0" ViewCount="538" Body="&lt;p&gt;When you perform a discrete Fourier transform (DFT), and compute the DFT coefficients, $c_k$ and $X(K)$, what do these values tell us about the signal it came from? &lt;/p&gt;&#xA;" OwnerUserId="7304" LastEditorUserId="1606" LastEditDate="2013-12-21T14:35:01.750" LastActivityDate="2019-01-06T09:10:29.257" Title="Discrete Fourier transform" Tags="|discrete-signals|dft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13231" PostTypeId="2" ParentId="13230" CreationDate="2013-12-17T08:58:34.137" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; would be a better place to get a full answer, but in short: Discrete Fourier Transform is defined over a finite set of $N$ samples $x_n$ by the formula &#xA;$$&#xA;X_k=\sum\limits_{n=0}^{N-1} x_n e^\frac{-i2\pi kn}{N} 	&#xA;$$&#xA;The resulting DFT coefficients contains information about the &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_domain&quot; rel=&quot;nofollow&quot;&gt;frequency content&lt;/a&gt; of the original signal.&lt;/p&gt;&#xA;" OwnerUserId="7296" LastActivityDate="2013-12-17T08:58:34.137" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13232" PostTypeId="1" CreationDate="2013-12-17T09:33:02.947" Score="2" ViewCount="1212" Body="&lt;p&gt;In radix-2 FFT, why is the bit growth equal to $1+\sqrt{2}$ per stage? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know the logic as to how that value has been obtained. Is it just empirical or has it been derived?&lt;/p&gt;&#xA;" OwnerUserId="5764" LastEditorUserId="76" LastEditDate="2013-12-17T10:19:44.227" LastActivityDate="2014-04-18T04:41:18.747" Title="Logic for bit growth in radix-2 fft" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13233" PostTypeId="2" ParentId="13144" CreationDate="2013-12-17T09:58:55.183" Score="1" Body="&lt;p&gt;I see two differences between your PSD plot and those from the reference you have given&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The PSD is normalized to the mean power of the data subcarriers&lt;/li&gt;&#xA;&lt;li&gt;The PSD is &quot;smoother&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In order to obtain a similar result&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the mean of the PSD at the data subcarriers and divide the PSD by this value&lt;/li&gt;&#xA;&lt;li&gt;&quot;Bin&quot; your PSD, i. e. take the mean of every $N$ PSD values to create a &quot;smooth&quot; version of the original PSD&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;By adding the following lines to your code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(linspace(-1,1,fft_len), fftshift(10*log10(PSD_mean)));&#xA;hold on;&#xA;&#xA;mean_sig_power = mean([PSD_mean(1:N/2) PSD_mean(fft_len-N/2+1:fft_len)]); % mean power of data subcarrierse&#xA;PSD_mean = fftshift(PSD_mean);  &#xA;bin_length = 2;&#xA;num_bins = floor(fft_len / bin_length);&#xA;PSD_smooth = zeros(1, num_bins);&#xA;for k = 1:num_bins&#xA;  PSD_smooth(k) = mean(PSD_mean((k-1)*bin_length + 1 : k*bin_length));&#xA;end&#xA;plot(linspace(-1,1,num_bins),(10*log10(PSD_smooth./mean_sig_power)),'r');&#xA;hold off;&#xA;ylim([-35 12]);&#xA;grid on;&#xA;legend('yours', 'theirs');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...I've created the following plot...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mWyv2.png&quot; alt=&quot;PSD of OFDM signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...which I think looks quite similar to your references.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2013-12-17T09:58:55.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13234" PostTypeId="1" CreationDate="2013-12-17T10:16:38.573" Score="5" ViewCount="8667" Body="&lt;p&gt;How is iterative refinement is applied to the estimate obtained by Lucas-Kanade algorithm? I am familiar with the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Estimate velocity at each pixel using one iteration of Lucas and Kanade estimation&lt;/li&gt;&#xA;&lt;li&gt;Warp one image toward the other using the estimated flow field&lt;/li&gt;&#xA;&lt;li&gt;Refine estimate by repeating the process&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am not able to get the meaning of above steps, more specifically, step (2) and what &lt;em&gt;&quot;warping one image toward the other&quot;&lt;/em&gt; means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it related to pyramidal implementation of Lucas-Kannade method? Can somebody please provide an explanation for this step?&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="53" LastEditDate="2013-12-17T14:26:31.350" LastActivityDate="2013-12-17T14:26:31.350" Title="Iterative Lucas-Kanade algorithm" Tags="|image-processing|computer-vision|optical-flow|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13235" PostTypeId="1" CreationDate="2013-12-17T10:53:51.003" Score="1" ViewCount="683" Body="&lt;p&gt;Actually I want to calculate the cross correlation coefficient of any signal on comparing with all mother wavelets like Morlet, Daubechies using MATLAB. &lt;/p&gt;&#xA;" OwnerUserId="7307" LastActivityDate="2017-07-21T10:46:38.487" Title="Cross correlation coefficient using MATLAB" Tags="|matlab|wavelet|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13236" PostTypeId="2" ParentId="13234" CreationDate="2013-12-17T11:34:42.657" Score="4" Body="&lt;p&gt;let's first explain what warp is: if you apply LK for two images and you get say &lt;em&gt;u&lt;/em&gt;=2 and &lt;em&gt;v&lt;/em&gt;=3 for a certain pixel, in this case applying warping of one image is to increase the x-coordinate of that pixel by 2 and increase it's y-coordinate by 3, and then make this for all other pixels in the image using the associated &lt;em&gt;u&lt;/em&gt; and &lt;em&gt;v&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In step two you need to warp one image using the &lt;em&gt;u&lt;/em&gt; and &lt;em&gt;v&lt;/em&gt; motion vectors that you get from the first step, if your estimate to &lt;em&gt;u&lt;/em&gt; and &lt;em&gt;v&lt;/em&gt; from the first step is accurate then after applying the second step the two images will coincides on each other, and this means that if you apply Lucas Kanade algorithm on these two images(step 3) you will get &lt;em&gt;u&lt;/em&gt;=0 and &lt;em&gt;v&lt;/em&gt;=0 because the two images coincides on each others. but in real situations you will not get accurate &lt;em&gt;u&lt;/em&gt; and &lt;em&gt;v&lt;/em&gt; from the first iteration. so after applying the warping there will be a smaller motion between the two images and if you apply Lucas Kanade algorithm between these two images you will get a smaller &lt;em&gt;u&lt;/em&gt; and &lt;em&gt;v&lt;/em&gt; and you refine the motion vectors by the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u_(next) = u_(previuos) + u_(current)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v_(next) = v_(previuos) + v_(current)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the algorithm terminates when $u_(current)$ and $v_(current)$ are zeros or very small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is iterative LK without pyramids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the idea from the following &lt;a href=&quot;http://crcv.ucf.edu/source/Optical_Flow/Lucas%20Kanade.zip&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt; which implements iterative LK with pyramids explained in the following paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;B.D. Lucas and T. Kanade, &quot;An Iterative Image Registration technique, with an Application to Stero Vision,&quot; Int'l Joint Conference Artifical Intelligence, pp. 121-130, 1981.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="1380" LastEditDate="2013-12-17T14:10:18.993" LastActivityDate="2013-12-17T14:10:18.993" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13237" PostTypeId="2" ParentId="10873" CreationDate="2013-12-17T13:03:35.830" Score="1" Body="&lt;p&gt;There are some examples in this blog post. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://iosr.surrey.ac.uk/blog/2013-12-16.php&quot; rel=&quot;nofollow&quot;&gt;http://iosr.surrey.ac.uk/blog/2013-12-16.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2013-12-17T13:03:35.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13238" PostTypeId="1" CreationDate="2013-12-17T16:42:26.660" Score="4" ViewCount="10628" Body="&lt;p&gt;I want to calculate delay between an input and an output audio signal of my audio processing system. The input and output signals are available as signed 16 bit integers. To try out, I tried the autocorrelation of the input signal with the following numpy commands:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import wave&#xA;wfp = wave.open('test.wav', 'rb')&#xA;samples = wfp.readframes(wfp.getnframes())&#xA;signal = np.frombuffer(samples, np.int16)&#xA;corr = np.correlate(signal, signal, &quot;full&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assumed that the peak of the autocorrelation is always at lag 0, which is at the index corr.size / 2 in the corr array. However I get different values for the index, when I calculate np.argmax(corr).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I normalize the signal first to get values between -1.0 and +1.0, the peak is always at corr.size / 2 as expected, at least in my tests with different signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For normalization, I used the following steps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal = signal / float(0xFFFF)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone please explain to me, why I have to normalize the signal.&lt;/p&gt;&#xA;" OwnerUserId="7309" LastActivityDate="2022-07-15T04:06:00.597" Title="numpy.correlate and autocorrelation; audio signal" Tags="|audio|python|correlation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13240" PostTypeId="1" CreationDate="2013-12-17T17:13:35.680" Score="2" ViewCount="307" Body="&lt;p&gt;First off, I apologize for possibly incorrect use of jargon, as I am new in this area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a type of signal that I am assuming can be described by an arbitrary number (let's say $n$) of basis vectors, which are linearly independent. I am measuring a signal through one sensor, which gives me a vector of amplitudes. I am able to measure an arbitrary number (let's say $m$) of mixtures of the basis signals, which gives me $m$ measured signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The length of my vectors is 150000, sampled at a frequency of 2.5 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is what I think my system of equations will look like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y = A X $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Y$ is the matrix containing the mixtures (measurements) and has dimensions of $ m \times 150000 $, $X$ is the matrix containing the basis signals, and has dimensions of $ n \times 150000 $, and $A$ is a coefficient matrix that has dimensions of $ m \times n $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to solve for $A$. However, since $X$ is non-square ($ n \ll 150000$), it does not have an inverse. I guess I could calculate the pseudo-inverse. Does this make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also looked into Principal Component Analysis and how it is used in various types of spectroscopy. It seems to me that PCA assumes a set of basis signals, and I don't know whether that has a physical meaning in my case, since my signals are stochastic (but stationary). I used the PCA routine on matrix $Y$ in MATLAB, and it gave me some signals very similar to the input ones, but I did not know what to do with them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I do have a valid physical model for my signals. Should I perhaps use model-based blind source separation (BSS) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for taking the time.&lt;/p&gt;&#xA;" OwnerUserId="7310" LastEditorUserId="7310" LastEditDate="2013-12-17T20:11:48.360" LastActivityDate="2014-03-31T12:57:31.417" Title="Separating a signal into its constituent components" Tags="|signal-analysis|source-separation|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13241" PostTypeId="1" AcceptedAnswerId="13250" CreationDate="2013-12-17T18:58:53.257" Score="0" ViewCount="198" Body="&lt;p&gt;One way to measure the frequency response of a filter is to input separate cosine/sine wave at the desired frequency, measure the steady state output, stack the inputs/outputs into complex arrays, and divide. A more efficient way is to use the DFT, and somehow we get away with just inputting one sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Input $x_n = A \cos(\omega_0 n)$, with $\phi = 0$&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure the steady-state output:&#xA;$$&#xA;  \begin{align*}&#xA;    y_n =  A | H(e^{j \omega_0}) | \cos\left (\omega_0 n + \angle H(e^{j\omega_0}) \right )&#xA;  \end{align*}&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the DFTs $Y_k$ and $X_k$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Record $H_{\hat{k}} = \frac{Y_{\hat{k}}}{X_{\hat{k}}}$ at $\hat{k}$ that corresponds to $\omega_0$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to figure out is why this works, clearly there's phase information but I'm missing something in the derivation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;  X_{\hat{k}} &amp;amp;= \sum_{n=0}^{N-1} x_n e^{-j \omega_0 n} \quad \text{where } \frac{2\pi}{N} \hat{k} = \omega_0 \\&#xA;    &amp;amp;= \sum_{n=0}^{N-1} A \cos(\omega_0 n) e^{-j \omega_0 n} \\&#xA;    &amp;amp;= \frac{A}{2} \sum_{n=0}^{N-1} \left (e^{j\omega_0 n} + e^{-j\omega_0 n} \right ) e^{-j\omega_0 n} \\&#xA;    &amp;amp;= \frac{A}{2} \sum_{n=0}^{N-1} 1 + e^{-j 2 \omega_0 n}&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;  Y_{\hat{k}} &amp;amp;= \sum_{n=0}^{N-1} A \left | H(e^{j\omega_0}) \right | \cos\left (\omega_0 n + \angle H(e^{j\omega_0}) \right ) e^{-j \omega_0} \\&#xA;    &amp;amp;= \frac{A}{2} \left | H(e^{j\omega_0}) \right | \sum_{n=0}^{N-1} \left (e^{j(\omega_0 n + \angle H(e^{j\omega_0}))} + e^{-j(\omega_0 n + \angle H(e^{j \omega_0}))} \right ) e^{-j\omega_0 n} \\&#xA;    &amp;amp;= \frac{A}{2} \left | H(e^{j\omega_0}) \right | \sum_{n=0}^{N-1} e^{j \angle H(e^{j\omega_0})} + e^{-j \angle H(e^{j \omega_0})} e^{-j 2 \omega_0 n} \\&#xA;    &amp;amp; \; \Big\Downarrow \; \text{?} \\&#xA;    &amp;amp;= \frac{A}{2} \left | H(e^{j\omega_0}) \right | e^{j \angle H(e^{j\omega_0})} \sum_{n=0}^{N-1} 1 + e^{-j 2 \omega_0 n}&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is that the phase information comes out by dividing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;  H_{\hat{k}} &amp;amp;= \frac{Y_{\hat{k}}}{X_{\hat{k}}} = \left | H(e^{j\omega_0}) \right | e^{j \angle H(e^{j\omega_0})}&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="6934" LastEditorUserId="6934" LastEditDate="2013-12-18T16:32:39.630" LastActivityDate="2014-02-16T17:27:52.160" Title="Why is it possible to frequency sweep with just one sinusoid?" Tags="|fft|dft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13242" PostTypeId="2" ParentId="13214" CreationDate="2013-12-17T20:53:48.340" Score="1" Body="&lt;p&gt;You could rewrite $x(t)$ as a rectangular function before doing the Fourier transform. You could deduce the width and center of the rect signal directly from the given expression but it would be a easier to just draw the signal and deduce the values from the graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your rect signal will be in the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t) = rect(\frac{t-t_o}{W})$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_0$ - center of the rectangular signal &lt;/p&gt;&#xA;&#xA;&lt;p&gt;W - width(duration) of the pulse&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this point you would use a Fourier transform table and some Fourier transform theorems (involving scaling and delay) to get the $sinc$ version of the $X(\omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, if you prefer, you could just modify a little bit the expression you already have to get the expression where you could use Euler's formula as Dilip Sarwate commented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(\omega)=1 \cdot \frac{1}{j\omega}(e^{-j\omega} - e^{-j2\omega})= e^{-j1.5\omega}e^{+j1.5\omega} \frac{1}{j\omega}(e^{-j\omega} - e^{-j2\omega}) = e^{-j1.5\omega}\frac{1}{j\omega}(e^{+j0.5\omega} - e^{-j0.5\omega})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this point it should be easy to get the result.&lt;/p&gt;&#xA;" OwnerUserId="3431" LastActivityDate="2013-12-17T20:53:48.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13243" PostTypeId="2" ParentId="13194" CreationDate="2013-12-17T22:28:50.570" Score="0" Body="&lt;p&gt;You may be interested in generating a &quot;maximal length sequence&quot; (MLS) vector. Even for short sequences, its fourier transform is spectrally flat (except for the 1st DC element, which can be tested independently). The test vector will consist of only +1 and -1 values, of length 2^N - 1 which you can apply to the system under test and obtain a response vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;MLS are frequently used in impulse response measurement. You can use a simple back-substituion method or the fast hadamard transform to quickly obtain an impulse response from the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the impulse response, you can fourier transform it to get the frequency response from which the power spectral gain can be obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, an impulse response is also spectrally flat (It's fourier transform is 1 at all frequencies) but often does not have enough power for reasonable test data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, Matlab does not appear to have a function for generating an MLS (as far as I can see), but the following submission which I have not evaluated contains a .m file that claims to do this for you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/1246-mls-m&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/1246-mls-m&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may have to dig in a bit if you want to get the impulse response from the output but at least this will give you a spectrally flat test signal, which is what you requested. &lt;/p&gt;&#xA;" OwnerUserId="7315" LastActivityDate="2013-12-17T22:28:50.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13245" PostTypeId="2" ParentId="13221" CreationDate="2013-12-17T23:39:25.797" Score="4" Body="&lt;p&gt;Phase is a property of sinusoidal waves and describes how far along the wave is in it's cycle. A simple wave may be described as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(\theta)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\theta$ is it's phase.  It's usually measured in radians and at every multiple of 2$\pi$, the wave goes back to the beginning of its cycle and starts again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the wave is varying in time, it may be described as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin( \omega t )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wave will repeat its cycle every time $\omega t$ reaches $2\pi$, or every $2\pi/\omega$ seconds, which is the wave's period. The term, $\omega t$ is the wave's phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In seismology, the wave will travel through time and space. A wave in space and time will look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin( kx - \omega t )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $k$ is the wave-vector describing the wavelength and direction of propagation of the wave in space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$kx - \omega t$ is the wave's phase. Every time, $kx - \omega t$ reaches $2\pi$, the wave will repeat its cycle. The wave's wavelength is $2\pi/k$ and it's period is $2\pi/\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a linear system, you can split any signal into a sum on sinusoidal signals at different frequencies, calculate how the individual sinusoidal signals propagate, then recombine them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many case it is easier to do calculations with sines and phase than it is to handle the propagation of the individual waves themselves.&lt;/p&gt;&#xA;" OwnerUserId="7315" LastEditorUserId="1606" LastEditDate="2013-12-18T09:14:02.297" LastActivityDate="2013-12-18T09:14:02.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13246" PostTypeId="2" ParentId="13228" CreationDate="2013-12-18T00:03:43.423" Score="0" Body="&lt;p&gt;I've been playing around with this web-based software, which seems to solve your problem quite nicely:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://www.micromodeler.com/dsp&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've mostly been using it for the ARM Cortex, but it generates code for Matlab also. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It takes seconds to drag, drop and edit a filter and have it produce the matlab code. The filter length is limited in the demo version, but you can use a lower length filter then tune it manually afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might come in useful if you ever need to quickly design a filter in the future and produce Matlab code for it. &lt;/p&gt;&#xA;" OwnerUserId="7315" LastActivityDate="2013-12-18T00:03:43.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13247" PostTypeId="1" CreationDate="2013-12-18T02:36:43.333" Score="0" ViewCount="147" Body="&lt;p&gt;Thanks porten!&#xA;Thanks Bitstream!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But our professor has said that design your own filter!(not used built in function of matlab).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am designing my own filter.The problem is still there.First, i have to know filter's  order(N). One way is to find from its transition width. The pass-band edge frequency is 500Hz and stop band edge frequency is 700Hz. But i don't understand how to get it?&#xA;Can you help me?&lt;/p&gt;&#xA;" OwnerUserId="7303" LastActivityDate="2013-12-18T23:11:45.580" Title="Fir filter designing in matlab(1)" Tags="|filters|" AnswerCount="2" CommentCount="2" ClosedDate="2013-12-23T01:59:06.997" ContentLicense="CC BY-SA 3.0" />
  <row Id="13249" PostTypeId="2" ParentId="13240" CreationDate="2013-12-18T12:01:29.347" Score="2" Body="&lt;p&gt;You can have a look to &lt;a href=&quot;http://en.wikipedia.org/wiki/Non-negative_matrix_factorization&quot; rel=&quot;nofollow&quot;&gt;Non-negative Matrix Factorization&lt;/a&gt;, which try to find the factorization of a matrix (be careful, the matrix values have to be non negative) into a product of two matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By adding L1 regularization to the cost function, you can ensure that each measure is encoded by a relatively small set of basis functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been used for example for &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/e6820/papers/SmarB03-nmf.pdf&quot; rel=&quot;nofollow&quot;&gt;music transcription&lt;/a&gt;, computer vision, text classification,....&lt;/p&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2013-12-18T12:01:29.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13250" PostTypeId="2" ParentId="13241" CreationDate="2013-12-18T16:25:43.313" Score="0" Body="&lt;p&gt;Thanks to geometrikal and Jason R, the sum of exponentials is equal to zero when $\omega_0 = \frac{2\pi}{N} \hat{k}$ and $0 \leq \hat{k} \leq N-1$, which is obvious when you realize that it's just the sum over $2 \hat{k}$ periods of $e^{-j2\omega_0n}$, where $T = \frac{2\pi}{2\omega_0} = \frac{N \pi}{2\pi \hat{k}} = \frac{N}{2 \hat{k}}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $\hat{k} &amp;gt; N-1$, I suppose you would have to zero pad, which is where the digital sinc Jason R. mentions comes in.&lt;/p&gt;&#xA;" OwnerUserId="6934" LastActivityDate="2013-12-18T16:25:43.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13251" PostTypeId="2" ParentId="13192" CreationDate="2013-12-18T17:22:23.330" Score="1" Body="&lt;p&gt;In real time you may detect the local maxima but not the global maxima. &#xA;It is important to you to have a training data, to set some peak levels. You say peaks in amplitude, so I assume you are considering the volume of the sound. Because a sudden note from 2 octaves higher might be another peak. But then you should consider the frequencies, not the volume.&#xA;In short, without having an assumption for the peak levels, you can't detect peaks in real time. After you have some assumptions search for the peak detection algorithms. &lt;/p&gt;&#xA;" OwnerUserId="7324" LastActivityDate="2013-12-18T17:22:23.330" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13252" PostTypeId="2" ParentId="13192" CreationDate="2013-12-18T17:25:24.483" Score="1" Body="&lt;p&gt;From your comment it sounds like you may not be looking for &quot;peak detection&quot; per se, but rather detecting when the magnitude of the signal becomes large. Or perhaps even just detecting whether or not there is signal present. If that is the case, then might I suggest simply setting a threshold on the amplitude of the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If peak detection really is what you are after, then you can find the peaks in a signal by taking the derivative of the signal and looking at the zero crossings.&lt;/p&gt;&#xA;" OwnerUserId="7319" LastActivityDate="2013-12-18T17:25:24.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13253" PostTypeId="2" ParentId="13247" CreationDate="2013-12-18T20:52:18.963" Score="1" Body="&lt;p&gt;There is no one perfect order &quot;N&quot;.  You can always get a better (or at least as good) filter by increasing N, at the cost of more computational load.  So usually the question is &quot;what is the lowest N that will be barely good enough?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A relatively easy way to determine that is experimentally.  Guess what you think the optimal N will be, design a filter, see if it meets the filter criteria or not.  If it does with large margins, reduce N by a lot.  If it barely makes it either stop or reduce N by a little.  If it doesn't make the criteria, increase N.  Rinse and repeat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;frederic harris (for some reason he likes to have his name uncapitalized) gave the following formula in his book &quot;Multirate Signal Processing for Communication Systems&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ N \approx \frac{f_s}{\Delta f} \frac{Atten(dB) - 8}{14}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the estimated filter order, $f_s$ is the sample frequency, $\Delta f$ is the transition band width, and $Atten(dB)$ is the amount of attenuation you want in the stop band, in dB.  I would &lt;em&gt;not&lt;/em&gt; use the formula to get the optimal $N$, rather I would use it as a starting place for the iterative process described above.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-12-18T20:52:18.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13254" PostTypeId="1" AcceptedAnswerId="13301" CreationDate="2013-12-18T21:20:26.217" Score="2" ViewCount="7193" Body="&lt;p&gt;I currently have a .wav signal that was recorded at a 48 kHz sample rate, with a central frequency of 5.260 MHz and bandwidth of 4 kHz. I'm trying to get some information from this signal, specifically the location of the frequency peaks using matlab, which I would expect to be around 5.260 MHz. The code I'm using to generate the power spectral density is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;path = '5.260MHz.wav';&#xA;f0 = 5.260e6; % frequency 5.260 MHz&#xA;&#xA;% sample properties&#xA;[x, Fs] = wavread(path); % Fs = 48 kHz&#xA;alias = 48e3*floor(f0/48e3);      % starting frequency of target alias&#xA;&#xA;%estimate spectrum&#xA;[psd, f] = pwelch(x, 512, [], [], Fs);&#xA;&#xA;% If the frequency lies in one of the mirror frequency bands,&#xA;% we have to rotate about half the sample rate.&#xA;if (mod(f0, 48e3) &amp;gt; 24e3)  &#xA;    f = Fs - f;&#xA;end&#xA;&#xA;plot(f + alias, psd)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This script produces the following plot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RD28R.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bandwidth does seem to be 4 kHz as expected, but the frequency peaks appear to be in the wrong place. I would expect them to occur between 5.256 and 5.264 MHz, or maybe 5.258 and 5.262 MHz, not between 5.276 and 5.280 MHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I generated my own files with the same central frequency and bandwidth, I got the following when I ran the above script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% signal properties&#xA;f0 = 5.260e6;           % frequency 5.260 MHz&#xA;sf = 4e3;               % bandwidth 4 kHz&#xA;&#xA;% sample properties&#xA;fs = 24e6;              % sampling frequency 24 MHz&#xA;N = 10e6;               % number of samples&#xA;&#xA;% generate random frequency modulated sinusoidal signal&#xA;fi = smooth(randn(N, 1), 11);&#xA;fi = fi / std(fi) * sf + f0;&#xA;x = cos(2 * pi * cumsum(fi) / fs);&#xA;&#xA;% downsample to 48 kHz (factor 500)&#xA;x = x(1 :500: end);&#xA;fs = fs / 500;&#xA;&#xA;wavwrite(x, fs, 'test_5.260MHz.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KNjJX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plot is exactly as expected, using the same script as the first plot. I'm wondering if I should be treating the first input different in some way to have it graphed correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've tried testing some other generated cosine signals using the same code as above, and they all graph correctly. However, every data signal I've tried has been off to some degree (I can post different sample plots if that would be useful). It could be an error with the data collection instrument, but it's far more likely to be a bug in my code.&lt;/p&gt;&#xA;" OwnerUserId="7325" LastEditorUserId="7325" LastEditDate="2014-01-09T00:29:02.663" LastActivityDate="2014-01-09T00:29:02.663" Title="Technique of sampling a high-frequency signal (Mhz) with a lower sampling rate (khz)?" Tags="|matlab|fft|bandwidth|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="13255" PostTypeId="2" ParentId="13204" CreationDate="2013-12-18T22:43:08.727" Score="1" Body="&lt;p&gt;I've been using some pretty nice web-based filter design software that solves the whole problem in one go:&#xA;  &lt;a href=&quot;http://www.micromodeler.com/dsp&quot; rel=&quot;nofollow&quot;&gt;http://www.micromodeler.com/dsp&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does the filter design, SOS factoring, solves the integer coefficients and spits out the code in C or for several other platforms. It's pretty intuitive and the demo version should give you the C code that you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you don't use the generated code directly in your assignment, you can see how it's done it and you can also use their one to check your results.&lt;/p&gt;&#xA;" OwnerUserId="5110" LastActivityDate="2013-12-18T22:43:08.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13256" PostTypeId="2" ParentId="9339" CreationDate="2013-12-18T22:43:51.423" Score="1" Body="&lt;p&gt;This document is seriously awesome.  It gave me a good understanding of how spectrum analysers work in an easily understandable way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://literature.agilent.com/litweb/pdf/5965-7920E.pdf&quot; rel=&quot;nofollow&quot;&gt;http://literature.agilent.com/litweb/pdf/5965-7920E.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5806" LastActivityDate="2013-12-18T22:43:51.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13257" PostTypeId="2" ParentId="13247" CreationDate="2013-12-18T23:11:45.580" Score="0" Body="&lt;p&gt;Kaiser's approximation is another way to do this and it seemed to work better, at least in my case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N = [-20*log10(sqrt(dp*ds)) - 13]/[14.6(ws - wp)/2pi]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.webpages.ttu.edu/tkarp/ECE4364/chapter6.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.webpages.ttu.edu/tkarp/ECE4364/chapter6.pdf&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://www.dsprelated.com/showmessage/62286/1.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showmessage/62286/1.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oppenheim and schaefer p 480 - Characteristics of FIR filters, which is also Kaiser's approximation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is Belanger's approximation, from the first reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are only estimates and in practice, these will be good for a first estimate but you will then have to iteratively look at the graphs and adjust N manually if you need to get a good fit.&lt;/p&gt;&#xA;" OwnerUserId="5110" LastActivityDate="2013-12-18T23:11:45.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13258" PostTypeId="2" ParentId="11503" CreationDate="2013-12-18T23:12:03.830" Score="1" Body="&lt;p&gt;I don't know of a function that does all of what you ask, but it is easy enough to write.  They key step is to create short-time integrations on which the FFTs may be performed.  As you say, cpsd then averages all these STIs, but you can write your own to skip that step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key function to do this is $y = buffer (x,fftlen,overlap)$.  You input your FFT processing parameters, similar to cpsd, and get a matrix of overlapping time series.  I apply a Hanning window to each STI before performing FFT. Then you can simply apply $S = FFT(y)$ to get a matrix of overlapped spectra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Assuming x is longer than fftlen:&#xA;overlap = fftlen/2; % 50% overlap&#xA;win = hanning(fftlen);&#xA;X = buffer(x,fftlen,fftlen/2,'nodelay');  % Matrix of overlapping STIs&#xA;numSTIs = size(X,2);&#xA;winX = X.*win(:,ones(1,numSTIs); % Time-domain windowed STIs&#xA;S = fft(winX,fftlen,1)/fftlen;  % Double-Sided Complex Spectrum Matrix&#xA;SdB = 20*log10(2*abs(S(1:fftlen/2+1,:)));  % Log Scale Single-Sided Real Spectrum Matrix&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then calculate your auto-spectrum using either of these matices.  Of course you would need an x2 to repeat and calculate a cross-spectrum matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i = 1:numSTIs&#xA;    Sx1x2(:,:,i) = S1(:,i)'*S2(:,i);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(If anyone knows of a way to do this without a for loop, please let me know!)&lt;/p&gt;&#xA;" OwnerUserId="7326" LastEditorUserId="1273" LastEditDate="2013-12-19T12:08:26.280" LastActivityDate="2013-12-19T12:08:26.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13259" PostTypeId="1" AcceptedAnswerId="13260" CreationDate="2013-12-18T23:23:34.847" Score="0" ViewCount="381" Body="&lt;p&gt;This might sound silly, but I have a language barrier type of question, and I was hoping someone could clear up this misunderstanding:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen the term &quot;early vision&quot; several times in papers I've read, but the term often doesn't accompany any &lt;em&gt;later&lt;/em&gt; publications to compare with when using the term. At first I assumed this was referring the the chronological order of the publications, but the lack of &quot;later vision&quot; makes me, as a newcomer to the field, question whether this is a term to refer to the processing order used in vision - such as &quot;early&quot; in respect to the order of operations used in the image processing. What is the correct interpretation of this term?&lt;/p&gt;&#xA;" OwnerUserId="7282" LastEditorUserId="7282" LastEditDate="2013-12-18T23:42:10.100" LastActivityDate="2013-12-19T00:10:19.720" Title="Is &quot;early vision&quot; chronological or process" Tags="|image-processing|computer-vision|terminology|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13260" PostTypeId="2" ParentId="13259" CreationDate="2013-12-19T00:10:19.720" Score="2" Body="&lt;p&gt;I'm pretty sure it means early as in the sorts of things that happen in the first steps of the visual cortex. So things like basic segmentation and shape detection and motion analysis would be early but not higher level reasoning like object recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cs.duke.edu/~tomasi/papers/tomasi/tomasiEcs00.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.duke.edu/~tomasi/papers/tomasi/tomasiEcs00.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-19T00:10:19.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13261" PostTypeId="1" AcceptedAnswerId="13262" CreationDate="2013-12-19T02:01:54.863" Score="5" ViewCount="749" Body="&lt;p&gt;I understand FIR &amp;amp; IIR digital filters are often implemented in fixed point DSP hardware. I have also seen them implemented in software. Do companies make special purpose digital filtering chips that use floating point precision (float) and (double)? When fixed point hardware is used, what are the choices for the bits of precision?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2014-06-27T11:28:36.433" Title="How many bits of precision are often used in fixed point DSP?" Tags="|filters|hardware-implementation|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13262" PostTypeId="2" ParentId="13261" CreationDate="2013-12-19T02:32:43.900" Score="7" Body="&lt;p&gt;Almost all such programming is done in C, which means that 16 bits (shorts) and 32 bits (ints) make sense.  I doubt it will surprise you that most chips support those bit widths, with 16 bits being a particular favorite because it is wide enough to be useful and narrow enough to be power efficient, small, and fast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that there are a few chips that operate on 12 bits, but that is much rarer than the 16 bit chips.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2013-12-19T02:32:43.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13263" PostTypeId="2" ParentId="13232" CreationDate="2013-12-19T02:44:11.313" Score="2" Body="&lt;p&gt;FFT error analysis is a well-studied field with a significant literature.  For a radix-2 Decimation-in-Time (DIT) butterfly, bit growth per stage can be 2.4142..., and for a Decimation-in-Frequency (DIF) stage it can be 2.8284... .  Other factors are related to: matter of rounding (eg: round up, round down, round to nearest, truncate, etc.), hardware considerations (number of guard bits, overflow/underflow detection/correction, etc.), algorithm type, number representation, etc., etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the maximum numbers from a butterfly can be determined by inspection, significant analytical work has also been done in expressing average errors, error variance, etc., subject to the conditions mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's other info available, such as: &lt;a href=&quot;https://groups.google.com/forum/#!msg/comp.dsp/c5c9DKYE1Qw/8SNY4gRqqBcJ&quot; rel=&quot;nofollow&quot;&gt;https://groups.google.com/forum/#!msg/comp.dsp/c5c9DKYE1Qw/8SNY4gRqqBcJ&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2013-12-19T02:44:11.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13264" PostTypeId="1" AcceptedAnswerId="13273" CreationDate="2013-12-19T04:56:47.697" Score="2" ViewCount="2283" Body="&lt;p&gt;When using Butterworth filter in MATLAB, if I chose an order too high, sometimes the filtered signal would grow without bound to infinity, and if I decrease the order, the problem disappears, has anyone encountered the same problem, and why?&lt;/p&gt;&#xA;" OwnerUserId="5694" LastActivityDate="2013-12-19T15:04:09.240" Title="Why do butterworth filter sometimes make signals diverge?" Tags="|filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13266" PostTypeId="1" CreationDate="2013-12-19T05:28:14.300" Score="0" ViewCount="546" Body="&lt;p&gt;I have a mic having sensitivity chart as below which has relative dB on y-axis showing &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1V/0.1Pa&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;what does this convey how to read my mic's sensitivity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a document on microphone sensitivity from &lt;a href=&quot;http://www.analog.com/library/analogdialogue/archives/46-05/understanding_microphone_sensitivity.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;analog&lt;/a&gt; says the microphone sensitivity is measure with 1Pa pressure as reference &lt;/p&gt;&#xA;&#xA;&lt;p&gt;confused in half way after seeing my datasheet of mic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/29U5V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;usually i was of the opinion that the microphone sensitivity is measure with reference to 20micropascals,but i read with this SPL measurements&#xA;so i am wrong &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if i have to buy an SPL i have to correlate my SPL with the microphone i am using &lt;/p&gt;&#xA;&#xA;&lt;p&gt;because if my microphone i am using in my application picks up some sound according to its sensitivity and the spl meter i am purchasing may not give me the required SPL level that i have detected&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when i have seen the frequency Weighting curves of the SPL meter they are shown as below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fOZn3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what do these convey ? are they trying to attenuate some frequencies or they are trying to follow human auditory model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if i have to buy an SPL meter having correlative sensitivity as of my microphone would be better,what is your opinion am i going the right way in selection of an SPL &lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="4513" LastEditDate="2013-12-20T10:12:33.777" LastActivityDate="2020-09-21T05:42:12.420" Title="How to decipher this Microphone sensitivity Chart for Choosing a SPL meter" Tags="|filters|frequency|sound|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13267" PostTypeId="1" CreationDate="2013-12-19T09:32:09.263" Score="4" ViewCount="4158" Body="&lt;p&gt;The ripples in the amplitude spectrum of a linear spectrum is undesirable. I desire to obtain a flat spectrum response. Hence, how can I remove these ripples? Also, which factors (like time bandwidth product, chirp rate) are affecting the ripples, and how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I designed a chirp with a frequency from 10 to 90&amp;nbsp;Hz in &lt;a href=&quot;http://en.wikipedia.org/wiki/MATLAB&quot; rel=&quot;nofollow&quot;&gt;MATLAB&lt;/a&gt;. However, I obtained &lt;a href=&quot;https://en.wikipedia.org/wiki/Chirp#Reduction_of_spectral_ripple&quot; rel=&quot;nofollow&quot;&gt;Fresnel ripples&lt;/a&gt; (which normally occurs) in the passband, along with overshoots at the band edges. I need to study the application of chirps on a material and use it for defect analysis. For this, I need to optimize the whole energy applied to the chirp. Hence, I want to get rid of these ripples. So, what parameters like chirp rate and time of sweep will affect the system?&lt;/p&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="207" LastEditDate="2014-08-14T18:08:12.390" LastActivityDate="2019-04-29T18:04:19.723" Title="Why do we get ripples in the frequency spectrum of a chirp, and how do I remove it?" Tags="|frequency-spectrum|signal-analysis|spectrogram|" AnswerCount="3" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="13269" PostTypeId="1" CreationDate="2013-12-19T10:00:06.430" Score="3" ViewCount="479" Body="&lt;p&gt;To be correct I want to determine variance of white noise before integration (brown noise is white noise after integration). For example, I have a following model (in MATLAB) of noises acting on my sensor:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eiE6I.jpg&quot; alt=&quot;noise model&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I determine variance (power) of 'white noise 2' from samples (total noise)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course noises are band-limited. I have to take into account following noise model of my sensor in my project but I got stuck on this.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\tilde \omega(t)&amp;amp;=\omega(t)+\beta (t)+\eta_v (t)\\&#xA;\dot \beta(t)&amp;amp;=\eta_u(t)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can I use power spectral density or Allan variance plot for this (how)? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7330" LastEditorUserId="1629" LastEditDate="2016-05-19T07:43:15.887" LastActivityDate="2016-05-20T11:44:21.900" Title="How to determine brown noise variance from samples?" Tags="|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13271" PostTypeId="1" AcceptedAnswerId="13274" CreationDate="2013-12-19T11:07:15.610" Score="-1" ViewCount="1519" Body="&lt;p&gt;What does the squared magnitude of the DFT coeffiecient tell me,&#xA;where do I use it? &#xA;what does it define?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|X(k)^2| = ???$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious to  know  because the Amplitude is given by the formula $A_k = \sqrt{|X(k)|}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it cannot be the amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would help me alot if anyone could help me.&lt;/p&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="7277" LastEditDate="2013-12-19T12:12:15.780" LastActivityDate="2013-12-19T21:08:55.687" Title="Squared dft Coefficient defines?" Tags="|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13272" PostTypeId="1" CreationDate="2013-12-19T11:12:01.947" Score="0" ViewCount="957" Body="&lt;p&gt;I have solved the problem of &lt;a href=&quot;https://dsp.stackexchange.com/questions/13247/fir-filter-designing-in-matlab1&quot;&gt;finding the filter's order&lt;/a&gt;. The order, $N$ is 144 (N= 4/Normalized of BW).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the $F_s$(sampling frequency) is 7200Hz, $f_p$(pass-band edge frequency) is 500Hz and $f_s$(stop-band edge frequency) is 700Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I want to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create an ideal impulse response i.e, sinc function and then &lt;/li&gt;&#xA;&lt;li&gt;Apply a Blackman window function to calculate my filter's coefficients.                                         &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am designing the filter in Matlab and I am having difficulty with those two tasks.&lt;/p&gt;&#xA;" OwnerUserId="7303" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2013-12-23T18:53:24.810" Title="Impulse response for FIR filter design" Tags="|matlab|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13273" PostTypeId="2" ParentId="13264" CreationDate="2013-12-19T14:01:12.247" Score="6" Body="&lt;p&gt;Basically, this is bound to happen with higher order filters and finite precision. The filters' poles are getting closer and closer to the unit circle for sharper transition bands. But poles very close to the unit circle lead to unstable filters for some level of precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things you could do:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Increase the precision of your numeric type (e.g. double instead of single precision)&lt;/li&gt;&#xA;&lt;li&gt;Factor the filter into a series of 2nd order sections&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Matlab and Octave allow you to directly compute the poles (p), zeros (z) and the overall gain (g) instead of the filter coefficients b and a:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[z,p,g] = butter(...);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the result can be converted to a SOS matrix (second order sections):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[sos,g] = zp2sos(z,p,g);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each row in the &lt;code&gt;sos&lt;/code&gt; matrix represents a biquad, a 2nd order IIR filter. Using this second order section factorization -- meaning: a couple of 2nd order IIR filter in series -- is less subspectible to rounding errors as far as I know. Actual filtering can be done with &lt;code&gt;sosfilt&lt;/code&gt; instead of &lt;code&gt;filter&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = sosfilt(sos,x)*g;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And if you still have trouble getting it stable, you should probably replace &lt;code&gt;butter&lt;/code&gt; with &lt;code&gt;ellip&lt;/code&gt; and allow a bit of passband ripple and/or do multiple passes of the same lower order filter.&lt;/p&gt;&#xA;" OwnerUserId="1961" LastEditorUserId="1961" LastEditDate="2013-12-19T15:04:09.240" LastActivityDate="2013-12-19T15:04:09.240" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13274" PostTypeId="2" ParentId="13271" CreationDate="2013-12-19T14:03:30.947" Score="3" Body="&lt;p&gt;The sum (or integral) of the magnitude squared of a signal gives the signal &lt;em&gt;energy&lt;/em&gt;. &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's Theorem&lt;/a&gt; tells us that the sum (or integral) of a function's magnitude squared is equal to the sum (or integral) of its Fourier transform's magnitude squared. In the case of the DFT the relation is:&#xA;$$&#xA;\sum_{n=0}^{N-1} | x[n] |^2  =   \frac{1}{N} \sum_{k=0}^{N-1} | X[k] |^2&#xA;$$&#xA; Therefore, if you square the magnitude of all the bins of the DFT and add them up, it is another way to find the signal's energy (Multiplied by the number of elements in the signal). So the magnitude squared of any individual bin gives you a value proportional to the signal energy &lt;em&gt;at that particular frequency&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7319" LastEditorUserId="7319" LastEditDate="2013-12-19T21:08:55.687" LastActivityDate="2013-12-19T21:08:55.687" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="13275" PostTypeId="1" AcceptedAnswerId="13276" CreationDate="2013-12-19T15:25:26.213" Score="4" ViewCount="1738" Body="&lt;p&gt;I am very new to Fourier analysis, but I understand that through the use of the Fourier transform a signal in the time domain is displayed in the frequency domain, where frequency values are normally displayed along the x-axis, and amplitude is displayed along the y-axis.  However, at one point in the textbook I am using, the following is stated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume that we have the function $f(t) = \cos(\omega_0 t)$.  The spectrum then consists of two delta-functions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega) = \pi \delta(\omega - \omega_0) + \pi \delta(\omega + \omega_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;__&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This confuses me.  When we have $f(t) = \cos(\omega_0 t)$, then I would assume that the Fourier transform should yield an amplitude of $1$ at $\omega = \omega_0$ and $0$ elsewhere. But the delta function is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\delta(\omega - \omega_0) = \left\{ \begin{array}{1 1} \infty &amp;amp; \quad \omega = \omega_0 \\ 0 &amp;amp; \quad \omega \neq \omega_0 \end{array} \right.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So wouldn't this give an infinite value at $\omega = \omega_0$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can explain the intuition behind the statement in my textbook, then I would be very grateful!&lt;/p&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2013-12-19T15:34:43.157" Title="Fourier Transform and Delta Function" Tags="|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13276" PostTypeId="2" ParentId="13275" CreationDate="2013-12-19T15:34:43.157" Score="3" Body="&lt;p&gt;The textbook is right. A sine wave in the time domain has infinite energy since it continues over an infinite amount of time. When you transform into the Frequency domain all this energy is concentrated on a single (or two) frequency. Hence the value there is indeed infinite. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course these are all theoretical considerations. In the real world, ideal sine waves do not exist since they all have a beginning and an end.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-19T15:34:43.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13277" PostTypeId="2" ParentId="12893" CreationDate="2013-12-19T18:48:04.007" Score="0" Body="&lt;p&gt;I think you should try some stable segmentation technique like mean shift segmentation or watershed transform. The codes are available both in Open CV and Matlab.&lt;/p&gt;&#xA;" OwnerUserId="5767" LastActivityDate="2013-12-19T18:48:04.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13278" PostTypeId="2" ParentId="13267" CreationDate="2013-12-19T19:57:07.567" Score="1" Body="&lt;p&gt;Depends on your application constraints. Easiest way would be the following&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create chirp in the time domain&lt;/li&gt;&#xA;&lt;li&gt;Fourier Transform&lt;/li&gt;&#xA;&lt;li&gt;Set the spectrum amplitude to what you want it to be&lt;/li&gt;&#xA;&lt;li&gt;Inverse Fourier Transform&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This produces a chirp-like time domain signal that has the exact frequency spectrum that you want&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-19T19:57:07.567" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13279" PostTypeId="2" ParentId="13266" CreationDate="2013-12-19T20:14:12.333" Score="2" Body="&lt;p&gt;Microphones are typically specified in dB re 1 V/Pa. So am microphone with a sensitivity -44 dB (like this one &lt;a href=&quot;http://www.panasonic.com/industrial/electronic-components/parametric-search.aspx?src=/www-cgi/jvcr13pz.cgi?E%2BSS%2B2%2BABA5010%2B0%2B4%2BAM&quot; rel=&quot;nofollow&quot;&gt;http://www.panasonic.com/industrial/electronic-components/parametric-search.aspx?src=/www-cgi/jvcr13pz.cgi?E%2BSS%2B2%2BABA5010%2B0%2B4%2BAM&lt;/a&gt;) would produce 6.3mV RMS at 1 Pa of sound pressure. 1 Pa also corresponds to 94 dBSPL. So you can easily convert dB SPL in dB Pa by subtracting 94.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The datasheet for our microphone looks strange. I have never seen unit of 1.0V/0.1Pa before. This is potentially a print error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weighting curves do indeed mimic the frequency response of the human auditory system at different overall levels. However they are all 0 dB at 1 kHz, so if you calibrate at 1 kHz the weighting doesn't matter. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-19T20:14:12.333" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13280" PostTypeId="2" ParentId="13261" CreationDate="2013-12-19T20:20:09.387" Score="7" Body="&lt;p&gt;Most higher-end DSP chips have single-cycle multiply floating point hardware. Examples are Analog Devices Sharc or Texas Instruments C6X. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Audio processing is an interesting case for fixed point. 32-bit is overkill, while 16-bit is really not enough for processing. 24-bit is therefore a good choice, and the Motorola (Freescale) 56k processors operate in 24-bit fixed point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some fixed point processors have different word sizes for different purposes. Accumulators often have wider word width (I have seen 48, 56, 64 and 80 bits). There is an automotive chip that uses 14 bits for coefficients and 18 bits for data.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="29" LastEditDate="2014-06-26T17:45:24.607" LastActivityDate="2014-06-26T17:45:24.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13281" PostTypeId="1" CreationDate="2013-12-19T21:01:56.880" Score="1" ViewCount="323" Body="&lt;p&gt;I have ordered a USRP kit to do radio signal processing in software. Is there a way to use the same device to process sonar data? What would I do upconvert the sonar to 50 MHz?&lt;/p&gt;&#xA;" OwnerUserId="4731" LastEditorUserId="13320" LastEditDate="2016-08-13T13:03:35.063" LastActivityDate="2016-08-13T13:03:35.063" Title="Use of USRP SDR to process sonar?" Tags="|signal-analysis|software-implementation|sonar|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13282" PostTypeId="2" ParentId="13122" CreationDate="2013-12-19T23:33:23.653" Score="0" Body="&lt;p&gt;I think the question is not related to the tensor fields. There is a growing area in signal processing, namely tensor factorizations. Here tensor is simply a multiway array - generalization of the matrix. So, yes, a video is a tensor with dimensions $m\times n \times T$ here $T$ is a frame count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tensor related methods are not restricted to the video processing because in many data analysis problems, data comes in tensor form, for instance think of a tensor encodes the relations between $user \times user \times product$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see an audio processing application of the tensor factorization from &lt;a href=&quot;http://www.cmpe.boun.edu.tr/~cemgil/papers/simsekli-yilmaz-cemgil-icassp2012.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastActivityDate="2013-12-19T23:33:23.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13283" PostTypeId="1" CreationDate="2013-12-20T05:10:54.447" Score="1" ViewCount="182" Body="&lt;p&gt;my guide has told me to get familiarized with state estimates and kalman filter ....the problem is that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I am totally new to this topic and finding it really difficult to understand due to lack of materials. so, can someone give some suggestions on how to proceed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I am also suppose to incorporate delayed data into kalman filter equations. help is needed on this aspect also&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all these have to be implemented on MATLAB..&lt;/p&gt;&#xA;" OwnerUserId="7334" LastEditorUserId="7334" LastEditDate="2013-12-20T16:28:38.700" LastActivityDate="2013-12-20T16:28:38.700" Title="Incorporating delayed data in Kalman filter" Tags="|matlab|discrete-signals|kalman-filters|estimation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13284" PostTypeId="2" ParentId="10879" CreationDate="2013-12-20T07:27:12.597" Score="1" Body="&lt;p&gt;this is due to the fact that the default boundary handling is symmetric extension, which requires several coefficients more in order to achieve the perfect reconstruction. Try&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;dwtmode('per')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to use periodization to set the representation to be non-redundant. This will however be non-redundant only for input signal lengths being integer multiples of 2^J, where J is number of wavedec levels. Otherwise, very strange padding is used in every step of the wavedec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.: Sorry for the late answer :)&lt;/p&gt;&#xA;" OwnerUserId="5222" LastActivityDate="2013-12-20T07:27:12.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13285" PostTypeId="1" AcceptedAnswerId="13290" CreationDate="2013-12-20T07:33:59.017" Score="3" ViewCount="2229" Body="&lt;p&gt;I'm creating a program for localizing types of barcodes.&#xA;(I know plenty exist, that's not the question :) )&#xA;I'm focusing for the time being on 1D barcodes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difficulty I have is that the barcodes I need to be able to locate could be situated anywhere within an image with other information (text/images/...), inequal lighting conditions (-&gt; gradients), and barcodes could be scaled and orientated in any way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Edit] Unlike most barcode-related cases however, my application does not need to be run on a smartphone, so can allow myself some processing bandwidth&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been researching as much as possible in books and publications, but think it's time to ask the experts...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the most appropriate approach for reliably localising 1D barcodes in difficult environments?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm applying otsu thresholding, basic edge detection and hough transforms.&#xA;Problems i currently face:&lt;br&gt;&#xA;- otsu thresholding is global and doesn't handle local gradients on large images well. are there localized algorithms that exist?&lt;br&gt;&#xA;- hough locates the lines of the barcodes, but also other items (in particular text), and it's difficult to filter only the barcodes (thresholding the min number of pixels in the line throws out a lot, but also throws out the smaller barcodes)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering about Fourier and Gabor filters, but they seem more complex, so want opinions before i start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I am doing everything in Octave and Java&lt;/p&gt;&#xA;" OwnerUserId="7335" LastEditorUserId="7335" LastEditDate="2014-01-06T14:26:08.410" LastActivityDate="2015-07-05T21:43:10.830" Title="Barcode localization in difficult environments" Tags="|image-processing|filters|computer-vision|algorithms|image-segmentation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13286" PostTypeId="2" ParentId="12758" CreationDate="2013-12-20T10:26:22.163" Score="3" Body="&lt;p&gt;you can also find speech corpus from here &lt;/p&gt;&#xA;&#xA;&lt;p&gt;English:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.americannationalcorpus.org/&quot; rel=&quot;nofollow&quot;&gt;American National Corpus Open to All&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.repository.voxforge1.org/downloads/SpeechCorpus/Trunk/Audio/Main/8kHz_16bit/&quot; rel=&quot;nofollow&quot;&gt;Huge Corpus from Vox Forge Repository &lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indian Local:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://tdil-dc.in/index.php?option=com_up-download&amp;amp;task=view-download-tool&amp;amp;view=GET&amp;amp;toolid=268&quot; rel=&quot;nofollow&quot;&gt;Hindi Language Corpus&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cse.iitkgp.ac.in/~pabitra/shruti_corpus.html&quot; rel=&quot;nofollow&quot;&gt;Bengali Corpus&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ldcil.org/&quot; rel=&quot;nofollow&quot;&gt;Speeches from Indian Language Consortium&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4513" LastActivityDate="2013-12-20T10:26:22.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13288" PostTypeId="1" CreationDate="2013-12-20T11:34:59.843" Score="3" ViewCount="1936" Body="&lt;p&gt;I'm trying to implement some code for watermarking on audio based on a scientific paper. I'm stuck in the part of the pseudo code where they calculate the fourth order cumulant of the approximation coefficients of DWT. I have no idea what a cumulant is even when I tried to understand the theory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the following MATLAB code in this &lt;a href=&quot;http://es.scribd.com/doc/51207656/20/Cumulants&quot; rel=&quot;nofollow&quot;&gt;book&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Cum4 = mean(P.^4) - 4*mean(P)*mean(P.^3) - 3*mean(P.^2)^2 +12*mean(P)^2*mean(P.^2)- 6*mean(P)^4;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which outputs a single value, meaning the 4th cumulant. However the paper is expecting more than one value (at least that is what I understand). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This the part I don't get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For each AHC, calculate is fourth-order cumulant, denoted as Ci(k)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C_{i(k)} = \left \{ c_{i(k)}(n) | n = 0,...,\frac{L_{f}}{2^{H-1}} \right \}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where AHC are the approximation coefficients of the DWT H level and Lf are the samples where the DWT was applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the calculation for the 4th cumulant correct? Am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope someone can help me, thanks&lt;/p&gt;&#xA;" OwnerUserId="4222" LastEditorUserId="4222" LastEditDate="2013-12-20T11:42:02.573" LastActivityDate="2017-06-13T17:49:03.103" Title="4th order cumulant of signal" Tags="|discrete-signals|estimation|statistics|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13289" PostTypeId="1" CreationDate="2013-12-20T12:37:42.187" Score="2" ViewCount="948" Body="&lt;p&gt;I have a corpus of several thousand sounds. Now I pick a sound sample &lt;strong&gt;S&lt;/strong&gt;, and I want to find in my corpus the sound &lt;strong&gt;S'&lt;/strong&gt; that is the most similar to &lt;strong&gt;S&lt;/strong&gt;.&#xA;The application is for music, for a composition that I am working on :) I found a lot of questions which are all related to speech recognition. The problem here is different as &lt;strong&gt;rhythm&lt;/strong&gt; is the most important info for me, even before timbre. If &lt;strong&gt;S'&lt;/strong&gt; has a different length than &lt;strong&gt;S&lt;/strong&gt;, it must be somewhat of stretched version of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The samples are between 0.5 seconds to 2 seconds (approximately). I have tried to compute &lt;strong&gt;MFCCs&lt;/strong&gt;, apply &lt;strong&gt;DTW&lt;/strong&gt;, but I don't get convincing results. I still believe MFCCs are the way to go, however I started to think DTW is not suited for my purpose, because it removes the rhythm information. For example (and if I understood well), DTW would recognize that the sounds &lt;code&gt;&quot;Puuuum pum tchak&quot;&lt;/code&gt; and &lt;code&gt;&quot;Pum pum tchaaaak&quot;&lt;/code&gt; are the same. But obviously, when it comes to music, they are not, as the timing is crucial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how to compare 2 matrices of MFCCs, keeping the time information? Or is my approach completely wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was currently looking into procrustes analysis, as I have read that it compares 2 shapes, removing scaling, ... and this sounded good to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With DTW I might have :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;distance(&quot;Pum pum tchak&quot;, &quot;Pum pum tchaaaak&quot;) &amp;lt; distance(&quot;Pum pum tchak&quot;, &quot;Puuum puuum tchaaak&quot;)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in other words, the time wraping doesn't care about the fact that &lt;code&gt;&quot;Puuum puuum tchaaak&quot;&lt;/code&gt; is just exactly the same as &lt;code&gt;&quot;Pum pum tchak&quot;&lt;/code&gt; but with slower tempo.&lt;/p&gt;&#xA;" OwnerUserId="1169" LastEditorUserId="1169" LastEditDate="2013-12-20T17:26:57.503" LastActivityDate="2014-03-20T18:43:14.007" Title="How to compare 2 matrices of MFCCs, keeping the time information" Tags="|audio|sound|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13290" PostTypeId="2" ParentId="13285" CreationDate="2013-12-20T12:42:22.243" Score="5" Body="&lt;p&gt;Other than commercial barcode reading algorithms (many of which fail to read challenging codes), I would like to direct you to this paper which is one of the best academic works in that field in my opinion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.soe.ucsc.edu/~orazio/papers/GalloWACV09.pdf&quot; rel=&quot;nofollow&quot;&gt;Gallo, Manduchi: Reading Challenging Barcodes with Cameras&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a more recent version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.soe.ucsc.edu/~manduchi/papers/barcodes.pdf&quot; rel=&quot;nofollow&quot;&gt;Gallo, Manduchi: Reading 1D Barcodes with Mobile Phones Using Deformable Templates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Judging by the performance they present it can decode really deformed and low quality barcodes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the localization stage, you will require a robust and fast decoding algorithm. Here is one very strong algorithm from Simsekli and Birdal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.tbirdal.me/downloads/tolga_birdal_icassp_2015.pdf&quot; rel=&quot;nofollow&quot;&gt;Simsekli, Birdal: A Unified Probabilistic Framework for Robust Decoding of Linear Barcodes&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-06-18T18:15:30.750" LastActivityDate="2015-06-18T18:15:30.750" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13291" PostTypeId="2" ParentId="13289" CreationDate="2013-12-20T13:59:56.417" Score="2" Body="&lt;p&gt;You are misunderstanding how DTW works. You can actually adjust the frame deletion/insertion costs to adjust how much temporal mismatch you can tolerate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would have: DTW(&quot;Puuuum pum tchak&quot;, &quot;Puuum pum tchak&quot;) &amp;lt; DTW(&quot;Puuuum pum tchak&quot;, &quot;Pum pum tchk&quot;) &amp;lt; DTW(&quot;Puuuum pum tchak&quot;, &quot;Purr purr purr&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is to say, if there is a sample with a perfectly good timing, it'll always yield a higher DTW score than a sample with the wrong timing. The trade-off between similar timbre and similar timing can be adjusted by tweaking the DTW alignment costs. One useful thing with DTW is that it finds the optimal alignment between the &quot;query&quot; and the found sample - so you can use the path it founds to timestretch/phase-vocode the result and align it perfectly with the query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not clear what kind of sensitivity on timing your application has; which features matter the most (overall timbre? onomatopoeia which is pronounced?); and what kind of processing you could do to the found clips to align them even better with the query. If rhythm/timing is absolutely essential, you might want to process each sample by an onset detector ; and restrict your search to the set of clips which have the right number of onsets, and the correct inter-onset times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have absolutely no tolerance on differences in rhythm, then you could very well compute the average of pairwise distances between the two clips (padded with zeros if their length does not match). That would be a bit silly, but your application might want that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if both your query and your samples can accept the same domain-specific representation (say a beatboxed rhythm and a drum loop can both be transcribed into &quot;bass drum&quot; and &quot;snare drum&quot; events) - it might help to transcribe all clips and to match the transcriptions instead of the audio signals.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2013-12-20T17:52:31.027" LastActivityDate="2013-12-20T17:52:31.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13292" PostTypeId="2" ParentId="11320" CreationDate="2013-12-20T14:05:32.247" Score="6" Body="&lt;p&gt;At the end what has proven to be the best solution was onset detection based on either high frequency or energy content. Before it could work I had to use high-pass filter to cut out first 1 kHz, since it contained too much noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I had noise-only area I could use its profile to reduce noise from rest of the sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One library I found particularly useful was &lt;a href=&quot;http://aubio.org/%20Aubio&quot; rel=&quot;noreferrer&quot;&gt;Aubio&lt;/a&gt;. It has a good set of examples and provides a lot of algorithms to choose from for onset detection.&lt;/p&gt;&#xA;" OwnerUserId="5785" LastActivityDate="2013-12-20T14:05:32.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13293" PostTypeId="2" ParentId="13100" CreationDate="2013-12-20T14:08:30.393" Score="1" Body="&lt;p&gt;Hough transform is an edge based operation. For this reason, if you could extract the edges of the outer boundary (together with many noisy pixels) and adjust the radius parameter of the Hough transform, you will be finding the circle of the iris, but not anywhere else. You might want to check:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[centers,radii] = imfindcircles(A,radiusRange)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;radiusRange&lt;/code&gt; is the parameter you should get right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, sometimes for some noisy images, Circular Hough Transform might not be the solution. In such cases you might try Hough ellipses or other methods for locating geometric primitives.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="80" LastEditDate="2013-12-20T14:14:16.457" LastActivityDate="2013-12-20T14:14:16.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13296" PostTypeId="2" ParentId="13204" CreationDate="2013-12-21T04:24:54.417" Score="3" Body="&lt;p&gt;okay, this is, or can be, stuff straight outa a textbook. by &quot;SOS&quot;, you mean &quot;2nd-order sections&quot;? i usually call those &quot;biquads&quot;.  maybe that's not the best term for it in the s-plane.  i dunno.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;anyway, defending on your passband ripple, you should have the resonant frequency and Q for each LPF biquad.  you can use those two parameters and get digital biquads directly out of that using the Audio EQ Cookbook.  google will find it fast for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;otherwise convert your Tchebyshev from s-plane to z-plane however you want.  the Cookbook uses the bilinear transform, which means every bump or feature in the analog frequency response will have a corresponding bump or feature in the digital frequency response.  if you're more interested in matching the impulse response, you would transform H(s) -&gt; H(z) using the Impulse Invariant method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;someone will probably vote me down for not answering the question completely (they've done it in the past).  big deel.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-21T04:24:54.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13297" PostTypeId="2" ParentId="6251" CreationDate="2013-12-21T07:00:38.147" Score="0" Body="&lt;p&gt;If you want to trace color then as starting you could use color matching using minimun color difference. Morever, i will suggest you to convert your image into LAB color space because it is uniform and will surely give you better results than that using RGB space&lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2013-12-21T07:00:38.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13298" PostTypeId="1" CreationDate="2013-12-21T11:37:54.073" Score="1" ViewCount="1039" Body="&lt;p&gt;Can anybody tell me the advantages of the lifting scheme and why it is better then a normal filter bank?&lt;/p&gt;&#xA;" OwnerUserId="7344" LastEditorUserId="1606" LastEditDate="2013-12-21T14:33:24.523" LastActivityDate="2016-06-22T20:40:52.950" Title="What are the main advantages and disadvantages of the lifting scheme?" Tags="|wavelet|filter-bank|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13299" PostTypeId="1" CreationDate="2013-12-21T15:37:56.493" Score="0" ViewCount="1499" Body="&lt;p&gt;I have a sin wave of 16Hz, sampled at 2048 samples persecond. I performed the FFT of the sequence and did a spectrum plot. My plot gave me two spikes at both ends of the graph. But i was told the spike is meant to be at 16. how exactly am i supposed to do the plotting in order to get this exact spike?&lt;/p&gt;&#xA;" OwnerUserId="7278" LastActivityDate="2014-01-21T17:18:07.607" Title="position of spike in the spectrum of a sin wave" Tags="|fft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13301" PostTypeId="2" ParentId="13254" CreationDate="2013-12-21T17:01:39.927" Score="1" Body="&lt;p&gt;You cannot capture a 5 MHz signal by sampling at 48 kHz. That doesn't mean there won't be anything in your sample, it means it will represent the signal incorrectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens if you use a too small sampling frequency is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow noreferrer&quot;&gt;aliasing&lt;/a&gt;: the original frequency shows up as another frequency altogether. The translation from the real to the sampled frequency is like a process of wrapping or folding the infinite frequency axis into your limited frequency interval $[0 ; \frac12 f_s]$, or $[-\frac12 f_s ; \frac12 f_s]$ for complex-valued signals. $\frac12 f_s$ is also called Nyquist frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, not just the main frequency but the total bandwidth of the signal of 800 kHz is much larger than the sampling frequency. Because of this, I wouldn't expect any clearly defined peak to be present. Since you seem to find peaks, my guess is that that is due to your very primitive approach to &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_density_estimation&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral estimation&lt;/a&gt;. If you use a better method, e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Welch%27s_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;Welch's modified periodogram&lt;/a&gt;, which is implemented in Matlab as &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/pwelch.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;pwelch&lt;/code&gt;&lt;/a&gt;, I'd expect that you see a very flat (white) spectrum.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Addition based on nimrodm's comment: My initial statement has to be relativized if the bandwidth of the signal is smaller than $\frac12 f_s$. In that case, &lt;em&gt;if there is additional knowledge about the true signal frequency&lt;/em&gt;, this knowledge can be used to resolve the ambiguity introduced by aliasing, and perfect reconstruction of the true signal is possible. See &lt;a href=&quot;https://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;undersampling&lt;/a&gt;. However, it is not possible to determine the true frequency from the undersampled signal and nothing else.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A simulated example: Matlab code to generate a frequency-modulated signal with peak at 5 MHz and bandwidth 400 kHz, initially sampled at 24 MHz.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% signal properties&#xA;f0 = 5e6;               % frequency 5 MHz&#xA;sf = 0.4e6;             % bandwidth 400 kHz&#xA;&#xA;% sample properties&#xA;fs = 24e6;              % sampling frequency 24 MHz&#xA;N = 10e6;               % number of samples&#xA;&#xA;% generate random frequency modulated sinusoidal signal&#xA;fi = smooth(randn(N, 1), 11);&#xA;fi = fi / std(fi) * sf + f0;&#xA;x = cos(2 * pi * cumsum(fi) / fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Estimating the spectrum using &lt;code&gt;pwelch&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% estimate spectrum&#xA;[psd, f] = pwelch(x, 512, [], [], fs);&#xA;figure&#xA;plot(f, psd)&#xA;xlabel('f [Hz]')&#xA;ylabel('normalized power spectral density [1/Hz]')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives this result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ko1y0.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal is downsampled to 48 kHz&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% downsample to 48 kHz (factor 500)&#xA;fs = fs / 500;&#xA;x = x(1 :500: end);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the estimated spectrum looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GVMBS.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is, as expected, basically a white (flat) spectrum, and the many small &quot;peaks&quot; are random fluctuations due to the fact that this spectrum was estimated based on only a 500th of the original 10 million samples. The estimate could be improved by repeating the procedure and averaging over the different results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the bandwidth is changed to 4 kHz&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sf = 4e3;               % bandwidth 4 kHz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the results of spectal estimation on original and downsampled signal look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FeMN5.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3k4J3.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The narrower peak fits nicely into the range 0 to 24 kHz of the downsampled spectral estimate, it just necessarily appears at the wrong place, in this case 8 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;8 kHz = 5 MHz – 104 · 48 KHz is the smallest &lt;em&gt;alias&lt;/em&gt; of 5 MHz with respect to a sampling rate of 48 kHz, the next largest is 48 kHz – 8 kHz = 40 kHz (mirroring around the Nyquist frequency of 24 kHz). All the larger aliases derive from these two by adding integer multiples of 48 kHz: 56, 88, 104, 136 kHz up to 4952, 4984, 5000, 5032 kHz and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the spectral estimation cannot distinguish these aliases, the frequency axis of the spectrum plot becomes ambiguous: instead of representing frequency components of the signal from 0 to 24 kHz, it could as well represent frequencies from 48 to 24 kHz (backwards because of the mirroring!),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D5p7y.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or from 48 to 72 kHz, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we know the frequency content of the signal lies around 5 MHz, we can select the corresponding aliased frequency interval, 4992 to 5016 kHz,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/udwIo.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and recover the correct location of the peak at 5 GHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This trick does not work, however, if the bandwidth of the signal is larger than $\frac12 f_s$, because the true frequency content of the signal has been aliased across several of these frequency intervals.&lt;/p&gt;&#xA;" OwnerUserId="5834" LastEditorUserId="5834" LastEditDate="2014-01-03T19:00:57.817" LastActivityDate="2014-01-03T19:00:57.817" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13302" PostTypeId="2" ParentId="13299" CreationDate="2013-12-21T17:08:31.983" Score="0" Body="&lt;p&gt;The second half of your FFT is the conjugate of the first half. Just plot the first half. The frequency resolution is 2048/N where N is the full FFT size.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2013-12-21T17:08:31.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13304" PostTypeId="2" ParentId="12756" CreationDate="2013-12-21T19:04:58.640" Score="1" Body="&lt;p&gt;You have to calculate $H(f)$, the Fourier transform of $h$. Similarly, you have to calculate $X(f)$ which is FT of $x$. Then, recall that, convolution in time domain is multiplication in frequency domain. Using this property, you will get $Y(f)$. Take inverse Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is probably a HW, I will not give further details, the general way is like that. You can manage algebra.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastActivityDate="2013-12-21T19:04:58.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13309" PostTypeId="1" AcceptedAnswerId="13312" CreationDate="2013-12-22T09:23:36.147" Score="0" ViewCount="56" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Md1Ow.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dear all,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please find attached image,&#xA;I am not able to understand why is the underlined term is to be included.&#xA;Shouldn't it be simply the exponential term?&lt;/p&gt;&#xA;" OwnerUserId="7348" LastEditorUserId="7348" LastEditDate="2013-12-22T09:32:36.253" LastActivityDate="2013-12-22T12:30:33.393" Title="Convolution in Continious time" Tags="|convolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13312" PostTypeId="2" ParentId="13309" CreationDate="2013-12-22T12:30:33.393" Score="0" Body="&lt;p&gt;The $u(t-2)$ term needs to be included because the upper limit of the definite integral is $t-2$, not $\infty$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;h(t) &amp;amp;= e^{-(t-2)}u(t-2)\\&#xA;y(t) &amp;amp;= x(t) * h(t)= \int_{-\infty}^{\infty} x(t')h(t-t') dt'\\&#xA; &amp;amp;= \int_{-\infty}^{\infty} x(t')e^{-(t-t'-2)}u(t-t'-2) dt'\\&#xA;u(t-t'-2)&amp;amp;= \begin{cases} 1 &amp;amp; t'&amp;lt;t-2 \\ 0 &amp;amp; \text{otherwise} \end{cases}\\&#xA;y(t) &amp;amp;= \int_{-\infty}^{t-2} x(t')e^{-(t-t'-2)}(1) dt' + \int_{t-2}^{\infty} x(t')e^{-(t-t'-2)} (0) dt'\\&#xA;&amp;amp;= \int_{-\infty}^{t-2} x(t')e^{-(t-t'-2)} dt'.&#xA;\end{align*}&lt;/p&gt;&#xA;" OwnerUserId="7286" LastActivityDate="2013-12-22T12:30:33.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13313" PostTypeId="1" AcceptedAnswerId="13714" CreationDate="2013-12-22T12:53:57.543" Score="0" ViewCount="188" Body="&lt;p&gt;Following this link:&#xA;&lt;a href=&quot;http://software.intel.com/sites/products/documentation/doclib/ipp_sa/80/ipp_manual/GUID-5457048E-3C59-43E4-8A99-FB3873DCB769.htm&quot; rel=&quot;nofollow&quot;&gt;http://software.intel.com/sites/products/documentation/doclib/ipp_sa/80/ipp_manual/GUID-5457048E-3C59-43E4-8A99-FB3873DCB769.htm&lt;/a&gt;&#xA;I have produced the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        const int len = 512;&#xA;        Ipp64f pInputSignal[len];&#xA;&#xA;        int tapslen = 27;&#xA;        int numIters = len;&#xA;&#xA;        IppsFIRState_64f* pState;&#xA;        IppStatus status;&#xA;&#xA;        Ipp64f* pOutputSignal = ippsMalloc_64f(len*sizeof(Ipp64f));&#xA;        Ipp64f* taps = ippsMalloc_64f(tapslen*sizeof(Ipp64f));&#xA;        Ipp64f* pDL = ippsMalloc_64f(tapslen*sizeof(Ipp64f));&#xA;&#xA;        ippsZero_64f(pDL,tapslen);&#xA;        float sample_rate = 48000.0;//Hz //TODO DEFAULT_SAMPLE_RATE&#xA;        float frequency = 400.0;//Hz&#xA;        float amplitude = 2000.0;&#xA;&#xA;        //Fill pInputSignal[t] = 2*pi*frequency*t, where t is time from t[i] = i/sample_rate&#xA;        fillBufferWithSinusoidData_64f(pInputSignal,len,sample_rate,frequency,amplitude);&#xA;&#xA;        //computes tapsLen coefficients for bandstop  FIR filter&#xA;        float rFreqLow  = (frequency-52.0)/(sample_rate);&#xA;        float rFreqHigh = (frequency+51.0)/(sample_rate);&#xA;&#xA;        status = ippsFIRGenBandstop_64f(&#xA;            rFreqLow,&#xA;            rFreqHigh,&#xA;            taps, &#xA;            tapslen, &#xA;            ippWinHamming, &#xA;            ippTrue);&#xA;        Assert::AreEqual((int)IppStatus::ippStsNoErr,(int)status);&#xA;&#xA;        ////filter an input vector&#xA;        status = ippsFIRInitAlloc_64f(&amp;amp;pState, taps,tapslen, pDL);&#xA;        status = ippsFIR_64f(pInputSignal, pOutputSignal, numIters, pState);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In other words: &#xA;Input is a sinusoid at frequency 400Hz&#xA;Band stop between 348.0Hz to 451Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expected output : something flat (as I would expect the sine signal would get filtered out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actual output : Sine wave moves 1/2 phase, magnitude is lowered a bit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas about what went wrong here?&lt;/p&gt;&#xA;" OwnerUserId="5846" LastActivityDate="2014-01-11T07:38:01.940" Title="How to use IPP FIRGenBandStop method?" Tags="|finite-impulse-response|" AnswerCount="1" CommentCount="1" ClosedDate="2014-01-12T18:22:35.710" ContentLicense="CC BY-SA 3.0" />
  <row Id="13316" PostTypeId="1" CreationDate="2013-12-22T15:53:27.733" Score="0" ViewCount="302" Body="&lt;p&gt;Some animals are specially trained to repeat human phrases, others just make sounds that people interpret as speech.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this &lt;a href=&quot;http://www.youtube.com/watch?v=42s5S0s07o8&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt; a rooster seems to say &quot;Cristo Viene&quot; (Christ is coming).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the spectrogram of that rooster to analyze the formant position of the vowels I can't find any matches (I was using a formant position UCLA's chart from  &lt;a href=&quot;http://www.linguistics.ucla.edu/people/hayes/103/Charts/VChart/&quot; rel=&quot;nofollow noreferrer&quot;&gt; here &lt;/a&gt;), because the pitch of the animal is obviously different to formant position of human male or females. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody knows the way to find the formants position at different pitches? (I put the spectrogram of the rooster above)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NJGaA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7316" LastActivityDate="2013-12-22T16:06:15.493" Title="Non human formant frequencies" Tags="|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13317" PostTypeId="2" ParentId="13316" CreationDate="2013-12-22T16:06:15.493" Score="3" Body="&lt;p&gt;I think you have a misunderstanding about formants, pitch and partial tones. The spectrogram shows the position of the partials and you can also estimate their fundamental frequency, or pitch, trajectory to be the position of the lowest partial. The formant structure is not readily recognizable from this representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formants are the resonances of the vocal tract but these resonance frequencies are not necessarily excited because they don't coincide with the partial frequencies that are at integer multiple positions of the fundamental frequency. Rather, the formants &lt;em&gt;shape&lt;/em&gt; the amplitude of the exciting signal, in this case best described by the partials. You can think of the formants as the peaks of the (smooth) envelope that you can draw on a frequency-amplitude diagram showing the amplitudes of the partials.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2013-12-22T16:06:15.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13318" PostTypeId="2" ParentId="11320" CreationDate="2013-12-22T16:34:58.263" Score="0" Body="&lt;p&gt;I don't know much of audio noise reduction but after a quick and dirty noise subtraction from the pass-band filtered (around 1500-3000 hz) I get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dl.dropboxusercontent.com/u/98395391/signal_denoised.wav&quot; rel=&quot;nofollow&quot;&gt;https://dl.dropboxusercontent.com/u/98395391/signal_denoised.wav&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it sounds just a bit better of the filtered and original signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a simple Wiener filter I get very similar results.&lt;/p&gt;&#xA;" OwnerUserId="1884" LastActivityDate="2013-12-22T16:34:58.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13319" PostTypeId="2" ParentId="13299" CreationDate="2013-12-22T16:38:05.543" Score="1" Body="&lt;p&gt;A sinusoid is the sum of two complex exponentials (&quot;negative&quot; and &quot;positive&quot; frequency) so that their imaginary parts cancel out each other:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$cos(f \cdot t) = \frac{1}{2} \left( exp(f \cdot t \cdot i) + exp(-f \cdot t \cdot i) \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier Transform decomposes your input into a weighted sum of complex exponentials. Therefore, you get to see two pulses in the spectrum. One at -f and another at +f, basically. Typically, the &quot;negative half&quot; of the spectrum is located after the positive half because in discrete signals there is no difference between -f Hz and fs-f Hz where fs is the sampling frequency. So, your FFT result's ordering is 0 Hz to almost fs Hz where you can think of the second half as the negative portion of the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since real-valued signals have an imaginary part of zero, you'll notice that the Fourier Transform of real-valued signals always exhibits a symmetry between negative and positive frequencies with a certain kind of phase relationship (same amplitude and negated phase) so that the complex exponentials' imaginary parts cancel between negative and positive frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Complex-valued signals are more general in that their spectra don't have to be symmetric around 0 Hz. The imaginary part helps you distinguish between positive and negative frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$exp(f \cdot t \cdot i) = cos(f \cdot t) + i \cdot sin(f \cdot t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see above, the sign of f does not change the real part. But it does affect the sign of the imaginary part.&lt;/p&gt;&#xA;" OwnerUserId="1961" LastEditorUserId="1961" LastEditDate="2013-12-22T16:46:40.257" LastActivityDate="2013-12-22T16:46:40.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13320" PostTypeId="1" AcceptedAnswerId="13323" CreationDate="2013-12-22T22:13:46.573" Score="1" ViewCount="80" Body="&lt;p&gt;I am an experimental research engineer working on a Laser experiment. The details do not matter but due to practical limitations my data is influenced by the following transformation during data acquisition, and I was wondering if there is a mathematical method or an algorithm to &quot;undo&quot; its effect on the captured signal, that is to get the inverse.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MHwiO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get the y in terms of s.&#xA;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7350" LastActivityDate="2013-12-24T11:09:56.533" Title="Inverse of a summing function" Tags="|filters|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13322" PostTypeId="1" AcceptedAnswerId="13357" CreationDate="2013-12-22T22:53:38.743" Score="3" ViewCount="272" Body="&lt;p&gt;If I have a measured signal $y$, true signal $x$, and a convolution matrix $A$ that is a Toeplitz but not circulant matrix, I can write the convolution as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;y = A x \ .&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to analyze the system using diagonalized coefficients of the Fourier transform. A re-formulation such as the one given below is often used to provide a means for fast computation:&#xA;\begin{equation}&#xA;\left[\begin{array}{c}&#xA;y\\&#xA;y'&#xA;\end{array}\right] = &#xA;C&#xA;\left[\begin{array}{c}&#xA;x\\&#xA;0&#xA;\end{array}\right] = &#xA;\left[\begin{array}{cc}&#xA;A &amp;amp; B \\&#xA;B &amp;amp; A &#xA;\end{array}\right]&#xA;\left[\begin{array}{c}&#xA;x\\&#xA;0&#xA;\end{array}\right] = &#xA;\left[\begin{array}{c}&#xA;A x \\&#xA;B x &#xA;\end{array}\right] \ ,&#xA;\end{equation}&#xA;where $C$ is a circulant matrix into which the Toeplitz matrix $A$ is embedded, using an additional matrix $B$ derived from the values of $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Diagnoalized values of $C$ can be obtained by multiplication with Discrete Fourier Transform matrices. But are these values relevant for interpreting the behavior of the original system, $y = Ax$ - for instance, for use in construction of a Wiener filter for the original system?&lt;/p&gt;&#xA;" OwnerUserId="5362" LastEditorUserId="128" LastEditDate="2019-03-24T05:45:11.767" LastActivityDate="2019-03-24T05:45:11.767" Title="Interpreting FFT Coefficients from System Matrix That Is Originally Toeplitz (Not Circulant)" Tags="|fourier-transform|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13323" PostTypeId="2" ParentId="13320" CreationDate="2013-12-23T00:17:01.317" Score="1" Body="&lt;p&gt;Looks like a convolution. S is the convolution of y with another signal of w+1 consecutive ones. So, S is the result of a moving sum filter. But the moving sum filter completely removes certain frequencies in the signal. For example, if you use w=3 and have the following signal y:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; y: ... 0  1  0 -1  0  1  0 -1  0  1  0  -1 ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then S[i] for any i (the moving sum over 4 neighboring samples) will always be zero, no matter how you shift or scale y. And that makes the problem of recovering y from s something between impossible and hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case your data is finite, it is possible to write your equations as a matrix-vector product and solve it with the usual algorithms. You can ask tools like Matlab or GNU Octave about how noisy the inverse would be. This is something you should check for since the problem is ill-conditioned. Your equations, assuming y and s are finite can be written like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ A \cdot y = s $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, A would contain mostly zeros and w+1 consecutive ones per row, at least for first rows. At the end, you have less ones because y is supposed to be finite. Then, asking for the condition number is a matter of typing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cond(A)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in Matlab or Octave. Example for 6 samples and w=2&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:1&amp;gt; A = toeplitz([1 0 0 0 0 0],[1 1 1 0 0 0])&#xA;A = &#xA;&#xA;   1   1   1   0   0   0&#xA;   0   1   1   1   0   0&#xA;   0   0   1   1   1   0&#xA;   0   0   0   1   1   1&#xA;   0   0   0   0   1   1&#xA;   0   0   0   0   0   1&#xA;&#xA;octave:2&amp;gt; cond(A)&#xA;ans = 7.9053&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's actually test it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:3&amp;gt; y = [1 9 3 2 4 3]';&#xA;octave:4&amp;gt; s = A*y&#xA;s =&#xA;&#xA;   13&#xA;   14&#xA;    9&#xA;    9&#xA;    7&#xA;    3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And now the inversion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:5&amp;gt; y2 = A\s&#xA;y2 =&#xA;&#xA;   1&#xA;   9&#xA;   3&#xA;   2&#xA;   4&#xA;   3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This inversion is actually easy to implement because the matrix exhibits a triangular structure. You can recover y sample by sample starting at the end and moving to the front.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example was free of noise. Keep in mind that the condition number tells you how the relative error in s will be amplified (worst case) if you recover y from s. So, for example, if s contains a relative error of 3%, the recovered y may have a relative error as large as 3% * 7.9053 = 23.716%. Unfortunately, the condition number increases with the number of samples in this case. So, if you have to recover not six but 1000 samples and/or your w parameter is large, you're out of luck because the inversion will amplify the noise in s a lot, too.&lt;/p&gt;&#xA;" OwnerUserId="1961" LastEditorUserId="1961" LastEditDate="2013-12-24T11:09:56.533" LastActivityDate="2013-12-24T11:09:56.533" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13324" PostTypeId="1" AcceptedAnswerId="13326" CreationDate="2013-12-23T09:04:08.360" Score="5" ViewCount="486" Body="&lt;p&gt;When I searched for octave, I listened to the fact that if you take an octave band the lower cutoff is double the upper cutoff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is this name octave coming from, that is, where does the figure eight show its significance in the above statement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same way, if the above is clarified, I have some doubts on 1:2 and 1:3 octaves.&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="1606" LastEditDate="2013-12-23T10:17:01.733" LastActivityDate="2013-12-27T19:02:17.620" Title="What is an octave? It is said to be eight, but I cannot see the eight anywhere" Tags="|filters|frequency|octave|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13325" PostTypeId="1" CreationDate="2013-12-23T09:09:07.623" Score="1" ViewCount="808" Body="&lt;p&gt;My doubt is in regards to the usage of the function &lt;code&gt;cceps&lt;/code&gt; in Matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function is giving me the cepstrum for the entire speech signal of 3 or 4sec. This works well when I play back the signal after taking the inverse (using the&lt;code&gt;icceps&lt;/code&gt; function). However, in order to analyze the given speech signal, we are supposed to only consider 20ms frame. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is taking the complex cepstrum throughout the signal valid? Why is it working out here?&lt;/p&gt;&#xA;" OwnerUserId="7352" LastEditorUserId="76" LastEditDate="2013-12-23T10:16:04.307" LastActivityDate="2018-01-08T03:49:49.333" Title="cceps (complex cepstrum) function in Matlab" Tags="|matlab|signal-analysis|speech-recognition|speech-processing|cepstral-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13326" PostTypeId="2" ParentId="13324" CreationDate="2013-12-23T09:19:38.543" Score="10" Body="&lt;p&gt;This comes from music terminology. The name &quot;octave&quot; comes from the fact that in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Heptatonic_scale&quot;&gt;heptatonic musical scales&lt;/a&gt; (which are the prevalent scales in western music), the note with a 2:1 frequency ratio is the eighth note in the scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the C major scale (C D E F G A B C) the eighth note is one octave above / has a 2:1 frequency ratio with the tonic.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-12-23T09:19:38.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13327" PostTypeId="1" CreationDate="2013-12-23T10:11:31.513" Score="3" ViewCount="4104" Body="&lt;p&gt;I am having some problems understanding how the Fourier transform method is used to determine the FIR filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as i have understood, you start by using the ideal impulse reponse for the specific filter design you want to have.  Those are given in this table&lt;img src=&quot;https://i.stack.imgur.com/pC2lN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the the ideal impulse reponse contains infinite impulses, we truncate the infinite to finite a number by $m$, (which is confusing how this is done).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my question is how do predetermine the order of the filter, without having to try randomly, using this method?&lt;/p&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="15892" LastEditDate="2016-02-13T21:59:51.687" LastActivityDate="2017-07-08T21:33:20.197" Title="FIR filter design by the Fourier transform method" Tags="|fourier-transform|filter-design|finite-impulse-response|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13328" PostTypeId="1" AcceptedAnswerId="13332" CreationDate="2013-12-23T11:08:19.550" Score="5" ViewCount="3437" Body="&lt;p&gt;If we filter out ideal white noise using an ideal LPF of cutoff frequency 10 KHz and then sample it at 30 KHz , is the resulting discrete signal statistically independent? I would like to know the statistical behaviour of the output signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was attending an on-line test. My answer was told wrong.Below is the snapshot from the on-line test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VO6jJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to know what would be the result if sampling frequency is below Nyquist frequency?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="5253" LastEditDate="2013-12-23T14:58:53.477" LastActivityDate="2013-12-23T20:10:35.760" Title="Sampling low pass filtered white noise" Tags="|random|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13329" PostTypeId="2" ParentId="13328" CreationDate="2013-12-23T12:35:13.627" Score="3" Body="&lt;p&gt;If by 'resulting discrete signal statistically independent' you mean whether the samples will be independent, i.e. whether $P(x[1],x[2],\dots,x[N]) = \prod_{i=1}^N P(x[i])$, the answer is in general no, because the filtering will induce correlations between nearby elements: the LPF operation means that values of successive elements can't change arbitrarily quickly, hence not independent.&lt;/p&gt;&#xA;" OwnerUserId="7286" LastActivityDate="2013-12-23T12:35:13.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13332" PostTypeId="2" ParentId="13328" CreationDate="2013-12-23T15:25:29.307" Score="9" Body="&lt;p&gt;The output of your filter is what is sometimes called band-limited white noise. In&#xA;your particular case, the autocorrelation function of the output noise is a sinc&#xA;function whose zeroes are every $100$ microseconds, that is, samples taken at&#xA;the rate of $10^4$ samples/second are uncorrelated.  Your samples at $3\times 10^4$&#xA;samples per second are closer together and thus are &lt;em&gt;correlated&lt;/em&gt;.  In fact,&#xA;the correlation coefficient between successive samples is &#xA;$\displaystyle \frac{\sin(\pi/3)}{\pi/3} = \frac{3\sqrt{3}}{2\pi} \approx 0.827$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note added after question was edited: Samples taken $0.03$ milliseconds apart&#xA;are at a frequency of $33.33\ldots$ kHz, not $30$ kHz as you say in the&#xA;part of the question that you typed in yourself. Regardless, the answer (B) is&#xA;&lt;em&gt;incorrect&lt;/em&gt; and the reasoning given in support of answer (B)&#xA;is bogus. What is being sampled is&#xA;&lt;em&gt;not&lt;/em&gt; white noise but &lt;em&gt;filtered&lt;/em&gt; white noise, and Answer A is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For (B) to be the correct answer,&#xA;the sampling rate must be a &lt;em&gt;sub-multiple&lt;/em&gt; of $10$ kilosamples per second,&#xA;that is the samples must be spaced $100$ microseconds apart&#xA;or an &lt;em&gt;integer&lt;/em&gt; multiple of $100$ microseconds&#xA;apart.  Sampling every $0.3$ milliseconds, that is, every $300$ microseconds &#xA;meets this criterion; sampling every $0.03$ milliseconds does not.&#xA;Now sampling at $10$ kilosamples/second  makes the samples &lt;em&gt;uncorrelated&lt;/em&gt; &#xA;(answer (C)) and to get from this to the &lt;em&gt;stronger&lt;/em&gt; result that&#xA;the samples are &lt;em&gt;statistically independent&lt;/em&gt; (answer (B)), we need&#xA;&lt;em&gt;further&lt;/em&gt; assumptions about the noise. The standard assumption is&#xA;that the noise is Gaussian. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In summary, (B) would be the correct answer&#xA;  if the sampling were done every $0.3$ milliseconds (since the problem&#xA;  statement already includes the assertion that the noise is Gaussian)&#xA;  and (C) would be the correct answer if it did not say that the noise&#xA;  is Gaussian since we could not the make the specialization from&#xA;  uncorrelated to independent.&#xA;  But when the sampling is done every $0.03$ milliseconds, then (A)&#xA;  is the correct answer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2013-12-23T20:10:35.760" LastActivityDate="2013-12-23T20:10:35.760" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13333" PostTypeId="1" AcceptedAnswerId="13362" CreationDate="2013-12-23T15:52:15.350" Score="1" ViewCount="156" Body="&lt;p&gt;I am detecting vehicles from the video (taken with a camera), and the vehicle &lt;em&gt;detection part works fine&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I should &lt;strong&gt;always extract &lt;em&gt;only one representative frame&lt;/em&gt; per vehicle&lt;/strong&gt;, and not the whole sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, if I have a few seconds of video (and possibly multiple vehicles), my approach currently extracts multiple frames (for every vehicle). Instead, as an output I would like &lt;em&gt;one representative frame&lt;/em&gt; in which the &lt;em&gt;vehicle is whole, i.e. well visible&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already implemented an entropy technique on it which makes it better but am still getting too much frames of the same vehicle. Could you suggest a technique which I can use to extract only one frame which contains the whole vehicle and ignore all other frames which contain that (same) vehicle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the following entropy technique in my problem&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double entropy = 0.0;&#xA;for (int i=0; i&amp;lt;histNorm.rows; i++)&#xA;{&#xA;    float binEntry = histNorm.at&amp;lt;float&amp;gt;(i,0);&#xA;    if (binEntry != 0.0)&#xA;        entropy -= binEntry * log2(binEntry);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="5057" LastEditDate="2013-12-27T07:56:50.107" LastActivityDate="2013-12-27T07:56:50.107" Title="How the select the representative frame when detecting vehicles" Tags="|computer-vision|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13334" PostTypeId="2" ParentId="13325" CreationDate="2013-12-23T16:05:27.637" Score="2" Body="&lt;p&gt;You should split the signal up into overlapping chunks of 20 to 30 ms. It is certainly valid to take the complex cepstrum on the 4 second signal. But, since the frequency characteristics of speech are constantly varying the complex cepstrum on the 4 second signal will average all of these together and you won't know what happened when. If you take it in each 20 ms window then you can see how the properties of the signal change over time.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-23T16:05:27.637" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13335" PostTypeId="1" AcceptedAnswerId="13344" CreationDate="2013-12-23T16:29:19.650" Score="2" ViewCount="4807" Body="&lt;p&gt;I have a wav file recorded from a hydrophone. I am not quite familiar with signal processing so I really need some advice from you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have gathered the information which looks useful and related.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sample rate = 250 000 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Receive sensitivity of hydrophone = -180 db re 1V/μ Pa&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak-to-peak voltage range = 5.64 V&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pre-amplifier gain = &lt;strong&gt;18 dB&lt;/strong&gt; (Modified)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let A be the amplitude saved in the wav file. What is the formula to transform A from amplitude to Sound Pressure Level?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the given information is not sufficient, please tell me what more do I need?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any helps are appreciated!&lt;/p&gt;&#xA;" OwnerUserId="7356" LastEditorUserId="7356" LastEditDate="2013-12-24T03:21:37.823" LastActivityDate="2017-03-21T14:38:02.957" Title="How to obtain the Sound Pressure Level from .wav file based on these given parameters?" Tags="|wave|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13336" PostTypeId="1" CreationDate="2013-12-23T16:37:07.157" Score="1" ViewCount="1177" Body="&lt;p&gt;I have a simple problem I would like to figure out for fourier analysis of seismic data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us say that we have a signal $z[n]$, of length $N$. If I take its (same size) FFT, I will get $Z[k]$, also of length $N$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that zero-padding will not improve my resolution, however, what I am trying to figure out is: If I take an $N$ length FFT, is there ANY risk that I will be missing some information, that would have otherwise shown up had I taken a &lt;em&gt;greater&lt;/em&gt; than $N$ length FFT instead? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The case I worry about is if my seismic signal has energy at a frequency that lies between frequency bins. How well would it show up - or not show up - if I do not zero-pad? I would not want to miss this signal should it in fact exist. Cheers. &lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2016-10-06T08:02:13.583" Title="To what extent can we see signals that fall between frequency bins?" Tags="|filters|fourier-transform|dft|window-functions|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13337" PostTypeId="2" ParentId="13336" CreationDate="2013-12-23T16:56:35.193" Score="5" Body="&lt;p&gt;zero-padding will not &quot;improve resolution&quot; in the sense that it would help you separate two peaks in the spectrum that are very close (too close) to each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but zero-padding, as well as interpolation in the frequency domain, &lt;b&gt;does&lt;/b&gt; improve resolution in the sense that it help you to more precisely estimate the location of an isolated peak in the spectrum.  in fact, zero-padding in the time domain is equivalent to interpolating in the frequency domain using the sinc() function (actually the dirichlet function) as the interpolation kernel.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-23T16:56:35.193" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13338" PostTypeId="1" CreationDate="2013-12-23T18:00:14.547" Score="1" ViewCount="65" Body="&lt;p&gt;I've been doing some work with creating visual output on oscilloscopes using audio; here are some examples:&#xA;&lt;a href=&quot;http://www.youtube.com/watch?v=UJ8-vySqEAI&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=UJ8-vySqEAI&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is using Max/MSP to read from a buffer of 3d geometry as audio output to an oscilloscope screen. I'm interested in doing transformations on full frames of video as well, like a digital/analog hybrid version of the old Scanimate machines from the 70s:&#xA;&lt;a href=&quot;http://www.youtube.com/watch?v=wTO3CKM2Yy0&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=wTO3CKM2Yy0&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But at 44100 samples/second, I don't have the bandwidth to keep a frame of video on the screen at a high enough scan rate without the signal degrading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like to do is to use something like MiniDSP to:&#xA;1. Load a frame of pixels (monochrome) into a buffer&#xA;2. Read out the buffer to modulate the beam's brightness and move it along a raster scan path at high speed (around 60fps ideally)&#xA;3. Add LFOs to modulate the scan path to warp the image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This requires a high sampling rate for output, probably higher than normal audio rates for NTSC video, and I know MiniDSP is mainly for audio applications. I'm wondering if you can recommend a solution, ideally one that has friendly features like USB connectivity and C++ compiler, or am I dreaming? Can MiniDSP be overclocked to work at higher rates for output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks very much for any help.&lt;/p&gt;&#xA;" OwnerUserId="7357" LastActivityDate="2013-12-23T18:00:14.547" Title="User-friendly DSP for high-frequency application?" Tags="|video-processing|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13339" PostTypeId="2" ParentId="13336" CreationDate="2013-12-23T18:06:49.410" Score="3" Body="&lt;p&gt;Windowing plays an important role, too. With a &quot;rectangular&quot; window (actually, none at all) a signal with a frequency that fall between two bins will be mapped to a sampled sinc in the frequency domain, and thus the energies of adjacent bins would have to be added to reach a good estimate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some window functions were designed to allow better peak energy measurement (usually called &quot;flat top&quot;).&lt;/p&gt;&#xA;" OwnerUserId="7358" LastEditorUserId="76" LastEditDate="2013-12-24T00:23:55.990" LastActivityDate="2013-12-24T00:23:55.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13340" PostTypeId="2" ParentId="13327" CreationDate="2013-12-23T18:15:33.303" Score="0" Body="&lt;p&gt;The higher the filter order is, the steeper or less rippled (,,smoother''?) a filter approximating a certain prototype can be. So you would select the highest order feasible. Often the desired order may be specified. Common window functions will ,,smear out'' ripples (averaging them out) and make the filter less steep. Windowing and Filtering are acutally dual to each other, you could think of a window as a low pass filter for the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-23T18:15:33.303" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="13341" PostTypeId="2" ParentId="13272" CreationDate="2013-12-23T18:53:24.810" Score="1" Body="&lt;p&gt;Since the blackman window is defined in relation to its length (at least, that is, with the parameter chosen canonically), there's too few parameters open to match the band edges. You could, however:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&#xA;&lt;li&gt;&#xA;Determine $\omega_0 \over \pi$ (the $\pi$ being the scale built in to the $\operatorname{sinc}$ function). $\omega_0$ could be picked as the arithmetic mean of the band edges.&#xA;&#xA;&lt;pre&gt;&gt; w0=600/7200&lt;/pre&gt;&#xA;&lt;li&gt;Window a sinc scaled accordingly by a blackman window.&#xA;&#xA; &lt;pre&gt;&gt; F=sinc((-71.5:71.5)*w0)).*blackman(144)'&lt;/pre&gt;&#xA;&#xA;&lt;li&gt;F now contains a sinc windowed by the blackman function, centered about the middle of the filter (giving a constant phase filter).&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The resulting filter is quite steep, but it has a rather leaky stopband. If the task at hand was a different one, please excuse and explain in a little more detail.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-23T18:53:24.810" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13343" PostTypeId="1" CreationDate="2013-12-23T22:57:06.233" Score="3" ViewCount="1037" Body="&lt;p&gt;I would like to create a very simple system that allows a user to train (once or multiple times) a spoken phrase (from 1 word to a whole sentence.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the (same) user would speak the phrase back, and the system would score how close to the original the phrase was matched. If certain words were missed or incorrect, the score would be deducted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen several articles about audio fingerprinting (ie Shazaam) but these implementations are an overkill. I have a known sound pattern that I'm matching against, not search against a database of audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've tried (using the R libraries DTW and tuneR):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;recorded the phrase &quot;Known as the father of the constitution, he was the first to arrive in Philadelphia for the Constitutional Convention.&quot; three times, however, the 3rd time instead of saying &quot;Philadelphia&quot; I said &quot;New York&quot;.&lt;/li&gt;&#xA;&lt;li&gt;took the MFCC of all three WAV files&lt;/li&gt;&#xA;&lt;li&gt;took the DTW three times: Phili1 vs Phili2, Phili1 vs. NY, Phili2 versus NY&lt;/li&gt;&#xA;&lt;li&gt;Plotted the alignment, question is...&lt;strong&gt;what do I do with this data, what metric should I use&lt;/strong&gt; You can see in the plot that the first alignment is most linear (same phrase repeated exactly)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Phili1 vs Phili2&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/M9q48.png&quot; alt=&quot;Phili1 vs Phili2&quot;&gt;&#xA;&lt;strong&gt;Phili1 vs. NY&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/bObkk.png&quot; alt=&quot;Phili1 vs. NY&quot;&gt;&#xA;&lt;strong&gt;Phili2 vs. NY&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GJyzM.png&quot; alt=&quot;Phili2 vs. NY&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7360" LastEditorUserId="7360" LastEditDate="2013-12-25T18:18:39.130" LastActivityDate="2013-12-25T18:18:39.130" Title="Algorithm to detect if a spoken phrase matches a previously spoken phrase" Tags="|fft|speech-recognition|speech|mfcc|speech-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13344" PostTypeId="2" ParentId="13335" CreationDate="2013-12-23T23:59:12.410" Score="6" Body="&lt;p&gt;The hydrophone has -180 dB 1V/uPa or -60 dB V/Pa. 1 Pa produces hence 1mV or, other way around, the sensitivity is 1mV/Pa. Peak voltage is 5.64 peak to peak. That's 2.82V peak or 2V RMS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A full scale sine wave has 2 V RMS which is 2000 Pa. dBSPL is referenced against 20uPa so 2000 Pa is equivalent to 160 dBSPL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The clipping point of your wave file corresponds to 160 dB SPL. The exact relationship between number and dBSPL  depends  on the format of the wave file (fixed vs. floating, number of bits). For a 16 bit fixed point format, the clipping point corresponds to the number 32768. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-23T23:59:12.410" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13345" PostTypeId="2" ParentId="13336" CreationDate="2013-12-24T00:48:26.073" Score="2" Body="&lt;p&gt;Here are some basic facts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define discrete Fourier transform of a series of $N$ points $x_n$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_k = \frac{1}{N}\sum_{n=0}^{N-1} x_n \exp^{-i 2 \pi n x k / N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We get N unique frequency bins at frequencies $k/N$ were k runs from 0 to $N-1$. If the actual time of the series is $T$ then the width of the frequency bins is $1/T$, and the highest frequency bin is $(N-1)/T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal you're measuring is real then $X_k = X_{N-k}^*$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, now let's get to your questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we measure a 2 Hz complex sinusoid for 1 second, with 20 points. Then the 2nd bin (numbering from zero) will be nonzero, but all the others will be zero. This is all nice and neat because 2 Hz fits exactly into the 1 second measurement window, eg. exactly 2 oscillations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what happens if we measure a signal at 12.2 Hz? In this case the signal sits at a frequency that is between two frequency bins. What happens is essentially that the power shows up mostly in the 12Hz bin, but &quot;leaks&quot; into neighboring bins as well. This is illustrated in the figure below. There we plot the computed Fourier coefficients (blue dots) and the expected result of the DFT that I computed by doing the sum explicitly (red lines).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that most of the power is at bin number 12, but there is also significant power in the neighboring bins. This power in the &quot;wrong&quot; place is called &quot;spectral leakage.&quot; In this sense, having too coarse a set of bins does lead to loss of information because you can't tell whether the power in bins 11 and 13 are from leakage or from actual tones. One thing that affects the particulars of how spectral power leaks into neighboring bins is the window you use in the DFT. This is a rich topic and there's too much for me to describe here, but if you search the 'net for &quot;fourier transform window&quot; you'll find what you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now going back to the list of facts I put forth in the beginning you can see that if we had simply measured for longer we'd have a finer set of bins and at least partially mitigated this problem. If you do this by zero padding you do get more points, and therefore finer frequency bins, but as you already said you don't actually have any more information because these zero padded points are completely made up. How do you reconcile that with the fact that you have more frequency bins? It all fits together when we realize that zero padding is essentially &lt;em&gt;interpolation&lt;/em&gt; in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more thing. If all you care about is the total power then spectral leakage isn't much of a problem. When power leaks out of one bin into the neighboring ones the total power doesn't change much, if at all.$^{[a]}$ The only time you have to worry about spectral leakage messing up the total power in the DFT is at the very lowest frequency bins. If you need details on this I can provide. Just ask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[a]$: The details of whether it's precisely conserved are actually a lot more complicated than other people may have you believe. Watch out for people who cite Perseval's theorem too readily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Nd0r.png&quot; alt=&quot;Illustration of spectral leakage&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="7361" LastEditDate="2015-06-17T09:19:51.930" LastActivityDate="2015-06-17T09:19:51.930" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="13346" PostTypeId="1" AcceptedAnswerId="14558" CreationDate="2013-12-24T03:50:18.933" Score="0" ViewCount="854" Body="&lt;p&gt;I would like to know how to compute the statistics of the discrete Fourier transform of a noise signal. To illustrate what I mean, I will first explain in detail a computation I have managed to do myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have a discrete time series of values $x_n$ with $n$ from 0 to $N-1$. Each $x_n$ is a random variable, uncorrelated with the others, and Gaussian distributed with width $\sigma$. If I define the discrete Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_k = \frac{1}{N}\sum_{n=0}^{N-1} x_n e^{-2 \pi i n  k / N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then I find that $X_k$ is a complex random variable with real and imaginary parts Gaussian distributed with width $\sigma/\sqrt{2 N}$. I did the computation by using the fact that the distribution of a sum is the convolution of the distributions, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to know how to do this computation in the case that $x_n$ are correlated. How does one approach this problem? I can make the assumption that the process is Markovian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had &lt;a href=&quot;https://scicomp.stackexchange.com/questions/10394/how-can-we-compute-statistics-of-the-dft-of-a-random-signal&quot;&gt;originally asked this on the Computation Science site&lt;/a&gt;, but I think here is a better fit.&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="-1" LastEditDate="2017-04-13T12:53:54.087" LastActivityDate="2015-06-14T02:27:09.473" Title="How to compute the statistics of the DFT of correlated noise?" Tags="|noise|dft|statistics|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13347" PostTypeId="2" ParentId="13336" CreationDate="2013-12-24T05:10:51.853" Score="1" Body="&lt;p&gt;In non-zero noise, a shorter FFT contains less samples, therefore both less energy and less information about any signal.  So it will &quot;miss&quot; more of the signal because of the lesser information in a shorter window upon the signal.  A shorter FFT will also move a larger portion of a signal into the DC and Fs/2 bins where some information can be lost in the windowing process,  depending on phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In stationary Gaussian noise, the longer the FFT window, the greater the likelihood that a stationary signal will appear above the noise floor, and/or allow a more accurate interpolation of its spectrum (peaks, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A shorter FFT or window could also potentially completely miss a non-stationary event in time (e.g. If it occurs before or after the window).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero-padding before the FFT will do the same as high-quality interpolation after, in showing stuff &quot;between bins&quot;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-12-24T05:32:50.457" LastActivityDate="2013-12-24T05:32:50.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13348" PostTypeId="1" CreationDate="2013-12-24T05:19:31.973" Score="1" ViewCount="320" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FJPix.jpg&quot; alt=&quot;Freq response of Different Microphones with Different Diaphragm size&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here Above are the frequency responses of different size microphone(condenser)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what actually is the relation between the microphone capsule size and frequency response ? &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The conclusion is that a large diaphragm microphone will have a more limited frequency range than a small diaphragm. This is illustrated in the graphs&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;i found some sites explaining the reason but i did not get the reason well, can any one illustrate for me plz&lt;/p&gt;&#xA;" OwnerUserId="4513" LastActivityDate="2013-12-24T13:26:00.097" Title="Why a Large Diaphragm Microphone is limited to lesser frequency range" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13349" PostTypeId="2" ParentId="13343" CreationDate="2013-12-24T09:18:42.557" Score="1" Body="&lt;p&gt;MFCC is an established way of handling speech recognition. You will find plenty of libraries and tools (e.g. &lt;a href=&quot;http://yaafe.sourceforge.net/%20yaafe&quot; rel=&quot;nofollow&quot;&gt;yaafe&lt;/a&gt;, &lt;a href=&quot;http://sox.sourceforge.net/%20Sox&quot; rel=&quot;nofollow&quot;&gt;SoX&lt;/a&gt;) that can extract them for you. Implementing them yourself is also quite easy. Yaafe provides plethora of other audio features you might like to play with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mind that MFCC are not very robust against noise, so you might like to apply some noise reduction beforehand if required. Some people advocate raising the log-mel-amplitudes to a power 2 or 3 before applying discreet cosine transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some libraries, like scikit learn, next to all machine learning algorithms provide also DTW. On your place I would just try MFCC and see how it goes from there.&lt;/p&gt;&#xA;" OwnerUserId="5785" LastActivityDate="2013-12-24T09:18:42.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13350" PostTypeId="2" ParentId="13343" CreationDate="2013-12-24T10:29:04.190" Score="1" Body="&lt;p&gt;MFCC + DTW is the baseline/textbook-ish method for what you want to do. Looking at the best alignment path will allow you to find out which words are missing ; looking at the distances along the alignment path will allow you to find which frames are incorrectly pronounced. Note that this method is not very robust to changes in environment (say background noise, distance to microphone...), will give random results when the two sentences to match are from different speakers; and will be oblivious to some pronunciation errors (such as differences in pitch - since this aspect of prosody is very superficially captured by the MFCC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shazam uses features specifically crafted for music. I don't think the literature on audio fingerprinting is very relevant to what you are trying to do.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2013-12-24T10:29:04.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13351" PostTypeId="1" CreationDate="2013-12-24T12:09:55.670" Score="1" ViewCount="2094" Body="&lt;p&gt;&lt;a href=&quot;http://www.cs.tut.fi/~foi/3D-DFT/BM3DDEN_article.pdf&quot; rel=&quot;nofollow&quot;&gt;BM3D&lt;/a&gt;  is considered state of the art in Image Denoising. I am trying to implement the algorithm in Matlab. Right now, I am done with the 3D wavelet transform in the first step, and to be precise, the equation 3 in the aforementioned paper. What I want to do now is to carry out the equation 5 on my de-noised patches in 3D domain. Can someone please explain the equation 5, the aggregation scheme, a bit more lightly? &lt;/p&gt;&#xA;" OwnerUserId="4142" LastActivityDate="2021-11-23T08:37:34.283" Title="Help me with BM3D algorithm's aggregation scheme" Tags="|image-processing|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13352" PostTypeId="2" ParentId="13348" CreationDate="2013-12-24T13:26:00.097" Score="4" Body="&lt;p&gt;There are typically two reasons: First, a larger diaphragm is also heavier and hence it's inertia is bigger, which slows it down at higher frequencies (but also provides for significantly higher max SPL handling).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main reason, however, is the relationship between wavelength and diaphragm size. The microphone basically &quot;integrates&quot; the sound pressure over the spatial area of the diaphragm. For a plane wave, the sound pressure is the same everywhere, but in a diffuse field that's not the case anymore. The wave length at 10 kHz is about 34 mm. So there are points on the diaphragm that are half a wavelength apart and it's entirely possible that one point sees positive pressure and the other negative pressure. These can cancel each other out (to some extent). &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-24T13:26:00.097" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13353" PostTypeId="1" CreationDate="2013-12-24T12:13:25.197" Score="0" ViewCount="449" Body="&lt;p&gt;I've been looking around and found some great C/C++/Java libraries like CMU Sphinx or Windows SAPI. I did not like SAPI, and CMU Sphinx is way too complicated... would need months to understand how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would like to start writing my own library, even it would be crap, but to understand all the parts how to recognize a word in real-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now comes in my head a question,... how to match digital input to a given word? How to make it without seconds delay?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I understand is that I pass the input into buffer and I have to process it. First I try to create some spectrogram (time, frequency, amplitude) and then to use Fast Fourier Transform. In the database/list I will have stored words with their phonemes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how do I match these phonemes with FFT output? I simply do not understand all the steps.&lt;/p&gt;&#xA;" OwnerUserId="7366" OwnerDisplayName="Wiggler Jtag" LastEditorUserId="7366" LastEditDate="2013-12-24T16:39:57.113" LastActivityDate="2013-12-27T19:12:24.950" Title="In voice recognition system, how to match digital input to a given word without seconds delay?" Tags="|speech-recognition|speech-processing|c|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13356" PostTypeId="1" CreationDate="2013-12-24T21:03:17.960" Score="1" ViewCount="1165" Body="&lt;p&gt;i want to know more about brief descriptor algorithm and matlab code for this.&#xA;the points copmare with another what choice them. e.g. 128 point at patch how are choose.?&#xA;thanks&lt;/p&gt;&#xA;" OwnerUserId="7372" LastActivityDate="2013-12-24T21:03:17.960" Title="BRIEF descriptor and matlab code" Tags="|computer-vision|" AnswerCount="0" CommentCount="1" ClosedDate="2013-12-25T19:19:57.477" ContentLicense="CC BY-SA 3.0" />
  <row Id="13357" PostTypeId="2" ParentId="13322" CreationDate="2013-12-24T21:23:31.290" Score="3" Body="&lt;p&gt;If I understand your question, then the answer lies in the equivalence of linear and circular convolution - the linear convolution being implemented by multiplication with a toeplitz matrix, while circular convolution is implemented by multiplication with a circulant matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a length N signal and length M filter impulse response, the circular and linear convolutions are equivalent if you pad the signal and filter with zeros to length N+M-1 - that is, you can implement the linear convolution using the DFT. You are padding x with zeros above, and presumably the number of zeros is such that the length N+M-1 requirement is met.  Then in matrix form, the DFT matrix would diagonalize the corresponding convolution operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps - I'm short on time right now and can't provide a more detailed explanation.&lt;/p&gt;&#xA;" OwnerUserId="7373" LastActivityDate="2013-12-24T21:23:31.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13358" PostTypeId="1" CreationDate="2013-12-25T09:48:04.533" Score="1" ViewCount="62" Body="&lt;p&gt;When a sum of sine waves is passed through a non linear process, harmonics and intermodulation distortion products are created, which are visible when applying an FFT to the signal. This causes potential problems when figuring out which sine waves were present in the signal originally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does something similar happen when a sum of walsh functions is passed through a non linear process and the walsh transform is applied? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;B&lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2013-12-25T09:48:04.533" Title="determining walsh function components of signal after passing through non linear process" Tags="|fft|frequency-spectrum|signal-detection|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13359" PostTypeId="1" AcceptedAnswerId="13361" CreationDate="2013-12-25T10:21:16.680" Score="2" ViewCount="464" Body="&lt;p&gt;How can I detect a quadrilateral in a point cloud that looks almost like a rectangle? How do I set the criteria (i.e orientation, size etc) to get the shape for example in the image below? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/13yyr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7363" LastEditorUserId="7363" LastEditDate="2013-12-26T05:31:27.903" LastActivityDate="2013-12-26T05:31:27.903" Title="How to detect quadrilaterals in a point cloud?" Tags="|algorithms|image-processing|statistics|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13361" PostTypeId="2" ParentId="13359" CreationDate="2013-12-25T17:09:14.793" Score="1" Body="&lt;p&gt;There is one possible solution which is roughly $O(n\cdot (n-1)\cdot log(n))$ where $n$ is the number of points.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Build 2-dimensional k-d tree from all the points&lt;/li&gt;&#xA;&lt;li&gt;For each pair of unmarked (undiscovered) points&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;2.1 Determine two areas (based on rectangle criteria) where the other two points can possibly lay&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.2 Find nearest point to center of each of the areas (using the k-d tree)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.3 If each nearest point is unmarked and lays within its respective area, store new rectangle, mark all four points as discovered&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm can be optimized by keeping undiscovered points in a set, picking new ones from the, progressively reducing its size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another speedup would be removing discovered points from the KD-tree so the algorithm does not have to check them in step 2.3.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2013-12-25T17:16:17.843" LastActivityDate="2013-12-25T17:16:17.843" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13362" PostTypeId="2" ParentId="13333" CreationDate="2013-12-25T20:45:34.700" Score="2" Body="&lt;p&gt;I can not give you a full approach, but I might have an interesting suggestion. As soon as you &lt;em&gt;detect a vehicle&lt;/em&gt;, &lt;strong&gt;start &lt;a href=&quot;https://dsp.stackexchange.com/questions/tagged/tracking?sort=votes&amp;amp;pageSize=15&quot;&gt;tracking&lt;/a&gt; it&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For every detection, you could &quot;remember&quot; the first and last frame of the video where you tracked that vehicle. &lt;strong&gt;You associate every vehicle detection with a series of consecutive frames.&lt;/strong&gt; The &lt;em&gt;beginning&lt;/em&gt; frame would be the one when the detection was made, and the &lt;em&gt;ending&lt;/em&gt; would be the first frame when the tracking algorithm fails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you could &lt;strong&gt;select only a single frame for every distinct vehicle you tracked&lt;/strong&gt; during your video sequence, with more or less simple approaches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;select the middle frame of the tracking sequence, as there is a high chance that in the middle of the tracking, the vehicle was well visible&lt;/li&gt;&#xA;&lt;li&gt;do matching between several points in the sequence, or just base your decision on the number of features you can still track at a certain frame:  selecting a frame with a large number of trackable/matchable features is probably a good choice&lt;/li&gt;&#xA;&lt;li&gt;remember the &quot;quality&quot; of your detection for every frame in the sequence, and select the frame where the detection quality was the best&lt;/li&gt;&#xA;&lt;li&gt;depending on the preferences, be mindful to either select one representative frame if the sequences for two vehicles overlap, or purposefully select different frames (possibly from non-overlapping parts of the sequences). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2013-12-25T20:45:34.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13363" PostTypeId="1" CreationDate="2013-12-25T23:19:36.270" Score="0" ViewCount="709" Body="&lt;p&gt;I am working on a spectrum analyzing simulator, which is meant to compute and plot the FFT of a sine wave carrier signal of $16 Hz$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my practicals with a spectrum analyzer, I know that the spike shows up on the $16Hz$ mark. But after computing my own FFT and passing the magnitude of the FFT to a plotter in &lt;code&gt;Matlab&lt;/code&gt;, I get two spikes, one at the beginning and the other at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My sample rate is $2048$ samples per second, and what I plotted was the respective $abs(FFT)$ against a frequency step of $16/2048$. Doing the &lt;a href=&quot;http://cens.ioc.ee/local/man/matlab/techdoc/ref/fftshift.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fftshift&lt;/code&gt;&lt;/a&gt; only moves the spike to the $8Hz$ mark and not $16Hz$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried computing FFT in different programming languages and with different tools (java &lt;code&gt;jtransform&lt;/code&gt;, Matlab, C language, Excel, two java written classes for FFT by different universities).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I dont think my FFT result are wrong, I think it has to do with the plotting. I do not understand why my plot does not look like it would in real life. From my description and information, can you see any problems that would cause my plot to be wrong?&lt;/p&gt;&#xA;" OwnerUserId="7378" LastEditorUserId="1273" LastEditDate="2013-12-26T18:53:19.893" LastActivityDate="2014-01-29T21:15:32.217" Title="Plotting Spectrum Analysis" Tags="|matlab|fft|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13364" PostTypeId="1" CreationDate="2013-12-25T23:48:04.990" Score="3" ViewCount="475" Body="&lt;p&gt;My problem is essentially a 'blind source separation' problem. I have 3 non-orthogonal sources (or basis functions) and $N$ random linear combinations (mixes) of said sources. My problem is to obtain the sources from the mixes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure A shows the sources, B shows the mixes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approaches taken:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$\textbf{PCA}$ - I tried PCA on the mixes (fig.C), but the issue is that PCA will only give orthogonal bases, while my sources/bases are non-orthogonal. This issue with PCA is shown in figure D, where the data is clearly described by 2 non-orthogonal basis, but PCA (the solid lines) cant reconstruct them!&lt;/li&gt;&#xA;&lt;li&gt;$\textbf{Factor Rotation}$ - I tried applying some solutions form Factor Analysis (not my forte). The promax rotation (matlab: &lt;code&gt;nw = rotatefactors(cov,'method','promax')&lt;/code&gt; ) is shown in fig. D with the dashed lines. As far as I can tell, factor rotation works with the principal components, not the original matrix and thus I have no idea how it could reconstruct the right basis. I think this only works with factor matrices, not with generic ones...&lt;/li&gt;&#xA;&lt;li&gt;$\textbf{ICA}$ - I tried overdetermined ICA with the fastICA algorithm (also not my forte, but I think I understand it better). I was hoping this would work since independent components (ICs) are non orthogonal. The solution is shown in fig.E. While the ICs are indeed nonorthogonal, they are NOT my original sources :-(&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any other potential tips or leads or solutions would be greatly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TO7JE.png&quot; alt=&quot;figure&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;More mathematical Detail&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3 source signals are themselves linear combos of the 5 laguerre basis functions. Thus, the problem can be formulated as such:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I take &lt;code&gt;l=5&lt;/code&gt; laguerre basis functions of length &lt;code&gt;m=30&lt;/code&gt; to get &lt;code&gt;B&lt;/code&gt;, an &lt;code&gt;[l,m]&lt;/code&gt; matrix &lt;/li&gt;&#xA;&lt;li&gt;I randomly mix then is my &lt;code&gt;x=3&lt;/code&gt; sources, &lt;code&gt;S: S=B*M1&lt;/code&gt;, where &lt;code&gt;M1&lt;/code&gt; is a random &lt;code&gt;[l,x]=[5,3]&lt;/code&gt; mixing matrix. &lt;code&gt;S&lt;/code&gt; is displayed in fig.A&lt;/li&gt;&#xA;&lt;li&gt;I mix S &lt;code&gt;n=100&lt;/code&gt; times to get my mixed signals, &lt;code&gt;K&lt;/code&gt; (fig.B), where &lt;code&gt;K=S*M2&lt;/code&gt;, a &lt;code&gt;[x,n]=[3,100]&lt;/code&gt; randomly generated mixing matrix.&lt;/li&gt;&#xA;&lt;li&gt;I have the original basis, &lt;code&gt;L&lt;/code&gt;, &amp;amp; the mixed matrix, &lt;code&gt;K&lt;/code&gt;. &lt;code&gt;K=S*M2=B*M1*M2&lt;/code&gt;. My goal is to recover &lt;code&gt;S&lt;/code&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;NOTE: I understand that this may seem impossible since there are many possible &lt;code&gt;S&lt;/code&gt;'s to choose from (ie the factorizatio &lt;code&gt;S*M2=B*M1*M2&lt;/code&gt; is not unique), however, the true &lt;code&gt;S&lt;/code&gt;, will dramatically decrease model complexity by having only &lt;code&gt;x=3&lt;/code&gt; rather than &lt;code&gt;l=5&lt;/code&gt; basis functions which can exactly reproduce all the kernels.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4550" LastEditorUserId="1629" LastEditDate="2016-01-27T13:34:44.060" LastActivityDate="2023-01-08T00:03:08.503" Title="How to Extract Nonorthogonal PCA Principal Components" Tags="|discrete-signals|signal-analysis|covariance|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13365" PostTypeId="2" ParentId="13364" CreationDate="2013-12-26T00:17:51.953" Score="1" Body="&lt;p&gt;Let's say x,y and z are your basis vectors and you mix them to get what you are calling your mixed sources. If your basis vectors were (x-y), y, and (z+y) then you could mix them in a different way and end up with the same mixed sources. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, there are many ways to come up with a set of basis vectors for your signals. You need to say what kind of basis you want. It is not enough to say that the basis vectors are non-orthogonal. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-26T00:17:51.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13366" PostTypeId="2" ParentId="13364" CreationDate="2013-12-26T00:51:20.167" Score="-1" Body="&lt;p&gt;A map from a weights vector $w$ to a ,,mixed signal'' $S$ would be just your 3 prototype signals as a matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A=\left[\matrix{x &amp;amp; y &amp;amp; z}\right]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that a linearly combined signal could be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S=Aw$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A ,,pseudoinverse'' to this matrix $A$ (in a few words: a matrix $A'$ so that $A'A=\mathbf{1}$) would map that signal back to $w$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A'S=w$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is then finding such a pseudo-inverse. However, this problem is well-known and implementations are available.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastEditorUserId="7358" LastEditDate="2013-12-26T01:01:21.290" LastActivityDate="2013-12-26T01:01:21.290" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13368" PostTypeId="1" CreationDate="2013-12-26T05:04:52.313" Score="1" ViewCount="380" Body="&lt;p&gt;In idea of buying an SPL meter i have drawn the specifications out in them very first and important spec is sensitivity of microphone many high priced microphones have their sensitivity arround 50mV/Pa where as some other with less cost have it arround 1V/Pa,&lt;/p&gt;&#xA;&lt;p&gt;so what actually i want to know is, what is the actual role of Microphone sensitivity ?,for me it looks like the mic sensitivity will help in extending its dynamic range only i think..&lt;/p&gt;&#xA;&lt;p&gt;for example the low cost meters will have differnt dB ranges&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;low    30-80dB, Med 50-100dB,High   80-130dB&lt;/p&gt;&#xA;&lt;p&gt;why so&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;which microphones will be costly,whether a high sensitive like 12mV/Pa or a low sensitive 40mV/Pa&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-03-16T08:06:50.107" Title="Role of Microphone sensitivity in building an SPL meter or dB meter" Tags="|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13369" PostTypeId="1" AcceptedAnswerId="13443" CreationDate="2013-12-26T05:22:38.240" Score="0" ViewCount="3139" Body="&lt;p&gt;I would like to resample an audio signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling frequency of an original audio signal is 50k Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to down sampling frequency is 30k Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, I followed the procedures as below using LabVIEW.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;'1. IIR low pass filter&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Butterworth / 6th / Lowpass / up to 15k Hz&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;'2. Resample to 30kHz&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why I used LPF is to prohibit the anti-aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt; from now on&lt;/b&gt;, I have some questions.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1. Do we need to do LPF for prohibiting anti-aliasing?&#xA;&#xA;2. If we have to do, how can we choose the lower cutoff frequency?&#xA;   In my case, I choose as 15k Hz because this is the new Nyquist frequency.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR is there the standard procedure for resampling?&lt;/p&gt;&#xA;" OwnerUserId="4639" LastActivityDate="2013-12-30T21:01:07.207" Title="Doing resampling, how can we choose lower cutoff frequency for LPF filter?" Tags="|lowpass-filter|resampling|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13370" PostTypeId="1" CreationDate="2013-12-26T08:30:50.817" Score="4" ViewCount="4328" Body="&lt;p&gt;suppose I have a 4 seconds signal captured at $f_s$ = 1024Hz, which gives 4,096 data array. What is the different between these 2 FFT methods (MATLAB code)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] FFT the entire input with 4096-points FFT&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = length(input);&#xA;Y = fft(input)/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;[2] Divide the input into 8 segments (4096/8=512 data point each), and feed each segment to 512-points FFT, and then average the output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = length(input);&#xA;Y = zeros(1,512);&#xA;for i = 1:8&#xA;  segment = input(512*(i-0)+1 : 512*i);&#xA;  Y = Y + abs(fft(segment,512))/512/8;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Question #1: Are these 2 methods equivalent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question #2: Is the frequency resolution for both methods equal to $\frac{f_s}{N}$ = 0.25Hz per bin?&lt;/p&gt;&#xA;" OwnerUserId="7382" LastEditorUserId="7382" LastEditDate="2015-11-11T17:55:38.017" LastActivityDate="2015-11-11T19:21:29.390" Title="FFT the whole input vs FFT segment" Tags="|fft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13371" PostTypeId="2" ParentId="10789" CreationDate="2013-12-26T09:28:28.283" Score="-1" Body="&lt;p&gt;Here to my question i have gone for a simple solution as suggested by some people above and also with my idea i stayed simple with the approach&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on the decoder side i have taken two types comfort noise with different noise strengths,while streaming the decoded data if the user finds distrubing with one noise strength i will switch to the other noise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have got the noise files of 1 second up on which repetition will also doesn't bother a human ear&lt;/p&gt;&#xA;" OwnerUserId="4513" LastActivityDate="2013-12-26T09:28:28.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13372" PostTypeId="1" CreationDate="2013-12-26T11:15:09.503" Score="-1" ViewCount="221" Body="&lt;p&gt;I want to set the precision to 24 bits while using matlab. Is this possible without using vpa?&#xA;because vpa is consuming lot of time since I am calling vpa more than 8000 times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help  &lt;/p&gt;&#xA;" OwnerUserId="7384" LastActivityDate="2013-12-26T15:24:23.213" Title="setting the precision" Tags="|matlab|" AnswerCount="1" CommentCount="1" ClosedDate="2014-01-10T22:47:14.353" ContentLicense="CC BY-SA 3.0" />
  <row Id="13373" PostTypeId="1" AcceptedAnswerId="13376" CreationDate="2013-12-26T11:52:27.923" Score="1" ViewCount="260" Body="&lt;p&gt;I am reading a text on discrete signal processing, which states that the frequency response of a signal can be obtained by plugging the value $e^{jω}$ into the z-domain transfer function $H(z)$. In other words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{IIR}(ω) = H(z)|_{z=e^{jω}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example given in the text, it is given that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = (\frac{1}{1 - \frac{1}{5}z^{-1}}) (\frac{1}{1 + \frac{1}{2}z^{-1}})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, the text presents the following equation for the magnitude of the frequency response when $ω = \frac{\pi}{2T}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|H_{IIR}(\frac{\pi}{2T})| = \frac{|j|}{|j - \frac{1}{5}||j + \frac{1}{2}|} = \frac{1}{\sqrt{\frac{1}{25} + 1}\sqrt{\frac{1}{4} + 1}} = \frac{\sqrt{130}}{13}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how the author derived the above equation. That is, what kind of wizardry leads to the following equations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|H_{IIR}(\frac{\pi}{2T})| = |(\frac{1}{1 - \frac{1}{5}e^{-j\frac{\pi}{2T}}}) (\frac{1}{1 + \frac{1}{2}e^{-j\frac{\pi}{2T}}})| = \frac{|j|}{|j - \frac{1}{5}||j + \frac{1}{2}|} = \frac{1}{\sqrt{\frac{1}{25} + 1}\sqrt{\frac{1}{4} + 1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it have something to do with magnitude and a special identity regarding the constant $e$?&lt;/p&gt;&#xA;" OwnerUserId="7305" LastActivityDate="2013-12-26T15:35:30.397" Title="Obtaining the magnitude of the frequency response by plugging $e^{jω}$ into the z-domain transform function?" Tags="|frequency-response|z-transform|magnitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13374" PostTypeId="2" ParentId="3541" CreationDate="2013-12-26T12:43:54.323" Score="1" Body="&lt;p&gt;Maybe you'd be better off using Bessel-Thompson filters. Maybe one could find an all-pass that approximately corrects a Butterworth filter, but it looks rather hard.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-26T12:43:54.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13375" PostTypeId="2" ParentId="13372" CreationDate="2013-12-26T15:24:23.213" Score="1" Body="&lt;p&gt;Matlab uses by default the data type &lt;code&gt;double&lt;/code&gt;, which has 64 bits precision, so there is no need to use vpa, if you want &lt;em&gt;at least&lt;/em&gt; 24 bits precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is really your intention to decrease precision, you could use variables of data type &lt;code&gt;single&lt;/code&gt; with 32 bits precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need exactly 24 bits precision, vpa may be the way to go. Alternatively, you could artificially reduce the precision of the result after each computation step.&lt;/p&gt;&#xA;" OwnerUserId="5834" LastActivityDate="2013-12-26T15:24:23.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13376" PostTypeId="2" ParentId="13373" CreationDate="2013-12-26T15:35:30.397" Score="2" Body="&lt;p&gt;It's  derived using Euler's equation &lt;a href=&quot;http://en.wikipedia.org/wiki/Euler&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Euler&lt;/a&gt;'s_formula. You start with $$H(z) = (\frac{1}{1 - \frac{1}{5}z^{-1}}) (\frac{1}{1 + \frac{1}{2}z^{-1}})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then plug in $e^{-jwT}$ for $z^{-1}$ and you get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = (\frac{1}{1 - \frac{1}{5}e^{-j\frac{\pi }{2}}}) (\frac{1}{1 + \frac{1}{2}e^{-j\frac{\pi }{2}}})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now according to Euler we simply have $e^{-j\frac{\pi }{2}} = -j$ so the whole thing simplifies to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = (\frac{1}{1 - \frac{1}{5}\cdot (-j)}) (\frac{1}{1 + \frac{1}{2}\cdot (-j)})$$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Utilizing $(-j) \cdot j = 1$ we can multiple each part of the fraction with j/j and get &#xA;$$H(z) = (\frac{j}{j - \frac{1}{5}}) (\frac{j}{j + \frac{1}{2}})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we can take the magnitude as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left | H(z) \right | = \frac{\left | j^{2} \right |}{\left | j-\frac{1}{5} \right |\cdot \left | j+\frac{1}{2} \right |}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't exactly the same formula that you have given but since magnitude j and j^2 are the same, the final result comes out to be the same.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-26T15:35:30.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13377" PostTypeId="2" ParentId="13370" CreationDate="2013-12-26T15:43:41.980" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Question #1: Are these 2 methods equivalent?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, method #1 is taking an FFT of the entire sequence resulting in frequency bin widths of fs/N = 1024/4096 = 0.25 Hz. Method #2 is summing shorter FFTs at a frequency resolution (bin width) of 1024/512 = 2.0 Hz. For #2, if you divide by the number of FFTs after you sum them you are then averaging them. This is often times used to reduce the variance of the result.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Question #2: Is the frequency resolution for both methods equal to 0.25Hz per bin?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, they are 0.25 &amp;amp; 2.0 Hz. The resolution, or bin width, of the FFT is fs/N.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-12-26T15:43:41.980" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13378" PostTypeId="2" ParentId="13369" CreationDate="2013-12-26T15:54:39.080" Score="0" Body="&lt;p&gt;There is no standard procedure for re-sampling audio, it's actually a pretty complicated trade off and depends heavily on the specific requirements of your application. In general you need to decide&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What amount of aliasing can you tolerate? &lt;/li&gt;&#xA;&lt;li&gt;Do you care about phase distortion. If yes, what amount can you tolerate?&lt;/li&gt;&#xA;&lt;li&gt;Do you care about latency? If yes, how much can you tolerate?&lt;/li&gt;&#xA;&lt;li&gt;How much pass band magnitude distortion can you tolerate?&lt;/li&gt;&#xA;&lt;li&gt;How high cutoff point of you re sampled bass band need to be? &lt;/li&gt;&#xA;&lt;li&gt;How much out-of-band content is in your original signal?&lt;/li&gt;&#xA;&lt;li&gt;How much MIPS can you spend?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;6th order Butterworth at 15k is very efficient (fast), low latency, pass band ripple of less than 1dB  up to 14kHz but it does provide significant phase distortion and aliasing rejection is mediocre at best. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-26T15:54:39.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13379" PostTypeId="2" ParentId="13368" CreationDate="2013-12-26T16:00:09.367" Score="2" Body="&lt;p&gt;This is all about dynamic range since you can always compensate for sensitivity with a proper pre-amp. Dynamic range is limited at the low end by the self noise of the microphone (or the quality of the electronics) and the high end is limited by the distortion of the microphone or the clip points of the electronics.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2013-12-26T16:00:09.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13381" PostTypeId="1" CreationDate="2013-12-26T18:56:23.533" Score="1" ViewCount="162" Body="&lt;p&gt;How can I find this all pass filter's phase? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{jw}) =\frac{−a* + e^{-jw}}{1 - a(e^{-jw})}$$&#xA;where $a = ρe^{jϴ}$ is the pole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I want to find group delay, I know that the group delay is the derivative of the phase with respect to w but i don't know how to find the phase&lt;/p&gt;&#xA;" OwnerUserId="7387" LastEditorUserId="76" LastEditDate="2013-12-29T03:15:17.973" LastActivityDate="2013-12-29T03:15:17.973" Title="How can I find this all pass filter's phase?" Tags="|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13382" PostTypeId="2" ParentId="13381" CreationDate="2013-12-26T19:50:50.443" Score="3" Body="&lt;p&gt;phase of a filter is the angle (or &quot;argument&quot;) of the complex number that is $H(e^{j\omega})$ at each value of $\omega$ .  you may need to &quot;unwrap&quot; the phase by adding or subtracting integer multiples of $2 \pi$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, to post math to these pages, surround the $\LaTeX$ expression with single dollar signs for inline math and double dollar signs for math expressions on their own line.  if you need a quick guide for LaTeX, my suggestion is the one that lives at Wikipedia: &lt;a href=&quot;https://en.wikipedia.org/wiki/Wikipedia:Math&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Wikipedia:Math&lt;/a&gt; .  i'm still learning how to do other markup here.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-26T19:50:50.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13383" PostTypeId="1" AcceptedAnswerId="13387" CreationDate="2013-12-26T20:32:52.440" Score="0" ViewCount="439" Body="&lt;p&gt;I often see examples in textbooks where someone constructs a 2D Fourier spectrum of an image by fixing two (symmetric) pixels to a given value, and computes the inverse DFT to get a nice waveform image. I want to know how these images are created. It seems to me that they pick one pixel that would give them the desired spacing and orientation, fill in the symmetric opposite pixel with the conjugate value, and then somehow fill in the DC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This last part is what's confusing me. I want to answer the more general question: if you're given the non-DC frequency components of the Fourier spectrum of an image, how do you compute the DC component? I would be happy with an algorithmic solution, as I'm working on signals in Python with the scipy/numpy suite.&lt;/p&gt;&#xA;" OwnerUserId="1658" LastActivityDate="2013-12-26T23:25:06.167" Title="How do I compute the DC component given the other part of the Fourier spectrum?" Tags="|image-processing|frequency-spectrum|dft|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13384" PostTypeId="2" ParentId="13351" CreationDate="2013-12-26T20:34:16.417" Score="3" Body="&lt;p&gt;&lt;strong&gt;BM3D intuition&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The intuition behind BM3D is the same as other non-local algorithms: an image is made by the juxtaposition of many, self-repetitive small image elements called patches. Thus, when looking at small enough pieces, it is possible to find enough similar patches that can be combined and denoised together.&lt;/p&gt;&#xA;&lt;p&gt;The different non-local algorithms are different in the way used to combine these similar patches.&#xA;BM3D relies on &lt;em&gt;sparsity&lt;/em&gt;. This principle has become widely accepted now, and basically states that for many useful signals (including images) there exists at least one frame where this signal can be decomposed into a small number of meaningful components.&lt;/p&gt;&#xA;&lt;p&gt;For images, DCT and wavelet basis are obvious candidates for the sparse frame: JPEG / JPEG2k compression rely on the transformation of the input images into 8-by-8 blocks followed by retaining the strongest coefficients, which is indeed a sparsifying transform.&lt;/p&gt;&#xA;&lt;p&gt;When noise is added to a signal, its frequencies get mixed or added to the frequencies of the noise-free signal. For example, white noise adds non-zero values to the whole spectrum. Thus, finding a sparse approximate of a noisy signal (in a good basis of course) yields usually a good denoising performance.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;BM3D mechanics&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The 3D transform of BM3D is actually a 2D+1 transform.&lt;/p&gt;&#xA;&lt;p&gt;Algorithmically, this is what happens (I'll describe the mathematical intuition afterwards):&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;make a stack of similar patches. All the patches of the stack are supposed to be small &lt;strong&gt;variants&lt;/strong&gt; of the same ideal (noise free) patch. The &lt;em&gt;variant&lt;/em&gt; term is important, you'll see why later;&lt;/li&gt;&#xA;&lt;li&gt;take a 1D transform (DCT / wavelet) along one of the horizontal axes;&lt;/li&gt;&#xA;&lt;li&gt;take a 1D transform (DCT / wavelet) along the other. What you have now is a stack of transformed patches;&lt;/li&gt;&#xA;&lt;li&gt;now, take the transform of choice (DCT / wavelet / Wiener filtering) along the vertical axis. What you are doing here is taking a transform (DCT / wavelet) or directly computing a denoised value (Wiener filtering) for each point in the vertical column;&lt;/li&gt;&#xA;&lt;li&gt;(optional) if you used DCT / wavelet transform, apply a sparsifying transform, usually hard thresholding.&lt;/li&gt;&#xA;&lt;li&gt;Then, compute the denoised patches by inverting the different transforms (in reverse order);&lt;/li&gt;&#xA;&lt;li&gt;now, back project the result to the original patch locations. Patches can (and will) overlap when you denoise the whole image. This raises an important practical question: how do you fuse the results on overlapping areas? Which denoised patch is the most reliable? BM3D uses Eq. 5 to fuse the results by a weighted averaging: the weight of a back-projected patch is inversely proportional to the variance in the patch stack. When the variance of the stack is high, it means that the patches did not really come from the same ideal one, and thus the result is marked as less reliable.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Mathematically, the intuition is that most patches should be sparse in some good domain (typically, DCT domain for &lt;span class=&quot;math-container&quot;&gt;$8 \times 8$&lt;/span&gt; patches).&#xA;BM3D also supposes that patches in a stack are variants of a same patch, and thus the variations between these transformed patches and the ideal patch (in the transformed domain) should also be sparse. This assumption is enforced by the 3rd transform and the hard thresholding step.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2021-11-23T08:37:34.283" LastActivityDate="2021-11-23T08:37:34.283" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13385" PostTypeId="2" ParentId="13363" CreationDate="2013-12-26T21:04:44.860" Score="0" Body="&lt;p&gt;For a Spectrum Analysis using matlab FFT function you need get the first half values from your absolute FFT result and you leave to get two spikes, take a look in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;Nyquist Shannon sampling theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe are you confusing about FFT size and Sample rate, when you say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My sample rate is 2048 samples per second&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Are you right ? for me 2048 is your FFT size and not the Sample rate &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;against a frequency step of 16/2048&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If i understood well it is your frequency resolution, if it is true are you limited by your sample rate and you never will be able to find 16Hz from the FFT!&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2013-12-26T21:04:44.860" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="13386" PostTypeId="2" ParentId="12895" CreationDate="2013-12-26T22:41:08.030" Score="2" Body="&lt;p&gt;well, it depends on how &lt;i&gt;similar&lt;/i&gt; the audio signal from the two tracks are.  i dunno if the two tracks are identical, to within some degree of error &lt;i&gt;or noise&lt;/i&gt;, and to within some degree of time alignment, but  somehow, in a manner that is salient to your model or to your problem, you have to have a measure of &lt;b&gt;something&lt;/b&gt; in the two signals to align.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_x(t) = f\left\{ x(t) \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_y(t) = f\left\{ y(t) \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;be that &lt;b&gt;something&lt;/b&gt; that defines what it is you're trying to synchronize.   so you want to find a delay offset $\tau$, that maximizes the cross-correlation between $a_x(t)$ and $a_y(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{xy}(\tau) = \int_{-\infty}^{+\infty} a_x\left(t+\frac{\tau}{2}\right) a_y\left(t-\frac{\tau}{2}\right) w(t) \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with whatever window function $w(t) \ge 0$ you like best.  find the $\tau$ that maximizes $R_{xy}(\tau)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so i'm not telling you how to do this using discrete-time code.  you get to figure that out.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-26T22:41:08.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13387" PostTypeId="2" ParentId="13383" CreationDate="2013-12-26T23:25:06.167" Score="1" Body="&lt;p&gt;Not at all. By definition, the components are orthogonal.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-26T23:25:06.167" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13388" PostTypeId="2" ParentId="13370" CreationDate="2013-12-27T01:35:30.710" Score="0" Body="&lt;p&gt;You are absolutely correct, the frequency resolution $f_R$ (or bin width) should be calculated based on the length of FFT, $N_{FFT}$ (i.e. $f_R=\frac{f_s}{N_{FFT}}$), instead of the length of the original captured signal $N$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe most journals/books out there simply assume ($N=N_{FFT}$) in their sample calculation, and use the notation of $f_R=\frac{f_s}{N}$ throughout their books/papers. But when $N{\neq}N_{FFT}$ as in method #2, then the $f_R=\frac{f_s}{N}$ could to lead confusion among newbies (like myself). So a safer way is to use $f_R=\frac{f_s}{N_{FFT}}$ instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prove this, below are the output of 5Hz + 30Hz sinusoids ($f_s$=1024Hz, duration=4s, 4096 data points), and it's output with the FFT-512, and FFT-4096 respectively. You can see the frequency resolution (or bin width) of the FFT-512 output (3rd plot) is wider than FFT-4096 (2nd plot), since $\frac{f_s}{512}&amp;gt;\frac{f_s}{4096}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N1mMO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7382" LastEditorUserId="7382" LastEditDate="2015-11-11T19:21:29.390" LastActivityDate="2015-11-11T19:21:29.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13390" PostTypeId="1" AcceptedAnswerId="13392" CreationDate="2013-12-27T05:01:56.043" Score="0" ViewCount="279" Body="&lt;p&gt;there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me have a noisy speech signal $y(k)$ as below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(k) = x(k) + v(k) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where, $k$ is the discrete-time index, $x(k)$ is clean speech signal, $v(k)$ is a zero-mean random process, uncorrelated with $x(k)$ e.g. white noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we put into this as a vector form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \textbf{y} (k)  = \textbf{x}(k)+\textbf{v}(k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \textbf{y}(k) = [y(k)  \text{ }\  y(k-1) \text{ }\ ... \text{ }\ y(k-L+1)]^T,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L$ is a length of vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we try to calculate the correlation matrix of size $L \times\ L$, the noisy speech signal can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \textbf{R}_y = E[\textbf{y}(k)\textbf{y}^T(k)] = \textbf{R}_x+\textbf{R}_v.$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, $\textbf{R}_x = E[\textbf{x}(k)\textbf{x}^T(k)]$, $\textbf{R}_v = E[\textbf{v}(k)\textbf{v}^T(k)]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the speech signal is not the stationary signal but the transient signal.&#xA;This correlation matrix also can be used for calculating &lt;strong&gt;MVDR&lt;/strong&gt;(Minimum Variance Distortionless Response) process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I want to know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because $\textbf{y}(k)$ is not the stationary signal, I think there is a method for calculating the correlation matrix for transient signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can we calculate the cross-correlation matrix for transient signal?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above article is in the below. If there is any problem, I do delete this post. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jingdong Chen, Jacob Benesty, Yiteng Huang, and Tomas Gaensler(2011), &quot;&lt;em&gt;On single channel noise reduction in the time domain&lt;/em&gt;,&quot;  Acoustics, Speech and Signal Processing (ICASSP), 2011 IEEE International Conference on, On page(s): 277 - 280.&lt;/p&gt;&#xA;" OwnerUserId="4639" LastActivityDate="2013-12-27T05:19:43.610" Title="how to calculate cross correlation of transient signal?" Tags="|cross-correlation|matrix|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13391" PostTypeId="2" ParentId="13370" CreationDate="2013-12-27T05:04:22.677" Score="-1" Body="&lt;p&gt;The frequency resolution of a DFT operation is solely dependent on the #of samples ($N_s$)only. Taking a larger than $N_s$ length DFT implicitly makes use of zero-padding in matlab. This does not increase the frequency resolution (though it may appear so when you see the plots) and rather makes use of spectrum obtained without zero-padding to interpolate to the increased DFT length sample values. This operation helps in smooting the appearance of the spectrum and resolving potential ambiguities between the peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you are dividing the signal into frames and DFT of each frame will have thus a lower fundamental resolution (dependent on the number of sample you use 512 now). You are seeing good resolution (though the second case has poor resolution than first) because the sampling fvequency is much higher than the signal content frequencies hence you have captured enough number of cycles of the constituent components in both cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach of dividing the signal into frames and doing then averaging the resulting spectrum^2 (energy in the frequency domain) is used in power spectral density computation of stochastic (deterministic (sine waves)+noise) signals where number of available samples is always a limitation, hence it is appropriate to deduce interpretation from an average PSD than a single PSD estimate.&lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2013-12-27T05:04:22.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13392" PostTypeId="2" ParentId="13390" CreationDate="2013-12-27T05:19:43.610" Score="1" Body="&lt;p&gt;Correct speech signal is non-stationary. Hence, you have to stop here as whole dsp is based on stationary assumption, as of now at least to a larger extent. But as we cannot sit idle, we go ahead with quasi-stationary assumption. Take a window (rect/hamming/hanning - these have trade-offs) of 20-30 msec (this is different for male/female/music and is taken as 3-4 pitch periods in speech signal, you can keep it fixed at 30 msec (also referred as narrowband speech processing to get an intuition). Using this window break the speech signal into frames by windowing and shifting the window and extracting a frame for every window. You now have a bag of window length vectors of the given speech signal. Find auto-corr of these for any further processing as within the window the signal is assumed to be stationary (! though not exactly but better than the whole signal). &lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2013-12-27T05:19:43.610" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13393" PostTypeId="1" AcceptedAnswerId="13426" CreationDate="2013-12-27T05:42:02.243" Score="0" ViewCount="202" Body="&lt;p&gt;It has been said a picture is worth a thousand words!&#xA;There have been a large number of softwares to write dsp codes and analyze signals and algorithms. It will be good to share on data plotting tools, that is - given a data set (1-d, 2-d, 3-d, ..higher dimensions (creative ways to visualize this)) what are the different tools available and advantages of each for plotting such data sets.&#xA;Advantages can be with respect to:&#xA;(a) quick/easy plotting&#xA;(b) formats of fugures (.eps, .svg) file which can be generated&#xA;(c) latex font embedding easiness&#xA;(d) post script figures &#xA;Tools like: matlab, octave, gnuplot, tikz, pgf etc are widely used by many of us. It would be useful to share your experiences (advantages/disadvantage) and best plot you have drwan using the tool you prefer!&lt;/p&gt;&#xA;" OwnerUserId="4342" LastEditorUserId="4342" LastEditDate="2013-12-27T14:15:07.137" LastActivityDate="2013-12-29T18:03:06.213" Title="What plotting / visualization tools are useful in generating good plots?" Tags="|dsp-core|visualization|" AnswerCount="1" CommentCount="0" ClosedDate="2014-01-10T22:46:56.117" ContentLicense="CC BY-SA 3.0" />
  <row Id="13395" PostTypeId="1" CreationDate="2013-12-27T02:16:51.440" Score="2" ViewCount="909" Body="&lt;p&gt;I'm a bit confused with some details about frequency domain or studying systems with Laplace and Fourier analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we have a system with a transfer function $H(s)$ with no poles and zero's at origin. We know that the transfer function is a ratio between output and input. Also, an input of $X(s)=1$ represents a single impulse (Dirac) in time domain, which can be viewed as a signal containing all frequencies in frequency domain. Also, applying this input to the system will lead to an output $Y(s)$ which is equal to $H(s)$ which is like the system's unique characteristic (its transfer function) and also can be viewed as a response to all frequencies. This signal $H(s)$ can be transformed back to time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we have a system whose impulse response is something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yOuwD.gif&quot; alt=&quot;Impulse response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I studied Fourier Transform we used to study system's response and Bode plot by analysing variations in $\omega$. So, for example, making $\omega=0$ we could find the system's DC gain. Making $\omega$ low values we can observe the system response to low frequencies and the same for high frequencies with high values in $\omega$. It was very useful to study filters, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But note that all of this is only using the transfer function. And the transfer function may have an appearance like this above. And this does not make sense to me. If we think of the time-&gt;frequency transform, we should think that in frequency domain we are finding all frequencies which compose our signal in time domain, correct? This explains the Dirac containing all frequencies, for example. So, when making s=0 we should find H(s)=0 since this signal above does not have a DC level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we think about the transfer function as a system response to $X(s)=1$ it seems ok. But if we think about the transfer function as the same representation of this signal above, it does not make any sense. Also, if we apply a step signal, our system may respond like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wMZ6R.jpg&quot; alt=&quot;Step response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We saw that for this system (with no poles at origin), we can find something like $H(0)=K$ which represents the system's DC gain. Applying a step response will lead us to a signal $\frac{H(s)}{s}$. So now making now s=0 will lead us to $+\infty$. Again, if we think of this signal being the one above but represented in frequency domain, making s=0 should left us a DC finit level since the time domain representation show us that the signal contain a limited DC level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the final and initial value theorems but still I want to understand these relations between these domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if we want to study a filter response, we should apply some signal to the input and see what is the output. Mathematically we should convolute these signals in time domain or multiply in frequency domain and see what is the resulting signal. In time domain it all makes sense since we just convolute and see the system's response. In frequency domain it also makes sense just like the case where you use $X(s)=1$ which represents all frequencies and multiply by the system and see the resulting signal. But when thinking about the same signal being represented in both domains, I think I'm messing things up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want a help to understand relations between 's' variable and time domain. Making s=0 shouldn't lead me to the DC component of the signal in time domain? Generically, each value of 's' shouldn't lead me to 'how much' of this frequency is present in this signal?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;in short:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal like the first one does not have any DC component so it goes to zero when $t=\infty$. So why its representation in frequency domain have a DC component when we put s=0?&#xA;Also, the second signal does have a DC level when $t=\infty$. But in frequency domain the signal goes to $\infty$ when s=0 (which I thought it should represent DC level).&#xA;It happens with Heaviside function too. Its representation in frequency domain is $\frac{1}{s}$ altough when s=0 it goes to $\infty$. But it has a DC limited component. How do we explain all of that?&lt;/p&gt;&#xA;" OwnerUserId="7389" OwnerDisplayName="Felipe_Ribas" LastEditorUserId="7389" LastEditDate="2013-12-27T18:21:26.753" LastActivityDate="2013-12-27T19:28:19.043" Title="Frequency domain confusion" Tags="|frequency|fourier|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13396" PostTypeId="2" ParentId="13395" CreationDate="2013-12-27T17:49:25.920" Score="1" Body="&lt;p&gt;The impulse response and the transfer function of an LTI system are different, sometimes extremely different (except for a specific shape of Gaussian).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DC component of any impulse response is it's average value.  Your example time-domain squiggle seems to have a non-zero average value (integrate to determine the area under the curve), thus is has a non-zero DC component in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-12-27T19:28:19.043" LastActivityDate="2013-12-27T19:28:19.043" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13397" PostTypeId="2" ParentId="13395" CreationDate="2013-12-27T18:52:33.397" Score="0" Body="&lt;p&gt;There appears to be some confusion between Laplace and Fourier ,,frequencies'' - Actually, only the bases of the Fourier domain are periodic. The Laplace domain is only formally similar. Actually, in both cases, a parameter of $0$ will display ,,the DC part of the signal'', which makes it even harder to understand. Additionally, you seem to confuse $t$ and $s$. With $s=0$, you're trying to express a step at time $0$, which the Laplace transform just doesn't do well. You could take a limit, however.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-27T18:52:33.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13398" PostTypeId="2" ParentId="12843" CreationDate="2013-12-27T18:57:53.217" Score="0" Body="&lt;p&gt;You should evaluate the phase of your filter at the frequency of interest. This will tell you how much this frequency is going to be delayed.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-27T18:57:53.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13399" PostTypeId="2" ParentId="13324" CreationDate="2013-12-27T19:02:17.620" Score="0" Body="&lt;p&gt;The pitches in almost all Western music divide a 2:1 frequency ratio into 12 fairly-close to equally spaced ratios (2^(1/12) or about 1.0595), with slight variations depending on the temperament of the scale.  8 of those 12 frequency steps are whole notes in a typical major or minor scale (the other four frequency steps are sharps or flats within that scale).  The 8 scale steps provides for an 8 note musical octave of scale note pitches within a DSP octave over the same 2:1 range of frequencies.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-12-27T19:02:17.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13400" PostTypeId="2" ParentId="13353" CreationDate="2013-12-27T19:12:24.950" Score="1" Body="&lt;p&gt;There is a massive range of possible sounds that a human might recognize (or mis-recognize) as the same word in their language.  The problem is searching a large dimensional space representing all those possibilities (continuous variations of spectral and timing differences) for the closest match, perhaps also given some context around the search target for the most probable of multiple near matches.  This is a computational complexity problem that can sometimes be reduced in time by more computational power (a 1000 processor server or supercomputer might be able to do it in less than &quot;seconds&quot; of delay).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can search over less degrees-of-freedom with less robustness or accuracy, and perhaps miss most possible word matches.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-12-27T19:12:24.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13401" PostTypeId="2" ParentId="9877" CreationDate="2013-12-27T19:41:35.573" Score="18" Body="&lt;p&gt;If the spectrogram was computed as the magnitude of short time fourrier transforms from &lt;strong&gt;overlapping&lt;/strong&gt; windows, then the spectrogram contains implicitly some phase information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following iterations do the job :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_{n+1} = \text{istft}(S\cdot\exp(i\cdot\text{angle}(\text{stft}(x_n))))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S$ is the spectrogram, $\text{stft}$ is the forward-short time Fourier transform, $\text{isft}$ is the inverse-short time Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="7390" LastEditorUserId="80" LastEditDate="2017-09-13T10:51:13.737" LastActivityDate="2017-09-13T10:51:13.737" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13402" PostTypeId="1" CreationDate="2013-12-27T19:59:03.873" Score="5" ViewCount="1318" Body="&lt;p&gt;Matlab documentation says things like:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For high order filters, the state-space form is the most numerically accurate, followed by the zero-pole-gain form. The transfer function coefficient form is the least accurate; numerical problems can arise for filter orders as low as 15.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/ref/besself.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/help/signal/ref/besself.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Conversions between the TF, ZPK, and SS representations involve numerical computations and can incur loss of accuracy when overused. Because the SS and FRD representations are best suited for numerical computations, it is good practice to convert all models to SS or FRD and only use the TF and ZPK representations for construction or display purposes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/products/demos/shipping/control/GSModelTypeConversions.html?product=CT#9&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/products/demos/shipping/control/GSModelTypeConversions.html?product=CT#9&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;You can represent numeric system components using any model type. However, Numeric LTI model types are not equally well-suited for numerical computations. In general, it is recommended that you work with state-space (ss) or frequency response data (frd) models, for the following reasons:&lt;/p&gt;&#xA;&lt;p&gt;The accuracy of computations using high-order transfer functions (tf or zpk models) is sometimes poor, particularly for MIMO or high-order systems. Conversions to a transfer function representation can incur a loss of accuracy.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/control/ug/conversion-between-model-types.html#f3-1039600&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/help/control/ug/conversion-between-model-types.html#f3-1039600&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand why &lt;code&gt;zpk&lt;/code&gt; is better than &lt;code&gt;tf&lt;/code&gt;, and know that &lt;code&gt;ss&lt;/code&gt; can handle MIMO systems that the others can't, but is &lt;code&gt;ss&lt;/code&gt; also numerically better than &lt;code&gt;zpk&lt;/code&gt;?  Why?  Matlab generates filter prototypes in &lt;code&gt;zpk&lt;/code&gt; and then converts them to &lt;code&gt;ss&lt;/code&gt; for doing filter transformations, which seems odd since you can do the filter transformations directly in &lt;code&gt;zpk&lt;/code&gt; without converting back and forth.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2021-07-08T02:27:09.920" Title="Why is state-space representation more numerically stable than zeros-poles representation?" Tags="|filter-design|transfer-function|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13403" PostTypeId="2" ParentId="13381" CreationDate="2013-12-27T20:55:20.870" Score="1" Body="&lt;p&gt;You can compute the phase of the function by taking inverse tangent of imaginary part divided by the real. Check out this &lt;a href=&quot;http://mathworld.wolfram.com/ComplexNumber.html&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; on how to compute the real and imaginary parts. The real part is computed by taking 1/2*(z + conj(z)) and the imaginary follows a similar process. Once you have those just divide them and take the inverse tangent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obtaining the group delay would require taking the derivative of that result. Feel free to use Wolfram Alpha to check your work.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-12-27T20:55:20.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13404" PostTypeId="1" CreationDate="2013-12-28T00:42:41.580" Score="0" ViewCount="312" Body="&lt;p&gt;I have this linear system that is defined by the differential equation &#xA;    $$&#xA;    y''(t) + 4y'(t) + 5y(t) = 2x(t) + 3x'(t)&#xA;    $$&#xA;with x(t) the input and y(t) the output. I'm asked to find two things: The output when x(t) = cos(t), and the impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I did: First, I found the frequency response,H(f)&#xA;    $$&#xA;    H(f) = \frac{2 + 6\pi fj}{8\pi fj -4\pi^2 f^2+5}&#xA;    $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, I found the Fourier Transform of cos(t) which equals to: &#xA;    $$&#xA;    X(f) = \frac{1}{2}\delta (f-\frac{1}{2\pi }) + \frac{1}{2}\delta (f+\frac{1}{2\pi })&#xA;    $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the output basically would be&#xA;    $$&#xA;    Y(f) = H(f)\ X(f)&#xA;    $$&#xA;Is it possible to simplify the answer of Y(f)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second part of the question, I found the impulse response using Laplace Transform&#xA;    $$&#xA;    h(t) = [\frac{-17}{6} e^{5t} - \frac{1}{6} e^{-t}]u(t)&#xA;    $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think about my answer? Is it possible to use Z-transform to find h(t)?&lt;/p&gt;&#xA;" OwnerUserId="7391" LastEditorUserId="7391" LastEditDate="2013-12-30T06:08:03.570" LastActivityDate="2013-12-30T06:08:03.570" Title="Solving linear system and find impulse response" Tags="|frequency|frequency-response|impulse-response|linear-systems|" AnswerCount="0" CommentCount="11" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13405" PostTypeId="1" CreationDate="2013-12-28T04:41:08.523" Score="14" ViewCount="38939" Body="&lt;p&gt;I have no background in telecommunication. Could anyone please explain to me what is the IQ data in telecommunication? It will be best to explain it with some basic analogies. Many thanks!!&lt;/p&gt;&#xA;" OwnerUserId="7392" LastActivityDate="2023-10-16T10:29:17.637" Title="What is IQ Data?" Tags="|digital|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13406" PostTypeId="1" AcceptedAnswerId="13411" CreationDate="2013-12-28T10:36:03.830" Score="2" ViewCount="487" Body="&lt;p&gt;If we have an Image I and a Gabor filter created at specific size and orientation, assume that is &lt;code&gt;11x11&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw some persons who normalize the size of the filter, but i didn't understand what was meant by &quot;precalculate the normalization of the filter size&quot;. And within the normalization, they square the image, for example : &lt;code&gt;Isquare = I^2&lt;/code&gt;. So why the image is squared ?&lt;/p&gt;&#xA;" OwnerUserId="6925" LastActivityDate="2013-12-28T14:27:46.023" Title="Precalculate the Normalization of a filter size" Tags="|image-processing|filters|gabor|normalization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13407" PostTypeId="2" ParentId="12774" CreationDate="2013-12-28T10:41:03.673" Score="1" Body="&lt;p&gt;The wavelet function in a continuous WT needs to satisfy certain, relatively weak, admissibility conditions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the discretized CWT to work, one needs that the shifted and scaled functions corresponding to the choice of $a$ and $b$ form a frame. This gives slightly stronger conditions for the mother wavelet, but essentially this can always be satisfied if $a-1$ and $b$ are chosen small enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even when $a=2$ and $b=1$ still satisfies the frame conditions, there is no guarantee that there exists a father wavelet or scaling function that complements the wavelet frame to a multiresolution analysis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need a MRA with finite filters to implement a fast wavelet transform with a theoretically sound sampling mechanism valid for all scales and depths of the transform. Essentially, you need a continuous father wavelet with a compact peak as its main feature to justify the initialization of the FWT by just sampling the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the opposite direction, not all filter bank systems that have satisfying properties for a fast discrete WT (for a small depth of the FWT recursion) lead back to a MRA, the scaling equation may have no continuous solution.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2013-12-28T10:41:03.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13408" PostTypeId="1" AcceptedAnswerId="13420" CreationDate="2013-12-28T13:14:36.503" Score="1" ViewCount="840" Body="&lt;p&gt;I am trying to understand the equivalence of convolution through polynomial (coefficient) multiplication, Fast Fourier Transforms, and matrix multiplication. I am using octave with the octave-signal package, and part of this question may possibly related to their implementation (which I believe would be the same for MATLAB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I create my original signal with length $N$, and my boxcar window length is $n$.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 48; &#xA;n = 6; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use $\sin$ as the input function for this example. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dt = 2*pi/N;&#xA;t = [-N/2:N/2-1]'*dt;&#xA;f = sin(t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Convolution by polynomial multiplication ($g = h \star f$):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = ones(n,1);&#xA;g_conv = conv(h,f);&#xA;g_conv_same = conv(f,h,'same');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Convolution by FFT and FFT with zero-padding of the input (also $g = h \star f$):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;g_ft = real(ifft(fft(h,N).*fft(f)));&#xA;&#xA;f_padded = [f; zeros(n-1,1)]; % append zeros&#xA;g_ft_padded = real(ifft(fft(h,N+n-1).*fft(f_padded)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Convolution by matrix multiplication ($\mathbf{g} = \mathbf{A} \mathbf{f}$):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = convmtx(h,N);&#xA;g_mtx = A*f;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{A}$ looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1zmTG.png&quot; alt=&quot;convolution matrix&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find indices to trim arrays:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;idx_A = find(sum(A,2) == n);&#xA;idx_t = 1:length(idx_A);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Plot results (the signals convolved by different methods):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(t(idx_t),g_mtx(idx_A),'k','linewidth',3);&#xA;line(t-5*dt,g_ft,'color','g','linewidth',2);       %-&amp;gt; offset by 5*dt&#xA;line(t-7*dt,g_ft_padded(1:length(t)),'color','r','linestyle','--'); %-&amp;gt; offset by 7*dt&#xA;line(t(idx_t),g_conv(idx_A),'color','b','marker','o');&#xA;line(t-2*dt,g_conv_same,'color','b','marker','+'); %-&amp;gt; offset by 2*dt&#xA;legend({'matrix','FFT','FFT (padded)','conv','conv (same shape)'},...&#xA;       'location','southeast')&#xA;xlabel('x value')&#xA;ylabel('y value')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BYg8n.png&quot; alt=&quot;plots of convolved signals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have several questions at this point:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why are the results for the FFT methods offset by several units of &lt;code&gt;dt&lt;/code&gt;? &lt;/li&gt;&#xA;&lt;li&gt;If I pad the FFT results such that the input vector is no longer periodic (red dotted line), why do I miss part of the convolved function (on the right side) in the result?&lt;/li&gt;&#xA;&lt;li&gt;How do I treat the ends for the FFT convolution so that the results are aligned with the polynomial and matrix multiplication results?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. P.S. if there is a good textbook reference for these details I would appreciate your guidance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I have edited for clarification.)&lt;/p&gt;&#xA;" OwnerUserId="5362" LastEditorUserId="128" LastEditDate="2020-03-11T06:32:40.973" LastActivityDate="2020-03-11T06:32:40.973" Title="Equivalence of Convolution Through Polynomial and Matrix Products" Tags="|matlab|fourier-transform|convolution|linear-algebra|octave|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13409" PostTypeId="2" ParentId="13408" CreationDate="2013-12-28T13:26:08.637" Score="2" Body="&lt;p&gt;Convolution and polynomial multiplication are equivalent by definition. Offsets are usually introduced through indexing. The treatment of ends is important.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-28T13:26:08.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13410" PostTypeId="2" ParentId="13406" CreationDate="2013-12-28T13:29:57.247" Score="1" Body="&lt;p&gt;Normally, ,,normalization'' means to make the L2 norm (sum of squares) of a signal $1$. This is usually achieved by calculating the inverse of the sum of squares and multiplying by it.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-28T13:29:57.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13411" PostTypeId="2" ParentId="13406" CreationDate="2013-12-28T14:27:46.023" Score="3" Body="&lt;p&gt;Each pixel of the filter has a magnitude (intensity). The square function equivalently calculate the power density of the pixel. The normalization is to scale the filter power to 1. That's where &lt;code&gt;I^2&lt;/code&gt; at the denominator comes from.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2013-12-28T14:27:46.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13414" PostTypeId="1" AcceptedAnswerId="13416" CreationDate="2013-12-28T19:50:57.043" Score="1" ViewCount="2488" Body="&lt;p&gt;I red this &lt;a href=&quot;https://dsp.stackexchange.com/questions/7537/grayscale-morphology/8662#8662&quot;&gt;link&lt;/a&gt;, but unfortunately i still don't understand the process...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, Dilation process is performed by laying the structuring element H on the image I and sliding it across the image in a manner similar to convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The grayscale morphological dilation formula is written as follows :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[I ⊕ H](u,v) = \displaystyle\max_{(i,j)∈H}\{I(u-i,v-j)+H(i,j)\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume a greyscale image I of size 2x3, such that &lt;code&gt;I=[1 2 3; 3 7 2]&lt;/code&gt;; and a structuring element H of size 1x4, such that &lt;code&gt;H= [0 0 7 7]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are u,v and i,j? Please can someone explain to me in details how the formula is computed at each element of I in order to obtain the new image &lt;code&gt;dilated_I&lt;/code&gt; ? Because i still don't understand well the concept..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What was meant by a structuring element that contains only the origin ? i didn't understand well the concept behind grayscale dilation.&#xA;Any help will be very appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6925" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-03-02T18:31:01.013" Title="Computations in Grayscale morphology dilation" Tags="|image-processing|morphological-operations|morphology|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13415" PostTypeId="2" ParentId="13055" CreationDate="2013-12-28T21:04:52.410" Score="1" Body="&lt;p&gt;Yes. Your code does compute the same thing as the formula from the paper.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-28T21:04:52.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13416" PostTypeId="2" ParentId="13414" CreationDate="2013-12-28T21:49:16.020" Score="1" Body="&lt;p&gt;Structuring element is mostly supposed to be a binary array (though you can try 0 0 7 7 by yourself). &lt;code&gt;H=[0 0 1 1]&lt;/code&gt;&#xA;&lt;code&gt;u&lt;/code&gt;, &lt;code&gt;v&lt;/code&gt; are the pixel coordinate at &lt;code&gt;I&lt;/code&gt;. In your example, the only pixel value that will change is &lt;code&gt;I(1,2)&lt;/code&gt; (the array label starts from 0 instead of 1).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I =  1     2     3&#xA;     3     7     2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Consider &lt;code&gt;I(1,2)&lt;/code&gt;, from the formula, &lt;code&gt;I(1,2)&lt;/code&gt; &lt;code&gt;I(1,1)&lt;/code&gt;, and &lt;code&gt;I(1,0)&lt;/code&gt; will be considered.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I(1,2) = max( I(1-0,2-0) + H(0,0), I(1-0,2-1) + H(0,1), ...&#xA;              I(1-0,2-2) + H(0,2), )&#xA;       = 7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's the pixel value at &lt;code&gt;(1,2)&lt;/code&gt; after dilation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will show you &lt;code&gt;I(1,1)&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I(1,1)=max(I(1-0,1-0)+H(0,0), I(1,0,1-1)+H(0,1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is still the original &lt;code&gt;I(1,1)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, SE can has any values in its elements, but in Matlab, &lt;code&gt;imdilate&lt;/code&gt; only accepts &lt;a href=&quot;http://nf.nci.org.au/facilities/software/Matlab/toolbox/images/imdilate.html&quot; rel=&quot;nofollow&quot;&gt;binary SE&lt;/a&gt; as a mask to determine the dilation region. You can still use &lt;code&gt;[0 0 7 7]&lt;/code&gt; in your own calculation of dilation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As your suggestion, I am showing you an example with SE of 3X3 size. I will calculate &lt;code&gt;I(2,2)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I =  1     2     3 &#xA;     3     7     2&#xA;     3     7     2&#xA;H =  1     0     0&#xA;     0     1     1&#xA;     1     0     1&#xA;&#xA;I(2,2) = max( I(2-0,2-0) + H(0,0), I(2-0,2-1) + H(0,1), I(2-0,2-2) + H(0,2),...&#xA;              I(2-1,2-0) + H(1,0), I(2-1,2-1) + H(1,1), I(2-1,2-2) + H(1,2),...&#xA;              I(2-2,2-0) + H(2,0), I(2-2,2-1) + H(2,1), I(2-2,2-2) + H(2,2))&#xA;       = 7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2013-12-28T23:45:47.970" LastActivityDate="2013-12-28T23:45:47.970" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="13417" PostTypeId="2" ParentId="13405" CreationDate="2013-12-29T03:26:11.147" Score="10" Body="&lt;p&gt;Here is a &lt;a href=&quot;https://web.archive.org/web/20141009215430/http://www.ni.com/white-paper/4805/en/&quot; rel=&quot;nofollow noreferrer&quot;&gt;good article&lt;/a&gt; from National Instruments. In general, we ask on this site that you put in more effort into your question, e.g. links to articles that you've already looked at and things you haven't understood. Otherwise, you'll simply get an answer which is the first link you get from Google when typing in your question.&lt;/p&gt;&#xA;&lt;p&gt;In a nutshell, I/Q takes advantage of sine and cosine signals being mathematically orthogonal to each other, and therefore separable with very little amount of effort. This means that with appropriate care taken, you can modulate one signal with a sine wave, another one with a cosine wave (they are simply delayed versions of each other), and still be able to separate these two signals at the receiver even though their frequency spectrum overlaps.&lt;/p&gt;&#xA;&lt;p&gt;If this is either completely over your head, or completely obvious to you, edit your question with clarifications of how much you understand. Otherwise it's impossible to give you the exact answer you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="7092" LastEditDate="2023-10-16T10:29:17.637" LastActivityDate="2023-10-16T10:29:17.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13418" PostTypeId="1" AcceptedAnswerId="13430" CreationDate="2013-12-29T10:15:40.917" Score="0" ViewCount="99" Body="&lt;p&gt;Doing excersies from Richard Hammings book about digital filters I've got two questions about them:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Fourier expansion of $g(x) = \sin^5(x)$. Provided answer is: $\sin^5(x)=5\sin(x)-20 \sin(3 x)+16\sin(5 x)$. Which is obviously contradicts well-known &lt;a href=&quot;http://www.wolframalpha.com/input/?i=sin%5E5x&quot; rel=&quot;nofollow&quot;&gt;solution&lt;/a&gt;. Is it mistake in a book or author meant something another?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)The second excersice which confusing me is expansion in compex notation of $g(x) = \exp^ {\alpha x}$. I got the following form of coefficients: $c_{k} = {\frac {1} {(2\pi)}} (\exp^{\alpha\pi}  - \exp^{-\alpha\pi}){\frac {(-1)^k} {(\alpha-ik)}}$. These coefficients looks a little bit frightening to me and I don't know how to check them... Any ideas how to validate solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="7052" LastEditorUserId="7052" LastEditDate="2013-12-30T09:02:35.077" LastActivityDate="2013-12-30T09:02:35.077" Title="Two basic questions related to complex Fourier series" Tags="|fourier-series|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13419" PostTypeId="1" AcceptedAnswerId="13424" CreationDate="2013-12-29T14:48:51.173" Score="4" ViewCount="9484" Body="&lt;p&gt;In image processing, why do we always use odd square kernels(3x3, 5x5, 7x7, etc.) for filters? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why can't we use kernels of size 3x1, 5x3, etc. that are rectangular kernels? Also, why do we not prefer even kernels (2x2, 4x4, 6x6, etc.)?&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="76" LastEditDate="2014-01-01T15:29:07.907" LastActivityDate="2018-05-26T23:18:11.643" Title="Why do we always use square kernels for filters?" Tags="|image-processing|filters|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13420" PostTypeId="2" ParentId="13408" CreationDate="2013-12-29T16:21:08.233" Score="1" Body="&lt;p&gt;A helpful construction is that of a ,,convolution unit''. If you find a signal that, convolved by itself, stays identical, then you know a lot about how your convolution algorithm works. Note that while all discrete units (all ones surrounded by zeros) are convolution units, certain implementations might introduce padding or offsets so that the resulting signal is not identical to itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, let us assume that the signal resulting from a convolution is as long as one of the original signals. It is helpful to assume that the result retains the length of the longer of the input signals. In that case, padding becomes necessary. If you look at the definition of discrete convolution, you will notice that you will have to evaluate undefined portions of the signals. It is customary to fill these up by zeros, or by repeating or reflecting the signal. There are certain merits to each custom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To meet other requirements (eg. one signal being considered symmetric), one could use other rules, in that case you could add half of the padding left to the other signal, half of it right. Then you might discard some samples and find a signal of same length, again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This explains how different implementations give different results: padding and result selection are somewhat ,,ad hoc''. Actually, some implementations give the user a choice on how to pad or what part of the signal to return.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT convolution is ,,ring convolution''. The time domain wraps around the edges. It implicitly extends the signal rotationally. This explains how it mangles your signal. Offset is a minor problem, as it is easily explained by implementation. If you want an FFT not to disturb signal ,,edges'' (the indices at the extremes of the input array), you have to pad manually, at least as long as the support of the second signal. Note that if one of the signals is shorter, you have to pad it to the same length as well for FFT convolution to be feasible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the phenomena you observed are a consequence of implementation. There is no general answer on how to pad ,,correctly'' or how you could implement convolution so that it does not introduce ,,offset'' - Actually, you're talking about different time domains, and it is a matter of convention how convolved samples are mapped.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-29T16:21:08.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13421" PostTypeId="2" ParentId="13419" CreationDate="2013-12-29T16:24:28.473" Score="3" Body="&lt;p&gt;If the kernel is odd then you can center it on top of a pixel, which is nice. Lots of kernels are symmetric, so that's probably why they are often square. You can certainly use non-square or even kernels though.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2013-12-29T16:24:28.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13422" PostTypeId="2" ParentId="13419" CreationDate="2013-12-29T16:24:34.750" Score="0" Body="&lt;p&gt;You don't. This must be the consequence of a special implementation. Convolution is defined in all these cases.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-29T16:24:34.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13424" PostTypeId="2" ParentId="13419" CreationDate="2013-12-29T16:53:14.207" Score="3" Body="&lt;p&gt;You can use whatever size of kernel you like. The kernel is not necessary to be a square especially when you want to pay more attention to process along a specific orientation. In fact, moving average along a specific axis in a image is a simple filter with rectangular shape. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gaussian filters, probably one of the most used filters in image processing, are based on gaussian function in which the top value is achieved on the axis of symmetry. This is the main reason why such kinds of kernels are preferably to be odd. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kernel size selection is often supported in the filter kernel options in the image processing packages, such as all the &lt;code&gt;imfilter&lt;/code&gt; related functions in Matlab image processing toolbox. Yet I would also like to take an high-pass filter example if you design the filters by yourself. For a square kernel with odd dimensions, the value for all filter weights can be set to a negative value, except for the center cell, which has a positive value which increases with the size of the kernel; A square kernel that has even dimensions has the positive value in the central group of four cells; A rectangular kernel has a center group of positive value cells in proportion to the kernel's dimensions. They all work as a high-pass filter.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2013-12-30T12:31:32.950" LastActivityDate="2013-12-30T12:31:32.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13425" PostTypeId="1" CreationDate="2013-12-29T17:13:51.210" Score="5" ViewCount="618" Body="&lt;p&gt;Mercury's distance from the solar system's barycenter (in kilometers) &#xA;can be approximated as: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;5.9115960588705115e7 + 1.1573608483842954e7*Cos(2.086944367456105 - 0.0029751428085695573*t) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;based on 8 years worth of hourly &quot;samples&quot; from HORIZONS. (t is in &#xA;hours; I forget what value corresponds to t=0, but it should be &#xA;irrelevant to my question). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The residuals after this approximation look like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lunwu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could add additional Fourier coefficients, but there appears to be a &#xA;period or envelope that is larger than the sample size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard Fourier analysis will never find this period, and continuous &#xA;Fourier analysis is fairly inefficient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I find this period/envelope? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps more to the point: what's the simplest function that does a &#xA;&quot;fairly good&quot; job of approximating this data? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The graph shows a pattern, so there &quot;must be&quot; such a function? &lt;/p&gt;&#xA;" OwnerDisplayName="user7409" LastActivityDate="2017-05-30T11:33:13.887" Title="How to find period/envelope that is larger than sample size?" Tags="|frequency|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13426" PostTypeId="2" ParentId="13393" CreationDate="2013-12-29T18:03:06.213" Score="1" Body="&lt;p&gt;I guess Python has great tools for this, especially IPython Notebook: &lt;a href=&quot;http://ipython.org/notebook.html&quot; rel=&quot;nofollow&quot;&gt;http://ipython.org/notebook.html&lt;/a&gt; . It has good visualization opportunities and at the same time you could document your code and make it re-configurable and online. Of course it best for visualizing data low dimensions and creative visualization algorithms can be prepared either in OpenGL or high level languages such as MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In 3D, if appropriate, time varying surfaces can be embedded in 2D and shown as a 3D volume. For generic 4D visualizations you could either use videos, or accumulated volume maps. For visualization of high dimensional data, always make sure you check methods such as Multi Dimensional Scaling. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2013-12-29T18:03:06.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13428" PostTypeId="2" ParentId="13425" CreationDate="2013-12-29T20:01:26.177" Score="0" Body="&lt;p&gt;Just like you said, this is an envelope, so decomposing the equation to a sum of Fourier coefficients would require a VERY high order, which is not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to get past the &quot;underlying&quot; signal and analyse the envelope, which can be done in several ways like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Low-Pass filter the squared signal to leave the envelope which is of low frequency,then FFT the square root of the low-passed signal.&lt;/li&gt;&#xA;&lt;li&gt;FFT the analytic signal. Use Hilbert Discrete transform to get the analytic signal and FFT its absolute value.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7410" LastActivityDate="2013-12-29T20:01:26.177" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13429" PostTypeId="2" ParentId="13425" CreationDate="2013-12-29T20:19:58.113" Score="0" Body="&lt;p&gt;The envelope appears to be just ,,beating'', that is, the result of frequencies almost, but not exactly, multiple of each other. If you can measure each component finely enough, this will also give you the correct ,,beating''. The question would be how to find all components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of Mercury, there will probably be several components. I would try windowing the available data and looking for peaks in the Frequency domain. I wouldn't be surprised, were they the inverse of the difference of Mercuries orbital period and those of other planets. Of course, a window will smear your peaks, and you could have bad luck and not separate two components which actually are distinct.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-29T20:19:58.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13430" PostTypeId="2" ParentId="13418" CreationDate="2013-12-29T20:32:46.247" Score="1" Body="&lt;p&gt;First, or second, with complex notation and the binomial theorem,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin^5 x=\left(\frac{e^{ix}-e^{-ix}}{2i}\right)^5 = \frac{e^{i5x}-5e^{i3x}+10e^{ix}-10e^{-ix}+5e^{-3ix}-e^{-i5x}}{32i} = \frac{\sin(5x)-5\sin(3x)+10\sin x}{16}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\sin(5x) &amp;amp;= Im(e^{i5x}) = Im([\cos x+i\sin x]^5) \\&#xA;&amp;amp;= 5\cos^4x\sin x - 10\cos^2x\sin^3x + \sin^5x\\&#xA;&amp;amp;= 5(1-2\sin^2 x+\sin^4 x)\sin x-10(1-\sin^2x)\sin^3x+ \sin^5x\\&#xA;&amp;amp;= 5\sin x - 20\sin^3x +16\sin ^5x&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so you got the coefficients right, but the notation reversed.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the second task, is the star connected to convolution, cepstrum transforms or similar?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, it is just $g(x)=\exp(α x)=e^{α x}$ defined on the interval $[-\pi, \pi]$. Then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;c_k&#xA;&amp;amp;=\frac1{2\pi}\int_{-\pi}^\pi g(x)e^{-ikx}dx&#xA; =\frac1{2\pi}\int_{-\pi}^\pi e^{(α-ik)x}dx&#xA;\\&#xA;&amp;amp;=\frac1{2\pi}\left[\frac{e^{(α-ik)x}}{α-ik}\right]_{x=-\pi}^{x=\pi}\\&#xA;\end{align}&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2013-12-29T20:41:21.747" LastActivityDate="2013-12-29T20:41:21.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13431" PostTypeId="1" AcceptedAnswerId="13433" CreationDate="2013-12-29T22:11:23.810" Score="0" ViewCount="642" Body="&lt;p&gt;I have some samples that are read from a square &lt;a href=&quot;https://en.wikipedia.org/wiki/Pulse_wave&quot; rel=&quot;nofollow&quot;&gt;pulse wave&lt;/a&gt; and I'm looking for a way to find the characteristics of this wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a pulse wave, let $T_1$ be the non-pulse duration and $T_2$ to be the pulse duration, usually $T_1$ is bigger than $T_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know the base frequency, e.g., the frequency that includes $T_1+T_2$.&#xA;Can I do this using an FFT?&lt;/p&gt;&#xA;" OwnerUserId="7411" LastEditorUserId="76" LastEditDate="2013-12-30T18:06:57.663" LastActivityDate="2013-12-30T18:06:57.663" Title="Find &quot;base&quot; frequency of pulse wave" Tags="|fft|frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13432" PostTypeId="1" AcceptedAnswerId="13450" CreationDate="2013-12-30T01:47:24.647" Score="3" ViewCount="1663" Body="&lt;p&gt;I'm looking at last year's exams, and I found an exercise I can't solve:&#xA;(Roughly translated)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider $x(t)=\sum\limits_{k=1}^{+\infty}\left(\frac{1}{2}\right)^k \cos(k2\pi t)$ the input to a LTI system, with the transfer function shown in the picture below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oGsf2.png&quot; alt=&quot;Transfer function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Determine (and sketch) the Fourier transform of x(t) and y(t).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) Determine the Fourier coefficients of y(t). Justify.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing that comes to mind is using the Linearity of the Fourier Transform and calculate the Transform of $\left(\frac{1}{2}\right)^k \cos(k2\pi t)$, k dependant, and $X(jw)=\sum\limits_{k=1}^{+\infty}X_k(jw)$, so it would be something like&#xA;$$&#xA;X(jw)=\sum\limits_{k=1}^{+\infty}\left[2^{-k}\pi\left[\delta(\omega-2k\pi) + \delta(\omega+2k\pi)\right]\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have never seen a Fourier Transform that looked like this, so I'm not quite sure that's correct, or, if it is, if it can be used (efficiently) for calculations, in this form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After I get $X(jw)$, I can get $Y(jw)=X(jw)H(jw)$, so right now I'm pretty much just stuck in calculating $X(jw)$. Any help is much appreciated, and feel free to ask for clarification, if something I wrote is not clear enough.&lt;/p&gt;&#xA;" OwnerUserId="7412" LastEditorUserId="7412" LastEditDate="2013-12-30T22:52:03.020" LastActivityDate="2013-12-31T06:13:32.447" Title="Fourier Transform of infinite sum" Tags="|fourier-transform|signal-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13433" PostTypeId="2" ParentId="13431" CreationDate="2013-12-30T02:16:16.207" Score="0" Body="&lt;p&gt;Of course. Sample a few cycles, window, and do a FFT. The highest peak will be found at the base frequency (T1+T2) of your wave. With &quot;spectral reassignment&quot; you might get more precise results.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-30T02:16:16.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13434" PostTypeId="2" ParentId="13432" CreationDate="2013-12-30T02:47:39.793" Score="2" Body="&lt;p&gt;i think it's pretty obvious that only the component with angular frequency of $4 \pi $ gets through the LTI system to the output.  so the output should be $\frac{1}{4} \cos(4 \pi t) $.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2013-12-30T02:47:39.793" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13435" PostTypeId="1" CreationDate="2013-12-30T08:31:18.043" Score="1" ViewCount="1079" Body="&lt;p&gt;I am doing a time series change detection experiment.  One of the experiments includes generating some artificial data for model evaluation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came across a problem in generating noise data with some arbitrary covariance at every 100 time steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While &lt;code&gt;randn&lt;/code&gt; from Matlab allows me to generate the value, I am never able to figure how to change the covariance of the data.  Is there any example that I can refer to? &lt;/p&gt;&#xA;" OwnerUserId="7413" LastEditorUserId="76" LastEditDate="2013-12-30T17:48:07.340" LastActivityDate="2014-01-31T13:17:04.407" Title="Generate noise with arbitrary covariance" Tags="|noise|homework|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13436" PostTypeId="1" AcceptedAnswerId="13441" CreationDate="2013-12-30T13:13:12.863" Score="6" ViewCount="17958" Body="&lt;p&gt;On Wikipedia there is quite a list of window functions.  However, when you are doing a lot of STFTs, you often have to have some overlap to get better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally an overlap factor of 2 (i.e., 50% overlap) works fine (I'm doing analysis &amp;amp; resynthesis), but for some windows it isn't good (I currently have this experience with the Blackman window).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried my best but I couldn't find a resource that would list the &quot;good&quot; overlap factors for common and less common windows.&lt;/p&gt;&#xA;" OwnerUserId="7415" LastEditorUserId="1273" LastEditDate="2013-12-31T01:47:06.843" LastActivityDate="2016-08-30T15:55:47.037" Title="Choosing the right overlap for a window function" Tags="|fft|window-functions|stft|" AnswerCount="4" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="13437" PostTypeId="2" ParentId="13436" CreationDate="2013-12-30T17:14:28.930" Score="2" Body="&lt;p&gt;The area under the curve of a Blackman window is less than 50% that of a rectangular window (for a von Hann window the percentage is exactly 50%).  So more information will be lost (to quantization or other noise) by the windowing process using a Blackman window than using a von Hann window (or using a rectangular window for that matter).  Using overlapping windows provides some information redundancy (the same samples will be processed multiple times into the results), so more overlap can make up for some of this loss of information.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using more overlap provides more time locality resolution as well as more informational redundancy.  However, since time resolution is also affected (blurred) by the effective window width, there will diminishing returns in using too much overlap (e.g. stop increasing overlap when your analysis process no longer sees &quot;useful&quot; differences between offset frames).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;50% overlapped von Hann windows also &quot;add up&quot; to a flat top window, which is useful for resynthesis without amplitude modulation distortion, no matter if a different window is used for analysis.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-12-30T17:19:53.060" LastActivityDate="2013-12-30T17:19:53.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13438" PostTypeId="2" ParentId="13425" CreationDate="2013-12-30T17:29:14.267" Score="2" Body="&lt;p&gt;If you can guess the number of Fourier coefficients, then a decomposition method such as MUSIC or ESPIRIT might provide a parametric estimate or eigenvector decomposition, given that guess.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-12-30T17:29:14.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13439" PostTypeId="1" AcceptedAnswerId="13446" CreationDate="2013-12-30T18:06:55.483" Score="4" ViewCount="245" Body="&lt;p&gt;I'm doing &lt;a href=&quot;http://en.wikipedia.org/wiki/Electroencephalography&quot; rel=&quot;nofollow&quot;&gt;EEG&lt;/a&gt; data collection and my amp forces use of an analog lowpass filter before the ADC. I'm &lt;em&gt;fairly&lt;/em&gt; sure that I won't be interested in phenomena associated with frequencies of 30Hz or higher, so it strikes me that the most disk-space efficient thing to do is to analog lowpass at 30Hz (it uses a Bessel filter) and tell the ADC to sample at 60Hz. However, disk space considerations aside, I'm curious whether there is any difference between this strategy and, say, setting the lowpass to something really high like 250Hz and sampling at 500Hz, then once digitized and doing analysis, applying a digital lowpass at 30Hz. Would the double filtering induce artifacts? (i.e. Should I opt for the low analog lowpass for reasons other than disk space?)&lt;/p&gt;&#xA;" OwnerUserId="7417" LastActivityDate="2013-12-31T20:16:30.060" Title="Low analog lowpass + ADC vs High analog lowpass + ADC + low digital lowpass" Tags="|filters|lowpass-filter|digital|analog|conversion|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13440" PostTypeId="2" ParentId="13439" CreationDate="2013-12-30T19:45:27.570" Score="1" Body="&lt;p&gt;A single lowpass at 30Hz with a sampling rate at 60 Hz should provide accurate data, and filtering a second time should not manipulate any components of the signal at 30 Hz and below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, be sure that if you are converting between sample rates that you don't need to interpolate between samples- 500 Hz to 60 Hz should be fine, since it's an 8:1 ratio.&lt;/p&gt;&#xA;" OwnerUserId="5824" LastActivityDate="2013-12-30T19:45:27.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13441" PostTypeId="2" ParentId="13436" CreationDate="2013-12-30T20:22:07.243" Score="8" Body="&lt;p&gt;Please refer to this &lt;a href=&quot;http://edoc.mpg.de/395068&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; on the optimum overlap percentage for the Blackman-Harris window, which is derived to be 66.1%. It has a lot of useful information on spectral analysis and windows.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2013-12-30T20:22:07.243" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13442" PostTypeId="2" ParentId="13405" CreationDate="2013-12-30T20:51:48.230" Score="7" Body="&lt;p&gt;A simple answer is that I/Q are the real and imaginary components of the complex-valued transmitted baseband signal.   In communication systems &quot;I/Q data&quot; usually refers to the real (I) and imaginary (Q) samples of the constellation for the modulation type used. There are usually a lot of I/Q &quot;samples&quot; (rather than &quot;data&quot;) that happen during interim processing.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2013-12-30T20:51:48.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13443" PostTypeId="2" ParentId="13369" CreationDate="2013-12-30T21:01:07.207" Score="1" Body="&lt;p&gt;One thing to consider is the existing spectral content of the signal being downsampled.   If there is no significant energy above 15kHz, then the anti-alias filtering requirements are certainly relaxed since it won't have to do much for a 30kHz output sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So where to put the filter cutoff frequency also depends on assumptions about the spectral content of the input signal as well as the transition band rolloff characteristics of the filter.  For a 30kHz sampling rate the 3dB cutoff point of the filter may need to be much lower than 15kHz to prevent aliasing from 15.5kHz or 16kHz (for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Much of this depends on your tolerance for the level of aliasing and at what frequencies.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2013-12-30T21:01:07.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13444" PostTypeId="2" ParentId="13363" CreationDate="2013-12-30T21:07:51.527" Score="1" Body="&lt;p&gt;Generic FFTs use complex-valued input arrays and provide complex-valued output arrays, so they can differentiate positive and negative frequencies for complex-valued signals.   For real-valued signals, which is what it sounds like your case may be, this means that the positive and negative frequencies are mirrors of each other, so the spike at 16Hz will be mirrored by a spike at -16Hz.  Matlab's FFT function output array has the positive frequencies first followed by the negative frequencies, so one would expect two spikes:  the first at 16Hz, and the second wrapped to -16Hz which will be almost at the end of the array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fftshift should have &quot;unfolded&quot; the output array so that the negative frequencies plot on the left, with DC (0Hz) in the center, and positive frequencies on the right.   You should still see two spikes, one at -16 Hz and one at +16Hz, symmetric about zero.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2013-12-30T21:07:51.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13445" PostTypeId="2" ParentId="13336" CreationDate="2013-12-30T21:16:55.283" Score="1" Body="&lt;p&gt;Do you know what sort of window function is applied before the FFT?   With strictly rectangular windowing, the &quot;scalloping&quot; due to the sinx/x response of the window functions is greatest, so that a tone exactly between bins will have its energy suppressed a bit by the minimum of the scalloping.  There are fancy window functions that reduce this (e.g., flat-top windows), but there are tradeoffs regarding resolving the frequency of the energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned, if it is possible to use a longer FFT to increase the processing gain that may serve you better than zero-padding.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2013-12-30T21:16:55.283" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13446" PostTypeId="2" ParentId="13439" CreationDate="2013-12-31T00:13:43.700" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm curious whether there is any difference between this strategy and, say, setting the lowpass to something really high like 250Hz and sampling at 500Hz, then once digitized and doing analysis, applying a digital lowpass at 30Hz&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Good idea.  This is how &lt;a href=&quot;https://en.wikipedia.org/wiki/Oversampling&quot; rel=&quot;nofollow&quot;&gt;oversampling&lt;/a&gt; ADCs work, sampling at a high rate using a poor quality converter (even a 1-bit converter), and then using digital filtering to downsample to the desired value with better accuracy.  Digital filters can have a much sharper cutoff than analog filters for essentially no cost, reducing &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;aliasing&lt;/a&gt; that would otherwise get into your recording.  It can also improve your signal-to-noise if the analog signal isn't already restricting this.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would the double filtering induce artifacts? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not unless you design the filters poorly.  :)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2013-12-31T00:13:43.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13447" PostTypeId="2" ParentId="13439" CreationDate="2013-12-31T01:13:32.873" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm curious whether there is any difference between this strategy and, say, setting the lowpass to something really high like 250Hz and sampling at 500Hz, then once digitized and doing analysis, applying a digital lowpass at 30Hz&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Neither is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filters have non-zero transition width, and Nyquist sampling requires sampling at a rate above (not at) twice the highest spectrum frequency to avoid aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So sampling at 500 Hz after using a cheap non-steep-transition 100 Hz low-pass filter, then using a higher quality 30 Hz digital low-pass filter, and resampling to some rate ABOVE 60 Hz might be a suitable possibility that lowers the cost (or gets your signal farther away from a ripply or phase distorting transition edge) of the analog front-end filter in exchange for supposedly even lower-cost computational power.  Or set the filter somewhat below 30 Hz and sample at 60 if you don't need that top end  of 30.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2013-12-31T20:16:30.060" LastActivityDate="2013-12-31T20:16:30.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13448" PostTypeId="2" ParentId="13436" CreationDate="2013-12-31T02:11:08.780" Score="-1" Body="&lt;p&gt;Maybe look for the keywords ,,shift overlap add property'' or ,,constant overlap add property'' - Some window functions have the advantage to sum up to a constant function if taken in the proper distance, as was remarked here.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-31T02:11:08.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13449" PostTypeId="2" ParentId="11405" CreationDate="2013-12-31T02:17:24.527" Score="1" Body="&lt;p&gt;Convolution will not suffice, as the impulse response of your filter seems to be infinite. You need to ,,implement'' the filter, as Hilmar suggested. Look up ,,direct form'' 1 or 2. Numerics software usually includes functions exactly for this case. In the case of GNU Octave or similar programs, the function is called ,,filter''.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-31T02:17:24.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13450" PostTypeId="2" ParentId="13432" CreationDate="2013-12-31T06:13:32.447" Score="2" Body="&lt;p&gt;I believe you are correct with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(jw)=\sum\limits_{k=1}^{+\infty}\left[2^{-k}\pi\left[\delta(\omega-2k\pi) + \delta(\omega+2k\pi)\right]\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we also have $$H(jw) = \mathbf{1}_{[-5\pi,-3\pi]} + \mathbf{1}_{[3\pi,5\pi]}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then $$Y(jw) = X(jw)\cdot H(jw)$$&#xA;$$ = \left[2^{-2}\pi\left[\delta(\omega-4\pi) + \delta(\omega+4\pi)\right]\right]$$&#xA;$$ = \frac{\pi}{4} \left[\delta(\omega-4\pi) + \delta(\omega+4\pi)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transforming back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = \frac{1}{4} cos(4\pi t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is to see that $X(jw)$ is an infinite sum of dirac deltas, but only two of those deltas lie in the non-zero range of the transfer function.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2013-12-31T06:13:32.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13451" PostTypeId="1" CreationDate="2013-12-31T08:49:17.853" Score="0" ViewCount="93" Body="&lt;p&gt;The original Microsoft Kinect device IR projected a spacially encoded dot field and looked for distortion in the dot field with a single IR camera to create a depth map. But there were thousands of dots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen a few devices however, usually in motion capture, that only use a few dots. The one pictued below for example is used to determine the position, movement and rotation of a moving golf ball.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do they use a similar process of looking for distortion of the projected pattern, or some other process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tBkul.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7420" LastEditorUserId="7420" LastEditDate="2013-12-31T11:06:05.260" LastActivityDate="2013-12-31T11:45:39.360" Title="How does projecting a few IR dots capture an image three dimensionally?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13452" PostTypeId="1" AcceptedAnswerId="13457" CreationDate="2013-12-31T10:48:02.907" Score="2" ViewCount="7073" Body="&lt;p&gt;When you are transforming a signal in to a frequency domain using both DFT and DCT, say for a function sin(x), how the spectrum will be? will both frequency values (of DCT and DFT) same? Can anyone explain the values of the frequencies for the function sin(x) (obviously the frequency should be 1/2π)&lt;/p&gt;&#xA;" OwnerUserId="7422" LastActivityDate="2022-11-23T00:43:39.317" Title="DFT Vs DCT - spectrum differences" Tags="|dft|dct|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13453" PostTypeId="2" ParentId="13240" CreationDate="2013-12-31T11:00:11.890" Score="3" Body="&lt;p&gt;You do a QR decomposition of $X^T$. Then the system reads as $$Y=AR^TQ^T.$$ Now multiply with $Q$ from the right, $$YQ=AR^T,$$ which already should give you hints on the reliability of the eventual solution, since ideally, the block of $YQ$ right of the leading $m\times n$ block should be zero. If that is true, then $$A=[YQ]_{[1:m,1:n]}[R^T]_{[1:n,1:n]}^{-1}$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the QR decomposition using Householder reflections, you can apply the reflections computed for $X$ simultaneously to $X$ and $Y$, if $$S=I-2 vv^T,$$ then $$X_{next}=XS=X-2(Xv)v^T\text{ and }Y_{next}=YS=Y-2(Yv)v^T$$ and $$X_{final}=R^T,\; Y_{final}=YQ$$.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2013-12-31T11:00:11.890" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13454" PostTypeId="2" ParentId="13004" CreationDate="2013-12-31T11:23:21.207" Score="0" Body="&lt;p&gt;If you have a signal over the segment $[0:L-1]$ and a filter bank with noticeable values over the segment $[-F:F]$, then the filtered signal will have important values over the segment $[-F:L+F-1]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the FFT needs to be carried out with length $L+2F$ to avoid aliasing of important coefficients, and to avoid the wrap-around the signal needs to be padded by a block of $F$ zeros before and after, so that $[0:F-1]$ is zero, $[F:L+F-1]$ contains the original signal and $[L+F:L+2F-1]$ again contains zeros. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But remember that the time index corresponding to the start of the given signal is now at position $F$ in the filtered signal. If you use overlap-add with block size of $B$ and overlap $D$, then $L=B+D=D+(B-D)+D$, so in the end everything needs to be arranged such that $B+D+2F$ is a power of $2$.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2013-12-31T11:23:21.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13455" PostTypeId="2" ParentId="11258" CreationDate="2013-12-31T11:40:09.950" Score="1" Body="&lt;p&gt;Since Görtzel computes a part of the DFT, the relation between detectable frequencies is the same. So with 8000Hz sampling rate and 600 samples you cover the frequency range of -4000Hz to 4000Hz with 600 frequency intervals, and both your frequencies are points of the subdivision, thus both should be perfectly detectable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you show the code for the Görtzel iterations?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Or even before that, did you build the test signals using $\sin(\pi\cdot f\cdot t)$ or $\sin(2\pi\cdot f\cdot t)$? Only the second gives the correct frequency, the first could explain your observations, since the 600 samples would then contain $12.5$ periods of the oscillation for $f=333.33Hz$, but full $5$ for $133.33Hz$.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2013-12-31T11:48:07.323" LastActivityDate="2013-12-31T11:48:07.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13456" PostTypeId="2" ParentId="13451" CreationDate="2013-12-31T11:45:39.360" Score="2" Body="&lt;p&gt;The projected differaction pattern (formed out of Gaussians) has a special assymetric structure, which in turn would help the software resolve the stereo correspondence problem. After correspondence is obtained, the distance can be triangulated, as in a simple stereo setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further info, please check the PrimeSense patent:&#xA;&lt;a href=&quot;http://www.google.com/patents/US20090185274&quot; rel=&quot;nofollow&quot;&gt;http://www.google.com/patents/US20090185274&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other stereo reconstruction techniques might use color coded patterns, blue light patterns, phase shifting projections and so on. Generally, tools projecting fewer dots enjoy muliple pattern projection and encode every pattern differently. This might for example obtained by rotating the projector or programming it to project different light stripes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the object to be reconstructed, using multiple cameras might just be enough as the RGB image information might provide you enough data to disambiguate. In this case, you wouldn't even have to project a pattern. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The technique is generally called structured light and for further info you might check:&#xA;&lt;a href=&quot;http://fofi.pagesperso-orange.fr/Downloads/Fofi_EI2004.pdf&quot; rel=&quot;nofollow&quot;&gt;http://fofi.pagesperso-orange.fr/Downloads/Fofi_EI2004.pdf&lt;/a&gt;&#xA;&lt;a href=&quot;http://eia.udg.es/~qsalvi/Tutorial_Coded_Light_Projection_Techniques_archivos/v3_document.html&quot; rel=&quot;nofollow&quot;&gt;http://eia.udg.es/~qsalvi/Tutorial_Coded_Light_Projection_Techniques_archivos/v3_document.html&lt;/a&gt;&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Structured_light&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Structured_light&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2013-12-31T11:45:39.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13457" PostTypeId="2" ParentId="13452" CreationDate="2013-12-31T12:00:47.477" Score="2" Body="&lt;p&gt;The DCT for a signal $x(t)$ on $[0,T]$ is roughly the same as the DFT for the function $x(|t|)$ on $[-T,T]$, that is, mirrored at the vertical axis. Since that function is even, all sine coefficients will be zero and can be removed from the result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now $\sin(|t|)$ is different from $\sin(t)=-\sin(-t)$ for negative $t$, so the resulting coefficients will be quite unrelated. If the sampling interval ends at $t=T=2\pi$, the DFT will only exhibit one peak around frequency $f=\frac1{2\pi}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But because of the kink at $t=0$ in $\sin(|t|)$, and a second at the end of the sampling interval, the DCT will exhibit a general background of size $f^{-2}$ in the coefficient for frequencies $f&amp;gt;0$.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2013-12-31T12:00:47.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13458" PostTypeId="2" ParentId="13435" CreationDate="2013-12-31T12:02:31.297" Score="0" Body="&lt;p&gt;If you have two iid sequences generated with randn() called x and y, then cov(x(1:100:end),y(1:100:end)) will be zero. If you want that result to be nonzero, then one way is to add a fraction of x(1:100:end) to y(1:100:end) to introduce some correlation at every 100th step. You can control the covariance by changing the fraction of x that is added to y at every 100th step.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2013-12-31T12:02:31.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13460" PostTypeId="1" AcceptedAnswerId="13461" CreationDate="2013-12-31T12:25:07.877" Score="5" ViewCount="14623" Body="&lt;p&gt;I have difficulty in understanding what is Hue and Saturation. please explain what is hue and saturation to me with an example or analogy.  &lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2019-03-31T18:23:35.103" Title="What is Hue and Saturation?" Tags="|image-processing|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13461" PostTypeId="2" ParentId="13460" CreationDate="2013-12-31T12:32:33.807" Score="6" Body="&lt;p&gt;Hue is the main indication of color. It is the value actually telling you which color it is or the value that lets you go &quot;red&quot; when you see a red object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saturation is the perceived intensity. In other words it is a value of how dominant the color is, or how colorful the object looks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practical example: Regardless of the color, shadows generally happen to have low saturation values. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2013-12-31T12:32:33.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13462" PostTypeId="2" ParentId="13460" CreationDate="2013-12-31T12:37:02.163" Score="1" Body="&lt;p&gt;If you draw a intensity on wavelength curve for each pixel in the image, hue refers to the peak of the curve, i.e., at the visible wavelength with the greatest energy from the output. Saturation is the relative bandwidth of the curve. As saturation increases, colors appear more &quot;pure.&quot; As saturation decreases, colors appear more &quot;washed-out.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aim that we convert RGB to HSV is to separate the information from color space with the other information such as the brightness, pureness, and saturation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conversion from RGB to HSV is shown in this &lt;a href=&quot;http://www.rapidtables.com/convert/color/rgb-to-hsv.htm&quot; rel=&quot;nofollow&quot;&gt;page&lt;/a&gt; with both mathematical formulas and the numerical look-up.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2013-12-31T13:55:09.173" LastActivityDate="2013-12-31T13:55:09.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13463" PostTypeId="1" AcceptedAnswerId="14591" CreationDate="2013-12-31T12:40:06.350" Score="0" ViewCount="361" Body="&lt;p&gt;Thanks for reading my question. Please refer good books(links, if possible) for the following topics in Image processing. Your help is very much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;UNIT II SEGMENTATION&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fuzzy clustering, Watershed algorithm, Active contour methods, Texture feature based segmentation, Model based segmentation, Atlas based segmentation, Wavelet based Segmentation methods.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;UNIT III FEATURE EXTRACTION&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Texture descriptors- Autocorrelation, Co-occurrence features, Runlength features, Fractal model based features, Gabor filter, wavelet features.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;UNIT IV REGISTRATION AND IMAGE FUSION&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Image Fusion-Overview of image fusion, pixel fusion, Multiresolution based fusion discrete wavelet transform, Curvelet transform. Region based fusion.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-02-22T12:20:46.920" Title="Refer good books for the following topics in Image processing" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13464" PostTypeId="2" ParentId="13463" CreationDate="2013-12-31T12:47:33.100" Score="0" Body="&lt;p&gt;For first two:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feature Extraction &amp;amp; Image Processing for Computer Vision, by Mark Nixon and Alberto S Aguado&#xA;Computer Vision: Algorithms and Applications (Texts in Computer Science) by Richard Szeliski&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For last one&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sparse Image and Signal Processing Wavelets, Curvelets, Morphological Diversity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AUTHORS:&#xA;Jean-Luc Starck, Centre d'Etudes de Saclay, FranceFionn Murtagh, Royal Holloway, University of LondonJalal M. Fadili, Ecole Nationale Supérieure d'Ingénieurs de Caen, France&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2013-12-31T12:47:33.100" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13465" PostTypeId="2" ParentId="13452" CreationDate="2013-12-31T13:05:36.353" Score="0" Body="&lt;p&gt;Have a look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;. There is an example image, but for DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0vZXY.png&quot; alt=&quot;DFT vs. DCT&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2013-12-31T13:05:36.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13466" PostTypeId="2" ParentId="10262" CreationDate="2013-12-31T13:45:55.747" Score="1" Body="&lt;p&gt;I agree with Abid Rahman K, however eroding only would result in shape shrinkage.  To only get rid of the gap, Abid Rahman suggests a watershed based approach, but for a faster and easier method you might try:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Erode the regions&lt;/li&gt;&#xA;&lt;li&gt;Apply connected component labeling.&lt;/li&gt;&#xA;&lt;li&gt;Dilate the regions back.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This way you will have almost the same shape (with some artifacts arising due to morphology) but you will surely end up with single connected components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Watersheds and distance transform are also powerful and might be good choices if you have a lot of overlap.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2013-12-31T13:45:55.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13467" PostTypeId="1" AcceptedAnswerId="13481" CreationDate="2013-12-31T14:04:50.357" Score="4" ViewCount="1347" Body="&lt;p&gt;I have the following problem, that I ran into recently, when calculating the spectra of data that I obtain from a measurement technique, we are using in our group.&lt;/p&gt;&#xA;&lt;p&gt;In short what we do in the technique, is record a movie of a fluctuating, nearly circular object and determine the contour in each frame of the movie. We then use the spectrum of these fluctuations to measure physical properties of the object.&lt;/p&gt;&#xA;&lt;p&gt;I have now refined the algorithm that we use for tracking the object, so that it is more precise and we are able to determine the contours up to much shorter wavelengths or correspondingly up to a much higher number of modes.&lt;/p&gt;&#xA;&lt;p&gt;The physical theory behind the system predicts that the fluctuation-amplitude at low mode numbers will be much larger than the at high mode numbers - spanning up to 5 orders of magnitude over the now observable range of modes.&lt;/p&gt;&#xA;&lt;p&gt;With the now much large mode range and the correspondingly huge range of amplitudes in the spectrum, I seem to have run into an artifact caused by the windowing inherent to the FFT that we use to calculate the spectrum.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/v4zFC.jpg&quot; alt=&quot;Various spectra of synthetic data at different image SNR&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The spectrum above shows seven different, simulated datasets of a static object. The only thing that changes between the datasets is an increasing image SNR of the movie images (red: high SNR; yellow: low SNR).&#xA;As can be seen the spectra of the different datasets seem to consist of two contributions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;windowing-function/kernel with periodic maxima and minima&lt;/li&gt;&#xA;&lt;li&gt;noisy contribution from the increasingly imprecise contour tracking due to the decreasing SNR. This contribution seems to be summed to the window-function and dominates the spectrum in the ranges, where the windowing-function has a minimum (especially for high-SNR datasets).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now in the figure below you can see the experimental spectra of an object that almost stops fluctuating towards the end of the measurement/movie (blue: spectrum at movie beginning, green: spectrum at end of movie). (Note: the x-axis is now in wave numbers here – proportional to the inverse wavelength)&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/10Sad.jpg&quot; alt=&quot;Experimental spectra (blue: strong fluctuations, green: weak fluctuations)&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the blue spectrum we see:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We can see that the spectrum is dominated by the fluctuations of the object over the first ~50 modes (e.g. for wavenumber&amp;lt;=0.1e8).&lt;/li&gt;&#xA;&lt;li&gt;After this we see the contribution from the window-function.&lt;/li&gt;&#xA;&lt;li&gt;After this we see that at the position of the first minimum of the&#xA;window function (1.1e8&amp;lt;=wavenumber&amp;lt;=1.6e8), we are again able to see&#xA;the actual fluctuations of the object. This is confirmed by the fact, that we are able to distinguish between the two spectra of the initially strong fluctuating object (blue) and the lower fluctuating object at the later time (green) in this range. If we were only to see image noise in this range, then the blue and the green spectrum should overlap in this range.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Furthermore when looking at the autocorrelation functions of each mode I found the following:&#xA;In the ranges (wavenumber&amp;lt;=0.1e8) and (1.1e8&amp;lt;=wavenumber&amp;lt;=1.6e8) the autocorrelation functions exhibit correlation whereas in the other regions, the time series of the modes are completely decorrelated as would be expected of noise.&lt;/p&gt;&#xA;&lt;p&gt;So after this lengthy introduction, I have the following questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is my assumption that this is related to the window-function justified? If so I don't understand exactly why yet...&lt;/li&gt;&#xA;&lt;li&gt;Furthermore perhaps someone could suggest a means to get around this&#xA;artifact of the FFT windowing.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I have been reading up on different window-functions, but from what I understand, they all have an even wider main lobe than the rectangular window-function of the FFT. Since I seem to be “running into”  the main lobe with my spectrum, I am not sure if a different window-function would help.&lt;/p&gt;&#xA;&lt;p&gt;Perhaps there is some way of using the fact that I am dealing with circular contours, so that the signal I am processing is not windowed, but intrinsically periodic and &amp;quot;infinite&amp;quot; (as is the FFT)?!&lt;/p&gt;&#xA;&lt;p&gt;Could low-pass filtering (perhaps with a Butterworth filter) of the signal before performing the FFT help?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note 1:&lt;/strong&gt; Clarification of what is being Fourier-tranformed&lt;/p&gt;&#xA;&lt;p&gt;The object-tracking algorithm yields cartesian coordinates (x_i,y_i), which I transform to polar coordinates (theta_i,r_i) using the center-of-mass as center coordinate. The signal that I FFT is r_i-&amp;lt;r_i&amp;gt;, e.g. the deviation from the average radius of the contour&#xA;Thus, in principle, the signal should truly be periodic – which is what I meant by “intrinsically periodic” above. By rectangular window I meant the intrinsic windowing due to the finite input signal to the FFT. I am not using any additional windowing-function at the moment.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Notes 2:&lt;/strong&gt; Follow-up on effect of Zero-padding on FFT&#xA;With regards to the scaling behavior of the spectra, I performed the following tests as suggested by Eric Jacobsen. In the plots below I show the same dataset performing the FFT with varying levels of zero-padding.&#xA;Color coding of plots of the FFT with different zero-paddings:&#xA;red: no padding, green: +1 zero padding, blue: +4 zero padding, cyan: +6 zero padding&#xA;data-length: 2048 (for each the same)&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D585y.png&quot; alt=&quot;Plot of the FFT of the contour of a single movie frame&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Plot of the FFT of the contour of a single movie frame&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w8oIJ.png&quot; alt=&quot;Plot of the fluctuations of the spectra&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Plot of the fluctuations of the spectrum calculated as the variance of the values of each mode:&lt;/p&gt;&#xA;&lt;p&gt;&amp;lt;|c|^2&amp;gt;_t-&amp;lt;|c|&amp;gt;_t^2&lt;/p&gt;&#xA;&lt;p&gt;where c is the FFT of the signal.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xc5po.png&quot; alt=&quot;Plot of the two terms for calculating the variance for the case no zero-padding&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Plots of the two components of the variance of the non-zero-padded transform:&lt;/p&gt;&#xA;&lt;p&gt;red: &amp;lt;|c|^2&amp;gt;_t, blue: &amp;lt;|c|&amp;gt;_t^2&lt;/p&gt;&#xA;&lt;p&gt;As can be seen, the contribution due to the window-function is present in both in slightly different intensity and thus is not cancelled out, when calculating the difference.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;To finish off this topic: I found out that the observed sinc-like pattern in the spectrum was not caused by windowing of the FFT, but rather by the pattern of the pixels that (unfortunately) still show up significantly in the tracked signal. Combined with the interpolation of the pixels, this results in a convolution with a triangular kernel (see linear interpolation and its frequency response; so sinc^2 &lt;a href=&quot;https://ccrma.stanford.edu/%7Ejos/pasp04/Linear_Interpolation_Frequency_Response.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;see here&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;In the end, what led me to the realization, was the fact that due to the inverse behavior in Fourier space any large patterns are produced by a small structure in real-space (see also one of my comments), as is the case for the windowing-effect of the FFT.&lt;/p&gt;&#xA;&lt;p&gt;I marked the answer by Eric Jacobsen as correct, since he suggested, that the structure may also be caused by something very different from the windowing-effect of the FFT.&lt;/p&gt;&#xA;" OwnerUserId="7424" LastEditorUserId="26573" LastEditDate="2022-05-26T16:16:26.247" LastActivityDate="2022-05-26T16:16:26.247" Title="Working around FFT windowing?" Tags="|fft|fourier-transform|window-functions|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13471" PostTypeId="2" ParentId="7690" CreationDate="2013-12-31T15:40:25.627" Score="1" Body="&lt;p&gt;The &quot;Harvard sentences&quot; corpus is a classic: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Harvard_sentences&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Harvard_sentences&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2013-12-31T15:40:25.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13472" PostTypeId="1" AcceptedAnswerId="43978" CreationDate="2013-12-31T16:54:07.397" Score="6" ViewCount="613" Body="&lt;p&gt;If I have a measured signal $\mathbf{y}$ which is the result of the true signal $\mathbf{x}$ convolved with another function (linear and not circular convolution), I always seem to get an underdetermined system. Convolution expressed as a matrix equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\mathbf{y} = \mathbf{A} \mathbf{x}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in finding $\mathbf{x}$, given $M=5$ observations and knowing that the convolution matrix is defined by a boxcar function of window length $n=3$. The corresponding $M\times N$ convolution matrix is defined as the following, where $N=M+n-1$.&#xA;\begin{equation}&#xA;\mathbf{A} = \begin{pmatrix}&#xA;1 &amp;amp;   1 &amp;amp;   1 &amp;amp;   0 &amp;amp;   0 &amp;amp;   0 &amp;amp;   0 \\ &#xA;0 &amp;amp;   1 &amp;amp;   1 &amp;amp;   1 &amp;amp;   0 &amp;amp;   0 &amp;amp;   0 \\ &#xA;0 &amp;amp;   0 &amp;amp;   1 &amp;amp;   1 &amp;amp;   1 &amp;amp;   0 &amp;amp;   0 \\ &#xA;0 &amp;amp;   0 &amp;amp;   0 &amp;amp;   1 &amp;amp;   1 &amp;amp;   1 &amp;amp;   0 \\ &#xA;0 &amp;amp;   0 &amp;amp;   0 &amp;amp;   0 &amp;amp;   1 &amp;amp;   1 &amp;amp;   1 \\ &#xA;\end{pmatrix}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the literature, the convolution matrix is often $N\times N$ (or $M\times{}M$, however you want to define it). But it seems that with a finite number of observations, the convolution matrix corresponding to the available observations would have to be $M \times (M+n-1)$, which is always underdetermined (except when $n \equiv 1$, in which you don't have convolution of your signal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most convolution/deconvolution examples, the matrix is often represented as being &quot;square,&quot; in which there exist rows in the matrix where the number of non-zero elements are less than $n$. This does not correspond to any possible measurement. Padding is common for the input signal ($\mathbf{x}$) but not for the output ($\mathbf{y}$), so how can the system not be underdetermined?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit for clarification&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that convolution matrix is traditionally written as $N+m+1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;  \mathbf{A} = \begin{pmatrix}&#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;    1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;    1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;    0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;  \end{pmatrix}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, you never measure the signals corresponding to the first two and last two rows, so it would seem that you cannot use this matrix for creating the deconvolution filter.&lt;/p&gt;&#xA;" OwnerUserId="5362" LastEditorUserId="128" LastEditDate="2020-01-11T14:51:47.613" LastActivityDate="2020-01-11T14:51:47.613" Title="Deconvolution (Linear Convolution) with an Under Determined System of Equations?" Tags="|convolution|linear-systems|deconvolution|inverse-problem|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13473" PostTypeId="1" CreationDate="2013-12-31T17:32:36.637" Score="1" ViewCount="3892" Body="&lt;p&gt;can someone please help me? I have a project to implement a superheterodyne transmitter and receiver without using matlab functions that modulate. The first part which I can't seem to get right is the RF filter, which the my doctor said should just be a bandpass filter centered around Wc. I am supposed to get two sound signals, add them together which is my TdmSig then pass them through the bandpass filter centered around the frequency of the first carrier signal (which modulates signal 1) and should remove signal 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The center of my bandpass filter is 100khz/2pi = Fc = 15900&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Fs1 = Fs2.. and Fs1 = 44100 before interp command and after Fs1 = 132300&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I chose a bandwidth of 4000. I really tried for 3 days and I dont know how to get the bandwidth of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also before all that I am worried maybe I might be modulating my signals incorrectly I dont understand very well&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is file he sent&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The AM modulator: the modulation type is double side band suppressed carrier (DSB-SC) for all the signals, that is the modulation is performed by a simple multiplication with a carrier sinusoid. The first signal is modulated with 100KHz carrier. Each following signal is modulated with a carrier of frequency wc = 100khz + n*df where df= 60 KHz and the index n is the signal index (n = 0 for the first signal that is modulated at 100 KHz). The modulated signals are used to form a TDM signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RF stage: As discussed in the lecture, this is the stage that performs interference-image rejection. For simplicity, this stage will be implemented as a band-pass Filter (BPF) only, centered at the carrier frequency (that is tunable at the desired station). You can refer to MathWorks tutorial for the design of BPF in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all&#xA;clear&#xA;clc&#xA;[stereo1 Fs1] = wavread('Short_FM9090'); % This will save the samples of the 2 channels of the signal in the array stereo&#xA;[stereo2 Fs2] = wavread('Short_RussianVoice');&#xA;&#xA;&#xA;% Part i a(Converting to mono)&#xA;mono1(:,1)= stereo1(:,1)+stereo1(:,2); %This will add the 2 channels frequencies and convert to mono  &#xA;mono2(:,1)= stereo2(:,1)+stereo2(:,2); &#xA;&#xA;&#xA;%take small part for fast computation&#xA;mono1 = mono1(1:200000);&#xA;mono2 = mono2(1:200000);&#xA;&#xA;l1 = length(mono1); %This will return the size of the array mono1&#xA;l2 = length(mono2);&#xA;&#xA;&#xA;%Part ii b Amplitude Modulation&#xA;&#xA;Mod1 = interp(mono1,3);  % increase samples for Nyquist to be satisfied&#xA;Mod2 = interp(mono2,3);&#xA;Fs1 = Fs1*3;&#xA;l1 = l1*3;&#xA;&#xA;df = 60*10^3;&#xA;wc = 100*10^3;&#xA;&#xA;n = 0:0.05:l1/20;&#xA;n=n(1,1:end-1);&#xA;&#xA;carrier1 =  cos(wc*n/Fs1)';&#xA;Mod1 = Mod1.*carrier1;&#xA;&#xA;%plot carrier&#xA;&#xA;% figure&#xA;% plot(carrier1)&#xA;% title('carrier 1')&#xA;&#xA;Mod1_fft = fft(Mod1);&#xA;&#xA;zdouble = Mod1_fft;&#xA;zdouble = abs(zdouble(1:length(zdouble)/2+1));&#xA;frqdouble = (0:length(zdouble)-1)*Fs1/length(zdouble)/2;&#xA;&#xA;subplot(2,1,1); plot(frqdouble,zdouble);&#xA;title('Spectrum of double-sideband Mod 1 signal');&#xA;&#xA;wc2 = wc+df;&#xA;&#xA;carrier2 = cos(wc2*n/Fs1)';&#xA;Mod2 =  Mod2.*carrier2;&#xA;&#xA;Mod2_fft = fft(Mod2);&#xA;zdouble = Mod2_fft;&#xA;zdouble = abs(zdouble(1:length(zdouble)/2+1));&#xA;frqdouble = (0:length(zdouble)-1)*Fs1/length(zdouble)/2;&#xA;&#xA;subplot(2,1,2); plot(frqdouble,zdouble);&#xA;title('Spectrum of double-sideband Mod 2 signal');&#xA;&#xA;&#xA;figure&#xA;subplot(2,1,1); plot(Mod1);&#xA;title(' Mod 1 signal');&#xA;subplot(2,1,2); plot(Mod2);&#xA;title('Mod 1 signal');&#xA;&#xA;TdmSig =Mod1+Mod2;&#xA;&#xA;figure&#xA;plot(TdmSig)&#xA;title( 'TDM Signal in Time domain before filter')&#xA;ylabel('Amplitude')&#xA;xlabel('Time')&#xA;&#xA;Tdm_fft = fft(TdmSig);&#xA;Tdm_fft = fftshift(Tdm_fft);&#xA;k = -l1/2:(l1/2)-1;&#xA;figure&#xA;plot(k,abs(Tdm_fft))&#xA;title('Tdm in frequency domain before filter')&#xA;&#xA;%Part iv (RF Filter centered at Wc and Tunable)&#xA;&#xA;FsFilter =Fs1; % Sampling frequency&#xA;A_stop1 = 60; % Attenuation in the first stopband&#xA;F_stop1 = 11000; % Edge of the stopband &#xA;F_pass1 = 12900;% Edge of the passband &#xA;F_pass2 = 16900;% Closing edge of the passband &#xA;F_stop2 = 20000;% Edge of the second stopband&#xA;A_stop2 = 60; % Attenuation in the second stopband&#xA;A_pass = 1; % Amount of ripple allowed in the passband&#xA;&#xA;BandPassSecObj = fdesign.bandpass(F_stop1,F_pass1,F_pass2,F_stop2,A_stop1,A_pass,A_stop2,FsFilter);&#xA;hd = design(BandPassSecObj,'butter');&#xA;demod= filter(hd,TdmSig);&#xA;&#xA;soundsc(TdmSig) % should at least remove unwanted sound file&#xA;&#xA;figure&#xA;plot(demod)&#xA;title('Signal after Bandpass filter for TDM signal')&#xA;&#xA;Tdm_fft = fft(demod);&#xA;Tdm_fft = fftshift(Tdm_fft);&#xA;k = -l1/2:(l1/2)-1;&#xA;figure&#xA;plot(k,abs(Tdm_fft))&#xA;title('Tdm in frequency domain after filter')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7427" LastActivityDate="2014-01-01T18:54:44.633" Title="Separating two sound file frequencies using bandpass filter matlab" Tags="|matlab|filters|sound|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13474" PostTypeId="1" AcceptedAnswerId="13477" CreationDate="2013-12-31T19:45:48.677" Score="1" ViewCount="326" Body="&lt;p&gt;I'm not sure if this is possible, but let's say you had access to the original raw sampled digital pixels from a sensor, captured with nothing between the sensor and the lenses, i.e.  Anti aliasing filter, colour filter array etc etc removed. Would it be possible to filter the raw pixels in relation to the original wavelength frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="300" LastActivityDate="2013-12-31T20:59:14.243" Title="Filter pixels with respect to specific wavelength frequencies" Tags="|image-processing|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13475" PostTypeId="1" CreationDate="2013-12-31T20:49:57.543" Score="0" ViewCount="300" Body="&lt;p&gt;What should the energy, pitch frequency, and zero crossing rate of a voice/unvoiced/silence frame in signal be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My professor said that it is experimental, but I do not have any idea what the factors of these are and where I should begin from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any guesses based on experimental data or any limits on the quantities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a zero crossing rate between 2000 and 94000, energy between 0.0001 and 0.7, and&#xA;pitch frequency between 180 and 500.&lt;/p&gt;&#xA;" OwnerUserId="7070" LastEditorUserId="76" LastEditDate="2014-01-02T05:41:00.140" LastActivityDate="2014-02-01T06:17:08.627" Title="Quantifying the energy of a voiced frame" Tags="|voice|pitch|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13476" PostTypeId="2" ParentId="13460" CreationDate="2013-12-31T20:54:47.330" Score="1" Body="&lt;p&gt;If the density of photons is equal at all frequencies in the visual range, then a typical human would usually see just gray, and the color saturation would be said to be zero.  For RGB image data, the same if R == G == B.  The hue would be indeterminate.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all the photons are of identical frequency at the red end of the human visual range, then the saturation would be 100%, and the hue would be at the red end of the hue range.  Or R = 255, G = 0, B = 0 for 8-bit RGB images.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2013-12-31T20:54:47.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13477" PostTypeId="2" ParentId="13474" CreationDate="2013-12-31T20:59:14.243" Score="3" Body="&lt;p&gt;Aliasing irreversibly transforms frequencies above the Nyquist limit to appear as frequencies below the limit. Almost no mathematical algorithms are effective compared with a physical anti aliasing filter in front of the sensor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if the sampling frequency of the sensor itself is higher than the numerical aperture of the lens, it may not need the low pass anti aliasing filter any more since lens itself would serve as a low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the color filter, I think it depends on your application. If you are try to image fluorescence, it is possible without a color filter if the emission spectrum is distinguishable with excitation spectrum. Background subtraction operations will recover the pixel information on the fluorescence. Even if several emission spectra are multiplexed, there is still possibility to differentiate them by solving a linear matrix equation under the assumption that the sensor system is a linear system with different wavelengths. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But color correction filters in digital photography may still needed to get more uniform exposure in the desired channels. Otherwise, the denoising process, though maybe possible through some image processing algorithms, is still challenging in complete noise removal without the &lt;em&gt;prior&lt;/em&gt; knowledge of the noise distribution.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2013-12-31T20:59:14.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13478" PostTypeId="1" AcceptedAnswerId="13479" CreationDate="2014-01-01T03:15:34.240" Score="1" ViewCount="1641" Body="&lt;p&gt;I would just want to prove $\cos(t) + \cos(\pi t)$ is non periodic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know where to start it. Also I know that individually these signals ie $\cos(t)$ and $\cos(\pi t)$ are periodic with frequencies $1/(2 \pi)$ Hz and $1/2$ Hz respectively. But since the superpositon of these signals is not periodic should we represent them using Fourier transform only? What is the harm in drawing the frequency components at $1/(2 \pi)$ Hz and $1/2$ Hz using fourier series?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="235" LastEditDate="2014-01-01T07:14:43.910" LastActivityDate="2014-01-02T15:07:39.980" Title="How to prove $cos(t) + cos(\pi t)$ is non periodic function? Also can I represent this signal using fourier series?" Tags="|fourier-transform|fourier-series|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13479" PostTypeId="2" ParentId="13478" CreationDate="2014-01-01T06:20:45.643" Score="4" Body="&lt;p&gt;$cos(t)$ and $cos(\pi t)$ are both periodic with periods $2\pi$ and $2$ respectively. To find the period of the sum we need to find an integers $n,m$ such that $\pi n = 2 m$ or $\pi / 2 = m /n $, which is not possible since $\pi$ is irrational.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the Fourier series uses specific frequencies to form the signal. &lt;del&gt;You can't necessarily put a frequency component at irrational frequencies.&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier series work fine with irrational frequencies too, but the frequencies are all harmonics, that is, integer multiples, of the fundamental frequency.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastEditorUserId="5253" LastEditDate="2014-01-02T15:07:39.980" LastActivityDate="2014-01-02T15:07:39.980" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13481" PostTypeId="2" ParentId="13467" CreationDate="2014-01-01T09:49:46.187" Score="2" Body="&lt;p&gt;I'm not quite clear about the scaling in your plots, but the sinx/x response due to the FFT length, assuming the data length and the FFT length match (i.e., there is no zero-padding), has a main-lobe width of only two bins.   It looks like your plots may be either heavily zero-padded or the sinx/x you're seeing may be due to something else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sinx/x response shape appears in a number of unexpected places, like antenna patterns, diffraction, etc., so it's possible that it is due to something other than the FFT.  If you keep the size of the FFT constant and change the data length, zero-padding the difference, the sinx/x main lobe due to the rectangular window should widen as the date length shrinks.   That would be a way to see whether the sinx/x shape is due to the window or some other effect.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2014-01-01T09:49:46.187" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13482" PostTypeId="2" ParentId="13473" CreationDate="2014-01-01T12:31:38.703" Score="1" Body="&lt;p&gt;I did not follow/check all of your code, but I have the impression that there is some confusion about frequency, angular frequency, the place of the factor $2\pi$ and the arguments of the trig functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a frequency $f$ in cycles per second or Hertz, one possible signal exhibiting this frequency is $\cos(2\pi  f\cdot t)$ so that $ω=2\pi f$ is the angular frequency in radians per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you want to shift the frequency of a base band signal $x$ to a frequency band with carrier frequency $f_c$ and thus angular frequency $ω_c=2\pi f_c$, which is accomplished by computing the product $y(t)=x(t)\cos(2\pi f_c\cdot t)$. Which gives in fact two copies of the basis signal, one around $f_c$ and one around the mirror frequency $-f_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $x$ is sampled with sampling frequency $f_s$, and thus period $dt=\tfrac1{f_s}$, $x[n]=x(n/f_s)$, the samples of $y$ will be $y[n]=x[n]\cdot \cos(2\pi f_c/f_s\cdot n)$. Or with $ω_c/f_s$ instead of $2\pi f_c/f_s$, $y[n]=x[n]\cdot \cos(ω_c/f_s\cdot n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not comprehensible why the number $1/20$ as step size in $n$ occurs in this context, $n$ is here an integer, i.e., with step size $1$.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-01T12:31:38.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13483" PostTypeId="2" ParentId="13472" CreationDate="2014-01-01T12:55:54.740" Score="2" Body="&lt;p&gt;On the contrary, if you compute the convolution of a signal $x$ having a span of $M$ non-zero entries with a filter with a span of $N$ non-zero entries, then the resulting sequence will have $M+N-1$ non-zero entries, so that your system should be over-determined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computing the minimizer $x$ of $\|[0,1,0]*y-[1,1,1]*x\|_2$ leads by standard variational methods to the system of equations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[0,1,1,1,0]*y=[1,2,3,2,1]*x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the first two and the last two removed, and for some reason mathematics / linear algebra claims that this system is solvable even if $[0,1,0]*y=[1,1,1]*x$ is not.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-01T12:55:54.740" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13484" PostTypeId="2" ParentId="13435" CreationDate="2014-01-01T13:03:01.267" Score="2" Body="&lt;p&gt;If you want a Gaussian vector $X$ with $E(X)=0$ and $E(X\,X^T)=C$, then find a decomposition $C=AA^T$, for instance a Cholesky decomposition, compute a vector $U$ with standard normal uncorrelated random numbers as components and set $X=AU$.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-01T13:03:01.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13487" PostTypeId="2" ParentId="4723" CreationDate="2014-01-01T20:10:24.430" Score="4" Body="&lt;p&gt;You can also think of convolution as smearing/smoothing of one signal by another. If you have a signal with pulses and another of, say, a single square pulse, the result will the smeared or smoothed out pulses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example is two square pulses convolved come out as a flattened trapezoid. &lt;/p&gt;&#xA;" OwnerUserId="7433" LastEditorUserId="76" LastEditDate="2014-01-02T05:41:19.487" LastActivityDate="2014-01-02T05:41:19.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13488" PostTypeId="1" AcceptedAnswerId="13489" CreationDate="2014-01-01T20:33:57.520" Score="1" ViewCount="3588" Body="&lt;p&gt;A lot of people use &lt;code&gt;imfilter&lt;/code&gt; to achieve a 2-D convolution between an image and a filter, but the majority of people use &lt;code&gt;conv2&lt;/code&gt; instead of &lt;code&gt;imfilter&lt;/code&gt; because it is faster than &lt;code&gt;imfilter&lt;/code&gt; by at least 20%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filtered_image_with_imfilter = imfilter(image,filter,'symmetric','same','corr');&#xA;filtered_image_with_conv2 = conv2(image,filter,'same');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could someone explain to me in detail why &lt;code&gt;conv2&lt;/code&gt; is faster than &lt;code&gt;imfilter&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6925" LastEditorUserId="128" LastEditDate="2020-03-30T10:51:15.173" LastActivityDate="2020-03-30T10:51:15.173" Title="Performance of MATLAB's `conv2()` vs. `imfilter()`" Tags="|image-processing|matlab|filters|discrete-signals|convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13489" PostTypeId="2" ParentId="13488" CreationDate="2014-01-01T22:28:13.650" Score="4" Body="&lt;p&gt;First, I think &lt;code&gt;conv2&lt;/code&gt; and &lt;code&gt;imfilter&lt;/code&gt; will give you the same result if you change the filter option of &lt;code&gt;imfilter&lt;/code&gt; to &lt;code&gt;conv&lt;/code&gt; instead of &lt;code&gt;corr&lt;/code&gt;. &lt;code&gt;imfilter&lt;/code&gt; uses correlation to filter images by default that starts from one side of the image, whereas covolution starts from the other, so there may be some small differences in the filter output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, my test shows &lt;code&gt;imfilter&lt;/code&gt; on 2D image is faster if the filter size if the same as images. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc&#xA;data = (rand(200));&#xA;kernel = ones(200)/4e4;&#xA;tic&#xA;blurredData = conv2(data, kernel,'same');&#xA;conv2t=toc&#xA;tic&#xA;blurredData = imfilter(data, kernel,'same','conv');&#xA;imfiltime=toc&#xA;&#xA;&amp;gt;&amp;gt; conv2t =&#xA;&#xA;       2.7425&#xA;&#xA;&#xA;  imfiltime =&#xA;&#xA;       0.1552&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both &lt;code&gt;imfilte&lt;/code&gt;r and &lt;code&gt;conv2&lt;/code&gt; are hardware optimized and multi-threaded. For floating point inputs, the performance of them are supposed to be roughly the same. But in most cases in image processing, the filter kernel is linearly separable, &lt;code&gt;imfilter&lt;/code&gt; does separation of the kernel into row and column vectors. As a result, they are much faster.  Yet if the filter kernel is (1) not linearly separable, or (2) a small kernel such as a 5*5 filter kernel. &lt;code&gt;conv2&lt;/code&gt; wins in the processing time. I guess the reason is some time is spent on checking the separability of the kernel in &lt;code&gt;imfilter&lt;/code&gt;. I am not sure whether there are other different mechanisms that leads to the processing time difference between the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if the filter size is the same as image. &lt;code&gt;fft&lt;/code&gt; is always the best one (&lt;code&gt;O(nlogn)&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc&#xA;data = (rand(200));&#xA;kernel = ones(200)/4e4;&#xA;tic&#xA;blurredData = conv2(data, kernel,'same');&#xA;conv2t=toc&#xA;tic&#xA;blurredData = imfilter(data, kernel,'same','conv');&#xA;imfiltime=toc&#xA;tic&#xA;D=fft2(data);&#xA;K=fft2(kernel);&#xA;blurdata=ifft2(D.*K);&#xA;fftime=toc&#xA;&#xA;&#xA;&amp;gt;&amp;gt;conv2t =&#xA;&#xA;          2.7429&#xA;&#xA;&#xA;  imfiltime =&#xA;&#xA;          0.1327&#xA;&#xA;&#xA;  fftime =&#xA;&#xA;          0.0164&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@geometrikal's detailed analysis:&#xA;The reason fft is faster than imfilter with same size images is that imfilter pads the inputs (even with 'same'). For small filter kernels, not much padding is needed for imfilter, whereas to use the fft the kernel will have to be padded to the size of the image. In these cases imfilter is faster.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-01-02T13:09:33.923" LastActivityDate="2014-01-02T13:09:33.923" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13490" PostTypeId="2" ParentId="11433" CreationDate="2014-01-02T01:18:38.150" Score="0" Body="&lt;p&gt;monophonic pitch detection is hard enough.  polyphonic is a whole dimension harder. dunno how Melodyne does it, but they're probably the top of the pile these days.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;there aren't a lot of papers published on pitch detection, these days.  back in the olden days it was about speech processing and there are a few algs for monophonic.  then the issue became that of measuring the fundamental frequency $f_0$ (or the period, $\tau_0$) of a periodic or quasi-periodic signal.   ultimately the algs that were any good were based on Average Magnitude Difference Function (AMDF) or autocorrelation.  there's a relationship between the two (or at least between autocorrelation and the average magnitude-&lt;b&gt;squared&lt;/b&gt; difference function).  one has peaks exactly where the other has minimums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i've never really fiddled with polyphonic pitch detection, because most of what i had worked on was meant to be used in real time.  perhaps, if you can identify a note (perhaps the note with the most amplitude) out of the mix, you can use a comb filter to filter out that note and continue to identify the strongest note of the residual that is left.  all this is predicated on the notion that all of the notes are harmonic or quasi-periodic.  some tones, that humans perceive as having a pitch, are not harmonic.  bells, for instance.  in that case, i dunno how you would use a comb filter to isolate the note, since the harmonics might not line up with the teeth of the comb.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-01-02T01:18:38.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13491" PostTypeId="2" ParentId="13460" CreationDate="2014-01-02T01:35:27.203" Score="1" Body="&lt;p&gt;this comes from Wikipedia (but is consistent with my old 1970s communications textbook):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R, G, B, Y \in \left[ 0, 1 \right], \quad I \in \left[-0.5957, 0.5957\right], \quad Q \in \left[-0.5226, 0.5226\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix} Y \\ I \\ Q \end{bmatrix}&#xA;=&#xA;\begin{bmatrix}&#xA;  0.299    &amp;amp;  0.587    &amp;amp;  0.114 \\&#xA;  0.595716 &amp;amp; -0.274453 &amp;amp; -0.321263 \\&#xA;  0.211456 &amp;amp; -0.522591 &amp;amp;  0.311135&#xA;\end{bmatrix}&#xA;\begin{bmatrix} R \\ G \\ B \end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix} R \\ G \\ B \end{bmatrix}&#xA;=&#xA;\begin{bmatrix}&#xA;  1 &amp;amp;  0.9563 &amp;amp;  0.6210 \\&#xA;  1 &amp;amp; -0.2721 &amp;amp; -0.6474 \\&#xA;  1 &amp;amp; -1.1070 &amp;amp;  1.7046&#xA;\end{bmatrix}&#xA;\begin{bmatrix} Y \\ I \\ Q \end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the $Y$ signal is the monochrome intensity.  about the same as B&amp;amp;W.  a B&amp;amp;W TV would need only that.  the $I$ and $Q$ signals are the chroma or color signals.  as their names suggest, consider them as the &quot;in-phase&quot; and &quot;quadrature&quot; components of a single complex-valued modulated signal which is how the old NTSC standard used to do it.  $I$ is the real part, $Q$ is the imaginary part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;color &quot;saturation&quot; would be the magnitude of $I+jQ$ and color &quot;hue&quot; would be the complex angle of $I+jQ$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-01-02T01:35:27.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13492" PostTypeId="1" AcceptedAnswerId="13497" CreationDate="2014-01-02T03:43:19.600" Score="5" ViewCount="989" Body="&lt;p&gt;I am trying to gain a better understanding of pole locations in the $z$-plane of a given discrete transfer function, $H(z)$.  I think I have a pretty good understanding of how to use the $\mathcal Z$-transforms for filter design, but there is something about the core concepts that still confuse me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that poles are locations in the $z$-plane (complex plane) where a specific value of $z$ results in $\left|H(z)\right|$ approaching infinity.  This happens when the denominator of a $\mathcal Z$-transform expression has a zero at $z=a$.  i.e. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) =\frac{1}{z-0.5} &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;would have &lt;strong&gt;one&lt;/strong&gt; pole at $z = 0.5$.  The inverse $\mathcal Z$-transform of this fraction would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(n) = \mathcal{Z}^{-1}\left\{\frac{1}{z-0.5}\right\} = 2\cdot0.5^{n-1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $z$ is less than 1, this impulse response will decay as $n$ increases.  So the response is stable (which happens as long as the pole lies within the unit circle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if we look at the definition of the $\mathcal Z$-transform, with $z$ written in complex exponential form, i.e. $z=re^{j\omega}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = H\left(re^{j\omega}\right) = \sum_{n=-\infty}^{n=\infty} h(n)\left(re^{j\omega}\right)^{-n} = \sum_{n=-\infty}^{n=\infty} h(n)r^{-n}e^{-j\omega n},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can now express the $\mathcal Z$-transform for our pole directly using using $z=re^{j\omega}$ with $r=0.5$ and $\omega$=0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(0.5) = \sum_{n=-\infty}^{n=\infty} h(n)0.5^{-n} = \infty&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know this sum is infinity from our original transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is where my question begins to form. When $h(n)$ is summed against the $0.5^{-n}$ function, we get an unbounded summation, or a pole.  Of course that can only happen if $h(n)$ is infinite (which it is), since the above summation for $H(0.5)$ could not be infinite otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if $h(n)$ is infinite such that it sums to infinity multiplied by $0.5^{-n}$, it would clearly also sum to infinity against $0.58^{-n}$ or $0.25^{-n}$ for that matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;So my question is, if there is a pole at 0.5, why aren't there poles all along the real axis (except for zero)?&lt;/em&gt;&lt;/strong&gt;  Why is there only a pole at 0.5?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it explicit, we can use the specific $h(n)$ that was the inverse $\mathcal Z$-transform of $H(z)$, above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H\left(\frac 14\right) = \sum_{n=-\infty}^{n=\infty} \left[2\cdot\left(\frac{1}{2}\right)^{n-1}\right]\cdot \left(\frac{1}{4}\right)^{-n}&#xA;= \sum_{n=-\infty}^{n=\infty} 4\cdot 2^n = \infty&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this sum makes it look like there is a pole at $z=0.25$ for the $\mathcal Z$-transform of $h(n)$, but the transfer function says there is not!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the single pole makes sense to me looking at the $H(z)$ transfer function, but it doesn't make sense to me when I take it and use it directly in the $\mathcal Z$-transform expression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="7436" LastEditorUserId="1629" LastEditDate="2016-04-28T02:59:52.267" LastActivityDate="2016-04-28T02:59:52.267" Title="Understanding $\mathcal Z$-transforms and pole locations" Tags="|discrete-signals|infinite-impulse-response|impulse-response|transfer-function|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13493" PostTypeId="2" ParentId="13475" CreationDate="2014-01-02T05:36:32.040" Score="2" Body="&lt;p&gt;Are you being asked to write a simple vocoder?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question is somewhat vague and confusing, but it seems like you are being asked to determine parameter thresholds for deciding when a speech frame is voiced (has fundamental periodic component and harmonics), unvoiced or frictional (noise generated), and silent (do not encode).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like you would be using the pitch frequency estimates to determine if the frame is voiced/unvoiced, and signal energy to determine if it is a silence frame.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If he said it's experimental, I think he is asking you to look at the energy and pitch content of an audio signal and see if you can see differences that will help you choose thresholds.  For example, get some audio of someone speaking.  When the person is vocalizing (i.e. vowel sounds like &quot;aaaahh&quot; and nasally sounds like &quot;mmmmmmmm&quot;) the spectrum should show periodic components.  For unvoiced sounds (i.e. short &quot;th&quot; &quot;t&quot; &quot;s&quot; &quot;f&quot; type sounds) the spectrum will look more like noise.  And when there is silence, the signal should be relatively low energy.  Take what you find and use that information to determine your thresholds.&lt;/p&gt;&#xA;" OwnerUserId="7436" LastEditorUserId="7436" LastEditDate="2014-01-02T05:50:51.470" LastActivityDate="2014-01-02T05:50:51.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13494" PostTypeId="2" ParentId="13472" CreationDate="2014-01-02T05:54:50.327" Score="2" Body="&lt;p&gt;Your best bet is to use the least squares solution to inverting the matrix A. I won't go into detail of deriving it, but the &lt;a href=&quot;https://en.wikipedia.org/wiki/Least_squares#Linear_least_squares&quot; rel=&quot;nofollow&quot;&gt;wikipedia article&lt;/a&gt; is pretty good. The solution you would get is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{\mathbf{x}} = \left(A^TA\right)^{-1}A^T\mathbf{y}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this solution mean? First, notice that we're solving for $\hat{\mathbf{x}}$, not $\mathbf{x}$, because there may not be a solution that solves your system perfectly. However, if you look at the difference vector $\mathbf{d} = \mathbf{x} - \hat{\mathbf{x}}$, then this solution guarantees that $\mathbf{d}$ has the smallest possible length out of all possible solutions in the usual Euclidean sense on length.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-01-02T05:54:50.327" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13495" PostTypeId="1" AcceptedAnswerId="13504" CreationDate="2014-01-02T06:08:08.193" Score="4" ViewCount="760" Body="&lt;p&gt;Suppose that $G(i,j)$ is a Gaussian decay function on the distance between points $i$ and $j$ of an image. In addition, $D(i,j)$ is the difference between the VALUES of the image at those points. &#xA;Now, at every point $i$ of an image I need to compute the summation of the neighboring $G(i,j) D(i,j) $ , this is, the product of both functions. This is a convolution-like operation: for every point I add the contributions of a function at every neighboring point.&#xA;However, I do not know if that can be expressed as a convolution because G and D are functions on different variables: the distance (a raw gaussian filter) and the image intensity difference. &#xA;I need help at expressing the summation as a combination of convolution operations in order to easily code it in a program without the need for loops. In addition, it would allow me to possibly do it in the frequency domain.&#xA;Any help will be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="7440" LastEditorUserId="7092" LastEditDate="2020-03-31T04:55:40.050" LastActivityDate="2020-03-31T04:55:40.050" Title="Convolution of an Image with a Kernel That Is a Product of Two Functions" Tags="|image-processing|filters|signal-analysis|convolution|fourier|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13496" PostTypeId="2" ParentId="13495" CreationDate="2014-01-02T09:46:16.103" Score="0" Body="&lt;p&gt;Let * denote convolution operation, $g$ denote Gaussian kernel, &amp;amp;h&amp;amp; some other kernel and I be your image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is a linear operation: $g*h*I = g*(h*I)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gradient operation is also a linear one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\nabla (g*I) = (\nabla g) * I$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this reason if you first differentiate your kernel then apply it you will end up with smooth gradients. Actually, this is what Sobel has achieved:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Sobel_operator&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you further smooth the image prior to applying Sobel, this actually would have the same effect of increasing kernel size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further info on difference and Gaussian tricks, I would also suggest you to check&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Difference_of_Gaussians&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Difference_of_Gaussians&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-02T09:46:16.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13497" PostTypeId="2" ParentId="13492" CreationDate="2014-01-02T11:43:52.767" Score="4" Body="&lt;p&gt;The actual computation for the inverse Z transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac1{z-0.5}=\frac1z\cdot\frac1{1-\frac{0.5}{z}}=z^{-1}\sum_{k=0}^{\infty}(0.5)^k z^{-k}=\sum_{n(=k+1)=1}^\infty (0.5)^{n-1}z^{-n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that you see that the series is one-sided, $h(n)=0$ for $n&amp;lt;1$. This should remove most of the infinities that you stumbled upon.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note that this geometric series only converges for $\left|\frac{0.5}{z}\right|&amp;lt;1$, that is $|z|&amp;gt;0.5$. For applications one is only interested in the values of the Z transform on or close to the unit circle, $|z|\approx 1$, the eigenvalues and singular values of the sequence shift operator. The unit circle is clearly and comfortably contained in the region of convergence. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So for instance, if the pole were at $z=2$, then the inverse Z transform would again use the Laurent series on and close to the unit circle, i.e., for $|z|&amp;lt;2$, to give&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac1{z-2}=-\frac12\,\frac1{1-\frac z2}=-\sum_{n=0}^{\infty}2^{(-n)-1} z^{-(-n)},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is, $h(n)=0$ for $n&amp;gt;0$ and $h(n)=-2^{n-1}$ for $n\le 0$&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-01-02T19:23:06.970" LastActivityDate="2014-01-02T19:23:06.970" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13498" PostTypeId="2" ParentId="13492" CreationDate="2014-01-02T11:50:17.067" Score="2" Body="&lt;p&gt;You appear to assume that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{n=0}^{\infty}{2\cdot0.5^{n-1}\cdot a^{-n}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is infinite when $a\neq0.5$. This does not appear to be the case. When $a=0.5$, both exponents cancel, the result is always $2\cdot 0.5^{n-1-n}=1$. When $a\neq0.5$, the exponents don't cancel. Instead, you could write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{n=0}^{\infty}{2\cdot0.5^{n-1}\cdot a^{-n}}=\sum_{n=0}^{\infty}{2\cdot0.5^{n-1}\cdot 0.5^{-n}}\cdot 2^{-n}\cdot a^{-n}=&#xA;\sum_{n=0}^{\infty}{2^{-n}\cdot a^{-n}}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is finite. I just noticed I'm using the unilateral z-Transform which you don't. In this case I would justify that by the signal having to be causal. The bilateral version appears not to converge anywhere, at all.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-02T11:50:17.067" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13499" PostTypeId="1" AcceptedAnswerId="13500" CreationDate="2014-01-02T15:35:21.993" Score="2" ViewCount="259" Body="&lt;p&gt;I am very very new to signals, and I am trying to generate sounds based on some parameters from a database. So, the database stores the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;startFrequency&lt;/li&gt;&#xA;&lt;li&gt;endFrequency&lt;/li&gt;&#xA;&lt;li&gt;startAmplitude&lt;/li&gt;&#xA;&lt;li&gt;endAmplitude&lt;/li&gt;&#xA;&lt;li&gt;duration&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am generating a WAV file based on this information using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;double currentFrequency;&#xA;double currentAmplitude;&#xA;&#xA;int samplerate = 44100;&#xA;int samples = ceil(duration * samplerate);&#xA;int* mySampleBuffer = new int[samples];&#xA;&#xA;for(int i=0; i&amp;lt;samples; i++)&#xA;{&#xA;    currentFrequency = Interpolate(i, 0, samples, startFrequency, endFrequency);&#xA;    currentAmplitude = Interpolate(i, 0, samples, startAmplitude, endAmplitude);&#xA;    mySampleBuffer[i] = static_cast&amp;lt;int&amp;gt;(INT_MAX * (sin(((double)i * currentFrequency * PI * 2)/(double)samplerate) * (currentAmplitude/maxAmplitude)));&#xA;}&#xA;&#xA;writeWAVData(&quot;mySound.wav&quot;, mySampleBuffer, mySampleBufferSize, samplerate, 1);&#xA;delete[] mySampleBuffer;&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the currentFrequency reaches 1/2 of the startFrequency, I notice that the sound wave flips (not sure what the correct term for this is). It doesn't seem like this is correct. Could someone help me understand what is going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of Audacity &lt;img src=&quot;https://i.stack.imgur.com/pbSOy.png&quot; alt=&quot;Audacity&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this image, startFrequency is 3380 Hz, endFrequency = 1380 Hz, duration is 0.512 s, and the amplitude is constant from start to finish. I have calculated that at 0.43264 s, the currentFrequency is exactly 1/2 of the startFrequency. In the picture you can see the &quot;flip&quot; happen at about 0.43 seconds.&lt;/p&gt;&#xA;" OwnerUserId="7447" LastEditorUserId="7358" LastEditDate="2014-01-03T03:56:25.220" LastActivityDate="2014-01-03T03:56:25.220" Title="Generating a sound where end frequency is 1/2 of the start frequency" Tags="|frequency|aliasing|sweep|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13500" PostTypeId="2" ParentId="13499" CreationDate="2014-01-02T16:09:14.967" Score="5" Body="&lt;p&gt;Think of frequency in this context more in terms of angular velocity. If that velocity is constant, nothing changes from the usual picture. However, if the frequency changes, it is more correct to compute the actual angle that is input into the trig functions as an anti-derivative of the frequency function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the interpolated frequency is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=(1-\tfrac tT)\,f_0+\tfrac tT\,f_T,$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the angle at time $t$ is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi(t)=2\pi\,\int_0^t f(s)\,ds=2\pi\, [t(1-\tfrac{t}{2T})\,f_0+\tfrac{t^2}{2T}]=\pi t\,[(2-\tfrac tT)f_0+\tfrac tT\,f_T]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, your formula is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi_o(t)=2\pi\,t\,f(t)=2\pi t\,[(1-\tfrac tT)f_0+\tfrac tT\,f_T]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has a derivative or local angular velocity of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi_o'(t)=2\pi\,[(1-2\tfrac tT)f_0+2\tfrac tT f_T]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has a zero at $t=\frac T2\,\frac{f_0}{f_0-f_T}$, which given your data is located at $t=0.43264s$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the correct formula also reaches the local angular frequency of zero, but at the double of that time interval, so outside $[0,T]$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note on implementation: The last form of $\phi(t)$ can be constructed as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; pi*(i*dt)*(f0+interpolate(i,f0,fT,N))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with &lt;code&gt;N=samples&lt;/code&gt; and &lt;code&gt;dt=T/N&lt;/code&gt;, provided that &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;interpolate(0,f0,fT,N)==f0 and interpolate(N,f0,fT,N)==fT &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-01-02T16:44:52.370" LastActivityDate="2014-01-02T16:44:52.370" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13501" PostTypeId="1" CreationDate="2014-01-02T16:11:10.793" Score="2" ViewCount="3400" Body="&lt;p&gt;I am trying to estimate the Spectral Correlation Function by the FFT Accumulation Method (FAM) in Matlab.  The way I understand the FAM method is as &lt;a href=&quot;http://www.intechopen.com/download/get/type/pdfs/id/32212&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt; (see page 6 &amp;amp; 7 for FAM tutorial).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the image again summarizing the process:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Yqopc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll summarize how I am understanding this method below:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Acquire a data chunk, of &lt;code&gt;size = N&lt;/code&gt; data points.&lt;/li&gt;&#xA;&lt;li&gt;Have the user enter in the desired frequency resolution (&lt;code&gt;d_f&lt;/code&gt;), and desired alpha resolution (&lt;code&gt;d_alpha&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;From &lt;code&gt;d_f&lt;/code&gt; and &lt;code&gt;d_alpha&lt;/code&gt;, calculate the following parameters.  &lt;code&gt;N' = fs/d_f;&lt;/code&gt; &lt;code&gt;fs&lt;/code&gt; is sampling frequency of input signal.  &lt;code&gt;N'&lt;/code&gt; turns out to be the STFT FFT size.  &lt;code&gt;L = N'/4&lt;/code&gt;, where L is the STFT skip (see diagram in link).  P = fs/(L*d_a), which is the smoothing FFT size .. and finally &lt;code&gt;N = P*L&lt;/code&gt;, &lt;code&gt;N&lt;/code&gt; is the total number of data points we are going to process.  &lt;code&gt;N&lt;/code&gt; should be nextpow2 &gt; the input size and zero padded if necessary.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have the code to chunk up the data into segments of &lt;code&gt;N'&lt;/code&gt; data points, perform windowing for each of those chunks, compute the FFT of each of those chunks, and perform the downshift to baseband.  I store the complex baseband into a matrix called XD.  The dimensions of XD are: &lt;code&gt;N'&lt;/code&gt; rows X &lt;code&gt;P&lt;/code&gt; cols, where each col represents the STFT for a chunk.  Then, I perform the following operations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;XD = conj(XD');  % now dim(XD) = P x N'.&lt;/code&gt;  we do this b/c FFT operates on columns in a matrix in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps I am confused about in the FAM method are the multiplication of X with its complex conjugate, performing the time smoothing w/ the P point FFT, and then outputting the SCF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To perform the multiplication w/ the complex conjugate, I do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Np = N' (in code).&#xA;XM = zeros(P, Np^2);&#xA;for k=1:Np&#xA;    for l=1:Np&#xA;        XM(:,(k-1)*Np+l) = (XD(:,k).*conj(XD(:,1)));        &#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially this operation is creating a matrix XM with dimensions of &lt;code&gt;P&lt;/code&gt; x &lt;code&gt;(N')^2&lt;/code&gt;.  After this, I do an FFT on XM&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;XM2 = fft(XM);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now what do I do?  I have to essentially select certain values from XM2 as my SCF estimate, but am confused on how to go about doing this?  Each row in XM contains the spectral correlation between different frequency bins.  So for example, column 1 of XM contains the spectral correlation of bin1 with bin1, col 2 contains spectral correlation of bin1 with &lt;code&gt;bin2&lt;/code&gt;, col &lt;code&gt;N'&lt;/code&gt; contains the spectral correlation between bin1 and &lt;code&gt;bin-N'&lt;/code&gt;, col &lt;code&gt;N'+1&lt;/code&gt; contains the spectral correlation between &lt;code&gt;bin2&lt;/code&gt; and &lt;code&gt;bin1&lt;/code&gt;, etc etc...  That is the reason that XM has dimensions of &lt;code&gt;P&lt;/code&gt; x &lt;code&gt;(N')^2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused as to which of these points I need to select in order to create my SCF estimate.  I essentially need to figure out which elements of XM correspond to a certain alpha and freq value, but I don't know how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, and happy new years!&lt;/p&gt;&#xA;" OwnerUserId="7323" LastEditorUserId="6" LastEditDate="2014-01-03T03:58:12.243" LastActivityDate="2017-02-03T23:43:14.507" Title="Spectral Correlation Function estimation using FAM method -- implementation help" Tags="|frequency-spectrum|autocorrelation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13502" PostTypeId="2" ParentId="13499" CreationDate="2014-01-02T16:25:35.520" Score="1" Body="&lt;p&gt;I think you rediscovered aliasing on your screen. Does it sound right?&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-02T16:25:35.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13504" PostTypeId="2" ParentId="13495" CreationDate="2014-01-02T18:29:37.883" Score="3" Body="&lt;p&gt;It is equivalent to a bilateral filter. You can move the kernel to each local part of image to do the dot product, then sum them up to get the result in a loop. There is also a fast implementation with O(1) in &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/36657-fast-bilateral-filter/content/FastBilateralFilter/shiftable_jointBF.m&quot; rel=&quot;nofollow&quot;&gt;matlab programming&lt;/a&gt; for your reference. And the relevant publications are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;K.N. Chaudhury, D. Sage, and M. Unser, &quot;Fast O(1) bilateral  filtering using &#xA;trigonometric range kernels,&quot; IEEE Transactions on Image Processing, vol. 20, &#xA;no. 11, 2011.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;K.N. Chaudhury, &quot;Acceleration of the shiftable O(1) algorithm for bilateral filtering &#xA;and non-local means,&quot; arXiv:1203.5128v1. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I assume the Gaussian kernel is position shift-invariant. So normalization means the sum of elements inside the kernel equals to 1. For a 3*3 Gaussian kernel, it is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1/16  2/16  1/16&#xA;2/16  4/16  2/16&#xA;1/16  2/16  1/16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The bilateral filter can also be &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html&quot; rel=&quot;nofollow&quot;&gt;normalized&lt;/a&gt; with the K factor of integral of the product of  Gaussian kernel and intensity kernel. You can try both to observe the effect of normalization on your image data.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-01-03T13:50:40.063" LastActivityDate="2014-01-03T13:50:40.063" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13505" PostTypeId="2" ParentId="6126" CreationDate="2014-01-02T21:23:19.613" Score="3" Body="&lt;p&gt;using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \left(x[n] - x[n+m] \right)^2 = x^2[n] + x^2[n+m] - 2x[n]x[n+m] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one can easily show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;R_x[m] &amp;amp; = \sum_{n=-\infty}^{\infty}x[n]x[n+m] \\&#xA;       &amp;amp; = \sum_{n=-\infty}^{\infty}x^2[n] - \frac{1}{2} \sum_{n=-\infty}^{\infty}\left(x[n] - x[n+m] \right)^2 \\&#xA;       &amp;amp; = \ R_x[0] \quad \quad  - \frac{1}{2} \sum_{n=-\infty}^{\infty}\left(x[n] - x[n+m] \right)^2 \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the first term is simply $R_x[0]$ and the second term is a non-negative number being subtracted from the first.  that means $R_x[m]$ cannot exceed $R_x[0]$ for any $m$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-01-02T21:23:19.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13506" PostTypeId="1" CreationDate="2014-01-03T00:39:08.010" Score="-1" ViewCount="452" Body="&lt;p&gt;I have this differential equation &#xA;  $$&#xA;    y''(t) + y'(t) + y(t) = x(t) - 3x'(t)&#xA;    $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the system response of the system: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;        H(f) = \frac{1 - 6\pi fj}{(2\pi fj)^2 +2\pi fj+1}&#xA;    $$&#xA;which is equivalent to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;        H(s) = \frac{1 - 3s}{s^2 +s+1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: How to find the impulse response? If I factorize the denominator, it's not gonna be pretty. e.g., $s + \frac{1 +\sqrt{-3}}{2}$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what does the following mean? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Find the output for $t \ge 0$ with initial conditions $y(0) = 1$, $y'(0) = -1$ when the input is $2cos(6t)u(t)$. Identify the zero state, the zero input, the transient, and the steady state responses. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7391" LastEditorUserId="7391" LastEditDate="2014-01-04T23:00:27.127" LastActivityDate="2014-02-04T06:17:48.793" Title="The impulse response, $h(t)$, of a system" Tags="|frequency|frequency-response|impulse-response|linear-systems|self-study|" AnswerCount="1" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="13507" PostTypeId="1" CreationDate="2014-01-03T07:36:21.183" Score="5" ViewCount="3167" Body="&lt;p&gt;When you use the deconvolution method to make the blurry image sharper, you will have to estimate the Point Spread Function. Is there a difference between this PSF and an image kernel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question: Is the Point Spread Function in the time domain or frequency domain? Or can it be in both?&lt;/p&gt;&#xA;" OwnerUserId="7452" LastEditorUserId="128" LastEditDate="2018-05-30T19:58:01.670" LastActivityDate="2018-05-30T19:58:01.670" Title="What's the Difference between Convolution Kernel and Point Spread Function in the Context of Image Convolution?" Tags="|image-processing|linear-systems|deconvolution|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13508" PostTypeId="2" ParentId="13507" CreationDate="2014-01-03T10:58:57.550" Score="2" Body="&lt;p&gt;There is a slight difference in definition and in context. A PSF does not need to be a convolution kernel, however, it is almost always assumed to be one. Usually, you talk of a ,,PSF'' when you want to find out what it is, exactly, and of a ,,convolution kernel'' when you're aware that there is a convolution.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-03T10:58:57.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13509" PostTypeId="2" ParentId="13467" CreationDate="2014-01-03T13:05:48.883" Score="2" Body="&lt;p&gt;If your signal is truly periodic, and you are using no window (= rectangular window), then you need to insure that the fundamental frequency is centered directly in an FFT bin. I assume that the frame rate of your video capture is not syncronized to the fundamental frequency of the objects fluctuation rate. If you are looking for large dynamic range, the ratio of sampling frequency to the fundamental signal frequency needs to be an integer to very high accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not possible then you can use more advanced techniques. One technique I have used in the past is to use the raw FFT to do a frequency estimation using 3rd-order peak interpolation, and then do a sample-rate conversion on the input signal buffer to pull the fundamental frequency directly into a bin. Then you take the FFT again, and should get good results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also google &lt;a href=&quot;https://www.google.com/search?q=sine-wave%20curve-fit&amp;amp;rlz=1C1VEAD_enUS414US414&amp;amp;aq=f&amp;amp;oq=sine-wave%20curve-fit&amp;amp;aqs=chrome.0.57j0l3.277&amp;amp;sourceid=chrome&amp;amp;ie=UTF-8&quot; rel=&quot;nofollow&quot;&gt;&quot;sine-wave curve-fit&quot;&lt;/a&gt;, which is another way to accurately extract the fundamental frequency. One advantage of this technique is that it produces a residual output which is equal to the signal with the fundamental component removed. In that case you might be able to get away with an un-syncronized FFT of the residual since the big main lobe of the fundamental (which is responsible for most of the window leakage) has been removed.&lt;/p&gt;&#xA;" OwnerUserId="7453" LastEditorUserId="7092" LastEditDate="2014-01-03T14:46:37.777" LastActivityDate="2014-01-03T14:46:37.777" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13511" PostTypeId="2" ParentId="2937" CreationDate="2014-01-03T13:53:19.997" Score="1" Body="&lt;p&gt;I'm guessing anshu is long gone, but it looks to me as if what's incorrect in the code given here is the last step; instead of (q1 - c q2, s q2) it should compute (c q1 - q2, s q1). The rest looks OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It is easy to make this kind of mistake in this kind of code -- you want to give those variables names with 1 and 2 to mean &quot;1 back&quot; and &quot;2 back&quot;, but then your brain is liable to think that 1 is &quot;earlier&quot; than 2...)&lt;/p&gt;&#xA;" OwnerUserId="7454" LastActivityDate="2014-01-03T13:53:19.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13514" PostTypeId="1" AcceptedAnswerId="13515" CreationDate="2014-01-03T16:06:58.840" Score="0" ViewCount="3588" Body="&lt;p&gt;experts.&lt;/p&gt;&#xA;&lt;p&gt;I have a question concern &amp;quot;linear sine sweep&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Here is the equation of linear sine sweep(from &lt;a href=&quot;http://en.wikipedia.org/wiki/Chirp&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Chirp Pattern&quot;&gt;Wikipedia Chirp&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x(t) = sin\biggl[ 2\pi( f_0 +\frac{f_1-f_0}{2T}t)t\biggr] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt; is start frequency&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f_1$&lt;/span&gt; is end frequency&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is total length of excitation time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In my case, I would like to calculate the excited frequency at certain time frame.&lt;/p&gt;&#xA;&lt;p&gt;Let me calculate it through an example.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f_0 = 20 \text{ Hz}$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$f_1=200 \text{ Hz}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T = 60\text{ s}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this case, above equation can be written as below,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x(t) = sin\biggl[ 2\pi( 20 +1.5t)t\biggr]. $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we estimate the frequency at time 30 s, I think we could calculate as 65 Hz.&lt;/p&gt;&#xA;&lt;p&gt;For checking this is right or not, I checked the power spectrum by selecting time through 29.5 s  - 30.5 s for frequency resolution 1 Hz.&lt;/p&gt;&#xA;&lt;p&gt;However, from the power spectrum, the frequency was 112 Hz.&lt;/p&gt;&#xA;&lt;p&gt;There is difference between simulation value and calculated value almost twice.&lt;/p&gt;&#xA;&lt;p&gt;Also, I just checked 1 second(29.5 s - 30.5 s) Fourier transform absolute value, it also displayed the peak frequency as 112 Hz.&lt;/p&gt;&#xA;&lt;p&gt;What is the correct value?&lt;/p&gt;&#xA;&lt;p&gt;If the calculated value, 65 Hz, is wrong, is there any comment for correcting this?&lt;/p&gt;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;&lt;p&gt;If there is any comment or question, please let me know.&lt;/p&gt;&#xA;" OwnerUserId="4639" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2018-10-21T16:15:40.820" Title="How to estimate the frequency at certain time of linear sine sweep?" Tags="|frequency|sweep|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13515" PostTypeId="2" ParentId="13514" CreationDate="2014-01-03T16:43:43.467" Score="3" Body="&lt;p&gt;Frequency is the first derivative of the phase so in this case that's f0+(f0-f1)*t/T. If you plug in the numbers you get 110Hz, which is what your measurement shows. Not sure how you got 65Hz for that ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's intuitively clear as well. The sweep starts at 20 Hz and ends at 200 Hz after 60s. After 30s you should be at the half way point between 20 and 200, which is 110 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\varphi (t) = 2 \pi \cdot (f_{0}+\frac{f_{1}-f_{0}}{2T}\cdot t)\cdot t = 2 \pi \cdot (f_{0}\cdot t+\frac{f_{1} -f_{0}}{2T}\cdot t^{2})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\frac{1}{2 \pi}\cdot \frac{\partial \phi}{\partial t}=f_{0}+\frac{f_{1}-f_{0}}{T}t$$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="235" LastEditDate="2014-01-03T17:16:52.347" LastActivityDate="2014-01-03T17:16:52.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13516" PostTypeId="2" ParentId="13514" CreationDate="2014-01-03T16:44:59.013" Score="0" Body="&lt;p&gt;See the recent topic (&lt;a href=&quot;https://dsp.stackexchange.com/questions/13499/generating-a-sound-where-end-frequency-is-1-2-of-the-start-frequency&quot;&gt;Generating a sound where end frequency is 1/2 of the start frequency&lt;/a&gt;) on the opposite case of constructing such a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As used in the wikipedia article, but not explained, the local or instantaneous frequency is the derivative of the phase function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the interval $[t-Δt, t+Δt]$ the signal moves through $\frac{\phi( t+Δt)-\phi(t-Δt)}{2\pi}\approx\frac{\phi'(t)}{2\pi}\cdot 2Δt$ full periods of the sine function. So for small intervals, but large enough to contain still a few oscillations, $\frac{\phi'(t)}{2\pi}$ is a good approximation for the local frequency.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-01-03T16:52:21.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13517" PostTypeId="1" AcceptedAnswerId="13523" CreationDate="2014-01-03T18:20:40.443" Score="1" ViewCount="180" Body="&lt;p&gt;I want to learn how to go about analyzing some audio files I have acquired.  Let's say the files contain some sort of repeating sound (e.g., water dripping), and I want to derive the pattern of the repeating sound.  I use R for programming and analysis and have briefly introduced myself to the &lt;code&gt;tuneR&lt;/code&gt; and &lt;code&gt;seewave&lt;/code&gt; packages, but I am open to any answers about how such an analysis should be conducted.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make my question more concrete, let's say I have a 2 hour audio file of water dripping and I would like to be able to select some point or interval in the file and know the drip rate.  I will be pursuing further processing (e.g., finding times when the drip rate is most steady, fastest, slowest, etc.), but right now I am looking to learn how to get started with this task.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Specifics of my audio files: &#xA;.Wav files &#xA;Sampling rate: 44100 Hz&#xA;Bits: 16 &#xA;Stereo&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I briefly read about Fourier transforms, but due to my lack of knowledge and my rudimentary understanding of terminology, I am unclear if a Fourier transform would be appropriate starting place for this task.  I also briefly read about subcarriers, envelopes, and autocorrelation, but it quickly became clear to me that I could benefit greatly from some guidance before I start investing too much time learning about and introducing myself to the incorrect topics.&lt;/p&gt;&#xA;" OwnerUserId="4300" LastEditorUserId="76" LastEditDate="2014-01-04T00:05:31.980" LastActivityDate="2014-01-04T03:39:26.927" Title="How to derive a rate (e.g. water dripping) from an audio file" Tags="|filters|audio|frequency|signal-analysis|autocorrelation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13519" PostTypeId="1" CreationDate="2014-01-03T19:08:52.373" Score="1" ViewCount="264" Body="&lt;p&gt;I am working on algorithms to separate mixtures of 'almost periodic' signals. One such example is composite ECG consisting of maternal and fetal signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help with examples of such signals? The signal can also be from internet data.&lt;/p&gt;&#xA;" OwnerUserId="7459" LastEditorUserId="76" LastEditDate="2014-01-04T00:07:27.307" LastActivityDate="2014-02-03T00:17:25.280" Title="Examples of mixture of 'almost periodic' signals/data in nature or practice" Tags="|signal-analysis|source-separation|periodic|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13520" PostTypeId="2" ParentId="13519" CreationDate="2014-01-03T20:12:53.447" Score="1" Body="&lt;p&gt;The sound produced using the lowest pitched strings of large stringed music instruments often includes slightly inharmonic overtones (due to finite string thickness and stiffness), which renders the waveform of the note pitch not quite, but &quot;almost periodic&quot;.  You can record these sounds from the bottom octaves of most (physical, stringed) pianos, and bass guitars, etc.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-03T20:12:53.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13521" PostTypeId="2" ParentId="13254" CreationDate="2014-01-03T20:20:46.153" Score="1" Body="&lt;p&gt;You can capture a higher frequency signal by a using a sample rate much lower than twice the signal/spectral content frequency.  It's called undersampling.  To be useful, one has to know approximately how many &quot;folds&quot; the signal frequency is above the sample rate, there has to be no baseband (or other folded spectrum) signal to alias against, thus the bandwidth of the signal has to be narrower than Fs/2, and the spectrum of the signal can't cross any multiple of Fs/2.  The jitter of the sampling clock also has to be quite low (as low as the max absolute time jitter required for a sampler that is clocked at well above the signal frequency.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is no different from baseband sampling, as one needs a-priori knowledge (that the signal was, in fact, correctly low-pass-filtered baseband below Fs/2) to reconstruct the original signal correctly,&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-01-03T20:32:32.457" LastActivityDate="2014-01-03T20:32:32.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13522" PostTypeId="2" ParentId="13519" CreationDate="2014-01-03T20:20:48.510" Score="0" Body="&lt;p&gt;Try the so-called &lt;a href=&quot;http://www.physionet.org/physiobank/database/mitdb/&quot; rel=&quot;nofollow&quot;&gt;MIT DB&lt;/a&gt;. They got a few annotated signals.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-03T20:20:48.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13523" PostTypeId="2" ParentId="13517" CreationDate="2014-01-04T00:40:45.103" Score="3" Body="&lt;p&gt;Beat detection is not what you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beat detection aims at looking for a periodic, sometimes implicit pulse in music signals. The events you are interested here are not periodic and every drip counts. What you are looking for is instead &quot;Onset detection&quot;, to recognize each percussive event in the audio signal. There are ready to use software solution like &lt;a href=&quot;http://aubio.org/&quot; rel=&quot;nofollow&quot;&gt;aubio&lt;/a&gt; or &lt;a href=&quot;http://www.omras2.org/sonicannotator&quot; rel=&quot;nofollow&quot;&gt;sonic annotator&lt;/a&gt; to extract the timestamps at which percussive events occur in an audio file. From there, it is only a matter of running a sliding window over your output, count events within the window and divide by the duration of the window.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-01-04T03:39:26.927" LastActivityDate="2014-01-04T03:39:26.927" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13524" PostTypeId="1" AcceptedAnswerId="13631" CreationDate="2014-01-04T01:46:01.890" Score="5" ViewCount="5578" Body="&lt;p&gt;Compressive Sensing is built on 2 properties: 1) the sparsity of the representation basis relative to the sampling basis and 2) the incoherence between the singular vectors from each of the 2 bases in a). On the surface this seems fine to me but he &quot;incoherence&quot; relationship is confusing me a little. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some texts refer to the coherence between the bases (representation, sampling) and other refer to the coherence between each basis and the standard basis (e1, e2, e3 ...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a difference between these two statements?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;We are in the position to state our main result: if a matrix has row&#xA;  and column spaces that are incoherent with the standard basis, then&#xA;  nuclear norm minimization can recover this matrix from a random&#xA;  sampling of a small number of entries.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Page 6: &lt;a href=&quot;http://statweb.stanford.edu/~candes/papers/MatrixCompletion.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://statweb.stanford.edu/~candes/papers/MatrixCompletion.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Incoherent sampling ... The coherence between the sensing basis and and the representation basis&quot;.&#xA;Page 3: &lt;a href=&quot;http://authors.library.caltech.edu/10092/1/CANieeespm08.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://authors.library.caltech.edu/10092/1/CANieeespm08.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is related to this question:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/a/13017/4038&quot;&gt;https://dsp.stackexchange.com/a/13017/4038&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="128" LastEditDate="2019-06-03T04:25:47.053" LastActivityDate="2019-06-03T04:25:47.053" Title="Compressive Sensing - Incoherence Property" Tags="|signal-analysis|correlation|compressive-sensing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13525" PostTypeId="1" AcceptedAnswerId="13528" CreationDate="2014-01-04T01:51:38.233" Score="5" ViewCount="14751" Body="&lt;p&gt;There have been discussions on the differences between convolution and correlation, autocorrelation, cross-correlation, et al.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In spite of looking at the &lt;a href=&quot;http://www.youtube.com/watch?v=Ma0YONjMZLI&quot; rel=&quot;nofollow noreferrer&quot;&gt;visualizations&lt;/a&gt;, and understanding the formula for calculation of convolution and correlation, I don't understand the &lt;em&gt;need&lt;/em&gt; for correlation - is it required for identifying a signal uniquely?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the distinction between correlation and cross-correlation (if any exists)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I get that convolution can be important in determining system responses to any arbitrary input signals when the impulse response is known, but what are the practical scenarios where correlation is helpful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the theoretical differences between the concepts and &lt;a href=&quot;https://dsp.stackexchange.com/questions/2654/what-is-the-difference-between-convolution-and-cross-correlation?rq=1&quot;&gt;this link&lt;/a&gt; isn't helpful for my question.&lt;/p&gt;&#xA;" OwnerUserId="7460" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-01-04T09:48:39.660" Title="Applications of Correlation in Signal Processing" Tags="|convolution|autocorrelation|cross-correlation|correlation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13526" PostTypeId="2" ParentId="13525" CreationDate="2014-01-04T03:01:16.743" Score="4" Body="&lt;p&gt;A relatively simple application where correlation is used is in determining timing of a communications signal.  A known synchronization signal will be sent periodically so that the receiver can use it as a point of reference.  How does the receiver use it as a point of reference?  It correlates the incoming signal stream against the known sequence, and when the correlation peak is above a certain threshold, it will use the peak to establish symbol timing and make decisions on the symbols to extract a binary sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlation usually means cross-correlation, but I think the latter term only exists to be distinguished from auto-correlation.&lt;/p&gt;&#xA;" OwnerUserId="7436" LastActivityDate="2014-01-04T03:01:16.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13527" PostTypeId="1" AcceptedAnswerId="13529" CreationDate="2014-01-04T06:49:36.687" Score="-1" ViewCount="97" Body="&lt;p&gt;Let us consider the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ x ] = generate1(N,m,A3)&#xA;f1 = 100;&#xA;f2 = 200;&#xA;T = 1./f1;&#xA;t = (0:(N*T/m):(N*T))'; %'&#xA;wn = randn(length(t),1); %zero mean variance 1&#xA;x = 20.*sin(2.*pi.*f1.*t) + 30.*cos(2.*pi.*f2.*t) + A3.*wn;&#xA;%[pks,locs] = findpeaks(x);&#xA; %plot(x);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know peaks in the Fourier domain are represented at these frequencies, which are present in the signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let us take the plot of the Fourier transform of this signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=generate1(3,500,1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and  plot&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(abs(fft(y)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vOTz0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but clearly it does not show peaks at the frequencies given in the signal.  What is the problem?&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="76" LastEditDate="2014-01-04T09:27:06.683" LastActivityDate="2014-01-04T10:40:52.223" Title="Spectral structure of sinusoidal model" Tags="|fourier-transform|power-spectral-density|" AnswerCount="1" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="13528" PostTypeId="2" ParentId="13525" CreationDate="2014-01-04T09:48:39.660" Score="3" Body="&lt;p&gt;Correlation is mainly used for capturing the similarity of signals. A special case, normalized cross correlation is now accepted to be one the best methods to match a signal in another one (e.g. finding a template in a search image). In other words, this is called matching. More details:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation#Normalized_cross-correlation&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Cross-correlation#Normalized_cross-correlation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB code:&#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/29005-generalized-normalized-cross-correlation&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/29005-generalized-normalized-cross-correlation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Autocorrelation (cross correlation of the signal with itself) on the other hand, might give you information on repetitive patterns within the signal, such as musical beats. Pitch estimation of music also uses autocorrelation. In statistics, auto-correlation is used for error analysis, too. I would therefore suggest you also take a look at:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation#Applications&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Autocorrelation#Applications&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-04T09:48:39.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13529" PostTypeId="2" ParentId="13527" CreationDate="2014-01-04T09:55:13.753" Score="1" Body="&lt;p&gt;Lets analyze the computation. Your function takes $N$ periods of the $100Hz$ sine wave and correspondingly $2N$ periods of the $200Hz$ sine wave and samples them in $m$ equidistant points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you perform an FFT of size $m$. If we forget for the moment that there is a factor of 100Hz used in the production, we have sampled waves of $N$ and $2N$ full oscillations, and the FFT detects or handles sinusoids with up to $m/2$ full oscillations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the plot from of the FFT result scaled from 0 to m one would expect the first wave at position N, the second at position 2N, and the mirror frequencies at m-1-N and m-1-2N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example with N=3 and m=500, the 100Hz component is at position 3 and the 200Hz component at position 6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get more striking results, either reduce the range in the display to $[0:10N]$ or similar, or choose the magnitudes of m and N closer together, m=8N to m=20N should work well.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Added matlab interna: the fft command produces the DC at position 1, the first array position. The FFT with sampling frequency $f_s$ and $m$ samples produces a sampling of the frequency spectrum ranging from $-f_s/2$ to $f_s/2$ in $m$ steps, assuming $m$ is even. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fft command arranges these frequencies by wrapping around at $fs/2$, so that a component for $f&amp;gt;fs/2$ in reality is a component for $f-f_s&amp;lt;0$. For real signals, the negative spectrum is essentially the same as the positive, complex conjugation is the only difference. So one can just disregard the second half of the result of fft for visualization purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;generate1&lt;/code&gt; function should at least also return the sampling frequency &lt;code&gt;fs=(f1*m)/N&lt;/code&gt;. Then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m=500;&#xA;y,fs=generate1(3,m,1);&#xA;A=abs(fft(y))/m;&#xA;f=(0:1:m-1)*fs;&#xA;plot(f(1:m/2),A(1:m/2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;produces the full spectrum with correct scale. Replace &lt;code&gt;m/2&lt;/code&gt; in the plot command with a smaller number to display only parts of the spectrum. &lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-01-04T10:40:52.223" LastActivityDate="2014-01-04T10:40:52.223" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="13530" PostTypeId="1" CreationDate="2014-01-04T10:49:37.747" Score="2" ViewCount="5157" Body="&lt;p&gt;I need to implement an adaptive delta modulation encoder and decoder using matlab for my term project. How can I code a good adaptive delta modulation? How can I change &lt;code&gt;delta&lt;/code&gt;(or &lt;code&gt;sigma&lt;/code&gt;) to follow speech signals better? After that How can I decode it to recover original signal? I am using an algorithm which has that main idea: if three successive samples are equal, I increased delta with a constant &lt;code&gt;k&lt;/code&gt;. It is useful but not enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is used codes for adaptive delta modulation:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    function [ cn ] = adm_enc( signal )&#xA;delta_min = 0.6250/5; % minimum step size&#xA;k=1.5; &#xA;m = 0.85&#xA;% scaling constant&#xA;L = length(signal);    % length of input signal&#xA;Mq = zeros(1,L);   %aproximated or quintized signal     &#xA;dq = zeros(1,L);   %quantized error or difference between original signal and aproximated signal &#xA;cn = zeros(1,L);   %encoded output as a binary signal&#xA;delta=ones(1,L);   &#xA;for n=2:L&#xA;&#xA;    d = signal(n) - Mq(n-1); % error or difference between input (original) signal and approximation&#xA;    if d&amp;gt;0  % if error is greater than 0&#xA;        dq(n)=delta_min; % equate output to delta_min&#xA;    else&#xA;        dq(n)=-1.*delta_min; % equate output to -delta_min&#xA;    end&#xA;&#xA;    if dq(n)==dq(n-1) &amp;amp;&amp;amp; dq(n-1) == dq(n-2) % if two previous outputs are equal&#xA;        delta(n)=k.*delta(n-1); % scale step size&#xA;    else&#xA;        delta(n)=delta_min; % otherwise equate output to min step size&#xA;    end&#xA;     Mq(n) = Mq(n-1) + delta(n).*dq(n); % calculate approximation signal&#xA;end&#xA;for i=1:length(cn) % encode the output as a binary signal&#xA;    if dq(i)==delta_min&#xA;        cn(i)=1;&#xA;    else&#xA;        cn(i)=0;&#xA;    end&#xA;end&#xA;&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Codes used for adaptive delta demodulation (decoding process):&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ signal ] = adm_dec( cn )&#xA;delta_min = 0.6250/5;   % minimum step size&#xA;L = length(cn);     % length of input signal&#xA;k=1.5;        % scaling constant&#xA;&#xA;signal = zeros(1,L);  % initializations&#xA;delta=ones(1,L);&#xA;for i=1:length(cn) % decode binary input as output of adm&#xA;    if cn(i)==1&#xA;        Mq(i)=delta_min;&#xA;    else&#xA;        Mq(i)=-1.*delta_min;&#xA;    end&#xA;end&#xA;for n=2:L&#xA;&#xA;    if Mq(n)==Mq(n-1) % if two sequential input values are equal&#xA;        delta(n)=k.*delta(n-1); % scale step size&#xA;    else&#xA;        delta(n)=delta_min; % otherwise equate step size to min step size&#xA;    end&#xA; signal(n) = signal(n-1) + delta(n).*Mq(n); % calculate output of adm&#xA;end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After decoding process I am using a &lt;code&gt;lowpass filter&lt;/code&gt; to remove unwanted high frequency harmonics. &lt;/p&gt;&#xA;" OwnerUserId="7461" LastEditorUserId="7461" LastEditDate="2014-01-05T17:51:00.833" LastActivityDate="2014-01-05T17:51:00.833" Title="Adaptive Delta Modulation For Speech Signals" Tags="|matlab|modulation|homework|speech|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13531" PostTypeId="1" CreationDate="2014-01-04T11:33:08.367" Score="3" ViewCount="2355" Body="&lt;p&gt;I wish to isolate a crosswalk from its surrounding, and I thought that as crosswalks have a repetitive pattern of thick white stripes, I might be able to isolate them by measuring their frequency range, and using a band pass filter with the right cut-off frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I have no idea how to analyze the frequency of patterns in images. I know I should run fft2 on an isolated crosswalk, but I don't know what to do with the result.&lt;/p&gt;&#xA;" OwnerUserId="7464" LastActivityDate="2014-01-04T12:18:55.610" Title="Understanding Spatial Frequency of Images (using matlab)" Tags="|matlab|filters|frequency|image-processing|spatial|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13532" PostTypeId="2" ParentId="13531" CreationDate="2014-01-04T12:18:55.610" Score="2" Body="&lt;p&gt;If it is the repetitive pattern, you may observe some strong magnitude at some position in frequency domain. Use &lt;code&gt;imagesc(abs(fftshift(fft2(img))))&lt;/code&gt;, you probably would see:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HiaNG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those small white spots in the image correspond to the repetitive texture that is superimposed on the image. You may then use &lt;code&gt;ordfilt2(F,roi^2,ones(roi))&lt;/code&gt; to find out the &lt;code&gt;roi * roi&lt;/code&gt; local maximum of the image. Here &lt;code&gt;F = abs(fftshift(fft2(img)))&lt;/code&gt;, &lt;code&gt;roi&lt;/code&gt; is the region size of interest. Then change those values to zero:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sYrtN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the &lt;code&gt;real(ifft2(fftshift(F0)))&lt;/code&gt; you will recover the image in spatial domain. F0 is the frequency distribution after you implement the white spots removal on  &lt;code&gt;fftshift(fft2(img)))&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-04T12:18:55.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13533" PostTypeId="1" CreationDate="2014-01-04T13:19:07.467" Score="0" ViewCount="538" Body="&lt;p&gt;It's well known that convolution in the spatial domain is equivalent to multiplication in the frequency domain. i have multiplied the Fourier transform of an image &lt;em&gt;F&lt;/em&gt; with &lt;em&gt;H&lt;/em&gt;. where &lt;em&gt;H&lt;/em&gt; is the FT of a Gaussian function generated by the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function H = gaussian_kernel(size, sigma)&#xA;&#xA;    half_size = floor(size/2);&#xA;    [u,v]=meshgrid(-half_size:half_size,-half_size:half_size);&#xA;    H = exp(-(u.^2+v.^2) ./ (2 * sigma^2));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the size of &lt;em&gt;H&lt;/em&gt; is equal to the size of the image. my question is how to estimate h which is the blurring in spatial domain given that the FT of the gaussian is gaussian.&lt;/p&gt;&#xA;" OwnerUserId="1380" LastActivityDate="2014-01-07T05:29:42.803" Title="Inverse Fourier Transform" Tags="|fft|fourier-transform|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13535" PostTypeId="1" AcceptedAnswerId="13540" CreationDate="2014-01-04T14:04:28.470" Score="0" ViewCount="100" Body="&lt;p&gt;According to &lt;a href=&quot;https://dsp.stackexchange.com/questions/13527/spectral-structure-of-sinusoidal-model&quot;&gt;my previous question&lt;/a&gt;, I have changed the generate command to: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=generate1(100,1000,1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and got the following picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2KsED.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to test a wavelet transform on the same signal, which of course exists in Matlab, but I have  one thing which I should  clarify: generally, as I know large scale values correspond to small frequencies and small scale values to large frequencies.  So, how should I determine if the given frequencies are small or large? Also, which wavelet transform should i use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m=cwt(y,1:100,'sym2');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and plot it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(m)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pkyis.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I read the second picture? What kind of information can I get?&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-01-05T01:24:27.607" Title="Get spectral picture from a wavelet transform" Tags="|fourier-transform|wavelet|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13536" PostTypeId="1" CreationDate="2014-01-04T14:50:25.523" Score="1" ViewCount="877" Body="&lt;p&gt;I am trying to achieve a pattern matching between an image and a scene in which the image is. I am having problems with some images that does not contain corners, since &lt;a href=&quot;http://en.wikipedia.org/wiki/SURF&quot; rel=&quot;nofollow&quot;&gt;SURF&lt;/a&gt; is not able to find keypoints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know any algorithm or method for retrieving keypoints in images without corners? In other words: how can I find an image inside another when this image does not contain corners?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Matlab. Thank you in advance,&lt;/p&gt;&#xA;" OwnerUserId="3815" LastEditorUserId="53" LastEditDate="2014-01-04T21:45:57.483" LastActivityDate="2014-01-04T21:45:57.483" Title="Detect keypoints in images without corners" Tags="|image-processing|matlab|computer-vision|matlab-cvst|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13537" PostTypeId="2" ParentId="13536" CreationDate="2014-01-04T15:09:27.850" Score="1" Body="&lt;p&gt;If you are after the simplest algorithm, you can basically try Genaralized Hough Transform using the image edges only (not corners). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For really textureless objects, the following might guide you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) If you are willing to use an RGBD camera such as kinect, Hinterstoisser has come up with a quite good algorithm to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cvlabwww.epfl.ch/~lepetit/papers/hinterstoisser_pami11.pdf&quot; rel=&quot;nofollow&quot;&gt;http://cvlabwww.epfl.ch/~lepetit/papers/hinterstoisser_pami11.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If not, you can use BOLD features (Bunch of Line detectors). This would assume your template is composed of line features, and not corners. This paper is also quite comfortable to read:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://vision.deis.unibo.it/fede/papers/iccv13_pre.pdf&quot; rel=&quot;nofollow&quot;&gt;http://vision.deis.unibo.it/fede/papers/iccv13_pre.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the papers I provided are published after LineMod (or Line2D), which is already in OpenCV:&#xA;&lt;a href=&quot;http://ar.in.tum.de/pub/hinterstoisser2011linemod/hinterstoisser2011linemod.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ar.in.tum.de/pub/hinterstoisser2011linemod/hinterstoisser2011linemod.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-01-04T15:17:05.593" LastActivityDate="2014-01-04T15:17:05.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13538" PostTypeId="2" ParentId="13533" CreationDate="2014-01-04T15:15:49.903" Score="1" Body="&lt;p&gt;Suppose in time domain a Gaussian kernel is expressed as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;f(x,y) = exp (-r.^2/r0.^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where &lt;code&gt;r.^2 = x.^2 + y.^2;&lt;/code&gt;, &lt;code&gt;r0&lt;/code&gt; is the radius of the &lt;code&gt;exp(-1)&lt;/code&gt; point.&#xA;Then the 2D FFT should be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;F(u,v) = pi/r0.^2 * exp(-w.^2/w0.^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where &lt;code&gt;w.^2 = u.^2 + v.^2;&lt;/code&gt; , &lt;code&gt;w0 = 1/ (pi * r0);&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;As a result, I would change your function to:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;function H = gaussian_kernel(size, sigma)&#xA;&#xA;    half_size = floor(size/2);&#xA;    [u,v]=meshgrid(-half_size:half_size,-half_size:half_size);&#xA;    H = exp(-(u.^2+v.^2) ./ (2 * sigma^2));&#xA;    r0 = 2 * sigma^2 * pi^2;&#xA;    H = H * r0 * pi;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;H = gaussian_kernel(16, 2);&#xA;subplot(2,1,1),imagesc(H)  % frequency domain&#xA;subplot(2,1,2),imagesc(real(fftshift((ifft2(fftshift(H))))))  % time domain&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;result:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c2k75.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose it is &lt;code&gt;(-N/2+1 : N/2) /N * fs&lt;/code&gt; in the frequency axis (&lt;code&gt;N&lt;/code&gt; is the sampling point number, and &lt;code&gt;fs&lt;/code&gt; is the sampling rate), then it is supposed to be &lt;code&gt;(0:N-1)/(N * fs)&lt;/code&gt; in spatial axis.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-01-04T15:25:46.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13539" PostTypeId="2" ParentId="13536" CreationDate="2014-01-04T15:38:06.103" Score="4" Body="&lt;p&gt;The computer vision system toolbox in Matlab includes &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/feature-detection-extraction-and-matching.html&quot; rel=&quot;nofollow&quot;&gt;Feature Detection, Extraction, and Matching&lt;/a&gt;. The line, edges, histogram of oriented gradients are all included other than the corner features. And there is also an &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/feature-detection-extraction-and-matching.html#btj3w6s&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; on point feature matching in the toolbox (the names are called corners but they are actually not).&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-04T15:38:06.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13540" PostTypeId="2" ParentId="13535" CreationDate="2014-01-04T15:58:29.627" Score="0" Body="&lt;p&gt;Try this one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m=cwt(y,1:100,'sym2','plot');&#xA;colormap(pink)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result (btw, I cannot reproduce your curve in time domain with the function &lt;code&gt;generate1&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OQDSs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low scale values compress the wavelet and correlate better with high frequencies. While high scale values stretch the wavelet and correlate better with the low frequency content of the signal.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-04T15:58:29.627" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13541" PostTypeId="1" CreationDate="2014-01-04T16:35:41.860" Score="3" ViewCount="446" Body="&lt;p&gt;I am working on Speckle reduction in ultrasound images. I read a paper (snapshot of that paper is included below) where they have used a metric called beta metric which indicates the edge preserving capability of the filters. I tried to implement it using the equation (7) provided in the below snapshot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VK9hH.jpg&quot; alt=&quot;Beta Metrics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; %---Beta Calculation&#xA;    h = fspecial('laplacian');&#xA;    I1 = imfilter(Orig_Image,h);&#xA;    I2 = imfilter(Esti_Image,h);&#xA;    I_1 = mean2(I1);&#xA;    I_2 = mean2(I2);&#xA;    metrics.Beta = sum(sum((I1 - I_1).*(I2 - I_2)))./(sqrt(sum(((I1 - I_1).^2).*((I2 - I_2).^2))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;As you can see that the beta value is a single value [1x1] vector in Table 2 inside the snapshot. But when I run my code, I get beta value of size 1x256 for a 256x256 image.&#xA;Is my code wrong? How to implement the given equation (7) correctly in MATLAB? Please help.&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-06-15T22:12:47.533" Title="How to calcuate the beta metrics?" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13544" PostTypeId="2" ParentId="13536" CreationDate="2014-01-04T17:24:31.337" Score="1" Body="&lt;p&gt;It depends which types of the features are useful for you. If the corners are not useful/caracteristic, you should look elsewhere. For example, may be blob-like features will suit you need.&#xA;Take a look at wikipedia article on feature detectors &lt;a href=&quot;http://en.wikipedia.org/wiki/Feature_detection_(computer_vision)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Feature_detection_(computer_vision)&lt;/a&gt;. It is a good starting point and will give you an idea what are the groups and assumptions.&#xA;Nowadays there are many toolboxes that integrate many of those algorithms. For example, recent MATLAB versions already include toolboxes for computer vision.&lt;/p&gt;&#xA;" OwnerUserId="7466" LastActivityDate="2014-01-04T17:24:31.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13545" PostTypeId="2" ParentId="13533" CreationDate="2014-01-04T18:51:40.770" Score="0" Body="&lt;p&gt;i would look at it from a more fundamental, continuous-time (or continuous-space) and continuous-frequency perspective.  defining the Fourier Transform and inverse as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathfrak{F}\{x(t)\} = X(f) \triangleq \int_{-\infty}^{+\infty} x(t) e^{-i 2 \pi f t} dt  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and inverse&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathfrak{F}^{-1}\{X(f)\} = x(t) = \int_{-\infty}^{+\infty} X(f) e^{i 2 \pi f t} df $$ ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a nice transform pair to remember is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathfrak{F} \left\{ e^{-\pi t^2} \right\} =  e^{-\pi f^2} $$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;use the scaling property of the Fourier Transform to relate how wide the gaussian in one domain is related to how wide the gaussian is in the other.  you have to define how wide the extent of &quot;blurring&quot; is since the gaussian never really gets to zero.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-01-07T05:29:42.803" LastActivityDate="2014-01-07T05:29:42.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13546" PostTypeId="1" CreationDate="2014-01-04T20:54:48.740" Score="1" ViewCount="1198" Body="&lt;p&gt;I'm implementing a spectrogram algorithm and I get the basic concepts, however, I'm struggling with something. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have a 1D vector:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data = [0.36, 0.58, ...., 0.25]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then compute a STFT of this data (with an overlap of say 128) this then produces a 2D array. I then compute the log of these values in order to compute the spectrogram.  Would the resulting vector be 1D or 2D? Since the STFT is 2D (as it is split into blocks), I'm guessing that the spectrogram will be a 1D representation since I'm calculating the logs.&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="76" LastEditDate="2014-01-05T01:23:47.567" LastActivityDate="2014-01-05T01:23:47.567" Title="Will the resulting spectrogram from this algorithm be 1D or 2D?" Tags="|spectrogram|stft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13547" PostTypeId="2" ParentId="11349" CreationDate="2014-01-04T21:04:46.750" Score="3" Body="&lt;p&gt;I'm coming in pretty late, but...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you looking for a somewhat intuitive explanation since you already have the basic mathematical definitions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coherence time is the time over which the channel impulse response does not change appreciably or decorrelate (with &quot;appreciably&quot; having different interpretations depending on what you're doing).   The general idea is that if you are equalizing the channel in the receiver, the equalizer coefficients will not need to change significantly over the coherence time.   If training intervals are required, the training intervals need to happen faster than the coherence time would indicate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise coherence bandwidth, for an OFDM system in particular, suggests that the frequency-domain equalizer coefficients over certain bandwidth spans will be similar.  This is consistent with the definition you cited that the channel is essentially flat over the coherence bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these are statistical measures, however, as either can change quickly in a real channel and things like the spacing of nulls in the frequency domain is generally not constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response of the channel is the FT of the time-domain impulse response.  So &quot;coherence bandwidth&quot; is related to the FT of the delay spread, and that delay spread is expected to stay correlated with itself over the length of the coherence time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps a bit.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2014-01-04T21:04:46.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13548" PostTypeId="2" ParentId="13546" CreationDate="2014-01-04T21:15:55.177" Score="1" Body="&lt;p&gt;Spectrograms are two-dimensional, usually calculated from a one dimensional input vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example say that you want a spectrogram with k-pts of frequency domain span and M-pts of time-domain span.   With NO overlap an input vector of length N = k x M will fill the spectrogram.  Every k samples a k-pt DFT is performed and makes one of the M time-axis vectors on the spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a running spectrogram with an overlap of k/2, then N/2 input samples will be needed to create a k x M spectrogram, and the time scale will be cut in half.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually the logarithm only comes in to scale the amplitude of the output of the DFT.  i.e., each of the k complex samples in the DFT output becomes a scalar value computed from the log of the complex sample magnitude.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2014-01-04T21:15:55.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13549" PostTypeId="2" ParentId="13546" CreationDate="2014-01-04T21:32:00.693" Score="1" Body="&lt;p&gt;The log of every element of a 2D matrix is still a 2D matrix (usually time vs frequency for a spectrogram).  Taking the log() is usually done to make the graphic output closer to a human perceptual response than does a linear visualization.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-04T21:32:00.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13550" PostTypeId="2" ParentId="13546" CreationDate="2014-01-04T22:57:01.843" Score="1" Body="&lt;p&gt;In spectrogram, you split the 1D data vector (time sequency) into several segments with some overlaps. Fourier transform of the segment still produces you a 1D vector with the frequency axis. However, you do the STFT on all the segments, which will provide you the time axis as well. By aligning the STFT of each segments, you form a 2D array (time * frequency). &#xA;If &lt;code&gt;Px = spectrogram(...);&lt;/code&gt;  &lt;code&gt;plot(abs(Px))&lt;/code&gt; gives you a bunch of curves with each one as the y-axis value of the column of &lt;code&gt;Px&lt;/code&gt;. In other words, the function plots the STFT curve of each segments. More often used is &lt;code&gt;imagesc(abs(Px))&lt;/code&gt; which shows you the magnitude image with each pixel representing the specific time and frequency.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-04T22:57:01.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13551" PostTypeId="1" CreationDate="2014-01-05T00:20:14.387" Score="0" ViewCount="1737" Body="&lt;p&gt;I have the following signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qBaJU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to compute a Spectrogram algorithm, but, don't think I'm doing it right.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have computed the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) STFT (size 256 with an overlap of 128) &#xA; 2) Computed the logs using: '10 * log10(sqrt(re * re + im + im) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the result that I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TgAOT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I use &lt;code&gt;pylab&lt;/code&gt; in Python (for the same signal):&#xA;  &lt;code&gt;x = pl.specgram(signal)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o5lSH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;code&gt;matplotlib&lt;/code&gt; I get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E2aS1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, these are very different results.. I don't know why I'm getting these, I'm new to signal processing and spectrograms. Hope someone can help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the result I have when doing &lt;code&gt;imshow&lt;/code&gt; in python:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8RzyQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="5182" LastEditDate="2014-01-05T01:32:22.613" LastActivityDate="2023-02-26T22:27:25.850" Title="Spectrogram - Am I missing something?" Tags="|fft|python|spectrogram|stft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13553" PostTypeId="1" CreationDate="2014-01-05T00:48:55.680" Score="1" ViewCount="208" Body="&lt;p&gt;consider the classic scenario of identifying a radar frequency. You typically have a very short pulse of very high RF frequency. For example, a 50ns pulse repeating itself every 1MHz or so (PRF 1MHz and Pulse Repitition Interval 1us) and let's say there are 50 such pulses in each (radar) interrogation so that each set of coherent pulses takes 50us. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RF frequency is generally in Gigahertz but let's assume it has been downconverted to lie somewhere between 200MHz to 400MHz. Now you want to analyze this signal after subsampling it at a frequency of 100MHz. The straightforward approach would be to sample the whole 50 us worth of data but in reality the only time is signal is on during the 50us period is 50 times 50 ns which is just 2.5 us. The rest of the signal is just zeros. My question therefore is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;is there a 'smart' way of getting rid of this apparently useless information and hence be able to do a much shorter fft?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;is it possible to throw away long strings of zeros in between active pulses, stick the pulses together and perform fft? would that cause any sort of distortion in the spectrum?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4673" LastEditorUserId="7092" LastEditDate="2014-01-05T01:15:48.967" LastActivityDate="2014-01-07T14:57:25.880" Title="efficient spectrum/fft analysis of sparse signals (found in radar applications)" Tags="|fft|frequency-spectrum|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13554" PostTypeId="2" ParentId="13551" CreationDate="2014-01-05T00:50:15.083" Score="1" Body="&lt;p&gt;This appears to be just a matter of projection. Try &quot;imagesc&quot; in matlab.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-05T00:50:15.083" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13555" PostTypeId="2" ParentId="13553" CreationDate="2014-01-05T01:37:27.650" Score="2" Body="&lt;p&gt;One solution for this kind of problem is called an Instantaneous Frequency Measurement (IFM) Receiver. The pulses are located with an envelope detector and a threshold. The average phase change per sample is computed across each pulse; this is proportional to frequency of the pulse.  &lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-01-05T01:37:27.650" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13556" PostTypeId="2" ParentId="13193" CreationDate="2014-01-05T03:20:18.337" Score="1" Body="&lt;p&gt;I am trying to construct an aliasing image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I=rgb2gray(imread('Liver.png')); % a 512*512 image &#xA;subplot(1,2,1),imshow(I),title('Original image')  % shown on the left side of figure below&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when you implement &lt;code&gt;F=fftshift(fft2(I));&lt;/code&gt;, the corresponding axis represent the frequency range of &lt;code&gt;[-255:256]/512;&lt;/code&gt; and the cut-off frequency &lt;code&gt;U = V = 256/512 = 0.5;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;based on Nyquist Sampling Theorem, the sampling periods in spatial domain should satisfy&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;delta_x&amp;lt;=1/(2*U)=1;&#xA;delta_y&amp;lt;=1/(2*V)=1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to avoid the aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if your bandwidth of recorder is &lt;code&gt;64 * 64&lt;/code&gt;, the corresponding point interval in spatial domain is 1 / (64/256) = 4. Thus,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ia=imresize(I(1:4:end,1:4:end),[512 512]);&#xA;subplot(1,2,2),imshow(Ia),title('Aliased image') % shown on the right side of the figure below&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kcvkc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can observe the aliasing effect at the edge.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-05T03:20:18.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13557" PostTypeId="1" CreationDate="2014-01-05T03:21:58.570" Score="2" ViewCount="4434" Body="&lt;p&gt;I would like to find the frequency spectrum by drawing magnitude and phase for the following signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;S=sin(2*pi*100*t)+cos(pi*500*t);&#xA;&#xA;X=sinc(2*pi*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something particular to this problem that I should be noticing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can easily find the spectra giving a time domain like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=0:0.01:0.1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And using the &lt;code&gt;fft&lt;/code&gt; command for both signals &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X=fft(S);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What did they mean by drawing the magnitude and phase?&lt;/p&gt;&#xA;" OwnerUserId="7469" LastEditorUserId="76" LastEditDate="2014-01-05T03:35:16.657" LastActivityDate="2014-01-06T20:02:54.530" Title="Plotting magnitude and phase for frequency spectrum" Tags="|fft|frequency-spectrum|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13559" PostTypeId="2" ParentId="13557" CreationDate="2014-01-05T04:48:23.597" Score="2" Body="&lt;p&gt;for plotting magnitude spectrum versus frequency you can use the following script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:0.001:0.2;&#xA;s = sin(2*pi*100*t)+cos(pi*500*t);&#xA;S = abs(fftshift(fft(s)));&#xA;&#xA;Fs = 1000;&#xA;df = 1000/(length(s));&#xA;f = -Fs/2:df:Fs/2-df;&#xA;&#xA;plot(f,S);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here I used your first signal and plotted its magnitude spectrum. You must notice for your signal &lt;code&gt;min choosable Nyquist frequency&lt;/code&gt; is 500 Hz But we use it two times of it(which is 1000Hz), because we also want to see the part before f =0 in the frequency spectrum. Using this we find &lt;code&gt;df(delta f)&lt;/code&gt; frequency spacing. frequency vector must be multiples of df. By this way spectrum will be drawn correctly.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the output: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bHAiv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7461" LastEditorUserId="7461" LastEditDate="2014-01-05T04:53:45.070" LastActivityDate="2014-01-05T04:53:45.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13561" PostTypeId="2" ParentId="13506" CreationDate="2014-01-05T05:09:33.537" Score="1" Body="&lt;p&gt;firstly do &lt;code&gt;partial fraction&lt;/code&gt; for H(s) and then use &lt;code&gt;transform tables of Laplace&lt;/code&gt; &lt;code&gt;Transform.&lt;/code&gt; Using inverse laplace and tables you must be able to find impulse response. I think you can use &lt;code&gt;j^2 instead of -1&lt;/code&gt; and find complex roots for denominator. Then, using transform pairs you will find a &lt;code&gt;complex solution.&lt;/code&gt; &lt;/p&gt;&#xA;" OwnerUserId="7461" LastEditorUserId="7461" LastEditDate="2014-01-05T05:21:19.817" LastActivityDate="2014-01-05T05:21:19.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13562" PostTypeId="2" ParentId="13038" CreationDate="2014-01-05T08:25:36.257" Score="2" Body="&lt;p&gt;Scenes generally exhibit a fade-to-black transition. You could capture those frames with simple image processing tools, which are found in many libraries, such as OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to rely on the change of the mis-an-scene to be robust against sudden changes, then of cours algorithms for detecting temporal differences is more appropriate. For that, you might want to consider:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://vis.uky.edu/~cheung/courses/ee639_fall04/readings/spie99.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://vis.uky.edu/~cheung/courses/ee639_fall04/readings/spie99.pdf&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.mitsubishi-electric-itce.fr/uk-rce/pubdocs/VIL07-D071.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mitsubishi-electric-itce.fr/uk-rce/pubdocs/VIL07-D071.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a simple algorithm do as described here:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/4801053/video-scene-detection-implementation&quot;&gt;https://stackoverflow.com/questions/4801053/video-scene-detection-implementation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For harder cases, you might even try GMM-like background models to test if the transition was a temporarily quick shot or a complete change.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-01-05T08:25:36.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13563" PostTypeId="1" AcceptedAnswerId="13581" CreationDate="2014-01-05T14:41:37.017" Score="2" ViewCount="7151" Body="&lt;p&gt;Why is this the most widely accepted model of signal sampling?&lt;/p&gt;&#xA;&lt;p&gt;When multiplying the continuous signal value with the Dirac delta, we get an infinite value. However, if we perform convolution of our signal and the Dirac comb, we get our signal again — how is it useful?&lt;/p&gt;&#xA;&lt;p&gt;The answer to a similar question has been given &lt;a href=&quot;https://dsp.stackexchange.com/q/2948&quot;&gt;here&lt;/a&gt;, but it's still not 100% clear to me.&lt;/p&gt;&#xA;" OwnerUserId="7471" LastEditorUserId="7092" LastEditDate="2021-10-11T12:35:16.923" LastActivityDate="2021-10-21T11:34:04.727" Title="Why is the Dirac delta used when sampling continuous signals?" Tags="|sampling|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13564" PostTypeId="1" CreationDate="2014-01-05T15:34:35.600" Score="2" ViewCount="2343" Body="&lt;p&gt;When I transform an image from the spatial domain to the frequency domain, some frequencies are negative. What is the meaning of the negative sign? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tRkaR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7472" LastEditorUserId="76" LastEditDate="2014-01-05T18:21:51.733" LastActivityDate="2014-02-04T11:58:10.750" Title="What does the negative sign mean in the image frequency domain?" Tags="|fourier-transform|image-processing|frequency-domain|dct|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13565" PostTypeId="2" ParentId="13564" CreationDate="2014-01-05T16:37:51.273" Score="1" Body="&lt;p&gt;The matrix &lt;code&gt;b&lt;/code&gt; is the same size as &lt;code&gt;a&lt;/code&gt; and contains the discrete cosine transform coefficients indicating the correlation between the cosine function at two specific frequencies. They are not necessary to be positive values. The dimension, &lt;code&gt;4*4&lt;/code&gt; in your case, represents the different frequencies. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-01-05T18:03:34.393" LastActivityDate="2014-01-05T18:03:34.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13566" PostTypeId="2" ParentId="13564" CreationDate="2014-01-05T17:58:05.017" Score="4" Body="&lt;p&gt;Each DCT output bin is a (weighted) correlation against a cosine function of a certain frequency.  A negative value would represent a negative correlation, e.g. something in the image data is of the opposite phase to that cosine (e.g. maybe dark when the cosine is 1, and light when the cosine is -1, instead of vice-versa for a positive correlation).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-01-05T18:03:37.227" LastActivityDate="2014-01-05T18:03:37.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13567" PostTypeId="1" CreationDate="2014-01-06T02:35:33.150" Score="2" ViewCount="593" Body="&lt;p&gt;EDIT (after comments and subject matter review)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CS is based on a choice of a sensing basis $\Phi$ relative to a representation basis $\Psi$. Using an &quot;Incoherence Property&quot; $\mu$ that measures the correlation between vectors from each basis it has been shown that the CS paradigm can achieve good reconstructions if the incoherence between $\Phi$ and $\Psi$ is low. Examples of low $\mu$ come &lt;a href=&quot;http://www.ece.mcmaster.ca/~reilly/ece712/Nasser_thesis%20Ch2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;from&lt;/a&gt;: The spike basis ($\Phi$) and the Fourier basis ($\Psi$), the noiselet basis ($\Phi$) and the wavelet basis ($\Psi$), a random matrix ($\Phi$) and a fixed basis ($\Psi$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;updated question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to calculate the $\mu$ when the user is not able to chose $\Phi$ ahead of time to sample the signal, i.e. when the samples are already provided through some arbitrary sampling scheme that is sub-optimal vis-vis CS. My aim is to show/quantify, via $\mu$, that the arbitrary sampling scheme I have been given is sub-optimal if one is expecting CS to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ORIGINAL&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With respect to Matrix Completion and Compressive Sampling (CS) I'm trying to understand how to calculate an incoherence property &lt;strong&gt;&lt;em&gt;μ&lt;/em&gt;&lt;/strong&gt; between two bases &lt;strong&gt;&lt;em&gt;Φ&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Ψ&lt;/em&gt;&lt;/strong&gt;. Getting this incoherence is important because if &lt;strong&gt;&lt;em&gt;Φ&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Ψ&lt;/em&gt;&lt;/strong&gt; are highly correlated there is little chance of succesfully reconstructing a signal from sparse samples. It is stated &lt;a href=&quot;https://www.google.ca/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDAQFjAA&amp;amp;url=http://authors.library.caltech.edu/10092/1/CANieeespm08.pdf&amp;amp;ei=7gzKUrv8N4nOyAHu4YDICw&amp;amp;usg=AFQjCNHnpzDhEtFjNwPjpw3E1OIKzMkuKQ&amp;amp;sig2=IwcD4l944_vByjnqOAvL0Q&amp;amp;bvm=bv.58187178,d.aWc&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (page 3) that &lt;strong&gt;&lt;em&gt;μ&lt;/em&gt;&lt;/strong&gt; is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VgJ5f.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt; represents the number of elements in a matrix &lt;strong&gt;M&lt;/strong&gt; - say an image signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand &lt;strong&gt;&lt;em&gt;Φ&lt;/em&gt;&lt;/strong&gt; to be a sensing basis and &lt;strong&gt;&lt;em&gt;Ψ&lt;/em&gt;&lt;/strong&gt; to be a sparse representation basis. I am using uniform random sampling to get a set of a samples from &lt;strong&gt;M&lt;/strong&gt;. But I would also like to try arbitrary sampling patterns. (I'm not using wavelets or noiselets or Fourier coefficients - although I would like to try this eventually)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I actually obtain &lt;strong&gt;&lt;em&gt;Φ&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Ψ&lt;/em&gt;&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="4038" LastEditDate="2014-01-07T18:50:11.577" LastActivityDate="2014-01-07T18:50:11.577" Title="Calculating an incoherence property from sub-optimal sampling patterns" Tags="|matlab|signal-analysis|sampling|compressive-sensing|decomposition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13568" PostTypeId="2" ParentId="13563" CreationDate="2014-01-06T04:25:43.620" Score="0" Body="&lt;p&gt;The answer to your question is that multiplying by the Dirac comb thus:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;x(t) \cdot \sum_{n=-\infty}^{+\infty} \delta(t - nT) &amp;amp; = \sum_{n=-\infty}^{+\infty} x(t) \delta(t - nT)  \\&#xA;&amp;amp; = \sum_{n=-\infty}^{+\infty} x(nT) \delta(t - nT)  \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;shows explicitly that &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is sampled at the uniformly-spaced sample times &lt;span class=&quot;math-container&quot;&gt;$nT$&lt;/span&gt;.  All information between the samples is discarded because multiplying by zero discards the information.&lt;/p&gt;&#xA;&lt;p&gt;The the Sampling Theorem shows that, if &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is sufficiently bandlimited, then the entire &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; can be recovered from the sampled signal above and thus from the samples &lt;span class=&quot;math-container&quot;&gt;$x(nT)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2021-10-11T06:23:38.827" LastActivityDate="2021-10-11T06:23:38.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13571" PostTypeId="2" ParentId="13209" CreationDate="2014-01-06T09:56:05.603" Score="3" Body="&lt;p&gt;When taking a DFT you would also normally use the squared magnitude, which gives the amount of &lt;em&gt;power&lt;/em&gt; in a particular frequency bin. Of course you can use whichever you find more informative, but what usually gets quoted or plotted is the power spectrum, which is |DFT|^2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's nothing different about the Goertzel algorithm here; if the frequency you feed it is one of the finite set processed by a DFT, Goertzel and an ordinary DFT will do the exact same computation and give the exact same answer (aside from issues like roundoff and error accumulation, which are important but not really the point here).&lt;/p&gt;&#xA;" OwnerUserId="7454" LastActivityDate="2014-01-06T09:56:05.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13572" PostTypeId="2" ParentId="13227" CreationDate="2014-01-06T10:06:11.950" Score="2" Body="&lt;p&gt;It looks to me as if you are asking two completely separate questions here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First question: Indeed the two formulas aren't identical; it isn't &lt;em&gt;obvious&lt;/em&gt; that the Goertzel algorithm computes what it does. You can find a sketchy proof based on the $z$-transform on the Wikipedia page about the Goertzel algorithm, or you can do a more direct proof by mathematical induction. Or you can just take it on trust -- for most practical purposes all that matters is that it &lt;em&gt;does&lt;/em&gt; what it does, rather than why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With both the Goertzel algorithm and the complete DFT, |X|^2 is the &lt;em&gt;power&lt;/em&gt; at a particular frequency. This is a sensible thing to compute because, e.g., when you do a DFT the sum of all the powers (|Fourier coefficients|^2) equals the total power in the signal (= sum of |signal values|^2, up to a normalizing constant factor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency you're using is one of the ones processed by a DFT, the output of the Goertzel algorithm is (aside from &quot;numerical&quot; considerations like roundoff error) exactly the same as one bin of the DFT.&lt;/p&gt;&#xA;" OwnerUserId="7454" LastActivityDate="2014-01-06T10:06:11.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13573" PostTypeId="1" AcceptedAnswerId="13589" CreationDate="2014-01-06T11:45:42.703" Score="1" ViewCount="440" Body="&lt;p&gt;A wavelet transform is defined for infinite length signals. Finite length signals must be extended in some way before they can be transformed. I know that periodic replication and zero padding are appropriate for signals that begin and end on the baseline, while mirror -image replication and linear extrapolation provide continuity at the boundaries for signals that do not begin or end on the baseline. Periodic replication either wraps around or reflect the signal detail in the region beyond the boundaries and this distorts the interpretation of the transform coefficients near the boundaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a time series of limited duration not extending beyond the signal range and that is not a power of two as required by the transform (using R package wavethresh, function &lt;code&gt;wst()&lt;/code&gt;, packet-ordered non-decimated wavelet transform). Zero padding seems to be the only way forward for signals that begin and end on the baseline. Also, zero padding makes no assumptions of the signal after the boundaries describing only the signal, however zero padding results in a non length preserving transform (one in which the transform vector is longer than the signal vector) and large perturbations in the transform space are not reflected in the signal space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By doing zero padding (added at the beginning and at the end of the series) my question is how can I truncate the zero-padded signal of n coefficients to obtain n coefficients as be able to reconstruct the signal exactly.&lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="76" LastEditDate="2014-01-06T13:31:15.630" LastActivityDate="2014-01-06T18:24:51.300" Title="How can a zero-padded length n signal be truncated to n coefficients from which a signal can be reconstructed?" Tags="|signal-analysis|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13574" PostTypeId="1" CreationDate="2014-01-06T13:15:48.350" Score="1" ViewCount="1851" Body="&lt;p&gt;I would like to know if it is possible  to search Doppler shift of a carrier with sufficient oversampling while performing code search in the freqency domain. For instance can I selectively drop every X time domain sample bin from the fft processing? Will that not effectively change the input frequency being compared to the locally generated code?&#xA;I would like to perform the Doppler shift search of digital satellite broadcasts without having to change the lo supplying the IF in hardware.&#xA;Can this be done this way?&lt;/p&gt;&#xA;" OwnerUserId="7480" LastEditorUserId="7092" LastEditDate="2014-01-06T14:51:54.213" LastActivityDate="2017-01-27T22:30:24.550" Title="Can I search Doppler shift in freqency domain" Tags="|fft|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13577" PostTypeId="1" AcceptedAnswerId="13579" CreationDate="2014-01-06T15:36:50.017" Score="10" ViewCount="11653" Body="&lt;p&gt;So, I was reading the paper on &lt;a href=&quot;ftp://ftp.vision.ee.ethz.ch/publications/articles/eth_biwi_00517.pdf&quot; rel=&quot;noreferrer&quot;&gt;SURF (Bay, Ess, Tuytelaars, Van Gool: &lt;em&gt;Speeded-Up Robust Features (SURF)&lt;/em&gt;)&lt;/a&gt; and I can not comprehend this paragraph below:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Due to the use of box filters and integral images, we do not have to&#xA;  iteratively apply the same filter to the output of a previously filtered&#xA;  layer, but instead can apply box filters of any size at exactly the&#xA;  same speed directly on the original image and even in parallel&#xA;  (although the latter is not exploited here). Therefore, the scale&#xA;  space is analysed by up-scaling the filter size rather than iteratively&#xA;  reducing the image size, figure 4.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;This is figure 4 in question.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yE6wh.png&quot; alt=&quot;Figure 4&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: The paper has an explanation of integral image, however the whole content of the paper is based on the particular paragraph above. If anybody has read this paper, can you briefly mention what is going on here. The whole mathematical explanation is quite intricate to have a good grasp first up, so I need some assistance. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;Edit,couple of issues: &lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;1.&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Each octave is subdivided into a constant number of scale levels.&#xA;  Due to the discrete nature of integral images, the minimum scale&#xA;  difference between 2 subsequent scales depends on the length lo of the&#xA;  positive or negative lobes of the partial second order derivative in&#xA;  the direction of derivation (x or y), which is set to a third of the&#xA;  filter size length. For the 9x9 filter, this length lo is 3. For two&#xA;  successive levels, we must increase this size by a minimum of 2 pixels&#xA;  (one pixel on every side) in order to keep the size uneven and thus&#xA;  ensure the presence of the central pixel. This results in a total&#xA;  increase of the mask size by 6 pixels (see figure 5).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Figure 5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4Yj5v.png&quot; alt=&quot;Figure 5&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could not make sense of the lines in the given context.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For two successive levels, we must increase this size by a minimum of&#xA;  2 pixels (one pixel on every side) in order to keep the size uneven&#xA;  and thus ensure the presence of the central pixel. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know they are trying to do something with the length of the image, if its even they are trying to make it odd, so that there is a central pixel which will enable them to calculate the maximum or the minimum of the pixel gradient. I am bit iffy about its contextual meaning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;2.&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to calculate descriptor Haar wavelet is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WYEks.png&quot; alt=&quot;Haar Wavelet&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is the middle region has low $\sum\ dx$ but high $\sum\ |dx|$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;3.&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ralvi.png&quot; alt=&quot;Another one&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the necessity of having an approximate filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;4.&lt;/b&gt;&#xA;I have no issue with the way that they found out the size of the filter. They &quot;did&quot; something empirically. However, I have some nagging issue with this piece of line&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The output of the 9x9 filter, introduced in the previous section, is&#xA;  considered as the initial scale layer, to which we will refer as scale&#xA;  s = 1.2 (approximating Gaussian derivatives with  σ= 1.2).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How did they found out about the value of σ . Moreover how does the calculation of scaling done shown in the image below.The reason I am stating about this image is that the value of &lt;code&gt;s=1.2&lt;/code&gt; keeps on recurring, without clearly stating about its origin.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Sjugm.jpg&quot; alt=&quot;Scale Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;5.&lt;/b&gt;&#xA;The Hessian Matrix represented in terms of &lt;code&gt;L&lt;/code&gt; which is the convolution of second order gradient of Gausssian filter and the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0DPfJ.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the &quot;approximated&quot; determinant is said to contain only terms involving second order Gaussian filter.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9ydjm.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of &lt;code&gt;w&lt;/code&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bzukl.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question why the determinant is calculated like that above, and what is the relationship between approximate Hessian and Hessian matrix.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="128" LastEditDate="2019-08-18T15:00:29.870" LastActivityDate="2019-08-18T15:00:29.870" Title="Understanding SURF Features Calculation Process" Tags="|image-processing|computer-vision|multi-scale-analysis|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13579" PostTypeId="2" ParentId="13577" CreationDate="2014-01-06T16:03:22.127" Score="11" Body="&lt;p&gt;&lt;strong&gt;What's SURF?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to correctly understand what is going on, you also need to be familiar with &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;noreferrer&quot;&gt;SIFT&lt;/a&gt;: SURF is basically an approximation of SIFT. Now, the real question becomes: &lt;em&gt;what's SIFT?&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SIFT is both a &lt;em&gt;keypoint detector&lt;/em&gt; and a &lt;em&gt;keypoint descriptor&lt;/em&gt;.&#xA;In the detector part, SIFT is essentially a multi-scale variant of classical corner detectors such as the Harris corner, and that has the ability to auto-tune the scale. Then, given a location and a patch size (derived from the scale), it can compute the descriptor part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SIFT is very good at matching locally affine pieces of images, but it has one drawback: it is expensive (i.e., long) to compute.&#xA;A large amount of time is spent in computing the Gaussian scale-space (in the detector part), then in computing histograms of the gradient direction (for the descriptor part).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both SIFT and SURF can be seen as difference of Gaussians with automatic scale (i.e., Gaussian sizes) selection. This, you construct first a scale-space where the input image is filtered at different scales. The scale-space can be seen as a pyramid, where two consecutive images are related by a scale change (i.e., the size of the Gaussian low-pass fiéter has changed), and scales are then grouped by octaves (i.e., a big change in the size of the Gaussian filter).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In SIFT, this is done by repeatedly filtering the input with a Gaussian of fixed width until the scale of the next octave is reached.&lt;/li&gt;&#xA;&lt;li&gt;In SURF, you do not suffer any runtime penalty from the size of the Gaussian filter thanks to the use of the integral image trick. Thus, you compute directly the image filtered at each scale (without using the result at the previous scale).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The approximation part&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since computing the Gaussian scale-space and the histograms of the gradient direction is long, it is a good idea (chosen by the authors of SURF) to replace these computations by fast approximations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors remarked that small Gaussians (like the ones used in SIFT) could be well approximated by square integrals (also known as &lt;em&gt;box blur&lt;/em&gt;).&#xA;These rectangle averages have the nice property to be very fast to obtain thanks to the integral image trick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the Gaussian scale-space is actually not used &lt;em&gt;per se&lt;/em&gt;, but to approximate a Laplacian of Gaussians (you can find this in the SIFT paper).&#xA;Thus, you do not need just Gaussian-blurred images, but derivatives and differences of them. So, you just push a bit further the idea of approximating a Gaussian by a box: first derive a Gaussian as many times as needed, then approximate each lobe by a box of the correct size. You will eventually end up with a set of Haar features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Increment by 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just an implementation artifact, as you have guessed. The goal is to have a central pixel.&#xA;The feature descriptor is computed with respect to the center of the image patch to be described.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Middle region&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When going from a black ray to a white ray, you have something like $\sum_{\text{all pix in column}} \partial x = A$. Then, going from white to black, you have the opposite sum: $\sum_{\text{all pix in column}} \partial x = -A$. Thus, you have a small $\sum \partial x$ for the window, but a higher sum of the magnitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Magic number&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first scale is obtained by applying a blur with $\sigma = 1.2$ (or 1.4 in some papers). This is because a natural (real) sharp image can be considered as being the result of the convolution of an ideal (without aliasing) image with a blur kernel of width $\sigma = 1.2$. I can't really remember where it comes from, but it was also explicitly studied in Guoshen Yu's work on A-SIFT, so you might check &lt;a href=&quot;http://www.cmap.polytechnique.fr/~yu/research/ASIFT/demo.html&quot; rel=&quot;noreferrer&quot;&gt;this page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2014-02-04T13:15:15.823" LastActivityDate="2014-02-04T13:15:15.823" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="13580" PostTypeId="1" CreationDate="2014-01-06T16:27:18.740" Score="1" ViewCount="261" Body="&lt;p&gt;Looking for a Basis representation:&#xA;Given a sparse or compressible image &lt;strong&gt;M&lt;/strong&gt;, how would one represent this image using a basis &lt;strong&gt;A&lt;/strong&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I let &lt;strong&gt;m&lt;/strong&gt; = vec(&lt;strong&gt;M&lt;/strong&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;m&lt;/strong&gt; = &lt;strong&gt;Ax&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;strong&gt;A&lt;/strong&gt; is my &quot;representation&quot; basis and &lt;strong&gt;x&lt;/strong&gt; is the vector of coefficients in the &lt;strong&gt;A&lt;/strong&gt; domain, what is the method for actually getting &lt;strong&gt;A&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="76" LastEditDate="2014-01-06T21:38:31.987" LastActivityDate="2014-01-06T21:38:31.987" Title="How would I represent an image using a basis $A$, given a sparse or compressible image?" Tags="|image-processing|matlab|decomposition|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13581" PostTypeId="2" ParentId="13563" CreationDate="2014-01-06T16:49:54.570" Score="2" Body="&lt;p&gt;The best explanation of this that I've seen is from the &amp;quot;Digital Signal Processing Handbook&amp;quot; by Madisetti. Essentially the multiplication by the delta function is equivalent to sampling because the Fourier transforms are the same. So although the result of &lt;span class=&quot;math-container&quot;&gt;$s(t)\delta(t-nT)$&lt;/span&gt; may not make much sense it's Fourier transform does exist because we are taking the integral over the delta function.&lt;/p&gt;&#xA;&lt;p&gt;I'm cutting and pasting his text and redoing the equations. Note CT=continuous time, DT= discrete time. I have not included figures 1.1 and 1.2.&lt;/p&gt;&#xA;&lt;p&gt;The relationship between the CT and the DT domains is characterized by the operations of sampling and reconstruction. If &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt; denotes a signal &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt; that has been uniformly sampled every T seconds, then the mathematical representation of &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$s_a(t) =\sum_{n=- \infty}^{\infty} s(t)\delta(t-nT) \qquad \tag{1.1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\delta(t)$&lt;/span&gt; is a CT impulse function defined to be zero for all &lt;span class=&quot;math-container&quot;&gt;$t\not=0$&lt;/span&gt;, undefined at t=0, and has&#xA;unit area when integrated fromt &lt;span class=&quot;math-container&quot;&gt;$t=-\infty$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$t=\infty$&lt;/span&gt;. Because the only places at which the product &lt;span class=&quot;math-container&quot;&gt;$s(t)\delta(t−nT)$&lt;/span&gt; is not identically equal to zero are at the sampling instances, &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt; in (1.1) can be replaced with &lt;span class=&quot;math-container&quot;&gt;$s(nT)$&lt;/span&gt; without changing the overall meaning of the expression. Hence, an alternate expression for &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt; that is often useful in Fourier analysis is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$s_a(t) =\sum_{n=- \infty}^{\infty} s(nT)\delta(t-nT) \qquad \tag{1.2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The CT sampling model &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt; consists of a sequence of CT impulse functions uniformly spaced at intervals of &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; seconds and weighted by the values of the signal &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt; at the sampling instants, as depicted in Fig.1.1. Note that &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt; is not defined at the sampling instants because the CT impulse function itself is not defined at &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. However, the values of &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt; at the sampling instants are imbedded as “area under the curve” of &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt;, and as such represent a useful mathematical model of the sampling process. In the DT domain the sampling model is simply the sequence defined by taking the values&#xA;of &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt;  at the sampling instants, i.e.,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$s[n]=s(t)|_{t=nT}  \qquad \tag{1.3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In contrast to &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt;, which is not defined at the sampling instants, &lt;span class=&quot;math-container&quot;&gt;$s[n]$&lt;/span&gt; is well defined at the sampling instants, as illustrated in Fig.1.2. Thus, it is now clear that &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s[n]$&lt;/span&gt; are different but equivalent models of the sampling process in the CT and DT domains, respectively. They are both useful for signal analysis in their corresponding domains. Their equivalence is established by the fact that they&#xA;have equal spectra in the Fourier domain, and that the underlying CT signal from which &lt;span class=&quot;math-container&quot;&gt;$s_a(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s[n]$&lt;/span&gt; are derived can be recovered from either sampling representation, provided a sufficiently large sampling rate is used in the sampling operation (see below).&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="80" LastEditDate="2021-10-21T11:12:12.003" LastActivityDate="2021-10-21T11:12:12.003" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13582" PostTypeId="2" ParentId="13227" CreationDate="2014-01-06T16:59:54.357" Score="1" Body="&lt;p&gt;In your initial formula, you should observe that $W_N^k+W_N^{-k}=2\cos(2\pi\tfrac{k}{N})$ and, by definition of the powers, $W_N^k\cdot W_N^{-k}=1$. Thus the denominator factors as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(1-2\cos(2\pi\tfrac{k}{N})z^{-1}+z^{-2})=(1-W_N^kz^{-1})(1-W_N^{-k}z^{-1})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the first factor cancels against the numerator. Thus &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac1{1-W_N^{-k}z^{-1}}=\sum_{j=0}^\infty W_N^{-kj}z^{-j}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;remains, the application to a signal gives the desired Fourier coefficient at the $N$th position, i.e., with index $N-1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole point of the complication of the Goertzel algorithm is that the computation of the filtered signal for any real valued input signal can be kept in the real numbers until the last step. And even then the computation of the complex results can be avoided if only the amplitude is desired. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you chose the right power of the norm or adapt the threshold value to avoid square roots.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-06T16:59:54.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13583" PostTypeId="2" ParentId="13577" CreationDate="2014-01-06T17:01:13.207" Score="5" Body="&lt;p&gt;In order to identify the potential interest points, &lt;a href=&quot;http://fourier.eng.hmc.edu/e161/lectures/gradient/node10.html&quot; rel=&quot;nofollow&quot;&gt;difference-of-Gaussian function (DOG)&lt;/a&gt; is often used to process the image, thus making it invariant to scale and orientation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In SIFT, image pyramids are established by filtering each layer with DOG of increasing &lt;code&gt;sigma&lt;/code&gt; values and taking the difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, SURF applies a much faster approximation of second-order Gaussian partial derivatives with &lt;a href=&quot;http://fourier.eng.hmc.edu/e161/lectures/gradient/node9.html&quot; rel=&quot;nofollow&quot;&gt;Laplacian of Gaussian (LoG)&lt;/a&gt; and the square filters of different size (9*9, 15*15, ...). The computational cost is independent of the filter size. There is no down-sampling (change &lt;code&gt;sigma&lt;/code&gt;) for higher levels in the pyramid, but only the up-scale of filter size resulting in having images of the same resolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One additional note: the authors in your paper further simplify the Gaussian second derivative at the 4 orientations (x,y,xy,yx) with the kernel &lt;code&gt;[1 -2 1]&lt;/code&gt;, &lt;code&gt;[1 -2 1]'&lt;/code&gt;, &lt;code&gt;[1 -1;-1 1]&lt;/code&gt;, and &lt;code&gt;[-1 1;1 -1]&lt;/code&gt;. When the filter size increases, you just need to extend the simplified kernel regions to achieve the larger one. And it is equivalent to the DOG with different scales (LoG curve is the same shape as DOG, and the filter size makes their width also equal).&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-01-06T18:16:51.217" LastActivityDate="2014-01-06T18:16:51.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13584" PostTypeId="2" ParentId="13580" CreationDate="2014-01-06T17:18:24.897" Score="1" Body="&lt;p&gt;The textbook algorithm is to minimize&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\|Ax-m\|_1+\alpha\|x\|_0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\|x\|_0$ counts the number of non-zero coefficients. Since that is a bad function for the determination of a descent direction, one softens the counting norm to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\|x\|_ε=\sum_k|x_k|^ε$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for some small value of $ε$. For instance, for $|x_k|&amp;gt;\exp(-\tfrac1{\sqrtε})$, which is a very small threshold, one gets $|x_k|^ε&amp;gt;\exp(-\sqrtε)\ge 1-\sqrtε$, so that all not too small and not too large values get mapped to $1$ and only really small values get mapped to zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a really smooth function, mostly for theoretical purposes, one can smoothen the kink at $0$ by using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\|x\|'_ε=\sum_k(\delta^2+|x_k|^2)^{ε/2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and obviously choosing $δ$ small enough so that $x_k=0$ still gets mapped close to $0$, for instance by choosing $δ=\exp(-\tfrac1{\sqrtε^3})$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now that this answer is completely orthogonal to the question in its current form, I hope that someone else has more insight into the topic of matrix selection. What I know is this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the beginning, before compressed or compressive sensing existed as word, $A$ was a matrix of wavelet or wavelet-like coefficients. The whole idea of wavelet based compression (and JPEG) is to zero out small coefficients (and truncate the binary representation of non-null coefficients). This can be improved upon in one direction by observing and utilizing correlations in the detail coefficients over multiple scales, or in the other direction by making the basis vectors even more uncorrelated and thus reducing those fractal features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may also be algorithms that start with a random matrix and modify or reject it based on certain frame conditions. &lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-01-06T17:56:40.363" LastActivityDate="2014-01-06T17:56:40.363" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13585" PostTypeId="1" CreationDate="2014-01-06T18:09:26.470" Score="0" ViewCount="49" Body="&lt;p&gt;If I know &lt;strong&gt;y&lt;/strong&gt; (samples) and &lt;strong&gt;x&lt;/strong&gt; (signal), is there a practical matlab algorithm to calculate &lt;strong&gt;A&lt;/strong&gt; in &lt;strong&gt;y = Ax&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4038" LastActivityDate="2014-01-06T22:12:23.610" Title="sensing and representation matrices from exhaustive data" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13586" PostTypeId="2" ParentId="13580" CreationDate="2014-01-06T18:11:39.247" Score="1" Body="&lt;p&gt;There are many algorithms to find the solution vector x, given a basis matrix A. But you are asking how to find the basis matrix A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many problems you can choose it. For example in a sparse frequency estimation problem, the columns of A correspond to samples from a particular complex exponential at a particular frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also algorithms for handling the off-grid problem i.e. when the basis vector is slightly misaligned with your data. Most of the algorithms start with a hypothesized set of vectors and then use a gradient descent approach to modifying the basis vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another set of algorithms are referred to as Dictionary Learning algorithms. These algorithms tend to use a training database to find a good set of basis vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found Michael Elad's book - Sparse and Redundant Representations quite good. It's not too mathematical - he also has a chapter on Dictionary Learning algorithms. There are also some tutorial like articles in the IEEE Signal Processing Magazine by Candes. There is also a very good chapter on compressive sensing in &quot;Principles of Modern Radar - Advanced Techniques&quot; by Melvin, Scheer which provides a good overview and a large number of reference papers.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2014-01-06T20:30:19.277" LastActivityDate="2014-01-06T20:30:19.277" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13587" PostTypeId="2" ParentId="13574" CreationDate="2014-01-06T18:14:37.233" Score="0" Body="&lt;p&gt;The point of doppler shift would be a change in frequency. So if you compare to a fixed frequency, that's not going to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you try to ,,correct'' the doppler shift so that you can compare with the original frequency as well. That depends on the circumstances. If you just strike samples, you will introduce aliases. These might interfere with what you try to measure. In the worst case, they could introduce ,,beating'' and ruin your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would rather try to measure different bins, or maybe use a window that is wider than the range of the doppler shift. It depends on the parameters if latter would be feasible. Given that satellites move at a tiny fraction of the speed of light, and that most radio analysis mixes down to MHz range, your doppler shift might be very small (measured in bins) actually.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-06T18:14:37.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13588" PostTypeId="2" ParentId="13585" CreationDate="2014-01-06T18:24:04.620" Score="1" Body="&lt;p&gt;The solution is probably not unique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$    \left[ { \begin{array}{cc} a &amp;amp; b \\ c &amp;amp; d \end{array} } \right] \left[{\begin{array}{c} 1 \\ 0 \end{array}} \right] =    \left[{\begin{array}{c} 1 \\ 1 \end{array}} \right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$b$ and $d$ can be any value provided $a = c = 1$&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="76" LastEditDate="2014-01-06T21:36:02.393" LastActivityDate="2014-01-06T21:36:02.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13589" PostTypeId="2" ParentId="13573" CreationDate="2014-01-06T18:24:51.300" Score="2" Body="&lt;p&gt;From a theory standpoint, that ought to be possible. It's not bound to be simple, however. Zero padding will scale and interpolate the FD representation of your signal. If you remove coefficients the right way, you should be able to reconstruct what's missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you doubled the signal length by padding. You can then remove every other bin of the fourier transformed (starting with the second) and get exactly the result you would have without padding.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-06T18:24:51.300" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13590" PostTypeId="2" ParentId="13580" CreationDate="2014-01-06T18:27:59.413" Score="1" Body="&lt;p&gt;The DCT is often used in practice, for example in the classical, non-wavelet, version of &lt;a href=&quot;https://en.wikipedia.org/wiki/JPEG#Discrete_cosine_transform&quot; rel=&quot;nofollow&quot;&gt;JPEG&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5863" LastActivityDate="2014-01-06T18:27:59.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13591" PostTypeId="1" CreationDate="2014-01-06T18:30:02.510" Score="1" ViewCount="159" Body="&lt;p&gt;Given a million data points in say 100d,&#xA;is there a way to generate an optimal filter bank of say 20 filters&#xA;from an SVD of the data ?&lt;br&gt;&#xA;Call the 100d space $F$ (as in Frequency), with coordinates $[f_1, f_2 ... f_{100}]$.&#xA;There are many bases $V_i$ of $F$,&#xA;that split the 1M $\times$ 100 data array&#xA;$ A \approx \sum_{i=1}^{100} d_i U_i  \otimes V_i $&lt;br&gt;&#xA;where the $d_i$ are scalars $d_1 \ge d_2\ ...\ \ge 0$,&#xA;the $U_i$ are 1M long, and the $V_i$ 100 long.&lt;br&gt;&#xA;I have two goals:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the $d_i$ should be rapidly decreasing, so that 20 terms approximate $A$ reasonably well&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;for a filter bank, I want a local basis,&#xA;with each $V_i$ zero outside some interval $[f_a, f_b]$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How can I optimize  both together ?&lt;br&gt;&#xA;The problem is that SVD has no notion of locality in $F$.&#xA;And one can optimize a filter bank with a given local basis,&#xA;such as overlapping triangles in MFCC, but I see no connection to SVD.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;Edit 12 Jan: SVD and filter banks / local overlapping bases / dictionaries seem to me quite different:&lt;br&gt;&#xA;$\qquad$ SVD: orthogonal, fast and easy, very dependent on data and noise&lt;br&gt;&#xA;$\qquad$ local: many possibilities / objectives, robust.&lt;br&gt;&#xA;Nonetheless it would be nice if one could use SVD/PCA to&#xA;improve a given filter bank / local basis.&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="4389" LastEditDate="2014-01-12T14:23:04.717" LastActivityDate="2014-01-12T14:23:04.717" Title="Optimal filter bank from SVD/PCA" Tags="|decomposition|filter-bank|optimization|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13592" PostTypeId="2" ParentId="13557" CreationDate="2014-01-06T18:57:30.133" Score="0" Body="&lt;p&gt;For plotting the magnitude and phase using the above, but with the following (slight) modifications&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;S=fftshift(fft(s))  &#xA;figure  &#xA;plot(f,abs(S)); %Plot of magnitude  &#xA;figure   &#xA;plot(f,unwrap(angle(S))); %Plot of phase  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note - unwrap() tries to take care of any 2*pi jumps in the phase.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2014-01-06T20:02:54.530" LastActivityDate="2014-01-06T20:02:54.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13593" PostTypeId="2" ParentId="8586" CreationDate="2014-01-06T19:29:02.867" Score="1" Body="&lt;p&gt;If the signals are not aligned, yet you have a clue that they more or less &quot;mean&quot; the same thing, or refer to similar data, you could use dynamic time warping (DTW) algorithm to obtain a better correspondence (then simply taking the value at the same location). You could measure RMS, MSE or whatever you like, using those correspondences. For DTW, you might want to check:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_time_warping&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Dynamic_time_warping&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good way to elaborate this idea is utilized in Earth Mover Distance (EMD), which computes the minimal effort to bring the signals to alignment, as a distance measure. EMD is presented here:&#xA;&lt;a href=&quot;http://ai.stanford.edu/~rubner/emd/default.htm&quot; rel=&quot;nofollow&quot;&gt;http://ai.stanford.edu/~rubner/emd/default.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EMD gives you a direct distance, which you might use for further analysis.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-06T19:29:02.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13594" PostTypeId="2" ParentId="11026" CreationDate="2014-01-06T19:34:19.080" Score="0" Body="&lt;p&gt;Segmenting signal into overlaping frames is called &quot;enframe&quot; operation. A simple example is here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22372-wavelet-subband-coding-for-speaker-recognition/content/sbc/enframe.m&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/22372-wavelet-subband-coding-for-speaker-recognition/content/sbc/enframe.m&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might then filter (convolve) your signal with any kernel using for example &quot;conv&quot; command. Then apply the inverse operation of enframe.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-06T19:34:19.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13595" PostTypeId="2" ParentId="13585" CreationDate="2014-01-06T21:30:53.037" Score="1" Body="&lt;p&gt;You could use tensor factorization methods. For example if you are sure that your data is non-negative, then Nonnegative Matrix Factorization might be used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/stats/nnmf.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/stats/nnmf.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your application and format of A, you might want the sparsest solution. In that case minimization of $L_0$ norms would be considerable. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-01-06T22:12:23.610" LastActivityDate="2014-01-06T22:12:23.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13596" PostTypeId="1" CreationDate="2014-01-06T22:56:44.143" Score="4" ViewCount="233" Body="&lt;p&gt;Is there a good online course (with video) for Image/Signal Processing or Matrix Computations that includes a section on the principles of Compressed Sensing?&lt;/p&gt;&#xA;" OwnerUserId="4038" LastActivityDate="2014-04-26T20:30:09.040" Title="Soft question: seeking online course reference for CS" Tags="|image-processing|discrete-signals|compressive-sensing|" AnswerCount="6" CommentCount="1" CommunityOwnedDate="2014-04-27T02:07:28.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="13597" PostTypeId="2" ParentId="13596" CreationDate="2014-01-06T23:03:42.973" Score="2" Body="&lt;p&gt;EDIT: There is no shortage of links to go through:&#xA;&lt;a href=&quot;http://www.quora.com/Compressed-Sensing/What-are-some-good-resources-for-learning-about-compressed-sensing&quot; rel=&quot;nofollow&quot;&gt;http://www.quora.com/Compressed-Sensing/What-are-some-good-resources-for-learning-about-compressed-sensing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can suggest a good one from experience I would appreciate it.&lt;/p&gt;&#xA;" OwnerUserId="4038" LastActivityDate="2014-01-06T23:03:42.973" CommentCount="0" CommunityOwnedDate="2014-04-27T02:07:28.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="13598" PostTypeId="2" ParentId="13596" CreationDate="2014-01-06T23:18:13.250" Score="1" Body="&lt;p&gt;Coursera has many courses available. Please check &lt;a href=&quot;https://www.coursera.org/course/digital&quot; rel=&quot;nofollow&quot;&gt;https://www.coursera.org/course/digital&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-06T23:18:13.250" CommentCount="0" CommunityOwnedDate="2014-04-27T02:07:28.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="13599" PostTypeId="2" ParentId="5975" CreationDate="2014-01-06T23:54:42.997" Score="1" Body="&lt;p&gt;Check out Yang and Ramanan's work with flexible mixture of parts.  It starts with a central part, but pairs of parts that are attached are detected jointly by estimating the probability that the image area being queried supports the co-occurence of the attached parts in the image.  Error is presumed in the attachment and is minimized using a spring-like model.  Each part is detected using HOG-style techniques, and all pairs of parts in the human 'tree' are iterated over to determine the detection.  In my experience it has a very good false alarm rate, but requires hardware acceleration for real-time applications.&lt;/p&gt;&#xA;" OwnerUserId="7154" LastActivityDate="2014-01-06T23:54:42.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13600" PostTypeId="2" ParentId="13596" CreationDate="2014-01-07T02:02:48.897" Score="1" Body="&lt;p&gt;There are some good links at the Nuit Blanche website:&#xA;&lt;a href=&quot;http://nuit-blanche.blogspot.ca/p/teaching-compressed-sensing.html&quot; rel=&quot;nofollow&quot;&gt;Nuit Blanche&lt;/a&gt;&#xA;In particular the course by Baraniuk and Duarte &lt;a href=&quot;http://cnx.org/content/col11133/latest/&quot; rel=&quot;nofollow&quot;&gt;CNX Course&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-07T02:02:48.897" CommentCount="0" CommunityOwnedDate="2014-04-27T02:07:28.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="13601" PostTypeId="1" AcceptedAnswerId="13609" CreationDate="2014-01-07T03:14:17.963" Score="2" ViewCount="828" Body="&lt;p&gt;&lt;strong&gt;First, some background:&lt;/strong&gt; &lt;em&gt;The STFT is the best general-purpose tool I know of for analysing a (musical or other) signal into its component frequencies. For many purposes the STFT works fine, but there are two related problems that make it non-ideal for musical purposes -- 1) the frequency bins are evenly-spaced, not logarithmically like the human hearing system works, and 2) by the mathematical nature of the DFT/FFT, you need to capture a long period of audio to get decent frequency resolution at low frequencies.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For example, to be able to distinguish semitones accurately in the bass range of a piano, you'd need approximately 1hz resolution, meaning you'd need to capture 1 second of audio. For music, this is a completely unacceptable time resolution.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;There are various ways to enhance the output of the FFT, including a) zero-padding to create a larger window, or b) overlapping analysed segments, or c) magic with the phase to detect frequency change. These are useful, but still have problems -- more computation overhead, and while (a) can increase the apparent frequency resolution at a given temporal resolution, it doesn't help with a situation where two frequencies happen to fall into the same bin.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;So... I've been researching other possibilities, out of sheer interest. CWT and DWT looked very promising at first, but the CWT is very slow to compute, and the DWT only has octave frequency resolution. (That right?) I've also considered taking multiple FFTs at different time/frequencies resolutions to cover the space better, or solutions like zoom-FFT. These all help solve different specific problems, but none of them really make the fundamental problem go away: we don't have a fast (N log N) way of analysing the frequencies in a signal at good temporal &lt;strong&gt;and&lt;/strong&gt; frequency resolution.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;A lot of people point to the Heisenberg uncertainty principle at this point, implying that there's a mathematical impossibility of actually achieving this at all. I'm pretty sure this is simply wrong: sure, the uncertainty principle is valid, but we're not even close to running into it yet. The problem here is that the DFT/FFT can only analyse frequencies at integer multiples of the fundamental. However, the other frequencies are certainly there to be analysed, at good temporal resolution -- if we're willing to use a (computationally slow) sine sweep or continuous wavelet transform. The uncertainty principle doesn't cause problems until &lt;strong&gt;long&lt;/strong&gt; after the FFT ceases to be useful.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So, my solution. I'd like you to tell me if and where it's wrongheaded:&lt;/strong&gt; Let's correlate the input signal with probe phasors at select frequencies. At first, this sounds like an N^2 algorithm (N operations for a correlation at each frequency, times the number of frequencies). However, the key point is that for equivalent log-frequency resolution to an FFT of the same frequency resolution (at low frequencies), you only need to analyse log N frequencies -- because the resolution at high frequencies is logarithmically less important in musical signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we have an algorithm that works like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Decide on your frequency resolution. Let's say octaves for now, though I'd want sub-semi-tones in most applications.&lt;/li&gt;&#xA;&lt;li&gt;Pre-load some buffers with probe phasors as frequencies spaced at that interval -- let's say 16, 32, 64, 128, 256, 512, 1024hz, [...]. Because higher frequencies can be detected in a shorter amount of time, you need fewer samples (= better temporal resolution, as well as fewer operations) at higher frequencies. For the sake of it, let's use a few periods at each frequency.&lt;/li&gt;&#xA;&lt;li&gt;Pre-window these buffers, if it makes sense.&lt;/li&gt;&#xA;&lt;li&gt;Correlate each of these with a long-enough segment of the input signal at time t (i.e. the sum of the component-wise multiplication of the segment and the probe). Probably normalize this value.&lt;/li&gt;&#xA;&lt;li&gt;The result of this correlation is the magnitude of the signal at that frequency, at time t. So, the table of results-vs-frequencies should be your frequency spectrum at the desired logarithmic resolution (octaves, in this case).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From what I can work out, this would give you superb temporal resolution proportional (a few cycles of each frequency) at whatever frequency resolution you like, using approximately N operations times log N frequencies, so long as your frequencies were logarithmically spaced -- which is exactly what you want for music, and exactly the problem with the STFT -- thus, &lt;strong&gt;solving the problems with the STFT (for musical signals), with equivalent computational complexity.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? Would this work at all? Are there caveats or pitfalls? Is my complexity calculation mathematically sound?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It feels a bit like inventing a perpetual-motion machine -- it looks like it should work, but my gut feeling is that I'm glossing over some important detail.&lt;/p&gt;&#xA;" OwnerUserId="2076" LastEditorUserId="2076" LastEditDate="2014-01-07T06:43:04.923" LastActivityDate="2015-05-01T03:42:44.120" Title="Analyse audio/music frequencies without STFT, at 1/f temporal resolution, using probe phasors at logarithmically-spaced frequencies, O(N log N)?" Tags="|fourier-transform|frequency-spectrum|dft|time-frequency|stft|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13602" PostTypeId="2" ParentId="13601" CreationDate="2014-01-07T05:52:12.963" Score="3" Body="&lt;p&gt;What you describe might be similar to applying a Constant-Q transform using Morlet or Gabor wavelets.  These transforms may have a higher computational cost than using windowed FFTs, but may, when scaled suitably, represent something closer to human perceptual resolutions for both frequency and time.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-01-07T15:14:41.600" LastActivityDate="2014-01-07T15:14:41.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13603" PostTypeId="1" CreationDate="2014-01-07T07:08:47.427" Score="2" ViewCount="736" Body="&lt;p&gt;I am looking to detect a combination of frequencies in the frequency domain. For example, here is my spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/F6DVY.png&quot; alt=&quot;spectrum!&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I'm trying to detect the pilot tone. I have the FFT of the pilot tone:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NONEe.png&quot; alt=&quot;pilot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which zoomed in looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W1l15.png&quot; alt=&quot;zoomed&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried doing a cross-correlation in matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;trainingfft = fft(trainingfreq);&#xA;datafft = fft(idat);&#xA;Hxcorr = dsp.Crosscorrelator;&#xA;CorrResult = step(Hxcorr,datafft,trainingfft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But ended up with this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8p812.png&quot; alt=&quot;correlation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really am looking to detect the presence of the three peaks anywhere in the spectrum. I think the cross correlation isn't working because of the presence of the noise floor, so I was thinking about using some kind of threshold checker to clean up the noise but really am looking for an elegant solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an elegant way of doing this?&lt;/p&gt;&#xA;" OwnerDisplayName="user1529" LastEditorUserId="7092" LastEditDate="2020-03-29T14:15:53.677" LastActivityDate="2020-03-29T14:15:53.677" Title="Detecting a frequency pattern in the frequency domain" Tags="|fft|discrete-signals|signal-analysis|cross-correlation|correlation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13604" PostTypeId="1" CreationDate="2014-01-07T08:56:06.020" Score="2" ViewCount="87" Body="&lt;p&gt;All  of my DSP experience is very much centred in the EM spectrum and I've only ever processed EM-type signals in the past. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm now doing quite a bit of work in ultrasound and the audio spectrum, but a lot of the techniques I'm using are used in the EM mainly. I'm reading a lot of EM papers about DSP at much higher frequencies. Can I expect that the principles behind these techniques will behave in the same way, even though the medium of transmission is different?&lt;/p&gt;&#xA;" OwnerDisplayName="user1529" LastEditorUserId="76" LastEditDate="2014-01-07T14:30:26.877" LastActivityDate="2014-01-08T21:27:14.597" Title="Do DSP principles apply in the same way to both Audio and EM spectrums?" Tags="|audio|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13605" PostTypeId="1" AcceptedAnswerId="13606" CreationDate="2014-01-07T10:05:10.740" Score="17" ViewCount="39090" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How come FIR filters are always stable?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since they contain poles, shouldn't they be more affected by stability issues than others?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="1629" LastEditDate="2016-09-10T07:52:38.347" LastActivityDate="2019-01-07T07:42:04.807" Title="Why are FIR filters still stable even though they contain poles?" Tags="|filters|finite-impulse-response|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13606" PostTypeId="2" ParentId="13605" CreationDate="2014-01-07T11:00:25.707" Score="12" Body="&lt;p&gt;FIR filters contain only zeros and no poles.  If a filter contains poles, it is IIR.  IIR filters are indeed afflicted with stability issues and must be handled with care.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some further thought and some scribbling and google-ing, I think that I have an answer to this question of FIR poles that hopefully will be satisfactory to interested parties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beginning with the Z transform of a seemingly poleless FIR filter:&#xA;$$H(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2} + \cdots + b_N z^{-N}}{1}$$&#xA;As is shown in RBJ's answer, the FIR poles are revealed by multiplying the numerator and denominator of $H(z)$ by $z^{N}$:&#xA;$$H(z) = \frac{b_0 z^{N} + b_1 z^{N-1} + b_2 z^{N-2} + \cdots + b_N }{z^{N}}$$&#xA;Thus yielding our $N$ poles at the origin of a general FIR filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in order to show this, the assumption of causality is placed on the filter.  Indeed, if we consider a more general FIR filter where causality is not assumed:&#xA;$$G(z) = \frac{b_0 z^{k} + b_1 z^{k-1} + b_2 z^{k-2} + \cdots + b_N z^{k-N}}{1}$$&#xA;A different number of poles $(N-k)$ appear at the origin:&#xA;$$G(z) = \frac{b_0 z^{N} + b_1 z^{N-1} + b_2 z^{N-2} + \cdots + b_N }{z^{N-k}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, I conclude the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(Answering the original question) In general, an FIR filter does have poles, though always at the origin of the Z-plane.  Because they are never beyond the unit circle, they are no threat to the stability of an FIR system.&lt;/li&gt;&#xA;&lt;li&gt;The number of poles of the FIR signal corresponds to the filter order $N$ and the &quot;degree&quot; of acausality $k$. Thus, it is possible to construct FIR filters which have no poles but these filters are then acausal -- &lt;em&gt;i.e.&lt;/em&gt; they aren't conceivable for realtime processing.  For an $N^{th}$ order FIR filter which is exactly causal $(k=0)$, there are $N$ poles at the origin.&lt;/li&gt;&#xA;&lt;li&gt;Perhaps the simplest way to conceive of a pole at the origin is a simple delay element:&#xA;$$ H(z) = z^{-1} = \frac{1}{z}$$&#xA;The typical FIR filters can then be viewed as acausal filters which are followed by enough delay elements to make them causal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4391" LastEditorUserId="4391" LastEditDate="2014-01-08T16:33:32.760" LastActivityDate="2014-01-08T16:33:32.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13607" PostTypeId="2" ParentId="13604" CreationDate="2014-01-07T11:33:51.270" Score="0" Body="&lt;p&gt;Yes. However, depending on frequency, there might not be hardware that's fast enough.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-07T11:33:51.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13608" PostTypeId="1" AcceptedAnswerId="13657" CreationDate="2014-01-07T13:07:04.493" Score="4" ViewCount="970" Body="&lt;p&gt;Why is it that spectral images appear? I know they appear for $F_s$, but why those replicas appear, I don't know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g., sampling $x(t) = sin(1000 * 2\pi t)$ with a sample frequency of 230 Hz.&#xA;I know it will alias, due to spectral replicas, but why do those appear at all? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XnO9z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="76" LastEditDate="2014-01-07T14:36:28.853" LastActivityDate="2014-01-08T17:45:29.333" Title="Spectral images - How do they appear during ADC?" Tags="|frequency-spectrum|aliasing|digital|digitize|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13609" PostTypeId="2" ParentId="13601" CreationDate="2014-01-07T13:27:56.350" Score="3" Body="&lt;p&gt;True, the complexity would be $O(N \log N)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this $\log N$ captures a different reality from the $\log N$ in the FFT algorithm. In your case it comes from the fact that you're only interested in a smaller set of logarithmic spaced frequencies. In the FFT case, it comes from the &quot;divide and conquer&quot;, recursive structure of the Cooley–Tukey  algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you're interested in quarter-tone resolution, from 40 Hz to 1.28kHz. That's 5 octaves, or 120 quarter-tones. For a 1024-long buffer, your algorithm is doing exactly 1024 x 120 complex MAC (plus some book-keeping). A naive radix-2 FFT would do 1024 x 10 complex MAC (plus some book-keeping). Your algorithm is 12 times slower.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, your transform doesn't sound invertible, which makes it useful only for analysis applications (not resynthesis, effects...).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-01-07T15:40:46.000" LastActivityDate="2014-01-07T15:40:46.000" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13610" PostTypeId="2" ParentId="13604" CreationDate="2014-01-07T13:45:04.443" Score="2" Body="&lt;p&gt;Many of the ideas will be similar, but some assumptions may no longer apply. For instance many signals in EM can be treated as Narrowband (narrow bandwidth with respect to the centre frequency), in Ultrasound you may run into Broadband signals more easily. Another problem you may run into is the speed of propagation varies as a function of frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exactly what difference you encounter will depend on your experiences with EM and what exactly your are doing in ultrasound.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-07T13:45:04.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13611" PostTypeId="2" ParentId="13603" CreationDate="2014-01-07T14:14:13.020" Score="2" Body="&lt;p&gt;Try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xcorr(trainingfft,datafft,'option') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to specified a normalization for the cross-correlation. See the &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/xcorr.html&quot; rel=&quot;nofollow&quot;&gt;file page&lt;/a&gt; for more details of the option. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-07T14:14:13.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13612" PostTypeId="1" CreationDate="2014-01-07T14:24:17.213" Score="0" ViewCount="2442" Body="&lt;p&gt;Why is it that we Z-transform a difference equation to get a the transfer function of an digital filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How come a digital filter is given in the Z-domain, and what is the Z-domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for that sake, why do analog filters operate in the S-domain, and what is the S-domain?&lt;/p&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="76" LastEditDate="2014-01-07T14:38:08.567" LastActivityDate="2014-01-07T16:37:33.643" Title="Digital filters and the Z-transform" Tags="|filters|z-transform|digital|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13614" PostTypeId="2" ParentId="13553" CreationDate="2014-01-07T14:57:25.880" Score="0" Body="&lt;p&gt;I'm not sure I'm understanding your application. Are you trying to figure out the radar's frequency from the observations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the radar's PRF a priori - you can use that information to coherently add the pulses together. If you don't know the PRF you won't be able to eliminate the capture of the zero data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the radar platform moving? If so there is a spatial Doppler effect which may need to be compensated for. The situation is similar to Synthetic Aperture Radar (SAR) for coherently adding pulses together. 50 pulses is not a lot - whether you'll need to compensate for the spatial Doppler will depend on the geometry of the problem.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-07T14:57:25.880" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13615" PostTypeId="2" ParentId="13612" CreationDate="2014-01-07T14:57:29.967" Score="2" Body="&lt;p&gt;Applying a filter to a signal is convolution. For discrete signals, convolution equals polynomial or power (Laurent) series multiplication. The Z &quot;transform&quot; just formally puts filter coefficients and signal samples in power resp. Laurent series so that their multiplication can be interpreted back as the application of the filter to the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are certain important filters whose coefficient sequence is connected to a geometric sequence, so that the power/Laurent series with those coefficients has, again formally, a closed form as rational function.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Added: The real transform behind the formal Z transform is the Fourier series. Any stable signal or filter, i.e., with exponentially decaying coefficiens to both sides, and some signals that are not that good have a convergent Fourier series. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you might know that there is some funny business with the function space and pointwise convergence etc., the important part however is that the converse direction, recovering the coefficients from the periodic function, is much less problematic. So you can think of a signal being encoded by a periodic (square integrable function) $X(ω)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_n=\frac1{2π}\int_{-π}^π X(ω)e^{-i\,nω}\,dω$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of information content, $(x_n)$ and $X(ω)$ are equivalent. The application of a filter $f_k$ with Fourier series $F(ω)$ to encode it then has (depending on convention) the Fourier series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_n (f*x)_ne^{iωn}=\sum_n \sum_k f_ke^{iωk}\,x_{n-k}e^{iω(n-k)}=F(ω)X(ω)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to get the code of the filtered signal, you just multiply the codes of the filter and the signal pointwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By that design, any rational function $h(z)$ that acts as a Z transform is always the Z transform of a stable signal, the encoded coefficients are obtained by evaluating $X(ω)=h(e^{iω})$ over the unit circle,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_n=\frac1{2π}\int_{-π}^π h(e^{iω})e^{-i\,nω}\,dω=\frac1{2πi}\int_{|z|=1} \frac{h(z)}{z^{n+1}}\,dz$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that the resulting coefficients are those for the Laurent series relative to a narrow annulus around the unit circle.&#xA;end Added&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The Laplace or s transform does something similar for continuous signals. Convolution in the time picture is the same as pointwise multiplication in the Fourier picture. In the beginning and formally, the s transform is just a Fourier transform hiding the complex unit. There is more to it, the domains of Fourier and Laplace transforms each have parts that are not contained in the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The power of the Laplace transform stems from the fact that it can perfectly express solutions of linear (ordinary and partial) differential equations with constant coefficients. Among solutions of such ODE are the polynomials, exponential and trigonometric functions and products thereof.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-01-07T16:37:33.643" LastActivityDate="2014-01-07T16:37:33.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13616" PostTypeId="2" ParentId="13608" CreationDate="2014-01-07T15:35:19.320" Score="1" Body="&lt;p&gt;One way to represent AD conversion mathematically is to think of it as a multiplication of the signal by an &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirac_comb&quot; rel=&quot;nofollow&quot;&gt;impulse train&lt;/a&gt;, which is a sequence of dirac delta distributions spaced by the sampling period $T_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this in mind and remembering that multiplicating in the time domain is equivalent to doing convolution in the frequency domain, it's possible to see that the frequency representation of the digitalized signal will be the convolution of the frequency representation of the sampled analog signal with the frequency representation of the impulse train. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it turns out, the frequency representation of an impulse train spaced by $T_s$ is an impulse train spaced by the sampling frequency $f_s$. Also, the convolution of a dirac delta with any function $g$ is just $g$ itself. By displacing the delta function by $f_s$, we also displace the result of the convolution by $f_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the spectrum of the digitalized signal will be an infinite sum of copies of the spectrum of the analog signal distant of each other by $f_s$. Since the spectrum is bilateral, if your analog signal has frequency components above $f_s/2$, those components will end up summed from two different replicas in the spectrum of the digital signal, and this is in fact the aliasing effect.&lt;/p&gt;&#xA;" OwnerUserId="7385" LastActivityDate="2014-01-07T15:35:19.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13617" PostTypeId="2" ParentId="13605" CreationDate="2014-01-07T15:40:59.070" Score="26" Body="&lt;p&gt;FIR filters contain as many poles as they have zeros.  but all of the poles are located at the origin, $z=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because all of the poles are located inside the unit circle, the FIR filter is ostensibly stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is probably not the FIR filter the OP is thinking about, but there is a class of FIR filters called Truncated IIR filters (TIIR) which may have a pole on or outside the unit circle that is canceled by a zero at the same location.  the simplest example of this is the moving sum or moving average filter.  but, from an I/O perspective, these TIIR filters are FIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but i wouldn't naively guarantee &quot;stability&quot;.  using control-system language, the TIIR filter are not &quot;completely observable&quot; and may appear stable because its impulse response appears finite in length, but inside the filter states could be going to hell, and with finite numerical precision, that internal instability will eventually show up at the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we have to disabuse ourselves from the notion that &lt;i&gt;&quot;FIR filters have no poles&quot;&lt;/i&gt;.  ain't true.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-01-08T16:18:05.637" LastActivityDate="2014-01-08T16:18:05.637" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13618" PostTypeId="2" ParentId="13567" CreationDate="2014-01-07T15:43:43.587" Score="2" Body="&lt;p&gt;$\Phi$ is the matrix that represents the way you sample your signal $x$. Actually,  $\Phi$ can be an identity matrix with some rows eliminated, which means you are picking a subset of $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Psi$ represents the basis that you choose to expand $x$: &#xA;$$x = \Psi c$$&#xA;A very simple example is that $x$ is a cosine function (thus containing only one frequency component), then you can take $\Psi$ to be the Discrete Fourier (or discrete cosine) matrix and $c$ is just the coefficient of the specific frequency, and it is pretty sparse (all the coefficients on other frequencies will be zero). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the compressed signal $b$ can be represented as:&#xA;$$b = \Phi \Psi c$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually you can also view $\Phi \Psi$ as selection of the random rows of $\Psi$, then&#xA;one possible option of $\Phi$ and $\Psi$ is (in Matlab):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Psi = fft(eye(n)); &#xA;p = randperm(n);&#xA;Phsi = Psi(p(1:m),:); % choose the first m rows from the permutation &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Psi&lt;/code&gt; is $\Psi$, and &lt;code&gt;Phsi&lt;/code&gt; is $\Phi \Psi$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For your case, yes you can use singular value decomposition on the image space. But I would prefer to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[u,s,v]=svd(M'*M); % spectrogram&#xA;Psi = s(1:m,1:m) * v(1:m,:);&#xA;U = u(1:m,:);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which indicates that you select the &lt;code&gt;m&lt;/code&gt; most magnitude on spectrum components. Columns in &lt;code&gt;v'&lt;/code&gt; are the orthogonal vectors that map the frequency component with the corresponding magnitude to spectrum space. Please note that you don't need &lt;code&gt;u&lt;/code&gt; as the basis, since it is always equivalent between &lt;code&gt;u * s * v' * x = b&lt;/code&gt;, and &lt;code&gt;s * v' * x = u' * b&lt;/code&gt;. As a result, the compressed form is converted to:&#xA;$$U'b = \Phi \Psi c$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps. Thanks&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="4038" LastEditDate="2014-01-07T18:21:30.540" LastActivityDate="2014-01-07T18:21:30.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13619" PostTypeId="2" ParentId="13612" CreationDate="2014-01-07T15:57:11.557" Score="4" Body="&lt;p&gt;The S-transform allows you to deal with differential equations in an algebraic manner - so they become easier to solve. Since continuous/analog filters consist of integrators and differentiators the S-transform is therefore a natural way to deal with these systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The z-transform provides an algebraic way of dealing with finite difference systems and therefore it is a natural way to deal to discrete-time systems i.e. digital.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the S-transform, setting $s=j\omega$ results in the Fourier transform. For continuous time systems we are interested in whether poles are on the right or left side of the $j\omega$ axis, because that determines the stability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Z-transform, setting $z=e^{j\omega}$ results in the Discrete-Time Fourier transform. To determine stability, we are interested in whether the poles are inside or outside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the S and Z domains are similar - they allows you solve continuous and discrete time systems, respectively,  using algebra.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-07T15:57:11.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13621" PostTypeId="1" CreationDate="2014-01-07T17:34:56.283" Score="0" ViewCount="785" Body="&lt;p&gt;How does an equalizer prevent a sample and hold effect? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does a reconstruction filter only smooth out the output of an DAC (+S&amp;amp;H) or does it have another function?&lt;/p&gt;&#xA;" OwnerUserId="7277" LastEditorUserId="76" LastEditDate="2014-01-07T21:47:52.900" LastActivityDate="2021-11-24T19:01:10.657" Title="How does an equalizer prevent a sample and hold effect?" Tags="|filters|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13622" PostTypeId="1" CreationDate="2014-01-07T17:58:40.717" Score="1" ViewCount="166" Body="&lt;p&gt;Can anyone help me understand where the value of $2$ comes from in the following statement? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A time function t whose frequency response is white out to a bandwidth B has &#xA;about 2 · B · T independent values when measured for the time interval T.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is in the context of a serial stream of digital (e.g. binary) data. The function &lt;code&gt;t&lt;/code&gt; represents this data stream.&lt;/p&gt;&#xA;" OwnerUserId="7492" LastEditorUserId="7092" LastEditDate="2014-01-07T18:43:45.913" LastActivityDate="2014-01-08T14:33:34.327" Title="On computing the number of independent values from a signal's bandwidth?" Tags="|digital-communications|statistics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13623" PostTypeId="2" ParentId="13621" CreationDate="2014-01-07T18:06:29.640" Score="1" Body="&lt;p&gt;Equalizers do not prevent the sample and hold effect, though if you are talking about compensation filters, see the edit below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two types of reconstruction filters (also known as low-pass filters): analog and digital.  An analog low-pass filter can smooth out the output of a DAC.  A digital low-pass filter cannot, since it comes before the DAC.  What it can do is reduce the effect of the sample and hold by increasing the sample rate (assuming it is an interpolation filter) and then getting rid of the aliases via the low-pass filtering.  The effect of the sample and hold is reduced due to the increased sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: As Robert points out, the frequency droop that happens as a result of the zero-order hold can be partially compensated for with digital filters whose frequency domain gain is the inverse of the zero-order hold effect.  While this will not eliminate the sample and hold effect, it will mitigate it.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2014-01-08T19:15:42.017" LastActivityDate="2014-01-08T19:15:42.017" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13624" PostTypeId="2" ParentId="13524" CreationDate="2014-01-07T19:31:59.800" Score="6" Body="&lt;p&gt;I am trying to answer your question about incoherence here rather than update my previous answer on another question of yours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compressive sensing requires low coherent pairs. So the lower $\mu(\Phi,\Psi)$, the better. Actually is $\Phi$ is spike basis (identity matrix) with $\phi_k(t) = \delta(t-k)$, and $\Psi$ is Fourier basis with $\psi_j(t) = 1/\sqrt n e^{-i \cdot 2\pi \cdot jt/n}$, which is just the example I showed you in &lt;a href=&quot;https://dsp.stackexchange.com/questions/13567/calculating-an-incoherence-property-from-sub-optimal-sampling-patterns/13618#13618&quot;&gt;another question&lt;/a&gt;, $\mu(\Phi,\Psi) = 1$, and the maximal incoherence is achieved. It is similar that if you apply the spike basis and the orthogonal basis obtained from SVD. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other coherence includes but not limited to: coherence between noiselets and Haar wavelets is $\sqrt2$; coherence between noiselets and Baubechies D4 and D8 are $2.2$ and $2.9$, respectively; random matrices are largely incoherent with any fixed basis $\Psi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may refer to &lt;a href=&quot;http://home.ustc.edu.cn/~zhanghan/cs/Candes_Romberg07.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Candes-Romberg theorem&lt;/a&gt; for more details on incoherent sampling.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-01-07T19:31:59.800" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13625" PostTypeId="1" CreationDate="2014-01-07T19:38:22.653" Score="-1" ViewCount="110" Body="&lt;pre&gt;&lt;code&gt;while abs(x(i)) &amp;lt;0.05     % Silence detection&#xA;    i = i + 1;&#xA;end&#xA;x(1 : i) = [];&#xA;x(6000 : 10000) = 0;&#xA;x1 = x.* w;&#xA;mx = fft(x1);&#xA;&#xA;% Transform to frequency domain&#xA;nx = abs(mx(floor(mel(f))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7482" LastEditorUserId="7092" LastEditDate="2020-03-31T04:56:45.810" LastActivityDate="2020-03-31T04:56:45.810" Title="difficulty in understanding this code" Tags="|matlab|signal-analysis|sound|" AnswerCount="1" CommentCount="3" ClosedDate="2014-01-09T14:15:43.597" ContentLicense="CC BY-SA 3.0" />
  <row Id="13626" PostTypeId="2" ParentId="13625" CreationDate="2014-01-07T19:43:28.330" Score="2" Body="&lt;p&gt;&lt;code&gt;x&lt;/code&gt; is a sound signal, the &lt;code&gt;while&lt;/code&gt; loop finds out the time point that sound first comes out. Before that, the signal is regarded as silence and removed, the signal within 6000 and 10000 elements are set to zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;w&lt;/code&gt; is probably a window function that extracted the time zone you are interested, then the signal is converted to frequency domain. &lt;code&gt;nx&lt;/code&gt; is the magnitude in frequency domain. (I am not sure what does &lt;code&gt;mel&lt;/code&gt; mean, perhaps a function defined in another file)&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-01-07T20:13:01.583" LastActivityDate="2014-01-07T20:13:01.583" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13627" PostTypeId="2" ParentId="13622" CreationDate="2014-01-07T20:17:22.987" Score="3" Body="&lt;p&gt;It comes from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist_rate&quot; rel=&quot;nofollow&quot;&gt;Nyquist rate&lt;/a&gt;.  The Nyquist sample rate for a signal with bandwidth $B$ is $2B$.  In other words, that is the lowest sample rate that will contain all of the information in the signal without distorting it (i.e. without losing information).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question implicitly assumes that the sample rate is $2B$, and thus that in time $T$ you will get $2B*T$ independent samples.  If the sample rate was greater than $2B$, then the signal would not be &quot;white&quot; anymore and the samples would have some correlation.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-01-07T20:17:22.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13628" PostTypeId="2" ParentId="13015" CreationDate="2014-01-07T20:20:53.370" Score="3" Body="&lt;p&gt;The mutual coherence is a kind of proxy for the Restricted Isometry Constant (RIC), because the RIC is impractical to calculate i.e. NP hard. You should note that the RIP is sufficient but not necessary for sparse reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's another definition of mutual coherence - assume that you are trying to solve&#xA;$$y=Ax$$&#xA;where $x$ is sparse.&#xA;The mutual coherence of $A$ is given as&#xA;$$u(A) = \max_{i\neq j}|A_i^HA_j| $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RIC is conservatively bounded by $u(A) \leq R_s(A) \leq (s-1)u(A)$, where $||x^{true}||_0=s$.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-07T20:20:53.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13629" PostTypeId="2" ParentId="9628" CreationDate="2014-01-07T21:34:22.647" Score="1" Body="&lt;p&gt;As others have stated in the comments, the answer is &quot;No&quot;.  The non-zero mean of the matrix dictates that a nonzero mean vector (say, all ones), will have substantially higher gain than a random vector with zero mean (say uniformly random +1,-1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the squared norm of A times a constant vector y is expected to be n*(p*N)^2.  (iteration of expectations)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The squared norm of A times a vector x drawn uniformly from (-1,+1) is expected to be n*(p*N).  (calculable by sum of variances of Binomial distribution)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The norms of x and y are the same, but the expectation of transformed norms differ by a factor of p*N -- diverging as the dimensions grow large.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's matlab code to help demonstrate.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=2000;&#xA;N=1000;&#xA;p=.9;&#xA;A=double(rand(n,N)&amp;lt;p); &#xA;x=sign(randn(N,1)); &#xA;y=ones(N,1);&#xA;Ex_normSqAx = n*(N*p);  % E[ squared norm of A times random signs ]&#xA;Ex_normSqAy = n*(N*p)^2; % E[ squared norm of A times constant vector ]&#xA;normSqAx = norm(A*x)^2;&#xA;normSqAy = norm(A*y)^2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-01-07T21:34:22.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13630" PostTypeId="1" AcceptedAnswerId="13639" CreationDate="2014-01-07T23:13:27.417" Score="2" ViewCount="1115" Body="&lt;p&gt;This is what I am doing and will be grateful for any help.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I selected 16 similar blocks to a reference block from a search block, put them in a 3D array, Wavelet Thresholded them, took inverse transform.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;These 16 similar blocks belong to one 32 * 32 search block as mentioned above.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now I should multiply each of these blocks with their weight, and then add them all up, creating a 2D array from a 3D array.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This new block then replaces all the 16 original blocks that I had selected before for hard thresholding.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Am I correct here? I will be absolutely grateful for a response.&lt;/p&gt;&#xA;" OwnerUserId="4142" LastEditorUserId="4142" LastEditDate="2014-01-07T23:34:42.083" LastActivityDate="2014-01-13T11:58:16.567" Title="Help required with BM3D Image denoising algorithm implementation" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13631" PostTypeId="2" ParentId="13524" CreationDate="2014-01-08T00:42:41.617" Score="3" Body="&lt;p&gt;I cant add comment due to low reputation. I think you misunderstood @lennon310's meaning. I reviewed his answer in the link, he treated Phi as a row selection matrix. @lennon310, please consider change your word 'rectangular identity'. I know what you mean, but that is not called identity matrix. Phi (in his context) is something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 1 0 0 0 0&#xA;   0 0 0 0 1 0&#xA;   1 0 0 0 0 0&#xA;   ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Only one element valued 1 in each row, as if you are selecting rows of Psi.  &lt;/p&gt;&#xA;" OwnerUserId="7103" LastActivityDate="2014-01-08T00:42:41.617" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13632" PostTypeId="2" ParentId="13596" CreationDate="2014-01-08T00:45:40.537" Score="1" Body="&lt;p&gt;There are some matlab &lt;a href=&quot;http://compsens.eecs.umich.edu/sensing_tutorial.php&quot; rel=&quot;nofollow&quot;&gt;codes&lt;/a&gt; on CS.&lt;/p&gt;&#xA;" OwnerUserId="7103" LastActivityDate="2014-01-08T00:45:40.537" CommentCount="0" CommunityOwnedDate="2014-04-27T02:07:28.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="13633" PostTypeId="2" ParentId="13605" CreationDate="2014-01-08T01:53:07.343" Score="1" Body="&lt;p&gt;Somewhat by definition, actually. Since you input finite energy and the Filter will only maximally deliver a multiple of the energy input (its impulse response has a finite energy), the resulting signal will maximally have a multiple of the energy input. It can not resonate and thus escalate, as IIR filters can. This is behind Kenneides answer as well.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-08T01:53:07.343" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13636" PostTypeId="1" CreationDate="2014-01-08T04:52:28.450" Score="1" ViewCount="965" Body="&lt;p&gt;I have an EEG signal and it contains eye blink artifacts. I read some references and know that it is possible to detect eye blinks and remove them by using wavelet transforms, but I don't know that how do it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I detect eye blinks? After transforming the EEG signal into wavelet coefficients, what should I do and which level of Daubechies can be used to do that?&lt;/p&gt;&#xA;" OwnerUserId="7496" LastEditorUserId="76" LastEditDate="2014-01-08T23:44:24.763" LastActivityDate="2014-01-08T23:44:24.763" Title="Denoise EEG signal by using Daubechies function" Tags="|filters|wavelet|eeg|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13637" PostTypeId="2" ParentId="13605" CreationDate="2014-01-08T05:12:13.863" Score="17" Body="&lt;p&gt;&lt;i&gt;&quot;Can you mathematically show that FIR filters have poles, because I'm not seeing it.&quot; –  Jim Clay&lt;/i&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can we assume this FIR is causal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;filter order is $N$.  number of taps is $N+1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the Finite Impulse Response:  $ \quad h[n] = 0 \quad \forall \quad n&amp;gt;N, \ n&amp;lt;0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;transfer function of the FIR:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;H(z) &amp;amp; = \sum_{n=-\infty}^{+\infty} h[n] z^{-n} \\&#xA;     &amp;amp; = \sum_{n=0}^{N} h[n] z^{-n} \\&#xA;     &amp;amp; = \sum_{n=0}^{N} z^{-N} h[n] z^{N-n} \\&#xA;     &amp;amp; = z^{-N} \sum_{n=0}^{N} h[N-n] z^n \\&#xA;     &amp;amp; = \frac{\sum_{n=0}^{N} h[N-n] z^{n}}{z^N} \\&#xA;     &amp;amp; = \frac{h[N] + h[N-1]z + h[N-2]z^2 + \cdots + h[1]z^{N-1} + h[0]z^N}{(z-0)^N} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all you have to do is factor the numerator and you'll know where the zeros are.  but it's pretty obvious where all the poles are for an FIR filter.  and there are as many poles as is the order of the FIR filter.  note that these poles do not affect the frequency response.  except for phase.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-01-08T05:12:13.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13638" PostTypeId="1" AcceptedAnswerId="13672" CreationDate="2014-01-08T06:29:22.580" Score="0" ViewCount="590" Body="&lt;p&gt;I'm starting to learn about Gabor filters and Fourier series. I need to make a presentation on Gabor filters in a few months, so I need quality references for the presentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any suggestions on introductory books, useful articles or other similar literature which I may use as references for theory on Gabor filters and Fourier transform?&lt;/p&gt;&#xA;" OwnerUserId="4378" LastEditorUserId="1273" LastEditDate="2014-01-09T23:12:19.657" LastActivityDate="2014-01-10T13:43:28.567" Title="Book recommendations on Gabor filter and Fourier series" Tags="|reference-request|fourier-series|gabor|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13639" PostTypeId="2" ParentId="13630" CreationDate="2014-01-08T07:09:04.577" Score="2" Body="&lt;p&gt;Step 3 is not correct. The first part is ok (each denoised result is weighted by some likelihood of correctness, that was obtained previously from the variance of the data), but you don't have to add them up. Each slice from the 3D array is a 2D patch that is back-projected to the resulting image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sum happens when 2 back-projected patches do overlap in the final image domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;About back-projection&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back-projection is the process of taking a 2D slice from the denoised stack and put it back in image space.&#xA;This is required because unlike most variants of NL-means BM3D denoises patches and not the central pixel of a patch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you have 2 images when implementing BM3D:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the original (noisy) one;&lt;/li&gt;&#xA;&lt;li&gt;the result (denoised) image.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The spatial location of a patch should not change during the denoising process, otherwise the image content would be destroyed. So, each slice from the denoised patch stack goes back to its original place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, one issue remains: what to do when back-projected patches overlap? What value should we keep for a single pixel?&#xA;The solution chosen by BM3D is that each pixel contains a weighted mean of the patches that overlap in each pix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement this, you can simply pre-multiply each slice of the denoised stack by its weight, add a third image to store the sum of the weights inside each pixel, sum for each pixel its value from all the denoised patches that contain it, and in a final step (once all the patch stacks haves been processed) divide the result image by the weight image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Image processing main loop (outline)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no &quot;unleft&quot; pixel in the final result. The outline of the main loop is as follows: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;for every pixel of the image, form a reference patch; &lt;/li&gt;&#xA;&lt;li&gt;for a given reference patch, find n &amp;lt;= N (B=16 in your case) patches whose distance to the reference patch is less than some threshold and make a stack; &lt;/li&gt;&#xA;&lt;li&gt;denoise the stack; &lt;/li&gt;&#xA;&lt;li&gt;back project the patches in the denoised stack; &lt;/li&gt;&#xA;&lt;li&gt;back to 1) for the next pixel). &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thus, you always have one stack for a given patch (degenerate case: only 1 patch in the stack), and a pixel is always involved in several patches.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2014-01-13T11:58:16.567" LastActivityDate="2014-01-13T11:58:16.567" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13640" PostTypeId="1" CreationDate="2014-01-08T07:44:49.353" Score="2" ViewCount="494" Body="&lt;p&gt;I am able to find out the velocities of pixels using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lucas%E2%80%93Kanade_Optical_Flow_Method&quot; rel=&quot;nofollow&quot;&gt;Lucas-Kanade method&lt;/a&gt;. Now I want to use it for tracking. I am using a Kalman filter taking $x$, $y$, $v_x$ and $v_y$ ($(x,y)$ is position of a particular object pixel and $(v_x,v_y)$ is velocity of a pixel) as state variables of the Kalman filter. Now the problem I am facing is how will I get to select the pixels that are representing the object to be tracked?&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="39" LastEditDate="2014-01-08T11:01:28.093" LastActivityDate="2018-03-20T12:37:42.733" Title="Recognizing object of interest in object tracking using Lucas-Kanade method" Tags="|image-processing|visual-tracking|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13641" PostTypeId="1" CreationDate="2014-01-08T07:53:50.120" Score="2" ViewCount="2549" Body="&lt;p&gt;I want to find the partial derivative of an image with respect to its X coordinate. I read that it can be done by convolution of the image with a mask like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             fx = conv2(im1, 0.25 * [-1 1; -1 1]) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do not understand how is it calculating the partial derivative - can anyone explain?&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="39" LastEditDate="2014-01-08T10:58:49.207" LastActivityDate="2014-01-10T09:16:07.053" Title="Partial derivative of image using mask" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13642" PostTypeId="2" ParentId="9573" CreationDate="2014-01-08T08:25:57.357" Score="0" Body="&lt;p&gt;You can try with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mean-shift&quot; rel=&quot;nofollow&quot;&gt;mean shift&lt;/a&gt; algorithm. It is implemented in &lt;a href=&quot;http://orfeo-toolbox.org&quot; rel=&quot;nofollow&quot;&gt;Orfeo Toolbox&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7498" LastEditorUserId="7092" LastEditDate="2014-01-08T13:15:15.510" LastActivityDate="2014-01-08T13:15:15.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13644" PostTypeId="2" ParentId="9573" CreationDate="2014-01-08T08:42:24.327" Score="0" Body="&lt;p&gt;Microsoft has developed Branch-and-MinCut, and well applied it to medical images. The paper is here:&#xA;&lt;a href=&quot;http://research.microsoft.com/en-us/um/people/ablake/papers/ablake/image%20segmentation%20eccv2008.pdf&quot; rel=&quot;nofollow&quot;&gt;http://research.microsoft.com/en-us/um/people/ablake/papers/ablake/image%20segmentation%20eccv2008.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a quite good algorithm, as it address global minima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, they released it open source:&#xA;&lt;a href=&quot;http://research.microsoft.com/en-us/downloads/994e80f7-007b-4fed-a6e9-db5f4f32ccd1/&quot; rel=&quot;nofollow&quot;&gt;http://research.microsoft.com/en-us/downloads/994e80f7-007b-4fed-a6e9-db5f4f32ccd1/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-08T08:42:24.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13645" PostTypeId="2" ParentId="13641" CreationDate="2014-01-08T08:58:17.517" Score="2" Body="&lt;p&gt;Partial derivatives in discrete domains are computed using differences (finite difference in more proper terms). There are many methods to do that such as central finite difference or forward, backward and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convolution operation you mentioned computes forward distances in horizontal direction and results in x-derivatives (namely the $x$ component of the gradient). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To also compute in $y$ direction you might do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fx = conv2(im1,0.25* [-1 -1; 1 1]) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;0.25 is there just to scale the values to appropriate range (weights each pixel the same).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on finite differencing you might check:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_difference#Forward.2C_backward.2C_and_central_differences&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Finite_difference#Forward.2C_backward.2C_and_central_differences&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is a local-masking operation where at each pixel you compute the dot product of the kernel and matrix part that corresponds to the kernel. Then, kernel is shifted. I won't go to the details of convolution as it is already explaind in &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Convolution&lt;/a&gt;. However, let's say we have a matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;   I=&#xA;  \left[ {\begin{array}{cc}&#xA;   1 &amp;amp; 2 &amp;amp; 4 \\&#xA;   6 &amp;amp; 14 &amp;amp; 17\\&#xA;   16 &amp;amp; 41 &amp;amp; 18\\&#xA;  \end{array} } \right]&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we convolve this with the kernel mentioned and discard for now the boundary conditions, we end up with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;   G=&#xA;  \left[ {\begin{array}{cc}&#xA;   -2.25 &amp;amp;  -1.25 \\&#xA;   -8.25 &amp;amp;  5.0 \\&#xA;  \end{array} } \right]&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(this is part in the middle of the result). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you should notice that basically, per each element, we compute a sum of 2 neighbors vertically on the left, sum of 2 neighbors vertically on the right and subtract these intermediate results. As subtraction is done horizontally, it computes the horizontal derivatives. This is what convolution intrinsically does. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-01-10T09:16:07.053" LastActivityDate="2014-01-10T09:16:07.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13646" PostTypeId="2" ParentId="13640" CreationDate="2014-01-08T09:02:32.380" Score="0" Body="&lt;p&gt;If the only thing that moves is the object, you might threshold the magnitudes of the flow vectors. Magnitudes which are greater than some threshold simply represent the optical flow components of the moving object, and nothing else.  &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-08T09:02:32.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13647" PostTypeId="2" ParentId="13636" CreationDate="2014-01-08T09:23:27.483" Score="2" Body="&lt;p&gt;You might simply use soft/hard thresholding. This operation is quite standard and called Wavelet Denoising.&#xA;Here are some resources:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.stthomas.edu/mathematics/pdfs/MSAD/Denoising%20via%20Wavele.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.stthomas.edu/mathematics/pdfs/MSAD/Denoising%20via%20Wavele.pdf&lt;/a&gt;&#xA;&lt;a href=&quot;http://scholar.lib.vt.edu/theses/available/etd-12062002-152858/unrestricted/Chapter4.pdf&quot; rel=&quot;nofollow&quot;&gt;http://scholar.lib.vt.edu/theses/available/etd-12062002-152858/unrestricted/Chapter4.pdf&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.ee.iitb.ac.in/~icvgip/PAPERS/202.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ee.iitb.ac.in/~icvgip/PAPERS/202.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An overview of noise removal for EEG:&#xA;&lt;a href=&quot;http://www.ijarcce.com/upload/february/3_A%20survey%20on%20different.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ijarcce.com/upload/february/3_A%20survey%20on%20different.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some source code on image denoising via VisuShrink:&#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/43996-image-denoising-using-visushrink&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/43996-image-denoising-using-visushrink&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-08T09:23:27.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13648" PostTypeId="2" ParentId="863" CreationDate="2014-01-08T09:26:58.483" Score="1" Body="&lt;p&gt;You can use structure from motion type of algorithm to estimate the camera pose from the environment, not from the markers and then fuse this camera pose with the marker poses in order to detect the locations of the markers accurately. Knowing the extrinsic pose of your camera (by SFM), you can triangulate all the 3D positions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For pose estimation, 5-point methods are usually more accurate than 8-point algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presumably, you should do further bundle adjustment so that the overall accuracy increases.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2017-04-18T20:31:17.703" LastActivityDate="2017-04-18T20:31:17.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13649" PostTypeId="2" ParentId="9667" CreationDate="2014-01-08T09:37:28.387" Score="2" Body="&lt;p&gt;Other than searching for a color space, why don't you just first apply a color correction and then get the hue space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If illumination is an issue, you might consider an illumination invariant color correction:&#xA;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.108.6859&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.108.6859&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then simple convert your image to HSV and get H channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, if you have some clue about what you are looking at (such as roads, football fields etc) then you might use that too. Such an algorithm is mentioned here:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/10922467/illumination-invariant-image&quot;&gt;https://stackoverflow.com/questions/10922467/illumination-invariant-image&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-01-08T09:37:28.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13650" PostTypeId="2" ParentId="12636" CreationDate="2014-01-08T10:25:03.157" Score="4" Body="&lt;p&gt;Wavelets are ideal for localized events. The Fourier Transform represents a function as a sum of sines and cosines, neither of which are localized. The spectrogram does keep some time information, at the expense of frequency resolution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the signal is not localized at all.  The spectrogram smears your 15 Hz band over several Hz, as it captures some time information, and the scalogram flat out fails.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-01-08T10:25:03.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13651" PostTypeId="2" ParentId="13605" CreationDate="2014-01-08T12:23:52.317" Score="1" Body="&lt;p&gt;Nobody's really touched upon why the poles of a FIR filter are removable so I've attempted to answer this below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FIR filters will have removable poles at the origin, because the boundedness of their impulse response requires this. That is around the pole, it's possible to define the function so that it is still holomorphic (differentiable at every point of its domain). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a theorem of Riemann that if a signal is differentiable at every point of it's domain (except for finitely many points), then there exists a neighborhood around these special points where the function is bounded. The implications are two way in this theorem, so because FIR filters are required to have a bounded impulse response then the impulse response must be differentiable at every point within the unit circle. Thus, the signal can be extended in a consistent way so that there are no singularities (i.e. the poles are removable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why the z-transform of a FIR filter contains no negative powers of $z$.&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2014-01-08T12:23:52.317" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13652" PostTypeId="2" ParentId="13622" CreationDate="2014-01-08T14:19:52.587" Score="0" Body="&lt;p&gt;I don't think that whiteness is of any importance here, and in particular, &#xA;&lt;strong&gt;no&lt;/strong&gt; digital modulation scheme is going to create a signal whose power spectrum&#xA;is anywhere close to that of band-limited white noise -- flat in bandwidth $B$&#xA;and $0$ outside the band.  The result the OP is asking about&#xA;is based on what is called the &#xA;&lt;em&gt;&lt;a href=&quot;http://books.google.com/books?id=gu_pHTmUwaIC&amp;amp;pg=PA306&amp;amp;lpg=PA306&amp;amp;dq=landau+pollak+theorem&amp;amp;source=bl&amp;amp;ots=-1kQr9JZPn&amp;amp;sig=pTzx6AUrfT_pX5o47nnOMGmT7lo&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=21_NUsayHsjMsASCgYHwDA&amp;amp;ved=0CFYQ6AEwBQ#v=onepage&amp;amp;q=landau%20pollak%20theorem&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;Landau-Pollak theorem&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The late U.S. Supreme Court Justice Potter Stewart once rendered&#xA;a decision in which he memorably said&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;``I may not know how to define it legally, but I know it when I see it.''&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;He was, of course, speaking of pornography, but the notion of&#xA;&lt;em&gt;bandwidth&lt;/em&gt; of a signal is very similar.  &lt;em&gt;Every&lt;/em&gt; engineer understands&#xA;the notion, perhaps only at an intuitive level, but a definition of bandwidth&#xA;that is satisfactory for &lt;em&gt;all&lt;/em&gt; purposes remains as elusive as ever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal $s(t)$ is said to be &lt;em&gt;strictly time-limited&lt;/em&gt; if $s(t)$ is 0&#xA;outside a time interval of finite length, e.g. &#xA;$s(t) = 0$ if $t &amp;lt; 0$&#xA;or $t &amp;gt; T$.  It is said to be&#xA;&lt;em&gt;strictly band-limited&lt;/em&gt; if its Fourier transform $S(f)$&#xA;is 0 outside a frequency interval of finite length, e.g.&#xA;$S(f) = 0$&#xA;if $\vert f\vert &amp;gt; W$, or $S(f) = 0$ if  $\vert f\vert &amp;gt; f_c+W/2$,&#xA;or $\vert f \vert &amp;lt; f_c - W/2$&#xA;corresponding respectively to lowpass or bandpass signals of bandwidth $W$.&#xA; Unfortunately, a signal&#xA;cannot be both strictly time-limited and strictly band-limited.&#xA;Now, let $s(t)$ be a &lt;em&gt;unit-energy&lt;/em&gt; strictly time-limited function.&#xA;In particular, suppose that $s(t) = 0$ if $t &amp;lt; 0$ or if $t &amp;gt; T$.&#xA;Let $\eta$ denote a &lt;em&gt;small&lt;/em&gt; positive number, that is,&#xA;$0 &amp;lt; \eta \ll 1$.  Let $W$ be a number such that&#xA;$$&#xA;\int_{-W}^W \vert S(f)\vert^2 \, df &amp;gt; 1 - \eta,&#xA;$$&#xA;that is, &lt;em&gt;almost all&lt;/em&gt; of the energy in $s(t)$ is in the&#xA;frequency band $[-W, W]$.  We say that $s(t)$ is&#xA;&lt;em&gt;essentially band-limited&lt;/em&gt; to $W$ Hz or an essentially&#xA;low-pass signal of bandwidth $W$ Hz.  Now, suppose that&#xA;$\{s(t)\}$ denotes a collection of unit-energy signals that are&#xA;all strictly time-limited to $[0, T]$ and all essentially band-limited&#xA;to $[-W, W]$.  How many mutually orthogonal signals does the set&#xA;$\{s(t)\}$ contain?  The answer is given by a result called&#xA;the Landau-Pollak Theorem.  The number of orthogonal&#xA;signals is less than $2WT/(1 - \eta)$.  Since $\eta$ is very&#xA;close to 0, the denominator is just slightly less than 1, and so we&#xA;conclude that the number of orthogonal signals strictly&#xA;time-limited to $[0, T]$ and essentially band-limited to&#xA;$W$ Hz is approximately $M = 2WT$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Duality says that if the signal is &lt;em&gt;strictly&lt;/em&gt; band-limited to&#xA;$W$ Hz, then it is &lt;em&gt;essentially&lt;/em&gt; time-limited to a duration of&#xA;$T$ seconds (that is, ($1-\eta$) of the energy is in that duration)&#xA;and there are approximately $2WT$ orthogonal signals with this&#xA;property.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-01-08T14:33:34.327" LastActivityDate="2014-01-08T14:33:34.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13653" PostTypeId="2" ParentId="1450" CreationDate="2014-01-08T15:42:57.187" Score="2" Body="&lt;p&gt;I recommend you to use TopSurf as in here:&#xA;&lt;a href=&quot;http://www.liacs.nl/~bthomee/topsurf/index.html&quot; rel=&quot;nofollow&quot;&gt;http://www.liacs.nl/~bthomee/topsurf/index.html&lt;/a&gt;&#xA;&lt;a href=&quot;http://press.liacs.nl/researchdownloads/topsurf/&quot; rel=&quot;nofollow&quot;&gt;http://press.liacs.nl/researchdownloads/topsurf/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can do large scale recognition and is open source. At least try to benchmark your results with it.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-08T15:42:57.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13654" PostTypeId="2" ParentId="13641" CreationDate="2014-01-08T16:02:48.527" Score="1" Body="&lt;p&gt;@tbirdal's explanation using finite differences is of course right, but there's another way to understand this: Linear operators like convolution or taking a partial derivative are associative. Meaning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{\partial}{\partial x}\text{convolution}(f,g) = convolution(\frac{\partial}{\partial x}f,g)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, even when the partial derivative of a function is undefined, the partial derivative of a convolution of that function with some kernel function may be defined. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the partial derivative of the convolution with a triangle function is equivalent to convolution with the derivative of the triangle function - which is just your kernel (note the shift by 0.5 pixels):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L1c1J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think of your image as a series of dirac pulses or as a piecewise constant function, convolving it with a smoothing kernel, then taking the derivative makes perfect sense. And that's just what your convolution mask does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another common derivative kernel is the Gaussian derivative, which is equivalent to Gaussian smoothing, then taking the derivative.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2014-01-08T16:02:48.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13655" PostTypeId="2" ParentId="1450" CreationDate="2014-01-08T16:35:48.767" Score="2" Body="&lt;p&gt;Just to add to the discussion I am currently working on image matching and I found OpenCV's &lt;a href=&quot;http://docs.opencv.org/modules/features2d/doc/feature_detection_and_description.html&quot; rel=&quot;nofollow&quot;&gt;ORB&lt;/a&gt; is free; however &lt;a href=&quot;http://docs.opencv.org/modules/nonfree/doc/feature_detection.html&quot; rel=&quot;nofollow&quot;&gt;SURF and SIFT&lt;/a&gt; aren't. You can look at &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; example as a possible starting point. &lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="4433" LastEditDate="2014-01-10T02:31:34.323" LastActivityDate="2014-01-10T02:31:34.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13657" PostTypeId="2" ParentId="13608" CreationDate="2014-01-08T17:45:29.333" Score="1" Body="&lt;p&gt;the reason that they appear is that the sampling function is periodic and has these Fourier sinusoidal components all with coefficients of 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;s(t) &amp;amp; = T \sum_{n=-\infty}^{+\infty} \delta(t - nT) \\&#xA;&amp;amp; = \sum_{k=-\infty}^{+\infty} e^{j 2 \pi (k/T) t } \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so when you multiply $x(t)$ by $s(t)$ to sample it, you are multiplying by all of these sinusoids, with frequencies of $k/T$ and that bumps up your original baseband spectrum from something centered at DC to something centered at $k/T$.  and then it adds it all up.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-01-08T17:45:29.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13658" PostTypeId="1" CreationDate="2014-01-08T17:56:51.050" Score="2" ViewCount="527" Body="&lt;p&gt;I am relatively new to DSP and have been reading a lot on the internet. I have a couple of questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal in the form of a function &#xA;$$&#xA;f(x) = A_0 + A_1 \cos(\omega_1 x) + A_2 \cos(\omega_2 x)+...+ A_n \cos(\omega_n x). &#xA;$$&#xA;I have $f(x)$ and I know the minimum and maximum frequencies. $f(x)$ can have really high frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) I need to find the amplitude $A_p$ of a particular frequency $\omega_p$ in $f(x)$. One way to do this is, I could get sample points from $f(x)$ sampling at greater than Nyquist rate and do an FFT and find the amplitude. But if $f(x)$ has really high frequencies, the sampling would take most of the time. If i am interested only in estimating the amplitude $A_p$, is there another way, a faster way, of doing this. In the best case, I would like to estimate $A_p$ to within 0.5 of its actual value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;b)If I want $A_0$, the DC component, I can compute the average of $f(x)$ but with high frequencies in $f(x)$ that would mean high sampling rates. Any other faster way of doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c)The FFT takes $O(n\log(n))$ if $n$ is the size of the input and returns the magnitudes for $n$ different frequencies. If we are only interested in one particular frequency we should be able to alter the source code so that it would take only $O(\log(n))$, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for answering!&lt;/p&gt;&#xA;" OwnerUserId="7502" LastEditorUserId="80" LastEditDate="2014-01-08T18:15:08.833" LastActivityDate="2014-01-08T18:20:08.010" Title="Estimating the amplitude of a particular frequency" Tags="|frequency-spectrum|frequency|estimation|dsp-core|amplitude|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13659" PostTypeId="2" ParentId="13658" CreationDate="2014-01-08T18:19:31.790" Score="3" Body="&lt;p&gt;Maybe you have a look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow&quot;&gt;Goertzels Algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-08T18:19:31.790" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13660" PostTypeId="2" ParentId="13658" CreationDate="2014-01-08T18:20:08.010" Score="6" Body="&lt;p&gt;The usual way to estimate the amplitude of a particular frequency is to use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Goertzel algorithm.&lt;/a&gt;  There is a &lt;a href=&quot;http://www.embedded.com/design/real-world-applications/4401754/Single-tone-detection-with-the-Goertzel-algorithm&quot; rel=&quot;noreferrer&quot;&gt;good write-up by Rick Lyons here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though Rick's writeup is about single tone detection, it can be applied when multiple tones are present, too.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-01-08T18:20:08.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13663" PostTypeId="1" CreationDate="2014-01-08T22:22:19.883" Score="0" ViewCount="145" Body="&lt;p&gt;I have a 4096 sequence of FFT coefficient. All of which a real values. My sampling frequency is also 4096 samples per seconds. Now I want to make a plot. I know my Y axis would be my FFT magnitude values, but what would my x- axis be. Would it be my sampling frequency, that is 1,2,3,4.........4096?&lt;/p&gt;&#xA;" OwnerUserId="7271" LastActivityDate="2014-06-08T06:32:07.820" Title="FFT Plot Axis Confirmation" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13666" PostTypeId="2" ParentId="12636" CreationDate="2014-01-08T23:23:29.053" Score="1" Body="&lt;p&gt;Yes, you are missing something :) Although you have tried different wavelet families you should use the &lt;code&gt;GaborWavelet&lt;/code&gt;. I wrote this in &lt;code&gt;Mathematica&lt;/code&gt;, but you can do it in any environment you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cwd = ContinuousWaveletTransform[Table[4 Sin[2 Pi 15 t] + 2 Cos[2 Pi 48 t] +   &#xA;               RandomReal[{-.5, .5}], {t, 0, 5 \[Pi], .01}], GaborWavelet[]]&#xA;&#xA;WaveletScalogram[cwd, ColorFunction -&amp;gt; &quot;RoseColors&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gG1PG.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7477" LastActivityDate="2014-01-08T23:23:29.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13667" PostTypeId="1" AcceptedAnswerId="13673" CreationDate="2014-01-08T23:32:38.360" Score="2" ViewCount="12643" Body="&lt;p&gt;I have This image which is basically made of sloped lines (almost horizontal and parallel)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LmIJJ.png&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried exactly the code in &lt;a href=&quot;http://www.mathworks.de/de/help/images/ref/houghlines.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;matlab documentation&lt;/a&gt; to detect those lines (except the rotation part) but I got a very strange result (vertical lines detected and no single horizontal line!):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iMnGB.png&quot; alt=&quot;the output of houghlines&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really can't find explanation of this output. I tried the same code on a different image and it was ok. I tried to change all the possible parameters in &lt;code&gt;houghlines&lt;/code&gt; and &lt;code&gt;houghpeaks&lt;/code&gt; but I always get vertical lines even though my image has no vertical lines or anything similar to be vertical!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to detect the parallel lines in the image or somehow get their slope. If you think there's something wrong in my image or additional modification I should do to the example code. or if you have any better idea that would be great!&lt;/p&gt;&#xA;" OwnerUserId="7470" LastActivityDate="2018-07-11T01:37:15.470" Title="Detecting lines with houghlines in matlab" Tags="|image-processing|matlab|hough-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13668" PostTypeId="1" AcceptedAnswerId="13679" CreationDate="2014-01-09T00:09:31.320" Score="-2" ViewCount="267" Body="&lt;p&gt;I am working on Speckle Noise reduction in Ultrasound Images using MATLAB R2013. I have designed 10 basic filters and trying out hybrid combination using these filters. When I run my program I get different results at different time for the same input image, no other input parameters were changed. When I ran my program at 1.17 am, I got the PSNR = 74.5424 and when I ran the same program at 1.21 am, I got PSNR = 75.04. Why this is happening ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is coming different values at every time I run my program, how could I conclude on a single value ? Please help. I have attached the screenshot below, see the values of SNR, PSNR, Beta and Speckle Index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1sZtA.jpg&quot; alt=&quot;problem with my program&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="7092" LastEditDate="2020-03-28T13:24:24.240" LastActivityDate="2020-03-28T13:24:24.240" Title="Getting different results when running my program at different times" Tags="|image-processing|matlab|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="5" ClosedDate="2014-01-12T18:20:52.967" ContentLicense="CC BY-SA 3.0" />
  <row Id="13669" PostTypeId="2" ParentId="6084" CreationDate="2014-01-09T01:32:54.610" Score="1" Body="&lt;p&gt;The difference of gaussian (DOG) is the convolution of input image by difference of two gaussians usually with different standard devitations($\sigma$). The basic idea behind this is to capture edges or gradients in the images that are simplified by the gaussian with larger $\sigma$  but preserved by the smaller gaussian. This is form of scale space derivative, which basically analyses different frequency components in the image, by changing the $\sigma$s  of gaussians. Thus, its like a band-pass filter that rejects certain frequencies in the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we consider an constant image with its value centered around the means of the gaussians, the result of the DOG would be a zero - indicating no gradient.Try &lt;a href=&quot;http://softwarebydefault.com/2013/05/18/difference-of-gaussians/&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; out for a basic tutorial.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastActivityDate="2014-01-09T01:32:54.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13670" PostTypeId="2" ParentId="12721" CreationDate="2014-01-09T01:41:56.660" Score="1" Body="&lt;p&gt;The cross shape that i see in this example seems to remain more or less orthogonal. Maybe using a houghlines transformation with a piecewise flexibility might provide more true positives, but this also increases the false positives. In this case a corner detector might also be a goodidea, thus providing a set of interest points to search from and eliminate. The problem again there would be the large number of false positives. Try this &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.94.890&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;morphological corner detector (&lt;em&gt;Robert Laganiere (1998): &quot;Morphological Corner Detection&quot;&lt;/em&gt;)&lt;/a&gt; - its simple and structural. The problem in such cases is classifying your background on which the cross falls to help improve with the false positives!&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="1273" LastEditDate="2014-01-09T10:43:57.870" LastActivityDate="2014-01-09T10:43:57.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13671" PostTypeId="2" ParentId="12908" CreationDate="2014-01-09T02:05:27.057" Score="0" Body="&lt;p&gt;After a long time checking my code, I found the root cause of my problem, a misunderstanding of tree depth. I was counting the root of the node as a level hence when setting depth as 6 I was expecting to obtain 1M words but I could have just obtained at most 100K.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far in the best run using the full dataset I obtained 997.228 words, a more reasonable number than before considering there is no guarantee on obtaining full vocabulary size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side comment I tried removing the too close descriptors termination condtion but the performance decreased, indicating it might lead to a more discriminative vocabulary.&lt;/p&gt;&#xA;" OwnerUserId="4373" LastActivityDate="2014-01-09T02:05:27.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13672" PostTypeId="2" ParentId="13638" CreationDate="2014-01-09T02:56:18.187" Score="1" Body="&lt;p&gt;This is a book that I would recommend as a starting point: &lt;a href=&quot;http://szeliski.org/Book/drafts/SzeliskiBook_20100903_draft.pdf&quot; rel=&quot;nofollow&quot;&gt;Richard Szeliski: &lt;em&gt;Computer Vision: Algorithms and Applications&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="1273" LastEditDate="2014-01-10T13:43:28.567" LastActivityDate="2014-01-10T13:43:28.567" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13673" PostTypeId="2" ParentId="13667" CreationDate="2014-01-09T03:10:57.427" Score="4" Body="&lt;p&gt;The biggest issue is that the pixels for each line are too few (I will explain with more details below). I would consider to stretch, and then dilate your raw image a little bit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;file='https://i.stack.imgur.com/LmIJJ.png';&#xA;I=imread(file);&#xA;I=imcrop(I,[1 206 size(I,2) size(I,1)]);&#xA;I=imresize(I,[size(I,1) 256]);&#xA;I=imdilate(I,strel('line',1,0));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I assume you are using the sample code from Mathworks on &lt;code&gt;hough&lt;/code&gt;, &lt;code&gt;houghlines&lt;/code&gt;, and &lt;code&gt;houghpeaks&lt;/code&gt;. The problem is that there are not very many pixels along one slope in your image. You feel like it is a line, but it is actually a curve that consists of many short lines with different orientation. I think one parameter that you need to tune is the &lt;code&gt;'FillGap'&lt;/code&gt; which will connect the very short segments. I tried:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;lines = houghlines(BW,T,R,P,'FillGap',30,'MinLength',15);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And the image I obtained:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wmw4U.jpg&quot; alt=&quot;Hough Peaks&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TAs3j.jpg&quot; alt=&quot;Hough Lines&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is still plenty of room for improvement, yet at least most lines are detected.&lt;/p&gt;&#xA;&lt;p&gt;Note that the theta-axis in hough peaks indicates the slopes of the lines, you may also check them from &lt;code&gt;lines&lt;/code&gt;, &lt;code&gt;T&lt;/code&gt;, and &lt;code&gt;R&lt;/code&gt;. But since the image has already been stretched along the 2nd dimension of raw data, you may need to scale them back (with some tangent transformations) if you plan to get the slopes of those detected lines.&lt;/p&gt;&#xA;&lt;p&gt;Hope it helps, thank you.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-01-09T03:10:57.427" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13674" PostTypeId="2" ParentId="13663" CreationDate="2014-01-09T03:58:46.233" Score="1" Body="&lt;p&gt;Here's a short snippet of code that returns the domain of the FFT depending on if you have the onesided or twosided FFT. This is from some code I posted on a somewhat related question &lt;a href=&quot;https://dsp.stackexchange.com/questions/13075/re-implementing-the-spectrogram-function-from-matlab/13077#13077&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Nfft - FFT size&#xA;% Fs - Sampling frequency in Hz&#xA;% oneside - flag indicating FFT results will be onesided or two sided&#xA;&#xA;% Compute the frequency vector&#xA;if oneside == true&#xA;  f = fs * (0:Nfft/2).'./Nfft;&#xA;else&#xA;  f = fs * (-Nfft/2:Nfft/2-1).'./Nfft;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-01-09T03:58:46.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13675" PostTypeId="1" AcceptedAnswerId="13676" CreationDate="2014-01-09T04:58:26.567" Score="0" ViewCount="473" Body="&lt;p&gt;I am working on an implementation in which I need to apply an FFT to determine which of 4 frequencies are present in a signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing a 64 point FFT on a buffer which only is partly filled (the remainder of the buffer is zero-ed). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When looking at the screenshots of the signal in the time domain, you will notice that the signal is roughly the same in each screenshot, but it has different phase in each screenshot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4okie.png&quot; alt=&quot;signal in time domain - first screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DKXk5.png&quot; alt=&quot;signal in time domain - second screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When looking at the screenshots of the FFT of the two versions of the signal, you will notice that the magnitude for bin 4, which corresponds to the signal frequency, is 874.83 in one of the screenshots but 366.94 in the other, even though the only difference between the two versions of the signal is a phase difference (?) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9yZbo.png&quot; alt=&quot;FFT of signal in first screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kixWQ.png&quot; alt=&quot;FFT of signal in second screenshot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understands why this happens and how to deal with this. I am generating the signal myself and want to make sure that phase doesn't play a role here. When the signals are more or less the same in amplitude, I would expect their magnitude after calculating the FFT to stay the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you need this information, the sampling frequency is 7800 Hz and the actual frequency involved is 487.5 Hz which is exactly 7800/64*4, or the start of bin 4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the screenshots of the FFT, the magnitude data is plotted upside down (i.e. zero is the top of the screenshot). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please shed some light on this? Thanks for helping!&#xA;B&lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2014-01-09T05:42:26.683" Title="Change of bin magnitude when phase of signal changes when doing FFT?" Tags="|fft|signal-analysis|dft|phase|magnitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13676" PostTypeId="2" ParentId="13675" CreationDate="2014-01-09T05:42:26.683" Score="3" Body="&lt;p&gt;The FFT magnitude, for non-zero sinusoidal-like signals, will only be the same, given a change in phase relative to the window, for signals that are exactly periodic in the window width (the non-zero padded portion of the FFT aperture).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-09T05:42:26.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13677" PostTypeId="2" ParentId="12721" CreationDate="2014-01-09T11:03:41.360" Score="0" Body="&lt;p&gt;I guess you have 2 lasers and trying to extract the position.&#xA;In this case, it won't be a good idea to rely on lines. If you are using for example red lasers, you better decorate the camera with a red filter, so that the rest of the content will not appear that much in the camera. Also, if you are working in let's say an outdoors environment, you might try to use a powerful laser (which might do some harm to the ideas, watch out).&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-09T11:03:41.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13679" PostTypeId="2" ParentId="13668" CreationDate="2014-01-09T14:11:24.557" Score="8" Body="&lt;p&gt;&lt;code&gt;imnoise&lt;/code&gt; for speckle noise adding is not deterministic. I would suggest you save the noise image after imnoise by calculate the difference between the noise added image and the raw clean image. When you test other filters and want to make a comparison, directly add the noise image to the raw image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can repeat the filter experiment many times (each time use imnoise) and get an average of PSNR, SNR, and Beta.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-09T14:11:24.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13680" PostTypeId="1" AcceptedAnswerId="13681" CreationDate="2014-01-09T16:30:27.997" Score="3" ViewCount="419" Body="&lt;p&gt;I've just learned about linear systems and impulse response functions. I know that in a linear system consisting of $h_1[k]$ and $h_2[k]$, the impulse response of the system is $h_1[k] \ast h_2[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an exercise I was given the following system responses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;h_1(0) &amp;amp;= a \\&#xA;h_1(1) &amp;amp;= b \\&#xA;h_2(0) &amp;amp;= c \\&#xA;h_2(1) &amp;amp;= d \\&#xA;h_1(n) = h_2(n) &amp;amp;= 0 \; \text{otherwise} \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question was whether it would be possible to construct the parameters $a$, $b$, $c$, and $d$ in such a way that the linear system $h_1 \ast h_2$ would result in a &lt;strong&gt;moving average of the order 3&lt;/strong&gt; being applied to the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, I started with the convolution $h[k] = h_1[k] \ast h_2[k]$ for $k = 0, 1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;h[k] = [ac, bc + ad, bd]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that for a moving average of order 3, the required convolution kernel would look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;[1/3, 1/3, 1/3]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that means I have to solve the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;ac &amp;amp;= 1/3 \\&#xA;bc + ad &amp;amp;= 1/3 \\&#xA;bd &amp;amp;= 1/3 \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that's where I'm stuck. From my guts I'd say it's not possible to get to an answer here, because even if $a = 1$ and $b = 1$, $c$ and $d$ would have to be $1/3$ &lt;em&gt;and&lt;/em&gt; $c + d$ would have to be $1/3$ as well. Which isn't solvable.&lt;/p&gt;&#xA;" OwnerUserId="7511" LastEditorUserId="7092" LastEditDate="2020-03-28T13:26:09.813" LastActivityDate="2020-03-28T13:27:17.293" Title="Can I construct a linear system so that it results in a moving average?" Tags="|discrete-signals|signal-analysis|convolution|linear-systems|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13681" PostTypeId="2" ParentId="13680" CreationDate="2014-01-09T16:36:34.277" Score="4" Body="&lt;p&gt;The function you are trying to solve is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{b}{3 \cdot a} + \frac{a}{3 \cdot b}=\frac{1}{3}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also&#xA;&lt;span class=&quot;math-container&quot;&gt;$a^2-ab+b^2=0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but this function does not have a real number solution. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2020-03-28T13:27:17.293" LastActivityDate="2020-03-28T13:27:17.293" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13682" PostTypeId="2" ParentId="13015" CreationDate="2014-01-09T18:17:29.323" Score="3" Body="&lt;p&gt;If you have your sensing matrix &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; and your representation matrix &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; you just need to calculate&lt;img src=&quot;https://i.stack.imgur.com/qPLHW.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; is your incoherence property and &lt;em&gt;n&lt;/em&gt; is the number of elements in the signal.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; is you Fourier matrix and &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is your sensing matrix (your A matrix). In matlab you can just calculate the maximum inner product from the n-length vectors of &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; and mutliply by &lt;span class=&quot;math-container&quot;&gt;$\sqrt n$&lt;/span&gt; to get your incoherence value. Than check it against [1,&lt;span class=&quot;math-container&quot;&gt;$\sqrt n$&lt;/span&gt;] where low incoherence is &amp;quot;good&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-01-09T18:17:29.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13683" PostTypeId="1" CreationDate="2014-01-09T18:49:36.417" Score="2" ViewCount="98" Body="&lt;p&gt;When I select a part of an image and apply a negative function to it, it works 100%:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/XJ1Nn.png&quot; alt=&quot;figure1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3X07z.png&quot; alt=&quot;figure1 code&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When trying to apply the same method using another function, the part of image becomes black:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LZ9T3.png&quot; alt=&quot;figure2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nO1s8.png&quot; alt=&quot;figure2 code&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the problem and how can I fix it?&lt;/p&gt;&#xA;" OwnerUserId="7472" LastEditorUserId="76" LastEditDate="2014-01-10T03:26:40.503" LastActivityDate="2014-04-10T09:45:42.617" Title="Why does part of my image turn black when applying functions to a part of an image in Matlab?" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13685" PostTypeId="1" CreationDate="2014-01-09T20:20:05.423" Score="0" ViewCount="70" Body="&lt;p&gt;I am sampling two sinusoidal analogue signals that are phase separated by $\frac{2\pi}{3}$, and there appears to be a significant amount of common mode noise in my samples. What, if any approach can I take to improve my SNR?&lt;/p&gt;&#xA;" OwnerUserId="7513" LastEditorUserId="1273" LastEditDate="2014-01-09T23:02:14.307" LastActivityDate="2014-01-10T15:03:00.930" Title="Common mode noise from two ADC results" Tags="|discrete-signals|noise|signal-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13686" PostTypeId="1" CreationDate="2014-01-09T21:18:05.037" Score="0" ViewCount="111" Body="&lt;p&gt;This question is in two parts, both related in some way or another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a signal where the sample rate is 44100 and compute a normal 1D DFT on this signal. The size of this signal is 220500. I need to compute the Hertz for the outputted DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculate the bins using the formula below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sqrt(output[i].re * output[i]. re + output[i].im * output[i].im)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then find the maximum number in this vector and compute the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freq = max * 44100 / fft.size() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This then gives me a result of: 4526.84 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know, something seems to be wrong here, the duration of the file is &lt;code&gt;0:05&lt;/code&gt; is this result expected or unexpected? I'm sure I need to take into account the number of seconds, but I was lead to believe that the resulting answer should be that of the sample rate (44100) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's suppose I've computed a STFT of this signal of size 256 with an overlap of 128, let's suppose I want to calculate the frequency of each of these segments, or, parts, since this will now effectively be a 2D vector. Do I therefore need to calculate this using the formula above, where the FFT size in this case will infact be 256. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated :) &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-02-08T22:21:24.447" Title="Understanding Hertz" Tags="|fft|frequency|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13687" PostTypeId="2" ParentId="10867" CreationDate="2014-01-09T21:26:37.210" Score="1" Body="&lt;p&gt;yes - a video signal would be considered 3rd order tensor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;scalars are 0-order tensors, vectors are 1st order tensors, matrices are 2nd order tensor,  data volumes are 3rd order tensors and so on for multi-dimensional arrays.&lt;/p&gt;&#xA;" OwnerUserId="4038" LastActivityDate="2014-01-09T21:26:37.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13688" PostTypeId="2" ParentId="13686" CreationDate="2014-01-09T21:38:33.600" Score="1" Body="&lt;p&gt;Your calculation of the frequency of a given bin is correct:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Freq = \frac{binNumber}{numberOfBins}F_s&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that the problem is that you are setting the bin number to the maximum bin power instead of the index of the bin with the maximum power.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-01-09T21:38:33.600" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="13689" PostTypeId="1" CreationDate="2014-01-09T22:49:01.890" Score="0" ViewCount="113" Body="&lt;p&gt;Could you tell me why wavelets without scaling functions can't be used for two-dimensional analysis? What is the role of scaling function?&lt;/p&gt;&#xA;" OwnerUserId="7515" LastEditorUserId="7092" LastEditDate="2014-01-10T01:23:18.623" LastActivityDate="2014-05-10T04:29:46.383" Title="Two-dimensional wavelet analysis" Tags="|signal-analysis|wavelet|2d|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13690" PostTypeId="2" ParentId="13680" CreationDate="2014-01-09T23:01:39.777" Score="2" Body="&lt;p&gt;The gain of the desired moving average filter is not important; you can stick&#xA;it after you have done the important work, if you like.   What&#xA;you are asking is whether $G(z)H(z) = (a +bz^{-1})(c + dz^{-1})$ can&#xA;equal $(1 + z^{-1} + z^{-2})$. Unfortunately, the roots of $1+z^{-1}+z^{-2}$ are the two complex cube roots of unity,  that is,&#xA;$$ 1 + z^{-1} + z^{-2} = \left(1+e^{j2\pi/3}z^{-1}\right)\left(1+e^{j4\pi/3}z^{-1}\right)$$and so the only way this is going&#xA;to work is if we allow the coefficients to be complex numbers. &lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-01-10T03:24:16.070" LastActivityDate="2014-01-10T03:24:16.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13691" PostTypeId="5" CreationDate="2014-01-09T23:11:42.640" Score="0" Body="&lt;p&gt;Asking for official sources, e.g. books, scientific articles or other similar literature that can be used to back up your statements or methods. Usually used to write a scientific or other official documentation about the approach or method used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;books&lt;/li&gt;&#xA;&lt;li&gt;journal articles&lt;/li&gt;&#xA;&lt;li&gt;conference proceedings&lt;/li&gt;&#xA;&lt;li&gt;thesis manuscripts&lt;/li&gt;&#xA;&lt;li&gt;manuals for various tools&lt;/li&gt;&#xA;&lt;li&gt;links and affiliations of important databases (e.g. for image processing)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="1273" LastEditDate="2014-01-10T13:39:02.253" LastActivityDate="2014-01-10T13:39:02.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13692" PostTypeId="4" CreationDate="2014-01-09T23:11:42.640" Score="0" Body="Asking for official sources, e.g. books, scientific articles or other similar literature that can be used to back up your statements or methods." OwnerUserId="1273" LastEditorUserId="1273" LastEditDate="2014-01-10T13:39:28.317" LastActivityDate="2014-01-10T13:39:28.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13693" PostTypeId="2" ParentId="13689" CreationDate="2014-01-09T23:39:31.127" Score="1" Body="&lt;p&gt;,,A wavelet'' actually is two functions that are orthogonal to each other. That way, a signal can be split into two parts. One part is the wavelet proper, while the other is usually called ,,scaling function'' (sometimes ,,mother wavelet'' as well). When you have just one of both, you can not perform a meaningful wavelet transform.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-09T23:39:31.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13694" PostTypeId="1" CreationDate="2014-01-10T01:24:29.747" Score="6" ViewCount="669" Body="&lt;p&gt;I have a large collection of oversampled images (family photos of varying 'sharpness' scanned at a uniformly high dpi) and would like to downsample them to optimise storage space whilst retaining detail within some reasonable threshold. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am hoping to find (or build) a tool that can help me identify what I (a confessed layman) would call the 'natural resolution' of the scanned image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example a 70 year old black &amp;amp; white 6x4&quot; print scanned at 600dpi might be downsampled to 253dpi and look 'sharp' (for some definition of sharp). The downsampled image might then be upsampled to 600dpi again with a deviation from the original that falls within an acceptable threshold. Downsampling the original to 252dpi then upsampling might result in too much deviation, therefore the tool may decide that 253dpi is the sweet spot for that image. Ideally the tool could determine the sweet spot without having to iteratively downsample and upsample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many complications (noise, dust, sharp edges that represent the edges of the photo instead of the photo itself) so the tool may require user supervision. At the moment I'm just looking for pointers as to what techniques and terms I should be familiarising myself with. I have put many hours into googling this issue but all results are either overly simple pc mag stuff (e.g. 'always scan at X dpi') or impenetrable research papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit (clarification, 2014-01-11)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paragraph above about downsampling then upsampling is just to illustrate my point about determining loss of detail. In my actual workflow I only intend to downsample (no subsequent upsample step). The goal is to find an algorthm that on a per-image basis will determine the lowest resolution I can downsample to without sacrificing image detail (or sacrificing within an acceptable limit).&lt;/p&gt;&#xA;" OwnerUserId="7518" LastEditorUserId="7518" LastEditDate="2014-01-11T06:14:09.623" LastActivityDate="2014-02-10T06:21:52.243" Title="Downsampling oversampled image (smallest size which retains image 'detail' within acceptable limits)" Tags="|image-processing|downsampling|resampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13695" PostTypeId="2" ParentId="13694" CreationDate="2014-01-10T04:19:16.597" Score="3" Body="&lt;p&gt;There are many &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_scaling&quot; rel=&quot;nofollow noreferrer&quot;&gt;options&lt;/a&gt; yet it is highly dependent on the properties of the image being resampled.  Images downsampled with &lt;a href=&quot;http://en.wikipedia.org/wiki/Bicubic_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;bicubic interpolation&lt;/a&gt; are regarded as smoother and with fewer interpolation artifacts. You may also try &lt;a href=&quot;http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;nearest neighbor interpolation&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;bilinear interpolation&lt;/a&gt;. Make sure a low pass filter is applied before further processing with downsampling strategies, otherwise the &lt;a href=&quot;https://dsp.stackexchange.com/questions/13193/create-an-aliased-image-in-fd/13556#13556&quot;&gt;aliasing&lt;/a&gt; artifacts may be induced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides, you may also consider &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/kopf/pixelart/paper/pixel.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;vectorization algorithm&lt;/a&gt;  in which a resolution independent vector representation is created before rendered to the image at a desired resolution. it is mainly used in up-sampling but the vectorization method is helpful in preserving the feature connectivity in down-sampling as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another interesting &lt;a href=&quot;http://www.codinghorror.com/blog/2007/07/better-image-resizing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog&lt;/a&gt; on comparison between different image re-size approaches.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the design of low pass filter served as a pre-processing method before downsampling, you can consider this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose a low pass filter $g$ works on the image $x$, and the filtered image is $u = x*g$. After that, simply decimate $u$ by 2, you get $v$. Now you want to recover the original image. You can zero-upsample the $v$ into $w$ where $w_{2n} = v_{n}$, and $w_{2n-1} = 0$. Then another filter $h$ is applied, trying to obtain $\hat{x} = w * h$. After Z-transform, $U(z) = X(z)G(z)$, $\hat{X}(z) = W(z)H(z)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $W(z) = 1/2(U(z) + U(-z))$, we have $\hat{X}(z)=1/2(H(z)G(z))X(z) + 1/2(H(z)G(-z))X(-z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good downsampling is equivalent to a good recovery to some extent. In order to best recover the original image ($\hat{X}(z)=X(z)$), you are trying to make $H(z)G(z)$ as close to $2$ as possible, while $H(z)G(-z)$ as close to $0$ as possible. The design of low pass filter $G(z)$ is based on this criteria. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-01-10T05:18:43.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13696" PostTypeId="1" CreationDate="2014-01-10T09:05:58.350" Score="0" ViewCount="517" Body="&lt;p&gt;Thanks for your time to read my question first. I’m new about audio, but I have to make this done:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add a few bytes of data to a sound file and generate a new sound file.&lt;/li&gt;&#xA;&lt;li&gt;If I convert that file to any sound format, these bytes data should still there.&lt;/li&gt;&#xA;&lt;li&gt;When I play that file anywhere, I pick up the sound with mobile phone microphone and got these bytes back.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have searched some informations:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It's like &quot;Audio Watermark&quot;&lt;/li&gt;&#xA;&lt;li&gt;A study : &lt;a href=&quot;http://www.ijstr.org/final-print/july2012/Hiding-Text-In-Audio-Using-Multiple-LSB-Steganography-And-Provide-Security-Using-Cryptography.pdf&quot; rel=&quot;nofollow&quot;&gt;HIDING TEXT IN AUDIO USING MULTIPLE LSB STEGANOGRAPHY AND PROVIDE SECURITY USING CRYPTOGRAPHY&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;This &lt;a href=&quot;http://www.youtube.com/watch?v=Bnb_9CASMpo&quot; rel=&quot;nofollow&quot;&gt;video&lt;/a&gt; is what I want, but I'm still not clear how to do that. Could you please give me some suggestion about that?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for any help you might be able to provide.&lt;/p&gt;&#xA;" OwnerUserId="7519" LastEditorUserId="7092" LastEditDate="2014-01-10T13:39:23.880" LastActivityDate="2014-04-18T19:22:43.350" Title="Hide text in audio and got text by phone microphone when the audio is plaid anywhere" Tags="|audio|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13697" PostTypeId="1" CreationDate="2014-01-10T10:53:38.573" Score="3" ViewCount="7394" Body="&lt;p&gt;I can understand just fine how to use 1-dimensional interpolation on data points where one coordinate is a function of the other: &lt;code&gt;y = f(x)&lt;/code&gt;. However, when we have an image, we generally have points in the image that are not given uniquely by such a function, e.g. two points &lt;code&gt;(x1,y1)&lt;/code&gt; and &lt;code&gt;(x1,y2)&lt;/code&gt;, so how do we describe this in order to interpolate between points in the image?&lt;/p&gt;&#xA;" OwnerUserId="1464" LastEditorUserId="7092" LastEditDate="2020-03-29T14:18:18.637" LastActivityDate="2020-03-29T14:18:18.637" Title="How do you interpolate between points in an image (2D), e.g. using splines?" Tags="|discrete-signals|image-processing|interpolation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13698" PostTypeId="1" CreationDate="2014-01-10T12:48:47.833" Score="1" ViewCount="1717" Body="&lt;p&gt;I want to apply a &lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/matlabfns/FrequencyFilt/homomorphic.m&quot; rel=&quot;nofollow&quot;&gt;homomorphic process&lt;/a&gt; to an image, and one of the steps involves the &lt;code&gt;imadjust&lt;/code&gt; function. The source of this code is &lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/matlabfns/&quot; rel=&quot;nofollow&quot;&gt;http://www.csse.uwa.edu.au/~pk/research/matlabfns/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the steps in the homomorphic process is the &lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/matlabfns/GreyTrans/histtruncate.m&quot; rel=&quot;nofollow&quot;&gt;histogram truncation&lt;/a&gt;. This is where toward the end, &lt;code&gt;imadjust&lt;/code&gt; is applied like this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;newim = imadjust(im,gv,[0 1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately Octave doesn't seem to have this function, so I'm guessing it's a Matlab Image Processing Toolkit function. Is there a way to replace it? I haven't managed to find one that uses just two arguments, in addition to the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this &lt;a href=&quot;http://nesl.ee.ucla.edu/fw/chenni/Chenni_desktop/Documents/gumstix_ubuntu/2.0%20GB%20Filesystem/usr/share/octave/packages/3.0/image-1.0.8/imadjust.m&quot; rel=&quot;nofollow&quot;&gt;imadjust.m&lt;/a&gt; but it has 4 arguments (image, in, out, and gamma)&#xA;Not sure how it's related to the one I'm using which is 3 arguments (image, gamma?/interpolated value, and two values array). &lt;/p&gt;&#xA;" OwnerUserId="4618" LastEditorUserId="76" LastEditDate="2014-01-12T17:16:40.180" LastActivityDate="2014-03-14T00:16:55.790" Title="Is imadjust a Matlab-only library? If so, can it be replaced?" Tags="|image-processing|octave|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13699" PostTypeId="2" ParentId="13697" CreationDate="2014-01-10T12:57:59.560" Score="5" Body="&lt;p&gt;There are various methods on 2d interpolation (&lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_interpolation&quot;&gt;this one&lt;/a&gt;, and &lt;a href=&quot;http://www.mathworks.com/help/symbolic/mupad_ref/numeric-cubicspline2d.html&quot;&gt;this one&lt;/a&gt;). But most of them considered at least 4 points rather than 2. The simplest 2d interpolation is 3 1d interpolation, in which you interpolate the points between &lt;code&gt;(x1-d1, y1-d2)&lt;/code&gt; and &lt;code&gt;(x1+d1, y1-d2)&lt;/code&gt; as &lt;code&gt;(x2,y2)&lt;/code&gt;, then you interpolate the points between &lt;code&gt;(x1-d3, y1+d4)&lt;/code&gt; and &lt;code&gt;(x1+d3, y1+d4)&lt;/code&gt; as &lt;code&gt;(x3,y3)&lt;/code&gt;. Finally &lt;code&gt;(x1,y1)&lt;/code&gt; is obtained by 1d interpolation of &lt;code&gt;(x2,y2)&lt;/code&gt; and &lt;code&gt;(x3,y3)&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-10T12:57:59.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13700" PostTypeId="2" ParentId="13698" CreationDate="2014-01-10T13:09:54.290" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;http://www.mathworks.com/help/images/ref/imadjust.html&quot; rel=&quot;nofollow&quot;&gt;imadjust&lt;/a&gt; in Matlab includes 4 arguments as well. You always need to specify the shape of the curve (&lt;code&gt;gamma&lt;/code&gt;), and map the values in &lt;code&gt;I&lt;/code&gt; to new values in &lt;code&gt;J&lt;/code&gt; such that values between &lt;code&gt;low_in&lt;/code&gt; and &lt;code&gt;high_in&lt;/code&gt; map to values between &lt;code&gt;low_out&lt;/code&gt; and &lt;code&gt;high_out&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try the link you found yourself, or try &lt;a href=&quot;http://www4.hcmut.edu.vn/~huynhqlinh/TinhocDC/WebLQNguyen/matlab/tai%20lieu/MATLAB6_COURSE/WORK/IMAGES/IMAGES/IMADJUST.M&quot; rel=&quot;nofollow&quot;&gt;this version&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-10T13:09:54.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13702" PostTypeId="1" AcceptedAnswerId="13705" CreationDate="2014-01-10T14:36:52.560" Score="0" ViewCount="53" Body="&lt;p&gt;When someone says apply gaussian kernel, is that the same thing as saying, convolve it with a gaussian mask? &lt;/p&gt;&#xA;" OwnerUserId="4618" LastActivityDate="2014-01-10T14:59:53.407" Title="Is applying a gaussian kernel a fancy way of saying convolving with a gaussian mask?" Tags="|terminology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13703" PostTypeId="1" CreationDate="2014-01-10T14:54:13.727" Score="1" ViewCount="3587" Body="&lt;p&gt;I am simulating (in Matlab) the transmit portion of a comm system.  I generate random data, then I want to modulate it to BPSK, pulse shape the data, and then potentially shift it up in frequency by a carrier.  My question is regarding the pulse shaping portion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Atleast in matlab, to generate the root raised cosine filter using the &lt;strong&gt;rcosdesign&lt;/strong&gt; function, you need to know the roll-off factor  ($\beta$) , as well as the samples-per-symbol ($sps$) and the filter span ($span$).  The samples per symbol will be dictated by the sampling frequency $f_s$ as well as the desired length of the generated signal with a certain datarate $R$.  For example, if I have a BPSK signal with a sampling frequency of 8192 Hz, and I want to generate 1 second of data at a datarate of 256 Hz, then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;sps = f_s/R&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we've established 2 of the inputs to creating the filter are set, the rolloff factor $\beta$ and the samples per symbol, $sps$.  Now, my understanding is that the filter span is kind of arbitrary.  I know that a longer filter span creates a longer group delay, but what are the other tradeoffs to having a longer filter span versus shorter?&lt;/p&gt;&#xA;" OwnerUserId="7323" LastActivityDate="2015-04-23T21:58:50.053" Title="SRRC filter -- filter span tradeoffs" Tags="|filters|impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13705" PostTypeId="2" ParentId="13702" CreationDate="2014-01-10T14:59:53.407" Score="3" Body="&lt;p&gt;Yes. Convolution in spatial domain, or dot product in frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-10T14:59:53.407" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13707" PostTypeId="1" CreationDate="2014-01-10T15:34:15.207" Score="0" ViewCount="159" Body="&lt;p&gt;Some background: I am putting a sig-gen signal through an ADC, into an FPGA where I can modify it, out a DAC and up to a SpecAn.  All that works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am experimenting with fractional delay filters, coefficients, and IF values (which are just my sine wave coming in for testing).  I sample at 200MHz, and I have played with IFs of 25MHz, 50MHz, 66.667MHz and other in between.  What I do on the FPGA is take the inputted signal, and sum it with a delayed copy of a signal (think multipath).  The delay is being varied by using a fractional delay filter to create the copy (either 3 coefficients or 7 right now; all the below is for 7 coefficients).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what is the relationship between the number of coefficients I use, and the frequency of the IF?  I think I am missing something fundamental (and probably easy), but I can't see what.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot of the summations of the 25MHz signal with 7 coefficients on the fractional delay.  The y-axis is the signal level (dBm) and the x-axis is the amount of delay.  I stepped from 0 clock delay to 12 clocks (60ns) in 0.4 clock increments (2ns).  You can see the in-phase additions at clocks delays 0 and 8, and the out of phase cancellations at 4 and 12 clock delays.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/CJqLq.png&quot; alt=&quot;25MHz IF, 7 fractional delay coefficients&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next is the same sort of plot, but the IF is 66.667MHz and I go from 0 clock delays to 3 clocks delays (15ns) in 0.1 clock (0.5ns) increments.  Here we should be in-phase at 0 and 3 clocks delays, and out of phase at 1.5.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DGUw5.png&quot; alt=&quot;66.667MHz IF, 7 fractional delay coefficients&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can see in the second plot is that there seems to be a lag in the prediction.  I actually have peaks just after where I would expect to see them (delays 0 and presumably 3), and my out-of-phase signal seems to appear after where I would expect it as well (1.5 clocks).  There also appears to be more unevenness and the signal isn't as steady as the first plot (which was nearly as perfect and smooth as I could expect).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that the faster IF is going to be harder to predict, but I feel like there is a relationship that I am missing between the IF, fractional delay coefficients, and maybe even sample rate.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone enlighten me?&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2014-01-10T15:34:15.207" Title="Relationship between fractional delay coefficients and frequency?" Tags="|filter-design|continuous-signals|filtering|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13709" PostTypeId="2" ParentId="13667" CreationDate="2014-01-10T17:08:36.780" Score="2" Body="&lt;p&gt;Another answer from my comments (I would prefer to re-answer rather than edit the solution 1):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imrotate(I, theta,'loose');  % theta ranges from 0 to 180&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then use &lt;code&gt;imfilter(I,f);&lt;/code&gt; where you may have 4 choice for &lt;code&gt;f&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f=[-1 -1 -1; 2 2 2;-1 -1 -1]; % horizontal line&#xA;f=[-1 2 -1;-1 2 -1;-1 2 -1]; % vertical&#xA;f=[-1 -1 2;-1 2 -1;2 -1 -1]; % 45 degree&#xA;f=[2 -1 -1;-1 2 -1;-1 -1 2]; % 135 degree&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-10T17:08:36.780" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13710" PostTypeId="2" ParentId="13697" CreationDate="2014-01-10T17:16:44.950" Score="4" Body="&lt;p&gt;the simplest interpolation method is nearest neighbour. If you have 4 points with values given by Ms the interpolated value is given by P = f(x,y):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P$\ = f(x,y)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;= M_11 if $\ |x-x_1|&amp;lt;= |x-x_2|$  and $\ |y-y_1|&amp;lt;= |y-y_2|$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;= M_12 if $\ |x-x_1|&amp;lt; |x-x_2|$  and $\ |y-y_2|&amp;lt; |y-y_1|$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;= M_21 if $\ |x-x_2|&amp;lt; |x-x_1|$  and $\ |y-y_1|&amp;lt; |y-y_2|$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;= M_22 if $\ |x-x_2|&amp;lt; |x-x_1|$  and $\ |y-y_2|&amp;lt; |y-y_1|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method is bilinear interpolation. Given by:&lt;img src=&quot;https://i.stack.imgur.com/V9XXJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases the Ms stand for the values at each of 4 points. The x's and y's are coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presume that these methods work better when you have a uniform grid (i.e. your Ms are equally spaced apart). Fancier methods may be able to capture more complex data locations. For example kriging. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You asked about 2 point interpolation in a 2D space. Perhaps this occurs at the edges and part of the reason why you get edge effects. Others will be able to correct me on this. I hope this helps somehwat.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Ng541.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="4038" LastEditDate="2014-01-12T23:38:13.597" LastActivityDate="2014-01-12T23:38:13.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13711" PostTypeId="1" CreationDate="2014-01-11T00:28:15.913" Score="0" ViewCount="68" Body="&lt;p&gt;I have obtained &lt;a href=&quot;http://en.wikipedia.org/wiki/Earth_mover%27s_distance#Applications&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; from Wikipedia about the application of Earth Movers Distance to pattern recognition. Can anybody explain the concept of &lt;code&gt;signature&lt;/code&gt; used in this Wikipedia article. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2014-01-11T01:00:02.977" Title="What is Earth Movers Distance and how is it used in pattern recognition?" Tags="|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13712" PostTypeId="2" ParentId="13711" CreationDate="2014-01-11T01:00:02.977" Score="1" Body="&lt;p&gt;A set of clusters. Each cluster is represented by a pair with (1) one single point (usually the center in the cluster) ,and (2) a weight coefficient that usually in proportional to the size of the corresponding cluster. Note that the point can be anything including the coordinates of the pixel, the color information, intensity...etc.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-11T01:00:02.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13713" PostTypeId="1" CreationDate="2014-01-11T04:23:53.600" Score="0" ViewCount="1762" Body="&lt;p&gt;I am trying to implement a phase vocoder overlap-add pitch shifting algorithm for part of a plugin I'm writing.  I have done this kind of thing offline before and I understand the theory, but this is the first time I've attempted to do realtime processing. This seems to add extra difficulty.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my issue: the audio routing library I'm using gives me 1024 samples of audio at a time, and I must return 1024 samples of supposedly pitch-shifted audio each time.  I know that I can just use some kind of ring buffer or something to cache the samples needed for my overlap-add algorithm, but what do I return the very first time? That is, what do I do with the first 1024 samples of audio I'm given? It seems that with an overlap factor of 4, I would need at least 1792 (256*3 + 1024) samples before I could return my first 1024 samples, because of the overlap requirement.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doomed to just output silence the first go-round, until I get enough samples to actually start doing the algorithm? It doesn't seem ideal to delay the audio, even if only by a couple of milliseconds. I would like it to be sample accurate if at all possible, even if there's a slight drop in quality for the first few windows of data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7529" LastActivityDate="2014-01-11T04:23:53.600" Title="Sample accurate real-time pitch shifting algorithm" Tags="|fft|pitch|time-frequency|real-time|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13714" PostTypeId="2" ParentId="13313" CreationDate="2014-01-11T07:38:01.940" Score="0" Body="&lt;p&gt;There are some issues with the code.&#xA;1. There seems to be a problem number of taps used for frequency. For filtering 400Hz sine wave at samplerate 48KHz I get better results if I use tapslen more than 559. &#xA;2. ippsFIRGenBandstop apparently is implemented as band pass + band stop + band pass. By doing this IPP tends to add some ripple at the higher end (around 44,000 and above). See here:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SWdcO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using this filter it is recommended to use some kind of a FIR filter design tool like TFilter: &lt;a href=&quot;http://t-filter.appspot.com/fir/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://t-filter.appspot.com/fir/index.html&lt;/a&gt;&#xA;Or matlab FIR filter design toolbox.&lt;/p&gt;&#xA;" OwnerUserId="5846" LastActivityDate="2014-01-11T07:38:01.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13715" PostTypeId="2" ParentId="13119" CreationDate="2014-01-11T10:00:41.047" Score="-1" Body="&lt;p&gt;You might try to window the FFT so that you do not introduce harmonics. Then filtering in the FD might be easier.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-11T10:00:41.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13716" PostTypeId="1" AcceptedAnswerId="13717" CreationDate="2014-01-11T11:35:01.867" Score="1" ViewCount="1063" Body="&lt;p&gt;I know that 3 conditions must be met in order a pair of stochastic processes $X(t)$ and $Y(t)$ to be characterized as jointly &lt;strong&gt;WSS&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. $X(t)\;\; WSS$&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. $Y(t)\;\; WSS$&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. $R_{xy}(t_1,t_2) = R_{xy}(t_1 - t_2) = R_{xy}(t_2 - t_1)$&lt;/strong&gt; which means that their cross-correlation function should depend only on the difference $T = t_1 - t_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: if the first 2 conditions are met but the cross-correlation function does not depend on any variable (I mean that it's a constant e.g. $R_{xy}(t_1,t_2) = 0$) can we assume that the two stochastic processes $X(t)$ and $Y(t)$ are jointly &lt;strong&gt;WSS&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7001" LastEditorUserId="1212" LastEditDate="2017-01-26T07:46:01.753" LastActivityDate="2017-01-26T07:46:01.753" Title="A special case of 2 jointly Weak-Sense Stationary (WSS) stochastic processes" Tags="|cross-correlation|random-process|stationary|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13717" PostTypeId="2" ParentId="13716" CreationDate="2014-01-11T12:27:44.793" Score="0" Body="&lt;p&gt;Yes, when $R_{X,Y}(t_1, t_2) = E[X(t_1)Y(t_2)] = 0~ \forall ~t_1, t_2$, $\{X(t)\}$ and $\{Y(t)\}$&#xA;are often called &lt;em&gt;uncorrelated&lt;/em&gt; WSS processes,&#xA;and they are considered to be jointly WSS processes.  More nitpicky folks&#xA;agree that the processes are indeed jointly WSS when $R_{X,Y}(t_1, t_2) = 0~ \forall ~t_1, t_2$, but insist on reserving the adjective &lt;em&gt;uncorrelated&lt;/em&gt; &#xA;for processes for which the &lt;em&gt;cross-covariance&lt;/em&gt; function&lt;br&gt;&#xA;$$C_{X,Y}(t_1,t_2) = E\left[\left(X(t_1)-E[X(t_1)]\right)\left(Y(t_2)-E[Y(t_2]\right)\right] =E[X(t_1)Y(t_2)]-E[X(t_1)]E[Y(t_2)] = R_{X,Y}(t_1,t_2)-E[X(t_1)]E[Y(t_2)]$$&#xA;equals $0$ for all $t_1, t_2$, that is, &lt;em&gt;every&lt;/em&gt; pair of random variables $X(t_1)$, $Y(t_2)$ from the processes is a pair of uncorrelated random variables.  Of course, when at least one of the processes has zero mean&#xA;(as is usually the case in signal processing applications), then&#xA;$C_{X,Y}(t_1,t_2) = R_{X,Y}(t_1,t_2)$ and so the nit gets picked without&#xA;requiring any further consideration.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-01-11T12:27:44.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13718" PostTypeId="1" AcceptedAnswerId="13752" CreationDate="2014-01-11T01:03:46.380" Score="6" ViewCount="1324" Body="&lt;p&gt;We are using phase correlation to find pattern on image and what we get is 15% of results is spurious. Ours pattern has 32x32 pixels and image for research has 32x512 pixels. So we put Pattern to 32x512 pixels image to the left side and the rest of image is filled by zero pixels. Next we apply FFT to pattern and the image without applying a window function. &#xA;Then we make Hadamard product, normalized it and do inverse FFT of resulting matrix. &#xA;Sometimes we get false peak almost on the middle of plot where edge effects and circularity of correlation should be neglected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else could be the cause of false peak ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Images:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what was searched and what we got:&#xA;&lt;img src=&quot;https://lh4.googleusercontent.com/-cGXACcUUMkk/UtCX3iLtBxI/AAAAAAAAEbM/bBlPYuCE-GU/s811/two_towers.png&quot; alt=&quot;what was searched and what we got&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;real research image 32x512 (before greyscale)&#xA;&lt;img src=&quot;https://lh3.googleusercontent.com/-GQSrln7qnO8/UtCT8elB_FI/AAAAAAAAEaw/bh7aKyyMRIo/s512/subimage.png&quot; alt=&quot;research image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;real pattern in (in greyscale)&#xA;&lt;img src=&quot;https://lh5.googleusercontent.com/-YaDK_1QvqIQ/UtCT6-rNkNI/AAAAAAAAEao/41MOQJ_bXxU/s512/pattern_grey.png&quot; alt=&quot;real pattern&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;correlation result&#xA;&lt;img src=&quot;https://lh5.googleusercontent.com/-HT-w2spIQr0/UtCT80C9UtI/AAAAAAAAEa4/PeFJT3EmO5c/s1035/transformer_value.png&quot; alt=&quot;correlation result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best Regards&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dawid D&lt;/p&gt;&#xA;" OwnerUserId="7532" OwnerDisplayName="Dawid D" LastEditorUserId="7092" LastEditDate="2020-03-31T04:53:41.753" LastActivityDate="2020-03-31T04:53:41.753" Title="Ambiguous results of phase correlation in pattern recognition" Tags="|image-processing|signal-analysis|computer-vision|cross-correlation|template-matching|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13719" PostTypeId="1" AcceptedAnswerId="13734" CreationDate="2014-01-11T16:48:38.647" Score="0" ViewCount="456" Body="&lt;p&gt;My professor told me that in sampling a signal, is not usual to respect the Shannon theorem because the interpolation formula contains sines and fractions which are difficult to calculate with a microprocessor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is audio sampled at 44.1-48 KHz (Nyquist frequency of audio signals)? Is there a dedicated  hardware for accomplishing this? I can sample sound with my PC, so does this mean that I have this hardware in my PC?&lt;/p&gt;&#xA;" OwnerUserId="7534" LastEditorUserId="76" LastEditDate="2014-01-12T00:55:47.523" LastActivityDate="2014-01-12T10:23:39.630" Title="Why do we follow Shannon's Theorem in audio sampling?" Tags="|sound|nyquist|embedded-systems|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13720" PostTypeId="1" CreationDate="2014-01-11T17:47:08.813" Score="5" ViewCount="3962" Body="&lt;p&gt;Suppose that I need to apply a convolution filter to an image. I want to do it by using the convolution theorem so I compute the kernel for the size of the input image to later calculate fft's and multiply. But I want the fft calculation to be less time consuming. The kernel loses its magnitude the further from its center, as usual. If I want to crop it, say, have a smaller kernel with only significant values, can I for instance compute its fft and later somehow extend the resulting frequency domain image of the kernel to fit the size of the input image, to later multiply them point-wise?&lt;/p&gt;&#xA;" OwnerUserId="7440" LastEditorUserId="7092" LastEditDate="2014-02-10T19:33:49.463" LastActivityDate="2014-02-10T19:52:07.783" Title="Convolution theorem with a kernel smaller than the image" Tags="|image-processing|filters|filter-design|convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13722" PostTypeId="1" CreationDate="2014-01-11T18:12:39.880" Score="0" ViewCount="1012" Body="&lt;p&gt;Currently, I am developing a piece of software for chord recognition. There are FFT and pitch class profiling on it. I tried using the pitch class profile proposed by Takuya Fujishima, but the result is not quite accurate. This may be because I misinterpreted the pitch class profile algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand the folowing formula formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p(k)= [12 \;log_2( \frac {l}{N} \cdot \frac {f_{sr}} {f_{ref}})]$  $mod$  $12$&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What are $f_{ref}$,and $N$ here?&lt;/li&gt;&#xA;&lt;li&gt;Does $N$ mean the sample size of FFT (4096,1024,etc.) or the total bins of the spectrum?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5797" LastEditorUserId="76" LastEditDate="2014-01-12T00:54:16.450" LastActivityDate="2015-10-10T20:57:47.360" Title="Pitch class profiling" Tags="|fft|sound|pitch|music|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13723" PostTypeId="2" ParentId="13720" CreationDate="2014-01-11T18:53:32.887" Score="3" Body="&lt;p&gt;It depends on what kind of kernel you are applying. In the paper of &lt;a href=&quot;ftp://ftp.vision.ee.ethz.ch/publications/articles/eth_biwi_00517.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;SURF&lt;/a&gt;, the authors use an approximation to the second order Gaussian partial derivative kernel, see the 3rd and 4th figure below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BPwzn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By such approximation, you can expand the kernel (or change the scaling) by just adding elements with single numbers. See the figure shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nIqF9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-11T18:53:32.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13724" PostTypeId="2" ParentId="13722" CreationDate="2014-01-11T19:14:16.833" Score="0" Body="&lt;p&gt;$f_{ref}$ is the reference frequency corresponding to the first pitch class profiling (or PCP[0]), $N$ is the number of samples in the sound that is used to implement the short time Fourier transform. The original sound sequence will be split into overlapping segments with the length of $N$. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-11T19:14:16.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13726" PostTypeId="1" CreationDate="2014-01-11T19:42:38.027" Score="0" ViewCount="106" Body="&lt;p&gt;I have two sine signals with frequencies f1 and f2, and phase p1 and p2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I modulate the phase of these signals to transmit two symbols simultaneously, chosen from the set [0,1,2,3]. For example, I represent 0 by 45 degrees phase shift, 1 by 90 degrees phase shift, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signals will pass through an optical communication channel, potentially getting distorted. This means there could be intermodulation products and harmonics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plan on using an FFT to determine magnitude and phase changes of the signals. I am hoping to retrieve the symbols from the phase changes I detect using the FFT. I want the magnitude to stay constant while the phase is shifting to transmit the symbols. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling rate I'm working with is 7800 hz. I will potentially have to fit 16 transmission channels (frequencies) below 1500 hz. At any time, two frequencies randomly chosen from the set of 16 frequencies may be present, transmitting symbols as explained above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this going to work, and what are the key issues to keep and mind and to work around? Any practical pointers or references are highly appreciated as I'm a novice in phase modulation and encoding/decoding of information in this fashion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for helping!&#xA;B&lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2014-01-11T19:42:38.027" Title="transmitting data using phase modulation of two sine waves passed through distortion" Tags="|fft|modulation|phase|information-theory|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13728" PostTypeId="1" AcceptedAnswerId="13732" CreationDate="2014-01-11T21:33:17.177" Score="8" ViewCount="26480" Body="&lt;p&gt;I am having trouble understanding the example program for audio recording , &#xA;it comes with PyAudio module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using an external Audio Card to record the sound , obviously, the voice should be converted into the digital form to be presented to the computer. But i do not understand how this code converts the input Analog Voice into Digital Form and then saving it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pyaudio&#xA;import wave&#xA;import sys&#xA;&#xA;CHUNK = 1024&#xA;# What is CHUNKS here ?&#xA;FORMAT = pyaudio.paInt16&#xA;CHANNELS = 2&#xA;RATE = 44100&#xA;RECORD_SECONDS = 5&#xA;WAVE_OUTPUT_FILENAME = &quot;test.wav&quot;&#xA;&#xA;p = pyaudio.PyAudio()&#xA;&#xA;stream = p.open(format=FORMAT,&#xA;                channels=CHANNELS,&#xA;                rate=RATE,&#xA;                input=True,&#xA;                frames_per_buffer=CHUNK)&#xA;print(&quot;start....&quot;)&#xA;&#xA;frames = []&#xA;&#xA;for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):&#xA;    data = stream.read(CHUNK)&#xA;    frames.append(data)&#xA;&#xA;print(&quot;done...&quot;)&#xA;&#xA;&#xA;stream.stop_stream()&#xA;stream.close()&#xA;p.terminate()&#xA;&#xA;wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')&#xA;wf.setnchannels(CHANNELS)&#xA;wf.setsampwidth(p.get_sample_size(FORMAT))&#xA;wf.setframerate(RATE)&#xA;wf.writeframes(b''.join(frames))&#xA;wf.close()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the code is executed it record the sounds for 5seconds using an external audio card with a mic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I understood from the code is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Rate is 44Kbps, which means that 44 kilo bytes are generated from the Analog Audio signals per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then an empty frame is generated &lt;code&gt;frame[]&lt;/code&gt; where all the recorded data will be stored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next thing is &lt;code&gt;for&lt;/code&gt; loop,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):&#xA;    data = stream.read(CHUNK)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the answer to &lt;code&gt;RATE/CHUNK*RECORD_SECONDS&lt;/code&gt; is &lt;code&gt;215.33&lt;/code&gt; which means there will be 215 iterations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why the &lt;code&gt;RATE&lt;/code&gt; is divided by &lt;code&gt;CHUNKS&lt;/code&gt; and then multiplied by &lt;code&gt;RECORD_SECONDS&lt;/code&gt; for the recording of &lt;code&gt;5&lt;/code&gt; seconds. (RECORD_SECONDS = 5)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, What exactly is &lt;code&gt;CHUNK&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="1324" LastEditorUserId="1324" LastEditDate="2014-01-11T21:41:29.897" LastActivityDate="2015-06-21T17:43:14.503" Title="What are Chunks when recording a voice signal" Tags="|audio|voice|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13729" PostTypeId="2" ParentId="13728" CreationDate="2014-01-11T21:52:08.130" Score="3" Body="&lt;p&gt;Usually a data stream is broken up into chunks of data, where each chunk is some number of samples. In practice an analog to digital converter (ADC) has a buffer that you read data from it. So the buffer is also sometimes called a chunk of data. It's usually faster in practice to read many samples in a chunk, then process that chunk, instead of reading the data sample by sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see the word chunk come up a lot in audio processing. Sometimes a chunrk can reference both meta data and data. For example this &lt;a href=&quot;http://en.wikipedia.org/wiki/Audio_Interchange_File_Format&quot; rel=&quot;nofollow&quot;&gt;Wikipedia AIFF&lt;/a&gt; article describes several different chunks in the AIFF format.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-11T21:52:08.130" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13731" PostTypeId="2" ParentId="13728" CreationDate="2014-01-11T22:41:59.563" Score="2" Body="&lt;p&gt;This is an addition to porten's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are not exactly right with your description of rate. The rate is in Hertz, meaning in your case 44100 Hz - or 44100 samples per second. So you are basicly reading out that many digitized values from your device. So if you want to record 5 seconds, you will have to save $5\cdot 44100$ samples. Because, as porten wrote in his answer, most audio systems work with chunks (also called frames or blocks), the program will now read chunks of data. One chunk in your case is 1024 samples. So basicly the system reads 215.33 chunks out of the buffer until it has saved the whole 5 seconds of audio data.&lt;/p&gt;&#xA;" OwnerUserId="5545" LastActivityDate="2014-01-11T22:41:59.563" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13732" PostTypeId="2" ParentId="13728" CreationDate="2014-01-11T22:54:52.713" Score="12" Body="&lt;p&gt;So essentially, @porten pointed out what chunks of sound are. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at your code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CHUNK = 1024&#xA;# What is CHUNKS here ?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The chunk is like a buffer, so therefore each buffer will contain 1024 samples, which you can then either keep or throw away. We use CHUNKS of data, instead of a continuous amount of audio because of processing power. (Let's assume this was a continuous flow of data being received from a Microphone and is being recorded and saved) then it would just eat up the processor, thus causing potential crashes. In terms of Raspberry Pi / Arduino development (Where the RAM is very small) CHUNKING the data like this makes the stream flow easier and thus prevents memory leaks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another reason:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume that you wanted to implement an algorithm for determining whether something is speech, or, is just noise. How would/could you do this using a constant stream flow of sound data? It would be very difficult. Therefore, by storing this into an array (or list in your case) you can perform analysis on this data, for example RMS. Then you could have some threshold to determine if you want to keep the data, or the data is no good. E.g. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CHUNK = 1024&#xA;&#xA;var input[CHUNK] = readAudio(CHUNK); // reads in 1024 of data&#xA;&#xA;// compute RMS &#xA;a = RMS(input); &#xA;if(a &amp;gt;= THRES_VALUE)&#xA;{ &#xA;    actual += input;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in this example above, we record 1024 bytes of data, we then compute RMS and check to see whether or not the sound is speech or just white-noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To confirm as well, the chunks contain the data. &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-01-11T22:54:52.713" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13733" PostTypeId="2" ParentId="13719" CreationDate="2014-01-12T04:30:13.220" Score="1" Body="&lt;p&gt;What your professor probably meant is that in most audio converters a small amount of aliasing is permitted (for example if you put 24.1khz into a 48khz converter you will see an output component at 23.9kHz that is not very heavily attenuated). The reason for this is that manufacturers like to use so- called half-band filters in the decimation chain because this saves a factor of 2 in the number of multiplications. Halfband filters impose a response symmetry around FS_out/2 so the attenuation at Nyquist is only 6db.  Since this is above the audio band it is not audible. However if you attempt to use this shortcut at lower sample rates like 8khz, it can be quite audible so it is not a recommended technique for lower sample-rates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bob&lt;/p&gt;&#xA;" OwnerUserId="7453" LastActivityDate="2014-01-12T04:30:13.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13734" PostTypeId="2" ParentId="13719" CreationDate="2014-01-12T05:40:45.133" Score="1" Body="&lt;p&gt;I do not know about the sinus values in embedded processors, since pre-computed values can be used. The principal problem with the interpolation with the cardinal series is that it is highly, one could even say extremely, acausal. To correctly implement it, you have to go back to times before the big bang and forward to the times after the dissolution of our galaxy to obtain the samples required for an exact reconstruction, and who in these days has that time and money.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you always use filters that are imperfect from the theoretical point of view. To account for that gap between ideal theory and real practice, one uses a sampling frequency that is a higher multiple of the highest frequency in the signal than just the Nyquist double. Humanly perceptible sound goes to 12kHz according to vinyl and to 15kHz according to CDs and mp3. The range from 41-48kHz provides a safe multiple of &lt;s&gt;3&lt;/s&gt; 2.5-4 of the frequency range.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Please note &quot;according to vinyl ...  and mp3&quot;, which means that recordings of widely acceptable quality are produced with filtering the sound down to the frequency band limit of 12kHz-14kHz and thus having an oversampling factor of 3-4 when encoding with 41-48kHz. People trained in listening to orchestral music may notice the missing harmonics, especially at solos of high-pitched instruments.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-01-12T10:23:39.630" LastActivityDate="2014-01-12T10:23:39.630" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13735" PostTypeId="1" CreationDate="2014-01-12T08:06:02.603" Score="1" ViewCount="173" Body="&lt;p&gt;I have the following vector and wavelet transform (from R waveslim package) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x&amp;lt;-c(0.1,0.4,0.1,-0.05,0.025,0.12,0.42,0.14,-0.15,0.25,0.35,0.23,0.11,-0.35,0.025,0.1,0.4,0.1,-0.05,0.025,-0.12,0.2,0.09,-0.05,0.05,0.15,0.13,0.21,-0.15,0.023,0.1,0.4,0.1,-0.05,0.025,0.12,0.42,0.14,-0.15,0.25,0.35,0.23,0.11,-0.35,0.025)&#xA;J = 8&#xA;Faf = FSfarras()$af&#xA;    Fsf = FSfarras()$sf&#xA;af = dualfilt1()$af&#xA;    sf = dualfilt1()$sf&#xA;w = dualtree(x, J, Faf, af)&#xA;w&#xA;#For the synthesis of w, the output is&#xA;idualtree(w, J, Fsf, sf)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would you happen to know if there is a function or mix of functions in any R package that may undecimate and make shift invariant the above transform, I have reviewed the packages in R and could not find any of this two functions. Otherwise it will be very helpful if you could drive me over the steps to carry over the above mentioned processes.    &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2014-01-12T08:18:12.383" LastActivityDate="2014-01-12T08:18:12.383" Title="How to undecimate and make shift invariant a Dual-tree Complex Discrete Wavelet Transform in R" Tags="|wavelet|" AnswerCount="0" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13736" PostTypeId="1" CreationDate="2014-01-12T13:55:14.227" Score="7" ViewCount="8230" Body="&lt;p&gt;What's the correct way. Should I zero-pad a signal before or after applying a windowing function?&lt;/p&gt;&#xA;" OwnerUserId="6951" LastEditorUserId="6951" LastEditDate="2014-01-12T14:13:15.343" LastActivityDate="2022-05-09T03:49:30.760" Title="Zero-pad before or after windowing for FFT" Tags="|fft|fourier-transform|window-functions|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13737" PostTypeId="1" AcceptedAnswerId="13738" CreationDate="2014-01-12T14:12:39.647" Score="0" ViewCount="1174" Body="&lt;p&gt;I am learning about ADC MCP3422 Chip, because I want to use ADC Pi chip with my Raspberry Pi which is using MCP3424 ADCs, but I am having trouble understanding how the ADC calculation is done in the datasheet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Data sheet links are available in the end)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I know of ADCs,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ADC has a bit size.&#xA;and ADC tends to generate the total number of level based on the Reference Voltage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a &lt;code&gt;3-bit&lt;/code&gt; ADC then and the &lt;code&gt;Reference Voltage&lt;/code&gt; is &lt;code&gt;2volts&lt;/code&gt;, then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2^3 = 8-bits&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now &lt;code&gt;2volts&lt;/code&gt; will be divided in &lt;code&gt;8&lt;/code&gt; levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;8/2 = 0.25volts&lt;/code&gt; (each level will represent &lt;code&gt;0.25 volts&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;000 = 0 -&amp;gt; 0.25 volts&#xA;001 = 0.25 -&amp;gt; 0.50&#xA;010 = 0.50 -&amp;gt; 0.75&#xA;011 = 0.75 -&amp;gt; 1.00&#xA;100 = 1.00 -&amp;gt; 1.25&#xA;101 = 1.25 -&amp;gt; 1.50&#xA;110 = 1.50 -&amp;gt; 1.75&#xA;111 = 1.75 -&amp;gt; 2.00&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, in case of MCP3424, I have so much confusions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bit size is &lt;code&gt;18&lt;/code&gt;.&#xA;Reference voltage is &lt;code&gt;2.048volts&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;2^18 = 262144&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that mean there will be &lt;code&gt;262144&lt;/code&gt; levels ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;code&gt;2.048/262144 = 0.000007812volts&lt;/code&gt;&#xA;Does that mean each level will represent, &lt;code&gt;0.000007812 volts&lt;/code&gt; ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the data sheet says,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The data rate for analogue to digital conversions is 3.75 (17 bit), 15 (15&#xA;bit), 60 (13 bit) or 240 (11 bit) samples per second. Data rate and&#xA;resolution can be configured within software using the I2C interface.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How the data rate is calculated here, and how come reducing the bit is increasing the Data Rate ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MCP3424 Datasheet: www.pridopia.co.uk/pi-doc/mcp3424.pdf‎&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADC Pi Datasheet: &lt;a href=&quot;http://www.abelectronics.co.uk/docs/stock/raspberrypi/adcpi2/Datasheet-ADCPiV2.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.abelectronics.co.uk/docs/stock/raspberrypi/adcpi2/Datasheet-ADCPiV2.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1324" LastActivityDate="2014-05-24T15:03:08.467" Title="Confusion with ADC conversion in MCP3424" Tags="|digital|analog|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13738" PostTypeId="2" ParentId="13737" CreationDate="2014-01-12T15:39:04.113" Score="1" Body="&lt;p&gt;If the conversion is 18-bit, there will be 262144 levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it seems to me that on the ADC Pi board, one of the differential inputs of each MCP3424 converter channel is grounded ; so this actually halve the range, and the first bit of a word read from the ADC will always be zero. That's why the ADC Pi datasheet reports half the resolutions compared to those published on the MCP3424 datasheet (17-bit, 15-bit, 13-bit, 11-bit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a relationship between data rate and bit rate because the converter has a &lt;a href=&quot;http://en.wikipedia.org/wiki/Delta-sigma_modulation&quot; rel=&quot;nofollow&quot;&gt;delta-sigma architecture&lt;/a&gt;. There is an internal conversion/integration clocked at a fixed 983040 Hz, and this conversion &quot;budget&quot; can be used at your whim to achieve different data rate / bit-rate ratios with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_r = \frac{983040}{2^{b_r}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively (and this is a gross mis-simplification), reducing the sample rate gives the ADC more time to extract the finer details of each sample.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-01-12T15:39:04.113" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13739" PostTypeId="1" CreationDate="2014-01-12T17:29:31.277" Score="0" ViewCount="345" Body="&lt;p&gt;I am trying to develop a filtering routine, using Java, and I am using the windowing method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my studies, I was told that if I make a plot of the impulse response of an ideal lowpass filter, I would get a SINC graph. In this situation, what am I plotting against (i.e., what values are on the X-Axis?)?&lt;/p&gt;&#xA;" OwnerUserId="7271" LastEditorUserId="76" LastEditDate="2014-01-12T22:38:48.673" LastActivityDate="2014-04-13T02:04:00.703" Title="What are the values on the x-axis when I plot the impulse response of a lowpass filter?" Tags="|lowpass-filter|impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13740" PostTypeId="2" ParentId="13736" CreationDate="2014-01-12T17:36:34.790" Score="10" Body="&lt;p&gt;If done correctly, the order should not matter. You apply windowing to remove the jumps at the end of the signal segment by fading the values there to zero. Zero-padding then continues with zeros. Irregardless if padded or not, the windowing should only be applied to the original signal segment.&lt;/p&gt;&#xA;&lt;p&gt;The wrong way would be to zero-padding and then apply windowing to the new longer signal over its full length, i.e., without regard to the position of the jumps. This would not remove the jumps and thus keep the background in the spectrum non-related to the frequency content of the signal but the segmentation method.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7092" LastEditDate="2022-05-09T03:49:30.760" LastActivityDate="2022-05-09T03:49:30.760" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13742" PostTypeId="1" CreationDate="2014-01-12T18:03:51.613" Score="0" ViewCount="157" Body="&lt;p&gt;I am a beginner in opencv and have started learning it using visual studio 2012 and opencv 2.4.7 . But i got stuck at very beginning .I want to know about Mat used in Opencv .It is a class and an image name is a variable of this class .i just know this .but still i am feeling like i didn't get it totally like what are its data members and member functions?&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="7084" LastEditDate="2014-01-12T18:31:28.087" LastActivityDate="2014-01-12T19:06:13.453" Title="Mat class of c++ in open cv" Tags="|image-processing|opencv|c|" AnswerCount="1" CommentCount="0" ClosedDate="2014-01-13T12:39:56.830" ContentLicense="CC BY-SA 3.0" />
  <row Id="13743" PostTypeId="2" ParentId="13739" CreationDate="2014-01-12T18:06:41.807" Score="0" Body="&lt;p&gt;There is a frequency inherent to sinc. Sometimes, the definition is normalized by multiplying $x$ with $\pi$. Then if the sampling frequency of the signal is 1 then, the sampled sinc is identical to a Kronecker delta (that is, a ,,wire'' - it will not filter at all, or identically: a low pass filter with cutoff at Nyquist frequency). In case the cutoff frequency is different, you will need to multiply t by a factor smaller than 1 to get x. Then the factor will be the ratio of cutoff and Nyquist frequency.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-12T18:06:41.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13744" PostTypeId="2" ParentId="13742" CreationDate="2014-01-12T19:06:13.453" Score="1" Body="&lt;p&gt;&lt;code&gt;Mat&lt;/code&gt; declares a variable of type Matrix which can have multiple dimensions. In VS&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mat image = imread('test.bmp'); //lets consider a 2d image for now&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now put a &lt;code&gt;.&lt;/code&gt; in front of &lt;code&gt;image&lt;/code&gt; and the member functions will be exposed.&lt;/p&gt;&#xA;" OwnerUserId="4142" LastActivityDate="2014-01-12T19:06:13.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13745" PostTypeId="1" CreationDate="2014-01-12T19:35:47.443" Score="3" ViewCount="588" Body="&lt;p&gt;This is a rather general question.  Suppose I have an arbitrary filter, $F$, defined in the Laplace domain;&#xA;$$&#xA;F=k\frac{\prod_i (s+z_i)}{\prod_j(s+p_j)}.&#xA;$$&#xA;How do I calculate the impulse response of this filter analytically?  As a specific simple example, consider the first order low pass filter&#xA;$$&#xA;F_0=\frac{1}{s+p}.&#xA;$$&#xA;To be clear, what I want to get from this transformation is a function which describes the delta function response from $t=0$ to $t\rightarrow\infty$ where the delta function is applied at $t=0$.&lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2014-02-11T20:25:46.527" Title="Analytical Calculation of the Impulse Response of an Arbitrary Filter" Tags="|filters|filter-design|lowpass-filter|impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13746" PostTypeId="1" AcceptedAnswerId="13751" CreationDate="2014-01-12T20:03:27.823" Score="1" ViewCount="540" Body="&lt;p&gt;Is there any way to remove useless information (unimportant details) from an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, for example, we have a specific image, so this contains both useful and useless information. If this image can be recognized directly without the useless information, the unnecessary information can be removed (e.g., illumination, some noises, variations, etc.).&lt;/p&gt;&#xA;" OwnerUserId="6925" LastEditorUserId="76" LastEditDate="2014-01-12T22:35:47.007" LastActivityDate="2014-01-13T00:02:52.110" Title="What technique can I use to remove useless information from an image?" Tags="|image-processing|image-segmentation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13747" PostTypeId="2" ParentId="13746" CreationDate="2014-01-12T20:22:44.720" Score="4" Body="&lt;p&gt;Although you did not spent even a minute in researching the question I will post an answer to it. There are multiple ways; I will try to demonstrate it using wavelets in &lt;code&gt;Mathematica&lt;/code&gt;.&#xA;So, first of all we need an image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = ExampleData[{&quot;TestImage&quot;, &quot;Mandrill&quot;}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wQLcA.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then we apply the &lt;code&gt;DiscreteWaveletTransform&lt;/code&gt; using the &lt;code&gt;HaarWavelet&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dwd = DiscreteWaveletTransform[img]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We plot the transformation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WaveletImagePlot[dwd]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pLriF.png&quot; alt=&quot;WaveletImagePlot&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We threshold it, i.e. removing the noise according to some criteria&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wtd = WaveletThreshold[dwd]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again plot the transformation and the filtering&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WaveletImagePlot[wtd]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kowr8.png&quot; alt=&quot;Wavelet&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We now inverse the transformation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;iwd = InverseWaveletTransform[wtd]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6lVul.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And visualize the differences between the two images&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ImageDifference[iwd, img]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/d8Ogv.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7477" LastActivityDate="2014-01-12T20:22:44.720" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13748" PostTypeId="2" ParentId="13745" CreationDate="2014-01-12T20:23:16.453" Score="1" Body="&lt;p&gt;Your expression is the Laplace transform of the exponential function &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_transform#Table_of_selected_Laplace_transforms&quot; rel=&quot;nofollow&quot;&gt;$e^{-pt}$&lt;/a&gt;. The Laplace transform of the dirac unit is $1$. So the inverse Laplace transform is exactly $e^{-pt}$. Maybe the fact that this function is noncausal adds a little complexity here.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-12T20:23:16.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13749" PostTypeId="1" CreationDate="2014-01-12T21:34:45.767" Score="3" ViewCount="447" Body="&lt;p&gt;I'm experimenting with a 30 Hz sine wave and I want to extract the frequencies of this, and have implemented the algorithm to do so. This gives a correct reading, well, gives 29 Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm now wanting to compute the algorithm for an STFT. So, for this, I use &lt;code&gt;NFFT = 256&lt;/code&gt; with an overlap of &lt;code&gt;128&lt;/code&gt;, using the Hanning Window function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives me a series of bins which I can then calculate the frequency formula on. However, when I graph this, the results do not seem right, for some reason:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bhumy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, it might just be me in thinking that the results do not look right, however, if they are, why would the results be this? I just don't get it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I was expecting when the energy is low, the result would be low and thus when the energy was high, the result would be high. Let me give you another example on a more structured sound file. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sample rate = 12000 &#xA;NFFT = 256 &#xA;Overlap = 128&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S0XvH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the STFT output for this is below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vywed.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong here, or, do these results look ok?&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="76" LastEditDate="2014-01-12T22:33:15.873" LastActivityDate="2014-01-12T22:33:15.873" Title="Why are the frequencies associated with the STFT bins not representative of the energy?" Tags="|fft|audio|stft|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13750" PostTypeId="2" ParentId="13746" CreationDate="2014-01-12T22:13:23.983" Score="1" Body="&lt;p&gt;The amount of information contained in a signal (or image) is generally related to entropy. If you compute the per pixel entropy of the image, then you can get use threholding to remove or retain the importance. Filtered entropy appears like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/St3WC.png&quot; alt=&quot;Image of the Local Entropy Filtering&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in this image the white pixels denote higher entropy while lower ones represent unimportance or lack of information.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-12T22:13:23.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13751" PostTypeId="2" ParentId="13746" CreationDate="2014-01-12T23:52:23.290" Score="4" Body="&lt;p&gt;It depends on how you define the noise and what kind of noise does your image have. Different filters work on different kinds of noise. Among those filters, &lt;a href=&quot;http://www.mathworks.com/help/images/removing-noise-from-images.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiener filter&lt;/a&gt; is often used by tailoring itself to the local image variance. And a new method called block-matching and 3D ﬁltering (BM3D) in which the Weiner filter is used to optimize the parameters of denoising by shrinkage in 3D transform domain with block matching. Their &lt;a href=&quot;http://www.cs.tut.fi/~foi/3D-DFT/BM3DDEN_article.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;research paper&lt;/a&gt; is very worth reading and studying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a9tOz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the illumination difference, you may need to equalize the difference by creating a white evenly distributed background. This &lt;a href=&quot;https://stackoverflow.com/questions/20794252/line-detection-against-darker-shades&quot;&gt;post&lt;/a&gt; with Gaussian blurring method and &lt;a href=&quot;https://stackoverflow.com/questions/4632174/what-processing-steps-should-i-use-to-clean-photos-of-line-drawings&quot;&gt;this one&lt;/a&gt; with dilate after erode may help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JihqZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-01-13T00:02:52.110" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="13752" PostTypeId="2" ParentId="13718" CreationDate="2014-01-13T05:28:21.283" Score="4" Body="&lt;p&gt;I suspect your problem occurs due to some scaling issues. Basically you need to normalize your research image to the pattern template by subtracting the mean value of the template. And it is better calculate the ratio of correlation to the standard deviation of both images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know which programming language you are using. I wrote a Matlab code for you to better get what I meant above (note that I did not use zero padding since I work on the spatial domain, I don't think it is the issue that caused your spurious correlation too):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;file1='https://lh3.googleusercontent.com/-GQSrln7qnO8/UtCT8elB_FI/AAAAAAAAEaw/bh7aKyyMRIo/s512/subimage.png'; % Research image&#xA;I1=double(rgb2gray(imread(file1)));&#xA;file2='https://lh5.googleusercontent.com/-YaDK_1QvqIQ/UtCT6-rNkNI/AAAAAAAAEao/41MOQJ_bXxU/s512/pattern_grey.png';   % Template pattern image&#xA;I2=double(rgb2gray(imread(file2)));&#xA;&#xA;I2=I2(:,1:32); %% No padding  &#xA;&#xA;It=double(I2);  % template&#xA;Ii=double(I1);  % image&#xA;&#xA;Ii_mean = conv2(Ii,ones(size(It))./numel(It),'same');&#xA;It_mean = mean(It(:));&#xA;corr_1 = conv2(Ii,rot90(It-It_mean,2),'same')./numel(It);&#xA;corr_2 = Ii_mean.*sum(It(:)-It_mean);&#xA;conv_std = sqrt(conv2(Ii.^2,ones(size(It))./numel(It),'same')-Ii_mean.^2);&#xA;It_std = std(It(:));&#xA;S = (corr_1-corr_2)./(conv_std.*It_std);&#xA;&#xA;imagesc(abs(S))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wzRzM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can observe the correlation peak at 17th row, 450th column, which is the position of your pattern in original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use Matlab built-in function &lt;code&gt;normxcorr2(It,Ii);&lt;/code&gt;, just note that this function results in the correlation map with the sum of the lengths of two images, while my code provides you the correlation map the same size of your research image.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-01-13T17:44:35.083" LastActivityDate="2014-01-13T17:44:35.083" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13755" PostTypeId="1" AcceptedAnswerId="13766" CreationDate="2014-01-13T09:46:25.140" Score="4" ViewCount="2974" Body="&lt;p&gt;I'm trying to implement the &lt;a href=&quot;http://www.see.ed.ac.uk/~tblumens/papers/BDIHT.pdf&quot; rel=&quot;nofollow&quot;&gt;Iterative Hard Thresholding&lt;/a&gt; recovery algorithm for compressive sensing in python. It is a very simple algorithm, given&#xA;$ \mathbf{y}( = \mathbf{A}\mathbf{x}), \mathbf{A}$, &#xA;we start with $\mathbf{x}^{[0]}=0$ and update the estimate of $\mathbf{x}$ iteratively with,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{equation} \mathbf{x}^{[n+1]} = \mathbf{H}_{s}( \mathbf{x}^{[n]} + \mathbf{A}^{T}(\mathbf{y} - \mathbf{Ax}^{[n]})) \end{equation}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{H}_{s}(\mathbf{a})$ is the Hard thresholding operator which sets all but $s$ largest magnitude components of $\mathbf{a}$ to zero. $\mathbf{A}$ is the measurement matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pylab import *&#xA;&#xA;def largestElement(x, n):&#xA;    # returns the nth largest element of the vector x&#xA;    N = x.shape[0]&#xA;    if n &amp;gt; N:&#xA;        n = N&#xA;    elif n &amp;lt; 1:&#xA;        n = 1&#xA;    t = np.sort(x)[::-1]&#xA;    return t[n-1] # python index starts at 0&#xA;&#xA;# Soft thresholding function&#xA;def softThreshold(x, threshold):&#xA;    j = np.abs(x) &amp;lt;= threshold&#xA;    x[j] = 0&#xA;    j = np.abs(x) &amp;gt; threshold&#xA;    x[j] = x[j] - np.sign(x[j])*threshold&#xA;    return x&#xA;&#xA;# Hard thresholding function&#xA;def hardThreshold(x, threshold):&#xA;    j = np.abs(x) &amp;lt; threshold&#xA;    x[j] = 0&#xA;    return x&#xA;&#xA;def reconstructIHT(A, y, s, Its=500, tol=0.001, x=0, verbose=False):&#xA;    # recovers a sparse vector x from y using Iterative Hard thresholding Algorithm&#xA;    # xhat = reconstructIHT(A, t, T, tol, x, verbose)&#xA;    #  Arguments:&#xA;    #       A - measurement matrix&#xA;    #       y - measurements&#xA;    #       s - sparsity level require in reconstruction&#xA;    #       Its - max number of iterations (optional)&#xA;    #       tol - stopping criteria (optional)&#xA;    #       x - original vector used to print progress of MSE (optional)&#xA;    #       verbose - print progress (optional)&#xA;&#xA;    # Length of original signal&#xA;    N = A.shape[1]&#xA;&#xA;    # Length of measurement vector&#xA;    n = A.shape[0]&#xA;&#xA;    # Initial estimate&#xA;    xhat = np.zeros(N)&#xA;&#xA;    # Initial residue&#xA;    r = y&#xA;&#xA;    for t in xrange(Its):&#xA;        # Pre-threshold value&#xA;        gamma = xhat + np.dot(A.T, r)&#xA;&#xA;        # Find the s-th largest coefficient of gamma&#xA;        threshold = largestElement(np.abs(gamma), s)&#xA;&#xA;        # Estimate the signal (by hard thresholding)&#xA;        xhat = hardThreshold(gamma, threshold)&#xA;&#xA;        # Compute error, print and plot&#xA;        if verbose:&#xA;            err = np.mean((x-xhat)**2)&#xA;            print &quot;iter# = &quot;+str(t) + &quot; MSE = &quot; + str(err)&#xA;&#xA;        # update the residual&#xA;        r = y - np.dot(A, xhat)&#xA;&#xA;        # Stopping criteria&#xA;        if np.linalg.norm(r)/np.linalg.norm(y) &amp;lt; tol:&#xA;            break&#xA;&#xA;    return xhat&#xA;&#xA;&#xA;if __name__ == '__main__':&#xA;    N = 2000 # signal length&#xA;    n = 400  # Number of measurements&#xA;    k = 50   # Number of non-zero elements&#xA;&#xA;    T = 200 # Number of iterations&#xA;&#xA;    tol = 0.0001 # Tolerance&#xA;&#xA;    # Generate problem instance&#xA;    A = np.random.randn(n,N)&#xA;    # normalize to columns to have unit norm&#xA;    A = A/np.sqrt(np.sum(A**2, axis=0))&#xA;&#xA;    # Sparse signal x[i] in {+1, -1, 0}&#xA;    x = np.sign(np.random.rand(k)-0.5)&#xA;    x = np.append(x, np.zeros(N-k))&#xA;    x = x[np.random.permutation(np.arange(N))]&#xA;&#xA;    # Generate measurements&#xA;    y = np.dot(A, x)&#xA;&#xA;    # Reconstruct using IHT&#xA;    xiht = reconstructIHT(A, y, k, T, tol, x=x, verbose=True)&#xA;&#xA;    print &quot;All Close xiht and x :&quot; + str(np.allclose(xiht, x))&#xA;&#xA;    erriht = np.mean((xiht-x)*(xiht-x))     &#xA;    print &quot;Mean Squared Error AMP: &quot; + str(erriht)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even with this simple algorithm, the output MSE is diverging from the first iteration itself. I'm getting the following output while executing the above script&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ python iht.py &#xA;iter# = 0 MSE = 0.0212064839901&#xA;iter# = 1 MSE = 0.0343619834319&#xA;iter# = 2 MSE = 0.0699223575979&#xA;iter# = 3 MSE = 0.142079696301&#xA;iter# = 4 MSE = 0.412376685514&#xA;iter# = 5 MSE = 1.15243885539&#xA;iter# = 6 MSE = 4.01798792918&#xA;iter# = 7 MSE = 14.2079757137&#xA;iter# = 8 MSE = 53.368135365&#xA;iter# = 9 MSE = 203.594951636&#xA;iter# = 10 MSE = 802.066963904&#xA;iter# = 11 MSE = 3191.3320412&#xA;iter# = 12 MSE = 12906.9426382&#xA;iter# = 13 MSE = 53269.0355341&#xA;iter# = 14 MSE = 224943.846986&#xA;iter# = 15 MSE = 973665.201472&#xA;iter# = 16 MSE = 4257382.86503&#xA;iter# = 17 MSE = 18692796.3866&#xA;iter# = 18 MSE = 82371037.4764&#xA;iter# = 19 MSE = 364100534.649&#xA;iter# = 20 MSE = 1613521353.98&#xA;iter# = 21 MSE = 7168116403.28&#xA;iter# = 22 MSE = 31928645804.5&#xA;iter# = 23 MSE = 142615155018.0&#xA;iter# = 24 MSE = 637897124776.0&#xA;iter# = 25 MSE = 2.85545575893e+12&#xA;iter# = 26 MSE = 1.27824446331e+13&#xA;iter# = 27 MSE = 5.72207134294e+13&#xA;iter# = 28 MSE = 2.56149013357e+14&#xA;iter# = 29 MSE = 1.14665325897e+15&#xA;iter# = 30 MSE = 5.13300318342e+15&#xA;iter# = 31 MSE = 2.29779329081e+16&#xA;iter# = 32 MSE = 1.02860914392e+17&#xA;iter# = 33 MSE = 4.60457768293e+17&#xA;iter# = 34 MSE = 2.06124316181e+18&#xA;iter# = 35 MSE = 9.22717274943e+18&#xA;iter# = 36 MSE = 4.13055182075e+19&#xA;iter# = 37 MSE = 1.84904507664e+20&#xA;iter# = 38 MSE = 8.27726619554e+20&#xA;iter# = 39 MSE = 3.70532533453e+21&#xA;iter# = 40 MSE = 1.65869207421e+22&#xA;iter# = 41 MSE = 7.42514934227e+22&#xA;iter# = 42 MSE = 3.32387449197e+23&#xA;iter# = 43 MSE = 1.48793527633e+24&#xA;iter# = 44 MSE = 6.66075506727e+24&#xA;iter# = 45 MSE = 2.98169273705e+25&#xA;iter# = 46 MSE = 1.33475731931e+26&#xA;iter# = 47 MSE = 5.97505262467e+26&#xA;iter# = 48 MSE = 2.67473744861e+27&#xA;iter# = 49 MSE = 1.19734852032e+28&#xA;iter# = 50 MSE = 5.3599409537e+28&#xA;iter# = 51 MSE = 2.39938217983e+29&#xA;iter# = 52 MSE = 1.07408549733e+30&#xA;iter# = 53 MSE = 4.80815297065e+30&#xA;iter# = 54 MSE = 2.15237381444e+31&#xA;iter# = 55 MSE = 9.63511990024e+31&#xA;iter# = 56 MSE = 4.31316971379e+32&#xA;iter# = 57 MSE = 1.9307941336e+33&#xA;iter# = 58 MSE = 8.64321655241e+33&#xA;iter# = 59 MSE = 3.86914332666e+34&#xA;iter# = 60 MSE = 1.73202533935e+35&#xA;iter# = 61 MSE = 7.75342633463e+35&#xA;iter# = 62 MSE = 3.47082797006e+36&#xA;iter# = 63 MSE = 1.55371912724e+37&#xA;iter# = 64 MSE = 6.95523704191e+37&#xA;iter# = 65 MSE = 3.11351784638e+38&#xA;iter# = 66 MSE = 1.39376894293e+39&#xA;iter# = 67 MSE = 6.23921866557e+39&#xA;iter# = 68 MSE = 2.79299160412e+40&#xA;iter# = 69 MSE = 1.25028509479e+41&#xA;iter# = 70 MSE = 5.59691198477e+41&#xA;iter# = 71 MSE = 2.50546246579e+42&#xA;iter# = 72 MSE = 1.12157242861e+43&#xA;iter# = 73 MSE = 5.02072862715e+43&#xA;iter# = 74 MSE = 2.24753348998e+44&#xA;iter# = 75 MSE = 1.00611030066e+45&#xA;iter# = 76 MSE = 4.50386141788e+45&#xA;iter# = 77 MSE = 2.01615743902e+46&#xA;iter# = 78 MSE = 9.0253461236e+46&#xA;iter# = 79 MSE = 4.040203958e+47&#xA;iter# = 80 MSE = 1.80860077815e+48&#xA;iter# = 81 MSE = 8.09621694534e+48&#xA;iter# = 82 MSE = 3.6242784819e+49&#xA;iter# = 83 MSE = 1.6224113809e+50&#xA;iter# = 84 MSE = 7.26273850647e+50&#xA;iter# = 85 MSE = 3.25117114157e+51&#xA;iter# = 86 MSE = 1.45538955896e+52&#xA;iter# = 87 MSE = 6.51506388346e+52&#xA;iter# = 88 MSE = 2.91647395326e+53&#xA;iter# = 89 MSE = 1.30556207463e+54&#xA;iter# = 90 MSE = 5.84435986066e+54&#xA;iter# = 91 MSE = 2.61623272035e+55&#xA;iter# = 92 MSE = 1.17115882838e+56&#xA;iter# = 93 MSE = 5.24270257235e+56&#xA;iter# = 94 MSE = 2.34690031754e+57&#xA;iter# = 95 MSE = 1.05059194652e+58&#xA;iter# = 96 MSE = 4.7029838883e+58&#xA;iter# = 97 MSE = 2.10529478424e+59&#xA;iter# = 98 MSE = 9.42437021644e+59&#xA;iter# = 99 MSE = 4.2188274365e+60&#xA;iter# = 100 MSE = 1.888561732e+61&#xA;iter# = 101 MSE = 8.45416284324e+61&#xA;iter# = 102 MSE = 3.78451327108e+62&#xA;iter# = 103 MSE = 1.69414062215e+63&#xA;iter# = 104 MSE = 7.58383507211e+63&#xA;iter# = 105 MSE = 3.39491029547e+64&#xA;iter# = 106 MSE = 1.51973451488e+65&#xA;iter# = 107 MSE = 6.80310463229e+65&#xA;iter# = 108 MSE = 3.04541564231e+66&#xA;iter# = 109 MSE = 1.36328293268e+67&#xA;iter# = 110 MSE = 6.10274777838e+67&#xA;iter# = 111 MSE = 2.73190029404e+68&#xA;iter# = 112 MSE = 1.22293751727e+69&#xA;iter# = 113 MSE = 5.47449031869e+69&#xA;iter# = 114 MSE = 2.45066030163e+70&#xA;iter# = 115 MSE = 1.09704019267e+71&#xA;iter# = 116 MSE = 4.91090986188e+71&#xA;iter# = 117 MSE = 2.19837302522e+72&#xA;iter# = 118 MSE = 9.84103576307e+72&#xA;iter# = 119 MSE = 4.40534812697e+73&#xA;iter# = 120 MSE = 1.97205787958e+74&#xA;iter# = 121 MSE = 8.8279340663e+74&#xA;iter# = 122 MSE = 3.95183228069e+75&#xA;iter# = 123 MSE = 1.76904112077e+76&#xA;iter# = 124 MSE = 7.91912779867e+76&#xA;iter# = 125 MSE = 3.54500437301e+77&#xA;iter# = 126 MSE = 1.58692425784e+78&#xA;iter# = 127 MSE = 7.10388009477e+78&#xA;iter# = 128 MSE = 3.18005803689e+79&#xA;iter# = 129 MSE = 1.42355571646e+80&#xA;iter# = 130 MSE = 6.3725594136e+80&#xA;iter# = 131 MSE = 2.85268170471e+81&#xA;iter# = 132 MSE = 1.27700541968e+82&#xA;iter# = 133 MSE = 5.71652574905e+82&#xA;iter# = 134 MSE = 2.55900767029e+83&#xA;iter# = 135 MSE = 1.14554198548e+84&#xA;iter# = 136 MSE = 5.12802855471e+84&#xA;iter# = 137 MSE = 2.29556639488e+85&#xA;iter# = 138 MSE = 1.02761227186e+86&#xA;iter# = 139 MSE = 4.600115177e+86&#xA;iter# = 140 MSE = 2.05924551711e+87&#xA;iter# = 141 MSE = 9.21823027591e+87&#xA;iter# = 142 MSE = 4.12654871475e+88&#xA;iter# = 143 MSE = 1.84725308281e+89&#xA;iter# = 144 MSE = 8.2692443197e+89&#xA;iter# = 145 MSE = 3.70173433491e+90&#xA;iter# = 146 MSE = 1.65708456014e+91&#xA;iter# = 147 MSE = 7.4179532917e+91&#xA;iter# = 148 MSE = 3.32065317374e+92&#xA;iter# = 149 MSE = 1.48649325045e+93&#xA;iter# = 150 MSE = 6.65429982602e+93&#xA;iter# = 151 MSE = 2.97880304275e+94&#xA;iter# = 152 MSE = 1.33346374517e+95&#xA;iter# = 153 MSE = 5.96926192891e+95&#xA;iter# = 154 MSE = 2.67214523867e+96&#xA;iter# = 155 MSE = 1.19618811531e+97&#xA;iter# = 156 MSE = 5.35474639068e+97&#xA;iter# = 157 MSE = 2.39705682923e+98&#xA;iter# = 158 MSE = 1.07304455213e+99&#xA;iter# = 159 MSE = 4.80349317052e+99&#xA;iter# = 160 MSE = 2.1502878509e+100&#xA;iter# = 161 MSE = 9.62578206651e+100&#xA;iter# = 162 MSE = 4.30898962448e+101&#xA;iter# = 163 MSE = 1.92892291303e+102&#xA;iter# = 164 MSE = 8.63484001741e+102&#xA;iter# = 165 MSE = 3.86539356356e+103&#xA;iter# = 166 MSE = 1.73034675467e+104&#xA;iter# = 167 MSE = 7.74591213587e+104&#xA;iter# = 168 MSE = 3.46746423252e+105&#xA;iter# = 169 MSE = 1.55221334723e+106&#xA;iter# = 170 MSE = 6.94849640477e+106&#xA;iter# = 171 MSE = 3.11050039436e+107&#xA;iter# = 172 MSE = 1.39241817794e+108&#xA;iter# = 173 MSE = 6.23317195446e+108&#xA;iter# = 174 MSE = 2.79028478869e+109&#xA;iter# = 175 MSE = 1.24907338653e+110&#xA;iter# = 176 MSE = 5.59148776233e+110&#xA;iter# = 177 MSE = 2.50303430795e+111&#xA;iter# = 178 MSE = 1.12048546167e+112&#xA;iter# = 179 MSE = 5.01586281026e+112&#xA;iter# = 180 MSE = 2.24535530286e+113&#xA;iter# = 181 MSE = 1.00513523332e+114&#xA;iter# = 182 MSE = 4.49949652055e+114&#xA;iter# = 183 MSE = 2.01420348897e+115&#xA;iter# = 184 MSE = 9.01659924941e+115&#xA;iter# = 185 MSE = 4.03628841225e+116&#xA;iter# = 186 MSE = 1.80684798073e+117&#xA;iter# = 187 MSE = 8.08837053258e+117&#xA;iter# = 188 MSE = 3.62076602847e+118&#xA;iter# = 189 MSE = 1.6208390281e+119&#xA;iter# = 190 MSE = 7.25569985564e+119&#xA;iter# = 191 MSE = 3.24802028347e+120&#xA;iter# = 192 MSE = 1.45397907463e+121&#xA;iter# = 193 MSE = 6.50874983818e+121&#xA;iter# = 194 MSE = 2.91364746545e+122&#xA;iter# = 195 MSE = 1.30429679493e+123&#xA;iter# = 196 MSE = 5.83869582521e+123&#xA;iter# = 197 MSE = 2.61369721e+124&#xA;iter# = 198 MSE = 1.17002380499e+125&#xA;iter# = 199 MSE = 5.23762163039e+125&#xA;All Close xiht and x :False&#xA;Mean Squared Error AMP: 5.23762163039e+125&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any advice will be highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1488" LastEditorUserId="128" LastEditDate="2019-06-03T04:26:58.990" LastActivityDate="2019-06-03T04:26:58.990" Title="Iterative Hard Thresholding (Python Implementation)" Tags="|python|thresholding|compressive-sensing|" AnswerCount="2" CommentCount="1" ClosedDate="2014-01-17T18:15:50.760" ContentLicense="CC BY-SA 4.0" />
  <row Id="13756" PostTypeId="1" AcceptedAnswerId="13757" CreationDate="2014-01-13T09:47:11.590" Score="1" ViewCount="262" Body="&lt;p&gt;I have a (rough) known period sine wave coming in, held in an array, with superimposed noise. I need to find and count the maxima and minima (in C). Any suggestions or algorithms? The signal has already been received and buffered, so not real time.&lt;/p&gt;&#xA;" OwnerUserId="7233" LastActivityDate="2014-01-13T10:24:55.323" Title="How to extract the maxima and minima of a noisy period input signal" Tags="|signal-analysis|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13757" PostTypeId="2" ParentId="13756" CreationDate="2014-01-13T10:24:55.323" Score="2" Body="&lt;p&gt;If you have the entire signal, you can then run a Lowess smoothing. This algorithm is statistically robust and provides locally acceptable smoothing. Outliers will be tolerated as well. After smoothing your signal in that way, you might apply a derivative based (or even derivative free) peak detection in order to obtain the signal peaks. These will be your local minima/maxima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use MATLAB or R and port smoothing algorithms to C, they are pretty straightforward and open source:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/curvefit/smooth.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/curvefit/smooth.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here are your options in C:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;a href=&quot;https://code.google.com/p/variationtoolkit/&quot; rel=&quot;nofollow&quot;&gt;https://code.google.com/p/variationtoolkit/&lt;/a&gt; for Lowess/Loess.&#xA;2) For peak detection, there are many tools available in C, one of them being:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/xuphys/peakdetect&quot; rel=&quot;nofollow&quot;&gt;https://github.com/xuphys/peakdetect&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-13T10:24:55.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13758" PostTypeId="1" AcceptedAnswerId="15047" CreationDate="2014-01-13T14:39:32.847" Score="5" ViewCount="1919" Body="&lt;p&gt;I'm having a hard time wrapping my head around doppler and how it affects a digital communications signal's baud rate.  The examples that I've seen explain that the center frequency of a signal is shifted when either the receiver and/or transmitter are moving relative to each other.  What I don't understand is the why doppler also affects baud rate?  Can someone point me to some tutorials on this topic or explain?  What I'd like to understand clearly is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Intuitively understand why this happens?&lt;/li&gt;&#xA;&lt;li&gt;Mathematically understand why this happens? &lt;/li&gt;&#xA;&lt;li&gt;I'd like to be able to calculate when this is something that a communications receiver has to take into account?  My guess is that based on the doppler shift that will be experienced by the receiver, in combination with the signal's baud rate, but I guess I need some hints or help to get me along with this.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is a follow-up to this question already posted: &lt;a href=&quot;https://dsp.stackexchange.com/questions/422/how-to-estimate-and-compensate-for-doppler-shift-in-wireless-signals&quot;&gt;How to estimate and compensate for doppler shift in wireless signals?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7323" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2020-01-21T20:00:54.727" Title="Doppler effect on Baud Rate" Tags="|digital-communications|demodulation|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13759" PostTypeId="2" ParentId="13736" CreationDate="2014-01-13T14:53:59.713" Score="5" Body="&lt;p&gt;I would window and then zero-pad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of the window is to smooth out the boundary transitions.  When you zero-pad you are introducing a very abrubt transition at the zero-pad point which, if you want the window to be effective, is where the smoothed out transition should happen.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-01-13T14:53:59.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13760" PostTypeId="2" ParentId="11313" CreationDate="2014-01-13T15:02:59.363" Score="2" Body="&lt;p&gt;Starting with your original signal $s(t)$, we designate $u(t)$ and $l(t)$ as the curves for the upper and lower portions of the envelope respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You find the upper curve of the envelope, $u(t)$, by picking out the local maximums of $s(t)$ and then connect them using splines to get a continuous representation of the curve. You find the lower curve of the envelope, $l(t)$, by picking out the local minimums of $s(t)$ and connecting these points via splines to get a representation of the lower portion of the envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The curve $m(t)$ comes from averaging the upper and lower portions of the envelope i.e. $m(t)=\frac{l(t)+u(t)}{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Handling the end points and how the splines fit these points is problematic. There are several papers trying to address this issue and the results of the EMD are very dependent on how the end points are handled. So if you are trying to duplicate the results of a specific paper - you'll need the exact code that they used (to handle the end points in the same manner).&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-13T15:02:59.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13761" PostTypeId="1" CreationDate="2014-01-13T16:22:18.757" Score="4" ViewCount="94" Body="&lt;p&gt;I have a handwritten document which contains graphics, tables, and text paragraphs.&#xA;I know how to extract graphics from this document. Now I want to know how can I discriminate between text lines and table rows, if I have already segmented the document into lines?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see an example of a document image below: in red is the graphic part. That which is framed in blue represents the table row, but there is no ruling line in the table. I want to discriminate between line text and table row using line layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rzOzC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7546" LastEditorUserId="76" LastEditDate="2014-01-14T01:06:10.623" LastActivityDate="2015-03-06T13:56:05.777" Title="What are the optimal features for text line and table row discrimination in a handwritten document image?" Tags="|image-segmentation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13762" PostTypeId="2" ParentId="13736" CreationDate="2014-01-13T16:23:17.257" Score="4" Body="&lt;p&gt;You must window your data, &lt;em&gt;before&lt;/em&gt; zero-padding. The point of the windowing process is to smooth out the end-points of your data prior to taking the FFT, so that we reduce spectral leakage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you zero-pad and then window, you are making the implicit statement that all the zeros you added are part of your data, which is incorrect.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastActivityDate="2014-01-13T16:23:17.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13763" PostTypeId="1" CreationDate="2014-01-13T16:26:51.793" Score="1" ViewCount="76" Body="&lt;p&gt;What are the best ways to estimate the power spectrum of a given time series?  Any pointers to review articles or book chapters would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little more information: When estimating a power spectrum from a time series, I typically use Welch's method (matlab command pwelch) with the default parameters.  My understanding is that this is standard practice in the community, but that it became so in the days when computing power was limited.  With modern computing abilities, are there better (more accurate) ways to estimate a power spectrum? What are the differences between the methods?&lt;/p&gt;&#xA;" OwnerUserId="7540" LastActivityDate="2014-01-13T16:26:51.793" Title="Estimating a Power Spectrum from a Time Series" Tags="|fft|power-spectral-density|" AnswerCount="0" CommentCount="1" FavoriteCount="0" ClosedDate="2014-01-13T19:06:20.213" ContentLicense="CC BY-SA 3.0" />
  <row Id="13764" PostTypeId="1" AcceptedAnswerId="13795" CreationDate="2014-01-13T16:38:36.240" Score="2" ViewCount="3302" Body="&lt;p&gt;I have a chemical spectrum with amplitude on the &lt;code&gt;Y&lt;/code&gt; axis and wavenumbers on the &lt;code&gt;X&lt;/code&gt; axis, sampling interval I think this is $1.5^{10}$ hertz. I would like to reconstruct the amplitude/time representation of the original signal by performing a &lt;code&gt;ifft&lt;/code&gt; of the signal however I have no phase information. Since the information is unchanging (constant) over time I don't think that the phase information is necessary for reconstruction of the original signal. Can I set the phase information to zero and still reconstruct the signal in this case and how do I incorporate the sampling interval in the matlab ifft routine for accurate frequency calculation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I think I should be using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sig = abs(ifftshift(ifft(complex(data.YData))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dave&lt;/p&gt;&#xA;" OwnerUserId="7545" LastEditorUserId="7092" LastEditDate="2014-01-13T19:04:57.427" LastActivityDate="2014-01-15T13:38:51.683" Title="ifft of signal without phase information" Tags="|matlab|ifft|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13765" PostTypeId="2" ParentId="13764" CreationDate="2014-01-13T16:58:37.357" Score="3" Body="&lt;p&gt;This is tricky. The phase information impacts the time domain form very much. For example white noise and a delta impulse have exactly the same amplitude spectrum, the only difference is in the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without any further assumptions or extra knowledge this can't be done. For example if you know that the signal is stationary, you could just try a random phase. If it's the impulse response of a causal system, you could try a minimum phase. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-01-13T16:58:37.357" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13766" PostTypeId="2" ParentId="13755" CreationDate="2014-01-13T18:46:07.783" Score="7" Body="&lt;p&gt;I'm by no means an expert in this, but I find the subject of compressed sensing very interesting, so I thought it'd be fun to play around with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe your error is in the generation of your sampling matrix, $\Phi$. According to the paper you reference &quot;&lt;em&gt;The convergence of this algorithm was proven in [1] under the condition that $\|\Phi\|_2 &amp;lt; 1$ .&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take the norm of your matrix &lt;em&gt;A&lt;/em&gt;, you'll find that it's above 1, and that if you scale it such that the norm goes below 1 then your program will converge (actually, I found that as long as the norm of A was below about 2.8 it would converge, which I've yet to understand).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that's helpful!&lt;/p&gt;&#xA;" OwnerUserId="7509" LastActivityDate="2014-01-13T18:46:07.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13767" PostTypeId="2" ParentId="10736" CreationDate="2014-01-13T19:07:21.840" Score="4" Body="&lt;p&gt;The $\sigma$ decides the scale of objects being simplified. This is explained &lt;a href=&quot;http://en.wikipedia.org/wiki/Canny_edge_detector&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The size of the Gaussian filter: the smoothing filter used in the first stage directly affects the results of the Canny algorithm. Smaller filters cause less blurring, and allow detection of small, sharp lines. A larger filter causes more blurring, smearing out the value of a given pixel over a larger area of the image. Larger blurring radii are more useful for detecting larger, smoother edges – for instance, the edge of a rainbow.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thus the support size of the Gaussian function decides the level of details that are simplified. Simplest way is to test with binary squares/circles.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="1273" LastEditDate="2014-01-14T09:22:01.570" LastActivityDate="2014-01-14T09:22:01.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13768" PostTypeId="2" ParentId="3060" CreationDate="2014-01-13T19:23:54.343" Score="0" Body="&lt;p&gt;There is a benchmark code and test and learning dataset to perform image segmentation with ground truth dataset at &lt;a href=&quot;http://www.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/&quot; rel=&quot;nofollow&quot;&gt;Berkeley website&lt;/a&gt; and the &lt;a href=&quot;http://www.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/code/segbench.tar.gz&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt; in the same place.&lt;/p&gt;&#xA;" OwnerUserId="5886" LastEditorUserId="5886" LastEditDate="2014-01-14T10:03:34.923" LastActivityDate="2014-01-14T10:03:34.923" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13769" PostTypeId="2" ParentId="10736" CreationDate="2014-01-13T19:26:14.987" Score="2" Body="&lt;p&gt;For better understanding of $\sigma$ I would suggest reading some about the scale spaces.&#xA;Some reading recommendations may be found here: &#xA;&lt;a href=&quot;http://www.csc.kth.se/~tony/earlyvision.html&quot; rel=&quot;nofollow&quot;&gt;http://www.csc.kth.se/~tony/earlyvision.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-13T19:26:14.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13770" PostTypeId="1" CreationDate="2014-01-13T22:53:19.600" Score="1" ViewCount="896" Body="&lt;p&gt;I might be going crazy here. Following my question: &lt;a href=&quot;https://dsp.stackexchange.com/questions/13749/why-are-the-frequencies-associated-with-the-stft-bins-not-representative-of-the&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some thinking and probably understood that my STFT algorithm was not performing correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed this algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt; Get 256 of data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt; Apply windowing function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt; Get the FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt; get the first 128 points &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my result. I have used &lt;code&gt;NFFT = 256&lt;/code&gt; which should give me &lt;code&gt;128&lt;/code&gt; points. I firstly calculated the FFT (after the windowing function was applied) and only counted the first &lt;code&gt;128&lt;/code&gt; values of this. I.e. &lt;code&gt;FFT_RESULT / 2&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p8u6d.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas my last output was the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wqlxt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't quite understand why the values along the &lt;code&gt;X axis&lt;/code&gt; are particular that high?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so following the advice, I did the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Created a 2D vector for each of the &quot;256 resulting FFT values&quot; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for(size_t i=0; (i &amp;lt; signal.size()); i++)&#xA;{&#xA;    std::vector&amp;lt;double&amp;gt; temp_vector;&#xA;    // store blocks of 256 inside temp_vector &#xA;&#xA;    // Compute Hanning Window &#xA;&#xA;    // Compute FFT&#xA;&#xA;    std::vector&amp;lt;std::vector&amp;lt;complex&amp;gt; stft; &#xA;&#xA;    stft.push_back(temp_vector);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gave me a total of 74 blocks within the 2D vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then took the absolute value of the REAL values and stored these inside a double, read these in and with &lt;code&gt;pylab&lt;/code&gt; library I used &lt;code&gt;imshow()&lt;/code&gt; and got the following result: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W2niK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, If I plot normally, I get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lOMjE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think my calculations are correct, I just don't think I'm plotting them right using the spectrogram!! &lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-01-14T03:06:53.547" Title="STFT - Plotting is not a true representation" Tags="|fft|stft|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13771" PostTypeId="2" ParentId="13770" CreationDate="2014-01-13T22:59:42.057" Score="0" Body="&lt;p&gt;Your calculations are correct, but that's not how you plot STFT. If you think about it, you're trying to plot three-dimensional data, namely value that is a function of both time and frequency. To represent three-dimensional data we use images rather than graphs. Vertical and horizontal coordinates represent frequency and time respectively, and pixel color or intensity represents FFT magnitude of a specific frequency at a specific time. We call these images &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;nofollow&quot;&gt;spectrograms&lt;/a&gt;&lt;/em&gt;. MATLAB Signal Processing Toolbox comes with a &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;spectrogram&lt;/code&gt;&lt;/a&gt; command which lets you plot spectrograms.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-01-13T22:59:42.057" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="13772" PostTypeId="2" ParentId="13770" CreationDate="2014-01-14T03:06:53.547" Score="2" Body="&lt;p&gt;Regarding your first 2 plots: for FFT results, the X axis is usually labeled with the FFT_bin_index * sample_rate / FFT_length, and the Y axis with either the magnitude (absolute value of the complex bin value), or the log magnitude of the FFT result bin.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-14T03:06:53.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13773" PostTypeId="2" ParentId="10736" CreationDate="2014-01-14T09:58:07.070" Score="1" Body="&lt;p&gt;One more thing to add is that an &lt;strong&gt;edge&lt;/strong&gt; detection is usually defined more or less like &lt;a href=&quot;http://en.wikipedia.org/wiki/Edge_detection&quot; rel=&quot;nofollow noreferrer&quot;&gt;from Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Identifying points in a digital image at which the &lt;strong&gt;image brightness changes sharply&lt;/strong&gt; or, more formally, has discontinuities.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They have a nice illustration:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XQZEz.png&quot; alt=&quot;Edge&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the edge is between $4$th and $5$th pixel (or, between $3$rd and $4$th, if you count $0$-based). (because the gradient is &lt;code&gt;2 1 2 148 4 1&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to say, is that what you refer to as &quot;thick&quot; edges, will most likely be detected as &lt;em&gt;two edges&lt;/em&gt;. As an example, take a look at these example images from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Canny_edge_detector&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia Canny page&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yR0L9.png&quot; alt=&quot;Original&quot;&gt;  &lt;img src=&quot;https://i.stack.imgur.com/j3Wzf.png&quot; alt=&quot;EdgeDet&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the bars going out of the valve (the long thin white structures), and note how in the edge detection result, they are detected as two lines (outer and inner edge).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can, of course, be avoided, combining the blurring (the $\sigma$ parameter) and some &lt;a href=&quot;http://en.wikipedia.org/wiki/Edge_detection#Edge_thinning&quot; rel=&quot;nofollow noreferrer&quot;&gt;edge thinning&lt;/a&gt; techniques. After you blur the image, what was once a wide, sharp edge having just one peak in gradient will now have a gradient &lt;em&gt;slowly reaching maximum and then slowly dropping towards zero&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there was no blurring, the gradient would be e.g.&lt;br&gt;&#xA;&lt;code&gt;2 1 3 130 4 2 3 111 2 0 2&lt;/code&gt;.&#xA;&lt;br&gt; After blurring, the gradient might look like:&lt;br&gt;&#xA; &lt;code&gt;2 1 2 50 85 120 94 63 12 2 0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the after-blurring the edge detector will detect a $5px$ long edge. If you want to get just the location of the edge marked by $1px$ wide line, the edge supressing technique is what finds the &quot;maximum&quot; in your blurred-edge gradient and marks the middle pixel (e.g. one with gradient $120$) as the actual edge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2014-01-14T09:58:07.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13774" PostTypeId="1" CreationDate="2014-01-14T10:30:29.570" Score="0" ViewCount="1559" Body="&lt;p&gt;Having some trouble understanding this concept, really could do with some advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want my STFT to have the following parameters: &lt;code&gt;NFFT = 256&lt;/code&gt; &lt;code&gt;overlap/hop = 128&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now essentially, the algorithm will work as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Split the signal into blocks of 256 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will result in around &lt;code&gt;72*265&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2) For each of these blocks, calculate against the Hanning Window &#xA;&#xA;3) Create a &quot;slider&quot; that does an overlap of 128.. So, in theory it would &#xA;   therefore be: `size = 256 + 128` &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Therefore, when I'm computing the DFT for each of the overlapped blocks, will my FFT remain at size 256 or will the size be &lt;code&gt;256 + 128&lt;/code&gt; If this is the case, does each block in the resulting vector still have to be of size 256?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is now my result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/K3Hjj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, compare this to a spectrogram in &lt;code&gt;matplotlib&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Chyvn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where am I actually going wrong? I cannot make any sense of this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked bat through all the data, the blocks are correctly overlapping, Hanning window is being applied correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could it be to do with the fact I'm using a 1D DFT? I.e. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;std::vector&amp;lt;complex&amp;gt; FFT-&amp;gt;transform(complex_vector[0...n], 256);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="5182" LastEditDate="2014-01-14T19:51:26.287" LastActivityDate="2014-01-14T19:51:26.287" Title="STFT - DFT size of the bins" Tags="|dft|stft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13776" PostTypeId="2" ParentId="13774" CreationDate="2014-01-14T12:06:27.160" Score="1" Body="&lt;p&gt;The overlap is the way that you walk on your signal to be analyzed, lets go to an simple example, imagine that your signal &lt;code&gt;X&lt;/code&gt; has a length = 14, &lt;code&gt;NFFT = 4&lt;/code&gt; and &lt;code&gt;overlap/hop = 2&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = 1 2 3 4 5 6 7 8 9 10 11 12 13 14&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To know the number of blocks of analysis you will:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int(n_samples/Overlap) - 1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then for this example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(14/2)-1 = 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;lets get 4 points from &lt;code&gt;X&lt;/code&gt; to pass to your &lt;code&gt;FFT&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the first time you get from &lt;code&gt;X&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X2 = 1 2 3 4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from now you need overlap by 2&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X2 = 3 4 5 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Third time&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X2 = 5 6 7 8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;fourth time&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X2 = 7 8 9 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;fifth time&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X2 = 9 10 11 12&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;sixth time&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X2 = 11 12 13 14&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2014-01-14T12:06:27.160" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13777" PostTypeId="2" ParentId="6223" CreationDate="2014-01-14T14:20:51.640" Score="0" Body="&lt;p&gt;I guess you have minus signs on the output, which prevent the result from appearing correctly. Clip your output so that the results are between [0, 255].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The numerical solver works in floating point precision and doesn't respect the byte image constraint. So you have to post-process your numerical result. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-14T14:20:51.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13778" PostTypeId="2" ParentId="13764" CreationDate="2014-01-14T14:31:11.853" Score="1" Body="&lt;p&gt;You cannot reconstruct the time domain signal without the phase information, unless you make further assumptions about your signal. One set of assumptions is whether the signal is minimum or maximum phase - with those assumptions you could reconstruct the signal uniquely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the phase of a particular frequency component may not be important, what is important is the phase relationship between the different frequency components. If you changed the phase at different frequencies, you will end up with wildly different time domain responses.&#xA;Consider the following signal:&#xA;$$s(t) = \sin(2\pi f_1t) + 0.5\sin(2\pi f_2t +\phi)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think of having a dial which changes the value of $\phi$, then as you change it the resulting signal will also change.  The situation gets even more complication when you add multiple sinusoids at different frequencies and each one has it's own phase.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-14T14:31:11.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13779" PostTypeId="1" AcceptedAnswerId="13787" CreationDate="2014-01-14T14:43:40.670" Score="1" ViewCount="704" Body="&lt;p&gt;I was reading on windowed fourier transform and wavelet transform, and i was thinking that the windowed fourier transform is a subset of wavelet transform. Is that true?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2014-01-15T06:41:51.420" Title="Relationship between windowed fourier transform and wavelet transform" Tags="|wavelet|stft|time-frequency|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13780" PostTypeId="1" AcceptedAnswerId="13788" CreationDate="2014-01-14T15:10:10.207" Score="3" ViewCount="514" Body="&lt;p&gt;A device is rotating with a particular wind speed and producing such pulse frequencies in a minute: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;24.988 25.224 25.212 25.066 25.310 24.963 24.826 24.944 25.490 25.176 24.740 24.988   &#xA;24.994 24.722 24.510 24.863 25.249 24.931 25.218 24.907 25.459 25.292 25.163 25.447 &#xA;25.072 25.360 24.976 25.103 25.237 24.845 25.237 25.206 25.109 24.969 24.976 25.194 &#xA;25.218 24.975 24.777 24.832 24.564 24.637 24.919 24.931 24.944 24.994 25.378 25.042&#xA;25.182 25.151 25.097 25.103 25.030 25.018 24.783 24.722 24.667 24.963    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it possible to understand what type of distribution is this and plot it? Each number is the average of frequency for a second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each number is the mean pulse frequency for &lt;code&gt;1&lt;/code&gt; second in Hz. So I want to see how are these frequencies distributed.&lt;/p&gt;&#xA;" OwnerUserId="7555" LastEditorUserId="7092" LastEditDate="2014-01-14T19:12:07.770" LastActivityDate="2014-01-15T19:41:53.370" Title="How to determine, calculate and plot a probability distribution for a given set of numbers?" Tags="|discrete-signals|signal-analysis|estimation|statistics|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13782" PostTypeId="2" ParentId="13779" CreationDate="2014-01-14T16:17:00.927" Score="0" Body="&lt;p&gt;Wavelets commonly factor the frequency of the basis vectors into their temporal widths, some with more than one temporal location.  Windowed FFTs fix the temporal width of each basis vector to the length of the FFT, thus independent of any bin frequency, and with the basis location fixed to the center of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose one could consider the FFT to be similar to a wavelet transform with a bad set of wavelets (too many high frequency ones and with poor temporal/locality resolution, and too few low ones and with poor frequency resolution).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-14T16:17:00.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13783" PostTypeId="2" ParentId="13774" CreationDate="2014-01-14T16:30:03.993" Score="1" Body="&lt;p&gt;For a non-zero overlap, the size of each FFT will remain exactly the same.  However some of the data points used in each successive FFT will be from the previous FFT window, thus allowing less completely new data points to make up the final length to be fed to that successive FFT.  Thus more overlap will create a larger number of blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an overlap of 128, the 2nd FFT uses 128 points from the end of the first FFT, and adds 128 new points from the data stream, to make up a total of 256 data points, the same length as the first FFT.  Rinse and repeat.  The number of blocks for 50% overlap will approach double that of the number for zero overlap.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-01-14T16:36:24.220" LastActivityDate="2014-01-14T16:36:24.220" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13785" PostTypeId="1" CreationDate="2014-01-14T16:45:42.750" Score="5" ViewCount="2281" Body="&lt;p&gt;I am trying to replicate the spetrum as given in Audacity and other commercial software... I am getting crazy with the correct scaling needed in order to have dBFS (with reference to a full scale sine wave).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose $x_t$ is the PCM sample at $k$ bit precision, first of all I rescale the PCM samples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s_t =  \frac{x_t}{  \frac{ 2^{k-1} }{ \sqrt{2}  }  }&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose now $w_t$ is some window function, I compute the FFT of of size N of the product $s_t w_t$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $P_1, P_2, \ldots, P_N$ be the FFT complex values. Since I am only interested in one-side spectrum, I just retain the fist half of the sequence. Moreover suppose for simplicity that the time series matches the window size $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;p_i = 2\left| \frac{P[i]}{N}\right|^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $i=1,2,\ldots, N/2-1$ should give the power spectrum values. Then one would take $10\log_{10}(p_i)$ to get dBFS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I think that in order to express dBFS one needs to scale the $p_i$ in some way taking into account the effect of the window. In fact  I produced a pure 1KHz sine wave then I computed my spectrum and compared it with that obtained with Audacity,  Adobe Audition etc. My FFT stays below by few dBFS so I think it's really a problem of scaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope somebody knows if there is a standard ways of doing that!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&#xA;Pierre&lt;/p&gt;&#xA;" OwnerUserId="7557" LastActivityDate="2022-06-27T13:21:19.717" Title="dBFS scaling and spectrum" Tags="|frequency-spectrum|dbfs|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13786" PostTypeId="2" ParentId="13785" CreationDate="2014-01-14T17:01:31.147" Score="1" Body="&lt;p&gt;Here's a &lt;a href=&quot;http://edoc.mpg.de/395068&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; with a pretty thorough explanation of proper scaling in order to obtain the power spectrum or power spectral density. Essentially N should be the ENBW or the sum of the window squared.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-14T17:01:31.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13787" PostTypeId="2" ParentId="13779" CreationDate="2014-01-14T17:57:04.387" Score="-1" Body="&lt;p&gt;Define the Fourier transform as   $$ x(t) = \mathcal{F}^{-1}\big\{ X(\omega) \big\} \triangleq\frac{1}{2 \pi} \int_{-\infty}^{\infty} X(\omega) e^{j\omega t} \ d\omega $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and   $$ X(\omega) = \mathcal{F}\big\{ x(t) \big\} = \int_{-\infty}^{\infty} x(t) e^{-j\omega t} \ dt $$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define the real-valued and non-negative window function $w(t) \ge 0$: $$ \int_{-\infty}^{\infty} w^2(u) \ du = \int_{-\infty}^{\infty} \frac{1}{a} w^2\left( \frac{u}{a} \right) \ du = \int_{-\infty}^{\infty} \frac{1}{a} w^2\left( \frac{t-\tau}{a} \right) \ d\tau \triangleq \frac{c_g}{2 \pi} \quad \forall a \ne 0 \quad \forall t$$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Call this Eq (1): $$ \begin{align}&#xA;x(t) &amp;amp; = x(t) \left[ \frac{2 \pi}{c_g} \int_{-\infty}^{\infty} \frac{1}{a} w^2\left( \frac{t-\tau}{a} \right) \ d\tau \right] \\&#xA;&amp;amp; =  \frac{2 \pi}{c_g} \int_{-\infty}^{\infty} \left[ x(t)  \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \right] \ \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \ d\tau \\&#xA;\end{align}  \quad \forall a&amp;gt;0 $$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define the Short-Time Fourier Transform (STFT) as $$ X_{a,\tau}(\omega) \triangleq \mathcal{F}\left\{ x(t)  \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \right\} = \int_{-\infty}^{\infty} x(t)  \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) e^{-j\omega t} \ dt  $$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that $$  x(t)  \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) = \mathcal{F}^{-1}\big\{ X_{a,\tau}(\omega) \big\} = \frac{1}{2 \pi} \int_{-\infty}^{\infty} X_{a,\tau}(\omega) e^{j\omega t} \ d\omega  $$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Eq (1), $$ \begin{align}&#xA;x(t) &amp;amp; =  \frac{2 \pi}{c_g} \int_{-\infty}^{\infty} \left[ x(t)  \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \right] \ \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \ d\tau \\&#xA;&amp;amp; =  \frac{2 \pi}{c_g} \int_{-\infty}^{\infty} \left[ \frac{1}{2 \pi} \int_{-\infty}^{\infty} X_{a,\tau}(\omega) e^{j\omega t} \ d\omega \right] \ \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \ d\tau \\&#xA;&amp;amp; =  \frac{1}{c_g} \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} X_{a,\tau}(\omega) e^{j\omega t} \ \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right)  \ d\omega \ d\tau \\&#xA;&amp;amp; =  \frac{1}{2 \pi} \int_{-\infty}^{\infty} \left[ \frac{2 \pi}{c_g} \int_{-\infty}^{\infty} X_{a,\tau}(\omega) \ \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \ d\tau \right] \ e^{j\omega t} \ d\omega \\&#xA;&amp;amp; =  \frac{1}{2 \pi} \int_{-\infty}^{\infty} X(\omega) \ e^{j\omega t} \ d\omega \\&#xA;\end{align}  $$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that $$ X(\omega) = \frac{2 \pi}{c_g} \int_{-\infty}^{\infty} X_{a,\tau}(\omega) \ \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \ d\tau \quad \forall a&amp;gt;0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is true for all $a&amp;gt;0$, we choose $a=\frac{1}{\omega}$ which means $$ X(\omega)=0 \quad \forall \omega \le 0 $$ and consequently $$ \Im\big[ x(t) \big] = \mathcal{H} \left\{ \Re\big[ x(t) \big] \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathcal{H} \{ \cdot \} \ $  is the Hilbert Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have $$ x(t) = \frac{1}{c_g} \int_{-\infty}^{\infty} \int_{0}^{\infty} X_{1/\omega,\tau}(\omega) e^{j\omega t} \ \sqrt{\omega} w\left( \omega (t-\tau) \right)  \ d\omega \ d\tau $$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting in the integral: $\frac{1}{a} \rightarrow \omega$ and $\frac{-1}{a^2} da \rightarrow d\omega$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x(t) &amp;amp; = \frac{1}{c_g} \int_{-\infty}^{\infty} \int_{0}^{\infty} X_{a,\tau}\left(\frac{1}{a}\right) e^{j\frac{t}{a}} \ \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) \frac{1}{a^2} \ da \ d\tau \\&#xA; &amp;amp; = \frac{1}{c_g} \int_{-\infty}^{\infty} \int_{0}^{\infty} \left[ X_{a,\tau} \left(\frac{1}{a}\right) e^{j\frac{\tau}{a}} \right]  \ \left[ \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) e^{j\frac{t-\tau}{a}} \right] \frac{1}{a^2} \ da \ d\tau \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $$ g_{a,\tau}(t) \triangleq  \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) e^{j\frac{t-\tau}{a}} $$ is the Wavelet,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ g(t) \triangleq g_{1,0}(t) = w(t) e^{jt} $$ is the Mother Wavelet, and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ g_{a,\tau}(t) = \frac{1}{\sqrt{a}} g\left( \frac{t-\tau}{a} \right) $$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; X_{a,\tau} \left(\frac{1}{a}\right) e^{j\frac{\tau}{a}} &amp;amp; = \int_{-\infty}^{\infty} x(t)  \frac{1}{\sqrt{a}} w\left( \frac{t-\tau}{a} \right) e^{-j\frac{t-\tau}{a}} \ dt \\&#xA;&amp;amp; = \int_{-\infty}^{\infty} x(t) \ g_{a,\tau}^*(t) \ dt \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is the Continuous Wavelet Transform of $x(t)$.  The scaler $c_g$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ c_g = 2 \pi \int_{-\infty}^{\infty} w^2(t) \ dt = 2 \pi \int_{-\infty}^{\infty} \big| g(t) \big|^2 \ dt = \int_{-\infty}^{\infty} \big| G(\omega) \big|^2 \ d\omega $$ .&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-01-15T06:41:51.420" LastActivityDate="2014-01-15T06:41:51.420" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13788" PostTypeId="2" ParentId="13780" CreationDate="2014-01-14T18:29:53.960" Score="1" Body="&lt;p&gt;In Matlab that would look like the code below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your data set is very small, it'll be difficult to get an accurate estimation of the PDF. The more data you have, the better your estimate can get and the smaller you can make the intervals. To get the actual PDF you'd have to normalize to the interval width.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% data&#xA;x = [24.988 25.224 25.212 25.066 25.310 24.963 24.826 24.944 25.490 25.176 24.740 24.988   ...&#xA;24.994 24.722 24.510 24.863 25.249 24.931 25.218 24.907 25.459 25.292 25.163 25.447 ...&#xA;25.072 25.360 24.976 25.103 25.237 24.845 25.237 25.206 25.109 24.969 24.976 25.194 ...&#xA;25.218 24.975 24.777 24.832 24.564 24.637 24.919 24.931 24.944 24.994 25.378 25.042...&#xA;25.182 25.151 25.097 25.103 25.030 25.018 24.783 24.722 24.667 24.963    ];&#xA;&#xA;% create sum suitable bins&#xA;bins = 24.5:.1:25.4;&#xA;[count, intervals ] = hist(x,10); % 10 intervals;&#xA;clf;&#xA;bar(intervals, count);&#xA;grid('on');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-01-14T18:29:53.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13789" PostTypeId="2" ParentId="13780" CreationDate="2014-01-14T19:10:34.077" Score="3" Body="&lt;p&gt;A &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_density_estimation&quot; rel=&quot;nofollow noreferrer&quot;&gt;kernel density estimation&lt;/a&gt; based on your data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J8GvZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depend on your programming language, you may find the corresponding fitting functions with different distributions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/34943-fit-all-valid-parametric-probability-distributions-to-data/content/allfitdist.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;allfitdist function&lt;/a&gt; with statistic toolbox in Matlab in your data fitting. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = [24.988 25.224 25.212 25.066 25.310 24.963 24.826 24.944 25.490 25.176 24.740 24.988   ...&#xA;24.994 24.722 24.510 24.863 25.249 24.931 25.218 24.907 25.459 25.292 25.163 25.447 ...&#xA;25.072 25.360 24.976 25.103 25.237 24.845 25.237 25.206 25.109 24.969 24.976 25.194 ...&#xA;25.218 24.975 24.777 24.832 24.564 24.637 24.919 24.931 24.944 24.994 25.378 25.042...&#xA;25.182 25.151 25.097 25.103 25.030 25.018 24.783 24.722 24.667 24.963    ];&#xA;&#xA;[D PD] = allfitdist(x,'PDF');  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the fitted probability density is not good enough:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gnugx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The curves for each possible distribution are all overlapped. Like I mentioned yesterday, you may need more sample number to obtain a better estimation.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="80" LastEditDate="2014-01-15T19:41:53.370" LastActivityDate="2014-01-15T19:41:53.370" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13790" PostTypeId="2" ParentId="13780" CreationDate="2014-01-14T19:24:54.907" Score="1" Body="&lt;p&gt;Yes, just plot a histogram. If you have MATLAB, you can then use trapz to convert the count in each bin to a probability. Play around with the number of bins until you get something that looks reasonable. It should be noted, that you may not have enough data for a good representation of the PDF.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-14T19:24:54.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13791" PostTypeId="2" ParentId="6223" CreationDate="2014-01-14T20:08:42.293" Score="2" Body="&lt;p&gt;The Poisson equation may suffer from ill-posedness if the boundary condition is not suﬃcient to yield a unique solution to the problem. The most often used boundary condition is Dirichlet boundary condition, in which the values of $I(x,y)$ are specified for those points $(x,y)$ on the boundary of $I$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, after you stretch your solution to another scale, you got the correct solution. It is possible the solution to your Poisson equation is not unique, and your algorithm just found out the correct one based on some restrained part (such as minimal norm of least square) in the optimization. It is &lt;strong&gt;much much more&lt;/strong&gt; possible that it is already sufficient to determine $I(x,y)$ up to an arbitrary additive constant, and this constant is determined by the solution of Laplacian equation: $$\nabla^{2}\hat I= 0$$ &lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-01-14T20:22:55.383" LastActivityDate="2014-01-14T20:22:55.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13792" PostTypeId="2" ParentId="10267" CreationDate="2014-01-14T20:37:52.703" Score="6" Body="&lt;p&gt;Keep in mind, L1 is not the only approach to compressive sensing.  In &lt;a href=&quot;http://www2.ece.ohio-state.edu/~schniter/research.html&quot;&gt;our research&lt;/a&gt;, we've had better success with Approximate Message Passing (AMP).  I am defining &quot;success&quot; as lower error, better phase transitions (ability to recover with fewer observations), and lower complexity (both memory and cpu).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Approximate Message Passing algorithm establishes a Bayesian framework to estimate the unknown vectors in a large scale linear system where the inputs and outputs of the linear system are determined by probablistic models (e.g. &quot;this vector was measured with noise&quot;, &quot;this vector has some zeros&quot;).  The original &lt;a href=&quot;http://www.stanford.edu/~montanar/RESEARCH/FILEPAP/mpacs.pdf&quot;&gt;AMP approach forged by Donoho&lt;/a&gt; has been refined by &lt;a href=&quot;http://arxiv.org/abs/1010.5141&quot;&gt;Rangan&lt;/a&gt; into &lt;em&gt;Generalized&lt;/em&gt; Approximate Message Passing with &lt;a href=&quot;http://gampmatlab.wikia.com/wiki/Generalized_Approximate_Message_Passing&quot;&gt;Matlab code available&lt;/a&gt;. The inputs and outputs can be almost arbitrary probability density functions.  In our research , we've found that GAMP is typically faster, more accurate, and more robust (read: better phase transition curves) than the L1 convex approaches and greedy approaches (e.g. Orthogonal Matching Pursuit). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My advisor and I just wrote &lt;a href=&quot;http://arxiv.org/pdf/1312.3968.pdf&quot;&gt;a paper&lt;/a&gt; on using GAMP for Analysis CS, where one expects an abundance of zeros, not in the unknown vector x, but rather in a linear function of that unknown, Wx. &lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-01-14T20:37:52.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13793" PostTypeId="1" CreationDate="2014-01-14T20:55:55.933" Score="4" ViewCount="1564" Body="&lt;p&gt;I'm doing pattern matching by means of normalized grey-scale correlation. My input image is noisy and so the peaks in the correlation plot cannot be found just by thresholding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original correlation plot displayed as a surface, the peaks are visible, but are not the only local maxima in the picture, I need to find only the ones that are cone-shaped. Note that I know how many I'm looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zf0jJ.png&quot; alt=&quot;original correlation plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed that if I calculated the local gradient of the correlation plot, the peaks appear clearly on visual inspection, especially on the gradient orientation plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gradient orientation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dPR8R.png&quot; alt=&quot;gradient orientation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a way to automatically detect the exact position of the peaks (2 in this case, but it is sometimes more) with a one pixel accuracy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I guess would help me is a way to identify the center pixel towards which the gradient direction points from all around. The center of the radial gradient, otherwise said.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to generate an ideal radial gradient such as this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zKXqn.png&quot; alt=&quot;ideal gradient&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and fit it to the image by moving correlation but with no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does someone have an idea? I'm certainly not the first one needing this kind of method, but I couldn't find anything in the literature, am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I found someone who had a similar question &lt;a href=&quot;https://dsp.stackexchange.com/q/3016/7560&quot;&gt;here&lt;/a&gt; but couldn't find a satisfactory answer.&lt;/p&gt;&#xA;" OwnerUserId="7560" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-01-15T14:09:33.580" Title="Detecting peaks in a noisy 2D correlation plot" Tags="|image-processing|object-recognition|peak-detection|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13794" PostTypeId="1" CreationDate="2014-01-14T22:10:25.637" Score="0" ViewCount="63" Body="&lt;p&gt;If I have the discrete Hartley transform of a signal of length 2&lt;sup&gt;n&lt;/sup&gt;, how can I use it to efficiently obtain the discrete Hartley transform of the same signal padded to length 2&lt;sup&gt;n+m&lt;/sup&gt; for some m &gt; 0?&lt;/p&gt;&#xA;" OwnerUserId="310" LastActivityDate="2014-02-13T23:26:24.007" Title="Computing Hartley transform of zero-padded signal from transform of original signal?" Tags="|zero-padding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13795" PostTypeId="2" ParentId="13764" CreationDate="2014-01-14T22:55:06.697" Score="3" Body="&lt;p&gt;Human perception of sound does not depend very much on the phase, this was once used in the VOCODER to compress long distance telephone communications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your general idea should work, only that the shape of the signal is arbitrary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you check the documentation,  would think that one applies ifftshift before ifft to mirror the application of fftshift after fft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But probably you need a different kind of preparation: Assuming that the Y[k] represent the amplitude of the frequency &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X[k]=k/N*fs/2, k=0,...,N-1, &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where N is the length of the array and fs the sampling frequency. Then you need to double the length of Y and set &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y[N+k]=Y[N-1-k], k=0,...,N-1. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This surely can be more efficiently expressed using array operations, join Y and its reverse to form the new Y. Then apply directly ifft, without ifftshift, to get a signal with the given spectrum.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update 14.1.:If the number of frequencies is rather small, an explicit evaluation as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{k:Y[k]\ne 0} Y[k]\cdot \sin(c\cdot X[k]\cdot t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;may be easier to implement. The factor c is to be fixed in such a way that the result is in the audible spectrum.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-01-15T13:38:51.683" LastActivityDate="2014-01-15T13:38:51.683" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13796" PostTypeId="2" ParentId="13794" CreationDate="2014-01-14T23:15:08.643" Score="1" Body="&lt;p&gt;Since the convolution theorem applies to the Hartley transform as well as the DFT, you may be able to use the same technique as can be used for FFT interpolation or spectrum resampling.  Use the Hartley transform of the implied rectangular window as an interpolation kernel, and interpolate to a larger N. Perhaps window the interpolation kernel for a trade-off between accuracy and computational efficiency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the size and efficiency of the interpolation needed to meet your requirements, it may be more efficient to do an inverse and forward transform instead.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-14T23:15:08.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13797" PostTypeId="1" AcceptedAnswerId="13801" CreationDate="2014-01-14T23:56:31.493" Score="1" ViewCount="642" Body="&lt;p&gt;I was reading a paper 'A Flexible Framework for Local Phase Coherence Computation' (&lt;a href=&quot;https://ece.uwaterloo.ca/~z70wang/publications/iciar11a.pdf%E2%80%8E&quot; rel=&quot;nofollow&quot;&gt;paper URL&lt;/a&gt;) on using wavelets for local phase coherence. I just want to be sure. Is the gabor wavelet the same as the gabor function in the gabor transform (STFT)? If not, can we use a Windowed Fourier Transform instead?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="5014" LastEditDate="2014-01-17T05:46:40.670" LastActivityDate="2014-01-17T05:46:40.670" Title="gabor wavelet and gabor transform" Tags="|wavelet|window-functions|gabor|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13798" PostTypeId="1" CreationDate="2014-01-15T00:46:12.000" Score="1" ViewCount="399" Body="&lt;p&gt;I have a signal that consists of a sine wave, on which I apply a rectangular window and then an FFT. I'm only interested in the magnitude of the sine wave, and I want it to stay the same even if the signal shifts a few samples to the right relative to the window (of course assuming the sine wave has the same amplitude from top to bottom). Is this possible and how can this be done best? The application is a kind of pitch detector where I have to detect a small group of different pitches. &lt;/p&gt;&#xA;" OwnerUserId="5762" LastActivityDate="2014-01-15T13:17:55.787" Title="how to make fft ignore phase shift when only interested in magnitude" Tags="|fft|phase|magnitude|amplitude|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13799" PostTypeId="1" CreationDate="2014-01-15T04:37:33.207" Score="-1" ViewCount="91" Body="&lt;p&gt;I am new to DSP, so I wan't to know a couple of things. How does µlaw encoding function on a log scale such that you can input 16-bit signals and get the 8-bit µlaw signal output, after compression, and then use that as a building block to expand it back to 16-bit signals. I would love if someone can guide me through this. Also, how is this lossless compression, if that is what it is.&lt;/p&gt;&#xA;" OwnerUserId="7562" LastActivityDate="2022-06-16T02:03:50.480" Title="How does µlaw encoding work with 16-bit signals?" Tags="|digital-communications|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13800" PostTypeId="2" ParentId="13793" CreationDate="2014-01-15T05:51:44.487" Score="2" Body="&lt;p&gt;You could try using the peak-to-sidelobe ratio, i.e. how many standard deviations above the mean is each point in the correlation output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;psr = ${p - \mu }\over\sigma  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically you compute the mean and sigma in a window around each point excluding the region nearest to each point.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-01-15T05:51:44.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13801" PostTypeId="2" ParentId="13797" CreationDate="2014-01-15T08:26:03.630" Score="1" Body="&lt;p&gt;The Gabor wavelet is (almost) the same as the Morlet wavelet (some authors distinguish these two by an additional constant to fulfill the wavelet's admissibility condition). And yes, it is the same function as in the Gabor transform (gaussian windowed oscillation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The application of phase coherence should be independent of the underlying wavelet and the nature of the transform (Wavelet, Gabor/STFT, other weird metrics). Essentially important is the concept of reproducing kernels and the intrinsic (Heisenberg) uncertainty that influence you measure of phase coherence and must be taken care of.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2014-01-15T08:26:03.630" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13802" PostTypeId="2" ParentId="13798" CreationDate="2014-01-15T08:59:56.623" Score="1" Body="&lt;p&gt;You can't make an FFT ignore phase (for strictly real input), except for signals which have frequencies that are exactly periodic in the FFT window length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you will have to interpolate to get any between bin magnitude peaks.  And an accurate magnitude interpolation of any non-bin-centered frequency will depend on phase (easiest if you reference phase to the center of the data window), especially near the DC or Fs/2 bins, but to a much smaller extent, thru the rest of the FFT result as well.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-15T08:59:56.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13804" PostTypeId="1" CreationDate="2014-01-15T11:17:58.237" Score="4" ViewCount="12210" Body="&lt;p&gt;I have a question regarding the fourier transform. If I plot the frequency against the fourier transform for a periodic signal and I get a peak, What is the physics behind it? I want to know the physical meaning of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why we get a peak and what does it signify?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7563" LastActivityDate="2014-01-15T21:41:56.997" Title="physical meaning of fourier transform" Tags="|fft|matlab|transform|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13805" PostTypeId="2" ParentId="13804" CreationDate="2014-01-15T11:52:28.793" Score="1" Body="&lt;p&gt;The peak represents the most dominant frequency in your periodic signal. The Fourier transform represents the energy at each frequency in your time-domain signal. You only get peaks when specific frequencies are particularly strong. If you took the FT of white noise you would get a fairly flat line. &lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2014-01-15T11:52:28.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13807" PostTypeId="2" ParentId="13798" CreationDate="2014-01-15T13:17:55.787" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm only interested in the magnitude of the sine wave, and I want it&#xA;  to stay the same even if the signal shifts a few samples to the right&#xA;  relative to the window&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The absolute magnitude of the DFT result will be independent of the phase shift. Each DFT bin will give you a complex number of the form $A \ e^{j \ \theta}$. Circularly shifting your tone will only affect $\theta$. If you take the absolute magnitude, you will end up with $|A|$, all the while ignoring the phase. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastActivityDate="2014-01-15T13:17:55.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13808" PostTypeId="1" AcceptedAnswerId="13809" CreationDate="2014-01-15T13:56:52.743" Score="6" ViewCount="4303" Body="&lt;p&gt;I have been using convolution for finding outputs of various systems .I know how to use it.But I still don't know what does convolution exactly  means? how one can define convolution ?&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="4619" LastEditDate="2014-01-15T19:43:28.813" LastActivityDate="2014-01-15T20:26:37.237" Title="What is the intuition behind convolution?" Tags="|discrete-signals|continuous-signals|" AnswerCount="2" CommentCount="0" ClosedDate="2014-01-17T09:56:13.060" ContentLicense="CC BY-SA 3.0" />
  <row Id="13809" PostTypeId="2" ParentId="13808" CreationDate="2014-01-15T14:36:43.367" Score="9" Body="&lt;p&gt;No doubt there are many links and expositions on wikipedia and elsewhere about convolution, its relation to linear systems, and its link to frequency analysis, however I do not think that is what you are after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forget convolution for a moment. Just think of nothing but averages: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I give you a series of say, $10$ numbers, and ask you to take the average, you can do that very easily. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us say that I give you another set of $10$ numbers again, and also ask you to take the average. You can again, do that very easily. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I keep giving you a set of $10$ numbers, and you keep giving me averages. What a life!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine I tell you a secret: Those sets of $10$ numbers I have been giving you, are actually from a taken from a long series of numbers. In fact I have a list of $100$ numbers. The first set of $10$ numbers I gave you were the first $10$ numbers of that list. (First sample to 10th sample). You averaged them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second list of $10$ numbers were actually the 2nd sample, to the 11th sample. You averaged them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third list of $10$ numbers I gave you were actually the 3rd sample, to the 12th sample. You averaged them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After all this, I ask you to plot all the averages you gave me, one after the other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Congratulations! You just showed me a convolution result!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Disclaimer: There are some border conditions that I have skipped over, but this is basically all a convolution is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in summary, think of a convolution as just a sliding average. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, remember how I said &quot;average&quot; those $10$ numbers I gave you? Well you can also do a weighted average. (That is, instead of multiplying all the $10$ numbers by $1$ before averaging them, we multiply them by different numbers, before averaging them. This is a weighted average). This will still be a convolution though. We call those numbers &quot;weights&quot;, and sometimes they are referred to as the &quot;filter kernel&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some advanced systems actually change their weights as they run, and they are called adaptive filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eitherway, this should provide you with a solid intuition: Just remember that convolution can be thought of - is - a moving average of your data. Hope that helped!&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2014-01-15T20:26:37.237" LastActivityDate="2014-01-15T20:26:37.237" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13810" PostTypeId="2" ParentId="13808" CreationDate="2014-01-15T14:48:02.710" Score="3" Body="&lt;p&gt;Convolution expresses in mathematics how to get the output of a Linear Time Invariant (LTI) system in response to an arbitrary input - if you know the impulse response.&#xA;Take a discrete time system that has an impulse response h[t], so if I feed in an impulse I get h[t] at the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if I want to know the output given an input of x[n] = [1 2 1], what you do is break this input into 3 impulses i.e. we look at 3 separate input sequences [1 0 0], [0 2 0], and [0 0 1]. Our desired input is the sum of these 3 inputs. Because our system is LTI the output of the sum of the inputs is the sum of the outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because our inputs are impulses, the outputs will simply be scaled and delayed versions of the impulse response (again because of the definition of an LTI system) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the output of each input is:&lt;br&gt;&#xA;[1 0 0] -&gt; 1*h[t]&lt;br&gt;&#xA;[0 2 0] -&gt; 2*h[t-1]&lt;br&gt;&#xA;[0 0 1] -&gt; 1*h[t-2]  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore the summing the left side and the right side we get&lt;br&gt;&#xA;[1 2 1] -&gt; 1*h[t] + 2*h[t-1] + 1*h[t-2]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So convolution simply sums delayed and scaled versions of the impulse response. The scaling and delay factors are simply the amplitude and delay associate with the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often the convolution formula looks awkward because the output is written at a specific point in time i.e. what is the value of  y[2]? In our example above we would have to take the 3rd point from each of the output signals i.e. 1*h[2], 2*h[1], 1*h[0].  To see this let&lt;br&gt;&#xA;y${}_0$[t] =1*h[t]&lt;br&gt;&#xA;y${}_1$[t] =2*h[t-1]&lt;br&gt;&#xA;y${}_3$[t] =1*h[t-2]&lt;br&gt;&#xA;and therefore &#xA;Then we can see that&lt;br&gt;&#xA;y${}_0$[2] = 1*h[2]  = 1*h[2]&lt;br&gt;&#xA;y${}_1$[2] = 2*h[2-1] =  2*h[1]&lt;br&gt;&#xA;y${}_3$[2] =1*h[2-2] = 1*h[0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The total output is the given by summing these i.e.&lt;br&gt;&#xA;y[2] =  1*h[2]+ 2*h[1]+1*h[0]  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But see this can also be written as:&lt;br&gt;&#xA;y[2]= x[0]*h[2] + x[1]*h[1] + x[2]*h[0]   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I have done above is replace the scaling with the corresponding index of the input signal x[].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we write the formula for the output signal at an arbitrary time, y[n] - the result is the convolution formula. So the convolution formula is the result of having a Linear Time Invariant system and the impulse response of that system.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-15T14:48:02.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13811" PostTypeId="2" ParentId="13804" CreationDate="2014-01-15T15:27:07.703" Score="1" Body="&lt;p&gt;Any non-pathological exactly periodic signal can be decomposed into the sum of a bunch of sinewaves (overtones or harmonics).  The weight of each harmonic component determines the shape of the waveform.  A peak, assuming it is above the noise floor, would merely represent the largest weighted harmonic component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physics of many common simple systems with a (nearly) linear restoring force can be approximated by a differential equation whose solution is a series of complex exponentials, which can be broken down into a bunch of sinewaves at different frequencies and starting phases.  Thus the usefulness of the FT in studying or controlling such systems.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-01-15T15:33:36.710" LastActivityDate="2014-01-15T15:33:36.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13812" PostTypeId="2" ParentId="11139" CreationDate="2014-01-15T15:48:21.187" Score="1" Body="&lt;p&gt;The sampling rate is 6 kHz, so all the spectral content of what you are sampling will appear in the frequency range of -3 kHz &amp;lt; f &amp;lt; 3 kHz. The unshaded triangle from 3 kHz to 9 kHz is where the actual spectral content is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you sample at 6 kHz the spectral content of the unshaded triangle will appear as the triangle in the shaded region. More specifically the frequency at 4 kHz will appear at -2kHz, and the frequency at 7 kHz will appear at 1 kHz. Another way of saying this is, if you sample at 7kHz tone at 6 kHz it looks exactly the same as a 1 kHz tone sampled at 6 kHz. That's why aliasing leads to ambiguity - you can't tell whether that 1 kHz tone actually came from a 1 kHz, or a 7 kHz tone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the unshaded triangle represents where the original spectral content is, and the triangle in the shaded portion is where that triangle gets mapped to (when sampling at 6 kHz). &lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-15T15:48:21.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13813" PostTypeId="2" ParentId="13758" CreationDate="2014-01-15T16:36:13.113" Score="0" Body="&lt;p&gt;The relationship between baud rate and the doppler effect is through the &#xA;so called &quot;coherence time&quot; or doppler spread. The coherence time is a measure of the time interval over which the signal's amplitude  is for the most part statistically correlated. Therefore it can be considered the maximum interval for a single baud. If the pulse is smaller than the coherence time than the amplitude is relatively constant over the period of one baud and equalization is easier (time-flat fading). If the pulse/buad was to stretch out longer than the coherence time than equalizing the signal would be more difficult because he amplitude could change during the pulse interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen values for coherence time of approximately $\dfrac{0.43}{f_d}$ where $f_d$ is proportional to the carrier frequency $f_d=\dfrac{velocity}{\lambda}$,   $\lambda=\dfrac{c}{f_0}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why it happens? I can explain but you are better off just searching for &quot;Jakes fading model&quot;. You should get all the info you need. &lt;/p&gt;&#xA;" OwnerUserId="7567" LastEditorUserId="8202" LastEditDate="2014-05-16T22:23:44.813" LastActivityDate="2014-05-16T22:23:44.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13814" PostTypeId="2" ParentId="11139" CreationDate="2014-01-15T17:14:18.373" Score="0" Body="&lt;p&gt;If you want to sample a signal you (mathematically speaking) Convolve it with a train of impulses (having as frequency the sampling frequency) resulting in the frequency domain in multiple copies your signal's (the one you have sampled) frequency representation.That copied are depicted in the picture you are showing there and are situated lets say &quot;above&quot; each impulse (from the train of impulses you used to sample your signal) thats why you see the compounents spaced at fs.Now if you increase your sampling rate you will observe that this multiple copies will be shrink in and if you decrease it the will grow like spread more around the fs.That means that after a certain point of reducing the sampling rate (samsapling,if a spell it correctly) these will overlap resulting in alliasing. &lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-01-15T17:14:18.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13815" PostTypeId="2" ParentId="13804" CreationDate="2014-01-15T17:20:12.193" Score="0" Body="&lt;p&gt;That component signifies the magnitude of that signal in the frequency domain.&#xA;Is something similar with taking the peak (higher point of it in time domain) of a sinusoidal and placing it in a graph,where the x axis will represent the frequencies,and y the magnitude,on x on the spot where the f=1/T of that sinusoidal is located.&lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-01-15T17:20:12.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13816" PostTypeId="2" ParentId="11139" CreationDate="2014-01-15T17:23:48.963" Score="0" Body="&lt;p&gt;My take is the shaded area contains the original signal. when you sample that baseband band-limited signal at fs you will get replicas of it at intervals spaced by nFs n=-inf......inf. as long as the sampling rate is greater than in this case the double-sided bandwith there will be no ailiasing/distortion of the signal if you low pass filter it. You could also recover the original signal by bandpass filtering at nFs and shifting the signal back down to basband&lt;/p&gt;&#xA;" OwnerUserId="7567" LastActivityDate="2014-01-15T17:23:48.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13817" PostTypeId="1" AcceptedAnswerId="13822" CreationDate="2014-01-15T20:41:19.667" Score="0" ViewCount="1841" Body="&lt;p&gt;I have been experimenting with speaker independent automatic speech recognition.  At this point, I understand that the signal is typically segmented into overlapping frames and MFCCs are extracted as features for each frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of the texts I read talk about reducing the dimensionality of the features using (for example) Linear Discriminant Analysis or Primary Component Analysis.  While I think I understand the concepts involved in reducing dimensions in the abstract, I am not understanding how this feature reduction is supposed to be applied to the MFCC vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested primarily because several texts seem to suggest that reducing the dimensionality produces less variant features, which make recognizing patterns easier.  As a bonus, there is also less computational overhead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the dimension reduction supposed to be applied on a per-frame basis?  For something like LDA, don't you need to know what class the data belongs to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Carl&lt;/p&gt;&#xA;" OwnerUserId="7568" LastActivityDate="2014-01-16T00:19:58.287" Title="How to Reduce Speech Feature Dimensions?" Tags="|speech-recognition|mfcc|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13818" PostTypeId="2" ParentId="13804" CreationDate="2014-01-15T21:00:20.670" Score="2" Body="&lt;p&gt;I read your question a little differently than the other people who have answered.  The role of the Fourier transform in physics is as a bi-directional one-to-one mapping between &lt;a href=&quot;http://en.wikipedia.org/wiki/Conjugate_variables&quot; rel=&quot;nofollow&quot;&gt;conjugate variables&lt;/a&gt;.  The most famous example of a conjugate variable pair is position/momentum, but there are many others. Some examples of conjugate variable pairs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;position and momentum over Planck's constant $[x,p/\hbar]$&lt;/li&gt;&#xA;&lt;li&gt;time and energy $[t,E]$&lt;/li&gt;&#xA;&lt;li&gt;aperture and the sine of the diffraction angle divided by the wavelength &#xA;$\left[x,\frac{\sin\theta}{\lambda}\right]$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One of the consequences in quantum mechanics is that the operators (quantum mechanics uses differential operators which are related to the classical variables) &lt;a href=&quot;http://en.wikipedia.org/wiki/Canonical_commutation_relation&quot; rel=&quot;nofollow&quot;&gt;do not commute&lt;/a&gt;.  So, using the position/momentum example; $xp\neq px$.  This leads to an uncertainty relation between conjugate variables.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual statement of the Heisenberg &lt;a href=&quot;http://en.wikipedia.org/wiki/Uncertainty_principle&quot; rel=&quot;nofollow&quot;&gt;uncertianty principle&lt;/a&gt; is that the more well one knows the position of a quantum particle, the less one can know about the momentum.  Mathematically; &#xA;$$&#xA;\sigma_x\sigma_ p\geq\frac{\hbar}{2}.&#xA;$$&#xA;However, the more general statement of the uncertainty principle is that the uncertainty between any pair of conjugate variables is given by &#xA;$$&#xA;\sigma_1\sigma_2\geq\frac12.&#xA;$$&#xA;This uncertainty relation leads to some rather strange effects in quantum physics.  For example, the uncertainty relation between energy and time allow for the violation of energy conservation on very brief timescales, a law which is sacred in classical physics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking for more information on the uses of the Fourier transform in physics and engineering with many worked examples, &lt;a href=&quot;http://bloguna.tolafghan.com/assets/documents/138/1810/FourierTransf.pdf&quot; rel=&quot;nofollow&quot;&gt;have a look at this free textbook by J. F. James&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7540" LastEditorUserId="7540" LastEditDate="2014-01-15T21:41:56.997" LastActivityDate="2014-01-15T21:41:56.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13819" PostTypeId="1" AcceptedAnswerId="13821" CreationDate="2014-01-15T21:54:00.810" Score="3" ViewCount="180" Body="&lt;p&gt;I'm working on a sound card based OFDM system and ran into some problems:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gbjTh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I perform  DAC on the real and imaginary parts of the IFFT? I think they are real numbers instead of 0 and 1. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7569" LastActivityDate="2014-01-15T23:27:42.990" Title="OFDM DA conversion problem" Tags="|software-implementation|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13820" PostTypeId="2" ParentId="13755" CreationDate="2014-01-15T22:30:51.163" Score="3" Body="&lt;p&gt;It seems your problem is that you don't have enough measurements ($n$ is too large) or, conversely, your sparsity level is too large ($k$ is too large).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following results running your code with &lt;code&gt;n=650&lt;/code&gt; and &lt;code&gt;k=50&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;iter# = 0 MSE = 0.00812474693295&#xA;iter# = 1 MSE = 0.00271708140753&#xA;iter# = 2 MSE = 0.000356259110511&#xA;iter# = 3 MSE = 6.21904907643e-05&#xA;iter# = 4 MSE = 1.44382449129e-05&#xA;iter# = 5 MSE = 3.78893253914e-06&#xA;iter# = 6 MSE = 1.0594446086e-06&#xA;iter# = 7 MSE = 3.07260599077e-07&#xA;iter# = 8 MSE = 9.11129787831e-08&#xA;iter# = 9 MSE = 2.73966343485e-08&#xA;iter# = 10 MSE = 8.31158766951e-09&#xA;iter# = 11 MSE = 2.53626229375e-09&#xA;iter# = 12 MSE = 7.76921000721e-10&#xA;iter# = 13 MSE = 2.3860780809e-10&#xA;iter# = 14 MSE = 7.34107163353e-11&#xA;All Close xiht and x :False&#xA;Mean Squared Error AMP: 7.34107163353e-11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I get the following results running your code with &lt;code&gt;n=400&lt;/code&gt; and &lt;code&gt;k=25&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;iter# = 0 MSE = 0.00220889518721&#xA;iter# = 1 MSE = 0.000307654598132&#xA;iter# = 2 MSE = 2.10598716122e-05&#xA;iter# = 3 MSE = 1.95585608289e-06&#xA;iter# = 4 MSE = 2.11634342685e-07&#xA;iter# = 5 MSE = 2.52134822012e-08&#xA;iter# = 6 MSE = 3.22221470836e-09&#xA;iter# = 7 MSE = 4.34247659324e-10&#xA;iter# = 8 MSE = 6.09018078495e-11&#xA;All Close xiht and x :False&#xA;Mean Squared Error AMP: 6.09018078495e-11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="172" LastActivityDate="2014-01-15T22:30:51.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13821" PostTypeId="2" ParentId="13819" CreationDate="2014-01-15T23:27:42.990" Score="3" Body="&lt;p&gt;Imaginary part of a complex number is real. For example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z = 1 - 2j$$&#xA;$$\mathsf{Re}(z) = 1$$&#xA;$$\mathsf{Im}(z) = -2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same will happen with the imaginary part of your FFT. In the end, you get two real signals. Then you modulate them by two sinusoids which are 90 degrees out of phase, and add the modulated signals at the output stage.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-01-15T23:27:42.990" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13822" PostTypeId="2" ParentId="13817" CreationDate="2014-01-16T00:19:58.287" Score="1" Body="&lt;p&gt;You have one feature vector per frame. The collection of feature vectors for all the frames in the training data form a matrix. Since this is training data, you know the true class for each frame. Use this matrix and the training data labels to build your LDA matrix. Alternatively, just use this matrix (without the labels) to find the PCA matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you use this matrix to reduce the dimensionality of the feature vector for each frame in your test data when you're doing the speech recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PCA doesn't produce less variant features. I think what you meant to say was that the features are less correlated with each other. This is called whitening and it can help some classifiers better learn from the training data. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-01-16T00:19:58.287" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13823" PostTypeId="1" CreationDate="2014-01-16T03:11:06.320" Score="1" ViewCount="245" Body="&lt;p&gt;Ok, so I'm kind of moving forward with implementing the STFT. I realise that I was taking the entire FFT and not the first half.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem that I'm having now is, understanding how to get the Freq bins, what calculation should I use? For example, I have been using this formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(10 * log10(sqrt(v[i][j].re * v[i][j].re + v[i][j].im * v[i][j].im)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which, I realise that this is for decibels. Currently, my graph looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5ZMdu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this makes sense to me now, this is finally starting to come together! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would this algorithm work?:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take the magnitude of each of the elements inside the bin `mags = (re * re + im + im) I then find the maximum index of the bin, multiply it by the Fs and divide by the bin size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I did this, however, would this only give me &lt;code&gt;1&lt;/code&gt; result for each block? &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-01-16T15:06:10.470" Title="How to find the Freqs bins" Tags="|fft|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13824" PostTypeId="1" AcceptedAnswerId="13847" CreationDate="2014-01-16T04:56:59.180" Score="1" ViewCount="4547" Body="&lt;p&gt;Given a difference equation, how do we tell if it is an IIR filter or FIR filter?&#xA;For example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;y(n) = x(n-3)+y(n-1)&lt;/strong&gt; . Is it FIR or IIR? Can you please give me a way to figure this out? &#xA;Thanks! :)&lt;/p&gt;&#xA;" OwnerUserId="7570" LastEditorUserId="7092" LastEditDate="2020-03-31T04:56:06.043" LastActivityDate="2020-03-31T04:56:06.043" Title="Type of filter, given difference equation?" Tags="|filters|discrete-signals|signal-analysis|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13825" PostTypeId="2" ParentId="13824" CreationDate="2014-01-16T05:13:00.943" Score="0" Body="&lt;p&gt;Find out if there are any non-zero poles in the transfer function(after pole-zero cancellation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] - y[n-1] = x[n-3]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(z) - z^{-1}Y(z) = z^{-3}X(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = \dfrac{Y(z)}{X(z)} = \dfrac{z^{-3}}{1-z^{-1}} = \dfrac{1}{z^{2}(z-1)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it has poles at $p_{0} = 1,\;\; p_{1}, p_{2} = 0$ so it is an IIR filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some FIR filters can be realized with a recursive structure too.&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Cascaded_integrator-comb_filter&quot; rel=&quot;nofollow&quot;&gt;Cascaded Integrator-Comb filter&lt;/a&gt; is recursive version of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response#Moving_average_example&quot; rel=&quot;nofollow&quot;&gt;Moving Average filter&lt;/a&gt;. The recursive structure is more efficient than the straight forward transversal structure for implementing it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] - y[n-1] = x[n] - x[n-3]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(z) - z^{-1}Y(z) = X(z) - z^{-3}X(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = \dfrac{Y(z)}{X(z)} = \dfrac{1-z^{-3}}{1-z^{-1}} = 1+z^{-1}+z^{-2} = \dfrac{z^{2}+z+1}{z^{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this has poles at $p_{0},p_{1} = 0$ and zeros at $z_{0},z_{1}=\dfrac{-1\pm \sqrt{3}j}{2}$&lt;/p&gt;&#xA;" OwnerUserId="1488" LastEditorUserId="1488" LastEditDate="2014-01-17T05:47:17.387" LastActivityDate="2014-01-17T05:47:17.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13827" PostTypeId="2" ParentId="13824" CreationDate="2014-01-16T05:35:04.843" Score="1" Body="&lt;p&gt;The difference equation of IIR filter is recursive, which means the current output depends upon the previous output (the output depends upon the infinite past). Your example is IIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the difference equation of FIR filter depends only upon the input. If the input is finite in duration, then the output is also finite in duration.  &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-16T05:35:04.843" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13828" PostTypeId="1" AcceptedAnswerId="13831" CreationDate="2014-01-16T05:58:53.037" Score="2" ViewCount="549" Body="&lt;p&gt;I'm trying to implement an sound card-based OFDM modem. A paper says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...A serial to parallel converter is applied and the IFFT operation is&#xA;  performed on the parallel complex data.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Say I have a stream $S$ of complex numbers, then after serial-to-parallel (S/P) conversion, it becomes $S_1$ and $S_2$. But as far as I'm concerned, OFDM requires the sub-carriers to be orthogonal to each other. So can I just perform IFFT twice directly on the streams without defining the frequencies of sub-carriers? I'm quite puzzled. Any help on this will be greatly appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7569" LastEditorUserId="1606" LastEditDate="2014-01-16T08:37:43.553" LastActivityDate="2014-01-16T08:37:43.553" Title="Software-based sound card OFDM" Tags="|modulation|software-implementation|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13829" PostTypeId="1" AcceptedAnswerId="13830" CreationDate="2014-01-16T06:14:57.887" Score="0" ViewCount="263" Body="&lt;p&gt;I was reading a paper which uses a filter bank of gabor filters with different frequencies and &lt;strong&gt;orientations&lt;/strong&gt;. However, I often see the construction of a filter bank of gabor filters with different frequencies and &lt;strong&gt;scales&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure on the construction of it. How do I construct it, any generic example will be ok. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="5014" LastEditDate="2014-01-16T07:39:51.427" LastActivityDate="2014-01-16T07:39:51.427" Title="filter bank of gabor filters with different frequencies and orientations" Tags="|filters|stft|gabor|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13830" PostTypeId="2" ParentId="13829" CreationDate="2014-01-16T06:59:19.727" Score="1" Body="&lt;p&gt;Look on wikipedia. &lt;a href=&quot;https://en.wikipedia.org/wiki/Gabor_filter&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Gabor_filter&lt;/a&gt; The $\theta$ controls the orientation.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-01-16T06:59:19.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13831" PostTypeId="2" ParentId="13828" CreationDate="2014-01-16T08:36:38.833" Score="3" Body="&lt;p&gt;The serial/parallel converter shown in most OFDM transmitter block diagrams is required in a hardware implementation but not very meaningful for software implementation. Because in software there is no IFFT block that actually works with parallel inputs, it's all serial processing in reality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $S(k)$ be your input stream of complex numbers and $N$ be the number of subcarriers, i.e. the IFFT size. Then you have to calculate the IFFT of every $N$ samples in $S(k)$, i.e. of the vectors $[S(iN),\ldots,S((i+1)N - 1)]$, with symbol index $i=0,1,2,\ldots$. The result is the OFDM modulated time domain signal. If I understand your example correctly you have to apply the IFFT to both $S_1$ and $S_2$, yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the IFFT operation is also complex, in general. Unless you use two audio channels followed by an Inphase/quadrature mixer that shifts the signal to a carrier frequency the vectors defined above have to exhibit a complex conjugate symmetry in order to obtain a real-valued time domain signal. (So-called discrete multitone (DMT))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The allocation of data to subcarriers happens through the IFFT algorithm you're using. The &lt;em&gt;FFTW&lt;/em&gt; library, for example, allocates $S(0)$ to frequency zero and $S(N-1)$ to &quot;frequency&quot; $-N/2$. What physical frequency this corresponds to in turn depends on the sampling frequency of the digital-to-analog converter you're using. Orthogonality is inherent to the (I)FFT algorithm, you don't have to apply any further processing to obtain it.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-01-16T08:36:38.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13833" PostTypeId="1" CreationDate="2014-01-16T12:12:03.477" Score="6" ViewCount="1994" Body="&lt;p&gt;I'm doing a small &lt;em&gt;overview of different image representations&lt;/em&gt; used in image processing and computer vision. For every representation, I would like to have (at least) the following information:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the name of the &lt;strong&gt;family of representations&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;some &lt;strong&gt;basic characteristics&lt;/strong&gt; of the representation family (what information is retained in the representation)&lt;/li&gt;&#xA;&lt;li&gt;what tasks are they typically used for&lt;/li&gt;&#xA;&lt;li&gt;what are &lt;strong&gt;different&lt;/strong&gt; concrete &lt;strong&gt;types of representation&lt;/strong&gt; from this family&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;references&lt;/strong&gt; for different representations &lt;em&gt;and&lt;/em&gt; references for their usages&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In addition to the representations I already know / have information about it (as an &lt;a href=&quot;https://dsp.stackexchange.com/a/13836/1273&quot;&gt;answer listed below&lt;/a&gt;), I am mostly interested in &lt;em&gt;compressed domain&lt;/em&gt; (e.g. Fourier domain, wavelets), but knowing about other representations, e.g. edge-based, or whatever else I don't know about yet would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If at all possible, I would appreciate &lt;strong&gt;if you could provide references&lt;/strong&gt; (e.g. the article that proposed the representation, or a book explaining the representation), as indicated with the &lt;a href=&quot;https://dsp.stackexchange.com/tags/reference-request/info&quot;&gt;&lt;code&gt;reference-request&lt;/code&gt; tag&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&lt;strong&gt;Disclamer&lt;/strong&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;I know list-questions are usually discouraged, but we had something similar about &lt;a href=&quot;https://dsp.stackexchange.com/q/7748/1273&quot;&gt;segmentation&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/q/2411/1273&quot;&gt;thresholding&lt;/a&gt;, and it worked well.&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;If the info I already provided is more suited as an answer, I could edit it out and post it as an answer. Also, I'm thinking maybe this would be a good question for community wiki. &lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-01-30T11:25:15.490" Title="Different representations of images and their purpose" Tags="|image-processing|computer-vision|reference-request|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13834" PostTypeId="1" AcceptedAnswerId="13843" CreationDate="2014-01-16T12:25:10.207" Score="5" ViewCount="7842" Body="&lt;p&gt;When output histogram is not same as reference histogram, why is the method called histogram equalization?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example below are two figures from &lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_equalization&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Histogram_equalization&lt;/a&gt;. The output histogram (2nd figure) looks nothing like a discrete uniform distribution. Why is it called &quot;equalization&quot; then? &lt;img src=&quot;https://i.stack.imgur.com/yqVkZ.png&quot; alt=&quot;input image histogram&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/nJqMZ.png&quot; alt=&quot;output image histogram&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4206" LastActivityDate="2014-02-06T09:31:19.947" Title="Why is histogram equalization called as &quot;equalization&quot;?" Tags="|image-processing|equalization|histogram|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13835" PostTypeId="2" ParentId="13834" CreationDate="2014-01-16T13:12:29.833" Score="2" Body="&lt;p&gt;To make a signal with that distribution have a truly uniform distribution would probably require that the transformation used be time-varying: a value $10$ at time $t_0$ would be moved to, say, a value of $15$, but a value $10$ at time $t_1$ (later) would be moved to, for example, $20$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what the equalizer tries to do is to make the &lt;strong&gt;cumulative distribution&lt;/strong&gt; of the signal as &lt;em&gt;linear&lt;/em&gt; as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cumulative distribution linearization approach allows a transform of the form:&#xA;$$&#xA;y(t) = T[x(t)]&#xA;$$&#xA;where $T[x_1]$ always maps to $y_1$, regardless of the time at which it occurs. &lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_equalization&quot; rel=&quot;nofollow noreferrer&quot;&gt;There's a bit more explanation of the details on Wikipedia.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit: Not sure if this is quite what you're after, but I tried implementing what I suggested to get a fully uniform distribution in the pixel values. The &lt;code&gt;scilab&lt;/code&gt; code is below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the simple example I chose, it did a reasonable job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mGDro.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = scf();&#xA;t=-%pi:0.1:%pi;&#xA;m=sin(t)'*cos(t);&#xA;m = 10*round(m*10);&#xA;clf()&#xA;subplot(221);&#xA;grayplot(t,t,m);&#xA;subplot(222);&#xA;histplot(100,m)&#xA;subplot(223);&#xA;&#xA;[sorted,indices] = gsort(m);&#xA;m_equalized = zeros(m);&#xA;N = length(indices);&#xA;val_max = 1;&#xA;val_min = 0;&#xA;vals = [0:N-1]/(N-1)*(val_max - val_min) + val_min;&#xA;&#xA;m_equalized(indices) = vals;&#xA;grayplot(t,t,m_equalized);&#xA;&#xA;subplot(224)&#xA;histplot(100,m_equalized)&#xA;&#xA;f.color_map = graycolormap(32);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2014-01-17T18:34:09.430" LastActivityDate="2014-01-17T18:34:09.430" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13836" PostTypeId="2" ParentId="13833" CreationDate="2014-01-16T13:27:11.887" Score="4" Body="&lt;p&gt;These are some representations that I already gathered information on, so I'll list them here.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pixel based representation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;simplest to define, simple neighborhood relations between elements (4,8,6-connectivity &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=773286&quot; rel=&quot;nofollow noreferrer&quot;&gt;(1)&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;only local information for each element&lt;/li&gt;&#xA;&lt;li&gt;big number of elements in the representation (used for displaying the image, applications with a lot of noise/details: e.g. medical imaging)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Block-based representations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;image divided in a set of (rectangular) arrays&lt;/li&gt;&#xA;&lt;li&gt;number of elements slightly smaller than with &lt;em&gt;pixel-based&lt;/em&gt;, still only local information&lt;/li&gt;&#xA;&lt;li&gt;both gray-scale and binary images&lt;/li&gt;&#xA;&lt;li&gt;uses in compression (&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=843184&quot; rel=&quot;nofollow noreferrer&quot;&gt;(2)&lt;/a&gt;, &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=387415&quot; rel=&quot;nofollow noreferrer&quot;&gt;(3)&lt;/a&gt;, &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=718506&quot; rel=&quot;nofollow noreferrer&quot;&gt;(4)&lt;/a&gt;), segmentation (&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=718506&quot; rel=&quot;nofollow noreferrer&quot;&gt;(4)&lt;/a&gt;, &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0031320398001253&quot; rel=&quot;nofollow noreferrer&quot;&gt;(5)&lt;/a&gt;), extracting different image features (&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0031320398001253&quot; rel=&quot;nofollow noreferrer&quot;&gt;(5)&lt;/a&gt;, &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0031320305001743&quot; rel=&quot;nofollow noreferrer&quot;&gt;(6)&lt;/a&gt;, &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=877219&quot; rel=&quot;nofollow noreferrer&quot;&gt;(7)&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Region based&lt;/strong&gt; (sometime also &lt;a href=&quot;https://dsp.stackexchange.com/a/11066/1273&quot;&gt;&lt;strong&gt;super-pixels&lt;/strong&gt;&lt;/a&gt;) &lt;strong&gt;representations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;regions not rectangular; formed by grouping similar and connected pixels, usually using over-segmentation&lt;/li&gt;&#xA;&lt;li&gt;adjacency information between regions (usually as RAG (region-adjacency graph &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0019995874906962&quot; rel=&quot;nofollow noreferrer&quot;&gt;(8)&lt;/a&gt;) or combinatorial map &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/0010448591900828&quot; rel=&quot;nofollow noreferrer&quot;&gt;(9)&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;normalized cuts &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=868688&quot; rel=&quot;nofollow noreferrer&quot;&gt;(10)&lt;/a&gt;, graph-based segmentation (e.g. by Felzenszwalb and Huttenlocher &lt;a href=&quot;http://link.springer.com/article/10.1023/B:VISI.0000022288.19776.77&quot; rel=&quot;nofollow noreferrer&quot;&gt;(11)&lt;/a&gt;), watershed-based (&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4564470&quot; rel=&quot;nofollow noreferrer&quot;&gt;(12)&lt;/a&gt;, &lt;a href=&quot;http://csce.uark.edu/~jgauch/library/Segmentation/Vincent.1991.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;(13)&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;number of elements in the representation reduced while accuracy is kept&lt;/li&gt;&#xA;&lt;li&gt;used for object detection and segmentation, but different unions of multiple regions have to be considered&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hierarchical representations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;propose &lt;em&gt;most likely&lt;/em&gt; unions of regions of region-based representations&lt;/li&gt;&#xA;&lt;li&gt;image representation at different scales&lt;/li&gt;&#xA;&lt;li&gt;only regions present in the representation have to be examined, can be constricted by scale&lt;/li&gt;&#xA;&lt;li&gt;min-/max-tree (&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=663500&quot; rel=&quot;nofollow noreferrer&quot;&gt;(14)&lt;/a&gt;, &lt;a href=&quot;http://www.iwaenc.org/proceedings/1997/nsip97/pdf/scan/ns970311.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;(15)&lt;/a&gt;), tree of shapes (&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S1047320399904418&quot; rel=&quot;nofollow noreferrer&quot;&gt;(16)&lt;/a&gt;, &lt;a href=&quot;http://link.springer.com/chapter/10.1007/3-540-45986-3_10&quot; rel=&quot;nofollow noreferrer&quot;&gt;(17)&lt;/a&gt;), binary partition tree &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=841934&quot; rel=&quot;nofollow noreferrer&quot;&gt;(18)&lt;/a&gt;, $\alpha$-tree &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4362825&quot; rel=&quot;nofollow noreferrer&quot;&gt;(19)&lt;/a&gt;, ...&lt;/li&gt;&#xA;&lt;li&gt;used for: object detection &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4637886&quot; rel=&quot;nofollow noreferrer&quot;&gt;(20)&lt;/a&gt;, video segmentation &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=663500&quot; rel=&quot;nofollow noreferrer&quot;&gt;(21)&lt;/a&gt;, image segmentation and filtering (&lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-21569-8_24&quot; rel=&quot;nofollow noreferrer&quot;&gt;(22)&lt;/a&gt;, &lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-03613-2_6&quot; rel=&quot;nofollow noreferrer&quot;&gt;(23)&lt;/a&gt;), image simplification &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4378395&quot; rel=&quot;nofollow noreferrer&quot;&gt;(24)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-01-16T13:27:11.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13837" PostTypeId="2" ParentId="13834" CreationDate="2014-01-16T14:35:06.997" Score="2" Body="&lt;p&gt;If I hand you a uniform distribution spanning say, 0 to 1, then I can say that the probability of a variable with this uniform distribution taking on value of say, 0.3 is, &lt;em&gt;equal&lt;/em&gt; to the probability that it takes on a value of 0.7, or 0.01, or 0.93, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, since the uniform distribution is flat, all probability values are &lt;em&gt;equal&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now forget about distributions, imagine a histogram from an image. If you make an image histogram, you are just measuring the popularity of all pixel values from say, 0 to 255. If all pixel values that take on a value of 0, (black), are equal to the number of pixels that take on a value of 255, (white), are equal to the number of pixels taking on a value of 123, (greyish), etc etc, then the histogram is an equalized histogram. Again, &quot;equalized&quot; because all pixel-popularity measures are the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However not all images have this same spread. If you take a picture of a scene with the sun photo-bombing it in the background at noon, most of your pixels live around the 255 area, because the sun has made most pixels white, &lt;em&gt;even if they were not white to begin with&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the histogram will be heavily skewed to the right. Now, the number of pixels that are white, is NOT equal to the number of grey pixels, or the number of black pixels, etc etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in histogram &lt;em&gt;equalization&lt;/em&gt;, this we force all the pixels to take on values, such that when you come to measure the pixel popularities in the end, then will all have &lt;em&gt;equal&lt;/em&gt; values. Hope that helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Not that is we could force all pixel values to have a certain distribution, but in that case we have no guarantee that it will correspond in some form to the original image.   This why you might not see a properly uniform distribution after equalization. Histogram equalization will try to make the PDF &lt;em&gt;as uniform as possible&lt;/em&gt;, while at the same time respecting the original properties of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly but most importantly, histogram equalization was initially developed by assuming &lt;em&gt;continuous&lt;/em&gt; random variables. If the original image has intensities modeled as a &#xA;&lt;em&gt;continuous&lt;/em&gt; random variable $X$ with pdf $p_x(x)$, and the HEQ image result's intensities as a &lt;em&gt;continuous&lt;/em&gt; random variable $Y$ with PDF $p_y(y)$, then $p_y(y)$ will be a uniform distribution, if we transform the random variable $X$ by its own CDF, $T$. That is, $Y$ will be a uniformly distributed &lt;em&gt;continuous&lt;/em&gt; random variable if we set $Y = T(X)$. However, this is for the continuous case. For real images that are discrete, we are &lt;em&gt;estimating&lt;/em&gt; a discrete CDF $T$ from coarse quantization levels, and applying it to a specific number of pixel values. This is why we will not get a perfectly uniform histogram result. Theory proves equalization for a continuous case, while in practice, we are dealing with discrete and quantized images and imperfect CDF estimation no less.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2014-01-23T01:52:23.443" LastActivityDate="2014-01-23T01:52:23.443" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13838" PostTypeId="1" AcceptedAnswerId="49084" CreationDate="2014-01-16T14:58:18.910" Score="3" ViewCount="617" Body="&lt;p&gt;I sample a continuous signal $s(T)$ over time. This leads to $s[t]$, which depends on several factors of which some are (pseudo-) periodic. I am interested in the effect of one such periodic factors and want to look at signal changes during this period under differing experimental conditions. I know the start and end of every period $i$ and said period slowly and slightly varies over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Raw signal $s[t]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gyPH7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first approach was to estimate the size of the periodic changes by looking at the power spectrum, where under certain conditions the largest peak is indeed around the frequency for the mean period which I know a priori.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Power spectrum $S[\omega]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S0lO1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each measurement I know the start and the end time of the current period $i$, say $t_{i,start}$ and $t_{i,end}$. If I calculate the &quot;phase&quot; or relative position in the current period $\varphi(t)=\frac{t-t_{i,start}}{t_{i,start}-t_{i,end}}$ I can reorder my data as such and plot it. Because I have many samples and the frequency of the effect is not correlated to my sampling frequency the phase increase in my reordered data averages out to pretty much linear (so the two images below are almost identical).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reordered raw data for reordered sample number $s[n]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NHkKZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data plotted to phase $s[\varphi]$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TSZOH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking around with google I found that this is called &lt;a href=&quot;https://dsp.stackexchange.com/questions/9547/slow-sampling-of-signal-and-averaging-over-n-periods&quot;&gt;Equivalent-Time Sampling&lt;/a&gt; (ETS) in some fields. However it is difficult to find a mathematical formulation for this operation, so it is difficult to see really what information I keep and lose from my data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;My question now is broad&lt;/em&gt;: is there a formal mathematical way to model ETS (maybe as a filter on a transformed domain?) and how can I make valid observations about the size and qualities (for example waveform) for this effect when using ETS? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above (when calculating $\varphi$) I implicitly asume that the waveform is stretched if a period is longer, but in reality there might just be a longer delay before a certain impulse is processed again. Might it be better to use an absolute time delay since start of current period? (as $\varphi(t)=t-t_{i,start}$) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think the data, once in equivalent time, can also be considered as unevenly spaced timeseries, since $\varphi(t)$ is unevenly spaced due to the differing period lengths. An answer &lt;a href=&quot;https://stackoverflow.com/questions/29644950/matlab-autocorrelation-of-unevenly-spaced-timeseries&quot;&gt;here&lt;/a&gt; suggests &lt;a href=&quot;http://www.eckner.com/papers/unevenly_spaced_time_series_analysis.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;methods&lt;/a&gt; to calculate correlation between unevenly spaced timeseries. With those methods it might be possible to make a comparison between measurements without any filtering and without assuming a certain sampling rate (seems artificially high in the reordered data). Another &lt;a href=&quot;https://stats.stackexchange.com/questions/33796/is-there-any-gold-standard-for-modeling-irregularly-spaced-time-series&quot;&gt;answer&lt;/a&gt; (and &lt;a href=&quot;https://stats.stackexchange.com/questions/49300/how-does-one-apply-kalman-smoothing-with-irregular-time-steps?noredirect=1&amp;amp;lq=1&quot;&gt;this&lt;/a&gt; related answer) suggests to use a Kalman filter to smooth the unevenly spaced time series.&lt;/p&gt;&#xA;" OwnerUserId="5273" LastEditorUserId="5273" LastEditDate="2018-05-09T16:09:58.173" LastActivityDate="2018-05-10T13:16:59.310" Title="Mathematical model of equivalent-time sampling, the resulting unevenly spaced periodic signal, and its interpretation" Tags="|filters|sampling|time-frequency|information-theory|nonuniform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13839" PostTypeId="2" ParentId="13823" CreationDate="2014-01-16T15:06:10.470" Score="1" Body="&lt;p&gt;Your Y axis likely should be scaled to frequency (Hz), not FFT bin index [0..127].  The frequency scale would be something like the bin_index * sample_rate / FFT_length .&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-16T15:06:10.470" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="13841" PostTypeId="1" CreationDate="2014-01-16T19:41:03.390" Score="0" ViewCount="1209" Body="&lt;p&gt;I'm trying to apply a frequency shift to a generated despreading code in order to find and track a broadcast signal CDMA. Expected doppler shift range of the signal from center frequency would be approx +/- 5KHz. Based on freq2 = c/(c-orbitspeed) * freq1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wanting to shift the code based on equations, assuming data set is made of complex numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N = sample size&#xA;imaginary j = (0, 1)           same as notation i&#xA;new sample bin k = fft(generated code)[k] * e(-1 * j * 2 * PI * shift amount / N * k)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this &quot;* j&quot; makes the power an imaginary number part&#xA;e() being the same as *10^power, 10 being a real number (10, 0j)&#xA;do I need to follow the complex^complex rule to evaluate the e() expression? Then use the complex * complex to finish the product??&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void adjust_CodeDoppler(int shift) // of fft data, apply fft in place first on gen_code&#xA;    {&#xA;        complex power;&#xA;        complex e;&#xA;        complex multiplier;&#xA;        power.m_re = 0;&#xA;        e.m_re = 10;&#xA;        e.m_im = 0;&#xA;        for(int n=0; n&amp;lt;N; n++)&#xA;        {&#xA;            power.m_im  = (-2*PI*shift/n*N); //*j part makes this the imag part of power&#xA;            double ph = phaseAngleComp(e); //for (10, 0j) is always 0 = 0/10&#xA;            double mg = magnatudeComp(e);  //for (10, 0j) is alwyas 10, sqrt( 10^2 + 0^2 )&#xA;            multiplier.m_re = pow(mg, power.m_re) * exp(-1 * power.m_im * ph) * cos(power.m_re * ph + power.m_im * log(mg) ); //= 10^power real part&#xA;            multiplier.m_im = pow(mg, power.m_re) * exp(-1 * power.m_im * ph) * sin(power.m_re * ph + power.m_im * log(mg) ); //= 10^power imag part&#xA;            shift_gen_code[n] = multiplier * gen_code[n]; //using complex operator *&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Seperately to affect phase shift in data, Is this done in time domain?? Can this be suffiecient to adjust phase offsets without changing a NCO/VCO on the quad mixer?&#xA;Based on equations: also assuming data is alread I / Q  A/D converted&#xA;    ph = phase angle&#xA;n = bin position, time domain?&#xA;Wc = expected center frequency&#xA;Dpd = desired phase offset at time []&#xA;adjusted_ph = ph[n-1] + Wc + Dpd[n]&#xA;//limit phase shift&#xA;if(adjusted_ph[n] &gt; 2* PI){adjusted_ph[n] = adjusted_ph[n] - 2*PI;}&lt;/p&gt;&#xA;" OwnerUserId="7480" LastEditorUserId="7480" LastEditDate="2014-01-17T12:25:57.490" LastActivityDate="2014-01-17T12:25:57.490" Title="Frequency shift and phase shift (Doppler)" Tags="|fft|" AnswerCount="0" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="13842" PostTypeId="1" CreationDate="2014-01-16T20:21:20.533" Score="6" ViewCount="123" Body="&lt;p&gt;I was reading and trying to reproduce the results in the arXiv preprint of &lt;a href=&quot;http://arxiv.org/abs/1207.0632&quot; rel=&quot;noreferrer&quot;&gt;Periodic Gabor Functions with Biorthogonal Exchange: A Highly Accurate and Efficient Method for Signal Compression&lt;/a&gt; by Asaf Shimshovitz et al., and a few questions arose. In brief, the paper outlines a new (as of 2012) family of wavelet-like expansions (closely related to the von Neumann lattice functions) which are time-frequency localized, and I have questions regarding how badly the method can fail when they're potentially used in signal compression or quantum-chemical calculations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the details of the paper can be stripped away to give a simple linear algebra procedure, as follows. Given a vector $\mathbf{v}\in\mathbb{C}^n$ and a not necessarily linearly-independent basis $\mathbf{G}=\{\mathbf{g}_1,\mathbf{g}_2,...,\mathbf{g}_n\}$ of column vectors spanning $\mathbb{C}^n$, the following identity holds:&#xA;$$\mathbf{B}\mathbf{G}^\dagger \mathbf{v}=\mathbf{v}$$&#xA;where $\mathbf{B}=(\mathbf{G}^\dagger)^{-1}$. In Dirac notation, this trivial statement reads as&#xA;$$\sum_{j=1}^n|\mathbf{b}_j\rangle\langle\mathbf{g}_j|\mathbf{v}\rangle=\sum_{j=1}^n\beta_j|\mathbf{b}_j\rangle=|\mathbf{v}\rangle$$&#xA;which can be interpreted as saying that given any vector $\mathbf{v}$ and basis $\mathbf{G}$, the expansion coefficients $\beta_j$ of $\mathbf{v}$ in the basis $\mathbf{B}$ biorthogonal to $\mathbf{G}$ are simply given by the inner products $\langle\mathbf{g}_j|\mathbf{v}\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a clever choice of $\mathbf{G}$, one often finds that the majority of the inner products $\langle\mathbf{g}_j|\mathbf{v}\rangle$ nearly vanish, and one is naively tempted to approximate $\mathbf{v}$ as&#xA;$$|\mathbf{v}\rangle\approx\sum_{\substack{j=1 \\ \langle\mathbf{g}_j|\mathbf{v}\rangle\geq\delta}}^n|\mathbf{b}_j\rangle\langle\mathbf{g}_j|\mathbf{v}\rangle$$&#xA;where $\delta$ is some compression threshold. In matrix notation, this reads&#xA;$$\mathbf{v}\approx\mathbf{B}_{tr}(\mathbf{G}_{tr})^\dagger\mathbf{v}$$&#xA;where $\mathbf{G}_{tr}=\{\mathbf{g}_j|\langle\mathbf{g}_j|\mathbf{v}\rangle\geq\delta\}$ is the basis $\mathbf{G}$ truncated to only include the basis columns which have considerable overlap with $\mathbf{v}$, and $\mathbf{B}_{tr}$ is the corresponding truncated version of $\mathbf{B}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approximation is decent but not optimal; the optimal approximation is actually&#xA;$$\mathbf{v}\approx\mathbf{B}_{tr}'(\mathbf{G}_{tr})^\dagger\mathbf{v}$$&#xA;where $\mathbf{B}_{tr}'=(\mathbf{G}_{tr}^\dagger)^+$ where $+$ denotes the Moore-Penrose pseudoinverse; a proof of optimality is simple and relies on basic facts about pseudoinverses, so I'll skip it. The use of $\mathbf{B}_{tr}'$ instead of $\mathbf{B}_{tr}$ is referred to as the Porat (Genossar) correction in the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply put, my question is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are there any reliable bounds on the error inherent in this approximation, given knowledge of the coefficients $\langle\mathbf{g}_j|\mathbf{v}\rangle$ and the compression threshold $\delta$? For example, if we choose $\delta$ so that $\frac{\sum_{\langle\mathbf{g}_j|\mathbf{v}\rangle\geq\delta}|\langle\mathbf{g}_j|\mathbf{v}\rangle|^2}{\sum_{j=1}^n|\langle\mathbf{g}_j|\mathbf{v}\rangle|^2}=0.99$, can we say that the truncation-compressed vector is 99% close to the original? Or is it much worse than that? Or can we say nothing? If we can say nothing, is there any further info which would allow us to say something useful?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The paper gives no statements regarding error bounds, which I assume the authors had set aside for later to figure out; this is probably largely due to the fact that the original motivation for the von Neumann wavelet procedure was for quantum mechanical calculations, rather than signal compression applications. Nevertheless, knowing bounds on how reliable the technique is seems like an essential facet of any compression method. For now, let's assume that the basis vectors $\mathbf{g}_j$ of $\mathbf{G}$ are normalized to one ($\mathbf{g}_j^\dagger\mathbf{g}_j=1$). My first thoughts on attacking this were that the error can be quantified by the expression&#xA;$$\epsilon:=\frac{|\mathbf{v}-\mathbf{B}_{tr}'\mathbf{G}_{tr}^\dagger\mathbf{v}|^2}{|\mathbf{v}|^2}=\frac{|(I-\mathbf{A}^+\mathbf{A})\mathbf{v}|^2}{|\mathbf{v}|^2}=\frac{|P_{R(\mathbf{G}_{tr})}\mathbf{v}|^2}{|\mathbf{v}|^2}$$&#xA;where $\mathbf{A}=\mathbf{G}_{tr}^\dagger$ and $P_{R(\mathbf{G}_{tr})}$ is the projector operator onto the subspace spanned by the columns of $\mathbf{G}_{tr}$. But I'm stuck here, and not sure where to go (I'm not particularly good at math). Does anyone have any helpful clues or intuition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an unrelated but interesting bit of visual imagery, here is a picture of the signal $\frac{k^2}{67108864}+\sin&#xA;   \left(\frac{k^3}{64000000}-\frac{k^2}{4900}+\frac{k}{4}\right) \cos&#xA;   \left(\frac{k}{3}\right)$ for $1\leq k\leq 16384$ in the von Neumann domain (brightness corresponds to absolute value of coefficient and color corresponds to phase angle in complex plane, with red being 1, green being $i$, cyan being -1, and purple being $-i$, with the time axis on bottom and the frequency axis on the side):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xEUln.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7577" LastEditorUserId="7577" LastEditDate="2014-01-16T20:56:18.220" LastActivityDate="2015-01-01T22:02:26.600" Title="Error bounds in signal compression represented by truncated Moore-Penrose biorthogonal bases using von Neumann wavelets" Tags="|wavelet|compression|linear-algebra|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13843" PostTypeId="2" ParentId="13834" CreationDate="2014-01-16T20:44:01.677" Score="5" Body="&lt;p&gt;To answer your question histogram equalization is called like this because its &lt;em&gt;function&lt;/em&gt; is to produce an equalized histogram (that is an uniform probability density function).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are different &lt;em&gt;algorithms&lt;/em&gt; that may approach this function, and obviously there is a problem in the example that is shown:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In fact, the algorithm used there will always have trouble producing a flat histogram when mapping the function to a discrete set of 256 (except when the input histogram is already flat!)&lt;/li&gt;&#xA;&lt;li&gt;As a consequence, the cumulative histogram shows discrete jumps which produce this non-regular output histogram.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Why is this simple algorithm still used? Because, &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the output image will often good enough for the initial purpose,&#xA;that is to maximize the range of intensities used in the image - though the histogram may look ugly...&lt;/li&gt;&#xA;&lt;li&gt;it is simple! &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are simple alternatives. The simplest is to use a linear interpolation of the cumulative function. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Theory: In general terms, the method may be easily derived if we know the probability distribution function $dP_{i}$ of variable $a_i$ representing the luminance image at pixel $i$. Indeed,  by choosing the non-linearity as the cumulative distribution function transforming any observed variable $\bar{a}_i$ into:&#xA;$$&#xA;z_i(\bar{a}_i)= P_{i}(a_i \leq \bar{a}_i) = \int_{-\infty}^{\bar{a}_i} dP_{i}(a_i)%&#xA;$$&#xA;This is equivalent to the change of variables which transforms the luminance image to a variable with uniform probability distribution function in $[0, 1]^M$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Evaluation: In physiology (retina for instance), this distribution is assumed to be sampled for each &quot;pixel&quot; (photoreceptor in mammals) over time (for instance, something like &quot;the probability distribution over last minute&quot;). In image processing, when handling one single image, you can assume stationarity over space, that is compute the histogram over all pixel values. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Algorithm: now that we have all in place, some example algorithm in python:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sample code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.misc import lena&#xA;I = 1. * lena()&#xA;I = (I - I.min())/(I.max()-I.min())&#xA;import matplotlib.pyplot as plt&#xA;# the cumulative histogram&#xA;n_quant = 40&#xA;(hist, bins) = np.histogram(I.ravel(), bins=np.linspace(0., 1., n_quant+1), normed=True)&#xA;P = np.cumsum(hist/np.sum(hist))&#xA;# equalization&#xA;I_z = np.interp(I, np.linspace(0., 1., n_quant), P)&#xA;(hist_z, bins) = np.histogram(I_z.ravel(), bins=np.linspace(0., 1., n_quant+1), normed=True)&#xA;plt.bar(np.linspace(0., 1., n_quant), hist, color='r', alpha=.3, width=1./n_quant)&#xA;plt.bar(np.linspace(0., 1., n_quant), hist_z, color='b', alpha=.3, width=1./n_quant)&#xA;plt.title('Histogram of Lena')&#xA;plt.xlabel('luminance')&#xA;plt.ylabel('probability')&#xA;plt.xlim((0,1.))&#xA;plt.savefig('equalization.png')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output (red is raw histogram, blue is equalized). As you can see, there are variations, but it looks better &lt;code&gt;:-)&lt;/code&gt;. Notably, you have less &quot;jumps&quot; around most popular values. The parameter &lt;code&gt;n_quant&lt;/code&gt; is important to tune smoothness versus precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tHLxC.png&quot; alt=&quot;output of code&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1085" LastEditorUserId="1085" LastEditDate="2014-02-06T09:31:19.947" LastActivityDate="2014-02-06T09:31:19.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13844" PostTypeId="1" CreationDate="2014-01-17T01:11:41.407" Score="8" ViewCount="10191" Body="&lt;p&gt;A very simple MATLAB experiment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = 200;  &#xA;fs = 1000;  &#xA;t = 0: 1/fs : 1;&#xA;x = cos(2*pi*f*t);  &#xA;plot(angle(fftshift(fft(x))));  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's the output:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4TLxO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, made a minor change to the above code snippet; reducing the time duration by just 1 sample, as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = 200;  &#xA;fs = 1000;  &#xA;t = 0: 1/fs : 1 - 1/fs;&#xA;x = cos(2*pi*f*t);  &#xA;plot(angle(fftshift(fft(x)))); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the phase spectrum goes totally crazy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/reMIR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In the first plot, I was hoping to see a zero phase at bin 700 which corresponds to the positive frequency of 200 in this example. That doesn't seem to be the case.&#xA;Secondly, I don't understand the linear parts of the graph in plot 1. I do appreciate phase components that could potentially exist due to the so-called numerical noise, but then how could that noise be so 'linear' in phase?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the second plot, why removing just one sample would have such a drastic impact on the phase plot? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Am I doing something fundamentally wrong here? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4673" LastActivityDate="2016-02-26T17:50:51.257" Title="baffled by fft phase spectrum!" Tags="|fft|matlab|phase|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13845" PostTypeId="2" ParentId="13844" CreationDate="2014-01-17T02:38:30.713" Score="17" Body="&lt;p&gt;You aren't doing anything wrong, but you also aren't thinking carefully about what you should expect to see, which is why you're surprised at the result. For question 1, your conjecture is close, but you actually have things backwards; it's numerical noise that's plaguing your second one, not your first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pictures may help. Here's plots of the magnitude and phase for the first trial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = Cos[2.0 \[Pi] 200 Range[0, 1, 1/1000]];&#xA;fx = Fourier[x];&#xA;ListLinePlot[Abs[fx], PlotRange -&amp;gt; All]&#xA;ListLinePlot[Arg[fx], PlotRange -&amp;gt; All]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kBuWH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OIXSz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the second one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = Cos[2.0 \[Pi] 200 Range[0, 1 - 1/1000, 1/1000]];&#xA;fx = Fourier[x];&#xA;ListLinePlot[Abs[fx], PlotRange -&amp;gt; All]&#xA;ListLinePlot[Arg[fx], PlotRange -&amp;gt; All]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VLfbG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bRDnb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's going on here? The second one is easiest to explain. First, the FFT of the second one has zero amplitude everywhere except at the two peaks visible in the magnitude spectrum; this follows since the definition of the FFT using 1,000 datapoints returns frequencies of the form $k/1000$ for $0\leq k\leq 999$, and hence your signal falls &lt;em&gt;exactly&lt;/em&gt; on a frequency bin. As a result, at the other 998 points your signal is entirely due to machine noise due to floating point errors, and hence your phase spectrum is nonsense, because it's literally the phase of pseudorandom numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first one, however, the definition of the FFT encompasses frequencies of the form $k/1001$ for $0\leq k \leq 1000$, whereas your signal frequency is $200/1000$, which is not of the form $k/1001$. As a result, your signal is broadened by &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot; rel=&quot;noreferrer&quot;&gt;spectral leakage&lt;/a&gt;, and will be nonzero almost everywhere. I will not comment on the physical form of the phase plot, but I will say that it admits a closed analytic form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, I think graphs of phase angle alone are a really bad idea for conveying information, precisely for this reason; first, you can't tell if you're looking at the phase of low-amplitude garbage or actual signal, and second, it's not translation-invariant, and it's easy to get utterly bewildering graphs for simple inputs. Much better, if you're still looking for something which conveys phase information, is a graph which simultaneously portrays phase and amplitude information in the same visual manner, such as a plot where phase is encoded as hue and magnitude is encoded as brightness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDENDUM: Here's a couple pictures from Mathematica which illustrate the principle I stated in the preceding paragraph:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hue = Compile[{{z, _Complex}}, {(1.0 Arg[-z] + \[Pi])/(2 \[Pi]), &#xA;Exp[1 - Max[Abs[z], 1]], Min[Abs[z], 1]}, &#xA;CompilationTarget -&amp;gt; &quot;C&quot;, RuntimeAttributes -&amp;gt; {Listable}];&#xA;L = 500;&#xA;data = Table[Boole[x &amp;lt;= 11 &amp;amp;&amp;amp; y &amp;lt;= 11], {x, L}, {y, L}];&#xA;Image[hue@&#xA;RotateRight[&#xA;10 RotateRight[Fourier[RotateRight[data, {-5, -5}]], {L/2, L/2}]], &#xA;ColorSpace -&amp;gt; Hue, Magnification -&amp;gt; 1]&#xA;Image[hue@&#xA;RotateRight[&#xA;10 RotateRight[Fourier[RotateRight[data, {-4, -4}]], {L/2, L/2}]], &#xA;ColorSpace -&amp;gt; Hue, Magnification -&amp;gt; 1]&#xA;Image[hue@&#xA;RotateRight[&#xA;10 RotateRight[Fourier[RotateRight[data, {0, 0}]], {L/2, L/2}]], &#xA;ColorSpace -&amp;gt; Hue, Magnification -&amp;gt; 1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JpcOl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/urv2X.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/73Lcp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T2D59.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All three images are 2D Fourier transforms of the same input signal (an $11\times 11$ square of 1's padded with zeros to a length of $500\times 500$), but the inputs have been cyclically rotated by 5, 4, and 0, and 200 datapoints. The magnitude spectra (encoded by pixel brightness) are identical, but the phase spectra are completely different! Phase encoding is done so that 1 maps to red, $i$ maps to green, $-1$ maps to cyan, and $-i$ maps to purple. This is what I mean when I say that phase spectra are non-shift invariant, and thus not amenable to human visual understanding. For example, with a cyclic shift of 200 datapoints, it's completely impossible to tell what's going on in the phase, since it just looks like static, but the input signal is no more complicated than the other input cases.&lt;/p&gt;&#xA;" OwnerUserId="7577" LastEditorUserId="7577" LastEditDate="2014-01-17T18:09:08.913" LastActivityDate="2014-01-17T18:09:08.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13846" PostTypeId="2" ParentId="13834" CreationDate="2014-01-17T04:45:15.030" Score="1" Body="&lt;p&gt;After doing some math, I think we can see why it's called equalization when we consider the continuous variable case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $y = g(x)$ then we can show that&#xA;$f_{Y}(y)=f_{X}(x)\cdot |{dx \over dy}|$ where $f$ is the density function.&#xA;If we equate $f_{Y}(y)$ to a uniform distribution (which is the aim of equalization), we get $f_{X}(x)\cdot |{dx \over dy}| = 1$ within the range of $X$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, $dy = f_{X}(x)dx$ or $\int_{0}^y dy = \int_{-\inf}^x f_{X}(x)dx$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y = \int_{-\inf}^x f_{X}(x)dx = F_{X}(x)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or $g(x) = F_{X}(x)$ which is what we do in the standard histogram equalization method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In discrete case even though final distribution doesn't look like discrete uniform distribution, it's the best approximation that is theoretically possible. Also this is useful &lt;a href=&quot;https://dsp.stackexchange.com/questions/7803/lesser-bins-histogram-looks-more-equalised-than-higher-bins-histogram-after-hist?rq=1&quot;&gt;Lesser bins histogram looks more equalised than higher bins histogram after histogram equalisation?&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-01-17T04:50:39.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13847" PostTypeId="2" ParentId="13824" CreationDate="2014-01-17T06:15:36.393" Score="1" Body="&lt;p&gt;Non-Recursive filters are synonym to FIR filters. if you will take z transform of difference equation which is non recursive then you will find out poles for FIR can lie at only zero.Hence if the equation is non-recursive then surely it will represent a FIR filter and its z transform will have all poles at zero.for example, if you have &#xA;     y(n)=x(n)-2x(n-1)&#xA;then it is surely a FIR filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But Recursive equations can represent IIR or FIR. &#xA;&lt;strong&gt;case 1:when does a recursive can represent a FIR?&lt;/strong&gt;&#xA;if you introduce a unit delay in above equation then &#xA; y(n-1)=x(n-1)-2x(n-2)&#xA;and then subtract it from above one you will have&#xA;  y(n)-y(n-1)=x(n)+x(n-1)-2x(n-2)&#xA;Now this equation is a recursive one and  if you will find out its Z transform you will see that it has a pole  at 1.then if you see its zeros  it  will surely have a zero at exactly at the same point at which pole is present hence it cancels the effect of that pole making the system give a finite response.&#xA;&lt;strong&gt;case 1:when does a recursive can represent an IIR?&lt;/strong&gt;&#xA;this is the case which exactly fits the equation you provided in your example. Find z transform and you will see that a pole is present in z transform that lie at a position other than 0 causing the system to give infinite response&lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2014-01-17T06:15:36.393" CommentCount="1" CommunityOwnedDate="2014-01-17T06:15:36.393" ContentLicense="CC BY-SA 3.0" />
  <row Id="13850" PostTypeId="1" CreationDate="2014-01-17T12:53:24.373" Score="9" ViewCount="3445" Body="&lt;p&gt;&lt;em&gt;Conditional entropy&lt;/em&gt; $H(X|Y)$ tells us how much the average uncertainty about a channel input $X$ is after observing channel output $Y$, and &lt;em&gt;mutual information&lt;/em&gt; $I(X,Y)$ measures how much information about channel input $X$ can be obtained observing channel output $Y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doesn't this mean that $H(X|Y)$ and $I(X,Y)$ complement each other or tell us the same thing? If so, then since &lt;em&gt;mutual information&lt;/em&gt; is symmetric $I(X,Y)=I(Y,X)$, shouldn't &lt;em&gt;conditional entropy&lt;/em&gt; be symmetric as well?&lt;/p&gt;&#xA;" OwnerUserId="7585" LastEditorUserId="1273" LastEditDate="2014-01-17T14:13:08.067" LastActivityDate="2021-08-14T20:00:59.533" Title="Why is mutual information symmetric but conditional entropy isn't?" Tags="|information-theory|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13851" PostTypeId="1" CreationDate="2014-01-17T13:23:20.313" Score="5" ViewCount="1629" Body="&lt;p&gt;I am wondering about whether or not there is a theoretical limit as to the speed at which we can compute a DFT. We all know that the FFT executes in $O (N \log N)$ time. However, is this a lower bound of some sort? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Might there be yet faster algorithms that have yet to be discovered which we do not currently know about that are faster, or is this a holy boundary that cannot be crossed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Apparently this is a &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_science&quot; rel=&quot;noreferrer&quot;&gt;known unsolved problem&lt;/a&gt; in CS, (thanks to @John). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what are the details of the problem? Where would one start to try to make improvements?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="80" LastEditDate="2014-01-17T17:09:30.200" LastActivityDate="2023-07-03T00:20:20.893" Title="Is $O (N \log N)$ FFT speed the fastest we can ever attain?" Tags="|fft|fourier-transform|dft|" AnswerCount="4" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="13852" PostTypeId="1" CreationDate="2014-01-17T13:46:15.910" Score="2" ViewCount="633" Body="&lt;p&gt;I am using a miniature car and I want to estimate the position. We can not use GPS modules and most of the tracking systems that I saw, are using IMU sensor with the GPS module. In our car we are able to find our exact correct location with image processing but for some parts that don;t have enough markings we can not do this. So we want to use the IMU as backup for our positioning. so as long as the positioning is close is good for us.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are only interested in our 2D position since the car is on a flat ground.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a IMU 9DOF sensor and I want to calculate my movement. I have seen some amazing works with IMU for tracking body movements but no code or simple explanation anywhere about it. So basically, I have the reading from accelerometer, gyro and magnetometer. I also have orientation in quarternions. From the device I am also getting the linear acceleration but even when I am not moving it in any direction the values are not $0$ which is really confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please help me how to approach this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7589" LastEditorUserId="1273" LastEditDate="2014-01-17T14:15:23.260" LastActivityDate="2014-01-17T14:15:23.260" Title="Tracking 2D positioning with IMU Sensor" Tags="|math|position|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13855" PostTypeId="1" CreationDate="2014-01-17T15:03:05.807" Score="0" ViewCount="217" Body="&lt;p&gt;I understand and have implemented a 2D discrete wavelet transform that uses a Haar wavelet to process images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I would like to implement a 2D Cohen-Daubechies-Feauveau wavelet transform, but I am uncertain about how to do the inverse transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Haar transform uses a 2x2 kernel, so I have 4 coefficients for each 2x2 block of pixels, and it's obvious to me how to reverse transform to reconstruct my pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CDF wavelet uses odd tap filters, so at each image location &lt;code&gt;(i,j)&lt;/code&gt;, I have 4 coefficients.  It seems, therefore, that there is no need to downsample -- I can simply get 4 coefficient images, where each is the same size as the original image, and then run the reverse transform on those four images to reconstruct the original.  Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the method I tried, but it does not restore the image -- it just gives me garbage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If A is the low pass filter and B is the high pass filter, x is the image, and x(A,B) means apply filter A to x horizontally and B to x vertically:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;x1 = x(A,A)&lt;/li&gt;&#xA;&lt;li&gt;x2 = x(A,B)&lt;/li&gt;&#xA;&lt;li&gt;x3 = x(B,A)&lt;/li&gt;&#xA;&lt;li&gt;x4 = x(B,B)&lt;/li&gt;&#xA;&lt;li&gt;y1 = x1(B,B)&lt;/li&gt;&#xA;&lt;li&gt;y2 = x2(B,A)&lt;/li&gt;&#xA;&lt;li&gt;y3 = x3(A,B)&lt;/li&gt;&#xA;&lt;li&gt;y4 = x4(A,A)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sum y1, y2, y3, y4 to get original image, x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this method look correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am certain that I am doing the forward transform correctly, but I am unsure about the reverse transform.  I have read the Wikipedia article on &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_wavelet_transform&quot; rel=&quot;nofollow&quot;&gt;Fast Wavelet Transform&lt;/a&gt;, and I believe that I am implementing what this page states (without the downsampling).&lt;/p&gt;&#xA;" OwnerUserId="7592" LastEditorUserId="7592" LastEditDate="2014-01-21T14:54:47.097" LastActivityDate="2014-01-21T14:54:47.097" Title="How do I implement the CDF wavelet inverse?" Tags="|discrete-signals|wavelet|2d|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13856" PostTypeId="1" CreationDate="2014-01-17T15:26:30.833" Score="6" ViewCount="4041" Body="&lt;h3&gt;First of all I would like to say that :&lt;/h3&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I'm new to DSP and in a &amp;quot;learning curve&amp;quot; hence the &amp;quot;basicness&amp;quot; of my questions.&lt;/li&gt;&#xA;&lt;li&gt;I've read as many posts/articles as possible on the internet but still need &amp;quot;guidance&amp;quot;.&lt;/li&gt;&#xA;&lt;li&gt;I'm french hence the bad formulation sometimes.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3&gt;My mission/data context :&lt;/h3&gt;&#xA;&lt;p&gt;Performing data analysis on real data sets (oil-rig data).&#xA;Sometimes data collected on the rig present low frequency component due to rig movements.&#xA;Data are collected every 5 seconds so the &lt;strong&gt;sampling rate is 0.2 Hz&lt;/strong&gt;. The size of the data to be analysed will be &lt;strong&gt;1024/2048/4096 points&lt;/strong&gt; let's call it &lt;strong&gt;N&lt;/strong&gt; is this post.&#xA;My mission is to perform a filtering on these data to eliminate the low frequency component.&#xA;&lt;strong&gt;This is not a real time application&lt;/strong&gt;. The range of data to be analysed will be chosen and then the analysis performed.&lt;/p&gt;&#xA;&lt;h3&gt;Chosen approach :&lt;/h3&gt;&#xA;&lt;p&gt;Process these data with a FFT, filtering the FFT and perform an IFFT to obtain and clean(er) set of data. Basically the lowest frequency found in the FFT is to be eliminated.&#xA;Many users suggested me to use the overlap-add method to obtain the desired result.&#xA;First I was thinking of just zeroing low frequency related bins in my FFT but my readings on the subject suggested to rather use a high pass filtering (with spectral inverted windowed-sinc).&lt;/p&gt;&#xA;&lt;p&gt;Designing this filter and applying it is what I post here for because it turned out to be way more difficult than expected.&lt;/p&gt;&#xA;&lt;h3&gt;Questions :&lt;/h3&gt;&#xA;&lt;p&gt;Do I have to use the overlap-add method considering that my application is not a real time one ?&lt;/p&gt;&#xA;&lt;p&gt;For what I have understood I need to design a high pass filter kernel with a spectral inverted sinc function. Then I have to perform a FFT on my filter kernel and multiply points by points my filter FFT(1) coefficients with my data FFT(2) coefficient before performing a IFFT on the resulting FFT. Am I correct on this one ?&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;According to my readings I can obtain a spectral inverted sinc function by inverting (-sin(x)/x) it and adding 1 to the center of symmetry. I am right, do you guys confirm ? Do I add 1 on the one center point only ?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the right size to choose for my filter kernel ? Is it the same size &lt;strong&gt;N&lt;/strong&gt; as my data ? As I have to multiply my FFT(1) with my FFT(2) I would think that I have to choose the same size but I'm probably wrong on this one and the overlap add method may be the answer.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The kernel filter designing is tricky, I don't know where to place the central lobe of my spectral inverted sinc, in 0, on a specific offset in the time domain ?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7475" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2020-10-14T05:14:12.547" Title="Filter size vs. FFT size and Overlap add" Tags="|fft|highpass-filter|ifft|" AnswerCount="4" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13857" PostTypeId="2" ParentId="13855" CreationDate="2014-01-17T15:48:05.320" Score="0" Body="&lt;p&gt;It's possible that you get a small shift with forward/backward transforms. This is especially the case if you're trying to keep your 1D filters causal (no future data needed). Anyway, &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_wavelet_transform&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; gives you the basic form for  the inverse transform: you apply the two kernels in reverse to the &lt;code&gt;s&lt;/code&gt;and &lt;code&gt;d&lt;/code&gt; terms &amp;amp; sum the two contributions. Don't mind the &lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-01-17T15:48:05.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13858" PostTypeId="2" ParentId="13856" CreationDate="2014-01-17T16:09:30.963" Score="0" Body="&lt;p&gt;If you have a data sequence that is larger than the size of data window used in each FFT, then you will need to use an algorithm such as overlap-add or save.  The size of the FFT should be equal to or larger than the sum of the data window plus the impulse response of your filter (your windowed Sinc).  The size of your windowed Sinc will be related to your desired filter transition width and frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-17T16:09:30.963" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13859" PostTypeId="2" ParentId="13844" CreationDate="2014-01-17T17:47:36.570" Score="0" Body="&lt;p&gt;If you want to vary the frequency of a signal or the FFT length so that the signal varies between exactly periodic and not exactly periodic in the FFT aperture, and don't want to see the phase of the peak magnitude bin for that signal change, one can reference the initial phase of the signal to the center if the FFT aperture instead of the beginning (for a generated sin(t), put t=0 in the center of the FFT array).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-17T17:47:36.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13860" PostTypeId="1" AcceptedAnswerId="13862" CreationDate="2014-01-17T18:15:52.267" Score="0" ViewCount="211" Body="&lt;p&gt;I am fairly new to DSP have been reading up on digital filters and have a few questions. I have a signal with very high frequencies whose DC component i want to estimate. The magnitudes of these frequencies can be very high too. I can average out the signal, and this works, but the high frequencies mean high sample rate. I want to do this a lot faster. If i can filter the high frequencies, i should be able to average out the signal with a lower sample rate. To do this i need a low pass filter. If i can design a low pass filter that can attenuate all frequencies above the cutoff frequency (Fcutoff) by a factor of K or more decibels (K can be any number, -1000db, -100000db etc;) then i should be able to estimate the DC component (DC component estimate will be a function of K) much faster. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Is it possible, in theory, to design such a low pass filter, where i specify not just Fcutoff but also K. And if i were to implement such a filter, which filter would be the best one. FIR or IIR? Butterworth, chebychef, elliptic etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b)I was reading up on the butterworth filter on wikipedia and other online sources. Wiki states that the butterworth filter for high frequencies has an attenuation of 20n db/decade, where n is the filter order. Consider a filter of order 5. If i want all frequencies &gt;= 1Hz to be attenuated by &gt;= -100db, then i can move the cutoff to 0.1hz. And if &gt;= 1Hz is to be attenuated by &gt;= -1000db, i can move the cutoff to 0.01hz. Doing this would still allow the DC component to pass through and filter everything else out. Theoretically this should be possible, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;c) when you have the magnitude response of a filter in decibles do you use the 10log rule or the 20log rule? I am assuming the 10log rule. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your answers!&lt;/p&gt;&#xA;" OwnerUserId="7502" LastActivityDate="2014-01-18T01:07:00.340" Title="A question on filters" Tags="|filters|lowpass-filter|dsp-core|downsampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13862" PostTypeId="2" ParentId="13860" CreationDate="2014-01-17T21:01:12.673" Score="1" Body="&lt;p&gt;Too many things to comment here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Decibels and thousands never go together. -1000dB means $10^{100}$ power attenuation (or $10^{50}$ amplitude attenuation), which is &lt;em&gt;A LOT&lt;/em&gt; (an astronomical lot!): the noise level of any electronics, the DAC quantization noise, or the noise introduced by digital arithmetic will make your 1000 dB attenuation useless. Furthermore, designing a filter for such attenuation will normally result in a order so high it is impossible to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider maximum gains or attenuations in the 100s of dB. As a reference, signal to noise ratio of CD encoding is around 96 dB. Or a satellite radio link can have a free-space attenuation of hundreds of dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- The $20 N$ dB/decade attenuation of (low-pass) filters is an asymptotic slope. The actual frequency response depends on the type of filter (Butterworth or Bessel have the smoothest response). Which to choose depends on your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- How does your system work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;analog signal -&amp;gt; ADC -&amp;gt; digital LPF -&amp;gt; downsampling -&amp;gt; average&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;analog signal -&amp;gt; analog LPF -&amp;gt; ADC -&amp;gt; average&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why don't you place a big RC filter and sample at a lower frequency? You'll still get your average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, you &lt;em&gt;always&lt;/em&gt; need a low-pass filter before the sampler to avoid aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4- for your (c) question: if you consider amplitude response of the filter, then it is $20 \log$. If you consider magnitude squared (or power response) then $10 \log$.&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2014-01-18T01:07:00.340" LastActivityDate="2014-01-18T01:07:00.340" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13864" PostTypeId="1" CreationDate="2014-01-17T22:15:17.427" Score="1" ViewCount="328" Body="&lt;p&gt;Using MATLAB signal processing toolbox, I have created signals like dirichlet, chirp and etc and and obtained their fourier and cosine fourier transform. Now I want to find the frequency where for example A% frequencies are less than that and use it as a thresholding frequency to compact the signal and eliminate unnecessary details?&#xA;Could you please tell me a little more about thresholding frequencies and how to choose them in signal processing?&lt;/p&gt;&#xA;" OwnerUserId="5009" LastEditorUserId="368" LastEditDate="2016-01-04T19:16:06.923" LastActivityDate="2016-05-03T22:12:27.890" Title="make a threshold frequency based on percentage of frequencies less than that?" Tags="|matlab|fourier-transform|frequency|thresholding|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13865" PostTypeId="2" ParentId="10737" CreationDate="2014-01-17T22:47:43.890" Score="2" Body="&lt;p&gt;Check out OpenALPR (&lt;a href=&quot;http://www.openalpr.com&quot; rel=&quot;nofollow&quot;&gt;http://www.openalpr.com&lt;/a&gt;).  It uses Local Binary Patterns (LBP) to identify plate regions -- so it should work independently of background colors.&lt;/p&gt;&#xA;" OwnerUserId="7595" LastActivityDate="2014-01-17T22:47:43.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13866" PostTypeId="1" CreationDate="2014-01-17T23:56:28.007" Score="2" ViewCount="7417" Body="&lt;p&gt;I'm trying to understand PSD, and, it's functions.&lt;/p&gt;&#xA;&lt;p&gt;So far I have carried out the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Segmented a signal with &lt;code&gt;NFFT = 256&lt;/code&gt; and &lt;code&gt;hop_size = 128&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Windowed each of these segments (Hamming)&lt;/li&gt;&#xA;&lt;li&gt;DFT of each Window&lt;/li&gt;&#xA;&lt;li&gt;Taken the first half of the resulting matrix &lt;code&gt;(n/2+1)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;From what I have read so far, the algorithm can be best described as the following:&lt;/p&gt;&#xA;&lt;p&gt;We take the squared magnitude of the LENGTH &lt;code&gt;NFFT&lt;/code&gt;, we calculate this by: &lt;code&gt;mag = (bin.re * bin.re + bin.im * bin.im)&lt;/code&gt;. This gives the magnitudes of each of the points in the DFT bin.&lt;/p&gt;&#xA;&lt;p&gt;Q1: These are &amp;quot;averaged&amp;quot; to form &lt;code&gt;Pxx&lt;/code&gt; &lt;code&gt;Pxx&lt;/code&gt; is a bin of size &lt;code&gt;NFFT/2+1&lt;/code&gt; which I assume store the averages, but, do these store the averages for each of the bins? Because I don't quite understand:&lt;/p&gt;&#xA;&lt;p&gt;If I have a resulting 2D matrix containing values:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;a = [[1, 2, 3, 4, 5, 6, 9, 8],&#xA;     [2, 5, 8, 9, 7, 8, 9, 7],&#xA;     [4, 5, 6, 4, 7, 8, 9, 8]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I then take the &amp;quot;average&amp;quot; of these.. I.e. (1+2....., n)/NFFT/2+1. This is only going to give one value, for each of the bins?&lt;/p&gt;&#xA;&lt;p&gt;OK, so now onto Scaling. Can we therefore scale to the Frequency? If so, do we scale by &lt;code&gt;Fs * window_size&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&lt;p&gt;I don't think my last question made that much sense..&lt;/p&gt;&#xA;&lt;p&gt;So far I have a 2D vector containing &lt;code&gt;146x128&lt;/code&gt;..&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;block1 = [1, 2, 3, ...... n] (where `n` is 128) &#xA;&#xA;block2 = [0, 5, 6, ...... n] &#xA;&#xA;.....&#xA;&#xA;block146 = [1, 4, 5, .... n]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, if I calculate the average magnitude of each of these blocks, i.e. &lt;code&gt;sum(sqrt(re*re+im*im))/128&lt;/code&gt; this will give me the averages for each block (a vector containing 146 samples).&lt;/p&gt;&#xA;&lt;p&gt;For each of my samples in the &lt;code&gt;blocks&lt;/code&gt; do I therefore divide each of these by the average magnitude for that particular block? I.e.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;block1 = [0, 1, 2, ...... n]&#xA;average = (0+1+2)/128 = 0.58 (for example)&#xA;&#xA;result = [0/0.58, 1/0.58, 2/0.58.... n]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Therefor my resulting vector will still be a 2D vector.&lt;/p&gt;&#xA;&lt;p&gt;Does this make sense?&lt;/p&gt;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;1 - What type of signal are you trying to process? I.e: What type of application is it? Is it a unidimensional signal, like Audio sampled at 44.1Khz? Or is it a multidimensional signal like an image or video?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I'm trying to process a Audio signal.&lt;/p&gt;&#xA;&lt;p&gt;What I have done so far is:&lt;/p&gt;&#xA;&lt;p&gt;Taken a 1D input vector, this vector is then split into blocks (of size &lt;code&gt;256&lt;/code&gt; with an overlap/hop of &lt;code&gt;128&lt;/code&gt; this gives me a total of 146 blocks with each containing 128 samples. These samples have been multiplied by the Hamming Window and then a DFT has been passed through.&lt;/p&gt;&#xA;&lt;p&gt;These blocks contain the resulting values after Windowing and DFT has taken place.&lt;/p&gt;&#xA;&lt;p&gt;2 - Where are you performing these calculations? Matlab, Octave, python, or some other?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I am performing these calculations using C++&lt;/p&gt;&#xA;&lt;p&gt;3 - When you say 2D vector (maybe could be less confusing to call this a Matrix), What does the numbers inside mean? what are the columns and what are the rows?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The columns and rows contain the DFT results of the Hanning windowing of each block at &lt;code&gt;256/2 = 128&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Essentially, what I'm attempting to do is create a spectrogram. Currently, I can plot the spectrogram with magnitudes of the values, i.e. &lt;code&gt;(re*re+im*im)&lt;/code&gt; however, instead of plotting the magnitudes, I want to plot the overall power spectrum (PSD) so I can determine where the power is mainly within the signal.&lt;/p&gt;&#xA;&lt;p&gt;If I do this using &lt;code&gt;matplotlib&lt;/code&gt; I can get the following results:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OVNum.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;So in theory, instead of showing the &lt;code&gt;magnitudes&lt;/code&gt; which is what I'm currently doing, I want to show the PSD (like in the graph). I looked at the matplotlib source code and this is what was given:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result, windowVals = apply_window(result, window, axis=0,&#xA;                                  return_window=True)&#xA;result = np.fft.fft(result, n=pad_to, axis=0)[:numFreqs, :]&#xA;&#xA;result = np.conjugate(result) * result&#xA;&#xA;# for PSD&#xA;result /= (np.abs(windowVals)**2).sum()&#xA;&#xA;result[1:-1] *= scaling_factor&#xA;&#xA;# where scaling_factor is either 1 or 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To me, the above code looks like they are taking the squared sum of the WindowValues (Which is Hamming) and dividing each value from the &lt;code&gt;result&lt;/code&gt; (which is the resulting DFT) and finally multiplying by the scaling factor.&lt;/p&gt;&#xA;&lt;p&gt;Does this look correct?&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-01-18T21:04:06.267" Title="Power Spectral Density estimate (PSD)" Tags="|fft|stft|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13868" PostTypeId="2" ParentId="13696" CreationDate="2014-01-18T01:38:01.970" Score="1" Body="&lt;p&gt;I'm not sure about how much experience you have in writting software, but if what you want is to hide some data information within an analog audio signal, it seems for me like the way to go would be to use spread spectrum modulation and encode the data digitally and add it to your audio signal as some background noise.&#xA;Spread spectrum is in itself already a form of encryption, so the bytes you add there will be from the get go, very difficult to recover for a hacker unless they: 1-know that are there, and 2-have the key for generating the pseudorandom sequence to de-spread the signal.&#xA;But if you want even more security you can choose to packet your data by SSH tcp packets, and have in your phone a program to extract those from the digital signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for point number 2. My suggestion immplies that you add something to the analog signal, or if you will to the PCM raw waveform, which is the same for all practical purposes. So, taking into account that the job of an encoder/compressor like mp3 is to compres the signal, but to eventually recover the original waveform with as less RMS error as possible, we could say that the original noise waveform that you add will still be there, slightly modified, but still there, and hence when you recover the bits by demodulation, and apply suitable Error correction tecniques, I think your data should still be there intact as it was put into the sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please take into account that i just suggested a possible technology, normally used with narrowband RF signals, but maybe you could do some research and check if it will work in your scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also Another technique that could be used, if you want to send Text (Like they do in the video), is to generate based on your text a signal that will look like the ASCII characters in the time-frequency plane. Then to recover you just perform time-frequency analisys and use any image recognition algorithm.&#xA;This just came to mind, so it probably sounds very wierd, but may be another way to add another signal to an audio file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-18T01:38:01.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13869" PostTypeId="2" ParentId="7539" CreationDate="2014-01-18T02:28:35.590" Score="2" Body="&lt;p&gt;The best is to calculate Hurst for stationary data (as then you can somehow find out if there are long range dependency signals which are not part of AR or MAs) but you can do non stationary as well. You can calculated froma fractal or wavelet transforms. Results are different   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In calculating Hurst you have to divide the data in short windows and average the results, (place a range the last 8 elements). Hurst can fluctuate significantly depending on the period you select. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-04-29T22:07:49.237" LastActivityDate="2015-04-29T22:07:49.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13870" PostTypeId="2" ParentId="13866" CreationDate="2014-01-18T03:11:44.973" Score="3" Body="&lt;p&gt;First of all, what do you mean when you say &quot;Taken the first half of the resulting matrix (n/2+1)&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT will result in a vector, but maybe you mean taking only the first half of the FFT samples because the others are the negative frequencies and hence redundant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, the process you describe is actually correct, and there is no need to do anything else. In your example with the resulting matrix a, you aparently took an FFT of size 8 (Or 16 if you then choped the second half of it). But what you do is simply take the average of all the first numbers of these vectors, and that would be an estimate of the Power spectral Density at f = 1*fs/NFFT. &#xA;Taking the average of all the second number will be an estimate of PSD at f = 2*fs/NFFT, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example the PDS would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PSD = 1/3*[(1+2+4) , (2+5+5) ,(3+8+6) , ... ];&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you are analizing in real time as you carry out the computation, if the signal is Wide sense stationary, then it should converge or hover around some value, but if it is not, it will deviate over time to adjust to the new coming statistics of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i understood you correctly, that should be it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:  oops i forgot about the important scaling factor. The scaling factor should be introduced to preserve the parseval theorem between the PSD and its transform (The autocorrelation). If you windowed your signal first, i think you should apply the scaling factor 1/sum(W*fs/NFFT), where W is your window vector. Since you are merely dividing by the integral of the window function in the frequency domain This is what you add to the estimate of the frequency component  when you do the FFT by windowing first. Because the FFT alone already preserves the energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am even more confused with the 2-D thing. Let me try an ask you a few questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - What type of signal are you trying to process? I.e: What type of application is it? Is it a unidimensional signal, like Audio sampled at 44.1Khz? Or is it a multidimensional signal like an image or video?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Where are you performing these calculations? Matlab, Octave, python, or some other?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - When you say 2D vector (maybe could be less confusing to call this a Matrix), What does the numbers inside mean? what are the columns and what are the rows? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 - Did you check the link to mathworks? i think you will find what you are trying to do, is well explained there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, just to make sure you understand the backgroun well enough, you could refer to some classical books that have the topic very well explained:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Digital Signal Processing, Principles, Algorithms And Applications&lt;/strong&gt; -Proakis &amp;amp; Manolakis - 3rd Ed. Ch. 12&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And the Father of all books in spectral Estimation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Spectral Analysis of Signals&lt;/strong&gt; - Stoica &amp;amp; Moses&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ahh, ok, now i get what you are trying to do. So, here's the thing. I gave a quick read to the sections on FFT and PSD in the books by Stoica and Proakis, and still can't quite understand why they propose a scaling factor of simply 1/N to the FFT, while the matlab function for PSD using periodogram method scales the FFT by 2/(Fs*N), being N the length of the FFt, in your case 256.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i don't know a lot of C++ but i would say do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Take first frame X, which consists of 256 samples of audio signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - apply 256 FFT to it. you obtain Xfft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - To each complex value Xfft(i), for i = 0...255, do xfft(i)*conj(xfft(i))&#xA;which is equal to abs(xfft(i))^2. this you already did,so up to here nothing new.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 - Multiply the whole vector Xfft by 2/(Fs*N).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will give you the Power spectral density for your frame X. Now take the next frame and do the same, And when you reach a number of frames that you would like to plot, you stop and plot your vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now since you are taking frames every 128 samples, your estimates at each time step will be sort of crammed up together, so a trick that youwould use is the fact that a Speech/audio signal is approximately wide sense statinary (WSS) in an interval of 20-50 msec (See Speech Enhancement - Jacob Benesty).&#xA;So what you could do, is assuming you have an Fs = 44100, that gives you a period of 50msec of around 2205 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the dimensions of the frames you took you could easily average 15 or 16 overlaped frames and get a Smoother estimate of the PSD. But the choice is yours, experiment with it and have fun!&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="7599" LastEditDate="2014-01-18T21:04:06.267" LastActivityDate="2014-01-18T21:04:06.267" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13871" PostTypeId="1" CreationDate="2014-01-18T04:15:55.530" Score="0" ViewCount="1669" Body="&lt;p&gt;I'm trying to figure out how FFT's phase works. Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;t = np.linspace(0,120,1200)&#xA;acc = lambda t: 10*np.sin(2*np.pi*t)&#xA;&#xA;# signal is a perfect 10 amplitude 1 frequency sin wave&#xA;signal = acc(t)&#xA;&#xA;FFT = np.fft.rfft(signal)&#xA;freqs = np.fft.rfftfreq(len(signal),1/10.)&#xA;real = signal[110]&#xA;total = 0&#xA;for binnum in range(len(FFT)):&#xA;    bin = FFT[binnum]&#xA;    amp = (np.sqrt(bin.real**2 + bin.imag**2))/len(freqs)&#xA;    angle = np.angle(bin)&#xA;    phase = np.arctan2(bin.imag, bin.real)&#xA;    freq = freqs[binnum]&#xA;    contribution = amp * np.sin(2*np.pi*freq*t[110] + phase)&#xA;    total += contribution&#xA;&#xA;    print &quot;Amp: %f, angle: %f, phase: %f, freq: %f&quot; % (amp, angle, phase, freq)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the print, I see this line: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;mp: 9.815303, angle: -1.256637, phase: -1.256637, freq: 1.000000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It thinks the phase of the perfect 1 frequency wave is -1.25, but it should be 0. How do I find the right phase?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I understand if it's because of spectral leakage, but how does the inverse FFT work then? I was under the impression that to reconstruct the signal at time t, you'd just sum up all the contributions from the sinusoidal waves. But it doesn't work, since the output of the above code is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;total: -9.90868489422&#xA;real: 0.576119838246&lt;/p&gt;&#xA;" OwnerUserId="7596" LastEditorUserId="7596" LastEditDate="2014-01-18T04:44:22.190" LastActivityDate="2014-01-18T10:06:22.217" Title="Help understanding FFT Phase: code and results provided" Tags="|fft|fourier-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13872" PostTypeId="2" ParentId="2962" CreationDate="2014-01-18T04:57:57.070" Score="4" Body="&lt;p&gt;As Bjorn Roche was saying, using FFT for this would be terribly inneficient. But here it goes in a very very simple fashion using the method of upsample filter and downsample in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Take desired vector signal of length N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Perform N point FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - Zero padd the FFT with 160*N zeros at the middle of the FFT vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 - Perform IFFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5 - Select one out of 441 samples discarding the other 440.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will be left with a vector of length N*160/441, that will be your resampled signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see you are doing a lot of pointless computations, because most of the results will be then thrown away. But if you have access to the code performing the FFT, you could actually tweak it a little bit so it only calculates the IFFT results that you will end up with and not the ones you will throw away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-18T04:57:57.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13873" PostTypeId="2" ParentId="13871" CreationDate="2014-01-18T07:37:08.500" Score="1" Body="&lt;p&gt;You phase isn't zero because your FFT width isn't an exact multiple of your sinewave's period.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-18T07:37:08.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13874" PostTypeId="2" ParentId="13871" CreationDate="2014-01-18T10:06:22.217" Score="1" Body="&lt;p&gt;Use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = np.linspace(0,120,1200, endpoint=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to get exactly 1200 sampling points with the correct wrap-around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then consider also that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(x)=\frac{e^{ix}-e^{-ix}}{2i}=\tfrac12 e^{i(x-\frac\pi2)}+\tfrac12e^{-i(x-\frac\pi2)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which leads to the then observable phase of -1.570796...&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-18T10:06:22.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13875" PostTypeId="2" ParentId="13856" CreationDate="2014-01-18T10:41:17.387" Score="0" Body="&lt;p&gt;To do the computation of overlap-add: You divide the signal into segments starting at indices $kL$ using an overlap of size $D$, that is, between kL and kL+D there is a cross-fade adding to 1 of the segment $(k-1)$ and segment $k$. Applying a filter of finite length is equivalent to polynomial multiplication. The windowed $k$th segment of length $L+D$ and the filter of length $F$ result in a filtered segment of length $L+D+F-1$. This is the size that has to fit in the dyadic FFT-length $N$. After zeropadding, FFT, multiplication with the FFT of the filter and iFFT the filtered segment is added in its full length $N$ to the output signal starting at positon $kL$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The combination of filtering and downsampling can be factored into steps in the so-called lifting scheme. For short filters like those of the discrete wavelet transform, this is faster than overlap-add. Using the idea of the Remez-algorithm, relatively short wavelet transforms with good frequency separation can be constructed.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-18T10:41:17.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13876" PostTypeId="2" ParentId="13855" CreationDate="2014-01-18T11:15:32.130" Score="1" Body="&lt;p&gt;To the contrary, the odd tap filters allow you to keep everything perfectly symmetric. If you make the filter centered at $0$, then the application of the filter at position $i$ requires a symmetric range of coefficients around $i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All 2-channel wavelets will produce a quad-tree decomposition of a 2D image, regardless of tap length. The only complication of longer, non-trivial wavelet filter banks is the treatment of the boundaries. Here one has an advantage in using symmetric filters. (Symmetric and orthogonal wavelet filters exist for 3-channel, 4-channel wavelets and so on. See articles by Heller, Belogay/Wang, Turcajeva.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you continue the image by mirroring at the boundaries, the transformed image will also have odd or even symmetry at the boundaries so that the size of the transformed image can be kept equal to the size of the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the reconstruction process, you have to reconstruct those mirrored coefficients in the bands and then apply the centered filters to obtain the original image back.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-18T11:15:32.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13878" PostTypeId="2" ParentId="13696" CreationDate="2014-01-18T13:50:38.210" Score="1" Body="&lt;p&gt;The MP3 processing does not aim to minimize RMS error, it aims to hide noise under the masking curve. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point-by-point difference between an original file and one that has been through mp3 encode/decode is very large. Also, the high- frequency phase is not preserved. So you'll need to consider adding some tones that can be analyzed in the frequency domain. &lt;/p&gt;&#xA;" OwnerUserId="7453" LastEditorUserId="76" LastEditDate="2014-04-18T19:22:43.350" LastActivityDate="2014-04-18T19:22:43.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13881" PostTypeId="1" AcceptedAnswerId="13882" CreationDate="2014-01-18T18:28:12.023" Score="0" ViewCount="62" Body="&lt;p&gt;I have a doubt, it may be silly. Please explain me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In K-L Transform, For forward transform we have the below equation &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uzzeY.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For inverse transform we have the below equation &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jUiIt.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reverse transform why the 'A' transpose is not common to both y and m(mean of x) as in Forward transform equation?&lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-01-18T18:44:27.550" Title="Doubt in K-L Transform equations" Tags="|image-processing|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13882" PostTypeId="2" ParentId="13881" CreationDate="2014-01-18T18:44:27.550" Score="1" Body="&lt;p&gt;$y=A(x-m_x)$--&gt;$A^Ty=A^TA(x-m_x)=x-m_x$--&gt;$x=A^Ty+m_x$&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-18T18:44:27.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13883" PostTypeId="1" CreationDate="2014-01-18T19:23:31.997" Score="1" ViewCount="6303" Body="&lt;p&gt;I am running an acoustic simulation.  I put in a frequency and get out a complex number; the frequency response for that frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to generate a 1024-sample impulse response (supposing my output sample-rate is 44.1kHz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I go about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I have the first step: take the Nyquist frequency 22.05kHz, and cut it into 512 equal slices.  So each slice will have a bandwidth of 22050/512 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I feed these frequencies into the simulator and get back 512 complex numbers; the first will be 0+0i corresponding to 0Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm following an instruction that says: 'consider 0Hz now to be the symmetry point, and add 511 negative frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have &#xA;    {&#xA;        Re(511) + i.Im(511), &#xA;        ..., &#xA;        Re(1) + i.Im(1), &#xA;        0 + 0i,&#xA;        Re(1) + i.Im(1), &#xA;        ..., &#xA;        Re(511) + i.Im(511), &#xA;    }&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1023 frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm confused. I don't know what I'm doing any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently I need to IFFT this, and that is going to give me an 1023 sample impulse response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could somebody help me get my feet back on the ground?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would the MatLab code for this look like?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Also, is there any way to do it from the Bash shell using Python or something similar?)&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2014-01-29T00:30:30.393" LastActivityDate="2014-01-29T00:30:30.393" Title="Convert frequency response to impulse response" Tags="|fourier-transform|frequency-response|impulse-response|" AnswerCount="2" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13885" PostTypeId="1" CreationDate="2014-01-19T02:25:02.613" Score="0" ViewCount="263" Body="&lt;p&gt;I am a quite new to the area of digital signal processing. I am currently doing a project on sine wave generation. I know that according to Gibbs phenomenon, many sine waves add up to form a square wave. So, square wave would contain many frequencies. If we filter that square wave stage by stage using low pass and band pass filters, will I be able to get a sine wave at expected fundamental frequency? Please help.&lt;/p&gt;&#xA;" OwnerUserId="7610" LastActivityDate="2014-01-19T17:03:33.833" Title="Inverse of the Gibbs Phenomenon to generate a sine wave" Tags="|matlab|filters|digital|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13886" PostTypeId="2" ParentId="13851" CreationDate="2014-01-19T02:39:06.773" Score="0" Body="&lt;p&gt;Most of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Divide_and_conquer_algorithm&quot; rel=&quot;nofollow&quot;&gt;&quot;divide and conquer&quot; algorithm&lt;/a&gt; in computational paradigm uses O(NlogN) as the lower bound. It provides some sort of balance between space and time complexity. Sort is one of the application for divide and conquer approach. FFT has also been computed using the same &quot;Divide and Conquer&quot; approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;O(N) algorithms require more space (memory) for computation although it is fast. The only way to make improvement is to improve the speed of the multiplication using different algorithms like karatsuba multiplication, Vedic multiplication, etc.&lt;/p&gt;&#xA;" OwnerUserId="7610" LastActivityDate="2014-01-19T02:39:06.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13887" PostTypeId="2" ParentId="13885" CreationDate="2014-01-19T04:21:22.577" Score="3" Body="&lt;p&gt;Square waves are composed of sine waves at the odd harmonics- i.e. 1st, 3rd, 5th, etc.  So yes, you can produce a sine wave from a square wave if you filter it with a low-pass filter whose bandwidth is at least as big as the first harmonic frequency, and whose cutoff frequency is lower than the third harmonic.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-01-19T04:21:22.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13888" PostTypeId="1" AcceptedAnswerId="13891" CreationDate="2014-01-19T07:33:18.550" Score="0" ViewCount="1260" Body="&lt;p&gt;I'm learning about the Wiener filter, and I'm working on my own implementation. I'm starting out with the non-causal filter, and I need to calculate some covariance matrices. If the signal is assumed to be a linear combination of a target signal and noise, then the signal can be modeled as: $$x[n] = y[n] + w[n]$$ where x is the observed signal, y is the target and w is noise. If I understand correctly, the weiner filter is a linear-minimum-mean-square-error estimation process. What I'm getting hung up on is that we need to compute a matrix of expected values based on the input signal x, namely $$E[xx^{T}]$$ and I know that to do this we need to apply the expectation operator to each element in the matrix $$xx^{T}$$ but I don't know how to do that computation, or what it even means.&lt;/p&gt;&#xA;" OwnerUserId="6944" LastActivityDate="2014-01-19T14:07:53.390" Title="wiener filter (non-causal) calculating covariance matrices" Tags="|filters|filter-design|statistics|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13890" PostTypeId="1" CreationDate="2014-01-19T12:03:22.923" Score="0" ViewCount="738" Body="&lt;p&gt;I am I am working with 'wav' files in audio signal processing. I am able to find out STFT by using the function &quot; spectrogram(file name, window length). Now I want to apply Inverse Short time fourier transform on the above signal. I tried &quot;invspectrogram&quot;. but its showing error as Undefined function for input argument type of double. So please tell me how to proceed.&lt;/p&gt;&#xA;" OwnerUserId="7612" LastEditorUserId="7092" LastEditDate="2014-01-19T17:06:49.590" LastActivityDate="2014-01-19T17:15:16.877" Title="Inverse Short time fourier transform" Tags="|fft|audio|discrete-signals|stft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13891" PostTypeId="2" ParentId="13888" CreationDate="2014-01-19T14:07:53.390" Score="1" Body="&lt;p&gt;The expectation operator can not be applied in real.In Weiner filter you will require to find the value of &lt;strong&gt;R&lt;/strong&gt; i.e. correlation matrix of input signal which is ideally &lt;strong&gt;E[X(n)X'(n)]&lt;/strong&gt; and also &lt;strong&gt;P&lt;/strong&gt; i.e  cross correlation matrix of input signal and desired signal &lt;strong&gt;E[X(n)d(n)]&lt;/strong&gt;. Actual meaning of this expectation is that the correlation is obtained by using a large number of realisation of the input signal called ensemble .But in reality we have only one realisation and that is the input signal which you are going to apply to the weiner filter to calculate output. hence its exact value cant be find out. and therefore to use weiner filter in reality we require to apply various approximations to calculations of covariance matrix which finally result in various adaptive algorithms .As an example ,LMS algorithm which uses the following approximations for above matrices,&#xA;               &lt;strong&gt;R=X(n)*X'(n)   and P= X(n)d(n)&lt;/strong&gt;&#xA;Now these values can be calculated using the only available realisation of signal.Although these Algorithms do not provide full convergence to weiner solution but approximates weights close to weiner solution. This error in solution is the result of approximation used. Weiner solution is actually the ideal solution of a adaptive filter hence it can not be attained because the Expectation operation can be applied in theory but practical implementation is impossible.&#xA;LMS,NLMS,BLMS,RLS these are some other algorithms that can also be used .each have its own good side and a bad side and have to be applied according to necessity. &lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2014-01-19T14:07:53.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13892" PostTypeId="1" AcceptedAnswerId="13903" CreationDate="2014-01-19T14:12:36.117" Score="0" ViewCount="106" Body="&lt;p&gt;I know we can use a &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-step&#xA;-impulse&#xA;-sinus&#xA;-multisine&#xA;-random phase multisine&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To identify a system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what are the advantages/disadvantags of each type of input?&lt;/p&gt;&#xA;" OwnerUserId="7273" LastActivityDate="2014-01-20T02:47:28.707" Title="choosing an input signal for system identificaiton" Tags="|system-identification|" AnswerCount="1" CommentCount="2" ClosedDate="2014-01-22T19:35:03.700" ContentLicense="CC BY-SA 3.0" />
  <row Id="13893" PostTypeId="2" ParentId="1317" CreationDate="2014-01-19T14:27:27.950" Score="1" Body="&lt;p&gt;It all depends with what platform you want to process it, if you need a simple circuit, i suggest blasting out the signal with gain and turn it into a square wave and measure the period with a microcontroller using the timer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you want to go fancy with signal processing, check out MUSIC method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Multiple_signal_classification&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Multiple_signal_classification&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-19T14:27:27.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13894" PostTypeId="2" ParentId="424" CreationDate="2014-01-19T14:44:03.967" Score="1" Body="&lt;p&gt;so you basically are looking for an Automatic Gain Control (AGC). Not sure if you must do it by processing digitally, but there are very very good integrated circuits out there that can perform that task very well, usually the AGC is integrated with a lot of other features, but some circutis can be created with JFET transistors and some diodes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But a very easily understandable way of doing this with digital processing would be to design an adaptive variance estimator, like taking a time window of enough samples to represent 5 or 10 msec, and apply a forgetting factor alpha^n (alpha &amp;lt;1) so each new sample that comes gets taken into account  more than the past samples.&#xA;then based on this variance estimation you design aaccording to your desire, a function that maps the variance to a gain that you apply to each audio sample.&#xA;this could be a hard-decision boundary,whereas if the variance goes above some threshold you decrease the gain by some factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or could be a more soft-decision boundary, where you create a non linear transformation from variance to gain, and apply the transformation to every sample based on the last variance estimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This are more heuristic methods but at least it saves you from all the heavy math.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-19T14:44:03.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13895" PostTypeId="1" CreationDate="2014-01-19T16:40:18.073" Score="7" ViewCount="5717" Body="&lt;p&gt;I want to know what is the difference between additive noise, multiplicative noise.. In what domain these noises are handled to remove?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested particularly in image dataset &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does different domains are used in case of satellite imaging where noise due to reflection of frequencies is statistically independent?&lt;/p&gt;&#xA;" OwnerUserId="7615" LastActivityDate="2022-12-10T03:33:16.877" Title="Which domain used for denoising additive and multiplicative noises" Tags="|image-processing|filters|noise|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13896" PostTypeId="2" ParentId="13885" CreationDate="2014-01-19T17:03:33.833" Score="0" Body="&lt;p&gt;Please provide more information on exactly what you need to do, and what tools you have available. Also the title is very misleading and even logically incorrect.&#xA;The gibbs phenomenon is the fact that to represent a square wave with a finit number of harmonics, the edges of the sharp transition present an overshoot which has a lower bound on amplitud but which area decreses as the number of harmonics increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, do you need to build a digital system that can generate a Sine wave? Do you need to generate other waveforms? Does the sinewave you want to generate have a fixed frequency, or is it expected to be able to change?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the Easies way to generate a sinewave is to build an oscillator circuit. They can even be done with discrete components, but there are several very good integrated circuits that can be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it needs to be done digitally, a Look up table is a very good way to do it. But there are other methods, any book on real-time embedded systems would have a chapter or a section about signal generation.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-19T17:03:33.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13897" PostTypeId="2" ParentId="13890" CreationDate="2014-01-19T17:15:16.877" Score="1" Body="&lt;p&gt;A magnitude-only spectrogram is not invertible. The spectral phase required for reconstruction has been lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A complex FFT (a 1D column of spectrogram data before the absolute magnitude is taken and colored) might be (within numerical limitations) invertible by using an IFFT, but that won't recover the original signal if the STFT is using windowed FFTs.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-19T17:15:16.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13899" PostTypeId="1" CreationDate="2014-01-19T17:35:20.157" Score="3" ViewCount="781" Body="&lt;p&gt;This question comes from a realistic problem that how to obtain a time domain wind pressure from known wind spectrum. Or similarly, gets rail surface curve from spatial rail spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, this question does not have unique solution, since phase information is not given. Usually we assume that phase of the time/spatial domain data in uniformly distributed in ($-\pi$, $\pi$], and using a random distributed phase to do inverse Fourier transform to obtain the time/spatial domain data. However, I feel not so comfortable to assign such rapid changing phase to the spectrum. I wonder whether there are some more reasonable assumptions to get these jobs done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, question &lt;a href=&quot;https://dsp.stackexchange.com/questions/13764/ifft-of-signal-without-phase-information&quot;&gt;ifft of signal without phase information&lt;/a&gt; discussed some strategies on how to do this job. @LutzL suggested Human perception can be used to help determine the phase information. But I cannot understand how Human perception is working. @Hilmar said minimum phase may be a choice, but I do not know whether there is a physical meaning of minimum phase. Is there any discussion to show minimum phase is a good choice for physical phenomena, like wind. &lt;/p&gt;&#xA;" OwnerUserId="7602" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-07-04T20:31:17.460" Title="What assumptions should be used to invert spectrum into time domain data?" Tags="|frequency-spectrum|power-spectral-density|ifft|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13901" PostTypeId="2" ParentId="3581" CreationDate="2014-01-19T19:35:09.583" Score="-1" Body="&lt;p&gt;My suggestion:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Convert track audio format from 16bit fixed point to 32bit floating point.&lt;/li&gt;&#xA;&lt;li&gt;Add the current sample value of all tracks to be mixed.&lt;/li&gt;&#xA;&lt;li&gt;Don't do anything else.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The user may wish to process this mixed stream with compression and/or limiting prior to dithering and reconversion to 16bit fixed point format (assuming this conversion... mixdown to hand off to mastering engineers is usually left at a higher resolution format)&lt;/p&gt;&#xA;" OwnerUserId="7618" LastEditorUserId="1273" LastEditDate="2014-01-21T10:23:28.757" LastActivityDate="2014-01-21T10:23:28.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13902" PostTypeId="2" ParentId="13895" CreationDate="2014-01-19T19:47:46.740" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I want to know what is the difference between additive noise,&#xA;  multiplicative noise.. In what domain these noises are handled to&#xA;  remove?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Additive noise and multiplicative noise are just &lt;em&gt;models&lt;/em&gt; of how noise corrupts our data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One very common model is the additive noise model, where we have our 'true' data vector $s[n]$, (which we are trying to ascertain), being corrupted by a noise vector, $v[n]$. What we are given, is $x[n]$, where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = s[n] + v[n]&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is called the 'additive' noise model, because as you can see, noise is &lt;em&gt;added&lt;/em&gt; to our true signal, giving us $x[n]$. There are many ways in which we can remove this noise in an additive model, such as filtering, (which is a form of averaging if you like). This is a very common type of noise model. If I am talking, and you are talking over me, your voice can be modeled as additive to my voice. You voice would be additive 'noise', that is added to my voice, which in this vain example is the 'true' signal, (although this would be disputed in a heated argument between two people). In a more objective example, thermal noise from a microphone's electronics can also be modeled as an additive noise, which is added to a voice signal that it has received. Many things can be modeled as additive types of noises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplicative noise on the other hand is still a model, but in this model our true data samples are being &lt;em&gt;multiplied&lt;/em&gt; by noise samples, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = s[n]v[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One common way to remove multiplicative noise is to actually transform it into an additive model, and then apply everything we know from the additive noise reduction field. We can do this easily via taking the logarithm of the signal, filtering, then inverse log transform. Thus we can do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = s[n]v[n] \implies \log(x[n]) = \log(s[n]v[n]) = \log(s[n]) + \log(v[n])&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point we have an additive model once more. Now, we can filter as we normally might, to remove or reduce $\log(v[n])$, and then simply take $\log^{-1}$ of the result, yielding an estimate of $s[n]$, our true signal. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I am interested particularly in image dataset&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;One example of multiplicative noise is in illumination differences between images, which is solved in the above way. The non-uniform illumination across an image can be modeled as a pixel-by-pixel multiplication of the image by an illumination mask. This is also known as homomorphic filtering by the way. Anytime you can model a corrupting phenomenon as &lt;em&gt;multiplying&lt;/em&gt; your clean data signal, you can use this multiplicative model.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="1629" LastEditDate="2016-08-19T10:46:14.617" LastActivityDate="2016-08-19T10:46:14.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13903" PostTypeId="2" ParentId="13892" CreationDate="2014-01-20T02:47:28.707" Score="2" Body="&lt;p&gt;conceptually, any driving signal with bandwidth that covers the maximum expected bandwidth of the system being identified is sufficient.  you drive input and synchronously measure input and output, use the FFT to compute the spectra of both input and output, divide the output spectrum by the input spectrum, inverse FFT the resulting spectrum and you have the impulse response.  at least if nothing bad happened, like the system went non-linear because the driving signal exceeded some bounds of saturation.  or if the amplitude of the driving signal was so low that the result of the division has measurement and numerical errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the whole idea of a good driving function is one that does not exceed limits of linearity in the device, yet delivers a lot of energy to reduce measurement and numerical error.  a measure of efficacy for a driving signal is &lt;b&gt;crest factor&lt;/b&gt;, which is the ratio of the maximum signal amplitude to the r.m.s. amplitude.  the lower the crest factor, the better.  it means more energy driving the device under test while remaining within maximum limits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the impulse driving function is natural in that what is measured at the output is the impulse response.  making the nascent impulse thin enough to have wide bandwidth might mean that the input energy is small.  you would need to measure the impulse response several times by driving the system with a train of impulses, spaced apart sufficiently (longer than any expected impulse response) and synchronously average the results.  but the impulse train will be zero most of the time, and if you limit the impulse height to prevent saturation, then the driving signal has low power and your wait is longer in collecting data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a single sine wave is not sufficiently broadbanded.  it will tell you only how that system behaves at the frequency of the sine.  a collection of added sinusoids at various frequencies will give you a better broadbanded result, but might add up to a spiky driving signal if all of the phases are the same.  scrambling the phases can help, but finding the best &quot;random&quot; phases can be ad hoc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a &lt;strong&gt;swept&lt;/strong&gt;-frequency sinusoid is a popular driving signal and there is some theory behind it, if the swept frequency varies linearly with time.  if log-frequency is swept linearly with time, the preceding theory no longer applies.  the crest factor is $\sqrt{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another possible driving signal is a bipolar maximum-length sequence, which is $(-1)^{a[n]}$ where $a[n]$ is a binary {0,1} maximum-length PN sequence.  with that signal the crest factor is as low as it can get (which is 1), but there can be unpredictable behavior if there are sufficient non-linearity in the system being tested.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-01-20T02:47:28.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13905" PostTypeId="2" ParentId="13167" CreationDate="2014-01-20T08:01:28.937" Score="1" Body="&lt;p&gt;Kalman filter have basic requirements that the random processes like input signal, measurement signal,process noise and measurement noises all should be white Gaussian in nature.what Kalman filter actually do is that it uses the system model and input signal and generates its own output which is actually a predicted value now using the observation from the system it calculate the correction to be applied to the predicted output and hence final results are better than observations obtained from the system. Hence very first step- is that you need a system model. &lt;strong&gt;i am totally disagree with @Deniz notion that in non-linear case you should use particle filter. particle filter is used when the random process as mentioned above are not white Gaussian. Even if your system is non linear you can use Extended kalman filter or unscented kalman filter&lt;/strong&gt;. As ur case is concerned i think you should apply extended or unscented kalman filter as velocities for navigation will keep on changing. &lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2014-01-20T08:01:28.937" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13906" PostTypeId="1" CreationDate="2014-01-20T09:47:09.087" Score="2" ViewCount="192" Body="&lt;p&gt;I just read the article linked to below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.eetimes.com/document.asp?doc_id=1275520&quot; rel=&quot;nofollow&quot;&gt;http://www.eetimes.com/document.asp?doc_id=1275520&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I'm planning on doing a Masters in Signal Processing. I'd like to know what the career prospects are for someone graduating in this specialization. Note that I live in the high-tech capital of India, so I should be in about the best place in this part of the world for any tech related positions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really like the idea of applying mathematics to solve practical problems, so that's why I picked DSP. Am I too late to the party, as this article seems to imply?&lt;/p&gt;&#xA;" OwnerUserId="3374" LastActivityDate="2014-01-20T14:28:41.410" Title="So is there such a thing as a DSP engineer nowadays?" Tags="|soft-question|" AnswerCount="2" CommentCount="1" ClosedDate="2014-01-20T14:28:54.553" ContentLicense="CC BY-SA 3.0" />
  <row Id="13907" PostTypeId="1" AcceptedAnswerId="13931" CreationDate="2014-01-20T09:57:44.520" Score="5" ViewCount="4326" Body="&lt;p&gt;I am reading a paper using log-gabor filters for feature detection. I was thinking about the difference between Gabor filters and log-gabor filters. Can anyone tell me the difference(s), and a way to implement them? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2016-04-08T11:26:16.337" Title="difference between Gabor and log-Gabor function" Tags="|local-features|gabor|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13908" PostTypeId="2" ParentId="13906" CreationDate="2014-01-20T12:53:40.120" Score="2" Body="&lt;p&gt;Seems to me that the DSP position goes the same way as most jobs in large corporations. Join a big enough company and you will specialize yourself because for the other things there is a guy who specialized in there and is much better at it than you. So you either do the higher-level (architecture, system design) or the lower-level (implementation, verifiction) tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to be more of a generalist, join a small start-up. It can easily happen that you do everything there: from high-level definition of a solution to a problem (probably on whiteboard), first implementation in high-level languages such as matlab all the way down to the FPGA implementation. However, as the startup grows, you probably will have to specialize, again. But by then you should know what parts you really like.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-01-20T12:53:40.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13909" PostTypeId="1" AcceptedAnswerId="13949" CreationDate="2014-01-20T12:53:56.650" Score="2" ViewCount="609" Body="&lt;p&gt;Could someone tell me where it is that I might be going wrong with the following problem?&lt;/p&gt;&#xA;&lt;p&gt;Ok, so I'm computing a spectrogram, and, trying to return the PDS of the signal (to show where the signal has the most energies) which I will then use in plotting the decibels.&lt;/p&gt;&#xA;&lt;p&gt;In my approach, I multiply each of the frames by the Hanning window, perform FFT of the resulting blocks and then only take the first half of the result (resulting vector).&lt;/p&gt;&#xA;&lt;p&gt;Finally, I take each of the blocks (computed by the STFT) and perform PSD.&lt;/p&gt;&#xA;&lt;p&gt;The problem that I'm having is this:&lt;/p&gt;&#xA;&lt;p&gt;The chart below illustrates the results that I'm getting using my own &lt;code&gt;C++&lt;/code&gt; code:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wOyBA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Whereas in &lt;code&gt;Python&lt;/code&gt;, using &lt;code&gt;matplotlib&lt;/code&gt; if I replicate this, then I get the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eLjlH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can't understand where the &amp;quot;noise&amp;quot; is coming from. I can only think that it could be some periodic noise which could be due to little discontinuities at the start and at the end of each frame. But I don't know where I have gone wrong.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;NFFT = 256&lt;/code&gt; hop size = &lt;code&gt;128&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-04-22T04:38:35.220" Title="PSD - Spectrum analysis" Tags="|fft|stft|power-spectral-density|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13910" PostTypeId="2" ParentId="13906" CreationDate="2014-01-20T14:28:41.410" Score="3" Body="&lt;p&gt;Yes there is. There definetely is there such a thing called DSP  Engineer, but it is not exactly what the article described, i think it even goes more high level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nowadays, most companies relies on already established Knowledge such as standards, or papers from IEEE or AES, or such places. So a DSP engineer requires now more than ever, a lot of knowledge about Programming, in a low level fashion, programming in Assemly, C/C++ to producte robust, reliable, mantainable, understandable and expandable code. It is true what the artcile says that the are cookbooks, so if you don't remember exactly how LMS algorithm goes, you can pick up the book and refresh it in 5 minutes. But the concept needs to be there. If you are completely new to DSP, but you know a lot about programming and Kernel and operating systems, you will have a hard time implementing algorithms if you don't know the basics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no real answer to your question but i state again my first comment. Yes there is, but it has incorporated a lot more about embedded Systems that what it had bewteen 1960 and 1980.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-20T14:28:41.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13911" PostTypeId="1" AcceptedAnswerId="13920" CreationDate="2014-01-20T15:20:33.727" Score="0" ViewCount="271" Body="&lt;p&gt;Hi I was researching on STFT when I encountered this slide online &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zw66K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand the points, Can anyone explain them? Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2014-01-20T22:39:29.250" Title="phenomenon when window size for STFT is too short" Tags="|window-functions|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13912" PostTypeId="1" AcceptedAnswerId="13916" CreationDate="2014-01-20T16:20:23.250" Score="1" ViewCount="897" Body="&lt;p&gt;I'm trying to compute the real cepstral coefficients of recorded telephone audio in Matlab using the rceps function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On some audio frames (480 samples per frame -- 60ms of audio at 8kHz), I get a Matlab error:  &quot;rceps:ZeroInFFT&quot;. The cepstrum does not exist because some of the DFT coefficients are 0. The frames in question are not zero, nor are any of the sample values complex. Going by the RMS of the frame, many of the frames that have errors have significant energy. About 10% of my frames give this error, so it seems like a bigger problem than a fluke.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused because this type of analysis is very common, especially for speech analysis, but I can't find record of anyone else having this problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;audio % is a 236000x1 vector of doubles containing PCM audio data at 8kHz&#xA;window_size = 3 %Working with multiples of 20-ms frames&#xA;errs = zeros(N_frames,1);&#xA;for i=0:N_frames-window_size&#xA;    %% Cepstral analysis&#xA;    s = audio((i*160+1):((i+window_size)*160)); %Grab 60ms of audio -- 480x1 matrix&#xA;    try&#xA;        c = rceps(s);&#xA;    catch err&#xA;        errs(i+1) = 1;&#xA;    end &#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7624" LastActivityDate="2014-01-20T17:27:47.290" Title="Can't compute real cepstrum of real signal" Tags="|matlab|speech-processing|cepstral-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13913" PostTypeId="1" CreationDate="2014-01-20T16:26:30.933" Score="0" ViewCount="1861" Body="&lt;p&gt;I have done with &lt;a href=&quot;https://dsp.stackexchange.com/questions/13100/locating-the-outer-boundary-of-the-iris&quot;&gt;iris localization&lt;/a&gt;. Now I need to perform iris normalization, but I don't have any idea about it. How to implement iris normalization please?&lt;/p&gt;&#xA;" OwnerUserId="7212" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-06-27T10:03:55.097" Title="How to perform iris normalization?" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13914" PostTypeId="1" CreationDate="2014-01-20T16:53:49.387" Score="1" ViewCount="494" Body="&lt;p&gt;Ok, so I have some recorded data over several hours that looks like this (values on y, time on x).&lt;br&gt;&#xA;See this image &lt;a href=&quot;https://imgur.com/fdakUlk&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imgur.com/fdakUlk&lt;/a&gt;&lt;br&gt;&#xA;I need a way to use matlab to divide the data into sections depending on their mean value. The sections needs to be atleas a couple of hours. Just by looking at the data they can easily be spotted, see this image: &lt;a href=&quot;https://i.stack.imgur.com/OlxVN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/OlxVN.jpg&lt;/a&gt;&lt;br&gt;&#xA;Is there a good method of doing this? What do I need to research?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7625" LastActivityDate="2014-06-20T00:58:52.993" Title="Fun problem: Dividing a dataset into parts depending on mean value" Tags="|matlab|filters|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13915" PostTypeId="2" ParentId="13914" CreationDate="2014-01-20T17:21:31.370" Score="0" Body="&lt;p&gt;I don't know if this would be much help to you, and, I haven't coded in matlab in a while (I could probably try to write some code which will allow this). Would the following not work?:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Split the data into segments of say 256 (256 samples in each data block)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Calculate the mean value of each block&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Have a threshold value (Maybe look up dynamic threshold) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) If the mean value &lt;code&gt;&amp;gt;=&lt;/code&gt; OR &lt;code&gt;&amp;lt;=&lt;/code&gt; to the threshold, determine what to do with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please could you elaborate &quot;their mean value&quot;, I assume you mean the &lt;code&gt;mean&lt;/code&gt; value for each block, and, not the entire signal?&lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-01-20T17:21:31.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13916" PostTypeId="2" ParentId="13912" CreationDate="2014-01-20T17:27:47.290" Score="3" Body="&lt;p&gt;It's common, when computing a cepstrum, to replace any zero's or tiny magnitudes in the 1st FFT result with some (noise) floor value to keep the scale and range of the log function &quot;reasonable looking&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Huge negative spikes (or -inf) from the log() of tiny spectrum magnitudes don't usually provide that much added useful information to the rest of the results in cepstral-type analysis.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-20T17:27:47.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13917" PostTypeId="2" ParentId="13913" CreationDate="2014-01-20T18:09:13.643" Score="1" Body="&lt;p&gt;Please check the following for Iris Normalization:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://ijcsi.org/papers/IJCSI-8-4-1-342-348.pdf&quot; rel=&quot;nofollow&quot;&gt;Nithyanandam. S, Gayathri K.S., Priyadarshini P.L.K. - &lt;em&gt;A New IRIS Normalization Process For The Recognition System With Cryptographic Techniques&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://uwspace.uwaterloo.ca/bitstream/handle/10012/2846/emohamma2006.pdf?sequence=1&quot; rel=&quot;nofollow&quot;&gt;Arvacheh E. - &lt;em&gt;A Study of Segmentation and Normalization for Iris&#xA;  Recognition&#xA;  Systems&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="8202" LastEditDate="2015-06-18T14:33:23.453" LastActivityDate="2015-06-18T14:33:23.453" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13918" PostTypeId="2" ParentId="13914" CreationDate="2014-01-20T18:51:47.447" Score="0" Body="&lt;p&gt;What about:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Cluster the data (say using Otsu's thresholding method). This gives a temporal set of binary values&lt;/li&gt;&#xA;&lt;li&gt;Use morphological operations like Opening, Closing, Erosion, and Dilation to determine end points of relevant lengths.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sorry, I don't do matlab, but in Mathematica that would be pretty straightforward to implement.&lt;/p&gt;&#xA;" OwnerUserId="602" LastActivityDate="2014-01-20T18:51:47.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13919" PostTypeId="1" CreationDate="2014-01-20T19:12:33.057" Score="3" ViewCount="403" Body="&lt;p&gt;I just started learning about image processing. I am using the book &quot;Digital image processing&quot; by Gonzalez and Woods but I don't like this book very much. I would like to read a book which can actually make me interested in image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you suggest some good resources?&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="1273" LastEditDate="2014-01-21T10:30:43.173" LastActivityDate="2014-02-22T16:14:45.093" Title="Resources for learning image processing" Tags="|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13920" PostTypeId="2" ParentId="13911" CreationDate="2014-01-20T20:26:23.933" Score="0" Body="&lt;p&gt;It might mean that if you take a window of not enough length so as to contain at least one period of a sinusoid, and instead you are only getting a lot less inside the window of analysis (Like 10% of the period or something like that), then the fourier transform will show you the spectrum of a signal as if that little piece you got inside the window, extended periodically was the entire signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To know exactly what is going on in your graph, we need to know the scale of the time axis, and which signal was being analyzed, if it was a sinusoid, what was the frequency. but that might be what the book is trying to say.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="5662" LastEditDate="2014-01-20T22:39:29.250" LastActivityDate="2014-01-20T22:39:29.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13921" PostTypeId="1" AcceptedAnswerId="13927" CreationDate="2014-01-20T20:55:19.883" Score="2" ViewCount="892" Body="&lt;p&gt;According to my question about separability of Gabor filters in &lt;a href=&quot;https://stackoverflow.com/questions/21210307/working-on-separable-gabor-filters-in-matlab&quot;&gt;this link&lt;/a&gt;, I want now to convolve my image with this separable filter by using the normalized cross correlation operation. Assume my &lt;code&gt;Gabor filter is G&lt;/code&gt;, &lt;code&gt;my image is I&lt;/code&gt;. My Gabor is separated into Low-Pass gaussian filter f(x) and Band-Pass gaussian filter g(y). Therefore the image is convolved with the Gabor using the following equation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I(x,y)*G(x,y) = (I(x,y)*f(x))*g(y).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I want to achieve this separable convolution using the &lt;strong&gt;&lt;em&gt;normalized cross-correlation operation&lt;/em&gt;&lt;/strong&gt; described below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ySP83.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;^G&lt;/code&gt; is the zero mean, unit normal version of the filter and &lt;code&gt;H(x,y)&lt;/code&gt; represents a filter with all ones and the same size of the Gabor filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I didn't understand what is &lt;code&gt;^G&lt;/code&gt;. What should be its value? what it differs from &lt;code&gt;G&lt;/code&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) How the normalized cross-correlation is computed for the separable Gabor? I don't know if I use correctly the formula: &lt;code&gt;I(x,y)*f(x)*g(y) / I^2(x,y)*H(x,y)&lt;/code&gt; . I don't think that it's true. because I didn't understand what should be the value of &lt;em&gt;zero mean, unit normal version of the Gabor&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6925" LastEditorUserId="128" LastEditDate="2020-11-25T16:15:27.300" LastActivityDate="2020-11-25T16:15:27.300" Title="Normalized Cross Correlation Operation" Tags="|image-processing|cross-correlation|separability|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13922" PostTypeId="1" CreationDate="2014-01-20T21:30:28.053" Score="0" ViewCount="114" Body="&lt;p&gt;I am working on signal processing for speaker verification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have extracted MFCC features for few wav files using GMM algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, i want to &lt;strong&gt;add any 2 MFCC features to another variable&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I achieve this?&lt;/p&gt;&#xA;" OwnerUserId="7628" LastEditorUserId="7092" LastEditDate="2014-01-20T22:08:10.470" LastActivityDate="2014-01-20T22:08:10.470" Title="How to add 2 MFCC extracted features to a variable?" Tags="|matlab|discrete-signals|mfcc|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13923" PostTypeId="2" ParentId="13895" CreationDate="2014-01-20T21:36:54.587" Score="4" Body="&lt;p&gt;The answer given by user4619 is pretty good. I have some extra comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably the most common source of additive noise is thermal noise, but external sources are often modeled as additive noise - usually noise is meant to be purely random, but depending on your definition of noise it may also represent deterministic signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the additive noise case you can increase the signal level and get an improvement in the Signal to Noise Ratio (SNR). In multiplicative noise increase the signal (desired) signal power does get you anything in terms of signal power because the noise power is proportional to the signal power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some examples of multiplicative noise:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In radar imagery speckle noise is often modeled as multiplicative &lt;/li&gt;&#xA;&lt;li&gt;Phase noise in A/D convertors. Phase noise affects the timing of the actual sample acquisition and produces timing jitter&lt;/li&gt;&#xA;&lt;li&gt;In Sonar systems Reverberation is a multiplicative problem. Increasing the sound level of the source results in increased reverberation levels as well&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Additive noise is normally handled by looking at linear transforms into a space in which the signal and the noise are separated. This could be in frequency domain, wavelet domain, or a subspace defined by eigenvectors (These are just some examples). Once you've found this space the noise is removed by a simple filtering operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplicative noise can sometimes be handled in the same manner, but it depends. For example - in the case of speckle noise in radar imagery normal filters (band pass, low pass, high pass) don't work very well - median filters tend to work better (There are lots of other approaches though). Note that the median filter is non-linear - it uses order statistics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for multiplicative noise you may be looking at a non-linear transform (see the log() operation user4619 mentioned) and then some linear/non0linear operations, or you may just try a non-linear operation e.g. the median filter.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-20T21:36:54.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13925" PostTypeId="1" AcceptedAnswerId="13929" CreationDate="2014-01-20T22:26:46.440" Score="2" ViewCount="585" Body="&lt;p&gt;What is the conceptual difference between Kolmogorov-Sinai entropy, Shannon entropy and Boltzmann entropy? Are they interchangeable and mean the same? Where can I find a good lucid explanation about Kolmogorov entropy and why it is needed and its significance. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5119" LastActivityDate="2014-01-30T11:51:10.860" Title="Conceptual definition of entropy" Tags="|information-theory|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13926" PostTypeId="1" CreationDate="2014-01-20T22:30:18.640" Score="0" ViewCount="485" Body="&lt;p&gt;I'm trying to analyze the power spectral density of a signal recorded from a Ham radio antenna. The signal is about 30 seconds long, recorded at a 48 kHz sample rate. The frequency is center frequency of 8 kHz recording, with the receiver centered on 5.275 MHz. The signal I'm currently looking at is supposed to be around 5.260 MHz, however I'm getting inconsistent results with the matlab script below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[FileName,PathName] = uigetfile('*.wav','Select the wav file');&#xA;PathName = strcat(PathName, FileName);  %Adds the filename to the end of the pathnames&#xA;&#xA;[x,Fs] = audioread(PathName);&#xA;[pxx,f] = pwelch(x,500,300,500,Fs);&#xA;plot(f,pxx)&#xA;xlabel('Hz'); ylabel('dB');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I run this code with '5.260MHz.wav', it produces the following plot:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TcOwk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These frequency peaks all occur between 0-4 kHz, which is unexpected. &#xA;Since 5.260e6 mod 48e3 = 28e3, I would expect the signal to be at 48e3 - 28e3 = 20e3, or 20 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created my own signal and then undersampled it as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% signal properties&#xA;f0 = 5.260e6;           % frequency 5.260 MHz&#xA;sf = 8e3;               % bandwidth 8 kHz&#xA;&#xA;% sample properties&#xA;Fs = 24e6;              % sampling frequency 24 MHz&#xA;N = 10e6;               % number of samples&#xA;&#xA;% generate random frequency modulated sinusoidal signal&#xA;fi = smooth(randn(N, 1), 11);&#xA;fi = fi / std(fi) * sf + f0;&#xA;x = cos(2 * pi * cumsum(fi) / Fs);&#xA;Fs = Fs / 500;&#xA;x = x(1 :500: end);&#xA;&#xA;filename = 'test_5.260MHz.wav';&#xA;audiowrite(filename,x,Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I plot this signal with the above script, it looks as expected, with a peak at 20 KHz:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BLolC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I used the following script from the mathworks site to create another signal, which also graphed as expected:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;                    % Sampling frequency&#xA;T = 1/Fs;                     % Sample time&#xA;L = 1000;                     % Length of signal&#xA;t = (0:L-1)*T;                % Time vector&#xA;% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid&#xA;x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); &#xA;y = x + 2*randn(size(t));     % Sinusoids plus noise&#xA;&#xA;filename = 'test_50_120Hz.wav';&#xA;audiowrite(filename,y,Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Uw94X.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I'm getting consistent results with my generated files, I would like to believe that there is simply an error with the information concerning my antenna signal. However, I have several different antenna signals, and they are all graphing in the 0-4 kHz range, regardless of where the signal supposedly exists or the central frequency. This leads me to believe that I may be using the matlab code incorrectly, or that I may be misinterpreting how .wav files and radio signals work exactly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any input is appreciated. As I am still new to stackexchange, any suggestions on how to make the question clearer are also appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7325" LastEditorUserId="7325" LastEditDate="2014-01-23T23:10:29.677" LastActivityDate="2014-03-06T08:51:44.537" Title="Analyzing an undersampled recording from an antenna with matlab?" Tags="|matlab|signal-analysis|power-spectral-density|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13927" PostTypeId="2" ParentId="13921" CreationDate="2014-01-20T22:32:34.707" Score="3" Body="&lt;p&gt;From what the paper described, I think $\hat G$ is achieved by standardized normalization on $u$ and $v$ before you implement the formula (1) on $G$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = -filtSizeL : filtSizeR; &#xA;y = x;&#xA;u = x * cos(theta) + y * sin(theta);&#xA;v = -x * sin(theta) + y * cos(theta);&#xA;u = (u - mean(u))/std(u);&#xA;v = (v - mean(v))/std(v);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The filter is still separable after this normalization step, but I don't think you need to implement that, because it is just equivalent to select a different $\sigma$ value in the filter.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-01-20T22:45:30.647" LastActivityDate="2014-01-20T22:45:30.647" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="13928" PostTypeId="1" AcceptedAnswerId="13933" CreationDate="2014-01-20T23:38:01.230" Score="1" ViewCount="131" Body="&lt;p&gt;I have several seconds of speech signal and I have to detect moments in time of arousal with excitation signal, which is creating by larynx. I'm looking for useful reference since several days. I know that a speech signal is a convolution of excitation signal with a filter response and I've read about cepstral analysis and linear prediction, but I still do not know how to take advantage of these methods for my puspose. I think that I have to separate these two signals in some way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the fundamental frequency by create autocorelation function and reading maxima, which gave me the period of fundamental tone. But actualy I don't know how to use it.&#xA;I need to do it in matlab. Please help me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is good example what I need.&#xA;&lt;a href=&quot;http://www.iba.zut.edu.pl/dydaktyka/pliki/referat_js/image002.jpg&quot; rel=&quot;nofollow&quot;&gt;http://www.iba.zut.edu.pl/dydaktyka/pliki/referat_js/image002.jpg&lt;/a&gt;&#xA;In the top plot these impulses are marked as short lines and this is what I need to do.&lt;/p&gt;&#xA;" OwnerUserId="7629" LastActivityDate="2014-01-21T12:38:34.383" Title="How to detect time of arousal with excitation signal in speech signal?" Tags="|matlab|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13929" PostTypeId="2" ParentId="13925" CreationDate="2014-01-21T00:32:51.133" Score="4" Body="&lt;p&gt;Let me give you a quick answer, focused on ways you can improve and research for a deeper knowledge by yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Kolmogorov and Shannon  Entropies are related to measures of information and strongly related to one another. (See the wikipedia page for Kolmogorov complexity for further info.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Boltzmann entropy, which is an older concept, is a completely differenty and unrelated concept from the theory of Thermodynamics. (Again, wikiepdia...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - The formal definition of kolomogorov entropy uses the Shannon entropy in the formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in the information entropy concept, i suggest you read the &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0471062596&quot;&gt;Book&lt;/a&gt; by Cover &amp;amp;Thomas, which has an entire chapter on Kolmogorov Complexity.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-21T00:32:51.133" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13930" PostTypeId="1" AcceptedAnswerId="13939" CreationDate="2014-01-21T01:16:26.810" Score="0" ViewCount="315" Body="&lt;p&gt;I have a doubt related to calculating the Discrete Time Fourier Transform (DTFT) by hand. Specifically in how calculate the frequency axis of the spectrum. My signal has N values and was sampled at FS Hz, the spectrum would have N entries too (where N/2 values are a mirror of the other half). The maximum representable frequency is FS/2 (by the Nyquist theorem), that means that I have to multiply each entry by FS/N, so for the last entry (N/2) I have this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(FS/N) * (N/2) = FS/2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I sample at a higher FS Hz the spectrum is shifted. Think for instance in this function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = cos(2*pi*f0*t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &quot;f0 = 1/T&quot;, T is the period of the cosine and &quot;t&quot; means each entry of the time axis. Then the spectrum is two pulses in &quot;-f0&quot; and &quot;f0&quot;. But doing this in python:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = range(-N/2,N/2)&#xA;f = [float(FS)/(float(N)) * i for i in f]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And sampling at a higher FS, then the pulses are shifted. But the correct behavior is that the pulses remain in the same location (&quot;-f0&quot; and &quot;f0&quot;), because the cosine function period didn't change. Am I doing something wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PD: I know that increasing the sampling rate would increase the density of the spectrum and the time signal too, so N is going bigger automatically, because I would have more samples per second.&lt;/p&gt;&#xA;" OwnerUserId="7316" LastEditorUserId="7316" LastEditDate="2014-01-21T13:56:36.050" LastActivityDate="2014-01-21T16:54:03.503" Title="Frequency Axis problem in a DTFT" Tags="|fourier-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13931" PostTypeId="2" ParentId="13907" CreationDate="2014-01-21T02:09:16.883" Score="7" Body="&lt;p&gt;The 1D gabor filter has the following form in the frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_{b(\sigma,\omega_0)}(\omega) = \text{exp}\left(-\frac{\sigma^2}{2}(\omega - \omega_0)^2\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 1D log-gabor filter is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_{l(\sigma,\omega_0)}(\omega) = \text{exp}\left(-\frac{\ln^2(\omega/\omega_0)}{2\ln^2(\sigma)}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Log-gabor filters are used because they have 0 DC component for arbitrary large bandwidth, and size distribution of features in an image is often logarithmic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The excellent paper &lt;em&gt;On the Choice of Band-Pass Quadrature Filters&lt;/em&gt; by Djamal Boukerroui, J. Alison Noble and Michael Brady explains further differences for these two filters as well as others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some MATLAB code for the 2D version:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[rows, cols] = size(I);&#xA;&#xA;% FFT mesh&#xA;[ux, uy] = meshgrid(([1:cols]-(fix(cols/2)+1))/(cols-mod(cols,2)), ...&#xA;    ([1:rows]-(fix(rows/2)+1))/(rows-mod(rows,2)));&#xA;ux = ifftshift(ux);   % Quadrant shift to put 0 frequency at the corners&#xA;uy = ifftshift(uy);&#xA;&#xA;% Convert to polar coordinates&#xA;th = atan2(uy,ux);&#xA;r = sqrt(ux.^2 + uy.^2);&#xA;&#xA;% Create spectrum&#xA;filterFFT = 1.0/wavelength;&#xA;filterFFT = exp((-(log(r/filterFFT)).^2) / (2 * log(sigma)^2));&#xA;filterFFT(1,1) = 0;&#xA;&#xA;% Filter image&#xA;I_filtered = real(ifft2(fft2(I) .* filterFFT));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Advantage of 0 DC&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The advantage of having 0 DC component is that the response of the filter doesn't depend on the mean value of the signal. It also means you don't have an infinite impulse response. The Gabor filter has a small non-zero component around DC that is usually removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For feature detection, say you designed a filter kernel to match a step (1D) or edge (2D). If the filter had a DC component then the response would vary with the mean image level. e.g. consider the sobel edge detector, and the same kernel with increased values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = double(imread('the_image.jpg'));&#xA;I = I(:,:,1);&#xA;f1 = [[-1 0 1];...&#xA;      [-2 0 2];...&#xA;      [-1 0 1]];&#xA;f2 = [[0 3 4];...&#xA;      [1 3 5];...&#xA;      [0 3 4]];    &#xA;I1 = conv2(I,f1,'same'); images(I1); colorbar; pause;&#xA;I2 = conv2(I,f2,'same'); images(I2); colorbar; pause;&#xA;I3 = conv2(I+100,f1,'same'); images(I3); colorbar; pause;&#xA;I4 = conv2(I+100,f2,'same'); images(I4); colorbar; pause;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this code &lt;code&gt;f2&lt;/code&gt; = &lt;code&gt;f1 + 3&lt;/code&gt;. Only convolving with &lt;code&gt;f1&lt;/code&gt;, which has 0 DC, gives the same result when the mean value of &lt;code&gt;I&lt;/code&gt; is changed. The image responses 'look' the same, but only the 0 DC one is useful for feature detection.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2014-01-27T06:57:31.090" LastActivityDate="2014-01-27T06:57:31.090" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="13932" PostTypeId="1" CreationDate="2014-01-21T10:06:43.260" Score="0" ViewCount="64" Body="&lt;p&gt;I want to extract the oilspill affected areas in SAR images using thresholding, where the affected area appears as darker than surroundings. Here I am attaching the code, where I am  able to extract the white portions in the image. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;i=imread('oil.jpg');&#xA;figure(1);&#xA;imshow(i)&#xA;title('Orginal image');&#xA;% RGB to Gray conversion;&#xA;J=rgb2gray(i);&#xA;figure(2);&#xA;imshow(J)%Grayscale image&#xA;x=imresize(J,[256 256]);% converting the imagesize to 256x256&#xA;figure(3);&#xA;imshow(x)&#xA;k=imadjust(x);&#xA;imshow(k)&#xA;imhist(k)&#xA;y=double(k)&#xA;[m n]=size(y);&#xA;L=double(255);&#xA;% Extracting the white portion;&#xA;for i=1:m&#xA;    for j=1:n&#xA;        z(i,j)=0;&#xA;        if y(i,j)&amp;gt;=100 &amp;amp;&amp;amp; y(i,j)&amp;lt;=255&#xA;            z(i,j)=L;&#xA;        end&#xA;    end&#xA;end&#xA;figure(4);&#xA;imshow(z)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The image I'm working on is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tyeUJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7631" LastEditorUserId="1273" LastEditDate="2014-01-21T10:19:17.463" LastActivityDate="2014-01-21T14:12:12.400" Title="oilspill extraction" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="2" ClosedDate="2014-03-20T15:25:34.723" ContentLicense="CC BY-SA 3.0" />
  <row Id="13933" PostTypeId="2" ParentId="13928" CreationDate="2014-01-21T12:38:34.383" Score="1" Body="&lt;p&gt;You are looking for the instants of glottal closure, or GCIs.  There are many freely Matlab algorithms to do such.  Check out, for example, the &lt;a href=&quot;http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/doc/voicebox/dypsa.html&quot; rel=&quot;nofollow&quot;&gt;DYPSA algorithm&lt;/a&gt;.  A paper explaining how these algorithms generally work can be found &lt;a href=&quot;http://tcts.fpms.ac.be/~drugman/files/TASLP-GCI.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2014-01-21T12:38:34.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13934" PostTypeId="1" AcceptedAnswerId="13936" CreationDate="2014-01-21T12:58:46.990" Score="1" ViewCount="539" Body="&lt;p&gt;I wanted to consult with some experts whether or not this pre-processing step is excessive for what I'm trying to achieve. I am in a similar scenario as the author of the article, where I have many many colonies that I'm trying to segment and distinguish from the background. So I found this article:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ericbattenberg.com/school/segment_paper06.pdf&quot; rel=&quot;nofollow&quot;&gt;A System for Automatic Cell Segmentation of Bacterial Microscopy Images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preprocessing -&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Power-Law Transformation, &lt;/li&gt;&#xA;&lt;li&gt;Homomorphic Processing, &lt;/li&gt;&#xA;&lt;li&gt;Log of Image, &lt;/li&gt;&#xA;&lt;li&gt;Subtracting Original image by Gaussian Kenrel of Image, &lt;/li&gt;&#xA;&lt;li&gt;Vincent Dome Transform (never heard of this, so I just used a different de-noising algorithm) &lt;/li&gt;&#xA;&lt;li&gt;Morphological Operator, &lt;/li&gt;&#xA;&lt;li&gt;3x3 Median Filter&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then we continue with the main part of the recipe:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;II. Background Segmentation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;III. Cell Segmentation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IV. Convex Hull Segment Splitting&lt;/p&gt;&#xA;&#xA;&lt;p&gt;V. Post Processing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no problem going through with this I've already Implemented step 2-6 (not sure how to apply 1). My only concern that it's time consuming to iterate one test for every time I change a value of a controllable variable.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Update &lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Finally got to ask my professor (an expert of Computer Vision and Machine Learning) and she goes &quot;no this is not excessive at all&quot;&lt;/p&gt;&#xA;" OwnerUserId="4618" LastEditorUserId="4618" LastEditDate="2014-01-23T13:13:47.377" LastActivityDate="2014-01-23T13:13:47.377" Title="Is it an excessive pre-processing step in image processing?" Tags="|image-processing|computer-vision|preprocessing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13935" PostTypeId="2" ParentId="13932" CreationDate="2014-01-21T14:12:12.400" Score="2" Body="&lt;p&gt;You are almost there, just deal with your image in the HSV space.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;i=imread('https://i.stack.imgur.com/tyeUJ.jpg');&#xA;figure(1);&#xA;imshow(i)&#xA;title('Orginal image');&#xA;% RGB to Gray conversion;&#xA;% J=i(:,:,2);&#xA;ii=rgb2hsv(i);&#xA;J=ii(:,:,1);&#xA;% J=rgb2gray(i);&#xA;figure(2);&#xA;imshow(J)%Grayscale image&#xA;x=imresize(J,[256 256]);% converting the imagesize to 256x256&#xA;figure(3);&#xA;imshow(x)&#xA;k=imadjust(x);&#xA;imshow(k)&#xA;imhist(k)&#xA;y=double(k);&#xA;[m n]=size(y);&#xA;L=double(255);&#xA;% Extracting the white portion;&#xA;for i=1:m&#xA;    for j=1:n&#xA;        z(i,j)=0;&#xA;        if y(i,j)&amp;lt;=1 &amp;amp;&amp;amp; y(i,j)&amp;gt;=0.6 || y(i,j)&amp;lt;=0.1&#xA;            z(i,j)=L;&#xA;        end&#xA;    end&#xA;end&#xA;figure(4);&#xA;imshow(z)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5qxyF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you want your boundary much more accurate, thresholding method will always not be the choice.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-21T14:12:12.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13936" PostTypeId="2" ParentId="13934" CreationDate="2014-01-21T15:13:40.030" Score="1" Body="&lt;p&gt;I cannot access the raw images, so I did not test the algorithm. Note the aim of pre-processing is to increase the cell contrast to the background. You can remove one step from 2-6 each time to observe the background segmentation effect. By this means you may determine what steps play critical roles on the accurate cell boundary extraction and what others are not necessary. Mostly morphological operations plus sobel filters should be sufficient.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-01-21T15:13:40.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13938" PostTypeId="2" ParentId="13883" CreationDate="2014-01-21T16:21:47.277" Score="1" Body="&lt;p&gt;I've put up an answer at &lt;a href=&quot;https://stackoverflow.com/questions/21209017/python-convert-frequency-response-to-impulse-response&quot;&gt;https://stackoverflow.com/questions/21209017/python-convert-frequency-response-to-impulse-response&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically if my frequencies are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ f_dc, f_1, ..., f_k, f_nyquist }  &#xA;&#xA;    (f_dc=0, f_nyquist for me = 22050 a.k.a freq limit for 44.1kHz audio)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have to construct:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ DC, f_1, ..., f_k, nyquist, f_k*, ..., f_1* }&#xA;&#xA;    with DC = nyquist = 0 (note: z* is the complex conjugate of z)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I iFFT.&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-01-28T02:31:18.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13939" PostTypeId="2" ParentId="13930" CreationDate="2014-01-21T16:49:51.590" Score="0" Body="&lt;p&gt;Generally I like to compose my sinusoids using this format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = cos(2*pi*f/fs*(0:num_samps-1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Depending on the FFT routine you will use it will provide either the onesided or twosided result. Calculating the domain of the frequency axis is as follows. It should be noted that num_samps and NFFT may not be the same.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Nfft - FFT size&#xA;% Fs - Sampling frequency in Hz&#xA;% oneside - flag indicating FFT results will be onesided or two sided&#xA;&#xA;% Compute the frequency vector&#xA;if oneside == true&#xA;  f = fs * (0:Nfft/2).'./Nfft;&#xA;else&#xA;  f = fs * (-Nfft/2:Nfft/2-1).'./Nfft;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have a look at this &lt;a href=&quot;http://www.rssd.esa.int/SP/LISAPATHFINDER/docs/Data_Analysis/GH_FFT.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; for a nice explanation on spectrum estimation.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-21T16:49:51.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13941" PostTypeId="2" ParentId="13883" CreationDate="2014-01-21T17:08:11.373" Score="3" Body="&lt;p&gt;Here is a MATLAB example. Inefficient code but hopefully easy to read&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Example: first order bandpass from 200 to 2000 Hz sampled at 44.1 kHz&#xA;n = 1024; % FFT length&#xA;fs = 44100; % sample rate&#xA;f0 = [200 2000]; % bandpass range&#xA;[b,a] = butter(1,2*f0/fs); % these are the difference equation coefficients&#xA;b0 = b(1); b1 = b(2); b2 = b(3);&#xA;a0 = a(1); a1 = a(2); a2 = a(3);  % for easier readability&#xA;&#xA;% Step 1: build normalized frequency vector&#xA;om = 2*pi*(0:n/2)'/n;&#xA;&#xA;% step 2: calculate the frequency response at every frequency&#xA;z = exp(j*om); % this is the &quot;z&quot; of the z-transform&#xA;% calculate the Z transform , &#xA;H = (b0+ b1*z.^-1 + b2*z.^-2)./(a0+ a1*z.^-1 + a2*z.^-2);&#xA;&#xA;% Step 3: make it conjugate symmetric&#xA;H = [H; conj(H(end-1:-1:2))];&#xA;&#xA;% Step 4: inverse FFT&#xA;h = real(ifft(H));&#xA;&#xA;% Step 5: verify against direct evaluation of the time domain difference equation&#xA;d0 = zeros(n,1); d0(1) = 1; % unit impulse&#xA;href = filter(b,a,d0);&#xA;err = 10*log10( sum((h-href).^2)./sum(href.^2));&#xA;fprintf('Error = %6.2f dB\n',err);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-01-21T17:08:11.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13942" PostTypeId="1" CreationDate="2014-01-21T18:51:42.590" Score="4" ViewCount="318" Body="&lt;p&gt;How would you use the MATLAB &lt;a href=&quot;http://pastebin.com/uPKaM8D3&quot; rel=&quot;nofollow&quot;&gt;function&lt;/a&gt; below to create a FIR filter with a custom magnitude and phase response? It is from the &lt;a href=&quot;http://code.google.com/p/smitoolbox/&quot; rel=&quot;nofollow&quot;&gt;Statistical Modeling and Inference MATLAB Toolbox&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [a, rw, info] = irls(X, y, wf, s, r2, a0, varargin)&#xA;% Iterative Reweighted Least Square&#xA;%&#xA;%   The iterative reweighted least square algorithm updates vector a&#xA;%   by alternating between the following two steps:&#xA;%&#xA;%       1. solve the weighted least square problem to get a&#xA;%&#xA;%           minimize sum_i w_i || x_i' * a - y_i ||^2 + (r2/2) * ||a||^2&#xA;%&#xA;%       2. update the weights as&#xA;%&#xA;%           w_i = wf(||x_i' * a - y_i|| / s)&#xA;%&#xA;%          Here, wf is a function that calculates a weight based on &#xA;%          the residue norm.&#xA;%&#xA;%   a = irls(X, y, wf, s, r2, a0, ...);&#xA;%   [a, rw] = irls(X, y, wf, s, r2, a0, ...);&#xA;%   [a, rw, info] = irls(X, y, wf, s, r2, a0, ...);&#xA;%&#xA;%       performs iterative reweighted least square in solving the&#xA;%       coefficient vector/matrix a.&#xA;%&#xA;%       Input arguments:&#xA;%       - X:        the design matrix. In particular, x_i is given by&#xA;%                   the i-th row of X, i.e. X(i,:).&#xA;%&#xA;%       - y:        the response vector/matrix. y(i,:) corresponds to &#xA;%                   X(i,:).&#xA;%&#xA;%       - wf:       the weighting function, which should be able to take&#xA;%                   into multiple input residues in form of a matrix, and&#xA;%                   return a matrix of the same size.&#xA;%&#xA;%       - s:        the scale parameter&#xA;%&#xA;%       - a0:       the initial guess of a.&#xA;%&#xA;%       Output arguments:&#xA;%       - a:        the resultant coefficient vector/matrix.&#xA;%&#xA;%       - rw:       the weights used in the final iteration (n x 1)&#xA;%&#xA;%       - info:     a struct that contains the procedural information.&#xA;%&#xA;%       Suppose X is a matrix of size n x d, and y is a matrix of size&#xA;%       n x q, then a (and a0) will be a matrix of size d x q.&#xA;%&#xA;%       One can specify additional options to control the procedure in&#xA;%       name/value pairs.&#xA;%&#xA;%       - MaxIter:      the maximum number of iterations {100}&#xA;%       - TolFun:       the tolerance of objective value change at&#xA;%                       convergence {1e-8}&#xA;%       - TolX:         the tolerance of change of a at convergence {1e-8}&#xA;%       - Display:      the level of information displaying&#xA;%                       {'none'|'proc'|'iter'}&#xA;%       - Monitor:      the monitor that responses to procedural updates&#xA;%&#xA;&#xA;%   History&#xA;%   -------&#xA;%       - Created by Dahua Lin, on Jan 6, 2011&#xA;%&#xA;&#xA;%% verify input and check options&#xA;&#xA;if ~(isfloat(X) &amp;amp;&amp;amp; ndims(X) == 2)&#xA;    error('irls:invalidarg', 'X should be a numeric matrix.');&#xA;end&#xA;[n, d] = size(X);&#xA;&#xA;if ~(isfloat(y) &amp;amp;&amp;amp; ndims(y) == 2 &amp;amp;&amp;amp; size(y, 1) == n)&#xA;    error('irls:invalidarg', 'y should be a numeric matrix with n rows.');&#xA;end&#xA;q = size(y, 2);&#xA;&#xA;if ~isa(wf, 'function_handle')&#xA;    error('irls:invalidarg', 'wf should be a function handle.');&#xA;end&#xA;&#xA;if ~(isfloat(s) &amp;amp;&amp;amp; isscalar(s) &amp;amp;&amp;amp; s &amp;gt; 0)&#xA;    error('irls:invalidarg', 's should be a positive scalar.');&#xA;end&#xA;&#xA;if ~(isfloat(r2) &amp;amp;&amp;amp; isscalar(r2) &amp;amp;&amp;amp; r2 &amp;gt;= 0)&#xA;    error('irls:invalidarg', 'r2 should be a non-negative scalar.');&#xA;end&#xA;&#xA;if ~(isfloat(a0) &amp;amp;&amp;amp; isequal(size(a0), [d q]))&#xA;    error('irls:invalidarg', 'a0 should be a numeric matrix of size d x q.');&#xA;end&#xA;&#xA;if numel(varargin) == 1 &amp;amp;&amp;amp; isstruct(varargin{1})&#xA;    options = varargin{1};&#xA;else&#xA;    options = struct('MaxIter', 100, 'TolFun', 1e-8, 'TolX', 1e-8);&#xA;&#xA;    if nargin == 1 &amp;amp;&amp;amp; strcmpi(f, 'options')&#xA;        a = options;&#xA;        return;&#xA;    end&#xA;    options = smi_optimset(options, varargin{:});&#xA;end&#xA;&#xA;omon_level = 0;&#xA;if isfield(options, 'Monitor')&#xA;    omon = options.Monitor;&#xA;    omon_level = omon.level;&#xA;end&#xA;&#xA;&#xA;%% main&#xA;&#xA;a = a0;&#xA;converged = false;&#xA;it = 0;&#xA;&#xA;if omon_level &amp;gt;= optim_mon.ProcLevel&#xA;    omon.on_proc_start();&#xA;end&#xA;&#xA;% initial weighting&#xA;&#xA;e = X * a - y;&#xA;[rn, rn2] = e_to_rn(e);&#xA;rw = wf(rn);&#xA;v = (rw' * rn2) / 2;&#xA;&#xA;&#xA;while ~converged &amp;amp;&amp;amp; it &amp;lt; options.MaxIter&#xA;&#xA;    it = it + 1;&#xA;    if omon_level &amp;gt;= optim_mon.IterLevel&#xA;        omon.on_iter_start(it);&#xA;    end&#xA;&#xA;    a_p = a;&#xA;    v_p = v;&#xA;&#xA;    % re-solve a&#xA;    a = llsq(X, y, rw, r2);&#xA;&#xA;    % re-evaluate rw and v&#xA;    e = (1/s) * (X * a - y);&#xA;    [rn, rn2] = e_to_rn(e);&#xA;    rw = wf(rn);&#xA;    v = (rw' * rn2) / 2;&#xA;&#xA;    % determine convergence&#xA;    ch = v - v_p;&#xA;    nrm_da = norm(a - a_p);&#xA;    converged = abs(ch) &amp;lt; options.TolFun &amp;amp;&amp;amp; nrm_da &amp;lt; options.TolX;  &#xA;&#xA;&#xA;    if omon_level &amp;gt;= optim_mon.IterLevel        &#xA;        itstat = struct( ...&#xA;            'FunValue', v, ...&#xA;            'FunChange', ch, ...&#xA;            'Move', NaN, ...&#xA;            'MoveNorm', nrm_da, ...&#xA;            'IsConverged', converged);                    &#xA;        omon.on_iter_end(it, itstat);&#xA;    end&#xA;end&#xA;&#xA;&#xA;if  nargout &amp;gt;= 2 || omon_level &amp;gt;= optim_mon.ProcLevel&#xA;    info = struct( ...&#xA;        'FunValue', v, ...&#xA;        'LastChange', ch, ...&#xA;        'LastMove', nrm_da, ...&#xA;        'IsConverged', converged, ...&#xA;        'NumIters', it);&#xA;end&#xA;&#xA;if omon_level &amp;gt;= optim_mon.ProcLevel&#xA;    omon.on_proc_end(info);&#xA;end&#xA;&#xA;&#xA;function [rn, rn2] = e_to_rn(e)&#xA;&#xA;if size(e, 2) == 1&#xA;    rn = abs(e);&#xA;    rn2 = e .^ 2;&#xA;else&#xA;    rn2 = dot(e, e, 2);&#xA;    rn = sqrt(rn2);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2014-01-22T18:25:25.697" LastActivityDate="2014-01-22T18:25:25.697" Title="Design Nonlinear (Arbitrary) Phase FIR Filter using Iterative Reweighted Least Squares (IRLS)?" Tags="|matlab|filter-design|finite-impulse-response|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13943" PostTypeId="1" AcceptedAnswerId="13979" CreationDate="2014-01-21T19:27:01.403" Score="0" ViewCount="4642" Body="&lt;p&gt;I have to find the partial derivative of an image with respect to its x dimension. I am using central difference method i.e &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \partial_x F(x) = \frac{F(x+1,y)-F(x-1,y)}{2} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $F(x,y)$ represents the image and if I want to use spatial filtering for the same then I can use filter mask as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$0.5 \times [0, -1, 0;0, 0, 0;0, 1, 0],$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then simply do filtering of F with this mask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to know:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;whether central difference can be applied for finding partial derivative?&lt;/li&gt;&#xA;&lt;li&gt;whether the filter mask (which I have proposed above) can be used or not for finding partial derivative?&lt;/li&gt;&#xA;&lt;li&gt;if not, please suggest me a filter mask which can perform it better and also mention how is it performing the required operation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="1355" LastEditDate="2014-01-23T09:46:33.633" LastActivityDate="2014-01-23T13:23:17.940" Title="partial derivative of image" Tags="|image-processing|2d|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13944" PostTypeId="2" ParentId="13943" CreationDate="2014-01-21T19:56:52.840" Score="0" Body="&lt;p&gt;Yes, it can. The filter you suggest would give the vertical partial derivative (at least, if I take it to be matlab notation). Its rotation would give the horizontal partial derivative. However, other definitions of partial derivatives are possible, and your filter is of low order.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-21T19:56:52.840" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13945" PostTypeId="1" AcceptedAnswerId="13946" CreationDate="2014-01-21T20:00:18.453" Score="1" ViewCount="468" Body="&lt;p&gt;According to my question in &lt;a href=&quot;https://stackoverflow.com/questions/21210307/working-on-separable-gabor-filters-in-matlab&quot;&gt;this link&lt;/a&gt;, I applied (with a big help from lennon310) the separability of Gabor filters of any orientation.&#xA;The only disadvantage of this method is the convolution in the complex domain. So we can treat  the Gabor ﬁlter &lt;code&gt;G(x,y)&lt;/code&gt; as a two dimensional matrix that has a low rank, since the ﬁlter is fairly smooth at lower frequencies. Singular value decomposition can then be used in order to decompose the ﬁlter into a linear sum of real separable ﬁlters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KyPxY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, &lt;code&gt;ui&lt;/code&gt;, &lt;code&gt;vi&lt;/code&gt; are the columns of the orthogonal matrices &lt;code&gt;U,V&lt;/code&gt;. &lt;code&gt;s_i&lt;/code&gt; is the singular value. The convolution of the ﬁlter &lt;code&gt;G(x, y)&lt;/code&gt; with the image &lt;code&gt;I(x, y)&lt;/code&gt; can now be approximated using:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/KfkkW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please I need a help about how can I edit my code in &lt;a href=&quot;https://stackoverflow.com/questions/21210307/working-on-separable-gabor-filters-in-matlab&quot;&gt;this link&lt;/a&gt; in order to apply that in MATLAB. Any help will be very appreciated.&lt;/p&gt;&#xA;" OwnerUserId="6925" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-01-21T22:28:21.757" Title="Apply Singular Value Decomposition on Gabor filters" Tags="|image-processing|matlab|filtering|gabor|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13946" PostTypeId="2" ParentId="13945" CreationDate="2014-01-21T20:58:47.743" Score="1" Body="&lt;p&gt;I won't recommend you apply SVD in your Gabor filter, since it does not bring much benefit but increase the computing load. If you implement SVD, you may not separate the filter at first, instead the SVD is performed on the &lt;a href=&quot;https://stackoverflow.com/questions/20921698/how-to-create-64-gabor-features-at-each-scale-and-orientation-in-the-spatial-and&quot;&gt;2D Gabor filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                for i = -filtSizeL:filtSizeR&#xA;                    for j = -filtSizeL:filtSizeR&#xA;&#xA;                        if ( sqrt(i^2+j^2)&amp;gt;filtSize/2 )&#xA;                            E = 0;&#xA;                        else&#xA;                            x = i*cos(theta) - j*sin(theta);&#xA;                            y = i*sin(theta) + j*cos(theta);&#xA;                            E = exp(-(x^2+G^2*y^2)/(2*sigmaq))*cos(2*pi*x/lambda(k));&#xA;                        end&#xA;                        f(j+center,i+center) = E;&#xA;                    end&#xA;                end&#xA;&#xA;               %% SVD %%%%&#xA;               [u,s,v]=SVD(f);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;u&lt;/code&gt;, &lt;code&gt;s&lt;/code&gt;, and &lt;code&gt;v&lt;/code&gt;, you implement the convolution with your image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    convv = zeros(size(image_double));&#xA;    for i = 1:filtSizeR+filtSizeL+1&#xA;        convv1=imfilter(image_double*s(i,i),  u(i,:),'conv');&#xA;        convv2=imfilter(double(convv1),v(:,i)','conv');&#xA;        convv = convv + convv2;&#xA;    end&#xA;&#xA;    figure&#xA;    imagesc(imag(convv));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yet I don't think this method is as good as your separable &lt;code&gt;f&lt;/code&gt; and &lt;code&gt;g&lt;/code&gt; method.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-01-21T20:58:47.743" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13947" PostTypeId="2" ParentId="88" CreationDate="2014-01-21T21:49:23.760" Score="1" Body="&lt;p&gt;maybe you already know this, but if you have matlab you can use the matlab coder, and create a simple function that uses the feature you want to examine. Then run it and see the created C code. I tried with with the FFT, and with QR decomposition, and while it is a bit messy, it can be understood just fine.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-21T21:49:23.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13948" PostTypeId="2" ParentId="13945" CreationDate="2014-01-21T22:28:21.757" Score="2" Body="&lt;p&gt;&lt;strong&gt;The final code will be:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i = -filtSizeL:filtSizeR&#xA;            for j = -filtSizeL:filtSizeR&#xA;&#xA;                if ( sqrt(i^2+j^2)&amp;gt;filtSize/2 )&#xA;                    E = 0;&#xA;                else&#xA;                    x = i*cos(theta) - j*sin(theta);&#xA;                    y = i*sin(theta) + j*cos(theta);&#xA;&#xA;                     %fx = exp(-(i^2)/(2*sigmaq))*exp(sqrt(-1)*i*cos(theta));&#xA;                     %gy = exp(-(j^2)/(2*sigmaq))*exp(sqrt(-1)*j*sin(theta));&#xA;                     %E=real(fx*gy);&#xA;&#xA;                   E = exp(-(x^2+G^2*y^2)/(2*sigmaq))*cos(2*pi*x/lambda(k));&#xA;                end&#xA;                f(j+center,i+center) = E;&#xA;            end&#xA;        end&#xA;&#xA;        f = f - mean(mean(f));&#xA;        f = f ./ sqrt(sum(sum(f.^2)));&#xA;&#xA;%%%% SVD %%%%&#xA;        [u,s,v]=svd(f);&#xA;&#xA; convv = zeros(size(image_double));&#xA;   for i = 1:filtSizeR+filtSizeL+1&#xA;       convv1=imfilter(image_double*s(i,i),  u(i,:),'conv');&#xA;        convv2=imfilter(double(convv1),v(:,i)','conv');&#xA;        convv = convv + convv2;&#xA;    end&#xA;&#xA;    figure&#xA;    imagesc(convv);&#xA;    colormap(gray);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6925" LastActivityDate="2014-01-21T22:28:21.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13949" PostTypeId="2" ParentId="13909" CreationDate="2014-01-22T03:30:58.703" Score="1" Body="&lt;p&gt;I'm a little confused by this statement given the previous one indicates you've already taken the FFT.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Finally, I take each of the blocks (computed by the STFT) and perform PSD.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally the following is used; Seperate into frames (overlap if desired) -&gt; apply window -&gt; fft -&gt; transform and scale into dB (if desired).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scaling for a power spectrum or power spectral density can be a bit tricky at first, but this &lt;a href=&quot;http://www.rssd.esa.int/SP/LISAPATHFINDER/docs/Data_Analysis/GH_FFT.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; goes into some great detail about how to set it up.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-22T03:30:58.703" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13951" PostTypeId="1" CreationDate="2014-01-22T09:11:12.037" Score="6" ViewCount="5643" Body="&lt;p&gt;I'm calculating the beat of song through the frequency domain. I have 60 seconds of audio sampled at 48000Hz, multiplied by a Hanning window in the time domain. This gives me a resolution in the frequency domain of 1BPM, and I'm interested in frequencies from ~10 BPM to ~300BPM, which is only the first 300 bins of the 48000*60 bin length FFT. How does the Hanning window affect the phase of the song's beat? Using no window (really a rectangular window) results in a different phase than the Hanning window does.&lt;/p&gt;&#xA;" OwnerUserId="7642" LastActivityDate="2018-08-04T07:00:35.297" Title="Effect of Hanning Window on phase of FFT" Tags="|fft|phase|window-functions|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13954" PostTypeId="1" CreationDate="2014-01-22T11:17:34.637" Score="3" ViewCount="1860" Body="&lt;p&gt;I know for sure that white noise is considered as a stationary sound, but is that true for the rest of them? &lt;a href=&quot;http://en.wikipedia.org/wiki/Colors_of_noise&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Colors_of_noise&lt;/a&gt;&#xA;Also, can we meet some of these sounds in nature? Is there any relation between these noises and noises that you can hear in a town(vehices,traffic,people chatting) or are these noises just an artificial invention?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your ideas and thoughts!:)&lt;/p&gt;&#xA;" OwnerUserId="7645" LastActivityDate="2014-01-23T17:08:48.513" Title="Colored noises: Stationary or non-stationary?" Tags="|noise|sound|color|stationary|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13955" PostTypeId="1" CreationDate="2014-01-22T11:18:15.757" Score="3" ViewCount="1096" Body="&lt;p&gt;So far, I have read that all the non-parametric estimation techniques decrease the frequency resolution in order to decrease the variance in the spectral estimate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the general &quot;overview&quot; meaning of variance and what is the advantage in decreasing the variance of spectral estimate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The PSD can be calculated from the autocorrelation function of a signal by taking its Fourier transform, called the periodogram. In general the variance of the estimate $P_{xx}(f)$ does not decay to zero as $N$ tends to infinity.  Thus, &quot;the periodogram is not a consistent estimate of the true power density spectrum&quot;, i.e., it does not converge to the true power density spectrum. Thus, the estimated spectrum suffers from the smoothing  effects and the leakage embodied in the Barlett window. The smoothing and leakage ultimately limit our ability to resolve closely spaced spectra. The methods Barlett along with Blackman, Tukey, and Welch are classical methods and make no assumption about how the data were generated and are hence called non-parametric methods. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this method for reducing the variance in the periodogram involves three steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First the $N$-point sequence is subdivided into $K$ non-overlapping segments, where each segment has length $M$. &lt;/li&gt;&#xA;&lt;li&gt;For each segment we compute the periodogram.&lt;/li&gt;&#xA;&lt;li&gt;Finally, we average the periodograms for the $K$ segments to obtain the Barlett power spectrum estimate.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7646" LastEditorUserId="76" LastEditDate="2014-01-23T09:28:55.693" LastActivityDate="2014-01-23T09:28:55.693" Title="What are variance and bias in spectral estimation (specifically periodogram spectral estimation)?" Tags="|frequency-spectrum|estimation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13956" PostTypeId="1" AcceptedAnswerId="13973" CreationDate="2014-01-22T12:28:12.370" Score="2" ViewCount="5753" Body="&lt;p&gt;I understand the cyclic prefix, but in (1) it's said that: &quot;If we consider that the channel effect is minimal and can be neglected. then the phase difference of the CP and the OFDM symbol which the victim of CFO can be found by $2\pi\beta N/N= 2\pi\beta$.&quot; and then, the author derives the equation for estimating the CFO $\beta$. My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How is this phase difference between the cyclic prefix (CP) and the corresponding rear part of an OFDM symbol obtained?&lt;/li&gt;&#xA;&lt;li&gt;I'm confused about how the cyclic prefix is used to estimate the carrier frequency offset. Can you explain how the formula for $\beta$ is derieved?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1)&#xA;&lt;a href=&quot;http://worldsciencepublisher.org/journals/index.php/JOE/article/download/578/467&quot; rel=&quot;nofollow&quot;&gt;W.aziz, E.Ahmed, G.Abbas, S.Saleem, Q.Islam, &quot;Performance analysis of carrier frequency offset (CFO) in OFDM usign MATLAB&quot;, Journal of Engineering, Vol. 1,No.1, 2012&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="7644" LastEditorUserId="1606" LastEditDate="2014-01-22T15:33:41.587" LastActivityDate="2014-01-23T15:57:22.023" Title="Carrier frequency offset (CFO) estimation using cyclic prefix" Tags="|fft|estimation|phase|ofdm|digital|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13957" PostTypeId="1" CreationDate="2014-01-22T14:18:05.680" Score="0" ViewCount="188" Body="&lt;p&gt;I have got a video containing 200 frames and i am extracting low level features at pixel level. Then i am dividing the entire frame in to small spatial patches (say of size 7x7) and creating a feature vector for each spatial patch (by summing up the feature values of the pixel inside the particular patch). If i want to use the HoG features in the above mentioned procedure, what is the best possible way to do that? i.e using PCA? or shall i use the values of the bin for that particular 7x7 patch directly (say if i have 4 bins then it will be 4 feature variables)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS : i am using GMM to model the features. So i want the features of each patch can be correlated with one-another using euclidean distance measure.&lt;/p&gt;&#xA;" OwnerUserId="7422" LastEditorUserId="7422" LastEditDate="2014-01-23T04:06:13.150" LastActivityDate="2014-01-23T13:12:19.113" Title="Encoding the HOG features" Tags="|image-processing|histogram|gradient|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13959" PostTypeId="2" ParentId="88" CreationDate="2014-01-22T15:03:55.720" Score="1" Body="&lt;p&gt;Here is a paper which does an actual Matlab version of the &quot;core&quot; remez algorithm.&#xA;“A MATLAB based optimum multiband FIR filters design program following the original idea of the Remez multiple exchange algorithm” -2011 IEEE International Symposium on Circuits and Systems (ISCAS) - Authors (Ahsan, Saramaki)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper does a good job at explaining the basic algorithm. The goal of the paper was to avoid using the original Fortran code - which does not explain the algorithm very well and often just gets translated into various other languages directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I will comment on. One of the core ideas of the algorithm is to fit a curve and then find the extremal points. Usually a Lagrange Interpolation is used to explain this idea, but Lagrange Interpolation has poor numerical properties. In the original algorithm the use Barycentric Implementation of Lagrange Interpolation - which avoids many of the associated pitfalls of Lagrangian interpolation. So if you are trying to fully understand the code, you may want to look up Barycentric Interpolation.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-22T15:03:55.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13960" PostTypeId="2" ParentId="4821" CreationDate="2014-01-22T15:38:19.853" Score="1" Body="&lt;p&gt;The software Amira from Visage Imaging has some excellent built-in registration features. I never tried that exact problem, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is unfortunately pretty pricy, but you can download a free trial version of it from the website to give it a try. &lt;a href=&quot;http://www.vsg3d.com/amira/overview&quot; rel=&quot;nofollow&quot;&gt;http://www.vsg3d.com/amira/overview&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also found some well implemented registration algorithms in the software MedInria, an open source and free software specially developed for medical image analysis. &lt;a href=&quot;http://med.inria.fr&quot; rel=&quot;nofollow&quot;&gt;http://med.inria.fr&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7560" LastActivityDate="2014-01-22T15:38:19.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13961" PostTypeId="1" AcceptedAnswerId="13981" CreationDate="2014-01-22T17:36:37.210" Score="3" ViewCount="402" Body="&lt;p&gt;In certain applications, you have enough SNR available to, for example, perform an FFT and identify peak location and hence the signal frequency. If my understanding is correct, parameter estimation techniques, such as maximum likelihood, will only be useful when your SNR is so low that you can't run a basic peak search to identify frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have seen literature where people plot performance of various estimation algorithms vs SNRs upto 40~50dB. It seems like a waste of processing power to perform ML on a high SNR (40dB is quite a high value) signal and extract the already obvious information?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a 'rule of thumb' to say, use statistical algorithms below such SNR levels?&lt;/p&gt;&#xA;" OwnerUserId="4673" LastEditorUserId="128" LastEditDate="2018-07-25T03:58:47.787" LastActivityDate="2018-07-25T03:58:47.787" Title="Minimum SNR Requirements for Maximum Likelihood Frequency Estimation" Tags="|frequency-spectrum|estimation|maximum-likelihood-estimation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13962" PostTypeId="2" ParentId="13961" CreationDate="2014-01-22T17:50:46.190" Score="3" Body="&lt;p&gt;I doubt that there is such a rule because your assumption- the negative of computational work more than offsets the benefits of lower error probabilities- assumes that computations are expensive and errors are not. The &quot;costs&quot; of computational work and errors depends entirely on the application.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-01-22T17:50:46.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13963" PostTypeId="1" AcceptedAnswerId="13964" CreationDate="2014-01-23T00:08:30.077" Score="0" ViewCount="252" Body="&lt;p&gt;I'm currently reading this paper: &lt;a href=&quot;http://www.rssd.esa.int/SP/LISAPATHFINDER/docs/Data_Analysis/GH_FFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.rssd.esa.int/SP/LISAPATHFINDER/docs/Data_Analysis/GH_FFT.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;On page 21, it has a section called &amp;quot;Putting it all together&amp;quot;, it states the following steps:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Input data&lt;/p&gt;&#xA;&lt;p&gt;Frequency resolution and length of DFT&lt;/p&gt;&#xA;&lt;p&gt;Window function&lt;/p&gt;&#xA;&lt;p&gt;Splitting of the data stream&lt;/p&gt;&#xA;&lt;p&gt;FFT&lt;/p&gt;&#xA;&lt;p&gt;Scaling&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Now, the &amp;quot;Window function&amp;quot; is mapped out before the &amp;quot;Splitting of the data stream&amp;quot; if this is the case, should I therefore multiply each of the bins within the data stream by each of the window values (Hanning)?&lt;/p&gt;&#xA;&lt;p&gt;For example, at the moment, my Hanning window size is: &lt;code&gt;256&lt;/code&gt; and the data is split into segments of size 256x128 in this case.. &lt;code&gt;N = size of stream&lt;/code&gt; and then compute &lt;code&gt;hanning(N)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've seem a lot of DSP engineers split the window up into frames, before applying the window?&lt;/p&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-01-23T02:31:44.690" Title="STFT - Putting it all together" Tags="|fft|window-functions|stft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13964" PostTypeId="2" ParentId="13963" CreationDate="2014-01-23T01:22:28.847" Score="1" Body="&lt;p&gt;If your window is a rectangular window, then there is no mapping out since splitting the stream into frames is effectivley applying that window. Once you split the stream into frames, if your window is not rectangular, you would then multiply the window against the frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y[i] = x[i] * w[i], for i = 0 to N-1, then take the FFT of y.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-23T01:22:28.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13965" PostTypeId="1" CreationDate="2014-01-23T01:58:08.003" Score="1" ViewCount="450" Body="&lt;p&gt;Ok, so finally some things are making sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to &lt;code&gt;scale&lt;/code&gt; the results, which I have done by the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;PS_{rms} = \frac{2 \cdot \left |y _{m} \right |^{2}}{&#xA;   S_{1}^{2} &#xA;} m = 0.....N/2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where   $y_{m} = (re*re+im*im)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This produces the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LtekI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Sorry about the axis - I have not had time to do these)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prior to scaling the results, I got the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YcTmj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, so far, so good (I hope!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to remove the noise around the signal, in theory, so that the main peaks are just showing and remove all the peaks that are not. So in theory, I would just be left between points (60 - 80).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying to read, and, understand the &quot;Section 10: Averaging and overlapping&quot; in this paper:&#xA;&lt;a href=&quot;http://www.rssd.esa.int/SP/LISAPATHFINDER/docs/Data_Analysis/GH_FFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.rssd.esa.int/SP/LISAPATHFINDER/docs/Data_Analysis/GH_FFT.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It assumes that the usual remedy is to take the average of $M$ elements and reduce the standard deviation of the averaged result by a factor of $1 / \sqrt{M}$ however, what would be $M$ in this case? How could I therefore reduce the standard deviation, in order to remove noise from the result of scaling the PSD?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the only part to which I am now confused about, I essentially need to reduce the noise levels at the start of the result, and, at the end of the result thus giving me only the important peaks within the signal. &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-01-23T03:02:17.820" Title="PSD - Correct Formula for removing Noise" Tags="|fft|stft|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13966" PostTypeId="2" ParentId="13963" CreationDate="2014-01-23T02:31:44.690" Score="0" Body="&lt;p&gt;A non-rectangular window function is usually to help compensate for some of the effects of splitting the stream (which ends up being a rectangular window).  So the window function is to be applied &lt;strong&gt;after&lt;/strong&gt; splitting the stream into FFT length (or shorter) blocks.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-01-23T02:31:44.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13967" PostTypeId="2" ParentId="13965" CreationDate="2014-01-23T03:02:17.820" Score="1" Body="&lt;p&gt;What you need is a &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/filters.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;digital filter&lt;/a&gt;. Digital filters are means to shape or &quot;filter&quot; the frequency response of a signal. Specifically, you need something called a &lt;a href=&quot;https://stackoverflow.com/questions/12093594/how-to-implement-band-pass-butterworth-filter-with-scipy-signal-butter&quot;&gt;band pass filter&lt;/a&gt; which would leave the 60-80 frequency mostly alone, and would mostly get rid of everything else. Snoop around this site or Google them. Digital filter are DSP 101, so there are many examples and tutorials out there.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2014-01-23T03:02:17.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13968" PostTypeId="2" ParentId="13934" CreationDate="2014-01-23T05:07:47.573" Score="0" Body="&lt;p&gt;It is not necessary to use all the mentioned pre-processing steps in your code. Go for the goal of the pre-processing if you can achieve your goal with out some of the steps then omit them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Optimizing the code can reduce the time consumed in iterations. &lt;/p&gt;&#xA;" OwnerUserId="7652" LastActivityDate="2014-01-23T05:07:47.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13969" PostTypeId="1" CreationDate="2014-01-23T07:11:43.830" Score="1" ViewCount="109" Body="&lt;p&gt;I'm trying to relate a near shore tidal signal (&lt;strong&gt;point A&lt;/strong&gt;) to 3 points along a long model boundary (&lt;strong&gt;points B C D&lt;/strong&gt;). I want to possibly have a relationship between &lt;strong&gt;B C D&lt;/strong&gt; with which we can convert &lt;strong&gt;A&lt;/strong&gt; predictions into &lt;strong&gt;B C&lt;/strong&gt; and &lt;strong&gt;D&lt;/strong&gt;. At the moment I'm doing a single phase shift, an amplitude ration for levels above zeros, an amplitude ration for levels below zero and a mean level shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This creates a kink in the Tidal signal at Peak ebb and Peak flood and results in the model over predicting ebb currents. I was wondering if anyone is aware of a more complex relationship for this sort of transformation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I would like to capture is the difference in phase shift between high and low water (for example the ration of period of the positives to the period of the negatives might be different for the different points). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example algorithm for current process.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = vector (size n x 1 ) units meters&#xA;&#xA;time_A = vector (size n x 1 )&#xA;&#xA;ph_B = phase shift for AvsB.&#xA;&#xA;pos_amp_B = positive amplitude ration.&#xA;neg_amp_B = negative amplitude ration.&#xA;&#xA;B_mean = long term mean of B.&#xA;&#xA;A_mean = long term mean of A.&#xA;&#xA;for i = 1:n&#xA;    a = A(i) - A_mean&#xA;    if a &amp;gt; 0&#xA;       B(i) = a*pos_amp_B&#xA;    else&#xA;       B(i) = a*neg_amp_B&#xA;    end&#xA;    time_B(i) = time_A(i) = ph_B&#xA;    B(i) = B(i) + B_mean&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;BTW: The relationship is based on about 6 months of data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 1: &#xA;Well, firstly just think of two sinusoidal signals (ie. amplitude, phase shift), but not regular, so for example the period is 12.5 hrs but the slopes and periods of the positive half and negative half aren't all the same. You don't need any contextual knowledge. Im just looking for a transformation algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a pic of the timeseries and the fft comparisons (fft focused on frequencies of high energy (12.5 hrs (semidiurnal)), just to give idea not all frequencys are so scaled nicely). Black is A. green in zeros line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N10aa.png&quot; alt=&quot;Water Level [m] timeseries (top) and fft analysis (bottom)&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7653" LastActivityDate="2014-01-23T07:11:43.830" Title="Signal Relationships and Conversion: Transforming one Signal into another?" Tags="|fft|matlab|ifft|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13970" PostTypeId="1" AcceptedAnswerId="13982" CreationDate="2014-01-23T08:02:37.797" Score="11" ViewCount="9321" Body="&lt;p&gt;When I was studying dispersion of refraction index in semiconductors and dielectrics, my professor tried to explain that if a filter (like a dielectric absorbing some light frequencies, or an electric RC-filter) removes some frequencies, then the remaining ones must be phase shifted to compensate for those frequencies (which are infinitely spread in time as usual monochromatic signals) being subtracted from the whole signal, to preserve causality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I intuitively understand what he was talking about, but what I'm not sure of is whether his argument is really justified - i.e. whether there can exist a non-trivial filter, which absorbs some frequencies and leaves remaining ones not shifted, but still preserving causality. I can't seem to construct one, but can't prove it doesn't exist as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is: how can it be (dis)proved that a causal filter &lt;em&gt;must&lt;/em&gt; shift phases of frequencies relative to each other?&lt;/p&gt;&#xA;" OwnerUserId="7654" LastEditorUserId="7654" LastEditDate="2014-01-23T14:17:29.560" LastActivityDate="2019-03-09T15:35:49.683" Title="Can a causal filter without phase shifts exist?" Tags="|filters|phase|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13971" PostTypeId="2" ParentId="13970" CreationDate="2014-01-23T08:27:23.237" Score="7" Body="&lt;p&gt;There are filters that cause a ,,linear'' phase shift, that is, constant delay. It is not possible to filter anything at all (causally) without causing any delay.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-23T08:27:23.237" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13973" PostTypeId="2" ParentId="13956" CreationDate="2014-01-23T09:08:10.920" Score="3" Body="&lt;p&gt;To understand the equation in question consider how frequency offset $f_\mathrm{off}$ affects the received signal $r(t)$. For simplicity the authors assume the noise-free case and a frequency flat channel, i.e. the received signal before frequency offset is equal to the transmitted signal $s(t)$. Frequency offset is a frequency shift and can be expressed in time domain by&#xA;$$&#xA;r(t) = s(t) \mathrm{e}^{j2\pi f_\mathrm{off}t}.&#xA;$$&#xA;The received signal is now sampled at $t = n/F_\mathrm{s},\, n\in\mathbb{Z}$, where $F_\mathrm{s}$ is the sampling frequency. This yields&#xA;$$&#xA;r(n/F_\mathrm{s}) = s(n/F_\mathrm{s}) \mathrm{e}^{j2\pi n f_\mathrm{off}/F_\mathrm{s}}.&#xA;$$&#xA;In the following we write $r_n$ and $s_n$ for $r(n/F_\mathrm{s})$ and $s(n/F_\mathrm{s})$, respectively. The authors introduce the normalized frequency offset $\beta = f_\mathrm{off}/\Delta f$ but they don't define what $\Delta f$ is. From the context I understand that it is the subcarrier spacing $\Delta f = F_\mathrm{s}/N$, where $N$ is the number of subcarriers. Using this relationship we can rewrite the above equation as a function of $\beta$:&#xA;$$&#xA;r_n = s_n \exp\left(j2\pi \frac{\beta}{N}n \right).&#xA;$$&#xA;Next we consider a received cyclic prefix sample at $n$ (see above) and the corresponding received payload data sample $N$ samples apart at $n+N$:&#xA;$$&#xA;r_{n+N} = s_{n+N} \exp\left(j2\pi \frac{\beta}{N}(n+N) \right)&#xA;= s_{n} \exp\left(j2\pi\beta + j2\pi \frac{\beta}{N}n \right)&#xA;$$&#xA;In the above equation we have exploited that the cyclic extension is just a copy of the last $N_\mathrm{g}$ samples of an OFDM symbol and therefore $s_{n+N} = s_{n}$ (for all $s_{n}$ that are in the cyclic prefix). We can now see that the phase difference between the cyclic prefix and its corresponding data samples is $\arg(r_n^* r_{n+N})=2\pi\beta$ which is the answer to your first question. It is now easy to obtain an estimate $\hat\beta$ of $\beta$&#xA;$$&#xA;\hat\beta = \frac{1}{2\pi}\arg(r_n^* r_{n+N})&#xA;$$&#xA;It's just an estimation because in reality the received signal is corrupted by noise and channel distortion. The estimation can be improved by not only comparing &lt;em&gt;one&lt;/em&gt; cyclic prefix and data sample but &lt;em&gt;all&lt;/em&gt; $N_\mathrm{g}$ cyclic prefix samples with their respective copies. This is done by adding all $r_n^* r_{n+N}$ in the cyclic prefix and answers your second question about how the formula for $\beta$ is derived.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to say that the paper you're referring to is poorly written and that I probably  wouldn't have understood it neither if I hadn't had some prior knowledge about this topic. Thus I suggest you also read the original work about this topic van de Beek et al.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;J. J. van de Beek, M. Sandell, and P. O. Borjesson, “ML estimation of time and frequency offset in OFDM systems,” IEEE Trans. Signal Process., vol. 45, no. 7, pp. 1800–1805, Jul. 1997.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-01-23T09:08:10.920" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13974" PostTypeId="1" CreationDate="2014-01-23T10:55:33.820" Score="10" ViewCount="5572" Body="&lt;p&gt;I would like to know what is the Compression Algorithm used by Facebook for compressing the images? I uploaded a image of size 242 Kb and I downloaded the same image from my Facebook album. The size of downloaded image is 46 Kb and the subjective quality is similar, I wasn't able to differentiate between the original (uploaded) and downloaded (from Facebook) image. The downloaded image was downsampled though, from &lt;code&gt;1226 x 1600&lt;/code&gt; to &lt;code&gt;552 x 720&lt;/code&gt;. So Facebook compresses the image at a good ratio while we are uploading it to our Facebook account without affecting the subjective quality much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder what compression algorithm they are using for this purpose. What would be your best guess?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                           Original image: tamil_girl_painting (size 1226 x 1600)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dbzU1.jpg&quot; alt=&quot;Original Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                  Downloaded (from Facebook) image: tamil_girl_painting (size 552 x 720)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CYi1f.jpg&quot; alt=&quot;Compressed Image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="8330" LastEditDate="2014-03-26T16:31:53.690" LastActivityDate="2014-03-27T19:33:02.677" Title="What is the Compression Algorithm used by Facebook?" Tags="|image-processing|image-compression|jpeg|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="13975" PostTypeId="2" ParentId="13951" CreationDate="2014-01-23T12:09:36.927" Score="1" Body="&lt;p&gt;It't really more of a question of what the rectangular window is doing to your phase relationships, because it doesn't deemphasize the &quot;edge effects&quot; that occur at the beginning and end of your block of samples, which is the whole point of using a non-rectangular window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this experiment: Do a number of FFTs with lengths ranging from 59*48000 samples to 60*48000 samples, using both window types. You'll find that the Hanning window gives much more consistent results than the rectangular window does. The two results will agree best when the length is close to an integer number of beats.&lt;/p&gt;&#xA;" OwnerUserId="1996" LastActivityDate="2014-01-23T12:09:36.927" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13976" PostTypeId="2" ParentId="13970" CreationDate="2014-01-23T13:09:27.590" Score="4" Body="&lt;p&gt;Phase shift is due to time delay i.e. Time taken by the signal to reach from input to the output of a system. Now if system is not causing any phase shift then it means time delay is zero. Now think of a system which is providing output at the same instant when input is applied. Will that be possible ? Of course not .if there's a system then it must be performing some kind of job on the signal that produces delay and finally phase shift&lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2014-01-23T13:09:27.590" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13977" PostTypeId="2" ParentId="13934" CreationDate="2014-01-23T13:11:35.577" Score="0" Body="&lt;p&gt;Chances are great that all this preprocessing is overkill. And also possibly unsufficient in your case. It all depends on the quality of your images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First check how your segmentation behaves without any preprocessing.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2014-01-23T13:11:35.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13978" PostTypeId="1" AcceptedAnswerId="13993" CreationDate="2014-01-23T13:11:41.203" Score="1" ViewCount="7587" Body="&lt;p&gt;I have just a quick question about how to calculate Deltas from MFCC. I have found the formula for calculating deltas &lt;a href=&quot;http://practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/#deltas-and-delta-deltas&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d_t=\frac{\sum_{n=1}^{N}n\left(c_{t+n}-c_{t-n}\right)}{2\sum_{n=1}^{N}n^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another source states it is a regression equation. From what I can see, it takes coefficient from a previous and next frame. For any $N$ e.g. $N=2$, $t-n$ in $c_{t-n}$ can refer to the past where there are no frames. Which values should I substitute in this case? Should it be simply 0?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, when $t+n$ in $c_{t+n}$ refers to a frame in future that not exists, should it also be 0?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4721" LastActivityDate="2014-01-24T07:21:41.647" Title="MFCC Deltas, Delta-Deltas" Tags="|speech-recognition|speech|mfcc|speech-processing|cepstral-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13979" PostTypeId="2" ParentId="13943" CreationDate="2014-01-23T13:23:17.940" Score="1" Body="&lt;p&gt;Computing the image derivatives are very important for a lot of vision tasks. So let me first begin with answering your questions quickly and then get to more details.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Whether central difference can be applied for finding partial derivative?&#xA;YES&lt;/li&gt;&#xA;&lt;li&gt;Whether the filter mask (which I have proposed above) can be used or not for finding partial derivative?&#xA;It can be used, but only the vertical one (in $y$ direction). The horizontal one would be the transpose of that.&lt;/li&gt;&#xA;&lt;li&gt;If not, please suggest me a filter mask which can perform it better and also mention how is it performing the required operation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For noisy images computing derivatives this way would not be very helpful. That's why Sobel operator exists (&lt;a href=&quot;http://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Sobel_operator&lt;/a&gt;). Instead of the mask you proposed, it suggests to use $0.125 \times [1, 0, -1; 2, 0, -2; 1, 0, -1]$. However Sobel lacked the rotational symmetry. So Scharr kernels were proposed (the same wiki page, on the very bottom). These were proven to be better alternatives. Yet, these developments did not stop the further research. Being not so old, Farid and Simoncelli proposed more robust differentiation operators. See the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hany Farid and Eero Simoncelli &quot;Differentiation of Discrete&#xA;Multi-Dimensional Signals&quot; IEEE Trans. Image Processing. 13(4): 496-508 (2004)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One implementation of this is presented in Peter's Computer Vision MATLAB functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/matlabfns/&quot; rel=&quot;nofollow&quot;&gt;http://www.csse.uwa.edu.au/~pk/research/matlabfns/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check derivative5 and derivative7 functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading about Scale Space would also give you more insight on the nature of such linear operators: &lt;a href=&quot;http://en.wikipedia.org/wiki/Scale_space&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Scale_space&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope these help. Cheers,&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-01-23T13:23:17.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13980" PostTypeId="2" ParentId="13833" CreationDate="2014-01-23T13:30:10.110" Score="4" Body="&lt;p&gt;You can add &lt;strong&gt;Vector graphics&lt;/strong&gt; representations (as opposed to raster representations, mainly used in computer graphics):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;region outlines&lt;/strong&gt; and &lt;strong&gt;strokes&lt;/strong&gt; represented by smooth free-form curves (defined by a finite number of control points).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;no pixels&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;conceptually similar to &lt;strong&gt;CAD&lt;/strong&gt; files.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;regions of &lt;strong&gt;constant color&lt;/strong&gt; or &lt;strong&gt;color gradients&lt;/strong&gt;, opaque or &lt;strong&gt;transparent&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;typical formats: &lt;a href=&quot;http://en.wikipedia.org/wiki/Scalable_Vector_Graphics&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;SVG&lt;/strong&gt;&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/PostScript&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;PostScript&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;used for resolution-independent, high quality graphics. Relevant for image &lt;strong&gt;vectorization&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;proposals to use this representation for &lt;a href=&quot;http://opus.bath.ac.uk/32970/&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;photographic images&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2014-01-24T10:49:00.693" LastActivityDate="2014-01-24T10:49:00.693" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="13981" PostTypeId="2" ParentId="13961" CreationDate="2014-01-23T13:36:33.610" Score="2" Body="&lt;p&gt;The FFT is really a bank of matched filters - each FFT bin corresponds to the output of a matched filter. The criterion for a matched filter is to maximize the SNR at the output of the filter - Note SNR at the output is measured differently than at the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the FFT can be used for frequency estimation, it isn't great. The resolution of the FFT is $1/T$ , where $T$ is the duration of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, there are several methods for estimating the frequency (parametric methods, Eigenvalue analysis etc). In measuring the performance of these estimators you are interested in looking at the variance of the estimator at a particular SNR (assuming your estimator is unbiased). You will usually find that the variance of the estimate decreases as the SNR increases - that's why you see people looking at such high SNRs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At these high SNRs you can use the FFT as an estimator, but the variance of that estimate is probably higher than if you used the other techniques.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-01-23T13:36:33.610" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="13982" PostTypeId="2" ParentId="13970" CreationDate="2014-01-23T14:53:59.607" Score="17" Body="&lt;p&gt;Suppose that a linear filter has impulse response &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt; and frequency response/transfer function &lt;span class=&quot;math-container&quot;&gt;$H(f) = \mathcal F [h(t)]$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt; has the property that &lt;span class=&quot;math-container&quot;&gt;$H(-f) = H^*(f)$&lt;/span&gt; (conjugacy constraint). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the response of this&#xA;filter to complex exponential input &lt;span class=&quot;math-container&quot;&gt;$x(t) = e^{j2\pi f t}$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$y(t) = H(f)e^{j2\pi f t} = |H(f)|e^{j(2\pi f t + \angle H(f))}$$&lt;/span&gt; and if&#xA;we want this filter to cause &lt;em&gt;no&lt;/em&gt; phase shift, it must be that &lt;span class=&quot;math-container&quot;&gt;$\angle H(f) = 0$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How about if, instead of no phase shift, we are willing to allow&#xA;a fixed constant phase shift for all frequencies? That is, &lt;span class=&quot;math-container&quot;&gt;$\angle H(f) = \theta$&lt;/span&gt; for &lt;em&gt;all&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is acceptable to us where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; need not be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;? The extra &#xA;latitude does not help very much, because &lt;span class=&quot;math-container&quot;&gt;$\angle H(-f) = -\angle H(f)$&lt;/span&gt;, and&#xA;so &lt;span class=&quot;math-container&quot;&gt;$\angle H(f)$&lt;/span&gt; cannot have fixed constant value for all &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; unless that value&#xA;is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We conclude that if a filter does not change the phase at all, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt; is a real-valued function, and because of the conjugacy constraint, it is&#xA;also an &lt;em&gt;even&lt;/em&gt; function of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.  But then its Fourier transform &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt; is a&#xA;an &lt;em&gt;even&lt;/em&gt; function of time, and thus the filter cannot be causal (except in trivial cases): if its impulse&#xA;response is nonzero for any particular &lt;span class=&quot;math-container&quot;&gt;$t &amp;gt; 0$&lt;/span&gt;, then it is also nonzero for &lt;span class=&quot;math-container&quot;&gt;$-t$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$-t &amp;lt; 0$&lt;/span&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the filter need not be doing any&#xA;frequency suppression, that is, we did not need the assumption that&#xA;some frequencies are &quot;removed&quot; by the filter (as the OP's&#xA;professor's filter does) to prove the claim that zero phase shift&#xA;is not possible with a causal filter, frequency suppressor or not.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2019-03-09T15:35:49.683" LastActivityDate="2019-03-09T15:35:49.683" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13983" PostTypeId="2" ParentId="13956" CreationDate="2014-01-23T15:51:24.253" Score="3" Body="&lt;p&gt;In addition to Deve's very good answer above, it should be noted that the phase difference $\arg(r_n^* r_{n+N})=2\pi\beta$ is circular and you cannot tell the difference between $0, 2\pi, 4\pi, ...$. In the given case this means that $\beta$ is limited to the range $[0...1]$ or $[-0.5...0.5]$. Therefore, this technique only removes the CFO completely if $|f_{off}|&amp;lt;\frac{\Delta f}{2}$. In all other cases, $\beta$ will be estimated (in the optimal case) such that $\frac{f_{off}}{\Delta f} + \beta$ becomes integer and hence, the resulting CFO after removing the estimated part is an integer multiple of the subcarrier spacing. In that process it can easily happen, that removing the estimated CFO actually increases the CFO of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For that reason, what this technique actually does is estimating (and later removing) fractional carrier frequency offset which is only equivalent to carrier frequency offset estimation if $|f_{off}|&amp;lt;\frac{\Delta f}{2}$. However, if the fractional CFO is removed, this avoids the inter-carrier-interference it causes. What remains is a cyclic shift of the OFDM carriers caused by the remaining CFO that is a multiple of the carrier spacing. So there should be some pilot carriers that allow the detection of such a case.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastEditorUserId="5069" LastEditDate="2014-01-23T15:57:22.023" LastActivityDate="2014-01-23T15:57:22.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13985" PostTypeId="2" ParentId="13954" CreationDate="2014-01-23T17:08:48.513" Score="3" Body="&lt;p&gt;Stationary processes have a spectrum that's time-independent. As the Wikipedia link shows, the colored noises each have a characteristic spectrum, are therefore not time-dependent, and thus stationary.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-01-23T17:08:48.513" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="13986" PostTypeId="1" CreationDate="2014-01-23T18:05:34.010" Score="1" ViewCount="218" Body="&lt;p&gt;I am pursuing a master's in signal processing and I am working on object tracking. Till now I have done object tracking using colors, background subtraction and the Lucas-Kanade method along with a Kalman filter. For my final dissertation, I want to do something new on object tracking and I have explored a lot to get some new ideas but all in vain.  If anyone is working within the same field please suggest some ideas.&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="76" LastEditDate="2014-01-25T03:59:33.257" LastActivityDate="2014-01-25T03:59:33.257" Title="Object tracking using image processing" Tags="|image-processing|" AnswerCount="0" CommentCount="3" ClosedDate="2014-01-27T14:28:49.213" ContentLicense="CC BY-SA 3.0" />
  <row Id="13987" PostTypeId="1" CreationDate="2014-01-23T18:11:58.393" Score="1" ViewCount="3856" Body="&lt;p&gt;In QPSK, after splitting the odd and even bits into the I and Q channels, and then multiplying them with the sine and cosine function, what next am I suppose to do? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I rearrange them back into their odd and even positions? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in OQPSK do I make the first bit of my Q array a dummy bit zero to represent the half symbol delay in the Q channel ?&lt;/p&gt;&#xA;" OwnerUserId="7271" LastEditorUserId="7092" LastEditDate="2014-01-24T20:25:15.243" LastActivityDate="2019-04-14T07:02:39.897" Title="QPSK and OQPSK Modulation" Tags="|modulation|qpsk|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13988" PostTypeId="2" ParentId="13987" CreationDate="2014-01-23T19:00:01.500" Score="2" Body="&lt;p&gt;sure, in reception of QPSK, you receive bit pairs as they are transmitted, and detangle them in the reverse manner that they were grouped together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what's really cool about OQPSK is that the order of the bits going in can &lt;strong&gt;naturally&lt;/strong&gt; determine the order of bit changing in OQPSK.  in fact, it can be made into a DSP modulation system &lt;em&gt;without&lt;/em&gt; the need for grouping bits together in pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define the bitstream &lt;span class=&quot;math-container&quot;&gt;$a[n] \in \{0,1\}$&lt;/span&gt;, and the bipolar binary signal as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x[n] \ = \ (-1)^{a[n]} \ = \ 1  -  2 a[n]\ \in \ \{+1,-1\} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then define these two gating functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;even samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ g[n] \ = \ \tfrac{1}{2} \left(1 + (-1)^n \right) \ = \ \tfrac{1}{2} \left(1 + e^{j \pi n} \right) \ = \ \begin{cases}&#xA;1, &amp;amp; n\text{ even} \\&#xA;0, &amp;amp; n\text{ odd}&#xA;\end{cases} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;odd samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  1 - g[n] \ = \ g[n-1] \ = \ \tfrac{1}{2} \left(1 - (-1)^n \right) \ = \ \tfrac{1}{2} \left(1 - e^{j \pi n} \right) \ = \ \begin{cases}&#xA;0, &amp;amp; n\text{ even} \\&#xA;1, &amp;amp; n\text{ odd}&#xA;\end{cases} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the I/Q quadrature pair is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$      i[n]  \ = \     g[n] \ x[n] \ + \ (1-g[n]) \ x[n-1]  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$      q[n]  \ = \ (1-g[n]) \ x[n] \ + \     g[n] \ x[n-1]  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that &lt;span class=&quot;math-container&quot;&gt;$i[n+1]=i[n]=x[n]$&lt;/span&gt; for even &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q[n+1]=q[n]=x[n]$&lt;/span&gt; for odd &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.  so for either &lt;span class=&quot;math-container&quot;&gt;$i[n]$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt;, the bit rate is half the bit rate is for &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;.  so the bandwidth needed for the analog reconstructed signals &lt;span class=&quot;math-container&quot;&gt;$i(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q(t)$&lt;/span&gt; need only be half of the bandwidth needed for the reconstruction of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the discrete-time OQPSK modulating signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ s[n] \ = \ i[n] \ + \ j \ q[n]  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;returning to the real &lt;span class=&quot;math-container&quot;&gt;$i[n]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;i[n] \ &amp;amp; = \ g[n] \ x[n] \ + \ (1-g[n]) \ x[n-1] \\&#xA;       &amp;amp; = \ \tfrac{1}{2} \left(1 + e^{j \pi n} \right) \ x[n] \ + \ \tfrac{1}{2} \left(1 - e^{j \pi n} \right) \ x[n-1] \\&#xA;       &amp;amp; = \ \tfrac{1}{2} (x[n] + x[n-1]) \ + \ \tfrac{1}{2} e^{j \pi n} (x[n] - x[n-1]) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;q[n] \ &amp;amp; = \ (1-g[n]) \ x[n] \ + \     g[n] \ x[n-1] \\&#xA;       &amp;amp; = \ \tfrac{1}{2} \left(1 - e^{j \pi n} \right) \ x[n] \ + \ \tfrac{1}{2} \left(1 + e^{j \pi n} \right) \ x[n-1] \\&#xA;       &amp;amp; = \ \tfrac{1}{2} (x[n] + x[n-1]) \ - \ \tfrac{1}{2} e^{j \pi n} (x[n] - x[n-1]) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the OQPSK modulating signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;s[n] \ &amp;amp; = \ i[n] \ + \ j \ q[n] \\&#xA;&amp;amp; = \ \tfrac{1}{2} (x[n] + x[n-1]) \ + \ \tfrac{1}{2} e^{j \pi n} (x[n] - x[n-1]) \ + \ j \ \left( \tfrac{1}{2} (x[n] + x[n-1]) \ - \ \tfrac{1}{2} e^{j \pi n} (x[n] - x[n-1]) \right)  \\&#xA;&amp;amp; = \ \frac{1+j}{2} (x[n] + x[n-1]) \ + \ \frac{1-j}{2} e^{j \pi n} (x[n] - x[n-1]) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now compute the Discrete-time Fourier Transform (DTFT)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;S(\omega) \ &amp;amp; = \ \frac{1+j}{2} \left(X(\omega) + e^{-j\omega}X(\omega) \right) \ + \ \frac{1-j}{2}  \left(X(\omega-\pi) - e^{-j(\omega-\pi)}X(\omega-\pi) \right) \\&#xA;&amp;amp; = \ \frac{1+j}{2} X(\omega) \left(1 + e^{-j\omega} \right) \ + \ \frac{1-j}{2}  X(\omega-\pi) \left(1 - e^{-j(\omega-\pi)} \right) \\&#xA;&amp;amp; = \ \frac{1+j}{2} X(\omega) \left(1 + e^{-j\omega} \right) \ + \ \frac{1-j}{2}  X(\omega-\pi) \left(1 + e^{-j\omega} \right) \\&#xA;&amp;amp; = \ \frac{1 + e^{-j\omega}}{2} \Big( (1+j)X(\omega) \ + \ (1-j)X(\omega-\pi) \Big) \\&#xA;&amp;amp; = \ e^{-j\omega/2}\frac{e^{j\omega/2} + e^{-j\omega/2}}{2} \Big( (1+j)X(\omega) \ + \ (1-j)X(\omega-\pi) \Big) \\&#xA;&amp;amp; = \ e^{-j\omega/2} \ \cos(\omega/2) \ \Big( (1+j)X(\omega) \ + \ (1-j)X(\omega-\pi) \Big) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the next question to ask is what does the spectrum of &lt;span class=&quot;math-container&quot;&gt;$X(\omega)$&lt;/span&gt; look like for a bit stream &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; that looks like 00000000...? or 11111111...? or 01010101...? or 10101010...? or 00110011...? or 01100110...?  and then what is the spectrum of the quadrature modulating signal &lt;span class=&quot;math-container&quot;&gt;$S(\omega)$&lt;/span&gt; with those same bit sequences for &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2019-04-14T07:02:39.897" LastActivityDate="2019-04-14T07:02:39.897" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13989" PostTypeId="1" CreationDate="2014-01-23T20:01:40.677" Score="0" ViewCount="594" Body="&lt;p&gt;As a part of my thesis work -in which I am using both acoustic and visual information- I am looking forward to implement a real time sound source localization sub-system. From the geometric principles, I know that at least 4 non-coplanar microphones are needed for 3D localization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as I understand, using only a laptop to interface 4 microphones is impossible. I read that one sound card can only support 2. I also search through 4 microphone usb interfaces and found out &lt;a href=&quot;http://sine.ni.com/nips/cds/view/p/lang/en/nid/209817&quot; rel=&quot;nofollow&quot;&gt;quiet expensive solutions&lt;/a&gt;. I have also encountered to &lt;a href=&quot;http://en.wikipedia.org/wiki/PlayStation_Eye&quot; rel=&quot;nofollow&quot;&gt;PS Eye&lt;/a&gt;, I'm not sure its sensory information is accessible through MATLAB or CLAM/C++ though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I only need an approximate information, I then decided to use only the azimuth angle information (planar confidence) of the source. For that, I know 2 microphones are enough. But I read about another theoretical problems for this case, like the need of calibration, harder sound seperation etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to ask is there a cheap interfacing solution, using 3 or 4 USB microphones? If not, would it be feasible to build up something from scratch and use amplified electret mics? I am really confused about hardware selection. Neither my advisor, nor the academic papers have too much practical information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7661" LastActivityDate="2014-02-23T01:35:44.107" Title="USB microphone &amp; interface selection" Tags="|matlab|audio|real-time|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13990" PostTypeId="1" AcceptedAnswerId="13996" CreationDate="2014-01-23T22:28:56.003" Score="2" ViewCount="689" Body="&lt;p&gt;If I ave 2 otherwise identical 1D signals that are phase shifted from each other then cross-correlation is a perfect way to identify the time lag between the 2 signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now supposing I double the speed of one of those signals (eg sampled at every other sample).  The cross correlation will fail miserably at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in image we can account for this kind of scaling (or even rotation) by converting the images to log polar coordinates and then performing the [phase] correlation.  This has the added advantage of being able to identify the angle of rotation and amount of scaling, I believe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a similar, simple transform for 1D signals to allow for identification of the time lag as well as identifying the amount of time compression of the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess you could use log polar coordinates directly on the 1D signal but it would, instantly, square the memory requirements.  Any other thoughts?&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2014-01-28T12:59:46.500" Title="Cross-correlation of time compressed 1D signal" Tags="|cross-correlation|correlation|1d|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="13991" PostTypeId="2" ParentId="13989" CreationDate="2014-01-24T00:48:28.450" Score="2" Body="&lt;p&gt;Just get a multi-channel recording interface and some regular analog microphones. For example &lt;a href=&quot;http://www.sweetwater.com/store/detail/Scarlett18i20/&quot; rel=&quot;nofollow&quot;&gt;http://www.sweetwater.com/store/detail/Scarlett18i20/&lt;/a&gt; has plenty of channels and microphone pre-amps.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-01-24T00:48:28.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="13993" PostTypeId="2" ParentId="13978" CreationDate="2014-01-24T07:21:41.647" Score="4" Body="&lt;p&gt;It's better to copy first frame and last frame values to extend vector sequence beyond boundaries than to assign 0. This could be implemented just by adjusting indexes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (index1 &amp;lt; 0)&#xA;    index1 = 0&#xA;if (index2 &amp;gt; N - 1)&#xA;   index2 = N - 1&#xA;&#xA;delta = v[index1] - v[index2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2014-01-24T07:21:41.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="13994" PostTypeId="2" ParentId="13974" CreationDate="2014-01-24T10:29:38.480" Score="7" Body="&lt;p&gt;From the images you posted its quite clear that the image has been downsampled and re-compressed with lower quality jpeg settings.  If you look round the mouth you can clearly see JPEG-like artefacts.&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2014-01-24T10:29:38.480" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="13996" PostTypeId="2" ParentId="13990" CreationDate="2014-01-24T14:00:34.220" Score="3" Body="&lt;p&gt;With known time scaling, you can resample to a common rate and then cross-correlate.  It is natural to think you might need to go to the higher of the two rates, but that does not increase information beyond the lower rate, it only interpolates the information. This is analogous to zero-padding an FFT to interpolate the resolution of a peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine unknown time scaling, &lt;a href=&quot;http://en.wikipedia.org/wiki/Cepstrum&quot; rel=&quot;nofollow&quot;&gt;cepstral&lt;/a&gt; processing may provide some insights.  I'm afraid it is not my area, but it sounds related to what you are describing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, you've got two dimensions of uncertainty (start time, rate) across which you'd like to search to find the best correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can reduce it to one dimension by considering the &lt;strong&gt;magnitude&lt;/strong&gt; of the two signals' spectral data. The lower rate data should then look like a stretched version of the higher rate data.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2014-01-28T12:59:46.500" LastActivityDate="2014-01-28T12:59:46.500" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13998" PostTypeId="1" CreationDate="2014-01-24T17:44:44.480" Score="0" ViewCount="1160" Body="&lt;p&gt;Trying to understand whether or not I am calculating the PSD correctly. Below is the equation that I am using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;PSD_{rms}(f_{m} = m \cdot f_{res}) = \frac{PS_{rms}&#xA;}{ENBW} = \frac{2 \cdot \left | y_{m} \right |^{2}}{f_{s}\cdot S_{2}} m = 0....N/2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This equation is applied using the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Calculate the squared magnitude of the FFT bin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ mag = (re*re+im*im) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) For each of these magnitude, I calculate the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ PSD(0...NFFT/2) = 2 \cdot (mag[0... NFFT/2] / Fs \cdot S2 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it looks like the following in code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PSD[i] = 2 * (result[i]) / (12000 * S2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gzs4Q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks like the result is being scaled correctly. However, the removal of the noise...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been told to use a &lt;code&gt;band-pass&lt;/code&gt; filter, but, looking at the source code of Matlab in their &lt;code&gt;spectrogram&lt;/code&gt; algorithm they do not pass the results through any kind of filtering algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Should the output be this, and, if so, should I therefore apply a filtering algorithm even though matlab does not? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at matlab result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dnJiT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="5182" LastEditDate="2014-01-24T17:56:20.950" LastActivityDate="2014-01-26T02:42:48.393" Title="PSD - Is this formula correct?" Tags="|fft|spectrogram|stft|power-spectral-density|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="13999" PostTypeId="1" CreationDate="2014-01-24T20:56:08.847" Score="1" ViewCount="554" Body="&lt;p&gt;I have a 2D array/matrix (something like an image, but it's not an actual image) with values from 0 to X (in this case 180). and I have a 1D array/Vector that has the occurrence frequency of these values in the 2D matrix (I think it's like Histogram, but I've done that manually).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the 1D array can look like this.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/AW4nd.png&quot; alt=&quot;1D array representing the occurrence of the 2D array&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to segment it based on peak values. I mean I want to get each mountain separately. so let's say every cell (or pixel in the 2D array) that has a value between 0 and 30 will have the label 1, and the values between 30 and 150 will have the label 2, and the values from 150 to 180 will have the label 3. (that's in case of 3 labels only -which is fine-). &#xA;but I could want to do it with more than that for example from 0 to 5, then from 5 to 18 etc. so segment each peak separately. I used the &lt;code&gt;findpeak&lt;/code&gt; matlab function, but I've only got peaks (which represent the center of my range). I thought of getting every 2 consecutive peaks and then segment based on half the distance between them, but that will give a bad result between 20 and 150 for example.&#xA;looking for local minima might be useful but I think there's no function in matlab for that. and if I want to go in this approach I'm afraid of getting too many results in the long valley range (which I don't need).&#xA;I don't know if there's a better idea. so to reformulate the question, eventually I want to segment a 2D array based on the most occurred values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas or scientific keywords can be helpful, because I'm a newbie in this area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(and here's another example)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uvVhO.png&quot; alt=&quot;another example with 3 main mountains&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the function I'm using to show the peaks for now:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[pks,locs] = findpeaks(data, 'MINPEAKHEIGHT', 200);&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7470" LastActivityDate="2014-01-24T20:56:08.847" Title="Segmentation based on peak values" Tags="|image-processing|matlab|image-segmentation|segmentation|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14001" PostTypeId="2" ParentId="13987" CreationDate="2014-01-24T23:55:31.657" Score="5" Body="&lt;p&gt;This question seems to be based on several misconceptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a QPSK modulator operating at a rate of $N$ baud, &lt;em&gt;two&lt;/em&gt; bits enter the&#xA;modulator during each $T = N^{-1}$ second interval.  If the bits are&#xA;entering on a single wire (at a rate of $2N$ bits per second, the&#xA;QPSK modulator first &lt;em&gt;converts&lt;/em&gt; this serial input&#xA;bit stream at $2N$ bits per second into two parallel bit streams at&#xA;$N$ bits per second. For example, alternate bits are steered to&#xA;alternate streams so that, &lt;em&gt;say,&lt;/em&gt; all the odd-numbered bits&#xA;are in one stream and all the even-numbered bits are in the &#xA;other stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases, the bits entering the QPSK modulator&#xA;are already formatted into two parallel bit streams at $N$ bits per&#xA;second. One important and commonly observed arrangement of this type&#xA;is when a rate-$\frac12$ convolutional encoder precedes the QPSK modulator,&#xA;so that &lt;em&gt;information&lt;/em&gt; bits enter the encoder serially&#xA;at rate $N$ bits per second, and the convolutional encoder spits out two &#xA;&lt;em&gt;parallel&lt;/em&gt; bit streams at $N$ bits per second.  However, regardless of&#xA;encoding or not, the bits that the QPSK&#xA;modulator uses are in two parallel streams that are &lt;em&gt;synchronous&lt;/em&gt;&#xA;(that is, the bit transitions occur at the same times (once every&#xA;$T$ seconds) and in each&#xA;bit stream, the bit occupies the entire $T$ second interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the OP's question says, the bits are modulated onto cosine and&#xA;sine carriers.  As discussed in more detail &lt;a href=&quot;https://dsp.stackexchange.com/a/6447/235&quot;&gt;here&lt;/a&gt;, if the bits in the two streams are denoted by $b_I$ and&#xA;$b_Q$, then the corresponding signals, &lt;strong&gt;say, over the interval&#xA;$[0,T)$&lt;/strong&gt; can be taken to be &#xA;$$(-1)^{b_I}\cos(2\pi f_c t) ~~ \text{and}~~ -(-1)^{b_Q}\sin(2\pi f_c t),&#xA;0 \leq t &amp;lt; T. \tag{1}$$&#xA;(Ignore the negative sign on the $\sin$, it is there to simplify&#xA;notation in more detailed analyses).  The QPSK signal is the &lt;strong&gt;sum&lt;/strong&gt;&#xA;$$(-1)^{b_I}\cos(2\pi f_c t) -(-1)^{b_Q}\sin(2\pi f_c t),&#xA;0 \leq t \leq T. \tag{2}$$&#xA;&lt;strong&gt;It is not the case, as the OP seems to think&lt;/strong&gt; that the two&#xA;signals are separated into even and odd bits, so that&#xA;$(-1)^{b_I}\cos(2\pi f_c t)$ lasts from $t=0$ to $t=T/2$ and&#xA;$-(-1)^{b_Q}\sin(2\pi f_c t)$ from $t=T/2$ to $t=T$: the&#xA;cosine and sine signals last for the full $T$-second duration&#xA;and the bits $b_I$ and $b_Q$ both affect the signal phase for all&#xA;$T$ seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Offset QPSK &lt;em&gt;also&lt;/em&gt; converts the serial bit stream into&#xA;two parallel bit streams in which the bit intervals are&#xA;of duration $T$ on each wire, but the bit &lt;em&gt;transitions&lt;/em&gt;&#xA;are &lt;strong&gt;not synchronous&lt;/strong&gt; but occur with an &lt;em&gt;offset&lt;/em&gt; of&#xA;$T/2$ seconds.  Thus, $b_I$ modulates the cosine carrier&#xA;to produce &#xA;$$(-1)^{b_I}\cos(2\pi f_c t), 0 \leq t &amp;lt; T$$&#xA;but $b_Q$ modulates the sine carrier to produce&#xA;$$-(-1)^{b_Q}\sin(2\pi f_c t), \frac{T}{2} \leq t &amp;lt; \frac{3T}{2}.$$&#xA;The modulator output is &lt;em&gt;still&lt;/em&gt; the sum of the two sinusoids,&#xA;but the sinusoids change phase at different times. In fact,&#xA;the signal can be deemed to be a $2N$ baud signal since the&#xA;phase can change once every $T/2 = (2N)^{-1}$ seconds.&#xA;Each bit still affects the phase for $T$ seconds, but the&#xA;bit transitions are staggered.  In the receiver, integrations&#xA;(or matched filterings)&#xA;are carried out over (staggered) $T$-second intervals in the&#xA;two branches of the receiver, and the decision devices&#xA;spit out one bit every $T$ seconds but at staggered times.&#xA;It is easy to multiplex these decisions onto a single wire&#xA;that thus carries a bit stream at $2N$ bits per second,&#xA;just as the input to the QPSK modulator (if anyone still&#xA;remembers that far back in this answer) is a bit stream&#xA;on a single wire at $2N$ bits per second.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-01-24T23:55:31.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14002" PostTypeId="1" CreationDate="2014-01-25T01:41:50.470" Score="1" ViewCount="2945" Body="&lt;p&gt;I am working recognition of plant seeds with Matlab, and I am looking for code to remove the shadow in grayscale and binary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9s2hC.jpg&quot; alt=&quot;image of seed with shadow&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The binarized version of the image is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WMYs1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7673" LastEditorUserId="80" LastEditDate="2014-03-20T01:47:59.077" LastActivityDate="2014-03-20T01:47:59.077" Title="Removal of shadow from Matlab image for recognition of seeds of plants" Tags="|matlab|" AnswerCount="2" CommentCount="3" ClosedDate="2014-03-21T00:11:52.720" ContentLicense="CC BY-SA 3.0" />
  <row Id="14003" PostTypeId="1" CreationDate="2014-01-25T03:49:18.137" Score="0" ViewCount="1856" Body="&lt;p&gt;I am developing a chord recognition program using neural networks.I need to normalize the spectrogram or my pitch class profile to provide inputs for the neural network. The pitch class profile classifies the frequency into 12 class semitones (From note A to G). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem here is it produces really high values and low values: they can be on the order of ten, one million, or even a trillion. Meanwhile, the input values for the neural network should be between 1 and -1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is a normalization formula that I can use to transform the values to be between 1 and -1?&lt;/p&gt;&#xA;" OwnerUserId="5797" LastEditorUserId="76" LastEditDate="2014-01-25T03:54:06.617" LastActivityDate="2014-08-25T10:24:10.543" Title="Normalizing a spectrogram or a pitch class profile" Tags="|fft|audio|frequency-spectrum|stft|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14004" PostTypeId="2" ParentId="14002" CreationDate="2014-01-25T07:38:57.133" Score="0" Body="&lt;p&gt;Have you gone through the &quot;rice grains&quot; tutorial?&#xA;&lt;a href=&quot;http://www.mathworks.com/help/images/image-enhancement-and-analysis.html&quot; rel=&quot;nofollow&quot;&gt;(a)&lt;/a&gt; &lt;a href=&quot;http://www.mathworks.com/products/image/examples.html?file=/products/demos/shipping/images/ipexrice.html&quot; rel=&quot;nofollow&quot;&gt;(b)&lt;/a&gt; &lt;a href=&quot;http://cronos.rutgers.edu/~lrr/dsp%20design%20course/lectures_2012_new/pdf_2012/Lecture3c_2012.pdf&quot; rel=&quot;nofollow&quot;&gt;(c)&lt;/a&gt; &lt;a href=&quot;http://www-rohan.sdsu.edu/doc/matlab/toolbox/images/getting3.html&quot; rel=&quot;nofollow&quot;&gt;(d)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that feeding your image into the process described in the &quot;rice grains&quot; tutorial,&#xA;with minor tweaks -- perhaps changing the&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;background = imopen(I,strel('disk',15));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;step to perhaps something more like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;background = imopen(I,strel('disk',600));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would produce a images closer to what you wanted.&lt;/p&gt;&#xA;" OwnerUserId="484" LastActivityDate="2014-01-25T07:38:57.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14006" PostTypeId="2" ParentId="14002" CreationDate="2014-01-25T12:14:15.747" Score="0" Body="&lt;p&gt;I will propose 2 methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The easy one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saturation value of shadows are generally very low. So convert your image to HSV domain. Obtain S channel (saturation) and threshold it. For this specific example, threshold value $100$ gives you the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nmWVE.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) More Sophisticated: Shadow removal problem is generally tackled using intrinsic images. They are pretty straightforward to compute and various resources exist on that literature. To begin with, I would suggest:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cs.mcgill.ca/~jfrank8/ecse626/ecse626-project-jordan-frank.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cs.mcgill.ca/~jfrank8/ecse626/ecse626-project-jordan-frank.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-01-25T15:21:57.667" LastActivityDate="2014-01-25T15:21:57.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14008" PostTypeId="1" CreationDate="2014-01-25T12:45:10.233" Score="1" ViewCount="2491" Body="&lt;p&gt;I have a progam in matlab that generates a linear and quadratic chirp, and now I want to study the frequency components in wvtool. However, I am not able to decode the frquency domain scale &quot;the normalized frequency&quot;. The usual process of deviding the normalized frequency with the sampling frequency doesnot provide the desired value. Please refer to the program and image for details.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 500;&#xA;tf = 1;&#xA;t = 0:1/Fs:1;&#xA;f1 = 10;&#xA;f2 = 90;&#xA;slope = (f2-f1)./t(end);&#xA;&#xA;F = f1 + slope* t;&#xA;F1 = f1 + slope* t.* t;   &#xA;% quadratic chirp&#xA;y = 1.33*cos(2*pi*F1.*t);&#xA;% linear chirp&#xA;y1 = 1.33*cos(2*pi*F.*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZbGpC.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="1606" LastEditDate="2014-01-25T13:26:42.927" LastActivityDate="2014-03-26T18:55:24.150" Title="Normalized frequency in matlab" Tags="|fft|matlab|frequency-spectrum|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14009" PostTypeId="1" AcceptedAnswerId="14010" CreationDate="2014-01-25T14:11:31.153" Score="0" ViewCount="1089" Body="&lt;p&gt;I'am pretty new to this topic so i dont have much experience with DSP.&#xA;I want to filter(highpass) a WAVE file, i have already programmed the FFT, and now want to filter the FFT vector via convolution (which is a multiplication in frequency domain ?!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Can anyone give me an easy equation for such a filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If i have an equation i compute it, also Fourier-Transform it, an multiply it with my FFT vector and inverse Transform it an i have applied the filter?!&lt;/p&gt;&#xA;" OwnerUserId="7677" LastActivityDate="2014-01-25T15:01:20.563" Title="Easy Filter with FFT and Convolution" Tags="|fft|filters|convolution|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14010" PostTypeId="2" ParentId="14009" CreationDate="2014-01-25T15:01:20.563" Score="0" Body="&lt;p&gt;Actually, yes. As Hilmar pointed out, it might be cheaper to use an ordinary filter, but that depends on the circumstances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have two signals $A$ and $B$ with Fourier transform being $\mathcal{F}$, their convolution $A\ast B$ will be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;A\ast B = \tilde{\mathcal{F}}(\mathcal{F}(A)\cdot\mathcal{F}(B))&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $\tilde{\mathcal{F}}$ being the inverse transform. This is the well known &quot;convolution lemma&quot;. There is not much of a theory to see. In the Fourier domain, you just replace convolution by (point-wise) multiplication. Your question already contained the answer, to me it just appears that you were not sure about the details.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-25T15:01:20.563" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14011" PostTypeId="1" CreationDate="2014-01-25T16:57:15.727" Score="4" ViewCount="1924" Body="&lt;p&gt;I understand the concept of channel capacity as the maximal rate of the channel code I can apply without making a mistake in the receiver, in that sense the capacity is between 0 and 1.&#xA;What I don't understand is the meaning of the capacity in the AWGN channel case where it is calculated by C=(1/2)*log2(1+SNR) where clearly I get a number greater than 1 when the SNR is greater than 3 (linear scale).&#xA;How can I pass more than 1 bits/channel use when the SNR is very high?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7680" LastActivityDate="2014-01-26T14:48:35.463" Title="Meaning of channel capacity in the AWGN channel" Tags="|information-theory|channelcoding|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14014" PostTypeId="2" ParentId="14008" CreationDate="2014-01-25T18:25:04.693" Score="1" Body="&lt;p&gt;In order to get the actual frequency of each bin, not normalized frequency, you must compute the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fres = fs/fft_size; % Bin spacing&#xA;f = fres * (0:fft_size/2); % Bin centers and frequency axis&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-25T18:25:04.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14016" PostTypeId="1" AcceptedAnswerId="14018" CreationDate="2014-01-25T21:16:31.077" Score="18" ViewCount="7100" Body="&lt;p&gt;Since a couple of months ago I started being actively involved in the area of control of dynamical systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most cases, designing a controller for a given dynamic system will require the employment of digital signal processing techniques, especially in the area of signal filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I do not have a background in control engineering, I wonder if any of you may provide me with suggestions of sound &lt;strong&gt;textbooks dealing with signal filters&lt;/strong&gt; into some detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The textbooks should ideally encompass:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Introduction to the most common filters in the area of DSP;&lt;/li&gt;&#xA;&lt;li&gt;Explanation of their main characteristics in both frequency and time domain;&lt;/li&gt;&#xA;&lt;li&gt;In which scenarios are they generally used (role or function of the filter).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Although being a naive question, I hope you may advise a couple of textbooks.&lt;/p&gt;&#xA;" OwnerUserId="3666" LastEditorUserId="1273" LastEditDate="2014-01-27T15:44:46.170" LastActivityDate="2017-06-23T13:10:53.047" Title="A good textbook for designing signal filters" Tags="|filters|filter-design|reference-request|control-systems|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14017" PostTypeId="2" ParentId="14011" CreationDate="2014-01-25T21:23:31.523" Score="5" Body="&lt;p&gt;There are two main factors when figuring out how many bits are transmitted per symbol (or &quot;channel use&quot;): the modulation and the error correction encoding.  For instance, BPSK modulation with no encoding transmits 1 bit/symbol, while QPSK with no encoding transmits 2 bits/symbol.  Higher order modulation schemes (e.g. 8-PSK, 16-QAM, 32-QAM, etc.) can transmit even more bits/symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error correction encoding reduces the number of information bits/symbol, because some of the bits are used for the error correction code.  While this is unfortunate it is necessary to achieve arbitrarily low error rates without requiring insanely high SNR's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fairly common set of error correction codes is $\frac{1}{2}$ rate convolutional codes, which are called &quot;$\frac{1}{2}$ rate&quot; because half of the bits are information (i.e. payload) bits, while the others are code bits (often called &quot;parity bits&quot;).  Thus, if you used QPSK and a $\frac{1}{2}$ rate convolutional code you would have an overall information transmission rate of $2*\frac{1}{2} = 1$ bit/symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, getting to your question, you ask- &quot;but if I find that the capacity is e.g. 2.3 [bits/channel use] doesn't it tell me that I can use QPSK modulation because the channel can work (with appropriate coding) with above 2 bits per sample without error?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, that's not what it's saying.  What it is saying is that there exists a modulation and error correction scheme (and please note that it does not say &lt;em&gt;anything&lt;/em&gt; about what the appropriate modulation type[s] and/or error correction scheme[s] might be) that can get you reliably error free data transmission at up to 2.3 bits/symbol.  Now, having said that, since QPSK has a data rate that is less than 2.3 bits/symbol, if you paired it up with an appropriate error correction scheme for your channel (for instance, are the errors bursty or non-bursty?) then you could probably get reliable communication through that channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best codes that we know of for getting close to the Shannon limit are Turbo codes and low-density parity check codes (also known as Gallager codes).&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-01-25T21:23:31.523" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14018" PostTypeId="2" ParentId="14016" CreationDate="2014-01-25T22:25:16.573" Score="18" Body="&lt;p&gt;There are a lot of books out there, but if you are interested in Control and Signal Processing, I strongly suggest you take a look a Stephen Boyd Lectures from standford:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=bf1264iFr-w&quot;&gt;http://www.youtube.com/watch?v=bf1264iFr-w&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's the first one, the entire course is really valuable and he is a great Teacher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appart from That here's a good list of my preferred books on Signal Processing, some are more introductory, and some are more advanced:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Signals And Systems - Oppenheim &amp;amp; Willsky&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Digital Signal Processing - Proakis &amp;amp; Manolakis&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Discrete Time Signal Processing - Oppenheim &amp;amp; Schafer&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A bit more Advanced and Related to Control:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Optimum Signal Processing - Sophocles J. Orfanidis&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Optimal Filtering - Brian D. O. Anderson &amp;amp; John B. Moore&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Optimal Control: Linear Quadratic Methods - Brian D. O. Anderson &amp;amp; John B. Moore&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some on Statistical Processing (Advanced):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Statistical Signal Procfessing - Louis L. Scharf&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Linear Estimation - Thomas Kailath, Ali H. Sayed &amp;amp; Babak Hassibi (Watch out this one is really tough)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Spectral Analysis of Signals - Petre Stoica &amp;amp; Randolph Moses&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And some about Adaptive processing (Useful in every area of signal processing and control):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Adaptive Filter Theory - Simon Haykin&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Adaptive Filters - Ali H. Sayed&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Satistical And adaptive Signal Processing - Manolakis, Ingle &amp;amp; Kogon&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And of course, the father of all Control Engineering Textbooks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Linear Systems - Thomas Kailath&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From your question i cannot really guess your background, but if you have never studied any topic like LTI systems, Digital Systems or Control, i would say you have a couple of years ahead of you to really learn and dominate the topic. The books i listed are the most referenced books in university courses, and in general the ones that everyone studies. They are for the most part, very theoretical, a lot of math and stuff like that. But it's a must have for reference. If you are looking for more instant satisfaction i would say try to google some cookbooks about digital filters or control, with the basics of PID controllers, linear regulators, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="80" LastEditDate="2014-01-26T02:02:47.940" LastActivityDate="2014-01-26T02:02:47.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14019" PostTypeId="2" ParentId="13998" CreationDate="2014-01-26T02:42:48.393" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;My question is: Should the output be this, and, if so, should I therefore apply a filtering algorithm even though matlab does not?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Without seeing your code I can't determine what's the reason for a difference in the two plots. There's multiple things that come into play like window type, overlap, and FFT size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't say for sure if you should filter your data. It depends on the application. If you're just going to plot it, it may not be necessary. If the out of band energy or noise is really high and leaking into the signal band, then maybe. If this is going to be the input to some other process and you think the out of band energy is degrading some results, then sure, go ahead and filter. Without knowing your application it's tough to say what's right or wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, in order to filter your signal to remove out of band noise, there's two approaches, but the easiest would be to do it in the time-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filter the data in the time-domain with either an FIR or IIR filter. Have a look at functions &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/fir1.html&quot; rel=&quot;nofollow&quot;&gt;fir1&lt;/a&gt; and &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/fir2.html&quot; rel=&quot;nofollow&quot;&gt;fir2&lt;/a&gt; in MATLAB. Once you design your filter, use &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/freqz.html&quot; rel=&quot;nofollow&quot;&gt;freqz&lt;/a&gt; to quickly plot the frequency response to make sure it's correct. Once you have your filter 'b', compute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% design filter 'b' using fir1 or fir2&#xA;y = filter(b, 1, x); % Filter input x with filter b&#xA;% compute PSD of y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Depending on your filter you should see suppression of energy in the stop bands.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-26T02:42:48.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14020" PostTypeId="2" ParentId="14003" CreationDate="2014-01-26T02:53:01.633" Score="0" Body="&lt;p&gt;Well if you know what a reasonable min/max range of the output of your spectogram will be then you can just remap the range, see this &lt;a href=&quot;https://stackoverflow.com/questions/3451553/value-remapping&quot;&gt;se question&lt;/a&gt;. Otherwise you'll need to have some sort of clipping method that maps values greater than X to 1. Example: &gt;1 trillion = 1, 0 = -1, and remap the ranges between 0 to 1 trillion onto the range of -1 to 1. You could also convert the spectogram output into decibels which will effectively compress the output range to something like -60 to 100 dB. These are generally typical ranges in dB for the output of a spectogram. Note that taking the log will make the output nonlinear, I'm not sure if that will have any negative effects on your neural network.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-01-26T02:53:01.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14021" PostTypeId="2" ParentId="14011" CreationDate="2014-01-26T03:29:49.927" Score="5" Body="&lt;p&gt;There are two different kinds of channel models that are being confused here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;em&gt;binary symmetric channel,&lt;/em&gt; the inputs and the outputs&#xA;are constrained to be $0$ or $1$ and the key parameter is the&#xA;transition probability: the probability that an input $0$ is changed&#xA;to an output $1$ or vice versa.  The channel capacity $C$&#xA;is a number between $0$ and $1$ and the meaning is that by using&#xA;a suitable code of rate $R &amp;lt; C$ on the channel, we can transmit&#xA;at a rate of $R$ information bits per channel use with arbitrarily&#xA;high reliability (that is, with arbitrarily small bit error&#xA;probability.  A (block) code for such a channel would be a set&#xA;of $M$ binary $n$-tuples that will convey $\log_2 M$ bits in $n$ channel&#xA;uses at a rate $R = \frac{\log_2 M}{n}$. Usually $M$ is chosen as&#xA;a power of $2$, say $2^k$ for some $k &amp;lt; n$.  Note also that the&#xA;binary symmetric channel capacity cannot exceed 1 bit per channel use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete-time Gaussian channel is a different beast. The inputs &#xA;can be arbitrary real numbers (it is not necessary that they &#xA;be restricted to $0$ or $1$) and if the $i$-th input is $x_i$,&#xA;then the $i$-th output is $x_i+n_i$ where the $n_i$ are &lt;em&gt;independent&lt;/em&gt;&#xA;zero-mean Gaussian random variables with variance $\sigma^2$.&#xA;$x_i^2$ is called the power in the $i$-th input and&#xA;$\sigma^2$ is called the noise power.  A (block) code for such&#xA;a channel is a collection of $M$ $n$-vectors $\mathbf x^{(i)}$&#xA;(called a codebook) that can be used&#xA;to transmit $\log_2 M$ bits in $n$ channel uses.  Various realistic &#xA;constraints are placed on the code.  One &#xA;such constraint is that the &lt;em&gt;peak power&lt;/em&gt; is bounded by $P$:&#xA;the magnitudes of all the $M\times n$ entries $x_j^{(i)}$&#xA;in the codebook are no larger than $\sqrt{P}$.&#xA;Another is that &#xA;that the &lt;em&gt;average power&lt;/em&gt; is bounded by $P$: &#xA;$$\frac{1}{Mn}\sum_{i} ||\mathbf x^{(i)}||^2 &#xA;= \frac{1}{Mn} \sum_i \sum_j \left|x_j^{(i)}\right|^2\leq P.$$&#xA;The capacity of the channel depends on the &lt;em&gt;signal to noise ratio&lt;/em&gt;&#xA;$P/\sigma^2$ and it can exceed one bit per channel use.  Think of it&#xA;this way: we can use multilevel pulse amplitude modulation to transmit&#xA;more than one bit per channel symbol on this channel whereas with&#xA;the binary symmetric channel we are restricted to binary modulation&#xA;and so cannot exceed one bit per channel use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For lots of details on this kind of stuff at a level lower than&#xA;a typical graduate text, see the following links (lecture notes&#xA;of mine).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture06.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture 6&lt;/a&gt;,&#xA;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture07.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture 7&lt;/a&gt;,&#xA;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture08.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture 8&lt;/a&gt;,&#xA;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture09.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture 9&lt;/a&gt;,&#xA;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture10.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture 10&lt;/a&gt;,&#xA;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture11.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture 11&lt;/a&gt;,&#xA;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture12.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture 12&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-01-26T14:48:35.463" LastActivityDate="2014-01-26T14:48:35.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14025" PostTypeId="1" CreationDate="2014-01-26T11:40:20.647" Score="1" ViewCount="2184" Body="&lt;p&gt;My goal is to obtain a plot with the spatial frequencies of an image - kind of like doing a fourier transformation on it. I don't care about the position on the image of features with the frequency f (for instance); I'd just like to have a graphic which tells me how much of every frequency I have (the amplitude for a frequency band could be represented by the sum of contrasts with that frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to do this via the &lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fft2.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;numpy.fft.fft2&lt;/code&gt;&lt;/a&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a link to a &lt;a href=&quot;http://nbviewer.ipython.org/urls/gist.github.com/TheChymera/8606917/raw/2a93b8b1c3b15e8467cca21b5924c20533787fc5/imFreq?create=1&quot; rel=&quot;nofollow&quot;&gt;minimal example&lt;/a&gt; portraying my use case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it turns out I only get distinctly larger values for &lt;code&gt;frequencies[:30,:30]&lt;/code&gt;, and of these the absolute highest value is &lt;code&gt;frequencies[0,0]&lt;/code&gt;. How can I interpret this? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What exactly does the amplitude of each value stand for?&lt;/li&gt;&#xA;&lt;li&gt;What does it mean that my highest value is in &lt;code&gt;frequency[0,0]&lt;/code&gt; What is a &lt;code&gt;0 Hz&lt;/code&gt; frequency?&lt;/li&gt;&#xA;&lt;li&gt;Can I bin the values somehow so that my frequency spectrum is orientation agnostic?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7687" LastActivityDate="2014-01-26T14:05:22.773" Title="Interpret numpy.fft.fft2 output" Tags="|fft|frequency-spectrum|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14026" PostTypeId="2" ParentId="14025" CreationDate="2014-01-26T14:05:22.773" Score="1" Body="&lt;p&gt;You actually did a two dimensional Fourier transform there. The 0 Hz frequency is the ,,DC offset'' of your signal, that is, its average value. In computers, it's no wonder that there's a high average value, because signals are often defined using positive numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a 2D Fourier transform, the coefficients of the transformed correspond to products of 1D Fourier basis elements, that is, signals with a period equal to the length of the signal. You could call these overtones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2D Products of two such signals are not ,,orientation agnostic''. In fact, they have obvious orientation along the edges of the signal. It is not entirely clear what you are asking for here.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-26T14:05:22.773" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14027" PostTypeId="2" ParentId="4723" CreationDate="2014-01-26T20:15:35.820" Score="4" Body="&lt;p&gt;If you take a picture with a camera with the lens defocused, the result is a convolution of the focused image with the point spread function of the defocus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability distribution of the sum of a pair of dice is the convolution of the probability distributions of the individual dice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long multiplication is convolution, if you don't carry from one digit to the next. And if you flip one of the numbers. {2, 3, 7} convolved with {9, 4} is {8, 30, 55, 63}&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      2   3   7&#xA;   X      4   9&#xA;---------------&#xA;     18  27  63 &#xA;  8  12  28&#xA;---------------&#xA;  8  30  55  63&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(You could finish out the multiplication by carrying the &quot;6&quot; from 63 into the 55, and so on.)&lt;/p&gt;&#xA;" OwnerUserId="7689" LastEditorUserId="-1" LastEditDate="2015-11-19T12:59:30.517" LastActivityDate="2015-11-19T12:59:30.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14028" PostTypeId="1" CreationDate="2014-01-26T20:16:56.957" Score="2" ViewCount="232" Body="&lt;p&gt;Not sure if this is the right place for my question but let me give it a try.&#xA;I have a very simple analog sensor (piezo transducer) which is attached to a microcontroller. I'm using this sensor to detect gestures (hand movements).&#xA;The mCU sends the sensor data to my PC where I'm running a simple application that plots the data to a graph. In this graph the human eye and brain can recognize easily which gesture is present on the graph, but, of course, the computer has to recognize it as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for an algorithm or at least a starting point I can detect these gestures. I'm very new to this field so any advice or information would be a great help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you can see a sample screenshot of the graph with two different gestures:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1bqfV.png&quot; alt=&quot;Gesture detection using piezo sensor&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to set the correct tags for this question.&lt;/p&gt;&#xA;" OwnerUserId="7690" LastActivityDate="2014-02-26T00:37:49.313" Title="Gesture recognition from analog sensor value" Tags="|signal-analysis|algorithms|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14030" PostTypeId="2" ParentId="13850" CreationDate="2014-01-26T23:04:51.323" Score="6" Body="&lt;p&gt;No,because while mutual information tells you how much uncertainty can a random variable $X$ &lt;em&gt;remove&lt;/em&gt; from another random variable $Y$, the conditional entropy of $X$ given $Y$ tells you how much uncertainty &lt;em&gt;remained&lt;/em&gt; in X after using the information (given by $I(X;Y)$) that $Y$ gave it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(X|Y)=H(X)-I(X;Y)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why the conditional entropy depends on the value of the entropy before the observation and the mutual information isn't, because it is only the difference ($\delta$) between two entropy states, before and after the observation. &lt;/p&gt;&#xA;" OwnerUserId="7686" LastEditorUserId="7092" LastEditDate="2014-01-27T01:16:13.400" LastActivityDate="2014-01-27T01:16:13.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14031" PostTypeId="2" ParentId="14028" CreationDate="2014-01-26T23:55:12.503" Score="1" Body="&lt;p&gt;You can use a matched filter. Average all the gesture 1's and that's your filter. Do the same for however many gestures you have and you will effectively have a bunch of filters. Run the data through those filters in parallel and then you will need a decision threshold that indicates yes/no if that gesture is detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should look something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9GfNk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-01-26T23:55:12.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14032" PostTypeId="2" ParentId="2101" CreationDate="2014-01-27T03:10:09.237" Score="1" Body="&lt;p&gt;In general, in order to stabilise a system, however complex, if you have the transfer function $G(s)$, you introduce a feedback loop with a new function $F(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Write the closed loop transfer function for the new system with the added $F(s)$, and then find $F(s)$ in order for the new system to be stable. This is like the first exercise in any control book in order to offer an example of stabilising a system via negative Feedback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the book from Ogata on control engineering for reference.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="8202" LastEditDate="2016-06-25T10:14:03.943" LastActivityDate="2016-06-25T10:14:03.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14033" PostTypeId="1" CreationDate="2014-01-27T07:11:31.367" Score="1" ViewCount="126" Body="&lt;p&gt;Are all isotropic bandpass filter kernels, wavelets?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any properties that the radial frequency profile has to meet to be considered a wavelet?&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-01-27T07:44:26.450" Title="Are all isotropic bandpass filter kernels, wavelets?" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14034" PostTypeId="2" ParentId="14033" CreationDate="2014-01-27T07:44:26.450" Score="2" Body="&lt;p&gt;Certainly not. ,,Isotropic'' means that the impulse response is independent of direction, that is, that the filter is rotationally symmetric. Wavelets are orthogonal basis functions (filters, maybe) with certain properties. Not every orthogonal basis function will be isotropic, and not every isotropic filter is orthogonal. It is even hard to see how a isotropic filter may be a wavelet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look up ,,wavelet conditions'' to learn more about how this orthogonality has to be understood to build an invertible transform. &lt;a href=&quot;http://www-math.mit.edu/~gs/papers/Strang-PNAS-FN-Corr2.pdf&quot; rel=&quot;nofollow&quot;&gt;Banded Matrices with Banded Inverses&lt;/a&gt; might help the algebraically inclined.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-27T07:44:26.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14035" PostTypeId="1" CreationDate="2014-01-27T08:22:50.283" Score="1" ViewCount="2125" Body="&lt;p&gt;I am trying to learn this part but I dont seem to understand.&#xA;if I have a finite length sequence, and a n-point DFT of it (in an interval)... is it possible to evaluate expressions of the  n-point DFT without computing them explicitly? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the exercise is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; be finite-length sequence such that: &lt;span class=&quot;math-container&quot;&gt;$x[n] = \{2,1,1,0,3,2,0,3,4,6\}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;=n&amp;lt;=9$&lt;/span&gt;&#xA;    and &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; be the 10-point DFT of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$0\le k\le9$&lt;/span&gt;. evaluate the following without explicitly computing the DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I) \space  X[0]$$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$II) \space \sum_{k=0}^9 X[k]$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$III) \space \sum_{k=0}^9  |X[k]|^2 $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$IV) \space \sum_{k=0}^9 X[k]e^{-j \frac {(4\pi)}{5}k}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then it continues:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; denote N-point DFT of an N-point sequence &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is even). Two N/2-point sequence are defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$g[n] = a_1  x[2n] + a_2  x[2n+1]  \space where \space  0\le n\le(N/2)-1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$h[n] = a_3  x[2n] + a_4  x[2n+1]  \space where \space  0\le n\le(N/2)-1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;constant &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; satisfies: &lt;span class=&quot;math-container&quot;&gt;$a_1  a_4 \neq a_2  a_3$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let &lt;span class=&quot;math-container&quot;&gt;$G[k]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H[k]$&lt;/span&gt; denote the N/2-point DFT's of &lt;span class=&quot;math-container&quot;&gt;$g[n]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$h[n]$&lt;/span&gt; respectively.&#xA;Determine N-point DFT &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$G[k]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H[k]$&lt;/span&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any clues on the solution? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;any input is highly appreciated.&#xA;thank you&lt;/p&gt;&#xA;" OwnerUserId="7693" LastEditorUserId="7693" LastEditDate="2020-06-17T02:16:37.553" LastActivityDate="2020-06-17T02:16:37.553" Title="How to evaluate expressions without explicitly computing a DFT?" Tags="|fourier-transform|dft|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14036" PostTypeId="2" ParentId="14035" CreationDate="2014-01-27T09:17:24.060" Score="2" Body="&lt;p&gt;Parts of the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I) is the average value (DC coefficent) of the signal, 2.2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;III) is, by Parzeval's theorem, equal to the square sum of the signal, 80&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-27T09:17:24.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14038" PostTypeId="1" AcceptedAnswerId="14043" CreationDate="2014-01-27T14:24:06.080" Score="7" ViewCount="985" Body="&lt;p&gt;I am working on an 802.11a demod that works, for the most part, but has a bug that causes intermittent errors.  I haven't finished characterizing it, but it appears that the problem is  in my equalizer block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;802.11a is an OFDM signal, and each OFDM symbol has 64 sub-channels.  Four of those sub-channels are pilots (known data), at sub-channels 7, 21, -7, and -21.  I use the pilots to correct for any remaining carrier offset (shows up as a constant phase offset in the pilots) and timing offset (shows up as a liner offset- i.e. the phase offset is 0 at bin 0 and grows as it gets further from bin 0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do simple averaging to detect the carrier offset phase, and some simple manipulations before averaging to detect the time phase offset (e.g. multiply channel -21 by -1, multiply channel -7 by -3, and multiply channel 7 by 3).  I'm intentionally leaving out some unneeded details, but hopefully this gives the gist of what I'm doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that the circular nature of angles can cause the averaging to misbehave in catastrophic ways for certain values.  For instance, imagine imagine averaging $-\frac{4}{5}\pi$ and $\frac{4}{5}\pi$.  It's easy to see graphically that the answer should be either $-\pi$ or $\pi$, but the standard averaging formula gives the answer of 0, literally the opposite of the correct answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q6TU9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the proper way to average angles?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;I'll try and make what I'm doing a little clearer.  There are two &quot;error conditions&quot; that manifest themselves differently at the output of the FFT.  First is carrier offset, which manifests itself as a constant phase offset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3kNUv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this case averaging the cartesian pilot values rather than the angle, as John suggested, is a good idea.  Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second error condition is timing offset, which manifests as a linear phase offset.  The greater the time offset, the larger the slope of the phase offset.  The slope can also be negative, depending on whether the receiver is ahead or behind where it should be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vyvu0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since it is strictly linear (the origin passes through zero), I could theoretically calculate the slope from just one pilot.  I would first calculate the carrier offset phase offset (i.e. error condition #1), subtract that out, and then use any of the four to calculate the slope.  That would avoid averaging altogether.  The problem is that noise can make these values jump around, so my estimate is much better if I use all four- thus the averaging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully the picture above makes it clear that I can't just take the pilot values and average them as is- I have to modify them to make them a constant + noise.  I do this by multiplying the angle of the -21 pilot by -1, the -7 pilot by -3, the 7 pilot by 3, and the 21 pilot by 1.  They thus become equivalent to the 21 pilot and can be averaged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MMswm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know of a good way to multiply the angle of a vector by a constant like &quot;3&quot; in the cartesian system, so it looks to me like I would have to convert to polar coordinates, multiply the angles by -1, -3, 3, and 1 respectively, convert back to cartesian coordinates, average the pilots, then convert back to polar to get the phase offset.  While this is do-able, I would like to find a less klunky solution if possible.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2014-01-27T18:48:25.950" LastActivityDate="2014-01-30T21:24:04.983" Title="Angle Averaging" Tags="|demodulation|polar|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14040" PostTypeId="2" ParentId="14038" CreationDate="2014-01-27T15:35:12.027" Score="0" Body="&lt;p&gt;I would change the domain from $[-\pi:+\pi)$ to $[0:2\pi)$ and deal with everything modulo $2\pi$. Then you don't need to deal with negative angles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or as John mentioned, use complex numbers for everything up to where you need an actual angle.&lt;/p&gt;&#xA;" OwnerUserId="7509" LastActivityDate="2014-01-27T15:35:12.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14043" PostTypeId="2" ParentId="14038" CreationDate="2014-01-27T19:53:14.580" Score="5" Body="&lt;p&gt;As you pointed out in your edit, averaging the values isn't a great fit for this sort of problem. A simple alternative would be to simply fit a line to the four phase measurements using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Ordinary_least_squares&quot;&gt;linear least squares&lt;/a&gt; fit. That should perform better than the single-point approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possibly even-better solution would be to fit a sinusoid to the four complex samples instead. This prevents you from having to calculate their phase angles first, which could cause a degradation in performance at low SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, to accomplish your original goal of multiplying a complex number's phase by 3, you can do so by simply taking each number to the third power:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\arg(x^3) = 3 \arg(x)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This obviously will also affect the magnitude of each sample, but if you're only concerned about phase, you can typically work around that. By doing this, however, you're going to limit the range of timing offsets that your estimator will work over. Multiplying the phase of a complex number by 3 will introduce a $2\pi/3$ phase ambiguity in the output (i.e. you wouldn't be able to detect a shift in phase of $2\pi/3$). This is similar to the contant phase ambiguities that you often see in PSK synchronization systems (like a Costas loop).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-01-27T19:53:14.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14044" PostTypeId="2" ParentId="14038" CreationDate="2014-01-27T20:04:40.953" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://users.cecs.anu.edu.au/~williams/papers/P12.pdf&quot; rel=&quot;nofollow&quot;&gt;The usual way to approach directional is to move to a (complex) vector approach.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your observations are periodic with period $P$ then the mean of $N$ observations, $\hat\alpha(n)$ can be found as per equation (1) of the above link:&#xA;$$&#xA;\hat{\mu}_P = \frac{P}{2\pi} \left[ \arg \left ( \sum_{n=0}^{N-1} e^{j2\pi\hat\alpha(n)/P} \right) \right ]_{2\pi}&#xA;$$&#xA;which scales the $\hat\alpha$ to be periodic over $2\pi$, performs a unit vector complex sum, takes the argument (angle) of the complex sum, and finally rescales to in $[0,P)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar approach can be used to obtain a &quot;circular sample variance&quot;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-01-27T20:04:40.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14046" PostTypeId="2" ParentId="11277" CreationDate="2014-01-27T23:28:28.123" Score="0" Body="&lt;p&gt;Wavelet packet transform is not well suited for creating such a spectrogram. The spectrum of higher-order wavelet packets has several strong peaks (not just one), which explains why you are getting spurious results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/3/31/Daubechies12-packet-spectrum.png&quot; rel=&quot;nofollow&quot;&gt;http://upload.wikimedia.org/wikipedia/commons/3/31/Daubechies12-packet-spectrum.png&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-27T23:28:28.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14048" PostTypeId="1" AcceptedAnswerId="14115" CreationDate="2014-01-28T03:28:43.393" Score="3" ViewCount="765" Body="&lt;p&gt;I have read somewhere online that the log gabor filter has an advantage over the gabor filter, in the sense that it has 0 DC component. How do you prove this property mathematically? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7702" LastActivityDate="2014-02-06T08:22:27.220" Title="proving that a log gabor filter has 0 DC offset" Tags="|phase|local-features|gabor|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14049" PostTypeId="1" CreationDate="2014-01-28T05:50:01.443" Score="1" ViewCount="210" Body="&lt;p&gt;I want to implement an OFDM transceiver chip and my question is how to choose the clock frequency of the IFFT block? The number of output bits of the IFFT block? Also, how has the clock frequency and the number of output bits of the digital-to-analog converter (DAC) to be chosen?&lt;/p&gt;&#xA;" OwnerUserId="7703" LastEditorUserId="1606" LastEditDate="2014-01-28T09:46:31.347" LastActivityDate="2014-01-28T09:46:31.347" Title="Choosing clock frequency and number of bits of an OFDM transceiver" Tags="|ofdm|" AnswerCount="1" CommentCount="2" ClosedDate="2014-05-13T04:14:29.507" ContentLicense="CC BY-SA 3.0" />
  <row Id="14050" PostTypeId="1" CreationDate="2014-01-28T07:55:52.893" Score="0" ViewCount="298" Body="&lt;p&gt;How can i get lpc coefficient by htk?&#xA;I know that there is a binary code &quot;HCopy&quot; which is ganna help with that... but my question is how can i read a wav file in htk?&#xA;and i guess i need activeperl to run this? right?&#xA;i installed htk but do i need compilation for getting lpc coefficient?&#xA;I would appreciate if some one introduce me a pdf or step by step instructions for doing this...&#xA;Thanks a million :)  &lt;/p&gt;&#xA;" OwnerUserId="7070" LastActivityDate="2014-01-28T07:55:52.893" Title="Getting LPC coefficient by HTK" Tags="|lpc|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14051" PostTypeId="2" ParentId="14049" CreationDate="2014-01-28T09:45:12.750" Score="1" Body="&lt;p&gt;The clock frequency $f_\mathrm{s}$ of the digital-to-analog converter (DAC) ultimately depends on the desired bitrate $R$ and some other parameters like guard interval length and number of bits per subcarrier. You can find the detailed formulas in a &lt;a href=&quot;https://dsp.stackexchange.com/questions/7533/&quot;&gt;related question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The speed of the IFFT block depends on $f_\mathrm{s}$ and the number of subcarriers $N_\mathrm{SC}$. It has to transfrom $f_\mathrm{S}/N_\mathrm{SC}$ sets of values each set consisting of $N_\mathrm{SC}$ complex numbers. What clock frequencies are involved in such an IFFT block depends on implementation details (mainly degree of parallelization) and cannot be answered in general.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-01-28T09:45:12.750" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14052" PostTypeId="1" AcceptedAnswerId="14057" CreationDate="2014-01-28T09:55:41.260" Score="3" ViewCount="1610" Body="&lt;p&gt;I'm going to train a HOG detector for detect objects (pedestrian head) with SVMLight library. But my question is not about implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering how to collect samples. I have to use some videos, and they have 1624x1234px dimension. The pedestrian heads have more or less 20x20px bounding-boxes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the 20x20 pixels too small for a correct HOG feature extraction? Or is suitable for training? The, it has to be power of 2 so.. 36 pixels?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what about the detection? Can I scale down the videos? As far as I know the detection is done on the training sample and then maybe scaled down. So if I train the detector with 20x20px I can detect objects of 20x20 as minimum, then if I scale down the image as half of the size I can detect object 40x40, but not 10x10 (I should scale up but the noise will be a problem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then, what about the computation time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hint will be appreciated..&lt;/p&gt;&#xA;" OwnerUserId="1063" LastEditorUserId="53" LastEditDate="2014-01-28T15:55:56.080" LastActivityDate="2014-02-01T15:58:56.000" Title="Minimum size for positive samples for HOG (Histogram of Gradient) detector training" Tags="|image-processing|computer-vision|object-recognition|detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14056" PostTypeId="1" CreationDate="2014-01-28T14:51:54.470" Score="0" ViewCount="767" Body="&lt;p&gt;The well-known relationships for zero-mean circularly-symmetric complex Gaussian $z = a + jb = |z| \exp(j\varphi)$ signals are&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the amplitudes $|z| = \sqrt{a^2 + b^2}$ are Rayleigh-distributed&lt;/li&gt;&#xA;&lt;li&gt;the phases $\varphi = \arg(z)$ are uniformly distributed&lt;/li&gt;&#xA;&lt;li&gt;the pdf of such signals is fully described by their complex covariance matrix $\mathbf{\Sigma}$, which is Wishart-distributed in case it is estimated from a number of independent samples ($\rightarrow \mathbf{\hat{\Sigma}}$)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My question is two-fold: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) What's the distribution of $z$ in case the amplitudes are constant, e.g. all normalized to 1? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What's the distribution of $\mathbf{\hat{\Sigma}}$ in case the same normalization is applied, i.e. the amplitudes of its elements are removed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figure that it's then $z = \exp(j\varphi)$, with $\varphi \sim \mathcal{U}$, i.e. I am possibly looking for the distribution the exponential of a uniformly distributed variable follows. For $\mathbf{\Sigma}$, however, I have no idea.&lt;/p&gt;&#xA;" OwnerUserId="4689" LastEditorUserId="4689" LastEditDate="2014-01-28T16:51:45.740" LastActivityDate="2014-01-28T16:51:45.740" Title="Constant amplitude, uniform phase - what's the distribution of the complex signal then?" Tags="|statistics|gaussian|covariance|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14057" PostTypeId="2" ParentId="14052" CreationDate="2014-01-28T14:59:29.790" Score="1" Body="&lt;p&gt;Ideally, your training size should be a multiple of the HOG cell size.  So if your cell is 8x8 your training size should be 16x16 or 24x24.  And no, you cannot detect objects that are smaller than your training size.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2014-01-28T15:41:30.277" LastActivityDate="2014-01-28T15:41:30.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14058" PostTypeId="1" AcceptedAnswerId="14084" CreationDate="2014-01-28T17:16:08.150" Score="0" ViewCount="1257" Body="&lt;p&gt;&lt;strong&gt;Main Problem: How can you inverse Wavelet Transforms&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;(Using the data given by &lt;code&gt;signal.scipy.cwt&lt;/code&gt;)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was wondering if anyone understands the &lt;code&gt;scipy.signal.cwt()&lt;/code&gt; function well enough to use it to remove backgrounds and noise from data.&#xA;I have seen where Matlab has an inverse continuous wavelet transform function which will return the original form of the data by inputting the wavelet transform, although you can filter out the slices you don't want.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/icwtlin.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MATALAB inverse cwt funciton&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since scipy doesn't appear to have the same function, I have been trying to figure out how to get the data back in the same form, while removing the noise and background.&#xA;How do I do this?&#xA;I noticed that the wavelet has negative values, when the original data is made of Gaussian-like feautures, so I tried squaring it, but this gives me values way to large and not quite right.&#xA;I tried reading about the transforms but everything is very complicated which was difficult to parse in order to figure out what I needed to do.&lt;/p&gt;&#xA;&lt;p&gt;Here is what I have been trying:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Compute the wavelet transform&#xA;# I can't figure out what the width is or does?&#xA;widths = range(1,11) &#xA;# Ricker is 2nd derivative of Gaussian&#xA;# (*close* to what *most* of the features are in my data)&#xA;# (They're actually Lorentzians and Breit-Wigner-Fano lines)&#xA;cwtmatr = signal.cwt(xy['y'], signal.ricker, widths)&#xA;&#xA;# Maybe we multiple by the original data? and square?&#xA;WT_to_original_data = (xy['y'] * cwtmatr)**2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And here is a fully compilable short script to show you the type of data I am trying to get and what I have etc.:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy import signal&#xA;import matplotlib.pyplot as plt&#xA;&#xA;# Make some random data with peaks and noise&#xA;def make_peaks(x):&#xA;    bkg_peaks = np.array(np.zeros(len(x)))&#xA;    desired_peaks = np.array(np.zeros(len(x)))&#xA;    # Make peaks which contain the data desired&#xA;    # (Mid range/frequency peaks)&#xA;    for i in range(0,10):&#xA;        center = x[-1] * np.random.random() - x[0]&#xA;        amp = 60 * np.random.random() + 10&#xA;        width = 10 * np.random.random() + 5&#xA;        desired_peaks += amp * np.e**(-(x-center)**2/(2*width**2))&#xA;    # Also make background peaks (not desired)&#xA;    for i in range(0,3):&#xA;        center = x[-1] * np.random.random() - x[0]&#xA;        amp = 40 * np.random.random() + 10&#xA;        width = 100 * np.random.random() + 100&#xA;        bkg_peaks += amp * np.e**(-(x-center)**2/(2*width**2))&#xA;    return bkg_peaks, desired_peaks&#xA;&#xA;x = np.array(range(0, 1000))&#xA;bkg_peaks, desired_peaks = make_peaks(x)&#xA;y_noise = np.random.normal(loc=30, scale=10, size=len(x))&#xA;y = bkg_peaks + desired_peaks + y_noise&#xA;xy = np.array( zip(x,y), dtype=[('x',float), ('y',float)])&#xA;&#xA;# Compute the wavelet transform&#xA;# I can't figure out what the width is or does?&#xA;widths = range(1,11) &#xA;# Ricker is 2nd derivative of Gaussian&#xA;# (*close* to what *most* of the features are in my data)&#xA;# (They're actually Lorentzians and Breit-Wigner-Fano lines)&#xA;cwtmatr = signal.cwt(xy['y'], signal.ricker, widths)&#xA;&#xA;# Maybe we multiple by the original data? and square?&#xA;WT = (xy['y'] * cwtmatr)**2&#xA;&#xA;&#xA;# plot the data and results&#xA;fig = plt.figure()&#xA;ax_raw_data = fig.add_subplot(4,3,1)&#xA;ax = {}&#xA;for i in range(0, 11):&#xA;    ax[i] = fig.add_subplot(4,3, i+2)&#xA;&#xA;ax_desired_transformed_data = fig.add_subplot(4,3,12)&#xA;&#xA;ax_raw_data.plot(xy['x'], xy['y'], 'g-')  &#xA;for i in range(0,10):&#xA;    ax[i].plot(xy['x'], WT[i])&#xA;&#xA;ax_desired_transformed_data.plot(xy['x'], desired_peaks, 'k-')&#xA;&#xA;fig.tight_layout()&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This script will output this image:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HLVXu.jpg&quot; alt=&quot;output&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where the first plot is the raw data, the middle plots are the wavelet transforms and the last plot is what I want to get out as the processed (background and noise removed) data.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone have any suggestions? Thank you so much for the help.&lt;/p&gt;&#xA;" OwnerUserId="4385" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2017-08-11T18:02:43.283" Title="Inverse of Wavelet Transforms - Background and Noise Removal" Tags="|noise|wavelet|python|background-subtraction|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14060" PostTypeId="1" CreationDate="2014-01-28T22:31:50.413" Score="4" ViewCount="3108" Body="&lt;p&gt;What are the methods through which we can quantify the randomness or complexity in a given signal. I know spectral flatness measure (geometric to arithmetic means) is one way to do it, but what are other common techniques?&lt;/p&gt;&#xA;" OwnerUserId="7713" LastActivityDate="2023-10-28T02:33:14.647" Title="Methods to quantify randomness (or complexity) in a signal" Tags="|matlab|local-features|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14064" PostTypeId="1" AcceptedAnswerId="14072" CreationDate="2014-01-29T05:19:38.290" Score="-1" ViewCount="77" Body="&lt;p&gt;When looking for a sparse solution to $\ Az = y $, under what condition(s) does the nullspace $\ N(A)$ of a matrix $\ A$ not contain any $\ 2s$-sparse vector other than the zero vector, i.e $\ N(A) \cap   \{z \in \mathbb{R}^N: \|z\|_0 \le 2s\} = \{0\} $&lt;/p&gt;&#xA;" OwnerUserId="4038" LastActivityDate="2014-01-29T14:07:45.150" Title="recovery of sparse vectors" Tags="|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14066" PostTypeId="2" ParentId="6301" CreationDate="2014-01-29T07:02:00.510" Score="0" Body="&lt;p&gt;This will get you close to a closed form solution...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weight at each vector is:&#xA;$$\frac{(1-L)L^t}{1-L^T}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$L$ is your smoothing constant; $(1-L)$ is often referred to as alpha&lt;/li&gt;&#xA;&lt;li&gt;$t$ is your time vector&lt;/li&gt;&#xA;&lt;li&gt;$T$ your last $t+1$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This doesn't exist anywhere else on the internet, so I had to invent it. It may therefore result in slightly different weights, but it works.&lt;/p&gt;&#xA;" OwnerUserId="7718" LastEditorUserId="1273" LastEditDate="2014-01-29T20:24:44.483" LastActivityDate="2014-01-29T20:24:44.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14067" PostTypeId="1" CreationDate="2014-01-29T09:10:28.170" Score="6" ViewCount="19494" Body="&lt;p&gt;When designing digital filters we start off with FIR and IIR. Later on we talk about window functions e.g Kaiser and Hamming windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand why we need so many type of window functions described by rather complex mathematical equations and how they relate to FIR and IIR. &lt;/p&gt;&#xA;" OwnerUserId="4464" LastEditorUserId="13320" LastEditDate="2016-11-21T13:18:41.963" LastActivityDate="2021-04-17T19:14:09.993" Title="What is a window function in DSP and why do we need it?" Tags="|filters|filter-design|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14068" PostTypeId="2" ParentId="14067" CreationDate="2014-01-29T09:33:39.017" Score="0" Body="&lt;p&gt;Basically, window functions are used to limit a signal in Time (to make it shorter), or to improve artifacts of the Fourier transform. The first function is easy to understand. The second explains why there are so many and in what way they differ. Depending on what details of the signal you are interested, you might choose a specific window function.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-29T09:33:39.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14069" PostTypeId="1" CreationDate="2014-01-29T12:28:33.280" Score="2" ViewCount="375" Body="&lt;p&gt;i have to do super resolution of two low resolution images to obtain a high resolution image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1st image is taken as base image and the second image is registered with respect to it . i used SURF algorithm for image registration . A Delaunay triangulation is constructed over the points using a built-in MATLAB delaunay function . The HR grid of size is constructed for a prespecified resolution enhancement factor R Then HR algorithm for interpolating the pixel values on the HR grid is summarized next.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HR Algorithm Steps: 1. Construct the Delaunay triangulation over the set of scattered vertices in the irregularly sampled raster formed from the LR frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Estimate the gradient vector at each vertex of the triangulation by calculating the unit normal vector of neighbouring vector using cross product method.Sum of the unit normal vector of each triangle multiplied by its area is divided by summation of area of all neighbouring triangles to get the vertex normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approximate each triangle patch in the triangulation by a continuous and, possibly, a continuously differentiable surface, subject to some smoothness constraint. Bivariate polynomials or splines could be the approximants as explained below.&#xA;Set the resolution enhancement factor along the horizontal and vertical directions and then calculate the pixel value at each regularly spaced HR grid point to construct the initial HR image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now i have the results shown below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now for one kind of data set i get this result that has a few pixels black and wite in a random manner for the other type i get thin parallel lines all over image after super resolution the results are attached&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for first set random pixels appear on super resolution,for second set random pixels with parallel lines appear, these pixels appear on differnt pattern when i change transformation type from affine to projective in estimate geometric transform command, more over for other data sets there are deformation like parallel lines in edges.for some images it is quite well and does not give any deformation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any one can tell me the reason, i have figured out may be its demosaicing but i am not sure,because i dnt have much understanding of it , moreover can it be a bug in my code but it behaves different for different images, i have increased the size by super resolution twice.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0XmLF.jpg&quot; alt=&quot;superresolved image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OBLvE.jpg&quot; alt=&quot;first unregistered image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ScYEn.jpg&quot; alt=&quot;unregistered image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/dTHDr.jpg&quot; alt=&quot;second unregistered image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qvovL.jpg&quot; alt=&quot;unregistered image&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NwCQT.jpg&quot; alt=&quot;second unregistered image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7720" LastEditorUserId="7720" LastEditDate="2014-01-29T12:36:31.733" LastActivityDate="2016-03-03T19:00:58.567" Title="Artifacts in image after super resolution using delaunay triangulation in MATLAB" Tags="|image-processing|matlab|resolution|superresolution|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14070" PostTypeId="1" CreationDate="2014-01-29T12:29:32.363" Score="3" ViewCount="281" Body="&lt;p&gt;I have the following Spectrogram of a signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6rtLZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, in this signal, I know there is one point of interest (between 60-80) and between the the particular frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could, potentially smooth the signal and perform a simple &lt;code&gt;peakfinding&lt;/code&gt; algorithm to find the peak and then just extract the bin number where the bin has the highest frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm however looking for a different method where multiple calls, at different bins of the output, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wFQEq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here there are 4 calls or 4 significant components of this signal, that I need to extract and show in a plot (not a spectrogram). Ideally, in this spectrogram, the X-axis represents time, so, I would like to extract the signal so that it is possible to show where they are in time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea behind this, is to be able to count the number of calls (significant parts) of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen this being implemented through the idea of Principle component analysis, however, I do not want to go down this route, instead, would like to use a simple and more elegant solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please recommend an algorithm, or, some reading materials to where I might be able to implement such an algorithm to be able to count the number of calls?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-01-29T12:29:32.363" Title="Segment/Idenfication of signal from a spectrogram" Tags="|signal-analysis|signal-detection|stft|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14071" PostTypeId="2" ParentId="14067" CreationDate="2014-01-29T13:55:53.570" Score="5" Body="&lt;p&gt;First you need to understand that windows, such as the Kaiser or Hanning, are used to design FIR filters, not IIR. Windows are also used for spectral analysis, but I think you are only asking about them with regard to filter design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason there are so many types of windows is that each generates a slightly different frequency response and time domain response, as shown here.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/99MFM.png&quot; alt=&quot;32 Tap FIR Filter Example&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2014-01-29T13:55:53.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14072" PostTypeId="2" ParentId="14064" CreationDate="2014-01-29T14:07:45.150" Score="0" Body="&lt;p&gt;The simplest answer-  when every set of $2s$ columns of $A$ are linearly independent. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's not a practically useful answer, though, because it requires testing every set of $2s$ columns for independence.  Some other conditions to consider-  the null space property, the restricted isometry property, and conditions based on mutual coherence.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section 2 of the paper &lt;a href=&quot;http://rauhut.ins.uni-bonn.de/LinzRauhut.pdf&quot; rel=&quot;nofollow&quot;&gt;Compressive Sensing and Structured Random Matrices&lt;/a&gt; provides a good overview, although it is primarily focused on sparse recovery bel $\ell_1$ minimization.&lt;/p&gt;&#xA;" OwnerUserId="4202" LastActivityDate="2014-01-29T14:07:45.150" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14073" PostTypeId="1" AcceptedAnswerId="14074" CreationDate="2014-01-29T14:58:31.750" Score="1" ViewCount="188" Body="&lt;p&gt;Why do people sometimes write $H(e^{j\omega})$, some others use $H(\omega)$ and even others use $H(f)$ with $\omega=2\pi f$ to describe the frequency response of a filter or a spectrum? Is there any &quot;real&quot; difference in meaning or is it just convention?&lt;/p&gt;&#xA;" OwnerUserId="7723" LastActivityDate="2014-01-29T15:11:50.777" Title="Frequency Response Notation" Tags="|fourier-transform|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14074" PostTypeId="2" ParentId="14073" CreationDate="2014-01-29T15:11:50.777" Score="1" Body="&lt;p&gt;In nearly every field of mathematics or science you will find multiple notations that mean the same thing, sometimes from slightly different angles. This is one of those cases where there are multiple ways of notating the same concept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For discrete-time systems, there really isn't any difference in meaning between the definitions that you gave, especially between the first two ($H(e^{j\omega})$ and $H(\omega)$). The first is just a bit more explicit that the function $H$ refers to the (complex-valued) amplitude of the system's output when its input is a complex exponential with angular frequency $\omega$. This is a bit verbose, so often you'll see it trimmed to the latter representation. $H(f)$ is not typically used for discrete-time systems, as $f$ refers to a continuous-time frequency in Hertz; without a specified sampling frequency, there isn't a well-defined mapping between $f$ and $\omega$, the more natural frequency concept for discrete-time systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(f)$ is typically only specified for continuous-time systems, where it competes with the alternate notation $H(\omega$). In any mathematical expression where you use one of them, you can massage the expression to use the other, sometimes involving factors of $2\pi$ that need to be inserted in various places to make the math work out. As a general rule, in my experience, the $\omega$ form is used more commonly in control systems contexts, whereas communications engineers seem to prefer the $f$ form. However, as I said, there's really no functional difference between the two.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-01-29T15:11:50.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14075" PostTypeId="2" ParentId="14067" CreationDate="2014-01-29T16:06:26.843" Score="6" Body="&lt;p&gt;The FFT computes the coefficients for a periodic, ever repeating signal. In practical applications, signal segments are finite and not periodic. Just applying the FFT to a segment of a signal essentially wraps the end of the segment around to the start, generating a jump discontinuity. Such jumps result in an undesirable background artifacts in the FFT amplitudes. To make the wrap-around smooth, one can fade the signal to zero at both segment ends by multiplying it with a window function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal is essentially smooth, then even a simple linear fade to zero may not enough, since also kinks in the signal lead to some background artifacts in the amplitudes, however much smaller than those resulting from jumps. The choice of the windowing function is thus a balance between background artifact reduction and computational simplicity, and also of the length of the segment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional considerations are required for overlap-add schemes, where the shifted window functions have to add to one.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-29T16:06:26.843" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14077" PostTypeId="1" CreationDate="2014-01-29T17:35:46.267" Score="1" ViewCount="1252" Body="&lt;p&gt;&lt;em&gt;Fore-word :Kindly Observe this question has multiple updates take the latest update as question !&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;here below is my 256pt FFT on an 2Khz sinusoid signal,on a fixed point DSP tms320c5515&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zQymK.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;strong&gt;please ignore this this has occured due to programatic bug&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;is this above figure expected in the first place ?(with out windowing)&lt;/p&gt;&#xA;&lt;p&gt;after looking several resources i have came to a conclusion that using a hanning window is the best way to go before an STFT,but my question is how to window an input signal which is a signed data 16bit,&lt;/p&gt;&#xA;&lt;p&gt;i know generally we go for finding the hamming window vector in matlab for a 256bin and try to multiply that window&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tgkso.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;but when i did multiply my signal with a vector which i got from the matlab a 256pt hamming window which is having values from  0.08 -0.99 ,still i have my spectral leakages persistent in the FFT results&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;float window[256]={&#xA;    0.0801396321, 0.0805584436, 0.0812561802, 0.0822324185, 0.0834865656, &#xA;    0.0850178601, 0.0868253726, 0.0889080056, 0.0912644947, 0.0938934094,&#xA;    0.0967931537, 0.099961967, 0.103397926, 0.107098944, 0.111062774,&#xA;    0.115287011, 0.119769089, 0.124506288, 0.129495732, 0.134734391,&#xA;    0.140219085, 0.145946484, 0.151913112, 0.158115346, 0.16454942, &#xA;    0.171211429, 0.178097329, 0.185202937, 0.192523942, 0.200055898,&#xA;    0.207794233, 0.215734248, 0.223871124, 0.232199921, 0.240715582,&#xA;    0.249412937, 0.258286707, 0.267331503, 0.276541836, 0.285912112,&#xA;    0.295436645, 0.305109651, 0.314925258, 0.324877507, 0.334960356,&#xA;    0.345167684, 0.355493294, 0.365930917, 0.376474217, 0.387116792,&#xA;    0.397852183, 0.40867387, 0.419575286, 0.43054981, 0.441590782,&#xA;    0.452691497, 0.463845217, 0.47504517, 0.486284557, 0.497556555,&#xA;    0.508854319, 0.520170992, 0.531499704, 0.542833575, 0.554165727,&#xA;    0.565489278, 0.576797356, 0.588083093, 0.59933964, 0.610560161,&#xA;    0.621737846, 0.632865908, 0.643937592, 0.654946175, 0.665884975,&#xA;    0.676747351, 0.687526708, 0.698216503, 0.708810244, 0.719301502,&#xA;    0.729683906, 0.739951154, 0.750097012, 0.760115322, 0.77, 0.779745046,&#xA;    0.789344544, 0.798792666, 0.808083676, 0.817211933, 0.826171896,&#xA;    0.834958125, 0.843565286, 0.851988154, 0.860221615, 0.868260671,&#xA;    0.876100441, 0.883736166, 0.89116321, 0.898377064, 0.905373349,&#xA;    0.912147817, 0.918696356, 0.92501499, 0.931099882, 0.93694734,&#xA;    0.942553812, 0.947915896, 0.953030335, 0.957894025, 0.962504013,&#xA;    0.966857501, 0.970951846, 0.974784561, 0.97835332, 0.981655957,&#xA;    0.984690466, 0.987455005, 0.989947896, 0.992167626, 0.994112846,&#xA;    0.995782376, 0.997175203, 0.99829048, 0.999127531, 0.999685848,&#xA;    0.999965091, 0.999965091, 0.999685848, 0.999127531, 0.99829048,&#xA;    0.997175203, 0.995782376, 0.994112846, 0.992167626, 0.989947896,&#xA;    0.987455005, 0.984690466, 0.981655957, 0.97835332, 0.974784561,&#xA;    0.970951846, 0.966857501, 0.962504013, 0.957894025, 0.953030335,&#xA;    0.947915896, 0.942553812, 0.93694734, 0.931099882, 0.92501499,&#xA;    0.918696356, 0.912147817, 0.905373349, 0.898377064, 0.89116321,&#xA;    0.883736166, 0.876100441, 0.868260671, 0.860221615, 0.851988154,&#xA;    0.843565286, 0.834958125, 0.826171896, 0.817211933, 0.808083676,&#xA;    0.798792666, 0.789344544, 0.779745046, 0.77, 0.760115322, 0.750097012,&#xA;    0.739951154, 0.729683906, 0.719301502, 0.708810244, 0.698216503, &#xA;    0.687526708, 0.676747351, 0.665884975, 0.654946175, 0.643937592,&#xA;    0.632865908, 0.621737846, 0.610560161, 0.59933964, 0.588083093,&#xA;    0.576797356, 0.565489278, 0.554165727, 0.542833575, 0.531499704,&#xA;    0.520170992, 0.508854319, 0.497556555, 0.486284557, 0.47504517,&#xA;    0.463845217, 0.452691497, 0.441590782, 0.43054981, 0.419575286,&#xA;    0.40867387, 0.397852183, 0.387116792, 0.376474217, 0.365930917,&#xA;    0.355493294, 0.345167684, 0.334960356, 0.324877507, 0.314925258, &#xA;    0.305109651, 0.295436645, 0.285912112, 0.276541836, 0.267331503, &#xA;    0.258286707, 0.249412937, 0.240715582, 0.232199921, 0.223871124, &#xA;    0.215734248, 0.207794233, 0.200055898, 0.192523942, 0.185202937, &#xA;    0.178097329, 0.171211429, 0.16454942, 0.158115346, 0.151913112, &#xA;    0.145946484, 0.140219085, 0.134734391, 0.129495732, 0.124506288,&#xA;    0.119769089, 0.115287011, 0.111062774, 0.107098944, 0.103397926,&#xA;    0.099961967, 0.0967931537, 0.0938934094, 0.0912644947, 0.0889080056,&#xA;    0.0868253726, 0.0850178601, 0.0834865656, 0.0822324185, 0.0812561802,&#xA;    0.0805584436, 0.0801396321, 0.08}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;is my way of windowing correct or wrong ?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 1&lt;/strong&gt;  : &lt;em&gt;Results with out windowing&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;of updated screen shots of input tone and windowed and FFT:&lt;/p&gt;&#xA;&lt;p&gt;with suggestions of more explanations requirement i have tried to give a standard 440Hz tone with sampling freq 8000, which is 16bitPCM format, the tone is windowed and then fft was done&lt;/p&gt;&#xA;&lt;p&gt;with out windowing&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tDhrL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;ater applying my window looking like&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LGAhz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;after windowing with the above window it has turned the sinusoidal to sqaure(expected ? !)&#xA;which further given rise to more worse FFT why so ?&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WqFnS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2&lt;/strong&gt; :&lt;em&gt;Update 1 has bug with the program where i was trying to do FFT with a wrong window array&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here below is the input the effect of windowing and the FFT result,there no problem with the window i have mentioned in the question,i have generated it from matlab and used it as array,&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C1uC5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;now is the response and every thing OK ! ?  i feel its correct,a peak at 14th bin (~430Hz) and 256-14(~7560Hz) now i have to go for the magnitude plotting urgently to get the power of each bin&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 3&lt;/strong&gt; :&lt;em&gt;Magnitude Plot Updated&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9aRHP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now the convnetional problem why two peaks,how to remove the other negative frequency peak can i nullify greater than (fs/2)? people do this by shifting how can i shift the (256-14)7560Hz componed to it left un existing side -14Hz ,How ?&lt;/p&gt;&#xA;&lt;p&gt;are there any other things i do need to do further improvisation to this FFT ? to further make it better&lt;/p&gt;&#xA;&lt;p&gt;and also i am seeing a secondary peak next to my desired peak sometimes(not shown in the pic )why so ?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 4&lt;/strong&gt; : &lt;em&gt;Update is Regarding the new window usage,effects after overlapped frames are used,also zeropadding&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;With the suggestion from other forums,when people said a zero padding decreases the multiple peaks in the magnitude plot and also a overlapped frames will help&lt;/p&gt;&#xA;&lt;p&gt;so i have changed my strategy to do a&#xA;512pt FFT&#xA;Frame size 20ms ie., 160 samples(8000 sampling rate)&#xA;50 % overlap which makes it to 320 samples rest i have done zero padding&lt;/p&gt;&#xA;&lt;p&gt;and i also have updated the window to symmetric 4-term Blackman-harris Window which is said to give peaks of dominant frequency and suppress the rest&lt;/p&gt;&#xA;&lt;p&gt;below figure show the updated results,and magnitude plot resulting in a valley also,which is not desired&lt;/p&gt;&#xA;&lt;p&gt;But on the other side i have Opensource KissFFT algo which is doing same thing which gives a superb response to the same input&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sDV1t.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;output of KissFFT(Open Source Implementation)-which is also trying to take a 160ms frame and do the FFT of 512pt with 50% frame overlap&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AzyEf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;why so ? whats wrong with my approach what am i missing ?&#xA;Is this any bug with my hardware FFT algorithm when compared to Cooley-Tukey Algo ? My hardware uses a Radix-2 approach&lt;/p&gt;&#xA;&lt;p&gt;i really need some inputs to make my fft more strengthened&lt;/p&gt;&#xA;&lt;p&gt;Very thanks for the answers up to now !&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-01-31T15:09:49.717" Title="FFT - Effects of Windowing,Improvisation approaches on RealTime FFT Hardware" Tags="|fft|window-functions|dsp-core|zero-padding|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14078" PostTypeId="1" AcceptedAnswerId="14083" CreationDate="2014-01-29T17:36:18.313" Score="0" ViewCount="348" Body="&lt;p&gt;This is a follow up question to: &lt;a href=&quot;https://dsp.stackexchange.com/questions/14070/segment-idenfication-of-signal-from-a-spectrogram&quot;&gt;Segment/Idenfication of signal from a spectrogram&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main goal is to identify (segment) all of the calls from a given signal. The signal looks like the following (Spectrogram):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fDsyY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how there are 4 calls within this signal, I would like to identify there are 4 calls and just capture these calls so I can then use this for later analysis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have carried out the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Computed an STFT (Spectrogram on the time-signal) of a series of bat calls. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The spectrogram shows where each of the calls are, by the high energy levels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am now calculating is the time variance between all of the different calls using the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T =  \sum_a^b x \sqrt{re*re+im*im}&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is calculated for each of the bins, the result is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mzRN9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I belive the &lt;code&gt;x axis&lt;/code&gt; relates to the time, and the &lt;code&gt;y axis is the total variance&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, it is clear where the most significant parts of the signal are, the 4 spikes indicate the parts that I need to extract, it's just how... I suppose I could use a threshold value, and state that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if variance &amp;gt; THRESHOLD:&#xA;   keep the block &#xA;else:&#xA;   place &quot;0&quot; in each of the elements &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, how would I calculate the threshold in order to the above? What if the next set of calls are different to the threshold set for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By doing the following (above) and, using a threshold value, I get the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cacNl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, can I calculate each of the frequencies (of the bird calls) based upon this? I.e. $$(binnumber * Fs) / NFFT$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;Fs&lt;/code&gt; is the frequency sample rate and NFFT is the size of each of the bins? &lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-01-29T20:07:47.487" Title="STFT Time Variance - Threshold" Tags="|signal-analysis|stft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14079" PostTypeId="1" CreationDate="2014-01-29T17:36:27.633" Score="-1" ViewCount="523" Body="&lt;p&gt;In (1), it's said that: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If two identical training symbols are transmitted consecutively, the corresponding signals with CFO of $\epsilon$ are related with each other as follows: $y_2[n]=y_1[n]\exp(j2\pi \epsilon)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How is this relation between $y_1[n]$ and $y_2[n]$ achieved? How is the exponential part associated with $y_1[n]$ obtained?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) &lt;a href=&quot;http://maxwellsci.com/print/rjaset/v6-2041-2044.pdf&quot; rel=&quot;nofollow&quot;&gt;Ishtiaq Akbar, A. Naveed Malik, &quot;Performance analysis of carrier frequency offset estimation techniques for OFDM systems&quot;, Research journal of Applied Sciences, Engineering and Technology 6(11): 2041-2044, 2013&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7644" LastEditorUserId="1606" LastEditDate="2014-02-03T16:22:13.030" LastActivityDate="2014-02-03T16:22:13.030" Title="Carrier frequency offset (CFO) estimation based on Symbols" Tags="|digital-communications|estimation|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14081" PostTypeId="2" ParentId="14038" CreationDate="2014-01-29T18:43:01.713" Score="0" Body="&lt;p&gt;Here is a quick hack I've used in the past to find an &quot;average angle&quot;.&#xA;It's a little clunky and uses more magic numbers than I would like,&#xA;but at least it's quick and efficient and doesn't have the catastrophic failure that simple arithmetic averaging gives.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// median_average: find the &quot;average angle&quot; from some set of angles.&#xA;// pick A and B &quot;well separated&quot; from each other and from 0 --&#xA;// perhaps A =~= 2pi/3 and B =~= 4pi/3&#xA;average0 = (average{ (angles .- 0) mod 2pi } + 0) mod 2pi&#xA;averageA = (average{ (angles .- A) mod 2pi } + A) mod 2pi&#xA;averageB = (average{ (angles .- B) mod 2pi } + B) mod 2pi&#xA;average = median ( average0, averageA, averageB )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I typically store angles in something like &lt;a href=&quot;http://en.wikibooks.org/wiki/Floating_Point/Fixed-Point_Numbers#brads&quot; rel=&quot;nofollow&quot;&gt;&quot;brad&quot;&lt;/a&gt; representation, so that the &quot;mod 2pi&quot; operation is a quick &quot;bitand MASK&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a proof that the median of 3 intermediate averages always gives the &quot;correct&quot; average for any 2 angles that are less than 2pi/3 apart; the median of 5 intermediate averages always gives the &quot;correct&quot; average for any 2 angles that are less than 4pi/5 apart, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever this &quot;median_average&quot; algorithm averages 2 angles together that are &quot;not too far apart&quot;, at most 1 of the 3 intermediate simple averages gives a catastrophically wrong value (at most 2 of the 5 intermediate averages).&#xA;(As you already mentioned, the &quot;average0&quot; value is completely wrong when trying to average 0.1 and 2pi-0.1).&#xA;Then the final median() throws out the &quot;wrong&quot; value (if there is one) and returns one of the 2 correct averages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Have you considered the possibility that the timing offset is so bad that the phase offset crosses the +pi line and &quot;wraps around&quot; to -pi ? Maybe you're lucky enough that that never happens in your system).&lt;/p&gt;&#xA;" OwnerUserId="484" LastActivityDate="2014-01-29T18:43:01.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14082" PostTypeId="2" ParentId="14077" CreationDate="2014-01-29T18:49:12.750" Score="0" Body="&lt;p&gt;First your formula does not appear to be correct. The Hamming window (not to be confused with the von Hann or occasionaly ,,Hanning'' window, which your formula seems to represent) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ w(n) = 0{,}54 + 0{,}46 \cdot \cos\left(\frac{2\pi n}{M}\right), \; n = -\frac{M}{2}, \ldots, \frac{M}{2}-1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is somewhat close to the vector you give. But that does not explain why you are not satisfied with the results. Actually, different windows often behave similarly enough that you do not easily see the difference. You should have the peak of the window at $1$, even in fixed point representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say you want to detect a certain peak, which does not seem to be represented well in the diagram. You said you got the figure not using a window. In that case either your signal is rather curious (not a sinusoid at all) or something is wrong in your calculation. A sinusoid would be expected to transform into a $\operatorname{sinc}$. Your transformed looks somewhat different. There appear to be two peaks equally strong and some signal inbetween. That is certainly not what is expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you try transforming a simple pulse (a $1$ surrounded by $0$s). It should come out as a simple exponential $y_k=e^{(ck+d)j\omega}$ for some $c$ and $d$, i.e. it should have magnitude $1$ everywhere.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-29T18:49:12.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14083" PostTypeId="2" ParentId="14078" CreationDate="2014-01-29T18:59:22.097" Score="0" Body="&lt;p&gt;You could use a factor $0&amp;lt;c&amp;lt;1$ of the average of the variances &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathrm{THRESHOLD}=c\cdot{\operatorname{avg}(\operatorname{var}(X))}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the ,,calls'' (I suppose you're referring to birds) start sharply but fade out gradually, you could extend every period a little in the front and a little more in the end.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastEditorUserId="7358" LastEditDate="2014-01-29T20:07:47.487" LastActivityDate="2014-01-29T20:07:47.487" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14084" PostTypeId="2" ParentId="14058" CreationDate="2014-01-29T19:04:53.997" Score="0" Body="&lt;p&gt;I ended up finding a package which provides an inverse wavelet transform function called &lt;code&gt;mlpy&lt;/code&gt;.  The function is &lt;code&gt;mlpy.wavelet.uwt&lt;/code&gt;.  This is the snippet which may interest people if they are trying to do noise or background removal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Make 2**n amount of data&#xA;new_y, bool_y = wave.pad(xy['y'])&#xA;orig_mask = np.where(bool_y==True)&#xA;&#xA;# wavelet transform parameters&#xA;levels = 8&#xA;wf = 'h'&#xA;k = 2&#xA;&#xA;# Remove Noise first&#xA;# Wave transform&#xA;wt = wave.uwt(new_y, wf, k, levels)&#xA;# Matrix of the difference between each wavelet level and the original data&#xA;diff_array = np.array([(wave.iuwt(wt[i:i+1], wf, k)-new_y) for i in range(len(wt))])&#xA;# Index of the level which is most similar to original data (to obtain smoothed data)&#xA;indx = np.argmin(np.sum(diff_array**2, axis=1))&#xA;# Use the wavelet levels around this region&#xA;noise_wt = wt[indx:indx+1]&#xA;# smoothed data in 2^n length&#xA;new_y = wave.iuwt(noise_wt, wf, k)&#xA;&#xA;# Background Removal&#xA;error = 10000&#xA;errdiff = 100&#xA;i = -1&#xA;iter_y_dict = {0:np.copy(new_y)}&#xA;bkg_approx_dict = {0:np.array([])}&#xA;while abs(errdiff)&amp;gt;=1*10**-24:&#xA;    i += 1&#xA;    # Wave transform&#xA;    wt = wave.uwt(iter_y_dict[i], wf, k, levels)&#xA;&#xA;    # Assume last slice is lowest frequency (background approximation)&#xA;    bkg_wt = wt[-3:-1]&#xA;    bkg_approx_dict[i] = wave.iuwt(bkg_wt, wf, k)&#xA;&#xA;    # Get the error&#xA;    errdiff = error - sum(iter_y_dict[i] - bkg_approx_dict[i])**2&#xA;    error = sum(iter_y_dict[i] - bkg_approx_dict[i])**2&#xA;&#xA;    # Make every peak higher than bkg_wt&#xA;    diff = (new_y - bkg_approx_dict[i])&#xA;    peak_idxs_to_remove = np.where(diff&amp;gt;0.)[0]&#xA;    iter_y_dict[i+1] = np.copy(new_y)&#xA;    iter_y_dict[i+1][peak_idxs_to_remove] = np.copy(bkg_approx_dict[i])[peak_idxs_to_remove]&#xA;&#xA;# new data without noise and background&#xA;new_y = new_y[orig_mask]&#xA;bkg_approx = bkg_approx_dict[len(bkg_approx_dict.keys())-1][orig_mask]&#xA;new_data = diff[orig_mask] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here a complete compilable script which can produce output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy import signal&#xA;import matplotlib.pyplot as plt&#xA;import mlpy.wavelet as wave&#xA;&#xA;# Make some random data with peaks and noise&#xA;############################################################&#xA;def gen_data():&#xA;    def make_peaks(x):&#xA;        bkg_peaks = np.array(np.zeros(len(x)))&#xA;        desired_peaks = np.array(np.zeros(len(x)))&#xA;        # Make peaks which contain the data desired&#xA;        # (Mid range/frequency peaks)&#xA;        for i in range(0,10):&#xA;            center = x[-1] * np.random.random() - x[0]&#xA;            amp = 100 * np.random.random() + 10&#xA;            width = 10 * np.random.random() + 5&#xA;            desired_peaks += amp * np.e**(-(x-center)**2/(2*width**2))&#xA;        # Also make background peaks (not desired)&#xA;        for i in range(0,3):&#xA;            center = x[-1] * np.random.random() - x[0]&#xA;            amp = 80 * np.random.random() + 10&#xA;            width = 100 * np.random.random() + 100&#xA;            bkg_peaks += amp * np.e**(-(x-center)**2/(2*width**2))&#xA;        return bkg_peaks, desired_peaks&#xA;&#xA;    # make x axis&#xA;    x = np.array(range(0, 1000))&#xA;    bkg_peaks, desired_peaks = make_peaks(x)&#xA;    avg_noise_level = 30&#xA;    std_dev_noise = 10&#xA;    size = len(x)&#xA;    scattering_noise_amp = 100&#xA;    scat_center = 100&#xA;    scat_width = 15&#xA;    scat_std_dev_noise = 100&#xA;    y_scattering_noise = np.random.normal(scattering_noise_amp, scat_std_dev_noise, size) * np.e**(-(x-scat_center)**2/(2*scat_width**2))&#xA;    y_noise = np.random.normal(avg_noise_level, std_dev_noise, size) + y_scattering_noise&#xA;    y = bkg_peaks + desired_peaks + y_noise&#xA;    xy = np.array( zip(x,y), dtype=[('x',float), ('y',float)])&#xA;    return xy&#xA;# Random data Generated&#xA;#############################################################&#xA;&#xA;xy = gen_data()&#xA;&#xA;# Make 2**n amount of data&#xA;new_y, bool_y = wave.pad(xy['y'])&#xA;orig_mask = np.where(bool_y==True)&#xA;&#xA;# wavelet transform parameters&#xA;levels = 8&#xA;wf = 'h'&#xA;k = 2&#xA;&#xA;# Remove Noise first&#xA;# Wave transform&#xA;wt = wave.uwt(new_y, wf, k, levels)&#xA;# Matrix of the difference between each wavelet level and the original data&#xA;diff_array = np.array([(wave.iuwt(wt[i:i+1], wf, k)-new_y) for i in range(len(wt))])&#xA;# Index of the level which is most similar to original data (to obtain smoothed data)&#xA;indx = np.argmin(np.sum(diff_array**2, axis=1))&#xA;# Use the wavelet levels around this region&#xA;noise_wt = wt[indx:indx+1]&#xA;# smoothed data in 2^n length&#xA;new_y = wave.iuwt(noise_wt, wf, k)&#xA;&#xA;# Background Removal&#xA;error = 10000&#xA;errdiff = 100&#xA;i = -1&#xA;iter_y_dict = {0:np.copy(new_y)}&#xA;bkg_approx_dict = {0:np.array([])}&#xA;while abs(errdiff)&amp;gt;=1*10**-24:&#xA;    i += 1&#xA;    # Wave transform&#xA;    wt = wave.uwt(iter_y_dict[i], wf, k, levels)&#xA;&#xA;    # Assume last slice is lowest frequency (background approximation)&#xA;    bkg_wt = wt[-3:-1]&#xA;    bkg_approx_dict[i] = wave.iuwt(bkg_wt, wf, k)&#xA;&#xA;    # Get the error&#xA;    errdiff = error - sum(iter_y_dict[i] - bkg_approx_dict[i])**2&#xA;    error = sum(iter_y_dict[i] - bkg_approx_dict[i])**2&#xA;&#xA;    # Make every peak higher than bkg_wt&#xA;    diff = (new_y - bkg_approx_dict[i])&#xA;    peak_idxs_to_remove = np.where(diff&amp;gt;0.)[0]&#xA;    iter_y_dict[i+1] = np.copy(new_y)&#xA;    iter_y_dict[i+1][peak_idxs_to_remove] = np.copy(bkg_approx_dict[i])[peak_idxs_to_remove]&#xA;&#xA;# new data without noise and background&#xA;new_y = new_y[orig_mask]&#xA;bkg_approx = bkg_approx_dict[len(bkg_approx_dict.keys())-1][orig_mask]&#xA;new_data = diff[orig_mask] &#xA;&#xA;##############################################################&#xA;# plot the data and results&#xA;fig = plt.figure()&#xA;&#xA;ax_raw_data = fig.add_subplot(121)&#xA;ax_WT = fig.add_subplot(122)&#xA;&#xA;ax_raw_data.plot(xy['x'], xy['y'], 'g')&#xA;for bkg in bkg_approx_dict.values():&#xA;    ax_raw_data.plot(xy['x'], bkg[orig_mask], 'k')&#xA;&#xA;ax_WT.plot(xy['x'], new_data, 'y')&#xA;&#xA;&#xA;fig.tight_layout()&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the output I am getting now:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/krkZH.jpg&quot; alt=&quot;Shifting Background Removal&quot;&gt;&#xA;As you can see, there is still a problem with the background removal (it shifts to the right after each iteration), but &lt;a href=&quot;https://dsp.stackexchange.com/questions/14086/shifting-of-shift-invariant-wavelet-transforms&quot;&gt;it is a different question which I will address here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4385" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-01-29T19:25:55.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14085" PostTypeId="1" AcceptedAnswerId="14301" CreationDate="2014-01-29T19:20:24.760" Score="5" ViewCount="3302" Body="&lt;p&gt;I'm trying to convert accelerometer data from accelerations to displacement,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that the initial velocity is zero and the initial position is also zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 500;&#xA;T = 1/Fs;&#xA;t = (0:length(y) -1)*T;&#xA;&#xA;vel = cumtrapz(t, acc);&#xA;disp = cumtrapz(t, vel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;here are the respective plots from acceleration to displacement,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xf912.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sShHt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DAiKw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented a kalman filter but the result is the same. I'm trying to work around with wavelet decomposition, any help would be very appreciated to resolve this problem.&lt;/p&gt;&#xA;" OwnerUserId="4940" LastEditorUserId="4940" LastEditDate="2014-02-05T13:21:33.413" LastActivityDate="2015-01-05T17:26:54.273" Title="Weird behaviour converting velocity to displacement" Tags="|time-frequency|integration|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14086" PostTypeId="1" CreationDate="2014-01-29T19:25:03.300" Score="3" ViewCount="726" Body="&lt;p&gt;&lt;strong&gt;Main Question: Why would iterative wavelet/inverse-wavelet transforms cause a shift along the x-axis for undecimated (shift-invariant) wavelet transforms?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am attempting to remove backgrounds from signals using an iterative wavelet transform method similar to this approach which I found in an article:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tglZY.jpg&quot; alt=&quot;Article description&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am receiving this output from my python program described below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/COyiv.jpg&quot; alt=&quot;shifting&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why the inverse wavelet is shifting every iteration to the right.  What could cause this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the script I am using to produce this output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;import mlpy.wavelet as wave&#xA;&#xA;# This fucntion should be fine &#xA;# Make some random data with peaks and noise&#xA;def gen_data():&#xA;    def make_peaks(x):&#xA;        bkg_peaks = np.array(np.zeros(len(x)))&#xA;        desired_peaks = np.array(np.zeros(len(x)))&#xA;        # Make peaks which contain the data desired&#xA;        # (Mid range/frequency peaks)&#xA;        for i in range(0,10):&#xA;            center = x[-1] * np.random.random() - x[0]&#xA;            amp = 100 * np.random.random() + 10&#xA;            width = 10 * np.random.random() + 5&#xA;            desired_peaks += amp * np.e**(-(x-center)**2/(2*width**2))&#xA;        # Also make background peaks (not desired)&#xA;        for i in range(0,3):&#xA;            center = x[-1] * np.random.random() - x[0]&#xA;            amp = 80 * np.random.random() + 10&#xA;            width = 100 * np.random.random() + 100&#xA;            bkg_peaks += amp * np.e**(-(x-center)**2/(2*width**2))&#xA;        return bkg_peaks, desired_peaks&#xA;&#xA;    # make x axis&#xA;    x = np.array(range(0, 1000))&#xA;    bkg_peaks, desired_peaks = make_peaks(x)&#xA;    avg_noise_level = 30&#xA;    std_dev_noise = 10&#xA;    size = len(x)&#xA;    scattering_noise_amp = 100&#xA;    scat_center = 100&#xA;    scat_width = 15&#xA;    scat_std_dev_noise = 100&#xA;    y_scattering_noise = np.random.normal(scattering_noise_amp, scat_std_dev_noise, size) * np.e**(-(x-scat_center)**2/(2*scat_width**2))&#xA;    y_noise = np.random.normal(avg_noise_level, std_dev_noise, size) + y_scattering_noise&#xA;    y = bkg_peaks + desired_peaks + y_noise&#xA;    xy = np.array( zip(x,y), dtype=[('x',float), ('y',float)])&#xA;    return xy&#xA;# Random data Generated&#xA;#############################################################&#xA;&#xA;&#xA;#############################################################&#xA;# Wavelet Transformations&#xA;#############################################################&#xA;&#xA;xy = gen_data()&#xA;&#xA;# Make 2**n amount of data&#xA;new_y, bool_y = wave.pad(xy['y'])&#xA;orig_mask = np.where(bool_y==True)&#xA;&#xA;# wavelet transform parameters&#xA;levels = 8&#xA;wf = 'h'&#xA;k = 2&#xA;&#xA;# Remove Noise first&#xA;# Wave transform&#xA;wt = wave.uwt(new_y, wf, k, levels)&#xA;# Matrix of the difference between each wavelet level and the original data&#xA;diff_array = np.array([(wave.iuwt(wt[i:i+1], wf, k)-new_y) for i in range(len(wt))])&#xA;# Index of the level which is most similar to original data (to obtain smoothed data)&#xA;indx = np.argmin(np.sum(diff_array**2, axis=1))&#xA;# Use the wavelet levels around this region&#xA;noise_wt = wt[indx:indx+1]&#xA;# smoothed data in 2^n length&#xA;new_y = wave.iuwt(noise_wt, wf, k)&#xA;&#xA;# Background Removal&#xA;error = 10000&#xA;errdiff = 100&#xA;i = -1&#xA;iter_y_dict = {0:np.copy(new_y)}&#xA;bkg_approx_dict = {0:np.array([])}&#xA;while abs(errdiff)&amp;gt;=1*10**-24:&#xA;    i += 1&#xA;    # Wave transform&#xA;    wt = wave.uwt(iter_y_dict[i], wf, k, levels)&#xA;&#xA;    # Assume last slice is lowest frequency (background approximation)&#xA;    bkg_wt = wt[-3:-1]&#xA;    bkg_approx_dict[i] = wave.iuwt(bkg_wt, wf, k)&#xA;&#xA;    # Get the error&#xA;    errdiff = error - sum(iter_y_dict[i] - bkg_approx_dict[i])**2&#xA;    error = sum(iter_y_dict[i] - bkg_approx_dict[i])**2&#xA;&#xA;    # Make every peak higher than bkg_wt&#xA;    diff = (new_y - bkg_approx_dict[i])&#xA;    peak_idxs_to_remove = np.where(diff&amp;gt;0.)[0]&#xA;    iter_y_dict[i+1] = np.copy(new_y)&#xA;    iter_y_dict[i+1][peak_idxs_to_remove] = np.copy(bkg_approx_dict[i])[peak_idxs_to_remove]&#xA;&#xA;# new data without noise and background&#xA;new_y = new_y[orig_mask]&#xA;bkg_approx = bkg_approx_dict[len(bkg_approx_dict.keys())-1][orig_mask]&#xA;new_data = diff[orig_mask] &#xA;&#xA;&#xA;#############################################################&#xA;# This part should be fine&#xA;# Plot the data and results&#xA;#############################################################&#xA;fig = plt.figure()&#xA;&#xA;ax_raw_data = fig.add_subplot(121)&#xA;ax_WT = fig.add_subplot(122)&#xA;&#xA;ax_raw_data.plot(xy['x'], xy['y'], 'g')&#xA;for bkg in bkg_approx_dict.values():&#xA;    ax_raw_data.plot(xy['x'], bkg[orig_mask], 'k')&#xA;&#xA;ax_WT.plot(xy['x'], new_data, 'y')&#xA;&#xA;&#xA;fig.tight_layout()&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4385" LastActivityDate="2014-01-29T19:25:03.300" Title="Shifting of Shift-Invariant Wavelet Transforms" Tags="|wavelet|python|transform|thresholding|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14088" PostTypeId="1" CreationDate="2014-01-29T20:53:48.357" Score="2" ViewCount="52" Body="&lt;p&gt;My $G(s)=1-e^{-s/\tau}$, $\tau$ is very small, say of order $10^{-4}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to compute a $H(z)$ (a digital filter) such that $H(z)$ has the inverse response of $G(s)$. Is ok even if $G(z)$ has the inverse response just for $f$&amp;lt;20k.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't not also zero and pole go $G(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm able to have an proximation of $H(z)$, but I found it with an iterative algorithm set $H(z)=\dfrac{\alpha}{1 -\beta z^{-1}}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I prefer a formal solution.&lt;/p&gt;&#xA;" OwnerUserId="7728" LastEditorUserId="6" LastEditDate="2014-01-29T21:24:28.077" LastActivityDate="2014-01-29T21:24:28.077" Title="How can I compute the inverse digital of a nonrational transfer function?" Tags="|transfer-function|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14089" PostTypeId="2" ParentId="14085" CreationDate="2014-01-30T01:32:39.337" Score="3" Body="&lt;p&gt;Double integration is very sensitive to any offset noise in acceleration measurement.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even a very tiny non-zero acceleration offset will, when double integrated and given enough time, send the calculated position outside the radius of the galaxy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some sort of position or location measurements, with respect to some fixed reference point, in addition to acceleration data, may be required to compensate for any offset and noise in the acceleration data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-01-30T06:16:29.330" LastActivityDate="2014-01-30T06:16:29.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14090" PostTypeId="2" ParentId="14085" CreationDate="2014-01-30T02:09:14.940" Score="11" Body="&lt;p&gt;You have two problems here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, as hotpaw2 mentioned, double integration is sensitive to any non-zero bias in your accelerometer, which will certainly be present if you are using a MEMS accelerometer. Suppose you have a bias of $b$; then, your position at time $t$ is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p(t) = \int_0^t \int_0^{t^\prime} b \ dt^{\prime\prime} \  dt^\prime = \frac{b}{2} t^2$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your position is growing quadratically with time.  Not good!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem will be the measurement noise that is riding on your signal.  Double integration of this noise signal will behave like a second-order random walk and will also cause your position to diverge over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A common approach to this sort of problem is to use a &lt;a href=&quot;https://en.wikipedia.org/wiki/Kalman_filter&quot;&gt;Kalman Filter&lt;/a&gt;.  Also, &lt;a href=&quot;http://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-696.pdf&quot;&gt;this&lt;/a&gt; is a good introduction to position estimation using accelerometers.&lt;/p&gt;&#xA;" OwnerUserId="4202" LastActivityDate="2014-01-30T02:09:14.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14091" PostTypeId="1" AcceptedAnswerId="14104" CreationDate="2014-01-30T02:51:26.070" Score="0" ViewCount="4617" Body="&lt;p&gt;My question is simple but I am new to MATLAB's sound functions so I am unsure what to do. I would like to read the audio (from the microphone) then apply the &lt;code&gt;fft(X,n)&lt;/code&gt; function to it where the &lt;code&gt;n&lt;/code&gt; should be 256. I was applied the fft function to &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/audiorecorder.html&quot; rel=&quot;nofollow&quot; &gt;this code&lt;/a&gt; like &lt;code&gt;fft(myRecording,256)&lt;/code&gt; but I kept getting zeros.&lt;/p&gt;&#xA;" OwnerUserId="7731" LastActivityDate="2014-03-15T15:38:58.773" Title="Get sound from matlab and convert with FFT" Tags="|matlab|fft|audio|" AnswerCount="1" CommentCount="0" ClosedDate="2014-02-15T22:01:31.677" ContentLicense="CC BY-SA 3.0" />
  <row Id="14093" PostTypeId="1" CreationDate="2014-01-30T04:25:06.533" Score="2" ViewCount="313" Body="&lt;p&gt;I have a beam fixed at one end and free at the other. It obviously results in vibrations due to the disturbances in the environment or when induced. This system can be represented using a differential equation. The vibrations are sensed using sensors, analyzed and reduced. Now, the sensing is done through compressed sensing technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is it possible to find the optimal sensor placement (minimal number of sensors along with the details of its spatial position) just with the help of the measurement matrix (that we design in compressed sensing for reconstruction purpose)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we want to retrieve $\mathbf x$ (vibrational info) from: $\mathbf{y= Cx}$, where $\mathbf C$ is the fat matrix (measurement matrix * sparse matrix). I want to find a relationship that the measurement matrix can hold with the placement of sensors. It's like an inverse problem, instead of designing a measurement matrix with respect to the sensors placed, I want to place the sensors with the knowledge I have about the measurement matrix.&lt;/p&gt;&#xA;" OwnerUserId="7733" LastEditorUserId="128" LastEditDate="2019-06-03T04:27:32.867" LastActivityDate="2019-06-03T04:27:32.867" Title="Compressed / Compressive Sensing - Sensor Placement" Tags="|compression|sensor|compressive-sensing|" AnswerCount="2" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="14094" PostTypeId="2" ParentId="14077" CreationDate="2014-01-30T07:16:44.140" Score="1" Body="&lt;p&gt;In the classic windows paper by &lt;a href=&quot;http://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow&quot;&gt;Harris&lt;/a&gt;, he mentions that the Hamming window can be thought of as a modified Hanning (or Hann) window.  Although the equation shown in your post is for a Hanning window (same as equation 27b, p. 60 in the Harris paper), you mention both 'Hanning' and 'Hamming' in your post, so I'm not sure which one you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, your window points are not correct.  For an even N, the w[0] and w[N/2] points should be unique, and the rest of the points should exhibit symmetry.  For example, the 256 point Hanning is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;double w[ ] = {&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0,      //w[0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.000150591,    //w&lt;a href=&quot;http://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.000602272,    //w[2]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.00135477, //w[3]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.999398,   //w[126]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.999849,   //w[127]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.,     //w[128]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.999849,   //w[129]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.999398,   //w[130]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.00240764, //w[252]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.00135477, //w[253]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.000602272,    //w[254]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.000150591  }; //w[255]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the w[0] and w[N/2] points are unique; the w[N/2] point is '1', and the rest of the points display the proper symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are variants of the Hamming (eg: exact Hamming), but the one often referred to as Hamming uses a particular coefficient (alpha = 25/46, or approximately .54, as mentioned in the Harris paper).  The calculation results in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;double w[ ] = {&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.08,       //w[0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.0801385,  //w&lt;a href=&quot;http://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.0805541,  //w[2]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.0812464,  //w[3]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.999446,   //w[126]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.999861,   //w[127]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.,     //w[128]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.999861,   //w[129]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.999446,   //w[130]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.082215,   //w[252]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.0812464,  //w[253]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.0805541,  //w[254]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.0801385  };   //w[255]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once again, the w[0] and w[N/2] points are unique, the w[N/2] point is '1', and the points display the proper symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, the window points you show look like a reversed Hamming window for an odd N (the .08 is shown last, and your N/2 point is not '1', so you don't have the proper symmetry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at your re-edited 440 hz graphs, your input seems good, but your 'after windowing' graph is definitely a problem.  It seems to be just a clipped version of the input.  Most window deemphasize the beginning and ending parts of the input data, so that the data has more of a bulging shape - the beginning and ending data are near zero amplitude, and the middle of the data is near or at original height.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your results show quite a bit of noise, probably due to giving the FFT that clipped input waveform.  But your results also show something around the proper places (ie: sample rate/N gives you a frequency spacing of 31.25 hz, so a 440 hz tone should show up at the 440/31.25 = 14.08 hz point, which is very nearly bin 14, and also at the negative frequency bin 256-14).  But your results should be two sharp spikes, instead of the slightly smeared out data shown (this could also be due to the clipping).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, you should present your result as a magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your incorrect window points can certainly cause problems, but I can't say for sure if that is your only source of error. &lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2014-01-30T07:16:44.140" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14095" PostTypeId="2" ParentId="14093" CreationDate="2014-01-30T09:13:50.390" Score="0" Body="&lt;p&gt;Measurement matrix is generally a Gaussian iid matrix. It is used (afaik),or can be used for several applications of compressive sensing. If you want to aim for a better matrix, which eventually would give you a good reconstruction with less amount of measurements, I believe you should analyse your signal well and come up with a measurement matrix that is incoherent as possible with your signal. I can't directly tell you what kind of a matrix you'll need for your specific application but incoherency between measurement and sparsifying basis is a must, and can be approved for further efficiency. Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="7113" LastActivityDate="2014-01-30T09:13:50.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14096" PostTypeId="2" ParentId="14077" CreationDate="2014-01-30T09:14:10.370" Score="0" Body="&lt;p&gt;&quot;after windowing with the above window it has turned the sinusoidal to sqaure(expected ? !) which further given rise to more worse FFT why so ?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowing is point-wise multiplication, that is, you would multiply sample 1 with the first sample of the window, sample 2 with the second, and so on. You appear to ,,chain'' the window function and your signal ($f^\star{}(x)=\mathrm{window}(f(x))$), which is just the wrong thing to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently you resolved a problem in your transform. The new result certainly looks better: there is a clear peak, as would be expected.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-30T09:14:10.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14100" PostTypeId="2" ParentId="13833" CreationDate="2014-01-30T11:08:33.043" Score="4" Body="&lt;p&gt;You can also classify representations based on their level of abstraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Low-level representations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These representations start with &lt;strong&gt;pixel based representations&lt;/strong&gt;, in which pixel brightness or color is used directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are these representations not enough? In computer vision, we are interested in physical quantities of observed scenes, e.g. distance, albedo, etc., or in recognition of objects. Pixel based representations contain this information in a very indirect form. We should extract desirable invariant quantities from raw images, that is, to transform images to some different representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most direct way to obtain some useful operations on images is to represent them as mathematical objects. There are two common types of mathematical representations of images. They are &lt;strong&gt;functional representations&lt;/strong&gt; and &lt;strong&gt;stochastic models&lt;/strong&gt;. Functional representations can be used for applying spatial transformations (e.g. scaling, rotation, affine, or projective) and for changing the functional basis (Fourier and wavelet transforms, etc.). Stochastic models (e.g. Markov fields) are useful in extracting statistical properties of visual scenes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Intermediate representations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, it is difficult to achieve invariance w.r.t. complex factors of image changes within mathematical representations. Usually, it is easier to abstract from variable image content. E.g. instead of recovering true reflectance maps of visible surfaces, we can simply use borders of these surfaces as invariant descriptions of images. This leads to &lt;strong&gt;contour-level representations&lt;/strong&gt;. Contours can be extracted locally or globally. In the second case, images will be represented as regions. Contours can also be represented as connected chains or as separated edge points. In addition to some degree of invariance, these representations also help to reduce data dimensionality. That is, if images are 2D signals, then contours are 1D signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can further increase invariance and uniqueness of basic representation elements (pixels-&gt;contours-&gt;...). &lt;strong&gt;Structural representations&lt;/strong&gt; are the next step of this abstraction. Their basic elements are straight lines, corners, arcs, etc. Complex structural elements can also be constructed including different types of junctions and geometric figures. &lt;strong&gt;Vector graphics representations&lt;/strong&gt; belong to intermediate-level representations, but structural or contours image descriptions are derived from raw images in computer vision, while computer graphics is the reverse process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, such abstraction leads to great loss of data. In practice, &lt;strong&gt;feature points&lt;/strong&gt; are used more frequently. They are similar to structural elements (they can stand for corners, centers of blobs or line segments, etc.), but they are not necessarily constructed from contours, and more importantly they are augmented with local features making them more informative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Semantic (or knowledge-based) representations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Highest level of image representations are semantic representations, in which image regions are labeled with meaningful labels (words). You can also consider intermediate representations as a way to fill the semantic gap between pixel-level and semantic-level representations. Right now, this gap is far from being totally filled though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also two types of &lt;strong&gt;multi-level or hierarchical representations&lt;/strong&gt;. Computer vision system can analyze images on different levels of abstraction or resolution. Multi-resolution representations can be applied to image descriptions on any level of abstraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In should be noted that all these representations also have neurophysiologic analogues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also other types of representations (color and textural representations, specific representations for 3D images, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some random (and rather old) examples of usage of different representations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Functional representations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essannouni L., Ibn-Elhaj E., Aboutajdine D. Fast cross-spectral image registration using new robust correlation // J. of Real-Time Image Processing. 2006. V. 1. № 2. P. 123–129.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lan Z-D., Mohr R., Remagnino P. Robust matching by partial correlation // Proc. 6th British Machine Vision Conference. 1995. P. 651–660.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Goecke R., Asthana A., Pettersson N., Petersson L. Visual vehicle egomotion estimation using the Fourier-Mellin transform // IEEE Trans. Intelligent Vehicles Symposium. 2007. P. 450–455.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Stochastic models&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chan T.F., Shen J., and Vese L. Variational PDE models in image processing // Notice Amer. Math. Soc. 2003. V. 50. P. 14–26.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zhu S.C., Wu Y.N., Mumford D.B. Filters, random fields, and maximum entropy (FRAME): towards a unified theory for texture modeling // Int’l J. Computer Vision. 1998. V. 27. No. 2. P. 1–20.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Geman S., Geman D. Stochastic relaxation, Gibbs distributions and Bayesian restoration of images // IEEE Trans. PAMI. 1984. V. 6. P. 721–741.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shen, L., Bai, L.: A review on Gabor wavelets for face recognition // Pattern Analysis and Applications. 2006. V. 9. P. 273–292.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edges and contours&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Olson C.F., Huttenlocher D. Automated target recognition by matching oriented edge pixels // IEEE Trans. on Image processing. 1997. V. 6. No 1. P. 103–113.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Olson C.F. A probabilistic formulation for Hausdorff matching // Proc. IEEE Conf. on Computer Vision and Pattern Recognition. 1998. P. 150–156.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yang C.H.T., Lai S.H., Chang L.W. Hybrid image matching combining Hausdorff distance with normalized gradient matching // Pattern Recognition. 2007. V. 40. № 4. P. 1173–1181.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;** Structural representations **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parida L., Geiger D., and Hummel R.. Junctions: detection, classification, and reconstruction // IEEE Trans. Pattern Analysis and Machine Intelligence. 1998. V. 20. No. 7. P. 687-698.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noronha S., Nevatia R. Detection and modeling of buildings from multiple aerial images // IEEE Trans. PAMI. 2001. V. 23. No. 5. P. 501–518.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lutsiv V., Malyshev I., Potapov A. Hierarchical structural matching algorithms for registration of aerospace images // Proc. SPIE. 2003. V. 5238. P. 164–175.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Efrat A., Gotsman C. Subpixel image registration using circular fiducials // Int. J. Comp. Geom. and Appl. 1994. V. 4, No. 4. P. 403–422.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lagunovsky D. and Ablameyko S. Straight-line-primitive extraction in grey-scale object recognition // Pattern Recog. Letters. 1999. V. 20. P. 1005–1014.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Keypoints&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lowe D. Object recognition from local scale-invariant features // Proc. Int. Conf. on Computer Vision. 1999. P. 1150–1157.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Baumberg A. Reliable feature matching across widely separated views // Conf. on Computer Vision and Pattern Recognition. 2000. P. 774–781.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;// Right now, there are a lot of papers on this topic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Knowledge-based systems&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linying S., Sharp B., Chibelushi C. Knowledge-based image understanding: a rule-based production system for X-ray segmentation // Int. Conf. on Enterprise Information Systems (ICEIS). 2002. P. 530–533.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Liedtke C.-E., Buckner J., Grau O., Growe S., Tonjes R. AIDA: a system for the knowledge based interpretation of remote sensing data // 3d Airborne Remote Sensing Conference and Exhibition. 1997. V. 2. P. 313–320.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Growe S., Tonjes R. A knowledge based approach to automatic image registration // Proc. Int. Conf. on Image Processing. 1997. V. 3. P. 228–231.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Crevier D., Lepage R. Knowledge-based image understanding systems: a survey // Comp. Vision and Image Understanding. 1997. V. 67. № 2. P. 161–185.&lt;/p&gt;&#xA;" OwnerUserId="7706" LastEditorUserId="7706" LastEditDate="2014-01-30T11:25:15.490" LastActivityDate="2014-01-30T11:25:15.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14101" PostTypeId="2" ParentId="13240" CreationDate="2014-01-30T11:50:21.073" Score="2" Body="&lt;p&gt;What you are looking for is exactly Independent Component Analysis, (ICA). The setup for ICA is exactly, given a matrix $Y$, from $Y = AX$, find &lt;em&gt;both&lt;/em&gt; $A$ and $X$. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastActivityDate="2014-01-30T11:50:21.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14102" PostTypeId="2" ParentId="13925" CreationDate="2014-01-30T11:51:10.860" Score="2" Body="&lt;p&gt;Boltzmann entropy shows uncertainty, with which a macrostate of a thermodynamic system describes its possible microstate. Except its application to thermodynamic systems (and multiplication by a physical constant), Boltzmann entropy (or more concretely, its generalization, namely, Gibbs entropy) is absolutely the same as Shannon entropy. They have similar forms and nearly the same meaning. As far as I remember, Shannon even took &quot;H&quot; for his entropy from Boltzmann's H-theorem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kolmogorov entropy... if you mean Kolmogorov-Sinai entropy than it's entropy of dynamic systems. It has the same nature as Boltzmann and Shannon entropy, but being applied to specific domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Kolmogorov complexity, which is also a measure of information quantity, is conceptually very different. While Shannon entropy is introduced based on knowledge of the stochastic model of the data source, Kolmogorov complexity doesn't suppose this knowledge meaning that one should account for the complexity of the model to get appropriate information measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Shannon theory, the notion of information is derived from the notion of probability. At the same time, in Kolmogorov theory, the opposite way is taken - the notion of probability is derived from the notion of information, which is introduced basing on universal Turing machine. This results in very deep methodological differences, e.g., for machine learning.&lt;/p&gt;&#xA;" OwnerUserId="7706" LastActivityDate="2014-01-30T11:51:10.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14104" PostTypeId="2" ParentId="14091" CreationDate="2014-01-30T12:56:22.127" Score="1" Body="&lt;p&gt;I use this function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function audio_recorder = MicFFT(Fs, update_rate)&#xA;&#xA;recObj = audiorecorder(Fs, 16, 2);&#xA;get(recObj);&#xA;&#xA;% Record your voice for time specified by update_rate.&#xA;&#xA;while 1 &#xA;    recordblocking(recObj, update_rate);&#xA;    myRecording = getaudiodata(recObj);&#xA;    subplot (2, 1, 1);&#xA;    plot (myRecording);&#xA;    xlabel('Time')&#xA;    ylabel('Amplitude')&#xA;    title('Time domain representation of y(t)')&#xA;&#xA;    L = length(myRecording);&#xA;    NFFT = 2^nextpow2(L); % Next power of 2 from length of myRecording&#xA;    Y = fft(myRecording,NFFT)/L;&#xA;    f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;    subplot (2, 1, 2); &#xA;    plot(f,2*abs(Y(1:NFFT/2+1))) &#xA;    drawnow; &#xA;    axis([0 Fs/2 0 0.01])&#xA;    title('Single-Sided Amplitude Spectrum of y(t)')&#xA;    xlabel('Frequency (Hz)')&#xA;    ylabel('|Y(f)|')&#xA;&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Fs is the sampling frequency whilst update_rate is the length of each recording&lt;/p&gt;&#xA;" OwnerUserId="7737" LastEditorUserId="7737" LastEditDate="2014-03-15T15:38:58.773" LastActivityDate="2014-03-15T15:38:58.773" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14105" PostTypeId="1" CreationDate="2014-01-30T13:50:43.700" Score="0" ViewCount="788" Body="&lt;p&gt;I would like to create a signal that is nearly uniform distributed (as depicted in Figure 1). It must consist of some single sine waves (e. g. 400 Hz, 430 Hz, 500 Hz) or a random band limited signal (e g. 495 to 500 Hz as depicted in Figure 2).&lt;/p&gt;&#xA;&lt;p&gt;I expiremented with some parameters but I didn't get a good result. Does anyone know an analytical mathematical description or a kind of &amp;quot;thumb rule&amp;quot; for creating such signals?&lt;/p&gt;&#xA;&lt;p&gt;Additionally I would prefer a signal that is as harmonic (in time domain) as possible (one single frequency would be the best - but of course not possible ;-) ). The signal is faded in and out with an raised cosine, because it's repeated periodically by a signal generator and I want to avoid steps in my signal.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NMaG8.png&quot; alt=&quot;uniformly distributed&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DfxXH.png&quot; alt=&quot;Time Plot, Spectral Plot and Histogram Plot of an band limited signal&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;To answer the &amp;quot;why&amp;quot; question:&#xA;I have an nonlinear system which I want to correct by avaraging (see picture 3). Usually I would get the red point which differs from the linear &amp;quot;true&amp;quot; value represented by the blue dotted line. The magenta colored dots are createt by a sine-wave and the big blue dot is gained through the avaraging of those magenta dots. This works whith a sine-wave signal, but since a sine-wave is not uniform distributet it is not perfect and the big blue dot differs from the big green dot representing the true value.&lt;/p&gt;&#xA;&lt;p&gt;I tried to combine three sinusoids with different amplitudes. The result was not to bad but its a trial and error way. I would prefer an analytical way if there is any.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OW39n.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="5434" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-03-09T01:50:50.560" Title="How to create a band limited signal of sine waves that is nearly uniform distributed" Tags="|histogram|analytic-signal|signal-synthesis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14106" PostTypeId="2" ParentId="14105" CreationDate="2014-01-30T14:45:46.263" Score="2" Body="&lt;p&gt;This is a wierd thing you are trying to do. What i the purpose behind this signal generation? What particular application needs this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think of two ways, but maybe one is not correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Generate Uniform White noise, and then filter it to your desired bandwith of interest. But that will surely affect the probability distribution of the amplitudes and make it more laplacian, like your graph shows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Generate Any signal you want with the desired narrow bandwith (Still not sure why you need this, but let's say you do). you could use method one for it. Then estimate the probabiliy density with any method, like periodogram like you did, or Kernel Density estimation with parzen windows, etc.&#xA;Then, design a non-linear transformation that you can apply sample to sample, in order to go from the probability density that you have, to a uniform. This non linear transofrmation is actually the &quot;Inverse Probability distribution&quot; that you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you estimate your density in discrete intervals with periodogram, maybe you could look at the form of the graph and try to guess what functional form it has, then fit it with least squares to a continuous function, and then obtain the Probability Distribution from that, find the inverse, and apply that transformation to every sample. That should give you a signal which is uniformly distributed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am guessing now, but i think that your bandwith will not be preserved by this transformation. I have actually never studied the relationship between bandwith and probability density of the amplitudes. But try it and see what happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hope it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;I think you are trying to do is Least Squares fitting. It is the most mathematically correct application of &quot;averaging to get rid of interferences and unwanted noise&quot;, or of linearizing a non-linear systems. Take all your measurments, and fit them to a line. There are 5 types of Least Squares methods:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Least Squares with $L_{2}$-norm&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Least Squares with $L_{1}$-norm&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Least Squares with $L_{\infty}$-norm&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Total Least Squares&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Data Least Squares&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Try some of them and see which one gets better result for your particular application.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="7599" LastEditDate="2014-01-30T20:28:48.123" LastActivityDate="2014-01-30T20:28:48.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14107" PostTypeId="1" CreationDate="2014-01-30T16:05:54.873" Score="2" ViewCount="774" Body="&lt;p&gt;I am collection a quadrature signal from a radio.  The I and Q signals go through a sound card at a sample rate of 192000, and then a FFT is performed on the signals.&#xA;Due to various reasons, the signals are shifted slightly from the 90 degree phase difference and need to be corrected at some point. How can one go about doing this?&#xA;Thanks for your help.&#xA;Tom&lt;/p&gt;&#xA;" OwnerUserId="7741" LastActivityDate="2014-02-12T13:55:22.753" Title="How do you alter the phase relationship between I and Q in a quadrature signal?" Tags="|fft|phase|quadrature|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14108" PostTypeId="2" ParentId="14105" CreationDate="2014-01-30T16:21:11.083" Score="0" Body="&lt;p&gt;As bone said, the task sounds somewhat arbitrary. However, it does not appear to be impossible. I assume you want the frequency content to be distributed normally around a center frequency, this appears not to be very clear though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides filtering white noise with a filter of the desired profile (which appears to be easy), you could multiply a sinusoid which has the center frequency with a signal that has the desired profile around DC. By the convolution theorem, this would bring your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question would then be how to generate a normally distributed signal around DC. Luckily, normal distributions are mapped to normal distributions by the FT, so you would just need to window by a normal distribution (a gaussian).&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-30T16:21:11.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14109" PostTypeId="1" AcceptedAnswerId="14860" CreationDate="2014-01-30T16:33:45.337" Score="-1" ViewCount="466" Body="&lt;p&gt;I am looking for a good introduction to wavelets and wavelet transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that covers the following: Vector Spaces – Properties– Dot Product – Basis – Dimension, Orthogonality and Orthonormality – Relationship Between Vectors and Signals – Signal Spaces – Concept of Convergence – Hilbert Spaces for Energy Signals- Fourier Theory: Fourier series expansion, Fourier transform, Short time Fourier transform, Time-frequency analysis.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             MULTI RESOLUTION ANALYSIS              9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Definition of Multi Resolution Analysis (MRA) – Haar Basis – Construction of General Orthonormal&#xA;MRA – Wavelet Basis for MRA – Continuous Time MRA Interpretation for the DTWT – Discrete&#xA;Time MRA – Basis Functions for the DTWT – PRQMF Filter Banks&lt;br&gt;&#xA;                        CONTINUOUS WAVELET TRANSFORMS           &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelet Transform – Definition and Properties – Concept of Scale and its Relation with Frequency&#xA;– Continuous Wavelet Transform (CWT) – Scaling Function and Wavelet Functions (Daubechies&#xA;Coiflet, Mexican Hat, Sinc, Gaussian, Bi Orthogonal)– Tiling of Time – Scale Plane for CWT.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        DISCRETE WAVELET TRANSFORM          &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Filter Bank and Sub Band Coding Principles – Wavelet Filters – Inverse DWT&#xA;Computation by Filter Banks – Basic Properties of Filter Coefficients – Choice of Wavelet&#xA;Function Coefficients – Derivations of Daubechies Wavelets – Mallat's Algorithm for DWT – Multi&#xA;Band Wavelet Transforms Lifting Scheme- Wavelet Transform Using Polyphase Matrix&#xA;Factorization – Geometrical Foundations of Lifting Scheme – Lifting Scheme in Z –Domain.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                APPLICATIONS                    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Wavelet methods for signal processing- Image Compression Techniques: EZW–SPHIT Coding –&#xA;Image Denoising Techniques: Noise Estimation – Shrinkage Rules – Shrinkage Functions –&#xA;Edge Detection and Object Isolation, Image Fusion, and Object Detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please suggest the steps,resources and materials to do the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. DeeRam&lt;/p&gt;&#xA;" OwnerUserId="7739" LastActivityDate="2014-03-06T21:17:07.653" Title="Need to learn wavelet, suggest steps and resources" Tags="|fourier-transform|signal-analysis|wavelet|reference-request|" AnswerCount="2" CommentCount="1" ClosedDate="2014-03-18T22:35:25.387" ContentLicense="CC BY-SA 3.0" />
  <row Id="14110" PostTypeId="2" ParentId="14109" CreationDate="2014-01-30T17:53:49.553" Score="1" Body="&lt;p&gt;Go to your library and scan for readability the books on functional analysis for Hilbert and Banach spaces and the Fourier transform, some book on signal processing for the intricacies of sampling and practical aspects. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After studying these topics, you can then venture into the vast wavelet literature. There I would concentrate first, keeping in mind your interest on the more theoretical properties, on authors C. Heil, S. Mallat and I. Daubechies. &lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-01-30T17:53:49.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14111" PostTypeId="1" AcceptedAnswerId="14114" CreationDate="2014-01-30T18:46:27.013" Score="6" ViewCount="874" Body="&lt;p&gt;How is the &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/filter.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/a&gt; implemented in MATLAB? How is it so fast?&lt;br&gt;&#xA;What's the fastest implementation of a FIR filter?&lt;/p&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="128" LastEditDate="2019-11-18T09:17:15.497" LastActivityDate="2022-01-17T18:24:41.117" Title="How Is the MATLAB `filter()` Function So Fast?" Tags="|matlab|infinite-impulse-response|finite-impulse-response|software-implementation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14112" PostTypeId="2" ParentId="12949" CreationDate="2014-01-30T20:14:45.960" Score="0" Body="&lt;p&gt;Are you trying to do half wave rectification? A resistance and a diode will work...&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-30T20:14:45.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14114" PostTypeId="2" ParentId="14111" CreationDate="2014-01-30T20:45:12.600" Score="4" Body="&lt;p&gt;Actually it seems MATLAB implementation of the &lt;code&gt;filter()&lt;/code&gt; function is pretty straight forward and not fast.&lt;/p&gt;&#xA;&lt;p&gt;For a fast implementation, have a look at &lt;a href=&quot;https://www.mathworks.com/matlabcentral/fileexchange/32261&quot; rel=&quot;nofollow noreferrer&quot;&gt;FilterM&lt;/a&gt; by Jan Simon.&lt;/p&gt;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&lt;p&gt;In the latest releases of MATLAB (From R2016b and above) the performance of the &lt;code&gt;filter()&lt;/code&gt; function has improved.&lt;br /&gt;&#xA;The methods to accelerate those operations are usually based on:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Utilizing Vectorized  / SIMD Operations (SSE / AVX in &lt;code&gt;x86&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Multi Threading.&lt;/li&gt;&#xA;&lt;li&gt;Loop Unrolling.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Update (2021):&lt;br /&gt;&#xA;In recent MATLAB versions the function was accelerated using parallelization and vectorization.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="7092" LastEditDate="2022-01-17T18:18:36.103" LastActivityDate="2022-01-17T18:18:36.103" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14115" PostTypeId="2" ParentId="14048" CreationDate="2014-01-30T20:48:15.257" Score="2" Body="&lt;p&gt;Log-gabor are filters defined similarly as gabor filters in the sense that their envelope consist in a Gaussian in Fourier space. This is advantageous because this makes them optimal with respect to the compromise between localization (in space) and detection (of the mean frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference is that log-gabor (as their name implies) are defined in the log-space frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This makes sense as this relevant feature (frequency) may for some applications better optimized when the precision in frequency is proportional to the mean frequency. &lt;/li&gt;&#xA;&lt;li&gt;this has the drawback that they have no simple analytical formulation in the space domain as simple Gabor filters,&lt;/li&gt;&#xA;&lt;li&gt;In perception, this is very advantageous: for instance the human ear is in a large range sensitive to the relative increments of frequency (this is called the Fechner-Weber rule). This is also used in vision, see for instance the filters obtained in this &lt;a href=&quot;http://invibe.net/LaurentPerrinet/Publications/Fischer07cv&quot; rel=&quot;nofollow noreferrer&quot;&gt;this computational neuroscience paper&lt;/a&gt; mimicking the receptive field of simple cells in the primary visual cortex:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/F5yMp.png&quot; alt=&quot;example 2D log-gabor filters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To specifically answer your question, log-Gabor filters have indeed the property of having a zero DC offset:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;To show this consider that this offset is the value of the spectrogram at the origin (for null frequencies). In log-frequencies, the DC corresponds to the limit of the log function at zero, that is minus infinite. Necessarily, this implies that this value is zero for a finite bandwidth of the filter. In (simplified) mathematical terms, the envelope is :&#xA;$$f \propto \exp( - \log(f)^2 / B^2 /2$$&#xA;so that for $B&amp;gt;0$, we have  $f(0) \propto \lim_{f \rightarrow \infty} \exp( - \log(f)^2 / B^2 /2) = 0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This is relevant in perception. Indeed, remember that the DC component represent the average luminance value in the image, that is some global configuration (daylight vs nightlight, some specific exposure setting in your camera/eyeball) more relevant to specific tasks such as keeping the circadian rhythm (= syncing with the day rhythm). When doing a perceptually relevant task, such as detecting the shape of an object or tracking the motion of an object, these features are independent of the global configuration: e. g. a cat at night has the same shape as a cat during day!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1085" LastEditorUserId="1085" LastEditDate="2014-02-06T08:22:27.220" LastActivityDate="2014-02-06T08:22:27.220" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14117" PostTypeId="2" ParentId="14038" CreationDate="2014-01-30T21:00:32.147" Score="0" Body="&lt;p&gt;For computing the average of angles, you may use circular statistics as defined in Mardia K. V., Jupp P. E. (2009, Directional Statistics, Vol. 494 Hoboken, NJ: Wiley) and as used in &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3775506/&quot; rel=&quot;nofollow&quot;&gt;this paper, Eq. 10&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The idea behind Equation 10 is that in order to compute the mean of a circular quantity, the position and direction first need to be transformed into an angle, which is then projected to the 2D unit circle where the arithmetic mean is computed. After that, the angle that the mean position forms is transformed back from an angle to space. For positions, this takes the form:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$ 	x_{pred}^{net}(t) = 1 + \frac{1}{2 \pi} \textrm{arctan2}(\sum_i^{N_{exc}} \mathit{p}_i(t) (\sin(2\pi x_i - \pi)), \sum_i^{N_{exc}} \mathit{p}_i(t) (\cos(2 \pi x_i - \pi)))  $$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;in your context, you have $N$ measures $\theta_i$ with probabilities $p_i$, the average $\theta$ is equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 	\theta = \textrm{arctan2}(\sum_i^{N} \mathit{p}_i (\sin(2\pi \theta_i - \pi)), \sum_i^{N} \mathit{p}_i (\cos(2 \pi \theta_i - \pi))) &#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1085" LastEditorUserId="80" LastEditDate="2014-01-30T21:24:04.983" LastActivityDate="2014-01-30T21:24:04.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14118" PostTypeId="2" ParentId="11204" CreationDate="2014-01-30T21:46:45.573" Score="1" Body="&lt;p&gt;Have a look to the paper :&#xA;&lt;a href=&quot;http://www-l2ti.univ-paris13.fr/~beghdadi/jasp2006_SNR_W.pdf&quot; rel=&quot;nofollow&quot;&gt;A. Beghdadi, R. Iordache, “Image quality Assessment using the Joint Space/ Spatial-Frequency Representation”, EURASIP Journal on Applied Signal Processing, Volume 2006, Article ID 80537, 2006, Pages 1–8.(PDF)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A. Beghdadi&lt;/p&gt;&#xA;" OwnerUserId="7745" LastEditorUserId="80" LastEditDate="2014-01-30T22:21:43.493" LastActivityDate="2014-01-30T22:21:43.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14120" PostTypeId="1" CreationDate="2014-01-30T23:03:52.993" Score="-1" ViewCount="154" Body="&lt;p&gt;Suppose I have the following signal (Spectrogram):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/j2qgi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have three types of elements that I want to identify within this signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Noise  2) Call-1 3) Call-2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have prior training of what each of the elements looks like and can obtain training for the duration of each call, and, the frequency ranges that each call will be present at. The task is to make a classifier for each of the training samples, and then iterate through the signal and detect the probability of each classifier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is: At what data do I need for the classifier? For example, can I take training data and perform cross-correlation on the signal to detect which is the most likely classifier at the particular point in the signal.. Or look at the frequencies that are &lt;code&gt;known through training&lt;/code&gt; and detect whether it is noise, or, an actual signal?&lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-01-31T03:41:23.210" Title="Classifier for detecting sound over noise" Tags="|frequency-spectrum|signal-detection|" AnswerCount="1" CommentCount="1" ClosedDate="2014-03-06T02:24:26.167" ContentLicense="CC BY-SA 3.0" />
  <row Id="14121" PostTypeId="2" ParentId="14120" CreationDate="2014-01-31T03:41:23.210" Score="0" Body="&lt;p&gt;I believe Singular value decomposition might help extract information. &#xA;This might give you some insight: &#xA;. &lt;a href=&quot;https://maxwell.ict.griffith.edu.au/spl/publications/papers/tencon97_lilly_svd.pdf&quot; rel=&quot;nofollow&quot;&gt;Speech recognition using svd&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;. &lt;a href=&quot;http://see.stanford.edu/materials/aimlcs229/transcripts/MachineLearning-Lecture15.pdf&quot; rel=&quot;nofollow&quot;&gt;Tutorial&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7570" LastActivityDate="2014-01-31T03:41:23.210" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14122" PostTypeId="1" CreationDate="2014-01-31T04:12:02.790" Score="0" ViewCount="166" Body="&lt;p&gt;I am an ECE student, and i am doing my project&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to generate a code for gabor  wavelet transform. I have no idea  could you help me with a sample program&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have DNA as input sequences and how can use it as input data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;sample sequence  s={ACGTACGTACCCCAGGGATTT} &quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks and regards!&lt;/p&gt;&#xA;" OwnerUserId="7747" LastActivityDate="2014-01-31T17:52:52.440" Title="how can i call the input data in wavelet transform and generate code for gabor wavelet manually?" Tags="|wavelet|gabor|" AnswerCount="2" CommentCount="2" ClosedDate="2014-03-18T23:27:23.477" ContentLicense="CC BY-SA 3.0" />
  <row Id="14123" PostTypeId="1" CreationDate="2014-01-31T06:54:27.340" Score="-1" ViewCount="8657" Body="&lt;p&gt;$y(n)=n \times y(n-1)+x(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n)=$ output of causal Linear Time Invariant system&#xA;$x(n)=$ input of causal Linear Time Invariant system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n)=x(n) * h(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h(n)= $system&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="7092" LastEditDate="2014-01-31T15:37:24.930" LastActivityDate="2014-01-31T15:37:24.930" Title="How to calculate impulse response of discrete time system?" Tags="|discrete-signals|self-study|" AnswerCount="1" CommentCount="1" ClosedDate="2014-02-24T16:46:59.223" ContentLicense="CC BY-SA 3.0" />
  <row Id="14124" PostTypeId="2" ParentId="14016" CreationDate="2014-01-31T08:22:34.903" Score="3" Body="&lt;p&gt;A great book to learn about digital signal processing in general ist &quot;Understanding digital signal processing&quot; from &quot;Richard Lyons&quot;. &lt;a href=&quot;http://www.amazon.de/Understanding-Digital-Signal-Processing-Richard/dp/0137027419&quot; rel=&quot;nofollow&quot;&gt;Amazon-Link&lt;/a&gt;. It's easy to read and requiers no previous knowledge. You'll get comfortable with discrete signals, &lt;code&gt;FFT&lt;/code&gt;, &lt;code&gt;filters&lt;/code&gt; and so on very fast. All the mathematics that you need is described inside this book (you'll need no other references for mathematics). You may find a cheaper version of this book on &lt;a href=&quot;http://eurobuch.de&quot; rel=&quot;nofollow&quot;&gt;eurobuch&lt;/a&gt; - good luck! Maybe, for designing the perfect filter you will need another book afterwards, but I think it's the rigth one to start with.&lt;/p&gt;&#xA;" OwnerUserId="5434" LastEditorUserId="4513" LastEditDate="2014-01-31T09:43:47.650" LastActivityDate="2014-01-31T09:43:47.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14125" PostTypeId="1" AcceptedAnswerId="14134" CreationDate="2014-01-31T09:23:32.803" Score="8" ViewCount="11607" Body="&lt;p&gt;The figure below shows in dashed lines sinusoidal signals of the same frequency at three different phase shifts.  The signals are then sampled such that the sinusoidal frequency is exactly a half of the sampling frequency, i.e. the frequency of all the sinusoids is the Nyquist frequency.  The samples taken from this signal are represented by the circles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Zm4e.png&quot; alt=&quot;Nyquist frequency signal with samples&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the figure, it seems that the amplitude of the digital sinusoidal signals is dependent upon the sampling rate and instant of sampling.  In fact if the sampling times coincide with the zero-crossings of the sinusoid, then no signal will be detected at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had initially thought that sampling a bandlimited analog signal at the appropriate sampling frequency would enable perfect reconstruction, but this counter-example has left me stumped.  It seems that this sinusoid will generally not be reconstructed properly if digitized and then reconstructed at this rate.  Have I gone wrong in my understanding, and if so, can someone please point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="4391" LastEditorUserId="1629" LastEditDate="2016-08-24T07:24:26.257" LastActivityDate="2016-08-24T07:24:26.257" Title="Nyquist Frequency Phase Shift" Tags="|sampling|digital|analog|nyquist|analog-to-digital|" AnswerCount="8" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14126" PostTypeId="2" ParentId="14125" CreationDate="2014-01-31T10:03:39.460" Score="8" Body="&lt;p&gt;The sampling theorem states that &lt;span class=&quot;math-container&quot;&gt;$f_\mathrm{S} \geq 2f_\mathrm{max}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$f_\mathrm{S}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f_\mathrm{max}$&lt;/span&gt; are the sampling and maximum signal freuqency, respectively. But there's an additional condition: The equal sign only holds if the signal spectrum does not contain a dirac impulse at &lt;span class=&quot;math-container&quot;&gt;$f_\mathrm{S}/2$&lt;/span&gt; which is clearly the case in your example. Therefore &lt;span class=&quot;math-container&quot;&gt;$f_\mathrm{S} &amp;gt; 2f_\mathrm{max}$&lt;/span&gt; has to be fulfilled.&lt;/p&gt;&#xA;&lt;p&gt;A reference for this statement can be found &lt;a href=&quot;http://www.princeton.edu/%7Eachaney/tmve/wiki100k/docs/Nyquist%E2%80%93Shannon_sampling_theorem.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, for example:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If a signal contains a component at exactly B hertz, then samples spaced at exactly 1/(2B) seconds do not completely determine the signal, Shannon's statement notwithstanding. This sufficient condition can be weakened, as discussed at Sampling of non-baseband signals below.&lt;/p&gt;&#xA;&lt;p&gt;More recent statements of the theorem are sometimes careful to exclude the equality condition; that is, the condition is if x(t) contains no frequencies higher than or equal to B; this condition is equivalent to Shannon's except when the function includes a steady sinusoidal component at exactly frequency B.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The above is an excerpt of an earlier version of &lt;a href=&quot;http://en.wikipedia.org/wiki/Sampling_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;the according Wikipedia article&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-02-03T16:15:20.133" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="14128" PostTypeId="2" ParentId="14125" CreationDate="2014-01-31T11:51:53.143" Score="3" Body="&lt;p&gt;By definition, band-limited signals in the sense of the sampling theorem have finite energy. Sine waves are periodic and thus have infinite energy. So any dirac pulse in the Fourier transform is not permissible.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To be more precise, the sampling theorems only applies to signals that can be represented as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\int_{-f_s/2}^{f_s/2} X(f)\,e^{2\pi i\,ft}\,df$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $X\in L^2$. In the class of $L^2$ functions, values at specific points do not matter, so the values of $x(t)$ do not depend on the specific values of $X(\pm f_s/2)$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Any realistically occuring signal $x(t)$ is of finite length and thus has a continuous Fourier transform. For any approximation of &quot;band-limited&quot;, the Fourier transform $X(f)$ needs to have negligible values at $\pm f_s/2$ and beyond.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Addendum:&lt;/strong&gt; Any finite signal that looks for some time segment like a sine wave $\sin(2\pi ft)$ and sports a sufficiently smooth fade-in and -out has smooth peaks in its spectrum around the frequencies $\pm f$. Outside the peaks, the amplitude goes towards zero, but never does reach it to stay at zero. Thus one has to define a threshold of where the amplitude is for practical purposes identical to zero, absolute or relative to the peak value of the amplitude. But that leads to the frequency contents of the signal to be contained in between $\pm (f+h)$, so that even the strict rule requires a sampling frequency of at least $f_s=2(f+h)&amp;gt;2f$.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-02-02T15:04:15.823" LastActivityDate="2014-02-02T15:04:15.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14129" PostTypeId="2" ParentId="14123" CreationDate="2014-01-31T12:37:24.757" Score="3" Body="&lt;p&gt;Paul R is right: your system in not time-invariant, so the impulse response doesn't mean much.  This could actually be a typing error o your site, more common is y(n) = k*y(n-1)+x(n). This being said, you can still calculate impulse response my simply starting at n = 0 and evaluate the difference equation one step at a time. For 1,2,3,4 ... so the impulse response would be h(n) = n.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However your last three sentence are not true. The system is not time invariant, convolution is meaningless and h(n) is not the system response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming difference equation is actually y(n)= k*y(n-1)+x(n), the answer would be quite different.With the same method you can determine the impulse response to be 1, k, k^2, k^3 .... So you have h(n) = k^n which would indeed be the system response and could be used for convolution.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-01-31T12:37:24.757" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14130" PostTypeId="2" ParentId="14077" CreationDate="2014-01-31T15:09:49.717" Score="0" Body="&lt;p&gt;First I do not see any mention of complex numbers at all. Maybe you are just evaluating the real part of your transform, then the problem with double (or rather, oscillating) peaks could be explained. Kevin McGee referred to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second half of your transform should be conjugate symmetric to the first half, if you transform a real signal (which you certainly appear to do). It is then redundant and can be ignored.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-01-31T15:09:49.717" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14131" PostTypeId="1" AcceptedAnswerId="14136" CreationDate="2014-01-31T15:51:18.817" Score="1" ViewCount="90" Body="&lt;p&gt;This is my system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pYch7.png&quot; alt=&quot;Continuos system with sampler&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to find a transfer function? I can’t help the YR(s) going inside B(s) without being sampled, and I think this is the problem. Any help?&lt;/p&gt;&#xA;" OwnerUserId="789" LastActivityDate="2014-01-31T20:56:22.697" Title="Existence of transfer function" Tags="|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14133" PostTypeId="2" ParentId="14122" CreationDate="2014-01-31T16:42:00.667" Score="2" Body="&lt;p&gt;You're probably &lt;strong&gt;way&lt;/strong&gt; out of your league if you have these problems, and just getting code won't help you with your project. your teacher will spot rather quickly that you didn't write it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start, you should read up on wavelet transforms in general. Gabor wavelets are just a specific kind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll learn that wavelet transforms work on signals. That means you'll need to represent your DNA as a signal, i.e numbers.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-01-31T16:42:00.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14134" PostTypeId="2" ParentId="14125" CreationDate="2014-01-31T17:31:28.810" Score="6" Body="&lt;p&gt;The sample rate needs to be GREATER than (NOT just equal to) twice the highest non-zero frequency content of the signal being sampled.  Just a little bit greater might work, but the closer the sample rate is to twice the signal frequency, the longer in time you may need to sample to raise the signal above the noise and complex conjugate image in a DFT/FFT result.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-02-01T18:02:40.923" LastActivityDate="2014-02-01T18:02:40.923" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="14135" PostTypeId="2" ParentId="14122" CreationDate="2014-01-31T17:52:52.440" Score="1" Body="&lt;p&gt;May I suggest an illustrative example which should guide you in the beginning ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As noted you can't obtain any results using the given DNA sequence as it is. Instead you should transform it and what more natural than assigning integer values to each nucleobase ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data = {A, C, G, T, A, C, G, T, A, C, C, C, C, A, G, G, G, A, T, T, T} /. &#xA;        {A -&amp;gt; 1, G -&amp;gt; 2, T -&amp;gt; 3, C -&amp;gt; 4};&#xA;&#xA;cwd = ContinuousWaveletTransform[data, GaborWavelet[]]&#xA;&#xA;WaveletScalogram[cwd, ImageSize -&amp;gt; 500, ColorFunction -&amp;gt; &quot;DeepSeaColors&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DP3DJ.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Or if you need a finer resolution&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ListDensityPlot[Abs@Reverse@cwd[All, &quot;Values&quot;], ColorFunction -&amp;gt; &quot;DeepSeaColors&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qhXLq.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can always observe the scalogram in 3D&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = cwd[&quot;LinearScalogramFunction&quot;]&#xA;&#xA;(* Real Part *)&#xA;Plot3D[Re@f[x, y], {x, 1., 21.}, {y, 1.15117, 7.74411}, ImageSize -&amp;gt; 500,&#xA;            ColorFunction -&amp;gt; &quot;SunsetColors&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/d9M6F.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(* Imaginary part *)&#xA;Plot3D[Im@f[x, y], {x, 1., 21.}, {y, 1.15117, 7.74411}, ImageSize -&amp;gt; 500,&#xA;            ColorFunction -&amp;gt; &quot;SunsetColors&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Fwrth.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I will leave the interpretation of the scalograms to you. &lt;/p&gt;&#xA;" OwnerUserId="7477" LastActivityDate="2014-01-31T17:52:52.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14136" PostTypeId="2" ParentId="14131" CreationDate="2014-01-31T20:56:22.697" Score="2" Body="&lt;p&gt;You need to determine an expression for the samplers. Normally i would think that those are A/D converters, but  they give $A(s)$ and in the variable $s$ it is implied (sort of) that is the laplace transform, and laplace transforms are used for continuos time systems, so the samplers T could also be just converting the signal into a piecewise constant signal, and that is a non linear operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please try to clarify this, and then we will be able to help you more easily.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-01-31T20:56:22.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14137" PostTypeId="1" AcceptedAnswerId="14153" CreationDate="2014-01-31T22:40:02.343" Score="0" ViewCount="809" Body="&lt;p&gt;I have a collection of audio files of subjects sleeping, which have different lengths,  ranging from 8 hours to 10 hours. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to detect when a snore occurs in them.  First of all I want to normalise them.  What is the best method to normalise them so they all have similar values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm am using the following code which basically sets the sum of all the values to 1. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;recording = recording / norm(recording, 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, for example, the energy value of a snore differs greatly from one recording to another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any better methods of normalization which will cope with a range of different length recordings?&lt;/p&gt;&#xA;" OwnerUserId="7753" LastActivityDate="2014-02-01T21:01:24.577" Title="Normalisation of different length signals" Tags="|matlab|normalization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14138" PostTypeId="2" ParentId="14137" CreationDate="2014-02-01T01:56:35.270" Score="1" Body="&lt;p&gt;In audio, &quot;normalization&quot; means making all values be between 0 and 1. So&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;recording = recording / max( abs(min(recording)), abs(max(recording)) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-02-01T01:56:35.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14140" PostTypeId="2" ParentId="14125" CreationDate="2014-02-01T03:48:42.730" Score="2" Body="&lt;p&gt;Your observation is correct, and it has been noted before.  One example, for instance, is mentioned on pages 160-161 of &quot;Principles of Communication Systems&quot; by H. Taub and D. Schilling, McGraw-Hill Book Company, 1971.  After introducing the sampling theorem, the authors state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;An interesting special case is the sampling of a sinusoidal signal having the frequency Fm.  Here, &lt;em&gt;all&lt;/em&gt; the signal power is concentrated precisely at the cutoff frequency of the low-pass filter, and there is consequently some ambiguity about whether the signal frequency is inside or outside the filter passband.  To remove this ambiguity, we require that Fs (be greater than) 2Fm rather than that Fs (be greater than or equal to) 2Fm.  To see that this condition is necessary, assume that Fs = 2Fm but that an initial sample is taken at the moment the sinusoid passes through zero.  Then all successive samples will also be zero.  This situation is avoided by requiring Fs (be greater than) 2Fm.&quot;&lt;/p&gt;&#xA;" OwnerUserId="1926" LastEditorUserId="1926" LastEditDate="2014-02-02T03:47:57.053" LastActivityDate="2014-02-02T03:47:57.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14141" PostTypeId="1" CreationDate="2014-02-01T06:53:57.037" Score="0" ViewCount="340" Body="&lt;p&gt;I am trying to solve a phasor addition problem, reducing from its original form to &#xA;$$X(t) = A \cos(\omega_0 * t + \phi)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original equation is :&#xA; $$X(t) = 2 \sin(\omega_0 * t + 45) + \cos(\omega_0*t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I converted the sine term into cosine. The result that i got was &#xA;$$X(t) = 2 \cos(\pi/2 - \omega_0*t - \pi/4) + \cos(\omega_0*t) $$&#xA;Which reduces to :&#xA;$$X(t) = 2 \cos(\pi/4 - \omega_0*t) + \cos(\omega_0*t) $$&#xA;Up to this point I verify in MATLAB that the original function and the function in cosines are equal by graphing them and then calling the $norm()$ function and verify that it is something very close to 0. &#xA;&lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/norm.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/matlab/ref/norm.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then perform the phasor addition process. &#xA;$X(t) = Re(2e^{j(\pi/4)}e^{j\omega_0 t})+Re(e^{j0}e^{j\omega_0 t})$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_1= 2e^{j(\pi/4)} = 2(cos(\pi/4) + jsin(\pi/4)) = 2(\frac{\sqrt2}2+j\frac{\sqrt2}2) = \sqrt2 + j\sqrt2$$&#xA;$$X_2 = e^{j0} = cos0 + jsin0 = 1$$&#xA;$$X_3 = X_1 + X_2 = \sqrt2 + j\sqrt2 + 1 = 2.41421 + j1.41421$$&#xA; To turn it into back into the stated form of $X(t) = A \cos(\omega_0 * t + \phi)$ i find the $R$ &#xA;$$R = \sqrt{2.41421^2 + 1.41421^2} = 2.79793$$&#xA;$$\theta = arctan(1.41421/2.41421) = .529902$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final result being $X(t) = 2.79793\cos(\omega_0 t + .529902) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then go to MATLAB to plot the original signal and the reduced signal that I found but when I call the $norm(originalSignal - reducedSignal)$ I get a number much greater than 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to figure out why this is returning such a high number. Some of my guesses are the negative $-\omega_0 t$ in the first term of the function when I convert sine to cosine $X(t) = 2 \cos(\pi/2 - \omega_0 t - \pi/4) + \cos(\omega_0 t) $ I don't know if the process changes for a situation like that. Problems I have worked through and have gotten the correct answer always seem to have the $\omega_0 t$ as positive part inside the cosine term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the Matlab code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = [0 : .01 : 1];&#xA;originalWave = 2*sin(50 *t + pi/4) + cos(50*t);&#xA;reducedWave = 2.79793*cos(50*t+.529902);&#xA;&#xA;subplot(2,1,1)&#xA;plot(t, originalWave)&#xA;subplot(2,1,2)&#xA;plot(t, reducedWave)&#xA;&#xA;norm(originalWave - reducedWave)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what could be wrong with my process or answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate any advice or help. Thanks. &lt;/p&gt;&#xA;" OwnerUserId="7756" LastActivityDate="2014-02-01T11:47:57.237" Title="Reducing a signal to Acos(omega * t+ phi) with negative omega*t" Tags="|matlab|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14143" PostTypeId="1" AcceptedAnswerId="27060" CreationDate="2014-02-01T07:52:50.513" Score="0" ViewCount="330" Body="&lt;p&gt;I used &lt;em&gt;nftool&lt;/em&gt; in Matlab 2012 and trained a network. I gave the training inputs as x=[250:1] and targets as t=[250:1]. I used 10 hidden layers. I trained the network and got the results and exported the data to workspace. I finally got net as the variable in the workspace. I want to realize this network in hardware. So, I want the exact weights and bias values. I searched the net and typed net.IW and got 10 values, net.LW and got yet another 10 values and net.b and got 11 values. My network diagram is as shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/abkE1.png&quot; alt=&quot;Output Neural Net&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If IW is the Input Weight and LW is the Layer Weight, I realized the network diagram as shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1UnN4.png&quot; alt=&quot;My realization of output Neural Network&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got 10 values for IW, which would fit into 10 hidden layers, and 10 values for LW, which will fit into 10 hidden layers according to my realization. I got 11 values for bias, which will fit in to my network, since there are 11 (b) blocks in the network. &#xA;But, i am missing one IW and one LW value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know whether there is a mistake in my realization of the output of the network or I missed any of the values. Please help. &lt;/p&gt;&#xA;" OwnerUserId="7610" LastActivityDate="2015-12-14T18:23:20.720" Title="Help in viewing the output of a neural network" Tags="|matlab|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14144" PostTypeId="2" ParentId="14141" CreationDate="2014-02-01T11:47:57.237" Score="1" Body="&lt;p&gt;You flipped a sign on the phase, the answer is -.529....&#xA;It's not &#xA;$$X(t) = Re(2e^{j(\pi/4)}e^{j\omega_0 t})+Re(e^{j0}e^{j\omega_0 t})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's&#xA;$$X(t) = Re(2e^{-j(\pi/4)}e^{j\omega_0 t})+Re(e^{j0}e^{j\omega_0 t})$$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-02-01T11:47:57.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14145" PostTypeId="1" AcceptedAnswerId="14146" CreationDate="2014-02-01T13:40:14.953" Score="0" ViewCount="1704" Body="&lt;p&gt;Does anyone know any &lt;code&gt;FFT&lt;/code&gt; algorithm that can be implemented in C?&#xA;I am trying to convert a built-in matlab FFT api to a function in C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate any help!&lt;/p&gt;&#xA;" OwnerUserId="7758" LastEditorUserId="4513" LastEditDate="2014-02-01T21:31:10.717" LastActivityDate="2014-02-01T21:31:10.717" Title="Implementation of FFT algorithm in C Programming" Tags="|matlab|fft|c|" AnswerCount="1" CommentCount="2" ClosedDate="2014-02-01T19:00:29.913" ContentLicense="CC BY-SA 3.0" />
  <row Id="14146" PostTypeId="2" ParentId="14145" CreationDate="2014-02-01T15:11:46.907" Score="1" Body="&lt;p&gt;I just did exactly what you are asking for a few weeks ago. Try the Matlab coder. It turns your scripts into C funtions. This is what i did, maybe you can try it and see if it works for you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Make a simple function in matlab like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;function [y] = myfft(x)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y = fft(x,2^nextpow2(length(x)));&lt;/p&gt;&#xA;&#xA;&lt;p&gt;end&#xA;2 - Run the matlab coder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - Set the input values to double and sizes of the inputs and outputs (You can read a little bit of the help for this, it is easy to understand).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 - Build a static library based on this code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result was that matlab created a few source and header files with initialization code, as well as a function with the actual algorithm, i think it used a global variable for the twiddle factors in the Cooley-Tukey algorithm and then just performed the radix-2 computations. So i ended up with the complete source code as well as the compiled myfft.so binary to include in any desired project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try it out, maybe you'll need to do some configurations, i use linux so i guess it was implied for matlab that the compiler would be gcc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps,&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="7599" LastEditDate="2014-02-01T19:55:26.687" LastActivityDate="2014-02-01T19:55:26.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14147" PostTypeId="2" ParentId="14052" CreationDate="2014-02-01T15:58:56.000" Score="2" Body="&lt;p&gt;You should use elements which are a power of 2, for easy and faster computation.&#xA;I'll say, start with 8x8, so you can only scale up.&#xA;And if you have to look only at some portions of this image, then you can crop the original one.&lt;/p&gt;&#xA;" OwnerUserId="7760" LastActivityDate="2014-02-01T15:58:56.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14148" PostTypeId="2" ParentId="14079" CreationDate="2014-02-01T16:41:52.810" Score="1" Body="&lt;p&gt;This is very simple. If there is a carrier frequency offset then there will be a phase rotation from symbol to symbol proportional to the frequency offset.   For an offset of $\omega$ rad/sec, and an symbol period of $T$ the expected phase difference due to the CFO from symbol to symbol will be $\omega T$ radians.  This can be expressed similar to what you've shown since the only difference between identical consecutive training symbols will be the phase due to the CFO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The indices don't make much sense as you've shown them, but if identical symbols $y$ are received at samples $n$ and $n+1$ with CFO = $\omega$ rad/sec and symbol period $T$ seconds, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n+1) = y(n)\mathrm{exp}(j\omega T)$&lt;/p&gt;&#xA;" OwnerUserId="51" LastEditorUserId="1606" LastEditDate="2014-02-02T14:45:56.633" LastActivityDate="2014-02-02T14:45:56.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14149" PostTypeId="2" ParentId="14107" CreationDate="2014-02-01T16:50:24.500" Score="1" Body="&lt;p&gt;If there are separate ADCs for I and Q then that has to be fixed in the analog front-end, e.g., a quadrature mixer prior to the ADCs has an imbalance or the sample times of the ADCs aren't properly aligned.  Or both.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2014-02-01T16:50:24.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14150" PostTypeId="1" CreationDate="2014-02-01T20:30:21.033" Score="-1" ViewCount="289" Body="&lt;p&gt;Right. I'm trying to understand the concepts for determining where the signal contains voiced and unvoiced parts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have created a spectrogram (STFT) of a signal and I'm trying to separate from voiced and unvoiced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried calculating this using the total energy for each bin, and, applying some threshold value for this, however, this concept does not work since determining the threshold requires interaction and and the system should detect this automatically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I therefore use some kind of estimation in order to calculate which bins contain voiced or unvoiced? Let's say, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1) Calculate abs magnitude of STFT Bin &#xA;2) Take the 1st, 2nd bins and [form some kind of estimation]&#xA;4) use the estimation (2) to detect whether the signal contains voiced &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or could anyone recommend any algorithms, or, reading materials (that are very mathematical intensive) to separating voiced from unvoiced signals without using a threshold value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="5182" LastEditDate="2014-02-01T22:05:59.890" LastActivityDate="2014-02-04T02:31:24.563" Title="Suggested algorithms for detecting voiced / unvoiced signals" Tags="|signal-detection|stft|" AnswerCount="2" CommentCount="4" ClosedDate="2014-03-21T00:11:06.590" ContentLicense="CC BY-SA 3.0" />
  <row Id="14151" PostTypeId="1" CreationDate="2014-02-01T20:41:02.313" Score="0" ViewCount="204" Body="&lt;p&gt;When taking the DTFT of a discrete-time signal $x[n]=a \times u[n]$, the book &quot;Signals and Systems&quot; by Chi-Tsong Chen claims that the result is $\frac 1 {1-a \cdot e^{-j \cdot \omega \cdot T}}$; however, many other sources claim the DTFT is $\frac 1 {1-a \cdot e^{-j \cdot \omega}}$ without the T term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book I have states that $x[n]=x(nT)$ by definition and the DTFT by definition is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)= \sum_{n=-\infty}^{+\infty}x(nT)e^{-j \omega n T}$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain the reason for the differences?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time.&lt;/p&gt;&#xA;" OwnerUserId="7761" LastEditorUserId="4346" LastEditDate="2014-02-02T06:20:49.390" LastActivityDate="2014-06-01T11:17:33.173" Title="Discrete Time Fourier Transform Pair Discrepancy" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14152" PostTypeId="2" ParentId="14150" CreationDate="2014-02-01T21:00:22.780" Score="1" Body="&lt;p&gt;Voiced frames may tend to have magnitude peaks that are more narrow-band than unvoiced spectral peaks, and with potential harmonic spacing of multiple spectral peaks.  You can iterate on a threshold that divides using the above tests most clearly into 2 or 3 clusters.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-01T21:00:22.780" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14153" PostTypeId="2" ParentId="14137" CreationDate="2014-02-01T21:01:24.577" Score="1" Body="&lt;p&gt;With your current method if you have two recordings that are very similar except one is two hours longer then you will end up making the longer recording quieter. I don't think that's really what you want. You could also try splitting the recordings up into smaller equal sized chunks and processing them like that. It could make normalization easier.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-02-01T21:01:24.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14154" PostTypeId="1" CreationDate="2014-02-01T22:13:26.380" Score="1" ViewCount="93" Body="&lt;p&gt;Also, in Huffman Coding, why do we use fewer bits for high frequency data. I don't get the intuition. Shouldn't it be the opposite or does this have to do something with the psychoacoustic model of the human hearing which says that our cochlea is sensitive to lower frequencies more than higher, hence we use up higher bits for lower frequencies? &lt;/p&gt;&#xA;" OwnerUserId="7562" LastActivityDate="2014-02-01T22:27:54.833" Title="Why do we quantize high frequencies coarsely, shouldn't it be the opposite?" Tags="|dct|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14155" PostTypeId="2" ParentId="14154" CreationDate="2014-02-01T22:27:54.833" Score="3" Body="&lt;p&gt;In Huffman coding frequency refers to the number of times a particular sequence of discrete source symbols has appeared in the input. It is not the same concept as frequency in the continuous space such as sound frequency. As such, it has nothing to do with psychoacoustics or the cochlea. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use fewer bits for the higher frequency source symbols because frequent source symbols have lower entropy and assigning fewer bits to low entropy symbols gives better compression.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-02-01T22:27:54.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14157" PostTypeId="1" CreationDate="2014-02-02T02:43:02.300" Score="2" ViewCount="250" Body="&lt;p&gt;I am doing the Coursera course on DSP by Prandoni and Vetterli, and was excited to learn that we can use the tools of vector spaces to analyze discrete signals. At this early point in the course the professors did mention that since the signals live in Hilbert space, we can naturally talk of orthogonality, for one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious: what other linear algebra operations/concepts do we use with discrete signals, and what is the rationale behind them?&lt;/p&gt;&#xA;" OwnerUserId="3374" LastActivityDate="2014-06-02T04:34:15.023" Title="What are the mathematical consequences of a discrete signal living in Hilbert space?" Tags="|discrete-signals|linear-algebra|hilbert-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14158" PostTypeId="2" ParentId="14157" CreationDate="2014-02-02T03:17:52.870" Score="2" Body="&lt;p&gt;whether or not a signal lives in a Hilbert space depends only on if you say it does.  if you say so, then you need to specify an inner product $&amp;lt;x,y&amp;gt;$ (which is pretty easy for &lt;b&gt;finite&lt;/b&gt;-length discrete-time signals)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \langle x,y \rangle = \sum_n x[n] y^*[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you need to use that inner product definition to define a norm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |x| = \sqrt{\langle x,x \rangle} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which should also be the same as the distance measure from $x$ to the $0$ element in that Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you need to be able to add and subtract elements in the Hilbert space (easy to do for discrete-time signals).  why this might be useful would be for defining a signal $x$, an estimation of that signal $\hat{x}$, and an error signal, $e_x$ such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{x} = x + e_x $$&#xA;or&#xA;$$ e_x = \hat{x} - x $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can think of the norm of $e_x$ which is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |e_x| = \sqrt{\langle e_x,e_x \rangle} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as a measure of the distance that $\hat{x}$ is from $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if gives you a formal framework for defining error and then maybe help you with algorithms (like a matched filter) for minimizing error, so that a received signal most closely approximates what was transmitted.  or so that some other  &quot;thing&quot; most closely hits some specified target &quot;thing&quot;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-02-02T03:17:52.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14160" PostTypeId="2" ParentId="14151" CreationDate="2014-02-02T04:01:16.167" Score="1" Body="&lt;p&gt;This is just normalized frequency versus un-normalized frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the capitalization of omega. The capital omega $\Omega$, usually refers to the normalized frequency (with $-\pi$ and $\pi$ corresponding to $-f_s/2$ and $f_s/2$) and the normal omega $\omega$, to the regular angular frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your two sources just use different convention. There is no contradiction.&lt;/p&gt;&#xA;" OwnerUserId="5145" LastEditorUserId="8202" LastEditDate="2014-06-01T11:17:33.173" LastActivityDate="2014-06-01T11:17:33.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14161" PostTypeId="1" CreationDate="2014-02-02T04:52:25.183" Score="0" ViewCount="257" Body="&lt;p&gt;This paper by &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.60.3991&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Edward Rosten and Tom Drummond 2008&lt;/a&gt; describes choosing interest point via machine learning approach using ID3 algorithm. I understand the concept of the ID3 they are using. But my question is how are they fitting this whole training and testing idea of machine learning, while are analysing real time video frame. &lt;/p&gt;&#xA;" OwnerUserId="4433" LastActivityDate="2014-02-05T07:03:16.173" Title="Machine Learning in FAST corner detector" Tags="|computer-vision|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14163" PostTypeId="2" ParentId="14161" CreationDate="2014-02-02T09:23:46.960" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;But my question is how are they fitting this whole training and testing idea of machine learning, while are analysing real time video frame.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your question is not clear, but I'll try to answer. They don`t analyze &quot;real time video frame&quot; with machine learning. What do they do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;They have slow segmented test == test all points around whole circle, if it looks like corner. No machine learning.&lt;/li&gt;&#xA;&lt;li&gt;They want to do it fast, so to test not all points around circle, but only some of them. And they want to know which points test first to have answer. &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;That`s why they take some training data and use &quot;slow&quot; test in it - to have ground truth. Then they train decision tree to approximate this &quot;slow&quot; test. &#xA;Basically - you have (for simplicity) 8 points for test around circle. Each point can be darker, brighter or the same as central. Result of testing can be &quot;corner&quot; or &quot;not a corner&quot;. &#xA;Example. You test north point, it is &quot;darker&quot;. You look for ground truth and see, that there are both &quot;corner&quot; and &quot;not a corner&quot; points with &quot;darker&quot; north point. Cannot decide. Then you test south point - it is also darker, then east and west - all are darker.You look for the ground truth and see that all points with this test results are &quot;not a corner&quot;. &#xA;Now you can answer &quot;not a corner&quot; with only 4 tests instead of all 8. So, you can save it as one branch of decision tree. The same for other cases. You find optimal way by some criterion and form full decision tree.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You or me use FAST detector - we don`t retrain trees, we just use ready ones to have it, so no machine learning in real time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7030" LastEditorUserId="7030" LastEditDate="2014-02-05T07:03:16.173" LastActivityDate="2014-02-05T07:03:16.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14166" PostTypeId="1" CreationDate="2014-02-02T13:02:37.340" Score="0" ViewCount="531" Body="&lt;p&gt;I am reading sensor data with my Raspberry Pi from the MPU-6050 sensor, which has an accelerometer and an gyroscope. I am using an adjusted version of the i2cdevlib and I'm taking the measurements from the FIFO buffer with the DLP (digital low pass) enabled. I don't know if this is important, but the sensor output is the following (when not moved):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MZ6SB.png&quot; alt=&quot;sensor&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The X-Axis are seconds, the Y-Axis is the gyroscope output (32 bits) divided through (2¹⁶ * 16.4). It seems that the 17th bit from right is toggling from 0 to 1 all the time. This error occurs on all three axis.&#xA;Is this an usual error? Is there a filter?&lt;/p&gt;&#xA;" OwnerDisplayName="user7768" LastActivityDate="2014-02-02T13:02:37.340" Title="Spikes in rotanional rate from MPU-6050" Tags="|filters|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14168" PostTypeId="2" ParentId="14125" CreationDate="2014-02-02T18:37:46.580" Score="3" Body="&lt;p&gt;again, even with the &lt;strong&gt;Addendum&lt;/strong&gt;, i think Lutz's answer misses the point.  the point is (quoting &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem#Critical_frequency&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate the necessity of $f_s \ &amp;gt; \ 2B$, consider the family of sinusoids (depicted in Fig. 8) ) generated by different values of $\theta$ in this formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \frac{\cos(2 \pi B t + \theta )}{\cos(\theta )}\ = \ \cos(2 \pi B t) - \sin(2 \pi B t)\tan(\theta ), \quad -\pi/2 &amp;lt; \theta &amp;lt; \pi/2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $f_s = 2B$ or equivalently $T = 1/(2B)$, the samples are given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(nT) = \cos(\pi n) - \underbrace{\sin(\pi n)}_{0}\tan(\theta ) = (-1)^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regardless of the value of $\theta$.  That sort of ambiguity is the reason for the &lt;strong&gt;strict&lt;/strong&gt; inequality of the sampling theorem's condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/3/3f/CriticalFrequencyAliasing.svg/200px-CriticalFrequencyAliasing.svg.png&quot; alt=&quot;Fig. 8&quot;&gt;&#xA;Fig. 8&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-02-02T18:47:40.433" LastActivityDate="2014-02-02T18:47:40.433" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14170" PostTypeId="1" CreationDate="2014-02-03T01:37:19.943" Score="0" ViewCount="359" Body="&lt;p&gt;What type of signal analysis (if any) might be performed on a recorded music vocal track to determine if pitch correction might have been applied to a performance?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-03T04:37:03.790" Title="Pitch correction detection?" Tags="|audio|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14171" PostTypeId="1" CreationDate="2014-02-03T01:45:31.130" Score="-1" ViewCount="116" Body="&lt;p&gt;If I have the following spectrogram:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hRu6d.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;And only wanted to have the signals that are in a particular frequency range (2627 - 3939htz).. Can I run a FIR filter to only allow these signals through, and therefore, it will be much easier to segment each of the calls?&lt;/p&gt;&#xA;&lt;p&gt;If so, which FIR filter would be more appropriate for this task? Would a band-pass filter work for this example?&lt;/p&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-02-03T02:32:02.467" Title="Which FIR filter should I choose?" Tags="|filters|frequency-spectrum|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14172" PostTypeId="1" CreationDate="2014-02-03T02:28:14.570" Score="0" ViewCount="258" Body="&lt;p&gt;Branching off from the question [Mapping the value of a sample in a 2-D DFT to cycles/pixel], I have a few more questions related to 2D FFT of images.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I correct in assuming that the fundamental frequency is the image itself?&lt;/li&gt;&#xA;&lt;li&gt;And one copy of the image is equivalent to 1 wave cycle?&lt;/li&gt;&#xA;&lt;li&gt;The sampling frequency is the number of pixels in the image?&lt;/li&gt;&#xA;&lt;li&gt;And If this is correct, how do I compare two distinct images?&lt;/li&gt;&#xA;&lt;li&gt;Can I compare the sampling frequencies ( &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{N_1}$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{N_2}$&lt;/span&gt; ) and frequency peaks of one image with a second image (&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{N_2}$&lt;/span&gt;)? (&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{N_1}$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{N_2}$&lt;/span&gt; are the dimensions of an image)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What I am trying to understand is - what the X &amp;amp; Y axis of a complex 2D FFT plot is? and how to compare information from 2 plots?&lt;/p&gt;&#xA;" OwnerUserId="842" LastEditorUserId="128" LastEditDate="2020-12-12T21:30:44.863" LastActivityDate="2020-12-12T21:30:44.863" Title="FFT (DFT) of 2D Images" Tags="|image-processing|fft|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14173" PostTypeId="2" ParentId="14171" CreationDate="2014-02-03T02:32:02.467" Score="1" Body="&lt;p&gt;A spectrogram is already a bunch of magnitudes of bandpass filtered signal, especially if a non-rectangular window has been applied before the STFTs.   You might be able to test whether a higher quality bandpass filter might help by just keeping the horizontal rows of your spectrogram that correspond to the frequencies you want to keep for your segmentation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-03T02:32:02.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14174" PostTypeId="2" ParentId="14170" CreationDate="2014-02-03T04:37:03.790" Score="1" Body="&lt;p&gt;someone recently pointed me to &lt;a href=&quot;http://webcache.googleusercontent.com/search?q=cache%3aFzmJx3LapRcJ%3ahcsi.cs.tsinghua.edu.cn/Paper/Paper12/Shenyifeng_ICSAI.pdf+&amp;amp;cd=2&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&quot; rel=&quot;nofollow&quot;&gt;a paper that purports to detect and count duplicated fragments&lt;/a&gt;.  i presume that if the density of duplicated fragments exceeds some threshold, one might suspect that &lt;strong&gt;up&lt;/strong&gt;-shifting may have been done to that piece of audio.  i don't see how it could detect down-shifting (how does it detect a removed fragment?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if, by &quot;pitch correction&quot;, you mean pitch quantizing or autotuning™ on a monophonic sound, then i suppose you might run a good tracking pitch detector (maybe not such an easy problem) and maybe a histogram on the detected pitches.  we would expected pitch corrected vocals to have, in the histogram of pitch, a higher frequency of occurrence for pitches more closely located adjacent to pitch semitones (if autotune was set to correct to equal-temperament) or against some note identified as the tonic and then other notes that are &quot;just intoned&quot; (frequency ratios of small integers) with that tonic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pitch detection/estimation is a signal processing issue, but determining what the tonic is, might be sorta a musicological question.  also something could be pitch &quot;corrected&quot; to a pitch standard that is not A-440.  perhaps all of the semitone locations are scooted down a quartertone from A-440.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if one is not going for the &quot;Cher effect&quot;, pitch correction can be very subtle when it is done well.  one need not clamp the pitch hard against the semitone targets.  one can cause the amount of pitch correction to &quot;slew&quot; a little, which makes it slower to correct.  one can separate the vibrato out of the pitch detector output (with a LPF applied to the pitch contour signal), apply pitch correction to the remaining pitch contour, then add the extracted vibrato back.  that would be &lt;em&gt;very&lt;/em&gt; hard to detect.  maybe the singer just sang it well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;not an easy problem.  and not a well-solved problem, at least with the current state-of-the-art.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-02-03T04:37:03.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14175" PostTypeId="1" AcceptedAnswerId="14177" CreationDate="2014-02-03T05:20:33.307" Score="0" ViewCount="1293" Body="&lt;p&gt;I'm trying to get the correct FFT bin index based on the given frequency. The audio is being sampled at &lt;code&gt;44.1k Hz&lt;/code&gt; and the FFT size is &lt;code&gt;1024&lt;/code&gt;. Given the signal is real (capture from PyAudio, decoded through &lt;code&gt;numpy.fromstring&lt;/code&gt;, windowed by &lt;code&gt;scipy.signal.hann&lt;/code&gt;), I then perform FFT through &lt;code&gt;scipy.fftpack.rfft&lt;/code&gt;, and compute the decibel of the result, in whole, &lt;code&gt;magnitude = 20 * scipy.log10(abs(rfft(audio_sample)))&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on &lt;a href=&quot;https://stackoverflow.com/questions/2921674/determining-the-magnitude-of-a-certain-frequency-on-the-iphone/2937762#2937762&quot;&gt;this&lt;/a&gt;, and &lt;a href=&quot;https://stackoverflow.com/questions/4364823/how-to-get-frequency-from-fft-result?lq=1&quot;&gt;this&lt;/a&gt;, I originally had my mapping from the FFT bin index, &lt;code&gt;k&lt;/code&gt;, to any frequency, &lt;code&gt;F&lt;/code&gt;, as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;F = k*Fs/N  for k = 0 ... N/2-1&lt;/code&gt; where &lt;code&gt;Fs&lt;/code&gt; is the sampling rate, and &lt;code&gt;N&lt;/code&gt; is the FFT bin size, in this case, &lt;code&gt;1024&lt;/code&gt;. And the reverse as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;k = F*N/Fs  for F = 0Hz ... Fs/2-Fs/N&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, realizing that the &lt;code&gt;rfft&lt;/code&gt;'s result is no symmetric like &lt;code&gt;fft&lt;/code&gt;, and provides the result, in an &lt;code&gt;N&lt;/code&gt; size array. I now have some questions in regarding the mapping and the function. Documentation unfortunately did not provide much information as I'm novice in this area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;To me, the result of &lt;code&gt;rfft&lt;/code&gt; on an audio sample can be used directly from the first bin to the last bin, as no symmetry occurs in the output, is that correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given the lack of symmetry from the above, the frequency resolution appears to have increased, is this interpretation correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Because of using &lt;code&gt;rfft&lt;/code&gt;, my mapping function from bin index &lt;code&gt;k&lt;/code&gt; to frequency &lt;code&gt;F&lt;/code&gt; is now &lt;code&gt;F = k*Fs/(2N)  for k = 0 ... N-1&lt;/code&gt; is this correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Conversely, the reverse mapping function from frequency &lt;code&gt;F&lt;/code&gt; to bin index &lt;code&gt;k&lt;/code&gt; now becomes &lt;code&gt;k = 2*F*N/Fs  for F = 0Hz ... Fs/2-(Fs/2/N)&lt;/code&gt;, what about the correctness of this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My general confusion arises from how &lt;code&gt;rfft&lt;/code&gt; is related to &lt;code&gt;fft&lt;/code&gt;, and how the mapping can be done correctly while using &lt;code&gt;rfft&lt;/code&gt;. I believe my mapping is offset by a small amount, and that is crucial in my application. Please point out the mistake or advise on the matter if possible, thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="5307" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-02-03T06:27:08.487" Title="Python scipy.fftpack.rfft frequency bin mapping" Tags="|fft|python|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14176" PostTypeId="1" CreationDate="2014-02-02T13:15:03.643" Score="0" ViewCount="59" Body="&lt;p&gt;Please help me in solving the following problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Find the pulse transfer function and weighting sequence of the system described by the following difference equation: $$y[k+2]+ y[k+1]+(0.89)y[k]=r[k] \ ,$$ where $y[k]$ is the input and $r[k]$ is the output.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerDisplayName="avi" LastEditorUserId="4346" LastEditDate="2018-05-07T18:08:47.050" LastActivityDate="2018-05-07T18:08:47.050" Title="transfer function" Tags="|transfer-function|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14177" PostTypeId="2" ParentId="14175" CreationDate="2014-02-03T06:27:08.487" Score="0" Body="&lt;p&gt;I don't use scipy, but the documentation link you provided is very similar to other real-only FFT's.  So regarding your questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Note that there is a y(0) in the output, but no Im(y(0)).  That's because for even N and real-only inputs (ie: all imaginary inputs are zero), then both the Im(y(0)) and Im(y(n/2)) outputs are going to be zero, and need not be represented in the output.  So you can't just run a loop from the first to last bin.  And note the difference of output sequence between odd/even numbered N (ie: you have an Im(y(n/2)) for odd N, but it will be zero for an even N). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) There is no increase in frequency resolution.  For N complex inputs, the FFT returns N complex outputs.  When the N inputs are real-only, you only need return N/2 numbers because of the symmetry and the knowledge that one or two of them will be zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) No, you'll still be off because of the single y(0) output (ie: no Im(y(0)). See point 1 above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) To go from k to F, I just multiply the bin number 'k' by sample_rate/N.  I rarely ever have to do the inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't make it more complicated than it is.  Just follow the documentation's description of the outputs.  After doing a few FFT's, you might start doing a lot of that mapping stuff in your head.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2014-02-03T06:27:08.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14178" PostTypeId="2" ParentId="14172" CreationDate="2014-02-03T07:58:29.980" Score="1" Body="&lt;p&gt;Consider a 1D wave of 10sec duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I correct in assuming that the fundamental frequency is the image itself?&#xA;Does the 10 sec sample equal the fundamental freq? No. same for images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And one copy of the image is equivalent to 1 wave cycle?&#xA;Repeat above. Answer: No&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling frequency is the number of pixels in the image?&#xA;One pixel can be thought of as the sampler. But, this could be changed. You could go for sub-pixel sampling also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this I think the last question has no relevance. Comparing two images, to the best of my knowledge is an open ended problem.&lt;/p&gt;&#xA;" OwnerUserId="7749" LastActivityDate="2014-02-03T07:58:29.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14180" PostTypeId="2" ParentId="2492" CreationDate="2014-02-03T08:13:07.517" Score="0" Body="&lt;p&gt;If you consider the brute force matching approach for detecting motion, you'll see that though we work with blocks of fixed size, the block itself can start at any pixel. This isn't possible with the DC transformed data. You can't compare combine parts of DCT of different blocks and compare with another block (in other image). &lt;/p&gt;&#xA;" OwnerUserId="7749" LastActivityDate="2014-02-03T08:13:07.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14181" PostTypeId="2" ParentId="13564" CreationDate="2014-02-03T08:22:26.440" Score="2" Body="&lt;p&gt;Consider a 1-D delta function.&#xA;It can be written as difference of two unit step trains. All we have done is represent one data in terms of another - mathematically, we are using a different set of basis vectors for representing same data.&#xA;d(n) = u(n) - u(n-1)&#xA;Similarly, in the DCT, one is trying to express some data in terms of a different basis vector set - the set of cosine functions. And just like in any general vector space, some of the coefficients might be negative. There is no other real great physical significance to this.&lt;/p&gt;&#xA;" OwnerUserId="7749" LastActivityDate="2014-02-03T08:22:26.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14183" PostTypeId="1" CreationDate="2014-02-03T13:40:48.080" Score="9" ViewCount="50402" Body="&lt;p&gt;I am quite new to Java and Signal Processing, but I was assigned a project dealing in audio processing. My topic given to me is a game that has a component of analyzing a song (any given song) and outputs data depending on the frequency currently being played (real time). ie: as the song plays, it outputs the current frequency (every second it outputs the current frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been told on &lt;em&gt;stackoverflow&lt;/em&gt; to use FFT. they say &quot;just do a FFT&quot; but that means nothing to me? HOW do you do an FFT? I have read tutorials, and basically understand what it is, but have no clue on how to implement it as in: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;what is the data type of the audio file most suitable for such processing?&lt;/li&gt;&#xA;&lt;li&gt;what exactly is the input of the FFT&lt;/li&gt;&#xA;&lt;li&gt;how do I interpret the results&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can anybody suggest a simple to follow walk through/tutorial on how to process an audio signal? Additionally, if anybody knows a good implementation of FFT for Java, I would appreciate the suggestions.&lt;/p&gt;&#xA;" OwnerUserId="7776" LastEditorUserId="13320" LastEditDate="2016-11-21T13:00:18.703" LastActivityDate="2019-02-11T04:17:35.687" Title="How to analyze audio input/spectrum correctly" Tags="|fft|audio|java|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14185" PostTypeId="1" CreationDate="2014-02-03T16:15:11.550" Score="0" ViewCount="808" Body="&lt;p&gt;I'm trying to estimate the height of my device using an cheap integrated &lt;a href=&quot;http://cache.freescale.com/files/sensors/doc/data_sheet/MMA8653FC.pdf&quot; rel=&quot;nofollow&quot;&gt;Freescale accelerometer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I estimate the earth direction when measured acceleration is close to 1g, then I project the measurement on that direction and integrate twice.&#xA;Very quickly the estimated height drifts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking maybe to use some machine learning algorithm, by feeding it aligned height from video tracking as examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you suggest algorithms that would help doing that?&#xA;Or any other way to make height estimation more precise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Motion is known to be limited in a range of ±0.5m.&lt;/p&gt;&#xA;" OwnerUserId="519" LastEditorUserId="519" LastEditDate="2014-02-03T22:19:01.100" LastActivityDate="2014-02-03T22:19:01.100" Title="Estimating device height from 3-axis accelerometer data (possibly by supervised learning)" Tags="|signal-analysis|noise|machine-learning|motion|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14186" PostTypeId="2" ParentId="14183" CreationDate="2014-02-03T17:03:45.970" Score="9" Body="&lt;p&gt;Let's see. I have no idea about Java classes or what type of support it has for signal processing, but i will give you some guidelines. The Particular details of the implementation in the language, you have to figure out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do any kind of processing on an audio file you need the &quot;raw&quot; data, meaning an audio file wich has uncompressed audio samples. For exmaple, the WAV format, which normally has samples in 16bit signed 2's complement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are going to use a computer and do offline processing, might be a good idea to cast that value to a double (Which in most processors today means 64bit floating point number).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore you will have a continuos stream of double numbers coming from the file. Then you need to define a way to handle the continous data. A standard, very widely used way is to use a circular buffer (even if it is offline, i assume you want your code to be efficient, and loading the entire file to memory as an array is not the best solution). Either that or just a normal buffer, is your choice. The buffer length should be a power of 2 (Do to efficiency of the Cooley-Tukey radix-2 algorithm).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you need to do the actual FFT. This is merely a multiplicacion of the buffer (Which mathematically is a vector) by the FFT matrix. How this operation is actually performed in Java, no idea. In C it would be just to pass the pointer to the array and the length to an FFT routine that, either returns a pointer to dinamically allocated memory, or leaves the result in an array that you pass to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;finally, you arrive at an array of M complex numbers (Assuming the length of the array/buffer/vector with the signal is M). And then you do whatever you want with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, you could take the magnitude of each of the complex numbers, and find the maximum, to detect where the fundamental frequency could be (very approximate though).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extras:&#xA;More advanced techniques to process would include a pre windowing to avoid leakeage, doing zero-padding to obtain more resolution on the windowed spectrum, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it Helps.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="-1" LastEditDate="2019-02-11T04:17:35.687" LastActivityDate="2019-02-11T04:17:35.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14187" PostTypeId="1" CreationDate="2014-02-03T17:46:40.610" Score="2" ViewCount="3657" Body="&lt;p&gt;Why do we always characterize a LTI system by its impulse response and not by another response, like the step response? What does the impulse response have that is so special?&lt;/p&gt;&#xA;" OwnerUserId="7779" LastEditorUserId="21075" LastEditDate="2016-10-21T15:23:04.677" LastActivityDate="2016-11-03T08:42:44.507" Title="Why do we always characterize a LTI system by its impulse response?" Tags="|linear-systems|impulse-response|" AnswerCount="6" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14188" PostTypeId="2" ParentId="14060" CreationDate="2014-02-03T18:08:51.250" Score="3" Body="&lt;p&gt;For a quantized or digital signal, you can get a upper bound on an estimate of information complexity or randomness by attempting to compress the data and/or the data's spectrum using a large variety of compression algorithms.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-07T00:23:54.137" LastActivityDate="2014-03-07T00:23:54.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14189" PostTypeId="2" ParentId="14187" CreationDate="2014-02-03T18:15:45.673" Score="2" Body="&lt;p&gt;The math for analyzing the behavior of applying an arbitrary signal to an LTI system (filtering, etc.) is usually more compact in description when using the impulse response rather than the step response.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-11-03T00:40:44.370" LastActivityDate="2016-11-03T00:40:44.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14190" PostTypeId="2" ParentId="14060" CreationDate="2014-02-03T18:16:30.727" Score="5" Body="&lt;p&gt;There are two different concepts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think as your signal as a single random variable $X$ that is emitting values, then what you want is to calculate the Entropy of the random variable&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Entropy_estimation&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Entropy_estimation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are considering the entire random signal or stochastic process, then you have to estimate the autocorrelation function. The most random signal possible is White noise, in which every sample of the signal is not correlated with any other except itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Autocorrelation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-02-03T18:16:30.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14191" PostTypeId="1" CreationDate="2014-02-03T18:21:12.230" Score="2" ViewCount="249" Body="&lt;p&gt;MATLAB's implementation of &lt;code&gt;cwt&lt;/code&gt; uses the complex morlet wavelet as: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;psi(x) = (pi*Fb)^(-0.5)*exp(2*1j*pi*Fc*x)*exp(-(x^2)/Fb);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, it is possible to implement the &lt;code&gt;cwt&lt;/code&gt; in the Fourier domain (&lt;code&gt;cwtft&lt;/code&gt;). In this case, MATLAB uses a slightly different version of the Morlet wavelet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;psi = (pi^(1/4)).*exp(2*pi*1j*t)*exp(-(t.^2)/2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The question is: how can I change (or insert) the frequency band parameter in the &lt;code&gt;cwtft&lt;/code&gt; version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;psi2 = (Fb*pi.^(1/4)).*exp(2*pi*Fc*1j*t).*exp(-(t.^2)/(Fb*2));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if yes, how is the Fourier version of &lt;code&gt;psi2&lt;/code&gt; (because the implementation takes the fourier transform of &lt;code&gt;psi2&lt;/code&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="7780" LastEditorUserId="1629" LastEditDate="2016-09-04T09:36:47.270" LastActivityDate="2016-09-04T09:36:47.270" Title="How can I change the frequency band ($\tt Fb$ parameter) using $\tt cwtft$?" Tags="|matlab|wavelet|" AnswerCount="0" CommentCount="0" ClosedDate="2016-09-04T16:19:33.760" ContentLicense="CC BY-SA 3.0" />
  <row Id="14192" PostTypeId="2" ParentId="14185" CreationDate="2014-02-03T18:25:32.460" Score="1" Body="&lt;p&gt;Any tiny offset error will cause a double integration to fly off quadratically in time.  Even if you manage to calibrate out this error for one sample test setup, any drift in offset due to change in temperature, orientation, age, power fluctuations, etc., will eventually render that calibration useless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuous recalibration (airspeed, compass, optical fix, etc.) is likely required for a more useful result over a sufficiently long time period.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-03T18:25:32.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14194" PostTypeId="2" ParentId="14187" CreationDate="2014-02-03T20:07:04.663" Score="0" Body="&lt;p&gt;any model response &lt;strong&gt;must&lt;/strong&gt; be from a model input that contains non-zero energy at all frequencies (or virtually all).  both the impulse and the step do that, but i think the reason why the impulse response is preferred over the step response is that the Fourier transform, Laplace transform, Z transform, DTFT, DFT (whatever) of an impulse is the number 1 (for all frequencies $\omega$ or all $s$ or $k$ or whatever).  if you end up calculating the transfer function by dividing the transform of the output by the transform of the input, it's pretty easy to divide by 1.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-02-03T20:07:04.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14197" PostTypeId="2" ParentId="14150" CreationDate="2014-02-04T02:31:24.563" Score="0" Body="&lt;p&gt;Maybe you try &lt;a href=&quot;http://en.wikipedia.org/wiki/Reassignment_method&quot; rel=&quot;nofollow&quot;&gt;spectral reassignment&lt;/a&gt;. Voiced sounds will have a higher ratio of $d \omega \over dt$.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-04T02:31:24.563" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14198" PostTypeId="2" ParentId="14187" CreationDate="2014-02-04T03:44:08.773" Score="4" Body="&lt;p&gt;Let's try a simple example.  A discrete-time LTI system has unit pulse response&#xA;$$h[0] = 1,\quad h[1] = 1,\quad h[n] = 0 ~~\text{for all}~ n \geq 2.&#xA;\tag{1}$$&#xA;The response $y$ of this system to a signal $x$ given by&#xA;$$x[0] = 1,\quad  x[1] = -1,\quad x[2] = 1,\quad x[n] = 0 &#xA;~~\text{for all}~ n \geq 3 \tag{2}$$ is readily calculated &#xA;via the convolution formula,&#xA;and we get&#xA;$$y[0] = 1, \quad y[1] = 0, \quad y[2] = 0, \quad y[3] = 1,\quad y[n] = 0 &#xA;~~\text{for all}~ n \geq  4.\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;============================================================&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;unit-step&lt;/em&gt; response $g$ of the same LTI system is easily found to be&#xA;$$g[0] = 1,\quad g[n] = 2 ~~\text{for all}~ n \geq 1.\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, suppose that you are given only the step response $g$ in $(4)$&#xA;but not the pulse response in $(1)$.  How will you compute the response&#xA;of this LTI system to input $x$?  It is known that the answer is $(3)$,&#xA;but you are asked to figure out how to get from $(2)$ and $(4)$ to $(3)$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2016-11-02T22:54:45.027" LastActivityDate="2016-11-02T22:54:45.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14199" PostTypeId="1" AcceptedAnswerId="14201" CreationDate="2014-02-04T03:48:50.280" Score="5" ViewCount="6829" Body="&lt;p&gt;For the application of Gabor filters in feature-based (e.g. lines and edges in images) digital image processing, it is desired that the DC component is 0. Why is this so? What effect does it have mathematically if the DC component of the filter is not 0?  Thanks in advance! &lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="21075" LastEditDate="2020-04-30T11:39:12.170" LastActivityDate="2020-04-30T11:39:12.170" Title="Gabor filters for digital image processing" Tags="|image-processing|filters|filter-design|gabor|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14200" PostTypeId="2" ParentId="14183" CreationDate="2014-02-04T06:26:23.053" Score="5" Body="&lt;p&gt;If you are good enough with  &lt;code&gt;JAVA&lt;/code&gt; you can use the &lt;a href=&quot;https://sites.google.com/site/piotrwendykier/software/jtransforms&quot; rel=&quot;noreferrer&quot;&gt;JTRANSFORMS&lt;/a&gt; a java library for &lt;code&gt;FFT&lt;/code&gt; which may come in help for you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and by your need  it sounds like a &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EJv9i.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sweb.cityu.edu.hk/sm1204/2012A/page20/index.html&quot; rel=&quot;noreferrer&quot;&gt;Music Visualization using Java Sound API&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dry.ly/ruby-music-visualizer&quot; rel=&quot;noreferrer&quot;&gt;Music Visualization using FFT in Ruby in 7Steps&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can follow these simple steps as of your requirement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*Get accustomed to some audio terminology &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.Read the Playing Frame(Lets say a 20-30ms),your frame size depends on your &lt;code&gt;sampling rate&lt;/code&gt; lets say you are using a sampling rate 8000 and each sample is &lt;code&gt;16bit&lt;/code&gt; &lt;code&gt;signed&lt;/code&gt; &lt;code&gt;little endian&lt;/code&gt;,then your frame of 20ms will be 160 samples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note:try to play a &lt;code&gt;raw&lt;/code&gt; file not a compressed &lt;code&gt;mp3&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.Take the Frame of Raw Data and Perform a &lt;code&gt;FFT&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.Perform Proper &lt;code&gt;Windowing&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4.your output FFT result will have two components real and complex try to take a magnitude plot from it which is just &lt;code&gt;absolute&lt;/code&gt; value of the complex component,your peak gives you the &lt;code&gt;dominant frequency&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;5.have a look at simple tutorials like below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://music.columbia.edu/cmc/musicandcomputers/chapter3/03_04.php&quot; rel=&quot;noreferrer&quot;&gt;Good Tutorial on FFT&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dspguide.com/ch12/2.htm&quot; rel=&quot;noreferrer&quot;&gt;Engineers Guide to FFT&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cnx.org/contents/82e6ba6f-b828-42ef-9db1-8de4b448b869@22.1&quot; rel=&quot;noreferrer&quot;&gt;FFT Tutorial&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cnx.org/contents/26aa0672-1bf7-4237-850e-81c825504116@3&quot; rel=&quot;noreferrer&quot;&gt;OverView of FFT&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="4513" LastEditDate="2014-02-05T05:30:26.467" LastActivityDate="2014-02-05T05:30:26.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14201" PostTypeId="2" ParentId="14199" CreationDate="2014-02-04T13:13:47.160" Score="5" Body="&lt;p&gt;In short: If a filter have DC component it means that for a constant region of the image, the filter response will depend on the grey value of that region. Constant region with higher values ==&gt; higher response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One usually wants higher responses only in case of edges/corners and not in the case of bright but constant regions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a picture worth 1000 words, here is an example. I took a simple image consisting of two horisontal lines, each one in different background. I took the Gabor and LogGabor filter. LogGabor is a variant that have 0 DC response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I filtered the image with a Gabor filter (tuned to respond to horizontal signals) and then, the same image, with LogGabor filter (tuned with exactly the same parameters as Gabor filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ivokg.png&quot; alt=&quot;Original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gabor convoluted:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WhILo.jpg&quot; alt=&quot;gabor&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LogGabor convoluted:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9GUtb.jpg&quot; alt=&quot;logGabor&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example of Gabor filter, with a bandwidth of 0.7 octaves.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Ce6ZS.jpg&quot; alt=&quot;gabor0.7&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's ignore the edges for a moment and focus on the constant regions.&#xA;In the second image, you see different responses for the constant regions! Darker region have a lower response than the lighter one. For the LogGabor case (third image) you see that the response is the same regardless of the original intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The response values were scaled in 0-255 interval, so, neutral grey means 0 response, darker means negative values and lighter positive ones. The bandwidth is set to 2 octaves (except for the 4'th image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to a paper by &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.74.4550&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boukerroui et al.&lt;/a&gt;, for bandwidths around 0.7 the DC response is close to the computational errors ($10^{-6}$). The 4'th figure demonstrate this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My personal advice to you is to use another bandpass filter. I strongly recommend Gauss Derivatives or Difference of Gaussians (in this order) if it is necessary for you to stay in spatial domain. If you don't have this restriction, I personally prefer LogGabor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my experience there is no net advantage or disadvantage in terms of end result between logGabor, Gaussian Derivatives, Difference of Gaussians or more exotic Cauchy filters. BUT this might vary, depending on your practical application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the code, here is a snippet of my Gabor/LogGabor implementation.&#xA;The code is in Matlab, the convolutions are done in Fourier space. The complexity is $O(n log n)$ and it depends only on the image dimensions, not on the filter dimensions. The code follows the guidelines in &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.74.4550&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boukerroui et al.&lt;/a&gt;. It is developed by me and released under MIT licence (not shown here) so feel free to use it as you see fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Img must be a MxNx1 of doubles, (preferably between 0 and 1 but it should work with 0-255 too); P0 is the tuning period (wavelength), that is, $P_0=1/f$, where f is tuning frequency; Orient is the filter orientation, expressed in radians; FBW frequency bandwidth in octaves; ABW the angle bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ ReConv,ImConv ] = GaborConv( Img, P0,Orient, FBW, ABW,varargin )&#xA; ReConv=Img; ImConv=Img;&#xA; ImgFFt=fft2(Img);&#xA; lg2pi=sqrt(log(2)/pi);&#xA; A=P0*lg2pi*(2^FBW+1)/(2^FBW-1); B=P0*lg2pi*(1/tan(0.5*ABW));&#xA; K=1/(A*B); KF=2*pi/P0;&#xA; [N,M]=size(Img); u0=1/P0*cos(Orient); v0=1/P0*sin(Orient);&#xA; FFilt=zeros([M,N]);&#xA; stx=1/(M-1); sty=1/(N-1);&#xA; [U V]=meshgrid(-0.5:stx:0.5,-0.5:sty:0.5);&#xA; Ur=(U-u0)*cos(Orient)+(V-v0)*sin(Orient);&#xA; Vr=-(U-u0)*sin(Orient)+(V-v0)*cos(Orient);&#xA; FFilt=exp(-pi*(Ur.*Ur.*A.*A+Vr.*Vr.*B.*B)) ;&#xA; FFilt=ifftshift(FFilt);&#xA; normFact=sum(sum((abs(ifft2(FFilt)))));&#xA; RezFreq=FFilt.*ImgFFt/normFact; RezSpace=ifft2(RezFreq);&#xA; ReConv=real(RezSpace); ImConv=imag(RezSpace);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Log Gabor method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [  ReConv,ImConv ] = LogGaborConv( Img, P0,Orient, FBW, ABW,useCos ).&#xA; ReConv=Img;&#xA; ImConv=Img;&#xA; ImgFFt=fft2(Img);&#xA; %Compute the k_beta according to the desired frequency bandwidth&#xA; kBeta=exp(-1/4*sqrt(2*log(2))*FBW); &#xA; gaussSD=sqrt(ABW^2/(2*log(2))); %compute Gauss SD to ensure that Gauss(ABW,0,SD)==0.5&#xA; lnkB2=2*log(kBeta)^2;&#xA; nc=exp(-1/8*lnkB2/2)*sqrt(-2*sqrt(pi)/(1/P0*log(kBeta)));&#xA; [N M]=size(Img);&#xA; stx=1/(M-1);&#xA; sty=1/(N-1);&#xA; [Ug Vg]=meshgrid(-0.5:stx:0.5,-0.5:sty:0.5);&#xA; Radius=sqrt(Ug.^2+Vg.^2);&#xA; Radius = ifftshift(Radius);&#xA; Radius(1,1)=1;&#xA; Radius = fftshift(Radius);&#xA; %prepare a low pass filter, as proposed by Kovesi&#xA; lowpass=1./(1+(Radius./0.45).^(30));&#xA; %Compute the bandpass filter&#xA; logRad=nc*exp(-log(Radius*P0).^2/lnkB2);&#xA; RadialBP=logRad.*lowpass;&#xA; %Compute the angle component&#xA; Theta=atan2(Vg,Ug);&#xA; sintheta = sin(Theta);&#xA; costheta = cos(Theta);&#xA; ds = sintheta * cos(Orient) - costheta * sin(Orient);&#xA; dc = costheta * cos(Orient) + sintheta * sin(Orient);&#xA; dtheta = abs(atan2(ds,dc));&#xA; if ~exist('useCos','var')&#xA;     useCos=0;&#xA; end&#xA; if useCos==0&#xA;     %Use a gauss angle&#xA;     AngFilter=exp(-dtheta.^2/(2*gaussSD^2));&#xA; else&#xA;     %Use a cosine angle&#xA;     AngFilter=cos(dtheta).^2.*heaviside(dtheta./pi+0.5).*heaviside(0.5-dtheta./pi);&#xA; end&#xA; logGaborFilt=RadialBP.*AngFilter;&#xA; logGaborFilt=ifftshift(logGaborFilt);&#xA; logGaborFilt(1,1)=0;&#xA; normFact=sum(sum((abs(ifft2(logGaborFilt)))));&#xA; RezFreq=logGaborFilt.*ImgFFt/normFact;&#xA; RezSpace=ifft2(RezFreq);&#xA; ReConv=real(RezSpace);&#xA; ImConv=imag(RezSpace);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As for how the DC response varies with various parameters and why, a comprehensive discussion is in &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.74.4550&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boukerroui et al.&lt;/a&gt;, equations (19) and (20) at pages 75, 76. Take a peek at Appendix C (pag 101). I would like to redirect you to the paper rather than just copy/paste the relevant paragraphs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps!&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="5737" LastEditDate="2014-02-04T16:29:24.967" LastActivityDate="2014-02-04T16:29:24.967" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14202" PostTypeId="2" ParentId="14187" CreationDate="2014-02-04T16:13:38.727" Score="0" Body="&lt;p&gt;Given the response of an LTI system to an impulse input, it is then easy to get the corresponding output to an arbitrary input. An arbitrary input can be seen as the sum of weighted and time-delayed impulses. Because the systems is Linear Time Invariant (LTI) the output is simply obtained summing the weighted and time delayed versions of the impulse response. The weighting and time delay factors are exactly the same as those used in obtain the input signal from an impulse.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-02-04T16:13:38.727" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14203" PostTypeId="2" ParentId="14199" CreationDate="2014-02-04T16:49:38.257" Score="4" Body="&lt;p&gt;I would like to add some notes to @visoft's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Log-gabor filter is a very good one alternative to gabor filter has no DC component. Yet in ordinary gabor filter it is also possible to remove the DC component. See the Matlab code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [GABOUT1,GABOUT2]=gaborfilter(I,S,F,W,P)&#xA;&#xA;if isa(I,'double')~=1&#xA;    I=double(I);&#xA;end&#xA;size=fix(1.5/S); % exp(-1.5^2*pi) &amp;lt; 0.1%&#xA;&#xA;k=1;&#xA;for x=-size:size&#xA;    for y=-size:size&#xA;        G1(size+x+1,size+y+1)=k*exp(-pi*S^2*(x*x+y*y))*...&#xA;            (exp(sqrt(-1)*(2*pi*F*(x*cos(W)+y*sin(W))+P)));&#xA;        G2(size+x+1,size+y+1)=k*exp(-pi*S^2*(x*x+y*y))*...&#xA;            (exp(sqrt(-1)*(2*pi*F*(x*cos(W)+y*sin(W))+P))-exp(-pi*(F/S)^2+sqrt(-1)*P));&#xA;    end&#xA;end&#xA;&#xA;GABOUT1=conv2(I,double(G1),'same');&#xA;GABOUT2=conv2(I,double(G2),'same');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the code &lt;code&gt;exp(-pi*(F/S)^2+sqrt(-1)*P))&lt;/code&gt; is the DC component due to the overlapping. And &lt;code&gt;GABOUT1&lt;/code&gt; is the filtered image with DC component, while &lt;code&gt;GABOUT2&lt;/code&gt; is the filtered image with the compensation of DC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue with DC component is that one cannot achieve both broad spectral information and maximal spatial localization. As a result, you may over-estimate the low-frequency components but under-estimate the high-frequency components in a image. And &lt;strong&gt;this is especially reflected if you observe the magnitude of the filtered image. But there is no evident difference if you are observing the imag part of the image.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check one example below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I=imread('cat.jpg');&#xA;I=rgb2gray(I);&#xA;imshow(I),figure,&#xA;[G1,G2]=gaborfilter(I,0.5,0.1,0,0);&#xA;I1=abs(G1);&#xA;I1=I1/max(I1(:))*256;&#xA;imshow(uint8(I1))&#xA;&#xA;I2=abs(G2);&#xA;I2=I2/max(I2(:))*256;&#xA;figure,imshow(uint8(I2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rarrb.jpg&quot; width=&quot;210&quot; height=&quot;150&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/R0EmA.jpg&quot; width=&quot;210&quot; height=&quot;150&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PHvuu.jpg&quot; width=&quot;210&quot; height=&quot;150&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compared with the original image (left), the filtered one with DC component (middle) deteriorates at the high frequency, while the one without DC component (right) enhances the high-frequency details (tiny edges at various orientations) very much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can observe the imag part of the filtered image by changing the code to &lt;code&gt;I1=imag(G1);&lt;/code&gt; and &lt;code&gt;I2=imag(G2);&lt;/code&gt; and you may not see that much difference, i.e., the influence of DC component is not that much at the imag part of the filtered image.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-04T16:49:38.257" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14204" PostTypeId="1" AcceptedAnswerId="14205" CreationDate="2014-02-04T16:58:21.157" Score="2" ViewCount="614" Body="&lt;p&gt;I am working on Despeckling Ultrasound images. I have been trying out some basic filters and their hybrid combination.. Now I would like to try Diffusion Filtering techniques to despeckle the ultrasound images. I don't know anything about the diffusion filtering techniques (Isotropic diffusion or Perona Malik Anisotropic Diffusion Filter). I would like to learn from the basic. Please suggest some books to learn about Diffusion techniques.. Please keep in mind that I am not an advanced learner. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did google and found this book (&lt;a href=&quot;http://books.google.co.in/books?id=EVoNLGlAbnkC&amp;amp;printsec=frontcover&amp;amp;dq=despeckling&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=SxfxUpurPMS3rgfft4H4AQ&amp;amp;ved=0CCwQ6AEwAA#v=onepage&amp;amp;q=despeckling&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;Despeckle Filtering Algorithms and Software for Ultrasound Imaging By Christos P. Loizou, Constantinos S. Pattichis, Costas Pattichis&lt;/a&gt;) very useful. But I couldn't able to buy it. If anyone have the PDF of this book (even 1 or 2 chapters), please provide me the link. Also provide some useful links to learn these techniques&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="7092" LastEditDate="2017-05-10T02:26:21.337" LastActivityDate="2017-05-10T02:26:21.337" Title="Despeckling Ultrasound images using Diffusion Filtering" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14205" PostTypeId="2" ParentId="14204" CreationDate="2014-02-04T17:46:18.757" Score="1" Body="&lt;p&gt;Reference: &lt;a href=&quot;http://www.lpi.tel.uva.es/muitic/pim/docus/anisotropic_diffusion.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Anisotropic Diﬀusion in Image Processing by Joachim Weickert&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No matter where would you learn the theoretical background of the diffusion techniques, I would like to apply the Matlab implementation on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Anisotropic_diffusion#Formal_definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;2nd formal definition&lt;/a&gt; of anisotropic diffusion, it is not difficult. I used the ultrasound B-scan image you used before.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I=imread('ultrasound.png');&#xA;I=rgb2gray(I);&#xA;subplot(1,2,1)&#xA;imshow(I);&#xA;[rows, cols]=size(I);&#xA;diff = double(I); % original image&#xA;lambda = 0.25; &#xA;niter = 10;&#xA;Co = 20;&#xA;for i = 1:10  % iterations&#xA;&#xA;  % Construct diffl which is the same as diff but&#xA;  % has an extra padding of zeros around it.&#xA;  diffl = zeros(rows+2, cols+2);&#xA;  diffl(2:rows+1, 2:cols+1) = diff;&#xA;&#xA;  % North, South, East and West differences&#xA;  deltaN = diffl(1:rows,2:cols+1)   - diff;  &#xA;  deltaS = diffl(3:rows+2,2:cols+1) - diff;  &#xA;  deltaE = diffl(2:rows+1,3:cols+2) - diff;  &#xA;  deltaW = diffl(2:rows+1,1:cols)   - diff;&#xA;&#xA;  cN = 1./(1 + (deltaN/Co).^2);&#xA;  cS = 1./(1 + (deltaS/Co).^2);&#xA;  cE = 1./(1 + (deltaE/Co).^2);&#xA;  cW = 1./(1 + (deltaW/Co).^2);&#xA;&#xA;  diff = diff + lambda*(cN.*deltaN + cS.*deltaS + cE.*deltaE + cW.*deltaW);&#xA;&#xA;end&#xA;subplot(1,2,2),imshow(uint8(diff))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see the edge preserving effect of diffusion filter (right) compared with the speckled noisy image (left).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qw0mT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-05T01:15:47.787" LastActivityDate="2014-02-05T01:15:47.787" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="14206" PostTypeId="1" CreationDate="2014-02-04T18:56:40.553" Score="-1" ViewCount="91" Body="&lt;p&gt;SO i have to calculate the PSD of mentioned input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is my code. (every little thing written wholly and solely by myself)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = 100;  % number of packets of size 1kB&#xA;P_final = 0; %final PSD&#xA;&#xA;while(x ~= 1)  % loops over 100 packets&#xA;b = rand(1,8192); %1kB packet with equally likely 1s and 0s maaped to -1s and +1s &#xA;                  %with threshold of 0.5&#xA;%generating the packet&#xA;for n = 1 : 8192&#xA;   if(b(n) &amp;lt;= 0.5)&#xA;      b(n) = -1;&#xA;   else&#xA;      b(n) = +1;&#xA;   end&#xA;end&#xA;B = fft(b,8192);      %taking fourier of single packet&#xA;Pbb = B.*conj(B);     %calculating PSD&#xA;P_final = P_final + Pbb;  %summing all PSDs for averaging later for 100 packets&#xA;&#xA;&#xA;x = x - 1; %while loop check&#xA;end        %end of while loop&#xA;&#xA;P_final = P_final/100;  % averaging PSDs of 100 packets&#xA;&#xA;&#xA;plot(P_final) %plotting the PSD&#xA;title('Power spectral density')&#xA;xlabel('Frequency (Hz)')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now the problem is i am getting the output as &lt;img src=&quot;https://i.stack.imgur.com/9TnUm.jpg&quot; alt=&quot;PSD_incorrect&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as told in assignment. The output is a sinusoid. which means that its PSD should have one peak and other very small frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked my logic which seems right to me. But i still cant get the output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be highly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT # 1&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ErGuZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7553" LastEditorUserId="7553" LastEditDate="2014-02-05T12:42:06.163" LastActivityDate="2014-04-06T14:59:17.277" Title="PSD of a 100 1kB packets with equally probable 1s and 0s" Tags="|matlab|power-spectral-density|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14207" PostTypeId="1" CreationDate="2014-02-04T19:24:07.093" Score="0" ViewCount="54" Body="&lt;p&gt;The following pictures describe my situation. Any thoughts on an appropriate algorithm I could use to solve this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9m5Mb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7792" LastActivityDate="2014-02-04T20:00:19.837" Title="Non-linearly additive spectral subtraction?" Tags="|algorithms|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14208" PostTypeId="1" AcceptedAnswerId="14329" CreationDate="2014-02-04T19:47:51.177" Score="2" ViewCount="223" Body="&lt;p&gt;A key result in compressive sensing states that, with high probability on the random&#xA;draw of an $\ m × N$ Gaussian or Bernoulli matrix $\ A$, all $\ s$-sparse vectors $\ x$ can be reconstructed from $\ y = Ax$ using a variety of algorithms provided &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ m ≥ Cs\ln(N/s)$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\ C &amp;gt; 0$ is a universal constant (independent of $\ s, m,$  and $\ N$). This bound is in fact optimal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practical terms, how does one interpret/find $\ C$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;source: &lt;a href=&quot;http://www.cis.pku.edu.cn/faculty/vision/zlin/A%20Mathematical%20Introduction%20to%20Compressive%20Sensing.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cis.pku.edu.cn/faculty/vision/zlin/A%20Mathematical%20Introduction%20to%20Compressive%20Sensing.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4038" LastActivityDate="2014-02-14T09:55:49.110" Title="Constant used to determine the minimum samples in Compressed Sensing" Tags="|computer-vision|compressive-sensing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14209" PostTypeId="2" ParentId="14207" CreationDate="2014-02-04T20:00:19.837" Score="1" Body="&lt;p&gt;It's difficult to suggest an algorithm without knowing more about the nature of these signals, but if it really is as simple as the above situation, then a spectral subtraction approach which uses the reference 'Single Substance' signal to activate a binary mask might do the job for you.&lt;/p&gt;&#xA;" OwnerUserId="4391" LastActivityDate="2014-02-04T20:00:19.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14210" PostTypeId="1" AcceptedAnswerId="14236" CreationDate="2014-02-05T06:41:20.877" Score="2" ViewCount="1956" Body="&lt;p&gt;I am doing my Bachelor's project on Road extraction. I have detected the line segments(edges) in the image using hough transform. I need to detect the curved lines in the road and link them(edge linking).&lt;img src=&quot;https://i.stack.imgur.com/R6siB.jpg&quot; alt=&quot;Kindly&quot;&gt; help me with matlab coding.&lt;/p&gt;&#xA;" OwnerUserId="7799" LastActivityDate="2014-02-06T16:26:03.733" Title="How to trace the edges on matlab" Tags="|image-processing|matlab|edge-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14211" PostTypeId="1" AcceptedAnswerId="14216" CreationDate="2014-02-05T09:53:09.400" Score="4" ViewCount="3204" Body="&lt;p&gt;Suppose you have a signal $s(t)$, corrupted by Gaussian noise of $\eta(t)$ with zero mean and standard deviation $\sigma$. So that the measured signal is $f(t)=s(t)+\eta(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now want to calculate the spectrum of the signal using FFT. For my particular case, I have found that for wavenumbers $q$ above a given cuttoff value $q_c$ (e.g. for short wavelengths), my spectrum of $s(t)$ will run into the noise floor of $\eta$. The noise floor due to the (ideal) Gaussian noise $\eta(t)$ in Fourier space is given by $\int \sigma^2 dt$ and thus depends on the length of sampling interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible to modify the noise-floor of the frequency spectrum in Fourier space by reducing the length of the sampling interval in the time-domain and thus gain SNR for a certain $q$-range of interest? In other words, could I do something like high-pass filter the whole signal and then take the FFT of a short region to reduce the noise. Or perhaps do something similar.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If this is conceptually flawed, why?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If it is not flawed, how would I do this and what are the limits/tradeoffs to doing this (obviously there has to be a limit). Also, what are the implications/requirements for the stationarity vs. non-stationarity of signal $s(t)$ in order to justify this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7424" LastEditorUserId="1629" LastEditDate="2016-05-18T08:17:49.853" LastActivityDate="2016-05-18T08:17:49.853" Title="Effect of sampling interval length and Gaussian noise on the frequency-spectrum" Tags="|fft|frequency-spectrum|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14212" PostTypeId="1" CreationDate="2014-02-05T10:37:24.773" Score="3" ViewCount="8763" Body="&lt;p&gt;In my project I am extracting the lines of an image with openCV2 by firstly creating a skeleton: I convert it to a binary image, invert it (to make it work with morphological operations) and then perform a bunch of morphological operations. Then I apply the canny edge detector on the skeleton and perform a Hough transformation.&lt;/p&gt;&#xA;&lt;p&gt;Now the important part: In order to remove the gaps I perform a closing operation. My problem now is that there are still some gaps and fragments and I can't apply the closing operation one more time because its idempotent (only applicable once).&lt;/p&gt;&#xA;&lt;p&gt;I want to refine the lines by closing all gaps and possibly thicken the lines. How may I achieve this?&lt;/p&gt;&#xA;&lt;p&gt;Here some images to illustrate my problem.&lt;/p&gt;&#xA;&lt;h3&gt;Original image&lt;/h3&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qHtCP.png&quot; alt=&quot;original&quot; /&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Processed image&lt;/h3&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6ABXL.png&quot; alt=&quot;processed&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;See those tiny lines which protrude from the edges? Or the interruptions in a straight line?&lt;br&gt;&#xA;For the gaps in the lines I thought about looping through the matrix and if the points left and right of a pixel are 1 (drawn), then that particular pixel should also be set to 1. Would that be a good solution?&lt;/p&gt;&#xA;" OwnerUserId="5295" LastEditorUserId="-1" LastEditorDisplayName="user11906" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-05-14T01:08:42.693" Title="Refining lines in an image with openCV" Tags="|image-processing|computer-vision|opencv|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14213" PostTypeId="1" AcceptedAnswerId="14214" CreationDate="2014-02-05T10:38:49.737" Score="2" ViewCount="400" Body="&lt;p&gt;I have the following aerial image (apparently taken from an airplane):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hHDOA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have a map of the area shown in the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the image and the map I can mark the corresponding streets, street intersections and landmarks (I have shown only three here, but I can provide more points for precision).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to skew the map to match the image (camera position, angle, etc).  How can I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I can program OpenCV and AForge.Net, and can use Gimp and Blender, all on Windows.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0bkFz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5025" LastEditorUserId="5025" LastEditDate="2014-02-05T10:58:21.757" LastActivityDate="2014-02-05T14:39:09.877" Title="Skew map to match aerial image" Tags="|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14214" PostTypeId="2" ParentId="14213" CreationDate="2014-02-05T11:45:13.833" Score="2" Body="&lt;p&gt;Well you could try to estimate a transformation matrix that maps between the coordinates in the two images. The idea is that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\begin{bmatrix}&#xA;x_a\\&#xA;y_a&#xA;\end{bmatrix}&#xA;=&#xA;\begin{bmatrix}&#xA;A_{xx} &amp;amp; A_{yx}\\&#xA;A_{xy} &amp;amp; A_{yy}&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;x_m\\&#xA;y_m&#xA;\end{bmatrix}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_a, y_a$ are the coordinates (in pixels for example) of the aerial image and $x_m, y_m$ are the coordinates of the photograph. Writing this out leads to the system of equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;x_a = A_{xx}x_m + A_{yx}y_m&#xA;\end{equation}&#xA;\begin{equation}&#xA;y_a = A_{xy}x_m + A_{yy}y_m&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way you can represent scaling, rotation and shearing operations between the images. You need at least four points per image to solve that system but I recommend more and then calculate the least squares solution using linear regression. This will also give you an indication on how well everything works. If there are large residual errors after the fit, then the linear transformation might not be sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you then want to overlay the images, just apply the transformation matrix to your map and the result should be an image that has the reference coordinates on top of each other and the areas in between are linearly transformed accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many things that can go wrong here. For once, it only works for roughly flat terrain  (even though that effect becomes weaker if the plane is further away). Also, if there is lens distortions in the photograph, that will affect the accuracy of the fit (usually close to the image borders). And finally, map inaccuracies might throw you off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, it's just a matter of trying. If the 2D-transformation model is not capable of delivering accurate results, you need to model more effects. But estimating those will probably also require more referene points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other idea would be to put the image on a plane (like a texture) and place the plane in a 3D-space and match it with the plane of the photograph. That would end you up with a 3-dimensional transformation matrix for this plane. Might work as well.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-02-05T11:45:13.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14215" PostTypeId="1" CreationDate="2014-02-04T18:10:37.677" Score="0" ViewCount="85" Body="&lt;p&gt;I am trying to perform the fast fourrier transform to non uniformly sampled data . The output is in the following image &lt;img src=&quot;https://i.stack.imgur.com/4buwl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was obtained using the following code in &lt;strong&gt;MATLAB&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% x is the sampled signal&#xA;%% t is the sampling instances&#xA;L=size(x,1);&#xA;t_new = linspace(t(1),t(end),L); &#xA;&#xA;% Performing interpolation to obtain a uniformly sampled signal&#xA;x_new_cubic = interp1(t,x,t_new,'cubic'); &#xA;x_new_pchip =interp1(t,x,t_new,'pchip');&#xA;x_new_spline = interp1(t,x,t_new,'spline');&#xA;&#xA;NFFT = 2^nextpow2(L);&#xA;X = fft(x_new_cubic,NFFT)/L;&#xA;F=1000*linspace(0,1,NFFT/2+1);&#xA;&#xA;figure;&#xA;&#xA;subplot(121);&#xA;plot(F,20*log10(abs(X(1:NFFT/2+1))));&#xA;xlabel('Frequency[Hz]');&#xA;ylabel('|X|[dB]');&#xA;w =  hamming(L,'periodic');&#xA;x_win = w.*x_new_cubic(1:L)';&#xA;X_win = fft(x_win,NFFT)/L;&#xA;&#xA;subplot(122);&#xA;plot(F,20*log10(abs(X_win(1:NFFT/2+1))));&#xA;xlabel('Frequency[Hz]');&#xA;ylabel('|X|[dB]');&#xA;title('Hamming Window')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that I can't trust such result, but I am not sure too. Can any one give me some advice?&lt;/p&gt;&#xA;" OwnerUserId="7806" OwnerDisplayName="user2536125" LastActivityDate="2014-02-05T11:49:26.950" Title="Fast Fourrier Transform of real measurements in Matlab" Tags="|matlab|" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="14216" PostTypeId="2" ParentId="14211" CreationDate="2014-02-05T12:48:58.850" Score="3" Body="&lt;p&gt;Yes, you're on the right track. The key thing that would help you would not involve decreasing your sampling interval, but &lt;em&gt;increasing your observation duration&lt;/em&gt;. Here's a qualitative explanation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall the &lt;a href=&quot;https://dsp.stackexchange.com/questions/5915/what-is-the-meaning-of-the-dft/5921#5921&quot;&gt;filterbank interpretation of the DFT&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \sum_{n=0}^{N-1} x[n] e^{\frac{-j2\pi k n}{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this view of the transform, the DFT implements a uniformly-spaced bank $N$ of critically-sampled filters. The frequency response of each filter in normalized frequency $\omega$ has the shape of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Dirichlet_kernel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dirichlet kernel&lt;/a&gt;, whose width is inversely proportional to $N$. So, as you increase the observation duration, you implicitly increase $N$, meaning that each bandpass filter covers a smaller portion of the frequency band. That means that proportionally less noise power is passed by each bin's corresponding filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can help you if you're analyzing a narrowband signal such as a sinusoidal tone. Again, think of that situation as placing a bunch of bandpass filters in the hope that one will catch your signal of interest. You will maximize the SNR in the resulting observations by making those bandpass filters as narrow as possible, i.e. by making your DFT as long as possible. Thus, you can increase your DFT length in order to &quot;push down the noise floor.&quot; To those who are familiar with &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrum_analyzer&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectrum analyzers&lt;/a&gt;, this is analogous to decreasing the resolution bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also make a theoretical argument for why this is the case. Assume the unitary definition of the DFT to avoid having scaling factors get in the way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \frac{1}{\sqrt{N}}\sum_{n=0}^{N-1} x[n] e^{\frac{-j2\pi k n}{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And recall &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Parseval's theorem&lt;/a&gt; for the DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{n=0}^{N-1} |x[n]|^2 = \sum_{k=0}^{N-1} |X[k]|^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that $x[n]$ is a zero-mean white noise process with variance $\sigma^2$ and take the expectation of both sides:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{n=0}^{N-1} \mathbb{E}\left(|x[n]|^2\right) = \sum_{k=0}^{N-1} \mathbb{E}\left(|X[k]|^2\right)&#xA;$$&#xA;$$&#xA;N \sigma^2 = N \mathbb{E}\left(|X[k]|^2\right)&#xA;$$&#xA;$$&#xA;\sigma^2 = \mathbb{E}\left(|X[k]|^2\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I have made the assumption that $\mathbb{E}\left(|X[k]|^2\right)$ is a constant independent of $k$ (which is true, but I haven't shown it here; you can see a proof in &lt;a href=&quot;http://users.ece.gatech.edu/mrichard/DFT%20of%20Noise.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this analysis of white noise in the frequency domain&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The takeaway from this is that as you increase the DFT size $N$, the expected value of the noise spectrum's squared magnitude doesn't change under the unitary definition of the transform. However, let's look at what happens to the same quantity for the case of $x[n]$ being a sinusoidal tone of interest. Assume without loss of generality that the tone is at zero frequency (i.e. it is a constant; I will assume $x[n] = 1$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \frac{1}{\sqrt{N}}\sum_{n=0}^{N-1} x[n] e^{\frac{-j2\pi k n}{N}}&#xA;$$&#xA;$$&#xA;X[k] = \frac{1}{\sqrt{N}}\sum_{n=0}^{N-1} e^{\frac{-j2\pi k n}{N}}&#xA;$$&#xA;$$&#xA;X[k] = \frac{1}{\sqrt{N}} N \delta[k]&#xA;$$&#xA;$$&#xA;X[k] = \sqrt{N} \delta[k]&#xA;$$&#xA;$$&#xA;|X[k]|^2 = N \delta[k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This illustrates the payoff:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As you increase the DFT size $N$, the expected squared magnitude of the noise process in the frequency domain stays constant. However, the expected frequency-domain squared magnitude for a narrowband signal is proportional to $N$. Therefore, you can effectively increase the frequency-domain SNR by increasing the transform length $N$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A bonus illustration in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% tone at zero frequency plus noise&#xA;x = 1+randn(1e5,1);  &#xA;% calculate DFTs of various lengths&#xA;X1 = 1/sqrt(100)*fft(x(1:1e2));&#xA;X2 = 1/sqrt(1e3)*fft(x(1:1e3));&#xA;X3 = 1/sqrt(1e4)*fft(x(1:1e4));&#xA;X4 = 1/sqrt(1e5)*fft(x);&#xA;% plot them all&#xA;figure;&#xA;hold all;&#xA;plot(10*log10(abs(X1).^2));&#xA;plot(10*log10(abs(X2).^2));&#xA;plot(10*log10(abs(X3).^2));&#xA;plot(10*log10(abs(X4).^2));&#xA;% zoom in on the first part of the plot&#xA;a = axis;&#xA;a(1:2) = [1 10];&#xA;axis(a);&#xA;legend('N = 100', 'N = 1000', 'N = 10000', 'N = 100000');&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tiIMv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the logarithmic scaling on the Y axis, showing the proportionality to $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A final note to address the other part of your question: there are of course limits to what you can accomplish here. One key one is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Uncertainty_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncertainty principle&lt;/a&gt;; namely, when you increase the transform length in this way to gain resolution on the frequency axis, you lose a corresponding amount of time resolution. Secondly, your results may vary if your signal of interest or your background noise is not stationary over your observation interval; increasing the transform duration obviously increases the chances of this occurring.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-02-05T12:48:58.850" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14218" PostTypeId="2" ParentId="14212" CreationDate="2014-02-05T13:05:55.110" Score="2" Body="&lt;p&gt;If you are trying to remove the gaps during hough transform, you can set &lt;code&gt;minLineLength&lt;/code&gt;(Minimum length of line. Line segments shorter than this are rejected) and &lt;code&gt;maxLineGap&lt;/code&gt; (Maximum allowed gap between line segments to treat them as single line) in &lt;a href=&quot;http://docs.opencv.org/trunk/doc/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html#probabilistic-hough-transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;cv2.HoughLinesP()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some results from the morphological operations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2X1f2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-06T15:43:28.147" LastActivityDate="2014-02-06T15:43:28.147" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14220" PostTypeId="1" AcceptedAnswerId="14226" CreationDate="2014-02-05T13:33:15.563" Score="4" ViewCount="4092" Body="&lt;p&gt;I want to know that why large laplacian spatial filtering is done on EEG signals? I tried a lot but could not find material on LLSF. And what is meant by spatial filter ( in context of Digital Signal Processing)? Why is it called &quot;Large&quot; and &quot;laplacian&quot;? &lt;/p&gt;&#xA;" OwnerUserId="7112" OwnerDisplayName="Muhammad Akmal" LastEditorUserId="7092" LastEditDate="2014-02-05T16:20:26.990" LastActivityDate="2014-02-05T17:40:23.940" Title="Large Laplacian Spatial Filter on EEG?" Tags="|filters|discrete-signals|signal-analysis|eeg|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14221" PostTypeId="1" AcceptedAnswerId="14224" CreationDate="2014-02-05T14:16:56.190" Score="0" ViewCount="6259" Body="&lt;p&gt;this is a crosspost from stackoverflow as I figured there may be more who can help me here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been writing a basic C program to generate a sine wave and write it out to STDOUT for piping into a filter which I am also going to write but I'm having issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to generate what sounds like a good clean sine wave, but the frequency is off.  When I listen to the output I am generating and compare to a true signal generators output, the frequency of mine is slightly too high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The C code should generate raw 16 bit signed stereo wav @ 44100Hz for a frequency passed as an argument to the program, or 500Hz as default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A matlab version of the code is here, (modded very slightly for 1 indexing in Matlab, WHY MATHWORKS WHY!?) minus the passing to STDOUT etc as I know that works fine&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CHANNELS = 2; SAMPLING_RATE = 44100; NUM_SAMPLES = 512;&#xA;&#xA;frequency = 1000;&#xA;&#xA;%% BEGIN WHILE(1) LOOP HERE&#xA;&#xA;output_buff = zeros(1,CHANNELS*NUM_SAMPLES);&#xA;&#xA;for i = 1:2:CHANNELS*NUM_SAMPLES&#xA;    output_buff(i) = 30000 * sin(frequency * pi * (i-1)/NUM_SAMPLES);&#xA;    output_buff(i+1) = output_buff(i);&#xA;end&#xA;&#xA;%% OUTPUT TO STDOUT AND REPEAT&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I should add that this code runs (in the C version) inside a while true loop, generating a full output_buff of values, then pushing the buffer to STDOUT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have written some further testing code to see what's actually being generated as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(1:CHANNELS*NUM_SAMPLES, output_buff)&#xA;&#xA;output_buff = output_buff .* hanning(length(output_buff))';    &#xA;Y = fft(output_buff);    &#xA;Mag=abs(Y(1:length(output_buff)/2)).^2;    &#xA;[a,b]=max(Mag);    &#xA;% Result    &#xA;SAMPLING_RATE*b/length(output_buff)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I run this script, I can see at the end the frequency of the generated signal is actually 1.0767e+03Hz... Close but no cigar...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried tweaking some of the parameters but I have no idea what's wrong or how to make the generated frequency more accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The C code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;sys/types.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;errno.h&amp;gt;&#xA;#include &amp;lt;string.h&amp;gt;&#xA;&#xA;#include &amp;lt;unistd.h&amp;gt;&#xA;&#xA;#define M_PI 3.1415926535897932384626433832795L&#xA;#define NUM_CHANNELS 2&#xA;#define NUM_SAMPLES 1024&#xA;#define SAMPLE_RATE 44100&#xA;&#xA;double frequency = 500.0;&#xA;&#xA;int main(int argc, char *argv[])&#xA;{   &#xA;    if (argc &amp;gt;= 2){&#xA;        frequency = atof(argv[1]);&#xA;    }&#xA;&#xA;    int16_t samples[NUM_CHANNELS * NUM_SAMPLES];&#xA;    unsigned cbBuffer=sizeof(samples);&#xA;&#xA;    while(1){&#xA;        for (int i = 0; i &amp;lt; cbBuffer; i+=NUM_CHANNELS){&#xA;            samples[i] = (int16_t) 30000 * sin(frequency * M_PI * (double)i /(double)(NUM_SAMPLES));&#xA;            samples[i+1] = samples[i];&#xA;        }&#xA;&#xA;        int done=write(STDOUT_FILENO, samples, cbBuffer);&#xA;        if(done&amp;lt;0){&#xA;            fprintf(stderr, &quot;%s : Write to stdout failed, error=%s.&quot;, argv[0], strerror(errno));&#xA;            exit(1);&#xA;        }else if(done!=cbBuffer){&#xA;            fprintf(stderr, &quot;%s : Could not read requested number of bytes from stream.\n&quot;, argv[0]);&#xA;        }&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I changed the C code as follows and I now get a nice smooth sine wave but the frequency is way too low&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int main(int argc, char *argv[])&#xA;{   &#xA;    if (argc &amp;gt;= 2){&#xA;        frequency = atof(argv[1]);&#xA;    }&#xA;&#xA;    int16_t samples[NUM_CHANNELS * NUM_SAMPLES];&#xA;    unsigned cbBuffer=sizeof(samples);&#xA;    int counter = 0;&#xA;&#xA;    while(1){&#xA;        for (int i = 0; i &amp;lt; NUM_CHANNELS * NUM_SAMPLES; i+=NUM_CHANNELS){&#xA;            samples[i] = (int16_t) 3000 * sin(frequency * M_PI * (double)counter /(double)(SAMPLE_RATE));&#xA;            samples[i+1] = samples[i];&#xA;            counter++;&#xA;        }&#xA;&#xA;        int done=write(STDOUT_FILENO, samples, cbBuffer);&#xA;        if(done&amp;lt;0){&#xA;            fprintf(stderr, &quot;%s : Write to stdout failed, error=%s.&quot;, argv[0], strerror(errno));&#xA;            exit(1);&#xA;        }else if(done!=cbBuffer){&#xA;            fprintf(stderr, &quot;%s : Could not read requested number of bytes from stream.\n&quot;, argv[0]);&#xA;        }&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7803" LastEditorUserId="7803" LastEditDate="2014-02-05T14:48:16.053" LastActivityDate="2014-02-05T14:50:35.063" Title="Trouble Generating a Sine Wave in C/Matlab from Basics" Tags="|matlab|discrete-signals|c|signal-synthesis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14222" PostTypeId="2" ParentId="14206" CreationDate="2014-02-05T14:35:32.987" Score="0" Body="&lt;pre&gt;&lt;code&gt;nx = 8192; psd = zeros(nx,1); &#xA;for i = 1:100, x = fft(sign(randn(nx,1))); psd = psd + x.*conj(x); end&#xA;plot(10*log10(psd/100/nx));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You for equal probability of 1s and 0s (or 1s and -1s) for that matter you would expect the white spectrum to be white, i.e. all frequencies are equally likely. The code snippet above shows this, i.e. all frequencies are close to 0 dB with a little bit of noise on top. The more you average the less noise you will get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have been told that the output is a sinusoid, than there must be some misunderstanding in either the problem or solution statement.  &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-02-05T14:35:32.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14223" PostTypeId="2" ParentId="14213" CreationDate="2014-02-05T14:39:09.877" Score="2" Body="&lt;p&gt;The perspective transform between two image planes can be shown as:&#xA;\begin{equation}&#xA;\begin{bmatrix}&#xA;Xw\\&#xA;Yw\\&#xA;w&#xA;\end{bmatrix}&#xA;=&#xA;\begin{bmatrix}&#xA;a &amp;amp; b &amp;amp; c\\&#xA;d &amp;amp; e &amp;amp; f\\&#xA;g &amp;amp; h &amp;amp; 1&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;x\\&#xA;y\\&#xA;1&#xA;\end{bmatrix}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since $w = gx + hy +1$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can change the matrix equation to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\begin{bmatrix}&#xA;X\\&#xA;Y\\&#xA;...&#xA;\end{bmatrix}&#xA;=&#xA;\begin{bmatrix}&#xA;x &amp;amp; y &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -Xx &amp;amp; -Xy\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; x &amp;amp; y &amp;amp; 1 &amp;amp; -Yx &amp;amp; -Yy\\&#xA;...&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;a\\&#xA;b\\&#xA;c\\&#xA;d\\&#xA;e\\&#xA;f\\&#xA;g\\&#xA;h&#xA;\end{bmatrix}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note you have 8 unknowns, which indicates that you need at least 4 independent coordinate correspondences to avoid the underdetermining of the matrix.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-05T14:39:09.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14224" PostTypeId="2" ParentId="14221" CreationDate="2014-02-05T14:50:35.063" Score="0" Body="&lt;p&gt;So I've managed to fix it.  My problem was I wasn't properly taking into account the Sampling Rate of the produced raw wav file, and that by using the loop variable, there is a discontinuity for each iteration of the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final working code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;sys/types.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;errno.h&amp;gt;&#xA;#include &amp;lt;string.h&amp;gt;&#xA;&#xA;#include &amp;lt;unistd.h&amp;gt;&#xA;&#xA;#define M_PI 3.1415926535897932384626433832795L&#xA;#define NUM_CHANNELS 2&#xA;#define NUM_SAMPLES 512&#xA;#define SAMPLE_RATE 44100&#xA;&#xA;double frequency = 500.0;&#xA;&#xA;int main(int argc, char *argv[])&#xA;{   &#xA;    if (argc &amp;gt;= 2){&#xA;        frequency = atof(argv[1]);&#xA;    }&#xA;&#xA;    int16_t samples[NUM_CHANNELS * NUM_SAMPLES];&#xA;    unsigned cbBuffer=sizeof(samples);&#xA;    int counter = 0;&#xA;&#xA;    while(1){&#xA;        for (int i = 0; i &amp;lt; NUM_CHANNELS * NUM_SAMPLES; i+=NUM_CHANNELS){&#xA;            samples[i] = (int16_t) 3000 * sin(frequency * 2 * M_PI * (double)counter /(double)(SAMPLE_RATE));&#xA;            samples[i+1] = samples[i];&#xA;            counter++;&#xA;        }&#xA;&#xA;        int done=write(STDOUT_FILENO, samples, cbBuffer);&#xA;        if(done&amp;lt;0){&#xA;            fprintf(stderr, &quot;%s : Write to stdout failed, error=%s.&quot;, argv[0], strerror(errno));&#xA;            exit(1);&#xA;        }else if(done!=cbBuffer){&#xA;            fprintf(stderr, &quot;%s : Could not read requested number of bytes from stream.\n&quot;, argv[0]);&#xA;        }&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7803" LastActivityDate="2014-02-05T14:50:35.063" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14226" PostTypeId="2" ParentId="14220" CreationDate="2014-02-05T16:57:59.883" Score="5" Body="&lt;p&gt;&lt;strong&gt;Laplacian&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a 2nd derivative of the recorded voltage for each electrode. Suppose the recordings at position $(i,j)$ is $V(i,j)$, then &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_operator#Definition&quot; rel=&quot;noreferrer&quot;&gt;Laplacian operation &lt;/a&gt; at $(i,j)$ is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(V(i,j)-2V(i-1,j)+V(i-2,j))^2 + (V(i,j)-2V(i,j-1)+V(i,j-2))^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it serves as a high-pass filter that enhances localized activity while suppresses the diffusion activity. The implementation of the Laplacian in EEG filtering on the voltage at each electrode is to subtract the weighted voltages from the surrounding electrodes from the voltage recording at current electrode, where the weight is electrode distance dependent. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Large&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference between large and small is determined by how you select the electrodes. For the small Laplacian, you select the nearest-neighbor electrodes, while for the large Laplacian, they are the next-nearest-neighbor electrodes. See the figure below. If the signal you are interested in is less highly localized and/or varies in exact location over &#xA;time, the large Laplacian is expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cxl7W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read the paper &lt;a href=&quot;http://www.ece.uvic.ca/~bctill/research/bci/chmaprefs/McFarland1997.pdf&quot; rel=&quot;noreferrer&quot;&gt;Spatial filter selection for EEG-based communication by Dennis J. McFarland et all&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-05T17:40:23.940" LastActivityDate="2014-02-05T17:40:23.940" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="14228" PostTypeId="1" CreationDate="2014-02-05T19:07:24.047" Score="0" ViewCount="127" Body="&lt;p&gt;Calculating the power of AWGN should be equal to infinity as PSD is constant and its integration is infinity over all frequencies. Hence for any signal with finite power mixed with AWGN, SNR should zero. But this doesn't seems right??&lt;/p&gt;&#xA;" OwnerUserId="7459" LastEditorUserId="128" LastEditDate="2018-06-16T19:12:01.573" LastActivityDate="2018-06-16T19:12:01.573" Title="What is SNR of Signal with Additive White Gaussian Noise" Tags="|noise|power-spectral-density|gaussian|snr|random-process|" AnswerCount="0" CommentCount="2" ClosedDate="2014-02-16T14:58:04.063" ContentLicense="CC BY-SA 4.0" />
  <row Id="14231" PostTypeId="2" ParentId="10997" CreationDate="2014-02-06T07:59:29.573" Score="1" Body="&lt;p&gt;Kalman gain actually defines the amount of correction applied by Kalman filter to the incoming measurements to make them less noisy. As the number of iterations of Kalman filter increases, Kalman gain increases (which actually means the correction applied to noisy measurements increases)and consequently error covariance starts decreasing. i suppose you want to know why kalman gain become constant. Actually after a finite number of iteration the error covariance of the system decreases to a very low value and become constant. At that time Kalman gain reaches the maximum amount of correction it can provide to the incoming noisy inputs.&#xA;Your above Kalman gain settles to a constant value in a very less time. This actually happen when you take process noise covariance very low and error covariance very high.In your above model value of value for diagonal elements of Q  are very low which means that kalman filter assumes that your system is quite accurate(as process noise added by it into system is less due to less Q) hence it doesnot have to provide much correction and quickly settles down to a low error covariance value and a constant kalman gain value.&#xA;one more thing is that all of your systems states vary with time and represents a non-linear system and you must use an extended kalman filter of unscented kalman filter  &lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2014-02-06T07:59:29.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14232" PostTypeId="1" CreationDate="2014-02-06T09:37:26.313" Score="2" ViewCount="335" Body="&lt;p&gt;I am playing around with FFT and cant seem to get the expected results. I have a sound clip that i recorded from a mic placed on an analogue clock. So it has a sound every second.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[wave,fs]=wavread('clock.wav');&#xA;t=0:1/fs:(length(wave)-1)/fs;&#xA;plot(t,wave);&#xA;n=length(wave)-1;                                             &#xA;f=0:fs/n:fs;&#xA;wavefft=abs(fft(wave));&#xA;plot(f,wavefft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the code that i am using. And here are the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should be seeing a huge spike at 1hz but i am not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT followed by the sound wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jeRKx.jpg&quot; alt=&quot;This is the FFT&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PkQwX.jpg&quot; alt=&quot;And this is the sound wave&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7815" LastActivityDate="2014-02-06T18:08:19.247" Title="Need help with FFT results" Tags="|matlab|fft|sound|wave|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14233" PostTypeId="1" CreationDate="2014-02-06T11:20:39.173" Score="0" ViewCount="124" Body="&lt;p&gt;I want to know that what features might be needed for recognizing a word i a sentence exactly?&#xA;I guess the routine for recognizing the word in a sentence is ganna follow this:&#xA;1-calculate voiced and unvoiced and silence frames&#xA;2-determine a threshold &#xA;3- when ever we get to a silence frame,that could be an end point of a word besides considering other features ...&#xA;This is the main idea i guess , and if it is wrong or right or anything else,i would really appreciate if you help me out with completing these steps...&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7070" LastActivityDate="2014-02-06T17:16:54.833" Title="recognizing words in a sentence" Tags="|signal-analysis|speech-recognition|voice|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14235" PostTypeId="1" CreationDate="2014-02-06T12:37:56.497" Score="1" ViewCount="659" Body="&lt;p&gt;i have made a subroutine to calculate 1d fft of a series of size 2^n. I need to calculate discrete sine transform of a series using the fft subroutine. I am not sure what to do.&lt;/p&gt;&#xA;" OwnerUserId="7817" LastActivityDate="2014-02-07T04:33:47.550" Title="discrete sine transform using FFT" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14236" PostTypeId="2" ParentId="14210" CreationDate="2014-02-06T15:15:54.667" Score="0" Body="&lt;p&gt;One possible pre-processing apporach is to use &lt;code&gt;imdilate(I,strel('disk',5))&lt;/code&gt; to thicken the road lines a little bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are trying &lt;code&gt;houghlines&lt;/code&gt;, probably one parameter that you need to tune is the 'FillGap' which will connect the very short segments (you can try to change this parameter yourself to observe the effect, along with the &lt;code&gt;MinLength&lt;/code&gt; value):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lines = houghlines(BW,T,R,P,'FillGap',30,'MinLength',15);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the road curves are not straight lines, so I won't recommend you to use hough transform. You may try &lt;code&gt;bwmorph(bw,'skel',N);&lt;/code&gt; after you thicken the binarized road image. &lt;code&gt;N&lt;/code&gt; is the iteration number that you need to tune.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-06T16:26:03.733" LastActivityDate="2014-02-06T16:26:03.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14237" PostTypeId="1" AcceptedAnswerId="14350" CreationDate="2014-02-06T16:07:35.657" Score="2" ViewCount="2021" Body="&lt;p&gt;Firstly, the context: I've been given a signal in a wav file, the sampling rate and carrier frequency along with the fact it is Manchester encoded and has been ASK Modulated. Five periods of a sinusoidal wave at half frequency of the carrier denote the end of a 'row' and a parity column/row is added. From this I am to reproduce a 300x300 black and white image. My main tool I've been given (never used before) is MatLab. This IS an assignment, and I'm just looking for some answers that I can't find clearly elsewhere. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, from what I understand I've got this &lt;code&gt;y[t]&lt;/code&gt;, which is equal to &lt;code&gt;x[t]*cos(2*pi*1000*t)&lt;/code&gt;. From this signal I need to try and get &lt;code&gt;x[t]&lt;/code&gt; out, then decode it. One of my issues is how to go about extracting this signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long start, and if any of this seems basic. It's an introductory course that just throws us in the deep-end all of a sudden!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 1:&lt;/strong&gt; As this is ASK after Manchester Encoding, I'm guessing each 'bit' will be represented by a group of values from the sample that go from either positive to negative or negative to positive? Is my guess correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2:&lt;/strong&gt; In the samples, there are exactly five (or six, I've forgotten at present) zeros between each group of four non-zero numbers (except at the parts which I'm guessing are the five periods denoting the end of a row). Would these zeroes be useful in the demodulation, or are they just introduced during the sampling phase and not useful for demodulation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 3:&lt;/strong&gt; So, assuming the above questions are correct. To demodulate this signal, would I simply remove all the zero values, then iterate through and denote a '1' when it is positive and a '0' when it is negative (maybe some additional value for when the end of a row is encountered), then pair it up so 10 -&gt; 1 and 01 -&gt; 0?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks for any help, and sorry once more about the length!&lt;/p&gt;&#xA;" OwnerUserId="7819" LastEditorUserId="7092" LastEditDate="2014-02-06T16:27:58.350" LastActivityDate="2014-02-12T15:24:08.757" Title="ASK and Manchester Encoding" Tags="|discrete-signals|demodulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14238" PostTypeId="2" ParentId="14232" CreationDate="2014-02-06T17:10:26.737" Score="2" Body="&lt;p&gt;Since you are looking for a low frequency periodicity in the amplitude envelope of your sound clip, and not the tone waveform or pitch, you might try squaring or taking the absolute value of your signal before applying the fft, and then ignoring higher frequency bins in the result (similar to a cheap AM demodulator).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-02-06T18:08:19.247" LastActivityDate="2014-02-06T18:08:19.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14239" PostTypeId="2" ParentId="14233" CreationDate="2014-02-06T17:16:54.833" Score="1" Body="&lt;p&gt;In sentences in normal human speech, words are usually not separated by silent frames or thresholds.  Humans guess (perhaps some form of expectation driven pattern matching) at word separations, and are sometimes wrong.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-06T17:16:54.833" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14240" PostTypeId="2" ParentId="14232" CreationDate="2014-02-06T17:39:44.533" Score="2" Body="&lt;p&gt;The energy in the ticks is distributed to higher frequencies, too. The base frequency probably is not very strong. You might be looking for broadband signals. I would try to take a time difference of amplitudes. Ticks will have steep temporal edges.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-06T17:39:44.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14241" PostTypeId="1" AcceptedAnswerId="14242" CreationDate="2014-02-06T19:32:22.283" Score="20" ViewCount="47241" Body="&lt;p&gt;How a mean filter is called as linear filter and a median filter is called as non linear filter? I understand how a mean and median filter operates, but I was not able to relate with the term linear and non-linear. Please explain me with an example.&lt;/p&gt;&#xA;" OwnerUserId="7794" LastEditorDisplayName="user40095" LastEditDate="2019-04-04T00:28:22.347" LastActivityDate="2019-04-04T00:28:22.347" Title="What is the difference between linear and non-linear filters?" Tags="|image-processing|filters|discrete-signals|signal-analysis|filtering|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14242" PostTypeId="2" ParentId="14241" CreationDate="2014-02-06T20:51:46.760" Score="20" Body="&lt;p&gt;Nonlinear filters are those for which the linearity relationship breaks down.&#xA;Consider two signals $A$ and $B$, for linear filter such as mean filter $F_m$,you have&#xA;$F_m(A+\lambda B) = F_m(A) + \lambda F_m(B)$, but the equation is not satisfied for an nonlinear filter such as the median filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In application, the median filter removes outliers and shot noise that is independent of magnitude, while mean filter serves as smoothing purpose.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-06T20:51:46.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14243" PostTypeId="2" ParentId="14241" CreationDate="2014-02-06T22:11:58.553" Score="5" Body="&lt;p&gt;In a linear filter, the output will change linearly with a change in the input.  You could plot some sort of straight line from the relationship between the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A median filter can change non-linearly with certain input changes. e.g. take an input vector where all the data values are different: a change in a non-middle value won't affect the median output at all, until when that value rises or falls enough to become the middle item, when it can suddenly completely affect the output.  Thus producing a kinked line (non-linear), instead of a straight line (linear) when the relationship is plotted.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-06T22:11:58.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14244" PostTypeId="1" CreationDate="2014-02-07T01:29:50.030" Score="4" ViewCount="191" Body="&lt;p&gt;For many papers which talks about using wavelet transforms for feature detection in image processing, it is stated that it is advantageous for the wavelet to have zero mean? Why is this so? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7702" LastEditorUserId="5014" LastEditDate="2014-02-07T06:20:36.947" LastActivityDate="2014-02-13T20:01:23.913" Title="mean of wavelet for image processing" Tags="|image-processing|wavelet|local-features|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14245" PostTypeId="1" CreationDate="2014-02-07T02:35:44.390" Score="2" ViewCount="83" Body="&lt;p&gt;I'm using a Hidden Markov Model in order to train an application for gesture recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I have gathered samples, and, using a library have trained these values (They have been passed through a Baum–Welch function in order to train the dataset. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then (in real-time) have computed the gestures of each model, however, I get the wrong result back. I have only ever used a HMM and trained using MFCC features. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the &lt;em&gt;actual&lt;/em&gt; input data have to be passed through the Baum-Welsh function too, in order to compute the Viterbi-Decoder algorithm? When using MFCC, I did not have to perform such an operation, but, I was lead to believe that the HMM can be trained using the MFCC features, in this instance the real-data is just of doubles.&lt;/p&gt;&#xA;" OwnerUserId="1810" LastEditorUserId="76" LastEditDate="2014-02-09T12:44:00.817" LastActivityDate="2014-02-09T12:44:00.817" Title="Does the input data have to be passed through the Baum-Welsh function to compute the Viterbi decoder?" Tags="|hmm|viterbi-algorithm|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14246" PostTypeId="2" ParentId="14235" CreationDate="2014-02-07T04:33:47.550" Score="-1" Body="&lt;p&gt;well, you can do a little Googling and Wikipeding and find &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_sine_transform&quot; rel=&quot;nofollow&quot;&gt;the definitions of the DST&lt;/a&gt; and pick one of them.  The get the definition of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt; (the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;FFT&lt;/a&gt; is an efficient method to compute the DFT), use &lt;a href=&quot;http://en.wikipedia.org/wiki/Euler%27s_formula#Relationship_to_trigonometry&quot; rel=&quot;nofollow&quot;&gt;Euler's formula&lt;/a&gt; on the DST definition and see where a DFT pops out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i might get back to this tonight and spell it out, but if you're not sure where to go next, the above (hit the links) tells you where to approach the problem.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-02-07T04:33:47.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14252" PostTypeId="1" CreationDate="2014-02-07T15:08:54.690" Score="1" ViewCount="1509" Body="&lt;p&gt;I'm trying to figure out how to use DSP techniques in order to both add artificial echoes to a sound file, but more importantly to be able to detect these echoes. I've been reading about it here:&#xA;&lt;a href=&quot;http://www.snotmonkey.com/work/school/405/methods.html#echo&quot; rel=&quot;nofollow&quot;&gt;http://www.snotmonkey.com/work/school/405/methods.html#echo&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me to possibly some example code using Apple's Accelerate framework for being able to detect hidden echoes in sound coming from the microphone?  Also, for detecting the echoes, it is important that the application doesn't need to have knowledge of the original sound, meaning it should be detectable in any sound that's being played that has these echoes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any information.&lt;/p&gt;&#xA;" OwnerUserId="7830" LastActivityDate="2014-05-29T12:43:27.603" Title="Echo hiding technique" Tags="|fft|audio|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14254" PostTypeId="1" CreationDate="2014-02-07T16:54:14.243" Score="0" ViewCount="71" Body="&lt;p&gt;my low pass filter keeps distorting and I'm at a loss to explain why. It calculates the correct coefficients, but distorts everything. The code is as follows. It's driving me mad. What's weird is my high pass works perfectly and it's coded in a similar way, but with a negative b1 coefficent and the same a1 and a2 coeffcients.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float cutoff = 100.00f * M_PI * 2.0f;&#xA;float c      = 2.0f * sampleRate;&#xA;float q      = sqrt(2.0f)/2.0f;&#xA;&#xA;g_a1LP = (2.0f * pow(c, 2.0f) - (2.0f * pow(cutoff, 2.0f))) / (pow(c, 2.0f) + ((cutoff*c)/q) + pow(cutoff, 2.0f));&#xA;g_a2LP = -(pow(c, 2.0f)  + pow(cutoff, 2.0f) - (cutoff*c)/q ) / (pow(c, 2.0f) + ((cutoff*c)/q) + pow(cutoff, 2.0f));&#xA;g_b0LP = 1.0f;&#xA;g_b1LP = 2.0f;&#xA;g_b2LP = 1.0f;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The values for &lt;code&gt;a1 = 1.97985&lt;/code&gt; and &lt;code&gt;a2 = -0.98005&lt;/code&gt;. The actual processing is then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Low pass&#xA;            g_lastLowPassOutSamples[0] = (g_b2LP * g_lastLowPassInSamples[2]) + (g_b1LP * g_lastLowPassInSamples[1]) + (g_b0LP * g_lastLowPassInSamples[0]) +  (g_a2LP * g_lastLowPassOutSamples[2]) + (g_a1LP * g_lastLowPassOutSamples[1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7804" LastEditorUserId="7804" LastEditDate="2014-02-07T16:59:04.020" LastActivityDate="2014-02-07T16:59:04.020" Title="Low pass butterworth filter is distorting" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="0" CommentCount="5" ClosedDate="2014-03-21T00:07:05.640" ContentLicense="CC BY-SA 3.0" />
  <row Id="14258" PostTypeId="1" CreationDate="2014-02-08T03:11:34.940" Score="0" ViewCount="77" Body="&lt;p&gt;I am an ECE student, and I am doing my project on underwater communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main concept of my project is to denoise the signal by using UFB and WPD algorithms, and giving that output to a matched filter. I have already generated the sinewave and added noise and given it to the matched filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I write the code for UFB (uniform filter bank)?&lt;/p&gt;&#xA;" OwnerUserId="7833" LastEditorUserId="76" LastEditDate="2014-02-09T12:41:19.160" LastActivityDate="2014-02-09T12:41:19.160" Title="How can I apply a Gabor filter to a sine waveform?" Tags="|filters|gabor|filter-bank|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14259" PostTypeId="1" AcceptedAnswerId="14589" CreationDate="2014-02-08T04:09:29.213" Score="0" ViewCount="1278" Body="&lt;p&gt;How we define frequency in an image? &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does the repetition of a single gray level defines the frequency?(Example: can a black(single color/constant region) background image be called high frequency image?) I think it is not so.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Or&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does the frequency depends on number of changes in the gray levels in an image? If so Why? I couldn't able to relate the image frequency with the signal frequency where we say high frequency signal when the same cycle is repeated many times in a unit time. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7834" LastActivityDate="2014-02-22T11:32:11.893" Title="How we define frequency in an image?" Tags="|image-processing|discrete-signals|" AnswerCount="3" CommentCount="0" ClosedDate="2014-03-14T13:52:23.020" ContentLicense="CC BY-SA 3.0" />
  <row Id="14260" PostTypeId="1" CreationDate="2014-02-08T06:44:13.337" Score="0" ViewCount="1667" Body="&lt;p&gt;this is for an application in which passwords are stored in the form of audio inputs .&#xA;In order to provide user access , the password(in audio form) will be matched with already stored password(audio only) in the database . I wanted to know how to measure the extent of similarity in two audio patterns . the audio patterns can be a clap sequence , knock sequence , whistle etc &lt;/p&gt;&#xA;" OwnerUserId="7835" LastActivityDate="2014-02-08T19:21:58.743" Title="Matching two audio inputs (signals)" Tags="|matlab|signal-analysis|cross-correlation|speech-recognition|autocorrelation|" AnswerCount="2" CommentCount="0" ClosedDate="2014-03-20T01:44:14.497" ContentLicense="CC BY-SA 3.0" />
  <row Id="14261" PostTypeId="1" AcceptedAnswerId="14266" CreationDate="2014-02-08T08:15:51.533" Score="1" ViewCount="136" Body="&lt;p&gt;There are couple of methods listed &lt;a href=&quot;http://en.wikipedia.org/wiki/Determining_the_number_of_clusters_in_a_data_set&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; about finding the value of k in k means algorithm. How much sound is each of these procedure when used to find out the value of k in unsupervised manner.&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="128" LastEditDate="2019-09-15T18:49:40.613" LastActivityDate="2019-09-15T18:49:40.613" Title="Unsupervised Way to Choose K in K-Means Algorithm" Tags="|algorithms|machine-learning|clustering|unsupervised-learning|k-means|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14262" PostTypeId="2" ParentId="14212" CreationDate="2014-02-08T09:00:14.110" Score="0" Body="&lt;p&gt;May be this would help.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get the skeleton image.&lt;/li&gt;&#xA;&lt;li&gt;Find those runs of consecutive foreground pixel in vertical direction in the image whose previous or next column has all background pixel within the run-length. This would give the location of the points, which needs to be processed.&lt;/li&gt;&#xA;&lt;li&gt;For each point find the nearest steep point. This would be either a branch point or a point where an abrupt change in angle has occured. (Example point 15 in the image of previous answer). If there is no such point there is obviously another end-point. Call these as reference point. The vector between an endpoint and reference point would give the direction of extension.&lt;/li&gt;&#xA;&lt;li&gt;Now there can be various ways to decide which point to join with. You can take the nearest foreground point in that direction. You can also pick some features depending on the angle and distance between an endpoint and a point of extension to use in a KNN classifier.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="7771" LastActivityDate="2014-02-08T09:00:14.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14265" PostTypeId="2" ParentId="14259" CreationDate="2014-02-08T13:43:00.990" Score="1" Body="&lt;p&gt;The frequency of some image signal was traditionally given by a number of &lt;em&gt;cycles-per-millimeter&lt;/em&gt; (or per other spatial unit). This is a historical unit of measurement that is related to the invention of photography and comparing lenses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A cycle is also called a &lt;em&gt;pair of lines&lt;/em&gt;. It is created by the alternance of a dark-then-white pattern. If the black and white lines have the same width, then you have a pure frequency. If the lines get thinner and thinner (as in most resolution test charts), then you have some chirp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A constant region, whatever the color, is some continuous signal. High frequencies correspond to spatially fast changes in intensity: a pattern of dots or of thin zebras is high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since an image is a 2D signal, frequencies are defined with respect to their horizontal and vertical components (obviously, some diagonal pattern can be created by having non-continuous horizontal and vertical components).&#xA;You can find an example of resolution chart &lt;a href=&quot;http://en.wikipedia.org/wiki/1951_USAF_resolution_test_chart&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to experiment by yourself, you can try to generate various frequencies by creating fake 2D Fourier transforms with only 1 non-zero frequency and invert them.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-02-08T13:43:00.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14266" PostTypeId="2" ParentId="14261" CreationDate="2014-02-08T15:17:02.830" Score="3" Body="&lt;p&gt;The idea underlying the k-means algorithm is to find clusters that minimize the intra-cluster variance and maximize the inter-cluster sum-of-square. Note that the total variance is fixed so minimization of intra-cluster variance is equivalent to maximization of inter-cluster sum of square. Basically various methods aim to achieve such minimization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is no &quot;correct&quot; K number or &quot;best&quot; method in k means. One clustering may be better than another by one metric, but worse by another metric. And depending on your own project, sometimes one clustering works but sometimes it does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You had better try those method to see whether they are suit in your case. If your data is not high-dimensional, you can just try &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_density_estimation&quot; rel=&quot;nofollow noreferrer&quot;&gt;kernel density estimation&lt;/a&gt; to observe the number of peaks. Otherwise, the easiest and heuristic one is rule of thumbs, then I would suggest Elbow method (cease increasing the number of clusters when the new generated cluster is closed to some of the existing). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many discussions on &lt;a href=&quot;https://stackoverflow.com/questions/1793532/how-do-i-determine-k-when-using-k-means-clustering&quot;&gt;stackoverflow&lt;/a&gt; and &lt;a href=&quot;https://stats.stackexchange.com/questions/23472/how-to-decide-on-the-correct-number-of-clusters&quot;&gt;cross validation&lt;/a&gt; on this topic that you may be interested in as well.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-02-08T15:17:02.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14267" PostTypeId="1" AcceptedAnswerId="14268" CreationDate="2014-02-08T15:38:20.767" Score="6" ViewCount="3836" Body="&lt;p&gt;This is a pretty general question about how to compute derivatives of a digital signal $x[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know what are the different approaches (from naive to complex) and how are they compared to one another? Is it possible with FIR/IIR filters? What are the pro's and contra's. Which are better for real-time applications?&lt;/p&gt;&#xA;" OwnerUserId="3352" LastEditorUserId="7092" LastEditDate="2020-03-28T13:29:44.840" LastActivityDate="2020-03-28T13:29:44.840" Title="Ways to compute the n-the derivative of a discrete signal" Tags="|filters|discrete-signals|signal-analysis|derivative|derivation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14268" PostTypeId="2" ParentId="14267" CreationDate="2014-02-08T16:13:21.633" Score="7" Body="&lt;p&gt;The estimation of derivative is straightforward:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x'(n)~=\frac{x(n+1)-x(n-1)}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x''(n)~={x(n+1)-2*x({n})+x({n-1})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or if you have a signal sampled at $t_i=i\Delta t$,&#xA;it is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x'(t_{i})~=\frac{x(t_{i+1})-x(t_{i-1})}{2*\Delta t}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x''(t_{i})~=\frac{x(t_{i+1})-2*x(t_{i})+x(t_{i-1})}{(\Delta t)^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are interested in may be how to smooth the estimation. And yes you can use some recursive filters such as  $y(n) = a \cdot x(n) + (1-a) \cdot y(n-1)$, or just implement your estimation with some simple windows (Hann window for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To achieve the high SNR without distorting the signal very much, &lt;a href=&quot;http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_smoothing_filter&quot; rel=&quot;noreferrer&quot;&gt;Savitzky–Golay filter&lt;/a&gt; also smooths your data by fitting successive sub-sets of adjacent data points with a low-degree polynomial with linear least squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab code for an N-th derivative of signal row vector &lt;code&gt;x&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dx = x; %'Zeroth' derivative&#xA;&#xA;for n = 1:N % Apply iteratively&#xA;&#xA;    dif = diff(dx,1); % First derivative&#xA;    first = [dif(1) dif];&#xA;    last = [dif dif(end)];&#xA;&#xA;    dx = (first+last)/2;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-09T01:26:56.160" LastActivityDate="2014-02-09T01:26:56.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14269" PostTypeId="2" ParentId="14267" CreationDate="2014-02-08T16:14:37.660" Score="3" Body="&lt;p&gt;There is a good article in Wikipedia: &lt;a href=&quot;http://en.wikipedia.org/wiki/Numerical_differentiation&quot; rel=&quot;nofollow&quot;&gt;Numerical Differentiation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you'd expect differentiation to be (Anti?)symmetric, using IIR filters might not be the wisest of ideas.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-08T16:14:37.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14270" PostTypeId="2" ParentId="14260" CreationDate="2014-02-08T16:52:03.193" Score="2" Body="&lt;p&gt;Look up acoustic fingerprint or audio fingerprinting and dynamic-time warping for some basic technologies used to compare audio files.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-08T16:52:03.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14271" PostTypeId="2" ParentId="14259" CreationDate="2014-02-08T16:57:29.907" Score="0" Body="&lt;p&gt;Another definition is from the basic mathematical theory provided by Mr. Fourier, where &lt;strong&gt;any&lt;/strong&gt; (non-pathological) waveform or image can be represented by the composition of a bunch of sinusoids or sinusoidal patterns of different frequencies, even if there is &lt;strong&gt;no&lt;/strong&gt; readily apparent repeating pattern or frequency of changes in the waveform or image.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-08T16:57:29.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14272" PostTypeId="1" CreationDate="2014-02-08T17:23:22.427" Score="4" ViewCount="3016" Body="&lt;p&gt;I came across various works in the literature of document analysis addressing the problem of detecting base lines in multi-oriented texts. But no amount of search could give me satisfactory answer to the following quest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an algorithm to detect the base line which neither use a histogram based method or any kind of threshold parameter?&lt;/p&gt;&#xA;" OwnerUserId="7771" LastEditorUserId="20930" LastEditDate="2018-04-25T14:44:00.257" LastActivityDate="2018-04-25T14:44:00.257" Title="Base line detection of text lines" Tags="|image-processing|computer-vision|image-registration|text-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14273" PostTypeId="2" ParentId="14272" CreationDate="2014-02-08T18:10:33.943" Score="5" Body="&lt;p&gt;I don't think you can completely get rid of histogram or threshold-based binarization, since the former is to achieve line segmentation, while the latter is to extract the letters. The Radon horizontal projection is used for &lt;a href=&quot;https://stackoverflow.com/questions/21209297/how-to-convert-the-projections-of-the-lines-to-any-usable-segmentation-informati/21211638#21211638&quot;&gt;line segmentation&lt;/a&gt;, and the center line can be used to approximate the baseline of each segment. Yet this is somehow equivalent to the horizontal histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some improvement based on the basic histogram. In Zheng et al's paper  &lt;a href=&quot;http://www.umiacs.umd.edu/~zhengyf/BackgroundLineDetect_ICDAR03.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A model based line detection in documents&lt;/a&gt;, they applied a directional single connected chain strategy that considers the global textline orientation and merges the non-overlapped small segments into one line. The algorithm provides more accurate base line detection than the pure histogram-based line segmentation.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides, in Arabic script where short characters and large diacritics exist, the Tarik et al's paper &lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-40567-9_6&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Novel Baseline Detection Method of Handwritten Arabic-Script Documents Based on Sub-Words&lt;/a&gt; that measures the vertical distance between the semi-overlapped subwords baselines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet in those studies in the attempt to increase the accuracy, histogram and/or threshold were still a necessity.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-02-08T18:10:33.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14274" PostTypeId="2" ParentId="14260" CreationDate="2014-02-08T19:21:58.743" Score="1" Body="&lt;p&gt;You could also take a look at pattern recognition in the time-frequency domain. This would imply to take the entire audio signal and perform time-frequency analysis (finding a pro version of the spectrogram) and analize that as an image. If the two time-frequency representations match for the audio files, it is very likely that they are the same password.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-02-08T19:21:58.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14275" PostTypeId="1" CreationDate="2014-02-08T19:23:29.127" Score="5" ViewCount="3823" Body="&lt;p&gt;I am working with wavelet transforms. When we apply a discrete wavelet transform to an image, it decomposes into four components named the approximation component, thevertical component, the horizontal component, and the diagonal component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These components are indicated as LL, HL, LH, HH respectively. I understand how an image is decomposed by using a wavelet transform, but I don't know why generally in an image high frequency component contain more noise.&lt;/p&gt;&#xA;" OwnerUserId="7794" LastEditorUserId="76" LastEditDate="2014-02-09T12:37:58.907" LastActivityDate="2014-02-13T20:08:05.673" Title="Why does the high frequency component of an image contain more noise?" Tags="|image-processing|frequency|noise|wavelet|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14276" PostTypeId="1" AcceptedAnswerId="14277" CreationDate="2014-02-08T19:37:17.947" Score="4" ViewCount="17872" Body="&lt;p&gt;If a signal depends on only one variable then we call it one dimensional, and if a signal depends on two variable we call it a two dimensional signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when we represent an one dimensional signal, we use two axes(amplitude vs. time).&#xA;In case of a two dimensional signal, we use two axes (for example, the x axis and the y axis in an image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I understand the difference between a one and two dimensional signal?&lt;/p&gt;&#xA;" OwnerUserId="7794" LastEditorUserId="76" LastEditDate="2014-02-09T12:31:08.210" LastActivityDate="2020-10-10T02:51:27.737" Title="What is the difference between a one dimensional and a two dimensional signal?" Tags="|discrete-signals|signal-analysis|image-processing|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14277" PostTypeId="2" ParentId="14276" CreationDate="2014-02-08T20:47:39.753" Score="6" Body="&lt;p&gt;Basically the dimensional number refers to the number of independent variables (input). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In one dimensional signal $f(t)$, the amplitude $y=f(t)$ is the dependent variable (output), and there is only one independent variable $t$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In two dimensional image $f(x,y)$, the two independent variables are $x$ and $y$, and the dependent variable $f$ is also called intensity. If you want to make it similar with &lt;em&gt;amplitude vs time&lt;/em&gt; plot as you do with one dimensional signal, you can plot a &lt;em&gt;intensity vs x vs y&lt;/em&gt; scattered dots with three axis as well. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-08T20:47:39.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14278" PostTypeId="2" ParentId="14275" CreationDate="2014-02-08T20:57:43.080" Score="2" Body="&lt;p&gt;In actual photography, this is the case because there is no correlation in the noise of neighboring pixels. They are all independent, other than the contribution of a supposed signal.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-08T20:57:43.080" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14279" PostTypeId="2" ParentId="14275" CreationDate="2014-02-09T00:10:21.823" Score="0" Body="&lt;p&gt;noise is often high frequency in nature. it interrupts the image, you can find them in the high frequencies area in DWT also the same for Discrete Cosine Transform (DCT) matrix, where noises lay in the down-right corner (high frequencies band).&lt;/p&gt;&#xA;" OwnerUserId="5714" LastActivityDate="2014-02-09T00:10:21.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14280" PostTypeId="2" ParentId="14276" CreationDate="2014-02-09T00:20:08.927" Score="0" Body="&lt;p&gt;x, y represents the image plane and in this case it's 2D plane, or 3D plane. So it's amplitude plane in front of the time plane. Like graphical representation, we could have the simple case as one vector or more than one which consist a plane. So we represent the time plane vs amplitude (perpendicular planes)&lt;/p&gt;&#xA;" OwnerUserId="5714" LastEditorUserId="7092" LastEditDate="2020-10-10T02:51:27.737" LastActivityDate="2020-10-10T02:51:27.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14281" PostTypeId="2" ParentId="12701" CreationDate="2014-02-09T01:19:26.927" Score="2" Body="&lt;p&gt;gabor filter formed a sine/cosine wave with a gaussian, where the center of frequency of the filter is specified by the frequency of sine-cosine and the band width of the filter is specified by the width of the gaussian (valid perfectly inside a certain range and outside it, attenuates the frequency). In other words, more than one gabor filter to cover the spectrum.&#xA;the gabor filter can be designed for a band-width of 1 octave maximum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can find more details about &lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/matlabfns/PhaseCongruency/Docs/convexpl.html&quot; rel=&quot;nofollow&quot;&gt;gabor and log-gabor&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5714" LastActivityDate="2014-02-09T01:19:26.927" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14282" PostTypeId="2" ParentId="14275" CreationDate="2014-02-09T02:04:07.990" Score="3" Body="&lt;p&gt;There are &lt;a href=&quot;http://www.dig.cs.gc.cuny.edu/seminars/IPCV/pres12.pdf&quot; rel=&quot;nofollow&quot;&gt;different types of noise sources&lt;/a&gt; in imaging process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Photoelectronic&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;photon noise: Poisson distribution, whole spectra;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thermal noise: Gaussian distribution, white noise, whole spectra;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Impulse&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;salt and pepper noise: mainly high frequency noise; (@user7358 made a very good point on the reason).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;line drop: part or all of a line in the image lost, can be viewed as a deterministic high frequency noise;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Structured&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;periodic: low frequency noise;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;aperiodic: JPEG noise, low frequency too;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;detector striping: calibration differences among individual scanning detectors, mainly low frequency;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only observe the evident noise when you zoom in the high frequency band with wavelet, I assume it is mainly the shot noise (salt and pepper). When you are doing some simulations with noise added, try (1) salt and pepper,  (2) Gaussian, and (3) Gaussian with a high-pass band applied, and observe the difference after wavelet decomposition.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-09T02:04:07.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14283" PostTypeId="2" ParentId="13683" CreationDate="2014-02-09T08:26:58.007" Score="1" Body="&lt;p&gt;'edited image' is of type uint8 and the selected area which you have taken for processing finally after applying all operations is coming out as type double.But when you place it in original image it is considered as of type uint8 because the image is of type uint8. Hence before putting it in original image you should multiply x by 255 so that it get be properly scaled.&lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2014-02-09T08:26:58.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14285" PostTypeId="1" CreationDate="2014-02-09T04:02:44.980" Score="5" ViewCount="281" Body="&lt;p&gt;$f:\mathbb{R}^n\rightarrow\mathbb{R}$ is a signal and $g:\mathbb{R}^n\rightarrow\mathbb{R}$ is a known point-spread function (say, a Gaussian).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A system samples $f\star g$ at a known sequence of irregular points, $(\mathbf{x}_n)_n$. Are there any methods, analytic or numerical, to deconvolve the samples from $g$ to reveal samples of $f$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $f$ were band-limited and the sequence of sample points $(\mathbf{x}_n)_n$ were periodic and finer than the sampling theorem's frequency, then I believe by the convolution theorem sampled-$g$'s  Fourier transform could be divided out pointwise from that of sampled-$f\ast g$, yielding sampled-$f$'s Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="1965" OwnerDisplayName="enthdegree" LastEditorUserId="1965" LastEditDate="2018-09-06T19:43:34.923" LastActivityDate="2018-09-06T19:43:34.923" Title="How do you deconvolve irregularly sampled points?" Tags="|image-processing|convolution|sampling|deconvolution|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14286" PostTypeId="1" AcceptedAnswerId="14290" CreationDate="2014-02-10T04:25:48.180" Score="2" ViewCount="56" Body="&lt;p&gt;Does anyone have suggestions for performing the above?  Presently, in my job we send signals through geological formations; however, if the rock is too dense, then we are unable to receive any signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signals must be sent from a battery-powered transmitter.  Here is an article I've found sending neutrinos, but I am more interested in sending electromagnetic radiation:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.gizmag.com/neutrino-messaging/21842/&quot; rel=&quot;nofollow&quot;&gt;http://www.gizmag.com/neutrino-messaging/21842/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7844" LastEditorUserId="7092" LastEditDate="2014-02-10T04:54:49.200" LastActivityDate="2014-02-10T16:32:15.410" Title="How do you send signals through geological formations" Tags="|discrete-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14287" PostTypeId="1" CreationDate="2014-02-10T06:57:24.847" Score="2" ViewCount="603" Body="&lt;p&gt;I am currently doing foreground segmentation in image sequences. A DCT 8 by 8 feature is extracted for each pixel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now i want to explore dynamic block size for different scenes. Is there any rules or criterion to decide optimal block size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7848" LastEditorUserId="7092" LastEditDate="2014-02-11T13:31:45.030" LastActivityDate="2022-06-24T12:21:47.080" Title="Is there a way to evaluate block size when doing image processing or video processing" Tags="|image-processing|image-segmentation|dct|video-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14288" PostTypeId="2" ParentId="14285" CreationDate="2014-02-10T08:56:01.510" Score="3" Body="&lt;p&gt;You can use a graph-based Signal Processing framework to apply regular deconvolution algorithms. The whole point is that traditional operators (such as FFT) can be defined on graph structures, and graph structures do handle &quot;by design&quot; without any overhead irregular sampling patterns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some useful reference scan be found on my former office mate's &lt;a href=&quot;http://lts2www.epfl.ch/page-85380-en.html&quot; rel=&quot;nofollow&quot;&gt;webpage&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-02-10T08:56:01.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14289" PostTypeId="1" CreationDate="2014-02-10T11:43:00.023" Score="-1" ViewCount="243" Body="&lt;p&gt;Can you please help me with this problem??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been working on AM335x sitara evm and my project needs self diagnosis of the captured audio from the mic through the speaker on the same board (we have re-worked on the evm to add the mic and speaker). In the application it is preferred that the user only requests for the audio test to be performed and the software (have to implement; but no Idea how to do so) need to check the quality of the audio and based on the statistics it has to give the test result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please provide me some ideas how to implement this self diagnosis test for audio quality. If you feel the question is unclear or could not understand please let me know.....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;G.Shricharan&lt;/p&gt;&#xA;" OwnerUserId="7849" LastActivityDate="2014-05-30T17:59:35.533" Title="How to check the quality of an audio through an algorithm or software program" Tags="|audio|speech-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14290" PostTypeId="2" ParentId="14286" CreationDate="2014-02-10T13:00:05.737" Score="4" Body="&lt;p&gt;For digital communications, bit error rate performance is all about &lt;a href=&quot;http://en.wikipedia.org/wiki/Eb/N0&quot; rel=&quot;nofollow&quot;&gt;$\frac{E_b}{N_0}$, the &lt;em&gt;energy per bit&lt;/em&gt; divided by the &lt;em&gt;noise power spectral density&lt;/em&gt;&lt;/a&gt;. The part that you can control is the energy per bit. Energy per bit is equal to $\text{(average power)(bit duration)}$. You can increase $E_b$ (and therefore decrease your bit error rate) in two ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Raising your transmitter power. This may or may not be possible based on the hardware you're using, the frequency band in use, and any governmental regulations for your locale.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Decreasing the bit rate (i.e. give more time per bit). In cases of extremely high path loss, like communication into caves, you can get reliable operation at a very low bit rate (although other issues such as long-term oscillator stability can come into play and diminish the gain that you might expect).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Communication into deep geological formations is something of a niche application, so you may have trouble finding a lot of literature on suggested approaches. There are companies who specialize in making this type of equipment, so it may serve you better to consult the marketplace for existing solutions that might be off the shelf instead of trying to engineer one from scratch (if your budget permits, of course; I expect such systems to be expensive due to the rather small market).&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2014-02-10T16:32:15.410" LastActivityDate="2014-02-10T16:32:15.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14292" PostTypeId="2" ParentId="14287" CreationDate="2014-02-10T14:40:39.447" Score="1" Body="&lt;p&gt;I assume the block size is related to image quality no matter you are doing the segmentation or compression. Generally speaking, smaller blocks are better as far as correlation (the pixels in the block are more correlated), but if they're too small, you won't be able to eliminate many coefficients from each block without causing severe distortion, especially when there are high variance and more details in the block. Some compression algorithms use different block sizes within the same image so that high-detail regions are divided into smaller blocks, while smooth regions are divided into larger blocks (&lt;a href=&quot;https://www.spiedigitallibrary.org/conference-proceedings-of-spie/2707/1/Compression-of-medical-images-through-adaptive-block-size-DCT-coding/10.1117/12.238452.short?SSO=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chong et al's Compression of medical images through adaptive block-size DCT coding&lt;/a&gt;, and &lt;a href=&quot;https://web.archive.org/web/20100713073622/http://scien.stanford.edu/pages/labsite/2000/ee368b/projects2000/Projects/embrya/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Influence of DCT Block Size on Coding Efficiency: An Adaptive Variable Block Size Transform Coding System with Lagrangian Cost Function Decision Criterion&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Besides, &lt;a href=&quot;https://ieeexplore.ieee.org/document/388074&quot; rel=&quot;nofollow noreferrer&quot;&gt;Karunasekera et al's A distortion measure for blocking artifacts in images based on human visual sensitivity&lt;/a&gt; provides you a reference to estimate the distortion induced by blocking artifacts. &lt;a href=&quot;https://web.archive.org/web/20170809100710/http://crpit.com/confpapers/CRPITV36Singh.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pramod el al's Unsupervised Segmentation of Medical Images using DCT&#xA;Coeﬃcients&lt;/a&gt; applied DCT coefficients to the image segmentation.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="26573" LastEditDate="2022-06-24T12:21:47.080" LastActivityDate="2022-06-24T12:21:47.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14293" PostTypeId="2" ParentId="14244" CreationDate="2014-02-10T14:43:44.753" Score="1" Body="&lt;p&gt;Please consider that the wavelet transform coefficients represent the local details of the signal. In (incomplete) DWT or a Gaussian pyramid, there is also a trend signal after the transform that contains the global behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first condition on this local-global separation is that constant or near constant parts of the signal get mapped to zero in the local details. The scalar product of a (wavelet) function with a constant function gives its DC contents. So DC of wavelet equal 0 means that the computed coefficients are high at regions of interest like edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same goes for higher moments. If one wants to regard slow linear or quadratic &quot;gradients&quot; in the signal as not essential for the contents, or as part of the trend signal, then the first resp. second moment of the wavelet must vanish.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Or to consider it from a slightly different angle: Each scale of the wavelet transform corresponds to the application of a high-pass filter. One defining property of a high-pass filter is that the amplitude response around the frequency zero is small, ideally zero. Vanishing moments of the wavelet function correspond to a flat graph of the Fourier transform of the wavelet at frequency zero.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-02-10T15:59:47.093" LastActivityDate="2014-02-10T15:59:47.093" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14294" PostTypeId="1" AcceptedAnswerId="14295" CreationDate="2014-02-10T14:49:55.253" Score="1" ViewCount="204" Body="&lt;p&gt;It's a very basic question, but I havn't found the question on google or dsp.stackexchange.com:&#xA;How does integraion of a signal change the spectrum?&lt;/p&gt;&#xA;" OwnerUserId="5434" LastActivityDate="2014-02-10T15:10:40.383" Title="How does integration of a signal change the spectrum?" Tags="|frequency-spectrum|integration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14295" PostTypeId="2" ParentId="14294" CreationDate="2014-02-10T15:10:40.383" Score="6" Body="&lt;p&gt;It is the basic property of Fourier Transforms. Given that $g(t)$ and $G(f)$ are Fourier transform pairs i.e.&lt;br&gt;&#xA;$g(t)  \rightleftharpoons G(f)$&lt;br&gt;&#xA;then&lt;br&gt;&#xA;$\int_{-\infty}^tg(\tau)d\tau \rightleftharpoons \frac{1}{j2\pi f}G(f)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumes that $G(0)=0$. If $G(0)$ is not zeros then the integral of $g(t)$ has a Fourier transform that includes a Dirac delta function.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-02-10T15:10:40.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14296" PostTypeId="1" CreationDate="2014-02-10T15:38:44.657" Score="4" ViewCount="8614" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n2wWQ.png&quot; alt=&quot;This data has noise, I want to apply a low-pass filter to it. How to design it and apply it?&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;As see in the picture, there are high frequency noise in the signal. How to design a low-pass filter to eliminate the noise? How to apply this filter in Matlab?&lt;/p&gt;&#xA;" OwnerUserId="7852" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2020-03-29T14:15:35.500" Title="How to use low pass filter in Matlab for discrete data?" Tags="|matlab|filters|discrete-signals|signal-analysis|lowpass-filter|" AnswerCount="2" CommentCount="2" ClosedDate="2014-03-17T16:09:14.500" ContentLicense="CC BY-SA 3.0" />
  <row Id="14297" PostTypeId="2" ParentId="14296" CreationDate="2014-02-10T15:40:42.663" Score="1" Body="&lt;p&gt;Check &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/conv.html&quot; rel=&quot;nofollow&quot;&gt;conv&lt;/a&gt; function. Use &lt;code&gt;conv(f,x)&lt;/code&gt; where &lt;code&gt;f&lt;/code&gt; is the filter and &lt;code&gt;x&lt;/code&gt; is the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also implement the filter process in frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X=fft(x);&#xA;F=fft(f);&#xA;X_LP=real(ifft(X.*F));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/filter.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;filter&lt;/code&gt;&lt;/a&gt; too. In &lt;code&gt;y = filter(b,a,x)&lt;/code&gt;, the filter is described by numerator coefficient vector &lt;code&gt;b&lt;/code&gt; and denominator coefficient vector &lt;code&gt;a&lt;/code&gt;,which is different in &lt;code&gt;conv&lt;/code&gt; where the input is the time series of the filter. But &lt;code&gt;conv(f,x)&lt;/code&gt; and &lt;code&gt;filter(f,1,x)&lt;/code&gt; gives the same result in your case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For dfilt.dffir type filter, use the code below (&lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/filter.html&quot; rel=&quot;nofollow&quot;&gt;example page&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = randn(100,1);    % Original signal.&#xA;b = fir1(50,.4);     % 50th-order linear-phase FIR filter.&#xA;hd = dfilt.dffir(b);    % Direct-form FIR implementation.&#xA;y = filter(hd,x);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;filter&lt;/code&gt; can handle FIR and IIR systems, while &lt;code&gt;conv&lt;/code&gt; only works for FIR filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides,  &lt;code&gt;filter&lt;/code&gt; can also return the filter states, so that it can be used in subsequent calls without incurring filter transients.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-10T16:25:48.167" LastActivityDate="2014-02-10T16:25:48.167" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="14298" PostTypeId="2" ParentId="14296" CreationDate="2014-02-10T15:48:31.237" Score="0" Body="&lt;p&gt;Does the picture displayed the filter or the signal?&#xA;If your filter is saved in the SOS-format (second order system) and you have the dsp-toolbox, you can use the sosfilt or filtfilt function.&lt;/p&gt;&#xA;" OwnerUserId="5434" LastActivityDate="2014-02-10T15:48:31.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14299" PostTypeId="1" AcceptedAnswerId="14300" CreationDate="2014-02-10T16:11:03.483" Score="4" ViewCount="2695" Body="&lt;p&gt;Both Correlation and Convolution are displacement function, i.e they are used to slide the filter mask across the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is same as correlation except that the filter mask is rotated 180 degree before computing the sum of products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We mostly use convolution. why it is widely used? why convolution is preferred over correlation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Convolution in time domain   = Multiplication in Frequency domain&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Do we have any similar relation for correlation ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Correlation in time domain  =  _______________ in Frequency domain ?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-02-10T19:54:45.917" Title="Correlation and Convolution" Tags="|image-processing|discrete-signals|" AnswerCount="2" CommentCount="1" ClosedDate="2014-02-24T16:45:53.203" ContentLicense="CC BY-SA 3.0" />
  <row Id="14300" PostTypeId="2" ParentId="14299" CreationDate="2014-02-10T16:17:45.573" Score="1" Body="&lt;p&gt;Please note that for complex-valued signals, complex conjugates are needed for correlation, but neither signal is conjugated in the convolution. So it is only partially true for real valued signals that &lt;code&gt;Convolution is same as correlation except that the filter mask is rotated 180 degree before computing the sum of products.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In image processing, convolve the multiple filters into a single filter is preferred, while correlation is sufficient if you are only find one template for matching purpose. Check &lt;a href=&quot;https://dsp.stackexchange.com/questions/12684/difference-between-correlation-and-convolution-on-an-image&quot;&gt;this post&lt;/a&gt; for its associative property on convolution.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-02-10T16:22:49.687" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14301" PostTypeId="2" ParentId="14085" CreationDate="2014-02-10T16:35:57.317" Score="1" Body="&lt;p&gt;I resolved the issue, applying a butterworth band-pass in both acceleration and velocity,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all&#xA;clear all&#xA;clc&#xA;&#xA;addpath(genpath('/home/samuel/Dropbox/WORK/ISRProject/Mass_project/'));&#xA;&#xA;load acc;&#xA;Fs = 500;&#xA;T = 1/Fs;&#xA;x = linspace(1,2000,2000);&#xA;t = (0:length(a) -1)*T;&#xA;&#xA;a = a.*9.8;&#xA;&#xA;al = bandpass_butterworth(a, [0.5 25], Fs,2);&#xA;&#xA;vel = cumtrapz(t,al);&#xA;vel = bandpass_butterworth(vel, [0.5 25], Fs,2);&#xA;&#xA;pos = cumtrapz(t,vel);&#xA;&#xA;subplot(311), plot(t,al);&#xA;ylabel('Acceleration [m/s^2]');&#xA;subplot(312), plot(t,vel);&#xA;ylabel('Velocity [m/s]');&#xA;subplot(313), plot(t,pos);&#xA;ylabel('Position [m]');&#xA;xlabel('Time [s]');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/exiug.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the initial position almost corresponds to the final one. This example is not the same as the original signal as I don't have the other one anymore.&lt;/p&gt;&#xA;" OwnerUserId="4940" LastActivityDate="2014-02-10T16:35:57.317" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14303" PostTypeId="1" CreationDate="2014-02-10T17:30:59.903" Score="1" ViewCount="598" Body="&lt;p&gt;In the below screenshot I was unable to understand how the equation 4.3 is derived from the above equation.. How $x(nT)$ has become $x(n)$ ? Please clear my doubt and suggest some link to understand DFT. I am sorry for the poor image quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/S5VG5.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7834" LastEditorUserId="7092" LastEditDate="2014-02-10T17:43:56.080" LastActivityDate="2014-06-11T13:59:59.777" Title="Doubt : Derive DFT from CFT" Tags="|image-processing|fourier-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14304" PostTypeId="2" ParentId="14303" CreationDate="2014-02-10T17:35:35.177" Score="0" Body="&lt;p&gt;That is most likely a typo. In my opinion it should also read x(nT) in Eq. 4.3&lt;/p&gt;&#xA;" OwnerUserId="5145" LastActivityDate="2014-02-10T17:35:35.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14306" PostTypeId="1" AcceptedAnswerId="14307" CreationDate="2014-02-10T17:46:48.520" Score="3" ViewCount="20384" Body="&lt;p&gt;Apologies in advance for what I imagine is a simple question, however I can't work out how to do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two signals of the same type but with different sensor types, the figure below will give you an idea of some of the data I've got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tVZIk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I very simply want to calculate the average percentage difference between the two signals. Methods I've attempted so far have calculated outrageous results, in the order of ~200% difference. My attempt is below: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  for i = 1:length(data)&#xA;      per(i) = abs((var1(i)-var2(i))/((var1(i)+var2(i))/2)) * 100;&#xA;  end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe the problem in this method is that I'm only calculating the difference between the two immediate points in question (i) and not on a grand scale of all the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="7855" LastActivityDate="2015-06-11T19:06:28.743" Title="Percentage difference between two signals" Tags="|matlab|discrete-signals|signal-analysis|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14307" PostTypeId="2" ParentId="14306" CreationDate="2014-02-10T18:43:12.420" Score="5" Body="&lt;p&gt;At the least you should normalize it by the length of the sequence. But what you're trying to do is a pretty standard thing. I'm not sure what percentage difference really means. What you should probably be using is something like the root mean squared error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$RMSE=\sqrt{\frac{1}{N}\sum_{n=0}^{N-1}(x(n)-y(n))^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x(n)$ and $y(n)$ are your two sequences.&lt;/p&gt;&#xA;" OwnerUserId="1678" LastActivityDate="2014-02-10T18:43:12.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14308" PostTypeId="2" ParentId="13720" CreationDate="2014-02-10T19:52:07.783" Score="3" Body="&lt;p&gt;If you want to do the convolution in the frequency domain, you have to pad the kernel with zeros to make it the same size as the image.  There is really no way around it.  The upside is that you only need to take the FFT of the filter once, and then you can re-use it for multiple images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are concerned with speed, you would have to do some analysis here. For small separable kernels doing the convolution in the spatial domain may be faster. &lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-02-10T19:52:07.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14309" PostTypeId="2" ParentId="14299" CreationDate="2014-02-10T19:54:45.917" Score="5" Body="&lt;p&gt;Convolution as associative, while correlation is not.  The associative property is what allows you to convolve multiple filters into a single one, and then convolve that one filter with the image.  That is the big advantage of convolution over correlation.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-02-10T19:54:45.917" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14310" PostTypeId="1" CreationDate="2014-02-10T21:18:13.917" Score="0" ViewCount="191" Body="&lt;p&gt;Is there any relationship between the FFT and linear predictive methods?  Can an FFT result or the input to an FFT be modified to do non-circular prediction/extrapolation from the FFT results.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-10T23:02:32.097" Title="Is there any relationship between the FFT and linear prediction?" Tags="|fft|linear-prediction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14311" PostTypeId="2" ParentId="14306" CreationDate="2014-02-10T21:23:38.053" Score="2" Body="&lt;p&gt;You are calculating the relative error between two curves, when you curves have the opposite sign, the difference between the two curves may be even larger than the amplitude of the curve. That's probably the reason why your &lt;code&gt;mean(per)&lt;/code&gt; reaches 200.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like @Eric said, RMSE makes more sense, the Matlab implementation is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RMSE = sqrt(mean((var1-var2).^2)); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-10T21:23:38.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14312" PostTypeId="2" ParentId="14310" CreationDate="2014-02-10T21:27:39.327" Score="2" Body="&lt;p&gt;One thing that comes to mind is that a linear predictor can be implemented using the LMS algorithm, and the LMS algorithm can be implemented in block fashion using FFTs (see Chapter 7 of &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/013267145X&quot; rel=&quot;nofollow&quot;&gt;Haykin's &lt;em&gt;Adaptive Filter Theory&lt;/em&gt;&lt;/a&gt;). I wouldn't say that implies any kind of &lt;em&gt;relationship&lt;/em&gt;, but FFTs can be used to accelerate the implementation of some linear predictors.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-02-10T21:27:39.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14313" PostTypeId="2" ParentId="14306" CreationDate="2014-02-10T22:11:08.370" Score="3" Body="&lt;p&gt;In addition to the RMSE interpretation already given, another visually obvious way to interpret &quot;percentage difference&quot; is via the standard Euclidean norm. The two signals, assuming they're sampled uniformly over the interval, can be thought of as two different vectors in $n$-dimensional space, and they're pointing in very similar directions. Thus, one can interpret the percentage difference as&#xA;$$d=\frac{|v_1-v_2|^2}{|v_1||v_2|},$$&#xA;which can be implemented by &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dot(var1-var2, var1-var2)/sqrt(dot(var1,var1)*dot(var2,var2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7577" LastActivityDate="2014-02-10T22:11:08.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14314" PostTypeId="2" ParentId="14289" CreationDate="2014-02-10T22:17:50.700" Score="0" Body="&lt;p&gt;It appears that you want to play a tone, record it, and then measure how the signal was degraded. That is certainly possible, however it would then not be clear if any problem is in the speaker or in the microphone. If you can rely on that the speaker is identical, this could be circumvented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, you'd want to find a ,,characteristic'' of the microphone. You could describe the transfer function, it would be the (pointwise) ratio of the fft of the two signals. You could play back pulses, then the postprocessing would be easier. However it's not trivial to cancel out the speakers characteristic.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-10T22:17:50.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14315" PostTypeId="2" ParentId="14208" CreationDate="2014-02-10T22:23:28.077" Score="1" Body="&lt;p&gt;C depends , among other things, on the reconstruction algorithm. &lt;/p&gt;&#xA;" OwnerUserId="717" LastActivityDate="2014-02-10T22:23:28.077" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14316" PostTypeId="2" ParentId="14310" CreationDate="2014-02-10T23:02:32.097" Score="2" Body="&lt;p&gt;Well, the linear prediction problem can be thought as a filtering operation. Actually many linear predictors are based on FIR filters. So Technically you can implement the FIR filter with an FFT (And in a more efficient way depending on the size of the data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a Reference, try &quot;The Theory of Linear Prediction - Vaidyanathan&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1598295756&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Theory-Prediction-Synthesis-Lectures-Processing/dp/1598295756&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-02-10T23:02:32.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14317" PostTypeId="2" ParentId="14085" CreationDate="2014-02-11T00:34:36.683" Score="4" Body="&lt;p&gt;It depends  what type of accelerometer you are using and what you want the displacement signal for. I'm not an expert in signal processing, but I have sure used a lot of accelerometers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most piezoelectric accelerometers do not work down to DC - these accelerometers use charge amplifiers and the Low Frequency response is dependant on the time constant of the amplifier. Accelerometers like these  are commonly used for, e.g, structural and machinery vibration monitoring. Employing a band pass filter as you have done is appropriate. You could also fit a straight line to the acceleration signal and then subtract that line before integration, then do the same to the resulting velocity signal. Just be aware that this approach has limitations at low frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, on the other hand, you are using a sensor that can measure down to DC (e.g. piezo-resistive accelerometers) you will not have the low frequency limitations of piezoelectric accleerometers. If, though, you want to use the signal to work out distance moved, then see LukeP's links, though the results are not likley to be accurate...&lt;/p&gt;&#xA;" OwnerUserId="7856" LastActivityDate="2014-02-11T00:34:36.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14321" PostTypeId="1" CreationDate="2014-02-11T07:05:25.893" Score="2" ViewCount="1867" Body="&lt;p&gt;I'm looking for a good resource (book, tutorial, lesson etc.) that explains the usage of Kalman filtering in image processing applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware of the fact that Kalman filtering is an optimal estimator which is a tool not a concept in image processing because of that I didn't find a book that explains the usage of Kalman filtering for real applications (from a technical perspective).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use OpenCV (Matlab will be fine), so I prefer resources that handle image processing in OpenCV. &lt;/p&gt;&#xA;" OwnerUserId="5788" LastEditorUserId="1273" LastEditDate="2014-02-11T13:12:41.257" LastActivityDate="2014-02-11T14:58:15.817" Title="Kalman filtering in image processing, resources?" Tags="|image-processing|kalman-filters|matlab-cvst|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14322" PostTypeId="1" CreationDate="2014-02-11T08:05:27.707" Score="4" ViewCount="4077" Body="&lt;p&gt;In an audio file I would like to find calls of a specific bird specie, one that makes wobbling sound with rising notes. Can you recommend what would be the best audio feature to calculate in time or frequency domain to capture its essence? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Among others I tried MFCC, but the results were not promising (or perhaps my implementation poor) .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[Edit]&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this post I explained briefly the problem and included exemplary audio file with spectrogram: &lt;a href=&quot;https://dsp.stackexchange.com/questions/11320/noise-reduction-from-very-noisy-audio&quot; title=&quot;My previous post&quot;&gt;Example&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is another example. All marked areas contain kiwi (famous flightless bird from New Zealand) calls I am trying to identify. Mark that the original audio is very noisy; presented spectrogram is a result of applying high-pass filter and spectral subtraction on areas identified as noise-only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZKQYn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5785" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-03-14T14:18:21.373" Title="Detection of wobbling sound with rising notes" Tags="|audio|frequency-spectrum|classification|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14323" PostTypeId="1" AcceptedAnswerId="14328" CreationDate="2014-02-11T10:54:08.913" Score="2" ViewCount="2057" Body="&lt;p&gt;One definition of the Morlet wavelet function is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{\pi f_b}}e^{\frac{-t^2}{f_b}}e^{j2\pi f_c t}$$&lt;/span&gt;&#xA;The Fourier transform of this equation is:  &lt;span class=&quot;math-container&quot;&gt;$e^{-\pi^2 f_b(f-f_c)^2}$&lt;/span&gt; (is it right)?&lt;br /&gt;&#xA;First I attempted to plot the FFT of Morlet function by &lt;code&gt;FFT&lt;/code&gt; function in Matlab,  then I've plotted the Fourier transform function directly. I've expected to see same plots, but unfortunately they have different magnitude (why?). I publish the plot and my codes, do you have any idea why this happened? Is there any problem in my codes? Or any problem in the obtained Fourier transform? Or any problem in Matlab built-in &lt;code&gt;FFT&lt;/code&gt; function?&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lov8V.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;I wrote this script to get those plots:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;fS = 500;&#xA;tStart= -4;&#xA;tStop= 4;&#xA;timeVector = linspace(tStart,tStop, (tStop-tStart)*fS );&#xA;fC = 2;&#xA;fB=2;&#xA;timeMask = zeros(1,length(timeVector));&#xA;timeMask((timeVector &amp;gt;= -fB/2) &amp;amp; (timeVector &amp;lt;= fB/2)) = 1;&#xA;psiWavelet = ((pi*fB))^(-0.5).*...                   % Morlet function&#xA;exp(2*1i*pi*fC.*timeVector).*exp(-timeVector.^2/fB); % Morlet function&#xA;%      FFT plot by matlab bulit-in FFT function&#xA;     Nfft =10*2^nextpow2(length(timeVector));&#xA;    FFT =fftshift(abs(fft(psiWavelet,Nfft)));&#xA;    freqs=[0:Nfft - 1].*(fS/Nfft);&#xA;    freqs(freqs &amp;gt;= fS/2) = freqs(freqs &amp;gt;= fS/2) - fS;&#xA;    freqs=fftshift(freqs);&#xA;    figure(2);&#xA;    subplot(1,2,1)&#xA;    plot(freqs, FFT); &#xA;    xlim([-1  5]);&#xA;    xlabel('Frequency / Hz');&#xA;    title (sprintf('Fourier Transform'));&#xA;%     FFT plot by its direct fourier transfrom function&#xA;    f_psi=exp(-(pi^2*fB)*(freqs-fC).^2);&#xA;    subplot(1,2,2)&#xA;    plot(freqs,f_psi)&#xA;    xlim([-1  5]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="31264" LastEditDate="2020-08-21T17:49:27.193" LastActivityDate="2020-08-21T17:49:27.193" Title="Fourier Transform of Morlet wavelet Function?" Tags="|matlab|fft|fourier-transform|wavelet|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14324" PostTypeId="2" ParentId="14321" CreationDate="2014-02-11T13:08:53.923" Score="0" Body="&lt;p&gt;&lt;sub&gt;&lt;sup&gt;Disclaimer: this information is essentially the same an one I provided in &lt;a href=&quot;https://stackoverflow.com/a/10600923/884412&quot;&gt;my answer about particle filters on SO&lt;/a&gt;&lt;/sub&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.udacity.com/view#Course/cs373/CourseRev/apr2012&quot; rel=&quot;nofollow noreferrer&quot;&gt;This online course&lt;/a&gt; deals with &lt;strong&gt;Monte Carlo localization, Kalman fitlers and particle filters&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is called &quot;Programing a Robotic Car&quot;, so not really image processing, but: It is &lt;strong&gt;explained in very general way&lt;/strong&gt;, so the principles explained are easily applicable to any kind of input (e.g. sonic, gps, visual...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has &lt;strong&gt;examples in python&lt;/strong&gt;, including &quot;in class tasks&quot; and &quot;homeworks&quot; (various non-programming and programming tasks meant to help you understand and learn how to implement the various filters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is taught by a Standford professor if I'm not mistaken, and it's very easy to follow. By the end of the course, you should have &lt;strong&gt;all three methods implemented in python and ready to apply&lt;/strong&gt; to any kind of data, including visual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&lt;sup&gt;Disclamer 2: I assume you mean applications in &lt;em&gt;Computer Vision&lt;/em&gt;, since &lt;em&gt;Image processing&lt;/em&gt; deals mostly with static images. To estimate something, you would need multiple data, that is a video sequence, which makes it lean more towards &lt;em&gt;CV&lt;/em&gt; than &lt;em&gt;IP&lt;/em&gt;.&lt;/sup&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="1273" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-02-11T13:08:53.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14325" PostTypeId="1" AcceptedAnswerId="14327" CreationDate="2014-02-11T13:58:11.843" Score="2" ViewCount="5577" Body="&lt;p&gt;Given the noise spectral density ${N_0\over 2} = a$, what can be deduced about the variance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a two-symbol canal(/cable), and when $T_0 = 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it that, $\sigma_X^2 = {N_0 \over 2} *T_0$?&lt;/p&gt;&#xA;" OwnerUserId="7862" LastEditorUserId="5662" LastEditDate="2014-02-13T20:38:38.057" LastActivityDate="2014-02-15T03:25:48.183" Title="What can we deduce about variance when we are given the noise spectral density?" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14326" PostTypeId="2" ParentId="14321" CreationDate="2014-02-11T14:11:48.450" Score="2" Body="&lt;p&gt;Here are a couple of examples from the computer vision system toolbox:&#xA;&lt;a href=&quot;http://www.mathworks.com/help/vision/ug/object-tracking.html#bt1l2nh&quot; rel=&quot;nofollow&quot;&gt;Using kalman filter for object tracking&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more in-depth explanation the best book is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0890061793&quot; rel=&quot;nofollow&quot;&gt;Multiple Target Tracking with Radar Applications&lt;/a&gt; by Samuel Blackman.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2014-02-11T14:58:15.817" LastActivityDate="2014-02-11T14:58:15.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14327" PostTypeId="2" ParentId="14325" CreationDate="2014-02-11T14:40:45.123" Score="5" Body="&lt;p&gt;Given a low-pass signal $x$ that is a realization of random variable $X$ with constant spectral density $a=N_0/2$ in $f=-B\ldots B$ (and zero otherwise) we can calculate the mean power of that signal by $\bar P = 2aB=N_0B$, where $B$ is the signal bandwidth. The mean power of a random variable is defined as the expectation of $X^2$, i.e. $\bar P = \mathrm E[X^2]$. The correspondance between mean power and variance $\sigma_X^2$ of a random variable $X$ is&#xA;$$&#xA;\sigma_X^2=\mathrm E[X^2]-m_X^2&#xA;$$&#xA;where $m_X$ is the mean value of $X$. That is, for zero mean (which is often true for noise) we get&#xA;$$&#xA;\sigma_X^2=\mathrm E[X^2] = N_0B&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning your second question, I assume that $T_0$ is the symbol duration. Thus the symbol rate $R_\mathrm{S} = 1/T_0$. The bandwidth of a signal with symbol rate $R_\mathrm{S}$ is often approximated by $B=R_\mathrm{S}/2$ and thus&#xA;$$&#xA;\sigma_X^2 = N_0B = N_0R_\mathrm{S}/2 = N_0/(2T_0)&#xA;$$&#xA;(You can also check the units in your equation: $N_0$ is power per Hz and $T_0$ is in sec. But the result should be a power)&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-02-12T15:43:21.617" LastActivityDate="2014-02-12T15:43:21.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14328" PostTypeId="2" ParentId="14323" CreationDate="2014-02-11T16:03:28.110" Score="5" Body="&lt;p&gt;If you approximate the Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f)=\mathcal F(x)(f)=\int_{-\infty}^\infty x(t)\,e^{-2\pi j\,ft}\,dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by the discrete Fourier transformation for by sampling on the time segment $[-T,T]$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f_n)\approx \sum_{k=-N}^{N-1} x(k\tau)\,e^{-2\pi j\,f_nk\tau}\,\tau=s[n]\,\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $T=N\tau$, $f_n=n/(N\tau)=n/N*f_s=n/T$, $n=-N,...,N-1$, $s$ the result of FFT on the sampled $x$ sequence after shift, ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then you have to multiply the result of the FFT method by $\tau=T/N=1/f_s$.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-02-11T22:40:34.753" LastActivityDate="2014-02-11T22:40:34.753" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14329" PostTypeId="2" ParentId="14208" CreationDate="2014-02-11T16:38:36.853" Score="3" Body="&lt;p&gt;The constant C is usually left unspecified as it can be very hard to calculate.  It is independent of the signal dimension, and results in Compressed Sensing are generally only concerned with big-O results, so it falls out when we say something like $m = \mathcal{O}(s \ln{(N/s)})$.  The important part in this statement is the strong dependence on the sparsity level, and that the signal dimension $N$ only logarithmically affects the number of measurements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give an example of where such a constant would come from:  Let $V_d$ be the volume of the unit $\ell_2$ ball in $\mathbb{R}^d$.  Some simple cases are that $V_2 = \pi r^2$ and $V_3 = \frac{4}{3} \pi r^3$.  Note that both of these results are of the form $V_d = C r^d$, and this pattern generalizes for finite $d$.  In CS, it is $r^d$ that we are interested in, as it captures the dependence on the signal dimension.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $C$ will vary depending on the algorithm as different inequalities may be used in the proofs.  I don't know of any publications that specifically calculate C. &lt;/p&gt;&#xA;" OwnerUserId="4202" LastEditorUserId="4038" LastEditDate="2014-02-14T09:55:49.110" LastActivityDate="2014-02-14T09:55:49.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14330" PostTypeId="1" AcceptedAnswerId="14331" CreationDate="2014-02-11T18:27:31.940" Score="1" ViewCount="67" Body="&lt;p&gt;I am reading Digital Communication, 3rd edition by Barry &amp;amp; Lee,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Book's Webpage: &#xA;&lt;a href=&quot;http://www.springer.com/engineering/signals/book/978-0-7923-7548-7&quot; rel=&quot;nofollow&quot;&gt;enter link description here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an excerpt taken from this book (mentioned above) from Chapter 3, Page # 57, 1st Para, 1st Line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It says,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Although modulation and demodulation are deterministic,the information to be      &#xA; transmitted over a communication system, as well as the noise encountered in the &#xA; physical transmission medium,is random or stochastic.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I understand Noise being a random process but how the information to be transmitted could be a random process.&#xA;I mean do we not know the nature of information to be transmitted by us ahead of any transmission ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please elucidate this.&lt;/p&gt;&#xA;" OwnerUserId="7237" LastActivityDate="2014-02-11T18:48:08.943" Title="Information to be transmitted being a stochastic process?" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14331" PostTypeId="2" ParentId="14330" CreationDate="2014-02-11T18:48:08.943" Score="1" Body="&lt;p&gt;The excerpt is intimating that, for communication applications, the information source is stochastic in the sense that its output is not fully known &lt;em&gt;a priori&lt;/em&gt;. If you did know its output, then you wouldn't need a communication link at all! With that said, there are levels of gray to this effect, and there is a large area of study on its own known as &lt;em&gt;information theory&lt;/em&gt;. Here's a very basic high-level summary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amount of &lt;em&gt;information&lt;/em&gt; conveyed by a transmission is related to the amount of &lt;em&gt;entropy&lt;/em&gt; contained in the transmission. Its entropy measures how unpredictable the transmission is. In your example, if a receiver observes a signal that is fully deterministic (i.e. it is completely predictable), then that transmission contains zero information. So, in a sense, the less we know what to expect about the next observed transmission, the more information that it can carry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in terms of maximizing information rate, you want to maximize the entropy in your transmitted signal. However, there are some cases where reducing your transmission's entropy could be advantageous. Specifically, error-correcting codes are encoding methods that allow a receiver to recover from symbol errors by exploiting intentionally-inserted redundancy into a transmitted signal (which reduces its entropy). Thus, the information rate is lower, but the probability of error is reduced as well.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-02-11T18:48:08.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14332" PostTypeId="2" ParentId="14322" CreationDate="2014-02-11T19:10:31.623" Score="0" Body="&lt;p&gt;I suppose you still want to isolate single calls that could be identified by that rising pattern. You'd have to find the peaks for that. Maybe you first identify and isolate the ,,pulses'', then find the frequency maximum of each and then have your program cut where there's a large downward step.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-11T19:10:31.623" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14333" PostTypeId="1" AcceptedAnswerId="66567" CreationDate="2014-02-11T20:15:33.220" Score="0" ViewCount="437" Body="&lt;p&gt;In the DSP class I'm taking, a lot of the questions ask me to list the multiplicity of a pole or zero in a rational Z-transform. For example, the multiplicity of the zero at $z=1$ in :$\frac{(z-1)^2}{(z-5)}$ is $2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What knowledge do we gain by knowing the multiplicity of some pole or zero? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, if we know the multiplicity of all the poles and zeros, we can describe the z-transform of a rational function, but this is not a very satisfying answer.&lt;/p&gt;&#xA;" OwnerUserId="1965" LastActivityDate="2020-04-17T12:07:08.697" Title="Why do we care about the multiplicity of poles and zeros in rational Z-transforms?" Tags="|discrete-signals|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14335" PostTypeId="2" ParentId="14333" CreationDate="2014-02-12T08:30:11.567" Score="0" Body="&lt;p&gt;Multiple poles have amplitude and phase profile different to that of single poles.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-12T08:30:11.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14336" PostTypeId="1" AcceptedAnswerId="14347" CreationDate="2014-02-12T09:07:15.627" Score="1" ViewCount="1383" Body="&lt;p&gt;Let $|A|$ denote the power of the analog signal $A$. Is that true to assume $|A+B|=|A|+|B|$, for two arbitrary signals $|A|$ and $|B|$? That is the power of the summation of two signals is -at least roughly- equal to the summation of the powers of the two signals. What if $A$ and $B$ are random signals? &lt;/p&gt;&#xA;" OwnerUserId="7872" LastEditorUserId="7092" LastEditDate="2020-03-28T13:32:16.763" LastActivityDate="2020-03-28T13:32:16.763" Title="Power of summation of two signals" Tags="|discrete-signals|signal-analysis|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14337" PostTypeId="2" ParentId="7697" CreationDate="2014-02-12T09:44:27.337" Score="0" Body="&lt;p&gt;The I-Q components are orthogonal. Hence, a different signal can be transmitted in each component. If you don't use both components (I-Q) to generate your signal, you actually generate the envelope of the modulated signal, which usually seems harder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B08GG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get the analytic signal (complex) from the envelope (real), you can apply the Hilbert transform. You can see this transformation in the spectrum. The complex signal has non-symmetric spectrum, while the real signal has a symmetric spectrum with half amplitude respect to the complex one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_+(t)=s(t)+j \cdot \hat{s}(t) \; \; with \; \; \hat{s}(t)=\frac{s(t)}{\pi t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I suggest that you generate both I-Q components. You don't need to actually create a complex variable, you can store it as a bi-variate variable, i.e. Nx2 matrix.&lt;/p&gt;&#xA;" OwnerUserId="4776" LastActivityDate="2014-02-12T09:44:27.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14338" PostTypeId="1" AcceptedAnswerId="14348" CreationDate="2014-02-12T10:05:38.053" Score="4" ViewCount="1299" Body="&lt;p&gt;I am not able to understand the formula,&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rglFW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is $W$ (window) and intensity in the formula mean,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this formula in opencv doc &lt;a href=&quot;http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_features_harris/py_features_harris.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_features_harris/py_features_harris.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7873" LastEditorUserId="7092" LastEditDate="2020-03-30T03:55:02.637" LastActivityDate="2020-03-30T03:55:02.637" Title="Corner detection using Chris Harris &amp; Mike Stephens" Tags="|image-processing|discrete-signals|signal-analysis|computer-vision|opencv|" AnswerCount="1" CommentCount="2" ClosedDate="2014-03-14T13:48:39.223" ContentLicense="CC BY-SA 3.0" />
  <row Id="14339" PostTypeId="1" AcceptedAnswerId="14370" CreationDate="2014-02-12T10:11:20.013" Score="-1" ViewCount="73" Body="&lt;p&gt;I am doing OCR for Kannada and English. What are the best features in image? Please also tell me some tools to perform OCR before implementing it as code (like Rapiedminer for machine learning).&lt;/p&gt;&#xA;" OwnerUserId="7873" LastEditorUserId="7092" LastEditDate="2014-02-13T04:08:58.657" LastActivityDate="2014-02-13T04:08:58.657" Title="what are best features" Tags="|image-processing|computer-vision|preprocessing|ocr|" AnswerCount="1" CommentCount="1" ClosedDate="2014-02-16T14:46:16.900" ContentLicense="CC BY-SA 3.0" />
  <row Id="14341" PostTypeId="2" ParentId="3284" CreationDate="2014-02-12T11:20:49.540" Score="1" Body="&lt;p&gt;The Solution finally was to match the input vectors in the group delay simulating Matlab functions.That means that the frequencies and the group delay Vectors given as input in Matlab should be SHORT and not as long as i had to give,and exactly on the same length (which makes sense).The most tricky part is to find which length was that would fit in and run the simulation.&lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-02-12T11:20:49.540" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14342" PostTypeId="2" ParentId="14336" CreationDate="2014-02-12T11:54:06.783" Score="1" Body="&lt;p&gt;No, that is not true. It is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;|a+b| \leq |a| + |b|&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: This is not true for the power which was asked for by the OP (see the comments). I over-read the re-definition of $|\cdot|$.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastEditorUserId="5069" LastEditDate="2014-02-12T16:29:14.013" LastActivityDate="2014-02-12T16:29:14.013" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14343" PostTypeId="1" CreationDate="2014-02-12T12:04:47.303" Score="0" ViewCount="71" Body="&lt;p&gt;How to determine the frequency of a signal with a value of the sample and value of the time instant the sample was taken ?&lt;/p&gt;&#xA;" OwnerUserId="7875" LastActivityDate="2014-02-12T14:38:31.753" Title="Determing the frequency of a signal with a sample at a time" Tags="|filters|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="1" ClosedDate="2014-02-16T14:36:47.003" ContentLicense="CC BY-SA 3.0" />
  <row Id="14345" PostTypeId="1" AcceptedAnswerId="14351" CreationDate="2014-02-12T13:39:38.827" Score="0" ViewCount="52" Body="&lt;p&gt;If I have spectrum $X_k$ of the signal evaluated at frequencies $k \delta f$ and I want to know what is the value of that same signal at some other frequencies , i.e., $k' \delta f'$.I know that $\delta f$ and $\delta f'$ are somehow reelated (e.g. $\delta f = 12 \delta f'$) how can I express spectrum of the signal with this new carrier spacing ($k' \delta f'$) having only info about $X_k$ or in other words what is the coefficient, $X_k' = coefficient \cdot X_k$.&#xA;Thanks in advance for any help.&lt;/p&gt;&#xA;" OwnerUserId="7879" LastEditorUserId="7092" LastEditDate="2014-02-12T14:01:21.623" LastActivityDate="2014-02-12T15:20:58.043" Title="Signal spectrum when carrier width changes" Tags="|fft|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14346" PostTypeId="2" ParentId="14107" CreationDate="2014-02-12T13:55:22.753" Score="3" Body="&lt;p&gt;As you already know, the &lt;a href=&quot;http://www.ni.com/white-paper/2218/en/&quot; rel=&quot;nofollow&quot;&gt;quadrature error, also called quadrature skew&lt;/a&gt;, describes how far off the actual angle between I and Q is from the ideal 90 degrees.&#xA;It is one component of &lt;a href=&quot;https://en.wikipedia.org/wiki/modulation_error_ratio&quot; rel=&quot;nofollow&quot;&gt;modulation error ratio&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seem to be lots of people talking about how to &lt;a href=&quot;http://exodus.poly.edu/~kurt/manuals/manuals/HP%20Agilent/HP%20ESA%20E4400%20Series%20Documentation/ESA%20%28D%29/FILES/E4402037.PDF&quot; rel=&quot;nofollow&quot;&gt;measure quadrature skew&lt;/a&gt;,&#xA;but few people talking about how to compensate.&#xA;The two major approaches to compensation seem to be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;During initial factory tuning, some human watches an o'scope measuring the skew while manually tweaking the analog parts, or&lt;/li&gt;&#xA;&lt;li&gt;During normal operation, the receiver internally estimates the quadrature skew and compensates digitally.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Often hardware designers deliberately build &quot;&lt;a href=&quot;http://users.ecs.soton.ac.uk/jrs105/finalgdpreportgroup14.pdf&quot; rel=&quot;nofollow&quot;&gt;off-tuned recievers&lt;/a&gt;&quot;.&#xA;With such hardware, when the transmitter repeatedly transmits &quot;the same&quot; constellation point, the raw I/Q point sampled by the reciever -- rather than staying close to a single fixed location in the I/Q diagram as with a perfectly tuned direct-conversion receiver -- instead rotates in a circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a receiver somehow estimates (typically in a FPGA or in software) how far the constellation has been rotated by that analog hardware, and corrects for it by rotating the I/Q sample in the opposite direction.&#xA;It is possible to simultaneously estimate the phase skew between I and Q and correct for that at the same time.&#xA;(In effect,&#xA;if you know the skew is S and you measure raw x,q coordinate,&#xA;you can deskew and find the true x,y in perfectly orthogonal coordinates&#xA;with y = qc - xt,&#xA;where c is some approximation of 1/cos(S) and t is some approximation of tan(S); often c = 1 and t=S (in radians) is adequate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further reading:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ee.ucl.ac.uk/ong/blind-equalization-nyquist-filtering&quot; rel=&quot;nofollow&quot;&gt;&quot;Blind Equalization of Receiver In-Phase/Quadrature Skew in the Presence of Nyquist Filtering&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;a patent search for &quot;quadrature skew&quot; compensation turns up a few.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rfdesign.com/images/archive/0502Cutler36.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;Effects of physical layer impairments on OFDM systems&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6479217&quot; rel=&quot;nofollow&quot;&gt;&quot;Compensation for In-Phase/Quadrature Imbalance in Coherent-Receiver Front End for Optical Quadrature Amplitude Modulation&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.analog.com/static/imported-files/application_notes/AN-1039.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;Correcting Imperfections in IQ Modulators to Improve RF Signal Fidelity&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ece.uic.edu/~devroye/courses/ECE531/project/Nash.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;Estimation and Compensation of Impairments caused by Quadrature Modulators and Demodulators&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="484" LastActivityDate="2014-02-12T13:55:22.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14347" PostTypeId="2" ParentId="14336" CreationDate="2014-02-12T14:09:48.250" Score="3" Body="&lt;p&gt;For the amplitude, the inequation $|a+b|≤|a|+|b|$ is satisfied. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since the power includes a square calculation on the amplitude, you can find all the three ($=$,$\leq$,and $\geq$) relations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference is that amplitude is a vector, while power is a scalar. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-12T14:09:48.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14348" PostTypeId="2" ParentId="14338" CreationDate="2014-02-12T14:29:46.560" Score="7" Body="&lt;p&gt;Harris Corner detector tries to quantify the local intensity changes at all the directions for each pixel. The figure below illustrates the basic idea clearly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k1CCY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $I(x+u,y+v)$ indicates the pixel intensities of all the neighborhood pixels around $(x,y)$.&#xA;The window function is applied for feature localization. For most often used Gaussian function, the choice of sigma value corresponds to different feature width in the image.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-12T14:29:46.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14349" PostTypeId="2" ParentId="14343" CreationDate="2014-02-12T14:38:31.753" Score="2" Body="&lt;p&gt;A single sample tells almost nothing about the frequency of a signal.  The only hypothesis that is eliminated is a DC signal of a different value from that of the sample.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more samples one accumulates over a longer period of time, the better one might be able to fit a maximum likelihood estimate of higher degree models of what the spectrum of the signal might be to those samples, assuming non-aliased samples of a high enough density relative to the bandwidth the signal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-12T14:38:31.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14350" PostTypeId="2" ParentId="14237" CreationDate="2014-02-12T15:02:26.953" Score="2" Body="&lt;p&gt;I would suggest you first &lt;em&gt;demodulate&lt;/em&gt; your signal. Take the received signal &lt;code&gt;y[t] = x[t]*cos(2*pi*1000*t)&lt;/code&gt; and multiply it by &lt;code&gt;cos(2*pi*1000*t)&lt;/code&gt;. Remember, $ cos(A)cos(B) = 1/2 (cos(A-B) + cos(A+B)) $. You'll be left with &lt;code&gt;x[t]*0.5*(cos(0) + cos(2*pi*2000*t) = x[t]*0.5*1 + x[t]*0.5*cos(2*pi*2000*t)&lt;/code&gt;. Filtering the remaining signal with a low pass filter at 1k Hz, leaving only x[t]. From there you can try and answer the rest of your questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab this will look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:1/Fs:END_TIME;  % Fs is your sampling rate. This makes a vector of individual time ticks&#xA;y_demod = y.*cos(2*pi*1000*t);   % This multiplies every element in Y with the cos(...) &#xA;                                 % ... element. Make sure they're the same size.&#xA;a = (1/Fs)*(Fs/4);               % A cutoff frequency of approximately 1/2 the sampling rate&#xA;x_est = filter([1 1-a],a,y_demod);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The simple 1-pole low pass filter was taken from here: &lt;a href=&quot;https://stackoverflow.com/questions/1783633/matlab-apply-a-low-pass-or-high-pass-filter-to-an-array&quot;&gt;https://stackoverflow.com/questions/1783633/matlab-apply-a-low-pass-or-high-pass-filter-to-an-array&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="461" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-02-12T15:24:08.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14351" PostTypeId="2" ParentId="14345" CreationDate="2014-02-12T15:20:58.043" Score="0" Body="&lt;p&gt;If the signal is band-limited (at least above some noise level) below half the highest frequency in your initial frequency evaluation set, then you can resample the spectrum to any other frequency spacing by using periodic Sinc (Dirichlet) kernel interpolation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is an integer relationship between the two carrier frequency bin spacings, then you can pre-calculate a polyphase interpolation table using the Sinc function (or a windowed approximation, if that meets your S/N requirements).  Otherwise you can convolve the entire spectrum vector against a computed periodic Sinc or Dirichlet kernel with the appropriate phase offset per computed &quot;carrier&quot; frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-12T15:20:58.043" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14352" PostTypeId="2" ParentId="8945" CreationDate="2014-02-12T15:59:30.130" Score="1" Body="&lt;p&gt;Since it is very hard to guess what result you &lt;em&gt;need&lt;/em&gt;, proposing any automatic segmentation method is very hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me instead propose two different semi-automatic &lt;em&gt;segmentation with markers&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Segmentation using Minimum Spanning Forests with markers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method is based on a version of watershed &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4564470&quot; rel=&quot;nofollow&quot;&gt;[Cousty et. al.: &lt;em&gt;Watershed Cuts: Minimum Spanning Forests and the Drop of Water Principle&lt;/em&gt;, 2009]&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you calculate a version of watershed (there are many versions), called &lt;em&gt;watershed cuts&lt;/em&gt;, which gives you a (pretty severe) over-segmentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, you mark your one object (or all of your objects, 1 marker per object + 1 for the background if there is any) you want to find, and it calculates the most likely segmentation based on pre-calculated watershed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to go into details, since there is pseudo-code and example images provided (one is even a cell image) in the article, but if you want me please leave a comment and I can add some more information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Segmentation using $\alpha$-trees (or $\alpha$-connected components) with markers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the &quot;starting over-segmentation&quot; is actually simply the segmentation to flat-zones (equal-intensity areas in the image). I am going to explain a little bit of theory here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An $\alpha$-connected component of a pixel $p$, or $\alpha$-$CC(p)$ is obtained as follows: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;first you choose a connectivity (4- or 8-conn.; 4-conn simply means the neighbors of a pixel are &lt;em&gt;up, down, left,&lt;/em&gt; and &lt;em&gt;right&lt;/em&gt;)&lt;/li&gt;&#xA;&lt;li&gt;if the intensity difference between two neighboring pixels is $\leq \alpha$, those pixels are connected&lt;/li&gt;&#xA;&lt;li&gt;$\alpha$-$CC(p)$ contains all the pixels connected to pixel $p$ as well as all the pixels that can be reached from pixel $p$ through a connected path &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, for various reasons (I can expand the answer again if somebody asks), if you follow the $\alpha$-$CC$ around one pixel, its area usually grows slowly as you increase the $\alpha$, then at some point you have a sudden and rapid increase in the area, and then it continues to grow slowly. Usually, if you look at the $\alpha$-$CC$ just in the moment &lt;em&gt;before&lt;/em&gt; the rapid size increase, it will give you your object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, you can use markers to mark which $\alpha$-$CC$'s you want to &quot;follow&quot;. The advantage here is that you can calculate the $\alpha$-hierarchy once and then do all the calculations on the same hierarchy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it sounds a bit confusing with all the new terms unless you know something about $\alpha$-trees, but here's some references to help:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-32313-3_4&quot; rel=&quot;nofollow&quot;&gt;Najman, Soille: &lt;em&gt;On Morphological Hierarchical Representations for Image Processing and Spatial Data Clustering&lt;/em&gt;, 2012&lt;/a&gt; - a good reference for $\alpha$-hierarchies in general&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-38294-9_18&quot; rel=&quot;nofollow&quot;&gt;Serna, Marcotegui: &lt;em&gt;Attribute Controlled Reconstruction and Adaptive Mathematical Morphology&lt;/em&gt;, 2013&lt;/a&gt; - these guys have done something very similar to what I am proposing. One of the proposed and explored usages in their article is segmentation (they're just using more attributes, not just area).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6395114&quot; rel=&quot;nofollow&quot;&gt;Merciol, Lefevre: &lt;em&gt;Fast Image and Video Segmentation Based on Alpha-tree Multiscale Representation&lt;/em&gt;, 2012&lt;/a&gt; - this is more or less exactly the usage I described.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2014-02-12T15:59:30.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14353" PostTypeId="1" AcceptedAnswerId="14401" CreationDate="2014-02-12T15:59:32.183" Score="3" ViewCount="8944" Body="&lt;p&gt;I am working on decimation of signal, and I want to know which is the best way to understand if the downsampling is well done or not. At the moment I am comparing the FFT of the source signal and the downsampled signal and I observed a downward shift of it (I think it is due to the lesser quantity of samples), I had also a look into the time behavior. Do you have other advices/suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the comments/answers:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;one method to understand if the downsampling process is well done is by comparing the FFT of the decimated signal and the original signal. The original signal must be attenuated by the decimation factor as suggested in the answer from @user2934229. Otherwise the signals can be normalized by the length of the signal (not suggested in my case because the signal is too long);&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7796" LastEditorUserId="7796" LastEditDate="2014-02-17T16:57:34.993" LastActivityDate="2014-02-17T16:57:34.993" Title="Downsampling/Decimation - When is well done?" Tags="|fft|filters|downsampling|decimation|" AnswerCount="6" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14354" PostTypeId="2" ParentId="14353" CreationDate="2014-02-12T16:17:17.460" Score="-3" Body="&lt;p&gt;A decent ,,downsampling'' (let's say for obvious audio purposes) would, as you observed, just scale the spectrum and pad it with zeroes at the upper end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point would be that this is hard to do. Just inserting zeros (let's say one between each pair of samples) will mirror the spectrum into the upper half of the new spectrum. You would first insert zeros and then filter with as steep a filter as you can get. This will introduce error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You were talking about decimation, which means removing samples. That would upsample your signal. I suppose you were referring to inserting samples instead.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-12T16:17:17.460" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14356" PostTypeId="2" ParentId="14353" CreationDate="2014-02-12T16:29:41.513" Score="1" Body="&lt;p&gt;One either needs to have a signal that is already bandlimited to below half the new downsampled sample rate, or low-pass filter the signal before doing the decimation.  If the latter, then the downsampling is &quot;well done&quot; if the low-pass filtering is &quot;well done&quot;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-12T16:29:41.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14357" PostTypeId="2" ParentId="14353" CreationDate="2014-02-12T16:55:11.727" Score="0" Body="&lt;p&gt;When you down sample the signal it will spread and may overlap or leak,or in generally cause problems because of that spreading of it.So you should apply filters in order to restrict that behavior,and take care that you downsampling it with factors that will not bring it down that the fundamental frequency range (fs/2).I hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-02-12T16:55:11.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14358" PostTypeId="1" CreationDate="2014-02-12T18:03:19.353" Score="2" ViewCount="107" Body="&lt;p&gt;Please consider the following excerpt (from &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/19188125&quot; rel=&quot;nofollow&quot;&gt;Rodrigo R, Zouqi M, Chen Z, Samarabandu J.: &lt;em&gt;Robust and efficient feature tracking for indoor navigation&lt;/em&gt;&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Robust feature tracking is a requirement for many computer vision tasks such as indoor robot navigation. However, indoor scenes are characterized by poorly &lt;strong&gt;localizable&lt;/strong&gt; features.&lt;/em&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand what &lt;em&gt;localizability&lt;/em&gt; is, and would appreciate help.  (PS: I know there is a dsp tag called &quot;local-features&quot;, but the tag currently has no definition.)&lt;/p&gt;&#xA;" OwnerUserId="5025" LastEditorUserId="1273" LastEditDate="2014-02-13T09:54:02.430" LastActivityDate="2014-02-13T09:54:02.430" Title="What is localizability in Computer Vision?" Tags="|computer-vision|local-features|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14359" PostTypeId="2" ParentId="14353" CreationDate="2014-02-12T18:49:05.997" Score="1" Body="&lt;p&gt;If your data is already bandlimited such that downsampling will not produce any aliasing, then you will not notice any difference. For example, if your data is sampled at 1000Hz, but there's not spectral content above 250Hz, downsampling by a factor of two to get a new sample rate of 500Hz will not produce any aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose you do have spectral content above 250Hz and you want to asses how well downsampling with an anti-aliasing filter will suppress any aliasing, then you must design the filter to your specifications. Typically you will set the stop band attentuation level to something like 30dB or more and then plot the filter to see if indeed is properly designed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is, then it's safe to say that any signals in the stop band will be attenuated by that amount. That's just how filtering works. Long story short, design the filter to your specification and plot it. If it isn't, consider increasing the filter order.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-02-12T18:49:05.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14360" PostTypeId="2" ParentId="14358" CreationDate="2014-02-12T18:59:25.877" Score="5" Body="&lt;p&gt;In the robot navigation problem, the localization problem refers to the real time estimation of its position and orientation under various backgrounds. This is usually achieved by some natural landmark selection (laser points, camera views, etc.), and the features in the image (corners, tiny lines with different orientations, etc.). So the localizability reflects how easy, robust and consistent the robot's position and orientation can be estimated with the choice of feature points. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.centropiaggio.unipi.it/sites/default/files/Perruquetti.pdf&quot;&gt;Hugues Sert et al's Mobile robot algebraic localizability&lt;/a&gt; includes more strict definition with details, and its relation to observability.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-12T18:59:25.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14363" PostTypeId="1" CreationDate="2014-02-12T21:07:31.737" Score="1" ViewCount="384" Body="&lt;p&gt;would you please tell me what does LPCC exactly do?How can we calculate the coefficients of LPCC?&#xA;I need to know clearly what is it so i can implement it.&#xA;I dont know if i am asking this question correctly but whats the different between LPC and LPCC?do they even have any similarity that gives us the ability to talk about differences?&#xA;I taught calculating mfc coefficients  is a part of lpcc? right?&#xA;I would appreciate if you help me out with that :)&lt;/p&gt;&#xA;" OwnerUserId="7070" LastActivityDate="2014-02-12T21:07:31.737" Title="Definition of LPCC" Tags="|signal-analysis|lpc|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14364" PostTypeId="1" CreationDate="2014-02-12T21:42:21.663" Score="2" ViewCount="2071" Body="&lt;p&gt;What criteria should be used to safely decide if it is an IIR filter or FIR filter from a difference equation? FIR filter are always stable, meaning all poles are inside the unit circle AND have pole-zero cancellations i.e have equal number of poles and zeros at the same point in the z-plane. IIR filters are conditionally stable, i.e always have poles on/outside the unit circle. Is this good enough to distinguish from the difference equation? what other criteria should be considered? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: Please don't say IIR filters have recursive difference equations, and FIR doesn't. It is not true.&lt;/p&gt;&#xA;" OwnerUserId="7570" LastEditorUserId="7570" LastEditDate="2014-02-12T23:48:13.833" LastActivityDate="2016-08-14T16:46:59.213" Title="Criteria to distinguish FIR and IIR filters from difference equation?" Tags="|filters|discrete-signals|infinite-impulse-response|linear-systems|finite-impulse-response|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14365" PostTypeId="2" ParentId="14364" CreationDate="2014-02-12T23:24:40.633" Score="6" Body="&lt;p&gt;If the Z-transform of the feedforward section is divisible by the Z-transform of the feedback section, the filter is FIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider your example: $y[n] = y[n-1] + x[n] - x[n-3]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Z-transform is $\mathrm Y(z)- z^{-1}\mathrm Y(z) = \mathrm X(z) - z^{-3}\mathrm X(z)$, and the Z-transform of the response is $\mathrm H(z) = \mathrm Y(z)/\mathrm X(z) = (1 - z^{-3})/(1 - z^{-1}) = 1 + z^{-1} + z^{-2}$. This means that the filter can be realized as $\mathrm y[n] = \mathrm x[n] + \mathrm x[n-1] + \mathrm x[n-2]$, which is clearly FIR.&lt;/p&gt;&#xA;" OwnerUserId="7883" LastEditorUserId="11256" LastEditDate="2016-08-14T16:46:59.213" LastActivityDate="2016-08-14T16:46:59.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14366" PostTypeId="2" ParentId="14364" CreationDate="2014-02-12T23:32:42.577" Score="-1" Body="&lt;p&gt;As far as i know, unless you want a deep philosophical analysis fo filters, there is absolutely no working distinction between a FIR/IIR filter or a diference equation, in the sense that a filter has &quot;ALWAYS&quot; an associated diference equation that you can write.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that though, if you randomly pick up a piece of papaer that has a difference equation written on it, you can't automatically say &quot;Oh they are working with filters and signal processing here&quot;, because difference equations are used in lots of other applications where you aren't even processing a signal. And the solution to the equation (giveng initial conditions or an input $X[n]$) might mean something completely different to the output of a filter.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-02-12T23:32:42.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14367" PostTypeId="1" CreationDate="2014-02-13T00:01:13.943" Score="0" ViewCount="1979" Body="&lt;p&gt;I know that for linear phase filters, all frequency components have equal delay times. That is, there is no distortion of signal due to the time delay of frequencies relative to one another. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for filters generalised linear phase, where the phase is of the form &lt;span class=&quot;math-container&quot;&gt;$a\omega+b$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is not zero. Will the same be true for them? Thanks in advance! &lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="4298" LastEditDate="2019-12-18T13:17:03.970" LastActivityDate="2019-12-18T13:17:03.970" Title="linear phase and generalised linear phase filters" Tags="|filters|linear-phase|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14368" PostTypeId="1" CreationDate="2014-02-13T00:59:44.160" Score="4" ViewCount="1345" Body="&lt;p&gt;Are there any modulation schemes (or other situations) where sampling at or very near twice the carrier frequency would be better than IQ or quadrature sampling using a local oscillator at or near the carrier frequency for SDR demodulation?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2017-02-16T05:38:09.250" Title="IQ sampling vs 2X f0 sampling for SDR" Tags="|demodulation|software-defined-radio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14370" PostTypeId="2" ParentId="14339" CreationDate="2014-02-13T04:07:32.027" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://code.google.com/p/tesseract-ocr/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tesseract&lt;/a&gt; is an often used OCR tool, but before that you need to pre-processing your image with some basic operations such as binarization, morphological operation, and &lt;a href=&quot;https://stackoverflow.com/questions/9292726/how-to-correct-uneven-illumination-in-images-using-matlab&quot;&gt;illumination equalization&lt;/a&gt;, and letter extraction.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-02-13T04:07:32.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14371" PostTypeId="2" ParentId="14367" CreationDate="2014-02-13T04:59:23.067" Score="1" Body="&lt;p&gt;Yes the same will be true for generalized linear phase. The only difference is that there will be a processing delay, due to the filter being casual like hotpaw2 said. Normally for FIR filters this delays is half the number of coefficients of the filter.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-02-13T04:59:23.067" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14372" PostTypeId="2" ParentId="577" CreationDate="2014-02-13T05:42:38.630" Score="1" Body="&lt;p&gt;A little gotcha regarding time complexity: FIR filters are vectorizable, which really helps in  modern CPU architectures. Furthermore, IIR filters take a performance hit because the current output value depends on earlier output values, which removes the advantage of pipelining.&lt;/p&gt;&#xA;" OwnerUserId="7883" LastActivityDate="2014-02-13T05:42:38.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14374" PostTypeId="1" AcceptedAnswerId="14379" CreationDate="2014-02-13T06:08:02.057" Score="0" ViewCount="578" Body="&lt;p&gt;For antisymmetric FIR windows, the phase response is of the form $a\omega+b$, where $b$ is $\pm\frac{\pi}{2}$, so it is not strictly linear. Does the waveform of the signal gets retained?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="90" LastEditDate="2014-02-13T15:47:48.637" LastActivityDate="2014-02-13T15:47:48.637" Title="Do antisymmetric FIR filters preserve the shape of their input waveforms?" Tags="|filters|linear-phase|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14376" PostTypeId="1" AcceptedAnswerId="14377" CreationDate="2014-02-13T10:52:10.457" Score="-4" ViewCount="1005" Body="&lt;p&gt;$X(jw) = 1 + \frac {jw+3}{jw+4}$  what is the IDFT of this signal?&lt;/p&gt;&#xA;" OwnerUserId="7892" LastEditorUserId="7092" LastEditDate="2014-02-13T12:24:34.303" LastActivityDate="2014-02-13T12:24:34.303" Title="How to calculate IDFT this signal?" Tags="|fourier-transform|continuous-signals|deconvolution|" AnswerCount="1" CommentCount="7" ClosedDate="2014-02-13T16:04:10.837" ContentLicense="CC BY-SA 3.0" />
  <row Id="14377" PostTypeId="2" ParentId="14376" CreationDate="2014-02-13T11:07:01.833" Score="-2" Body="&lt;p&gt;IF w refers to set of frequencies i assume that you can put it on Matlab and get the results,for sure.&lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-02-13T11:07:01.833" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14378" PostTypeId="2" ParentId="11177" CreationDate="2014-02-13T11:46:48.893" Score="7" Body="&lt;p&gt;You want to have an interpolation with a equal number of weights on both sides of the points you want to interpolate in between. So you choose either one or two weights on each side, resulting in an interpolation of two (linear) or four (cubic) points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An quadratic interpolation would need three points, which would only make sense at the border of a grid, where you can choose only one point on one side and two on the other.&lt;/p&gt;&#xA;" OwnerUserId="7893" LastActivityDate="2014-02-13T11:46:48.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14379" PostTypeId="2" ParentId="14374" CreationDate="2014-02-13T12:05:10.553" Score="5" Body="&lt;p&gt;Such phase response is called &lt;em&gt;Generalized linear phase&lt;/em&gt;, where you are allowed the $\pm \pi/2$ constant phase, and zero crossings (which add $\pi$ jumps in phase at one or more frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filters with an antisymmetric impulse response do in fact have the $\pm \pi/2$ constant phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simplest case: $h[n] = \delta[n] - \delta[n-1]$, with frequency response $H(e^{j\theta}) = 2j e^{-j \theta /2} \sin( \theta/2 )$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practical terms, these filters are types of differentiators: they all have a zero at $z=1$ (0 frequency) due to the fact that $\displaystyle\sum h[n] = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is clear that these filters &lt;em&gt;do not retain&lt;/em&gt; the waveform of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally you say that linear phase filters &quot;retain the waveform&quot; in case of low-pass filters, where you want to filter out noise but retain the shape of a pulse. More importantly, you want a good eye-pattern when decoding, and a non-linear-phase filter will result in asymmetric step responses and a poor eye pattern.&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="80" LastEditDate="2014-02-13T12:59:17.417" LastActivityDate="2014-02-13T12:59:17.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14380" PostTypeId="2" ParentId="14353" CreationDate="2014-02-13T13:53:25.393" Score="0" Body="&lt;p&gt;It depends entirely how your spectrum looks and what type of signal you have that you want to decimate.&lt;br&gt;&#xA;If you have a signal only (no interferers in band), you have to design a filter that suppresses any images resulting from the decimation process. The amount of filtering depends on how much you need to suppress the image signal to maintain an SNR that still allows you to decode the signal.&lt;br&gt;&#xA;If you have a signal with an interferer, the amount of filtering would have to take into account how much the interferer and signal images needs to be suppressed to have an good SNR afterwards.&lt;br&gt;&#xA;So the quick answer is to look at SNR before and after decimation to tell you if you have done it properly.&lt;/p&gt;&#xA;" OwnerUserId="7890" LastActivityDate="2014-02-13T13:53:25.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14381" PostTypeId="1" CreationDate="2014-02-13T16:52:56.563" Score="1" ViewCount="1034" Body="&lt;p&gt;I am searching for a good thesis topic on DSP with the use Matlab/Simulink/LabVIEW for my master, however, when I contact my department (we only have 1 DSP professor), he asks me to try to propose one but I cannot think of any.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if someone can help me with some ideas&lt;/p&gt;&#xA;" OwnerUserId="7226" LastActivityDate="2014-02-13T17:50:24.537" Title="Thesis Topics for DSP using Matlab/Simulink/LabVIEW" Tags="|matlab|" AnswerCount="1" CommentCount="2" ClosedDate="2014-03-14T13:52:39.757" ContentLicense="CC BY-SA 3.0" />
  <row Id="14382" PostTypeId="2" ParentId="14381" CreationDate="2014-02-13T17:50:24.537" Score="0" Body="&lt;p&gt;If I were you, I'd go for something related to Compressed Sensing. Even though my Ph.D. is not on this subject, I've come across it couple of months ago and it looks quite interesting, and it's relatively a new topic too (correct me if i'm wrong). Violating the Nyquist Sampling rate has never been that scientific and fun I suppose. Give it a shot, read a couple of papers (there are really good review papers out there that can give you a good introduction, you might want to visit &lt;a href=&quot;http://dsp.rice.edu/cs&quot; rel=&quot;nofollow&quot;&gt;this website&lt;/a&gt; for a good start). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck and try to have fun while doing it, that's a must!&lt;/p&gt;&#xA;" OwnerUserId="7113" LastActivityDate="2014-02-13T17:50:24.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14383" PostTypeId="2" ParentId="14244" CreationDate="2014-02-13T20:01:23.913" Score="1" Body="&lt;p&gt;It is advantageous for a simple reason:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The DC component carries little information for signal processing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(well, you can find counterexamples - but from my experience, they would weight 0.01%)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the mean of wavelet coefficient, when convolved with an image, would transfer to this mean times the DC component. Having this information in your wavelet coefficients vector would just add some redundant, mostly uninformative bias.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2014-02-13T20:01:23.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14384" PostTypeId="2" ParentId="14275" CreationDate="2014-02-13T20:08:05.673" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't know why generally in an image high frequency component&#xA;  contain more noise.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is not always true and depends on the relative envelope of both the signal and noise. Imagine your signal is the image of a bar code while you are in a foggy environment generating cloud-like noise. This will generate a situation where the signal is more white and the noise pink - in that case the opposite would be true: in this image low frequency component contain (relatively) more noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This counter-example is to show your are most of the time true: natural images have have an envelope which is mostly pink (in 1/f) due to the fact that they contain images of objects that are self-similar while pixel noise is mostly independent - thus white- noise. Yes, in most images, the high frequency components relatively contain more noise.  &lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2014-02-13T20:08:05.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14385" PostTypeId="2" ParentId="4723" CreationDate="2014-02-13T20:25:17.503" Score="2" Body="&lt;p&gt;Another way to look at convolution is to consider that you have two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;DATA - quantities certainly corrupted by some noise - and at random positions (in time, space, name it)&lt;/li&gt;&#xA;&lt;li&gt;PATTERN = some knowledge of how information should look like&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;the convolution of DATA with (the mirror symmetric of the) PATTERN is another quantity that evaluates -knowing the PATTERN- how likely it is that it is at each of the positions within the DATA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Technically, at every position, this quantity is the correlation (this is  the mirror of the PATTERN) and thus measures the log-likelihood under some general assumptions (independent Gaussian noise). The convolution allows to compute it at each position (in space, time ...) in parallel.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastEditorUserId="1085" LastEditDate="2016-12-26T21:31:24.033" LastActivityDate="2016-12-26T21:31:24.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14386" PostTypeId="1" CreationDate="2014-02-13T22:57:55.907" Score="1" ViewCount="417" Body="&lt;p&gt;Assume I have a (single real float channel) biquad IIR filter implemented in C, and some coefficients for a bandpass filter (right out of RBJ's cookbook).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I convert the input, output, data path, and internal arithmetic of this IIR filter to use complex data types and multiplies, can I use the resulting code to filter a complex (IQ) data stream?  If so, how might I modify the biquad IIR coefficients to filter just the negative frequency versus the positive frequency band in a complex (IQ) data stream?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-13T22:57:55.907" Title="IIR biquad coefficients for negative frequencies in IQ data?" Tags="|infinite-impulse-response|biquad|quadrature|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14387" PostTypeId="1" CreationDate="2014-02-14T00:41:04.930" Score="3" ViewCount="1577" Body="&lt;p&gt;What are the differences between KLT and SVD? It looks more or less similar to me. Did I misunderstand the concepts? Explain me more about SVD and if possible provide me the link for SVD (Image Processing). Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7834" LastEditorUserId="6" LastEditDate="2014-02-14T01:07:52.413" LastActivityDate="2014-02-14T03:15:15.743" Title="How do KLT and SVD differ from each other?" Tags="|image-processing|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14388" PostTypeId="2" ParentId="14387" CreationDate="2014-02-14T01:13:34.907" Score="1" Body="&lt;p&gt;KLT and SVD are essentially the same, except KLT is applied to continuous linear operators, and SVD is applied to finite-variable linear operators (matrices). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The principal idea is the same: given a linear function (or operator), we find a basis representation for the inputs in such a way that every component of this basis would get multiplied by a number. This is more simply knows as eigenvalue decomposition.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-02-14T01:13:34.907" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14389" PostTypeId="1" CreationDate="2014-02-14T01:15:03.137" Score="0" ViewCount="53" Body="&lt;p&gt;Sound are digitalized in computers as an archive with its intensity amplitude at the given time. I want to ask a very simple question about frequency filtering. How it's done, if there's no frequency information stored in the digital audio? It's all intensity. I cannot understand.&lt;/p&gt;&#xA;" OwnerUserId="7898" LastActivityDate="2014-02-14T01:31:55.473" Title="Frequency filtering - Audio" Tags="|frequency|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14390" PostTypeId="2" ParentId="14389" CreationDate="2014-02-14T01:31:55.473" Score="3" Body="&lt;p&gt;An set of digitized intensity samples that varies in time produces a waveform (just graph the data).  If the waveform shows any periodicity, that will be an obvious frequency.  Even if it doesn't, Fourier theory says any (non-pathological) waveform can be decomposed into a set (perhaps infinite) of sinewaves.  And sinewaves are describe as having a frequency.  Thus frequency information is implicit.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this frequency information can be changed by certain filtering processes or algorithms many different ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if the digitized samples don't vary at all (a set of constants), that is the same as DC, or a frequency of zero (0 Hz).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-14T01:31:55.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14391" PostTypeId="2" ParentId="14387" CreationDate="2014-02-14T03:08:51.080" Score="2" Body="&lt;p&gt;From the direct implementations of the two, SVD and KLT are different since $S$ in SVD is a diagonal matrix, while $C$ in KLT is not. Besides, KLT is originally used to describe a stationary process. In its expansion, an infinite number of basis functions is required to&#xA;form a complete set. Yet for a random vector $X$, it can be rephreased in terms of a linear combination of orthonornal basis vectors, then covariance matrix $C$ is furtherly derived.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a 2D image, we can view it as $M$ realizations of stochastic process $x$ where $M$ is the row of the image. And the assumption is that all rows have the same row covariance matrix $C$, then the KLT can be somehow converted to the form of SVD. In other words, when considering a multivariate stochastic process, the SVD and the KLT are computationally equivalent. That's why in most cases people view the both as the same. For mathematical details, refer to &lt;a href=&quot;http://saig.physics.ualberta.ca/s/sites/default/files/chapter6.pdf&quot; rel=&quot;nofollow&quot;&gt;The KL transform and eigenimages&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the application of image compression, the global KLT is used for the whole image, while SVD is better applied to each block. In &lt;a href=&quot;http://mirlab.org/conference_papers/International_Conference/ICASSP%201997/pdf/scan/ic972713.pdf&quot; rel=&quot;nofollow&quot;&gt;Patrick et al's Hybrid KLT-SVD Image Compression&lt;/a&gt;, they combined the two method to implement the adaptive transform on the blocks to achieve a better coding efficiency.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-14T03:15:15.743" LastActivityDate="2014-02-14T03:15:15.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14392" PostTypeId="1" CreationDate="2014-02-14T03:46:28.317" Score="1" ViewCount="143" Body="&lt;p&gt;Compressed sensing (CS) guarantees exact object recovery (or with high probability) given a) sufficient measurements are taken in a sparse basis which is b) incoherent vis-a-vis a given object representation basis.&lt;/p&gt;&#xA;&lt;p&gt;Does CS theory state anything about reconstruction of successively less sparse signals? That is, if I don't meet the requirements of a) can I say anything about what the reconstruction will look like? I think the answer is No from watching Candes's &lt;a href=&quot;http://videolectures.net/mlss09us_candes_ocsssrl1m/&quot; rel=&quot;nofollow noreferrer&quot;&gt;lectures&lt;/a&gt;. But I haven't read this specifically yet. I would appreciate any pointers/references.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: I think the answer, at least empirically, is shown in &lt;a href=&quot;https://arxiv.org/abs/0805.4471&quot; rel=&quot;nofollow noreferrer&quot;&gt;Emmanuel J. Candes, Benjamin Recht - Exact Matrix Completion via Convex Optimization&lt;/a&gt; for Matrix Completion (long paper), where the x axis shows the sampling ratio and the y axis shows the ratio of degrees of freedom to the number of samples taken. The saw-tooth pattern between black and white areas seems interesting - perhaps suggesting that there are some sample ratios which do better at higher ranks. &lt;img src=&quot;https://i.stack.imgur.com/BZjQ9.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="7092" LastEditDate="2023-07-06T21:37:09.167" LastActivityDate="2023-07-06T21:37:09.167" Title="Sparsity limits of compressed sensing - is this right?" Tags="|image-processing|computer-vision|compressive-sensing|image-compression|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14393" PostTypeId="2" ParentId="13785" CreationDate="2014-02-14T04:41:18.937" Score="0" Body="&lt;p&gt;ENBW = equivalent noise bandwidth.  A rectangular window with values &lt;span class=&quot;math-container&quot;&gt;$\frac {1}{N}$&lt;/span&gt; (one might say this is the no-window case) has an equivalent noise bandwidth of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.  Look for fred harris's (&lt;a href=&quot;https://en.wikipedia.org/wiki/Fredric_J._Harris&quot; rel=&quot;nofollow noreferrer&quot;&gt;he doesn't capitalize his name&lt;/a&gt;) paper titled &lt;a href=&quot;https://ieeexplore.ieee.org/document/1455106&quot; rel=&quot;nofollow noreferrer&quot;&gt;On the use of Windows for Harmonic Analysis with the Discrete Fourier Transform&lt;/a&gt;.  It's a classic and should explain what you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="7899" LastEditorUserId="7092" LastEditDate="2022-06-27T13:21:19.717" LastActivityDate="2022-06-27T13:21:19.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14395" PostTypeId="1" CreationDate="2014-02-14T11:29:14.277" Score="5" ViewCount="513" Body="&lt;p&gt;I'm afraid this might be a bit of an elementary question, but I'm afraid I'm a little new to this. I've got a system that measures a frequency spectrum to find resonant frequencies. It does this by applying an impulse, and then performs a linear sweep through a range of frequencies measuring the amplitude of the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, this seems to produce data that contains both frequency- and time-domain information, because the frequency being measured changes over time. The results seem to agree with this: the initial impulse decays over &quot;time&quot;, with individual excitations being visible at various frequencies. See here for an example (frequency on the horizontal axis, amplitude on the vertical): &#xA;&lt;img src=&quot;https://i.stack.imgur.com/9tdE9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to remove from this data the &quot;time&quot; component, leaving just the resonant responses. I have tried mirroring the data, then deconvolving a &quot;top hat&quot; function, and FTing the result, but I am not convinced this corresponds to anything meaningful. Could anyone provide any insight?&lt;/p&gt;&#xA;" OwnerUserId="7901" LastEditorUserId="1081" LastEditDate="2014-03-16T22:23:59.617" LastActivityDate="2018-09-13T08:00:58.273" Title="Mixed time/frequency domain data" Tags="|filters|frequency-spectrum|time-frequency|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14396" PostTypeId="2" ParentId="14395" CreationDate="2014-02-14T12:51:33.757" Score="0" Body="&lt;p&gt;Once you performed the FFT, there are no time components left. &#xA;If you don't need the entire spectrum image you got from the transform but only the main resonants, try smoothing the data and then apply some kind of peak-finding.&lt;/p&gt;&#xA;" OwnerUserId="7686" LastActivityDate="2014-02-14T12:51:33.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14398" PostTypeId="1" AcceptedAnswerId="14407" CreationDate="2014-02-14T15:28:24.440" Score="1" ViewCount="140" Body="&lt;p&gt;I am trying to compute the accuracy of the HMAX model. I am using the Face category (containing 435 images) from the Caltech101 database. I split it into x training and y testing. At each time, when x increases, the accuracy also increases. Furthermore, I heard that the number of training should be equal to 80% by comparing it to the tests. So when I split my data into 348 positive training and the rest for positive testing, I got an accuracy that it is smaller than the other smaller splits (when x&amp;lt;348)!!.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even when I took x=300, I also got a smaller accuracy!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, I also used the background category and I split it into 50 negative training and 50 negative testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please why I got a smaller accuracy? Please I need your help.&lt;/p&gt;&#xA;" OwnerUserId="6925" LastEditorUserId="6925" LastEditDate="2014-02-14T15:39:04.260" LastActivityDate="2014-10-13T19:26:52.027" Title="Database into training and testing images" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14399" PostTypeId="2" ParentId="14395" CreationDate="2014-02-14T16:48:10.610" Score="0" Body="&lt;p&gt;Ideally, you would excite with a sine and then measure the amplitude. Often, this is not practical, so you just try to measure the impulse response as good as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will not have to modify the recorded impulse response to measure resonant frequencies. They will naturally stand out in a spectrogram. There is no time component left that you would have to remove. However, the result probably will be complex, and the phase information relates to time. Adding a mirror image might cancel some part of the signal, you would not want that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case you should isolate single excitations. The result will get distorted if you transform more than a single pulse. You could probably undo that, but I think it's not worth the hassle. I don't know what you're trying to achieve by deconvolving a box function.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-14T16:48:10.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14401" PostTypeId="2" ParentId="14353" CreationDate="2014-02-14T20:27:47.853" Score="2" Body="&lt;p&gt;Ignoring your original question, and referring to your comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I am observing the FFT of the downsampled signal presents an attenuation. I don't understand why.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The output of FFT (or DFT in general) isn't normalized - it is relative to the signal length (the total amount of samples being transformed). When decimating a signal (say, by a factor of M), you end up with a signal with 1/M length the original signal's length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, because DFT/FFT results are relative to signal length, a decimated signal with a 1/M length would have DFT/FFT components &quot;attenuated&quot; by a factor of M as well, even if the original signal was properly downsampled (i.e. bandlimited before being decimated).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To properly compare between the DFT of different signals, you should divide the output of DFT by the length of the transformed signal, to normalize the transform.&lt;/p&gt;&#xA;" OwnerUserId="7827" LastActivityDate="2014-02-14T20:27:47.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14402" PostTypeId="1" CreationDate="2014-02-14T21:58:04.327" Score="0" ViewCount="126" Body="&lt;p&gt;Over the past few weeks, I have been working on a problem of segmenting an audio file containing some bat samples. I have now successfully come up with a moderate algorithm to do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to calculate the herts, or, the Htz of each of blocks that I have deemed to contain interest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, for the signal I am calculating the frequency using the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ freq = i * Fs / NFFT $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;i&lt;/code&gt; is the bin_index of the currently block. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This produces a vector containing 128 values which holds the frequencies. This, looks correct when I am plotting the spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each of the blocks that are of significance, I calculate the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Take the max magnitude of each of the blocks, capture the index&lt;br&gt;&#xA;2) Match the index (calculated above) against the frequency vector&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This, for one of the blocks produces the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;hertz = 3375&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To which I convert to Htz using the following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Htz = hertz / 1000 = 3.375&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, from my estimation, 33.3Htz does seem reasonable since this is in audible hearing, however, why am I getting such a small number, compared to what I should be getting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-02-14T21:58:04.327" Title="Calculating hertz / kHz" Tags="|frequency-spectrum|frequency|stft|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14404" PostTypeId="1" AcceptedAnswerId="14410" CreationDate="2014-02-15T02:21:47.063" Score="5" ViewCount="313" Body="&lt;p&gt;The big disadvantage of a DFT is that it has only frequency resolution and no time resolution. This means that although we might be able to determine all the frequencies present in a signal, we do not know when they are present. So we go for Wavelets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, What are the applications (other than music &amp;amp; speech processing ) that require both the time and frequency information at same time  ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you relate that we require both spatial (time) and frequency information in an image at a same time ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give me some good examples and suggest a book (PDF links) to learn Wavelet Multiresolution Analysis (For Dummies)&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="5800" LastEditDate="2014-02-17T13:38:40.147" LastActivityDate="2015-12-09T08:43:42.697" Title="Why we need Frequency and Time information at the same time" Tags="|image-processing|discrete-signals|frequency|time-frequency|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14405" PostTypeId="2" ParentId="14325" CreationDate="2014-02-15T03:25:48.183" Score="4" Body="&lt;p&gt;There are, in my opinion, several ambiguities in the question asked, and also in&#xA;Deve's answer which the OP has accepted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phrase &quot;$\ldots$ noise has spectral density $\frac{N_0}{2}\ldots$&quot; is&#xA;usually interpreted to mean that the noise is a &lt;em&gt;continuous-time white noise&#xA;process&lt;/em&gt; which is a mathematical abstraction that is useful and convenient&#xA;in many analyses.  This noise process is often assumed to be Gaussian as well&#xA;(white Gaussian noise) which leads to the acronym AWGN or WGN.  Any resemblance&#xA;to the signals broadcast by a certain Chicago radio and TV station are purely&#xA;coincidental...   In any case, the random variables constituting this mythical&#xA;process have &lt;strong&gt;zero mean&lt;/strong&gt;, because if not, then the power spectral density would&#xA;have a  impulse at $f=0$ in contradiction to the assumption that the spectral&#xA;density has fixed value $\frac{N_0}{2}$ for all $f$.&#xA;The random variables also have infinite variance (cf. the answer to &#xA;&lt;a href=&quot;https://dsp.stackexchange.com/q/8629/235&quot;&gt;this question&lt;/a&gt;) -- that is, the process does not&#xA;exist in nature and cannot be observed directly.  As pointed out in the&#xA;answer to the cited question, what &lt;em&gt;can&lt;/em&gt; observed is the effect that this&#xA;mythical process produces at the output of a filter in which case the&#xA;result is a wide-sense-stationary random process in which all the random&#xA;variables have variance $\sigma^2$ given by &#xA;$$\sigma^2  = \int_{-\infty}^\infty \frac{N_0}{2}|H(f)|^2\,\mathrm df$$&#xA;where $H(f)$ is the transfer function of the filter. Since the input&#xA;process has zero mean, so does the output process have zero mean, that is,&#xA; all the random variables constituting the process have zero mean. For the&#xA;case of WGN, the filter output is a strictly stationary &lt;em&gt;Gaussian&lt;/em&gt; &#xA;process, meaning that all the random variables are Gaussian random&#xA;variables.  As a special case of all this, if the filter is an ideal&#xA;bandpass filter of bandwidth $B$ Hz with unit gain in the passband, then&#xA;the noise variance is $N_0B$.  Such a filter has nonzero gain for&#xA;$|f| \leq B$ (lowpass filter) or for $|f| \in [f_c-B/2,f_c+B/2]$&#xA;(bandpass filter with center frequency $f_c$ Hz), and of course for&#xA;any filter, the noise variance is $N_0B$ where $B$ is the&#xA;&lt;em&gt;equivalent noise bandwidth&lt;/em&gt; of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning to the question asked by the OP, it is not clear what is meant by&#xA;_&quot;two-symbol canal (cable)&quot; and what is meant by $T_0$. One&#xA;possible interpretation is that we are transitioning from a &#xA;continuous-time process to a discrete-time process by sampling&#xA;the white noise at intervals of $T$ seconds.  Of course, the white&#xA;noise is observable only through the sampler which has finite&#xA;bandwidth and so what is actually being sampled is a finite-variance&#xA;process as described in the previous paragraph.  More practically,&#xA;one is usually concerned with observing some finite-bandwidth&#xA;lowpass signal $x(t)$, and so the signal (plus the white noise)&#xA;is first passed through a lowpass filter of bandwidth $B$ where&#xA;$B$ denotes the signal bandwidth, and now it is &lt;em&gt;this&lt;/em&gt; bandwidth,&#xA;(and not the bandwidth of the sampler which can be orders of&#xA;magnitude larger) that determines the noise variance.  But&#xA;what about the sampling interval $T$?  That has &lt;em&gt;no&lt;/em&gt; effect&#xA;on the variance of the noise samples.  What $T$ affects is&#xA;the &lt;em&gt;covariance&lt;/em&gt; between different samples.  The correlation&#xA;between two random variables separated by $t$ seconds in time&#xA;from bandlimited noise of bandwidth $B$ Hz is &#xA;$\operatorname{sinc}(Bt) = \frac{\sin(\pi Bt)}{\pi Bt}$,&#xA;that is, samples separated by multiples of $B^{-1}$ seconds&#xA;are &lt;em&gt;uncorrelated&lt;/em&gt; (and in the case of Gaussian noise, &lt;em&gt;independent&lt;/em&gt;)&#xA;and so if the sampling interval $T$ is a multiple of $B^{-1}$&#xA;seconds, the random variables are uncorrelated/independent which&#xA;is a model used very often.  But if the samples are taken at&#xA;other sampling rates, then the noise samples are correlated.&#xA;See &lt;a href=&quot;https://dsp.stackexchange.com/q/13328/235&quot;&gt;this question&lt;/a&gt;&#xA;for more discussion of this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if &quot;two-symbol&quot; means that something like a&#xA;BPSK system with symbol interval $T$ and a correlation receiver is &#xA;under consideration, then the noise at the correlator output&#xA;has variance $$\sigma^2 = \frac{N_0T}{2}$$ (cf. my comment in&#xA;response to a query from moderator PeterK. in the question&#xA;&lt;em&gt;Variance of white Gaussian noise&lt;/em&gt; cited earlier.)&#xA;Note the difference between this and the answer $N_0/(2T_0)$&#xA;given by @Deve.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-02-15T03:25:48.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14407" PostTypeId="2" ParentId="14398" CreationDate="2014-02-15T05:52:27.253" Score="2" Body="&lt;p&gt;Some of the possible reasons would be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Object recognition accuracy is not really well-defined. Instead accuracies are for particular datasets. &lt;/li&gt;&#xA;&lt;li&gt;What you are working with is called cross-validation, where you split your own dataset into testing and training datasets and then use the trained model to make predictions on the test dataset.&lt;/li&gt;&#xA;&lt;li&gt;Depending on how you do the cross-validation and the final model, the accuracy tests may vary. For example, if (even by a random process) your training set contains well-conforming images and the test dataset contains images which are not even closely conforming to your model, then the accuracy would be low.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As for a solution to your dilemma, you should probably consider looking at the dataset and sampling in such a way that this situation can be avoided. Alternatively you could use a more generalizable algorithm and check for overfitting of the data via cross-validation again.&lt;/p&gt;&#xA;" OwnerUserId="958" LastActivityDate="2014-02-15T05:52:27.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14408" PostTypeId="1" AcceptedAnswerId="14418" CreationDate="2014-02-15T10:33:53.997" Score="2" ViewCount="4156" Body="&lt;p&gt;I am a beginner in digital image processing, recently I read a paper on color image contrast enhancement, In that paper authors have implemented their method in HSV color model. In my work I have implemented that paper in MATLAB using RGB color model. I just want to know that whether it will make any difference or not?&lt;/p&gt;&#xA;" OwnerUserId="4444" LastActivityDate="2018-05-04T14:06:43.240" Title="Problem with HSV and RGB color model" Tags="|image-processing|matlab|color|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14409" PostTypeId="2" ParentId="14408" CreationDate="2014-02-15T11:15:39.537" Score="0" Body="&lt;p&gt;Yes, it make large difference. Why? Because HSV and RGB are much difference color space.&#xA;RGB is Red, Green and Blue, normal color space.&#xA;HSV is Hue, Saturation and Value (read more &lt;a href=&quot;http://en.wikipedia.org/wiki/HSL_and_HSV&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;). &#xA;In your algorithm ( or paper) take a look in which channel of image you should work. Sometimes you need only Value (for example histogram equalization), sometimes Saturation. In you paper should be precisly be said which channel they are using.&lt;/p&gt;&#xA;" OwnerUserId="7910" LastActivityDate="2014-02-15T11:15:39.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14410" PostTypeId="2" ParentId="14404" CreationDate="2014-02-15T13:49:58.263" Score="7" Body="&lt;pre&gt;&lt;code&gt;For the source, go to end of the answer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Suppose one day you got one note which has some thing written to it, say &lt;strong&gt;&quot;Major frequency components are 10 Hz, 25Hz, 50 Hz and 100 Hz&quot;&lt;/strong&gt;. Somehow, you understood that its time-series representation is a very important thing (may be master-piece work of a great musician, or some national security matter, anything). So you decided to find it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You start by plotting the spectrum which looks like below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p9rbN.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(There can be some noises/disturbances in between these frequencies, but most people neglect it)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you want to find its time-series representation. Since we have worked it a lot in our signal processing class in college, most probably, we get below signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t)=cos(2 \pi 10 t)+cos(2\pi 25 t)+cos(2 \pi 50 t)+cos(2 \pi 100 t) &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great !!! &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But is this the only time series representation for those frequencies?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider another time series signal which plays a sine wave of frequency 100 Hz for 300 ms, then 50 Hz sine wave for next 300 ms, then 25 Hz sine wave for 200 ms, then 10 Hz sine wave for 200 ms. A total of 1000 ms long signal. If you plot it, it will look like below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fEmtm.gif&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually above signal also have similar frequency spectrum (shown below):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MXrCE.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Those ripples are because of sudden changes in frequency. Amplitude changes are because of change in how long each frequency was played. They are not of importance to us right now.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So what to do now? How will you pick one? Even if we change the order they were played, still we get the same frequency spectrum. So how many such combinations you have?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;In short words, without knowing when those frequencies were played, it&#xA;  is very difficult to find its time series representation, and that is&#xA;  where, wavelets come into picture. It provides not only the&#xA;  frequencies present in the signal, but also, the time it was present&#xA;  in the signal.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;UPDATE (17-Feb-14)&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt; : How do you relate that we require both spatial (time) and frequency information in an image at a same time ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Answer&lt;/strong&gt; : &lt;em&gt;Me too, had the same question before, so after seeing your comment, I thought I should find one example (I haven't studied wavelets in the context of images before wavelets). And below explanation is the &lt;a href=&quot;http://www.quora.com/In-laymans-terms-what-is-a-wavelet-transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;summary of an answer in Quora.com&lt;/code&gt;&lt;/a&gt; (all credits to that author, Ron Reiter) which I felt as a good example.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be knowing that we use the DCT for jpeg compression of images. It preserves the low frequency data while throws away some of the high frequency data in the images, based on the image quality we need.Or in other words, this method is good with low frequency data, but not that accurate with high frequency data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in an image with sky and a tree, the areas of sky will be preserved accurately while some details of tree will be thrown off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In DCT, we take 8x8 blocks of images and encode it for all frequency of data. For very low frequencies, we could have used higher block size while for very high frequencies, we may have to use lower block size than this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now apply our wavelet method as explained in 1D case above. What if we can find both frequency and their location in the image? We can encode the low frequency areas in big chunks while high frequency areas in low chunks. So it produces better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Please check the link for more details&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;SOURCE:&lt;/h1&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~unjung/mylec/WTpart1.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;THE WAVELET TUTORIAL by ROBI POLIKAR&lt;/a&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All the images, explanation, everything, are extracted from this link. It is a must-read introduction of wavelets to beginners&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www-2.nersc.no/~even/matlab/toolbox/wavelets/amara/wavelet.html#wwwintro&quot; rel=&quot;nofollow noreferrer&quot;&gt;Amara's Wavelet Page&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.quora.com/In-laymans-terms-what-is-a-wavelet-transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wavelet in image compression - Ron Reiter at Quora.com&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="818" LastEditorUserId="818" LastEditDate="2014-02-17T02:48:02.143" LastActivityDate="2014-02-17T02:48:02.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14411" PostTypeId="1" AcceptedAnswerId="14419" CreationDate="2014-02-15T14:11:39.770" Score="0" ViewCount="9598" Body="&lt;p&gt;May i know what does this function do in matlab?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;num = fir1(80, [5Hz, 50Hz]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that 5 Hz is the low cut-off freq and 50 Hz is the high cut-off freq.&#xA;I'm not sure why it is 80 for the first parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What will be the output of this function?&lt;/p&gt;&#xA;" OwnerUserId="7758" LastEditorUserId="7092" LastEditDate="2020-03-31T04:52:43.887" LastActivityDate="2020-03-31T04:52:43.887" Title="What does fir1 in matlab does?" Tags="|matlab|filters|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14414" PostTypeId="1" AcceptedAnswerId="14420" CreationDate="2014-02-15T14:46:53.173" Score="3" ViewCount="1810" Body="&lt;p&gt;I'm trying to do some analysis of a curly human hair on an iPhone app. I've been using the openCV library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Particularly I want to be able to estimate the length of the hair, and locate its end points (a measure of curliness is stretched end-to-end length vs. relaxed end-to-end length).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach so far has been to use a canny edge detector to find the hair. Then to dilate the result. Finally to skeletonise the image and consider the ends to be those pixels that only have one neighbour. Since the resulting image would hopefully be a one pixel thick line, I could just count the pixels to estimate the length (and maybe adjust for diagonal movements).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trouble is when the hair is so curly it crosses itself. This makes the skeletonisation add in extra branches and rings that mess up the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better approach for very curly hairs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some examples:&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/C3UVD.jpg&quot; alt=&quot;Straight hair before&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bcZGr.png&quot; alt=&quot;Straight hair after&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NN05k.jpg&quot; alt=&quot;Curly hair before&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gSbsb.png&quot; alt=&quot;Curly hair after&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TYHuS.png&quot; alt=&quot;Curly hair zoomed&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7911" LastActivityDate="2014-02-15T22:09:52.977" Title="Algorithm for finding length and end points of a curly human hair" Tags="|image-processing|edge-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14415" PostTypeId="2" ParentId="14404" CreationDate="2014-02-15T16:32:36.597" Score="1" Body="&lt;p&gt;Yes, the way is from segment wise DFT to overlapping segments with window functions to something like Gabor wavelets to more general wavelet transforms. Only the first variant should be avoided for numerical reasons, the others have uses in their own right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applications are for instance if you analyze speech or some piece of music, where not only it is important that some pitch pattern occurred, but also when.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And of course, for broadband WiFi the location of information in a time-frequency structure is the basic working principle.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Multiresolution analysis is not for dummies. That is why, for instance, there is no decent wikipedia article on this topic. You immediately dive into some heavy functional analysis. Wim Sweldens once did a historical survey article on orthogonal wavelets that had all essential information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or perhaps it was someone else, however, have a look at Jawerth/Sweldens (1994) &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.45.5864&quot; rel=&quot;nofollow&quot;&gt;An overview of wavelet based MRA&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="231" LastEditDate="2015-12-09T08:43:42.697" LastActivityDate="2015-12-09T08:43:42.697" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14416" PostTypeId="1" CreationDate="2014-02-15T16:46:14.710" Score="7" ViewCount="625" Body="&lt;p&gt;I am working with speckle noise reduction in ultrasound images. I have used wavelet transform for removing the noise  by eliminating certain frequencies in order to eliminate any existing noise. Since in an image HH,LH,HL components contains most of the noise. We can eliminate noise by eliminating those components.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  step 1 : read an input image. &#xA;  step 2 : apply discrete wavelet transform.&#xA;  step 3 : Eliminate LH, HL, HH  by making these components zero.&#xA;  step 4 : Take inverse wavelet transform(let us consider this as output 1).&#xA;  step 5 : read the same input image and again take discrete wavelet transform.&#xA;  step 6 : eliminate LL component by making zero and keep LH,HL &amp;amp; HH because it contains edge information. (trying to remove noise from the edge information &amp;amp; add it back to Output 1)&#xA;  step 7 : take inverse wavelet transform .&#xA;  step 8 : Applying a Hybrid Filter (Median- Weiner) to the above image&#xA;  step 9 : We get the filtered image ( let us consider this as output 2) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have represented the same in the below figure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now, I need to combine output 1 and output 2 . I just added both the outputs but am not getting proper output . Please suggest me the technique which I should use to combine these two output images. Kindly tell me whether it is possible or not and also tell me whether this concept is correct or wrong.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/isaGJ.png&quot; alt=&quot;Block Diagram&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ImKLF.jpg&quot; alt=&quot;2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7794" LastEditorUserId="5800" LastEditDate="2014-02-16T01:44:30.503" LastActivityDate="2015-12-16T05:46:00.697" Title="Combining two images" Tags="|image-processing|wavelet|transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14417" PostTypeId="2" ParentId="14408" CreationDate="2014-02-15T17:58:28.763" Score="1" Body="&lt;p&gt;RGB module has three dependent layers R, G, B any change in the lightness and brightness reflects on the three colors layers (high correlation between the three layers). unlike other modules i.e, HSV, YIQ which separate the chromatic (color) in one or more independent layer as possible, a comparison between the RGB and other modules briefly was introduced by  &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0031320301000541&quot; rel=&quot;nofollow&quot;&gt;cheng et al&lt;/a&gt;. lightness represents a challenge in the image processing field not only on segmentation but also it has been observed the the affect of illumination variation is more the changes between the individual on pattern recognition. in 2D image, to obtain effective results with low computational cost you should treat the luminance as separated layer. on the other hand, HSV plots three layers: (V) brightness, (H) hue, and (S) saturation. While brightness embodies the achromatic layer, hue represents the dominant color, and saturation the amount of white mixed with the hue (hue and saturation are chromatic layers)&lt;/p&gt;&#xA;" OwnerUserId="5714" LastEditorUserId="5714" LastEditDate="2014-02-15T18:23:51.493" LastActivityDate="2014-02-15T18:23:51.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14418" PostTypeId="2" ParentId="14408" CreationDate="2014-02-15T20:00:52.063" Score="5" Body="&lt;p&gt;HSV is one of the color space transforms that separate color from intensity. Depending on your application (my understanding is contrast enhancement is somehow related to image segmentation in your OP), there are several advantages of HSV:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Histogram equalization of a color image is suggested only on the intensity component;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Saturation component is regarded as invariant in shadow (only intensity changes), so processing the image in HSV space is better suit for shadow removing. &lt;a href=&quot;https://stackoverflow.com/questions/20331347/how-to-remove-shadow-of-image-on-matlab/20333646#20333646&quot;&gt;This post&lt;/a&gt; that tried to remove the shadow from an image is for your reference;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Hue component makes the algorithm better immune and thus more robust to lighting variations. This feature makes it better fit in some medical applications such as the palm skin segmentation (under normal RGB space it is not easy to thresholding out the hand palm).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In color enhancement that you mentioned, if the colors in your image are not so strong, it would be quite difficult to detect colored objects. Adding some arbitrary value in the Image would not Help, since it would increase the brightness but not the contrast. After the conversion to HSV space you may increase the Saturation then convert it back to the RGB color space. The colors of interest may appear much better in the image which would facilitate the object recognition nicely. You can have a try by this means to adjust your image contrast.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You may also want to check &lt;a href=&quot;https://dsp.stackexchange.com/questions/2687/why-do-we-use-the-hsv-colour-space-so-often-in-vision-and-image-processing&quot;&gt;this post&lt;/a&gt; for more discussions.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-02-15T20:00:52.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14419" PostTypeId="2" ParentId="14411" CreationDate="2014-02-15T20:30:29.633" Score="3" Body="&lt;p&gt;You cannot use ordinary frequency values as the input. &lt;code&gt;fir1&lt;/code&gt; requires normalized frequency values that locate within $[0,1]$ where $1$ represents the normalized &lt;em&gt;NYQUIST&lt;/em&gt; frequency (half the sampling rate). Suppose your sampling rate is $500$ Hz, the code should be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;num = fir1(80, [0.02, 0.2]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;num&lt;/code&gt; is a 1*81 vector, and the corresponding filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F(z) = num(1) + num(2)z^{-1} + num(3)z^{-2} + ...num(81)z^{80}$&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2014-08-09T02:53:38.693" LastActivityDate="2014-08-09T02:53:38.693" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14420" PostTypeId="2" ParentId="14414" CreationDate="2014-02-15T22:09:52.977" Score="3" Body="&lt;p&gt;Note that once you obtain the skeleton, it is very hard to reverse back to separate the connected components that should not be connected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that your original image contrast is too low. I would operate an open morphological operation on your raw image to remove the background, hence increase the contrast of hair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your raw image (reverse each pixel by &lt;code&gt;255-I&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TmT2s.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background ( Open operation with the 20*20 all ones kernel, in order to remove the dark regions, along with the small, thin bright regions, only keep the large bright regions, which are viewed as the noisy background):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MILXs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtract the background from the raw image, and binarize the output, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DRbML.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I would do a dilation with the kernel: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0 0 1;...&#xA; 0 1 0;...&#xA; 1 0 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remove the small isolated object, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q6Wci.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally you extract the skeleton:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RiJ5i.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looks better than your result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most important step is the binarization part. The better you can obtain after thresholding, the easier you will implement the skeleton extraction. And the contrast enhancement is the key operation during binarization process.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-15T22:09:52.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14421" PostTypeId="1" CreationDate="2014-02-15T22:36:39.417" Score="1" ViewCount="249" Body="&lt;p&gt;I am new to Matlab. For me the task is to perform data classification on some data set. The given data set consists of numeric values. One thing that bothers me is I have to perform all KNN, ANN, and SVM. In performing KNN, I faced a problem of how to find the value of &lt;code&gt;K&lt;/code&gt;. If it is user defined? From which value we have to start and when to stop it?&lt;/p&gt;&#xA;" OwnerUserId="7912" LastEditorUserId="7092" LastEditDate="2014-02-16T01:00:21.083" LastActivityDate="2014-02-16T01:00:21.083" Title="Is there any method to find K value in KNN?" Tags="|matlab|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14422" PostTypeId="2" ParentId="14421" CreationDate="2014-02-16T00:57:15.450" Score="1" Body="&lt;p&gt;Basically too large &lt;code&gt;k&lt;/code&gt; may tend to underfit, while smaller &lt;code&gt;k&lt;/code&gt; may tend to overfit. You may try to run the classification with different &lt;code&gt;k&lt;/code&gt; within the preset range with &lt;a href=&quot;http://pic.dhe.ibm.com/infocenter/spssstat/v20r0m0/index.jsp?topic=/com.ibm.spss.statistics.help/alg_knn_training_crossvalidation.htm&quot; rel=&quot;nofollow&quot;&gt;cross-validation&lt;/a&gt;. Observe and find out the &lt;code&gt;k&lt;/code&gt; that gives you the least cross validation sum-of-square error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possible metric besides the sum-of-square error is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Silhouette_%28clustering%29&quot; rel=&quot;nofollow&quot;&gt;Silhouette&lt;/a&gt; applied to interpretation and validation of clusters of data. The technique provides a succinct graphical representation of how well each object lies within its cluster.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-16T00:57:15.450" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14423" PostTypeId="2" ParentId="14416" CreationDate="2014-02-16T01:20:08.323" Score="1" Body="&lt;p&gt;You can implement discrete wavelet transforms on &lt;code&gt;output1&lt;/code&gt; and &lt;code&gt;output2&lt;/code&gt;. Use &lt;code&gt;LL&lt;/code&gt; from &lt;code&gt;output1&lt;/code&gt; and &lt;code&gt;LH&lt;/code&gt;, &lt;code&gt;HL&lt;/code&gt;, and &lt;code&gt;HH&lt;/code&gt; to form a new block, then implement inverse wavelet transform.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-16T01:20:08.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14424" PostTypeId="1" CreationDate="2014-02-16T01:49:47.647" Score="2" ViewCount="182" Body="&lt;p&gt;&lt;strong&gt;Statement 1 :&lt;/strong&gt; When we take DFT of an image matrix, we get DFT co-efficient matrix. What does  the DFT Co-efficients tells about the image? (For example, take the 1st co-eff in the DFT matrix, what does it tells us ?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Statement 2:&lt;/strong&gt; In a DFT matrix, we have low frequency components on the top left corner of the matrix and the frequency will be getting increase as we move down and we have high frequency in the bottom right corner. Is this statement correct ? Correct me if I am wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't able to understand the following image (&lt;strong&gt;which contradicts my statement 2 (I think so )&lt;/strong&gt;) , can anyone explain this pls?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TLkHr.jpg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-02-16T03:30:42.770" Title="Standard representation of FFT of an Image?" Tags="|image-processing|frequency|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14425" PostTypeId="2" ParentId="14424" CreationDate="2014-02-16T03:30:42.770" Score="1" Body="&lt;p&gt;For real data, the result of an FFT is conjugate symmetric, so all but quadrant A is often ignored as redundant info.  Statement 2 seems to be about just quadrant A.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-16T03:30:42.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14426" PostTypeId="1" AcceptedAnswerId="14432" CreationDate="2014-02-16T07:06:47.993" Score="2" ViewCount="3506" Body="&lt;p&gt;I am working on a project regarding 3D reconstruction of 2D images. I have understanding of finding and Mathcing the keypoints and its algorithms; but i am not able to replicate the theory in MATLAB code. Is there any Book or paper which is basic for this problem?&lt;/p&gt;&#xA;" OwnerUserId="7914" LastEditorUserId="53" LastEditDate="2014-02-16T16:34:28.043" LastActivityDate="2014-10-13T15:14:08.863" Title="Is there any good book regarding 3D reconstruction from 2D images? I prefer to work in MATLAB" Tags="|computer-vision|matlab-cvst|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14427" PostTypeId="1" AcceptedAnswerId="14438" CreationDate="2014-02-16T08:13:47.890" Score="1" ViewCount="56" Body="&lt;p&gt;There is a transfer function &lt;span class=&quot;math-container&quot;&gt;$G(s)= \frac{-2(s+4)}{(s+3)(s+2)(s+1)} $&lt;/span&gt;. Find its gain &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. I'm not sure, what does this question mean. Is there any konstant gain for this system? I tried to find its frequency characteristic.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$G(s)= \frac{-2(s+4)}{(s+3)(s+2)(s+1)}  = \frac{-2(j\omega+4)}{(j\omega+3)(j\omega+2)(j\omega+1)} = \frac{-8(1+\frac{j\omega}{4})}{(1+\frac{j\omega}{3})(1+\frac{j\omega}{2})(1+j\omega)\cdot 6}=\frac{-\frac{4}{3}(1+\frac{j\omega}{4})}{(1+\frac{j\omega}{3})(1+\frac{j\omega}{2})(1+j\omega)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$20\cdot \log_{10}|-\frac{4}{3}| = 2.5\space dB$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I think the frequency characteristic of this system looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6j1PQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Am I right? If so, those are gains for every frequency.&lt;/p&gt;&#xA;&lt;p&gt;If there was written to find DC gain, I would use the formula:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$DCgain=\lim_{s\to 0} s\frac1s G(s) = \frac{-2(0+4)}{(0+3)(0+2)(0+1)} = -\frac86 = -\frac43$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is that the gain K I am looking for?&lt;/p&gt;&#xA;&lt;p&gt;As I said. I don't understand the question. Gain of the system like this... what does it use to be?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-02-16T14:37:28.267" Title="Gain of the system" Tags="|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14428" PostTypeId="1" CreationDate="2014-02-16T08:26:28.797" Score="0" ViewCount="226" Body="&lt;p&gt;Is there a better way to increase Recall Rate when using SIFT features?&lt;br&gt;&#xA;I am thinking a way to replace the NN1/NN2 ratio to account for slightly distorted objects.&lt;br&gt;&#xA;Moving towards clustering and using BOW(Bag Of Words) seems a way but I need to do one-on-one match of objects in images rather than training and learning. This refrains me from thinking towards BOW.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody got any idea?&lt;/p&gt;&#xA;" OwnerUserId="7904" LastActivityDate="2014-12-14T00:36:55.930" Title="Increasing Recall rate for SIFT" Tags="|object-recognition|sift|distance-metrics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14429" PostTypeId="1" CreationDate="2014-02-16T08:31:38.273" Score="0" ViewCount="658" Body="&lt;p&gt;Will using Cosine-Similarity or Histogram Intersection as distance-metric, for matching SIFT descriptors, help to get better results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody tried on that ever?&lt;/p&gt;&#xA;" OwnerUserId="7904" LastActivityDate="2014-02-16T08:31:38.273" Title="Distance-metric for SIFT descriptors matching" Tags="|object-recognition|sift|histogram|distance-metrics|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14430" PostTypeId="2" ParentId="7868" CreationDate="2014-02-16T08:37:59.410" Score="0" Body="&lt;p&gt;Lets say 1st image has 100 keypoints and the 2nd image has 500 keypoints.&lt;br&gt;&#xA;For NN search every point in the 1st image finds nearest one among the 500 points&#xA;But when we reverse image order, each keypoint of 2nd image searches for the nearest one among 100 keypoints. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically the search space changes and hence the results.&lt;/p&gt;&#xA;" OwnerUserId="7904" LastActivityDate="2014-02-16T08:37:59.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14431" PostTypeId="2" ParentId="14428" CreationDate="2014-02-16T10:05:13.913" Score="0" Body="&lt;p&gt;You can just increase the threshold for NN1/NN2 ratio. By the way, which detector do you use? In &quot;&lt;a href=&quot;ftp://cmp.felk.cvut.cz/pub/cmp/articles/mishkdmy/Mishkin-TR-2013-15.pdf&quot; rel=&quot;nofollow&quot;&gt;Two-view Matching with View&#xA;Synthesis Revisited&lt;/a&gt;&quot; paper have been shown that different detectors need slightly different ratio. Also they recommend to take into account geometrical position of the NN2 in order to increase ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it is always balance between recall and precision - you increase recall and loose precision. Could you explain what exactly do you want to do - which images and what the final result you want to archive? &lt;/p&gt;&#xA;" OwnerUserId="7030" LastActivityDate="2014-02-16T10:05:13.913" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="14432" PostTypeId="2" ParentId="14426" CreationDate="2014-02-16T10:30:08.213" Score="5" Body="&lt;p&gt;There are a lot of good books. &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot;&gt;Multiple View Geometry in Computer Vision&lt;/a&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;http://szeliski.org/Book/&quot;&gt;Computer Vision: Algorithms and Applications&lt;/a&gt;&quot;, but anyway, replication of the theory is the necessary stage to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can start from the finishing course &quot;&lt;a href=&quot;https://cw.felk.cvut.cz/wiki/courses/a4m33tdv/start&quot;&gt;3D Computer Vision&lt;/a&gt;&quot; from the CTU. They published lectures and labs - in MatLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Here is a ready implementation &lt;a href=&quot;http://www.fit3d.info/&quot;&gt;http://www.fit3d.info/&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="7030" LastActivityDate="2014-02-16T10:30:08.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14433" PostTypeId="1" AcceptedAnswerId="14442" CreationDate="2014-02-16T11:46:57.930" Score="1" ViewCount="1413" Body="&lt;p&gt;I am using a SIFT algorithm to extract features from an image.  I understand that the SIFT descriptor first finds the extrema and then finds the gradient and direction of each of these interest points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens after this part?&lt;/p&gt;&#xA;" OwnerUserId="6941" LastEditorUserId="53" LastEditDate="2014-02-16T16:15:49.373" LastActivityDate="2014-02-16T16:15:49.373" Title="What steps come after finding the gradients of the SIFT key points?" Tags="|image-processing|computer-vision|sift|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14434" PostTypeId="1" CreationDate="2014-02-16T14:14:23.703" Score="0" ViewCount="80" Body="&lt;p&gt;I have a function which looks like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wtEG5.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if there is a measure for a &quot;weak type run length&quot;. &#xA;How can I know that a function is approximately constant in some &lt;strong&gt;specific&lt;/strong&gt; neighborhood?&#xA;How can I differentiate this function from random noise?&lt;/p&gt;&#xA;" OwnerUserId="4994" LastActivityDate="2014-02-16T14:26:01.903" Title="Measuring local &quot;flatness&quot;" Tags="|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14435" PostTypeId="2" ParentId="14241" CreationDate="2014-02-16T14:17:57.887" Score="22" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CHg4w.png&quot; alt=&quot;linear vs non-linear&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand the linearity property more easily.Let us consider the above diagram,here we have 2 sequences namely &lt;code&gt;Xn&lt;/code&gt; and &lt;code&gt;Yn&lt;/code&gt;. when we add both the sequence we get &lt;code&gt;Xn+Yn&lt;/code&gt; whose amplitude value are represented with blue colour. when any system which satisfy this condition then it is called linear. &#xA;In case of mean filter, mean value for sequence &lt;code&gt;Xn&lt;/code&gt; is &lt;code&gt;1+1+3/3=5/3&lt;/code&gt;.mean value for sequence Yn is &lt;code&gt;1+2+0/3=1&lt;/code&gt;.mean value for &lt;code&gt;Xn+Yn&lt;/code&gt; is &lt;code&gt;2+3+3/3=8/3&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ mean(Xn)+mean(Yn)= mean(Xn+Yn), \\ \\&#xA; 5/3    +    1   = 8/3 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hence we called mean filter as linear filter.&#xA;In case of median filter, if we calculate median value for sequence &lt;code&gt;Xn&lt;/code&gt;, we get 1 (arrange the sequence in ascending order and then find the middle value). similarly median value of sequence &lt;code&gt;Yn&lt;/code&gt; is 1 .median value of sequence &lt;code&gt;Xn+Yn&lt;/code&gt; is 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$median(Xn)+median(Yn)  \neq  median(Xn+Yn).\\ \\&#xA;1 + 1  \neq    3 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hence we call median filter as non-linear filter&lt;/p&gt;&#xA;" OwnerUserId="7794" LastActivityDate="2014-02-16T14:17:57.887" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14436" PostTypeId="2" ParentId="14434" CreationDate="2014-02-16T14:26:01.903" Score="1" Body="&lt;p&gt;You can run the signal through a low pass filter to get rid of the high frequency content. After that, if you know the expected length of the flatness of the signal, you can perform matched filtering with a template of that length. If the cross-correlation result exceeds some threshold, consider the signal detected.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-02-16T14:26:01.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14437" PostTypeId="1" CreationDate="2014-02-16T14:30:22.843" Score="8" ViewCount="9558" Body="&lt;p&gt;In theory of FT(Fourier transform) and STFT(Short Time Fourier Transform) it is said that&#xA;&lt;strong&gt;&quot;A wide window gives better frequency resolution but poor time resolution. A narrower window gives good time resolution but poor frequency resolution&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody explain why a narrower window gives poor frequency resolution?&lt;/p&gt;&#xA;" OwnerUserId="7825" LastEditorUserId="76" LastEditDate="2014-02-16T14:53:26.113" LastActivityDate="2014-02-17T00:38:18.053" Title="Why does a narrower window in a Fourier transform or STFT give poor frequency resolution?" Tags="|fft|wavelet|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14438" PostTypeId="2" ParentId="14427" CreationDate="2014-02-16T14:37:28.267" Score="0" Body="&lt;p&gt;Yes, the gain of that system is frequency variant. One other way to calculate the &lt;a href=&quot;http://mathworld.wolfram.com/AbsoluteSquare.html&quot; rel=&quot;nofollow&quot;&gt;gain&lt;/a&gt; is multiplying the transfer function by the conjugate of itself. As for K, it's easy to find that value by inspection.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-02-16T14:37:28.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14439" PostTypeId="2" ParentId="14437" CreationDate="2014-02-16T14:55:07.090" Score="3" Body="&lt;p&gt;When calculating the frequency resolution, or bin width, of a DFT the formula is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;frequency_resolution = sample_rate/fft_size&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's say you have a 8000 Hz sample rate audio signal, but you want really high frequency resolution. You only have 8000 samples for one second, but you want to take a 32K FFT to get a really high frequency resolution. When you take a 32K FFT of a sequence of 8000 samples you need to pad the sequence with a ton of zeros in order to fill the FFT. There's no added value from doing this, so while you get a high resolution in the frequency domain, there's not enough sample support so it's just interpolated data. The frequency domain plot is smooth and interpolated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now say you have a lot of data, but a lot of data takes time to fill the FFT register. Say your sample rate is 8000, but you want really high resolution and your going to wait for it. You wait 4 seconds to fill that 32K FFT. Now when you take that FFT there's no extra padding of zeros to fill it. So when you look at the plot those bins are not interpolated, but supported by a lot of data because you waited for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the difference. When you have a long FFT with low sample support you get interpolated data. So that's the time-frequency trade-off you speak of. If you want high resolution, you need data to support it.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-02-16T14:55:07.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14441" PostTypeId="1" AcceptedAnswerId="14443" CreationDate="2014-02-16T16:11:09.027" Score="1" ViewCount="1669" Body="&lt;p&gt;Suppose that we have  some sample:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y =&#xA;&#xA;   31.2241&#xA;   -5.9830&#xA;   22.6058&#xA;   -2.2309&#xA;  -42.8272&#xA;   29.2850&#xA;   -6.2652&#xA;   20.8502&#xA;   -2.4639&#xA;  -44.7525&#xA;   30.1104&#xA;   -6.0180&#xA;   21.4476&#xA;   -1.5089&#xA;  -45.1826&#xA;   29.2744&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and somehow I know that it is obtained via a sinusoidal method which contains two sine functions at different frequencies and amplitudes, so I apply the music method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pmusic(y,4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and obtain the plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MYkd6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the location of peaks at the normalized peaks, but I don't know the actual frequency.  How can I find it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the formula is $\frac{\text{normalized frequency}*f_s}{2}$, but what about $f_s$?  Can I find it?&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="7092" LastEditDate="2020-03-28T13:32:31.717" LastActivityDate="2020-03-28T13:32:31.717" Title="How can I find the actual frequency given a normalized frequency?" Tags="|matlab|discrete-signals|signal-analysis|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14442" PostTypeId="2" ParentId="14433" CreationDate="2014-02-16T16:13:50.113" Score="1" Body="&lt;p&gt;First of all, there are two distinct parts to SIFT.  The first part is interest point detection algorithm (aka key-point detection), which finds local extrema of the multi-scale difference-of-gaussians function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second part is computing the feature descriptor, which is a vector describing the image patch around each key point. SIFT computes this descriptor by taking a 16x16 block of pixels centered at a key point, dividing it into 4x4 cells, and computing an 8-bin histogram of gradient orientations within each cell.  This results in a 4*4*8=128-element vector, which is the descriptor.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the SIFT algorithm normalizes the feature descriptor for rotation.  It finds the dominant gradient direction in the patch around the key point and shfits the gradient histograms such that the first orientation bin corresponds to that direction. This makes the descriptors invariant to in-plane rotation.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-02-16T16:13:50.113" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14443" PostTypeId="2" ParentId="14441" CreationDate="2014-02-16T16:41:15.183" Score="2" Body="&lt;p&gt;&lt;code&gt;[Y,FS,NBITS]=wavread(FILE)&lt;/code&gt; returns the sample rate (&lt;code&gt;FS&lt;/code&gt;) in Hz and the number of bits per sample (&lt;code&gt;NBITS&lt;/code&gt;) used to encode the data in the music file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, &lt;code&gt;[S,F] = pmusic(Y,4,F,FS)&lt;/code&gt; to compute the pseudospectrum at frequencies &lt;code&gt;F&lt;/code&gt; in Hz. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-16T16:41:15.183" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14444" PostTypeId="2" ParentId="14428" CreationDate="2014-02-16T17:55:54.100" Score="1" Body="&lt;p&gt;With slight modification you might want to use RootSift:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/publications/2012/Arandjelovic12/arandjelovic12.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.robots.ox.ac.uk/~vgg/publications/2012/Arandjelovic12/arandjelovic12.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the other steps in the paper will guide to improve the recall rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-02-16T17:55:54.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14446" PostTypeId="2" ParentId="14437" CreationDate="2014-02-16T18:31:08.167" Score="4" Body="&lt;p&gt;It's the uncertainty principle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Uncertainty_principle#Harmonic_analysis&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Uncertainty_principle#Harmonic_analysis&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-16T18:31:08.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14449" PostTypeId="2" ParentId="14437" CreationDate="2014-02-17T00:38:18.053" Score="6" Body="&lt;p&gt;The other answers are good, but I thought that I would try to give a more intuitive/visual answer since I am an intuitive/visual guy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture below is the plot of two tones that are almost the same frequency.  One tone is plotted in red, and the other in blue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eNvkX.png&quot; alt=&quot;Short window&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generated the picture in Matlab with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tone1 = sin(2*pi*.05 * (0:99));&#xA;tone2 = sin(2*pi*.0501 * (0:99));&#xA;plot(tone1)&#xA;hold on&#xA;plot(tone2, 'r')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see from both the picture and the code, the two tones are very close in frequency.  They are starting to separate a bit towards the end of this short window, but they are still very similar, to the point where a DFT could not tell them apart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I create the same tones with the same frequencies, only I make the window longer (5000 samples this time instead of 100) we get a much different picture.  Obviously there will be more cycles in each tone...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wn8fM.png&quot; alt=&quot;Long window&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... but that's not the interesting part.  We see the interesting part when we zoom in at the end of the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/31vYP.png&quot; alt=&quot;Long window zoom&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We see that the two tones are 180 degrees out of phase at the end of the window, which makes them very easy to distinguish.  So how did I know to pick 5000 samples?  The difference in the two tones is $.0002\pi \frac{radians}{sample}$, so $5000$ samples $* .0002\pi \frac{radians}{sample} = \pi$ radians.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As another answer mentioned, the resolution of the DFT is the sample frequency divided by the number of samples (i.e. the window length).  I implicitly made the sample frequency 1, so if we divide 1 by 5000 (the number of samples), we get that the resolution is .0002 Hz.  Our tones actually differ by .0001 Hz, meaning that tone2 will have energy in both tone1's bin and the bin next to it (and a little bit in all the others too, but that's a different story).&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-02-17T00:38:18.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14450" PostTypeId="2" ParentId="10526" CreationDate="2014-02-17T03:09:32.410" Score="-1" Body="&lt;p&gt;Let x[n] and y[n] be two orthogonal baseband signals, with bandwidth B. Check if the following signals are orthogonal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u[n]=x[n]∗cos(2∗π∗fc∗n)$&#xA;$v[n]=y[n]∗cos(2∗π∗fc∗n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer:&#xA;For $u[n]$ to be orthogonal to $v[n]$&#xA;Inner Product = $&amp;lt;u[n],v[m]&amp;gt;$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using Parsevals theorem&#xA;Compute &#xA;Integration (from -Inf to Inf) {U(f) * conj(V(f))} df&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $U(f)$ is frequency domain of $u[n]$ &#xA;= $(X[f-fc]+X[f+fc])/2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $V(f)$ is frequency domain of $v[n]$ &#xA;= $(Y[f-fc]+Y[f+fc])/2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inner Product will be&#xA;= Integration (X[f-fc].Y[f-fc] + X[f+fc].Y[f+fc])/4&#xA;= 0&lt;/p&gt;&#xA;" OwnerUserId="7885" LastEditorUserId="7092" LastEditDate="2014-02-17T03:51:00.270" LastActivityDate="2014-02-17T03:51:00.270" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14451" PostTypeId="1" AcceptedAnswerId="14462" CreationDate="2014-02-17T04:34:59.630" Score="8" ViewCount="21545" Body="&lt;p&gt;I have searched this question but couldn't find the answer in this network. I know this is very confusing question for DSP beginners. Both DFT and Z-transform work for Discrete signal. I have read that &quot;&lt;em&gt;Z-transform is the general case of DFT, when we consider unit circle then, Z-transform becomes Discrete Fourier Transform (DFT)&lt;/em&gt;&quot;. What does this mean? Ok, I can understand the mathematical verification but what is the physical meaning of this and how this affect the analysis in DSP?&lt;/p&gt;&#xA;" OwnerUserId="7922" LastActivityDate="2014-02-17T14:59:44.607" Title="Difference between DFT and Z-Transform" Tags="|fourier-transform|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14452" PostTypeId="2" ParentId="14451" CreationDate="2014-02-17T05:18:29.733" Score="3" Body="&lt;p&gt;Z transform is digital equivalent of laplace transform and it is used for steady state analysis of signals/systems,while DFT is  digital analog of fourier transform,now can you describe difference between laplace transform and fourier transform?you can check this link&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://answers.yahoo.com/question/index?qid=20090819040222AAxskS9&quot; rel=&quot;nofollow&quot;&gt;http://answers.yahoo.com/question/index?qid=20090819040222AAxskS9&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;illustration from DFT to z transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://fourier.eng.hmc.edu/e102/lectures/Z_Transform/node1.html&quot; rel=&quot;nofollow&quot;&gt;http://fourier.eng.hmc.edu/e102/lectures/Z_Transform/node1.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorDisplayName="user350" LastEditDate="2014-02-17T05:25:10.650" LastActivityDate="2014-02-17T05:25:10.650" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="14455" PostTypeId="1" CreationDate="2014-02-17T09:18:12.540" Score="0" ViewCount="424" Body="&lt;p&gt;I've found a material explaining the sample and hold operation pretty well, but there's one thing I can't understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.springer.com/cda/content/document/cda_downloaddocument/9781848001183-c1.pdf?SGWID=0-0-45-484012-p173780368&quot; rel=&quot;nofollow&quot;&gt;http://www.springer.com/cda/content/document/cda_downloaddocument/9781848001183-c1.pdf?SGWID=0-0-45-484012-p173780368&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Next, we would like to take this ideally sampled signal and hold the values&#xA;between samples. As we have a train of impulses with the correct areas, we&#xA;need a “block” that takes an impulse with area A, transforms it into a rectangular&#xA;pulse of height A that starts at the time at which the delta function is&#xA;input to the block, and persists for exactly Ts seconds. &lt;strong&gt;A little bit of thought&#xA;shows that what we need is a linear, time-invariant (LTI) filter whose impulse&#xA;response, h(t), is 1 between t = 0 and t = Ts and is zero elsewhere.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we know this is the impulse response that will give us a pulse of HEIGHT A, not area A? Could anyone explain this &quot;a little bit of thought&quot; part? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7471" LastActivityDate="2014-03-20T03:07:31.153" Title="Sample and hold - LTI filter" Tags="|sampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14459" PostTypeId="2" ParentId="14455" CreationDate="2014-02-17T13:55:41.423" Score="0" Body="&lt;p&gt;Some little bits of thought:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the system behaves constantly at any time, turning an impulse into a rectangle =&gt; it is time invariant. One can also say that the system needs to transform an impulse into a rectangle but does not now when it will arrive;&lt;/li&gt;&#xA;&lt;li&gt;linear, because if two impulses are superimposed then the heights will be added, not mixed or masked in any other way;&lt;/li&gt;&#xA;&lt;li&gt;the time range between t and Ts should be obvious;&lt;/li&gt;&#xA;&lt;li&gt;the desired output is the height of the impulse (which carries the information), but this value needs to be kept during a certain amount of time Ts to be able to be observed. Thus, what the sample-and-hold should output is a rectangle height A and width Ts. The sample part needs to detect the amplitude A of the signal, while the hold part need to maintain it during Ts seconds.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-02-17T13:55:41.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14460" PostTypeId="1" AcceptedAnswerId="14463" CreationDate="2014-02-17T14:01:00.553" Score="0" ViewCount="2599" Body="&lt;p&gt;I'm trying to create a chirp/swept signal that has it's frequency going down exponentially using matlab/octave.  I can't use the built in chirp function because I'm trying to create a chirp/swept signal based on an equation/formula.  I tried creating some code below but as you see from the spectrogram the frequency does not end at the correct frequency, and the frequency doesn't go down exponentially.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all,clc&#xA;freq1=20; %start freq&#xA;freq2=200; %end freq&#xA;fs=44100;&#xA;dur=1; %duration of signal in seconds&#xA;&#xA;t = linspace(0,2*pi,fs*dur);&#xA;&#xA;f=freq1:(freq2-freq1)/length(t):freq2-(freq2-freq1)/length(t); &#xA;%20:(200-20)/lenght(t) :200-(200-20)/length(t)&#xA;&#xA;data=sin(f.*t); %build signal&#xA;data=(data/max(abs(data))*.8); %normalize signal&#xA;wavwrite([data'] ,fs,32,strcat('/tmp/del.wav')); %export file&#xA;plot(t,data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's a spectrogram plot &#xA;&lt;img src=&quot;https://i.stack.imgur.com/GDvcm.png&quot; alt=&quot;spectrogram plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) create a signal based on a given equation/formula where the frequency is exponentially decaying (based on the formula 1/exp)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) be able to type in the starting and ending frequency along with it's duration in seconds example &#xA;startfreq=20; endfreq=200; durseconds=2;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectrogram plot should look something like this if the start frequency is 200hz ending at 20hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CZbC4.png&quot; alt=&quot;what the spectrogram should look like&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1894" LastActivityDate="2014-02-18T13:29:34.640" Title="Exponential decaying Swept / chirp signal" Tags="|matlab|discrete-signals|signal-analysis|continuous-signals|octave|" AnswerCount="1" CommentCount="1" ClosedDate="2014-03-19T00:03:11.467" ContentLicense="CC BY-SA 3.0" />
  <row Id="14461" PostTypeId="2" ParentId="14455" CreationDate="2014-02-17T14:18:37.557" Score="2" Body="&lt;p&gt;An impulse of &quot;area&quot; $A$ means $A\delta(t)$. The nomenclature arises because&#xA;$\displaystyle \int_{-\infty}^\infty A\delta(t) \,\mathrm dt = A,$&#xA;that is, the &quot;area under the curve&quot; is $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the system is linear and&#xA;time-invariant, and the response to input $\delta(t)$ is a pulse of height $1$&#xA;and duration from $0$ to $T_s$, the response to $A\delta(t)$ is a pulse of&#xA;height $A$ and duration from $0$ to $T_s$.  Its &quot;area&quot; is $AT_s$, that is, $A$&#xA;&lt;strong&gt;multiplied by&lt;/strong&gt; the area $T_s$ of the response to the unit impulse.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-02-17T14:18:37.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14462" PostTypeId="2" ParentId="14451" CreationDate="2014-02-17T14:59:44.607" Score="4" Body="&lt;p&gt;Actually, the Z transform is not really a proper transform, just a re-interpretation of the sequence of samples as coefficients of a formal Laurent series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases the formal Laurent series converges, if it does, it does so on an annular region in the complex plane. For useful signals (stable, summable, exponentially decaying) this annulus contains the unit circle, and the evaluation of the Laurent series on the unit circle corresponds to the Fourier series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interesting point of connecting a signal sequence to a periodic function on the unit circle is the inverse transformation, that many useful sequences are sequences of Fourier coefficients. And of course that convolution of signals corresponds to point-wise multiplication of the functions.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-02-17T14:59:44.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14463" PostTypeId="2" ParentId="14460" CreationDate="2014-02-17T15:12:48.190" Score="4" Body="&lt;p&gt;Frequency is the derivative of phase, so you need to start with the expression for frequency, which in your case is&lt;br&gt;&#xA;$f=200\exp(-\alpha*t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At time $t=0$ this will have the frequency of 200, but we need to solve for $\alpha$ so that the frequency at time $t=2$ is 20.  Solving for $\alpha$ gives $\alpha=1.1513$.&#xA;To get the correct expression for the phase you need to integrate the above expression for the phase i.e. solve&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f =\frac{1}{2\pi}\frac{d\phi}{dt}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following matlab code generates this signal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=500; %sampling frequency&#xA;t=(0:2*fs)/fs; %Time vector&#xA;alpha=1.1513;&#xA;sig = exp(-j*2*pi*200/alpha*exp(-alpha*t));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that just because the instantaneous frequency behaves this way doesn't mean the spectrogram will follow it exactly. It will get better if you have a higher time-bandwidth product.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2014-02-18T13:29:34.640" LastActivityDate="2014-02-18T13:29:34.640" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14465" PostTypeId="1" CreationDate="2014-02-17T16:50:06.500" Score="1" ViewCount="103" Body="&lt;p&gt;I am doing my first steps in embedded systems and there is a big deal of fixed point code and of course DSP optimized code.I would like please if possible to recommend any book/material related to that topics.&lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-02-17T16:50:06.500" Title="DSP implementation recommended bibliography (good books-material related to fixed/floating point-optimization)" Tags="|dsp-core|fixed-point|floating-point|" AnswerCount="0" CommentCount="1" ClosedDate="2014-03-14T13:57:36.617" ContentLicense="CC BY-SA 3.0" />
  <row Id="14466" PostTypeId="1" CreationDate="2014-02-17T16:58:52.963" Score="0" ViewCount="1244" Body="&lt;p&gt;I'm using portaudio for I/O audio streaming, and I wanted to apply some equalization on audio input from microphone. I found that most people refer to fft for task like that, so I use FFTW library in my project. My first idea was to select frequency bins in some range, from fft resulting complex array, and  increase their amplitudes by scaling them with some factors. But this resulting only in noise,  there is no sign of any equalization. So my question is, is it possible to increase volume at specified frequencies, through fft, and if so, how to do that. My experience so far makes me think that any change of those values in fft complex array just destroys the sound. Is there a proper way to manipulate with that complex data from fft resulting array?&lt;br&gt;&#xA;Any tips for equalization other than fft are also welcome.&lt;/p&gt;&#xA;" OwnerUserId="7929" LastEditorUserId="6" LastEditDate="2014-08-01T22:19:12.120" LastActivityDate="2014-08-01T22:19:12.120" Title="Manipulating with frequencies through fftw" Tags="|fft|c|equalization|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14467" PostTypeId="1" CreationDate="2014-02-17T17:06:50.830" Score="2" ViewCount="1078" Body="&lt;p&gt;I am not very good in statistic neither in probability theory, and I do not completely understand the mathematical background of Monte Carlo simulation or SIR sampling, but I'd like computer vision and I'm experimenting with it hoping to get some nice results with already known techniques (I don't want to reinvent the wheel neither to find some new method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done an approximate implementation of particle filter with Bhattacharyya distance as liklihood score function. What I mean with &lt;em&gt;approximate&lt;/em&gt; refers to the resampling part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my rough algorithm does something like that, in python pseudo-code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for each particles:&#xA;    p.position = move with a random walk motion model&#xA;&#xA;    p_histogram = calculate histogram that is under the particle&#xA;    p.weight = bhattacharyya_distance( p_histogram, model_histogram )&#xA;&#xA;sort(particles, less_weight_comparator)&#xA;# now particles[0] has less weight --&amp;gt; less distance&#xA;# and particles[nParticles-1] has more weight --&amp;gt; more distance&#xA;&#xA;# find best k particles&#xA;# i.e., the particles that has weight less then a threshold 0.25&#xA;k = -1&#xA;for each particles:&#xA;    if p.weight &amp;lt; 0.25: &#xA;         k++;&#xA;    else:&#xA;         break&#xA;&#xA;# resample all the other particles near those k best ones&#xA;if k!= -1:&#xA;    for i in range(k, nParticles):&#xA;        # choose a random number between 0 and k&#xA;        new_index = rand(0,k) &#xA;        # resample the particle near the k_th &#xA;        # with a gaussian random with 0 mean and 0.6 variance&#xA;        particles[i].position = particles[k].position * random_gauss(0, 0.6)&#xA;else:&#xA;    print &quot;target is lost&quot;&#xA;&#xA;predicted_position = particles[0].position&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this work quite well, but not every time, so I'm trying to improving it following some famous implementation, like the one in the &lt;a href=&quot;http://www.cs.berkeley.edu/~pabbeel/cs287-fa11/optreadings/Arulampalam_etal_2002.pdf&quot; rel=&quot;nofollow&quot;&gt;Arulampalam_etal_2002 paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But.. I'm confused and I don't understand what is happening in the resampling stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With my rough and superficial algorithm I'm always aware of what is happening: particle with the weight less then my threshold are too far from the histogram model, and if &lt;code&gt;k == -1&lt;/code&gt; the target is lost. It is clear, in my mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the paper mentioned (and in all the other particle filter papers) I'm reading about normalizing weight as all weights sums up to 1, and calculate a degeneracy value $N_eff$ (Equation 51) and.. I'm lost.  My &lt;code&gt;n_eff&lt;/code&gt; has values from 249.444 (at the first frame after the particle filter initialization so that some particles has to be near to the target) to 245.452 (more frame later, when the target is lost) and here, again I cannot find a threshold. If I normalize the weights, after the sorting, I have particles weight that goes from values like 0.00418279 to 0.00240669, and I cannot easily find a threashold value that can help me in understanding which are near the target or not, and it depends on how many particles I have so if I add more particles I'm more lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More over, in paper like &lt;a href=&quot;http://perso.telecom-paristech.fr/~bloch/P6Image/articles/adaptivepartfilter.pdf&quot; rel=&quot;nofollow&quot;&gt;Nummiaro_2002&lt;/a&gt; the Bhattacharyya is calculated inside a gaussian (Equation 10) and I'm not sure on what this means, and I lost an easy way to understand which particle has an histogram near to the model or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm totally lost in what including the Bhattacharyya into a gaussian means, and why normalizing and how to find the threshold for understand how many particles has to be resamples and which are out which are in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope someone can explain me a little bit, with simple and easy words.&lt;/p&gt;&#xA;" OwnerUserId="1063" LastActivityDate="2014-02-21T11:06:50.987" Title="Particle filter, resampling step implementation" Tags="|computer-vision|particle-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14468" PostTypeId="1" AcceptedAnswerId="14496" CreationDate="2014-02-17T17:22:34.267" Score="0" ViewCount="851" Body="&lt;p&gt;I am trying to introduce a fractional delay in my input vector x[n] so the output is something like y[n]=x[n-M/N]. I am not supposed to use the MATLAB fracdelay function.So, I used sampling and delay. The three steps I followed are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)Upsample the input by M.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)Delay the upsampled version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3)Downsample the output obtained in step 2 to get y[n].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I can't get the correct fractionally delayed output. Can someone please help? Here is my MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=[1 2 3 4 1 3 4 5 6 3];&#xA;up=upsample(x,2);&#xA;&#xA;z=zeros(1,10);&#xA;&#xA;for n=1:10; &#xA;   k=n+1;&#xA;   z(1,k)=up(1,n);&#xA;end&#xA;&#xA;y=downsample(z,2,1);&#xA;subplot(411);&#xA;stem(x)&#xA;subplot(412)&#xA;stem(up)&#xA;subplot(413);&#xA;stem(z)&#xA;subplot(414);&#xA;stem(y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is how my output looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X8JCq.jpg&quot; alt=&quot;output&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7842" LastActivityDate="2014-02-18T20:41:27.427" Title="How to display the output as the input with a fractional delay?" Tags="|matlab|digital-communications|downsampling|delay|" AnswerCount="3" CommentCount="0" ClosedDate="2014-03-06T02:23:47.193" ContentLicense="CC BY-SA 3.0" />
  <row Id="14469" PostTypeId="2" ParentId="14466" CreationDate="2014-02-17T18:04:40.960" Score="2" Body="&lt;p&gt;You applied the FFT to the full signal? Then modification of the amplitudes will likely destroy any time locality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the so-called STFT, short term Fourier transform, or overlap-add method to get a time-localized frequency analysis.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-02-17T18:04:40.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14470" PostTypeId="2" ParentId="14468" CreationDate="2014-02-17T18:40:17.403" Score="2" Body="&lt;p&gt;The problem is that you are using &quot;upsample&quot;, which merely inserts zeros in between the original samples, instead of &quot;interp&quot;, which upsamples and then low-pass filters.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-02-17T18:40:17.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14471" PostTypeId="1" AcceptedAnswerId="14477" CreationDate="2014-02-17T20:33:59.757" Score="3" ViewCount="539" Body="&lt;p&gt;As a follow-on to this &lt;a href=&quot;https://dsp.stackexchange.com/questions/10428/berchins-fdls-arbitrary-filter-design-algorithm&quot;&gt;post&lt;/a&gt;, how would you force linear phase for a FIR filter you synthesized using Berchin's FDLS?&lt;/p&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="128" LastEditDate="2019-06-26T08:51:34.793" LastActivityDate="2019-06-26T08:51:34.793" Title="Force Linear Phase for a FIR Filter Synthesized Using Berchin's FDLS?" Tags="|matlab|finite-impulse-response|least-squares|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14472" PostTypeId="2" ParentId="14468" CreationDate="2014-02-17T20:59:13.173" Score="1" Body="&lt;p&gt;It is probably easier to convolve with a (fractionally) shifted sinc, or to do the same in the fourier domain, that is, multiply with the frequency response of a linear phase filter, which is rather easy to construct. Then you'd wrap the ends, however. There is an IIR version of fractional delay, too.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-17T20:59:13.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14473" PostTypeId="2" ParentId="10526" CreationDate="2014-02-17T21:48:23.547" Score="1" Body="&lt;p&gt;Signals $x$ and $y$ are orthogonal which means that&#xA;$\displaystyle \sum_n x[n]y[n] = 0.$  Note that the range of summation&#xA;is whatever is needed for equality to hold.  Signals $u$ and $v$ given by&#xA;$$u[n] = x[n]\cos(2\pi f_c n), \quad v[n]= y[n]\cos(2\pi f_c n),\  \forall n$$&#xA;are orthogonal if &#xA;$\displaystyle \sum_n u[n]v[n] = \sum_n x[n]y[n] \cos^2(2\pi f_c n) = 0.$&#xA;Now, if $f_c$ is a &lt;em&gt;half-integer,&lt;/em&gt; that is, $f_c = \frac{m}{2}$ where $m$ is&#xA;some integer (even or odd), then $2\pi f_c n = \pi (mn)$ is an &lt;em&gt;integer&#xA;multiple&lt;/em&gt; of $\pi$, and so we see that $\cos^2(2\pi f_c n) = 1$ for all $n$.&#xA;It follows that &#xA;$\displaystyle \sum_n x[n]y[n] \cos^2(2\pi f_c n) = \sum_n x[n]y[n] = 0$&#xA;since $x$ and $y$ have been assumed to be orthogonal.  For other values&#xA;of $f_c$, it is not possible to guarantee that $u$ and $v$ are orthogonal&#xA;for &lt;em&gt;all&lt;/em&gt; choices of orthogonal signals $x$ and $y$.  However, for any given&#xA;specific value of $f_c$, it should be possible to find several pairs of&#xA;orthogonal $x$ and $y$ for which $u$ and $v$ are orthogonal&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-02-17T21:48:23.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14474" PostTypeId="1" CreationDate="2014-02-17T21:59:24.063" Score="2" ViewCount="6488" Body="&lt;p&gt;When energy is referred to as the square summable sequence, is that energy a representation of the power of the signal? How is the energy of frequency determined?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. what if an audio signal has high energy on the higher frequencies and another has high energy on the lower, bass, frequencies, how is this determined? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What exactly is the power from the square summable series representing then and is it useful for audio?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2014-02-18T20:17:32.603" Title="Energy of an audio signal" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14477" PostTypeId="2" ParentId="14471" CreationDate="2014-02-17T23:38:34.867" Score="2" Body="&lt;p&gt;Remember that, as its name suggests, Berchin's frequency-domain least squares method (FDLS) is really just a least-squares fit of a desired frequency-domain response. Recall that for an arbitrary transfer function of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = \frac{\sum_{k=0}^{M} b_k z^{-k}}{\sum_{k=1}^{N} a_k z^{-k}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can write the system's frequency response by simply letting $z=e^{j\omega}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(\omega) = \frac{\sum_{k=0}^{M} b_k e^{-j\omega k}}{\sum_{k=1}^{N} a_k e^{-j\omega k}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sort of system can be implemented as an IIR filter with $b_k$ as the feedforward (numerator) coefficients and $a_k$ as the feedback (denominator) coefficients. The FDLS method simply requires you to define the desired (complex-valued) frequency response at a collection of frequencies $\{\omega_k\}$. Evaluating the above expression for each frequency $\omega_k$ yields a system of linear equations in the $b_k$ and $a_k$ variables. You can then solve this using least-squares methods to yield the best coefficients for the desired frequency response and filter order (in the LS sense, of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the requirement for exact linear phase (i.e. better linear phase response than you might get by just applying the method itself and specifying a desired linear phase response), then you could reformulate the above a bit, if you're willing to accept an FIR-only filter structure.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Recall that linear phase in the frequency domain corresponds to symmetry in the filter's time-domain impulse response. For FIR filters, this impulse response is the same as the filter's coefficients $b_k$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let $a_k=0\ \forall\ k$ in the above expression, yielding:&#xA;$$&#xA;H(\omega) = \sum_{k=0}^{M} b_k e^{-j\omega k}&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;The symmetry constraint corresponds to a loss in the number of degrees of freedom in the linear system; instead of each of the coefficients being independent variables, the linear-phase constraint requires that coefficients that are symmetric about the impulse response's midpoint to be equal.&lt;/li&gt;&#xA;&lt;li&gt;Rewrite the above equation taking these constraints into account. For example, for a type I FIR filter (odd length, even symmetry), then you would have something like:&#xA;$$&#xA;H(\omega) = \sum_{k=0}^{\frac{M}{2}-1} b_k e^{-j\omega k} + \sum_{k=\frac{M}{2}+1}^{M} b_{M-k} e^{-j\omega k} + b_{\frac{M}{2}} e^{-j\omega \frac{M}{2}}&#xA;$$&#xA;where the filter has $M+1$ taps. You would then solve the system for the reduced set of coefficients, then reconstruct the overall filter impulse response using the symmetry constraint:&#xA;$$&#xA;h[k] = &#xA;\begin{cases}&#xA;b_k, &amp;amp;&amp;amp; 0 \le k \le \frac{M}{2} \\&#xA;b_{M-k}, &amp;amp;&amp;amp; \frac{M}{2}+1 \le k \le M&#xA;\end{cases}&#xA;$$&#xA;The result is an FIR filter that will have linear phase.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2014-02-18T16:30:01.590" LastActivityDate="2014-02-18T16:30:01.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14478" PostTypeId="2" ParentId="14466" CreationDate="2014-02-18T01:44:52.960" Score="1" Body="&lt;p&gt;If you want a real result, then the full array given the IFFT has to be complex conjugate symmetric.  But you are modifying only half of the array (below index 513) and not the other, rendering a symmetric array non-symmetric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, a brick wall transition may produce ringing artifacts.  In addition, if you are processing blocks of a longer signal, then overlap-add or overlap-save using longer FFTs is required to avoid circular convolution artifacts.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-18T01:44:52.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14479" PostTypeId="2" ParentId="14471" CreationDate="2014-02-18T01:58:37.787" Score="0" Body="&lt;p&gt;Given an FDLS solution as a transfer function with a closest fit to your desired magnitude response, all possible stable phase responses can be derived by trying all permutations of flipping the zeros of that transfer function inside and outside the unit circle.  This set can be evaluated for the closest fit to your desired phase response, linear or otherwise.  The closest fit in phase for that constellation of poles and zeros may not be an exact fit.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-18T01:58:37.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14480" PostTypeId="2" ParentId="14474" CreationDate="2014-02-18T02:38:28.000" Score="5" Body="&lt;p&gt;No, energy is not the same as power.  Power is energy per unit of time.  An analogy- energy is like distance, while power is like speed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to determine energy in the frequency domain is to take the signal and do an FFT.  The Fourier Transform preserves energy, i.e. the transform has the same exact energy as the signal does in the time domain.  You can then find the energy of each frequency bin by multiplying its value with its complex conjugate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal power represents how quickly it delivers energy.  In the context of audio it correlates with how loud the sound is, though there is not a 1-to-1 correspondence.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2014-02-18T20:17:32.603" LastActivityDate="2014-02-18T20:17:32.603" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14481" PostTypeId="2" ParentId="13851" CreationDate="2014-02-18T04:15:21.457" Score="3" Body="&lt;p&gt;While the general problem remains an open problem in theoretical computer science, there are (randomized) algorithms known as sparse fast fourier transforms which can approximate DFTs to a certain approximation factor when there are only a few DFT coefficients you are concerned with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find some details in these papers and related papers (downloadable &lt;a href=&quot;http://groups.csail.mit.edu/netmit/sFFT/paper.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Hassanieh, Haitham, et al. &quot;Nearly optimal sparse Fourier transform.&quot; Proceedings of the 44th symposium on Theory of Computing. ACM, 2012.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hassanieh, Haitham, et al. &quot;Simple and practical algorithm for sparse Fourier transform.&quot; Proceedings of the Twenty-Third Annual ACM-SIAM Symposium on Discrete Algorithms. SIAM, 2012.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2014-02-18T13:12:11.423" LastActivityDate="2014-02-18T13:12:11.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14483" PostTypeId="1" AcceptedAnswerId="14512" CreationDate="2014-02-18T07:33:09.607" Score="0" ViewCount="27665" Body="&lt;p&gt;I would like to know if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  \text {Z-Transform ( }  G(s)H(s) \text{ )} = \text {Z-Transform (}G(s) \text{)} \text { Z-Transform (} H(s) \text{) } = G(z)H(z)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where G(s), H(s) are the Laplace transform representations of g and h, and G(z) and H(z) are the Z-transform representation of g and h.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this relation true?&lt;/p&gt;&#xA;" OwnerUserId="4376" LastActivityDate="2014-02-19T16:00:44.313" Title="Conversion from laplace transform to z-transform" Tags="|transfer-function|transform|z-transform|" AnswerCount="1" CommentCount="3" ClosedDate="2014-03-14T13:51:33.487" ContentLicense="CC BY-SA 3.0" />
  <row Id="14487" PostTypeId="1" CreationDate="2014-02-18T10:38:21.423" Score="0" ViewCount="1832" Body="&lt;p&gt;Why do we need an oversampling in OFDM signal? and how to do it? &#xA;If around half of the Sub-carriers are only used to send data, then do we need to perform oversampling to the signal? Is it necessary to have LPF in OFDM transceiver? &lt;/p&gt;&#xA;" OwnerUserId="7703" LastActivityDate="2014-02-19T08:42:46.280" Title="Oversampling in OFDM" Tags="|lowpass-filter|ofdm|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14488" PostTypeId="1" CreationDate="2014-02-18T13:14:39.730" Score="2" ViewCount="457" Body="&lt;p&gt;I have been looking to implement feature extraction and matching in MATLAB. For this, I've read many algorithms, but i'm not able to understand how to implement these in MATLAB. Is there any Book related to this topic which is based on MATLAB? i.e. gives exapmles and sample codes in MATLAB?&#xA;I have read Gonzolez and there is no other book that deals with Image Processing Algorithms with help of MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="7914" LastEditorUserId="53" LastEditDate="2015-01-14T15:00:43.457" LastActivityDate="2015-01-14T15:18:22.250" Title="Is there any good book regarding Image Processing Algorithms for Feature Extraction and Matching which gives examples in MATLAB?" Tags="|image-processing|matlab|computer-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14490" PostTypeId="2" ParentId="14474" CreationDate="2014-02-18T15:30:44.230" Score="5" Body="&lt;p&gt;Any useful definition for power or energy in audio signals depends highly on context and application. While you can formally sum the squares of the samples and call it energy, the result isn't really useful for anything. It is &lt;strong&gt;NOT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The energy delivered to the speakers&lt;/li&gt;&#xA;&lt;li&gt;The energy consumed by the amplifier &lt;/li&gt;&#xA;&lt;li&gt;Energy that the power supply needs to provide or that is drawn of the the wall outlet&lt;/li&gt;&#xA;&lt;li&gt;Acoustic energy radiated from the speaker&lt;/li&gt;&#xA;&lt;li&gt;Any measure on how loud it it. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All these are very different things and only loosely correlated. Without a specific goal of what you need &quot;power&quot; or &quot;energy&quot; for, it's difficult to properly define the term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example it's very easy to construct two signals, A and B, where A has twice the &quot;energy&quot; of B but is only half as loud as B. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-02-18T15:30:44.230" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14491" PostTypeId="1" CreationDate="2014-02-18T15:37:19.663" Score="6" ViewCount="4448" Body="&lt;p&gt;I have to detect speech intervals in large pre-recorded files in my project. I think, there won't be so much noise in the background (audio will be recordered in the room or even in the studio), but it still can be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what are good VAD algorithms that I can use (algorithms, not libraries)?&lt;/p&gt;&#xA;" OwnerUserId="7523" LastActivityDate="2014-05-23T02:53:29.493" Title="Voice Audio Detection algorithm" Tags="|audio|algorithms|speech|speech-processing|voice|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14494" PostTypeId="1" AcceptedAnswerId="14511" CreationDate="2014-02-18T17:00:49.787" Score="0" ViewCount="6107" Body="&lt;p&gt;In below image, we have scaling property of DFT, how the final equation is obtained from the above equation. That is how we are getting the scaling factor , $ \frac{1}{|ab|} $ in the final equation ? Please explain how we are getting $ \frac{1}{|ab|} $. Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/keSqj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation 4.12 is given as&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sZPVI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7834" LastEditorUserId="7834" LastEditDate="2014-02-19T00:50:43.150" LastActivityDate="2023-11-20T18:35:21.953" Title="Scaling Property in DFT" Tags="|image-processing|discrete-signals|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14495" PostTypeId="1" CreationDate="2014-02-18T18:46:13.770" Score="6" ViewCount="396" Body="&lt;p&gt;Does anyone know how to find information on the derivation (rather than the definition and application) of Teager's Energy Operator, both for the continuous and sampled case.&#xA;I have Kaiser's early papers &quot;On a simple Algorithm to calculate the 'Energy' of a signal&quot; and &quot;Some useful properties of Teager's Energy operator&quot; but these seem to stop short of giving the derivation.&lt;/p&gt;&#xA;" OwnerDisplayName="user7944" LastEditorUserId="90" LastEditDate="2014-02-18T21:26:12.090" LastActivityDate="2021-10-30T10:05:10.450" Title="Teager's Energy Operator" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14496" PostTypeId="2" ParentId="14468" CreationDate="2014-02-18T19:07:24.383" Score="0" Body="&lt;p&gt;You should use the built-in &lt;code&gt;upsample()&lt;/code&gt; and &lt;code&gt;downsample()&lt;/code&gt; functions for the obvious purposes. While for delaying the signal you'll have to create a separate index vector because in MATLAB you can't keep track of index without this step. Then simply introduce the fractional delay in the index vector and plot your original signal against this delayed version of the index vector.&lt;/p&gt;&#xA;" OwnerUserId="7946" LastEditorUserId="7092" LastEditDate="2014-02-18T20:41:27.427" LastActivityDate="2014-02-18T20:41:27.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14497" PostTypeId="1" AcceptedAnswerId="14509" CreationDate="2014-02-18T19:09:18.897" Score="1" ViewCount="6379" Body="&lt;p&gt;I'm designing a bandpass filter in scipy following the &lt;a href=&quot;http://wiki.scipy.org/Cookbook/ButterworthBandpass&quot; rel=&quot;nofollow noreferrer&quot;&gt;cookbook&lt;/a&gt;. However, if I decrecrease the filtering frequencies too much I end up with garbage at high order filters. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy.signal import butter, lfilter&#xA;&#xA;def butter_bandpass(lowcut, highcut, fs, order=5):&#xA;    nyq = 0.5 * fs&#xA;    low = lowcut / nyq&#xA;    high = highcut / nyq&#xA;    b, a = butter(order, [low, high], btype='band')&#xA;    return b, a&#xA;&#xA;if __name__ == &quot;__main__&quot;:&#xA;    import numpy as np&#xA;    import matplotlib.pyplot as plt&#xA;    from scipy.signal import freqz  &#xA;    # Sample rate and desired cutoff frequencies (in Hz).&#xA;    fs = 25&#xA;    # Plot the frequency response for a few different orders.&#xA;    plt.figure(1)&#xA;    plt.clf()&#xA;    for order in [1, 3, 5, 6, 9]:&#xA;        b, a = butter_bandpass(0.5, 4, fs, order=order)&#xA;        w, h = freqz(b, a, worN=2000)#np.logspace(-4, 3, 2000))&#xA;        plt.semilogx((fs * 0.5 / np.pi) * w, abs(h), label=&quot;order = %d&quot; % order)  &#xA;    plt.xlabel('Frequency (Hz)')&#xA;    plt.ylabel('Gain')&#xA;    plt.grid(True)&#xA;    plt.legend(loc='best')&#xA;&#xA;    plt.figure(2)&#xA;    plt.clf()&#xA;    for order in [1, 3, 5, 6, 9]:&#xA;        b, a = butter_bandpass(0.05, 0.4, fs, order=order)&#xA;        w, h = freqz(b, a, worN=2000)#np.logspace(-4, 3, 2000))&#xA;        plt.semilogx((fs * 0.5 / np.pi) * w, abs(h), label=&quot;order = %d&quot; % order)  &#xA;    plt.xlabel('Frequency (Hz)')&#xA;    plt.ylabel('Gain')&#xA;    plt.grid(True)&#xA;    plt.legend(loc='best')&#xA;&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mdYun.png&quot; alt=&quot;fs = 25, low = 0.5, high = 4&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/oU6tv.png&quot; alt=&quot;fs = 25, low = 0.05, high = 0.4&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5428" LastActivityDate="2014-03-21T12:43:23.427" Title="Bandpass butterworth filter frequencies in scipy" Tags="|filter-design|python|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14499" PostTypeId="1" AcceptedAnswerId="14522" CreationDate="2014-02-19T04:53:53.237" Score="0" ViewCount="80" Body="&lt;p&gt;i've written a source code in visual dp ++ in c language. the platform is sharc processor adsp 21062.after the build is complete. while running the program it is displaying a message &#xA; &lt;code&gt;Instruction timed out with PC at: 0x20a5a&lt;/code&gt; . what may be the error in my c code. can you please resolve?&lt;/p&gt;&#xA;" OwnerUserId="7926" LastEditorUserId="7092" LastEditDate="2014-02-19T18:08:19.527" LastActivityDate="2014-02-20T00:32:42.993" Title="regarding visual dsp ++" Tags="|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14500" PostTypeId="1" AcceptedAnswerId="14542" CreationDate="2014-02-19T06:36:59.660" Score="0" ViewCount="827" Body="&lt;p&gt;I know that many books and papers talk about the DC offset/DC component of a filter. How do we define the DC offset mathematically, for the case of discrete filters?&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="5014" LastEditDate="2014-02-20T00:02:31.220" LastActivityDate="2014-02-21T01:32:31.997" Title="DC component of a discrete filter" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="14502" PostTypeId="2" ParentId="14487" CreationDate="2014-02-19T08:42:46.280" Score="1" Body="&lt;p&gt;Oversampling in OFDM is usually implemented by modulating some subcarriers at the spectrum margins with zero. This zero-padding in frequency domain corresponds to oversampling in time domain. If only 50% percent of the subcarriers are used, then this corresponds to an oversampling factor of 2. Specifically, if the total number of subcarriers is $N$ and if $M$ of these subcarriers are set to zero, then the oversampling factor is $N/(N-M)$. Note, that the $M$ zero subcarriers have to be arranged in a row, cyclic shifting allowed. Normally, they're arranged symmetrically at the lowest and highest frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An OFDM transmitter might require a low pass filter in order to keep out-of-band radiation low. The cut-off frequency is usually half of the sampling frequency ($f_\mathrm{s}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An OFDM receiver requires a low pass filter before A/D conversion (sampling) with cut-off frequency $f_\mathrm{s}/2$. Otherwise aliasing can occur.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-02-19T08:42:46.280" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14503" PostTypeId="1" CreationDate="2014-02-19T08:43:01.577" Score="0" ViewCount="57" Body="&lt;p&gt;I have a speech file that was recorded with a sampling frequency of 8kHz. I read the file in Matlab as &lt;code&gt;[x,fs,nbits]=wavread('speech.wav)&lt;/code&gt;. Now I play the file in Matlab using &lt;code&gt;soundsc(x,fs)&lt;/code&gt;. But if I use the command &lt;code&gt;soundsc(x,fs/2)&lt;/code&gt; and &lt;code&gt;soundsc(x,2*fs)&lt;/code&gt; the speech changes. What is the reason?&lt;/p&gt;&#xA;" OwnerUserId="7952" LastEditorUserId="1606" LastEditDate="2014-02-19T09:02:39.363" LastActivityDate="2014-04-01T14:32:15.603" Title="doubt regarding sampling frequencies" Tags="|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14504" PostTypeId="1" AcceptedAnswerId="14505" CreationDate="2014-02-19T08:56:03.843" Score="0" ViewCount="206" Body="&lt;p&gt;I am interested in analyzing full length songs for general features of the track which are not otherwise apparent. For e.g., I want to look at various parts of the song with time-frequency plots/wavelets/other signal processing tools for, lets say -  How does the frequency content of the song during the guitar solo compare to the part when only vocals are on? What is the frequency with which the guitar solo starts? What is its peak? ..and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although I use FFT often for research, this is something I am fascinated by.... Any suggestions where to start?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point I have got WAV files for MATLAB analysis, since they have almost no loss. Where do I go from here? Any references to concepts/open source codes/literature etc. would be greatly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I am not into audio engineering or anything similar. Its just for my own interest.&lt;/p&gt;&#xA;" OwnerUserId="5190" LastActivityDate="2014-02-19T11:10:19.403" Title="Suggestions for FFT based tools to analyze music - Preferably MATLAB/free software packages" Tags="|fourier-transform|wavelet|signal-detection|music|cepstral-analysis|" AnswerCount="1" CommentCount="0" ClosedDate="2014-03-06T02:23:15.630" ContentLicense="CC BY-SA 3.0" />
  <row Id="14505" PostTypeId="2" ParentId="14504" CreationDate="2014-02-19T11:10:19.403" Score="0" Body="&lt;p&gt;My favorite is &lt;a href=&quot;http://www.sonicvisualiser.org/&quot; rel=&quot;nofollow&quot;&gt;Sonic Visualiser&lt;/a&gt;. It is free and fast. In combination with the &lt;a href=&quot;http://www.vamp-plugins.org/&quot; rel=&quot;nofollow&quot;&gt;Vamp Plugins&lt;/a&gt; you can analyze low level features up to high level features like onsets, pitches, chords and so on. It has also an nice spectrum and spectrogram fea&lt;/p&gt;&#xA;" OwnerUserId="7953" LastActivityDate="2014-02-19T11:10:19.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14506" PostTypeId="2" ParentId="14503" CreationDate="2014-02-19T11:17:17.593" Score="3" Body="&lt;p&gt;The soundsc command will playback $f_s$ samples per second. Playing back at a faster rate than you recorded will increase the pitch of the speech. Playing back at a lower sample rate will reduce the pitch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you prefer to think in the frequency domain; all the information is scaled on the frequency axis with relation to the change in $f_s$. Reducing fs squashes the information on the frequency axis and increasing $f_s$ will stretch the information on the frequency axis. &lt;/p&gt;&#xA;" OwnerUserId="5105" LastEditorUserId="5105" LastEditDate="2014-04-01T14:32:15.603" LastActivityDate="2014-04-01T14:32:15.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14507" PostTypeId="2" ParentId="2687" CreationDate="2014-02-19T11:44:18.120" Score="2" Body="&lt;p&gt;HSV stands for Hue-Saturation-Value. It is actually a type of color plane representation (like RGB, YCbCr etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a device independent color representation format: The HSV color representation is useful to detect specific color types, e.g.: skin color, fire color etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Matlab&lt;/code&gt; function to convert an RGB image to HSV plane is &lt;code&gt;rgb2hsv('/inputimage_name')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7955" LastEditorUserId="1273" LastEditDate="2014-02-19T12:49:06.910" LastActivityDate="2014-02-19T12:49:06.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14509" PostTypeId="2" ParentId="14497" CreationDate="2014-02-19T12:25:42.273" Score="2" Body="&lt;p&gt;You're probably running into numerical precision issues on the higher-order filters with sharp cutoffs. It could be a limitation of the &lt;code&gt;butter&lt;/code&gt; function in SciPy, or it could be due to the filter structure that it's using when evaluating the frequency response. A better way of implementing high-order IIR filters is using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_filter#Cascaded_second-order_sections&quot; rel=&quot;nofollow&quot;&gt;second-order sections (SOS)&lt;/a&gt; structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little Googling suggests that SciPy &lt;a href=&quot;https://github.com/scipy/scipy/issues/2444&quot; rel=&quot;nofollow&quot;&gt;doesn't yet support converting a filter to its SOS representation&lt;/a&gt;. Furthermore, there are apparently some issues with how filter parameters are handled internally that cause &lt;a href=&quot;https://github.com/scipy/scipy/issues/2443&quot; rel=&quot;nofollow&quot;&gt;bad results with high-order filters&lt;/a&gt;. That sounds like what you're describing. These are apparently in the process of being addressed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, I came across &lt;a href=&quot;https://gist.github.com/endolith/4525003&quot; rel=&quot;nofollow&quot;&gt;this example&lt;/a&gt; that shows how you might implement an SOS structure using SciPy. I haven't tested the code at all, so there's no warranty, but it may be worth a look.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-02-19T12:25:42.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14511" PostTypeId="2" ParentId="14494" CreationDate="2014-02-19T14:36:43.960" Score="0" Body="&lt;p&gt;$\sum\limits_{m=0}^{M-1} \sum\limits_{n=0}^{N-1} f(am,bn)e^{-j \cdot 2\pi(\frac {k}{M} \cdot m + \frac {l}{N} \cdot n)} $  (let $m'=am, n'=bn$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$=\sum\limits_{m'=0}^{(M-1)a} \sum\limits_{n'=0}^{(N-1)b} f(m',n')e^{-j \cdot 2\pi(\frac {k/a}{M} \cdot m' + \frac {l/b}{N} \cdot n')}$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;($m'$, $n'$ with the incremental interval of $a$ and $b$ respectively)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &#xA;$\sum\limits_{m'=0}^{M-1} \sum\limits_{n'=0}^{N-1} f(m',n')e^{-j \cdot 2\pi(\frac {k/a}{M} \cdot m' + \frac {l/b}{N} \cdot n')}$&#xA;$=F(k/a,l/b)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $m'$, $n'$ with the incremental interval of $1$, and the points $m$ and $n$ are evenly distributed on the circle, according to the symmetry, you have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum\limits_{m'=0}^{(M-1)a} \sum\limits_{n'=0}^{(N-1)b} f(m',n')e^{-j \cdot 2\pi(\frac {k/a}{M} \cdot m' + \frac {l/b}{N} \cdot n')} = \frac {1}{|ab|}F(k/a,l/b)$&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-19T16:30:28.137" LastActivityDate="2014-02-19T16:30:28.137" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14512" PostTypeId="2" ParentId="14483" CreationDate="2014-02-19T15:47:41.733" Score="2" Body="&lt;p&gt;Your question makes no sense. Z transform is performed on a discrete signal/series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $H(s)$ is a continuous function, you can't just calculate a Z-transform of $H(s)$ without first sampling it, to make it discrete. Also, it doesn't make much sense to do a time-&gt;spectrum transform (such as a Z-transform) on a spectral representation ($H(s)$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming that when you write &quot;$Z-Transform(H(s))$&quot;, what you really want to do is to convert $H(s)\to H(z)$, meaning to calculate the Z-transform of $h[nT]$, where $h[nT]$ is $h(t)$, sampled at intervals of $T$, and $h(t)$ is the inverse Laplace transform of $H(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm correct in my assumption, the transformation you are seeking is known as &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Star_transform&quot; rel=&quot;nofollow&quot;&gt;star transform&lt;/a&gt;&quot;, which would provide a transform function $H^{*}(s)$, in terms of $e^{sT}$, which may be easily converted to $H(z)$ by way of the substitution $z=e^{sT}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; - some elaboration on the conversion process: what you need to do is calculate $H^{*}(s)$ from $H(s)$ using one of the two relations described in &quot;Relation to Laplace transform&quot; in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Star_transform&quot; rel=&quot;nofollow&quot;&gt;Wikipedia article&lt;/a&gt;, then do the substitution $z=e^{sT}$, to get $H(z)$.&lt;/p&gt;&#xA;" OwnerUserId="7827" LastEditorUserId="7827" LastEditDate="2014-02-19T16:00:44.313" LastActivityDate="2014-02-19T16:00:44.313" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14514" PostTypeId="1" CreationDate="2014-02-19T17:59:34.740" Score="1" ViewCount="194" Body="&lt;p&gt;Can you please explain or point the right way to think about how to implement two sound effects in a .wav file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I read a .wav file and converted it to int values (in &lt;code&gt;numpy&lt;/code&gt; array) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;array([59383, 58290, 60629, ..., 52606, 51982, 56274], dtype=uint16)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First, I am not sure I am clear about what these values in array really represent. &#xA;Is it correct that every value is one out of 65535  ( &lt;code&gt;unsigned int16&lt;/code&gt; ) magnitude levels that analog output device will produce in some moment in time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory chorus effect could be achieved by following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Make copy of original array &lt;/li&gt;&#xA;&lt;li&gt;Weaken this copied array ( multiplying by some &lt;code&gt;value &amp;lt; 1&lt;/code&gt; )&lt;/li&gt;&#xA;&lt;li&gt;Add this copied array to original one&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In practice I don't know how to add them correctly. Should I simply add values one by one, make a convolution of the two arrays or interleave original array and its modified copy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also a chorus effect should have an &lt;strong&gt;arbitrary&lt;/strong&gt;  time &lt;strong&gt;delay&lt;/strong&gt;  and I don't know how to accomplish this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I implement that randomization of the time delay for the data I am about to add? &lt;/p&gt;&#xA;" OwnerUserId="7960" LastEditorUserId="76" LastEditDate="2014-02-19T19:43:24.537" LastActivityDate="2014-02-19T19:43:24.537" Title="How do I combine a copy of a signal with the original to achieve a chorus effect in a .wav file using Python?" Tags="|convolution|python|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14516" PostTypeId="2" ParentId="13230" CreationDate="2014-02-19T20:04:23.987" Score="1" Body="&lt;p&gt;at its core, the DFT operates on a discrete and periodic function (of period $N$) of some dimension (most often time) using the data of one period of that function and transforms it to a discrete and periodic function (with the same period $N$) of the reciprocal dimension (most often frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] \ \triangleq \  \sum_{k=0}^{N-1} \ X[k] \ e^{j 2 \pi nk/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X[k] \ = \ \frac{1}{N} \sum_{n=0}^{N-1} \ x[n] \ e^{-j 2 \pi nk/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i switched, for the sake of cleaner discussion, where the scaling factor $\frac{1}{N}$ goes.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;both functions are fully defined by a finite set of coefficients. $X[k]$ are the Fourier coefficients of the $x[n]$ discrete periodic function.  $x[n]$ are the Fourier coefficients of the $X[k]$ discrete periodic function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;they tell you about the magnitude and phase of each sinusoidal component ($e^{j \theta}$ is a sinusoidal function for real $\theta$) of the Fourier series.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-02-20T01:10:56.747" LastActivityDate="2014-02-20T01:10:56.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14519" PostTypeId="1" AcceptedAnswerId="14614" CreationDate="2014-02-19T22:25:55.743" Score="0" ViewCount="470" Body="&lt;p&gt;A state space representation is given by:&#xA;$$\dot{x}= \begin{bmatrix}0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0&amp;amp;0&amp;amp;-2&amp;amp;-4\\0&amp;amp;0&amp;amp;1&amp;amp;0\end{bmatrix}x+\begin{bmatrix} 1\\0\\1\\0\end{bmatrix} u$$&#xA;$$y=\begin{bmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{bmatrix}x$$&#xA;I need to find a transfer function of this system. I don't know how, but I've tried it this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote all equations:&#xA;$$\dot x_1 = u$$&#xA;$$\dot x_2 = x_1$$&#xA;$$\dot x_3 = -x_3-4x_4+u$$&#xA;$$\dot x_4=x_3$$&#xA;$$y=x_2-x_4$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I've draw a scheme of such system:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GfRWa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then tried to find its transfer function.&#xA;$$-4X_4-2sX_4+U = X_4s^2$$&#xA;$$U = X_4(s^2+4+2s)$$&#xA;$$X_4= \frac{U}{s^2+2s+4} $$&#xA;$$X_2 = \frac{U}{s^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y = X_2 - X_4 = \frac{U}{s^2} -\frac{U}{s^2+2s+4}$$&#xA;$$G(s) = \frac{Y(s)}{U(s)} = \frac{1}{s^2} -\frac{1}{s^2+2s+4}=\frac{2(s+2)}{s^2(s^2+2s+4)}$$&#xA;I don't know, whether this is right answer nor solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What solution would you recomend for this task? Is the solution above correct?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="4158" LastEditDate="2014-02-23T22:28:51.677" LastActivityDate="2014-02-23T22:28:51.677" Title="How to find transfer function by state space representation matrices" Tags="|transfer-function|state-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14521" PostTypeId="2" ParentId="13914" CreationDate="2014-02-19T22:58:43.750" Score="1" Body="&lt;p&gt;Try total variation denoising. Here I found a piecewise constant toolbox: &lt;a href=&quot;http://www.maxlittle.net/software/pwctools.zip&quot; rel=&quot;nofollow&quot;&gt;http://www.maxlittle.net/software/pwctools.zip&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1825" LastActivityDate="2014-02-19T22:58:43.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14522" PostTypeId="2" ParentId="14499" CreationDate="2014-02-20T00:32:42.993" Score="0" Body="&lt;p&gt;The processor is stalled. For example you are trying to read a peripheral register and there is no data available. This can have many different reasons so without further detail that's impossible to assess. First step would be to look at program memory at address 0x20a5a and see  what the processor was trying to do. Take a look at the disassembly window.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-02-20T00:32:42.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14523" PostTypeId="1" AcceptedAnswerId="14675" CreationDate="2014-02-20T00:52:58.587" Score="15" ViewCount="5224" Body="&lt;p&gt;In general any form of enropy is defined as uncertainty or randomness. In a noisy environment, with increase in noise, I believe that entropy increases since we are more uncertain about the information content of the desired signal. What is the relationship between entropy and SNR? With increase in signal to noise ration, the noise power decreases but this does not imply that the information content of the signal increases!! &#xA;The information content may remain same, so does that mean entropy is unaffected?&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="780" LastEditDate="2014-08-08T05:11:53.880" LastActivityDate="2019-12-13T13:47:21.647" Title="Relationship between entropy and SNR" Tags="|noise|signal-detection|snr|information-theory|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14525" PostTypeId="1" CreationDate="2014-02-20T05:20:21.557" Score="0" ViewCount="178" Body="&lt;p&gt;For my source code witten in c ,in visual dsp++ 5.0 for a forward error correcting code on adsp 21062 sharc family platform. i want to plot a graph between different data sets. when i tried to use the plot window, it is showing the data sets which are in assembly.so how to plot a graph between the input and output in the tool?please help me out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-05-21T17:46:11.883" Title="regarding plots in visual dsp ++ 5.0" Tags="|dsp-core|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14526" PostTypeId="1" CreationDate="2014-02-20T05:32:39.897" Score="2" ViewCount="587" Body="&lt;p&gt;I'm working on a Ultrasonic Transducers resonance tracking system. Where phase shift between Voltage and Current is the feedback signal for my system when phase difference is Zero that means system is resonant other wise depending on the phase difference frequency will be changed proportionally. I went through lots of different techniques of phase detection which includes Several&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Analog(Comparatively Simple) techniques such as:- &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Phase Locked Loop &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Zero Crossing Based Phase Measurement &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Simple Phase Detector ICs&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Digital(Complex DSP Based) Techniques Using Mathematical Algorithms such as:-&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Cross Correlation &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;FFT &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Goertzels Algorithm &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sine Wave fit Methods &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;VVV&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So, My question is:- Which system will be best to use for a phase difference calculation analog or digital?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considerations &amp;amp; Preferences:- Transducer is noisy (Gaussian white noise + harmonics of fundamental). Accurate phase difference calculation is crucial.&lt;/p&gt;&#xA;" OwnerUserId="7967" LastEditorUserId="7967" LastEditDate="2014-03-06T09:02:29.760" LastActivityDate="2014-03-06T16:37:45.460" Title="Digital Vs. Analog Phase measurement" Tags="|phase|digital|analog|measurement|" AnswerCount="1" CommentCount="4" ClosedDate="2014-03-20T23:57:20.470" ContentLicense="CC BY-SA 3.0" />
  <row Id="14527" PostTypeId="1" CreationDate="2014-02-20T09:27:10.470" Score="1" ViewCount="189" Body="&lt;p&gt;Is it possible to model the acoustic transfer function in MATLAB for a common set of headphones? i.e. I want to model the summation of a noise sample and the audio from the output of the headphone e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;signal = exteriorNoise + Music&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where signal would be the information the user would hear? I would imagine headphones would implement some attenuation and low pass filtering, but I cannot find any documentation. I am aware every headphone / in-ear would be different, but I merely wish to make a more realistic model that basic signal addition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7968" LastActivityDate="2014-02-20T16:13:22.053" Title="Head Phone Transfer Function MATLAB" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14529" PostTypeId="1" AcceptedAnswerId="14544" CreationDate="2014-02-20T11:57:40.933" Score="0" ViewCount="93" Body="&lt;p&gt;When I do a spectrogram in matlab / octave I can create a swept signal that looks like the RED plot line below.  But how can I create a swept signal like the BLUE line in the 1st plot using the equation below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks to Daniel and David for getting me this far with the code is below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;startfreq=200;&#xA;fs=44100;&#xA;endfreq=20;&#xA;dursec= 10;%duration of signal in seconds&#xA;t=(0:dursec*fs)/fs; %Time vector&#xA;alpha=log(startfreq/endfreq)/dursec;&#xA;sig = exp(-j*2*pi*startfreq/alpha*exp(-alpha*t));&#xA;sig=(sig/max(abs(sig))*.8); %normalize signal&#xA;wavwrite([sig'] ,fs,32,strcat('/tmp/del.wav')); %export file&#xA;specgram(sig,150,400);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1st plot&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UO2am.png&quot; alt=&quot;Plot that I&amp;#39;m trying to reproduce&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2nd plot&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sYPWh.png&quot; alt=&quot;Plot with 200hz-20hz works&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;How can I fix the the equation in the variable &lt;strong&gt;sig&lt;/strong&gt; to get it to look like the BLUE line in the &lt;strong&gt;1st plot&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3rd plot&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/aitil.png&quot; alt=&quot;Plot with 20hz-200hz which doesn&amp;#39;t do what I want&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="1894" LastEditorUserId="1894" LastEditDate="2014-02-20T15:23:53.797" LastActivityDate="2015-03-12T21:39:06.723" Title="adjusting swept signal equation" Tags="|matlab|frequency-spectrum|signal-analysis|continuous-signals|octave|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14530" PostTypeId="1" AcceptedAnswerId="14540" CreationDate="2014-02-20T13:27:23.953" Score="4" ViewCount="5719" Body="&lt;p&gt;I have a signal consisting of two sine waves of same frequency but have different phase (and also a lot of HF noise). Their amplitudes differ by about $120\textrm{ dB}$. How to I go about separating them? SNR is about $130\textrm{ db}$ but its frequency is far higher than my signal, i.e. $f(\textrm{noise}) \gg  f(\textrm{signal})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any special technique? Also I am really just a beginner, so extra points for those who give a detailed explanation.&lt;/p&gt;&#xA;" OwnerUserId="7973" LastEditorUserId="7092" LastEditDate="2020-03-28T13:23:35.167" LastActivityDate="2020-03-28T13:23:35.167" Title="How to separate a low amplitude signal of same frequency but different phase" Tags="|image-processing|fft|discrete-signals|signal-analysis|lowpass-filter|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14531" PostTypeId="2" ParentId="14530" CreationDate="2014-02-20T14:24:09.393" Score="3" Body="&lt;p&gt;There are many ways to add two sine waves of the same frequency and different phase and get back a sine wave. These cant be separated without more information. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastEditorUserId="5662" LastEditDate="2014-02-20T17:16:58.627" LastActivityDate="2014-02-20T17:16:58.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14532" PostTypeId="2" ParentId="14525" CreationDate="2014-02-20T16:05:44.860" Score="1" Body="&lt;p&gt;export the data from memory and process it in MATLAB, Octace of whatever your favorite analysis tool is. VDSP has only very limited data analysis capabilities&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-02-20T16:05:44.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14533" PostTypeId="2" ParentId="14527" CreationDate="2014-02-20T16:13:22.053" Score="1" Body="&lt;p&gt;It's actually a band-pass characteristic, since very low frequencies will be inaudible on headphones. Firstly, searching for &quot;headphone frequency response&quot; brings up a lot of results, especially on an image search. Then, the site &lt;a href=&quot;http://www.headphone.com&quot; rel=&quot;nofollow&quot;&gt;headphone.com&lt;/a&gt; seems to offer frequency characteristic plots for many of the headphones they sell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, you often only get graphs. However, you can use tools like &lt;a href=&quot;http://www.frantz.fi/software/g3data.php&quot; rel=&quot;nofollow&quot;&gt;g3data&lt;/a&gt; (plot digitizing tools) to assist you in recovering data from pictures or even scans of plots. I used such tools a lot to trace plots from scientific papers for which data is usually not available.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-02-20T16:13:22.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14535" PostTypeId="1" CreationDate="2014-02-20T16:45:47.367" Score="3" ViewCount="141" Body="&lt;p&gt;I am inquiring as to a &lt;em&gt;practical&lt;/em&gt; way to solve a problem I have. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I need to transmit a signal, $x[n]$, through a seismic transmitter. (It will go through a D/A, etc). The transmitter that we have has a certain frequency characteristic, in that, it passes certain frequencies out better than others. (Nothing shocking, but for the sake of simplicity we can assume it is linear across frequency). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My signal $x[n]$ is somewhat wide-band. Hence, at the output of the transmitter, it might become distorted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering, knowing my ideal signal $x[n]$ and knowing my transmitter frequency characteristics, is there a way I can 'massage' $x[n]$ before putting it through my transmitter, such that at the output I get the original $x[n]$ that I wanted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like I mentioned I am seeking guidance on practical and actionable techniques for something like this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the context helps this is for a seismic transponder app. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2014-05-24T01:49:45.387" Title="Correction of a signal through a transmitter" Tags="|filters|fourier-transform|filter-design|adaptive-filters|" AnswerCount="1" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="14536" PostTypeId="1" AcceptedAnswerId="14555" CreationDate="2014-02-20T16:56:46.890" Score="1" ViewCount="696" Body="&lt;h2&gt;Problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I wish to filter a discrete-time input signal, $x[n]$, so as the output signal's, $y[n]$, exponential moving average, $a[n+1] = a[n] + \alpha(y[n] - a[n])$, tracks around a constant reference $\mu_x$ such that $\mathbb{E}\{y[n]\} \approx \mu_x$, and also an approximately constant variance, $\text{var}\{y[n]\} \approx \sigma_x^2$, while maintaining as much information about the incoming signal as possible.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Naive Motivating Solution&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;1) Maintain an average of the input, $b[n+1] = b[n] + \alpha(x[n] - b[n])$ and an approximation of the signal variance, $c[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Define the output to be $y[n] = \frac{x[n] - b[n]}{\sqrt{c[n]}}$ which tracks a reference of 0 with unity variance.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There are a number of problems with this approach which make it not very numerically robust, such as when low values of variance occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more intelligent way of doing this? Perhaps using a dynamic linear filter? Or high pass filter?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Other Points&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The inputs can be considered independent, and are drawn from one of several dynamic distributions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The application, if you are interested, is comparing the amplitudes of recent inputs with each other by assigning them a &quot;reward&quot; output. This is high reward for relatively higher input values and a low for lower lower values. However, I desire the mean reward to be an approximately constant output mean. Furthermore, there may be some medium-time dynamics in the inputs, such as decaying toward zero over time.&lt;/p&gt;&#xA;" OwnerUserId="7962" LastEditorUserId="4346" LastEditDate="2014-02-21T07:05:28.110" LastActivityDate="2014-02-21T07:05:28.110" Title="Filtering a signal to have a constant exponential moving average" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14537" PostTypeId="2" ParentId="14530" CreationDate="2014-02-20T17:50:57.297" Score="8" Body="&lt;p&gt;Two exact sine waves of the same frequency but different phases sum to another exact sine wave.  That resultant sine wave can be decomposed into an infinite numbers of pairs (or any other greater number) of sine waves of the same frequency, not just the two original ones.  Thus more information is required to reduce the possible solution space below infinite.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-02-20T20:54:18.880" LastActivityDate="2014-02-20T20:54:18.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14538" PostTypeId="1" CreationDate="2014-02-20T19:21:35.993" Score="7" ViewCount="5348" Body="&lt;p&gt;What does the Eigen values and Eigen vector of a signal or function represent? What is its physical significance? I know about basis vectors of a signal which constitute the orthogonal planes where signal projections are represented. Are basis vectors and Eigen vectors same thing? Can we reconstruct signal using these Eigen vectors?&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="7092" LastEditDate="2020-01-27T17:10:55.420" LastActivityDate="2020-01-27T17:10:55.420" Title="eigen values and eigen vectors of signal" Tags="|image-processing|discrete-signals|signal-analysis|continuous-signals|signal-synthesis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14540" PostTypeId="2" ParentId="14530" CreationDate="2014-02-20T19:34:39.460" Score="8" Body="&lt;p&gt;$E_1=E_{10}sin (\omega t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E_2=E_{20}sin (\omega t + \delta)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E_{\theta} = E_1 + E_2 = E_{\theta0}sin (\omega t + \phi )$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be described as the figure below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ltjSq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now given the $E_{\theta 0}$, you can rotate $E_1$ and $E_2$ arbitrarily as long as $E_1$ , $E_2$, and $E_{\theta 0}$ form the triangular. As a result, your given sine wave can be decomposed into an infinite numbers of pairs of sine waves of the same frequency, which is not necessarily the two original ones.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2017-05-06T15:03:12.297" LastActivityDate="2017-05-06T15:03:12.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14541" PostTypeId="2" ParentId="14530" CreationDate="2014-02-20T20:07:37.583" Score="4" Body="&lt;p&gt;The noise seems to be irrelevant to this problem since you say that it is a&#xA;frequency band far removed from the sinusoids of interest.  Thus, with a relatively&#xA;simple bandpass filter, you should be able to recover a signal&#xA;$$s(t) = C\cos(2\pi f_c t + \theta) = A\cos(2\pi f_ct + \theta_1)&#xA;+ B\cos(2\pi f_ct + \theta_2), \tag{1}$$ where $C$ and $\theta$ are presumably easily&#xA;measured. Assume that all the amplitude&#xA;parameters in $(1)$ have positive&#xA;value (negative values having been absorbed into the phase terms).&#xA;Now, all we know about $A$ and $B$ is that $A \gg B$, in fact,&#xA;$A \approx 10^6B$ or $A \approx 10^{12}B$ depending on whether that&#xA;$120$ dB that you specify is a voltage ratio or a power ratio. Let's just say&#xA;that $A \approx 10^nB$ for some largish $n$. Now, apply&#xA;@lennon310's phasor diagram with the additional knowledge that $A \approx C$&#xA;and $\theta_1 \approx \theta$.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The maximum value of $A$ is $C(1+10^{-n})$ and this occurs when $\theta_1=\theta$, $\theta_2 = \theta+\pi$, that is, $(1)$ reduces to&#xA;$$s(t) = C\cos(2\pi f_c t + \theta) = C(1+10^{-n})\cos(2\pi f_ct + \theta)&#xA;- C\cdot10^{-n}\cos(2\pi f_c t+\theta).$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The minimum value of $A$ is $C(1-10^{-n})$ and this occurs when &#xA;$\theta_1= \theta_2 = \theta$, that is, $(1)$ reduces to&#xA;$$s(t) = C\cos(2\pi f_c t + \theta) = C(1-10^{-n})\cos(2\pi f_ct + \theta)&#xA;+ C\cdot10^{-n}\cos(2\pi f_c t+\theta).$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;More pictorially, lennon310's $E_{\theta 0}$ and $E_1$ are &lt;strong&gt;very nearly the&#xA;same phasor&lt;/strong&gt;, with the tip of the arrowhead of $E_1$ lying inside a &#xA;&lt;em&gt;small&lt;/em&gt; circle centered at the tip of the arrowhead of $E_{\theta 0}$.&#xA;The special cases above occur when all three phasors are collinear&#xA;with $E_2$ reducing (or increasing) the amplitude of $E_1$ by a very&#xA;small amount. But, as hotpaw2 and Aaron have already pointed out to&#xA;you, we cannot say much more that this about the relative amplitudes&#xA;and phases of the two sinusoids that sum to $C\cos(2\pi f_ct+\theta)$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-02-20T20:07:37.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14542" PostTypeId="2" ParentId="14500" CreationDate="2014-02-20T20:16:48.530" Score="3" Body="&lt;p&gt;Here is a (working) link to a paper relevant to the OP: &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.80.2334&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.80.2334&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like when they say zero DC, they mean &quot;band pass filter&quot; (see page 4). And when they say DC component they just mean frequency response at zero frequency. For instance, see Eq. (20) where they evaluate $G_b(0)$. That's the answer to your question: you can define the DC offset of the filter response as its gain at zero frequency.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="1825" LastEditDate="2014-02-21T01:32:31.997" LastActivityDate="2014-02-21T01:32:31.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14543" PostTypeId="2" ParentId="14538" CreationDate="2014-02-20T20:28:33.960" Score="5" Body="&lt;p&gt;Consider a linear time-invariant system that maps a given signal to another signal space.  If the system produces a scaled version of the input signal $\phi$, say $\lambda \phi$, then we can view $\lambda$ and $\phi$ as eigenvalue and eigenvector respectively ($λ$ gives us the gain or attenuation of the eigen-signal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose the impulse response of system is $h[n]$, when you input $x[n]$ is an eigen-signal, you have the output&#xA;$$y[n] = x[n]\sum\limits_{k=- \infty}^{\infty}  h[k]e^{-j \cdot \omega \cdot k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so $$\lambda = \sum\limits_{k=- \infty}^{\infty}  h[k]e^{-j \cdot \omega \cdot k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note this is just the Discrete Time Fourier Transform of $h[n]$ since $H(e^{j \omega}) = \sum\limits_{k=- \infty}^{\infty}  h[k]e^{-j \cdot \omega \cdot k}$. Further, the Fourier Transform of $x[n]$ becomes meaningful as well.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note that eigenvectors do not always form a basis. For example, $\begin{pmatrix} 0 &amp;amp;1 \\ 0 &amp;amp;0\end{pmatrix}$ has $0$ as its only eigenvalue, with eigenspace $\begin{pmatrix} x \\ 0 \end{pmatrix}$. There are not enough independent eigenvectors to form a basis.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For other discussions on the physical significance of eigenvalues or eigenvectors for a signal, please refer to this post from &lt;a href=&quot;http://www.researchgate.net/post/What_is_the_physical_significance_of_eigenvalues_or_eigenvectors_Please_try_to_explain_in_very_simple_language&quot; rel=&quot;nofollow noreferrer&quot;&gt;researchgate&lt;/a&gt;. And yes you can reconstruct the original signal using all the eigenvectors, or approximate the signal using some of them&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="25664" LastEditDate="2017-05-03T14:06:56.790" LastActivityDate="2017-05-03T14:06:56.790" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14544" PostTypeId="2" ParentId="14529" CreationDate="2014-02-20T20:42:52.413" Score="1" Body="&lt;p&gt;The general formula for the exponential rise in frequency is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f=A+B(1-\exp(-\alpha t))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to solve for the values of $A$, $B$ and $\alpha$. Let's assume you want an initial frequency of $20$ at time $t=0$, and an asymptotic frequency of $200$ Hz at time $t=\infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting $t=0$ and $f=20$ into the above equation we find $A=20$. If we substitute $t=\infty$ and $f=200$ we find that $B=180$. For $\alpha$ you really have a free choice - it controls how fast the frequency rises. If you have another control point say at time $t=2$ we want the frequency to be at $95%$ of the final frequency i.e. $f=.95 \times 200=190$ then we can substitute these into the above equation (Since we know what $A$, and $B$ are).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$190=20+180(1-\exp(-2\alpha))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solving gives $\alpha= -0.5\ln(10/180)=-1.445$. If you want a faster rise then you'll need to choose a larger value of $\alpha$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the expression for phase we simply integrate with respect to time to give&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\phi =2\pi(At+Bt+\frac{B}{\alpha}\exp(-\alpha t))$&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7092" LastEditDate="2015-03-12T21:39:06.723" LastActivityDate="2015-03-12T21:39:06.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14546" PostTypeId="1" CreationDate="2014-02-21T00:57:19.533" Score="1" ViewCount="664" Body="&lt;p&gt;I would like to experiment with some input from a microphone and am receiving a 2 channel, 512 samples buffer in real time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the signal could be passed through a low pass filter, and then windowed before the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sample rate is 44100.00, what low pass filter is needed for this, does the analog to digital conversion not run it through a low pass filter before converting it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly does a window apply to real time sample input of 512 samples? Is a window not the same as a filter? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also read that the signal can be run through the FFT twice, why exactly is this done and is it necessary for this data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to slowly build this up to do spectral analysis etc. Is this done directly on the FFT bin data? &lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2014-02-21T15:13:04.170" Title="Preparing audio data for FFT" Tags="|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14547" PostTypeId="1" CreationDate="2014-02-21T01:02:12.780" Score="4" ViewCount="357" Body="&lt;p&gt;I would like to write a BPM detector. Does either of the domains provide more information for this type of analysis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What exactly is being looked for in the data to detect onset for BPM detection in either domain? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does tracking energy values in the time domain lead into rhythm detection?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously pattern recognition can be used but how can it be done fast enough in real time using c?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2014-02-21T21:28:54.960" LastActivityDate="2014-02-22T12:57:47.777" Title="Combining time domain and frequency domain data for BPM detection in real time" Tags="|audio|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14548" PostTypeId="2" ParentId="14546" CreationDate="2014-02-21T01:09:26.617" Score="2" Body="&lt;p&gt;If there is not already a 22 kHz (or lower) low-pass filter (or a mic or sound source that does not respond at or above half your sample rate) before the ADC you are using, then your data may already contain aliasing noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The window does not apply to your real-time sample input buffer, but to the input to your FFT, which can be of a different length (using data from multiple input buffers, for instance).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the FFT windows are overlapped by 50%, then this could be one reason why what you read said that the data is processed twice.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-02-21T01:14:36.667" LastActivityDate="2014-02-21T01:14:36.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14549" PostTypeId="1" AcceptedAnswerId="14550" CreationDate="2014-02-21T01:28:40.913" Score="0" ViewCount="778" Body="&lt;p&gt;I have been trying to understand a publication &lt;a href=&quot;http://www.sigmobile.org/awards/mobicom2011-2.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; where Short time fourier transform is applied over n samples in steps of m samples each (m is the size of the moving window). I understand that the computational complexity of the Short time fourier transform for m samples is &lt;code&gt;mlogm&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operation also consists of extracting energy from the samples. Since there are m samples in the window, I believe it should be O(m) in the worst case.&#xA;So , as per my understanding, the complexity of the whole operation should be &#xA;&lt;code&gt;O(n/m * (mlogm + m)) = O(nm)&lt;/code&gt;. Since there n/m windows and each window has mlogm for fourier transform and m for signal strength extraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the publication shows the complexity as &lt;code&gt;O(nmlogm)&lt;/code&gt;. Please help me understanding this.&lt;/p&gt;&#xA;" OwnerUserId="7985" LastActivityDate="2014-02-21T02:43:58.100" Title="How is the complexity of applying Short term fourier transform over n samples with a moving window of size m amount to O(nmlogm)" Tags="|fft|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14550" PostTypeId="2" ParentId="14549" CreationDate="2014-02-21T02:43:58.100" Score="1" Body="&lt;p&gt;evidently the author is performing an FFT $n$ times (or, if the window hop is not 1 sample, it would be proportional to $n$) and each FFT costs something proportional to $m \log(m)$).  all this is quite normal.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-02-21T02:43:58.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14551" PostTypeId="1" AcceptedAnswerId="14672" CreationDate="2014-02-21T03:45:25.423" Score="0" ViewCount="28515" Body="&lt;p&gt;It might be a very silly question, however I'm facing problem with it. Now, the Gaussian noise is a signal with zero mean and variance. I understand what the mean and the variance mean however, I'm facing problem with zero mean. What does that mean? Does it mean that it is only a signal with variance which represents the magnitude of the signal? And if this is the case, why we bother ourself with variance since the magnitude of this signal is random?  I want to understand that because I want build a sensor (a function in C/C++) and add some noise to the data. In MatLab, there is &lt;code&gt;randn&lt;/code&gt; to generate Gaussian noise, but I have no idea how to do same concept in C++.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit: Let's say I have a sensor with $\pm$ 0.2 as an error. What I understand that the noise should be a Gaussian noise with zero mean and variance. Now, I have a real data which represents the position in 1D. My sensor now should give the position with some uncertainty. This is my code in C++11&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;&#xA;#include &amp;lt;chrono&amp;gt;&#xA;#include &amp;lt;random&amp;gt;&#xA;&#xA;int main(int argc, const char * argv[])&#xA;{&#xA;&#xA;    double noise; // Gaussian noise with zero mean and variance 1&#xA;    double data_sensor; &#xA;    double position(2.0);&#xA;&#xA;    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();&#xA;    std::default_random_engine engine(seed);&#xA;    std::normal_distribution&amp;lt;double&amp;gt; dist(0, 1);&#xA;&#xA;    for (int i(0); i &amp;lt; 10; ++i)&#xA;    {   &#xA;        noise = dist(engine);&#xA;        data_sensor = position + 0.2*noise;&#xA;        std::cout &amp;lt;&amp;lt; &quot;Real Data: &quot; &amp;lt;&amp;lt; position &amp;lt;&amp;lt; &quot;  Sensor Data: &quot; &amp;lt;&amp;lt; data_sensor &amp;lt;&amp;lt; std::endl;&#xA;&#xA;    }&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Real Data: 2  Sensor Data: 2.19025&#xA;Real Data: 2  Sensor Data: 1.96754&#xA;Real Data: 2  Sensor Data: 2.03551&#xA;Real Data: 2  Sensor Data: 1.58706   &amp;lt;&amp;lt; Why this out of the range&#xA;Real Data: 2  Sensor Data: 2.11237&#xA;Real Data: 2  Sensor Data: 1.98482&#xA;Real Data: 2  Sensor Data: 1.94809&#xA;Real Data: 2  Sensor Data: 1.8264&#xA;Real Data: 2  Sensor Data: 1.9776&#xA;Real Data: 2  Sensor Data: 1.70071   &amp;lt;&amp;lt; Why this out of the range&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5788" LastEditorUserId="7092" LastEditDate="2020-03-29T14:15:11.803" LastActivityDate="2020-03-29T14:15:11.803" Title="noise of zero mean and variance?" Tags="|discrete-signals|signal-analysis|noise|gaussian|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14552" PostTypeId="2" ParentId="14530" CreationDate="2014-02-21T03:57:27.390" Score="2" Body="&lt;p&gt;It is impossible separate two sinusoidal, as all previous answer pointed out. But if you know precise parameters of first signal you can estimate parameters of second signal. If it is possible you can try.&#xA;Your signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t)=A\exp(i(\omega t+\phi_0))+ b\exp(i(\omega t + \phi_1)) + n(t)$, and you know A, $\omega$ and $\phi_0$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;C(t) &amp;amp;= y(t)\exp(-i(\omega t+\phi_0)) \\&#xA;&amp;amp;= A\exp[i(\omega t+\phi_0)-i(\omega t+\phi_0)] +b\exp[i(\omega t +\phi_1)-i(\omega t+\phi_0)] + n(t)\exp(-i(\omega t+\phi_0)) \\&#xA;&amp;amp;= A + b\exp(i(\phi_1- \phi_0)) + n(t)\exp(-i(\omega t+\phi_0))&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For eliminating noise try to average over $k*2 \pi/\omega$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&amp;lt;C(t)&amp;gt; = A+b\exp(i(\phi_1-\phi_0))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you know A and $\phi_0$ you can calculate $b$ and $\phi_1$. But you must know A and $\phi_0$ with very high precision.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="90" LastEditDate="2014-02-21T14:40:08.997" LastActivityDate="2014-02-21T14:40:08.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14553" PostTypeId="2" ParentId="14551" CreationDate="2014-02-21T04:29:12.857" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Normal_distribution#Generating_values_from_normal_distribution&quot; rel=&quot;nofollow&quot;&gt;Box–Muller method&lt;/a&gt; uses two independent random numbers distributed uniformly on $(0,1)$, then uses such two uniformly distributed numbers to produce values with normal distribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero-mean indicates the average value of the detected signal at each time point is zero. In digital signal processing, zero often refers to $2^{n-1}$ where $n$ is the bit number of digitizer. For example, if you have a 16-bit signal ($65536$), then $32768$ represent the zero in double, and those numbers that less than $32768$ are negative.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-21T05:00:06.043" LastActivityDate="2014-02-21T05:00:06.043" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14554" PostTypeId="2" ParentId="14551" CreationDate="2014-02-21T04:30:27.737" Score="2" Body="&lt;p&gt;You need to know what a probability distribution is, along with the definitions of mean and variance. The mean is average value of observations from that distribution (as the number of observations is large). The variance measures the average squared deviations from the mean. So, you can think of it as the average(amplitude^2)(which is not the same as (average(amplitude))^2). This measures the spread of values of the distribution. We worry about it precisely since the signal is random - if it were constant, this would not matter, but knowing the variance tells us something about where the distribution takes its values (in the case of the Gaussian, for example, you have the 68-95-99.7 rule, for example). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before adding noise, you should know a bit about probability (and even if Gaussian noise is the right noise to add). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for C++ implementation, Boost has a normal distribution as one of its rng options as does c++11 compilers (see this &lt;a href=&quot;https://stackoverflow.com/questions/1118482/c-tr1-how-to-use-the-normal-distribution&quot;&gt;thread&lt;/a&gt;). &lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2014-02-21T04:30:27.737" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14555" PostTypeId="2" ParentId="14536" CreationDate="2014-02-21T04:38:57.497" Score="1" Body="&lt;p&gt;I'll draw on my (limited) experience in audio mixing and mastering. Speech recorded through a microphone requires the same statistical properties (constant moving average and constant variance), and two straightforward processing stages ensure this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An &quot;exponential moving average&quot; is another word for a 1-pole low-pass filter. This moving average can be brought close to zero by passing the signal through any high-pass filter, such as a &quot;DC killer&quot; or &quot;remove subsonic rumble&quot; filter that an audio processing package such as Audacity or Audition may provide. The stronger the high-pass characteristic, the closer the moving average will stick to the center line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you want to make the variance constant. That's a job for a level compressor. Find the RMS (square root of variance) of the signal over the next few milliseconds, and adjust the gain (amplification) of the signal over that period to bring the variance up or down to the variance you want. Audio processing packages provide this as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention numerical stability. The standard DSP literature describes ways to implement a robust high-pass filter. For instance, FIR filters tend to be very stable.&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2014-02-21T04:38:57.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14557" PostTypeId="2" ParentId="14551" CreationDate="2014-02-21T05:05:46.453" Score="0" Body="&lt;p&gt;i think you are little bit confused.Actually the variance is the thing which gives a range from the mean to vary randomly. suposing your mean is one, then your noise signal varies from a range (add plus or minus one to the variance factor to randomize your data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-02-21T05:05:46.453" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14558" PostTypeId="2" ParentId="13346" CreationDate="2014-02-21T07:34:29.440" Score="3" Body="&lt;p&gt;After many weeks I give the answer to my own question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a limit in which we can solve this problem in a reasonably simple way. Suppose we sum enough points in our DFT that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow&quot;&gt;central limit theorem&lt;/a&gt; guarantees that the distribution of the sum's real and imaginary parts are Gaussian distributed. Then we only need to compute the variance. If we specialize the case of the variances of the real part of the DFT we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\langle (\textrm{Re} X_k) (\textrm{Re} X_l) \rangle = \frac{1}{N^2}\sum_{n=0}^{N-1}\sum_{m=0}^{N-1}\langle x_n x_m \rangle \cos(2\pi n k / N)\cos(2 \pi m l / N)&#xA;$$&#xA;The thing to note is that $\langle x_n x_m \rangle$ is just the correlation function of the time domain samples, which we can denote $\rho(n-m)$. Putting this in, we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\langle (\textrm{Re} X_k) (\textrm{Re} X_l) \rangle = \frac{1}{N^2}\sum_{n=0}^{N-1}\sum_{m=0}^{N-1} \rho(n-m) \cos(2\pi n k / N)\cos(2 \pi m l / N)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This form in terms of the correlation function is useful because the correlation function is frequently known; By the &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem&quot; rel=&quot;nofollow&quot;&gt;Wiener-Khinchin theorem&lt;/a&gt; the correlation function is the Fourier transform of the spectral density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sum can be computed numerically, or even analytically for some particular forms of $\rho$. To compute covariance with imaginary parts of $X$ just put $\sin$ instead of $\cos$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the idea for this in J. Schoukens and J. Renneboog, IEEE Transactions on Instrumentation and Measurement, Vol. IM-35, No. 3, September (1986).&lt;/p&gt;&#xA;" OwnerUserId="7361" LastActivityDate="2014-02-21T07:34:29.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14559" PostTypeId="2" ParentId="14467" CreationDate="2014-02-21T11:06:50.987" Score="2" Body="&lt;p&gt;Your question is about the resampling step, and let's focus on that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resampling is used in particle filtering to counteract &quot;sample impoverishment&quot; that is the fact that some particles may have very low weights. This is a waste of resources as you want to describe your probability distribution ate best. You should note that it should not interfere (a priori) with the measurement of prediction steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The optimal situation is to have all particles having roughly uniform weights and that's the goal set by most resampling algorithms. I propose you use this function which uses something similar to histogram equalization for a ratio &lt;code&gt;resample&lt;/code&gt;of particles (a nd-array were the last line represents the weights):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def resampling(particles, resample):&#xA;    &quot;&quot;&quot;&#xA;    Resample weighted particles.&#xA;&#xA;    The particles are grouped in N_pop batches to represent multiple velocities.&#xA;    The probability is given for all particles but corresponds to the proba-&#xA;    bility of one batch.&#xA;&#xA;    Input&#xA;    -----&#xA;    N particles as a particles.shape array&#xA;&#xA;    Output&#xA;    ------&#xA;    N particles as a particles.shape array&#xA;&#xA;    Parameters&#xA;    ----------&#xA;    resample : gives the ratio of particles that get resampled at every frame (between 0 and 1)&#xA;&#xA;    &quot;&quot;&quot;&#xA;    particles_out = particles.copy()&#xA;    N = particles.shape[1]  # number of particles&#xA;&#xA;&#xA;    # resample a percentage of the particles (the total number keeps to N)&#xA;    if resample &amp;gt; 0:&#xA;        # draw resample (in %) random addresses of particles that we will reassign&#xA;        N_resample = int(N*resample)&#xA;        address_resample = np.random.permutation(np.arange(N))[0:N_resample]&#xA;&#xA;        # draw from this subset some addresses uniformly over their pdf using histogram equalization&#xA;        proba_resample = particles_out[-1, address_resample]&#xA;        proba_resample /= proba_resample.sum()&#xA;        address = np.interp(np.linspace(0, 1, N_resample, endpoint=False)+1/2./N_resample,#np.random.rand(N_resample),&#xA;                            np.concatenate(([0.], np.cumsum(proba_resample))),&#xA;                            np.arange(N_resample+1))&#xA;        address = [int(k) for k in address]&#xA;&#xA;        # reassign these particles and set their weight to a uniform value&#xA;        particles_out[:, address_resample] = particles_out[:, address_resample[address]]&#xA;        subset_weight = proba_resample[address].sum() # should be \approx N_resample / N, that is, resample&#xA;        particles_out[4, address_resample] = subset_weight / N_resample #1/N_resample #particles_out[4, address_resample].sum()&#xA;&#xA;        # ultimately, normalize weights&#xA;        particles_out[4, :] /= particles_out[4, :].sum()&#xA;&#xA;    return particles_out&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2014-02-21T11:06:50.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14560" PostTypeId="1" AcceptedAnswerId="14662" CreationDate="2014-02-21T11:51:23.157" Score="3" ViewCount="7484" Body="&lt;p&gt;I am trying to get a working understanding of how to resize images using bilinear and bicubic transformations. I coded a resizing function based on things I've read here and Wikipedia, etc., but I get different results than what MATLAB and Mathematica give.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A minimal working example is the image &lt;code&gt;im=[100 50 0]&lt;/code&gt; in MATLAB or &lt;code&gt;im={1, .5, 0}&lt;/code&gt; in Mathematica. My algorithm (and &quot;common sense&quot;) tells me that resizing this image to 5 pixels should give&#xA;&lt;code&gt;im=[100 75 50 25 0]&lt;/code&gt; and &lt;code&gt;i={1, .75, .5, .25, 0}&lt;/code&gt;, respectively. However, I get&#xA;&lt;code&gt;im=[100 80 50 20 0]&lt;/code&gt; and &lt;code&gt;i={1, .8, .5, .2, 0}&lt;/code&gt; from MATLAB and Mathematica when forcing the bilinear method. Specifically, the MATLAB commands&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im=[100 50 0];&#xA;imresize(im,[1,5],'bilinear')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;returns&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ans =  100.0000   80.0000   50.0000   20.0000         0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They are obviously doing the same, different thing than my code (and common sense). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain their algorithm to me? I am guessing it my mistakes relate to how to &quot;index&quot; the new image. The original image, with only one row, has a constant &quot;&lt;code&gt;y&lt;/code&gt;&quot; value of 1, with columns &lt;code&gt;x=1,2,3&lt;/code&gt;. I am assuming that the new image could be viewed as having columns indexed as &lt;code&gt;x=1, 1.5, 2, 2.5, 3&lt;/code&gt;, and interpolation is needed to compute the values of &lt;code&gt;f(1.5,1)&lt;/code&gt; and &lt;code&gt;f(2.5,1)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7989" LastEditorUserId="7989" LastEditDate="2014-02-21T13:20:24.967" LastActivityDate="2014-02-25T14:35:58.830" Title="Understanding MATLAB/Mathematica's bilinear interpolation" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14561" PostTypeId="1" CreationDate="2014-02-21T12:03:17.183" Score="3" ViewCount="1001" Body="&lt;p&gt;Does &lt;code&gt;FFT&lt;/code&gt; method input argument have to be power of 2, i.e, $2^n$&lt;br&gt;&#xA;I just realized there are many algorithm for &lt;code&gt;FFT&lt;/code&gt; implementation, is there any algorithm that takes arbitrary amount of samples as input argument?&lt;br&gt;&#xA;if yes, what is their advantages amongst each other? &#xA;namely, what algorithm does Matlab apply? &lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2014-02-22T08:46:34.440" Title="FFT method input argument have to be $2^n$ ?" Tags="|matlab|fft|fourier-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14562" PostTypeId="2" ParentId="14561" CreationDate="2014-02-21T12:21:02.717" Score="6" Body="&lt;p&gt;It is a common misconception that all FFT algorithms require their inputs to have a length that is a power of 2. The radix-2 &lt;a href=&quot;http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm&quot;&gt;Cooley-Tukey&lt;/a&gt; algorithm, the first to be widely known, has this limitation, but there are mixed-radix versions of the algorithm that don't require a power-of-2-sized input. In addition to Cooley-Tukey, there are a number of other FFT algorithms that have differing requirements on their input size; there are even techniques like &lt;a href=&quot;http://en.wikipedia.org/wiki/Rader%27s_FFT_algorithm&quot;&gt;Rader's algorithm&lt;/a&gt; that work on inputs whose sizes are prime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good, general purpose FFT implementations like MATLAB's &lt;code&gt;fft()&lt;/code&gt; or &lt;a href=&quot;http://www.fftw.org/&quot;&gt;FFTW&lt;/a&gt; support a wide range of algorithms and select one that is most appropriate for the specific situation. For more details on the specifics, go to the MATLAB documentation itself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; doc fft&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;h3&gt;Algorithms&lt;/h3&gt;&#xA;  &#xA;  &lt;p&gt;The FFT functions (fft, fft2, fftn, ifft, ifft2, ifftn) are based on a&#xA;  library called FFTW [3],[4]. To compute an N-point DFT when N is&#xA;  composite (that is, when N = N1N2), the FFTW library decomposes the&#xA;  problem using the Cooley-Tukey algorithm [1], which first computes N1&#xA;  transforms of size N2, and then computes N2 transforms of size N1. The&#xA;  decomposition is applied recursively to both the N1- and N2-point DFTs&#xA;  until the problem can be solved using one of several machine-generated&#xA;  fixed-size &quot;codelets.&quot; The codelets in turn use several algorithms in&#xA;  combination, including a variation of Cooley-Tukey [5], a prime factor&#xA;  algorithm [6], and a split-radix algorithm [2]. The particular&#xA;  factorization of N is chosen heuristically.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;When N is a prime number, the FFTW library first decomposes an N-point&#xA;  problem into three (N – 1)-point problems using Rader's algorithm [7].&#xA;  It then uses the Cooley-Tukey decomposition described above to compute&#xA;  the (N – 1)-point DFTs.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For most N, real-input DFTs require roughly half the computation time&#xA;  of complex-input DFTs. However, when N has large prime factors, there&#xA;  is little or no speed difference.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The execution time for fft depends on the length of the transform. It&#xA;  is fastest for powers of two. It is almost as fast for lengths that&#xA;  have only small prime factors. It is typically several times slower&#xA;  for lengths that are prime or which have large prime factors.&lt;/p&gt;&#xA;  &#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;   You might be able to increase the speed of fft using the&#xA;    utility function fftw, which controls the optimization of the&#xA;    algorithm used to compute an FFT of a particular size and dimension.&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;  &#xA;  &lt;h3&gt;References&lt;/h3&gt;&#xA;  &#xA;  &lt;p&gt;[1] Cooley, J. W. and J. W. Tukey, &quot;An Algorithm for the Machine&#xA;  Computation of the Complex Fourier Series,&quot;Mathematics of Computation,&#xA;  Vol. 19, April 1965, pp. 297-301. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[2] Duhamel, P. and M. Vetterli, &quot;Fast Fourier Transforms: A Tutorial&#xA;  Review and a State of the Art,&quot; Signal Processing, Vol. 19, April&#xA;  1990, pp. 259-299. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[3] FFTW (&lt;a href=&quot;http://www.fftw.org&quot;&gt;http://www.fftw.org&lt;/a&gt;) &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[4] Frigo, M. and S. G. Johnson, &quot;FFTW: An Adaptive Software&#xA;  Architecture for the FFT,&quot;Proceedings of the International Conference&#xA;  on Acoustics, Speech, and Signal Processing, Vol. 3, 1998, pp.&#xA;  1381-1384. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[5] Oppenheim, A. V. and R. W. Schafer, Discrete-Time Signal&#xA;  Processing, Prentice-Hall, 1989, p. 611. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[6] Oppenheim, A. V. and R. W. Schafer, Discrete-Time Signal&#xA;  Processing, Prentice-Hall, 1989, p. 619. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[7] Rader, C. M., &quot;Discrete Fourier Transforms when the Number of Data&#xA;  Samples Is Prime,&quot; Proceedings of the IEEE, Vol. 56, June 1968, pp.&#xA;  1107-1108.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-02-21T12:21:02.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14563" PostTypeId="2" ParentId="11092" CreationDate="2014-02-21T13:25:28.583" Score="0" Body="&lt;p&gt;You have to Fourier Transform your signals,after that you will get the different freq components,that will consist your spectrum,your bandwidth will be the difference between the higher and the smaller (in terms of freq) components. &lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-02-21T13:25:28.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14565" PostTypeId="2" ParentId="14488" CreationDate="2014-02-21T14:53:29.453" Score="2" Body="&lt;p&gt;you may refer Feature Extraction &amp;amp; Image Processing&#xA; By Mark Nixon, Alberto S Aguado.&lt;/p&gt;&#xA;" OwnerUserId="7794" LastActivityDate="2014-02-21T14:53:29.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14566" PostTypeId="2" ParentId="14560" CreationDate="2014-02-21T15:02:01.290" Score="2" Body="&lt;p&gt;&lt;code&gt;imresize&lt;/code&gt; gets you different results on Matlab and Octave. The one in Octave calls the &lt;code&gt;interp2&lt;/code&gt; function, which with &lt;code&gt;'bilinear'&lt;/code&gt; method will return you &lt;code&gt;[100 75 50 25 0]&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it seems like there is some extra processing in Matlab.  It performs affine transformation on the image. The interpolation is calculated on each pixel in the output image, then inverse map onto the indices of the pixels in the input image with the contributing weights. So I guess the mapped coordinates are not distributed uniformly (not exactly at 1.5 and 2.5 between [1,2], and [2,3] in your case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably you can &lt;code&gt;edit imresize_old&lt;/code&gt; to see more source code content than &lt;code&gt;imresize&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-21T15:02:01.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14567" PostTypeId="2" ParentId="14546" CreationDate="2014-02-21T15:13:04.170" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I know the signal could be passed through a low pass filter, and then windowed before the FFT.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, it &lt;em&gt;could&lt;/em&gt; be, and it's usually advisable to use a window, but these are not just things you do blindly because you heard about them. Low passing the data will alter it in ways you might not want to. It might be useful, or it might not -- depends on your application. It will reduce the amount of high frequencies represented in your FFT results. Is that what you want? Maybe, maybe not. Windowing is useful because it reduces (but does not eliminate) frequency-domain distortion caused by separating your data into chunks. Usually you want that, but there are trade-offs (my explanation is an over-simplification).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The sample rate is 44100.00, what low pass filter is needed for this, does the analog to digital conversion not run it through a low pass filter before converting it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The input must be filtered before the digital conversion (and usually this is done for you). There is no way to filter it after to achieve the same effect, so even if it's not taken care of for you, you might as well forget about it. Chances are, your DA Converter does a halfway decent job of this, though.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How exactly does a window apply to real time sample input of 512 samples? Is a window not the same as a filter?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A window and a filter are different, as explained above.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I have also read that the signal can be run through the FFT twice, why exactly is this done and is it necessary for this data?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You haven't really told us anything about what you want to do with this data, but no, it's highly unusual to do two FFTs.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I would like to slowly build this up to do spectral analysis etc. Is this done directly on the FFT bin data?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;More or less. I suggest you read up on filtering, windowing, fourier analysis on Wikipedia. &lt;a href=&quot;http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html&quot; rel=&quot;nofollow&quot;&gt;This blog post&lt;/a&gt; might also help.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2014-02-21T15:13:04.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14568" PostTypeId="2" ParentId="14561" CreationDate="2014-02-21T15:45:03.533" Score="2" Body="&lt;p&gt;The simplest FFT to explain in a short text book chapter recursively factors a DFT length by 2,  log2(N) times, thus only seems to work for lengths that are powers of 2.  But you don't have to recursively divide-and-conquer all the way down to the last 2 elements, and you can also use the same basic algorithm to divide the length by other small factors, such as 3 or 5, etc.  Thus, the &quot;time&quot; (actually number of arithmetic ops) complexity for any length that can be decomposed into mostly a lot of tiny prime factors is roughly the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also other methods for larger prime factors that require longer textbook chapters.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, most advanced modern FFT libraries (FFTW, Accelerate/vDSP, etc.) can handle lot of lengths other than powers of 2.  Anyway, the actual order of execution time performance on modern processors is more due to data cache and instruction scheduling issues than just the number of arithmetic operations, so lots of other things have to done to compute a Fast DFT equivalent, not just radix-2 reduction.  Matlab uses one of these modern libraries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But many simple canonical-looking (student exercise, minimal lines of code, etc.) FFTs only use the short textbook chapter methods for lengths that are powers of 2 (and ignore CPU cache, etc. issues).  These short FFTs were also useful on older or tiny processors with very limited instruction memory.  Thus the common misconception.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-02-21T16:10:20.120" LastActivityDate="2014-02-21T16:10:20.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14569" PostTypeId="1" AcceptedAnswerId="14576" CreationDate="2014-02-21T15:58:54.907" Score="0" ViewCount="188" Body="&lt;p&gt;I have an image processing application that is different than anything that I've done before, and am looking for suggestions on how to approach.  Here is a basic description of the problem:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Given a set of images taken of over time, an &quot;intensity wave&quot; results for each pixel in the image, i.e. if you plot the intensity value of each pixel vs time, a wave plot results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find pixels that have &quot;similar&quot; waves (in terms of both shape and phase) and put them into a bucket.  It is unknown beforehand how many buckets there will be.  It would be great to be able to define a required level of &quot;correlation&quot; between waves before they are put into the same bucket.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At the end of the analysis, I want to look at how many buckets there are, how many pixels are in each buckets, and the spatial map over the image of each bucket.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've considered doing an FFT for each &quot;pixel wave&quot; and then comparing the results of that...not sure if that would work.  Any ideas or suggestions would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bryan&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS Also please let me know if you think that there is a better forum to submit this question.&lt;/p&gt;&#xA;" OwnerUserId="7994" LastActivityDate="2014-02-22T16:35:01.920" Title="Wave Correlation?" Tags="|image-processing|correlation|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14570" PostTypeId="1" AcceptedAnswerId="14571" CreationDate="2014-02-21T16:40:07.083" Score="4" ViewCount="1206" Body="&lt;p&gt;First time studying image processing...&lt;br /&gt;&#xA;I just don't understand what does fourier transformed image of an image describe?&lt;br /&gt;&#xA;For example consider given following pictures, The first one is the image, and the second one is the fourier transformation of the image.&lt;br /&gt;&lt;br /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BaQwI.jpg&quot; alt=&quot;The Lena image&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/LX5ie.jpg&quot; alt=&quot;The fourier transformation of lena&quot;&gt;&#xA;&lt;hr /&gt;&#xA;Now my question is:&lt;br /&gt;&#xA;By given the fourier transformation image, what am i suppose to comprehend from that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate any help here, i just cannot proceed with my studies without understanding this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7996" LastActivityDate="2014-02-21T18:28:17.647" Title="What does an image of Fourier Transformation of an image tell us?" Tags="|image-processing|computer-vision|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14571" PostTypeId="2" ParentId="14570" CreationDate="2014-02-21T17:16:44.207" Score="6" Body="&lt;p&gt;The Fourier transform image is a convenient representation to perform other functions on the images such as filtering. By itself, there's probably not much you can intuit by just looking at it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example you posted you can see how most of the energy in the Fourier image is near the center. This means that most of the energy in the image is in low frequencies. In other words, there are many areas of the picture with smooth texture like her shoulder, the hat and the blurred background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The black areas in the fourier image are away from the center. These represent the high frequencies, i.e. rough texture on the image or portions of the image that change rapidly. The high frequencies are black in the fourier image, which means that there is not a lot of high frequency energy in the Lena image. If you took a picture of static on an old tv screen then it would have a lot of high frequency energy in the image. There would be no dark regions in the fourier image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each pixel in the fourier image corresponds to a 2d-wave that is used to make up the original image. There is no spatial correspondence between the regions of the fourier image and the original image. Each pixel in the fourier image corresponds to a 2d-wave across the whole of the original image.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastEditorUserId="5662" LastEditDate="2014-02-21T18:28:17.647" LastActivityDate="2014-02-21T18:28:17.647" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14572" PostTypeId="1" CreationDate="2014-02-21T17:31:17.127" Score="0" ViewCount="124" Body="&lt;p&gt;I have been given a sinusoidal signal &lt;code&gt;x&lt;/code&gt; in time domain,asked to investigate the frequncy responce of the signal using matlab and observing the result,and using &lt;code&gt;grpdelay(x,1)&lt;/code&gt; command in matlab to observe the group delay of the signal .and taking &lt;code&gt;y=conv(x,x);&lt;/code&gt;which define the convolution of &lt;code&gt;x&lt;/code&gt; signal by itself and then asked to use the &lt;code&gt;grpdelay(y,1)&lt;/code&gt;.&#xA;My question here is what change should I exspect to see in group delay figure of &lt;code&gt;conv(x,x)&lt;/code&gt;?&#xA;or better to say how convolving of the signal by itself would effect the group delay of the signal.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7999" LastEditorUserId="7092" LastEditDate="2014-02-21T19:04:23.647" LastActivityDate="2014-02-21T20:48:23.387" Title="convolution and groupdelay" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14573" PostTypeId="1" CreationDate="2014-02-21T18:01:49.653" Score="0" ViewCount="121" Body="&lt;p&gt;I am trying to apply kalman filter for video processing , i am studying about it from different sources but it take me towards question that if i don't know that where my object come in frame mean i don't know about its angle (location in frame) then is it possible that Kalman filter automatically detect its measurements e.g location (as i already applied algorithms for specific object detection , so i only want that detected object tracking) and then track it in other frames ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other thing which come to my mind is that two objects (which i want to detect) come in the same frame and in the same measurements to is kalman filter take them as two different objects for tracking ?&lt;/p&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="5057" LastEditDate="2014-02-21T18:33:05.730" LastActivityDate="2014-02-21T19:04:51.343" Title="Queries on Kalman Filter" Tags="|image-processing|computer-vision|kalman-filters|tracking|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14574" PostTypeId="2" ParentId="14573" CreationDate="2014-02-21T18:53:37.937" Score="2" Body="&lt;p&gt;Main thing is that in the first frame it will be required to select the object of detection because it is obvious that the algorithm will not know automatically which object you want to track if a number of things will be moving in the video scene.Lucas-Kannade method is one of the methods which can detect moving objects in a given video frame . If you do not specify object it will show movement of all moving objects.Thats why you have to tell the algorithm which thing you want to track. Second thing i want to tell you is about Kalman filter which i think you are interpreting wrong , what Kalman filter actually do is that it uses the system model and input signal and generates its own output which is actually a predicted value . Now using the observation from the system it calculate the correction to be applied to the predicted output and hence final results are better than observations obtained from the system. Hence very first step is that you need a system model and the measurements. In tracking algorithms generally, Image processing algorithm is applied to detect the object of interest and then Kalman filter is applied to make the detected location more precise. Do not think that it will predict on its own. I hope it will help you.&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="5057" LastEditDate="2014-02-21T19:04:51.343" LastActivityDate="2014-02-21T19:04:51.343" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14576" PostTypeId="2" ParentId="14569" CreationDate="2014-02-21T20:42:22.920" Score="0" Body="&lt;p&gt;I'll propose a short answer and develop it if you need more information&#xA;So, step 1 and 3 are somehow easy to implement&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would map step 2 into:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.1) From each wave extract a set of features. This step basically defines what it means for tow waves to be similar and what information from waves is irrelevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.2) Cluster the waves in buckets. Choose a method that computes the number of clusters automatically (you still have to specify a value that roughly defines the similarity between the data)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 2.1 try to use more than one algorithm that can describe your wave. There are a wide variety of algorithms and your FFT ideea is good (that is, for each wave, compute FFT and use first k coefficients as features). Note that some algorithms generate features that are phase invariant, other keep the phase information. The choice is yours, whenever the phase information is useful or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 2.2 you can use out of the box clustering algorithms. I suggest to start with the simpler ones, than climb up to more sophisticated approaches. There are mainly two categories, one for which you state the desired number of clusters and the other one where you specify something equivalent of a threshold and the algorithm clusters the data in as many buckets as necessary. Start with a k-means clustering and stop maybe at a mean shift clustering. Hierarchical clustering is another idea but could be hard to work with it from the beginning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my perspective step 2.2 is the most difficult to get it right. The meta parameter that controls the clustering is tricky to be tuned. Ideally you should have a way to measure independently how good the clustering is (ex. make a hand made bucketing that will be a ground truth for your method or derive some domain specific measures for the images). Based on the ground truth you can &quot;tune&quot; the meta parameter to an optimal value. The tuning is done using cross-validation or a simple train/evaluate splitting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.s. The clustering algorithm basically computes some distances between the features. You can measure directly the distance between two 1D signals with some methods (correlation, RMSE, etc) but in my opinion it limits your options in defining what it means for two waves to be similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to clarify what phase variant/invariant means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a picture with two signals (s1 and s2), that are very similar and in phase.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Nh7hc.jpg&quot; alt=&quot;signals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I performed FFT and extracted magnitude and phase (anlge) from each Fourier coefficient. (Note, the magnitude is log compressed so the absolute values are comparable)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Magnitude for each signal (m1 and m2):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1rrdg.jpg&quot; alt=&quot;Magnitude&quot;&gt;&#xA;Phase for each signal (p1 and p2):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/jn5li.jpg&quot; alt=&quot;Phase&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I compute the Euclidean distance between the magnitudes and phases I get the following values:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For phase shift of 0 Magnitude distance: 6.2272 phase distance: 19.9371&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I change the phase of the s2 so it will be in $\pi/2$ wrt to s1 and the values changed to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For phase shift of 0.5 Magnitude distance: 5.9229 phase distance: 28.0612&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Just for reference, here are the out of phase s1, s2, m1, m2, p1 and p2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signals:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0cF8h.jpg&quot; alt=&quot;signalsPi&quot;&gt;&#xA;Magnitude of the Fourier&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DxLKS.jpg&quot; alt=&quot;MagPi&quot;&gt;&#xA;Phase:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/pr5zu.jpg&quot; alt=&quot;PhasePi&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the magnitude of in phase and out of phase signals are roughly unchanged. You can say that the magnitude of FFT for a signal, is insensitive to alterations of the phase (this is what the fancy &quot;invariant&quot; word means). The phase of FFT is another story, it is very sensitive to changes in the phase of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I post the MATLAB code so you can play with the simulations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function FourierFeatures()&#xA;phaseShift = 0.5; % 0 == in phase, 0.5 = pi/2 out of phase&#xA;&#xA;s1 = generateSignal(100,0.0);&#xA;s2 = generateSignal(100,phaseShift);&#xA;[m1 p1] = performFourier(s1);&#xA;[m2 p2] = performFourier(s2);&#xA;&#xA;close all;&#xA;plot(s1,'r'); hold on; plot(s2,'b');&#xA;figure;&#xA;plot(m1,'r'); hold on; plot(m2,'b');&#xA;figure&#xA;plot(p1,'r'); hold on; plot(p2,'b');&#xA;&#xA;mdist = norm(m2-m1);&#xA;pdist = norm(p2-p1);&#xA;&#xA;disp(['For phase shift of ', num2str(phaseShift) , ' Magnitude distance: ',num2str(mdist), ' phase distance: ' , num2str(pdist)]);&#xA;&#xA;end&#xA;%Compute FFT Magnitude and phase&#xA;function [magnitude, phase] = performFourier(signal)&#xA;    f = fft(signal);&#xA;    magnitude = abs(f);&#xA;    magnitude = log(1+magnitude);&#xA;    phase = angle(f);&#xA;end&#xA;&#xA;%Generate sinusoidal signals with some noise&#xA;function signal = generateSignal(length, offset)&#xA;    x = [1:length];&#xA;    omega = [10, 15 ,20];&#xA;    amplitude  = [10 10 15];&#xA;    randomAmp = [1 3 3];&#xA;    y = 5 * rand(1,length);&#xA;    for i = 1: size(omega,2)&#xA;        y = y + amplitude(i) * sin(offset * omega(i) + x * omega(i))+ randomAmp(i) * rand(1,length);&#xA;    end&#xA;    signal = y;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="5737" LastEditDate="2014-02-22T16:35:01.920" LastActivityDate="2014-02-22T16:35:01.920" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14577" PostTypeId="2" ParentId="14572" CreationDate="2014-02-21T20:48:23.387" Score="1" Body="&lt;p&gt;There is some confusion here. Frequency Response and Group Delay are properties of a System not the properties of a signal. You can only calculate the spectrum of a signal (magnitude and phase). A &quot;signal&quot; doesn't have group delay unless it's the impulse response of an LTI system.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-02-21T20:48:23.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14578" PostTypeId="1" AcceptedAnswerId="14613" CreationDate="2014-02-21T23:22:13.030" Score="1" ViewCount="130" Body="&lt;p&gt;Using under-sampled data, what determinations can be made about the Nyquist rate (correct sampling rate)? If my instrumentation limits me to sampling data at a fixed but insufficient rate what, if anything, can be determined from that data about the sampling rate that would be required to properly represent the signal? Are there signal analysis techniques that would provide any indicators?&lt;/p&gt;&#xA;" OwnerUserId="8005" LastActivityDate="2014-02-23T20:45:47.367" Title="Using under-sampled data, what determinations can be made about the Nyquist rate (correct sampling rate)?" Tags="|signal-analysis|sampling|nyquist|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14579" PostTypeId="1" AcceptedAnswerId="14585" CreationDate="2014-02-22T00:10:31.630" Score="0" ViewCount="993" Body="&lt;p&gt;I have a sinusiodal signal &lt;code&gt;x&lt;/code&gt; in time domain.I have done the convlotion as followings using matlab:&#xA;&lt;code&gt;y=conv(x,x)&lt;/code&gt;  and &lt;code&gt;y=conv(x,fliplr(x))&lt;/code&gt;.&#xA;Observing the result by Matlab, both of the above signal giving the same result in frequency domain. Why do you think is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: &lt;code&gt;FLIPLR(X)&lt;/code&gt; returns X with row preserved and columns flipped&#xA;    in the left/right direction.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = 1 2 3     becomes  3 2 1&#xA;    4 5 6              6 5 4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7999" LastEditorUserId="7092" LastEditDate="2014-02-22T00:30:16.060" LastActivityDate="2014-02-22T03:32:28.120" Title="convolution and frequncy response" Tags="|matlab|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14580" PostTypeId="2" ParentId="14578" CreationDate="2014-02-22T00:25:56.597" Score="0" Body="&lt;p&gt;If the modulation is asymmetric (as in SSB/USB) and appears to be &quot;upside-down&quot;, then that may be evidence that a better sample rate is higher.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-22T00:25:56.597" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14581" PostTypeId="2" ParentId="14491" CreationDate="2014-02-22T01:12:11.963" Score="5" Body="&lt;p&gt;Depending on the actual recordings, the algorithm complexity could range from dead easy to really complex...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll take the studio recording case first, so I can assume :&#xA;- (Almost) no noise coming from outside (cars, trucks, bus...)&#xA;- Nobody slamming the door in the middle of the recording&#xA;- Voice samples are recorded at optimal level independently of who is speaking (some ppl speak very low, others loud and clear)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's the case, then you could implement the logic of what sound engineers call a noise gate : below a certain audio power threshold, it's silence, otherwise it's not.&#xA;You'd have to calculate mean power over a very small window and check it against the threshold. Probably take safety margins around &quot;speeched&quot; areas so you don't cut the start/end of the words.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determining the correct threshold is a manual process involving trials and errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise gates sometimes use 2 different thresholds : one to determine speech has started and another to determine speech has stopped. The second one being lower than the first one so it doesn't stop in the middle of a word.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determining threshold(s) for different files recorded at different levels (because of different speakers) might become tricky. One way to help is to first normalize the volumes : i.e. check for the max value and apply gain in order to bring this value to the max authorized one in the range you're working with (might be -1.0 to 1.0 or 0.0 to 1.0 or signed/unsigned integer values).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing to define is the minimum length of &quot;speeched&quot; areas and the minimum length of silent areas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's a bit more background noise (and I assume the noise volume doesn't change too much over time), you could use the property of white noise when calculating autocorrelation factors : it's mean value goes close to zero&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of &quot;brute force&quot; autocorrelation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int n = vocalSample.length;&#xA;for (int j = 0; j &amp;lt; n; j++) {&#xA;    for (int i = 0; i &amp;lt; n; i++) {&#xA;        correllation[j] += vocalSample[i] * vocalSample[(n + i - j) % n];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then calculate mean value of the array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do this for very small arrays (e.g. 1ms at 22KHz -&gt; 22 values), otherwise it will take ages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I actually used this technique with some success on Ted talks to remove silence in order to perform speaker identification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have hours and hours of recording, you might consider multithreading your calculations :-)&#xA;In my calculations (remove noise, normalize, extract vocal print), I crunched 10Gb in about 8 minutes using 8 worker threads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;State-of-the-art vad is something beyond what could be explained here, here is a link to an extremely interesting IEEE article on the subject : &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6403507&amp;amp;punumber%3D97&quot; rel=&quot;noreferrer&quot;&gt;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6403507&amp;amp;punumber%3D97&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8006" LastActivityDate="2014-02-22T01:12:11.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14582" PostTypeId="1" AcceptedAnswerId="14584" CreationDate="2014-02-22T01:33:16.513" Score="1" ViewCount="2247" Body="&lt;p&gt;I have the following two graphs but I don't know how to recognize from the graph if they are IIR or FIR! Can you please guide me through? &#xA;&lt;img src=&quot;https://i.stack.imgur.com/vG2fi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.: Does MATLAB have a function to detect if an impulse response graph corresponds to IIR or FIR?&lt;/p&gt;&#xA;" OwnerUserId="7907" LastActivityDate="2014-02-22T02:43:41.777" Title="How can I detect if a filter is FIR or IIR according to impulse response graph?" Tags="|matlab|filters|filter-design|infinite-impulse-response|finite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14584" PostTypeId="2" ParentId="14582" CreationDate="2014-02-22T02:43:41.777" Score="5" Body="&lt;p&gt;If a filter is FIR then the impulse response is finite and goes to zero and stays there. This is like the second filter in your post. If it is IIR the impule response extends towards infinity like the first image in your post&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-02-22T02:43:41.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14585" PostTypeId="2" ParentId="14579" CreationDate="2014-02-22T03:32:28.120" Score="3" Body="&lt;p&gt;Convolution in the time domain means you are multiplying their frequency transforms. This is one of the many properties of the Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zh4tf.jpg&quot; alt=&quot;Properties of Fourier Transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when you flip a signal X[n], you can also write it down as x[n1], where n1 = -n. If you look at the time scaling property, try replacing 'a' by -1. You'll observe that the F(W) will now become F(-W).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since F(-W) is exactly the same as F(W), your result does not change. &lt;/p&gt;&#xA;" OwnerUserId="8008" LastActivityDate="2014-02-22T03:32:28.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14586" PostTypeId="2" ParentId="14561" CreationDate="2014-02-22T08:46:34.440" Score="0" Body="&lt;p&gt;The basic idea of most &quot;FFT&quot; algorithms is to decompose the DFT of a non-prime length N = KM sequence into M DFTs of length K sequences and K DFTs of length M sequences, interconnected with N complex &quot;twiddle factor&quot; multiplications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the multiplicative complexity of the direct realization is N^2 and the resulting complexity is MK^2 + KM^2 + N = N(K + M + 1) there will be savings as N &gt; K + M + 1. Now, K and M can possibly be decomposed again and so on. If not, the DFT is evaluated straightforwardly (which for length 2 is really simple).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If N is prime there are other methods, Bluestein, Rader etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If M and K are coprime one can avoid the twiddle factor multiplications at the expense of a bit more complicated ordering of the sequences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For short (but longer than two) lengths, there are more efficient methods in terms of multiplications than direct evaluation such that the Winograd short length DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &quot;split-radix&quot; FFT algorithms, which divides the length into more than two parts. This is the case for FFTW, which splits the sequence in lengths N/2, N/4, and N/4.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-02-22T08:46:34.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14587" PostTypeId="2" ParentId="13009" CreationDate="2014-02-22T08:59:39.177" Score="1" Body="&lt;p&gt;The resulting analytic signal after using a the Hilbert transform filter is ideally a signal without any negative frequencies, hence, attenuating -1 (using normalized frequency) to 0 while transmitting 0 to 1 (note that this is a complex output and therefore one do not have the standard symmetry around 0). This is obtained by phase-shifting positive frequencies pi/2 and negative frequencies -pi/2 while keeping the magnitude to be one and adding the output with the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is not possible to obtain this change in phase-shift without a transition band one will need to specify how wide the transition band should be.. Hence, in your case the 0.1 would indicate that your designed filter will perform well from 0.05 to 0.95 with a transition band from -0.05 to 0.05 and similarly from 0.95 to 1.05.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Increasing the order with constant transition band will produce a higher attenuation/smaller approximation error in the passband, while decreasing the transition band with the same order will have the opposite effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you will implement it on an FPGA I would suggest multiplying the coefficients with a power of two, e.g. 8192 to get a better range for the output and use of the bits.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2014-02-23T20:30:58.590" LastActivityDate="2014-02-23T20:30:58.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14589" PostTypeId="2" ParentId="14259" CreationDate="2014-02-22T11:32:11.893" Score="2" Body="&lt;p&gt;If an image has large values at high frequency components then the data is changing rapidly on a short distance scale. e.g. a page of text&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the image has large low frequency components then the large scale features of the picture are more important. e.g. a single fairly simple object which occupies most of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus low frequency correspond to slow varying information ( continuous surface)&#xA;high frequency correspond to quickly varying information ( eg. edges)&lt;/p&gt;&#xA;" OwnerUserId="7794" LastActivityDate="2014-02-22T11:32:11.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14590" PostTypeId="2" ParentId="13919" CreationDate="2014-02-22T11:51:51.610" Score="1" Body="&lt;p&gt;Gonzales&amp;amp;Woods is a good book. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;since u need some other book for reference i may suggest &#xA; &lt;code&gt;&#xA;&lt;/code&gt;Author: S. Jayaraman, S. Esakkirajan And T. Veerakumar&#xA; &lt;code&gt;&#xA;&lt;/code&gt;Title of the Book: Digital Image Processing&#xA; &lt;code&gt;&#xA;&lt;/code&gt;Publisher: Tata McGraw - Hill Education Pvt. Ltd, New Delhi&#xA; &lt;code&gt;&#xA;&lt;/code&gt;Year: 2010&#xA; &lt;code&gt;&#xA;&lt;/code&gt;Edition: 3&#xA;&lt;code&gt;&#xA;&lt;/code&gt;This is also good book for beginners&lt;/p&gt;&#xA;" OwnerUserId="7794" LastActivityDate="2014-02-22T11:51:51.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14591" PostTypeId="2" ParentId="13463" CreationDate="2014-02-22T12:20:46.920" Score="1" Body="&lt;p&gt;for Multiresolution based fusion discrete wavelet transform you may refer the following&#xA;&quot; A Wavelet based image fusion tutorial &quot; by Gonzalo Pajares ( available at: www.ELSEVIERcomputer science.com)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Wavelet based image fusion techniques - An introduction ,review and comparison by Krista Amolins&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for Curvelet transform refer &quot; Wavelet for image fusion&quot; by shih-Gu Huang&lt;/p&gt;&#xA;" OwnerUserId="7794" LastActivityDate="2014-02-22T12:20:46.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14592" PostTypeId="2" ParentId="14547" CreationDate="2014-02-22T12:57:47.777" Score="1" Body="&lt;p&gt;BPM detectors work by finding the strongest period in the onset detection function - a function of time indicating how likely it is that there is an onset at time t. Which brings the topic of onset detection...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tracking energy/envelope in the time domain is a weak strategy for detecting rhythm/notes, because:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For some instruments, there are playing techniques which create new notes without a significant change of energy (for example moving the finger on a string of a cello with no change in bowing, or changing the fingering on a flute with continuous blowing). This has the effect of creating changes in fundamental frequency without a noticeable change in the time-domain envelope.&lt;/li&gt;&#xA;&lt;li&gt;A lot of commercial music is so heavily compressed that the signal is almost &quot;pumped&quot; to maximum amplitude all the time.&lt;/li&gt;&#xA;&lt;li&gt;While this is yet another corner case, it is worth reminding that some instruments or playing techniques have very slow attacks.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So naively looking for peaks in the time-domain (via energy) will not be very robust. You have to look for better &quot;clues&quot;, and the frequency domain is the answer. The simplest thing that can be done in the frequency domain is to compute the difference of energy between adjacent STFT frames (a measure known as the &quot;spectral energy flux&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more elaborate metric, which is actually as cheap in terms of computing costs, consists in checking the deviation between the actual and expected value of the complex amplitude in a STFT bin (&lt;a href=&quot;http://www.eecs.qmul.ac.uk/legacy/dafx03/proceedings/pdfs/dafx81.pdf&quot; rel=&quot;nofollow&quot;&gt;reference here&lt;/a&gt;) - this deviation would be null in the stable segment of a note (as the amplitudes are just sustaining or slowly decaying; and the phases are just keeping on rolling), and high at an onset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All these techniques have very modest computational costs and can be implemented in realtime even on relatively cheap microcontrollers - a complete beat-tracker (onset detection + BPM detection + beat tracking) is in the 10 MIPS range.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-02-22T12:57:47.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14594" PostTypeId="1" CreationDate="2014-02-22T14:27:07.187" Score="0" ViewCount="70" Body="&lt;p&gt;I have used the following command to slice a large image into blocks of 2x2 pixels:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;convert -crop 2x2 +repage Logo.jpg sl%d.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I attempt to put the blocks next to each other in the order that they should be, I get a smaller size of the original image. I wonder if there is anything I should do to get the original size.&lt;/p&gt;&#xA;" OwnerUserId="8012" LastEditorUserId="7092" LastEditDate="2014-02-22T17:02:18.193" LastActivityDate="2014-02-22T17:02:18.193" Title="Slicing of images" Tags="|image-processing|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14595" PostTypeId="2" ParentId="13919" CreationDate="2014-02-22T16:14:45.093" Score="2" Body="&lt;p&gt;Do you really want to read a book? As a good resource to start, I'd suggest playing around with the &lt;a href=&quot;http://scikit-image.org/docs/dev/auto_examples/&quot; rel=&quot;nofollow&quot;&gt;scikit-image library&lt;/a&gt;. Trying the classical algorithms with real-world images will give you a nice feel of how difficult &amp;amp; amusing image processing is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Refer to a book afterwards, when you want to have a grasp of the maths behind the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also try O'Reilly's &lt;a href=&quot;http://programmingcomputervision.com/&quot; rel=&quot;nofollow&quot;&gt;&quot;Programming Computer Vision with Python&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8015" LastActivityDate="2014-02-22T16:14:45.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14596" PostTypeId="2" ParentId="6306" CreationDate="2014-02-22T17:30:20.120" Score="-1" Body="&lt;p&gt;&quot;Are these both good metrics for evaluation?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It all depends what it is you want to evaluate, ie what you want to use your detectors/descriptors for, and what kind of images you have (with repeated patterns? very similar but distinct objects? inside/outside?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want precise correspondence between 2 images of the exact same things, those are good metrics (that's the kind of images used by Mikolajczyk for the tests). These is useful, for instance, for image stitching &amp;amp; 3D reconstruction.&lt;/p&gt;&#xA;" OwnerUserId="8015" LastActivityDate="2014-02-22T17:30:20.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14597" PostTypeId="1" CreationDate="2014-02-22T19:48:25.323" Score="2" ViewCount="1245" Body="&lt;p&gt;I have a physical system consisting of a microphone, which feeds to a DSP, which drives a speaker. The microphone and speaker system have an amplitude response or gain, as well as a phase response, which is clearly lagging as the frequency increases. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aim is to produce an IIR filter in the hardware of a DSP that can create a net loop gain of 1 and a phase shift of (180' + 360k'). I am limited to IIR filters.  The aim is that whatever the microphone reads, will produce a signal from the speaker that is out of phase with the input acoustic signal, even if it is a cycle or 2 delayed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have measured the transfer function for the microphone speaker combination and calculated the arbitrary magnitude and phase response required to meet my needs.  Here is my Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#xA;%  This script calculates the filter coefficients, from measured amplitude &#xA;%  and phase data.  The intention is to program an IIR filter&#xA;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#xA;&#xA;clc                                                     %Clear the creen from any previous runs&#xA;&#xA;Frequency   =       [0;     20;       50;         100;        150;        200;        250;        300;        350;        400;        450;        500;        550;        600;        650;        700;        750;        800;        850;        900;        950;        1000;       1050;       1100;       1150;       1200;       1250;       1300;       1350;       1400;       1450;       1500;       1550;       1600;       1650;       1700;       1750;       1800;       1850;       1900;       1950;       2000;         2050;];     %Frequency values&#xA;Mag_SM      = 0.001*[20;    42.105;   63.158;     78.947;     78.947;     118.421;    118.421;    126.316;    113.158;    107.895;    84.211;     71.053;     48.421;     50.526;     41.053;     40.000;     37.895;     33.684;     29.474;     28.421;     26.316;     24.211;     23.158;     23.158;     22.105;     21.053;     21.053;     20.000;     18.947;     15.789;     16.316;     15.789;     16.842;     15.789;     16.842;     16.842;     16.842;     17.368;     16.316;     15.263;     14.211;     13.158;       10;];       %Magnitude gain of speaker microphone&#xA;Phi_SM      =       [-90;   -94;      -140;       -173;       -135;       -173;       -194;       -216;       -232;       -256;       -262;       -270;       -269;       -272;       -290;       -282;       -281;       -288;       -269;       -282;       -287;       -284;       -295;       -285;       -286;       -294;       -297;       -285;       -301;       -292;       -287;       -292;       -285;       -288;       -285;       -294;       -290;       -311;       -306;       -301;       -298;       -310;        -330;];      %Phase lag of speaker microphone&#xA;Phi_DSP     =       [3.5;   3.5;      1;          -1;         -1.75;      -2.25;      -3;         -3.75;      -4.5;       -5;         -5.5;       -6.25;      -7;         -7.5;       -8.5;       -9;         -9.5;       -10.25;     -10.75;     -11.5;      -12.25;     -13;        -13.5;      -14;        -15;        -15.5;      -16.25;     -17;        -17.5;      -18;        -18.75;     -19.25;     -20;        -20.75;     -21.25;     -22;        -22.75;     -23.25;     -24;        -24.75;     -25.5;      -26;        -26.5;];      %Phase lag of the DSP ADC and DAC hardware&#xA;&#xA;Phi_Tot     =       Phi_SM + Phi_DSP;                   %Add the phase lag of the DSP to the speaker and microphone, as this is the total phase lag needed to cmopensate in the IIR&#xA;&#xA;Mag_IIR     =       1./Mag_SM;                          %We want the response of the IIR to be the inverse&#xA;Phi_IIR     =       -360 - 180 - Phi_Tot;               %Make sure the IIR phase is always negative so as to be causal&#xA;&#xA;[Rows Columns] = size(Frequency);                       %For counting and what not&#xA;&#xA;Data_Array = horzcat(Frequency, Mag_IIR, Phi_IIR);      %Put them all into an array for ease of use&#xA;&#xA;for n = 1:Rows                                          %Make a complex representation off the magnitude and phase data&#xA;    Data_Array(n, 4) = Data_Array(n, 2).*exp(1j*(Data_Array(n, 3)*2*pi/360));&#xA;end&#xA;&#xA;D = fdesign.arbmagnphase('Nb,Na,F,H',31,31,Frequency/2050,Data_Array(:, 4)); &#xA;Hd = design(D,'iirls');&#xA;&#xA;hfvt = fvtool(Hd, 'Color','w');                         %For plotting the graphs&#xA;legend(hfvt,'Equiripple', 'FIR Least-Squares','Frequency Sampling', ...&#xA;    'Location', 'NorthEast')&#xA;hfvt(2) = fvtool(Hd,'Analysis','phase','Color','white');&#xA;legend(hfvt(2),'Equiripple', 'FIR Least-Squares','Frequency Sampling')&#xA;&#xA;ax=get(hfvt(2),'CurrentAxes'); set(ax,'NextPlot','Add');&#xA;pidx = find(Frequency&amp;gt;=0);&#xA;plot(ax,Frequency,[fliplr(unwrap(angle(Data_Array(:,pidx-1:-1:1)))) ... % Mask&#xA;    unwrap(angle(Data_Array(:,pidx:end)))],'k--')&#xA;&#xA;fcfwrite(Hd,'firfilter.txt');                           %Write filter coefficients to a file&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The magnitude plot is perfectly acceptable:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rilmO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the phase plot is correct to a certain extent:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kLCfy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not entirely correct because instead of spanning from 270' to 540', which is phase LEAD and non-causal, it should be spanning from -450' to -180', which is phase LAG and causal.  As a result, because Matlab has created a filter that has a positive phase, it is non-causal and unstable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Coefficient Format: Decimal&#xA;&#xA;% Discrete-Time IIR Filter (real)     &#xA;% -------------------------------     &#xA;% Filter Structure    : Direct-Form II&#xA;% Numerator Length    : 32            &#xA;% Denominator Length  : 32            &#xA;% Stable              : No            &#xA;% Linear Phase        : No       &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I assume if Matlab were to put in the appropriate delays in the IIR, it COULD add another 720' onto the phase lag and produce a stable filter that is realizable real-time?  Any ideas how to tell it to include the -720'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind regards Charles&lt;/p&gt;&#xA;" OwnerUserId="8016" LastActivityDate="2014-06-23T02:14:30.027" Title="IIR filter that is causal and stable and has more phase lag at lower frequencies" Tags="|matlab|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14598" PostTypeId="2" ParentId="14535" CreationDate="2014-02-22T23:29:48.283" Score="1" Body="&lt;p&gt;For the sake of not putting more stuff in the comments, I'll try describe how I would approach the problem, although I confess that I've never actually done this myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mentioned yourself, that for the sake of simplicity, we can assume for now that the system is linear, so that all frequencies are distorted in a consistent way. Perhaps it's non-linear as a function of distance between transmitter and receiver, but let's assume for now that this distance is fixed. I also assume that time-invariance property holds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linear time-invariant (LTI) systems are nice in many ways, one of which is that they commute (note that this is generally &lt;em&gt;not&lt;/em&gt; true for &lt;em&gt;time-varying&lt;/em&gt; systems). In other words, if $L_1$ and $L_2$ are LTI, then $L_1(L_2(x[n])) = L_2(L_1(x[n]))$ This means that if you can work out how to correct the received signal for distortions caused by your channel after you've received the signal, the &lt;em&gt;same&lt;/em&gt; correction can be applied as &lt;em&gt;pre-distortion&lt;/em&gt; before you send it out. Note all the assumptions we made, so if these definitely do not hold, perhaps you should clarify and we can start relaxing them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to the topic of how in the world do you compute the correction filter. There are two equally straightforward ways, depending on whether you need it to be and FIR filter or if you can allow it to be IIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing you do is measure the impulse response of the system. This can be done in many ways. For seismic systems I've heard people use chirp deconvolutions and wavelet based methods (I don't know much about exact ones). I would start off by sending a chirp through your channel, recording it on the other end, taking FFT's of original and received signals, dividing recorded by original and taking the IFFT. I know I will probably get lynched for suggesting this, but this is a first step. This may actually work okay, so try it. You can then start experimenting with more sophisticated ways of obtaining the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we've obtained this impulse response, call it $h[n]$, we need to invert it. From basic LTI system theory, we know that inverting $H(z)$ is done simply with $H^{-1}(z)=\dfrac{1}{H(z)}$. However, there's a catch. $H^{-1}(z)$ may not be stable if $H(z)$, which is a polynomial, has complex roots outside the unit circle on the complex plane. This can be remedied by converting $H(z)$ to a minimum-phase system. This can be done using real cepstrum, and if you have MATLAB with the signal processing toolbox, the &lt;code&gt;rceps&lt;/code&gt; command will do that for you without any additional code (look up the documentation). Now we have an IIR all-pole filter that solves the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If IIR is not a good option and you need an FIR filter, Linear Predictive Coding (LPC) can be used to approximate this filter with an FIR filter. Describing it is beyond what I'm going to describe here, but you're welcome to post more questions on these topics if you like. This is more of a system overview rather than the full solution, but working out the entire thing without knowing constraints and requirements of your project is impossible.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2014-05-24T01:49:45.387" LastActivityDate="2014-05-24T01:49:45.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14599" PostTypeId="2" ParentId="14597" CreationDate="2014-02-23T00:00:01.810" Score="1" Body="&lt;p&gt;A pole inside the unit circle will cause the phase angle (representing phase lag), of that pole's contribution, to increase as the angle around the unit circle (representing frequency) increases.  A pole outside does the opposite.  So your choices for a generally decreasing phase angle around the unit circle are: (1) poles outside, an unstable filter, or (2) more zeros inside than poles + zeros outside, representing a FIR filter (instead of, or in conjunction with an IIR).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-23T00:00:01.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14600" PostTypeId="1" AcceptedAnswerId="14612" CreationDate="2014-02-23T00:24:14.890" Score="-1" ViewCount="1144" Body="&lt;p&gt;suppose we have an fir filter: &#xA;t=[-50:50];&#xA;x=[sinc(.1*t).*cos(2*pi*.15*t),sinc(.1*t),sinc(.1*t).*cos(2*pi*.3*t)];&#xA;using matlab command grpdelay(x,1),we observe the groupd dalay of the system.&#xA;then we have y=conv(x,x),again using the matlab command grpdelay(y,1) what changes in group delay would you expect to see in convolved signal.&#xA;how convolving a signal by itself would effect the group delay of the output signal in compare to x signal.&#xA;any help much appriciated&lt;/p&gt;&#xA;" OwnerUserId="7999" LastActivityDate="2014-02-23T20:02:51.650" Title="group delay of an fir filter" Tags="|matlab|convolution|group-delay|" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14602" PostTypeId="1" CreationDate="2014-02-23T06:02:48.550" Score="2" ViewCount="483" Body="&lt;p&gt;TL/DR: I'd like to take the median of lots of images to make a single &quot;better&quot; image.  The problem is, the camera is slowly moving, and there is significant lens distortion.  On the plus side the motion is constant, I've got lots of images, timestamps on each image, and I've been able to track points across the images to help align them.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I have a large 2000 frame series of night sky images taken from a GoPro Hero3. &lt;em&gt;Which is in itself silly because GoPros have bad low light performance.&lt;/em&gt; I've done some light math on the images, and identified star position &quot;arcs&quot; over the 2 hour period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way, using the star movement, to solve for the distortion of the lens AND the star rotation? Perhaps using OpenCV, or barrel distortion correction formulas?  Star rotation alone is easy - 1 rotation every 24 hours.  But generating the formula of (x1, y1) = f(x0, y0, num_minutes) is hard given I don't have the north star identified, the camera has a fish-eye effect, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I feel like there should be a generic way to solve the pixel offset equation, regardless of the interaction between the lens distortion and star rotation.&lt;/strong&gt; Any ideas? I believe I have all the info needed, about 30k data points across 250 stars of: (star_id, time, x, y) with good coverage, see the fast graph image below.  (I'd chop off the left side where some trees stayed still.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uwGdX.png&quot; alt=&quot;fast graph of star tracks&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8019" LastActivityDate="2014-02-23T06:02:48.550" Title="Motion and Distortion Estimation using multiple still images?" Tags="|opencv|motion-detection|distortion|superresolution|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14603" PostTypeId="1" AcceptedAnswerId="16489" CreationDate="2014-02-23T10:52:48.037" Score="7" ViewCount="2303" Body="&lt;p&gt;I know that the complex wavelet transform is given by&#xA;$$\int_{-\infty}^{\infty}f(x)\psi^*_{s,u}(x)\,dx$$&#xA;where $f$ is the signal, $\psi_{s,u}(x)=\frac{1}{\sqrt{s}}\psi(\frac{x-u}{s})$ is the wavelet.&#xA;and $^*$ denotes the complex conjugate operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have the wavelet $\psi_{s,u}$, which is represented by &lt;code&gt;psi&lt;/code&gt; in MATLAB, and I want to compute the above integral. Which command should I use for computation in MATLAB?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;conv(f,psi)&lt;/code&gt; or &lt;code&gt;conv(f,conj(psi))&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since &lt;code&gt;conj&lt;/code&gt; computes the complex conjugate of a vector? Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5014" LastEditorUserId="128" LastEditDate="2018-08-26T06:37:04.973" LastActivityDate="2021-02-16T15:53:29.023" Title="Convolution of Signal with a Wavelet" Tags="|matlab|wavelet|convolution|filtering|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14604" PostTypeId="2" ParentId="14600" CreationDate="2014-02-23T14:17:52.300" Score="0" Body="&lt;p&gt;This is related to FIR filters and the linearity (flat) of the Group delay that they possess.&#xA;That article helped me to understand the fundamental concepts of group delay:&lt;a href=&quot;http://www.scribd.com/doc/41169598/Group-Delay&quot; rel=&quot;nofollow&quot;&gt;http://www.scribd.com/doc/41169598/Group-Delay&lt;/a&gt;&#xA;And Richard G. Lyons Understanding Digital Signal Processing  1996 book has a very nice explanation for FIR filtering where you will understand,how the pulses are used and how you would possibly proceed with the above problem.&#xA;Anyway if you put the expression you shared above in MATLAB you will be able to draw some conclusions about the group delay behavior of that design.   &lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-02-23T14:17:52.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14606" PostTypeId="1" CreationDate="2014-02-23T14:59:52.867" Score="6" ViewCount="3672" Body="&lt;p&gt;I am working with speckle noise reduction in ultrasound images. At present I am learning about anisotropic diffusion.I will explain first what I have  understood about anisotropic diffusion.&#xA;I learnt the difference between isotropic and anisotropic diffusion using the diagram below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SFfEG.png&quot; alt=&quot;anisotropic diffusion&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of isotropic diffusion diffusion of the pixel value takes place all across the image.This result in blurring of edges whereas in case of anisotropic diffusion smoothing or diffusion is carried out depending on the image edges and their direction.&#xA;It smoothens homogeneous image regions but retains image edges. (&lt;strong&gt;I know that the tool that is used to find the strength of the edges and the direction is gradient but I need some more explanation on what is gradient? How we calculate gradient? Please explain me in a lucid manner I have zero knowledge about gradient. Please explain me with easy explanation&lt;/strong&gt;)&#xA;Based on this gradient value we perform smoothing. If the magnitude of the gradient is small then smoothing is done. If the magnitude of the gradient is large then smoothing is stopped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dPqbC.png&quot; alt=&quot;graph&quot;&gt;&lt;br&gt;&#xA;This graph illustrates the relationship between anisotropic diffusion and gradient magnitude.In the figure the orginal signal is noisy but 2 major peaks are still visible.Applying the diffusison process to the original signal and using the gradient magnitude to attenuate the diffusion process at places where the diffusion process at places&#xA;where the edges is strong produce a signal in which the SNR is high.The diffusion at the edges of the signals is attenuated by using a function of the gradient magnitude.(&lt;strong&gt;&lt;em&gt;This gradient magnitude equation is what I am unable to understand please see the following equation and explain me in detail. I don't Know why they use divergence and gradient&lt;/em&gt;&lt;/strong&gt; )&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WKij3.png&quot; alt=&quot;diffusion&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/LoEWH.png&quot; alt=&quot;diffusion 1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BFBNo.png&quot; alt=&quot;diffusion 2&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gQr42.png&quot; alt=&quot;diffusion 3&quot;&gt;&#xA;&lt;code&gt;&#xA;&lt;/code&gt;( &lt;strong&gt;&lt;em&gt;I couldn't able to understand these equations. please explain the equations in relation with the theory above&lt;/em&gt;&lt;/strong&gt;)&lt;/p&gt;&#xA;" OwnerUserId="7794" LastEditorUserId="8563" LastEditDate="2018-09-19T16:36:42.720" LastActivityDate="2018-09-19T16:36:42.720" Title="Anisotropic diffusion" Tags="|image-processing|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14607" PostTypeId="1" CreationDate="2014-02-23T15:20:16.387" Score="2" ViewCount="340" Body="&lt;p&gt;I am trying to detect a crosswalk pattern on the road by using Hough transform, and then selecting lines that separate between black and white regions in a binary image. The stripes are detected fine, but the problem is that a lot of other unwanted objects provide false positives, as you can see in the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SFyjU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*You can ignore the non-parallel lines, they are not taken into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to ignore things such as the wall and the taxi that are also 'parallel' to the crosswalk stripes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my question is:&lt;/strong&gt; Is there an algorithmic way to detect the ground plane(road in this case), even partially, in order to improve detection?&lt;/p&gt;&#xA;" OwnerUserId="7464" LastEditorUserId="7464" LastEditDate="2014-02-24T00:13:23.170" LastActivityDate="2014-02-24T00:13:23.170" Title="Detect Ground Plane" Tags="|matlab|detection|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14609" PostTypeId="1" CreationDate="2014-02-23T18:43:55.327" Score="0" ViewCount="52" Body="&lt;p&gt;Let's say I have a sound file, I then compute the Spectrogram and segment each part of it. Assume that it is a recording of someone saying the word &quot;Hello&quot; and therefore, each piece is given like so: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 -&amp;gt; H&#xA;1 -&amp;gt; E&#xA;2 -&amp;gt; L&#xA;3 -&amp;gt; L &#xA;4 -&amp;gt; O&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to calculate the duration of each of the parts/phonemes. Is there a way to do this? I was thinking, because I have the data, is it possible to just count the total number of elements and therefore calculate the time it takes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone suggest any reading material that could potentially help me. &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-02-23T18:43:55.327" Title="Time of sound-signal" Tags="|stft|speech-processing|time-frequency|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14610" PostTypeId="1" CreationDate="2014-02-23T19:03:29.830" Score="1" ViewCount="408" Body="&lt;p&gt;For a time discrete signal, the rect-filter (for 1D signal [1,1]) is a perfect low pass filter. I was wondering, what is the best gaussian approximation of this filter? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a current problem, I cannot use binomial filters but have to use Gaussian filters for smoothing. Ths question is thus, &lt;strong&gt;what is the standard deviation of a Gaussian filter best approximating the [1,1] rect-filter&lt;/strong&gt;. 'Best' could e.g. mean is has similar probperties in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="8024" LastActivityDate="2014-02-24T16:12:08.073" Title="Standard deviation of Gaussian corresponding to perfect low pass filter [1,1]" Tags="|sampling|gaussian|frequency-domain|smoothing|approximation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14612" PostTypeId="2" ParentId="14600" CreationDate="2014-02-23T20:02:51.650" Score="0" Body="&lt;p&gt;x is the filter? conv(x,x) is then identical to cascading two of these filters. The group delay is equivalent to the delay of the signal through the filter. The rest of the reasoning is left as a rather trivial exercise.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-02-23T20:02:51.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14613" PostTypeId="2" ParentId="14578" CreationDate="2014-02-23T20:45:47.367" Score="1" Body="&lt;p&gt;This may be a trivial answer, but you can of course use the aliasing information to determine the correct sampling rate, given that you know that the signal is undersampled. In the simplest case, given that the signal appears to be at $k f_s,\ k &amp;lt; 0.5$ one can devise that the frequency of the signal is $(1-k)f_s$. In general it may be at $(N \pm k)f_s$ for some integer $N$.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-02-23T20:45:47.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14614" PostTypeId="2" ParentId="14519" CreationDate="2014-02-23T21:01:41.460" Score="0" Body="&lt;p&gt;Use the fact that $\dot x_1 = s x_1$ and take it from there. It appears that your result is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be noted that there is a closed form expression to map a state-space representation to a transfer function. However, it includes inverting a matrix with s variables and may hence be more challenging than just solving it as stated above&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-02-23T21:01:41.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14615" PostTypeId="1" AcceptedAnswerId="14618" CreationDate="2014-02-23T21:06:45.120" Score="1" ViewCount="3944" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nkx9V.png&quot; alt=&quot;Cool Audio Visualization&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to make/create this spectrum visualization on a physical &lt;a href=&quot;http://www.adafruit.com/products/1613&quot; rel=&quot;nofollow noreferrer&quot;&gt;Led_Bar_Panel(s)&lt;/a&gt;.&#xA;Here's what I think I should do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take sample's in real-time( Sampling freq = &lt;strong&gt;&lt;em&gt;Fs&lt;/em&gt;&lt;/strong&gt; KHz, only voice)&lt;/li&gt;&#xA;&lt;li&gt;Do a FFT( As far I know we take (2 ^ &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;) samples at a time. Is there a mathematical relation between &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Fs&lt;/em&gt;&lt;/strong&gt; ?)&lt;/li&gt;&#xA;&lt;li&gt;Take the averaged amplitudes(eg. 1-10 Hz will constitute one band/bar of LED) amplitudes.&lt;/li&gt;&#xA;&lt;li&gt;Pass amplitude information to an Arduino.&lt;/li&gt;&#xA;&lt;li&gt;Arduino Controls the Bar lights as per incoming data from PC.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is this approach right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other thing that I want to know is &quot;Can a Arduino do this fft in real time @ 8Khz sampling&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kindly provide me information/suggestions.&#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8026" LastActivityDate="2014-02-24T21:39:38.597" Title="How to make this cool Audio Spectrum Visualizer" Tags="|fft|audio|visualization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14616" PostTypeId="1" CreationDate="2014-02-23T21:52:46.077" Score="1" ViewCount="1127" Body="&lt;p&gt;SIFT algorithm provides a 128 dimensional feature vector that is used for image classification.When all the interest points(key points) are taken together and K-means clustering is applied,the image is then clustered into many clusters.My question is how does this clustering/grouping of feature points together help in creating a dictionary(of equivalent image words).Does the output after applying this BoW algorithm yield a single vector for an image.&lt;/p&gt;&#xA;" OwnerUserId="6941" LastActivityDate="2014-02-24T12:33:58.260" Title="what is the output of BoW after an image has been trained with SIFT algorithm and k-means" Tags="|image-processing|algorithms|classification|sift|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14617" PostTypeId="2" ParentId="14416" CreationDate="2014-02-23T22:34:40.487" Score="0" Body="&lt;p&gt;It all depends on the part you called ,,fusion''. Just adding the images would result in the original image, because of linearity of DWT. It is not very clear what you are trying to achieve (what is ,,proper'' in your sense). Probably you want to emphasize a drawing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following ideas appeared:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Noise reduction and edge preservation seem to contradict each other&#xA;and might be subject to a trade-off. &lt;/li&gt;&#xA;&lt;li&gt;You might want to just weigh the DWT coefficients, instead of first splitting the fields. There appears be no advantage in doing so.&lt;/li&gt;&#xA;&lt;li&gt;One level of a DWT will not&#xA;give much room to reason about preserving edges. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-23T22:34:40.487" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14618" PostTypeId="2" ParentId="14615" CreationDate="2014-02-23T23:48:16.943" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a mathematical relation between n and Fs ?)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$n$ will determine your frequency resolution. For example, if $f_s = 16kHz$ and $2^n = 8192$, each bin in your FFT will have a width of about $16000 / 8192 \sim 2$ Hz. From your image, it looks like the smallest FFT bin width you want is 10 Hz wide. This means that if $f_s = 16kHz$, you can work with a size as low as $2^n = 2048$, but no smaller.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One other thing that I want to know is &quot;Can a Arduino do this fft in&#xA;  real time @ 8Khz sampling&quot;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are many types of Arduino boards. This is absolutely doable with the recent boards that have 32-bit ARM processors. On the older 8-bit AVR-based Arduino boards, the data point I found is that a &lt;a href=&quot;http://wiki.openmusiclabs.com/wiki/ArduinoFFT&quot; rel=&quot;nofollow&quot;&gt;size 256 FFT runs in 7ms&lt;/a&gt;. So it would still be possible with some corner cutting, such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reducing the sample-rate to 8kHz as you suggest, and get a few less bars in the upper range (or faking the data - there's not much going on in here which is not correlated with the few bars before it anyway...)&lt;/li&gt;&#xA;&lt;li&gt;Reducing the FFT size and get a few less bars in the lower range&lt;/li&gt;&#xA;&lt;li&gt;Reducing the frame rate at which you do the analysis, and if necessary use some interpolation between frames.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure I've already seen a bunch of projects doing that. If you only need a few bars, another approach is to use a filter bank.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-02-24T21:39:38.597" LastActivityDate="2014-02-24T21:39:38.597" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14619" PostTypeId="2" ParentId="14610" CreationDate="2014-02-24T03:01:26.147" Score="1" Body="&lt;p&gt;Suppose you want a low pass filter supported on $f \in [-1,1]$. The Fourier transform of a Gaussian is a Gaussian. So let's assume our Gaussian filter has a frequency response of the form $G_\sigma(f) = \frac{1}{\sigma \sqrt{2 \pi}} e^{-f^2/\sigma^2}$. For the best Gaussian fit in least squares sense, let us minimize the squared error ($\mathsf{SE}$):&#xA;$$&#xA;\mathsf{SE}(\sigma) = \int_{-1}^1 |G_\sigma(f)-1|^2 \;\;\; d\,f&#xA;$$&#xA;by choice of $\sigma$. This calls for some numerical evaluation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Integrate[ (1/s/Sqrt[2 Pi] Exp[-f^2/s^2] - 1)^2, {f, -1, 1}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which gave me&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2 - Sqrt[2] Erf[1/s] + 1/(2 Sqrt[2 Pi] s) Erf[ Sqrt[2]/s ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then plot the result as a function of $\sigma$ (i.e. &lt;code&gt;s&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see a minimum around $\sigma =0.7$.&lt;/p&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="1825" LastEditDate="2014-02-24T16:12:08.073" LastActivityDate="2014-02-24T16:12:08.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14620" PostTypeId="1" AcceptedAnswerId="14622" CreationDate="2014-02-24T04:02:02.360" Score="3" ViewCount="2024" Body="&lt;p&gt;I repeatedly see two representations of the general transfer function in the literature. The first is the following which is factorization of the numerator and denominator polynomials:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\textbf{G}(s) = k \frac{ (s - a_{1})(s - a_{2})(s - a_{3})\ldots&#xA;                              }{ (s - b_{1})(s - b_{2})(s - b_{3})(s - b_{4})\ldots&#xA;                                }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative, below, eludes me and I'll checked many sources but none seem to justify it. The difference is a lowly $s$ term in the denominator raised to a power.  Is this general form related the open-loop transfer function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\textbf{G}(s) = k \frac{ (s - a_{1})(s - a_{2})(s - a_{3})\ldots&#xA;                              }{s^m (s - b_{1})(s - b_{2})(s - b_{3})(s - b_{4})\ldots&#xA;                                }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what is the difference, if any in these two forms?&lt;/p&gt;&#xA;" OwnerUserId="3648" LastActivityDate="2014-02-24T06:57:17.490" Title="What is the general form of a transfer function" Tags="|transfer-function|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14622" PostTypeId="2" ParentId="14620" CreationDate="2014-02-24T06:21:20.340" Score="6" Body="&lt;p&gt;You may write the second equation on the first form by using $b_i = 0$ corresponding to those poles appearing at $s = 0$. Hence, the only difference is that in the second form you know that there are $m$ poles at $s=0$ while in the first form they may still be there, but one will have to check the values of $b_i$ to determine if they are there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a system with poles at $s=0$ is a marginally stable system and that the poles are typically introduced by integrators, which have a transfer function $1/s$.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-02-24T06:21:20.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14623" PostTypeId="2" ParentId="14620" CreationDate="2014-02-24T06:35:52.930" Score="1" Body="&lt;p&gt;The first representation of the Transfer Function can have poles at zero,this is not represented explicitly in that equation.The second form of the transfer function representation, takes into account,the poles located at &lt;strong&gt;z&lt;/strong&gt;=0.The presence of a pole at zero causes instability.&lt;/p&gt;&#xA;" OwnerUserId="6941" LastEditorUserId="6941" LastEditDate="2014-02-24T06:57:17.490" LastActivityDate="2014-02-24T06:57:17.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14624" PostTypeId="2" ParentId="14616" CreationDate="2014-02-24T07:41:53.627" Score="0" Body="&lt;p&gt;Yes, output for image is 1-D array of visual words. The word is number of the cluster, feature belongs to.&#xA;Output for feature is one number.  &lt;/p&gt;&#xA;" OwnerUserId="7030" LastActivityDate="2014-02-24T07:41:53.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14625" PostTypeId="1" CreationDate="2014-02-24T08:35:49.597" Score="0" ViewCount="321" Body="&lt;p&gt;I can not understand the reason why the following sentence is true:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If we have a Right-Hand signal(RHS) x(n), X(z), the Z-transform of x(n), has the same number of poles and zeros except at z = infinity&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;can any one explain why!?&lt;/p&gt;&#xA;" OwnerUserId="8033" LastActivityDate="2014-02-24T08:35:49.597" Title="Why the number of poles and zeros for a RHS signal in the Z domain is equal?" Tags="|discrete-signals|signal-analysis|z-transform|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14626" PostTypeId="1" CreationDate="2014-02-24T10:23:52.953" Score="1" ViewCount="93" Body="&lt;p&gt;If I have a discrete real-time signal $x[n]$, with its latest value $x[i]$ and all its past values $x[i-t]$, how can I estimate the derivative at $x[i]$?&lt;/p&gt;&#xA;" OwnerUserId="3352" LastEditorUserId="3352" LastEditDate="2014-02-24T10:29:46.740" LastActivityDate="2017-03-23T17:04:10.837" Title="How do I estimate the derivative of the current position, when I have only values from past to present?" Tags="|real-time|machine-learning|derivative|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14629" PostTypeId="1" AcceptedAnswerId="14633" CreationDate="2014-02-24T10:44:28.040" Score="0" ViewCount="180" Body="&lt;p&gt;I am currently working on a race car project where steering and braking is to be done by a fully electronic x-by-wire system. To roughly determine the minimum bandwidth of the controllers, I took user + car data from an existing race car. I though I would do an FFT of the input signals to see what the 'user' bandwidth is, and let the controller sample time be at least 10 times this value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, this is what I did with the steering input:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I took the sampled time-series of the steering wheel angle, s(t), for 2 laps, and removed the mean value from the series.&lt;/li&gt;&#xA;&lt;li&gt;I determined |s(t)|^2 to obtain a power-like quantity from the user input&lt;/li&gt;&#xA;&lt;li&gt;An FFT was performed on the signal from step 2, and the bandwidth of this signal was determined. At first I was going to determine the half power bandwidth, but I quickly noticed the spectral components above 2 Hz were negligible so I took this as the 'user signal bandwidth'&lt;/li&gt;&#xA;&lt;li&gt;From step 3, the min sample frequency for the steering input is 20 Hz as rule of thumb.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;was I correct in thinking that an FFT of the input signal represents&#xA;how much input 'energy' is present at each frequency in the FFT?&#xA;&lt;ul&gt;&#xA;&lt;li&gt;does step 2 makes sense or should I skip it?&lt;/li&gt;&#xA;&lt;li&gt;Am I correct in thinking the system will steer nicely if I sample the input signal at at least the frequency from step 4?&lt;/li&gt;&#xA;&lt;li&gt;My grad prof asked me 'so an FFT of the steering input, what am I seeing here? What does this graph actually mean? Is the driver&#xA;actually turning the wheel at 1/3 Hz, what have you plotted?' and I&#xA;had no idea how to clearly answer this question. Any thoughts?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am new to this forum so hope my questions are clear enough for you guys.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for helping me out!&lt;/p&gt;&#xA;" OwnerUserId="8037" LastActivityDate="2014-02-24T23:40:36.807" Title="Using DFT to determine control system bandwidth from user input" Tags="|fft|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14630" PostTypeId="2" ParentId="14626" CreationDate="2014-02-24T11:07:57.530" Score="2" Body="&lt;p&gt;Is the derivative between x[n] and x[n-1] useful enough, hence x'[n] = x[n] - x[n-1] ? Or do you need a better estimate?&lt;/p&gt;&#xA;" OwnerUserId="8037" LastActivityDate="2014-02-24T11:07:57.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14631" PostTypeId="2" ParentId="14616" CreationDate="2014-02-24T11:45:05.350" Score="1" Body="&lt;p&gt;You essentially got it right: the final purpose of the whole BoW clustering algorithm is to somehow produce a single &lt;em&gt;image descriptor&lt;/em&gt; for every image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of BoW clustering (either K-means, or hierarchical K-means, or some other clustering), this &lt;em&gt;image descriptor&lt;/em&gt; is a histogram of visual words for that image often normalized by the number of local features for each image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me offer a step-by-step explanation of the process:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;first you get all the local features from all the images (or just from your &lt;em&gt;learning dataset&lt;/em&gt;), and cluster all those features by a &lt;strong&gt;clustering&lt;/strong&gt; algorithm of choice&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;after completing the clustering, for every cluster we &lt;strong&gt;calculate the &quot;representative member&quot;&lt;/strong&gt; by some kind of mean or average over all the local feature samples from that cluster&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &quot;representative member&quot; is actually your &lt;em&gt;visual word&lt;/em&gt; -- it's like the &quot;core&quot; of all the features of the cluster (if you would be working with actual words, the samples &quot;work&quot;, &quot;working&quot; and &quot;workaround&quot; might all have a common representative member &quot;work&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This step might actually be skipped -- we don't care about exact visual word, as long as we can distinguish between the clusters (e.g. knowing how to classify a new local feature in to &quot;cluster 1&quot;, &quot;cluster 2&quot; or &quot;cluster 3&quot; is enough).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;now, for every image in our database we construct the &quot;image descriptor&quot; by making &lt;strong&gt;the histogram by clusters&lt;/strong&gt; for that image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g., if there is 4 clusters in final clustering, and our image has 4 features in cluster 1, 10 in cluster 2, 4 in cluster 3 and 2 more in cluster 4, the descriptor might be: &lt;code&gt;4|10|4|2&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;finally, we can &lt;strong&gt;normalize the histograms&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following with the same example from above, the image had a total of 20 features. We could thus normalize the &lt;code&gt;4|10|4|2&lt;/code&gt; histogram by dividing everything by 20 and getting: &lt;code&gt;0.2|0.5|0.2|0.1&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With this, you ended your &quot;database description&quot; -- you have a numeric descriptor for all your images. Now, when a new image arrives, you do the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;extract local SIFT (or any other kind) of features&lt;/li&gt;&#xA;&lt;li&gt;determine for all the local features of the new image to which cluster they belong&lt;/li&gt;&#xA;&lt;li&gt;make a histogram for the new image (+ normalize histogram)&lt;/li&gt;&#xA;&lt;li&gt;compare the histogram of the new image to the histograms of database images&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You have methods other than BoW to create the &quot;image descriptors&quot;. One alternative to BoW is VLAD (Vector of locally aggregated descriptors), which is a bit more compact but has the same purpose.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2014-02-24T11:45:05.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14633" PostTypeId="2" ParentId="14629" CreationDate="2014-02-24T12:34:38.733" Score="1" Body="&lt;p&gt;Your basic approach seems correct! However, step 2 is not a good idea since taking the square of the signal is a non-linear operation. Taking the square of the FFT to determine the signal power is correct though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your profs. question it depends on what you have measured and at which sample rate. I assume it is the steering wheel angle and therefore it should be possible to answer it, but there will be some pitfalls as most likely the steering movement is not in a sinusoidal form. However, the basic frequencies in the movement will be related to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that you redo the estimation without the squaring of the signal, the ten times safety margin should be more than enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To further convince you and your prof. I would suggest bandlimiting the measured data to your estimate by using a very sharp FIR filter and compare visually as well as downsampling the data and compare.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-02-24T12:34:38.733" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14634" PostTypeId="1" AcceptedAnswerId="14637" CreationDate="2014-02-24T12:37:04.003" Score="0" ViewCount="499" Body="&lt;ol&gt;&#xA;&lt;li&gt;Euclidian distance&lt;/li&gt;&#xA;&lt;li&gt;Cosine similarity&lt;/li&gt;&#xA;&lt;li&gt;Histogram Intersection&lt;/li&gt;&#xA;&lt;li&gt;Or any other?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Consider the importance of the method in case of images. Eg, Cosine Similarity matches angle of two vectors...&lt;br&gt;&#xA;What impact comparing just the angle or distance has on accuracy of BOW?&lt;br&gt;&#xA;Detailed explanation is welcome!!!&lt;/p&gt;&#xA;" OwnerUserId="7904" LastActivityDate="2014-02-24T14:56:59.203" Title="Which is the best method for comparing the histogram obtained after BOW?" Tags="|image-processing|object-recognition|sift|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14635" PostTypeId="2" ParentId="6306" CreationDate="2014-02-24T13:22:45.553" Score="1" Body="&lt;p&gt;Actually, the more a read your question, the less it makes sense. What I'm trying to answer here are not actually your questions, I'm rather trying to address the problems in your reasoning. They're too long for the comment, and they might set you on the right path.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let's start with &lt;strong&gt;detector evaluation&lt;/strong&gt; and referring to the Mikolajczyk paper.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I would use repeatability and a correspondence count for matched regions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would suggest re-reading the Mikolajczyk paper. This statement does not make much sense in the context of the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;repeatability&lt;/em&gt; and the &lt;em&gt;correspondence count&lt;/em&gt; were designed to be evaluated &lt;strong&gt;without involving the descriptors&lt;/strong&gt;, that is, &lt;strong&gt;without performing the matching&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When calculating the repeatability and correspondence number, Mikolajczyk proposes &lt;em&gt;likely matches&lt;/em&gt; based on image geometry and feature geometry (e.g. exclusively the feature position and size in the image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These &lt;strong&gt;same measures&lt;/strong&gt;, but performed on &lt;strong&gt;actual matches instead of geometrical estimates&lt;/strong&gt; produce different measures: the &lt;strong&gt;matching score&lt;/strong&gt; and the &lt;strong&gt;nb of correct matches&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These two pairs of measures were &lt;em&gt;both&lt;/em&gt; developed for evaluating the &lt;em&gt;quality of the detector&lt;/em&gt; (but not the descriptive power of the descriptor). While the first two measures (repeatability and correspondence number) are &lt;strong&gt;completely decoupled from the descriptor&lt;/strong&gt; (e.g. the matching process), that makes them somewhat less reliable. Thus, the other two measures (matching score and number of correct matches) do all detector comparisons using the same descriptor (SIFT), so the results are more reliable while somewhat dependent of the descriptor choice.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I'll take two images. One referred as source- and one as comparison-image.&lt;br&gt;&#xA;  &lt;sub&gt;&lt;sup&gt;(I took the liberty of correcting &lt;em&gt;&quot;to images&quot;&lt;/em&gt; in &lt;em&gt;&quot;two images&quot;&lt;/em&gt;. Please correct if wrong)&lt;/sup&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, I hope here you mean that you will be using this as a sub-routine to evaluate a dataset. Getting a comparison score between just one pair of images is not very descriptive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are trying to interpret the score for just one pair outside of context, you can not determine what is causing the (both good and bad) results, while it could be any and all of below:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the type of scene&lt;/li&gt;&#xA;&lt;li&gt;any single one of the transformations between images&lt;/li&gt;&#xA;&lt;li&gt;some combinations of the transformations&lt;/li&gt;&#xA;&lt;li&gt;poor image conditions (e.g. lighting, contrast, camera quality)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That is &lt;strong&gt;why Miolajczyk has &lt;em&gt;datasets&lt;/em&gt;.&lt;/strong&gt; Each dataset is dedicated to a single image transformation or varying a single image condition. Each dataset is either &quot;structured&quot; or &quot;textured&quot; (different &quot;types&quot; of scene) -- and contains one dominant planar surface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reference image in each dataset is a good quality, frontal image. The second one for each dataset is a &lt;em&gt;small change&lt;/em&gt; of the desired type (and represents how the detector reacts to small transformation on this type of image). Further images in the dataset represent more severe transformations of the same type, and are used to examine the detectors invariance under that kind of transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point of this is that in order to make a good &lt;strong&gt;estimate of detector quality&lt;/strong&gt;, you need to &lt;strong&gt;examine the trends&lt;/strong&gt; this detector exhibits while changing different conditions, &lt;strong&gt;one condition at a time&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You say two related things:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a way to evaluate the detector without RANSAC?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and then:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I think I definitively need the homography. But I never found a way to set the localisation-error ε for the repeatability-measure. Is there a way to set ε?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let's start with saying that &lt;strong&gt;yes, you definitely need the homography&lt;/strong&gt; to calculate the repeatability. Note when I said that the &lt;em&gt;repeatability and correspondence count&lt;/em&gt; rely on the &lt;em&gt;image geometry&lt;/em&gt; -- and this can only be calculated using the homography.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, even though I said that the &lt;em&gt;&quot;matching score is performed on actual matches instead of geometrical estimates&quot;&lt;/em&gt; -- this is true in principle, but Mikolajczyk still uses some geometrical information to obtain a more relevant result. Thus, yes, you need homography.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second part, &lt;strong&gt;yes, RANSAC is the best way to estimate a homography between two images of the (same) planar surface&lt;/strong&gt;. &lt;em&gt;But&lt;/em&gt;, that said you &lt;strong&gt;should not use only RANSAC estimate directly&lt;/strong&gt; each time you perform detector evaluation between a pair of images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean by this is that &lt;strong&gt;you should have pre-computed homograpies for every image pair that you plan to use in the testing&lt;/strong&gt;. Two ways to get pre-computed homographies are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pre-compute them yourself. In that case, you will most probably use RANSAC in this step. (you have some guidelines on this in the Mikolajczyk paper)&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Find datasets with pre-computed correct homographies&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Finally, what all my partial answers were leading to is a response to what you're planning to do:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I've read all Mikolajczyk papers (...). Now I'm implementing an evaluation-tool in OpenCV.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Well... why are you re-inventing the wheel?&lt;/strong&gt; &lt;em&gt;Mikolajczyk produced a testing framework, which is still available online.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This framework includes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;datasets with homographies provided&lt;/li&gt;&#xA;&lt;li&gt;good description of the datasets (e.g. what does each dataset evaluate)&lt;/li&gt;&#xA;&lt;li&gt;binaries that do all the &quot;dirty work&quot; from Mikolajczyk: all the region normalization, region rescaling and similar things mentioned in the Mikolajczyk paper. If you read the paper, you should know why they are important.&lt;/li&gt;&#xA;&lt;li&gt;a fully implemented function in &lt;code&gt;MATLAB&lt;/code&gt; that will calculate the &lt;em&gt;repeatability score&lt;/em&gt; and the &lt;em&gt;number of correspondance&lt;/em&gt; for any &lt;strong&gt;whole dataset&lt;/strong&gt; (and with minimal modification, will also calculate the &lt;em&gt;matching score&lt;/em&gt; and &lt;em&gt;number of correct matches&lt;/em&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In addition to &lt;strong&gt;only using the provided &lt;code&gt;MATLAB&lt;/code&gt; code&lt;/strong&gt;, in order to not re-invent the wheel but if you want to avoid &lt;code&gt;MATLAB&lt;/code&gt;, you can still:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;tweak the &lt;code&gt;MATLAB&lt;/code&gt; code to produce numeric instead of graph output, and then further analyse the numeric output in your language of choice&lt;/li&gt;&#xA;&lt;li&gt;use the &lt;code&gt;MATLAB&lt;/code&gt; code provided as help and guide in making your own testing environment (since you want to produce the same / similar functionality)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And to recap, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My question so far: Are these both good metrics for evaluation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, you were the one that did the research. You should be able to tell us. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my own personal research, I would say that &lt;strong&gt;the Mikolajczyk framework&lt;/strong&gt; is a &lt;strong&gt;good framework for evaluating feature detectors&lt;/strong&gt;. It was published in 2006 but you can still see recent papers using this framework. It has been accepted by the community as the go-to evaluation framework, and that &lt;strong&gt;with most of the community&lt;/strong&gt; (if not all) &lt;strong&gt;using the original code&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, please don't get offended by this, but if you are ultimately asking this question, it seems to me like you did not understand the paper(s) you read quite well. I only commented on the &quot;detector evaluation&quot; part in my answer, but I hope it made you realize you still have to put more effort in to understanding the framework you want to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My suggestion is to go back to reading the framework papers for both detector and descriptor evaluation. Possibly ask specific questions about what you do not understand (I'll be glad to answer any &lt;em&gt;new&lt;/em&gt; questions about the Mikolajczyk framework).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I understand I did not talk much about &quot;detector evaluation&quot;, but I could do some digging and reminding and write something about that if you want as well.&lt;/p&gt;&#xA;" OwnerUserId="1273" LastActivityDate="2014-02-24T13:22:45.553" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14636" PostTypeId="1" AcceptedAnswerId="14640" CreationDate="2014-02-24T14:13:42.400" Score="4" ViewCount="61240" Body="&lt;p&gt;I am trying to sample a sine wave and plot it's frequency components, but I am having problems implementing it.The result of taking 65536 samples of one cycle of a sine wave with max amplitude 1 and a frequency 100 can be seen below.Where the Y-axis this the magnitude of the complex Fourier sum, and the x-axis is the sample number.How can I see what frequency the sine wave has from this plot?, I would like to have a plot of freq vs Magnitude and not sample Number vs magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was expecting one big spike of amplitude 1 or 2 spikes of amplitude 0.5 each, but I seem to be getting a large amplitude, I don't know what i might be doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9RgQ6.jpg&quot; alt=&quot;FFT of sin(2*pi*f*t)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Amp = 1;&#xA;freq = 100;&#xA;dt = 2 * pi /65536;&#xA;index = 1;&#xA;for t = 0:dt:2*pi&#xA;   sine(index) = Amp * sin(2*pi*freq*t);&#xA;   sampleNumber(index) = index;&#xA;   index = index + 1;&#xA;end&#xA;&#xA;transform = fft(sine);&#xA;magTransform = abs(transform);&#xA;plot(sampleNumber,magTransform);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4376" LastActivityDate="2018-12-28T14:10:05.577" Title="How to get the FFT of a sine wave" Tags="|matlab|fft|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14637" PostTypeId="2" ParentId="14634" CreationDate="2014-02-24T14:56:59.203" Score="0" Body="&lt;p&gt;Histogram Intersection (Pyramid Match Kernel) specifically is currently accepted as a better tool, but this doesn't generalize really. When you formulate your features or histogram computations differently, things are subject to change.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-02-24T14:56:59.203" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14639" PostTypeId="2" ParentId="14636" CreationDate="2014-02-24T15:26:43.480" Score="3" Body="&lt;p&gt;Some FFTs require dividing by 1/N to represent magnitude &quot;naturally&quot; (which is non-energy preserving).  To label the X axis requires knowing the sample rate (Fs).  If known, then f_x = bin_index * Fs / N, up to N/2, then mirrored for negative frequencies.  If the frequency of a spectral peak (your input sinewave) isn't &lt;strong&gt;exactly&lt;/strong&gt; periodic in the FFT length (e.g. an integer number of cycles), then the magnitude of the closest FFT result bin will be smaller, and you will need to interpolate between bins to find a closer estimate to the peak magnitude (parabolic or windowed-Sinc kernel interpolations are common).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-24T15:26:43.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14640" PostTypeId="2" ParentId="14636" CreationDate="2014-02-24T15:35:30.787" Score="7" Body="&lt;p&gt;It looks like you're getting your frequency in Hertz confused with in radians/sec since you have the factor of &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; in both your sampling period &lt;em&gt;dt&lt;/em&gt; and your signal. I rewrote a bit of your code to clarify what I think you really want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Amp = 1;&#xA;freqHz = 12000;&#xA;fsHz = 65536;&#xA;dt = 1/fsHz;&#xA;t = 0:dt:1-dt;&#xA;sine = Amp * sin(2*pi*freqHz*t);&#xA;&#xA;N = 65536;&#xA;transform = fft(sine,N)/N;&#xA;magTransform = abs(transform);&#xA;&#xA;faxis = linspace(-fsHz/2,fsHz/2,N);&#xA;plot(faxis/1000,fftshift(magTransform));&#xA;axis([-40 40 0 0.6])&#xA;xlabel('Frequency (KHz)')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If your sampling frequency is 65536 samples/second, and you want for example a tone at 12 KHz, you can create it as shown. So here your sample period is 1/65536 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your expectation of getting two spikes with an amplitude of 0.5 each was correct -- just your generated tone was not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for scaling the x-axis to be in Hertz, just create a vector with the same number of points as your FFT result and with a linear increment from &lt;span class=&quot;math-container&quot;&gt;$-fs/2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$+fs/2$&lt;/span&gt;. Note also the fftshift I used in the plot. That's because the output of Matlab's FFT function goes linearly from 0 to fs. I find it easier to visualize having DC centered but either way is fine. Without the fftshift the &lt;em&gt;faxis&lt;/em&gt; vector would go from 0 to &lt;em&gt;fs&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qMTIl.png&quot; alt=&quot;FFT of a 12 KHz tone&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7509" LastEditorUserId="35749" LastEditDate="2018-12-28T14:10:05.577" LastActivityDate="2018-12-28T14:10:05.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14641" PostTypeId="2" ParentId="14636" CreationDate="2014-02-24T15:43:15.047" Score="0" Body="&lt;p&gt;To add som formulas to the answer of hotpaw2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the FFT you compute a representation of your signal as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{k=0}^{N-1} \hat x_k e^{2\pi i\,f_k\,t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_k=\frac{k}{N}f_s$ for $k=0,1,...,N/2-1$ and $f_k=\frac{k-N}{N}f_s$ for $k=N/2,...,N-1$, assuming $N$ even.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the FFT requires that the samples be taken with sampling step $\tau=1/f_s$, $x_n=x(n\tau)$, and the FFT of the sample array $(x_n)_n$ gives the scaled amplitude array $(N\hat x_k)_k$, since $\sum_{k=0}^{N-1}1=N$. The rescaling is usually left out of the FFT implementations to be dealt with by the user of the FFT library.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-02-24T15:43:15.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14642" PostTypeId="2" ParentId="14636" CreationDate="2014-02-24T15:43:59.027" Score="0" Body="&lt;p&gt;FFT provides method of computing DFT this you already know. now consider a signal x(n) and its DFT X(k). if your signal consist of N(65536 in your case) samples then X(k) will provide values at discrete frequencies of &lt;code&gt;2*pi*k/N&lt;/code&gt; .In fact the above DFT X(k) means &lt;code&gt;X(2*pi*k/N)&lt;/code&gt;. so if you are finding X(1) then it means you are finding DFT coefficient at discrete frequency of 2*pi*1/N and similary ,X(2) means coefficient for 2*pi*2/N and hence so on .Each coefficient shows contribution of that frequency in that signal if its large then it means that frequency constitute major part of signal. so for plotting fft with respect to frequency replace sample axis with frequency axis having points &lt;code&gt;2*pi*k/N&lt;/code&gt; where k=0 to 65535.FT never provides any information regarding time .it just provide frequency information of the signal. &lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2014-02-24T15:43:59.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14647" PostTypeId="2" ParentId="14629" CreationDate="2014-02-24T23:40:36.807" Score="1" Body="&lt;p&gt;First, I agree that step 2 should be omitted before the FFT.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, I'd suggest a much larger data collection set before making any conclusions on the frequencies that might be involved in the user input.  As a racer, I can tell you that many drivers have different styles, some being very smooth with inputs which would be expected to have less bandwidth, and others that are constantly making quick corrections. Car setup will affect this as well. Input bandwidths may increase substantially in response to an incident like a mechanical failure (e.g., blown tire) or other unusual situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also tricks like letting go of the steering wheel to allow it to recenter quickly after a substantial correction that will result in a high rate of change of the steering angle.  If you want to be able to capture things like that, be sure to include such events in your test and analysis data.  The implication here is that the steering angle can change faster than a normal human input either in response to letting go or hitting a curb/berm/hole on an apex or something like that.&lt;/p&gt;&#xA;" OwnerUserId="51" LastActivityDate="2014-02-24T23:40:36.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14648" PostTypeId="2" ParentId="9966" CreationDate="2014-02-25T00:30:44.640" Score="21" Body="&lt;p&gt;If $N$ is the length of the moving average, then an approximate cut-off frequency $F_{co}$ (valid for $N &amp;gt;= 2$) in normalized frequency $F=f/fs$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F_{co} = \frac {0.442947} {\sqrt{N^2-1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse of this is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N = \frac {\sqrt{0.196202 + F_{co}^2}}{F_{co}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This formula is asymptotically correct for large N, and has about 2% error for N=2, and less than 0.5% for N&gt;=4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.: After two years, here finally what was the approach followed.&#xA;The result was based on approximating the MA amplitude spectrum around $f=0$ as a parabola (2nd order Series) according to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$MA(\Omega) = \frac {Sin(\Omega∗N/2)}{Sin(\Omega/2)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$MA(\Omega) \approx 1+(\frac{1}{24}-\frac{N^2}{24})\Omega^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be made more exact near the zero crossing of $MA(\Omega)-\frac{\sqrt2}{2}$ by multiplying $\Omega$ by a coefficient&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\alpha=0.95264$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;obtaining &#xA;$MA(\Omega) \approx 1+0.907523(\frac{1}{24}-\frac{N^2}{24})\Omega^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution of $MA(\Omega)-\frac{\sqrt2}{2}=0$ gives the results above, where $2\pi F_{co}=\Omega_{co}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the above relates to the -3dB cut off frequency, the subject of this post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes though it is interesting to obtain an attenuation profile in stop-band which is comparable with that of a 1st order IIR Low Pass Filter (single pole LPF) with a given -3dB cut off frequency (such a LPF is also called leaky integrator, having a pole not exactly at DC but near to it). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RUYNl.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RUYNl.png&quot; alt=&quot;relations between a MA filter (FIR, N-1 zeros) and a 1-pole IIR LPF&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact both the MA and the 1st order IIR LPF have -20dB/decade slope in the stop band (one needs a larger N than the one used in the figure, N=32, to see this), but whereas MA has spectral nulls at $F=k/N$ and a $1/f$ evelope, the IIR filter only has a $1/f$ profile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{IIR} = \frac{1-Exp(-\Omega_{co})}{1-Exp(-\Omega_{co})*Exp(j \Omega)}$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one wants to obtain an MA filter with similar noise filtering capabilities as this IIR filter, and matches the 3dB cut off frequencies to be the same, upon comparing the two spectra, he would realize that the stop band ripple of the MA filter ends up ~3dB below that of the IIR filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get the same stop-band ripple (i.e. same noise power attenuation) as the IIR filter the formulas can be modified as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F_{co,IIR} = \frac {0.32} {\sqrt{N^2-1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N = \frac {\sqrt{0.1024 + F_{co,IIR}^2}}{F_{co,IIR}}$&lt;/p&gt;&#xA;" OwnerUserId="8043" LastEditorUserId="8043" LastEditDate="2016-06-29T09:00:23.597" LastActivityDate="2016-06-29T09:00:23.597" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14650" PostTypeId="1" AcceptedAnswerId="14651" CreationDate="2014-02-25T03:10:51.993" Score="0" ViewCount="2828" Body="&lt;p&gt;Given the frequency response $H (jω) = csc(ω)$ how would I go about finding the difference equation?  I know I can find $h[n]$ from here but after that I feel like I'm missing something.&lt;/p&gt;&#xA;" OwnerUserId="8044" LastEditorUserId="7092" LastEditDate="2014-02-25T05:07:15.233" LastActivityDate="2014-02-25T12:10:35.807" Title="Find Difference Equation From Frequency Response" Tags="|frequency-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14651" PostTypeId="2" ParentId="14650" CreationDate="2014-02-25T03:51:28.997" Score="1" Body="&lt;p&gt;so, if we're looking around for a discrete-time difference equation, let's modify the notation slightly to make it look like it's a frequency response for a discrete-time system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$  \begin{align}&#xA;H \left( e^{j \omega} \right) &amp;amp; = \csc(\omega) \\&#xA;&amp;amp; = \frac{1}{\sin(\omega)} \\&#xA;&amp;amp; = \frac{2j}{e^{j \omega} - e^{-j \omega}} \\&#xA;&amp;amp; = \frac{2j \ e^{-j \omega}}{1 - (e^{-j \omega})^2} \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so i guess that means that&#xA;$$H(z) = \frac{2j \ z^{-1}}{1 - z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so can you get a difference equation from that?&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-02-25T03:51:28.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14652" PostTypeId="1" CreationDate="2014-02-25T06:58:05.210" Score="2" ViewCount="1141" Body="&lt;p&gt;i am trying to understand how does the image rotation occur? i studied and came to know that we just multiply the image coordinates with rotation matrix which gives us the value of new coordinates. ok that is fine i get this. But main thing which is confusing me is the pixel values. i read that the pixel coordinates which we get after rotation can be non decimal hence interpolation is needed to get value at that point for this we rotate image back to original coordinate and find value by interpolation. But if we will rotate it back to original coordinate the the pixel will regain its original coordinate and at that coordinates value w are already having the value then why to do interpolation.please somebody clear my confusion.&lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2015-05-18T12:28:24.497" Title="concept of image rotation" Tags="|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14653" PostTypeId="2" ParentId="14652" CreationDate="2014-02-25T08:52:40.027" Score="0" Body="&lt;p&gt;You can round to the nearest pixel before rotating back to get the interpolation values. I think there are better ways of handling it though. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-02-25T08:52:40.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14654" PostTypeId="1" CreationDate="2014-02-25T10:20:06.223" Score="3" ViewCount="246" Body="&lt;p&gt;In image processing, how do &lt;a href=&quot;http://en.wikipedia.org/wiki/Region_growing&quot; rel=&quot;nofollow&quot;&gt;region growing&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_segmentation#Clustering_methods&quot; rel=&quot;nofollow&quot;&gt;clustering&lt;/a&gt; differ from each other? There are many papers like clustering based on region growing. I couldn't able to draw a fine line between these two concepts.&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="6" LastEditDate="2014-02-26T01:35:19.120" LastActivityDate="2024-04-03T18:05:00.563" Title="Region growing Vs Clustering" Tags="|image-processing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14655" PostTypeId="2" ParentId="14652" CreationDate="2014-02-25T11:34:52.127" Score="3" Body="&lt;p&gt;When you multiply the image matrix with the rotation matrix, you are essentially multiplying an integer matrix with a real number matrix. The result is a real matrix, which has to be quantized back to a discrete matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is being quantized? The coordinates themselves. The integer coordinates of the previous position of the pixel is now a real valued coordinate, which must be converted back to an integer in order to be placed on the screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were asked to rotate it back to the original angle you could have been right in questioning the futility of interpolation. However, the user might not want to rotate it back, so you have to perform interpolation or quantization to be able to use the rotated image. If you are concerned about image fidelity, you might want to save a copy of the original real valued matrix in memory or file until or opertions are finished and the user exits program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a &lt;a href=&quot;http://www.datagenetics.com/blog/august32013/index.html&quot; rel=&quot;nofollow&quot;&gt;useful link&lt;/a&gt; you might want to peruse.&lt;/p&gt;&#xA;" OwnerUserId="8050" LastEditorUserId="8050" LastEditDate="2014-02-25T11:42:09.527" LastActivityDate="2014-02-25T11:42:09.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14656" PostTypeId="1" AcceptedAnswerId="14663" CreationDate="2014-02-25T11:57:03.320" Score="0" ViewCount="2504" Body="&lt;p&gt;I have a raw EEG signal of length 2,50,000 samples. I band passed it from 0.05-10Hz (sampling frequency=500). Then I down sampled it at 20Hz. Now question is: What will be effect if I vary down sampling from 20Hz to say 5Hz or 60Hz? And why 20Hz is appropriate?&lt;/p&gt;&#xA;" OwnerUserId="7112" LastActivityDate="2014-02-25T15:33:28.583" Title="Effect of different downsampling rate on EEG signal" Tags="|signal-analysis|preprocessing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14657" PostTypeId="2" ParentId="14650" CreationDate="2014-02-25T12:10:35.807" Score="0" Body="&lt;p&gt;replace h(z) by the output by input form y(z)/x(z).now cross multiply by the numerator and denominator of the transfer function. now if suppose x(z)*pow(z,-1) appears in the time domain write it as x(n-1). finally bring it into y(n)=(combination of x(n) terms and y(n) terms)..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-02-25T12:10:35.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14658" PostTypeId="1" CreationDate="2014-02-25T13:17:59.400" Score="2" ViewCount="399" Body="&lt;p&gt;I need to know what is iteration and divergence in anisotropic diffusion filter technique.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;Isotropic diffusion&lt;/strong&gt; $$\frac{\partial I(x, y, z)}{\partial t}={\rm div}\left[c\cdot \nabla I\left(x, y, z\right)\right], \quad&#xA;\text{where } c \text{ is the diffusion coefficient}$$&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;Anisotropic diffusion&lt;/strong&gt; $$\frac{\partial I(x, y, z)}{\partial t}={\rm div}\left[g\left(\left\| I\left(x, y, z\right)\right\|\right)\cdot \nabla I\left(x, y, z\right)\right], \quad \text{where } g \text{ is the anisotropic diffusion coefficient }\textbf{(Edge stopping function)}$$&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Here $t$ refers to iteration, what is this iteration ? How is it related to filtering ? I know that iteration refers to number of rounds but how it is related with filtering ?&lt;/li&gt;&#xA;&lt;li&gt;Also explain to me why we use divergence in these equation what is the purpose of divergence. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8051" LastEditorUserId="37293" LastEditDate="2018-08-19T16:00:04.307" LastActivityDate="2020-01-11T23:02:15.283" Title="Anisotropic Diffusion Filter - Intuition Behind Parameters" Tags="|image-processing|filtering|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14659" PostTypeId="1" CreationDate="2014-02-25T13:25:05.540" Score="1" ViewCount="648" Body="&lt;p&gt;I'm trying to program a spectrum analyser in C++ but I'm faced with a conceptual problem : how to map the results of the FFT to an image ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me detail : &#xA;I'm doing all this in a dynamic way.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have chunks of audio data as float [-1;1] arriving to my class.&lt;/li&gt;&#xA;&lt;li&gt;I put them in a circular buffer which has the same size as my FFT window&lt;/li&gt;&#xA;&lt;li&gt;I apply a Hann(ing) windowing function&lt;/li&gt;&#xA;&lt;li&gt;I apply an FFT to the result. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This part works great. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the result of my FFT is a two dimensional array (my library automatically does the sqrt(re^2 + im^2) part) with bin indexes and amplitudes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to draw this result from time to time into a window. The problem is, the window has way less pixels than there are bins (if my buffer size is 65536, I have 32768 bins), so I have to do some kind of &quot;averaging&quot;. &#xA;I could do a mean, a root square mean, take the maximum, etc etc ... I have no idea what is the best method to use ? The application of this will be music, more specifically, detect frequency masking by plotting several semi-transparent sepectrums on the top of each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice on a good way to do that would be much appreciated&lt;/p&gt;&#xA;" OwnerUserId="710" LastActivityDate="2014-02-25T16:41:46.693" Title="Spectrum analysis : how to represent FFT results" Tags="|fft|frequency-spectrum|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14660" PostTypeId="2" ParentId="14659" CreationDate="2014-02-25T13:46:53.733" Score="1" Body="&lt;p&gt;Actually, what do the squared magnitude FFT result represent? They represent the total energy in a given frequency bin. So to downscale your results to less bands, you can sum them. It's not even necessary to average the results - however it would have the same effect, as you map the results to an image, thus rescaling them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, note that if you need to rescale by something else than an power of two, you'll need to do it using supersampling, as the results won't map directly to your new bins.&lt;/p&gt;&#xA;" OwnerUserId="5779" LastEditorUserId="5779" LastEditDate="2014-02-25T14:07:19.380" LastActivityDate="2014-02-25T14:07:19.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14662" PostTypeId="2" ParentId="14560" CreationDate="2014-02-25T14:35:58.830" Score="1" Body="&lt;p&gt;A good answer is posted at &lt;a href=&quot;https://mathematica.stackexchange.com/questions/42825/understanding-bilinear-imageresize/42842?noredirect=1#42842&quot;&gt;https://mathematica.stackexchange.com/questions/42825/understanding-bilinear-imageresize/42842?noredirect=1#42842&lt;/a&gt;, the &lt;em&gt;Mathematica&lt;/em&gt; StackExchange site.&lt;/p&gt;&#xA;" OwnerUserId="7989" LastEditorUserId="-1" LastEditDate="2017-04-13T12:55:35.443" LastActivityDate="2014-02-25T14:35:58.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14663" PostTypeId="2" ParentId="14656" CreationDate="2014-02-25T15:03:26.570" Score="0" Body="&lt;p&gt;Given that you have removed all signal content above 10 Hz, your 20 Hz sample rate will be identical to the minimum sample rate based on the Nyquist sampling criterion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you instead use 5 Hz, you can only represent a bandwidth of 2.5 Hz and, e.g., a signal appearing to be at 2 Hz might have been a 3, 7 or 8 Hz signal as well (meaning that you can not distinguish between a signal at any of those frequencies after the downsampling). This is caused by aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using 60 Hz would be clearly feasible but will consume more storage of the signal. The possible benefit might be that later processing may be simpler as the signal does not cover the whole signal band. However, this depends on which processing is required later. Also, while the processing in itself may be simpler, there are more samples to operate on so the total complexity may not be reduced.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-02-25T15:03:26.570" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14664" PostTypeId="2" ParentId="14656" CreationDate="2014-02-25T15:33:28.583" Score="0" Body="&lt;p&gt;By saying you sample your signal,you actually convolve it with a train of impulses spaced apart by Ts (1/f).That results in MULTIPLE COPIES of your signal in the frequency domain.&#xA;That multiple copies could possibly create problems,resulting of that change in the sampling frequency (you may dont care about that but you may be asked in the future).If the sampling rate is reduced (downsampling) then this copies will EXPAND,(and may overlap with each other) if the sampling rate is increased (up sampling) this will shrink.&#xA;Now,the limit where you will not have them overlapping is the fundamental frequency range (+-fs/2).That is derived by the Niquist criterion,for sampling and that is why it &quot;should&quot; be kept the frequency range within this limits.&lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-02-25T15:33:28.583" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14665" PostTypeId="2" ParentId="14659" CreationDate="2014-02-25T16:41:46.693" Score="1" Body="&lt;p&gt;There are many ways to map an FFT spectrum to an image for musicians.  Weighted sums of FFT magnitudes based on the frequency response or frequency discrimination bandwidths of the human ear.  MIDI note width overlapping triangular windows (logarithmic with frequency in size).  Etc.  Usually of the log magnitude, but other scales are used as being better mappings to human loudness perception curves.  Books and research papers on audiology and the psychology of music or hearing publish tons of these curves.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-25T16:41:46.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14666" PostTypeId="2" ParentId="14658" CreationDate="2014-02-25T20:37:06.733" Score="0" Body="&lt;p&gt;Divergence is a differential operator, something like derivation. It can be approximated by a filter. It measures if a vector field is a ,,sink'' or a ,,source'' in a given locus.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-25T20:37:06.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14667" PostTypeId="1" CreationDate="2014-02-26T01:51:05.087" Score="8" ViewCount="1991" Body="&lt;p&gt;I know that all periodic continuous time signal have discrete spectral representations, but are all discrete spectral representations periodic in continuous time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, can all periodic signals be represented by a fourier series?&lt;/p&gt;&#xA;" OwnerUserId="8057" LastEditorUserId="128" LastEditDate="2018-08-19T19:58:52.190" LastActivityDate="2022-05-27T03:43:02.680" Title="Continuous Time Signal and Discrete Time Signal - Connection Between Periodicity and Discretness" Tags="|discrete-signals|continuous-signals|frequency-domain|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14669" PostTypeId="1" CreationDate="2014-02-26T03:57:23.550" Score="0" ViewCount="133" Body="&lt;p&gt;I have a periodic term $V(x) = \sum_K  \exp(iKx) V_K$ where $K =2\pi n/a$ where $a$ is the periodicity of the term and $n =0,1,2,3....$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to find the Fourier coefficient $V_K$ corresponding to a particular $K$. Suppose I have a vector for $V(x)$ having $10000$ points for $x = 0,0.01a,0.02a,...a,1.01a,....2a....100a$ such that the size of my lattice is $100a$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT on this vector gives $10000$ Fourier coefficients. The $K$ values corresponding to these Fourier coefficients are $2\pi n/(10000*0.01a)$ with $n=0,1,2,3,...9999$. But my $K$ had the form $2\pi n/a$ due to the periodicity of the lattice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing ?&lt;/p&gt;&#xA;" OwnerUserId="8060" LastEditorUserId="7396" LastEditDate="2014-02-28T16:47:56.577" LastActivityDate="2014-02-28T16:47:56.577" Title="discrete fourier transform in Matlab - theoretical confusion" Tags="|matlab|fft|fourier-transform|dft|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14670" PostTypeId="2" ParentId="14667" CreationDate="2014-02-26T04:03:58.253" Score="0" Body="&lt;p&gt;Yes, all periodic signals can be represented by the Fourier Series, and the discrete time signals have periodic spectra (you can try this by applying DFT or FFT for a discrete time signal in MATLAB). The reason for this is you are trying to find the coefficients $X(e^{j \;\omega})$ using the formula for a DFT which has the term $\exp{(\dfrac{-j2\pi k n}{N})}$, because of which you can find periodicity in the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="7926" LastEditorUserId="8202" LastEditDate="2014-05-16T22:20:36.210" LastActivityDate="2014-05-16T22:20:36.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14671" PostTypeId="1" AcceptedAnswerId="14686" CreationDate="2014-02-26T06:34:57.600" Score="0" ViewCount="1980" Body="&lt;p&gt;I'm trying to do time-series prediction with dynamic recurrent networks in Matlab (will try at least NARX and LRN architectures, if not one or two others). The question I have is, what is the functional difference between giving a network multiple inputs, versus giving it an input vector with multiple elements?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My inputs are values from multiple sensors. Can I create a single matrix (say, a 3xN matrix for 3 sensors that recorded N time steps), run 'con2seq' and use that as a single input to the network? What is the functional difference between doing that versus formatting it as 3 different sequential inputs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand it, each value (each row within the 3xN matrix, or alternatively each of the 3 single-row inputs) will get its own weight to every layer 1 neuron. Is that correct? What's the difference between the two options, then? Is the only purpose of creating multiple inputs for the case where you want to send some inputs to one subset of layers and other inputs to a different subset of layers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading the first third of the Neural Network Toolbox User Guide, I looked around on here, stackexchange, and google with luck. Everyone says, &quot;net.inputs{K}.size is the dimension of input K, while net.numInputs is the number of inputs,&quot; which is tautological more than clarifying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks much for your help!&lt;/p&gt;&#xA;" OwnerUserId="8062" LastActivityDate="2014-02-26T20:00:02.677" Title="Matlab Neural Networks: input size vs. number of inputs" Tags="|matlab|discrete-signals|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14672" PostTypeId="2" ParentId="14551" CreationDate="2014-02-26T07:47:04.473" Score="1" Body="&lt;p&gt;Looking at your various comments with other answers, let me see if I can restate your question, and you can tell me if that's correct. You have a sensor and are modelling the output to include noise with mean=zero and unknown variance (your wording makes it sound as though variance is also zero). You asked if zero mean noise implies that signal variance describes the magnitude of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to be clear: you are talking about the variance of the &lt;em&gt;noise&lt;/em&gt;, correct, not the variance of the signal? I will assume you meant noise variance, and also that variance of the noise is non-zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the noise has mean=0, that means that the noise is a random signal centered on the true value. If you think about noise as a signal that wiggles randomly through time across some limited range, we can say that the center of this range is equal to the true value of the sensor. The variance of the noise, then, describes how far from the true value this wiggling signal goes - how far away from the true value these random perturbations go. If you look at the true (noise-free) value and the noise separately, the noise would wiggle randomly around the zero line while the true value is whatever its values are. The values that the true value can take on (how much true value moves around, a.k.a. its variance) is entirely independent of the noise's variance (how much noise moves around).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, if noise had a non-zero mean, it would create a bias or an offset to your true value (so, if noise had mean=1 in your example, then your recorded values would be 3.19, 2.97, 3.04...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you say error of +/- 0.2, do you mean that 0.2 is the variance, the standard deviation, or the maximum amount from the true value by which the readout value can deviate? If it's the maximum error, then simulating it as you do with &quot;0.2*noise&quot; will give about 35% of the values outside of the range [-0.2, 0.2], because that doesn't set a hard limit on what the values can be. Taking your &quot;noise&quot; vector and multiplying it by 0.2 makes it into a vector with mean=0 and standard-deviation=0.2 (before multiplying by 0.2, it was mean=0 and stddev=1). If std=0.2, then 65% of your values will be in the range [-0.2, 0.2]. If you want &lt;em&gt;all&lt;/em&gt; values to be within [-0.2, 0.2], use 0.2/4 or 0.2/5 as your multiplier - there will still be a few outliers, but it will be 1 out of 1,000 values instead of 1 out of 3.&lt;/p&gt;&#xA;" OwnerUserId="8062" LastActivityDate="2014-02-26T07:47:04.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14675" PostTypeId="2" ParentId="14523" CreationDate="2014-02-26T08:53:06.237" Score="9" Body="&lt;p&gt;When you say that the &quot;information content may remain the same,&quot; do you mean the information in the total signal, or the information of the desired signal? Hopefully this will answer both cases. I know Shannon entropy much better than Kolmogorov so I'll use that, but hopefully the logic will translate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say $X = S + N$ is your total signal ($X$), comprised of the sum of your desired signal $S$ and your noise component $N$. Let's call entropy $H$. As you said, noise adds entropy to a system by increasing its complexity. However, it's not necessarily only because we're more uncertain about the &lt;em&gt;information content&lt;/em&gt; of the signal, but because there's more uncertainty in the signal overall. If SNR kind of measures how certain we are of what $S$ is, then $H(X)$ kind of measures how well we can predict future states of $X$ based on the current state of $X$. Entropy is concerned with how complex the whole signal is, regardless of the composition of noise vs. non-noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you increase SNR by removing noise (attenuating $N$), you decrease the total signal $X$'s complexity and thus its entropy. You haven't lost any information carried by $S$, only (presumably meaningless) information carried by $N$. If $N$ is random noise, then obviously it doesn't carry meaningful information, but it takes a certain amount of information to describe $N$'s state, determined by the number of states that N can be in, and the probability of it being in each of those states. That's the entropy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can look at two Gaussian distributions with different variances, say one has a variance of $1$ and the other has a variance of $100$. Just looking at the equation for a Gaussian distribution, we see that the $Var=100$ distribution has a maximum probability that is only $\frac {1} {10}$th the value of the $var=1$ distr's probability. Conversely, this means that there is greater probability that the $Var=100$ distr will take values other than the mean, or that there is more certainty that the $Var=1$ distribution will take values near the mean. So, the $Var=1$ distribution has a lower entropy than the $Var=100$ distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We established that higher variance implies higher entropy. Looking at error propagation, it is also true that $Var(X+Y) &amp;gt;= Var(X) + Var(Y)$ (equal for independent $X$, $Y$). If $X = S + N$, then for entropy $H$, $H(X) = H(S+N)$. Since $H$ is (indirectly) a function of variance, we can fudge things a little to say $H(Var[X]) = H(Var[S+N])$. To simplify, we say $S$ and $N$ are independent, so $H(Var[X]) = H(Var[S] + Var[N])$. Improved SNR often means attenuating noise power. This new signal with higher SNR will then be $X = S + (\frac {1} {k})N$, for $k&amp;gt;1$. Entropy then becomes $H(Var[X]) = H(Var[S] + (1/k)^2*Var[N])$. $k$ is greater than $1$, so $Var[N]$ will decrease when N is attenuated. If $Var[N]$ decreases, so does $Var[S+N]$, and therefore $Var[X]$, resulting in a decrease in $H(X)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not very concise, sorry. In short, $X$'s entropy decreases if you increase SNR, but you've done nothing to $S$'s information. I can't find the sources right now, but there's a method to calculate SNR and mutual information (a bivariate measure similar to entropy) from each other. Maybe the main takeaway is that SNR and entropy don't measure the same thing.&lt;/p&gt;&#xA;" OwnerUserId="8062" LastEditorUserId="7092" LastEditDate="2014-02-26T16:15:44.590" LastActivityDate="2014-02-26T16:15:44.590" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="14679" PostTypeId="1" AcceptedAnswerId="14681" CreationDate="2014-02-26T13:21:53.993" Score="1" ViewCount="1142" Body="&lt;p&gt;How does the &lt;a href=&quot;https://en.wikipedia.org/wiki/Non-local_means&quot; rel=&quot;nofollow noreferrer&quot;&gt;Non Local Means Filter&lt;/a&gt; different from other approaches such as:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_blur&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian Smoothing&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Total_variation_denoising&quot; rel=&quot;nofollow noreferrer&quot;&gt;Total Variation Denoising&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8066" LastEditorUserId="128" LastEditDate="2017-09-14T10:54:05.093" LastActivityDate="2017-09-14T10:54:05.093" Title="Non Local Means Filtering Technique Compared to Gaussian Blur and Total Variation Denoising" Tags="|image-processing|matlab|denoising|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14680" PostTypeId="1" CreationDate="2014-02-26T13:56:41.107" Score="3" ViewCount="1284" Body="&lt;p&gt;I came across a paper that is trying to classify and detect object(s) present in what they call a &lt;em&gt;natural scene data-set&lt;/em&gt;. They have images containing objects like cars, bikes and people.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me how this is different from other data-sets that contain the images of cars/bikes/people?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The site with the data-sets I am interested in is: &lt;a href=&quot;https://lear.inrialpes.fr/people/marszalek/data/ig02/&quot; rel=&quot;nofollow&quot;&gt;Natural Scene Database&lt;/a&gt;.&lt;br&gt;&#xA;For comparison, the &lt;a href=&quot;http://www.vision.caltech.edu/html-files/archive.html&quot; rel=&quot;nofollow&quot;&gt;Caltech Computational Vision&lt;/a&gt; data-set also contains cars and bikes from the rear and side view (with less background).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know what is so special about the &lt;em&gt;natural image data-set&lt;/em&gt; compared to the standard data-sets containing various viewpoints of cars/bikes from these set of images? Why would this &lt;em&gt;natural image data-set&lt;/em&gt; be a bigger callenge in object detection?&lt;/p&gt;&#xA;" OwnerUserId="6941" LastEditorUserId="1273" LastEditDate="2014-02-28T10:37:34.987" LastActivityDate="2014-05-21T06:17:45.217" Title="What does natural scene image data-set mean?" Tags="|image-processing|computer-vision|classification|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14681" PostTypeId="2" ParentId="14679" CreationDate="2014-02-26T15:02:35.483" Score="2" Body="&lt;p&gt;Gaussian smoothing and TV denoising are local filters that only consider the neighborhood around each target pixel; on the other hand, non-local means updates a pixel's value by using a weighted average of the pixels judged to be most similar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why it is called non-local is because it does not consider the spatial relationship between pixels, instead, the similarity between different patches and the patch around the target pixel is computed to determine the weight mentioned above (inversely proportional to the distance between its patch and the reference patch of the target pixel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet some studies also showed that &lt;a href=&quot;http://arxiv.org/abs/1311.3768&quot; rel=&quot;nofollow&quot;&gt;Non-Local means is a local image denoising algorithm&lt;/a&gt;, in which experimental results indicated that the bias of the non local means estimator is an increasing function of the radius of the similarity searching zone (patch).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The paper (&lt;a href=&quot;http://123seminarsonly.com/Seminar-Reports/029/42184313-10-1-1-100-81.pdf&quot; rel=&quot;nofollow&quot;&gt;A.Buade et al's On image denoising methods&lt;/a&gt;) provided more detailed comparisons between non local means and Gaussian, TV from the aspect of (1) the method noise, (2) the mean square error, and (3) the visual quality of the restored images by simulation. You can skip the theoretical part by reading section 6 for a brief conception of the effect of those methods, which may also be helpful in better understanding the meaning of those mathematical formulas in previous sections.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-26T15:09:50.773" LastActivityDate="2014-02-26T15:09:50.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14683" PostTypeId="1" AcceptedAnswerId="14685" CreationDate="2014-02-26T18:08:52.833" Score="4" ViewCount="7124" Body="&lt;p&gt;I'm finding some difficulties to understand the difference between &lt;a href=&quot;http://en.wikipedia.org/wiki/Filter_%28signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;Filters&lt;/a&gt;, and &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;Windowing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;accoriding to my understanding both filters and window functions will make changes to the input signal parameters, according to wiki,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Filter:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;a filter is a device or process that removes from a signal some unwanted component or feature&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Windowing:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;a window function (also known as an apodization function or tapering function[1]) is a mathematical function that is zero-valued outside of some chosen interval.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to understand is this,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Where do we use these windowing functions &amp;amp; Filters in practical world?&lt;/li&gt;&#xA;&lt;li&gt;Do I need to use both for better signal quality, if so which one come first(&lt;code&gt;Filters&lt;/code&gt; =&gt; &lt;code&gt;Window&lt;/code&gt; or &lt;code&gt;Window&lt;/code&gt; =&gt; &lt;code&gt;Filters&lt;/code&gt;)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3569" LastActivityDate="2021-03-09T07:24:52.947" Title="What is the difference between Filters and Windowing?" Tags="|filters|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14684" PostTypeId="2" ParentId="14667" CreationDate="2014-02-26T18:09:14.100" Score="2" Body="&lt;p&gt;I get into fights occasionally at the USENET newsgroup &lt;em&gt;comp.dsp&lt;/em&gt; regarding the inherent nature of the DFT. But I'll repeat it here:&lt;/p&gt;&#xA;&lt;p&gt;Anytime one uniformly samples a continuous function in one domain, it makes it representable as a discrete function in that domain and it causes periodicity in the reciprocal domain.  And anytime one makes a function periodic in one domain, it causes it to be discrete (appearing as uniformly sampled) in the reciprocal domain.  that is always the case.&lt;/p&gt;&#xA;&lt;p&gt;The thing that gets me in trouble with some of my peers (but not with the math, I'm quite comfortable with the DFT math) is that I (and not just me) concluded that the DFT transforms one discrete and periodic function (with period &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;) in one domain to another discrete and periodic function (having the same period &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;) in the reciprocal domain. But in both domains, the periodic function is discrete, so it is fully described with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; numbers in either domain.&lt;/p&gt;&#xA;&lt;p&gt;This means that the DFT effectively periodically extends the data passed to it.  you pass to the DFT (or FFT) &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples, and the DFT will treat it as if it were one period of a periodic function. The DFT is essentially the same as the DFS.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="7092" LastEditDate="2022-05-26T20:54:46.943" LastActivityDate="2022-05-26T20:54:46.943" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14685" PostTypeId="2" ParentId="14683" CreationDate="2014-02-26T19:04:55.280" Score="5" Body="&lt;p&gt;Filters and windows complement each other, in a way. This is due to the convolutional lemma of the fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me expand on that. A filter would be a convolution of a signal with another. In a technical sense, a window has a fixed (supposedly short) size and is seen as &quot;cutting out&quot; a short part of the signal. Often, a DFT would follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the fourier domain, convolution and point-wise multiplication trade places, so a convolution in the time domain is a pw. multiplication in the fourier domain and vice-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A filter scales the spectrum with a known frequency response. A window will filter the spectrum instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filters and window functions often (but not always) have different design goals. For example, in a filter you would have rather large bandwidths. Windows percieved as useful have a small bandwidth (often, just a few samples). You can talk about both kinds in the same terms, you just have to remember that both are used in different contexts.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-02-26T19:04:55.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14686" PostTypeId="2" ParentId="14671" CreationDate="2014-02-26T20:00:02.677" Score="1" Body="&lt;p&gt;This question is better fit in stackoverflow or cross validated site, yet I am trying to illustrate a simple example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you have three measurements $a$, $b$, and $c$, with each measurement only $1$ time reading, the hidden layer node and output are scalar. Compose an input vector is shown below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        w1 &#xA;(a,b,c) =&amp;gt; (H1)-------(O1) =&amp;gt; Result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The value at output layer is $ \alpha ((a+b+c)w_1)$, where $\alpha$ is the activation function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you treat the measurements separately at the input layer, the neural network is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  w1 &#xA;a =&amp;gt; &#xA;     \&#xA;  w2                &#xA;b =&amp;gt; (H1)----------(O1) =&amp;gt; Result&#xA;     /                &#xA;  w3                &#xA;c =&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the output is $ \alpha (aw_1 + bw_2 + cw_3)$. Now you are dealing with three independent neurons, which indicates that updating one of the weights won't change the 'learned' weights on other input nodes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, a single neuron usually take in scalars rather than vector values (for the case of one time reading), or take in vectors rather than matrix arrays (for the case of a series of time readings).&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-26T20:00:02.677" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14687" PostTypeId="2" ParentId="13703" CreationDate="2014-02-26T20:21:54.653" Score="-1" Body="&lt;p&gt;I'm assuming that you have got your roll-off from somewhere else Kiran, you say it is set but not how.  Not sure how the Matlab function defines filter span ( samples or symbols ) but you usualy get nicer spectra and eye diagrams if you choose a span where at least one of the end points is a zero.&lt;/p&gt;&#xA;" OwnerUserId="8070" LastActivityDate="2014-02-26T20:21:54.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14688" PostTypeId="1" CreationDate="2014-02-26T20:56:31.920" Score="2" ViewCount="77" Body="&lt;p&gt;I have three vectors, $x[n]$, $w[n]$, and $z[n]$. I need to compute:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = z[n] * \Big(x[n] \cdot w[n] \Big)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is easy to do. However, is there a way I can do this by 'opening' up the bracket? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let us say that I am already given $z[n] * x[n]$. If this was the starting point, what could I do with this and with the three already given vectors to get $y[n]$? The &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt; on convolution properties does not seem to have a case for a scenario like this.&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2014-02-27T16:55:46.110" Title="Is it possible to open up this particular convolution equation?" Tags="|filters|convolution|fourier|matched-filter|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14690" PostTypeId="1" CreationDate="2014-02-26T22:15:04.243" Score="1" ViewCount="168" Body="&lt;p&gt;I have one question concerning phase rotation of signals and I am not sure wether it works or not:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume we have a zero-phase wavelet x(t) i.e. Ricker wavelet. &#xA;Unfortunately, in our experiment, the wavelet y(t) we use is not zero phase anymore but rotated by an phase angle $\Psi$. Yet, we still can clearly identify the peak of the wavelet at x(T).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;Is it possible to derive the position of the peak of the corresponding zero-phase wavelet $x(t)$ from $y(\tau)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first steps are:&#xA;1) equation Ricker wavelet: &#xA;$$&#xA;x(t)=(1-2 \pi^2 f^2 t^2) e^{-\pi^2 f^2 t^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) equation rotated Ricker wavelet&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(\tau)=(1-2 \pi^2 f^2 \tau^2) e^{(-\pi^2 f^2 \tau^2 - \Psi \tau)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My assumption was setting $y(t) = x(t)$ and solve for $t$ since $\tau,f,\Psi$ are known. Unfortunately the amplitude of the wavelet changes with the phase rotation.&#xA;How can I account for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;please help!&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2014-02-26T22:15:04.243" Title="Derive Maximum of zero phase rotated wavelet from rotated wavelet" Tags="|wavelet|phase|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14691" PostTypeId="1" CreationDate="2014-02-26T23:58:17.563" Score="4" ViewCount="2268" Body="&lt;p&gt;I have frequency response data. It is output from an acoustic simulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I convert this into an impulse response, and get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zbx9T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that picture the blue line is the impulse response. Mostly it is hiding behind the green line (which is the impulse response if I halve the frequency resolution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sorry for an unclear picture. I will replace it in due course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, the thing I notice of interest is that if the impulse response is regarded as a loop, the ends appear to match up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any mathematical basis for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems strange to me that the impulse response is somehow non-causal.  Because what it is modelling is a single pressure wave hitting a microphone.  Commonsense suggests to me that it should have a very sharp attack as the main wave hits followed by diminishing ripples corresponding to echoes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm quite surprised to see ripples before the main spike, let alone before t=0, as it were.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this some artefact of the FFT due to the fact that it is forced to sample at discrete intervals, therefore the spike cannot be completely accurate, and maybe the preceding wobbles are compensating for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In which case would I do better to reposition the start of the impulse response 100 samples in from the end, and have it wrap round?&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2014-04-07T19:50:03.083" Title="Frequency response creates non-causal impulse response" Tags="|fft|impulse-response|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14692" PostTypeId="1" CreationDate="2014-02-27T03:22:21.410" Score="3" ViewCount="276" Body="&lt;p&gt;I heard from someone online who said: &quot;Only random signal has PSD, determinate signal does not have. For example, period signal does not have PSD.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am very astonishing about this statement, but it seems he is quite sure about his idea. In my opinion, both random signal and determinate signal have PSD, and it is the Fourier transform of the autocovariance of the signal. However, only stationary random and period signal have stable PSD. Am I right?&lt;/p&gt;&#xA;" OwnerUserId="7602" LastActivityDate="2016-12-22T09:15:40.797" Title="Only random signal has PSD?" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14693" PostTypeId="1" CreationDate="2014-02-27T04:01:43.933" Score="1" ViewCount="207" Body="&lt;p&gt;Assume the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;img = 255*rand(512); %Generating a 2D matrix with random numbers between 0 to 255.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VSwhS.jpg&quot; alt=&quot;2D matrix with random values&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fftimg = abs(fft2(img)); %FFT of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6RyJH.jpg&quot; alt=&quot;FFT of the above image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency transform of this image is a single high value at the top left corner of the image. This means the 'energy' or the frequency response is the highest and concentrated at the lowest frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you explain why this happens?&lt;/p&gt;&#xA;" OwnerUserId="8008" LastActivityDate="2014-02-27T13:02:52.913" Title="What's the frequency transform of a random matrix?" Tags="|matlab|fft|image-processing|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14694" PostTypeId="2" ParentId="14693" CreationDate="2014-02-27T04:50:24.767" Score="3" Body="&lt;p&gt;That is the DC offset (at zero frequency).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = 255*randn(512);  % thanks @Jason's comment&#xA;img1=img-mean(img(:));&#xA;fftimg = abs(fft2(img1));&#xA;imagesc((fftshift(fftimg)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives you the spectrum of the normal distribution image. Note that white noise is flat in the frequency domain, but the Gaussian noise in the time domain is still Gaussian in the frequency domain. You may need to average a large number of FFTs of white noise to approach the average power spectral density.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-02-27T13:02:52.913" LastActivityDate="2014-02-27T13:02:52.913" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14695" PostTypeId="1" AcceptedAnswerId="14716" CreationDate="2014-02-27T06:33:22.023" Score="1" ViewCount="1574" Body="&lt;p&gt;I have a continuous signal,xc(t) which is bandlimited to =pi/T ,&#xA;and x[n] = xc(nT) are samples of this signal.&#xA;I need to show there is a Parseval's relation between the original signal and the sampled version.That is I need to prove that energy will be conserved!&#xA;Can anyone please help?&lt;/p&gt;&#xA;" OwnerUserId="7842" LastActivityDate="2014-02-28T15:55:16.637" Title="How to prove energy is preserved in sampling using Parseval's Relation?" Tags="|sampling|dsp-core|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14696" PostTypeId="2" ParentId="14691" CreationDate="2014-02-27T06:45:30.610" Score="1" Body="&lt;p&gt;If you don't have the frequency response's phase data, only the magnitudes, then the impulse response from an IFFT will likely be skewed and/or smeared (circularly) in time from whatever the original waveform was.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-27T06:45:30.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14698" PostTypeId="2" ParentId="14680" CreationDate="2014-02-27T09:46:24.150" Score="2" Body="&lt;p&gt;From one perspective, not much. However, biological perceptual systems have evolved in response to physical properties of natural environments. And such environments possess certain characteristics, such as Laplacian distribution shaped histograms. Therefore natural images are grouped and analyzed together.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-02-27T09:46:24.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14699" PostTypeId="1" CreationDate="2014-02-27T10:03:13.590" Score="0" ViewCount="1710" Body="&lt;p&gt;I'm trying to obtain the overall LTAS of a large batch of audio (wav) files. To do this, I should obtain the LTAS of each file individually, then take the average value across all LTASs for each frequency. I also need the standard deviation for each frequency. I'm doing this in Matlab, but am rather a noob. Can anyone offer any pointers to help me write a Matlab script to do this? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8076" LastActivityDate="2020-01-30T21:10:32.450" Title="Long Term Average Spectrum of large batch of audio files" Tags="|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14701" PostTypeId="2" ParentId="14691" CreationDate="2014-02-27T11:54:30.393" Score="1" Body="&lt;p&gt;You need to calculate more frequency points and then use a larger IFFT.  Even though the room simulator calculates the response in the frequency domain, there is an underlying room impulse response that has a certain length. If your IFFT is not large enough to accommodate this length then you will get the type of wrap- around that you are seeing. &#xA;You could also consider this to be a form of aliasing, only going from frequency to time rather than the more usual approach of going from time to frequency. Consider a room with a single long reflection. The frequency response will have periodic wiggles that are spaced by 1/Tdelay. You need to sample these wiggles with at least 2 points per wiggle, which is another way of saying that the IFFT length has to be at least Tdelay long. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bob&lt;/p&gt;&#xA;" OwnerUserId="7453" LastActivityDate="2014-02-27T11:54:30.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14702" PostTypeId="2" ParentId="13703" CreationDate="2014-02-27T12:09:02.263" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;Lower rolloff means less excess-bandwidth and therefore longer time span.&#xA;That is, you will need a longer filter to accurately reproduce the ideal RRC filter response (increases implementation complexity)&lt;/li&gt;&#xA;&lt;li&gt;Longer filter means more accurate RRC filter and potentially lower ISI at the receiver side (depends on your target SNR)&lt;/li&gt;&#xA;&lt;li&gt;Longer filter means less noise out of band transmitted (infinite length filter would have zero power outside symbol-rate*(1+rolloff)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In practice, due to the above constraints, RRC filters are usually not designed by just truncating the ideal RRC impulse response. Either you multiply the impulse response with a window function or you directly optimize the filter coefficients for error and rejection.&lt;/p&gt;&#xA;" OwnerUserId="1082" LastActivityDate="2014-02-27T12:09:02.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14703" PostTypeId="1" CreationDate="2014-02-27T12:39:19.293" Score="3" ViewCount="17046" Body="&lt;p&gt;We often hear that &quot;convolution in time is the same as multiplication in frequency&quot;, and vice versa, that &quot;convolution in frequency is the same as multiplication in time&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in a typical windowing operation, we do a point-wise multiplication of a signal $x[n]$, with a window $w[n]$. This means that in the frequency domain, we are performing $X(f) * &#xA;W(f)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is the following: I wish to illustrate this for myself, but I am not sure what lengths FFTs to take, and what type of convolution to do. (Circular? Linear? etc). Those details seem to be missing from all sources I look at. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you want to do convolution in the frequency domain, what lengths FFT do I pick to compute $X(f)$ and $W(f)$, and what type of convolution am I doing? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2014-03-02T14:49:02.573" Title="Convolution in the frequency domain" Tags="|frequency-spectrum|convolution|frequency-response|window-functions|frequency-domain|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14704" PostTypeId="2" ParentId="14703" CreationDate="2014-02-27T13:36:34.857" Score="2" Body="&lt;p&gt;the FFT is a fast method of doing the DFT.    yes, multiplication in one domain corresponds to convolution in the reciprocal domain.  and since the DFT is a totally circular operation, any consequential convolution done in one domain by the DFT by multiplication in the other domain is circular convolution.  you don't have a choice about it.  to make a circular convolution look like linear convolution, you must zero-pad sufficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how many zeros to pad?  need to consider how fast convolution (overlap-add or overlap-save) works.  if $N$ is the DFT length, the non-zero lengths of the two sequences being convolved, must not add to more than $N+1$ otherwise there will be overlapping and aliasing of non-zero components.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-03-02T14:49:02.573" LastActivityDate="2014-03-02T14:49:02.573" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14705" PostTypeId="1" AcceptedAnswerId="14729" CreationDate="2014-02-27T15:14:14.167" Score="1" ViewCount="96" Body="&lt;p&gt;I may have a potential application where maximizing the mode (as opposed to typically minimizing the variance) would be useful for state estimates. The situation may arise from skewed distributions where the mode is of more interest than the mean. I was wondering if anyone has seen a filter like this before? Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Josh&lt;/p&gt;&#xA;" OwnerUserId="8079" LastEditorUserId="128" LastEditDate="2017-09-27T10:30:37.540" LastActivityDate="2017-09-27T10:30:37.540" Title="Analogous filter to Kalman that maximizes mode (as opposed to minimizing variance)" Tags="|filters|kalman-filters|estimation|maximum-a-posteriori-estimation|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14706" PostTypeId="2" ParentId="14688" CreationDate="2014-02-27T16:55:46.110" Score="1" Body="&lt;p&gt;Here is a re-write of a previously mistaken answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us write $y[n] = z[n] * \Big(x[n] \cdot w[n] \Big) = \displaystyle\sum_{m=-M}^{M} {z[n-m] \cdot (x[m] \cdot w[m])}$ and rearrange as $y[n] = \displaystyle\sum_{m=-M}^{M} {(z[n-m] \cdot x[m]) \cdot (w[m])}$. After this point, we cannot take the terms out of the brackets.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-02-27T16:55:46.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14707" PostTypeId="1" AcceptedAnswerId="14710" CreationDate="2014-02-27T17:52:31.900" Score="2" ViewCount="530" Body="&lt;p&gt;I have a raster image (A) of size 20x20 and I want to scale it down to a size of 10x10 (B).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naturally in the resulting picture B one pixel will represent 4 pixels shaped 2x2 from A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to give a canonical answer to how the pixel values of B have to be calculated if no neighbouring pixels (surrounding the 2x2 subset) in A should be taken into account? Mean, maximum or something else?&lt;/p&gt;&#xA;" OwnerUserId="7507" LastActivityDate="2017-03-30T02:21:39.673" Title="Scaling down a raster image" Tags="|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14709" PostTypeId="2" ParentId="14703" CreationDate="2014-02-27T18:25:22.190" Score="1" Body="&lt;p&gt;For pointwise multiplication of two signals, they should have the same length, say N. Do the fft() with N, then circular convolution with N, then ifft(). There is a difference of a factor of N probably because of the 1/N difference between the definition of fft and ifft.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a=[1 2 3 4 5];&#xA;b=[4 5 6 7 8];&#xA;ifft( cconv(fft(a), fft(b), 5))&#xA;a.*b&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can deduce that you need circular conv in freq domain because, were it linear convolution, the result would be longer than N, but the pointwise multiplication is of length N.&lt;/p&gt;&#xA;" OwnerUserId="3511" LastActivityDate="2014-02-27T18:25:22.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14710" PostTypeId="2" ParentId="14707" CreationDate="2014-02-27T18:26:38.270" Score="4" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_interpolation&quot; rel=&quot;nofollow&quot;&gt;Bilinear&lt;/a&gt; is the most widely used method. The nearest neighbor down-sampling algorithm is the fastest but least accurate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that when you are trying to down-scale an image by half, the bilinear sampling algorithm becomes the average (mean as you mentioned):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x1[i/2][j/2] = (x[i][j] + x[i+1][j] + x[i][j+1] + x[i+1][j+1]) / 4;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-02-27T18:26:38.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14711" PostTypeId="2" ParentId="14699" CreationDate="2014-02-27T19:27:10.247" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;use &quot;wavread()&quot; to read the audio files &lt;/li&gt;&#xA;&lt;li&gt;use &quot;pwelch()&quot; to calculated the power spectrum of the songs&lt;/li&gt;&#xA;&lt;li&gt;you do energy averagin over multiple songs.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Something like this (just a code sketch)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nx = 8192; % that's about 5 Hz @44.1 kHz&#xA;dd = dir('*.wav'); % all files in the current directory&#xA;nFiles = length(dd);&#xA;LTAS = zeros(nx/2+1,nFiles)&#xA;for i = 1:nFiles&#xA;  x = wavread(dd(i).name);&#xA;  LTAS(:,i) = pwelch(x,hanning(nx),nx/2);&#xA;end&#xA;LTASOverAllSongs = mean(LTAS,2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="80" LastEditDate="2014-03-29T22:24:17.507" LastActivityDate="2014-03-29T22:24:17.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14713" PostTypeId="1" CreationDate="2014-02-28T04:01:13.153" Score="0" ViewCount="667" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4jwWY.jpg&quot; alt=&quot;hilbert-&amp;gt;fft-&amp;gt;cepstrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to find the fundamental frequency of a bearing fault.This is my code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c2=cceps(abs(Signal_fft_hilbert(2:250)));&#xA;plot(freq_s(2:250),c2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the cepstrum plot in the image. I have plotted the frequency instead of time. Is that right? And I am not able to identify which should be the fundamental frequency. Theoretically it should be somewhere around 100-123.but I am getting many prominent peaks.&#xA;Please help &lt;/p&gt;&#xA;" OwnerUserId="8085" LastEditorUserId="7092" LastEditDate="2014-02-28T04:40:00.717" LastActivityDate="2014-02-28T04:40:00.717" Title="cepstrum analysis to get fundamental freuquency" Tags="|matlab|frequency-spectrum|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14714" PostTypeId="1" AcceptedAnswerId="14715" CreationDate="2014-02-28T06:28:16.883" Score="10" ViewCount="23381" Body="&lt;p&gt;I need to implement a script for generating features from an input image by using the Gabor filter. I have no past experience of wavelets and I'm just learning Fourier analysis (I understand the basic idea behind Fourier analysis and transform) so they can't help me to understand Gabor filter, because I need to have an implementation done in a week. I don't need to understand the foundations of the Gabor filter function, but I would want to understand to some extent of what it is and what does it do. What are the parameters? What do they mean? What is the output of the function? For example this is the formula I copied from &lt;a href=&quot;http://en.wikipedia.org/wiki/Gabor_filter&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(x,y;\lambda, \theta, \psi, \sigma,\gamma) = \exp\left(-\frac{x'^2+\gamma^2 y'^2}{2\sigma^2}\right)\exp\left(i\left(2\pi\frac{x'}{\lambda}+\psi\right)\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my obvious question is: What does this mean? What does the variables mean? According to Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x, y$: I assume these coordinates specify the pixel value of an image at coordinates $(x,y)$ (&lt;strong&gt;2. This is OK, understood&lt;/strong&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lambda$: represents the wavelength of the sinusoidal factor &lt;strong&gt;(Sinusoidal factor, huh? 3a. How do you select it? 3b. Where does it come from? 3c. Is it an arbitrary number or what? Freely chosen?)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\theta$: represents the orientation of the normal to the parallel stripes of a Gabor function &lt;strong&gt;(4. What does that mean?)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\psi$: is the phase offset &lt;strong&gt;(5. offset of what? How is this value determined? Is it freely chosen?)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sigma$: is the sigma/standard deviation of the Gaussian envelope &lt;strong&gt;(6. Need more explanation...)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\gamma$: is the spatial aspect ratio, and specifies the ellipticity of the support of the Gabor function &lt;strong&gt;(7. Again need more details and more explanation)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And most importantly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(x,y;\lambda, \theta, \psi, \sigma,\gamma) = X$$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;8&quot;&gt;&#xA;&lt;li&gt;What is the output value $X$? What does it mean?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As I mentioned I don't need thorough explanation of the theory, because I bet it is long and reading a 1000 page book on unknown subject is not an option for me right now. I need to have have a black-box understanding of this function so that I can implement it in code and most importantly understand &lt;strong&gt;what is the input&lt;/strong&gt; and &lt;strong&gt;what is the output&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help!! =)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read this post:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://math.stackexchange.com/questions/259877/value-of-x-y-in-computing-gabor-filter-function&quot;&gt;https://math.stackexchange.com/questions/259877/value-of-x-y-in-computing-gabor-filter-function&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it doesn't answer my question thorough enough :) &lt;/p&gt;&#xA;" OwnerUserId="4378" LastEditorUserId="-1" LastEditorDisplayName="user18425" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2018-03-15T03:16:28.877" Title="Understanding the Gabor filter function" Tags="|image-processing|fourier-transform|gabor|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14715" PostTypeId="2" ParentId="14714" CreationDate="2014-02-28T10:06:37.673" Score="8" Body="&lt;p&gt;A matlab implementation is in this answer: &lt;a href=&quot;https://dsp.stackexchange.com/a/14201/5737&quot;&gt;https://dsp.stackexchange.com/a/14201/5737&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The wikipedia formula is a little bit too general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If you know the basics of the with Fourier transform then you empirically know that: The image is viewed as being formed by superimposing a series of sinusoidal waves of various frequencies oriented in all kind of directions. Each &quot;pixel&quot; in the transform tells us the &quot;intensity&quot; of such a wave. The position of the &quot;pixel&quot; tells us the frequency and orientation of the wave. In practice, one wants to select only certain waves, having a specific frequency and a specific orientation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there you have it: The Gabor transform is one of many so called band pass filters that allows you to &quot;cut&quot; the Fourier transform and isolate only specific information. Another important information is that each Fourier &quot;pixel&quot; is a complex value (real and imaginary part)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Parameters: Two parameters are already shown:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.a) The tuning frequency $f_0$, or tuning period $P_0$, or $\lambda$ establish to what kind of sinus wave the filter will respond best. ( $f = 1/P_0 = 1/\lambda$ or $f=\pi/\lambda$ depending on the specific implementation ) Basically, a smaller $P_0$ means a denser sinus wave. A larger $P_0$ means larger waves. $P_0$  is in pixels (3, 5, 30, etc. pixels) Don't go under 3 pixels or beyond $W/2$ or you get nasty effects. $W$ is the width of the image, if the image is square. You specify this using P0 parameter in the matlab code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.b) Central angle. These waves can have any directions. You want to select only waves at specific angle. So, the second parameter is the tuning angle, $\theta_0$ or $\theta$ in your formula. Usually, in radians. Orient in matlab code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One cannot isolate only a certain frequency or a certain orientation. (Search for uncertainty principle in the textbooks. Yes, is similar to the one in physics) But one can tune how much of the nearby frequencies will leak. The next two parameters specify that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.c) $\Delta F$, frequency bandwidth expressed in octaves. Usefull values, 1.5, 2, 3. Larger values means capturing a broader range of frequencies. There is a price for a tighter bandpass, a poorer spatial localization. Why, again, textbook. FBW in matlab code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.d) $\Delta \theta$ the angle bandwidth. Expressed in radians. $\pi/3$ or $\pi/2$ works just fine. ABW in matlab code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relation between $\Delta f$, $\Delta \theta$ from matlab code and $\sigma, \gamma$ from Wikipedia have a formula but is not essential for understanding Gabor. $\psi$ is again not important for basic understanding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have it: $X$ from Wikipedia is a 2D matrix of numbers containing a convolution mask. You take the original image, filter it with the convolution mask and get another image. This new image is the &quot;Gabor response&quot; for the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matlab code does these two steps together. Constructs the Gabor filter with the specified parameters and performs convolution. The results  ReConv,ImConv are the responses. Each  response &quot;pixel&quot; have a real and an imaginary part. If you want to use this code you usually must compute the energy for the response: $E = \sqrt{a^2+b^2}$ where $a$ is the real part of the response (ReConv) and $b$ is the imaginary part (ImConv), for each pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There you have it:&#xA;1) Build a Gabor filter specifying $P_0, \theta_0, \Delta f, \Delta \theta$&#xA;2) Convolute your image with the filter. You will get two values per each pixel.&#xA;3) Compute the energy $E$ and get the intensity of the response for each pixel in the original image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another intuition: Suppose you want to select edges stretching on an orientation perpendicular to $\pi/6$ and a certain width of 20 pixels. You can build a Gabor filter with $P_0 \approx 20, \theta_0 = \pi/6, \Delta f = 2, \Delta \theta = pi/2$. TAKE CARE that there is no equal relation between the dimension of your edge and the $P_0$ parameter. You should try various values and see what works best. The other parameters ($\Delta f, \Delta \theta$) touch them when you have some experience tuning the first two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cristi&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a site which allows you to play a bit with Gabor parameters and note the results: &lt;a href=&quot;http://www.cogsci.nl/pages/gabor-generator.php?option=com_content&amp;amp;view=article&amp;amp;Itemid=63&amp;amp;id=50&amp;amp;generate=yes&amp;amp;orient=45&amp;amp;size=96&amp;amp;env=gaussian&amp;amp;std=12&amp;amp;freq=0.1&amp;amp;phase=0&amp;amp;red0=128&amp;amp;green0=128&amp;amp;blue0=128&amp;amp;red1=255&amp;amp;green1=255&amp;amp;blue1=255&amp;amp;red2=0&amp;amp;green2=0&amp;amp;blue2=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cogsci.nl/pages/gabor-generator.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a quick look, both freqnency and angle bandwidths are tied together as &quot;Standard Deviation in pixels ... to the Gauss envelope&quot;. The rest of the parameters are easily identified. However, note that there are numerical differences! Eg. the phase can be expressed in 0-1 interval or 0-$\pi$ interval.&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-05-30T11:52:49.743" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14716" PostTypeId="2" ParentId="14695" CreationDate="2014-02-28T15:42:48.517" Score="2" Body="&lt;p&gt;Since your signal is band-limited, it has a representation in the orthogonal system of shifted sinc functions,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_c(t)=\sum_{n\in\Bbb Z} x_c(nT)\operatorname{sinc}\left(\tfrac tT-n\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\operatorname{sinc}(x)=\frac{\sin(\pi x)}{\pi x}=\int_{-1/2}^{1/2}e^{i2\pi fx}\,df$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the &lt;em&gt;Plancherel identity&lt;/em&gt; of the continuous Fourier transform this leads to &#xA;$$&#xA;\langle \operatorname{sinc}(x-m),\,\operatorname{sinc}(x-n)\rangle &#xA;=&#xA;\int_{-1/2}^{1/2}e^{i2\pi f(n-m)}\,df&#xA;=&#xA;\delta_{m,n},&#xA;$$&#xA; i.e., orthogonality of the unscaled functions. In the scaled variant above one gets, first by orthogonality and then by rescaling of the time parameter, the &lt;em&gt;Parseval identity&lt;/em&gt; for the orthonormal basis $\tfrac1{\sqrt{T}}\operatorname{sinc}(\tfrac tT-n)$, $n\in\Bbb Z$, of the space of band-limited functions,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\|x_c\|_2^2=\sum_{n\in\Bbb Z} |x_c(nT)|^2 \langle \operatorname{sinc}(\tfrac tT-n),\,\operatorname{sinc}(\tfrac tT-n)\rangle=T\,\sum_{n\in\Bbb Z} |x_c(nT)|^2&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="7396" LastEditorUserId="7396" LastEditDate="2014-02-28T15:55:16.637" LastActivityDate="2014-02-28T15:55:16.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14717" PostTypeId="1" CreationDate="2014-02-28T16:35:01.353" Score="-1" ViewCount="2858" Body="&lt;p&gt;I would like to get the bpm of a song analyzing the spectrum of the volume.&#xA;Doing a fft what I get is a peak at the origin and of course that can't be the frequency corresponding to the bpm, so I do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\overline{h} = h - \frac{1}{l}\sum_0^l h$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h$ is the fft of the volume and $l$ is the length of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I expect the bpm frequency to show up in the interval $[1 Hz,3Hz]$ but how can I recognize it?&lt;/p&gt;&#xA;" OwnerUserId="8093" OwnerDisplayName="user1584773" LastActivityDate="2014-03-30T19:57:24.310" Title="Getting bpm of song with fft" Tags="|fourier-transform|" AnswerCount="2" CommentCount="1" ClosedDate="2014-04-02T15:19:33.007" ContentLicense="CC BY-SA 3.0" />
  <row Id="14718" PostTypeId="2" ParentId="14717" CreationDate="2014-02-28T17:30:07.873" Score="1" Body="&lt;p&gt;Unless your FFT is very large you're not going to get much resolution in the range of interest since each FFT bin holds Fs/N Hz of spectrum. ( Fs = sample rate, N=FFT size).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have successfully got very accurate BPM values by using two FFT's in series and then picking the biggest peak in the region of interest in the final averaged spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IME this works well for signals with a reasonably prominent beat. e.g. typical modern pop &amp;amp; rock music. &lt;/p&gt;&#xA;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;" OwnerUserId="5780" LastEditorUserId="5780" LastEditDate="2014-02-28T19:25:08.257" LastActivityDate="2014-02-28T19:25:08.257" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14719" PostTypeId="1" CreationDate="2014-02-28T17:31:56.613" Score="5" ViewCount="1681" Body="&lt;p&gt;I have a dataset of images representing human skin. How do I plot the skin color distribution in HSV color space and YCBCR color space. However, I'd like ignore the &quot;value&quot; or &quot;brightness&quot; in both color spaces and analyze rest of the layers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The below is the code, I found to plot the distribution for ycbcr but don't understand what it means. Can anyone explain it please?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;chroma = zeros(256);&#xA;cb = imycc(:,:,2);&#xA;cb = reshape(cb, 1, numel(cb));&#xA;cb = round(cb);&#xA;&#xA;cr = imycc(:,:,3);&#xA;cr = reshape(cr, 1, numel(cr));&#xA;cr = round(cr);&#xA;&#xA;for i = 1:length(cb)&#xA;   chroma(cb(i), cr(i)) = chroma(cb(i), cr(i)) + 1;&#xA;end&#xA;surf(chroma)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8087" LastEditorUserId="128" LastEditDate="2020-03-13T08:56:57.873" LastActivityDate="2024-03-31T08:01:05.160" Title="How Do I Plot Color Distribution of HSV Image in MATLAB" Tags="|matlab|image-processing|image-segmentation|visualization|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14722" PostTypeId="2" ParentId="14692" CreationDate="2014-02-28T18:40:21.833" Score="1" Body="&lt;p&gt;Autocovariance is defined on random signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C_{XX}(t,s) = E\left[(X_t - \mu_t)(X_s - \mu_s)\right] = E[X_t X_s] - \mu_t \mu_s&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expected value only makes sense for random processes. You could treat a deterministic process as a random process where everything except for the one signal you observed has probability zero.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastEditorUserId="1629" LastEditDate="2016-12-22T09:15:40.797" LastActivityDate="2016-12-22T09:15:40.797" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14723" PostTypeId="2" ParentId="14717" CreationDate="2014-02-28T19:40:34.673" Score="1" Body="&lt;p&gt;The BPM of only certain limited styles or forms of music or music performance is represented by periodicity in volume.  Make sure you are testing with one of those by inspecting a volume vs. time graph.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-02-28T19:40:34.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14724" PostTypeId="1" AcceptedAnswerId="14728" CreationDate="2014-02-28T21:34:00.797" Score="0" ViewCount="124" Body="&lt;p&gt;Suppose we have a communication channel that has a bit-error rate of 50% and the bits are flipped at random such that the receiver has no efficient way to tell which bits have been flipped and there are no error correction bits transmitted with the signal. How do you calculate the information loss (in bits) imposed by the channel? I know there a Shannon formula for doing this but I don't know what it is! Could someone solve this for me with a specific example? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4660" LastActivityDate="2014-03-01T05:50:48.263" Title="Transmission Line Information Loss" Tags="|information-theory|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14725" PostTypeId="1" CreationDate="2014-02-28T22:31:38.410" Score="0" ViewCount="415" Body="&lt;p&gt;I'm currently trying to decide what classifier to use for my snore detection algorithm. Which uses some features like Zero cross rating, frequency band energy, first formants...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The classifiers which have been pointed to are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Support Vector Machine&#xA;Naive Bayes Classifier&#xA;Knn Nearest Neighbour&#xA;Linear or Quadratic Classifier&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, could somebody describe what situation each classifier is used in,  or point me to a good paper, website for article which describes each classifier well.. I find the Mathworks website hard to understand the difference between each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="7753" LastActivityDate="2014-03-01T02:34:59.090" Title="What Matlab Classifiers to use" Tags="|matlab|classification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14726" PostTypeId="2" ParentId="14725" CreationDate="2014-03-01T02:34:59.090" Score="1" Body="&lt;p&gt;If you don't know what you're doing, naive bayes is hard to screw up. The naive part of naive bayes is that it assumes that all of your features are independent. They probably aren't independent but in many cases it doesn't matter so much that this assumption is violated. Naive bayes is also good at handling different feature types such as using both categorical variables and continuous variables for the same classification task.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-03-01T02:34:59.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14727" PostTypeId="2" ParentId="14724" CreationDate="2014-03-01T03:09:37.157" Score="-2" Body="&lt;p&gt;the information &lt;em&gt;capacity&lt;/em&gt; through a channel is, from Shannon,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ I = \int_0^B \log_2 \left( 1 + \frac{S(f)}{N(f)} \right) df $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $I$ is the rate of information passed through the channel in  bits per unit time, $B$ is the one-sided bandwidth, $S(f)$ is the power spectrum of the signal and $N(f)$ is the power spectrum of the noise.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-03-01T03:09:37.157" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14728" PostTypeId="2" ParentId="14724" CreationDate="2014-03-01T05:50:48.263" Score="3" Body="&lt;p&gt;A binary input - binary output channel which flips bits with equal probabilities is known as a &lt;a href=&quot;http://en.wikipedia.org/wiki/Binary_symmetric_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Binary Symmetric Channel&lt;/a&gt;.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/c0OeR.png&quot; alt=&quot;bsc&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Image Credit: Wikipedia - Binary Symmetric Channel)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Channel_capacity&quot; rel=&quot;nofollow noreferrer&quot;&gt;channel capacity&lt;/a&gt; $C$ is the maximum (actually, a supremum) &lt;a href=&quot;http://en.wikipedia.org/wiki/Mutual_information&quot; rel=&quot;nofollow noreferrer&quot;&gt;mutual information&lt;/a&gt; between the channel inputs and the channel outputs over input distributions. You can't get information through a channel more than its capacity. Intuitively, this says that by designing the way you put inputs into the channel well, you can maximize the amount of stuff coming out of the channel that you can recover (and this limit is the capacity). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, this is&#xA;$$C = \sup_{p(x)} I(X;Y)$$&#xA;where $p(x)$ is probability distributions on the input $X$ and $Y$ is the output of the channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, you can write the input of the channel as $P(X=0) = q$ and $P(X=1) = 1-q$. With this distribution, you can see that $P(Y=0) = P(X=0 \text{ and no crossover}) + P(X = 1 \text { and crossover}) = q(1-p) + (1-q)p$ and $P(Y=1) = 1-P(Y=0)$. The mutual information between $X$ and $Y$ is given by $I(X;Y)=\sum_{x,y} p(x,y) \log \frac{p(x,y)}{p(x)p(y)}$ where $p(x,y)$ is the joint distribution of $x$ and $y$, and $p(x)$, $p(y)$ are the distributions of $x$ and $y$ respectively. By writing down $I(X;Y)$ and then maximizing over $q$, you will see $C = 1 - H(p)$ where $H(p)$ is the binary entropy function $-p \log_2 p - (1-p) \log_2 (1-p)$. Then, in your case, $p = \frac{1}{2}$ where $H(p) = 1$, so the capacity is $0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested in learning more about this, a few good books to look (at very different levels of difficulty):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Elements of Information Theory (Second Edition), by Tom Cover and Joy Thomas (Easy, Probably Best Starting Point)&lt;/li&gt;&#xA;&lt;li&gt;Information Theory and Reliable Communication, by Robert Gallegar (A bit harder)&lt;/li&gt;&#xA;&lt;li&gt;Information Theory: Coding Theorems for Discrete Memoryless Channels by Czisar and Korner (Pretty hard)&lt;/li&gt;&#xA;&lt;li&gt;Information Theory by Robert B. Ash (Dover book, Easy)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And an unrelated book which I love, but couldn't keep myself from mentioning, is David Mackay's Information Theory, Inference and Learning Algorithms (free on his website), even though it doesn't go over channel capacity. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-03-01T05:50:48.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14729" PostTypeId="2" ParentId="14705" CreationDate="2014-03-01T05:59:08.943" Score="1" Body="&lt;p&gt;You can use a recursive Bayes filtering (RBF) approach to do maximum a posteriori (MAP) estimation. While MMSE estimators look at the conditional mean, MAP estimators look at the conditional mode. See these &lt;a href=&quot;http://people.csail.mit.edu/mrub/talks/filtering.pdf&quot; rel=&quot;nofollow&quot;&gt;notes&lt;/a&gt; for some details. In order to do RBF, you should look into &lt;a href=&quot;http://en.wikipedia.org/wiki/Particle_filtering&quot; rel=&quot;nofollow&quot;&gt;particle filters / sequential monte carlo&lt;/a&gt; methods. There are plenty of books on this topic as well as review papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you assume that your Kalman filter has white Gaussian noise independent for the process and measurement, and an independent Gaussian initial state, you can prove that the MAP estimator coincides with the Kalman filter. [ A Kalman filter is a RBF for the nice Gaussian case. ]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good paper to look at is S. Godsill, A. Doucet, M. West's “Maximum a posteriori sequence estimation using Monte Carlo particle ﬁlters,” Ann. Inst. Stat. Math., vol. 52, no. 1, pp. 82–96, 2001. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual article is behind a paywall, but certainly, many articles on related topics have been written (You can just google Maximum A Posteriori estimation with particle filtering or recursive bayes filtering for details). &lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2014-03-01T06:12:05.783" LastActivityDate="2014-03-01T06:12:05.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14730" PostTypeId="1" AcceptedAnswerId="14773" CreationDate="2014-03-01T06:19:25.520" Score="1" ViewCount="8082" Body="&lt;p&gt;In the following question and answer I kind of get it how it is calculated at surface but I don't get it fully. Can someone please explain the answer in depth?&lt;img src=&quot;https://i.stack.imgur.com/q1g7D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7907" LastActivityDate="2014-03-03T15:14:29.883" Title="How to calculate the zero state response?" Tags="|discrete-signals|convolution|impulse-response|linear-systems|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14731" PostTypeId="2" ParentId="2555" CreationDate="2014-03-01T06:30:37.280" Score="1" Body="&lt;p&gt;This code should generate similar plots to those of pichenettes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def ASD_envelope( nSamps, tAttack, tRelease, susPlateau, kA, kS, kD ):&#xA;    # number of samples for each stage&#xA;    sA = int( nSamps * tAttack )&#xA;    sD = int( nSamps * (1.-tRelease) )&#xA;    sS = nSamps - sA - sD&#xA;&#xA;    # 0 to 1 over N samples, weighted with w&#xA;    def weighted_exp( N, w ):&#xA;        t = np.linspace( 0, 1, N )&#xA;        E = np.exp( w * t ) - 1&#xA;        E /= max(E)&#xA;        return E&#xA;&#xA;    A = weighted_exp( sA, kA )&#xA;    S = weighted_exp( sS, kS )&#xA;    D = weighted_exp( sD, kD )&#xA;&#xA;    A = A[::-1]&#xA;    A = 1.-A&#xA;&#xA;    S = S[::-1]&#xA;    S *= 1-susPlateau&#xA;    S += susPlateau&#xA;&#xA;    D = D[::-1]&#xA;    D *= susPlateau&#xA;&#xA;    env = np.concatenate( [A,S,D] )&#xA;&#xA;    # plot&#xA;    tEnv = np.linspace( 0, nSamps, len(env) )&#xA;    plt.plot( tEnv, env )&#xA;    plt.savefig( &quot;OUT/EnvASD.png&quot; )&#xA;    plt.close()&#xA;&#xA;    return env&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm grateful for any improvements, one thing that may be a good idea is allowing the last three parameters (which determine the steepness of each of the three stages) to vary between 0 and 1, where 0.5 would be a straight-line. But I can't see offhand how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I haven't tested thoroughly all usage cases, for example if one stage has zero length.&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2014-03-01T06:30:37.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14733" PostTypeId="1" AcceptedAnswerId="14734" CreationDate="2014-03-01T07:09:09.020" Score="0" ViewCount="12939" Body="&lt;p&gt;Say for instance, face detection algorithms - I see researchers testing their algorithms and table their results under &lt;code&gt;TP&lt;/code&gt; and &lt;code&gt;FP&lt;/code&gt;. What are these?&lt;/p&gt;&#xA;" OwnerUserId="8087" LastActivityDate="2023-10-19T15:30:47.850" Title="What are True Positive and False Positive with reference to image processing" Tags="|image-processing|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14734" PostTypeId="2" ParentId="14733" CreationDate="2014-03-01T07:27:38.593" Score="1" Body="&lt;p&gt;A ,,true'' positive would be an image that has a property (in the context of face detection maybe: ,,contains a face'') and that is recognized by a program as such. A ,,false'' positive then is one that does not have the property but is recognized anyway.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-01T07:27:38.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14735" PostTypeId="1" AcceptedAnswerId="14737" CreationDate="2014-03-01T08:40:20.923" Score="1" ViewCount="806" Body="&lt;p&gt;I have a sound source that generates an ultrasonic pulse. I have two microphones seperated by a distance which are at a distance from the source. I want to find the time delay of arrival of the ultrasonic pulse at the mics. I am filtering out all the frequencies other than my source frequency from the outputs of the mics. Due to noise and other reasons, the shape of the pulse received at each mic is not same. I am using cross-correlation to find the time delay but the results are inconsistent. I observed that when I use low frequencies (100~300hz), results are consistent. But I want to find using ultrasonic sound. I am using the below code for finding time delay&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[xc,lags]=xcorr(x1,x2);&#xA;[m,i]=max(xc);&#xA;timeDelay=lags(i);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone please tell me what is it that I am doing wrong and how to correct it? I posted a similar question &lt;a href=&quot;https://stackoverflow.com/questions/22039670/time-delay-estimation-using-crosscorrelation&quot;&gt;here&lt;/a&gt;, but couldnt understand the provided answer. In some articles, it is mentioned that cross-correlation works only for cases when the signal shapes are identical. If so, how can I find the delay? I was also wondering if the voice tracking cameras used in video conferencing use some technique other than cross-correlation.&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-03-01T23:35:22.820" Title="Time delay estimation using ultrasound" Tags="|matlab|cross-correlation|delay|ultrasound|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14736" PostTypeId="1" AcceptedAnswerId="14767" CreationDate="2014-03-01T13:34:55.377" Score="5" ViewCount="1364" Body="&lt;p&gt;I have a doubt. We calculate metrics such as PSNR, SNR, and MSE to prove that the proposed algorithm is better than its counterparts. To do this we need Original image (Noise free), Noisy image (we add this noise) and then Filtered image. Now we compare original and filtered output to estimate these parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how to estimate these parameters when we have only the noisy image? That is in case of an ultrasound image, speckle noise occurs in the original image itself. We don't have a noisy free images in case of ultrasound. If we do as usual (as stated above), we will get poor results (PSNR,SNR &amp;amp; MSE) even though the subjective quality of the image is improved considerably. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, one way to do is to add extra noise to this noisy (original) image and apply our filter and show that the added noise has been removed efficiently. I want you to suggest any other ways to prove that my proposed algorithm is performing better than its counterparts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;              Original Image                       Filtered Image&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qw0mT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="5800" LastEditDate="2014-03-03T00:30:28.523" LastActivityDate="2014-03-03T01:55:40.517" Title="Metrics for Noisy Images" Tags="|image-processing|denoising|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14737" PostTypeId="2" ParentId="14735" CreationDate="2014-03-01T16:16:11.317" Score="2" Body="&lt;p&gt;The transient edge or pulse shape of a tone burst represents a modulation.  The resulting modulated signal will contain frequency components higher than the tone frequency.  Thus you may need a sample rate much higher than just over 2X the tone frequency to reproduce a waveform accurately enough for cross-correlation to match the edges of the pulse envelopes.  This is likely true for your low tones and for voices, where the sample rate can be 10X to 200X higher than the tone or forment frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering out frequencies just below the tone carrier can also remove any lower sidebands of the modulation, thus likely increasing the error in envelope matching by cross-correlation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-01T23:35:22.820" LastActivityDate="2014-03-01T23:35:22.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14738" PostTypeId="1" CreationDate="2014-03-01T20:02:48.713" Score="1" ViewCount="739" Body="&lt;p&gt;Lets say I have a matrix &lt;code&gt;x=[ 1 2 1 2 1 2 1 2 3 4 5 ]&lt;/code&gt;.&#xA;To look at its histogram, I can do &lt;code&gt;h=hist(x)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;code&gt;h&lt;/code&gt; with retrieve a matrix consisting only the number of occurrences and does not store the original value to which it occurred. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want is something like a function which takes a value from &lt;code&gt;x&lt;/code&gt; and returns number of occurrences of it. Having said that, what one thing &lt;code&gt;histeq&lt;/code&gt; does should we admire is, it automatically scales nearest values according!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should solve this issue? How exactly people do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My reason of interest is in images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say I have an image. I want to find all number of occurrences of a chrominance value of image.&lt;/p&gt;&#xA;" OwnerUserId="8087" LastActivityDate="2014-05-01T07:07:46.853" Title="How to get histogram data object from matlab" Tags="|matlab|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14739" PostTypeId="1" AcceptedAnswerId="14761" CreationDate="2014-03-01T20:26:59.500" Score="6" ViewCount="3986" Body="&lt;p&gt;I am having trouble wrapping my head around digital filters with different orders of numerator and denominator.  Let me know if any of these points is wrong:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;All (digital or analog) transfer functions have the same number of poles and zeros, &lt;em&gt;if&lt;/em&gt; you include the ones at infinity.  So $H(s) = 1/s$ has a pole at the origin and a zero at infinity, which is important for visualizing the amplitude response surface in the S plane.&lt;/li&gt;&#xA;&lt;li&gt;But usually when we say &quot;number of poles&quot; or zeros we mean &lt;em&gt;finite&lt;/em&gt; poles or zeros.  So $H(s) = 1/s$ is considered to have one pole and no zeros.&lt;/li&gt;&#xA;&lt;li&gt;Digital filters designed by bilinear transform from analog filters always have the same number of poles and zeros (and none are ever at infinity).  But digital filters can also be made with different orders of numerator and denominator.&lt;/li&gt;&#xA;&lt;li&gt;To find the poles and zeros of a digital transfer function in the general case, you first must express it as positive powers of z (&quot;controls engineer format&quot;) and then find the roots of the numerator and denominator, same way as an analog filter.  So for example, a single-sample delay in &quot;DSP engineer format&quot; $H(z) = z^{−1}$ is rewritten as $H(z) = 1/z$, which shows that it has a pole at the origin and a zero at infinity, so it's considered to have &quot;one pole and no (finite) zeros&quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So then I become confused:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;FIR filters are described as &quot;all-zero filters&quot;. &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/filtfilt.html&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt; &lt;a href=&quot;http://www.vyssotski.ch/BasicsOfInstrumentation/SpikeSorting/Design_of_FIR_Filters.pdf#page=4&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt; They can be represented as a transfer function like $$H(z) = b_0 + b_1 z^{-1} + b_2 z^{-2}$$  But if you convert to positive powers of z to find the poles and zeros, you get: $$H(z) = \frac{b_0 {z}^{2} + b_1 z + b_2}{z^2}$$ which has just as many poles at the origin as there are zeros.  What is the significance of these poles?  These are each the $H(z) = z^{−1}$ delay elements used to produce the feedforward signals?  Seems like the poles end up at the origin if the delay elements are not fed back to the input?  So FIR filters are not actually all-zero filters?&lt;/li&gt;&#xA;&lt;li&gt;Similarly, maxflat filters (Selesnick-Burrus generalized Butterworth) are described as having &quot;more zeros than poles&quot;, which is supposed to be computationally advantageous.   (Why?)  The &lt;a href=&quot;http://www.mathworks.com/help/signal/ug/iir-filter-design.html&quot; rel=&quot;noreferrer&quot;&gt;Matlab example&lt;/a&gt; produces &lt;code&gt;b = [0.0950    0.2849    0.2849    0.0950]&lt;/code&gt; and &lt;code&gt;a = [1.0000   -0.2402]&lt;/code&gt;.  I think this is &quot;negative powers of z&quot; format, so this would represent a transfer function $$H(z) = \frac&#xA;{0.0950 + 0.2849 z^{-1} + 0.2849 z^{-2} + 0.0950 z^{-3}}&#xA;{1.0000 - 0.2402 z^{-1}}&#xA;$$&lt;/li&gt;&#xA;&lt;li&gt;But again, if you convert to positive powers of z, you get: $$H(z) = \frac&#xA;{0.0950 z^3 + 0.2849 z^2 + 0.2849 z + 0.0950}&#xA;{1.0000 z^3 - 0.2402 z^2}&#xA;$$ which has 3 poles again, 2 of which are at the origin.  So the number of poles and zeros is again the same, and they're all finite, too.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If adding a zero to a digital transfer function always also adds a finite pole, I don't understand how a filter with &quot;more zeros than poles&quot; can exist, or be advantageous.  Might as well use those poles to affect the frequency response if you have them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some convention where poles at the origin are not included in the tally, like the way poles at infinity are not included?  If so, why?&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2014-03-02T22:37:30.320" Title="Digital filters with more zeros than poles" Tags="|filter-design|transfer-function|digital|delay|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14740" PostTypeId="2" ParentId="14739" CreationDate="2014-03-01T20:40:12.037" Score="4" Body="&lt;p&gt;In the sampled digital realm, poles at the origin represent delay, which may be necessary to make a filter implementation strictly causal.  This delay usually requires no additional arithmetic ops (as a pole elsewhere than zero would require).  Sometimes when describing a filter where delay is irrelevant (offline processing, etc.), the filter is centered at a non-causal location (causality being added/enforced by the rest of the system outside of the filter being described); thus ignoring some poles which are just (a tiny fraction of the total system) delays.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-02T00:50:45.393" LastActivityDate="2014-03-02T00:50:45.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14741" PostTypeId="2" ParentId="12949" CreationDate="2014-03-01T22:11:29.730" Score="1" Body="&lt;p&gt;Try raising the input to the Nth power, then 1st- order low pass filtering, followed by the Nth root. If N is 2 then this is equivalent to rms with exponential forgetting factor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bob&lt;/p&gt;&#xA;" OwnerUserId="7453" LastActivityDate="2014-03-01T22:11:29.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14742" PostTypeId="2" ParentId="14739" CreationDate="2014-03-02T01:05:57.607" Score="2" Body="&lt;p&gt;a causal discrete-time filter, $H(z)$, cannot have more zeros than poles.  you can factor it out and you will be left with positive powers of $z$ and that means an &lt;strong&gt;advance&lt;/strong&gt; of the impulse response before $n=0$.  but a causal $h[n]$ must be zero for $n&amp;lt;0$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-03-02T01:05:57.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14744" PostTypeId="2" ParentId="14738" CreationDate="2014-03-02T06:20:52.577" Score="1" Body="&lt;pre&gt;&lt;code&gt;%Let's say:&#xA;X = [1 2 3 4 4 4 3 2 1 5 10];&#xA;Num = input(&quot;Please enter the number&quot;);&#xA;temp = X == Num;&#xA;&#xA;%let's assume Num in this case is 4&#xA;%temp = [0 0 0 1 1 1 0 0 0 0 0]&#xA;&#xA;ans = sum(temp);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ans = 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a quick and an effective way to find the number of occurrences of a particular value.&lt;/p&gt;&#xA;" OwnerUserId="8008" LastActivityDate="2014-03-02T06:20:52.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14746" PostTypeId="1" AcceptedAnswerId="14749" CreationDate="2014-03-02T11:16:42.220" Score="6" ViewCount="6146" Body="&lt;p&gt;So, I am reading a paper about &lt;a href=&quot;http://www.willowgarage.com/sites/default/files/orb_final.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;ORB: An Efficient Alternative to SIFT or SURF&lt;/a&gt; and it happens to calculate the direction of  corner from it center . According to Rosin the author of the paper;moments of a patch is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kz9Ny.jpg&quot; alt=&quot;moment&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the centroid is of the patch from the center is calculated using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/15dtR.jpg&quot; alt=&quot;centroid&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The direction of the patch is computed from&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pU1cy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what are these value of &lt;code&gt;p&lt;/code&gt; and &lt;code&gt;q&lt;/code&gt; and why is it out there?&lt;/p&gt;&#xA;" OwnerUserId="4433" LastEditorUserId="128" LastEditDate="2019-10-19T08:21:25.410" LastActivityDate="2019-10-19T08:21:25.410" Title="ORB Algorithm: What Is Intensity Centroid?" Tags="|image-processing|computer-vision|feature-extraction|feature-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14748" PostTypeId="1" CreationDate="2014-03-02T11:40:39.627" Score="0" ViewCount="679" Body="&lt;p&gt;How to calculate the Q value for a high pass filter ?&#xA;Ps: I'm a beginner in signal processing, so please put it in simple terms.&lt;/p&gt;&#xA;" OwnerUserId="7875" LastActivityDate="2014-06-20T07:58:37.573" Title="Q value for a high pass filter" Tags="|filters|audio|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14749" PostTypeId="2" ParentId="14746" CreationDate="2014-03-02T11:41:59.207" Score="4" Body="&lt;p&gt;p and q - order of the moments, it is the analogue of the mechanical moments (i.e. of force or inertia). Image moments are very basic properties of image, invariant to rotation, could be used as simple descriptor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moment of inertia Ix= I2 = mass *x_coordinate^2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image moment Ix2 = intensity * *x_coordinate^2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Moment_(physics)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Moment_(physics)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Image_moment&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Image_moment&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7030" LastActivityDate="2014-03-02T11:41:59.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14750" PostTypeId="2" ParentId="14748" CreationDate="2014-03-02T14:06:01.783" Score="1" Body="&lt;p&gt;You can look at &lt;a href=&quot;http://www.analog.com/library/analogdialogue/archives/43-09/edch%208%20filter.pdf&quot; rel=&quot;nofollow&quot;&gt;these set of notes&lt;/a&gt; provided by Analog Devices as part of their &quot;Basic Linear Design&quot; seminar, or just look for notes on second order filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function of a second order high pass filter is &#xA;$$H(s) = \frac{A s^2}{s^2+\frac{w_0}{Q}s+w_0^2}$$ where $w_0$ is the cutoff frequency, $Q$ is the $Q$-factor, and $A$ is the gain.&lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-03-02T14:06:01.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14752" PostTypeId="1" CreationDate="2014-03-02T14:29:35.593" Score="1" ViewCount="205" Body="&lt;p&gt;I know that the frequency response of a filter is described by equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;H(w) = 1-1.176*e^(-jw) + e^(-j2w)&lt;/code&gt; , where w is the angular frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in time domain I have a filter that is described by difference equation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(k) = x(k)-1.176*x(k-1)+x(k-2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I'm asked to explain the connection between these equations and why the coefficients for the both equations are the same &lt;code&gt;[1 -1.176 1]&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been reading books and trying to find information around the internet but without any solutions for this. Could someone explain me the connection of these equations? Why are the coefficients same?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an idea that these two equations might represent the same filter but in different domains (time and frequency). Does convolution have something to do with this?&lt;/p&gt;&#xA;" OwnerUserId="8098" LastEditorUserId="7092" LastEditDate="2014-03-02T20:54:29.160" LastActivityDate="2014-03-04T12:49:57.470" Title="Connection between filter equation in frequency domain and difference equation in time domain?" Tags="|filters|frequency|convolution|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14753" PostTypeId="1" CreationDate="2014-03-02T14:54:49.407" Score="1" ViewCount="1340" Body="&lt;p&gt;Hi I am working on one project and I have some trouble with comparison audio files. I have read a lot of articles about this problem but I couldn't find a good one working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my project I need to compare two audio events like gun shot, explosion, crying, breaking of glass, ... These files have max 5sec duration but it can be different. I store these in database and there will be more examples from one audio event. Users will load his .wav file (max 5sec) into program, and program shows all files in database where is similar with the uploaded audio event. What I need is recognize which audio event is it. For example if an user uploads some explosions, program will return all files including some kind of explosion. So I am not looking for exact match. I just need find out how similar is this file with these in database. I need it in some numbers , maybe in percentage, so I can tell the files which match 90% or more. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is the best technique to find this kind of similarity, which way is best for my case? &lt;/p&gt;&#xA;" OwnerUserId="8099" LastEditorUserId="7092" LastEditDate="2014-03-02T22:11:32.507" LastActivityDate="2014-03-03T20:53:46.130" Title="Comparasion of two wav files in Matlab" Tags="|matlab|audio|signal-analysis|" AnswerCount="1" CommentCount="2" ClosedDate="2014-03-18T22:33:45.940" ContentLicense="CC BY-SA 3.0" />
  <row Id="14754" PostTypeId="1" CreationDate="2014-03-02T16:38:30.983" Score="10" ViewCount="14762" Body="&lt;p&gt;I am working on an audio system where I need to implement an equal power crossfade between two signals over a specified number of samples. Initially I implemented a linear fade but this creates a dip in the middle of the crossfade which I don't want. I tried a few other methods that I found on Google but they either make a dip in another part of the curve or even make the sound louder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have float samples ranging from -1.0 to 1.0 and I want to crossfade between them over the course of x samples, keeping the perceived volume the same over the entire crossfade, what would be the correct formula for calculating the curve? Preferably I want to have a value like 0.001 represent the minimum level that the fade in starts at and the fade out goes to. 1.0 should be the maximum. Thanks in advance for any advice!&lt;/p&gt;&#xA;" OwnerUserId="8100" LastEditorUserId="4346" LastEditDate="2018-06-21T06:16:06.817" LastActivityDate="2023-02-24T02:47:49.930" Title="Equal power crossfade" Tags="|audio|amplitude|envelope|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14755" PostTypeId="2" ParentId="14754" CreationDate="2014-03-02T17:09:41.427" Score="11" Body="&lt;p&gt;if the two audio signals are totally uncorrelated, the the &lt;strong&gt;squares&lt;/strong&gt; of the two crossfade gains should add to 1.  so, to prevent that dip, your crossfade function will look more like $\sqrt{\frac{1}{2}(1+t)}$ and $\sqrt{\frac{1}{2}(1-t)}$ rather than $\frac{1}{2}(1+t)$ and $\frac{1}{2}(1-t)$  for $-1 \le t \le +1$.  note, for constant power crossfades, at the midpoint of the crossfade ($t=0$), both crossfade gains are at $\sqrt{\frac{1}{2}} \approx 0.707$ rather than at $\frac{1}{2}$.  that's what addresses the dip you want to avoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if your two audio signals are somewhere between totally uncorrelated and totally correlated, you need to determine the degree of correlation (that's what cross-correlation is all about), and then the crossfade functions can be determinied analytically.  &lt;a href=&quot;http://music.columbia.edu/pipermail/music-dsp/2011-July/069971.html&quot;&gt;i have posted to music-dsp a little theory about it.&lt;/a&gt;  it's not perfectly rigorous, but i think it works.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-03-02T17:09:41.427" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14756" PostTypeId="1" AcceptedAnswerId="14758" CreationDate="2014-03-02T17:44:52.317" Score="0" ViewCount="82" Body="&lt;p&gt;In the below link: &lt;a href=&quot;http://en.wikipedia.org/wiki/Active_contour_model&quot; rel=&quot;nofollow&quot;&gt;Active Contour&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Active_contour_model&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Active_contour_model&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Internal Energy of the snake is &#xA;$$E_{internal}=\frac{(\alpha\,\!(s)\left | \mathbf{v}_s(s) \right \vert^2 + \beta\,\!(s)\left | \mathbf{v}_{ss}(s) \right \vert ^2)}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why it is divided by 2 ?&lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-03-02T21:17:02.200" Title="Active Contours" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14757" PostTypeId="2" ParentId="14752" CreationDate="2014-03-02T20:24:23.783" Score="2" Body="&lt;p&gt;&lt;strong&gt;Hint:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function $H(\omega)$ is equal to the ratio of output and input spectra:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=\frac{Y(\omega)}{X(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your first equation can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(\omega)=X(\omega) - 1.176X(\omega)e^{-j\omega} + X(\omega)e^{-2j\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you get if you transform this equation to the time-domain?&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-02T20:24:23.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14758" PostTypeId="2" ParentId="14756" CreationDate="2014-03-02T21:17:02.200" Score="0" Body="&lt;p&gt;It's not a big deal indeed. Sometimes the $\frac {1}{2}$ term is &lt;a href=&quot;http://www.cs.utexas.edu/~grauman/courses/378/handouts/snakes.pdf&quot; rel=&quot;nofollow&quot;&gt;omitted&lt;/a&gt;, thus the membrane term $\alpha$ and thin plate term $\beta$ are halved to achieve the same effect. The core is the trade-off between contracting behavior and sharp bends avoidance, which are reflected with the first and second derivative terms. &lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-03-02T21:17:02.200" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14761" PostTypeId="2" ParentId="14739" CreationDate="2014-03-02T22:37:30.320" Score="7" Body="&lt;p&gt;If you consider the transfer function of a causal IIR filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{B(z)}{A(z)}=\frac{\sum_{m=0}^M b_mz^{-m}}{\sum_{n=0}^N a_nz^{-n}},\quad a_0=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then you always get the same number of poles and zeros, regardless of the choice of $M$ and $N$ (as already pointed out by Robert). However, what is meant by a system with &quot;more zeros than poles&quot;, is a system with a numerator degree $M$ greater than the degree $N$ of the denominator. In this case &quot;poles&quot; refers to the poles away from the origin. It is only these poles that have to be implemented. So a system with some poles at the origin is cheaper to implement than a system with all its poles away from the origin. So your argument that you &quot;might as well use those poles ... if you have them&quot; does not really hold, because poles at the origin come without any implementation costs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The remaining question is why such filters with more zeros than poles (away from the origin) can be useful. Let me just give two examples:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In implementation as well as in the design process, poles can give a lot of trouble (instability, noise enhancement, local optima in the design process, etc.). On the other hand, FIR filters with good frequency selective properties must often have a very large degree (resulting in a large delay and in high implementation costs). Adding just a few poles can give us the best of both worlds: better filter behavior at a greatly reduced (numerator) degree $M$, and only little trouble because there are only very few poles.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For frequency selective filters with a small desired phase distortion in the passbands, IIR systems with $M&amp;gt;N$ are very useful, because the poles ideally contribute only to the passbands, whereas the zeros must contribute to the passbands (for phase equalization) as well as to the stopbands (zeros on or close to the unit circle). Consequently, we need poles only at angles corresponding to passband frequencies, but we need zeros everywhere.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The figure below shows such a system (lowpass filter with approximately linear passband phase response, $M=12, N=6$):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xK8sx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-02T22:37:30.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14762" PostTypeId="1" CreationDate="2014-03-02T22:48:58.610" Score="0" ViewCount="105" Body="&lt;p&gt;I am stuck in a situation here while calculating received SNR in AWGN channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I performed calculations directly in decibels, I got very high SNR value for instance 140 dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the formula: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;SNRreceived = [power transmitted(dBm) + FSPL(dB)]-[No(db) * B(hz) + 10log(KT) + NF(dB)]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone point out where am I mistaken or my formula is not correct? &lt;/p&gt;&#xA;" OwnerUserId="8101" LastEditorUserId="7092" LastEditDate="2014-03-03T02:56:21.773" LastActivityDate="2014-03-03T02:56:21.773" Title="High SNR value unacceptable" Tags="|snr|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14763" PostTypeId="1" CreationDate="2014-03-03T00:05:15.927" Score="0" ViewCount="144" Body="&lt;p&gt;For a question on my homework, I am given &lt;code&gt;f(t) = e^(-a*abs(t))&lt;/code&gt; and asked to find the Fourier transform of the function. I understand how to do that part, but then the answer requires me to &quot;Compute the amplitude and phase spectra&quot; of the function. My question is, what are these spectra and how do I obtain them from the given function or its Fourier transform? &lt;/p&gt;&#xA;" OwnerUserId="8102" LastEditorUserId="7092" LastEditDate="2014-03-03T01:17:39.620" LastActivityDate="2014-03-03T01:17:39.620" Title="Obtaining the frequency and phase spectra from fourier transform?" Tags="|fourier-transform|homework|phase|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14764" PostTypeId="2" ParentId="14763" CreationDate="2014-03-03T00:52:14.590" Score="1" Body="&lt;p&gt;They simply are the magnitude and angle of the Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-03-03T00:52:14.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14765" PostTypeId="1" AcceptedAnswerId="14771" CreationDate="2014-03-03T01:02:29.980" Score="3" ViewCount="4113" Body="&lt;p&gt;I'm quite new to the subject and am having fun playing around with the FFT. What I am currently doing is trying to sample an audio signal and display its frequency spectrum at the same time. This works alright with what I am doing so far, but there are still a few missing puzzle pieces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I have implemented so far:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I get the raw audio data (i.e. my signal) and sample it with a sampling frequency of 44.1 kHz.&lt;/li&gt;&#xA;&lt;li&gt;For each time instance of the audio file where I update the spectrum (e.g. every 1/24 th second), I grab a certain amount of samples from my sampled signal around the time instance, apply a window function to it (Hann window) and then I transform it using the fftw library.&lt;/li&gt;&#xA;&lt;li&gt;Then I look at what I get. Since all my input data is real, I get n/2 + 1 complex values, am I correct in that assumption?&lt;/li&gt;&#xA;&lt;li&gt;Now, I'd like to display this spectrum. I calculate the magnitude of each of the n/2 + 1 vectors using the l2-norm and try to display that.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The last part is where I'm note sure of how to proceed. First, is this magnitude I calculate called the amplitude in frequency domain or am I mixing stuff up? &#xA;As far as I know, the amplitude of the original signal in the window I transformed is somehow spread across my spectrum (i.e. my frequency bins). &#xA;What I am looking for is a nice mapping in order to display these frequency bins nicely (in fact...I always group a few together to get larger frequency bands). &#xA;Here is what I am trying to do:&#xA;For my visualization, I have 12 bands and each has 15 discrete levels. So effectively what I am doing so far is trying to map the maximum of all bins in a frequency band into {0,1,...15}. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have just been playing around so far, trying things like logarithms and linear mappings, but none seem be giving me the results I am expecting. For example, the lower frequencies might have a very high amplitude where higher ones are comparatively low, even though the corresponding audio signal would have me expecting higher magnitudes for the higher frequency bands. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my main question, could this be mainly due to the fact that I am always picking the maximum? Would a mean value over all bins in a band be better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My gut tells me thats just the tip of the iceberg. A linear transformation is, for example, difficult to adjust since I don't know what the maximum frequency magnitude is when I am calculating my spectrum on the fly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate it if some of you Gurus could help me learn what I am missing and, perhaps, tell me if there is anything horribly wrong with what I am doing up to the point where I want to visualize the calculated spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&#xA;Brick&lt;/p&gt;&#xA;" OwnerUserId="8103" LastActivityDate="2014-03-07T23:49:06.070" Title="Adequate representation of frequency domain amplitude/magnitude of FFT of a signal" Tags="|fft|frequency|amplitude|magnitude|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14766" PostTypeId="2" ParentId="14765" CreationDate="2014-03-03T01:36:15.950" Score="2" Body="&lt;p&gt;Many audio FFT visualizations use log(magnitude) instead of linear, as that makes it easier to find a scale that makes data visible a graph.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The energy contained in band that contains multiple FFT result bins would be the sum, not the max.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the &quot;certain amount&quot; of samples you grab for each FFT is a small fraction of those per 1/24 second, then you may want to average the magnitude of several FFT windows that fit within that display frame time.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-03T01:36:15.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14767" PostTypeId="2" ParentId="14736" CreationDate="2014-03-03T01:55:40.517" Score="4" Body="&lt;p&gt;How would you expect the effect of a denoising model? Do you want it to exceed your ability to observe the noise pattern and remove them, or to replace you and remove the known pattern which you define as noise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think most denoising algorithms target the 2nd option. That's the reason why it makes more sense to quantify and compare different algorithms through simulations. The paper assumes the main source of noise comes from speckle, which can be further assumed as Gaussian noise. So they added normal distribution values onto the 'clean' image, and PSNR, SNR, and MSE all get involved with the variation of the image. Such variation is just due to the adding values. They are actually trying to find out which algorithm can reduce such variation to the closest level of 'clean' image. So the comparisons have to be implemented with the known 'clean' image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strictly speaking, the 'clean' image in the paper is not clean at all. It is experimental data from ultrasonic B mode scan, and includes the unknown noise. I remember you asked a question in SO very long ago, claiming that you failed to reproduce some of the comparison results from the paper. That's very possible, since as I mentioned above, you can only evaluate your algorithms via simulations, and the 'clean' image should have been generated as a computational phantom. Otherwise you don't even know which part of the image from experiment, other than your added value,  is treated as noise in your algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, SNR can be used as the quantification of experimental data, but it is not calculated that way in your paper. The aim of your algorithm is to enhance the region of interest (organ, tissues in the ultrasound image), making it clearer to the diagnosis. As a result, you'd better choose such regions by yourself, and select other background regions as the  'noise' part in &lt;a href=&quot;http://en.wikipedia.org/wiki/Signal-to-noise_ratio#Alternative_definition&quot; rel=&quot;nofollow&quot;&gt;SNR calculation&lt;/a&gt;. If you have more than one regions not viewed as background, &lt;a href=&quot;http://en.wikipedia.org/wiki/Contrast-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;contrast to noise ratio (CNR)&lt;/a&gt; is also suited in your contrast quantification (this is more used in MRI image analysis). Besides, &lt;a href=&quot;http://en.wikipedia.org/wiki/Optical_transfer_function#The_edge-spread_function&quot; rel=&quot;nofollow&quot;&gt;edge spread function (ESF)&lt;/a&gt; along with &lt;a href=&quot;https://spie.org/x34298.xml&quot; rel=&quot;nofollow&quot;&gt;modulation transfer function&lt;/a&gt; are often used in optical imaging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also find &lt;a href=&quot;http://www.rakuten.com/prod/radiographic-image-analysis/211937450.html?listingId=333230382&amp;amp;s_kwcid=&quot; rel=&quot;nofollow&quot;&gt;some books on image analysis&lt;/a&gt; useful in image quality evaluation.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-03-03T01:55:40.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14768" PostTypeId="2" ParentId="14765" CreationDate="2014-03-03T02:28:54.887" Score="5" Body="&lt;p&gt;The correct way to group multiple bins together is to multiply each complex fft bin output by its complex conjugate (which gives the bin power) then add all the bin powers together and divide by the number of bins in the group. If you want to display in db (which is the conventional approach) then take 10*log10() of the result. Negative db values are normal and expected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if your audio signal is music, it is quite normal that the spectrum falls off with frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also from your description it sounds like you are not using a 2 ^n number of points. It's best to stick with 2^n data buffer sizes to maximize the efficiency of the fft computation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bob&lt;/p&gt;&#xA;" OwnerUserId="7453" LastActivityDate="2014-03-03T02:28:54.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14769" PostTypeId="1" CreationDate="2014-03-03T07:46:25.867" Score="0" ViewCount="912" Body="&lt;p&gt;I am working on bearing faults detection. I am doing the following steps:&lt;br&gt;&#xA;signal-&gt;mean zero-&gt;high pass-&gt;hilbert-&gt;y-&gt;fft-&gt;cepstrum of y.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Tme8q.jpg&quot; alt=&quot;this is my spectrum after hilbert and fft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lXDAX.jpg&quot; alt=&quot;this is the cepstrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my code is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    analy = hilbert(Signal);&#xA;    y = abs(analy);&#xA;    N = 2*2048;T=N/Fs;&#xA;    sig_f = abs(fft(y(1:N)',N));&#xA;    sig_n = sig_f/(norm(sig_f));&#xA;    Signal_fft_hilbert = sig_n;&#xA;    freq_s = (0:N-1)/T;    &#xA;&#xA;       figure(3)&#xA;      plot(freq_s(2:250),Signal_fft_hilbert(2:250))&#xA;      title ('Average FFT after Hilbert enveloping');&#xA;     xlabel('Frequency in Hz')&#xA;&#xA;      figure(4)&#xA;      c2=cceps(y(2:250));&#xA;     plot(freq_s(2:250),c2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is I am not able to extract the fundamental frequency out of the spectrum or cepstrum. my bearing frequency is 42 Hz.I am not getting prominent peaks in this region. Please suggest something.&lt;/p&gt;&#xA;" OwnerUserId="8085" LastActivityDate="2014-03-03T07:46:25.867" Title="bearing frequency detection" Tags="|matlab|fft|frequency-spectrum|frequency|cepstral-analysis|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14770" PostTypeId="2" ParentId="14752" CreationDate="2014-03-03T07:51:07.880" Score="2" Body="&lt;p&gt;Or put another way, what would be the result of the filter if the input is the test sinusoid $x(k)=e^{jkω}$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(k)=e^{jkω}-1.176e^{j(k-1)ω}+6e^{j(k-2)ω}=(1-1.176e^{−jω}+e^{−2jω})e^{jkω}=H(ω)x(k)$$&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-03-03T07:51:07.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14771" PostTypeId="2" ParentId="14765" CreationDate="2014-03-03T09:33:03.380" Score="2" Body="&lt;p&gt;I did a fair amount of frequency-content visualization in the past, although I don't have the code in front of me... Sorry I don't have more time but I think this might be of help, so here's what I recall:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First off, I'm not sure if this is part of what is giving you headaches, but since a real signal run through an FFT doesn't have a complex (phase) signal component, your spectrum is going to be reflected about 0, and you really only want the values &gt;= 0; so, generally that means you will just drop half of your FFTed signal. (I am not 100% sure, but I believe that it will depend on the FFT you use where these are located, IIRC I generally took the values from 0-n/2...) Not only can the reflection end up throwing you off, but taking the wrong half (or both together) could be causing what you are seeing with the low frequencies seemingly being high and vice versa.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A super-simple power spectrum is easy: you can just take the square of the magnitude of each bin. For a complex number $x + iy$ the magnitude is given by $\sqrt{x^2 + y^2}$, thus the power just becomes $x^2+y^2$. So, for a complex point in code, this amounts to adding the squares of &lt;code&gt;point.real&lt;/code&gt; and &lt;code&gt;point.imaginary&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Although I think some of the links below will help you if you want absolute power bins, I was used to using relative dB power spectrums; IIRC we called our computation a dBm or SNR (signal-to-noise ratio) estimate, although I think that was fudging a bit... To do this, find the maximum power value in your FFT bins and scale from there, with 0 dB at the top. So, again IIRC, find $p_{max}$ and then each point is given by $10\cdot log_{10}(\frac{p}{p_{max}})$. This gives you a plot with 0 dBm at the top, and the lowest value can change from run to run. So you actually end up with all 0 or negative values, since what you're computing is approximate &quot;dBm down&quot; from the highest power bin rather than an absolute power in this case; this was how we measured our signal-to-noise ratio. (For reference, every 3 dBm increase represents a doubling of power; so 3 dBm down represents a drop by approximately 50%.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We definitely always used power-of-two FFTs, they are generally much faster; if this isn't enough data to do much with, just average your FFTs together; I think probably you'll have fairly good luck with raw averages, but the links below might help you be a little more rigorous if you want or need some rigor. :)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Don't forget that your 0th bin is the DC component of the signal, in other words, the power in your signal that wasn't related to frequency; you can either just mask it out after taking the FFT (much less computationally intensive, but it may (or may not) have some ill effects depending on your application from bypassing or ignoring any rigorous DSP techniques [e.g. using a windowing function]... (although TBH I did some pretty intensive DSP that I'm sure was &lt;em&gt;theoretically&lt;/em&gt; much worse for not having it, but that worked about 5x as fast and gave us results that were just as good, so, as always, YMMV.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And don't forget also (like I did :D) to place a lower bound on your data; just go through all your data points and choose a number (perhaps 60 or 90 db down e.g. -60 or -90) and anything lower than that, set to that. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope that gets you started a bit, I know I got a lot of help when I was first doing this kind of thing, and playing around with averages, FFT sizes, etc. and just looking at the results should help a good bit; sounds like you're on the right track. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's good information at [The Mathworks] on this kind of plotting... (&lt;a href=&quot;http://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html&lt;/a&gt;) Also there seems to be a very good summary of what you'll need to know regarding window functions and more detail on the power spectrum processing relating to this at &lt;a href=&quot;http://www.webcitation.org/query?url=http%3A%2F%2Fwww.wavemetrics.com%2Fproducts%2Figorpro%2Fdataanalysis%2Fsignalprocessing%2Fpowerspectra.htm&amp;amp;date=2014-03-06&quot; rel=&quot;nofollow&quot;&gt;WaveMetrics&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A full example of a spectrum analyzer starts on &lt;a href=&quot;http://www.webcitation.org/query?url=http%3A%2F%2Fwww.ee.umd.edu%2F%7Etretter%2Fcommlab%2Fc6713slides%2Fch4.pdf&amp;amp;date=2014-03-06&quot; rel=&quot;nofollow&quot;&gt;page 4-34 of this paper&lt;/a&gt; (big thanks to Dr. Steven Tretter, Professor Emeritus, Dept. of Electrical and Computer Engineering at the University of Maryland for having a good resources that's got more than just theory in it up and available for anyone to learn from, BTW!) &lt;del&gt;Unfortunately webcitation is not working for me at the moment so hopefully someone can grab a webcite at some point in case it moves.&lt;/del&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;caveat emptor&lt;/strong&gt;: it's been a while since I was working much with frequency domain analysis, and it was with ultrasonic and satellite signals, not audio; however, the principles should be the same here...&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;[edit log: 2013-03-05: 1. was able to grab webcitations for the paper from Dr. Tretter (&lt;a href=&quot;http://www.ece.umd.edu/faculty/tretter&quot; rel=&quot;nofollow&quot;&gt;http://www.ece.umd.edu/faculty/tretter&lt;/a&gt;, I'll try to pull a webcite for that later as well) and for the Power Spectra page from WaveMetrics before the site stopped accepting requests again, so, yay! 2. expanded on a comment I made answering a question about my answer from Brick (OP) relating to the 0th bin (DC component) of the FFT signal, for the benefit of any others who might come across this in the future; and 3. a quick mention of some real-world pragmatism vs. theory during my (5 year) stint working with DSP and Satellite signals. 2013-03-06: Added info about capping values RE: OP questions below.]&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="8104" LastEditorUserId="8104" LastEditDate="2014-03-07T23:49:06.070" LastActivityDate="2014-03-07T23:49:06.070" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="14773" PostTypeId="2" ParentId="14730" CreationDate="2014-03-03T15:14:29.883" Score="2" Body="&lt;p&gt;The answer to your question is essentially contained in Dilip's comment, but I guess as a beginner you need some more help. First, it's important to realize that the response of an LTI system to a scaled and shifted impulse&#xA;$$x[n]=a\delta(n-k)$$ is simply a scaled and shifted version of its impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=ah[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the response to a sum of signals equals the sum of the responses to the individual components of the input signal. Consequently, the response to the given input signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=2\delta[n]-3\delta[n-2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=2h[n]-3h[n-2]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you just have to express the impulse response $h[n]$ in terms of $\delta$-impulses. By noting that&#xA;$$u[n]-u[n-3]=\delta[n]+\delta[n-1]+\delta[n-2]$$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=\delta[n]+\delta[n-1]+4\delta[n-2] \tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging (2) into (1) gives the desired result.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-03T15:14:29.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14774" PostTypeId="2" ParentId="14752" CreationDate="2014-03-03T15:36:55.210" Score="1" Body="&lt;p&gt;An alternative explanation is to remember that the frequency response is obtained by letting $z=e^{j\omega}$. So you use similar mathematics to the previous answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have&lt;br&gt;&#xA;$$H(z)= \frac{Y(z)}{X(z)} = 1-1.176z^{-1} + z^{-2}$$&#xA;$$Y(z)=X(z) -1.176X(z)z^{-1}+X(z)z^{-2}$$ &#xA;Now you can use the property of z-transforms i.e. $z^{-1}$ is merely a delay element, to obtain the time domain difference equation.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-03-03T15:36:55.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14775" PostTypeId="1" CreationDate="2014-03-03T16:39:27.743" Score="1" ViewCount="3661" Body="&lt;p&gt;I am creating an Android app which records sound for &lt;code&gt;t&lt;/code&gt; seconds at a sampling rate of 44.1kHz with a buffer size of 8192 (16 bit mono samples). I need to plot a graph of amplitude against frequency, and so first I need to run an FFT over the buffer each time it is full (which happens multiple times every second, more so with an increasing sampling rate). However, after I run the FFT I understand I need to 'bin' the frequencies and then apply an A-weighting to each bin. From the Nyquist criterion, I understand that I only need to look at the first half of the frequencies, and disregard the first corresponding to the DC component. However, I am unsure of what 'binning' actually means and would like some clarification as to what it is, and how to choose what goes in what bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please advise :) .&lt;/p&gt;&#xA;" OwnerUserId="8109" LastActivityDate="2014-04-02T19:10:29.773" Title="Explanation of binning in frequency analysis post-FFT" Tags="|fft|audio|digital|nyquist|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14778" PostTypeId="2" ParentId="14775" CreationDate="2014-03-03T17:04:24.303" Score="1" Body="&lt;p&gt;If you desire to plot a graph with other than 4096 points (half the FFT length) on the frequency axis, then you will have to resample the FFT result.  This re-binning may have to composite several FFT magnitude bins into each plot point bin, depending on your desired x axis plot resolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-03T17:04:24.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14779" PostTypeId="2" ParentId="14775" CreationDate="2014-03-03T17:30:56.967" Score="2" Body="&lt;p&gt;In its simplest form, the 'binning' process consists in summing the energies (squared magnitude) within groups of adjacent FFT values. This will give you the total energy in a set of disjoint frequency bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more elaborate form consists in using overlapping triangle filter banks - you compute a weighted sum of the energy in a range of FFT bins to get a number which can be interpreted as the energy measured at the output of a band-pass filter of a given center frequency/width. For example, one can use this technique to build a visualization which uses a 1/3 octave scale on the frequency axis.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-03-03T17:30:56.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14780" PostTypeId="1" CreationDate="2014-03-03T17:31:49.043" Score="2" ViewCount="315" Body="&lt;p&gt;I am detecting roadline pattern in an image. I have applied delaunay triangulation. &#xA;I get 160 triangles in that. Now I need to find the area for each triangle. Can you kindly help me. Only after this I should proceed with my project. Please help me...&#xA; &lt;img src=&quot;https://i.stack.imgur.com/oO4aI.jpg&quot; alt=&quot;delaunay triangulation&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7799" LastEditorUserId="8202" LastEditDate="2014-05-21T07:23:29.767" LastActivityDate="2014-05-21T07:23:29.767" Title="Find the area of all triangles from an output of Delaunay Triangulation" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14781" PostTypeId="1" AcceptedAnswerId="14782" CreationDate="2014-03-03T17:52:15.847" Score="0" ViewCount="438" Body="&lt;p&gt;I am trying to use &lt;code&gt;Matlab&lt;/code&gt; to compute the spectrogram of a signal but I can't seem to figure out how Matlab computes the spectrogram.Consider the case where I have a signal x(t) with M samples and I want to compute it's spectrogram using hann windows of length N and using an overlap of K samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because there are M samples and the advance time is (N - K) samples, I would expect the resultant spectrogram to have dimensions of either $N$ by $\frac{W}{(N - K)}$ OR if matlab only provides frequencies up to $\frac{f_s}{2}$ then dimensions to be $\frac{N}{2}$ by $\frac{W}{(N-K)}$ but I am getting weird dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below shows the case where I have computed the spectrogram when M = 32 * 700 = 24400, N = 256 and K = 256 - 32 = 224.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%specgram(data, ChunkSize, SampleRate, Size Of Hanning Window, Overlap (in Samples)  &#xA;    D = specgram( 1:1:(32*700),256, 8000 ,256 , 224);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;produces a 129 * 693 matrix instead of the (256 * 700) or (128 * 700) spectrogram I was expecting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Result should be an ($M$ by $\text{Number Of STFT Chuncks}$) matrix and &#xA;$$&#xA;  \text{Number Of Chunks} = \frac{\text{Number Of Samples in Signal}}{\text{Advance Time (in Samples)}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{Number Of Chunks} = \frac{32 * 700}{32} = 700&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I missed out on something? Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4376" LastActivityDate="2014-03-03T17:59:22.270" Title="How to obtain the Spectrogram of a signal" Tags="|matlab|stft|spectrogram|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14782" PostTypeId="2" ParentId="14781" CreationDate="2014-03-03T17:59:22.270" Score="5" Body="&lt;p&gt;Since the input signal is real, half of the FFT data is &quot;useless&quot; because it is simply the complex conjugate of the other half. More precisely, a 256-long FFT of a real signal will give you: the DC amplitude, 127 amplitudes, the amplitude at Nyquist, and 127 conjugate amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Among the 700 chunks, 256 / 32 - 1 = 7 extend outside the boundaries of the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, 129x693.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-03-03T17:59:22.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14784" PostTypeId="2" ParentId="14775" CreationDate="2014-03-03T18:38:37.350" Score="1" Body="&lt;p&gt;If all you need to plot the FFT spectrum (ie plot amplitude vs frequency), then just  get an array with the discrete FFT bin frequencies and plot it against the amplitudes.The frequencies only exist at the discrete locations given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  f = n\frac{f_s}{N} - \frac{f_s}{2} \hspace{2mm} \text{where n } \hspace{0.5mm} = 0, 1, 2,...N&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the amplitudes A are given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  A = \text{Magnitude(Data[n])} \hspace{2mm} \text{where n } \hspace{0.5mm} = 0, 1, 2,...N&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a 8192 long Audio signal for example, you would do something similar to what I have done in the small dirty pseudo code / C# code sample I have written below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 8192;&#xA;Sample_Rate = 44100;&#xA;float[] myAudio = new Float[N];&#xA;myAudio = getAudio();&#xA;Complex[] myFFT_Audio = FFT(myAudio);  //Returns N complex values&#xA;&#xA;//Get Array of frequency Values&#xA;float[] frequencies = new float[N]&#xA;for( i = 0 ; i &amp;lt; N; i++)&#xA;   { frequencies[i] = i * (Sample_Rate / N) - (Sample_Rate / 2); }&#xA;&#xA;//Get Amplitudes&#xA;float[] Amplitudes = new float[N]&#xA;for( i = 0; i &amp;lt; N; i++)&#xA;  { Amplitudes[i] = myFFT_Audio[i].Magnitude(); }&#xA;&#xA;//Plot Frequencies vs Amplitudes - will plot for frequencies -fs/2 to fs/2&#xA;PLOT(frequencies , Amplitudes);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to only plot the values from $0$ to $f_s/2$ instead of from $-f_s/2$ to $f_s/2$ you can discard the first half of the values and just plot the second half.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need to make sure you know what sort of data FFT samples your FFT algorithm is returning as algorithms can either return FFT samples corresponding to either frequencies ranging from $-f_s / 2$ to $f_s/2$ or from $0$ to $f_s$.The code sample above assumes the former is true but that isn't always the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab, for example, usually gives FFT samples corresponding to frequencies ranging from $0$ to $f_s$ so your frequencies in this case would just be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; f = n\frac{f_s}{N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can still get a plot from $-f_s/2$ to $f_s/2$ fairly easily though because the Fourier transform is periodic with period equal to $f_s$.&lt;/p&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="4376" LastEditDate="2014-03-03T18:47:33.083" LastActivityDate="2014-03-03T18:47:33.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14786" PostTypeId="2" ParentId="14780" CreationDate="2014-03-03T20:50:03.067" Score="0" Body="&lt;p&gt;This is kind of not really a DSP question, but assuming that the triangles are defined sufficiently (eg. you can calculate edge lengths, angles etc.), each triangle has an area of its base multiplied by its height, divided by $2$.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-03T20:50:03.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14787" PostTypeId="2" ParentId="14753" CreationDate="2014-03-03T20:53:46.130" Score="0" Body="&lt;p&gt;Maybe you are looking for something called &quot;audio fingerprinting&quot;. This might employ DSP techniques, but in this form the question might be percieved as somewhat broad. There is no one correct algorithm of this kind, rather a bunch of good ideas that can be combined in different ways.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-03T20:53:46.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14790" PostTypeId="1" CreationDate="2014-03-04T01:50:50.573" Score="3" ViewCount="146" Body="&lt;p&gt;Calculating the &lt;a href=&quot;https://en.wikipedia.org/wiki/Coherence_(signal_processing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;coherence&lt;/a&gt; (sometimes called magnitude squared coherence) between two signals indicates the presence or lack thereof of a linear transformation between the two signals.  &lt;strong&gt;Is there an analogue for signals which are related by a non-linear transformation?&lt;/strong&gt;  Let's assume that the expected non-linear transformation is known.  It would be even better if the calculation could identify the non-linear transformation within some bounds, but that is probably just wishful thinking.&lt;/p&gt;&#xA;&lt;p&gt;An example of coherence between ocean water level (due to tides) and ground water level measured in a well, taken from the Wikipedia article linked above.  This is an example of the coherence between two signals related by a linear transformation.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/AAKYD.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AAKYD.jpg&quot; alt=&quot;Coherence plot from Wikipedia&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&#xA;&lt;sub&gt;(source: &lt;a href=&quot;https://upload.wikimedia.org/wikipedia/en/7/70/Well_PBF-5_Ocean_Coherence.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikimedia.org&lt;/a&gt;)&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="7540" LastEditorUserId="7092" LastEditDate="2022-12-24T01:24:12.200" LastActivityDate="2022-12-24T01:24:12.200" Title="Is there an analogue of coherence between data sets related by a non-linear transformation?" Tags="|fourier-transform|frequency-spectrum|transform|coherence|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14794" PostTypeId="1" CreationDate="2014-03-04T06:59:30.643" Score="1" ViewCount="641" Body="&lt;p&gt;I am student of network security, and &lt;em&gt;very unfamiliar&lt;/em&gt; with the domain of signal processing. Do pardon my naivety at asking very basic stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My work deals with detecting malicious activity in network logs -say, differentiating between botnet traffic and benign Internet traffic. I came across this interesting article titled &lt;a href=&quot;http://dx.doi.org/10.1109/MSP.2006.1708419&quot; rel=&quot;nofollow&quot;&gt;Detecting and identifying malware: a new signal processing goal&lt;/a&gt;. Since then, I have been exploring the world of FFTs, DTFTs, Wavelet transforms, cepstrum and the ilk. But I have not been able to make much progress with the application of these principles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to know from dsp experts that what kind of time-series transforms can be useful for my task. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To keep things clear, I will provide a brief description of data I deal with: As I said, my task is of separating botnet traffic from Internet traffic. Lets define Internet traffic as the traffic seen from the systems of regular users of the Internet like you and me, who browse the web, watch a few videos, check mail, maybe download a few movies, and also exhibit periods of inactivity say while they sleep, eat, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And lets define botnet traffic as the traffic of a covert malware/virus (a 'bot') on your machine &lt;em&gt;calling home&lt;/em&gt; to its master or contacting fellow 'bots' (just to maintain connectivity), and also the commands sent by the master to its bots or those exchanged by bots amongst themselves. This traffic does typically have patterns and periodicity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am right, I &lt;em&gt;am&lt;/em&gt; dealing with &lt;em&gt;signals&lt;/em&gt; of botnet traffic mixed with Internet traffic (which does not have any specific pattern?) What kind of time-series transforms can be useful here? DFTs? FFTs? Cepstral analysis {or is that being too creative? :)}&lt;/p&gt;&#xA;" OwnerUserId="8117" LastEditorUserId="8117" LastEditDate="2014-03-04T11:07:42.070" LastActivityDate="2014-03-04T19:35:54.583" Title="How can I use time-series transforms for detecting malware?" Tags="|fft|dft|cepstral-analysis|" AnswerCount="1" CommentCount="6" ClosedDate="2014-03-21T00:02:20.187" ContentLicense="CC BY-SA 3.0" />
  <row Id="14795" PostTypeId="2" ParentId="1004" CreationDate="2014-03-04T07:16:50.207" Score="0" Body="&lt;p&gt;I find myself coming back to this post time and time again.  Thank you for asking the question.  Here is a great, computationally-friendly implementation of the leaky integrator in C (intended for a microcontroller).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, some rearrangement:&#xA;y = α * x + (1 − α) * y_last&#xA;  = α * (x - y_last) + y_last&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if we restrict α to be about 12%, 25%, 50%, (1/8, 1/4, 1/2,...).  We can take advantage of some efficient bit-shifting.  Taking the case of 1/8, 8 =&gt; 2^3 =&gt; (downshift 3 times) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;= (x - y_last) / 8 + y_last&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define SMOOTHING_FACTOR       (3)&#xA;&#xA;int16_t FilterSample(int16_t new_sample)&#xA;{&#xA;  static int16_t last_result = 0;&#xA;&#xA;  // Each bit shift down is equivalent to dividing-by-two&#xA;  last_result = (new_sample - last_result) &amp;gt;&amp;gt; SMOOTHING_FACTOR) + last_result;&#xA;&#xA;  return last_result;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="8116" LastActivityDate="2014-03-04T07:16:50.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14796" PostTypeId="1" CreationDate="2014-03-04T08:02:09.690" Score="1" ViewCount="222" Body="&lt;p&gt;I am working on bearing faults.I did the high pass filter and then calculated the envelope of the signal in the time domain. I then found its fourier. The fft spectrum is still not clear. My fundamental frequencies are not visible clearly. Do i need to filter it further?&lt;/p&gt;&#xA;" OwnerUserId="8085" LastActivityDate="2014-08-05T03:22:58.333" Title="filtering fft spectrum further?" Tags="|fft|signal-analysis|highpass-filter|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14797" PostTypeId="2" ParentId="14790" CreationDate="2014-03-04T08:24:48.467" Score="1" Body="&lt;p&gt;Are you interested in coherence's ability to discriminate correlations at different frequencies, or are you interested in any measure of non-linear correlation? Coherence is basically cross-correlation in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mutual information can measure non-linear correlations, but says nothing about the form of the correlation. It's also difficult to estimate accurately without large amounts of data (kernel density estimation is a popular tool to help with that right now, though I think cupolas have begun to gain traction).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know that anybody has done so, but you could alternatively use one signal to predict another using an artificial neural network with one hidden layer. Your correlation metric could then be something like an RMSE between predicted and target signals. It feels like a hack, though. With some work you could try to infer something about the relationship type based on the trained weights of the network. I'm not an expert, but I don't know of a formal framework to actually do that. It's also not an established metric, so you have to also do the work to convince people that it's meaningful (much more difficult if you can't cite sources that did it before you).&lt;/p&gt;&#xA;" OwnerUserId="8062" LastActivityDate="2014-03-04T08:24:48.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14799" PostTypeId="1" AcceptedAnswerId="14800" CreationDate="2014-03-04T10:16:11.537" Score="1" ViewCount="1299" Body="&lt;p&gt;I'm trying to write a simple script that should plot the spectrum in scilab, to test it I use a  sinus function with 440hz so that I get my dirac in this position , my problem is that it doesn't work and I don't understand why? &#xA;here's the code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 8000;&#xA;f = 440;&#xA;t= 0:1/Fs:1;&#xA;y = sin(2*%pi*f*t);&#xA;&#xA;nf = 1024; // number of point in the DFT&#xA;Y = fft(y)&#xA;f = Fs/2  * linspace(0,1,nf/2+1);&#xA;clf();&#xA;plot(f,abs(Y(1:nf/2+1))); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and this is what I get : &#xA;&lt;img src=&quot;https://i.stack.imgur.com/G8zsv.png&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any idea why I get this ? &lt;/p&gt;&#xA;" OwnerUserId="1785" LastActivityDate="2018-05-30T20:44:37.420" Title="can't get the right spectrum in scilab" Tags="|matlab|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14800" PostTypeId="2" ParentId="14799" CreationDate="2014-03-04T10:33:50.360" Score="3" Body="&lt;p&gt;Your fft vector Y has the same length as your input signal y, because you just specified nf without letting fft() know what your desired FFT-length is. This is why your peak does not appear at 440 Hz. Your vector Y does not correspond to the frequencies in f. It's just a matter of correct scaling of the x-axis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I do not know scilab, so I don't know how to pass the desired FFT-length to fft(). If you can't do that, you just need to make your time domain signal have the desired FFT-length.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-04T10:33:50.360" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14801" PostTypeId="1" AcceptedAnswerId="14838" CreationDate="2014-03-04T11:59:46.427" Score="1" ViewCount="866" Body="&lt;p&gt;I am recording a 17khz signal at a sample freq of 44.1khz. I want to perform cross-correlation between the received and transmitted signals for calculating TDOA. But when I do xcorr, the results are inconsistent. Is it because my sample freq is too low for my signal freq? If so, how can I overcome this? Will upsampling help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;My received signal also consists of noise. I am passing my received signal through a bandpass filter with limits 16khz to 18khz. I am using butterworth filter. Is it better to use FIR filter instead?&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="6940" LastEditDate="2014-03-06T05:27:53.097" LastActivityDate="2014-03-06T05:27:53.097" Title="Upsampling signal for cross correlation" Tags="|cross-correlation|interpolation|ultrasound|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14804" PostTypeId="1" CreationDate="2014-03-04T14:00:30.830" Score="4" ViewCount="2933" Body="&lt;p&gt;I referred the below papers to understand the working of Phase Encoding,but the explanation is not proper.Just a few steps have been given in brief.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ijcsi.org/papers/IJCSI-9-1-2-402-406.pdf&quot; rel=&quot;nofollow&quot;&gt;ijcsi.org&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ijarcce.com/upload/june/11_LSB%20Modification%20and%20Phase%20Encoding%20Technique%20of%20Audio%20Steganography%20Revisited.pdf&quot; rel=&quot;nofollow&quot;&gt;www.ijarcce.com&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please explain the concept of how Audio Steganography using Phase Encoding works?&lt;/p&gt;&#xA;" OwnerUserId="8119" LastEditorUserId="21075" LastEditDate="2020-05-09T14:53:53.370" LastActivityDate="2020-05-09T14:53:53.370" Title="Audio steganography using phase encoding technique" Tags="|fft|audio|phase|steganography|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14805" PostTypeId="1" AcceptedAnswerId="14807" CreationDate="2014-03-04T14:15:45.013" Score="2" ViewCount="256" Body="&lt;p&gt;I have a situation where a sampled signal is passed through a DAC and re-sampled by a switched capacitor circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see a model for this in the literature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard model of a DAC is the ZOH. But when it gets re-sampled by the switched cap circuit it seems to me that ZOH effect of the DAC disappears because of the re-sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does the Signal Processing SE community think?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the re-sampling is at the same rate as the DAC.&lt;/p&gt;&#xA;" OwnerUserId="8120" LastEditorUserId="21075" LastEditDate="2020-04-29T20:56:25.590" LastActivityDate="2020-04-29T20:56:25.590" Title="What's the model for a DAC followed by a sampler?" Tags="|sampling|digital-to-analog|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14806" PostTypeId="2" ParentId="14805" CreationDate="2014-03-04T15:06:45.513" Score="2" Body="&lt;p&gt;It depends on how acccurate your model is. For an ideal DAC with rectangular impulse response $g(t)$ followed by an ideal sampler your observation is true: the sampled signal is identical to the DAC input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as soon as some frequency selective element comes into play (e.g. anti-aliasing filter) the impulse repsonse $g(t)$ causes a droop in frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-03-04T15:06:45.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14807" PostTypeId="2" ParentId="14805" CreationDate="2014-03-04T15:10:20.260" Score="5" Body="&lt;p&gt;What kind of DAC is that? Standard instrumentation DAC (modeled by a ZOH, with a negligible settling time and no reconstruction filter) or something fancier?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's happening could be described in the following terms: in the short analog land between the DAC and the rest of the circuit, you see your signal with mirror images of its spectrum above Nyquist frequency (amplitude decreasing with frequency, as your ZOH is equivalent to a multiplication of the spectrum by a sinc function). The switched capacitor circuit resamples this signal; but since its sample rate is the same as that of the original signal, there is no aliasing - the mirror images created by the DAC/ZOH will line up perfectly with the original harmonics.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-03-04T15:10:20.260" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14808" PostTypeId="1" AcceptedAnswerId="14935" CreationDate="2014-03-04T15:26:00.470" Score="9" ViewCount="9090" Body="&lt;p&gt;I am trying to get a frequency response vs dB SPL plot for recorded sounds. I have a microphone with a flat response, a sensitivity of 4mV/Pa, and 1 Pa = 94dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the dB SPL, I have the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$dB SPL = 94 + 20 \cdot \log_{10}(AI/0.004)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where AI in the input voltage from the microphone, and assuming no gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to work to get the overall dB SPL level for the signal, using peak voltage as AI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how can I apply this to an FFT of the input signal, to get the intensity level per frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw &lt;a href=&quot;https://dsp.stackexchange.com/questions/1059/how-do-you-plot-an-spl-vs-frequency-curve-for-a-given-set-of-pressure-data/&quot;&gt;this&lt;/a&gt; post, and am not sure how to adapt this to input voltage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some python code to demonstrate what I have thus far, my goal is to apply this to ultrasonic signals that contain many different frequency components.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;fs = 5e5&#xA;duration = 1&#xA;npts = fs*duration&#xA;t = np.arange(npts, dtype=float)/fs&#xA;f = 1000&#xA;amp = 1.414*0.004   &#xA;signal = amp * np.sin((f*duration) * np.linspace(0, 2*np.pi, npts))&#xA;&#xA;rms = np.sqrt(np.mean(signal**2))&#xA;dbspl = 94 + 20*np.log10(rms/0.004)&#xA;&#xA;sp = np.fft.fft(signal)&#xA;freq = np.arange(npts)/(npts/fs)&#xA;&#xA;sp_db = 94 + 20*np.log10(???)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8056" LastEditorUserId="8202" LastEditDate="2022-08-23T14:47:39.013" LastActivityDate="2022-08-23T14:47:39.013" Title="SPL values from FFT of microphone signal" Tags="|fft|audio|python|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14809" PostTypeId="1" CreationDate="2014-03-04T15:42:19.253" Score="1" ViewCount="42" Body="&lt;ol&gt;&#xA;&lt;li&gt;I have an on going input signal, most of the time with no activity.&lt;/li&gt;&#xA;&lt;li&gt;Once in a while there is an activity (oscillations in different freq).&lt;/li&gt;&#xA;&lt;li&gt;I need to take &lt;strong&gt;good&lt;/strong&gt; 205 samples out of the signal. &#xA;what i mean by &lt;strong&gt;good&lt;/strong&gt;?&#xA;really oscillating signal for 205 samples (not just crossing threshold).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;here is an image to clarify:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/E2v2K.jpg&quot; alt=&quot;oscillating signal&quot;&gt;&#xA;bubble 1 - not good selection.&#xA;bubble 2 - good selection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need an efficient way with low computation complexity (for example STFT is heavy), to measure signal's sections oscillation level and chose the best one for further processing, someone knows?&lt;/p&gt;&#xA;" OwnerUserId="8122" LastActivityDate="2014-03-04T15:42:19.253" Title="select meaningful part out of a signal (for goertzel)" Tags="|signal-analysis|algorithms|preprocessing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14812" PostTypeId="1" CreationDate="2014-03-04T16:19:36.480" Score="0" ViewCount="557" Body="&lt;p&gt;I have I and Q samples of a time domain signal, sampled at a rate T, both of length L.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I create the complex envelope, &lt;code&gt;C = sampleI+j*sampleQ&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then take the FFT of C based on Matlab's FFT help algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs=1/T;&#xA;NFFT = 2^nextpow2(L)&#xA;Y = fft(C,NFFT)/L&#xA;fvar = (0:NFFT/2)*(Fs/NFFT)&#xA;plot(fvar,2*abs(Y))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The frequency content of the complex envelope should only contain positive frequencies but the FFT returns results symmetric in frequency so is there anything I need to do to C or to Y to interpret the results properly?  Do I just throw away the upper half of the frequency components in the FFT result?&lt;/p&gt;&#xA;" OwnerUserId="8123" LastEditorUserId="7092" LastEditDate="2014-03-04T16:39:10.333" LastActivityDate="2014-03-04T16:39:10.333" Title="FFT of complex envelope" Tags="|fft|analytic-signal|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14815" PostTypeId="1" AcceptedAnswerId="14822" CreationDate="2014-03-04T17:07:17.770" Score="0" ViewCount="368" Body="&lt;p&gt;We know that when we window a signal, we increase the main-lobe width. Let 'main-lobe-width' here be the null-to-null bandwidth of the main lobe. Let us further more say that the main-lobe width of a square window is '1'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to know, is given a particular symmetric window, is there a closed form solution for how much the main-lobe will increase by, relative to that of a square window?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can look up this percentage increase for various windows just fine by the way. I am asking if there is a closed form solution for what the percentage increase is, given an arbitrary symmetric window.&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2014-03-05T09:47:28.930" Title="Is there a closed form expression for main-lobe width increase given a window?" Tags="|filters|fourier-transform|window-functions|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14819" PostTypeId="2" ParentId="14794" CreationDate="2014-03-04T19:35:54.583" Score="2" Body="&lt;p&gt;The point seems to be moot. An attacker could hide in noise. Any meaningful interpretation of the question appears to aim for temporal regularity of attacks. Maybe an attack is temporally regular, but so is users' behavior. So, there might be lots of applications for transforms in malware detection, but none of them appears to promise any insight on how to recognize or intercept it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a computer science standpoint i would say that ,,recognizing malware'' is akin to the problem of recognizing two functions as equal, which in general is a proof, which is not computable in any ordinary sense. It would probably amount to proving P=NP. Any ,,heuristic'' recognition of malware can be evaded that way. The only system capable of actually and reliably recognizing malware appears to be a conscious human being.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-04T19:35:54.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14822" PostTypeId="2" ParentId="14815" CreationDate="2014-03-05T09:47:28.930" Score="2" Body="&lt;p&gt;If I understand you correctly, you are in fact asking for a closed-form solution for the position of the first zero of a given window function. Such a solution cannot exist, because what you would need is an analytic solution to a polynomial equation, which does not exist for polynomials of degree 5 or higher (that's the &lt;a href=&quot;http://en.wikipedia.org/wiki/Abel%E2%80%93Ruffini_theorem&quot; rel=&quot;nofollow&quot;&gt;Abel-Ruffini Theorem&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-05T09:47:28.930" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14823" PostTypeId="1" CreationDate="2014-03-05T10:25:10.043" Score="0" ViewCount="52" Body="&lt;p&gt;first of all, I am not a technician, but I would really appreciate your helping with one (I hope simple or trivial) issue. I recorded a signal (skin conductance level - SCL, uS unit) with my device - 16 bit, range of the measured SCL is 1-20 uS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a recording software I changed digital upper range - &quot;digital maximum&quot; - from 1024 to 65536 (minimum = 0).&lt;img src=&quot;https://i.stack.imgur.com/sYrsK.png&quot; alt=&quot;Element where I changed Digital maximum to 65536&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that when I record the signal and the signal reaches about the half of the physical maximum (the range the device can measure SCL = 1-20uS), from the recorded signal I see something like &quot;inverted-across-zero&quot; values, they have negative values but as it is from oscilatory parts obvious, when the signal is lower than the bound about 10,5 uS then it is above zero value, when it exceeds 10,5 uS it become inverted and the values are (deposited) under zero axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can this &quot;phenomenon&quot; be caused due to my stupid change of digital maximum to 65536?&#xA;Thank you for any help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;M.&lt;/p&gt;&#xA;" OwnerUserId="8135" LastActivityDate="2014-03-05T14:51:57.860" Title="Inverted values - digital resolution issue?" Tags="|digital|resolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14824" PostTypeId="1" AcceptedAnswerId="14826" CreationDate="2014-03-05T10:49:15.337" Score="3" ViewCount="1065" Body="&lt;p&gt;I have a small input signal of 60Hz sine wave from signal generator, which is corrupted with 50Hz mains supply frequency. I want to measure the amplitude of the 60Hz signal using FFT because it is very small to see in the oscilloscope.&lt;br&gt;&#xA;The Matlab FFT code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = data;    &#xA;Fs = 2048;&#xA;[r, L] = size(y);&#xA;NFFT = 2^nextpow2(L); % Next power of 2 from length of y&#xA;Y = fft(y,NFFT)/L;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;% Plot single-sided amplitude spectrum.&#xA;plot(f,2*abs(Y(1:NFFT/2+1))) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the FFT plot doesn't give a sharp peak at 50 and 60Hz. The plot looks like this: &lt;img src=&quot;https://i.stack.imgur.com/LGT10.png&quot; alt=&quot;zoomed&quot;&gt;. The consecutive points have high and low amplitude alternatively which gives a saw-tooth like plot. Why is it so? Is the amplitude of 60Hz affected by this?&lt;/p&gt;&#xA;" OwnerUserId="8136" LastActivityDate="2014-03-05T15:00:35.687" Title="FFT plot in Matlab, accuracy" Tags="|matlab|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14825" PostTypeId="2" ParentId="14823" CreationDate="2014-03-05T11:53:45.457" Score="1" Body="&lt;p&gt;This looks like a &quot;signed number&quot; problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An unsigned binary number with n bits has a range from 0 to 2^n -1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But a Signed number weights the MSB as -2^(n-1) so the range is -2^(n-1) to 2^(n-1) -1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9B0Vv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider an unsigned signal going from 0 to 255 being viewed as though it was a 2's complement number. Notice how it would look as though it flips from +127 to -128 and continue up to -1 (255 corresponds to -1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that what you're seeing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice that you're max digital value is 65536. But the maximum value a 16 bit unsigned number can hold is 65535 .. 2^16 -1&lt;/p&gt;&#xA;" OwnerUserId="8120" LastEditorUserId="8120" LastEditDate="2014-03-05T12:11:08.633" LastActivityDate="2014-03-05T12:11:08.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14826" PostTypeId="2" ParentId="14824" CreationDate="2014-03-05T12:57:56.177" Score="2" Body="&lt;p&gt;The phenomenon you see is called &quot;window effect&quot; or also &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot; rel=&quot;nofollow&quot;&gt;spectral leakage&lt;/a&gt;&quot;. It occurs because ideally you would like to analyze an infinitely long signal (which would give you ideal peaks in the frequency domain), but actually you analyze a truncated (windowed) signal. In fact you multiply your signal with a window function - in your case a simple rectangular window - which in the frequency domain corresponds to a convolution with the frequency response of the window. This gives you the effect that you see. You can try different &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window functions&lt;/a&gt;, but you will not get rid of the basic effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, for the plot you could try using values in dB, i.e. use $20\log (|Y|)$ instead of a linear plot; this will make things look a bit better.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-05T12:57:56.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14827" PostTypeId="1" CreationDate="2014-03-05T13:16:08.653" Score="5" ViewCount="1766" Body="&lt;p&gt;I want to create a project that will recognized the chords that i played in guitar.&#xA;I recorded a raw sound to be compare to the one that the user will input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a recorded sound chordA then I will ask the user to play a sound in the guitar and check if the signal is similar to my sound chordA..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting the audio signal is easy but comparing them is so hard. What is the method that will suit my application? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;recObj = audiorecorder; &#xA;disp('Start speaking.') &#xA;recordblocking(recObj, 4); &#xA;disp('End of Recording.'); &#xA;myRecording = getaudiodata(recObj); &#xA;wavwrite(myRecording,'chordread.wav'); &#xA;[x, Fs] = wavread('chordread.wav'); &#xA;[x1, Fs1] = wavread('chordA.wav'); &#xA;Y = fft(x); &#xA;Z = fft(x1); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now that I have &lt;code&gt;Y&lt;/code&gt; and &lt;code&gt;Z&lt;/code&gt; how can I compare those two?&lt;/p&gt;&#xA;" OwnerUserId="8137" LastEditorUserId="7092" LastEditDate="2020-03-29T14:17:44.033" LastActivityDate="2020-03-29T14:17:44.033" Title="How do I compare chords played on a guitar with a known sample?" Tags="|fft|discrete-signals|signal-analysis|music|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14828" PostTypeId="2" ParentId="14827" CreationDate="2014-03-05T13:52:54.710" Score="1" Body="&lt;p&gt;I'm afraid that there is no simple and straightforward way to solve your problem. The spectrum of the recording of chords contains too much redundant and unspecific information, so I do not think that you can base your comparison on the output of an FFT. You probably need to extract robust features which don't contain any irrelevant information. This will take quite some research effort. You should take a look at feature extraction used in speech recognition or music recognition.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-05T13:52:54.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14829" PostTypeId="2" ParentId="14827" CreationDate="2014-03-05T14:13:42.393" Score="5" Body="&lt;p&gt;You probably need more than one algorithm for an accurate detection. Work on frequency domain (mostly via DFT and spectrogram) is the most often used initial transform. After that sophisticated probabilistic models originally used in speech recognition are applied, such as hidden Markov models, dynamic Bayesian networks, and conditional random fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The review article &lt;a href=&quot;http://schall-und-mauch.de/artificialmusicality/2010/08/automatic-chord-transcription-using-computational-models-of-musical-context-2/&quot;&gt;Automatic Chord Transcription Using Computational Models of Musical Context&lt;/a&gt; gives you a thorough overview on the relevant technique, although it focuses on a more complicated chords recognition with more than one instrument (key, bass note, beat are all considered as well). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also some open source chord detection algorithms:&#xA;&lt;a href=&quot;http://isophonics.net/nnls-chroma&quot;&gt;Chordino&lt;/a&gt;, &lt;a href=&quot;http://clam-project.org/&quot;&gt;Chordata&lt;/a&gt;, and&lt;br&gt;&#xA;&lt;a href=&quot;http://labrosa.ee.columbia.edu/projects/chords/&quot;&gt;LabROSA Chord Recognition&lt;/a&gt;. Note that in LabROSA, a supervised learning method is applied to &quot;teach&quot; the model recognize the chords with higher accuracy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very interesting topic, and I look forward to see your update in your guitar chord detection result.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-03-05T14:13:42.393" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14830" PostTypeId="2" ParentId="14823" CreationDate="2014-03-05T14:51:57.860" Score="0" Body="&lt;p&gt;Yes.  It appears your method of &quot;seeing&quot; a sample is limited to a maximum of 32767 (typical for 16-bit signed twos-complement number representations or formats), so a larger sample value (anything larger than 32767 up to your setting of 65536) won't fit, and will thus be seen as a wrong value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can fix this at least in two ways.  Decrease the max range, or use a sample storage and display number format that can display larger values (32-bit floats, for instance).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-05T14:51:57.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14831" PostTypeId="2" ParentId="14824" CreationDate="2014-03-05T15:00:35.687" Score="1" Body="&lt;p&gt;If the 50 or 60 Hz signals aren't at frequencies whose periods are exact sub-multiples of the FFT length, then you will see  the effects of the rectangular windowing of your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also possible that your 50 Hz signal is not a perfectly pure sinusoid, and thus you will see the sidebands due to the modulations of the center frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-05T15:00:35.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14832" PostTypeId="2" ParentId="14827" CreationDate="2014-03-05T15:13:12.857" Score="0" Body="&lt;p&gt;For each note, a guitar produces a mix of overtones that changes over time.  The composite spectrum of multiple notes in a chord isn't likely to match that produced by another guitar strummed by a different person,  so a simple FFT matching procedure will have some (perhaps large, depending on your matching method) probability of failure.  Thus the need to look at research paper on the topic, and see if the test conditions and goals of the research suitably matches the requirements of your project.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-05T15:13:12.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14833" PostTypeId="2" ParentId="14827" CreationDate="2014-03-05T16:08:27.107" Score="1" Body="&lt;p&gt;In terms of difficulty, your solution will be half-way between comparing raw FFTs and the kind of research cited by lennon310.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chord transcription from polyphonic music recordings (fully produced songs) presents a bunch of challenges such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Notes of a chord can be spread across the time axis (for example, the lead sheet might mention a &quot;C&quot; chord, but the guitar player will slowly strum each note in sequence).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Notes of a chord can be spread across several instruments - the root note played by the bass, the fifth by a background synth and the third in the vocals.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The recognition system must be robust to chord inversions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The system must make abstraction of the timbre of the instrument playing the chord.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The boundaries between chords are not known in advance.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;None of these are going to be problems for you, since what you need to recognize are single chords whose start and end time correspond to the start and end of your signal, played with the same inversion structure as the template, and probably with the same octave, and with an instrument of vaguely similar timbre.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would thus suggest the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One big FFT of the entirety of the recording.&lt;/li&gt;&#xA;&lt;li&gt;Mapping of the FFT data to a constant-Q scale (such as quartertones).&lt;/li&gt;&#xA;&lt;li&gt;If necessary, the same NNLS estimation as in Matthias Mauch's paper - to emphasize fundamentals and attenuate harmonics - with a parameter $s$ (decay of the template harmonic combs) fine-tuned for the guitar. This gives you a vector akin to a &quot;piano roll&quot; slice.&lt;/li&gt;&#xA;&lt;li&gt;Comparison (by mean of scalar product) between the resulting vector and the template.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In particular, there is no need to use chroma features, since this would neutralize transposition/inversions errors that you might want to identify.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-03-05T16:13:52.150" LastActivityDate="2014-03-05T16:13:52.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14834" PostTypeId="1" AcceptedAnswerId="14848" CreationDate="2014-03-05T16:38:06.767" Score="0" ViewCount="1123" Body="&lt;p&gt;The $\frac{d_1}{d_2}&amp;lt;0.6$ gives a large number of false matches and it assumes the nearest neighbour is a correct match. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody knows any good method to reduce number of false matches or filter them ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we use k-NN matches instead of $\frac{d_1}{d_2}&amp;lt;0.6$ ratio for matching the SIFT features and then choose the best of k points by:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Changing the Euclidean distance by considering the spatial neighbourhood, or&lt;/li&gt;&#xA;&lt;li&gt;Spatial neighbourhood matching.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Anybody ever tried something like that? Or any paper related?&lt;/p&gt;&#xA;" OwnerUserId="7904" LastEditorUserId="8202" LastEditDate="2014-06-04T13:59:13.123" LastActivityDate="2014-10-03T11:49:10.000" Title="k-NN match for object recognition" Tags="|image-processing|object-recognition|sift|knn|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14836" PostTypeId="1" AcceptedAnswerId="14837" CreationDate="2014-03-05T19:59:20.000" Score="1" ViewCount="2067" Body="&lt;p&gt;How can I generate an NxM DCT matrix? In Matlab &lt;code&gt;dctmtx&lt;/code&gt; function generates only square matrix (NxN).&lt;/p&gt;&#xA;" OwnerUserId="8139" LastEditorUserId="7092" LastEditDate="2014-03-05T20:34:44.490" LastActivityDate="2014-03-05T20:44:20.857" Title="NxM DCT matrix generation" Tags="|matlab|dct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14837" PostTypeId="2" ParentId="14836" CreationDate="2014-03-05T20:44:20.857" Score="1" Body="&lt;pre&gt;&lt;code&gt;type dctmtx&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you will get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function c = dctmtx(n) &#xA;[cc,rr] = meshgrid(0:n-1); &#xA;c = sqrt(2 / n) * cos(pi * (2*cc + 1) .* rr / (2 * n)); &#xA;c(1,:) = c(1,:) / sqrt(2); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it's not that hard to generate an non-square DCT matrix, just with minor revision:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function c = dctmtx1(n,m) &#xA;[cc,rr] = meshgrid(0:n-1, 0:m-1); &#xA;c = sqrt(2 / n) * cos(pi * (2*cc + 1) .* rr / (2 * n)); &#xA;c(1,:) = c(1,:) / sqrt(2); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-03-05T20:44:20.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14838" PostTypeId="2" ParentId="14801" CreationDate="2014-03-05T22:47:22.713" Score="0" Body="&lt;p&gt;A narrow-band filter may remove some of the bandwidth of the signal containing timing information of the signal's envelope modulation.  The narrower the filter, the more any tone burst will be smeared out in time.  Upsampling after the timing information is destroyed won't help much.  Using a wider bandwidth signal, channel, and filter, with perhaps a higher sampling rate to support that bandwidth, will help improve time estimation accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A chirp, or other large frequency modulation is one common method used to increase a signal's bandwidth to allow better timing estimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that any real signal with a frequency near either DC or Fs/2 can face strong interference from it's negative frequency conjugate image in the frequency domain, as well as any of the images sidebands, which can also greatly distort the signal envelope and the envelopes timing information in the received sampled data.  A higher sampling rate can also help solve this problem for high frequency tones.  (And a longer sample window length for near DC signals.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-05T23:14:31.693" LastActivityDate="2014-03-05T23:14:31.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14839" PostTypeId="1" CreationDate="2014-03-06T06:46:00.883" Score="0" ViewCount="932" Body="&lt;p&gt;I tried the following code for modulation of two analog waves. Can anyone point to how to modulate and demodulate for an analog and a digital wave? I tried by replacing the second signal (x2) with a digital pulse but I am not able to recover the analog wave after demodulation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T = 1;&#xA;Fs = 44100;&#xA;t = 0:1/Fs:T;&#xA;Fc = 17000;&#xA;&#xA;f1 = 100;&#xA;x1 = sin(2*pi*f1*t);&#xA;f2 = 200;&#xA;x2 = sin(2*pi*f2*t);&#xA;&#xA;Cs = sin(2*pi*Fc*t);&#xA;Cc = cos(2*pi*Fc*t);&#xA;&#xA;%%Modulation&#xA;mod_wav = x1.*Cs + x2.*Cc;&#xA;&#xA;%%Demodulation&#xA;demod_x1 = mod_wav.*Cs;&#xA;demod_x2 = mod_wav.*-Cc;&#xA;&#xA;%%filter&#xA;fpass = 10; fstop = 500; N = 30;&#xA;b = firls(N,[0 fpass fstop Fs/2]/Fs/2, [1 1 0 0], [1 1]);&#xA;filt_x1 = filter(b,1,demod_x1);&#xA;filt_x2 = filter(b,1,demod_x2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above code, if i use butter filter, then it is properly working but not if i use FIR like above. Why is that? In a broader sense, when to use butter and and when to use FIR filter?&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="6940" LastEditDate="2014-03-07T05:11:27.637" LastActivityDate="2014-03-08T03:48:25.100" Title="QAM for analog and digital waves" Tags="|matlab|digital-communications|modulation|demodulation|" AnswerCount="1" CommentCount="4" ClosedDate="2014-03-19T00:04:40.083" ContentLicense="CC BY-SA 3.0" />
  <row Id="14840" PostTypeId="1" CreationDate="2014-03-06T06:51:21.760" Score="0" ViewCount="92" Body="&lt;p&gt;I am reading some paper, and I am having some trouble with some Fourier transform,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that $F(\omega)$ is the Fourier transform of $f(x)$, i.e. where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=\int_{-\infty}^{\infty}f(x)e^{-i\omega x}\,dx.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is $$\frac{1}{2\pi}\int_{-\infty}^{\infty}\frac{F(\omega-a)}{i\omega}e^{i\omega x}\,d\omega ?$$&#xA;I was thinking of using the time integration property, since $i\omega$ appears at the denominator, but I am not sure how to start it.&lt;/p&gt;&#xA;" OwnerUserId="5014" LastActivityDate="2014-03-06T11:49:46.903" Title="problem with Fourier transform" Tags="|fourier-transform|integration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14842" PostTypeId="1" CreationDate="2014-03-06T09:50:16.527" Score="0" ViewCount="144" Body="&lt;p&gt;I have project in which I'll work on audio files using Matlab, I'll be listing to different  machine and should get thei rotational speeds, which is kind of periodic, my question how should I analyse this should I  work with the spectrum and its magnitude using the &lt;code&gt;fft&lt;/code&gt; or should I use the PSD , which is the result of &lt;code&gt;pwelch&lt;/code&gt;. &#xA;I'm not asking for code! thanks for your help &lt;/p&gt;&#xA;" OwnerUserId="1785" LastActivityDate="2014-06-04T17:47:07.623" Title="how to process audio files in Matlab" Tags="|matlab|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14843" PostTypeId="2" ParentId="14840" CreationDate="2014-03-06T10:16:40.707" Score="2" Body="&lt;p&gt;Since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x)=\frac{1}{2\pi}\int_{-\infty}^{\infty}F(\omega)e^{i\omega x}d\omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you are looking for the inverse transform of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega)=\frac{F(\omega-a)}{i\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at a table of Fourier transform correspondences you will find&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{F(\omega)}{i\omega}\Longleftrightarrow \int_{-\infty}^x f(y)dy$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega-a)\Longleftrightarrow e^{iax}f(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, the function whose Fourier transform is $G(\omega)$ is the integral of a modulated version of $f(x)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega)\Longleftrightarrow \int_{-\infty}^x e^{iay}f(y)dy$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correspondence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{F(\omega)}{i\omega}\Longleftrightarrow \int_{-\infty}^x f(y)dy\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assumes that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(0)=\int_{-\infty}^{\infty} f(x)dx=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumption is often made implicitly because it is a standard requirement (obviously, a sufficient one) for the Fourier transform to exist. If&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(x)=\int_{-\infty}^x f(y)dy$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it simply means that $g(x)$ is a well-behaved function satisfying $\lim_{x\rightarrow\infty}g(x)=0$. However, it is also possible to compute the Fourier transform of functions that do not satisfy this condition. In this case, the correspondence (1) has to be modified:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{F(\omega)}{i\omega}+\pi F(0)\delta(\omega)\Longleftrightarrow \int_{-\infty}^x f(y)dy\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which obviously simplifies to (1) if $F(0)=0$. If this condition is not satisfied, the result for the inverse transform of $G(\omega)$ given above must be modified by an additive constant:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega)\Longleftrightarrow \int_{-\infty}^x e^{iay}f(y)dy-\frac{1}{2}\int_{-\infty}^{\infty}e^{iax}f(x)dx$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-03-06T11:49:46.903" LastActivityDate="2014-03-06T11:49:46.903" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="14845" PostTypeId="1" CreationDate="2014-03-06T10:44:00.457" Score="1" ViewCount="529" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/53M9m.jpg&quot; alt=&quot;histogram&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is a recursive way of finding threshold in the image using histogram that are biomodal, and is as follows:&lt;/p&gt;&#xA;&lt;p&gt;An automated procedure for bimodal histograms :&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select an initial estimate of T&lt;/li&gt;&#xA;&lt;li&gt;Compute the means of the two regions determined  by T&lt;/li&gt;&#xA;&lt;li&gt;Set the new T as the average of the two means&lt;/li&gt;&#xA;&lt;li&gt;Repeat steps 2,3 until the difference in T in  successive iterations is smaller than a predefined  parameter&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I have an old exam question below and I dont know how to solve it. all I know the T is &lt;span class=&quot;math-container&quot;&gt;$114$&lt;/span&gt; and if this also helps total number of pixels are area first triangle+are of second triangle area + 4000 pixels. I am stuck on how to calculate step 2 to get me going.&lt;/p&gt;&#xA;&lt;h2&gt;Old Exam Question&lt;/h2&gt;&#xA;&lt;p&gt;explain why the isodata threshold of image is equal to &lt;span class=&quot;math-container&quot;&gt;$114$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5773" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-03-07T22:02:30.147" Title="GLOBAL THRESHOLDING using histogram" Tags="|image-processing|image-segmentation|homework|histogram|thresholding|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14847" PostTypeId="1" CreationDate="2014-03-06T09:05:52.370" Score="0" ViewCount="258" Body="&lt;p&gt;let's assume I have two time series: one with a delta peak at position $x$ and another time series with a minimum phase wavelet that starts at time $y$ with a maximum peak at position $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when I convolve both time series, is the beginning of my minimum-phase wavelet at position $x$ or is the maximum amplitude of the minimum-phase wavelet at position $x$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know, that when I convolve a zero-phase wavelet, the maximum amplitude is at the position of the delta function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am puzzled..........&lt;/p&gt;&#xA;" OwnerUserId="8071" OwnerDisplayName="MichaelScott" LastEditorUserId="8071" LastEditDate="2014-03-06T12:19:15.883" LastActivityDate="2014-06-04T15:47:07.413" Title="Convolve a minimum phase wavelet with delta peak" Tags="|wavelet|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14848" PostTypeId="2" ParentId="14834" CreationDate="2014-03-06T12:10:05.727" Score="0" Body="&lt;p&gt;Generally, one wouldn't gain much from such parameter tuning or workarounds.&#xA;The accuracy heavily depends on the image features that you are using, together with KNN algorithm. If you are using an approximate ANN, try using FLANN. In FLANN, increasing the number of trees and the iterations contribute to the accuracy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To improve the matching accuracy, enhancements over descriptors are also possible. Zisserman proposes RootSift, which is very easy to implement and enhances SIFT with an intuitive modification:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/publications/2012/Arandjelovic12/arandjelovic12.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.robots.ox.ac.uk/~vgg/publications/2012/Arandjelovic12/arandjelovic12.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also other good details in this paper.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Other than that, if you are already using BoW, you end up with sparse features. For a more meaningful representation, try VLAD (&lt;a href=&quot;http://www.vlfeat.org/api/vlad.html&quot; rel=&quot;nofollow&quot;&gt;http://www.vlfeat.org/api/vlad.html&lt;/a&gt;). Yet, a quantization through a vocabulary tree as in Nister and Stewinius (&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.61.9520&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.61.9520&lt;/a&gt;) would help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imposing spatial neighborhoods isn't straightforward, but can be done. However, I recommend you to first try the aforementioned methods with post processing (geometric verification). A nice one is found here: &lt;a href=&quot;http://web.stanford.edu/~sstsai/selected_papers/2010_GeometricReranking.pdf&quot; rel=&quot;nofollow&quot;&gt;http://web.stanford.edu/~sstsai/selected_papers/2010_GeometricReranking.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-10-03T11:49:10.000" LastActivityDate="2014-10-03T11:49:10.000" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14849" PostTypeId="1" AcceptedAnswerId="14854" CreationDate="2014-03-06T12:33:50.210" Score="1" ViewCount="361" Body="&lt;p&gt;kernel &lt;code&gt;A =&lt;/code&gt; &lt;pre&gt;[ 0 -1 0&lt;br/&gt; -1 4 -1 &lt;br/&gt;  0 -1 0 ]&#xA;&lt;/pre&gt;and &lt;code&gt;B =&lt;/code&gt; &lt;pre&gt;[-1 0 -1&lt;br/&gt;  0 4 0&lt;br/&gt; -1 0 -1 ]&lt;/pre&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have found the frequency spectrums with &lt;code&gt;freqz2&lt;/code&gt; function of Matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;A&lt;/code&gt;'s spectrum has the highest magnitudes in the corners &lt;code&gt;(1,1),(-1,-1),(1,-1),(-1,1)&lt;/code&gt; &#xA;and &lt;code&gt;B&lt;/code&gt;'s in &lt;code&gt;(1,0),(0,1),(-1,0),(0,-1)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the center of the frequency spectrum has the low frequency information and the corners the high frequency information such as edges. It appears that &lt;code&gt;B&lt;/code&gt; filter produces a sharper image although &lt;code&gt;A&lt;/code&gt; has higher magnitude in the corners. Why is this happening ?&lt;/p&gt;&#xA;" OwnerUserId="8151" LastEditorUserId="7092" LastEditDate="2014-03-06T15:25:12.363" LastActivityDate="2014-03-06T15:25:12.363" Title="Which kernel produces sharper image" Tags="|image-processing|filters|fourier-transform|frequency-spectrum|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14850" PostTypeId="1" CreationDate="2014-03-06T13:39:18.633" Score="1" ViewCount="208" Body="&lt;p&gt;I applied Fourier transform on a sound (PCM generated digitally with sin function) and frequency detection is accurate. However, if I play the sound and record it, and then apply a Fourier transform to detect frequencies, my results are nowhere close to original results. The window size I have chosen for Fourier transform is 30 samples. ( Sampling frequency is 44100 Hz and 30 samples represent a symbol. Each symbol frequency is shifted by 1470 Hz.). Is my approach right ?&lt;/p&gt;&#xA;" OwnerUserId="8152" LastEditorUserId="8152" LastEditDate="2014-03-06T14:09:56.160" LastActivityDate="2014-03-10T16:49:35.980" Title="Fourier Transform for frequency analysis" Tags="|fft|audio|frequency-spectrum|sound|pitch|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14851" PostTypeId="2" ParentId="14847" CreationDate="2014-03-06T14:10:19.640" Score="1" Body="&lt;p&gt;If I understand the question properly. Consider the case when the delta is at time zero. In this case the convolution does not do anything to the other signal i.e. it starts at time y and the maximum peak will be at time z.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if we delay the delta to time x, then the output of the convolution will also be delayed by x. So the signal will start at time x+y, and the maximum peak will be at time x+z.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I haven't understood correctly, you may need to include some figures to more clearly explain the situation. &lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-03-06T14:10:19.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14852" PostTypeId="1" AcceptedAnswerId="14853" CreationDate="2014-03-06T14:45:24.067" Score="1" ViewCount="2504" Body="&lt;p&gt;After reading this question: &lt;a href=&quot;https://dsp.stackexchange.com/questions/8133/psd-power-spectral-density-explanation&quot;&gt;PSD (Power spectral density) explanation&lt;/a&gt; I am still a little confused as to what extra information the PSD gives us over simply taking the magnitude of the fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my understanding is that the PSD is equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|X(\omega)|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but what does that tell me that simply&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|X(\omega)|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;does not. I am assuming that squaring the fourier transform's magnitude somehow makes the number more physically (or mathematically) relevant? So how do I interpret the values of the power spectral density, especially when the signal is not a physical one and hence has no actual energy (say for example a financial signal or an image)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, does the power spectral density contain information about the probability of the frequencies in the signal? As in is there a way to use the power spectral density to make a statement about the significance level of making a claim about a harmonic frequency in a stochastic signal? So something kind of like checking the significance of the coefficients from an AR model?&lt;/p&gt;&#xA;" OwnerUserId="8153" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-06-04T16:47:07.830" Title="Power spectral density interpretation" Tags="|fourier-transform|power-spectral-density|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14853" PostTypeId="2" ParentId="14852" CreationDate="2014-03-06T15:21:01.210" Score="4" Body="&lt;p&gt;it doesn't tell you new information, but because the abs value function is non-analytic (i.e. not all of its derivatives are continuous), and the magnitude-squared &lt;em&gt;is&lt;/em&gt;, then the latter can be manipulated mathematically in ways that the former cannot.  one important property of the power spectrum is that it is the Fourier transform of the autocorrelation function in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the PSD gives you the &lt;strong&gt;energy&lt;/strong&gt; of each frequency component for a deterministic signal and the expectation value of the energy for each frequency component for a random (or &quot;stochastic&quot; if you like jargon) signal.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-03-06T15:21:01.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14854" PostTypeId="2" ParentId="14849" CreationDate="2014-03-06T15:23:45.907" Score="2" Body="&lt;p&gt;The sharpness of an image depends on &lt;a href=&quot;http://en.wikipedia.org/wiki/Acutance&quot; rel=&quot;nofollow noreferrer&quot;&gt;acutance&lt;/a&gt; and resolution. The &lt;a href=&quot;https://stackoverflow.com/questions/6646371/detect-which-image-is-sharper&quot;&gt;quantification of image sharpness&lt;/a&gt; seems image content dependent to me, since (i) sometimes the noise at the low SNR region may be enhanced with an high-pass kernel, and (ii) your &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;B&lt;/code&gt; work on the edges with different orientations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a very simple example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T = [1 0 1;...&#xA;     0 1 0;...&#xA;     1 0 1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;conv(T,A,'same')&lt;/code&gt; gives you&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   [4  -3  4;...&#xA;    -3  4  -3;...&#xA;    4  -3  4];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;while &lt;code&gt;conv(T,B,'same')&lt;/code&gt; results in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   [3 0 3;...&#xA;    0 0 0;...&#xA;    3 0 3];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looks like kernel &lt;code&gt;A&lt;/code&gt; is better in sharpening the 45 degree edges. Yet with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  T = [0 1 0;...&#xA;       1 1 1;...&#xA;       0 1 0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The performance of two kernels looks reversed (&lt;code&gt;B&lt;/code&gt; appears to be better in horizontal and vertical edges enhancement). &lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-03-06T15:23:45.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14855" PostTypeId="2" ParentId="14842" CreationDate="2014-03-06T16:32:29.593" Score="3" Body="&lt;p&gt;Spectrum, FFT magnitude, and pwelch are pretty much the same thing, i.e. a metric of energy density as a function of frequency. They all can be configured in different ways: window length, window shape, overlap, FFT size, lin/log representation, smoothing, different averaging methods, etc. &#xA;All these parameters need to be chosen carefully depending on the requirements of your application: how fast do you need to track, what frequency resolution do you need,  what's the  noise spectrum look like etc.&#xA;Choosing the parameters properly is actually more important than the core algorithm (which is more or less the same anyway).&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-06T16:32:29.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14856" PostTypeId="2" ParentId="14526" CreationDate="2014-03-06T16:37:45.460" Score="0" Body="&lt;p&gt;Digital has one major challenge for control application: latency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any digital system needs to include A/D conversion, processing and D/A conversion. The minimum amount of latency is 1/SampleRate even if you don't do anything else but a straight wire. You also typically can't use off-the-shelf sigma-delta-converters since these have significant amount of conversion latency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most digital control systems tend to use heavy oversampling and fast one-shot converters to work around this problem. Once you have the basic infrastructure in place, the digital domain offers a large variety of algorithms that are highly configurable and effect. However the cost of entry is high. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-06T16:37:45.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14857" PostTypeId="1" AcceptedAnswerId="14859" CreationDate="2014-03-06T17:06:46.490" Score="0" ViewCount="2137" Body="&lt;p&gt;Lets say we have a picture with 6bits/pixel and we use discrete cosine transform with 8x8 blocks of pixels and each coefficient is 8 bits. We can use 2 8x8 masks, a zonal mask A and a zonal bit allocation mask B. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A = &lt;pre&gt;[1 1 1 1 1 0 0 0&lt;br/&gt; 1 1 1 1 0 0 0 0&lt;br/&gt; 1 1 1 0 0 0 0 0&lt;br/&gt; 1 1 0 0 0 0 0 0&lt;br/&gt; 1 0 0 0 0 0 0 0&lt;br/&gt; 0 0 0 0 0 0 0 0&lt;br/&gt; ...... ]&#xA;&lt;/pre&gt;B = &lt;pre&gt;[8 7 6 4 3 2 1 0&lt;br/&gt; 7 6 5 4 3 2 1 0&lt;br/&gt; 6 5 4 3 3 1 1 0&lt;br/&gt; 4 4 3 3 2 1 0 0&lt;br/&gt; 3 3 3 2 1 1 0 0&lt;br/&gt; 2 2 1 1 1 0 0 0&lt;br/&gt; 1 1 1 0 0 0 0 0&lt;br/&gt; 0 0 0 0 0 0 0 0  ]&lt;/pre&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it correct to say that for A we have 64 : 15 compression namely 4.2 : 1 cause we keep 15 coefficients out of 64? does the same apply for B ? &lt;/p&gt;&#xA;" OwnerUserId="8151" LastActivityDate="2014-03-06T17:51:21.667" Title="How is compression ratio related to number of dct coefficients" Tags="|image-processing|dct|compression|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14858" PostTypeId="2" ParentId="6182" CreationDate="2014-03-06T17:32:24.703" Score="1" Body="&lt;p&gt;A few points:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Filtering in the frequency domain is complicated and needs a real algorithm like overlap add to avoid time domain aliasing. It's much easier to filter directly in the time domain: [b,a] = butter(1,100/(SampleRate/2); y_filtered = filter(b,a,y); is much better&lt;/li&gt;&#xA;&lt;li&gt;You probably want to put notch filter on the drone frequency&lt;/li&gt;&#xA;&lt;li&gt;For broad-band stationary noise a good method is Wiener filtering or spectral subtraction. Many papers have been published on this.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-06T17:32:24.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14859" PostTypeId="2" ParentId="14857" CreationDate="2014-03-06T17:51:21.667" Score="0" Body="&lt;p&gt;Compression ratio is defined as the amount of bits in the original image divided by the amount of bits in the compressed image. In the original image the number of coefficients is &lt;code&gt;64&lt;/code&gt;, while you choose &lt;code&gt;15&lt;/code&gt; coefficients after DCT in the compressed image with mask &lt;code&gt;A&lt;/code&gt;. The ratio is &lt;code&gt;64*6/15*8&lt;/code&gt;. With mask &lt;code&gt;B&lt;/code&gt; it is &lt;code&gt;64*6/41*8&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2014-03-06T17:51:21.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14860" PostTypeId="2" ParentId="14109" CreationDate="2014-03-06T20:28:59.907" Score="0" Body="&lt;p&gt;For wavelet I would recommend this book:&#xA;&lt;a href=&quot;http://www.conceptualwavelets.com/book.html&quot; rel=&quot;nofollow&quot;&gt;http://www.conceptualwavelets.com/book.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not too much mathematics included, yet in depth.&lt;/p&gt;&#xA;" OwnerUserId="8129" LastEditorUserId="7092" LastEditDate="2014-03-06T21:17:07.653" LastActivityDate="2014-03-06T21:17:07.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14862" PostTypeId="1" AcceptedAnswerId="14864" CreationDate="2014-03-06T23:02:23.137" Score="2" ViewCount="22876" Body="&lt;p&gt;How do you measure the SNR of a sinewave in the frequency domain? (Assuming no filtering.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose: $$x(n) = s(n) + n(n)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create the signal (nCycles of a sinewave) in MATLAB...:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sampleRate = 1024;&#xA;f0 = sampleRate/8;&#xA;&#xA;nCycles = 11;&#xA;time = 0:1/sampleRate:nCycles/f0;&#xA;&#xA;signal = sin(2*pi*f0*time);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Create the noise and scale it by the desired SNR...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SNR = 10;&#xA;noise = randn(size(signal));&#xA;% scale the noise to obtain the desired SNR&#xA;noise = noise / norm(noise) * norm(signal) / 10^(SNR/20);&#xA;&#xA;x = signal + noise;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Calculate the resulting SNR (in the time domain):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;actualSNR = 20*log10(norm(signal)/norm(x - signal));&#xA;disp(['SNR = ',num2str(actualSNR),'  dB']) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Plot the noisy signal in time and frequency&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subplot(2,1,1)&#xA;% plot the signal in time&#xA;plot(time,signal)&#xA;hold on; grid on&#xA;plot(time,x,'r')&#xA;&#xA;% plot the noisy signal in frequency&#xA;NFFT = 4096;&#xA;X = fftshift(fft(x,NFFT));&#xA;X = X/max(abs(X));&#xA;f = sampleRate/2*linspace(-1,1,NFFT);&#xA;subplot(2,1,2)&#xA;&#xA;plot(f,20*log10(abs(X)))&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2014-03-10T15:45:58.373" LastActivityDate="2014-12-19T19:52:42.377" Title="Measure the SNR of a signal in the frequency domain?" Tags="|matlab|fft|frequency-spectrum|signal-analysis|snr|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14863" PostTypeId="2" ParentId="9068" CreationDate="2014-03-07T00:00:37.780" Score="1" Body="&lt;p&gt;Both are linear transforms. Both can be expressed as a matrix. These matrices  are invertible. So you can have the product of one matrix with the inverse of the other. In practice, you could not actually calculate inverse matrices, so you'd have to stick with solvers. However, such products are a little op-art. Coursey GNU octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lUPWA.jpg&quot; alt=&quot;Real part of such a matrix&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-07T00:00:37.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14864" PostTypeId="2" ParentId="14862" CreationDate="2014-03-07T02:10:36.253" Score="6" Body="&lt;p&gt;It can be a little tricky.  If your sine wave happens to fall at an FFT bin center, things are a little easier.  If your sine wave happens to not fall at a bin center, you have to consider spectral leakage.  You'll also need to consider how your window function affects your signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple technique to estimate the signal power would be to sum the squared magnitudes of the FFT bins with most of the signal's energy (i.e. the largest bins).  To get the noise energy, sum the squared magnitude of all of the other bins.  This will get you close.&lt;/p&gt;&#xA;" OwnerUserId="7899" LastEditorUserId="7899" LastEditDate="2014-03-07T04:10:42.290" LastActivityDate="2014-03-07T04:10:42.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14865" PostTypeId="1" CreationDate="2014-03-07T05:56:01.750" Score="2" ViewCount="1401" Body="&lt;p&gt;This is an extention to my other &lt;a href=&quot;https://dsp.stackexchange.com/questions/14735/time-delay-estimation-using-ultrasound&quot;&gt;question&lt;/a&gt;. My sampling frequency is only about 2x my tone frequency. I want to estimate time delay of arrival using this signal. I am generating the tone signal so I know its properties. Can I use compressed sensing to reconstruct my tone wave received by the sensors and get a good time delay estimate? An answer with some matlab code would be brilliant.&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-03-08T05:29:49.523" Title="Time delay estimate and sampling frequency" Tags="|matlab|cross-correlation|time-frequency|compressive-sensing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14866" PostTypeId="2" ParentId="14865" CreationDate="2014-03-07T08:14:15.367" Score="1" Body="&lt;p&gt;You should try to measure the phase of the signals, since so you can average out errors. Phase difference is proportional to time delay, but wraps.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-07T08:14:15.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14867" PostTypeId="1" AcceptedAnswerId="14868" CreationDate="2014-03-07T09:05:52.833" Score="0" ViewCount="5378" Body="&lt;p&gt;I need to generated a high frequency sinusoidal signal for modulation in MATLAB. But it turns out to be something weird. This is the simple code snippet I used...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:0.001:100;&#xA;A = 1;&#xA;s = A*sin(2*pi*1e9.*t);  %1 GHz signal&#xA;plot(t, s);&#xA;title('Modulating Signal');&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of the sine wave I am getting something weird like this..&lt;img src=&quot;https://i.stack.imgur.com/qOcZU.jpg&quot; alt=&quot;Not really the sine wave or the full blue wave&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8158" LastActivityDate="2019-07-04T13:21:46.153" Title="Matlab HIgh frequency sine wave generation" Tags="|matlab|tone-generation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14868" PostTypeId="2" ParentId="14867" CreationDate="2014-03-07T09:19:24.953" Score="1" Body="&lt;p&gt;The function you need to evaluate is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A*sin(2*pi*FREQUENCY*(1:NUM_SAMPLES)/SAMPLE_RATE)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Use a reasonable sample rate (at least twice the frequency) and a reasonable interval (remember that at a sample rate of 2Ghz, 1 second of signal will fill up the memory of your computer) ; and it'll work! From your code it seems that you are trying to generating 100s of signal at a sample rate of 1kHz, which doesn't make sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, in your code, the argument of the sin function is an integer multiple of $2\pi$ so in theory your code should be plotting a flat line of 0s. You are seeing something a bit different due to the finite resolution of floating point numbers.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-03-07T09:37:17.873" LastActivityDate="2014-03-07T09:37:17.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14869" PostTypeId="2" ParentId="14867" CreationDate="2014-03-07T09:20:00.497" Score="1" Body="&lt;p&gt;The problem is the definition of your vector $\tt{t}$. You seriously subsample your signal because its period is $T=10^{-9}$ and you the interval of your sample points is $10^{-3}$. Try the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0,1e-7,10000);&#xA;A = 1;&#xA;s = A*sin(2*pi*1e9.*t);  %1 GHz signal&#xA;plot(t, s);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-07T09:20:00.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14870" PostTypeId="1" CreationDate="2014-03-07T09:21:30.023" Score="1" ViewCount="91" Body="&lt;p&gt;I am trying to learn signal processing and digital pre-distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.altera.com/end-markets/wireless/advanced-dsp/predistortion/wir-digital-predistortion.html&quot; rel=&quot;nofollow&quot;&gt;http://www.altera.com/end-markets/wireless/advanced-dsp/predistortion/wir-digital-predistortion.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently trying to auto correlate the input signal and from this I make a matrix. I then get the coefficients for this matrix and use them with a LUT to help pre-distort the signal. I am having difficulty understanding what these coefficients represent? Why are they useful when added to the LUT. So the coefficients are used as a weight in those LUTs. Can anyone give me a pointer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same goes for the cross-correlation with the feedback, what do the coefficients from that vector represent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="7145" LastActivityDate="2014-03-07T09:21:30.023" Title="DPD auto and crosscorrelation" Tags="|autocorrelation|" AnswerCount="0" CommentCount="2" ClosedDate="2014-03-21T00:03:37.450" ContentLicense="CC BY-SA 3.0" />
  <row Id="14871" PostTypeId="2" ParentId="1167" CreationDate="2014-03-07T10:03:48.013" Score="3" Body="&lt;p&gt;I hope this &lt;a href=&quot;https://www.youtube.com/watch?v=k6y2kzayV6A&amp;amp;list=UUZCDx4cxOF3Bd57k3ek-YpQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt; (from the Florida Institute of Technology. Titled &quot;what is wide sense staionary, strict sense, ergodic signals&quot; by Dr. Ivica Kostanic in his Communications Theory class) from 16:55 could clear your doubts &lt;/p&gt;&#xA;" OwnerUserId="8162" LastEditorUserId="26081" LastEditDate="2017-12-06T09:12:38.813" LastActivityDate="2017-12-06T09:12:38.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14872" PostTypeId="1" CreationDate="2014-03-07T10:12:44.390" Score="0" ViewCount="206" Body="&lt;p&gt;I have two cameras, and I'm up to perform some matching stuff on videos captured by these two cameras since I'm a CV guy.&lt;/p&gt;&#xA;&lt;p&gt;The problem is that two cameras have very different performance in terms of color and brightness. The same object in the same illumination appears different in two cameras.&lt;/p&gt;&#xA;&lt;p&gt;Is there any academic work on measuring something like the &amp;quot;rgb response curve&amp;quot; of a camera? I want to unify the rgb response of these two cameras to guarantee the same object &amp;quot;looks&amp;quot; the same in two cameras.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; Below is just an intuitive illustration of my problem. Same object appears different in different cameras.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8ipiN.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/P1BPJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="8161" LastEditorUserId="7092" LastEditDate="2021-04-19T11:31:32.343" LastActivityDate="2021-04-19T16:54:12.437" Title="How to unify the color and brightness measure of two given cameras?" Tags="|image-processing|camera|color|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14873" PostTypeId="2" ParentId="14872" CreationDate="2014-03-07T12:07:48.517" Score="4" Body="&lt;p&gt;Here you have two options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Color calibrate your cameras (radiometric calibration) to the same reference. Then try matching. There are many academic works on this topic, one of them being:&#xA;&lt;a href=&quot;http://research.microsoft.com/en-us/um/people/yasumat/papers/rankcalib_PAMI12_preprint.pdf&quot; rel=&quot;nofollow&quot;&gt;http://research.microsoft.com/en-us/um/people/yasumat/papers/rankcalib_PAMI12_preprint.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Use a vignetting invariant (or color invariant) feature descriptor. For example you could try to work with gradients instead of intensities and so on. This is harder, but if you could achieve it you get rid of the cumbersome calibration procedure. There are also valuable works done in this field, such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cvip.louisville.edu/wwwcvip/research/publications/Pub_Pdf/2006_2/CSIFTA%20SIFT%20Descriptor%20with%20Color%20Invariant%20Characteristics.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cvip.louisville.edu/wwwcvip/research/publications/Pub_Pdf/2006_2/CSIFTA%20SIFT%20Descriptor%20with%20Color%20Invariant%20Characteristics.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck,&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-07T12:07:48.517" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14874" PostTypeId="2" ParentId="10177" CreationDate="2014-03-07T15:03:09.897" Score="1" Body="&lt;p&gt;If you are looking at only those bins, you will not be accurate. Some energy is transferred to the neighboring bins. You need to set a threshold and assume its existence if you bin has a value greater than the threshold. Fixing the threshold is a task of lots of experimenting.&lt;/p&gt;&#xA;" OwnerUserId="8152" LastActivityDate="2014-03-07T15:03:09.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14878" PostTypeId="1" CreationDate="2014-03-07T23:43:47.977" Score="1" ViewCount="3885" Body="&lt;p&gt;I have a signal that contains two components. How can I separate it two its two components in matlab?&#xA;Please note that the location and shape of components are different in each experiment and we do a lot of experiments. It should automatically detect the two components based on the frequency contents. I have added this comment because some people suggested &#xA;c1 = x(1:80);c2 = x(81:end);  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not mean such separation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/meBq5.png&quot; alt=&quot;The given signal; the two components can be seen clearly by eye.&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8171" LastEditorUserId="13320" LastEditDate="2016-11-21T13:05:35.820" LastActivityDate="2016-11-21T13:05:35.820" Title="given a mixture of two signals, how to separate it to its base components?" Tags="|matlab|signal-analysis|frequency|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14879" PostTypeId="1" CreationDate="2014-03-08T00:59:21.827" Score="0" ViewCount="266" Body="&lt;p&gt;How can I do point by point multiplication of the quantized DCT coefficients with the quantization matrix before computing the inverse DCT for each block? I want to modify the reconstruction algorithm to approximately undo the quantization step shown here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i = 1:Blocks&#xA;    for j=1:Blocks&#xA;        irange = (i-1)*8+1:(i-1)*8+8;&#xA;        jrange = (j-1)*8+1:(j-1)*8+8;&#xA;        quantblock = round(y(irange,jrange)./Q);&#xA;        quant_DCTblocks(irange,jrange) = quantblock;&#xA;    end&#xA;end&#xA;figure&#xA;imagesc(quant_DCTblocks)&#xA;colormap(gray)&#xA;set(gca,'Xtick',[])&#xA;set(gca,'Ytick',[])&#xA;axis('square')&#xA;title('quantized DCT Coeffs')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7907" LastActivityDate="2021-11-29T16:12:52.260" Title="How to undo the quantization step in DCT?" Tags="|image-processing|matlab|dct|jpeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14880" PostTypeId="1" CreationDate="2014-03-08T02:50:01.997" Score="1" ViewCount="567" Body="&lt;p&gt;I'm coding a phase vocoder in C for time-stretching audio signals. The only piece that is currently not working is the phase propagation.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I take overlapping frames from an input signal, apply a window function, and perform FFT.&lt;/li&gt;&#xA;&lt;li&gt;Then i calculate the phase propagation (the one I'm stuck with)&lt;/li&gt;&#xA;&lt;li&gt;Finally I perform iFFT and overlap-add the output frames with a different hop size.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If I skip step 2, the phase propagation, the output sound is correctly time-stretched but I can hear a &lt;em&gt;phaser&lt;/em&gt; effect. My assumption is that the missing piece will correct this. However when I apply my current implementation the sound is terribly distorted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate if anyone can give some good pointers on how the phase correction can be implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be too much to ask, but this is my current implementation should you see something weird.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// _prevPhaseX[] = FFT phases from previous frame (n-1) (propagation input)&#xA;// _prevPhaseY[] = FFT phases from previous frame (n-1) (propagation output)&#xA;// _phase[] has the FFT phase information from current frame&#xA;static int first = 1;&#xA;if (first)&#xA;{&#xA;    first = 0;&#xA;    for (int k=0; k&amp;lt;half; k++)          // half = window length/2 = number of bins&#xA;    {&#xA;        _prevPhaseX[k] = _phase[k];&#xA;        _prevPhaseY[k] = _phase[k];&#xA;    }&#xA;}&#xA;else&#xA;{&#xA;    // int length = window length - e.g. 1024 &#xA;    // float Ra = analysis hop size - e.g. 256&#xA;    // float Rs = synthesis hop size - e.g. 512&#xA;    // float PI = PI&#xA;    // float DPI = 2*PI&#xA;    for (int k=1; k&amp;lt;half; k++)&#xA;    {&#xA;        // compute Delta Phi(k)&#xA;        float phase = _phase[k];&#xA;        float omega = DPI*(float)k/(float)length;  // length vs length/2?&#xA;        float phasediff = phase - _prevPhaseX[k] - Ra*omega;&#xA;        _prevPhaseX[k] = phase;   // Save value for next frame&#xA;&#xA;        // get principal argument&#xA;        while (phasediff&amp;gt;PI) phasediff -=DPI;&#xA;        while (phasediff&amp;lt;-PI) phasediff +=DPI;&#xA;&#xA;        float freq = omega + (phasediff)/Ra;&#xA;        _phase[k] = _prevPhaseY[k] + Rs*freq;&#xA;        _prevPhaseY[k] = _phase[k];   // Save value for next frame&#xA;    }&#xA;} &#xA;// the _phase[] vector (and magnitude[]) goes to IFFT (after conv. to rectangluar)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8172" LastEditorUserId="8172" LastEditDate="2014-03-08T22:29:08.960" LastActivityDate="2014-03-11T21:13:14.330" Title="problems calculating phase propagation (in C)" Tags="|fft|audio|phase|c|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14881" PostTypeId="2" ParentId="14879" CreationDate="2014-03-08T03:28:27.990" Score="2" Body="&lt;p&gt;From the code it looks like the &lt;em&gt;quantization&lt;/em&gt; step is doing two things:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;dividing by &lt;code&gt;Q&lt;/code&gt;, and&lt;/li&gt;&#xA;&lt;li&gt;rounding.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Undoing the divide by &lt;code&gt;Q&lt;/code&gt; is easy. The rounding is where the actual quantizing is happening though, and unfortunately that is the part that you cannot undo- at least not without more information. Rounding causes information to be lost and you cannot undo that.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="7092" LastEditDate="2021-11-29T16:12:52.260" LastActivityDate="2021-11-29T16:12:52.260" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14882" PostTypeId="2" ParentId="14839" CreationDate="2014-03-08T03:48:25.100" Score="2" Body="&lt;p&gt;When I ran your code in Matlab I got the following warning message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =  6.912349e-21. &#xA;&amp;gt; In firls at 175 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It turns out that the problem is the &quot;/Fs/2&quot; part.  You are trying to normalize the frequencies from $0$ to $\frac{F_s}{2}$ into the range $0$ to $1$.  The problem is that Matlab divides the numbers in order, so even though what you want is /(Fs/2) what you are getting is /(Fs*2).  Changing the line to the following-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = firls(N,[0 fpass fstop Fs/2]/(Fs/2), [1 1 0 0], [1 1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;fixes the problem.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-08T03:48:25.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14883" PostTypeId="2" ParentId="6398" CreationDate="2014-03-08T04:58:23.280" Score="1" Body="&lt;p&gt;What you are seeing is spectral leakage, which does vary based on the windowing function, as you've seen. In window function selection, there is a tradeoff of frequency resolution, spectral leakage, and amplitude accuracy. Some applications of fft might find the major spectral leakage of a boxcar/no-window function acceptable, as the frequency resolution is better.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a visual readout of random audio data, like your spectrogram, a windowing function like hanning does much better. &lt;/p&gt;&#xA;" OwnerUserId="8174" LastActivityDate="2014-03-08T04:58:23.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14884" PostTypeId="2" ParentId="14865" CreationDate="2014-03-08T05:29:49.523" Score="2" Body="&lt;p&gt;A colleague of mine has investigated time delay estimation using compressed sensing in this paper: &lt;a href=&quot;http://vbn.aau.dk/en/publications/compressive-parameter-estimation-for-sparse-translationinvariant-signals-using-polar-interpolation(56d35506-d4ae-4296-9a36-7ec95b1160c7).html&quot; rel=&quot;nofollow&quot;&gt;http://vbn.aau.dk/en/publications/compressive-parameter-estimation-for-sparse-translationinvariant-signals-using-polar-interpolation(56d35506-d4ae-4296-9a36-7ec95b1160c7).html&lt;/a&gt;&#xA;You can find the accompanying Matlab code here: &lt;a href=&quot;http://www.sparsesampling.com/cpe/&quot; rel=&quot;nofollow&quot;&gt;http://www.sparsesampling.com/cpe/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2014-03-08T05:29:49.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14885" PostTypeId="1" CreationDate="2014-03-08T07:46:47.873" Score="1" ViewCount="45" Body="&lt;p&gt;This is the logistic distribution of single random variable (taken from Wikipedia).&lt;/p&gt;&#xA;&lt;p&gt;x = random variable&#xA;mu = mean of all random variables&#xA;s = variance.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qUHkD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, I want to do a Bivariate logistic distribution (having two random variables x1 and x2). My dataset is going to be image pixel values!&lt;/p&gt;&#xA;&lt;p&gt;When I find the covariance of two random variables, it turns out to be a 2 x 2 square matrix but I need a single number! How to actually compute a bivariate model?&lt;/p&gt;&#xA;" OwnerUserId="8087" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-05-07T11:05:40.923" Title="How to set covariance for Bivariate Logistic Distribution" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14886" PostTypeId="2" ParentId="14880" CreationDate="2014-03-08T09:19:09.120" Score="1" Body="&lt;p&gt;I think one problem with your code is that $\tt{\_phase[k]}$ is the phase of the current &lt;em&gt;input&lt;/em&gt; frame, whereas $\tt{\_prevPhase[k]}$ refers to the previous &lt;em&gt;output&lt;/em&gt; frame. However, I think you should compute the phase difference by comparing the current and the previous input frames, and not the current input and the previous output frame. So you need two variables for past phases, one for the input phase and one for the output phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more thing: you should increase your FFT size. For $R_s=512$ you should probably have an FFT size of at least $2048$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would also be helpful if you posted links to a short segment of an input signal, and the two corresponding output signals, one with and one without phase modification. Then it might be easier to judge what the problem is.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-03-11T21:13:14.330" LastActivityDate="2014-03-11T21:13:14.330" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14887" PostTypeId="2" ParentId="14885" CreationDate="2014-03-08T09:58:53.840" Score="2" Body="&lt;p&gt;The covariance of any multivariate distribution is always a matrix. Maybe it is of help to you to know what this matrix contains:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-In general, each entry i,j of the matrix gives you the correlation between the RVs i and j. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;-So a diagonal element i,i will simply be the variance of the RV i.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-If RV i and j are independent, then the non-diagonal entry i,j is zero (they are uncorrelated). The reverse of this statement is not generally true, but it is for Gaussians iirc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what you are trying to do, but perhaps the trace of the matrix or its determinant is of use to you?&lt;/p&gt;&#xA;" OwnerUserId="8103" LastActivityDate="2014-03-08T09:58:53.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14888" PostTypeId="2" ParentId="14878" CreationDate="2014-03-08T15:04:57.763" Score="2" Body="&lt;p&gt;I would suggest you take a look at 'independent component analysis', and 'blind source separation' tasks. In general, given a signal of mixtures of components to be separated to its contents well addressed by optimization in complicated cases. Here you show one example, but probably in each experiment you have something very different. I will also take a look at my files to see if still I have relevant codes to solve it or not. &lt;/p&gt;&#xA;" OwnerUserId="8178" LastEditorUserId="7092" LastEditDate="2014-03-09T02:12:32.137" LastActivityDate="2014-03-09T02:12:32.137" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14891" PostTypeId="1" AcceptedAnswerId="15046" CreationDate="2014-03-08T16:16:15.977" Score="1" ViewCount="120" Body="&lt;p&gt;I want to linearize a system to this form&#xA;$$\begin{bmatrix}&#xA;		 \Delta\dot{x}_1\\&#xA;		\Delta\dot{x}_2\\  &#xA;		\Delta\dot{x}_3&#xA;	\end{bmatrix} = A\begin{bmatrix}\Delta x_1\\ \Delta x_2\\ \Delta x_3\end{bmatrix}+B\begin{bmatrix} \Delta u\end{bmatrix}$$&#xA;    $$\begin{bmatrix}&#xA;		 \Delta y&#xA;	\end{bmatrix} = C\begin{bmatrix}\Delta x_1\\ \Delta x_2 \\ \Delta x_3\end{bmatrix}+D\begin{bmatrix} \Delta u\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The A matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A = \begin{bmatrix} \frac{\partial \dot x_1}{\partial x_1} &amp;amp; \frac{\partial \dot x_1}{\partial x_2} &amp;amp; \frac{\partial \dot x_1}{\partial x_3}\\[6pt] \frac{\partial\dot x_2}{\partial x_1} &amp;amp; \frac{\partial \dot x_2}{\partial x_2} &amp;amp; \frac{\partial \dot x_2}{\partial x_3}\\[6pt] \frac{\partial\dot x_3}{\partial x_1} &amp;amp; \frac{\partial \dot x_3}{\partial x_2} &amp;amp; \frac{\partial \dot x_3}{\partial x_3}\end{bmatrix}_{|P}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$=\begin{bmatrix} M_1L &amp;amp; \frac{d}{dt} \left[\frac{R_2}{M^2}\ln(x_2(t)+1)\right] &amp;amp; R_1\\[6pt] L_1L_2   &amp;amp;   \frac{d}{dt} \left[\frac{L_1}{M^2}\ln(x_2(t)+1)\right]&amp;amp; R_2\\[6pt] 0 &amp;amp;\frac1C &amp;amp; 0\end{bmatrix}_{|P}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has in its second comulmn logarithm. Pay attention only there. ($M$, $L$'s and $R$'s are some constants) If I derivate it, I get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$=\begin{bmatrix} M_1L &amp;amp; \frac{R_2 \frac{dx_2(t)}{dt}}{M^2(x_2(t)+1)} &amp;amp; R_1\\[6pt] L_1L_2 &amp;amp; \frac{L_1 \frac{dx_2(t)}{dt}}{M^2(x_2(t)+1)}&amp;amp; R_2\\[6pt] 0 &amp;amp;\frac1C &amp;amp; 0\end{bmatrix}_{|P}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I'm not sure what to do with this. Since my initial condition $P$ are in equilibrium and  $\frac{dx_2(t)}{dt} = 0$, should I put there the $0$? The result would look like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$=\begin{bmatrix} M_1L &amp;amp; 0 &amp;amp; R_1\\[6pt] L_1L_2 &amp;amp; 0 &amp;amp; R_2\\[6pt] 0 &amp;amp;\frac1C &amp;amp; 0\end{bmatrix}_{|P}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But few weeks ago I have been solving similar situation and I didn't put $\frac{dx_2(t)}{dt}$ in the matrix at all. Lecturer told me it was right. According to that, this matrix should look like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$=\begin{bmatrix} M_1L &amp;amp; \frac{R_2}{M^2(x_2(t)+1)} &amp;amp; R_1\\[6pt] L_1L_2 &amp;amp; \frac{L_1 }{M^2(x_2(t)+1)}&amp;amp; R_2\\[6pt] 0 &amp;amp;\frac1C &amp;amp; 0\end{bmatrix}_{|P}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm confused. The mode $x_i(t)$ isn't consider as a function of time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to solve this?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="4158" LastEditDate="2014-03-08T16:51:58.157" LastActivityDate="2014-03-17T22:50:31.933" Title="Logarithm in state space equations" Tags="|system-identification|state-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14892" PostTypeId="2" ParentId="14878" CreationDate="2014-03-08T19:45:53.520" Score="1" Body="&lt;p&gt;In your example, the most important difference appears to be in frequency. If this is to be expected, filtering would be the natural approach.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-08T19:45:53.520" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14893" PostTypeId="1" CreationDate="2014-03-08T22:59:47.480" Score="0" ViewCount="43" Body="&lt;p&gt;I got this simple Discrete time signal question on which i have to perform shifting and multiplication.But I have some Doubt regarding the answer this book shows. Please see the uploaded image.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BpLoo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8181" LastActivityDate="2014-03-08T22:59:47.480" Title="Operaion on Simple Discrete Time Signal , Very Simple Question" Tags="|discrete-signals|convolution|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14894" PostTypeId="1" CreationDate="2014-03-09T00:07:33.633" Score="3" ViewCount="349" Body="&lt;p&gt;I have no background in signal processing but I would like to know what is the actual state of the art for vocal elimination/reduction. Obviously, I am not talking about the infamous &quot;stereo elimination&quot;, but other, more sophisticated techniques that not everybody is aware of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that for many projects there might be no software or online application available, but I'd find very useful to hear a demonstration.&lt;/p&gt;&#xA;" OwnerUserId="7268" LastEditorUserId="13320" LastEditDate="2016-11-21T13:01:09.243" LastActivityDate="2016-11-21T13:01:09.243" Title="What is the state of the art for vocal elimination/reduction?" Tags="|algorithms|voice|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14895" PostTypeId="2" ParentId="14880" CreationDate="2014-03-09T02:08:56.150" Score="4" Body="&lt;p&gt;you don't wanna do this on a bin-by-bin basis.  &lt;a href=&quot;http://msp.ucsd.edu/Publications/mohonk95.pdf&quot; rel=&quot;nofollow&quot;&gt;here's a paper by Miller Puckette&lt;/a&gt; that is seminal regarding this issue.  what you want to do is identify specific frequency components (perhaps each lobe in the spectrum would be a specific frequency component) and multiply that entire $n$th lobe by $e^{j \phi_n}$  where $\phi_n = \omega_n \ T_n$  and  $\omega_n$ is the frequency of the $n$th component and $T_n$ is the time adjustment to that component to match its phase to the corresponding component in the previous frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;each bin gets multiplied by $e^{j \phi_n}$, but for most bins that factor is the same as for an adjacent bin.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-03-09T05:03:20.220" LastActivityDate="2014-03-09T05:03:20.220" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14896" PostTypeId="2" ParentId="10675" CreationDate="2014-03-09T03:18:05.573" Score="1" Body="&lt;p&gt;&lt;code&gt;dwt2&lt;/code&gt; is the single level decomposition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;wavedec2&lt;/code&gt; is multilevel decomposition&lt;/p&gt;&#xA;" OwnerUserId="8182" LastEditorUserId="7092" LastEditDate="2014-03-09T04:08:46.183" LastActivityDate="2014-03-09T04:08:46.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14897" PostTypeId="1" CreationDate="2014-03-09T05:08:55.793" Score="0" ViewCount="755" Body="&lt;p&gt;I have a noisy signal file in Matlab and I have to denoise the polluted signal using a discrete Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm asked to perform the fourier transform, then take its absolute value. Then study/examine the absolute values to then implement a low-pass filter for the actual sound (and corresponding high-pass filter for the background noise) in Matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on general approaches? This is an intro course so suggestions shouldn't be too formal. Also this is homework so only hints please.&lt;/p&gt;&#xA;" OwnerUserId="8183" LastEditorUserId="8183" LastEditDate="2014-03-09T05:21:45.503" LastActivityDate="2014-03-10T05:46:28.423" Title="Intro Question to Signal Processing (Low-Pass Filter)" Tags="|dft|lowpass-filter|homework|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14899" PostTypeId="1" CreationDate="2014-03-09T06:30:53.207" Score="1" ViewCount="170" Body="&lt;p&gt;I have a project of recording human's sound via Android's SoundRecoder API, and then displaying the extracted note on The screen. It is specific for Android platform (can't use Jmusic or Jfugue API as javaSE environment is not supported).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose I get to record a sound using this API . How can I then deploy FFT to extract notes from this sound?  Basically as it is not pure sinusoidal wave it might involve multiple frequencies and overtones. Are there any good algorithms to do so? If yes, where I can simulate and the last of all whole of the extracted tone should be rendered on musical sheet?&lt;/p&gt;&#xA;" OwnerUserId="8184" LastEditorUserId="7092" LastEditDate="2014-03-09T16:27:13.547" LastActivityDate="2014-03-10T04:35:35.877" Title="possibilty of extracting a tone from MIDI values" Tags="|fft|java|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14900" PostTypeId="2" ParentId="14899" CreationDate="2014-03-09T07:43:54.250" Score="2" Body="&lt;p&gt;You correctly note that a musical note is usually not just a simple sine wave. Thus, an FFT may only be one of the steps used in a pitch detection/estimation algorithm (there are many: &lt;a href=&quot;http://en.m.wikipedia.org/wiki/Pitch_detection&quot; rel=&quot;nofollow&quot;&gt;http://en.m.wikipedia.org/wiki/Pitch_detection&lt;/a&gt;).  For music, a good place to start might be the research papers published on MIREX: &lt;a href=&quot;http://www.music-ir.org/mirex/wiki/Audio_Melody_Extraction&quot; rel=&quot;nofollow&quot;&gt;http://www.music-ir.org/mirex/wiki/Audio_Melody_Extraction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-09T07:43:54.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14901" PostTypeId="1" CreationDate="2014-03-09T12:18:35.923" Score="0" ViewCount="73" Body="&lt;p&gt;I have this simple $x(t)$ graph, and I have some confusion regarding time shifting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2YTS9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the graph of $x(1-t)$ ? &lt;/p&gt;&#xA;" OwnerUserId="8181" LastEditorUserId="1629" LastEditDate="2016-05-23T21:52:02.860" LastActivityDate="2016-05-23T21:52:02.860" Title="Very simple problem regarding shifting of a signal" Tags="|signal-analysis|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14903" PostTypeId="1" CreationDate="2014-03-09T13:48:26.493" Score="0" ViewCount="151" Body="&lt;p&gt;Can you explain to someone with no mathematical background why is deconvolution used in telescopes, CT scans and seismographs? How do you explain that the same technique can be used for different things. The distortions in telescopes, CT scans and seismographs are all different from each other.&lt;/p&gt;&#xA;" OwnerUserId="8186" LastEditorUserId="8186" LastEditDate="2014-03-09T14:26:13.640" LastActivityDate="2014-03-11T18:05:31.040" Title="Why is deconvolution used in telescopes, CT scans and seismographs?" Tags="|deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14904" PostTypeId="2" ParentId="14901" CreationDate="2014-03-09T14:29:23.500" Score="3" Body="&lt;p&gt;Don't look at graphs and don't think of &quot;flip and slide&quot; as your&#xA;instructor/TA will tell you is the way to solve such problems.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(\cdot)$ is a function that has value $5$ whenever what&#xA;is between the &quot;$($&quot; and the &quot;$)$&quot; has value between $-4$ and $4$.  So, $x(1-t)$&#xA;has value $5$ exactly when&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ -4 \leq 1-t \leq 4 \quad \Rightarrow \quad t \in [a, b]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ and $b$ are numbers (hint: they are integers!) that I will&#xA;leave for you to work as an exercise. When you are done, you can easily&#xA;sketch $x(1-t)$  from this information.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-03-09T14:29:23.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14905" PostTypeId="2" ParentId="14897" CreationDate="2014-03-09T15:05:05.950" Score="1" Body="&lt;p&gt;Based on your description it sounds like the idea is to use the FFT to figure out where your signal energy is in terms of frequencies.  Once you know that you know what the passband of your filter should be, and from that you can decide on a reasonable cutoff frequency.  You want to cutoff as much of the noise energy as possible which means you want to have the cutoff frequency as close to the passband frequency as possible, but you need some space for the transition band to make the filter implementable with a reasonable number of taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, I often like to look at the signal energy in the log scale because it helps to get a better understanding of the weaker portions of the signal.  In Matlab you do it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(20*log10(abs(fft(signal))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-09T15:05:05.950" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="14906" PostTypeId="1" CreationDate="2014-03-09T16:27:26.960" Score="0" ViewCount="3202" Body="&lt;p&gt;I have this wav file that I recorded using my laptop, It contains the sound of a G chord of a guitar. Since the guitar have 6 strings the sound should contain different frequencies I want to determine the top 10 most dominant frequency in the signal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[X, Fs] = wavread('chordG.wav');&#xA;freq = fft(X);&#xA;plot(abs(freq)):&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't know how to proceed after that it shows the graph of the frequency but I don't know how can I extract the values in the graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your answer would be very much appreciated :)&lt;/p&gt;&#xA;" OwnerUserId="8137" LastEditorUserId="8202" LastEditDate="2016-11-21T15:12:50.243" LastActivityDate="2016-11-21T15:12:50.243" Title="How to get the 10-5 most dominant frequency in an audio signal" Tags="|matlab|fft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14907" PostTypeId="1" CreationDate="2014-03-09T16:40:06.147" Score="0" ViewCount="128" Body="&lt;p&gt;I am trying to plot short time energy of an utterance with percent overlap as an input variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I referred to the short time energy equation it can be represented as square summation of $x(n)*w(n-m)$ where $w(n)$ seems to be window length.&#xA;But I couldn't figure out how to write it as percent overlap.&lt;/p&gt;&#xA;" OwnerUserId="8187" LastEditorUserId="7092" LastEditDate="2014-03-09T16:49:45.380" LastActivityDate="2014-04-08T22:31:53.370" Title="is there a mathematical relation between percent overlap and window length or amplitude" Tags="|matlab|window-functions|speech-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14908" PostTypeId="2" ParentId="14906" CreationDate="2014-03-09T17:41:30.587" Score="1" Body="&lt;p&gt;There are research papers on the topic of automatic polyphonic chord estimation/transcription on MIREX (&lt;a href=&quot;http://www.music-ir.org/mirex/wiki/2014:Audio_Chord_Estimation&quot; rel=&quot;nofollow&quot;&gt;http://www.music-ir.org/mirex/wiki/2014:Audio_Chord_Estimation&lt;/a&gt;).  Also a book and a thesis by A. Klapuri.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-09T17:41:30.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14909" PostTypeId="2" ParentId="14907" CreationDate="2014-03-09T20:52:13.123" Score="0" Body="&lt;p&gt;The amount of overlap and the window length are completely independent parameters, other than the fact that the window has to be longer than the amount of overlap of course.  People often have the window length be twice the amount of overlap (i.e. overlap = 50%), but you don't have to do that.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-09T20:52:13.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14910" PostTypeId="2" ParentId="14907" CreationDate="2014-03-09T21:54:23.583" Score="1" Body="&lt;p&gt;Percent overlap merely sets how often you measure the energy, relative to the window width.  You can re-measure every sample, or once per annum, or any density in between.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-09T21:54:23.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14911" PostTypeId="2" ParentId="14899" CreationDate="2014-03-10T04:35:35.877" Score="0" Body="&lt;p&gt;A simple way is to search for the maximum amplitude in the spectrum ; however depending on the instrument this could either be located at the fundamental frequency or at a multiple of that frequency, so what you could do is extract these frequencies and their harmonics along with the associated amplitudes, and correlate the data against sample values for different instruments to identify the note played (and even the instrument)&lt;/p&gt;&#xA;" OwnerUserId="5779" LastActivityDate="2014-03-10T04:35:35.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14912" PostTypeId="1" AcceptedAnswerId="14918" CreationDate="2014-03-10T05:03:32.000" Score="0" ViewCount="623" Body="&lt;p&gt;I have to come up with an upsampling algorithm for a project and cannot use Matlab's built in &lt;code&gt;upsample&lt;/code&gt; function. I came up with the following function but it just runs forever when I use a 13 second, 16-bit song sampled at 44.1kHz. Please let me know how I can improve the efficiency of this algorithm: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    x = desired_Fs/original_Fs; %desired and original sampling frequencies&#xA;    len = x * length(y); %y is the input signal&#xA;    q = x - 1;&#xA;&#xA;    for i = 1:x:len&#xA;       for j = length(y):-1:i+1&#xA;            y(j + q) = y(j);&#xA;       end&#xA;       for k = i+1:1:i+q&#xA;            y(k) = 0;&#xA;       end&#xA;    end `&#xA;    upsampled_audio = y;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8191" LastActivityDate="2014-03-10T13:03:38.003" Title="Upsampling algorithm too slow" Tags="|matlab|" AnswerCount="2" CommentCount="0" ClosedDate="2014-03-21T11:45:53.353" ContentLicense="CC BY-SA 3.0" />
  <row Id="14913" PostTypeId="2" ParentId="14897" CreationDate="2014-03-10T05:46:28.423" Score="0" Body="&lt;p&gt;Sorry if this is too basic, but I'll try to describe what the Fourier transform means (also, warning: I'm not good at short explanations). Any &quot;time series&quot; (signal) can be described as the sum of individual sine waves, each with a different frequency. Any one frequency will have a certain amount of power that is not necessarily the same as other frequencies' power. Where your notes talk about &quot;patterns&quot; in the data, that's what I mean by these individual sine waves that we sum up. The important point that the Fourier transform is based on is that &lt;em&gt;any&lt;/em&gt; signal can be approximated by a sum of sine waves of different frequencies (the classic example is the &lt;a href=&quot;http://www.slack.net/~ant/bl-synth/images/sum_sines.gif&quot; rel=&quot;nofollow&quot;&gt;square wave&lt;/a&gt;). Even if the signal is aperiodic, you can construct a set of sine waves of different frequencies and different powers that approximate your signal. As you use a larger number of sine waves, you get a better approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With sound, power corresponds to loudness. If you play two notes on the piano at the same time, one loudly and one quietly, then one note &quot;has more power in the signal&quot; (is louder) than the other. The Fourier coefficients are essentially the powers of each frequency. Say you have a simple signal that is the sum of 3 sine waves: one at 20Hz, one at 31Hz, and one at 49Hz. If you calculate Fourier coefficients of the signal between 1Hz and 100Hz and plot them, that will be something like your &quot;power spectral density&quot; - how powerful/present each frequency is in the signal. This plot would be zero everywhere except for peaks at 20, 31, and 49 Hz, because all frequencies except those three have zero signal power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be useful for filtering, because sometimes the signal and noise exist in nonoverlapping frequency bands (let's say your signal is only the 31Hz component; then low frequency noise is 20Hz and high frequency noise is 49Hz). You can look at what they are with the PSD/Fourier coefficients plot, and that helps you decide where to set your cutoff frequencies to filter out unwanted frequency bands (aka noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, all of these values will be ranges instead of individual values. So, low frequency noise might be all frequencies &amp;lt;20Hz, high frequency noise might be all frequencies &gt;100Hz, and the signal might exist in the 30-80Hz band. You can then filter appropriately (high-pass filter for frequencies &amp;lt;30Hz, low-pass for frequencies &gt;80Hz). It's not always clean like this: sometimes the different bands overlap (e.g. if signal has 50Hz-500Hz components and noise has frequencies &gt;300Hz, then you have interference between 300 and 500 Hz that is harder to separate out). To make these claims you need to know some characteristics of the signal, which you often do. For example, just above middle C is the note &quot;A&quot; at 440 Hz, and my speaking voice is usually more than an octave below that. If you want to remove higher frequency noises (say, a dog is whining in the background that you want to suppress), you can low-pass filter at 220 Hz (1 octave lower = 1/2 frequency) and know that my voice will still be there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few ways to filter in Matlab. If you search for band-pass filters you can find something that's easy to implement (aka matlab functions that band-pass filter). You can also search for low-pass and high-pass individually; depending on the filter it doesn't make a difference if you do a band-pass vs. if you do the two steps separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps, good luck!&lt;/p&gt;&#xA;" OwnerUserId="8062" LastActivityDate="2014-03-10T05:46:28.423" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14914" PostTypeId="2" ParentId="14878" CreationDate="2014-03-10T06:01:21.750" Score="1" Body="&lt;p&gt;If you want to separate based on frequency, then it seems like you want to work in the frequency domain. You can either calculate a spectrogram to see frequencies' powers over time, or you can calculate the PSD across an entire experiment and decompose the signal that way. You can then get the separated signals by creating two copies (one for each component you want to recognize) of the Fourier-domain signal, zeroing unwanted Fourier coefficients (zeroing different sets of coefficients in each of the two copies), and reconstructing the two signals. To reconstruct signals from a spectrogram, make sure the window overlap is at least 50%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to automate it a little more, you might perform PCA on the spectrograms. Matlab has native FFT, PCA, and spectrogram functions, so it's all very quick.&lt;/p&gt;&#xA;" OwnerUserId="8062" LastActivityDate="2014-03-10T06:01:21.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14915" PostTypeId="2" ParentId="14912" CreationDate="2014-03-10T08:08:11.463" Score="4" Body="&lt;p&gt;First, you should use informative variable names. For example, use &quot;upsample_ratio&quot; instead of x, &quot;inSignal&quot; instead of y etc. This will make your code much easier to read and understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you should avoid using for loops in matlab if possible, and especially don't use nested for loops, since they take very long time in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third, you overuse the variable y. Use intermediate variables to keep temporary and result values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forth, your algorithm concept is wrong in case the upsampling ratio is not a whole number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically for your code, start by replacing the inner loops with array operations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;vec = length(y):-1:i+1;&#xA;y(vec+q) = y(vec);&#xA;y(i+1:1:i+1) = 0;&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8193" LastActivityDate="2014-03-10T08:08:11.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14916" PostTypeId="1" CreationDate="2014-03-10T10:53:18.843" Score="1" ViewCount="358" Body="&lt;p&gt;I need to identify two systems. Those are their Unit Step responses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5e2e2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IfeCB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know, what order of the system that is. It could be second order system with zero in 0. Lecturer told me it was third order system, but then told me to solve it as second order system, so I'm a bit confused. More over we don't have materials for those systems, which would show us how to idnetify them. Lecturer told me to search it on the internet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I wonder whether anyone could give me some hint or better, if anyone could explain how to solve this or what kind of system those systems are. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would welcome some good materials for this task.&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="6" LastEditDate="2014-03-10T17:53:13.893" LastActivityDate="2016-09-30T08:48:10.530" Title="Identification of the system with zeros" Tags="|homework|system-identification|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14917" PostTypeId="1" CreationDate="2014-03-10T11:05:34.660" Score="1" ViewCount="828" Body="&lt;p&gt;I have two audio signal that I want to compare using Matlab, my problem is that I can hear the difference between both loud and clear, but when use the function &lt;code&gt;pwelch&lt;/code&gt; to compare their PSD ,I don't see much difference between them,any idea how can I compare them with a different methode ! thanks in advance ! &lt;/p&gt;&#xA;" OwnerUserId="1785" LastActivityDate="2014-03-11T02:13:36.110" Title="how to compare two audio signals" Tags="|discrete-signals|signal-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14918" PostTypeId="2" ParentId="14912" CreationDate="2014-03-10T13:03:38.003" Score="1" Body="&lt;p&gt;Your question is really a StackOverflow question, not Signal Processing, but since you are here...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;upsampleFactor = desired_Fs/original_Fs; %desired and original sampling frequencies&#xA;output = zeros(length(input)*upsampleFactor,1);&#xA;output(1:upsampleFactor:end) = input;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code assumes that upsampleFactor is an integer.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-10T13:03:38.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14919" PostTypeId="1" AcceptedAnswerId="14920" CreationDate="2014-03-10T13:16:50.140" Score="7" ViewCount="5958" Body="&lt;p&gt;I am basing my question on this &lt;a href=&quot;https://dsp.stackexchange.com/questions/2962/how-to-resample-audio-using-fft-or-dft&quot;&gt;post&lt;/a&gt; here, because I would like additional details on it, as I have not had any success in re-creating it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to simply learn, in no uncertain terms, how to do upsampling via the FFT. There seem to be a lot of details regarding if the signal is even or odd, where exactly to zero-pad, how much exactly, etc, and I am not getting those correct numbers for some reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; So let us say I have an even or odd length signal, of length $N$. I would like to upsample it to, say, $2N$, using FFTs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this done exactly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I tried:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried following the post and others on the web but there seems to be very little consistency. It basically amounts to &quot;zero-padding the frequency domain and then IFFTing&quot; but I do not get proper results. In my case, I have a signal of length $100$, and I would like to upsample it to length $200$. So I do the following command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ifft(fftshift([zeros(1,50) fftshift(fft(signal, 100)) zeros(1,50)]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This however gives me complex data back, and not a signal that is simply upsampled by a factor of $2$. I am not sure where the problem is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1329" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2022-07-11T04:23:32.963" Title="Upsample data using FFTs. How is this exactly done?" Tags="|filters|frequency-spectrum|frequency|resampling|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14920" PostTypeId="2" ParentId="14919" CreationDate="2014-03-10T13:50:02.867" Score="13" Body="&lt;p&gt;One trick, for even-length signals, is what to do with the &quot;middle&quot; sample.  Here, I've split it half and half between each side of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other trick is to ensure that you have the right amplitudes in the resampled signal. Here's it's a factor of 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this in scilab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1,100,'normal');&#xA;X = fft(x);&#xA;XX = 2*[X(1:50) X(51)/2 zeros(1,99) X(51)/2 X(52:100)];&#xA;xx = ifft(XX);&#xA;&#xA;clf;&#xA;plot([0:199]/200,xx)&#xA;plot([0:199]/200,xx,'go')&#xA;plot([0:99]/100,x,'r.')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which appears to generate the right thing. The red dots are the original samples, and the green circles (and blue connecting lines) are the resampled data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lL9Rf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the case of an odd number of samples, there are fewer fiddly bits (no splitting the last coefficient):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x2 = rand(1,101,'normal');&#xA;X2 = fft(x2);&#xA;XX2 = 2*[X2(1:51) zeros(1,101)  X2(52:101)];&#xA;xx2 = ifft(XX2);&#xA;&#xA;clf;&#xA;plot([0:201]/202,xx2)&#xA;plot([0:201]/202,xx2,'gx')&#xA;plot([0:100]/101,x2,'r.')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2014-03-10T18:48:34.827" LastActivityDate="2014-03-10T18:48:34.827" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14921" PostTypeId="2" ParentId="14862" CreationDate="2014-03-10T16:22:36.217" Score="0" Body="&lt;p&gt;Another solution can be to model the noise using the non-sine frequencies. This relies on having a reasonable parametric model whose parameters can be estimated from the non-sine frequencies. E.g. if you know the noise is white or pink, this is fairly straightforward. Once you've got the parameters estimated, it's also easy to estimate how much noise there is at the sine frequency, and sum up all noise contributions.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-03-10T16:22:36.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14923" PostTypeId="2" ParentId="14850" CreationDate="2014-03-10T16:49:35.980" Score="1" Body="&lt;p&gt;That's to be expected. If the input of your FF transform is 30 (real) points, you also get 30 real amplitudes out, for 30 different frequency bins. Each bin is (44100/2)/30 Hz wide, or about 700 Hz. That is &lt;em&gt;quite&lt;/em&gt; wide. Add to that the effect of spectral leakage, which may quite well extend for 5 bins in either direction. 10 out of 30 bins will contain the ground frequency. Any higher harmonics will add to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, people use much longer FFT's. 256 is quite a common choice, and 1024 isn't unheard of either.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-03-10T16:49:35.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14924" PostTypeId="2" ParentId="14916" CreationDate="2014-03-10T18:00:03.997" Score="1" Body="&lt;p&gt;&lt;strong&gt;Hint&lt;/strong&gt;: It's a system with a damped oscillation of a single frequency sine wave, which also starts with an arbitrary phase. That should give you amplitude curve (damping), oscillation component (sinusoidal wave) and phase (starting point of the wave). If you can figure out the general form this system takes mathematically, it's a matter of plugging in the right values for those three.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Another hint&lt;/strong&gt;:&#xA;Don't overthink the system order. Think about what a first order system could look like. Do you need to go further? What could a second order system look like? Do you need to go further, etc. I guarantee you will stop pretty early.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Perhaps a more important hint&lt;/strong&gt;:&#xA;You're given a step response, not an impulse response, but there's a way to go from one to the other (what is it). Once you find the expression to describe this curve, going to impulse response should be very easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;One last hint&lt;/strong&gt;:&#xA;Depending on how your subject is taught, this may help or this may hinder your attempts, so take this one with a grain of salt. If it confuses you, ignore it. My Linear Systems professor said this and made us repeat this out loud in class almost every lecture: &lt;em&gt;Solutions to linear systems are always exponentials&lt;/em&gt;!&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2014-03-10T18:44:41.367" LastActivityDate="2014-03-10T18:44:41.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14925" PostTypeId="2" ParentId="14125" CreationDate="2014-03-10T21:41:06.843" Score="0" Body="&lt;p&gt;I have an analog sine wave generator that outputs 17kHz. And I am sure that it is realistically occurring. If I wanted to use this signal for some sound effect for a youthful audience, for, say, a finite twenty periods, and the first sample exactly coincides with a zero crossing, then I'm pretty sure that it is not going to reach its full amplitude in the reconstruction. So much for faithful reconstruction, I might say, even at a signal frequency well below half the sampling rate. Seems like my old open reel would do a better job than a 44k1 sound adapter.&lt;/p&gt;&#xA;" OwnerUserId="8197" LastActivityDate="2014-03-10T21:41:06.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14926" PostTypeId="1" AcceptedAnswerId="14931" CreationDate="2014-03-10T23:44:09.913" Score="1" ViewCount="1922" Body="&lt;p&gt;I'm obtaining MFCC by using the function wave2mfcc from the Speech and Audio Processing library (SAP) from here &lt;a href=&quot;http://mirlab.org/jang/matlab/toolbox/&quot; rel=&quot;nofollow&quot;&gt;http://mirlab.org/jang/matlab/toolbox/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps follows the procedure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take the Fourier transform of (a windowed excerpt of) a signal.&lt;/li&gt;&#xA;&lt;li&gt;Map the powers of the spectrum obtained above onto the mel scale, using triangular overlapping windows.&lt;/li&gt;&#xA;&lt;li&gt;Take the logs of the powers at each of the mel frequencies&lt;/li&gt;&#xA;&lt;li&gt;Take the discrete cosine transform of the list of mel log powers, as if it were a signal&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As I have previously read, the MFCC are the &lt;strong&gt;spectral envelope&lt;/strong&gt; of the signal, but I don't know how to relate the coefficients with the envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I have a signal 'example.wav' &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[signal fs] = wavread('example.wav');&#xA;    figure(1); plot(log(abs(fft(signal)));&#xA;    mfcc = wave3mfcc(signal,fs);&#xA;    figure(2); plot(mfcc):&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand the MFCC should have the shape of the figure 1, but in my case it doesn't, maybe I'm missing some step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody tell me please how to relate them and being able to graph?&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2014-03-11T08:20:56.903" Title="Spectral Envelope from MFCC" Tags="|frequency-spectrum|mfcc|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14930" PostTypeId="2" ParentId="14125" CreationDate="2014-03-11T06:25:16.373" Score="0" Body="&lt;p&gt;And that, rbj, seems to be answering OP's question. It is the 'ringing' of the reconstruction filter that fills the 'holes' made by the 'beat' of the sampling rate (to put it mildly simplistic). The samples still coincide with the frequency of the signal to be reproduced, so the filter keeps getting energy at that frequency. And, in an ironic contrast with previous assertions regarding 'infinite signals', it would actually be impossible to correctly  quantize a signal that just 'jumps from the origin' for a few samples, as such a signal has infinite bandwidth. So OP's example cannot be the whole signal. Formulas for bandwith used in amplitude modulation can explain.&lt;/p&gt;&#xA;" OwnerUserId="8197" LastEditorUserId="8197" LastEditDate="2014-03-11T06:40:38.880" LastActivityDate="2014-03-11T06:40:38.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14931" PostTypeId="2" ParentId="14926" CreationDate="2014-03-11T08:20:56.903" Score="4" Body="&lt;p&gt;It would be more accurate to say that the MFCC &quot;capture&quot; or &quot;represent&quot; the spectral envelope - in the sense that two signals with a similar spectral envelope will have a similar sequence of MFCC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MFCC coefficients themselves are not supposed to &quot;look&quot; like the spectral envelope when plotted. After all the spectral envelope is a &quot;big&quot; vector (as long as the size of an analysis window), while the MFCC are designed to be short (a handful of coefficients). The spectral envelope is highly redundant (this is a very smooth function, consecutive values are correlated), while the MFCC are, by design, very little correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One could visualize the spectral envelope from the MFCC by inverting all steps in the process except the first one (note that you probably omitted one last step: truncate the vector and keep first 13 or 20 coefficients). The reverse operations would thus be: pad with zeros, compute inverse DCT, take exponential, and compute a matrix product with the matrix containing the triangular bin responses. This will yield a smoothed version of the spectrum that will show what the MFCC &quot;see&quot; of the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, unless &quot;example.wav&quot; is very short, there is something wrong in your code. Audio signals are analyzed in short overlapping frames rather than wholly. It's likely that you might instead want to look at spectrograms; and at the MFCC as a 2D matrix (imagesc).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-03-11T08:20:56.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14934" PostTypeId="2" ParentId="11546" CreationDate="2014-03-11T13:43:12.670" Score="1" Body="&lt;p&gt;I think that this approach should work rather well (I did very similar project few years ago). Things you might consider:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You probably might want to use pre-emphasis filter on a signal.&lt;/li&gt;&#xA;&lt;li&gt;In addition to MFCC features you can also include $\Delta$ and $\Delta\Delta$ (first and second derivatives - simple differences).&lt;/li&gt;&#xA;&lt;li&gt;Comparing against more templates in my case largely improved recognition rate. I think that the easiest way do so is by using k-NN algorithm on distances returned from DWT.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-01-06T09:05:05.987" LastActivityDate="2015-01-06T09:05:05.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14935" PostTypeId="2" ParentId="14808" CreationDate="2014-03-11T17:23:26.537" Score="5" Body="&lt;p&gt;Let's assume that signal you are analysing is sinusoid with amplitude &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x=a\sin{2\pi f_{0} t}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its RMS value of amplitude is then: &lt;span class=&quot;math-container&quot;&gt;$\dfrac{a}{\sqrt{2}}$&lt;/span&gt; as you noticed in your code. Before performing DFT it is good practice to window signal as it decreases leakage, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After transforming this signal into the frequency domain, you will obtain a two-sided spectrum. Then we have to take the magnitude of these complex values. Probably you would notice that all of them are very high. That's because energy is not normalised. Normalisation can be done via dividing values of magnitude by energy of your window. As people tend to take signal &quot;as it is&quot; (which is equal to applying rectangular window) the spectrum is then divided by a number of samples &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. For different types of windows this factor that is equal to the sum of all window samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, we are only interested in one half of a spectrum, therefore the amplitude of all samples must be multiplied by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; to compensate the loss of energy, except DC component (which appears only once) and Nyquist bin (if it's present).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, as you want to analyse RMS of the signal, you must understand the following. All values of single-sided spectrum are of height &lt;span class=&quot;math-container&quot;&gt;$\dfrac{A_{i}^{2}}{2}$&lt;/span&gt;, which is equal to &lt;span class=&quot;math-container&quot;&gt;$ \left( \dfrac{A_{i}}{\sqrt{2}}\right)^{2}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\dfrac{A_{i}}{\sqrt{2}}$&lt;/span&gt; is the RMS magnitude amplitude for the &lt;em&gt;i-th&lt;/em&gt; frequency component. Translating this into Python code you obtain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;fs = 5e5       # Sampling frequency [Hz]&#xA;duration = 10  # Duration of the test signal [s]&#xA;&#xA;N = int(fs * duration)&#xA;t = np.arange(N, dtype=float) / fs&#xA;&#xA;f = 1000  # Frequency of the test signal [Hz]&#xA;sensitivity = 0.004  # Sensitivity of the microphone [mV/Pa]&#xA;p_ref = 2e-5 # Reference acoustic pressure [Pa]&#xA;amp = sensitivity * np.sqrt(2)  # Amplitude of sinusoidal signal with RMS of 4 mV (94 dB SPL)&#xA;signal = amp * np.sin(2 * np.pi * f * duration * t)  # Signal [V]&#xA;&#xA;# Calculate the level from time domain signal&#xA;rms_time = np.sqrt(np.mean(signal**2))&#xA;db_time = 20 * np.log10(rms_time / sensitivity / p_ref)&#xA;&#xA;# Apply window to the signal&#xA;win = np.hamming(N)&#xA;signal = signal * win&#xA;&#xA;# Get the spectrum and shift it so that DC is in the middle&#xA;spectrum = np.fft.fftshift( np.fft.fft(signal) )&#xA;freq = np.fft.fftshift( np.fft.fftfreq(N, 1 / fs) )&#xA;&#xA;# Take only the positive frequencies&#xA;spectrum = spectrum[N//2:]&#xA;freq = freq[N//2:]&#xA;&#xA;# Since we just removed the energy in negative frequencies, account for that&#xA;spectrum *= 2&#xA;# If there is even number of samples, do not normalize the Nyquist bin&#xA;if N % 2 == 0:&#xA;    spectrum[-1] /= 2&#xA;&#xA;# Scale the magnitude of FFT by window energy&#xA;spectrum_mag = np.abs(spectrum) / np.sum(win)&#xA;&#xA;# To obtain RMS values, divide by sqrt(2)&#xA;spectrum_rms = spectrum_mag / np.sqrt(2)&#xA;# Do not scale the DC component&#xA;spectrum_rms[0] *= np.sqrt(2) / 2&#xA;&#xA;# Convert to decibel scale&#xA;spectrum_db = 20 * np.log10(spectrum_rms / sensitivity / p_ref)&#xA;&#xA;# Compare the outputs&#xA;print(&quot;Difference in levels: {} dB&quot;.format(db_time - spectrum_db.max()))&#xA;&#xA;plt.semilogx(freq, spectrum_db)&#xA;plt.xlim( (1, fs/2)  )&#xA;plt.ylim( (0, 120) )&#xA;plt.grid('on')&#xA;plt.xlabel(&quot;Frequency [Hz]&quot;)&#xA;plt.ylabel(&quot;SPL [dB]&quot;)&#xA;&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Rxfsz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rxfsz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Difference in levels: -1.4210854715202004e-14 dB&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As you can see, this is producing consistent results for both time and frequency domain. Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2020-02-24T20:42:56.587" LastActivityDate="2020-02-24T20:42:56.587" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14936" PostTypeId="1" CreationDate="2014-03-11T17:38:56.170" Score="0" ViewCount="190" Body="&lt;p&gt;Calculate the entropy of Turkish alphabet and compare with the entropy of English alphabet with using Matlab?&#xA;  How can ı do this question anybody help please?..&lt;/p&gt;&#xA;" OwnerUserId="8206" LastActivityDate="2014-03-11T17:59:11.097" Title="Calculate the entropy of Turkish alphabet and compare with the entropy of English alphabet with using Matlab?" Tags="|matlab|computer-vision|signal-analysis|linear-algebra|" AnswerCount="1" CommentCount="0" ClosedDate="2014-04-30T07:10:41.297" ContentLicense="CC BY-SA 3.0" />
  <row Id="14937" PostTypeId="2" ParentId="14936" CreationDate="2014-03-11T17:59:11.097" Score="4" Body="&lt;p&gt;I'll give you a hint: You need the probability distribution of the alphabet (English and Turkish). For English see the &lt;a href=&quot;http://en.wikipedia.org/wiki/Letter_frequency&quot; rel=&quot;nofollow&quot;&gt;Wikipedia &quot;Letter Frequency&quot; page&lt;/a&gt;. Now it's possible to compute the Entropy of this distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is a rough approximation (and an upper bound) since in practice, the letters of a word (and a sentence) are correlated. So, for example, in English the letter 'q' is always followed by 'u'. Thus, the entropy of a source producing English documents is strictly less than the one you'll get from looking at single letters.&lt;/p&gt;&#xA;" OwnerUserId="1082" LastActivityDate="2014-03-11T17:59:11.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14938" PostTypeId="2" ParentId="14903" CreationDate="2014-03-11T18:05:31.040" Score="1" Body="&lt;p&gt;As long as the &quot;distortion&quot; is caused by a linear system, its effect can be modeled by a convolution operation with some &quot;filter&quot;. The filter is different for different applications and perhaps even different scenarios and is usually measured / estimated before the deconvolution operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The deconvolution itself attempts to recover the original signal given the measured output which is the convolution of a signal with a filter (essentially the signal was filtered and we use the result to try and recover the original signal before filtering).&lt;/p&gt;&#xA;" OwnerUserId="1082" LastActivityDate="2014-03-11T18:05:31.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14940" PostTypeId="1" AcceptedAnswerId="15956" CreationDate="2014-03-11T18:45:12.443" Score="1" ViewCount="3535" Body="&lt;p&gt;Currently doing some signal analysis in python for a major project in my physics degree which is due really soon. I need some help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have two signals, f(t) and g(t) which are recorded over the same amount of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;f(t) and g(t) both feature different amounts of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;f(t) and g(t) are recorded at different sampling rates so I have two different quantities of measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For analysis I imagine I will need:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Interpolation (or resampling?) both signals to get the same sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) Smoothing/filtering to reduce noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a then b or b then a?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to ideally have two signals with equal sampling frequencies. I would also like all values of f(t) and g(t) to occupy the same points on the t (x) axis. In addition to this I would like to smooth the data as much as possible with a minimal loss of information.&lt;/p&gt;&#xA;" OwnerUserId="8207" LastActivityDate="2014-07-29T17:59:32.340" Title="filter and resample or resample and smooth?" Tags="|interpolation|smoothing|filtering|resampling|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14941" PostTypeId="2" ParentId="14878" CreationDate="2014-03-11T18:50:24.500" Score="0" Body="&lt;p&gt;Maybe you should use Wavelets or the Matching pursuit algorithm. I see two perfect Gabor atoms  there. The new MATLAB has implemented Matching Pursuit.&lt;/p&gt;&#xA;" OwnerUserId="4627" LastActivityDate="2014-03-11T18:50:24.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14943" PostTypeId="2" ParentId="14940" CreationDate="2014-03-11T20:02:41.207" Score="0" Body="&lt;p&gt;If the 2 Fs are multiple each other the simple thing than you have to do is Interpolate the signal with the lowest Fs. Remember that interpolation is the process of upsampling and filtering a signal to increase its effective sampling rate.&#xA;So you have to up-samplig data of a factor L (put L zero btw each samples) and then low pass filter (with freq cut = pi/L).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the 2 Fs are not multiple each other you 2 Interpolate each data with different interpolation factor in order to obtain the same sampling freq.&#xA;In any case: it is not recommend decimante. I will lost data.&lt;/p&gt;&#xA;" OwnerUserId="8209" LastActivityDate="2014-03-11T20:02:41.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14944" PostTypeId="1" AcceptedAnswerId="14945" CreationDate="2014-03-11T20:33:20.210" Score="3" ViewCount="3454" Body="&lt;p&gt;I have one quite simple question: how does the amplitude of the signal scale when we do FFT where FFT window length is shorter then duration of the signal? Does this means that if FFT size is 12 time shorter that also amplitude of the signal will scale by 1/12? if so what is the mathematical explanation.&#xA;Thx in adavance for any reply.&lt;/p&gt;&#xA;" OwnerUserId="8210" LastActivityDate="2014-03-11T22:31:23.460" Title="How does amplitude scale when FFT size is smaller then signal duration?" Tags="|fft|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14945" PostTypeId="2" ParentId="14944" CreationDate="2014-03-11T21:16:56.797" Score="3" Body="&lt;p&gt;When you perform simple DFT of your signal with length $N$, then you have to scale it properly. Normally it is done by dividing magnitude by length of spectrum vector, which is $N$. Another thing is that normally we are interested in one-sided spectrum, therefore you need to multiply your above result by 2 to compensate energy. This will assure, that values of magnitude are representative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case when you are using windows different from rectangular (Hamming, Blackman, etc.) you are not dividing by $N$ - you must scale it by sum of your window samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore when you are windowing your signal, you get a new signal with a length of a window. Thus in your case amplitude will be scaled down by 12.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example for 1Hz sine wave and two window types is shown below. Please note, that frequency axis is chopped at 3Hz. You can see that amplitude of peaks is equal to unit amplitude of signal. Also in case of Hamming window side-lobes are much lower than in case of rectangular, sacrificing main-lobe width at the same time. This can be seen better in logarithmic scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/odn9Z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB code used to produce result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc, clear all, close all&#xA;f0 = 1;        % fundamental frequency&#xA;fs = 50;       % sampling frequency&#xA;T = 6*pi;      % upper time limit &#xA;t = 0:1/fs:T;  % time vector&#xA;N = length(t); % number of samples&#xA;&#xA;% 5 Hz sinusoid with unit amplitude&#xA;s = sin(2*pi*f0*t);&#xA;% Windowing signal&#xA;win = hamming(N)'; &#xA;s_win = s.*win;&#xA;% Magnitude spectra&#xA;S = abs(fft(s));&#xA;S_win = abs(fft(s_win));&#xA;% Frequency vector&#xA;f = (0:fs/N:round(fs/2));&#xA;% Take one-sided spectrum&#xA;S_h = 2*S(1:length(f));&#xA;S_win_h = 2*S_win(1:length(f));&#xA;% Normalisation&#xA;S_h = S_h / length(s);&#xA;S_win_h = S_win_h / sum(win);&#xA;% Time domain signal plots&#xA;subplot(2,1,1)&#xA;plot(t,s)&#xA;xlim([0 T]); grid on; hold on;&#xA;plot(t,s_win,'r');&#xA;legend({'Rectangular window','Hamming window'})&#xA;xlabel('Time'); ylabel('Amplitude')&#xA;% Frequency domain plots&#xA;subplot(2,1,2)&#xA;plot(f, S_h)&#xA;grid on; hold on;&#xA;plot(f, S_win_h, 'r');&#xA;legend({'Rectangular window','Hamming window'})&#xA;xlabel('Frequency'); ylabel('Amplitude')&#xA;xlim([0 3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-03-11T22:31:23.460" LastActivityDate="2014-03-11T22:31:23.460" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="14946" PostTypeId="1" CreationDate="2014-03-11T21:56:18.410" Score="1" ViewCount="418" Body="&lt;p&gt;I've seen the use of a Causal wavelet mentioned a few times but have never seen any examples of them in use with Matlab.  Is it possible to to perform a Wavelet Decomposition using a causal wavelet i.e. no future data.  If so an example of how to do this would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8212" LastActivityDate="2014-03-11T21:56:18.410" Title="Causal Wavelet Decomposition" Tags="|wavelet|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14947" PostTypeId="1" CreationDate="2014-03-11T22:15:52.920" Score="1" ViewCount="344" Body="&lt;p&gt;I'm using the MATLAB algotirhm Matching Pursuit to obtain the Gabor atoms forming a signal.&#xA;But now I want to graph them in a &quot;Heisenberg boxes&quot; graph.&#xA;Does someone how if is there a function to graph them like this?:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fJPUH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uBHck.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or maybe I should write a function for graph. In that case, I know the time and frequency which are the coordinates of the atom, also I have the scale which give me the width in time. But how can I know how much wide is in frequency? I suppose that I must have a certain area and by knowning the width in time I can calculate the width in frequency but I'm not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-------------------------UPDATED----------------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made my own function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function plotGaborAtomos(N,params,fs)&#xA;%N is the length of the atoms&#xA;%params gives the parameters from Gabor atom&#xA;%params is size 3xnCols where first row has the scale, second row has timeShifts and third row the freqs&#xA;%params = scales timeShifts freqs&#xA;nCols = size(params,2);&#xA;a = [ 0 N/fs 0 fs/2];&#xA;plot(a(1)-.5, a(3)-.5);&#xA;axis(a);&#xA;hold on;&#xA;titlestr = 'Sonido prueba';&#xA;titlestr = ['Heisenberg boxes: ' titlestr ];&#xA;title(titlestr);&#xA;xlabel('Time');&#xA;ylabel('Frequency');&#xA;&#xA;area = N;&#xA;for i=1:nCols&#xA;    s = params(1,i);&#xA;    tCentral = params(2,i)/fs; &#xA;    fCentral = params(3,i)*fs;&#xA;    t0 = tCentral - (s/fs)/2; &#xA;    t1 = tCentral + (s/fs)/2; &#xA;    wideFreq = area/(s) * fs/2/N;&#xA;    f0 = fCentral-wideFreq;&#xA;    f1 = fCentral+wideFreq;&#xA;    plot([t0 t1 t1 t0 t0], [f0 f0 f1 f1 f0])&#xA;    plot( tCentral, fCentral, 'o')&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using it in a signal of length 256 gives me this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/J0bj5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As can be seen, the sampling frequency is 44100Hz&lt;/p&gt;&#xA;" OwnerUserId="4627" LastEditorUserId="4627" LastEditDate="2014-03-13T18:43:09.053" LastActivityDate="2014-03-13T18:43:09.053" Title="Heisenberg boxes image for Matching Pursuit" Tags="|matlab|time-frequency|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14951" PostTypeId="1" AcceptedAnswerId="14952" CreationDate="2014-03-12T09:30:25.930" Score="5" ViewCount="478" Body="&lt;p&gt;Say we have a signal S, and we composite it with a 0.1-volume 30-sample-delayed version of itself, so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T(k) = S(k) + 0.1*S(k-30)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would one rearrange this equation to make S the subject?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e given the resultant signal T, and the fact that we know the parameters of the echo (0.1 and 30), how to reproduce the original S?&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2014-03-12T13:29:06.453" LastActivityDate="2016-12-23T21:50:52.350" Title="Trivial echo separation" Tags="|filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14952" PostTypeId="2" ParentId="14951" CreationDate="2014-03-12T09:46:35.433" Score="8" Body="&lt;p&gt;The way the signal $T(k)$ is generated is by applying an FIR (finite impulse response) filter to the signal $S(k)$. The transfer function of this FIR filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=1+0.1z^{-30}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to compensate for such a filter, you need a filter with a transfer function which is the inverse of $H(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(z)=1/H(z)=\frac{1}{1+0.1z^{-30}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a recursive filter with an infinitely long impulse response (IIR). If you filter the signal $T(k)$ with this IIR filter, the result will be $S(k)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-12T09:46:35.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14953" PostTypeId="1" CreationDate="2014-03-12T13:40:37.940" Score="3" ViewCount="7537" Body="&lt;p&gt;Say I have a transfer function, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{1+0.1z^{-30}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I compute the &lt;a href=&quot;https://en.wikipedia.org/wiki/Impulse_response&quot; rel=&quot;nofollow&quot;&gt;impulse response&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is just an example, the important thing is that it is in closed symbolic form!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly, if I could just rewrite $H(z)$ as some polynomial in $z^-1$ (by using a Taylor expansion), I could just read off the coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is there another way?&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="207" LastEditDate="2014-03-12T20:38:55.773" LastActivityDate="2014-03-12T20:38:55.773" Title="How to compute the impulse response from a transfer function" Tags="|impulse-response|transfer-function|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14954" PostTypeId="2" ParentId="14953" CreationDate="2014-03-12T14:11:43.810" Score="5" Body="&lt;p&gt;Your filter is the all-poles IIR, this simplifies things a bit. Normally you can write transfer function in following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z)=\dfrac{\sum_{i=0}^{P}b_{i}z^{-i}}{\sum_{j=0}^{Q}a_{j}z^{-j}} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going back to the discrete time domain you will get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] =\dfrac{1}{a_0}\left( \sum_{i=0}^{P}b_ix[n-i]-\sum_{j=1}^{Q}a_jy[n-j]\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore in your case it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n]=x[n]-0.1y[n-30]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculation of particular values can be done by feeding Kronecker delta to your system ([1 0 0 0 0 0 0 ...] signal). Basically you will observe that something is happening every 30 samples ;) You can easily generate the plot in MATLAB/Octave, just remember that your filter has following coefficients:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b=[1]&#xA;a=[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By calling &lt;em&gt;impz(b,a)&lt;/em&gt; function you will get similar plot (first 100 samples):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8xkbO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-03-12T17:31:58.470" LastActivityDate="2014-03-12T17:31:58.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14955" PostTypeId="2" ParentId="14953" CreationDate="2014-03-12T14:23:02.843" Score="3" Body="&lt;p&gt;If your question is actually about implementing this transfer function, then you don't want to use its impulse response. Simply implement the difference equation correctly given in jolek's answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]= x[n] - 0.1y[n-30],\quad y[-30]=y[-29]=\ldots=y[-1]=0\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only FIR filters are usually implemented directly using their (finite) impulse response. IIR filters are implemented by recursions, as given by (1).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-03-12T14:29:11.473" LastActivityDate="2014-03-12T14:29:11.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14957" PostTypeId="1" CreationDate="2014-03-12T15:03:37.580" Score="3" ViewCount="337" Body="&lt;p&gt;I am on a project to write a function in Java to perform GMSK modulation. I have a good understanding of the GMSK modulation block diagram to an extent, but I have a challenge on what it means to delay the Q-phase input by 90&amp;deg;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I simply multiply my Q-phase bit stream by a negative sine carrier or what? Please, what is the correct thing to do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CoZkY.png&quot; alt=&quot;GMSK MODULATOR BLOCK DIAGRAM&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7271" LastEditorUserId="4298" LastEditDate="2018-08-15T16:59:01.203" LastActivityDate="2018-08-15T16:59:01.203" Title="How do I implement the delay of the Q-Phase Input in GMSK?" Tags="|modulation|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14961" PostTypeId="2" ParentId="14951" CreationDate="2014-03-12T15:43:40.010" Score="2" Body="&lt;p&gt;To complement Matt L. perfectly correct answer, the easy way to rearrange your equation to solve for $S$ is just like you'd do for any simple arithmetic equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{aligned}&#xA;T_k &amp;amp;= S_k + 0.1 \; S_{k-30} \\&#xA;\iff \quad S_k &amp;amp;= T_k - 0.1 \; S_{k-30} \\&#xA;\end{aligned}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I hear you saying, there's still an $S$ on the right hand side!  Yes, there is, but it's a &lt;em&gt;delayed&lt;/em&gt; version of $S$.  If you just start at, say, sample $0$ and compute $S$ for successive samples, then by the time you need to compute $S_k$, you &lt;em&gt;already know&lt;/em&gt; $S_{k-30}$, because you just computed it 30 steps ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you still have a problem for the first 30 steps, since for those the equation ends up referring to a sample with a negative index.  Indeed, you can choose any values you want for those negative-index samples, and still produce a valid output that satisfies the equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For practical purposes, you can just define those samples to be all zero, or perhaps equal to the mean of the first few actual samples.  Fortunately, due to the $0.1$ decay factor in your equation, the influence of whatever values you choose to assign to those initial samples will fade away pretty rapidly, and should be imperceptible after only a few hundred steps.&lt;/p&gt;&#xA;" OwnerUserId="724" LastEditorUserId="724" LastEditDate="2016-12-23T21:50:52.350" LastActivityDate="2016-12-23T21:50:52.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14962" PostTypeId="2" ParentId="14957" CreationDate="2014-03-12T16:47:56.537" Score="4" Body="&lt;p&gt;A system that shifts the input signal by 90 degrees is a Hilbert transformer. For a single sine wave, a 90 degree phase shift is simple (e.g., sine becomes cosine), but for a general signal you need a Hilbert transformer. Check the basics &lt;a href=&quot;http://en.wikipedia.org/wiki/Hilbert_transform#Discrete_Hilbert_transform&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&#xA;It can be implemented using an FIR (finite impulse response) digital filter. Such a filter can be designed in Matlab/Octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; The above is an answer to the question &quot;how do I perform a $90^{\circ}$ phase shift (for non-sinusoidal signals)?&quot;. However, what I didn't notice - and what was luckily pointed out by Jim Clay in a comment - is the fact that in the given diagram there is no need for a phase shifter. The first $90^{\circ}$-block simply symbolizes the splitting of the signal in an I-component and a Q-component. It is not a phase splitter and the $90^{\circ}$-symbol is actually quite misleading.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-03-14T08:31:24.113" LastActivityDate="2014-03-14T08:31:24.113" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="14963" PostTypeId="2" ParentId="13149" CreationDate="2014-03-12T16:53:32.680" Score="0" Body="&lt;p&gt;Said Matrix maps one stereo signal to another &quot;panned&quot; one, that is, one where the phases of both channels have a different phase to before. Even if your guitar produces a two channel signal (some do, however this is not &quot;stereo&quot; in the sense that the signal implies a certain angle to the listener), this alone will not give real panning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actual stereo signals (eg. a sound source recorded with two microphones) do not only have amplitude differences, but also a phase relation, and direction is mostly percieved through phase difference. Amplitude differences alone do make the signal sound directional, but with phase differences (actually: mostly plain delays - the time the signal takes to travel from one ear to the other, so to say) the effect is much more pronounced and sounds far more realistic, too. You can't express that as a matrix (of scalars) alone, you'd need filters, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is just short of a science to make stereo recordings that sound realistic, and even harder to play these back without headphones. With speakers, you will always have cross-talk between the channels, an effect that does not happen to actual sound sources. However, almost everybody is used to how stereo played back through speakers sounds, so just imitating what happens in a recording of a real sound source is not the worst idea of all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to go even more realistic, you could model parts of a skull and of ears. Turns out, the finer you can do this, the more subtle effects you can achieve, eg. making sound sounding like coming from behind instead of in front, or above or below - which makes differences that are not explainable without considering the actual anatomy of a human (and which would be different, would you mix a signal for a dog eg.). There's people out there who actually build &quot;dummy heads&quot; that have acoustic properties close to an actual head, put mics inside and make a recording like that. These sometimes turn out to be completely awesome.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-12T16:53:32.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14965" PostTypeId="1" AcceptedAnswerId="14966" CreationDate="2014-03-12T19:31:28.133" Score="3" ViewCount="4460" Body="&lt;p&gt;I want to implement the 'filter' function in matlab but I just can't seem to replicate the results I get when using the matlab function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of the matlab function is that it takes 3 arguments: 'b' = array of numerator coefficients , 'a' = array of denominator coefficients and 'array' = the array to be filtered.So if you wanted to filter an array with a filter H(z) where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  H(z) = \frac{b_1 + b_2z^{-1}}{a_1 + a_2z^{-1}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and store it in an array called &quot;result&quot; then you would write&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = filter( [b1 b2] , [a1 a2] , array );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I tried to implement the 'filter' function ( with the number of coefficients in the numerator and denominator limited to 2) by getting the difference equation from H(z) then using it to get the resultant array but this route does not seem to work, ie&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  H(z) = \frac{Y(z)}{X(z)} = \frac{b_1 + b_2z^{-1}}{a_1 + a_2z^{-1}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  X(z) (b_1 + b_2z^{-1}) = Y(z)(a_1 + a_2z^{-1})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;b_1x[n] + b_2x[n-1] = a_1y[n] + a_2y[n-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\implies y[n] = \frac{b_1}{a_1}x[n] + \frac{b_2}{a_1}x[n-1] - \frac{a_2}{a_1}y[n-1] &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meaning the matlab code should look something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ result ] = myFilter( b , a , audio )&#xA;%MyFilter&#xA;%a,b = Two Element Arrays&#xA;%array = the array we want to filter&#xA;&#xA;N = size(audio,2);&#xA;&#xA;for i = 1:N&#xA;   if( i == 1 )&#xA;       result(i) = ( b(2)/a(1)) * audio(i);&#xA;&#xA;   else&#xA;       result(i) = ( b(1) / a(1) ) * audio(i) + ...&#xA;                   ( b(2) / a(1) ) * audio(i-1) - ...&#xA;                   ( a(2) / a(1) ) * result(i-1);&#xA;   end&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The function above does not produce the same results as the matlab filter function.Does anyone know what I am doing wrong? Have I understood how the filter function in matlab works?&lt;/p&gt;&#xA;" OwnerUserId="4376" LastActivityDate="2014-03-12T19:42:04.830" Title="How to implement a filter in matlab" Tags="|filters|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14966" PostTypeId="2" ParentId="14965" CreationDate="2014-03-12T19:42:04.830" Score="3" Body="&lt;p&gt;You have a typo in:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result(i) = ( b(2)/a(1)) * audio(i);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result(i) = ( b(1)/a(1)) * audio(i);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-03-12T19:42:04.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14967" PostTypeId="2" ParentId="14940" CreationDate="2014-03-13T01:01:42.703" Score="0" Body="&lt;p&gt;If you want to upsample to the higher of the two frequencies, then order shouldn't matter so much - as David K said, try both (does python have anything like Matlab's &lt;code&gt;interp1&lt;/code&gt;? It's a useful approach for resampling to a common time basis when sampling frequencies aren't multiples/divisors of the target frequency). If you want to downsample, you need to low-pass filter first to avoid aliasing. In that case, low-pass filter to a cutoff frequency less than or equal to half the target sampling frequency. Is that the kind of answer you're looking for, or were you hoping for more details?&lt;/p&gt;&#xA;" OwnerUserId="8062" LastEditorUserId="8062" LastEditDate="2014-03-13T01:08:31.633" LastActivityDate="2014-03-13T01:08:31.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14968" PostTypeId="1" AcceptedAnswerId="14977" CreationDate="2014-03-13T02:59:57.730" Score="8" ViewCount="3771" Body="&lt;p&gt;I know this is maybe a very basic question but I am doing this as a hobby and I can't find a solution to this problem.&#xA;Basically I am trying to remove some noise from data I am reading from an accelerometer. This is what I want to achieve (&lt;a href=&quot;http://eeweb.poly.edu/iselesni/lecture_notes/TVDmm/TVDmm.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Taken from Total Variation Denoising (An MM algorithm)&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3pc1B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read in &lt;a href=&quot;https://dsp.stackexchange.com/questions/3026/picking-the-correct-filter-for-accelerometer-data&quot;&gt;Picking the correct filter for accelerometer data&lt;/a&gt; that Total Variaton Denoising would fit my needs. So I read &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_variation_denoising&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Total Variation Denoising&lt;/a&gt; article from Wikipedia and I think I have to use one of this equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/d4eiM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nyjec.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't understand how I apply this to my signal. Suppose I have a set of x,y points like in the plots above, how I apply the equation to that data? I implemented some simple low-pass and high-pass filters like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this is maybe too complex and I don't know where to start or how. I want to implement this in Java or C so Matlab is not an option (I have seen a lot of MatLab implementing this). I will appreciate any help to guide me in the right direction!&lt;/p&gt;&#xA;" OwnerUserId="8225" LastEditorUserId="128" LastEditDate="2020-04-27T20:11:21.040" LastActivityDate="2022-03-24T17:06:58.073" Title="Using Total Variation Denoising to Clean Accelerometer Data" Tags="|matlab|discrete-signals|noise|denoising|total-variation|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14969" PostTypeId="1" AcceptedAnswerId="14975" CreationDate="2014-03-13T03:14:34.450" Score="1" ViewCount="107" Body="&lt;p&gt;I'm doing MIT's OCW course with Allan Oppenheim - &quot;Signals and Systems&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm given 2 continuous signals$$x(t)=\cos[\omega_x(t+r_x)+\theta_x]\tag1$$ and $$y(t)=\cos[\omega_y(t+r_y)+\theta_y]\tag2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming their phases are the same, the notes tell me that the signals are identical if $$\omega_x=\omega_y$$which is quite obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the discrete case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, I'm given 2 signals $$x[n]=\cos[\Omega_x(n+P_x)+\theta_x]\tag3$$ and $$y[n]=\cos[\Omega_y(n+P_y)+\theta_y]\tag4$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time, assuming that the phases are the same, the notes say that the signals are identical if $$\Omega_x=\Omega_y+2\pi k \tag5$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the $2\pi k$ present in equation 5?&lt;/p&gt;&#xA;" OwnerUserId="3374" LastActivityDate="2014-03-13T09:02:38.207" Title="Comparing 2 sinusoids: Discrete case vs Continuous case" Tags="|discrete-signals|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14970" PostTypeId="1" AcceptedAnswerId="14999" CreationDate="2014-03-13T03:27:27.073" Score="2" ViewCount="798" Body="&lt;p&gt;We are working with speckle noise reduction in ultrasound images by using various despeckling filtering techniques. We compare the performance of each filtering technique by using Quality metrics such as mean square error,signal to noise ratio,peak signal to noise ratio,Edge preservation index,Speckle index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that mean square error metric indicates how different the images being compared are. Therefore the lower its value is,the closer the estimated image is to the original image.&#xA;The peak signal to noise ratio must be high which indicates an improvement in speckle reduction.&lt;strong&gt;But when we calculate these metrics, mean square error is high and Peak signal to noise ratio is small. any one please say me why this happens so.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original image that  we have used is shown below&#xA;&lt;img src=&quot;https://i.stack.imgur.com/jvYFW.jpg&quot; alt=&quot;original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we corrupted the original image with 3% noise &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6EUP0.jpg&quot; alt=&quot;noisy image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula that we used to calculate these metrics is given below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OtNTu.png&quot; alt=&quot;metrics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result which we obtain while using median filter is given below&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fWcyT.png&quot; alt=&quot;results&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7794" LastEditorUserId="26573" LastEditDate="2018-09-08T20:21:14.910" LastActivityDate="2018-09-08T20:21:14.910" Title="Performance metrics for analysing the performance of various filters" Tags="|filters|performance|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14972" PostTypeId="1" AcceptedAnswerId="14978" CreationDate="2014-03-13T05:09:59.200" Score="5" ViewCount="137" Body="&lt;p&gt;I wonder what generalization I can make about what happens when I introduce some error in my sampler spacing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, If I sample once every second I would want my sampler to take a signal at 1s,2s,3s,4s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, my real world sampler looks like more like 1.01s, 1.99s, 2.99s, 4.01s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to make a statement about the Fourier domain. I expect my high frequencies to be ambiguous while my lower ones should not to change, too much. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand how to do this in terms of a uniform change, for example 1.01, 2.02, 3.03 (which is just a change in sampling rate), but I'm wondering how I can describe this with some knowledge of my error distribution, or for my application even understanding how to describe this knowing the mean of the error would be wonderful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody point me in the right direction? &lt;/p&gt;&#xA;" OwnerUserId="941" LastEditorUserId="941" LastEditDate="2014-07-26T22:42:42.637" LastActivityDate="2014-07-26T22:42:42.637" Title="Dealing with Random Errors in Sampling Rates?" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14975" PostTypeId="2" ParentId="14969" CreationDate="2014-03-13T08:56:30.733" Score="3" Body="&lt;p&gt;Because of the $2\pi$-periodicity of the cosine and the discrete nature of $n$ ($n,k\in \mathbb{N}$):&#xA;$$&#xA;x[n] = \cos[\Omega_\mathrm{x}] = \cos[(\Omega_\mathrm{y}+2\pi k)n] = \cos[\Omega_\mathrm{y}n+2\pi kn] = \cos[\Omega_\mathrm{y}n] = y[n]&#xA;$$&#xA;This important &quot;phenomenon&quot; is called aliasing and only occurs for discrete-time signals. The normalized frequency $\Omega$ is therefore usually restricted to the interval $[-\pi, \pi]$.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-03-13T09:02:38.207" LastActivityDate="2014-03-13T09:02:38.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14976" PostTypeId="2" ParentId="14968" CreationDate="2014-03-13T09:10:40.250" Score="5" Body="&lt;p&gt;Well, unless it is a more programming question (how to translate from MATLAB script to C code), you might find interesting the following implementation: &lt;a href=&quot;http://www.gipsa-lab.grenoble-inp.fr/%7Elaurent.condat/download/condat_fast_tv.c&quot; rel=&quot;nofollow noreferrer&quot;&gt;click&lt;/a&gt;, proposed in this article: &lt;a href=&quot;https://lcondat.github.io/publis/Condat-fast_TV-SPL-2013.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A direct algorithm for 1D total variation denoising&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2022-03-24T17:06:58.073" LastActivityDate="2022-03-24T17:06:58.073" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14977" PostTypeId="2" ParentId="14968" CreationDate="2014-03-13T09:15:29.703" Score="6" Body="&lt;p&gt;Apart from Total Variation Denoising you could try a first much simpler approach: a &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;noreferrer&quot;&gt;median-filter&lt;/a&gt;. You just move a window along your data and replace the current input value by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Median#The_sample_median&quot; rel=&quot;noreferrer&quot;&gt;median&lt;/a&gt; of all data in the window. You just have to optimize the window length (by experimenting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, the equations you copied into your question are for 2-dimensional data, but your data are 1-D.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-13T09:15:29.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14978" PostTypeId="2" ParentId="14972" CreationDate="2014-03-13T10:20:08.287" Score="10" Body="&lt;p&gt;You might read up on &quot;Aperture Jitter&quot;. You are correct that higher frequencies are affected more than lower ones. Here is a good reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.analog.com/static/imported-files/tutorials/MT-007.pdf&quot;&gt;http://www.analog.com/static/imported-files/tutorials/MT-007.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-03-13T10:20:08.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14979" PostTypeId="1" AcceptedAnswerId="14981" CreationDate="2014-03-13T12:32:57.157" Score="2" ViewCount="121" Body="&lt;p&gt;Quoted from &lt;a href=&quot;https://dsp.stackexchange.com/questions/1823/how-do-phons-relate-to-loudness&quot;&gt;this&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As a first order approximation it takes ten times the energy to double the perceived loudness&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So is there a 2nd order approximation. If so then how much change in RMS value doubles perceived loudness? Is it governed by any system of equations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-03-13T13:50:31.833" Title="is there a second order approximation to perceived loudness" Tags="|audio|music|acoustics|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14980" PostTypeId="2" ParentId="14979" CreationDate="2014-03-13T13:02:09.397" Score="0" Body="&lt;p&gt;No, by &quot;first order approximation&quot; they probably mean &quot;rule of thumb&quot;. Loudness is a subjective measure related to sound intensity, but there are no exact relationships.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-13T13:02:09.397" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14981" PostTypeId="2" ParentId="14979" CreationDate="2014-03-13T13:50:31.833" Score="3" Body="&lt;p&gt;This depends highly on the signal and it's content. For narrow band signal, the loudness can fairly well be estimated through the equal loudness curves as published in ISO 226 (see for example) &lt;a href=&quot;http://en.wikipedia.org/wiki/Equal-loudness_contour&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Equal-loudness_contour&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For wide band signal, things are more complicated. If the signals are stationary, you apply frequency weighting curves for the appropriate overall loudness (such as &quot;A&quot; or &quot;C&quot; weighting), which gives in some cases a reasonable estimate but can also be quite off by  a fair amount. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next step up in complexity would be a loudness calculation based on on a detailed perceptual model. So you split the signal into &quot;critical bands&quot;, apply forward, backward, simultaneously masking thresholds, apply frequency weightings and than integrate this all up. The resulting loudness is often measure in &quot;Sone&quot; which intended to be a &quot;ratio scale&quot;, meaning it has an absolute zero value (threshold of audibility) and 6 Sones is twice as loud as 3 Sone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So overall it's possible to get very accurate estimates of perceived loudness even for non stationary signals, but it requires deploying very complicated perceptual models. These models basically the same ones as used in perceptual codecs such as MP3, AAC, Dolby Digital etc.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-13T13:50:31.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="14982" PostTypeId="2" ParentId="14894" CreationDate="2014-03-13T19:17:37.050" Score="-1" Body="&lt;p&gt;I looked at this about 5 years ago when I was first hosting karaoke. I didn't find anything that did anywhere near a decent job. The generally had a knob that would allow you to remove more or less vocal, but they all removed/garbled the instrumentals along with it.&lt;/p&gt;&#xA;" OwnerUserId="7689" LastActivityDate="2014-03-13T19:17:37.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14983" PostTypeId="2" ParentId="14894" CreationDate="2014-03-13T19:45:14.423" Score="2" Body="&lt;p&gt;Some recent ideas (2-3 years old, I haven't followed recently):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Design an elaborate generative model of the spectrogram of music signals, combining a non-negative mixture of a small set of background frames (models the background music) + a harmonic comb filtered by a non-negative mixture of smooth basis functions (the source filter model of the lead instrument), with constraints on the pitch transitions. Estimate model parameters from the audio clip. Use Wiener filtering to resynthesize the background music/vocals from the estimated spectra. See &lt;em&gt;A musically motivated mid-level representation for pitch estimation and musical audio source separation&lt;/em&gt; by Durrieu et al. Such Bayesian approaches can be made more complex ad nauseam, by integrating prior knowledge about note transitions/durations - at the cost of increasingly hairy inference procedures. &lt;a href=&quot;http://www.durrieu.ch/research/jstsp2010.html&quot; rel=&quot;nofollow&quot;&gt;Demo time!&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Techniques inspired by background subtraction in video analysis. The idea is that the accompaniment (especially in &quot;bland&quot; pop music) is invariant by a translation of a few bars (the duration of the &quot;loop&quot; or &quot;riff&quot;) - while the vocals are not. Once the structure of the piece of music is known and can be described in terms of repeated groups of bars (a well-studied topic in itself), one can take the median of translated versions of the spectrogram to suppress the vocals. See &lt;em&gt;REpeating Pattern Extraction Technique (REPET): A Simple Method for Music/Voice Separation&lt;/em&gt; by Rafil &amp;amp; Pardo. &lt;a href=&quot;http://www.cs.northwestern.edu/~zra446/repet.html&quot; rel=&quot;nofollow&quot;&gt;Demo time!&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the commercial space, you can download a trial for &lt;a href=&quot;http://www.audionamix.com/shop/&quot; rel=&quot;nofollow&quot;&gt;ADX Trax&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-03-13T19:50:35.337" LastActivityDate="2014-03-13T19:50:35.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14984" PostTypeId="2" ParentId="14322" CreationDate="2014-03-13T20:30:58.103" Score="3" Body="&lt;p&gt;I would start with following set of parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MFCC's (I that know you tried it, but stay with me) without static energy (1'st coefficient)&lt;/li&gt;&#xA;&lt;li&gt;Some descriptors from MPEG-7, like: Spectral Flatness, Harmonicity, Fundamental frequency, Spectral Spread, etc. You can find out more about them here: &lt;a href=&quot;https://www.ims.tuwien.ac.at/publications/tuw-140030.pdf&quot; rel=&quot;nofollow&quot;&gt;click&lt;/a&gt; or in this great book: &lt;a href=&quot;http://www.amazon.co.uk/MPEG-7-Audio-Beyond-Indexing-Retrieval-ebook/dp/B000W0YS42/ref=sr_1_1?ie=UTF8&amp;amp;qid=1394742958&amp;amp;sr=8-1&amp;amp;keywords=mpeg%207%20and%20beyond&quot; rel=&quot;nofollow&quot;&gt;MPEG-7 Audio and Beyond&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You should also include $\Delta$'s and $\Delta\Delta$'s of MFCC's and Spectral Flatness. They should really improve accuracy. You can also try to calculate these for other parameters. Having that, you can start with Gaussian Mixture Model or Support Vector Machine (I think that GMM will be suitable for that task). After training your model simply validate it on testing set (seems obvious but I've seen many projects where people tested their Machine Learning algorithms on training set with added noise or, what's even worse, same training data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this, you should perform Feature Optimisation. This is important part, as some of the features are irrelevant (i.e. Spectral Flatness for few first filter banks, while bird's chirp has higher frequencies). Nice publications with many algorithms for that purpose can be found here: &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.101.1337&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;click&lt;/a&gt;,   &lt;a href=&quot;http://www.cs.cmu.edu/~kdeng/thesis/feature.pdf&quot; rel=&quot;nofollow&quot;&gt;click&lt;/a&gt;.&#xA;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-03-13T20:36:30.340" LastActivityDate="2014-03-13T20:36:30.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14985" PostTypeId="1" AcceptedAnswerId="14988" CreationDate="2014-03-13T23:51:48.267" Score="1" ViewCount="1342" Body="&lt;p&gt;I apologize if this is not the correct forum, but I thought I'd ask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an array of signal samples and I want to detect (retroactively, once I have measured the time/magnitude values) if there are any spikes / deviations during a sampled real signal&#xA;How would I do this intelligently? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been computing the mean of all my sets and the standard deviation and seeing if any of the individual samples greatly deviate from the mean, but I'm thinking there must be a more established method or approach&lt;/p&gt;&#xA;" OwnerUserId="8234" LastActivityDate="2014-03-14T01:47:56.480" Title="How can I detect when a signal deviates from a flatline?" Tags="|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="14986" PostTypeId="2" ParentId="13698" CreationDate="2014-03-14T00:16:55.790" Score="1" Body="&lt;p&gt;Octave does have this function. You didn't provide the error that lead you to conclude it does not, but here are some guesses:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;error: 'imadjust' is undefined near column x line y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This could be because you don't have the image package installed, or maybe you just have not loaded it. I'm using the MacPorts package manager where you can install the package by searching 'octave-image'. If you know you have it installed, make sure it's loaded:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pkg load image&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also have encountered the problem that octave's implementation does not deal well with different data formats. This problem manifests as the image appearing completely white or black after running through imadjust. If this is the case, then explicitly convert the data to double before handing it to imadjust and explicitly return it to your format after. Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my_output = uint8(imadjust(double(my_input),gv,[0;255]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally make sure that your gv is a 2 element vector.&lt;/p&gt;&#xA;" OwnerUserId="8235" LastActivityDate="2014-03-14T00:16:55.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14987" PostTypeId="1" AcceptedAnswerId="14998" CreationDate="2014-03-14T00:39:06.433" Score="1" ViewCount="2906" Body="&lt;p&gt;The goal is to preprocess an image in a way that outside the circle isn't in the region-of-interest so set its value to 0 (black). That way the followed step of segmentation will be easier to analyze all the blobs that exists inside that circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My instance isn't this one in particular, but this example is somewhat close enough &#xA;&lt;img src=&quot;https://i.stack.imgur.com/JqghB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking of applying an X across the whole picture, and detecting the outer most intersection of the the X and O, then from there calculate the center, assuming there's no noise on the edges of the rectangle in which the circle is in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR is there a way in Matlab that can already assist me with this?&lt;/p&gt;&#xA;" OwnerUserId="4618" LastEditorUserId="4618" LastEditDate="2014-03-14T11:06:00.830" LastActivityDate="2014-03-14T14:30:41.977" Title="How to detect, using matlab, the center of the biggest circle?" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14988" PostTypeId="2" ParentId="14985" CreationDate="2014-03-14T01:41:58.233" Score="4" Body="&lt;p&gt;This type of problem is part of Detection Theory.  Do you have an estimate of the background noise levels?  How about the statistics of the noise?  If the noise is AWGN, things get a little easier.  You can set a detection threshold based off your noise statistics to achieve a desired probability of detection / probability of false alarm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be careful about using the mean of your data to set the threshold.  The &quot;spikes&quot; could bias your mean estimate.  If the noise is not stationary (i.e. it changes levels), using the mean could result in false detections (alarms).  One simple option is to compute a running average and create a threshold off this running average.  If the sample of interest is above the threshold, declare a detection and do not include the sample in the running average calculation.  There're a ton of variations to this simple concept depending on the situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is truly a flat line without noise, you could apply a highpass filter by subtract the previous sample from the current sample.  The result would be an array of zeros with non-zero sample values at the spikes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more formal treatment of detection theory, I highly recommend Steven Kay's book &quot;Fundamentals of Statistical Signal Processing, Volume II: Detection Theory&quot;.&lt;/p&gt;&#xA;" OwnerUserId="7899" LastEditorUserId="7899" LastEditDate="2014-03-14T01:47:56.480" LastActivityDate="2014-03-14T01:47:56.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14989" PostTypeId="2" ParentId="13739" CreationDate="2014-03-14T01:51:29.777" Score="1" Body="&lt;p&gt;For digital filters the x-axis is samples.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-14T01:51:29.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14990" PostTypeId="1" AcceptedAnswerId="14991" CreationDate="2014-03-14T07:09:07.967" Score="1" ViewCount="738" Body="&lt;p&gt;The following integral (perhaps fourier tranform of $\sin (t \omega)$ ) is not convergent:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\int_{-\infty }^{\infty } e^{-i t \omega } \sin (t \omega ) \, dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As, $\sin (t \omega)$ is NOT an Energy Signal (but a Power Signal), then how come we get successful in finding the fourier transform of $\sin (t \omega)$ ?&lt;/p&gt;&#xA;" OwnerUserId="5049" LastActivityDate="2014-03-14T09:04:46.267" Title="$\sin (t \omega)$ is not an Energy Signal, then how come its Fourier transform do exist?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14991" PostTypeId="2" ParentId="14990" CreationDate="2014-03-14T09:04:46.267" Score="4" Body="&lt;p&gt;You are right that such integrals are meaningless unless they are interpreted as distributions. And this is what we need to do, because - as you know - the Fourier transform of a sine function involves delta impulses. Let me try to make this a bit more intuitive:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse Fourier transform of the delta function $\delta(\omega)$ (in the frequency domain) is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi}\int_{-\infty}^{\infty}\delta(\omega)e^{i\omega t}d\omega= \frac{1}{2\pi}e^{i0\cdot t}=\frac{1}{2\pi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have the Fourier transform relation (time domain $\Longleftrightarrow$ frequency domain)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1\Longleftrightarrow 2\pi\delta(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the shifting property we obtain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{i\omega_0 t}\Longleftrightarrow 2\pi\delta(\omega-\omega_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(\omega_0t)=\frac{1}{2i}[e^{i\omega_0 t}-e^{-i\omega_0 t}]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we get for its Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(\omega_0t)\Longleftrightarrow \frac{\pi}{i}[\delta(\omega-\omega_0)-\delta(\omega+\omega_0)]$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-14T09:04:46.267" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14992" PostTypeId="1" AcceptedAnswerId="14993" CreationDate="2014-03-14T09:39:50.603" Score="0" ViewCount="879" Body="&lt;p&gt;i use  &lt;a href=&quot;https://github.com/grzesiu/fft/blob/9445fbccb925d4e8e7d746d7c582a71a29452814/FFT.c&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; for complex fft. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Output expected&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;$fft[3].real= 32$ (peak at 3rd bin)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$fft[61].real= 32$ ((peak at negative frequency pair of 3rd bin)) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other values negligibly small&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The input is&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;$ y.real = \sin (2\pi*3i/64)$ where $i = 0 \to 63$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ y.imaginary = \sin (0*3i/64)$ where $i = 0 \to 63$ (all zero)&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The output i got&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;$fft[3].imaginary = -32$ (peak at 3rd bin)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$fft[61].imaginary = 32$ ((peak at negative frequency pair of 3rd bin))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other values negligibly small&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the first time i am working with complex input fft. Can somebody explain me why i am getting peaks in imaginary part and not in real part of fft. As of my understanding doing &lt;code&gt;Real FFT&lt;/code&gt; is nothing but using one half of input as Real part input and other half as Imaginary part input to the &lt;code&gt;Compelx radix 2 FFT&lt;/code&gt; algorithm [i remember from &lt;code&gt;John G Proakis&lt;/code&gt; textbook]. But i don't understand why this pseudo complex signal produces this kind of output. Also can someone explain me the phase information of this pseudo complex &#xA;wave ?&lt;/p&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="7868" LastEditDate="2014-03-14T12:00:43.883" LastActivityDate="2014-03-14T12:00:43.883" Title="understanding complex fft results" Tags="|fft|fourier-transform|c|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="14993" PostTypeId="2" ParentId="14992" CreationDate="2014-03-14T11:08:36.397" Score="1" Body="&lt;p&gt;Your expected output can be achieved when the input is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;real part = cos(2*pi*[0:63]*3/64)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;imag part = 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think you have a couple of issues:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You are missing a factor 1/64 in your description of the input above.&lt;/li&gt;&#xA;&lt;li&gt;You should use cos() instead of sin() for the real part of the input.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Try fixing issue 1 in your post, and try fixing issue 2 in your code.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-03-14T11:08:36.397" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="14994" PostTypeId="2" ParentId="14987" CreationDate="2014-03-14T11:21:52.380" Score="0" Body="&lt;p&gt;Ok, I still do not get the &quot;applying an X&quot; part, but will still answer :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a circle generation algorithm called Breshenham's Circle Algorithm : &lt;a href=&quot;http://en.wikipedia.org/wiki/Midpoint_circle_algorithm&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Midpoint_circle_algorithm&lt;/a&gt;. This would generate you a circle with integer coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are to go with floating point, there is also a single pass algorithm:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start traversing the image&lt;/li&gt;&#xA;&lt;li&gt;At each pixel compute the radius to the desired circle: $sqrt(d_x^2+d_y^2)$ where $d_x$ and $d_y$ are the differences of current pixel from the center of the circle. If this value is smaller than your circle you are within the circle and can assign this pixel to 1.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For drawing of circles, you could check out this link:&#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/answers/52895-how-to-draw-circle-in-an-image&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/answers/52895-how-to-draw-circle-in-an-image&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-14T11:21:52.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14995" PostTypeId="1" CreationDate="2014-03-14T13:11:28.983" Score="0" ViewCount="661" Body="&lt;p&gt;I am caught up in a following question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a mixed (causal + anti-causal) input to a system whose output is causal, with system having transfer function with pole at z=-1 and zero at z=1. What is the ROC for the system (if any) ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a bunch.&lt;/p&gt;&#xA;" OwnerUserId="5527" LastActivityDate="2014-03-14T13:21:38.110" Title="Region of Convergence for pole at z=-1 ?" Tags="|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14996" PostTypeId="2" ParentId="14995" CreationDate="2014-03-14T13:21:38.110" Score="1" Body="&lt;p&gt;If the system is causal then the ROC is outside the pole with maximum magnitude. Since there is only one pole at $z=-1$, the ROC is $|z|&amp;gt;1$. Note that the system is not stable since the ROC does not include the unit circle.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-14T13:21:38.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14997" PostTypeId="2" ParentId="14322" CreationDate="2014-03-14T14:18:21.373" Score="1" Body="&lt;p&gt;I tried using chirplet transform (from &lt;a href=&quot;http://mptk.irisa.fr/&quot; rel=&quot;nofollow&quot; title=&quot;MPTK&quot;&gt;MPTK&lt;/a&gt; library) proposed in one of the comments by visoft - with limited success I am afraid. Not that it was not working at all, but I have found much better approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the procedure is quite lengthy, those who are interested I invite to reading third chapter of a small &lt;a href=&quot;https://github.com/tracek/Ornithokrites/blob/master/report/report.pdf?raw=true&quot; rel=&quot;nofollow&quot; title=&quot;Write-up&quot;&gt;write-up&lt;/a&gt; in PDF I created. In comparison to chirplets it is not only roughly 20x faster, but also more flexible, accurate and stable. It proved to be more successful in kiwi recognition than people who initially labelled the supplied data, which I did not think is possible. Here is a list of features I used:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;perceptual spread&lt;/li&gt;&#xA;&lt;li&gt;perceptual sharpness&lt;/li&gt;&#xA;&lt;li&gt;spectral flatness&lt;/li&gt;&#xA;&lt;li&gt;spectral roll-off&lt;/li&gt;&#xA;&lt;li&gt;spectral decrease&lt;/li&gt;&#xA;&lt;li&gt;spectral shape statistics&lt;/li&gt;&#xA;&lt;li&gt;spectral slope&lt;/li&gt;&#xA;&lt;li&gt;Linear Predictive Coding (LPC) coefficients &lt;/li&gt;&#xA;&lt;li&gt;Line Spectral Pairs (LSP) coefficients&lt;/li&gt;&#xA;&lt;li&gt;Octave Band Signal Intensity (OBSI) coefficients&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The idea in essence is quite similar to what jojek was proposing, so +1 and my thanks! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementation details can be found on &lt;a href=&quot;https://github.com/tracek/Ornithokrites&quot; rel=&quot;nofollow&quot; title=&quot;Github&quot;&gt;Github's project page&lt;/a&gt;. Hopefully it can assist other people in similar endeavours. Any comments, suggestions and questions are much welcomed both here and on the project's page.&lt;/p&gt;&#xA;" OwnerUserId="5785" LastActivityDate="2014-03-14T14:18:21.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14998" PostTypeId="2" ParentId="14987" CreationDate="2014-03-14T14:30:41.977" Score="1" Body="&lt;p&gt;Would the built-in function &lt;a href=&quot;http://www.mathworks.com/help/images/ref/imfindcircles.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;imfindcircles&lt;/code&gt;&lt;/a&gt; work for you?  The radius and center are both returned. The examples are included in the same page. The function is based on Hough transform so it might be an overkill.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another much faster method is &lt;a href=&quot;http://www.mathworks.com/help/images/ref/regionprops.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;regionprops&lt;/code&gt;&lt;/a&gt;. You may use this function &lt;strong&gt;only&lt;/strong&gt; after binarizing the image first, and that means there &lt;strong&gt;must&lt;/strong&gt; be a contrast difference between the region inside and outside the circle. You may try something like this (copied from &lt;a href=&quot;https://stackoverflow.com/questions/20400873/detect-a-circular-shape-inside-image-in-matlab&quot;&gt;this post&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;st = regionprops( ~BW, 'Area', 'Centroid', 'PixelIdxList' );&#xA;&#xA;sel = [st.Area] &amp;gt; numel(BW)*0.5; % exclude the small regions&#xA;st = st(sel);&#xA;&#xA;cntr = .5 * [size(BW,2) size(BW,1)]; % Compute region distance to center of image&#xA;d = sqrt( sum( bsxfun(@minus,vertcat( st.Centroid ), cntr ).^2, 2 ) );&#xA;&#xA;[mn idx] = min(d); % pick the region closest to center&#xA;&#xA;res = false(size(BW)); &#xA;res( st(idx).PixelIdxList ) = true; % the region outside the circle is &#xA;                                      set to false, thus excluded&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that in the code above, &lt;code&gt;cntr = .5 * [size(BW,2) size(BW,1)];&lt;/code&gt; assumes the circle is in the center of the whole image. You need to estimate the rough position of the circle in your case as a &lt;em&gt;prior&lt;/em&gt; knowledge and change this line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Several assumptions mentioned above make the &lt;code&gt;regionprops&lt;/code&gt; option more tricky than &lt;code&gt;imfindcircles&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-03-14T14:30:41.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="14999" PostTypeId="2" ParentId="14970" CreationDate="2014-03-14T15:20:45.077" Score="0" Body="&lt;p&gt;They are getting values like that because they may be reading the image as &lt;code&gt;double&lt;/code&gt; while calculating the metrics, you can use &lt;code&gt;im2uint8&lt;/code&gt; to convert the double into &lt;code&gt;uint8&lt;/code&gt; and estimate the metrics. you will get the desired output. Though it does not mean that their values are incorrect. &lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-03-14T15:20:45.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15000" PostTypeId="1" CreationDate="2014-03-14T23:52:48.640" Score="3" ViewCount="1929" Body="&lt;p&gt;I'm investigating whether it's practical to use a Goertzel filter to decipher a binary message phase-shift encoded into a single frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cn7W8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the bottom line to reflect the discontinuities visible in the top line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code generating the second and third lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;samps_per_sec = SAMP_RATE&#xA;cycles_per_sec = CARRIER_FREQ_Hz&#xA;rad_per_sec = two_pi * cycles_per_sec&#xA;rad_per_samp = rad_per_sec / samps_per_sec&#xA;&#xA;import cmath&#xA;&#xA;def Goertzel( signal ):&#xA;&#xA;  w = rad_per_samp&#xA;  exp_w = np.exp( 1j*w )&#xA;  exp_nw = np.exp( -1j*w ) # or exp_w.conj()&#xA;&#xA;  _s = 0.&#xA;  __s = 0.&#xA;&#xA;  out_s= []&#xA;  out_phase= []&#xA;  for i in range( 0, len( signal ) ):&#xA;    s = signal[i] + 2.*exp_w.real * _s - __s&#xA;    out_s += [s]&#xA;&#xA;    y = s - exp_nw * _s&#xA;&#xA;    phase = cmath.phase( y ) - i * w # subtract expected phase increment&#xA;&#xA;    phasewrap = ( phase + np.pi) % two_pi - np.pi&#xA;    out_phase += [ phasewrap / np.pi ] # range -1 to +1&#xA;&#xA;    __s = _s&#xA;    _s = s&#xA;&#xA;  export_WAV_mono( &quot;out_s.WAV&quot;, 0.001 * np.array( out_s ) )&#xA;  export_WAV_mono( &quot;out_phase.WAV&quot;, 0.1 * np.array( out_phase ) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems as though the third line is just tracking the phase of the second.  Before the signal starts the phase is effectively random (I put a very low microscopic noise level into the signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the second line amplitude goes down to 0 there is a tremor in the phase, which makes sense: as the amplitude approaching zero it is going to go everywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is really worrying is that when the wave inverts its phase, the filter doesn't seem to be able to register this, it is as if the forward thrusters turn off and the backward thrusters turn on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't see how I can get a useful result from this process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the approach fundamentally flawed?  I've copied the maths from the Wikipedia page on Goertzel algorithm, and cross checked it with several implementations I found from various articles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that maybe the implementation is actually correct, and I just had a false expectation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the complete Python script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/local/bin/python&#xA;&#xA;import numpy as np&#xA;from itertools import *&#xA;from array import array&#xA;&#xA;&#xA;# generator expression&#xA;# similar to list comprehensions, but create one value at a time&#xA;# def white_noise( amp=1. ):&#xA;#   return ( np.random.uniform(-amp, +amp) for _ in count(0) )&#xA;&#xA;two_pi = 2. * np.pi&#xA;&#xA;SAMP_RATE = 44100&#xA;SAMPS_PER_WAVE = 20&#xA;WAVES_PER_HALF_BIT = 10&#xA;&#xA;CARRIER_FREQ_Hz = SAMP_RATE / float( SAMPS_PER_WAVE )&#xA;&#xA;SAMPS_PER_HALF_BIT = SAMPS_PER_WAVE * WAVES_PER_HALF_BIT&#xA;&#xA;import wave&#xA;&#xA;def export_WAV_mono( filepath, samps ):&#xA;  # the largest possible signed 16-bit integer&#xA;  S16MAX = float( 2 ** 15 - 1 )&#xA;  samps_sint16 = S16MAX * samps.clip(-1.,+1.)&#xA;  data = array( 'h', samps_sint16.astype(int) )&#xA;&#xA;  wv = wave.open( filepath, &quot;w&quot; )&#xA;&#xA;  wv.setparams( (&#xA;    1,                  # nchannels&#xA;    2,                  # sampwidth in bytes&#xA;    44100,              # framerate&#xA;    len( data ),        # nframes&#xA;    'NONE',             # comptype&#xA;    'not compressed'    # compname&#xA;    ) )&#xA;&#xA;  # this is the crucial step: the .tostring() method forces this into the string format that AIFC requires&#xA;  wv.writeframes( data.tostring() )&#xA;&#xA;  wv.close()&#xA;&#xA;# Fs -&amp;gt; 2 pi&#xA;# 1 -&amp;gt; 2 pi / Fs&#xA;# CARRIER_FREQ_Hz -&amp;gt; ?&#xA;#theta = ( two_pi / SAMP_RATE ) * CARRIER_FREQ_Hz&#xA;&#xA;samps_per_sec = SAMP_RATE&#xA;cycles_per_sec = CARRIER_FREQ_Hz&#xA;rad_per_sec = two_pi * cycles_per_sec&#xA;rad_per_samp = rad_per_sec / samps_per_sec&#xA;&#xA;import cmath&#xA;&#xA;def Goertzel( signal ):&#xA;  # https://sites.google.com/site/hobbydebraj/home/goertzel-algorithm-dtmf-detection&#xA;  # https://dsp.stackexchange.com/questions/145/estimating-onset-time-of-a-tone-burst-in-noise/151#151&#xA;&#xA;  w = rad_per_samp&#xA;  exp_w = np.exp( 1j*w )&#xA;  exp_nw = np.exp( -1j*w ) # or exp_w.conj()&#xA;&#xA;  _s = 0.&#xA;  __s = 0.&#xA;&#xA;  out_s= []&#xA;  out_phase= []&#xA;  for i in range( 0, len( signal ) ):&#xA;    s = signal[i] + 2.*exp_w.real * _s - __s&#xA;    out_s += [s]&#xA;&#xA;    y = s - exp_nw * _s&#xA;&#xA;    phase = cmath.phase( y ) - i * w # subtract expected phase increment&#xA;&#xA;    phasewrap = ( phase + np.pi) % two_pi - np.pi&#xA;    out_phase += [ phasewrap / np.pi ] # range -1 to +1&#xA;&#xA;    __s = _s&#xA;    _s = s&#xA;&#xA;  export_WAV_mono( &quot;out_s.WAV&quot;, 0.001 * np.array( out_s ) )&#xA;  export_WAV_mono( &quot;out_phase.WAV&quot;, 0.1 * np.array( out_phase ) )&#xA;&#xA;&#xA;def main( ):&#xA;  binary_signal = [1,0,1] # ,1,0,1,0,1]&#xA;&#xA;  BEFORE = 100&#xA;  AFTER = 100&#xA;&#xA;  signal = [ ]&#xA;&#xA;  PHASE_SHIFT = np.pi&#xA;&#xA;  phase = 0.&#xA;  for b in binary_signal:&#xA;    phase += PHASE_SHIFT&#xA;&#xA;    counter = 0&#xA;    while True:&#xA;      for i in range( 0, SAMPS_PER_HALF_BIT ):&#xA;        s = np.sin( phase )&#xA;        signal += [s]&#xA;        phase += rad_per_samp&#xA;&#xA;      counter += 1&#xA;      if counter == 2:&#xA;        break&#xA;&#xA;      if b:&#xA;        phase += PHASE_SHIFT&#xA;&#xA;&#xA;&#xA;  print len( signal)&#xA;  noise_len = BEFORE+len(signal)+AFTER&#xA;  amp = 0.001&#xA;  sig = amp * ( 2. * np.random.random( noise_len ) - 1. )&#xA;&#xA;  # SIGNAL_SAMP_OFFSET = 50&#xA;  for i in range( 0, len(signal) ):&#xA;    sig[BEFORE + i] += signal[ i ];&#xA;&#xA;  export_WAV_mono( &quot;signal.WAV&quot;, 0.25 * sig )&#xA;&#xA;&#xA;  Goertzel( sig )&#xA;&#xA;if __name__ == '__main__':&#xA;  main( )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: Links&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/145/estimating-onset-time-of-a-tone-burst-in-noise/151#151&quot;&gt;Estimating onset time of a tone burst in noise?&lt;/a&gt;&#xA;&lt;a href=&quot;http://asp.eurasipjournals.com/content/2012/1/56&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://asp.eurasipjournals.com/content/2012/1/56&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.mstarlabs.com/dsp/goertzel/goertzel.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mstarlabs.com/dsp/goertzel/goertzel.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-03-15T19:31:57.967" Title="Extracting phase using Goertzel filter in Python" Tags="|filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15001" PostTypeId="2" ParentId="15000" CreationDate="2014-03-15T02:33:09.360" Score="3" Body="&lt;p&gt;I think you may be using a Phillips head screwdriver to drive a torx head screw (you're using the wrong tool for the problem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're trying to detect is the phase discontinuities in the original data signal. These are &lt;em&gt;local&lt;/em&gt; discontinuities: they happen once, and then we don't care about past ones any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the Goertzel algorithm is doing is different: It's going to calculate the Fourier coefficient (amplitude and phase) of the &lt;em&gt;entire&lt;/em&gt; data sequence --- including all past phase transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way you can know what that should look like is if you knew the data sequence modulating your sinusoid in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To try to understand this myself, I wrote the &lt;code&gt;scilab&lt;/code&gt; code below (sorry, python is too much of a stretch on a Friday night!).  What I'm trying to calculate is the &quot;true&quot; phase of the signal at every time instant... as you can see, the phase is a little... unpredictable --- because the data is unknowable (well, random).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the figure: the red circles are the &quot;true&quot; phase at the end of each bit period, the blue line is the &quot;true&quot; phase for every time instant, the red and green lines are the phase (and the negative of the phase) of the carrier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bit sequence that was generated for this particular realization was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.  1. -1.  1. -1. -1. -1.  1. -1. -1.  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FvYoy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;scialab&lt;/code&gt; script only below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bits = bool2s(rand(1,10,'normal')&amp;gt;0)*2-1;    &#xA;N = 32;&#xA;f0 = 2/N;&#xA;ONE = cos(2*%pi*f0*[0:N-1] + %pi/3);&#xA;data = kron(bits,ONE);&#xA;&#xA;clear phi&#xA;&#xA;for k=1:length(data)&#xA;    ft = sum(data(1:k).*exp(-%i*2*%pi*[0:k-1]*f0));    &#xA;    phi(k) = atan(imag(ft),real(ft));&#xA;    disp(idx)&#xA;end&#xA;&#xA;clf&#xA;plot(phi)&#xA;boundries = [N:N:length(phi)];&#xA;plot(boundries,phi(boundries),'ro');&#xA;plot([0 N*10], [%pi/3 %pi/3],'r');&#xA;plot([0 N*10], -[%pi/3 %pi/3],'g');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2014-03-15T02:38:13.537" LastActivityDate="2014-03-15T02:38:13.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15002" PostTypeId="1" AcceptedAnswerId="15005" CreationDate="2014-03-15T03:27:54.110" Score="2" ViewCount="17282" Body="&lt;p&gt;I need a small help for my assignment, which is to solve the 8-point FFT without using Matlab or C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preliminary information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;8-point sine wave: [0, 0.7071, 1, 0.7071, 0, -0.7071, -1, -0.7071]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;8-point complex exponential: [1, 0.7071-j0.7071, -j, -0.7071-j0.7071]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here's the attempts I did:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.) Bit reversing the 8-point sine wave and rearrange it to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0, 0, 1, -1, 0.7071, -0.7071, 0.7071, -0.7071]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.) Perform each butterfly calculation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First pass:&#xA;[0, 0, 0, 2, 0, 1.414, 0, 1.414]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second pass:&#xA;[0, -j2, 0, 2, 0, 1.414-j1.414, 0, 1.414+j1.414]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the last:&#xA;[0, -j4, 0, 2-j2, 0, 2.828, 0, 2.828-j2.828]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the last pass which is the result does not match with the actual FFT result in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0, -j4, 0, 0, 0, 0, 0, j4]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any steps I might have missed? Opinions and pointers are greatly appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8240" LastActivityDate="2015-02-28T15:15:44.780" Title="Problems calculating 8-point FFT of an 8-point sine wave by hand" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15003" PostTypeId="1" CreationDate="2014-03-15T09:34:12.523" Score="0" ViewCount="112" Body="&lt;p&gt;I'm interested in sending digital data over ultrasound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial thought is that it should be first converted to BMC:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WnATa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then phase shift encoded (PSK):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XD0kj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initially thought to use a Goertzel filter to decode it, but this runs into trouble: &lt;a href=&quot;https://dsp.stackexchange.com/questions/15000/extracting-phase-using-goertzel-filter-in-python&quot;&gt;Extracting phase using Goertzel filter in Python&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a practical mechanism?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more intelligent way to encode the data, maybe using two frequencies and taking the relative strength at any moment in time?&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-03-15T09:34:12.523" Title="Best strategy for sending digital signal over ultrasound" Tags="|digital-communications|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15005" PostTypeId="2" ParentId="15002" CreationDate="2014-03-15T12:29:43.890" Score="4" Body="&lt;p&gt;I will start from very beginning. So having signal: $ x[n] = [0; \ 0.7071; \ 1; \ 0.7071; \ 0; \ -0.7071; \ -1; \ -0.7071] $ and given exponent: $ w[n] = [1; \ 0.7071 - 0.7071i; \ -i; \ -0.7071 - 0.7071i;\ -1;\ -0.7071 + 0.7071i; \ i; \ 0.7071 + 0.7071i]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First we need to inverse the bits and rearrange our signal. For 8 samples we will obtain following change in indices: $ [0;\ 1;\ 2;\ 3;\ 4;\ 5;\ 6;\ 7] \Rightarrow [0;\ 4;\ 2;\ 6;\ 1;\ 5;\ 3;\ 7] $, thus our signal becomes: $ x[n] = [0; \ 0; \ 1; \ -1; \ 0.7071; \ -0.7071; \ 0.7071; \ -0.7071] $. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now according to following schematic:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Wttcj.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We calculate &quot;butterflies&quot; in following manner:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5G4pY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where: $ W_{N}^{k} = e^{\dfrac{-2\pi i k}{N}} $ (rotating vector on our complex plane with step angle of $2 \pi/N $ )&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Starting from a first butterfly in &lt;strong&gt;first stage&lt;/strong&gt; ($x[0]$ and $x[4]$ as the inputs) we have following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ A = 0, B = 0, W_8^0=w[0]=1$, giving output: $ [0; 0] $, next butterfly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ A = 1, B = -1, W_8^0=w[0]=1$, giving output: $ [0; 2] $, next butterfly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ A = 0.7071, B = -0.7071, W_8^0=w[0]=1$, giving output: $ [0; 1.4142] $, next butterfly is the same with output:  $ [0; 1.4142] $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now, after first pass our vector is as follows (same to the one obtained by Peter Griffin):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x'[n]=[0; \ 0; \ 0; \ 2; \ 0; \ 1.4142; \ 0; \ 1.4142] $&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;At &lt;strong&gt;second stage&lt;/strong&gt;, first butterfly consists of samples: $x'[0]$ and $x'[2] $, where $ W_8^0=1 $. We can therefore calculate the output as: $[0+1\cdot 0; \ 0-1\cdot 0] = [0; \ 0] $. These are outputs $x''[0]$ and $x''[2]$ of the second stage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next butterfly is given by inputs $x'[1]$ and $x'[3] $, where $ W_8^2=w[2]=-i $. We calculate output $x''[1]$, $x''[3]$ as: $[0-i\cdot 2; \ 0-(-i)\cdot 2] = [-2i; \ 2i] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two following butterflies are calculated in the same manner: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[0+1\cdot 0; \ 0-1\cdot 0] = [0; \ 0] \Rightarrow x''[4]$, $x''[6]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[1.4142-i\cdot 1.4142; \ 1.4142-(-i)\cdot 1.4142] = [1.4142-1.4142i; \ 1.4142+1.4142 i] \Rightarrow x''[4], \ x''[6]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So our vector after second stage is following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x''[n] = [0; \ -2i; \ 0; \ 2i; \ 0; \ 1.4142-1.4142i; \ 0; \ 1.4142+1.4142i] $ - you've made a mistake here.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Finally, we calculate results for &lt;strong&gt;third stage&lt;/strong&gt;. By looking at the main schematic, first butterfly consists of samples: $x''[0], x''[4] = [0; 0]$. The $W_N^k$ coefficient is given by $W_8^0=w[0]=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculating butterfly we obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[0+1\cdot 0; \ 0+(-1)\cdot 0] = [0; \ 0] $ - these are final FFT values $X[0], X[4]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving to next butterfly based on samples $x''[1], x''[5] = [-2i; 1.4142-1.4142i]$ with coefficient $W_8^1=w[1]=0.7071 - 0.7071i$. Result: $[-2i+(0.7071 - 0.7071i)\cdot (1.4142-1.4142i); \ -2i-(0.7071 - 0.7071i)\cdot (1.4142-1.4142i)] = [-4i; \ 0] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And next butterfly based on samples $x''[2], x''[6] = [0; \ 0]$, with  $W_8^2=w[2]=-i$ will give $[0+(-i)0; \ 0-(-i)0] = [0; \ 0] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the last butter fly based on samples $x''[3], x''[7] = [2i; \ 1.4142+1.4142i]$, with $W_8^3=w[2]=-0.7071 - 0.7071i$ will result in: $[2i+(-0.7071 - 0.7071i)\cdot (1.4142+1.4142i); \ 2i-(-0.7071 - 0.7071i)\cdot (1.4142+1.4142i)] = [0; \ 4i] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So our final vector is following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X[k] = [0; \ -4i; \ 0; \ 0; \ 0; \ 0; \ 0; \ 4i] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which means MATLAB is calculating FFT correctly ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One final remark - always take care about $W_N^k$ factor - look on the schematic and it's pretty obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-02-28T15:15:44.780" LastActivityDate="2015-02-28T15:15:44.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15006" PostTypeId="2" ParentId="15002" CreationDate="2014-03-15T12:29:55.627" Score="0" Body="&lt;p&gt;The problem is the second pass. The fourth element should be $2i$ instead of $2$. Then everything works out properly. Because the signal is real-valued you have some form of conjugate symmetry in each pass.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-15T12:29:55.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15007" PostTypeId="1" AcceptedAnswerId="15016" CreationDate="2014-03-15T12:48:22.723" Score="5" ViewCount="1705" Body="&lt;p&gt;It is widely known that matching a FIR filter of fixed length to a band model is an unconstrained QP-problem. The MATLAB function &lt;a href=&quot;https://www.mathworks.com/help/signal/ref/firls.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;firls()&lt;/code&gt;&lt;/a&gt; implements a solution to this problem. Basically, one symbolically evaluates integrals of the (Z-domain) transfer function over the unit circle, getting astonishingly simple expressions for the match quality. Additionally, that method is stable and will not fail, other than the &lt;a href=&quot;https://en.wikipedia.org/wiki/Parks%E2%80%93McClellan_filter_design_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Parks McClellan Filter Design Algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to fit IIR filters to such a model in the $ {L}_{2} $ Norm Sense?&lt;br&gt;&#xA;Several problems arise:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;While the cost function (fit quality?) can be written down, is it not a simple quadratic anymore, but a fraction of two quadractics.&lt;/li&gt;&#xA;&lt;li&gt;You appear to have to optimize nominator and denominator at the same time.&lt;/li&gt;&#xA;&lt;li&gt;It might be hard to constrain the denominator to &quot;minimum phase&quot;, so that the resulting filter is stable.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am not looking for gradient descent or other local optimization methods, as the cost function might have several local optima. An idea that crossed my mind would be that it appears possible to pose the FIR problem so that it yields the optimal coefficients for an IIR all-pass.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastEditorUserId="4298" LastEditDate="2020-06-15T16:18:05.390" LastActivityDate="2021-03-20T13:24:55.280" Title="Design $ {L}_{2} $ Norm Optimal Infinite Impulse Response (IIR) Filters" Tags="|filters|filter-design|infinite-impulse-response|optimization|math|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15008" PostTypeId="1" AcceptedAnswerId="15009" CreationDate="2014-03-15T14:14:20.797" Score="2" ViewCount="3801" Body="&lt;p&gt;I am trying to understand how this works, specifically, what the DTFT of each step looks like in each step of the chain (for understanding). I am not looking for an answer like because the input signal has a frequency of $\pi/3$, it will be reconstructed correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xx9Wr.png&quot; alt=&quot;I am trying to understand how this works&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plotted the DTFT of each step in MATLAB and simply don't understand the result. (DTFT of $x_d[n]$ and $x_r[n]$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to know what the transfer functions of the downsampler and upsampler are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following pictures shows the DTFT of $x[n]$, $x_d[n]$ and $x_e[n]$ respectively&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oFp2a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know where the frequency components in the upsampled signal ($x_e[n]$) are coming from. I have noticed though, that it is what you would get if you convolved the original signal ($x[n]$) with an impulse train with period $2\pi/3$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: Why is there no DTFT tag on this site?&lt;/p&gt;&#xA;" OwnerUserId="7737" LastEditorUserId="8202" LastEditDate="2014-03-15T14:36:47.050" LastActivityDate="2017-10-24T03:49:09.650" Title="Trying to understand downsampling and then upsampling" Tags="|fft|discrete-signals|interpolation|downsampling|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15009" PostTypeId="2" ParentId="15008" CreationDate="2014-03-15T15:39:19.147" Score="2" Body="&lt;p&gt;&lt;strong&gt;Downsampling&lt;/strong&gt; can be defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s_{out}[n]= s_{in}[n\cdot M]$ (taking every &lt;em&gt;M-th&lt;/em&gt; signal sample)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying Z-transform we obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\bar{s}_{out}[z]=\dfrac{1}{M}\sum_{m=0}^{M-1}\bar{s}_{in}\left[ z^{1/M} \cdot w_{M}^{m} \right]$, where $w_{M}=e^{-2\pi i /M}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By substituting $z=e^{2\pi i f_n}$ ($f_n $ is the normalised frequency: $f_n = \dfrac{f}{f_s} \in [0, 0.5]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This yields following relationship between input and output spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{s}_{out}[f_n]= \dfrac{1}{M}\sum_{m=0}^{M-1}\hat{s}_{in}\left[ (f_n-m)/M \right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can understand that as a fact that your spectrum is being copied M times (even outside of your original sampling frequency) and stretched by factor of M.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Upsampling&lt;/strong&gt; on the other hand is governed by following equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s_{out}[n]=\begin{cases} s_{in}(n/M) &amp;amp; \text{n} \; mod \;\text{M} =0 \\ 0 &amp;amp; \text{otherwise}\end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying Z-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \sum_{n} s_{out}[n]\cdot z^{-n} = \sum_{n} s_{in}[n]\cdot z^{-nM}$, which gives: $\bar{s}_{out}[z]=\bar{s}_{in}[z^M] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By doing same substitution of a unit circle instead of &lt;em&gt;z&lt;/em&gt; variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{s}_{out}[f_n] = \hat{s}_{in}[M\cdot f_n] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can imagine that this equation is squeezing your spectrum by factor of M, bringing at the same time whatever is outside of your sampling frequency range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plots you've obtained are great example how it works! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. There is a &lt;strong&gt;&lt;em&gt;dft&lt;/em&gt;&lt;/strong&gt; tag.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-03-15T16:09:42.447" LastActivityDate="2014-03-15T16:09:42.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15011" PostTypeId="2" ParentId="15000" CreationDate="2014-03-15T18:58:46.260" Score="3" Body="&lt;p&gt;Instead of using a changing length Goertzel filter, use two fixed length Goertzel filters.  Your current filter is getting one point longer at each output point, which continually changes the frequency response.  A sliding Goertzel filter, if you can solve stability issues, may require less computation than recomputing a fixed length filter at every input sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With two fixed length filters, each one bit-time long, the pair offset by one bit-time, you can check for maxima in the phase difference between the two complex Goertzel (or 1-bin DFT) filters to mark a phase shift in the input at the point right between the two filters.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-15T19:05:05.250" LastActivityDate="2014-03-15T19:05:05.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15012" PostTypeId="1" CreationDate="2014-03-15T19:02:11.270" Score="2" ViewCount="1256" Body="&lt;p&gt;I am currently trying to implement a GMSK demodulator, using Java. I am actualy trying to use the model of this block diagram. However, I really do not know what goes on within the mode selector and the differentiator. Does anyone have an understanding of this?, or is there a better method i can employ which may or may not be different from this ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JHDeV.jpg&quot; alt=&quot;GMSK Demodulator block diagram&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7271" LastActivityDate="2014-03-15T19:02:11.270" Title="How to implement GMSK demodulation" Tags="|modulation|demodulation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15013" PostTypeId="1" AcceptedAnswerId="15014" CreationDate="2014-03-15T19:13:55.107" Score="-1" ViewCount="1399" Body="&lt;p&gt;I am reading tutorials about windowing and have read following  sentence:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For an integer number of cycles, all smoothing windows yield the same peak amplitude reading and have excellent amplitude accuracy. Side lobes do not appear because the spectrum of the smoothing window approaches zero at Δf intervals on either side of the main lobe.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This term integer number of cycle, I have meet several times and please explain me what does it means? Does it means that periodic functions are integer number of cycles, because they  repeat  at each period, which is equal main period multiplied by some integer? What about non-periodic signals? Thanks in advance.&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="8202" LastEditDate="2014-03-15T19:54:28.193" LastActivityDate="2014-03-15T21:43:21.087" Title="Spectral leakage - understanding the integer number of cycles while windowing" Tags="|discrete-signals|continuous-signals|window-functions|periodic|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15014" PostTypeId="2" ParentId="15013" CreationDate="2014-03-15T19:28:52.473" Score="1" Body="&lt;p&gt;I believe that you took this sentences from here: &lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/371361K-01/lvanlsconcepts/windowing_signals/&quot; rel=&quot;nofollow&quot;&gt;National Instruments - Windowing Signals&lt;/a&gt;. By &quot;cycle&quot; they mean Hz, such as 100 Hz = 100 cycles per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what &quot;integer&quot; means? Well, simply numbers 1, 2, 3, etc. (no fractional component). Basically they are addressing the problem of spectral leakage. If for example you have a sinusoid with frequency 250 Hz, and you will take integer number of its periods, so after calculating the DFT your frequency bins are $0, 1, 2, ..., 250, ...$. Then peak from your signal will match exactly one of the frequency bins.&#xA;In case it is not matched (for example 250.5 Hz, signal is same length yielding non-integer number of cycles), then you need to deal with spectral leakage - energy at this given frequency spreads across frequency bins on left and right (i.e. 250Hz and 251 Hz). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why we are also using time windows - to decrease effect of spectral leakage (errors is peaks amplitude).&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-03-15T20:10:36.703" LastActivityDate="2014-03-15T20:10:36.703" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15015" PostTypeId="1" AcceptedAnswerId="15020" CreationDate="2014-03-15T20:34:43.483" Score="3" ViewCount="1276" Body="&lt;p&gt;I have read about spectral leakages in other posts here. From what i understand, it occurs because you dont have an integer number of time periods in your sampled data. By default a rectangular window (=no window) is used and it corresponds to a sinc function in the frequency domain. If we have an integer number of time periods in our data the zeros of the sinc cancel out every other frequency component giving us the correct value. If however we dont have an integer number of time periods in our sample, that corresponds to a shifted sinc and this is convolved with the frequency spectrum of the original resulting in leakage. In essence there is always leakage but it is masked by carefully choosing the number of samples to be an integer number of time-periods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a simple program in scilab to see if i can remove this leakage with windowing. f(x) = Asin(20*pi*X). Maximum frequency = 10, sampling rate Fs = 30. I use a sinc window. A finite sinc window leaks in the frequency domain. For n samples the FFT(sinc) = (m1, m2, m3,...mn), m2 to mn are mirrored about the center. I changed the FFT(sinc) to FFTnew = (-m1, m2/abs(m2)-m2,-m3,-m4,...,mn/abs(mn)-mn) so that abs(FFT + FFTnew) = (0,1,0,...,1). I now create a new window called modifiedSincWindow = sinc + InvFFT(FFTnew). (in scilab invFFT(FFT(f(x)) = f(x), no scaling issues). the abs(FFT(modifiedSincWindow)) has all 0s except for 2 1s as expected. This is obvious from the linearity property of the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) NumSamples = 30. FFT(f(x) x modifiedSincWindow) gives me the correct amplitude A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) NumSamples = 31. FFT(f(x) x modifiedSincWindow) does not give me the correct amplitude A. it doesnt even look anything like in (a). why is this? if we are convolving the frequency spectrum of the signal with the spectrum of the modifiedSincWindow and since the component falls in some bin shouldnt we get the same result as in (a). the spectrum for the modifiedSincWindow is exactly 1 for a particular bin and zero for the rest. And convolving this with the spectrum of f(x) should get me the same result as (a) but it isnt. Can anyone help me understand what exactly is happening here? why is it not working as expected? thanks for your comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Added scilab code below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question basically boils down to if we are getting leakage because of the convolution by the sinc function, why not multiply the signal with a window whose magnitude response is 1 for one bin and zero for the rest. This should give us the right amplitude value irrespective of whether the number of samples is an integer number of time periods or not. right? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;maxFreq = 10;&#xA;T = 3*maxFreq;&#xA;&#xA;numSamples = T; %%(b) numSamples = T+1&#xA;timeRes = 1/T;&#xA;&#xA;%%sampling the sinc function&#xA;&#xA;sincVals = zeros(numSamples);&#xA;&#xA;for i = 1:1:numSamples&#xA;    xval = (i - numSamples/2) * timeRes;&#xA;    if(xval == 0) %%then&#xA;        sincVals(i) = 1;&#xA;    else&#xA;        sincVals(i) = sinc(xval);&#xA;    end&#xA;end&#xA;&#xA;fftVals = fft(sincVals);&#xA;&#xA;modifiedFFTArray = zeros(numSamples);&#xA;&#xA;for i = 1:1:numSamples&#xA;    modifiedFFTArray(i) = -fftVals(i);&#xA;end&#xA;&#xA;modifiedFFTArray(2) = fftVals(2)/abs(fftVals(2)) - fftVals(2);&#xA;modifiedFFTArray(numSamples) = fftVals(numSamples)/abs(fftVals(numSamples)) - fftVals(numSamples);&#xA;&#xA;invModified = ifft(modifiedFFTArray);&#xA;&#xA;%%sincDiffs magnitude response is 0 for all bins except for 2 bins where it is 1&#xA;&#xA;sincDiff = sincVals + (invModified);&#xA;signal = zeros(numSamples);&#xA;&#xA;for i = 1:1:numSamples&#xA;    xval = i * timeRes;&#xA;    signal(i) = 1.5*cos(2*pi*maxFreq*xval) * (sincDiff(i));&#xA;end&#xA;&#xA;binRes = T/numSamples;&#xA;&#xA;%%disp(binRes)&#xA;binID = 1+floor(maxFreq/binRes); %%indexing is from 1 so add 1&#xA;%%disp(binID)&#xA;fftVals = fft(signal);&#xA;&#xA;plot(abs(fftVals))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7502" LastEditorUserId="8202" LastEditDate="2014-03-15T21:38:38.633" LastActivityDate="2014-03-16T05:25:31.660" Title="A question about spectral leakage" Tags="|fft|frequency-spectrum|window-functions|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15016" PostTypeId="2" ParentId="15007" CreationDate="2014-03-15T21:13:31.653" Score="9" Body="&lt;p&gt;As you have already pointed out in your question, it is not possible (without using optimization methods) to compute an exact L2 solution for the frequency domain design problem of IIR filters due to the non-linear relationship between the filter coefficients and the error function. There is, however, a method which can come close and which transforms the problem to a linear one: the &lt;a href=&quot;https://ccrma.stanford.edu/%7Ejos/filters/Equation_Error_Formulation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Equation Error Method&lt;/a&gt;. Instead of defining the error measure as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E_0=\sum_k\left |H_k -\frac{B_k}{A_k}\right|^2\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the frequency index, &lt;span class=&quot;math-container&quot;&gt;$H_k$&lt;/span&gt; is the complex desired frequency response at frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_k$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$B_k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_k$&lt;/span&gt; are the numerator and denominator polynomials, respectively, also evaluated at the frequency point with index &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;), one defines an error measure&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E_1=\sum_k\left |H_kA_k -B_k\right|^2\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Minimizing &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; is a linear problem in the filter coefficients. You get an overdetermined system of linear equations which can be solved (in the &lt;span class=&quot;math-container&quot;&gt;$l_2$&lt;/span&gt; sense) by solving a set of linear equations. (Of course, the number of frequency points must be greater than the number of filter coefficients). The result of minimizing (2) is identical to solving a weighted &lt;span class=&quot;math-container&quot;&gt;$l_2$&lt;/span&gt; problem with weight function &lt;span class=&quot;math-container&quot;&gt;$|A_k|^2$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E_1=\sum_kW_k\left|H_k -\frac{B_k}{A_k}\right|^2\quad\textrm{with}\quad W_k=|A_k|^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are two (related) problems with this method:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The specification must not only include the desired magnitude response but also the desired phase. If the phase specification is chosen in a way that does not fit the chosen filter order and the general properties of IIR filters, the approximation error will be large, and the filter might be unstable (which brings us to the next point).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Stability is not considered in the design process. Depending on the specification, the best approximation could either be stable or unstable.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Of course, poles outside the unit circle can be reflected inside the unit circle without affecting the designed magnitude response, but the approximation error might still be large, because an unstable filter indicates that the specification is not well suited to the chosen filter order. So it takes quite some experience to choose an appropriate desired phase response.&lt;/p&gt;&#xA;&lt;p&gt;An in-depth explanation of the equation error method can be found in the book &lt;em&gt;Digital Filter Design&lt;/em&gt; by Parks and Burrus. You can find a good overview in &lt;a href=&quot;https://ccrma.stanford.edu/%7Ejos/filters/Equation_Error_Formulation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Julius O. Smith III - Introduction to Digital Filters - With Audio Applications - Equation Error Formulation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="7092" LastEditDate="2021-03-20T13:24:55.280" LastActivityDate="2021-03-20T13:24:55.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15017" PostTypeId="2" ParentId="15013" CreationDate="2014-03-15T21:43:21.087" Score="2" Body="&lt;p&gt;With reference to FFT windowing of periodic signals, an integer number of cycles means that a signal repeats a whole number of times (3, 4, 5, etc.) within the FFT aperture, with no fractional remainder (3.1, 4.51, 5.99, etc.).  For a frequency of X Hz, the FFT width in time would have to be some whole integer multiple of 1/X, which is the period of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT results that look like side-lobes will always appear for non-zero non-periodic signals.  This is because the basis vectors of an FFT are only orthogonal between sinusoids that are exactly periodic in the FFT aperture.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-15T21:43:21.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15018" PostTypeId="2" ParentId="15015" CreationDate="2014-03-15T21:53:29.043" Score="0" Body="&lt;p&gt;The transform of a signal (or window) that appears in exactly 1-bin of an FFT is a pure complex sinusoid, periodic in the FFT aperture.  Multiplying by a periodic complex sinusoid in the time domain merely circularly shifts the spectrum in the frequency domain by an integer number of bins (as it's the equivalent of circular convolution with a shifted impulse).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you multiply in the time domain by a complex sinusoid that is not exactly periodic in the FFT aperture, you might be able to shift the spectrum by a fractional bin width to put a specific frequency of interest (not necessarily a spectral peak) right at a bin center, but that sinusoidal window will leave artifacts of its own.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-15T22:15:03.257" LastActivityDate="2014-03-15T22:15:03.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15019" PostTypeId="1" AcceptedAnswerId="15025" CreationDate="2014-03-15T21:53:28.990" Score="3" ViewCount="310" Body="&lt;p&gt;I've been trying to solve a Discrete LTI System problem where the overall impulse response of the following System, whose input and output sequences are, respectively, $x(n)$ and $y(n)$, has to be found:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GLUtt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling the output sequence that comes out of the adder $e(n)$, I know that $y(n) = e(n) \star h(n)$. I also know that $e(n) = x(n) - y(n)$, which leads to $y(n) = x(n) \star h(n) - y(n) \star h(n)$.&#xA;Thats the point where I got stuck. I don't know how to proceed in order to isolate $y(n)$ in the last expression. I would like to isolate it in order to make $x(n) = \delta(n)$ and evaluate the overall Impulse Response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I am not supposed to use any transform techniques as the book I am following has not yet arrived at those subjects. If possible, don't show the final calculations, only what I should do in order to separate $y(n)$. I would like to figure the rest out by myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2014-03-16T09:56:31.713" Title="Impulse Response with non-delayed feedback" Tags="|discrete-signals|impulse-response|linear-systems|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15020" PostTypeId="2" ParentId="15015" CreationDate="2014-03-15T21:54:20.187" Score="0" Body="&lt;p&gt;First, very short explanation is that if you do that, it will make Heisenberg angry and he will sent a Shrodinger's Cat after you ;) Accordingly to Uncertainty Principle you must always sacrifice something. If your signal is finite in time domain (it always is in our applications), then it's spectrum must be infinite. Take for example rectangular pulse of some given length. We know that its FT is a $sinc$ function, which side-lobes are oscillating around X-axis towards infinity (well, in digital domain up to sampling frequency). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you stated (if I understand you correctly) is: instead taking window with spectrum sinc-like, we want it to be a delta-like: one at the centre and zero elsewhere. That would require your signal to be infinite in the time domain. Let's imagine then: you are making your signal longer and longer. Starting at some initial point it has $N$ samples, so the frequency resolution is $f_s/N$ (probably you can observe some leakage). You are extending it further up to $100\cdot N$ samples which makes your frequency resolution 100 times better, squeezing your $sinc$ function. At some point, when signal is going to be infinite, your frequency resolution is infinitesimal and $sinc$ looks like $\delta$. You would not have any problems with leakage. But obviously - we cannot do that.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-03-15T21:54:20.187" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15021" PostTypeId="1" CreationDate="2014-03-15T22:03:21.103" Score="-3" ViewCount="685" Body="&lt;p&gt;How can I find time difference between two same audio signals?&#xA;Please do not answer cross-correlation or GCC. I am looking up for a new solution that will help me. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8246" LastEditorUserId="8202" LastEditDate="2014-03-15T23:39:10.677" LastActivityDate="2014-03-15T23:39:10.677" Title="How can I find time difference between two same audio signals?" Tags="|audio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15022" PostTypeId="2" ParentId="15021" CreationDate="2014-03-15T22:26:58.420" Score="0" Body="&lt;p&gt;Assuming the magnitude has remained unchanged, instead of correlation, another possibility is to compute AMDF (magnitude difference) or ASDF (squared difference) between a range of shifts of the two waveforms.  Peak interpolation of the difference vector may be useful.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-15T22:26:58.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15023" PostTypeId="2" ParentId="15019" CreationDate="2014-03-15T23:18:54.713" Score="1" Body="&lt;p&gt;Hint:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make a list of the value of $u[n]$ as a function of $n$, e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{l|c|c|c|c|c|c|l}&#xA;\hline&#xA;n \to &amp;amp;-2 &amp;amp;-1 &amp;amp;0 &amp;amp;1 &amp;amp;2 &amp;amp;\cdots \\&#xA;\hline&#xA;u[n] &amp;amp;0 &amp;amp;0 &amp;amp;1 &amp;amp;1 &amp;amp;1 &amp;amp;&#xA;\cdots\\&#xA;\hline&#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now add a new row marked $h[n]$ whose values I will leave you to fill in.&#xA;Then read &lt;a href=&quot;https://dsp.stackexchange.com/a/6355/235&quot;&gt;this answer&lt;/a&gt; to&#xA;figure out what $y[n]$ is.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-03-15T23:18:54.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15024" PostTypeId="1" AcceptedAnswerId="15028" CreationDate="2014-03-15T23:57:52.490" Score="2" ViewCount="1070" Body="&lt;p&gt;I've been told that they are influenced by noise considerably more than that of a first order edge detector such as a Gaussian. But why?&lt;/p&gt;&#xA;" OwnerUserId="8247" LastActivityDate="2014-03-17T02:51:41.110" Title="Why are 2nd order edge detectors such as Laplacian more susceptible to noise?" Tags="|computer-vision|edge-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15025" PostTypeId="2" ParentId="15019" CreationDate="2014-03-16T00:05:50.817" Score="3" Body="&lt;p&gt;Take the z-transform of your equation to get $y(z) = x(z) h(z) - y(z) h(z)$ which you can simplify to $$ y(z) \left( 1 + h(z) \right) = x(z) h(z) $$ and therefore get the transfer function &#xA;$$ H(z) := \frac{y(z)}{x(z)} = \frac{h(z)}{1+h(z)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now plug in the z-transform $h(z)$ of your response $h(n)$ and perform an inverse z-transform to get the total impulse response $H(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An approach that is more basic and does not require z-transforms works for your particular example by solving the recursion equation explicitly. The inner system with the response $h(n) = u(n) \left( \frac{1}{2}\right)^n$ can be written with the recursive difference equation $y'(n) = x'(n) + \frac{1}{2} y'(n-1)$ where $x'$ and $y'$ are the output and input of the subsystem. Then we can write the full system in terms of the following equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(n) = y'(n)$$&#xA;$$ x'(n) = x(n) - y(n)$$&#xA;$$ y'(n) = x'(n) + \frac{1}{2} y'(n-1) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eliminating $x'$ and $y'$ results in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(n) = x(n) - y(n) + \frac{1}{2} y(n-1) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which simplifies to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\frac{1}{2}x(n)+\frac{1}{4}y(n-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This system has the impulse response $$H(n) = \frac{1}{2} u(n) \left(\frac{1}{4}\right)^n$$&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-03-16T09:56:31.713" LastActivityDate="2014-03-16T09:56:31.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15028" PostTypeId="2" ParentId="15024" CreationDate="2014-03-16T01:19:04.393" Score="1" Body="&lt;p&gt;Generally 2nd derivative is more sensitive to noise than 1st derivative. The 2nd derivative is usually accompanied by zero crossing detection, so it works better when grey level transitions are smooth. When the noise level is high, the gray level fluctuates and may result in many zero crossings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides, there is less chance of multiple edge responses with 2nd derivative edge detectors.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="8247" LastEditDate="2014-03-17T02:51:41.110" LastActivityDate="2014-03-17T02:51:41.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15029" PostTypeId="1" CreationDate="2014-03-16T03:20:55.813" Score="2" ViewCount="176" Body="&lt;p&gt;I have a spectrogram built by breaking a signal into chunks and taking the FFT of these chunks. An example spectrogram is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4ZrMi.png&quot; alt=&quot;Spectrogram of signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this spectrogram I am looking for a curve (aka pitch contour) that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Starts at zero&lt;/li&gt;&#xA;&lt;li&gt;Increases to an unknown value&lt;/li&gt;&#xA;&lt;li&gt;Stays at that unknown value for at least one minute&lt;/li&gt;&#xA;&lt;li&gt;Decreases back to zero&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's fairly easy to program this curve detection in the spectrogram above since the curve of interest is brighter than other potential curves.  However, this brightness difference won't exist in a noisier data set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I use the constraints I know about the curve (starts at zero, increases, ...) to reliably find the curve without relying on the brightness?&lt;/p&gt;&#xA;" OwnerUserId="3435" LastActivityDate="2014-03-16T10:47:34.933" Title="Detecting a curve with certain characteristics in a spectrogram" Tags="|fft|signal-analysis|signal-detection|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15030" PostTypeId="2" ParentId="15015" CreationDate="2014-03-16T05:25:31.660" Score="2" Body="&lt;p&gt;I see you've already accepted one of the answers, but you (or others) might be interested in: R. J. Webster, “Leakage Regulation in the Discrete Fourier Transform Spectrum,” Proc. IEEE, vol. 68, no. 10, Oct. 1980, pp. 1339-1341. -- Among the statements:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;A point insufficiently emphasized in the literature is that leakage in the DFT spectrum is a phenomenon of calculation.  The continuous distribution of leakage energy is determined only by the form of the window, and the DFT is a kind of lattice through which this continuous function is observed.  Because the lattice is fixed by convention, and the leakage distribution shifts according to the frequency of the signal, the discrete leakage components become dependent on the signal frequency.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(regarding the familiar 'picket-fence' effect): &quot;The reader should note, importantly, that this effect is not a property of the harmonic nature of (the signal frequency fzero), as seems often suggested, e.g., [5], [6], but of the essentially arbitrary way G(f - (the signal frequency fzero)) is evaluated.  The apparently special relationship between harmonic frequencies and the rectangular window, in which the zeros of the window transform coincide precisely with the DFT sampling frequencies, is neither significant nor unique.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author then goes on to show an example of using a shifted sum-of-cosines window centered on f = 10.25 that reduces the leakage to zero beyond bin 11 of his FFT when given an input signal of that frequency.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2014-03-16T05:25:31.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15031" PostTypeId="2" ParentId="15029" CreationDate="2014-03-16T09:26:04.473" Score="1" Body="&lt;p&gt;This answer might sound hard initially, but once understood it is intuitive and certainly deals well with the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One smart way to model such constraints is either through HMM's or through MRFs. The design is similar, but for HMM I would give you some hint:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prepare your transition matrix in such a way that Viterbi decoding would provide you the resulting curve. For example, the first state will be at 0 with certain variance, since it starts there. Then it is only allowed to increase, within a given tolerance. This tolerance would be obtained from a Gaussian prior. Say, the slope of the line (thus the variance of the Gaussian) would range from 1 to 5. Finally, you should only allow for a decrease or keeping constant. Similarly, for every other constraint you could do this. Here allowance means that the probability of transition from the constant state to an increasing state is 0. Otherwise you have a probability (might be due to any distribution, prior etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also make use of Hierarchical HMMs to elaborate your model with such tracking parameters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Hierarchical_hidden_Markov_model&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Hierarchical_hidden_Markov_model&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.cs.princeton.edu/courses/archive/spr06/cos598C/papers/FineSingerTishby1998.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.princeton.edu/courses/archive/spr06/cos598C/papers/FineSingerTishby1998.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-03-16T10:47:34.933" LastActivityDate="2014-03-16T10:47:34.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15032" PostTypeId="1" CreationDate="2014-03-16T12:26:46.823" Score="3" ViewCount="127" Body="&lt;p&gt;I'm looking at communicating digital data through the air as soundwaves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate the problem, I generate a 10-cycle 2kHz wave, play it out through my MacBook's speakers and pick it up on my iPod Touch:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ddkl9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The echoes are about half the amplitude of the probing signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HotPaw pointed out to me in a comment on a recent question that there is a potential problem with dead-spots: regions of destructive interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SWs44.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use a particular carrier frequency, transmitting from one point in the room to another, there will be certain locations where acoustic cancellation / destructive interference occurs, resulting in a dead spot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surely other technologies such as Wi-Fi must encounter the same difficulties. How do engineers deal with this phenomenon?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only solution I can think of is to simultaneously use say three different carriers, and have the listener select the strongest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS severely hampered on the tags: data transmission, communication, radio, information transfer, echo, Radio, rf, signal, &lt;em&gt;bleh&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2014-03-19T11:27:55.523" LastActivityDate="2014-03-19T11:27:55.523" Title="Dealing with echoes / dead-spots in digital transmissions" Tags="|signal-analysis|acoustics|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15033" PostTypeId="1" AcceptedAnswerId="15035" CreationDate="2014-03-16T12:31:56.437" Score="1" ViewCount="1650" Body="&lt;p&gt;I am getting error while implementing a simple idea for noise detection in an image. Let  I  denote  noisy  image  and  for  each  pixel of  I  is represented by I(x,y). A Sliding window of size 3X3 centered at I(x, y) is defined. At first we estimate that the center pixel of window is noise or not. To differ the noise and signal, we calculate the mean (m) and standard deviation (s) of the window. If the pixel is between m-s and m+s then it is a signal otherwise noise and we will apply median Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.  Read an Image I.&#xA;2.  Take a Sliding Window or Mask of size 3X3.&#xA;3.  Calculate the Mean (m) and Standard deviation (s) from the Mask.&#xA;4.  Calculate the threshold as follows &#xA;         t1 = m-s and t2 = m+s&#xA;&#xA;5.  IF     t1 &amp;lt;= I(x,y) and  I(x,y)  &amp;lt;= t2 THEN&#xA;&#xA;           Result(x,y) = I(x,y)&#xA;    ELSE&#xA;        Result(x, y) = medfilt2(I(x,y)&#xA;&#xA;6.  Repeat the step 3 , 4 and 5 on Entire Image.&#xA;7.  Display the Resultant Image.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to implement this algorithm as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;close all;&#xA;clear all;&#xA;&#xA;I=imread('lena.jpg');&#xA;I=rgb2gray(I);&#xA;J=imresize(I, [128 128]);&#xA;L = imnoise(J,'speckle',0.01);&#xA;&#xA;&#xA;[m,n]=size(L);&#xA;% RETAINING THE CORNER PIXELS/ we can do zero padding also, suggest me which one is good&#xA;&#xA;for i= 1:m+4&#xA;    for j = 1:n+4&#xA;        L(:,1:2)=J(:,1:2);         % retain the first two columns&#xA;        L(:,(m-1):m)=J(:,(m-1):m); % retain the last two columns&#xA;        L(1:2,:)=J(1:2,:);         % retain the first two rows&#xA;        L((n-1):n,:)=J((n-1):n,:); % retain the last two rows&#xA;    end&#xA;end&#xA;&#xA;for i=1:m-2 &#xA;    for j=1:n-2&#xA;&#xA;      P=L(i:(i+2),j:(j+2));&#xA;      s=std2(P(:)); % Calculating Standard deviation&#xA;      m=mean2(P(:)); % Calulating Mean&#xA;      t1=m-s; % Threshold 1&#xA;      t2=m+s; % Threshold 2&#xA;&#xA;      if (P(2,2)&amp;lt;=t1 &amp;amp;&amp;amp; P(2,2)&amp;gt;=t2)&#xA;       iout(i,j)=medfilt2(P(:))&#xA;      else&#xA;       iout(i,j)=P(2,2)&#xA;      end&#xA;&#xA;&#xA;      end&#xA;end&#xA;L&#xA;iout&#xA;imshow(iout, []);&#xA;imshowpair(L,iout,'montage');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;It runs but there is no change between input and output images.. Image is not filtered.&lt;/strong&gt;&#xA;Please help me.&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="128" LastEditDate="2019-03-15T22:10:32.580" LastActivityDate="2019-03-15T22:10:32.580" Title="Image Noise Detection in MATLAB" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15034" PostTypeId="1" AcceptedAnswerId="15039" CreationDate="2014-03-16T12:47:25.060" Score="1" ViewCount="652" Body="&lt;p&gt;I am try to grasp the idea of frequency domain for images. I think get the basics, but now I've stuck with a question that I can't find appropriate answer anywhere.&#xA;How are frequency domain and complex numbers in relationship?&#xA;I've read this article from &lt;a href=&quot;http://www.dspguide.com/ch24/5.htm&quot; rel=&quot;nofollow&quot;&gt;DSPguide&lt;/a&gt; and I understand that after applying DFT to an image in spatial domain, we get two planes: real and imaginary plane. By doing some calculations, we can get amplitude and phase planes. For what is the phase plane used for?&lt;/p&gt;&#xA;" OwnerUserId="8251" LastActivityDate="2014-03-16T17:42:54.720" Title="Complex numbers in a frequency domain of a 2D image" Tags="|image-processing|dft|transform|digital|fourier|" AnswerCount="2" CommentCount="0" ClosedDate="2014-03-18T22:08:06.953" ContentLicense="CC BY-SA 3.0" />
  <row Id="15035" PostTypeId="2" ParentId="15033" CreationDate="2014-03-16T13:09:51.913" Score="0" Body="&lt;p&gt;1) This condition can never be satisfied: &#xA;&lt;code&gt;if (P(2,2)&amp;lt;=t1 &amp;amp;&amp;amp; P(2,2)&gt;=t2)&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be &#xA;&lt;code&gt;if (P(2,2)&gt;=t1 &amp;amp;&amp;amp; P(2,2)&amp;lt;=t2)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You haven't created iout. You should be creating it with: &#xA;&lt;code&gt;iout=zeros(m,n)&lt;/code&gt; at least before the beginning of second loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) medfilt2 performs a median filtering. What you would like to write is &lt;code&gt;median(P(:))&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) This is not an error but for use with std2 and mean2 you can just use &lt;code&gt;std2(P)&lt;/code&gt;, you don't need to &lt;code&gt;std2(P(:))&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-03-16T13:22:53.227" LastActivityDate="2014-03-16T13:22:53.227" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="15036" PostTypeId="2" ParentId="15033" CreationDate="2014-03-16T14:10:41.070" Score="1" Body="&lt;p&gt;If you would like to do this faster, what you could try is the neighborhood operations. Take for example the sample code below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;I = imread('tire.tif');&#xA;f = @(x) max(x(:));&#xA;I2 = nlfilter(I,[3 3],f);&#xA;imshow(I);&#xA;figure, imshow(I2);&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This applies a maximum filtering. You could consider changing your neighborhood function &lt;code&gt;f&lt;/code&gt; to your custom algorithm (inside your loop) and this should give you a better speed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course there are a lot of ways of getting speed. Use of integral images, moving averages and precomputations might save you from the burden of heavy block processing. But this would be way a lot to write in here. For more details check out these papers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.csse.uwa.edu.au/~shafait/papers/Shafait-efficient-binarization-SPIE08.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.csse.uwa.edu.au/~shafait/papers/Shafait-efficient-binarization-SPIE08.pdf&lt;/a&gt;&#xA;&lt;a href=&quot;http://arxiv.org/ftp/arxiv/papers/1201/1201.5227.pdf&quot; rel=&quot;nofollow&quot;&gt;http://arxiv.org/ftp/arxiv/papers/1201/1201.5227.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-16T14:10:41.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15037" PostTypeId="2" ParentId="15032" CreationDate="2014-03-16T14:26:15.910" Score="3" Body="&lt;p&gt;If the channel is static and you are in a deep fade -- then, yes, your only option is to increase the bandwidth or go multicarrier like you suggest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, modern WiFi systems use that exact technique: OFDM (&quot;Orthogonal frequency division multiplexing&quot; -- sometimes known as multi-tone or multicarrier transmission).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could go with two receive antennas (microphones in your case) spaced far enough. If you use 2000Hz carrier, the wavelength is v/f = 300[m/s] / 2000 Hz = 0.15 m. So a distance of around 10cm should give you enough diversity. This can also be implemented at the transmitter.&lt;/p&gt;&#xA;" OwnerUserId="1082" LastEditorUserId="1082" LastEditDate="2014-03-16T14:31:51.843" LastActivityDate="2014-03-16T14:31:51.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15038" PostTypeId="2" ParentId="15034" CreationDate="2014-03-16T15:53:31.920" Score="0" Body="&lt;p&gt;The real and imaginary plane are also the symmetric and anti-symmetric planes.  Image content that is symmetric around the center lines will show up in the real plane.  Image content that is opposite in brightness across the center lines will appear in the imaginary plane.  Data that is neither or some combination of both will end up in both, with the phase angle indicating the mix or a shift (or rotation wrapping around the edges) from symmetric to anti-symmetric.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-16T16:06:59.747" LastActivityDate="2014-03-16T16:06:59.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15039" PostTypeId="2" ParentId="15034" CreationDate="2014-03-16T17:18:33.823" Score="0" Body="&lt;p&gt;Why don't you try it? Since points in the frequency domain correspond to sine waves in the image domain, it is reasonable to assume that the phase of the entries in the frequency domain controls the phase of the resulting sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f1 = zeros(255, 255);&#xA;&#xA;% Create image1 in the frequency domain - maintain conjugate symmetry &#xA;% so we'll get a real image when we call ifft &#xA;f1(5,1)   = 255*255*.5 * exp(-j*pi/4);&#xA;f1(252,1) = 255*255*.5 * exp(j*pi/4);&#xA;&#xA;% The second image is essentially the same except the phase is 0.&#xA;f2 = abs(f1); % no phase&#xA;&#xA;figure(1); &#xA;imshow(ifft2(f2)); title('phase = 0');&#xA;figure(2);&#xA;imshow(ifft2(f1)); title('phase = pi/4')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is &lt;img src=&quot;https://i.stack.imgur.com/4eJbc.png&quot; alt=&quot;this figure&quot;&gt; and &lt;img src=&quot;https://i.stack.imgur.com/0HNLA.png&quot; alt=&quot;and this one&quot;&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you can clearly see that the difference is the sine wave phase only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at the values along the y-axis you'll see &lt;img src=&quot;https://i.stack.imgur.com/fUvRx.png&quot; alt=&quot;this&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1082" LastEditorUserId="1082" LastEditDate="2014-03-16T17:42:54.720" LastActivityDate="2014-03-16T17:42:54.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15040" PostTypeId="1" CreationDate="2014-03-16T18:05:45.617" Score="2" ViewCount="501" Body="&lt;p&gt;I got some problem in the equalization techniques. I am new to communication simulations but I have done some data analysis labs in my college. I read some where on Internet that in a research paper that &#xA;zero forcing is Optimization technique but on Wikipedia it says it is Equalization technique? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused in equalization and optimization techniques in communication. I am doing a OFDM simulation project in MATLAB and I am stuck in terms of these. I have read on Google but they both terms are kind confusing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can some body please explain the different equalization techniques and the use of zero forcing? &#xA;Why to use zero forcing and what are basic possible equalization techniques that can be used with zero forcing. &lt;/p&gt;&#xA;" OwnerUserId="4126" LastActivityDate="2014-03-16T19:22:45.130" Title="Is zero forcing Optimization technique or Equalization technique?" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15041" PostTypeId="1" AcceptedAnswerId="15043" CreationDate="2014-03-16T18:11:37.603" Score="0" ViewCount="293" Body="&lt;p&gt;I'm at a loss trying to answer the following question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response $H(j\omega)$ of a length 4 FIR filter with real impulse response has the following specific values: $H(j\cdot0) = 2$, $H(j\cdot \pi/2 ) = 7 − 3j$, and $H(j\cdot\pi) = 0$. Determine the impulse response function $h(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't think of anything to do but apply the inverse DTFT but how would that work at specific values?  Is there another method I'm forgetting?&lt;/p&gt;&#xA;" OwnerUserId="8044" LastEditorUserId="8202" LastEditDate="2014-03-16T20:37:37.503" LastActivityDate="2014-03-16T20:37:37.503" Title="Impulse Response from Frequency Response at Specific Values" Tags="|frequency-response|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15043" PostTypeId="2" ParentId="15041" CreationDate="2014-03-16T18:23:24.570" Score="0" Body="&lt;p&gt;If you look at the definition of $H(j\omega)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\omega)=\sum_{n=0}^{N-1}h(n)e^{-jn\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then you can see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(0)=\sum_{n=0}^{N-1}h(n)=h(0)+h(1)+h(2)+h(3)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\pi/2)=\sum_{n=0}^{N-1}h(n)e^{-jn\pi/2}=h(0)-jh(1)-h(2)+jh(3)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\pi)=\sum_{n=0}^{N-1}h(n)e^{-jn\pi}=h(0)-h(1)+h(2)-h(3)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives you 4 equations for the 4 unknown coefficents:&#xA;$$h(0)+h(1)+h(2)+h(3)=2\\&#xA;h(0)-h(2)=7\\&#xA;-h(1)+h(3)=-3\\&#xA;h(0)-h(1)+h(2)-h(3)=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess you can take it from here.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-16T18:23:24.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15044" PostTypeId="2" ParentId="14395" CreationDate="2014-03-16T18:33:21.770" Score="0" Body="&lt;p&gt;I believe that if you are already using measurements with sweep sine, then the whole procedure of obtaining frequency response is pretty straightforward. Let me describe whole procedure from the beginning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; You need to generate sweep sine signal, logarithmic seems to be the best choice. It is governed by following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)= \sin{\left[\dfrac{2\pi f_1T}{\ln{\dfrac{f_2}{f_1}}}\cdot \left( e^{\dfrac{t}{T} \ln{\left( \dfrac{f_2}{f_1}\right)}}-1\right) \right]} $,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where: $f_1,$,$f_2$ - initial and final frequency of sweep, $T$ - total duration of sweep signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; You feed this signal into your system and record output - let's call this $y(t)$. This is in fact you sweeping signal changed your model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Now you must calculate the impulse response $h(t)$ of your system. It can be done by doing following convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h(t)=y(t)\star f(t) $, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where: $f(t)$ - so called &quot;inverse filter&quot; that is calculated by time-reversing your original excitation signal $x(t)$ and applying amplitude envelope. The amplitude modulation must reduce the level of your signal by 6dB/oct., starting from 0dB and ending at $-6\log_2{\left( \dfrac{f_2}{f_1} \right)} $. This is done because spectrum of logarithmic sweep is similar to the one of pink noise. In order to compensate that you must apply this modulation. Below you can see some plots targeting this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; Now you have the impulse response $h(t)$ of your system. According to the properties of LTI  systems, frequency response can be obtained by taking the Fourier Transform of impulse response. Basically you just have to take the obtained impulse response, calculate it's DFT and plot the amplitude spectrum in order to obtain what you need. You might also want to consider applying window to your impulse response, having it's beginning just before initial spike and also ending before the noise  is only present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plots:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EEcQq.png&quot; alt=&quot;Spectrum of the logarithmic sweep&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/K2aj1.png&quot; alt=&quot;Spectrum of the inverse filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EqNXp.png&quot; alt=&quot;Waveform plot of the logarithmic sweep&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VbRnq.png&quot; alt=&quot;Waveform of the inverse filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Why the image descriptions do not appear?&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-03-16T18:33:21.770" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15045" PostTypeId="2" ParentId="15040" CreationDate="2014-03-16T18:33:55.907" Score="6" Body="&lt;p&gt;Zero-forcing is not an optimiziation technique and neither an equalization technique. It is simply one of several possible &lt;em&gt;criteria&lt;/em&gt; to design (or optimize) an equalizer. A zero-forcing equalizer is designed to completely remove intersymbol interference, but does not take noise into account. Another, more practical criterion is the MSE (mean-square error) criterion, which results in an equalizer that minimizes intersymbol interference and reduces noise power at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest you consult one of the many good books on digital communication to learn more about this quite complex topic. Here are just two which I like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Digital Communication by Lee and Messerschmitt&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Digital Communications by Proakis&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-03-16T19:22:45.130" LastActivityDate="2014-03-16T19:22:45.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15046" PostTypeId="2" ParentId="14891" CreationDate="2014-03-16T20:22:57.067" Score="1" Body="&lt;p&gt;It's $\frac{d\dot x_2}{dx_2}$, not $\frac{d\dot x_2}{dt}$, so that's why the right result truly is $\frac{R_2}{M^2(x_2(t)+1)}$.&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="4158" LastEditDate="2014-03-17T22:50:31.933" LastActivityDate="2014-03-17T22:50:31.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15047" PostTypeId="2" ParentId="13758" CreationDate="2014-03-16T20:37:50.403" Score="3" Body="&lt;p&gt;I'm sure that you are familiar with the idea of how Doppler affects a sine wave.  When the transmitter and/or receiver move towards the other the wave arrives more quickly, which makes the wave appear to be a higher frequency.  In regards to the baud rate, it also arrives more quickly.  If you think about it you will see that this must be so.  After all, the data stream cannot be separated from the carrier wave that modulates it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you have a signal that is exactly identical to the &quot;non-Doppler&quot; signal except it arrives faster or slower than the non-Doppler signal.  This can be modeled exactly, in the discrete time domain, through resampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why is Doppler usually modeled as a simple frequency shift when it should really be modeled as resampling?  Two reasons- first, the frequency shift effect is almost always vastly larger than the baud rate change.  The reason for this is that the Doppler effect is proportional to the frequency of the original wave ($\Delta f = \frac{\Delta v}{c}f_0$).  The frequency of the carrier wave is vastly greater than the baud rate, so the effect is much larger on the carrier wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second reason most people don't model it as resampling is that it is difficult to do very small arbitrary sample rate changes, like 3013/3014.  If either the numerator or denominator is a prime number or has really large factors then it can become impractical to do traditional fractional resampling.  In that case polynomial interpolation is probably the best way to go.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-16T20:37:50.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15048" PostTypeId="1" CreationDate="2014-03-16T20:59:35.060" Score="0" ViewCount="1949" Body="&lt;p&gt;I'm trying to get my dsp sea legs a bit, and am trying to complete a problem that asks for the mean delay and expected SNR boost for a given difference equation: y[n] = (x[n] + ... + x[n-N+1])/N&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love some general guidance on how to learn more about how to address this. Specifically,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'd like to plot the filter function in octave/matlab, but am not sure how to get there from the difference equation. most of the examples I've come across assume that I have a frequency band to specify, but I'm not sure how I can derive that from just the difference equation.&lt;/li&gt;&#xA;&lt;li&gt;I'm not sure how to calculate the expected SNR boost in the absence of any info about the noise source. Is it possible to calculate some concept of the amount of 'smoothing' the filter is expected to provide, and consider that to be the reduction in noise between the input and the output?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks for any hints!&lt;/p&gt;&#xA;" OwnerUserId="8255" LastActivityDate="2014-03-17T08:22:31.723" Title="fir filter - mean delay and snr from difference equation?" Tags="|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15051" PostTypeId="2" ParentId="15008" CreationDate="2014-03-16T23:53:47.370" Score="2" Body="&lt;p&gt;if you start with the original spectrum, then you have spectra at pi/4 and -pi/4. you will also have spectra either side of 2pi, i.e at 7pi/4 and 9pi/4.&#xA;when you down sample by 3, these spectra (just consider the positive frequencies for now) will move from pi/4 to 3pi/4, the one at 7pi/4 will move down to 5pi/4.&#xA;when you upsample by 3 the spectra at 3pi/4 will go to pi/4 again, and the one at&#xA;5pi/4 will move to 5pi/(4*3) = 5pi/12. this is why you see those 2 spectra close together. down sample spreads the spectra out, up sample squashes them back inwards. if you filter the signal at -pi/3 to pi/3 you will get rid of these spectra at 5pi/12. to recover the signal will need to have gain of 3.&lt;/p&gt;&#xA;" OwnerUserId="8489" LastActivityDate="2014-03-16T23:53:47.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15054" PostTypeId="1" CreationDate="2014-03-17T06:28:28.613" Score="1" ViewCount="34" Body="&lt;p&gt;i came across many terms describing loudness ! I understood perceived loudness which is what the user perceived and is related to the user. What is specific loudness and perceptual loudness? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;AES Convention Paper 7180&lt;/code&gt; defines specific loudness as&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a measure of perceptual intensity across frequency and time and is measured in units of sone per critical band&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which i confuse with perceptual loudness! Can someone make me clear?&lt;/p&gt;&#xA;" OwnerUserId="7868" LastActivityDate="2014-03-17T06:28:28.613" Title="Diference between Specific,perceived and perceptual Loudness" Tags="|audio|acoustics|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15055" PostTypeId="1" CreationDate="2014-03-17T07:02:46.523" Score="0" ViewCount="351" Body="&lt;p&gt;Are the following frequency domain signals valid DTFT's (Discrete Time Fourier Transforms)? Answer yes or no, and justify your answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) $X(\omega) = \omega + \pi$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) $X(\omega) = i + \pi$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c) $X(\omega) = \sin(10\omega)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;d) $X(\omega) = \sin(\omega/10)$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm just very unsure as to how to go about this question (what methodology to use). Could anyone possibly point me in the right direction? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8263" LastActivityDate="2014-03-17T07:02:46.523" Title="Determining Valid DTFT's" Tags="|discrete-signals|fourier-transform|frequency-domain|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15056" PostTypeId="2" ParentId="15048" CreationDate="2014-03-17T08:22:31.723" Score="3" Body="&lt;p&gt;I'll give you some hints to help you solve the problem by yourself. Looking at the input-output relation, you can see that the output signal is computed only from a combination of delayed input signal values, and not from delayed output signal values. So your impulse response has a finite length and the filter can be implemented by a non-recursive structure (FIR filter). Using the impulse response, you can write the input-output relation as a finite convolution sum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=0}^{N-1}x[n-k]h[k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing (1) to your difference equation, you can easily see what the system's impulse response $h[n]$ is. Once you have the impulse response, you can compute the frequency response using an FFT. Plot its magnitude and phase to see how the filter behaves in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The (group) delay is the negative derivative of the filter's phase response. You will find that the phase is a linear function, so the delay is a constant. You just need to determine the slope of the phase (either analytically or by inspection of the phase plot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without any further knowledge of your desired signal and the noise characteristics, you cannot say much about a possible SNR improvement.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-17T08:22:31.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15057" PostTypeId="1" CreationDate="2014-03-17T12:29:33.310" Score="1" ViewCount="257" Body="&lt;p&gt;I want to know the difference between the 2D continuous and discrete Gabor filter when it comes to Matlab implementation. I found many files related to 2D Gabor filter on Mathworks File Exchange but I am unable to find any file related to 2D continuous Gabor wavelet. I want to use continuous Gabor filter to enhance blood vessels in retinal images. Please guide me.&lt;/p&gt;&#xA;" OwnerUserId="7071" LastActivityDate="2023-07-01T18:01:06.597" Title="Is there any difference between the 2D continuous and discrete Gabor filter when it comes to MATLAB implementation" Tags="|image-processing|matlab|wavelet|gabor|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15058" PostTypeId="1" AcceptedAnswerId="15083" CreationDate="2014-03-17T12:41:15.550" Score="1" ViewCount="304" Body="&lt;p&gt;I am researching in medical image processing area. I want to segment knee cartilage into femoral cartilage and tibial cartilage. But two part have same intensity and only different position(femoral cartilage is above and tibial cartilage is below). I am finding the techniques or method to segment them individualy.Could you help me show to me that techniques? Thank you so much![enter image description here][1]&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="8264" LastEditDate="2014-03-26T17:35:04.653" LastActivityDate="2014-03-26T17:35:04.653" Title="How to segment femoral and tibial knee cartilage individualy?" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15060" PostTypeId="1" AcceptedAnswerId="15061" CreationDate="2014-03-17T13:19:47.430" Score="1" ViewCount="2720" Body="&lt;p&gt;guys. I am really lacking in knowledge of linear algebra. I am reading slides of Harris corner. But I am really confused about one of them. I know that I can find corners by two large eigenvalues but I can not consider it as an ellipse....can anybody give me any suggestions?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BR1TM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8229" LastActivityDate="2014-03-17T13:43:21.760" Title="How to understand relationships between ellipse and second moment matrix of Harris corner detector?" Tags="|linear-algebra|corners|harris|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15061" PostTypeId="2" ParentId="15060" CreationDate="2014-03-17T13:43:21.760" Score="0" Body="&lt;p&gt;Consider a 2-by-2 diagonal matrix $M$ with diagonal elements $a&amp;gt;0$ and $b&amp;gt;0$. Then the equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x^TMx=const\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(with $x$ a column vector with elements $u$ and $v$) becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$au^2 + bv^2 = const$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is simply the equation of an ellipse (or a circle if $a=b$). If $M$ is not diagonal, equation (1) still describes an ellipse if $M$ is positive definite (i.e. it has positive eigenvalues), but then its major and minor axes do not coincide with the Cartesian axes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also have a look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Quadratic_form#Geometric_meaning&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-17T13:43:21.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15063" PostTypeId="2" ParentId="3300" CreationDate="2014-03-17T15:11:11.733" Score="1" Body="&lt;p&gt;To solve this problem you need to separate background and foreground. &#xA;This is the solution, I propose you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; convert the image from Rgb to grayscale; You will obtain an image that we call &lt;code&gt;I1&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; apply a morphological filter,  erosion using a large radius, eventually several times&#xA;==&gt; you should erase the pill by erosion and obtain only the background;&#xA;You will obtain a new image &lt;code&gt;I2&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; subtract &lt;code&gt;I2&lt;/code&gt; to &lt;code&gt;I1&lt;/code&gt;, you will obtain the foreground i.e the pill;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt; apply another morphological filter to fill any hole in the pill that you obtained;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5)&lt;/strong&gt; apply a morphological filter, erosion, small radius to remove any isolated pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method does not require any threshold, shape detection, color segmentation or anything else.&lt;/p&gt;&#xA;" OwnerUserId="8266" LastEditorUserId="7092" LastEditDate="2014-03-17T17:29:55.763" LastActivityDate="2014-03-17T17:29:55.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15064" PostTypeId="1" CreationDate="2014-03-17T16:18:15.037" Score="0" ViewCount="925" Body="&lt;p&gt;Say you have a bandpass filter and you place it on 40 discretely sampled points from a sinusoid with a period of 40.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the bandpass filter (green curve on the image) only &quot;in phase&quot; with the sinusoid if you use a window length (impulse response length) for the filter of 1/4th the period of the sinusoid (here 40/4=10)? So the green filter has the same turning and bending points only if you use the 10 past observations, multiply with the impulse response (of length 10) and add that up..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W4T1G.jpg&quot; alt=&quot;Sinusoid with 3 Bandpass filters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct that this is related to how the length of the impulse response affects the phase delay?&lt;/p&gt;&#xA;" OwnerUserId="735" LastActivityDate="2015-05-15T22:30:24.737" Title="Bandpass Filter window length: filter &quot;in phase&quot; with sinusoidal input" Tags="|filter-design|bandpass|finite-impulse-response|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15066" PostTypeId="2" ParentId="15064" CreationDate="2014-03-17T17:54:01.517" Score="0" Body="&lt;p&gt;Obviously, it is not exactly in phase. What kind of a filter is it? IIR filters can easily have large delays. The result will be in phase with the original when the phase of the filter (including any technical delay) is a multiple of 2pi.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-17T17:54:01.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15067" PostTypeId="1" CreationDate="2014-03-17T18:47:02.393" Score="0" ViewCount="170" Body="&lt;p&gt;I don't know how to determine line rate and frame rate of the following system:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Height of monitor:            40cm&#xA;Screen Aspect Ratio:          16:9&#xA;Pixel Aspect Ratio:           4:3&#xA;Progressive scan&#xA;Viewing distance from screen: 0.6m&#xA;Active line period:           15μs &#xA;Horizontal Blanking:          5μs &#xA;Vertical blanking lines:      20&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8267" LastEditorUserId="76" LastEditDate="2014-03-18T03:41:41.177" LastActivityDate="2014-03-18T03:41:41.177" Title="Line rate and frame rate" Tags="|resolution|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15068" PostTypeId="1" CreationDate="2014-03-17T23:08:22.633" Score="2" ViewCount="609" Body="&lt;p&gt;I am stuck on a problem about finding the complete solution of a Discrete Linear System by using the parametrization $y_{c}(n) = y_{h}(n) + y_{p}(n)$ where $y_{h}(n)$ and $y_{p}(n)$ are, respectively, the homogenous and particular solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The System, in this case, is given by the following difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n) = y(n-2) + x(n) + x(n-2)$ $\{y(-2) = 1; y(-1) = -1\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input sequence is $x(n) = n^{2}u(n-1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had no problems finding the homogenous solution. It was pretty straightforward. The next step would be to find the particular solution and then calculate the constants that appear on the homogenous solution. I chose a model for $y_{p}(n)$ by looking at a table, which, in this case, yielded: $y_{p}(n) = (K_{1}n^{2} + K_{2}n + K_{3})u(n-1)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem was that after plugging this model on the system's difference equation and doing some algebra, the constant $K_{3}$ canceled out and I arrived at the following expression:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$-4K_{1} + 4nK_{1} + 2K_{2} = 2n^{2} - 4n + 4$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That was the first example where a constant got canceled and where I found no expressions of $K_{n}$ multiplying $n^{2}$, in order to create a linear system of equations and find the constants. My book hasn't yet talked about such cases, and I don't know how to proceed. Am I doing things right? How can I proceed in order to solve this problem? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2014-03-17T23:08:22.633" Title="Coefficient Cancelation on Particular Solution" Tags="|discrete-signals|linear-systems|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15070" PostTypeId="1" CreationDate="2014-03-18T01:33:43.997" Score="0" ViewCount="473" Body="&lt;p&gt;I am seeking a clarification of the concept of Incoherence within the MC framework. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) the literature mentions the application of a &quot;strong incoherence&quot; given a set of assumptions. Intuitively, how is the strong incoherence different than &quot;incoherence&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Does the Restricted Isometry Property have anything to do with low rank Matrix Completion of natural images, or does it only pertain to the reconstruction of signals in CS (i.e. y = Ax).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an incoherence property $\mu$ used in CS to measure the correlation between the sensing and representation bases; whereby low correlation enables signal reconstruction of sparse signals with fewer samples and high correlation makes it nearly impossible regardless of the sparsity of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For MC, there is also an incoherence property $\mu$: it measures the correlation between the singular vectors of the matrix (&lt;strong&gt;U&lt;/strong&gt; and &lt;strong&gt;V&lt;/strong&gt; from SVD) and the standard basis vectors (i.e. &lt;strong&gt;$\ e_i$&lt;/strong&gt; = vector of zeros except for a 1 at index i). As with CS, low rank (i.e. singular value-sparse) matrices exhibiting a low correlation are more likely to be reconstructed than those with high correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these incoherence properties are used to stipulate the minimum number of samples required to reconstruct a signal (1D, 2D, respectively). However, I cannot see where the matrix incoherence property addresses the nature of the sampling; I.e. it only tells me which matrices are more likely to be reconstructed. I believe this is because the &quot;nature of the sampling&quot; that is assumed (by CS community doing MC) for low rank MC problems is strictly &quot;uniform random sampling&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, restricting our attention only to those low rank matrices with low $\mu$, is there an additional MC incoherence property that characterizes the nature of the sampling to say whether or not a matrix can be reconstructed? (I'm looking for a link back to CS where they compare the relationships between different representation/sensing bases to see if they work well together to reconstruct the signal.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="4038" LastEditDate="2014-03-18T03:15:21.513" LastActivityDate="2014-05-17T18:10:04.097" Title="Incoherence: Compressed Sensing (CS) vs Matrix Completion (MC)" Tags="|computer-vision|compressive-sensing|reconstruction|matrix|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15071" PostTypeId="1" AcceptedAnswerId="15073" CreationDate="2014-03-18T02:18:48.647" Score="0" ViewCount="1025" Body="&lt;p&gt;I understand that you need to sample at a frequency greater than or equal to the Nyquist frequency to reconstruct a signal/aliasing etc. I read though that a &quot;more conservative&quot; approach is to sample at 2x-5x the Nyquist frequency (Rampil '98, on EEG processing). Assuming signal bandwidth doesn't extend beyond $F_N/2$ (has been low-pass filtered), are there effects/advantages of sampling at higher frequencies than $F_N$? That is, if I have a signal with no components above 100Hz, is there an advantage to sample at 1kHz vs at 200Hz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The context is that I'm resampling various signals (EEG, EMG, joint angles) to a common time basis and need to pick the target frequency. Processing time is fast enough to not be a huge concern, but I do want to decrease it somewhat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8062" LastActivityDate="2014-03-18T21:25:15.810" Title="Effects of sampling rate approaching the Nyquist frequency? (not undersampling)" Tags="|downsampling|bandwidth|nyquist|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15073" PostTypeId="2" ParentId="15071" CreationDate="2014-03-18T05:08:50.470" Score="1" Body="&lt;p&gt;What you're describing is called oversampling. You may want to take a look at the following - &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Oversampling&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Oversampling&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8272" LastActivityDate="2014-03-18T05:08:50.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15074" PostTypeId="2" ParentId="15071" CreationDate="2014-03-18T06:01:50.017" Score="2" Body="&lt;p&gt;Sampling at 2*Fn is suitable only for signals that are infinitely long and perfectly bandlimited to below Fn, which conditions don't exist in actual signals being sampled or resampled (given non-perfect low-pass filtering), or in any non-infinite length signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A finite length rectangular window will itself introduce higher frequency content to the signal being sampled or recorded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, there are major advantages to a sample rate higher than 2*Fn, in terms of not corrupting the signal, especially if any higher frequency (close to Fn) spectral content near the beginning or end of your recorded signal is important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added:  Reconstructing a signal represented by data at a sample rate well above twice the highest frequency can greatly reduce the computational (or hardware) requirements of the reconstruction filter or interpolator.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-18T21:25:15.810" LastActivityDate="2014-03-18T21:25:15.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15075" PostTypeId="1" CreationDate="2014-03-18T08:16:43.140" Score="1" ViewCount="1362" Body="&lt;p&gt;I'm working with AEC of Speex. The algorithm is based on the MDF adaptive filter + an adaptive learning rate. I'm using it like a ANC and it works very well.&#xA;Does anybody have some material, as block scheme, data flow diagram of the AEC of Speex.&#xA;I have read the documentation but it is not very useful for the dsp concepts.&#xA;thank you so much&#xA;m&lt;/p&gt;&#xA;" OwnerUserId="8274" LastActivityDate="2014-03-18T08:16:43.140" Title="AEC Speex . How does it work?" Tags="|adaptive-filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15076" PostTypeId="1" CreationDate="2014-03-18T09:40:58.167" Score="2" ViewCount="866" Body="&lt;p&gt;I am trying to improve an edge following algorithm developed by some students who did a project at my work. The algorithm is supposed to make a robot follow a line with the use of a camera. Their approach was to detect edges with Canny's algorithm and then extract lines from this image using the Hough transform. Three suggested lines will then be presented to the user, who may choose which line the robot should try to follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want feedback about is data association using the Hough transform. Is there any good criteria for matching of lines between frames? The used solution right now is to measure the angle and distance between followed line and extracted lines and to choose the one that is most similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other problem I see is that they did not filter the signal, i.e. detected lines between frames. I have an idea about using Kalman filter to estimate the current parameters of the edge by using the extracted lines so that it is dynamic and less error prone. What do you think about that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have thought about making a SLAM algorithm instead but since we only want a proof of concept that will be a huge remake and requires much more data than I currently have.&lt;/p&gt;&#xA;" OwnerUserId="8276" LastEditorUserId="7338" LastEditDate="2017-12-30T08:39:33.070" LastActivityDate="2022-01-24T19:11:53.430" Title="Edge following using Hough transform" Tags="|kalman-filters|hough-transform|visual-tracking|canny-edge-detector|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15077" PostTypeId="1" AcceptedAnswerId="15086" CreationDate="2014-03-18T10:03:55.970" Score="1" ViewCount="740" Body="&lt;p&gt;I have read some about Karhunen-Loeve Transform (KLT) and its application to the field of seismic data processing.&#xA;The method as I understand it based on decomposing the data (actually mostly used in image processing) using SVD on its covariance matrix and projecting the data back after manipulating one or some of the covariance matrix's eigenvalues.&lt;br&gt;&#xA;One of the assumptions, when using on seismic data to remove random noise, is that the features to keep, should be aligned in time. If this is not the case, then one have to correct for the observed move-out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For ex. in the top picture below 400 time samples (y-axis) for more than 50 data traces(x-axis) are shown. Each trace represents data recorded on one geophone. There are multiple &quot;events&quot; in the data represented by horizontal lines across the figure. There is no time delay for the observed event across the traces.&#xA;The picture in the bottom is the result after applying KLT on the data, by zeroing the smallest eigenvalue of data's covariance matrix.&#xA;My question is, why the assumption of time alignment of the &quot;event&quot; (horizontal features)? The method fails if the events occurred along a line with a slope, that is the same event was observed with a delay from one trace to the next.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZCyH3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2016-06-17T09:55:17.157" Title="Karhunen loeve transform question" Tags="|denoising|covariance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15078" PostTypeId="2" ParentId="15032" CreationDate="2014-03-18T11:13:54.423" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://rnd.azoft.com/mobile-app-transering-data-using-ultrasound/&quot; rel=&quot;nofollow&quot;&gt;http://rnd.azoft.com/mobile-app-transering-data-using-ultrasound/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This article points out the problem of deep-fade, and offers a frequency sweep approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it also states that communicating in a low signal-to-noise environment of ultrasound is still an open problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper &lt;a href=&quot;http://www.princeton.edu/~hlzhang/files/squeakychat.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.princeton.edu/~hlzhang/files/squeakychat.pdf&lt;/a&gt; links at the bottom to several ultrasound projects.&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2014-03-18T11:21:46.117" LastActivityDate="2014-03-18T11:21:46.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15079" PostTypeId="1" CreationDate="2014-03-18T11:56:45.540" Score="1" ViewCount="98" Body="&lt;p&gt;I have tried Region based Segmentation - through Seed Growing, Watershed algorithm, and Graphcut algorithm, but none have been successful so far. I am using MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="7914" LastActivityDate="2014-05-17T14:05:50.220" Title="What are the Segmentation algorithms that can be used to process Satellite images (obtained from Google Earth) to segment forest and barren areas?" Tags="|image-processing|segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15080" PostTypeId="2" ParentId="15076" CreationDate="2014-03-18T11:59:16.597" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;Matching lines across multiple views is a common research problem and is reasonably well studied:&#xA;If you have the end points for example: &lt;a href=&quot;http://cmp.felk.cvut.cz/%7Ewerner/software/lmatch/lmatch_memo.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tomas Werner - Matching of Line Segments Across Multiple Views: Implementation Description (memo)&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Even tough this deals with more geometric properties, if your scenes are well conditioned, you could as well use the gradient/intensity information to match the lines.&lt;/p&gt;&#xA;&lt;p&gt;Here is a full source code on multiview line matching from monocular setups: &lt;a href=&quot;https://github.com/manhofer/Line3Dpp&quot; rel=&quot;nofollow noreferrer&quot;&gt;manhofer - Line3D++ - Multi-View Stereo using Line Segments&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You might also like to start with that.&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Using a KALMAN filter on the lines would be a good idea. There are also more sophisticated algorithms. For example, in each frame you might want to minimize cost function to obtain the subpixel line, which has better resemblence to the line in the previous frame.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;You can also track the camera pose and from there hypothesize the lines.&lt;/p&gt;&#xA;&lt;p&gt;You try to avoid SLAM, but maybe, triangulating the lines and obtaining 3D structure would be the best in reducing the errors.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="60971" LastEditDate="2022-01-24T19:11:53.430" LastActivityDate="2022-01-24T19:11:53.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15081" PostTypeId="2" ParentId="15079" CreationDate="2014-03-18T13:05:50.747" Score="1" Body="&lt;p&gt;You could try image saliency or entropy filtering. Entropy filtering calculates the entropy of gray values in the image Image within a rectangular mask. The result is written to the output image. The process is repeated in a sliding window fashion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the resulting image, the forest areas should appear more whitish while the barren areas appear black, because they don't contain enough information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course I assume the roads would make a problem. However you could get rid of them using morphological edge finding operations. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-18T13:05:50.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15083" PostTypeId="2" ParentId="15058" CreationDate="2014-03-18T13:28:01.440" Score="0" Body="&lt;p&gt;Looks like you have to do some motion tracking of points to separate the two. Is it possible to take images before and after some motion? That way you could model how the cartilage moved as a function of tibia or femoral motion, and you might be able to separate what portions of the cartilage belong to the tibia and femur.&lt;/p&gt;&#xA;" OwnerUserId="8079" LastActivityDate="2014-03-18T13:28:01.440" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15085" PostTypeId="2" ParentId="15070" CreationDate="2014-03-18T17:08:44.940" Score="-1" Body="&lt;p&gt;Partial answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Matrix completion does &quot;not rely on any notions of restricted isometry.&quot; Candes and Recht, 2008.&lt;/p&gt;&#xA;" OwnerUserId="4038" LastActivityDate="2014-03-18T17:08:44.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15086" PostTypeId="2" ParentId="15077" CreationDate="2014-03-18T17:57:46.660" Score="2" Body="&lt;p&gt;There is something that is not clear of what you have done with the data, and that is who do you form the random vectors to perform de SVD (or EVD) on the covariance matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 -The KLT can be succesfully used on a one dimensional signal (only one Geophone), taking frames of $M$ samples and estimating a covariance matrix from it, and the performing Eigenvalue decomposition, or with the SVD of the Data matrix (which supposedly is the same), then you sort the eigenvalues (or singular values) in descending order, and remove the smallest ones according to a particular criteria. With this you will remove part of the noise.&#xA;Based on the process i described, there is no assumption about any correlation between the signaals on the geophones (and in reality i think there will be, but i am not an expert in geology), so if you perform the same processing to every signal, it doesnt matter what delay you have between particular events, the process will still remove noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - But, if you construct your random vector with one sample from each geophone taken at the same time instant, then the time delay might affect the correlation between each sample from a geophone and then applying KLT might not reduce the noise as it is expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach number 1 i described is called Temporal PCD (Principal component analysis) and the second one is called Spatial PCA, assuming you put the geophones in different locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally i think it should not fail if you do spatial PCA, because even though there will be time delay, the samples from different geophones at same time instants will have some degree of correlation, except if you put them hundreds of miles apart, but if they are all in the same region, then they will each sense approximately the same signal but contaminated with noise and probably convoluted with an impulse response of the geographical region, but as long as there is correlation, you can apply KLT.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="7599" LastEditDate="2016-06-17T09:55:17.157" LastActivityDate="2016-06-17T09:55:17.157" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15087" PostTypeId="1" AcceptedAnswerId="15091" CreationDate="2014-03-18T20:34:21.447" Score="4" ViewCount="2288" Body="&lt;p&gt;If a system is given by a transfer function in the $z$ domain that has all poles and zeros inside the unit circle except for a factor of $z^{-1}$ in the denominator (pole at infinity), can it still be considered minimum phase?&#xA;If not, how would I create an all pass system to neutralize this pole and obtain a minimum phase representation of the system without also adding a zero at infinity (which i assume would also cause the system to not be min-phase?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{1 - \frac 12 z^{-1}}{z^{-1}}$$&lt;/p&gt;&#xA;" OwnerUserId="8281" LastEditorUserId="4298" LastEditDate="2017-12-11T09:27:50.630" LastActivityDate="2018-04-10T08:57:19.930" Title="Minimum phase systems with pole at infinity" Tags="|phase|z-transform|allpass|minimum-phase|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15088" PostTypeId="1" AcceptedAnswerId="15089" CreationDate="2014-03-18T20:42:01.477" Score="2" ViewCount="14675" Body="&lt;p&gt;I am trying to implement Matlab's cross correlation function but I can't seem to replicate the results obtained when using Matlab's built in function &quot;xcorr&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Documentation for xcorr can be found &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ref/xcorr.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;HERE&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the Matlab documentation it seems as though the cross correlation is implemented as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  R_{xy}[m] =  \left.\begin{cases} \sum_{n=0}^{N - m - 1} x[n + m] y[n]&#xA;&amp;amp; m \geq 0\\ \\ R_{yx}[-m] &amp;amp; m &amp;lt; 0\\ \end{cases} \right\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or equivalently as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  R_{xy}[m] =  \left.\begin{cases} \sum_{n=1}^{N - m} x[n + m] y[n]&#xA;&amp;amp; m \geq 0\\ \\ \sum_{n=1}^{N + m} y[n - m] x[n] &amp;amp; m &amp;lt; 0\\ \end{cases} \right\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if x and y have indexes starting at 1.The result will then be C, where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  C(m) = R_{xy}(m - N) \hspace{1cm} \text{for} \hspace{1cm} m = 1, 2,...,2N - 1. &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The implementation of this formula in Matlab is shown below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [result] = myXCorr(A , B)&#xA;%Implementation of the Cross Coorelation Function&#xA;&#xA;N = size(A,2);&#xA;M = size(B,2);&#xA;result = zeros(1, N + M - 1 );&#xA;len = size(result,2);&#xA;&#xA;for m = 1 : len  &#xA;   arg = (m - N); &#xA;&#xA;   if(arg &amp;lt; 0)&#xA;       negativeCondition = 1;&#xA;       limit = N + arg;&#xA;   else&#xA;       negativeCondition = 0;&#xA;       limit = N - arg;&#xA;   end&#xA;&#xA;   for n = 1:limit&#xA;           if(negativeCondition == 0)&#xA;            result(m) = result(m) + A(arg + n) + B(n);&#xA;           else&#xA;            result(m) = result(m) + A(n) + B(n - arg);&#xA;           end&#xA;   end&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This implementation does not produce the same results as Matlab and I can't seem to find out  what the error is.The plots of the autocorrelation's are shown below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = 1:1:10;&#xA;B = 1:1:10;&#xA;&#xA;myResult = myXCorr(A,B);&#xA;mResult = xcorr(A,B);&#xA;&#xA;lag = -9:1:9;&#xA;&#xA;plot(lag, myResult);&#xA;plot(lag, mResult);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Autocorrelation using my function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eQCLg.jpg&quot; alt=&quot;myXCorr.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Autocorrelation using &quot;xcorr&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4A7z4.jpg&quot; alt=&quot;xcorr.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what 'm doing wrong here? Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="80" LastEditDate="2014-03-18T21:53:26.297" LastActivityDate="2017-02-07T09:07:08.173" Title="How to compute the cross correlation of two fuctions" Tags="|matlab|cross-correlation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15089" PostTypeId="2" ParentId="15088" CreationDate="2014-03-18T20:50:40.017" Score="3" Body="&lt;p&gt;In the loop where you compute your result vector, you should be multiplying the A and B values instead of adding them up.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-18T20:50:40.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15090" PostTypeId="2" ParentId="15087" CreationDate="2014-03-18T21:11:41.420" Score="0" Body="&lt;p&gt;No, to the first question.  A pole at infinity means the region of convergence does not include infinity.  This means that the system is not causal.  But the definition of a minimum phase system usually includes the requirement that the system be causal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-18T21:11:41.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15091" PostTypeId="2" ParentId="15087" CreationDate="2014-03-18T21:15:26.987" Score="3" Body="&lt;p&gt;If I see it correctly, your transfer function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1-\frac{1}{2}z^{-1}}{z^{-1}}=z-\frac{1}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This system is not a minimum-phase system because its pole is at infinity (as you've already pointed out). You could use a trivial all-pass filter with impulse response $h[n]=\delta[n-1]$, i.e. a simple delay by one sample to change your original (non-causal) transfer function to a stable and causal transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_m(z)=z^{-1}H(z)=1-\frac{1}{2}z^{-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is also minimum-phase, because it has a pole at $z=0$ and a zero at $z=1/2$. This means that all the system's poles and zeros are inside the unit circle and the minimum-phase requirement is met.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-18T21:15:26.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15092" PostTypeId="1" AcceptedAnswerId="15094" CreationDate="2014-03-18T22:55:57.650" Score="0" ViewCount="1568" Body="&lt;p&gt;In a debate on the value of 24b/192KHz consumer audio (using a good brick wall filter, minimal jitter), a friend posed the argument:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Nyquist never properly dealt with harmonics, which change sound&#xA;  pressures by riding a higher frequency on a lower frequency &quot;carrier&quot;,&#xA;  increasing the propagation of the higher frequency and lending some&#xA;  extra punch to the lower frequency.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;http://www.computeraudiophile.com/f8-general-forum/better-understanding-shannon-nyquist-8568/&quot; rel=&quot;nofollow&quot;&gt;post&lt;/a&gt; from ComputerAudioPhile.com poses the same:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So let's say you have a flute that produces a tone at 14kHz. It may&#xA;  then produce overtones or harmonics at 28kHz, 42kHz, etc. If say the&#xA;  28kHz overtone is sufficiently strong, and you truncate at redbook&#xA;  sampling frequency (corresponding to a 22kHz signal), then you might&#xA;  get an artifact at 22kHz - (28-22kHz) = 16kHz, which, if you are young&#xA;  enough, might be audible.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My Nyquestions are: How does this &lt;em&gt;actually work&lt;/em&gt;? Which papers should I read?&lt;/p&gt;&#xA;" OwnerUserId="8282" LastEditorUserId="8282" LastEditDate="2014-03-18T23:44:19.837" LastActivityDate="2014-04-18T03:39:09.620" Title="Does sampling ~&gt; Nyquist frequency capture harmonics?" Tags="|nyquist|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15093" PostTypeId="2" ParentId="15092" CreationDate="2014-03-18T23:13:01.103" Score="1" Body="&lt;p&gt;This is called &quot;aliasing&quot; and it is simply a result of periodicity of sine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sin ak$ = $\sin (a+2b\pi)k$ (for integers $k$,$b$ - $k$ being the sample index)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you maybe have $a=1.3\pi$, you could also see it as a signal at $-0.7\pi$ (a signal of negative phase at $0.7\pi$), or rather: you will not see any difference in the samples.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-18T23:13:01.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15094" PostTypeId="2" ParentId="15092" CreationDate="2014-03-18T23:30:21.613" Score="1" Body="&lt;p&gt;No.  Sampling at double the Nyquist frequency won't capture usable data at that frequency in the real world (finite length signals imperfectly filtered).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling &lt;strong&gt;above&lt;/strong&gt; double the Nyquist frequency will not capture any of the very common harmonics or overtones of a pitch that are around or above half the sampling frequency, even if the pitch is well below half the sampling rate.  If this high frequency spectrum is not filtered out, it will be aliased and thus distort the recorded data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus audio has to be low-pass filtered before sampling, which removes any overtones or harmonics around or above half the sample rate.  However, for a high enough sample rate, say 48 kHz, any spectrum around or above half this is thought to be inaudible to most adult humans.  If these overtones are inaudible, then any effect that they have on the fundamental pitch waveform is also thought to be inaudible (although the topic is debated.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added:  For part 2 of your question, the subject is called &quot;aliasing&quot; in sampling.  If the anti-aliasing low-pass filter isn't very good (stop-band well above the noise floor), then there might remain spectral content above half the sample rate in frequency, which will be folded down in frequency (aliased) by sampling, and thus cause distortion.  The greater the difference between the highest frequency from the mic and half the sample rate, the less will be left behind by a non-good filter, or a different and cheaper reasonably-good filter might be suitable.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-19T00:12:29.570" LastActivityDate="2014-03-19T00:12:29.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15096" PostTypeId="1" AcceptedAnswerId="15097" CreationDate="2014-03-19T01:40:35.353" Score="7" ViewCount="3882" Body="&lt;p&gt;I have 2 vectors, &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, both of length &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. I know they are related by &lt;span class=&quot;math-container&quot;&gt;$a*b=c$&lt;/span&gt;. My goal is to recover &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. Obviously &lt;span class=&quot;math-container&quot;&gt;$b = \mbox{deconv} (c,a)$&lt;/span&gt;. I am only interested in the first &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; elements of the convolution (i.e., discarding the last &lt;span class=&quot;math-container&quot;&gt;$M-1$&lt;/span&gt; elements). I have two methods of doing this deconvolution in MATLAB and I get different answers. I want to know why:&lt;/p&gt;&#xA;&lt;p&gt;The first method would be using MATLAB's default algorithm:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;b=deconv([c;zeros(M-1,1)],a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The second method would be using Toeplitz matrices:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;A=toeplitz(a,[a(1);zeros(M-1,1)]);     &#xA;b=A^-1*c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where &lt;code&gt;A&lt;/code&gt; is the Toeplitz matrix form of the vector &lt;code&gt;a&lt;/code&gt; with &lt;code&gt;0&lt;/code&gt;s on upper triangle.&lt;/p&gt;&#xA;&lt;p&gt;I believe in theory these methods should give me identical answers, but the answers are somewhat different (but still close).&#xA;Why is this?&lt;/p&gt;&#xA;" OwnerUserId="4550" LastEditorUserId="7092" LastEditDate="2023-02-26T15:27:33.940" LastActivityDate="2023-02-26T15:27:33.940" Title="Relationship between discrete deconvolution and Toeplitz matrices" Tags="|matlab|linear-systems|deconvolution|matrix|linear-algebra|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15097" PostTypeId="2" ParentId="15096" CreationDate="2014-03-19T03:02:45.580" Score="10" Body="&lt;p&gt;I think you are constructing the convolution matrix incorrectly. Let's do an easy example with some numbers to see how it is constructed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's imagine that youhave the following vectors of dimensions $M$ and $N$, And let's for the sake of it, say that $M = 5$ and $N = 4$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{a} = [a_{1},a_{2},a_{3},a_{4}]^{T}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{b} = [b_{1},b_{2},b_{3},b_{4},b_{5}]^{T}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;\mathbf{c} = \mathbf{a}*\mathbf{b}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix form, if we assume $\mathbf{a}$ is the system response, the convolution is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation} &#xA;    c = \mathbf{A}\mathbf{b}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation} &#xA;    \mathbf{A} = \left[&#xA;    \begin{array}{ccccc}&#xA;        a_{1} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;        a_{2} &amp;amp; a_{1} &amp;amp; 0 &amp;amp;  0 &amp;amp; 0 \\&#xA;        a_{3} &amp;amp; a_{2} &amp;amp; a_{1} &amp;amp;  0 &amp;amp; 0 \\&#xA;        a_{4} &amp;amp; a_{3} &amp;amp; a_{2} &amp;amp; a_{1} &amp;amp;  0 \\&#xA;        0 &amp;amp; a_{4} &amp;amp; a_{3} &amp;amp; a_{2} &amp;amp; a_{1} \\&#xA;        0 &amp;amp; 0 &amp;amp; a_{4} &amp;amp; a_{3} &amp;amp; a_{2} \\&#xA;        0 &amp;amp; 0 &amp;amp; 0 &amp;amp; a_{4} &amp;amp; a_{3} \\&#xA;        0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; a_{4} \\&#xA;    \end{array}\right]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By doing the convolution with this matrix, you get the full operation including the transients. So the correct matlab code would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A = toeplitz([a,zeros(1,M-1)],[a(1),zeros(1,M-1)]) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Check help toepliz to verify how it constructs the matrix)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use this matrix and the result of the convolution is exactly as with the matrix multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, a word of wisdom, as you can clearly see, the full convolution matrix with the transients is not square, so in order to &quot;invert&quot; it and do deconvolution you will need to use the Moore-Penrose Pseudoinverse. And you will get some differences in the beginning and end of the resulting vector, but it is the best you can do, as using the pseudoinverse would be the same as performing least squares, since the deconvolution is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{b} = \left(\mathbf{A}^{T}\mathbf{A}\right)^{-1}\mathbf{A}^{T}\mathbf{c}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This result will always hold, because the dimensions of $A$ are always $(M+N-1)\times M$, so the matrix is always &quot;skinny&quot; and the equation holds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this, it should give you the result you were looking for.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="7599" LastEditDate="2014-03-19T16:28:12.423" LastActivityDate="2014-03-19T16:28:12.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15100" PostTypeId="1" CreationDate="2014-03-19T05:13:50.837" Score="1" ViewCount="808" Body="&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to remove artifact that appears strongly on all channels in my EEG data. It's already recorded (from another lab) so I can't use hardware solutions. Also: band overlap and no reference channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Less Short&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I have 28 EEG channels with strong common-mode artifact&lt;/em&gt; (artifact amplitude is on the order of $10^4$, the rest is on the order of $10^2$), but I don't have a channel I can specifically call a reference channel. If you run cross-correlation between the channels, all pairs have a $C_{xy}&amp;gt;0.98$, all at 0s lag. That alone tells me it's artifact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Is there a standard practice for removing this kind of artifact from signal?&lt;/em&gt; Artifact band overlaps signal band, so band-pass filters aren't enough. I thought to call one channel the reference channel and subtract it from all others, but then I either have to manually pick a ref channel for each file (many files), or rely on a given channel being well-behaved (not all are). An option I like more is to take the mean at each time step, and subtract it from each channel. In Matlab code, &lt;code&gt;artifact_free = raw_data - mean(raw_data,2)&lt;/code&gt; (columns = channels, rows = time steps).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second option implicitly assumes that non-artifact components can be characterized as random, independent processes, and could smooth/remove cortical response in the signal that happens at/near the same time on different channels. Because of this I'm still a bit uncomfortable with doing that. I'm a little new to EEG so I don't know what assumptions I'm allowed to make. We got the data from another lab, so there are no EEG experts to ask here, and I don't want to lose information in the data or do something that statistics says I can't.&lt;/p&gt;&#xA;" OwnerUserId="8062" LastActivityDate="2014-03-19T05:13:50.837" Title="Common mode rejection (in software) without a reference channel? EEG data" Tags="|filters|noise|eeg|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15101" PostTypeId="1" AcceptedAnswerId="15106" CreationDate="2014-03-19T06:42:39.463" Score="3" ViewCount="3048" Body="&lt;p&gt;I'm developing an Artificial Neural Network based Speech Recognition System using MFCCs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have 260 input nodes in the ANN, and this number of nodes corresponds to the number of MFCCs that I will use. During feature extraction the number of total coefficients vary with respect to the duration of the sound file. This poses a problem if the ANN was trained just for 260 coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So most likely the system will fail if a different sound duration which yields lesser or greater number of coefficients is used to test the Neural Network. My question is how do I go about this problem? I have seen several papers in the net talking about Speech Recognition using ANN but I haven't seen something concerning this problem &lt;/p&gt;&#xA;" OwnerUserId="8250" LastActivityDate="2015-12-05T19:14:44.723" Title="Using MFCC to an ANN Speech Recognition System" Tags="|speech-recognition|mfcc|machine-learning|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15102" PostTypeId="2" ParentId="15101" CreationDate="2014-03-19T06:58:22.577" Score="1" Body="&lt;p&gt;You should process the speech in blocks of a few milliseconds at a time. Each block will be the same length. Then you can apply your ANN to those features.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-03-19T06:58:22.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15103" PostTypeId="1" AcceptedAnswerId="15104" CreationDate="2014-03-19T08:28:45.750" Score="2" ViewCount="7699" Body="&lt;p&gt;I understand why there need an low pass filter before &lt;strong&gt;down-sampling&lt;/strong&gt;, the sample frequency need to be at least twice of the max frequency signal, else there will be &lt;code&gt;alias&lt;/code&gt; issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But base on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Upsampling&quot; rel=&quot;nofollow&quot;&gt;Wiki&lt;/a&gt; page, we need an lowpass filter after &lt;strong&gt;up-sampling&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Upsampling requires a lowpass filter after increasing the data rate,&#xA;  and downsampling requires a lowpass filter before decimation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand that, can anyone explain it?&lt;/p&gt;&#xA;" OwnerUserId="7388" LastActivityDate="2014-03-19T09:04:51.040" Title="Why need an low pass filter after up-sampling?" Tags="|sampling|downsampling|supersampling|" AnswerCount="1" CommentCount="1" ClosedDate="2014-03-19T14:16:11.337" ContentLicense="CC BY-SA 3.0" />
  <row Id="15104" PostTypeId="2" ParentId="15103" CreationDate="2014-03-19T09:04:51.040" Score="2" Body="&lt;p&gt;Let's say you've sampled an analog signal $x(t)$ with spectrum $X(\omega)$ at rate $1/T$ that is high enough to satisfy the sampling theorem. The spectrum (i.e. the discrete time Fourier transform (DTFT)) of the sampled signal $x_{1,k}$ will be a periodic repetition of $X(\omega)$. The repetition period is $1/T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you sample the same signal with a higher rate $L/T,\, L\in\mathbb N$ yielding $x_{L,k}$. Again the spectrum will be a periodic repetition of $X(\omega)$ but this time the repetition period is $L/T$, so the spectral images have greater frequency distance than before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The task of upsampling consists in calculating $x_{L,k}$ from $x_k$. First, $L-1$ zeros are inserted after every sample of $x_k$. Actually this just changes the basic frequency support of the DTFT to $-L/(2T)\ldots L/(2T)$ containing $L$ copies of the original (analog) spectrum. Therefore the unwanted copies are filtered out with a lowpass filter so that only the original spectrum in range $-1/(2T)\ldots 1/(2T)$ remains. This is identical to $x_{L,K}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above steps are quite well explained in the &lt;a href=&quot;http://en.wikipedia.org/wiki/File%3aSpectral_views_of_zero-fill_and_interpolation_by_lowpass_filtering.pdf&quot; rel=&quot;nofollow&quot;&gt;figure&lt;/a&gt; of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Upsampling&quot; rel=&quot;nofollow&quot;&gt;Wiki article&lt;/a&gt; you quoted (in the same order).&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-03-19T09:04:51.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15105" PostTypeId="1" AcceptedAnswerId="15108" CreationDate="2014-03-19T10:31:10.237" Score="1" ViewCount="1466" Body="&lt;p&gt;I'm working on a audio sample recognition project, where first you profile a sound and then run the sound detection function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently during the 'profile' stage I'm grabbing copies of the magnitude frequency bin from the sound you want to detect (for a changeable pre-set amount of FFTs). During the detection phase I'm trying to use these to compare the similarity of the incoming identical length FFT, to see if they 'match'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be some good methods to compare the two FFTs given that I have a '&lt;em&gt;learn&lt;/em&gt;' phase which can be used. I've tried comparing the maximum frequency bin, which works well to an extent. Voice recognition is easily fooled, with a tone generator (Which makes sense)'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sampling at 16000Hz with each FFT at 2048 samples long, equating to 128ms of data. Which I believe gives me a frequency range of ~8000hz. &lt;/p&gt;&#xA;" OwnerUserId="8288" LastEditorUserId="8288" LastEditDate="2014-03-19T13:14:45.953" LastActivityDate="2014-03-19T13:30:31.893" Title="Comparing an audio signal with a previous 'taught/profiled' signal" Tags="|fft|audio|voice|machine-learning|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15106" PostTypeId="2" ParentId="15101" CreationDate="2014-03-19T10:32:08.557" Score="0" Body="&lt;p&gt;You will be using an &quot;enframe&quot; operation, such as this one:&#xA;&lt;a href=&quot;http://my.fit.edu/~vkepuska/ece5526/TIMIT_Corpus/MATLAB/voicebox/enframe.m&quot; rel=&quot;nofollow&quot;&gt;http://my.fit.edu/~vkepuska/ece5526/TIMIT_Corpus/MATLAB/voicebox/enframe.m&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will split up your signal with certain overlap. You will extract certain features (MFCC) from those features and will train these as the parts of phonemes (or any other speech indicator). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will do the same thing in runtime and classify each block obtained by enframe as a phoneme. At the end you get a result, where intervals of your speech are mapped to key speech blocks. Unifying them would allow to recognize what is spoken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to do that, than you can go with HMMs, which can deal with changing length speech signals.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-19T10:32:08.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15107" PostTypeId="1" CreationDate="2014-03-19T12:04:46.360" Score="5" ViewCount="344" Body="&lt;p&gt;I am currently reading &quot;A parametric texture model based on joint statistics of complex wavelet coefficients&quot;, by Portilla and Simoncelli. In this article, they use the &quot;steerable pyramid&quot; to represent the image. This uses a set of filters to decompose the image in a set of something around 16 subbands in the frequency domain, varying in spatial frequency and orientation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; They mention (page 55) that their decomposition forms a &quot;tight frame&quot;. I know the definition of a tight frame in general linear algebra setting, or say orthogonal wavelet decomposition. However, in those cases the set of vectors that form the frame has cardinality of &lt;em&gt;at least the dimension of the space considered&lt;/em&gt;. It seems highly unlikely that the space of images they want to consider is at most 16, and thus highly unlikely that this is what they mean. Can anybody tell me what is meant by the notion of a &quot;tight frame&quot; in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;: I am a mathematician that recently started working in neuroscience and now reading the mentioned article, published in the international journal of computer vision. Therefore the problem is probably just a matter of different languages used in different fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="8289" LastActivityDate="2014-09-01T15:40:28.757" Title="Meaning of tight frame in the context of texture synthesis" Tags="|filters|dft|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15108" PostTypeId="2" ParentId="15105" CreationDate="2014-03-19T13:21:23.637" Score="2" Body="&lt;p&gt;FFT won't work because it captures too many details which are rather irrelevant to the task. You need to extract a representation of sound which is more or less invariant by pitch and amplitude changes (properties of sound which are irrelevant to your problem). So you need a &quot;blurred&quot; version of the spectrum - and MFCCs are exactly that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The textbook-ish, baseline system for speaker verification is to extract &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel-frequency_cepstrum&quot; rel=&quot;nofollow&quot;&gt;MFCCs&lt;/a&gt; (first coefficient excluded) on the &quot;profile&quot; recording; train a Gaussian Mixture Model on this data. The more data we have in the profile, the better (ideally, the most common phonemes should all be represented).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To score a new recording (during the &quot;recognition&quot; phase), extract the MFCCs, and compute the likelihood of the model given this data (you'll have to normalize by the length of the recording). Compare the score to a threshold - set according to the false positive rate you want to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For speaker recognition, you train one model per speaker to recognize; and select the speaker associated with the model with the higher score.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-03-19T13:30:31.893" LastActivityDate="2014-03-19T13:30:31.893" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15109" PostTypeId="1" CreationDate="2014-03-19T13:39:35.520" Score="1" ViewCount="246" Body="&lt;p&gt;I have a C# desktop application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its purpose is to detect motion changes between consecutive frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am using the excellent Emgu wrapper to OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I know this question may seem ridiculous but it is an extreme example to demonstrate best what I mean by the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a complete white background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Snow begins to fall..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I actually want to detect the motion changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously the contrast is appalling and my normal way of detecting motion pixels by comparing the RGB values will need to have a really low threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I use 10% difference. Any less than that and I will incur noise from more 'contrasted' images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could look at the edges instead of the color changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could try to write a test that will detect a low contrast image and lower the threshold to 5% (e.g.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will of course attempt these 2 things now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but is there a more obvious approach to this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could post code that shows how I compare the pixels of each image and report motion but that would be a very basic thing to post. But will do if asked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I see it a human can detect this motion of snow so I just need to find what rules would allow my code to do the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE&#xA;For me I decided to improve the gamma of an image to help me with poor contrast.&#xA;This is the code I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double intensity = grayCurrent.GetAverage().Intensity;&#xA;double g = Math.Log(Shared.Optimum, 256) / Math.Log(intensity, 256);&#xA;if (g != 1)&#xA;{&#xA;    grayCurrent._GammaCorrect(g);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am doing here is get the average 'darkness' of the overall image.&#xA;I then found that 'log' formula on my Google Searches travels.&#xA;I then, by trial and error determined that the shared optimum for my particular application is 75.&#xA;I then say if the 'balance' is '1' then do not change anything. If it is off the 'norm' then make the changes to the overall image.&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="8290" LastEditDate="2014-03-25T07:42:15.357" LastActivityDate="2014-03-25T07:42:15.357" Title="motion detection within a poor contrast image" Tags="|image-processing|image-segmentation|c#|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15110" PostTypeId="2" ParentId="8468" CreationDate="2014-03-19T13:46:35.710" Score="8" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I only need the total group delay, not spectrum of group delay.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Group delay &lt;em&gt;is&lt;/em&gt; a spectrum, so this doesn't make sense.  The group delay is the derivative of the phase response of the filter, so in Python it can be calculated as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy import signal&#xA;from numpy import pi, diff, unwrap, angle&#xA;&#xA;w, h = signal.freqs(b, a)&#xA;group_delay = -diff(unwrap(angle(h))) / diff(w)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The units of phase are radians, and the units of frequency are radians/sec, so the units of group delay are in seconds.  Examples at &lt;a href=&quot;https://gist.github.com/endolith/4964212&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt; and &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.bessel.html&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The group delay of a Bessel filter is maximally flat, so when you say &quot;the&quot; group delay, you probably mean the maximum passband group delay.  Like in this filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HVdbB.png&quot; alt=&quot;Bessel filter group delay plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The passband has about 0.032 seconds of group delay.  Your Butterworth filter does not attempt to have a flat group delay in the passband, however, so it's up to you to decide what &quot;the&quot; group delay is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IigxS.jpg&quot; alt=&quot;group delay of bessel vs butterworth filters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you want the group delay at 0 Hz, or the maximum group delay at the cutoff frequency?  Or maybe at a specific frequency like the fundamental clock frequency of your digital signal?&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2014-03-19T13:46:35.710" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15111" PostTypeId="1" CreationDate="2014-03-19T14:20:53.167" Score="3" ViewCount="2743" Body="&lt;p&gt;I am working on a eye blink detection project in Matlab. By this moment I have been successfully extracted the images of pupil of eye from the real time video captured via a web cam.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am stuck at the process to differentiate the open eye pupil to the closed eye lid state.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Open eye pupil&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YD2Pq.png&quot; alt=&quot;Open eye pupil&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.closed eye lid&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SyiO9.png&quot; alt=&quot;closed eye lid&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please suggest me any image processing function or algorithm to differentiate between the two states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Attached images are the original/actual images extracted from the program on which image processing is to be done.)&lt;/p&gt;&#xA;" OwnerUserId="8291" LastEditorUserId="128" LastEditDate="2023-07-06T08:33:06.740" LastActivityDate="2024-04-02T22:03:00.330" Title="Eye Blink Detection Using Computer Vision" Tags="|image-processing|matlab|computer-vision|machine-learning|face-detection|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15112" PostTypeId="1" AcceptedAnswerId="15141" CreationDate="2014-03-19T15:20:22.080" Score="1" ViewCount="485" Body="&lt;p&gt;I have posted this question &amp;quot;Electrical Engineering&amp;quot;, but this seems a more appropiate place. I am trying to model a bireciprocal Cauer filter in LTspice but I don't get the expected results. More precisely, using this formula for the coefficients&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\gamma=\frac{re(p_i)−1}{re(p_i)+1}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$re(p_i)$&lt;/span&gt; is the realpart of the pole, gives this result:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dOE8W.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dOE8W.png&quot; alt=&quot;normal way&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point it doesn't really matter what settings were in the beginning, the &amp;quot;why&amp;quot; is in the following. Among the few references I found online, one that gives a numerical example is a thesis, &lt;i&gt;Design and Realization Methods for IIR Multiple Notch Filters and High Speed Narrow-band and Wide-band Filters, L. Barbara Dai&lt;/i&gt; and, simply by looking at the numbers and comparing them with what I had, it seemed as if the poles need to be &amp;quot;normalized&amp;quot; to the single real pole, &lt;span class=&quot;math-container&quot;&gt;$p_{\frac{N+1}{2}}$&lt;/span&gt;. And so I tried:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\gamma=\frac{\frac{re(p_i)}{re_{\frac{N+1}{2}}}-1}{\frac{re(p_i)}{re_{\frac{N+1}{2}}}+1}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and, even if the numerical values still differed, but a not as before, I got this result:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X1Yqz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X1Yqz.png&quot; alt=&quot;&amp;quot;normalized&amp;quot; coefficients&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example used here is not the one used in the thesis, but I seem to get good results (I cannot verify them) with either stop-band, or transition-band optimizations and for any (odd) order.&lt;/p&gt;&#xA;&lt;p&gt;So, my question is: are the &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; terms from the formula &lt;span class=&quot;math-container&quot;&gt;$\gamma=\frac{A_i-2}{A_i+2}$&lt;/span&gt; calculated as &lt;span class=&quot;math-container&quot;&gt;$A_i=2\sigma_i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; is the realpart of the complex &lt;i&gt;s-domain&lt;/i&gt; &lt;span class=&quot;math-container&quot;&gt;$s_i=-\sigma_i\pm j \omega_i$&lt;/span&gt; or somehow else? If else, how?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Just for the sake of comparison, the following is a test using the same settings as in the thesis: &lt;span class=&quot;math-container&quot;&gt;$A_s=68 =&amp;gt; A_p, \omega_s=\frac{2}{3} =&amp;gt; \omega_p , f_0=2$&lt;/span&gt;. The order is calculated based on these four parameters, which will result in a stop-band attenuation optimization, rather than a transition-band or a pass-band optimization. I say this because I don't know what approach Barbara Dai has.&lt;/p&gt;&#xA;&lt;p&gt;The first simulation is with the raw values from the thesis for &lt;span class=&quot;math-container&quot;&gt;$\gamma_i$&lt;/span&gt; (black trace) and the quantized values (blue trace) (surprisingly, the quantized values seem to get a better result):&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://s27.postimg.org/txv5djaw3/thesis.png&quot; alt=&quot;thesis&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;If I calculate the values for &lt;span class=&quot;math-container&quot;&gt;$\gamma_i$&lt;/span&gt; according to the equation from p.26 from the thesis, I get these values:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\gamma_1=−0.098365443613057, \gamma_2=−0.34760115224764, \gamma_3=−0.7329991130665$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the values for the real part(s) of the poles, &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt;, are:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sigma_1=0.15406868065906, \sigma_2=0.48411864791316, \sigma_3=0.82088758493805$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The results of the simulation with LTspice is this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://s29.postimg.org/8h40dsfnr/test1.png&quot; alt=&quot;my results&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the black trace is with the above coefficients and the blue trace is with Barbara Dai's unquantized.&lt;/p&gt;&#xA;&lt;p&gt;Seeing this I tried to transform back the values for &lt;span class=&quot;math-container&quot;&gt;$\gamma_{1,2,3}$&lt;/span&gt; from the thesis, to see what values for the poles were originally and compare them against my results:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sigma_1^{BD}=0.15537305159045, \sigma_2^{BD}=0.48869842253758, \sigma_3^{BD}=0.83127957288835$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which are different than mine. However, at a glance, it seemed that I could try to divide each real pole from my calculations to the value of the single, real pole at &lt;span class=&quot;math-container&quot;&gt;$s_4=\sigma_4+j0 , \sigma_4=0.98572364533093$&lt;/span&gt;, in order to calculate the values for the lattice coefficients (which is how the 2nd eq. from the beginning appeared), and I got these values:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\gamma_1=−0.091240471459003, \gamma_2=−0.34126450145251, \gamma_3=−0.72965482018797 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the result of the simulation is this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://s16.postimg.org/bs9pdbupx/test2.png&quot; alt=&quot;surprise!&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;with the blue trace being this result and the black trace Barbara Dai's unquantized, which seems even better even if the lobes in the stop-band aren't quite equiripple:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://s22.postimg.org/vwrlg7ykh/lobes.png&quot; alt=&quot;lobes&quot; /&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;[edit]&lt;/p&gt;&#xA;&lt;p&gt;The case of the BLWDF implies that, given the stop-band attenuation and frequency, the pass-band attenuation and frequency can be deduced, or vice-versa. For this case, I'll impose &lt;span class=&quot;math-container&quot;&gt;$A_s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\omega_s$&lt;/span&gt; and deduce &lt;span class=&quot;math-container&quot;&gt;$A_p=-10 log_{10}(1-10^{-\frac{A_s}{20}})$&lt;/span&gt; (eq. 2.51 in the above thesis) and &lt;span class=&quot;math-container&quot;&gt;$f_p=\frac{f_0}{2}-f_s$&lt;/span&gt; (in the analog domain) or &lt;span class=&quot;math-container&quot;&gt;$\omega_p=\frac{1}{\omega_s}$&lt;/span&gt; (in the digital domain, eq. 2.52a,b).&lt;/p&gt;&#xA;&lt;p&gt;The example at p.27 gives &lt;span class=&quot;math-container&quot;&gt;$A_s=68 \omega_s=\frac{16}{48}kHz=\frac{2}{3}$&lt;/span&gt; (normalized to &lt;span class=&quot;math-container&quot;&gt;$\frac{f_0}{2}=1$&lt;/span&gt;). From these: &lt;span class=&quot;math-container&quot;&gt;$A_p=6.8831e-7$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f_p=\frac{1}{3}$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$\omega_p=\frac{1}{1.732}=0.57735$&lt;/span&gt;. Using these to find the poles would imply several approaches, due to the complexity if Cauer filters. I don't know what approach the thesis uses but, whichever the case, it shouldn't yield such differences as the ones shown in picture#3. For my case, I'll use stop-band optimization, obtained by imposing &lt;span class=&quot;math-container&quot;&gt;$A_s, A_p, \omega_s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\omega_p$&lt;/span&gt; and determining the order. The poles (zeroes are not needed here) are &lt;span class=&quot;math-container&quot;&gt;$\sigma_{1,2,3}$&lt;/span&gt; below picture#3 and the result is picture#4.&lt;/p&gt;&#xA;&lt;p&gt;If I try to reverse Barbara Dai's process, to determine what poles were used to calculate her version of &lt;span class=&quot;math-container&quot;&gt;$\gamma_i$&lt;/span&gt;, I get the values of &lt;span class=&quot;math-container&quot;&gt;$\sigma_{1,2,3}^{BD}$&lt;/span&gt; below picture#4, which are slightly different than mine.&lt;/p&gt;&#xA;&lt;p&gt;At this point, back then when I obtained them, it seemed to me that I &lt;i&gt;could try&lt;/i&gt; to divide each pole to &lt;span class=&quot;math-container&quot;&gt;$\sigma_4$&lt;/span&gt;, the real, single pole, and so I did (second formula from above) which gave the results in picture#5, but this can't be the normal way of doing it, it was a whim tried at the moment, which gave quite the unexpected pleasant surprise. But now I'm left with the question: how are the poles derived in order to calculate the values for &lt;span class=&quot;math-container&quot;&gt;$\gamma_i$&lt;/span&gt;? Because it's not meant to be any different than any other Cauer filter design, with the differences in symmetry due to the bireciprocal nature.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Ultra-short-summary:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;using the coefficients calculated as &lt;span class=&quot;math-container&quot;&gt;$\gamma_i=\frac{A_i-2}{A_i+2}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A_i=2\sigma_i$&lt;/span&gt; (s-domain &lt;span class=&quot;math-container&quot;&gt;$s_i=\sigma_i+j \omega_i$&lt;/span&gt;), is not working (see picture#1, #4 - black trace)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;since only odd orders are valid, there is an extra single, real pole. By sheer ogling, dividing &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sigma_{\frac{N+1}{2}}$&lt;/span&gt; gives the results in pictures #2 and #5 - black trace.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Question: Are the terms &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; calculated as &lt;span class=&quot;math-container&quot;&gt;$2 \sigma_i$&lt;/span&gt; or somehow else? If else, how?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I don't know how to explain better at this time. If there are any English errors, my apologies, it's not my native language.&lt;/p&gt;&#xA;" OwnerUserId="8292" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-02-18T17:06:04.400" Title="Bireciprocal lattice wave digital filter" Tags="|filter-design|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="15113" PostTypeId="1" CreationDate="2014-03-19T15:36:21.093" Score="0" ViewCount="1523" Body="&lt;p&gt;I am quite confused whether the following numerical differences i find are just severe round off errors made by matlab, or something i am doing wrong. The following happened when trying to see what a low pass filter looks like in the spatial domain.&lt;/p&gt;&#xA;&lt;p&gt;By mathematics, the inverse fourier transform of a real symmetric image (&lt;span class=&quot;math-container&quot;&gt;$I(x,y) = I(-x,-y)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; gives the value of the image at the given pixel) should again be real-valued.&lt;/p&gt;&#xA;&lt;p&gt;However, when starting out with a low pass filter I defined as a disc of ones centered around the origin, surrounded by zeroes, the matlab command ifft2(ifftshift(I)) gave an image with pretty nontrivial complex component.&lt;/p&gt;&#xA;&lt;p&gt;When explicitly telling Matlab to utilize the symmetry, the command ifft2(ifftshift(I),'symmetric') did indeed give a matrix with only real entries. However, the numerical difference between the two commands was pretty big compared to what i expected: Letting &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; be our symmetric image in the frequency domain, i entered the following commands:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;J = ifft2( ifftshift(I) );&lt;/p&gt;&#xA;&lt;p&gt;K = ifft2( ifftshift(I), 'symmetric' );&lt;/p&gt;&#xA;&lt;p&gt;mean(mean(abs(real(J) - K)))&lt;/p&gt;&#xA;&lt;p&gt;ans =&lt;/p&gt;&#xA;&lt;p&gt;3.2851e-04&lt;/p&gt;&#xA;&lt;p&gt;mean(mean(abs(K)))&lt;/p&gt;&#xA;&lt;p&gt;ans =&lt;/p&gt;&#xA;&lt;p&gt;7.4830e-04&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;as you see, the difference between the real part of J and K is not that big per se, but it is big compared to the mean values of K. So it is quite nontrivial.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt; 1. Why do these complex components show up in J? Are they really round off errors made by Matlab?&#xA;2. Where does this numerical difference come from when i use this 'symmetric' command? Again just round of errors?&#xA;3. In practice, when dealing with symmetric real matrices (or more generally conjugate symmetric matrices), is it advisable to use the 'symmetric' command?&lt;/p&gt;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="8289" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-03-19T15:36:21.093" Title="Why does the inverse fourier transform of a lowpass filter have complex components in matlab?" Tags="|image-processing|fft|filters|fourier-transform|lowpass-filter|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15114" PostTypeId="1" AcceptedAnswerId="15117" CreationDate="2014-03-19T16:29:29.703" Score="7" ViewCount="3864" Body="&lt;p&gt;I've a noisy signal, which is the sound of motor with a constant speed, so  the sound &quot;should&quot; be  periodic, I know that there is a way to use the autocorrelation function to get the period,I did it, but I can't figure out the period. Any idea how to do that bellow the signal and the result of the autocorrelation : &#xA;the signal &#xA;&lt;img src=&quot;https://i.stack.imgur.com/Ndk69.png&quot; alt=&quot;signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the autocorrelation result : &#xA;&lt;img src=&quot;https://i.stack.imgur.com/J8H9Y.png&quot; alt=&quot;autocorrelation &quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1785" LastActivityDate="2017-02-16T19:17:59.330" Title="can't find out the period of my signal" Tags="|matlab|discrete-signals|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15115" PostTypeId="2" ParentId="15114" CreationDate="2014-03-19T20:10:48.117" Score="3" Body="&lt;p&gt;it seems that are you applying some window function in your signal (autocorrelation Plot seems windowed) !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do its work, split your signal in a constant framed data overlaped or not, apply autocorrelation function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(k)=\sum_{n=0}^{N-1}x(k) * x(n+k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end find the peak position and congrats you found the period !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do it in matlab &lt;a href=&quot;https://stackoverflow.com/questions/18145936/how-to-extract-a-frequency-from-a-signal/18215440#18215440&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2014-03-19T21:11:39.603" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15116" PostTypeId="1" CreationDate="2014-03-19T20:33:05.633" Score="0" ViewCount="1057" Body="&lt;p&gt;Say I have two signals, a(t) and b(t) where the former is the input and the latter in the output. These signals are both recorded by sampling at every 0.01s. The Fast Fourier Transform was applied to both of these providing me with two large arrays of complex numbers. The FFT of b was divided by the FFT of a to provide me with a new array of complex numbers. This was plotted as can be seen below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LZya5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where x axis is real any y axis is imaginary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would one go about producing a closed form type polynomial for the transfer function of such a system? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Inverse FFT of the above. Complex components were of the order e^-14 and thus rounded to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NourS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8207" LastEditorUserId="8207" LastEditDate="2014-03-19T22:06:47.357" LastActivityDate="2014-03-19T22:06:47.357" Title="Obtaining an expression for the transfer function when using FFT" Tags="|fft|transfer-function|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15117" PostTypeId="2" ParentId="15114" CreationDate="2014-03-19T20:58:20.983" Score="6" Body="&lt;p&gt;Here's an attempt to do what you need in &lt;code&gt;scilab.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yh9FF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top plot shows some data that I synthesized.  The second plot shows the auto-correlation of the raw data (zoomed in around the central peak of the auto-correlation).  The red circles show the peaks found &lt;a href=&quot;https://fileexchange.scilab.org/toolboxes/209000&quot; rel=&quot;noreferrer&quot;&gt;using this &lt;code&gt;find_peaks&lt;/code&gt; function&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final plot shows the difference between all the peak locations. This will be an estimate of the period.  Because you're not really guaranteed that the underlying period will be an integer number of samples, you should probably find the mean of these values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the &quot;true&quot; period is &lt;code&gt;1/f0 = 11.191996&lt;/code&gt;, and taking &lt;code&gt;diffs = diff(peaks);&lt;/code&gt; and then &lt;code&gt;mean(diffs(10:173))&lt;/code&gt; yields &lt;code&gt;11.195122&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Code below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 1000;&#xA;f0 = 0.0893495634;&#xA;phi = rand(1,1,'uniform')*2*%pi;&#xA;sigma = 0.5;&#xA;&#xA;x = sin(2*%pi*[0:N-1]*f0 + phi) + sigma*rand(1,N,'normal');&#xA;XC = xcorr(x);&#xA;&#xA;clf&#xA;subplot(311)&#xA;plot(x);&#xA;&#xA;subplot(312)&#xA;plot(XC);&#xA;&#xA;peaks=peak_detect(XC,0);&#xA;&#xA;plot(peaks,XC(peaks),'ro')&#xA;&#xA;a = get('current_axes');&#xA;a.data_bounds=[950 1050 -500 800];&#xA;&#xA;subplot(313)&#xA;plot(diff(peaks));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2014-03-19T21:18:10.003" LastActivityDate="2014-03-19T21:18:10.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15121" PostTypeId="1" AcceptedAnswerId="15135" CreationDate="2014-03-20T05:28:46.267" Score="1" ViewCount="2944" Body="&lt;p&gt;I have an image taken a night time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apply _EqualizeHist to it. But the result is a high level of whiteness running through the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s028T.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had asked this question in a slightly different way and was given a link to improve the white balancing of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was the &lt;a href=&quot;https://stackoverflow.com/questions/22388643/how-to-change-the-contrast-of-an-image-using-emgu/22389270#22389270&quot;&gt;original question&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is that link:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/1175393/white-balance-algorithm&quot;&gt;enter link description here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have got as far as this in my code but now I am stuck as to what to do next.  I would be grateful if anyone can suggest the next step?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            Image&amp;lt;Bgr, byte&amp;gt; frame = new Image&amp;lt;Bgr, byte&amp;gt;(file);&#xA;            frame._EqualizeHist();&#xA;            Image&amp;lt;Hsv, byte&amp;gt; hsv = new Image&amp;lt;Hsv, byte&amp;gt;(file);&#xA;            Image&amp;lt;Gray,byte&amp;gt; maskLight= new Image&amp;lt;Gray,byte&amp;gt;(hsv.Width,hsv.Height);&#xA;            Image&amp;lt;Gray, byte&amp;gt; maskDark = new Image&amp;lt;Gray, byte&amp;gt;(hsv.Width, hsv.Height);&#xA;&#xA;            Emgu.CV.CvInvoke.cvThreshold(hsv[2], maskLight, 128, 255, THRESH.CV_THRESH_BINARY);&#xA;            Emgu.CV.CvInvoke.cvThreshold(hsv[2], maskDark, 0, 127, THRESH.CV_THRESH_BINARY);&#xA;&#xA;            Bgr bgrLightest;&#xA;            MCvScalar scalarLightest;&#xA;            frame.AvgSdv(out bgrLightest, out scalarLightest, maskLight);&#xA;&#xA;            Bgr bgrDarkest;&#xA;            MCvScalar scalarDarkest;&#xA;            frame.AvgSdv(out bgrDarkest, out scalarDarkest, maskDark);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&#xA;I have tried to implement the suggestion kindly goven by sansuiso.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Image&amp;lt;Bgr, byte&amp;gt; rgb = new Image&amp;lt;Bgr, byte&amp;gt;(@&quot;D:\789.jpg&quot;);&#xA;            pictureBox1.Image = rgb.ToBitmap();&#xA;&#xA;            for (int x = 0; x &amp;lt; 360; x = x + 24)&#xA;            {&#xA;                for (int y = 0; y &amp;lt; 288; y = y + 24)&#xA;                {&#xA;                    rgb.ROI = new Rectangle(0, 0, 360, 288);&#xA;                    int xx = x;&#xA;                    int yy = y;&#xA;                    if (x &amp;gt; 0)&#xA;                    {&#xA;                        xx = xx - 12;&#xA;                    }&#xA;                    if (y &amp;gt; 0)&#xA;                    {&#xA;                        yy = yy - 12;&#xA;                    }&#xA;                    rgb.ROI = new Rectangle(xx, yy, 24, 24); //360*288&#xA;                    rgb._EqualizeHist();&#xA;                }&#xA;            }&#xA;            rgb.ROI = new Rectangle(0, 0, 360, 288);&#xA;            pictureBox2.Image = rgb.ToBitmap();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the resulting image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0iChr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, I am not doing this right.  Can anyone see if my code is wrong please?&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-03-22T18:59:58.093" Title="Improve contrast when image has a flood of white balancing" Tags="|image-processing|opencv|c#|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15122" PostTypeId="1" CreationDate="2014-03-20T08:23:28.417" Score="1" ViewCount="671" Body="&lt;p&gt;I have a signal of length 'N' which looks like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[.......p-set...] [SINE-WAVE] [....q-set...]&#xA;&#xA;amplitude of points in p-set &amp;lt;&amp;lt; amplitude of points in sine-wave&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sometimes there are a few sparse points in p-set whose amplitude is comparable to sine-wave points. However, number of such points is much less than the length of the sine wave.&#xA;I want to find the beginning point of the sine-wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly I cannot use thersholding as those sparse points will be counted as the beginning of the sine-wave which is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any effective solution or existing functions? Sliding window may be? Please explain with some code (MATLAB). Due to firewall restrictions I cannot upload image. Sorry.&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="6940" LastEditDate="2014-03-20T08:31:31.930" LastActivityDate="2014-06-03T07:38:12.980" Title="Removing empty/low amplitude part from signal" Tags="|matlab|filters|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15125" PostTypeId="2" ParentId="13221" CreationDate="2014-03-20T16:38:14.650" Score="1" Body="&lt;p&gt;In seismic data processing the term phase is used/referred to differently in depending on the context. The answer from @tobassit is fundamentally correct but the way in which geoscientists and data processors refer to phase can cause some confusion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, in terms of early stage seismic processing, where raw signal/receiver data is processed, the term &quot;phase&quot; is can be used to refer to the degree of phase rotation in the seismic wavelet in a processed dataset. During the seismic processing workflow a deconvolution and phase correction step is normally applied and the &quot;phase&quot; of the data will be set as either &lt;a href=&quot;http://www.glossary.oilfield.slb.com/en/Terms.aspx?LookIn=term%20name&amp;amp;filter=zero-phase&quot; rel=&quot;nofollow&quot;&gt;zero phase or mixed phase&lt;/a&gt;. Understanding the &quot;phase&quot; of a seismic dataset is critical in its subsequent use as it affects the relationship between peaks-troughs in the data and underlying the reflectivity series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, in terms of post stack seismic data analysis, seismic traces are often represented by an &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal#Applications&quot; rel=&quot;nofollow&quot;&gt;Analytic Signal Model&lt;/a&gt; for the purposes of analysis and interpretation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The analytical seismic trace is created by computing the Hilbert Transform of the real trace to produce quadrature trace (90 degree phase shifted version). This together with the original provides a complex trace from which  number of useful quantities can be derived. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are known as the complex trace attributes and include Instantaneous Phase (see link on wikipedia page above for the Analytic Signal) which is often referred to as 'phase' by seismic interpreters. The phase attribute is useful due to its directly relationship to subsurface structure independent of reflection strength.&lt;/p&gt;&#xA;" OwnerUserId="8296" LastActivityDate="2014-03-20T16:38:14.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15126" PostTypeId="1" CreationDate="2014-03-20T18:39:55.517" Score="1" ViewCount="431" Body="&lt;p&gt;I have a 10-bit ADC with 8.5 bit ENOB. I have 2.5 quantization levels of thermal noise in front of the ADC. Is there a reason to process more than 8 bits from this ADC?&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-03-20T19:24:02.533" Title="Effect of rounding off ADC value" Tags="|analog-to-digital|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15127" PostTypeId="1" CreationDate="2014-03-20T19:18:56.503" Score="4" ViewCount="179" Body="&lt;p&gt;I wish that all those people on that flight were with us, and maybe they still are, as I like to think they are on an island somewhere waiting to us to find them ... however, it does not look good... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, a spy plane searching for possible remnants of Malaysian Flight 370 took this photo:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9s9hT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However they cannot tell what this is an image of, floating in the sea. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering, what image processing techniques might us in the DSP community utilize here to better ascertain / clean up the image so that we might be able to get a better picture? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The waves of the ocean would seem to contribute to high-frequency components, so perhaps nulling the high frequency fourier co-efficients in the 2D-FFT, and then inverse transforming? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What other techniques might we use? ... perhaps we can segment it while respecting shapes of big features?... &lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2014-06-27T19:25:25.333" Title="Malaysia Flight 370 Image Processing" Tags="|image-processing|filters|fourier-transform|lowpass-filter|image-segmentation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15128" PostTypeId="2" ParentId="15126" CreationDate="2014-03-20T19:24:02.533" Score="1" Body="&lt;p&gt;How wide is the word width of the processor receiving these 10-bit values from the A/D converter?  Wider than 8 bits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is there to gain by adding another layer of quantization error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have here is a highly dithered signal that is dithered naturally.  Sometimes in audio we actually go out of our way to dither a signal so that further processing and quantization is better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your processor is 8 bits wide and you absolutely do not want to do multi-byte arithmetic (with an Add-with-carry instruction) or do not have the computational bandwidth to do higher precision arithmetic, then perhaps it makes sense to quantize your noisy 10-bit value to an 8-bit value.  Otherwise it does not.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-03-20T19:24:02.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15129" PostTypeId="1" CreationDate="2014-03-20T19:45:02.403" Score="1" ViewCount="343" Body="&lt;p&gt;I have a problem right now to solve. I have a Gaussian peak, which I need to divide into three components (three Gaussian distribution). For those three component Gaussian distribution, I already know the mean and standard deviation, if I want to do this by using least squares, where should I start with in Matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8297" LastEditorUserId="8202" LastEditDate="2014-03-20T23:46:00.213" LastActivityDate="2014-06-19T01:50:55.693" Title="Using Least Squares for curve fitting in Matlab" Tags="|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15130" PostTypeId="1" CreationDate="2014-03-20T20:15:36.873" Score="2" ViewCount="3778" Body="&lt;p&gt;Bit of a long post, but this is a complex topic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to hash of a series of video files so that they can be quickly checked for duplication. I know that any amount of data can be reduced to a hash, but I'd like to do this in a way that is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Format independent, i.e. not a binary hash, but one based on what you see&lt;/li&gt;&#xA;&lt;li&gt;Resolution independent - aspect ratio notwithstanding&lt;/li&gt;&#xA;&lt;li&gt;Offset independent - this is the tricky part&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So far this is what I've got:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I use handbrake to extract still images from a video stream - this makes an FLV come out the same as an MP4&lt;/li&gt;&#xA;&lt;li&gt;I wrote some code that will blur (nearest neighbor) the image into a smaller one, e.g. 640x480 =&gt; 64x48. It then reduces the colors to a smaller palate. This eliminates minor differences in aspect ratio and small pixel differences due to different codecs/bitrates.&lt;/li&gt;&#xA;&lt;li&gt;Some more code that will hash that image into a 128-bit byte array. These can be stored in a database and compared very efficiently&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Where I'm really stuck is the offset. If video A and video B are the &quot;same&quot; video, but B is missing the first 2 seconds, or has additional minute/hour/etc. of footage, the whole thing is off; hashes either match or they don't. In fact, I might even have issues with my sampling rate in handbrake as I don't totally understand key-frames - I'm just taking X frames per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I'd like is some way to sample sections of the video, and store many hashes per video file, and if any hashes from A match any hashes from B, do further analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figure this must be possible because of the way SoundHound and Shazaam work on music. Does anyone have insight into this?&lt;/p&gt;&#xA;" OwnerUserId="8298" LastActivityDate="2014-03-20T21:25:35.963" Title="Hashing a video file" Tags="|video-processing|video|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15131" PostTypeId="2" ParentId="15129" CreationDate="2014-03-20T20:37:20.477" Score="0" Body="&lt;p&gt;For fitting multiple Gaussians to data you could take a look at EM algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/26184-em-algorithm-for-gaussian-mixture-model&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/26184-em-algorithm-for-gaussian-mixture-model&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-20T20:37:20.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15132" PostTypeId="2" ParentId="15129" CreationDate="2014-03-20T20:38:10.503" Score="1" Body="&lt;p&gt;1) Form a matrix, A of order $m$ x $3$, such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A=\left[f(x) \ \ g(x) \ \ h(x)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f(x), g(x)$ and $h(x)$ are three column vectors such that each column is a sample of component guassian at $x$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Form a column vector, $b$ of your original Gaussian pulse of order m.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Solve the system $x=((A'*A)^{-1}*A')*b$, where $x$ is your desired set of coefficients of order $3$ x $1$, that would minimize the error in the least square sense.&lt;/p&gt;&#xA;" OwnerUserId="5049" LastActivityDate="2014-03-20T20:38:10.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15133" PostTypeId="2" ParentId="15130" CreationDate="2014-03-20T21:25:35.963" Score="2" Body="&lt;p&gt;Extracting one single hash per video and expecting it to work for subsegment matching is unrealistic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach - which is the one used in audio identification systems but could be extended to video - is to extract many hashes, one for each small segment of content (say a few seconds of video). The matching process consists in matching your &quot;query&quot; sequence of hashes to the sequence of hashes extracted from your video. This is quite similar to a text indexing/retrieval problem, and traditional data structure for such problems (like inverted indices) would work. You can probably build your implementation on top of an existing text indexing system like Lucene/Solr. See for example, the &lt;a href=&quot;https://github.com/echonest/echoprint-server&quot; rel=&quot;nofollow&quot;&gt;echoprint server&lt;/a&gt; code, built on Solr.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This addresses the sequence aspect. Remains the problem of generating robust hashes for images. What you are doing is probably going to still be sensitive to minor differences in compression/resolution - You'll need a very rough quantization of a small number of DCT / wavelet coefficients for it to be robust.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-03-20T21:25:35.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15134" PostTypeId="1" AcceptedAnswerId="15144" CreationDate="2014-03-20T23:29:20.143" Score="1" ViewCount="573" Body="&lt;p&gt;I have an analog filter with its frequency response curve in dB described by the following expression:&#xA;$$&#xA;N_{dB}=20log_{10}\omega t_1 \sqrt{\frac{1+(\omega t_2)^2}{1+(\omega t_1)^2}}&#xA;$$&#xA;This expression is derived from the series connection of two lowpass filters each associated with the following RC circuit:&lt;br&gt;&#xA;&lt;img src=&quot;https://dl.dropboxusercontent.com/u/617319/3.jpg&quot; alt=&quot;RC Circuit&quot;&gt;&lt;br&gt;&#xA;where, for each circuit, the &lt;em&gt;time constant&lt;/em&gt; $t_i=RC$ and of course $\omega = 2\pi f$, where $f$ is the frequency (this is actually the equalization curve for magnetic tape recording/playback, see &lt;a href=&quot;http://www.richardhess.com/tape/history/NAB/NAB_Reel_Tape_Standard_1965_searchable.pdf&quot; rel=&quot;nofollow&quot;&gt;Annex B, page 14 of this document&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to obtain an approximation of this frequency response using a digital filter. I don't know if there is a method to exploit our knowledge of the analog frequency response or if I should design the filter myself from scratch.&#xA;The end goal is to obtain the impulse response and save it as a a .wav file (I know how to do this last part). I just took a basic DSP course at my Uni but we didn't work with analog filters so I am a little bit lost.&lt;/p&gt;&#xA;" OwnerUserId="8299" LastEditorUserId="3562" LastEditDate="2014-03-21T13:22:11.393" LastActivityDate="2019-05-18T12:39:20.470" Title="Approximate the magnitude response of an analog filter with a digital filter, starting from its gain expression" Tags="|matlab|filters|analog|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15135" PostTypeId="2" ParentId="15121" CreationDate="2014-03-20T23:59:18.070" Score="2" Body="&lt;p&gt;Histogram equalization is a global operation which can result in some areas being adversely effected at the cost of the rest of the image looking better. Consider using the Retinex algorithm. It works very well at improving both local and global contrast enhancement. There's a flurry of papers on this topic and the algorithm is somewhat straightforward to implement. The most challenging part is the selection of parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a &lt;a href=&quot;http://scholar.google.com/scholar?hl=en&amp;amp;q=retinex&amp;amp;btnG=&amp;amp;as_sdt=1,47&amp;amp;as_sdtp=&quot; rel=&quot;nofollow&quot;&gt;list&lt;/a&gt; of papers and here's &lt;a href=&quot;http://fias.uni-frankfurt.de/~triesch/courses/275vision/papers/multiscaleRetinex.pdf&quot; rel=&quot;nofollow&quot;&gt;one&lt;/a&gt; that's very useful.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-03-20T23:59:18.070" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15137" PostTypeId="1" CreationDate="2014-03-21T04:02:38.877" Score="1" ViewCount="684" Body="&lt;p&gt;I'm trying to find the count of horizontal columns in an ordered image (a sprite image that is used to generate an animated image):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LlMjs.png&quot; alt=&quot;Sprited dino&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this image, I'm trying to generate a meta-data file like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{ &#xA;&quot;frames&quot;: 12, &#xA;&quot;cols&quot;: 6, &#xA;&quot;width&quot;: 102, &#xA;&quot;height&quot;: 89&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Frames would be the total count of &quot;elements&quot; in the image, columns is the horizontal column count, and width/height is for the individual &quot;element&quot; and can be calculated, once you know the column count.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;What I Have Already&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I've been using numpy/scipy/python mainly since I am a Python guy, but not too experienced with scipy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2516/counting-the-number-of-groups-of-1s-in-a-boolean-map-of-numpy-array&quot;&gt;This answer&lt;/a&gt; showed me how to get the total count of elements in an image and got me this far ipython:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jybym.png&quot; alt=&quot;ipython count&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Where I'm Stuck&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;On most simple images, the ndimage.label works well, but once the image gets too dense, it seems to fall apart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried using a kind of line-by-line average of the file: subtract 1 horizontal line, get the ndimage.label count of total elements in the picture, then keeping subtract the whole image to build buckets and calc the average std deviation for the image; which would be the horizontal count. But this still isn't accurate on dense images like this: &lt;img src=&quot;https://i.stack.imgur.com/XyYt2.png&quot; alt=&quot;http://asktherelic.com/priv/npc_bundle_of_joy__x1_talk_png_1354839566.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would anyone have suggestions for a better algorithm or counting method?&#xA;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For ease of hacking I have a zip with the ipython notebook and sample images available here: &lt;a href=&quot;http://asktherelic.com/priv/sprite_sample.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://asktherelic.com/priv/sprite_sample.zip&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it looks something like this currently: &#xA;&lt;a href=&quot;http://asktherelic.com/priv/sprite_sample.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://asktherelic.com/priv/sprite_sample.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8301" LastEditorUserId="13320" LastEditDate="2017-04-17T17:47:06.600" LastActivityDate="2017-04-17T17:47:06.600" Title="Finding horizontal count of items in an image" Tags="|python|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15138" PostTypeId="1" CreationDate="2014-03-21T04:14:02.400" Score="0" ViewCount="195" Body="&lt;p&gt;Is it possible to find time delay of arrival using demodulated signals (of bandwidth ~200hz)? I have a setup in which I receive (multiple receivers, of course) modulated signal from a source. I want to find the angle of arrival of the signal. The signal is amplitude modulated. Due to hardware limitations, cross correlation of the raw data is not yielding good results. So I want to demodulate the signal, and then perform cross correlation using the demodulated ones. Will it yield good results? I googled it a bit and I can only find correlation calculations being done on the raw data. I was wondering that the raw data would consist of lot of noise and interference. So why not demodulate the data and then find cross correlation at least when the signals are analog modulated?&lt;/p&gt;&#xA;" OwnerUserId="6940" LastActivityDate="2014-03-21T04:14:02.400" Title="TDOA using demodulated signal" Tags="|signal-analysis|modulation|demodulation|time-frequency|delay|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15139" PostTypeId="2" ParentId="15134" CreationDate="2014-03-21T04:34:26.490" Score="0" Body="&lt;p&gt;Did you try to plot this curve in matlab.&#xA;I am not sure whether it is any standard high,low or band pass filter.&#xA;So, to calculate the impulse response there might be two ways.&#xA;1. take the inversefft of the NdB and then do the convolution between your impulse input and the inversefft signal of filter usinc conv(x,y) command.&#xA;2. Or convert the impulse input into frequency domain by fft transform in matlab and then just multiply the gain and fft of input impulse and then convert them in time domain.&#xA;Can you do it using above method? &#xA;Do you want a matlab code for this method?&lt;/p&gt;&#xA;" OwnerUserId="8302" LastActivityDate="2014-03-21T04:34:26.490" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15140" PostTypeId="1" CreationDate="2014-03-21T05:27:47.377" Score="3" ViewCount="515" Body="&lt;p&gt;I am sending 6.6Vpp square wave across a narrow-band, 40 kHz Transmitter to a narrow-band, 40 kHz Receiver. I want to find a very accurate distance between the two (sub millimeter). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My assumption so far is that if I can get very consistent results at a fixed distance, that I can calibrate the speed of sound and an offset error time to get consistent results (and absolute, not just relative) at a bunch of different results.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I've tried 3 different signal processing methods and none of them are yielding the perfect results I'm looking for. I'm sampling at 500 kHz.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Threshold method: I transmit 10-20 periods, and then look for the received waveform to pass a given threshold, then I take this sample to be the TOF. Obviously if there is noise, there is going to be some error, so its understandable why this doesn't work.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;BFSK method: I transmit 50 periods at 41 kHZ, 20 periods to linearly transition to 39 kHz, and then 50 periods at 39 kHz. I receive the waveform, and use a zero detection algorithm, then detect instantaneous frequency. When I detect the frequency crossing at 40 kHz, I use this to determine TOF. This is my most accurate method. But I come across a strange error: sometimes I get all of my results with precision all within 0.5mm (500 trials), but othertimes I run this code, I get a BUNCH of errors, like 50% of the errors are greater than 5 mm. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Cross correlation method: I store a previous received signal that was taken at a known distance in memory, then I correlate my received signal to this result. My correlation only uses 4-5 periods on each side of the peak of the trial signal to reduce the computation time of the correlation. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any recommendations on real-time, robust, sub-mm signal processing methods for ultrasound rangefinding? &lt;/p&gt;&#xA;" OwnerUserId="8304" LastActivityDate="2014-03-21T13:33:13.667" Title="Ultrasound Signal Processing Methods" Tags="|cross-correlation|real-time|ultrasound|analog-to-digital|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15141" PostTypeId="2" ParentId="15112" CreationDate="2014-03-21T07:47:11.823" Score="1" Body="&lt;p&gt;Let's try to sort of answer this from the BLWDF point of view (without much of the WDF-theory, since this can to a large extent be skipped as you know which structure you want).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting from a second-order BLWDF allpass section (based on symmetric two-port adaptors without any negations in the feedback), the transfer function is&#xA;$$\frac{z^{-2}-a}{1-a z^{-2}} = \frac{1-a z^2}{z^2-a},$$&#xA;where $a$ is the adaptor coefficient (assuming the input connected to the negative side of the subtractor is the input). This has roots in $z=\pm \sqrt{a}$. Hence, the poles can be either on the real or imaginary axis in the $z$-domain. Typically, you would like to map them to the imaginary axis. This clearly hold for the standard approximations such as Cauer/Elliptic filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, one approach is to design your filter directly in the $z$-domain, making sure that the poles end up on the imagniary axis and then take every other pole pair and position in every other branch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you mention, for this to happen, you need a anti-symmetric power complementary filter, so it should meet Feldtkeller's equation&#xA;$$ |H(e^{-j\omega})|^2 + |H_C(e^{j\omega})|^2 = 1,$$&#xA;where $H_C$ is the complementary filter (in the case of parallel allpass filters the sum/difference if the original filter is obtained by subtracting/adding the branches). This gives that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(1-\delta_c)^2 + \delta_s^2 = 1 \Rightarrow \delta_s^2 = 2\delta_c - \delta_c^2 \approx 2\delta_c \Rightarrow \delta_C \approx \frac{\delta_s^2}{2},$$&#xA;where $\delta_c$ and $\delta_s$ are the passband and stopband ripples, respectively, leading to $A_p = -20 \log_{10} (1-\delta_c) $ and $A_s = -20 \log_{10} (\delta_s)$.&#xA;In addition, the passband and stopband edges should be related as $\omega_c = \pi - \omega_s$. However, the trick here is to know exactly how to select your specification so that you get a specification without any over design. If you manage that, you are home.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same type of problem arises when you go from an analog filter. You need to have a filter, such that the specification become a spec which can be mapped to a BLWDF. Now, the relation is quite straightforward to compute, but you will need to find a spec where all four parameters (passband/stopband ripple/edge) results in an odd order filter without any over design. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While LWDF (and all filters constructed of the allpass branches in parallel) are very sensitive to coefficient quantization, the quantized results in your first comparison figure are really better since they come from a mini-max solution and are not quantized that hard. Your values are, as you've noticed, probably not computed the right way. I tend to believe the reason being that your analog filter is over designed in one way or the other, leading to that it is not actually suitable for a BLWDF, but rather an LWDF, i.e., the poles do not end up exactly on the imaginary axis after the transform. Reading your text again, I think I can confirm that this is the reason: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The order is calculated based on these four parameters, which will result in a stop-band attenuation optimization, rather than a transition-band or a pass-band optimization. I say this because I don't know what approach Barbara Dai has.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Hence, you need to adjust the specification such that there are no &quot;optimization&quot; in the design process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can extend the answer where required, but please point out where it is needed (I will, e.g., not go into the bi-linear transform for time constraint reasons right now).&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2014-03-21T07:55:09.693" LastActivityDate="2014-03-21T07:55:09.693" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15142" PostTypeId="2" ParentId="15121" CreationDate="2014-03-21T08:19:51.603" Score="1" Body="&lt;p&gt;You can perform histogram equalization on blocks inside the image. Overlapping blocks (and result averaging in the overlap areas) could help in reducing the subsequent block artifacts. &lt;a href=&quot;http://szeliski.org/Book/&quot; rel=&quot;nofollow&quot;&gt;R. Szeliski's book&lt;/a&gt; has some explanation of this local equalization algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possibility is to model the hotspot in the middle as a kind of Gaussian spot, then output the final result as the weighted mean between the original and equalized image. The weights should be given in each pixel by the value of this Gaussian spot. This is a crude model but that could give interesting results here.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-03-21T08:19:51.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15143" PostTypeId="1" CreationDate="2014-03-21T09:07:58.737" Score="3" ViewCount="173" Body="&lt;p&gt;I have many close-range images of a single wind turbine blade (taken from different positions, same angle):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SCwsE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to separate the blade image from background like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tO4So.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem arises in image alignment application where the blade image moves about large amount while the background does not (parallax effect). The backgroud also consists of more pixels so it is prefered for alignment while the blade is discarded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem is that the blade surface is very smooth and there are few to none interest points to detect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it for example possible to detect one or more curves to isolate boundary of the blades and then possibly align the curves instead of interest points?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to use graph cut to extract the precise edge and convert it to spline curve - however, how to align such curves? Maybe 3D surfaces based on intensity data can be aligned rather than 2D curves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any more ideas?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2014-03-21T09:47:05.470" LastActivityDate="2014-03-21T09:47:05.470" Title="Detecting blades of a wind turbine" Tags="|edge-detection|image-registration|background-subtraction|stitching|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15144" PostTypeId="2" ParentId="15134" CreationDate="2014-03-21T10:41:37.483" Score="0" Body="&lt;p&gt;From the given magnitude response (and from what is written in the document), the transfer function of your system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(s)=\frac{st_1(1+st_2)}{1+st_1}\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this system is not stable. I suppose that this response is only to be approximated in a certain frequency range, which means that a stable filter can approximate this transfer function well enough in that frequency range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several methods for transforming an analog transfer function to the digital domain. You could use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;bilinear transform&lt;/a&gt;, which will give you a recursive digital filter. This filter will have a pole at &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt; (i.e. it will not be stable), but you could move this pole away from the unit circle (e.g. to &lt;span class=&quot;math-container&quot;&gt;$z=-.98$&lt;/span&gt;, just try a few values), and this will probably result in a useful system. Another method is frequency sampling. You replace &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; in (1) by &lt;span class=&quot;math-container&quot;&gt;$j\omega$&lt;/span&gt; and evaluate &lt;span class=&quot;math-container&quot;&gt;$H(j\omega)$&lt;/span&gt; on an equidistant frequency grid in the range &lt;span class=&quot;math-container&quot;&gt;$[0,f_s/2]$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$f_s$&lt;/span&gt; is your sampling frequency. Then you extend your desired frequency response to the range &lt;span class=&quot;math-container&quot;&gt;$[0, f_s]$&lt;/span&gt; by taking the conjugate symmetry property of the DFT into account. Then you simply obtain the impulse response by applying an inverse FFT to the desired frequency response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2019-05-18T12:39:20.470" LastActivityDate="2019-05-18T12:39:20.470" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="15145" PostTypeId="1" CreationDate="2014-03-21T10:50:42.900" Score="0" ViewCount="551" Body="&lt;p&gt;I've started to implement an MFCC algorithm on an embedded DSP, using the CMSIS DSP library. However the results I'm getting don't appear consistent. This is my algorithm so far: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Gather 32ms PCM sample from microphone, 512 samples long. 16000hz&lt;/li&gt;&#xA;&lt;li&gt;Apply a Hamming window.&lt;/li&gt;&#xA;&lt;li&gt;Compute the 512 FFT using &lt;a href=&quot;http://www.keil.com/pack/doc/CMSIS/DSP/html/group___real_f_f_t.html#ga00e615f5db21736ad5b27fb6146f3fc5&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Compute the magnitudes to get power spectrum.&lt;/li&gt;&#xA;&lt;li&gt;Generate a set of 30 filter banks - using 32 points on the mel spectrum&lt;/li&gt;&#xA;&lt;li&gt;Convert my power spectrum magnitudes from 16bit ints to floats.&lt;/li&gt;&#xA;&lt;li&gt;Get the dot product for each filter with the power spectrum.&lt;/li&gt;&#xA;&lt;li&gt;Log each dot product.&lt;/li&gt;&#xA;&lt;li&gt;This is the uncertain part. The DSP library I'm using only has DCT IV, and this only supports sizes 128 and up. My set of logs is 32. So I've opted to use a &lt;a href=&quot;http://www.keil.com/pack/doc/CMSIS/DSP/html/group___fast.html&quot; rel=&quot;nofollow&quot;&gt;Real FFT&lt;/a&gt; function, the results I get from this vary quite a lot. If I speak the same word in the same tone. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Could this be what is hampering my result? Real FFT provides an output of both real, complex and conjugate data (described in link above) - which would I use for the MFCC? - Should I even expect my MFCCs to be similar or is it expected to vary a lot? My results tend to vary between -20.0 and 20.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8288" LastEditorUserId="8288" LastEditDate="2014-03-21T10:56:27.447" LastActivityDate="2014-03-21T11:30:06.423" Title="MFCC, uncertain of my results and algorithm" Tags="|fft|mfcc|arm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15146" PostTypeId="2" ParentId="15145" CreationDate="2014-03-21T11:30:06.423" Score="2" Body="&lt;p&gt;For the computation of MFCC's you usually use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-II&quot; rel=&quot;nofollow&quot;&gt;DCT-II&lt;/a&gt;. Just implement it yourself if you can't find a proper implementation anywhere. You only have relatively few log spectral values, and probably even fewer DCT coefficients that you will use, so I hope that computational complexity will be no big issue. &lt;a href=&quot;http://www.cic.unb.br/~lamar/te073/Aulas/mfcc.pdf&quot; rel=&quot;nofollow&quot;&gt;This document&lt;/a&gt; is a nice overview of all the steps necessary for obtaining MFCC's.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-21T11:30:06.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15147" PostTypeId="2" ParentId="15137" CreationDate="2014-03-21T13:04:13.860" Score="1" Body="&lt;p&gt;Using any image processing library, here is the simple step&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Threshold invert  with high value will give you each object as a contour.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now process each contour and find centre of mass.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then sort contour by co-ordinates.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4799" LastActivityDate="2014-03-21T13:04:13.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15148" PostTypeId="1" CreationDate="2014-03-21T13:11:43.810" Score="2" ViewCount="9282" Body="&lt;p&gt;I have a question related to wavelet transform: we know that while the Fourier transform is  good for a spectral analysis or which frequency components occurred in signal, it will not give information about at which time it happens. That's why the wavelet transform is suitable for the time-frequency analysis. It is also good for signal denoising, but of course it has some disadvantages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would like to know what are main advantages of the wavelet transform? Is it good for spectral estimation; like finding amplitudes, frequencies and phases, or it just helps us to find discontinuous and irregularities of a signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="8202" LastEditDate="2015-08-30T19:13:42.167" LastActivityDate="2016-05-04T13:19:08.077" Title="Disadvantages of wavelet transform" Tags="|discrete-signals|fourier-transform|wavelet|continuous-signals|fourier-series|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15149" PostTypeId="2" ParentId="15140" CreationDate="2014-03-21T13:33:13.667" Score="3" Body="&lt;p&gt;Cross correlation should work.  I think the problem is the waveform that you are using.  A square wave has bad auto-correlation properties.  If it is a periodic square wave it will have multiple peaks.  It sounds like you are just using a single pulse which is better, but it will still have a gradual roll-off which is a problem.  Instead, use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Barker_code&quot; rel=&quot;nofollow&quot;&gt;Barker code&lt;/a&gt;, which will give you a nice sharp peak and very low side peaks.  I would BPSK modulate the barker code and then cross correlate what you receive with the &quot;ideal&quot; signal.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-21T13:33:13.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15150" PostTypeId="1" CreationDate="2014-03-21T13:42:18.633" Score="0" ViewCount="1324" Body="&lt;p&gt;I have a set of audio files which contain a word each one, and I'd want to be able to compare a new word (coming from a smartphone mic) to &lt;strong&gt;check &lt;em&gt;if&lt;/em&gt; it resembles to a specific file&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;how much&lt;/em&gt; it resembles to that audio file&lt;/strong&gt;. I &lt;strong&gt;don't need to know which word it is&lt;/strong&gt;, or doing a STT system, actually, just checking how similar two words are. The &lt;strong&gt;words may come from different speakers&lt;/strong&gt;, male, female, old people, kids, even non-speakers for a specific language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the question is, which should be the processes to do something quite simple? I've been reading about MFCC, DTW and I can ensure I understand little to nothing about how I should proceed. I'd need to create an algorithm to match those words, but I have not a single clue on how to proceed after the &quot;Conception steps&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have, however, tried an Android library called &lt;a href=&quot;https://code.google.com/p/musicg/&quot; rel=&quot;nofollow&quot;&gt;Musicg&lt;/a&gt;, which should compare sounds based on:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A frequency range for the whole sound&lt;/li&gt;&#xA;&lt;li&gt;An intensity range for the whole sound&lt;/li&gt;&#xA;&lt;li&gt;A standard deviation range (yes, for the whole sound)&lt;/li&gt;&#xA;&lt;li&gt;A High pass and low pass limits&lt;/li&gt;&#xA;&lt;li&gt;Range of times the sound crosses the &quot;zero&quot; line&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But I am pretty sure this might not be enough to make sure two sounds are similar or different. The examples they handle are only onomatopoeii, (for those who code, here's an example to detect &lt;a href=&quot;https://code.google.com/p/musicg/source/browse/src/com/musicg/api/ClapApi.java&quot; rel=&quot;nofollow&quot;&gt;Claps&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the question. &lt;strong&gt;Is there a magic algorithm that does all the heavy work of comparing two audios from different speakers that is able to give a similarity score?&lt;/strong&gt; If so, can you put me back to the tracks with a simple (well, as simple as it can be, of course) example, please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus track: &lt;strong&gt;Is any of the algorithms able to do the processing with precomputed values from the set of audio files?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8308" LastActivityDate="2014-03-21T16:15:04.863" Title="Compare two words from different speakers" Tags="|signal-analysis|speech-recognition|voice|mfcc|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15151" PostTypeId="1" CreationDate="2014-02-15T18:18:53.363" Score="1" ViewCount="868" Body="&lt;p&gt;I have a problem with a FFT analysis in MATLAB, which is probably related to my limited understanding of the fundamentals of Fourier analysis. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I use MATLAB’s built-in  fft analysis function.  &lt;/li&gt;&#xA;&lt;li&gt;The sampling frequency is 48000Hz The samples signal is a fairly clean sinus at 3000Hz (se below)&lt;/li&gt;&#xA;&lt;li&gt;I use a flat top windowing.  &lt;/li&gt;&#xA;&lt;li&gt;I sample two voltage signals and use them to calculate the impedance of a device under test.&#xA;An example of time data fed into the fft function, after windowing, is presented below&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mliF2.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I increases the sampling time from shorter to a longer times, e.g.  0.5sec to 1sec, I get incorrect impedance results (e.g. negative resistance). Intuitively I would assume that longer sampling times would increase the accuracy. &#xA;I have tracked the difference between the two different sample times to a change of the sign of the imaginary part of the discrete Fourier transform output for the 3000Hz-frequency bin. I do not know if this can be related to the incorrect results. &#xA;For the shorter sampling time the imaginary part of the DFT is negative, se left figure below. And for the longer sampling time the imaginary part of the DFT is positive, se right figure below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kyuqa.gif&quot; alt=&quot;http://i.imgur.com/VOSPNgw.gif&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am grateful for any ideas of what might be causing this issue? I’m also happy to provide additional information if needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind regards, &#xA;Johan&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit:&#xA;My code is quite long, but below I have attached a code extract which I think is most relevant to the problem. I have not written all this code myself, but the author is unfortunately not available to me for questions. Generally this code have worked very well for a long time, the issue described in my original post is the only time that I have ever seen a problem.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% stSet.freq is the excitation frequency&#xA;% TH is the time data matrix&#xA;&#xA;[Gij, freq, spec] = specDens(TH(inx,2:end), measData.Fs, blockSize, windowFcn, nOverlap, nFFT); &#xA;inxHD = ([1:nHarmonics].*stSet.freq)./spec.x(2)+1; %% Defining indicies for HD components&#xA;inxHD = inxHD(inxHD&amp;lt;nFFT/2-1);%% Taking only HD components &amp;lt; Fs/2&#xA;&#xA;% I = U2/R&#xA;% U = (U1-U2)&#xA;% Hiu = U/I = (U1-U2)/U2*R (electrical impedance)&#xA;&#xA;% Gij      - cross- and autopower spectral density functions &#xA;&#xA;% Channels&#xA;ch_U1   = 1; % Ch.#1 - U1&#xA;ch_U2   = 2; % Ch.#2 - U2&#xA;R = 1.; % Resistance of measurement resistor&#xA;&#xA;H.iu    = (Gij(inxHD,ch_U1,ch_U1) - Gij(inxHD,ch_U2,ch_U1)) ./ Gij(inxHD,ch_U2,ch_U1)*R; % Electrical impedance&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Subfunction: specDens&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [Gij, freq, spec] = specDens(TH, Fs, blockSize, windowFcn, nOverlap, nFFT)&#xA;%&#xA;% Syntax:&#xA;% [Gij, freq, spec] = specDensRE2(TH, Fs, blockSize, windowFcn, nOverlap, nFFT)&#xA;%&#xA;% MATLAB function for computing cross- and autopower spectral density functions from continous signal measurements&#xA;%&#xA;%  __Outputs__&#xA;%   Gij      - cross- and autopower spectral density functions&#xA;%   freq     - frequency vector&#xA;%   spec     - Single sided linear spectrum&#xA;%&#xA;%  __Inputs__&#xA;%   TH        - measured signal, [m, n] = size(TH), m = No of samples, n = No of channels&#xA;%   Fs        - sampling frequency&#xA;%   blockSize - Block size&#xA;%   windowFcn - user defined window,  no input =&amp;gt; Hanning&#xA;%   nOverlap  - user defined overlap, no input =&amp;gt; nOverlap &amp;lt;=&amp;gt; 75%&#xA;%   nFFT      - Number of fft points&#xA;&#xA;&#xA;if(nargin&amp;lt;6); &#xA;    nFFT = blockSize; end;&#xA;&#xA;if(nargin&amp;lt;5); &#xA;    nOverlap = round(blockSize*.75); end;&#xA;&#xA;if(nargin&amp;lt;4); &#xA;    [windowFcn, windowLSS] = window_re(blockSize,'Hanning'); end;&#xA;&#xA;if(ischar(windowFcn)); %% assuming windowFcn is defining window type&#xA;    [windowFcn, windowLSS] = window_re(blockSize,windowFcn); end;&#xA;&#xA;&#xA;[nSamples, nCh] = size(TH); %% nSamples=No of samples, nCh=No of channels&#xA;if(nSamples&amp;lt;nCh);&#xA;    disp('Assuming input data transposed.');&#xA;    TH = TH.';&#xA;    [nSamples, nCh] = size(TH); %% nSamples=No of samples, nCh=No of channels&#xA;end&#xA;&#xA;nAvg        = fix((nSamples-nOverlap)/(blockSize-nOverlap));&#xA;nLost       = mod((nSamples-nOverlap),(blockSize-nOverlap));&#xA;windowFcn   = windowFcn(:);                             %% making sure windowFcn is a column vector&#xA;Gij         = zeros(nFFT,nCh,nCh);                      %% cross- and autopower spectral density functions&#xA;scaleFactor = (nFFT/blockSize)*nAvg*sum(windowFcn)^2;   %% quad. normalising scale factor&#xA;freq        = [0:(nFFT-1)]'*Fs/nFFT;                    %% frequency vector&#xA;tmp         = zeros(nFFT,nCh);&#xA;&#xA;% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %&#xA;% % % CROSS- AND POWER SPECTRA&#xA;% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %&#xA;inxSelect = [1:blockSize];&#xA;%disp(['Calculating spectral density functions, nAvg = ' int2str(nAvg) ', nLost = ' int2str(nLost)]);&#xA;for loop=1:nAvg&#xA;    tmp = TH(inxSelect,:)-repmat(mean(TH(inxSelect,:)),blockSize,1); %% Removing BIAS&#xA;    %tmp = detrend(TH(inxSelect,:));     %% select a block and de-trend&#xA;&#xA;    tmp = tmp.*repmat(windowFcn,1,nCh);  %% apply window to signal(s)&#xA;    tmp = fft(tmp,nFFT);                 %% FFT &#xA;    for ii = 1:nCh&#xA;        for jj = ii:nCh&#xA;            Gij(:,ii,jj) = Gij(:,ii,jj) + tmp(:,ii).*conj(tmp(:,jj));&#xA;        end&#xA;    end&#xA;    inxSelect = inxSelect + round(blockSize-nOverlap);&#xA;end&#xA;for ii = 1:nCh&#xA;    for jj = (ii+1):nCh&#xA;        Gij(:,jj,ii) = conj(Gij(:,ii,jj));&#xA;    end&#xA;end&#xA;Gij = Gij/scaleFactor;&#xA;&#xA;&#xA;% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %&#xA;% % % IF NUMBER OF OUTPUT ARGUMENTS &amp;gt; 2&#xA;% % %    =&amp;gt; OUTPUT SINGLE SIDED AMPLITUDE SPECTRUM&#xA;% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %&#xA;if(nargout&amp;gt;2);&#xA;    % % Selecting single sided spectrum (assuming real signal)&#xA;    if(rem(nFFT,2)==1);    % nFFT odd&#xA;        inx = [1:(nFFT+1)/2]';&#xA;    else&#xA;        inx = [1:nFFT/2+1]';&#xA;    end&#xA;    spec.x  = freq(inx);       %% frequency vector&#xA;    spec.y  = zeros(length(inx),nCh);&#xA;    for ii=1 : nCh&#xA;        spec.y(:,ii)=sqrt(Gij(inx,ii,ii)*2);&#xA;    end&#xA;&#xA;    %% PSD&#xA;    % PSD       = (Gij(inx,ii,ii)*2)/df/windowLSS; %% needs window LSS to calc from AP &#xA;    % PSD       = spec.y .^2/df/windowLSS;        &#xA;    % RMS_PSD   = sqrt(df*sum(PSD));  &#xA;&#xA;    spec.Fs        = Fs;    &#xA;    spec.nFFT      = nFFT;&#xA;    spec.RMSinfo   = char('RMS(time) = sqrt(mean(abs(x).^2))','RMS(spec) = sqrt(sum(spec.y.^2)/windowLSS)','NOK for signals with BIAS ~= 0');&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7913" OwnerDisplayName="JohanGustafsson" LastActivityDate="2014-07-19T16:11:30.377" Title="FFT analysis of longer data sets" Tags="|matlab|fft|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15152" PostTypeId="2" ParentId="15151" CreationDate="2014-02-15T19:30:13.207" Score="-1" Body="&lt;p&gt;actually decreasing sampling frequency may create the aliasing effect (sampled signal will be distorted and nothing similar to the original one) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Aliasing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if You want to properly sample Your signal use Nyquist - Shannon theory, which states that sampling frequency should be at least twice the signal frequency (it was proven that twice is enough and further increasing sampling rate does not gives better results)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thus Your sampling rate should be at least 6000Hz (sampling frequency of the sinus signal) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;could You also provide the matlab code You used in this?&lt;/p&gt;&#xA;" OwnerDisplayName="akfaz" LastActivityDate="2014-02-15T19:30:13.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15153" PostTypeId="2" ParentId="15150" CreationDate="2014-03-21T14:35:31.197" Score="1" Body="&lt;p&gt;What you want to do is by no means simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The devil is in the word &quot;resemble&quot;. Resemble according to which propoerty of sound? Pronounced phonemes? Prosody? There are languages in which variations in the pronunciation in such or such phoneme are tolerated - while in other language these might be different phonemes. Pitch has little importance in some languages, moderate importance in some others (stress patterns), and is essential in a tone language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you don't care about prosody and only phonemes, the simplest thing that could possibly work reliably would be the DTW of MFCCs, with one sequence of MFCC multiplied by the matrix that yields the smaller overall distance (as a form of vocal tract-length normalization).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-03-21T14:35:31.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15154" PostTypeId="1" AcceptedAnswerId="15161" CreationDate="2014-03-21T16:10:42.810" Score="0" ViewCount="604" Body="&lt;p&gt;I am trying to make filters like &lt;code&gt;sepia filter&lt;/code&gt; in my app like other photo editing applications , till now I don't have any idea about it , Can any one help me out for it about its algorithms and how to do it ? and Can I implement in opencv using native c++ or we have any of its build in functions ?&lt;/p&gt;&#xA;" OwnerUserId="5057" LastActivityDate="2014-03-21T19:24:50.813" Title="How to make filters?" Tags="|filters|computer-vision|image-processing|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15155" PostTypeId="2" ParentId="15150" CreationDate="2014-03-21T16:15:04.863" Score="2" Body="&lt;p&gt;There is no (known) magic solution, as the sound of the same word from very different speakers are often not actually similar to one another in term of any simple characteristics such as you list (frequency range, intensity range, pitch, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To often, humans can only guess at what word is said from an unknown speaker based on context.  And you don't have that with single word recordings.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-21T16:15:04.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15156" PostTypeId="2" ParentId="15064" CreationDate="2014-03-21T16:23:56.690" Score="1" Body="&lt;p&gt;I find what you are saying really hard to understand. Let me try to decode it. Let me know if my decoding is correct.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Say you have a bandpass filter and you place it on 40 discretely sampled points from a sinusoid with a period of 40.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This makes little sense.  What I think you mean is: I have a filter with impulse response $h(n)$ that I am going to apply to a sinusoidal signal of length 40 samples.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is the bandpass filter (green curve on the image) only &quot;in phase&quot; with the sinusoid if you use a window length (impulse response length) for the filter of 1/4th the period of the sinusoid (here 40/4=10)? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again, I'm finding it hard to fathom what you mean, but I interpret this as: If my impulse response $h(t)$ is of length 10 samples, then the output of my filter is a sinusoid that is in phase with the input.  When I use an impulse response of a different length (9 or 11) then the phase is incorrect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a start, your filter output will not generally have precisely the same phase as the filter input.  If your filter is a linear phase FIR filter, then as @MattL says, the filter will hvae a group delay of $(N-1)/2$ samples --- 4.5 samples in the case of a  length 10 filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to reproduce your diagram (&lt;code&gt;scilab&lt;/code&gt; code below) shows this effect: the green plot is the original, the red plot is the output of a length 9 filter (which has a delay of 4 samples), the black plot is the output of a length 10 filter (delay 4.5), and the blue is the output for a length 11 filter (delay of 5).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JgIes.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;CODE BELOW&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;P = 40;&#xA;x = sin(2*%pi*[0:79]/P)&#xA;&#xA;h10 = ones(1,10)/10;&#xA;h09 = ones(1,9)/9;&#xA;h11 = ones(1,11)/11;&#xA;&#xA;y09 = filter(h09,1,x);&#xA;y10 = filter(h10,1,x);&#xA;y11 = filter(h11,1,x);&#xA;&#xA;clf;&#xA;plot(x,'g');&#xA;plot(y10,'k');&#xA;plot(y09,'r');&#xA;plot(y11,'b');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-03-21T16:23:56.690" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="15157" PostTypeId="1" CreationDate="2014-03-21T18:12:49.973" Score="1" ViewCount="2381" Body="&lt;p&gt;I have some code that collects amplitudes from a complex sound like a song. I now want to plot a graph of amplitude vs time, for the graph plotting I use JavaFX. However I get about 9 million amplitude shorts for each channel, so how to I select a few samples to plot (as plotting 9 million points is obviously out of the question)? Do I need to use the sample rate or sample size? Is there a particular way I should go about this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Is this post more suited for StackOverflow?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AudioInputStream in = AudioSystem.getAudioInputStream(file);&#xA;AudioInputStream din = null;&#xA; AudioFormat baseFormat = in.getFormat();&#xA;  AudioFormat decodedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,&#xA;  baseFormat.getSampleRate(), //sample rate&#xA;  16,                         //sample size (bits)&#xA;  baseFormat.getChannels(),   //channels&#xA;  baseFormat.getChannels() * 2,//frame size&#xA;  baseFormat.getSampleRate(), //frame rate&#xA;  false);                     //little-endian&#xA;  din = AudioSystem.getAudioInputStream(decodedFormat, in);&#xA;  byte[] temp = new byte[4];&#xA;&#xA;  //....&#xA;  //leftDos and rightDos are streams of shorts&#xA;  //....&#xA;&#xA;  int i = 0;&#xA;  while (din.read(temp, 0, 4) != -1) {&#xA;      if (decodedFormat.getChannels() == 2) {&#xA;          leftDos.writeShort(temp[1] * 256 + temp[0]);&#xA;          rightDos.writeShort(temp[3] * 256 + temp[2]);&#xA;          i++;&#xA;      }&#xA;  }&#xA;&#xA; //...retrieve shorts...//&#xA; short[] left = new short[(bytes.length / 2)];&#xA;&#xA; int len = 0;&#xA; try {&#xA;     while (1 &amp;gt; 0) {&#xA;         left[len] = leftDIS.readShort();&#xA;         len++;&#xA;     }&#xA; } catch (EOFException e) {&#xA;      System.err.println(&quot;End of stream&quot;);&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8312" LastActivityDate="2014-03-21T18:25:28.860" Title="Java amplitude processing" Tags="|audio|sampling|amplitude|java|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15158" PostTypeId="2" ParentId="15157" CreationDate="2014-03-21T18:25:28.860" Score="2" Body="&lt;p&gt;There are a number of ways to do this, but I like this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// very rough pseudocode&#xA;step_size = 9000000 / width_of_window;  // 9000000 or however many points&#xA;for each pixel in width of window&#xA;  figure out what portion of the audio stream this x value corresponds to&#xA;  take step_size shorts corresponding to position in audio stream&#xA;  find the minimum and maximum values in that portion of the stream&#xA;  draw a vertical line at the current x value with position and length corresponding&#xA;      to the min and max values you found&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So basically you're displaying the min and max values of successive portions of the stream in each column of your draw box, or canvas, or whatever you're using.&lt;/p&gt;&#xA;" OwnerUserId="7883" LastActivityDate="2014-03-21T18:25:28.860" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15160" PostTypeId="1" CreationDate="2014-03-21T19:24:32.217" Score="1" ViewCount="235" Body="&lt;p&gt;I looked over the other entries regarding peak detection and none seem to answer my question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with Fourier spectra of digitized audio that can't be measured again. There are no constraints on the nature of the audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding outliers is easy. I'm worried about &quot;fat&quot; peaks whose contours might be made jagged by background noise. Their &quot;summits&quot; are peaks among peaks. So how salient and separate does a peak need to be in order to qualify?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a statistical way of approaching the problem? I could do something ad hoc, but without firm theoretical grounding, I rely much more on testing to confirm the algorithm's robustness. I'd like to know theoretically, rather than empirically, that my algorithm is sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, for those who have read this far, is there a good corpus of audio test data I can use for analysis algorithms?&lt;/p&gt;&#xA;" OwnerUserId="7883" LastActivityDate="2014-03-21T19:24:32.217" Title="Yet Another Peak Detection Request" Tags="|frequency-spectrum|signal-analysis|statistics|peak-detection|" AnswerCount="0" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="15161" PostTypeId="2" ParentId="15154" CreationDate="2014-03-21T19:24:50.813" Score="1" Body="&lt;p&gt;You can look at implementations for open source image editing programs (e.g. GIMP). This &lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc163866.aspx&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; from MSDN Magazine, January 2005 by Stephen Toub, entitled &quot;Sepia Tone, StringLogicalComparer, and More&quot; in the .NET matters section specifies a linear transformation of the color space to get a Sepia effect: &quot;New Red = R*.393 + G*.769 + B*.189 New Green = R*.349 + G*.686 + B*.168 New Blue = R*.272 + G*.534 + B*.131&quot; where each channel is normalized to lie in $[0,1]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its just applying the formula on each pixel, so you don't need any special libraries.&lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-03-21T19:24:50.813" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15162" PostTypeId="1" CreationDate="2014-03-21T20:09:16.187" Score="1" ViewCount="945" Body="&lt;p&gt;Say we have a sampled signal for which the inputs can be out of range. For instance, say a sampled sensor has a range of 0 to 1, and is presented with a time-varying stimulus where a peak occurs with max amplitude 1.2. In the data we would see a saturated or clipped peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are some of the approaches to making estimates about the peak value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How good of an estimate can be made by interpolating the value of the peak from the slope on either side of the clipping? This becomes difficult because if analysis relies on the dataset being at a specific sample rate, interpolation will result in upsampling, unless interpolation is done and the new signal is downsampled with an offset so that the peak becomes a data point. I'm sure this isn't an ideal approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about calculations in the frequency domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone ever been presented with this problem?&lt;/p&gt;&#xA;" OwnerUserId="8316" LastActivityDate="2014-03-22T09:41:25.953" Title="Peak detection from saturated signals" Tags="|peak-detection|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15163" PostTypeId="1" AcceptedAnswerId="15238" CreationDate="2014-03-22T06:39:00.197" Score="4" ViewCount="1361" Body="&lt;p&gt;I am interested in characterising the time-dependent response of a system to a sinusoidal input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steady state response of the system is also sinusoidal, however I wonder if there is a standard way to represent the information in a manner that is more detailed than the Frequency Response Function to capture the transient information too (as a function of frequency input)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. The system where input: $s(t) = \sin(\omega t), 0 \le t &amp;lt; \infty $ gives output: $y(t) = (1+e^{-t}) \sin(\omega t), 0 \le t &amp;lt; \infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response would be unity, and the impulse response could not be used to capture the transient behaviour?&lt;/p&gt;&#xA;" OwnerUserId="7694" LastEditorUserId="7694" LastEditDate="2014-03-26T04:07:48.000" LastActivityDate="2014-05-12T11:15:24.667" Title="Frequency response equivalent to characterise transient response (to sinusoidal inputs)?" Tags="|frequency-response|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15164" PostTypeId="1" CreationDate="2014-03-22T06:47:26.287" Score="0" ViewCount="1361" Body="&lt;p&gt;I have been studying carrier frequency offset estimation techniques in OFDM systems. I have understood several of them. when using Pilot tones, as stated in paper (1), the process involves two methods namely: acquisition and tracking modes. a large range CFO is estimated in the acquisition mode while in  the tracking mode, only fine CFO is estimated. &#xA;I have confusion, What are the nature of those Pilot tones? how are they being generated?&#xA;the authors of the paper wrote equation (18) without any derivation? can I get the system model for this technique?&#xA;the questions may sound easy, but I really need it. Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference:&#xA;(1) Praween Kumar Nishad,  P. Singh, &quot;Carrier Frequency Offset Estimation in OFDM Systems&quot;, National Institute of technology&#xA;&lt;a href=&quot;http://dspace.nitrkl.ac.in/dspace/bitstream/2080/1928/1/ID-451_praween.pdf&quot; rel=&quot;nofollow&quot;&gt;http://dspace.nitrkl.ac.in/dspace/bitstream/2080/1928/1/ID-451_praween.pdf&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="8317" LastActivityDate="2017-04-14T23:59:44.020" Title="Using Pilot tones to estimate carrier frequency offset in ofdm" Tags="|digital-communications|ofdm|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15165" PostTypeId="2" ParentId="15163" CreationDate="2014-03-22T09:36:04.683" Score="0" Body="&lt;p&gt;Every Linear Time Invariant system is fully described by either it's frequency response or it's impulse response. One can turned into the other via the Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either one can be used to model the behavior of the system to anything you want to throw at it. For example if you are interested in the &quot;transient behavior at different frequencies&quot;, you could create a sine wave burst (i.e. a short signal with a few cycles of a sine wave embedded in zeros) and convolve this with the impulse response. The result would show the transient response to a &quot;narrow band&quot; signal.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-22T09:36:04.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15166" PostTypeId="2" ParentId="15162" CreationDate="2014-03-22T09:41:25.953" Score="1" Body="&lt;p&gt;Depends on the amount of clipping and what other information about the signal you have. It's pretty easy to detect clipping (wave form constant at +xmax or -xmax). Once a region has been found you can try to replace the clipped region with an interpolation from the non-clipped regions around this. The best interpolation scheme will depend on what else you know about the signal. You can try polynomial expansions, Taylor series, Frequency domain interpolation, etc. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-22T09:41:25.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15168" PostTypeId="2" ParentId="15164" CreationDate="2014-03-22T12:47:09.637" Score="2" Body="&lt;p&gt;I am familiar with 802.11a, so I'll answer your questions with regard to how 802.11a does it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;What are the nature of those Pilot tones?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are 64 sub-carriers in 802.11a.  Four of them are used as the pilot channels.  The pilots themselves are simply known data- if I remember correctly they are either (1 + i) or -(1 + i).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;how are they being generated?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The transmitter just puts the appropriate data into the pilot sub-channels and then ifft's the entire symbol (i.e. with all of the other sub-channels).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;the authors of the paper wrote equation (18) without any derivation?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This isn't really a question.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;can I get the system model for this technique?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do you mean by a system model?  We don't normally provide code.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-22T12:47:09.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15169" PostTypeId="1" CreationDate="2014-03-22T13:31:26.690" Score="2" ViewCount="367" Body="&lt;p&gt;I'm new to DSP and trying to do some example problems for a class and am confused by this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a data set, and knowing it contains a signal that is a single sinusoid with random content noise, how can I calculate the signal to noise ratio? I also have the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been able to plot the autocorrelation, and can see the characteristic peak at 0 to indicate the noise. I'm just unsure if I can get the power of the signal and noise from this autocorrelation, or the power spectra density (taking the fft of the autocorrelation). Do I need to find the amplitude, frequency, and phase of the sinusoidal signal and subtract it from the original to do this? If so, how do I find those?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated, I am new to DSP and learning to thanks!&lt;/p&gt;&#xA;" OwnerUserId="8320" LastActivityDate="2014-06-20T17:01:27.543" Title="How to get the signal to noise ratio from noisy data set with sinusoid?" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15170" PostTypeId="2" ParentId="15169" CreationDate="2014-03-22T14:50:34.607" Score="1" Body="&lt;p&gt;One method is to pass the noisy sinewave through a notch filter tuned to the sine wave frequency. The output of the notch filter is N and the input is S + N. S/N = (S + N)/N - 1. This is the way some analog meters work.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-03-22T14:50:34.607" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15171" PostTypeId="1" CreationDate="2014-03-22T15:38:33.697" Score="0" ViewCount="376" Body="&lt;p&gt;I am interested in removing oscillations from a signal to capture the lower-frequency variations, similar to the objective of &lt;a href=&quot;https://dsp.stackexchange.com/questions/9671/how-to-remove-the-periodic-oscillations-from-a-signal&quot;&gt;this problem&lt;/a&gt;. The oscillations vary in frequency in the time domain, so wavelet shrinkage seems to be a reasonable option, but most of the literature on wavelet shrinkage is applied to denoising, where the noise to be shrunk is i.i.d. Gaussian. Low-frequency oscillations are generally autocorrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it still technically sound to apply wavelet shrinkage for removing higher frequency components even though they are not noise? Is there a better method? I am not aware of too many spatially-adaptive low-pass filters which have a convenient interpretation as wavelets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are examples of two of such signals. As you can see, the oscillations occur with different frequencies along the space/time domain (x-axis). I have tried Fourier smoothing, but it does not seem to leave any relevant features. (I have also tried truncated SVD, but it also does a horrible job removing the oscillations.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5K2Vh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5362" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2014-03-23T09:58:06.063" Title="Algorithms for removing oscillations?" Tags="|wavelet|time-frequency|denoising|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15172" PostTypeId="1" CreationDate="2014-03-22T16:50:17.087" Score="1" ViewCount="92" Body="&lt;p&gt;What could I say about stability of those systems by looking at the scheme?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;System 1&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GdJ3u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;System 2&#xA;&lt;img src=&quot;https://i.stack.imgur.com/l0aZR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_r(s)$ is input, $a(s)$, $b(s)$, $p(s)$, $q(s)$ and $r(s)$ are some polynomials and $y$ is output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculated tranfer $\frac{y}{y_r}$ and it's the same for both systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{y}{y_r} = \frac{r(s)b(s)}{a(s)p(s)+b(s)q(s)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What makes the difference between stability and behavior of those systems? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Some progress:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've edited the schemes. There is something, that obviosly differs in those systems. It's $e_{ss}$ - stady state error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first system is:&#xA;$$e_{ss1}=y_r(s)\frac{r(s)}{p(s)}-y(s)\frac{q(s)}{p(s)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second:&#xA;$$e_{ss2}=y_r(s)r(s)-y(s)q(s)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it tell me something about stability?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I guess this form is more usefull:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e_{ss1}=y_r(s)\frac{r(s)a(s)}{a(s)p(s)+b(s)q(s)}$$&#xA;$$e_{ss2}=y_r(s)\frac{r(s)a(s)p(s)}{a(s)p(s)+b(s)q(s)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second system's steady state error has higher order numinator than denominator. Does it mean, the signal's higher frequencies would be infinitely amplified?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="4158" LastEditDate="2014-03-22T18:59:45.300" LastActivityDate="2014-06-23T17:16:17.043" Title="Differences between two closed-loop systems" Tags="|control-systems|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15174" PostTypeId="1" CreationDate="2014-03-23T08:19:00.533" Score="0" ViewCount="650" Body="&lt;p&gt;it is a couple of weeks that I am thinking about the following: I have a tool which is able to simulate the dynamic behavior a steel tower exhibites due to the coupled action of wind and waves. Currently, to damp the oscillations, I am controlling the acceleration of the tower top by means of a standard feedback loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, this procedure is rather cumbersome and suboptimal: I damp the tower oscillation even when it's not needed, since the mentioned oscillation cannot jeopardize the system. Therefore, I am thinking of a triggering method: this trigger should be based on online FFT analysis of the tower oscillations: if the FFT amplitude is above a certain risk-threshold, the control loop must be activated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the question is: I am used to post-process full time series by means of FFT, but in my case the FFT should be performed on the simulated signal while the simulation is running.&#xA;Do you know any way I could perform kind of step-by-step FFT analysis?&lt;/p&gt;&#xA;" OwnerUserId="3666" LastEditorUserId="3666" LastEditDate="2014-03-23T08:29:51.927" LastActivityDate="2014-03-23T08:29:51.927" Title="Online FFT of simulated signal" Tags="|matlab|fft|discrete-signals|signal-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15175" PostTypeId="1" CreationDate="2014-03-23T08:49:27.167" Score="2" ViewCount="1953" Body="&lt;p&gt;I have an array &lt;code&gt;x&lt;/code&gt; of length 1024 (stored as 16 bits integers, named for example &lt;code&gt;np.int16&lt;/code&gt; in numpy/python), i.e. &lt;strong&gt;the size of x is 1024*2 = 2048 bytes.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;em&gt;Remark : x comes from an audio .wav file, stored as 16 bits integers, as it is very common. But it is also very common to interpret it as a float array, with values in $[-1, +1]$ by doing:&lt;/em&gt; &lt;code&gt;x = x * 1.0 / 2^16&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I take &lt;code&gt;fft(x)&lt;/code&gt;, as the input was real, there is some symmetry that makes that I only need to store half of the array &lt;code&gt;fft(x)&lt;/code&gt;, that's often also called &lt;code&gt;rfft(x)&lt;/code&gt; : &lt;strong&gt;real fft&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;This means that, by taking &lt;code&gt;fft&lt;/code&gt;, I translated 1024 real numbers into 512 complex numbers (i.e. can be viewed as 1024 real numbers again) : in a mathematical point of view, we have the same amount of data : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1024 real coefficients -- rfft --&amp;gt; 1024 real coefficients&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But in a programmaing point of view, is it possible to store, losslessly* and without compression, the &lt;code&gt;fft&lt;/code&gt; of an array of 1024 elements of type &lt;code&gt;int16&lt;/code&gt; (using 2048 bytes) with 2048 bytes maximum ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If not, what is the minimum number of bytes required to store the &lt;code&gt;fft&lt;/code&gt; of such an array?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;remark (*) : by losslessly I mean that the original &lt;code&gt;x&lt;/code&gt; can be recovered later&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2014-03-26T13:48:26.200" LastActivityDate="2014-03-27T17:10:57.450" Title="Store a FFT with a minimal amount of data" Tags="|fft|discrete-signals|fourier-transform|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15176" PostTypeId="1" AcceptedAnswerId="20346" CreationDate="2014-03-23T11:02:12.217" Score="2" ViewCount="8546" Body="&lt;p&gt;I have c# desktop application and I am using emgu framework as a wrapper for OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to sharpen an image because the input images are not great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tired a technique I found via searches that suggest from the original image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take a copy and blur it. &#xA;I then take another copy of the original and invert it.&lt;br&gt;&#xA;I then merge the 2 new images together.&lt;br&gt;&#xA;I then finally invert that merged image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done all that but the image pretty much looks the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the right approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can post my code if need be - I used Aforge to quickly test this approach though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&#xA;To answer my own question I used this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            Image&amp;lt;Bgr, byte&amp;gt; image = new Image&amp;lt;Bgr, byte&amp;gt;(@&quot;D:\20140320022038047.jpg&quot;);&#xA;            Image&amp;lt;Bgr, byte&amp;gt; image2 = new Image&amp;lt;Bgr, byte&amp;gt;(@&quot;D:\20140320022038047.jpg&quot;);&#xA;            Emgu.CV.CvInvoke.cvSmooth(image, image2, SMOOTH_TYPE.CV_GAUSSIAN, 5, 5, 9, 9);&#xA;            Emgu.CV.CvInvoke.cvAddWeighted(image, 1.5, image2, -0.5, 0, image);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="8290" LastEditDate="2014-03-23T11:59:27.303" LastActivityDate="2015-02-03T16:48:13.597" Title="Sharpening an image using emgu" Tags="|image-processing|opencv|c#|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15178" PostTypeId="1" AcceptedAnswerId="15234" CreationDate="2014-03-23T12:28:26.723" Score="2" ViewCount="2419" Body="&lt;p&gt;let us suppose that we have following signal  values,which consists  by deterministic  components and random noise(white noise)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;56.69&#xA;75.24&#xA;13.77&#xA;8.56&#xA;-12.88&#xA;-65.34&#xA;-45.33&#xA;-48.78&#xA;-22.23&#xA;54.12&#xA;83.77&#xA;11.84&#xA;2.31&#xA;39.59&#xA;-32.09&#xA;-88.86&#xA;5.45&#xA;50.24&#xA;-37.39&#xA;-35.69&#xA;38.62&#xA;7.06&#xA;-30.01&#xA;22.36&#xA;60.71&#xA;30.96&#xA;5.90&#xA;-38.91&#xA;-58.15&#xA;-40.87&#xA;-13.18&#xA;-14.77&#xA;35.36&#xA;103.24&#xA;39.04&#xA;-50.76&#xA;6.98&#xA;1.23&#xA;-87.46&#xA;-60.86&#xA;65.08&#xA;23.93&#xA;-28.36&#xA;2.42&#xA;31.67&#xA;-5.22&#xA;4.02&#xA;37.50&#xA;12.36&#xA;5.37&#xA;-18.83&#xA;-68.70&#xA;-38.11&#xA;35.47&#xA;7.47&#xA;11.64&#xA;103.89&#xA;88.26&#xA;-62.41&#xA;-62.44&#xA;10.09&#xA;-33.92&#xA;-72.48&#xA;17.83&#xA;74.35&#xA;7.56&#xA;-5.35&#xA;22.56&#xA;-2.11&#xA;-2.82&#xA;2.59&#xA;-21.33&#xA;-0.52&#xA;-4.11&#xA;-50.68&#xA;-66.68&#xA;28.14&#xA;62.10&#xA;6.73&#xA;32.39&#xA;93.62&#xA;-18.56&#xA;-112.15&#xA;-38.18&#xA;3.33&#xA;-44.78&#xA;13.79&#xA;76.52&#xA;39.92&#xA;9.55&#xA;-7.09&#xA;-28.72&#xA;-1.59&#xA;19.01&#xA;-26.25&#xA;-22.61&#xA;32.54&#xA;0.06&#xA;-80.17&#xA;-2.02&#xA;103.68&#xA;31.50&#xA;-9.29&#xA;44.79&#xA;6.10&#xA;-93.30&#xA;-87.67&#xA;2.06&#xA;5.53&#xA;20.94&#xA;67.28&#xA;48.24&#xA;16.43&#xA;4.28&#xA;-49.05&#xA;-43.92&#xA;14.48&#xA;2.02&#xA;-56.29&#xA;16.29&#xA;54.09&#xA;-42.38&#xA;-33.91&#xA;67.16&#xA;64.26&#xA;-34.38&#xA;1.31&#xA;17.57&#xA;-69.49&#xA;-86.43&#xA;-14.43&#xA;20.61&#xA;38.08&#xA;66.31&#xA;38.91&#xA;9.62&#xA;-4.38&#xA;-45.47&#xA;-91.23&#xA;-9.17&#xA;52.92&#xA;-21.17&#xA;-31.51&#xA;69.74&#xA;22.55&#xA;-62.65&#xA;22.34&#xA;72.59&#xA;-6.34&#xA;-49.96&#xA;0.06&#xA;-38.30&#xA;-55.57&#xA;-22.15&#xA;28.14&#xA;61.12&#xA;81.82&#xA;37.94&#xA;-32.41&#xA;-14.05&#xA;-16.05&#xA;-90.12&#xA;-46.52&#xA;75.39&#xA;50.48&#xA;-36.08&#xA;21.54&#xA;64.57&#xA;-32.83&#xA;-47.71&#xA;47.82&#xA;35.80&#xA;-31.32&#xA;-37.71&#xA;-30.45&#xA;-36.51&#xA;6.90&#xA;30.17&#xA;25.81&#xA;69.67&#xA;50.19&#xA;-55.42&#xA;-76.26&#xA;-11.97&#xA;-47.71&#xA;-80.69&#xA;52.76&#xA;91.17&#xA;-5.08&#xA;-12.75&#xA;49.10&#xA;5.44&#xA;-46.98&#xA;-0.40&#xA;22.20&#xA;-12.89&#xA;-17.56&#xA;-24.62&#xA;-18.95&#xA;22.94&#xA;53.27&#xA;8.67&#xA;35.09&#xA;67.76&#xA;-27.38&#xA;-111.75&#xA;-37.70&#xA;14.80&#xA;-56.16&#xA;2.87&#xA;105.52&#xA;59.46&#xA;-42.36&#xA;-7.17&#xA;12.65&#xA;-32.87&#xA;-38.61&#xA;-0.33&#xA;1.07&#xA;0.12&#xA;6.79&#xA;-41.04&#xA;3.19&#xA;76.28&#xA;18.78&#xA;-26.27&#xA;47.46&#xA;16.52&#xA;-116.17&#xA;-82.44&#xA;25.21&#xA;8.68&#xA;2.55&#xA;70.61&#xA;86.29&#xA;-10.63&#xA;-44.12&#xA;-19.48&#xA;-34.54&#xA;-31.95&#xA;8.52&#xA;-10.48&#xA;11.89&#xA;40.45&#xA;-10.66&#xA;-34.27&#xA;63.24&#xA;42.83&#xA;-32.87&#xA;-18.44&#xA;37.47&#xA;-64.48&#xA;-101.98&#xA;7.93&#xA;59.48&#xA;22.63&#xA;43.46&#xA;74.91&#xA;2.31&#xA;-49.18&#xA;-56.15&#xA;-55.96&#xA;-11.68&#xA;37.66&#xA;3.36&#xA;13.40&#xA;45.50&#xA;14.21&#xA;-57.98&#xA;6.29&#xA;74.98&#xA;-7.25&#xA;-70.83&#xA;12.29&#xA;7.90&#xA;-76.29&#xA;-24.42&#xA;69.80&#xA;60.11&#xA;28.97&#xA;39.65&#xA;-11.23&#xA;-59.30&#xA;-60.80&#xA;-63.71&#xA;-16.72&#xA;66.48&#xA;59.98&#xA;-17.27&#xA;36.01&#xA;55.04&#xA;-38.70&#xA;-59.95&#xA;48.63&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i know that sampling frequency=100;i am interested what is a  basic steps  using wavelet to extract  frequencies and phases?i know that there is function of  cwt for compute continuous wavelet transform and from coefficients it tries to determine  frequencies,now if i know  sampling frequency and dont know  frequency components but suppose that it must be less then  sampling frequency/2 or fs/2,because of Nyquist criteria to held,how can i take  scales?i have tried following example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; B=xlsread('data_generations1','A1','g8:g301');&#xA;&amp;gt;&amp;gt; scales=1:100;&#xA;&amp;gt;&amp;gt; coeff=cwt(B,1:100,'db2','plot');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and got following picture&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CM6PT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now how can i determine  which frequency and phases are in signal?or which wavelet basis should i choose?please help me in this problem&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastActivityDate="2014-03-27T23:04:28.247" Title="use wavelet transform to extract frequencies from given signal" Tags="|matlab|signal-analysis|wavelet|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15179" PostTypeId="1" AcceptedAnswerId="15181" CreationDate="2014-03-23T12:38:35.153" Score="1" ViewCount="2468" Body="&lt;p&gt;If I want to measure entropy of an image how should I do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to ignore things like tree leaves moving in the wind with my C# desktop application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know matlab has this functionality but I cannot see it within Emgu which is what I am using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got as far as finding 'Shannon Entropy' is probably the way forward but I am stuck as to how to implement it in C# speficially for images.&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="6" LastEditDate="2014-03-24T08:10:11.077" LastActivityDate="2016-12-08T02:20:13.780" Title="Entropy of an image" Tags="|image-processing|c#|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15180" PostTypeId="1" AcceptedAnswerId="15184" CreationDate="2014-03-23T13:09:41.683" Score="0" ViewCount="185" Body="&lt;p&gt;when it comes to digital I/Q signal power measurement we know that this power is viewed as $I^2+Q^2$ (as its polar form). This is the power as referred to final analogue signal. Yet the IQ modulator does not convert I/Q to polar form, instead only the final I is output to real world say in the RF modulator.&#xA;When I model two I/Q mixers it does not show that final power is $I^2 + Q^2$ but rather just $I^2$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = randn(1,1024)+j*randn(1,1024); %random I/Q input&#xA;sincos1 = exp(j*2*pi*(0:1023)*.01); &#xA;y1 = x.*sincos1; % first digital IQ modulator &#xA;&#xA;sincos2 = exp(j*2*pi*(0:1023)*.1);&#xA;y2 = real(y1.*sincos2); %rf IQ mixer giving final analogue output&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if you check power of y2 you will see it is close to real(y1) rather than complex y1.&#xA;I ask this because for all power dependent applications e.g. DPD we assume power is $I^2+Q^2$&#xA;what am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8327" LastEditorUserId="4376" LastEditDate="2014-03-23T15:15:19.847" LastActivityDate="2014-03-23T17:28:43.870" Title="digital IQ modulators" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15181" PostTypeId="2" ParentId="15179" CreationDate="2014-03-23T13:10:45.150" Score="2" Body="&lt;p&gt;You have probably found out that entropy of a discrete random variable $X$ is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(X)=-\sum_{i=1}^N p_i\log_2 p_i\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the size of the alphabet (i.e. the number of possible values of $X$), and $p_i$ is the probability that $X$ assumes the $i^{th}$ value of the alphabet.&#xA;The entropy $H(X)$ can be interpreted as the average information obtained by observing $X$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of an image, you need to estimate the values $p_i$. You can do this by computing the histogram of the image: define a number $N$ of bins of (equal) grayscale ranges and simply count the number of pixels per bin. Dividing the number of pixels per bin by the total number of pixles gives you an estimate of $p_i$. Then you just need to plug these values into (1) and you get the entropy of the image.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-23T13:10:45.150" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15182" PostTypeId="2" ParentId="15175" CreationDate="2014-03-23T13:49:28.193" Score="5" Body="&lt;p&gt;In general, quantizing an FFT result is a lossy process.  Given that the FFT twiddle factors are transcendental functions, any finite storage size will result in adding some quantization noise; and that noise increases as the resulting format decreases in bit size.  For extremely sparse FFT results, it may be possible to compress those results, but those are statistically very rare cases.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-23T13:49:28.193" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15183" PostTypeId="2" ParentId="15178" CreationDate="2014-03-23T14:45:27.860" Score="1" Body="&lt;p&gt;A simple (hanning-windowed) FFT reveals four peaks that stand out far beyond the noise. This appears to be what you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gqjAO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-23T14:45:27.860" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15184" PostTypeId="2" ParentId="15180" CreationDate="2014-03-23T14:58:35.967" Score="0" Body="&lt;p&gt;The power of the final real-valued signal $y_2$ is half the power of $y_1$ because you take the real part (and thus reduce power by a factor 2). The real part of $y_1$ is already the sum of the I-component and the Q-component, not only the I-component:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Re\{y_1\}=Re\{x\}\cos\omega_1 t - Im\{x\}\sin\omega_1 t= I-Q$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the original formula $I^2+Q^2$ is correct, you just need to apply a factor of $1/2$ if you don't compensate for taking the real-part. This is why in some textbooks the real part operation in a bandpass modulator is 'implemented' as $\sqrt{2}Re\{\cdot\}$; this will keep the power unchanged.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-03-23T17:28:43.870" LastActivityDate="2014-03-23T17:28:43.870" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15185" PostTypeId="1" CreationDate="2014-03-23T15:58:18.787" Score="1" ViewCount="4088" Body="&lt;p&gt;I conducted a research on how to implement a QPSK demodulator. I found out the Quadrature QPSK demodulation technique which seems very straight forward. Here is what i understood from the explanation of the block diagram, and would like to confirm from this platform if my understanding is right.  From the block diagram below, I am meant to do the following for a 2048 bits QPSK modulated signal:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Split the incoming 2048 bits of QPSK modulated signal into the I and Q phase&lt;/li&gt;&#xA;&lt;li&gt;Multiply the 1024 bits in the I phase by the recovered carrier&lt;/li&gt;&#xA;&lt;li&gt;multiply the other 1024 bits in the Q phase by the 90 shifted recovered carrier&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is what do I do to this sets of I and Q phase outputs in order to get my demodulated bits ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most explanations I have seen just says it passes through a decision maker, but none has gone the extra length to explain what really happens within the decision maker&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/erzwE.jpg&quot; alt=&quot;QPSK DEMODULATOR&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7271" LastEditorUserId="7271" LastEditDate="2014-03-23T16:04:50.887" LastActivityDate="2014-03-23T18:29:03.183" Title="Implementing QPSK Demodulation" Tags="|modulation|demodulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15186" PostTypeId="2" ParentId="14680" CreationDate="2014-03-23T17:23:24.440" Score="2" Body="&lt;p&gt;A natural image is like a photo, as opposed to a synthetic or artificial image which is like a cartoon or line art, that typically has sharp edges and flat areas of color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's of interest to people who are compressing digital images: natural images compress better with JPEG while synthetic ones compress better using lossless formats such as PNG or GIF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The distinction between these two types is blurring these days, as technology for photorealistic image generation has developed.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2014-03-24T01:28:15.250" LastActivityDate="2014-03-24T01:28:15.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15187" PostTypeId="2" ParentId="15185" CreationDate="2014-03-23T18:17:08.770" Score="3" Body="&lt;p&gt;Your block diagram is correct. However, it seems to me that your understanding of how to implement it is not. There are no 'bits' in the modulated signal! The input signal is a noisy analog bandpass signal, and the I and Q components are derived from this signal as shown in the block diagram: by demodulating and filtering the incoming signal. Then this (complex) signal is sampled at the symbol rate (you may need timing recovery to know when to sample) and fed to a slicer. The slicer decides which of the four possible symbols was (probably) transmitted in each symbol interval. After the detected symbols are known you simply decode each symbol according to the coding in the transmitter (each symbol carries two bits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I didn't mention matched filters even though they were emphasized in Dilip's comment. For an optimum receiver they are of course necessary, but given the level of the question it seems to me that the block diagram is OK, and that the idea is probably that it should be implemented as is. Even though it will result in a sub-optimum receiver it can perform well under mild channel conditions. The only real difference is the type of low-pass filter used (matched to the transmitted pulses or just eliminating out-of-band noise).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-03-23T18:29:03.183" LastActivityDate="2014-03-23T18:29:03.183" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15188" PostTypeId="1" CreationDate="2014-03-23T19:01:22.697" Score="0" ViewCount="144" Body="&lt;p&gt;If I have the following power spectral density of the quantization error can I tell that quantization noise is approximately white? Can you please provide some justification?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/csiIs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7907" LastActivityDate="2014-03-24T02:04:19.833" Title="Is the quantization noise white here?" Tags="|signal-analysis|noise|power-spectral-density|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15189" PostTypeId="2" ParentId="13974" CreationDate="2014-03-23T20:05:34.167" Score="2" Body="&lt;p&gt;ImageMagick's &quot;identify -verbose&quot; says it's JPEG. The sample image here has quality 77, while several recent ones of mine that I checked just now have either &quot;quality 71&quot; or &quot;quality 74&quot;. All of them have 2x downsampling of the chroma channels.  Most of the time I have uploaded high-quality (IJG quality 92) JPEGs without donwsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some have Facebook's &quot;tinysrgb&quot; profile while others have one of the color.org sRGB profiles.  I haven't yet figured out how these choices are made, or how to influence them.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2014-03-27T19:33:02.677" LastActivityDate="2014-03-27T19:33:02.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15190" PostTypeId="1" AcceptedAnswerId="17595" CreationDate="2014-03-23T20:26:32.733" Score="4" ViewCount="554" Body="&lt;p&gt;I want to know the performance of a deconvolution algorithm with different CN, so I'm convolving my signal with different convolution matrices(different CNs) and then applying the deconvolution algorithm, then the error between the original and reconstructed signals is measured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a proper way to create the convolution matrix with variable CN.&lt;/p&gt;&#xA;" OwnerUserId="1380" LastEditorUserId="128" LastEditDate="2019-01-14T17:46:24.417" LastActivityDate="2019-02-08T09:41:19.693" Title="How to Create a Convolution Matrix with a Variable Condition Number (CN)" Tags="|convolution|deconvolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15191" PostTypeId="1" CreationDate="2014-03-23T20:47:45.157" Score="2" ViewCount="4866" Body="&lt;p&gt;ECG signal is affected by interferences such as the Powerline Interference, Baseline Wandering and Muscle Noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many filters available which can reasonably cancel these types of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found that Butterworth, Chebyshev, Wiener and Kaiser filters, along with wavelets could be used for this purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my main questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Which filters are the most commonly used and easier to implement&#xA;(both from the above list and from other filters you have in mind)? &lt;/li&gt;&#xA;&lt;li&gt;Can you provide me some pseudo-code samples on how to implement some simple filters, maybe Butterworth or Wiener?&lt;/li&gt;&#xA;&lt;li&gt;In which references should I look at concerning ECG digital&#xA;filtering, I mean which provide an overview of the various filters instead of foccusing on a specific one?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8253" LastEditorUserId="8253" LastEditDate="2014-03-23T22:19:16.447" LastActivityDate="2018-07-30T18:24:31.250" Title="Which filters are the most commonly used and easier to implement for ECG noise removal?" Tags="|filters|signal-analysis|denoising|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15192" PostTypeId="2" ParentId="15191" CreationDate="2014-03-23T21:22:21.690" Score="2" Body="&lt;p&gt;Different filters are used for different purposes. Removing powerline noise, which usually is concentrated at a single frequency, is usually performed with a notch filter. Removing baseline wandering is usually done with a DC blocking filter, which is a very narrow high pass filter, and is essentially another notch filter with 0 Hz center frequency. Removing EMG is usually more difficult, but you can try doing it with a low pass filter, since EMG has a lot of content in high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to process EEG signals for simple things like heartbeat rate detection, look at the &lt;a href=&quot;http://www.robots.ox.ac.uk/~gari/teaching/cdt/A3/readings/ECG/Pan+Tompkins.pdf&quot; rel=&quot;nofollow&quot;&gt;Pan-Tompkinks algorithm&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions 2 and 3 require some effort on your part, since they're very broad. I've used &lt;a href=&quot;http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471208116.html&quot; rel=&quot;nofollow&quot;&gt;this book&lt;/a&gt; in a graduate class on the topic, and I found it to be very insightful.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-03-23T21:22:21.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15193" PostTypeId="2" ParentId="15191" CreationDate="2014-03-23T21:32:44.983" Score="0" Body="&lt;p&gt;I think you can use any filter of them, it depends alot on the type of the filter(low pass,high pass,....)&#xA;First you should know the useful frequency part and the noise part, depending on IEC specification, the bandwidth of the ECG is 0.5Hz to 150Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so you can use a low pass filter with break frequency 150Hz to remove the high frequency noise(larger than 150), and use notch filter(remove specific frequency) to remove the power line noise at 50Hz or 60Hz, the noise added by muscles is hard to remove because it lies in the bandwidth of the ECG signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can use MATLAB and see the help of these filters, it provides nice examples.&lt;/p&gt;&#xA;" OwnerUserId="1380" LastActivityDate="2014-03-23T21:32:44.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15194" PostTypeId="2" ParentId="15188" CreationDate="2014-03-24T02:04:19.833" Score="1" Body="&lt;p&gt;It depends on your band-width of interest. If your band-width of interest is very very small than the bandwidth of quantization-noise then you may say that noise is white.&lt;/p&gt;&#xA;" OwnerUserId="5049" LastActivityDate="2014-03-24T02:04:19.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15195" PostTypeId="1" CreationDate="2014-03-24T04:29:54.470" Score="2" ViewCount="66" Body="&lt;p&gt;I'm currently working on a digital audio OFDM project and found that even if I explicitly specified the same sample rate (11025 Hz), the transmitter and receiver still differ slightly in it(lesser than 1 Hz). My professor asked me to use a 'multirate interpolating filter' to synchronize the two sample rates. Could you give me some hints about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, I'm programming with C++ and the portaudio library. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7569" LastActivityDate="2014-03-24T04:29:54.470" Title="Sample rate synchronization" Tags="|software-implementation|" AnswerCount="0" CommentCount="0" ClosedDate="2014-05-13T04:16:52.650" ContentLicense="CC BY-SA 3.0" />
  <row Id="15197" PostTypeId="1" AcceptedAnswerId="15201" CreationDate="2014-03-24T08:49:42.680" Score="6" ViewCount="1192" Body="&lt;p&gt;My understanding of jpg compression is that, if done repeatedly, any image will eventually be reduced to a single flat color, due to the way it deals with neighboring pixels. However, years ago I was told that mp3 does not have this problem, a 192kbps song will stay at the same audio quality with little file size variation no matter how many times it is compressed at the same setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is that? What's the differentiating factor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8333" LastActivityDate="2014-03-24T15:08:31.187" Title="Difference between jpg compression and mp3 compression" Tags="|audio|compression|image-compression|jpeg|mp3|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15199" PostTypeId="1" AcceptedAnswerId="15200" CreationDate="2014-03-24T12:20:55.210" Score="0" ViewCount="1298" Body="&lt;p&gt;I created a data signal and calculated the spectrum via the fft-command in MATLAB. The data-signal itself is not periodic but it is created in a way that it can be treated as one period of a periodic signal. The last sample smoothly transitions to the first one. I observe that the absolute of the spectrum strongly depends on the zero-padding before calculating the fft. If I do zero-pad the signal such that its length is a power of two, the spectrum differs severely from the one where I kept the signal unchanged. In the following pictures you can see the results.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sjPCN.jpg&quot; alt=&quot;Absolute of the IFFT of the original signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aQNRE.jpg&quot; alt=&quot;Absolute of the IFFT of the zero-padded signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be clearly seent that there is a kind of gap at the center of the channels without zero-padding. I can't explain this. I would expect the shape of both transforms to be the same. Why is that not the case here, does anyone have an idea?&lt;/p&gt;&#xA;" OwnerUserId="8335" LastActivityDate="2014-03-24T12:57:28.380" Title="Why is there a difference between MATLAB's FFT of a zero-padded signal compared to the non-padded case" Tags="|fft|zero-padding|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15200" PostTypeId="2" ParentId="15199" CreationDate="2014-03-24T12:57:28.380" Score="0" Body="&lt;p&gt;If you write&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFT(data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you basically sample a continous &quot;spectral curve&quot; at length(data) many points. If you do zero padding&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFT(data,len)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;length(data)&lt;/code&gt;&amp;lt;&lt;code&gt;len&lt;/code&gt; you effectively sample the curve at more points (len) that are more closely spaced. But it is still is the same curve. It was just sampled at different frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is really the only difference you made, then you're probably witnessing a &quot;sampling issue&quot;. By that I mean the curves appear to be different because you've sampled it at different points and there is some oscillations going on. Chances are that you havn't applied any windowing which would smooth out the curve a bit and make this effect (otherwise known as spectral leakage) less likely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could try one of the following things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;do even more zero padding for an increased sample rate (samples/Hz) and check out the shape&lt;/li&gt;&#xA;&lt;li&gt;apply a window function to smooth out the curve before the FFT&lt;/li&gt;&#xA;&lt;li&gt;use PWELCH&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;PWELCH does more than simply an FFT. It includes windowing and averaging of overlapping but smaller windows. This is probably what you should be doing given your &quot;non-periodic&quot; hint.&lt;/p&gt;&#xA;" OwnerUserId="1961" LastActivityDate="2014-03-24T12:57:28.380" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15201" PostTypeId="2" ParentId="15197" CreationDate="2014-03-24T13:22:25.250" Score="9" Body="&lt;p&gt;Actually, it's kind of the other way around. If you reuse the same JPEG encoder at the same quality level (without any smoothing steps as built-in prepcosessing) and a decoder which faithfully decompresses the images, I expect the image quality not to degrade from generation to generation. This is because quantization (the lossy part) is done the same way during the 2nd compression. You can imagine scalar quantization like this: given some value v and a quantizer step s, the quantized value is round(v/s)*s. Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = 6.3&#xA;s = 2&#xA;q = round(v/s)*s = 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, the first &quot;compression&quot; includes an error of 0.3 in this case. But if you feed this into the encoder a 2nd time&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = 6&#xA;s = 2&#xA;q = round(v/s)*s = 6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it does not change anymore. It stays 6. If you change the quality level from one compression to the next, you also change the quantizer step s. This would add a new rounding error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that this is just a simple example. JPEG Quantization may include a &quot;dead zone quantizer&quot; which changes the threshold a bit near 0. For example, you might want to round any value v to zero in case |v|&amp;lt;0.7. Something like this might give you a slightly higher quality-per-bit ratio because zeros can be much more compactly represented. But this should not change what I described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With MP3 the &quot;quantization steps&quot; are computed dynamically and depend on the actual signal. This is what the &quot;psychoacoustic model&quot; is for. It analyzes the audio data and tells us how strongly we can quantize certain portions of the signal without us noticing a difference. But this quantization adds &quot;quantization noise&quot; which could make the psychoacoustic model compute other quanzitation steps during the 2nd compression even in the case where you told the encoder to use the same &quot;quality level&quot;. In the case the 2nd compression uses different quantization steps, you'll introduce new rounding errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, something like this has been done before. Some artist did such an experiment where he compressed some audio file over and over again (like 1000 times) and the result had little to do with the original. Unfortunately, I don't remember any names or references.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other issues which make lossy audio compression more complicated. For example, a decoder might add or remove some leading samples (encoder+decoder delay mismatch) which would make the encoder work on different blocks for the 2nd pass. This would also add new rounding errors. But if I remember correctly, such a &quot;block position mismatch&quot; was shown to be beneficial w.r.t. generation loss by some experiments done by the &lt;a href=&quot;http://hydrogenaudio.org/&quot;&gt;Hydrogenaudio&lt;/a&gt; crowd a couple of years ago. So, while there was still a generation loss, the loss was less annoying than with matching block positions.&lt;/p&gt;&#xA;" OwnerUserId="1961" LastEditorUserId="1961" LastEditDate="2014-03-24T13:59:26.193" LastActivityDate="2014-03-24T13:59:26.193" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15202" PostTypeId="1" CreationDate="2014-03-24T13:31:50.423" Score="3" ViewCount="720" Body="&lt;p&gt;I'm creating a three-dimensional model of the earth based on &lt;a href=&quot;http://srtm.usgs.gov/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;SRTM&lt;/a&gt; height data. The data set is pretty huge, so only a small fraction of the data is available at any given time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The height data is organized in 1° x 1° &lt;em&gt;tiles&lt;/em&gt; which come in different resolutions (from 1x1 to 1200x1200, roughly in power-of-two steps). For visualization purposes, I'm sampling the surface in equidistant steps. The sampling theorem gives me an optimal tile resolution to work on, and as long as the point is in the middle of a tile or all neighbouring tiles have the same resolution, this is pretty straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently employing cubic splines to get a &lt;strong&gt;continuously differentiable surface function&lt;/strong&gt;. Data points are grey, the sampled point is the red x, used data points are green.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OBtU9.png&quot; alt=&quot;Bicubic interpolation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem appears when a point is near the border of two &lt;strong&gt;differently-resolved tiles.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the point's nearest neighbours and linearly interpolating between them gives me a continuous surface, but not a differentiable one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hfUck.png&quot; alt=&quot;Differently-Resolved tiles&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most common of such neighbourships is unfortuanely a large (1200x1200 or 600x600) tile being next to a 1x1 one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I need an algorithm for interpolating smoothly on these borders that offers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;near-exact results if the queried point coincides with a tile data point&lt;/li&gt;&#xA;&lt;li&gt;continuous differentiability in both directions&lt;/li&gt;&#xA;&lt;li&gt;high-frequency features fading out quickly into low-resolution tiles&lt;/li&gt;&#xA;&lt;li&gt;good performance (possibly at the expense of accuracy)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8337" LastActivityDate="2014-03-24T13:31:50.423" Title="Interpolating on the borders of differently-resolved images" Tags="|image-processing|sampling|interpolation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15203" PostTypeId="1" AcceptedAnswerId="15204" CreationDate="2014-03-24T14:07:47.270" Score="8" ViewCount="4251" Body="&lt;p&gt;I am interested in understanding the mathematical reason for why does applying a median filter on an image (or signal) result in reduction of noise.&lt;/p&gt;&#xA;" OwnerUserId="8338" LastActivityDate="2014-03-24T19:54:33.447" Title="What is the math behind median filter's noise reduction property?" Tags="|filters|noise|denoising|math|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15204" PostTypeId="2" ParentId="15203" CreationDate="2014-03-24T14:41:08.087" Score="13" Body="&lt;p&gt;&lt;strong&gt;Intuition:&lt;/strong&gt; The intuition is this: Your noise is some event or events that are rare, and that when compared to other events, look like outliers that shouldn't really be there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you are measuring the speeds of every car on the highway as they pass by you and plot them, you will see that they are usually in the range of say, $50$ mph to $70$ mph. However as you are inspecting your data for your boss, you see that you recorded a speed of $1,000,000$ mph. Not only does this value not make physical sense for the speed of an actual car on a highway, but it also sticks out wildly from the rest of your data. Chalking this event up to some strange measurement error, you remove it, and give the rest of your data to your boss.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However as you continue your measurements day in and day out, you notice that every now and then, you get those wild measurements of speed. For example, over the span of 1 hour, you measure 1000 cars, and their speeds are nicely between $50$ and $70$ mph, however 3 of those have speeds of $23,424$ mph, $12,000,121$ mph, and $192,212,121,329,982,321,912$ mph, breaking not only local state laws, but also those of theoretical physics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You get tired of continuously having to go in, and remove those errant data points caused by your cheapo-radar by hand. Afterall, your boss is really only interested in the statistics of the speeds, not so much every actual value. He likes to make nice histograms for &lt;em&gt;his&lt;/em&gt; bosses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those errant and large numbers are a kind of 'noise' you reckon - 'noise' caused by your cheapo-radar that you bought from a shady pawn shop. Is the noise additive white gaussian noise? (AWGN). Yes and no - It's spectrum is wideband and white, but it is temporally rare, sparse, and very localized. It is better referred to as 'salt and pepper' noise, (especially in the image processing domain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, what you can do, is run your data through a &lt;em&gt;median filter&lt;/em&gt;. Your median filter will take a block of say, $5$ speed points, (points 1 to 5), find the median, and spit that value as the 'average' speed. Then it will take the next 5 points, (points 2 to 6), take that median, and spit out this as the average, etc etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens when you come across one of your faster-than-light speeds?. Let us say that your 5 speeds were [45, 65, 50, 999999, 75]. If you took the normal average, your 'average' speed here will be something quite large. However if you take the median, your 'average' will be 65. Which best approximates the average that you are really trying to measure? The median metric. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if you filter your data with a median filter, you will be sure to remove those outliers - and you have thus faithfully 'de-noised' your signal. In contrast, if you tried to remove your noise via traditional filtering, (nothing but a moving weighted sum), you will instead 'smear' the error across your data, and not get rid of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Math:&lt;/strong&gt; The math is this: The median measurement is what is referred to as an &lt;a href=&quot;http://en.wikipedia.org/wiki/Order_statistic&quot;&gt;order statistic&lt;/a&gt;. That is, it returns the value of your data, along some point, after it has been ordered. The max and min are also both order statistics - they return the extreme points of your data after it has been ordered. Taking the median also returns the value of your ordered data, but right from the middle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But why are they different from mean filters? Well, mean-filters compute an average using &lt;em&gt;all&lt;/em&gt; the data. If you notice from max, min, and median, you are getting an answer &lt;em&gt;without&lt;/em&gt; using all the data. In fact, all the median does is &lt;em&gt;order&lt;/em&gt; your data, and pick the value in the middle. It never 'touches' the outliers, like those large speeds that you measured. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why median - an order statistic - is able to 'remove' outlier noise for you. Outlier noise segregates itself in front of the median, and the median never comes near it or considers it, while still giving you a nice estimate of central tendency. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2014-03-24T15:33:07.690" LastActivityDate="2014-03-24T15:33:07.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15205" PostTypeId="2" ParentId="15197" CreationDate="2014-03-24T15:08:31.187" Score="8" Body="&lt;p&gt;I don't think that repeated jpg compression reduces to a single flat color.  I tried compressing-decompressing an image 3 times.  (Using GIMP 2.8.2, at quality level &quot;10%&quot; with progressive, exif, thumbnail and xmp all turned off, 4:2:2 vertical subsampling and integer DCT.)  All three images are identical (Linux &lt;code&gt;cmp&lt;/code&gt; turns up no differences at all between the files.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;jpg and mp3 have similar philosophies: given some model of human perception, estimate how well a human could perceive each feature in the input.  If it can't be perceived (according to the model) then leave it out of the output.  I don't know much about mp3, but in jpg, once you've removed certain features and kept others, the file is no longer compressible unless you use a different perception model for the next round of compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In jpg the human perception model is relatively simple: (1) we see gradations of intensity with much more detail than we see changes in color and (2) we see medium frequency gradations in more detail than we see high-frequency gradations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jpg makes use of (1) (usually) by converting the picture from sRGB to YCbCr.  Then the Cb and Cr planes are reduced in resolution (usually by a factor of 2 in each direction, so you throw out 3/4 of the info.)  Once the resolution loss is done once it is reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jpg makes use of (2) by transforming each 8x8 block of the picture into the frequency domain, and then quantizing the high frequencies (as described in @sellibitze's post).  Again once the quantization is done it is reversible.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastActivityDate="2014-03-24T15:08:31.187" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15206" PostTypeId="1" AcceptedAnswerId="15207" CreationDate="2014-03-24T17:23:57.140" Score="17" ViewCount="8010" Body="&lt;p&gt;I have a friend working in wireless communications research. He told me that we can transmit more than one symbol in a given slot using one frequency (of course we can decode them at the receiver).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The technique as he said uses a new modulation scheme. Therefore if one transmitting node transmits to one receiving node over a wireless channel and using one antenna at each node, the technique can transmit two symbols at one slot over one frequency.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I am not asking about this technique and I do not know whether it is correct or not but I want to know if one can do this or not? Is this even possible? Can the Shannon limit be broken? Can we prove the impossibility of such technique mathematically?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Other thing I want to know, if this technique is correct what are the consequences? For example what would such technique imply for the famous open problem of the interference channel? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any suggestions please? Any reference is appreciated.  &lt;/p&gt;&#xA;" OwnerUserId="8342" LastEditorUserId="1629" LastEditDate="2016-09-08T18:59:20.893" LastActivityDate="2021-09-29T19:04:17.637" Title="Can we break the Shannon capacity?" Tags="|modulation|reference-request|channelcoding|" AnswerCount="6" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15207" PostTypeId="2" ParentId="15206" CreationDate="2014-03-24T17:51:52.077" Score="22" Body="&lt;p&gt;Most certainly not. While there has been some claims to break Shannon here and there, it usually turned out that the Shannon theorem was just applied in the wrong way. I've yet to see any such claim to actually prove true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some methods known that allow for transmission of multiple data streams at the same time on the same frequency. The MIMO principle employs spatial diversity to achieve that. Comparing a MIMO transmission in a scenario that offers high diversity with the Shannon limit for a SISO transmission in an otherwise similar scenario might actually imply that the MIMO transmission breaks Shannon. Yet, when you write down the Shannon limit correctly for the MIMO transmission, you again see that it still holds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another technique to transmit on the same frequency at the same time in the same area would be CDMA (Code Division Multiple Access). Here, the individual signals are multiplied with a set of orthogonal codes so that they can be (perfectly in the ideal case) separated again at the receiver. But multiplying the signal with the orthogonal code will also spread its bandwidth. In the end, each signal employs much more bandwidth than it needs and I've never seen an example where the sum of the rates was higher than Shannon for the whole bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you can never be sure that breaking Shannon is actually impossible, it is a very fundamental law that stood the test of time for a long time. Anyone claiming to break Shannon has most likely made a mistake. There needs to be overwhelming proof for such a claim to be accepted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, transmitting two signals on the same frequency at the same time in the same area is easily possible using the correct method. This is by no means an implication that Shannon is broken.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastEditorUserId="-1" LastEditDate="2014-03-28T00:18:13.553" LastActivityDate="2014-03-28T00:18:13.553" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15208" PostTypeId="2" ParentId="15172" CreationDate="2014-03-24T18:42:44.327" Score="1" Body="&lt;p&gt;There are more than just one way to approach the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) You can find the steady state error by finding the equation of the denominator of the transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In system 1: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D(s) = a(s)p(s) + b(s)q(s)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The order of the system is determined by this order of $D(s)$. Solving for $D(s)$ will give you the poles of the system. If the poles 'solutions of $D(s)$' all are negative. That means if all the values of the solution to $D(s)$ are in the left half plane $&amp;lt;0$. This means the system is stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The error in time domain is defined as &quot;input - output&quot;.&#xA;That is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e(t) = y_r(t) - y(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to compute the steady state error, that is time at infinity 'after a long time'.&#xA;The equation will be: $$ e_{ss} = \lim_{t \to \infty}  y_r(t) - y(t) $$&#xA;That is simply taking the limit as t goes to infinity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, using the final value theorem to compute the steady state error in the $s$ domain the equation will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_{ss} = \lim_{ s \to 0} E$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is in your terms&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_{ss} = \lim_{s \to 0} s\cdot e_{ss1} \quad(1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_{ss} = \lim_{s \to 0} s\cdot e_{ss2} \quad(2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore; you can note that the result depends on the 'Type of the system and the Input'.&#xA;Type of the system: is how many poles at zero do you have?&#xA;That is writing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(s)p(s) + b(s)q(s) = s^n (s+a_0)(s\cdot a_1) \cdot ... \cdot(s\cdot a_{n-1})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the value n represents the order of the system.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type zero means no poles to zero.&lt;/li&gt;&#xA;&lt;li&gt;Type I means one pole at zero, etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now if the input is a unit step that is $$y_r(s) = \dfrac{1}{s}$$ &#xA;this will cancel out with the $s$ as specified in equations $(1)$ and $(2)$. The equation will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ e_{ss1} = \lim_{s \to 0} \dfrac{r(s)a(s)}{a(s)p(s)+b(s)q(s)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, looking at the type of system: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If it is of type one or higher, it is clear now that the $e_{ss1}$ goes to&#xA;infinity yielding unstable system.&lt;/li&gt;&#xA;&lt;li&gt;If type zero, it will have a certain value, yet still stable.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These are the techniques, and the answer highly depends on the type of the system or even the characteristic equation that is the equation of the denominator of the transfer function.&lt;/p&gt;&#xA;" OwnerUserId="8348" LastEditorUserId="8202" LastEditDate="2014-04-23T20:21:17.990" LastActivityDate="2014-04-23T20:21:17.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15209" PostTypeId="2" ParentId="15206" CreationDate="2014-03-24T18:50:53.800" Score="16" Body="&lt;p&gt;The capacity of a channel should be viewed as analogous to the&#xA;speed limit on a highway. It &lt;em&gt;is&lt;/em&gt; possible to travel at a speed &#xA;greater than the posted limit on a highway but it is &lt;em&gt;not&lt;/em&gt; possible&#xA;to achieve good gas mileage while doing so.  Similarly, it&#xA;&lt;em&gt;is&lt;/em&gt; possible to transmit data at rates higher than the capacity &#xA;of the channel (in fact, unlike highways, there are no&#xA;cops who will try to stop you from doing so) but it &lt;em&gt;not&lt;/em&gt; possible to&#xA;transmit at such high rates with very small error probability.  If we&#xA;don't care about BER, it is possible to send &quot;data&quot; over the channel&#xA;at arbitrarily high rate. Of course, most of what the receiver will&#xA;get is sheer garbage, but we have agreed that BER is not important.&#xA;For example, in a pulse amplitude modulation&#xA;(PAM) system with fixed maximum transmitter power, we can use binary&#xA;modulation to transmit (maximum power) pulses of amplitude $\pm A$ &#xA;in each signaling interval of duration $T$ and achieve a data rate&#xA;of $T^{-1}$ bps, or we could use quaternary modulation and&#xA;transmit pulses of amplitude $\pm A$ or $\pm A/3$ to get a data&#xA;rate of $2T^{-1}$ bps or octonary modulation with pulses of amplitude $\pm A$,&#xA;$\pm \frac{5}{7}A$, $\pm \frac{3}{7}A$, $\pm \frac{1}{7}A$ to get a data&#xA;rate of $3T^{-1}$ bps, etc.  The BER gets progressively worse as the&#xA;number of levels increase and they are spaced closer and closer together,&#xA;but hey, we agreed that BER is not a concern; data rate is.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What information theory tells us is that if we restrict ourselves&#xA;to communication schemes that have data rates smaller than the&#xA;channel capacity, then we can achieve &lt;em&gt;any&lt;/em&gt; given BER no matter&#xA;how small. The schemes will be very complex, exorbitantly expensive&#xA;to implement, and have long delays (latency) if the desired BER&#xA;is very small, but they exist and can be found (though the search&#xA;might require immense effort). But the capacity of a channel&#xA;is not like the&#xA;velocity of light in physics: a fundamental limit that cannot be&#xA;exceeded. It &lt;em&gt;is&lt;/em&gt; possible to transmit at rates higher than&#xA;the capacity, just not reliably.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-03-24T18:50:53.800" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15210" PostTypeId="2" ParentId="15203" CreationDate="2014-03-24T19:54:33.447" Score="6" Body="&lt;p&gt;Assuming independent random variables with normal distributions, the probability that a value will fall beyond, say, 2 standard deviations will be about 0.01.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a median filter of width 3, that triplet must contain two outliers on the same side of the mean in order for an outlier to come through. This event has a probability of $2 \cdot 0.005^2 =$ 0.00005.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the median filter increases in width, the probability of an outlier making it through decreases exponentially.&lt;/p&gt;&#xA;" OwnerUserId="7883" LastActivityDate="2014-03-24T19:54:33.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15213" PostTypeId="1" CreationDate="2014-03-24T17:20:24.397" Score="0" ViewCount="96" Body="&lt;p&gt;I have a friend working in wireless communications research. He told me that we can transmit more than one symbol in a given slot using one frequency (of course we can decode them at the receiver).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The technique as he said uses a new modulation scheme. Therefore if one transmitting node transmits to one receiving node over a wireless channel and using one antenna at each node, the technique can transmit two symbols at one slot over one frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not asking about this technique and I do not know whether it is correct or not but I want to know if one can do this or not? Is this even possible? Can the Shannon limit be broken? Can we prove the impossibility of such technique mathematically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other thing I want to know, if this technique is correct what are the consequences? For example what would such technique imply for the famous open problem of the interference channel? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions please? Any reference is appreciated.  &lt;/p&gt;&#xA;" OwnerUserId="8342" OwnerDisplayName="user3439590" LastEditorUserId="26573" LastEditDate="2019-04-23T03:12:24.603" LastActivityDate="2019-04-23T03:12:24.603" Title="Can we break the Shannon capacity?" Tags="|channelcoding|" AnswerCount="0" CommentCount="2" ClosedDate="2014-03-25T18:19:20.243" ContentLicense="CC BY-SA 3.0" />
  <row Id="15214" PostTypeId="1" AcceptedAnswerId="50241" CreationDate="2014-03-24T23:38:34.523" Score="2" ViewCount="213" Body="&lt;p&gt;Given $ M \in \mathbb{R}^{N \times N} $ which is a Positive Definite Matrix.&lt;br&gt;&#xA;Let $ \hat{x} $ the MMSE of $ x $ given $ z $, namely $ \hat{x} = \mathbb{E} \left[ x \mid z \right] $.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prove the equivenalce of the following expressions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$ \arg \min_{\hat{x}} \mathbb{E} \left[ {\left( \hat{x} - x \right)}^{T} \left( \hat{x} - x \right) \mid z \right] $.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$ \arg \min_{\hat{x}} \mathbb{E} \left[ {\left( \hat{x} - x \right)}^{T} M \left( \hat{x} - x \right) \mid z \right] $.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$ \arg \min_{\hat{x}} \operatorname{Tr} \left( M \mathbb{E} \left[ {\left( \hat{x} - x \right)}^{T} \left( \hat{x} - x \right) \mid z \right] \right) $&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Equivalence means all are actually minimized by $ \hat{x} = \mathbb{E} \left[ x \mid z \right] $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equivalence of 2 and 3 is easy using the Cyclic Property of the $ \operatorname{Tr} \left( \cdot \right) $ operator.&lt;br&gt;&#xA;Yet showing the invertible transformation keeps the solution (Equivalence of 1 and 2) isn't trivial.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2021-07-16T05:35:48.687" LastActivityDate="2022-01-13T11:08:59.990" Title="Minimum Mean Square Estimator - Equivalent Expressions to Minimize" Tags="|estimation|statistics|math|bayesian-estimation|estimators|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15215" PostTypeId="1" CreationDate="2014-03-25T01:08:34.270" Score="4" ViewCount="2568" Body="&lt;p&gt;I want to implement the following algorithm. Let  $I$  denote  noisy  image  and  for  each  pixel of  $I$  is represented by $I(x,y)$. A Sliding window of size $3\times3$ centered at $I(x, y)$ is defined. At first we estimate that the center pixel of window is noise or not. To differ the noise and signal, we calculate the mean ($m$) and standard deviation ($s$) of the window. If the pixel is between $m-s$ and $m+s$ then it is a signal otherwise noise and we will apply weiner Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.  Read an Image I.&#xA;2.  Take a Sliding Window or Mask of size 3X3.&#xA;3.  Calculate the Mean (m) and Standard deviation (s) from the Mask.&#xA;4.  Calculate the threshold as follows &#xA;         t1 = m-s and t2 = m+s&#xA;&#xA;5.  IF     t1 &amp;lt;= I(x,y) and  I(x,y)  &amp;lt;= t2 THEN&#xA;&#xA;           Result(x,y) = I(x,y)&#xA;    ELSE&#xA;        Result(x, y) = weiner2(I(x,y)&#xA;&#xA;6.  Repeat the step 3 , 4 and 5 on Entire Image.&#xA;7.  Display the Resultant Image.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First, I tried to implement this algorithm for median filter, so that I can extend it to other filters such as wiener, anisotropic diffusion,butterworth etc.  I did implement it correctly with the help of 'tbirdal'. Thank you 'tbirdal'. But I am unable to extend the implementation for other filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**I don't want to use loop.. Because it takes more time to run .. 20 mins to run a $512 \times 512$ image.. I want to implement this using functions such as nlfilter, imfilter etc **&#xA;Program:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A=imread('npan3.jpg');&#xA;&#xA;&#xA;fun = @(x) noisedetect_2(x(:));&#xA;B = nlfilter(A,[3 3],fun);&#xA;&#xA;imshow(A), figure, imshow(B, [])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;noisedetect_2&lt;/code&gt; function is given as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function nd=noisedetect_2(sub)&#xA;sub=vec2mat(sub,3);&#xA;[row col]=size(sub);&#xA;%siz=size(sub)&#xA;s=std2(sub);&#xA;m=mean2(sub);&#xA;t1=m-s;&#xA;t2=m+s;&#xA;nd=zeros(row,col);&#xA;&#xA;if (sub(2,2)&amp;gt;=t1 &amp;amp;&amp;amp; sub(2,2)&amp;lt;=t2)&#xA;    nd=sub;&#xA;else    &#xA;    nd=wiener2(sub);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Assignment has more non-singleton rhs dimensions than non-singleton subscripts&#xA;&#xA;Error in nlfilter (line 75)&#xA;        b(i,j) = feval(fun,x,params{:});&#xA;&#xA;Error in nd_test_2 (line 10)&#xA;B = nlfilter(A,[3 3],fun);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I understand what the error means. the &lt;code&gt;nlfilter&lt;/code&gt; is expecting single value but the function returns $3\times3$ matrix. How to solve this issue?. I just want to apply any filter only when the pixel falls out of the range $t_1$ and $t_2$ because it is considered as noisy pixel. Otherwise, it is retained as such because it is considered as noisefree pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me implement the algorithm.&lt;/p&gt;&#xA;" OwnerUserId="5800" LastEditorUserId="128" LastEditDate="2020-10-05T15:10:34.430" LastActivityDate="2020-10-05T15:10:34.430" Title="Image Noise Detection Using MATLAB" Tags="|image-processing|matlab|noise|denoising|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15216" PostTypeId="2" ParentId="15214" CreationDate="2014-03-25T04:01:00.370" Score="2" Body="&lt;p&gt;Use the Cholesky decomposition of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as a change of coordinates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$tr(ABC) = tr(CAB)$&lt;/span&gt; - trace is invariant under cyclic permutations, and &lt;span class=&quot;math-container&quot;&gt;$tr(scalar)=scalar$&lt;/span&gt;. Thus, &lt;span class=&quot;math-container&quot;&gt;$tr(M E[ x x^T]) = tr(E[M x x^T]) = E[tr(M x x^T) ] = E[tr( x^T M x ) ] = E[x^T M x]$&lt;/span&gt;. Now, replace &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\hat{x}-x$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="128" LastEditDate="2022-01-13T11:08:59.990" LastActivityDate="2022-01-13T11:08:59.990" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="15218" PostTypeId="1" AcceptedAnswerId="15226" CreationDate="2014-03-25T06:47:12.487" Score="4" ViewCount="14913" Body="&lt;p&gt;I am finding the techniques to remove unwanted regions (small dots) from image. I have an image that includes object and some unwanted region (small dots- see first image). I want to remove it. Hence, I use some morphological operator example 'close' to remove. But it is not perfect. Do you have other way to remove more clear (similar second image)? You can download example image at &lt;a href=&quot;https://www.dropbox.com/s/rz4s8lsnu0kg43k/Image.mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tx9dz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PJ4Bo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2020-06-30T11:18:32.330" Title="Best way to remove unwanted region from image" Tags="|image-processing|image-segmentation|classification|morphological-operations|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15219" PostTypeId="1" AcceptedAnswerId="15220" CreationDate="2014-03-25T07:07:28.900" Score="0" ViewCount="6569" Body="&lt;p&gt;Let us suppose that we have modeled signal using AR model, and suppose we have following model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/faS9k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used spectral estimation function from MATLAB&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pyulear&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now frequencies are given in normalized frequencies and I would like to know how to convert them back to real frequencies? From there it is clear that we have four deterministic model and also plus some white noise, actually I want to know approximate frequencies in each deterministic model. I can of course determine this frequencies using  FFT, periodogram and so on, but I am studying application of the AR/ARMA model. So in my case, I have such frequencies on following figures, how can I determine actual frequencies? Thanks in advance.&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="8202" LastEditDate="2014-03-25T10:10:30.877" LastActivityDate="2015-06-07T19:43:21.860" Title="Convert normalized frequency to real frequency in AR model" Tags="|matlab|frequency-spectrum|continuous-signals|frequency-domain|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15220" PostTypeId="2" ParentId="15219" CreationDate="2014-03-25T09:08:41.030" Score="0" Body="&lt;p&gt;Matlab generally uses normalized frequencies in radians/sample. If the signal is real-valued then these frequencies are in the interval $[0,\pi]$ (as you can see in the plot). The Matlab frequency variable $w$ is normalized as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w=\frac{2\pi f}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sampling frequency. So $w=\pi$ corresponds to $f=f_s/2$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-25T09:08:41.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15221" PostTypeId="1" CreationDate="2014-03-25T10:03:17.937" Score="4" ViewCount="1808" Body="&lt;p&gt;I have a C# desktop application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a wrapper to OpenCV which is EMGU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am just performing a basic motion detection operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using component labelling and 2 frames differencing to determine motion changes.  I am also using an averaging background approach to update the background which i use to 'subtract' from the current and previous frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All this works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BrOp1.jpg&quot; alt=&quot;Green Bush&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because this bush is close to the camera, movement will be detected by my current methods when the wind blows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, consider this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NHy8L.jpg&quot; alt=&quot;CobWeb&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here we see a cobweb to the right of the image. Again when the wind blows I get motion detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My possible solutions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look for shapes. In the case of elongated shapes like the cobweb where the height is greater than the width (to a certain scale) then ignore that movement.&#xA;But, I found I am missing motion when someone walks on the pavement at the back of the image from across the road.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Erosion.&#xA;Again I am missing genuine motion like people and bikes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compare Histograms&#xA;I have found it is not reliable.  A histogram will only measure the number of different colours (in its own bin).  It is possible for the colours to change due to the saturation and lighting or/and the same numbers of colours are found because another object has passed by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I thought about using atrophy. I did post an earlier question to this here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/15179/entropy-of-an-image&quot;&gt;Entropy of an image&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but as the person who so kindly explained entropy suggested that I should post as a specific/separate question here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to explore whether the frequency or/and entropy would help me here?  Should I look at spatial or frequency distribution?  Would frequency be best to look into if I want to avoid colour changes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would either approach be faster than the other as I want it real-time as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any eduction for me here would be great.&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-03-25T12:46:50.760" Title="Entropy/frequency of a natural image" Tags="|image-processing|c#|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15223" PostTypeId="2" ParentId="15218" CreationDate="2014-03-25T12:27:30.173" Score="0" Body="&lt;p&gt;You could try to apply anisotropic filtering as described by Perona and Malik (and many papers after that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would go in two steps:&#xA;-first step low pass filter of your image, likely the unwanted region will be smoothed out, but the good region will be a bit blurred.&#xA;-second step apply a diffusion a la perona and malik and use the first step to speed/slow diffusion depending you are in the good region (with data left) or a bad one (filtered out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is however if you are ok with obtaining a greyscale image, if you want to keep it binary it would not work I guess.&lt;/p&gt;&#xA;" OwnerUserId="8363" LastActivityDate="2014-03-25T12:27:30.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15224" PostTypeId="2" ParentId="13551" CreationDate="2014-03-25T12:38:57.807" Score="1" Body="&lt;p&gt;It seems you obtain one value for each time considered.&#xA;You should be taking the fourier transform of the signal with a window centered on the point t1, this gives you a spectrum (a vector, not a scalar), move to t2, repeat that gives a second spectrum and so on.&#xA;Spectrogram will be a collection of spectra indexed by time, it is a time/frequency representation, your result is 1D not 2D&lt;/p&gt;&#xA;" OwnerUserId="8363" LastActivityDate="2014-03-25T12:38:57.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15225" PostTypeId="2" ParentId="15221" CreationDate="2014-03-25T12:46:50.760" Score="4" Body="&lt;p&gt;Entropy would be a good metric in order to separate trees. However I would suggest you to calculate the entropy of gray values within a rectangular window. Consider this image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Os8NX.png&quot; alt=&quot;Aerial Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After entropy filter, I could obtain this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GJyFj.png&quot; alt=&quot;Entropy filtered image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the trees (and also other informative areas) look white and it's possible to segment them out with a simple threshold. Try and see whether it also works for your case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the possible pre-computations, this could be optimized to run in real-time.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-25T12:46:50.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15226" PostTypeId="2" ParentId="15218" CreationDate="2014-03-25T13:15:23.577" Score="2" Body="&lt;p&gt;Looks like you are using Matlab. Try &lt;a href=&quot;http://www.mathworks.com/help/images/ref/bwareaopen.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;bwareaopen(I, N)&lt;/code&gt;&lt;/a&gt;, where &lt;code&gt;I&lt;/code&gt; is the original binary image and &lt;code&gt;N&lt;/code&gt; is the estimated size of each unwanted connected region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try &lt;code&gt;edit bwareaopen&lt;/code&gt; for more details. Basically the algorithm tries to find the size of connected regions. &lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling&quot; rel=&quot;nofollow&quot;&gt;Connected-component labeling&lt;/a&gt; with &lt;a href=&quot;http://en.wikipedia.org/wiki/Disjoint-set_data_structure&quot; rel=&quot;nofollow&quot;&gt;union-find&lt;/a&gt; algorithm is expected to get you there.&lt;/p&gt;&#xA;" OwnerUserId="7092" LastEditorUserId="7092" LastEditDate="2014-03-25T13:52:41.670" LastActivityDate="2014-03-25T13:52:41.670" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15227" PostTypeId="1" AcceptedAnswerId="15274" CreationDate="2014-03-25T13:15:36.467" Score="2" ViewCount="232" Body="&lt;p&gt;I  am interested in spectral resolution of spectral estimation methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you point me to some good literature, videos or books from which i can read and study?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to understand how to resolve  two closed spaced sinusoids:&#xA;$$&#xA;x_1(t) = \sin(\omega_1 t + \phi_1) \\&#xA;x_2(t) = \sin(\omega_2 t + \phi_2) \\&#xA;$$&#xA;where $\omega_1 \approx \omega_2$.&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="80" LastEditDate="2014-03-25T18:11:50.177" LastActivityDate="2014-03-27T14:20:34.403" Title="literature related to Spectral resolution" Tags="|signal-analysis|signal-detection|resolution|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15229" PostTypeId="2" ParentId="15218" CreationDate="2014-03-25T15:41:13.270" Score="2" Body="&lt;p&gt;Referring to MATLAB, the basic steps are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determine the connected components:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;CC = bwconncomp(BW, conn);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compute the area of each component:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;S = regionprops(CC, 'Area');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remove small objects:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;L = labelmatrix(CC);&#xA;BW2 = ismember(L, find([S.Area] &gt;= P));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the last step, after obtaining &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;, you might as well retain the component with the largest area if you are interested in a single component. This would make the algorithm invariant to the size of the noise.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2018-12-05T12:41:40.530" LastActivityDate="2018-12-05T12:41:40.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15230" PostTypeId="2" ParentId="15163" CreationDate="2014-03-25T16:11:16.733" Score="2" Body="&lt;p&gt;The first question to be decided here if the system whose behavior is described by the input-output relationship:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u(t)\sin(\omega t) \to u(t)(1+e^{-t})\sin(\omega t)\tag{1}$$&#xA;is indeed a LTI system.  The unstated assumption here is that &lt;strong&gt;$(1)$ holds for &lt;em&gt;all&lt;/em&gt;&#xA;$\omega$.&lt;/strong&gt;  Now, if the system is indeed a causal LTI system with &#xA;impulse response $h(t)$, then&#xA;its response to the signal $u(t)\sin(\omega t)$ is given by &#xA;$$y(t) = \int_{-\infty}^{\infty} h(\tau)u(t-\tau)\sin(\omega (t-\tau))\,\mathrm d\tau&#xA;= \int_{0}^t h(\tau)\sin(\omega(t-\tau))\,\mathrm d\tau, \quad t &amp;gt; 0$$&#xA;where (as usual) we have changed the limits on the integral by taking advantage&#xA;of the fact that $u(t-\tau)$ makes a transition&#xA;from $1$ to $0$ as soon as $\tau$ sweeps past $t$ as $\tau$ increases&#xA;from $-\infty$ to $\infty$, and second by using our knowledge that&#xA;$h(\tau) =0$ for all $\tau &amp;lt; 0$.  Now, this integral &lt;em&gt;should&lt;/em&gt; work out&#xA;to be of the form $$a(\omega, t)\sin(\omega t) + b(\omega, t)\cos(\omega t) \tag{2}$$&#xA;because the antiderivative of $\sin(\omega(t-\tau))$ is $\frac{1}{\omega}\cos(\omega(t-\tau))$ and so $\omega$ &lt;em&gt;should&lt;/em&gt; show up somewhere in the&#xA;&lt;em&gt;coefficients&lt;/em&gt; of $\sin(\omega t)$ and $\cos(\omega t)$.  But it doesn't;&#xA;we are told that $(2)$ works out to be $(1+e^{-t})$, that is,&#xA;$b(\omega, t) = 0$ and $a(\omega, t) = 1+e^{-t}$ is a function of $t$ only.  So,&#xA;there is something fishy here.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-03-25T16:11:16.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15231" PostTypeId="1" CreationDate="2014-03-25T17:29:13.257" Score="0" ViewCount="1125" Body="&lt;p&gt;I am trying to implement an algorithm in real-time on a Fixed point DSP (The Blackfin from Analog Devices). The algorithm does a lot of stuff, but in the middle it performs an algorithm called &quot;Fast Data Projection Method&quot; (FDPM), which goes something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\mathbf{x}_{k} = [x_{1}, x_{2},\dotsb,x_{M}]^{T}$ be a random vector which contains $M$ samples from a discrete signal. In the Process we take sequentially many vectors from the sampled signal with some degree of overlapping, but that is not relevant.  We can assume that the vectors $\mathbf{x}_{k}$ come one after another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FDPM aims at obtaining a matrix $W \in \mathbb{R}^{M\times N}$ whose columns are the eigenvectors of the correlation matrix $R_{x} = E[\mathbf{x}\mathbf{x}^{T}]$ of the vector $\mathbf{x}$. So we initiallize the algorithm with a random matrix $W_{0}$ (Can also be the identity matrix), and perform the following steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - $\mathbf{y}_{k} = W_{k}^{T}\mathbf{x}_{k}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - $\mathbf{a}_{k} = \mathbf{y}_{k} - \|\mathbf{y}_{k}\|\mathbf{e}_{1}$,  (Where $\mathbf{e}_{1} = [1,0,0,\dotsb,0]^{T}$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - $G_{k+1} = I-\frac{2}{\|\mathbf{a}_{k}\|^{2}}\mathbf{a}_{k}\mathbf{a}_{k}^{T}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 - $W_{k+1} = Normalize\{\left[W_{k}+\mu_{k}\mathbf{x}_{k}\mathbf{x}_{k}^{T}W_{k}\right]G_{k+1}\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $Normalize\{·\}$ stand for normalizing each of the columns of the matriz individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the problem is the following. I have tested this algoritm in MATLAB with double precisiòn and it works fine, i am able to obtain the eigenvectors very close to the real signal eigenvectors and the algorithms does it's job, no problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is, when i use the fixed point toolbox to perform this operations with 16bit numbers in Q15 format, then everything goes wrong. The first one or two iterations have small error, but quickly all the vectors start to saturate (The components go to either 1 or -1) and while the matrices do not saturate, they converge to a matrix which is orthogonal to the same matrix calculated with double precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am guessing that the loss of precision occurred by casting to 16bit affects too much, so i think i might have to do some signal scaling or some &quot;re normalization&quot; every once in a while, but i have no idea how to analize the problem and how to know where i have to modify the algorithm to make it work in 16bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone ever worked with this type of problem? anyone has any idea what i could do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-03-25T17:29:13.257" Title="How to Prevent overflow/saturation in fixed point implementation of Fast Data Projection Algorithm" Tags="|matlab|matrix|fixed-point|quantization|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15232" PostTypeId="1" AcceptedAnswerId="15235" CreationDate="2014-03-25T18:03:32.507" Score="-1" ViewCount="174" Body="&lt;p&gt;i'm trying to filter a signal with a FFT. I window each block of signal (i use a 4096 points signal) and then remove some high frequencies by just multiplying the magnitude response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the result is : the more i remove highs, the more i have glitches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's bad to EQ directly with the FFT but i just want to know why there are some glitches&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i  tried to zero the DC, i tried to window another time the input window by a short amount (maybe not the clever thing to do).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have less clics when using a Nutall window, compared to a Hamming or Hanning, and the clics seems to appear every FFTSize/2 samples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, why clics? and what is the remedy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank you gentlemen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: i've searched everywhere without getting a proper solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit 2 : you can try this matlab program, (i'm not very sure about the filtering part but if it's wrong correct it and it should glitch all the way)&#xA;&lt;a href=&quot;http://pastebin.com/8tBmjNqG&quot; rel=&quot;nofollow&quot;&gt;http://pastebin.com/8tBmjNqG&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="8366" LastEditDate="2014-03-25T18:44:03.530" LastActivityDate="2014-03-25T20:07:24.947" Title="glitches when performing EQ on an OLA FFT" Tags="|fft|equalization|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15233" PostTypeId="2" ParentId="15232" CreationDate="2014-03-25T19:24:52.783" Score="0" Body="&lt;p&gt;You get clicks because of time domain aliasing. Google &quot;overlap add&quot; (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&lt;/a&gt;) on how to properly EQ in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-25T19:24:52.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15234" PostTypeId="2" ParentId="15178" CreationDate="2014-03-25T19:33:22.690" Score="0" Body="&lt;p&gt;To answer inside the framework you set:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the CWT domain the frequencies will stay the same, the wavelet will behave just like any other filter. It will only filter out frequencies, not change them. You can see banded regions in the image where the peaks are. Since you picked a wavelet that does not have a very steep frequency response, &quot;beating&quot; is visible and appears to be about as strong as the signal itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you choose a wavelet with better frequency resolution (a longer one), the signals will stand out better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you try to do a DWT, you will get aliases, and the signals are not far enough apart to separate them completely.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-25T19:33:22.690" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15235" PostTypeId="2" ParentId="15232" CreationDate="2014-03-25T20:07:24.947" Score="0" Body="&lt;p&gt;Zero-ing isolated FFT bins can create a very long impulse response (above some noise floor), so your FFT length may need to be a lot longer than both the data window plus your current amount of zero-padding to prevent the impulse response from wrapping around circularly.  Or your can use a filter response with shallower transition bands, which usually represents a shorter impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, one uses a rectangular window when doing overlap-add FFT fast convolution filtering, not a Nutall or Von Hann window.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-25T20:07:24.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15236" PostTypeId="2" ParentId="15227" CreationDate="2014-03-25T20:13:57.003" Score="0" Body="&lt;p&gt;You could start by looking into the MUSIC and ESPIRIT algorithms for constrained parameter estimation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-25T20:13:57.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15237" PostTypeId="2" ParentId="15227" CreationDate="2014-03-25T20:38:24.377" Score="0" Body="&lt;p&gt;Look into the &quot;Chirp z transform&quot; (somtimes referred to as the zoom FFT&quot;).  You can go to a good standard DSP reference. I believe you can find this as public domain on the internet. The book is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Digital Signal Processing&quot; by Oppenheim and Schafer&#xA;See chapter 6, section 6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This techniques allows you to concentrate you're calculations on a narrow range of frequencies. You would &quot;zoom&quot; into the range of your two closely spaced sine waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also google &quot;chirp z transform&quot;, &quot;zoom z transform&quot; or &quot;zoom FFT&quot;.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2014-03-26T00:00:25.843" LastActivityDate="2014-03-26T00:00:25.843" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15238" PostTypeId="2" ParentId="15163" CreationDate="2014-03-25T22:17:34.483" Score="4" Body="&lt;p&gt;As already pointed out in Hilmar's answer, a linear time-invariant (LTI) system is completely described by its impulse response, or - equivalently - by its frequency response, which is the Fourier transform of its impulse response. I think that there is a misunderstanding concerning the Fourier transform, namely that it can only be used to describe steady-state responses to infinitely long sinusoidal input signals, but this is definitely not the case. I think it's illustrative to look at an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume we have a causal real-valued LTI system with frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=A(\omega)+jB(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A(\omega)$ and $B(\omega)$ are the real and imaginary parts of $H(\omega)$, respectively. Now let's define an input signal to this system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=u(t)\sin(\omega_0t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its Fourier transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\frac{\pi}{2j}[\delta(\omega-\omega_0)-\delta(\omega+\omega_0)]&#xA;+\frac{\omega_0}{\omega_0^2-\omega^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using $A(\omega)$ and $B(\omega)$, the imaginary part of the Fourier transform of the output signal $y(t)$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Im\{Y(\omega)\}=-\frac{\pi}{2}[A(\omega_0)\delta(\omega-\omega_0)-A(-\omega_0)\delta(\omega+\omega_0)]-\frac{\omega_0B(\omega)}{\omega^2-\omega_0^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $y(t)=0$ for $t&amp;lt;0$ (because this is true for $x(t)$ and because the system is causal), it is fully described by the imaginary part of its Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=-\frac{2}{\pi}\int_{0}^{\infty}\Im\{Y(\omega)\}\sin\omega t\; d\omega,\quad t&amp;gt;0\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) and (2) we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = A(\omega_0)\sin\omega_0t+\frac{2\omega_0}{\pi}\int_{0}^{\infty}\frac{B(\omega)}{\omega^2-\omega_0^2}\sin\omega t\;d\omega,\quad t&amp;gt;0\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (3) fully describes the response of the LTI system to the causal input signal $x(t)=u(t)\sin\omega_0 t$, including transients. This example is supposed to show that the frequency response (or the impulse response) is sufficient for a complete description of the system's response to arbitrary input signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Derivation of Equation (2):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $Y(\omega)=Y_R(\omega)+jY_I(\omega)$ be the Fourier transform of $y(t)$.&#xA;We need the following basic properties of the Fourier transform (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Functional_relationships&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)\textrm{ real-valued}\Longrightarrow Y(\omega)=Y^*(-\omega)$$&#xA;from which follows&#xA;$$Y_R(\omega)=Y_R(-\omega)\textrm{ and }Y_I(\omega)=-Y_I(-\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $y_e(t)=0.5[y(t)+y(-t)]$ is the even part of $y(t)$ and $y_o(t)=0.5[y(t)-y(-t)]$ is the odd part of $y(t)$ then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_e(t)\Longleftrightarrow Y_R(\omega)\\&#xA;y_o(t)\Longleftrightarrow jY_I(\omega)$$&#xA;These relation can be found in the link above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $y(t)$ is real-valued the inverse transform can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty}Y(\omega)e^{j\omega t}d\omega=&#xA;\frac{1}{2\pi}\int_{-\infty}^{\infty}\Re\{Y(\omega)e^{j\omega t}\}d\omega=\\&#xA;=\frac{1}{2\pi}\int_{-\infty}^{\infty}[Y_R(\omega)\cos(\omega t)-Y_I(\omega)\sin(\omega t)]d\omega=\\&#xA;=\frac{1}{\pi}\int_{0}^{\infty}[Y_R(\omega)\cos(\omega t)-Y_I(\omega)\sin(\omega t)]d\omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the last equality follows from the fact that the integrand is an even function of $\omega$.&#xA;Consequently we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_e(t)=\frac{1}{\pi}\int_{0}^{\infty}Y_R(\omega)\cos(\omega t)d\omega\\&#xA;y_o(t)=-\frac{1}{\pi}\int_{0}^{\infty}Y_I(\omega)\sin(\omega t)d\omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With these preliminaries we can finally state the result using the fact that for causal $y(t)$ the following holds for $t&amp;gt;0$ (because $y(-t)=0$ for $t&amp;gt;0$):&#xA;$$y(t)=2y_e(t)=2y_o(t),\quad t&amp;gt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\frac{2}{\pi}\int_{0}^{\infty}Y_R(\omega)\cos(\omega t)d\omega=\\&#xA;=-\frac{2}{\pi}\int_{0}^{\infty}Y_I(\omega)\sin(\omega t)d\omega,\quad t&amp;gt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last equality is the same as Equation (2) above.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-05-12T11:15:24.667" LastActivityDate="2014-05-12T11:15:24.667" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15239" PostTypeId="1" AcceptedAnswerId="15242" CreationDate="2014-03-25T22:32:35.443" Score="3" ViewCount="3787" Body="&lt;p&gt;I currently run real time audio through an FFT and the library (vDSP) returns magnitude and phase values (polar coordinates) for data in the FFT bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the bin with the highest magnitude always represent the fundamental frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What exactly can the phase of the frequency bins be used for in regards to audio? What does it represent? Would that be used for audio identification, e.g. matching amplitude and phase pairs within the same bins of different audio segments?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2014-03-25T22:41:27.423" LastActivityDate="2014-03-26T00:48:07.843" Title="What does the phase of a FFT bin of an audio signal represent?" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15240" PostTypeId="1" CreationDate="2013-01-28T01:56:20.707" Score="7" ViewCount="1978" Body="&lt;p&gt;i am trying to implement a short time fourier transform of an audio signal to do some filtering (subtract another stft signal using spectral subtraction). I am using a hamming window function with 50% overlap. Additional the size of my FFT is twice the window size, zeros at the end of the signal in time domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;mic is the input and output signal for in-place filtering&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is my code for so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    stftWindowSize = 256;&#xA;    stftWindowSizeOver2 = stftWindowSize/2;&#xA;    stftN = 512;&#xA;    stftLog2n = log2(stftN);&#xA;    stftNOver2 = stftN/2;&#xA;    stftSetup = vDSP_create_fftsetup (stftLog2n, FFT_RADIX2);&#xA;&#xA;//length is the complete signal to be processed&#xA;for(i = 0;i&amp;lt;(length/stftWindowSizeOver2)-1;i++){&#xA;&#xA;    //apply hamming window and copy to complex arrays&#xA;    vDSP_vmul(&amp;amp;mic[i*stftWindowSizeOver2],1,stftHamming,1,stftTmpStorage,1,stftWindowSize);&#xA;    vDSP_ctoz((DSPComplex *)stftTmpStorage, 2, &amp;amp;stftMic, 1, stftWindowSize);&#xA;&#xA;    //fft&#xA;    vDSP_fft_zrip(stftSetup, &amp;amp;stftMic, 1, stftLog2n, FFT_FORWARD);&#xA;&#xA;    //here shold the filtering happen right?&#xA;&#xA;    //inverse fft&#xA;    vDSP_fft_zrip(stftSetup, &amp;amp;stftMic, 1, stftLog2n, FFT_INVERSE);&#xA;&#xA;    //scale back&#xA;    float scale = 2*stftN;&#xA;    vDSP_vsdiv(stftMic.realp, 1, &amp;amp;scale, stftMic.realp, 1, stftNOver2);&#xA;    vDSP_vsdiv(stftMic.imagp, 1, &amp;amp;scale, stftMic.imagp, 1, stftNOver2);&#xA;&#xA;    //mic data back to real, clear original signal and add overlapping data back in&#xA;    vDSP_ztoc(&amp;amp;stftMic, 1, (COMPLEX *)stftTmpStorage, 2, stftWindowSizeOver2);&#xA;&#xA;    //set old signal to zero in non overlapping area and add&#xA;    if(i==0)&#xA;        vDSP_vclr(mic, 1, stftWindowSize);&#xA;    else&#xA;        vDSP_vclr(&amp;amp;mic[(i+1)*stftWindowSizeOver2], 1, stftWindowSizeOver2);&#xA;&#xA;    vDSP_vadd(stftTmpStorage,1,&amp;amp;mic[i*stftWindowSizeOver2],1,&amp;amp;mic[i*stftWindowSizeOver2],1,stftWindowSize);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;basically what im trying to do here is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;get chunk of float data of length: stftWindowSize (only half the data is &quot;new&quot; due to 50% overlap with previous chunk) from input/output signal mic&lt;/li&gt;&#xA;&lt;li&gt;apply hamming window&lt;/li&gt;&#xA;&lt;li&gt;compute FFT of the chunk + zeros at the end of signal with overall length: stftN&lt;/li&gt;&#xA;&lt;li&gt;compute inverse FFT&lt;/li&gt;&#xA;&lt;li&gt;scale back as a result of the FFT&lt;/li&gt;&#xA;&lt;li&gt;clear non overlapping area in innput/output signal mic.&lt;/li&gt;&#xA;&lt;li&gt;add my processed iFFT data back into mic with a 50% overlap with previous chunk data.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Problem:&lt;/strong&gt;&lt;br&gt;&#xA;as i'm not doing anything with my FFT-data the sound should be the same as before, but unfortunately it isn't. It sounds somewhat modified and especially low frequencies look significantly changed when i look at the spectrum of the signal before and after my STFT.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am i doing wrong? have i misunderstood the zero padding? is this method suited for filtering (especially spectral subtraction)?&lt;br&gt;&#xA;i hope you can help me!&lt;/p&gt;&#xA;" OwnerUserId="3160" OwnerDisplayName="Maximilian Körner" LastActivityDate="2020-05-10T00:05:35.553" Title="STFT overlap add method - What am i doing wrong?" Tags="|audio|filtering|fft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15241" PostTypeId="2" ParentId="15239" CreationDate="2014-03-26T00:16:39.773" Score="5" Body="&lt;p&gt;The frequency bin with the highest magnitude is very often not the fundamental pitch frequency, especially for lower (male) voices and larger stringed instruments.  It could instead represent a strong overtone or harmonic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT phase result is very important in representing any transient waveform shape or timing, for instance whether a note onset or percussive hit occurred toward the beginning or end of the FFT frame.  It's thus not very useful in matching sounds unless the FFT frame timing is somehow very precisely matched to the sound's timing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a very narrow-band signals that are stationary across multiple FFT frames with known time offsets, the FFT phase results can also potentially be used for frequency estimation finer than the FFT bin spacing resolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-26T00:48:07.843" LastActivityDate="2014-03-26T00:48:07.843" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15242" PostTypeId="2" ParentId="15239" CreationDate="2014-03-26T00:22:00.130" Score="5" Body="&lt;p&gt;It is difficult to assign meaning to individual phase values in an FFT.  If you wanted to reconstruct your original signal using each of the frequency components in the FFT, you would use the phase values to time align each of the sinusoids so you get the proper destructive and constructive interference to reproduce the original signal.  Altering the phase relationship of the frequency components can dramatically change the time domain representation of the signal (peaks and troughs can be shifted around this way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase is more meaningful when applied over a band of frequencies.  The cumulative effect of phase shift over a band of frequencies can delay the attack and or decay of audio signals.  This can be important in audio systems and in particular speaker design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look up &quot;Group delay and phase delay&quot; (google or enter in wikipedia) for a discussion of how these concepts affect sound quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be very difficult to do meaningful matching of audio signals by comparing values of FFT results.  You can do exact matches if things are properly time aligned, but even minor changes to the audio signals can cause major changes in FFT values.  For identification or matching of sounds, more complex methods are used.  For example speech recognition uses CEPSTRAL analysis which involves multiple transforms, filter banks and a log computation to create sets of &quot;feature&quot; coefficients (Mel frequency cepstral coefficients &#xA;) that can be compared for similarity.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2014-03-26T00:22:00.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15244" PostTypeId="1" AcceptedAnswerId="15254" CreationDate="2014-03-26T05:52:53.353" Score="0" ViewCount="809" Body="&lt;p&gt;I have an image with its type is 16 bit signed. I see some paper, the author often convert it to unsigned 8 bit. But they did not explain why they do it. Could you explain what is benefit of this work? And How to implement it by matlab code?&lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2023-03-17T10:34:11.687" Title="What is benefit when convert signed 16 bit to unsigned 8 bit in medical image?" Tags="|matlab|image-processing|image-segmentation|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15245" PostTypeId="1" AcceptedAnswerId="15246" CreationDate="2014-03-26T06:16:31.507" Score="2" ViewCount="2999" Body="&lt;p&gt;let us suppose that we some signal $x(t)$,which consist of sinusoidal   components and white noise,i would like to know how to use    chirp z transform for improving spectral resolution?i found   this article about  chirp z transform &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://prod.sandia.gov/techlib/access-control.cgi/2005/057084.pdf&quot; rel=&quot;nofollow&quot;&gt;http://prod.sandia.gov/techlib/access-control.cgi/2005/057084.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;also  similar  article on official matlab side&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/ref/czt.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/signal/ref/czt.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but  as i know always in spectral estimation methods,some  knowledge we should know how process is going,or  some other things,let us suppose that we know sampling frequency lat say $Fs=100$,and   also we know that it consist as i mentioned by periodic components(sin or cosine),but i dont  know number of components,neither frequency or neither phases(+neither amplitudes),how can i apply chirp z transform to this signal?we have just some signal samples  with size $N=294$ ,please help me how to  choose correct components so that  get  effectively spectral structure and if let say one frequency is $f_1=13$ and second $f_2=13.5$,this transform be able to separate this  frequencies from each other,thanks&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorDisplayName="user350" LastEditDate="2014-03-26T06:39:15.663" LastActivityDate="2016-06-12T15:27:58.973" Title="use chirp z transform for spectral resolution" Tags="|matlab|frequency-spectrum|z-transform|resolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15246" PostTypeId="2" ParentId="15245" CreationDate="2014-03-26T08:27:04.613" Score="5" Body="&lt;p&gt;If you have no prior knowledge about the approximate locations of the frequencies, the Chirp Z-transform is of no immediate use to you. The Chirp Z-transform functions like a magnifying glass, so you need to know where you want to look and the Chirp Z-transform will show you the details. I would suggest you use an FFT to get an idea where the frequencies are, and if you need a very high resolution in a certain area of the spectrum, then the Chirp Z-transform can be useful. However, if computational complexity and memory are no issue, you can simply use a long FFT to achieve the same. If you want to know more about the Chirp Z-transform I would recommend &lt;a href=&quot;http://www.ece.ucsb.edu/Faculty/Rabiner/ece259/Reprints/015_czt.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; to you.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-06-12T15:27:58.973" LastActivityDate="2016-06-12T15:27:58.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15248" PostTypeId="1" CreationDate="2014-03-26T13:01:30.327" Score="1" ViewCount="1872" Body="&lt;p&gt;I am planning to implement a pattern matching algorithm using something like correlation as a matching metric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the template I am going to use will, if present, have different sizes in the target images. The interval of sizes might be something like :&#xA;x 0.5 , x 0.75 , x 1.0 , x 1.25 , x 1.5 , x 2.0 of the original template size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To speed up the search it is suggested in various articles to build a gaussian pyramid of both the template and the target search image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am not able to relate in any meaningful way the number of pyramid levels to create (for model and for target) , the object scales as described above, and the gaussian filter sigmas (used when creating the pyramid) ! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone shed any light on this ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example 1 level of the pyramid reduces the resolution of the image by 2 (is this the same as saying that the image has been scaled by 0.5 ) ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Than what about a pyramid level of -1 (which should make the image bigger x 2.0) : with what gaussian filter should it be treated before upsampling ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about object scales (e.g. x 1.25) which fall in-between pyramid levels ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to anyone who could provide some insight/references,&#xA;    Todor&lt;/p&gt;&#xA;" OwnerUserId="8373" LastActivityDate="2014-05-27T16:03:53.183" Title="Computer Vision - Gaussian Pyramid, Scale Space and Pattern Matching" Tags="|computer-vision|gaussian|scale-space|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15249" PostTypeId="2" ParentId="15244" CreationDate="2014-03-26T13:02:22.560" Score="1" Body="&lt;p&gt;Other than the data being smaller and thus requiring less memory there is usually no benefit to converting to 8 bit unsigned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is never a benefit in terms of image quality, and there is usually not a benefit in terms of processing speed.  Most processors handle 16 bit values as fast as they do 8 bit values (though there are exceptions).  The one possible speed benefit is that more data will fit in the processor cache, which can make the processing faster.  At that level of detail you really just have to run it and see which way is faster.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-26T13:02:22.560" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15251" PostTypeId="2" ParentId="15244" CreationDate="2014-03-26T13:11:42.383" Score="0" Body="&lt;p&gt;I'm not sure but if you take the &lt;code&gt;IMA&lt;/code&gt;  type images they are all in GRAY scale so to represent that you'll  go from 0 to 255 and for this range you'll need only 8bits  , so it doesn't make sense to loose efficiency whit other data type&lt;/p&gt;&#xA;" OwnerUserId="1785" LastActivityDate="2014-03-26T13:11:42.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15252" PostTypeId="1" AcceptedAnswerId="15259" CreationDate="2014-03-26T14:28:22.557" Score="0" ViewCount="1413" Body="&lt;p&gt;Hello there I am a Student.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to know how to find the Natural and Total Response of the given system: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X3FUl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bl3Bj.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;where: $x(t)=e^{-t}u(t)$ and $y(0^+)=2, \dfrac{d}{dt}y(0^+)=3$. (If the image above is not clear) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for my exam preparation, please kindly help or at least specify where&#xA;I can find the solution for this question, and  best tutorial for signal and system.&lt;/p&gt;&#xA;" OwnerUserId="8169" LastEditorUserId="5069" LastEditDate="2014-03-26T14:50:46.270" LastActivityDate="2014-03-26T17:23:32.143" Title="how to find the &quot;Natural and Total Response&quot; of the system" Tags="|signal-analysis|continuous-signals|homework|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15253" PostTypeId="1" CreationDate="2014-03-26T15:09:35.477" Score="1" ViewCount="194" Body="&lt;p&gt;Coming from a photogrammetry background, I am quite familiar with camera calibration, and the common assumptions that are used for crowd-sourced images (i.e. center point in the middle of the image, pixel resolution from the EXIF data etc.). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have been wondering a maybe naive question lately: Can I calibrate a manipulated image (e.g. downloaded from twitter or facebook), that has possibly been cropped or maybe even resampled and has no EXIF data? The nice thing is: More than 4 ground control points in the desired object coordinate system can be asummed available. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any papers available on this problem?&lt;/p&gt;&#xA;" OwnerUserId="4689" LastActivityDate="2017-11-07T17:46:03.960" Title="(Rough) camera calibration of manipulated images" Tags="|computer-vision|camera-calibration|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15254" PostTypeId="2" ParentId="15244" CreationDate="2014-03-26T15:26:17.677" Score="1" Body="&lt;p&gt;Many image display devices only have an 8-bit DAC.  So if one wants to analyze only what will be displayed on such a device (without added dithering or noise filtering, etc.), one can convert to that 8-bit format and potentially save storage memory.  Many standard image file formats also only support 8 bits of luminance, so the same is true for data planned to be stored or transmitted in such a format.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this process is lossy, and will remove information that a display supporting greater luminance resolution (10-bit DAC, etc.) can display.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-26T15:26:17.677" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15255" PostTypeId="2" ParentId="3541" CreationDate="2014-03-26T15:44:39.003" Score="0" Body="&lt;p&gt;You could use half order filtres and filter bidirectionally, which worldwide result in linear phase. Even in case of real-time processing overlap and add block processing approximations could be used.&lt;/p&gt;&#xA;" OwnerUserId="8375" LastActivityDate="2014-03-26T15:44:39.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15256" PostTypeId="5" CreationDate="2014-03-26T16:24:02.747" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-03-26T16:24:02.747" LastActivityDate="2014-03-26T16:24:02.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15257" PostTypeId="4" CreationDate="2014-03-26T16:24:02.747" Score="0" Body="JPEG is a lossy image compression format, suitable for photographs and other natural images.  It attempts to compress the image while retaining its visual appearance, while allowing the compressor to trade image quality for file size." OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2014-03-26T16:32:30.693" LastActivityDate="2014-03-26T16:32:30.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15259" PostTypeId="2" ParentId="15252" CreationDate="2014-03-26T17:23:32.143" Score="1" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/42ACy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll assume you do do what a Laplace transform really is!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you have to do, is just compute the la place inverse for each part to get the result you want.&#xA;If you want the natural response only, just find the inverse Laplace transform of the noted part. If you want the total response just take the inverse Laplace transform for the whole factor.&lt;/p&gt;&#xA;" OwnerUserId="8348" LastActivityDate="2014-03-26T17:23:32.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15260" PostTypeId="1" AcceptedAnswerId="15354" CreationDate="2014-03-26T17:38:26.620" Score="3" ViewCount="1953" Body="&lt;p&gt;It is well known that a moving average algorithm done in the time domain is equivalent to a filter with frequency response $\mathrm{sinc}(\omega\tau)$ where $\tau$ is the averaging time. (see &lt;a href=&quot;https://dsp.stackexchange.com/a/9970/8376&quot;&gt;this related answer&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has the following beneficial property: you are streaming a time series of data ${x_n}$, and the average at any point ($a_n$) is just:&#xA;$$ a_n = a_{n-1} \frac{n-1}{n} + \frac{x_n}{n} .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus you may apply the above recursive algorithm for an arbitrary amount of time ($\tau$), and when you stop, the value you have is filtered by $\mathrm{sinc}(\omega\tau)$, and has a correspondingly reduced variance. Now the $\mathrm{sinc}$ function is a first order low pass, modulated by a $\sin$ envelope. So in effect you have done a first order low pass where the characteristic low pass time constant $\tau$ is equal to the length of the data stream, and $\tau$ was not necessarily known before you started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: is there some analogous procedure which allows for an (approximate) &lt;strong&gt;second order&lt;/strong&gt; low pass where the time constant is not known a priori? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possibility is to &quot;average the averages&quot; but that requires keeping all the averages in memory. Is there some law preventing such a procedure with small memory requirements?&lt;/p&gt;&#xA;" OwnerUserId="8376" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-04-01T18:48:37.887" Title="Is there an algorithm for second order filtering of data where the filter frequency is not known a priori?" Tags="|noise|lowpass-filter|filtering|moving-average|averaging|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15262" PostTypeId="2" ParentId="15260" CreationDate="2014-03-26T18:23:21.207" Score="0" Body="&lt;p&gt;Yes, you can do a second-order low-pass filter without using lots of memory.  The key is to use the fact that convolution is a linear operation.  You want to do the following:&#xA;$$&#xA;y(t) = (x(t)*f_1(t))*f_2(t)&#xA;$$&#xA;where $f_1(t)$ and $f_2(t)$ are your two moving average filters of unknown a priori width.  If we use the associative property of linearity we can do the following:&#xA;$$&#xA;y(t) = (x(t)*f_1(t))*f_2(t) = x(t)*(f_1(t)*f_2(t))&#xA;$$&#xA;You create a new filter by convolving the two averaging filters, and then using that composite filter to filter your data.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-03-26T18:23:21.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15263" PostTypeId="1" AcceptedAnswerId="15267" CreationDate="2014-03-26T19:27:03.963" Score="1" ViewCount="992" Body="&lt;p&gt;I'm going over the W3 PNG specification (creating a PNG library from scratch) and I've finally found how to create a green 1x1 image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying to create a bigger image of mixed Red, Green and Blue pixels. Let's say a 4x4 image. Sadly I'm getting all the pixels mixed and some of them are Black or Pink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Details:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Signature: OK&lt;/li&gt;&#xA;&lt;li&gt;IHDR: OK&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Width: 4   &lt;/li&gt;&#xA;&lt;li&gt;Heigh: 4 &lt;/li&gt;&#xA;&lt;li&gt;Bit depth: 8&lt;/li&gt;&#xA;&lt;li&gt;Color: 2&lt;/li&gt;&#xA;&lt;li&gt;Filter: 0&lt;/li&gt;&#xA;&lt;li&gt;Compression: 0&lt;/li&gt;&#xA;&lt;li&gt;Interlace: 0&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;IDATA: 4 chunks*&lt;/li&gt;&#xA;&lt;li&gt;IEND: OK&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;*IDATA chunks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;4 bytes length: Number of bytes of the DATA after Zlib deflate&lt;/li&gt;&#xA;&lt;li&gt;4*1 byte type: IDAT &lt;/li&gt;&#xA;&lt;li&gt;X bytes data: 4*4bytes unsigned integers, Zlib deflated, one after the other, Network byte order &#xA;&lt;ul&gt;&#xA;&lt;li&gt;255 for blue**&lt;/li&gt;&#xA;&lt;li&gt;65280 for green** &lt;/li&gt;&#xA;&lt;li&gt;16711680 for red**&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;4 bytes crc: OK &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;**Bitwise results of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alpha&amp;lt;&amp;lt;24 | red&amp;lt;&amp;lt;16 | green&amp;lt;&amp;lt;8 | blue&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With alpha, blue, green and red taking values from 0 to 255 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's wrong with this?&lt;/p&gt;&#xA;" OwnerUserId="8378" LastEditorUserId="8330" LastEditDate="2014-03-26T21:47:54.690" LastActivityDate="2014-03-26T21:47:54.690" Title="PNG IDAT specification" Tags="|image-processing|image-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15264" PostTypeId="2" ParentId="4788" CreationDate="2014-03-26T20:07:10.253" Score="2" Body="&lt;p&gt;Another word is &quot;stacking&quot;.  It is used to reduce CCD noise, to increase focal depth (by stacking images that are focused slightly differently), to improve very low-light astronomical photos, and to obtain high dynamic range (HDR) from a series of normal range images.  See&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Focus_stacking&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Focus_stacking&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.instructables.com/id/Astrophotography-Star-Photo-Stacking&quot; rel=&quot;nofollow&quot;&gt;http://www.instructables.com/id/Astrophotography-Star-Photo-Stacking&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/High_dynamic_range_imaging&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/High_dynamic_range_imaging&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8330" LastActivityDate="2014-03-26T20:07:10.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15265" PostTypeId="2" ParentId="4788" CreationDate="2014-03-26T20:30:42.033" Score="3" Body="&lt;p&gt;Intuitively, if You move the sensor $ N $ steps each at the size of $ \frac{1}{N} $ of its resolution you can get $ \times N $ more resolution.&lt;br&gt;&#xA;It is like a polyphase representation of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using estimation methods, any movement which is not an (Event with zero probability) integer multiplication of the resolution of the sensor, namely, fractional movement can be used to gather more data and enhance resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually those methods are called Super Resolution which is fancy name for Poly Phase representation and sampling and are sub problem in the Inverse Problem family in Image Processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, pay attention that many papers deals with Super Resolution yet the actually solve a different problem (Deconvolution of Single Image).&lt;br&gt;&#xA;While the problem you're after is also in the field of Inverse Problems, yet using multi images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the method you are after is mainly used in the Lithography industry.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-07-02T08:45:54.810" LastActivityDate="2018-07-02T08:45:54.810" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15266" PostTypeId="2" ParentId="15253" CreationDate="2014-03-26T20:37:50.523" Score="1" Body="&lt;p&gt;1) It seems to me that you don't care about solving for correspondences or obtaining any high level paradigm in that sense. So I would treat this problem as a minimal problem and redirect you to check:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cmp.felk.cvut.cz/minimal/&quot; rel=&quot;nofollow&quot;&gt;http://cmp.felk.cvut.cz/minimal/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe specifically, 4-point method with unknown focal length:&#xA;&lt;a href=&quot;http://cmp.felk.cvut.cz/minimal/p4pfr.php&quot; rel=&quot;nofollow&quot;&gt;http://cmp.felk.cvut.cz/minimal/p4pfr.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could find many variants in that page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Well, this problem involves many issues of multiple view geometry theory. However, in this case, an uncalibrated approach would be more suitable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could obtain point correspondences from SIFT-like features. As your images are downloaded from social platforms, it is likely that they will contain a lot of such feature points. Then, you could match the descriptors in a RANSAC-like fashion and retain the correct matches. From there it is possible to compute $F$ the fundamental matrix. With further assumptions, constraints or knowledge about the scene you could compute the scale as well as  the 3D point coordintates. Some examples here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31.4741&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31.4741&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under certain constraints it is also possible to recover the camera matrices:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.cecs.anu.edu.au/~hartley/Papers/eccv92/Higgins/higgins.pdf&quot; rel=&quot;nofollow&quot;&gt;http://users.cecs.anu.edu.au/~hartley/Papers/eccv92/Higgins/higgins.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After all, I would recommend you to read:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/hzbook/&quot; rel=&quot;nofollow&quot;&gt;http://www.robots.ox.ac.uk/~vgg/hzbook/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-11-22T14:50:14.887" LastActivityDate="2014-11-22T14:50:14.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15267" PostTypeId="2" ParentId="15263" CreationDate="2014-03-26T20:46:22.107" Score="2" Body="&lt;p&gt;I just answered this in Stack Overflow.  Here's the answer again:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The PNG pixels are in RGBA order, not ARGB, so you'd need to write&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alpha | red&amp;lt;&amp;lt;24 | green &amp;lt;&amp;lt; 16 | blue &amp;lt;&amp;lt;8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But you are writing color type 2, so your pixels should be 3 bytes each instead of four; you can't really encode them in 4-byte integers as you've done. So either change the color type to 6 or switch to writing each sample as an individual byte.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also you need a filter byte at the beginning of each row. Zero will work for you. So in your example 4x4 RGB image you will need to write 13 bytes per row&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 R G B R G B R G B R G B&#xA;0 R G B R G B R G B R G B&#xA;0 R G B R G B R G B R G B&#xA;0 R G B R G B R G B R G B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and zlib-compress that. It can all go into one IDAT chunk. If you need to write smaller IDAT chunks, you have to zlib-compress the image first, then split the zlib output into pieces that you put in consecutive IDAT chunks.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastActivityDate="2014-03-26T20:46:22.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15268" PostTypeId="2" ParentId="15260" CreationDate="2014-03-26T21:22:47.283" Score="2" Body="&lt;p&gt;The formula $$ a_n = a_{n-1} \frac{n-1}{n} + \frac{x_n}{n} .$$&#xA;is a way to compute the average of $n$ samples, and update this average whenever a new sample is obtained, without storing all of the samples individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ignoring the part about online computation, I think your question is equivalent to &quot;is there a way to estimate the mean of N identically distributed random variables that has lower standard deviation than the arithmetic average?&quot;  If so, the answer is: &lt;strong&gt;no, there isn't&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also worry about the numerical behavior of this formula for large $n$.&lt;/p&gt;&#xA;" OwnerUserId="64" LastEditorUserId="64" LastEditDate="2014-03-26T21:33:56.263" LastActivityDate="2014-03-26T21:33:56.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15269" PostTypeId="1" AcceptedAnswerId="15271" CreationDate="2014-03-27T01:36:32.033" Score="1" ViewCount="2515" Body="&lt;p&gt;What is the 2D version of Shift Theorem?&lt;/p&gt;&#xA;" OwnerUserId="8379" LastEditorUserId="8379" LastEditDate="2014-03-27T04:05:29.780" LastActivityDate="2014-03-27T11:51:06.363" Title="2D version of Shift Theorem" Tags="|image-processing|fft|fourier-transform|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15270" PostTypeId="1" AcceptedAnswerId="15276" CreationDate="2014-03-27T09:33:20.250" Score="0" ViewCount="3677" Body="&lt;p&gt;I have a C# desktop application. I am using EMGU as a wrapper for OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am receiving images in JPEG format that were originally taken by an analogue camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quality of the image is poor (compared to digital cameras).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to see if I can use filters/methods derived from OpenCV/EMGU that could enhance the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean by enhancement is to make the image a bit sharper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have played around with median, bilateral, contrast stretching to see if the image can be improved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nothing has worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if it can be confirmed to me that nothing I can do will enhance the image that will be an answer in itself. I can stop trying and persuade the client to use a digital camera instead...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vws31.jpg&quot; alt=&quot;grainy image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code that I apply to the original image to get the image you can see here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        int factor = Shared.factor;&#xA;        int xVal = 288;&#xA;        int yVal = 360;&#xA;        using (Image&amp;lt;Bgr, Byte&amp;gt; color = new Image&amp;lt;Bgr, byte&amp;gt;(grid))&#xA;        {&#xA;            byte[] data = null;&#xA;&#xA;              for (int x = 0; x &amp;lt; xVal; x++)&#xA;              {&#xA;                  for (int y = 0; y &amp;lt; yVal; y++)&#xA;                  {&#xA;                      grid[x, y, 0] = (byte)(grid[x, y, 0] / factor);&#xA;                      grid[x, y, 1] = (byte)(grid[x, y, 1] / factor);&#xA;                      grid[x, y, 2] = (byte)(grid[x, y, 2] / factor);&#xA;                  }&#xA;                }&#xA;                color.Data = grid;&#xA;                data = ImageToByteArray(color.ToBitmap());&#xA;        }&#xA;&#xA;&#xA;    private byte[] ImageToByteArray(Image imageIn)&#xA;    {&#xA;        byte[] data = null;&#xA;        try&#xA;        {&#xA;            using (MemoryStream ms = new MemoryStream())&#xA;            {&#xA;                imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);&#xA;                imageIn.Dispose();&#xA;                data = ms.ToArray();&#xA;            }&#xA;        }&#xA;        catch (Exception ex)&#xA;        {&#xA;         //do something&#xA;        }&#xA;        finally&#xA;        {&#xA;            if (imageIn != null)&#xA;            {&#xA;                imageIn.Dispose();&#xA;            }&#xA;        }&#xA;        return data;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As requested this is an original image but from a different view:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5gyNb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="8330" LastEditDate="2014-03-30T13:35:39.997" LastActivityDate="2014-03-30T13:35:39.997" Title="Options to enhance a poor image" Tags="|image-processing|c#|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15271" PostTypeId="2" ParentId="15269" CreationDate="2014-03-27T11:51:06.363" Score="1" Body="&lt;p&gt;The 2D version is just the same as the 1D version:&#xA;$$&#xA;x(n,m) \leftrightarrow X(k,l) = \sum_{n=0}^{N-1} \sum_{m=0}^{M-1} x(n,m) e^{-j2\pi nk/N - j2\pi ml/M}\\&#xA;x(n-a,m-b) \leftrightarrow &#xA;\begin{array}{ccl}&#xA;&amp;amp;&amp;amp;\sum_{n=0}^{N-1} \sum_{m=0}^{M-1} x(n-a,m-b) e^{-j2\pi nk/N - j2\pi ml/M} \\&#xA;&amp;amp;=&amp;amp; \sum_{n'=0}^{N-1} \sum_{m'=0}^{M-1} x(n',m') e^{-j2\pi (n'+a)k/N - j2\pi (m'+b)l/M}\\&#xA; &amp;amp;=&amp;amp; X(k,l) e^{-j (2\pi ka/N + 2\pi lb/M)}&#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-03-27T11:51:06.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15272" PostTypeId="2" ParentId="15057" CreationDate="2014-03-27T13:04:45.973" Score="-1" Body="&lt;p&gt;I came to know that technically there's no difference between the 2D discrete and Continuous Gabor filter when it comes to MATLAB every thing is discrete&lt;/p&gt;&#xA;" OwnerUserId="7071" LastActivityDate="2014-03-27T13:04:45.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15273" PostTypeId="2" ParentId="15260" CreationDate="2014-03-27T13:11:28.740" Score="2" Body="&lt;p&gt;You can &quot;average the averages&quot; the same way as you average your input signal. It can be done by the same recursive procedure without storing &quot;all the averages&quot;. The only thing you need to do is store two numbers instead of one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x_n$ be the data to be averaged and let $y_n$ be the output of the first averaging procedure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_n=\alpha y_{n-1}+(1-\alpha)x_n,\quad 0&amp;lt;\alpha &amp;lt;1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the same type of recursion again (just with a possibly different time constant) results in the final output $z_n$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z_n=\beta z_{n-1}+(1-\beta)y_n,\quad 0&amp;lt;\beta &amp;lt;1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also write the total procedure as a single second order recursion (eliminating $y_n$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z_n=(\alpha+\beta)z_{n-1}+\alpha\beta z_{n-2}+(1-\alpha)(1-\beta)x_n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have second order recursive filter which only needs to store two past output values. If you want a second-order system, this is the minimum storage possible.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-27T13:11:28.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15274" PostTypeId="2" ParentId="15227" CreationDate="2014-03-27T14:20:34.403" Score="2" Body="&lt;p&gt;I would recommend&lt;br&gt;&#xA;Array Signal Processing - Johnson, Dudgeon. This book covers classical spectral estimation, Minimum Variance Distortionless Response (MVDR), Linear Prediction, and subspace methods (e.g. MUSIC and ESPIRIT). It provides examples of the resolution capabilities between these methods. The are quite a number of good references in this book if you require additional detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MUSIC and ESPIRIT type algorithms are dicussed in most advanced DSP texts:&lt;br&gt;&#xA;Advanced Digital Signal Processing, Proakis, Rader, Ling, Nikias&lt;br&gt;&#xA;Discrete Random Signals and Statistical Signal Processing, Therrien&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For parametric methods:&lt;br&gt;&#xA;Spectral Analysis - A modern Perspective (Kay, Marple) Proc. IEEE Vol 6, No 11, 1981&lt;br&gt;&#xA;Modern Spectral Estimation: Theory and Application, Steven Kay&lt;br&gt;&#xA;Digital Spectral Analysis - S.L. Marple&lt;br&gt;&#xA;SPECTRAL ANALYSIS OF SIGNALS - P Stoica and R Moses  PDF is available &lt;a href=&quot;http://user.it.uu.se/~ps/ref.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The books by Marple and Kay tend to focus on algorithms i.e. implementations of various MA, AR, and ARMA approaches (e.g. fast Lattice filter implementations) rather than the performance of a basic approach&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compressive Sensing / Sparse Reconstruction techniques can also be used. There are too many references here to list. There are a few books by these authors Michael Elad, Yonina Eldar, and Holger Rauhut. These techniques are often quoted as &quot;having super resolution properties&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithms are often hard to compare directly because they all have twiddle factors which affect their performance.  For example&lt;br&gt;&#xA; 1. For MA, AR, ARMA, what order of model to use?&lt;br&gt;&#xA; 2. For Compressive techniques - how closely to space the template vectors? What level of regularization to use? How many frequencies are there? How many samples do we have?&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-03-27T14:20:34.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15275" PostTypeId="2" ParentId="15175" CreationDate="2014-03-27T15:36:53.510" Score="-2" Body="&lt;p&gt;This is not exactly an answer (I hope it will become it soon) but a result based on experience :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.io.wavfile import read, write&#xA;from scipy.fftpack import rfft, irfft&#xA;&#xA;(fs, x) = read('nowomannocry_16bit_mono.wav')&#xA;&#xA;y = rfft(x)&#xA;M = max(abs(y))&#xA;y *= 1.0 * (2**23-1) / M               # mapped into [-2^23, 2^23 -1]&#xA;y = np.round(y)&#xA;y = np.int32(y)   # here we store the fft by using the full width of 24 bits &#xA;&#xA;z = irfft(y) * M / (2**23-1)&#xA;z = np.round(z)&#xA;z = np.int16(z)&#xA;print z - x, max(abs(z-x))&#xA;# [0 0 0 ..., 0 0 0] 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to this small test (done on &lt;em&gt;Bob Marley's No woman no cry, 16 bit, mono&lt;/em&gt; ;)), &lt;strong&gt;24 bits&lt;/strong&gt; seem to be enough to store the FFT of the original signal, in such a way that the original signal can be recovered by RFFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried with 16, 20, 22 bits, and it wasn't enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are only experiences, but can something be proven in this direction ?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2014-03-27T15:36:53.510" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15276" PostTypeId="2" ParentId="15270" CreationDate="2014-03-27T16:31:43.627" Score="2" Body="&lt;p&gt;There is no way to regain any lost data at all. However, there are many phenomena that might distort the image in a recoverable way, not actually losing any data. You seem to try to undo a &quot;point spread function&quot;, that is eg. some consistent blur. This would be not the only way an image can be distorted, however it is by far the most common.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case you would assume that the original image is convolved or filtered by an (initially unknown) point spread function. There may be the inverse operation to that. You could call this &quot;equalization&quot; of the frequency space of the image, then.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not every inverse operation would be represented by an &quot;edge sharpening&quot; operation that is known a priori. You could maybe try to look at the image a virtually point-shaped light source gives, preferrably in front of a dark background. A laser pointer or a bright LED might serve as an example.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-03-27T16:31:43.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15277" PostTypeId="1" CreationDate="2014-03-27T16:37:41.957" Score="1" ViewCount="77" Body="&lt;p&gt;I'm a CS who took an internship at an EE shop, and I'm trying to do some work developing in house and client applications for a chip designer, and I'm having some fundamental communication problems. Mainly I shore up any applications they need developed from their specs, including at the moment a tool that demonstrates Jitter on a given PLL. I've had some high level stats, linear algebra, and DIP courses that I thought would have prepared me for this, but right now I've got a 50 pages on how to calculate Peak to Peak Jitter, Period Jitter, Random Jitter, and Long Term Jitter, and I can't seem to get a solid equation/algorithm out of any of it. It seems to approach RMS like it's a constant number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what I need to tackle this. Does any one have a(some) primer(s) on the subject(s)?&lt;/p&gt;&#xA;" OwnerUserId="2057" LastActivityDate="2014-03-27T16:37:41.957" Title="DSP, Related Math, Statistics, and Jitter Primers" Tags="|statistics|" AnswerCount="0" CommentCount="1" ClosedDate="2014-05-13T04:07:47.750" ContentLicense="CC BY-SA 3.0" />
  <row Id="15278" PostTypeId="2" ParentId="15175" CreationDate="2014-03-27T17:10:57.450" Score="0" Body="&lt;p&gt;OK, I can provide you an (almost) answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using a lifting based realization of the complex twiddle factor multiplication with quantized coefficients, the word length will increase with three times the coefficient word length after performing the multiplication. Hence, a direct evaluation would give the initial data word length plus three times the coefficient word length plus 10 (which is the two-logarithm of 1024). This what is needed to store the exact result of the DFT computation using a direct computation. If you instead are using an FFT algorithm, you would be looking at at most nine twiddle factor stages, each adding three times the coefficient word length number of bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess neither of these numbers are actually what you are looking for, since you probably do not want to write your own DFT/FFT. Also, with these numbers, the question &quot;What do you need the DFT for?&quot; and &quot;How good approximation of the DFT do you need?&quot; arise pretty rapidly.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-03-27T17:10:57.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15279" PostTypeId="1" CreationDate="2014-03-27T19:22:01.593" Score="2" ViewCount="731" Body="&lt;p&gt;IS there a Matrix form of the STFT that could be applied to a signal directly, as in the case of DFT? We know the matrix structure of the DFT Matrix. Can we derive that somehow for a STFT Transform? The parameters that I wish to use are &#xA;N = signal length&#xA;R = frame length&#xA;overlap = 50%&#xA;DFT length = K &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Attempt: I have tried to represent the DFT blocks along a diagonal with 50% overlap between the blocks. Each of the DFT Block will be multiplied by a diagonal block of the same size consisting of the window coefficients. Am I heading in the right direction? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any directions or suggestions would be helpful.&#xA;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="5608" LastActivityDate="2014-03-27T20:08:58.160" Title="Matrix form of STFT" Tags="|dft|stft|transform|matrix|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15280" PostTypeId="2" ParentId="15270" CreationDate="2014-03-27T19:27:50.607" Score="1" Body="&lt;p&gt;Your image seems sharp. Increasing the sharpness will not help. You need to use Deconvolution to inpaint some of the missing data. Try algorithms for inpainting, low-rank + sparse recovery or other methods of compressed sensing. If you want to increase the resolution then you can use the algorithms of super resolution, try the following&#xA;&lt;a href=&quot;http://www.wisdom.weizmann.ac.il/~vision/SingleImageSR.html&quot; rel=&quot;nofollow&quot;&gt;http://www.wisdom.weizmann.ac.il/~vision/SingleImageSR.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5608" LastActivityDate="2014-03-27T19:27:50.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15281" PostTypeId="2" ParentId="15279" CreationDate="2014-03-27T20:08:58.160" Score="2" Body="&lt;p&gt;For an overlapped STFT (overlap &gt; 0), the output vector will be larger than the signal input vector, so the matrix form will not be square.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-27T20:08:58.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15282" PostTypeId="2" ParentId="15178" CreationDate="2014-03-27T23:04:28.247" Score="0" Body="&lt;p&gt;Try using the Crosswavelet and Wavelet Coherence package linked below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://noc.ac.uk/using-science/crosswavelet-wavelet-coherence&quot; rel=&quot;nofollow&quot;&gt;http://noc.ac.uk/using-science/crosswavelet-wavelet-coherence&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Morlet mother wavelet should serve you well if you're looking for periodic behavior.&lt;/p&gt;&#xA;" OwnerUserId="8389" LastActivityDate="2014-03-27T23:04:28.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15283" PostTypeId="1" AcceptedAnswerId="15304" CreationDate="2014-03-28T03:54:38.490" Score="10" ViewCount="25298" Body="&lt;p&gt;I'm not sure if is the correct location for ask this question. If not please info me the correct StackExchange site.&#xA;As this &lt;a href=&quot;http://en.wikipedia.org/wiki/YUV#Y.27UV420p_.28and_Y.27V12_or_YV12.29_to_RGB888_conversion&quot; rel=&quot;noreferrer&quot;&gt;wikipedia&lt;/a&gt; page show, there is one YUV format of image as YUV420 and YUV411.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know what is YUV, but what those 420 and 411 means?&lt;/p&gt;&#xA;" OwnerUserId="7388" LastActivityDate="2014-03-29T15:56:46.870" Title="What does the 420 means in YUV420?" Tags="|image-processing|image-compression|video-compression|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15284" PostTypeId="1" AcceptedAnswerId="15366" CreationDate="2014-03-28T03:57:22.253" Score="5" ViewCount="3626" Body="&lt;p&gt;Suppose you have a system, H, that you want to estimate its transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have a finite number of complex input samples, x, and noisy complex (magnitude and phase) output samples, y:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In practice, how do you estimate it's transfer function given a mean-squared error criteria?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What algorithms are used to estimate transfer functions when you have limited and noisy data?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How would you estimate the transfer function using a Wiener filter?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="128" LastEditDate="2019-06-26T08:52:07.407" LastActivityDate="2019-06-26T08:52:07.407" Title="Estimate the Transfer Function of an Unknown System" Tags="|transfer-function|estimation|least-squares|linear-algebra|inverse-problem|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15285" PostTypeId="2" ParentId="8282" CreationDate="2014-03-28T06:31:39.450" Score="0" Body="&lt;p&gt;The satement of Peter K. regarding terms FIR , IIR and non-recursive , recursive is true. Many text books and also wikipedia is wrong when saying that IIR is the same as recursive filter and FIR is non-recursuve. Both filters FIR and IIR can be implemeted as recursive or non-recursive form. Please see lecture of prof. Dutta Roy about this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cosmolearning.com/video-lectures/fir-iir-recursive-non-recursive/&quot; rel=&quot;nofollow&quot;&gt;http://www.cosmolearning.com/video-lectures/fir-iir-recursive-non-recursive/&lt;/a&gt;&#xA;or the same:&#xA;&lt;a href=&quot;http://www.youtube.com/watch?v=GpqMAzGEXXk&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=GpqMAzGEXXk&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8391" LastActivityDate="2014-03-28T06:31:39.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15288" PostTypeId="1" AcceptedAnswerId="15291" CreationDate="2014-03-28T08:38:04.573" Score="0" ViewCount="1757" Body="&lt;p&gt;I am using Matlab Simulink to analyse Amplitude Modulation in Noise. I attached my system below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3ZmkA.png&quot; alt=&quot;model&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problems:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)In the mixer I am using a bandpass filter and another one after the envelope detector and I need to determine the minimum and maximum frequencies allowed depending on these parameters( I attached screenshots too) since I tried using mathwork site but it was not helpful regarding these values. &lt;img src=&quot;https://i.stack.imgur.com/57XHf.png&quot; alt=&quot;filter after envelope&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/xxOTc.png&quot; alt=&quot;filter in mixer&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)Also I need to know what needs to be changed in the model if the AM channel has a different carrier frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3)What does 999e3 evaluate to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2017-07-26T19:10:50.513" Title="Simulink for Amplitude Modulation" Tags="|matlab|modulation|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15289" PostTypeId="1" AcceptedAnswerId="15290" CreationDate="2014-03-28T10:15:14.270" Score="-1" ViewCount="207" Body="&lt;p&gt;Is 999e3 in matlab = 0.999? Because I am not sure whether e mean exponential or you move the decimal point by 3decimal places&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-03-28T10:24:03.883" Title="999e3 numerical representation in Matlab" Tags="|matlab|" AnswerCount="1" CommentCount="0" ClosedDate="2014-04-02T15:20:45.353" ContentLicense="CC BY-SA 3.0" />
  <row Id="15290" PostTypeId="2" ParentId="15289" CreationDate="2014-03-28T10:24:03.883" Score="4" Body="&lt;p&gt;$$999e3=999\cdot 10^{3}=999000$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-28T10:24:03.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15291" PostTypeId="2" ParentId="15288" CreationDate="2014-03-28T10:34:20.783" Score="0" Body="&lt;p&gt;1) Do I fail to understand the question? The allowed frequency range of a bandpass filter goes from Fpass1 to Fpass2. The range between Fstop1 and Fpass1 and from Fpass2 to Fstop2 is the transition range where the filter goes from fully attenuated to fully &quot;open&quot; so there shouldn't be any strong interferers in this range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Your band select filter before the down-mixer. It usually has your carrier frequency in the middle of Fpass1 and Fpass2 and is as wide as your expected signal is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) 999000&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-03-28T10:34:20.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15292" PostTypeId="1" AcceptedAnswerId="15297" CreationDate="2014-03-28T11:18:01.847" Score="0" ViewCount="83" Body="&lt;p&gt;I have noticed that there is an identical pattern between two signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one is a signal of n identically spaced samples over a single period of a sinusoid&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the other is a signal constructed of the real component of the second (i.e. first periodic) Fourier bin of n circular shifts of the signal, so pseudocode would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;allocate a final result, size n&#xA;loop from 1 to n&#xA;    newSignal = circularly shift signal one step to the left&#xA;    newValue = take the FFT, second (first periodic) bin, real component&#xA;    finalResult(n) = newValue&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only difference between these two is the scaling. If one's input is known to be a single cycle of a sinusoid, this is a nice way to remove all noise without knowing the phase of the input. Obviously it works in part because the second Fourier bin corresponds to the frequency of the input. But that's as far as my intuition gets me. In terms of theory, I don't understand why a signal composed of the real component of the second Fourier bins of the circular shift of each step of the signal looks the same as the original signal. Can anyone shed insight?&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="5623" LastEditDate="2014-03-28T12:25:09.733" LastActivityDate="2014-03-28T17:02:59.197" Title="Why does this FFT based signal deliver a sinusoidal result?" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15293" PostTypeId="1" AcceptedAnswerId="15308" CreationDate="2014-03-28T13:03:41.313" Score="0" ViewCount="908" Body="&lt;p&gt;let us suppose that we have non stationary signal,whose value is given by &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;56.69&#xA;69.22&#xA;-2.19&#xA;21.80&#xA;9.85&#xA;-80.51&#xA;-56.28&#xA;-18.79&#xA;-14.32&#xA;12.26&#xA;74.71&#xA;67.37&#xA;24.43&#xA;-9.05&#xA;-47.30&#xA;-62.60&#xA;-47.64&#xA;-26.36&#xA;20.78&#xA;67.58&#xA;49.83&#xA;28.24&#xA;25.14&#xA;-43.10&#xA;-72.81&#xA;-17.82&#xA;-12.38&#xA;-34.82&#xA;58.96&#xA;69.83&#xA;-5.10&#xA;14.65&#xA;28.29&#xA;-64.48&#xA;-61.23&#xA;26.43&#xA;1.90&#xA;-47.52&#xA;51.01&#xA;41.97&#xA;-41.54&#xA;-0.62&#xA;60.86&#xA;-52.44&#xA;-37.61&#xA;61.99&#xA;-10.36&#xA;-60.20&#xA;30.45&#xA;22.95&#xA;-55.33&#xA;34.50&#xA;85.71&#xA;-13.38&#xA;-12.63&#xA;54.70&#xA;-37.86&#xA;-77.38&#xA;4.65&#xA;9.28&#xA;-24.83&#xA;68.53&#xA;85.37&#xA;-15.80&#xA;-7.33&#xA;4.31&#xA;-72.06&#xA;-73.52&#xA;1.21&#xA;17.90&#xA;16.23&#xA;63.14&#xA;63.68&#xA;-14.40&#xA;-22.79&#xA;-46.29&#xA;-73.40&#xA;-35.51&#xA;13.92&#xA;27.94&#xA;65.99&#xA;50.76&#xA;6.08&#xA;-5.44&#xA;-33.80&#xA;-73.27&#xA;-14.35&#xA;14.32&#xA;-10.47&#xA;41.59&#xA;65.77&#xA;-9.65&#xA;-17.11&#xA;25.02&#xA;-34.94&#xA;-57.50&#xA;32.16&#xA;35.22&#xA;-47.44&#xA;14.10&#xA;68.68&#xA;-35.63&#xA;-23.43&#xA;52.82&#xA;-18.17&#xA;-45.41&#xA;35.20&#xA;13.02&#xA;-77.34&#xA;9.09&#xA;54.62&#xA;-41.86&#xA;5.54&#xA;100.61&#xA;-2.50&#xA;-47.15&#xA;21.43&#xA;-30.39&#xA;-105.88&#xA;10.12&#xA;54.47&#xA;-15.25&#xA;51.19&#xA;85.27&#xA;-13.40&#xA;-63.08&#xA;-3.18&#xA;-55.73&#xA;-85.04&#xA;18.21&#xA;56.47&#xA;24.51&#xA;54.11&#xA;55.81&#xA;-22.11&#xA;-48.48&#xA;-52.59&#xA;-52.83&#xA;-32.17&#xA;21.34&#xA;52.16&#xA;57.12&#xA;32.52&#xA;3.33&#xA;-26.44&#xA;-45.33&#xA;-51.45&#xA;-26.23&#xA;22.70&#xA;7.25&#xA;30.30&#xA;49.79&#xA;10.05&#xA;-47.82&#xA;7.81&#xA;5.60&#xA;-52.47&#xA;12.12&#xA;49.13&#xA;-27.13&#xA;-11.40&#xA;53.12&#xA;-14.12&#xA;-37.25&#xA;64.87&#xA;24.10&#xA;-64.07&#xA;16.83&#xA;25.67&#xA;-84.88&#xA;-23.01&#xA;76.72&#xA;2.82&#xA;-18.01&#xA;81.46&#xA;19.46&#xA;-69.46&#xA;-4.69&#xA;-15.00&#xA;-95.40&#xA;-14.27&#xA;81.06&#xA;10.99&#xA;12.24&#xA;77.50&#xA;-13.87&#xA;-80.90&#xA;-39.37&#xA;-33.24&#xA;-55.32&#xA;27.60&#xA;87.91&#xA;46.31&#xA;35.38&#xA;34.22&#xA;-36.01&#xA;-70.78&#xA;-43.57&#xA;-18.78&#xA;-5.34&#xA;48.43&#xA;53.05&#xA;39.49&#xA;20.91&#xA;-11.03&#xA;-39.82&#xA;-42.87&#xA;-34.33&#xA;-21.77&#xA;33.55&#xA;22.34&#xA;11.90&#xA;27.41&#xA;7.81&#xA;-40.11&#xA;1.82&#xA;9.00&#xA;-45.68&#xA;-10.45&#xA;44.91&#xA;-7.91&#xA;-47.04&#xA;41.03&#xA;24.43&#xA;-45.47&#xA;28.51&#xA;54.19&#xA;-51.30&#xA;-33.24&#xA;27.62&#xA;-63.64&#xA;-53.94&#xA;84.27&#xA;31.39&#xA;-19.69&#xA;67.12&#xA;39.14&#xA;-85.28&#xA;-46.64&#xA;3.16&#xA;-58.10&#xA;-30.32&#xA;96.07&#xA;56.72&#xA;2.62&#xA;46.12&#xA;4.95&#xA;-114.65&#xA;-43.85&#xA;0.83&#xA;-27.53&#xA;16.15&#xA;99.72&#xA;40.78&#xA;-9.38&#xA;15.97&#xA;-32.67&#xA;-78.52&#xA;-36.29&#xA;8.67&#xA;3.76&#xA;36.16&#xA;61.85&#xA;31.10&#xA;-9.09&#xA;-14.47&#xA;-51.55&#xA;-35.03&#xA;-16.66&#xA;0.81&#xA;39.57&#xA;42.17&#xA;-8.22&#xA;13.39&#xA;20.67&#xA;-36.92&#xA;-21.53&#xA;25.32&#xA;-13.28&#xA;-27.59&#xA;41.31&#xA;-3.05&#xA;-56.63&#xA;21.87&#xA;41.42&#xA;-24.58&#xA;19.23&#xA;65.43&#xA;-55.32&#xA;-57.21&#xA;28.64&#xA;-12.84&#xA;-50.87&#xA;75.03&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i have tried to apply autoregressive model to this data,by using following matlab code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Pxx,f]=pyulear(B,20,1024,100);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;plot(f,Pxx)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and i have got following picture &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kWJCt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this case i had not any information about order,just i have took randomly,now one point is that  this signal is represented by following form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[t]=A_1(sin(\omega_1*t+\phi_1)+A_2*sin(\omega_2*t+\phi_2)+....+A_p*sin(\omega_p*t+\phi_p)$+$z(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where  $\phi$ are some constants and  also frequencies and amplitudes,$z(t)$ is white noise,because this signal is nonstationary,can we apply standard autoregressive models(AR,ARMA) to  this model?which methods are suitable for  better  spectral resolution?i am  not interested  estimation of parameters,just i am concerned about spectral resolution,i want to distinguish from each other closed spaced frequencies,or when $\omega_p\approx \omega_{p+1}$thanks in advance&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorDisplayName="user350" LastEditDate="2014-03-29T04:54:17.897" LastActivityDate="2014-03-29T04:54:17.897" Title="ARMA models for non stationary signals" Tags="|matlab|noise|autoregressive-model|superresolution|periodic|" AnswerCount="1" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="15294" PostTypeId="1" CreationDate="2014-03-28T13:20:08.160" Score="1" ViewCount="185" Body="&lt;p&gt;We are performing a convolution of audio signal, with 511th order FIR&#xA;filters, using fast convolution methods: overlap-add or overlap-save.&#xA;Filters are being designed in frequency domain several thousand times&#xA;per second. Filters need to be zeros padded to be used in order to be&#xA;used in fast convolution algorithms, so to acquire appropriately&#xA;padded filters we do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;frequency domain filter design, filters of 511th order&lt;/li&gt;&#xA;&lt;li&gt;IFFT into time domain&lt;/li&gt;&#xA;&lt;li&gt;zeros padding to 2048 length (1536 zeros)&lt;/li&gt;&#xA;&lt;li&gt;FFT back into frequency domain (for multiplication with spectral&#xA;representation of input audio signal)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Computational complexity of such operation occurred be to high for our&#xA;needs. We're trying to figure out if there's a method to avoid&#xA;IFFF-&gt;FFT steps and reduce the overall complexity from O(NlogN) to&#xA;O(N). Any ideas if it is possible, and, if so, how can it be achieved? &lt;/p&gt;&#xA;" OwnerUserId="8399" LastEditorUserId="4346" LastEditDate="2017-01-05T04:00:32.580" LastActivityDate="2017-01-05T04:00:32.580" Title="Method for modifying frequency-domain signal to produce predetermined time-domain signal" Tags="|fft|ifft|fast-convolution|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15295" PostTypeId="2" ParentId="15191" CreationDate="2014-03-28T13:56:13.103" Score="0" Body="&lt;p&gt;Joe..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 3 would answer Question 1 (since a resource giving an overview without focusing on any given technique would answer that question).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at Chapter 2 &quot;ECG Signal Analysis&quot; of &quot;ECG Acquisition and Automated Remote Processing&quot; by R. Gupta et al. (Springer India 2014).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gives a nice overview on different challenges ECG Analysis faces, and different solutions for these problems, with references to original work in case you want to dig deeper on any matter. It also gives pseudo-code in case you're interested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had already tried the differences method to get rid of Baseline Wander, which I found effective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have also a look at &quot;Computer Aided ECG Analysis - State of the Art and Upcoming Challenges&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, keep in mind that it's not enough to get a &quot;nice ECG&quot;, meaning a &quot;visually appealing&quot; ECG. You need to take into account how much information is lost by that filtering, and how much distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you need to test your algorithms on known signals and known noise to be able to do that and compute error, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bear also in mind that it always boils down to a compromise. Some cite Heisenberg, I quote the Rolling Stones: You can't always have what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We all want fast algorithms we can implement real time, filters that only filter the noise but leave the ECG characteristics intact, 1000+Hz sampling frequency on a wearable device with unlimited battery time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reality is quite not that great. Hence the word &quot;challenges&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also doing my thesis on the matter, so if you have any other question, feel free to ask: I won't be the douchebag who tells you &quot;How come you don't know this ?&quot;.&lt;/p&gt;&#xA;" OwnerUserId="8400" LastActivityDate="2014-03-28T13:56:13.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15296" PostTypeId="1" CreationDate="2014-03-28T13:58:14.080" Score="0" ViewCount="1434" Body="&lt;p&gt;Let &lt;code&gt;STFT[frame, freqbin]&lt;/code&gt; be the short-time Fourier transform of some audio data.&#xA;&lt;em&gt;(here &lt;code&gt;frame&lt;/code&gt; is the index in time, and  &lt;code&gt;freqbin&lt;/code&gt; is the index in frequency)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very often, &lt;code&gt;STFT[k, f0]&lt;/code&gt; will be close to &lt;code&gt;STFT[k+1, f0]&lt;/code&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tB850.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... then it could be interesting to store, for each frequency bin &lt;code&gt;f0&lt;/code&gt;, only the differences :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;STFT[0, f0], STFT[1, f0] - STFT[0, f0], STFT[2, f0] - STFT[1, f0], STFT[3, f0] - STFT[2, f0], etc.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(such processing is known as delta encoding) ; these differences will be small on average, and this could lead to a reduction of the &lt;em&gt;average&lt;/em&gt; bit usage for storage of the audio data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can this idea be turned into an efficient audio data compression ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(I don't speak here about psychoacoustic effects that could lead to use different levels of quantizations for each frequency / or frequency masking ; I know that such ideas are used in MP3 compression).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; as mentionned by @pichenettes, the graph above showing continuity between adjacent frames is the &quot;magnitude plot&quot;. The &quot;phase / angle plot&quot; is a bit less continuous :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1zpI5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2014-03-28T14:51:08.870" LastActivityDate="2014-03-28T21:21:08.787" Title="Audio compression with STFT" Tags="|fft|audio|fourier-transform|stft|compression|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15297" PostTypeId="2" ParentId="15292" CreationDate="2014-03-28T14:05:18.000" Score="1" Body="&lt;p&gt;Let me see if I understood you correctly. You have one period of a sinusoidal signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\sin\left (\frac{2\pi n}{N}\right ),\quad n=0,1,\ldots N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its DFT is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $k=1$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[1]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi n/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the given signal $x[n]$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[1]=\frac{N}{2j}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the left-shifted versions of $x[n]$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_l[1]=\sum_{n=0}^{N-1}x[n+l]e^{-j2\pi n/N}=e^{j2\pi l/N}\sum_{n=0}^{N-1}x[n]e^{-j2\pi n/N}=e^{j2\pi l/N}\frac{N}{2j}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Re\{X_l[1]\}=\Re\left\{e^{j2\pi l/N}\frac{N}{2j}\right\}=\frac{N}{2}\sin\left (\frac{2\pi l}{N}\right )=\frac{N}{2}x[l],\quad l=0,1,\ldots, N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q.E.D.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-03-28T17:02:59.197" LastActivityDate="2014-03-28T17:02:59.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15298" PostTypeId="2" ParentId="15248" CreationDate="2014-03-28T14:25:45.047" Score="1" Body="&lt;p&gt;Template matching is related to finding the maximum correlation between two signals, where one of the signals (the image being explored) is usually much bigger than the reference signal (the object being searched for). Obviously, the best correlation score can only be obtained when the size of the object in the image is equal to its size in the template (intuitively, both shapes will superpose).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However I am not able to relate in any meaningful way the number of pyramid levels to create (for model and for target)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The number of scales is related to two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the size of the object of interest in the explored image&lt;/li&gt;&#xA;&lt;li&gt;the computation time reduction that you want to obtain.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To have the best localization accuracy, you need to have one template image that matches exactly the size of the object in the explored image. Thus, if you don't know a priori this size, but you have instead a range of sizes, your template pyramid should include each of these sizes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the template matching part can be expensive (one correlation computation for each possible position of the template in the image), you want to reduce the number of pixels explored. Thus, you create a pyramid of the image to explore, start by looking for the object at the coarsest scale to get a rough position that gets refined at the next scale, etc. Again, since the size of the object needs to match between the template and the explored image, you need to rescale appropriately each of the images from the pyramid that you built for the template (previous paragraph).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For example 1 level of the pyramid reduces the resolution of the image by 2 (is this the same as saying that the image has been scaled by 0.5 ) ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It depends... Reducing the resolution by two along each dimension divides the number of pixels by 4. This is usually referred to as scaling by 0.5 but as an image resolution reduction by 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A common practice is to divide the number of pixels by 2, yielding a $\sqrt{2}$ factor along each dimension.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Than what about a pyramid level of -1 (which should make the image bigger x 2.0) : with what gaussian filter should it be treated before upsampling ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You need to use image interpolation techniques here. OpenCV uses (in optical flow methods) a gaussian upsampling by injecting $0$'s along the odd lines/columns then applying a gaussian blur.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-03-28T14:25:45.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15299" PostTypeId="2" ParentId="15296" CreationDate="2014-03-28T14:32:24.790" Score="2" Body="&lt;p&gt;I see two big drawbacks to your method:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The image you posted is not the STFT, but its magnitude. The difference between the &lt;strong&gt;magnitude&lt;/strong&gt; of adjacent STFT frames is small; so for your scheme to work you would have to store the magnitude and phase separately. But then, there would be no compression at all on the phase data that would still represent 50% of the data and would be required for reconstructing the signal. Try plotting the phase (angle) of the STFT to see how ugly it is.&lt;/li&gt;&#xA;&lt;li&gt;Assuming the deltas are encoded using variable-length integers or Golomb codes (I assume that's the idea behind it...), your method would compress large and temporally stable values in the spectrum (the red &quot;lines&quot; on the spectrogram image). It's obvious that these represent only a small fraction of the values. There would be no gain for the background &quot;noise&quot; which amounts for a very large portion of the spectrogram magnitude data.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A much more efficient way of getting rid of these stable/predictable peaks in the spectrogram is to whiten the signal and code the residual+the filter coefficients. This is (among other things) the principle of the FLAC lossless codec.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-03-28T14:32:24.790" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="15300" PostTypeId="2" ParentId="15248" CreationDate="2014-03-28T15:14:02.963" Score="1" Body="&lt;p&gt;Generating pyramids and searching for different scales are two different things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pyramid generation is commonly referred as a technique to speed up, where each level of the template is sought in each corresponding level of the search image. If you satisfy a sufficient match score in the higher levels of the pyramid, then you could stop searching further, propagate to the next level. On the lower level of the pyramid (bigger image), you could restrict the domain of search. In other words, you could hypothesize a range within which the template should lie. In the finest level, you just apply a brute for search but in a really small area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scale is a different story. To search for multiple scales, you have to generate the template in multiple scales and search them. Note that only the template should be generated in multiple scales. And if you are using a pyramidal matching, then separate pyramids should be built for these scales too. Searching over a variety of scales might seem insane, but if you extract a sparse set of meaningful features from the image (such as strong gradients), this search can in fact be made feasible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, it is a good idea to choose the number of levels of pyramids as large as possible because it significantly reduces  the time necessary to find the object. On the other hand, number of levels must be chosen such that the model is still recognizable and contains a sufficient number of points of interest on the highest pyramid level. If the number of pyramid levels is chosen too small, the time required to find the model may increase. Typically $4$ is a descent value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still if you need more accuracy, you could always go for a sub-pixel registration as a final refinement stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If implemented in a very naive fashion, template matching is very exhaustive. However, there are many efficient ways to speed it up. For further reading, I would for example recommend: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.221.7835&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.221.7835&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-28T15:14:02.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15301" PostTypeId="1" CreationDate="2014-03-28T15:50:30.023" Score="1" ViewCount="67" Body="&lt;p&gt;I understand that this has something to do with difference between refresh rate of monitor (or line frequency used by the ballast in case of Fluoroscent lamp) and frame capture rate of video recorder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When learning about DSP in the past, I vaguely remember that a certain difference in frame capture rates of video recorder against the refresh rate of screen will cause the movement of bands upwards or downwards (assuming screen drawn left to right, top to bottom) ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me understand the phenomenon (the name, if there is one for this) or direct me to appropriate text on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7920" LastActivityDate="2014-03-28T17:40:09.583" Title="Why do we observe band when recording CRT monitors or Flouroscent lamp via video recorder?" Tags="|sampling|video-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15303" PostTypeId="2" ParentId="15301" CreationDate="2014-03-28T17:40:09.583" Score="1" Body="&lt;p&gt;This effect is most obvious in light generators that brighten and dim cyclicly over time, as in an AC current powered photon generator (bulb), or the phosphors on an old CRT periodically hit by a refresh beam.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some ways this is similar to audio beating between two different but close audio frequency signals or pitched notes.  If the frequencies are slightly different (including the fundamental of one to a strong harmonic of another), then the phase will drift in and out over time.  In audio, this creates changing constructive or destructive interference.  In video recording this might capture the brightest portion of the beam or lamp when in phase, or not capture it when out of phase, or a capture over time while the phase is continually changing in between, resulting in rolling of the brightest band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the NTSC frame refresh rate is 29.97 Hz, which will beat against half an AC line frequency of 30 Hz.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-28T17:40:09.583" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15304" PostTypeId="2" ParentId="15283" CreationDate="2014-03-28T17:44:29.817" Score="9" Body="&lt;p&gt;The 3-digit number describes the subsampling of the&#xA;chroma (U and V) channels.  A detailed explanation is at&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Chroma_subsampling&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Chroma_subsampling&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, YUV420 means that the U and V channels have half the resolution of the luma (Y) channel, in the horizontal and vertical directions. The sampling method usually present in low to medium quality JPEG images is YCrCb420 (high quality JPEGs are usually YCrCb444 (no subsampling).&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2014-03-29T15:56:46.870" LastActivityDate="2014-03-29T15:56:46.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15305" PostTypeId="1" AcceptedAnswerId="15353" CreationDate="2014-03-28T17:49:40.237" Score="3" ViewCount="9693" Body="&lt;p&gt;I am trying to solve the following equation for h (an [MxM matrix]):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;k[\tau_1,\tau_2]=\sum_{i_1=0}^M \sum_{i_2=0}^M h[i_1,i_2]x[\tau_1-i_1]x[\tau_2-i_2]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have k, which is a 2D [MxM] symmetric matrix &amp;amp; I have x which is also a 2D [MxM] symmetric toeplitz (autocorrelation) matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is basically a 2D deconvolution problem, but this isnt my field and I cant figure out how to do it in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if possible I would prefer a time domain solution, but frequency domain would also work!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Attempted Solution #1: Division in frequency domain:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;h_pred=ifft(fft2(k)./fft2(x)); &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this should work, but for some reason it keeps giving me an imaginary answer!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Attempted Solution #2: Toeplitz matrix inversion:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;h_pred=inv(x)*k;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works better, however while the recovered h_pred is much closer to the true h, it is still very far off...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4550" LastEditorUserId="4550" LastEditDate="2014-03-28T18:17:00.730" LastActivityDate="2014-04-01T01:09:38.563" Title="2D Deconvolution in matlab" Tags="|image-processing|matlab|deconvolution|2d|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15306" PostTypeId="2" ParentId="15294" CreationDate="2014-03-28T17:55:42.200" Score="2" Body="&lt;p&gt;Zero-padding is one domain is equivalent to Sinc (or Dirichlet) convolution in the other, which is O(n^2), so that won't save you.  For less computation, you might want to try different filter design methods (compositing existing FIR filters, IIRs, etc.) or finding a way to recompute your filter less often.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-28T17:55:42.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15307" PostTypeId="2" ParentId="15296" CreationDate="2014-03-28T21:21:08.787" Score="0" Body="&lt;p&gt;Audio compression has been done with wavelet transforms which have some relation to the STFT.  The wavelet transform, like the STFT is a time/frequency transform but has forms that are specifically designed to be invertible whereas practical inversion of the STFT is problematic.  The STFT resembles continuous wavelet transforms which are better suited for analysis than synthesis (reconstruction).  The discrete wavelet transform was developed in a way that is more suitable for synthesis and thus applications such as compression.  The practical ability to invert discrete wavelet transforms is achieved by defining the discrete wavelet transform such that redundant information is eliminated between the coefficients computed using the transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike the STFT which employs the complex exponential as its kernel, many different functions have been developed for use as wavelet transform kernels, some of which are real functions.  Wavelet kernels can be developed for specific tasks.  The kernel, which can be loosely referred to as a wavelet, need only satisfy a set of admissibility conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients that are computed using a discrete wavelet transform follow an order associated with time duration.  The lowest order coefficients represent long time duration (often associated with low frequencies) while higher order coefficients represent short rime duration (representing detail and often associated with high frequencies).  With band limited signals having a lowpass characteristic (such as voice), the higher order coefficients tend to vanish.  One technique that is used for signal compression is to eliminate all coefficients above a certain order (think higher frequencies).  There is an obvious trade off between the highest order of coefficients retained for signal reconstruction and fidelity.  This method is distinctly different than the one you proposed which uses the difference between adjacent frequency bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good non technical introduction to wavelet analysis is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The World According to Wavelets&quot; by Barbera Burke Hubbard.  There are lots of sites on the web dedicated to the theory and application of wavelets.  Google wavelet audio compression and you will find many links.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2014-03-28T21:21:08.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15308" PostTypeId="2" ParentId="15293" CreationDate="2014-03-28T22:20:33.760" Score="0" Body="&lt;p&gt;As I've said in the (copious) comments, the signal modeled using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[t]=A_1(\sin(\omega_1 t+\phi_1)+A_2 \sin(\omega_2 t+\phi_2)+....+A_p \sin(\omega_p t+\phi_p) + z(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is stationary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your statement &lt;code&gt;i am not interested estimation of parameters,just i am concerned about spectral resolution&lt;/code&gt; seems like an oxymoron.  I think what you mean is that you're not concerned with estimating $A_k$ and $\phi_k$, but you are interested in $\omega_k$ for the case where $\omega_k \approx \omega_{k+1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please refine your question, based on this information and the discussion in the comments above?&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-03-28T22:20:33.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15309" PostTypeId="2" ParentId="15284" CreationDate="2014-03-28T22:42:23.473" Score="2" Body="&lt;p&gt;One approach you can take is to try to fit your data &lt;a href=&quot;http://en.wikipedia.org/wiki/Autoregressive%E2%80%93moving-average_model#Fitting_models&quot; rel=&quot;nofollow&quot;&gt;to an ARMA model&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several implementations (as that link suggests).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also a good reference (if you're mathematically minded) is &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0136566952&quot; rel=&quot;nofollow&quot;&gt;Lennart Ljung's book, &lt;em&gt;System Identification: Theory for the User&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most algorithms mentioned in the links use a mean square error criterion. Many algorithms work well (enough) with small amounts of data.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-03-28T22:42:23.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15310" PostTypeId="1" CreationDate="2014-03-29T01:44:29.623" Score="0" ViewCount="350" Body="&lt;p&gt;what are the applications of Fourier transform in modulation ? What are modulation schemes that use Fourier transform? I guess, FSK &amp;amp; PSK are related to Fourier transform since it both have frequency and phase in their names respectively. &lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-03-29T03:07:55.350" Title="what are the applications of fourier transform in modulation" Tags="|modulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15311" PostTypeId="2" ParentId="15310" CreationDate="2014-03-29T03:07:55.350" Score="3" Body="&lt;p&gt;OFDM is usually modulated by using an IFFT (or FFT), using the DFT basis vectors for the multi-carrier orthogonality.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-03-29T03:07:55.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15312" PostTypeId="1" CreationDate="2014-03-29T03:28:06.883" Score="0" ViewCount="1281" Body="&lt;p&gt;I need to study a wave file for every 100 Hz. However, I dont know how can I design filer for each 100 Hz. Let's say 0-100 Hz, 100-200 Hz, ... , ((fs/2)-100) _  (fs/2) Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it any MATLAB code for it ?&#xA;How many samples are needed for bandwidth of 100  Hz ? I maen how should calculate it ?&#xA;Please guide me.&#xA;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="4327" LastActivityDate="2014-04-28T16:35:34.997" Title="Design Filter Banks for every 100 Hz" Tags="|matlab|fft|fourier-transform|filter-design|filter-bank|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15314" PostTypeId="2" ParentId="15312" CreationDate="2014-03-29T04:41:19.817" Score="1" Body="&lt;p&gt;I have assumed your sampling rate as 1KHz &amp;amp; designed the code. The minimum sampling frequency is the nyquist frequency ofcourse. That depends on your design input. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=1000; % sampling freq&#xA;fc=99/2; % cutoff freq for filter  &#xA;fc1=101/2; % cutoff freq for filter&#xA;LpfLength=96; % Number of Filter coefficients&#xA;NFFT=8192;&#xA;% Low Pass Filter&#xA;lpf=fir2(LpfLength-1,[0 fc fc1 fs/2]/(fs/2),[1 1 0 0]);&#xA;for n=1:LpfLength,&#xA;   lpf(1,n)=lpf(1,n)*complex(cos(2*pi*n*50/fs),sin(2*pi*n*50/fs)); &#xA;end&#xA;for q=2:(fs/100)+1,&#xA;    for n=1:LpfLength,&#xA;        lpf(q,n)=lpf(q-1,n)*complex(cos(2*pi*n*100/fs),sin(2*pi*n*100/fs)); &#xA;    end&#xA;end &#xA;&#xA;FFThn=fft(lpf(1,:),NFFT);    %enter any value between 1 &amp;amp; fs/100 in place of 1 for different bpf&#xA;magfhn=20*log10(abs(FFThn));    % Magnitude in dB&#xA;&#xA;figure;&#xA;plot((0:NFFT-1)*fs/NFFT,magfhn); %Freq. plot of LPF&#xA;xlabel('Frequency (Hz)');&#xA;ylabel('Magnitude (dB)');&#xA;title('Low Pass Prototype Filter')&#xA;axis([0 fs -100 5]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The variable lpf will hold different band pass filters in different rows. You can use those.&lt;/p&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2014-03-29T04:41:19.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15316" PostTypeId="2" ParentId="15305" CreationDate="2014-03-29T08:39:23.293" Score="4" Body="&lt;p&gt;1) The first equation should look like: &lt;code&gt;h_pred = ifft2 ( fft2(k) ./ fft2(x) )&lt;/code&gt;. You have a small typo there, I believe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you first zero-pad the kernel to the size of image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) MATLAB also has a blind deconvolution function:&#xA;&lt;a href=&quot;http://www.mathworks.com/help/images/ref/deconvblind.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/images/ref/deconvblind.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if you are referencing to this one, but for Toeplitz approach, I would refer to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] P. C. Hansen, “Deconvolution and Regularization with Toeplitz Matrices,” Numerical Algorithms, vol. 29, no. 4, pp. 323–378, 2002.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-29T08:39:23.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15317" PostTypeId="1" CreationDate="2014-03-29T12:09:49.343" Score="0" ViewCount="1393" Body="&lt;p&gt;I'm making a project connected with identifying dynamic of sales. That's how the piece of my database looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hJbmf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are free columns:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Product - present the group of product&lt;/li&gt;&#xA;&lt;li&gt;Week - time since launch the product (week), first 26 weeks&lt;/li&gt;&#xA;&lt;li&gt;Sales_gain - how the sales of product change by weeks&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the database there is 3302 observations = 127 time series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to cluster time series in groups which are going to show me different dynamic of sales. Before clustering I want to use Fast Fourier Transform to change time series on vectors and take into consideration amplitude etc and then use a distance algorithm and group products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's my first time I deal with FFT and clustering, so I would be grateful if anybody would point steps, which I have to do before/after using FFT to group dynamics of sales. I want to do all steps in R, so it would be wonderful if somebody type which procedures should I use to do all steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thats how my time series looks like now:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k19wU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that I am relatively new to time series analysis (that's why I cannot put here my code) so any clarity you could provide in R or any package you could recommend that would accomplish this task efficiently would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Instead of FFT I found the code for DTW here -&gt; &lt;a href=&quot;http://www.rdatamining.com/examples/time-series-clustering-classification&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;&lt;br&gt;&#xA;but cannot use it on my data base and time series (suggest R to analyze new time series after 26 weeks). Can somebody explain it to me?&lt;/p&gt;&#xA;" OwnerUserId="8410" LastEditorUserId="8202" LastEditDate="2014-03-30T13:34:27.453" LastActivityDate="2014-03-30T13:34:27.453" Title="Fast Fourier Transform and Clustering of Time Series" Tags="|fourier-transform|wavelet|time-frequency|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15318" PostTypeId="2" ParentId="15312" CreationDate="2014-03-29T15:44:31.467" Score="2" Body="&lt;p&gt;A windowed FFT with a length that corresponds to 2/100ths of a second will give you overlapping filters each with roughly 100 Hz bandwidth.  Just use every other FFT result bin if you want 100 Hz filter spacing.  The window shape (Von Hann, Nutall, etc.) will allow some tuning of the filter shape, but the main passband lobe of a windowed FFT will be about twice the FFT bin spacing in width.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An unwindowed FFT creates filters with too much stop band ripple to usually be considered useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also zero-pad and/or use an FFT a higher integer multiple of 0.01S in length to get better control over the windowing (a proportionately wider or narrower Gaussian window, for instance) and the window's frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of samples needed will be the FFT length in samples, or the sample rate multiplied by the FFT's length in time.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-03-29T15:56:03.017" LastActivityDate="2014-03-29T15:56:03.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15319" PostTypeId="1" CreationDate="2014-03-30T00:21:32.047" Score="2" ViewCount="4856" Body="&lt;p&gt;I am currently doing a project on sound signal processing by using MATLAB. I have a problem regarding creating the command line so that I can get a graph containing frequency by its time. But this graph is the result of an audio input. &#xA;example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = audioread('samson.wav')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I still can't get this kind of a result. How can I get this colour graph? Thank you&lt;img src=&quot;https://i.stack.imgur.com/9cdoE.jpg&quot; alt=&quot;this is example of color graph that i would like to have as a result, by putting an audio as an input&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="8413" LastEditorUserId="13320" LastEditDate="2016-11-21T13:01:39.653" LastActivityDate="2016-11-21T13:01:39.653" Title="Time-frequency representation of sound signal using Matlab" Tags="|signal-analysis|sound|time-frequency|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15320" PostTypeId="2" ParentId="15319" CreationDate="2014-03-30T02:13:33.683" Score="6" Body="&lt;p&gt;I believe that this &quot;color graph&quot; you are looking for is a &lt;strong&gt;spectrogram&lt;/strong&gt; (although it looks to me more like a scalogram, but you did not mentioned wavelets). Let me give you an example in MATLAB of obtaining such plot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;load handel&#xA;nfft = 512;  &#xA;noverlap = 128;&#xA;win = hamming(nfft);&#xA;spectrogram(y, win, noverlap, nfft, Fs, 'yaxis')&#xA;colormap('jet')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So first line is loading of some standard test recording, it gives you two variables: &lt;strong&gt;Fs&lt;/strong&gt; (sampling frequency) and &lt;strong&gt;y&lt;/strong&gt; (your signal). Next you define length of your analysis: &lt;strong&gt;nfft&lt;/strong&gt; in your Short Time Fourier Transform and by how many samples you want to shift your analysis window. When defining window you can use variety of them (simply check in MATLAB help), I've used most common one: Hamming window. Last line is for setting colour representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computation of spectrogram is very straightforward, please refer to help for more details: &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;click&lt;/a&gt;. The last argument 'yaxis' tells MATLAB to use horizontal time axis and vertical for frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having that you can play with length of your analysis window and the overlap. You must though understand one, most important thing: &lt;strong&gt;better resolution in time&lt;/strong&gt; (short window) &lt;strong&gt;yields poorer resolution in frequency domain and vice versa&lt;/strong&gt; - that's a trade-off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end you should get something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ibSTT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you would like to obtain the &lt;strong&gt;scalogram&lt;/strong&gt;, here's how to do it in MATLAB. Most important thing - you must have Wavelet Toolbox installed!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Definition of signal consisting of two sinusoids&#xA;f1 = 10;&#xA;f2 = 40;&#xA;Fs = 1000;&#xA;t  = 0:1/Fs:1;&#xA;y =  sin(2*pi*t*f1) + sin(2*pi*t*f2);&#xA;&#xA;wname = 'morl'; % Choosing the wavelet&#xA;scales = 1:1:128; % Defining scales&#xA;coefs = cwt(y, scales, wname); % Get wavelet coefficients&#xA;&#xA;wscalogram('image', coefs, 'scales', scales, 'ydata', y); % Get the scalogram, together with time domain signal overlayed&#xA;colormap(jet) % Set the colormap&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As a result you will get something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FnTgR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-04-01T08:35:06.447" LastActivityDate="2014-04-01T08:35:06.447" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="15323" PostTypeId="1" CreationDate="2014-03-30T13:23:27.170" Score="0" ViewCount="144" Body="&lt;p&gt;I have two force-time signals obtained from a couple of force plates, corresponding to input/output signals for some system. Plotting the two together one of the first things I noticed was a time delay. Initially I used cross correlation to gain some approximation for this feature however now I look a little closer I realize things are little more complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically the output trails behind the input with a time delay that is maximum at the maxima/minima on the two signals and in between the delay tends towards 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I literally have no idea how to express this. Can anyone suggest anything? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Rough plot below. Genuinely apologize for the MSPaint... I don't have access to anything better or my plots right now! Also the absolute integral of both signals is approximately equal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UU7Io.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking of making the time delay dependent on amplitude but sadly my mathematical skills at the moment restrict me to something as basic as pulling off maxima/minima with basic differentiation and recording the separation of corresponding features as a function of amplitude. Far too crude!&lt;/p&gt;&#xA;" OwnerUserId="8207" LastEditorUserId="8207" LastEditDate="2014-03-30T13:48:19.387" LastActivityDate="2014-03-30T13:48:19.387" Title="Describing a time delay at a maximum for maxima and minima but tends to 0 elsewhere" Tags="|discrete-signals|cross-correlation|impulse-response|transfer-function|delay|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15325" PostTypeId="1" CreationDate="2014-03-30T16:55:25.150" Score="0" ViewCount="3254" Body="&lt;p&gt;let us consider following matlab code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;help aicbic&#xA; aicbic Akaike and Bayesian information criteria&#xA;&#xA;  Syntax:&#xA;&#xA;    [aic,bic] = aicbic(logL,numParam,numObs)&#xA;&#xA;  Description:&#xA;&#xA;    Given optimized log-likelihood function values logL obtained by fitting&#xA;    a model to data, compute the Akaike (AIC) and Bayesian (BIC)&#xA;    information criteria. Since information criteria penalize models with&#xA;    additional parameters, aic and bic select models based on both goodness&#xA;    of fit and parsimony. When using either AIC or BIC, models that&#xA;    minimize the criteria are preferred.&#xA;&#xA;  Input Arguments:&#xA;&#xA;    logL - Vector of optimized log-likelihood objective function values&#xA;      associated with parameter estimates of various models.&#xA;&#xA;    numParam - Number of estimated parameters associated with each value &#xA;      in logL. numParam may be a scalar applied to all values in logL, or a &#xA;      vector the same length as logL. All elements of numParam must be &#xA;      positive integers.&#xA;&#xA;  Optional Input Argument:&#xA;&#xA;    numObs - Sample sizes of the observed data associated with each &#xA;      value of logL. numObs is required for computing BIC, but not AIC.&#xA;      numObs may be a scalar applied to all values in logL, or a vector the&#xA;      same length as logL. All elements numObs must be positive integers. &#xA;&#xA;  Output Arguments:&#xA;&#xA;    aic - Vector of AIC statistics associated with each logL objective&#xA;      function value. The AIC statistic is defined as:&#xA;&#xA;        aic = -2*logL + 2*numParam&#xA;&#xA;    bic - Vector of BIC statistics associated with each logL objective&#xA;      function value. The BIC statistic is defined as:&#xA;&#xA;        bic = -2*logL + numParam*log(numObs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let us suppose that we have the data in a &lt;code&gt;matlab&lt;/code&gt; vector &lt;code&gt;X&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I  apply this matlab function (&lt;code&gt;aicbic&lt;/code&gt;) to &lt;code&gt;X&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to find the AR order of the data.&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="80" LastEditDate="2014-03-30T17:12:28.650" LastActivityDate="2014-03-30T17:12:28.650" Title="How is `aicbic` or other matlab function used to find the AR order of specific data?" Tags="|matlab|autoregressive-model|" AnswerCount="0" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="15326" PostTypeId="1" AcceptedAnswerId="15327" CreationDate="2014-03-30T19:09:45.113" Score="2" ViewCount="918" Body="&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; &lt;a href=&quot;https://dsp.stackexchange.com/q/15326/80&quot;&gt;This is a question that another user has been trying (unsuccessfully) to ask.&lt;/a&gt; Because the multiple questions asking, essentially, the same thing have either been deleted by me (because they were duplicates of each other) or by the user, I have tried to ask the question in such a way that will help the user and is a good fit for the site.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a vector of data measurements, $x(n)$, and I want to fit a model to that data:&#xA;$$&#xA;x(n) =  \sum_{p=1}^{P} a_p \cos(2\pi f_p + \phi_p) + \epsilon(n)&#xA;$$&#xA;where each of the $P$ sinusoids is parameterized by $(a_p, f_p, \phi_p)$ and $\epsilon$ is an i.i.d. Gaussian, white noise process with zero mean and variance $\sigma^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: How do we use &lt;a href=&quot;http://en.wikipedia.org/wiki/Akaike_information_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;AIC&lt;/a&gt; (or &lt;a href=&quot;http://en.wikipedia.org/wiki/Bayesian_information_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;BIC&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Minimum_description_length&quot; rel=&quot;nofollow noreferrer&quot;&gt;MDL&lt;/a&gt;) to estimate the model order, $P$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Wikipedia entry just says:&#xA;$$&#xA;AIC = 2P - 2\ln(L)&#xA;$$&#xA;where $L$ is the likelihood function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I calculate $L$ given $x(n)$?&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-03-30T23:51:52.933" Title="Can someone show the details of how to apply AIC for sinusoidal models to specific data?" Tags="|autoregressive-model|" AnswerCount="1" CommentCount="6" CommunityOwnedDate="2014-03-30T19:14:58.200" ContentLicense="CC BY-SA 3.0" />
  <row Id="15327" PostTypeId="2" ParentId="15326" CreationDate="2014-03-30T22:44:52.597" Score="2" Body="&lt;p&gt;The PDF (likelihood function) of the multi-tone estimation problem is:&#xA;$$&#xA;{\cal L}({\bf x}; {\bf a}, {\bf f},{\bf \phi}, {\sigma}^2) = \frac{1}{(2\pi \sigma^2)^{\frac{N}{2}}} &#xA;\exp\left( - \frac{1}{2\sigma^2} \sum_{n=0}^{N-1} ( x(n) - \sum_{p=1}^{P} {a}_p \cos(2\pi {f}_p + {\phi}_p) )^2   \right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=510621&quot; rel=&quot;nofollow noreferrer&quot;&gt;The paper by Djuric&lt;/a&gt; quotes the AIC and MDL values as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ssqpC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code at the end attempts to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Generate a 5-tone noisy signal.&lt;/li&gt;&#xA;&lt;li&gt;Do the ML estimates of the amplitudes, frequencies and phases for a given value of $p$.&lt;/li&gt;&#xA;&lt;li&gt;Find the (log) likelihood values for each value of $p$.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the AIC and MDL values from Djuric.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The plot for $p = 1 \ldots 60$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IKtz8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, the AIC &lt;em&gt;over-estimates&lt;/em&gt; the model order. In this particular case, AIC gets 7 and MDL gets 5 (the correct value). The minima of each curve are plotted (as a &lt;code&gt;o&lt;/code&gt; on the AIC curve and as a &lt;code&gt;+&lt;/code&gt; on the MDL curve).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Djuric, P.M., &quot;A model selection rule for sinusoids in white Gaussian noise,&quot; &lt;em&gt;Signal Processing, IEEE Transactions on  (Volume:44 ,  Issue: 7 )&lt;/em&gt;, pp. 1744 - 1751.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;scilab&lt;/code&gt; CODE ONLY BELOW&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;P = 5;&#xA;f = [ 0.1 0.12 0.231 0.333 0.478634];&#xA;phi = [0.329847 5.90324 3.09834 4.907983 1.984];&#xA;a = [ 1 1 2 2 3];&#xA;sigma = 1;&#xA;&#xA;N = 100;&#xA;&#xA;x = cos(2*%pi*[0:N-1]'*f + ones(N,1)* phi )*a';&#xA;&#xA;xn = x + sigma*rand(N,1,'normal');&#xA;&#xA;&#xA;function [L,LL] = likelihood(data,ahat,fhat,phihat,sigmahat)&#xA;    N = length(data);&#xA;    datahat = cos(2*%pi*[0:N-1]'*fhat + ones(N,1)* phihat )*ahat';&#xA;    L = 1/(2*%pi*sigmahat*sigmahat)^(N/2) * exp(-1/(2*sigmahat*sigmahat)*sum((data - datahat).^2));&#xA;    LL = - log(2*%pi*sigmahat*sigmahat)*N/2 - -1/(2*sigmahat*sigmahat)*sum((data - datahat).^2);&#xA;endfunction&#xA;&#xA;function [a,m] = aic(p,L,N)&#xA;    a = 3*p - log(L);&#xA;    m = 3*p/2*log(N) - log(L);&#xA;endfunction&#xA;&#xA;function [ahat,fhat,phihat,regr] = sin_estimate(data)&#xA;    PAD = 10;&#xA;    N = length(data);&#xA;    DATA = fft([data; zeros((PAD-1)*N,1)],-1);&#xA;    [mx,ix] = max(abs(DATA(1:N*PAD/2,1)));&#xA;    ahat = mx/(N/2);&#xA;    fhat = (ix-1)/N/PAD;&#xA;    phihat = atan(imag(DATA(ix)),real(DATA(ix)));&#xA;&#xA;    regr = data - cos(2*%pi*[0:N-1]'*fhat + ones(N,1)* phihat )*ahat&#xA;endfunction&#xA;&#xA;pValues = [1:60];&#xA;likeValues = [];&#xA;loglikeValues = [];&#xA;aicValues = [];&#xA;mdlValues = [];&#xA;for p=pValues,&#xA;    signal = xn;&#xA;    a_est = zeros(1,p);&#xA;    f_est = zeros(1,p);&#xA;    phi_est = zeros(1,p);&#xA;    for pp=1:p&#xA;        [a_est(pp),f_est(pp),phi_est(pp),signal] =  sin_estimate(signal);   &#xA;    end&#xA;&#xA;    [l,ll] = likelihood(xn,a_est,f_est,phi_est,sigma);&#xA;&#xA;    likeValues = [likeValues l];&#xA;    loglikeValues = [loglikeValues ll];&#xA;&#xA;    [aicv,mdlv] = aic(p,likeValues(p));&#xA;    aicValues = [aicValues; aicv]&#xA;    mdlValues = [mdlValues; mdlv]&#xA;end&#xA;&#xA;clf;&#xA;plot(aicValues);&#xA;plot(mdlValues,'r');&#xA;title('AIC and MDL plots');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2014-03-30T23:51:52.933" LastActivityDate="2014-03-30T23:51:52.933" CommentCount="5" CommunityOwnedDate="2014-03-30T22:44:52.597" ContentLicense="CC BY-SA 3.0" />
  <row Id="15328" PostTypeId="1" AcceptedAnswerId="15339" CreationDate="2014-03-31T02:58:38.883" Score="1" ViewCount="291" Body="&lt;p&gt;Basically the same as this question, but it was never really answered: &lt;a href=&quot;https://dsp.stackexchange.com/questions/3436/stereo-sound-separation-into-three-sources&quot;&gt;Stereo sound separation into three sources&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine I have a really trivial signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Left: 100Hz tone + 200Hz tone + 500Hz tone&lt;/li&gt;&#xA;&lt;li&gt;Right: 500Hz tone + 1kHz tone + 2kHz tone&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd like to perform some operation where I can decompose Left and Right into L', R' and C. Where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;L': 100Hz + 200Hz&lt;/li&gt;&#xA;&lt;li&gt;R': 1kHz + 2kHz&lt;/li&gt;&#xA;&lt;li&gt;C : 500Hz&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd like the algorithm to work reasonably well for mixed, commercial music, which would exclude just a simple FFT analysis (I think.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started out looking at correlation, but I don't think that applies in this case. Now I'm thinking I need to be looking at ICA, but that seems to be focused on producing N signals from a single input, and not 3 signals from 2 inputs...&lt;/p&gt;&#xA;" OwnerUserId="7125" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2014-03-31T17:23:50.740" Title="Decompose stereo signal" Tags="|audio|correlation|ica|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15330" PostTypeId="1" CreationDate="2014-03-31T08:41:33.733" Score="0" ViewCount="72" Body="&lt;p&gt;I am working on tracking an object in a video by using its color. what i did is that i have converted the color of a selected object into LAB color space since it is a uniform color space. and then in each frame of video i am searching for same color by finding color difference in LAB color space. Now main problem is arising when more than one object of same color is appearing in the video scene. one method i adopted for avoiding detection of wrong object is to search for same color in limited area  around last detected position of the object. but this is causing failure to detect fast moving objects and leaving my methods suitable for slow moving targets only. so i want to know is there any method i can apply for avoiding wrong detection.&lt;/p&gt;&#xA;" OwnerUserId="7084" LastActivityDate="2014-03-31T10:52:58.490" Title="Tracking using color" Tags="|image-processing|color|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15331" PostTypeId="2" ParentId="15330" CreationDate="2014-03-31T08:52:41.363" Score="0" Body="&lt;p&gt;You can use meanshift from OpenCV:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.opencv.org/trunk/doc/py_tutorials/py_video/py_meanshift/py_meanshift.html&quot; rel=&quot;nofollow&quot;&gt;http://docs.opencv.org/trunk/doc/py_tutorials/py_video/py_meanshift/py_meanshift.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-31T08:52:41.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15333" PostTypeId="1" AcceptedAnswerId="15334" CreationDate="2014-03-31T10:10:49.180" Score="0" ViewCount="204" Body="&lt;p&gt;You know that a sine corresponds to a pulse by J.Fourier transform. The lower is the frequency, the closer is the pulse to the origin. A constant signal is a sine (or cosine, that may be important) of frequency 0. It is a pulse in the origin. This is ok, since &lt;a href=&quot;https://dsp.stackexchange.com/questions/9842&quot;&gt;we know very well that a pulse transforms to the white spectrum: it is a combination of all sine waves at once&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I see a contradiction here. I have just shown that a constant is also a sine of frequency 0 and, also, a combination of all frequencies. A sine of frequency 0 is a sum of all frequencies. How is this possible?&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-03-31T10:29:53.223" Title="Sine of frequency 0 contains sines of all frequencies at once in it" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15334" PostTypeId="2" ParentId="15333" CreationDate="2014-03-31T10:29:25.720" Score="5" Body="&lt;p&gt;You are confusing time domain and frequency domain. A constant time domain function (a sine with frequency 0, if you like) corresponds to a delta impulse at the origin (i.e., frequency zero!) in the &lt;em&gt;frequency domain&lt;/em&gt;. A delta impulse at frequency zero is zero for all other frequencies $\omega\neq 0$. Consequently, a constant in the time domain is not a combination of all frequencies. What you were probably thinking of is a delta impulse in the &lt;em&gt;time domain&lt;/em&gt;, which corresponds to a constant in the frequency domain (i.e., it contains all frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, summarizing, a constant in one domain corresponds to a delta impulse in the other domain. A constant in the time domain does not contain any frequencies other than 0 (delta at zero in the frequency domain). A constant in the frequency domain (i.e. a combination of all frequencies) corresponds to a delta impulse in the time domain.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-03-31T10:29:25.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15335" PostTypeId="2" ParentId="15330" CreationDate="2014-03-31T10:52:58.490" Score="1" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You can check the area of the same-color region. It should be close to the last one and it should be around some value (you can filter out very small and very big regions).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can check rectangularity, circularity, convexity, angle, width, height depending on your object to be tracked.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If your false-detected regions are very small, you can try to a bit smooth the image first and then check for values.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Besides that if the false detected objects are very similar to the correct ones, your method seems to be the most feasible way to do it. You can consider making it faster by choosing different platform or optimizations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8423" LastActivityDate="2014-03-31T10:52:58.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15336" PostTypeId="2" ParentId="15328" CreationDate="2014-03-31T11:08:41.810" Score="6" Body="&lt;p&gt;There a few commercial algorithms that do exactly that (Dolby Prologic, DTS Neo 6, Lexicon Logic 7, Bose Videostage, etc.). If your project has the funds, you can simply try to license one of those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inner workings of these algorithms are rather complicated and typically a mixture of time domain and frequency domain feature extraction, some steering logic, and some real time steering mechanics (time variant mixers, sub band filters, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple signals like your example are normally easy to tease apart, however almost all music is  partially correlated and overlapping both in time and frequency. For starters it's difficult to define what actually SHOULD be in the center and the Left and Right. The algorithm has to make a lot of &quot;artistic&quot; decision to make sure there are no steering artifacts and it meets the design intent over a wide variety of source material. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-31T11:08:41.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15338" PostTypeId="2" ParentId="10541" CreationDate="2014-03-31T13:55:50.103" Score="-2" Body="&lt;p&gt;The DFT is the transform of limited no of samples of a periodic signal.&#xA;the DTFT is a transform of the entire sample signal from $-\infty$ to $+\infty$ and input so not necessarily periodic.&lt;/p&gt;&#xA;" OwnerUserId="8426" LastEditorUserId="80" LastEditDate="2014-03-31T14:19:14.203" LastActivityDate="2014-03-31T14:19:14.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15339" PostTypeId="2" ParentId="15328" CreationDate="2014-03-31T14:40:59.337" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://arrow.dit.ie/cgi/viewcontent.cgi?article=1036&amp;amp;context=argcon&quot; rel=&quot;nofollow&quot;&gt;A very simple algorithm for stereo signals which are a combination of &quot;panned&quot; mono sources.&lt;/a&gt; This allows you to take a stereo source and &quot;listen&quot; to signals panned at a given point, or within a given range of the pan parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveats:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It does not work well if the mix is more than a sum of panned mono sources (stereo reverb applied to the mix, tracks captured with a pair of overhead mics).&lt;/li&gt;&#xA;&lt;li&gt;It heavily relies on the assumption that two sources will never overlap in the time/frequency/azimuth space (which is going to be wrong for music).&lt;/li&gt;&#xA;&lt;li&gt;It also suffers from the usual artefacts of STFT-based methods (incorrect phase estimation) - but this problem is common to a very large range of algorithms found in the source separation literature.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-03-31T17:23:50.740" LastActivityDate="2014-03-31T17:23:50.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15340" PostTypeId="2" ParentId="1317" CreationDate="2014-03-31T15:40:51.180" Score="3" Body="&lt;p&gt;I have got a guitar a month ago and started writing a &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.igorinov.stringtuner&quot; rel=&quot;nofollow&quot;&gt;PLL-based tuner&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the resources I used to understand PLL was &lt;a href=&quot;http://arachnoid.com/phase_locked_loop/&quot; rel=&quot;nofollow&quot;&gt;&quot;Understanding Phase-Locked Loops&quot;&lt;/a&gt; page by Paul Lutus.&lt;/p&gt;&#xA;" OwnerUserId="8428" LastActivityDate="2014-03-31T15:40:51.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15341" PostTypeId="1" AcceptedAnswerId="15344" CreationDate="2014-03-31T15:41:45.640" Score="-3" ViewCount="7509" Body="&lt;p&gt;Is 1.0e-03 * 0.9734 equivalent to 0.9734 * 10^-3 = 0.0009734 ? Because I am not sure &lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-03-31T17:54:03.340" Title="1.0e-03 * 0.9734 numerical representation in Matlab" Tags="|matlab|" AnswerCount="2" CommentCount="1" ClosedDate="2014-04-02T15:17:15.353" ContentLicense="CC BY-SA 3.0" />
  <row Id="15343" PostTypeId="2" ParentId="15341" CreationDate="2014-03-31T16:00:59.107" Score="0" Body="&lt;p&gt;Yes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; 1.0e-03 * 0.9734&#xA;ans =&#xA;    0.0009734&#xA;&amp;gt;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-03-31T16:00:59.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15344" PostTypeId="2" ParentId="15341" CreationDate="2014-03-31T17:54:03.340" Score="1" Body="&lt;p&gt;When you have &lt;code&gt;y = Xe-3&lt;/code&gt; that's a shorter way of saying &lt;code&gt;y = X * 10^-3&lt;/code&gt;. Since multiplication distributes and the &lt;code&gt;e&lt;/code&gt; operator only looks for the next number by default, yes, &lt;code&gt;1e-3 * X = X * 1e-3 = X * 10^-3&lt;/code&gt;. Likewise for addition.&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2014-03-31T17:54:03.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15345" PostTypeId="1" CreationDate="2014-03-31T17:55:33.743" Score="3" ViewCount="1108" Body="&lt;p&gt;I have an elementary function $p:\mathbb{R}^2\rightarrow\mathbb{R}$ which (locally) represents an image. It's a polynomial, and its the result of the following 2D convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p=f\star G\star \mathbf{1}_{A}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $G(x,y)$ is a 2D Gaussian, and $\mathbf{1}_A$ 'box' function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(x,y)=e^{-\frac{(x^2+y^2)}{2\sigma^2}}, \quad\mathbf{1}_A(x,y)=1 \text{ for }x \text{ and } y &amp;lt; a, 0\text{ otherwise.}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a closed form for a function with which I can convolve $p$, which results in $f$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am 'avoiding' the use of such a filter by performing Fourier deconvolution, but mathematically this opens a huge can of worms.&lt;/p&gt;&#xA;" OwnerUserId="1965" LastEditorUserId="1965" LastEditDate="2014-03-31T18:57:55.063" LastActivityDate="2017-07-15T15:13:40.800" Title="Continuous-time mathematical formula for deconvolution filters" Tags="|filters|filter-design|convolution|continuous-signals|deconvolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15347" PostTypeId="1" AcceptedAnswerId="15348" CreationDate="2014-03-31T18:24:47.183" Score="0" ViewCount="132" Body="&lt;p&gt;I have one image. I want to segment it by simple approach. Could you suggest to me the best method to segment it? I think one of them is gradient or FCM. But I am not sure. Please see  my given image file &lt;a href=&quot;https://www.dropbox.com/s/ptym1zik6j35fq4/imagetest.mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;br&gt;&#xA;and segmented image file below&lt;img src=&quot;https://i.stack.imgur.com/9e5WX.png&quot; alt=&quot;here&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2014-03-31T19:08:01.563" Title="Best method to segment a given image" Tags="|image-processing|image-segmentation|machine-learning|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15348" PostTypeId="2" ParentId="15347" CreationDate="2014-03-31T18:47:45.310" Score="0" Body="&lt;p&gt;For such a segmentation, you might want to use graphcuts:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Graph_cuts_in_computer_vision&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Graph_cuts_in_computer_vision&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However lately there have been better algorithms proposed, such as Branch and Mincut:&#xA;&lt;a href=&quot;http://research.microsoft.com/en-us/downloads/994e80f7-007b-4fed-a6e9-db5f4f32ccd1/&quot; rel=&quot;nofollow&quot;&gt;http://research.microsoft.com/en-us/downloads/994e80f7-007b-4fed-a6e9-db5f4f32ccd1/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For most of the methods, source codes are available and you could try them out of the box. Also check out:&#xA;&lt;a href=&quot;http://vision.csd.uwo.ca/code/&quot; rel=&quot;nofollow&quot;&gt;http://vision.csd.uwo.ca/code/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-03-31T18:47:45.310" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15351" PostTypeId="1" CreationDate="2014-03-31T21:00:01.907" Score="5" ViewCount="2360" Body="&lt;p&gt;Why do some tables say that Laplace (or Fourier?) inverse of exponential is a time-shifted delta pulse &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\delta (t) &amp;amp;\overset{\mathcal F}{\Longleftrightarrow} 1\\&#xA;\delta (t-t_0) &amp;amp;\overset{\mathcal F}{\Longleftrightarrow} e^{-j2\pi f t_0}\\&#xA;1 &amp;amp;\overset{\mathcal F}{\Longleftrightarrow} \delta (f)\\&#xA;e^{j2\pi f_0 t} &amp;amp;\overset{\mathcal F}{\Longleftrightarrow}\delta (f-f_0)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And table:&#xA;\begin{array}{c|c}&#xA;f(t)=\mathcal L^{-1}\left\{\mathcal F(s)\right\}&amp;amp;\mathcal F(s)=\mathcal L\left\{f(t)\right\}\\\hline&#xA;e^{at}&amp;amp;\displaystyle\frac{1}{s-a}&#xA;\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whereas others say that it is a (pole) hyperbola rather than a delta-pulse?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e^{at}\overset{\mathcal F}{\Longleftrightarrow}\frac{1}{s-a}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="1629" LastEditDate="2016-08-26T06:13:23.727" LastActivityDate="2016-08-26T06:13:23.727" Title="Fourier transform of exponent: Delta pulse or hyperbola?" Tags="|fourier-transform|laplace-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15352" PostTypeId="2" ParentId="15351" CreationDate="2014-03-31T22:16:30.463" Score="3" Body="&lt;p&gt;The first table is a table of Fourier transform pairs.  The second table is a table of one Laplace transform pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If things were all correct, then you should be able to set $s = j\omega$ in the Laplace transform pair to get the Fourier transform pair:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e^{j\omega_0 t} \leftrightarrow \frac{1}{j(\omega - \omega_0)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is a problem with this: it has a singularity at $\omega = 0$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this means is that the usual definition of functions breaks down.  &lt;a href=&quot;https://dsp.stackexchange.com/a/11558/80&quot;&gt;See this great answer to a related (duplicate?) question from Dilip.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-03-31T22:16:30.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15353" PostTypeId="2" ParentId="15305" CreationDate="2014-04-01T01:09:38.563" Score="2" Body="&lt;p&gt;I figured it out. The correct answer is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H=X^{-1}KX^{-1}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="4550" LastActivityDate="2014-04-01T01:09:38.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15354" PostTypeId="2" ParentId="15260" CreationDate="2014-04-01T03:23:57.497" Score="2" Body="&lt;p&gt;This answer would not have been possible without &lt;a href=&quot;https://dsp.stackexchange.com/a/15273/8376&quot;&gt;Matt L.'s answer&lt;/a&gt;, as well as some out of band communication with &lt;a href=&quot;https://dsp.stackexchange.com/users/64/nibot&quot;&gt;nibot&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's see one way to derive the formula for computing the average that is given in the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting from a set of numbers $\{x_n\}$, we have the definition of the average up to the $n$th sample:&#xA;$$ a_n = \frac{1}{n}\sum_{j=1}^n x_j = \frac{1}{n}s_n,$$&#xA;and $s_n$ is the sum of all samples up to $n$. Now, $s_n$ can be defined recursively:&#xA;$$ s_n=s_{n-1}+x_n,$$&#xA;and given that $na_n=s_n$, we have:&#xA;$$ a_n=\frac{n-1}{n}a_{n-1}+\frac{x_n}{n}.$$&#xA;And we have the averaging formula from the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we want to basically perform this averaging operation again on the $a_n$ samples. So we just repeat the same formula, but now for the averages of $a_n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d_n = \frac{n-1}{n}d_{n-1}+\frac{a_n}{n},$$&#xA;$$d_n = \frac{n-1}{n}d_{n-1}+\frac{n-1}{n^2}a_{n-1}+\frac{x_n}{n^2}, $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but we can replace $a_{n-1}$ in terms of $d_{n-1}$ and $d_{n-2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d_n = \frac{n-1}{n}d_{n-1}+\frac{n-1}{n^2}\left[(n-1)d_{n-1}-(n-2)d_{n-2}\right]+\frac{x_n}{n^2}, $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and finally after simplification&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d_n =\frac{(2n-1)(n-1)}{n^2}d_{n-1}-\frac{(n-1)(n-2)}{n^2}d_{n-2}+\frac{x_n}{n^2}.$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this set of numbers is equivalent to &quot;averaging the averages&quot; and only requires two stored values!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below I plot a signal which is random noise where the RMS is 20 times the mean value. I also show the first and second order averages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RgUDh.png&quot; alt=&quot;demonstration of second order average&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As one can see, the second order average takes longer to approach the true mean value, but it has smaller fluctuations relative to the mean. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fluctuations get smaller as more and more samples are recorded, so it has the added benefit that the time scale of the effective low-pass filter is always increasing. If this were a simple low pass filter with a fixed pole frequency, then at some point we would be throwing away information from very old samples. This filter uses information from all samples, regardless of how old they are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I think this recipe can be repeated and the average can be done to any order.&lt;/p&gt;&#xA;" OwnerUserId="8376" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2014-04-01T18:48:37.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15355" PostTypeId="1" CreationDate="2014-04-01T04:01:54.300" Score="0" ViewCount="450" Body="&lt;p&gt;In Radar signal processing, one has to separate clutter(unwanted signals) from moving target signals.&lt;/p&gt;&#xA;&lt;p&gt;The picture given below is an example of Radar Signal Power Spectrum(taken from the book Radar Systems Analysis  and Design Using MATLAB by B.R. Mahafza).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/3MM00.jpg&quot; alt=&quot;Radar Signal Power Spectrum&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why target return is coming in between 0(DC) and &lt;span class=&quot;math-container&quot;&gt;$f_{r}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$f_{r}$&lt;/span&gt; is the pulse repetition frequency.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="7092" LastEditDate="2022-01-16T23:47:18.463" LastActivityDate="2022-01-16T23:47:18.463" Title="Why the radar (moving) target return is not centered at zero frequency" Tags="|fft|frequency-spectrum|radar|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15356" PostTypeId="2" ParentId="15351" CreationDate="2014-04-01T09:10:11.770" Score="8" Body="&lt;p&gt;As pointed out by Peter K., it is important to distinguish between Laplace and Fourier transforms. The first few transform pairs in your question are Fourier transform pairs, whereas the last pair is a correspondence of the &lt;em&gt;unilateral&lt;/em&gt; Laplace transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(s)=\int_{0}^{\infty}f(t)e^{-st}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the last transform pair in your question the $\mathcal{F}$ symbol is wrong because it would imply that it is a general Fourier transform pair. To be precise, the (Laplace transform) correspondence is actually&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{at}u(t)\Longleftrightarrow \frac{1}{s-a}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because with the unilateral Laplace transform we only consider causal time functions, which satisfy $f(t)=0$ for $t&amp;lt;0$. Note that this is not necessarily the case with Fourier transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's now consider the Fourier transform of the (causal) time function in (1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(j\omega)=\int_{-\infty}^{\infty}e^{at}u(t)e^{-j\omega t}dt=\int_{0}^{\infty}e^{-(j\omega - a)t}dt=\frac{1}{j\omega-a},\quad \textrm{for Re}\{a\}&amp;lt;0\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing (1) and (2) we see that, for $Re\{a\}&amp;lt;0$, the two transforms are indeed the same for $s=j\omega$. For $Re\{a\}&amp;gt;0$ the Fourier transform does not exist because the region of convergence of the Laplace transform $F(s)$ does not contain the imaginary axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us finally consider the time function $f(t)=e^{j\omega_0 t}$. If we were to multiply it with the step function $u(t)$, its unilateral Laplace transform exists according to equation (1) with $a=j\omega_0$. However, if we consider the function for $-\infty&amp;lt;t&amp;lt;\infty$, then its (bilateral) Laplace transform does not exist, whereas its Fourier transform does exist. It is given by a delta impulse in the frequency domain as shown in your table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we now make sense of the relation between the Fourier and the (unilateral) Laplace transform? We must consider three cases:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The region of convergence of the Laplace transform $F(s)$ contains the $j\omega$ axis: then the Fourier transform is simply the Laplace transform evaluated at $s=j\omega$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The region of convergence of the Laplace transform $F(s)$ does not contain the $j\omega$ axis: then the Fourier transform does not exist.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The region of convergence is $Re\{s\}&amp;gt;0$ but there are singularities on the $j\omega$ axis: both transforms exist but they have different forms. The Fourier transform has additional delta impulses. Consider the function $f(t)=e^{j\omega_0 t}u(t)$. From (1), its Laplace transform is given by&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$F(s)=\frac{1}{s-j\omega_0}$$&#xA;However, due to the singularity on the $j\omega$ axis, its Fourier transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(j\omega)=\pi\delta(\omega-\omega_0)+\frac{1}{j\omega-j\omega_0}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might seem that the Laplace transform is more general than the Fourier transform (when looking at the second point above), but this is actually not the case. In system theory, there are many important functions which are not causal, e.g. the impulse responses of ideal band-limiting (brick-wall) filters. For these functions the Laplace transform does not exist, but their Fourier transform exists. The same is of course true for sinusoidal functions defined for $-\infty&amp;lt;t&amp;lt;\infty$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-02T11:22:55.843" LastActivityDate="2014-04-02T11:22:55.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15357" PostTypeId="1" AcceptedAnswerId="15364" CreationDate="2014-04-01T09:38:36.823" Score="1" ViewCount="512" Body="&lt;p&gt;(copy from &lt;a href=&quot;https://stackoverflow.com/questions/22573839/proper-meaning-and-origin-of-pcm-pulse-code-modulation&quot;&gt;Proper meaning (and origin) of PCM (pulse code modulation)? - Stack Overflow&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apologies first, as StackOverflow is possibly not the right forum for this question; in that case please suggest a move in the comments. But it is motivated by usage in documentation like &lt;a href=&quot;http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;ALSA project - the C library reference: PCM (digital audio) interface&lt;/a&gt; - and at least there is code (below) for the images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is - when I hear the term &quot;Pulse Code Modulation&quot;, the first thing that pops in my mind is this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/km6px.png&quot; alt=&quot;test_p4.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess, that would be the &lt;a href=&quot;http://en.wikipedia.org/wiki/Binary-coded_decimal#BCD_in_Electronics&quot; rel=&quot;nofollow noreferrer&quot;&gt;BCD&lt;/a&gt; representation of a level, encoded as serial signal transitions (MSB first).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then, I read the above PCM link, or &lt;a href=&quot;http://en.wikipedia.org/wiki/PCM&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pulse-code modulation - Wikipedia&lt;/a&gt;, and it turns out it is not so; for comparison:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nww0k.png&quot; alt=&quot;test_p3.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that U1 in the above image would be PAM (pulse amplitude modulation); U3 would be PWM (pulse width modulation) - and it is U2 that would represent PCM (pulse code modulation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then, when I look at U2 - I'd &lt;em&gt;also&lt;/em&gt; call that &quot;pulse amplitude modulation&quot;; in a way, U2 is also amplitude modulation, no? Why is it then called &quot;pulse &lt;em&gt;code&lt;/em&gt; modulation&quot; instead? I guess the word &quot;code&quot; is what confuses me most here, and makes me first think of something like U4 above -  for the case of U4 it is clear, but which is this &quot;code&quot;, which had been &quot;modulated&quot; onto the signal in the case of U2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Latex source for the images:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\documentclass{standalone}&#xA;&#xA;\def\plotchoice{4} % 1 - last; 3 - first three; 4 - all four&#xA;&#xA;\usepackage{pgfplots}&#xA;\pgfplotsset{compat=1.5.1}&#xA;\usepackage{pgfplotstable}&#xA;\usepackage{tikz}&#xA;\usetikzlibrary{calc}&#xA;\usetikzlibrary{fit}&#xA;\usetikzlibrary{pgfplots.groupplots}&#xA;\usepackage{tikz-timing}&#xA;\renewcommand{\ttdefault}{pcr} % courier for boldface typewriter&#xA;&#xA;% to have the H character filled:&#xA;% (( note - if { LL LH HL H 0.9H 0.1L}:&#xA;% must split last H to 0.9H 0.1 (so to&#xA;% end on L, without drawing beyond range)&#xA;% else the fill of H is not good. ))&#xA;\tikztimingdef{HL}{&#xA;  -- ++(\slope,-\height)&#xA;  [fill=black] \tikztiminguse{HH}{#1-\slope}&#xA;}&#xA;&#xA;% define H and L as A and B with added text&#xA;\tikztimingmetachar{A}{H N[&#xA;  rectangle,align=center,&#xA;  xshift=-0.5\xunit,yshift=-0.5\yunit,&#xA;  font=\large\tt\bfseries,&#xA;  color=black!65,&#xA;]{1}}&#xA;\tikztimingmetachar{B}{L N[&#xA;  rectangle,align=center,&#xA;  xshift=-0.5\xunit,yshift=+0.5\yunit,&#xA;  font=\large\tt\bfseries,&#xA;  color=black!65,&#xA;]{0}}&#xA;&#xA;\makeatletter&#xA;% http://tex.stackexchange.com/questions/33703/extract-x-y-&#xA;\newcommand{\gettikzxy}[3]{%&#xA;  \tikz@scan@one@point\pgfutil@firstofone#1\relax&#xA;  \edef#2{\the\pgf@x}%&#xA;  \edef#3{\the\pgf@y}%&#xA;}&#xA;\newlength{\trx}\newlength{\try}&#xA;\def\getlengths{%&#xA;\gettikzxy{(refsize)}{\rx}{\ry}&#xA;%  %re-convert \rx back to length, so can scale it directly in style= below:&#xA;\setlength{\trx}{\rx}\setlength{\try}{\ry}&#xA;\typeout{rx \rx , ry \ry ; (\the\trx , \the\try)}&#xA;\gettikzxy{(refnull)}{\rx}{\ry}&#xA;\addtolength{\trx}{-\rx}&#xA;\addtolength{\try}{-\ry}&#xA;\typeout{orx \rx , ory \ry ; (\the\trx , \the\try)}&#xA;}&#xA;\makeatother&#xA;&#xA;&#xA;\begin{document}&#xA;&#xA;\pgfplotstableread[col sep=&amp;amp;,row sep=\\]{&#xA;  0 &amp;amp; 0 \\&#xA;  1 &amp;amp; 1 \\&#xA;  2 &amp;amp; 3 \\&#xA;  3 &amp;amp; 2 \\&#xA;  4 &amp;amp; 2 \\&#xA;}\mytable&#xA;&#xA;% note: remember picture has side effect of cancelling xlabels at=edge bottom&#xA;\begin{tikzpicture}%[remember picture]&#xA;&#xA;\begin{groupplot}[&#xA;  group style={&#xA;    group name=my plots,&#xA;    group size=1 by \plotchoice,&#xA;    xlabels at=edge bottom,&#xA;    xticklabels at=edge bottom,&#xA;    vertical sep=0pt,&#xA;  },&#xA;  footnotesize,&#xA;  width=10cm,&#xA;  height=4cm, % of single subplot&#xA;  xlabel={$t$\,[s]},&#xA;  xmin=-0.5, xmax=4.5,&#xA;  ymin=0, ymax=3.5,&#xA;  xtick={-0.5,0,...,4.5},&#xA;  ytick={1,2,3},&#xA;  tickpos=left,&#xA;  ytick align=outside,&#xA;  xtick align=outside,&#xA;  axis x line=middle,&#xA;  axis x line*=bottom,&#xA;  axis y line=middle,&#xA;  axis y line*=left,&#xA;  ylabel style={align=right,anchor=north,shift={(-3.2em,+0.4em)},font=\small},&#xA;]&#xA;&#xA;\ifnum\plotchoice&amp;gt;2 %&#xA;\typeout{plotchoice &amp;gt; 2}&#xA;\nextgroupplot[ybar,bar width={1pt},restrict x to domain=0:3.5,ylabel=U1]&#xA;\addplot[fill=black,draw=black,mark=*]&#xA;  table[] \mytable;&#xA;&#xA;\node[] (refnull) at ({axis cs:0,0}) {};&#xA;\node[] (refsize) at ({axis cs:1,1}) {};&#xA;&#xA;\nextgroupplot[const plot,ylabel=U2]&#xA;\addplot[fill=black,draw=black,line width=2pt] table[] \mytable \closedcycle;&#xA;&#xA;\nextgroupplot[ylabel=U3]&#xA;\addplot [] coordinates {(0,0)};&#xA;\pgfplotsextra{ % must have, else \gettikzxy will not work!&#xA;\getlengths&#xA;\timing[line width=2pt,&#xA;  %style={x=0.333\trx,y=1\try}, %ok, but \xunit,\yunit are not set&#xA;  %timing/.style={xunit=0.333\trx,yunit=1\try}, % nowork&#xA;  % like this - so \xunit,\yunit are set:&#xA;  timing/xunit={0.333\trx},&#xA;  timing/yunit={1\try},&#xA;  name=tgraph1,&#xA;]&#xA;    at ({axis cs:0,0})&#xA;  { LLL HLL HHH HHL };&#xA;}&#xA;\fi&#xA;&#xA;\ifnum\ifnum\plotchoice=1 1\else\ifnum\plotchoice=4 1\else0\fi\fi =1 %&#xA;\typeout{plotchoice 1 or 4}&#xA;\nextgroupplot[ylabel=U4]&#xA;\addplot [] coordinates {(0,0)};&#xA;\ifnum\plotchoice=1{&#xA;\node[] (refnull) at ({axis cs:0,0}) {};&#xA;\node[] (refsize) at ({axis cs:1,1}) {};&#xA;}\else\fi&#xA;\pgfplotsextra{ % must have, else \gettikzxy will not work!&#xA;  %\typeout{; (\the\trx , \the\try)} % 0pt here! so must do again:&#xA;\getlengths %&#xA;\timing[line width=2pt,&#xA;  timing/xunit={0.5\trx},&#xA;  timing/yunit={1\try},&#xA;  name=tgraph2,&#xA;]&#xA;    at ({axis cs:0,0})&#xA;  { BB BA AA AB};&#xA;}&#xA;\fi&#xA;&#xA;\end{groupplot}&#xA;&#xA;\coordinate (refdelta) at ($(refsize)-(refnull)$) ;&#xA;&#xA;% vertical lines spanning all plots:&#xA;\foreach \ix in {0,1,...,4} {&#xA;  \draw[draw=black!30,dashed,line width=1pt]&#xA;    let \p1 = ($(refnull)+\ix*(refdelta)$),&#xA;    \p2 = (my plots c1r\plotchoice.south),&#xA;    \p3 = (my plots c1r1.north)&#xA;  in %&#xA;  (\x1,\y2) -- (\x1,\y3) ;&#xA;}&#xA;% vertical lines plot 3:&#xA;\ifnum\plotchoice&amp;gt;2&#xA;\foreach \ix in {0,1,2,3} {&#xA;  \foreach \ixx in {1,2,3} {&#xA;    \draw[draw=black!30,dashed,line width=0.5pt]&#xA;      let \p1 = ($(refnull)+\ix*(refdelta)+\ixx*0.333*(refdelta)$),&#xA;      \p2 = (my plots c1r3.south),&#xA;      \p3 = (my plots c1r3.center)&#xA;    in %&#xA;    (\x1,\y2) -- (\x1,\y3) ;&#xA;  }&#xA;}&#xA;\fi&#xA;% vertical lines plot 4:&#xA;\ifnum\ifnum\plotchoice=1 1\else\ifnum\plotchoice=4 1\else0\fi\fi =1 %&#xA;\foreach \ix in {0,1,2,3} {&#xA;  \foreach \ixx in {1,2} {&#xA;    \draw[draw=black!30,dashed,line width=0.5pt]&#xA;      let \p1 = ($(refnull)+\ix*(refdelta)+\ixx*0.5*(refdelta)$),&#xA;      \p2 = (my plots c1r\plotchoice.south),&#xA;      \p3 = (my plots c1r\plotchoice.center)&#xA;    in %&#xA;    (\x1,\y2) -- (\x1,\y3) ;&#xA;  }&#xA;}&#xA;\fi&#xA;&#xA;\end{tikzpicture}&#xA;&#xA;\end{document}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8427" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2021-11-07T14:41:30.770" Title="Proper meaning (and origin) of PCM (pulse code modulation)?" Tags="|terminology|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15358" PostTypeId="1" AcceptedAnswerId="18104" CreationDate="2014-04-01T10:21:55.720" Score="7" ViewCount="25242" Body="&lt;p&gt;I search to display a time-frequency signal with an original discrete temporal signal (sampling step = 0.001sec). I use Python and the library &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/signal.html&quot; rel=&quot;noreferrer&quot;&gt;Scipy.signal&lt;/a&gt;. I use the function &lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.signal.cwt.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;cwt(data, wavelet, widths)&lt;/code&gt;&lt;/a&gt; to do a &lt;a href=&quot;http://users.rowan.edu/~polikar/WAVELETS/WTpart3.html&quot; rel=&quot;noreferrer&quot;&gt;continuous wavelet transform&lt;/a&gt;, with the &lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.signal.morlet.html&quot; rel=&quot;noreferrer&quot;&gt;complex morlet wavelet&lt;/a&gt; (or gabor wavelet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First step: Obtain a scale-translation signal. &#xA;In doubt, I associate directly the array “widths” with the array of the possible different scales. Because, I don’t understand what is parameter width if it’s not scale. Perhaps, you will tell me “it’s the width of your current wavelet”! But, even if it is, I don’t know how linked width with scale…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second problem is to find and display the equivalent with frequency. In literature, I find this formula: Fa = Fc / (s*delta), where Fa is the final frequency, Fc the center frequency of a wavelet in Hz, s the scale and delta the sampling period. So, ok for scale (if I find the link with the width) and delta (=0.001sec), but it’s more complicated with center frequency of the wavelet. In scipy documentation, I find that:&#xA;“The fundamental frequency of this wavelet [morlet wavelet] in Hz is given by f = 2*s*w*r / M, where r is the sampling rate [s is here Scaling factor, windowed from -s*2*pi to +s*2*pi. Default is 1; w the width; and M the length of the wavelet].”&#xA;I think it’s the center frequency, is it? Maybe the solution to my first problem is here also (scaling factor and scale..?)..?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="8402" LastEditorUserId="29" LastEditDate="2014-04-03T13:57:33.077" LastActivityDate="2023-01-14T06:58:18.650" Title="Continuous Wavelet Transform with Scipy.signal: what is parameter &quot;widths&quot; in cwt() function? How do time-frequency?" Tags="|wavelet|python|transform|time-frequency|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15359" PostTypeId="1" AcceptedAnswerId="15363" CreationDate="2014-04-01T10:49:49.390" Score="2" ViewCount="1044" Body="&lt;p&gt;I have been studying about boundary discontinuity in DFT and why it is not used as transform in image compression. What i understand is that DFT is N periodic and that causes a discontinuity at the boundary. This means that more number of terms are needed to represent the function and the rate of convergence is slow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody explain as to what does it mean when they say that &quot;more number of terms are needed to represent the function?&quot; . And how does it help to use DCT which is 2N periodic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference article is at : &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_cosine_transform&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Discrete_cosine_transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8435" LastActivityDate="2014-04-01T15:57:16.973" Title="What does boundary discontinuity in DFT imply?" Tags="|fourier-transform|transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15360" PostTypeId="2" ParentId="15359" CreationDate="2014-04-01T11:47:01.240" Score="4" Body="&lt;p&gt;Because the left (top) edge of an image is unlikely to be a reflection of its right (bottom) edge, there are discontinuities all along the edges of an image when it is viewed as N-periodic. These discontinuities are represented in the frequency domain by high-frequency coefficients. From an image compression point of view, using the 2-D DFT as a transform would require to store these high frequency coefficients (or non-zero terms in the decomposition of the image as a sum of elementary components), which do not describe anything meaningful in the image itself, but are a nasty side-effect of an inappropriate choice of transform.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-01T13:27:39.973" LastActivityDate="2014-04-01T13:27:39.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15363" PostTypeId="2" ParentId="15359" CreationDate="2014-04-01T15:34:38.620" Score="3" Body="&lt;p&gt;The lower frequency basis vectors of a finite size DFT have nearly equal values at the 2 edge points, thus are poor at encoding &quot;smooth&quot; data where the first and last element can be quite different, such as arbitrary image block edges, into a small number of basis vectors.  (e.g. It takes a massive pile of vectors that are all nearly the same at the boundary points to represent any big difference between these two points, as well as properly transform encoding the rest of the data.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other transforms (DCT, etc.) include at least some smooth basis vector that can easily represent a huge difference between the first and last point in the window, thus possibly requiring a smaller number of basis vectors for a close approximation to an invertible transform of reasonably smooth data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-01T15:57:16.973" LastActivityDate="2014-04-01T15:57:16.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15364" PostTypeId="2" ParentId="15357" CreationDate="2014-04-01T16:50:27.727" Score="1" Body="&lt;p&gt;PAM is a good visual representation of PCM and can be thought of as a first step in creating a PCM data stream.  Pulse Code Modulation is commonly used in telephone transmission systems. The most common format is an 8 bit representation of 16 bit linear fixed point audio data (voice) that is band limited to roughly 300 to 3600 Hz.  The sampling rate is 8Khz.  The 8 bit representation of 16 bit is achieved using a logorithmic compression scheme (u-law in the US, a-law elsewhere).  After the data is compressed, it is serialized for transmission.  Note that PCM doesn't have to be compressed or 8 bits.  16 bit linear PCM is also a common format, but not in telephone transmission systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The format for u-law or alaw encoded PCM is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Serial bit stream, each byte is a compressed audio dample:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       byte N         byte N+1         byte N+2&#xA;...|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|...&#xA;                    s e e e m m m m&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;8000 samples/second X 8 bits/sample = 64Kbps bit rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;s = sign bit &#xA;e = exponent &#xA;m = mantissa &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for telephone quality audio, you first bandlimit your audio signal and then sample it using a 16bit analog to digital converter.  Next compress each sample using u-law or a-law log encoding. Finally, serialize the data into a bit stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In telephone transmisions systems, this would represent a baseband signal.  The PCM streams are up converted to higher bit rates and time multiplexed with other audio channels.  A T1 telephone trunk contains 24 time multiplesed PCM audio channels, while E1 contains 32.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2014-04-01T16:59:35.697" LastActivityDate="2014-04-01T16:59:35.697" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15365" PostTypeId="2" ParentId="15345" CreationDate="2014-04-01T17:46:22.370" Score="1" Body="&lt;p&gt;The FT of the convolutional inverse is the point-wise inverse in the FD. So the convolutional inverse of a gaussian might have numerical problems. The FT of a gaussian is a gaussian. Its point-wise inverse thus can be large in many places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a box function, the situation doesn't look all that good either. Its FT is a variant on $\operatorname{sinc}$, which has many zeroes and loci of low magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can certainly determine the convolutional inverse of a gaussian, but the inverse of a box function is not even a function. Convolving with a box will cancel any function that is periodic with a period multiple of the edge length.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-04-01T17:46:22.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15366" PostTypeId="2" ParentId="15284" CreationDate="2014-04-01T17:58:54.000" Score="5" Body="&lt;p&gt;Here's the way I think about a discrete &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow&quot;&gt;Wiener Filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a sequence of observations $\mathbf{y} \in \Re^n $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Form a matrix from the input $\mathbf{x} \in \Re^{n+r-1}$ by shifting columns one sample each:&#xA;$$&#xA;X= \begin{bmatrix}&#xA;x_1 &amp;amp; x_2 &amp;amp; ... &amp;amp; x_r \\ &#xA;x_2 &amp;amp; x_3 &amp;amp; &amp;amp; x_{r+1} \\ &#xA;x_3 &amp;amp; x_4 &amp;amp; &amp;amp; x_{r+2} \\&#xA;... &amp;amp; &amp;amp; &amp;amp; ...\\&#xA;x_n &amp;amp; x_{n+1} &amp;amp; ... &amp;amp; x_{r+n-1}\\&#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the act of &lt;em&gt;correlating&lt;/em&gt; the signal $\mathbf{x}$ with a filter $\mathbf{h}$ can be represented as $\mathbf{y} = \mathbf{X h}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $\mathbf{X^Ty}=\mathbf{X^TX~h}$ and the least squares solution for $\mathbf{h}=(\mathbf{X^TX})^{-1}\mathbf{X^Ty}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an octave/Matlab example that might help illustrate&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r = 31; % filter length&#xA;n = 1e4;% signal length&#xA;SNR = 0;% AWGN measurement SNR in dB&#xA;x = randn(n,1); % random signal&#xA;h0 = randn(r,1); % unknown filter&#xA;y0 = filter(h0,1,x); % convolve x0,h0&#xA;y0 = circshift( y0, -(r-1)/2 ); % align x,y0&#xA;y = y0 + randn(size(y0)) * norm(y0)/sqrt(n) * 10^(-SNR/20); % add noise&#xA;&#xA;% Wiener-Hopf solution&#xA;XX = xcorr(x,x,r-1);&#xA;Xy = xcorr(x,y,(r-1)/2 );&#xA;hrev = toeplitz(XX(r:end))  \ Xy; % least squares solution&#xA;h1 = conj(flipud(hrev));  % change from a correlating filter to a convolution filter&#xA;&#xA;nmse_recovery = 20*log10( norm(h1-h0) / norm(h0));&#xA;plot([h0 h1]);&#xA;legend('truth','recovered')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2014-04-03T02:45:31.187" LastActivityDate="2014-04-03T02:45:31.187" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15371" PostTypeId="1" CreationDate="2014-04-01T20:26:17.463" Score="0" ViewCount="173" Body="&lt;p&gt;I perform some tests where I run cepstrum pitch detection algorithm over polyphonic sound. Result shows that there is almost always occurrence of lowest frequency of tones played simultaneously.&#xA;I think this is because the lowest frequency has the longest period. But I do not know if it is true or why it is so.&#xA;Can you somebody explain this or why there is lowest frequency? Or suggest some publications?&lt;/p&gt;&#xA;" OwnerUserId="5857" LastActivityDate="2016-07-20T17:53:54.810" Title="Lowest frequency within pitch detection in polyponic sound" Tags="|frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15372" PostTypeId="2" ParentId="15371" CreationDate="2014-04-01T20:58:49.810" Score="-1" Body="&lt;p&gt;The lowest pitch in a chord is likely to have a large number of its possible overtone frequencies match the actual overtones of other notes in a harmonious chord, leading to a good cepstral magnitude, which looks for spectral periodicity (overtone series's).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However a cepstrum might also find more overtone sequence periodicities at pitches lower than the lowest pitch in a chord.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-07-20T17:53:54.810" LastActivityDate="2016-07-20T17:53:54.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15374" PostTypeId="1" AcceptedAnswerId="15380" CreationDate="2014-04-01T22:49:07.820" Score="9" ViewCount="2181" Body="&lt;p&gt;I have a bunch of audio files that have both speech and music parts (think radio). For instance, a given file might consist of the following sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;music --- speech --- music --- speech --- music --- speech --- music&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My goal is to detect when the file changes between music and speech, and cut away the music parts leaving only the speech. However, I don't know what method to use to distinguish between speech and music. I was considering detecting the tempo, but some of the music is very slow or has a varying tempo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(While we're at it, so that I don't have to write my own, are there any existing software libraries out there that can distinguish between speech and music?)&lt;/p&gt;&#xA;" OwnerUserId="4416" LastActivityDate="2014-04-02T09:16:07.673" Title="Detecting changes between voice and music" Tags="|audio|algorithms|speech|voice|music|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15375" PostTypeId="1" CreationDate="2014-04-01T23:30:53.643" Score="1" ViewCount="460" Body="&lt;p&gt;Basically I want to perform an FFT to find the frequencies of the sound, then stretch the frequencies (for example a stretch by 2 means copy the value of the fourier coefficient X(n) to X(n/2) then use an inverse FFT. Will this work ?&lt;/p&gt;&#xA;" OwnerUserId="8439" LastActivityDate="2014-04-11T08:46:51.447" Title="What's a simple way to shift the pitch?" Tags="|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15377" PostTypeId="2" ParentId="15375" CreationDate="2014-04-02T04:46:14.843" Score="1" Body="&lt;p&gt;To stretch the spectrum, you will also need to do some high quality (Sinc kernel) interpolation to fill in any bins that don't have an integer submultiple source.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-02T04:46:14.843" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15378" PostTypeId="1" AcceptedAnswerId="15381" CreationDate="2014-04-02T05:13:26.683" Score="2" ViewCount="277" Body="&lt;p&gt;Let's suppose I have a signal &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt; that is periodic, with two periodicities &lt;span class=&quot;math-container&quot;&gt;$P1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P2$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$P1&amp;gt;P2$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that I know the values of the two periodicities. Using the Fast Fourier transform I can show the two values as peaks in a power spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's suppose the second periodicity &lt;span class=&quot;math-container&quot;&gt;$P2$&lt;/span&gt; (the faster one), has exactly the same value as the first harmonic of the fundamental value, or &lt;span class=&quot;math-container&quot;&gt;$P2=2×P1$&lt;/span&gt;. This means that I will be not able to distinguish it by using the power spectrum, at least not by looking at the frequency of the peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: is there a way to separate the contributions in such a case? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, is it possible to predict the power of the first harmonic, so that the difference between the predicted power and the observed power of the harmonic peak gives a result significant enough (i.e., greater than &lt;span class=&quot;math-container&quot;&gt;$3\sigma$&lt;/span&gt;) to say that the first harmonic also &quot;contains&quot; the contribution from a periodicity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, be plain I am not experienced in this (nonetheless some equations/numbers are ok).&lt;/p&gt;&#xA;" OwnerUserId="8442" LastEditorUserId="47251" LastEditDate="2020-02-03T22:58:07.780" LastActivityDate="2020-02-04T11:11:15.020" Title="Fourier transform with periodicity at the harmonic frequency" Tags="|fourier-transform|periodic|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15379" PostTypeId="1" CreationDate="2014-04-02T05:44:49.073" Score="1" ViewCount="676" Body="&lt;p&gt;How are Radix-8 and Radix-2^3 FFT are related?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are they same?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got some more details in IEEE paper by&#xA;S.He and M. Torkelson, &quot;Designing pipeline FFT processor for OFDM (de)modulation,&quot; in &lt;em&gt;Proc. Int. Symp. Signals, Syst.,&lt;/em&gt; 1998, pp. 257-262.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT Radix 2^3 has complexity of radix 8 but has a structure as that of radix-2.&lt;/p&gt;&#xA;" OwnerUserId="7885" LastEditorUserId="80" LastEditDate="2014-04-03T15:13:10.130" LastActivityDate="2014-04-03T15:13:10.130" Title="How Radix-8 and Radix-2^3 are related" Tags="|fft|digital|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15380" PostTypeId="2" ParentId="15374" CreationDate="2014-04-02T07:03:42.567" Score="14" Body="&lt;p&gt;This is a well-studied problem, dating back from the mid 90s (DARPA/NIST broadcast transcription challenges). Search for &quot;speech/music segmentation&quot; or &quot;audio segmentation&quot; and you'll find thousands of research papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two broad approaches to solve this problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Supervised classification&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Train a speech/music classifier, using a standard machine learning approach. You can use MFCCs as input features, along with other basic feature like zero-crossing rate, amplitude modulation at 4Hz, etc. Recently it became common to throw in as many features as possible, and using feature detection techniques to identify the most discriminant ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any classification algorithm will do - support vector machines, gaussian mixture models, decision trees. Once the classification is done, you'll have misclassified frames (for example a tiny acapella segment in a song will be classified as speech; or a FX or jingle between speech will stand-out). This requires post-processing, the most common approach is to apply mode filtering (voting) on the sequence of classifier outputs. The classification/temporal smoothing are sometimes rolled into one through the use of hidden markov models for both classification and temporal smoothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ref: &lt;em&gt;Content-based audio classiﬁcation and segmentation by using support vector machines&lt;/em&gt;, Lu et al.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Unsupervised segment change detection&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a 10s window sliding over the signal. Compute audio features on the first half, on the second half, and use a statistical test to decide which hypothesis is the most likely: the two sets of audio features are drawn from the same distribution, or are drawn from two different distributions. The output of the test will tell you how likely it is that the middle of the window corresponds to the boundary between a speech and a music segment. Select the points with the highest scores as the segment boundaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same audio features as for the supervised approach (MFCC, ZCR, amplitude modulation at 4 Hz...) can be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Textbook&quot; criterion for the statistical test: bayesian information criterion (BIC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ref: &lt;em&gt;Unsupervised Audio Stream Segmentation And Clustering Via The Bayesian Information Criterion&lt;/em&gt;, Zhou &amp;amp; Hansen (for an introduction to BIC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Combined Supervised and Unsupervised approaches for automatic segmentation of radiophonic audio streams&lt;/em&gt;, Richard, Ramona &amp;amp; Essid (for more exotic change detection tests).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-02T09:16:07.673" LastActivityDate="2014-04-02T09:16:07.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15381" PostTypeId="2" ParentId="15378" CreationDate="2014-04-02T07:29:16.087" Score="3" Body="&lt;p&gt;If you have two periodic functions $f(t)$ and $g(t)$, where $f(t)$ has fundamental frequency $f_0$ and $g(t)$ has fundamental frequency $2f_0$, then their sum $h(t)=f(t)+g(t)$ is periodic with fundamental frequency $f_0$. Without any further knowledge about $f(t)$ or $g(t)$ there is no way to separate the two, because if the only knowledge you have about $f(t)$ is that it is periodic with fundamental frequency $f_0$, then there is no way to distinguish it from the sum function $h(t)$, which has the same periodicity.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-02T07:29:16.087" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15382" PostTypeId="2" ParentId="15379" CreationDate="2014-04-02T08:50:29.917" Score="4" Body="&lt;p&gt;Radix-2^3 is a special class of radix-2 algorithms where the basic decomposition is based on radix-8 and the 8-point DFTs are later on decomposed into radix-2, leading to an algorithm based on radix-2 butterflies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Same&quot; depends on what you mean and how you classify algorithms. In some sense, a valid way to implement a radix-8 butterfly is to decompose it into radix-2 butterflies. Still, using classic definitions, the size of the fundamental butterfly operation that is realized determines the radix, leading to that radix-8 and radix-2^3 are &quot;different&quot;.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-04-02T08:50:29.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15383" PostTypeId="2" ParentId="69" CreationDate="2014-04-02T10:00:52.057" Score="7" Body="&lt;p&gt;The main importance of the Fourier transform lies with system analysis.  The main constituent of our universe is vacuum, and vacuum is a fundamentally linear and time-invariant carrier of fields: different fields superimpose by adding their respective vectors, and regardless of when you repeat the application of certain fields, the outcome will be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a consequence, a lot of systems also involving physical matter are to a good approximation behaving as linear, time-invariant systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such LTI systems can be described by their &quot;impulse response&quot;, and the response to any time-distributed signal is described by convolving the signal with the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is a commutative and associative operation, but it is also quite computationally and conceptually expensive.  However, the convolution of functions is mapped by Fourier transform into piecewise multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that the properties of linear time invariant systems and their combinations are much better described and manipulated after Fourier transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, things like &quot;frequency response&quot; are quite characteristic for describing the behavior of a lot of systems and become useful for characterizing them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fast Fourier transforms are in the &quot;almost, but not quite, entirely unlike Fourier transforms&quot; class as their results are not really sensibly interpretable as Fourier transforms though firmly routed in their theory.  They correspond to Fourier transforms completely only when talking about a sampled signal with the periodicity of the transform interval.  In particular the &quot;periodicity&quot; criterion is almost always not met.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several techniques for working around that, like the use of overlapping windowing functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the FFT &lt;em&gt;can&lt;/em&gt; be employed for doing discrete-time convolution when doing things right, and is it is an efficient algorithm, that makes it useful for a lot of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can employ the basic FFT algorithm also for number theoretic transforms (which work in discrete number fields rather than complex &quot;reals&quot;) in order to do fast convolution, like when multiplying humongous numbers or polynomials.  In this case, the &quot;frequency domain&quot; is indistinguishable from white noise for basically any input and has no useful interpretation before you do the inverse transform again.&lt;/p&gt;&#xA;" OwnerUserId="8447" LastActivityDate="2014-04-02T10:00:52.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15384" PostTypeId="1" AcceptedAnswerId="15385" CreationDate="2014-04-02T12:18:36.437" Score="1" ViewCount="1276" Body="&lt;p&gt;What is the relation between the AM modulation index and the SNR? (I plotted this and it came as the shape of the exponential graph)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also what is the relation between the channel noise power and the SNR? &#xA;I plotted this and  I got the shape as this graph:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yzKA1.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yzKA1.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(ignore the labels of the axis)&lt;/p&gt;&#xA;" OwnerUserId="8392" LastEditorUserId="1629" LastEditDate="2017-12-12T00:02:06.520" LastActivityDate="2017-12-12T00:02:06.520" Title="SNR relation with modulation index and noise power" Tags="|matlab|digital-communications|modulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15385" PostTypeId="2" ParentId="15384" CreationDate="2014-04-02T13:54:09.420" Score="1" Body="&lt;p&gt;If $x(t)$ is your message signal, then you can write the AM signal as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=A[1+mx(t)]\cos\omega_0 t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A&amp;gt;0$ is a real-valued constant, $m$ is the modulation index, and $\omega_0$ is the carrier frequency (in radians). If you assume that the noise added by the channel is white with power spectral density $N_0$, then the SNR after demodulation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$SNR=\frac{A^2m^2\overline{x^2(t)}}{4N_0B_x}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $B_x$ is the bandwidth of the message $x(t)$ and $\overline{x^2(t)}$ is its average power.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-02T13:54:09.420" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15387" PostTypeId="1" CreationDate="2014-04-02T15:38:21.680" Score="0" ViewCount="1298" Body="&lt;p&gt;Is there a name for a filter that is using a moving average on the frequency domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am searching for such a filter to filter out long &quot;pads&quot; (synths) from music.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do any of you know about such software?&lt;/p&gt;&#xA;" OwnerUserId="8449" LastActivityDate="2014-04-02T15:38:21.680" Title="Moving average on the frequency domain - (Welch's Method?)" Tags="|fft|audio|moving-average|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15394" PostTypeId="1" AcceptedAnswerId="15444" CreationDate="2014-04-02T18:59:34.193" Score="1" ViewCount="1674" Body="&lt;p&gt;I have a problem with Otsu's method. I would like to implement histogram to compute how many ones' and zeros'. For Otsu's method, I have a code from a book and it is running without problem. This is the picture &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MxJqh.jpg&quot; alt=&quot;here&quot;&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented a code to compute the histogram. This is the output of my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;------------------&#xA;    0 : 14332&#xA;    1 : 2102&#xA;    2 : 1387&#xA;    3 : 745&#xA;    4 : 221&#xA;    5 : 117&#xA;    6 : 27&#xA;    7 : 9&#xA;  248 : 6&#xA;  249 : 12&#xA;  250 : 48&#xA;  251 : 162&#xA;  252 : 396&#xA;  253 : 830&#xA;  254 : 1377&#xA;  255 : 28554&#xA;------------------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('images.jpg');&#xA;level = graythresh(I);&#xA;BW = im2bw(I, level);&#xA;imshow(BW)&#xA;imwrite(BW, 'img.jpg');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my C++ code. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;opencv2\core\core.hpp&amp;gt;&#xA;#include &amp;lt;opencv2\highgui\highgui.hpp&amp;gt;&#xA;#include &amp;lt;opencv\cv.h&amp;gt;&#xA;#include &amp;lt;map&amp;gt;&#xA;#include &amp;lt;iomanip&amp;gt;&#xA;&#xA;std::map&amp;lt;int, int&amp;gt; computeHistogram(const cv::Mat&amp;amp; image)&#xA;{&#xA;    std::map&amp;lt;int, int&amp;gt; histogram;&#xA;&#xA;    for ( int row = 0; row &amp;lt; image.rows; ++row)&#xA;    {&#xA;        for ( int col = 0; col &amp;lt; image.cols; ++col)&#xA;        {&#xA;          ++histogram[(int)image.at&amp;lt;uchar&amp;gt;(row, col)];&#xA;&#xA;        }&#xA;    }&#xA;&#xA;    return histogram;&#xA;}&#xA;&#xA;void printHistogram(const std::map&amp;lt;int, int&amp;gt;&amp;amp; histogram)&#xA;{&#xA;    std::map&amp;lt;int, int&amp;gt;::const_iterator histogram_iter;&#xA;    std::cout &amp;lt;&amp;lt; &quot;\n------------------\n&quot;;&#xA;    for( histogram_iter = histogram.begin(); histogram_iter != histogram.end(); ++histogram_iter)&#xA;    {&#xA;      std::cout &amp;lt;&amp;lt; std::setw(5) &amp;lt;&amp;lt; histogram_iter-&amp;gt;first &amp;lt;&amp;lt;  &quot; : &quot; &amp;lt;&amp;lt; histogram_iter-&amp;gt;second &amp;lt;&amp;lt; &quot;\n&quot;;&#xA;    }&#xA;    std::cout &amp;lt;&amp;lt; &quot;------------------\n&quot;;&#xA;}&#xA;&#xA;int main(int argc, char **argv)&#xA;{&#xA;    cv::Mat img = cv::imread(&quot;img.jpg&quot;, CV_BGR2GRAY);&#xA;    printHistogram(computeHistogram(img));&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why this is the result? What I'm expecting is how many 255 and 0 (black and white only). Moreover, if I run another picture, I get another results with the range 0-255.&lt;/p&gt;&#xA;" OwnerUserId="5788" LastEditorUserId="4618" LastEditDate="2014-04-05T06:22:07.723" LastActivityDate="2014-04-05T07:33:54.127" Title="Otsu's method problem?" Tags="|image-processing|image-segmentation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15395" PostTypeId="2" ParentId="15394" CreationDate="2014-04-02T19:02:58.953" Score="0" Body="&lt;p&gt;There's obviously more than just 0 and 255 valued pixels. I'd suggest implementing a thresholding preprocessor. This way you can convert anything close to white to completely white, and anything close to black to completely black. Not sure what language you're using but here's an example of what I mean. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (i = 0; i &amp;lt; columnsSize, i++){&#xA;    for (j = 0; j &amp;lt; rowsSize, j++){&#xA;       if (image(i, j) &amp;lt; 100)   image(i,j) = 0;&#xA;       else  image(i,j) = 255;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Better yet, thresholding + counter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int black = 0;&#xA;int white = 0;&#xA;    for (i = 0; i &amp;lt; columnsSize, i++){&#xA;        for (j = 0; j &amp;lt; rowsSize, j++){&#xA;           if (image(i, j) &amp;lt; 100)   {image(i,j) = 0; black++}&#xA;           else  {image(i,j) = 255; white++}&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4618" LastEditorUserId="4618" LastEditDate="2014-04-02T19:08:47.730" LastActivityDate="2014-04-02T19:08:47.730" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15396" PostTypeId="1" CreationDate="2014-04-02T20:26:32.020" Score="1" ViewCount="74" Body="&lt;p&gt;I am using openCV to find a particular object, and am trying to find a way to make it locate the object consistently. The object's location will be determined by taking 30 frames and trying to find the best guess based on where it is found in each of the 30 frames. Both the camera and object are (mostly) stationary (the object can move slightly, but optimally it will be stationary during the 30 frames).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image demonstrates what I'm looking for. I know that the green box may not truly be what would be calculated, I just threw it in there to demonstrate. The red boxes are the guesses on each frame, and the green one is what I'm trying to calculate. Are there any known formulas/algorithms for this, or any references on where to start?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AGXo3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initially tried to just calculate the mode along the X-axis (ignoring width) (with each estimate rounded so that there would be some similarity), and picking a random rectangle whose x value was in that range for X but that was not giving me a very good estimate.&lt;/p&gt;&#xA;" OwnerUserId="8457" LastEditorUserId="8457" LastEditDate="2014-04-02T20:32:42.850" LastActivityDate="2014-04-02T21:52:28.593" Title="Best Guess Rectangle" Tags="|computer-vision|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15397" PostTypeId="2" ParentId="15396" CreationDate="2014-04-02T20:55:30.967" Score="2" Body="&lt;p&gt;I must admit I haven't worked on anything like this before, but looking at your data it seems to me that computing the &lt;a href=&quot;http://en.wikipedia.org/wiki/Median#The_sample_median&quot; rel=&quot;nofollow noreferrer&quot;&gt;median&lt;/a&gt; of e.g. the lower left corner point of all rectangles (i.e. taking x and y dimensions into account) should get rid of outliers. After having removed outliers from your data, you could simply try to average the remaining rectangles. Obviously, such an approach requires some heuristic tweaking, but it may be worth a try.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I just tried Matt's approach (just taking the 1D medians of the top/left/bottom/right X and Y values) and the results seem pretty good. See plot below of 20 realizations of various random rectangles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mknpr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;scilab&lt;/code&gt; CODE ONLY BELOW&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function r = getRect(t,l,b,r)&#xA;    large =  [1 1 0 0]*rand(1,1,'normal')*abs(t-b) + [0 0 1 1]*rand(1,1,'normal')*abs(l-r);&#xA;    small =  [1 1 0 0]*rand(1,1,'normal')*5 + [0 0 1 1]*rand(1,1,'normal')*5;&#xA;&#xA;    noise = small;&#xA;    if (rand(1,1,'uniform') &amp;lt; 0.2) then&#xA;        noise = large;&#xA;    end&#xA;    r = [t l b r] + noise;&#xA;endfunction&#xA;&#xA;&#xA;for p = 1:20;&#xA;&#xA;N = 20;&#xA;&#xA;x_points = [2 2 4 4 2];&#xA;y_points = [1 3 3 1 1];&#xA;&#xA;subplot(5,4,p)&#xA;RR= [];&#xA;for n=1:N&#xA;    R = getRect(10,10,100,50);&#xA;    RR = [RR; R];&#xA;    plot(R(x_points),R(y_points),'r');&#xA;end&#xA;&#xA;RRm = median(RR,'r');&#xA;&#xA;xset(&quot;thickness&quot;,4)&#xA;plot(RRm(x_points),RRm(y_points),'g');&#xA;xset(&quot;thickness&quot;,1)&#xA;end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="80" LastEditDate="2014-04-02T21:52:28.593" LastActivityDate="2014-04-02T21:52:28.593" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15399" PostTypeId="2" ParentId="14780" CreationDate="2014-04-02T21:21:18.963" Score="1" Body="&lt;p&gt;Why not to use following matrix form, while given vertices pairs $(x_i, y_i) $:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A = \dfrac{1}{6} \det \begin{bmatrix} x_1 &amp;amp; y_1 &amp;amp; 1 \\ x_2 &amp;amp; y_2 &amp;amp; 1\\x_3 &amp;amp; y_3 &amp;amp; 1 \end{bmatrix}  = \dfrac{1}{2}( x_3y_1 + x_1y_2+x_2y_3-x_3y_2-x_1y_3-x_2y_1)$&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-21T07:14:11.723" LastActivityDate="2014-05-21T07:14:11.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15400" PostTypeId="1" AcceptedAnswerId="15403" CreationDate="2014-04-02T22:43:03.557" Score="2" ViewCount="846" Body="&lt;p&gt;I am investigating autocorrelation of electrical noise as part of an undergraduate experiment (as detailed in &lt;a href=&quot;http://physlab.lums.edu.pk/images/a/ab/Correlation.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://physlab.lums.edu.pk/images/a/ab/Correlation.pdf&lt;/a&gt;). I sampled noise voltages using an 8-bit AtoD from a noise generator (whose description was not provided). I first sampled the noise directly, then I sampled it after passing it through a low-pass filter. I imported the data into MATLAB and used the &lt;code&gt;autocorr&lt;/code&gt; function to autocorrelate it. The no-filter data autocorrelated as expected, being just 1 at t=0 (as in Fig 1 in paper); however, the filtered data decays initially as expected but then dips below 0 before coming back up and staying around 0 as in the image below. &lt;img src=&quot;https://i.stack.imgur.com/igIUk.jpg&quot; alt=&quot;Negative autocorrelation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My three issues are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I am not really sure what this means physically (is the correlation 'direction' changed so-to-speak?),&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why might this be occurring? I know that a description of the noise generator may be important here but I do not have that information myself.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there any way to correct this issue, and if not, what would be the best compromise?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are snapshots of the noise without and with the filter (RC=0.5ms) respectively:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kEGrs.png&quot; alt=&quot;Noise before without filter&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4vU9q.png&quot; alt=&quot;Noise going through RC=0.5ms low-pass filter&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8458" LastEditorUserId="8458" LastEditDate="2014-04-02T22:59:36.270" LastActivityDate="2014-04-03T03:51:04.233" Title="Autocorrelation of noise - negative correlation" Tags="|noise|autocorrelation|statistics|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15401" PostTypeId="1" AcceptedAnswerId="15499" CreationDate="2014-04-03T00:10:42.550" Score="2" ViewCount="2539" Body="&lt;p&gt;I am developing a software for fundamental frequency tracking. For this purpose, I have designed a function which calculates autocorrelation over the signal and a second function which, based on autocorrelation result, finds the peak corresponding to the fundamental frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the code I have written is not very reliable. What I want to know is: &lt;strong&gt;which algorithms are reliable for fundamental frequency peak search?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My autocorrelation plot looks as follows so far, when done in MATLAB:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iCWuX.png&quot; alt=&quot;full recording ACF plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however, I implemented it in C, because my software is in C, as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 91     for(;i &amp;lt; *length;i++) {&#xA; 92         for(j = i;j &amp;lt; *length + i;j++) {&#xA; 93             if(j &amp;gt; i) {&#xA; 94                 sum += 0;&#xA; 95             } else {&#xA; 96                 sum += samples[i] * samples[j];&#xA; 97             }&#xA; 98         }&#xA; 99 &#xA;100         result[i] = sum;&#xA;101         sum = 0.0f;&#xA;102     }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with &lt;code&gt;i&lt;/code&gt; starting in &lt;code&gt;0&lt;/code&gt;. I also believe this code to be OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approximating the above plot in MATLAB, I see this, where the marked peak would be my fundamental frequency one (the note I'm testing with is an E2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tlusA.png&quot; alt=&quot;window ACF plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as we can see from this plot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wj5mx.png&quot; alt=&quot;second peak marked&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the signal I'm dealing with is quasiperiodic and the difference between those peaks actually result in the fundamental frequency for E2 note: the distance between the two is 389 - 193 == 196 (values obtained from drag &amp;amp; drop of MATLAB plot), which, divided by my sampling rate of 16 kHz, results in 0.01225, that would be my wave period. Inverting this value I obtain 81.6326530612 Hz, which is very near to my expected 82.41 Hz for E2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I'm having a real bad time trying to locate these two peaks in code, since I'm not sure what to compare to be sure the peaks I found are actually these two peaks.&lt;/p&gt;&#xA;" OwnerUserId="8354" LastEditorUserId="8354" LastEditDate="2014-04-04T00:05:30.620" LastActivityDate="2014-04-09T01:01:36.937" Title="Algorithms for finding fundamental frequency based on ACF result" Tags="|frequency|algorithms|autocorrelation|pitch|peak-detection|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15402" PostTypeId="1" CreationDate="2014-04-03T03:44:52.160" Score="3" ViewCount="522" Body="&lt;p&gt;As a follow on &lt;a href=&quot;https://dsp.stackexchange.com/questions/15284/estimate-the-transfer-function-of-an-unknown-system&quot;&gt;Estimate the Transfer Function of an Unknown System&lt;/a&gt; which os estimating a transfer function of an unknown system using a &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiener&lt;/a&gt; filter,&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How would you put a minimum &lt;a href=&quot;http://en.wikipedia.org/wiki/Mean_squared_error&quot; rel=&quot;nofollow noreferrer&quot;&gt;MSE&lt;/a&gt; criteria on how well the estimated filter weights matched the actual transfer function of the system? [Suppose you needed the MSE to be no more than -50dB]?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How would you change his &lt;a href=&quot;https://dsp.stackexchange.com/a/15366/5843&quot;&gt;formulation&lt;/a&gt; if you wanted poles as well as zeroes (an IIR rather than an FIR filter)?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="7092" LastEditDate="2021-11-21T18:15:43.830" LastActivityDate="2021-11-21T18:15:43.830" Title="Using a Wiener Filter to Estimate a Transfer Function" Tags="|estimation|transfer-function|correlation|linear-algebra|adaptive-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15403" PostTypeId="2" ParentId="15400" CreationDate="2014-04-03T03:51:04.233" Score="2" Body="&lt;p&gt;If the impulse response of the low pass filter goes negative, that means that the filter is adding an inverted or negative image of the input signal to the output at that delay.  Which the autocorrelation is finding it as it is, negative.  The impulse response goes negative as one way of canceling out some of the input spectrum in the filter's stopband.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-03T03:51:04.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15405" PostTypeId="2" ParentId="15402" CreationDate="2014-04-03T07:33:34.850" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;The desired MSE is application dependent, so there can be no general&#xA;rule. If the approximation doesn't satisfy your needs you can&#xA;increase the filter length to obtain a better match.&lt;/li&gt;&#xA;&lt;li&gt;There is no straightforward way to change the FIR Wiener filter solution to an IIR solution because the IIR formulation results in a set of nonlinear equations which have no closed-form solution. The IIR solution might also be unstable, so FIR filters are a much more practical choice when computing a Wiener filter.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-03T07:33:34.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15407" PostTypeId="2" ParentId="15358" CreationDate="2014-04-03T09:45:52.390" Score="0" Body="&lt;p&gt;I tried to study directly the &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.morlet.html#scipy.signal.morlet&quot; rel=&quot;nofollow&quot;&gt;morlet wavelet function&lt;/a&gt; in testing different values for width and scale parameters. The results are that it's not (for me) intuituve :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;width corresponds to the numbers of peaks of the wavelet&lt;/li&gt;&#xA;&lt;li&gt;scale varies the &quot;width&quot; of the wavelet form (worth: more s increases, more this width decreases... It's in opposition to &lt;a href=&quot;http://users.rowan.edu/~polikar/WAVELETS/WTpart3.html&quot; rel=&quot;nofollow&quot;&gt;this method&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In fact, this method says: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Scaling, as a mathematical operation, either dilates or compresses a signal. Larger scales correspond to dilated (or stretched out) signals and small scales correspond to compressed signals.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I will search another methods to try to see where is the problem. Unless someone knows already the response. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In fact, the problem seems to come from the number of cycles of the wavelets: more the frequency increases, more the number of cycles must follow. And the number of cycles is really linked with parameter &quot;w&quot; in morlet wavelet. It is really important if you do a study over a large band of frequency.&#xA;Hope that it will help others.&lt;/p&gt;&#xA;" OwnerUserId="8402" LastEditorUserId="8202" LastEditDate="2016-10-30T10:29:30.497" LastActivityDate="2016-10-30T10:29:30.497" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15408" PostTypeId="1" CreationDate="2014-04-03T11:32:23.210" Score="0" ViewCount="967" Body="&lt;p&gt;Folks I've written a small utility that extracts some (and only some) header information from Tifs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To test it fully I need some Big Endian Tifs, but I cant find any, and I can't find anything to generate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a public repository for tifs with big endian encoding? Or of something that can generate some?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, apologies if this is off topic.&lt;/p&gt;&#xA;" OwnerUserId="8466" LastActivityDate="2014-04-04T16:56:54.767" Title="Need samples of big endian encoded tifs" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ClosedDate="2014-04-14T19:47:18.013" ContentLicense="CC BY-SA 3.0" />
  <row Id="15410" PostTypeId="1" CreationDate="2014-04-03T13:42:45.123" Score="2" ViewCount="240" Body="&lt;p&gt;I am very new to DSP so please excuse any brevity...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to design a 4x4 CMOS camera array and stitch the images together for further processing... I have tried doing that with opencv but the frame rate count drops drastically... So i want to do the Stitching part using some Image Processor Kit which can take multiple CMOS camera input and stitch them and give me a single image as output and the fps should be 60fps ideally atleast 48 fps... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I have a very basic level knowledge of DSP so I would need some suggetions regarding which Image Processor or Kit I should use to make a quick prototype... Also what kind of input does the Processor need from the camera(ttl, usb, etc)... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8469" LastActivityDate="2014-04-03T13:42:45.123" Title="Realtime image-stitching using a CMOS camera array" Tags="|image-processing|dsp-core|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15412" PostTypeId="1" AcceptedAnswerId="15414" CreationDate="2014-04-03T19:22:45.393" Score="1" ViewCount="5287" Body="&lt;p&gt;I am learning about FIR filters and I'm confused.&#xA;I am trying to find out different types of FIR filters.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is direct form and n-tap FIR filter the same?&lt;/li&gt;&#xA;&lt;li&gt;What does transposed FIR filter do?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8472" LastEditorUserId="13320" LastEditDate="2019-02-10T15:53:21.883" LastActivityDate="2019-02-10T15:53:21.883" Title="FIR filters: direct form / transposed FIR" Tags="|filters|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15414" PostTypeId="2" ParentId="15412" CreationDate="2014-04-03T20:44:01.437" Score="4" Body="&lt;p&gt;A finite impulse response (FIR) digital filter implements the following convolution sum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\sum_{n=0}^{N-1}h(k)x(n-k)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for each output sample $y(n)$, where $x(n)$ is the discrete-time input signal, $h(n)$ is the filter's impulse response, and $N$ is the filter length. The values $h(n)$ are also called &lt;em&gt;filter taps&lt;/em&gt;, and $N$ is then referred to as the number of taps. The filter described by Equation (1) is also called an $N$-tap filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Direct-form and transposed direct-form are just different implementations, i.e. different ways to compute the sum in (1). In theory they are identical, but when computed with finite precision, there can be differences between the different implementations. The direct-form FIR structure is also called &lt;em&gt;tapped delay line&lt;/em&gt; or &lt;em&gt;transversal filter&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two realizations below are the direct-form structure (transversal filter, tapped delay-line) and the transposed structure (from Oppenheim and Schafer, &lt;em&gt;Discrete-time Signal Processing&lt;/em&gt;):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rr3dr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-04T05:26:11.450" LastActivityDate="2014-04-04T05:26:11.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15415" PostTypeId="2" ParentId="15408" CreationDate="2014-04-03T23:38:20.967" Score="0" Body="&lt;p&gt;Every TIFF begins with a two-byte flag indicating its endianness. If you can get your hands on a database of TIFF files, you can write a simple script to read the first two bytes and filter out the ones that match your desired endianness. I doubt that such a specialized database would exist somewhere on the web.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-04-03T23:38:20.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15416" PostTypeId="1" AcceptedAnswerId="15417" CreationDate="2014-04-04T01:22:28.577" Score="2" ViewCount="544" Body="&lt;p&gt;Most of the resources I found online go the other way. If I have the transfer function&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H(z) = 1 - \cos(\theta) \, z^{-1} + z^{-2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do I get the difference equation from it, so that I can apply the transfer function to a set of data?&lt;/p&gt;&#xA;" OwnerUserId="8474" LastEditorUserId="7092" LastEditDate="2023-11-23T13:39:19.833" LastActivityDate="2023-11-23T13:39:19.833" Title="How do I find the difference equation from a transfer function?" Tags="|discrete-signals|z-transform|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15417" PostTypeId="2" ParentId="15416" CreationDate="2014-04-04T02:53:37.687" Score="3" Body="&lt;p&gt;A transfer function $H(Z)$ can be written as $H(Z)=\frac{Y(Z)}{X(Z)}$. Then, your $H(Z)$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{Y(Z)}{X(Z)}=1-\cos\theta~Z^{-1}+Z^{-2}$ or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(Z)=X(Z)(1-\cos\theta~ Z^{-1}+Z^{-2})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now taking the inverse $Z$transform, we get the difference equation as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n)=x(n)-\cos\theta~x(n-1)+x(n-2)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this help you.&lt;/p&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2014-04-04T02:53:37.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15418" PostTypeId="2" ParentId="15190" CreationDate="2014-04-04T03:52:02.607" Score="0" Body="&lt;p&gt;The condition number (CN) of a matrix (in &lt;span class=&quot;math-container&quot;&gt;$L_2$&lt;/span&gt; norm) is the square root of of the ratio of the largest eigenvalue to the smallest eigenvalue. We see here that CN is related to the extreme (largest and smallest) eigenvalues. It looks like we can vary the CN by varying the eigenvalues.&lt;/p&gt;&#xA;&lt;p&gt;Convolution matrix is a Toeplitz matrix. There are some special Toeplitz matrices such as tri-diagonal and penta-diagonal matrices whose eigenvalues in terms of matrix entries are well-known [1-2]. In these case, by varying the matrix entries we can vary the eigenvalues and in turn the CN.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[1] S. Noschese, L. Pasquini, and L. Reichel,  &amp;quot;Tridiagonal Toeplitz&#xA;matrices: properties and novel applications,&amp;quot;  Numer. Linear Algebra&#xA;Appl., 20 (2013), pp. 302-326&lt;/p&gt;&#xA;&lt;p&gt;[online: &lt;a href=&quot;http://www.math.kent.edu/%7Ereichel/publications/toep3.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.math.kent.edu/~reichel/publications/toep3.pdf&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;p&gt;[2] G. D. Smith, Numerical Solution of Partial Diﬀerential Equations,&#xA;2nd ed., Clarendon Press, Oxford, 1978.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8475" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-01-14T18:32:09.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15419" PostTypeId="2" ParentId="15122" CreationDate="2014-04-04T06:32:26.407" Score="1" Body="&lt;p&gt;If you know the frequency of the sine signal  already, you can correlate your [.......p-set...] [SINE-WAVE] [....q-set...] signal with the sine signal. The correlation will give you a peak where sine wave exactly matches with the signal. Since you know the sine signal length you can figure out the beginning of the sine signal in your original signal. I hope this helps you a bit.&lt;/p&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2014-04-04T06:32:26.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15420" PostTypeId="1" AcceptedAnswerId="15421" CreationDate="2014-04-04T06:49:19.913" Score="0" ViewCount="43" Body="&lt;p&gt;Consider the following scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say, one machine is sending out a beep signal every 10 seconds in a very noisy environment. I have two sensors which detects these beeps independently. Device A is near to machine compared to B, so B always have a two samples delay compared to A. Since it is noisy environment, devices sometimes detects noise also as beeps and sometimes even misses the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the data&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = [5,10,20,25,30,40,45,50]&#xA;B = [12,18,22,32,38,42,52]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See, A and B have beeps at 10 &amp;amp; 12 which says beep @5 in A is a noise. Similarly @25 in A because 30 in A and 32 in B says they are the good data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly in B, 18 is a noise because there is a synchronized peak at @20 in A and @22 in B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a plot of that (red mark shows noisy beeps):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N5EmB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any mathematical/signal processing method which I can use to find the location of correct beeps based on the synchronized information available from two datas and get rid of the noisy ones?&lt;/p&gt;&#xA;" OwnerUserId="818" LastActivityDate="2014-06-03T08:38:12.903" Title="Finding correct values based on information from two arrays" Tags="|noise|correlation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15421" PostTypeId="2" ParentId="15420" CreationDate="2014-04-04T07:16:16.313" Score="2" Body="&lt;p&gt;This is a fairly easy task. The reason is that your signals are monotonically increasing and encode the same additively evolving time information. &#xA;First of all, I suggest you subtract 2 from B. Then what you do is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Start at position 0 on A and position 0 on B and maintain 2 separate indices (say $i$ and $j$) for traversing A and B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Compare current values of $A$ and $B$: $A_i$ and $B_j$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) The moment where $A_i &amp;gt; B_j$ increase $i$ : $i=i+1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) The moment where $B_j &amp;lt; A_i$ increase $j$ : $j=j+1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) The moment where $B_j = A_i$ you have a beep. Increase both indices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) Goto step 2 and repeat until you reach the end.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-04-04T07:16:16.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15423" PostTypeId="1" CreationDate="2014-04-04T07:52:48.387" Score="3" ViewCount="256" Body="&lt;p&gt;Say I have 5 minutes of input and output audio. One method I know is to do FFT on windows from input and output. Then divide FFT output into bins and find average energy in various bands for all the windows. After this, take ratio of energy bands from output windows with corresponding energy bands from input windows. And then take average of all these ratios. This will give an approximation to FFT(Y)/FFT(X) i.e. transfer function of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other methods to find transfer function given input and output time series?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastActivityDate="2014-05-04T08:38:21.917" Title="Given input and output time series, obtaining filter design" Tags="|filters|audio|filter-design|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15424" PostTypeId="2" ParentId="14606" CreationDate="2014-04-04T08:04:55.147" Score="3" Body="&lt;p&gt;Let's proceed step-by-step:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I need some more explanation on what is gradient? How we calculate gradient? please explain me in a lucid manner I have zero knowledge about gradient.please explain me with easy explanation&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;a gradient relate to a measure of the derivate, that is, the coefficient of variation. If you think of a measure of position, the derivate is the speed. Now, we do not have a single point, but a field of pixel with values. Now think of it as a landscape, the luminance as the height and the gradient as the slope. It has both a magnitude (how steep it is) and a direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the formulation that you cite, the slope is computed thanks to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Divergence&quot; rel=&quot;nofollow&quot;&gt;divergence operator&lt;/a&gt;. In this case it equals to the sum of slope in the directions of the reference frame (that is, in x and y). It is used to allow a more general formulation in non-euclidean spaces.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This gradient magnitude equation is what I am unable to understand please see the following equation and explain me in detail. I don't Know why they use divergence and gradient &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;the basic idea behind this equation is to control diffusion by the contours:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;diffusion helps to smooth out data by averaging locally. one drawback is that if you do it too long, you lose all information.&lt;/li&gt;&#xA;&lt;li&gt;contours is the abstract concept of a boundary. Think of it for instance as the contour of a object in an image or the transient in the square wave that you show. To detect the position of these contours, you may use the gradient, and specifically the amplitude of the gradient (how steep the slope is)&lt;/li&gt;&#xA;&lt;li&gt;now comes the heuristic of anisotropic diffusion: if you diffuse, but that you control the speed of this diffusion by the borders, then, you obtain a better result.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These equations just lay down these concepts quantitatively.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastEditorUserId="1085" LastEditDate="2014-04-06T19:48:02.837" LastActivityDate="2014-04-06T19:48:02.837" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15425" PostTypeId="2" ParentId="15423" CreationDate="2014-04-04T08:07:26.130" Score="1" Body="&lt;p&gt;If your system is linear, then you can find the impulse response $h(n)$ of the system using the convolution sum $y(n)=\sum_{k=0}^{N} h(k)x(n-k)$, which can be written in matrix-vector form as $y=Xh$, where $X$ is a convolution matrix of the input data and $N$ is the order of the system, say $N=10$ for example. Since you know $X$ and $y$, you can find $h$ via the Pseudo inverse, assuming you have created an over-determined system $y=Ah$. The pseudo-inverse is $h=(X^T X)^{-1}X^T y$. After finding $h$, find the FFT of $h$ or take the Laplace transform of $h$ to get the transfer function. I hope this helps you.&lt;/p&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2014-04-04T08:07:26.130" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15426" PostTypeId="1" AcceptedAnswerId="15437" CreationDate="2014-04-04T08:18:16.343" Score="3" ViewCount="577" Body="&lt;p&gt;Suppose that I am receiving RF signals contaminated with noise through antenna.&#xA;This signal is digitally sampled.&#xA;How can I understand the type of noise(Gaussian,Uniform etc).&#xA;Any algorithm is there to test the type of noise.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastActivityDate="2014-04-04T21:14:37.447" Title="How to understand the type of noise" Tags="|noise|estimation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15427" PostTypeId="1" CreationDate="2014-04-04T08:30:16.917" Score="2" ViewCount="379" Body="&lt;p&gt;I have the following problem:&#xA;Let $x$, $y$ be finite real valued sequences defined on $0, \ldots, N-1$ and let $g$ be a non negative integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z_n=\sum_{k=0}^n x_{n-k}y_k, \quad \text{also on $0, \ldots, N-1$.}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the sum is from $0$ to $n$, not $N-1$. In addition, the DFT of $y$ is known in closed form.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a way to write $z$ as some cyclic convolution, so that with the help of the convolution theorem $z$ can be calculated in $N \log N$ instead of $N^2$?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I tried following the convolution theorem proof but I get stuck:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;z_n&amp;amp;=\sum_{k=0}^nx_{n-k}y_k= \sum_{k=0}^{N-1}x_{n-k}\cdot \theta (n-k)\cdot y_k\\&#xA;\Rightarrow \tilde{z_q}&amp;amp;=\sum_{n=0}^{N-1}\sum_{k=0}^{N-1} x_{n-k}\cdot \theta (n-k)\cdot y_k e^{-2\pi iqn/N}\\&#xA;&amp;amp;=\sum_{n=0}^{N-1}\sum_{k=0}^{N-1} x_{n-k}\cdot \theta (n-k)e^{-2\pi iq(n-k)/N}\cdot y_k e^{-2\pi iqk/N}\\&#xA;&amp;amp;=\sum_{k=0}^{N-1} y_k e^{-2\pi iqk/N} \sum_{n=0}^{N-1} x_{n-k}\cdot \theta (n-k)e^{-2\pi iq(n-k)/N}\\&#xA;&amp;amp;=\sum_{k=0}^{N-1} y_k e^{-2\pi iqk/N} \sum_{n'=-k}^{N-1-k} x_{n'}\cdot \theta (n')e^{-2\pi iqn'/N}\\&#xA;&amp;amp;=\sum_{k=0}^{N-1} y_k e^{-2\pi iqk/N} \sum_{n'=0}^{N-1-k} x_{n'}e^{-2\pi iqn'/N}=?????\\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the second sum depends on $k$ so the double sum doesn't factor to the product of DFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="8476" LastEditorUserId="1629" LastEditDate="2016-05-16T10:39:10.350" LastActivityDate="2017-08-17T20:44:53.943" Title="DFT for something similar to convolution" Tags="|dft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15429" PostTypeId="2" ParentId="15426" CreationDate="2014-04-04T10:24:17.717" Score="-1" Body="&lt;p&gt;The way I'm familiar with is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Send the RF Image multiple times. Say 100 times.&#xA;2- Compare by &quot;subtraction&quot; in case of an Image for example .. between the received image/ and transmitted one.&#xA;3- The subtraction will give you the noisy image.&#xA;4- Plot a histogram statistics for the noisy image, for every received image. You'll then be able to roughly model the noise based on the experimental results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most familiar ones are, Guassian, or even Uniform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if it's not of these familiar ones. Run a regression code to represent this model as an equation. By that means you can take the inverse of it to compensate for the noise.&lt;/p&gt;&#xA;" OwnerUserId="8348" LastEditorUserId="8348" LastEditDate="2014-04-04T21:14:37.447" LastActivityDate="2014-04-04T21:14:37.447" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15431" PostTypeId="1" CreationDate="2014-04-04T13:12:02.313" Score="2" ViewCount="1655" Body="&lt;p&gt;I'm having some trouble implementing a Kalman filter in MATLAB. I have an Android phone connected sending data from accelerometer for 10 seconds. After i have the data I take out the x-axis vector. What I want after that is to get better readings using the Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output I am looking for is both the acceleration and the velocity of the phone. When I run the code I get almost no change in acceleration (is between -0.5 and 0.5 m/s^2) and way to much change in velocity (increasing to very high numbers). The tests I have been running are when the phone is laying still on a table. So the correct values in acceleration and velocity should be 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem is that since i'm only measuring acceleration my state vector will be the same vector as the measurement vector with the only difference that i also have velocity in the state vector. Both the control input is the acceleration and the measurement is the acceleration.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when I update my state vector the difference that is going to be multiplied with the Kalman gain is always zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my question is: Should the measurement noise / the process noise be added to the measured acceleration &quot;z&quot; or should the noise be added to the state prediction vector?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8479" LastActivityDate="2014-06-03T15:41:16.207" Title="Problem with Kalman filtering accelerometer data" Tags="|matlab|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15432" PostTypeId="2" ParentId="15427" CreationDate="2014-04-04T13:36:16.650" Score="1" Body="&lt;p&gt;You might be looking for the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#Circular_convolution_theorem_and_cross-correlation_theorem&quot; rel=&quot;nofollow&quot;&gt;convolution property&lt;/a&gt; of the DFT. If $z[n] = x[n] * y[n]$, where $*$ represents circular convolution, then $Z[k] = X[k] Y[k]$, where $Z[k]$ is the DFT of $z[n]$ and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This property is used in fast convolution techniques like &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap_save&quot; rel=&quot;nofollow&quot;&gt;overlap-save&lt;/a&gt; to implement convolution in $O(N \log N)$ time instead of the $O(n^2)$ time required by direct implementation of the convolution sum.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-04-04T13:36:16.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15433" PostTypeId="2" ParentId="15431" CreationDate="2014-04-04T14:36:56.760" Score="2" Body="&lt;p&gt;If there is any offset in the acceleration measurement, then a Kalman filter won't help without the addition of some velocity and/or position reference measurements.  Double integration of random-walk noise in the acceleration measurement will eventually lead to a reported position of your device outside the solar system.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-04T14:53:12.360" LastActivityDate="2014-04-04T14:53:12.360" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15434" PostTypeId="2" ParentId="15408" CreationDate="2014-04-04T16:56:54.767" Score="2" Body="&lt;p&gt;The current ImageMagick can make them.  Given a little-endian TIFF,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;convert le.tiff -endian msb -define tiff:endian=msb be.tiff&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;em&gt;vice versa&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;convert be.tiff -endian lsb -define tiff:endian=lsb le.tiff&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Run&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;identify -verbose be.tiff | grep ndian&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to see what happened.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastActivityDate="2014-04-04T16:56:54.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15436" PostTypeId="1" CreationDate="2014-04-04T18:17:56.430" Score="3" ViewCount="3142" Body="&lt;p&gt;I'm trying to get a handle on the importance of the error feedback term in noise shaping operation in typical audio dither algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking in terms of four signals.  The original signal, the output (quantised) signal, the dither signal, and the error signal (the difference between output and original).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple approach would be to generate white noise and apply a filter to it to generate a coloured dither signal, add this to the original signal, quantise to the output signal, and disregard the error signal.  It appears to be a fairly common approach to use white (unfiltered) or violet (differentiated) noise functions in this configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach I see implemented is to take the error signal and filter that and add white noise to define the dither signal, then add it to the original, quantise, and calculate the next error term for the filter.  This implies a tight loop for the data flow -- we cannot compute a new error term without resolving the previous one -- making it hard to use SIMD efficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From those I can infer a third option -- forgo the noise altogether and simply filter and reintegrate the error signal directly.  I suppose this comes with some risk of modulation artefacts related to but distinct from the artefacts introduced by quantisation without any dither or shaping at all; however, I suspect this might be how it's done in some high-frequency 1-bit cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point I'm unclear on is that complex filters which attempt to model the threshold of human hearing appear to come under the title of 'noise shaping', and this implies (supported by implementations I have seen) use of the error feedback term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it a flawed or misguided approach to forgo the error feedback but still use the complex filter on white noise for the dither function?  Is the error signal genuinely offering something important here?&lt;/p&gt;&#xA;" OwnerUserId="5180" LastActivityDate="2014-04-06T19:52:22.993" Title="Audio signal dither and noise shaping" Tags="|audio|noise|quantization|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15437" PostTypeId="2" ParentId="15426" CreationDate="2014-04-04T18:58:56.343" Score="2" Body="&lt;p&gt;There are several different ways to look at noise:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The probability density function (PDF) of a noise process, $x(t)$ say. It is sometimes written $p_x(x)$.  This tells you how frequently the the variable $x(t)$ takes on specific values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to think of a PDF is as a (normalized) histogram of the possible values that $x(t)$ can take.  The PDF is normalized because $x(t)$ must take on &lt;em&gt;some&lt;/em&gt; value between $-\infty$ and $+\infty$, so the integral&#xA;$$&#xA;\int_{-\infty}^{+\infty} p_x(x) dx = 1.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the figure below shows the PDF (in blue) and the histogram (in black) for a normal (a.k.a. Gaussian) random variable and for a uniform random variable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jT6pr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Another way to look at noise is whether there is a relationship between the value of $x(t_1)$ and the value $x(t_2)$ (where $t_1 \not= t_2$). If there is no relationship, then the noise is said to be &quot;white&quot;.  If there &lt;strong&gt;is&lt;/strong&gt; a relationship, the noise is said to be &quot;colored&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way this is usually illustrated is using autocorrelation (autocovariance) of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are two plots of the autocorrelation of normally distributed noise.  In the first plot, the noise is white.  In the second plot, there is a high level of correlation between subsequent samples.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jad4G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;scilab&lt;/code&gt; CODE BELOE&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 15426&#xA;&#xA;X_gauss = rand(1,1000,'normal');&#xA;&#xA;X_uniform = rand(1,1000,'uniform');&#xA;&#xA;&#xA;figure(1)&#xA;clf&#xA;subplot(211)&#xA;histplot(100,X_gauss)&#xA;vals = [-3:0.1:3];&#xA;plot(vals,exp(-vals.^2/2)/sqrt(2*%pi))&#xA;subplot(212)&#xA;histplot(100,X_uniform)&#xA;plot([0 1], [1 1])&#xA;&#xA;figure(2)&#xA;&#xA;X_white = X_gauss;&#xA;X_colored = filter(ones(1,50),10,X_white);&#xA;&#xA;figure(2)&#xA;clf&#xA;subplot(211)&#xA;plot(xcorr(X_white))&#xA;mtlb_axis([970 1030 -1000 1000])&#xA;subplot(212)&#xA;plot(xcorr(X_colored))&#xA;mtlb_axis([970 1030 -1000 1000])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-04-04T18:58:56.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15438" PostTypeId="1" AcceptedAnswerId="15450" CreationDate="2014-04-04T20:10:49.333" Score="2" ViewCount="1725" Body="&lt;p&gt;I am new to DSP, and currently trying to implement a simple polyphase decimation program in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;M is decimation factor, x is input (for now it is a square wave 8096 samples), y_polyDec is result from polyphase, output is result from regular filter then decimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FilterBank_LPF = fir1(127, 1/M);&#xA;y_polyDec = zeros(8096/M, 1);&#xA;&#xA;for i = 1:M&#xA;&#xA;    p(:, i) = FilterBank_LPF(i:M:end);&#xA;    x(:, i) = input(M-i+1:M:end);&#xA;    y_polyDec = filter(p(:, i), 1, x(:, i))+ y_polyDec;&#xA;&#xA;end&#xA;&#xA;out_LPF = filter(FilterBank_LPF, 1, input);&#xA;output = downsample(out_LPF, M);&#xA;&#xA;%===========================================&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I compare &quot;output&quot; and &quot;y_polyDec&quot; (either comparing the decimated sample values or frequency spectrum using fvtool) I notice there are differences in the values. I was wondering if my code is wrong, or am I still missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="8481" LastEditorUserId="4298" LastEditDate="2014-04-05T14:14:21.797" LastActivityDate="2014-04-05T18:05:57.987" Title="Polyphase decimation matlab" Tags="|matlab|decimation|" AnswerCount="1" CommentCount="0" ClosedDate="2014-05-06T17:19:05.173" ContentLicense="CC BY-SA 3.0" />
  <row Id="15441" PostTypeId="1" AcceptedAnswerId="15445" CreationDate="2014-04-05T02:40:35.760" Score="0" ViewCount="2378" Body="&lt;p&gt;I would like to compute how many zeros and ones (e.i. 255) in a binary image. The following code to generate a binary image by using Matlab. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('images.jpg');&#xA;level = graythresh(I);&#xA;BW = im2bw(I, level);&#xA;imshow(BW)&#xA;imwrite(BW, 'img.jpg');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my C++ code. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;opencv2\core\core.hpp&amp;gt;&#xA;#include &amp;lt;opencv2\highgui\highgui.hpp&amp;gt;&#xA;#include &amp;lt;opencv\cv.h&amp;gt;&#xA;#include &amp;lt;map&amp;gt;&#xA;#include &amp;lt;iomanip&amp;gt;&#xA;&#xA;std::map&amp;lt;int, int&amp;gt; computeHistogram(const cv::Mat&amp;amp; image)&#xA;{&#xA;    std::map&amp;lt;int, int&amp;gt; histogram;&#xA;&#xA;    for ( int row = 0; row &amp;lt; image.rows; ++row)&#xA;    {&#xA;        for ( int col = 0; col &amp;lt; image.cols; ++col)&#xA;        {&#xA;          ++histogram[(int)image.at&amp;lt;uchar&amp;gt;(row, col)];&#xA;&#xA;        }&#xA;    }&#xA;&#xA;    return histogram;&#xA;}&#xA;&#xA;void printHistogram(const std::map&amp;lt;int, int&amp;gt;&amp;amp; histogram)&#xA;{&#xA;    std::map&amp;lt;int, int&amp;gt;::const_iterator histogram_iter;&#xA;    std::cout &amp;lt;&amp;lt; &quot;\n------------------\n&quot;;&#xA;    for( histogram_iter = histogram.begin(); histogram_iter != histogram.end(); ++histogram_iter)&#xA;    {&#xA;      std::cout &amp;lt;&amp;lt; std::setw(5) &amp;lt;&amp;lt; histogram_iter-&amp;gt;first &amp;lt;&amp;lt;  &quot; : &quot; &amp;lt;&amp;lt; histogram_iter-&amp;gt;second &amp;lt;&amp;lt; &quot;\n&quot;;&#xA;    }&#xA;    std::cout &amp;lt;&amp;lt; &quot;------------------\n&quot;;&#xA;}&#xA;&#xA;int main(int argc, char **argv)&#xA;{&#xA;    cv::Mat img = cv::imread(&quot;img.jpg&quot;, CV_BGR2GRAY);&#xA;    printHistogram(computeHistogram(img));&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I got&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;------------------&#xA;    0 : 11451&#xA;    1 : 590&#xA;    2 : 602&#xA;    3 : 498&#xA;    4 : 428&#xA;    5 : 376&#xA;    6 : 387&#xA;    7 : 349&#xA;    8 : 314&#xA;    9 : 278&#xA;   10 : 229&#xA;   11 : 206&#xA;   12 : 212&#xA;   13 : 159&#xA;   14 : 142&#xA;   15 : 112&#xA;   16 : 106&#xA;   17 : 96&#xA;   18 : 86&#xA;   19 : 54&#xA;   20 : 44&#xA;   21 : 37&#xA;   22 : 26&#xA;   23 : 26&#xA;   24 : 14&#xA;   25 : 14&#xA;   26 : 10&#xA;   27 : 4&#xA;   28 : 7&#xA;   29 : 8&#xA;   30 : 2&#xA;   32 : 7&#xA;   33 : 2&#xA;   34 : 3&#xA;   36 : 2&#xA;   37 : 4&#xA;   38 : 1&#xA;  211 : 1&#xA;  216 : 1&#xA;  217 : 1&#xA;  219 : 4&#xA;  220 : 2&#xA;  221 : 2&#xA;  223 : 3&#xA;  224 : 5&#xA;  225 : 2&#xA;  226 : 4&#xA;  227 : 4&#xA;  228 : 5&#xA;  229 : 8&#xA;  230 : 15&#xA;  231 : 19&#xA;  232 : 22&#xA;  233 : 25&#xA;  234 : 36&#xA;  235 : 21&#xA;  236 : 54&#xA;  237 : 54&#xA;  238 : 64&#xA;  239 : 93&#xA;  240 : 113&#xA;  241 : 111&#xA;  242 : 127&#xA;  243 : 163&#xA;  244 : 193&#xA;  245 : 182&#xA;  246 : 202&#xA;  247 : 218&#xA;  248 : 263&#xA;  249 : 289&#xA;  250 : 291&#xA;  251 : 301&#xA;  252 : 403&#xA;  253 : 458&#xA;  254 : 469&#xA;  255 : 29211&#xA;------------------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this right? What I'm expecting is the number of 0s and 255s. &lt;/p&gt;&#xA;" OwnerUserId="5788" LastActivityDate="2014-04-05T15:22:30.443" Title="Histogram and binary image in opencv?" Tags="|image-processing|opencv|histogram|" AnswerCount="1" CommentCount="3" ClosedDate="2014-04-14T19:48:28.593" ContentLicense="CC BY-SA 3.0" />
  <row Id="15442" PostTypeId="2" ParentId="15436" CreationDate="2014-04-05T03:30:13.303" Score="1" Body="&lt;p&gt;To get a feel for how to answer my own question I made a -90dB test tone ramp, and applied different processes to it, and plotted the spectrogram with SoX.  The z axis is shifted up from the default to make things clearer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the conventional approach (the second one described in my question) of filtering the error and adding this to the signal (shaping) before adding dither and quantising to calculate the new error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DJZdt.png&quot; alt=&quot;Lipshitz-shaped error&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to see what happens when we try to avoid reference to the error term, we apply the Lipshitz filter to white noise and use that as the dither before quantisation and discard the error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i13a4.png&quot; alt=&quot;Lipshitz-shaped white noise dither&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's obvious here is that while the noise floor can be raised in the same place as it's raised in the noise-shaping approach, it seems to hit a limit below which it cannot be lowered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is as one might expect, as it's subject to quantisation noise and the only thing special about the signal we're filtering is that it starts out white so that the quantisation noise isn't correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to complete the picture, we try removing the dither pattern and applying noise shaping in isolation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HOOSP.png&quot; alt=&quot;Lipshitz-shaped, no dither&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oops!  Obviously not a good idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in answer of my own question, if you are going to dither and not noise-shape, there is limited value in using a complex transfer function for the dither pattern, because the quantisation noise floor still exists with dither and the regions that might come out especially clear with shaping are not accessible with plain dither.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, there must still be some merit in shaping the dither function, because I can at least reduce the noise in the low frequency region by using violet noise rather than white, and I don't know how far beyond that the theoretical limits of unshaped dither extend.  So this answer is incomplete.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Correction&lt;/em&gt;: Originally I messed up a coefficient in the middle image (shaped white noise).  I've updated the image, and things work better than before, but the same basic conclusion can still be drawn.&lt;/p&gt;&#xA;" OwnerUserId="5180" LastEditorUserId="5180" LastEditDate="2014-04-05T18:20:05.033" LastActivityDate="2014-04-05T18:20:05.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15444" PostTypeId="2" ParentId="15394" CreationDate="2014-04-05T07:33:54.127" Score="4" Body="&lt;p&gt;jpg is a compressed storage format and no matter how binary your image is, you will almost always end up with gray values in the resulting image (due to compression).&#xA;Please save it as png and try again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Also note that you still have 0s and 255s as the dominant bins, because jpg generally degrades around the edges, which constitute a small portion in the image.)&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-04-05T07:33:54.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15445" PostTypeId="2" ParentId="15441" CreationDate="2014-04-05T07:38:21.763" Score="1" Body="&lt;p&gt;The answer is posted as a reply to &lt;a href=&quot;https://dsp.stackexchange.com/questions/15394/otsus-method-problem&quot;&gt;Otsu's method problem?&lt;/a&gt; . So it is now a duplicate I guess.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-04-05T09:21:51.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15450" PostTypeId="2" ParentId="15438" CreationDate="2014-04-05T18:05:57.987" Score="4" Body="&lt;p&gt;The problem is in the input signals to your polyphase filters. They should be delayed and subsampled versions of the input signal, like in the following code fragment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M=8;    % downsampling factor&#xA;L=256;  % length of input signal, integer multiple of M&#xA;x=randn(L,1);  % input signal&#xA;h = fir1(127, 1/M);&#xA;yp = zeros(L/M, 1);&#xA;&#xA;for i = 1:M,&#xA;    xtmp = [zeros(i-1,1); x];  % delayed input signal&#xA;    tmp = filter( h(i:M:end), 1, xtmp(1:M:L) );  % polyphase filtering&#xA;    yp = yp + tmp;  % accumulate outputs of polyphase filters&#xA;end&#xA;&#xA;% compare with standard filtering&#xA;y = filter ( h, 1, x);&#xA;yM = downsample( y, M );&#xA;&#xA;n=1:L/M;&#xA;plot(n,(yM-yp)/max(yM))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-05T18:05:57.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15453" PostTypeId="1" CreationDate="2014-04-05T19:46:33.893" Score="0" ViewCount="103" Body="&lt;p&gt;In Audio Experts book, it's given as&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Sound pressure meters must be calibrated at factory to a standard acoustic volume.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So what doth this &lt;code&gt;standard acoustic volume&lt;/code&gt; means?&lt;/p&gt;&#xA;" OwnerUserId="7868" LastActivityDate="2014-04-06T13:24:59.710" Title="what is standard acoustic volume" Tags="|audio|sound|acoustics|measurement|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15454" PostTypeId="2" ParentId="15453" CreationDate="2014-04-05T19:59:12.660" Score="1" Body="&lt;p&gt;Normally it is &lt;strong&gt;94 dB&lt;/strong&gt; of Sound Pressure Level, where 0 dB is 20 µPa of acoustic pressure. This is the SPL you will find in most of the acoustic calibrators for measurement microphones. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="29" LastEditDate="2014-04-06T13:24:59.710" LastActivityDate="2014-04-06T13:24:59.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15456" PostTypeId="1" AcceptedAnswerId="15459" CreationDate="2014-04-06T00:04:59.573" Score="0" ViewCount="1709" Body="&lt;p&gt;Why is MSK (minimum shift keying or FSK with a modulation index of 0.5) said to be a spectrally efficient form of FSK?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-06T12:39:26.203" Title="MSK spectral efficiency explanation" Tags="|modulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15457" PostTypeId="2" ParentId="15427" CreationDate="2014-04-06T00:25:58.583" Score="0" Body="&lt;p&gt;There is simpler way to get from your circular convolution to DFT terms.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start of with your first equation summed from $p=0$ to $N-1$.&lt;/li&gt;&#xA;&lt;li&gt;Now multiply both sides of equation by $e^{-2\pi j \cdot k n/N}$.&lt;/li&gt;&#xA;&lt;li&gt;Then sum both sides from $n =0$ to $N-1$.&lt;/li&gt;&#xA;&lt;li&gt;Use the DFT property $x(n-p) \Leftrightarrow e^{-2\pi i \cdot p&#xA;   k/N}\cdot X(k)$.&lt;/li&gt;&#xA;&lt;li&gt;Replace the $x(n-p)$ with  $x(n)*e^{-2\pi j \cdot pk/N}$.&lt;/li&gt;&#xA;&lt;li&gt;Rearrange terms to get $Z(k) = X(k)\cdot Y(k)$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8489" LastEditorUserId="8202" LastEditDate="2014-06-05T07:34:42.783" LastActivityDate="2014-06-05T07:34:42.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15458" PostTypeId="1" AcceptedAnswerId="15462" CreationDate="2014-04-06T03:45:04.483" Score="5" ViewCount="9105" Body="&lt;p&gt;I understand the process of using a Sobel kernel for edge detection in greyscale images. The input is a greyscale image, and the output is a greyscale image. I'm having trouble, however, figuring out how to apply the Sobel kernel to a color image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I find the color gradient for each color channel (R, G, and B) then average each value to get the final color gradient value? Or do I average the color channels then find the color gradient of that image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to render a raytraced image, find the edges, then re-render only the high-contrast regions with anti-aliasing and leave the low-contrast regions alone.&lt;/p&gt;&#xA;" OwnerUserId="4321" LastEditorUserId="128" LastEditDate="2020-02-20T08:42:05.193" LastActivityDate="2020-02-20T08:42:05.193" Title="Edge Detection on a Color Image" Tags="|image-processing|computer-vision|edge-detection|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15459" PostTypeId="2" ParentId="15456" CreationDate="2014-04-06T08:37:56.093" Score="1" Body="&lt;p&gt;In traditional FSK, the frequency separation between pulses is $1/T$, where $T$ is the symbol rate. This guarantees orthogonal pulses while maintaining a continuous phase. The phase is continuous because a pulse with the next higher frequency traverses exactly one more cycle than the one with the lower frequency (during one symbol interval).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can easily show that in order to guarantee orthogonality between pulses, a frequency separation of $1/2T$ is actually sufficient. This is indeed the minimum frequency separation guaranteeing orthogonality. Now a higher frequency pulse traverses only half a cycle more than the pulse with the next lower frequency. The smaller frequency separation reduces the bandwidth compared to traditional FSK, whereas the probability of error remains unchanged due to the orthogonality of the pulses. This is why MSK is often referred to as bandwidth-efficient (compared to traditional FSK).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for MSK to have a continuous phase the initial phase of a pulse must be either $0$ or $\pi$, depending on the phase of the previous pulse (because some pulses have a phase value of $\pi$ at the end of a symbol interval due to the minimum frequency separation of half a cycle per symbol interval).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This additional &quot;phase encoding&quot; inherent in MSK can actually be used in the receiver by applying the Viterbi algorithm. In this way, MSK can perform better than traditional FSK. It can overcome the 3dB loss of FSK as compared to PSK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that MSK can be viewed and implemented as a special case of offset keyed PSK (with sinusoidal pulse shapes).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-06T12:39:26.203" LastActivityDate="2014-04-06T12:39:26.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15460" PostTypeId="1" AcceptedAnswerId="15647" CreationDate="2014-04-06T09:54:34.867" Score="0" ViewCount="3560" Body="&lt;p&gt;I wanted to simulate OFDM system in MATLAB. I'm using Fixed WiMAX OFDM parameters in my simulation, where the number of data sub-carriers are 192, number of Pilot sub-carriers are 8, number Null sub-carriers are 56.&#xA;Null tones can be obtained in MATLAB by generating zero matrix with the required rows and columns. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Null subcarrier:&#xA;msg(1,1:100)=0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;similarly, for data subcarriers, digitally modulated data is sent. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Data subcarrier:&#xA;msg(2,1:100)= 1*sign(randn(1,100)) + i*sign(randn(1,100));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my question is, what type of data could I send for Pilot tones?? all books and literature I have read says that: Pilot tones are just known data. &#xA;What type of Known data are the Pilot tones? What kind of data should I send in my specific problem? Please, clarify. &lt;/p&gt;&#xA;" OwnerUserId="8416" LastEditorUserId="1606" LastEditDate="2014-04-15T09:04:21.283" LastActivityDate="2014-04-15T09:26:03.747" Title="generating pilot sub-carriers in matlab" Tags="|matlab|ofdm|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15461" PostTypeId="1" AcceptedAnswerId="15478" CreationDate="2014-04-06T10:35:24.247" Score="0" ViewCount="3865" Body="&lt;p&gt;let us consider represented of damping exponential model by prony method,there is source code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=zeros(1,N);&#xA;for i=1:N&#xA;    y(i)=x(800*i);&#xA;end&#xA;d=zeros(1,N/2);&#xA;for i=1:N/2&#xA;    d(i)=y(i+N/2);&#xA;end&#xA;D=zeros(N/2,N/2);&#xA;for i=1:N/2&#xA;    for j=N/2:-1:1&#xA;        D(i,-j+N/2+1)=y(i+j-1);&#xA;    end&#xA;end&#xA;a=pinv(D)*d';&#xA;&#xA;muhat=roots([1,-a']);&#xA;U=zeros(N,N/2);&#xA;for i=1:N&#xA;    for j=1:N/2&#xA;        U(i,j)=muhat(j,1)^(i-1);&#xA;    end&#xA;end&#xA;C=pinv(U)*y';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and equation of model is following with there solving  procedures :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kgMGO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with their  description :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/svFME.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and solving strategies :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0GrSy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find Roots of charactreristic polynomial formed from the linear prediction coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rt7gw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solve the original set of linear equations to yield the estimates of the exponential amplitude and sinusoidal phase&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gehiO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i want following thing: we have given signal and i want input  be it's length and  L,or function should have following form&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [amplitudes,damping_factor,phase,frequency]=prony(y,n,L)&#xA;&#xA;%n-length(y)&#xA;%L-number of complex exponential,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;how can i continue?how to  change given code in my case?thanks in advance&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastActivityDate="2016-10-12T11:41:54.413" Title="use prony method for damped exponentials" Tags="|matlab|frequency-spectrum|periodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15462" PostTypeId="2" ParentId="15458" CreationDate="2014-04-06T11:09:06.157" Score="5" Body="&lt;p&gt;Finding edges in a color image can be done by decomposing the image into its channels, finding the gradients separately and fusing them somehow. However, such approach doesn't incorporate the color components in a joint model. Luckily, there is a better way to do this, which is the structure tensor representation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The color structure tensor describes the bi-dimensional ﬁrst order differential structure at a certain point in the image. It is specified by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;   S=&#xA;  \left[ {\begin{array}{cc}&#xA;   R_x^2+G_x^2+B_x^2 &amp;amp; R_xR_y+G_xG_y+B_xB_y \\&#xA;   R_xR_y+G_xG_y+B_xB_y &amp;amp; R_y^2+G_y^2+B_y^2 \\&#xA;  \end{array} } \right]&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where subscripts denote the partial derivatives. This is a more precise description of the local gradients. Eigen-decomposition is then applied to the structure tensor matrix $S$ to form the eigenvalues and eigenvectors. The larger eigenvalue shows the strength of the local image edges (gradient magnitude) and the corresponding eigenvector points across the edge (in gradient direction). In other words, eigenvalues encode the gradient magnitude while the eigenvectors contain the gradient orientation information. Note that the eigenvectors and eigenvalues can be computed analytically for a structure tensor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many other usecases of the structure tensor, so it is good to know. Last but not least, here is a MATLAB code, which uses this information to compute the gradients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/28114-fast-edges-of-a-color-image-actual-color-not-converting-to-grayscale/content/coloredges.m&quot; rel=&quot;noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/28114-fast-edges-of-a-color-image-actual-color-not-converting-to-grayscale/content/coloredges.m&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After obtaining the gradients, you could further carry on your edge detection in a standard fashion (canny etc.). &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-04-06T11:09:06.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15464" PostTypeId="1" CreationDate="2014-04-06T14:37:46.663" Score="5" ViewCount="11881" Body="&lt;p&gt;What is the difference between soft thresholding and hard thresholding. Where we use soft and hard thresholding in image for denoising. I understand that in hard thresholding, the coefficients below threshold value are set to zero and the value above the threshold is set to one. Please explain me about soft threshold. &#xA;Please explain whether the threshold value is the intensity value of the image. For example if the intensity value ranges between 0 to 255. In case of hard thresholding if the threshold value is considered as 100 then the values below 100 is set to 0.The value above 100 are retained. Is this correct? Please correct me.&lt;/p&gt;&#xA;" OwnerUserId="7794" LastEditorUserId="8202" LastEditDate="2014-04-07T16:53:11.403" LastActivityDate="2014-06-06T17:55:04.810" Title="Wavelet thresholding" Tags="|wavelet|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15465" PostTypeId="2" ParentId="15458" CreationDate="2014-04-06T15:33:14.720" Score="3" Body="&lt;p&gt;Yes, you can use the sobel gradient for each individual color.&#xA;If you are comfort in doing edge detection in a different method try this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Specify clearly the color you want to obtain. Say a red color.&#xA;Pure red will be something like this [1,0,0]. If you are following RGB model/color system.&#xA;Where:&#xA;First value: Represents how red it is.&#xA;Second value: Represents how green it is.&#xA;Third value: Represents how blue it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you know the exact color you want say [0.85,0.2,0.17]. That will be fine as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Specify a range. That is up to the user to pick and mostly done by trial and error and he/she gets the exact wanted color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your color was [0.85,0.2,0.17].&#xA;Say your range for red color is [0.9 to 0.8].&#xA;Say your range for red color is [0.25 to 0.15].&#xA;Say your range for red color is [0.22 to 0.12].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- Now you can easily do a for loop to search in the region of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm of looping will be - Search for  red values that fall in the region specified, if found, search if the green pixel value falls into the specified region, and if it was found, do lastly for the blue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you do realize the places of edges, you can easily manipulate and change their colors for any different purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an easy kinda long technique for big images, but yet simple to understand.&lt;/p&gt;&#xA;" OwnerUserId="8348" LastActivityDate="2014-04-06T15:33:14.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15466" PostTypeId="1" CreationDate="2014-04-06T18:12:21.583" Score="1" ViewCount="870" Body="&lt;p&gt;I don't really know anything about signal processing. I need to find similairty between two 1-dimensional time series. I read somewhere that spectral coherence could be used to find similarity between two time series. But i am not able to get around how to use it. Can some one tell how i can use it to compute similarity between time series.&lt;/p&gt;&#xA;" OwnerUserId="8493" LastActivityDate="2016-09-21T19:57:21.840" Title="Using spectral coherence for computing similarity between time series data" Tags="|coherence|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15467" PostTypeId="2" ParentId="15436" CreationDate="2014-04-06T19:52:22.993" Score="4" Body="&lt;p&gt;i dunno what a &quot;Lipshitz filter&quot; is but i &lt;strong&gt;do&lt;/strong&gt; know who Stanley Lipshitz is.  now, i don't know for sure what Stanley would say to you, but the best advice i got from him is that it does little good to color the additive dither if you are also using error feedback.  if there is &lt;strong&gt;no&lt;/strong&gt; noise shaping feedback, probably the simplest way to get triangular PDF dither is to generate good, independent, rectangular PDF random numbers $v[n]$ and run that through a differentiator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ d[n] = v[n] - v[n-1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the result is high-pass in the spectrum and triangular PDF.  if $\Delta$ is the step size of the quantization, $\frac{\Delta^2}{12}$ is the variance (or power) of raw quantizer, but you have two more of them due to your dither and $\frac{\Delta^2}{4}$ is the total power due to the entire dithered quantizer.  a 4.77 dB increase in quantization error, but the quantization is fully decoupled from both the mean and variance of the input signal.  although this is the same quantization power that you would get from adding two independent random numbers, i think you would prefer that much of the power is steered to higher frequencies (but not all of it, the spectrum of the raw quantizer is still flat).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;if&lt;/strong&gt; you're planning on error feedback, i think the best advice is either use white, triangular PDF dither (requires adding two independently generated rectangular PDF random numbers) and error feedback (designing a good feedback filter takes a bit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or &lt;strong&gt;no&lt;/strong&gt; dither (if the quantization step size is very small) and error feedback.  the simplest no-trivial example of this is &quot;fraction saving&quot; where you simply hack off the low-order bits (the floor() function) and add those bits back in (zero-extended on the left) to the next sample before that sample is quantized (with the floor() function).  it has infinite S/N ratio at DC and totally kills any limit cycle in feedback filters (like biquads) that get the filter stuck on a DC value even when the input goes to zero.  i've done that a lot.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-04-06T19:52:22.993" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15468" PostTypeId="1" CreationDate="2014-04-06T21:07:34.117" Score="1" ViewCount="142" Body="&lt;p&gt;I have a large data set that was collected by a 5 GHz oscilloscope, so I basically have an array of voltages with each index being a very small time step apart.  I am looking for a specific signal in this data set that would only be present for a very small time frame and so most of the data will not contain this signal.  The issue is that the signal I am looking for has an amplitude less than or equal to that of the background noise.  The signal should also be a fairly wideband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question starts then with how to find this signal?  My first thoughts are there must be something I can do to take advantage of the fact that my noise and signal probably follow different distributions, but I am not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this is a fairly open-ended question so I am just looking for suggestions into general methodologies that help uncover a signal that is not consistent with background noise, but of the same or lesser amplitude.&lt;/p&gt;&#xA;" OwnerUserId="5536" LastEditorUserId="13320" LastEditDate="2016-11-21T13:08:33.550" LastActivityDate="2016-11-21T13:08:33.550" Title="Finding a signal in noisy data" Tags="|noise|detection|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15470" PostTypeId="1" CreationDate="2014-04-07T03:43:52.457" Score="0" ViewCount="45" Body="&lt;p&gt;I can not understand the following sentences, could you please anyone guide me ?&#xA;&quot;Comparing with the embedding in audio signals, the usable bandwidth is greatly reduced, &#xA;from 22.05 kHz to 4 kHz. According to Costa’s result, the corresponding capacity will be &#xA;reduced to l/5 th accordingly.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The costa formula is Cw,Costa=(1/2)*Log2(1+(var_w/var_N))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dkv56.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also compete it in MATLAB&lt;/p&gt;&#xA;&#xA;&lt;p&gt;((1/2)&lt;em&gt;(log(1+(1/4))/log(2)))  /   ((1/2)&lt;/em&gt;(log(1+(1/22.05))/log(2)))    = 5.0311&#xA;is it right ?&lt;/p&gt;&#xA;" OwnerUserId="4327" LastEditorUserId="4327" LastEditDate="2014-04-07T07:27:17.800" LastActivityDate="2014-05-07T18:08:46.203" Title="Capacity computation in Costa sheme" Tags="|digital-communications|information-theory|math|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15471" PostTypeId="1" AcceptedAnswerId="15496" CreationDate="2014-04-07T04:14:35.883" Score="4" ViewCount="1551" Body="&lt;p&gt;here is my scenario: one speaker is sending a chirp, and a microphone is recording it as well as all following echoes. The function of the chirp is already know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal: subtract the original chirp from the recorded sound, and leave only the echoes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this questions is hard for me in these ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;To match the original chirp and recorded sounds, I don't know which&#xA;approach to use: cross-correlation, or minimize &lt;em&gt;sum(abs(difference&#xA;between two vectors))&lt;/em&gt;. The difference here means element-wise difference.&lt;/li&gt;&#xA;&lt;li&gt;The echo may be mixed with the chirp itself, so I'd better only do &#xA;cross-correlation on the first small portion of the chirp.&lt;/li&gt;&#xA;&lt;li&gt;The amplitude of recorded sound depends on the microphone.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="8237" LastEditorUserId="8237" LastEditDate="2014-04-07T04:25:25.680" LastActivityDate="2015-02-21T21:03:43.637" Title="Subtracting Original Audio Signal" Tags="|audio|cross-correlation|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15472" PostTypeId="1" AcceptedAnswerId="15473" CreationDate="2014-04-07T06:45:27.730" Score="0" ViewCount="118" Body="&lt;p&gt;I wonder if the following acoustic system is i) considered to be linear time-invariant, and ii) if it is fully described by it's frequency response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A speaker produces waves at the input location of a duct system with a branch and the output is measured after the branch point. The anechoic terminations completely absorb the sound waves, and it is assumed that only 1D low frequency waves exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E9qx7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the system, when subject to the input&#xA;$$ x(t) = e^{j \omega t}, \quad t \ge 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;experiences the output&#xA;$$ y(t) = \left\{ &#xA;  \begin{array}{l l}&#xA;    0 &amp;amp; \quad 0 \le t &amp;lt; t_0 \\&#xA;    A e^{j \omega t} &amp;amp; \quad \text{$t_0 \le t&amp;lt;t_1$}\\&#xA;    A e^{j \omega t} + B e^{j \omega t}&amp;amp; \quad \text{$t \ge t_1$}&#xA;  \end{array} \right., $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where A and B are complex constants depending on the duct geometry, and $t_1$is the delay time due to the side branch geometry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes the system itself is not changing with time, however due to the finite speed of sound there is a transient period before the reflection from a side branch has occurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response at $\omega$ (a complex number capturing only magnitude and phase relationship between input and output) would be related to the final part of the piecewise defined output (steady state part) and offer no information about the time $t_1$. So, for example, a second system which had a longer side branch may have the same frequency response yet a different value of $t_1$. Therefore my argument would be that the FR is inadequate to characterise the transient behaviour of the system. Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="7694" LastEditorUserId="7694" LastEditDate="2014-04-07T14:22:17.217" LastActivityDate="2014-04-07T14:22:17.217" Title="Is the following system LTI (finite speed of signal propagation)?" Tags="|frequency-response|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15473" PostTypeId="2" ParentId="15472" CreationDate="2014-04-07T07:08:21.677" Score="2" Body="&lt;p&gt;No, if your system can (with sufficient accuracy) be modeled as a linear time-invariant system, then it is fully characterized by its impulse response. Since the frequency response is the Fourier transform of the impulse response, the system is also fully characterized by its frequency response. The frequency response does not only describe steady-state behavior but also transients (because it simply is a full description of the system). See also &lt;a href=&quot;https://dsp.stackexchange.com/questions/15163/frequency-response-equivalent-to-characterise-transient-response-to-sinusoidal/15238#15238&quot;&gt;this answer&lt;/a&gt; to a related question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-04-07T07:08:21.677" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="15474" PostTypeId="1" AcceptedAnswerId="15484" CreationDate="2014-04-07T07:53:48.050" Score="0" ViewCount="1493" Body="&lt;p&gt;I have two questions regarding signal processing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) In my analysis I generate a signal in the time domain with a frequency of 0.1 Hz. I apply the FFT and then determine the peak frequency of the signal, which should be 0.1 Hz. But I notice that when I simulate my signal for 200s, the peak frequency is always close to the 0.1Hz, but when I simulate my signal for 20s, then the peak frequency is not always 0.1Hz. Is there a certain rule of thumb for the duration of the signal to have the peak frequency occur in the frequency domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Currently I am just determining the peak frequency of my signal, as the highest peak in the frequency domain. But sometimes I have a lot of peaks near each other and at times they might overlap. What are some other recommended techniques to determine the peak frequency? I am using Matlab&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8498" LastActivityDate="2014-04-07T20:20:48.653" Title="Time duration of a signal to determine the peak frequency" Tags="|matlab|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15475" PostTypeId="2" ParentId="15470" CreationDate="2014-04-07T08:15:23.793" Score="1" Body="&lt;p&gt;You really didn't give sufficient context and background information to provide a complete answer, but I'll try anyway. You didn't say so, but I assume that $\sigma_W^2$ is the power of a watermark and that $\sigma_N^2$ is the power of additive noise. I furthermore assume that the &quot;usable bandwidth&quot; is the bandwidth for generating the watermark. If we additionally assume that the watermark signal is white with spectral density $W_0$, then its power inside the usable bandwidth $B$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma_W^2=2W_0B$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $B_1=22050Hz$ and $B_2=4000Hz$ we get for the capacity ratio&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\log_2(1+\frac{2W_0B_2}{\sigma_N^2})}{\log_2(1+\frac{2W_0B_1}{\sigma_N^2})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is not a fixed ratio, but it depends on the constants $W_0$ and $\sigma_N^2$. If they are not given, then there is no way to claim that this ratio is $1/5$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you can assume that $\sigma_W^2/\sigma_N^2\ll 1$ then the capacity can be approximated by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\log (2)}\frac{\sigma_W^2}{\sigma_N^2}=\frac{1}{2\log (2)}\frac{2W_0B}{\sigma_N^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and with the same assumptions as above the capacity ratio is equal to the ratio of bandwidths $B_2/B_1=0.18$, which is indeed close to $1/5$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If any of my assumptions are not correct, please clarify your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-07T17:18:21.223" LastActivityDate="2014-04-07T17:18:21.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15476" PostTypeId="1" AcceptedAnswerId="15488" CreationDate="2014-04-07T09:40:25.133" Score="0" ViewCount="1641" Body="&lt;p&gt;I am working to make a music player with automatic genre classification application in Java.&#xA;On Google searches I mostly found the works of George Tzanetakis who describe an algorithm from Music Genre Automatic Classification. I have big problems with obtaining the beat histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dspace.library.uvic.ca:8080/bitstream/handle/1828/1344/tsap02gtzan.pdf?sequence=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://dspace.library.uvic.ca:8080/bitstream/handle/1828/1344/tsap02gtzan.pdf?sequence=1&lt;/a&gt;  this is one of the documents that describes the algorithm and includes a flow diagram for beat analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have implemented all the functions from that flow diagram: the Full Wave Rectification, Low Pass Filtering, Downsampling, Normalization and Autocorrelation. I am pretty sure that these are correct because i found plenty of implementations and formulas in the internet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I find difficult is how to link these together to obtain the beat histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do not figure is how to make the processing of those octaves and how to sum them. I understood that octaves are same thing as in music. I implemented the DWT transform that as it is described in this document and used the wikipedia page about DWT  implementation that luckily is written in Java, just like my application.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I think my problem is  that I  did not understand properly how to get the octaves from the DWT transform. I obtain a waveform just like in : &lt;a href=&quot;http://en.wikipedia.org/wiki/File:Haar_DWT_of_the_Sound_Waveform_%22I_Love_Wavelets%22.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/File:Haar_DWT_of_the_Sound_Waveform_%22I_Love_Wavelets%22.png&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that DWT transform I have split the transform just like in the wiki page with waveform for that audio sample: second half is first octave and just like in wiki example it looks like the original signal. First half  i split again and its second half is second octave and so on.   Am I doing wrong at this stage? For about two weeks I was sure I did it correctly and now that I get a wrong signal after autocorrelation, with no peaks as it should be. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How I did to sum the octaves after processing each of them as in the diagram: I first took the largest one,  and for the second one which is half size of first octave I added to the large one every second index in the array. From the third I added the values to every 4th index in the array and so on.  I got about 6-7 octaves in total. And this is where I think I may be wrong again. Because those octaves are arrays with different sizes(each is half size of the other one) and had to split the smaller ones over the larger octave. Have I done wrong? I  very much believe that the fact that my octaves arrays have different sizes could be where I am wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please tell me where I may be wrong in what I described about how I tried to implement that algorithm. I very much think that I did not understood what octaves  and I should not have arrays with different sizes after the DWT transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the autocorrelation I should have a signal with peaks while I have something linear so I cannot make Peak Detection(last stage of the algorithm) with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more thing I would like to ask is how would I get that bpm from the signal after the autocorrelation? I have an array with size of 2048  because I started with 131072 samples and did a downsampling to have 65536 values as in the documentation(my wav files have 44100 frequency while in document they had 22050). After dwt and getting first octave I had 32768 samples for first octave and 2048 after the downsampling by 16. In the beat histograms shown in this document they have bpm values from 60 to 200. How am I obtaining those values? I understand that bpm is almost same thing as frequency but I do not know how to get frequency from this transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After summing the octaves, using the sample from the answer, I got something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/efbQ9.jpg&quot; alt=&quot;summed octaves&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are a bit different because I used DWT as filterbank. After I apply the usual autocorrelation I get something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I1rs0.jpg&quot; alt=&quot;autocorrelation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the problem is that Tzanetakis used the enhanced autocorrelation which is a bit different and is based on Tolonen and Karjalainen   algorithm.&lt;/p&gt;&#xA;" OwnerUserId="8499" LastEditorUserId="8499" LastEditDate="2014-04-23T09:57:21.637" LastActivityDate="2014-04-23T09:57:21.637" Title="Obtaining beat histogram using Tzanetakis algorithm" Tags="|audio|wavelet|octave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15478" PostTypeId="2" ParentId="15461" CreationDate="2014-04-07T11:56:09.593" Score="0" Body="&lt;p&gt;you have C and U, and C can be written as C_i = (A_i/2)*exp(j*phase)&#xA;U_i can be written as exp(damp_i + j*2*pi*f_i)*T&#xA;its should be easy to extract the info from that. T is sampling period.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%to get damping factor i and frequency i use something like this &#xA;%assume damping factor at sample 1 is 0.3, frequency at 1 is 20 &#xA;%and out sampling frequency is 500 Hz&#xA;damp1 = [0.3 0.4 0.5];&#xA;f1 = [20 30 40];&#xA;T = 1/500;&#xA;%assume this is your ui vector from th ealgorithm&#xA;ui = exp((damp1 + j*2*pi*f1)*T);&#xA;%get the damping and frequencies&#xA;lv1 = log(ui);&#xA;r_damp1 = real(lv1)/T;&#xA;r_f1 =imag(lv1)/(T*2*pi);&#xA;&#xA;%assume this is your Ci vector from algorithm&#xA;Ai = [0.1 0.2 0.3];&#xA;phasei=[pi/8 pi/4 pi/2];&#xA;Ci = (Ai/2).*exp(j*phasei);&#xA;%extract phase and amplitude&#xA;r_Amp = abs(Ci)*2;&#xA;r_phase = angle(Ci);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8489" LastActivityDate="2014-04-07T11:56:09.593" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="15479" PostTypeId="2" ParentId="15460" CreationDate="2014-04-07T11:59:24.083" Score="1" Body="&lt;p&gt;In your case, each OFDM symbol contains 256 sub-carriers. Store the pilot values for a OFDM symbol at time instant $n$ in an $8 \times 1$ array say &lt;code&gt;V&lt;/code&gt;. Also, you have the positions of the pilot carriers stored in a array say, &lt;code&gt;P&lt;/code&gt;. Let the &lt;code&gt;OF(:,n)&lt;/code&gt; represent the $256 \times 1$ OFDM symbol at time &lt;code&gt;n&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can assign the pilot values &lt;code&gt;V&lt;/code&gt; to the corresponding pilot positions &lt;code&gt;P&lt;/code&gt; in the OFDM symbol at time &lt;code&gt;n&lt;/code&gt; as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OF(P,n)=V&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in MATLAB. I hope this helps you a bit. &lt;/p&gt;&#xA;" OwnerUserId="8475" LastEditorUserId="90" LastEditDate="2014-04-07T15:56:49.143" LastActivityDate="2014-04-07T15:56:49.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15480" PostTypeId="2" ParentId="15471" CreationDate="2014-04-07T12:28:46.157" Score="2" Body="&lt;p&gt;You can't really subtract out the original sweep. You have a transfer function between speaker and microphone that's heavily dependent on frequency so the amplitude of the sweep will be different at every point in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard method would be to de-convolve the sweep (convolve with the frequency inverse of the excitation signal) and calculate the impulse response this way.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-04-07T12:28:46.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15481" PostTypeId="1" CreationDate="2014-04-07T13:44:12.470" Score="4" ViewCount="3246" Body="&lt;p&gt;Since my algorithm needs to detect long, coherent edges, the estimated local magnitude P for each pixel is normalized with respect to the magnitudes in it’s local neighborhood W (i.e., a 5x5 window).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{normalized} = \dfrac{P - \mu _w}{\sigma_w}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mu _w$ and $\sigma_w$ denote the average and the standard deviation of edge magnitudes in the pixel neighborhood $w$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is given in the paper &quot;GradientShop: A Gradient-Domain Optimization Framework for Image and Video Filtering&quot; by Bhat, and I need to implement the algorithm described there. I am not getting, what does normalizing the gradient mean exactly ?&lt;/p&gt;&#xA;" OwnerUserId="8502" LastEditorUserId="128" LastEditDate="2019-03-15T22:11:00.607" LastActivityDate="2022-02-02T08:30:24.480" Title="What Does Normalizing Gradient Means?" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15483" PostTypeId="1" CreationDate="2014-04-07T14:34:20.683" Score="0" ViewCount="689" Body="&lt;p&gt;I have below doubts, so confusing! As I don't want to assume from what I read, I am asking for help here!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Are Second Order Sections another name for biQuads ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If I have 2 single pole transfer functions, then cascading them equals multiplying the polynomial; such as below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_1 =\frac{b_{10}+b_{11}Z^{-1}}{1-a_{10} Z^{-1}}$$ and $$H_2 =\frac{b_{20}+b_{21}Z^{-1}}{1-a_{20} Z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then cascaded version is a 2nd order polynomial such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_c =\frac{b_{0}+b_{1}Z^{-1}+b_{2}Z^{-2}}{1-a_{0} Z^{-1}-a_{1} Z^{-2}}$$ where &lt;strong&gt;the poles and zeros can be obtained by taking root of this polynomial, which is not the two individual poles or zeros exist before cascading! Am I right?&lt;/strong&gt; Or taking square root will give the same poles or zeros of the individual ?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What is the mathematical steps behind the MATLAB commands &lt;code&gt;tf2zp&lt;/code&gt; and &lt;code&gt;zp2sos&lt;/code&gt;? How to do the same manually [just like we handcode calculation of the FFT using the butterfly tree diagram]?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.disca.upv.es/aperles/arm_cortex_m3/curset/CMSIS/Documentation/DSP/html/group___biquad_cascade_d_f2_t.html&quot; rel=&quot;nofollow&quot;&gt;This&lt;/a&gt; shows the &lt;code&gt;Direct form II Transposed structure&lt;/code&gt; and it's implementation equation. Now taking values of $a_0$, $a_1$, $b_0$,$b_1$,$b_2$ from $H_c$ and using them in the implementation equation &lt;strong&gt;is right&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="8202" LastEditDate="2014-04-07T14:42:58.407" LastActivityDate="2014-04-07T14:42:58.407" Title="IIR filter SOS and Direct Forms doubt" Tags="|matlab|filters|transfer-function|software-implementation|z-transform|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15484" PostTypeId="2" ParentId="15474" CreationDate="2014-04-07T15:38:02.607" Score="1" Body="&lt;p&gt;What window function are you using when you apply your FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal being analyzed is simply truncated on both ends, the window is rectangular.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets call the length of time that you generate your signal the analysis window and call the signal you create the &quot;windowed signal&quot;.  In this case I'm assuming the window to be rectangular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One interpretation of the math behind the FFT is that the signal being analyzed is periodic and the complete version of the signal is formed by taking the unaltered input from the analysis window and placing it end to end so it repeats indefinitely as illustrated below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....| Windowed Signal (-1) |  Windowed Signal (0) | Windowed Signal (+1) |...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on where you stop your signal generation, you may introduce discontinuities in the periodic signal that the FFT assumes when you do your analysis.  For example if your signal generation stops at the peak of a sine wave but starts at a 0 crossing, the signal at the point where one windowed signal segment meets the nest will abruptly go from Vpeak to 0.  This discontinuity introduces spurious frequency content in the FFT.  Also if you don't make your analysis window an integer multiple of the period of signal being analyzed, the FFT will assume the signal is periodic in a different period than the signal being analyzed (actually the period assumed by the FFT is always the window length).  this will create frequency lobes that are not harmonically related to the signal you are testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you increase the length of your window, the contribution of the discontinuity and window period diminish, so the longer duration signal will give more accurate results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to improve accuracy of the FFT frequency and/or amplitude resolution is with the use of non-rectangular window functions.  There are a bunch of window functions that are designed for this purpose.  The window function is multiplied by your time domain data (signal).  The effect of the window function is to taper off the amplitude of at the ends of your analysis window (the start and end of the signal you generate) so the edge effects are reduced in the FFT computations.  Different windows have different advantages in frequency or amplitude resolution, so there are trade offs in choosing a window function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, if you want decent resolution in your FFT, you should provide a data length that is least 2x the period of the lowest frequency to be represented and apply a window function to soften the effects of signal truncation.  Note that the longer you make your time window, the greater the frequency resolution of your FFT.  The bins are spaced at 1/T and its multiples where T is the duration of your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is plenty of information on the internet that discusses the different window functions  used in FFT analysis.  Just Google &quot;FFT window functions&quot;.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="3562" LastEditDate="2014-04-07T20:20:48.653" LastActivityDate="2014-04-07T20:20:48.653" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15486" PostTypeId="2" ParentId="14691" CreationDate="2014-04-07T16:55:34.197" Score="-1" Body="&lt;p&gt;impulseResponses = [impulseResponses(:,end/2+1:end), impulseResponses(:,1:end/2)]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is the solution,&#xA;and ya remember to use a higher number of samples for fft bins,&lt;/p&gt;&#xA;" OwnerUserId="8505" LastEditorUserId="8505" LastEditDate="2014-04-07T17:05:19.747" LastActivityDate="2014-04-07T17:05:19.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15487" PostTypeId="2" ParentId="15464" CreationDate="2014-04-07T17:01:20.200" Score="2" Body="&lt;p&gt;For a given threshold $\lambda$ (that can be dependent on resolution level), and value of wavelet coefficient $d$, &lt;strong&gt;hard thresholding&lt;/strong&gt; is defined as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$  D^H(d|\lambda)=\begin{cases}&#xA;               0,&amp;amp; \text{for } |d| \leq \lambda\\&#xA;               d,&amp;amp; \text{for } |d| &amp;gt; \lambda&#xA;            \end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whereas &lt;strong&gt;soft thresholding&lt;/strong&gt; is governed by following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$  D^S(d|\lambda)=\begin{cases}&#xA;               0,&amp;amp; \text{for } |d| \leq \lambda\\&#xA;               d-\lambda,&amp;amp; \text{for } d &amp;gt; \lambda \\&#xA;               d+\lambda,&amp;amp; \text{for } d &amp;lt; -\lambda \\&#xA;            \end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure below depicts both cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mBOcC.png&quot; alt=&quot;Hard and soft thresholding&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;soft thresholding&lt;/strong&gt; is also called &lt;em&gt;wavelet shrinkage&lt;/em&gt;, as values for both positive and negative coefficients are being &quot;shrinked&quot; towards zero, in contrary to &lt;strong&gt;hard thresholding&lt;/strong&gt; which either keeps or removes values of coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of image de-noising, you are not working strictly on &quot;intensity values&quot;, but wavelet coefficients. You probably remember that you can decompose your image into wavelet levels, like in case of lovely Lena.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Wnk7p.jpg&quot; alt=&quot;Lena&quot;&gt;&#xA; Assuming that wavelet transform gives sparse coefficients, mostly close to zero, and noise level is lower than wavelet coefficients, you can simply threshold these. Although if you wish, you can perform &lt;em&gt;hard/soft&lt;/em&gt; thresholding on each decomposition level with a different value of $\lambda$. When it is done, then you just have to reconstruct your image from all decomposition levels and voila, noise should be removed!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below you have two examples of de-noised image via hard and soft thresholding respectively (same $\lambda$). Obviously soft thresholding gives more smooth image- if you can notice that with such a poor resolution ;) Courtesy of MATLAB.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YHOUC.png&quot; alt=&quot;Hard&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U6Wj2.png&quot; alt=&quot;Soft&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-04-07T17:01:20.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15488" PostTypeId="2" ParentId="15476" CreationDate="2014-04-07T17:28:51.787" Score="2" Body="&lt;p&gt;The firsts steps by Tzanetakis can be described as an Scheirer algorithm(Tempo and beat analysis of acoustic musical signals by Eric Sheirer), you can use DTW, filterbanks or FFT to split your signal in &lt;code&gt;N&lt;/code&gt; subbands!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try to help you with what I did in the past, my steps are described below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can show a simple example of 6(six) (200, 400, 800, 1600, 3200, 6400) decomposed subbands aka &quot;Scheirer 1998″, I used this &lt;a href=&quot;https://raw.githubusercontent.com/ederwander/Beat-Track/master/AudioTest/B128.wav&quot; rel=&quot;nofollow noreferrer&quot;&gt;sample&lt;/a&gt; to test:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AnKFF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After DTW or filterbanks you need extract the envelope of each subband:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Apply Full Wave Rectification&lt;/li&gt;&#xA;&lt;li&gt;Apply Low Pass Filter&lt;/li&gt;&#xA;&lt;li&gt;Apply Downsample&lt;/li&gt;&#xA;&lt;li&gt;Apply Mean Removal&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My envelopes from the six subbands above are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kD2QY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK now do you have six downsampled envelopes (Downsample can help you gain speed to compute the autocorrelation), you need sum all envelopes like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GcF59.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Almost there, you need apply autocorrelation and to find bpm values between 60 and 200, you need compute the START and END position to be computeded from your summed envelopes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;start = (60 * downsampled_value) / (200)&#xA;&#xA;end = (60 * downsampled_value) / (60)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you know the start and end to do the autocorrelation :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step is find the peak from your autocorrelation and convert to BPM:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BPM=60*downsampled_value/PEAK&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And finally ride a histogram with the results of BPM's from each audio piece analyzed !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: Tzanetakis and Sheirer algorithm is not perfect its works well in strong rhythmic songs.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2014-04-07T17:28:51.787" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15490" PostTypeId="2" ParentId="14691" CreationDate="2014-04-07T18:41:43.957" Score="3" Body="&lt;p&gt;I am familiar with similar phenomena. During measurements with usage of sweep-sine, when you convolve your signal with inverse filter you are obtaining your IR. Although if you consider perfect case of convolving your original sweep $x(t)$ with the inverse filter $f(t)$, then you should get perfect Kronecker delta. Unfortunately what you will get is an impulse with pre and post-ringing:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RHneg.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;One way to minimise this effect is to use so called Kirkeby Algorithm, described here by A.Farina (my guru of acoustic measurements): &lt;a href=&quot;http://pcfarina.eng.unipr.it/Public/Papers/226-AES122.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Advancements in Impulse Response Measurements by Sine Sweeps&lt;/a&gt;. I am sure will find it quite fascinating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One last tittle-tattle:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Commonsense suggests to me that it should have a very sharp attack as the main wave hits followed by diminishing ripples corresponding to echoes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are definitely right, although in real world measurements it is possible to have preceding spike before main impulse in some cases. For example if you place your source close to the wall, then wave from speaker will excite mechanical wave in a wall and wave will propagate in the material with speed of sound much higher than in case of air. Nextly wall will emit acoustic wave that will be captured by your microphone.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-04-07T18:41:43.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15491" PostTypeId="1" AcceptedAnswerId="15504" CreationDate="2014-04-07T18:52:59.047" Score="0" ViewCount="477" Body="&lt;p&gt;I read in a paper that a sound signal can be delayed by D degrees. How can such a thing be possible? Isn't sound signals expressed only in terms of the time axis? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7316" LastActivityDate="2014-04-08T08:07:48.937" Title="How to delay a signal by D degrees" Tags="|sound|delay|allpass|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15492" PostTypeId="1" CreationDate="2014-04-07T18:55:29.107" Score="0" ViewCount="38" Body="&lt;p&gt;I have a Output Curve of following characteristics&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1fTVl.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/1fTVl.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following is the data which represents the output curve cited above&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0   1228.15406117455    1213.71796132282    1199.44623423626    1185.33715849069    1171.38902630825    1157.60014358826    1143.96882993237    1130.49341866405    1117.17225684288    1104.00370527364    1090.98613851046    1078.11794485629    1065.39752635781    1052.82329879590    1040.39369167202    1028.10714819050    1015.96212523702    1003.95709335331    992.090536708388    980.360953066379    968.766853751044    957.306763607236    945.979220959370    934.782777567031    923.715998577884    912.777462477973    901.965761039541    891.279499266498    880.717295337626    870.277780547640    859.959599246218    849.761408775075    839.681879403208    829.719694260385    819.873549268974    810.142153074209    800.524226972966    791.018504841132    781.623733059661    772.338670439371    763.162088144576    754.092769615612    745.129510490332    736.271118524637    727.516413512102    718.864227202765    710.313403221133    701.862796983477    693.511275614446    685.257717863085    677.101014018280    669.040065823703    661.073786392290    653.201100120311    645.420942601057    637.732260538220    630.134011658968    622.625164626790    615.204698954125    607.871604914830    600.624883456507    593.463546112736    586.386614915240    579.393122306018    572.482111049470    565.652634144552    558.903754736983    552.234546031533    545.644091204419    539.131483315831    532.695825222615    526.336229491134    520.051818310328    513.841723405001    507.705085949342    501.641056480713    495.648794813713    489.727469954538    483.876260015660    478.094352130827    472.380942370417    466.735235657145    461.156445682143    455.643794821435    450.196514052799    444.813842873049    439.495029215736    434.239329369281    429.046007895553    423.914337548901    418.843599195643    413.833081734033    408.882082014698    403.989904761570    399.155862493301    394.379275445192    389.659471491612    384.995786068946    380.387562099043    375.834149913207    371.334907176693    366.889198813755    362.496396933217    358.155880754588    353.867036534721    349.629257495012    345.441943749158    341.304502231452    337.216346625644    333.176897294352    329.185581209025    325.241831880470    321.345089289941    317.494799820775    313.690416190604    309.931397384121    306.217208586402    302.547321116805    298.921212363411    295.338365718043    291.798270511836    288.300421951372    284.844321055367    281.429474591926    278.055395016351    274.721600409499    271.427614416707    268.172966187255    264.957190314395    261.779826775920    258.640420875285    255.538523183269    252.473689480189    249.445480698649    246.453462866826    243.497207052304    240.576289306430    237.690290609210    234.838796814729    232.021398597103    229.237691396949    226.487275368383    223.769755326528    221.084740695544    218.431845457169    215.810688099765    213.220891567874    210.662083212278    208.133894740554    205.635962168130    203.167925769835    200.729430031931    198.320123604641    195.939659255160    193.587693821135    191.263888164634    188.967907126584    186.699419481673    184.458097893730    182.243618871551    180.055662725203    177.893913522768    175.758059047548    173.647790755713    171.562803734401    169.502796660248    167.467471758370    165.456534761766    163.469694871160    161.506664715267    159.567160311482    157.650901026989    155.757609540290    153.887011803139    152.038837002892    150.212817525260    148.408688917462    146.626189851781    144.865062089509    143.125050445289    141.405902751840    139.707369825069    138.029205429564    136.371166244459    134.733011829684    133.114504592569    131.515409754832    129.935495319916    128.374532040696    126.832293387534    125.308555516696    123.803097239110    122.315699989477    120.846147795722    119.394227248782    117.959727472736    116.542440095264    115.142159218437    113.758681389832    112.391805573974    111.041333124092    109.707067754198    108.388815511474    107.086384748976    105.799586098638    104.528232444585    103.272138896747    102.031122764767    100.805003532210    99.5936028310572    98.3967444164976    97.2142541419957    96.0459599346504    94.8916917708293    93.7512816520819    92.6245635813268    91.5113735393103    90.4115494613329    89.3249312142428    88.2513605736907    87.1906812016462    86.1427386241704    85.1073802094438    84.0844551460460    83.0738144214844    82.0753108009696    81.0887988064351    80.1141346957970    79.1511764424544    78.1997837150241    77.2598178573099    76.3311418685023    75.4136203836077    74.5071196541023    73.6115075288110    72.7266534350062    71.8524283597264    70.9887048313103    70.1353569011454    69.2922601256279    68.4592915483322    67.6363296823873    66.8232544930576    66.0199473805265    65.2262911628803    64.4421700592893    63.6674696733859    62.9020769768354    62.1458802930985    61.3987692813833    59.4883213755835    57.6483869118112    55.8755259367794    54.1665202384763    52.5183563982524    50.9282102384589    49.3934325474650    47.9115359739955    46.4801829919653    45.0971748454356    43.7604413910364    42.4680317622626    41.2181057864981    40.0089260915283    38.8388508436906    37.7063270647464    36.6098844790632    35.5481298468222    34.5197417427304    33.5234657431651    32.5581099878283    31.6225410848696    30.7156803310698    29.8365002210865    28.9840212219663    28.1573087911403    27.3554706179645    26.5776540705486    25.8230438311588    25.0908597048888    24.3803545875820    23.6908125801659    23.0215472376397    22.3718999419403    21.7412383888150    21.1289551796556    20.5344665100015    19.9572109471129    19.3966482896451    18.8522585030342    18.3235407247356    17.8100123339373    17.3112080808174    16.8266792708190    16.3559929997865    15.8987314361504    15.4544911466551    15.0228824624129    14.6035288823265    14.1960665111621    13.8001435297733    13.4154196951792    13.0415658683801    12.6782635679663    12.3252045477276    11.9820903966137    11.6486321595240    11.3245499775272    11.0095727462157    10.7034377910043    10.4058905582723    10.1166843213306    9.83557990027752    9.56234539487254    9.29675592962605    9.03859341036164    8.78764629156238    8.54370935386321    8.30658349109817    8.07607550635358    7.85199791651758    7.63416876485290    7.42241144115244    7.21655450906823    7.01643154023247    6.82188095481515    6.63274586818697    6.44887394337809    6.27011724904377    6.09633212266684    5.92737903874406    5.76312248171972    5.60343082344452    5.44817620495165    5.29723442235448    5.15048481668219    5.00781016748056    4.86909659001510    4.73423343592343    4.60311319717196    4.47563141318063    4.35168658098654    4.23118006832444    4.11401602950876    4.00010132400749    3.88934543760435    3.78166040605072    3.67696074111369    3.57516335893142    3.47618751059112    3.37995471484913    3.28638869291620    3.19541530523493    3.10696249017925    3.02096020460939    2.93734036621838    2.85603679760903    2.77698517204319    2.70012296080697    2.62538938213866    2.55272535166765    2.48207343431511    2.41337779760910    2.34658416636844    2.28163977871173    2.21849334334935    2.15709499811800    2.09739626971883    2.03935003462156    1.98291048109845    1.92803307235332    1.87467451071194    1.82279270284141    1.77234672596718    1.72329679505757    1.67560423094658    1.62923142936686    1.58414183086548    1.54029989157635    1.49767105482374    1.45622172353228    1.41591923341968    1.37673182694912    1.33862862801892    1.30157961736815    1.26555560867691    1.23052822534142    1.19646987790401    1.16335374211922    1.13115373763752    1.09984450728875    1.06940139694817    1.03980043596818    1.01101831815952    0.983032383306248   0.955820599199133   0.929361544172696   0.903634390131477   0.878618886051614   0.854295341944170   0.830644613267103   0.807648085773110   0.785287660780989   0.763545740858505   0.742405215905110   0.721849449623219   0.701862266367018   0.682427938358193   0.663531173258183   0.645157102086936   0.627291267478379   0.609919612263140   0.593028468369314   0.576604546032312   0.560634923305132   0.545107035860604   0.530008667077409   0.515327938401923   0.501053299978151   0.487173521538225   0.473677683546191   0.460555168587976   0.447795653000654   0.435389098734315   0.423325745440032   0.411596102777619   0.400190942937019   0.389101293367371   0.378318429707958   0.367833868915394   0.357639362581574   0.347726890437081   0.338088654034864   0.328717070609165   0.319604767104817   0.310744574372160   0.302129521522970   0.293752830442904   0.285607910456123   0.277688353137837   0.269987927270671   0.262500573940842   0.255220401770266   0.248141682280806   0.241258845386994   0.234566475013650   0.228059304834930   0.221732214131435   0.215580223762081   0.209598492247567   0.203782311962319   0.198127105431917   0.192628421733057   0.187281932993220   0.182083430987262   0.177028823828250   0.172114132749923   0.167335488978228   0.162689130689473   0.158171400052687   0.153778740353848   0.149507693199712   0.145354895799043   0.141317078319080   0.137391061315172   0.133573753231541   0.129862147971212   0.126253322533180   0.122744434714959   0.119332720878702   0.116015493779123   0.112790140451515   0.109654120158199   0.106604962391776   0.103640264933625   0.100757691966098   0.0979549722369389  0.0952298972744753  0.0925803196521720  0.0900041513011877  0.0874993618696001  0.0850639771270087  0.0826960774132594  0.0803937961300688  0.0781553182743600  0.0759788790121574  0.0738627622919147  0.0718052994961873  0.0698048681305858  0.0678598905489812  0.0659688327139552  0.0641302029915237  0.0623425509791821  0.0606044663663534  0.0589145778263389  0.0572715519389033  0.0556740921426450  0.0541209377163267  0.0526108627883675  0.0511426753737151&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following function represents the output characteristics of Tracer in 50 minute time interval (Y-Axis-Mbq  ; X-Axis : Time in minutes)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now i would like to Sample the Output Curve into 19 frames&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;4 frames : Each of 15 seconds time interval&#xA;2 frames : Each of 30 seconds time interval&#xA;2 frames : Each of 60 seconds time interval&#xA;11 frames : Each of 200 seconds time interval&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and plot each of the Respective frames in a plot, kindly suggest me some methodology to approach this problem&lt;/p&gt;&#xA;" OwnerUserId="8506" LastActivityDate="2014-04-07T18:55:29.107" Title="Matlab:Sampling Curve into Frames and Plotting" Tags="|matlab|signal-analysis|sampling|continuous-signals|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15494" PostTypeId="2" ParentId="14691" CreationDate="2014-04-07T19:50:03.083" Score="2" Body="&lt;p&gt;Interesting answers so far, but I think it could be something else: Sampling requires to the signal to be band limited. Ideally all energy is very very low as you approach the Nyquist frequency. If your acoustic simulator produces significant energy close to or at Nyquist, you will this type of time domain ringing (which is essentially a form of aliasing). In order to do the FFT you need to have the Nyquist value to be real. If your simulator spits at a value at Nyquist that has a non zero phase, you will also get time domain ringing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best would probably be to cascade your frequency response with a low pass filter before doing an inverse FFT. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-04-07T19:50:03.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15495" PostTypeId="1" CreationDate="2014-04-07T20:35:49.187" Score="0" ViewCount="1548" Body="&lt;p&gt;I was expecting that when I take (for example, in MATLAB), s2 = fft(s1/norm(s1)), the norm of s2 is not equal one, norm(s2) $\neq$ 1.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot figure out why this is! Can anyone shed light on this?&lt;/p&gt;&#xA;" OwnerUserId="4141" LastActivityDate="2014-04-07T21:49:37.550" Title="Fourier transform of a normalized vector" Tags="|fft|normalization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15496" PostTypeId="2" ParentId="15471" CreationDate="2014-04-07T21:04:31.100" Score="3" Body="&lt;p&gt;Well my friend, let me answer your questions here. You've asked why subtraction of recorded sweep from original one will not produce any info about echos. So I took exponential sinusoid in range of $5\mathrm{Hz}$ up to $7995\mathrm{Hz}$, sampling frequency is $16\mathrm{kHz}$. Then I've used some crude filtering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jkJWo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In result we get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VHOpq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that amplitude is modulated according to filtering applied. Now if we want to get some info about the impulse response of our system, then let's try simple subtraction as suggested by you, that's what we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nrPyA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can get from this time domain signal is what is the difference between different frequencies in time. Any info about reflections would not be straightforward. This is simple filtering, so there are none, but imagine you have some reverberation in the end, then your recorded signal is longer than played. Thus you have some tail of decaying sinusoids - nightmare to analyse anything&#xA;But when you deconvolve filtered signal with the inverse filter, that's what you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Toz7j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How beautiful is that! ;) You've obtained the impulse response of a filter that was applied at the very beginning. What's more, you can perform Fourier Transform of that impulse response and that will give you frequency response of this filter. I quickly did some frequency analysis, so you can see result below. Upper normalised frequency axis is forced to be logarithmic. You can easily relate that to filtering applied in the beginning. What's more, you can deduce that this plugin is using FIR filter because phase is linear!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y0L3j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it was for example measurement of acoustic space, then your impulse response would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GrSlv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that you can very easily detect any reflections, delays between arrivals via different paths and even flutter echo or different fancy stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you are interested in detection of echo, then I suggest you to read the work of Dietsch (unfortunately in German): &lt;em&gt;Ein objektives Kriterium zur Erfassung von   Echostörungen bei Musik- und Sprachdarbietungen&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above all following thesis: &lt;a href=&quot;http://www.akutek.info/Papers/AL_Echo.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Evaluation of objective echo criteria&lt;/strong&gt;&lt;/a&gt;. Guy is investigating echos a lot - you even have MATLAB files in the appendix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some bits about theory standing behind sweep-sine measurements: &lt;a href=&quot;http://pcfarina.eng.unipr.it/Public/Papers/226-AES122.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Advancements in Impulse Response Measurements by Sine Sweeps&lt;/strong&gt;&lt;/a&gt;, and: &lt;a href=&quot;http://web.arch.usyd.edu.au/~wmar0109/DESC9090/old/Farina_00.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Simultaneous Measurement of Impulse Response and Distortion with a Swept-Sine Technique&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And bit more about derivatives from IR to convince you how powerfull it is: &lt;a href=&quot;http://kurser.iha.dk/eit/eaku/litt/Acoustic%20Parameters%20and%20IR%20Derivatives.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Theoretical and Applied Room Acoustics Including Parameters and IR Derivatives&lt;/strong&gt;&lt;/a&gt; (although that one is targeting more at Architectural Acoustics)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I did convinced you - good luck!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-02-21T21:03:43.637" LastActivityDate="2015-02-21T21:03:43.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15497" PostTypeId="2" ParentId="15495" CreationDate="2014-04-07T21:30:03.003" Score="2" Body="&lt;p&gt;Depends on the scaling of the FFT pair for the conventional case (no scaling for the forward FFT and 1/N for the inverse FFT), the frequency domain norm will be higher by sqrt(N) where N is the FFT length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative would to to use 1/sqrt(N) for both forward and inverse FFT in which case the norm would be preserved. Both versions can be found in practice.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-04-07T21:30:03.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15498" PostTypeId="2" ParentId="15495" CreationDate="2014-04-07T21:49:37.550" Score="2" Body="&lt;p&gt;There are different conventions in scaling of the FFT, in MATLAB you need to scale it by $\sqrt{N}$, where $N$ is your number of samples. Saying it in matlabish:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc, clear all&#xA;%% Create some sinusoidal signal with noise&#xA;t = linspace(0, 6*pi, 1000)+randn(1,1000);&#xA;s1 = sin(2*pi*t);&#xA;% Calculate the norm of s1&#xA;s1_norm = norm(s1);&#xA;display(sprintf('L2 norm of s1: %.2f', s1_norm))&#xA;%% Create signal s2 as the FFT of normalised s1&#xA;% Scale FFT by sqrt(N) - this is convention used in MATLAB&#xA;s2 = fft(s1)/sqrt(length(t));&#xA;% Calculate the norm of s2&#xA;s2_norm = norm(s2);&#xA;display(sprintf('L2 norm of s2: %.2f', s2_norm))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-04-07T21:49:37.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15499" PostTypeId="2" ParentId="15401" CreationDate="2014-04-07T22:00:42.703" Score="2" Body="&lt;p&gt;im assuming your signals are audio and harmonic and you are not doing multiple F0 estimation where you have multiple tones played simultaneously. in that case there are a few easier methods. the normalisation of short time autocorrelation function. r(lag) = (1/N)*sum(x(n)*x(n+lag)&#xA;N is length of x(n)&#xA;F0 here is obtained from the inverse of the lag that corresponds to the maximum of r(lag) within a predefined range (for example your range could be from 20 to 250, hence at lag 196 you have a maximum, again play around with this range). to avoid detecting an integer multiple of the period, short lags are better than long ones.&#xA;here is a C function for this, probably worth playing around with. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void autocorr(  &#xA;    float *r,       /* (output) autocorrelation vector */ &#xA;    const float *x, /* (input) data vector */ &#xA;    int N,          /* length of data vector */ &#xA;    int order       /* largest lag for calculated  &#xA;                      autocorrelations */ &#xA;)&#xA;{ &#xA;    int     lag, n;&#xA;    float   sum; &#xA;&#xA;    for (lag = 0; lag &amp;lt;= order; lag++) { &#xA;        sum = 0; &#xA;        for (n = 0; n &amp;lt; N - lag; n++) { &#xA;            sum += x[n] * x[n+lag]; &#xA;        } &#xA;        r[lag] = sum/N; &#xA;    } &#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An alternative method for detecting peaks, is center clipping. after your autocorr function you could code something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(n) = a(n) - C,  if a(n) &gt;= C&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(n) = a(n) + C, if a(n) &amp;lt;= -C&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(n) = 0 otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;C is some percentage of the max amplitude of the autocorr vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all i have showed you above is the very basic stuff, since F0 analysis can be very complex (probably why people have not answered). you can find more in speech codec books or music transcription books.  &lt;/p&gt;&#xA;" OwnerUserId="8489" LastEditorUserId="8354" LastEditDate="2014-04-09T01:01:36.937" LastActivityDate="2014-04-09T01:01:36.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15500" PostTypeId="2" ParentId="15491" CreationDate="2014-04-07T22:26:54.553" Score="0" Body="&lt;p&gt;If you have a finite window of samples of a reasonably band-limited sound signal, you can also represent this sound data in the frequency domain.  In the frequency domain, each frequency point has a phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, you can try an fftshift of the data, zero-pad the center of the vector, do an FFT, convert the complex result to magnitude and phase, add a constant to the phase of every bin between DC and Fs/2 (and the inverse constant to the other half so the vector remains conjugate symmetric), then reverse the FFT process to get a phase delayed result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added:  It looks like the paper isn't about changing the chirp sound itself, but about changing the timing phase of the start of the chirp sound with reference to an external periodic chirp-rate clock (clock start or mid-clock, etc.). Thus 2 Pi would be equal to one clock period, or 1/chirp_rate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-08T02:50:08.570" LastActivityDate="2014-04-08T02:50:08.570" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15501" PostTypeId="1" AcceptedAnswerId="15509" CreationDate="2014-04-07T23:51:21.583" Score="3" ViewCount="230" Body="&lt;p&gt;I have to develop an underwater positioning system which has to determine the position of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Remotely_operated_underwater_vehicle&quot; rel=&quot;nofollow&quot;&gt;ROV&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Four buoys will be placed on each corner of a swimming pool. Each one of these buoys will be equipped with an hydrophone and a transducer (which emits acoustic signals). Both devices will be connected to a Raspi for performing DSP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ROV will also contain the same equipment (transducer, hydrophone, Raspi).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering which could be the best way to determine the distances between the ROV and the buoys for triangulating the position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first glance I have tought with the next ways to achieve it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Signal Strength: Every buoy will emit a beacon signal with the same power, but at  different frequency for each one. The ROV could determine its position be means of comparing the power received.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Ping: The ROV emits a ping and inicialices a counter, when the buoys receive the ping they respond immediately. When the ROV receives the ping back stops the counter and calculates the distance.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think that the second approach can be much more accurate. The first method that comes in my mind in order to achieve it is to use a certain frequency for emitting the ping (let's say 2khz). The buoys would be in recepcion mode, awaiting for receiving this ping. They would detect the ping by means of frequency analysis (Goertzel's algorithm). The same algorithm would be used in to ROV for receiving the ping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main drawback is that the system needs to be really precise. An error of 1ms means 1.4m of deviation. I don't really know if that is doable and if is the best way to achieve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which method would you use?&lt;/p&gt;&#xA;" OwnerUserId="8512" LastActivityDate="2014-04-08T10:07:46.500" Title="Underwater Acoustic Positioning" Tags="|fourier-transform|acoustics|ultrasound|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15502" PostTypeId="2" ParentId="15491" CreationDate="2014-04-08T01:04:09.180" Score="0" Body="&lt;p&gt;Given that you have limited number of samples, you can perform a Discrete Fourier Transform and represent your sound in frequency domain (frequencies and phases). After that if you want to apply a delay of D degrees you can simply use the known Fourier transform below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ F\left \{ f(t-\theta) \right \} \rightarrow \hat{f}(w) \times e^{jw\theta} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that your sound is a number of sinusoids added together; to apply same phase delay to all frequency components is multiply a complex number $ e^{jw\theta} $ where $\theta$ is your desired phase delay. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand if you want to apply the same time delay to all your frequency components you should calculate the appropriate phase angle shift to be applied to each frequency component. Assuming $t_{delay}$ is the delay you want to apply, you can obtain $\theta_w$ to apply with&#xA;$$ \theta_w = w\times t_{delay} = 2\pi f\times t_{delay} $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In which, $\theta_w $ should be calculated for each frequency bin of your results of your DFT. And the reasoning behind this can be simply explained as below. Assume a signal with sinusoid components.&#xA;$$ f(t) = sin(2\pi f_1t) + sin(2\pi f_2t) $$&#xA;If I want to apply the same phase angle shift to both signals (I don't know why anyone would want but anyways):&#xA;$$ g(t) = sin(2\pi f_1t + \theta) + sin(2\pi f_2t + \theta) $$&#xA;And to apply a time delay:&#xA;$$ f(t-t_{delay}) = sin(2\pi f_1(t-t_{delay})) + sin(2\pi f_2(t-t_{delay})) $$&#xA;$$ f(t-t_{delay}) = sin(2\pi f_1t-2\pi f_1t_{delay}) + sin(2\pi f_2t-2\pi f_2t_{delay}) $$&#xA;As you see the phase angle shift $\theta$ you should apply is different for each frequency component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: If you have the proper MATLAB license you could try checking out the doc and source of delayseq function (it's in Phased Array System Toolbox).&lt;/p&gt;&#xA;" OwnerUserId="8513" LastActivityDate="2014-04-08T01:04:09.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15503" PostTypeId="1" AcceptedAnswerId="15508" CreationDate="2014-04-08T06:51:18.170" Score="2" ViewCount="732" Body="&lt;p&gt;I have a motor, that I want to analyse, using its sound, so I can  its 'character' I was using the the simple fft, and figured out, that it wouldn't help, so I tried the order analysis, at least I incremented the speed of the motor and I can say it in spectrogram like here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oFTXC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question isn't about codes but about theory, what are the methods that I can use to analyse the sound of motor? &#xA;Thanks for any help ! &#xA;link : &lt;a href=&quot;https://stackoverflow.com/questions/22894679/how-to-implement-the-order-analysis-in-matlab&quot;&gt;related question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-04-08T10:05:21.733" Title="How to analyse the sound of Motor" Tags="|matlab|continuous-signals|signal-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15504" PostTypeId="2" ParentId="15491" CreationDate="2014-04-08T08:07:48.937" Score="1" Body="&lt;p&gt;What they mean by a delay of $n$ degrees is simply in reference to the periodicity of the chirps. A period consists of the chirp sound plus an interval of silence. Let the period be $T$. If another chirp starts in the middle of the period of the first chirp, i.e. there is an offset of $T/2$, then the authors refer to this as a delay of 180 degrees. So the delay in degrees $\varphi$ is related to the time delay $\tau$ by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\varphi=\frac{360^\circ}{T}\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is the period of the chirp. &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-08T08:07:48.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15506" PostTypeId="1" CreationDate="2014-04-08T08:57:10.893" Score="0" ViewCount="1712" Body="&lt;p&gt;I am working on LMS algorithm,i am not getting exactly how we get desired response of the filter that is compared with the estimated output&lt;/p&gt;&#xA;" OwnerUserId="8514" LastEditorUserId="128" LastEditDate="2020-03-17T08:27:12.753" LastActivityDate="2024-03-27T16:27:11.170" Title="LMS Algorithm: How to Define the Desired Signal" Tags="|discrete-signals|adaptive-filters|lms|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15507" PostTypeId="2" ParentId="15506" CreationDate="2014-04-08T09:04:27.133" Score="1" Body="&lt;p&gt;In a digital communication system you often use a known training sequence for an initial adaption of the filter taps. After this initialization, the output of the slicer is used as a desired signal. This mode of operation is called &lt;em&gt;decision directed&lt;/em&gt;. This is just a (hopefully helpful) example. In general it depends on your application how you define your desired signal.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-08T09:04:27.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15508" PostTypeId="2" ParentId="15503" CreationDate="2014-04-08T09:35:34.590" Score="1" Body="&lt;p&gt;In my opinion, using the STFT (or spectrogram) as you already did is a good start. Try to change the parameters of your STFT, i.e. window size and frame shift until you are able to detect certain frequencies and their repetitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example for a decelerating car on the highway. The inertial sensor (not a microphone) was placed at the axle:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KspI7.png&quot; alt=&quot;STFT of decelerating car&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8515" LastActivityDate="2014-04-08T09:35:34.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15509" PostTypeId="2" ParentId="15501" CreationDate="2014-04-08T10:07:46.500" Score="1" Body="&lt;p&gt;I have worked with this kind of a positioning system before (NOT underwater, but still sound based), and I hope I can help. Your first option is probably not the best idea, even in a controlled environment there are many factors which can change your signal's amplitude and therefore making it unreliable information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think your second option is a better way to go. It could be even better if you can embed some time information to your transmitted signal as well (a timestamp like GPS). With a timestamp containing information about when the signal was fired, you can calculate the time difference without ping-back, which would save you some distance error. Or you would have two methods to determine the position and you can perhaps use some sort of filtering depending on a set of initial results (to decide which one works better). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method that I would like to suggest is an array configuration. If you can make sure that your transmitters will transmit at ABSOLUTELY at the same time (with respect to each other), you can use the phase differences of the received signals in your boat to determine the range and the respective angles(with some ambiguity). So again you wouldn't need to ping back your signal. But in this configuration the absolute positions of your transmitters must remain the same, and the positioning of your receivers in your boat must remain the same as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we used the ping method, our biggest problem was echo. I don't know exactly how echo works underwater but if it exists, I would suggest you to be careful about it. In our project we had only used the ping without any extras that I suggested to you, and I must admit it wasn't very reliable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck with your project, I hope you do better than us, and I would like to hear about the results.&lt;/p&gt;&#xA;" OwnerUserId="8513" LastActivityDate="2014-04-08T10:07:46.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15510" PostTypeId="2" ParentId="15401" CreationDate="2014-04-08T11:08:00.740" Score="0" Body="&lt;p&gt;You may get better results if you do a spectro-temporal auto-correlation. This involves splitting the signal into frequency bands and performing an ACF on each band. Summing across the auto-correlations of all the bands can provide clearer peaks and hence a more reliable $f_0$ estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information see Licklider's 'A duplex theory of pitch perception'. &lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2014-04-08T11:08:00.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15511" PostTypeId="1" CreationDate="2014-04-08T12:15:39.663" Score="1" ViewCount="56" Body="&lt;p&gt;Can anybody tell me how to calculate the order analysis / spectrum of a signal? I've been searching in vain. I want to use MATLAB to analyse the signal / sound of a motor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information about the order analysis - here is an &lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/372416A-01/svtconcepts/intro_ord_ana/&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help! &lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="8202" LastEditDate="2014-04-08T19:47:07.970" LastActivityDate="2014-04-08T19:47:07.970" Title="The order analysis in MATLAB" Tags="|matlab|continuous-signals|" AnswerCount="0" CommentCount="8" ClosedDate="2014-04-18T17:28:09.870" ContentLicense="CC BY-SA 3.0" />
  <row Id="15515" PostTypeId="2" ParentId="15506" CreationDate="2014-04-08T14:57:56.607" Score="3" Body="&lt;p&gt;as the others have said you are best looking at practical examples of uses of LMS. once examples is noise cancellation. think of a system where we have two microphones, one mic is the source which contains speech and background noise. the other microphone will just contain noise. in this system we try to eliminate the noise from the speech. so the inputs to the LMS are our noise reference signal and the difference between the (speech + noise) - estimate of the noise, so in this case the LMS adapts to noise that appears at the source. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example is echo cancellation. here you using your landline, which goes through a hybrid circuit, the signal from the far end x(n) is mixed with the near end signal u(n), so the signal going to far end is x + u + v = d, where v is noise. at the far end the person does not want to hear their own voice. so at the far end the user will have access to x(n), so inputs to LMS are x(n) and e(n) where e = d - y. in this case y is our output of LMS, used to remove the x from signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in a comms system, as mentioned above the LMS is used to update the equaliser coeffs. in comms systems they use the training sequence (s[n]) which is known at both ends of the transmission system, this allows us to train the equaliser. this training sequence is used before speech transmision, and during speech transmission, and sometimes training is turned off completely if channel estimate is good. in this system the LMS has inputs r[n] (the recieved signal - the s[n] after passing through the channel), and e[n], which is from the s[n] - r[n], then you would update the equaliser coeffs f after doing f = f+mu*e*r.&lt;/p&gt;&#xA;" OwnerUserId="8489" LastActivityDate="2014-04-08T14:57:56.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15517" PostTypeId="1" CreationDate="2014-04-08T15:36:42.893" Score="1" ViewCount="255" Body="&lt;p&gt;I have $m$ complex-valued time-series $z_m(t_n)$, which I am currently analyzing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started by calculating their PSDs and CSDs. These exhibit an unexpected peak at a given frequency, which is present for all PSDs and CSDs, signaling some kind of coherence between the time-series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly this peak disappears, when I calculate the PSDs or CSDs of only the modulus $|z_m(t_n)|$ of the time-series, suggesting that the phase $\phi[z_m(t_n)]$ of the time-series is somehow related to the time-domain and thus is important for determining its the power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is acutally two-fold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) What does the relevance of the phase of $z_m(t_n)$ vs. $|z_m(t_n)|$ tell me about $z_m(t_n)$? I.e. is there some mathematical relevance/relation that could explain this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Could this be due to some kind of &quot;principal phase&quot; of the $z_m(t_n)$ that, by throwing it out when calculating the modulus, &quot;decorrelates&quot; the spectral information of my time-series in the frequency-domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a little puzzled by the behavior and hope somebody could suggest, where to look or if there is some way to unravel the relevance of the phase in this.&lt;/p&gt;&#xA;" OwnerUserId="7424" LastActivityDate="2014-04-08T15:36:42.893" Title="Importance of phase of time-series for PSD" Tags="|phase|power-spectral-density|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15518" PostTypeId="1" CreationDate="2014-04-08T16:31:24.710" Score="3" ViewCount="2974" Body="&lt;p&gt;I got an $N$, in my case 512, point FFT of a real-valued signal. Based on some calculation in my application I determine the parameters $k \in [1, N-1]$, the number of oscillations per period, $\phi \in [0, 2\pi[$, phase. I use these parameters and the function&#xA;$\cos\left(2\pi\cdot \frac{k}{N}\cdot t + \phi\right)$&#xA;to describe a signal in time-domain. Instead of calculating all the points of the signal and then doing an FFT I would like to directly calculate the result in frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculated the FFT coefficients for the function as following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n = \frac{N}{2}\left(\mathrm{e}^{i\phi} \cdot \mathrm{sinc}\left(n-k\right)+\mathrm{e}^{-i\phi} \cdot \mathrm{sinc}\left(n+k\right)\right), \quad\text{ with }\mathrm{sinc}(x) = \frac{\sin(\pi x)}{\pi x}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: $N$ is in here because the output of the FFT algorithm I use is not scaled and scaling is done in IFFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I &lt;a href=&quot;http://www.wolframalpha.com/input/?i=FourierCoefficient%5Bcos%288.23*t%2b0.1%29,t,9%5D-1/2*%28exp%28i*0.1%29*sinc%28%289-8.23%29*pi%29%2bexp%28-i*0.1%29*sinc%28%289%2b8.23%29*pi%29%29&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Verification of coefficients&quot;&gt;verified&lt;/a&gt; my coefficients using Mathematica with the &lt;a href=&quot;https://reference.wolfram.com/mathematica/ref/FourierCoefficient.html&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;FourierCoefficient&quot;&gt;FourierCoefficient&lt;/a&gt; function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculated a 512 elements long vector of complex doubles in Matlab and set my first vector to zero as there is no (dc) offset. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this valid or do I have to calculate bin 0 too if my $k$ is not a whole number? &lt;/li&gt;&#xA;&lt;li&gt;Can I use $c_0$ for it?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The next 255 values I filled $c_n$ with $n$ from -1 to -255. The next value I filled with zero as I was unsure which coefficient should go there. And then the next 255 values I filled with $c_n$ with $n$ from 255 to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To verify the correctness of my generated signal I plotted the real value of the IFFT of my vector. The output was as expected as long as $\phi$ was 0 and $k$ was a whole number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot (blue is what was expected and red the result from IFFT) with $\phi=0$ and $k = 8.3$:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/EPFwa.jpg&quot; alt=&quot;Plot with phi=0 and k=8.3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot with $\phi=0.3$ and $k = 8$:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6OHb1.jpg&quot; alt=&quot;Plot with phi=0.3 and k=8&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot with $\phi=0.3$ and $k = 8.3$:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PIvwd.jpg&quot; alt=&quot;Plot with phi=0.3 and k=8&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference my matlab code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k = 8.3; %number of oscillations per period&#xA;phi = 0.3; %phase in radians&#xA;&#xA;t = linspace(0,511,512);&#xA;n = linspace(-1,-255,255);&#xA;fft_coeff0 = 256*(exp(i*phi)*sinc(-k)+exp(-i*phi)*sinc(k));&#xA;fft_coeffs(1:255) = 256*(exp(i*phi)*sinc(n-k)+exp(-i*phi)*sinc(n+k));&#xA;&#xA;reconst_fft = [fft_coeff0 fft_coeffs 0 conj(fft_coeffs(end:-1:1))];&#xA;&#xA;y = cos(k/512*2*pi*t+phi);&#xA;plot(t, ifft(reconst_fft), 'r', t, y, 'b')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What could cause the difference between my expected output and the IFFT? &lt;/li&gt;&#xA;&lt;li&gt;How can I fix it?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Changed code to only calculate one side and use complex conjugating for the other side and added $c_0$ coefficient to vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot with $\phi=0.0$ and $k = 8.5$:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GQvQg.jpg&quot; alt=&quot;Plot with phi=0.3 and k = 8.3:&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding $c_0$ fixed the wrong amplitude.&lt;/p&gt;&#xA;" OwnerUserId="8520" LastEditorUserId="1629" LastEditDate="2016-03-29T21:07:32.180" LastActivityDate="2018-08-18T16:02:26.640" Title="Calculation of cosine in frequency domain instead of calculatin in time-domain followed by a FFT" Tags="|matlab|fft|fourier-transform|fourier-series|ifft|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15519" PostTypeId="5" CreationDate="2014-04-08T16:55:51.427" Score="0" Body="&lt;p&gt;image compression is a process of representing an image file or datastream using fewer bytes.  compression can be &quot;lossless&quot;, in which the original data can be recovered exactly, or it can be &quot;lossy&quot;, in which some detail is lost for the sake of better compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples of &quot;lossy&quot; compression are JPEG, which attempts to quantize the data in a manner that preserves image appearance and GIF, in which the number of colors is reduced to 256 or fewer.  PNG is an example of lossless image compression, at least to the extent that up to 16 bits of data per color sample are preserved.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2014-04-08T18:00:02.947" LastActivityDate="2014-04-08T18:00:02.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15520" PostTypeId="4" CreationDate="2014-04-08T16:55:51.427" Score="0" Body="image compression is a process of representing an image file or datastream using fewer bytes.  compression can be &quot;lossless&quot;, in which the original data can be recovered exactly, or it can be &quot;lossy&quot;, in which some detail is lost for the sake of better compression." OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2014-04-08T17:59:58.460" LastActivityDate="2014-04-08T17:59:58.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15521" PostTypeId="2" ParentId="15518" CreationDate="2014-04-08T17:10:13.837" Score="0" Body="&lt;p&gt;If you want to reconstruct a strictly real result sine wave, the input to the IFFT needs to be conjugate symmetric.  Whereas your code appears to have not inverted the imaginary component in the upper/negative half of the FFT coefficients.  C0 should from your equation, not zero, as non-periodic-in-window sinewaves can end up with a DC offset in that window.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-08T17:10:13.837" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15522" PostTypeId="1" CreationDate="2014-04-08T18:14:10.433" Score="1" ViewCount="224" Body="&lt;p&gt;I'm curious about the feasibility of designing a noise shaping filter (but might generalise to any recursive filter) with the constraint that the most recent output samples aren't available for several iterations of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use case I have in mind is reducing the word length of an audio stream sampled at 48kHz, and the filter would try to keep most of the quantisation noise out of the 200Hz-8kHz band (where human hearing is more sensitive); but with the additional constraint that the most recent seven outputs are not available to the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm applying this constraint so that the output can be produced several samples at a time using a mixture of SIMD and instruction-level parallelism -- working with a notional four-lane SIMD and two-fold unrolling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a lot of work for each sample which &lt;em&gt;could&lt;/em&gt; be performed in parallel (scaling, quantisation, dither) if not for the recursive factor.  Normally one might hope to use SIMD for the multiply-accumulate of the coefficients, but that's not a great proportion of the work if the filter has only a handful of taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm wondering if it's actually possible to design a filter that doesn't get in the way, here, but is still effective for its intended purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stereo would obviously offer an opportunity to halve the delay, but avoiding that assumption is preferable, as it makes mono a failure case and multi-channel becomes complicated.&lt;/p&gt;&#xA;" OwnerUserId="5180" LastEditorUserId="5180" LastEditDate="2014-04-09T17:30:25.107" LastActivityDate="2016-08-27T13:05:13.437" Title="Filter design with 8-tap latency on recursion" Tags="|filter-design|delay|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15523" PostTypeId="1" AcceptedAnswerId="15534" CreationDate="2014-04-08T18:57:45.517" Score="0" ViewCount="383" Body="&lt;p&gt;How do you determine if you are using analog or digital communications? For example when dealing with PCM and noise how can one notice any difference in the signals when using the two types of communications? Thanks&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-04-09T16:54:02.473" Title="Analog vs. digital communications in PCM and noise" Tags="|digital|analog|" AnswerCount="1" CommentCount="1" ClosedDate="2014-04-14T19:48:11.143" ContentLicense="CC BY-SA 3.0" />
  <row Id="15525" PostTypeId="1" CreationDate="2014-04-08T20:27:26.350" Score="0" ViewCount="157" Body="&lt;p&gt;let us suppose that we have given following model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t)=A_1 \sin(\omega_1*t+\phi_1) + A_2 \sin(\omega_2*t+\phi_2) + A_3 \sin(\omega_3*t+\phi_3)+ \ldots +A_p \sin(\omega_p*t+\phi_p)+z(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where  $z(t)$ is white noise,we have everything unknown,$p,A_i,\omega_i,\phi_i$,what i want to remove noise using wavelet,i know that is it  possible using discrete wavelet,so which mother waveelt is good for deterministic and  periodic components?let us suppose that we have  data  ,some numbers of length $N=294$,which mother wavelet should i choose and  which scales?please help me with practical example,because wavelet is new and i want to see what is steps for denoising,there is some link about denosing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://eeweb.poly.edu/iselesni/DoubleSoftware/signal.html&quot; rel=&quot;nofollow&quot;&gt;http://eeweb.poly.edu/iselesni/DoubleSoftware/signal.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;including matlab codes,but i want to know before i start use some method  ,is it relevant for such model?as i know wavelet is good for transient signals,is it ok for steady signals?for periodic ones?if so then which steps is necessary?thanks in advance&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorDisplayName="user350" LastEditDate="2014-04-08T20:49:12.587" LastActivityDate="2014-06-09T19:38:42.207" Title="denosing given signal using wavelet" Tags="|discrete-signals|noise|wavelet|denoising|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15526" PostTypeId="1" CreationDate="2014-04-08T20:42:20.660" Score="0" ViewCount="51" Body="&lt;p&gt;I encountered the following interesting computational problem in the field of computational statistical mechanics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/8yimd9uy5u0jrdj/dftpr.pdf&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/8yimd9uy5u0jrdj/dftpr.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank you :)&lt;/p&gt;&#xA;" OwnerUserId="8476" LastActivityDate="2014-04-08T20:42:20.660" Title="DFT method for a sequence defined by recursion" Tags="|fft|convolution|dft|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15527" PostTypeId="1" CreationDate="2014-04-08T21:52:16.937" Score="0" ViewCount="95" Body="&lt;p&gt;I read from Wikipedia that signals obey the uncertainty principle. The product of the measured uncertainty in frequency times the measured uncertainty in time is greater than a constant. The localization of both frequency and time is not possible simultaneous. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can two people play a signal game with signal acquisition? Player A sends a signal to player B. Player B listens to the signal. Player A stops transmitting the signal after a short period of time. Player B must calculate from the limited time signal what the frequency spectra is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a real game in the world?&lt;/p&gt;&#xA;" OwnerUserId="8437" LastActivityDate="2020-06-28T20:57:14.477" Title="Signal Acquisition Game?" Tags="|signal-analysis|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15529" PostTypeId="1" CreationDate="2014-04-09T00:57:01.130" Score="0" ViewCount="217" Body="&lt;p&gt;I want to detect, in real-time, a 1-2 word spoken phrase within continuous speech, speaker independently, in hardware. The smaller the number of gates the better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to do this? Are the requirements feasible?&lt;/p&gt;&#xA;" OwnerUserId="8525" LastEditorUserId="8525" LastEditDate="2014-04-09T03:44:54.960" LastActivityDate="2016-08-27T00:53:23.137" Title="Good methods for hardware based 1-2 word speaker independent speech recognition?" Tags="|speech-recognition|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15530" PostTypeId="1" CreationDate="2014-04-09T05:25:44.763" Score="0" ViewCount="51" Body="&lt;p&gt;I recently read a research paper that discussed how to correct lightcurve data (flux vs. time) by using the method as explained below:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We have considered as outliers in the datasets the individ- ual&#xA;  measurements showing a point-to-point deviation in the two-point&#xA;  dierence function of the light curve greater than 3 for the SC and&#xA;  5 for the LC, where  is dened as the standard deviation of the&#xA;  two-point dierence function.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;SC and LC are just different versions of the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone explain to me what they mean by the two-difference function and how they are using it to correct the time-series data? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the link to the paper. You can find this quote on page 3, section 3.1.&#xA;&lt;a href=&quot;http://arxiv.org/abs/1103.0382&quot; rel=&quot;nofollow&quot;&gt;http://arxiv.org/abs/1103.0382&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8483" LastEditorUserId="8483" LastEditDate="2014-04-10T01:12:52.620" LastActivityDate="2014-04-10T01:12:52.620" Title="Correcting outliers using the standard deviation of a two-point different function?" Tags="|noise|python|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15531" PostTypeId="2" ParentId="15529" CreationDate="2014-04-09T07:11:21.713" Score="1" Body="&lt;p&gt;There is really no need to do this in hardware. You can do the same on any cpu and it will be more flexible, energy efficient and updatable. You can pack simple computing core into your chip and run on it if you want. I don't think you'll gain anything from hardware implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a good implementation of keyword spotting you can check CMUSphinx &lt;a href=&quot;http://cmusphinx.sourceforge.net&quot; rel=&quot;nofollow&quot;&gt;http://cmusphinx.sourceforge.net&lt;/a&gt;, it has recently introduced good efficient keyword spotting. Fixed point arithmetics, noise suppression, tunable threshold. All that you need in single package.&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2014-04-09T07:11:21.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15533" PostTypeId="2" ParentId="10279" CreationDate="2014-04-09T08:31:56.460" Score="1" Body="&lt;p&gt;I think that you can find some tools here: &lt;a href=&quot;http://www.vamp-plugins.org/download.html&quot; rel=&quot;nofollow&quot;&gt;Vamp Plugins&lt;/a&gt;. These plugins can run standalone or in Sonic Visualizer. You also have Aubio plugin, mentioned by pichenettes, or ones created by guys at University of Barcelona (based on Pitch Contour Characteristics - more to read in the publication of J. Salamon and his thesis). I am sure you can find something for you in there.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-04-09T08:31:56.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15534" PostTypeId="2" ParentId="15523" CreationDate="2014-04-09T16:54:02.473" Score="0" Body="&lt;p&gt;This is quite a broad topic.  Let's narrow the scope to toll quality telephone audio.  Further assume both analog and digital channels are bandlimited to the same passband.  I assume you don't want to figure out the difference between a pair of wires and a PCM channel (i.e. a pair of wires has a very slow decay in frequency response where as a digital channel is hard band limited).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok a for sort of apples to apples comparison of a roughly 4Khz voice band channel, you can look for sampling artifacts in the channel.  The sampling frequency for telephone audio is 8Khz.  The true passband for telephone quality audio is 200Hz-3600Hz (still roughly speaking here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look for quantization noise.  Quantization noise is not random and can be made nearly periodic by choosing the right test signal.  The PCM encoding for standard CODEC ditigal telephone channels uses a type of compression that follows a log scale (u-law or A-law).  The analog reconstruction filter does not completely eliminate the quantization noise.  Because of the compression scheme, the quantization steps increase with increasing signal amplitude.  If you create a test signal that is a ramp running from -Vp to +Vp (where Vp is the maximum signal amplitude the channel can handle), you will see discontinuities that are closely spaced near 0V and spaced farther appart near +Vp and -Vp.  Use a frequency of 1KHz so the signal frequency is harmonically related to the sampling frequency.  This will place the quantization errors nearly at the same location for each period of the ramp signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use a spectrum analyzer and look for spurs in the frequency content of a test signal.  In this case, use a 1Khz sine wave.  Once again the quantization errors will remain at nearly the same position on each period of the sinewave.  The quantization errors will appear as distortion of the sine wave and show up as harmonics in the signal spectrum.  These harmonics will be greatest when the sampling frequency is harmonically related to the signal frequency so 1KHz and 2KHz are good choices.  As the test tone drifts away from intger divisions of the sampling rate, the quantization noise spreads and begins to look like a spectral contribution from random noise.  In telephone systems, a 1KHz test tone is generally not used for this reason.  The normal test tone frequency is 1004Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that modern CODECS with high compression rates such as G.729 have a difficult time passing periodic signals.  These CODECs are designed in such a way as to interpret all signals as human voice or noise, so the reproduced periodic signal will be highly distored or modulated.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2014-04-09T16:54:02.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15536" PostTypeId="2" ParentId="15522" CreationDate="2014-04-09T18:46:56.280" Score="1" Body="&lt;p&gt;This is tricky. Any filter with 8 tab latency between coefficients can be represented in the z-domain as a rational function in $z^{-8}$ . That's basically the same as saying the impulse response has 7 zeros between each non zero tap. Any filter with this property is periodic in the frequency domain. You can pick any transfer function from -pi/8 to pi/8 but the regions from pi/8 to 3*pi/8,etc. will just be repetitions of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may be able to do better with varying delays but this is a complicated design problem&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-04-09T18:46:56.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15538" PostTypeId="1" CreationDate="2014-04-09T19:51:32.273" Score="3" ViewCount="208" Body="&lt;p&gt;I'm hoping someone could point me in the direction of some signal processing methods to clean up my data. I'm collecting physiological data from human muscle (lower leg; gastrocnemius) during walking/gait. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the sensor is picking up contractions, but the problem is it's so plagued by motion and skin artefacts I can barely do anything with it. Performing an isometric contraction (contracting the muscle without changing its length) shows a good signal (as there are no motion or skin artefacts to contaminate it. However, when collecting real-world data of a subject walking I'm getting huge spikes on the heel strike, amongst other unpleasantries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sensor type revolves around a MEMS microphone, so basically it picks up everything. It is un-amplified and only filtered by post processing. The sampling rate is 1kHz and seems to be more than enough. It's a single channel/vector of a continuous signal (i.e. 10 minutes of collection at 1kHz is a 1x600000 vector). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me by suggesting some methods on what I can do. I've been looking at wavelet transforms which look promising, but any help on the matter will be much appreciated. Also look at PCA but having a vector makes it difficult (unless I break my data into windows?). I'm trying to keep it as uncontrolled as possible, so any analysis that I can do on my current collected data would be great! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can provide some data if it helps in your analysis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="7855" LastActivityDate="2014-06-16T15:22:10.793" Title="Noise rejection / feature extraction" Tags="|discrete-signals|signal-analysis|wavelet|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="15539" PostTypeId="1" AcceptedAnswerId="15547" CreationDate="2014-04-09T20:08:10.557" Score="1" ViewCount="7090" Body="&lt;p&gt;I know that the error probability for antipodal systems is  Q (√((2Fs)/No)) and for orthogonal systems it is Q (√(Fs/No)), however, can anybody give their derivation? Because I am finding different ones on the internet I am getting confused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found pages 74-75 useful but I think their derivations are quite short here:&#xA;&lt;a href=&quot;http://www.sps.ele.tue.nl/members/F.M.J.Willems/TEACHING_files/5JK00/signalenergyorthogonalsignals.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.sps.ele.tue.nl/members/F.M.J.Willems/TEACHING_files/5JK00/signalenergyorthogonalsignals.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-04-10T08:43:34.793" Title="Probability error for antipodal systems and orthogonal systems" Tags="|signal-analysis|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15540" PostTypeId="2" ParentId="15539" CreationDate="2014-04-09T20:55:45.573" Score="1" Body="&lt;p&gt;For equally likely&#xA;binary signals $s_0(t)$ and $s_1(t)$ of energies $E_0$ and $E_1$ respectively&#xA;in an AWGN channel with two-sided power spectral density $\frac{N_0}{2}$, the&#xA;error probability is given by&#xA;$$P_e = Q\left(\sqrt{\frac{E_0 + E_1 - 2 \langle s_0, s_1 \rangle}{2N_0}}\right)&#xA;\tag{1}$$&#xA;where&#xA;$\displaystyle \langle s_0, s_1 \rangle = \int_{-\infty}^\infty s_0(t)s_1(t)\,\mathrm dt$ is the &lt;em&gt;inner product&lt;/em&gt; of the two signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For antipodal signals, $E_0 = E_1 = E$ and $\langle s_0, s_1 \rangle = -E$ giving&#xA;everyone's favorite answer $Q\left(\sqrt{2E/N_0}\right)$ while for equal&#xA;energy orthogonal signals, the inner product is $0$ giving everybody's second&#xA;favorite answer $Q\left(\sqrt{E/N_0}\right)$. For some details of the proof&#xA;of $(1)$,&#xA;see &lt;a href=&quot;https://dsp.stackexchange.com/a/9389/235&quot;&gt;this answer&lt;/a&gt; that I wrote&#xA;some time ago.  For even more detail,&#xA;see &#xA;&lt;a href=&quot;http://courses.engr.illinois.edu/ece361/sp2011/Newlectures/Lecture03.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Lecture Note of mine&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-04-09T20:55:45.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15541" PostTypeId="1" AcceptedAnswerId="15542" CreationDate="2014-04-09T21:45:43.810" Score="0" ViewCount="404" Body="&lt;p&gt;For this type of input (top) and output (bottom) &lt;img src=&quot;https://i.stack.imgur.com/Lowrv.png&quot; alt=&quot;noise&quot;&gt; which of these equations is required for the SQNR: &lt;img src=&quot;https://i.stack.imgur.com/MjPB2.png&quot; alt=&quot;1&quot;&gt; or &lt;img src=&quot;https://i.stack.imgur.com/ZZkRs.png&quot; alt=&quot;2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-04-09T22:49:49.793" Title="SQNR for quantizer" Tags="|signal-analysis|" AnswerCount="1" CommentCount="1" ClosedDate="2014-05-06T17:20:25.327" ContentLicense="CC BY-SA 3.0" />
  <row Id="15542" PostTypeId="2" ParentId="15541" CreationDate="2014-04-09T22:49:49.793" Score="0" Body="&lt;p&gt;the 1.76 dB is assuming the &quot;S&quot; is a sine wave with amplitude right up to the rails (which has &quot;sinusoidal distribution&quot;) and &quot;QN&quot; is the quantization error (which has uniform distribution).  if you assume both S and QN have uniform distribution (which is what you might have with a triangle waveform cranked up to the rails), then the 1.76 dB goes away.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-04-09T22:49:49.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15543" PostTypeId="2" ParentId="14906" CreationDate="2014-04-10T00:20:55.120" Score="0" Body="&lt;p&gt;If I understand you right, you are actually asking for a fairly simple process. If not, then I'm sorry. What I understand from &quot;getting the top 10 most dominant frequency components&quot; is to have the top 10 frequency components with highest amplitudes. To do that you can simply follow the method below without any advanced processing.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;[y, Fs] = wavread('chordG.wav'); % read the wav file into X with sampling frequency Fs&#xA;fftVal = abs(fft(y,63)); % take 63 point FFT of signal and get magnitudes of the frequency components, increase number of points as you might require more frequency samples&#xA;mags = fftshift(fftVal); % perform an FFT shift to shift the negative frequencies&#xA;freqs = linspace(-Fs/2,Fs/2,length(mags))'; % create a proper frequency axis depending on the FFT length&#xA;plot(freqs, mags); % plot the frequency spectrum of your sound&#xA;% HERE&#xA;mergedData = [freqs, mags]; % merge the frequency data and magnitude data into a Nx2 matrix&#xA;sortedFreq = sortrows(mergedData, [-2 1]); % sort the merged columns by descending order wrt mags and then ascending order to freqs&#xA;top10freqs = sortedFreq(1:10, 1); % get the first 10 frequency components&#xA;top10mags = sortedFreq(1:10, 2); % get the first 10 frequency magnitudes&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this will give you the negative frequency components as well, which might be useless since we're talking about a real signal here. So before getting the top 10, you can eliminate the negative frequencies with a simple line of code that you insert to &quot;% HERE&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;mags(freqs &amp;lt; 0) = 0; % zero-out the mags where freqs are less than zero&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final note, while you are doing this process the number of FFT points you have is going to matter a lot, so my advice would be to experiment with your data a little bit and see how  many points work out for you.&lt;/p&gt;&#xA;" OwnerUserId="8513" LastActivityDate="2014-04-10T00:20:55.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15544" PostTypeId="1" AcceptedAnswerId="15546" CreationDate="2014-04-10T00:37:55.827" Score="0" ViewCount="81" Body="&lt;p&gt;I am new to audio processing. I wrote a simple real-time playback program (when you speak on the mic your voice is immediately played on the output), however it is not working. I am using a 8Hz ADC with 128 frame size, and I output these 128 samples directly to audio PWM. It doesn't play the audio even though there's a &quot;reaction&quot; when you tap the mic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a processing needed before outputing the samples, that would explain why it isn't working ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my main loop : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;while (1) {&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;while (ADCChannelIsBusy(MyADCHandle)){}&#xA;ADCChannelRead  (MyADCHandle, Frame, ADC_BUFFER_SIZE);&#xA;while(OCPWMIsBusy(MyDACHandle));&#xA;OCPWMWrite  (MyDACHandle,Frame, OCPWM_FRAME_SIZE);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote none of these functions, all were found in the dsPic starter Kit. Frame is the array where samples are stored.&lt;/p&gt;&#xA;" OwnerUserId="8439" LastEditorUserId="8439" LastEditDate="2014-04-10T00:52:18.113" LastActivityDate="2014-04-10T08:23:57.970" Title="Is there any processing needed to playback audio?" Tags="|audio|" AnswerCount="1" CommentCount="3" ClosedDate="2014-04-14T19:47:54.750" ContentLicense="CC BY-SA 3.0" />
  <row Id="15545" PostTypeId="1" CreationDate="2014-04-10T07:28:52.120" Score="0" ViewCount="433" Body="&lt;p&gt;what are the applications of discrete sine transform . can discrete sine transform be used in place of discrete cosine transform ? please state the reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can it be used in compression.?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2018-07-06T18:51:01.333" Title="the importance of discrete sine transform" Tags="|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15546" PostTypeId="2" ParentId="15544" CreationDate="2014-04-10T08:04:16.180" Score="0" Body="&lt;p&gt;This is unlikely to be a signal processing question. This is about the internals of the dsPic's firmware libraries and would be more suitable on another stackexchange site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things that could go wrong:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ADC input and PWM output might have a different data format (for example 12-bit right justified for the ADC, 8-bit for the PWM). You might need to scale / offset the data.&lt;/li&gt;&#xA;&lt;li&gt;ADC_BUFFER_SIZE and OCPWM_FRAME_SIZE might be of different sizes, requiring you to use an intermediate buffer and counters to keep track of data pouring in/out of this buffer. Or, if the implementation allows it, you might instead read/write partial buffers of a smaller size - identical for both calls.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-10T08:23:57.970" LastActivityDate="2014-04-10T08:23:57.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15547" PostTypeId="2" ParentId="15539" CreationDate="2014-04-10T08:43:34.793" Score="0" Body="&lt;p&gt;I believe that Dilip Sarwate's answer has all the necessary information, but I would like to add a few things that might make it a bit easier for the less initiated to get a better understanding of the formula for the error probability. Furthermore, I want to point out one reason why you can find in different texts slightly different versions of this formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I think it is important to see that the term in the numerator of the argument of the $Q(\cdot)$ function is simply the distance between the two signals $s_0(t)$ and $s_1(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sqrt{E_0 + E_1 - 2 \langle s_0, s_1 \rangle}=\sqrt{||s_0||^2+||s_1||^2-2\langle s_0, s_1 \rangle}=\sqrt{||s_0-s_1||^2}=||s_0-s_1||$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $||s_0||^2=||s_1||^2=E$, this distance is $2\sqrt{E}$ for antipodal signaling, and $\sqrt{2E}$ for orthogonal signaling, as shown in the figure below (from &lt;em&gt;Digital Communication&lt;/em&gt; by E.A. Lee and D.G. Messerschmitt):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/afIDi.png&quot; alt=&quot;signal distances for antipodal and orthogonal signaling&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This picture very cleary illustrates the reason why orthogonal signaling requires 3dB more SNR for the same probability of error as antipodal signaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noting that the argument of the $Q(\cdot)$ function is actually half the distance between the signals divided by the square root of the noise variance (which, admittedly, is not rigorously shown in this answer), the value of the $Q(\cdot)$ function is simply the probability that the noise is greater than half the distance between the two signals. Only then will the received signal be closer to the wrong signal, and, consequently, the decision will be wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the formula for the error probabiltiy, a source of confusion is the definition of the noise power spectral density $N_0$. There is the one-sided spectral density $N_{0,1}$ and the two-sided density $N_{0,2}$, and they are related by $N_{0,1}=2N_{0,2}$. Unfortunately, everybody just denotes them by $N_0$, so you always have to check which one is meant. For antipodal signaling, the formula for the error probability is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_e=Q\left(\sqrt{\frac{2E}{N_{0,1}}}\right)=Q\left(\sqrt{\frac{E}{N_{0,2}}}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for orthogonal signaling we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_e=Q\left(\sqrt{\frac{E}{N_{0,1}}}\right)=Q\left(\sqrt{\frac{E}{2N_{0,2}}}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formulas in Dilip Sarwate's answer use $N_0$ as a one-sided power spectral density, or - equivalently (as stated in his answer) - $\frac{N_0}{2}$ as a two-sided density. In any case, the difference between antipodal and orthogonal signaling is always a factor of $\sqrt{2}$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-10T08:43:34.793" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15548" PostTypeId="1" AcceptedAnswerId="15554" CreationDate="2014-04-10T12:12:18.103" Score="0" ViewCount="704" Body="&lt;p&gt;I'm looking at the problem of integer upsampling (i.e. interpolation). This can be achieved by first increasing the sample rate by factor $L$ (i.e. inserting $L-1$ zeros between the original samples) and then low-pass filtering the signal (see e.g. Oppenheim/Schafer, &quot;Discrete Time Signal Processing&quot;, Sect. 4.6.2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I compare the the samples of the original signal with the corresponding samples of the upsampled signal, I observe a slight difference in amplitude. Is there a way to avoid this and to leave the original samples unaltered? That's what I would expect of an interpolation method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter I used is a symmetric FIR filter with an even number of coefficients and for comparison I compensate the delay introduced by that filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that there are other interpolation methods (linear, cubic, hermite, etc.), but I would like to use this particular method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I could make myself understood. Thanks in advance for your help!&lt;/p&gt;&#xA;" OwnerUserId="8539" LastActivityDate="2014-04-11T07:03:19.577" Title="Integer upsampling - leave original samples unaltered" Tags="|lowpass-filter|resampling|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15550" PostTypeId="2" ParentId="6103" CreationDate="2014-04-10T14:27:28.420" Score="3" Body="&lt;p&gt;Since this question was asked a year and half ago, this is for memo:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I have designed notch filter for removing 50 Hz noise but don't know how to add a 50 Hz powerline interference noise to a clean ECG signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, let's say your original signal is &lt;code&gt;original_ecg&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sampling_frequency = 1000;&#xA;mains_coeff = 0.1;    Amplitude of mains line to change. Depends on your ECG signal.&#xA;time_step = 1/sampling_frequency;&#xA;max_time = 2;    % Duration of your signal in seconds.&#xA;t = time_step:time_step:max_time;    % This is our time vector.&#xA;mains_signal = cos(2*pi*60*t);       % 60Hz mains frequency. Depends.&#xA;dirty_signal = original_ecg + mains_coeff*mains_signal;&#xA;plot(dirty_signal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's an example signal from Physionet (100) where we add a noise of amplitude 0.1 and frequency of 60Hz. I've taken only 1second of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/coImP.jpg&quot; alt=&quot;Original signal - MIT - 100&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SrC97.jpg&quot; alt=&quot;Sinusoidal noise to be added, I normalizd the axis to be the same as original&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W9pNa.jpg&quot; alt=&quot;Dirty signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I made some assumptions to explain it roughly. I arbitrarily chose a 2 seconds duration, a 1000Hz sampling frequency, a 60Hz mains power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Important: Make sure your noise is the same length as your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meaning: If your ecg contains 100000 values, your noise should contain as much as that, or you'll get an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also important: Sometimes dimensions don't match (your time is a row, so is your mains. The data you import from MIT is a column that needs to be transposed simply &lt;code&gt;row_vector = column_vector'&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay, you are doing PLI (Power Line Interference) filtering. In a great, perfect world, it would be a sinusoïd, but in reality, there are spikes sometimes, arcs, etc. This is a pain in the butt. Feel free to add some impulses here and there in your mains to see how your code performs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to test a denoising algorithm, you add a &lt;em&gt;known&lt;/em&gt; noise to your signal, then pass it through your algorithm to get a denoised signal, then compare between original signal and denoised signal and  look at performance parameters (SNR, distortion, etc). For the PSD, you see if the frequency range you are interested in isn't attenuated, for example.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I compare which wavelet (e.g. db6) is best suited for ECG analysis?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, this is kind of tedious: You do a state of the art. You read a lot of articles about where the field is at right now. There are some good academic articles burried in a ton of crap. Unfortunately, you'll have to sort them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of articles don't contain any value actually, only an tiny incremental benefit (many times the cost is that it gets computationally intensive to the point it doesn't justify the tiny increment). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a business, after all, where companies want their technology and algorithm protected, so as someone said, each time someone tries to go in the field, they need to reinvent the wheel in some way or another. And where publishers want a lot of articles published (nonobstant quality, often times).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you test, a lot. You also get inspired applying things that aren't really applied in that discipline and try things out.&lt;/p&gt;&#xA;" OwnerUserId="8400" LastActivityDate="2014-04-10T14:27:28.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15551" PostTypeId="1" CreationDate="2014-04-10T14:48:56.427" Score="2" ViewCount="1224" Body="&lt;p&gt;I wrote a simple lowpass filter in python to run against lena. Now I'd like to add Gaussian noise to the lowpass filtered data and then run an inverse filter against the lowpass and try to get the original back (well, as close to original). I'm new to programming in python and not quite sure how to add noise and write the inverse. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;import scipy.misc&#xA;from scipy import ndimage&#xA;import Image &#xA;&#xA;def plot(data, title):&#xA;    plot.i += 1&#xA;    plt.subplot(2,2,plot.i)&#xA;    plt.imshow(data)&#xA;    plt.gray()&#xA;    plt.title(title)&#xA;plot.i = 0&#xA;&#xA; # Load the data...&#xA;img = scipy.misc.lena()&#xA;data = np.array(img, dtype=float)&#xA;plot(data, 'Original')&#xA;&#xA;#lowpass filter&#xA;n=5&#xA;kernel = kernel = np.ones((n,n))&#xA;&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8541" LastEditorUserId="8541" LastEditDate="2014-04-10T15:04:19.363" LastActivityDate="2014-04-10T15:04:19.363" Title="Lowpass then Inverse filtering in python" Tags="|lowpass-filter|python|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15552" PostTypeId="2" ParentId="15548" CreationDate="2014-04-10T15:05:57.203" Score="0" Body="&lt;p&gt;this answer comes only from my direct experience:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;first, if you are upsampling and leaving the original samples unaltered, you are necessarily using a windowed sinc() function as the interpolation kernel.  even if your method does not ostensibly appear to be the windowing method (say you're using Lagrange or Hermite polynomials), you can take whatever resulting impulse response and point-by-point divide by the sinc(), deal with the 0/0 division as a &quot;removable singularity&quot; (use the limit), and the result will be your effective window.  when looking at the interpolation FIR coefficients for the various phases and then look at the specific phase that corresponds to the original sample time, for windowed-sinc you will see 0s for every coefficient except one coef which has the value 1.  that corresponds to &quot;copying the original sample over&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;my experience is that, for the windowed-sinc kernel, the Kaiser window is best, but using either Parks-McClellan (firpm) or Least Squares (firls) is better, &lt;strong&gt;but&lt;/strong&gt; the output samples that lie on top of the original samples are &lt;strong&gt;not&lt;/strong&gt; unaltered, since they have to be filtered like every other sample.  so you have to compute them.  but, comparing apples-to-apples, for the same stopband attenuation, the P-McC or LS will have a shorter impulse response and fewer samples are needed in the FIR computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you're upsampling by exactly 2, then it makes sense to save 50% of the computation, and compute only the in-between samples and copy the original sample.  the FIR will be a little longer with a windowed-sinc.  but if you upsample by 4, windowed-sinc is &lt;strong&gt;not&lt;/strong&gt; worth it.  you may save 25% of the computation by copying the original, but the additional costs on the 3 other samples (compared to what you would have with P-McC or LS) exceeds what you save by not needing to compute the sample of the original.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-04-10T15:05:57.203" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15554" PostTypeId="2" ParentId="15548" CreationDate="2014-04-10T15:30:56.370" Score="1" Body="&lt;p&gt;You need to be careful with the delay compensation. If your symmetric filter has an even number of taps, then you get a non-integer delay. If you use a symmetric filter with an odd number of coefficients then the delay of $\frac{N-1}{2}$ samples is an integer number ($N$ is the number of filter coefficients).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-10T15:30:56.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15556" PostTypeId="1" CreationDate="2014-04-10T16:07:36.047" Score="1" ViewCount="416" Body="&lt;p&gt;I work mainly in GIS (geographical information systems) but I would like to deepen my knowledge of remote sensing (analyzing imagery acquired remotely from airborne or satellite sensors). I was advised to learn as much about signal analysis as possible. I am assuming that signal processing and analysis refer to the same techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because signal processing seems to be applied to all sorts of different areas, I'm not quite sure where to start. I should specify that beyond two university calculus courses (on which did quite well), I do not have a background in physics or math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone help me plan a sort of &quot;road map&quot; to learning signal processing, preferably applied to remote sensing? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8543" LastActivityDate="2015-09-03T14:04:59.727" Title="Getting introduced to signal processing for remote sensing" Tags="|signal-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15557" PostTypeId="1" CreationDate="2014-04-10T16:44:31.153" Score="0" ViewCount="1102" Body="&lt;p&gt;I had asked a question last night in regards to how to process my data (&lt;a href=&quot;https://dsp.stackexchange.com/questions/15538/noise-rejection-feature-extraction&quot;&gt;Noise rejection / feature extraction&lt;/a&gt;) but I have a more specific question now that I hope someone can answer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned in my other post, I have a microphone based sensor to detect muscle activity in the lower leg during walking, however the data is contaminated by the thud made during heel strike. As both the muscle contraction and heel strike noise are pretty reproducible on each stride I was hoping I could use some sort of feature extraction method to filter my data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been using CWT and I believe they could do what I intend based on my current results. I've been playing around with specific wavelets but the symlets 7 seems to be giving the best results. My hope is that the coefficients obtained by CWT will vary based on whether they're noise or contraction information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All processing is done in MATLAB. I've obtained the CWT simply by: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CWTcoeffs = cwt(data, 1:128, 'sym7');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the corresponding coefficients of noise/useful data seem to do what I want, but now trying to use this information to remove what I don't want is proving difficult. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also seen a MATLAB function of scal2frq which I hope to use to provide more frequency specific results. As I know, very roughly, what frequency bands I'm interested in I want to use this function to change the CWT scale, but not completely sure how. I believe it's done by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; s = [6, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 100];&#xA; scale = scal2frq(s, 'sym7', 1/fs);&#xA; CWTcoeffs = cwt(data, scale, 'sym7');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which does produce results, but I'm not sure if it's correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically what I'm asking is if this method seems plausible, and if so how might I use the results to damp or remove the noise I'm not interested in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I should probably add some data! Here is someone walking in a straight line for 50 steps: &lt;a href=&quot;https://www.dropbox.com/sh/jeoa8ll1leq8kbn/8jlEzbbW0R&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/sh/jeoa8ll1leq8kbn/8jlEzbbW0R&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7855" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-09-30T06:46:42.630" Title="CWT for filtering / feature extraction" Tags="|matlab|discrete-signals|signal-analysis|wavelet|local-features|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15558" PostTypeId="2" ParentId="15556" CreationDate="2014-04-10T17:01:26.583" Score="0" Body="&lt;p&gt;My brief recommendation would be to watch the Gilbert Strang Linear Algebra lectures (free MIT courseware, and he also provides a free copy of his textbook in pdf form) to get a comprehensive understanding of linear algebra. Then I would suggest looking into a course (on iTunesU or anywhere else) on Fourier Analysis. That will provide you up with a lot of the math/physics background to understanding signals processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since ArcGIS uses python, you can call any matlab signals processing functions in there if you're looking to use this directly in a GIS.&lt;/p&gt;&#xA;" OwnerUserId="8541" LastActivityDate="2014-04-10T17:01:26.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15560" PostTypeId="2" ParentId="15525" CreationDate="2014-04-10T18:53:06.093" Score="1" Body="&lt;p&gt;If you have reason to believe your signal is sparse in the frequency domain, they you should be denoising in that: use FFTs, not wavelets. Look at the magnitude spectrum and see if it's very spiky, and that will be your cue. If so, attenuate the frequencies with a small response.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-04-10T18:53:06.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15563" PostTypeId="1" AcceptedAnswerId="15565" CreationDate="2014-04-11T02:06:44.320" Score="0" ViewCount="7017" Body="&lt;p&gt;In the code I am trying to understand, there is an usage of Hann window multiple times (There's overlapping frames, the size of each is 512 and the overlapping factor is 75% so each time we capture  128 samples we build a new frame by shifting the previous one by 128 to the left). For each Frame we apply a Hann window before the FFT, so the first 128 samples were actually &quot;framed&quot; 4 times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I don't understand the purpose of this windowing. Can someone please tell me what its effect is on the FFT ?&lt;/p&gt;&#xA;" OwnerUserId="8439" LastActivityDate="2014-04-14T07:54:55.373" Title="What exactly is the effect of a Hann Window on the FFT output?" Tags="|window-functions|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15564" PostTypeId="2" ParentId="15563" CreationDate="2014-04-11T02:41:51.100" Score="1" Body="&lt;p&gt;FFT implicitly uses a rectangular window for a sequence. This kind of rectangular windowing has demerits. Rectangular window causes &quot;leakage&quot; of the main lobe power onto the side-lobes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowing is one of the techniques to reduce the side-lobe level. However, there are drawback in windowing too. Windowing increases the width of the main lobe which in turn affects the resolution. Rectangular window has a good resolution, that is, a sharper main lobe compared to other windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, in windowing, there is a trade-off between the width of main lobe and power in the side lobes. This trade-off is studied in the signal processing literature and it is available in many digital signal processing text books.    &lt;/p&gt;&#xA;" OwnerUserId="8475" LastEditorUserId="8475" LastEditDate="2014-04-14T07:54:55.373" LastActivityDate="2014-04-14T07:54:55.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15565" PostTypeId="2" ParentId="15563" CreationDate="2014-04-11T04:03:59.480" Score="2" Body="&lt;p&gt;See the following: &lt;a href=&quot;http://www.dtic.mil/dtic/tr/fulltext/u2/a381695.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.dtic.mil/dtic/tr/fulltext/u2/a381695.pdf&lt;/a&gt;  especially p.631 Figs. 17+18.  As noted by the author, a 4 to 1 overlap using a Hann or Hamming window allows for proper reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see: F. J. Harris, “On the use of Merged, Overlapped and Windowed FFT’s to Generate Synthetic Time Series Data with a Specified Power Spectrum,” Proc. IEEE 16th Asilomar Conf., 1982, pp. 316-321.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2014-04-11T04:03:59.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15566" PostTypeId="2" ParentId="15548" CreationDate="2014-04-11T07:03:19.577" Score="0" Body="&lt;p&gt;You can design an $L$:th-band (also known as Nyquist) filter, i.e., an FIR filter where the mid-tap is $1/L$ and every $L$:th coefficient starting from the mid-tap is zero. This gives you a filter which is &quot;complementary anti-symmetric&quot; around $\pi/L$ and is suitable for upsampling/downsampling by $L$. (Note that you should multiply the output of the interpolation filter by $L$, so in principle you will get the mid-tap 1 and all other coefficients in the corresponding polyphase branch will be zero, and, hence, you keep the original value.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest case is $L=2$ which gives you a half-band filter, i.e., a filter with an impulse response looking like $h_0 0 h_2 0 h_4 1/2 h_4 0 h_2 0 h_0$. In addition, you will for half-band filters have $\omega_cT + \omega_sT = \pi$ (passband edge + stopband edge = $f_s/2$) and $\delta_c = \delta_s$ (same passband and stopband ripples). These properties are the complementary anti-symmetry around $\pi/2$, i.e., $|H(e^{j\omega T}) + H(e^{j(\pi-\omega T)})|=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the general case, the relation is slightly more involved, but there will be a relation between passband and stopband ripples and shifted versions of the frequency response will sum up to one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To design the filter you can &quot;trick&quot; Remez/Parks-McClellan, at least in the $L=2$ case, by setting symmetric edges and identical ripples and, if needed, change every other coefficient to exactly 0 and 1/2. For the general case it works sometimes better, sometimes worse, so in general you may need to rely on either linear programming design or e.g. fminimax in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-04-11T07:03:19.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15568" PostTypeId="2" ParentId="1571" CreationDate="2014-04-11T08:12:25.470" Score="0" Body="&lt;p&gt;Ceemple is a rapid JIT C++ technical computing environment, that bundles several optimized C/C++ libraries for technical computing, so you can do both rapid prototyping and deployment within Ceemple. Available (free) from &lt;a href=&quot;http://www.ceemple.com&quot; rel=&quot;nofollow&quot;&gt;http://www.ceemple.com&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2014-04-11T08:12:25.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15569" PostTypeId="1" AcceptedAnswerId="15573" CreationDate="2014-04-11T08:38:22.823" Score="2" ViewCount="214" Body="&lt;p&gt;I am working on a signal processing assignment where I need to find out one common time domain signal from 4 observation. The math is like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}{lcl} y_1(t) &amp;amp; = &amp;amp; a_1(t)*x(t) + b_1(t) \\&#xA;                   y_2(t)&amp;amp; = &amp;amp;  a_1(t)*x(t) + b_1(t) \\&#xA;                   . &amp;amp; &amp;amp; \\ &#xA;                   . &amp;amp; &amp;amp; \\&#xA;                   y_n(t) &amp;amp; = &amp;amp; a_n(t)*x(t) + b_n(t)\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$n$ is up to 4 in my case, and $x(t)$ is my signal of interest which I want to extract from observed signals $y_n(t)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the general direction I should take in doing background study for this kind of application?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;K&lt;/p&gt;&#xA;" OwnerUserId="8546" LastEditorUserId="8202" LastEditDate="2014-04-11T11:13:28.670" LastActivityDate="2014-04-11T12:53:32.573" Title="Extracting common signal from 4 sets of observations" Tags="|signal-detection|correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15570" PostTypeId="2" ParentId="15375" CreationDate="2014-04-11T08:46:51.447" Score="1" Body="&lt;p&gt;Your approach intuitively makes sense, but it will not work the way you probably imagine. Homogenous stretching in frequency domain is exactly equivalent to stretching with the inverse factor in time domain. This holds for the continuous signal domain and up to aliasing also for the discrete domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this means is that if you perform this operation on a windowed section of your audio all you get is a locally time-domain resampled signal, i.e. the window frame is just played back faster or slower. If you combine this with some kind of overlap add scheme you get something that is usually called granular synthesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you pick the right grain size and overlap you can make it work with a lot of audible artefacts, but only for signals with a single pitch. And, like I said above, you don't need any kind of Fourier transform for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are way better methods if you want to pitch shift single pitch signals or even polyphonic signals. Monophonic methods usually start with first determining the pitch. So this might be a good starting point for your research.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-04-11T08:46:51.447" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15571" PostTypeId="1" AcceptedAnswerId="15572" CreationDate="2014-04-11T10:40:37.657" Score="0" ViewCount="63" Body="&lt;p&gt;I'm looking for a dedicated DSP chip that will allow sampling and delayed replay of a signal, given the following parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;buffer should be integrated&lt;/li&gt;&#xA;&lt;li&gt;configuration of the DSP chip (if needed) should be possible via host CPU (SPI or serial)&lt;/li&gt;&#xA;&lt;li&gt;starting and stopping the sampling/replay should be possible via a dedicated pin&lt;/li&gt;&#xA;&lt;li&gt;reading the samples via the host CPU is NOT required!&lt;/li&gt;&#xA;&lt;li&gt;sampling should be done with a frequency of at least 2MHz (since a temporal resolution of 1 µs is required)&lt;/li&gt;&#xA;&lt;li&gt;since this is for replaying a digital signal, a low resolution (even 1 bit per sample) is possible&lt;/li&gt;&#xA;&lt;li&gt;buffering should allow for 250 ms period&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I did not find any stand-alone DSP with this characteristics.&lt;/p&gt;&#xA;" OwnerUserId="8547" LastActivityDate="2014-04-12T10:49:30.073" Title="Dedicated DSP for delayed replay" Tags="|delay|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15572" PostTypeId="2" ParentId="15571" CreationDate="2014-04-11T11:43:18.240" Score="4" Body="&lt;p&gt;Hard to believe, that you actually looked. You probably don't even need a DSP for that, a normal microcontroller should be sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the STM32F4-Discovery board comes with an ARM Cortex-M3 that has several ADC channels that can do 2.4MSps each and up to 7.2MSps in interleaved mode. There's a DAC for signal output as well. But since your signal is digital anyways, you can probably sample with just a normal digital input pin. If 1bit per sample is enough, 250ms of a 2MHz sampled signal require 62500bytes which fits into the memory of the ARM quite well.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-04-11T11:43:18.240" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15573" PostTypeId="2" ParentId="15569" CreationDate="2014-04-11T12:53:32.573" Score="2" Body="&lt;p&gt;Because you have a set of linear equations, why don't you set up a linear system (for each data point) and solve the system (using SVD for example) to obtain the solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Write in the the matrix form such as $Y=\beta X$ where $\beta$ are known and $X$ is unknown.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-04-11T12:53:32.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15574" PostTypeId="1" AcceptedAnswerId="15591" CreationDate="2014-04-11T12:58:29.190" Score="2" ViewCount="2003" Body="&lt;p&gt;I want to calculate Morlet time and frequency resolution. the Morlet wavelet function is define as : $\psi(t)=\frac{1}{\sqrt{\pi f_b}}e^{j2\pi f_c}e^{-t^2/f_b}$&lt;br&gt;&#xA;Note: I know the answers, but I don't know how to achieve it on my own.I want someone to explain the time and frequency resolution relation to me please. here are some hint that I got from paper and might help you.&lt;br&gt;&#xA;in some paper I found that Morlet wavelet time and frequency resolution is : &#xA; $\Delta t=\frac{f_c\sqrt{f_b}}{2f_i}$ &#xA; $\Delta f=\frac{1}{2\pi f_c \sqrt{f_b}}$&lt;br&gt;&#xA;Because generally, the wavelet time and frequency resolution is define as:&lt;br&gt;&#xA;$\Delta t=s \Delta t_\psi$   and    $\Delta f= \frac {\Delta f_\psi}{s}$  (1)&lt;br&gt;&#xA;where 's' is scale. it is also evident that the frequency and scale are related to each other by $f_i=\frac{fc}{s_i}$ .   $\Delta t$ and $\Delta f$ are wavelet time and frequency resolution,respectively. $\Delta t_\psi$ and $\Delta f_\psi$ are morlet function time and frequency resolution which are as follow: &#xA;$\Delta t_\psi=\frac{\sqrt{f_b}}{2}$ and $\Delta f_\psi=\frac{1}{2\pi \sqrt{f_b}}$ (2)&lt;br&gt;&#xA;the Heisenberg uncertainty principle also says: $\Delta t \Delta f &amp;gt;= \frac{1}{4\pi}$&lt;br&gt;&#xA;Basically i want to prove (1) and (2). other things can be obtained by substituting.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2014-04-11T14:32:25.007" LastActivityDate="2014-04-12T20:40:45.967" Title="Morlet wavelet time and frequency resolution" Tags="|signal-analysis|wavelet|resolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15575" PostTypeId="2" ParentId="15571" CreationDate="2014-04-11T15:53:40.910" Score="2" Body="&lt;p&gt;I also suggest a general purpose microcontroller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your problem involves no processing and your data appears to be digital - so you don't even need an onboard ADC and DAC. The only thing you need is RAM and some very lightweight logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be silly to record digital data bit by bit - you only need to record the number of clock ticks between transitions. So if your input signal changes not so frequently, 250ms of binary data at 2 MHz might fit in just a few kilobytes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The STM32F405RGT6 has 64 pins only; only needs a quartz and passives; and has 192kbytes of internal memory (786ms at 2MHz, 1-bit, using naive encoding). Fast enough for sampling with a timer, by using input pin change interrupts, or by clocking it as a SPI slave.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-12T10:49:30.073" LastActivityDate="2014-04-12T10:49:30.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15578" PostTypeId="1" AcceptedAnswerId="15579" CreationDate="2014-04-11T19:55:55.990" Score="0" ViewCount="253" Body="&lt;p&gt;As it has proven in some paper and books the time and frequency resolution of Morlet wavelet is :&lt;br&gt;&#xA;  $\Delta t=\frac{f_c\sqrt{f_b}}{2f_i}$ &#xA; $\Delta f=\frac{1}{2\pi f_c \sqrt{f_b}}$&lt;br&gt;&#xA;I don't know how these relations have obtained, I have asked it in detail in &lt;a href=&quot;https://dsp.stackexchange.com/questions/15574/morlet-wavelet-time-and-frequency-resolution&quot;&gt;here&lt;/a&gt;.you can answer that if you want.&lt;br&gt;&#xA; but lets accept these relationship for now. there is some misunderstanding for me in here about the concept of resolution.&lt;br&gt;&#xA;for this case, by increasing the term $f_c\sqrt{f_b}$ we have finer frequency resolution but poor time resolution. I am sure about finer frequency and poor time resolution because my practical results meet it.  but if you look at $\Delta t$ and  $\Delta f$ relationships you receive that increasing the term $f_c\sqrt{f_b}$ leads to decrease $\Delta f$  and increase the $\Delta t$.&lt;br&gt;&#xA;does it mean that smaller value of resolution spell to have finer resolution and vice verca? &lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="128" LastEditDate="2018-07-12T14:03:05.893" LastActivityDate="2018-07-12T14:03:05.893" Title="Does Increasing Resolution Lead to Have a Poor Resolution?" Tags="|wavelet|resolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15579" PostTypeId="2" ParentId="15578" CreationDate="2014-04-11T20:49:58.500" Score="4" Body="&lt;p&gt;Indeed, that's the Heisenberg Uncertainty Principle - you can't have both very good frequency and time resolution. You always have to sacrifice something. In case of Short Time Fourier Transform it's straightforward, but for wavelets are being 'squeezed', which is changing their frequency resolution. Figure below describes more than a thousand words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://www.dsprelated.com/josimages_new/sasp/img2106.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Because you are still trying to understand why it is like that, then please mind that by increasing the frequency of the wavelet ($f_c$), you should also shrink it in time (decrease $f_b$). For more info please refer for example to: Paul Addison - &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0750306920&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Illustrated Wavelet Transform Handbook&lt;/a&gt;. You can find there a following graphs (Section 2.12):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R7hAJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PdPBA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tJZZr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:36.180" LastActivityDate="2014-04-12T16:05:47.407" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="15580" PostTypeId="1" CreationDate="2014-04-11T21:48:34.830" Score="1" ViewCount="621" Body="&lt;p&gt;From my days at college I rememeber that LPC splits a signal into a series of slowly changing filter coefficents and an audio-rate residual error signal, such that the original signal gets reproduced when you run the residual signal as &quot;excitation&quot; through a time-varying filter which is controlled by those coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cool thing is that you can replace the residual signal by another signal (e.g. a pulse train) and many of the characteristics of the original signal will be preserved. The excitation signal simply does not carry much information (except the pitch) and thus can be replaced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find this concept absolutlely intriguing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping that this method could be used to sythesize real-world instruments. I could e.g. replace the residual signal of a real Guitar, by one which was created by a Karplus-Strong algorithm. I would have &lt;em&gt;full control&lt;/em&gt; over that signal and if I feed it through the filter coefficients taken from a real guitar, this should take aways much of the artificial feel of Karplus-Strong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same reasoning led me to believe that one could build a fine vocal pitch correction this way. You pitch corect the residual and most of the unwanted artifacts will get filtered away in the filtering stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But all my attempts failed somewhat. For one, there does not seem to be much support for LPC in the open-source community(Luckily &quot;lpanal&quot; is still around). I played with csound and supercollider and I am getting the feeling that I am on the wrong track.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does the above make any sense or where did I go wrong?&lt;/li&gt;&#xA;&lt;li&gt;Is this idea of separating excitation from filtering widely used in sound synthesis? (I believe there is some audio compression algorithm, which uses LPC)&lt;/li&gt;&#xA;&lt;li&gt;Are there other methods which separate excitation from filtering?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8553" LastActivityDate="2014-04-11T22:49:54.687" Title="Separating excitation from filtering for sound sythesis" Tags="|sound|lpc|signal-synthesis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15581" PostTypeId="2" ParentId="15580" CreationDate="2014-04-11T22:47:03.810" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Does the above make any sense or where did I go wrong?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this idea of separating excitation from filtering widely used in sound synthesis? (I believe there is some audio compression algorithm, which uses LPC)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes it does.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For decades it was the strongest approach for speech - and by extension singing voice - synthesis.&lt;/li&gt;&#xA;&lt;li&gt;As for musical applications, in the framework of subtractive synthesis, filters or resonator banks (Moog 914) were used to model the coloration brought by the body of an instrument, or to create vocal sounds.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Vocoder&quot; rel=&quot;nofollow&quot;&gt;vocoder&lt;/a&gt; uses this principle to apply the formants (filters) extracted from a vocal signal onto a synthetic excitation signal coming from a synth.&lt;/li&gt;&#xA;&lt;li&gt;It is not uncommon to find a filter simulating the body of an instrument as the final step in a physical model (for example a simple &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Digital_Waveguide_Bowed_String.html&quot; rel=&quot;nofollow&quot;&gt;bowed instrument model&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~bilbao/booktop/node14.html&quot; rel=&quot;nofollow&quot;&gt;Modal synthesis&lt;/a&gt; is another sound synthesis technique based on the representation of sound as an excitation shaped through a filter.&lt;/li&gt;&#xA;&lt;li&gt;One could also consider that the virtual amp/speaker modelling techniques used to build today's electric guitar sound are inspired by this approach - the signal coming straight from the guitar being considered as a raw excitation shaped by the footprint of an amp &amp;amp; speaker.&lt;/li&gt;&#xA;&lt;li&gt;Actually, any convolution processor (such as a reverberator) might be seen as an application of this technique - when you sing in a room, your voice is the excitation, the room the resonator.&lt;/li&gt;&#xA;&lt;li&gt;This idea is also relevant to pitch-shifting. When a speaker speaks at a higher or lower pitch, the fundamental is modified, but the formants do not move (ideally...) - so a good pitch-shifting technique should preserve formants. To pitch-shift vocals or musical instruments sounds in a meaningful way, it might be a good idea to pitch-shift only the excitation part of the signal, while keeping the filter representation unchanged. In practice, though, we use techniques that do not explicitly make the actual separation (PSOLA in the time-domain, or spectral envelope manipulations in the frequency-domain when using a phase vocoder).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there other methods which separate excitation from filtering?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Cepstral analysis. In some situations, adaptive filtering.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-04-11T22:47:03.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15582" PostTypeId="2" ParentId="15580" CreationDate="2014-04-11T22:49:54.687" Score="0" Body="&lt;p&gt;Basically it depends on the application. For example in the automatic speech recognition (ASR) the first step would be to extract some &quot;meaningful&quot; features from the raw speech. In the ASR one is interested in features that are as speaker invariant as possible, because the only thing that matters is the content of the speech not the speaker himself. To do that you have to get rid of everything that is speaker dependent, like pitch frequency. You might be interested in this &lt;a href=&quot;http://www.advsolned.com/example_speech_coding.html&quot; rel=&quot;nofollow&quot;&gt;Speech Analysis - Linear Predictive Coding (LPC) vs. The Cepstrum&lt;/a&gt;. The &quot;Liftering&quot; concept is used to separate the excitation from filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are really interested in state-of-the-art feature extraction you can look at the Mel-frequency cepstral coefficients (MFCCs). There are lots of open-source feature extraction softwares out there like HTK toolkit and KALDI.&lt;/p&gt;&#xA;" OwnerUserId="8554" LastActivityDate="2014-04-11T22:49:54.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15583" PostTypeId="2" ParentId="15574" CreationDate="2014-04-11T23:01:22.067" Score="0" Body="&lt;p&gt;Consider a wavelet to be 1 bin of a windowed DFT or FT.  Scale is roughly proportional to how many cycles of a sine wave is inside the bulk of the wavelet window.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hold the frequency constant and make the wavelet  twice as long, and you have to move a wavelet twice as far before some event goes from centered in the wavelet to outside the bulk of the window.  Thus time resolution decreases with window width.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sinusoid the same frequency as a wavelet correlates well.  Change the frequency such that the number of periods of sine wave inside the window bulk differs by one period per window bulk width, and that sinusoid become roughly orthogonal, or correlates poorly.  Increase the window width, and the frequency change required to make the number of periods of the same frequency within that wider window differ by one period become smaller.  Thus frequency resolution increases with window width.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-11T23:06:53.217" LastActivityDate="2014-04-11T23:06:53.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15585" PostTypeId="1" CreationDate="2014-04-12T04:33:10.707" Score="2" ViewCount="552" Body="&lt;p&gt;So I just read something that two signals are aliasing to each other. I know what a single signal is being aliased - that is when sampling rate is not higher than or equal to the Nyquist rate. But I am just confused of what two signals aliasing to each other mean. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that each signal only carries single frequency. Let $f_s$ be sampling frequency and $f_1$ be the first signal and $f_2$. $f_s$ is assumed to be lower than Nyquist rate for both signals. In such case, in what condition of $f_1$ and $f_2$ would aliasing occur, given $f_s$? &lt;/p&gt;&#xA;" OwnerUserId="8555" LastActivityDate="2014-05-12T15:40:17.293" Title="What does &quot;two signals aliasing to each other&quot; mean?" Tags="|sampling|aliasing|nyquist|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15587" PostTypeId="1" AcceptedAnswerId="15592" CreationDate="2014-04-12T09:57:56.603" Score="0" ViewCount="348" Body="&lt;p&gt;let us consider following code  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [sca_1,sca_2,sca_3,sca_4]=calc_wavelet(y,wname,scales,freq,fs)&#xA;%y-input signal&#xA;%wname-wavelet basis name&#xA;%freq-test frequencies&#xA;%fs-sampling rate&#xA;TAB_Sca2Frq = scal2frq(scales,wname,1/fs);&#xA;[~,idxSca_1] = min(abs(TAB_Sca2Frq-freq(1)));&#xA;sca_1 = scales(idxSca_1);&#xA;[mini,idxSca_2] = min(abs(TAB_Sca2Frq-freq(2)));&#xA;sca_2 = scales(idxSca_2);&#xA;[~,idxSca_3] = min(abs(TAB_Sca2Frq-freq(3)));&#xA;sca_3 = scales(idxSca_3);&#xA;[mini,idxSca_4] = min(abs(TAB_Sca2Frq-freq(4)));&#xA;sca_4 = scales(idxSca_4);&#xA;coefs = cwt(y,scales,wname);&#xA;clf; wscalogram('image',coefs,'scales',scales,'ydata',y);&#xA;hold on&#xA;plot([1 size(coefs,2)],[sca_1 sca_1],'Color','m','LineWidth',2);&#xA;plot([1 size(coefs,2)],[sca_2 sca_2],'Color','m','LineWidth',2);&#xA;plot([1 size(coefs,2)],[sca_3 sca_3],'Color','m','LineWidth',2);&#xA;plot([1 size(coefs,2)],[sca_4 sca_4],'Color','m','LineWidth',2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i have  took following data&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; wname = 'morl';&#xA;scales = 1:1:128;&#xA;&amp;gt;&amp;gt; fs=100;&#xA;&amp;gt;&amp;gt; freq=[13.7   10.5    29.9    31&#xA;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when i run following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[scal_1,scal_2,scal_3,scal_4]=calc_wavelet(B,wname,scales,freq,fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;got result :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lQLsd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one  frequency is lost,i have tried  also following  basis&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; wname = 'mexh';&#xA;&amp;gt;&amp;gt; wname = 'morl';&#xA;&amp;gt;&amp;gt; wname = 'haar';&#xA;&amp;gt;&amp;gt; wname = 'gaus4';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;please  pay attention that  my model is following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/15559/understanding-1d-wavelet-analysis&quot;&gt;https://dsp.stackexchange.com/questions/15559/understanding-1d-wavelet-analysis&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so which wavelet basis should i choose for  good spectral  resolution?i want to use wavelet for ability to distinguish signals which are closed  spaced to each other,like in my case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;freq=[13.7   10.5    29.9    31];&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it could be  even more closed to each other&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2014-04-12T20:43:18.193" Title="use wavelet for improving spectral resolution" Tags="|matlab|wavelet|superresolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15588" PostTypeId="2" ParentId="8001" CreationDate="2014-04-12T10:46:15.273" Score="-1" Body="&lt;p&gt;When a system is unstable, the output of the system may be infinite even though the input to the system was finite. This cause a number of practical problems. For instance, a robot arm controller that is unstable may cause the robot to move dangerously. Also, systems that are unstable often incur a certain amount of physical damage, which can become costly. Nonetheless, many systems are inherently unstable - a fighter jet, for instance, or a rocket at liftoff, are examples of naturally unstable systems. Although we can design controllers that stabilize the system, it is first important to understand what stability is, how it is determined, and why it matters.&lt;/p&gt;&#xA;" OwnerUserId="8556" LastActivityDate="2014-04-12T10:46:15.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15589" PostTypeId="2" ParentId="15585" CreationDate="2014-04-12T14:52:36.943" Score="2" Body="&lt;p&gt;Aliasing would occur if $f_2 = f_1 + kf_s$, where $k$ is an integer. Consider the following example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_1(t) = \cos(j2\pi f_1 t + \phi_1) \\&#xA;x_2(t) = \cos(j2\pi f_2 t + \phi_2)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ideal sampler samples the above at a sample rate of $f_s$ to yield discrete-time signals $x_1[n]$ and $x_2[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_1[n] = \cos\left(2\pi f_1 \frac{n}{f_s} + \phi_1\right) \\&#xA;x_2[n] = \cos\left(2\pi f_2 \frac{n}{f_s} + \phi_2\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We got the above by noting that the sampler takes samples at times $\left[0, \frac{1}{f_s}, \frac{2}{f_s}, \ldots\right]$. To see the aliasing effect, substitute back in the relationship between $f_1$ and $f_2$ that we started with:.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_2[n] = \cos\left(2\pi (f_1 + kf_s) \frac{n}{f_s}+ \phi_2\right) \\&#xA;x_2[n] = \cos\left(2\pi f_1 \frac{n}{f_s} + 2\pi kf_s \frac{n}{f_s}+ \phi_2\right) \\&#xA;x_2[n] = \cos\left(2\pi f_1 \frac{n}{f_s} + 2\pi kn + \phi_2\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we recall a property of sinusoids:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\cos(x + 2\pi m) = \cos(x)\ \forall m \in \mathbb{Z}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, if we add any integer multiple of $2\pi$ in the argument of a sinusoid, we get the same value out of the function (stated differently, sinusoids are $2\pi$ periodic). That means that we can drop the $2\pi kn$ out of the above expression for $x_2[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_2[n] = \cos\left(2\pi f_1 \frac{n}{f_s} + \phi_2\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now compare the two discrete-time signals again:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_1[n] = \cos\left(2\pi f_1 \frac{n}{f_s} + \phi_1\right) \\&#xA;x_2[n] = \cos\left(2\pi f_1 \frac{n}{f_s} + \phi_2\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we look at the sampled versions of $x_1(t)$ and $x_2(t)$, they appear to be sinusoids at the exact same frequency. In the discrete-time domain, since one or both of them were not sampled at at least the Nyquist rate, and the two frequencies have the relationship that was stated above, we are unable to discriminate between the two frequency components. This is what is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;aliasing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-04-12T14:52:36.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15591" PostTypeId="2" ParentId="15574" CreationDate="2014-04-12T20:40:45.967" Score="2" Body="&lt;p&gt;Consider shifted and scaled versions of a mother wavelet $\psi(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\psi_{a,b}(t)=\frac{1}{\sqrt{a}}\psi\left(\frac{t-b}{a}\right),\quad a&amp;gt;0,\;b\in\mathbb{R}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the definition of the Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Psi(\omega)=\int_{-\infty}^{\infty}\psi(t)e^{-i\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it can be shown that the Fourier transform of $\psi_{a,b}(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Psi_{a,b}(\omega)=\sqrt{a}e^{-ib\omega}\Psi(a\omega)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the scaling factor $a$ appears in the denominator of the argument of $\psi_{a,b}(t)$ and in the &quot;numerator&quot; of the argument of $\Psi_{a,b}(\omega)$. This implies that stretching in the time domain ($a&amp;gt;1$) implies compression in the frequency domain and vice versa. Consequently, if $\Delta t$ and $\Delta f$ denote the &quot;spread&quot; of $\psi(t)$ in time and frequency, it follows from (1) and (2) that the corresponding spreads of $\psi_{a,b}(t)$ - call them $\Delta t_{a}$ and $\Delta f_{a}$ - are given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta t_a=a\Delta t\quad\textrm{and}\quad\Delta f_{a}=\frac{\Delta f}{a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the definition of $\Delta t$ and $\Delta f$, there is not way to &quot;prove&quot; the results that you stated. It is just a matter of defining the spread of a function. Since $|\psi(t)|$ is a Gaussian with standard deviation $\sigma=\sqrt{f_b/2}$ it seems natural to define $\Delta t$ as being proportional to the standard deviation, but there is no &quot;correct&quot; way to choose the proportionality constant. Once $\Delta t$ has been defined, the corresponding definition of $\Delta f$ can be obtained from the uncertainty principle.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-12T20:40:45.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15592" PostTypeId="2" ParentId="15587" CreationDate="2014-04-12T20:43:18.193" Score="0" Body="&lt;p&gt;The window shape chosen for your wavelet basis will generally only have a slight effect on frequency resolution.  To increase frequency resolution more, increase a scale factor that is related or proportional to the window length for a given frequency.  This will also decrease temporal resolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-12T20:43:18.193" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15593" PostTypeId="2" ParentId="15563" CreationDate="2014-04-12T20:53:57.527" Score="0" Body="&lt;p&gt;Convolution with the transform of a Von Hann window generates a less noisy looking FFT spectrum result than does convolution with a rectangular window.  One reason that this is so is because the Von Hann window attenuates the left and right sides of the data window so that there isn't a big difference between these two ends.  This makes the signal easier to represent with lower frequency basis vectors that are close to the same value at the two ends of the window, as are periodic-in-window sinusoids.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-12T20:53:57.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15594" PostTypeId="1" AcceptedAnswerId="15595" CreationDate="2014-04-13T03:16:09.373" Score="1" ViewCount="2565" Body="&lt;p&gt;&lt;em&gt;Thanks a lot to whoever downvoted my question for no good reason.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote an implementation of the Goertzel algorithm in JavaScript and made a demo that detects DTMF dial-tones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the code here:&#xA;&lt;a href=&quot;http://github.com/ravenstine/goertzeljs&quot; rel=&quot;nofollow&quot;&gt;http://github.com/ravenstine/goertzeljs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The demo is below, and you can try it out if you have a web browser that supports WebRTC(newer versions of Chrome and Firefox do).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://goertzel.herokuapp.com&quot; rel=&quot;nofollow&quot;&gt;http://goertzel.herokuapp.com&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an issue where I need help:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I need a way to effectively filter out background noise.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There wasn't much information that I could find on the subject that didn't already assume that I knew a lot about DSP.  I heard about using a window function and while I could find some algorithms, implementing them didn't seem to make any significant difference(Goertzel.js uses Exact Blackman).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, I came up with my own filter where if an energy peak is not distinct enough from the energies of other frequencies, the information from that sample isn't used.  This was actually tremendously effective when using a buffer size of 2048.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I want my DTMF detector to be as close to meeting ITU specifications as possible; the minimum duration of a DTMF tone to be detected is specified by ITU as 40ms, but my detector doesn't consistently detect tones unless they are around 110ms.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To deal with this, I want to make the buffer size even smaller, but if I do this then my method of removing noise becomes unmanageable(meaning it seems to either discriminate too-little or too-much).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, my detector works pretty well but background noise occasionally creates erroneous detections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are some other methods that I can implement to filter out noise with my DTMF detector?  Also, am I correctly employing the window function?&lt;/strong&gt;  &lt;/p&gt;&#xA;" OwnerUserId="8562" LastEditorUserId="8562" LastEditDate="2014-04-17T20:46:28.110" LastActivityDate="2015-06-26T18:39:03.153" Title="How can I reduce noise errors when detecting DTMF with the Goertzel algorithm?" Tags="|audio|frequency|noise|dft|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15595" PostTypeId="2" ParentId="15594" CreationDate="2014-04-13T03:35:29.477" Score="4" Body="&lt;p&gt;One technique to reject noise is to use the ratio of the Goertzel filter output power to the total signal power over the same 40 mS sliding time windows, as well as ratio of the absolute Goertzel power to some threshold, as part of your decision criteria.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can adjust your buffer size to match this minimum DTMF signal time (2048 may be too long if the sample rate is well below 44.1kHz).  Using a non-rectangular window may require using a longer Goertzel filter than 40 mS.  Adjusting the Goertzel filter length to be close to an integer number of periods of the filter's center frequency will also help reject DC.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added:&#xA;Using a sliding Goertzel (and sliding RMS power) will reduce the effects of framing.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-06-26T18:39:03.153" LastActivityDate="2015-06-26T18:39:03.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15597" PostTypeId="1" AcceptedAnswerId="15717" CreationDate="2014-04-13T05:27:07.750" Score="0" ViewCount="153" Body="&lt;p&gt;I'm sampling two signals with fundamental frequency of 50 Hz. I want to sample them at the same instant, but there's a delay between the first and the second conversion. I don't keep the previous values of the signals in an array, at most I can store 10/20 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to correct this delay. I thought of a FIR fractional delay, but i'm not sure is the right way to do it.&lt;/p&gt;&#xA;" OwnerUserId="8565" LastActivityDate="2014-04-17T17:26:19.223" Title="correcting delay between two samples" Tags="|sampling|delay|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15599" PostTypeId="1" CreationDate="2014-04-13T11:57:15.177" Score="0" ViewCount="330" Body="&lt;p&gt;What is the bandwidth required to transmit baseband modulated signals like an antipodal and orthogonal signals?&lt;/p&gt;&#xA;" OwnerUserId="8392" LastEditorUserId="8392" LastEditDate="2014-04-13T12:03:05.733" LastActivityDate="2014-04-13T12:03:05.733" Title="Bandwidth required for orthogonal and antipodal signals" Tags="|signal-analysis|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15600" PostTypeId="1" CreationDate="2014-04-13T14:56:33.697" Score="1" ViewCount="1271" Body="&lt;p&gt;I am attempting to use ICA (FastICA via scikit-learn) on EEG signals from seven electrodes per subject for feature extraction and identity classification – that is to extract signal which is related to a specific cortical area without noise and feed it to e.g. MLP for classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I currently understand it, I should be able to get at most seven individual components which I seem to be achieving, but I do not understand how to actually choose the one related to a specific area nor how to verify the results. How do I know I am not extracting noise (they are all very similar)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data have been pre-processed with a Butterworth bandpass filter (4 – 40 Hz). The mean error for classification of six subjects via MLP is currently around 12% but similar studies achieved far better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See for example:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=5223051&amp;amp;queryText=Selecting%20Relevant%20EEG%20Signal%20Locations%20for%20Personal%20Identi%EF%AC%81cation%20using%20ica%20and%20neural%20network&quot; rel=&quot;nofollow&quot;&gt;Selecting Relevant EEG Signal Locations for Personal Identiﬁcation using ica and neural network&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://link.springer.com/chapter/10.1007/978-3-642-12179-1_35&quot; rel=&quot;nofollow&quot;&gt;Personal Identification by EEG Using ICA and Neural Network&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Excuse the lameness with this one, please – the research papers and introductions to ICA I have read are not brilliant at explaining and use examples involving ideal components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Anyone?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8566" LastEditorUserId="-1" LastEditDate="2014-04-22T12:03:37.750" LastActivityDate="2020-11-20T03:09:54.723" Title="Using ICA on EEG signals for feature extraction" Tags="|classification|ica|eeg|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15602" PostTypeId="1" CreationDate="2014-04-13T15:38:15.990" Score="1" ViewCount="293" Body="&lt;p&gt;I understand that compression works by exploiting certain psycho-acoustical characteristics of our auditory perception, but I'm still confused. I mean ultimately, the waveform must be recorded regardless of what has been done to do it, and I was under the impression that all waveforms were born equal? Does removing a band of bits needed to store that information?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused?&lt;/p&gt;&#xA;" OwnerUserId="8571" LastActivityDate="2014-04-14T14:20:32.753" Title="How is data compression possible for audio?" Tags="|audio|compression|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15603" PostTypeId="2" ParentId="15602" CreationDate="2014-04-13T16:04:28.283" Score="2" Body="&lt;p&gt;The waveform doesn't have to be preserved. All waveforms are not born equal in terms of being able to differentiate between them using just human ears and brains as the detection equipment.  Sometimes, completely different looking waveforms will be heard as exactly the same sound.  Only the characteristics of an audio waveform that a &quot;typical&quot; human might perceive is preserved in compressed audio. And often enough, these characteristics are simpler in terms of the bits required to describe them then the raw original waveform.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-13T16:11:02.710" LastActivityDate="2014-04-13T16:11:02.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15604" PostTypeId="2" ParentId="15578" CreationDate="2014-04-13T16:33:45.580" Score="0" Body="&lt;p&gt;Increasing the numerical value of delta X usually means the same thing as decreasing the resolution of X, not increasing the resolution of X.  However delta X is often called &quot;resolution&quot; in spite if this inverse slope relationship.  But you have to be clear in your context about whether you are increasing the numerical value of delta X, or the quality of delta X (its resolution of X), which can have opposite meanings.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-13T17:00:39.870" LastActivityDate="2014-04-13T17:00:39.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15605" PostTypeId="2" ParentId="15602" CreationDate="2014-04-13T17:12:31.543" Score="2" Body="&lt;p&gt;there are at least two different meanings of &quot;compressed audio&quot;, one is, as your title mentions, compression of data and the other is level compression.  they're two totally different functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;about compression of audio data, there are two general classes: lossless compression and lossy compression.  in a crude sense of the word, signal quantization is a form of lossy compression, but i would not call word-width reduction the same topic as compression.  so let's assume the audio data has already had its word-width (or &quot;bit depth&quot;) reduced to its production length (say, 16 or 24 bits or whatever).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as the names might suggest, losslessly compressed audio data will have the audio data restored exactly when uncompressed.  the original waveform will be restored.  for lossy compression, when the audio is uncompressed the original waveform is &lt;strong&gt;not&lt;/strong&gt; restored, but the expectation is that the audio will sound the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to do lossless compression of audio, there are two main steps, the first is what is commonly called &quot;Differential Coding&quot;.  &quot;Delta Modulation&quot; is the simplest example, but one can employ Linear Predictive Coding (LPC) to combine the past N samples in such a way as to predict the next incoming sample.  if the prediction is good, the difference between the actual sample and the predicted sample will be small and that reduces the number of values to encode significantly.  say, for 16-bit, instead of having 65536 values to encode, your difference signal might be not much bigger than 128 and you'll need only 8 bits to encode that difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what about the rare times you need more than 8 bits because the difference is greater than 128?  &lt;strong&gt;this&lt;/strong&gt; is where entropy coding or Huffman coding comes in.  this is essentially what file compression programs like pkzip do.  words that appear often are assigned fewer bits than words that appear rarely.  this all comes out of Shannon's Information Theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that's, in a short form, what lossless compression is about.  to learn what lossy compression is about, there is a whole additional science about perception of audio, what audio features can be heard and what are not heard.  it's hard to explain, but there are ways of separating what can be heard from what cannot and for the separated data that is deemed not audible, no bits are allocated to it.  it's a crude explanation.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-04-13T17:12:31.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15606" PostTypeId="2" ParentId="15602" CreationDate="2014-04-13T17:22:11.360" Score="2" Body="&lt;p&gt;Here is my non-technical 2 cents...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually when you are referring to compressing audio, you are referring to audio that humans tend to listen to, like voice or music.  Voice and music are interesting and meaningful to humans because these signals have time correlations or redundancies that allow the human brain to track the signal and even predict where the signal is going.  The simplest way to understand this is to consider a fully uncorrelated audio signal, white noise.  White noise is not compressible in the strict sense because there is no way to predict from past samples of the signal what the next samples will be.  White noise is not particularly interesting to listen to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going back to more interesting signals, if you analyze music and/or voice you will discover that such signals are composed of many segments that over a short term can be modeled as periodic signals.  If you know how to model the source of the sounds, you can predict how to reproduce future signal from past values of the signal.  This ability to predict is what allows compression to take place.  If future signal samples can be predicted from past signal samples, the past signal samples include information that is not necessary to store information about the signal.  A compression algorithm looks for ways to eliminate these information redundancies  (or correlations) in the signal and store only non redundant  information (clearly not in a format that can be understood by the human auditory system).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other side of audio compression is audio reconstruction.  Here you take the non-redundant stored information and use it to reconstruct an audio signal.  Here a model of the audio source may be used as a tool in the reconstruction of the signal or more generally, the algorithm used to encode the signal without redundancy is reversed to insert the redundancy back into the signal.  In the reconstruction of the audio signal, the reconstructed signal can leave out features that are not perceivable by the human auditory system.  This is one area where  psycho-acoustics can be considered.  If features are known not to be unimportant for perception of the message, these features can be left out of the stored signal information.  Psycho-acoustics can further reduce the size of the compressed signal representation, but is not necessary to achieve compression of the original signal.  The only thing that is needed to compress any signal is time correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One caveat here is that some audio signals include white noise as a component of the signal.  White noise can't be compressed based on correlations, however this can be handled in a different way.  One option is to include a code in the compressed signal that indicates where and how much noise exists as a component of the signal.  Such codes are many times more efficient than storing the noise as time samples.  When reconstructing the signal, the noise can be re-generated at the appropriate level and combined with the reconstructed signal.  Some high compression voice coders use a technique like this for sounds such as 's' or 'sh'.  The noise part of the signal can be added back in without difficulty because the human ear isn't capable of distinguishing phase information about white noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The topic that deals with this type of processing directly is information theory.  You may like to read the following lightly technical treatment of the subject:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Symbols Signals and Noise&quot;&#xA;By: J. R. Pierce&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J.R. Pierce was a friend of Claude Shannon the so called father of information theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe this book is public domain and is now freely available as an ebook.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="-1" LastEditDate="2014-04-14T14:20:32.753" LastActivityDate="2014-04-14T14:20:32.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15607" PostTypeId="1" AcceptedAnswerId="15612" CreationDate="2014-04-13T17:40:52.653" Score="15" ViewCount="5941" Body="&lt;p&gt;We know that Heisenberg uncertainty Principle states that&#xA;$$\Delta f \Delta t \geq \frac{1}{4 \pi}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But (in many case for Morlet wavelet) I have seen that they changed the inequality to an equality. Now my question is when are we allowed to change the inequality to an equality:&#xA;$$\Delta f \Delta t = \frac{1}{4 \pi} $$&#xA;&lt;code&gt;why =&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="8580" LastEditDate="2014-04-14T09:05:31.657" LastActivityDate="2014-04-14T09:05:31.657" Title="When can we write Heisenberg uncertainty Principle as a equality?" Tags="|fourier-transform|wavelet|resolution|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15608" PostTypeId="2" ParentId="15607" CreationDate="2014-04-13T18:06:38.063" Score="2" Body="&lt;p&gt;I cannot give you all the theory behind this (as it literally fills books), but it turns out that Heisenberg becomes an exact equality for precisely this family of signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s_{t_0,\omega_0,\sigma,\phi,\gamma}(t) = \exp\left(-\left(\frac{t-t_0}{\sigma}\right)^2 + i \left(\phi + \omega_0 (t-t_0) + \gamma (t-t_0)^2\right)\right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where all parameters are real numbers. This family is generated by quadratic symplectomorphisms in time-frequency from a single Gabor atom. These symplectomorphisms preserve the Heisenberg uncertainty relation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Let me make this more precise and also in fact more correct. The signals I gave above minimise the time-frequency area, but not the time-frequency uncertainty product. If you want minimal $\Delta F \cdot \Delta T$ then $\gamma$ from above must vanish. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notion of time frequency area can however be generalised to measure the area of shapes that are not aligned with the time and frequency axis. That means instead of the uncertainty product between F and T we measure the minimal uncertainty product of any two conjugate variables spanned by F and T. I'll spare you the details, but for this definition of time-frequency area the family of signals gives you the minimum.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-04-13T20:40:52.613" LastActivityDate="2014-04-13T20:40:52.613" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15609" PostTypeId="1" CreationDate="2014-04-13T18:14:22.410" Score="0" ViewCount="201" Body="&lt;p&gt;I am totally new to image recognition and image analysis and have a project concerning detecting a smooth curve on a uniform background (white/black/any color) and then be able to follow this curve until its end. The curve may cross itself but the path that should be recognized should follow along the &quot;smoothness&quot; of the curve. Also, I want to be able to recognize and extract positions (x:s and y:s) of where the curve might turn.  &lt;br/&gt;&#xA;Since I am new to the area, which seem to be large enough to just become confused, I´m not sure of were to begin reading so any literature or tutorials or whatever is highly appreciated. What I need is some kind of starting point (of course, if anyone know if it is already done somewhere that even better!), what libraries or software to use. Anything is helpful!&lt;/p&gt;&#xA;" OwnerUserId="8570" LastActivityDate="2014-04-13T18:14:22.410" Title="Optimal way for curve detection" Tags="|image-processing|edge-detection|shape-analysis|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15610" PostTypeId="2" ParentId="15607" CreationDate="2014-04-13T18:20:57.440" Score="1" Body="&lt;p&gt;The uncertainty principle sets up a theoretical bound for resolution, so it is never written as an equality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equality relationships you are encountering are for for a specific analysis context and analysis implementation.  In this case the context is signal analysis so time/frequency are the conjugate variables of interest, and the implementation is the specific wavelet in use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equality relationship provides a way of comparing resolutions across different analysis implementations.  Care must be taken when interpreting these relationships because the definition of resolution shouldn't, but may vary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An equality relationship is appropriate once you have defined two things:&#xA;1) the mathematical meaning of resolution.&#xA;2) the method of analysis (in this case, choice of wavelet).&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2014-04-13T18:20:57.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15611" PostTypeId="1" AcceptedAnswerId="15614" CreationDate="2014-04-13T18:49:03.540" Score="1" ViewCount="2062" Body="&lt;p&gt;I have some code here that I don't quite understand.&#xA;It calculates the energy for a given frame the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;En=log(1+energy(32767*frame))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The energy function is defined as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;energy = sum(s.*s)/max(size(s))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where 's' is te given frame. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is why the frame needs to be multiplied by 32767, which is the max value for unsigned int 16. I couldn't find the theory behind this. Does anyone of you know why this multiplication is taking place? Does it have to do anything with the log calculation?max value for unsigned int 16. I couldn't find the theory behind this. Does anyone of you know why this multiplication is taking place? Does it have to do anything with the log calculation?&lt;/p&gt;&#xA;" OwnerUserId="8573" LastActivityDate="2014-04-13T19:18:06.357" Title="Log energy calculation" Tags="|matlab|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15612" PostTypeId="2" ParentId="15607" CreationDate="2014-04-13T18:57:34.893" Score="7" Body="&lt;p&gt;It is important to define the time and frequency widths $\Delta_t$ and $\Delta_{\omega}$ of a signal before discussing any special forms of the uncertainty principle. There is no unique definition of these quantities. With appropriate definitions it can be shown that only the Gaussian signal satisfies the uncertainty principle with equality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a signal $f(t)$ with Fourier transform $F(\omega)$ satisfying&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}f^2(t)dt=1\quad\textrm{(unit energy)}\\&#xA;\int_{-\infty}^{\infty}t|f(t)|^2dt=0\quad\textrm{(centered around }t=0)\\&#xA;\int_{-\infty}^{\infty}\omega|F(\omega)|^2d\omega=0\quad\textrm{(centered around }\omega=0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;None of these conditions is actually a restriction. They can all be satisfied (for signals with finite energy) by appropriate scaling, translation and modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we now define time and frequency widths as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta_t^2=\int_{-\infty}^{\infty}t^2|f(t)|^2dt\\&#xA;\Delta_{\omega}^2=\int_{-\infty}^{\infty}\omega^2|F(\omega)|^2d\omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the uncertainty principle states that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta_t^2\Delta_{\omega}^2\ge\frac{\pi}{2}\tag{2.6.2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(if $f(t)$ vanishes faster than $1/\sqrt{t}$ for $t\rightarrow\pm\infty$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the inequality is satisfied with equality for the Gaussian signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\sqrt{\frac{\alpha}{\pi}}e^{-\alpha t^2}\tag{2.6.3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation numbers above correspond to the proof below which is from &lt;em&gt;Wavelets and Subband Coding&lt;/em&gt; by Vetterli and Kovacevic (p.80):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RhqY4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-13T18:57:34.893" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15614" PostTypeId="2" ParentId="15611" CreationDate="2014-04-13T19:18:06.357" Score="1" Body="&lt;p&gt;First of all, the amplitude of a signal is expressed in arbitrary units, so there is no &quot;right&quot; answer. It's unlikely you'll be able to compute an absolute acoustic energy value - this depends on the gains of the recording chain, and the characteristics of the transducers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some audio analysis/feature extraction software consider that the full scale of the input audio signal is [-32768, 32767] (due to the predominance of the 16-bit format), some other implementation expect their input to be in the [-1.0, 1.0] range. Matlab's &lt;strong&gt;wavread&lt;/strong&gt; function can return both formats when reading data, with the 'double' or 'native' argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect the multiplication by 32767 in your code is simply there to keep the output consistent with a reference implementation of the algorithm which expected data to be in the [-32768, 32767] range, or maybe to keep the results consistent with a previous version of the software that used an input signal with the 'native' instead of 'double' scale.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-04-13T19:18:06.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15615" PostTypeId="1" AcceptedAnswerId="15618" CreationDate="2014-04-13T22:25:37.547" Score="1" ViewCount="4883" Body="&lt;p&gt;I am reading a paper in which they filter EEG signal using a notch filter to remove the power supply component of 50 Hz, then a high pass filter at 0.3 Hz to remove artifacts resulting from breathing, and finally a low pass filter with a cut-off frequency of 40 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any difference to simply using a band pass filter of 0.3 – 40 Hz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, why the notch at 50 Hz when everything 40+ Hz is thrown away, anyway?&lt;/p&gt;&#xA;" OwnerUserId="8566" LastActivityDate="2014-04-14T07:11:54.667" Title="Difference between band pass vs. low pass + high pass?" Tags="|filters|continuous-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15616" PostTypeId="1" CreationDate="2014-04-13T23:10:55.410" Score="4" ViewCount="12312" Body="&lt;p&gt;I know that similar questions have already been asked – I have read the answers, yet I am still not sure if I understand the topic properly at some points. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use FFT to calculate PSD estimate. FFT gives me a set of complex numbers that I want to transform into the PSD values. I am aware of the fact that only the first $N/2 + 1$ values are useful, and that the other half are complex conjugates of the first half. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I know that I will need to take the magnitude squared of each (useful) complex number the FFT gave me in order to find the PSD values. I also found out that I should incorporate some scaling/normalizing of the result. It is at this point that I am unsure. In some of the replies to similar questions it is said that the magnitude squared should be multiplied by $1/N$ only, while in others it is said that it should be multiplied by $1 / \left(N\cdot F_s\right)$.  I have not been able to figure out which of these two should be used when. Can anyone explain?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The sampling frequency of my signal is $128\textrm{ Hz}$. The length of the signal to be transformed is $256$ samples. In this case I found out that the distance between the resultant values of the FFT (or PSD values) should be $128/256 = 0.5\textrm{ Hz}$. Is that correct? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The original signal is in $\mu V$. In what values will the result of the PSD be? Is it $\mu V^2$ or $\mu V^2 /\textrm{ Hz}$? &#xA;(There might be a connection here with what I am asking in 1), am I right?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8574" LastEditorUserId="1629" LastEditDate="2016-06-01T12:18:05.927" LastActivityDate="2016-06-01T12:18:05.927" Title="PSD estimate using FFT - scaling and units" Tags="|fft|frequency-spectrum|power-spectral-density|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15617" PostTypeId="1" CreationDate="2014-04-13T23:57:36.207" Score="1" ViewCount="180" Body="&lt;p&gt;The problem is &lt;a href=&quot;http://i.gyazo.com/5e14f0b8266e74eb8850fa831b5e035e.png&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Now I know the definition of mixed/max/min phase wavelets, whether the roots lie within the unit circle or not. Starting from n = 1, let&#xA;$$ x_t = ( 5, 6) $$ &#xA;$$ X(z) = 5 + 6z $$&#xA;This would have root -5/6, making it a max phase wavelet (since it's within unit circle). If we switch 5 and 6 around in xt, we would get root -6/5, which would make it a min phase wavelet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how I would show they have same amplitude spectrum. I know |X(f)| amplitude spectrum would lie between -fc and fc (Nyquist frequency) and fc = 1/2*delta t. Not sure how I would go about proving it. &lt;/p&gt;&#xA;" OwnerUserId="8576" LastActivityDate="2014-08-12T10:56:20.347" Title="Amplitude Spectrum, Nyquist Frequency, mixed/min/max wavelets" Tags="|filters|discrete-signals|frequency-spectrum|signal-analysis|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15618" PostTypeId="2" ParentId="15615" CreationDate="2014-04-14T00:48:19.043" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any difference to simply using a band pass filter of 0.3 – 40&#xA;  Hz?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No - but some filter design tools might not provide an option to design a band-pass filter with a unity gain &quot;plateau&quot; over a range of frequencies (instead, the response of the band-pass filter will be a bump at a given frequency).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;why the notch at 50 Hz when everything 40+ Hz is thrown away, anyway?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;50 Hz is dangerously close to 40 Hz, and might still be in the transition band of the filter. The 40 Hz filter would have to be very steep to entirely attenuate the 50 Hz. It would be much easier to remove the 50 Hz component separately with a steep notch filter.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-04-14T00:48:19.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15619" PostTypeId="2" ParentId="15615" CreationDate="2014-04-14T07:11:54.667" Score="2" Body="&lt;p&gt;You are right that this is a sub-optimal approach. I agree with pichenettes answer that it is mainly a question of having a sufficiently flexible filter design tool. With such a tool, even the notch at 50Hz can be incorporated into one single design specification with the advantage that the overall filter probably performs better for a given filter complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a linear-phase FIR filter is used, then all design specifications (lower band-edge, upper band-edge, notch frequency, etc. ) can be formulated as a linear programming problem. &lt;a href=&quot;https://www.cs.princeton.edu/~ken/meteor_article.pdf&quot; rel=&quot;nofollow&quot;&gt;This paper&lt;/a&gt; is an example of such a method based on linear programming.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-14T07:11:54.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15620" PostTypeId="1" CreationDate="2014-04-14T07:35:01.800" Score="1" ViewCount="427" Body="&lt;p&gt;I'd like to sample band-limited Gaussian white noise non-uniformly. One way to approximate this would be to filter Gaussian white noise with a lower cutoff frequency and non-uniformly pick samples from this. However this approach would limit me to a fixed number of time-offsets and require many samples of noise to achieve sufficient resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any better way to do it?&lt;/p&gt;&#xA;" OwnerUserId="8578" LastActivityDate="2017-05-02T13:22:20.187" Title="Nonuniform sampling band-limited gaussian white noise" Tags="|sampling|gaussian|nonuniform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15621" PostTypeId="1" AcceptedAnswerId="15627" CreationDate="2014-04-14T08:26:52.770" Score="1" ViewCount="1493" Body="&lt;p&gt;I'm having an assignment of computing narrowband spectrograms using MATLAB.&#xA;And I totally have no idea about the code.&#xA;Can someone help me writing the code and explaining what's going on to me.&#xA;Lots of thanks!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Followings are the requirement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B.1. Load the recorded .wav file using the function “wavread”. Let y be the variable&#xA;storing the signal;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B.2. Perform short-time Fourier transform on y as follows:&#xA;(i) Divide the signal into many short-time frames. Each frame is 50 msec long. Frame&#xA;shift is 1 msec;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(ii) Apply 1024-point FFT on each frame;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(iii) Store the power spectrum of each frame in a column vector (note that only the first&#xA;512 FFT coefficients are needed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(iv) Append the power spectrum vectors of all frames to form super matrix S. The size&#xA;of the matrix will be 512 × no. of frames;&#xA;(v) Plot the spectrogram using the following MATLAB commands&lt;/p&gt;&#xA;" OwnerUserId="8581" LastActivityDate="2014-04-14T16:44:10.557" Title="Computing narrowband spectrograms using MATLAB" Tags="|stft|transform|fourier|" AnswerCount="1" CommentCount="0" ClosedDate="2014-04-14T19:49:36.727" ContentLicense="CC BY-SA 3.0" />
  <row Id="15622" PostTypeId="2" ParentId="15617" CreationDate="2014-04-14T08:53:14.860" Score="1" Body="&lt;p&gt;Note that moving between minimum phase, maximum phase, and mixed phase involves basically two operation in the time domain:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;shifting&lt;/li&gt;&#xA;&lt;li&gt;time-reversal&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If $X(e^{j\omega})$ is the Fourier transform of the sequence $x(n)$ then the transforms of the shifted and the time-reversed sequences are given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n-k)\Longleftrightarrow e^{-jk\omega}X(e^{j\omega})\\&#xA;x(-n)\Longleftrightarrow X(e^{-j\omega})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $|e^{-jk\omega}|=1$, the magnitudes of the spectra of $x(n)$ and $x(n-k)$ are identical. Furthermore, if $x(n)$ is real-valued then $X(e^{-j\omega})=X^*(e^{j\omega})$ and consequently the spectra of $x(n)$ and $x(-n)$ also have the same magnitudes.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-14T08:53:14.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15623" PostTypeId="1" AcceptedAnswerId="15633" CreationDate="2014-04-14T10:02:58.000" Score="0" ViewCount="337" Body="&lt;p&gt;I have a homework problem that I'm not quite sure how to complete.  The problem is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PROBLEM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Write the definition of the Fourier coefficients, and show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t + \frac{1}{2}T) = f(t) \rightarrow c_{2n+1} = 0$$&#xA;$$f(t + \frac{1}{2}T) = -f(t) \rightarrow c_{2n} = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also show that this is a consequence of the similarity theorem in the Fourier analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ANSWER&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been able to solve the first part.  The definition of Fourier coefficients is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n = \frac{1}{T} \int_{0}^{T} f(t) \exp(-2 \pi i n t/T) dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let $f(t) = f(t + \frac{1}{2}T)$.  If we plug this in we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n = \frac{1}{T} \int_{0}^{T} f(t + \frac{1}{2}T) \exp(-2 \pi i n (t + \frac{1}{2}T)/T)dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = \frac{1}{T} \int_{0}^{T} f(t + \frac{1}{2}T) \exp(-2 \pi i n t/T) \exp(- \pi i n) dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this last expression we se that when $n$ is even, $\exp(- \pi i n)$ is $1$, and when $n$ is odd, $\exp(- \pi i n)$ is $-1$.  Thus we see that if we want $f(t + \frac{1}{2}T) = f(t)$ we must have all odd Fourier coefficients equal to $0$, and if we want $f(t + \frac{1}{2}T) = -f(t)$ then all even Fourier coefficients must be equal to $0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know quite how to approach the last question though - how to show that this is a consequence of the similarity theorem.  Of course, the definition for  the similarity theorem is that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t/ \gamma) \leftrightarrow |\gamma| F(\gamma \omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and a property is that if we &quot;stretch&quot; the function in the time domain, then we &quot;shrink&quot; it in the time domain, and vice versa.  But how this apply to the problem above?  My intuition tells me that since every second Fourier coefficient is set equal to $0$ we are &quot;stretching&quot; the function in the frequency domain, but I don't know how to show that we then get a &quot;shrinking&quot; in the time domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can give me some help in how to attack this last part of the problem, then I would be extremely grateful!&lt;/p&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2014-04-14T13:32:33.763" Title="Similarity theorem in Fourier analysis" Tags="|frequency-domain|fourier-series|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15624" PostTypeId="1" AcceptedAnswerId="15626" CreationDate="2014-04-14T10:27:50.437" Score="0" ViewCount="313" Body="&lt;p&gt;i'm trying to get an FFT of a signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my FFT has 1024 samples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i added two sin functions one of freq 86,13Hz (2*44100/1024) and one of freq 129,19Hz (3*44100/1024)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the WAV looks like that (for 1 period) : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zve74.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i then use this code to inspect the FFT&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFTSize = 1024;&#xA;&#xA;Y = wavread('2sins.wav');&#xA;&#xA;current_window = zeros(FFTSize, 1);&#xA;&#xA;for k = 1:length(Y)/(FFTSize)&#xA;&#xA;   for m = 1:FFTSize&#xA;       current_window(m, 1) = Y((k-1)*(FFTSize)+m, 1);&#xA;   end;&#xA;&#xA;   plot(current_window)&#xA;&#xA;   a = abs(Ydft);&#xA;   p = angle(Ydft);&#xA;&#xA;  end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the bins 2 and 3 have the maximum amplitude of 256 which is right as i used two sin of frequency 2 and 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9NJqi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when i look at the phases they are -pi/2 which is weird as they should be 0 no ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here are the phases :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o2Ijr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so you see they are -pi/2, why is that ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and here is the WAV file i used so you can try yourself:&#xA;&lt;a href=&quot;http://www.khaelis.com/tmp/2sins.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.khaelis.com/tmp/2sins.zip&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks for help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;" OwnerUserId="8366" LastActivityDate="2014-04-14T10:47:25.510" Title="matlab's FFT is wrong? don't think so" Tags="|matlab|fft|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15625" PostTypeId="1" AcceptedAnswerId="15628" CreationDate="2014-04-14T10:40:36.800" Score="0" ViewCount="11169" Body="&lt;p&gt;I'm trying to plot fft in python. I use pyalsaaudio for capturing audio in PCM (S16_LE) format. I use the ion() and draw() functions in matplotlib to have the fft plotted in real time. This is the program I wrote : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import alsaaudio as alsa&#xA;import numpy as np   &#xA;from matplotlib import pyplot as plot&#xA;from matplotlib import animation&#xA;import time&#xA;&#xA;#Configuration&#xA;&#xA;card = 'default'&#xA;audio = alsa.PCM(alsa.PCM_CAPTURE,alsa.PCM_NONBLOCK, card)&#xA;&#xA;def configure():&#xA;    plot.ion()&#xA;    audio.setchannels(1)&#xA;    audio.setrate(44100)&#xA;    audio.setformat(alsa.PCM_FORMAT_S16_LE)&#xA;    audio.setperiodsize(1000)&#xA;&#xA;def run():&#xA;    loops = 100000&#xA;    plot.show()&#xA;    while loops &amp;gt; 0 :&#xA;            loops-=1&#xA;            length,data = audio.read()&#xA;&#xA;            if length:&#xA;                #converting into a float array&#xA;                npdata = np.fromstring(data,dtype='&amp;lt;i2')&#xA;                #Obtaining FFT&#xA;                freq_list = np.fft.fft(npdata)&#xA;                plot.plot(freq_list)&#xA;                plot.draw()&#xA;                plot.clf()&#xA;&#xA;    plot.close()&#xA;&#xA;&#xA;configure()&#xA;run()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;1) The entire plot is jumpy. The y axis limits range from -5 t 5 to several tens of thousands. Since the range of y axis keeps changing, so does the location of the plot. How can I fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The x axis range is the argument to audio.setperiodsize(). In this case, it is 1000. From the pyalsaaudio documentation, &quot;When the hardware processes data this is done in chunks of frames. The time interval between each processing (A/D or D/A conversion) is known as the period&quot;. Hence period is something to do with the time domain. It should have no relevance in the plot since fft is in the frequency domain. So why does the x axis of my plot end at the period size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) I believe that the fft function returns a set of complex numbers. What do they mean? The real part signifies the frequency and the imaginary part the amplitude? When I call matplotlib.plot() on the set of fft values, what is being plotted actually?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) My objective is to determine the dominant frequency of a signal. To do this, I need to know the frequency and the amplitude of the component with that particular frequency. Can I get this from the fft plot?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for looking into this.&lt;/p&gt;&#xA;" OwnerUserId="5116" LastActivityDate="2014-04-14T11:00:04.153" Title="Plot real-time FFT using matplotlib" Tags="|fft|python|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15626" PostTypeId="2" ParentId="15624" CreationDate="2014-04-14T10:47:25.510" Score="2" Body="&lt;p&gt;Matlab is right, as usually. The DFT of a sine is imaginary. If you do the same with the sum of two cosines, you would get a real-valued result.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-14T10:47:25.510" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15627" PostTypeId="2" ParentId="15621" CreationDate="2014-04-14T10:48:04.433" Score="1" Body="&lt;p&gt;No one is going to give you a full working code - the point is that you should &lt;strong&gt;learn&lt;/strong&gt; and &lt;strong&gt;understand&lt;/strong&gt; how to do it. Following guidelines for you:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;As given, use the &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/wavread.html&quot; rel=&quot;nofollow&quot;&gt;wavread&lt;/a&gt; function to load the recording (please mind that in the newest 2014a version this function is deprecated, you should use &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/audioread.html&quot; rel=&quot;nofollow&quot;&gt;audioread&lt;/a&gt; instead). MATLAB has wonderful help with very good examples, so simply use it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Having your signal loaded, together with its sampling frequency, you need to split it into chunks (&lt;em&gt;many short-time frames&lt;/em&gt;). This can be done in two ways, either you are using a loop construct (for, while - whichever you prefer), or (my favourite) use the MATLAB &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ref/buffer.html&quot; rel=&quot;nofollow&quot;&gt;buffer&lt;/a&gt; function (please consider using &lt;code&gt;'nodelay'&lt;/code&gt; option in it, as first frame will have zeros in it up to overlap length). Although you require the Signal Processing Toolbox license (I'm sure your University has it). This function allows you to specify the length of frame, overlapping and other things. In result you will obtain the matrix which columns are your signal frames. Having the sampling frequency from &lt;code&gt;wavread&lt;/code&gt;, it is very easy to calculate corresponding length of your frame in samples for given number of miliseconds&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now you can iterate over the columns of your matrix and calculate the FFT for each of them. You might want to use the &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/fft.html&quot; rel=&quot;nofollow&quot;&gt;fft&lt;/a&gt; function to get it. In extra parameter you can specify the length of your signal (to apply zero padding eventually). So let's say that now you have FFT for first frame. Now take the magnitude of it (&lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/abs.html?searchHighlight=abs&quot; rel=&quot;nofollow&quot;&gt;abs&lt;/a&gt;), and choose first 512 samples. Store this result into fist column of your &lt;em&gt;super matrix&lt;/em&gt; $S$. &lt;strong&gt;Optional step:&lt;/strong&gt; before calculating the FFT, I suggest you to multiply your frame by the window function, i.e. &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ref/hamming.html?searchHighlight=hamming&quot; rel=&quot;nofollow&quot;&gt;hamming&lt;/a&gt; window. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now you have the matrix $S$, so plotting can be done by using various functions (&lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/pcolor.html&quot; rel=&quot;nofollow&quot;&gt;pcolor&lt;/a&gt;, &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/imagesc.html?searchHighlight=imagesc&quot; rel=&quot;nofollow&quot;&gt;imagesc&lt;/a&gt;, and so on - pick whichever you prefer).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I suggest you to compare the final result with MATLAB built-in &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow&quot;&gt;spectrogram&lt;/a&gt; function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-04-14T16:44:10.557" LastActivityDate="2014-04-14T16:44:10.557" CommentCount="29" ContentLicense="CC BY-SA 3.0" />
  <row Id="15628" PostTypeId="2" ParentId="15625" CreationDate="2014-04-14T11:00:04.153" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Since the range of y axis keeps changing, so does the location of the&#xA;  plot. How can I fix this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Use &lt;code&gt;ylim&lt;/code&gt; to set the range of values on the Y axis.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So why does the x axis of my plot end at the period size?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your input vector is of size 1000 ; so the FFT result is a sequence of 1000 complex numbers. Since you don't specify values / units for the x axis of your plot, you just get an arbitrary index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a frequency scale, label your x axis as &lt;code&gt;arange(0.0, length - 1) / length * 44100&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What do they mean? The real part signifies the frequency and the imaginary part the amplitude?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You should really take some time to understand the Fourier transform. The use of &lt;code&gt;freq_list&lt;/code&gt; as a variable name makes me think that you are mistaken as to how the FFT works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complex number in freq_list[i] represents the complex amplitude at frequency &lt;code&gt;i / length * 44100&lt;/code&gt;. The magnitude of a complex amplitude represents actual amplitude, the angle of a complex amplitude represents phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're probably only interested in the (squared) magnitude, and you'll get much nicer plots if you plot it on a logarithmic scale.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My objective is to determine the dominant frequency of a signal. To do this, I need to know the frequency and the amplitude of the component with that particular frequency. Can I get this from the fft plot?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, by looking at the index of the FFT bin with the largest magnitude, but it's a rather terrible method for determining the fundamental frequency of audio signals - it has poor resolution and will provide incorrect results in a variety of common audio signals (for example it is common for speech signals to have lower energy at their fundamental frequency than at one harmonic).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-04-14T11:00:04.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15629" PostTypeId="1" AcceptedAnswerId="15630" CreationDate="2014-04-14T11:14:36.210" Score="0" ViewCount="206" Body="&lt;p&gt;Let $\textbf{h} \in \mathbb{C}^{N\times 1}$, $\textbf{a} \in \mathbb{C}^{N\times 1}$, $\textbf{b} \in \mathbb{C}^{N\times 1}$ and $\textbf{c} \in \mathbb{C}^{N\times 1}$. The variable $h_i$ is defined as $h_i=\left(a_i+b_i\right)c_i$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{a}=[1~2~3~4]^T$, $\textbf{b}=[5~6~7~8]^T$, $\textbf{c}=[9~10~11~12]^T$,&#xA;Then $h_1$ is calculated as follows $(a_1+b_1)c_1=(1+5)\times 9$, &#xA;$h_2 =(a_2+b_2)c_2=(2+6)\times 10$, $h_3 =(a_3+b_3)c_3=(3+7)\times 11$, $h_4 =(a_4+b_4)c_4=(4+8)\times 12$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally $\textbf{h}=[h_1, h_2, h_3, h_4]^T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question:&#xA;1. $\textrm{E}\left[\textbf{h}\textbf{h}^H\right]$=? in terms of $\textrm{E}\left[\textbf{c}\textbf{c}^H\right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.Can I write $\textbf{h}$ in terms of $\textbf{a}$ $\textbf{b}$, $\textbf{c}$?&lt;/p&gt;&#xA;" OwnerUserId="8583" LastActivityDate="2014-04-14T12:07:33.233" Title="Expectation of product of hermitian matrix" Tags="|signal-analysis|matrix|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15630" PostTypeId="2" ParentId="15629" CreationDate="2014-04-14T12:07:33.233" Score="1" Body="&lt;p&gt;You could define a diagonal matrix $\mathbf{D}$ with diagonal elements $d_{ii}=a_i+b_i$. Then vector $\mathbf{h}$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{h}=\mathbf{D}\mathbf{c}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the expectation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbb{E}[\mathbf{h}\mathbf{h}^H]=\mathbf{D}\mathbb{E}[\mathbf{c}\mathbf{c}^H]\mathbf{D}^H$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I assume that $\mathbf{a}$ and $\mathbf{b}$ are deterministic and $\mathbf{c}$ is random, because you said you wanted the expectation in terms of $\mathbf{c}$.)&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-14T12:07:33.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15631" PostTypeId="1" AcceptedAnswerId="15632" CreationDate="2014-04-14T12:23:30.617" Score="2" ViewCount="2932" Body="&lt;p&gt;Last week I've been trying to implement the Order Analysis in MATLAB in vain. I've read a lot of docs about it like &lt;a href=&quot;http://www.bksv.co.uk/Support/~/media/UnitedKingdom/FAQ%20Downloads/Order%20Analysis.ashx&quot; rel=&quot;nofollow&quot;&gt;this one &lt;/a&gt;,  but I still can't figure it out.&#xA;This will be my last shot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have recorded 10sec audio file of a rotating machine, the sampling frequency is 96Khz. In this 10sec interval, the speed of the machine will continuously increase, say from 800rpm to 1500rpm. Is there any way to calculate the Order Analysis for this machine? &#xA;I'll be grateful for any hint! &lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="8202" LastEditDate="2014-05-21T07:12:27.720" LastActivityDate="2019-05-23T05:56:47.053" Title="Order analysis or order tracking" Tags="|fourier-transform|frequency-spectrum|signal-analysis|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15632" PostTypeId="2" ParentId="15631" CreationDate="2014-04-14T13:24:39.000" Score="1" Body="&lt;p&gt;Well my friend, if you read the following B&amp;amp;K tutorial about the Order Tracking, then you should encounter so called &lt;strong&gt;Vold-Kalman Order Filtering&lt;/strong&gt;. Personally I don't like it (rather prefer Chirp-Fourier based methods for extracting the response of the system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find plenty &lt;strong&gt;implementations&lt;/strong&gt; in the internet. When you look for MATLAB, then please refer to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/32639-vold-kalman-order-tracking-code&quot; rel=&quot;nofollow&quot;&gt;Vold-Kalman order tracking code&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/36277-second-generation-vold-kalman-order-filtering&quot; rel=&quot;nofollow&quot;&gt;Second generation Vold-Kalman Order Filtering&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And most certainly I suggest you to search the bottom of the prof. Jiri Tuma website: &lt;a href=&quot;http://homel.vsb.cz/~tum52/index.php?page=download&quot; rel=&quot;nofollow&quot;&gt;click!&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more &lt;strong&gt;theory&lt;/strong&gt; please take a look at - I'm sure you will like it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sem-proceedings.com/17i/sem.org-IMAC-XVII-17th-174602-Characteristics-Vold-Kalman-Order-Tracking-Filter.pdf&quot; rel=&quot;nofollow&quot;&gt;Characteristics of the Vold-Kalman Order Tracking Filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://homel.vsb.cz/~tum52/download/VoldKalman.pdf&quot; rel=&quot;nofollow&quot;&gt;Vold-Kalman Order Tracking Filtration&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dynamicmeasurementsolutions.com/Articles/0503bran.pdf&quot; rel=&quot;nofollow&quot;&gt;Main Principles and Limitations of the Current Order Tracking Methods&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://institut17.kug.ac.at/fileadmin/media/iem/altdaten/projekte/publications/paper/dafx%5ffeldbauer%5fhoeldrich2/dafx%5ffeldbauer%5fhoeldrich2.pdf&quot; rel=&quot;nofollow&quot;&gt;Realization of the Vold-Kalman Tracking Filter - A Least Squares problem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.google.co.uk/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=10&amp;amp;ved=0CJoBEBYwCQ&amp;amp;url=http://thesis.lib.ncu.edu.tw/ETD-db/ETD-search/getfile?URN=93323098&amp;amp;filename=93323098.pdf&amp;amp;ei=BdxLU9DCDsyg7AaM-oGADw&amp;amp;usg=AFQjCNEp%5f0WffQmZLTrFGHdAaXD1k0ttBw&amp;amp;sig2=gpoRLRSQRRAmmuEz-X4vIw&amp;amp;bvm=bv.64542518,d.ZGU&amp;amp;cad=rja&quot; rel=&quot;nofollow&quot;&gt;Advanced Vold-Kalman Filtering Order Tracking&lt;/a&gt; - do not be scared, it's not in chineese ;)&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-04-14T13:33:55.333" LastActivityDate="2014-04-14T13:33:55.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15633" PostTypeId="2" ParentId="15623" CreationDate="2014-04-14T13:32:33.763" Score="1" Body="&lt;p&gt;If you have a $T$-periodic function $g(t)$ with Fourier coefficients $c_n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(t)=\sum_{n=-\infty}^{\infty}c_ne^{in\omega_0t},\quad\omega_0=\frac{2\pi}{T}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you create a new function $f(t)$ with Fourier coefficients $d_n$ defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d_n=c_{n/2},\quad n\textrm{ even}\\&#xA;d_n=0,\quad n\textrm{ odd}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. the spectrum is expanded by a factor two by inserting zeros between the original Fourier coefficients. Then $f(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\sum_{n=-\infty}^{\infty}d_ne^{in\omega_0t}=&#xA;\sum_{n\textrm{ even}}c_{n/2}e^{in\omega_0t}=&#xA;\sum_{n=-\infty}^{\infty}c_ne^{i2n\omega_0t}=g(2t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you get a compressed time domain signal with period $T/2$, as directly shown in the first equation of the problem formulation in your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-14T13:32:33.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15634" PostTypeId="2" ParentId="15616" CreationDate="2014-04-14T13:45:06.307" Score="0" Body="&lt;h3&gt;1. FFT (DFT) normalization&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Your math software may not normalize the FFT output, indeed. In such a case you should either refer to the docs or check manualy which normalization is appropriate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The following is applicable to FFT (DFT) with rectangular window as were noted by @jojek in the comments.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to check whether your normalization is correct is to calculate amplitude (not power) spectrum of say a &lt;code&gt;A*sin(1:N)&lt;/code&gt; series. If you see a peak of height &lt;code&gt;A&lt;/code&gt;, it's all right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;http://scilab.org/&quot; rel=&quot;nofollow&quot;&gt;Scilab&lt;/a&gt; I use the following function to get amplitude and power spectrum of a real signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;function [SD] = spect(y, pwr)&#xA;    // Spectrum of a real signal&#xA;&#xA;    if ~exists('pwr', 'l') then&#xA;        pwr = %f&#xA;    end&#xA;&#xA;    if ~isreal(y) then&#xA;        error('Real signal expected.')&#xA;    end&#xA;&#xA;    Y = fft(y) ./ length(y)&#xA;    SD = abs(Y(1 : $ / 2 + 1))&#xA;    SD(2 : $) = 2 .* SD(2 : $)&#xA;    if pwr then&#xA;        SD = (SD ./ sqrt(2)) .^ 2&#xA;    end&#xA;endfunction&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;2. FFT (DFT) frequency resolution&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Resolution of FFT is $\frac{F_s}{2}$, so you're right here.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;3. PSD Y-axis units&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The Y-axis of the PSD plot is in power units, $\mu V^2$ in your case.&lt;/p&gt;&#xA;" OwnerUserId="8540" LastEditorUserId="8540" LastEditDate="2014-04-14T14:24:51.887" LastActivityDate="2014-04-14T14:24:51.887" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15637" PostTypeId="2" ParentId="15616" CreationDate="2014-04-14T18:01:14.120" Score="2" Body="&lt;p&gt;Have a look at this &lt;a href=&quot;http://edoc.mpg.de/get.epl?fid=55356&amp;amp;did=395068&amp;amp;ver=0&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;, section 9 goes over how to scale or normalize the FFT output. For the PSD you need to divide by the effective noise bandwidth (ENBW) which is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;ENBW = f_s\frac{S_2}{S_1^{2}}\\&#xA;S_1 = \sum_{j=0}^{N-1}w_j\\&#xA;S_2 = \sum_{j=0}^{N-1}w_j^{2}\\&#xA;where~w_j~is~the~jth~sample~of~the~window~function&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-04-14T18:01:14.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15639" PostTypeId="2" ParentId="3351" CreationDate="2014-04-14T21:03:14.913" Score="2" Body="&lt;p&gt;In ideal world you'd have the correct model and use it.&lt;br /&gt;&#xA;In your case, the model isn't perfect.&lt;/p&gt;&#xA;&lt;p&gt;Yet the steps you're suggesting are based on a knowledge you have about the process - which you should incorporate into your process equation using your dynamic model matrix:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The classic and correct way given F matrix is built correctly according to your knowledge.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&amp;quot;Extra&amp;quot; prediction step will yield nothing, since &lt;span class=&quot;math-container&quot;&gt;$ {F}_{ik} = {F}_{ij} {F}_{jk} $&lt;/span&gt; and if you reduce the time frame you should alter &lt;span class=&quot;math-container&quot;&gt;$ Q $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ R $&lt;/span&gt; accordingly which should get you at the end of the chain of small steps the same &lt;span class=&quot;math-container&quot;&gt;$P_{k \mid k - 1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you don't measure V you'll must &amp;quot;Estimate&amp;quot; it somehow. Yet by definition, if your case falls under Kalman's assumptions using Kalman's filter would yield best results.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;All in all, stick with the &amp;quot;Classic&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="7092" LastEditDate="2021-02-23T05:46:05.847" LastActivityDate="2021-02-23T05:46:05.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15640" PostTypeId="2" ParentId="6405" CreationDate="2014-04-14T21:13:02.717" Score="0" Body="&lt;p&gt;There seems to be an image which is gone now and hence I might be missing something.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In order to declare if the system is invariant you should see if a delay of the input yields only a delay in the output.&lt;br /&gt;&#xA;In you case, does the input &lt;span class=&quot;math-container&quot;&gt;$x_1[n-m]$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$y_1[n-m]$&lt;/span&gt; and etc...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;As written by @DilipSarwate, By looking at the response for &lt;span class=&quot;math-container&quot;&gt;$ {x}_{2} - {x}_{1} $&lt;/span&gt; one could see the system is neither causal nor time invariant:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;consider that linearity requires that the response to &lt;span class=&quot;math-container&quot;&gt;$ {x}_{2} − {x}_{1} $&lt;/span&gt; be&#xA;&lt;span class=&quot;math-container&quot;&gt;$ T \left( {x}_{2} − {x}_{1} \right) = T \left( {x}_{2} \right) − T \left( {x}_{2} \right) = {y}_{2} − {y}_{1} $&lt;/span&gt;.&#xA;Now, &lt;span class=&quot;math-container&quot;&gt;$ {x}_{2} − {x}_{1} $&lt;/span&gt; is a pulse of amplitude &lt;span class=&quot;math-container&quot;&gt;$ 2 $&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$ n = 2 $&lt;/span&gt; and the response to it is nonzero at &lt;span class=&quot;math-container&quot;&gt;$ n = 0, 1, 2 $&lt;/span&gt; and so the system is not causal, and since &lt;span class=&quot;math-container&quot;&gt;$ {x}_{2} − {x}_{1} $&lt;/span&gt; is just &lt;span class=&quot;math-container&quot;&gt;$ {x}_{2} $&lt;/span&gt; delayed by 2 units while the response is not &lt;span class=&quot;math-container&quot;&gt;$ {y}_{2} $&lt;/span&gt; delayed by 2 time units, the system is time varying, not time invariant.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;If the input signals are band limited and their bandwidth is less than your system you won't be able to restore the impulse response.&lt;br /&gt;&#xA;You will be able only to get the response in the frequencies the input has energy in.&lt;br /&gt;&#xA;This could be done by frequency analysis of the input and the output.&lt;br /&gt;&#xA;If your system is indeed LTI the connection between input and output is given by convolution with the impulse response.&lt;br /&gt;&#xA;Convolution is multiplication in the frequency domain, hence you could easily get the impulse response (Again, only at frequencies the input has energy in).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Yet since this system isn't time invariant it doesn't have a single impulse response. It has a response to an impulse at &lt;span class=&quot;math-container&quot;&gt;$ n = 0 $&lt;/span&gt; but it might have a different one for an impulse at &lt;span class=&quot;math-container&quot;&gt;$ n = 1 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Update&lt;/h2&gt;&#xA;&lt;p&gt;This is a nice case to show the commutative property of convolution.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$ y \left[ n \right] = \left( h \ast x \right) \left[ n \right] = \left( x \ast h \right) \left[ n \right] $&lt;/span&gt; you can switch the roles between the &amp;quot;System&amp;quot; and the &amp;quot;Input Signal&amp;quot;.&lt;br /&gt;&#xA;So this question is equivalent to &lt;em&gt;Given known output and system response, how could one estimate the input of the system?&lt;/em&gt;&lt;br /&gt;&#xA;Well, this is a known problem called Deconvolution and in the case of no noise it is simple to solve.&lt;/p&gt;&#xA;&lt;p&gt;As written above, one way to do so it write the problem in matrix form.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2021-02-23T07:10:15.483" LastActivityDate="2021-02-23T07:10:15.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15641" PostTypeId="2" ParentId="8237" CreationDate="2014-04-14T21:33:24.563" Score="2" Body="&lt;p&gt;Though the Matched Filter is the best tool detection of a known signals under AWGN it should work well here as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To say something about the probabilities the question is, do you know something about the energy of the received signals?&lt;br&gt;&#xA;If you do, you should easily say something about the probabilities.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pay attention that if the assumption is a signal could be within a different signal you need to apply a generalized Matched Filter (Multi Decision).&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-04-14T21:33:24.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15643" PostTypeId="1" AcceptedAnswerId="15657" CreationDate="2014-04-15T02:39:16.580" Score="11" ViewCount="20351" Body="&lt;p&gt;I am trying to smooth a series of data in order to obtain a continuous function that could represent that given data set.&#xA;It came out that the &lt;a href=&quot;https://stackoverflow.com/a/20642478/2107030&quot;&gt;Savitzky-Golay&lt;/a&gt; method could be a good way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I don't know much about smoothing and/or interpolate, but I managed to obtain a good result, at a first glance:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UsKxh.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;The blue points are my data, and the red line is the result from a SG filter applied with a &lt;code&gt;window = 15&lt;/code&gt; and a &lt;code&gt;polynomial order = 13&lt;/code&gt;.&#xA;Now, I could try some other combinations of window&amp;amp;order, but more generally I would like to know the principles of the best meeting of these two parameters, especially in my case, where the data have no smooth trend (like a sinusoidal).&lt;/p&gt;&#xA;" OwnerUserId="8442" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2019-02-12T08:48:36.100" Title="Savitzky-Golay filter parameters" Tags="|filters|lowpass-filter|interpolation|smoothing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15644" PostTypeId="1" CreationDate="2014-04-15T04:14:59.633" Score="0" ViewCount="725" Body="&lt;p&gt;I have an EEG data set downloaded from physionet. I want to play that data into a brain monitoring device like for example BIS monitor or Narcotrend or any other similar brain monitoring device.I use Matlab GUI to visualize the data. Can I send it from a Matlab GUI to any one of the brain monitoring devices with a suitable hardware  in between.Any ideas please I am new to EEG signals. &lt;/p&gt;&#xA;" OwnerUserId="2006" LastActivityDate="2014-05-15T22:05:49.837" Title="EEG signal processing" Tags="|matlab|eeg|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15645" PostTypeId="1" AcceptedAnswerId="15654" CreationDate="2014-04-15T08:45:23.067" Score="1" ViewCount="617" Body="&lt;p&gt;In &lt;a href=&quot;http://www.emva.org/cms/upload/Standards/Standard1288_Downloads/basler_comparing_cameras_using_1288.ppt&quot; rel=&quot;nofollow&quot;&gt;this presentation&lt;/a&gt; on slide 15 there is a corollary:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Rule of thumb: the dark noise must be larger than 0.5&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Corollary: With a N bit digital signal you can deliver no more*) than&#xA;  N+1 bit dynamic range.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;*) You can if you use loss-less compression&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They give an example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Example : A 102f camera with 11 bit dynamic range will deliver only 9&#xA;  bit in Mono8 mode. Use Mono16!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why N+1? &#xA;How can an 8 bit signal deliver 9 bit dynamic range? &lt;/p&gt;&#xA;" OwnerUserId="8588" LastEditorUserId="8588" LastEditDate="2014-04-15T16:47:19.753" LastActivityDate="2014-04-15T16:47:19.753" Title="What is the maximum dynamic range of an N bit signal?" Tags="|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15646" PostTypeId="1" CreationDate="2014-04-15T08:50:50.070" Score="2" ViewCount="13306" Body="&lt;p&gt;I'm struggling with a signal analysis electrical engineering college assignment. We need to a derive differential equation for a low-pass filter, high-pass filter and a band pass filter (made by connecting the output of a low pass filter to the input of a high pass filter). Here are diagrams for reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low pass filter&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BbVST.png&quot; alt=&quot;Low Pass Filter Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;High pass filter&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YmKPe.png&quot; alt=&quot;High Pass Filter Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kcvog.png&quot; alt=&quot;Band Pass Filter&quot;&gt;$$$$&#xA;Band pass filter (buffer can be removed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equations I derived are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;low pass filter: &#xA;      $$V_o=V_i-RC \frac{dV_i}{dt}$$&lt;/li&gt;&#xA;&lt;li&gt;high pass filter: &#xA;      $$V_o=RC \frac{dV_i}{dt}$$&lt;/li&gt;&#xA;&lt;li&gt;band pass filter: &#xA;      $$V_o = R_2C_2 ( (1-C_1-R_1)- R_1C_1  \frac{d^2V_i}{dt^2} )$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The equation for the band pass filter I found by making the input of the high pass filter the output of the low pass filter. So I derived the equation of the low pass filter with respect to time and got:&#xA;$$&#xA;\frac{dV_o}{dt} = \frac{dV_i}{dt} - R_1\frac{dVi}{dt} - C_1\frac{dV_i}{dt} - R_1C_1\frac{d^2V_i}{dt^2}&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I substituted in this rate of change of voltage into the equation of the high pass filter to get the equation I derived for the band pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please tell me if what I have done is valid and if not, please explain to me what the correct strategy is. Thank you kindly.&lt;/p&gt;&#xA;" OwnerUserId="8589" LastEditorUserId="4376" LastEditDate="2014-04-15T09:48:31.963" LastActivityDate="2014-04-16T06:57:20.207" Title="Differential Equation of a Band Pass Filter" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15647" PostTypeId="2" ParentId="15460" CreationDate="2014-04-15T09:03:41.457" Score="0" Body="&lt;h2&gt;Principle&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The pilot tone/subcarrier (short: pilot) modulation for WiMax is specified in section 8.3.3.4.2 of IEEE standard &lt;em&gt;802.16-2004&lt;/em&gt;, which is available on the &lt;a href=&quot;http://standards.ieee.org/getieee802/download/802.16-2004.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;IEEE site&lt;/a&gt;. The data bits transmitted on the pilots are defined by a pseudo-random binary sequence (PRBS) $w_k$ of which the polynomial is given by $X^{11}+X^9+1$. The index $k$ stands for the OFDM symbol number and the the pilot tones are modulated using binary phase shift keying (BPSK), i.e. the subcarrier value is either $-A$ or $A$. The detailed allocation of BPSK symbols can be taken from the following equations that I have copied from the above-cited standard&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JEbD2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the energy of all subcarriers shall be equal and as you're using the symbol alphabet $\{1+j, 1-j, -1+j, -1-j\}$ with symbol energy $\sqrt{1^2+1^2}=\sqrt 2$ it must hold $A=\sqrt 2$.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Example&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The sequence for pilots in the uplink is $w_k=1,\ldots$ and the modulation of subcarriers in the first OFDM symbol ($k=0$) is given by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subcarrier index  value&#xA;----------------  -----&#xA;-88               -A&#xA;-63                A&#xA;-38               -A&#xA;-13                A&#xA; 13               -A&#xA; 38               -A&#xA; 63               -A&#xA; 88               -A&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Implementation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Create the sequence $w_k$ and create the BPSK symbols according to the above principle for every $k$. Then assign these values to the pilot subcarriers of every OFDM symbol. If rigorous accordance to the standard is not required you can just make up any random sequence of BPSK symbols and allocate them to the pilot subcarriers. Note that the pilot subcarrier allocation might be different depending on the version of the standard, uplink/downlink and PUSC/FUSC.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-04-15T09:26:03.747" LastActivityDate="2014-04-15T09:26:03.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15650" PostTypeId="5" CreationDate="2014-04-15T10:34:53.827" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-04-15T10:34:53.827" LastActivityDate="2014-04-15T10:34:53.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15651" PostTypeId="4" CreationDate="2014-04-15T10:34:53.827" Score="0" Body="the field of study that aims to solve an underdetermined linear system of equations by exploiting the structure of the unknown data" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2014-04-15T12:16:37.037" LastActivityDate="2014-04-15T12:16:37.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15652" PostTypeId="2" ParentId="15645" CreationDate="2014-04-15T10:47:58.603" Score="0" Body="&lt;p&gt;The values of dynamic range you're using seems to be base-2 logarithm (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_range&quot; rel=&quot;nofollow&quot;&gt;Dynamic range&lt;/a&gt; article).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the definition of dynamic range its best possible value for $N$-bit encoded signal is $2^N:1$ or just $N$ bits. You're right in that it's not possible to have more than $N$-bit DR for $N$-bit encoding (without any compression).&lt;/p&gt;&#xA;" OwnerUserId="8540" LastActivityDate="2014-04-15T10:47:58.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15653" PostTypeId="2" ParentId="15646" CreationDate="2014-04-15T12:01:21.617" Score="2" Body="&lt;p&gt;I'm afraid your results are not correct. Let's have a look at the low-pass filter. The current $i(t)$ through $R$ and $C$ must be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$i(t)=\frac{v_i(t)-v_o(t)}{R}=C\frac{dv_o(t)}{dt}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$v_i(t)=v_o(t)+RC\frac{dv_o(t)}{dt}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the high-pass filter we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$i(t)=\frac{v_o(t)}{R}=C\frac{d(v_i(t)-v_o(t))}{dt}$$&#xA;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$RC\frac{dv_i(t)}{dt}=v_o(t)+RC\frac{dv_o(t)}{dt}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's call the time constants of the low-pass and high-pass filters $\tau_L=R_LC_L$ and $\tau_H=R_HC_H$, respectively. For the band-pass filter we need a relation between $v_i(t)$ of the low-pass filter and $v_o(t)$ of the high-pass filter. If we use $v_{oL}(t)$ to denote the output of the low-pass filter, which equals the input of the high-pass filter, we get from (1) by taking the derivative&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{dv_i(t)}{dt}=\frac{dv_{oL}(t)}{dt}+\tau_L\frac{d^2v_{oL}(t)}{dt^2}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (2) we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_H\frac{dv_{oL}(t)}{dt}=v_o(t)+\tau_H\frac{dv_o(t)}{dt}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and (by taking the derivative)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_H\frac{d^2v_{oL}(t)}{dt^2}=\frac{dv_o(t)}{dt}+\tau_H\frac{d^2v_o(t)}{dt^2}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging (4) and (5) into (3) we finally get for the band-pass filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_H\frac{dv_i(t)}{dt}=v_o(t)+(\tau_L+\tau_H)\frac{dv_o(t)}{dt}+\tau_L\tau_H\frac{d^2v_o(t)}{dt^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, if you were allowed to use the Laplace or Fourier transform, everything would be a lot easier.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-16T06:57:20.207" LastActivityDate="2014-04-16T06:57:20.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15654" PostTypeId="2" ParentId="15645" CreationDate="2014-04-15T12:26:15.113" Score="5" Body="&lt;p&gt;From taking a look at the presentation, it seems that they might be using a slightly different definition of dynamic range than is typical. Usually, as in &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_range&quot;&gt;the Wikipedia article on the topic&lt;/a&gt;, dynamic range is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{dynamic range} = \frac{\text{largest possible representable value}}{\text{smallest possible representable value}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an $N$-bit (unsigned) signal, this is equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{dynamic range} = \frac{2^N-1}{1} = 2^N-1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, their discussion of dynamic range is interspersed with discussion of quantization noise. Therefore, I posit that they instead define dynamic range as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{dynamic range} = \frac{\text{largest possible representable value}}{\text{largest possible quantization error}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a uniformly-quantized quantity such as this, the maximum quantization error is equal to half of one bit. That leads to a dynamic range of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{dynamic range} = \frac{2^N-1}{0.5} = 2(2^N-1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The extra factor of 2 gives you an approximate increase of 1 bit in &quot;dynamic range&quot; when measured this way.  I assume that's what is meant by an $N$-bit digitized signal providing $N+1$ bits of dynamic range.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-04-15T12:26:15.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15655" PostTypeId="1" CreationDate="2014-04-15T12:33:17.567" Score="0" ViewCount="479" Body="&lt;p&gt;I have just bought a new video capture card whose output format is YUV 4:2:2 (as my old one) and surprisingly when I capture images with both cards I get different results. Differences are very small (have to zoom on edges if you want to see something) but I would like to know where do they come from? I was wondering if it was the transformation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;YUV 422 -&amp;gt; YUV 444&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That could change from one driver to another?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the original image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RKiDM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the capture with my old card:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gIPOq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the capture with my new card:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/3iuoa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="5125" LastEditDate="2014-04-15T12:38:33.537" LastActivityDate="2015-11-09T06:18:23.717" Title="New capture card YUV 4:2:2 leads to different images" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15657" PostTypeId="2" ParentId="15643" CreationDate="2014-04-15T13:08:55.523" Score="7" Body="&lt;p&gt;Let's call the window length $M$, and $N$ is the order of the polynomial. One important thing to realize is that you use a polynomial of order $N$ to approximate $M$ data points. This means that you use $M$ points to compute $N+1$ polynomial coefficients (an $N^{th}$ order polynomial has $N+1$ coefficients). So if $N+1=M$ then you do not smooth at all but you just use the polynomial to interpolate the data points. In your example this is almost the case, i.e. there is hardly any smoothing. Generally, $N$ is chosen considerably smaller than $M$ to achieve some smoothing (and also for numerical stability). The smaller $N$ compared to $M$, the more smoothing you will get. What remains is the choice of $M$, but as far as I know there are no general guidelines. In practical examples I've seen polynomial orders of $4$ or $5$ with much larger values for $M$. With all this in mind it remains to try several combinations of $M$ and $N$ and choose the one that fits best your application.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-15T13:08:55.523" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15658" PostTypeId="1" AcceptedAnswerId="15659" CreationDate="2014-04-15T15:06:59.873" Score="0" ViewCount="18948" Body="&lt;p&gt;For a certain experiment of which I have data, I want to calculate the autocorrelation of the measurements. For this I used the expression from &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation#Estimation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, which reads&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e0qvc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $n$ is the dataset's size, $0 &amp;lt; k &amp;lt; n$, $\sigma$ is the standard deviation and $\mu$ is the mean. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I've read the descriptions on the page, but I don't fully understand all of the terms in there. I understand why we divide by $(n-k$), because the number of datapoints used constantly changes (you have a finite signal, after all). However, I don't see why we divide by the variance. Moreover, I also don't know why we subtract the mean. Doesn't this lead to problems, if for example for n = 50 and k = 49, we want to multiply $(x_1-\mu)(x_{50}-\mu)$, and $x_1 &amp;gt; \mu$ but $x_{50} &amp;lt; \mu$? I don't really see what a negative correlation would entail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my data, which is only 0's and 1's, this is even more problematic. Using the above formula the correlations quickly decay to zero, but at the end they violently start to spike, because the contribution from the mean becomes so big, relatively. In my data the mean is 0.5 and the variance is 0.25, so for example, my final point $R(49)$ = $\frac{(0-0.5)(1-0.5)}{0.25}$ = -1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But -1 is huge, especially when 'previously' the correlations had died out to 0. How does one deal with this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An illustration of this is&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UWZn0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8593" LastEditorUserId="80" LastEditDate="2017-05-25T12:49:43.940" LastActivityDate="2017-05-25T12:49:43.940" Title="Autocorrelation function of a discrete signal" Tags="|discrete-signals|autocorrelation|correlation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15659" PostTypeId="2" ParentId="15658" CreationDate="2014-04-15T15:16:29.847" Score="3" Body="&lt;p&gt;First: you should really read some basic theory of autocorrelation. &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow noreferrer&quot;&gt;For example&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I also don't know why we subtract the mean&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;First, to subtract the mean is the usual and right thing to do – it's so standard that often it is straightly assumed that the signal has zero mean. Recall that the covariance of two variables is $E[ (x-\mu_x)(y-\mu_y)]$ – of which the variance is a special case. Here we are assuming that the process is stationary, so the mean is constant. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't really see what a negative correlation would entail.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The correlation (as the covariance) can be positive, zero or negative. A negative correlation says that the values tend to have opposite values, that is: when X has a &quot;big value&quot; (relative to the mean), then it's more probable that Y has a &quot;small value&quot; (relative to the mean). If the correlation is positive, then's the reverse.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, I don't see why we divide by the variance.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You don't have to. You divide by it if you want a normalized correlation (rather: a correlation coefficient), that will be in the $[-1, 1]$ range.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I understand why we divide by $(n−k)$...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Actually you have two alternatives here: if you divide by $(n-k)$ you get an unbiased estimator (good), but, you get large variance (the &quot;noise&quot; you see in the graph) for large values of $k$ (bad; however, one is often interested only in the correlation for small values of $k$). Alternatively, one can divide by $n$; this produce a biased estimator but better behaved (lower variance) for large $k$. This is also explained &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation#Estimation&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; or in any textbook about correlation estimators.&lt;/p&gt;&#xA;" OwnerUserId="358" LastEditorUserId="28725" LastEditDate="2017-05-25T11:37:49.420" LastActivityDate="2017-05-25T11:37:49.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15660" PostTypeId="2" ParentId="15645" CreationDate="2014-04-15T15:19:05.707" Score="0" Body="&lt;p&gt;The definition of &quot;dynamic range in dB&quot; is the sum of the S/N dB plus the dB of headroom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now if you assume the PDF of the signal has the same uniform distribution that the implied quantization noise (where one has quantized a longer word to these $N$ bits), then the dynamic range in dB is $20 \log_{10}(2^N)  = 20 \log_{10}(2)  N \approx  6.02  N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you assume the signal is a sinusoid (so it has a sinusoidal PDF) then you add 1.76 dB, i think.  the sine up to a level (and that level is the &quot;rails&quot; minus the dB headroom) is 1.76 dB louder than a uniform PDF (like a triangle wave would have) having the same maximum amplitude.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-04-15T15:19:05.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15661" PostTypeId="1" CreationDate="2014-04-15T16:02:22.050" Score="1" ViewCount="5864" Body="&lt;p&gt;I have the the noisy curve defined by numpy 2D array:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/oyA4p.png&quot; alt=&quot;mEPSC&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, it has the first flat segment, then rise, peak and decay phases. I need to find the starting point of the rise phase, marked here by the red dot. What algorythm can I use for that? I need it to be as noise-tolerant as possible.&lt;/p&gt;&#xA;" OwnerUserId="8595" LastActivityDate="2014-04-15T21:22:36.177" Title="How to find the inflection point in a noisy curve?" Tags="|python|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15662" PostTypeId="1" CreationDate="2014-04-15T17:48:59.650" Score="6" ViewCount="1292" Body="&lt;p&gt;I was thinking sometime back about how to explain the Continuous Wavelet Transform ELI5. So this is what I came across.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correlation of two exact signals is 1. So if I have an input signal $f(x)$ made up of an array of frequencies, how can I find out what frequencies exist at what points? Well, slide a signal $m(y)$ where $-\infty &amp;gt; y &amp;gt; +\infty$ over $f(x)$, and at those points where the co-relation of these signals is 1, well, those frequencies are present, at those times. This if of course a Continuous Wavelet Transform. Am I correct?&lt;/p&gt;&#xA;" OwnerUserId="4142" LastEditorUserId="8202" LastEditDate="2014-05-16T15:09:49.133" LastActivityDate="2016-02-28T10:40:40.107" Title="Intuition behind the Continuous Wavelet Transform?" Tags="|wavelet|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15664" PostTypeId="1" AcceptedAnswerId="15668" CreationDate="2014-04-15T18:22:23.480" Score="3" ViewCount="2305" Body="&lt;p&gt;I am having a problem understanding how the author gets the onset envelope of an audio song in &lt;a href=&quot;http://www.google.co.uk/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0CDUQFjAB&amp;amp;url=http%3A%2F%2Facademiccommons.columbia.edu%2Fdownload%2Ffedora_content%2Fdownload%2Fac%3A144440%2FCONTENT%2F09298210701653344.pdf&amp;amp;ei=WHlNU673I4G-O52bgTA&amp;amp;usg=AFQjCNEdNkgqk7niB5pUZveaJgSyR4T8hw&amp;amp;sig2=VkXMPsHfiR7pMoM5x_OjrQ&amp;amp;bvm=bv.64764171,d.ZWU&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entire section in question has been quoted below:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;First the input sound is resampled to 8 kHz, then we calculate the&#xA;  short-term Fourier transform (STFT) magnitude (spectrogram) using 32&#xA;  ms windows and 4 ms advance between frames. This is then converted to&#xA;  an approximate auditory representation by mapping to 40 Mel bands via&#xA;  a weighted summing of the spectrogram values [Ellis, 2005]. We use an&#xA;  auditory frequency scale in an effort to balance the perceptual&#xA;  importance of each frequency band. The Mel spectrogram is converted to&#xA;  dB, and the first-order difference along time is calculated in each&#xA;  band. Negative values are set to zero (half-wave rectification),&#xA;  then the remaining, positive differences are summed across all&#xA;  frequency bands. This signal is passed through a high-pass filter with&#xA;  a cutoff around 0.4 Hz to make it locally zero-mean, and smoothed by&#xA;  convolving with a Gaussian envelope about 20 ms wide. This gives a&#xA;  one- dimensional onset strength envelope as a function of time that&#xA;  responds to proportional increase in energy summed across&#xA;  approximately auditory frequency bands&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My understanding of the procedure of the first part of the procedure is that our 44.1KHz audio signal is resampled to 8KHz and then we perform a overlapping widowed STFT operation on it so we get the Fourier transform coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I really have no idea what is happening in the second part of the procedure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think we then alter those coefficients in such a way that the new Fourier transform coefficients are now balanced perceptually(ie the coefficients are now what a person's ear would perceive them to be).Then the so-called resultant &quot;Mel spectrogram&quot; is converted to dB, and the first-order difference along time is calculated in each band.Negative values are then set to zero (half-wave rectification),then the remaining, positive differences are summed across all frequency bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Why and how would we calculate the first order difference? What use is this? I have no extensive knowledge of the Mel scale and it's so-called &quot;frequency bands&quot; so this part is proving hard to understand.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This signal is passed through a high-pass filter with a cutoff around 0.4 Hz to make it locally zero-mean, and smoothed by convolving with a Gaussian envelope about 20 ms wide. This gives a one- dimensional onset strength envelope as a function of time that responds to proportional increase in energy summed across approximately auditory frequency bands&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Why do we need the signal to be locally zero-mean?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="4376" LastEditDate="2016-05-13T07:10:49.513" LastActivityDate="2016-05-13T07:10:49.513" Title="Onset Detection for Audio Signals" Tags="|fft|audio|signal-analysis|stft|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15665" PostTypeId="1" AcceptedAnswerId="15666" CreationDate="2014-04-15T18:25:50.290" Score="0" ViewCount="135" Body="&lt;p&gt;How can I convert a time signal (audio) into the frequency domain, multiply frequency amplitudes by a vector of scalars, and convert it back into the time domain, without messing up timing information (ringing?)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some context:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am calibrating ultrasonic speakers. I have a frequency roll-off curve of the attenuation dB for each frequency, from a reference point. I now want to compensate my output using this curve.  Here is an example that was gathered experimentally:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2UcLE.png&quot; alt=&quot;attenuation curve&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can then multiply my output signal in the frequency domain by this attenuation vector, and convert back into the time domain. For the most part this works, however, there is some extra energy at the wrong times, and I am not sure why. Here is what it looks like:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/I9KKX.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Here is some python code to demonstrate what I have. To make this a compilable example I try to approximate the attenuation vector with a sawtooth for variation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    import numpy as np&#xA;    from scipy.signal import chirp, sawtooth&#xA;&#xA;    def smooth(x,window_len=11):&#xA;        &quot;&quot;&quot;smooth the data using a window with requested size.&quot;&quot;&quot;&#xA;&#xA;        s=np.r_[x[window_len-1:0:-1],x,x[-1:-window_len:-1]]&#xA;&#xA;        w = np.hanning(window_len)&#xA;        y=np.convolve(w/w.sum(),s,mode='valid')&#xA;        return y[window_len/2:len(y)-window_len/2]&#xA;&#xA;    fs = 5e5&#xA;    duration = 0.2&#xA;    npts = duration*fs &#xA;    t = np.arange(npts).astype(float)/fs&#xA;&#xA;    # my output stimulus&#xA;    x = chirp(t, f0=5000, f1=1e5, t1=duration)&#xA;&#xA;    X = np.fft.rfft(x)&#xA;&#xA;    # stand-in attenuation vector&#xA;    variation = sawtooth(np.arange(npts/2 + 1)/500)&#xA;    attendB = np.linspace(0, 30, npts/2 + 1) + variation&#xA;&#xA;    # attempt to minimize ringing?&#xA;    attendB = smooth(attendB)&#xA;&#xA;    H = 10**((attendB).astype(float)/20)&#xA;&#xA;    # signal adjusted to calibration&#xA;    A = X * H&#xA;    a = np.fft.irfft(A)&#xA;&#xA;    # ==== plot ====&#xA;    import matplotlib.pyplot as plt&#xA;&#xA;    plt.subplot(211)&#xA;    plt.specgram(x, Fs=fs)&#xA;    plt.title('original')&#xA;    plt.subplot(212)&#xA;    plt.specgram(a, Fs=fs)&#xA;    plt.title('adjusted')&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can eliminate the extra energy by increasing the smoothing. However, this also reduces the accuracy of the calibration, as assesed by comparing the desired and recieved frequency response. Is this a trade-off I have to deal with, or am I going about this the wrong way? Alternatively, is it a feasible solution to implement this as a filter in the time domain?&lt;/p&gt;&#xA;" OwnerUserId="8056" LastActivityDate="2014-04-17T18:17:10.597" Title="Extra energy when altering frequency amplitudes" Tags="|filters|audio|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15666" PostTypeId="2" ParentId="15665" CreationDate="2014-04-15T19:07:12.153" Score="2" Body="&lt;p&gt;Try zero-padding your data by a large amount (approximating the length of the impulse response associated with your frequency domain compensation), and then use a longer FFT so that circular convolution artifacts don't wrap around in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A smoother frequency compensation curve will usually have a shorter impulse response, thus requiring less zero-padding for a given noise floor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-15T19:07:12.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15667" PostTypeId="1" AcceptedAnswerId="15686" CreationDate="2014-04-15T19:07:21.090" Score="0" ViewCount="1885" Body="&lt;p&gt;i am trying to reconstruct time series from SSA  ,because according to this link&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Singular_spectrum_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Singular_spectrum_analysis&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there is procedure&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;4th step: Diagonal averaging.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i have   with started following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;  B=xlsread('data_generations1','A1','g8:g301');&#xA;  n=length(B);&#xA;  l =input('Give the size of the interval: ' );% Number of columns in the Data matrix&#xA;   m=n-l+1;%number of rows in the Data matrix&#xA; X = zeros(m,l);&#xA;  for i=1:m&#xA;        X(i,:)=B(i:i+l-1);&#xA;  end;&#xA;  [U E V]=svd(X);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;now  which procedure should i make?i should some   eigenvalues right?from example let us consider following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; E=E(:);&#xA;    &amp;gt;&amp;gt; stem(E);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fbLDG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this case  i should  choose  first four eigenvalue right?what i would like  would be if i  will indicate starting index of eigenvalue and ending point of eigenvalue and i will reconstruct time series in these range,how can i do it?please help me&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastActivityDate="2014-04-16T10:52:29.463" Title="reconstruction of time series in SSA" Tags="|matlab|matrix|reconstruction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15668" PostTypeId="2" ParentId="15664" CreationDate="2014-04-15T19:37:06.000" Score="3" Body="&lt;p&gt;First of all, the title of your question is misleading because onset detection is very different from envelope detection. The onset detection function won't tell you how long a note is played or how slow its attack is... the envelope will. If the problem you are trying to solve is envelope detection, you might get inspiration from onset detection literature, but at some points the methods diverge. Onset detection extracts a &quot;cartoon&quot; version of the envelope in which all sudden changes are emphasized to make their detection easy.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I think we then alter those coefficients in such a way that the new&#xA;  Fourier transform coefficients are now balanced perceptually(ie the&#xA;  coefficients are now what a person's ear would perceive them to be)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is done by summing the energy (squared magnitude) of the FFT across 40 ranges of frequencies defined by the mel scale - usually with a triangular shape to emphasize a different center frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check point 4 of my answer to &lt;a href=&quot;https://dsp.stackexchange.com/questions/6499/help-calculating-understanding-the-mfccs-mel-frequency-cepstrum-coefficients&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why and how would we calculate the first order difference?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is the $1 - z^-1$ filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the first order difference is simply the energy in a given Mel band at time t minus the energy in the same Mel band at time t-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are interested in detecting onsets. Onsets are mostly characterized by a sudden rise of energy across the entire spectrum. A positive value of the first order difference indicate that energy is rising in one band. When summing across all bands, this gives a value that is very likely to be high when there is a note onset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do this detection across 40 frequency bands rather than in the time domain to detect events that would be masked by loud sounds in the time domain. For example, imagine a recording in which a high-hat cymbal sound is played on top of a loud, droning bass synth. In the time domain, the envelope of the signal will be a solid line with just a tiny wiggle when the high-hat plays, because the most dominant sound is the bass. But in the frequency domain, the bass note will only occupy the lowest frequencies, and it'll be easy to notice the attack of the high-hat sound, extending from mids to high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why do we need the signal to be locally zero-mean?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It makes it easier to detect onsets by thresholding. The high-pass filter (or subtraction of median, which is another commonly used detrending method) will make sharp peaks in the detection function more prominent.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-04-15T19:37:06.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15669" PostTypeId="2" ParentId="15644" CreationDate="2014-04-15T20:36:55.917" Score="-1" Body="&lt;p&gt;I'll assume that you want to do online monitoring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can always store the coming data from the GUI in a vector in MATLABA.&#xA;Then you can run simple code to plot them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also depends on the type of measurements you have. If the set is capable on detecting power ranges as well you should have the following readings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;High Alpha, Low Alpha, High Beta, Low Beta, High Gamma, Low Gamma, Delta, Theta, Attention, and Meditation. &lt;/p&gt;&#xA;" OwnerUserId="8348" LastActivityDate="2014-04-15T20:36:55.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15670" PostTypeId="1" CreationDate="2014-04-15T21:08:30.650" Score="3" ViewCount="1629" Body="&lt;p&gt;For my project, I needed to detect the primary oscillation frequency in a signal data. As I googled around, it turns out that DCT is the best tool to find this (&lt;a href=&quot;http://www.mech.pku.edu.cn/robot/teacher/wangjiandong/WangHuangLu_ImprovedDCT_CEP_2013.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.mech.pku.edu.cn/robot/teacher/wangjiandong/WangHuangLu_ImprovedDCT_CEP_2013.pdf&lt;/a&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: why would you base the analysis on DCT, and not DFT? What would happen if I were to apply the same analysis but with DFT? I can't accept that DCT is &quot;faster&quot; since for the practice of detecting oscillation, even in real time, both are &quot;fast enough&quot; and so speed and computation complexity should not be a factor into deciding which to pick!&lt;/p&gt;&#xA;" OwnerUserId="8600" LastActivityDate="2014-04-17T10:25:50.480" Title="Why would you use DCT as oppose to DFT for detecting oscillation in a signal?" Tags="|fft|discrete-signals|dft|time-frequency|dct|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15671" PostTypeId="2" ParentId="15661" CreationDate="2014-04-15T21:22:36.177" Score="3" Body="&lt;p&gt;I think Jazzmaniac's suggestion concerning Savitkzy-Golay filters makes a lot of sense. However, I do not suggest to simply smooth your data using these filters. What many people are not aware of is the fact that there are differentiating Savitzky-Golay filters, which smooth and compute the derivative at the same time. Such filters are implemented in Matlab: check &lt;a href=&quot;http://www.mathworks.nl/help/signal/ref/sgolay.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the smoothed derivative to detect your desired starting point. It will still require some heuristics and tweaking, but I do not see any other more straightforward way to do it.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-15T21:22:36.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15672" PostTypeId="2" ParentId="15670" CreationDate="2014-04-15T21:50:20.720" Score="1" Body="&lt;p&gt;Just keepin' it $\Re$eal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT records the timing offset of a particular sinusoid frequency as the phase of the complex coefficient.  Since the DFT of a real signal is conjugate-symmetric, the corresponding negative frequency coefficient gets the same magnitude but negative phase.  FFT routines frequently skip calculating the negative spectrum for real signals.&#xA;This leaves NFFT/2+1 non-redundant complex coefficients, however the DC and Nyquist bins are completely real.  It would be possible to combine the DC and Nyquist bin together, making zero growth in data size (for even length signals anyway).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this kind of flipping between Complex and Real structure may not be convenient for analysis or computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DCT captures essentially the same information about the real signal, except the timing of the sinusoid is encoded as the sum of cosine waves.&#xA;The DCT has the advantage of representing a unitary transform without mixing real and complex numbers.  The DFT is also unitary, but it maps $\mathbb{R^N} \rightarrow \mathbb{C^N}$.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2014-04-17T10:25:50.480" LastActivityDate="2014-04-17T10:25:50.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15673" PostTypeId="1" AcceptedAnswerId="15691" CreationDate="2014-04-15T21:57:16.687" Score="1" ViewCount="2646" Body="&lt;p&gt;I am trying to understand some basic concepts with IFFT as represented here &lt;a href=&quot;https://www.wpi.edu/Pubs/ETD/Available/etd-041806-174713/unrestricted/navalekar.pdf&quot; rel=&quot;nofollow&quot;&gt;OFDM Modem&lt;/a&gt; page 50-53, and 108-114.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some basics that are represented -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The base sampling rate is 8khz.&#xA;The symbol period is 32ms, which would calculate to 250 total samples.&#xA;The fft size is 64.&lt;br&gt;&#xA;The bin separations are 32hz.&#xA;The bandwidth used is from 1000-3000hz(1024-3072?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot get my mind around how to get from a ifft size of 64 to an output bandwidth of 1000-3000 and 32khz spacing.  Is there some basic reason why I wouldn't use a much larger ifft size of something like 256, and then use only 32-96? That would calculate to 31.25hz per bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, this thesis is proposing that you use a fft size of 64 to cover a bandwidth of 2khz beginning at 1khz, 1k-3k.  This isn't coming together for me at all, how this can get shifted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have to be math'ed here, be gentle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First attempt at upconversion using a spreadsheet:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;=(C12*ROW(C12)*EXP(-1*2*PI()*10*ROW(C12)))/ROW(C12)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where 10 is the carrier freq, C(12) is a row containing a sine lookup value.&lt;/p&gt;&#xA;" OwnerUserId="8028" LastEditorUserId="8028" LastEditDate="2014-04-17T17:59:28.887" LastActivityDate="2014-04-17T17:59:28.887" Title="IFFT and OFDM upconversion" Tags="|fft|ofdm|ifft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15674" PostTypeId="2" ParentId="15670" CreationDate="2014-04-15T23:14:57.597" Score="1" Body="&lt;p&gt;Compared to the DFT, the DCT has a better &quot;energy compaction&quot; property for narrow-band oscillations whose frequency is not exactly periodic within the DFT window's length.  This energy compaction may make it easier to spot or discriminate spectral peaks that are &quot;between bins&quot; in an FFT result, and/or that are barely above a given noise floor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-16T00:30:17.243" LastActivityDate="2014-04-16T00:30:17.243" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15675" PostTypeId="2" ParentId="15620" CreationDate="2014-04-15T23:32:32.330" Score="1" Body="&lt;p&gt;As you mention, you could upsample the signal to a sufficiently high rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative would be to compute an interpolation kernel for every desired output sample.  This would probably be pretty inefficient for a large number of output samples.  You could tabulate many interpolation kernels.  That would again leave you with a fixed set of possible offsets, but it might save you time and/or memory.&lt;/p&gt;&#xA;" OwnerUserId="8602" LastActivityDate="2014-04-15T23:32:32.330" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15676" PostTypeId="1" CreationDate="2014-04-16T03:49:20.033" Score="0" ViewCount="289" Body="&lt;p&gt;I have a time series (of 23 timestamps) of which I take the Fourier transform. Now the fourier transform has 23 imaginary values and each has an amplitude and a phase. When I get the phase angle, it given me arctan value of the angle. Now how can I determine if two fourier coefficients are in phase or out of phase.&lt;/p&gt;&#xA;" OwnerUserId="8604" LastActivityDate="2014-04-16T04:59:10.153" Title="How to check if Fourier components are in phase of out of phase?" Tags="|fourier-transform|phase|fourier-series|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15677" PostTypeId="2" ParentId="15676" CreationDate="2014-04-16T04:59:10.153" Score="1" Body="&lt;p&gt;Depends on the phase reference point in time.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the reference point, every DFT basis sinusoid can be either in-phase or out-of-phase (by 180 degrees) with every other basis, thus the same with any coefficient weighting of these basis vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you reference phase to the center of a DFT (using an fftshift), then the angle will tell you whether a particular component has even or odd symmetry relative to the center.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-16T04:59:10.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15678" PostTypeId="1" CreationDate="2014-04-16T05:25:37.357" Score="0" ViewCount="130" Body="&lt;p&gt;If I have a time series (for eg. for 23 timestamps) and if I plot it and see that it is bimodal, that means it might be having high value of second fourier coefficient (with frequency = 2). But when I do the fourier transform I find that the value of second fourier coefficient is very low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, is the following reasoning meaningful for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be the case that although second coefficient has low value but other coefficients having high value are in phase with the second coefficient, hence adding to its amplitude, and that is the reason we are seeing bimodal behavior in original time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS -&#xA;1) By second coefficient, I mean that when we do fourier transform we get a zeroth term for zero frequency, then first and then second.&#xA;2) By coefficient I mean the amplitude of the fourier coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I have a time series (bimodal i.e. with two peaks) and I do its fourier transform, 3rd term has an amplitude of x and phase of p1, where x is a very low value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I also see that 2nd term has an amplitude of y and phase of p1 and 4th term has an amplitude of z and phase of p1. y and z have high values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now do you think that two peaks in the original time series can be attributed to the following reasoning -&#xA;Although 3rd term (for frequency=2, having two peaks) has low amplitude (x) but because 2nd and 4th terms have high amplitudes and same phase, they have added to the amplitude of 2nd term and hence we see two peaks in the original time series?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, instead of 2nd and 4th terms, it can be any coefficients having phase same as the 3rd term.&lt;/p&gt;&#xA;" OwnerUserId="8604" LastEditorUserId="8604" LastEditDate="2014-04-16T07:32:26.923" LastActivityDate="2014-04-16T20:29:52.567" Title="Reason for bimodal behavior while low second fourier coefficient" Tags="|fourier-transform|fourier-series|fourier|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15679" PostTypeId="2" ParentId="15662" CreationDate="2014-04-16T06:19:03.447" Score="1" Body="&lt;p&gt;A wavelet has a shape, seldom a frequency. That is why the Gabor transforms and Gabor wavelet got an extra name. The Mexican hat, for instance, can be more precisely described as having a dominant frequency range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your explanation, the scale direction of the CWT is still missing. The interpretation of convolution is correct. However, in CWT, detection of details or events of a signal is not unique to one time and scale, there will be a time and scale range associated, most often, something looking like a curve in the time-scale image.&lt;/p&gt;&#xA;" OwnerUserId="7396" LastActivityDate="2014-04-16T06:19:03.447" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="15680" PostTypeId="1" CreationDate="2014-04-16T06:20:47.520" Score="0" ViewCount="2302" Body="&lt;p&gt;Connected with &lt;a href=&quot;https://dsp.stackexchange.com/questions/15643/savitzky-golay-filter-parameters/15657?noredirect=1#15657&quot;&gt;this topic &lt;/a&gt;, I would like to have some clarifications about the Fourier Transform and the Python tools that make it.&#xA;Having my data set whose plot is showed in the above link, my array of data is stored in &lt;code&gt;rate&lt;/code&gt;. Then, if I check the result from the Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yfft = np.fft.rfft(rate)&#xA;y_smooth = np.fft.irfft(yfft)&#xA;print y_smooth&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[  3.20000028e+01+0.j          -7.92633533e+00-7.75032655j&#xA;-5.34245688e+00-3.82390808j  -2.39880935e+00-0.60037314j&#xA;-8.71249166e-01-0.04362804j  -8.52507194e-02+1.09973189j&#xA;-1.58332047e-01+1.15256295j  -3.38909974e-01+0.96327143j&#xA; 5.51323015e-02+0.43936749j   3.81205886e-01-0.02489853j&#xA; 2.99110153e-01-0.26319101j   3.28283652e-01+0.11668814j&#xA; 1.08849205e-02-0.11317937j   3.79952011e-01+0.22278952j&#xA; 7.37720998e-02-0.26810083j  -2.14247586e-01-0.25950865j&#xA;-1.32242152e-01+0.j        ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, I am quite confused about this result, and I would need some tips how to interpret these numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The array contains $17$ complex number : does it mean that my signal can be approximated by a superimposition of $17$ harmonics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Are these numbers &lt;em&gt;the power&lt;/em&gt; of each harmonic, or &lt;strong&gt;what&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) are they ordered by the frequency order, or by power? Let's say I want to put to zero the higher orders, which ones should I put to zero?&lt;/p&gt;&#xA;" OwnerUserId="8442" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-04-16T08:14:20.970" Title="How to interpret results of Fourier transform by using Python" Tags="|fourier-transform|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15681" PostTypeId="2" ParentId="15680" CreationDate="2014-04-16T07:15:45.093" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The array contains 17 complex number : does it mean that my signal can&#xA;  be approximated by a superimposition of 17 harmonics?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;16.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first component is the DC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is not specific to your signal. Any real sequence of length 32 can be decomposed as 1 real DC component, 16 complex amplitudes, and 1 real amplitude (32 real number ins, 32 real numbers out).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are these numbers the power of each harmonic, or what?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They are the complex amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;are they ordered by the frequency order, or by power? Let's say I want&#xA;  to put to zero the higher orders&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They are ordered by frequency.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;which ones should I put to zero?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The last ones, but why would you want to do that?&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-16T08:14:20.970" LastActivityDate="2014-04-16T08:14:20.970" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15682" PostTypeId="2" ParentId="15680" CreationDate="2014-04-16T07:15:56.720" Score="3" Body="&lt;p&gt;Your data consist of 32 real values. Its discrete Fourier transform (DFT), which you computed using an FFT (Fast Fourier Transform) algorithm also has 32 (complex) values. However, since your data are real, the Fourier transform is symmetric and the last 15 values are redundant (i.e. can be computed from the other values). This is why you see 17 remaining non-redundant values. These values are no approximation but they are an exact representation of your data, just in a different form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_k=\sum_{n=0}^{N-1}x_ne^{-jnk2\pi/N},\quad k=0,1,\ldots,N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the number of data points (32 in your case). If $x_n$ is real-valued you can show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_k=X^*_{N-k},\quad k=1,\ldots, N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means that all information about your data is contained in the values $X_k$ for $k=0,1,\ldots,N/2$. Note that $X_0$ and $X_{N/2}$ are real-valued. So we have $N/2+1$ non-redundant complex number, two of which are real-valued. So you have $N/2-1$ real and imaginary parts, and 2 real numbers, which in total are exactly $N$ real numbers. No surprise that they are sufficient (and necessary) to represent your $N$ data points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to see how you can interpret the values $X_k$ you need to look at the inverse transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_n=\frac{1}{N}\sum_{n=0}^{N-1}X_ke^{jnk2\pi/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the values $X_k$ are the complex amplitudes of the complex exponentials representing your signal. They are ordered according to frequency. $X_0$ represents the DC value, and $X_{N/2}$ (assuming that $N$ is even) represents the value at half the sampling rate.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-16T07:15:56.720" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15683" PostTypeId="2" ParentId="15678" CreationDate="2014-04-16T07:45:35.523" Score="2" Body="&lt;p&gt;Two peaks does not imply a frequency of 2 - for example the peaks could be very narrow and/or their spacing could corresponding to a much smaller interval than half the time-series length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no information about the overall shape of the time-series that can be drawn from the knowledge of the second DFT coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have plotted here 15 time series (left) and the magnitude of their FFT (right). 5 unimodal, 5 bimodal, and 5 trimodal series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XyBew.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-16T20:29:52.567" LastActivityDate="2014-04-16T20:29:52.567" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15684" PostTypeId="1" AcceptedAnswerId="15692" CreationDate="2014-04-16T00:54:43.233" Score="3" ViewCount="530" Body="&lt;p&gt;I have two sound clips $C_1,C_2$ which are pretty similar.  I'd like to measure how perceptually similar they are, i.e., how similar a human would perceive the two to be.  Is there a way to use a lossy compression algorithm (e.g., a MP3, AAC, or Ogg Vorbis encoder) to compare the two clips?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It occurs to me that that audio compressors already contain a good deal of knowledge about psychoacoustics and human perception of sound, built into them.  Is there a good way to use them to measure how similar the two clips are?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe something like $L(C_1 || C_2) / (L(C_1) + L(C_2))$, where $L(x)$ is the length of the compression of sound clip $x$, and $C_1 || C_2$ is the result of concatenating the two clips?  Or maybe find the highest bitrate such that &#xA;$F(C_1)$ is close to $F(C_2))$ via a simple metric (e.g., L2 norm applied to the FFT spectrum), where $F(C)$ is the result of compressing $C$ at that bitrate followed by decompressing it?  Or something else along these lines?  Has anyone studied this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is relevant, the two clips are fairly similar: one was obtained by a transformation of the other.  They are aligned in time and have the same length.  Each is relatively short (at most a few seconds).  I've done some searching but haven't found any reference or research paper that discusses this sort of approach -- maybe I just haven't found it yet, though.&lt;/p&gt;&#xA;" OwnerUserId="5874" OwnerDisplayName="D.W." LastActivityDate="2014-04-16T15:59:08.857" Title="Measuring similarity of music, using lossy compression" Tags="|algorithms|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15686" PostTypeId="2" ParentId="15667" CreationDate="2014-04-16T08:44:13.397" Score="0" Body="&lt;p&gt;I'm interested in SSA and the related techniques and I made an implementation which may be useful to you. Take a look at this &lt;a href=&quot;http://scilab.org/&quot; rel=&quot;nofollow&quot;&gt;Scilab&lt;/a&gt; code: &lt;a href=&quot;https://gist.github.com/werediver/9785544&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/werediver/9785544&lt;/a&gt; Scilab language is pretty similar to Matlab and the code should be easy to port.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to your questions and your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're applying SVD directly to the trajectory matrix (the time delay embedding of the time series). That's possible and will work, but usualy SVD is applied to the covariance matrix $C=XX'$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right after SVD you have the eigenvalues (they are shown on your plot), but SSA is not done yet. Next, you need to compute the principal components of the trajectory matrix: $V_i=\frac{X'U_i}{\sqrt{\lambda_i}} (i=1,...,L)$ You need $\sqrt{\lambda_i}$ when applying SVD to the covariance matrix and just $\lambda_i$ when SVD is applied directly to the trajectory matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now the SSA decomposition is done and you want a partial reconstruction. The time domain representation of $V_i$ is $X_i=\sqrt{\lambda_i}U_iV_i'$. These components are additive so sum all the components you're interested in and then apply diagonal averaging to get from $X_I$ to univariate time series. Diagonal averaging produces a vector from averaged antidiagonals of the $X_I$ matrix, take a look at my implementation for example.&lt;/p&gt;&#xA;&#xA;&lt;hr/&gt;&#xA;&#xA;&lt;p&gt;I can point you to a good description of Basic SSA: &lt;a href=&quot;http://www.springer.com/statistics/statistical+theory+and+methods/book/978-3-642-34912-6&quot; rel=&quot;nofollow&quot;&gt;Singular Spectrum Analysis for Time Series&lt;/a&gt; book by N. Golyandina &amp;amp; A. Zhigljavsky has freely available sample, &lt;a href=&quot;http://www.springer.com/cda/content/document/cda_downloaddocument/9783642349126-c2.pdf?SGWID=0-0-45-1373628-p174720085&quot; rel=&quot;nofollow&quot;&gt;Chapter 2: Basic SSA&lt;/a&gt;. This chapter completely covers Basic (univariate) SSA decomposition &amp;amp; reconstruction algorithms and gives many advices on interpretation of the decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also pretty good book (teaching aid) in Russian language if it's appropriate for you: &lt;a href=&quot;http://www.gistatgroup.com/gus/ssa_an.pdf&quot; rel=&quot;nofollow&quot;&gt;Метод «Гусеница»-SSA: анализ временных рядов&lt;/a&gt;  by N. Golyandina.&lt;/p&gt;&#xA;" OwnerUserId="8540" LastEditorUserId="8540" LastEditDate="2014-04-16T10:52:29.463" LastActivityDate="2014-04-16T10:52:29.463" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="15687" PostTypeId="1" CreationDate="2014-04-16T08:53:25.137" Score="6" ViewCount="1609" Body="&lt;p&gt;I have been reading about eigen values and eigen vectors but I haven't been able to find any decent explanation relating their application in Image Processing / Computer Vision.&lt;/p&gt;&#xA;&lt;p&gt;For example, How can those be used for face detection and eye detection? Can somebody please through some light on this?&lt;/p&gt;&#xA;" OwnerUserId="8435" LastEditorUserId="128" LastEditDate="2022-01-19T18:41:56.940" LastActivityDate="2024-04-01T15:02:33.923" Title="Eigen Values and Eigen Vectors in Image Processing" Tags="|image-processing|computer-vision|linear-algebra|face-detection|eigendecomposition|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15689" PostTypeId="1" AcceptedAnswerId="15699" CreationDate="2014-04-16T11:43:10.050" Score="0" ViewCount="134" Body="&lt;p&gt;let say we have  some data,some signal written in this form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)=s(t)+\epsilon(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where  $s(t)$ is pure signal and  $\epsilon(t)$ is  white noise  with mean zero and some variance  ,question is that if we have enough sample data,should  periodogram always  estimate frequencies  correctly?let say we have following sinusoidal data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[t]=A_1(sin(\omega_1*t+\phi_1)+A_2*sin(\omega_2*t+\phi_2)+....+A_p*sin(\omega_p*t+\phi_p)$+$z(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i know that there is problem of variance increasing related to periodogram,but will it affect on frequency estimation?also i know that  resolution of periodogram is $1/N$,but let us suppose that  two frequency are not so close to each other,then will periodogram produce correct frequency estimation?variance is not important for me know&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastActivityDate="2014-04-16T21:24:28.220" Title="will always periodogram produce correct frequencies?" Tags="|matlab|superresolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15690" PostTypeId="2" ParentId="15687" CreationDate="2014-04-16T12:04:36.530" Score="1" Body="&lt;p&gt;I will try giving you some intuition.&lt;br /&gt;&#xA;The SVD says each matrix can be decomposed into 3 operations - Rotation, Stretching (Scaling) and the another Rotation.&lt;/p&gt;&#xA;&lt;p&gt;What matters is which directions are scaled and how.&lt;br /&gt;&#xA;Directions are vectors (Pointing some direction).&lt;/p&gt;&#xA;&lt;p&gt;The SVD has many uses in Linear Algebra.&lt;br /&gt;&#xA;One its most known use is &lt;a href=&quot;https://en.wikipedia.org/wiki/Low-rank_approximation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Low Rank Approximation of a matrix&lt;/a&gt;.&lt;br /&gt;&#xA;Low rank meaning to try represent the same data with lower number of degrees of freedom.&lt;/p&gt;&#xA;&lt;p&gt;It is immediately rings a bell for compression and dimensionality reduction (Also the SVD is practically the basis for &lt;a href=&quot;https://en.wikipedia.org/wiki/Karhunen%E2%80%93Lo%C3%A8ve_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Karhunen Loève Compression&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h2&gt;Image Compression&lt;/h2&gt;&#xA;&lt;p&gt;Think of decomposing the image into patches of &lt;span class=&quot;math-container&quot;&gt;$ n \times n $&lt;/span&gt; (Where usually &lt;span class=&quot;math-container&quot;&gt;$ n = 8 $&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$ n = 16 $&lt;/span&gt;).&lt;br /&gt;&#xA;Now build a matrix of those patches (Each patch as a column).&lt;br /&gt;&#xA;Then, using the SVD you will be able to find a low rank representation of this image which is basically a compression.&lt;br /&gt;&#xA;Why isn't it used?&lt;br /&gt;&#xA;Because this is the most effective compression in &lt;span class=&quot;math-container&quot;&gt;$ {L}_{2} $&lt;/span&gt; sense yet the base it uses is adaptive to the image. Namely with each compressed image you'll have also to deliver the base which hurts the practical compression ratio.&lt;br /&gt;&#xA;But this is the idea.&lt;/p&gt;&#xA;&lt;h2&gt;Eigen Faces&lt;/h2&gt;&#xA;&lt;p&gt;This is a nice implementation of idea using SVD.&lt;br /&gt;&#xA;You can read about in the great article on &lt;a href=&quot;https://en.wikipedia.org/wiki/Eigenface&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Eigen Face&lt;/a&gt; (Including Code).&lt;br /&gt;&#xA;Basically, again, you can use the low rank representation either to compress the data base of faces and / or use it as a method to recognize faces.&lt;/p&gt;&#xA;&lt;h2&gt;Compressed Sensing&lt;/h2&gt;&#xA;&lt;p&gt;The SVD is heavily used in the Compressed Sensing frame work.&lt;br /&gt;&#xA;For instance have a look on the Dictionary Learning method called - &lt;a href=&quot;https://en.wikipedia.org/wiki/K-SVD&quot; rel=&quot;nofollow noreferrer&quot;&gt;K-SVD&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Image Smoothing&lt;/h2&gt;&#xA;&lt;p&gt;The SVD is used to decompose the &lt;a href=&quot;https://en.wikipedia.org/wiki/Structure_tensor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tensor Structure Vector&lt;/a&gt; and infer about the directions of gradients in the patch.&lt;br /&gt;&#xA;For instance look at the work: &lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S0262885698001024&quot; rel=&quot;nofollow noreferrer&quot;&gt;Joachim Weickert - Coherence Enhancing Diffusion of Colour Images&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Feature Extractor (Corner Detection)&lt;/h2&gt;&#xA;&lt;p&gt;The Eigen Decomposition (Eigen Values) is used to analyze the structure tensor in order to detect corners.&lt;br /&gt;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Harris_corner_detector&quot; rel=&quot;nofollow noreferrer&quot;&gt;Harris Corner Detector&lt;/a&gt; uses trace and determinant to approximate the smallest eigenvalue, to save computations. The Shi-Tomasi variant directly computes the smallest eigenvalue.&lt;/p&gt;&#xA;&lt;p&gt;The Wikipedia article about the SVD is really great place start reading about it - &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Singular Value Decomposition&lt;/a&gt; (SVD).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark&lt;/strong&gt;: Information on the smoothing and corner detection is credited to &lt;a href=&quot;https://dsp.stackexchange.com/users/33605/cris-luengo&quot;&gt;@Cris Luengo&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2024-04-01T15:02:33.923" LastActivityDate="2024-04-01T15:02:33.923" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15691" PostTypeId="2" ParentId="15673" CreationDate="2014-04-16T13:30:36.043" Score="4" Body="&lt;p&gt;To explain the supposed contradiction between the number of samples calculated by symbol length and sampling rate on the one hand and the IFFT size on the other hand, you have to take into account that the IFFT output is upsampled by a factor of 4. This means that for every output sample of the IFFT block there are four samples after upsampling. There's a cyclic prefix of 16 samples so that we arrive at a total number of samples of $N=4\cdot(64+16)=320$ as stated on page 53.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand we can calculate the number of samples by $N=Tf_\mathrm{S}=32\mathrm{ms}\cdot8\mathrm{kHz}=256$. The symbol duration $T$ has been taken from page 108. It think the guard interval has not been taken into account there and thus $N=64\cdot4=256$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process that is described as &quot;upconversion&quot; is exactly the frequency shift that you are observing (cf. figure 3-8). Citing from the report:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Once the baseband signal has been interpolated it is multiplied with&#xA;  the audio band carrier frequency to obtain a audioband representation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To make this more clear using a formula, let $x(t)$ be the complex, analog OFDM signal (after digital-to-analog conversion (DAC)) and let $f_0$ be the desired carrier frequency. Then the radio frequency, upconverted signal $y(t)$ is&#xA;$$&#xA;y(t) = x(t)\operatorname{exp}(j2\pi f_0 t)&#xA;$$&#xA;This is a basic concept required in almost every radio system. For more information you might want to do some reserach on &lt;em&gt;radio frequency upconversion&lt;/em&gt; and &lt;em&gt;I/Q modulation&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The baseband bandwidth of an OFDM signal is approximately $f_\mathrm{S}/2$. But again, here we have to take the upsampling into account. If it is done correctly, it won't change the bandwidth of the signal. I.e. the sampling frequency &lt;em&gt;before&lt;/em&gt; upsampling is actually $f_\mathrm{S}/4 = 2\mathrm{kHz}$ and we have to use this frequency for calcuating the OFDM signal bandwidth wich here is $B=1\mathrm{kHz}$. Finally, the band occupied by the radio frequency signal is $f_0 - B\ldots f_0+B$ which corresponds to 1kHz to 3kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning your suggestion to use a greater IFFT size and to left some subcarriers unmodulated to achieve upconversion - this is a valid approach in this specific example. Note however, that in general it requires a larger sampling frequency which is often undesirable.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-04-16T13:30:36.043" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15692" PostTypeId="2" ParentId="15684" CreationDate="2014-04-16T14:11:11.173" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a good way to use them to measure how similar the two clips&#xA;  are?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a very sane intuition but something I have rarely seen in the literature - outside the peripheral idea of doing feature extraction from compressed streams (and the motivation here is just the reduced computational burden).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the major reason is that audio codecs do not store a perceptual representation of the audio data. Instead, they store a very coding-centric representation of audio - entropy-coded, quantized, coefficients of a transform - chosen so that the distortion between the original and the encoded signal falls below the threshold of perception. In a sense, looking at a compressed audio stream does not tell you anything about how a human would perceive the audio signal. It just tells you that anything that would fall below the perception thresholds has been taken away. The codec &quot;carves&quot; around the meaningful audio signal, but never touches it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;where L(x) is the length of the compression of sound clip x, and C1||C2 is the result of concatenating the two clips?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This makes sense on strings - I think this idea is found in some papers by Cilibrasi or Vitanyi - but this is not how audio codecs work. The audio codecs you mention are designed to process streaming audio with low latency, so they only &quot;see&quot; a short window of the signal at a time and do not attempt to eliminate long term redundancy. Just like JPEG for images. Copying 10 instances of the same note one after the other will result in a file 10x as large. Audio codecs have a fixed bit-rate, or an adaptive bit-rate that is adapted according to the content of the narrow window of signal that the codec sees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The redundancy eliminated by an audio codec is very short-term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your idea would require a much more sophisticated &quot;objet oriented&quot; codec that attempts to decompose the audio into a hierarchy of objects, such as notes. This idea is still in its infancy in the academic world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to look at it is to check if the decoding process bears similarity with a generative model of the signal. This is the case for some string compression algorithms, where the compression process recovers something akin to a generative grammar of the string (Sequitur, factor oracles...). This is the case for LPC-based speech codecs in which the LP coefficients embed knowledge about the articulation, and the residual knowledge about prosody and voicing/unvoicing - the compressed stream can be seen as data for a speech synthesizer. But this is not the case for general purpose audio codecs like the ones you mention - the decoder bears no similarities with the music production process.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Or maybe find the highest bitrate such that F(C1) is close to F(C2)) via a simple metric (e.g., L2 norm applied to the FFT spectrum)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You might do the opposite - look at the bitrate under which the clips become indistinguishable, but ultimately it wouldn't be that much easier than comparing sinusoidal representations pruned by a perceptual function.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-16T15:59:08.857" LastActivityDate="2014-04-16T15:59:08.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15695" PostTypeId="1" AcceptedAnswerId="15696" CreationDate="2014-04-16T18:30:29.403" Score="0" ViewCount="210" Body="&lt;p&gt;I am reading &lt;a href=&quot;http://www.mobileer.com/login/reg/direct_vs_wavetable.pdf&quot; rel=&quot;nofollow&quot;&gt;Direct Synthesis versus Wavetable Synthesis&lt;/a&gt;. The quote below explains code I have read but I don't get why it's a division by the integer multiple, when multiples increase in frequency. Doesn't that mean we need more samples (higher sample rate mapping to more samples for same accuracy) to deal with the higher frequencies, resulting in a larger wavetable.? &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you play a loop of a wavetable that is exactly one period at the fundamental frequency then the harmonic partials will fit within that loop. That is because the period of the harmonic partials are the fundamental period divided by N.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2014-04-16T19:58:51.107" LastActivityDate="2014-04-16T20:51:36.810" Title="Wavetables and Partials" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15696" PostTypeId="2" ParentId="15695" CreationDate="2014-04-16T19:41:26.027" Score="2" Body="&lt;p&gt;Harmonic partials have frequencies $f_i=if_1$, $i=2,3\ldots,$ where $f_1$ is the fundamental frequency. So the frequencies are not doubled, but they are integer multiples of the fundamental frequency. But if you talk about periods, then you have $T_i=1/f_i$, i.e. $T_i=T_1/i$, $i=2,3,\ldots$. So the period of the $i^{th}$ harmonic partial is the fundamental period divided by $i$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-16T19:41:26.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15697" PostTypeId="2" ParentId="15695" CreationDate="2014-04-16T20:51:36.810" Score="1" Body="&lt;p&gt;The number of samples per wave is reduced for higher frequency pitches so that the sample rate can stay constant.  This requires low-pass filtering out some of the highest frequency overtones before or at the time of the resampling to prevent aliasing at the target sample rate.  But normally, this sample rate is chosen so that anything above this low pass filter cut-off frequency is inaudible to humans.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-16T20:51:36.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15698" PostTypeId="2" ParentId="14667" CreationDate="2014-04-16T21:10:20.663" Score="-1" Body="&lt;p&gt;This is a 2 parts answer:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Given a discrete representation of the Spectral Data does necessarily represent a periodic function in the time domain?&lt;br /&gt;&#xA;Well, it is by definition. Look, the DFT is a fancy name to a scaled Discrete Fourier Series, namely combination of harmonic signals. By the nature they are all an integer multiplication of a base frequency. Now think about a linear combination of &lt;strong&gt;finite number of&lt;/strong&gt; harmonic signals which all are multiplication of known frequency -&amp;gt; It must be a periodic signal. You can also derive and see that the period is known, it is the length of the samples window to the most.&lt;/li&gt;&#xA;&lt;li&gt;Can all periodic signals be represented by a Fourier Series?&lt;br /&gt;&#xA;Now you are asking about convergence and there are few requirements about signals to be represented by a Fourier Series which deals with the ability to integrate them over the period. Another issue, when you say Fourier series, remember an infinite number of signals are considered.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-05-27T03:43:02.680" LastActivityDate="2022-05-27T03:43:02.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15699" PostTypeId="2" ParentId="15689" CreationDate="2014-04-16T21:12:27.230" Score="0" Body="&lt;p&gt;A periodogram created from a finite number of samples using an DFT is not really a &quot;correct&quot; frequency estimator, as much as it is a (leaky) frequency energy binning sieve, where the width of each bin is set by the DFT length and the window function applied.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The width and spacing of each bin may or may not be narrow enough for you to consider an error of up to half that size to still result in a useful frequency estimate.  Various interpolation methods that post-process DFT results may allow more precise estimates of spectral peaks than the bin spacing.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-16T21:12:27.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15700" PostTypeId="2" ParentId="15689" CreationDate="2014-04-16T21:24:28.220" Score="0" Body="&lt;p&gt;You will get good frequency information from a periodogram if, as you say, you have enough data to resolve the frequencies to the desired resolution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important that your signal be band limited to 1/2 the sample rate of the data for your periodogram.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2014-04-16T21:24:28.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15703" PostTypeId="2" ParentId="15620" CreationDate="2014-04-17T07:20:20.433" Score="1" Body="&lt;p&gt;In case someone else has any use for it here's some MATLAB code similar to what I ended up using. It basically filters the WGN, splits it up to separate signals for each sampler, upsamples these signals and filters with a fractional delay filter approximation (truncated version of ideal step response used as FIR filter). This would approximate the effects of time-interleaved sampling with fixed time-delays for each sampler (generated randomly in the code provided). There's also a commented-out line which can be used to test with a sine-wave input.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;% Number of samplers&#xA;nSamplers         = 2;&#xA;&#xA;% Use 50 taps for the fractional delay filter&#xA;nSideTaps         = 50;&#xA;n                 = -nSideTaps:nSideTaps;&#xA;&#xA;% Generate noise&#xA;nSamples          = 1E4*nSamplers;&#xA;whiteNoise        = randn(nSamples, 1);&#xA;% whiteNoise        = sin(2*pi*0.1*(1:numel(whiteNoise))); % Sine test&#xA;&#xA;% Band-limit noise&#xA;D                 = fdesign.lowpass('Fp,Fst,Ap,Ast', 0.5, 0.65, 2, 100);&#xA;lpFilterDesign    = design(D);&#xA;blNoise           = filter(lpFilterDesign.Numerator, 1, whiteNoise);&#xA;&#xA;% Reshape such that each row corresponds to a single sampler&#xA;blNoise           = reshape(blNoise, nSamplers, []);&#xA;&#xA;% Initialize sampled signal&#xA;sampledSignal     = zeros(numel(blNoise), 1);&#xA;fracDelays        = 0.05 * randn(nSamplers, 1); % Randomly chose delay times, standard deviation 5%&#xA;for i = 1:nSamplers&#xA;   bFracDelay        = sin(pi*(n'-fracDelays(i)))./(pi*(n'-fracDelays(i)));&#xA;   sampledSignal     = sampledSignal + filter(bFracDelay, 1, upsample(blNoise(i,:), nSamplers, i-1))';&#xA;end&#xA;&#xA;% Reshape to sub-adcs&#xA;sampledSignal     = reshape(sampledSignal, nSamplers, []);&#xA;&#xA;figure()&#xA;plot(20*log10(abs(fft(sampledSignal(nSamples/2+1:end)))));&#xA;title('FFT of sampled signal')&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8578" LastActivityDate="2014-04-17T07:20:20.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15705" PostTypeId="1" AcceptedAnswerId="15707" CreationDate="2014-04-17T11:43:28.037" Score="6" ViewCount="667" Body="&lt;p&gt;let us consider following graph of singular values &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VSp8k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i want to make  some kind of  clustering of these data,namely to  seperate  main components from non main components,let say signal components from noise components,i would like to do like this(any software matlab,etc is great,better matlab)let us start like this  ,first do linear regression  with first point,then do regression analysis with first two point and so on,point is that  one want to  create two group,in first group   coefficients of  regression lines should be  close to each other, also in another group  regression coefficients should be close to each other,but regression  coefficients  in one group must be different then coefficients in another group,that means that we should find such point which separate this group optimally,  in other word i should stop regression analysis at some point which  well separate  two group,and another regression will start from this stop point till other rest points,please help me how to do it programaticaly&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="37293" LastEditDate="2018-09-09T15:27:17.303" LastActivityDate="2022-01-19T18:03:56.493" Title="Separate Signal Values from Noise" Tags="|matlab|machine-learning|denoising|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15706" PostTypeId="2" ParentId="15705" CreationDate="2014-04-17T12:19:15.783" Score="0" Body="&lt;p&gt;I would use the SVD (Singular Value Decomposition).&#xA;By looking at the Singular Values I'd determine which vectors spread the data and which spread the noise.&lt;/p&gt;&#xA;&lt;p&gt;You may use approach like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Elbow_method_(clustering)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elbow method&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Practically, they both do both, but if we speak which are dominant, this would be a great starting point.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-01-19T18:03:56.493" LastActivityDate="2022-01-19T18:03:56.493" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15707" PostTypeId="2" ParentId="15705" CreationDate="2014-04-17T12:36:57.013" Score="0" Body="&lt;p&gt;You question is pretty broad and you didn't even mentioned that you're using &lt;a href=&quot;http://en.wikipedia.org/wiki/Singular_Spectrum_Analysis&quot; rel=&quot;nofollow&quot;&gt;SSA&lt;/a&gt; (at the moment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're asking for interpretaion of SSA decomposition. This topic is rather complex and pretty difficult to automate, but there are much information on this in chapter 2.4 &quot;Choice of Parameters in Basic SSA&quot; of the book &lt;a href=&quot;http://www.springer.com/statistics/statistical+theory+and+methods/book/978-3-642-34912-6&quot; rel=&quot;nofollow&quot;&gt;Singular Spectrum Analysis for Time Series&lt;/a&gt; by N. Golyandina &amp;amp; A. Zhigljavsky (&lt;a href=&quot;http://www.springer.com/cda/content/document/cda_downloaddocument/9783642349126-c2.pdf?SGWID=0-0-45-1373628-p174720085&quot; rel=&quot;nofollow&quot;&gt;chapter 2&lt;/a&gt; is freely available).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also search by keywoard &quot;&lt;strong&gt;AutoSSA&lt;/strong&gt;&quot; to get some related information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, SSA can not separate everything because there can be nonseparable components in the signal. Even noise can be nonseparable from the signal.&lt;/p&gt;&#xA;" OwnerUserId="8540" LastActivityDate="2014-04-17T12:36:57.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15708" PostTypeId="1" AcceptedAnswerId="15788" CreationDate="2014-04-17T13:30:29.890" Score="1" ViewCount="1046" Body="&lt;p&gt;My problem should probably be built up from the beginning, so lets start there. I performed a certain experiment 25 times. Every time, the experiment consists of 5000 measurements, and each measurement returns either 1 ('yes') or 0 ('no'). I know that each time I measure 1, the probability that this measurement is correct is $F_1$, while if I measure 0 I know that it's correct with probability $F_0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, subsequently I want to compute the autocorrelation function of these measurements I use the following formula&#xA;&lt;img src=&quot;https://i.stack.imgur.com/G3L64.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with a slightly different normalization, but in principle that should not matter, because what I want to do is fit this autocorrelation to an exponential decay and find the decay time. To do so, I thought I had two options: Either I fit the 25 datasets separately, and then find the mean of the decay time $t_1$ and maybe say something about its variance, or I can find the mean autocorrelation of the 25 datasets, and fit that one. I've decided that that is probably the best option, as the individual datasets can be quite noisy with strange fluctuations, while the mean looks much cleaner. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now I'm stuck wondering what I should be doing to find the uncertainty in the fit. Should I have introduced some sort of uncertainty due to the imperfect measurements ($F_0$ and $F_1$), or should I have introduced some sort of standard error of the mean for the 'mean autocorrelation' data? That last one seems plausible, as of course there is also a standard deviation in the 25 datasets, but then I get a little confused as to how I should do that. The formula for the standard error of the mean seems to be $\frac{\sigma}{\sqrt{n}}$, but this is a bit unfair as in my 5000 measurements, the autocorrelation drops to 0 after around 50 measurements. For the fit I therefore also only use the first ~100 points of the autocorrelation, as there's no real need to fit the next 4000 points that are all pretty much equal to 0. So should I instead only calculate the mean and standard error of the first 100 points? Would that be a fair way of finding the uncertainty? The subsequent fitting method will already give error bars for the $t_1$, but this of course heavily depends on the uncertainty in the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A final sort of sidetrail, what kind of quantitative method of finding how good I fit should I use for exponential decay? Reduced Chi square, Adjusted R squared, or something else entirely? I suppose this is not intended for dsp though, more for a statistics forum, so feel free to ignore it.&lt;/p&gt;&#xA;" OwnerUserId="8593" LastActivityDate="2014-04-22T11:32:57.180" Title="Determining the uncertainty of an autocorrelation" Tags="|autocorrelation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15709" PostTypeId="2" ParentId="15538" CreationDate="2014-04-17T14:16:02.650" Score="1" Body="&lt;p&gt;I've tried a copule of methods on your data (low-pass filtering via DFT, SSA filtering), but I don't know what result will satisfy you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mentioned that the signal is sampled with a higher-then-enough frequency. Can you rise the  sampling frequency even higher? I'm talking about &lt;a href=&quot;http://en.wikipedia.org/wiki/Oversampling&quot; rel=&quot;nofollow&quot;&gt;oversampling&lt;/a&gt;. This can help to get rid of some part (some kind) of the noise present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also mentioned PCA and that it's not appropriate for univariate time series. Right, PCA is almost useles with univariate time series, but there is an appropriate and closely related technique, &lt;a href=&quot;http://en.wikipedia.org/wiki/Singular_spectrum_analysis&quot; rel=&quot;nofollow&quot;&gt;SSA&lt;/a&gt;. You can find detailed description here: &lt;a href=&quot;http://www.springer.com/statistics/statistical+theory+and+methods/book/978-3-642-34912-6&quot; rel=&quot;nofollow&quot;&gt;Singular Spectrum Analysis for Time Series&lt;/a&gt; (free sample is enough: &lt;a href=&quot;http://www.springer.com/cda/content/document/cda_downloaddocument/9783642349126-c2.pdf?SGWID=0-0-45-1373628-p174720085&quot; rel=&quot;nofollow&quot;&gt;Chapter 2: Basic SSA&lt;/a&gt;). And my own GNU Octave (hope Matlab compatible) implementation here: &lt;a href=&quot;https://gist.github.com/werediver/10886388&quot; rel=&quot;nofollow&quot;&gt;ssa-octave.m&lt;/a&gt; (there is also Scilab implementation, but you probably don't need it). Take a look at chapter 2.4 &quot;Choice of Parameters in Basic SSA&quot; for interpretation and tuning tips.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also not clear to me: the &quot;5 seconds of stationary&quot; pattern in isometric data sample should be filtred out or it is a useful signal too?&lt;/p&gt;&#xA;" OwnerUserId="8540" LastEditorUserId="8540" LastEditDate="2014-04-17T14:28:17.743" LastActivityDate="2014-04-17T14:28:17.743" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15710" PostTypeId="1" CreationDate="2014-04-17T14:39:34.377" Score="5" ViewCount="26542" Body="&lt;p&gt;I read that multiplication is convolution in frequency domain. I also understand that convolution is just polynomial multiplication. Can somebody explain what are the advantages of doing convolution in frequency domain? Also, i would like to know how to multiply two signals in time domain and what is the significance of it.&lt;/p&gt;&#xA;" OwnerUserId="8435" LastEditorUserId="128" LastEditDate="2020-03-22T01:02:06.873" LastActivityDate="2020-03-22T01:02:06.873" Title="Difference Between Convolution and Multiplication" Tags="|fourier-transform|convolution|" AnswerCount="3" CommentCount="0" ClosedDate="2014-05-06T17:18:51.117" ContentLicense="CC BY-SA 4.0" />
  <row Id="15711" PostTypeId="2" ParentId="15710" CreationDate="2014-04-17T15:00:17.590" Score="2" Body="&lt;p&gt;It is significant that you can do &lt;em&gt;time domain convolution&lt;/em&gt; via &lt;em&gt;frequency domain multiplication&lt;/em&gt;. This can be done in less time due to existence of &lt;em&gt;highly&lt;/em&gt; optimized &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Fast Fourier Transformation&lt;/a&gt; algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time domain convolution has great significance in DSP at least because this way we can apply a &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response&quot; rel=&quot;nofollow&quot;&gt;FIR-filter&lt;/a&gt; to a signal.&lt;/p&gt;&#xA;" OwnerUserId="8540" LastActivityDate="2014-04-17T15:00:17.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15713" PostTypeId="2" ParentId="15710" CreationDate="2014-04-17T15:25:21.367" Score="8" Body="&lt;p&gt;&lt;em&gt;Multiplication&lt;/em&gt; in your first sentence is &lt;em&gt;term-by-term&lt;/em&gt; multiplication: $z[n] = x[n]y[n]$ for all $n$. Convolution, for discrete-time sequences, is equivalent&#xA;to &lt;em&gt;polynomial&lt;/em&gt; multiplication which is &lt;em&gt;not&lt;/em&gt; the same as the term-by-term&#xA;multiplication. Convolution also requires a lot more calculation: typically $N^2$&#xA;multiplications for sequences of length $N$ instead of the $N$ multiplications&#xA;of the term-by-term multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key point of Fourier analysis is that term-by-term multiplication in &lt;em&gt;one&lt;/em&gt;&#xA;domain is the same as convolution in the &lt;em&gt;other&lt;/em&gt; domain.  So, in order&#xA;to calculate the results of a convolution, you can either do it directly,&#xA;using $N^2$ multiplications, &lt;em&gt;or&lt;/em&gt; transform to the other domain, do a term-by-term&#xA;multiplication, and transform back. This requires two transformations&#xA;to go from one domain to the other, $N$ multiplications in the other domain,&#xA;and one &lt;em&gt;inverse&lt;/em&gt; transformation to come back to the domain&#xA;where the convolution result is needed. This more complicated process&#xA;can, in fact, require less computation because the transformations can&#xA;be done very efficiently via the &lt;em&gt;Fast Fourier Transform&lt;/em&gt; (FFT) algorithm&#xA;which requires about $N \log N$ multiplications. So, compare the computational&#xA;effort in calculating the three transforms and doing the term-by-term&#xA;multiplication&#xA;to $N^2$ to see if the FFT gives you a more efficient method of computing&#xA;a convolution.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-04-17T18:39:14.243" LastActivityDate="2014-04-17T18:39:14.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15714" PostTypeId="1" CreationDate="2014-04-17T15:37:46.297" Score="0" ViewCount="394" Body="&lt;p&gt;I have a discrete signal of random length (let's say between 500 and 800 in time). This signal has an important information which I want to collect and to put it together in a feature vector to train a classifier. The signal also comes in random phase and in random scale (it depends on the distance to the sensor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there are some constraints: the feature vector has to be invariant to scale and phase, it has to be a sparse representation of the information contained in the signal and it has to deal with the problem of different signal length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have followed a classic approach to solve this problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculate the Fourier coefficients of the signal, a[n] and b[n]. I take as feature vectors the most significant coefficients for my problem (I fix this parameter experimentally). To solve the problem of scale and phase invariance I consider only the normalized magnitude r[n] = s[n]/s[0] where s[n] = sqrt(a[n]^2+b[n]^2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This solution actually works quite well, but I am sure that there has to be something more &quot;up-to-date&quot; to solve that. I would really appreciate any alternative approaches to solve this problem or some references to read. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8617" LastActivityDate="2014-04-17T15:37:46.297" Title="Extracting features from a signal: a 21st century approach?" Tags="|fft|signal-analysis|machine-learning|information-theory|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15715" PostTypeId="2" ParentId="1334" CreationDate="2014-04-17T16:04:33.253" Score="0" Body="&lt;p&gt;As pv. said DFT is obtained by sampling the DTFT in &quot;Frequency Domain&quot;. As you might know a discrete-time signal is obtained by sampling a continuous-time signal. However, to construct the continuous-time signal perfectly from its discrete-time counterpart, the sampling rate MUST be greater than the Nyquist rate. To make this happen, the continuous-time signal has to be frequency limited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the DTFT and DFT the story is somehow reversed. You have DTFT that is continuous in &quot;Frequency&quot; domain. Basically you cannot store a continuous signal and process it in a computer. The solution is sampling! So, you sample from the DTFT and call the result DFT. However, according to sampling theorem to reconstruct the DTFT perfectly from DFT, the time-domain counterpart of DTFT MUST be &quot;time&quot;-limited. That's why one has to use windowing before taking the DFT. &lt;/p&gt;&#xA;" OwnerUserId="8554" LastActivityDate="2014-04-17T16:04:33.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15716" PostTypeId="2" ParentId="15655" CreationDate="2014-04-17T17:19:21.853" Score="1" Body="&lt;p&gt;4:2:2 means the color information has half the horizontal sample rate compared to the luminance.  Depending on the input, this lower sample rate may require having a low pass filter in the color channels.  Different cards may use different filters in phase and frequency response, resulting in slightly different results near any sharp transitions.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-17T17:19:21.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15717" PostTypeId="2" ParentId="15597" CreationDate="2014-04-17T17:26:19.223" Score="0" Body="&lt;p&gt;Assuming you are sampling above the Nyquist rate, then an interpolation kernel or equivalent fractional FIR filter on one or both channels (both to match up any non-zero processing delays) might be an appropriate solution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-17T17:26:19.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15718" PostTypeId="2" ParentId="15665" CreationDate="2014-04-17T18:17:10.597" Score="0" Body="&lt;p&gt;You need to make sure you window the time domain signal before FFT and after IFFT. From the diagrams, it looks like you have 'clicks' at each end of the signal, this is common when 'correcting' a system as you'll be modifying frequencies which may not be non-zero at the edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need a consistent frequency domain plot, it might be best to use the windowed overlap-add method.&lt;/p&gt;&#xA;" OwnerUserId="8618" LastActivityDate="2014-04-17T18:17:10.597" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15719" PostTypeId="1" CreationDate="2014-04-17T21:37:53.350" Score="0" ViewCount="74" Body="&lt;p&gt;How can you filter out a person's voice from a group of people talking? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a sample of each person's voice from the group, and the sample of the entire group talking at once. Both samples are uploaded into matlab for analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to single out any one person's voice?&lt;/p&gt;&#xA;" OwnerUserId="8622" LastActivityDate="2014-04-18T10:45:41.583" Title="Speaker Recognition" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15720" PostTypeId="1" CreationDate="2014-04-18T06:31:12.623" Score="2" ViewCount="1638" Body="&lt;p&gt;I am trying to do the complex trace analysis of a seismic trace in Matlab where I need to calculate the instantaneous frequency of a discrete signal. I have used the formula according to &lt;a href=&quot;http://library.seg.org/doi/abs/10.1190/1.2785048&quot; rel=&quot;nofollow&quot;&gt;Barnes&lt;/a&gt;. I am running an algorithm where I need to iteratively run complex trace analysis on the residual trace obtained after subtracting a matching wavelet from this trace. Though the formula gives me the results for lower frequencies &amp;lt;50 Hz, it does not give the right results for &gt;60 Hz. I am not able to understand why this is happening. Can someone please tell me the reason behind this and how to do this correctly?&lt;/p&gt;&#xA;" OwnerUserId="8243" LastEditorUserId="128" LastEditDate="2023-03-28T14:43:31.407" LastActivityDate="2023-03-29T03:06:45.857" Title="How to calculate the instantaneous frequency of a signal?" Tags="|signal-analysis|instantaneous-frequency|" AnswerCount="5" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="15723" PostTypeId="2" ParentId="15719" CreationDate="2014-04-18T08:24:28.960" Score="2" Body="&lt;p&gt;IMHO,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using several microphones (at least 2 like our ears) may help. There will be some constant delay in the time-domain between the recordings from different microphones. This will help you to amplify voice of a single person, because no 2 persons can occupy the same space :-) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To detect this time-domain delay, you have to sample at very high (as high as needed, high sampling rate helps on correct output) rates. You have to (sort of) scan your surround. Then you have to amplify the voice from one person and treat others as background noise. You may have to do some trial/error phase for this. Then you have to repeat this process for each individual...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps, I have not implemented such a system, but thinking of doing so...&lt;/p&gt;&#xA;" OwnerUserId="8592" LastEditorUserId="8592" LastEditDate="2014-04-18T10:45:41.583" LastActivityDate="2014-04-18T10:45:41.583" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15724" PostTypeId="1" CreationDate="2014-04-18T13:05:51.997" Score="0" ViewCount="110" Body="&lt;p&gt;This would most likely be the opposite of this question ( &lt;a href=&quot;https://dsp.stackexchange.com/questions/9110/mathematically-inclined-signal-and-systems-signal-processing-book?newreg=8946fadf496b4c42ac1eaa19a8aff997&quot;&gt;Mathematically inclined Signal and Systems/Signal Processing book?&lt;/a&gt; ) I figured I'd ask here if there are any good books that while, necessarily, focus on the math are more oriented to what these concepts can DO instead of the mathematics behind it, so I guess more how it changes the graphing or the function etc instead of the functions behind them. &lt;/p&gt;&#xA;" OwnerUserId="8626" LastActivityDate="2014-04-18T16:58:03.310" Title="Fourier Transforms and Series for the NON mathematically inclined." Tags="|fourier-transform|fourier-series|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15726" PostTypeId="2" ParentId="15724" CreationDate="2014-04-18T15:25:48.260" Score="2" Body="&lt;p&gt;Title: &quot;The World According to Wavelets&quot;&#xA;Author: Barber Burke Hubbard&#xA;Publisher:  A K Peters&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This book covers Fourier series, Fourier transforms and lots of related concepts as an introduction to another topic you may find interesting, wavelet analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book is in two parts.  Part one is non-technical.  Part includes some math.  The book also discusses the history and application of these important tools.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastActivityDate="2014-04-18T15:25:48.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15728" PostTypeId="2" ParentId="15724" CreationDate="2014-04-18T16:27:53.627" Score="1" Body="&lt;p&gt;If you are trying to understand digital signal processing concepts, i would suggest that you make peace with the math before going forward. You might find one or two books that explain things with some analogies and sort of in the air without dealing with the math, but eventually you need to know it. Math is not as bad as it seems.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2014-04-18T16:27:53.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15729" PostTypeId="2" ParentId="15724" CreationDate="2014-04-18T16:50:06.900" Score="4" Body="&lt;p&gt;The book &quot;Blip, Ping &amp;amp; Buzz&quot;, by M. Denny (2007, John Hopkins University Press), explains signal processing, as used in sonar and radar, at the level of a supermarket science magazine.  Some algebra required.  More on the use of Fourier analysis than any theory.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-18T16:58:03.310" LastActivityDate="2014-04-18T16:58:03.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15730" PostTypeId="2" ParentId="15720" CreationDate="2014-04-18T17:14:02.773" Score="0" Body="&lt;p&gt;Instantaneous frequency is a poorly defined concept over wide-band (single channel) data, but can be a useful estimation given narrow-band signals of sufficient duration.  One trick for using an instantaneous frequency estimation algorithm which is usefully accurate only in one frequency band is to resample (or modulate) your data to move the frequency band of interest into the bandpass of the algorithm.  You may need to bandpass filter your data before resampling (modulating) so that the source band ends up entirely within the algorithm's bandwidth.  The bandpass filter can then reject noise or signals-not-of-interest from interfering with the frequency estimation of portion of the signal of interest.&lt;/p&gt;&#xA;&lt;p&gt;In your case, you can try high-quality resampling your data to double the sample rate to extract instantaneous frequency estimates from 50 to 100 Hz.  Triple for 75 to 150, etc., assuming the sample rate and anti-aliasing mechanism captured spectrum in those ranges.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2023-03-29T02:42:06.473" LastActivityDate="2023-03-29T02:42:06.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15731" PostTypeId="1" AcceptedAnswerId="15733" CreationDate="2014-04-19T03:01:36.313" Score="1" ViewCount="236" Body="&lt;p&gt;I found a really intuitive explanation of Discrete Fourier Transform &lt;a href=&quot;http://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize the author's approach briefly : &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What if any signal could be made from circular motion (repeating cycles) ? &lt;strong&gt;This is the central theme of Fourier Transform&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Every circular path needs a size, speed, and starting angle (amplitude/frequency/phase). &lt;/li&gt;&#xA;&lt;li&gt;The combined &quot;position&quot; of all the cycles is our signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The author provides an interactive visualizer (screenshot below):&#xA;The cycles are shown on the left and the paths shown on the right. It shows 3 cycles (a cycle of 0 Hz, a cycle of 1 Hz and a cycle of 2 Hz). The paths of the cycles are in green. The combined path (signal) is in blue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The yellow dots are when we actually measure the signal. With 3 cycles defined (0Hz, 1Hz, 2Hz), each dot is 1/3 of the way through the signal. In this case, cycles [0 1 1] generate the time values [2 -1 -1], which starts at the max (2) and dips low (-1).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why are the dots spaced so ? More generally, if there are $n$ cycles, why is the signal sampled at $n$ points equi-spaced around the circle ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5teTO.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2014-07-31T04:26:11.090" Title="Discrete Fourier Transform - measuring signal at equi-spaced points" Tags="|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15732" PostTypeId="1" CreationDate="2014-04-19T03:14:23.227" Score="5" ViewCount="1901" Body="&lt;p&gt;I am trying to develop some code to find a transient signal in a data set I have.  Before I get there however I am trying to write code using simulated data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first am creating a signal with a specified frequency and then adding white noise to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then iterate through a loop where I create a reference signal at an incremental frequency.  I take the FFT of both signals and the I xcorr the results.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this methodology I get descent results when I use a SnR ratio of greater than -15 dB, but after that my results are no good.  Is there anyway I can optimize this to find signals that are hidden deeper than -15 dB SnR?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0,16*pi,1000);&#xA;y = cos(2*t);&#xA;z = awgn(y,-10);&#xA;fftz = fft(z);&#xA;&#xA;subplot(2,1,1);&#xA;plot(t,z)&#xA;subplot(2,1,2);&#xA;plot(t,y)&#xA;&#xA;freq = linspace(0.1,10,500);&#xA;&#xA;for i=1:500&#xA;    reference_signal = cos(freq(i)*t);&#xA;    fftr = fft(reference_signal);&#xA;    Q(i) = max(abs(xcorr(fftz,fftr)));&#xA;end&#xA;&#xA;subplot(3,1,1);&#xA;plot(t,y)&#xA;subplot(3,1,2);&#xA;plot(t,z)&#xA;subplot(3,1,3);&#xA;plot(freq,Q)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IFoub.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5536" LastEditorUserId="128" LastEditDate="2019-03-15T13:30:49.507" LastActivityDate="2022-01-19T18:01:33.520" Title="Using MATLAB `xcorr()` to Find a Signal Hidden Behind Noise" Tags="|matlab|fft|noise|cross-correlation|denoising|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15733" PostTypeId="2" ParentId="15731" CreationDate="2014-04-19T03:42:48.837" Score="1" Body="&lt;p&gt;The &quot;Cycles&quot; entries are the amplitudes of cosine waves of frequency 0Hz, 1Hz and 2Hz respectively, so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0Hz:  $0\cdot\cos(0)$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1Hz:  $1\cdot\cos(2 \pi t)$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2Hz:  $1\cdot\cos(4 \pi t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The time values are amplitudes of the resulting sum at specific sample points in time.&#xA;The time runs over 1 cycle of what in Fourier series analysis is call the fundamental frequency which in this case is 1Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Discrete Fourier transform is really a Fourier series, so the signal being represented is always periodic and always has a maximum time equal to 1 period of the fundamental frequency which represents one trip around the circle.  Every other frequency represented in the Fourier transform is an integer multiple of the Fundamental frequency or represents an integer multiple of trips around the circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When computing a discrete Fourier transform a signal is first sampled at some rate that must be higher than the frequencies represented by the transform.  For traditional frequency analysis, sampling is always done using uniform spacing.  This is called uniform sampling and since it must happen faster than the signal you are representing, you must have more than 1 sample uniformly spaced around your circle.  To be more precise, you must sample your signal at least 2 times higher than the highest frequency that you want to represent in your analysis, so for this case the sampling should be a minimum of 4Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sampling rate of 1 Hz would give you a single yellow dot on the circle at 0 angle (x=1).&#xA;2 Hz gives you 2 yellow dots, one at 0 angle and one at $\pi$ (x=1 and x=-1).&#xA;In this example you should have a minimum of 4 samples to represent the frequencies illustrated, so you should have 4 yellow dots equally spaced around the circle starting at 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circle is usually represented on a complex plain with the vertical axis representing imaginary numbers.  If this is done, the corresponding dots correspond to specific times calculated from the complex exponential $\exp(i 2 \pi t)$.  With the sample times starting at t=0 and progressing as 0,T/4,T/2,3T/4 (T being the period of the fundamental), the dots correspond to placement around the circle at the angles $0, \frac{\pi}{4}, \frac{\pi}{2},$ and $\frac{3 \pi}{4}$.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="8202" LastEditDate="2014-07-31T04:26:11.090" LastActivityDate="2014-07-31T04:26:11.090" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15734" PostTypeId="1" AcceptedAnswerId="15736" CreationDate="2014-04-19T04:08:03.393" Score="0" ViewCount="2702" Body="&lt;p&gt;I was trying to understand the Otsu thresholding algorithm in image processing. For that purpose I found a &lt;a href=&quot;http://www.labbookpages.co.uk/software/imgProc/otsuThreshold.html&quot; rel=&quot;nofollow&quot;&gt;useful link&lt;/a&gt;. I got the algorithm flow, but a fundamental doubt arises. Why 'minimum within class variance' ${\sigma_W}^2$ (notation given in the link) gives the optimum threshold? Please can someone clear my doubt?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2019-07-04T12:34:36.197" Title="Otsu Thresholding : Why 'minimum within class variance' gives the optimum threshold?" Tags="|image-processing|thresholding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15735" PostTypeId="2" ParentId="15732" CreationDate="2014-04-19T06:38:40.527" Score="3" Body="&lt;p&gt;Your method actually does work even with -30 [dB] SNR if you feed it 100k data points (I've checked).&lt;/p&gt;&#xA;&lt;p&gt;Also I don't see the point of using the first instead of the second:&lt;/p&gt;&#xA;&lt;pre&gt;&#xA;% Your way&#xA;Q1(i) = max(abs(xcorr(fftz,fftr)));&#xA;% Simplier and with very similar result&#xA;Q2(i) = max(abs(xcorr(reference_signal,z)));&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;Moreover, the second is almost what Fourier transform does, so why don't just calculate &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_density#Power_spectral_density&quot; rel=&quot;nofollow noreferrer&quot;&gt;PSD&lt;/a&gt;? (this also gives rather similar results and is very common technique)&lt;/p&gt;&#xA;&lt;p&gt;I don't know what to recommend you to achieve &lt;em&gt;much&lt;/em&gt; better results though. I'll come back if I think out something.&lt;/p&gt;&#xA;" OwnerUserId="8540" LastEditorUserId="128" LastEditDate="2022-01-19T18:01:33.520" LastActivityDate="2022-01-19T18:01:33.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15736" PostTypeId="2" ParentId="15734" CreationDate="2014-04-19T07:48:23.563" Score="2" Body="&lt;p&gt;Otsu threshold assumes a bi-modal (e.g. two-class) histogram. Nobuyuki Otsu shows that in such a case, minimizing the within-class variance is the same as maximizing between-class variance. To separate the bi-modal histogram, that is actually what you need to do. It would correspond to maximizing the distance between the clusters, which would give you the optimum point of separation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please check the paper for further details:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4310076&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4310076&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nobuyuki Otsu (1979). &quot;A threshold selection method from gray-level histograms&quot;. IEEE Trans. Sys., Man., Cyber. 9 (1): 62–66&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="38110" LastEditDate="2019-07-04T12:34:36.197" LastActivityDate="2019-07-04T12:34:36.197" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15737" PostTypeId="2" ParentId="15732" CreationDate="2014-04-19T08:08:23.933" Score="1" Body="&lt;p&gt;You're basically doing a bank of hypothesis to find your signal using Matched Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though you use a slightly different method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, you should leave the signal in the time domain and calculate the cross correlation or their multiplication at the frequency domain.&#xA;Yet, since your signal doesn't have unknown phase (Or delay) multiplication will do (It covers the cross correlation at time zero) -&gt; which is equivalent of what you do at the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're using AWGN the performance depends on the Effective SNR.&lt;br&gt;&#xA;The effective SNR is a function of the energy of the signal, variance of the noise and the number of samples.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you set the signal and the variance of the noise, just use more samples (Of the Signal -&gt; Equivalent of faster sampling rate).&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-05-20T05:48:21.563" LastActivityDate="2014-05-20T05:48:21.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15738" PostTypeId="1" CreationDate="2014-04-19T09:33:22.867" Score="0" ViewCount="125" Body="&lt;p&gt;Is it a realistic mapping to divide the frequency bins in 3 parts, high/mid/low frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can these bins then be manipulated to control the level of these bands in the time domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it sufficient to adjust these bin segments and do an iFFT to time domain?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2014-04-20T14:58:33.790" Title="Controlling audio high/mid/low in frequency domain" Tags="|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15740" PostTypeId="2" ParentId="15710" CreationDate="2014-04-19T11:25:31.553" Score="-2" Body="&lt;p&gt;The convolution operation can be imagined as swiping a credit card ,each instance of both the signals are multiplied with each other.&#xA;In which case a bar code scanner is more like multiplication ,only two instances of each signals are multiplied  .&lt;/p&gt;&#xA;" OwnerUserId="8632" LastActivityDate="2014-04-19T11:25:31.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15741" PostTypeId="1" AcceptedAnswerId="15752" CreationDate="2014-04-19T11:47:40.870" Score="3" ViewCount="3745" Body="&lt;p&gt;From discussions all over the internet, I understand that in a 512 sample point fft, only the first 256 contain relevant information provided that my signal is real. The other half contains complex conjugates of the first half. I base my question on &lt;a href=&quot;https://dsp.stackexchange.com/questions/2818/extracting-frequencies-from-fft&quot;&gt;this&lt;/a&gt; discussion at stack exchange.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to plot the fft of a wav file. I used 2 files - one wav file containing some music and another that was generated by scrip to play at 440Hz.&#xA;The fft plot of the 2nd (440hz signal) showed 2 peaks - one at 440hz and another at the other end of the plot. This was expected. However, plot of the music wav file was asymmetric. How can that be?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FsLqu.png&quot; alt=&quot;Asymetric plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the file onclassical_demo_elysium_anonymous-elysium_the-young-false-man_small-version_live-and_restored found &lt;a href=&quot;https://archive.org/details/onclassical-quality-wav-audio-files-of-classical-music&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Scipy did not parse it properly first and I had to strip the meta tags using audacity before I could get it working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used print  and I got this for the 440hz tone :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 203395.00000000  +0.j          203395.08226712 -57.78564066j&#xA;203395.32901382-115.57039787j ...,  203395.74007235+173.35334037j&#xA;203395.32901385+115.57039784j  203395.08226713 +57.78564063j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the music file, I got this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[ 2.+0.j -4.+0.j]&#xA;[-1.+0.j -7.+0.j]&#xA;[ 0.+0.j -2.+0.j]&#xA;..., &#xA;[ 0.+0.j -6.+0.j]&#xA;[ 0.+0.j -2.+0.j]&#xA;[ 1.+0.j -1.+0.j]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't think any of them are symmetrical! Or else the first and last values should coincide at least in the real part right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And just for the sake of it, the 440hz signal plot : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xHS1i.png&quot; alt=&quot;The 440hz signal plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried plotting abs(fft) - still asymmetrical. Also, why is the plot having both blue and green colors - real and complex parts?&lt;/p&gt;&#xA;" OwnerUserId="5116" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2014-04-20T07:53:24.950" Title="How can an FFT plot not be symmetrical?" Tags="|fft|python|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15743" PostTypeId="2" ParentId="15738" CreationDate="2014-04-19T13:03:35.773" Score="4" Body="&lt;p&gt;while you could do this in the frequency domain, there are many problems with this approach, some of which are outlined &lt;a href=&quot;http://blog.bjornroche.com/2012/08/why-eq-is-done-in-time-domain.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better approach is to use a time domain filter. There is a tutorial &lt;a href=&quot;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2014-04-19T13:03:35.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15744" PostTypeId="1" AcceptedAnswerId="15745" CreationDate="2014-04-19T13:49:20.660" Score="0" ViewCount="545" Body="&lt;p&gt;I'm trying to measure the angle between two needle positions in an analog meter (gauge).&#xA;such as:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OPc8B.png&quot; alt=&quot;image of a angular gauge&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the image processing of several images, I get the processed image below(a image show different needle positions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7F6ZI.png&quot; alt=&quot;demo image to show my question&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the black dot points were the feature points of needle area, so I use the line fitting algorithm(usually by least square method, or Hough transform to find the line) to get several line positions. I can get the L1, L2, so the angle between those two lines was theta1. &#xA;But the needle can located in many different places, so I can finally get many positions such as L3, L4...Ln. Those lines should be ideally intersect in one point, which is the rotation center of the needle. I can calculate the equivalent intersection point of all those lines (the red dot), since it is the rotation constraint of the movement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is: How can the equivalent point be used to refine the final angle, I mean I want to get a better value of theta1, theta2, theta3....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8275" LastEditorUserId="8275" LastEditDate="2014-04-19T13:57:33.587" LastActivityDate="2014-04-19T14:42:49.710" Title="measure angle between two lines, can rotation center constraint be used to refine the initial measured result?" Tags="|image-processing|measurement|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15745" PostTypeId="2" ParentId="15744" CreationDate="2014-04-19T14:11:27.173" Score="1" Body="&lt;p&gt;You could recompute the lines with the constraint that they all go through the red point. If you normally optimize a line &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y=ax+b$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by optimizing both parameters $a$ and $b$, you would now only have 1 degree of freedom for each line. If the red point has coordinates $(x_1,y_1)$ then you get&#xA;the constrained line equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y=a(x-x_1)+y_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with only one parameter $a$. Now you compute $a$ such that the squared distance to the other dots is minimized, and no matter which value of $a$ you obtain, the line will always pass through $(x_1,y_1)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-19T14:30:05.983" LastActivityDate="2014-04-19T14:30:05.983" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15746" PostTypeId="2" ParentId="15744" CreationDate="2014-04-19T14:42:49.710" Score="1" Body="&lt;p&gt;Assume, you find the point of intersection as follows: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's say your optimum point is $(x,y)$. You could write the distance of this point from each line, for each line. That would read as: $\frac{a_ix+b_iy+c}{\sqrt{a_i^2+b_i^2}}$, where $a_i$, $b_i$, and $c_i$ are line coefficients. We could rewrite this as $a'_i=\frac{a_i}{\sqrt{a_i^2+b_i^2}}$, $b'_i=\frac{b_i}{\sqrt{a_i^2+b_i^2}}$ and $c'_i=\frac{c_i}{\sqrt{a_i^2+b_i^2}}$. Write the distance as $a'_ix+b'_iy+c'_i$. This is a linear equation and you have $N$ equations like that, where $N$ is the number of lines. You can set up an overdetermined linear system and solve for the optimum $a'_i$, $b'_i$ and $c'_i$. Then you could find back the original coefficients. Actually the optimal $(x,y)$ will lie on the nullspace of this matrix and can be obtained by SVD.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's now stick to: $\frac{a_ix+b_iy+c}{\sqrt{a_i^2+b_i^2}}$. What you could do is to use non-linear optimization (such as Gauss-Newton) to minimize the sum of these distance. You could also use this step to refine the previous one.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A more involved approach would include some fancy stuff: Intersecting those lines at a single point is actually called Triangulation. It could well be done by setting up a linear system of equations and solving for the optimum point. More detail:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Triangulation_%28computer_vision%29&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Triangulation_(computer_vision)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;After finding the point of intersection you could either update rotation or the translation in order to enforce the line to pass through the optimum point.  &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-04-19T14:42:49.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15750" PostTypeId="2" ParentId="15738" CreationDate="2014-04-20T04:36:54.413" Score="1" Body="&lt;p&gt;Even if you want to do the filtering strictly in the frequency domain using FFTs, you will still need to compute the time-domain impulse response of your desired multi-band frequency modification and somehow limit the length of this impulse response that is above some noise floor.  Then you will need to use longer FFTs and IFFTs that are as long or longer than the sum of the length of this impulse response plus the length of your data windows. If you want to process blocks or windows shorter than the entire length of your signal (entire song, etc.), then you will additionally have to use overlap-add or overlap-save processing to combine all the FFT fast convolution filter results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't do the above, you will get circular convolution artifacts corrupting your filter output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, even frequency domain filtering requires some creation and analysis of a time domain filter kernel, which may turn out to be non-trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also need to evaluate the frequency response between your modification points (FFT bins, etc.), which can end up extremely distorted (ripple, pre-ring, etc.) near any sudden changes in your desired frequency control adjustments.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-20T14:58:33.790" LastActivityDate="2014-04-20T14:58:33.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15751" PostTypeId="2" ParentId="15741" CreationDate="2014-04-20T05:00:00.153" Score="3" Body="&lt;p&gt;FFT results of strictly real input are circularly conjugate symmetric around the first bin (bin 0).  Thus the complex conjugate of the last bin should be equal to the second bin (bin 1), not the first bin.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-20T05:00:00.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15752" PostTypeId="2" ParentId="15741" CreationDate="2014-04-20T07:53:24.950" Score="5" Body="&lt;p&gt;Using the &lt;code&gt;wav&lt;/code&gt; version of the file you linked to I performed an fft in matlab and got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First 3 terms:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; left channel       right channel&#xA;-1.1594 + 0.0000i  -1.8450 + 0.0000i&#xA;-0.4186 - 1.0013i  -0.2851 - 1.7655i&#xA; 0.5507 - 0.7589i   1.0478 - 0.4655i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Last 3 terms:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; left channel       right channel&#xA; 0.7388 - 0.3032i   0.4740 - 0.6654i&#xA; 0.5507 + 0.7589i   1.0478 + 0.4655i&#xA;-0.4186 + 1.0013i  -0.2851 + 1.7655i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looks conjugate symmetrical&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if you are processing the left and right channels at the same time and it is thinking it is a 2d signal or a complex valued signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way you get an asymmetric fft result is if the signal is complex.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-04-20T07:53:24.950" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15756" PostTypeId="1" CreationDate="2014-04-20T15:24:38.673" Score="4" ViewCount="6411" Body="&lt;p&gt;I know that the gradient function is supported by MATLAB, but the local gradient is not, so how do you calculate it?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Local gradient is another texture descriptor, which is defined as:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$I_g=\sum_{z=-r}^{r} | \nabla I(x+\tau) |^2 $$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="128" LastEditDate="2018-07-02T08:53:18.047" LastActivityDate="2022-05-27T13:31:23.303" Title="How to Calculate the Local Gradient of an Image in MATLAB" Tags="|matlab|filters|image-processing|image-segmentation|" AnswerCount="3" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="15761" PostTypeId="1" CreationDate="2014-04-21T02:44:41.890" Score="1" ViewCount="39" Body="&lt;p&gt;Suppose that a signal is decomposed by using discrete wavelet transform (DWT) and transmitted. Is it possible for receiver to find which type of wavelet is applied in transmitter side ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, if the signal is decomposed by Haar or DB and then reconstructed. Is it have any way to know the type of wavelet (like haar) that is already used ? &lt;/p&gt;&#xA;" OwnerUserId="4327" LastActivityDate="2014-04-21T02:44:41.890" Title="Estimate the type of wavelet transform in receiver side" Tags="|discrete-signals|fourier-transform|wavelet|waveform-similarity|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15763" PostTypeId="1" CreationDate="2014-04-21T13:49:52.693" Score="1" ViewCount="667" Body="&lt;p&gt;I have a &lt;a href=&quot;https://en.wikipedia.org/wiki/Phaser_%28effect%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;conventional phaser setup&lt;/a&gt; with allpass filters and feedback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can calculate the peaks frequencies of the phaser when the allpass delays are set to 1 (then they work as simple one sample delays). Adding two allpass delays will give an additional peak, and the peak frequencies for peaks i = 1 to N is found by: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(i / (N + 0.5) ) * SampleRate / 2 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where N is the number of peaks (and the number of allpass-delays divided by 2).&#xA;So if you have a 6-stage phaser at 44100, the 3 peaks will be at:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(1 / (3 + 0.5) ) * 44100 / 2 = 6300&#xA;(2 / (3 + 0.5) ) * 44100 / 2 = 12600&#xA;(3 / (3 + 0.5) ) * 44100 / 2 = 18900&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, these frequencies start warping when the allpass-delays are not set to 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kXfxt.png&quot; alt=&quot;Phaser using 8 allpass filters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I calculate the peak frequencies when the allpass-delays are not set to 1?&lt;/p&gt;&#xA;" OwnerUserId="8643" LastEditorUserId="8643" LastEditDate="2014-04-23T13:16:27.997" LastActivityDate="2015-10-20T19:03:44.960" Title="Resonant peak frequencies for phaser effect" Tags="|sound|allpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15764" PostTypeId="1" AcceptedAnswerId="15821" CreationDate="2014-04-21T15:48:14.043" Score="0" ViewCount="3219" Body="&lt;p&gt;I've got following problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assume you've this continous system 1st order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(s) = \frac{1}{1+s} $$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = tf('s');&#xA;sys = 1/(1+s);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm going to discretize this system via impulse invariant transformation and plot the results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sysD = c2d(sys,1e-3,'impulse');&#xA;impulse(sys);&#xA;hold all;&#xA;impulse(sysD);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/URtWB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this seems to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to create the impulse response for 7 seconds manually I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imp = zeros(1,7*1e3);&#xA;imp(1) = 1;&#xA;t = 0:1e-3:7-1e-3;&#xA;y = lsim(sys,imp,t);&#xA;plot(t,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q3rk3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately this is not the response I expected. The gain seems to be scaled by the samplerate 1e3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is: What does impulse do since this response should be correct. lsim uses the filter command and simply passes the nominator and denominator to filter I think. Is the dirac impulse (or kronecker delta) wrong? Must it be scaled by the samplerate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I discovered the whole thing, because I wanted to design a very simple digital filter. I knew the responses of time continuous systems, so I thought it would be easy to discretize the transfer function and use the coefficients of the digital transfer function that can be used by filter or in a dsp application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="8648" LastActivityDate="2014-05-23T23:02:28.717" Title="Differences between matlab's 'impulse' and 'lsim' command; create impulse response" Tags="|matlab|impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15766" PostTypeId="1" CreationDate="2014-04-21T18:55:32.560" Score="0" ViewCount="836" Body="&lt;p&gt;I'm  currently studying sound design, however over the past couple of years i started creating audio effects/instruments. I have also been programming in C++ for quite some years.&#xA;I noticed my shortcomings though; i can design compressors, envelopes and simple stuff like additive synthesis quite well along with basic signal knowledge (like samplerates, nyquist theorem), however i don't understand the theory behind some of the more dense mathematical subjects like filter designs, transfer functions, fourier transforms, complex numbers, time/frequency domain etc., or even the mathematical notation of such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without sounding too oblivious, what are the relevant fields for educating one in such topics? Also, if anyone has some book recommendations for easy introduction to required math/basic signal theory i would be most grateful :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2014-04-22T05:22:32.657" Title="Looking to educate myself in dsp theory" Tags="|filters|theory|" AnswerCount="4" CommentCount="0" ClosedDate="2014-05-13T04:03:59.963" ContentLicense="CC BY-SA 3.0" />
  <row Id="15767" PostTypeId="2" ParentId="15763" CreationDate="2014-04-21T19:01:44.357" Score="1" Body="&lt;p&gt;I refer to the following structure of a phaser (from &lt;a href=&quot;https://en.wikipedia.org/wiki/Phaser_%28effect%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gQXaj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's call the depth factor $a$, and the feedback factor $f$ ($|f|&amp;lt;1$).&#xA;I assume that there are $2N$ first order allpass filters, each with transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A_0(z)=\frac{z^{-1}-b}{1-bz^{-1}},\quad |b|&amp;lt;1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The allpass frequency response is obtained by evaluating (1) on the unit circle $z=e^{j\omega}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A_0(e^{j\omega})=\frac{e^{-j\omega}-b}{1-be^{-j\omega}}=&#xA;\frac{e^{-j\omega}-2b+b^2e^{j\omega}}{|1-be^{-j\omega}|^2}=\\&#xA;=\frac{(1+b^2)\cos(\omega)-2b+j(b^2-1)\sin(\omega)}{|1-be^{-j\omega}|^2}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since $A_0(z)$ is an allpass function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A_0(e^{j\omega})=e^{j\phi(\omega)}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (2) and (3) the phase $\phi(\omega)$ of the allpass satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tan(\phi(\omega))=\frac{(b^2-1)\sin(\omega)}{(1+b^2)\cos(\omega)-2b}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you cascade $2N$ of these allpass filters, the frequency response of this cascade is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[A_0(e^{j\omega})]^{2N}=e^{j2N\phi(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us first consider a system without feedback, i.e. $f=0$. The total frequency response of such a system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=1+ae^{j2N\phi(\omega)}=&#xA;1+a\cos(2N\phi(\omega))+ja\sin(2N\phi(\omega))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its squared magnitude is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(e^{j\omega})|^2=1+2a\cos(2N\phi(\omega))+a^2\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (5) it is obvious that the locations of the maxima of $|H(e^{j\omega})|^2$ are independent of the depth paramter $a$, and that they only depend on $N$ and on the allpass phase response $\phi(\omega)$ (i.e. on the paramter $b$). The maxima occur where the argument of the cosine in (5) equals $2\pi k$, $k=0,1,\ldots,N$, which is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi(\omega_k)=\frac{k\pi}{N},\quad k=0,1,\ldots,N$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_k$ are the peak frequencies. With (4) this condition becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{(b^2-1)\sin(\omega_k)}{(1+b^2)\cos(\omega_k)-2b}=\tan\left(\frac{k\pi}{N}\right),\quad k=0,1,\ldots,N\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (6) can be used to determine the peak frequencies $\omega_k$. Note that this needs to be done numerically since this equation cannot be solved for $\omega_k$ analytically. There are just some special indices $k$ for which an explicit solution is possible:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{rcl}\omega_0&amp;amp;=&amp;amp;0\\&#xA;\omega_{N/2}&amp;amp;=&amp;amp;\arccos\left(\frac{2b}{1+b^2}\right)\quad\textrm{if } N \textrm{ is even}\\&#xA;\omega_N&amp;amp;=&amp;amp;\pi&#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following figure is an example for $N=4$, $a=0.7$, and $b=0.6$ which shows $|H(e^{j\omega})|$&#xA;and the locations of the maxima (shown by 'x') which I've computed using equation (4).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RONID.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is feedback ($f\neq 0$) then the frequency response looks more complicated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\frac{1+(a-f)e^{j2N\phi(\omega)}}{1-fe^{j2N\phi(\omega)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its squared magnitude is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(e^{j\omega})|^2=\frac{1+2(a-f)\cos(2N\phi(\omega))+(a-f)^2}{1-2f\cos(2N\phi(\omega))+f^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily it turns out that feedback doesn't change the location of the peaks, it just makes them 'peakier'. In the following figure the system the frequency response shown above is compared to the response with feedback ($f=0.5$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nz1pr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-28T11:09:06.597" LastActivityDate="2014-04-28T11:09:06.597" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="15768" PostTypeId="2" ParentId="15766" CreationDate="2014-04-21T19:24:34.660" Score="0" Body="&lt;p&gt;I think you might like &lt;em&gt;&lt;a href=&quot;http://eceweb1.rutgers.edu/~orfanidi/intro2sp/&quot; rel=&quot;nofollow&quot;&gt;Introduction to Signal Processing&lt;/a&gt;&lt;/em&gt; by Orfanidis. It's very practically oriented and it's freely available. It contains all the necessary basics of the topics that you've mentioned.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-21T19:24:34.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15769" PostTypeId="2" ParentId="15766" CreationDate="2014-04-21T19:42:52.073" Score="1" Body="&lt;p&gt;The following blog has download-able IPython notebooks that you can run and tinker with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://python-for-signal-processing.blogspot.com/&quot; rel=&quot;nofollow&quot;&gt;http://python-for-signal-processing.blogspot.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lots of concepts covered that you can compute yourself using the scientific Python toolchain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8653" LastActivityDate="2014-04-21T19:42:52.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15770" PostTypeId="1" CreationDate="2014-04-21T19:53:48.713" Score="1" ViewCount="978" Body="&lt;p&gt;I'm currently doing my final year Degree in computing studies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The project I'm working on is a video of a webcam or computer webcam to have 2 pre-defined ROI (Region of Interest) on top and bottom of the video. It is to detect a person when he does a simple push up whether he reaches the area of both top and bottom ROI by detecting the person's head when he enters the ROI. I totally have very less experience in programming and really need guide and help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;During my research I've come across a journal/research at: Pattern Recognition Letters 33 (2012) 438–445. I've downloaded and gone thru it but can't seem to find its code or truly understand it. I got access with my University account at sciencedirect.com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2nd idea I had was after viewing a video in Youtube: &lt;a href=&quot;http://www.youtube.com/watch?v=z1Cvn3_4yGo&quot; rel=&quot;nofollow&quot;&gt;Traffic Counting based on OpenCV&lt;/a&gt;... I was very interested by that video. I was thinking if I could set 2 lines like he did and detect simple human motion up and down doing a simple accurate pushup exercise I would be so much happy but I can't seem to get contact or ask for any information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really need advice and help because I am really lost.&lt;/p&gt;&#xA;" OwnerUserId="8652" LastEditorUserId="1606" LastEditDate="2014-04-28T11:21:20.373" LastActivityDate="2015-06-22T21:24:01.973" Title="Counting human movement of exercise using ROI or pre-set passing line with OpenCV" Tags="|image-processing|computer-vision|opencv|image-segmentation|video-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15771" PostTypeId="1" CreationDate="2014-04-21T20:21:48.920" Score="1" ViewCount="295" Body="&lt;p&gt;I am measuring the phase shift between two pseudorandom signals using correlation ifft(A.conjugate()*B) and picking out the maximum).&#xA;That works very well, but takes a lot of time. I roughly know where the peaks are, and don't need the correlation for other shifts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an adaptive cross-correllation algorithm that would speed up the process if I am only interested in the positions of maxima, and already roughly know their positions?&#xA;Analog to the sliding DFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe running the cross-correlation on a decimated version of data, finding the peaks, interpolating, and then doing a manual correlation around the max?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already know within 200 samples where the maxima are.&#xA;The record length is about 200k samples.&lt;/p&gt;&#xA;" OwnerUserId="8654" LastActivityDate="2014-04-21T22:51:25.250" Title="Fast cross correlation with limited range" Tags="|cross-correlation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15774" PostTypeId="2" ParentId="15771" CreationDate="2014-04-21T22:51:25.250" Score="1" Body="&lt;p&gt;If the limited range is significantly more than log(N) shorter than the total signal of length N, then ordinary cross correlation over that limited range may be faster than FFT-based fast correlation.  You could just iterate away from the estimated/predicted lag until you find you have gone past a correlation peak (by a sufficient amount to account for expected noise).  But if you go more than log(N)/2 points away from your initial estimate, then perhaps switch back to fast convolution cross correlation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-21T22:51:25.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15775" PostTypeId="2" ParentId="15766" CreationDate="2014-04-21T23:03:36.690" Score="0" Body="&lt;p&gt;The math required before getting too far into DSP theory might include some trigonometry, analytic geometry, arithmetic of complex numbers, linear algebra, and basic integral calculus.  For music, a introduction to differential equations might help explain the relationship between the complex exponential equations and the (simplified) physics of the stuff that creates musical sound.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-21T23:03:36.690" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15776" PostTypeId="1" AcceptedAnswerId="15777" CreationDate="2014-04-22T00:09:55.093" Score="0" ViewCount="165" Body="&lt;p&gt;I working on writing a program to get the BPM rate and the Beat Times in audio songs but I am having trouble trying to come up with reliable testing strategies for my design.What do I benchmark my BPM rates and Beat Times against? Should I just use other softwares or is there ways of checking if my BPM rates and beat times are correct? (apart from physically listening and tapping along to the song).&lt;/p&gt;&#xA;" OwnerUserId="4376" LastActivityDate="2014-04-22T01:38:38.720" Title="Finding Accurate BPM and Beat Time Values in Audio" Tags="|audio|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15777" PostTypeId="2" ParentId="15776" CreationDate="2014-04-22T01:38:38.720" Score="1" Body="&lt;p&gt;Comparing your results against data annotated by a human listener is the way to go. You can try downloading some of the evaluation data from &lt;a href=&quot;http://www.music-ir.org/mirex/&quot; rel=&quot;nofollow&quot;&gt;MIREX&lt;/a&gt; or look for other research databases.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-04-22T01:38:38.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15778" PostTypeId="1" CreationDate="2014-04-22T01:43:39.273" Score="1" ViewCount="388" Body="&lt;p&gt;guys! I have carried out some experiments using matlab warp tools from &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22227-thin-plate-splines&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. But the results are not good, so I decide to read its original paper &lt;strong&gt;Principal Warps: Thin-Plate Splines and the Decomposition of Deformations&lt;/strong&gt; from &lt;a href=&quot;http://www.engineering.uiowa.edu/~aip/papers/bookstein-89.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; to find reasons. However, I am stuck to part II.....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It says the energy function $\mathbf{I_f}$  is proportional to $\mathbf{WKW^T = V(L^{-1}_nKL^{-1}_n)V^T}$, then, I can not understand the whole first paragraph of part II:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xWjVJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does the pattern of y-displacements represent an expansion of lengths along y-axis? Actually, I know energy function, but I can not understand its relations to $\mathbf{WKW^T}$, then the pattern of displacements, and then the actions around x or y axis. So, I ask this question about energy function. Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="8229" LastActivityDate="2014-04-22T01:43:39.273" Title="How to understand energy function in thin plate splines?" Tags="|image-processing|matlab|matrix|math|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15779" PostTypeId="1" AcceptedAnswerId="15784" CreationDate="2014-04-22T02:55:12.547" Score="2" ViewCount="2970" Body="&lt;p&gt;I'm currently working on a piece of DSP/Synthesis software and I have run into the issue of generating band limited waveforms. I have been doing some research to try and find a good solution but I haven't had much luck. I have found some things about a BLIT to generate complex waveforms but I have not found a good example of an implementation. I am not very good with Math or Mathematical notation but I am great with dealing with c/c++ code. If anyone has a good explanation of how to generate a BLIT using c/c++ or resources about that I would much appreciate any help that you could give.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I know this could also be a Stack Overflow question because of the programming nature but I thought I would try the DSP community first. Thanks again.&lt;/p&gt;&#xA;" OwnerUserId="8658" LastEditorUserId="8658" LastEditDate="2014-04-22T03:06:38.200" LastActivityDate="2014-04-22T06:31:02.537" Title="Band Limited Impulse Train Synthesis" Tags="|audio|dsp-core|signal-synthesis|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15781" PostTypeId="2" ParentId="15766" CreationDate="2014-04-22T05:22:32.657" Score="0" Body="&lt;p&gt;I think it would be best for you to get acquainted first with basics of digital signal processing. How is analog signal converted to digital signal. About sampling frequency. Then you can start looking into fourier series and fourier transform. Study about delta functions. Try to get understanding of impulse response of system. Get some introduction to z transform and look into creating various types of filter with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Digital Signal processing by SK Mitra is a good book to start. You can also get great study material at dspguide.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally i prefer the video lectures : &lt;a href=&quot;http://nptel.ac.in/courses/117102060/&quot; rel=&quot;nofollow&quot;&gt;http://nptel.ac.in/courses/117102060/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8435" LastActivityDate="2014-04-22T05:22:32.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15782" PostTypeId="1" CreationDate="2014-04-22T05:41:23.747" Score="0" ViewCount="82" Body="&lt;pre&gt;&lt;code&gt;float xx = acceleration.x;&#xA;float yy = acceleration.y;&#xA;float zz = acceleration.z;&#xA;&#xA;float dot = (px * xx) + (py * yy) + (pz * zz);&#xA;float a = ABS(sqrt(px * px + py * py + pz * pz));&#xA;float b = ABS(sqrt(xx * xx + yy * yy + zz * zz));&#xA;&#xA;dot /= (a * b);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I run into the equation above on &lt;a href=&quot;https://github.com/pdetagyos/Pedometer/blob/master/Pedometer/ViewController.m&quot; rel=&quot;nofollow&quot;&gt;github&lt;/a&gt;, but I don't know what kind of DSP filter is this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ result= \frac{x_{prev} * x + y_{prev} * y + z_{prev} * z }{\sqrt{x^2 + y^2 + z^2} * \sqrt{(x_{prev}^2 + y_{prev}^2 + z_{prev}^2)}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my question is too obvious please forgive my ignorance, I hope that it is a real question and it not will be closed.&lt;/p&gt;&#xA;" OwnerUserId="7552" LastActivityDate="2014-04-22T05:41:23.747" Title="What type of filter is this?" Tags="|filters|filter-design|filtering|highpass-filter|adaptive-filters|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15784" PostTypeId="2" ParentId="15779" CreationDate="2014-04-22T06:31:02.537" Score="3" Body="&lt;p&gt;the main idea behind BLIT is that these analog synth waveforms that we are trying to generate digitally can be thought of as the integral (over $t$) of impulse trains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a sawtooth can be thought of as the integral of the sum of a little bit of DC and an impulse train.  a square wave is the integral of impulses of alternating signs.  the  triangle wave is the integral of the square wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, to create bandlimited waveforms of the above, the impulse trains are bandlimited which means that each impulse $\delta(t-t_n)$ is replaced by a $\operatorname{sinc}(t-t_n)$ function, which is that impulse bandlimited through a Nyquist brick-wall LPF.  that sequence of bandlimited impulses is a BLIT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then, since integration is a filter with s-plane transfer function of $H(s)=\frac{1}{s}$ and is LTI (Linear, Time-Invariant), integrating the BLITs will introduce no new frequency components.  if your BLITs are bandlimited, so are the other waveforms that are derived from filtering the BLITs.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-04-22T06:31:02.537" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15785" PostTypeId="1" AcceptedAnswerId="19972" CreationDate="2014-04-22T07:43:36.880" Score="6" ViewCount="1814" Body="&lt;p&gt;Can somebody please explain how Photoshop &lt;code&gt;vibrance&lt;/code&gt; function can use in opencv c++ ? so that I may reproduce the same effects in my application. Here is the &lt;a href=&quot;http://digital-photography-school.com/vibrance-vs-saturation-in-plain-english/&quot; rel=&quot;noreferrer&quot;&gt;vibrance&lt;/a&gt; documentation&lt;/p&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="128" LastEditDate="2018-08-26T08:13:22.480" LastActivityDate="2018-08-26T08:13:22.480" Title="How Could One Imitate Photoshop's Vibrance Filter with OpenCV?" Tags="|computer-vision|image-processing|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15786" PostTypeId="1" AcceptedAnswerId="15787" CreationDate="2014-04-22T10:27:23.507" Score="0" ViewCount="3651" Body="&lt;p&gt;In Matlab we use below function to read an image :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var = imread('IMAGE‌‌ ‌PATH');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, how to do same thing in Scilab ?&lt;/p&gt;&#xA;" OwnerUserId="8665" LastActivityDate="2014-04-22T11:02:51.830" Title="How to read an image in Scilab" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="2" ClosedDate="2014-05-08T01:25:31.040" ContentLicense="CC BY-SA 3.0" />
  <row Id="15787" PostTypeId="2" ParentId="15786" CreationDate="2014-04-22T11:02:51.830" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://atoms.scilab.org/toolboxes/SIVP&quot; rel=&quot;nofollow&quot;&gt;Scilab Image and Video Processing toolbox&lt;/a&gt; provides &lt;a href=&quot;http://sivp.sourceforge.net/func-list-0.5.0/imread.htm&quot; rel=&quot;nofollow&quot;&gt;imread()&lt;/a&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The related &lt;a href=&quot;http://sivp.sourceforge.net/doc.php#image_read&quot; rel=&quot;nofollow&quot;&gt;How To entry&lt;/a&gt; gives example and it's similar to Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;im=imread(filename);&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://wiki.scilab.org/ATOMS&quot; rel=&quot;nofollow&quot;&gt;ATOMS&lt;/a&gt; article to learn how to install additional modules in Scilab.&lt;/p&gt;&#xA;" OwnerUserId="8540" LastActivityDate="2014-04-22T11:02:51.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15788" PostTypeId="2" ParentId="15708" CreationDate="2014-04-22T11:32:57.180" Score="2" Body="&lt;p&gt;As far as I can see the main question is: How to account for the uncertainty in the measurements of $X_t$ (i.e. $F$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach to do this would be to run some sort of Monte Carlo simulation on the data. I.e. for each experiment you can resample a large number of times (say 1000 or 10000) where each point has $1-F$ probability of being flipped. By calculating the auto-correlation of each resample you get a distribution of the correlation for each $k$. Then take the 95% (or another value) confidence interval to get an uncertainty in $R(k)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may also be possible to do this analytically but I'm not sure for binary data (my instinct says not or at least not simply).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This uncertainty in $R$ should be accounted for in your fitting of the data when calculating the decay time. This can definitely be done analytically and may be implemented in whatever you are using to do the fit (I think matlab does). Alternatively a similar Monte Carlo simulation could be done but is probably more effort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think all the data follows the same trend (not unreasonable if it is a repeated experiment) you could calculate a mean for each auto-correlation distance as you suggest. This is effectively taking a manual Monte Carlo with 25 resamples. Then you can calculate the standard error as you suggest (note: $n=25$, not $5000$). I would shy away from this approach as it ignores the uncertainty in you initial measurement which you presumably have a good reason for giving.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-04-22T11:32:57.180" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15789" PostTypeId="1" AcceptedAnswerId="15861" CreationDate="2014-04-22T12:54:34.423" Score="3" ViewCount="1900" Body="&lt;p&gt;I am using OpenCV C++ for making the blending mode like in &lt;code&gt;photoshop&lt;/code&gt;, I want to make overlay mode in it. I search its alternate in OpenCV in which I found &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/core/adding_images/adding_images.html&quot; rel=&quot;nofollow&quot;&gt;this blending&lt;/a&gt; way, but its not the overlay as I want to use the overlay method in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overlay method formula from &lt;a href=&quot;http://www.deepskycolors.com/archive/2010/04/21/formulas-for-Photoshop-blending-modes.html&quot; rel=&quot;nofollow&quot;&gt;this documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(Target &amp;gt; 0.5) * (1 - (1-2*(Target-0.5)) * (1-Blend)) +&#xA;(Target &amp;lt;= 0.5) * ((2*Target) * Blend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone please explain this formula for implementation in OpenCV C++ , how I can easily understand it for implementation or is there any &lt;em&gt;already&lt;/em&gt; build in function for it or any other easy way out.&lt;/p&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="8202" LastEditDate="2014-04-22T19:49:56.603" LastActivityDate="2014-04-26T08:14:28.373" Title="Trying to translate formula for blending mode" Tags="|computer-vision|image-processing|opencv|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15790" PostTypeId="1" CreationDate="2014-04-22T13:58:56.350" Score="2" ViewCount="3316" Body="&lt;p&gt;Could someone please provide a method for inverting random fixed point numbers.&#xA;I have as an input both positive and negative floating point numbers that should be converted into fixed point and then be inverted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example could be 1/0.2453 where floating-point 0.2453 is converted into a Q18 fixed point format and then inverted to 4.07664.&#xA;Thanks a lot!!&lt;/p&gt;&#xA;" OwnerUserId="959" LastEditorUserId="29" LastEditDate="2014-06-26T18:39:42.300" LastActivityDate="2014-06-26T18:39:42.300" Title="inverse Fixed point number (number^-1)" Tags="|fixed-point|conversion|" AnswerCount="1" CommentCount="15" ClosedDate="2014-05-03T06:51:51.040" ContentLicense="CC BY-SA 3.0" />
  <row Id="15791" PostTypeId="1" AcceptedAnswerId="15805" CreationDate="2014-04-22T14:24:56.157" Score="2" ViewCount="196" Body="&lt;p&gt;I have three signals (below) each having the same standard deviation, however, are clearly very different temporally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3AYr2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some such metric that could be calculated for each of these signals to give an indication of how they vary over time, such as a measure of continuousness or intermittency if such a metric exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If possible, I would like to do this by calculating a single number for each of these signals, rather than windowing into smaller chunks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8667" LastActivityDate="2014-04-22T20:36:51.500" Title="Measure of intermittency/continuousness of a signal" Tags="|signal-analysis|algorithms|statistics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15792" PostTypeId="2" ParentId="15789" CreationDate="2014-04-22T15:17:14.460" Score="0" Body="&lt;p&gt;Ok. Lets break it into pieces:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(Target &amp;gt; 0.5) * (1 - (1-2*(Target-0.5)) * (1-Blend)) + (Target &amp;lt;= 0.5) * ((2*Target) * Blend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;has two parts that are being blended:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(Target &amp;gt; 0.5) * (1 - (1-2*(Target-0.5))&#xA;(Target &amp;lt;= 0.5) * (2*Target)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of these the first is making sure that pixels with intensity greater than 0.5 (&lt;code&gt;Target &amp;gt; 0.5&lt;/code&gt;) only are chosen and the rest (&lt;code&gt;Target &amp;lt;= 0.5&lt;/code&gt;) go to the other image.&#xA;So, the second is limited to 0-0.5 values, which is being scaled to 0-1. For obtaining a similar range for the first set of pixels, a stretching algorithm is being used: &lt;code&gt;1-(1-2*(Target-0.5))&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the documentation mentions, this is a combination of multiply and screen - multiply for pixels with values less than or equal to 0.5 and screen for the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming to the point of OpenCV implementation, you will require the following methods:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Blend (&lt;code&gt;I1 *(1-b) + I2 *b&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Addition (&lt;code&gt;I1 + I2&lt;/code&gt;, with normalization of course)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Inversion  (&lt;code&gt;I2 = 1 - I1&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Thresholding (&lt;code&gt;I2 = I1 &amp;gt; a/b&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have followed the documentation's convention of using 1 as the maximum intensity, you could stick to this using float type images or scale it appropriately to use other formats.&lt;/p&gt;&#xA;" OwnerUserId="7749" LastEditorUserId="8202" LastEditDate="2014-04-23T20:32:52.243" LastActivityDate="2014-04-23T20:32:52.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15793" PostTypeId="1" AcceptedAnswerId="15796" CreationDate="2014-04-22T15:19:15.720" Score="0" ViewCount="536" Body="&lt;p&gt;I have recently started learning DSP and the book that I am reading challenges the readers to find a:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;continuous time-domain electrical signal that only has a finite number&#xA;  of amplitude values&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I obviously could not think of an example and hence I am here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please suggest an example of continuous electrical signal that takes only finite number of discrete values ?&lt;/p&gt;&#xA;" OwnerUserId="8501" LastActivityDate="2016-05-22T17:02:24.727" Title="Continuous time-domain electrical signal that only has a finite number of possible values" Tags="|continuous-signals|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15794" PostTypeId="2" ParentId="15793" CreationDate="2014-04-22T15:26:42.537" Score="2" Body="&lt;p&gt;Well, a DC signal for sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, there is probably more context from the book required (especially about the assumptions).&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-04-22T15:26:42.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15795" PostTypeId="2" ParentId="15756" CreationDate="2014-04-22T15:28:28.307" Score="0" Body="&lt;p&gt;Presuming you have the Image processing toolbox the imgradient function should do what you want. It calculates the gradient magnitude (and direction) of each pixel using standard &lt;a href=&quot;http://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;nofollow&quot;&gt;Sobel gradient&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the discussion it sounds like you may want to calculate the gradient some other way. If so I recommend either nlfilter for sliding window methods (i.e pixel by pixel) or blockproc for block processing. For these functions you will have to work out a suitable equation for the gradient yourself but this isn't hard.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-04-22T15:28:28.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15796" PostTypeId="2" ParentId="15793" CreationDate="2014-04-22T15:30:11.063" Score="2" Body="&lt;p&gt;A standard example would be a piecewise constant signal (with quantized amplitudes), e.g. generated by an ideal &lt;a href=&quot;http://en.wikipedia.org/wiki/Sample_and_hold&quot; rel=&quot;nofollow&quot;&gt;sample-and-hold&lt;/a&gt; circuit (check the figure in the link). Or the output of an ideal DAC (before the reconstruction filter), see the figure in &lt;a href=&quot;http://en.wikipedia.org/wiki/D/A_converter&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-22T16:02:47.260" LastActivityDate="2014-04-22T16:02:47.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15797" PostTypeId="1" CreationDate="2014-04-22T16:31:04.817" Score="0" ViewCount="386" Body="&lt;p&gt;I'm pretty new to Image Processing and am using MatLab.&#xA;I have an problem were I take an image of light passing trough an set of optical fibers (bundled together) and one were I pass laser energy trough the same bundle of fibers to burn the image of these fibers onto paper. &#xA;I then try to match these two. Up to now I just basicly imported both into photoshop and rotated, scaled and resized by hand to match them. However I am looking for an automated method in Matlab as I'm also doing different analysis on these pictures in matlab. &#xA;So I'm looking for an automated method to find the rotation, scale an movement difference of both images. &#xA;I tried a lot of different things using mostly different tools from the matlab imaging processing toolbox (SURF, BRISK, FAST) without success. Also with different optimizations of the image from just the basic matlab imadjust to changing to hue scale, contrast changes, brightness, denoising. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/Bg862.jpg&quot; alt=&quot;burned image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GQz08.jpg&quot; alt=&quot;light image&quot;&gt;&#xA;(i have higher resolution available)&#xA;Is there anyone who can send me in the right direction? &lt;/p&gt;&#xA;" OwnerUserId="8668" LastActivityDate="2014-04-22T16:31:04.817" Title="Correct image rotation/scale/moving change" Tags="|transform|scale-space|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15798" PostTypeId="1" AcceptedAnswerId="15799" CreationDate="2014-04-22T16:56:03.193" Score="0" ViewCount="769" Body="&lt;p&gt;I plotted a sine wave(blue) and a 90 degrees phase shifted cosine wave (red) expecting them to overlap each other. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = 0:0.001:1;&#xA;&#xA;%ploting sine&#xA;y = sin(2*pi*x);&#xA;plot(x, y);&#xA;&#xA;hold('on');&#xA;&#xA;%ploting cosine &#xA;z = cos(2*pi*x-90);&#xA;plot(x, z);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/muXzq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two graphs do not overlap.&#xA;Whats wrong with my assumption ?&lt;/p&gt;&#xA;" OwnerUserId="8501" LastActivityDate="2014-04-22T17:00:00.507" Title="Why dont sin and phase shifted cosine overlap?" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15799" PostTypeId="2" ParentId="15798" CreationDate="2014-04-22T17:00:00.507" Score="5" Body="&lt;p&gt;You're confusing degrees and radians.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(x)=\cos(x-\pi/2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\pi/2$ radians corresponds to 90 degrees.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-22T17:00:00.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15800" PostTypeId="1" CreationDate="2014-04-22T17:15:13.420" Score="0" ViewCount="1614" Body="&lt;p&gt;I have an image :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = imread('pic.jpg');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, How can I get spectrum of that image?&lt;/p&gt;&#xA;" OwnerUserId="8665" LastActivityDate="2014-04-22T19:07:49.180" Title="How to get spectrum of an image?" Tags="|matlab|frequency-spectrum|octave|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15801" PostTypeId="2" ParentId="15800" CreationDate="2014-04-22T17:36:16.687" Score="2" Body="&lt;p&gt;reference : Digital Image processing - Rafael Gonzalez&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steps :&#xA;The whole of filtering process can be summarized in the following points :&#xA;1&gt; Given an input image f(x,y) of size M X N, obtain the padding parameters P and Q as P =2M and Q = 2N&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with using DFT is that both the input and output images are periodic. This causes interference between adjacent periods if the periods are close with respect to the duration of the non-zero parts of the functions. So we padd  the image by using a padding function P having zeros equal to twice the image length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2&gt; Form a padded image f’(x,y) of size P X Q by appending the necessary numbers of zeros to f(x,y).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3&gt; Multiply f’(x,y) by (-1)^x+y to center its transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4&gt; Compute the DFT, F(u,v) of the image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = imread('pic.jpg');&#xA;figure(1);&#xA;imshow(f);&#xA;title('original image');&#xA;&#xA;PQ = paddedsize(size(f));&#xA;[U,V] = dftuv(PQ(1),PQ(2));&#xA; F = fftshift(fft2(f,PQ(1),PQ(2)));&#xA;&#xA; S =  abs(F);&#xA; ag = angle(F);&#xA;&#xA;[l,p] = size(S);&#xA;d = max(max(S));&#xA;c = min(min(S));&#xA;&#xA;for l = 1:1:l&#xA;    for p = 1:1:p&#xA;        S1(l,p) = (S(l,p)-c)*(255/(d-c));&#xA;    end&#xA;end&#xA;&#xA;figure(2);&#xA;subplot(2,2,1);&#xA;imshow(uint8(S1));&#xA;title('Magnitude response without log transform');&#xA;&#xA;% since dc dominates the values of spectrume, the dynamic range of other intensities in displayed image is compression. to bring out those details we perform log transformation.&#xA;&#xA;[m,n] = size(ag);&#xA;d = max(max(ag));&#xA;c = min(min(ag));&#xA;&#xA;for l = 1:1:l  &#xA;    for p = 1:1:p&#xA;        ag1(l,p) = (ag(l,p)-c)*(255/(d-c));&#xA;    end&#xA;end&#xA;&#xA;subplot(2,2,2);&#xA;imshow(uint8(ag1));&#xA;title('Phase response without log transform');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8435" LastEditorUserId="8202" LastEditDate="2014-04-22T19:07:49.180" LastActivityDate="2014-04-22T19:07:49.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15804" PostTypeId="2" ParentId="15791" CreationDate="2014-04-22T20:09:08.977" Score="1" Body="&lt;p&gt;I can't come up with any known standard measure, and it all depends on what you exactly need, but one simple measure could be computed like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M=\sum_{n=0}^{N-1}|x_{n+1}-x_n|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_n$ is the signal of length $N$. With this measure, the top two functions would be rated similarly (one big change is similar to lots of small changes), and the bottom function would get a considerably larger value (because of its many large changes).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-22T20:09:08.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15805" PostTypeId="2" ParentId="15791" CreationDate="2014-04-22T20:36:51.500" Score="2" Body="&lt;p&gt;Any metric measuring the relative importance of high-frequency content vs low-frequency content will be correlated with the amount of abrupt changes in the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try spectral roll-off (the frequency under which x% of the energy is concentrated) or &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_centroid&quot; rel=&quot;nofollow&quot;&gt;spectral centroid&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-04-22T20:36:51.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15806" PostTypeId="1" CreationDate="2014-04-22T21:07:24.070" Score="1" ViewCount="230" Body="&lt;p&gt;Its true that HTC one M8 uses dual camera to achieve the 3D Dimension plus effect, but can anybody tell what is it called, if its a series of image manipulation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Demonstrated here, &#xA;&lt;a href=&quot;https://www.youtube.com/watch?v=PuKphXzWwII&quot; rel=&quot;nofollow&quot;&gt;Video&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8670" LastActivityDate="2015-02-20T18:24:12.123" Title="3D effects like HTC One Dimension plus" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15807" PostTypeId="1" AcceptedAnswerId="15812" CreationDate="2014-04-23T05:15:13.707" Score="5" ViewCount="5817" Body="&lt;p&gt;I was watching &lt;a href=&quot;https://www.youtube.com/watch?v=6xaaeop7gJ8#t=1030&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; video where the presenter remarks:  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For a discrete signal, time shift corresponds to phase change in a discrete signal but not vice versa.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was trying to figure out how this could be proved. For example, if our discrete signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f[n] = A \cos(\Omega_o n + n_o)$ where $ n,n_o \in Z$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal undergoes a time shift $n'$, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ A \cos(\Omega_o (n + n') + n_o) = A \cos(\Omega_o n + \Omega_o n' + n_o)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would correspond to a phase shift only if $\Omega_o n'$ is an integer. But that means $\Omega_o$ needs to be an integer, which is not always the case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct explanation here ?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="1606" LastEditDate="2014-04-23T11:20:01.903" LastActivityDate="2014-10-20T21:11:38.627" Title="How does time shift correspond to phase change in a discrete signal?" Tags="|discrete-signals|phase|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15808" PostTypeId="1" AcceptedAnswerId="15819" CreationDate="2014-04-23T05:56:46.200" Score="1" ViewCount="197" Body="&lt;p&gt;In a book [1], gives an equation (equation 5.31 in the book) for estimating frequency offset in OFDM systems proposed by Classen. the procedure is: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;first, two OFDM symbols, $y_l [n]$ and $y_{l+D} [n]$ , are saved in a memory after synchronization. then, the signals are transformed into ${Y_l [k]}_{k=0}^{N-1}$ and ${Y_{l+D} [k]}_{k=0}^{N-1}$ via FFT, from which pilot tones are extracted. After estimating CFO from pilot tones in the frequency domain, the signal is compensated in the time domain. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is the equation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \hat \epsilon_{acq} = \dfrac{1}{2\pi \cdot T_{sub}} \underset{\epsilon}{max} \left \{ \left \vert \sum_{j=0}^{L-1} Y_{l+D}[p[j],\epsilon]\cdot Y_{l}^{*}[p[j],\epsilon]\cdot X_{l+D}^{*}[p[j]]\cdot X_l[p[j]] \right \vert \right \}  $      &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $L$, $p[j]$, and $X_{l}[p[j]]$ are the number of pilot tones, the location of the jth pilot tone, and the pilot tone located at $p[j]$ in the frequency domain at the $l^{th}$ symbol period, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the equation, It's supposed to find the normalized CFO, $\epsilon$. but, the parameter we are finding is involved in the equation $[P[j],ε]$.&#xA;My question is: how this parameter we're supposed to estimate is in the middle of the equation? What type of correlation is this? Or did I misunderstand the equation? Please explain.    &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;[1] Yong Soo Cho et al., &quot;MIMO-OFDM wireless communications with MATLAB&quot;, John Wiley &amp;amp; Sons (asia), 2010&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8597" LastEditorUserId="8597" LastEditDate="2014-04-23T13:39:11.853" LastActivityDate="2014-04-23T17:25:33.647" Title="What type of correlation is this equation?" Tags="|correlation|ofdm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15809" PostTypeId="1" AcceptedAnswerId="88572" CreationDate="2014-04-23T06:36:46.967" Score="3" ViewCount="201" Body="&lt;p&gt;I have images like below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2okOy.png&quot; alt=&quot;Img&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find some measures describing black spots dispersion and diversity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First measures I use are mass center off all black spots, mean area of spot, stdev of area need more ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want measures to describe irregularity, differences etc.&lt;/p&gt;&#xA;" OwnerUserId="583" LastEditorUserId="128" LastEditDate="2023-07-06T20:55:04.913" LastActivityDate="2023-08-06T10:02:40.303" Title="Image objects dispersion and diversity measures" Tags="|image-processing|measurement|connected-components|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15811" PostTypeId="2" ParentId="15789" CreationDate="2014-04-23T07:02:22.047" Score="1" Body="&lt;p&gt;You can find many ready solution in the Internet. For example &lt;a href=&quot;https://stackoverflow.com/questions/5919663/how-does-photoshop-blend-two-images-together&quot;&gt;here&lt;/a&gt; following macro is given:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define ChannelBlend_Overlay(A,B)    ((uint8)((B &amp;lt; 128) ? (2 * A * B / 255):(255 - 2 * (255 - A) * (255 - B) / 255)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Additionally you might want to check this package: &lt;a href=&quot;http://www.barbato.us/2010/12/01/blimageblending-emulating-photoshops-blending-modes-opencv/&quot; rel=&quot;nofollow noreferrer&quot;&gt;blImage&lt;/a&gt; for source code as you can very easilly translate it. I am sure you will find what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-04-23T07:02:22.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15812" PostTypeId="2" ParentId="15807" CreationDate="2014-04-23T07:06:47.717" Score="7" Body="&lt;p&gt;If you have a signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f[n]=\cos(\Omega_0n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you apply a time shift of $n_0$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f[n+n_0]=\cos(\Omega_0(n+n_0))=\cos(\Omega_0n+\Omega_0n_0)=\cos(\Omega_0n+\phi)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi=\Omega_0n_0$ is the phase shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other way around, if you have a phase shift of $\phi$, this is not always equivalent to a time shift of the original signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[n]=\cos(\Omega_0n+\phi)=\cos(\Omega_0(n+\phi/\Omega_0))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which only corresponds to an integer time shift if $\phi/\Omega_0$ is integer, i.e. if $\phi/\Omega_0=n_0$ which results in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[n]=f[n+n_0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Re-reading your question, I think that the misunderstanding lies in the fact that you believe that the phase of a discrete-time signal must be integer. This is not the case. Imagine two continuous-time signals&#xA;$$x(t)=\cos(\omega_0t)\quad\textrm{and}\quad y(t)=\cos(\omega_0t+\phi),\quad\phi\in\mathbb{R}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the following holds for any value of $\phi$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=x(t+\phi/\omega_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we can always express $y(t)$ as a shifted version of $x(t)$. Now imagine that we construct two discrete-time signals by sampling $x(t)$ and $y(t)$ at times $t_n=nT$ with some real-valued $T&amp;gt;0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f[n]=x(nT)=\cos(\omega_0nT)=\cos(\Omega_0n)\\&#xA;g[n]=y(nT)=\cos(\omega_0nT+\phi)=\cos(\Omega_0n+\phi)&#xA;$$&#xA;with $\Omega_0=\omega_0T$. Note that the phase $\phi$ is of course the same as before (and for this reason not necessarily integer). The difference between the continuous-time and the discrete-time case is now that $g[n]$ cannot in general be obtained from $f[n]$ by time-shifting because we can only shift by integers. The condition under which $g[n]$ &lt;em&gt;can&lt;/em&gt; be obtained by shifting $f[n]$ is if $\phi/\Omega_0$ is integer because then we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[n]=\cos(\Omega_0(n+\phi/\Omega_0))=f[n+\phi/\Omega_0]=f[n+n_0],\quad n_0\in\mathbb{Z}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-23T13:28:43.937" LastActivityDate="2014-04-23T13:28:43.937" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="15813" PostTypeId="2" ParentId="15756" CreationDate="2014-04-23T10:45:15.113" Score="2" Body="&lt;p&gt;First of all, pay attention it is a calculation per pixel using a sata from a blog.&#xA;Basically summing the Gradient norm over a block / windows.&lt;/p&gt;&#xA;&lt;p&gt;To calculate what you submitted above do the following:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Define the Finite Differences filters to approximate the gradient. Moreover build the &amp;quot;Win Summation&amp;quot; kernel which sums all elements within a window.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;    mLocalSumFilter = ones(filterWinSize, filterWinSize);&#xA;    vGradXFilter = [-0.5, 0, 0.5];&#xA;    vGradYFilter = [-0.5; 0; 0.5];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Calculate the image gradients:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;    mInputImageGradX = imfilter(mInputImage, vGradXFilter, 'replicate', 'same', 'corr');&#xA;    mInputImageGradY = imfilter(mInputImage, vGradYFilter, 'replicate', 'same', 'corr');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Calculate the norm of the gradient vector. Afterwards sum the norm of the gradient within the window.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;    mInputImageGradNorm = sqrt((mInputImageGradX .^ 2) + (mInputImageGradY .^ 2));&#xA;    mInputImageGradNorm = imfilter(mInputImageGradNorm, mLocalSumFilter, 0, 'same', 'corr') ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is it.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="80" LastEditDate="2022-05-27T13:31:23.303" LastActivityDate="2022-05-27T13:31:23.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15814" PostTypeId="1" CreationDate="2014-04-23T11:52:46.777" Score="2" ViewCount="849" Body="&lt;p&gt;Why is FFT a good method for detection of bearing faults? Why can't we do the analysis in time-domain?&lt;/p&gt;&#xA;" OwnerUserId="8085" LastActivityDate="2014-04-23T15:58:05.290" Title="FFT for bearing fault analysis" Tags="|fourier-transform|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15815" PostTypeId="2" ParentId="13327" CreationDate="2014-04-23T12:57:23.677" Score="1" Body="&lt;p&gt;There are three main characteristics of the filters that are affected by the filter length&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Passband Ripple &lt;/li&gt;&#xA;&lt;li&gt;Transition Width (from passband to stop band, or stop band to passband) &lt;/li&gt;&#xA;&lt;li&gt;Stopband attenuation and roll-off of sidelobes&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, there aren't any formulas for how the length of the window and the type of window used affect all of these 3 aspects of the filter. So you may need to increase the filter length to meet your passband ripple requirement, but it may not meet your required attenuation and/or roll-off requirement, so you'll need an even longer filter. This will need to be done by trial and error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe there were some articles in the IEEE that gave some length formulas when using the Kaiser window, but I don't have the references at hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even the length formulas for using the Parks–McClellan design (Remez exchange) are just a heuristic and were developed after performing a lot of experiments. Even these formulas can fail, often when a corner frequency is near 0 Hz or Fs/2. Most of the time these formulas are a good first estimate you may need a few extra coefficients to meet your exact requirements. Using the estimate of the filter order for the PM algorithm is a good first estimate for the minimum length of your filter using a windowing filter design technique.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="5843" LastEditDate="2015-02-17T20:47:56.630" LastActivityDate="2015-02-17T20:47:56.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15816" PostTypeId="2" ParentId="15814" CreationDate="2014-04-23T13:09:01.580" Score="3" Body="&lt;p&gt;&lt;strong&gt;Short answer&lt;/strong&gt;: We can, but it is not always as robust as frequency domain techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Longer answer&lt;/strong&gt;: This is very broad topic, but let me try to throw some light. Time domain techniques tend to be naive. For example some are based on the &lt;strong&gt;RMS energy&lt;/strong&gt; monitoring of the signal being recorded by an accelerometer. Main disadvantage is that on early stages of fatigue you can't distinguish between faulty and working bearing. Additionally setting a threshold is a real pain. Also some people are using methods based on &lt;strong&gt;crest factor&lt;/strong&gt; (ratio of peak to RMS), knowing that crest factor for impulsive sounds is high. Although there are some 'fancy' methods for analysis in time domain, such as: &lt;a href=&quot;http://www.uni-magdeburg.de/ifme/l-dynamik/quellen/paper_dog_str_edinburgh_source.pdf&quot; rel=&quot;nofollow&quot;&gt;New Time Domain Method for the Detection of Roller Bearing Defects&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency domain techniques (such as Cepstrum or Bispectrum) on the other hand are more robust and have properties that are desirable, such as you can very easily correlate detected fault frequency with a specific bearing and type of damage. For example when you use methods such as Bispectrum, which is (simply speaking) based on detecting presence of higher harmonics. Because it is also taking phase into consideration, in theory even if harmonic is almost covered with noise, you can still detect if its correlated with fundamental frequency - smart isn't it?&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-04-23T13:09:01.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15817" PostTypeId="2" ParentId="15806" CreationDate="2014-04-23T15:24:28.487" Score="1" Body="&lt;p&gt;The technique demonstrated in the video appears to be &quot;image morphing&quot; which is not specific to 3D.  They have &quot;morphed&quot; a left-eye view to a right-eye view and back.  The resulting animation is a form of &quot;wiggle&quot; stereoscopic presentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://en.wikipedia.org/wiki/Morphing&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Morphing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example I just made from an old stereo pair&#xA;of a Civil War cannon, from the Library of Congress.  I used&#xA;ImageMagick's &quot;-morph&quot; option to rock back and forth between&#xA;the two images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.simplesystems.org:/users/glennrp/stereo/loc_cannon.gif&quot; rel=&quot;nofollow&quot;&gt;http://www.simplesystems.org:/users/glennrp/stereo/loc_cannon.gif&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also the &quot;wiggle method&quot; of stereoscopy, with some more examples,&#xA;at &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiggle_stereoscopy&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Wiggle_stereoscopy&lt;/a&gt;&#xA;This method typically just alternates between the left and right images, but sometimes &quot;morphing&quot; or filling in with intermediate photos are used.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2014-04-26T15:25:19.847" LastActivityDate="2014-04-26T15:25:19.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15818" PostTypeId="2" ParentId="15814" CreationDate="2014-04-23T15:58:05.290" Score="0" Body="&lt;p&gt;An FFT is a computationally efficient way of decomposing certain types of system responses.  There may exist roughly equivalent time domain methods of analysis that would require far more computation for similar S/N statistics.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-23T15:58:05.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15819" PostTypeId="2" ParentId="15808" CreationDate="2014-04-23T17:25:33.647" Score="4" Body="&lt;p&gt;I understand your confusion because the equation is barely understandable from the information given in the book. It becomes more clear from the original paper by Classen and Meyr [1] from which it has been taken. They propose a two stage frequency offset estimation that consists of an acquistion stage and a tracking stage. The equation you've cited represents the acquisition algorithm. In fact, it is a searching algorithm that &quot;tries out&quot; various values of frequency offset $\epsilon$ and chooses the one value $\hat\epsilon_\mathrm{acq}$ that yields the maximum correlation sum. It can be described as follows&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For every $\epsilon$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Compensate the received time domain signal for the supposed frequency offset $\epsilon$&lt;/li&gt;&#xA;&lt;li&gt;Calculate the DFT of the frequency offset compensated RX signal. This yields $Y_{l}[p[j],\epsilon]$&lt;/li&gt;&#xA;&lt;li&gt;Calculate the correlation sum $R_\epsilon$. (The term inside $|\cdots|$)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, find the maximum $\hat R_\epsilon$ of all $R_\epsilon$ and calculate the estimated frequency offset by &#xA;$$&#xA;\hat \epsilon_{acq} = \dfrac{\hat R_\epsilon}{2\pi \cdot T_{sub}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Of course it's not feasible to evaluate the correlation sum for every $\epsilon$ because the number of possbile values is infinite. Instead, you have to restrict the range of values to a reasonable frequency offset that is determined by the hardware you're using. Additionaly, this &quot;search range&quot; has to be partitioned into discrete values. The authors of [1] note&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In practice we found that it is sufficient to space the trial parameters $0.1/T_{sub}$ apart from each other.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where $T_\mathrm{sub}$ is the length of one OFDM symbol including guard interval.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1] Classen, F. and Myer, H. (June 1994) Frequency synchronization algorithm for OFDM systems suitable for&#xA;communication over frequency selective fading channels. IEEE VTC’94, pp. 1655 1659.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-04-23T17:25:33.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15820" PostTypeId="1" CreationDate="2014-04-23T21:12:05.950" Score="-1" ViewCount="275" Body="&lt;p&gt;I am new to the topic of system identification and looking for a large Autoregressive (AR) model. Can anybody point out a large stable AR model which has more than 2 coefficients AND there should be a large number of zero coefficients? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/econ/specify-ar-models.html&quot; rel=&quot;nofollow&quot;&gt;This link&lt;/a&gt; presents an example of how to have nonzero coefficients in lag 1,4 for order, $p=4$ AR(4) model. But, the values are NaN !! So, how do I apply this technique so as to generate a large AR model with more number of zero coefficients and lesser number of non-zero coefficients ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for any stable AR($p$) model (preferably popular cited ones, if available) of higher order $p \ge 20$ where the number of non-zero coefficients are few (constraint) . If I generate a noisy sinusoidal wave given below, then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Generate sine wave = A*sin(2*pi*f*t + phi)&#xA;t = linspace(0,1,1000);&#xA;A = 5;&#xA;f = 2;&#xA;phi = pi/8;&#xA;sinewave = A*sin(2*pi*f*t + phi);&#xA;noisy_sine=sinewave+0.5*randn(size(t));&#xA;subplot(1,2,1);&#xA;plot(t, sinewave)&#xA;hold on;&#xA;subplot(1,2,2);&#xA;plot(t,noisy_sine);&#xA;&#xA;%Generate AR model&#xA;order =20;&#xA;ARCoeff = aryule(noisy_sine,order);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It returns AR model of 20 lags. But, all the coefficients are non-zero. How do I generate AR model of any order higher than 2 where the number of non-zero coefficients are lesser than the number of zero coefficients ?&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="1629" LastEditDate="2016-06-14T16:53:13.743" LastActivityDate="2022-04-17T04:04:00.370" Title="Issues in generating AR model with a constraint" Tags="|linear-systems|autoregressive-model|system-identification|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15821" PostTypeId="2" ParentId="15764" CreationDate="2014-04-23T21:13:10.620" Score="1" Body="&lt;p&gt;Indeed the &lt;code&gt;lsim&lt;/code&gt; function is returning scaled values. You might also notice that it is connected to the gain $k$ of your filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[z,p,k] = tf2zpk(sysD.num{1}, sysD.den{1});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will return:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;k=0.002&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can scale it back by the sampling period as you noticed.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-04-23T21:13:10.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15822" PostTypeId="1" AcceptedAnswerId="15826" CreationDate="2014-04-24T02:51:11.243" Score="5" ViewCount="2479" Body="&lt;p&gt;There are many algorithms that can calculate &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;FFT&lt;/a&gt;. Even with &lt;a href=&quot;http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Cooley–Tukey FFT algorithm&lt;/a&gt;, different radix can be used and the algorithms can divided into decimation in time and decimation in frequency. Any comment on how to choose these algorithms in practice?&lt;/p&gt;&#xA;" OwnerUserId="7602" LastActivityDate="2014-04-24T19:00:24.613" Title="How to choose a FFT algorithm?" Tags="|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15823" PostTypeId="1" AcceptedAnswerId="15831" CreationDate="2014-04-24T04:34:08.037" Score="10" ViewCount="17189" Body="&lt;p&gt;For a given time series which is n timestamps in length, we can take Discrete Wavelet Transform (using 'Haar' wavelets), then we get (for an example, in Python) -&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import pywt&#xA;&amp;gt;&amp;gt;&amp;gt; ts = [2, 56, 3, 22, 3, 4, 56, 7, 8, 9, 44, 23, 1, 4, 6, 2]&#xA;&amp;gt;&amp;gt;&amp;gt; (ca, cd) = pywt.dwt(ts,'haar')&#xA;&amp;gt;&amp;gt;&amp;gt; ca&#xA;array([ 41.01219331,  17.67766953,   4.94974747,  44.54772721,&#xA;        12.02081528,  47.37615434,   3.53553391,   5.65685425])&#xA;&amp;gt;&amp;gt;&amp;gt; cd&#xA;array([-38.18376618, -13.43502884,  -0.70710678,  34.64823228,&#xA;        -0.70710678,  14.8492424 ,  -2.12132034,   2.82842712])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where ca and cd are approximation and detailed coefficients. Now if I use all of them I can construct my original time series back using inverse DWT. But instead I want to use a fewer coefficients (like in Fourier Transform if we use only first few coefficients, we can approximately reconstruct the original time series). If I just use &lt;code&gt;ca&lt;/code&gt; or just use &lt;code&gt;cd&lt;/code&gt; I don't get the desired results. If I use only we coefficients from each of them (like first 4), I get only half of the time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I select the coefficients (from &lt;code&gt;ca&lt;/code&gt; and &lt;code&gt;cd&lt;/code&gt;) so that I can approximately create the original signal from them (i.e. most of its energy)?&lt;/p&gt;&#xA;" OwnerUserId="8604" LastEditorUserId="8202" LastEditDate="2022-08-22T19:19:59.880" LastActivityDate="2022-08-23T18:35:21.123" Title="Feature extraction/reduction using DWT" Tags="|python|wavelet|transform|local-features|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15824" PostTypeId="1" CreationDate="2014-04-24T04:59:47.663" Score="2" ViewCount="151" Body="&lt;p&gt;I want to implement the equalizer in matlab. I am just learning this. I want a good kick start code that can help me to learn it further. I searched a lot on Google but do not find a good reference code to start. I have a received signal in matlab that is modulated with QAM-16 modulation and passed through AWGN Noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know much about the equalizers, I also do not know how to find impulse response of that signal. can some body please help me to just let me start some piece of code so that I can learn more in this direction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4126" LastActivityDate="2014-04-24T04:59:47.663" Title="TDE, OFDE and FDE equalizer simplest exmple in matlab" Tags="|matlab|modulation|digital-communications|equalization|equalizer|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15825" PostTypeId="1" AcceptedAnswerId="15829" CreationDate="2014-04-24T07:37:05.063" Score="3" ViewCount="1710" Body="&lt;p&gt;I have rich experience signal-processing, but haven't touched image processing since my happy university days... so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working on a side project, I need to enhance ridges (continuous lines) in a 2D grey-scale image. Using Matlab, I'm at a point where Canny edge detection does a great job, but since many lines are thick, I get 2-edges for each ridge. Some Questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is Canny a tool fit for the task?&lt;/li&gt;&#xA;&lt;li&gt;If so, How do I adapt the Canny algorithm to enhance ridges, instead of edges?&lt;/li&gt;&#xA;&lt;li&gt;Where can I find a good intro to Canny edge detection (googled it, nothing &lt;strong&gt;really&lt;/strong&gt; helpful found)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8679" LastEditorUserId="8679" LastEditDate="2014-04-25T14:30:07.220" LastActivityDate="2014-04-25T14:30:07.220" Title="Canny non-max suppression intro" Tags="|image-processing|canny-edge-detector|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15826" PostTypeId="2" ParentId="15822" CreationDate="2014-04-24T10:03:27.967" Score="10" Body="&lt;p&gt;Both Cooley-Tukey and Radix DIT &amp;amp; DIF are based on the same principle, dividing the N samples into two groups, and doing the same for the resulting two groups recursively. DIT and DIF generally use Radix2, that is, split N into two N/2 groups and provide a $N\log{N}$ time, while Cooley-Tukey is a generalization which splits it into $N_1$ and $N_2$ groups, where $N=N_1\cdot N_2$. Cooley-Tukey also provides $N\log{N}$ time in most cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, Radix DIT and DIF (both special cases of the Cooley-Tukey) are very similar and provide the same optimization in terms of operation savings, with the difference being &lt;a href=&quot;http://en.wikipedia.org/wiki/Bit-reversal_permutation&quot; rel=&quot;noreferrer&quot;&gt;bit reversed&lt;/a&gt; samples either on the input or the output. These can be done in $O(N)$ time, either before (DIT) or after (DIF) calculating the DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, in some cases you don't even have do to the bit-reversal. Some applications (such as convolution) work equally well on bit-reversed data, so one can perform forward transforms, processing, and then inverse transforms all without bit reversal to produce final results in the natural order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, as an answer to your question, you can use Radix2 DIT or DIF FFT, depending on the application (see above paragraph), with the same result: Instead of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$4N^2 \quad\text{real multiplications}\\&#xA;4N^2-2N \quad\text{real additions}.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We achieved:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$2N\log_2{N}-7N+12 \quad\text{real multiplications}\\&#xA;3N\log_2{N}-3N+4 \quad  \text{real additions}.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that Radix DIT and DIF algorithms require that $N=2^p$, which is generally easy to satisfy. Increasing the radix gives us $\log_4$ for radix4, etc., which increases the calculation complexity on hardware, and in turn decreases the number of operations by ~$25\%$. Radix 2 and 4 are considered the most common, while Radix 8 (~$8\%$ optimization) and up generally demand too complex hardware for too small optimizations. Cooley-Tukey gives similar results, with more room for tweaking - in case of a specific $N$, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further optimizations, there are the &lt;a href=&quot;http://en.wikipedia.org/wiki/Split-radix_FFT_algorithm&quot; rel=&quot;noreferrer&quot;&gt;split-radix algorithm&lt;/a&gt; which uses both Radix 2 and Radix 4 , and many more application-specific algorithms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Other algorithms include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bruun's algorithm:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's not used much because Cooley-Tukey algorithm offers at least the same, and often better optimization. It was developed as a means to calculate DFT of real data (as opposed to complex).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rader's algorithm:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Rader's algorithm is used for cases where $N$ is a prime number, often a big prime number. Note that above mentioned algorithms require $N = 2^k$, so they don't really work for other $N$. Rader's algorithm guarantees $N\log{N}$ time for prime $N$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bluestein's algorithm:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Bluesten's algorithm calculates the DFT via convolution, and is another way of dealing with $N \neq 2^k$. For prime numbers, it offers $N\log{N}$ time, for even numbers Cooley-Tukey algorithm is better, and for odd numbers it offers a somewhat better time than Cooley-Tukey.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note, however, that for all such cases for $N$ it's possible to zero-pad the input series until we get an $N = 2^k$ and then use the Cooley-Tukey's algorithm. Of course, for prime $N$ it's more efficient to use Rader's or Bluestein's algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, these algorithms were developed at different points in time, so some are more efficient than the others. &lt;/p&gt;&#xA;" OwnerUserId="4710" LastEditorUserId="8202" LastEditDate="2014-04-24T19:00:24.613" LastActivityDate="2014-04-24T19:00:24.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15827" PostTypeId="1" CreationDate="2014-04-24T11:17:55.213" Score="0" ViewCount="856" Body="&lt;p&gt;Hi I need to simulate a simple multipath channel in matlab through which I can send my OFDM transmission signal, I want to test my OFDM receiver design.&#xA;So far I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Passing through Channel&#xA;nIFFT = 4096;&#xA;&#xA;% Create channel&#xA;channel = randn(1,nIFFT) + sqrt(-1)*randn(1,nIFFT);&#xA;&#xA;% cext_data is the signal to be transmitted&#xA;after_channel = filter(channel, 1, cext_data); &#xA;wavwrite(after_channel,'ofdm_tx8khz.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get a warning when I run the transmitter:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Warning: Data clipped during write to file:ofdm_tx8khz.wav&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and when I run the receiver I get: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Index exceeds matrix dimensions.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Error in ofdm_rx (line 26)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;chunk2 = signal((s+nIFFT):(s+nIFFT+nCyclic-1));&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was really hoping someone could help me simulate a multipath channel for my OFDM program.&lt;/p&gt;&#xA;" OwnerUserId="8572" LastEditorUserId="8202" LastEditDate="2014-04-24T12:12:17.363" LastActivityDate="2014-04-24T13:48:13.947" Title="Simulate a simple multipath channel for OFDM Modulation test. MATLAB" Tags="|matlab|ofdm|multipath|" AnswerCount="1" CommentCount="1" ClosedDate="2014-05-13T03:54:38.370" ContentLicense="CC BY-SA 3.0" />
  <row Id="15828" PostTypeId="2" ParentId="15827" CreationDate="2014-04-24T11:51:41.260" Score="1" Body="&lt;p&gt;Wav files expect values from -1 to +1.  You are probably exceeding those limits when you filter the signal through the channel model.  After the channel filter add the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;after_channel = after_channel / max(abs(after_channel));&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect, though, that you will still have a problem.  I believe that wavwrite ignores the imaginary part of complex data, so you will be losing that part of the signal.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2014-04-24T13:48:13.947" LastActivityDate="2014-04-24T13:48:13.947" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="15829" PostTypeId="2" ParentId="15825" CreationDate="2014-04-24T12:04:34.157" Score="5" Body="&lt;p&gt;Canny's original paper addressed the issue of ridge edges and roof edges in addition to step edges, but I'm unaware of any implementation of &quot;Canny&quot; edge detection that detects anything other than step edges.  Canny's paper is a pretty easy read, but, unfortunately, paywalled.  J. Canny, &quot;A computational approach to edge detection&quot;, &lt;em&gt;IEEE Trans. Pattern Analysis and Machine Intelligence&lt;/em&gt;, 8:679-714, 1986.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Canny's paper is really about how to use calculus of variations to derive a 1-dimensional filter that has optimal response to each type of edge.  It turns out that the ridge-edge filter is not scale invariant (you have to know how wide your ridges are).  Here is the picture from Canny's paper of the optimal ridge and roof detection operators (page 683, &amp;copy; IEEE, 1986, this is &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Fair_use&quot; rel=&quot;nofollow noreferrer&quot;&gt;fair use&lt;/a&gt;&quot;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5NIl0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is typically called &quot;Canny edge detection&quot; is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Perform an approximation of a derivative of Gaussian function in X and Y.  (This is usually done with a Gaussian blur followed by the Sobel operator.)  (The derivative of Guassian is actually &lt;em&gt;not&lt;/em&gt; the optimal step-edge detection operator, but the optimal step-edge detection operator &quot;kinda-looks-like&quot; a derivative of Gaussian.)&lt;/li&gt;&#xA;&lt;li&gt;Convert from $\langle\Delta x, \Delta y\rangle$ form at each pixel to $\langle$magnitude,&quot;angle&quot;$\rangle$.  (Where &quot;angle&quot; is a 2-bit approximation that tells you whether the edge is closer to horizontal, vertical or one of the two 45-degree diagonals.)&lt;/li&gt;&#xA;&lt;li&gt;&quot;Thinning&quot;: For each pixel look at its two neighbors in the &quot;angle&quot; direction and keep the pixel only if it is the maximum of itself and its two neighbors.  (Otherwise set the magnitude to 0.)&lt;/li&gt;&#xA;&lt;li&gt;&quot;Thresholding&quot;: For each pixel with magnitude less than some &quot;weak threshold&quot; suppress the pixel to 0.  For each pixel with magnitude greater than some &quot;strong threshold&quot; set the pixel to whatever value means &quot;definitely an edge.&quot;  For pixels between the two thresholds set the pixel to the value &quot;maybe an edge&quot;.&lt;/li&gt;&#xA;&lt;li&gt;Hysteresis: For each &quot;maybe an edge&quot; pixel change it to &quot;definitely an edge&quot; if any of its 8 neighbors in the horizontal, vertical or diagonal directions is &quot;definitely an edge.&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Theoretically, you should be able to turn a Canny edge detector into a ridge-edge detector by changing just step 1, but I've never tried it.&lt;/p&gt;&#xA;" OwnerUserId="3764" LastEditorUserId="3764" LastEditDate="2014-04-24T18:11:10.187" LastActivityDate="2014-04-24T18:11:10.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15830" PostTypeId="1" CreationDate="2014-04-24T12:51:40.213" Score="5" ViewCount="290" Body="&lt;p&gt;I try to resolve false edge problem in image segmentation. Let see its defination in Figure. The false edge problem often occurs in inhomogeneity image, especially for medical image. I am finding the method or feature to resolve it and achieve real edge. I try to apply some existing method example: localizing active contour, graph cut but they are not effective. I also apply gradient or entropy in here. Could you suggest some idea or feature or method to resolve it?Thank all . You can download test image at &lt;a href=&quot;https://www.dropbox.com/sh/ttymp4vnpjhbvfx/2iacME5zYp&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/sh/ttymp4vnpjhbvfx/2iacME5zYp&lt;/a&gt; . Note: orginal image is &quot;input.mat&quot;. Its type is 16 bit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MDFTN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let see example,In my marked image, B is real edge. We only analyse A point. At the A point, the intensity bigger than object region, but it not so big. Assume intensity of A point is 300, in which object intensity is about 260-280 (inhomogeneity property). So we can said A point is background, if we calssify it into two region. Sorry, you are true, the question must be update that A is true edge and C is false edge(because C is create by other region and background); true edge is created by object region and background&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rsESc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="8264" LastEditDate="2014-04-25T06:14:43.933" LastActivityDate="2015-05-18T23:50:14.793" Title="How to segment with false edge in in image?" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15831" PostTypeId="2" ParentId="15823" CreationDate="2014-04-24T13:29:09.047" Score="11" Body="&lt;p&gt;I think it is kind'a similar to soft and hard thresholding using in wavelet de-noising. Have you come across this topic? &lt;code&gt;pywt&lt;/code&gt; has already an in-built function for this purpose. Please take a closer look at this code and try to play with it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pywt&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;&#xA;ts = [2, 56, 3, 22, 3, 4, 56, 7, 8, 9, 44, 23, 1, 4, 6, 2]&#xA;&#xA;(ca, cd) = pywt.dwt(ts,'haar')&#xA;&#xA;cat = pywt.thresholding.soft(ca, np.std(ca)/2)&#xA;cdt = pywt.thresholding.soft(cd, np.std(cd)/2)&#xA;&#xA;ts_rec = pywt.idwt(cat, cdt, 'haar')&#xA;&#xA;plt.close('all')&#xA;&#xA;plt.subplot(211)&#xA;# Original coefficients&#xA;plt.plot(ca, '--*b')&#xA;plt.plot(cd, '--*r')&#xA;# Thresholded coefficients&#xA;plt.plot(cat, '--*c')&#xA;plt.plot(cdt, '--*m')&#xA;plt.legend(['ca','cd','ca_thresh', 'cd_thresh'], loc=0)&#xA;plt.grid('on')&#xA;&#xA;plt.subplot(212)&#xA;plt.plot(ts)&#xA;plt.hold('on')&#xA;plt.plot(ts_rec, 'r')&#xA;plt.legend(['original signal', 'reconstructed signal'])&#xA;plt.grid('on')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will produce following - hope this will guide you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ejyaO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note on running the code with the latest versions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you get an error like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;module 'pywt' has no attribute 'thresholding'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;use on line 9 and 10:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; cat = pywt.threshold(ca, np.std(ca)/2, mode='soft')&#xA; cdt = pywt.threshold(cd, np.std(cd)/2, mode='soft')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if you get an error on:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;plt.hold('on') then comment this line out:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  # plt.hold('on')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2019-07-23T23:40:18.003" LastActivityDate="2019-07-23T23:40:18.003" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15833" PostTypeId="2" ParentId="15790" CreationDate="2014-04-24T17:24:20.707" Score="6" Body="&lt;p&gt;the first thing that one must understand when doing fixed-point arithmetic is that, at the basic level, it is &lt;strong&gt;integer&lt;/strong&gt; arithmetic with some scaling factors applied.  perhaps just one scaling factor applied.  this scaling factor is directly related to the position of the binary point.  unless the chip is a fixed-point DSP or similar, the binary point is &lt;strong&gt;implied&lt;/strong&gt;, not explicit.  it, and the associated scaling factor, exists only in the mind of the programmer.  the CPU only thinks it is working on integers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as an example an unsigned, fixed-point, 16-bit format, that i would call &quot;1.15&quot; or, perhaps &quot;Q1.15&quot; (i think the &quot;Q&quot; is superfluous and notation like &quot;Q16&quot; does not supply enough information) has 1 bit to the left of the binary point and 15 bits to the right.  but the 16 bits, sitting all by themselves, is an integer.  the range of that unsigned integer, $n$, is $0 \le n \le 2^{16}-1$.  but the range of the unsigned fixed-point number implied $\hat{n}$ is $0 \le \hat{n} \le 2 - 2^{-15}$ = 1.99996948242188 .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the relationship between the two is:&#xA;$$ \hat{n} = n \cdot 2^{-15} $$&#xA;or&#xA;$$ n = \hat{n} \cdot 2^{15} $$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that the &quot;15&quot;(or &quot;-15&quot;) in the exponents is the same as the &quot;15&quot; in the &quot;Q1.15&quot; notation.  the scaling factor is directly related to the number of implied bits to the right of the binary point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if, instead it was a 16-bit &lt;em&gt;signed&lt;/em&gt;, we might use &quot;s.15&quot; or &quot;Qs.15&quot; notation to refer to the format, the range of the signed integer $n$ is $-2^{15} \le n \le +2^{15} - 1$.  and the range of the implied fixed-point value, $\hat{n}$, is $-1 \le \hat{n} \le 1 - 2^{-15}$ = 0.99996948242188 .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the mapping between the two is the same as above:&#xA;$$ \hat{n} = n \cdot 2^{-15} $$&#xA;or&#xA;$$ n = \hat{n} \cdot 2^{15} $$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the only difference is the use of &lt;code&gt;unsigned int&lt;/code&gt; vs. &lt;code&gt;int&lt;/code&gt; in your C code.  they both have the same number of bits to the right of the binary point and they both have the same mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now when C does addition or subtraction or multiplication or division of these values, it is operating on the &lt;strong&gt;integer&lt;/strong&gt; representation of those values.  but the integer representation is the same as your implied value, except for the scaling factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if you want to divide some numerator $\hat{n}$ by some denominator $\hat{d}$ to result in some quotient $\hat{q}$, you must first establish what the ranges of all three numbers are.  then establish how many bits are to the right of the binary point for each number.  then map those numbers $\hat{n}$ and $\hat{d}$ to their integer values $n$ and $d$, and determine what the range of the integer quotient is &lt;strong&gt;before&lt;/strong&gt; it is adjusted to represent $\hat{q}$.  there will be a scaling factor that will pop out at you (a power of 2) which will imply shifting of either $n$ or $d$ (most likely $n$) before the integer division is done.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-04-24T17:24:20.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15836" PostTypeId="1" CreationDate="2014-04-24T21:53:24.930" Score="2" ViewCount="1231" Body="&lt;p&gt;I have a dataset that contains multiple channels recorded over time (think EEG or EMG), and I'm working on a computational model for this data. When I have a working version of the model, I'd like to compare the model's predictions to some held-out test recordings. I thought it would be nice use some sort of signal-to-noise analysis to do this comparison, but I can't find much help on whether it even makes sense to try to compute SnR for multi-channel data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything I've seen so far about computing SnR assumes that you have a single time-varying channel to analyze. Should I compute the SnR for each channel of my data independently, and then average the values across channels? How is this sort of analysis typically handled in signal processing?&lt;/p&gt;&#xA;" OwnerUserId="5209" LastActivityDate="2021-08-19T06:06:35.567" Title="Can I compute signal-to-noise ratio on a vector-valued or multi-channel signal?" Tags="|snr|multi-channel|emg|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15837" PostTypeId="2" ParentId="11345" CreationDate="2014-04-24T23:16:13.540" Score="0" Body="&lt;p&gt;Might I suggest a completely different approach for those who don't use Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is quite simple to get 2nd order IIR filter coefficients from the 1st and/or 2nd order coefficients of H(s). This link shows the derivations for low pass, high pass, band pass, and notch IIR filters. The final results are quite simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.iowahills.com/A4IIRBilinearTransform.html&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/A4IIRBilinearTransform.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2014-04-24T23:16:13.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15838" PostTypeId="2" ParentId="14603" CreationDate="2014-04-25T01:42:08.013" Score="3" Body="&lt;p&gt;The complex conjugate is applied in the frequency domain, which corresponds to flipping the signal backwards in the time domain. When you have $$f(x)\psi^*_{s,u}(x)$$ this is a multiplication in the frequency domain. Multiplication becomes convolution in the time domain. So you should use &lt;code&gt;conv(f,fliplr(psi))&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-04-25T01:42:08.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15839" PostTypeId="1" CreationDate="2014-04-25T05:47:48.477" Score="0" ViewCount="194" Body="&lt;p&gt;I'm trying to compute the impulse response for the following system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(n) = \frac{1}{2} \left( x(n) + x(n-1) \right) + \frac{1}{2} y(n-1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and am told to assume that $y(-1)=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My solution&lt;/strong&gt;: Letting $x(n) = \delta(n)$, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(n) = \frac{1}{2}\left(\delta(n) + \delta(n-1)\right) + \frac{1}{2}h(n-1).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging in a few values for $n$ (and assuming that $h(-1)=0$), I've obtained:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(0) = \frac{1}{2},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(1) = \frac{1}{2} + \frac{1}{2} \cdot \frac{1}{2} = \frac{3}{4}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(2) = \frac{1}{2} + \frac{1}{2} \cdot \frac{3}{4} = \frac{3}{8}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, I've observed that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(n) = \begin{cases}&#xA;0, &amp;amp; n&amp;lt;0 \\&#xA;\frac{1}{2}, &amp;amp; n=0 \\&#xA;\frac{1}{2} + \left(\frac{1}{2}\right)^n, &amp;amp; n &amp;gt; 0&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this seem correct? I feel like I made a mistake somewhere and that the expression for $h(n)$ should be in a simpler form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: I computed the impulse response by taking the Fourier Transform and then plugging in values for $n$ and got something different than this. However, I believe that this discrepancy is due to the initial condition $y(-1)=0$.&lt;/p&gt;&#xA;" OwnerUserId="8686" LastEditorUserId="8686" LastEditDate="2014-04-25T06:30:22.467" LastActivityDate="2014-05-25T07:32:04.940" Title="Computing impulse response for system with feedback terms" Tags="|homework|impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15840" PostTypeId="2" ParentId="15839" CreationDate="2014-04-25T07:18:52.453" Score="-1" Body="&lt;p&gt;The line $h[2] = \dots$ should be $h[2] = \frac{1}{2}h[1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the z-transform to derive the inpulse response:&#xA;$x[n] = \delta[n] \Rightarrow X(z) = 1$&#xA;$Y(z) = .5 (1+z^{-1}) + .5 Y(z) z^{-1} \Rightarrow Y(z) = .5 \frac{1+z^{-1}}{1-.5z^{-1}} = .5 \left( \frac{1}{1-.5z^{-1}} + z^{-1}\frac{1}{1-.5z^{-1}} \right)$&#xA;$\Rightarrow y[n] = .5 \left( .5^{n} u[n] + .5^{n-1} u[n-1] \right)$, Where $u[n]$ is the heaviside step function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Table_of_common_Z-transform_pairs&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt; for transform pairs.&lt;/p&gt;&#xA;" OwnerUserId="8578" LastActivityDate="2014-04-25T07:18:52.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15841" PostTypeId="2" ParentId="15839" CreationDate="2014-04-25T07:19:50.847" Score="2" Body="&lt;p&gt;Your values for $h(0)$, $h(1)$ and $h(2)$ are correct. However, the general formula isn't.&#xA;It should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(n) = \begin{cases}&#xA;0, &amp;amp; n&amp;lt;0 \\&#xA;\frac{1}{2}, &amp;amp; n=0 \\&#xA;\frac{3}{2}\left(\frac{1}{2}\right)^n, &amp;amp; n &amp;gt; 0&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple way to solve such problems is to use the $\mathcal{Z}$-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=\frac{1}{2}X(z)(1+z^{-1})+\frac{1}{2}Y(z)z^{-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y(z)}{X(z)}=\frac{1}{2}\frac{1+z^{-1}}{1-\frac{1}{2}z^{-1}}=&#xA;\frac{1}{2}\frac{1}{1-\frac{1}{2}z^{-1}}+\frac{1}{2}\frac{z^{-1}}{1-\frac{1}{2}z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the transform pair&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{1-az^{-1}}\Longleftrightarrow a^nu(n),\quad |a|&amp;lt;1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and with the property&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n-1)\Longleftrightarrow z^{-1}X(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you arrive at&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(n)=\frac{1}{2}\left(\frac{1}{2}\right)^nu(n)+\frac{1}{2}\left(\frac{1}{2}\right)^{n-1}u(n-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which corresponds to above result.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-04-25T07:26:59.440" LastActivityDate="2014-04-25T07:26:59.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15842" PostTypeId="2" ParentId="15820" CreationDate="2014-04-25T08:38:52.630" Score="0" Body="&lt;p&gt;I was able to produce the AR(p) model with much of zero-coefficients. I use &lt;a href=&quot;http://scilab.org/&quot; rel=&quot;nofollow&quot;&gt;Scilab&lt;/a&gt; rather than Matlab, therefore I'll just describe the technique:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Generate some appropriate data with the desired spectral properties - the AR model will mimic these spectral properties.&lt;/li&gt;&#xA;&lt;li&gt;Fit the AR model of the desired order to your data.&lt;/li&gt;&#xA;&lt;li&gt;Find the desired number of the coefficients with &lt;em&gt;the lowest values&lt;/em&gt; and reset them to zero &lt;br&gt; (something like &lt;code&gt;a(find(abs(a) &amp;lt; stdev(a) / 2)) = 0&lt;/code&gt; - valid in Scilab).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The resulting model should (may?) still has a similar spectral properties &amp;amp; satisfy your requirements considering zero-coefficients.&lt;/p&gt;&#xA;" OwnerUserId="8540" LastActivityDate="2014-04-25T08:38:52.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15843" PostTypeId="1" CreationDate="2014-04-25T08:48:34.430" Score="1" ViewCount="2185" Body="&lt;p&gt;I am looking at data like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ybki4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Source data: &lt;a href=&quot;http://pastebin.com/raw.php?i=L6cd8d5K&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/raw.php?i=L6cd8d5K&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The data is quasi-periodic, there is a distinct cycle but it is not an exact repeat, and the period changes considerably.  I would like to find accurate peak positions, and period durations, for each cycle.  Ideally the peak positions would match the intuitive notion of where the exact peak is.&lt;/p&gt;&#xA;&lt;p&gt;What makes this hard:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;noise: although it may not be entirely noise!  the variation is much greater when the values are high, and so the highest spikes tend to occur near where the &amp;quot;real&amp;quot; peak is.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the waveform is not symmetrical: neither left-to-right nor up-down.  doing something like a highpass filter will move peaks up and down by an amount that depends on their duration and the shape in between.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What is unlikely to work well:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;bandpass filter combined with conventional peak picking: the position of the peaks will shift since values from the (asymmetrical) up and down slopes is added to where the peak is.  The really high values will not have a high weight in the result since the lowpass part of the bandpass filter will spread their energy to adjacent values.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;autocorrelation: the shape of successive cycles is too different.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;period durations measured from the leading (or trailing) edge of one cycle to the next: again shapes are too different.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="3650" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-07-25T18:55:22.753" Title="How to find peaks and periods?" Tags="|noise|autocorrelation|peak-detection|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15844" PostTypeId="2" ParentId="15843" CreationDate="2014-04-25T09:11:39.293" Score="2" Body="&lt;p&gt;Personally, I would just use a lowpass filter  try and keep it as small as possible to reduce the effect of asymmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that there is significant noise already implies some uncertainty in the peak position, I expect this will be of similar or greater magnitude to any bias the filter introduces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are really concerned about the bias you could look at using morphological opening and closing filters. This is basically running a ball over/under the surface so either one will over/underestimate the peak height. You can then get 2 lines to give an envelope of where the peak may lie.  The average of the two curves is probably a decent estimate of the &quot;true&quot; curve prodived the noise frequency is suitably high.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-04-25T09:11:39.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15846" PostTypeId="2" ParentId="8800" CreationDate="2014-04-25T11:10:14.090" Score="-2" Body="&lt;p&gt;I think this code would be helpful, as displaying intensity part gives you the spatial characteristics of an image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Write a MATLAB function which converts an RGB to HSI. Display the Hue&#xA;%image, Saturation image and the Intensity image. Histogram equalize the H,&#xA;%S and I images and the HSI image. Then convert the HSI image back to RGB.&#xA;&#xA;function rgbtohsi(x)&#xA;F=imread('C:\Documents and Settings\admin\Desktop\TM\tanya\img3.tif ');&#xA;F=im2double(F);&#xA;r=F(:,:,1);&#xA;g=F(:,:,2);&#xA;b=F(:,:,3);&#xA;th=acos((0.5*((r-g)+(r-b)))./((sqrt((r-g).^2+(r-b).*(g-b)))+eps));&#xA;H=th;&#xA;H(b&amp;gt;g)=2*pi-H(b&amp;gt;g);&#xA;H=H/(2*pi);&#xA;S=1-3.*(min(min(r,g),b))./(r+g+b+eps);&#xA;I=(r+g+b)/3;&#xA;hsi=cat(3,H,S,I);&#xA;HE=H*2*pi;&#xA;HE=histeq(HE);&#xA;HE=HE/(2*pi);&#xA;SE=histeq(S);&#xA;IE=histeq(I);&#xA;choice=input('1:RGB to HSI\n2:Display Hue, Saturation and Intensity Images\n3:HSI to         &#xA;    RGB\n4:Hue-Equalization\n5:Saturation-Equalization\n6:Intensity-&#xA;    Equalization\n7:HSI-   Equalization\n Enter your choice :');&#xA;switch choice&#xA;case 1&#xA;    figure,imshow(F),title('RGB Image');&#xA;    figure, imshow(hsi),title('HSI Image');&#xA;case 2&#xA;    figure,imshow(F),title('RGB Image');&#xA;    figure, imshow(H),title('Hue Image');&#xA;    figure, imshow(S),title('Saturation Image');&#xA;    figure, imshow(I),title('Intensity Image');   &#xA;case 3&#xA;    C=hsitorgb(hsi);&#xA;    figure,imshow(hsi),title('HSI Image');&#xA;    figure, imshow(C),title('RGB Image');&#xA;case 4&#xA;    RV=cat(3,HE,S,I);&#xA;    C=hsitorgb(RV);&#xA;    figure,imshow(hsi),title('HSI Image');&#xA;    figure,imshow(F),title('RGB Image');&#xA;    figure, imshow(C),title('RGB Image-Hue Equalized');&#xA;case 5&#xA;    RV=cat(3,H,SE,I);&#xA;    C=hsitorgb(RV);&#xA;    figure,imshow(hsi),title('HSI Image');&#xA;    figure,imshow(F),title('RGB Image');&#xA;    figure, imshow(C),title('RGB Image-Saturation Equalized');&#xA;case 6&#xA;    RV=cat(3,H,S,IE);&#xA;    C=hsitorgb(RV);&#xA;    figure,imshow(hsi),title('HSI Image');&#xA;    figure,imshow(F),title('RGB Image');&#xA;    figure, imshow(C),title('RGB Image-Intensity Equalized');&#xA;case 7&#xA;    RV=cat(3,HE,SE,IE);&#xA;    C=hsitorgb(RV);&#xA;    figure,imshow(hsi),title('HSI Image');&#xA;    figure,imshow(F),title('RGB Image');&#xA;    figure, imshow(C),title('RGB Image-HSI Equalized');&#xA;    F1=C;&#xA;    otherwise&#xA;    display('Wrong choice');&#xA;end&#xA;end&#xA;    function C=hsitorgb(hsi)&#xA;    HV=hsi(:,:,1)*2*pi;&#xA;    SV=hsi(:,:,2);&#xA;    IV=hsi(:,:,3);&#xA;    R=zeros(size(HV));&#xA;    G=zeros(size(HV));&#xA;    B=zeros(size(HV));&#xA;%RG Sector&#xA;    id=find((0&amp;lt;=HV)&amp;amp; (HV&amp;lt;2*pi/3));&#xA;    B(id)=IV(id).*(1-SV(id));&#xA;    R(id)=IV(id).*(1+SV(id).*cos(HV(id))./cos(pi/3-HV(id)));&#xA;    G(id)=3*IV(id)-(R(id)+B(id));&#xA;&#xA;%BG Sector&#xA;    id=find((2*pi/3&amp;lt;=HV)&amp;amp; (HV&amp;lt;4*pi/3));&#xA;    R(id)=IV(id).*(1-SV(id));&#xA;    G(id)=IV(id).*(1+SV(id).*cos(HV(id)-2*pi/3)./cos(pi-HV(id)));&#xA;    B(id)=3*IV(id)-(R(id)+G(id));&#xA;%BR Sector&#xA;    id=find((4*pi/3&amp;lt;=HV)&amp;amp; (HV&amp;lt;2*pi));&#xA;    G(id)=IV(id).*(1-SV(id));&#xA;    B(id)=IV(id).*(1+SV(id).*cos(HV(id)-4*pi/3)./cos(5*pi/3-HV(id)));&#xA;    R(id)=3*IV(id)-(G(id)+B(id));&#xA;    C=cat(3,R,G,B);&#xA;    C=max(min(C,1),0);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8688" LastEditorUserId="8202" LastEditDate="2014-04-25T12:34:40.547" LastActivityDate="2014-04-25T12:34:40.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15848" PostTypeId="1" AcceptedAnswerId="15849" CreationDate="2014-04-25T18:43:00.467" Score="0" ViewCount="303" Body="&lt;p&gt;Hi I am trying to get the image size of the uploaded image in MATLAB. So far I have got :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;read=imread(image.png)&#xA;&#xA;ymax=size(read) (1);&#xA;xmax=size(read) (2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this gives me an error. The image size is 300px by 256px, and I want my &lt;code&gt;ymax&lt;/code&gt; and &lt;code&gt;xmax&lt;/code&gt; to automatically get the pixel values. How do I do this?&lt;/p&gt;&#xA;" OwnerUserId="8572" LastEditorUserId="8202" LastEditDate="2014-04-25T22:55:10.520" LastActivityDate="2014-04-25T22:55:10.520" Title="Input image size in MATLAB" Tags="|image-processing|matlab|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15849" PostTypeId="2" ParentId="15848" CreationDate="2014-04-25T18:50:40.053" Score="2" Body="&lt;p&gt;It's not a MATLAB'ish way of doing that, try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[xmax, ymax, nchan] = size(read);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;nchan&lt;/code&gt; is the number of channels. Also it can be done by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xmax = size(read, 1);&#xA;ymax = size(read, 2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or even:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[xmax, ymax, ~] = size(read);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-04-25T18:56:05.857" LastActivityDate="2014-04-25T18:56:05.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15850" PostTypeId="1" CreationDate="2014-04-25T19:10:41.077" Score="2" ViewCount="1325" Body="&lt;p&gt;I'm reading a material where it says that a filter mask or kernel can be separable if the matrix of the filter mask has a rank 1. The two slides which describes this are as below:&lt;img src=&quot;https://i.stack.imgur.com/vAIiA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lv2AJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading these slides it seems to me that it's trying to mean that the averaging filter can be separable, while Laplacian of Gaussian(LoG) is not. But it doesn't make sense to me, because LoG is the combination of two filters, laplacian and gaussian while in the contrary the averaging filter is just one filter, how can an averaging filter be separable? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really confused on this matter. It would be helpful if you can make any sense out of this and explain me. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="6990" LastActivityDate="2019-10-02T21:43:17.687" Title="Role of the rank of the filter mask matrix in image processing?" Tags="|image-processing|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15851" PostTypeId="2" ParentId="13368" CreationDate="2014-04-25T19:17:03.623" Score="1" Body="&lt;p&gt;It's not only about sensitivity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all microphones with 1/2&quot; capsule are more expensive than ones with 1/4&quot;. Obviously it is not always a rule, but the bigger area of the diaphragm the more sensitive microphone is. Additionally size dictates its mechanical properties (resonance frequency, frequency range, etc.). But is sensitivity so important?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes we don't want our microphones to be so sensitive, especially when you want to measure things like gunshots or jet engines. In that case you need less sensitive capsule, such as B&amp;amp;K 4941, which is 1/4&quot; and has sensitivity of 0.09 mv/Pa! This ensures you will get 184 dB of maximum SPL - it is a lot! Mind that maximum SPL for sound wave at standard atmospheric pressure is ~194 dB, above there is a shockwave. And believe me - this microphone is way more expensive than some with 50 mv/Pa in their specification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore thing you should consider on first place, is to choose capsule with least Residual Noise Floor. This will minimise any noise in your measurements and affect the Dynamic Range of measurement kit. Small &lt;em&gt;curio&lt;/em&gt;: you can even buy microphones with very high sensitivity (1.1V/Pa) that are allowing you to measure the sound levels even down to -2dBA! G.R.A.S. 40HF could be an example - it has 1 inch membrane. You can imagine how expensive is this microphone...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to wrap it up. I suggest you to focus mainly on two things. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are not after measuring high SPL, then get the microphone with decent sensitivity and least possible noise floor. Also do not forget about it's frequency characteristic - you want it to be as flat as possible.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Please also pay attention to built quality of your microphone and other possible applications. For example you can buy ones with XLR connection and 48V phantom supply  (instead of 200V and LEMO connector) - such microphone can be used also with normal USB audio interface as measurement mic.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Please also remember that meter is very important as it can provide automatic scaling of dynamic range and ensures the bandwidth of your measurement. Plenty of low budget SLM's allow you only to measure up to 8kHz, and you must switch between ranges. What's more, when you switch between low and high it produces different results...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-04-25T19:22:18.740" LastActivityDate="2014-04-25T19:22:18.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15852" PostTypeId="2" ParentId="15850" CreationDate="2014-04-25T19:21:22.077" Score="2" Body="&lt;p&gt;Separable just means you can do it in the x-direction and then in the y-direction and have it come out the same as if you did it in both dimensions simultaneously to begin with. It's not too hard to see that this will work for an average filter. If the filter is averaging over a 3x3 grid then in the 2-d case you take an average of nine values. In the separable filter case you first take three averages of three values. Then you average those three averages together. In both cases you get the same answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The separable case is much faster because you get to reuse some of the work you did in the x-dimension when you are doing the y-direction. In other words, each average of three values you computed in the x-direction will be used multiple times when filtering in the y-direction. The filters that can be made separable are precisely those whose matrix rank is one. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-04-25T19:21:22.077" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15853" PostTypeId="1" AcceptedAnswerId="15854" CreationDate="2014-04-25T19:22:59.990" Score="2" ViewCount="3198" Body="&lt;p&gt;For fun, I computed the FFT of a pure sine wave. I chose chose the sample length to be an even multiple of the signal period, so that I don't see &lt;a href=&quot;https://dsp.stackexchange.com/questions/14824/fft-plot-in-matlab-accuracy&quot;&gt;windowing-effects&lt;/a&gt;. Here is the Matlab code that I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Signal properties&#xA;f_signal = 1000;&#xA;&#xA;% Sampling properties&#xA;f_sample = 4000;&#xA;T_total = 100;&#xA;&#xA;% Calculate signal vector&#xA;t = 0:1/f_sample:T_total;&#xA;N = length(t);&#xA;V = sin(2*pi*f_signal*t);&#xA;&#xA;% Calculate FFT&#xA;f_spectrum = (0:N-1)/N*f_sample;&#xA;V_spectrum = abs(fft(V))/(N/2);&#xA;&#xA;% Plot&#xA;figure(2)&#xA;semilogy(f_spectrum, V_spectrum)&#xA;set(gca, 'XLim', [f_signal-5, f_signal+5])&#xA;xlabel('Frequency in Hz')&#xA;ylabel('Normalized amplitude')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But instead of a single peak, I get the following result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zx4AH.png&quot; alt=&quot;Broadened FFT peak.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This strikes me as odd for two reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The effect is really huge. The center peak has an amplitude of 0.9 instead of 1, and the next bin to the right has an amplitude of 0.3 instead of 0.&lt;/li&gt;&#xA;&lt;li&gt;While I would expect that limited numerical precision broadens my peak a bit, I am quite surprised that the effect is so silky smooth. I always thought of rounding errors as &quot;noise&quot; of the least significant digit. Noise usually leads to jarry spectra. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I observed that if I choose a slightly lower frequency (999.9975) then the effect is minimal. What is going on here? &lt;/p&gt;&#xA;" OwnerUserId="8692" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-04-25T19:22:59.990" Title="FFT of a pure sine wave is not a single peak" Tags="|matlab|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15854" PostTypeId="2" ParentId="15853" CreationDate="2014-04-25T19:22:59.990" Score="2" Body="&lt;p&gt;Just as I wanted to click the &quot;ask&quot; button, I realized that I had run into a &lt;a href=&quot;http://en.wikipedia.org/wiki/Off-by-one_error#Fencepost_error&quot; rel=&quot;nofollow noreferrer&quot;&gt;fencepost&lt;/a&gt; problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My time vector is too long by 1 point. This means that the first and last point of my voltage vector are the same, which in turn means that my periodic signal has a phase shift as it repeats. This also explains why the phenomenon went (almost) away as I decreased the frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I instead define my time vector properly as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:1/f_sample:T_total-1/f_sample;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I get the result that I expect: A single peak and a tiny bit of noise around it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DrvdQ.png&quot; alt=&quot;Noise fixed&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8692" LastActivityDate="2014-04-25T19:22:59.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15855" PostTypeId="2" ParentId="2818" CreationDate="2014-04-25T21:15:20.110" Score="1" Body="&lt;p&gt;Juancho answers the question, but I feel I should point out on further discussion that &lt;em&gt;in general&lt;/em&gt; the input to the DFT/FFT is not strictly real, and therefore, the negative- or greater than Nyquist- frequencies contain information other than a conjugate of the Fs/2 data.&lt;/p&gt;&#xA;" OwnerUserId="8694" LastActivityDate="2014-04-25T21:15:20.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15856" PostTypeId="1" CreationDate="2014-04-26T03:32:01.330" Score="0" ViewCount="1332" Body="&lt;p&gt;Morse code dots and dashes are often displayed as a sound, or light that is on for a short or long period of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if the only way to communicate was by knocking.... (or similar encoding) that can only encode using extended (or short) durations of silence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it acceptable to use morse code in this way (where short or long durations of silence are the dots and dashes)? &lt;/p&gt;&#xA;" OwnerUserId="8695" LastActivityDate="2015-07-27T22:16:15.503" Title="Can Morse Code be encoded using &quot;silence&quot; for dots and dashes?" Tags="|signal-detection|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15857" PostTypeId="2" ParentId="15856" CreationDate="2014-04-26T04:05:25.940" Score="-1" Body="&lt;p&gt;Of course you can. You can do anything you want to the signal as long as there was a way to transform it back.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-04-26T04:05:25.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15858" PostTypeId="2" ParentId="15856" CreationDate="2014-04-26T04:40:57.263" Score="2" Body="&lt;p&gt;i used to be a ham radio person (like more than 40 years ago) and still know Morse code.  it's like learning to ride a bicycle; you don't forget.  between the elements (&lt;em&gt;&quot;dits&quot;&lt;/em&gt; and &lt;em&gt;&quot;dahs&quot;&lt;/em&gt;) of a single character, the space of silence is supposed to be the same as the &lt;strong&gt;ON&lt;/strong&gt; time of a single &lt;em&gt;&quot;dit&quot;&lt;/em&gt;.  call that a single unit of time.  so a string of &lt;em&gt;dits&lt;/em&gt; would be at exactly twice the frequency as a stream of &lt;em&gt;dahs&lt;/em&gt;.  but the space of silence between characters is supposed to be three units, the same length as a &lt;em&gt;dah&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, if you encode only the &lt;strong&gt;onsets&lt;/strong&gt; of each element, whether it's a &lt;em&gt;did&lt;/em&gt; or &lt;em&gt;dah&lt;/em&gt;, you can't tell the difference between a lot of &lt;em&gt;dahs&lt;/em&gt; in a row in the same character (like zero or &quot;0&quot;) or the same number of &lt;em&gt;dits&lt;/em&gt; in separate letters (like five adjacent &quot;E&quot; in sequence).  from just the onsets of the beeps, a single &quot;0&quot; (which is &quot;&lt;em&gt;dah-da-dah-dah-dah&lt;/em&gt;&quot;) sounds the same as &quot;EEEEE&quot; (which is &quot;&lt;em&gt;dit-dit-dit-dit-dit&lt;/em&gt;&quot; at the same rate).  nor could you hear the difference from &quot;EENE&quot; (&quot;&lt;em&gt;dit-dit-dah-dit-dit&lt;/em&gt;&quot; at the same relative onset times).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you make the space between letters long enough that there can be no confusion between separated characters and the closer elements within a character, you can figure it out from just knocking.  but, given the element and character spacing set forth by the format of Morse Code, you cannot tell &quot;0&quot; from &quot;EEEEE&quot; from &quot;EENE&quot; with just knocks.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-04-26T04:53:29.753" LastActivityDate="2014-04-26T04:53:29.753" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15859" PostTypeId="1" CreationDate="2014-04-26T05:12:04.003" Score="1" ViewCount="62" Body="&lt;p&gt;I have one problem that need you help. I am try to find the relationship between active contour and thickness information. For defination of thickness we can find at &lt;a href=&quot;https://stackoverflow.com/questions/3735748/measuring-the-average-thickness-of-traces-in-an-image&quot;&gt;thickness measuring&lt;/a&gt; and active contour at &lt;a href=&quot;http://cdanup.com/10.1.1.2.1828.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;chan-vese model&lt;/a&gt;. Could you sugess me method or idea to find the thickness of active contour (is called phi) as show in figure &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jQfq6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-04-28T16:08:18.593" Title="The relationship between zero level set and thickness information" Tags="|algorithms|image-processing|image-segmentation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15860" PostTypeId="2" ParentId="15856" CreationDate="2014-04-26T05:39:55.620" Score="1" Body="&lt;p&gt;If you encode only onsets in Morse Code, you can't tell an ending dot from an ending dash at the end any letter, word or phrase followed by a pause.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do, instead of Morse Code, is to use some sort of MFM or RLL (run-length limited) encoding with a starting sync header, similar to encoding represented by the magnetic transitions on an HDD.  Those time encodings have a controlled number of &quot;gaps&quot; which are a deterministic part of the encoding.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-04-26T18:18:33.763" LastActivityDate="2014-04-26T18:18:33.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15861" PostTypeId="2" ParentId="15789" CreationDate="2014-04-26T08:14:28.373" Score="1" Body="&lt;p&gt;Thanks all for answer and interest but as I didn't found the answer completely following my question , I update my own solution which I get from &lt;a href=&quot;https://stackoverflow.com/questions/23220686/trying-to-translate-formula-for-blending-mode/23222729?noredirect=1#23222729&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the author of the link you provided assumed that a pixel color as a value between 0 and 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine you want to blend 2 images img1 and img2. The formula says that if a pixel in img1 as a value &lt;code&gt;Target &amp;gt; 0.5&lt;/code&gt; then the resulting value is &lt;code&gt;(1 - (1-2*(Target-0.5)) * (1-Blend))&lt;/code&gt; for the blended image where Blend is the value of the pixel of img2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if &lt;code&gt;Target &amp;lt;= 0.5&lt;/code&gt; the resulting color value will be &lt;code&gt;((2*Target) * Blend)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to do this for each pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This link  provides an overlay blending function with OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example with a grayscale image. For a RGB image, you need to do this for each channel. Of course &lt;code&gt;img1&lt;/code&gt; and &lt;code&gt;img2&lt;/code&gt; must have the same size. Maybe there is a quicker way to do it with OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mat img1;&#xA;Mat img2;&#xA;img1 = imread(&quot;img1.jpg&quot;, CV_LOAD_IMAGE_GRAYSCALE);&#xA;img2 = imread(&quot;img2.jpg&quot;, CV_LOAD_IMAGE_GRAYSCALE);&#xA;Mat result(img1.size(), CV_32F);&#xA;&#xA;for(int i = 0; i &amp;lt; img1.size().height; ++i){&#xA;    for(int j = 0; j &amp;lt; img1.size().width; ++j){&#xA;        float target = float(img1.at&amp;lt;uchar&amp;gt;(i, j)) / 255;&#xA;        float blend = float(img2.at&amp;lt;uchar&amp;gt;(i, j)) / 255;&#xA;        if(target &amp;gt; 0.5){&#xA;            result.at&amp;lt;float&amp;gt;(i, j) = (1 - (1-2*(target-0.5)) * (1-blend));&#xA;        }&#xA;        else{&#xA;            result.at&amp;lt;float&amp;gt;(i, j) = ((2*target) * blend);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-04-26T08:14:28.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15862" PostTypeId="1" CreationDate="2014-04-26T15:21:09.680" Score="1" ViewCount="433" Body="&lt;p&gt;I mean some kind of system may dislike some special frequencies and there may be absorption lines.&lt;br/&gt;&#xA;Can somebody give some example? &lt;br/&gt;&#xA;You can lots of emission lines below. But is it possible the PSD is just a continuum with several absorption lines? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C5NGP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5690" LastEditorUserId="5690" LastEditDate="2014-04-27T03:52:45.797" LastActivityDate="2014-04-27T03:52:45.797" Title="it it possible that absorption appears in the power spectrum of a non man-made system?" Tags="|frequency-spectrum|" AnswerCount="0" CommentCount="6" ClosedDate="2014-05-13T12:35:46.247" ContentLicense="CC BY-SA 3.0" />
  <row Id="15863" PostTypeId="1" CreationDate="2014-04-26T15:35:42.403" Score="1" ViewCount="704" Body="&lt;p&gt;I am trying to match images from a large dataset which exactly match the given input image.(images with deformations/transformations are treated as different)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried euclidean distance but it isn't very scalable. I have also tried matching gradient magnitude and orientation pixel by pixel, but again it seems to work in approximate manner and is slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe, pixel by pixel matching wouldn't be apt for matching from such large dataset. Moreover, even if certain approximation is allowed, can the threshold be decided dynamically rather than prefixed ?&lt;/p&gt;&#xA;" OwnerUserId="1115" LastActivityDate="2014-04-26T17:17:24.130" Title="Feature for exact matching of images" Tags="|image-processing|computer-vision|local-features|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15864" PostTypeId="2" ParentId="15057" CreationDate="2014-04-26T15:37:34.943" Score="0" Body="&lt;p&gt;I think you are interested in the difference between the discrete wavelet transform and the continuous wavelet transform. Try looking up those topics.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-04-26T15:37:34.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15866" PostTypeId="2" ParentId="15863" CreationDate="2014-04-26T17:17:24.130" Score="2" Body="&lt;p&gt;Make use of perceptual hashes. It is very fast to compute and is very lightweight, both in terms of memory and cpu consumption. They are represented by simple long integers and can be indexed using many types of data structures such as VP Trees:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.phash.org/&quot; rel=&quot;nofollow&quot;&gt;http://www.phash.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work, you can extract SURF features, quantize them into visual words using a vocabulary tree or BOW and index these with a database structure such as inverted file index. Check out OpenCV. It has many of the tools I mentioned here.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-04-26T17:17:24.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15867" PostTypeId="2" ParentId="15843" CreationDate="2014-04-26T18:00:50.450" Score="0" Body="&lt;p&gt;As @Aaron said your peak definition is not very clear, but if you want to find the time position of the highest amplitudes that satisfies certain threshold condition, then I think a useful tool to extract that information is the STFT and specially if you are dealing with noise the Gabor Transform.&lt;/p&gt;&#xA;" OwnerUserId="8702" LastActivityDate="2014-04-26T18:00:50.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15868" PostTypeId="2" ParentId="427" CreationDate="2014-04-26T18:17:15.367" Score="8" Body="&lt;p&gt;You can visit the &lt;a href=&quot;https://www.youtube.com/playlist?list=PL8157CA8884571BA2&quot; rel=&quot;noreferrer&quot;&gt;MIT OpenCourseWare&lt;/a&gt;. A set of 20 video lectures by professor Alan V. Oppenheim. &lt;/p&gt;&#xA;" OwnerUserId="8702" LastActivityDate="2014-04-26T18:17:15.367" CommentCount="0" CommunityOwnedDate="2014-04-26T18:17:15.367" ContentLicense="CC BY-SA 3.0" />
  <row Id="15869" PostTypeId="1" AcceptedAnswerId="15871" CreationDate="2014-04-26T18:40:51.267" Score="3" ViewCount="363" Body="&lt;p&gt;I'm trying to work my way through a paper I found online, titled &quot;&lt;em&gt;Three Models of Wind-Gust Disturbances for the Analysis of Antenna Pointing Accuracy&lt;/em&gt;&quot; by W. Gawronski, 2002. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ipnpr.jpl.nasa.gov/progress_report/42-149/149A.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ipnpr.jpl.nasa.gov/progress_report/42-149/149A.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Appendix of the paper, Section I, the author outlines an approach to generate a time series. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(1) Apply white noise to the ﬁlter, H, with the following transfer&#xA;  function: $$H_d = \dfrac{0.1584 \cdot z^3 −0.3765 \cdot z^2 + 0.2716 \cdot z −0.0534}{ z^4 −2.9951 \cdot z^3 +3.0893 \cdot z^2 −1.1930 \cdot z + 0.0988}$$ and obtain time series of wind $\Delta v(t)$. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do you apply white noise to a filter? How do you use the transfer function to create a time series? &lt;/p&gt;&#xA;" OwnerUserId="8704" LastEditorUserId="8202" LastEditDate="2014-05-21T07:02:10.723" LastActivityDate="2014-05-21T07:02:10.723" Title="Generating a time series given a transfer function" Tags="|filters|discrete-signals|noise|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15870" PostTypeId="2" ParentId="13596" CreationDate="2014-04-26T18:42:42.450" Score="1" Body="&lt;p&gt;Here it's a set of lectures taught by professor Emmanuel Candés at Cambridge. &lt;a href=&quot;http://www.sms.cam.ac.uk/collection/1117766/&quot; rel=&quot;nofollow&quot;&gt;Video &amp;amp; Audio&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8702" LastActivityDate="2014-04-26T18:42:42.450" CommentCount="0" CommunityOwnedDate="2014-04-27T02:07:28.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="15871" PostTypeId="2" ParentId="15869" CreationDate="2014-04-26T19:33:12.343" Score="3" Body="&lt;p&gt;I think that procedure should be as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.Generate the white (Gaussian) noise  signal - &lt;code&gt;randn&lt;/code&gt; function in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.Having a transfer function of your filter divide it by $z^4$ (highest power in denominator) to get a proper representation for IIR filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_d(z)=\dfrac{0.1584\cdot z^{-1} −0.3765\cdot z^{-2} + 0.2716\cdot z^{-3} −0.0534\cdot z^{-4}}{1 −2.9951\cdot z^{-1} + 3.0893\cdot z^{-2} −1.1930\cdot z^{-3} + 0.0988\cdot z^{-4}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.Now you can extract the coefficients according to equations that can be found here: &lt;a href=&quot;http://en.wikipedia.org/wiki/Infinite_impulse_response&quot; rel=&quot;nofollow noreferrer&quot;&gt;IIR&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = \dfrac{\sum_{i=0}^{P}b_i z^{-1}}{1+\sum_{j=1}^{Q}a_j z^{-j}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will give you following vectors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a=[1 -2.9951 3.0893 -1.1930 0.0988] % denominator&#xA;b=[0 0.1584 -0.3765 0.2716 -0.0534] % numerator&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;4.These are coefficients of your filter that you can apply to the white noise signal. If you are using MATLAB/Octave, then use the &lt;code&gt;filter&lt;/code&gt; function. Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=filter(b,a,x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;x&lt;/code&gt; is your white noise signal generated previously. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude response of your filter is shown below - because you are going to apply it to white noise (having all frequencies equally probable), then spectrum of your filtered signal should be corresponding to amplitude response of your filter. There is a high gain in lower frequencies which makes somewhat sense (wind gusts are mostly energetic in lower range):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SIPGl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Judging from your article, now you only have to normalise the filtered white noise and scale it accordingly.&#xA;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-04-26T20:17:21.213" LastActivityDate="2014-04-26T20:17:21.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15872" PostTypeId="2" ParentId="13596" CreationDate="2014-04-26T20:30:09.040" Score="1" Body="&lt;p&gt;Apart from &lt;em&gt;Coursera&lt;/em&gt; mentioned previously, I could also suggest &lt;strong&gt;edX&lt;/strong&gt;: &lt;a href=&quot;https://www.edx.org/course/ricex/ricex-elec301x-discrete-time-signals-1032&quot; rel=&quot;nofollow&quot;&gt;ELEC301x Discrete Time Signals and Systems&lt;/a&gt; from Rice University. Fairly good introduction to DSP.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-04-26T20:30:09.040" CommentCount="0" CommunityOwnedDate="2014-04-27T02:07:28.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="15873" PostTypeId="1" CreationDate="2014-04-26T21:44:45.190" Score="0" ViewCount="382" Body="&lt;p&gt;HI I have these specification for an OFDM program I was wondering, what is the bandwidth and the sampling frequency? I'm not a student of Digital signal processing, hence I am so confused.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ymax=100;&#xA;nIFFT = 2048;&#xA;nCyclic = nIFFT/4;&#xA;pilot_distance = 16;&#xA;pilot_amplitude = 2;&#xA;offset = nIFFT*3;&#xA;% total number of complex samples in the timedomain&#xA;nTotal = (nIFFT+nCyclic)*ymax+offset;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8572" LastEditorUserId="6" LastEditDate="2014-04-26T22:05:50.907" LastActivityDate="2014-04-27T02:04:16.220" Title="How to calculate BW ofdm?" Tags="|sampling|ofdm|bandwidth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15874" PostTypeId="2" ParentId="15873" CreationDate="2014-04-26T22:10:51.020" Score="2" Body="&lt;p&gt;I don't think it's possible to deduce the sampling rate from this information. The sampling rate could be anything, since FFT is sampling rate agnostic. Sampling rate is pretty much independent of all other parameters which scale directly with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the bandwidth, it's not clear either. You're specifying pilot distance, but we don't know what the units are and we never see how those variables get used. Is there more to the code you're studying?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Looked at your full code, and the sampling rate is 8 kHz, since that's what frequency is used in the &lt;code&gt;wavwrite&lt;/code&gt; command. Will have to get back to bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2014-04-27T02:04:16.220" LastActivityDate="2014-04-27T02:04:16.220" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15876" PostTypeId="2" ParentId="3063" CreationDate="2014-04-27T02:15:25.967" Score="-1" Body="&lt;p&gt;First you have to change the image to binary image by using threshold, otsu method.&#xA;You can seperate the cells( overlapped cells) by using mathematical morphology such as erosion, opening.&#xA;Estimate the area.&lt;/p&gt;&#xA;" OwnerUserId="8708" LastActivityDate="2014-04-27T02:15:25.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15877" PostTypeId="1" CreationDate="2014-04-27T02:35:36.720" Score="1" ViewCount="192" Body="&lt;p&gt;I am experimenting with image down-sampling and would like to calculate a &lt;em&gt;numerical magnitude&lt;/em&gt; for alias-induced moiré patterns.  Is it possible to do this by analyzing the frequency-domain (FFT) of the input image and knowing the relative sampling rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that I have already applied any pre-sample filtering prior to taking the FFT, so the sampling will be point-based.&lt;/p&gt;&#xA;" OwnerUserId="1138" LastActivityDate="2014-04-27T02:35:36.720" Title="Can the Fast Fourier transform be used to compute the magnitude of moiré" Tags="|image-processing|fft|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15878" PostTypeId="1" AcceptedAnswerId="15879" CreationDate="2014-04-27T04:54:34.863" Score="1" ViewCount="916" Body="&lt;p&gt;I wrote matlab code for face detection.In my code it is detecting face for first 100 frames and it crop faces from each frame and saves it in database folder.Problems iam facing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.Detecting face frame by frame is very slow.Is there any idea to run faster since i have to work on 4000 frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.In my database folder it has to show 1 to 100 face images but it is not showing 11th and 12th face images directly it showing 13th face image after 10th image.23rd face image is blurr.Likewise so many images are missing and some are blurr.Last image number it is showing as 216.But total 106 face images are there in database folder.In that 12 images are blurr.Remaining are correct images.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;  clear all;&#xA;&#xA;  obj=vision.VideoFileReader('basu.avi');&#xA;&#xA;  for k=0:99&#xA;&#xA;  videoFrame      = step(obj);&#xA;  %using viola-jones algorithm&#xA;  FaceDetect = vision.CascadeObjectDetector;&#xA;&#xA; %FaceDetect&#xA;  BB = step(FaceDetect,videoFrame);&#xA;  %BB&#xA;   figure(2),imshow(videoFrame);&#xA;&#xA;  for i = 1:size(BB,1)&#xA;  rectangle('Position',BB(i,:),'LineWidth',3,'LineStyle','-','EdgeColor','r');&#xA;  end&#xA;&#xA;  %crop faces and convert it to gray&#xA;  for i = 1:size(BB,1)&#xA;  J= imcrop(videoFrame,BB(i,:));&#xA;  I=rgb2gray(imresize(J,[292,376]));&#xA;&#xA;  %save cropped faces in database folder&#xA;  filename = ['G:\matlab_installed\bin\database\' num2str(i+k*(size(BB,1))) '.jpg'];&#xA;  imwrite(I,filename);&#xA;  end&#xA;  end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8709" LastEditorUserId="53" LastEditDate="2014-05-29T13:44:51.380" LastActivityDate="2014-05-29T13:44:51.380" Title="Techniques to reduce delay in detecting face from video using vision.CascadeObjectDetector in matlab" Tags="|image-processing|matlab|computer-vision|face-detection|matlab-cvst|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15879" PostTypeId="2" ParentId="15878" CreationDate="2014-04-27T09:14:05.813" Score="0" Body="&lt;p&gt;Set the MinSize parameter to be as big as possible. The algorithm spends most of the time looking for small faces. If you are not interested in those then it can be made much faster.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-04-27T09:14:05.813" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15882" PostTypeId="2" ParentId="1227" CreationDate="2014-04-27T13:24:48.993" Score="0" Body="&lt;p&gt;Using an l1 trend filter is another idea:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.stanford.edu/~boyd/papers/l1_trend_filter.html&quot; rel=&quot;nofollow&quot;&gt;Paper&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://avibryant.github.io/l1tf/&quot; rel=&quot;nofollow&quot;&gt;Online Example&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8710" LastActivityDate="2014-04-27T13:24:48.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15883" PostTypeId="2" ParentId="15856" CreationDate="2014-04-27T13:44:30.783" Score="1" Body="&lt;p&gt;You could do a lossless transformation of Morse Code to Knock-Knock:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dit   &amp;lt;--&amp;gt;  knock,pause,pause&#xA;dah   &amp;lt;--&amp;gt;  knock,knock,pause&#xA;space &amp;lt;--&amp;gt;  pause,pause,pause&#xA;&#xA;e.g., SOS -- knock,pause,pause, knock,pause,pause, knock,pause,pause,&#xA;             pause,pause,pause,&#xA;             knock,knock,pause, knock,knock,pause, knock,knock,pause,  &#xA;             pause,pause,pause,&#xA;             knock,pause,pause, knock,pause,pause, knock(,pause,pause),&#xA;             stop.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not very efficient (12 knocks to transmit SOS) but better than&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a &amp;lt;--&amp;gt; knock, pause&#xA;z &amp;lt;--&amp;gt; 26 knocks, pause&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which takes 19+15+19=53 knocks to transmit SOS.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2015-07-27T22:16:15.503" LastActivityDate="2015-07-27T22:16:15.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15884" PostTypeId="1" CreationDate="2014-04-27T14:16:43.153" Score="1" ViewCount="395" Body="&lt;p&gt;I have been working frequency offset estimation in OFDM. The objective was to compare different frequency offset estimation techniques. By using MATLAB, I have simulated three different estimation techniques, namely: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;By using Pilot tones&lt;/li&gt;&#xA;&lt;li&gt;Using phase difference between two repetitive symbols (proposed by Moose)&lt;/li&gt;&#xA;&lt;li&gt;and by using a blind method (Cyclic Prefix)&#xA;The comparison between these methods is done by simulating the &lt;code&gt;mean square error (MSE)&lt;/code&gt;, and below is the output figure &#xA;&lt;img src=&quot;https://i.stack.imgur.com/yg3wY.jpg&quot; alt=&quot;comparison between estimation techniques&quot;&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, my supervisor highly recommended to do the comparison between the CFO estimation methods using another parameter rather than the &lt;code&gt;MSE&lt;/code&gt;(without suggesting another way). Therefore, I would like to request from the respected members to suggest me alternatives that I can do the comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that I'm not violating the rules of this forum by asking this general question.&lt;/p&gt;&#xA;" OwnerUserId="8416" LastActivityDate="2017-10-31T14:53:18.007" Title="comparison between frequency offset estimators" Tags="|digital-communications|estimation|statistics|ofdm|reference-request|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15885" PostTypeId="2" ParentId="15884" CreationDate="2014-04-27T14:56:56.250" Score="1" Body="&lt;p&gt;Well, since you simulate you could calculate the residual frequency offset which is basically the remaining CFO after correction or the difference between the true CFO and the estimated CFO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing that is often done is to give the resulting Bit Error Rate with different estimators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But really, please ask your supervisor what he has in mind. Everything else is guessing and probably wasted time.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-04-27T14:56:56.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15886" PostTypeId="2" ParentId="15884" CreationDate="2014-04-27T15:00:59.423" Score="0" Body="&lt;p&gt;The mean square error is helpful for evaluating the precision of the estimation method and it is important to do this analysis. But in a communcation system the most important parameter is the bit error rate (BER) for a given signal-to-noise ration (SNR). While your figure tells you what CFO estimation method has the highest precision it does not tell you what precision is required in your communications system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer this question you have to do end-to-end simulations where the transmitted and received bit sequences are compared and the number of bit errors is counted. In this way you can study how the remaining frequency offset affects the system performance. Of course, the expected outcome is, that the method with the highest precision performs best, i. e. results in the lowest BER. But it might turn out that the difference in precision doesn't translate into such a great difference in BER.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionaly you might want to study the impact of different parameters on the MSE. This could be delay spread and frequency offset, for example. Depending on the channel that is used, robustness against channel dispersion can be of great importance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another interesting parameter could be the mean of the estimation error. It tells you whether the estimator is biased or not.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-04-28T15:12:20.413" LastActivityDate="2014-04-28T15:12:20.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15888" PostTypeId="1" CreationDate="2014-04-28T11:06:12.423" Score="1" ViewCount="139" Body="&lt;p&gt;Looking for a solution to the following problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A signal $x(t)$ is band limited to $B$ Hz, and sampled above the&#xA;  Nyquist rate, with corresponding $f_s = 1/T$. If the sampled signal is&#xA;  given by&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$ y(n) = x(nT), $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;describe how to compute the phase-shifted sampled signal&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$ z(n) = x(nT + T/2), $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;from the samples $y(n)$ without first reconstructing $x(t)$ from&#xA;  $y(n)$ and resampling.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Have not been able to find one on the web.&lt;/p&gt;&#xA;" OwnerUserId="8686" LastActivityDate="2014-04-28T15:19:30.950" Title="Computing shifted signal without first reconstructing" Tags="|sampling|nyquist|reconstruction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15889" PostTypeId="1" CreationDate="2014-04-28T11:21:20.443" Score="3" ViewCount="2529" Body="&lt;p&gt;I want to make the same thing programmatically like &lt;code&gt;Color balance&lt;/code&gt; in &lt;code&gt;Photoshop&lt;/code&gt; , like in below image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WEo7E.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if we have same bar positions in Photoshop then how we can make them in OpenCV , because the problem which I am not understanding is that we have the image with &lt;code&gt;RGB&lt;/code&gt; format yes we can convert in other color format but how I can understand these values (do we need to subtract the Cyan values in OpenCV if Cyan Level is -20 in PS ? Or we need to Add ?) and did the same operation in OpenCV ,&#xA;For example if I need to change values in &lt;code&gt;Cyan&lt;/code&gt; , &lt;code&gt;Magenta&lt;/code&gt; and &lt;code&gt;Blue&lt;/code&gt; Do I need to convert image first to add values in Cyan and magenta and then convert it back to &lt;code&gt;BGR&lt;/code&gt; and then increase &lt;code&gt;blue&lt;/code&gt; ?&#xA;And is there any built in function in OpenCv for &lt;code&gt;Shadows , MidTones and Highlight&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mat img = imread(&quot;E:\\raw_3.jpg&quot;);&#xA;vector&amp;lt;Mat&amp;gt; colors;&#xA;split(img,colors);&#xA;colors[0] += 69;&#xA;colors[1] += 40 ;&#xA;colors[2] -= 23 ;&#xA;merge(colors,img);&#xA;imshow(&quot;image&quot; , img);&#xA;imwrite(&quot;E:\\color_balance.jpg&quot;,img);&#xA;waitKey();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for Cyan - red = -23 Magenta - Green = 40 Yellow - Blue = 69 But i am not getting the accurate result as it should be&lt;/p&gt;&#xA;" OwnerUserId="5057" LastActivityDate="2017-07-03T13:07:48.690" Title="How to make color balance of photoshop using opencv" Tags="|computer-vision|image-processing|opencv|color|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15890" PostTypeId="2" ParentId="15770" CreationDate="2014-04-28T11:39:01.923" Score="0" Body="&lt;p&gt;To track a human you have many options. If you could place a Kinect camera for example and track the skeleton of the person, you could obtain much more statistics about the behavior. This way, you could also get rid of the burden of segmenting the person. OpenCV already has Kinect integration.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-04-28T11:39:01.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15891" PostTypeId="2" ParentId="15888" CreationDate="2014-04-28T11:42:07.627" Score="2" Body="&lt;p&gt;Because the sampling frequency is above the Nyquist rate, the original signal can be written in terms of its samples $y(n)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{m=-\infty}^{\infty}y(m)\frac{\sin[\pi(t-mT)/T]}{\pi(t-mT)/T}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By setting $t=nT+T/2$ you get from (1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z(n)=\sum_{m=-\infty}^{\infty}y(m)\frac{\sin[\pi(n-m)+\pi/2]}{\pi(n-m)+\pi/2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin[\pi(n-m)+\pi/2]=(-1)^{n-m}$$ you finally get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z(n)=\sum_{m=-\infty}^{\infty}y(m)\frac{(-1)^{(n-m)}}{\pi(n-m)+\pi/2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for computing $z(n)$ you do not need to reconstruct $x(t)$ but you need to compute a sum over all values $y(m)$. In practice a few samples $y(m)$ around the value $n$ will be sufficient because the weighting factors in the sum decrease with increasing distance $|n-m|$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-28T11:42:07.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15892" PostTypeId="2" ParentId="14658" CreationDate="2014-04-28T12:31:00.227" Score="2" Body="&lt;p&gt;This paper - &lt;a href=&quot;https://www.scribd.com/document/406513369/The-Structure-of-Images&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Structure of Images&lt;/a&gt; describes quite nicely to get to the diffusion equations from the point of view of a filter. It's about the isotropic case, but anisotropic is really just an extension of that. For anisotropic diffusion see &lt;a href=&quot;https://www.scribd.com/document/406513370/Scale-Space-and-Edge-Detection-Using-Anisotropic-Diffusion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scale Space and Edge Detection Using Anisotropic Diffusion&lt;/a&gt; as Deniz suggests this one is quite good as it also includes discretised versions of the equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to solve the &lt;a href=&quot;http://en.wikipedia.org/wiki/Heat_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;heat equation&lt;/a&gt; where &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is the scale of the image, i.e. the amount of filtering to apply. For anisotropic diffusion the diffusion coefficient &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is replaced by &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; which is dependent on the image gradient and therefore filters preferentially depending on the gradient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The divergence here really just arises from the definition of the heat equation.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastEditorUserId="128" LastEditDate="2019-04-16T20:25:42.737" LastActivityDate="2019-04-16T20:25:42.737" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15893" PostTypeId="1" CreationDate="2014-04-28T14:09:11.513" Score="1" ViewCount="3046" Body="&lt;p&gt;I study image processing and I am new to it. so my question is for example what is the impulse response for:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$$ y(m,n) = 3\times x(m,n)+9 $$ &lt;/li&gt;&#xA;&lt;li&gt;$$ y(m,n) = m^2n^2 \times x(m,n) $$&#xA;where the $y(m,n)$ is output and $x(m,n)$ is input.&lt;br/&gt;&#xA;thanks.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8718" LastActivityDate="2014-04-28T19:02:12.973" Title="What is the impulse response for 2D functions" Tags="|image-processing|impulse-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15894" PostTypeId="2" ParentId="15884" CreationDate="2014-04-28T14:40:41.797" Score="1" Body="&lt;p&gt;Other things I would want to analyze:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How does the MSE behave for varied frequency offsets?&lt;/li&gt;&#xA;&lt;li&gt;What offset ranges can each algorithm tolerate?&lt;/li&gt;&#xA;&lt;li&gt;How quickly does each implementation converge?&lt;/li&gt;&#xA;&lt;li&gt;What is the implementation complexity for each method?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd also second Deve's suggestion to compare them in different multipath channel scenarios.&lt;/p&gt;&#xA;" OwnerUserId="7509" LastActivityDate="2014-04-28T14:40:41.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15895" PostTypeId="2" ParentId="15888" CreationDate="2014-04-28T15:19:30.950" Score="2" Body="&lt;p&gt;Yet another possibility is to zero-pad the signal sample vector, FFT it, rotate the phase of each FFT result bin linearly with the bin index, and IFFT a time shifted result.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-04-28T15:19:30.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15896" PostTypeId="1" CreationDate="2014-04-28T15:31:22.490" Score="3" ViewCount="309" Body="&lt;p&gt;In &lt;a href=&quot;http://en.wikipedia.org/wiki/Steepest_descent&quot; rel=&quot;noreferrer&quot;&gt;steepest descent&lt;/a&gt;&#xA;methods of minimizing a function $f(x), x \in \mathbb{R}^d$,&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YtYEJ.png&quot; alt=&quot;zig-zag descent path from Wikipedia&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it's common to approximate the gradient by finite differences:&#xA;$\qquad\qquad \nabla f(x) \approx gradest( x; h ) \equiv&#xA;{ {f( x + h I ) \ - \ f(x)} \over h } $&lt;br&gt;&#xA;then minimize along those directions:&lt;br&gt;&#xA;$\qquad\qquad x_{k+1} \  \text{from min} \ f( x_k + \lambda \ gradest( x_k ) ) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can a signal-processing point of view suggest ways of smoothing $gradest()$ in this context ?&lt;br&gt;&#xA;For example, one could view the &quot;zig-zags&quot; in the picture above as high frequencies in $gradest()$,&#xA;to be smoothed out over the last few ${x_k}$.&#xA;But that may be naive: &#xA;can one model, then smooth, zig-zags through non-uniformaly spaced points in 5d or 10d ?&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="128" LastEditDate="2019-01-05T07:31:17.813" LastActivityDate="2020-03-23T16:05:05.037" Title="How to Smooth Gradient Estimates for Steepest Descent Optimization" Tags="|filters|smoothing|optimization|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15898" PostTypeId="1" CreationDate="2014-04-28T17:33:39.797" Score="1" ViewCount="1055" Body="&lt;p&gt;I'm looking for an introductory book to time-frequency analysis. The book should be practical in nature and not mathematics heavy. Suggestions?&lt;/p&gt;&#xA;" OwnerUserId="8722" LastActivityDate="2017-02-23T17:16:10.427" Title="Introductory book on time-frequency analysis?" Tags="|time-frequency|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15899" PostTypeId="2" ParentId="14252" CreationDate="2014-04-28T17:41:25.647" Score="3" Body="&lt;p&gt;So far I have not experimented with audio steganography, but anyway, maybe these ideas are of some use for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding echoes to a signal is pretty easy as this process just adds a delayed version of the signal back to itself. You probably want to use a gain factor $f_\text{gain}$ for the additional signal that is smaller than one, $f_\text{gain} \leq 1$, to avoid having an echo that is louder than the original sound. In DSP terms this process corresponds to FIR filtering with an impulse response that consists of a delta impulse at time zero ($\delta[n]$) and a time-shifted and weighted delta impulse:&#xA;$$&#xA;\mathbf{b} = \delta[n] + f_\text{gain}\cdot \delta[n-L_\text{delay}],&#xA;$$&#xA;with $L_\text{delay}$ the delay time in samples&#xA;and&#xA;$$&#xA;\mathbf{a} = 1&#xA;$$&#xA;because it's an FIR filter. To get multiple echoes simply use more than one delayed delta impulses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For detecting hidden echoes in the signal, maybe it's worth a try whether you can achieve satisfactory performance with an adaptive filtering algorithm. For example, the (normalized) least mean-squares ([N]LMS) algorithm comes to my mind. I'm sure you can find implementations in a number of programming languages to download from the internet. Using the signals both as input signal and desired signal to the adaptive filtering algorithm would lead to a self-cancelling behaviour. Maybe, from analyzing the filter coefficients, you can find out about whether there are echoes in the signals and, if so, what the delay times are. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you experiment with the Cepstrum method described in the web page that the link in your question points, take care to have your signal blocks long enough to capture the echoes.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2014-04-28T17:41:25.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15900" PostTypeId="2" ParentId="10354" CreationDate="2014-04-28T17:54:24.703" Score="2" Body="&lt;p&gt;If I understand correctly what you are trying to achieve is usually called &lt;em&gt;Acoustic Echo Cancellation&lt;/em&gt;. In many cases, so-called &lt;em&gt;adaptive filtering algorithms&lt;/em&gt;, such as the (normalized) least-mean-squares ([N]LMS) algorithm, can be used effectively. In this context, I can really recommend the book &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0130040290&quot; rel=&quot;nofollow&quot;&gt;Adaptive Signal Processing&lt;/a&gt; by Widrow and Stearns. I'm sure you'll find a number of ready-to-use implementations of the (N)LMS algorithm to experiment with on the internet. (Have an eye on the filter order - it needs to be high enough to capture the length of your crosstalk path.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, as you mentioned that you are already working in the frequency domain, you can have a look on algorithms that are called (you guessed it) &lt;em&gt;frequency-domain LMS&lt;/em&gt; algorithms. They originate, via so-called &lt;em&gt;block LMS&lt;/em&gt; algorithms, from the classical LMS algorithms. In this context, I really liked the paper by Shynk: &lt;a href=&quot;http://users.isy.liu.se/en/rt/fredrik/spcourse/multirate.pdf&quot; rel=&quot;nofollow&quot;&gt;Frequency-domain and multirate adaptive filtering&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2014-04-28T17:54:24.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15901" PostTypeId="2" ParentId="15893" CreationDate="2014-04-28T19:02:12.973" Score="1" Body="&lt;p&gt;As pointed out by Jason R. in his comment, you can easily apply an impulse $\delta(m,n)$ (with $\delta(m,n)=1$ for $m=n=0$, and zero otherwise) to the systems and see what the output is. However, for those two examples the response to an impulse does not say much about the general behavior of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an important class of systems called &lt;em&gt;Linear Shift Invariant&lt;/em&gt; (LSI) systems which are completely characterized by their impulse responses. Linearity means that if $y_1(m,n)$ is the response to an input $x_1(m,n)$ and $y_2(m,n)$ is the response to input $x_2(m,n)$, then the response to the input $ax_1(m,n)+bx_2(m,n)$ is given by $ay_1(m,n)+by_2(m,n)$. If you check this condition you will find out that your first system is not linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shift invariance means that if $y(m,n)$ is the response to $x(m,n)$ then $y(m-k,n-l)$ is the response to the input $x(m-k,n-l)$. Your second system does not satisfy this condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So none of the two systems is LSI and therefore neither of them can be characterized by their impulse response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-28T19:02:12.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15902" PostTypeId="1" AcceptedAnswerId="15905" CreationDate="2014-04-28T19:38:43.807" Score="1" ViewCount="2347" Body="&lt;p&gt;I want to design FIR low-pass filter with the following specifications: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Cut-off frequency: 200 Hz &#xA;&#xA;  Order: 20 &#xA;&#xA;  Sampling frequency: 1000 Hz &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;what should be the stepwise method to do so &lt;/p&gt;&#xA;" OwnerUserId="8724" LastEditorUserId="4298" LastEditDate="2020-11-01T15:37:25.750" LastActivityDate="2020-11-01T15:37:25.750" Title="Low Pass FIR Filter" Tags="|filter-design|finite-impulse-response|" AnswerCount="1" CommentCount="4" ClosedDate="2014-05-13T12:35:16.813" ContentLicense="CC BY-SA 3.0" />
  <row Id="15904" PostTypeId="2" ParentId="3063" CreationDate="2014-04-28T21:06:38.860" Score="1" Body="&lt;p&gt;Similarly to @SalemMansour's suggestion it is also an area based approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A really rough estimation can be calculated if we can assume&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;that the cell sizes (in pixels) are not differ very much in all the images,&lt;/li&gt;&#xA;&lt;li&gt;that the cell colors are not differ very much in all the images.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then you can premeasure the average size of a cell and calculate a cheap mask for the cells like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from SimpleCV import *&#xA;im = Image(&quot;s58Hl.jpg&quot;)&#xA;r,g,b = im.splitChannels()&#xA;cellmask = g.equalize().threshold(90).invert()&#xA;masksize = cellmask.getGrayNumpy().sum()/255.&#xA;cellsize = 27*27 # premeasured cell size&#xA;cellnum = masksize/cellsize&#xA;print(cellnum)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It gives me ~211 for the cell count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mask image is like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/IEWIq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this smaller image I would manually count 9 cells:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i2Vmr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution gives the result of 9.46502057613.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Of course, if any of the assumptions are invalid then this approach is useless. It is also sensitive to the hard color threshold and the cell size constant. &#xA;Because of the color equalization, it can totally fail if no cell is present in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it is really simple and cheap :)&lt;/p&gt;&#xA;" OwnerUserId="156" LastActivityDate="2014-04-28T21:06:38.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15905" PostTypeId="2" ParentId="15902" CreationDate="2014-04-28T21:21:36.313" Score="5" Body="&lt;p&gt;Your filter is highly under-specified, so I assume that your design is supposed to be very basic. A very basic method would be to simply truncate and shift the impulse response of an ideal low pass filter with cutoff frequency $\omega_c=2\pi f_c/f_s=0.4\pi$ (where $f_s$ is the sampling frequency):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_{ideal}(n)=\frac{\sin(\omega_c n)}{\pi n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that since your filter must be causal you need to shift and truncate the ideal impulse response such that it is symmetric with respect to its maximum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(n)=\frac{\sin(\omega_c (n-10))}{\pi (n-10)},\quad n=0,1,\ldots,20\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (1) gives you the 21 filter coefficients $h(n)$ of a causal FIR filter approximating an ideal low pass filter response. Note that the filter order is 20.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple Matlab/Octave code could look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = -10:10;&#xA;omc = 0.4*pi;           % normalized cut-off frequency in rad&#xA;h = sin(omc*n)./(pi*n); % impulse response&#xA;h(11) = omc/pi;         % correct NaN value at n=0&#xA;H = fft(h,1024);        % complex frequency response&#xA;f = 1000/1024*(0:512);  % FFT frequency grid up to fs/2&#xA;plot(f,abs(H(1:513)));  % plot magnitude of frequency response&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-28T21:21:36.313" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="15906" PostTypeId="2" ParentId="15898" CreationDate="2014-04-28T22:22:11.367" Score="1" Body="&lt;p&gt;To be frank, time-frequency analysis is mathematical in nature. So there will always be some mathematics involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read a few DSP books over the years, none of them comes even close to the clarity of explanation in the following book, which is available for free online:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;The Scientist and Engineer's Guide to Digital Signal Processing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would though, have to take it step at a time (I guess you can stop reading at chapter 8). These concepts don't really have a 'quick fix' type of explanations.&lt;/p&gt;&#xA;" OwnerUserId="4576" LastActivityDate="2014-04-28T22:22:11.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15908" PostTypeId="1" AcceptedAnswerId="51472" CreationDate="2014-04-29T01:56:54.110" Score="5" ViewCount="112" Body="&lt;p&gt;I'm preparing a digital signal/image processing introductory course and, besides the theory and practices I want the students to read and discuss a couple of research papers during the last one or two classes. It doesn't matter if the papers are new I just want to expose the students some first hand research material in its original format. Which papers could you recommend me? Thanks&lt;/p&gt;&#xA;" OwnerUserId="205" LastEditorUserId="128" LastEditDate="2018-08-23T11:12:01.127" LastActivityDate="2018-08-23T11:17:27.750" Title="Papers for Teaching an Introductory Course in Image &amp; Signal Processing" Tags="|image-processing|filters|digital|self-study|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15909" PostTypeId="1" AcceptedAnswerId="15922" CreationDate="2014-04-29T04:46:04.660" Score="2" ViewCount="6196" Body="&lt;p&gt;From this &lt;a href=&quot;https://dsp.stackexchange.com/questions/8418/what-is-the-phase-and-magnitude-response-of-white-noise&quot;&gt;previous post&lt;/a&gt;, the real and imaginary parts of the Fourier transform of a zero mean Gaussian are uncorrelated (and i.i.d. Gaussians)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This some how seems counter-intuitive. It seems if the real part has a large intensity, then the imaginary part should be small. I read through the &lt;a href=&quot;http://users.ece.gatech.edu/mrichard/DFT%20of%20Noise.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;proof&lt;/a&gt; linked from the previous post, but I don't have a good intuitive feel from this proof. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you provide an intuitive explanation of why this is true?&lt;/p&gt;&#xA;" OwnerUserId="8728" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-04-30T13:38:55.540" Title="Correlation between real and imaginary parts of a Fourier transform of zero mean Gaussian" Tags="|fourier-transform|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15911" PostTypeId="1" AcceptedAnswerId="15923" CreationDate="2014-04-29T06:26:00.387" Score="1" ViewCount="555" Body="&lt;p&gt;I am trying to isolate (or segment to be precise) the vein pattern from Infra red image of a finger (using MATLAB) like shown below:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7XM2e.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my output will be a binary image like (not the exact dimension of image shown):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T16Ra.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried histogram equalization to make the veins more visible, but it was not that successful. Any help to proceed further would be very helpful.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="5253" LastEditDate="2014-04-29T09:56:52.193" LastActivityDate="2014-04-30T10:06:33.387" Title="How to extract the vein pattern from an IR image of finger?" Tags="|image-processing|computer-vision|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15912" PostTypeId="1" AcceptedAnswerId="15913" CreationDate="2014-04-29T06:52:54.560" Score="1" ViewCount="916" Body="&lt;p&gt;I am having great time while reading &quot;The Scientist and Engineer's Guide to Digital Signal Processing&quot; book. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &quot;Chapter-14 Introduction to Filters&quot; author indicates we can create high pass filter from low pass filters by multiplying low pass filter's frequency kernel with a sinusodial which has 0.5 frequency. &lt;a href=&quot;http://www.dspguide.com/ch14/5.htm&quot; rel=&quot;nofollow&quot;&gt;Link to the this chapter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I read every chapter carefully but I can't understand why this will work? &#xA;Can somebody please explain the reasoning behind of this process as easy that a computer science graduate could understand. &lt;/p&gt;&#xA;" OwnerUserId="5392" LastActivityDate="2014-04-29T07:36:55.583" Title="Why multiplying frequency kernel with sinusoid results shifting frequency domain" Tags="|filters|filter-design|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15913" PostTypeId="2" ParentId="15912" CreationDate="2014-04-29T07:36:55.583" Score="4" Body="&lt;p&gt;This can be explained by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution_theorem&quot; rel=&quot;nofollow&quot;&gt;Convolution theorem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you state, in the time domain you have the kernel (f) multiplied by a sinusoid (g).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take the Fourier transform of f·g (i.e., F(f·g)), this is equivalent to the convolution between F(f) and F(g) (i.e., F(f)*F(g)). Note that the &lt;a href=&quot;http://mathworld.wolfram.com/FourierTransformSine.html&quot; rel=&quot;nofollow&quot;&gt;Fourier transform of the sinusoid&lt;/a&gt; is proportional to two delta functions located at the frequency and negative frequency of the sine wave. So when you convolve these deltas with the frequency kernel your frequency kernel &quot;shifts&quot; to be centered around the sinusoid  frequency.&lt;/p&gt;&#xA;" OwnerUserId="8728" LastActivityDate="2014-04-29T07:36:55.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15914" PostTypeId="2" ParentId="15911" CreationDate="2014-04-29T09:34:30.100" Score="1" Body="&lt;p&gt;I tried using enhance contrast and histogram equalization on your image using &lt;a href=&quot;http://fiji.sc/Fiji&quot; rel=&quot;nofollow noreferrer&quot;&gt;FIJI&lt;/a&gt; and it seems to look pretty decent.&lt;img src=&quot;https://i.stack.imgur.com/fVzxL.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might still have some problems with segmenting due to the non-uniformity depending on the method you use.  If so perhaps look at local/adaptive threshold or something that looks for edges/maxima such as watershed based approaches.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-04-29T09:34:30.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15915" PostTypeId="2" ParentId="15908" CreationDate="2014-04-29T10:54:38.830" Score="2" Body="&lt;p&gt;I would guess you want something not too technically complex and cover the key concepts. The one that really jumps to mind is Canny's edge detector paper. Beyond that I guess it depends on what specific topics you cover. Here are a few ideas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Canny 1986, A Computational Approach to Edge Detection - the Canny filter paper. It is quite easy to understand and covers a widely used function. &lt;/li&gt;&#xA;&lt;li&gt;Bergholm 1987, Edge focusing - Paper on multiscale filtering. I guess not that popular a topic but I really like the paper, its well written and easy to understand.&lt;/li&gt;&#xA;&lt;li&gt;Chan &amp;amp; Vese 2001, Active contours without edges - Quite a widely cited paper, although perhaps not a great example, I find most of it quite impenetrable. First couple of sections are OK though and maybe more depending on your focus.&lt;/li&gt;&#xA;&lt;li&gt;Bleau &amp;amp; Leon 2000, Watershed-Based Segmentation and Region Merging - This paper is a bit of a beast (50+ pages) but is surprisingly clear and introduces things quite rigorously.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-04-29T10:54:38.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15916" PostTypeId="1" AcceptedAnswerId="15919" CreationDate="2014-04-29T11:25:50.943" Score="3" ViewCount="2842" Body="&lt;p&gt;I'm looking for a suitable measure in order to quantify the asymmetry of a signal. I've read this: &lt;a href=&quot;https://dsp.stackexchange.com/questions/11077/detect-signals-degree-of-imbalance&quot;&gt;Detect signals degree of imbalance&lt;/a&gt; and this: &lt;a href=&quot;https://dsp.stackexchange.com/questions/8586/how-to-measure-the-agreement-between-to-curves&quot;&gt;How to measure the agreement between to curves?&lt;/a&gt; but I can't see how they apply to my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is the part of the signal that I am interested in:&lt;img src=&quot;https://i.stack.imgur.com/tGUVl.jpg&quot; alt=&quot;Part of the signal that I am interested in (ignore xlabel)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red line shows the original signal and the black line shows the right part of the signal mirrored about the time=0 axis. What I need to do is find a way to quantify the asymmetry of the red line, i.e. a measure of its difference from the black line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have tried doing is taking the square root of the sum of the squares (SRSS) of the differences of each point. That is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;SRSS = \sqrt{\sum\limits_i (y_{black,i} - y_{red,i})^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, this measure is affected by the number of points that I take for each curve. So for example if the resolution is half, SRSS will decrease even if I'm comparing the same lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other measures of asymmetry that you can suggest? Ideally, they should be a single number and not be affected greatly by the resolution of the lines.&lt;/p&gt;&#xA;" OwnerUserId="8548" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-04-30T13:17:04.417" Title="How to quantify asymmetry of a signal?" Tags="|matlab|discrete-signals|signal-analysis|signal-detection|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15918" PostTypeId="2" ParentId="15916" CreationDate="2014-04-29T12:18:25.423" Score="3" Body="&lt;p&gt;You could compute the odd part of the signal. If the point of symmetry is the index $n=0$ (as in your example), then the odd part of the signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_o(n)=\frac12(y(n)-y(-n))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use the normalized sum of squares of $y_o(n)$ as a measure of asymmetry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$m=\frac{1}{(2N+1)Y^2_0}\sum_{n=-N}^{N}y_o^2(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Y_0=\max\{|y_o(n)|\}$. With this definition the measure $m$ is independent of the number of data points and it is also independent of scaling.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-04-29T12:18:25.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15919" PostTypeId="2" ParentId="15916" CreationDate="2014-04-29T12:21:42.637" Score="5" Body="&lt;p&gt;Assuming you're looking for symmetry around $x=0$, you can decompose any function into a symmetric and an antisymmetric part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f(x) = \frac{1}{2}\left(f(x)+f(-x)\right) + \frac{1}{2}\left( f(x) - f(-x) \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling $f_+(x):=\frac{1}{2}\left( f(x) + f(-x) \right)$ and $f_-(x):=\frac{1}{2}\left( f(x) - f(-x) \right)$ you can easily verify that $f_+$ is symmetric while $f_-$ is antisymmetric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can measure symmetry by taking any suitable norm on your functions. For example the symmetry of $f(x)$ can be measured as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S[f]:=\frac{||f_+||}{||f_+||+||f_-||}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which ranges from $0$ (fully antisymmetric) to $1$ (fully symmetric). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possible useful norm on functions is defined as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$||f|| = \sqrt{\int_\mathbb{R} f(x)^2 dx} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be discretised to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$||f|| = \sqrt{ \sum_i f(x_i)^2 \frac{x(i+1)-x(i-1)}{2} }$$&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-04-29T12:21:42.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15920" PostTypeId="1" AcceptedAnswerId="15924" CreationDate="2014-04-29T13:02:07.347" Score="2" ViewCount="6244" Body="&lt;p&gt;I have a hard problem that need your help. I have a binary image that maintains some unwanted region (small white dot) and hole regions (in figure 1).My idea is that the first I will remove unwanted region by calculating area these region and then filter with small area value.At the second step, I fill in hole region to make clear image.What do you think best method to fill in hole region. D.Because my idea need threshold value to remove unwanted region. I want to find automatic method to do it. Do you have any idea to resolve it? Thank you so much. This is my reference code for remove unwanted region. But it need threshold term. You can download image test at &lt;a href=&quot;https://www.dropbox.com/s/yvwl0lr0ef1q522/input.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function exImage=rmUnwantedRegion(Img,threshold)&#xA;    lb = bwlabel(Img);&#xA;    st = regionprops(lb, 'Area', 'PixelIdxList' );&#xA;    toRemove = [st.Area] &amp;lt;threshold; % fix your threshold here&#xA;    exImage = Img;&#xA;    exImage( vertcat(st(toRemove).PixelIdxList ) ) = 0; % remove&#xA; end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bGG3X.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2020-09-10T15:51:18.877" Title="Which method to remove small unwanted region and fill holes" Tags="|matlab|image-processing|image-segmentation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15922" PostTypeId="2" ParentId="15909" CreationDate="2014-04-29T14:20:47.470" Score="5" Body="&lt;p&gt;Recall the following &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Functional_relationships&quot; rel=&quot;nofollow noreferrer&quot;&gt;properties of the Fourier transform&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If $x(t)$ is an &lt;a href=&quot;http://en.wikipedia.org/wiki/Even_and_odd_functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;even function&lt;/a&gt;, then its Fourier transform $X(\omega)$ is purely real.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $x(t)$ is an &lt;a href=&quot;http://en.wikipedia.org/wiki/Even_and_odd_functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;odd function&lt;/a&gt;, then its Fourier transform $X(\omega)$ is purely imaginary.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus, we can think of the real and imaginary parts of the Fourier transform of a zero-mean Gaussian random process $x(t)$ as the Fourier transforms of two separate inputs $x_e(t)$ and $x_o(t)$: the components of the process that have even and odd symmetry, respectively. &lt;a href=&quot;https://math.stackexchange.com/questions/5274/how-do-i-divide-a-function-into-even-and-odd-sections&quot;&gt;We split the process into these components as follows&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_e(t) = \frac{x(t)+x(-t)}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_o(t) = \frac{x(t)-x(-t)}{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $x(t) = x_e(t) + x_o(t)$. Moving through this step by step,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Your observation was that $\text{Re}\{X(\omega)\}$ and $\text{Im}\{X(\omega)\}$ (the real and imaginary parts of the process's DFT) are uncorrelated. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using the Fourier transform properties mentioned above, we can deduce that $\text{Re}\{X(\omega)\} = X_e(\omega)$ and $\text{Im}\{X(\omega)\} = X_o(\omega)$; the real and imaginary parts of $X(\omega)$ are none other than the Fourier transforms of $x_e(t)$ and $x_o(t)$, respectively. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Therefore, your observation is equivalent to saying that $X_e(\omega)$ and $X_o(\omega)$ are uncorrelated.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since the Fourier transform is a one-to-one mapping between the time and frequency domains, I posit that the lack of correlation between $X_e(\omega)$ and $X_o(\omega)$ would imply a lack of correlation between $x_e(t)$ and $x_o(t)$ as well.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What is the correlation between $x_e(t)$ and $x_o(t)$? Simple:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;\mathbb{E}(x_e(t)x_o(t)) &amp;amp;= \mathbb{E}\left(\left(\frac{x(t)+x(-t)}{2}\right)\left(\frac{x(t)-x(-t)}{2}\right)\right) \\&#xA;&amp;amp;= \mathbb{E}\left(\frac{1}{4}\left(x^2(t) - x^2(-t)\right)\right) \\&#xA;&amp;amp;= \frac{1}{4} \left(\mathbb{E}(x^2(t)) - \mathbb{E}(x^2(-t))\right) \\&#xA;&amp;amp;= \frac{1}{4} \left(\sigma^2 - \sigma^2\right) \\&#xA;&amp;amp;= 0&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As expected, the even and odd components are uncorrelated. So, to summarize, I would say the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The real and imaginary components of a Fourier transform correspond to the individual Fourier transforms even and odd components of the input function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For a zero-mean Gaussian random process, these even and odd components are uncorrelated.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Therefore, their Fourier transforms (the real and imaginary components that you asked about) are also uncorrelated.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; To address your followup:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If $x(t)$ is Gaussian, then its even and odd components $x_e(t)$ and $x_o(t)$ are as well, due to the property that any weighted sum of Gaussian random variables is also Gaussian.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $x_e(t)$ and $x_o(t)$ are Gaussian random processes, then their Fourier transforms $X_e(\omega)$ and $X_o(\omega$) are as well. This follows from the same property as the previous statement; if you look at the transform, you're computing a weighted sum of a bunch of Gaussian random variables.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $X_e(\omega)$ and $X_o(\omega)$ are Gaussian, and they are uncorrelated with one another (as described above), then they are also independent. This is a property of the Gaussian distribution.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2014-04-30T13:38:55.540" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15923" PostTypeId="2" ParentId="15911" CreationDate="2014-04-29T14:27:53.710" Score="3" Body="&lt;p&gt;You might want to also try running a &lt;a href=&quot;http://en.wikipedia.org/wiki/Ridge_detection&quot; rel=&quot;nofollow noreferrer&quot;&gt;ridge filter&lt;/a&gt; on the dataset; something like &lt;a href=&quot;http://fiji.sc/wiki/index.php/Frangi&quot; rel=&quot;nofollow noreferrer&quot;&gt;the frangi filter&lt;/a&gt; might work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sample result is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/u63Kr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NB&lt;/em&gt;&#xA;the white border is due to the border in the image I pulled from this site &lt;/p&gt;&#xA;" OwnerUserId="1718" LastEditorUserId="1718" LastEditDate="2014-04-30T10:06:33.387" LastActivityDate="2014-04-30T10:06:33.387" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15924" PostTypeId="2" ParentId="15920" CreationDate="2014-04-29T14:51:07.027" Score="5" Body="&lt;p&gt;This code work fine for me. You try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RGB = imread('Image/input.png');&#xA;&#xA;GRAY = rgb2gray(RGB);&#xA;threshold = graythresh(GRAY);&#xA;originalImage = im2bw(GRAY, threshold);&#xA;&#xA;originalImage = bwareaopen(originalImage,250);&#xA;se = strel('disk', 10); %# structuring element&#xA;closeBW = imclose(originalImage,se);&#xA;&#xA;imshow(closeBW);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0iZwO.png&quot; alt=&quot;Rsultant image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8733" LastActivityDate="2014-04-29T14:51:07.027" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15925" PostTypeId="1" AcceptedAnswerId="15926" CreationDate="2014-04-29T15:19:35.613" Score="4" ViewCount="42934" Body="&lt;p&gt;I have an formula for this &quot;Maximum Quantization Error&quot; but i dont know what it is based in. Its just thrown in my study material without further explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Q = \dfrac {\Delta x}{2^{N+1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the number of bits used for quantization in a analog to digital conversion, and $\Delta x$ is, in portuguese &quot;Faixa de Excursão do Sinal&quot;, I don't know what would be the correct translation, but I bet on something like &quot;Signal Excursion Band&quot;. I know, its a strange name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help me with this? What is this $\Delta x$?&#xA;Sorry for my bad english, it isnt my native language.&lt;/p&gt;&#xA;" OwnerUserId="8734" LastEditorUserId="8202" LastEditDate="2014-04-29T17:07:31.510" LastActivityDate="2017-06-19T11:14:06.640" Title="What is &quot;Maximum Quantization Error&quot;?" Tags="|analog-to-digital|quantization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15926" PostTypeId="2" ParentId="15925" CreationDate="2014-04-29T15:48:25.403" Score="9" Body="&lt;p&gt;When you quantize a signal, you introduce and error which can be defined as &#xA;$$q[n] = x_q[n]-x[n]$$&#xA;where $q[n]$ is the quantization error, $x[n]$ the original signal, and $x_q[n]$ of the quantized signal. The maximum quantization error is simply $max(\left | q \right |)$, the absolute maximum of this error function. Dx in this definition seems to be the range of the input signal so we could rewrite this as&#xA;$$Q = \frac{max(x)-min(x)}{2^{N+1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at a quick example. Let's assume you have a signal that's uniformly distributed between -1 and +1 and you want to quantize this with 3 bits. You have a total 8 of quantizaton steps which would map to [-1 -.75 -.5 -25 0 .25 .5 .75]. The difference between steps is 0.25. If you round during quantization the maximum error will be half of that (i.e. 0.125). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's try the formula:&#xA;$$Q = \frac{max(x)-min(x)}{2^{N+1}} = \frac{1-(-1)}{2^{3+1}}= \frac{2}{16} = 0.125$$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="90" LastEditDate="2014-04-29T17:08:19.013" LastActivityDate="2014-04-29T17:08:19.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15927" PostTypeId="1" CreationDate="2014-04-29T16:27:53.453" Score="6" ViewCount="203" Body="&lt;p&gt;Consider a signal that can be expressed as a linear combinations of exponentials:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n) = \sum_{k=1}^K c_k z_k^n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to estimate the poles $z_k$ and I was told that I could estimate them by calculating the SVD of the Hankel matrix of the observations $\mathbf{H}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{H} = \left(\begin{array}{cccc}x(1) &amp;amp; x(2) &amp;amp; x(3) &amp;amp; \dots \\&#xA;x(2) &amp;amp; x(3) &amp;amp; x(4) &amp;amp; \dots \\&#xA;x(3) &amp;amp; x(4) &amp;amp; x(5) &amp;amp; \dots \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp;  \\\end{array}\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how exactly do I utilize the SVD? The poles will be the singular values? And is it possible to find $K$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8735" LastActivityDate="2015-02-24T18:08:00.827" Title="How to estimate the poles of a linear combination of exponentials?" Tags="|linear-algebra|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15928" PostTypeId="2" ParentId="15878" CreationDate="2014-04-29T17:00:07.353" Score="1" Body="&lt;p&gt;There are a few of things you can try:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Definitely move FaceDetect = vision.CascadeObjectDetector; outside of&#xA;the loop. You only need to create the face detector object once.&lt;br&gt;&#xA;Re-creating it for every frame is definitely your performance&lt;br&gt;&#xA;bottleneck.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;vision.VideoFileReader returns a frame of class 'single' by default. &#xA;If you change the output data type to 'uint8', that    should speed&#xA;up    the face detector.Use obj=vision.VideoFileReader('basu.avi',    'VideoOutputDataType',&#xA;'uint8');&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;vision.VideoFileReader can also do the conversion to grayscale for&lt;br&gt;&#xA;you. Use obj=vision.VideoFileReader('basu.avi',&lt;br&gt;&#xA;'VideoOutputDataType', 'uint8', 'ImageColorSpace', 'Intensity'); This&#xA;may be faster than calling rgb2gray.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Try limiting the size of the faces being detected using 'MinSize' and&#xA;'MaxSize' options of vision.CascadeObjectDetector    and/or try&lt;br&gt;&#xA;downsampling the frame before detecting faces.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8709" LastActivityDate="2014-04-29T17:00:07.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15929" PostTypeId="1" AcceptedAnswerId="15930" CreationDate="2014-04-29T19:18:20.880" Score="-2" ViewCount="1165" Body="&lt;p&gt;I have written this function in matlab&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [A] = intmat(a,b,N)&#xA; M = length(a);&#xA; A = zeros(M,N);&#xA; for m = 1 : M&#xA;   for n = 1 : N &#xA;     my_func = @(t) (t^(N-n));&#xA;     A(m,n) = quad(my_func,a(m),b(m));&#xA;   end&#xA; end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when i use this function for a = [1 2 3 4 5] and b = [1 2 3 4 5] and N = 5&#xA;i.e is run the statement intmat(a,b,N). i get the following error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;??? Error using ==&gt; mpower&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Inputs must be a scalar and a square matrix.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Error in ==&gt; intmat&gt;@(t)(t^(N-n)) at 6&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;my_func = @(t) (t^(N-n));&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Error in ==&gt; quad at 77&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;y = f(x, varargin{:});&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Error in ==&gt; intmat at 7&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A(m,n) = quad(my_func,a(m),b(m));&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7553" LastActivityDate="2014-04-29T19:41:39.547" Title="MATLAB code error" Tags="|matlab|" AnswerCount="2" CommentCount="1" ClosedDate="2014-05-03T14:16:58.063" ContentLicense="CC BY-SA 3.0" />
  <row Id="15930" PostTypeId="2" ParentId="15929" CreationDate="2014-04-29T19:35:45.290" Score="0" Body="&lt;p&gt;Change:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my_func = @(t) (t^(N-n));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my_func = @(t) (t.^(N-n));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7509" LastActivityDate="2014-04-29T19:35:45.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15931" PostTypeId="2" ParentId="15929" CreationDate="2014-04-29T19:41:39.547" Score="1" Body="&lt;p&gt;Strange error, because in my MATLAB it is showing:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Error using  ^  Inputs must be a scalar and a square matrix. To&#xA;  compute elementwise POWER, use POWER (.^) instead.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where answer is hidden in error message. You must apply element-wise operation. By default when for vector you do &lt;code&gt;a*a&lt;/code&gt; it will compute dot product. In order to multiply element by element use: &lt;code&gt;a.*a&lt;/code&gt;. So change the line 6:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my_func = @(t) (t.^(N-n));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Last question - what your software is supposed to do? Calculate integral for different ranges?&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-04-29T19:41:39.547" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15932" PostTypeId="1" CreationDate="2014-04-29T20:22:10.063" Score="0" ViewCount="142" Body="&lt;p&gt;Suppose we have a complex signal $\cos(2\theta) + j\sin(2\theta) = e^{j2\theta}$. Is there any way to find half-angle $\cos(\theta) + j\sin(\theta) = e^{j\theta}$ complex signal without going into polar form and preferably with no divisions? Iterative algorithms are fine.&lt;/p&gt;&#xA;" OwnerUserId="8740" LastEditorUserId="4346" LastEditDate="2014-04-30T06:43:13.853" LastActivityDate="2014-04-30T06:43:13.853" Title="Find half-angle of complex exponential" Tags="|polar|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15933" PostTypeId="2" ParentId="15932" CreationDate="2014-04-29T21:11:37.150" Score="1" Body="&lt;p&gt;For small $\Theta$ an approximation would be to simply halve the imaginary value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also use the ratio of the real and imaginary values as the index to a lookup table that would return the half angle value.  You could not store every possible value, of course, so you would have to choose some set of values and then lookup the value that is closest to the actual ratio.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-04-29T21:11:37.150" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15934" PostTypeId="2" ParentId="15898" CreationDate="2014-04-29T21:57:37.060" Score="2" Body="&lt;p&gt;I recommend this book:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.amazon.fr/Understanding-Digital-Signal-Processing-Edition/dp/0137027419&quot; rel=&quot;nofollow&quot;&gt;Understanding Digital Signal Processing, Richard G. Lyons&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This book explains the basics concepts of digital signal processing, which includes time-frequency analysis, in a very intuitive way.&lt;/p&gt;&#xA;" OwnerUserId="8735" LastActivityDate="2014-04-29T21:57:37.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15937" PostTypeId="2" ParentId="15927" CreationDate="2014-04-30T05:08:52.157" Score="0" Body="&lt;p&gt;Do you have to estimate it using the Hankel matrix?&#xA;It's because if we are talking about a continuous system, the powers of the exponential are actually the modes of your system. Take this case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s) = 1/(s+a) + 1/(s+b)  &#xA;$$&#xA;For say an impulse input:&#xA;$$&#xA;h(t) = y(t) = e^{-at} + e^{-bt}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the poles are $-b$ and $-a$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply the same idea for a discrete with the general solution of a difference equation, and you can come up with the comparison to find the poles from the equation directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if this is what you're looking for!&lt;/p&gt;&#xA;" OwnerUserId="8348" LastEditorUserId="8202" LastEditDate="2014-05-30T07:53:32.000" LastActivityDate="2014-05-30T07:53:32.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15938" PostTypeId="1" AcceptedAnswerId="15945" CreationDate="2014-04-30T05:10:27.630" Score="11" ViewCount="11427" Body="&lt;p&gt;This is a continuation of &lt;a href=&quot;https://dsp.stackexchange.com/questions/31/how-do-i-interpret-the-dct-step-in-the-mfcc-extraction-process&quot;&gt;the discussion here&lt;/a&gt;. I would comment there, but I don't have 50 rep so I'm asking a new question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I understand the DCT step in the MFCC calculation process: The rationale behind it is to separate the correlation in the log-spectral magnitudes (from the filterbank) due to the overlapping of the filters. Essentially, the DCT smooths the spectrum representation given by these log-spectral magnitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be correct to say that the blue line in the image below represents the spectrum as represented by the vector of log-spectral magnitudes, and the red line is that vector once its been DCT-ified?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vs1fO.png&quot; alt=&quot;DCT-ified log-spectral magnitudes (i.e. MFCCs) vs. merely log-spectral magnitudes???&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8743" LastEditorUserId="26573" LastEditDate="2019-01-07T17:23:09.787" LastActivityDate="2020-01-16T18:30:52.747" Title="Is this a correct interpretation of the DCT step in MFCC calculation?" Tags="|mfcc|dct|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15939" PostTypeId="1" CreationDate="2014-04-30T05:20:28.853" Score="1" ViewCount="2481" Body="&lt;p&gt;I need to do a perspective transformation on an image section from newspaper, here the girl's image. The section's coordinates are given as rough estimates. I need to find the boundary of the section and do a perspective transformation. I had been referring the following link.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://opencv-code.com/tutorials/automatic-perspective-correction-for-quadrilateral-objects/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://opencv-code.com/tutorials/automatic-perspective-correction-for-quadrilateral-objects/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, Hough Transform and Convex Hull method on contour finding give jagged lines. This is how the edge detection on the section looks like. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2fENF.jpg&quot; alt=&quot;edge&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;edges = cv2.Canny(gray, 50, 150)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I improve the Canny Edge lines to make them straighter so jagged lines are removed? The Convex Hull finds the boundary but not with a number of smaller lines and the boundary is not complete. Here is how the Convex Hull method's boundary looks like. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/SZTn7.jpg&quot; alt=&quot;convexhull&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;contours, hierarchy = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)&#xA;    for i, cnt in enumerate(contours):&#xA;        if hierarchy[0,i,3] == -1 and cv2.contourArea(cnt)&amp;gt;5000:&#xA;            hull = cv2.convexHull(cnt, returnPoints = True)&#xA;            print &quot;hull&quot;, hull&#xA;            for tempodd, itemodd in enumerate(hull):&#xA;                if tempodd % 2 == 0:&#xA;                    tempeven = tempodd&#xA;                    itemeven = itemodd&#xA;                    continue&#xA;                cv2.line(img, (itemeven[0][0], itemeven[0][1]), (itemodd[0][0], itemodd[0][1]), (255,0,0), 4)&#xA;                print &quot;itemodd&quot;, itemodd, &quot;itemeven&quot;, itemeven&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here since the Canny is getting jagged lines, the convex hull method gives multiple lines too. Point me where I am going wrong. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7692" LastActivityDate="2015-12-22T16:10:39.827" Title="Hough lines and Convex Hull methods give jagged lines" Tags="|hough-transform|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15940" PostTypeId="1" AcceptedAnswerId="15944" CreationDate="2014-04-30T05:22:48.343" Score="3" ViewCount="984" Body="&lt;p&gt;Reconstructing a speech signal from a collection of MFCC vectors &lt;a href=&quot;http://www.research.ibm.com/haifa/projects/multimedia/recovc/demo/index.html&quot; rel=&quot;nofollow&quot;&gt;seems to work pretty well&lt;/a&gt;, but I've heard that one advantage of MFCCs is speaker-independence i.e. they are more-or-less the same across different speakers for a given phoneme. How then can a speech signal, with all its speaker-dependent idiosyncrasies (accent, etc.) be reconstructed from a supposedly speaker-independent MFCC vector? Are MFCCs not in fact speaker-independent then? If not, what does determine speaker-independence vs. speaker dependence?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8743" LastActivityDate="2014-04-30T17:12:27.737" Title="If MFCC vectors are speaker independent, then how can we reconstruct unique speech signals from them?" Tags="|speech-recognition|mfcc|independence|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15941" PostTypeId="1" AcceptedAnswerId="15949" CreationDate="2014-04-30T05:30:14.917" Score="0" ViewCount="608" Body="&lt;p&gt;Say $\alpha$ is a complex random variable, then which one of the following expressions is correct?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$\mathbb{E}[\alpha^2]$ or &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\mathbb{E}[\alpha \alpha^*]$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8583" LastEditorUserId="1606" LastEditDate="2014-04-30T11:48:34.203" LastActivityDate="2014-04-30T12:03:17.437" Title="What is the mean power of a complex random variable?" Tags="|statistics|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15942" PostTypeId="2" ParentId="15938" CreationDate="2014-04-30T06:33:48.730" Score="3" Body="&lt;p&gt;More than smoothing the DCT reduces the number of dimensions needed to represent the spectrum. DCT is good for dimensionality reduction because it tends to compact most of the energy of the spectrum in the first few coefficients.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-04-30T06:33:48.730" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15943" PostTypeId="2" ParentId="15938" CreationDate="2014-04-30T07:08:30.920" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The rationale behind it is to separate the correlation in the log-spectral magnitudes (from the filterbank) due to the overlapping of the filters. Essentially, the DCT smooths the spectrum representation given by these log-spectral magnitudes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is incorrect. There is correlation between the log-spectral magnitudes not just because they overlap, but also because not any sequence of number represents a &quot;meaningful&quot; (as in, occurring in natural speech and sound) series of log-spectral magnitude. &quot;meaningful&quot; log-spectral magnitudes tend to be rather smooth, with an overall decrease of energy in the higher frequencies, etc. One would say that the dimension of the space of all &quot;meaningful&quot; log-spectral magnitude vectors is smaller than 40 or whichever number of bands you use ; and the DCT can be seen as dimensionality reduction to map the 40-channel data onto this smaller space.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Essentially, the DCT smooths the spectrum representation given by these log-spectral magnitudes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The DCT does not do any smoothing. You see smoothing when reconstructing from the DCT data - the smoothing being due to the loss of information by the DCT and the coefficient truncation that follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the MFCC coefficients do not store the smoothed spectrum - it stores a sequence of uncorrelated DCT coefficients.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-30T17:11:38.387" LastActivityDate="2014-04-30T17:11:38.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15944" PostTypeId="2" ParentId="15940" CreationDate="2014-04-30T07:19:10.560" Score="6" Body="&lt;p&gt;First of all there is some serious &quot;cheating&quot; in the MFCC reconstruction experiment you linked to: not only the MFCCs are used, but also the voiced/unvoiced bit and the pitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MFCC are not speaker independent. In fact, they are used for speaker identification/verification tasks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The speaker &quot;idiosyncracies&quot; are both in their prosody (preserved by this reconstruction experiment because the pitch is provided as a side-information to the reconstruction process) and in the articulation/timbre (preserved by the MFCC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two ingredients are needed to get MFCCs to work for speaker-independent recognition:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Vocal tract length normalization. A linear transformation (matrix multiplication of the MFCC vector) can map relatively well the MFCC sequences of two speakers speaking the same sentence. So even if MFCC are not speaker-independent one can optimize for a transformation matrix that &quot;flattens out&quot; the speaker-specific details.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Acoustic modelling. Using a large number of gaussians (or any classifier with large capacity) for a specific acoustic unit allows it to capture all the variations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-04-30T17:12:27.737" LastActivityDate="2014-04-30T17:12:27.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15945" PostTypeId="2" ParentId="15938" CreationDate="2014-04-30T08:13:46.787" Score="19" Body="&lt;p&gt;Let me start from the beginning. The standard way of calculating cepstrum is following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C(x(t))=\mathcal{F}^{-1}[\log(\mathcal{F}[x(t)])] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the MFCC coefficients case is a bit different, but still similar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After pre-emphasis and windowing, you calculate the DFT of your signal and apply the filter bank of the overlapping triangular filters, separated in mel scale (although in some cases linear scale is better than mel):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q0UUw.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In respect to cepstrum definition, you now represented the envelope of the spectrum (reduced spectrum) in mel-frequency scale. If you represent that, then you will see that it kind'a resembles your original signal spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next step is to calculate the logarithm of the coefficients obtained above. This is due to the fact that cepstrum is supposed to be a homomorphic transformation that separates signal from the impulse response of the vocal tract, etc. How?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An original speech signal &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt; is mostly convolved with an impulse response &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt; of the vocal tract: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat s(t)=s(t)\star h(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In frequency domain convolution is a multiplication of spectra: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat S(f) = S(f)\cdot H(f) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That can be decomposed into two parts, based on following property: &lt;span class=&quot;math-container&quot;&gt;$\log(a\cdot b) = \log(a)+\log(b) $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also expect that impulse response is not changing over time, thus it can be easily removed by subtracting the mean. Now you see why we taking the logarithms of our band energies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last step in the cepstrum definition would be the Inverse Fourier Transform &lt;span class=&quot;math-container&quot;&gt;$ \mathcal{F}^{-1}$&lt;/span&gt;. The problem is that we have only our log-energies, no phase information, so after applying the &lt;code&gt;ifft&lt;/code&gt; we get complex-valued coefficients - not very elegant for all this effort to be a compact representation. Although we can take the Discrete Cosine Transform, which is 'simplified' version of FT and get real-valued coefficients! &#xA;This procedure can be visualized as matching cosinusoids to our log-energy coefficients. You might remember that cepstrum is also called 'the spectrum of the spectrum'? That's the very step - we are searching for any periodicity in our log-energy envelope coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DuIB4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now you see that now it's rather hard to understand how the original spectrum looked like. Additionally, we are usually taking only first 12 MFCC's, as higher ones are describing fast changes in log-energies, which is usually making recognition rate worse. So the reasons for doing DCT were the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Originally you must perform IFFT, but it's easier to get the real-valued coefficients from DCT. Additionally, we no longer have full spectrum (all frequency bins), but energy coefficients within mel filter-banks, therefore usage of IFFT is a bit of overkill.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You see on the first figure that filter banks are overlapping, so the energy from ones next to each other is being spread between two - DCT allows to decorrelate them. Remember that this is a good property for example in case of Gaussian Mixture Models, where you can use diagonal covariance matrices (no correlation between other coefficients), instead of full ones (all coefficients are correlated) - this simplifies things a lot.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another way of decorrelating mel frequency coefficients would be PCA (Principal Component Analysis), technique solely used for this purpose. For our luck it was proven that DCT is a very good approximation of PCA when it comes to decorrelating signals, hence another advantage of using Discrete Cosine Transform.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Some literature:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Hyoung-Gook Kim, Nicolas Moreau, Thomas Sikora&lt;/em&gt; - &lt;strong&gt;MPEG-7 Audio and&#xA;  Beyond: Audio Content Indexing and Retrieval&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2020-01-16T18:30:52.747" LastActivityDate="2020-01-16T18:30:52.747" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="15947" PostTypeId="2" ParentId="15939" CreationDate="2014-04-30T08:37:07.327" Score="0" Body="&lt;p&gt;You could solve the problem in several ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Image pre-filtering (smoothing) with some kind of Gaussian filter, before doing edge detection, will yield smoother edges.&lt;/li&gt;&#xA;&lt;li&gt;Morphological operations, such as &lt;code&gt;dilate&lt;/code&gt; or &lt;code&gt;close&lt;/code&gt; on edge image will close the small holes.&lt;/li&gt;&#xA;&lt;li&gt;Find 4 most dominant lines using Hough method on edges image and then find their points of intersection&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="698" LastActivityDate="2014-04-30T08:37:07.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15949" PostTypeId="2" ParentId="15941" CreationDate="2014-04-30T11:46:53.137" Score="0" Body="&lt;p&gt;The correct expression for the mean power of a complex random variable $\alpha=x+jy$ is&#xA;$$&#xA;\begin{align}&#xA;\bar P &amp;amp;= \operatorname E\left[\alpha \alpha^*\right]\\&#xA;&amp;amp;= \operatorname E\left[x^2 + y^2\right]\\&#xA;&amp;amp;= \operatorname E\left[x^2\right] + \operatorname E\left[y^2\right]\\&#xA;&amp;amp;= \bar P_\mathrm{x} + \bar P_\mathrm{y}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the mean power of a complex random variable is the sum of the mean powers of its real and imaginary part, respectively. In contrast, expression no. 1 from your question evaluates to&#xA;$$&#xA;\begin{align}&#xA;\operatorname E\left[\alpha^2\right] &amp;amp;= \operatorname E\left[x^2 + j2xy - y^2\right]\\&#xA;&amp;amp;= \operatorname E\left[x^2\right] - \operatorname E\left[y^2\right] + \operatorname E\left[j2xy\right]\\&#xA;&amp;amp;= \bar P_\mathrm{x} - \bar P_\mathrm{y} + j2\operatorname E\left[xy\right]&#xA;\end{align}&#xA;$$&#xA;Note that for the special case of $x$ and $y$ being uncorrelated $\operatorname E\left[xy\right]=E\left[x\right]E\left[y\right]$. If, in addition, $x$ or $y$ has zero mean $E\left[xy\right]=0$.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-04-30T12:03:17.437" LastActivityDate="2014-04-30T12:03:17.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15951" PostTypeId="2" ParentId="15898" CreationDate="2014-04-30T13:55:30.903" Score="0" Body="&lt;p&gt;I would recommend &quot;An Introduction to Time-Frequency and Wavelet Transforms&quot; by Shie Qian. It covers Fourier, Gabor, Wavlet and Quadratic representations. It does not go into each area very deeply - but gives you and idea and you can then go into each area as you see fit. It does contain some mathematics, but not overly so. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having some foundation in linear algebra principles i.e. bases, orthogonality etc, will be useful. Wavelets are usually approached through multi-rate techniques (decimation and interpolation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also some tutorial like articles in the IEEE publications. Qian has one in the IEEE Signal Processing Magazine. Leonard Cohen has one in the Proceedings that focuses on linear and quadratic (STFT, Wigner-Ville) representations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another text is :&lt;br&gt;&#xA;&quot;Fundamentals of Wavelets&quot; by Goswani and Chan. While it is geared towards Wavelets, it covers STFT, Gabor and Wigner-Ville as well. The first chapter covers the basic linear algebra and vector space concepts you'll need to know.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-04-30T13:55:30.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15952" PostTypeId="2" ParentId="15939" CreationDate="2014-04-30T14:02:30.750" Score="0" Body="&lt;p&gt;So, basically what you want is the bounds of your picture. I think, although doing edge detection will yield corner feature after finding the intersection of the bounding lines, but that is more work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest you of finding most dominant four corners by 'corner feature detection'(Using Harris  or fast method). Then you have the bounds of your picture. Now you can have the sub image then apply the perspective transform to the raw image or to the corner vertices and then interpolate.&lt;/p&gt;&#xA;" OwnerUserId="8749" LastActivityDate="2014-04-30T14:02:30.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15954" PostTypeId="1" AcceptedAnswerId="15972" CreationDate="2014-04-30T15:43:41.170" Score="5" ViewCount="4354" Body="&lt;p&gt;I've read that upsampling performed in digital music playback can color the sound, produce artifacts, etc.  For example, an audio file ripped from a CD might be 44.1Khz/16-bit, and then upconverted to 48Khz/16-bit and played via an optical digital audio output.  Audiophiles say this is bad because the signal needs to be &quot;bit perfect&quot; to be reproduced correctly.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct?  My vague knowledge of DSP from grad school leads me to think that all upsampling should do is increase the bandwidth of the signal.  But, since the source signal is bandlimited, there shouldn't be anything new in the added bandwidth.  And I don't see why the process would color the sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? &lt;/p&gt;&#xA;" OwnerUserId="8752" LastActivityDate="2024-03-18T01:02:16.803" Title="Does audio upsampling create noise/artifacts or degrade the signal?" Tags="|audio|sampling|music|resampling|supersampling|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15955" PostTypeId="1" CreationDate="2014-04-30T16:11:02.590" Score="4" ViewCount="217" Body="&lt;p&gt;On Wikipedia I found the Hann-Poisson window, and the article claims the spectrum is smooth, but it isn't theoretically smooth, as it turns out. In practice you achieve partial smoothness by jacking up its $\alpha$ parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I find what I'm looking for in a function with finite support? Is it mathematically possible?&lt;/p&gt;&#xA;" OwnerUserId="7883" LastActivityDate="2017-07-13T08:34:21.427" Title="Window functions with rippleless spectra" Tags="|discrete-signals|fourier-transform|signal-analysis|window-functions|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="15956" PostTypeId="2" ParentId="14940" CreationDate="2014-04-30T17:14:51.343" Score="1" Body="&lt;p&gt;Could you describe what you want to find in your data -- peaks, trends, model ?&#xA;and what kind of noise there is -- $\infty$ possibilities ?&#xA;A plot would be good.&#xA;Without some more info, I can only say, with others, &quot;try it and see&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you may know,&#xA;a good way to smooth &lt;em&gt;and&lt;/em&gt; resample (interpolate) in Python is with&#xA;&lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/tutorial/ndimage.html#id1&quot; rel=&quot;nofollow&quot;&gt;scipy.ndimage.map_coordinates&lt;/a&gt;,&#xA;along the lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.ndimage import map_coordinates&#xA;&#xA;def smooth_resample( y, newlen ):&#xA;    &quot;&quot;&quot; resample y to newlen, with B-spline smoothing &quot;&quot;&quot;&#xA;    n = len(y)&#xA;    newgrid = np.linspace( 0, n - 1, newlen )&#xA;        # e.g. n = 3, newlen = 5 -&amp;gt; [0 .5 1 1.5 2]&#xA;    return map_coordinates( y, newgrid, mode=&quot;nearest&quot;, prefilter=False )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;map_coordinates&lt;/code&gt; also works for 2d images, 3d voxels ... hence the name &quot;ndimage&quot;.&lt;br&gt;&#xA;For more, stackoverflow has quite a few Q+A s that use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Cubic-spline interpolation uses the nearest 4 points to each x in newgrid,&#xA;whereas dsp smoothing filters are usually much longer.&#xA;For smoothing that preserves peaks,&lt;br&gt;&#xA;see Savitzky-Golay filters, e.g.&#xA;&lt;a href=&quot;http://apps.nrbook.com/empanel/index.html?pg=771&quot; rel=&quot;nofollow&quot;&gt;Numerical Recipes&lt;/a&gt; p. 771 ff.)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastActivityDate="2014-04-30T17:14:51.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15957" PostTypeId="2" ParentId="15955" CreationDate="2014-04-30T19:38:16.370" Score="0" Body="&lt;p&gt;That's an interesting question, I personally don't know if, in theory, that's possible or not (would be interesting to investigate). But as a practical matter perhaps you could design a Chebyshev Type II filter, take the IFFT, and use a sufficiently large number of taps. Chebyshev Type II filters have ripple in the stopband but not the passband (although that is monotonically decreasing). I'm not sure how much the truncation would influence the ripple, or if you can handle that large of a FIR. But it might get you close enough depending on your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This page details some of the results.&#xA;&lt;a href=&quot;http://iowahills.com/B2PolynomialFIRFilters.html&quot; rel=&quot;nofollow&quot;&gt;http://iowahills.com/B2PolynomialFIRFilters.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1678" LastActivityDate="2014-04-30T19:38:16.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15958" PostTypeId="1" AcceptedAnswerId="15994" CreationDate="2014-04-30T22:21:57.227" Score="1" ViewCount="60" Body="&lt;p&gt;I have an imaging problem.  I essentially have a metallic plate with a number of holes through it.  I am looking at the number of holes with a thermal camera.  While looking at the plate I have two phases of this analysis, 1.a source of hot fluid is flowing through the holes and behind the plate 2.a source of cold fluid flowing behind the plate and through the holes.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;During each phase I take a number of images N.  So in effect I have a set of random variables for each pixel in the image.  $H[x,y] = (x_1, x_2 .... x_n)$ and similarly $C[x,y]=(x_1, x_2 .... x_n)$ where H is the hot frames, C is the cold frames , x-y are the focal plane position of that particular pixel and 1,2,3 are the discrete time of the reading x.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it stands I'm just taking the mean value for H and C then subtracting them to generate an image ($I=\bar{H} - \bar{C}$ where the bar denotes the expected value) to gain an image that has significantly decreased noise and removes much of the background effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;This is really just to decrease the noise but I think there is more information there that I'm not utilizing considering this is not a wide sense stationary process, but is evolving with time as the temperatures reach equilibrium for each phase.&lt;/b&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a way to utilize this data and for any recommendations on processing this time evolution to form an image.  Any suggestions?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_difference#Arbitrarily_sized_kernels&quot; rel=&quot;nofollow&quot;&gt;Finite Difference Operator&lt;/a&gt; to approximate first and second derivatives, but this and various other algorithms have failed me.&lt;/p&gt;&#xA;" OwnerUserId="8606" LastActivityDate="2014-05-02T15:40:47.110" Title="Thermography time evolution" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15959" PostTypeId="1" CreationDate="2014-04-30T22:32:30.607" Score="1" ViewCount="182" Body="&lt;p&gt;I want to develop a procedure to remove some inpainted text from images, i.e. I have to estimate the inpainted pixels. I will do that with first an imputation step and then applying SVD (and perhaps later further improvements).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imputations step just have to give an initial guess of the inpainted pixels. I thought of applying a gaussian filter to get estimates of the inpainted pixels, but I think this does not give good results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does somebody know another way to get good inital guesses, i.e. imputations?&lt;/p&gt;&#xA;" OwnerUserId="8756" LastEditorUserId="8756" LastEditDate="2014-06-01T08:18:39.450" LastActivityDate="2015-01-27T12:16:22.610" Title="Drawing in images" Tags="|image-processing|lowpass-filter|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15960" PostTypeId="2" ParentId="15959" CreationDate="2014-04-30T23:01:00.147" Score="1" Body="&lt;p&gt;Proposal 1: Gaussian filter of large radius computed by assigning a null weight to any pixel that belongs to the inpainted area (so that the color of the text you want to get rid of does not &quot;bleed&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Proposal 2: Colour of the nearest pixel which does not belong to the inpainted area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Proposal 3: For each pixel, randomly sample a handful of points outside of the inpainted area, but not too far away from this pixel. Average the pixel values, weighted by the distance to the pixel.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-04-30T23:01:00.147" CommentCount="28" ContentLicense="CC BY-SA 3.0" />
  <row Id="15961" PostTypeId="1" AcceptedAnswerId="16132" CreationDate="2014-04-30T23:34:11.573" Score="0" ViewCount="2377" Body="&lt;p&gt;I'm trying to use a cardinal sine as a lowpass filter for a cosine signal with a fundamental of 1k. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In frequency domain, what really happens is that I'm multiplying two impulses (centered at -1k and 1k) with a rectangular pulse of width equals 2 (convolution is multiplication in frecuency domain). The result would be a constant zero function. However using the above code in Matlab I'm getting again the sinc function as output. Any help would be appreciated (attached the full plot).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D = 5;&#xA;f0 = 1000;&#xA;fm = 2*f0;    % nyquist reestriction&#xA;&#xA;t = (-D:1/fm:D);&#xA;x = cos(1000*2*pi*t);&#xA;h = sinc(t);&#xA;&#xA;x_p = filter(h,1,x);&#xA;plot(x_p);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GCO6k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7316" LastActivityDate="2014-05-09T14:23:26.160" Title="Using sinc as a filter" Tags="|filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15963" PostTypeId="2" ParentId="15961" CreationDate="2014-05-01T04:57:34.093" Score="1" Body="&lt;p&gt;You messed with f0/fm relationship. Try this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D = 5;&#xA;f0 = 1e3;&#xA;fm = 40e3;&#xA;t = 0:1:2*fm*D-1;&#xA;x = cos(2*pi*t*f0/fm);&#xA;h = sinc(-D*pi:1/10:D*pi);&#xA;x_p = filter(h,1,x);&#xA;plot(x_p); plot(x); plot(h);&#xA;figure; psd(x,2^11,fm);&#xA;figure; psd(h,2^11,fm);&#xA;figure; psd(x_p,2^11,fm);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8740" LastEditorUserId="8740" LastEditDate="2014-05-01T16:09:28.393" LastActivityDate="2014-05-01T16:09:28.393" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="15965" PostTypeId="1" AcceptedAnswerId="15966" CreationDate="2014-05-01T10:51:48.200" Score="0" ViewCount="1432" Body="&lt;p&gt;I want to transmit data like radio stations do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like radio stations broadcast music and etc. using frequency, so I am also curious to know about it that actually how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want to make such a device that will broadcast my data or voice in my apartment and if anybody will on that frequency they should hear my broadcast data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible or not ?&#xA;If yes then anyone please guide me.&#xA;And what happen if i ll broadcast on same frequency on which already data is broadcasting ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know about radio signals, so any guidance on it.&#xA;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="8760" LastActivityDate="2014-05-01T12:25:07.967" Title="How to transmit voice signal and receive on radio?" Tags="|signal-analysis|frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15966" PostTypeId="2" ParentId="15965" CreationDate="2014-05-01T12:25:07.967" Score="2" Body="&lt;p&gt;The first thing you have to know is that transmitting on the FM band is something heavily regulated. Your emitter must not exceed a specific power or range. Check the legislation of the country in which the device operates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this you will need an FM transmitter. You can buy them &lt;a href=&quot;http://www.belkin.com/us/p/P-F8Z439/&quot; rel=&quot;nofollow&quot;&gt;pre-made&lt;/a&gt;, or build them with &lt;a href=&quot;http://www.electroschematics.com/83/mini-fm-transmitter-max2606/&quot; rel=&quot;nofollow&quot;&gt;very few parts&lt;/a&gt;. It might even be possible to get it to work without additional hardware and some creative hacking (some smartphones or tablets use the BCM4329 chip for example, which is capable of FM transmission).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And what happen if i ll broadcast on same frequency on which already data is broadcasting ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The strongest signal wins.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-05-01T12:25:07.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15967" PostTypeId="1" AcceptedAnswerId="16300" CreationDate="2014-05-01T12:28:01.017" Score="4" ViewCount="1553" Body="&lt;p&gt;If I have an image that is severely corrupted by Poisson noise, and I want to fit a function to the image, is it &quot;better&quot; to attempt to denoise the signal first before fitting, or should I move straight to the fitting stage?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example below, a 2D Gaussian function has been corrupted by Poisson noise. Should I fit a 2D Gaussian to the noisy data, or to a denoised version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denoising images is often good for qualitative reasons, but I'm curious to know about the quantitative case, for example where the volume of the Gaussian is important?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By &quot;denoising&quot;, I'm thinking along the lines of the techniques such as &lt;a href=&quot;http://josephsalmon.eu/papers/ICASSP12_SDWH.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Non-local PCA&lt;/a&gt; rather than median filtering etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DCZFc.png&quot; alt=&quot;Noisy Gaussian image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8761" LastEditorUserId="8761" LastEditDate="2014-05-01T15:13:50.083" LastActivityDate="2014-05-16T22:56:04.893" Title="Poisson noise and curve fitting - denoise first?" Tags="|noise|image-processing|denoising|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15968" PostTypeId="1" AcceptedAnswerId="15969" CreationDate="2014-05-01T13:31:52.433" Score="1" ViewCount="1603" Body="&lt;p&gt;I am currently working on a application which requires an inverse Fourier transform (IFFT) and am using a function library provided by Texas Instruments, in the datasheet they give an example on how to use one of their IFFT functions (shown below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: whilst I understand the need to perform bit reversal either on the input (decimation in time for an FFT) or the output (decimation in frequency for an FFT), I can't understand what's happening in the code given in the example. No bit reversal is performed on the input or the outputs only on the twiddle factors, is there some maths I am missing? Maybe something to do with the why the code accesses individual twiddle factors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps. The code is original from page 4-34 of this document: &lt;a href=&quot;http://www.ti.com/lit/ug/spru657c/spru657c.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ti.com/lit/ug/spru657c/spru657c.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void main(void)&#xA;{&#xA; gen_w_r2(w, N); // Generate coefficient table&#xA; bit_rev(w, N&amp;gt;&amp;gt;1); // Bit−reverse coefficient table&#xA; DSPF_sp_cfftr2_dit(x, w, N);&#xA; // radix−2 DIT forward FFT&#xA; // input in normal order, output in&#xA; // order bit−reversed&#xA; // coefficient table in bit−reversed&#xA; // order&#xA; DSPF_sp_icfftr2_dif(x, w, N);&#xA; // Inverse radix 2 FFT&#xA; // input in bit−reversed order,&#xA; // order output in normal&#xA; // coefficient table in bit−reversed&#xA; // order&#xA; divide(x, N); // scale inverse FFT output&#xA; // result is the same as original&#xA; // input&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8165" LastActivityDate="2014-05-01T13:49:54.223" Title="Bit reversal on twiddle factors on inverse FFT" Tags="|fft|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15969" PostTypeId="2" ParentId="15968" CreationDate="2014-05-01T13:49:54.223" Score="1" Body="&lt;p&gt;The answer to your question can be found just in reading the comments in the C code that you quoted. The process looks like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The input vector &lt;code&gt;x&lt;/code&gt; is passed through a function &lt;code&gt;DSPF_sp_cfftr2_dit()&lt;/code&gt;, which is described as a radix-2 decimation-in-time forward FFT. It expects its input in normal order and writes its output in bit-reversed order. It expects its twiddle factors to be in bit-reversed order (which they are, as shown in the first two lines of the function).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The forward FFT result is passed through another function &lt;code&gt;DSPF_sp_icfftr2_dif()&lt;/code&gt;, which is described as a radix-2 decimation-in-frequency inverse FFT. It expects its input in bit-reversed order (which it is, as the input is the output of the forward FFT above, which was in bit-reversed order). It expects its twiddle factors to be in bit-reversed order (which they are). It writes its output in normal order.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So, what you have is an input vector &lt;code&gt;x&lt;/code&gt; that starts in normal order and runs through an FFT/IFFT round trip, resulting in a vector that is also in normal order (and should be approximately identical to the original vector &lt;code&gt;x&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-05-01T13:49:54.223" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15970" PostTypeId="1" AcceptedAnswerId="15971" CreationDate="2014-05-01T14:16:26.387" Score="3" ViewCount="1036" Body="&lt;p&gt;I am new to signal processing and am currently doing research into the subject. I am learning about Orthogonal Frequency Division Multiplexing and have a question. Most definitions of OFDM mention its modulation scheme can be adapted to suit channel conditions, an example being changing to a more robust scheme if heavy noise is present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is if the adaptation is applied to every sub-carrier or can each scheme be applied on a per sub-carrier basis? Will every sub-carrier be forced to switch to QPSK for example or can ones that are not affected keep using a high data rate scheme?&lt;/p&gt;&#xA;" OwnerUserId="8763" LastActivityDate="2017-05-04T23:44:32.687" Title="Really basic question about OFDM" Tags="|modulation|demodulation|ofdm|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15971" PostTypeId="2" ParentId="15970" CreationDate="2014-05-01T14:46:31.237" Score="5" Body="&lt;p&gt;Either of your suggested approaches would work (adapting modulation/coding scheme on a per-subcarrier basis or changing all subcarriers at once). There's no theoretical constraint that prevents you from doing that; it's simply a question of whether the added efficiency of tuning individual subcarriers is worth the increased system complexity.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-05-01T14:46:31.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15972" PostTypeId="2" ParentId="15954" CreationDate="2014-05-01T15:09:02.153" Score="6" Body="&lt;p&gt;The up-sampling process will always change the signal in some measurable way. However, if it's done properly the changes are negligible and don't result it any audible difference. Most commercially sample rate converters (hardware or software implementations), do a really good job at this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Off course, if done badly, upsampling can result in clearly audible signal degradation. I'm not familiar with Apple's implementation but I would assume that they got this correctly.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-05-01T15:09:02.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15973" PostTypeId="1" CreationDate="2014-05-01T15:51:11.667" Score="0" ViewCount="245" Body="&lt;p&gt;When considering the uncertainty of a signal which is determined by multiple inputs propagation of uncertainty states that for measurement $$ y = f(x), x=\{x_1, x_2,..., x_N\} $$ uncertainty in $y$ is $$u_y=\sum_i \frac{\partial f}{\partial x_i} u_{x_i} $$ My question is how do we get to this rule. I know that it can be obtained by a taylor expansion of $f_i$ but I don't see why this is a sensible/logical thing to do.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastEditorUserId="8662" LastEditDate="2014-05-02T09:23:35.853" LastActivityDate="2014-05-02T09:23:35.853" Title="What is the reasoning behind the deviration of propogation of uncertainty?" Tags="|derivation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15974" PostTypeId="1" AcceptedAnswerId="15975" CreationDate="2014-05-01T21:06:04.860" Score="3" ViewCount="2821" Body="&lt;p&gt;I am working on some waveform generation software and I am trying to figure out what the best type of filter would be to use a an Anti Aliasing filter for my algorithm.&#xA;I am generating my waves in a &quot;Raw&quot; mathematical way, meaning that i am creating a ramp for a saw wave and my square wave consists of pure 1's and 0's. The issue is that this technique is inherently not band limited. I would like to implement low pass filter into the algorithm in order to filter of the harmonic being generated that are higher than the nyquist limit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the ideal filter design for this? What kind of roll of would i need?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing this in c++ but i don't neccesarily need an answer in c++. just an equation or some resources would be good as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit:&#xA;I am not changing the sampling rate at any point in the chain. But i am still experiencing some aliasing somehow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double _DSP::Saw_Wave(double* _frequency,_DSP::Saw_Data* _data){&#xA;    double _val = _data-&amp;gt;_phasor;&#xA;    _data-&amp;gt;_phasor += 2.0*(1.0/(_DSP::Sample_Rate::Samples_Per_Second()/ *_frequency));&#xA;    if (_data-&amp;gt;_phasor&amp;gt;_data-&amp;gt;_tolerance) {&#xA;        _data-&amp;gt;_phasor-=2.0;&#xA;    }&#xA;    return _val ;&#xA;}&#xA;&#xA;typedef struct Saw_Data{&#xA;        double _phasor = 0.0;&#xA;        double _tolerance = 1.0;&#xA;    }Saw_Data;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where _DSP::SampleRate::Samples_Per_Second() is the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the code generates the proper wave and frequency but has unwanted low frequency information when played at higher frequencies.&lt;/p&gt;&#xA;" OwnerUserId="8658" LastEditorUserId="8658" LastEditDate="2014-05-01T21:36:31.617" LastActivityDate="2014-05-05T02:27:05.360" Title="Digital Anti Aliasing Filter For Waveform Band Limiting" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15975" PostTypeId="2" ParentId="15974" CreationDate="2014-05-01T21:42:28.470" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I am generating my waves in a &quot;Raw&quot; mathematical way, meaning that i am creating a ramp for a saw wave and my square wave consists of pure 1's and 0's. The issue is that this technique is inherently not band limited. I would like to implement low pass filter into the algorithm in order to filter of the harmonic being generated that are higher than the nyquist limit. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can't do this.  You've already aliased the frequencies when you generated the waves in that way.  You can't remove them with a filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're essentially sampling the pure mathematical signal without using an antialiasing filter first.  It's not possible to add the antialiasing filter &lt;em&gt;after&lt;/em&gt; sampling.  You will just filter the already-aliased signal.  Bandlimiting has to occur before sampling.  You need to change the way you generate the waveforms if you want them to be bandlimited.  You could generate them using additive synthesis, as I've demonstrated &lt;a href=&quot;https://gist.github.com/endolith/407991&quot;&gt;here&lt;/a&gt;, or you could generate them the simple way at a much higher sampling rate to minimize the aliasing, then antialias filter, then decimate.  Or you could use BLIT or BLEP, etc.  (I think those are both &quot;reduced-aliasing&quot; not 100% eliminated, but I'm not sure.)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2014-05-01T21:42:28.470" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="15976" PostTypeId="2" ParentId="15974" CreationDate="2014-05-01T22:23:30.160" Score="6" Body="&lt;p&gt;Let us say your sample rate is 48kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are generating a sawtooth wave at a fundamental frequency of 10kHz, using your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First harmonic is at 10kHz. Second harmonic at 20kHz. Third harmonic at 30kHz. But since your signal is inherently sampled at 48kHz, anything above Nyquist gets aliased back into the 0..24kHz band. The 30kHz harmonic is 6kHz above Nyquist, so it gets folded back to 24-6 = 18kHz. Fourth harmonic at 40kHz, 16kHz above Nyquist, folded back to 8kHz which is below your fundamental! Next harmonic at 50kHz, 26kHz above Nyquist, folded back to 2kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend you to use Sonic Visualizer or any other audio analysis tool, and monitor the spectra of the signals coming out of your code. You'll see the undertones created by your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are already working with a 48kHz sample rate / 24kHz Nyquist frequency, everything your algorithm generates will be folded into this band; and obviously no simple filter shape - low-pass, high-pass could filter the spurious 18kHz, 8kHz, 2kHz and so on tones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only filter that could possibly work would be a comb-filter with a cutoff frequency equal to your fundamental - but it is tricky to design, and still won't handle the case where the fundamental divides the sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, you need to use a technique which directly synthesize (approximately) band-limited data - additive synthesis, band-limited wavetables, or minBLEP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You generate your data as a ridiculously high sample rate - to the point that you can consider that aliasing will be negligible; and then low-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let us say that you request that no alias image should be above -48dB (which is still very lax!). This means that only the 252th harmonic of your sawtooth wave can be aliased (its amplitude will be 0.004, or -48dB). So your Nyquist frequency has to be above the frequency of the 252th harmonics of the highest pitched note. Let us say 4kHz is the highest fundamental frequency you want to synthesize. This means a sample rate of 2 x 4000 x 252 = 2 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you have lots of computational resources to waste, you can run your synthesis code at 2 MHz, then apply a brickwall low-pass filter at 24kHz, and resample at 48kHz. But this would be a very stupid thing to do...&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-05-01T23:17:38.910" LastActivityDate="2014-05-01T23:17:38.910" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15977" PostTypeId="2" ParentId="15958" CreationDate="2014-05-01T23:15:38.053" Score="0" Body="&lt;p&gt;I've had this post up with no takers so I will just put what I have found so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm that has resulted in the least noise for my application that I have tried is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $X =[x1,x2,....,xn]$ be a sample of a function over discrete time intervals where x is a real number and represents the output of a particular pixel at $\delta t*i$ where $0&amp;lt;i&amp;lt;n$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find a linear function $f$ that best approximates the data in the form (I tried polynomials of varying degrees but a linear function performed the best):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(x) = m *x + b$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluate the function at ${t }= {{n*\delta t} \over{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $f({{n*\delta t} \over{2}}) \approx Median $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My motivation was to find the median but it may be a somewhat bold assertion.  I wanted the median value of each pixel but the chances of picking a pixel due to noise was too great.  Plus because of the physical constraints I know that the data is either decreasing or increasing over the intervals with respect to the phase of data collection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do this for both hot and cold images to form the image using the notation above $I=\bar{H} - \bar{C}$.&lt;/p&gt;&#xA;" OwnerUserId="8606" LastEditorUserId="8606" LastEditDate="2014-05-02T12:17:06.123" LastActivityDate="2014-05-02T12:17:06.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15978" PostTypeId="1" AcceptedAnswerId="15979" CreationDate="2014-05-01T23:21:29.210" Score="1" ViewCount="1493" Body="&lt;p&gt;I am very new to DSP, so excuse my ignorance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Audacity, I generated a sine wave of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;frequency 440Hz&lt;/li&gt;&#xA;&lt;li&gt;amplitude: 0.8   &lt;/li&gt;&#xA;&lt;li&gt;duration: 1 minute&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now when i plot the spectrum for this sine wave, I get an image like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nVZrf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is really surprising for me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was expecting a single surge at 440 Hz for the pure tone. But this is entirely different.&#xA;Sure this is not anything to do with noise. Right ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can the spectrum of a pure tone have so many frequency components in the spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What obvious am I missing ?&lt;/p&gt;&#xA;" OwnerUserId="8501" LastActivityDate="2014-05-02T09:28:50.167" Title="Sin wave spectrum shows multiple frequency" Tags="|fft|frequency-spectrum|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15979" PostTypeId="2" ParentId="15978" CreationDate="2014-05-01T23:38:29.123" Score="4" Body="&lt;p&gt;An FFT only results in a single component (plus its complex conjugate and some tiny numerical noise) if the single pure real sinusoid input is of a frequency whose period is an exact integer submultiple of the FFT size.  A rectangular window makes any &quot;leakage&quot; into other non-adjacent bins even worse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the length of the FFT you have specified is 512, which is not an exact multiple of the period of your signal (which is 44100/440 = 100.227273).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-05-02T09:28:50.167" LastActivityDate="2014-05-02T09:28:50.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15980" PostTypeId="2" ParentId="15978" CreationDate="2014-05-02T03:52:46.323" Score="2" Body="&lt;p&gt;When you take the DFT of a finite length sequence, you are effectivly windowing it. For the simple example you described with a sinusoid, you are first taking y[n] = x[n] * w[n] where x is the sinusoid and w is the window function. Multiplication in the time domain is convolution in the frequency domain. The DFT of a rectangular window is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow&quot;&gt;sinc&lt;/a&gt; function. See the fourier transform pair 201 in &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; and it shows a rectangular function. The fourier transform of a sin function is two delta impulses at +/- frequency. You're only plotting the positive frequency, but the same exists in the negative frequency domain also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you convolve a sinc function with a delta function you smear the two, so that's why you have a sinc function that is smeared across the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other properties that characterize window functions like main lobe width and peak side lobe level, all of which are outside the scope of this question, but generally people use hamming or hanning windows prior to taking the FFT.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-05-02T03:52:46.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15981" PostTypeId="1" AcceptedAnswerId="15983" CreationDate="2014-05-02T04:15:55.983" Score="2" ViewCount="6093" Body="&lt;p&gt;A very naive question... A signal with bandwidth of 20 MHz is modulated using a carrier of 1 GHz. What will be the sampling frequency?&#xA;I was asked this question during an interview. I answered 2 GHz but the interviewer said it will be 40 MHz. Can anyone explain it?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8765" LastEditorUserId="4298" LastEditDate="2014-05-02T09:49:13.440" LastActivityDate="2014-05-02T09:49:13.440" Title="Sampling frequency of modulated signal" Tags="|frequency|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15982" PostTypeId="2" ParentId="15967" CreationDate="2014-05-02T04:50:43.633" Score="2" Body="&lt;p&gt;This is not an answer. I wanted to add a comment, but no rep yet.&#xA;This is mainly dependent on the SNR.&#xA;I feel this is a very content based decision. If most of your images are taken in very low intensity conditions, then denoising is required, to get an estimate of the original data. Or if they are medical images, you don't want much error in the analysis, so again some kind of &quot;refined&quot; data is required here.&#xA;But if you have images from well illuminated scenes, it really doesn't matter - the effect of the noise is very low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I missed a part of the answer. If its the volume that interests you, then based on the error in volume that you are willing to tolerate, you can set a threshold on the SNR, beyond which denoising becomes a must.&lt;/p&gt;&#xA;" OwnerUserId="7749" LastEditorUserId="8761" LastEditDate="2014-05-02T09:48:16.187" LastActivityDate="2014-05-02T09:48:16.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="15983" PostTypeId="2" ParentId="15981" CreationDate="2014-05-02T04:59:09.727" Score="5" Body="&lt;p&gt;Nyqvist-shannon sampling theorem  only says that your sampling frequency should be greater than twice the bandwidth of the signal and not twice the carrier frequency of the signal. Hence you can modulate your 20 MHz signal at any carrier frequency you need and still get back your original signal by sampling  at greater than 40 MHz. Hence you need not sample at 2GHZ for recovery of signal, you can do away with a sampling frequency greater than 40 MHz itself  For a more clear understanding refer to bandpass sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Undersampling&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="4375" LastEditDate="2014-05-02T06:04:07.213" LastActivityDate="2014-05-02T06:04:07.213" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="15984" PostTypeId="1" CreationDate="2014-05-02T07:30:17.550" Score="0" ViewCount="53" Body="&lt;p&gt;During the multi-camera tracking, there is a situation where one person moves from one camera's coverage area to another. In that case that person has to be re-identified(as the one from previous camera's previous view) in order to keep tracking the particular object. What is the easiest way to do this? Color matching? Can anyone give me some suggestions?&lt;/p&gt;&#xA;" OwnerUserId="7422" LastActivityDate="2014-05-02T07:30:17.550" Title="Pedestrian Re-identification during tracking" Tags="|image-processing|object-recognition|tracking|visual-tracking|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15985" PostTypeId="1" CreationDate="2014-05-02T08:18:46.470" Score="1" ViewCount="4903" Body="&lt;p&gt;I wish to low pass filter an image with a Gaussian kernel. However, I also wish to select a filter that has the property of producing images that have have no greater than N cycles/pixel. Let's say I wish N to be close to, or exactly .025.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By what method is $\sigma$ selected in order to obtain such an image?&lt;/p&gt;&#xA;" OwnerUserId="8766" LastActivityDate="2018-11-08T13:02:40.640" Title="When lowpass filtering with a Gaussian kernel, how can $\sigma$ be related to cycles/pixel?" Tags="|lowpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15987" PostTypeId="2" ParentId="15985" CreationDate="2014-05-02T09:09:06.227" Score="0" Body="&lt;p&gt;You have to be more specific about what you want from the filter. No practical lowpass filter will remove all of the energy in the low frequencies. Filter design involves a tradeoff between how well you want to eliminate the undesired frequencies and the size of your filter among other things.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-05-02T09:09:06.227" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15988" PostTypeId="2" ParentId="15985" CreationDate="2014-05-02T09:11:20.560" Score="1" Body="&lt;p&gt;The frequency response of a Gaussian is also a Gaussian, see &lt;a href=&quot;http://en.wikipedia.org/wiki/Gaussian_filter&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. The cutoff frequency $\sigma_f$ is defined as the standard deviation of the frequency response. This is given by $$ \sigma_f = \frac{1}{2\pi\sigma} $$ Given that $N$ is the wavelength of the frequency components you wish to remove, you can calculate the corresponding frequency and work out how much you want to reduce it by, work out the corresponding cut-off frequency and filter standard deviation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more back of the envelope approach is to say that Gaussians of standard deviation, $\sigma$, remove or strongly reduce components with lateral size $&amp;lt;\sigma$.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-02T09:11:20.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15990" PostTypeId="1" CreationDate="2014-05-02T10:30:35.457" Score="8" ViewCount="7173" Body="&lt;p&gt;&lt;em&gt;I am a student of computer science (not the university but technical school).&lt;/em&gt;&#xA;I am interested in the world of DSP, and I saw that it is closely connected with mathematics. I noticed for example that a lot is based upon the Fourier I'm slowly trying to learn. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want to buy the book &quot;Understanding Digital Signal Processing&quot;, but I do not know what I would go against it, and if I can understand it. What I want to know is a short list of topics needed before we can deal with such a study that one should know, is listed for reference material. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me give you an example of what I mean (to be taken only indicative, since we do not know almost nothing of DSP) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mathematics: Integral  &#xA;Physics: Pressure&#xA;Science: Anatomy of the human ear, Anatomy of the human eye.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know most of you are engineers with years of work experience and master behind it, but somewhere we must also begin ;)&lt;/p&gt;&#xA;" OwnerUserId="8770" LastActivityDate="2014-05-07T05:45:14.563" Title="What are the minimum knowledge required to begin the study of Digital Signal Processing?" Tags="|reference-request|soft-question|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="15991" PostTypeId="1" AcceptedAnswerId="15993" CreationDate="2014-05-02T10:45:05.810" Score="2" ViewCount="1256" Body="&lt;p&gt;I have multiples records of  a motor sound, I would like to synchronize them first and then  calculate their spectrogram. My question is how can I use the autocorrelation or the crosscorrelation to synchronize them? I want to make sure that the only difference I see in the spectrogram is related to the frequency, not to the start position of the motor or the records.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know to calculate the auto and cross correlation in MATLAB but I don't understand how to use them for synchronization purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="8202" LastEditDate="2014-05-21T07:00:28.730" LastActivityDate="2014-05-21T07:00:28.730" Title="Auto or cross correlation for synchronisation in MATLAB" Tags="|matlab|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15992" PostTypeId="2" ParentId="15990" CreationDate="2014-05-02T10:47:17.777" Score="15" Body="&lt;p&gt;I personally believe that the approach of studying something just in order to &quot;feel ready&quot; to study something else later on is not efficient and tends to overwhelm the student. (This of course only applies because I assume that you know what a computer scientist should know anyway: basic math, and - most importantly - how to think clearly and logically.) I could give you a whole list of mathematical topics which are important for doing DSP, but this would just paralyze you and would make you feel that there is so much you need to know that you won't even know where to start. Note that DSP has become such a huge topic in itself that there is hardly anyone who can claim that he knows even the basics of all its different sub-fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what do I recommend to you after all? Get a good book on DSP and simply start studying it. If you come across problems that you cannot solve yourself, dig deeper by searching the internet, asking questions on this site, etc. In this way you will learn all necessary basics that you might be lacking. But the point is that only in this way will you find out what it actually is that you are lacking, so filling the gaps in your knowledge will be most efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One good (and free!) book I would like to recommend to you is &lt;a href=&quot;http://eceweb1.rutgers.edu/~orfanidi/intro2sp/&quot; rel=&quot;noreferrer&quot;&gt;Introduction to Signal Processing by Orfanidis&lt;/a&gt;. It contains a lot of necessary basics and it is very practical. I think you will learn a lot in quite a short time. Also take a look at &lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;noreferrer&quot;&gt;this online-book&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answers to &lt;a href=&quot;https://dsp.stackexchange.com/questions/15766/looking-to-educate-myself-in-dsp-theory&quot;&gt;this question&lt;/a&gt; might also be relevant for you.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-05-02T10:47:17.777" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15993" PostTypeId="2" ParentId="15991" CreationDate="2014-05-02T11:06:23.960" Score="3" Body="&lt;p&gt;Mostly it is a very simple task. Here is the example for shifted sinusoid:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0,6*pi,1000); % time vector for sinusoid&#xA;s = [zeros(1,100), sin(2*pi*t), zeros(1,100)];  % original signal&#xA;shift = 30; % we are shifting our sinusoid 30 bins to the right&#xA;ss = [zeros(1, shift) s(1:end-shift)]; % signal shifted&#xA;subplot(2,1,1)&#xA;plot(s); hold on;&#xA;plot(ss, 'r')&#xA;&#xA;[c, lags] = xcorr(ss, s); % get the cross-correlation together with lags&#xA;subplot(2,1,2)&#xA;plot(lags, c)&#xA;&#xA;pred_shift = lags(c==max(c)); % calculated the shift from maximum value of cross-correlation&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is: &lt;code&gt;30&lt;/code&gt; and you can use it to shift back the signal &lt;code&gt;ss&lt;/code&gt;. In your case of engine signals it will be analogous. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-02T11:06:23.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15994" PostTypeId="2" ParentId="15958" CreationDate="2014-05-02T15:40:47.110" Score="0" Body="&lt;p&gt;First thing I would probably do is view it as a pseudo-video in matlab or something. Plot each time image and step through them to get a qualitative idea of if/how it changes in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Effectively what you have is a 3D matrix with dimensions ($n \times m \times t$). So for visualization purposes you are not restricted to the $xy$ plane you could for example view the time evolution along one row of you data. This is probably the best bet to visulise stuff as viewing 4D data is hard...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quantitative ways to describe the data I would guess you want to fit some model to the data. This should really be done on the whole dataset. You are probably in the best position to decide on an appropriate model, but I guess the &lt;a href=&quot;http://en.wikipedia.org/wiki/Heat_equation&quot; rel=&quot;nofollow&quot;&gt;heat equation&lt;/a&gt; would be a good place to start.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-02T15:40:47.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="15995" PostTypeId="2" ParentId="15990" CreationDate="2014-05-02T15:54:30.403" Score="1" Body="&lt;p&gt;While I pretty much agree with Matt L. I will actually try and answer the question you asked and give you a list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maths: Fourier transforms, calculus, complex numbers, trigonometry (at least as it applies to waves), convolution (I guess this is really just part of fourier).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Physics: Waves (knowing more about sound/EM waves may be useful depending on what signals you're looking at).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic Programming skills&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond this, specific knowledge may be useful depending on what your doing but the list could get very long very fast if I keep going.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-02T15:54:30.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15996" PostTypeId="1" AcceptedAnswerId="15998" CreationDate="2014-05-02T16:15:34.710" Score="4" ViewCount="5284" Body="&lt;p&gt;How do you derive the theoretical symbol error rate as a function of $E_\mathrm{b}/N_0$ for 4QAM? I know that the result should be $Q\left(\sqrt{2E_\mathrm{b}/N_0}\right)$ but I am ĺooking for the derivation. Also, what are the symbol error rates vs $E_\mathrm{b}/N_0$ for 16QAM and 32QAM?&lt;/p&gt;&#xA;" OwnerUserId="8392" LastEditorUserId="1606" LastEditDate="2014-05-02T17:26:35.227" LastActivityDate="2023-08-18T21:21:10.067" Title="How is the symbol error rate for M-QAM, 4QAM,16QAM and 32QAM derived?" Tags="|modulation|amplitude|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="15997" PostTypeId="2" ParentId="15990" CreationDate="2014-05-02T16:23:29.420" Score="1" Body="&lt;p&gt;One useful technique to get a very general topical overview of what might be needed is to look for introductory DSP courses at various universities that you respect.  Then check the catalog for all the course prerequisites required/recommended for the DSP course, and follow the course dependencies backwards until you get to what you know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, for their DSP course prerequisites, Stanford seems to require two courses on linear systems and signal processing, which in turn requires a course on calculus and ordinary differential equations.  Courses in statistical signal processing and Fourier transform theory are also recommended.  University calculus probably requires high school trig, algebra and geometry.  etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some large segment of the population, I do not recommend just &quot;diving in&quot;, as without the math prerequisites, one can end up with a very superficial or outright mistaken understanding.  But if you are bright and intellectually aggressive, try it.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-05-02T16:37:05.027" LastActivityDate="2014-05-02T16:37:05.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="15998" PostTypeId="2" ParentId="15996" CreationDate="2014-05-02T19:49:32.243" Score="6" Body="&lt;p&gt;In &lt;span class=&quot;math-container&quot;&gt;$2^{2n}$&lt;/span&gt;-QAM with a square constellation, there are &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; &amp;quot;corner&amp;quot; points and&#xA;&lt;span class=&quot;math-container&quot;&gt;$4(2^n-2)$&lt;/span&gt; &amp;quot;edge&amp;quot; points, and &lt;span class=&quot;math-container&quot;&gt;$(2^n-2)^2$&lt;/span&gt; &amp;quot;interior&amp;quot; points.  The &lt;em&gt;conditional&lt;/em&gt;&#xA;symbol error probabilities given that each type of point is transmitted,&#xA;are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;P_e(\text{corner}) &amp;amp;= 2Q(x) - Q^2(x)\\&#xA;P_e(\text{edge}) &amp;amp;= 3Q(x) - 2Q^2(x)\\&#xA;P_e(\text{interior}) &amp;amp;= 4Q(x) - 4Q^2(x)\\&#xA;\end{align}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$Q(x)$&lt;/span&gt; is the complementary cumulative probability distribution function&#xA;of the standard Gaussian random variable. Combining these using the law of&#xA;total probability (with the assumption that all &lt;span class=&quot;math-container&quot;&gt;$2^{2n}$&lt;/span&gt; signals are equally&#xA;likely) gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_e\left(2^{2n}\text{-QAM}\right) = 4 \left[1 - 2^{-n}\right]Q(x) &#xA;- 4\left[1 - 2^{-n}\right]^2Q^2(x)$$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-QAM, where &lt;span class=&quot;math-container&quot;&gt;$n = 1$&lt;/span&gt; and all the constellation points are corner points, this reduces to&#xA;&lt;span class=&quot;math-container&quot;&gt;$P_e(4\text{-QAM}) = 2Q(x) - Q^2(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;(This added part is for those who like to cross their eyes and dot their teas)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;So where do the above formulas come from? Well, for corner points, a symbol error occurs if the transmitted corner point is mistaken for either of its two nearest (edge) neighbors (or for other constellation points even farther away than the nearest neighbor). These &lt;em&gt;independent&lt;/em&gt; events have probability &lt;span class=&quot;math-container&quot;&gt;$Q(x)$&lt;/span&gt; each, and using &lt;span class=&quot;math-container&quot;&gt;$$P(A\cup B) = P(A) + P(B) - P(A\cap B),$$&lt;/span&gt; we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_e(\text{corner}) = 2Q(x) - Q^2(x).$$&lt;/span&gt; An edge point has three nearest neighbors, two of which are either corner points or edge points and one of which is an interior point. Now we use&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\require{cancel}P(A\cup B\cup C)= P(A)+P(B)+P(C)-P(A\cap B)-\cancelto{0}{P(A\cap C)}-P(B\cap C) + \cancelto{o}{P(A\cap B\cap C)}$$&lt;/span&gt; and independence of &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; and of &lt;span class=&quot;math-container&quot;&gt;$B,C$&lt;/span&gt; to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_e(\text{edge}) = 3Q(x) - 2Q^2(x).$$&lt;/span&gt;&#xA;Finally, an interior point has four nearest neighbors, the events &amp;quot;symbol error in the I direction&amp;quot; and &amp;quot;symbol error in the Q direction&amp;quot; are independent events of probability &lt;span class=&quot;math-container&quot;&gt;$2Q(x)$&lt;/span&gt; each, and so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_e(\text{interior}) = 4Q(x) - 4Q^2(x).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2023-08-18T21:21:10.067" LastActivityDate="2023-08-18T21:21:10.067" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16002" PostTypeId="2" ParentId="15908" CreationDate="2014-05-03T03:32:37.023" Score="1" Body="&lt;ul&gt;&#xA;&lt;li&gt;Sylvain Paris and Frédo Durand 2006, A Fast Approximation of the Bilateral Filter using a Signal Processing Approach - Very well-articulated paperwork.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8777" LastActivityDate="2014-05-03T03:32:37.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16003" PostTypeId="1" CreationDate="2014-05-03T04:56:54.710" Score="3" ViewCount="386" Body="&lt;p&gt;What options exist for discrete audio compression that is good quality, moderate compression (e.g. 3+:1), and low complexity (e.g. hundreds of processing cycles to encode each sample without the use of floating point), especially ones that are not patent-encumbered? The specific application is ambient sound - vocal and nonvocal audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not very well-versed in this space of algorithms. I'm familiar with the high quality high compression algorithms, but even MP3 is too expensive for my purposes. The only low complexity moderate compression algorithm family I know is ADPCM, and I have no idea if any implementations of that could be considered good quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Relevant question: what is the highest quality fixed-point ADPCM algorithm?&lt;/p&gt;&#xA;" OwnerUserId="5592" LastEditorUserId="5592" LastEditDate="2014-05-03T22:55:21.200" LastActivityDate="2014-05-05T02:07:06.277" Title="Low-Complexity Audio Compression?" Tags="|audio|discrete-signals|compression|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16005" PostTypeId="1" CreationDate="2014-05-03T10:09:27.370" Score="8" ViewCount="664" Body="&lt;p&gt;I am developing an image processing algorithm / plugin for Fiji (ImageJ) that processes scanned microscope slide images (20x magnification) and extracts features from the slides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The slides contain histological tumor sections that are stained immunohistochemically with an antibody that identifies nuclei positive with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Ki-67_%28protein%29&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Ki-67 protein&quot;&gt;Ki-67 protein&lt;/a&gt;, along with a counter-stain that identifies all nuclei. The so called proliferation index, which measures how fast the cells are dividing, is then calculated as the ratio of positive-to-negative nuclei. For the feature extraction, I basically need to extract two color components from the RGB image; the one corresponding to the positive nuclei (diaminobenzidine; brown color) and the other corresponding the negative cells (methyl green; light green color).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Fiji's Color Deconvolution plugin (&lt;a href=&quot;http://www.mecourse.com/landinig/software/cdeconv/cdeconv.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mecourse.com/landinig/software/cdeconv/cdeconv.html&lt;/a&gt;) for separating the two stains. This works remarkably well, except when the slide has been drawn onto with a marker pen. Pathologists sometimes mark regions of interest on the slide with a marker pen so that it would be easier to inspect the slide later on. My data set contains slides that have been drawn onto with a red/blue/green or a black marker. The problem is that the presence of colors other than the two stains fails the color deconvolution algorithm totally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wEqQ0.jpg&quot; alt=&quot;An example of an artifact from a black marker pen&quot;&gt; Above is an example of a slide at 20x magnification showing the edge of a line drawn with a black marker pen on the top-half of the image. The lower part of the image shows the brown positive nuclei and the light green negative nuclei.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any chance for filtering out these marker pen artifacts? The effect is similar to looking through a welder's mask, and I'd wan't to somehow subtract the mask from the image. If I can't filter out the marker, I'll probably just need to manually crop out the portions having these artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've given high-pass filtering a try as suggested by Aaron. I used ImageJ's &lt;a href=&quot;http://imagejdocu.tudor.lu/doku.php?id=plugin:filter:highpass_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;High-pass filter plugin&lt;/a&gt;, which creates a Gaussian blurred image from the source and then subtracts this blurred image from the original. The image is here (the radius / blur length or standard deviation of the Gaussian used was 20 pixels):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cbrWJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The artifact is almost gone and the nuclei are still recognizable, which is nice. The yellowish background color in the original (due to a calibration problem with the scanner) is also gone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd also like to understand how this works. :) What does the Gaussian do to the RGB values of each pixel? How should I select the pixel radius for the Gaussian? Wikipedia's &lt;a href=&quot;http://en.wikipedia.org/wiki/Gaussian_blur&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian Blur article&lt;/a&gt; wasn't all that clear to me. Are there other ways for implementing a high-pass filter for image data?&lt;/p&gt;&#xA;" OwnerUserId="8780" LastEditorUserId="8780" LastEditDate="2014-05-05T23:09:26.367" LastActivityDate="2022-01-30T12:44:40.103" Title="Removing marker pen artifacts from scanned microscope slide images" Tags="|image-processing|filters|image-segmentation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16006" PostTypeId="1" CreationDate="2014-05-03T11:45:08.597" Score="1" ViewCount="84" Body="&lt;p&gt;write an m-file that will take the&quot;cameraman&quot; and produce a image quality or difference matrix for spectral selection method.The image properties are a sfollowings:&#xA;For spectral selection:&#xA;image1:DC coefficiant only&#xA;Image 2:first A/2 coefficiant including DC,where is the number of coefficiants prior to the EOB symbol.&#xA;All non-zero(A) coefficients including DC&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my homework.I do not want to give me the ecaxt answer,but please can u give me any idea or link where might be related and helpful in finding the answer.&#xA;sound really tough to me.&#xA;cheers&lt;/p&gt;&#xA;" OwnerUserId="8699" LastEditorUserId="128" LastEditDate="2019-10-27T14:12:54.753" LastActivityDate="2019-10-27T14:12:54.753" Title="Image Compression (JPEG) - Show the Effect of Number of Coefficients on Quality" Tags="|matlab|image-processing|homework|image-compression|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16007" PostTypeId="2" ParentId="16003" CreationDate="2014-05-03T13:45:42.717" Score="1" Body="&lt;p&gt;SBC was specifically created for this purpose. See &lt;a href=&quot;http://en.wikipedia.org/wiki/SBC_%28codec%29&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/SBC_(codec)&lt;/a&gt;. I don't know what the current legal situation is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other alternatives depend on your application: what is your target bandwidth and what type of artifacts and errors can you tolerate and which ones not.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-05-03T13:45:42.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16008" PostTypeId="1" CreationDate="2014-05-03T16:34:32.453" Score="0" ViewCount="41" Body="&lt;p&gt;Iam having 1 min video.I need to cut the video into 5 segments depending on changing background.Please suggest me good algorithm which can be easily implemented in matlab.Please provide me helpful links.&lt;/p&gt;&#xA;" OwnerUserId="8709" LastActivityDate="2014-05-03T16:34:32.453" Title="Please suggest me good algorithm for video segmentation based on changing background?" Tags="|image-processing|image-segmentation|video-processing|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16009" PostTypeId="1" CreationDate="2014-05-03T19:19:24.303" Score="1" ViewCount="109" Body="&lt;p&gt;Inspired by the talk &lt;a href=&quot;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&quot; rel=&quot;nofollow&quot;&gt;&quot;You and Your Research&quot;&lt;/a&gt; by Richard Hamming, I started wondering what are the important research topics on signal processing nowadays. Certainly an extensive list of topics would not be easy to find. I do not know the trending topics, for example, on Circuits and Systems, but I could imagine it for biomedical engineering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in your opinion, what are some interesting research topics nowadays on signal processing? I could start with compressive sensing and tensor models.&lt;/p&gt;&#xA;" OwnerUserId="8735" LastEditorUserId="8735" LastEditDate="2014-05-04T19:35:54.667" LastActivityDate="2014-05-04T19:35:54.667" Title="Research on signal processing" Tags="|discrete-signals|" AnswerCount="0" CommentCount="2" ClosedDate="2014-05-04T12:58:52.380" ContentLicense="CC BY-SA 3.0" />
  <row Id="16010" PostTypeId="1" CreationDate="2014-05-03T19:37:41.510" Score="0" ViewCount="422" Body="&lt;p&gt;Is baseline wander in ecg is low frequecny noise in ecg and power line interference is high frequency noise in ecg? Is both the artifacts present in EMG signal?&lt;/p&gt;&#xA;" OwnerUserId="8783" LastEditorUserId="47790" LastEditDate="2020-04-02T12:08:51.253" LastActivityDate="2020-04-02T12:08:51.253" Title="Low frequency and high frequency noise of ecg" Tags="|signal-detection|ecg|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16011" PostTypeId="2" ParentId="16010" CreationDate="2014-05-03T22:27:53.100" Score="1" Body="&lt;p&gt;The frequency content of baseline wander is usually in the range below 0.5 Hz, while power line noise is somewhere around 50/60 Hz accompanied by some harmonics.&lt;/p&gt;&#xA;" OwnerUserId="8735" LastActivityDate="2014-05-03T22:27:53.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16015" PostTypeId="1" AcceptedAnswerId="16017" CreationDate="2014-05-04T07:23:29.770" Score="2" ViewCount="632" Body="&lt;p&gt;I have a functioning DTMF program. It takes a larger signal and breaks it up into many small components, then analyzes each segment with an FFT to determine if the magnitude of the response for a particular &quot;bin&quot;, corresponding to a specific frequency, is present, thereby indicating that the number which is respresented by that frequency has been pressed, straight forward enough, but I want to implement the Goertzel Algorithm of the library jmathstudio and I can't quite figure out how to go about searching for the frequency I want. the documentation says this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4JvYu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I construct the bins like this, the term '200' is dictated by the fact that my FFT is currently of size 400, and 2000 is determined by the fact that the sample rate is 4000.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int sixNineSeven = (int)(697.0*200/2000);&#xA;int sevenSevenZero = (int)(770.0*200/2000);&#xA;int eightFiveTwo = (int)(852.0*200/2000);&#xA;int nineFourOne = (int)(941.0*200/2000);&#xA;&#xA;int twelveZeroNine = (int)(1209.0*200/2000);&#xA;int thirteenThirtySix = (int)(1336.0*200/2000);&#xA;int fourteenSeventySeven = (int)(1477.0*200/2000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess the main thing I need to do is this step:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalized frequency in the range [0,1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But does that mean that I can totally ignore the sample frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose I would be doing this Geortzel operation in lieu of an FFT, so should I just search for this normalized frequency in each of the small segments?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   Complex coeff = su.goertzelFrequencyAnalysis(new Vector(c), (float)(1/697));&#xA;&#xA;   System.out.println(&quot;coeff &quot;+coeff);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My output is just a bunch of garbage like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   coeff org.JMathStudio.DataStructure.Complex@5e228a02&#xA;   coeff org.JMathStudio.DataStructure.Complex@7bd63e39&#xA;   coeff org.JMathStudio.DataStructure.Complex@2e8f4fb3&#xA;   coeff org.JMathStudio.DataStructure.Complex@42b988a6&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user8769" LastActivityDate="2014-05-04T09:50:36.880" Title="What is 'Normalized frequency in the range [0,1)', à la DTMF &amp; Goertzel algorithm" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16016" PostTypeId="1" CreationDate="2014-05-04T08:51:54.180" Score="4" ViewCount="749" Body="&lt;p&gt;I am new to signal processing, so sorry if the question is superbanal. I have been spending more days than I would admit on this and can't find the error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two triangle waves that are emitted from loudspeakers and M sensor in a linear uniform array. I need to estimate the delays of the single wave in the single sensor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went through the math and understand I have to use the correlation, but when I implement it in Matlab I clearly do some mistakes and get a correlation that has only one peak, in the center (in time) of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think I can add pictures because I have no reputation on this SO, I hope the question is clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Apparently I can, so this is the delay per sensor &lt;img src=&quot;https://i.stack.imgur.com/5I6YU.jpg&quot; alt=&quot;delay per sensor&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab I basicly do &lt;code&gt;xcorr(X(:,sensor),temp)&lt;/code&gt;, where &lt;code&gt;X(:,sensor)&lt;/code&gt; is the signal received in a sensor, that is the signal received from the two sources plus a small gaussian error and &lt;code&gt;temp&lt;/code&gt; is the triangle signal emitted by both sources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does the crosscorrelation have only one peak and not two?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: full code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;clc&#xA;% close all&#xA;%dati&#xA;v=350;%metri/sec&#xA;xa=1; %metri&#xA;ya=8;&#xA;xb=9;&#xA;yb=8;&#xA;spazio=0.25;%spazio intra sensori&#xA;spt=12.5*10^-3;%secondi &#xA;M=41;&#xA;&#xA;%ipotesi&#xA;sig=1/10;&#xA;&#xA;&#xA;%distanze trasmettitore/microfoni&#xA;indic_min_dista=xa/spazio+1;%5&#xA;indic_min_distb=xb/spazio+1;%37&#xA;&#xA;da=zeros(M,1); %vettore delle distanze&#xA;for i=(indic_min_dista):M&#xA;    da(i)=sqrt(ya^2+(spazio*(i-indic_min_dista))^2);&#xA;end&#xA;&#xA;for i=1:(indic_min_dista -1)&#xA;    da(i)=sqrt(ya^2+(spazio*(indic_min_dista-i))^2);&#xA;end&#xA;&#xA;db=zeros(M,1); %vettore delle distanze&#xA;for i=(indic_min_distb):M&#xA;    db(i)=sqrt(yb^2+(spazio*(i-indic_min_distb))^2);&#xA;end&#xA;&#xA;for i=1:(indic_min_distb -1)&#xA;    db(i)=sqrt(yb^2+(spazio*(indic_min_distb-i))^2);&#xA;end&#xA;%tempo trasmettitore/microfoni&#xA;&#xA;ta=zeros(M,1); %vettore dei tempi&#xA;for i=1:M&#xA;    ta(i)=da(i)/v;&#xA;end&#xA;&#xA;tb=zeros(M,1); %vettore dei tempi&#xA;for i=1:M&#xA;    tb(i)=db(i)/v;&#xA;end&#xA;% ta-(fliplr(tb'))'==0 i tempi sono = se letti dagli estremi opposti&#xA;%vettore dei tempi di campionamento&#xA;&#xA;win=10^-3;%secondi &#xA;N=ceil((max(ta)+2*spt)/win)+1;&#xA;% N=ceil((max(tb)+2*spt)/win)+1; sono = la situazione è del ttt simmetrica&#xA;&#xA;samples=zeros(N,1);&#xA;for i=0:(N-1)&#xA;    samples(i+1)=-spt + win*(i);&#xA;end&#xA;rit=+spt+samples;&#xA;&#xA;%segnale inviato&#xA;S=zeros(N,M);&#xA;temp=zeros(N,1);&#xA;for i =0:(N-1)&#xA;    for j=1:M&#xA;&#xA;&#xA;        if((samples(i+1)&amp;gt;ta(j)-spt) &amp;amp;&amp;amp; (samples(i+1)&amp;lt;=ta(j)))&#xA;            S(i+1,j)=S(i+1,j)+1-abs(samples(i+1)-ta(j))/spt;&#xA;            if(j==1)&#xA;            temp(i+1)=+1-abs(samples(i+1)-ta(j))/spt;&#xA;            end&#xA;        end&#xA;&#xA;        if((samples(i+1)&amp;gt;tb(j)-spt) &amp;amp;&amp;amp; (samples(i+1)&amp;lt;=tb(j)))&#xA;            S(i+1,j)=S(i+1,j)+1-abs(samples(i+1)-tb(j))/spt;&#xA;        end&#xA;&#xA;        if((samples(i+1)&amp;gt;ta(j)) &amp;amp;&amp;amp; (samples(i+1)&amp;lt;=ta(j)+spt))&#xA;            S(i+1,j)=S(i+1,j)+1-abs(samples(i+1)-ta(j))/spt;&#xA;            if(j==1)&#xA;            temp(i+1)=+1-abs(samples(i+1)-ta(j))/spt;&#xA;            end&#xA;        end&#xA;&#xA;        if((samples(i+1)&amp;gt;tb(j)) &amp;amp;&amp;amp; (samples(i+1)&amp;lt;=tb(j)+spt))&#xA;            S(i+1,j)=S(i+1,j)+1-abs(samples(i+1)-tb(j))/spt;&#xA;        end        &#xA;    end&#xA;end&#xA;&#xA;figure&#xA;imagesc(0:41,rit,S)&#xA;xlabel('Sensori');%\sigma^2_\omega&#xA;ylabel('Ritardo [s]');&#xA;&#xA;&#xA;W=zeros(N,M);&#xA;&#xA;&#xA;%costruisco W&#xA;for i =1:N&#xA;    for j=1:M&#xA;        W(i,j)=normrnd(0,sig);&#xA;    end&#xA;end&#xA;&#xA;&#xA;X=W+S;&#xA;&#xA;%vettore che uso per calcolo correlazioni&#xA;vv=find(temp~=0);&#xA;temp=temp(min(vv): max(vv));&#xA;&#xA;&#xA;%%&#xA;figure&#xA;imagesc(0:41,rit,X)&#xA;xlabel('Sensori');%\sigma^2_\omega&#xA;ylabel('Ritardo [s]');&#xA;figure&#xA;surf(S)&#xA;set(gca,'xlim',[0 41])&#xA;xlabel('Sensori'), ylabel('Ritardo [s]');&#xA;&#xA;% ticklabels = get(gca,'YTickLabel');&#xA;newTicklabels = rit;%[ticklabels(2:end,:);'60'];&#xA;set(gca,'YTickLabel',newTicklabels);&#xA;&#xA;figure&#xA;surf(X)&#xA;xlabel('Sensori'), ylabel('Ritardo [s]');&#xA;&#xA;% ticklabels = get(gca,'YTickLabel');&#xA;newTicklabels = rit;%[ticklabels(2:end,:);'60'];&#xA;set(gca,'YTickLabel',newTicklabels);&#xA;set(gca,'xlim',[0 41])&#xA;set(gca,'zlim',[0 2])&#xA;&#xA;%%&#xA;clc&#xA;% close all&#xA;% Stima ritardo per ogni sensore, in funzione di sigma^2&#xA;% valuta MSE cfr CRB almeno m=10 e y=5m,&#xA;&#xA;sig=1/100;%[1/10 1/5 1/2];&#xA;Nrun=100;&#xA;%segnale vero S(:,41)&#xA;%segnale registrato X(:,41)&#xA;MSEA=zeros(M,length(sig));&#xA;MSEB=zeros(M,length(sig));&#xA;mediaA=zeros(M,length(sig));&#xA;mediaB=zeros(M,length(sig));&#xA;&#xA;W=zeros(N,M);&#xA;psi=(-N:N)*win;%mi serve per valutare phi nella differenza tra i tau&#xA;&#xA;for nrun=1:Nrun&#xA;        ia =zeros(length(sig),M); %indici del massimo della funzione di correlazione&#xA;        ib =zeros(length(sig),M); %indici del massimo della funzione di correlazione&#xA;        for k=1:length(sig)&#xA;            %costruisco W&#xA;            for i =1:N&#xA;                for j=1:M&#xA;                    W(i,j)=normrnd(0,sig(k));&#xA;                end&#xA;            end&#xA;            X=W+S;&#xA;            for sensor=41:41&#xA;                phisx=zeros(N+1,1);&#xA;                phiss=zeros(length(psi),1);%N*2+1&#xA;                    corrtemp=xcorr(X(:,sensor),temp);&#xA;                    figure&#xA;                    plot(corrtemp)&#xA;            end&#xA;        end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT comparison of the received signal in two sensor (one on the side the blue one) and the central one (green line), the red line corresponds to the original triangle wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rN0aT.jpg&quot; alt=&quot;comparison&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT Correlation between triangle wave and received signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cy9qy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In response to the question, this is the hardware positioning. Please remember I am not an art major :D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WyTgG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8788" LastEditorUserId="8788" LastEditDate="2014-05-05T16:15:40.930" LastActivityDate="2022-04-16T03:07:50.673" Title="DOA estimation 2 sources time delay estimation uniform array" Tags="|matlab|cross-correlation|estimation|peak-detection|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="16017" PostTypeId="2" ParentId="16015" CreationDate="2014-05-04T08:51:59.160" Score="3" Body="&lt;p&gt;The normalized frequency '1' corresponds to the Nyquist frequency, i.e. half the sampling frequency. So the normalized frequencies $w$ are obtained from the frequencies $f$ in Hz by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w=\frac{2f}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency (in Hz) corresponding to a certain bin $i$ ($0\le i\le N-1$) of an FFT with length $N$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i=\frac{if_s}{N}\quad i=0,1,\ldots,N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For real-valued signals, the bins $i=N/2+1$ (assuming $N$ is even) to $i=N-1$ are redundant.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-05-04T09:50:36.880" LastActivityDate="2014-05-04T09:50:36.880" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="16018" PostTypeId="1" CreationDate="2014-05-04T12:57:32.403" Score="1" ViewCount="1299" Body="&lt;p&gt;I'm currently collating images to try and develop a HAAR classifier using the OpenCV traincascade functionality. The objects I want to detect are small and numerous (bees), and I'm curious as to whether it would be better to train the image with lots of small cutouts of the bees as positive images, or to use bigger positive images with the bees present along with a chunk of the background.&lt;/p&gt;&#xA;" OwnerUserId="8615" LastActivityDate="2015-02-28T22:52:06.630" Title="OpenCV Haar Classifier - best type of positive images" Tags="|opencv|object-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16019" PostTypeId="2" ParentId="16018" CreationDate="2014-05-04T17:39:30.350" Score="1" Body="&lt;p&gt;You probably want to train on as tightly cropped rectangular region around the bee as possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if you already thought of this but you should remember that this classifier can only handle recognizing objects in rectangles whose axes are aligned with image, i.e. no rotated rectangles. This is going to be tricky if the bees can be facing any which way. A human face detector has the advantage that faces are almost always found right side up in the image. If you wanted to recognize upside down faces too you would probably train only on right side up images and then check your input image twice--once with the original input and once with it flipped upside down. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably want to do something similar for the bees. All of your training images should be aligned so that the bee has approximately same orientation and scale. Then if you want to detect different orientations you can rotate your input image.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-05-04T17:39:30.350" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16022" PostTypeId="2" ParentId="15955" CreationDate="2014-05-04T20:02:10.243" Score="0" Body="&lt;p&gt;$y = 1 - \sqrt{1 - x^2}\space\space\text{for}\space x \in [-1,1]$ under a rectangular window is rippleless. The derivative of the transform has ripple, but the transform itself does not.&lt;/p&gt;&#xA;" OwnerUserId="7883" LastEditorUserId="7883" LastEditDate="2014-05-04T20:27:54.110" LastActivityDate="2014-05-04T20:27:54.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16024" PostTypeId="2" ParentId="16003" CreationDate="2014-05-05T00:13:58.420" Score="0" Body="&lt;p&gt;given that the data is audio sampled at 16 kHz and that the data is already &quot;reduced&quot; to 16-bit words, probably the simplest low-complexity compression would be to use Differential PCM (&quot;DPCM&quot; without the &quot;A&quot;) and apply Huffman coding (with a fixed code book) on the result of that.  the result is lossless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;lossly compression would be okay, except it requires analysis of the audio, which is not low complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DPCM is a simple special case of Linear Predictive Coding (LPC) which combines the previous samples of the signal to &lt;em&gt;predict&lt;/em&gt; the next sample, and then encode only the difference between the prediction and the actual sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let $x[n]$ be the audio samples.  with general LPC differential coding you linearly combine the previous $K$ samples to make a good guess at what the next sample will be:&#xA;$$ \hat{x}[n] = \sum_{k=1}^{K} a_k x[n-k] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the $a_k$ coefficients are somehow optimally chosen.  that's what LPC is about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with simple Delta modulation, $a_1 = 1$ and all other $a_k = 0$, so the guess for the next sample is simply the previous sample: $\hat{x}[n] = x[n-1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then, in the first step, you encode only the difference:&#xA;$$ d[n] = x[n] - \hat{x}[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;of course, you can reconstruct the signal from its previous values and the difference with&#xA;$$ x[n] = \hat{x}[n] + d[n] = \sum_{k=1}^{K} a_k x[n-k] + d[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note #1:&lt;/strong&gt; except for the simple Delta modulation, $\hat{x}[n]$ will likely have more bits than your original $x[n]$, so part of computing $\hat{x}[n]$ (for &lt;strong&gt;both&lt;/strong&gt; encoding and decoding) will include rounding to the nearest 16-bit value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, why do this?  the reason is that the difference signal $d[n]$ will be a &lt;em&gt;smaller&lt;/em&gt;, lower-amplitude signal, if your prediction is good.  it's possible that a signed 8-bit word can represent that difference 90% of the time.  but even if there are the occasional difference value that exceeds the 8-bit range, there are a couple of different things you can do about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one is to &lt;strong&gt;Adapt&lt;/strong&gt; a gain or scaling value to that difference:&#xA;$$ d[n] = \frac{1}{g[m]} \left( x[n] - \hat{x}[n] \right) $$&#xA;$$ x[n] = \hat{x}[n] + g[m]d[n] = \sum_{k=1}^{K} a_k x[n-k] + g[m]d[n] $$&#xA;where $m \triangleq \mathrm{floor}(n/N) \ $  and $g[m] \ge 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so there are fewer $g[m]$ values to encode, one for every $N$ samples.  that's ADPCM.  this is slightly lossy if $g[m]$ ever exceeds 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another scheme (Huffman) is to encode the difference values $d[n]$ with fewer bits than 16 bits (on average) using a little bit of Shannon Information Theory.  this is lossless and is essentially what file compression programs like PKZIP did originally.  the idea is that values of $d[n]$ that are 0 or +1 or -1 or +2 or -2, etc., will appear far more often than differences like +65535 or -65535 (which would be &lt;em&gt;possible&lt;/em&gt;, just not likely, with 17-bit integer values of $d[n]$).  Huffman coding, which assigns fewer bits to the most common messages and more bits to the more rare messages, is another big topic that i will leave for later.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-05-05T02:07:06.277" LastActivityDate="2014-05-05T02:07:06.277" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16025" PostTypeId="2" ParentId="15974" CreationDate="2014-05-05T00:52:01.637" Score="0" Body="&lt;p&gt;You can reduce the aliases by doing a simple linear interpolation for the single sample where the phase accumulator wraps around. It won't completely eliminate the problem but it should help. Use the ratio of ( phase modulo max phase ) to the phase increment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bob&lt;/p&gt;&#xA;" OwnerUserId="7453" LastActivityDate="2014-05-05T00:52:01.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16026" PostTypeId="2" ParentId="15974" CreationDate="2014-05-05T02:27:05.360" Score="2" Body="&lt;p&gt;there are four ways i know of to create bandlimited waveforms that approximate or sound like classic analog waveforms (that are not bandlimited much until they hit the loudspeaker).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;the BLIT and BLEP methods.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;additive synthesis with a limit on the harmonics.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;wavetable synthesis with interpolation between wavetables.  (this is what i would recommend.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;deriving the functional definition of a mostly bandlimited waveform and implementing that mathematical function.  like what might a simple filtered version of the square wave or sawtooth wave look like in the time domain?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;remember, when harmonics fold over and become inharmonic aliases, you want to avoid that, but you might be able to tolerate a little bit of that, so to make your life easier.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-05-05T02:27:05.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16028" PostTypeId="1" AcceptedAnswerId="16031" CreationDate="2014-05-05T12:15:30.990" Score="0" ViewCount="66" Body="&lt;p&gt;I was looking at the filters, and the ones for 1st derivatives, gradient &lt;a href=&quot;http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter#Tables_of_selected_convolution_coefficients&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter#Tables_of_selected_convolution_coefficients&lt;/a&gt;&lt;br&gt;&#xA;by testing the 9-points one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D=[-4;-3;-2;-1;0;1;2;3;4]/60;&#xA;y=sin((0:0.2:6)');&#xA;yd = conv(D,y);&#xA;plot([repmat(0,128,1) y yd(5:end-4)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a9wS0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we see that actually &lt;code&gt;[4;3;2;1;0;-1;-2;-3;-4]/60&lt;/code&gt; would give the right signs, so why is it like that?&lt;/p&gt;&#xA;" OwnerUserId="5826" LastEditorUserId="5826" LastEditDate="2014-05-05T14:57:51.313" LastActivityDate="2014-05-05T16:00:30.693" Title="Why are polynomial filters for gradients in the opposite sign?" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16029" PostTypeId="1" CreationDate="2014-05-05T13:59:34.330" Score="1" ViewCount="732" Body="&lt;p&gt;I am trying to apply phase lock loop to calculate phase shift due to doppler effect and finally calculate the doppler frequency($\Delta f$). I am assuming that the received wave is of the form,&#xA;$r(t) =\cos(2\pi f0 + \phi) $&#xA;.The receiver in my setup is at rest and the source is moving at velocity of about 1m/s. But I am not observing the correct doppler shift (calculated using, $\Delta f = \frac{v}{c}f0 $).&#xA;To calculate $\Delta f$ from $\phi$ I am using &#xA;$\Delta f = \frac{1}{2\pi}\frac{d\phi}{dt}$&#xA;.I am testing using $f0=17kHz$ with sound. My low pass filter in PLL is a linear phase FIR filter with stopband and passband frequencies of 200Hz and 100Hz respectively. &#xA;What am I doing wrong? I want to reduce the passband of the filter to 10Hz but octave is giving an error 'insufficient extremals'. Currently I am getting a maximum $\Delta f$ of about 6Hz while it should be around 50Hz according to the above equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Just found out that amplifying/de-amplifying the signal before processing it is changing the $\phi$. Not sure why? Can anyone shed some light?&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="26777" LastEditDate="2017-02-24T06:44:03.170" LastActivityDate="2017-02-24T06:44:03.170" Title="Doppler shift using PLL" Tags="|frequency-spectrum|filter-design|frequency|phase|pll|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16030" PostTypeId="2" ParentId="16005" CreationDate="2014-05-05T15:00:17.943" Score="1" Body="&lt;p&gt;The image looks like it would be mostly bi-modal ( see &lt;a href=&quot;http://en.wikipedia.org/wiki/Otsu%27s_method&quot; rel=&quot;nofollow&quot;&gt;Otsu Method&lt;/a&gt;).  You may be able to segment it and then apply separate &lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_equalization&quot; rel=&quot;nofollow&quot;&gt;Histogram Equalizations&lt;/a&gt; to both segments separately then recombine the results in the same range of values.&lt;/p&gt;&#xA;" OwnerUserId="8606" LastActivityDate="2014-05-05T15:00:17.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16031" PostTypeId="2" ParentId="16028" CreationDate="2014-05-05T15:14:21.110" Score="1" Body="&lt;p&gt;If you look at the formula above the table you linked to, you see that the output values are computed like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y^{\prime}_j=\sum_{n=-4}^{4}D_ny_{j+n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab this could simply be implemented by a vector product (for one output value $Y^{\prime}_j$, where the vector $y$ contains the input values around the current index $j$):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yd = D'*y;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the other hand, convolution of these sequences is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y^{\prime}_j=\sum_{n=-4}^{4}D_ny_{j-n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(note the '-' sign in the index of $y_j$!). So if you want to use the 'conv()' function in Matlab, you need to flip the coefficients in the vector $D$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-05-05T16:00:30.693" LastActivityDate="2014-05-05T16:00:30.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16032" PostTypeId="1" CreationDate="2014-05-05T15:21:28.190" Score="6" ViewCount="346" Body="&lt;p&gt;I'm currently working on implementing an efficient method to segment an organ on 3D CT images.&#xA;I used an algorithm (SLIC) to generate superpixels on each slice of my CT 3D matrix. The process is similar to the k-means algorithm although we do not need to visit the entire image for each pixel. &#xA;Then I build a graph based on the superpixel: each superpixel is a node in the graph and two nodes are connected if they contains pixels that are 4-adjacent. &#xA;The weight of the edge between two nodes is their color difference: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \sqrt {(color1 - color2)² }$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then tried to implement a method to allow the user to click on a superpixel and label it as foreground or background starting a diffusion algorithm to divide the 3D graph between the two labels. I used the &lt;a href=&quot;http://sibgrapi.sid.inpe.br/rep/sid.inpe.br/sibgrapi/2013/07.04.21.42&quot; rel=&quot;nofollow noreferrer&quot;&gt;IFT algorithm&lt;/a&gt; &#xA;However it doesn't perform as well as I want: sometime assigning a label or correcting an incorrectly deduced label will cause the algorithm to select improper superpixel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps I used: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Convert my matrix in 8 bits greyscale (between 0 and  255 value).&lt;/li&gt;&#xA;&lt;li&gt;Each pixel which value isn't between low_value and high_value is put to 0 (black).&lt;/li&gt;&#xA;&lt;li&gt;I do an histogram equalization to increase the contrast of the remaining values (thus trying to achieve better superpixel boundaries).&lt;/li&gt;&#xA;&lt;li&gt;Apply a blurring kernel to my matrix.&lt;/li&gt;&#xA;&lt;li&gt;Compute superpixels for each slice.&lt;/li&gt;&#xA;&lt;li&gt;Creating the corresponding graph and creating the edges between them.&lt;/li&gt;&#xA;&lt;li&gt;The user clicks with the foreground label (every superpixel is set to foreground).&lt;/li&gt;&#xA;&lt;li&gt;A click with the background label allows some superpixels to be set to background. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I sometime achieve quite satisfying results.&#xA;But some clicks may completely destroy the correct graph labeling even though they should have worked. &#xA;I have put a small illustrated example in the following &lt;a href=&quot;https://i.stack.imgur.com/oH1OE.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;imgur album&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my concerns and questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is the IFT algorithm suitable for 3D? I don't see reason why not but my example shows that maybe there label leakage through previous/next slices.&lt;/li&gt;&#xA;&lt;li&gt;What kind of preprocessing step can improve the diffusion. &lt;/li&gt;&#xA;&lt;li&gt;I thought about using dijkstra algorithm to determine which seed was closer to a certain superpixel. It didn't work so well : could it achieve what I want with the correct color distance function?&lt;/li&gt;&#xA;&lt;li&gt;Do you have any advice or article which may help me?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you and sorry if I was not clear, english isn't my first language.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="7092" LastEditDate="2015-03-11T19:54:52.610" LastActivityDate="2018-08-24T00:01:02.593" Title="Improving segmentation diffusion" Tags="|image-processing|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16033" PostTypeId="1" CreationDate="2014-05-05T15:34:01.563" Score="1" ViewCount="1164" Body="&lt;p&gt;I'm trying to fuse different images of the same scene which each image have a different focus. I've been told that first I have to perform an image registration to the images.&#xA;Right now, the result from the registration has errors, which can be seen by &quot;aura&quot; around the objects in the images and shrinking the image edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I'm trying to register images with focuses that their distance is big, I'm getting a result images with much more significant errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the following code (using the Accord library):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; class Registration&#xA;{&#xA;private List&amp;lt;Image&amp;lt;Bgr, Byte&amp;gt;&amp;gt; myOriginalImages;&#xA;private List&amp;lt;Bitmap&amp;gt; registratedImages = new List&amp;lt;Bitmap&amp;gt;();&#xA;&#xA;public Registration(List&amp;lt;Image&amp;lt;Bgr, Byte&amp;gt;&amp;gt; myOriginalImages)&#xA;{&#xA;    this.myOriginalImages = myOriginalImages;&#xA;}&#xA;&#xA;public List&amp;lt;Bitmap&amp;gt; getRegistratedImages()&#xA;{&#xA;    return registratedImages;&#xA;}&#xA;public void Run()&#xA;{&#xA;    int numOfTargetImages = myOriginalImages.Count - 1;&#xA;    SpeededUpRobustFeaturePoint[] surfPoints1;&#xA;    SpeededUpRobustFeaturePoint[] surfPoints2;&#xA;    IntPoint[] correlationPoints1;&#xA;    IntPoint[] correlationPoints2;&#xA;    MatrixH homography;&#xA;    Bitmap registratedImage;&#xA;&#xA;    // first image is the model image - no registration required&#xA;    registratedImages.Add(myOriginalImages.ElementAt(0).ToBitmap());&#xA;    Bitmap modelImage = registratedImages.ElementAt(0);&#xA;&#xA;    // create the registrated images&#xA;    for (int i = 1; i &amp;lt;= numOfTargetImages; i++)&#xA;    {&#xA;        ExtractFeatures(modelImage, myOriginalImages.ElementAt(i).ToBitmap(), out surfPoints1, out surfPoints2);&#xA;        MatchFeatures(surfPoints1, surfPoints2, out correlationPoints1, out correlationPoints2);&#xA;        homography = RANSAC(correlationPoints1, correlationPoints2);&#xA;        registratedImage = CreateRegisteredImage(modelImage, myOriginalImages.ElementAt(i).ToBitmap(), homography);&#xA;&#xA;        registratedImages.Add(registratedImage);&#xA;    }&#xA;}&#xA;private void ExtractFeatures(Bitmap img1, Bitmap img2, out SpeededUpRobustFeaturePoint[] surfPoints1, out SpeededUpRobustFeaturePoint[] surfPoints2)&#xA;{// extract features using SURF detector&#xA;    SpeededUpRobustFeaturesDetector surf = new SpeededUpRobustFeaturesDetector();&#xA;&#xA;    surfPoints1 = surf.ProcessImage(img1).ToArray();&#xA;    surfPoints2 = surf.ProcessImage(img2).ToArray();&#xA;}&#xA;&#xA;private void MatchFeatures(SpeededUpRobustFeaturePoint[] surfPoints1, SpeededUpRobustFeaturePoint[] surfPoints2, out IntPoint[] correlationPoints1, out IntPoint[] correlationPoints2)&#xA;{// match the features between the images by using correlation&#xA;    KNearestNeighborMatching matcher = new KNearestNeighborMatching(5);&#xA;    IntPoint[][] matches = matcher.Match(surfPoints1, surfPoints2);&#xA;&#xA;    correlationPoints1 = matches[0];&#xA;    correlationPoints2 = matches[1];&#xA;}&#xA;&#xA;private MatrixH RANSAC(IntPoint[] correlationPoints1, IntPoint[] correlationPoints2)&#xA;{&#xA;    RansacHomographyEstimator ransac = new RansacHomographyEstimator(0.001, 0.99);&#xA;    MatrixH homography = ransac.Estimate(correlationPoints1, correlationPoints2);&#xA;&#xA;    return homography;&#xA;}&#xA;&#xA;private Bitmap CreateRegisteredImage(Bitmap img1, Bitmap img2, MatrixH homography)&#xA;{&#xA;    Blend blend = new Blend(homography, img1);&#xA;    return blend.Apply(img2);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm getting the following images: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/njH7d.jpg&quot; alt=&quot;Result Image with closer focuses&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample images were taken from HeliconFocus for homework&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rtCbh.jpg&quot; alt=&quot;Result image with far focuses&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5665" LastActivityDate="2014-05-05T15:34:01.563" Title="Image Registration C#" Tags="|image-processing|c#|image-registration|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16034" PostTypeId="1" CreationDate="2014-05-05T18:24:34.477" Score="1" ViewCount="81" Body="&lt;p&gt;Can someone explain me how are the different frequency bands useful for detecting bearing faults using resonance demodulation?&lt;/p&gt;&#xA;" OwnerUserId="8085" LastActivityDate="2014-05-05T23:07:31.797" Title="resonance demodulation for bearing faults" Tags="|frequency|demodulation|" AnswerCount="1" CommentCount="0" ClosedDate="2014-05-13T04:02:38.213" ContentLicense="CC BY-SA 3.0" />
  <row Id="16035" PostTypeId="2" ParentId="16032" CreationDate="2014-05-05T21:21:26.760" Score="1" Body="&lt;p&gt;In your images, it seems regions are defined more by their edge boundaries rather than their colour. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the IFT is using a colour difference metric then it doesn't see much difference between some foreground and background super pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of colour difference I would try a different metric based on boundary edge strength.   For example, the weight of the edge between two nodes is set to the average edge strength along their shared super pixel boundary. You might need to define a minimum boundary length though, such as 20 pixels, otherwise noise can effect this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used this measurement before to combine segmentation regions and it works well. Interestingly, I was getting the segmentations using the IFT on a per pixel basis. This method you are applying looks interesting!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also combine the two measurements.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-05-05T21:21:26.760" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16036" PostTypeId="2" ParentId="16034" CreationDate="2014-05-05T23:07:31.797" Score="1" Body="&lt;p&gt;This &lt;a href=&quot;http://www.sem.org/PDF/Bearings_and_gearbox_diagnostics.pdf&quot; rel=&quot;nofollow&quot;&gt;presentation&lt;/a&gt; has a pretty good overview of characterizing bearing faults. In essence, once the measured frequency content does not match what is considered a good response from a bearing, it can be flagged as faulty or nearing fault.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-05-05T23:07:31.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16037" PostTypeId="1" AcceptedAnswerId="16041" CreationDate="2014-05-06T02:12:20.857" Score="1" ViewCount="1294" Body="&lt;p&gt;I would like to create a Band Limited Table Lookup Oscillator that functions much like the &lt;code&gt;sin()&lt;/code&gt; function in C++ works where i would inout a phase value and receive a sample value. for example &lt;code&gt;Sample s = saw(x);&lt;/code&gt; or &lt;code&gt;Sample s = square(x);&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fill the table I would first generate an oversampled table by a factor of &quot;X&quot; that contains the wave in a non band limited state. Then I would run the table through a filter of some sort FIR or IIR most likely. Then i would decimate the table by a factor of &quot;X&quot; and hopefully then have a table that i could read from that would produce a band limited signal. I would also have to interpolate across the table to ensure that all phase angles will be accommodated for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if this theory would work? Meaning would this produce a signal that is Band limited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will mock up the basic code below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double saw(double phase){&#xA;    return interpolate(phase);//i know this is incomplete&#xA;}&#xA;&#xA;double fillTable(){&#xA;    double table[size*oversampling];&#xA;&#xA;    //fill table here. skipping for length of example&#xA;&#xA;    for(int i =0;i&amp;lt;tableSize;++i){&#xA;        table[i]=filter(table[i]);&#xA;    }&#xA;    double table2[size];&#xA;    int x=0;&#xA;    for(int i =0;i&amp;lt;tableSize;++i){&#xA;        table2[i]=table[x];&#xA;        x+=oversampling;&#xA;    }&#xA;}&#xA;&#xA;//usage&#xA;sample x = saw(phase);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know the code is incomplete and syntactically incorrect but i just wanted to give an example of what i would like to be able to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So again. Will this be Band limited?&lt;/p&gt;&#xA;" OwnerUserId="8658" LastActivityDate="2014-05-06T07:48:48.460" Title="Band Limited Table Look Up Oscillator C++" Tags="|filtering|wave|oscillator|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16038" PostTypeId="2" ParentId="16037" CreationDate="2014-05-06T02:31:25.927" Score="1" Body="&lt;p&gt;Note that if the function with which you fill the table has spectral content at or above the Nyquist frequency for even the longer table length, then there may be (likely will be) aliasing noise that subsequent low pass filtering will not remove.  Perhaps a lesser amount of aliasing noise than with just using a shorter table, but this depends on the table filling function used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you plan on using this table to produce a periodic oscillation, you will have to wrap the filtering around the table circularly to account for the impulse response of the low pass filter crossing period boundaries, or else you will end up with filter truncation noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better approach might be to calculate the Fourier coefficients of the periodic function with which you plan of filling the table, and use those coefficients to synthesize the table by summing just those sinusoidal components (exactly periodic in the table length) that fall below the Nyquist frequency for the table length.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-06T02:31:25.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16039" PostTypeId="1" CreationDate="2014-05-06T06:45:32.953" Score="0" ViewCount="319" Body="&lt;p&gt;i have a legacy processed audio wav file. Another UN-processed copy of the source is processed by my algorithm. From both processsing blocks i get processed wav files as output. Now i want to do null tests, because i read (will soon quote the reference) null tests are suitable for objective loudness comparision. So &lt;code&gt;merely sutracting&lt;/code&gt; is enough?? But merely subtracting is not working. I see high of difference value. So what other parameters should be considered for null-testing!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;wav file descriptions: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source : 16 bit pcm ,48Khz sampled,32 Seconds length&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output : Both 24 bit,48Khz sampled,32 Seconds length&lt;/p&gt;&#xA;" OwnerUserId="7868" LastActivityDate="2014-05-06T06:45:32.953" Title="Comparing two wav in matlab using NullTest" Tags="|matlab|audio|signal-analysis|reference-request|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16040" PostTypeId="1" CreationDate="2014-05-06T07:24:16.313" Score="0" ViewCount="137" Body="&lt;p&gt;Suppose that we have the following model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = A_1\sin(\omega_1 t+\phi_1) + A_2\sin(\omega_2 t+\phi_2) + ... + A_p\sin(\omega_p t+\phi_p) + z(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is not related to how to determine the number of components, but I am interested in the maximum. For example, let us assume that we have sampled this model and get sample with size let's say $294$, the question arises what can be the maximum number of components? For instance, can it be more then $147$? or more then half the size of the signal sample? Or can it be in general something $20-50$, for instance? I am not expecting an exact number, but a possible maximum number which can be in this case.&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="1606" LastEditDate="2014-05-06T08:40:15.633" LastActivityDate="2014-08-05T23:38:43.677" Title="number of possible component in sinusoidal model" Tags="|signal-analysis|random|analytic-signal|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="16041" PostTypeId="2" ParentId="16037" CreationDate="2014-05-06T07:48:48.460" Score="3" Body="&lt;p&gt;Please note that you cannot implement a band-limited oscillator with a pure (stateless) function like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sample s = saw(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason is that the function must be aware of the rate at which x change to generate a signal with the correct bandwidth&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let us assume your sample rate is 48kHz. If you call your function in this order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;saw(0.00000000);&#xA;saw(0.00000001);&#xA;saw(0.00000002);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see that the argument is slowly changing to the point that aliasing is not an issue, so your function could return something like &lt;code&gt;x / M_PI - 1&lt;/code&gt; (assuming input is in [0, 2 pi[ ; and output in [-1, 1]) without any lookup table. But now, if you call it this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;saw(0.0);&#xA;saw(3.0);&#xA;saw(6.0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We are getting close to Nyquist frequency and the output must then be heavily band-limited - actually closer to &lt;code&gt;sin&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a band-limited sawtooth or square cannot be generated by mere waveshaping of the naive saw. You need your function to be aware of the target frequency so that it can make the right decision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another related misconception that can be found in your code is that you assume that you would need only one table. There is just not one single &quot;band-limited sawtooth&quot; waveform that would work for all frequencies. For low frequencies, there is very little different between the band-limited saw and the naive saw. For high frequencies, the band-limited saw is effectively a sine. So you have to define how much memory you want to dedicate to your task, and generate many band-limited tables corresponding to various frequencies. At run-time, you decide which one to use depending on the frequency of the signal. If this is for a musical application in which you don't want to hear the transition from one table to the next as notes rise in pitch, you'll need to add one further layer of interpolation on top of that to crossfade from one table to the next. A typical implementation would use one table by octave or per 8 semitones.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-05-06T07:48:48.460" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16042" PostTypeId="2" ParentId="16005" CreationDate="2014-05-06T10:59:44.000" Score="2" Body="&lt;p&gt;You could also try local contrast enhancement or similar. Fiji has a function called Enhance Local &lt;a href=&quot;https://en.wikipedia.org/wiki/Contrast_(vision)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contrast&lt;/a&gt; (CLAHE) which does this. Looks like high pass filtering works reasonably well for you though.&lt;/p&gt;&#xA;&lt;p&gt;As for your second question. The Gaussian Blur Wikipedia you mention refers to Low pass filter. For the low pass filter each pixel is average over the surrounding pixels, weighted by a Gaussian centered on the pixel. In your case you are doing a high pass filter. This can can be given by the original minus the low pass filter, which is probably the easiest way of thinking about it (IMO).&lt;/p&gt;&#xA;" OwnerUserId="8662" LastEditorUserId="7092" LastEditDate="2022-01-30T12:44:40.103" LastActivityDate="2022-01-30T12:44:40.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16043" PostTypeId="1" CreationDate="2014-05-06T12:00:44.730" Score="0" ViewCount="93" Body="&lt;p&gt;We have measured the human blood  pressure with the sphygmomanometer connected to relative senzor of the pressure and osciloscope. We measured the offset of the sensor as $U_{OFF}=1.01\ V$ and the sensitivity $k=0.02425\ \frac{V}{mmHg}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By measuring the pressure on the human's arm, we got this image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zwEfJ.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;How to find systolic and diastolic pressure in there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We got formula for counting the pressure $p$ out of the output voltage $U_x$&#xA;$$p=\frac1k\cdot (U_x-U_{OFF})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought the highest value is the first vertical cursor, which shoud be  $9.6\ mV$ according to the table in the right top of the image, but if I count with this value and the formula above, I get the maximum pressure $-40\ mmHg$. We didn't get very clear instructions how to count systolic and diastolic preassure either. I only know, systolic pressure should be half of the maximum value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody help me with this?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="4158" LastEditDate="2014-05-06T14:22:56.027" LastActivityDate="2014-05-06T14:22:56.027" Title="How to find blood pressure from osciloscope image" Tags="|continuous-signals|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16047" PostTypeId="1" CreationDate="2014-05-06T14:15:49.377" Score="0" ViewCount="122" Body="&lt;p&gt;I have a doubt regarding multi track/multi layer recording of audio signals. in recording studio each instrument or chorus,playback will use a independent layer/track..so after recording a all tracks ..how do they mix all of those into a single track ..any mixing scheme?..or it is the simple time division multiplexing??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am asking this because while I read any mp3 or wav file in Matlab..I can see only a one channel or 2 channel signal...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help would be appreciated...&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-05-07T04:23:18.027" Title="how multi track recording is performed?" Tags="|audio|" AnswerCount="2" CommentCount="1" ClosedDate="2014-05-13T04:16:25.520" ContentLicense="CC BY-SA 3.0" />
  <row Id="16048" PostTypeId="2" ParentId="16047" CreationDate="2014-05-06T14:29:38.137" Score="2" Body="&lt;p&gt;Most of recordings nowadays are being done in stereo - two channels. So when you do a recording in studio, then most of tracks are mono (i.e. microphones, guitars). The main job of sound engineer is to place them in panorama (Left - Centre - Right) to create a nice spatial feeling. For this purpose you have &lt;em&gt;pan&lt;/em&gt; knob to set this mono track to the left or right speaker (make it more louder or quieter in either of them). Many tracks are useful when you want to apply different filtering to different instruments or add some reverb, change the volume, etc. In the end all waveforms are being summed and voila!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main track is obviously a stereo track based on your adjustments of track's &lt;em&gt;pan&lt;/em&gt; - that's why you have two channels loaded into your MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-06T14:29:38.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16049" PostTypeId="1" AcceptedAnswerId="16052" CreationDate="2014-05-06T14:56:29.527" Score="4" ViewCount="4588" Body="&lt;p&gt;In ofdm systems after applying IDFT we take the last N/x samples and place them before these N samples. This is called cyclic prefix(CP).So why to use a cyclic prefix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the CP known to combat the  inter symbol interference.Why can't we use some junk data or zeros over there? Can't this junk data combat the ISI ?.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Phani Tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastEditorUserId="7926" LastEditDate="2015-03-05T04:07:56.553" LastActivityDate="2015-03-05T04:07:56.553" Title="cyclic prefix in ofdm" Tags="|digital-communications|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16050" PostTypeId="2" ParentId="16049" CreationDate="2014-05-06T15:23:43.350" Score="5" Body="&lt;p&gt;You could theoretically use anything in that first section, including dead space- i.e. no signal at all.  They use the cyclic prefix in case the demodulator isn't perfectly synced up in time and thus is a little off on where it grabs the symbol to do the FFT.  The cyclic prefix causes a time error to simply cause a phase shift in the FFT results instead of introducing noise which could cause errors.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-05-06T15:23:43.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16051" PostTypeId="2" ParentId="16040" CreationDate="2014-05-06T16:25:53.903" Score="1" Body="&lt;p&gt;I guess that your problem can be modeled as a harmonic retrieval problem. &#xA;You can check the &lt;a href=&quot;http://www.princeton.edu/~kung/papers_pdf/New%20Folder/State%20space%20and%20singular%20value.pdf&quot; rel=&quot;nofollow&quot;&gt;Kung's method&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8735" LastActivityDate="2014-05-06T16:25:53.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16052" PostTypeId="2" ParentId="16049" CreationDate="2014-05-06T16:43:55.213" Score="9" Body="&lt;p&gt;The cyclic prefix is to make sure that any multi-path interference (or other process similar to a linear time-invariant filter in the transmission channel) acts as a circular convolution on the FFT data frame, thus not affecting the orthogonality of the data channels within the FFT bins.  It also allow some slop in the receiver's symbol clock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus the cyclic prefix has to be a circular repetition of the IFFT data, either before or after the IFFT block, and long enough to be as long or longer than the maximum expected multi-path delay time differential in the channel, plus the maximum of any timing error between the received data block and the receiver symbol clock.  The N/4 is just a default estimate of this time for some common channels, but longer may be required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything other that a circular repetition can cause multi-path delays to act as a non-linear spectral spreading function (relative to the FFT frame) which will affect channel orthogonality, and thus S/N related reliability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Repetition (circular or otherwise) also helps to statistically even out the PAP (peak to average power) ratio over the extended frame.  And prefix repetition may help push any transmitter anomalies due to sudden changes in this ratio forward of the FFT frame.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-05-06T17:30:39.990" LastActivityDate="2014-05-06T17:30:39.990" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16053" PostTypeId="1" CreationDate="2014-05-06T17:21:11.730" Score="2" ViewCount="1408" Body="&lt;p&gt;Just wondering what the opening operator is in image processing? What does it do? Just deletes bits of the image that you don't want?&lt;/p&gt;&#xA;" OwnerUserId="8805" LastActivityDate="2014-05-06T20:56:23.617" Title="What is the Use of the Opening Operator" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16055" PostTypeId="2" ParentId="16053" CreationDate="2014-05-06T18:03:19.987" Score="4" Body="&lt;p&gt;Opening is the morphological operation used for example in removal of small particles or some noise in binary image. Additionally it is widely used in hand-writing recognition where you want only the 'skeleton' of your letter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically it is a dilation of the erosion. Erosion sets current pixel to 0 if any pixel in neighbourhood is 0. Dilation on the other hand sets pixel to 1 if any neighbour is 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of that in following way: first you do the erosion ($N$ steps), which is shrinking boundaries of your objects. After that you perform dilation (also $N$ steps), which is expanding boundaries of your objects. Because small ones were removed in erosion step you will &lt;em&gt;bring back&lt;/em&gt; biggest elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some image showing this operation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qCe90.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-06T18:12:22.617" LastActivityDate="2014-05-06T18:12:22.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16056" PostTypeId="2" ParentId="16053" CreationDate="2014-05-06T20:56:23.617" Score="1" Body="&lt;p&gt;Exactly. It deletes the bits of the image you don't want. For example, when you try to detect moving objects in a video using &lt;a href=&quot;http://en.wikipedia.org/wiki/Background_subtraction&quot; rel=&quot;nofollow&quot;&gt;background subtraction&lt;/a&gt; you get back a binary image, in which pixels with the value of 0 belong to the stationary background, and pixels with the value of 1 belong to moving foreground objects. This binary image is typically noisy. Morphological opening is a way to get rid of small noisy specks in the background, and morphological closing is a way to close noisy gaps or small holes in the foreground.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-05-06T20:56:23.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16057" PostTypeId="1" AcceptedAnswerId="16058" CreationDate="2014-05-06T23:22:01.317" Score="1" ViewCount="2910" Body="&lt;p&gt;How do I calculate the maximum number of harmonics a complex wave can have based on the sample rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I Have a 20hz fundamental and a sampling rate of 44100 hz. My instinct is to take 44100/2 = 22050(nyquist) and the take the fundamental and multiply by 2 while the frequency is less than nyquist and the count how many times I had to multiply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if i'm going in the right direction and if i'm not... what is the correct way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;I would like to add that I am creating a table based oscillator with multiple tables with different harmonic contents.I am trying to figure out how to calculate the harmonics each table should have if I have an arbitrary number of tables. So &lt;strong&gt;table 1&lt;/strong&gt; would have say &lt;strong&gt;500 harms&lt;/strong&gt; so a &lt;strong&gt;max freq of 44.1hz&lt;/strong&gt; and &lt;strong&gt;table n&lt;/strong&gt; would have &lt;strong&gt;x harms&lt;/strong&gt; and have a &lt;strong&gt;max freq of y&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8658" LastEditorUserId="8658" LastEditDate="2014-05-07T03:55:35.533" LastActivityDate="2014-05-07T03:55:35.533" Title="Calculate Max Number Of Harmonics for given Sample Rate?" Tags="|sampling|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16058" PostTypeId="2" ParentId="16057" CreationDate="2014-05-07T01:07:42.483" Score="2" Body="&lt;p&gt;No, you don't just multiply by 2, you multiply by every integer.  You can have a 2nd harmonic, a 3rd harmonic, 4th, etc.  (Only multiplying by 2s would tell you the number of octaves, not the number of harmonics.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So take Nyquist frequency, and divide by the fundamental frequency&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;22050 Hz / 20 Hz = 1102.5&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then round down to the nearest integer.  So you can fit 1102 harmonics.  The 1102th harmonic is 1102*20 = 22040 Hz, while the 1103th harmonic is 1103*20 = 22060 Hz, which is too high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that some &lt;a href=&quot;http://en.wikipedia.org/wiki/Fundamental_frequency&quot; rel=&quot;nofollow&quot;&gt;consider the fundamental as the 0th harmonic&lt;/a&gt; while others consider it the first harmonic.  I am counting it as the first, 1*f.)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2014-05-07T01:07:42.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16059" PostTypeId="1" AcceptedAnswerId="16065" CreationDate="2014-05-07T01:57:51.620" Score="0" ViewCount="1948" Body="&lt;p&gt;I had an exam one of these days and one of the questions was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Knowing that an auto-correlation estimator of a sinal x[n] could be defined by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R_{xx}[k] = \sum_{n=-\infty}^{+\infty}h[n].x[n+k] , k=0,1,...,n-1&#xA;$$&#xA;and that the non-periodic convolution:&#xA;$$&#xA;y[n]=x[n]*h[n] = \sum_{k=-\infty}^{+\infty}h[k].x[n-k]&#xA;$$&#xA;show how to calculate the autocorrelation with a convolution operation&quot;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And here is my reasoning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let's say that:&#xA;$$&#xA;h[n] = x[-n]&#xA;$$&#xA;Therefore, we would have some $y[n]$ for the following convolution:&#xA;$$&#xA;y[n] = x[n]*h[n]=x[n]*x[-n] = \sum_{k=-\infty}^{+\infty}x[k].x[k-n]&#xA;$$&#xA;So it would be nice to invert the signal $y[n]$, finding then a $y[-n]$. However, we will get the same result as before since convolution is a commutative operation:&#xA;$$&#xA;y[-n]=x[-n]*h[-n]=x[-n]*x[n]=x[n]*x[-n]=\sum_{k=-\infty}^{+\infty}x[-k].x[-k+n]&#xA;$$&#xA;Therefore, $R_{xx}[n]=y[n]=y[-n]$, since the convolution sum is symmetric with respect to zero.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Is my reasoning correct by formal mathematics?&#xA;The professor gave me a zero in this answer because he says that my assumption $R_{xx}[n]=y[n]=y[-n]$ is wrong because the correct calculation of the autocorrelation has a complex conjugate in one of the terms (so it might not be symmetric with respect to zero). I agree with it even though he has not placed this formalism in the autocorrelation definition. So, following the exam's definitions, is my reasoning correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, can I say that this will always be true whenever the signal is purely real?&#xA;And by consequence of the question above: can some of these be demonstrated for complex signals?&lt;/p&gt;&#xA;" OwnerUserId="7389" LastActivityDate="2014-05-07T08:35:53.630" Title="Convolution sum vs auto-correlation problem" Tags="|convolution|autocorrelation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16060" PostTypeId="1" CreationDate="2014-05-07T02:37:59.357" Score="8" ViewCount="3860" Body="&lt;p&gt;I'm using Filter Banks (Narrow Band Pass) created using the functions in Matlab. However,  I wanted to know if there are fundamental limitations like that of FFT which also affect the Filter Banks. Is there any co-relation between the two?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I don't know if they share the same problem of time and frequency being inversely related. If they do share this problem, this means that we cannot have higher time and higher frequency resolution at the same time. &lt;/p&gt;&#xA;" OwnerUserId="8811" LastActivityDate="2014-05-08T20:08:22.570" Title="Filter Banks and FFT, are they similar conceptually?" Tags="|fft|filters|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16061" PostTypeId="2" ParentId="16047" CreationDate="2014-05-07T04:23:18.027" Score="1" Body="&lt;p&gt;Mixing is done by summing signals. Typically a mixing algorithm&#xA; would work something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Signal a;&#xA;Signal b;&#xA;Signal c;&#xA;Gain g1;&#xA;Gain g2;&#xA;Pan p1;&#xA;Pan p2;&#xA;&#xA;//where signal is a buffer of sound&#xA;//gain is a scalar for amplitude mixing&#xA;//and pan is a pan amount from left to right (i use from 0-1)&#xA;&#xA;//now the mixing&#xA;&#xA;c = pan(a,p1)*g1 + pan(b,p2)*g2;//where pan() is a panning function of some sort&#xA;&#xA;//so if we have&#xA;Sample a(1,1);//left and right channel are equal to 1&#xA;Sample b(0.5,1);//same idea&#xA;Sample c;//storage for output&#xA;&#xA;//now step by step&#xA;a = pan(a,0)*.75;//pan left and scale gain by 3/4;&#xA;//a = l:0.75 r:0&#xA;b = pan(b,1)*.75;//pan right and scale gain by 3/4;&#xA;//b = l:0 r:0.75&#xA;c = a +b;&#xA;//c = l:0.75 r:0.75&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are some more complexities involved sometimes but that is the basics as far as i understand. I tried to give my explanation in a pseudo code kind of manor I hope it is readable. Also my panning calculations are off but I think they make the point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good Luck&lt;/p&gt;&#xA;" OwnerUserId="8658" LastActivityDate="2014-05-07T04:23:18.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16063" PostTypeId="2" ParentId="15990" CreationDate="2014-05-07T05:45:14.563" Score="0" Body="&lt;p&gt;Computer science, even with core majors like automata theory, discrete math, compiler construction,,, won't be of much service. Even the initial core in a physics major&#xA;won't cover fourier series though 2nd semester you'll calculate the flux around a &#xA;torus via a triple integral,,,and if you can't then you won't be having much fun.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You most definitely need skills in:&#xA;1.Differential equations including Laplace transforms&#xA;2.AC Circuit theory into Fourier series/transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I haven't even mentioned wavelet theory nor toolkits with DSP&#xA;instrumentation like Matlab and Mathematica or kits from TI&#xA;that allows you to play with real DSP hardware.&lt;/p&gt;&#xA;" OwnerUserId="8813" LastActivityDate="2014-05-07T05:45:14.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16064" PostTypeId="1" CreationDate="2014-05-07T06:21:15.717" Score="1" ViewCount="306" Body="&lt;p&gt;Actually I am using DSP kit TMS320C6711 through which I want to remove 50Hz component out of the signal. I am unable to interface Code Composer studio (v2) with matlab. Therefore, I have designed FIR notch filter using Code composer Studio in which coefficients are taken from fdatool of matlab. Kaiser window has been used for filtering. The problem I am facing here is when lower and upper cutoff frequencies are 35Hz and 65Hz respectively only I am able to manage significant attenuation. When I am trying to get the cutoff frequencies closer, attenuation level is reducing to unsatisfactory levels.&#xA;So, please help me to decide the window to be used and order to be selected so that I could achieve significant attenuation of 50Hz component with sharp cutoff frequencies.&lt;/p&gt;&#xA;" OwnerUserId="8814" LastActivityDate="2014-06-06T09:49:39.007" Title="Which type of fliter should be designed to remove 50 Hz" Tags="|matlab|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16065" PostTypeId="2" ParentId="16059" CreationDate="2014-05-07T08:35:53.630" Score="0" Body="&lt;p&gt;There are two things to consider. First, looking only at the exam question you can say that the convolution of $h[n]$ with a sequence $y[n]$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(h*y)[k]=\sum_nh[n]y[k-n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now define $y[n]=x[-n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(h*y)[k]=\sum_nh[n]x[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_nh[n]x[n+k]=(h*y)[-k],\quad y[n]=x[-n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you need to flip the signal $x[n]$, compute the convolution, and flip the result. This is true, given the sum in your exam question. No need to worry about complex conjugates because we just used the definition of the autocorrelation sum in the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other issue is the definition of the autocorrelation for complex sequences, and how it can be implemented by convolution. The usual definition is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{xx}[k]=\sum_nx^{*}[n]x[n+k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convolution of $x^*[n]$ with a sequence $h[n]$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(x^**h)[k]=\sum_nx^*[n]h[k-n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $h[n]=x[-n]$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(x^**h)[k]=\sum_nx^*[n]x[n-k]=R_{xx}[-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for complex signals, you need to compute the convolution sum of $x^*[n]$ with $x[-n]$, and flip the result to arrive at the autocorrelation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $R_{xx}[k]=R_{xx}^*[-k]$, so instead of flipping the result, you can also use its complex conjugate.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-07T08:35:53.630" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16067" PostTypeId="2" ParentId="16049" CreationDate="2014-05-07T08:46:51.763" Score="1" Body="&lt;p&gt;Assume transmission across an LTI ISI channel with AWGN noise at the receiver as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_n=x_n*h_n+ z_n,$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $z$ denotes AWGN noise $(0,\sigma^2)$ and $y_n,x_n,h_n$ model the output, input and the channel of a discrete time communication system respectively. One can use a variety of techniques starting from naive zero-forcing to adaptive equalization in order to get rid of the effect of &quot;convolution&quot; that is happening across the channel but the most easy-to-understand [and apparently one of the most elegant] techniques to achieve the same is Orthogonal frequency division multiplexing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to think about the usage of cyclic prefix is as follows. Cyclic prefix gives you parallel AWGN channels over which water-filling can be employed to achieve Capacity i.e. if the channel impulse response $h_n$ and if one has to transmit $\mathbf{x}=[x_0,x_1,\dots,x_{N_c}]$ where $N_c &amp;gt; L$ denotes the number of sub-carriers and $L$ denotes the length of the channel impulse response, then under coherent detection the received signal after [no sampling offset] FFT at the receiver [assuming the underlying IFFT at the transmitter and FFT at the receiver are implemented with suitable scaling constants so as to not change the SNR] is given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_i = \tilde{h}_ix_i + \tilde{z}_i, 1 \le i \le N_c,$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\tilde{h}$ denotes the $N_c$-point DFT of the channel impulse response after padding $h_n$ with appropriate number of zeros to make it length-$N_c$. The noise $\tilde{z}_n$, which is the $N_c$-point DFT of the original noise $z_n$, is still AWGN with same statistic provided that the FFT-IFFT pair is chosen with proper scaling co-efficients. The above results in a very simple equalization technique since all that one needs to do to $y_i$ is multiply it by $\frac{\tilde{h}^*}{|\tilde{h}|}$ which again does not change the noise statistic. The effective SNR of every sub-carrier is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$SNR_i = \frac{|\tilde{h}_i|^2E_i}{\sigma^2},$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $E_i$ is the average energy of the constellation employed across sub-carrier $i$. You get an inherent advantage of tuning both the power and the constellation type depending upon the channel condition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as other answers say, the above is like a wonderland that is very hard to even get into - the receiver should have perfect knowledge of everything in the system and all that stuff. &lt;/p&gt;&#xA;" OwnerUserId="5102" LastActivityDate="2014-05-07T08:46:51.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16068" PostTypeId="2" ParentId="16064" CreationDate="2014-05-07T08:54:40.400" Score="2" Body="&lt;p&gt;Highly selective notch filters require a rather long impulse response, which makes FIR an inefficient approach. A simple IIR notch filter is easily designed by zero/pole placement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a 2nd order recursive filter and place two zeros at $\exp(i \omega_0)$ and $\exp(-i \omega_0)$ on the unit circle, where $\omega_0=2\pi\frac{f}{f_s}$ is the normalised center frequency of your notch. Then place two poles just inside the unit circle behind the zeros, namely at $r\exp(i\omega_0)$ and $r\exp(-i\omega_0)$ with $0&amp;lt;r&amp;lt;1$. These two poles will cancel the effect of the zeros beyond a certain distance. The closer the poles are to the zeros (i.e. the closer $r$ is to $1$), the sharper the notch will be. Picking the right $r$ therefore controls your bandwidth but also gives you the ability to control numerical stability and error accumulation for limited precision implementations. If you more the poles too close to the unit circle, the filter will start to behave weirdly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this recipe to calculate your filter coefficients we can directly start with the z-domain transfer function&#xA;$$H(z) = \frac{\left(z-\exp(i\omega_0)\right)\left(z-\exp(-i\omega_0)\right)}{\left(z-r\exp(i\omega_0)\right)\left(z-r\exp(-i\omega_0)\right)}$$&#xA;which can be expanded to&#xA;$$H(z)=\frac{z^2-z\left(\exp(i\omega_0)+\exp(-i\omega_0)\right)+1}{z^2-z r\left(\exp(i\omega_0)+\exp(-i\omega_0) \right)+r^2}=\frac{z^2-2\cos(\omega_0)z+1}{z^2-2r\cos(\omega_0)z+r^2}$$&#xA;and cancelling $z^2$ gives you the transfer function in terms of unit delays:&#xA;$$H(z) = \frac{1-2\cos(\omega_0)z^{-1}+z^{-2}}{1-2r\cos(\omega_0)z^{-1}+r^2z^{-2}} $$&#xA;Using the definition of the transfer function $H(z)=\frac{Y(z)}{X(z)}$ for input and output signal z-transforms $X(z)$ and $Y(z)$ respectively results in the z-transform of the filter recursion:&#xA;$$Y(z)\left(1-2r\cos(\omega_0)z^{-1}+r^2z^{-2} \right)=X(z)\left(1-2\cos(\omega_0)z^{-1}+z^{-2} \right)$$&#xA;Inverting the z-transform takes us to discrete time domain:&#xA;$$y[n]-2r\cos(\omega_0)y[n-1]+r^2y[n-2]=x[n]-2\cos(\omega_0)x[n-1]+x[n-2]$$&#xA;Finally, we can solve for the output signal at time $n$ and get the recursive filter equation&#xA;$$y[n]=x[n]-2\cos(\omega_0)x[n-1]+x[n-2]+2r\cos(\omega_0)y[n-1]-r^2y[n-2]$$&#xA;This equation gives you the most recent output sample in terms of the three most recent input samples and the prior two output samples. As initial condition you can assume that all recent samples are 0.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-05-07T08:54:40.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16070" PostTypeId="1" CreationDate="2014-05-07T10:14:35.060" Score="1" ViewCount="282" Body="&lt;p&gt;I am trying to calculate the mfcc of an audio sample of 5sec duration. How can I frame this audio sample. Is there any criterion for selecting the frame size and number of frames? What all change will be there if the audio file is 30sec long?&lt;/p&gt;&#xA;" OwnerUserId="8818" LastActivityDate="2014-05-07T14:38:15.887" Title="How to frame an audio sample?" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16071" PostTypeId="1" AcceptedAnswerId="16223" CreationDate="2014-05-07T11:50:42.863" Score="9" ViewCount="1150" Body="&lt;p&gt;I have created a fairly simple TDOA system that uses ultrasonic signals emitted from two speakers to geolocate (relative to the speakers) mobile phones.  The two signals are separated by frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system has the following constraints:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The signals must be inaudible.  To that end we stick to frequencies above 17 kHz.  A few people can still hear that, but most can't.&lt;/li&gt;&#xA;&lt;li&gt;Sample rate is 44.1 kHz.&lt;/li&gt;&#xA;&lt;li&gt;Music will typically be playing, so there is lots of interference at the lower frequencies.&lt;/li&gt;&#xA;&lt;li&gt;We don't have control over how well the speakers and microphones work at the upper frequencies, so we've kept our upper limit at around 20 kHz.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The particular signal that I am using is BPSK modulated 13-bit Barker codes because of their good autocorrelation properties.  The autocorrelation looks like the following-&#xA;&lt;img src=&quot;https://i.stack.imgur.com/R85BO.png&quot; alt=&quot;Signal autocorrelation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I cross-correlate the expected signal against the received signal in real life, though, what I get typically looks like this-&#xA;&lt;img src=&quot;https://i.stack.imgur.com/AXx29.png&quot; alt=&quot;Typical cross-correlation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blue is the cross correlation with the speaker 1 signal, and the red is the cross-correlation with the speaker 2 signal.  It appears that the echoes are significant and, unfortunately, often stronger than the direct path signal due to the directional gain of the microphone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried simply detecting the earliest appearance of the signal as that is likely to be the direct path.  This approach is very sensitive to the threshold that I use for deciding when the signal is present and so is not robust at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like a robust approach for determining the &quot;true&quot; arrival time of the signal- i.e. the arrival time of the direct path signal.  Perhaps some form of channel estimation and deconvolution?  If so, how would that work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data/Code: I want to make it clear that I am not expecting anyone to analyze the data or inspect my code.  I have made them available in case you want to do so.  I am mostly interested in ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made the raw received signal and modulated expected signals available for download.  They are all sampled at 44.1 kHz.  Correlating the received signal with the expected signals will produce something similar but not identical to the picture above because I move the received signals to baseband and decimate before correlating with the expected signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://s000.tinyupload.com/?file_id=19885751963613134270&quot; rel=&quot;noreferrer&quot;&gt;Received signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://s000.tinyupload.com/?file_id=93080827776842673390&quot; rel=&quot;noreferrer&quot;&gt;Expected signal #1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://s000.tinyupload.com/?file_id=82756392629554652381&quot; rel=&quot;noreferrer&quot;&gt;Expected signal #2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://s000.tinyupload.com/?file_id=50496704421858244199&quot; rel=&quot;noreferrer&quot;&gt;Matlab scripts&lt;/a&gt;&#xA;The Matlab scripts has both the signal generation script (genLocationSig.m) and my receive/processing script (calcTimingOffset.m).&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2014-05-12T13:35:25.783" LastActivityDate="2014-05-13T18:05:30.023" Title="Ultrasonic signal detection" Tags="|signal-detection|multipath|ultrasound|" AnswerCount="1" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="16072" PostTypeId="2" ParentId="16070" CreationDate="2014-05-07T14:38:15.887" Score="2" Body="&lt;p&gt;Usually in speech recognition frame size is around 16 milliseconds (0.016 second), which corresponds to average length of an audio signal during which it is stationary (not to much variation). Regarding the overlap I suggest you to start with 50%, you can then try to play with it, but it should not change too much. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not really understand part of you question asking what will change if the file is 30 seconds long. Obviously frame length stays the same and only number of frames will increase.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-07T14:38:15.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16073" PostTypeId="1" CreationDate="2014-05-07T14:57:07.937" Score="2" ViewCount="204" Body="&lt;p&gt;I am looking for a great introduction to FFTs for my job. I studied math, but never heard of FFT until I got this job. There is not a lot of documentation at my place of work and the articles I have found online have been somewhat confusing, even the wikipedia entry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am looking for a recomendation for a higher level introduction to FFT. I would perfer free resorces over paid ones, but I can't be too picky here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8821" LastActivityDate="2017-09-15T06:57:56.460" Title="Needed: introduction to FFT" Tags="|fft|" AnswerCount="2" CommentCount="2" ClosedDate="2014-05-13T04:17:23.977" ContentLicense="CC BY-SA 3.0" />
  <row Id="16074" PostTypeId="1" CreationDate="2014-05-07T15:20:23.380" Score="4" ViewCount="3267" Body="&lt;p&gt;Is there any difference in energy content of baseband and bandpass signals? When we see their representation in frequency domain, it looks like a bandpass signal has double the energy content compared to basband. But my friend says there's no difference. Someone please clarify.&lt;/p&gt;&#xA;" OwnerUserId="8822" LastActivityDate="2014-05-09T03:28:32.270" Title="Energy in baseband and bandpass signal" Tags="|bandpass|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16075" PostTypeId="2" ParentId="16074" CreationDate="2014-05-07T18:11:09.667" Score="2" Body="&lt;p&gt;To give a very simple example: let us consider random signals and let's assume that $x(t)$ is a zero-mean wide-sense stationary &lt;em&gt;real-valued&lt;/em&gt; baseband signal with power $E[x^2(t)]$. Define a modulated bandpass signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=x(t)\cos(\omega_0t+\theta)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta$ is a random phase uniformly distributed in the interval $[0,2\pi)$, which is independent of the signal $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we get for the power of $y(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E[y^2(t)]=E[x^2(t)\cos^2(\omega_0t+\theta)]=E[x^2(t)]E[\cos^2(\omega_0t+\theta)]=\frac{1}{2}E[x^2(t)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for this simple example you were both wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(And the same holds of course also for the energy of deterministic signals, as hinted at in Dilip Sarwate's comment.)&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-05-07T19:01:39.050" LastActivityDate="2014-05-07T19:01:39.050" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16077" PostTypeId="2" ParentId="16073" CreationDate="2014-05-07T19:09:32.613" Score="2" Body="&lt;p&gt;I found the following review paper very illuminating:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://sites.math.washington.edu/~morrow/498_13/signal_fft.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Fourier Transforms: A Tutorial Review and a State of the Art&lt;/a&gt;&#xA;by P. Duhamel and M. Vetterli.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It covers a lot of things, from history to implementations.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2017-09-15T06:57:56.460" LastActivityDate="2017-09-15T06:57:56.460" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16078" PostTypeId="1" AcceptedAnswerId="16079" CreationDate="2014-05-07T19:51:45.920" Score="0" ViewCount="254" Body="&lt;p&gt;I am trying to work out this problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that we are transmitting data from a dictionary of 15 symbols. Let the &#xA;probability of sending one symbol be the same as that of sending any other &#xA;symbol. Calculate how often we need to fetch a symbol to transmit information at &#xA;a rate of 5 bits/s. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be found?&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-05-07T20:22:24.423" Title="Entropy when having symbols with same probability" Tags="|digital-communications|information-theory|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16079" PostTypeId="2" ParentId="16078" CreationDate="2014-05-07T20:22:24.423" Score="3" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt; Compute the entropy &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; of your source and note that in your case it represents the  number of bits required to represent each symbol. Then from&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\quad H$&lt;/span&gt; [bits/symbol] &lt;span class=&quot;math-container&quot;&gt;$\times$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; [symbols/second] = &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; [bits/second]&lt;/p&gt;&#xA;&lt;p&gt;compute &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-05-07T20:22:24.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16081" PostTypeId="1" AcceptedAnswerId="16084" CreationDate="2014-05-07T21:26:37.573" Score="0" ViewCount="88" Body="&lt;p&gt;How exactly is beat division applied to a signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the rhythm need to be detected or can just the onset be manipulated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For rhythm detection is it better to look for patterns in the frequency domain or time domain for accuracy?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2014-05-08T00:17:00.563" Title="Audio Beat Divide" Tags="|audio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16083" PostTypeId="1" AcceptedAnswerId="16086" CreationDate="2014-05-07T21:47:58.513" Score="0" ViewCount="1252" Body="&lt;p&gt;Assuming that a computer is interfaced with a device that has 210 characters and &#xA;that each character is transmitted using binary words what is the minimum &#xA;number of bits needed to represent each character? To find the minimum is there any specific formula ?&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-05-08T00:34:52.217" Title="Minimum number of bits required for each character" Tags="|signal-analysis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16084" PostTypeId="2" ParentId="16081" CreationDate="2014-05-07T23:34:34.510" Score="1" Body="&lt;p&gt;Using the video you have posted as a reference, it appears to be based on a beat-tracker. When you press one of the buttons, the previous beat in the playback buffer is looped, using a loop duration which is a fraction of the beat duration. This works well on music genres in which rhythmic events tend to coincide with the beat grid; and in which the beat grid is regular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most implementations of beat-trackers use of the short-term Fourier transform, with a relatively small window and hop size. This gives you an accuracy on the location of beats in the 5 to 10ms range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us take an example. We assume in this example that the BPM is 120 ; and the audio is processed at a rate of 48kHz. Thus, a beat has a duration of 0.5 seconds or 24000 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement the &quot;beat divide&quot; effect, the audio is shoved in a ringer buffer as it is played, and a beat tracker collects the time stamp of beats. For example, the beat tracker is aware that the previous beats are at timestamps 86000, 60000, 36000... in the ring buffer ; while the play-head is at timestamp 90000. When you press the &quot;beat divide&quot; button, with a ratio of 1, the device loops the content of the buffer between timestamps 60000 and 86000. With a ratio of 1/4, the device loops the content between timestamps 60000 and 66000 - the loop has thus a duration of 6000 samples, or 0.125s, or one fourth of the duration of a beat.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-05-08T00:17:00.563" LastActivityDate="2014-05-08T00:17:00.563" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16085" PostTypeId="1" CreationDate="2014-05-08T00:17:56.070" Score="1" ViewCount="140" Body="&lt;p&gt;I am reading &quot;&lt;a href=&quot;http://uavbook.byu.edu/lib/exe/fetch.php?media=lecture%3achap6.pdf&quot; rel=&quot;nofollow&quot;&gt;Small Unmanned Aircraft: Theory and Practice&lt;/a&gt;&quot; (page 7). We have the following Transfer Function (TF):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\phi(s)=\frac{a_{\phi 2}}{s(s+a_{\phi 1})}(\delta_a(s)+\frac{1}{a_{\phi 2}}d_{\phi 2}) $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta_a$ is the output signal to the actuator and $d_{\phi 2}(s)$ is an unwanted disturbance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially, the disturbance is neglected, and only a PD controller is employed, and the resulting 2nd order TF (with $k_p$ and $k_d$)is compared with the general second-order TF:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(s)=\frac{\omega_n^2}{s^2+2\zeta \omega_ns+\omega_n^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From which the value of $k_d$ is obtained (and $k_p=\frac{\delta_{a,max}}{e_{max}}$, where $e_{max}$ is the maximum error).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the disturbance is considered, and an integrator is added to get a full PID. The resulting TF (with $k_p$,$k_d$ and $k_i$) will be different, actually it will become 3rd order. However, the book does not update the values of the gains after the integrator has been added, and somehow claims that the integrator will basically nullify the disturbance, so no change is needed for the gains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain this to me?&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="8825" LastEditDate="2014-05-08T01:58:48.550" LastActivityDate="2014-05-08T01:58:48.550" Title="Does the integrator in a PID controller removes the disturbance?" Tags="|control-systems|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16086" PostTypeId="2" ParentId="16083" CreationDate="2014-05-08T00:34:52.217" Score="1" Body="&lt;p&gt;the formula is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lceil \log_2 210 \rceil = 8$&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-05-08T00:34:52.217" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16087" PostTypeId="2" ParentId="16060" CreationDate="2014-05-08T01:35:33.373" Score="9" Body="&lt;p&gt;The answer is yes, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;discrete Fourier transform (DFT)&lt;/a&gt;, of which the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;fast Fourier transform (FFT)&lt;/a&gt; is an efficient implementation, can be interpreted quite literally as a filter bank. Recall the formula for the DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \sum_{n=0}^{N-1} x[n] e^{\frac{-j2\pi k n}{N}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;filterbank&quot; interpretation for the above equation goes something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In order to get the $k$-th DFT output $X[k]$, we start with the input signal $x[n]$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiply $x[n]$ by a complex exponential function $e^{\frac{-j2\pi k n}{N}}$. By the frequency-shifting property of the DFT, this has the effect of shifting the content at frequency $\frac{2\pi k}{N}$ down to zero frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Convolve the result with a filter that has the impulse response:&#xA;$$&#xA;h[n] = \begin{cases}&#xA;1, &amp;amp;&amp;amp; 0 \le n \le N-1 \\&#xA;0, &amp;amp;&amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&#xA;This filter (known as a moving average or a &quot;boxcar&quot;) has a lowpass characteristic.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus, we can view the DFT as placing a bank of uniformly-spaced critically-sampled filters across the signal's spectrum. Each filter has the same frequency response as an $N$-sample moving average filter, centered at frequencies $e^{\frac{j2\pi k n}{N}}, k = 0, \ldots, N-1$. I described this similarly in an answer to a previous question &lt;a href=&quot;https://dsp.stackexchange.com/questions/5915/what-is-the-meaning-of-the-dft/5921#5921&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-05-08T20:08:22.570" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16088" PostTypeId="1" CreationDate="2014-05-08T02:47:20.240" Score="2" ViewCount="218" Body="&lt;p&gt;What's the best way to incorporate polynomials or sinusoidal equations into a linear model to predict a future amplitude in this sort of data? You can see that if those polynomials continued to go on, they wouldnt be anywhere close to fitting the final location. Im trying to use the greeen shaded area to predict the non shaded area.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mx4gq.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;Those light grey lines are polynomials like this: $$y_1 = a_1(x)^2 + b_1(x) + c_1\\$$ that are fitted to different sections of the data. Do I just use the a b and c variables from each polynomial, or do extrapolate out and use some other value?&lt;/p&gt;&#xA;" OwnerUserId="8826" LastEditorUserId="13320" LastEditDate="2016-11-21T13:02:59.577" LastActivityDate="2016-11-21T13:02:59.577" Title="Forecasting noisy data with polynomials" Tags="|noise|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16089" PostTypeId="1" AcceptedAnswerId="16091" CreationDate="2014-05-08T03:21:53.573" Score="0" ViewCount="63" Body="&lt;p&gt;What is the name of the following bit encoding generator matrices?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FNYUB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8437" LastActivityDate="2014-05-08T03:43:58.507" Title="2 by 2 bit orthogonal encoding mult-kronecker expansion matrices?" Tags="|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16090" PostTypeId="1" AcceptedAnswerId="16109" CreationDate="2014-05-08T03:24:35.733" Score="2" ViewCount="653" Body="&lt;p&gt;In &lt;a href=&quot;http://books.google.com/books?id=4jWp0RMTtw8C&amp;amp;lpg=PP1&amp;amp;dq=Introduction%20to%20Adaptive%20Arrays&amp;amp;pg=PA466#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;figure 11.23&lt;/a&gt; of Monzingo's &lt;em&gt;Introduction to Adaptive Arrays&lt;/em&gt;, the author uses a sinewave in the frequency domain to model the amplitude ripple in the passband of a channel of a receiver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gPh5U.png&quot; alt=&quot;frequency response of filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What does he mean by &lt;em&gt;array bandwidth&lt;/em&gt;?&lt;/li&gt;&#xA;&lt;li&gt;How does one create a time domain filter (FIR or IIR) with this custom/arbitrary frequency response?&lt;/li&gt;&#xA;&lt;li&gt;What are other conventional channel amplitude and phase ripple filter models?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2014-05-08T15:05:39.857" LastActivityDate="2014-05-08T16:38:05.847" Title="Creating a time domain filter from a frequency domain plot" Tags="|filters|bandwidth|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16091" PostTypeId="2" ParentId="16089" CreationDate="2014-05-08T03:43:58.507" Score="1" Body="&lt;p&gt;This is called Sylvester's construction for a $2^n\times 2^n$ Hadamard matrix. The matrices are sometimes called Walsh matrices or Walsh-Hadamard matrices.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-05-08T03:43:58.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16092" PostTypeId="1" CreationDate="2014-05-08T05:24:34.200" Score="0" ViewCount="45" Body="&lt;p&gt;Here are two images. What kind of filter/processing is done here?&#xA;It looks like an emboss but the bumps are smooth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Original : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZIRaR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Processed :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nqcrR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8827" LastEditorUserId="8202" LastEditDate="2014-05-08T06:04:59.673" LastActivityDate="2014-06-07T06:56:56.450" Title="What is this effect/filter in given images?" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16093" PostTypeId="2" ParentId="16092" CreationDate="2014-05-08T06:28:05.567" Score="1" Body="&lt;p&gt;Highlight blooming; the bright parts are bleeding into the shadows. It can be done with Photoshop's &lt;em&gt;Diffuse Glow&lt;/em&gt; filter.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-05-08T06:28:05.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16094" PostTypeId="2" ParentId="16088" CreationDate="2014-05-08T09:33:52.927" Score="1" Body="&lt;p&gt;Starting with your last question: to extrapolate you do just use your fitted coefficients and extend them to a greater $x$ range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I think this approach is inherently flawed for data such as yours over any significant time period, especially when using a polynomial model. The problem is that any polynomial has a limited number of turning points. Once you pass these the data will tend to head off to $\pm \infty$ which is unlikely to model anything well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency domain analysis may be a possibility, but I expect you would run into similar problems. Another approach could be to use some sort of moving average or auto-regressive model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Banks and similar financial institutions invest millions into modelling this sort of data so it definitely isn't easy.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-08T09:33:52.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16095" PostTypeId="1" CreationDate="2014-05-08T09:48:13.597" Score="2" ViewCount="560" Body="&lt;p&gt;I want to clear my thinking on how to approach problems of the type characterized below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess what we want to do is select a sample rate of a sufficient size such that this signal can be fully captured  therein but also small enough so as not to waste all the space from 0 to, 156? (77*2). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen in some examples that if we select a sampling rate that is some integer multiple of this rate then we can use one that is much lower than the nyquist frequency, taking advantage of the property of replication. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So maybe for part (a), this would just have the same thing repeated over and over every 56 MHz? and How about specral inversion, would every other sample be inverted?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For part (b) maybe it's 56/2 = 28? or maybe it's 77/2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For part (c) are we meant to think about the &lt;/p&gt;&#xA;&#xA;&lt;p&gt;fs' &amp;lt; 2fc-B/m&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or maybe the &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2fc-B/m &gt; fs &gt; 2fc+B/m+1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess m in this situation is 56? And B is 14? But how about the transition of B, it doesn't drop down straight but it flares out at the bottom, how to think about that? And I guess fc = 70? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AvYY6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; (reaction to Matt L.'s answer)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the image below what you had in mind for part (a)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But why don't we take the bandwidth into account? Furthermore, in the image it seems that the 14MHz indicated there as the bandwidth doesnt completely describe the size of B since it seems to flare out at the ends, how about that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can we generalize that equation to be that for any time we are performing that undersampling we can get the location of all the replications by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'Highest frequency component for which we must account' - ('number of K term' * 'sampling rate')&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and sampling rate must be &gt; 2B&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why did you only calculate for two terms? could be go on? can we do k = 3, 4, 5, 6... ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess you mean the answer to part (b) is 14 because it's the smallest positive spectral component right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;amp; for (c) you mean f1 = 14 MHz = 70MHz - fs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a5jg3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user8769" LastEditorUserId="4298" LastEditDate="2014-05-14T15:36:12.910" LastActivityDate="2015-04-09T20:55:38.913" Title="Sampling bandpass signal with spectral replications" Tags="|frequency|bandpass|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16096" PostTypeId="1" AcceptedAnswerId="16103" CreationDate="2014-05-08T10:07:53.387" Score="0" ViewCount="705" Body="&lt;p&gt;first of all, sorry for this basic question in signal processing, I'm pretty new in this field and have been stuck in a situation a little beyond my expertise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to derive the instantaneous wavenumber direction as an estimation of the direction normal of a 2D field by using a directional Hilbert transform in one of the directions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can recall correctly, all I have to do is to do a &lt;strong&gt;1D Fourier&lt;/strong&gt; transform of each data vector, &lt;strong&gt;apply a $\pi/2$ phase-shift&lt;/strong&gt; in the wavenumber domain and then apply an &lt;strong&gt;inverse Fourier transformation&lt;/strong&gt; to get the Hilbert transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the Hilbert transform is defined as:&#xA;$$&#xA;H(x(t)) = \frac{1}{\pi} PV \int_{-\infty}^{\infty}\frac{x(\tau)}{\tau-t}d\tau&#xA;$$&#xA;where $PV$ denotes the principal value of the integral and $H$ is the Hilbert transform of a vector $x(t)$. This is supposed to be equal to the convolution $\frac{1}{\pi t} * x(t)$ and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F(H(x(t))) = F(\frac{1}{\pi t}) F(x(t)).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the Fourier transformation and multiplication of the two factors on the right side is equal to the Fourier transformation of the Hilbert transformation of my vector, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question now is how to apply the phase shift on the Hilbert transform? is it simply multiplying the product on the right side by $\pi/2$ in the wavenumber domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot for any help!&#xA;Cheers!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I coded the Hilbert transformation in $C$ but unfortunately I do not get a phase shift of $90^\circ$ but somewhat different from that and with a wrong amplitude. My code looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    void hilbertfun(float *vin, float *vout, int n, int d)&#xA;    {&#xA;static complex *A;           //working array&#xA;int i;&#xA;float pi = 4. * atan(1.);&#xA;int signfun;&#xA;static float *rkx;&#xA;&#xA;void rk(float *ak, int n, float d, int ind);&#xA;&#xA;A  = (complex*) alloc1(n,sizeof(complex));&#xA;rkx = (float*) alloc1(n,sizeof(float));&#xA;&#xA;//copy input array to complex array&#xA;for(i=0; i&amp;lt;n; i++){&#xA;    A[i].r = vin[i];&#xA;    A[i].i = 0.;&#xA;}&#xA;&#xA;// perform inverse fft&#xA;fouriertransform(1,n,A);&#xA;&#xA;// calculate wavenumbers&#xA;wavenumbers(rkx,n,d,1);&#xA;&#xA;&#xA;&#xA;// check wether wavenumbers are positive or negative &amp;gt;&amp;gt; apply phase shift by using the impulse response of the Hilbert transformer&#xA;// + apply phase shift&#xA;for(i=0;i&amp;lt;n;i++){&#xA;  if (rkx[i] &amp;gt; 0) signfun = 1;&#xA;  else if (rkx[i] == 0) signfun = 0;&#xA;  else if (rkx[i] &amp;lt; 0) signfun = -1;&#xA;    A[i].r = - A[i].i * signfun;&#xA;    A[i].i = A[i].r * signfun;&#xA;}&#xA;&#xA;// perform forward fft&#xA;fouriertransform(-1,n,A);&#xA;&#xA;for(i=0;i&amp;lt;n;i++) vout[i]=A[i].r/n; //write into output and normalise&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform and the normalisation work perfectly fine without the phase shift (Original (red), Output (green)):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eXx88.png&quot; alt=&quot;FFT iFFT&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, with the phase shift I get this result (Original (red), Hilbert  transformed Output (green)):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/QxOj9.png&quot; alt=&quot;Input/Output signal to prove that Hilbert trafo does not work&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What am I missing?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8071" LastEditorUserId="8071" LastEditDate="2014-05-12T12:49:57.793" LastActivityDate="2014-05-12T14:52:11.197" Title="Discrete Hilbert transformation of a spatial signal" Tags="|discrete-signals|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16098" PostTypeId="2" ParentId="16073" CreationDate="2014-05-08T10:35:52.383" Score="1" Body="&lt;p&gt;i would recommed &quot;signal processing for communications &quot; by Martin Vetterli. It Deals with the fft and dft , analyses them and interprets the frequency domain plot of the signals. i think all your questions can be answered there!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phanit tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-05-08T10:35:52.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16101" PostTypeId="1" CreationDate="2014-05-08T11:12:37.087" Score="0" ViewCount="400" Body="&lt;p&gt;Can the Fast Walsh-Hadamard Transform be used to find a Walsh-Hadamard frequency spectrum which some how relates to a Fourier frequency spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the Fast Walsh-Hadamard Transform more accurate than the Fast Fourier Transform when analyzing signals with very low bit resolution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are the different Walsh-Hadamard harmonic signals stored in the matrix's columns ordered from lowest frequency to highest frequency across the matrix's rows with a lot of phase variation degeneracy in the mid-range frequencies. The matrix is symmetric.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:56&amp;gt; ifwht(eye(16)) .+ 1&#xA;ans =&#xA;&#xA;   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2&#xA;   2   2   2   2   2   2   2   2   0   0   0   0   0   0   0   0&#xA;   2   2   2   2   0   0   0   0   0   0   0   0   2   2   2   2&#xA;   2   2   2   2   0   0   0   0   2   2   2   2   0   0   0   0&#xA;   2   2   0   0   0   0   2   2   2   2   0   0   0   0   2   2&#xA;   2   2   0   0   0   0   2   2   0   0   2   2   2   2   0   0&#xA;   2   2   0   0   2   2   0   0   0   0   2   2   0   0   2   2&#xA;   2   2   0   0   2   2   0   0   2   2   0   0   2   2   0   0&#xA;   2   0   0   2   2   0   0   2   2   0   0   2   2   0   0   2&#xA;   2   0   0   2   2   0   0   2   0   2   2   0   0   2   2   0&#xA;   2   0   0   2   0   2   2   0   0   2   2   0   2   0   0   2&#xA;   2   0   0   2   0   2   2   0   2   0   0   2   0   2   2   0&#xA;   2   0   2   0   0   2   0   2   2   0   2   0   0   2   0   2&#xA;   2   0   2   0   0   2   0   2   0   2   0   2   2   0   2   0&#xA;   2   0   2   0   2   0   2   0   0   2   0   2   0   2   0   2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8437" LastEditorUserId="8437" LastEditDate="2014-05-08T14:19:26.677" LastActivityDate="2014-05-08T14:19:26.677" Title="Fast Walsh-Hadamard Transform frequency spectrum?" Tags="|discrete-signals|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16102" PostTypeId="2" ParentId="16060" CreationDate="2014-05-08T11:17:40.593" Score="0" Body="&lt;p&gt;if you want to have a good frequency resolution both in time domain as well as in frequency domain, you can use wavelet transforms to get it done. you can split your data into (1st level/iteration) low pass(smoothening), high pass(edge/zero crossing), band pass information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-05-08T11:17:40.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16103" PostTypeId="2" ParentId="16096" CreationDate="2014-05-08T11:30:56.533" Score="0" Body="&lt;p&gt;You need the Fourier transform of the impulse response of the Hilbert transformer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t)=\frac{1}{\pi t}\Longleftrightarrow H(j\omega)=-j\textrm{ sign}(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all positive frequencies are multiplied by $-j$ and all negative frequencies are multiplied by $j$. This corresponds to a phase shift of $-\pi/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm referring to your updated question including the code. I can't see if the computation of the wavenumber is OK, but one problem I definitely see is in applying the phase shift. You change A[i].r and then you re-use it (as if it were the orignal value) to compute A[i].i. Furthermore, I think the signs are wrong. If signfun=1, A[i].r=A[i].i and similarly for the computation of A[i].i. But the most important thing is to use a temporary variably to store the old value of A[i].r for computing A[i].i.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-05-12T14:52:11.197" LastActivityDate="2014-05-12T14:52:11.197" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16105" PostTypeId="1" AcceptedAnswerId="16106" CreationDate="2014-05-08T14:30:46.147" Score="14" ViewCount="11723" Body="&lt;p&gt;In the literature, I've found that DFS and DFT are one and the same. If they are one and the same why to use two different names for them? If there is really a difference what is it and what is the significance of discrete Fourier series?&lt;/p&gt;&#xA;" OwnerUserId="7926" LastEditorUserId="54556" LastEditDate="2020-12-21T15:01:49.067" LastActivityDate="2023-07-05T09:50:34.963" Title="The difference between DFT and DFS" Tags="|fft|discrete-signals|fourier-transform|dft|fourier-series|" AnswerCount="7" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16106" PostTypeId="2" ParentId="16105" CreationDate="2014-05-08T15:37:36.217" Score="3" Body="&lt;p&gt;We have had this fight many, &lt;em&gt;many&lt;/em&gt;, &lt;strong&gt;many&lt;/strong&gt; times at &lt;em&gt;&lt;a href=&quot;https://www.dsprelated.com/showthread/comp.dsp/135472-1.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;comp.dsp&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The DFT is the same thing as the DFS.&lt;/p&gt;&#xA;&lt;p&gt;The DFT maps a discrete and periodic sequence of numbers with period length of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to another discrete and periodic sequence of numbers with period length of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and the iDFT (which has the same form as the DFT) maps it back.&lt;/p&gt;&#xA;&lt;p&gt;Some people don't like anthropomorphizing algorithms or procedures, but I do.  The DFT &amp;quot;&lt;em&gt;assumes&lt;/em&gt;&amp;quot; that the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples passed to it are one period of a periodic sequence.  The DFT periodically extends the data passed to it.&lt;/p&gt;&#xA;&lt;p&gt;It is clear in the math, both in the definition of the DFT (and iDFT), and in &lt;strong&gt;any&lt;/strong&gt; theorem applicable to the DFT other than linearity (the periodic nature of the DFT is not evident in the linearity property, but it &lt;strong&gt;is&lt;/strong&gt; evident in anything that causes shifting or convolution in one domain or multiplication by a non-constant in the other domain).&lt;/p&gt;&#xA;&lt;p&gt;This is why, if periodicity is &lt;strong&gt;not&lt;/strong&gt; assumed (a better word would be &lt;em&gt;&amp;quot;recognized&amp;quot;&lt;/em&gt;), then people need to use this clunky modulo notation in the indices, like &lt;span class=&quot;math-container&quot;&gt;$x[ ((n))_N ]$&lt;/span&gt; (this is the notation that O&amp;amp;S use) and that, in my opinion, is a pathetic confession from the periodicity deniers that, when it comes down to the bottom line, even &lt;em&gt;they&lt;/em&gt; recognize that the DFT is inherently periodic.&lt;/p&gt;&#xA;&lt;p&gt;To be explicit, the periodic extension of the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; passed to the DFT is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \tilde{x}[n] = x[ ((n))_N ] = x[n\operatorname{mod}_N] \qquad \forall n \in \mathbb{Z}, \ N \in \mathbb{Z}&amp;gt;0$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ \qquad\qquad\qquad ((n))_N  \triangleq n\operatorname{mod}_N = n - N\left\lfloor \frac{n}{N} \right\rfloor  $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The notation &lt;span class=&quot;math-container&quot;&gt;$\lfloor \cdot \rfloor$&lt;/span&gt; means the &lt;code&gt;floor()&lt;/code&gt; function which is the largest integer that does not exceed the argument.&lt;/p&gt;&#xA;&lt;p&gt;To use &lt;strong&gt;any&lt;/strong&gt; of the shifting or convolution theorems of the DFT, this &lt;em&gt;modulo&lt;/em&gt; arithmetic of the indices is &lt;strong&gt;absolutely required&lt;/strong&gt;.  for the scaling or superposition theorems, this &lt;em&gt;modulo&lt;/em&gt; arithmetic is not required, but does not break those theorems in any case.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, to be consistent, when using the DFT for &lt;strong&gt;any&lt;/strong&gt; theorems to do any real work with the DFT, one should simply apply the &lt;em&gt;modulo&lt;/em&gt; arithmetic &lt;strong&gt;all of the time&lt;/strong&gt;.  Doing so &lt;em&gt;&lt;strong&gt;explicitly&lt;/strong&gt;&lt;/em&gt; periodically extends the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-sample sequence, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; passed the DFT.&lt;/p&gt;&#xA;&lt;p&gt;For me, it's just easier to drop the tilde &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\tilde{\ }$&lt;/span&gt;&amp;quot; and simply say that &lt;span class=&quot;math-container&quot;&gt;$\tilde{x}[n]$&lt;/span&gt; is the same as &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; and that &lt;span class=&quot;math-container&quot;&gt;$\tilde{X}[k]$&lt;/span&gt; is the same as &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; and just stop fucking around with this DFT business.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/18144/about-discrete-fourier-transform-vs-discrete-fourier-series/18157#18157&quot;&gt;People should read this other answer I wrote a long time ago regarding the inherent periodic nature of the DFT.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-05-22T14:37:43.407" LastActivityDate="2023-05-22T14:37:43.407" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16107" PostTypeId="1" AcceptedAnswerId="16108" CreationDate="2014-05-08T16:13:28.293" Score="0" ViewCount="551" Body="&lt;p&gt;I'm trying to code the HPS (&lt;a href=&quot;https://ccrma.stanford.edu/~pdelac/154/m154paper.htm#_ftnref9&quot; rel=&quot;nofollow noreferrer&quot;&gt;harmonic product spectrum&lt;/a&gt;) algorithm and the problem I'm facing is that using my guitar, the fundemental frequency (Here it's 82Hz) just isn't there, so is the 5th Harmonic at 410Hz (Actually it's the lowest local point).&#xA;In my algorithm, I did the step of finding the max of all (Mul(harmonic-multiplications))&#xA;What pre/post-process should I do to get to 82Hz here.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YHIIp.png&quot; alt=&quot;Plot&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8835" LastEditorUserId="29" LastEditDate="2014-05-08T20:39:12.013" LastActivityDate="2014-05-08T20:39:12.013" Title="Pitch Detection: HPS not working" Tags="|fft|audio|frequency|pitch|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16108" PostTypeId="2" ParentId="16107" CreationDate="2014-05-08T16:26:47.040" Score="2" Body="&lt;p&gt;Missing f0 is a common situation. Pitch could be defined the lowest common multiple of the spacing between spectral peaks, and they seem to be spaced by 82 Hz or 164 Hz here - so there's nothing wrong with your signal and spectrum. Harmonic sum or product should deal with this case. Could you please post plots of your harmonic sum or product? Which result do they give you?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also try looking at another pitch detection method like the Average Magnitude Difference Function or YIN.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-05-08T16:26:47.040" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16109" PostTypeId="2" ParentId="16090" CreationDate="2014-05-08T16:38:05.847" Score="2" Body="&lt;p&gt;I don't know much about arrays, so I can only answer the second part of your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(\omega)=(1+R\cos\omega T_0)\textrm{rect}\left(\frac{\omega}{2\pi B}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\textrm{rect}()$ is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Rectangular_function&quot; rel=&quot;nofollow&quot;&gt;rectangular function&lt;/a&gt;. Equation (1) can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(\omega)=\left(1+\frac{R}{2}e^{j\omega T_0}+\frac{R}{2}e^{-j\omega T_0}\right)\textrm{rect}\left(\frac{\omega}{2\pi B}\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which shows that $A(\omega)$ is a sum of three ideal low-pass filters with the same cut-off frequency, but with different delays ($0$, $-T_0$, and $T_0$) and different scaling factors. It is an ideal system and can only be approximated by a real system. The implementation suggested by (2) is a parallel connection of 3 low-pass filters with different delays and scaling factors. Note that in order for a causal filter to be able to approximate this ideal system reasonably well, you have to add a delay $\tau&amp;gt;T_0$. So the desired complex frequency response which you can base your design on is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=A(\omega)e^{-j\omega\tau}=\left(1+\frac{R}{2}e^{j\omega T_0}+\frac{R}{2}e^{-j\omega T_0}\right)e^{-j\omega\tau}\textrm{rect}\left(\frac{\omega}{2\pi B}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that each of the 3 low-pass filters is a linear phase filter. So I would suggest you use FIR filters to approximate $H(\omega)$. You first design an FIR low-pass filter with the desired cut-off frequency with group delay $\tau-T_0$ (in samples). For a linear-phase filter, the delay determines the filter length $N=2*$(delay in samples)$+1$. So by choosing $\tau$ you also choose the filter length. If the impulse response of this filter is $h(n)$, and if $n_0$ is the number of samples corresponding to $T_0$, then the total impulse response is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(n)=\frac{R}{2}h(n)+h(n-n_0)+\frac{R}{2}h(n-2n_0)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-08T16:38:05.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16110" PostTypeId="1" CreationDate="2014-05-08T17:45:04.243" Score="3" ViewCount="4833" Body="&lt;p&gt;This is my very first signal processing exercise so I'm very new to this space. That being said the goal is to do isolate voice recognition in identifying someone saying yes and no.As the title suggests I have a 1x26 vector that looks as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  Columns 1 through 10&#xA;&#xA;  (P)160.2504   66.7557  -35.9298  144.1598  -11.9133  -16.2184  -26.4730   78.0673   10.2075  -39.4318&#xA;&#xA;  Columns 11 through 20&#xA;&#xA;  -46.6702    5.9283  -42.9540    (P)0.2614    0.0382   -1.3315    0.1326   -1.4256    0.1936    0.4081&#xA;&#xA;  Columns 21 through 26&#xA;&#xA;   -1.4431   -1.6916   -1.1668   -0.2901   -0.4499   -0.4309&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where (P) denotes the log energy for the Mel Cepstrum Coefficients and Delta Coefficients respectively. This being said I would like to know how to normalize these values but how? I'm not sure what exactly to divide the energies by, let alone the coefficients. Like I said first project so a really go post guiding me would be REALLY appreciated! &lt;/p&gt;&#xA;" OwnerUserId="8801" LastActivityDate="2014-06-07T18:57:04.883" Title="Normalizing a vector with Mel Cepstrum Coefficients, Delta Coefficients and Log Energies for both" Tags="|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16111" PostTypeId="2" ParentId="16105" CreationDate="2014-05-08T17:52:24.673" Score="7" Body="&lt;p&gt;I think part of the problem is an awkward and inconsistent naming convention. There are 4 flavors of Fourier Transforms depending on which domain is continuous or discrete (which maps to being aperiodic or perodic in the other domain). So we have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;         Name                  Time                  Frequency&#xA;Fourier Transform    continous/aperiodic     continous/aperiodic &#xA;Fourier Series       continous/periodic      discrete/aperiodic &#xA;Discrete Time FT     discrete/aperiodic      continous/periodic&#xA;DFT or DFS           discrete/periodic       discrete/periodic&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A better naming would have been&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;         Name                  Time                  Frequency&#xA;Fourier Transform    continous/aperiodic     continous/aperiodic &#xA;Fourier Series       continous/periodic      discrete/aperiodic &#xA;Discrete FT          discrete/aperiodic      continous/periodic&#xA;Discrete FS          discrete/periodic       discrete/periodic&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so that discrete refers to &quot;discrete in time and periodic in frequency&quot; and &quot;series&quot; refers &quot;discrete in frequency and periodic in time&quot;. In other words &quot;series&quot; means sums and &quot;transform&quot; means integrals. Discrete mean sums and continuous means integrals.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-05-08T17:52:24.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16112" PostTypeId="2" ParentId="16110" CreationDate="2014-05-08T18:12:06.073" Score="6" Body="&lt;p&gt;You could collect a large collection of voice signals, extract the MFCCs, and compute the mean and standard deviation of each coefficient. Keep these numbers and use them once and for all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you can normalize the sequence of vectors from an utterance by subtracting the mean and dividing by the standard deviation you have pre-computed (&lt;strong&gt;do not&lt;/strong&gt; recompute the mean and standard deviation on each utterance - since each file utterance will have slightly different statistics).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be useful if you use the euclidean distance to compare MFCCs - for example when using DTW. However, more advanced statistical modelling techniques do not need this normalization step - a gaussian model, for example, will actually learn the mean and covariance matrix of the coefficients without having to pre-normalize the data (Euclidian distance on mean/std normalized data is just like Mahalanobis distance with a diagonal covariance matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sake of accuracy, I should point out that this normalization scheme has a flaw... The last MFCC coefficients are known to be very noisy and less informative - this follows from the energy compaction property of the DCT (the less relevant stuff is in the highest coefficient), or from the view of the DCT as an approximation of a PCA on the log mel spectra. Thus, the mean/standard-deviation scheme I have presented might &quot;blow up&quot; the importance of the last coefficients. Machine learning/feature selection algorithms might be robust to this and would discard them anyway, but the euclidian distance is not. A compromise I have used in past research is to normalize by a power &amp;lt; 1 of the standard deviation ; or to scale down, after normalization, the nth MFCC coefficient by $\alpha^n$ where $\alpha = 0.95$. Other normalization schemes implement &quot;liftering&quot; - by multiplying the sequence of MFCC point-wise by a window function.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-05-08T18:27:57.337" LastActivityDate="2014-05-08T18:27:57.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16113" PostTypeId="1" CreationDate="2014-05-08T18:20:43.567" Score="0" ViewCount="687" Body="&lt;p&gt;Anyone can explain me about how measure side lobe roll-off rate of kaiser window from Spectrum in matlab where side lobe roll-off rate is the asymptotic decay rate, in decibels per octave of frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How adjust Frequency axis if length of FFT = &quot;500&quot; by padding &quot;473&quot; zeros  with length of window= &quot;27&quot; to frequency in Hz. &lt;/p&gt;&#xA;" OwnerUserId="8463" LastActivityDate="2014-05-10T01:53:50.390" Title="Rate of fall of sidelobe level" Tags="|matlab|discrete-signals|frequency-spectrum|signal-analysis|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16114" PostTypeId="1" CreationDate="2014-04-29T16:13:49.477" Score="1" ViewCount="585" Body="&lt;p&gt;I'm new to OFDM modulation. During OFDM modulation in the frequency domain, are the negative frequencies modulated with a conjugate version of the data of the positive frequencies, or do the negative and positive frequencies carry completely different data?&lt;/p&gt;&#xA;" OwnerDisplayName="Charles" LastEditorUserId="4749" LastEditDate="2014-05-26T10:59:53.653" LastActivityDate="2015-02-05T21:06:35.050" Title="How do you perform OFDM modulation?" Tags="|modulation|ofdm|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16116" PostTypeId="2" ParentId="16114" CreationDate="2014-05-08T19:24:36.533" Score="1" Body="&lt;p&gt;There are independent sub-carriers in both the positive and negative frequencies.  In other words, yes, they have completely different data.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-05-08T19:24:36.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16118" PostTypeId="1" AcceptedAnswerId="16138" CreationDate="2014-05-08T19:34:56.240" Score="1" ViewCount="1008" Body="&lt;p&gt;I am working through previous exam questions for a class I'm currently taking in signal theory, and one problem, although it looks easy, stumps me.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PROBLEM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two real $N$-periodic time seires $f_n$ and $g_n$ are given, where $n = 0, 1, 2, ..., N-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, the complex time series $h_n$ is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n = f_n + i g_n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the discrete Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_m = F_m + i G_m$$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $m = 0,1,. . ., N-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the discrete Fourier transofrm $F_m$ and $G_m$ to the time series $f_n$ and $g_n$ expressed through $H_m$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ATTEMPTED SOLUTION&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said, I'm really stumped here.  Other than writing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_m = H_m - i G_m$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_m = i (F_m - H_m)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see what else to do.  Is this all there is to it?  It seems way too easy, so I'm pretty sure I'm not doing this correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone can give me any help, I would greatly appreciate it!&lt;/p&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2014-05-09T18:08:59.090" Title="Discrete Fourier transform of complex time series" Tags="|discrete-signals|fourier-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16120" PostTypeId="2" ParentId="16074" CreationDate="2014-05-09T03:28:32.270" Score="4" Body="&lt;p&gt;Let $x(t)$ denote a real-valued finite-energy signal of energy $E_x$, that is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^\infty |x(t)|^2\,\mathrm dt = E_x &amp;lt; \infty \tag{1}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and let $X(f)$ denote the Fourier transform of $x(t)$.&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem#Notation_used_in_engineering_and_physics&quot; rel=&quot;nofollow&quot;&gt;Parseval's theorem&lt;/a&gt; assures&#xA;us that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^\infty |x(t)|^2\,\mathrm dt = \int_{-\infty}^\infty |X(f)|^2\,\mathrm df \tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and thus the energy $E_x$ can also be computed via the right side of $(2)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the DSB-AM (Double-Side-Band Amplitude-Modulated) &#xA;signal $x(t)\cos(2\pi f_c t)$. Its energy is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;\int_{-\infty}^\infty |x(t)\cos(2\pi f_c t)|^2\,\mathrm dt&#xA;&amp;amp;= \int_{-\infty}^\infty |x(t)|^2|\cos(2\pi f_c t)|^2\,\mathrm dt\\&#xA;&amp;amp;= \frac 12 \int_{-\infty}^\infty |x(t)|^2[1 + \cos(2\pi 2f_c t)]\,\mathrm dt\\&#xA;&amp;amp;= \frac 12 E_x + \int_{-\infty}^\infty |x(t)|^2\cos(2\pi 2f_c t)\,\mathrm dt\tag{3}&#xA;\end{align}$$&#xA;Now, if the value of the integral on the right side of $(3)$ is &lt;em&gt;exactly&lt;/em&gt; zero,&#xA;then the modulated signal $x(t)\cos(2\pi f_c t)$&#xA;has &lt;em&gt;exactly&lt;/em&gt; half the energy of the unmodulated signal $x(t)$.&#xA;In the time domain, it can be plausibly argued that if the integral is&#xA;not identically zero, it is at least very small when $x(t)$ is a&#xA;&lt;em&gt;low-pass&lt;/em&gt; signal and $f_c$ is very large compared to the highest frequency&#xA;in $x(t)$.  Denote by $T = (2f_c)^{-1}$ the period of the double-frequency&#xA;sinusoid in $(3)$ and consider that&#xA;$$\int_{-\infty}^\infty |x(t)|^2\cos(2\pi 2f_c t)\,\mathrm dt&#xA;= \sum_{n=-\infty}^\infty \int_{nT}^{(n+1)T}|x(t)|^2\cos(2\pi 2f_c t)\,\mathrm dt.&#xA;\tag{4}$$&#xA;Now, $x(t)$ is a &lt;em&gt;slowly-varying&lt;/em&gt; signal that does not change very much&#xA;during $[nT, (n+1)T]$ and so&#xA;$$\int_{nT}^{(n+1)T}|x(t)|^2\cos(2\pi 2f_c t)\,\mathrm dt&#xA;\approx |x(nT)|^2 \int_{nT}^{(n+1)T}\cos(2\pi 2f_c t)\,\mathrm dt \approx 0.$$&#xA;Note also that &#xA;$\displaystyle \int \cos(2\pi 2f_c t)\,\mathrm dt &#xA;= -\frac{1}{4\pi f_c}\sin(2\pi 2f_c t)$ so that any contribution from&#xA;$\int_{nT}^{(n+1)T}|x(t)|^2\cos(2\pi 2f_c t)\,\mathrm dt$, which we have&#xA;already argued is going to be small is further tamped down towards $0$ by&#xA;that $\frac{1}{4\pi f_c} &amp;lt;&amp;lt; 1$ factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculations such as these are more easily handled in the frequency&#xA;domain. We have the Fourier transform pair&#xA;$$x(t)\cos(2\pi f_c t) \leftrightarrow &#xA;\left.\left.\frac 12\right[X(f+f_c)+X(f-f_c)\right]$$&#xA;so that Parseval's theorem gives us that&#xA;$$\begin{align}&#xA;\int_{-\infty}^\infty |x(t)\cos(2\pi f_c t)|^2\,\mathrm dt&#xA;&amp;amp;= \frac 14 \int_{-\infty}^\infty |X(f+f_c)+X(f-f_c)|^2\,\mathrm df\\&#xA;&amp;amp;= \frac 14 \left[\int_{-\infty}^\infty |X(f+f_c)|^2\,\mathrm df&#xA;+ \int_{-\infty}^\infty |X(f-f_c)|^2\,\mathrm df&#xA;\right.\\&#xA;&amp;amp;= \qquad \left. + \int_{-\infty}^\infty X(f+f_c)X^*(f-f_c)&#xA;+X^*(f+f_c)X(f-f_c)\,\mathrm df\right]\\&#xA;&amp;amp;= \frac 12 E_x + \frac 14 \left[\int_{-\infty}^\infty X(f+f_c)X^*(f-f_c)&#xA;+X^*(f+f_c)X(f-f_c)\,\mathrm df\right].\tag{5}&#xA;\end{align}$$&#xA;We now argue (as in the comments) that if the &lt;em&gt;support&lt;/em&gt;&#xA;of $X(f)$ is $[-W,W]$ and $f_c &amp;gt; W$, then the supports of&#xA;$X(f+f_c)$ and $X(f-f_c)$ are $[-f_c-W, -f_c+W]$ and&#xA;$[f_c-W, f_c+W]$ respectively, and since $-f_c+W &amp;lt; 0 &amp;lt; f_c-W$,&#xA;the supports do not overlap so that the integrand in $(5)$&#xA;has value $0$ for all $f$. Thus, $f_c &amp;gt; W$ is an explicit sufficient&#xA;condition for the energy in $x(t)\cos(2\pi f_c t)$ to be half of&#xA;the energy in $x(t)$.  The modulation process &quot;loses&quot; half the&#xA;energy because $\cos(2\pi f_c t)$ is a carrier signal of &lt;em&gt;power&lt;/em&gt; $\frac 12$;&#xA;if we had used a unit-power signal such as $\sqrt{2}\cos(2\pi f_c t)$,&#xA;there would be no &quot;loss&quot;.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-05-09T03:28:32.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16123" PostTypeId="1" CreationDate="2014-05-09T09:50:53.220" Score="2" ViewCount="739" Body="&lt;p&gt;Is is possible to use a digital filter (eg. Butterworth) for smoothing sensor data that is sampled at a non-constant rate? The time between two consecutive samples is between 12 to 40 ms.&lt;/p&gt;&#xA;" OwnerUserId="8846" LastActivityDate="2014-05-09T10:26:22.870" Title="Filtering discrete data" Tags="|lowpass-filter|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16124" PostTypeId="1" CreationDate="2014-05-09T10:11:51.120" Score="1" ViewCount="2305" Body="&lt;p&gt;Are there any computer vision libraries in PHP, or any server-side programming languages?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, maybe we can make a list of some -already implemented- methods (Viola Jones face detector, landmark detector etc.) to help someone who wants to implement such a library?&lt;/p&gt;&#xA;" OwnerUserId="8230" LastActivityDate="2014-05-09T12:19:39.933" Title="Computer Vision Libraries for PHP" Tags="|computer-vision|image-processing|face-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16125" PostTypeId="2" ParentId="16123" CreationDate="2014-05-09T10:21:15.107" Score="1" Body="&lt;p&gt;The most naive and easiest method would be to interpolate the data points. If you know what is the maximum frequency present in your signal then you can specify the sampling period. Let's say you pick the lowest possible: &lt;strong&gt;12ms&lt;/strong&gt;. Now you can perform some interpolation of your data. Normally I would suggest you to perform the sinc interpolation, but you can start with linear/spline/cubic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB/Octave you can use the &lt;code&gt;interp1&lt;/code&gt; function to interpolate the data points. If your data is called &lt;code&gt;x&lt;/code&gt;, known time stamps are &lt;code&gt;t&lt;/code&gt;, and new time stamps are &lt;code&gt;t_new&lt;/code&gt;, then you can do the following to calculate new dataset &lt;code&gt;X&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t_new = 0:0.012:max(t); %spaced by 12ms up to maximum value of vector t&#xA;X = interp1(t, x, t_new, 'spline');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is very simple approach but should work - although you might get some aliasing. You can also check out this article for more intelligent methods: &lt;a href=&quot;http://mate.dm.uba.ar/~hafg/papers-sem-05/al-gr-review.pdf&quot; rel=&quot;nofollow&quot;&gt;Nonuniform Sampling and Reconstruction in Shift-Invariant Spaces&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when you have your dataset, you can perform any filtering you like. Can I ask you what your sensor is so it's providing such data?&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-09T10:26:22.870" LastActivityDate="2014-05-09T10:26:22.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16126" PostTypeId="2" ParentId="16095" CreationDate="2014-05-09T11:17:58.413" Score="1" Body="&lt;p&gt;For (a) you just need to know that sampling will create replicas of the original spectrum shifted by multiples of the sampling frequency. But don't forget the negative frequencies. Since $s(t)$ is real-valued, you have $|S(f)|=|S(-f)|$, and you also have to shift the contribution at negative frequencies (which is a mirror image of the part of the spectrum shown in the figure). Considering the frequency range [-70MHz,70MHz], replicas of the positive part of the spectrum (as shown in the figure) occur at $70MHz-k\cdot56MHz$, $k=1,2$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_1=14MHz,\quad f_2=-42MHz$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replicas of the negative part of the original spectrum in the range [-70MHz,70MHz] occur at $-70MHz+kf_s$, $k=1,2$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_3=-14MHz,\quad f_4=42MHz$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the answer to (b) is $f_1=14MHz=70Mhz-f_s$, with the last equality being the answer to (c).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check &lt;a href=&quot;http://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt; for more information on bandpass sampling.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-09T11:17:58.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16127" PostTypeId="1" CreationDate="2014-05-09T12:07:27.780" Score="1" ViewCount="943" Body="&lt;p&gt;I have just read that the Gibbs phenomenon can cause artifacts in the use of Hilbert transforms for audio processing applications, but the reference contained no more specific information.  Can anyone expand on this remark?  When does the Gibbs phenomenon cause problems for the Hilbert transform, and how does one solve this problem?  Specific references to books or articles, and specific examples of signals with difficulties with Gibbs phenomenon for the Hilbert transform, would be appreciated.  Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bruce&lt;/p&gt;&#xA;" OwnerUserId="8847" LastActivityDate="2023-11-11T12:53:29.267" Title="Gibbs phenomenon in Hilbert transform" Tags="|hilbert-transform|gibbs-phenomenon|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16128" PostTypeId="2" ParentId="16124" CreationDate="2014-05-09T12:14:01.300" Score="2" Body="&lt;p&gt;Someone's written a php interface to OpenCV - &lt;a href=&quot;https://github.com/mgdm/OpenCV-for-PHP&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/mgdm/OpenCV-for-PHP&lt;/a&gt;, though I haven't tested it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you've tagged face detection I'll also mention that someone has written a php interface specifically to the face detection functionality of openCV too; &lt;a href=&quot;http://www.xarg.org/project/php-facedetect/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.xarg.org/project/php-facedetect/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you could try (and this would probably offer more flexibility);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Note: this is just a short list; searching e.g. &quot;python image processing&quot; will give more options] &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Python&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://docs.opencv.org/trunk/doc/py_tutorials/py_tutorials.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV bindings&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/ndimage.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;scipy.ndimage&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://scikit-image.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scikit-image&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Java&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV bindings&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://imagej.nih.gov/ij/developer/api/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ImageJ api&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;C++&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://docs.opencv.org/modules/refman.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://cimg.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CImg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1463/good-language-for-computer-vision&quot;&gt;The top answer to this question&lt;/a&gt; also has a good discussion, though I'd be careful about using Matlab in this instance as you might fall foul of their licence restrictions.&lt;/p&gt;&#xA;" OwnerUserId="1718" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-05-09T12:19:39.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16129" PostTypeId="2" ParentId="16118" CreationDate="2014-05-09T13:07:13.080" Score="1" Body="&lt;p&gt;Proposed answer to my own question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_m = \frac{1}{2}(H_m + H^*_m)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_m = \frac{1}{2i}(H_m - H^*_m)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H^*_m$ represents the complex conjugate of $H_m$.&lt;/p&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2014-05-09T13:07:13.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16130" PostTypeId="1" CreationDate="2014-05-09T13:46:41.573" Score="2" ViewCount="1715" Body="&lt;p&gt;I found many readings on &lt;code&gt;Non rigid registration&lt;/code&gt;, also saw some videos but didn't find a clear explanation anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I understood is the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Rigid Registration:&lt;/strong&gt; It is the alignment of two point clouds without changing the shape (ie only by rotation and translation). ICP algorithm is used. The closest point in the other point cloud is assumed to be the corresponding point.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Correspondence detection is not necessary for all the points.&lt;/li&gt;&#xA;&lt;li&gt;All the points are applied the same transformation.&lt;/li&gt;&#xA;&lt;li&gt;Iterative&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Non-rigid registration:&lt;/strong&gt; In this case, the shape of the point cloud might change. But what exactly are we doing? Are we finding the corresponding points using &lt;code&gt;Spin Images&lt;/code&gt;, and then applying separate transformations (translations in this case) for every corresponding point?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Correspondence detection has to be done for all the points.&lt;/li&gt;&#xA;&lt;li&gt;All the points are applied their separate transformations (might be same).&lt;/li&gt;&#xA;&lt;li&gt;Not iterative: Just apply a translation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Piecewise rigid registration:&lt;/strong&gt; We divide the non-rigid point cloud into many rigid parts and then apply separate rigid transformations per part. This lies between rigid and non-rigid registration.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Correspondence detection is done for only some of the points.&lt;/li&gt;&#xA;&lt;li&gt;Same transformation is applied to those points in a particular rigid part, but different parts might have different transformations.&lt;/li&gt;&#xA;&lt;li&gt;Iterative&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Please correct me if I'm wrong somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is there any role of &lt;code&gt;SIFT&lt;/code&gt; in correspondence detection. I've seen some links for SIFT in 3D.&lt;/p&gt;&#xA;" OwnerUserId="8849" LastEditorUserId="8849" LastEditDate="2014-05-13T10:18:43.293" LastActivityDate="2014-06-12T11:13:01.250" Title="What exactly do we do in non-rigid registration?" Tags="|image-registration|point-cloud|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16131" PostTypeId="2" ParentId="16127" CreationDate="2014-05-09T14:09:42.657" Score="5" Body="&lt;p&gt;The Gibbs phenomenon occurs wherever a discontinuous function is approximated by a truncated (Fourier) series. For the design of systems, the Gibbs phenomenon occurs when approximating ideal brick wall filter responses (like low-pass, band-pass, etc.), but also for all-pass systems such as the Hilbert transformer because of its discontinuity at &lt;span class=&quot;math-container&quot;&gt;$\omega=0$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(e^{j\omega})=-j\textrm{ sign}(\omega),\quad |\omega|&amp;lt;\pi\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The impulse response of the ideal discrete-time Hilbert transformer is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h(n)=\left\{\begin{array}{lc}\frac{2}{\pi n},&amp;amp;n\textrm{ odd}\\&#xA;0,&amp;amp; n\textrm{ even}\end{array}\right.\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A naive design approach would be to simply truncate the impulse response given by (2) to obtain an FIR approximation of a Hilbert transformer. The magnitude of the resulting frequency response for an FIR filter with 23 taps is shown by the blue curve in the following figure:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rnVAD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The point '1' on the x-axis is the Nyquist frequency. One can clearly see the Gibbs phenomenon with large ripples near the discontinuity. Note that with an even length filter the approximation would be better around the Nyquist frequency (because such a filter doesn't have a zero at Nyquist), but the Gibbs phenomenon around 0 would remain. The green curve in the figure is the magnitude of the frequency response when the truncated impulse response is windowed by a Hamming window. Clearly, the effect of the Gibbs phenomenon is greatly reduced, but this comes at the expense of a wider transition band.&lt;/p&gt;&#xA;&lt;p&gt;Using more sophisticated methods for designing FIR Hilbert transformers, such as the Parks McClellan algorithm, weighted least squares, or constrained least squares, the Gibbs phenomenon can be avoided. Of course, there will always remain an approximation error, but it can be made sufficiently small by choosing an appropriate filter length. Note that this is not the case when simply truncating the ideal impulse response. In this case, the maximum ripple size near the discontinuity remains the same, regardless of the filter length. Also note that with FIR filters the phase approximation error can be made exactly zero by choosing an anti-symmetric impulse response. The only error is the error in the magnitude of the response, as shown in above figure. This is different from IIR approximations, which can achieve an exact magnitude of 1, but there will always be a phase approximation error. You can find some basics about the design of Hilbert transformers in the textbook &lt;em&gt;Discrete-time Signal Processing&lt;/em&gt; by Oppenheim and Schafer.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2023-11-11T12:53:29.267" LastActivityDate="2023-11-11T12:53:29.267" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16132" PostTypeId="2" ParentId="15961" CreationDate="2014-05-09T14:23:26.160" Score="0" Body="&lt;p&gt;Probably the problem was happening because I was using a filter as long as my signal, so I was getting only the transient instead of the whole filtered result; as Honglei Chen graciously explained in this &lt;a href=&quot;http://www.mathworks.com/matlabcentral/answers/128372-using-sinc-as-a-filter#answer_135959&quot; rel=&quot;nofollow&quot;&gt;thread&lt;/a&gt;. He also suggested to me to use this version of the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;D = 5;&#xA;f0 = 1000;&#xA;fm = 2*f0;    % nyquist reestriction&#xA;t = (-D:1/fm:D-1/fm);&#xA;x = cos(1000*2*pi*t);&#xA;h = sinc(t(3*numel(t)/8:5*numel(t)/8-1));&#xA;x_p = filter(h,1,x);&#xA;plot(x_p);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7316" LastActivityDate="2014-05-09T14:23:26.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16133" PostTypeId="1" AcceptedAnswerId="16134" CreationDate="2014-05-03T02:59:01.473" Score="1" ViewCount="8664" Body="&lt;p&gt;Im trying to generate a sweep sine wave that increases its frequency till an upper limit and then starts decreasing its frequency to the lower limit at the same rate. Im trying to simulate in matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency of the wave will change based on the following formula: f = fmax-a*abs(T - t); a in the formula equals (fmax-fmin)/T&#xA;So the frequency should first increase and then decrease after it reaches time T at the same rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matlab code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freq1 = 20;&#xA;freq2 = 200;&#xA;fs = 44100;&#xA;endTime = 0.1;&#xA;t = 1/fs:1/fs:(endTime*2);&#xA;a = (freq2-freq1)/endTime;&#xA;f = freq2 -   a*abs(endTime - t);&#xA;sinwave = sin(2*pi*f.*t);&#xA;plot(t,sinwave)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems to display a very different result when we plot the value obtained. After T the plot suddenly reverses, changes to original value of frequency and again increases in frequency I am not able to understand this behavior as the frequency seems to give values that increase and then decreases. Please help me understand why the plot for waves shows a different value and how to correct this. (Sorry not able to include plot due to web site restrictions)&lt;/p&gt;&#xA;" OwnerDisplayName="user3453339" LastActivityDate="2014-05-09T14:29:28.307" Title="trying to generate a sweep sine wave that increases its frequency till an upper limit and then starts decreasing its frequency to the lower limit" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16134" PostTypeId="2" ParentId="16133" CreationDate="2014-05-03T09:42:30.687" Score="2" Body="&lt;p&gt;I think that in your simulation, you only calculate the &lt;a href=&quot;http://en.wikipedia.org/wiki/Instantaneous_phase&quot; rel=&quot;nofollow&quot;&gt;instantaneous frequency&lt;/a&gt;, but then fail to compute the phase for the &lt;code&gt;sin()&lt;/code&gt; function correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how you could correct this issue:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% parameters of linear up/down-sweep&#xA;freq1 = 20;&#xA;freq2 = 200;&#xA;fs = 44100;&#xA;&#xA;% length of a sweep in one direction&#xA;endTime = 0.1;&#xA;&#xA;% number of samples of a sweep in one sweep direction&#xA;N = endTime * fs;&#xA;&#xA;% instantaneous frequency at each point in time ...&#xA;% ... first increasing for N points, then decreasing for N points&#xA;inst_f = [linspace(freq1, freq2, N) linspace(freq2, freq1, N)];&#xA;&#xA;% since (in continuous time) instantaneous frequency is derivative of&#xA;% phase, we have to compute the &quot;integral&quot; to get the phase for sin().&#xA;phi = 2 * pi * cumsum(inst_f) / fs;&#xA;sweep = sin(phi);&#xA;&#xA;% plotting&#xA;t = linspace(0, endTime * 2, length(s));&#xA;plot(t, sweep);&#xA;&#xA;% wavwrite(sweep, fs, 32, '~/sweep_delete.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="blackbird" LastActivityDate="2014-05-03T09:42:30.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16135" PostTypeId="1" CreationDate="2014-05-08T14:56:17.580" Score="2" ViewCount="4224" Body="&lt;p&gt;I am trying to segment the nucleus of the cell in an image so I can extract its boundary. The nucleus and the background of the image are very similar so I am finding it difficult to do this using the something like erosion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could suggest a way to remove the background and keep the nucleus that would be very helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aYhrS.png&quot; alt=&quot;cell nucleus&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user3461851" LastActivityDate="2014-05-09T15:02:06.697" Title="Matlab - Segment cell nucleus from similar background" Tags="|matlab|image-processing|image-segmentation|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16136" PostTypeId="2" ParentId="16135" CreationDate="2014-05-08T15:24:36.563" Score="6" Body="&lt;p&gt;You need to work with different color space. Try &lt;a href=&quot;http://en.wikipedia.org/wiki/YCbCr&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;YCbCr&lt;/code&gt;&lt;/a&gt; for instance&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;oimg = imread('https://i.stack.imgur.com/aYhrS.png');&#xA;img = rgb2ycbcr(oimg); % conver RGB to YCbCr color space&#xA;msk = img(:,:,3)&amp;gt;130;  % apply threshold on Cr channel to get segmentation mask&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I picked up 130 as arbitrary threshold, you might need to adjust it a bit.&lt;br&gt;&#xA;Showing the input image, the image region for which &lt;code&gt;msk==1&lt;/code&gt;, and the background:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/v3twB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll leave it to you as an exercise to think why the &lt;code&gt;Cr&lt;/code&gt; channel performed well for this image.&lt;/p&gt;&#xA;" OwnerUserId="7146" OwnerDisplayName="Shai" LastActivityDate="2014-05-08T15:24:36.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16137" PostTypeId="2" ParentId="16135" CreationDate="2014-05-08T15:32:12.220" Score="2" Body="&lt;p&gt;The reason you're running into difficulty is because you're doing a black-white conversion, and this step is &quot;throwing out&quot; your best differentiating feature. Try doing the segmentation in a non b-w color space. The segmentation itself can be done pretty easily using k-means clustering:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = imread('https://i.stack.imgur.com/aYhrS.png');&#xA;imshow(img)&#xA;&#xA;cform = makecform('srgb2lab');&#xA;lab_he = applycform(img,cform);&#xA;&#xA;% classify the colors in 'a*b*' Space Using k-means clustering&#xA;ab = double(lab_he(:,:,2:3));&#xA;nrows = size(ab,1);&#xA;ncols = size(ab,2);&#xA;ab = reshape(ab,nrows*ncols,2);&#xA;&#xA;% Looks like there are ~3 colors in the image&#xA;nColors = 3;&#xA;&#xA;% repeat the clustering 3 times to avoid local minima&#xA;[cluster_idx, cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...&#xA;                                  'Replicates',3);&#xA;&#xA;pixel_labels = reshape(cluster_idx,nrows,ncols);&#xA;&#xA;% nucleus is in the center. figure out what its label is.&#xA;middleX = round(size(img,2)/2);&#xA;middleY = round(size(img,1)/2);&#xA;&#xA;nucleusLabel = pixel_labels(middleX,middleY);&#xA;&#xA;figure&#xA;tempImg = bsxfun(@eq,pixel_labels,nucleusLabel);&#xA;tempImg = bsxfun(@times,double(tempImg),double(img));&#xA;&#xA;imshowpair(img,tempImg/max(tempImg2(:)),'montage')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VdJxj.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="ChuckN" LastActivityDate="2014-05-08T15:48:10.407" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16138" PostTypeId="2" ParentId="16118" CreationDate="2014-05-09T18:08:59.090" Score="1" Body="&lt;p&gt;Note that even though&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_m=F_m+iG_m$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F_m$ and $G_m$ are NOT the real and imaginary parts of $H_m$, respectively. In general they are both complex sequences. Only $f_n$ and $g_n$ are real-valued, so in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n=f_n+ig_n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_n$ and $g_n$ really denote the real and imaginary parts of $h_n$. Now you need to know that for a real-valued sequence $x_n$ of length $N$ its DFT satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_k=X^*_{N-k}\tag{1}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, the DFT of a purely imaginary sequence $x_n$ satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_k=-X^*_{N-k}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) and (2) it follows that the DFT of the real part of a complex sequence $h_n$ corresponds to the &lt;em&gt;even part&lt;/em&gt; of its DFT, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_m=\frac{1}{2}[H_m+H^*_{N-m}]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the DFT of its imaginary part corresponds to the &lt;em&gt;odd part&lt;/em&gt; of $H_m$ (divided by $j$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_m=\frac{1}{2j}[H_m-H^*_{N-m}]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that both $F_m$ and $G_m$ satisfy (1) because both correspond to real-valued sequences $f_n$ and $g_n$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-09T18:08:59.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16139" PostTypeId="1" AcceptedAnswerId="16142" CreationDate="2014-05-09T18:35:44.637" Score="2" ViewCount="1136" Body="&lt;p&gt;I'm trying to figure out what a good DSP unit would be to try and learn how to do some embedded programming on? I would like something relatively inexpensive but that still has a decent amount of &quot;kick&quot; to it performance wise. I was looking at the TI ez-DSP but I don't know what to think of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like it to be programmable with C or C/C++&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would Prefer 32 bit or higher.(if possible)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fixed point math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something in the Ghz clock speed.(once more if possible)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Support for hardware modulo would be a plus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are many other considerations to take into account and some of the things I have specified may not be possible to get all in one unit especially at a low cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be using it for Audio Processing and Audio Signal Generation So if a unit exists that is either compatible with ADC and DAC units or has them built in would be good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am open for any recommendations or any advice at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks In advance, Alex&lt;/p&gt;&#xA;" OwnerUserId="8658" LastEditorUserId="8658" LastEditDate="2014-05-09T22:15:16.953" LastActivityDate="2014-05-15T07:31:36.033" Title="Recommendations for DSP Hardware" Tags="|dsp-core|c|embedded-systems|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16142" PostTypeId="2" ParentId="16139" CreationDate="2014-05-09T23:39:05.307" Score="6" Body="&lt;p&gt;Since what interests you is the &quot;embedded system&quot; part, and since you have a low budget (this excludes anything that requires proprietary compilers), I'd recommend building yourself a board with an ARM MCU and a codec, &lt;a href=&quot;http://ebrombaugh.studionebula.com/synth/stm32f4_codec/&quot; rel=&quot;noreferrer&quot;&gt;like this one&lt;/a&gt;. There's less than $50 of parts - the processor, the codec and the bare minimum to get them to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm recommending this because you can easily grab a FOSS toolchain for arm-none-eabi, because these chips have a serial bootloader which allows them to be programmed with a $2 FTDI dongle, and because they have enough flash and RAM onboard for many applications - so you don't have to deal with the complications of an external RAM or flash chip. For a beginner, it's good to have a small self-contained, system you can entirely master!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll learn how to set up a toolchain for an embedded processor, how to use a JTAG or serial interface to flash the chip, how to configure the peripherals and hardware for your application, and you'll write code in a relatively basic environment. It'll be a fun experience! The STM32F4 is good enough to implement audio effects and 6-10 voices of audio synthesis (Used in: the Owl stompbox, Audio Damage and Make Noise Eurorack modules, DIY synth projects like PreenFM2, Audiothingies P6, or Sonic Potions LXR). UAD needs a lot of computing power because they emulate analog hardware at the component level. You are not going to do that. To give you an idea of what's possible, the STM32F4 can run about 250 biquad filters or 100 wavetable oscillators or a phase vocoder with 75% overlap. This is a general purpose architecture, but there are DSP-ish things like saturation or MAC instructions that make the generated code relatively compact on audio DSP applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this won't teach you are the specifics of VLIW architectures, and the art of writing assembly for such architectures. For that, you'd need a proper DSP board from AD or TI, but this costs more, and once you build something with their devboards it's more expensive and complicated to replicate it on your own board. You can partly capture this experience with a &lt;a href=&quot;http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DM330011&quot; rel=&quot;noreferrer&quot;&gt;dsPIC&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another cheap toy you could play with: &lt;a href=&quot;http://www.elektor.com/adau1701-universal-audio-dsp-board-130232-71&quot; rel=&quot;noreferrer&quot;&gt;ADAU1701 board&lt;/a&gt;. It has a built-in AD/DA. Downside: it can only be programmed through AD's drag and drop tool, with building blocks like filters, dynamic processors... Elektor also has a spin FV-1 board - it's a very peculiar minimalistic chip that can be mastered in a few hours. Might be worth exploring if you like vintage reverbs.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-05-09T23:53:21.473" LastActivityDate="2014-05-09T23:53:21.473" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="16143" PostTypeId="1" AcceptedAnswerId="16145" CreationDate="2014-05-09T23:47:05.023" Score="2" ViewCount="181" Body="&lt;p&gt;I have the following block diagram&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/syZEE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that it's solution is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dfrac{10 K_p}{Js^2+(B+2K_pK_v)s+10K_p} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I try to derive the solution with reduction rules I get different result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assumptions: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$5$ and $K_vs$ are in parallel: $(5+K_vs)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$K_p \cdot \dfrac{2}{(Js+B)s}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;result: $$\dfrac{K_p \cdot \dfrac{2}{(Js+B)s}}{1 + K_p \cdot \dfrac{2}{(Js+B)s} + (5+K_vs)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="8855" LastEditorUserId="8202" LastEditDate="2014-05-10T17:50:03.917" LastActivityDate="2014-05-13T12:39:33.213" Title="Block diagram reduction" Tags="|theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16144" PostTypeId="2" ParentId="16113" CreationDate="2014-05-10T01:53:50.390" Score="2" Body="&lt;p&gt;It would be helpful to study the following 2 references:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] F. J. Harris, “On the Use of Windows for Harmonic Analysis with the Discrete Fourier&#xA;Transform,” Proc. IEEE, vol. 66, no. 1, Jan. 1978, pp. 51-83.  It is also available at:&#xA;&lt;a href=&quot;http://web.mit.edu/xiphmont/Public/windows.pdf&quot; rel=&quot;nofollow&quot;&gt;http://web.mit.edu/xiphmont/Public/windows.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] L. R. Rabiner, B. Gold, Theory and Application of Digital Signal Processing, Englewood Cliffs, NJ, Prentice-Hall, 1975. (Section 3.11 on pps. 93-94 refer to the Kaiser window, and Figs. 3.15 (p. 96) and 3.16 (p. 97) show a time and frequency domain 257 point Kaiser window, respectively).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference [1] above is the classic windows paper by Harris.  It is a good learning experience to compute the examples of windows from that paper and try to duplicate his graphs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First order of business – is it a Kaiser window as shown in ref. [2], or a Kaiser-Bessel window, as shown in ref. [1]?  No problem – both authors use Bessel functions when calculating the window, so either term is probably correct, depending on who you talk to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But wait a minute – the window calculation in [1] (eq. 46a, p. 73) is different than in [2] (eq. 3.54 on p. 94)!  One of them goes from -(N-1)/2 to (N-1)/2 and the other goes from 0 to &amp;lt;= |N/2|.  If the former is to be calculated correctly, N has to be an odd number, and for the latter, N has to be an even number. And yet, for both, adding in the zero point means that BOTH windows will have an odd number of total points!  And as if that weren't bad enough, the equations differ in other ways – [1] uses pi*alpha, while [2] uses beta.  And a denominator in [2] uses an N-1, whereas [1] uses N.  So which one is correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer lies in: what is the window being used for?  In [2], it is being used for a FIR filter.  As clearly noted in [1, p. 52, two paragraphs beginning with: “Since the DFT essentially considers sequences to be periodic, ...], windows for FIR filters have a different symmetry from those used in a DFT, and the latter have to be shifted by N/2 points.  The author of [1] identifies this as “a major source of window misapplication.”&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you'd better be sure that the window you're calculating is the right one (e.g.: eq. 46a in [1], appropriately right-shifted, and with the proper symmetry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing you have to be careful about is whether your window point calculations are for an odd or even N.  Whenever you see a -(N-1)/2 to (N-1)/2 range, it's probably odd (try to plug an even N into the indexes, and the end points are fractions).  If you see an N/2 somewhere, it's most likely for an even N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I recall, when calculating eq. 46a in [1], I programmed it using -(N-1)/2 to (N-1)/2 and then right shifted the result.  I wasn't quite sure I had the symmetry right, but after experimenting with a few different ways of calculating things, I concluded that I was using enough points such that I got only minor differences in the end results when trying different calculations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windows can be confusing at times.  Perhaps the best thing to do is to read [1] again and again and again – there are all kinds of things that you may not understand at first, and it takes time to become comfortable with some difficult concepts.  And it helps to know about papers written by other authors that correct some of the minor errors in [1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for zero-padding, if you do so (presumably by appending zeros to your time domain window), it will provide you with an interpolation of your frequency domain points.  I usually do that because it allows me to see the sidelobe structure more clearly.  Padding by 2 or 4 or 8, etc. is typical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for plotting – that's another area where you can make a lot of mistakes.  First, compute magnitude squared of your FFT results.  Then, normalize the data such that all your amplitudes are in dB relative to W(0).  Something like 10log10[W(n)/W(0)] (depending on how you're scaling things).  Your highest plot point should be W(0) at zero dB, and all the rest negative.  This is the way windows are almost always depicted in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the frequency axis, well, you can plot versus log(f) – it would make it easier to see the asymptotic decay of the sidelobes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you could always cheat (not recommended) by using the approximation for the frequency response shown in eq. 46b on p. 73 in [1].  Or just look at the table for Kaiser-Bessel on p. 55, which shows a -6 dB roll-off rate for the various Kaiser windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. - I have no idea who downvoted this question – seems to me to be the type of thing that a lot of practitioners would want to know.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2014-05-10T01:53:50.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16145" PostTypeId="2" ParentId="16143" CreationDate="2014-05-10T10:06:53.007" Score="2" Body="&lt;p&gt;I believe that it will be worth for many people to do it from scratch. Let's call the signal after input and feedback summation $E(s)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GH6DX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then question arises what $E(s)$ is equal to? Well that's simple:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E(s)=5R(s)-(5+K_vs)C(s) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have our backward path, now the forward one. What $C(s)$ is equal to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s)=E(s)K_p \dfrac{2}{(Js+B)s} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's substitute previously calculated $E(s)$ to the above equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s)=\dfrac{2}{(Js+B)s}K_p[5R(s)-(5+K_vs)C(s)] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because we have our output $C(s)$ on both sides of the equation, we must eliminate that. Expand the right side of the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s)=\dfrac{2}{(Js+B)s}5K_p\cdot R(s)-\dfrac{2}{(Js+B)s}K_p(5+K_vs)C(s) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now move the part with $C(s)$ to the left side and move it before parenthesis, this yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s) \left[1+ \dfrac{2}{(Js+B)s}K_p(5+K_vs)\right]=\dfrac{2}{(Js+B)s}5K_p\cdot R(s) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can divide right side of the equation by the factor from the left side:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s) =  \dfrac{\dfrac{2}{(Js+B)s}5K_p}{1+ \dfrac{2}{(Js+B)s}K_p(5+K_vs)}\cdot R(s) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great! Now we have direct relation between the input and the output. Let's make this fraction more pleasant:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s) =  \dfrac{\dfrac{10K_p}{(Js+B)s}}{1+ \dfrac{10K_p+2K_pK_vs}{(Js+B)s}}\cdot R(s) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now expand the one in denominator to: $\dfrac{(Js+B)s}{(Js+B)s} $, and add it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s) =  \dfrac{\dfrac{10K_p}{(Js+B)s}}{\dfrac{(Js+B)s + 10K_p+2K_pK_vs}{(Js+B)s}}\cdot R(s) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can now remove common $(Js+B)s$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s) =  \dfrac{10K_p}{(Js+B)s + 10K_p+2K_pK_vs}\cdot R(s) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally let's do one last multiplication:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s) =  \dfrac{10K_p}{Js^2+Bs + 10K_p+2K_pK_vs}\cdot R(s) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And voila!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(s) =  \dfrac{10K_p}{Js^2+ s(B +2K_pK_v)+ 10K_p}\cdot R(s) $$&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-13T12:39:33.213" LastActivityDate="2014-05-13T12:39:33.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16146" PostTypeId="1" CreationDate="2014-05-10T12:14:25.483" Score="1" ViewCount="433" Body="&lt;p&gt;I'm implementing a dictionary learning algorithm for doing sparse coding on images and I have a problem how to learn a dictionary corresponding to several iamges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let’s say X is the data matrix. If I apply dictionary learning only to one image then X is equal to the image. But what if I want to learn the dictionary for several images ? Should I in this case just put all images into X, i.e. X = [image1, image2, image3…]?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach I thought of was to learn a dictionary for each image separately and then decide online which dictionary to use (by e.g. comparing histograms or some similarity measures to decide to which training image the new input image is most similar to and then choosing the corresponding dictionary).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What appraoch should I use?&lt;/p&gt;&#xA;" OwnerUserId="8756" LastActivityDate="2016-12-03T06:08:15.373" Title="How to apply dictionary learning to several images?" Tags="|image-processing|machine-learning|image-compression|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16147" PostTypeId="1" AcceptedAnswerId="16150" CreationDate="2014-05-10T15:58:45.743" Score="0" ViewCount="421" Body="&lt;p&gt;Assume an arbitrary (discrete) signal that is periodic and known over a whole period. I need a way to select a characteristic point along the signal such that I can always retrieve it even when the signal is phase shifted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Candidates could be zero crossings or extrema or inflections... provided they exist and are unique or can be discriminated from others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the position of the maximum would work well for a triangle wave, a little less accurately for sinusoid and would raise an ambiguity for $\sin x+\frac13\sin 3x$ as this one has two maxima of equal height.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method should be robust to noise and work for relatively smooth signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know any general feature/formula having the desired properties ?&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2014-05-10T18:42:15.237" Title="Phase reference of a periodic signal" Tags="|phase|local-features|periodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16148" PostTypeId="1" CreationDate="2014-05-10T16:06:28.913" Score="-1" ViewCount="1193" Body="&lt;p&gt;Multiplications of time domain vectors of two signals is equivalent to convolutions in frequency domain and also use circular convolutions for when FIR filter design using window method in frequency. if working  Discrete Fractional Fourier transform (DFRFT)   i.e. on bins  between time and frequency domain then which is proper operation (multiplication, convolution or any other operational treatment) gives same effect for FIR filter design using window when DFRFT of window function and FFT of Ideal filter is taken? Please explain with example if possible.         &lt;/p&gt;&#xA;" OwnerUserId="8463" LastEditorUserId="128" LastEditDate="2020-03-11T06:34:33.610" LastActivityDate="2020-03-11T06:34:33.610" Title="Properties of Circular Convolution" Tags="|image-processing|matlab|discrete-signals|convolution|time-frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16149" PostTypeId="2" ParentId="16130" CreationDate="2014-05-10T16:09:49.253" Score="0" Body="&lt;p&gt;Registration is the recovery of a spatial transform that applies one data set (can be a point cloud) onto another. The spatial transform can include rigid motion (no deformation) and deformation; in the case of piecewise rigid deformation, the system is a mechanism, i.e. a number of rigid parts having different motions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whatever the case, the transformations are described by a number of degrees of freedom (translation, rotations, shrinking, locations of control points...) and associated parameters. The registration process uses information from the original and transformed data sets to estimate the parameters associated to these DOF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when registering appoint cloud onto another with known correspondences, every point pair gives a transformation equation, which can be used to resolve one DOF. Usually there a more equations than unknown parameters, and (robust) fitting techniques are used, such as RANSAC.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2014-05-10T16:09:49.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16150" PostTypeId="2" ParentId="16147" CreationDate="2014-05-10T16:15:19.920" Score="0" Body="&lt;p&gt;Compute a DFT of your signal over a period of $T$ samples, extract the phase $\phi$ (in the $[0, 2\pi[$ range) of the first harmonic, and use the point $\frac{2\pi-\phi}{2 \pi}T$ as your landmark.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will not correspond to a particular characteristic landmark in the time-domain waveform; but the procedure to retrieve it is by design invariant to phase shifts, distortion adding higher harmonics, and to a large extent noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s803Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the waveform of your signal is known in advance you can also use it as a template, and select as a landmark the lag, in samples, at which the cross-correlation between your observed period and your template is maximal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Python code here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;import pylab&#xA;&#xA;def shift(s, k):&#xA;  n = s.shape[0]&#xA;  return s[(numpy.arange(n) + k) % n]&#xA;&#xA;T = 256&#xA;t = numpy.arange(0.0, T) / T&#xA;&#xA;original = numpy.sin(t * 2 * numpy.pi) + numpy.sin(3 * t * 2 * numpy.pi) / 3&#xA;time_shifted = shift(original, 40)&#xA;distorted = shift(original + original ** 3, 200)&#xA;noisy = shift(original + numpy.random.randn(1, T).ravel() * 0.2, 180)&#xA;&#xA;signals = [original, time_shifted, distorted, noisy]&#xA;&#xA;for i, s in enumerate(signals):&#xA;  pylab.subplot(411 + i)&#xA;  pylab.plot(s)&#xA;&#xA;  # Phase of first harmonic method.&#xA;  first_harmonic_coefficient = numpy.fft.rfft(s)[1]&#xA;  angle_2pi = -numpy.angle(first_harmonic_coefficient) + 2 * numpy.pi&#xA;  angle_2pi = angle_2pi % (2 * numpy.pi)&#xA;  landmark = numpy.round(angle_2pi / (2 * numpy.pi) * T)&#xA;  pylab.plot(landmark, 0, 'r+')&#xA;&#xA;  # Cross-correlation method.&#xA;  xcorr = numpy.fft.irfft(numpy.fft.rfft(s) * numpy.fft.rfft(original))&#xA;  landmark = numpy.argmax(xcorr)&#xA;  pylab.plot(landmark, 0, 'g*')&#xA;&#xA;pylab.savefig('plot.png')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-05-10T18:42:15.237" LastActivityDate="2014-05-10T18:42:15.237" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16151" PostTypeId="1" CreationDate="2014-05-10T18:38:21.027" Score="0" ViewCount="186" Body="&lt;p&gt;Laplace&amp;amp;Z transform is just frequency analysis of a system with a multiplication of decaying exponential.  We analyse frequency with varying Laplace Exponential, which can be seen in the formula below for laplace transfrom. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BVimf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my simple aspect I can't make the theoretical connection, how inspecting frequency  with decaying exponential helps with understanding how system will behave? And how it helps with coping with differential functions for example &quot;Analysis of Electric Circuits&quot;. And even with IIR filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What further surprises me the things laplace&amp;amp;Z transforms used. They seem to me completely different .But somehow multiplying the system with decaying exponential works for them all. &#xA;The only similarity I see between; for example RLC curcuits and IIR filters is; these systems are not memoryless(output depends on prev. outputs). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I search the net I see only laplace-table's, questions etc.. I don't want to solve a problem, I want to understand the problem. If somebody can explain or direct me to a link I will be thankful. &lt;/p&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="4243" LastEditDate="2015-03-01T18:12:33.720" LastActivityDate="2015-03-01T18:12:33.720" Title="Connection with system analysis and laplace&amp;Z transform" Tags="|transform|z-transform|laplace-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16152" PostTypeId="2" ParentId="3106" CreationDate="2014-05-10T19:05:52.897" Score="0" Body="&lt;pre&gt;&lt;code&gt;VideoCapture capture;&#xA;    capture.open(CV_CAP_OPENNI);&#xA;    capture.set( CV_CAP_PROP_OPENNI_REGISTRATION , 0);&#xA;    unsigned t0=clock();  &amp;lt;======= what is clock identifier?&#xA;    if( !capture.isOpened() ){&#xA;        cout &amp;lt;&amp;lt; &quot;Can not open a capture object.&quot; &amp;lt;&amp;lt; endl;&#xA;        return -1;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8862" LastEditorUserId="8202" LastEditDate="2014-05-10T23:27:51.323" LastActivityDate="2014-05-10T23:27:51.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16153" PostTypeId="1" AcceptedAnswerId="16820" CreationDate="2014-05-10T20:51:07.207" Score="4" ViewCount="825" Body="&lt;p&gt;I am trying to make &lt;code&gt;filters&lt;/code&gt; for days but now I just want to know the experience of others rather than go on to wrong way and finally decided to put my query over here with full detail rather then short question of every day . What is the best way of making image filters like Instagram or aviary or many other photo editing application , Can we make it using &lt;code&gt;OpenCV&lt;/code&gt; or we need to make them by using operation on &lt;code&gt;bitmaps&lt;/code&gt; like simple color operations of giving weights to them.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How they made the filters?&lt;/li&gt;&#xA;&lt;li&gt;What is the logic behind it?&lt;/li&gt;&#xA;&lt;li&gt;How we can perform the same operation?&lt;/li&gt;&#xA;&lt;li&gt;Whats the best way of making them?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I read &lt;a href=&quot;http://www.quora.com/Instagram/How-does-Instagram-develop-their-filters&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quora - How Does Instagram Develop Their Filters?&lt;/a&gt;, but it didn't give the best way to operate with the tool for android . I don't even know that this question is right for this forum or not , but I just want to consult the algorithms , the best way to do it for android and simple the way from which I need to start ? I saw simple &lt;a href=&quot;http://answers.opencv.org/question/30328/how-to-implement-filters/&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV - How to Implement Sepia Filter&lt;/a&gt; operation but its not easy to find that type of values for other filters like which we want to make like other colored shades in which only little effect can change the whole look of the image and the last thing is it the helpful if we make filters in Photoshop and then follow the steps in our program.&lt;/p&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5057" LastEditorUserId="7092" LastEditDate="2021-05-27T12:18:23.213" LastActivityDate="2021-05-27T12:18:23.213" Title="How to Create Image Editing Filters" Tags="|filters|computer-vision|image-processing|opencv|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16154" PostTypeId="1" CreationDate="2014-05-10T20:54:52.617" Score="-1" ViewCount="239" Body="&lt;p&gt;I'm experimenting with linear predictive coding as a low-complexity audio compression method, and I'm observing something very odd. I'm compressing a 20 MB mono 16-bit PCM song in different block sizes using 2-sample LPC (increasing the number of samples appears to benefit little compression-wise). The optimal block size appears to be 32k samples, which yields the lowest standard deviation of output samples; going lower than that increases the standard deviation and by 64 samples it's 4x as large as for 32k samples. I don't understand why this would be. Shouldn't a smaller sample size yield a tighter fit to the local data and give higher predictive accuracy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the functions I wrote to compute the coefficients. Note that it's a prototype that uses floats for convenience:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define ADD_INDEX(x, add, size) ((x) + (add) - ((x) + (add) &amp;gt;= (size) ? (size) : 0))&#xA;#define SUB_INDEX(x, sub, size) ((x) - (sub) + ((x) &amp;lt; (sub) ? (size) : 0))&#xA;&#xA;void ComputeCovars(const short samples[], size_t numSamples, short prevSamples[], size_t prevIdx, size_t numCovars, float covars[])&#xA;{&#xA;    float mean = 0.0f;&#xA;    for (size_t i = 0; i &amp;lt; numCovars; i++)&#xA;        mean += prevSamples[i];&#xA;    for (size_t i = 0; i &amp;lt; numSamples; i++)&#xA;        mean += samples[i];&#xA;    mean /= numSamples + numCovars;&#xA;&#xA;    for (size_t i = 0; i &amp;lt; numSamples; i++)&#xA;    {&#xA;        float sample = (float)samples[i] - mean;&#xA;&#xA;        covars[0] += sample * sample;&#xA;        for (size_t j = 0; j &amp;lt; numCovars; j++)&#xA;            covars[j + 1] += sample * ((float)prevSamples[SUB_INDEX(prevIdx, j + 1, numCovars)] - mean);&#xA;&#xA;        prevSamples[prevIdx] = samples[i];&#xA;        prevIdx = ADD_INDEX(prevIdx, 1, numCovars);&#xA;    }&#xA;}&#xA;&#xA;void ComputeLinearCoeffs(const float covars[], size_t numCovars, float coeffs[])&#xA;{&#xA;    for (size_t i = 0; i &amp;lt; numCovars; i++)&#xA;        coeffs[i] = 0.0f;&#xA;&#xA;    switch (numCovars)&#xA;    {&#xA;        case 1:&#xA;            coeffs[0] = covars[1] / covars[0];&#xA;            break;&#xA;&#xA;        case 2:&#xA;        {&#xA;            float a = covars[0], b = covars[1], c = covars[1], d = covars[0],&#xA;                y = covars[1], z = covars[2],&#xA;                det = (a * d - b * c),&#xA;                A = d, B = -b, C = -c, D = a;&#xA;&#xA;            coeffs[0] = (A * y + B * z) / det;&#xA;            coeffs[1] = (C * y + D * z) / det;&#xA;&#xA;            break;&#xA;        }&#xA;&#xA;        case 3:&#xA;        {&#xA;            float a = covars[0], b = covars[1], c = covars[2], &#xA;                d = covars[1], e = covars[0], f = covars[1], &#xA;                g = covars[2], h = covars[1], i = covars[0],&#xA;                x = covars[1], y = covars[2], z = covars[3],&#xA;                det = a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g),&#xA;                A = e * i - f * h, B = f * g - d * i, C = d * h - e * g,&#xA;                D = c * h - b * i, E = a * i - c * g, F = b * g - a * h,&#xA;                G = b * f - c * e, H = c * d - a * f, I = a * e - b * d;&#xA;&#xA;            coeffs[0] = (A * x + D * y + G * z) / det;&#xA;            coeffs[1] = (B * x + E * y + H * z) / det;&#xA;            coeffs[2] = (C * x + F * y + I * z) / det;&#xA;&#xA;            break;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the code that gets executed on each block:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fill_n(autovars, nPredSamples + 1, 0.0f);&#xA;ComputeCovars(pnSrcBuffer, nSamples, workBuff, iSample, nPredSamples, autovars);&#xA;ComputeLinearCoeffs(autovars, numCoeffs, coeffs);&#xA;&#xA;for (int i = 0; i &amp;lt; nSamples; i++)&#xA;{&#xA;    float pred = 0;&#xA;    for (int j = 0; j &amp;lt; numCoeffs; j++)&#xA;        pred += coeffs[j] * samples[SUB_INDEX(iSample, j + 1, numCoeffs)];&#xA;&#xA;    samples[iSample] = pnSrcBuffer[i];&#xA;    pnSrcBuffer[i] -= short(pred + (pred &amp;gt;= 0.0f ? 0.5f : -0.5f));&#xA;    iSample = ADD_INDEX(iSample, 1, numCoeffs);&#xA;&#xA;    var += pnSrcBuffer[i] * pnSrcBuffer[i];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there some rational reason for this behavior, or is there a stupid bug in my code, or what?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I've rewritten part of the method to prevent knees at the buffer borders, but the same general problem remains.&lt;/p&gt;&#xA;" OwnerUserId="5592" LastEditorUserId="5592" LastEditDate="2014-05-13T06:17:44.923" LastActivityDate="2015-03-11T13:41:12.510" Title="Linear Predictive Coding and Block Size" Tags="|audio|compression|linear-prediction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16155" PostTypeId="2" ParentId="16151" CreationDate="2014-05-10T21:33:50.540" Score="4" Body="&lt;p&gt;You are right that the (bilateral) Laplace transform can be interpreted as the Fourier transform of $e^{-\sigma t}f(t)$. However, I think that the significance of the Laplace transform only becomes clear when $s=\sigma+j\omega$ is viewed as a complex variable because then we can study the analytic properties of the system function. E.g., electrical networks are characterized by the poles and zeros (in the complex $s$-plane) of their system function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The practical importance of the Laplace transform for the analysis of continuous systems lies in the fact that it transforms linear differential equations with constant coefficients into algebraic equations, which are obviously much easier to solve. This is achieved by the fact that in the Laplace transform domain, integration is equivalent to multiplication by $1/s$, and differentiation becomes multiplication with $s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any &lt;em&gt;linear time-invariant&lt;/em&gt; (LTI) system, such as the RLC-circuit you mentioned, will result in linear differential equations with constant coefficients. This is why any LTI system can be analyzed by the Laplace transform. Note that in practice usually the unilateral transform is used (where the integral starts at $t=0$ instead of $t=-\infty$), because practical systems are causal, and because in this way initial conditions (such as charged capacitors at $t=0$) can be easily taken into account. The unilateral Laplace transform is thus an appropriate tool to solve initial value problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything said so far carries over to the $\mathcal{Z}$-transform if you replace 'continuous system' by 'discrete system', and 'differential equation' by 'difference equation'. Linear time-invariant discrete systems consisting of adders, multipliers and delay elements are treated by the $\mathcal{Z}$-transform in the same way as LTI electrical networks are treated by the Laplace transform. And indeed, IIR filters are analogous to RLC circuits in the sense that both have an infinitely long impulse response and that both can be characterized by the poles and zeros of their system functions.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-10T21:33:50.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16157" PostTypeId="1" AcceptedAnswerId="28502" CreationDate="2014-05-10T23:56:14.377" Score="0" ViewCount="794" Body="&lt;p&gt;I intend to whiten the spectrum of a time series using a point-wise normalization in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my first test, it looks pretty good.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure;&#xA;n = 2e3;&#xA;t = 1:n;&#xA;m = n/2+1;&#xA;f = linspace(0,1,m);&#xA;x = rand(1,n) - 0.5;&#xA;y = fft(x);&#xA;subplot(2,2,1); plot(t,x,'k'); &#xA;axis tight; xlabel('t/s'); title('original signal x');&#xA;subplot(2,2,2); plot(f,abs(y(1:m)),'k'); &#xA;axis tight; xlabel('f/hz'); title('original spectrum');&#xA;y1 = y ./ abs(y);&#xA;x1 = real(ifft(y1));&#xA;y2 = fft(x1);&#xA;x2 = real(ifft(y2));&#xA;subplot(2,2,3); plot(t,x1,'k',t,x2-x1,'r'); &#xA;axis tight; xlabel('t/s'); title('whitened signal x1(black) and x2-x1(red)');&#xA;subplot(2,2,4); plot(f,abs(y1(1:m)),'k',f,abs(y2(1:m)),'r');&#xA;axis tight; xlabel('f/hz'); title('whitened spectrum y1(black) and y2(red)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The spectrum is flat after whitening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CAQBb.jpg&quot; alt=&quot;figure1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I windowed the spectrum, sth strange happened.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure;&#xA;n = 2e3;&#xA;t = 1:n;&#xA;m = n/2+1;&#xA;f = linspace(0,1,m);&#xA;x = rand(1,n) - 0.5;&#xA;y = fft(x);&#xA;subplot(2,2,1); plot(t,x,'k'); &#xA;axis tight; xlabel('t/s'); title('original signal x');&#xA;subplot(2,2,2); plot(f,abs(y(1:m)),'k'); &#xA;axis tight; xlabel('f/hz'); title('original spectrum');&#xA;y1 = y ./ abs(y);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;k = n/10;&#xA;w = sin(linspace(0,pi/2,k));&#xA;y1(1:k) = y1(1:k) .* w;&#xA;y1(m:-1:m-k+1) = y1(m:-1:m-k+1) .* w;&#xA;y1(n-m+3:n) = y1(m-1:-1:2);    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x1 = real(ifft(y1));&#xA;y2 = fft(x1);&#xA;x2 = real(ifft(y2));&#xA;subplot(2,2,3); plot(t,x1,'k',t,x2-x1,'r'); &#xA;axis tight; xlabel('t/s'); title('whitened signal x1(black) and x2-x1(red)');&#xA;subplot(2,2,4); plot(f,abs(y1(1:m)),'k',f,abs(y2(1:m)),'r');&#xA;axis tight; xlabel('f/hz'); title('whitened spectrum y1(black) and y2(red)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As shown in subplot 3, x1 and x2 are the same (the difference is zero; see red line), but their spectrum in subplot 4 (black and red) is different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After IFFT y1 to x1 and FFT x1 to y2, y2 differs from y1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5kYVf.jpg&quot; alt=&quot;figure2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8863" LastEditorUserId="8863" LastEditDate="2016-01-27T11:11:28.143" LastActivityDate="2016-01-27T11:11:28.143" Title="A problem about whitening of a signal" Tags="|fft|frequency-spectrum|signal-analysis|ifft|" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="16158" PostTypeId="1" AcceptedAnswerId="16159" CreationDate="2014-05-11T01:53:52.953" Score="2" ViewCount="248" Body="&lt;p&gt;I don't have a thorough background in Signal processing and require some information for an application pertaining to computer science. &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.27.8227&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Minimum Entropy Blind Signal Deconvolution with Non Minimum&#xA;Phase FIR Filters&lt;/a&gt; paper proposes to use entropy for blind system identification. My questions are the following based on terms that I cannot follow in the paper and shall be grateful for detailed explanation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: What does minimum phase filter mean? In my understanding phase of a signal means the angular displacement or the angle $\theta$ that appears in an equation like &#xA;$x=A sin (\omega*t + \theta)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: What is an inverse filter? How is it related to convolution and deconvolution?&lt;/p&gt;&#xA;" OwnerUserId="780" LastActivityDate="2014-05-11T07:23:50.543" Title="Conceptual questions from signal processing" Tags="|deconvolution|system-identification|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16159" PostTypeId="2" ParentId="16158" CreationDate="2014-05-11T02:00:37.963" Score="3" Body="&lt;p&gt;We will be talking about linear time-invariant systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A minimum phase filter is one which is causal and stable and its inverse is causal and stable. In the case of a discrete time system, you have all the poles and zeros of the transfer function within the unit circle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) An inverse filter of a filter with transfer function $H(z)$ is a filter $G(z)$ such that $H(z) G(z) = 1$ -- that is, when you cascade the filter with its inverse filter, its the identity filter. In the z-transform domain, multiplication corresponds to convolution in the time domain. So, if your input is $X(z)$, and your filter is $H(z)$ and your output is $Y(z)$, the relation is $Y(z) = H(z) X(z)$ in the z-transform domain, while in the time domain, $y[n] = h[n] * x[n]$ where $*$ denotes convolution and $h$ is the impulse response of the filter. The inverse filter convolves with the impulse response corresponding to $1/H(z)$ (that is, you take the output $y$ and find an input which when convolved with $h$ gives the output -- i.e. deconvolution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find more details in any introductory Digital Signal Processing text like Discrete-Time Signal Processing by Oppenheim, Schafer and Buck (now in its 3rd edition).&lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-05-11T02:00:37.963" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16161" PostTypeId="1" AcceptedAnswerId="16164" CreationDate="2014-05-11T04:33:51.940" Score="3" ViewCount="2083" Body="&lt;p&gt;Ok, so I recently started playing around with an SDR in an effort to challenge and educate myself. So, let's say the sampling rate (Fs) is 3MHz and of those we grab 3M samples. Now we are left with 3M samples consisting each of an IQ pair. Complex data. My understanding is that I would perform an FFT using the entire sample, consisting of IQ as the input for the FFT which would yield another complex answer. From this, calculate the magnitude and plot starting from 0? I'm not entirely positive which samples to throw out, which ones to keep, and in which order to plot them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I perhaps separate the real and imaginary prior to the FFT for the first 1.5M samples, perform an FFT for 1.5M of I and FFT for 1.5M of Q and plot the real to the right of 0 and the imaginary to the left of 0? Throwing out the rest of samples from 1.5-3M?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is very much appreciated. Thanks all.&lt;/p&gt;&#xA;" OwnerUserId="8865" LastActivityDate="2014-05-11T09:09:02.997" Title="Processing and plotting quadrature data in the frequency domain" Tags="|software-defined-radio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16162" PostTypeId="2" ParentId="16151" CreationDate="2014-05-11T04:35:46.860" Score="2" Body="&lt;p&gt;the exponential input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = e^{s t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is an eigenfunction to any Linear and Time-Invarient (LTI) system.  that means if the input is $x(t)$ above, the output $y(t)$ is (for some constant $s$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = h(t) \circledast x(t) = h(t) \circledast  e^{s t} = H(s) e^{s t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&quot;$\circledast$&quot; means convolution.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(s)$ is a constant because it's a function of $s$ which is constant.  so the output $y(t)$ is a scaled version of the input $x(t)$, so that's what makes $x(t)$ an eigenfunction of the LTI system that is fully described by either the impulse response $h(t)$ or transfer function $H(s)$.  the transfer function $H(s)$ is the Laplace Transform of the impulse response $h(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s$ can be anything, real (like $s=\sigma$), imaginary ($s=j \omega$), or complex ($s=\sigma+j\omega$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it turns out that, due to some theorem in complex analysis, that it suffices to know how the system (if it's &quot;analytic&quot;) responds to $x(t)=e^{j\omega t}$ for all real $\omega$ to fully describe the input/output relationship of the LTI system.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-05-11T04:35:46.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16163" PostTypeId="2" ParentId="16158" CreationDate="2014-05-11T07:23:50.543" Score="4" Body="&lt;p&gt;Batman has given a great answer. You need to go through the recommended book in order to understand the concepts mentioned. Let me try to simplify it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BIG PICTURE:&lt;/strong&gt; De-convolution or inverse filtering is required to retrieve an estimate of the original signal that went through an unknown linear system. Basically, we have a signal which went through an unknown system and we want to get the original back. &#xA;&lt;em&gt;Example:&lt;/em&gt; You shouted something across a room with lot of reverberation (echos) to your brother. Now for your brother to understand it, he needs to remove the reverberation effect. Let us see it in signal processing terminology.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is convolution:&lt;/strong&gt; Let $x(k)$ be your speech signal, and $h(k)$ is the unknown response of the room, then speech heard by your brother is $y(k) = h(k)\ast x(k)$ (this is convolution) and is more formally defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(k) = \sum_{n=0}^{N-1} h(n)x(k-n) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, your brother is listening to attenuated copies of your sound, i.e., $y(k) = h(0)x(k) + h(1)x(k-1) + ... + h(N-1)x(k-N+1)$. Note here x(k) is the complete speech of yours and $k-i$ denotes shift by $i$th sample, referring to the shifted copies.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is deconvolution:&lt;/strong&gt; Now lets say your brother recorded $y(k)$ and he wants to know what did you say? i.e., what is $x(k)$. What he needs to do is design a filter $w(k)$ such that $\delta(k) = w(k)\ast h(k)$, i.e., $w(k)$ is the inverse of $h(k)$. If you know basic signal processing then $\delta$ is the dirac delta function or an impulse. Now if we convolve $y(k)$ with $w(k)$ then $w(k)\ast y(k) = w(k)\ast h(k) \ast x(k) = \delta(k) \ast x(k) = x(k)$. And he can know what you said.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Minimum Phase:&lt;/strong&gt; deals with the design of $w(k)$. Minimum phase also means that our filter is designed such that it responds much faster than another filter that is non-minimum phase. It has to do with setting of zeros of $w(k)$. This concept will require another discussion, which I'll postpone for now.  &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-05-11T07:23:50.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16164" PostTypeId="2" ParentId="16161" CreationDate="2014-05-11T09:09:02.997" Score="0" Body="&lt;p&gt;You do not need to break it into real and imaginary. If you are interested in the spectrum, you will take the FFT and look at its squared absolute value i.e., magnitude square. Better see it in log domain, i.e., $20\log_{10}(|X(f)|)$, starting from 0 to number of FFT points. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For 1Hz resolution&lt;/em&gt; you need to take FFT of all 3M samples and FFT size should be 3M. But to ease the computational load you can consider taking a window of 1024 samples then take its  FFT using an FFT size of 1024 (In that case each FFT bin corresponds to 3M/1024 Hz). The number 1024 is just an example, you can consider any other value $N$ that suits you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For plotting&lt;/em&gt; take the magnitude response of each window and plot it. This is spectrum plot without any overlap. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For 50% overlap&lt;/em&gt; move the window by $N/2$ samples, take another mag. resp. It is better to average the response over few windows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowing is another interesting parameter to play with. In the above case the window is rect, i.e., $w(k) = \sum_{n=0}^{N-1} \delta(k-n)$, where size of window is N. If input signal is $x(k)$ then to pick N points we simply multiply $w(k)$ by $x(k)$. You can see other windows like Kaiser, Hamming or Hanning, and use which ever suits your needs.    &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-05-11T09:09:02.997" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16165" PostTypeId="2" ParentId="16148" CreationDate="2014-05-11T12:08:52.657" Score="1" Body="&lt;p&gt;The question is very unclear. Whether convolution is circular or not depends only on what flavor Fourier Transform you use. It has nothing to do with filter design. It has also nothing to do with whether signal are &quot;on bins&quot; or not.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-05-11T12:08:52.657" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16166" PostTypeId="1" CreationDate="2014-05-11T12:34:36.107" Score="1" ViewCount="13930" Body="&lt;p&gt;I have already calculated the cdf values of each image now i have to map the reference image values to target .&#xA;I cannot use histogram equalization or interpolation&#xA;I simply have to map them . &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function S = histM(t, target)&#xA; if size(target,2)&amp;gt;1&#xA;   %an image, replace the image with its cdf&#xA;   target = getImageCDF(target);&#xA; end&#xA;&#xA;%get the CDF for the input image&#xA; tcdf = getImageCDF(t);&#xA;&#xA;% .... what shall be done here to map the values of reference to target&#xA;&#xA;%subfunction: compute the CDF for an image that started as uint8&#xA; function cdf = getImageCDF(img)&#xA; bins = 0:255;&#xA; H = hist(img(:), bins);&#xA; Hmod = H + eps(sum(H));&#xA; cdf = [0, cumsum(Hmod)/sum(Hmod)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8688" LastActivityDate="2016-02-17T19:34:47.590" Title="Histogram matching of two images using cdf" Tags="|image-processing|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16168" PostTypeId="1" CreationDate="2014-05-11T13:48:31.860" Score="1" ViewCount="1770" Body="&lt;p&gt;I try to obtain fundamental frequency from cepstrum. I decide to use peak picking algorithm, which pick maximum value of the Cepstrum (c) with sampling rate fs.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [f0] = spPitchCepstrum(c, fs)&#xA; % search for maximum  between 2ms (=500Hz) and 20ms (=50Hz)&#xA; ms2=floor(fs*0.002); % 2ms&#xA; ms20=floor(fs*0.02); % 20ms&#xA; [maxi,idx]=max(abs(c(ms2:ms20)));&#xA; f0 = fs/(ms2+idx-1);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works but I can not understand why f0 is calculated like: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f0 = fs/(ms2+idx-1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where in denominator is value consist indexes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you somebody explain me why it is calculate in this way?&lt;/p&gt;&#xA;" OwnerUserId="5857" LastActivityDate="2014-06-10T16:52:07.210" Title="Cepstrum, peak picking" Tags="|frequency|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16169" PostTypeId="2" ParentId="2361" CreationDate="2014-05-11T13:52:28.740" Score="1" Body="&lt;p&gt;i am not sure i understand correctly the question (feel free to update me if not so).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is the MUSIC algorithm, which extracts signals embedded in a background noise, as a sum of sinusoidals signals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the option to use SVD (or Karhunen-Loeve transform) and reduce the dimensionality of the input data while retaning maximum information (this will discard most of the background noise components).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is online or real-time, this could be done adaptively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="8867" LastActivityDate="2014-05-11T13:52:28.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16170" PostTypeId="2" ParentId="16168" CreationDate="2014-05-11T14:40:50.907" Score="4" Body="&lt;p&gt;Cepstrum argument is called &lt;em&gt;quefreency&lt;/em&gt;, which is in fact a &lt;strong&gt;time domain&lt;/strong&gt;. So for example if you are looking for the fundamental frequency then you are searching for a peak in a specific range. In your case that's $[0.002; 0.2] \;sec$, which corresponds to $[50; 500] \; Hz$., knowing that $f=\dfrac{1}{t}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you are searching for fundamental frequency, you can find peak in &lt;em&gt;quefrency&lt;/em&gt; domain and then convert it to corresponding &lt;em&gt;frequency&lt;/em&gt;. You can also use a different approach. We know that our cepstrum is symmetrical around center (similarly to Fourier Transform), and also we have our sampling frequency $f_s$. Let's say that you have $N$ cepstrum bins, therefore distance between each of them is: $\dfrac{f_s}{N}$. That's why you can find the corresponding fundamental frequency $f_0$ by dividing sampling frequency by the index of a peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example our peak is at index number $10$, and sampling frequency is $1000 Hz$. Corresponding $f_0$ is $100 Hz$. If peak is at bin $50$ (more to the right, meaning lower frequency - remember quefrency is like time), then $f_0 = 20$ Hz. The subraction of 1 in denominator is cause by fact that MATLAB is indexing from 1 not from 0, like most of the programming languages.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-11T14:40:50.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16171" PostTypeId="2" ParentId="16168" CreationDate="2014-05-11T16:28:33.050" Score="1" Body="&lt;p&gt;The closer together a bunch of harmonic frequencies are in a sound, the higher the fundamental frequency that is producing all those harmonics.  A cepstrum returns something proportional to approximately the inverse of the frequency distance between a series of harmonic frequency peaks in the frequency domain.  The farther apart the harmonics, the lower the supposed fundamental.  So that's why Fs is divided by a bin number (converted to a 0 based index) in the Quefrency domain to produce a fundamental frequency estimate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-05-11T16:49:39.573" LastActivityDate="2014-05-11T16:49:39.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16175" PostTypeId="2" ParentId="16166" CreationDate="2014-05-11T18:10:36.013" Score="4" Body="&lt;p&gt;First you'll have to compute the histogram of one of the two images.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H = hist(img(:), bins);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next find the cdf of the image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; cdf = [0, cumsum(Hmod)/sum(Hmod)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next you'll have to make the second image follow the exact same cdf of the first image. This is usually known as histogram specification.&#xA;Here is the algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have a &lt;code&gt;3 bit&lt;/code&gt; image, that is $8$ different intensity values $0 &amp;gt; 7$.&#xA;Now as for the second image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find it's cdf as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now as seen in the following image. The $r_k$ is the pixel value of the second image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s_k$ is the cdf of the second image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z_k$ is the cdf of the firsk image (desired histogram).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z_{k}*$ and $n$ are computed as the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(z_k - s_k) &amp;gt;= 0$ for smallest value of $n \dots$ and $n = g_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly:&#xA;Let's compute $z_k*$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z_k - s_k = 0 - 0.15 = -0.15 &amp;gt;! 0 $ (not greater than zero)&#xA;increase $z_k$ and keep $s_k$ as is until you satisify the criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until you reach:&#xA;$0.15 - 0.15 = 0 &amp;gt;= 0$ (check)&#xA;Then $z_k* = z_k$&#xA;$n = r_k $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dBQZE.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some illustration images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CcYnH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hV2di.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Ef30c.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/keLdS.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fz8B5.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8348" LastEditorUserId="17817" LastEditDate="2016-02-17T19:34:47.590" LastActivityDate="2016-02-17T19:34:47.590" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16176" PostTypeId="1" AcceptedAnswerId="16177" CreationDate="2014-05-11T20:36:37.443" Score="5" ViewCount="836" Body="&lt;p&gt;I have a discrete signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; of length say &lt;span class=&quot;math-container&quot;&gt;$1024$&lt;/span&gt;, such that :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$-1 \leq x[n] \leq 1, \qquad \forall n$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and let &lt;span class=&quot;math-container&quot;&gt;$y[k]$&lt;/span&gt; be its DFT.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is there an upper bound for &lt;span class=&quot;math-container&quot;&gt;$|y[k]|$&lt;/span&gt; ?  (i.e. for the DFT of a bounded signal)&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="7092" LastEditDate="2021-02-20T14:23:47.460" LastActivityDate="2021-02-20T14:23:47.460" Title="Upper Bound for the DFT (FFT) Coefficients of a Bounded Signal" Tags="|fft|dft|math|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16177" PostTypeId="2" ParentId="16176" CreationDate="2014-05-11T21:07:32.803" Score="6" Body="&lt;p&gt;You can obtain a bound on the magnitude of the DFT of $x[n]$ ($|x[n]|\le 1$) as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\big|X[k]\big|=\left|\sum_{n=0}^{N-1}x[n]e^{-jkn2\pi/N}\right|\le\sum_{n=0}^{N-1}|x[n]|\le N\max_n|x[n]|=N\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for signals $x[n]=e^{j2\pi nl/N}$, $l\in\mathbb{Z}$, the bound is tight. However, for most other signals with $|x[n]|\le 1$ you will find that the maximum of $|X[k]|$ is substantially smaller than the bound given by $(1)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2018-09-10T12:04:20.573" LastActivityDate="2018-09-10T12:04:20.573" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16178" PostTypeId="2" ParentId="16176" CreationDate="2014-05-11T21:07:40.437" Score="2" Body="&lt;p&gt;All calculated coefficients of your FFT will be lower than maximum amplitude of your signal. Of course I mean normalized FFT, you must divide each of them by length of your sequence (in case of rectangular window). Two cases you should think of are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;One sinusoid varying between $-1$ and $1$ produces obviously peak in spectrum at its frequency with amplitude of $1$. That's what we expect&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have two (or more) sinusoids, each of them has also unit amplitude. Their superposition might produce signal (your signal $x[n]$ ) with an amplitude higher than $1$. You can observe that on plot below. Although when you do the FFT you will get two separated peaks with amplitude $1$. That means you cannot get signal with spectral peak values higher than time domain amplitude. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In some cases you will also encounter leakage problem, and the amplitude of your peak will be bit lower than it should be. But this also assures that you won't get more than maximum absolute value in the time domain.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t5xcY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-11T21:07:40.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16179" PostTypeId="2" ParentId="16176" CreationDate="2014-05-11T21:09:41.337" Score="1" Body="&lt;p&gt;The upper bound would be a coherent summation of all samples of $ x \left [ x \right ] $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{aligned}&#xA;X \left[ k \right ] &amp;amp; = \sum_{n = 0}^{N - 1} x \left[ n \right] \exp^{-j 2 \pi \frac{nk}{N}} \\&#xA;&amp;amp; \leq \left| \sum_{n = 0}^{N - 1} x \left[ n \right] \exp^{-j 2 \pi \frac{nk}{N}} \right| \\&#xA;&amp;amp; \leq \sum_{n = 0}^{N - 1} \left| x \left[ n \right] \exp^{-j 2 \pi \frac{nk}{N}} \right| \\&#xA;&amp;amp; \leq \sum_{n = 0}^{N - 1} \left| x \left[ n \right] \right| \\&#xA;&amp;amp; \leq N \max_{n} \left \{ \left| x \left[ n \right] \right| \right \} &#xA;\end{aligned}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you add the info $ \forall n \left| x \left[ n \right] \right| \leq 1 $ you can say you're bounded by $ N $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps...&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-09-10T22:41:00.693" LastActivityDate="2018-09-10T22:41:00.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16181" PostTypeId="1" CreationDate="2014-05-12T06:45:56.017" Score="6" ViewCount="12684" Body="&lt;p&gt;I am getting a high frequency at 0Hz. How can I remove it? I am not supposed to get it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;W = 3.64*2*pi;&#xA;&#xA;Fs = 50;                      % Sampling frequency in hz&#xA;T = 1/Fs;                     % Sample time&#xA;L = 1000;                     % Length of signal&#xA;t = (0:L-1)*T;                % Time vector&#xA;v = 113*(1+0.40*sin(W*t));&#xA;&#xA;theta0 = 12*(pi/180);         % in radians for 12 degree&#xA;theta1 = 6*(pi/180);          % in radians for 6 degree&#xA;theta = theta0-theta1*sin(W*t);&#xA;&#xA;Lift = 0.5*1.225*v.^(2)*(2*pi).*theta;&#xA;&#xA;NFFT = 2^nextpow2(L);         % Next power of 2 from length of Lift&#xA;Y = fft(Lift,NFFT)/L;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;subplot(2,1,1);&#xA;plot(Fs*t,Lift);&#xA;&#xA;subplot(2,1,2)&#xA;plot(f, 2*abs(Y(1:NFFT/2+1))) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8873" LastEditorUserId="8202" LastEditDate="2014-05-12T09:10:54.903" LastActivityDate="2014-07-16T10:48:42.380" Title="MATLAB - remove the frequency at zero in FFT" Tags="|matlab|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16182" PostTypeId="2" ParentId="16181" CreationDate="2014-05-12T06:48:12.677" Score="10" Body="&lt;p&gt;Frequency bin at zero is simply mean value of your signal. Just take a look on definition of DFT, for zero frequency $k$ we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left. X[k]=\sum_{n=0}^{N-1}x[n]e^{-i 2\pi  n\cdot k} \right |_{k=0} \Rightarrow X[0]=\sum_{n=0}^{N-1}x[n]e^{-i 2\pi  n\cdot 0} = \sum_{n=0}^{N-1}x[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after you calculate the FFT and divide by number of samples, indeed you get the mean value of your signal.&#xA;In order to remove that, please apply the following before the FFT calculation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Lift = Lift - mean(Lift);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-12T07:00:10.757" LastActivityDate="2014-05-12T07:00:10.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16183" PostTypeId="2" ParentId="16130" CreationDate="2014-05-12T06:53:18.347" Score="2" Body="&lt;p&gt;I have found this survey paper very useful:&#xA;&lt;a href=&quot;http://ralph.cs.cf.ac.uk/papers/Geometry/Registration.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ralph.cs.cf.ac.uk/papers/Geometry/Registration.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gives a categorized overview of the field. I think section 3 and 4 are the most relevant ones for you.&lt;/p&gt;&#xA;" OwnerUserId="156" LastActivityDate="2014-05-12T06:53:18.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16184" PostTypeId="1" AcceptedAnswerId="17610" CreationDate="2014-05-12T08:37:30.287" Score="1" ViewCount="2322" Body="&lt;p&gt;It is know that low frequency signals travel longer distance that of high frequency signal. If so, our speech signal is low frequency signal, why it is not travelling further?&lt;/p&gt;&#xA;" OwnerUserId="5800" LastActivityDate="2014-08-03T17:06:37.270" Title="If low frequency travels longer distance, why our speech is not travelling longer distance?" Tags="|frequency|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16185" PostTypeId="2" ParentId="16184" CreationDate="2014-05-12T09:28:42.270" Score="10" Body="&lt;p&gt;Well, first of all the Sound Level Pressure decreases by $6 \; \mathtt{dB}$ when doubling the distance - this plays a big role. We do also have sound attenuation coming from our medium - air. Let's take a closer look onto sound absorption coefficient for different frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3cEpT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing that human speech is mostly concentrated at the range of $300\;\mathtt{Hz}$ - $3.3\;\mathtt{kHz}$ (yes I know - let's forget about sibilants) you can judge that we are really doing our best. Larynx tones and first formants of voiced speech are clearly transmitted with minimum lost of energy. Therefore main problem is the decrease of SPL with increasing of distance from source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another issue is the hearing curve of human ear which makes the low attenuation at the low frequencies worse. For example even though air absorption for $2 \;\mathtt{kHz}$ - $3 \;\mathtt{kHz}$ is rather high, we can still hear the ambulance siren as it is in frequency range where human ear has it's resonance. Obviously that depends on many factors, i.e. in city you have lots of barriers for sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lSIUM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example let's say that you are a male speaking with normal level. Exemplary average $dBA$ values in frequency ranges are following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$250\; \mathtt{Hz}$: $51 \; \mathtt{dBA}$&lt;/li&gt;&#xA;&lt;li&gt;$1\;\mathtt{kHz}$: $49\;\mathtt{dBA}$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Assume that these are values measured at the distance of $1\mathtt{m}$ We want to know how loud you are at $100\mathtt{m}$. Applying atmospheric attenuation factor for 10% of relative humidity gives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L_{250}^{a}=51-0.1=50.9\;[\mathtt{dBA}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L_{1000}^{a}=49-1.4=47.6\;[\mathtt{dBA}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not a big change, isn't it? Now let's apply the following formula for calculating the sound level at a given distance $d_{ref}$ (assuming cylindrical wave):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$L_d=L_{ref}-20\log{\left( \dfrac{d_{ref}}{d} \right) } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying it to previously calculated values and substituting $d=1\;\mathtt{m}$, $d_{ref}=100\;\mathtt{m}$ we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L_{250}^{a,d}=L_{250}^{a}-40=10.9\;[\mathtt{dBA}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L_{1000}^{a,d}=L_{1000}^{a}-40=7.6\;[\mathtt{dBA}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both values we've obtained are way below the level of human breathing at a distance of $1\;\mathtt{m}$  ($25\; \mathtt{dBA}$) and environmental noise. You can also try to shout but it still won't give you  big increase in a distance. Please refer to this article: &lt;a href=&quot;http://www.alfwarnock.info/profess/Average%20Speech%20Levels.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Average Speech Levels and Spectra in Various Speaking/Listening Conditions&lt;/strong&gt;&lt;/a&gt; for detailed info about levels of speech. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One last word, bit out of scope of this question. There are some cases when you can be heard in far distance or you could be heard very poorly in a very close distance. Such phenomena occurs a lot in water (but also in the air), where sound waves can travel tens of kilometres. This is due to presence of wind, temperature inversions, terrain profile and refraction of sound. If you wish to know more, then I am sure there are plenty of guys in Physics SE willing to answer that question. As for start, here is some interesting article: &lt;a href=&quot;http://faculty.plattsburgh.edu/roger.hamernik/CDS_344/PDF_Files/Echos.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Outdoor Sound Propagation in the U.S. Civil War&lt;/strong&gt;&lt;/a&gt;, as well as bunch of papers regarding &lt;a href=&quot;http://www.icacommission.org/Proceedings/ICA2001Rome/6_13.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Outdoor Sound Propagation&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-08-01T16:50:55.140" LastActivityDate="2014-08-01T16:50:55.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16186" PostTypeId="1" AcceptedAnswerId="16197" CreationDate="2014-05-12T10:19:45.110" Score="3" ViewCount="2427" Body="&lt;p&gt;I'm trying to make an oscillator using IIR filter and I'm having problems tuning it so that it's stable on the platform I'm using (ARM Cortex M4F and CMSIS DSPLib's &lt;a href=&quot;http://www.keil.com/pack/doc/cmsis/DSP/html/group___biquad_cascade_d_f1.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;arm_biquad_cascade_df1_f32&lt;/a&gt;). Note that this is my first time doing this and that I don't know much about control theory, so I could be missing something very obvious here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking through some textbooks, I found the following formula for a transfer function of an oscillator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Asin(\omega_0)}{1-(2rcos(\omega_0))z^{-1}+r^2z^{-2}}  $$&#xA;where, as far as I understand it, A is the amplitude of the oscillator, $\omega_0$ is the normalized angular frequency, which is calculated as $\omega_0=\frac{2f_{real}}{f_{sampling}}$ and the r is parameter which sets the poles distance to the unit circle and decides if the system's output will be dampened, opposite of dampened (can't remember the word at the moment) or constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I designed an oscillator using following parameters I got from some other requirements:&#xA;sampling frequency $F_s=759493.7$, oscillator frequency $f1=25630$, amplitude $A=1$ (I plan to fine-tune this later), $r=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives me then $\omega_0=\frac{2f_1}{F_s}=0.0674923$ and the transfer function of:&#xA;$$H(z)=\frac{0.0674411}{1-1.9954464z^{-1}+1z^{-2}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the impulse response in MATLAB, I get the expected result:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DJZ40.png&quot; alt=&quot;Impulse response of the filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good. I then tried to implement this using arm_biquad_cascade_df1_f32. Here's the block diagram of the filter according to documentation: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/fkYsC.png&quot; alt=&quot;arm_biquad_cascade_df1_f32 block diagram&quot;&gt;&lt;br&gt;&#xA;Since I only have a single second order section in my oscillator, I'm using only one section as shown on the picture.&#xA;I set the coefficients to be:&lt;br&gt;&#xA;$b_0=0.0674923$, $b_1=0$, $b_2=0$&lt;br&gt;&#xA;$a_1=-1.9954464$, $a_2=1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I start executing this filter, the output is unstable and quickly goes to infinity. Manually experimenting with the parameter $r$, I managed to get a slowly decaying response with $r=0.5$. I suspect that what I'm seeing are the results of the MCU being only able to work with 32bit floating point numbers and lacking precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: How do I model the oscillator while taking into account the numerical precision errors? &lt;/p&gt;&#xA;" OwnerUserId="4977" LastActivityDate="2014-05-12T17:49:09.000" Title="IIR oscillator produces stable output in MATLAB, unstable on chip, how do I tune it?" Tags="|infinite-impulse-response|oscillator|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="16187" PostTypeId="2" ParentId="16186" CreationDate="2014-05-12T10:45:07.453" Score="2" Body="&lt;p&gt;A first thing: I think there is a $\pi$ missing in your conversion between frequencies and angular frequency. Your impulse response shows a period of about 90, while your period should be about 29 samples - there's clearly something wrong here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are seeing on your target hardware is due to the difference in precision between matlab's implicit use of double precision (64-bit), and the use of 32-bit for the routines you chose to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if this is not very apparent through the transfer function or the biquad structure, what this &quot;filter&quot; with no input does is simply rotate its initial conditions. With 32-bit precision, there is no guarantee that the magnitude of the input vector will be preserved by rotation - it can either grow (instability) or decay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you intend to use this as an oscillator (that is to say, if the input will always be null except for the initial conditions):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Regularly - say every 100th sample - mess with your state variables to readjust the norm of the vector to 1.&lt;/li&gt;&#xA;&lt;li&gt;Or use another simpler and more stable technique like a phase accumulator and a sine lookup table.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-05-12T12:06:58.360" LastActivityDate="2014-05-12T12:06:58.360" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16188" PostTypeId="1" CreationDate="2014-05-12T10:47:33.407" Score="2" ViewCount="1965" Body="&lt;p&gt;The other days I read a useful article (on BER v.s. Eb/N0 curve of ofdm) whose link is as bellow. While watching the plot inside, a question was arisen in my mind. I wonder if the BER v.s. Eb/N0 curve of BPSK alone (without using OFDM) and one using OFDM could be the same in both AWGN and fading (flat and selective) channels? If so, what’s the use of applying OFDM to BPSK alone (expect the simpler equalizer for OFDM case)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsplog.com/2008/08/26/ofdm-rayleigh-channel-ber-bpsk/&quot; rel=&quot;nofollow&quot;&gt;http://www.dsplog.com/2008/08/26/ofdm-rayleigh-channel-ber-bpsk/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best Regards&lt;/p&gt;&#xA;" OwnerUserId="8875" LastEditorUserId="1606" LastEditDate="2014-08-08T06:53:10.200" LastActivityDate="2014-08-08T06:53:10.200" Title="What is the advantages of BPSK+OFDM over usual BPSK (with no OFDM Modulation)?" Tags="|digital-communications|ofdm|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16193" PostTypeId="1" CreationDate="2014-05-12T16:18:43.027" Score="5" ViewCount="182" Body="&lt;p&gt;I'm wondering if there is a way that I can reconstruct an image, given the output vector obtained from the convolution with a certain filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I convolve my image with a filter from MR8 filter bank, so I got a feature vector v. Which is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = img ** filter&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so can I define a function that takes &lt;code&gt;v&lt;/code&gt; and &lt;code&gt;filter&lt;/code&gt; as an input, and restores the &lt;code&gt;img&lt;/code&gt; with a certain error ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img_restored = reconstruct(filter,v);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;What have I tried&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I searched for deconvolution, I found two things : &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Wiener Deconvolution : But it only works for de-blurring (I guess)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;deconv()&lt;/code&gt; function of MATLAB, but it takes two vectors as inputs, and gives one -complex- number as output.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Edit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Another approach could be storing all feature vectors for pixels (centers of sliding windows) and try to restore only a single pixel, then obtain an image by concatenating these pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help !&lt;/p&gt;&#xA;" OwnerUserId="8230" LastEditorUserId="8230" LastEditDate="2014-05-12T16:25:29.790" LastActivityDate="2021-02-19T06:48:22.943" Title="How to restore an image from its filter output?" Tags="|image-processing|filters|signal-analysis|deconvolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16194" PostTypeId="1" CreationDate="2014-05-12T17:17:46.690" Score="0" ViewCount="1608" Body="&lt;p&gt;When the following code is written,the resulting magnitude spectrum shows magnitude values represented by two peaks is different even though they have the same amplitude. why is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a fast reply  would be much appreciated&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Fs=250; %sampling frquency of 250Hz&#xA;i=0:1/250:4; %1000 data points&#xA;x1=sin(2*pi*7*i); %create sinusoidal wave with frequency=7Hz&#xA;x2=sin(2*pi*40*i);%create sinusoidal wave with frequency=40Hz&#xA;subplot(2,1,1);&#xA;plot(x1),xlabel('Sampling Points'),ylabel('Amplitude')&#xA;subplot(2,1,2);&#xA;plot(x2),xlabel('Sampling Points'),ylabel('Amplitude')&#xA;&#xA;y=x1+x2; %combine two signals to one&#xA;figure, psd(y) %spectrum analysis&#xA;&#xA;N=length(y); %legnth of y is attributed to N&#xA;&#xA;%calculate real part of Discrete Fourier Transform&#xA;for m=1:N,&#xA;sumn=0;&#xA;    for n=1:N,&#xA;    sumn=sumn + y(n)*(cos (2*pi*(m-1)*(n-1)/N));&#xA;    end&#xA;dftreal(m)=sumn; &#xA;end&#xA;&#xA;&#xA;%calculate imaginary part of Discrete Fourier Transform&#xA;for m=1:N,&#xA;sumn=0;&#xA;    for n=1:N,&#xA;    sumn=sumn + y(n)*(sin (2*pi*(m-1)*(n-1)/N));&#xA;    end&#xA;dftimag(m)=-sumn;&#xA;end&#xA;&#xA;&#xA;%obtaining magnitude spectrum using the obtained complex DFT values and&#xA;%plotting the spectrum&#xA;for m=1:N,&#xA;dftmag(m)=sqrt(dftreal(m)*dftreal(m)+dftimag(m)*dftimag(m));&#xA;end&#xA;&#xA;%obtaining magnitude spectrum using the obtained complex DFT values and&#xA;figure, plot(dftmag),title('Magnitude Spectrum 1'),xlabel('Sampling Points'),ylabel('Magnitude')&#xA;&#xA;%obtaining new Magnitude Spectrum based on fft&#xA;z=fft(y);&#xA;dftmag1=abs(z);&#xA;&#xA;figure, plot(dftmag1),title('Magnitude Spectrum 2'),xlabel('Sampling Points'),ylabel('Magnitude')&#xA;&#xA;%obtaining PSD of dftmag1&#xA;figure, psd(dftmag1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B5gZn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8878" LastActivityDate="2014-12-08T22:50:24.213" Title="Magnitude Spectrum, different magnitudes same amplitude" Tags="|matlab|frequency-spectrum|dft|magnitude|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16195" PostTypeId="2" ParentId="16194" CreationDate="2014-05-12T17:35:32.010" Score="0" Body="&lt;p&gt;The energy is simply spread over several FFT bins because your analysis window length is not an integer multiple of the period of your signals - your harmonics are not exactly aligned with the frequency resolution grid of the FFT. Read about spectral leakage and windowing...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the plot you have posted, what matters is not the peak amplitude, but the sum of the energy over the entire width of the peak. The first harmonic has a higher peak but it is narrow ; the second harmonic has a lower but wider peak. The total energy of both must be equal.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-05-12T17:35:32.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16196" PostTypeId="1" AcceptedAnswerId="16569" CreationDate="2014-05-12T17:43:20.113" Score="4" ViewCount="1130" Body="&lt;p&gt;We are trying to implement Alamouti STBC on underlying ofdm signal. We were thinking as to where to write alamouti coder block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought we could write it after the cyclic prefixer block as we get a symbol after the IFFT and cyclic prefixer. we could take two such symbols,send both of them at one time instant and then conjugate them and send them on the next time instant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then we saw a few block diagrams where alamouti coder is used  before IFFT block and after ofdm symbol mapper. when I searched why that's the case, there were reasons that said for OFDM to be effective, symbols should be assigned to subcarriers in frequency domain to mitigate multipath effects and not in time domain. The points that I don't understand are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What does it mean by saying symbols in ofdm  are assigned in frequency domain on individual subcarriers? I can only see a symbol at the output of a ofdm mapper which is a complex number which comes from the constellation diagram depending on the modulation technique used. The output of the IFFT is also a complex number. So  how does an IFFT operation done on complex symbols mean that they are assigned in frequency. we could as well use a FFT instead of a IFFT.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the reason for alamouti code to be implemented before IFFT? Can it also be implemented the way I thought after cyclic prefixer block?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="4375" LastEditDate="2014-05-13T17:36:12.857" LastActivityDate="2017-08-22T06:47:39.927" Title="Alamouti code after or before IFFT block in OFDM" Tags="|digital-communications|ofdm|ifft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16197" PostTypeId="2" ParentId="16186" CreationDate="2014-05-12T17:49:09.000" Score="2" Body="&lt;p&gt;i'll try to simplify what you have here.  so, being an oscillator, there is no input, only output.  but you &lt;strong&gt;can&lt;/strong&gt; think of it as a filter (with zero states) with an impulse as input.  but that impulse essentially sets the states of your filter and the rest of the input is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the feedback equation (from your diagram, setting $b_0$, $b_1$, and $b_2$ to $0$) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] \ = \ 2 \cos(\omega_0) \ y[n-1] \ - \ y[n-2] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\omega_0 = 2 \pi \frac{f_0}{f_s}$ and $f_s$ is the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this equation sets the frequency to $\omega_0$ but does not set the amplitude or phase.  you set the amplitude and phase by the judiciously setting the initial values of the two states, $y[n-1]$ and $y[n-2]$.  assuming your initial output sample is $y[0]$, your initial states are $y[-1]$ and $y[-2]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if you want your output to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = A \cos(\omega_0 n + \phi) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for a given $A$ and $\phi$, then you just walk the equation back to times $n=-1$ and $n=-2$ to get your initial states $y[-1]$ and $y[-2]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it's that easy.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-05-12T17:49:09.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16198" PostTypeId="2" ParentId="16194" CreationDate="2014-05-12T17:59:54.137" Score="2" Body="&lt;p&gt;To add a bit to the previous answers: the FFT result is &quot;binned&quot;, not continuous.  A plot of an FFT result often fools people by being smooth for large enough FFT lengths.  But the result is really more like a bar chart for a sequence of bins, rather than a line graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the bins are not rectangular in shape (in terms of frequency response).  The nearer a spectral frequency peak is to the center of an FFT bin, the more accurate the magnitude result.  You can get a list of your FFT's bin centers by multiplying sample_rate/length_of_FFT by integers from zero up to half the length.  If a frequency peak is not at the exact center of an FFT result bin, the magnitude gets split among multiple bins, which takes height away from the closest peak bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, some of your frequencies were closer to bin centers than others.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-12T17:59:54.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16200" PostTypeId="2" ParentId="16188" CreationDate="2014-05-12T23:46:22.517" Score="1" Body="&lt;p&gt;As far as I know. OFDM only helps because of the simpler equalizer. However, it is possible to structure your time domain BPSK data (in non-OFDM case) so that you can use a frequency domain equalizer and get much if not all of the advantages of OFDM. There are a few papers that basically state this. OFDM has much better advantages for &gt;16 QAM than it would for BPSK&lt;/p&gt;&#xA;" OwnerUserId="4221" LastActivityDate="2014-05-12T23:46:22.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16204" PostTypeId="1" AcceptedAnswerId="16205" CreationDate="2014-05-13T07:31:32.677" Score="1" ViewCount="864" Body="&lt;p&gt;I try to detect and count circles in image (for example smarties)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2Dpg6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use HSL color space. But I am not able to distiguish colors od the same color if they are in touch. I try to erode and dilate picture. But result is the same, I have only some blobs(connected components) od the same color. Do you have some general algorithm for this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I try to do that with EMGUCV library)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2014-05-13T10:16:39.827" Title="Color and circle detection in image" Tags="|image-processing|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16205" PostTypeId="2" ParentId="16204" CreationDate="2014-05-13T09:01:42.847" Score="0" Body="&lt;p&gt;If I understand you correctly, you erode, then dilate then look for the colour of your blobs. Erosion then dilation is an opening operator. As you can hopefully see that's not going to do too much to seperate the blobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest that you do not really need to dilate. If you just erode enough so that the blobs seperate. You can then mark a pixel in each blob (centre is probably a good bet), which should now be seperated, and find the colour of that pixel in the original image.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-13T09:01:42.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16206" PostTypeId="2" ParentId="16153" CreationDate="2014-05-13T09:14:32.553" Score="1" Body="&lt;p&gt;The word &quot;Filter&quot; in Image Processing word relates to &quot;Neighborhood&quot; based operation on pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filters in the context of Instagram and other Image Processing applications are combination of point operations (Works on single pixel, adjusting it values independent of its adjacent pixels) and filters which alters the pixel value according to its adjacent pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were you I'd start with learning about Point Operations such as Brightness, Contrast, Hue, Saturation, etc...&#xA;Once you build some functions which alters those move on to filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could combine them into &quot;Effect&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, Vignetting is easy to do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a rounded mask. White out side a circle and black around it.&lt;/li&gt;&#xA;&lt;li&gt;Smooth the mask using a Gaussian Blur.&lt;/li&gt;&#xA;&lt;li&gt;Adjust the brightness of pixel according to the values of this mask.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-06-12T21:39:04.527" LastActivityDate="2014-06-12T21:39:04.527" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16208" PostTypeId="1" AcceptedAnswerId="16763" CreationDate="2014-05-13T10:09:01.387" Score="0" ViewCount="677" Body="&lt;p&gt;Can any one help me in how to extract a table from the whole document image and segment it? I have done segmentation for the document image which has only text by using the projection profile. So please help me how to extract the table from the whole document image. I want only table to be extracted from the document. Please give me an idea how to do it. I want to continue my project using the projection profiles only.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;i have done the segmentation manually for the document image which was consisting only text using projection profile manually i din't use the tables in it. now i want to extract the contents of the table in an image without using the formulas or any transforms can you help me.&lt;/p&gt;&#xA;" OwnerUserId="8886" LastEditorUserId="6" LastEditDate="2014-05-20T21:35:34.147" LastActivityDate="2014-06-10T10:46:38.960" Title="OCR (optical character recognition) for Indian languages - segmentation" Tags="|matlab|image-segmentation|octave|morphological-operations|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16209" PostTypeId="2" ParentId="16204" CreationDate="2014-05-13T10:16:39.827" Score="2" Body="&lt;p&gt;There is no need to &lt;code&gt;Dilate&lt;/code&gt;. Here is my segmentation results:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5Q39P.png&quot; alt=&quot;segmentation results&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R9tSm.png&quot; alt=&quot;black-wihte image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is my code using OpenCV:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;&#xA;using namespace std;&#xA;#include &amp;lt;cv.h&amp;gt;&#xA;#include &amp;lt;cxcore.h&amp;gt;&#xA;#include &amp;lt;highgui.h&amp;gt;&#xA;using namespace cv;&#xA;&#xA;int main()&#xA;{&#xA;        int ht,wt;&#xA;    IplImage *im = cvLoadImage(&quot;2Dpg6.jpg&quot;);&#xA;        ht=im-&amp;gt;height,wt=im-&amp;gt;width;&#xA;    cvShowImage(&quot;RGB&quot;,im);&#xA;&#xA;    IplImage *img = cvCreateImage(cvGetSize(im),8,1);&#xA;    cvCvtColor(im,img,CV_RGB2GRAY);&#xA;&#xA;    CvRect rec;&#xA;    CvSeq *contours;&#xA;    CvMemStorage *storage=cvCreateMemStorage(0);&#xA;    IplImage *img2 = cvCreateImage(cvGetSize(im),8,1);&#xA;&#xA;    cvThreshold(img,img2,30,255,CV_THRESH_BINARY);  // image segmentation&#xA;    cvErode(img2,img2,NULL,7);  // erode&#xA;    cvShowImage(&quot;BW&quot;,img2);  // show black-wihte image&#xA;    cvFindContours(img2,storage,&amp;amp;contours,sizeof(CvContour),CV_RETR_CCOMP);  // find contours&#xA;    while(contours){&#xA;        rec = cvBoundingRect(contours,1);&#xA;        cvRectangleR(img,rec,cvScalar(255));&#xA;        contours=contours-&amp;gt;h_next;&#xA;    }&#xA;    cvShowImage(&quot;Gray&quot;,img);&#xA;&#xA;    cvWaitKey(0);&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8883" LastActivityDate="2014-05-13T10:16:39.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16211" PostTypeId="1" AcceptedAnswerId="16217" CreationDate="2014-05-13T12:05:14.407" Score="0" ViewCount="116" Body="&lt;pre&gt;&lt;code&gt;my_signal = 8192*cos(2*pi*6*(0:7)/8) + 1i* 8192*sin(2*pi*6*(0:7)/8);&#xA;&#xA;my_signal_fft = fft(my_signal);&#xA;&#xA;plot(abs(my_signal_fft));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is matlab code. What do you notice about the spectrum? Is it symmetrical? Obviously not, because I think it has an imaginary part. Would you enlighten me for the analysis of this signal's spectrum and why having an imaginary part doesn't make it symmetrical? How is the other half gone?&lt;/p&gt;&#xA;" OwnerUserId="8888" LastActivityDate="2014-05-13T12:37:58.200" Title="Analyzing Spectrum of a signal?" Tags="|matlab|fft|frequency-spectrum|signal-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16212" PostTypeId="2" ParentId="13864" CreationDate="2014-05-13T12:06:43.770" Score="0" Body="&lt;p&gt;If I understand you correctly, you should be able to sort all N bins by increasing magnitude, select the magnitude at position A*N/100 in the sorted array, and then discard any frequencies with magnitude less than that in the original array.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-05-13T12:06:43.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16214" PostTypeId="1" AcceptedAnswerId="16250" CreationDate="2014-05-13T12:13:57.360" Score="1" ViewCount="3818" Body="&lt;p&gt;When we have FFT of Square wave of a pure real signal with high frequency(close to f(max), less than half of sampling frequency) we see only 2 symmetric high peaks but when we decrease the frequency we see the two peaks and peaks of harmonics and they are getting smaller and smaller, why? Also the highest peaks are getting away from each other, movig &amp;lt;- and -&gt; , vice versa -&gt; &amp;lt;- when we increase the frequency. why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT of Sin wave has only 2 peaks no matter what and they also get away from each other when the frequency is low and get more and more closer when the frequency gets higher. Why? I would be glad if you can enlighten me!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say our sample count is 64 and sampling frequency is 8kHz and signal frequency 2kHz. We should see 2 peaks one at 16 and one at 48.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QIK3T.png&quot; alt=&quot;FFT Square&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture above is &lt;strong&gt;only the left half of my graph&lt;/strong&gt;, there is also a symmetrical part on the right. My signal is pure real. These small harmonics dont appear at my above settings but when I decrease the freuency to 600 Hz for example I see harmonics like this for square wave and none for Sine Wave. So on high frequencies they disappear and low frequencies they appear, the lower the more of these harmonics. Also the peaks are  getting away from each other when I lower the frequency and getting closer when I increase the frequency. At 4 kHz I expect to see only 1 Peak, two of them will unite. Why? Also I couldnt test what happens if I run with 5kHz :( and when I run the code with lots of samples like 2048, the graph displayed makes no sense at all. Why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I'm asking a lot questions but I would be glad if you have some time and help me!&lt;/p&gt;&#xA;" OwnerUserId="8888" LastEditorUserId="8888" LastEditDate="2014-05-13T13:12:34.250" LastActivityDate="2014-05-14T08:39:15.170" Title="FFT of Square Wave and Sin Wave" Tags="|fft|signal-analysis|sampling|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16216" PostTypeId="1" AcceptedAnswerId="16219" CreationDate="2014-05-13T12:32:29.410" Score="4" ViewCount="8368" Body="&lt;p&gt;Good day everyone.&lt;/p&gt;&#xA;&lt;p&gt;So, I run in to trouble - How to add white noise to signal samples?&lt;/p&gt;&#xA;&lt;p&gt;For now I'm working with MSK signal - quadrature modulator and quadrature demodulator + Viterbi processor.  My signal samples at TX and RX side represents Q and I signals of modulator(real and complex part of the signal). Model works nice in ideal situation, without any noise and other interference.&lt;/p&gt;&#xA;&lt;p&gt;So, I'm working with complex envelope of the MSK signal with amplitude equal to one. Currently, I would like to test my demodulator with some noise.&lt;/p&gt;&#xA;&lt;p&gt;It looks like, I just need to add (+) samples from my noise generator to samples of transmitted signal. But I'm not sure if this is correct way,&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Should I sum both Q and I channels to one sample of noise signal or not?&lt;/li&gt;&#xA;&lt;li&gt;And I'm pretty confused how to determine signal to noise ratio after this. I would like to measure bit error ratio at some SNR points. As I read in some books changing &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; parameter of white noise generator will play a role here, but still how to determine SNR in numbers after this?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8889" LastEditorUserId="1629" LastEditDate="2021-02-12T09:54:47.013" LastActivityDate="2021-02-12T09:54:47.013" Title="Adding white noise to complex signal (complex envelope)" Tags="|noise|snr|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16217" PostTypeId="2" ParentId="16211" CreationDate="2014-05-13T12:37:58.200" Score="0" Body="&lt;p&gt;Your signal has the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=A[\cos(2\pi fn)+i\sin(2\pi fn)]=Ae^{i2\pi fn}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a complex exponential with normalized frequency $f$ (normalized by the sampling frequency). The bins of the signal's FFT of length $N$ correspond to normalized frequencies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i=\frac{i-1}{N},\quad i=1,2,\ldots, N$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case $N=8$ and $f=6/8=f_7$ (using the Matlab indexation, which starts with index $1$). So the frequency of your signal $x(n)$ lies exactly on the FFT grid. This is why there is one peak at index $7$ and all other values are $0$ (apart from numerical inaccuracies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $x(n)$ were real-valued, its FFT would satisfy the following symmetry condition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_k=X^*_{N-k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for complex-valued signals, such as yours, there is in general no symmetry.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-13T12:37:58.200" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16219" PostTypeId="2" ParentId="16216" CreationDate="2014-05-13T13:21:36.153" Score="3" Body="&lt;p&gt;If you want a complex white noise sample with variance $N_0$, then you should generate two independent noise samples each with variance $\frac{N_0}{2}$. The two samples that you generate make up the real and imaginary parts of the desired complex noise sample. The resulting complex value will have the desired variance $N_0$. You should then sum this with your complex baseband signal to get the effect that you want.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-05-13T13:21:36.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16220" PostTypeId="1" CreationDate="2014-05-13T14:50:13.770" Score="0" ViewCount="310" Body="&lt;p&gt;I am quite new to MATLAB and I am currently trying to do some Fourier synthesis. In order to do the Fourier synthesis I need the phase information of the harmonics as a fraction of the period of the fundamental frequency. I am a bit lost on how to do this. Also I am trying to do a Fourier synthesis using the equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[i] = y[i-1] + p[j]\cdot \cos\left[2\pi f[j]\left(t- \dfrac{\gamma[j]}{f[1]}\right)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="8478" LastEditorUserId="8202" LastEditDate="2014-05-13T16:45:17.253" LastActivityDate="2015-10-19T01:42:35.960" Title="Phase information" Tags="|fourier|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16221" PostTypeId="1" AcceptedAnswerId="16229" CreationDate="2014-05-13T15:13:32.813" Score="1" ViewCount="374" Body="&lt;p&gt;My goal is to apply the &lt;a href=&quot;http://www.inside-r.org/packages/cran/signal/docs/remez&quot; rel=&quot;nofollow noreferrer&quot;&gt;Remez exchange algorithm in R&lt;/a&gt; to design an FIR band pass filter for a specific frequency window. The question is not supposed to be referring to R of course but about how to choose the parameters correctly and why the result looks like as it does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The toy signal is an additive combinations of four sine waves each adding a single frequency component to the final signal. The frequencies are 1/20, 1/300, 1/5000 and 1/7000. Its FFT plot is shown in figure (s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BKfyh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what I apparently didn't get yet is how I would have to choose the parameters for the filter design - being the pass band and the stop band cutoff points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 1st filter uses the cutoff points:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0&lt;/li&gt;&#xA;&lt;li&gt;1/10 - 2/1000&lt;/li&gt;&#xA;&lt;li&gt;1/10 - 1/1000&lt;/li&gt;&#xA;&lt;li&gt;1/10 + 1/1000&lt;/li&gt;&#xA;&lt;li&gt;1/10 + 2/1000&lt;/li&gt;&#xA;&lt;li&gt;1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With 1 being the Nyquist-frequency and the valid cutoff point interval being (0,1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in figure (r1) this results in an attenuation of all frequency components except for 1/5000. (I would assume that also the frequency component 1/5000 is actually attenuated but relatively less then the other components)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my first set of questions would be - why is that so? How could I calculate f.x. the frequency located in the center of the pass band? What is the quantitative relation between cutoff points on an interval (0,1) and the pass band?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2nd filter uses the cutoff points:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0&lt;/li&gt;&#xA;&lt;li&gt;1/10 - 2/500&lt;/li&gt;&#xA;&lt;li&gt;1/10 - 1/500&lt;/li&gt;&#xA;&lt;li&gt;1/10 + 1/500&lt;/li&gt;&#xA;&lt;li&gt;1/10 + 2/500&lt;/li&gt;&#xA;&lt;li&gt;1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And the result is an (relative) attenuation of all components except for 1/300. What I am wondering about in this case is why the pass band is apparently completely different from the above filter even though I just made the filter's pass band wider. I would assume at least that 1/5000 is still located within the pass band and not attenuated. A possible explanation might be that 1/300 is now included within the pass band and relative to 1/5000 less attenuated making 1/5000 look just smaller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to add that I am - as you can see - quite new to this subject and actually from a different area and trying my best to understand what's going on.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The canonical question would be: How do I have to choose the cutoff points in case of a possible interval (0,1=Nyquist-Freq) to attenuate all frequency components except for 1/N and its close neighbourhood?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;library(signal)&#xA;par(mfrow=c(5,1))&#xA;&#xA;# the toy signal&#xA;ch &amp;lt;- sin(2*pi*1:100000/floor(100000/20)) + &#xA;  sin(2*pi*1:100000/floor(100000/300)) +&#xA;  sin(2*pi*1:100000/floor(100000/5000)) +&#xA;  sin(2*pi*1:100000/floor(100000/7000))&#xA;&#xA;# (s)&#xA;barplot(abs(fft(ch))[1:10000])&#xA;&#xA;filter &amp;lt;- function(c0,d1,d2) {&#xA;&#xA;  # the filter design with cutoffs specified&#xA;  fir &amp;lt;- remez(n=1000,&#xA;    f=c(0,c0-d2,c0-d1,c0+d1,c0+d2,1),&#xA;    a=c(0,0,1,1,0,0))&#xA;&#xA;  # (fN)&#xA;  plot(freq$f,abs(freq$h),type=&quot;l&quot;)&#xA;  freq &amp;lt;- freqz(fir,n=100000)&#xA;  y &amp;lt;- signal::filter(as.vector(fir), 1, x=ch)&#xA;&#xA;  # (sN)&#xA;  barplot(abs(fft(y))[1:10000])&#xA;}&#xA;&#xA;filter(1/10,1/1000,2/1000)&#xA;filter(1/10,1/500,2/500)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7507" LastEditorUserId="7507" LastEditDate="2014-05-13T15:18:34.067" LastActivityDate="2014-05-13T17:14:07.540" Title="Trying to apply Parks-McClellan optimal FIR filter design" Tags="|filter-design|parks-mclellan|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16222" PostTypeId="1" CreationDate="2014-05-13T15:17:13.847" Score="5" ViewCount="3979" Body="&lt;p&gt;I try to find about the delay between two audio files using Cross Correlation in Java. I've already done this algorithm so far that i get a idea about how many samples is the delay. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;FFT x1 -&gt; Zero Padding to length: x1.length() + x2.length()&lt;/li&gt;&#xA;&lt;li&gt;FFT x2 -&gt; Zero Padding to length: x1.length() + x2.length()&lt;/li&gt;&#xA;&lt;li&gt;X3 = FFT{x1} multiply FFT{2}*&lt;/li&gt;&#xA;&lt;li&gt;x3 = IFFT{X3}&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To validate my results, i use octave. So i can see that my result is in generally correct, but the position of my graph isn't correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For testing i use the same files, so that this represent auto correlation function. In octave graph the maximum correlation is in the center of output vector, which seems to be right. -&gt; so the delay is 0, because same files&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WhS5o.jpg&quot; alt=&quot;Auto Correlation Function Octave&quot;&gt;&#xA;In my version, the graph is at the beginning and the end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9omBM.jpg&quot; alt=&quot;Auto Correlation Function Java&quot;&gt;&#xA;So if i use two different signals, in octave the maximum correlation moves left/right from center. In my algorithm its going from beginning to middle or end to middle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it seems my graph is calculated correct, because the peak moves the amount of samples that is the difference between the files. But the position isnt correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like i have to modify my output vector: left half &amp;lt;-&gt; right half&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas whats my problem ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public void execFastCrossCorrelation() throws FFTException&#xA;{&#xA;    // the used block size is N(x1) + N(x2)&#xA;    int blockSize = (x1.length+x2.length-1);&#xA;&#xA;    // create &amp;amp; calc FFT with zero padding &amp;amp; get result&#xA;&#xA;    // FFT x1&#xA;    FFT f1 = new FFT(x1, blockSize, 44100);&#xA;    f1.execFFT();&#xA;    Complex[] c1 = f1.getOutputData();&#xA;&#xA;    // FFT x2&#xA;    FFT f2 = new FFT(x2, blockSize, 44100);&#xA;    f2.execFFT();&#xA;    Complex[] c2 = f2.getOutputData();&#xA;&#xA;    // create output for cross correlation by using fast convolution : c3 = c1 multiply c2*&#xA;    Complex[] c3 = new Complex[c1.length];&#xA;    for(int i=0; i&amp;lt;c1.length;i++)&#xA;    {&#xA;        c3[i] = c1[i].multiply(c2[i].conjugate());&#xA;    }&#xA;&#xA;    // create &amp;amp; calc IFFT  &amp;amp; get result&#xA;    IFFT f3 = new IFFT(c3, c3.length, 44100);&#xA;    f3.execIFFT();&#xA;    Complex[] corrResult = f3.getOutputData();&#xA;&#xA;// search the maximum corrleation coefficient and his index&#xA;    double maxVal = 0;&#xA;    int maxIndex = 0;&#xA;&#xA;    for(int i=0; i&amp;lt;corrResult.length;i++)&#xA;    {&#xA;        if(corrResult[i].abs() &amp;gt; maxVal)&#xA;        {&#xA;            maxVal = corrResult[i].abs();&#xA;            maxIndex = i;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So FFT class is done by using apache-commons-math3. Simply use the input vecotr and create a FFT for the given blockSize (rounded up/down to power of two and zero padded if necessary). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now i tried to flip the output (means left halft -&gt; right half and right half -&gt; left half)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result matches the version of octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rMia9.jpg&quot; alt=&quot;Auto Correlation in Java flipped&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If i try this with different files, its also working like in octave, means the maximum is moving from the center to left/right. That means that my idea that the output vector has to be &quot;mirrored&quot; seems to be right. Do you have any idea why?&lt;/p&gt;&#xA;" OwnerUserId="8895" LastEditorUserId="128" LastEditDate="2018-05-31T04:43:48.627" LastActivityDate="2022-04-10T19:02:20.213" Title="Correlation Using FFT / IFFT (Convolution in Frequency Domain) in Java" Tags="|fft|autocorrelation|cross-correlation|java|fast-convolution|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16223" PostTypeId="2" ParentId="16071" CreationDate="2014-05-13T15:20:54.593" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/8oi8dklhwazoxtq/jediMeme.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;These are not the codes you are looking for...&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I mentioned in the comments, there are quite a number of ways to do robust TDOA. (Cross-correlation with Linear Chirps, Exponential Chirps, and CDMA-type methods). You have already built a TDOA system utilizing codes, (and that is indeed a good choice over linear-chirps if you need robustness to doppler), however you are limiting yourself artificially in two ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Barker codes only go up to length $13$. We can however make PN-sequence codes of arbitrary length to get a lot more coding gain.&lt;/li&gt;&#xA;&lt;li&gt;The use of only $1$ bit in your transmission. We can encode an entire preamble of many bits to transmit, gaining further resilience to multipath.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Use a PN-Sequence:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, very simply, change the codes you use to modulate your carrier by: Use PN-Sequences instead. PN generated codes can be of (nearly) arbitrary length, and can be generated via &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_feedback_shift_register&quot; rel=&quot;nofollow noreferrer&quot;&gt;LFSRs&lt;/a&gt;. (They also go by the name 'whiteners' in some texts). Here are three PN-sequences of length $31$, $61$, and $127$ respectively. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PN_31 = [ 1  1 -1 -1  1  1 -1  1 -1 -1  1 -1 -1 -1 -1  1 -1  1 -1  1  1  1 -1  1  1 -1 -1 -1  1  1  1];&#xA;&#xA;PN_61 = [ 1  1  1 -1  1  1 -1  1 -1 -1  1 -1 -1  1  1  1 -1 -1 -1  1 -1  1  1  1  1 -1 -1  1 ...&#xA;     -1  1 -1 -1 -1  1  1 -1 -1 -1 -1  1 -1 -1 -1 -1 -1  1  1  1  1  1  1 -1  1 -1  1 -1 ...&#xA;      1  1 -1 -1  1  1 -1];&#xA;&#xA;PN_127 = [-1     1     1     1    -1     1    -1    -1     1    -1     1     1    -1    -1    -1     1     1    -1     1     1     1     1    -1     1     1    -1     1    -1 ...&#xA;       1     1    -1     1     1    -1    -1     1    -1    -1     1    -1    -1    -1     1     1     1    -1    -1    -1    -1     1    -1     1     1     1     1     1 ...&#xA;      -1    -1     1    -1     1    -1     1     1     1    -1    -1     1     1    -1     1    -1    -1    -1     1    -1    -1     1     1     1     1    -1    -1    -1 ...&#xA;       1    -1     1    -1    -1    -1    -1     1     1    -1    -1    -1    -1    -1     1    -1    -1    -1    -1    -1    -1     1     1     1     1     1     1     1 ...&#xA;      -1     1    -1     1    -1     1    -1    -1     1     1    -1    -1     1     1     1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The circular and linear auto-correlations of the sequences are shown below. They will clearly yield white spectra, but more than that, we are no longer limited to $13$ chip lengths. In fact, the last code, PN_127, yields a coding gain of $10 \ log [\frac{127}{13} ] \approx 10$ dB gain over the barker sequence, all the while guaranteeing white spectra. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q7vvA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Transmit a preamble:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your particular application, you mentioned that you were only transmitting one bit. You should try to avoid this if you can help it, and transmit as many bits as your application can allow, to get &lt;em&gt;further&lt;/em&gt; coding gain out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what is commonly done on communication protocols to align with the beginning of a packet. A (known) preamble is transmitted, composed of &lt;em&gt;many&lt;/em&gt; bits. Each bit, is composed of many chips. (In our example, $31$, $61$, or $127$ chips with either of the above PN codes). Lastly, the bit sequence itself can be composed of yet another PN sequence, or if you like, you may transmit $13$ bits composing a barker pattern, with each bit being composed of either one of the the above PN sequences. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Try one or both of those solutions, and put up your results. I expect there to be tangible improvements that we can then iterate on. (Pulse shaping, different/longer PN sequences, etc). &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2014-05-13T18:05:30.023" LastActivityDate="2014-05-13T18:05:30.023" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="16224" PostTypeId="2" ParentId="16193" CreationDate="2014-05-13T15:31:41.690" Score="5" Body="&lt;p&gt;Consider the sequences [2 0 2 0 2 0 2 0] and [1 1 1 1 1 1 1 1]. When you filter these with the filter [1/2 1/2] both become [1 1 1 1 1 1 1 1]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, there are many input sequences that all filter to the same output. If you want to invert it you need some way of choosing which of those inputs is the one you want.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-05-13T15:31:41.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16225" PostTypeId="2" ParentId="16214" CreationDate="2014-05-13T15:46:40.373" Score="0" Body="&lt;p&gt;The odd harmonics are what makes a square wave different from a sine wave in the frequency domain.  Otherwise the FFT would lose information about the wave shape of the time domain input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The higher the fundamental frequency, the farther apart are any multiples of that frequency, such as overtones or harmonics.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-13T15:46:40.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16226" PostTypeId="1" CreationDate="2014-05-13T16:22:37.643" Score="1" ViewCount="537" Body="&lt;p&gt;I'm working on image processing that involves facial features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where can I get a generic 3D model of a human face? (any format is fine as long as I can manipulate the data using C or Matlab)&lt;/p&gt;&#xA;" OwnerUserId="8567" LastActivityDate="2015-03-13T07:51:08.180" Title="How to get a generic 3d Face model?" Tags="|image-processing|3d|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16227" PostTypeId="1" CreationDate="2014-05-13T16:23:56.510" Score="3" ViewCount="204" Body="&lt;p&gt;Consider 2 undirected weighted graph as shown in figure. Consider first graph as &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt; and second graph as &lt;span class=&quot;math-container&quot;&gt;$G_2$&lt;/span&gt;. Graph &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt; consist of vertices &lt;span class=&quot;math-container&quot;&gt;$V=\{F_1,F_2,F_3,F_4,F_5\}$&lt;/span&gt; and graph &lt;span class=&quot;math-container&quot;&gt;$G_2$&lt;/span&gt; consist of vertices &lt;span class=&quot;math-container&quot;&gt;$V=\{N_1,N_2,N_3,N_4,N_5\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fjrgE.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;According to logic of my project we have to match vertices of 2 graphs as shown below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;    F_1 &amp;amp;= N_2\\&#xA;    F_2 &amp;amp;= N_5\\&#xA;    F_3 &amp;amp;= N_4\\&#xA;    F_4 &amp;amp;= N_3\\&#xA;    F_5 &amp;amp;= N_1&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;These matching values are calculated manually by seeing values of diagonal elements of 2 adjacency matrices given below.&lt;/p&gt;&#xA;&lt;p&gt;Adjacency matrix for 2 graphs are shown below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     F1     F2    F3    F4    F5&#xA; F1   3     4     3     1     4&#xA; F2   3     5     3     1     4&#xA; F3   4     3     3     1     4&#xA; F4   3     2     3     1     4&#xA; F5   3     4     3     1     5&#xA;&#xA;      N1    N2    N3    N4    N5&#xA; N1   4     3     2     1     4&#xA; N2   4     3     3     1     2&#xA; N3   4     3     2     1     2&#xA; N4   4     3     2     1     1&#xA; N5   4     3     2     1     5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How it can be done in matlab?&lt;/p&gt;&#xA;" OwnerUserId="8709" LastEditorUserId="80" LastEditDate="2023-07-02T14:52:45.503" LastActivityDate="2023-07-02T14:52:45.503" Title="Matching 2 Undirected Weighted Graph in MATLAB" Tags="|matlab|image-processing|algorithms|matrix|graph-theory|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="16228" PostTypeId="2" ParentId="16220" CreationDate="2014-05-13T16:38:12.417" Score="1" Body="&lt;p&gt;Well, you task is basically about synthesising some given sounds - this is very broad question. The function you are using: &lt;a href=&quot;http://amath.colorado.edu/pub/matlab/music/synthesize_fp.m&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;synthesize_fp.m&lt;/strong&gt;&lt;/a&gt; takes the arguments you need to play with, but two most important ones are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;f&lt;/code&gt; - vector of frequencies that you must specify. If you provide only one, then you will obtain sinusoid. Adding more frequencies will produce more complicated waveforms. You can refer to this site for some fundamental waveforms: &lt;a href=&quot;http://hyperphysics.phy-astr.gsu.edu/hbase/audio/geowv.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Geometric Waveforms&lt;/strong&gt;&lt;/a&gt;. For musical synthesis widely used is sawtooth wave, so you can start with it. Please notice that also very important are:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;p&lt;/code&gt; - amplitudes for each frequency you are providing. Changing them will affect your sound very much. Please notice that rectangular and sawtooth wave differ only with amplitudes of their harmonics. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Last parameter is &lt;code&gt;gamma&lt;/code&gt;, that defines the phase shift with respect to fundamental frequency. Personally I suggest you to set it to zeros on the beginning. This shouldn't do very much difference when you are trying to play with this synthesis task. By doing that your equation becomes simply sum of the cosines: $\cos\left(2\pi f[j]t \right)$. There is really no need to bother with phase for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mostly you would want to mimic natural spectral content of the instruments. Therefore you might want to download some instrument recordings (flute/pipe organ), analyse their spectrum and feed a given harmonics with their amplitudes to your script. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-13T16:44:54.460" LastActivityDate="2014-05-13T16:44:54.460" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16229" PostTypeId="2" ParentId="16221" CreationDate="2014-05-13T17:14:07.540" Score="1" Body="&lt;p&gt;There are a few problems with your designs. First, the desired bandwidths and transition bands (between passbands and stopbands) are very narrow. Second, some of the center frequencies are very low, especially the ones at 20/100000 and 300/100000. And finally, your chosen filter length is very large. I do not know the implementation of the Remez exchange algorithm that you use, but I've seen several implementations that run into serious numerical problems for such filter lengths. You can see in your designs that around Nyquist there are some small peaks in the filter response. These are due to numerical problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you should try to make the passband and the transition bands a bit wider and reduce the filter length to see if you can get a reasonable design. From there you could try to make the specifications a bit more stringent and increase the filter order and see how far you can go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Octave, the following specification gives a reasonable result (center frequency: 0.1, filter length: 300, '1' corresponds to Nyquist):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h=remez(300,[0,.07,.085,.115,.13,1],[0,0,1,1,0,0]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-13T17:14:07.540" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16230" PostTypeId="2" ParentId="16226" CreationDate="2014-05-13T17:40:02.893" Score="1" Body="&lt;p&gt;You might have to make your own from a 3d face database, which may not be easy to do. This website has a good listing of public databases. &lt;a href=&quot;http://www.face-rec.org/databases/&quot; rel=&quot;nofollow&quot;&gt;http://www.face-rec.org/databases/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-05-13T17:40:02.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16231" PostTypeId="1" AcceptedAnswerId="16235" CreationDate="2014-05-13T17:50:09.097" Score="4" ViewCount="891" Body="&lt;p&gt;Why are Peak filters called &quot;Peak&quot; and why are Shelving filters called &quot;Shelving&quot;. I am not a native English speaker. So excuse me if it is so dumb question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kxIFK.jpg&quot; alt=&quot;Shelving filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UarjE.jpg&quot; alt=&quot;Peak filter&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8148" LastActivityDate="2014-05-16T01:21:33.740" Title="Shelving and Peak filters name" Tags="|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16232" PostTypeId="1" CreationDate="2014-05-13T18:05:45.007" Score="0" ViewCount="89" Body="&lt;p&gt;I want to do a convolution from the bottom right and not as usual from the top left. I think conv2 of Matlab only does from the top left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do a convolution in Matlab from the bottom right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for the answers.&lt;/p&gt;&#xA;" OwnerUserId="8756" LastActivityDate="2014-05-14T17:03:47.473" Title="Convolution from bottom right" Tags="|convolution|" AnswerCount="1" CommentCount="1" ClosedDate="2014-05-16T20:16:14.547" ContentLicense="CC BY-SA 3.0" />
  <row Id="16233" PostTypeId="1" CreationDate="2014-05-13T18:12:44.003" Score="1" ViewCount="1078" Body="&lt;p&gt;Let's say we have the following matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 0 0 0 0&#xA;0 1 0 0 0 0&#xA;1 1 0 0 0 0&#xA;1 1 0 0 0 0&#xA;0 0 0 0 0 0&#xA;0 0 0 1 1 1&#xA;0 0 0 0 1 1&#xA;0 0 0 0 0 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to calculate the size of every connected region of 1s and also get the corresponding matrix elements of each region. The size should be computed as (width + heigth) / 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example the bottom left region would have size (2 + 3) / 2 and the bottom right region would have size (3 + 2) / 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional to the size of the regions I also want the corresponding entries of the regions, i.e. region 1 has entries (2,2), (3,1), (3,2) and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be done in Matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking forward for the answers and wish everybody all the best.&lt;/p&gt;&#xA;" OwnerUserId="8756" LastActivityDate="2014-05-24T20:10:15.560" Title="How to compute regions of matrix" Tags="|matlab|matrix|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16234" PostTypeId="1" CreationDate="2014-05-13T18:24:27.927" Score="3" ViewCount="532" Body="&lt;p&gt;I want to use Robust PCA for image inpainting, i.e. to estimate anomalous (bad) pixels. I assume that the bad pixels are known (mask).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to calculate the Robust PCA using Alternating Direction Method of Multipliers but if somebody has already an implementation in Matlab I would not say no to sharing it. ;) But this is not my question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I use Robust PCA for image inpainting, i.e. estimating the bad pixels? With Robust PCA I have X = L + S where X is my original image matrix for some training images, L is a low rank matrix and S is a sparse matrix.&lt;/p&gt;&#xA;" OwnerUserId="8756" LastActivityDate="2023-06-22T08:07:11.787" Title="How to use Robust PCA for image inpainting?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16235" PostTypeId="2" ParentId="16231" CreationDate="2014-05-13T18:24:52.930" Score="5" Body="&lt;p&gt;This is probably the craziest, though important question on DSP SE ;) Answer is, because they:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;look like &lt;strong&gt;&lt;em&gt;peak&lt;/em&gt;&lt;/strong&gt;:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9fPt9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;and tend to have a &lt;strong&gt;&lt;em&gt;shelf&lt;/em&gt;&lt;/strong&gt; either in the beginning or the end of frequency range:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eEeGl.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-13T19:07:19.417" LastActivityDate="2014-05-13T19:07:19.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16236" PostTypeId="1" AcceptedAnswerId="16239" CreationDate="2014-05-13T18:36:39.197" Score="0" ViewCount="151" Body="&lt;p&gt;I would like to know whether this can be done and if then how would this feat be acomplished in Matlab given a filter calculated with Remez?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;h = remez(...);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not possible then I would appreciate an explanation whether this can be done approximately (approximations of the zeros and poles) or whether this is simply mathematically pointless because a broken rational complex polynomial representation does not exist.&lt;/p&gt;&#xA;" OwnerUserId="7507" LastActivityDate="2014-05-13T18:54:39.653" Title="Is it possible to calculate a z-transform for a filter calculated with Parks-McClellan?" Tags="|filter-design|z-transform|parks-mclellan|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16238" PostTypeId="2" ParentId="16236" CreationDate="2014-05-13T18:45:50.047" Score="1" Body="&lt;p&gt;Well, &lt;code&gt;remez&lt;/code&gt; function in MATLAB returns your FIR filter coefficients &lt;code&gt;b&lt;/code&gt; (of a numerator). Having them you can obtain zeros, poles and gain by calling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[z, p, k] = tf2zpk(b, 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's more, you can use the following tool to visualize your filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; fvtool(b, 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In R you can use the function &lt;a href=&quot;http://www.inside-r.org/packages/cran/phonTools/docs/polezero&quot; rel=&quot;nofollow&quot;&gt;polezero&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; polezero(b, 1); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to get the plot.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-13T18:54:39.653" LastActivityDate="2014-05-13T18:54:39.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16239" PostTypeId="2" ParentId="16236" CreationDate="2014-05-13T18:45:58.583" Score="2" Body="&lt;p&gt;If your impulse response is $h(n)$ then the $\mathcal{Z}$-transform of this impulse response (i.e. the transfer function of the filter) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\sum_{n=0}^{N-1}h(n)z^{-n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the filter length, i.e. the number of coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that since it is an FIR filter, all its poles are at the origin of the $z$-plane. The zeros are of course the zeros of the polynomial with coefficients $h(n)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-13T18:45:58.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16240" PostTypeId="1" CreationDate="2014-05-13T19:14:10.470" Score="4" ViewCount="26301" Body="&lt;p&gt;Required to find symbol error rate vs &lt;span class=&quot;math-container&quot;&gt;$E_b/N_0$&lt;/span&gt; for 4QAM, 16QAM &amp;amp; 32QAM.  Thought that SER &amp;amp; BER are the same but did my research to find that BER is &lt;span class=&quot;math-container&quot;&gt;$1/\log_2(M)$&lt;/span&gt; of SER. Could you please confirm this?&lt;/p&gt;&#xA;&lt;p&gt;Also found SER for:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;4QAM to be: &lt;span class=&quot;math-container&quot;&gt;$\displaystyle \text{erfc}\sqrt{\dfrac{E_b}{2N_0}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;and that of 16QAM to be: &lt;span class=&quot;math-container&quot;&gt;$\displaystyle\dfrac{3}{2} \text{erfc}\sqrt{\dfrac{E_b}{10N_0}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Are these values correct?  Still have problems to find SER for 32QAM...&lt;/p&gt;&#xA;&lt;p&gt;Hope you can help.&lt;/p&gt;&#xA;" OwnerUserId="8900" LastEditorUserId="1629" LastEditDate="2021-01-12T09:04:26.130" LastActivityDate="2021-01-12T09:04:26.130" Title="Deriving SER &amp; BER for 4QAM, 16QAM and 32QAM" Tags="|digital-communications|modulation|demodulation|amplitude-modulation|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="16241" PostTypeId="1" AcceptedAnswerId="16243" CreationDate="2014-05-13T19:56:49.583" Score="1" ViewCount="806" Body="&lt;p&gt;I will be using one central node/latop to play a tone and will have a second node/laptop to record and read the sound and be able to say this node is on the left or right. So trying to figure out the best way to distinguish between the two tones. I want to have a tone set for left and one set for the right. I want the sound to have 400 Samples at 44100 for 10ms between 18-22freq just outside the human hearing range so that the sound is not annoying etc. I want the sound to be different slightly but be able to tell the diff between them for the system to say the node that recorded and processed the sound is on the left of right. How would I go about doing this in matlab because I don't dont really code in this language much and only time I did was for image processing just doing this so I can graduate. &lt;/p&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2014-05-13T20:27:57.730" Title="Playing/Recording acoustic signal in matlab to tell difference between 2 sounds" Tags="|matlab|discrete-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16242" PostTypeId="1" AcceptedAnswerId="16244" CreationDate="2014-05-13T20:11:59.987" Score="0" ViewCount="1296" Body="&lt;p&gt;I have designed few shelving and peak filter. And I have calculated the a, b coeficients for several gains for these filters. Now I would like to create some kind of characteristic in Matlab so I could present my design of these filters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like this for shelving filter &#xA;&lt;img src=&quot;https://i.stack.imgur.com/ahZzW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8148" LastActivityDate="2014-05-15T19:10:01.670" Title="Matlab - Creating a characteristic for Peak and Shelving filter" Tags="|matlab|filters|filter-design|infinite-impulse-response|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16243" PostTypeId="2" ParentId="16241" CreationDate="2014-05-13T20:27:57.730" Score="1" Body="&lt;p&gt;I understand that you want to tell if your second laptop is placed on the left or right (or maybe on the axis) of main node? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you then to play the two-tone stereo signal, i.e.: $15\;kHz$ from the left, and $16\;kHz$ from the right speaker at the same time. Assuming that you are going to use sampling frequency of $f_s=41000 \;  \text{Hz}$ and taking the average distance between two speakers in a laptop to be $25\;cm$, you can calculate that the maximum delay between two signals, if the second node is on the right, will be approximately: $\dfrac{0.25}{343}=0.7289\;msec$. This corresponds to $32$ samples at a given sampling frequency. It is therefore a hard task, but still possible. Then after finding the delay between two signals, from its sign you are able to tell which speaker is further away, ergo you are on the opposite side. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB you just need to generate proper signals, given sampling frequency and play them back/record with: &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/import_export/record-and-play-audio.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;MATLAB - Record and Play Audio&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Few problems can arise:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You want to use very high frequencies, and this can be problematic as laptop speakers are usually low-grade gear and they possibly might have some problems- same goes to microphone. Also remember to turn any hardware noise cancellation, spatial enhancements, etc.&lt;/li&gt;&#xA;&lt;li&gt;Detection of you signal onset could be problematic as the resolution of DFT will be to low. You can also use some kind of correlation detection, but this is a problem for later on. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-13T20:27:57.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16244" PostTypeId="2" ParentId="16242" CreationDate="2014-05-13T20:29:56.637" Score="2" Body="&lt;p&gt;I suggest you to use &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ref/fvtool.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;fvtool&lt;/strong&gt;&lt;/a&gt; in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fvtool(b,a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-13T20:29:56.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16245" PostTypeId="1" AcceptedAnswerId="16246" CreationDate="2014-05-13T23:18:06.653" Score="0" ViewCount="704" Body="&lt;p&gt;I saw in some codes people always taper the ends of a signal using a cosine taper. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that necessary and why?&lt;/p&gt;&#xA;" OwnerUserId="8863" LastEditorUserId="8863" LastEditDate="2014-05-14T03:03:25.633" LastActivityDate="2014-05-14T03:03:25.633" Title="Is it necessary to taper two ends before fft a time series?" Tags="|fft|filters|signal-analysis|lowpass-filter|speech-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16246" PostTypeId="2" ParentId="16245" CreationDate="2014-05-14T01:10:14.913" Score="2" Body="&lt;p&gt;Tapering the two ends of a short audio signal allows it to be played at an arbitrary time after and before silence without a speaker &quot;pop&quot; or loud click.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a raised cosine taper reduces potential high frequency spectral content inherent in any sudden sharp startup transient, which might not be present in the rest of the data due to prior low pass filtering.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-14T01:10:14.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16247" PostTypeId="2" ParentId="16216" CreationDate="2014-05-14T02:24:18.733" Score="3" Body="&lt;p&gt;How do you measure the power of your signal?&lt;/p&gt;&#xA;&lt;p&gt;You will approximate it using,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{x,av} = \frac{1}{K} \sum_{k=0}^{K-1} |x(k)|^2,\text{ right! Where}\quad x(k) = x_{I}(k) + i.x_{Q}(k)&#xA;$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; denotes the imaginary part.&lt;/p&gt;&#xA;&lt;p&gt;In order to add a noise signal, you need to add noise to I and the Q part of &lt;span class=&quot;math-container&quot;&gt;$x(k)$&lt;/span&gt; separately. If we assume noise for I part to be &lt;span class=&quot;math-container&quot;&gt;$n_{I}(k)$&lt;/span&gt; and for Q part to be &lt;span class=&quot;math-container&quot;&gt;$n_Q(k)$&lt;/span&gt;, then the total noise power will be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{n,av} = \frac{1}{N}\sum_{k=0}^{K-1} |n(k)|^2,\quad\text{where}\quad n(k) = n_{I}(k) + i.n_Q(k)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;SNR is given as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;10\log_{10}\left(\frac{P_{x,av}}{P_{n,av}}\right)&#xA;$$&lt;/span&gt;&#xA;So, the total noise power, i.e., for the I and Q part combined for a given SNR value is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{n,av} = P_{x,av}10^{-SNR/10}&#xA;$$&lt;/span&gt;&#xA;You will generate one noise vector for I, i.e., add it to I part of &lt;span class=&quot;math-container&quot;&gt;$x(k)$&lt;/span&gt; with half of the power, and another noise vector to be added to Q part of &lt;span class=&quot;math-container&quot;&gt;$x(k)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$x(k)$&lt;/span&gt; is complex you can add noise in one go if you make the complex noise signal &lt;span class=&quot;math-container&quot;&gt;$n(k)$&lt;/span&gt; as mentioned above. In case of Gaussian noise you use &lt;code&gt;randn()&lt;/code&gt; function to generate noise for both I and Q parts, but do not forget to multiply each Gaussian noise component by &lt;span class=&quot;math-container&quot;&gt;$\sqrt{P_{n,av/2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hint: btw MATLAB allows this, &lt;code&gt;x = 1 + 1i*2&lt;/code&gt;, you can do &lt;code&gt;n = nI + 1i*nQ&lt;/code&gt;, if &lt;code&gt;nI&lt;/code&gt; and &lt;code&gt;nQ&lt;/code&gt; are noise vectors.&lt;/p&gt;&#xA;" OwnerUserId="8832" LastEditorUserId="1629" LastEditDate="2021-02-12T09:50:12.173" LastActivityDate="2021-02-12T09:50:12.173" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16248" PostTypeId="2" ParentId="16154" CreationDate="2014-05-14T04:58:05.707" Score="-1" Body="&lt;p&gt;Making some progress on this. So far I've found that the method for computing the coefficients (from &lt;a href=&quot;http://nptel.ac.in/courses/IIT-MADRAS/Principles_of_Communication1/Pdfs/1_9.pdf&quot; rel=&quot;nofollow&quot;&gt;http://nptel.ac.in/courses/IIT-MADRAS/Principles_of_Communication1/Pdfs/1_9.pdf&lt;/a&gt;) appears to have issues. It will create coefficients with a sum of almost 1, but the coefficients can sometimes be quite large (e.g. 15 and -14 in one case). When this is applied to samples with sizable values (e.g. &gt; 9000), this can lead to absurd prediction values such as 190,000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding this simple function dramatically reduces the error, bringing the standard deviation for 64 block size down to 20% more than the uncorrected version with 32k block size:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void SanitizeCoeffs(float coeffs[], size_t numCoeffs)&#xA;{&#xA;    switch (numCoeffs)&#xA;    {&#xA;        case 2:&#xA;        {&#xA;            if (abs(coeffs[0]) + abs(coeffs[1]) &amp;lt;= 3.0f)&#xA;                return;&#xA;&#xA;            coeffs[0] = 2.0f;&#xA;            coeffs[1] = -1.0f;&#xA;&#xA;            break;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Still leaves unanswered questions, but I think I can live with this, so probably won't investigate further.&lt;/p&gt;&#xA;" OwnerUserId="5592" LastEditorUserId="5592" LastEditDate="2014-05-15T06:19:45.507" LastActivityDate="2014-05-15T06:19:45.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16249" PostTypeId="1" CreationDate="2014-05-14T08:14:16.837" Score="0" ViewCount="2237" Body="&lt;p&gt;What does End Effect in signal processing basically means? I would like to see some reference book or papers if you suggest me.&lt;br&gt;&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2014-05-14T08:49:03.433" Title="What is End Effect in signal processing?" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16250" PostTypeId="2" ParentId="16214" CreationDate="2014-05-14T08:39:15.170" Score="0" Body="&lt;p&gt;By definition, a sine wave is given by: $\frac{e^{j2\pi f_0 n} - e^{-j2\pi f_0 n}}{2}$. Therefore, you will see one harmonics at index $k_1 = N\frac{f_0}{F_s}$ and &lt;strong&gt;a copy of it&lt;/strong&gt; at $k_2 = N - k_1$. Where $N$ is the FFT size which is 64 in your case. So, $k_1 = 64.2k/8k = 16$, and $k_2 = 48$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, you need to find the definition of a square wave, which must be having the main component $e^{j2\pi f_0 n}$ and its harmonics $e^{j2\pi k f_0 n}$, where $k = 0, 1, 2, ...$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For high frequencies, there are lesser Harmonics as by definition Harmonic frequencies are always the integer multiple of the fundamental frequency. Therefore, if your fundamental is at $600$Hz, you'll have Harmonics at $1200, 1800, 2400, ...$. Now as you increase your fundamental, the Harmonics become fewer and fewer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is more to it in terms of aliasing, however, I'll not dwell into that topic.   &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-05-14T08:39:15.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16251" PostTypeId="2" ParentId="16249" CreationDate="2014-05-14T08:49:03.433" Score="1" Body="&lt;p&gt;The end effect refers to where many filters and similar processes produce spurious results at the ends of the dataset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several reasons why this can occur. The most common one is when using moving window based filters the filter is not well defined at the boundary. For example consider a filter with a window of size 3. At your first data point ($n=1$) this filter is not well defined as $n=0$ does not exist. In order to calculate a value at this point the most common approach is to pad your data (often with zeros) to extend the width. As this is not real data it will skew the results for these points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find much literature on it. The book &lt;a href=&quot;http://books.google.co.uk/books?id=lYOjEIGLkxIC&amp;amp;lpg=PA57&amp;amp;ots=hAog4iFxjN&amp;amp;dq=edge+effect+convolution&amp;amp;pg=PA57&amp;amp;redir_esc=y#v=onepage&amp;amp;q=edge%20effect%20convolution&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;Biosignal and Medical Image Processing&lt;/a&gt; has a little bit.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-14T08:49:03.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16252" PostTypeId="1" CreationDate="2014-05-14T08:56:26.143" Score="0" ViewCount="5755" Body="&lt;p&gt;I need to implement people counting(head count) into one of the product.&#xA;I am able to detect faces and count them but only when the persons are actually looking into the camera, if they are not looking into it they will not be detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what I want is to an idea about detecting human rather than detecting only face.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have gone through some algorithm like voila jones etc..but did not get anything useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be great if someone can share their experience or any code snippet to do so or any algorithm to help me out here.&lt;/p&gt;&#xA;" OwnerUserId="8904" LastEditorUserId="8202" LastEditDate="2014-05-16T22:25:26.207" LastActivityDate="2018-10-13T06:49:37.847" Title="People counting implementation using OpenCV" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16253" PostTypeId="1" AcceptedAnswerId="16255" CreationDate="2014-05-14T09:16:16.727" Score="1" ViewCount="304" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Am53g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apply an FIR filter passing the band around 50/1000 and attenuating the other three frequency components 30/1000, 70/1000 and 110/1000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both filters are generated using the Remez algorithm. The first filter is of length 300 and the second is of length 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the beginning of the filtered signal attenuated and why is this attenuation effect stronger for a longer filter?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;library(signal)&#xA;par(mfrow=c(3,2))&#xA;&#xA;ch &amp;lt;- &#xA;  sin(2*pi*1:1000/floor(1000/30)) +&#xA;  sin(2*pi*1:1000/floor(1000/50)) +&#xA;  sin(2*pi*1:1000/floor(1000/70)) +&#xA;  sin(2*pi*1:1000/floor(1000/110))&#xA;&#xA;# FFT of signal&#xA;barplot(abs(fft(ch)[1:120]))&#xA;&#xA;# unfiltered signal&#xA;plot(ch,type=&quot;l&quot;)&#xA;&#xA;filter &amp;lt;- function(c0,d1,d2,n) {&#xA;  fir &amp;lt;- remez(n=n,f=c(0,c0-d2,c0-d1,c0+d1,c0+d2,1),a=c(0,0,1,1,0,0))&#xA;&#xA;  freq &amp;lt;- freqz(fir,n=n)&#xA;  y &amp;lt;- signal::filter(as.vector(fir), 1, x=ch)&#xA;&#xA;  # frequency response of filter&#xA;  barplot(abs(fft(y))[1:120])&#xA;  return(list(freq = freq, fir = fir, y = y))&#xA;}&#xA;&#xA;f &amp;lt;- filter(2*50/1000,1/80,1/40,n=300)&#xA;&#xA;# first filtered signal&#xA;plot(f$y, type=&quot;l&quot;)&#xA;&#xA;&#xA;f &amp;lt;- filter(2*50/1000,1/80,1/40,n=100)&#xA;&#xA;# second filtered signal&#xA;plot(f$y, type=&quot;l&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7507" LastActivityDate="2014-12-17T04:04:44.357" Title="Why is beginning of this FIR filtered signal attenuated?" Tags="|filter-design|bandpass|parks-mclellan|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16254" PostTypeId="2" ParentId="16240" CreationDate="2014-05-14T10:17:50.433" Score="14" Body="&lt;p&gt;I will try to give a relatively simple answer to a complex question. I will not give any exact expressions for the error rates for two reasons. The first I stated in my initial sentence, the second is that from your formulas I can see that you only looked for (or at least found) approximate expressions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Judging whether an expression for the error rate is correct - either as an exact expression or as a valid approximation - is complicated by several facts, the most important of which are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;different authors use different functions to express the cdf of the Gaussian distribution. The following relations hold:&#xA;$$Q(x)=\frac12\textrm{erfc}\left(\frac{x}{\sqrt{2}}\right)=\frac12\left[1-\textrm{erf}\left(\frac{x}{\sqrt{2}}\right)\right]$$&#xA;where erf$(x)$ is called the &lt;em&gt;error function&lt;/em&gt;, erfc$(x)$ is the &lt;em&gt;complementary error function&lt;/em&gt;, and $Q(x)$ is simply called the &lt;em&gt;Q-function&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The noise power spectral density $N_0$ is usually defined as the &lt;em&gt;one-sided&lt;/em&gt; density, but some authors use the &lt;em&gt;two-sided&lt;/em&gt; density. See &lt;a href=&quot;https://dsp.stackexchange.com/questions/15539/probability-error-for-antipodal-systems-and-orthogonal-systems/15547#15547&quot;&gt;this answer&lt;/a&gt; to a related question for a brief discussion of this issue. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The signal energy can be expressed by the energy per symbol, the energy per bit, by the minimum distance between symbols, etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For these reasons the same error rate can be expressed by several different formulas and it takes some patience to verify that they are actually all the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following I will use:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the Q-function $Q(x)$&lt;/li&gt;&#xA;&lt;li&gt;energy per bit $E_b$&lt;/li&gt;&#xA;&lt;li&gt;the &lt;em&gt;one-sided&lt;/em&gt; noise power spectral density $N_0$&lt;/li&gt;&#xA;&lt;li&gt;$M=2^k$ is the number of symbols, where each symbol represents $k=\log2 M$ bits&lt;/li&gt;&#xA;&lt;li&gt;the assumption that all symbols are equally likely&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The probability of symbol error $P_s$ for an AWGN channel can be approximated by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s\approx a(M)Q\left(\frac{d(M,E_b)}{\sqrt{2N_0}}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approximation &#xA;is valid at high and moderate SNRs, and is often used in practice. The function $a(M)$ is the average number of nearest neighbors in the symbol constellation. The function $d(M,E_b)$ is the minimum distance between two symbols. It depends of course on the number of symbols $M$ as well as on the energy per bit $E_b$. For even $k$ (i.e. for quadratic constellations) $a(M)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(M)=4\left(1-\frac{1}{\sqrt{M}}\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at the case $M=16$. The 4 inner points have 4 neighbors, the 8 edge points have 3 neighbors, and the 4 corner points have 2 neighbors, i.e. the average number of neighbors is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac14\cdot 4+\frac12\cdot 3+\frac14\cdot 2=3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which of course equals $a(16)=3$.&#xA;In the case of a cross-constellation the formula (2) is not valid anymore. For a cross-constellation with $M=32$ you have 16 inner points with 4 neighbors, 8 edge points with 3 neighbors, and 8 &quot;corner&quot; points with 2 nearest neighbors. So the average number of nearest neighbors is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac12\cdot 4+\frac14\cdot 3+\frac14\cdot 2=\frac{13}{4}=3.25\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we need to find the function $d(M,E_b)$. Again, for even $k$ (quadratic constellations) a general expression for $d(M,E_b)$ can be derived with relative ease (see e.g. &lt;a href=&quot;http://my.safaribooksonline.com/book/electrical-engineering/communications-engineering/9781139036535/2dot2-signal-constellations/222_average_energy_in_a_qam_co#X2ludGVybmFsX0J2ZGVwRmxhc2hSZWFkZXI/eG1saWQ9OTc4MTEzOTAzNjUzNS8xNQ==&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d(M,E_b)=\sqrt{\frac{6\log_2 (M) E_b}{M-1}}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the cross-constellation with $M=32$ we first need to compute the average energy per symbol. There are 5 different amplitude values, each contributing to the average energy per symbol (the symbols are at locations $\{a,3a,5a\}+i\{a,3a,5a\}$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E=\frac{4}{32}\cdot 2a^2 +\frac{8}{32}\cdot10a^2 +\frac{4}{32}\cdot18a^2 +\frac{8}{32}\cdot26a^2 +\frac{8}{32}\cdot34a^2=20a^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the minimum distance between two symbols is $d=2a$ we get for $d$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d=2a=2\sqrt{\frac{E}{20}}=\sqrt{\frac{E}{5}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $E=\log_2M\cdot E_b=5E_b$ we finally get for the $M=32$ cross-constellation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d=\sqrt{E_b}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining (1), (3), and (5) we get the approximation for the symbol error rate of the $M=32$ cross constellation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s\approx 3.25\cdot Q\left(\sqrt{\frac{E_b}{2N_0}}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the above formulas we get for 4-QAM and for 16-QAM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s\approx 2\cdot Q\left(\sqrt{\frac{2E_b}{N_0}}\right)\quad\textrm{(4-QAM)}\\&#xA;P_s\approx 3\cdot Q\left(\sqrt{\frac{4E_b}{5N_0}}\right)\quad\textrm{(16-QAM)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability of bit error can be obtained from the probability of symbol error quite easily if we assume Gray encoding (i.e. nearest neighbors differ by only one bit), and if we assume that errors are only caused by confusion with nearest neighbors (which is a good assumption at moderate to high SNRs). In this case a symbol error causes only one bit error and the bit error probability can be approximated by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_b\approx\frac{1}{\log_2M}P_s$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-05-14T16:15:23.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16255" PostTypeId="2" ParentId="16253" CreationDate="2014-05-14T10:42:58.773" Score="4" Body="&lt;p&gt;The filter you designed is a linear phase filter, therefore, response of the filter will start at $N/2$th sample, where $N $ is the filter order. As $N$ increases so does the delay of the response. You can find this delay value by computing group delay of the filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you want to reduce the delay, you can design a minimum phase filter. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastEditorUserId="8832" LastEditDate="2014-05-15T05:04:28.083" LastActivityDate="2014-05-15T05:04:28.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16258" PostTypeId="1" CreationDate="2014-05-14T13:00:26.743" Score="2" ViewCount="2058" Body="&lt;p&gt;I'm new to matlab sound processing and I am trying to create a 2D array for the sound code below. I have to make the sound have 400 samples(i.e 10ms) at 20hz, but having trouble getting the code to work. Any help would be greatly appreciated. &#xA;The steps are:&#xA;(1)    Construct a two-dimensional array (n x 2  array, i.e., 2 columns, n rows, n is the number of samples per sound channel).  The array is the sound signal, the first column is the sound for the left channel (left speaker), the second column is the sound for the right channel (right speaker)&#xA;(2)    Then play the sound.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 44100;&#xA;t = [0:4/Fs:4-4/Fs];&#xA;freq = 20;&#xA;f1 = sin(2*pi*freq*t);&#xA;f2 = sin(2*pi*2*freq*t);&#xA;%Sound 1&#xA;sound(f1,Fs);&#xA;%Sound 2&#xA;sound(f2,Fs);&#xA;%Play Consecutive&#xA;f12 = [f1 f2];&#xA;sound(f12,Fs);&#xA;%Play together&#xA;f_12 = [f1+f2];&#xA;sound(f_12,Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8901" LastEditorUserId="8662" LastEditDate="2014-05-14T15:56:49.317" LastActivityDate="2022-04-12T08:06:30.627" Title="Creating 2D array to play audio in left and right channel in matlab" Tags="|matlab|signal-analysis|sound|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16259" PostTypeId="2" ParentId="16253" CreationDate="2014-05-14T13:17:57.363" Score="2" Body="&lt;p&gt;For a $N$th order FIR filter, the first $N$ outputs are not valid, since they are the &lt;em&gt;transient response&lt;/em&gt; of the filter. Check the &quot;Steady State and Transient Response&quot; section in this page: &lt;a href=&quot;http://www.music.mcgill.ca/~gary/618/week1/signals.html&quot; rel=&quot;nofollow&quot;&gt;http://www.music.mcgill.ca/~gary/618/week1/signals.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8735" LastActivityDate="2014-05-14T13:17:57.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16260" PostTypeId="2" ParentId="16258" CreationDate="2014-05-14T13:33:10.193" Score="1" Body="&lt;p&gt;Since 20 Hz was a little hard to hear with my speakers, I've changed the main frequency to 600 Hz. I guess it should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;clear all;&#xA;&#xA;Fs = 44100; &#xA;N = 40000; % sample size&#xA;t = (1:N)*(1/Fs); &#xA;freq = 600; &#xA;&#xA;sound_array = zeros(N, 2); % initializes a N x 2 matrix&#xA;sound_array(:,1) = sin(2*pi*freq*t); &#xA;sound_array(:,2) = sin(2*pi*2*freq*t); &#xA;&#xA;% Sound 1 &#xA;sound(sound_array(:,1),Fs); &#xA;&#xA;% Sound 2 &#xA;sound(sound_array(:,2),Fs); &#xA;&#xA;% Play the first column at left channel and the second column at the right&#xA;% channel&#xA;sound(sound_array,Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In fact, if you use the entire array as input in &lt;code&gt;sound&lt;/code&gt;, the first column will go to the left channel and the second column to the right channel.&lt;/p&gt;&#xA;" OwnerUserId="8735" LastEditorUserId="8735" LastEditDate="2014-05-14T17:06:30.343" LastActivityDate="2014-05-14T17:06:30.343" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="16263" PostTypeId="2" ParentId="16232" CreationDate="2014-05-14T17:03:47.473" Score="2" Body="&lt;p&gt;I hope I understand your question correctly, in that you're trying to produce a mirror image of the convolution kernel (filter) and then convolve. Flip you convolution kernel. In MATLAB, you can use the &lt;code&gt;flip&lt;/code&gt; command. If you flip it left-to-right, this should do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you're simply saying that you want to use the same kernel but start the convolution process from a different point, this would not give you a different result back at all. This is one of the reasons you can do FFT based convolution.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-05-14T17:03:47.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16264" PostTypeId="2" ParentId="16252" CreationDate="2014-05-14T17:19:51.120" Score="2" Body="&lt;p&gt;This is an ongoing research problem, which is much more difficult to solve than face detection due to a gigantic variety of poses, angles, and other factors that play a role. This is usually done with image feature extraction on a large set of images followed by a supervised learning algorithm. In short, there's no unique answer, and there's definitely not a simple &quot;code snippet&quot; one could use for this task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're implementing a specific algorithm, you could probably get better help here, but not at this point.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-05-14T17:19:51.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16267" PostTypeId="2" ParentId="16139" CreationDate="2014-05-15T07:31:36.033" Score="1" Body="&lt;p&gt;Some quick partial answers:&lt;br/&gt;&#xA;If you simply want to learn embedded, get an Arduino.&lt;br/&gt;&#xA;If you want to learn a DSP, get EZDSP&lt;br/&gt;&#xA;If you want something that's 32-bits, 1 Ghz, get a Raspberry Pi or pcDuino.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Off the top of my head I don't have anything that is a proper DSP that meets every one of your requirements. pcDuino (not sure about Raspberry Pi) has SIMD and saturating instructions like a DSP, if that's close enough to count.&lt;/p&gt;&#xA;" OwnerUserId="5592" LastActivityDate="2014-05-15T07:31:36.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16268" PostTypeId="2" ParentId="16242" CreationDate="2014-05-15T07:43:14.323" Score="1" Body="&lt;p&gt;Thanks to @jojek I managed to create some characteristics for my filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low shelving filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dQBbw.png&quot; alt=&quot;Low shelving filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;High shelving filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VtUTT.png&quot; alt=&quot;High shelving filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak filter - bandwidth&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6elU0.png&quot; alt=&quot;Peak filter - bandwidth&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak filter - gain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/E8qKJ.png&quot; alt=&quot;Peak filter - gain&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8148" LastEditorUserId="8148" LastEditDate="2014-05-15T19:10:01.670" LastActivityDate="2014-05-15T19:10:01.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16269" PostTypeId="1" CreationDate="2014-05-15T07:50:22.480" Score="2" ViewCount="3540" Body="&lt;p&gt;I need to identify certain features of the audio signal recorded from microphone in stethoscope. These sounds are only samples i've found, but the final signal will be probably a bit noisier (maybe not, i don't know yet). Below are examples of three signals. Normal one and one of the person sick with atrial spatial defect, third one is of person with late aortic stenosis. These two fluctuations are named S1 and S2 respectively and they are my main subject of interest. Depending on a given heart condition S1 may have doubling and there may be some &quot;noisy&quot; sounds (clicks also) between S1 and S2. The length of the whole cycle (S1, S2) may vary depending on the heart rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what kind of processing should i perform to surely extract and recognize those features, i.e. two large fluctuations normally, with slight delay between them and if person is sick it may be either something before S1 or between S1 and S2 or S1 may double a bit. Also normally S1 has a larger amplitude spike than S2 as i understand. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have very limited knowledge in this field and not sure about what options are available to me. FFT magnitude graphs are showing somewhat recognizable results, but i think there is too much unneeded information there and they are not so distinct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The samples themselves can be found here: &lt;a href=&quot;http://depts.washington.edu/physdx/heart/demo.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Washington University: Heart sound samples&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Normal heart sound:&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/as59F.png&quot; alt=&quot;Normal heart sound&quot;&gt;&#xA;&lt;strong&gt;Atrial spatial defect heart sound:&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xUn84.png&quot; alt=&quot;Atrial spatial defect heart sound&quot;&gt;&#xA;&lt;strong&gt;Late aortic stenosis:&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/stMER.png&quot; alt=&quot;Late aortic stenosis&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3599" LastActivityDate="2014-08-13T16:20:47.763" Title="Preprocessing audio signal for neural network classification" Tags="|signal-analysis|machine-learning|preprocessing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16271" PostTypeId="1" AcceptedAnswerId="16280" CreationDate="2014-05-15T12:12:56.273" Score="4" ViewCount="10899" Body="&lt;p&gt;TV is L1 norm of gradient of an image. So we've to find gradient of the image (which is still matrix, right?). Then take the sum of absolute values of the gradient matrix (So now it must be a scalar, right?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I simply use &lt;code&gt;imgradient&lt;/code&gt; function in matlab for first step? It gives two values magnitude and direction, so which one should I consider for next step?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After getting gradient matrix say &lt;code&gt;Igrad&lt;/code&gt;, will just summing absolute values (&lt;code&gt;sum(abs(Igrad(:)))&lt;/code&gt; give me TV? And it must be just a single scalar value right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for reading. Keenly waiting for your reply.&lt;/p&gt;&#xA;" OwnerUserId="8915" LastEditorUserId="128" LastEditDate="2018-05-12T09:20:49.220" LastActivityDate="2022-08-04T14:57:13.533" Title="How to Calculate Total Variation (TV) of an Image?" Tags="|image-processing|matlab|total-variation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16272" PostTypeId="2" ParentId="16269" CreationDate="2014-05-15T12:31:01.627" Score="0" Body="&lt;p&gt;It looks to me like you can identify the differences between the three signals based on the spectral content and the absolute hilbert envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a lot more high frequency content in the defective heart beats so you can compare FFT magnitudes in the upper frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The envelopes of the healthy signal are nice curves, like a cosine window, so again you could measure how far the envelope differs from a cosine window or the envelope of the healthy heart beat.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2014-05-15T12:31:01.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16273" PostTypeId="1" CreationDate="2014-05-15T12:43:20.343" Score="0" ViewCount="1079" Body="&lt;p&gt;I have a play function that is called twice, each plays a channel (a column of the two dimensional array) in both speakers. What I am trying to do  is to play both channel at the same time. How do I silence a channel and set the  the elements in the corresponding column to 0. I also need an output array that im trying to make look like this when the data is output into it. The code is in the link below. &#xA;1     0&#xA;2     0&#xA;1     0&#xA;0     4&#xA;0     1&#xA;0     1&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 44100;&#xA;N = 400&#xA;t = (1:N)*(1/Fs);&#xA;freq = 600;&#xA;&#xA;sound_array = zeros(N,2);&#xA;%starts N x 2 matrix&#xA;sound_array(:,1) = sin(2*pi*freq*t);&#xA;sound_array(:,2) = sin(2*pi*freq*t);&#xA;&#xA;%Sound 1 &#xA;sound(sound_array(:,1), Fs);&#xA;%Sound 2&#xA;sound(sound_array(:,2), Fs);&#xA;%Play Consecutive&#xA;sound(sound_array, Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8901" LastEditorUserId="8202" LastEditDate="2014-05-15T13:18:57.587" LastActivityDate="2014-05-15T13:28:16.220" Title="Playing sound in left and right speaker alternatively and storing output in array in matlab" Tags="|matlab|signal-analysis|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16274" PostTypeId="1" AcceptedAnswerId="16281" CreationDate="2014-05-15T12:44:34.533" Score="-1" ViewCount="336" Body="&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: The signal $cos(2\pi14100t)$ is sampled at $F_s = 400 Hz$. It is then upsampled with a factor 3 and then reconstructed ideally with a new frequency $F = 500 Hz$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now want to find the new signal that is created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Incomplete solution&lt;/strong&gt;: With the frequency before sampling $\pm 141000 Hz$. After sampling the normalized frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f = \pm {14100 \above 1 pt 400} \pm k = \pm (35 + {1 \above 1 pt 4})\pm k= \pm {1 \above 1 pt 4} \pm k $ per sample&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interpolation with factor 3 yields the normalized frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f = {\pm {1 \above 1 pt 4} \pm k \above 1 pt 3} = $ 3 frequencies $\pm k?$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to solve it past that to get the final $F= \pm f * F_s$. I.e. $y(t) = cos(2\pi f_1t) + cos(2\pi f_2t) + cos(2\pi f_3t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my question is how do I calculate the 3 frequencies?&lt;/strong&gt; Would greatly appreciate a simple solution and not just an answer so that I actually understand this.&lt;/p&gt;&#xA;" OwnerUserId="8914" LastEditorUserId="8914" LastEditDate="2014-10-08T13:52:55.467" LastActivityDate="2014-10-08T13:52:55.467" Title="Ideal Reconstruction of Upsampled Signal" Tags="|sampling|interpolation|reconstruction|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="16275" PostTypeId="2" ParentId="16273" CreationDate="2014-05-15T13:15:53.283" Score="1" Body="&lt;p&gt;If you want to play only one channel then you must set zeros at one of your matrix columns, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sound_L = sound_array;&#xA;sound_L(:,2) = 0;&#xA;&#xA;sound_R = sound_array;&#xA;sound_R(:,1) = 0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So your code becomes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 44100;&#xA;N = 400&#xA;t = (1:N)*(1/Fs);&#xA;freq = 600;&#xA;&#xA;sound_array = zeros(N,2);&#xA;%starts N x 2 matrix&#xA;sound_array(:,1) = sin(2*pi*freq*t);&#xA;sound_array(:,2) = sin(2*pi*freq*t);&#xA;&#xA;%Left and Right channels&#xA;&#xA;sound_L = sound_array;&#xA;sound_L(:,2) = 0;&#xA;sound_R = sound_array;&#xA;sound_R(:,1) = 0;  &#xA;&#xA;%Sound 1 &#xA;sound(sound_L, Fs);&#xA;%Sound 2&#xA;sound(sound_R, Fs);&#xA;%Play Consecutive&#xA;sound(sound_array, Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-15T13:28:16.220" LastActivityDate="2014-05-15T13:28:16.220" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16276" PostTypeId="2" ParentId="16032" CreationDate="2014-05-15T13:23:34.487" Score="1" Body="&lt;p&gt;So I made progress on this particular problem. I have yet to optimize and improve our solution but it is definitely an improvement over what I posted here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I do not set pixel value to 0 if they are outside the intensity window I'm targeting anymore. I felt that while it did produce crisp boundaries for my superpixels this preprocessing step could be messing with the IFT algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also thought that the IFT algorithm was labeling and relabeling over the same superpixels. I used the &lt;a href=&quot;http://www.lni.hc.unicamp.br/~bergo/falcao_bergo_dift_2004.pdf&quot; rel=&quot;nofollow&quot;&gt;differential version of the algorithm&lt;/a&gt; which gave me a better global diffusion inside my graph.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The edges obtained in low contrast regions can be jagged but I plan to smooth them with either the Relaxed IFT or some post-processing steps like applying the Fourier Transform to my contour, applying a low pass filter + inverse FT and get a smoothed contour by morphological operators. &lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2014-05-15T13:23:34.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16277" PostTypeId="2" ParentId="16234" CreationDate="2014-05-15T13:53:01.370" Score="5" Body="&lt;p&gt;As far as I can remember, one of the main interests of using R-PCA for image inpainting is that a pixel accurate defective pixel masks is not necessary.&#xA;Intuitively, the main idea is that the observed image has low rank, but that the defects (given by the mask);&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;disturb this low-rank property&lt;/li&gt;&#xA;&lt;li&gt;form a sparse distribution.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Thus, image inpainting using R-PCA is given in this context by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X = L + S,$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is the restored (inpainted) image and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the defective pixel mask.&lt;/p&gt;&#xA;&lt;p&gt;This approach was implemented for example for background subtaction (motion detection task): the authors perform a low rank reconstruction of some shopping mall hallway. The moving pedestrians end up in the sparse component (=&amp;gt; mask) and the background is given by the low rank part. The backgournd does not have any &amp;quot;holes&amp;quot; in place of the pedestrians since a hole breaks the low rank constraint.&lt;/p&gt;&#xA;&lt;p&gt;For more insight about this approach, see &lt;a href=&quot;http://perception.csl.illinois.edu/matrix-rank/home.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yi Ma's low rank page&lt;/a&gt; (&lt;a href=&quot;https://web.archive.org/web/20180416094956/http://perception.csl.illinois.edu/matrix-rank/home.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;WayBack Machine Link&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="128" LastEditDate="2023-06-22T08:07:11.787" LastActivityDate="2023-06-22T08:07:11.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16278" PostTypeId="2" ParentId="16193" CreationDate="2014-05-15T14:03:06.190" Score="6" Body="&lt;p&gt;This type of problem is called &lt;em&gt;deconvolution&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There are several approaches to tackle it, including Wiener filtering (another name for Wiener deconvolution), but there are many of them.&#xA;Wiener filtering is not reserved to deblurring: it is to cancel linear degradation operators.&lt;/p&gt;&#xA;&lt;p&gt;As remarked by &lt;a href=&quot;https://dsp.stackexchange.com/users/5662/aaron&quot;&gt;Aaron&lt;/a&gt;, it is very often an ill-posed problem and additional knowledge is required to find a &lt;em&gt;good&lt;/em&gt; solution.&#xA;A classical approach very popular today is to use a &lt;em&gt;regularized inverse problem&lt;/em&gt; approach.&lt;/p&gt;&#xA;&lt;p&gt;The problem is stated as the sum of two terms &lt;span class=&quot;math-container&quot;&gt;$E(x) = d(Ax, y) + \lambda r(x)$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the variable;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the degradation operator (the forward convolution);&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$d(Ax,y)$&lt;/span&gt; is a distance (for example, Euclidean distance) between the degradation of the current solution with respect to the observation &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. It is called a &lt;em&gt;data term&lt;/em&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$r(x)$&lt;/span&gt; is a &lt;em&gt;prior&lt;/em&gt; or &lt;em&gt;regularization&lt;/em&gt; term that penalizes solutions &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that have a bad shape (usually, solutions &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that are not regular enough);&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is some weight that balances the effect of the two constraints.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Then, a good solution &lt;span class=&quot;math-container&quot;&gt;$x^\star$&lt;/span&gt; is found by minimizing the functional &lt;span class=&quot;math-container&quot;&gt;$E(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;See for example, have a look at &lt;a href=&quot;http://users.cms.caltech.edu/%7Ejtropp/conf/HGT06-Sparse-Approximation-ICASSP.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sparse Approximation via Iterative Thresholding&lt;/a&gt; for an application of this approach to sparse approximations.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="7092" LastEditDate="2021-02-19T06:48:22.943" LastActivityDate="2021-02-19T06:48:22.943" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16280" PostTypeId="2" ParentId="16271" CreationDate="2014-05-15T15:37:05.870" Score="7" Body="&lt;p&gt;The Total Variation of an image $I$ can be computed using two formulas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$TV(I) = \sum_{x} \| \nabla I (x) \|_1 $ (anisotropic TV);&lt;/li&gt;&#xA;&lt;li&gt;$TV(I) = \sum_{x} \sqrt{ \| \nabla I (x) \|_2^2 }$ (isotropic TV).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In practice, both formulas yield almost the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using matlab, what you propose implements the first formula, while the second one can be obtained by &lt;code&gt;sqrt(gradI_x.^2 + gradI_y.^2)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-05-15T15:37:05.870" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16281" PostTypeId="2" ParentId="16274" CreationDate="2014-05-15T15:59:15.083" Score="2" Body="&lt;p&gt;There are some mistakes in the question and your description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we sample a signal of frequency $f_m$ with a sampling rate $f_s$, the sampled signal contains the frequencies $f=f_m \pm nf_s$, where $n \in \mathbb{Z} $.&#xA;Here the frequencies available in the sampled signal are calculated as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_m=14100 Hz$&#xA; and $f_s=400 Hz$.&#xA;we know that, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ f=f_m \pm nf_s $, where $n = 0, \pm 1, \pm 2, \pm 3, ... $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie., $ f= ..., -1500, -1100, -700, -300, 100, 500, 900, 1300, 1700, ... $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we up sample the signal by 3, the frequencies will become $f/3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here the new frequencies are, $ f_u = ..., -633.33, -500, -366.67, -233.33, -100, 33.33, 166.67, 300, 433.33, 566.67, ... $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After upsampling the signal is reconstructed by using an LPF of cutoff frequency 500.&#xA;When we apply LPF to the above signal only the frequencies whose absolute value is below 500 remains and other frequencies will loss.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there for after applying LPF the frequency components available in the signal are,  $ -500, -366.67, -233.33, -100, 33.33, 166.67, 300, 433.33 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this solves your problem.&lt;/p&gt;&#xA;" OwnerUserId="8917" LastEditorUserId="8871" LastEditDate="2014-05-15T16:36:57.573" LastActivityDate="2014-05-15T16:36:57.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16283" PostTypeId="1" AcceptedAnswerId="16284" CreationDate="2014-05-15T18:33:33.883" Score="0" ViewCount="1176" Body="&lt;p&gt;I have 2 sounds that I created and trying to make them beeps. Maybe 4 or 5 repeated beeps but have a pause in between each beep but make it still part of the signal. I think I have it so that the sound is a single frequency but just need make it a repeated with pauses and still part of the same signal. Any help would be appreciated I have the code listed below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 44100;&#xA;N = 400;&#xA;t = (1:N)*(1/Fs);&#xA;freq = 600;&#xA;&#xA;sound_array = zeros(N, 2);&#xA;%starts N x 2 matrix&#xA;sound_array(:,1) = sin(2*pi*freq*t);&#xA;sound_array(:,2) = sin(2*pi*freq*t);&#xA;&#xA;%Left and Right channels&#xA;&#xA;sound_L = sound_array;&#xA;sound_L(:,2) = 0;&#xA;sound_R = sound_array;&#xA;sound_R(:,1) = 0;&#xA;plot(sound_array);&#xA;&#xA;%Sound 1&#xA;sound(sound_L, Fs);&#xA;%Sound 2&#xA;sound(sound_R, Fs);&#xA;%Play consecutive&#xA;sound(sound_array, Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8901" LastEditorUserId="8202" LastEditDate="2014-05-15T19:01:29.653" LastActivityDate="2014-05-15T19:12:30.837" Title="How to add repeated beeps to sound created with a pause in between each beep in MATLAB" Tags="|matlab|signal-analysis|sound|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16284" PostTypeId="2" ParentId="16283" CreationDate="2014-05-15T18:48:12.837" Score="1" Body="&lt;p&gt;Any pause can be done by using vector/matrix concatenation. Let's say you want to make a signal with pause of length &lt;code&gt;P&lt;/code&gt; after it, then do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;P = 400;&#xA;beep = [sound_array; zeros(P, 2)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now if you want to make arbitrary number &lt;code&gt;K&lt;/code&gt; of your beeps then use the &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/repmat.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;repmat&lt;/strong&gt;&lt;/a&gt; function as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;K = 5;&#xA;beeps = repmat(beep, K, 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please read more about matrix concatenation &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/math/creating-and-concatenating-matrices.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt; if you wish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that with your current code, because you use &lt;code&gt;sound&lt;/code&gt; function, signals will be played at the same time. I suggest you to use the &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/pause.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;pause&lt;/strong&gt;&lt;/a&gt; function to separate playbacks, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sound(...)&#xA;pause(1)&#xA;sound(...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To create a 1 second pause between playback starts.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-15T19:12:30.837" LastActivityDate="2014-05-15T19:12:30.837" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16285" PostTypeId="1" CreationDate="2014-05-15T21:08:28.300" Score="5" ViewCount="1327" Body="&lt;p&gt;Could some one tell reasons to use the MATLAB &lt;a href=&quot;http://www.mathworks.com/help/images/ref/imreconstruct.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;imreconstruct&lt;/code&gt;&lt;/a&gt; function when processing images? I already have studied the topic and what the function actually does to the image. However, I cannot figure what we would use it for. What output should we expect from calling doing this function?&lt;/p&gt;&#xA;" OwnerUserId="8699" LastEditorUserId="128" LastEditDate="2018-09-09T10:39:01.803" LastActivityDate="2020-10-05T16:21:20.593" Title="What Is the MATLAB `imreconstruct()` Useful For?" Tags="|image-processing|matlab|reconstruction|" AnswerCount="2" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16287" PostTypeId="2" ParentId="16231" CreationDate="2014-05-16T01:21:33.740" Score="1" Body="&lt;p&gt;Fear of noises... Shelving filters are named to remind audio technologists that most people fear the ocean, i.e., the following picture. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/IrHsi.png&quot; alt=&quot;Diagram of Continental Shelf&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The little it is worth; but note that a summer day spent on the continental shelf is scarier than just about every sound producible by humans. I myself would not have guessed this to be the reason - fear and prayers against devils and demons make up a great deal of the superfluity that is coined into terminology.&lt;/p&gt;&#xA;" OwnerUserId="8777" LastActivityDate="2014-05-16T01:21:33.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16288" PostTypeId="1" CreationDate="2014-05-16T03:45:27.367" Score="1" ViewCount="884" Body="&lt;p&gt;I have a .pgm format 480 * 640 gray scale image named 'columns.pgm'. Using PCA (principal component analysis), by preserving 40 principal components I compressed original image with 1218 KB to 301 KB using a Matlab function which I wrote. Now about the entropy. The entropy of the original file was 6.93 and of the compressed file was 7.17. Actually the entropy of the compressed version must be lesser, right? I am confused. Can someone give me a intuition based explanation. And are the cases similar for lossy and lossless compression?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2016-12-08T02:57:29.323" Title="Confusion about shannon's entropy of the grayscale image after lossy compression" Tags="|image-processing|information-theory|image-compression|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16289" PostTypeId="2" ParentId="16288" CreationDate="2014-05-16T05:30:05.220" Score="2" Body="&lt;p&gt;Shannon's entropy only makes sense when you define it over a probability distribution. You're using a probability distribution where each pixel is sampled independently from the histogram of pixel intensities. Clearly, real pictures don't come from such a distribution. If they did, they would all look like white noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that individual elements don't have entropy. Only distributions have entropy. So if you have two images it doesn't make sense to compare their entropy. It only makes sense to compare the entropy of the random distributions that you sampled the images from.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastEditorUserId="5662" LastEditDate="2014-05-16T14:59:12.610" LastActivityDate="2014-05-16T14:59:12.610" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16290" PostTypeId="1" CreationDate="2014-05-16T06:17:37.727" Score="1" ViewCount="206" Body="&lt;p&gt;I was going through some of the basics of fourier series and fourier transform. And I came across  one topic &quot;Fourier transform of periodic signal&quot;. But I am not able to understnad why we need to go for fourier transform because we already have fourier series to take care of periodic signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8922" LastActivityDate="2014-06-15T14:10:36.707" Title="Why we need fourier transform of periodic signal although we have fourier series for periodic signal?" Tags="|fourier-transform|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16291" PostTypeId="2" ParentId="16290" CreationDate="2014-05-16T14:01:18.403" Score="2" Body="&lt;p&gt;If you take the Fourier transform of a periodic signal, you'll arrive at the same result that you would if you had computed the signal's Fourier series. Its spectrum will consist of discrete lines that correspond directly with the terms in the Fourier series. As an example, note the following Fourier transform pair:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\cos(\omega_0 t) \Leftrightarrow \pi \left(\delta(\omega - \omega_0) + \delta(\omega+\omega_0)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you computed the complex Fourier series of $\cos(\omega_0 t)$, you would find exactly two nonzero coefficients: those that correspond to frequencies $\omega_0$ and $-\omega_0$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-05-16T14:01:18.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16292" PostTypeId="1" AcceptedAnswerId="16314" CreationDate="2014-05-16T14:57:34.123" Score="1" ViewCount="841" Body="&lt;p&gt;I normalized the spectrum of a time series and windowed the spectrum, then something strange happened. The code below can run in MATLAB or Octave.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure;&#xA;n = 2e3;&#xA;t = 1:n;&#xA;m = n/2+1;&#xA;f = linspace(0,1,m);&#xA;x = rand(1,n) - 0.5;&#xA;y = fft(x);&#xA;subplot(2,2,1); plot(t,x,'k'); &#xA;axis tight; xlabel('t/s'); title('original signal x');&#xA;subplot(2,2,2); plot(f,abs(y(1:m)),'k'); &#xA;axis tight; xlabel('f/hz'); title('original spectrum');&#xA;y1 = y ./ abs(y);  &#xA;k = n/10;&#xA;w = sin(linspace(0,pi/2,k));&#xA;y1(1:k) = y1(1:k) .* w;&#xA;y1(m:-1:m-k+1) = y1(m:-1:m-k+1) .* w;&#xA;y1(n-m+3:n) = y1(m-1:-1:2);  &#xA;x1 = real(ifft(y1));&#xA;y2 = fft(x1);&#xA;x2 = real(ifft(y2));&#xA;subplot(2,2,3); plot(t,x1,'k',t,x2-x1,'r'); &#xA;axis tight; xlabel('t/s'); title('whitened signal x1(black) and x2-x1(red)');&#xA;subplot(2,2,4); plot(f,abs(y1(1:m)),'k',f,abs(y2(1:m)),'r');&#xA;axis tight; xlabel('f/hz'); title('whitened spectrum y1(black) and y2(red)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As shown in subplot 3, the red line is the difference between &lt;code&gt;x1&lt;/code&gt; and &lt;code&gt;x2&lt;/code&gt;, meaning that they are exactly the same, but as shown in subplot 4, their spectrum (black and red, respectively) is different. &#xA;So, It's weird FFT of IFFT of a spectrum is different from the spectrum itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5kYVf.jpg&quot; alt=&quot;figure1&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8863" LastEditorUserId="8202" LastEditDate="2014-05-16T22:27:36.593" LastActivityDate="2014-05-18T07:52:47.123" Title="fft(x) different from fft(ifft(fft(x))?" Tags="|fft|frequency-spectrum|ifft|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="16294" PostTypeId="1" CreationDate="2014-05-16T15:51:49.620" Score="0" ViewCount="58" Body="&lt;p&gt;assume that I have a set of image and segmented image of a object in image (training set). Now, I want to measure features of object in image based on the training data. But I don't know how many features in image. And which is best feature for image segmentation? Gradient feature or entropy feature or ....Could you explain help me ?&lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2014-05-16T15:51:49.620" Title="How many features of given image" Tags="|image-processing|image-segmentation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16296" PostTypeId="2" ParentId="16292" CreationDate="2014-05-16T18:15:09.047" Score="3" Body="&lt;p&gt;The problem appears to be that your windowing function doesn't preserve complex conjugate symmetry. So ifft(y1) has a significant imaginary part. By discarding this through the real() operation you induce a significant error which results in the discrepancy. To verify try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z = ifft(y1); plot(imag(z));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-05-16T18:15:09.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16297" PostTypeId="1" AcceptedAnswerId="16298" CreationDate="2014-05-16T18:23:58.653" Score="0" ViewCount="118" Body="&lt;p&gt;I am trying to store the signal I have created in a single variable and graph the signal in two subplots in one single graph, one for left channel, one for right channel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 44100;&#xA;N = 400&#xA;t = (1:N)*(1/Fs);&#xA;freq = 500;&#xA;&#xA;sound_array = zeros(N,2);&#xA;%starts N x 2 matrix&#xA;sound_array(:,1) = sin(2*pi*freq*t);&#xA;sound_array(:,2) = sin(2*pi*freq*t);&#xA;&#xA;%Left and Right channels&#xA;sound_L = sound_array;&#xA;sound_L(:,2) = 0;&#xA;sound_R = sound_array;&#xA;sound_R(:,1) = 0;  &#xA;plot(sound_array);&#xA;&#xA;R = 400;&#xA;beep = [sound_array; zeros(R, 2)];&#xA;&#xA;%Sound 1 &#xA;sound(sound_L, Fs);&#xA;pause(1);&#xA;%Sound 2&#xA;sound(sound_R, Fs);&#xA;%Play Consecutive&#xA;sound(sound_array, Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8901" LastEditorUserId="8202" LastEditDate="2014-05-16T19:47:58.573" LastActivityDate="2014-05-16T19:52:02.780" Title="How to store the signal in a variable and plot the signal in MATLAB" Tags="|matlab|signal-analysis|sound|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16298" PostTypeId="2" ParentId="16297" CreationDate="2014-05-16T19:46:24.810" Score="1" Body="&lt;p&gt;I suggest you to do something like (one plot with two curves):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure&#xA;plot(sound_L(:,1), 'b'); % blue&#xA;hold on; grid on; % prevent from redrawing and add grid\&#xA;plot(sound_R(:,2), 'r'); % red&#xA;legend({'left', 'right'});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if you want two subplots:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure&#xA;subplot(211);&#xA;plot(sound_L(:,1), 'b'); grid on;&#xA;subplot(212);&#xA;plot(sound_R(:,2), 'r'); grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please mind that in your case &lt;code&gt;sound_L&lt;/code&gt; and &lt;code&gt;sound_R&lt;/code&gt; are the same. You are not making any use of &lt;code&gt;beep&lt;/code&gt; variable.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-16T19:52:02.780" LastActivityDate="2014-05-16T19:52:02.780" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16300" PostTypeId="2" ParentId="15967" CreationDate="2014-05-16T22:14:52.717" Score="5" Body="&lt;p&gt;If the example images you've given are at all representative of your application, you may want to consider thinking about the problem a little differently. Instead of thinking of the image as &quot;corrupted by Poisson noise&quot;, think of the observed data as a limited number of photons sampled at random from the latent image intensity map. The photon counts you get are providing &lt;em&gt;incomplete&lt;/em&gt; information about the latent image, not &lt;em&gt;corrupt&lt;/em&gt; or &lt;em&gt;noisy&lt;/em&gt; information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this perspective, if you are truly fitting a curve or formula of few parameters to your data, this is a classical parametric statistical estimation problem (lots of samples, few parameters). Such problems have a good estimation theory which guarantees you will accurately learn the fit parameters without needing too many sample points. If you apply a denoising step before parametric fitting, the theoretical guarantees will no longer apply because the error in the denoised image is some complicated composite of residual fit variance and bias from the denoiser's implicit signal model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there's a theoretical justification for fitting the function straight to the data. Just make sure that you use the correct Poissonian likelihood function when you do so, or use the EM algorithm if you don't want to worry about such things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: actually you don't even need Poissonian likelihood here (unless your data is quantized/binned). Just take the approach described in &lt;a href=&quot;http://en.wikipedia.org/wiki/Maximum_likelihood&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Maximum_likelihood&lt;/a&gt;. Here the $x_1, x_2, ... x_n$ are a collection of $n$ vectors giving the 2-D coordinates of your photon observations, and $\theta$ is the parameter vector for the function you want to fit. In the case of a Gaussian you have $\theta = (\mu,\Sigma)$ where $\mu$ is the mean (centroid in 2D) and $\Sigma$ is the covariance matrix. Then in the notation of the wiki article, your likelihood is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \prod_{i=1}^n f(x_i | \theta) = C \prod_{i=1}^n \exp( -\tfrac{1}{2} (x_i - \mu)^T \Sigma^{-1} (x_i - \mu)) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $C$ is some constant with square roots of pi in it and such :) If your data is quantized/binned then you consider the count value in each bin as a Poisson random variable and go from there. Weirdly, the Poisson and the $n$ observation approaches are nearly equivalent from an optimization standpoint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have a great reference for you offhand because I learned this stuff in lab classes or wherever years ago. But the wiki article and refs therein seem good. This paper seems ok too: &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.74.671&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.74.671&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8924" LastEditorUserId="8924" LastEditDate="2014-05-16T22:56:04.893" LastActivityDate="2014-05-16T22:56:04.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16303" PostTypeId="2" ParentId="16285" CreationDate="2014-05-17T09:40:37.360" Score="2" Body="&lt;p&gt;It could be useful in the field of OCR as a pre processing step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about badly scanned data.&lt;br&gt;&#xA;You'd like to convert it into binary image.&lt;br&gt;&#xA;So the first step would be applying some kind of thresholding.&lt;br&gt;&#xA;Since no thresholding is perfect, There will be some &quot;Holes&quot; / &quot;Gaps&quot; within the text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Closing those &quot;Holes&quot; / &quot;Gaps&quot; can be done using morphological operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See example here: &lt;a href=&quot;https://stackoverflow.com/questions/2055774&quot;&gt;StackOverlfow - Adaptive Thresholding - Implementation of the Minimum Error Thresholding Method&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-10-27T14:11:15.923" LastActivityDate="2019-10-27T14:11:15.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16304" PostTypeId="1" CreationDate="2014-05-17T11:56:00.170" Score="0" ViewCount="113" Body="&lt;p&gt;I'm trying to write a tempo detection algorithm for analysis of audio samples. I'm roughly following the approach described in &lt;a href=&quot;http://mykal.free.fr/synthesis/detectrythm.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scheirer&lt;/a&gt;, the first stages of which give me some very nice beat onset plots, which I'm happy are correct. The next stages involve the actual tempo detection process, which go something like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a comb filter with intervals corresponding to a particular BPM, e.g. for 120BPM the interval between impulses would be 0.5 seconds&lt;/li&gt;&#xA;&lt;li&gt;Convolve the onset signal with the comb filter&lt;/li&gt;&#xA;&lt;li&gt;Calculate the energy of the resulting signal (this will be the amount of energy the sample contains at the BPM in question)&lt;/li&gt;&#xA;&lt;li&gt;Repeat for all BPMs of interest&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Quite a neat process (I thought so, at least) and I've used it successfully. My problem stems from the fact that the comb filter convolution step is quite slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand it, generally the fastest way to convolve two signals is to transform them into the frequency domain and then multiply, and that's what I was originally doing. While this might be much faster for complicated signals, the comb filter is not itself particularly complicated. I could achieve the same result by adding together delayed signals, where the delay is set by the BPM interval (the pulses in my comb filter are 1 sample wide and have a magnitude of 1). And this is what I've been trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll simplify the problem by saying that my comb filter consists of just 2 pulses, so to convolve I need to add together the original signal with a single delayed signal. For the higher BPMs the pulse interval (delay) will be less, so there will be more overlap between these two signals. This would be fine if addition was the only thing I was doing, but when I square the sum of the signals this leads to a greater total energy in the cases with more overlap. In other words the total energy increases with BPM. The plot below illustrates this effect. It uses the process I described with randomised input signal, i.e. noise. In theory it should give a (roughly) constant energy over all BPMs, but instead I get a distribution that increases with BPM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ahxb6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to calculate a normalisation factor by assuming a signal of constant magnitude and calculating the energy of that for different overlaps, but that seems to skew the results the other way. So my question is essentially this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to normalise the total energy of a comb filter convolution, where the signals are convolved using a delay-addition approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully I've explained that well enough (sorry if some of the terminology isn't quite correct) and thanks in advance!&lt;/p&gt;&#xA;" OwnerDisplayName="user8798" LastActivityDate="2014-05-17T11:56:00.170" Title="Normalisation of delay-addition comb filter implementation" Tags="|filters|audio|convolution|normalization|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16305" PostTypeId="1" CreationDate="2014-05-17T12:19:46.210" Score="0" ViewCount="24" Body="&lt;p&gt;What fading model should I use for simulating rain loss in my network simulations? I am using NS-3 for this and I'm quite lost on how to go about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My simulation is just simple packet streaming and I want to test the effects of various interference on throughput.&lt;/p&gt;&#xA;" OwnerUserId="8763" LastActivityDate="2014-05-17T12:19:46.210" Title="Simulating rain interference" Tags="|homework|fading-channel|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16306" PostTypeId="1" CreationDate="2014-05-17T16:38:05.687" Score="0" ViewCount="130" Body="&lt;p&gt;I've been looking at 2 different methods to acquire a known prn code in a CDMA signal. The first trys Xor prn code chip to I sign data. Then average the result over a time period to determine the data bit. I have not had reliable success with this method. The second which I am going to try performs a real multiply of a the code chip and the sign then adds or subtracts the I data magnitude value over a time span. &#xA;Is one method known to be more reliable than the other? I'm typing on phone so I can't post any coding right now. If it would help I can update this question later.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7480" LastActivityDate="2014-07-17T02:54:00.557" Title="best meathod to lock onto a cdma signal?" Tags="|signal-detection|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16307" PostTypeId="1" CreationDate="2014-05-17T17:47:41.267" Score="1" ViewCount="36" Body="&lt;p&gt;I was wondering what would be the statistics of the output of the filtering of an extremely wideband signal (e.g. 10 Gbps random data stream) through a narrowband low-pass filter (e.g. 10 MHz LP). I have the feeling that the statistics of the output would be somehow Gaussian due to the central limit theorem, but I cannot give a clear explanation to this. &lt;/p&gt;&#xA;" OwnerUserId="8930" LastActivityDate="2014-05-17T17:47:41.267" Title="Statistics of the output of a high bitrate signal filtered through a narrow band low pass filter" Tags="|filters|lowpass-filter|continuous-signals|statistics|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16308" PostTypeId="1" AcceptedAnswerId="16347" CreationDate="2014-05-17T18:38:45.077" Score="0" ViewCount="1045" Body="&lt;p&gt;I am using FFTW3 to transform the autocorrelation function of a particular function. I expect the transform to be real since the autocorrelation function is symmetric with respect to negative and positive lags and its Fourier transform give the power spectrum. However, I get nonzero complex part and negative real parts after the transformation. What I may be doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am providing the code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* Compilation and execution command:&#xA; * gcc q1part2.c nrutil.c qtrap.c trapzd.c -lfftw3 -lm -o q1part2 &amp;amp;&amp;amp; ./q1part2 &#xA; */&#xA;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;#include &amp;lt;complex.h&amp;gt;&#xA;#include &amp;lt;fftw3.h&amp;gt;&#xA;#include &quot;nr.h&quot;&#xA;#include &quot;nrutil.h&quot;&#xA;double h = 0.01;&#xA;double a = 0.0, b = 10.0, p;&#xA;&#xA;double func(double t)&#xA;{&#xA;    return  cos(10 * t) + sin( 20 * t);&#xA;}&#xA;double intgrd(double t)&#xA;{&#xA;    return func(t) * func(t + p);&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    int  N = round(((b - a) / h) + 1);&#xA;    double y[2*N - 1], t[2*N - 1]; /* t array hold time delays */&#xA;    int i;&#xA;    fftw_complex *in, *out;&#xA;    fftw_plan MYPLAN;&#xA;    in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * (2 * N - 1));&#xA;    out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * (2 * N - 1));&#xA;    MYPLAN = fftw_plan_dft_1d(2*N - 1, in, out, FFTW_FORWARD, FFTW_ESTIMATE);&#xA;    for(i = 0; i &amp;lt; 2*N - 1; i++)&#xA;    {&#xA;        /* The definition of autocorrelation from the book &quot;A First Course on&#xA;        * Computational Physics&quot; by Paul DeVries was used.&#xA;        */&#xA;        p = i * h - 10.0;&#xA;        t[i] = p;&#xA;        if(p &amp;gt;= 0)&#xA;        {&#xA;            y[i] = sqrt(1 / (2 * M_PI)) * qtrap(intgrd, a, b - p);&#xA;            in[i] = y[i];&#xA;        }&#xA;        else&#xA;        {&#xA;            y[i] = sqrt(1 / (2 * M_PI)) * qtrap(intgrd, -p, b);&#xA;            in[i] = y[i];&#xA;        }&#xA;        //printf(&quot;%f \t %f \n&quot;, t[i], y[i]);&#xA;    }&#xA;    fftw_execute(MYPLAN);&#xA;    for(i = 0; i &amp;lt; N; i++)&#xA;    {&#xA;        printf(&quot;%f \t %f  %f \n&quot;, i * 2*  M_PI / (2 * (b - a)), creal(out[i]),cimag(out[i])); &#xA;    }&#xA;    fftw_destroy_plan(MYPLAN);&#xA;    fftw_free(in);&#xA;    fftw_free(out);&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The function &lt;strong&gt;qtrap&lt;/strong&gt; is a numerical integration algorithm provided in the code from the second edition (plain C) of the book &lt;strong&gt;Numerical Recipes&lt;/strong&gt;. I am really confused about the usage of the library and would like to get pointed in the right direction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8932" LastActivityDate="2014-05-19T22:09:30.620" Title="Confusion on using FFTW 3.3.4 (C version) for real and even data sets" Tags="|fft|c|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16309" PostTypeId="1" CreationDate="2014-05-17T21:23:48.657" Score="2" ViewCount="609" Body="&lt;p&gt;I'm applying at each 2048 samples the pitch synchronous algorithm to pitch scale some audio files, everything seems to occur well, but I've noticed some glitches, artifacts, clicks between every boundary frame!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm testing off-line in large áudio files(I'm processing frame-by-frame), what I tried to do was keep the old, current and the next frame to pitch synchronous computation (then I pitch scale 2048*3 samples), but does not seem to be working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the known ways to eliminate frame boundary discontinuity?&lt;/p&gt;&#xA;" OwnerUserId="5325" LastActivityDate="2014-05-17T22:29:44.143" Title="how to eliminate frame boundary discontinuity?" Tags="|audio|pitch|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16310" PostTypeId="2" ParentId="16309" CreationDate="2014-05-17T22:29:44.143" Score="1" Body="&lt;p&gt;Windowing is the first line of defense.  you may need the windowing to be complementary, which is that all window functions (at their various frame delays) add to 1.  the Hann window is an example.  the Hamming window (which might have better sidelobe behavior than the Hann) is sorta complementary, but it adds to 1.08 (just a simple scaling issue).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if your window use is only for analysis (and not for synthesis) you might not need it to be complementary, so you could use a Kaiser window or a Gaussian window, both which have some useful mathematical properties in analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the second line of defense is to use your 2048-sample as just buffers and space your frames (and the analysis windows that come with), by the detected period and adaptively advance the frame locations by a period each frame process.  that's a little weirder because you need to have, a priori, some knowledge of the period which what your pitch synchronicity is all about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the most weirdest line of defense, is to advance each frame by a well-chosen &quot;random&quot; value between $L$ and $2L$ (where $2L$ is longer than the longest anticipated period) to scramble up whatever effect of the boundary discontinuity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as we might say on &lt;em&gt;comp.dsp&lt;/em&gt;, &quot;you'll have to pay for more information&quot;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-05-17T22:29:44.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16311" PostTypeId="2" ParentId="16308" CreationDate="2014-05-18T01:26:45.500" Score="2" Body="&lt;p&gt;If the imaginary part is very small you are probably not doing anything wrong.  This is a common occurrence due to floating point quantization noise.  As long as you know the result should be real and the imaginary part is small, just drop the imaginary part.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-05-18T01:26:45.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16312" PostTypeId="2" ParentId="16306" CreationDate="2014-05-18T01:33:17.350" Score="1" Body="&lt;p&gt;CDMA signals typically have a pilot that is sent along with the data.  This pilot is a known chip sequence that is transmitter over and over again.  Receivers can use the pilot to lock onto the signal by correlating the received signal with the expected pilot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The autocorrelation is typically done by FFT'ing the received signal, multiplying it by the FFT'ed expected pilot, and IFFT'ing the result.  This is done both for computational efficiency and because the circular correlation that you get with FFT's is actually helpful in this case because the pilot is repeated.  Thus you should be able to &quot;catch&quot; the pilot no matter which phase it starts at in your captured signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have locked onto the pilot you know the signal's phase and it should be pretty straightforward at that point to despread the signal and recover the data, providing you know the data's spreading sequence.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-05-18T01:33:17.350" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16313" PostTypeId="1" CreationDate="2014-05-18T02:42:33.970" Score="2" ViewCount="2891" Body="&lt;p&gt;When computing wavelet transforms with &lt;a href=&quot;http://www.pybytes.com/pywavelets/&quot; rel=&quot;nofollow&quot;&gt;PyWavelets&lt;/a&gt; (Discrete Wavelet Transform in Python), e.g. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pywt&#xA;cA, cD = pywt.dwt([1, 2, 3, 4], 'db1')&#xA;&#xA;&amp;gt;&amp;gt; print 'cA', cA&#xA;cA [ 2.12132034  4.94974747]&#xA;&#xA;&amp;gt;&amp;gt; print 'cD', cD&#xA;cD [-0.70710678 -0.70710678]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;how can I specify the scale parameter of the wavelet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab for example using &lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/cwt.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;cwt()&lt;/code&gt;&lt;/a&gt; I can specify the scale(s) I want in the parameters, and it will return all possible shifts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = [1, 2, 3, 4];&#xA;scales = [1, 2, 3];&#xA;wavelet_name = 'db1';&#xA;coefs = cwt(x,scales, wavelet_name);&#xA;&#xA;&amp;gt;&amp;gt; coefs =   &#xA;&#xA;   -0.0000   -0.0000   -0.0000    0.0000&#xA;   -0.7071   -0.7071   -0.7071   -0.7071&#xA;   -1.1553   -1.1553   -1.1553    1.7371&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I'm basically trying to find an equivalent of Matlab's &lt;code&gt;cwt()&lt;/code&gt; in Python with a decent amount of wavelet functions available unlike &lt;code&gt;scipy.signal.cwt&lt;/code&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="1632" LastEditorUserId="1632" LastEditDate="2014-05-18T02:49:36.493" LastActivityDate="2014-05-18T02:49:36.493" Title="How can I specify the scale parameter of the wavelet in PyWavelets (pywt)?" Tags="|wavelet|python|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16314" PostTypeId="2" ParentId="16292" CreationDate="2014-05-18T07:52:47.123" Score="1" Body="&lt;p&gt;Hilmar was right, its a problem with the FFT indexing. Actually, you took care of the DC which does not appear in the right-side copy of FFT. Like-wise you've to take care of Fs/2 component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the modified working code. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure;&#xA;n = 2e3;&#xA;t = 1:n;&#xA;m = n/2+1;&#xA;f = linspace(0,1,m);&#xA;x = rand(1,n) - 0.5;&#xA;y = fft(x);&#xA;subplot(2,2,1); plot(t,x,'k'); &#xA;axis tight; xlabel('t/s'); title('original signal x');&#xA;subplot(2,2,2); plot(f,abs(y(1:m)),'k'); &#xA;axis tight; xlabel('f/hz'); title('original spectrum');&#xA;y1 = y ./ abs(y);  &#xA;k = n/10;&#xA;w = sin(linspace(0,pi/2,k));&#xA;y1(1:k) = y1(1:k) .* w;&#xA;y1(m-k:m-2) = y1(m-k:m-2).*fliplr(w(2:end));&#xA;y1(m-1:m+k-2) = y1(m-1:m+k-2).*w;&#xA;y1(n-k+2:n) = y1(n-k+2:n).*fliplr(w(2:end));&#xA;&#xA;x1 = real(ifft(y1));&#xA;y2 = fft(x1);&#xA;x2 = real(ifft(y2));&#xA;subplot(2,2,3); plot(t,x1,'k',t,x2-x1,'r'); &#xA;axis tight; xlabel('t/s'); title('whitened signal x1(black) and x2-x1(red)');&#xA;subplot(2,2,4); plot(f,abs(y1(1:m)),'k',f,abs(y2(1:m)),'r');&#xA;axis tight; xlabel('f/hz'); title('whitened spectrum y1(black) and y2(red)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting figures are:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fkmyP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-05-18T07:52:47.123" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16315" PostTypeId="1" CreationDate="2014-05-18T10:45:04.780" Score="1" ViewCount="145" Body="&lt;p&gt;I want to find the SER and BER of the 4QAM,16QAM,32QAM. I know that the formulas for SER and BER are different but I cant find them in any text book. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formulas for the BER that I found:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4QAM = Q(sqrt(2 ebno))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;16QAM = 3/4 Q(sqrt(4/5 ebno))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;32QAM = (8-sqrt2)/10 Q(sqrt(15/31 ebno)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can anyone confirm and give me the formulas for the BER please? Thanks&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-05-18T10:45:04.780" Title="BER and SER of QAM" Tags="|modulation|" AnswerCount="0" CommentCount="0" ClosedDate="2014-05-19T05:35:26.893" ContentLicense="CC BY-SA 3.0" />
  <row Id="16316" PostTypeId="1" AcceptedAnswerId="16322" CreationDate="2014-05-18T12:46:45.113" Score="-2" ViewCount="1727" Body="&lt;p&gt;By which value can the constellation of a 32QAM be normalized? for example 16QAM is normalized by squareroot of 10.&lt;/p&gt;&#xA;" OwnerUserId="8392" LastEditorUserId="4298" LastEditDate="2017-12-11T09:21:42.627" LastActivityDate="2017-12-11T09:21:42.627" Title="Normalizing 32QAM constellation points" Tags="|digital-communications|modulation|" AnswerCount="1" CommentCount="5" ClosedDate="2014-05-26T15:50:15.603" ContentLicense="CC BY-SA 3.0" />
  <row Id="16317" PostTypeId="1" CreationDate="2014-05-18T15:29:30.527" Score="0" ViewCount="962" Body="&lt;p&gt;My aim is to determine the power spectrum of a signal of finite duration using &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Its autocorrelation function&lt;/li&gt;&#xA;&lt;li&gt;Performing FFT directly on the time-domain data&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The function is defined as follows in the finite time interval from 0 to 10:&#xA;$$ \cos(10t) + \sin(20t) $$ &#xA;I am using the library FFTW 3.3.4 in C source code and pretty confused about all the normalization constants involved. After some work I managed to get the purely real FFT of the real and even autocorrelation function but the FFT of the autocorrelation function has negative parts in it. My concern is that if this is the power spectrum by &lt;strong&gt;Wiener-Khinchin&lt;/strong&gt;  theorem why it has negative parts in it. Furthermore, how can I normalize the output so that the power spectrum from the direct FFT of the time-domain data and the power spectrum from the autocorrelation functions are exactly the same. I am very confused about this subject and would like to be nudged in the right direction, any help and/or comment is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8932" LastEditorUserId="8932" LastEditDate="2014-05-18T18:13:32.467" LastActivityDate="2014-05-18T18:13:32.467" Title="Autocorrelation Function and Power Spectrum" Tags="|fft|frequency-spectrum|dft|autocorrelation|power-spectral-density|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16319" PostTypeId="1" AcceptedAnswerId="16323" CreationDate="2014-05-18T16:31:23.850" Score="1" ViewCount="2625" Body="&lt;p&gt;Why do we need different modulation techniques? Is it because we need to convert from analogue to digital data sometimes? Also what are typical applications where modulation schemes are used apart from wireless scenarios?&lt;/p&gt;&#xA;" OwnerUserId="8392" LastActivityDate="2014-05-18T20:42:22.990" Title="Modulation and it's application" Tags="|modulation|" AnswerCount="1" CommentCount="1" ClosedDate="2014-05-19T05:35:46.593" ContentLicense="CC BY-SA 3.0" />
  <row Id="16320" PostTypeId="1" CreationDate="2014-05-18T18:24:16.813" Score="13" ViewCount="1154" Body="&lt;p&gt;I was wondering which is the best language for image processing? I know MATLAB has a good library and user community for it. I havent checked it out, its there for python as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the most efficient language for this?&lt;/p&gt;&#xA;" OwnerUserId="8683" LastActivityDate="2017-05-14T09:12:57.430" Title="Image processing coding" Tags="|image-processing|matlab|python|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16321" PostTypeId="2" ParentId="16320" CreationDate="2014-05-18T18:40:59.370" Score="13" Body="&lt;p&gt;It's not only about programming language but library you are using. I can think of the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.co.uk/products/image/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;MATLAB&lt;/strong&gt;&lt;/a&gt; - image processing capabilities are quite ok, but for more advanced and real time processing you would need some low-level stuff. Additionally, it does not offer very good portability. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://reference.wolfram.com/mathematica/guide/ImageProcessing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Mathematica&lt;/strong&gt;&lt;/a&gt; - good for prototyping and quick visualization, but that is all in my humble opinion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://opencv.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;OpenCV&lt;/strong&gt;&lt;/a&gt; - I think this is the most popular library in IP community. Great capabilities (&lt;em&gt;GPU computing, Machine Learning module, GUI - what else do you need?&lt;/em&gt;), fast, and still under development (so minor bugs are being removed very quickly). Regarding community - it's big! Mainly for C/C++ programming, but also Python (probably suits you).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.oracle.com/technetwork/java/javase/tech/jai-142803.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;JAI&lt;/strong&gt;&lt;/a&gt; - Java Advanced Imaging - only if you like Java. Personally, I do not like it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.imagemagick.org/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;ImageMagick&lt;/strong&gt;&lt;/a&gt; - you can use it with &lt;strong&gt;many&lt;/strong&gt; programming languages, check the &lt;a href=&quot;http://www.imagemagick.org/script/api.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;API&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.xdp.it/cximage.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;CxImage&lt;/strong&gt;&lt;/a&gt; - good if you want to create something better than MS Paint and with some functionality of the Photoshop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cimg.eu/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;CImg&lt;/strong&gt;&lt;/a&gt; - obviously to be used with C++, but OpenCV is still better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://effbot.org/zone/pil-index.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;PIL&lt;/strong&gt;&lt;/a&gt; - Python specific library with lots of functionality. If you like it then you can take a closer look.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://simplecv.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;SimpleCV&lt;/strong&gt;&lt;/a&gt; - basically it is OpenCV python binding with some tweaks. Very easy to use and quite efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://scikit-image.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;scikit-image&lt;/strong&gt;&lt;/a&gt; - also Python library, but in my opinion worse than SimpleCV (although my friend would not agree to that). One advantage is that they included DAISY features extractor - quite useful if you need dense features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.boost.org/doc/libs/1_54_0/libs/gil/doc/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;GIL&lt;/strong&gt;&lt;/a&gt; - part of &lt;a href=&quot;http://www.boost.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boost&lt;/a&gt;, but less functional that OpenCV. Although if you like and use Boost then for some basic functionality it should be ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://resil.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;ResIL&lt;/strong&gt;&lt;/a&gt; - continuation of &lt;a href=&quot;http://openil.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;DevIL&lt;/a&gt; project. A major advantage is operating on many file formats, including some game files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://perso.esiee.fr/~coupriem/Pink/doc/html/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;PINK&lt;/strong&gt;&lt;/a&gt; - originally written in C++. I recently tried it out and it was very pleasant to work with. Great integration with Python and fast in embedded C. Apart from that they do have plenty of nice algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, there is plenty more Image Processing libraries, but these are ones I had contact with. So if you want to start with something, then choose OpenCV (preferably with C++ framework) - you will not regret! On the other hand, if your programming skills are not strong, then you might want to think about using Python-based libraries - really easy to learn and set-up.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2017-05-14T09:12:57.430" LastActivityDate="2017-05-14T09:12:57.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16322" PostTypeId="2" ParentId="16316" CreationDate="2014-05-18T18:46:37.210" Score="4" Body="&lt;p&gt;If we assume that the symbols are $\{\pm a,\pm 3a, \dots\}+i\{\pm a,\pm 3a, \dots\}$ - for 16-QAM and for the 32-QAM cross-constellation, where in the latter case there are no symbols at $(\pm 5\pm i5)a$ - then the &lt;em&gt;average&lt;/em&gt; energy per symbol is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_s=10a^2\quad\textrm{(16-QAM)}\\&#xA;E_s=20a^2\quad\textrm{(32-QAM)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the last equality was shown in &lt;a href=&quot;https://dsp.stackexchange.com/questions/16240/deriving-ser-ber-for-4qam-16qam-and-32qam/16254#16254&quot;&gt;this answer&lt;/a&gt;. So if you choose $a=1/\sqrt{10}$ for 16-QAM, and $a=1/\sqrt{20}$ for 32-QAM cross-constellation, you normalize the &lt;em&gt;average&lt;/em&gt; energy per symbol to unity. Note that the maximum energy per symbol in both cases is of course larger than the average energy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_{s,max}=18a^2=1.8E_s\quad\textrm{(16-QAM)}\\&#xA;E_{s,max}=34a^2=1.7E_s\quad\textrm{(32-QAM)}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-05-19T07:30:43.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16323" PostTypeId="2" ParentId="16319" CreationDate="2014-05-18T20:42:22.990" Score="2" Body="&lt;p&gt;We live in an analog world (okay, technically physicists believe that it is digital when you get down to Planck lengths and such, but that is way beyond the scope of this answer).  Modulation is all about mapping digital data to analog mediums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have (and use) different modulation techniques because they have different benefits and weaknesses.  The &quot;ideal&quot; modulation for a given application depends on the specifics of your application.  If you wanted a simple &quot;quick and dirty&quot; modulation and didn't care much about the data rate you might use on-off keying (OOK).  If you were trying for maximum bandwidth efficiency you would probably use OFDM.  If the multipath delay was such that using OFDM isn't feasible you could use DSSS with a rake receiver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples of non-wireless modulation are: CD's, Blue-ray, computer tapes, hard drives, and modems.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-05-18T20:42:22.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16324" PostTypeId="2" ParentId="13267" CreationDate="2014-05-18T21:54:47.197" Score="5" Body="&lt;p&gt;Another thing the OP can do is use the &quot;complex&quot; chirp. What you really have to do is (at two different times and both times sweeping all frequencies from -Nyquist through DC to +Nyquist) pass the real part, &lt;span class=&quot;math-container&quot;&gt;$x_r(t)=\cos(\pi \beta t^2)$&lt;/span&gt; and then pass the imaginary part &lt;span class=&quot;math-container&quot;&gt;$x_i(t)=\sin(\pi \beta t^2)$&lt;/span&gt; of the complex chirp through the material under test and synchronously measure the two real results (&lt;span class=&quot;math-container&quot;&gt;$y_r(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_i(t)$&lt;/span&gt;), then assemble them as the real and imaginary parts of the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;x(t) &amp;amp; =  e^{j \pi \beta t^2} \\&#xA;&amp;amp; = \cos(\pi \beta t^2) + j \sin(\pi \beta t^2) \\&#xA;&amp;amp; = x_r(t) \qquad + j \ x_i(t) \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ X(f) \ \triangleq \ \mathscr{F}\left\{ x(t) \right\} \ = \ \sqrt{\frac{j}{\beta}} e^{-j\frac{\pi}{\beta} f^2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will see that &lt;span class=&quot;math-container&quot;&gt;$ |X(f)| = \sqrt{\frac{1}{\beta}} $&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The respective outputs that are synchronously measured with the two driving signals are &lt;span class=&quot;math-container&quot;&gt;$y_r(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_i(t)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;y_r(t) &amp;amp; \triangleq h(t) \circledast x_r(t) \\&#xA; &amp;amp; = h(t) \circledast \cos(\pi \beta t^2) \\&#xA;\\&#xA;y_i(t) &amp;amp; \triangleq h(t) \circledast x_i(t) \\&#xA; &amp;amp; = h(t) \circledast \sin(\pi \beta t^2) \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then this aggregate complex output, &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt;, can be assembled (in the mind of the computer) from the responses of the cosine sweep (the real part) and the sine sweep (the imaginary part):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;y(t) &amp;amp; =  y_r(t) + j \ y_i(t) \\&#xA;&amp;amp; = h(t) \circledast x_r(t) + j \ h(t) \circledast x_i(t) \\&#xA;&amp;amp; = h(t) \circledast \left(x_r(t) + j \ x_i(t)\right) \\&#xA;&amp;amp; = h(t) \circledast x(t) \\&#xA;&amp;amp; = \int_{-\infty}^{+\infty} h(u) \, x(t-u) \ du \\&#xA;&amp;amp; = \int_{-\infty}^{+\infty} h(u) \, e^{j \pi \beta (t-u)^2} \ du \\&#xA;&amp;amp; = \int_{-\infty}^{+\infty} h(u) \, e^{j \pi \beta (t^2-2tu+u^2)} \ du \\&#xA;&amp;amp; = e^{j \pi \beta t^2} \int_{-\infty}^{+\infty} \left(h(u) \, e^{j \pi \beta u^2}\right) \, e^{-j 2 \pi \beta t u} \ du \\&#xA;&amp;amp; = e^{j \pi \beta t^2} \int_{-\infty}^{+\infty} \tilde{h}(u) \, e^{-j 2 \pi (\beta t) u} \ du \\&#xA;&amp;amp; = e^{j \pi \beta t^2} \tilde{H}(\beta t) \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \tilde{H}(f) \triangleq \int_{-\infty}^{+\infty} \tilde{h}(t) e^{-j 2 \pi f t} \ dt = \mathscr{F}\left\{\tilde{h}(t) \right\} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \tilde{h}(t) \triangleq h(t) e^{j \pi \beta t^2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is what you get: first consider making this adjustment (dechirping) in the measured output:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ y(t) e^{-j \pi \beta t^2} = \tilde{H}(\beta t) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if the sweep rate &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is low enough, then &lt;span class=&quot;math-container&quot;&gt;$e^{j \pi \beta t^2} \approx 1$&lt;/span&gt; for as long as &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt; is not close to 0. Then &lt;span class=&quot;math-container&quot;&gt;$\tilde{h}(t) \approx h(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tilde{H}(f) \approx H(f)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tilde{H}(\beta t) \approx H(\beta t)$&lt;/span&gt; and what you have measured in the output is another chirp, but with relative magnitude and phase changed by &lt;span class=&quot;math-container&quot;&gt;$\tilde{H}(\beta t) \approx H(\beta t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if the sweep rate is not so low, you can compute either the true frequency response &lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt; by first computing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;\tilde{h}(t) &amp;amp; =  \mathscr{F}^{-1}\left\{ \tilde{H}(f) \right\} \\&#xA;&amp;amp; = \int_{-\infty}^{+\infty} \tilde{H}(f) e^{j 2 \pi f t} df \\&#xA;&amp;amp; = h(t) e^{j \pi \beta t^2} \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or from that result you can get the true impulse response &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt; if that's what you want. It should be the same &lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt; you would get if you divided &lt;span class=&quot;math-container&quot;&gt;$Y(f) = \mathscr{F}\left\{ y(t) \right\} $&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$X(f) = \mathscr{F}\left\{ x(t) \right\} = \sqrt{\frac{j}{\beta}} e^{-j\frac{\pi}{\beta} f^2}$&lt;/span&gt;. And there is no division by zero, because &lt;strong&gt;there are no ripples&lt;/strong&gt; in &lt;span class=&quot;math-container&quot;&gt;$X(f)$&lt;/span&gt; because the magnitude is a constant &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\frac{1}{\beta}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is how to remove ripples (and any danger of division by zero) in the spectrum of a linearly-swept chirp.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2019-04-29T18:04:19.723" LastActivityDate="2019-04-29T18:04:19.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16325" PostTypeId="2" ParentId="16320" CreationDate="2014-05-19T01:47:07.440" Score="-1" Body="&lt;p&gt;If you want to roll your own algorithms or code, then include OpenCL, as many image processing kernels are &quot;embarrassingly parallel&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, on Big Iron, Fortran still beats most other languages at numeric vector performance.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-19T01:47:07.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16326" PostTypeId="1" CreationDate="2014-05-19T02:12:40.757" Score="3" ViewCount="883" Body="&lt;p&gt;I am looking for methods to enhance noisy images, where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;some pixels in the image are very noise,&lt;/li&gt;&#xA;&lt;li&gt;some other pixels do not contain so much noise. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My first thought is to build an adaptive Gaussian filter. &#xA;This means that the Gaussian kernel will depend on the (estimated) noise status of the current pixel (large radius of the Gaussian kernel for noisy pixels and a smaller in the converse case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you help me in calculating the kernel values?&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="128" LastEditDate="2018-08-23T08:41:16.643" LastActivityDate="2022-04-11T11:47:03.763" Title="Adaptive Gaussian Filter for Image Denoising" Tags="|image-processing|filters|noise|filter-design|denoising|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16327" PostTypeId="1" CreationDate="2014-05-19T05:49:17.120" Score="1" ViewCount="131" Body="&lt;p&gt;I have been working on Digital signal processing since Feb-2013. I have good command over it. Now I want to expand work in field of IMAGE and Video processing. Please suggest me best practical guide books, blogs, online links and other supporting matters related to IMAGE and Video processing .        &lt;/p&gt;&#xA;" OwnerUserId="8463" LastActivityDate="2014-05-19T08:26:08.850" Title="Image and video processing in matlab" Tags="|matlab|image-processing|digital-communications|video-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16328" PostTypeId="2" ParentId="16327" CreationDate="2014-05-19T08:26:08.850" Score="2" Body="&lt;p&gt;The following two books by by &lt;em&gt;Gonzalez and Woods&lt;/em&gt; can help you with image processing&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0130085197&quot; rel=&quot;nofollow&quot;&gt;Digital Image Processing Using MATLAB&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/013168728X&quot; rel=&quot;nofollow&quot;&gt;Digital Image Processing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8871" LastActivityDate="2014-05-19T08:26:08.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16329" PostTypeId="1" CreationDate="2014-05-19T08:32:02.640" Score="0" ViewCount="290" Body="&lt;p&gt;I've got a FIR filter, which I developed in IC. Now, when I got my results, I ended up with two signals:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Theoretical signal calculated through MATLAB as a response to my input.&lt;/li&gt;&#xA;&lt;li&gt;Real response given by the hardware.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What is the best method of calculating the error of the real response with respect to the theroetical one? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could go &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;delta = abs(Y) - abs(Yreal);&#xA;max_err = max(delta);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I don't know what to do with the maximum error? Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="4710" LastActivityDate="2014-06-18T10:46:15.450" Title="Calculating Signal Approximation Error (Theoretical signal - Real hardware signal)?" Tags="|filters|frequency-response|finite-impulse-response|approximation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16330" PostTypeId="1" CreationDate="2014-05-19T09:14:11.783" Score="12" ViewCount="20742" Body="&lt;p&gt;When transforming a noisy signal via Fast Fourier Transform from time to frequency domain there is a &quot;Processing gain&quot; of the FFT which increases as number of bins increases. I.e. the more bins I have the more the noise floor in the freqeuency domain is reduced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.&#xA;Actually I don't understand completely, from where this gain is coming from. Does this mean that I need just sample the signal with higher sampling rate in order to have more bins, hence a higher FFT processing gain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.&#xA;What is about the inverse FFT? Do I have a &quot;Processing lost&quot;? When starting in frequency domain does this mean, the more frequency samples I have, the more noise will appear in the time domain signal? However, this would be counter-intuitive since this would also lead to big distortion of signals when applying padding (of the frequency-domain data) for time-domain interpolation purposes.&lt;/p&gt;&#xA;" OwnerUserId="8940" LastEditorUserId="13320" LastEditDate="2016-11-21T13:00:12.043" LastActivityDate="2023-10-06T23:08:41.627" Title="FFT Processing Gain" Tags="|fft|" AnswerCount="7" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16331" PostTypeId="1" AcceptedAnswerId="16332" CreationDate="2014-05-19T09:23:50.243" Score="1" ViewCount="89" Body="&lt;p&gt;If $\omega$ is the frequency of a continuous time sinusoidal signal, $-\infty &amp;lt; \omega &amp;lt; \infty $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when it comes to discrete time sinusoidal signals, the range becomes limited : $-\pi \le \omega_{discrete} \le \pi $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that mean discrete sinusoidal signals cannot represent all frequencies possible ? What is the true picture here ?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2014-05-19T09:55:54.493" Title="Can a discrete sinusoidal signal represent only limited number of frequencies?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16332" PostTypeId="2" ParentId="16331" CreationDate="2014-05-19T09:55:54.493" Score="4" Body="&lt;p&gt;It is important to realize that in the discrete-time case, $\omega$ is normalized by the sampling frequency $f_s$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega=2\pi f/f_s$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inequality in your question is basically the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;sampling theorem&lt;/a&gt;, which says that a discrete-time signal can only represent frequencies lower than half the sampling frequency. All higher frequencies will be folded back into the frequency band $[0,f_s/2]$ (this is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;aliasing&lt;/a&gt;). If you need higher frequencies then you need to increase the sampling rate. &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-19T09:55:54.493" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16333" PostTypeId="2" ParentId="16329" CreationDate="2014-05-19T10:35:05.597" Score="1" Body="&lt;p&gt;There are lots of different error statistics you depending on what you want to know. If what you care about is the maximum error then what you suggest is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably more common is to use the RMS error i.e. $ \sqrt{\frac{1}{N}\sum(Y-Y_{real})^2} $. This is related to the variance of the system. I'm not sure if this is exactly what you want for your case as I suspect there will be strong spatial correlation across the filter. This is something you should look at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another issue is that the error is dependent on the input signal. You may wish to look at the frequency response of both systems to try and remove this issue.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-19T10:35:05.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16334" PostTypeId="1" CreationDate="2014-05-19T10:47:06.670" Score="0" ViewCount="174" Body="&lt;p&gt;From this derivation to get the differential of a band pass filter: Id like to find out how we set the upper frequency cut-off and the lower frequency cut-off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kcvog.png&quot; alt=&quot;Band Pass Filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$i(t)=\frac{v_i(t)-v_o(t)}{R}=C\frac{dv_o(t)}{dt}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$v_i(t)=v_o(t)+RC\frac{dv_o(t)}{dt}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the high-pass filter we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$i(t)=\frac{v_o(t)}{R}=C\frac{d(v_i(t)-v_o(t))}{dt}$$&#xA;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$RC\frac{dv_i(t)}{dt}=v_o(t)+RC\frac{dv_o(t)}{dt}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's call the time constants of the low-pass and high-pass filters $\tau_L=R_LC_L$ and $\tau_H=R_HC_H$, respectively. For the band-pass filter we need a relation between $v_i(t)$ of the low-pass filter and $v_o(t)$ of the high-pass filter. If we use $v_{oL}(t)$ to denote the output of the low-pass filter, which equals the input of the high-pass filter, we get from (1) by taking the derivative&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{dv_i(t)}{dt}=\frac{dv_{oL}(t)}{dt}+\tau_L\frac{d^2v_{oL}(t)}{dt^2}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (2) we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_H\frac{dv_{oL}(t)}{dt}=v_o(t)+\tau_H\frac{dv_o(t)}{dt}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and (by taking the derivative)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_H\frac{d^2v_{oL}(t)}{dt^2}=\frac{dv_o(t)}{dt}+\tau_H\frac{d^2v_o(t)}{dt^2}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging (4) and (5) into (3) we finally get for the band-pass filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_H\frac{dv_i(t)}{dt}=v_o(t)+(\tau_L+\tau_H)\frac{dv_o(t)}{dt}+\tau_L\tau_H\frac{d^2v_o(t)}{dt^2}$$&lt;/p&gt;&#xA;" OwnerUserId="8942" LastEditorUserId="8942" LastEditDate="2014-05-20T09:05:49.670" LastActivityDate="2014-05-20T09:05:49.670" Title="How do i set the band filter such that it has a pass band of 100Hz to 300Mhz?" Tags="|filters|" AnswerCount="1" CommentCount="2" ClosedDate="2014-05-19T13:31:09.843" ContentLicense="CC BY-SA 3.0" />
  <row Id="16335" PostTypeId="2" ParentId="16334" CreationDate="2014-05-19T11:25:21.190" Score="1" Body="&lt;p&gt;That's much easier in the frequency domain. You simply get&#xA;$$V_o(\omega) = V_i(\omega)\cdot \frac{1}{1+j\cdot \omega\cdot R_1 \cdot C_1}\cdot \frac{j\cdot \omega\cdot R_2 \cdot C_2}{1+j\cdot \omega\cdot R_2 \cdot C_2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first term is the lowpass and the second term is the highpass. To set the frequencies you need &#xA;$$R_1 \cdot C_1 = \frac{1}{2\cdot \pi \cdot 300MHz}$$&#xA;and&#xA;$$R_2 \cdot C_2 = \frac{1}{2\cdot \pi \cdot 100MHz}$$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2014-05-19T17:36:50.967" LastActivityDate="2014-05-19T17:36:50.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16337" PostTypeId="1" CreationDate="2014-05-19T12:10:32.333" Score="0" ViewCount="589" Body="&lt;p&gt;I want to convolve two discrete functions $f$ and $g$ using convolution stride size $a$ to get the result as $s_{a, i}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_{i,a} = \sum_i g_k f_{ai-k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that simple convolution with $a=1$ can be calculated via FFT. I can do it even now, but I have to drop out all the points except $ai$. I think this way is not the best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cannot you advice me something better?&lt;/p&gt;&#xA;" OwnerUserId="5343" LastEditorUserId="4346" LastEditDate="2017-01-05T03:55:08.753" LastActivityDate="2017-01-05T03:55:08.753" Title="Fast convolution with striding step" Tags="|fft|convolution|fast-convolution|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16338" PostTypeId="1" CreationDate="2014-05-19T12:45:35.143" Score="2" ViewCount="140" Body="&lt;p&gt;I am trying to follow a paper where they say they apply the Kalman filter, but don't give the forumulation for the Kalman filter! Moreover I have looked at two references Wikipeadia and &lt;a href=&quot;http://www.amazon.co.uk/Series-Analysis-Methods-Statistical-Science/dp/0198523548/ref=sr_1_4?ie=UTF8&amp;amp;qid=1400502526&amp;amp;sr=8-4&amp;amp;keywords=durbin+koopman&quot; rel=&quot;nofollow&quot;&gt;Durbin and Koopman 2001&lt;/a&gt;, but they seem to give slightly different formulations, I would like to know which is either is correct!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system I wish to apply the Kalman filter to is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{z}_k=\textbf{H}\textbf{x}_k+\textbf{v}_k$  $\textbf{v}_k \sim N(\textbf{0},\textbf{R})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{H}$ does not change over time&lt;br&gt;&#xA;$\textbf{R}$ is a diagonal of constants&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{x}_k=\textbf{F}\textbf{x}_{k-1}+(\textbf{I}-\textbf{F}){\mu} + \textbf{w}_k $   $\textbf{w}_k \sim N(\textbf{0},\textbf{Q})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{I}$ is the identity matrix&lt;br&gt;&#xA;$\mu$ is the vector of mean values of $\textbf{x}$&lt;br&gt;&#xA;$\textbf{F}$ is diagonal with the AR(1) params which do not change over time&lt;br&gt;&#xA;$\textbf{Q}$ is diagonal with the innovation processes for $\textbf{x}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First things first is this the correct way to set up an AR(1) state space model?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first formulation of the Klaman filter is given &lt;a href=&quot;http://en.wikipedia.org/wiki/Kalman_filter&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. See the section &quot;details&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They subscript the $\textbf{H}$ and $\textbf{F}$ with k which seems to denote that there matrices are evolving over time but no updating equations are given for them so it seems in practice they are treated as constant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the details section the final variance estimate is given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{P}_{k|k}=(\textbf{I}-\textbf{K}_k\textbf{H}_k)\textbf{P}_{k|k-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{P}_{k|k-1}=\textbf{F}_{k}\textbf{P}_{k-1|k-1}\textbf{F}_{k}'+\textbf{Q}_{k}$&lt;br&gt;&#xA;$\textbf{K}_{k}=\textbf{P}_{k|k-1}\textbf{H}_{k}'\textbf{S}_{k}^{-1}$&lt;br&gt;&#xA;$\textbf{S}_{k}=\textbf{H}_{k}\textbf{P}_{k|k-1}\textbf{H}_{k}'+\textbf{R}_{k}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expanding out&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{P}_{k|k}=(\textbf{I}-\textbf{K}_k\textbf{H}_k)\textbf{P}_{k|k-1}$&lt;br&gt;&#xA;$\textbf{P}_{k|k}=(\textbf{P}_{k|k-1}-\textbf{K}_k\textbf{H}_k\textbf{P}_{k|k-1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sub in $\textbf{P}_{k|k-1}$ and $\textbf{K}_{k}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{P}_{k|k}=((\textbf{F}_{k}\textbf{P}_{k-1|k-1}\textbf{F}_{k}'+\textbf{Q}_{k})-(\textbf{P}_{k|k-1}\textbf{H}_{k}'\textbf{S}_{k}^{-1})\textbf{H}_k(\textbf{F}_{k}\textbf{P}_{k-1|k-1}\textbf{F}_{k}'+\textbf{Q}_{k}))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there is a new $\textbf{P}_{k|k-1}$ term which we substitute as well &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{P}_{k|k}=((\textbf{F}_{k}\textbf{P}_{k-1|k-1}\textbf{F}_{k}'+\textbf{Q}_{k})-((\textbf{F}_{k}\textbf{P}_{k-1|k-1}\textbf{F}_{k}'+\textbf{Q}_{k})\textbf{H}_{k}'\textbf{S}_{k}^{-1})\textbf{H}_k(\textbf{F}_{k}\textbf{P}_{k-1|k-1}\textbf{F}_{k}'+\textbf{Q}_{k}))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meanwhile Durbin &amp;amp; Koopman 2001 give $\textbf{P}_{k|k}$ as see eqn 4.10 on p67 that I have substituted back into equation 4.3 on page 66:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{P}_{k|k}=\textbf{F}_{k}\textbf{P}_{k-1|k-1}\textbf{F}_{k}'-(\textbf{F}_{k}\textbf{P}_{k-1|k-1}\textbf{H}_{k}'\textbf{S}_{k}^{-1}\textbf{H}_k\textbf{P}_{k-1|k-1}\textbf{F}_{k}')+\textbf{Q}_t$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that I have changed the nomenclature to match that given in Wikipedia to facilitate comparison&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their state space model is slightly different&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{x}_k=\textbf{F}\textbf{x}_{k-1} + \textbf{A}\textbf{w}_k $   $\textbf{w}_k \sim N(\textbf{0},\textbf{Q})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the missing $(\textbf{I}-\textbf{F}){\mu}$ term is constant so should not affect the posterior variance estimate.&#xA;Also the $\textbf{A}$ term is simply assumed to be the identity matrix to match my original model shown above&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Which is any of these formulations is correct?  &lt;/li&gt;&#xA;&lt;li&gt;If they are both correct how do i change the derivation to get them to match?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any questions just ask, even happy to write out the D&amp;amp;K2001 derivation in full if it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;One thing I have noticed is that the time scripting is also slightly different in D&amp;amp;K2001&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{z}_k=\textbf{H}\textbf{x}_k+\textbf{v}_k$  $\textbf{v}_k \sim N(\textbf{0},\textbf{R})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{x}_{k+1}=\textbf{F}\textbf{x}_{k} + \textbf{A}\textbf{w}_k $   $\textbf{w}_k \sim N(\textbf{0},\textbf{Q})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{A}$ still assumed to be the identity matrix&lt;br&gt;&#xA;So when you start the series at $\textbf{x}=\mu$ the D&amp;amp;K2001 will base this value for $\textbf{x}$ in the first measurement equation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas the Wikipedia formulation will update $\textbf{x}$ first before using it in the measurement equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe this helps to explain the difference although I'm still unclear as to how it would lead to the differences shown above? &lt;/p&gt;&#xA;" OwnerUserId="8943" LastEditorUserId="1629" LastEditDate="2016-01-23T02:37:45.790" LastActivityDate="2016-01-23T02:37:45.790" Title="Correct Kalman Filter for Gaussian State Space Model" Tags="|kalman-filters|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16339" PostTypeId="1" AcceptedAnswerId="16340" CreationDate="2014-05-19T13:15:35.367" Score="2" ViewCount="1115" Body="&lt;p&gt;From the textbook &lt;em&gt;Signals and Systems&lt;/em&gt; by Oppenheimer ...&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If we define &lt;span class=&quot;math-container&quot;&gt;$h_k[n]$&lt;/span&gt; to be the impulse response to &lt;span class=&quot;math-container&quot;&gt;$\delta[n-k]$&lt;/span&gt;, then for the system to be time-invariant, we must have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h_k[n] = h_0[n-k]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I don't understand how the last equation follows. By definition of time-invariance, if the input is shifted by &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; units, the output is shifted by &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; units. From the given definition of &lt;span class=&quot;math-container&quot;&gt;$h_k[n]$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$h_0[n]$&lt;/span&gt; is the impulse response to &lt;span class=&quot;math-container&quot;&gt;$\delta[n]$&lt;/span&gt;. Shouldn't the time-invariance property read&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h_k[n] = h_0[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;EDIT:&#xA;The text goes on to add:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\delta[n-k]$&lt;/span&gt; is the time-shifted version of &lt;span class=&quot;math-container&quot;&gt;$\delta[n]$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$h_k[n]$&lt;/span&gt; is the time-shifted version of &lt;span class=&quot;math-container&quot;&gt;$h_0[n]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;But saying it is the time-shifted version does not mean equivalance. What gives?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-05-19T13:28:12.740" Title="Property for time invariance of system in terms of its impulse response" Tags="|impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16340" PostTypeId="2" ParentId="16339" CreationDate="2014-05-19T13:28:12.740" Score="3" Body="&lt;p&gt;Time-invariance means that if $y[n]$ is the response to $x[n]$, then $y[n-k]$ is the response to $x[n-k]$. So if $h_0[n]$ is the response to the impulse $\delta[n]$, then - if the system is time-invariant - its response to $\delta[n-k]$ must be $h_0[n-k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $h_k[n]=h_0[n]$ were true, then the response to any input $\delta[n-k]$ would be $h_0[n]$, regardless of $k$, which basically means that the system output would be independent of the input signal.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-19T13:28:12.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16341" PostTypeId="1" CreationDate="2014-05-19T16:27:28.047" Score="1" ViewCount="94" Body="&lt;p&gt;I want to simulate data from the following model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{z}_k=\textbf{H}\textbf{x}_k+\textbf{v}_k$  $\textbf{v}_k \sim N(\textbf{0},\textbf{R})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{H}$ does not change over time&lt;br&gt;&#xA;$\textbf{x}$ is a vector of loadings&lt;br&gt;&#xA;$\textbf{R}$ is a diagonal of constants&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{x}_k=\textbf{F}\textbf{x}_{k-1}+(\textbf{I}-\textbf{F}){\mu} + \textbf{w}_k $   $\textbf{w}_k \sim N(\textbf{0},\textbf{Q})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\textbf{I}$ is the identity matrix&lt;br&gt;&#xA;$\mu$ is the vector of mean values of $\textbf{x}$&lt;br&gt;&#xA;$\textbf{F}$ is diagonal with the AR(1) params which do not change over time&lt;br&gt;&#xA;$\textbf{Q}$ is diagonal with the innovation processes for $\textbf{x}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following code in Matlab&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nDates=20000; %number of dates&#xA;&#xA;mats=[1 2 3 4 5 6 7 8 9 10 12 15 20 25 30]'; %maturities &#xA;nY=length(mats); %#number of yields&#xA;&#xA;z=zeros(nY,nDates);  %declare vector for yields&#xA;x=zeros(3,nDates); %declare vector for factors&#xA;&#xA;R=0.00001;   %standard deviation&#xA;I=eye(3); %3*3 identity matrix&#xA;&#xA;v=normrnd(0,R,nY,nDates); %generate residuals&#xA;F=[0.9963 0 0; 0 0.9478 0; 0 0 0.774]; %AR(1) matrix&#xA;mu=[0.0501; -0.0251;-.0116]; %mean of X&#xA;lambda=0.5536; &#xA;&#xA;q = [0.0026^0.5 0 0;0 0.0027^0.5 0; 0 0 0.0035^0.5];&#xA;Q=q*q';&#xA;rng('default');  % For reproducibility&#xA;r = randn(nDates,3);&#xA;w= (r*Q)';     &#xA;&#xA;&#xA;&#xA;B= [ones(nY,1),((1-exp(-lambda*mats))./(lambda*mats)),((1-exp(-lambda*mats))./(lambda*mats))-exp(-lambda*mats)];&#xA;&#xA;X(:,1)=mu;&#xA;&#xA;for t=2:nDates&#xA;x(:,t)=F*(x(:,t-1))+(I-F)*mu+w(:,t);&#xA;z(:,t)=B*x(:,t)+v(:,t);&#xA;end&#xA;&#xA;z(:,1)=[];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It all seems straightforward enough but what test can I so to ensure that it has been implemented correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ones I have thought of:&lt;br&gt;&#xA;Check the correlation of the factors x on their 1 period lags match the values given in matrix F&lt;br&gt;&#xA;Check that the variances of v and w are correct&lt;br&gt;&#xA;Check that the mean of the simulated variables are correct  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to check that the empirical variance of the parameters matches their theoretical equivalent, but I don't know what the theoretical equivalent should be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please feel free to suggest further tests that will allow me to know for sure if the implementation is correct.&lt;/p&gt;&#xA;" OwnerUserId="8943" LastActivityDate="2014-05-19T16:27:28.047" Title="Simulating a state space model" Tags="|matlab|state-space|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16343" PostTypeId="2" ParentId="6310" CreationDate="2014-05-19T17:17:37.457" Score="2" Body="&lt;p&gt;considering your equation,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$k\times u[n] - 0.25\times k\times u[n-2] = 2\times u[n] + u[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the left half of the equation will result in a series as shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{cccccccc} [k &amp;amp; k &amp;amp; \frac{3}{4}k &amp;amp; \frac{3}{4}k &amp;amp; \frac{3}{4}k &amp;amp; \frac{3}{4}k  &amp;amp; \ldots &amp;amp;]\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the right hand of the equation is&#xA;$$\begin{array}{cccccccc} [2 &amp;amp; 3 &amp;amp; 3 &amp;amp; 3 &amp;amp; 3 &amp;amp; 3 &amp;amp; \ldots &amp;amp; ]\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for these two series to be equal,&#xA;$$\begin{array}{cccccccc} k = 2 \\ k=3\\ \frac{3}{4}k=3 \\ \frac{3}{4}k=3 \\ \vdots &amp;amp; \end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not possible to equate these two sequences without removing first two points. In that case, $k = 4$. The sequences are equal or the equation holds for $k = 4$ and $n \ge 2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we are getting here is total solution, so it will have the natural response and forced response. The output get stabilized and reach the stable value only after $n \ge 2$. This 'transients' before $n &amp;lt; 2$ are due to the natural response.&lt;/p&gt;&#xA;" OwnerUserId="8871" LastActivityDate="2014-05-19T17:17:37.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16344" PostTypeId="2" ParentId="16330" CreationDate="2014-05-19T20:36:32.437" Score="-1" Body="&lt;p&gt;The &quot;gain&quot; is in terms of desired (and easy to see) knowledge.  If you transform to the frequency domain, you gain more explicit/visible (as can see it in a graphic plot) knowledge of particular frequency bands, but lose visible (can no longer see it in the FFT plot) knowledge of exact timing information.  If you transform back to the time domain, then you gain more explicit knowledge of timing (impulse time and transient changes, etc.), but lose visible knowledge (if you throw away the previous FFT plot) of what frequency bands that that time-domain waveform stimulates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no actual gain in the inherent information present in either the time or frequency vector, more likely some tiny loses due to numerical precision within the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Increase the sampling rate of an already band-limited signal (already below Nyquist at the lower sample rate) adds no new information (except possibly moving the sample data farther from anti-alias filter distortions, and spreading out quantization noise).  There's nothing new to which to add more &quot;gain&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But increasing the total sample vector time (not with zero-padding, but with more actual relevant data) can add fresh new information, which may allow processing &quot;gain&quot; to lower the noise floor, especially given a stationary signal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-19T20:36:32.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16345" PostTypeId="1" CreationDate="2014-05-19T20:48:35.973" Score="1" ViewCount="9029" Body="&lt;p&gt;From the MATLAB code below where do these theoretical equations for Rayleigh fading and white Gaussian noise come from? Or how are they derived?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = 1/sqrt(2)*[randn(nrx,ntx,N/ntx) + 1i*randn(nrx,ntx,N/ntx)]; % Rayleigh channel&#xA;n = 1/sqrt(2)*[randn(nrx,N/ntx) + 1i*randn(nrx,N/ntx)]; % white gaussian noise, 0dB variance&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8300" LastEditorUserId="8202" LastEditDate="2014-05-19T20:54:54.513" LastActivityDate="2021-12-12T12:52:34.147" Title="MATLAB Rayleigh fading and white gaussian noise" Tags="|matlab|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16346" PostTypeId="2" ParentId="16330" CreationDate="2014-05-19T21:01:36.333" Score="4" Body="&lt;p&gt;The &lt;em&gt;&quot;'Processing gain' of the FFT which increases as number of bins increases&quot;&lt;/em&gt; is due solely to an issue of definition.  the FFT is a &quot;fast&quot; algorithm to compute the DFT.  usually the DFT (and inverse DFT) is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X[k] \triangleq \sum_{n=0}^{N-1} x[n] e^{-j 2 \pi n k/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \frac{1}{N} \sum_{k=0}^{N-1} X[k] e^{+j 2 \pi n k/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it could have been defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X[k] \triangleq \frac{1}{N} \sum_{n=0}^{N-1} x[n] e^{-j 2 \pi n k/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \sum_{k=0}^{N-1} X[k] e^{+j 2 \pi n k/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and can even be defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X[k] \triangleq \frac{1}{\sqrt{N}} \sum_{n=0}^{N-1} x[n] e^{-j 2 \pi n k/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] =  \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} X[k] e^{+j 2 \pi n k/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the latter form, there is no &quot;processing gain&quot; of either the DFT nor iDFT.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-05-19T21:01:36.333" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16347" PostTypeId="2" ParentId="16308" CreationDate="2014-05-19T22:09:30.620" Score="1" Body="&lt;p&gt;For your information, I just took one additional data point that I should not have taken. Replacing every &lt;strong&gt;2*N-1&lt;/strong&gt; with &lt;strong&gt;2*N-2&lt;/strong&gt; resolved the issue. My original (problematic sequence) was as follows:&#xA;$$ [0,1,2,3,3,2,1,0]$$&#xA;The problem was resolved when the series became like by removing the last term.&#xA;$$ [0,1,2,3,3,2,1]$$ &lt;/p&gt;&#xA;" OwnerUserId="8932" LastActivityDate="2014-05-19T22:09:30.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16348" PostTypeId="1" CreationDate="2014-05-19T23:38:31.600" Score="1" ViewCount="1810" Body="&lt;p&gt;I am using Matlab R2012b 64-bit on Windows 7 in order to estimate the power spectrum of a simple signal that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos(10t) + \sin(20t) $$defined in the time interval from 0.0 to 10.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I did:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) There was no predefined value of points so I took 1001 points by forming a time array and sampled the function at these points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I calculated the autocorrelation function of the signal with the built-in function &quot;xcorr&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) I performed FFT directly on the autocorrelation function with no additional options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) The resulting data set had imaginary parts(I think this should not be the case since the autocorrelation function is even).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) I took the absolute value of the FFT of ACF and plotted it as the power spectrum from the ACF after having it shifted with fftshift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) I took the FFT of the sinusoidal signal after padding it with 1000 (n-1) zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;7) I calculated the power spectrum from the FFT of the signal as the square of the absolute value of the frequency coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;8) I plotted both of them and compared them by assigning an array to difference between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;9) They turned out to be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything seems to be working correctly but my concerns are as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How can this data be interpreted? I expected the sum and difference frequencies of the individual sinusoidal functions in the signal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;-How can I normalize the output and represent negative frequencies properly since they have no physical significance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Does Matlab use FFTW libraries? My main task is to achieve the same results in a C program using these libraries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have benefitted from the following URL:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1919/efficiently-calculating-autocorrelation-using-ffts?rq=1&quot;&gt;Efficiently calculating autocorrelation using FFTs&lt;/a&gt; in organizing the post and achieving these results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also confused about the terms &lt;strong&gt;power spectrum&lt;/strong&gt;, &lt;strong&gt;power spectral density&lt;/strong&gt; and &lt;strong&gt;energy spectrum&lt;/strong&gt;. Are they used interchangeably? I would be grateful for an explanation of this phenomenon and normalization procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S : The code snippet I have used is as follows and it can reproduce my results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=transpose(0:0.01:10);&#xA;n=size(t,1);&#xA;f=cos(10*t)+sin(20*t);&#xA;acf=xcorr(f,f);&#xA;&#xA;FFTacf=fft(acf);&#xA;PSacf=abs(FFTacf);&#xA;&#xA;FFTp=fft([f;zeros(n-1,1)]);&#xA;PSf=FFTp.*conj(FFTp);&#xA;&#xA;figure;&#xA;subplot(2,1,1);&#xA;plot(fftshift(PSf));&#xA;title('PS from FFT');&#xA;subplot(2,1,2);&#xA;plot(fftshift(PSacf));&#xA;title('PS from ACF');&#xA;&#xA;d=PSacf-PSf;&#xA;fprintf('Max error = %6.2f \n', max(abs(d)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8932" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-11-21T11:19:08.160" Title="Obtaining power spectrum from ACF, FFT using Matlab and FFTW" Tags="|matlab|fft|frequency-spectrum|autocorrelation|normalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16349" PostTypeId="2" ParentId="16330" CreationDate="2014-05-19T23:56:26.640" Score="2" Body="&lt;p&gt;The FFT processing gain comes from the fact that the DFT (of which FFT is simply a fast implementation) is a non-normalized linear transformation. This is a mouthful, so let's look at what this means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to assume that you know what a &lt;a href=&quot;http://en.wikibooks.org/wiki/Linear_Algebra/Linear_Transformations&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear transformation&lt;/a&gt; is. Namely, given vectors $\mathbf{x}$ and $\mathbf{y}$ and a matrix $A$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{y} = A \mathbf{x}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DFT is just such a transformation. In fact, you can use MATLAB &lt;code&gt;dftmtx&lt;/code&gt; command to generate this matrix for you based on the length of vector $\mathbf{x}$. This this case,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{y} = \text{DFT}(\mathbf{x}).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This matrix $A$ has some properties. First of all, it's a square matrix, which means that it's probably invertible (and indeed it is!). It also tells us that we're essentially taking components of x and performing a &lt;a href=&quot;http://en.wikipedia.org/wiki/Change_of_basis&quot; rel=&quot;nofollow noreferrer&quot;&gt;change of basis&lt;/a&gt; given by the columns of $A$ to get its DFT. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's get to some more important properties. Matrix $A$ is orthogonal. This means that every column of $A$ is perpendicular to every other column, or more mathematically, $A^TA$ is a diagonal matrix (you may have to think a little about why this is true). This is a &lt;em&gt;very&lt;/em&gt; nice property, since simply transposing the matrix gives us something very close to its inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this Transpose $\leftrightarrow$ Inverse relationship strict, we want the matrix $A$ to also be &lt;em&gt;normal&lt;/em&gt;. This is a matrix whose every column vector has length 1. In other words, if $a$ is a column of $A$, then $\sqrt{a^Ta} = 1.$ If a matrix is both orthogonal and normal, we call it &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthonormality&quot; rel=&quot;nofollow noreferrer&quot;&gt;orthonormal&lt;/a&gt;, and in this case $A^TA = I$, so $A^T$ is in fact the inverse of $A$. Neat!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual DFT matrix (or the usual DFT transform) is orthogonal, but &lt;em&gt;not&lt;/em&gt; orthonormal. In fact, if $D$ is the DFT matrix, then $D^TD = N$ where $N$ is the number of columns (or rows, it's square!) in $D$. To make it orthonormal, we should use $\frac{D}{\sqrt{N}}$ instead. If you look at it long enough, you realize that is we scale both forward and inverse transforms by $\frac{1}{\sqrt{N}}$, we're doing extra work in performing the calculations, so we usually just scale by $\frac{1}{N}$ at the inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are better theoretical reasons for doing it on one side rather than of both. See &lt;a href=&quot;https://dsp.stackexchange.com/questions/11376/why-are-magnitudes-normalised-during-synthesis-idft-not-analysis-dft/11379#11379&quot;&gt;my answer here&lt;/a&gt; for more information.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-05-20T21:56:27.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16350" PostTypeId="1" CreationDate="2014-05-20T00:40:56.920" Score="1" ViewCount="1032" Body="&lt;p&gt;Is phase and amplitude information necessarily lost when undersampling if you have a constant periodic single frequency sinusoidal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second question is: How can one determine the undersampling frequency for such a case? And how to retrieve the amplitude and phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know if this is possible for a sampling frequency much lower than the Nyquist rate.&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2019-07-06T19:02:25.290" Title="Is phase and amplitude information necessarily lost when undersampling?" Tags="|sampling|phase|nyquist|amplitude|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16351" PostTypeId="2" ParentId="16345" CreationDate="2014-05-20T00:50:25.870" Score="1" Body="&lt;p&gt;So, it looks like the Gaussian noise is correctly generated, while the Rayleigh channel is generated incorrectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely, we're generating an array of real normally distributed random numbers and imaginary normally distributed random numbers, scaling both by $\frac{1}{\sqrt{2}}$. This works well for Gaussian, since on average their magnitude will indeed be 1 since&#xA;$$\sqrt{ \frac{1}{\sqrt{2}}^2 + \frac{1}{\sqrt{2}}^2 } = 1.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we can't directly get Rayleigh distribution by using Gaussian distribution alone (provided by &lt;code&gt;randn&lt;/code&gt;). We should use &lt;a href=&quot;http://www.mathworks.com/help/stats/raylrnd.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;raylrnd&lt;/code&gt;&lt;/a&gt; instead. In this case the same argument applies for the $\frac{1}{\sqrt{2}}$ scaling.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-05-20T00:50:25.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16352" PostTypeId="1" AcceptedAnswerId="16355" CreationDate="2014-05-20T02:39:22.773" Score="1" ViewCount="2209" Body="&lt;p&gt;I have the Fourier Transform of a signal. How can I determine the Nyquist Rate of that signal? What is the formula for that?&lt;/p&gt;&#xA;" OwnerUserId="8955" LastActivityDate="2014-05-20T20:05:32.710" Title="How to determine Nyquist Rate" Tags="|nyquist|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16353" PostTypeId="2" ParentId="16330" CreationDate="2014-05-20T02:40:18.203" Score="8" Body="&lt;p&gt;I think the easiest way to wrap around a concept is to have a simple example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% example of FFT of a very noisy sin wave&#xA;f0 = 1000;     % sinusoid frequency&#xA;Fs = 10000;    % sampling frequency &#xA;n = 0:1/Fs:1; % one second worth of sample index&#xA;N = length(n);&#xA;SNR = -20;    % signal to noise ratio is -20dB&#xA;Pn  = 0.5*10^(-SNR/10); % signal power is 0.5 for sin wave&#xA;NFFT = round([N/8 N/4 N/2 N]); % FFT size to see how it effects the gain&#xA;&#xA;&#xA;%% signal and generation&#xA;sx = sin(2*pi*f0*n);&#xA;sn = sqrt(Pn)*randn(1, N);&#xA;%% adding noise&#xA;xn = sx + sn;&#xA;%% signal with and w/o noise in time&#xA;figure(1);&#xA;plot(n(1:100), xn(1:100)); hold on;&#xA;plot(n(1:100), x(1:100), 'r');&#xA;legend('noisy', 'clean');&#xA;%% FFT of different sizes&#xA;figure(2); &#xA;Xf = fft(xn, NFFT(4));&#xA;plot(Fs*(0:NFFT(4)-1)/NFFT(4), abs(Xf)/N, '.-'); hold on;&#xA;Xf = fft(xn, NFFT(3));&#xA;plot(Fs*(0:NFFT(3)-1)/NFFT(3), abs(Xf)/N, 'r.-');&#xA;Xf = fft(xn, NFFT(2));&#xA;plot(Fs*(0:NFFT(2)-1)/NFFT(2), abs(Xf)/N, 'g.-'); &#xA;Xf = fft(xn, NFFT(1));&#xA;plot(Fs*(0:NFFT(1)-1)/NFFT(1), abs(Xf)/N, 'k.-');&#xA;legend('FFT size = N', 'FFT size = N/2', 'FFT size = N/4', 'FFT size = N/8');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plot of noisy and clean sin wave in time domain looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OyVSG.png&quot; alt=&quot;Noisy vs clean sin wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT plots for different sizes in frequency domain is:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gXHBd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e., increasing the FFT size means adding more signal samples in the calculation, and therefore easier for FFT to determine the frequency, as the signal information gets added on, while the noise information does not. Here you can see the &quot;relative&quot; noise floor w.r.t signal has decreased. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for inverse Fourier, I won't say it is a loss, I'd say we went back where we came from. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;hth. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastEditorUserId="8832" LastEditDate="2017-08-20T07:08:40.760" LastActivityDate="2017-08-20T07:08:40.760" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16354" PostTypeId="1" CreationDate="2014-05-20T04:10:44.387" Score="1" ViewCount="1137" Body="&lt;p&gt;Apologies if I'm using incorrect terms, and if this question's already been answered here. I have a data set which consists of a high DC signal modulated by AC signal (taken from custom-built biomedical instrumentation). Now the problem is that my signal has some low-frequency features that I'm having a hard time getting rid of using scipy. Please note that I'm a researcher but have limited practical experience in signal processing. I first do a low-pass on the signal to remove high-frequency components, and then I am trying to add a second filter to remove this low-frequency feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried doing a (butterworth order 1, cutoff 0.1Hz) high-pass filter but this removes the DC offset, which is important for me to keep (Figure 1). It also behaves in a rather odd manner. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/3gMuj.png&quot; alt=&quot;cutoff frequency 0.1Hz&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then tried doing a (butterworth order 1, band 0.1Hz to 0.5Hz) bandstop filter (removing low frequencies just above zero and just below  my range of interest) but this results in a strange peak in the filtered output which I am unable to explain (Figure 2 - bonus points for someone who can shed light on this). &#xA;&lt;img src=&quot;https://i.stack.imgur.com/kZyag.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is level the data, and remove these artifacts, so that each peak will  be in line with the next. I've searched around but there doesn't seem to be an obvious and readily available solution to this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give you an idea of what I would really like to do, here is a similar treatment of the signal done in OriginPro: (Look at the blue signal - it has not had its DC offset shifted at all. How is OriginPro implementing this highpass filter? How can I replicate this behaviour in scipy?)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zHzmy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do I want to use scipy if my job's being done in Origin? Simple: (1) I want to understand the processing in greater detail so I can optimize it to not lose important parts of the signal (2) To automate the entire processing from acquisition to analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would greatly appreciate any help at all. Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="8953" LastActivityDate="2014-05-20T04:10:44.387" Title="Signal leveling using scipy" Tags="|filter-design|python|highpass-filter|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16355" PostTypeId="2" ParentId="16352" CreationDate="2014-05-20T06:57:36.893" Score="3" Body="&lt;p&gt;For finite length or time limited signals, the Nyquist rate only makes sense given some finite noise floor requirement and finite total signal energy.  You look for the frequency at or above which nothing is above that noise floor and the total remaining energy is below that noise floor.  Twice that is the minimum sampling frequency to avoid aliasing causing any noise above that given floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For infinite length signals, there is the possibility of a frequency domain window of finite support width.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-05-20T20:05:32.710" LastActivityDate="2014-05-20T20:05:32.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16358" PostTypeId="1" CreationDate="2014-05-20T09:21:10.270" Score="-1" ViewCount="3896" Body="&lt;p&gt;I'm learning how to construct a discrete signal as a sum of impulse responses of the system. The final formula is then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n]=  \sum_{k= -\infty}^\infty x[n] h_{k}[n] &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what is the amplitude of the impulse response, because i thought an impulse response was already a scaled response to the unit impulse inputted into the system? But here they are multiplying again with a scaling factor of x[n]? So is the unit impulse's amplitude just 1 then?&lt;/p&gt;&#xA;" OwnerUserId="8942" LastActivityDate="2014-05-20T19:13:55.717" Title="What is the amplitude of the impulse resonse" Tags="|impulse-response|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16359" PostTypeId="1" CreationDate="2014-05-20T09:39:20.520" Score="0" ViewCount="2251" Body="&lt;p&gt;I am currently working on functional connectivity analysis of EEG, and need to bandpass filter my data into different frequency bands (Delta, Theta, Alpha and Beta). An important thing is that the filter doesn't cause phase distortion. I know a butterworth filter and processing the data in both the forward and reverse directions (e.g. with filtfilt in Matlab) is a good approach, however I was still wondering about the simple FFT/IFFT filtering approach. What are the exact disadvantages of this method? Does this method cause phase distortions? What are 'edge effects' that occur with this method? &lt;/p&gt;&#xA;" OwnerUserId="8959" LastActivityDate="2014-05-20T16:46:01.603" Title="Simple FFT filtering vs. e.g. butterworth filtering" Tags="|filters|fourier-transform|eeg|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16360" PostTypeId="1" AcceptedAnswerId="16374" CreationDate="2014-05-20T09:39:32.440" Score="-2" ViewCount="82" Body="&lt;p&gt;In these days we can able to easily calculate the bandwidths with the help of technology, but in olden days where people used the analog phones, how did they calculated the bandwidths?&lt;/p&gt;&#xA;" OwnerUserId="8958" LastActivityDate="2014-05-20T19:51:03.800" Title="Before the birth of computers how people calculated the bandwidths?" Tags="|discrete-signals|bandwidth|analog|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16361" PostTypeId="2" ParentId="16358" CreationDate="2014-05-20T09:57:07.593" Score="0" Body="&lt;p&gt;In case of discrete signals, the amplitude of unit impulse is 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does not mean that your impulse response should have unit amplitude. The impulse response can have any real valued amplitude in it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The area under unit impulse in continuous time domain is 1 not the amplitude. The amplitude of a unit impulse approaches infinity as the area under remains constant (=1).&lt;/p&gt;&#xA;" OwnerUserId="8871" LastEditorUserId="8871" LastEditDate="2014-05-20T14:57:55.873" LastActivityDate="2014-05-20T14:57:55.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16362" PostTypeId="1" CreationDate="2014-05-20T10:56:53.403" Score="0" ViewCount="244" Body="&lt;p&gt;as you can see on page 314 the derivation of the ln[f etc.] equation is done via the matched filter that i have also provided below. i would like to know how this equation is used to derive the ln[f etc.] from its previous probability functions, and how it then finally becomes in the form of ||a-b||&amp;lt;||a-b||&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help would be greatly appreciated. thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C4zNU.jpg&quot; alt=&quot;matched filter 3.2.2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vrZ2N.jpg&quot; alt=&quot;maximum likelihood 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rB0bk.jpg&quot; alt=&quot;maximum likelihood 2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8300" LastEditorUserId="128" LastEditDate="2018-07-25T03:59:21.347" LastActivityDate="2018-07-25T03:59:21.347" Title="Maximum Likelihood Derivation" Tags="|equalization|detection|maximum-likelihood-estimation|maximum-a-posteriori-estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16363" PostTypeId="2" ParentId="16362" CreationDate="2014-05-20T12:54:00.970" Score="3" Body="&lt;p&gt;The formula you need, which I don't see in the scanned pages, is the N-dimensional Gaussian distribution of the received vector given that the signal $s_m$ was transmitted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(\vec{r}|s_m)=\frac{1}{(\pi N_0)^{N/2}}\exp\left[-\frac{\sum_{j=1}^N(r_j-x_{mj})^2}{N_0}\right]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maximum likelihood receiver seeks to maximize this conditional probability by choosing the appropriate $s_m$. Since the logarithm is a monotonic function, you can as well maximize the logarithm of (1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\log(f(\vec{r}|s_m))=-\frac{N}{2}\log(\pi N_0)-\frac{1}{N_0}\sum_{j=1}^N(r_j-x_{mj})^2=\\=-\frac{N}{2}\log(\pi N_0)-\frac{1}{N_0}||\vec{r}-s_m||^2\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the first term in (2) is constant (i.e. independent of $s_m$), maximizing (2) is equivalent to minimizing the distance $||\vec{r}-s_m||^2$. If $||\vec{r}-s_m||^2$ is minimal, then obviously also $||\vec{r}-s_m||$ is minimal. So we arrive at the ML decision rule given in your book, i.e. choose the signal $s_m$ for which the distance to the received signal is a minimum.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-20T12:54:00.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16364" PostTypeId="2" ParentId="16326" CreationDate="2014-05-20T13:06:24.783" Score="2" Body="&lt;p&gt;It's not clear in your case that Gaussian kernels will help you.&lt;/p&gt;&#xA;&lt;p&gt;Since you have a noise shape that is closer to &lt;em&gt;salt-and-pepper&lt;/em&gt; noise instead of additive white noise, you may want to try other algorithms (that are somehow linked to an &lt;span class=&quot;math-container&quot;&gt;$L_1$&lt;/span&gt; best fit instead of a least squares solution):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;you can try median filtering, since it is by design more robust to this noise shape,&lt;/li&gt;&#xA;&lt;li&gt;you can also try to minimize some TV-&lt;span class=&quot;math-container&quot;&gt;$L_1$&lt;/span&gt; functional over your image, see &lt;a href=&quot;http://www.optimization-online.org/DB_FILE/2010/06/2646.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chambolle-Pock's paper (A first-order primal-dual algorithm for convex problems with applications to imaging) on primal dual minimization&lt;/a&gt; for a concrete example,&lt;/li&gt;&#xA;&lt;li&gt;you also can use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilateral_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;bilateral filter&lt;/a&gt;. You will have to play with the exponential decay of the pixel similarity function (&lt;span class=&quot;math-container&quot;&gt;$\sigma_d$&lt;/span&gt; in Wikipedia page) to get the desired behaviour.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="7092" LastEditDate="2022-04-11T11:47:03.763" LastActivityDate="2022-04-11T11:47:03.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16366" PostTypeId="2" ParentId="16326" CreationDate="2014-05-20T16:03:39.307" Score="3" Body="&lt;p&gt;So if I understand your description correctly your data looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JMStt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case you could try using a robust Gaussian smoothing. This involves an extra weight term to discard 'outliers'. There are many possible ways to define the outliers using deviation from the local mean (over the kernel) greater than $\pm 3 \sigma$ is a common way. Unfortunately I can't seem to find any decent papers or articles describing the method in more detail.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-20T16:03:39.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16367" PostTypeId="2" ParentId="16359" CreationDate="2014-05-20T16:25:32.027" Score="2" Body="&lt;p&gt;Edge effects due to circular convolution can occur if you don't zero pad the data sufficiently before FFT/IFFT filtering.  Fast convolution filtering using shorter sequential segments or windows from a longer data stream requires both padding of the FFT and overlap add/save processing of the overlapping IFFT results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just naively zeroing FFT bins instead of using the transform of a properly designed time domain filter can lead to extreme ripples in the filter's frequency response and/or ringing in the FFT/IFFT filtered result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No phase distortion should occur if the filter kernel has appropriate symmetry in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computational cost of an FFT (in CPU cycles or latency time) can be higher than with IIR filtering.  But that depends on the length of the data and the filter complexity (in filter order and/or number of passes).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-05-20T16:46:01.603" LastActivityDate="2014-05-20T16:46:01.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16368" PostTypeId="1" AcceptedAnswerId="16370" CreationDate="2014-05-20T16:34:38.537" Score="1" ViewCount="1020" Body="&lt;p&gt;I've been reading a little bit about how DCT works in image compression using the 2D transform, however I don't know how this applies to audio using a 1D transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have an audio segment, I mean, some samples of a mono audio vector.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ai = [-0.0288,-0.0304,-0.0354,-0.0406,-0.0469,-0.0518,-0.0647,-0.0831 ...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I calculate 1D DCT on that vector.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R = dct(Ai)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result would be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.2143   -0.3158   -0.6354   -0.3877    0.5503    0.2330   -0.1690    0.0203&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How should I interpret this result? Are the high energy coefficient the ones with a greater value?(I'm still a noob on this). Is the first value the DC coefficient? Is there a special way to read the vector (zig-zag or something)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be appreciated, btw I'm working with matlab.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="4222" LastActivityDate="2014-05-20T17:11:38.627" Title="High energy coefficients in 1d DCT for audio" Tags="|matlab|audio|dct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16369" PostTypeId="1" AcceptedAnswerId="16381" CreationDate="2014-05-20T17:03:56.073" Score="0" ViewCount="118" Body="&lt;p&gt;I am study linear classification(Y=aX+b) But it is still weakness that is overlapping problem. Could you suggest to me how to reduce overlapping problem in linear classification or how to find these parameters that helpful for overlapping reduction. In my question, I don't considier SVM method because it is more difficult to implement. Thank you so much &lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2014-05-20T22:13:37.650" Title="Linear classification and overlapping problem reduction" Tags="|image-processing|algorithms|image-segmentation|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16370" PostTypeId="2" ParentId="16368" CreationDate="2014-05-20T17:11:38.627" Score="3" Body="&lt;p&gt;When we calculate 1D DCT of a signal (vector) we will get the DCT coefficients of same length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first value in this is the DC coefficient and low frequency components are at the begnning, as the index increases the frequency also increases. And hence the last value in DCT coeffs is the highest frequency (ie. fs/2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zig zag scanning is done in 2D DCT to read the coefficients in the increasing order of frequency. But in 1D DCT there is no need of zig zag scan as it contains only one row (or 1 column), it is already in ascending order of frequency (starting from Dc value and ends at maximum frequency ie. fs/2).&lt;/p&gt;&#xA;" OwnerUserId="8917" LastActivityDate="2014-05-20T17:11:38.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16371" PostTypeId="2" ParentId="16358" CreationDate="2014-05-20T19:13:55.717" Score="-1" Body="&lt;p&gt;Impulse response means the output of an LTI system when the input is a unit impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;eg. $ y[n]=x[n]+2x[n-1]-x[n-2]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is a system. where, &lt;strong&gt;&lt;em&gt;y[n]&lt;/em&gt;&lt;/strong&gt; is the output and &lt;strong&gt;&lt;em&gt;x[n]&lt;/em&gt;&lt;/strong&gt; is the input.&#xA;Then the unit impulse response of the system is calculated by substituting &#xA;$x[n]=\delta[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then, the output $y[n]=\delta[n]+2\delta[n-1]-\delta[n-2]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie. impulse response, &lt;strong&gt;&lt;em&gt;h[n]={1,2,-1}&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence values in the impulse response may take any real number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Impulse response is used to characterize an LTI system. That is if we know the impulse response of a system we can calculate the output for any input x[n] by finding convolution of impulse response (h[n]) with the input(x[n]).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output of a system with impulse response &lt;strong&gt;&lt;em&gt;h[n]&lt;/em&gt;&lt;/strong&gt; and input &lt;strong&gt;&lt;em&gt;x[n]&lt;/em&gt;&lt;/strong&gt; is given by the equation (convolution), &#xA;$ y[n]=  \sum_{k= -\infty}^\infty x[k] h[n-k] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the input &lt;strong&gt;&lt;em&gt;x[n]&lt;/em&gt;&lt;/strong&gt; does not have any connection with impulse response &lt;strong&gt;&lt;em&gt;h[n]&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note : Unit Impulse is a standard signal with unit amplitude at 0 and 0 at all other instants.&#xA;But a unit impulse response is the output of an LTI system when the input is a unit impulse. It is the characteristics of an LTI system and the values may take any real number and is different for different system.&lt;/p&gt;&#xA;" OwnerUserId="8917" LastActivityDate="2014-05-20T19:13:55.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16372" PostTypeId="1" CreationDate="2014-05-20T19:36:47.200" Score="2" ViewCount="276" Body="&lt;p&gt;I'd like to validate changes to our app music player in our Continuous Integration unit tests (more like integration tests, really). My thoughts were to start with an audio file that contains only a pure tone, or a series of pure tones. Our automated test would stream this file over the internet and play it through our player. We would capture the output using MTAudioProcessingTap. This output would go through and FFT and the pass/fail test would be check for the existence of only the original frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would this work? I'm thinking this would catch pops and glitches, but not necessarily discontinuities in the output.&lt;/p&gt;&#xA;" OwnerUserId="8962" LastActivityDate="2014-05-20T20:33:56.833" Title="Using FFT to Unit Test a Music Player" Tags="|fft|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16373" PostTypeId="2" ParentId="16350" CreationDate="2014-05-20T19:39:14.417" Score="0" Body="&lt;p&gt;If you sample a constant periodic signal of frequency &lt;strong&gt;&lt;em&gt;f&lt;/em&gt;&lt;/strong&gt; with a frequency less than twice the frequency (below Nyquist rate or Undersampling) you will lost the data due to aliasing.&#xA;Lets say $f=100 Hz$ then by Nyquist rate we should sample the signal with a sampling rate higher than &lt;strong&gt;&lt;em&gt;200 Hz&lt;/em&gt;&lt;/strong&gt;.&#xA;If we under sample the signal (&amp;lt;200) by a sampling frequency say $f_s=180 Hz$.&#xA;Then due to aliasing the reconstructed signal will be a periodic signal with a frequency less than the original signal.&#xA;Here the reconstructed signal will be a &lt;strong&gt;80 Hz&lt;/strong&gt; signal instead of &lt;strong&gt;100 HZ&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So under sampling will replace a signal with a low frequency signal.&lt;/p&gt;&#xA;" OwnerUserId="8917" LastActivityDate="2014-05-20T19:39:14.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16374" PostTypeId="2" ParentId="16360" CreationDate="2014-05-20T19:51:03.800" Score="1" Body="&lt;p&gt;I may have used a sweepable oscillator for input with an oscilloscope to examine the output response in one engineering course lab, then compared a graph of the lab experimental results with some slide rule calculations.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-20T19:51:03.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16375" PostTypeId="2" ParentId="16372" CreationDate="2014-05-20T19:56:45.747" Score="1" Body="&lt;p&gt;The phase vocoder algorithm used with overlapped FFT frames might easily catch certain kinds of discontinuities in pure sine waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the audio file is compressed, note that this process itself may add certain kinds of distortion.  So you would need to find an experimental threshold.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-20T19:56:45.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16376" PostTypeId="2" ParentId="16372" CreationDate="2014-05-20T20:33:56.833" Score="1" Body="&lt;p&gt;Recently I did similar thing and I can suggest you some solutions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Play $1kHz$ sinusoid at a given level of some arbitrary length (mostly bit longer = better), then you can tell what is the &lt;strong&gt;gain&lt;/strong&gt; of your system, and calculate its &lt;strong&gt;THD&lt;/strong&gt;. Additionally if you signal is long enough then you might also notice any disruptions in it. For that you can use energy envelope of the received signal. In your case you might want to calculate variation of THD where ratio between fundamental ($1kHz$) and rest of frequencies is calculated.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Record silence only to check for the level of noise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For measuring of the frequency response you can either play white/pink noise and compare the spectral envelope or use the &lt;a href=&quot;https://dsp.stackexchange.com/a/15044/8202&quot;&gt;&lt;strong&gt;sweep sine&lt;/strong&gt;&lt;/a&gt; measurement technique to obatin impulse reponse and, from it, frequency reponse. You can also use the technique from good old times, when short sinusoids with increasing frequencies were played, but that's up to you. I am using sweeps all the time (what's more you can calculate the THD at each frequency).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You might also want to play the stereo signal with two sinusoids at different frequencies and same amplitude(i.e. $1kHz$ &amp;amp; $2kHz$) to check for any problems with stereo.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Obviously there is plenty more different tests I did, but they are always application dependent. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-05-20T20:33:56.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16377" PostTypeId="1" AcceptedAnswerId="16378" CreationDate="2014-05-20T20:54:32.423" Score="1" ViewCount="6849" Body="&lt;p&gt;I am trying to verify for myself that aliasing actually makes it impossible to distinguish the &quot;real&quot; and the aliased frequency. What I have done it set the sampling rate to 20 Hz and created two sine wave with 2 Hz and 18 Hz. As far as I understand the 18 Hz signal should alias to a 2 Hz signal when the sampling rate is 20 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Matlab code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = [0:0.05:1];      //20Hz sampling&#xA;a = sin(2*pi*2*t);   //2Hz sine wave&#xA;b = sin(2*pi*18*t);  //18Hz sine wave&#xA;plot(t, a);&#xA;hold on;&#xA;plot(t, b, 'red');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plot looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WcfPA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that both sine waves are equal, but 180 degrees out of phase. I wonder if there is something to it or if it's just Matlab drawing through the points in opposite ways?&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2015-02-21T20:52:34.993" Title="Visualizing aliasing in Matlab" Tags="|aliasing|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16378" PostTypeId="2" ParentId="16377" CreationDate="2014-05-20T21:13:55.807" Score="3" Body="&lt;p&gt;Yes, there is something to it.  The phase increment of each sample of the 2 Hz wave is $2\pi * 2*.05=.2\pi$.  The phase increment of each sample of the 18 Hz wave is $2\pi*18*.05=1.8\pi=-.2\pi$.  Thus, the 2 Hz wave is $sin(2\pi*2*t)$, and the 18 Hz wave is $sin(2\pi*-2*t)=-sin(2\pi*2*t)$.  Thus, the two waves are 180 degrees out of phase.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-05-20T21:13:55.807" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16379" PostTypeId="2" ParentId="16377" CreationDate="2014-05-20T21:16:46.967" Score="4" Body="&lt;p&gt;I think you should plot something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = [0:0.05:1];      %20Hz sampling&#xA;a = sin(2*pi*2*t);   %2Hz sine wave&#xA;b = sin(2*pi*18*t);  %18Hz sine wave&#xA;plot(t, a, 'bo');&#xA;hold on;&#xA;plot(t, b, 'ro');&#xA;&#xA;T = [0:0.001:1];     %1000Hz sampling frequency&#xA;A = sin(2*pi*2*T);&#xA;B = sin(2*pi*18*T);&#xA;% plot for 1000Hz sampling frequency&#xA;plot(T, A, 'b');&#xA;plot(T, B, 'r');&#xA;&#xA;legend({'2Hz @ 20 Hz f_s', '18Hz @ 20 Hz f_s', '2Hz @ 1000 Hz f_s', '18Hz @ 1000 Hz f_s'})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That allows to understand which exact samples of your sinusoids you are taken at a given sampling frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dO30B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-02-21T20:52:34.993" LastActivityDate="2015-02-21T20:52:34.993" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16380" PostTypeId="2" ParentId="16377" CreationDate="2014-05-20T21:24:24.143" Score="2" Body="&lt;p&gt;That's expected because an 18 Hz tone sampled at a 20 Hz sample rate is equivalent to a -2Hz tone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about how it would look if DC was re-centered up at 20 Hz. 18 Hz would be on the low side.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = [0:0.05:1];      %20Hz sampling&#xA;a = sin(2*pi*2*t);   %2Hz sine wave&#xA;b = sin(2*pi*18*t);  %18Hz sine wave&#xA;c = sin(2*pi*22*t);  %22Hz sine wave&#xA;d = sin(2*pi*-2*t);  %%-2Hz sine wave&#xA;plot(t, a);&#xA;hold on;&#xA;plot(t, b, 'r');&#xA;plot(t, c, 'ko');&#xA;plot(t, d, 'g*');&#xA;legend('2 Hz','18 Hz','22 Hz','-2 Hz')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QAy76.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7509" LastActivityDate="2014-05-20T21:24:24.143" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16381" PostTypeId="2" ParentId="16369" CreationDate="2014-05-20T22:13:37.650" Score="1" Body="&lt;p&gt;It's very difficult to tell what you're asking exactly, but one thing to keep in mind is that not al data is &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_separability&quot; rel=&quot;nofollow&quot;&gt;linearly separable&lt;/a&gt;. You may have to obtain more features from data or try non-linear separation techniques. SVM is one of them, but since you're not considering it, you can try polynomial separation or logistic classifiers.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-05-20T22:13:37.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16382" PostTypeId="1" AcceptedAnswerId="16383" CreationDate="2014-05-20T23:16:44.937" Score="1" ViewCount="630" Body="&lt;p&gt;I keep reading that a constant group delay over a frequency band is desirable for a filter. But a constant group delay means a linear decrease in the phase delay, which would distort the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume that I have a group delay of 5 [time units] over a frequency band from 100 Hz to 110 Hz.&#xA;That means that the phase delay is $-5\omega + c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the 100 Hz component will be delayed by 500 + c rad&lt;/li&gt;&#xA;&lt;li&gt;the 101 Hz component will be delayed by 505 + c rad&lt;/li&gt;&#xA;&lt;li&gt;the 102 Hz component will be delayed by 510 + c rad&lt;/li&gt;&#xA;&lt;li&gt;etc&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Considering that different frequencies components have different phase delays, the signal will be distorted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why is a flat group delay response desirable for a filter?&lt;/p&gt;&#xA;" OwnerUserId="5411" LastActivityDate="2014-05-21T19:20:41.717" Title="Interpret group delay of a filter" Tags="|filters|filter-design|group-delay|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16383" PostTypeId="2" ParentId="16382" CreationDate="2014-05-20T23:56:04.373" Score="4" Body="&lt;p&gt;This is actually pretty simple. Take a pure-tone sine wave, say&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t) = \cos\left(\omega t + \phi \right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, fix a time $t_0$ and find the phase $\psi(t_0)$ of $s(t_0)$. We get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\psi(t_0) = \omega t_0 + \phi$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's vary the frequency $\omega$ and keep the time fixed. The above expression becomes a linear function in $\omega$! Even though we haven't actually &quot;delayed&quot; the wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine it visually. You have a point in time (not 0, that will always stay the same) and a sine wave which is, say, shrinking (frequency increases). As it shrinks, different phases of this sine wave will cross your fixed time point for different frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why phase response of a simple delay system is a sloped line, not a horizontal line. Its derivative, however, will be horizontal and proportional to the amount of delay we introduced in the system, i.e&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial}{\partial \omega} \left( \omega t_0 + \phi \right) = t_0,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is precisely the system delay.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="80" LastEditDate="2014-05-21T19:20:41.717" LastActivityDate="2014-05-21T19:20:41.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16384" PostTypeId="1" AcceptedAnswerId="16413" CreationDate="2014-05-21T00:04:36.687" Score="4" ViewCount="243" Body="&lt;p&gt;In continuation to the previous question &lt;a href=&quot;https://dsp.stackexchange.com/questions/16158/conceptual-questions-from-signal-processing/16163?noredirect=1#16163&quot;&gt;Conceptual questions from signal processing&lt;/a&gt; I have a doubt which is: Consider an Autoregressive model (AR(2)): &#xA;$$&#xA;y(t) = ay(t-1) + by(t-2)&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and a FIR (Moving Average, MA(2)) model &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = a\epsilon(t-1) + b\epsilon(t-2).&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the reply in the prev question, in time domain &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = h[n]\star x[n]&#xA;$$&#xA;$h$ is the impulse response. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there any relation between impulse response and the coefficients of AR and MA model? &lt;/li&gt;&#xA;&lt;li&gt;What is the intuition of the coefficients and how do we get them? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="780" LastEditorUserId="128" LastEditDate="2018-07-02T08:55:59.617" LastActivityDate="2018-07-02T08:55:59.617" Title="Conceptual Question from Signal Processing - Impulse Response and AR Coefficients" Tags="|linear-systems|impulse-response|moving-average|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16385" PostTypeId="2" ParentId="16345" CreationDate="2014-05-21T01:33:18.453" Score="9" Body="&lt;p&gt;The Rayleigh fading channel equation you provided comes from the property that given two independent zero-mean Gaussian random variables with equal variance $X \sim N(0,\sigma^2)$ and $Y \sim N(0,\sigma^2)$, the random variable $R = \sqrt{X^2+Y^2}$ is Rayleigh distributed (see for example &lt;a href=&quot;http://en.wikipedia.org/wiki/Rayleigh_distribution#Related_distributions&quot;&gt;wikipedia&lt;/a&gt;). In the code you provided, the real and imaginary components (generated by independent calls to &lt;code&gt;randn&lt;/code&gt;) generally meet this condition (or at least approximates it quite well for reasonable pseudo-random generator) and the magnitude of &lt;code&gt;h&lt;/code&gt; would thus have a Rayleigh distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, it is generally assumed that the signals' power is preserved on average, that is $E\{R^2\} = 1$. Now given how we defined $R$:&#xA;$$&#xA;\begin{align}&#xA;  E\{R^2\} &amp;amp;= E\{X^2+Y^2\} \\&#xA;           &amp;amp;= E\{X^2\}+E\{Y^2\} &amp;amp;\mbox{(linearity of expectation)} \\&#xA;           &amp;amp;= 2E\{X^2\} &amp;amp;\mbox{($X$ and $Y$ identically distributed)} \\&#xA;           &amp;amp;= 2\sigma^2 &amp;amp;\mbox{($X$ and $Y$ zero-mean Gaussian)}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the signal power is preserved on average when $\sigma = 1/\sqrt{2}$. This is also the scaling factor that must be used if starting with unit variance Gaussian pseudo-random variables (as is the case with MATLAB's &lt;code&gt;randn&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, given a complex-valued Gaussian noise $n$ defined as $n = n_{\scriptsize \mbox{real}} + i\cdot n_{\scriptsize \mbox{imag}}$, where both real and imaginary components are Gaussian distributed with variance $\sigma_n^2$, the noise power is&#xA;$E\{|n|^2\} = E\{n_{\scriptsize \mbox{real}}^2 + n_{\scriptsize \mbox{imag}}^2\}$. By a similar argument as above, it follows that $E\{|n|^2\} = 2\sigma_n^2$. To obtain noise with unitary power, we thus need $\sigma_n = 1/\sqrt{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the notion of unitary power only makes sense once a measurement unit has been established. Quite often the noise power is defined relative to the signal power. In that case, a noise power of 1 (or 0dB) in signal power's units would mean that the power of the noise is the same as that of the signal.&lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="8952" LastEditDate="2015-10-18T21:37:07.840" LastActivityDate="2015-10-18T21:37:07.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16387" PostTypeId="1" AcceptedAnswerId="16418" CreationDate="2014-05-21T02:11:05.667" Score="5" ViewCount="398" Body="&lt;p&gt;I've a circular array of eight FM antennas. I'm doing digital beamforming to form eight beams with the following beam patterns:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/aIVLZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The objective is to reduce my side lobes even further, and to get narrower main beam. What I'm interested in to know if it is possible to take two adjacent beams, and do another step of beamforming, i.e., considering them as if coming from two antenna array with the beam pattern shown in the figure. I don't know how to incorporate the beam pattern into the standard set of equations for beamforming, as I think an omni-directional antenna is assumed. Any directions, suggestions are welcome. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-05-22T15:05:39.057" Title="Is it possible to do further beamforming on already beamformed data?" Tags="|digital|beamforming|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16388" PostTypeId="1" AcceptedAnswerId="16389" CreationDate="2014-05-21T02:39:31.960" Score="0" ViewCount="728" Body="&lt;p&gt;Which filters response is maximally flat at origin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that both &lt;strong&gt;High Pass Filter&lt;/strong&gt; and &lt;strong&gt;Band Pass Filter&lt;/strong&gt; have maximum flat response at origin, although it is almost zero in case of &lt;strong&gt;Bandpass Filter&lt;/strong&gt;. Am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a question that I came across in my friends exam yesterday.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is given is that it is the &lt;strong&gt;Butterworth&lt;/strong&gt; Filter. Is it true and if so, how? Are both HP and BP filters wrong.&#xA;Please explain.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8966" LastEditorUserId="8202" LastEditDate="2014-05-21T07:36:47.517" LastActivityDate="2014-05-21T12:18:40.170" Title="Types of Filters" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16389" PostTypeId="2" ParentId="16388" CreationDate="2014-05-21T03:21:34.133" Score="3" Body="&lt;p&gt;The classification of filters into general High-pass, Band-pass, Low-pass filters categories essentially indicates which frequency range is predominantly unattenuated. It has little to do with the type of filters such as Butterworth, which are defined with specific transfer function and imply a specific shapes in the frequency domain and correspondingly specific characteristics (such as ripples, flatness, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Analog Butterworth filters are referred to as &quot;maximally flat&quot; because all the derivatives (up to the 2n&lt;sup&gt;th&lt;/sup&gt;) of the filter gain function as a function of frequency are 0 at $\omega=0$ (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter#Maximal_flatness&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;). Note that this definition is given in the context of a low-pass Butterworth filter.&lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="8952" LastEditDate="2014-05-21T12:18:40.170" LastActivityDate="2014-05-21T12:18:40.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16390" PostTypeId="2" ParentId="16388" CreationDate="2014-05-21T03:57:16.110" Score="1" Body="&lt;p&gt;let's begin with a normalized-frequency lowpass prototype, where we want $|H_N(0)|=1$ and $|H_N(j\omega)|&amp;lt;1$ for $|\omega|&amp;gt;0$ and where we want the gain to essentially decrease as $|\omega|$ increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for normalized frequency, the $N$th-order prototype Butterworth frequency response (magnitude-squared) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |H_N(j\omega)|^2 \ = \ \frac{1}{1+\omega^{2N}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you compute the derivatives &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{d |H_N(j\omega)|^2}{d \omega} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and evalutate it at $\omega=0$, you will see that all of these derivatives are zero up to the $2N$th derivative (the odd-order derivatives would be zero anyway).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is what makes it maximally flat at $\omega=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the lowpass (LPF), highpass (HPF), and bandpass (BPF), tuned to a specific frequency, $\omega_0$, this same normalized-frequency prototype (once $H_N(s)$ is figured out) is used with these mappings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_{LPF}(s) = H_N\left( \frac{s}{\omega_0} \right)  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_{HPF}(s) = H_N\left( \frac{\omega_0}{s} \right)  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_{BPF}(s) = H_N\left( Q \left( \frac{s}{\omega_0} + \frac{\omega_0}{s} \right) \right)  $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-05-21T03:57:16.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16392" PostTypeId="1" CreationDate="2014-05-21T04:21:15.507" Score="-1" ViewCount="729" Body="&lt;p&gt;sinusoid  x(t)=1+sin(2*pi *500) &#xA;sampling rate :1000 samples/s&#xA;Can I have 4 points DFT output with the above data.&lt;/p&gt;&#xA;" OwnerUserId="8969" LastActivityDate="2014-05-21T05:30:50.433" Title="how to sample sine wave to 4 points dft output" Tags="|dft|sampling|periodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16393" PostTypeId="2" ParentId="16392" CreationDate="2014-05-21T05:30:50.433" Score="0" Body="&lt;p&gt;$ x(t)=1+sin(2*pi *500)$ is a sinusoidal signal with frequency 500 Hz and the sampling rate is 1000 Hz. So you have 1000 samples/sec and 500 cycles/sec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have only 2 samples/cycle. So you can calculate 4 point DFT by taking only 4 values (consecutive) from the samples (Since it represent 2 cycles). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For distortionless DFT you should take atleast one full cycle. Here 2 point DFT also possible. As the number of samples increases the DFT graph become more smooth. &lt;/p&gt;&#xA;" OwnerUserId="8917" LastActivityDate="2014-05-21T05:30:50.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16394" PostTypeId="1" AcceptedAnswerId="16447" CreationDate="2014-05-21T05:47:00.647" Score="5" ViewCount="14940" Body="&lt;p&gt;I am trying to design a high pass filter to remove baseline drift from an ECG signal.&#xA;the baseline drift is of very low frequency like 0.3Hz or so with an amplitude of 25% of the ECG signal. But the bandwidth of ECG signal itself is 0.5Hz to 150Hz. I have been trying fdatoolbox in matlab to design the HPF but I was not able to remove the baseline drift accurately.Please help on how can i achieve a low order filter to eliminate baseline drift. &#xA;I have got it using higher order filters of order above 1000. But I'm looking for a way if I can get lower order filter,like order of less than 30, to do the same.Thanks for your help..&lt;/p&gt;&#xA;" OwnerUserId="8970" LastEditorUserId="8970" LastEditDate="2014-05-21T05:55:35.447" LastActivityDate="2022-10-03T21:04:05.663" Title="Removing baseline drift from ECG signal" Tags="|filters|noise|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16395" PostTypeId="2" ParentId="16233" CreationDate="2014-05-21T06:15:03.463" Score="0" Body="&lt;p&gt;In order to get the regions, you need to solve first a problem that is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Connected-component_labeling&quot; rel=&quot;nofollow&quot;&gt;connected component labeling&lt;/a&gt;.&#xA;There are classical algorithms to solve it.&#xA;They will give you another matrix where each connected region has a unique ID (or &lt;em&gt;label&lt;/em&gt;). Then, you'll be able to compute all the properties that you need.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-05-21T06:15:03.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16396" PostTypeId="2" ParentId="14680" CreationDate="2014-05-21T06:17:45.217" Score="1" Body="&lt;p&gt;It's mostly an &lt;strong&gt;historical heritage&lt;/strong&gt;.&#xA;What the authors mean is that none of the pictures were:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;computer generated&lt;/li&gt;&#xA;&lt;li&gt;shot in controlled conditions (e.g., photobooth, lab...)&lt;/li&gt;&#xA;&lt;li&gt;faked or set up in any way.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Today, the trending term for this is &lt;strong&gt;in the wild&lt;/strong&gt;.&#xA;This does not mean that the images will bite you, but that the images come from standard customer/everyday cameras instead.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-05-21T06:17:45.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16397" PostTypeId="2" ParentId="16233" CreationDate="2014-05-21T08:53:33.573" Score="0" Body="&lt;p&gt;In matlab you can use the &lt;a href=&quot;http://www.mathworks.co.uk/help/images/ref/regionprops.html#bqkf8hf&quot; rel=&quot;nofollow&quot;&gt;regionprops&lt;/a&gt; function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'BoundingBox' option will give you the x &amp;amp; y sizes of each region or you can use 'Area' to get the number of pixels in each region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'PixelList' option will give the (x, y) corrds of the pixels in region.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-21T08:53:33.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16400" PostTypeId="2" ParentId="16233" CreationDate="2014-05-21T09:10:57.703" Score="4" Body="&lt;p&gt;Lets take the given matrix as &#xA;$$A=\left[\begin{array}{cccccc}&amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\\&#xA;&amp;amp;0 &amp;amp;\color{red}{1} &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;&amp;amp;\color{red}{1} &amp;amp;\color{red}{1} &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;&amp;amp;\color{red}{1} &amp;amp;\color{red}{1} &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;&amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;&amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\color{blue}{1} &amp;amp;\color{blue}{1} &amp;amp;\color{blue}{1} \\&#xA;&amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\color{blue}{1} &amp;amp;\color{blue}{1} \\&#xA;&amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0\end{array}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use the MATLAB function &lt;code&gt;bwlabel&lt;/code&gt; to find the connected components in the matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cc=bwlabel(A);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when you run this in MATLAB you will get &lt;code&gt;cc&lt;/code&gt; as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ cc = \left[\begin{array}{cccccc} &#xA;	 &amp;amp;0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp; \\&#xA;     &amp;amp;0&amp;amp;      \color{red}{1}&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp; \\&#xA;     &amp;amp;\color{red}{1}&amp;amp;      \color{red}{1}&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp; \\&#xA;     &amp;amp;\color{red}{1}&amp;amp;      \color{red}{1}&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp; \\&#xA;     &amp;amp;0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp; \\&#xA;     &amp;amp;0&amp;amp;      0&amp;amp;      0&amp;amp;      \color{blue}{2}&amp;amp;      \color{blue}{2}&amp;amp;      \color{blue}{2}&amp;amp; \\&#xA;     &amp;amp;0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      \color{blue}{2}&amp;amp;      \color{blue}{2}&amp;amp; \\&#xA;     &amp;amp;0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp;      0&amp;amp; \end{array}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 indicate connected region 1, 2 indicates connected region 2, etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want 2D pixel locations use, &lt;strong&gt;&lt;em&gt;find&lt;/em&gt;&lt;/strong&gt; function in &lt;strong&gt;&lt;em&gt;cc&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[r c]=find(cc==1)&lt;/code&gt; gives the row (r) and column (c) locations of the 1st connected region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[r c]=find(cc==2)&lt;/code&gt; gives the row (r) and column (c) locations of the 2nd connected region, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can get what ever you want..&lt;/p&gt;&#xA;" OwnerUserId="8917" LastEditorUserId="8871" LastEditDate="2014-05-24T20:10:15.560" LastActivityDate="2014-05-24T20:10:15.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16401" PostTypeId="1" CreationDate="2014-05-21T10:16:22.777" Score="2" ViewCount="161" Body="&lt;p&gt;I was wondering if there was a simple approach to smooth images, e.g using a Gaussian Kernel without introducing boundary effects which are also present when using Discrete Fourier Transforms?&#xA;For both approaches, the missing pixels at the left-hand side will be taken from the right-hand side and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I have a 5x5 Gaussian Kernel which I move iteratively over my MxN image. Up to now, in case I reach the last pixel of the image, the operator automatically uses  the first pixel and so on. Since my picture is not periodic I get artifacts even if I pad my picture on all sides with the intensity values of the corresponding adjacent column or row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you gus have any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2014-06-21T03:44:20.357" Title="Non-cyclic smoothing of a 2D image" Tags="|image-processing|smoothing|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16402" PostTypeId="1" AcceptedAnswerId="16404" CreationDate="2014-05-21T10:44:00.470" Score="0" ViewCount="79" Body="&lt;p&gt;i'm working on image matching mainly SIFT and SURF for my thesis. i read Moravec's and harris corner detectors and understand them quiet well in my own opinion.&lt;a href=&quot;http://courses.daiict.ac.in/pluginfile.php/13002/mod_resource/content/0/References/harris1988.pdf&quot; rel=&quot;nofollow&quot;&gt;A COMBINED CORNER AND EDGE DETECTOR&lt;/a&gt;[1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I even understoond harris-lapace detector but had no luck with understanding it's descriptor.&lt;a href=&quot;http://www.cse.unr.edu/~bebis/CS773C/ObjectRecognition/Papers/Mikolajczyk04a.pdf&quot; rel=&quot;nofollow&quot;&gt;Indexing based on scale invariant interest points&lt;/a&gt;[2]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i understood SIFT and SURF too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what i didn't really understand is some of these topics : harris-laplace descriptor , how does hessian matrix help to detect good interest points , RANSAC(have general idea but need details for image matching) , Haar wavlet( also have a general idea, don't know how it's output look like and how i can work with that)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that's pretty much it.&#xA;i would really appreciate If anyone can help me with finding general reference for these topics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i have sent this question on stackoverflow. they suggest here would be better place to ask it and get proper answer) &lt;/p&gt;&#xA;" OwnerUserId="8956" LastActivityDate="2014-05-21T11:01:20.193" Title="need general resource about image matching" Tags="|computer-vision|local-features|sift|harris|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16403" PostTypeId="1" CreationDate="2014-05-21T10:55:42.927" Score="2" ViewCount="201" Body="&lt;p&gt;I am working in linear classification such as &lt;span class=&quot;math-container&quot;&gt;$$y=ax+b.$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x=[x_1...x_n]$&lt;/span&gt;. But the method has weakness that is overfitting problem. Could you suggest to me one method or one way to reduce overfitting problem in linear classification (don't consisder other method ex SVM).&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="80" LastEditDate="2023-07-01T16:31:18.513" LastActivityDate="2023-07-01T16:31:44.993" Title="How to Reduce the Overfitting of a Linear Classifier" Tags="|image-processing|algorithms|image-segmentation|machine-learning|classification|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16404" PostTypeId="2" ParentId="16402" CreationDate="2014-05-21T11:01:20.193" Score="1" Body="&lt;p&gt;Check out Szeliski's book:&#xA;&lt;a href=&quot;http://szeliski.org/Book/drafts/SzeliskiBook_20100903_draft.pdf&quot; rel=&quot;nofollow&quot;&gt;http://szeliski.org/Book/drafts/SzeliskiBook_20100903_draft.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also an old book on feature detection:&#xA;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0123965497&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Feature-Extraction-Processing-Computer-Edition/dp/0123965497&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read the sections that you care about. Also, I think it is always a good idea to read about scale space theory if you are to work with such algorithms. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.nada.kth.se/~tony/book.html&quot; rel=&quot;nofollow&quot;&gt;http://www.nada.kth.se/~tony/book.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-05-21T11:01:20.193" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16405" PostTypeId="2" ParentId="16401" CreationDate="2014-05-21T11:06:08.057" Score="1" Body="&lt;p&gt;Well, padding is mainly the only option. However, what you could do is to shrink the size of the Gaussian Kernel as you approach the boundary. With this adaptive way of adjusting your kernel, you will lose smoothness as you approach the borders, but this could give you what you need in terms of smoothing. At least it doesn't introduce non-meaningful boundary conditions. Of course the smallest kernel size you could get down to is 3 and so you will have 1 column/row of junk values (you could also solve this problem a little bit by padding). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would like to get crazier, I would advice the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Copy your image into a padded one and inpaint the outer boundaries. Do it with an exampler approach such as PatchMatch(&lt;a href=&quot;http://gfx.cs.princeton.edu/pubs/Barnes_2009_PAR/index.php&quot; rel=&quot;nofollow&quot;&gt;http://gfx.cs.princeton.edu/pubs/Barnes_2009_PAR/index.php&lt;/a&gt;). This way, you will be inpainting your image with reasonable values and then you could apply a standard Gaussian convolution.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-05-21T11:06:08.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16406" PostTypeId="2" ParentId="16330" CreationDate="2014-05-21T13:24:57.877" Score="1" Body="&lt;p&gt;The processing gain of the FFT refers to increased SNR for a sinusoid. You can think of the DFT or the FFT as a bank of matched filters. The matched filter maximizes the SNR at the output. Another way to look at the processing gain, if you have sinusoid in noise in the time domain at a given SNR and then take the FFT and look at the Sinsoid power vs the noise power in the FFT bin (assuming the frequency corresponds exactly with a FFT bin) then you will see a higher SNR or processing gain. You can think of the FFT as bandwidth filters and the noise in each frequency bin is spread out in comparison to the time-domain signal where the noise is through out the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The processing gain comes about because it coherently adds the components of the sinusoid together. So you will also see this called coherent gain. This coherent addition is also why when you have a longer signal you get more processing gain i.e. more samples add together coherently. By coherent I mean that it assumes you have knowledge of the phase of the signal - in this case the frequency.  Alternatively you can think of a longer matched filter as having a narrower bandwidth, so less noise gets through the filter. Thus giving you better SNR or processing gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if the sinusoid does not exactly align with a frequency of an FFT bin, then there will still be a peak at near by FFT bins, but then a few of the neighbouring FFT bins will also contain significant magnitudes. There will be a peak at the nearest FFT bin but it will be less than the processing gain. This effect is often callled spectral leakage. You can use windows to reduce the spectral leakage, but you decrease the processing gain as well. The worst case loss is when your signal sits exactly between two FFT bin frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest you read the Harris paper on windows. It explains a lot of the details I am talking about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you have a sinusoid in white noise you will get the processing gain by taking the DFT/FFT. By taking the IFFT/IDFT you will suffer a processing loss because you are spreading your signal back into the noise.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-05-21T13:24:57.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16407" PostTypeId="1" CreationDate="2014-05-21T14:04:05.317" Score="1" ViewCount="113" Body="&lt;p&gt;In the image, I connects to universe, but II and III not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to detect both II and III, also I if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible with current computer vision libraries? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cZyvv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8977" LastActivityDate="2014-05-21T16:09:18.583" Title="Detecting blobs that connects to any other blob, maybe with OpenCV" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16408" PostTypeId="2" ParentId="16407" CreationDate="2014-05-21T16:09:18.583" Score="-1" Body="&lt;p&gt;Flood fill  the background, then hough transform to pick out rough circles II and III&lt;/p&gt;&#xA;" OwnerUserId="8980" LastActivityDate="2014-05-21T16:09:18.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16409" PostTypeId="2" ParentId="1254" CreationDate="2014-05-21T19:13:27.123" Score="1" Body="&lt;p&gt;zlib has a compression mode (&quot;HUFFMAN_ONLY&quot;) that is fast and does not require a lot of memory.  For typical photos using zlib with libpng I get about 1:2 compression ratios.  You can try it out with ImageMagick, GraphicsMagick, or pngcrush.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;convert input.ppm -quality 1 output_im.png&#xA;gm convert input.ppm -quality 1 output_gm.png&#xA;pngcrush -force -m 12 input.png output_pc.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These examples all use the PNG &quot;sub&quot; filter (1) which is effective for photos.&#xA;For *Magick, &quot;-quality 1&quot; and for pngcrush, &quot;-m 12&quot; means to use the &quot;sub&quot; filter and &quot;huffman_only&quot; compression.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="8330" LastEditDate="2014-05-22T15:32:51.763" LastActivityDate="2014-05-22T15:32:51.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16410" PostTypeId="1" CreationDate="2014-05-21T19:48:39.763" Score="1" ViewCount="58" Body="&lt;p&gt;The equation to approximate an input signal with a unit impulse in Continuous Time, is shown below, before we take the limit $\hat{x}(t)=\frac{lim}{\Delta\rightarrow0}\sum^{\infty}_{-\infty}x(k\Delta)\delta_\Delta(t-k\Delta)\Delta$ &amp;lt;-- why is there a final $\Delta$ multiplying the $\delta_\Delta(t-k\Delta)$?&lt;/p&gt;&#xA;" OwnerUserId="8942" LastActivityDate="2014-05-22T02:09:38.260" Title="Why the delta at the end of the approximation?" Tags="|convolution|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16413" PostTypeId="2" ParentId="16384" CreationDate="2014-05-21T21:17:10.973" Score="1" Body="&lt;p&gt;Impulse Response is basically the FIR coefficients of the system.&lt;br&gt;&#xA;Namely, a system $ H $ with an impulse response given by $ f [n] $ and a Filter $ F $ with an FIR representation of $ {f[0], f[1], \cdots, f[n]} $ are equivalent.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, systems with Feedback are equivalent of both FIR and IIR (AR) filters.&lt;br&gt;&#xA;But given infinite length of FIR model any LTI system can be represented by FIR coefficients.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relation could be easily displayed by the Laplace Transform of the system.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-05-21T21:17:10.973" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16414" PostTypeId="1" CreationDate="2014-05-21T21:34:27.407" Score="1" ViewCount="990" Body="&lt;p&gt;PROBLEM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two real, causal time series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_k = a^k \quad \text{and} \quad g_k = b^k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a \neq b$, $|a| &amp;lt; 1$, and $|b| &amp;lt; 1$, are given for $k = 0,1,2,...$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the linear convolution $h_n$ of the time series $f_k$ and $g_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ATTEMPTED SOLUTION&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think perhaps my attempted solution here can be improved upon. We have from the definition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n = \sum_{k=0}^{n} f_k g_{n-k} = \sum_{k=0}^{n} a^k b^{n-k} = b^n \sum_{k=0}^{n} \left(\frac{a}{b} \right)^k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we let $R = \left(\frac{a}{b} \right)$, the last term can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n = b^n \cdot \frac{1 - R^{n+1}}{1 - R}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n = \frac{b^n - \frac{a^{n+1}}{b}}{1 - \frac{a}{b}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n = \frac{b^{n+1} - a^{n+1}}{b-a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see how I can improve upon this answer though, but since we are given certain conditions in the problem, I have a feeling that it is possible to get a more elegant solution.  I see that as $n \to \infty$, $h_n \to 0$, but is there any way I can &quot;improve&quot; on the answer for any $n$?&lt;/p&gt;&#xA;" OwnerUserId="4637" LastEditorUserId="4637" LastEditDate="2014-05-21T21:48:06.073" LastActivityDate="2014-05-22T01:45:03.893" Title="Finding linear convolution of two time series" Tags="|discrete-signals|convolution|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16418" PostTypeId="2" ParentId="16387" CreationDate="2014-05-22T01:26:22.597" Score="5" Body="&lt;p&gt;For now I will focus on the conceptual, pending feedback from you:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What I'm interested in to know if it is possible to take two adjacent&#xA;  beams, and do another step of beamforming,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer to this is yes, this is possible to do, and this is done in many beamforming applications. Think about it like this: All beamforming is really doing, is undoing the delays your signals exhibit (by virtue of different sensors at different locations), and summing the result. (Example: Delay-And-Sum beamformer). But in what &lt;em&gt;order&lt;/em&gt; you undo the delays, before summing doesn't matter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the beamformed result of a sub-group of sensors can be considered as one 'element', and the beamformed result of another sub-group of sensors, another 'element', and then both 'element's' outputs are beamformed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, first we remove the effects of the delays in one sub-array. Then we remove the effects of the delays in the other sub-array. At this point, both signal outputs might still have a delay relative to each other. So then again, both those inputs can be beamformed again. You can keep doing this ad infinitum. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The objective is to reduce my side lobes even further, and to get&#xA;  narrower main beam.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If this is the objective, then the only way to reduce your main lobe width is to sample the spatial field with more sensors. This is the direct analogue to time-domain sampling. If we want greater frequency resolution (smaller main lobe width in the DFT analysis), we need to process a greater number of samples in time. Similarly, if we would like a smaller main-lobe width of our spatial spectra, we need to sample the spatial field with more sensors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Taking from the above, if you want to decrease your mainlobe width, you need more spatial samples. However if you want to reduce your sidelobes, then you would use a variety of windowing/shading functons. (Each of those functions will give you a slight increase in mainlobe width, but that is the price to pay). I am not sure what shading you have used for the above plots, but that will be good to know.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2014-05-22T15:05:39.057" LastActivityDate="2014-05-22T15:05:39.057" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16419" PostTypeId="2" ParentId="16410" CreationDate="2014-05-22T01:38:08.683" Score="1" Body="&lt;p&gt;$\delta_\Delta(t-k\Delta)$ is a spike with value 1. $\Delta$ is the width. It is like you are approximating the area under $x(t)$ with a bunch of rectangles of height $x(k\Delta)$ and width $\Delta$. So area is width by height, hence the multiplication. $x(k\Delta)\delta_\Delta(t-k\Delta)$ is a just a way of writing the discrete set of values at $x(k\Delta)$.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-05-22T01:38:08.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16420" PostTypeId="2" ParentId="16414" CreationDate="2014-05-22T01:45:03.893" Score="-1" Body="&lt;p&gt;There is a small mistake in your solution. Here $f_k$ and $g_k$ are infinite duration signal, ie. $n \to \infty$. You made a mistake that you took  &lt;strong&gt;n&lt;/strong&gt; in $h_n$ and number of coefficients in $f_k$ or $g_k$ as same, but it is different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n = \sum_{k=0}^{\infty} f_k g_{n-k} = \sum_{k=0}^{\infty} a^k b^{n-k} = b^n \sum_{k=0}^{\infty} \left(\frac{a}{b} \right)^k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n = b^n \cdot \frac{1}{1 - \frac{a}{b}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n = \frac{b^{n+1}}{b-a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to finite the number of coefficients in $f_k$ and $g_k$, use other variables other than &lt;strong&gt;n&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;strong&gt;n&lt;/strong&gt; in the RHS of your equation will replace with the new variable.&lt;/p&gt;&#xA;" OwnerUserId="8917" LastActivityDate="2014-05-22T01:45:03.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16421" PostTypeId="2" ParentId="16410" CreationDate="2014-05-22T02:09:38.260" Score="2" Body="&lt;p&gt;Here the signal is in continuous time domain. We can approximate any signal with weighted integral of unit impulse. As the signal is in continuous time domain &lt;strong&gt;integration&lt;/strong&gt; is used instead of &lt;strong&gt;summation&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual equation is ,&#xA;$$x(t)=\int_{-\infty}^{\infty}{x(t_0)\delta(t-t_0)dt}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your equation ${lim}_{\Delta\rightarrow0}\sum^{\infty}_{-\infty}$ stands for integration so &lt;strong&gt;$\Delta$&lt;/strong&gt; is required at the end, which stands for &lt;strong&gt;dt&lt;/strong&gt; in integral.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope you clear that.&lt;/p&gt;&#xA;" OwnerUserId="8917" LastActivityDate="2014-05-22T02:09:38.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16422" PostTypeId="1" CreationDate="2014-05-22T02:42:52.743" Score="3" ViewCount="2700" Body="&lt;p&gt;I'm working on a modem system using a 16-QAM scheme. The transmitter runs an IFFT to modulate the signal, and has a 12-bit DAC. The receiver runs an FFT to demodulate the signal, and has a 12-bit ADC. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the general parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sample rate is 512,000 SPS &lt;/li&gt;&#xA;&lt;li&gt;FFT size is 64 samples&lt;/li&gt;&#xA;&lt;li&gt;4 bits per bin/frequency with a total of 10 bins/frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Frequencies are in the range 32KHz to 104KHz. Frequency spacing is 8KHz.&lt;/li&gt;&#xA;&lt;li&gt;The rectangular 16-QAM constellation diagram is similar to this: &lt;a href=&quot;http://en.wikipedia.org/wiki/File%3aQAM16_Demonstration.gif&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/File:QAM16_Demonstration.gif&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The IFFT on the transmitter produces two 64 element arrays, real and imaginary. The transmitter has a 12-bit DAC available to transmit the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having trouble understanding exactly how to transmit this output of the IFFT? I've read in theory that I need to combine the two arrays (imaginary and real parts) via sine and cosine, but am having trouble understanding how this concept practically gets done in terms of programming. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone outline briefly (maybe a snippet of code or something?) how I combine the two 64 element arrays of real and imaginary data to feed into the DAC to transmit the signal on the wire?&lt;/p&gt;&#xA;" OwnerUserId="5211" LastActivityDate="2018-07-23T07:39:16.873" Title="How to transmit the real+imaginary output of an IFFT over a transmission channel?" Tags="|fft|algorithms|modulation|demodulation|ifft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16423" PostTypeId="1" AcceptedAnswerId="16428" CreationDate="2014-05-22T03:01:06.853" Score="2" ViewCount="416" Body="&lt;p&gt;My situation is as follows: i am trying to generate a waveform the hard way, by constructing the samples one by one and then saving the result to a .wav file using Python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the frequency is constant, everything is fine: i use $y(t) = \sin(2 \pi \cdot f \cdot t)$.&#xA;However, if i change the frequency to be a function of time, things go wrong. If the function is a linear one of the form $f(t) = a + bt$, it still works. But if i choose, for example, $f(t) = 40 + 10 \sin(t)$, the max frequency increases over time, reaching a maximum higher than the expect 50Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read something about instantaneous frequency, namely, this: &lt;a href=&quot;https://dsp.stackexchange.com/questions/2051/why-does-a-wave-continuously-decreasing-in-frequency-start-increasing-its-freque&quot;&gt;Why does a wave continuously decreasing in frequency start increasing its frequency past the half of its length?&lt;/a&gt;. But doing the integral evaluation makes the sound even weirder. And the method i currently have works for linear function of time, so i figured there must be something else wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to generate chunks of sound in the frequency i need, at each time, and then glue them together. I calculated the period of the oscillation, so that a chunk has as many samples as necessary to make a whole period on that frequency, so that there are no &quot;jumps&quot; between different frequencies. But generates a cracking sound in the sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of the kind of a JavaScript implementation of the kind of sound i need: &lt;a href=&quot;http://jsfiddle.net/m7US6/4/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://jsfiddle.net/m7US6/4/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8986" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-05-22T09:33:03.903" Title="Time-varying waveform" Tags="|frequency|sound|signal-synthesis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16424" PostTypeId="1" CreationDate="2014-05-22T05:16:45.943" Score="5" ViewCount="13271" Body="&lt;p&gt;For an efficient and optimized digital FIR filter design, there are two methods available broadly, Equiripple filter design &amp;amp; Least Squares filter design.  A general method for designing  a filter is also Frequency Sampled FIR design but it is not an optimized design&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic knowledge I have is that Equiripple filter, as the name suggests, has equal ripples in passband &amp;amp; stopband, which means the signal distortion that happens at the edge of the passband due to presence of a large ripple is avoided in Equiripple design BUT, Equiripple design has a large transition band, thus limiting the total passband width.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, in a Least Squares design, the transition band width is smaller than for Equiripple design, hence the passband width is more, but the passband ripple are not equi-ripple &amp;amp; exhibit a spike at the passband edge due to Gibbs phenomenon, which causes signal distortion at the edge.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is can somebody present or quote the all the differences &amp;amp; advantages over other, in a technical language, for the Equiripple design vs Least squares design of digital low pass FIR filter.  &lt;/p&gt;&#xA;" OwnerUserId="4875" LastEditorUserId="4298" LastEditDate="2020-11-01T15:37:56.013" LastActivityDate="2020-11-01T15:37:56.013" Title="Difference Between Equiripple &amp; Least Squares Design for FIR Digital Filters" Tags="|filter-design|lowpass-filter|finite-impulse-response|least-squares|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16425" PostTypeId="2" ParentId="16422" CreationDate="2014-05-22T05:40:29.987" Score="2" Body="&lt;p&gt;If you want to transmit a complex signal, you need two independent channels: one for the real part of the signal and another for the imaginary part. This makes sense, as the complex plane is two-dimensional. The question is, how can those channels be realized? It depends on what equipment you have available.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have multiple wires/DACs that can be used to convey the signal, then you can just use baseband transmission. Route the real part of your signal to one DAC and the imaginary part to the other. These would then feed separate transmission lines to carry the signals to the receiver. This method isn't often used, though. Why use multiple wires when you can just...&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have a single wire/DAC that can be used to transmit the signal, then you can use &lt;a href=&quot;http://en.wikipedia.org/wiki/Carrier_signal&quot; rel=&quot;nofollow noreferrer&quot;&gt;carrier modulation&lt;/a&gt;. Basically, you would modulate the real and imaginary parts of the signal onto separate sinusoidal carriers (this is done by multiplication by the desired carrier), which are then observed at the receiver and reassembled into the composite complex signal that you started with.&lt;/p&gt;&#xA;&lt;p&gt;A common technique for modulating complex signals is called &lt;a href=&quot;http://en.wikipedia.org/wiki/In-phase_and_quadrature_components&quot; rel=&quot;nofollow noreferrer&quot;&gt;I/Q modulation&lt;/a&gt;. This scheme uses a pair of sinusoids at the same frequency that have a phase offset of 90 degrees. This particular phase offset results in carrier signals that are orthogonal to one another, which allows the receiver to (in a perfect world) losslessly recover the two modulated signals. In practice, there will always be some &amp;quot;crosstalk&amp;quot; between the I and Q channels (which you could think of as carrying the real and imaginary parts of your modulating signal, respectively).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In your question, you suggested that you have a single DAC, so I would go the carrier modulation route. You'll need to select a carrier frequency appropriate for your application, taking the following things into account:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The bandwidth of your modulating signal.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The propagation medium to the receiver. If this is a wire, then you can often get by with as low of a carrier frequency as your signal bandwidth will allow (barring any limitations imposed by the path to the receiver, such as transformer coupling or other details). Wireless links often have quite high carrier frequencies (in the tens, hundreds, or thousands of MHz), depending upon characteristics such as desired range, transmit power, licensing, propagation environment, etc.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hardware limitations in your transmitter/receiver. You need to generate the carrier-modulated signal somehow! If you don't have analog hardware to do that for you (i.e. you output a pair of baseband signals and an analog transmitter upconverts it to an I/Q carrier-modulated output), then you'll need to synthesize the carrier-modulated signal digitally. That may or may not be possible given your system's constraints on DAC sample rate, processing throughput, and so on.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;FYI, the design that you described for your system sounds a lot like &lt;a href=&quot;http://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing&quot; rel=&quot;nofollow noreferrer&quot;&gt;orthogonal frequency-division multiplexing (OFDM)&lt;/a&gt;, albeit with a lot of unused carriers. You might find some useful information if you study up on how those systems are usually implemented.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-05-22T05:40:29.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16426" PostTypeId="2" ParentId="16424" CreationDate="2014-05-22T05:46:12.570" Score="4" Body="&lt;p&gt;One main difference is the cost function used in the two design methods:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Equiripple filters seek to minimize the maximum error between the desired filter response and the designed approximation. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Least-squares filters seek to minimize the total squared error betwen the desired filter response and the designed approximation. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These different strategies lead to the different characteristics observed in the two methods' results, a number of which you noted in your question. &lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-05-22T05:46:12.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16427" PostTypeId="1" CreationDate="2014-05-22T06:46:07.020" Score="6" ViewCount="1775" Body="&lt;p&gt;I found the following comment &lt;a href=&quot;https://dsp.stackexchange.com/questions/10541/when-to-use-the-dtft-vs-the-dft-and-their-inverses-in-analysis&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The DTFT can be used when the samples are not equally spaced in time, the DFT cannot&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My initial thought was that this had to do with periodicity of the basis complex exponential in DFT, but then this issue is unrelated to the &lt;em&gt;uniformity&lt;/em&gt; of sampling itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct explanation here ?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-05-22T16:04:27.393" Title="Why can't DFT be used when samples are not equally spaced in time?" Tags="|fourier-transform|dft|sampling|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16428" PostTypeId="2" ParentId="16423" CreationDate="2014-05-22T09:33:03.903" Score="0" Body="&lt;p&gt;Consider the function $\sin(2\pi f t)$. When $2\pi f t$ goes from $0$ to $2\pi$ you get oscillation of the sine wave, $2\pi$ to $4\pi$, another, and so on. So every time the argument changes by $2\pi$ you get one oscillation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now lets &lt;a href=&quot;http://www.wolframalpha.com/input/?i=2%20*pi%20*%20%2810%2b10*sin%282%20pi%20t%29%29%20*%20t,%20t%20=%200%20to%2012&quot; rel=&quot;nofollow noreferrer&quot;&gt;plot&lt;/a&gt; $2\pi f(t) t$ where $f(t) = 10 + 10 \sin(2 \pi t)$. (I've modified it a bit to show the effect more):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vqZuO.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As $t$ increases, this value changes faster and faster, meaning $\sin(2\pi f(t) t)$ will have higher and higher frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way of thinking about it - the frequency is the &lt;em&gt;derivative&lt;/em&gt; of $f(t) t$. For the example this is $20 \pi (\sin(2 \pi t)+2 \pi \mathbf{t} \cos(2 \pi t)+1)$. Note the $t$ multiplier in there - $t$ increases thus the frequency increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you really want is &#xA;$\tfrac{d}{dt} f(t) t = 40 + 10 \sin(t)$ which gives $f(t) t = 40t - 10\cos(t) + c$ and for your example try $ \sin(2\pi(40t - 10 \cos(t)))$&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-05-22T09:33:03.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16431" PostTypeId="2" ParentId="16427" CreationDate="2014-05-22T10:05:04.360" Score="9" Body="&lt;p&gt;You can actually use the DFT on non-unformly sampled data. It is still an orthogonal bijective map and has no inherent mathematical issues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, interpreting the meaning of the resulting spectrum is much less intuitive than for evenly spaced data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that the basis functions are no longer eigenfunctions of the time translation operator but of an operator that shifts samples, i.e. each sample gets shifted by a possibly different time offset. This is not a very meaningful operation in general and the eigenvectors of it are also not terribly useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result the bins of the spectrum do not correspond to a single frequency, but rather a single rate of samples. It is possible to associate a single bin with a sinusoid of time-varying momentary frequency though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can still be useful, mostly if your sampling intervals are not random but intentionally spaced differently to follow some kind of underlying structure of your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in total, saying that you can't use a DFT on non uniformly sampled data is not accurate. You can, but you have to know exactly what you're doing and be careful with drawing conclusions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me add some remarks about the relationship between DFT and DTFT in this context. The commend of Dilip in the question you refer to has probably the following background. The discrete time Fourier transform can be written as the continuous time Fourier transform of a series Dirac delta distributions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathrm{DTFT}\{x[n]\} = \mathcal{F} \{ \sum_nx[n]\delta(t-t_n) \}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the $t_n$ are the sampling times associated with the sampled values $x[n]$. This relationship naturally generalises to a nonuniform sampling grid if you just assume that the $t_n$ are not given by $nT$ for a sampling period $T$. I'm not sure I would call the result of this a DTFT anymore, but it's mathematically valid to do. because the properties of the continuous time Fourier transform make sure that the result is well behaved and that the basis functions are still orthogonal and represent a single frequency. This only works if your time axis is all real numbers, because only then the complex exponential functions expanded into are guaranteed to be both complete and orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a finite time axis where the DFT would be applicable, this method does not work. You can theoretically define a map that has all the properties of the DFT on a uniform grid when applied to a non-uniform grid by resampling the data on a uniform grid, applying the ordinary DFT, and considering these two steps as one &quot;nonuniform DFT transform&quot;. In this case you will in general loose certain mathematical properties like unitary/orthogonality however.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-05-22T16:04:27.393" LastActivityDate="2014-05-22T16:04:27.393" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16432" PostTypeId="1" CreationDate="2014-05-22T10:26:19.550" Score="1" ViewCount="106" Body="&lt;p&gt;The title might be unclear, but the problem is this. I have a signal sampled 1500 times with a rate of 60/s, and a sensor array 512 units large. There is a lot of noise, echo and other frequencies being picked up, but I am interested in only one. First I do a spike removal, then a bandpassfilter (butterworth) around the frequency range I suspect the signal is hidden. I then do a PCA to find wich of the 512 sensors picks up any systematic variation. Then I search for the best fit sinuswave in each of the top sensors (say 5 out of 512). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So main question, how to determine which of the PCA's is the one picking up the true signal without me knowing excactly what the frequency of the signal is? Second question, does the above steps seem reasonable? I am no expert in this, but experiments seems to indicate that with high STN objects of measurements (say a pendulum) it is clearly visible which PCA fits best (amplitude, hz, residuals of fit), but with low STN (say heartbeat), it is not so clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for lengthy text. Thanks alot for any answers!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: Running spectral analysis (using different Methods) gives different results depending on wich PC i am analysing. Might there be a spectral Method that does multivariate samples?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit 2: So while waiting for answers I have chosen to filter out principle components based on the correlation coefficient from a sinus wave fit (r&gt;0.5) &lt;em&gt;and&lt;/em&gt; % of data explained (p&gt;0.15). So in other words, the signal i am looking for has to be present in at least 15 out of the 512 sensors (if I understand PCA correctly), and the best fit sinewave has to explain at least 25% of the variation. This works well with test setups in a noisy environment. &lt;em&gt;Question:&lt;/em&gt; Is my approach sensible? Should or shouldnt I forego FFT and spectral estimation? Besides visualization, does frequency estimation based on the FFT gain anything over a iterative sinewave fitting, given that I know the signal is sinusoidal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks alot&lt;/p&gt;&#xA;" OwnerUserId="8990" LastEditorUserId="8990" LastEditDate="2014-05-26T12:12:36.727" LastActivityDate="2014-07-25T13:59:59.723" Title="Finding the best principle component" Tags="|frequency|frequency-response|multi-channel|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16433" PostTypeId="1" AcceptedAnswerId="34136" CreationDate="2014-05-22T11:43:15.670" Score="2" ViewCount="892" Body="&lt;p&gt;In terms of signal analysis (especially frequency decomposition) would it be bad to use cyclic autocorrelation (AC) instead of acyclic/linear AC?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My use case:&lt;br&gt;&#xA;I'm trying to characterize events in a sensor stream by periodicity/frequency. At the moment, I'm using DFT spectrum (spectral density) and AC of sliding windows.&lt;br&gt;&#xA;On the one handside it's algorithmically way cheaper to calculate the cyclic AC via FFT than acyclic (pad with zeroes and do double length FFT).&#xA;However, the cyclic AC looks similar (though not equal) to the acyclic for the first N/2 lags and is self-symmetric - thus at most half the information of acyclic AC can be contained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My motivation:&lt;br&gt;&#xA;If the cyclic AC would be sufficient for detection, that would mean better performance compared to linear AC (in terms of memory usage and computation time). I then could also calculate AC inplace (better parallelization potential).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rephrased question:&lt;br&gt;&#xA;Is there any rule when cyclic AC should NOT be used?&lt;br&gt;&#xA;Or perhaps, are there known cases, when cyclic AC might actually be better than linear AC?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance :-)&lt;/p&gt;&#xA;" OwnerUserId="5517" LastActivityDate="2018-03-12T07:03:34.577" Title="Autocorrelation - cyclic vs acyclic" Tags="|fourier-transform|autocorrelation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16435" PostTypeId="1" CreationDate="2014-05-22T15:24:04.647" Score="4" ViewCount="105" Body="&lt;p&gt;I wonder if there is a method works as follows:&#xA;1) The algorithm is trained with some images of a particular object (I train my Image with 1000 banana images)&#xA;2) I use the training data to segment a test image (semantic segmentation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The critical point here is, the training images DO NOT contain labeling information (foreground - background). I expect the algorithm to learn the shape of the object with some common edge orientations or features etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I study over Graphical Models for Segmentation and the most similar method is &quot;OBJCUT&quot; proposed by the following paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://eprints.pascal-network.org/archive/00006963/01/kumar10.pdf&quot; rel=&quot;nofollow&quot;&gt;http://eprints.pascal-network.org/archive/00006963/01/kumar10.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, they train the system with shape exemplars (ground truth images contain segmentations done by humans).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My objects to segment are non-articulated objects.&lt;/p&gt;&#xA;" OwnerUserId="8993" LastActivityDate="2014-09-24T17:44:10.363" Title="Is there an OBJECT BASED Image Segmentation method, with pure non-segmented training images?" Tags="|image-processing|computer-vision|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16436" PostTypeId="1" CreationDate="2014-05-22T15:33:54.030" Score="0" ViewCount="989" Body="&lt;p&gt;Let say I have a time-varying signal which is a mixture of two signals with different dc offsets. If I apply the fft on that signal, I will only get the dc value (at f=0hz) with stronger energy. How can I obtain another dc value which has less energy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other methods that I can use to extract both dc values?&#xA;Please advice. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional info:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a mix signal and it contains 2 signals with different frequency; one is at 20hz and another one is at 40hz. Also these 2 signals have different dc offsets. I am interested to obtain the dc offsets for both signals so I use the signal processing toolbox in Matlab to perform the FFT analysis in order to find the dc values (at f=0hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However,I found out that only dc value (measured in power spectral density) at 20hz appears at the resulted FFT. How do I know that the appear dc value is belong to 20hz? I know it because I firstly measured the 20hz signal individually and obtain its dc offset and then do the same thing for 40hz signal (from here I know that the dc value for 40hz is smaller than 20hz). Only then, I measured both signals concurrently to obtain the mix signals.&lt;/p&gt;&#xA;" OwnerUserId="8994" LastEditorUserId="8994" LastEditDate="2014-05-22T16:50:05.867" LastActivityDate="2014-07-23T17:49:10.480" Title="I have a mix signals (2 signals with different dc offset). How to recover another dc value which has been buried by the stronger dc value?" Tags="|matlab|fft|discrete-signals|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16437" PostTypeId="1" AcceptedAnswerId="16453" CreationDate="2014-05-22T16:03:15.837" Score="7" ViewCount="582" Body="&lt;p&gt;I want to determine the power of the noise component of a time dependend signal x(t) (similar to picture below)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1LJnF.png&quot; alt=&quot;signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With constant sampling rate I use Parceval's Therorem and calculate the standard deviation with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sigma^2 = \frac{\text{abs}(\text{FFT}(x))^2}{N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where N is number of data points and fft matlab dft implementation. For the standard deviation according to white noise I remove the discrete frequencies of the spectrum and use above formula with the mean value of the remaining spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some signals there are quite a few NaN data points (~ 10%), so said method can not be applied anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a mathematically correct method to determine the power of the noise component of the signal? Interpolation does not seem to be a good solution, because this would lead to an underestimation of the noise.&lt;/p&gt;&#xA;" OwnerUserId="5089" LastEditorUserId="128" LastEditDate="2018-07-02T08:56:36.707" LastActivityDate="2018-07-02T08:56:36.707" Title="Determining Power of White Noise Component of an Incomplete Time Signal" Tags="|matlab|noise|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16438" PostTypeId="1" AcceptedAnswerId="16441" CreationDate="2014-05-22T16:59:11.540" Score="4" ViewCount="10356" Body="&lt;p&gt;I don't understand why FFT return different maximum amplitude as the signal length increase. I would except that with a large signal length according to the frequency, detected amplitude will be very accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DgHuR.png&quot; alt=&quot;Plot amplitude from FFT against signal length&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From where this periodic signal is coming ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the related python code I used to generate the plot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib qt&#xA;%load_ext autoreload&#xA;%autoreload 2&#xA;&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;def get_fft(x, dt):&#xA;    n = len(x)&#xA;    fft_output = np.fft.rfft(x)&#xA;    rfreqs = np.fft.rfftfreq(n, d=dt)&#xA;    fft_mag = [np.sqrt(i.real ** 2 + i.imag ** 2) / n for i in fft_output]&#xA;    return np.array(fft_mag), np.array(rfreqs)&#xA;&#xA;def build_signal(amp, freq, signal_len):&#xA;&#xA;    f = freq&#xA;    A = amp&#xA;    dt = 1&#xA;    t = signal_len&#xA;&#xA;    x = np.arange(0, t, dt)&#xA;    y = A * np.cos(2*np.pi*f*x)&#xA;&#xA;    fft_mag, rfreqs = get_fft(y, dt)&#xA;    return x, y, fft_mag, rfreqs, amp, freq, signal_len&#xA;&#xA;# Build sin wave from 1 to 5000 signal length with freq=1e-3Hz and amplitude=0.5&#xA;all_t = []&#xA;all_amp = []&#xA;for t in np.arange(1, 5000, 100):&#xA;    x, y, fft_mag, rfreqs, amp, freq, signal_len = build_signal(amp=0.5, freq=0.001, signal_len=t)&#xA;&#xA;    all_t.append(t)&#xA;    all_amp.append(fft_mag.max())&#xA;&#xA;# Plot amplitude from FFT against signal length&#xA;plt.figure()&#xA;plt.plot(all_t, all_amp, 'o-')&#xA;plt.xlabel(&quot;Signal length&quot;)&#xA;plt.ylabel(&quot;Amplitude from FFT (0.25 is excepted)&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As MackTuesday ask in comment, I plotted the signal and related FFT for signal length = 1000 and 1400.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9ogq4.png&quot; alt=&quot;signal length = 1000&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/R0N8B.png&quot; alt=&quot;signal length = 1400&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8996" LastEditorUserId="8202" LastEditDate="2022-08-22T19:20:16.477" LastActivityDate="2022-08-22T19:20:16.477" Title="Why FFT does not retrieve original amplitude when increasing signal length" Tags="|fft|python|amplitude|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16439" PostTypeId="2" ParentId="16188" CreationDate="2014-05-22T18:43:36.183" Score="5" Body="&lt;p&gt;In a pure AWGN channel there is no benefit from OFDM because the noise will affect the received signal in the same way regardless of whether sent as a higher bandwidth serial stream or lower rate parallel streams. Similarly, there isn't much benefit in a flat fading environment either because, by definition, each constituent stream of the OFDM signal will be affected by the same amplitude change and linear phase shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main benefit from OFDM comes with frequency selective fading. That is because the effects of frequency selective fading worsen as signal bandwidth increases. With OFDM, each parallel low rate signal experiences a flat fading channel instead a frequency selective channel at the full bandwidth - i.e. each individual channel can be represented by a single complex value instead a multi-tap filter. That means frequency selective equalization is easily addressed, which allows us to scale to much higher bandwidths - and everybody wants higher bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the question refers to BER only, so other OFDM related characteristics such as spectrum mask or resource allocation are left out.&lt;/p&gt;&#xA;" OwnerUserId="8997" LastActivityDate="2014-05-22T18:43:36.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16440" PostTypeId="2" ParentId="16438" CreationDate="2014-05-22T18:57:39.430" Score="0" Body="&lt;p&gt;The maximum magnitude has to be interpolated for any sinusoid that is not exactly periodic by an exact integer number of periods in the FFT length.  An interpolation is necessary because those frequencies are not at the center of any FFT result bins (integer multiples of Fs/N in frequency), but slightly between them, thus spreading out the peak energy among multiple result bins.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just plotting the maximum magnitude of the FFT result vector won't give you that interpolation between bins.  Thus you only see the magnitude of the nearest bin, which could be half a bin away from the real frequency peak, and thus with a smaller value than the sinusoid magnitude.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-22T18:57:39.430" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16441" PostTypeId="2" ParentId="16438" CreationDate="2014-05-22T19:07:28.540" Score="9" Body="&lt;p&gt;Your code is bit unclear, especially generation of your signal. Python allows for vectorized operations so it is good to use it. What's more, it is good to clearly specify the sampling frequency of your signal and use it then. Also please remember to normalize your FFT by length of your signal (in this particular case) and multiply by 2 (half of spectrum is removed so energy must be preserved).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phenomena you are facing is connected with fact that your frequency is not matching exactly frequency bin for it. Because of that energy is leaking into other frequency bins. This is due to fact that &lt;strong&gt;you don't have integer amount of cycles of your sinusoid&lt;/strong&gt;. Please search for spectral leakage. Easy way to check that is to use the equation for frequency spacing in frequency domain, that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta f=\dfrac{f_s}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $f_s $ is your sampling frequency. Then your frequency vector is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f=[0, \; \Delta f, \; 2\Delta f, \; ...  \;,(N-2)\Delta f, \;(N-1)\Delta f] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If frequency you are analysing matches exactly one in your frequency vector, then amplitude will be correctly estimated, otherwise - leakage. In order to minimize this effect, you might want to apply &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;noreferrer&quot;&gt;window&lt;/a&gt; to your signal. It will reduce amount of energy leaking to other bins and in slight way will improve estimation of original amplitude, although you won't be really able to retrieve it in 100%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is small modification of your code to help you visualize that. The red curve is ideal spectrum and blue one is for given number of frequency bins (strictly connected to your signal length).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;import time&#xA;&#xA;def get_fft(y, fs):&#xA;    &quot;&quot;&quot; Get the FFT of a given signal and corresponding frequency bins.&#xA;&#xA;    Parameters:&#xA;        y  - signal&#xA;        fs - sampling frequency&#xA;    Returns:&#xA;        (mag, freq) - tuple of spectrum magitude and corresponding frequencies&#xA;    &quot;&quot;&quot;&#xA;    n  = len(y)      # Get the signal length&#xA;    dt = 1/float(fs) # Get time resolution&#xA;&#xA;    fft_output = np.fft.rfft(y)     # Perform real fft&#xA;    rfreqs = np.fft.rfftfreq(n, dt) # Calculatel frequency bins&#xA;    fft_mag = np.abs(fft_output)    # Take only magnitude of spectrum&#xA;&#xA;    # Normalize the amplitude by number of bins and multiply by 2&#xA;    # because we removed second half of spectrum above the Nyqist frequency &#xA;    # and energy must be preserved&#xA;    fft_mag = fft_mag * 2 / n           &#xA;&#xA;    return np.array(fft_mag), np.array(rfreqs)&#xA;&#xA;def build_signal(A, f, N, fs):&#xA;    &quot;&quot;&quot; Generate cosinusoidal signal of a given frequency and amplitude.&#xA;&#xA;    Parameters:&#xA;        A   - amplitude of a signal&#xA;        f   - fundamental frequency&#xA;        N   - number of signal samples&#xA;        fs  - sampling frequency&#xA;    Returns:&#xA;        t   - time vector&#xA;        y   - generated signal    &#xA;    &quot;&quot;&quot;&#xA;&#xA;    dt = 1/float(fs)            # Get the time domain spacing&#xA;    T  = N*dt               # Upper time limit&#xA;    t  = np.arange(0, T, dt)    # Construct time vector&#xA;&#xA;    y = A * np.cos(2*np.pi*f*t) # Generate the signal&#xA;&#xA;    return t, y&#xA;&#xA;if __name__ == &quot;__main__&quot;:&#xA;&#xA;    # Define the parameters&#xA;    fs = 100   # Sampling frequency (must satisfy the Nyquist theorem)&#xA;    f  = 10    # Signal fundamental frequency&#xA;    A  = 0.5   # Signal amplitude&#xA;&#xA;    # Prepare figure for plotting&#xA;    plt.figure()&#xA;    plt.ion()&#xA;    plt.show(block=False)&#xA;&#xA;    f_off = 1                     # Frequency offset in Hz for zoom&#xA;&#xA;    # Precomute the spectrum without any leakage&#xA;    (t, y) = build_signal(A, f, 1000, fs)&#xA;    (MAG, FREQ) = get_fft(y, fs)&#xA;&#xA;    for N in np.arange(1000, 10010, 1):&#xA;&#xA;        # Clear and scale&#xA;        plt.clf()&#xA;&#xA;        # Generate the signal  &#xA;        (t, y) = build_signal(A, f, N, fs)&#xA;&#xA;        # Get the spectrum and frequencies&#xA;        (mag, freq) = get_fft(y, fs)&#xA;&#xA;        # Plot the reference spectrum&#xA;        plt.plot(FREQ, MAG, '-or')&#xA;        plt.hold('on')&#xA;        # Plot the spectrum for given number of bins&#xA;        plt.plot(freq, mag, '-o')&#xA;        plt.title('Frequency spectrum for %d bins' % N)&#xA;        plt.xlabel('Frequency')&#xA;        plt.ylabel('Amplitude')&#xA;        plt.grid('on')&#xA;        plt.hold('off')&#xA;        plt.legend(['Ideal spectrum', 'Spectrum for %d bins' % N])&#xA;        plt.xlim((f-f_off, f+f_off))&#xA;        plt.ylim((0, A))      &#xA;&#xA;        plt.draw()&#xA;        plt.pause(0.5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Two intermediate steps. Signal is 10 Hz sinusoid with an amplitude of 0.5, sampling frequency is 100 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exact match:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w2wgy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency component you are analysis falls between two frequency bins:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xEtq5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-05-22T21:34:33.163" LastActivityDate="2014-05-22T21:34:33.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16442" PostTypeId="1" CreationDate="2014-05-22T20:19:44.053" Score="0" ViewCount="446" Body="&lt;p&gt;I'm implementing navigation system for my robot. There are two ways to get data from it: odometry(encoders from motors) and camera. Both of information sources can give me estimate of robot's position. But camera has very big noise. I've found that it is useful to use Kalman filter. After some literature looking I have a questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How to use kalman filter with adding measurement noise $v(k)$?&#xA;$$x(k+1) = F(k)x(k-1)+B(k)u(k)+w(k)$$&#xA;$$   z(k) = H(k)x(k)+v(k)$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How to make &quot;coefficient of trust&quot; for camera measurements in Kalman gain very low (because     of very very high camera noise)? (Probably is it needed to make specific Q or R matrix?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any help. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8999" LastEditorUserId="80" LastEditDate="2015-02-05T16:16:49.920" LastActivityDate="2015-02-05T16:16:49.920" Title="Adding measuruments noises to kalman filter" Tags="|filters|computer-vision|noise|kalman-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16443" PostTypeId="1" AcceptedAnswerId="16478" CreationDate="2014-05-22T20:31:53.963" Score="5" ViewCount="945" Body="&lt;p&gt;I wonder to know what is the best way to handle not equally spaced in time signal when performing FFT ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it depends on the signal itself. I work with signal with about 1000 - 5000 samples and they can contain between 0 to 20% missing samples. And I am interested in both main frequencies AND amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I do a basic linear interpolation to &quot;fill&quot; missing samples. I heard somewhere that we could actually &quot;fill&quot; missing samples with NaN (I didn't try yet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think about these two options ? Advantages and disadvantages ?&lt;/p&gt;&#xA;" OwnerUserId="8996" LastActivityDate="2014-05-24T05:35:56.533" Title="How to deal with signal not equally spaced in time when performing FFT?" Tags="|fft|interpolation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16444" PostTypeId="1" AcceptedAnswerId="16967" CreationDate="2014-05-22T21:35:54.350" Score="0" ViewCount="201" Body="&lt;p&gt;In their paper &lt;a href=&quot;http://www.vis.uky.edu/~stewe/publications/nister_stewenius_cvpr2006.pdf&quot; rel=&quot;nofollow&quot;&gt;Scalable Recognition with a Vocabulary Tree&lt;/a&gt;, Nister and Stewenius mention that after an offline training stage, new images can be inserted&#xA;on-the-ﬂy into the database. However, at the end of the training stage the IDF is computed and normalized. My question is, how would you incrementally update such a database composed of inverted document frequencies? &lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2016-03-29T11:55:17.227" LastActivityDate="2016-03-29T11:55:17.227" Title="Incremental Online Update of Tf-IDF Indices for Image Retrieval" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16445" PostTypeId="1" CreationDate="2014-05-22T22:32:22.210" Score="0" ViewCount="375" Body="&lt;p&gt;Is there a 'Nyquist Criteria' for the minimum samples per chip that are needed for a correlator? I've heard 2, but will 1 work? What are the implications of having less than the minimum (in the context of radar and communications)?&lt;/p&gt;&#xA;" OwnerUserId="5843" LastActivityDate="2014-06-09T04:37:21.267" Title="Minimum Samples Per Chip?" Tags="|digital-communications|correlation|nyquist|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16446" PostTypeId="2" ParentId="16445" CreationDate="2014-05-23T00:30:03.077" Score="0" Body="&lt;p&gt;It is not a good idea to do 1 sample/chip because if you happen to have the samples at the chip transitions then demodulation will go poorly.  Also, if you have much carrier offset you will likely lose and/or alias part of the signal.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-05-23T00:30:03.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16447" PostTypeId="2" ParentId="16394" CreationDate="2014-05-23T00:30:09.383" Score="6" Body="&lt;p&gt;You usually use a &lt;em&gt;DC notch&lt;/em&gt; filter. This is a recursive filter that should kill a very narrow band of frequencies around DC. One possible implementation is a first order DC notch with transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1 - z^{-1}}{1 - \lambda z^{-1}},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\lambda$ is some number very close to 1, say 0.99. A to demonstrate this in MATLAB,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = [1 -1];&#xA;a = [1 -0.99];&#xA;freqz(b,a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kF9N2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the phase response around DC gets pretty non-linear. Such is the nature of these recursive filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closer you make $\lambda$ to 1, the narrower the notch gets and the more distorted your phase response becomes around DC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For ECG signals, this will usually do. Experiment with $\lambda$ values that will suit your needs. Sometimes, if you make the notch too narrow, you won't get all off the drift, so 0.99 is usually a good starting point.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-05-23T00:30:09.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16448" PostTypeId="1" CreationDate="2014-05-23T00:39:18.080" Score="0" ViewCount="9286" Body="&lt;p&gt;i understand that there are linear equalizers such as MMSE and ZF, however there are also non-linear equalizers such as MLD. i would like to know what is the difference between a non-linear equalizer and linear equalizer, and how one can be distinguished from the other?&lt;/p&gt;&#xA;" OwnerUserId="8300" LastActivityDate="2018-08-28T17:29:04.917" Title="non linear equalizer vs linear equalizer" Tags="|equalization|detection|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16449" PostTypeId="2" ParentId="16443" CreationDate="2014-05-23T01:32:12.407" Score="4" Body="&lt;p&gt;It sounds like you are dealing with 'missing' data. Usually in cases like this, you can perform a simple polynomial regression on your data first, and then FFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way, you will fill in the gaps of the missing data based on the model polynomial you pick. Once you do that, you can perform an FFT. I would try this method first, before considering anything more involved. If you put an image of your data as well with the missing samples, that would go a long way.&lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2014-05-23T01:52:58.353" LastActivityDate="2014-05-23T01:52:58.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16451" PostTypeId="2" ParentId="16436" CreationDate="2014-05-23T04:47:52.067" Score="3" Body="&lt;p&gt;In general, to be able to separate two signals, you need two different mixtures of there signals. It's very similar to solving a system of equations with two unknowns. You need two equations if you have two unknowns. If you simply have a signal which is a sum of two other signals, you cannot retrieve the individual components.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-05-23T04:47:52.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16452" PostTypeId="2" ParentId="2550" CreationDate="2014-05-23T05:47:18.313" Score="1" Body="&lt;p&gt;I think in 2D Haar, $\sqrt{2}$ is not required, if the transform is applied simultaneously in both directions. It'd be of the form of $\frac{a+b+c+d}{2}$, which requires only fixed point implementation with the Q point being chosen based on number of levels. I had used this to implement Haar in C for embedded systems, and it works without rounding/truncation errors.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;Note:&#xA;My rep's not 50, so posting as answer. If anyone can move it to the comments it'd be good.&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="7749" LastActivityDate="2014-05-23T05:47:18.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16453" PostTypeId="2" ParentId="16437" CreationDate="2014-05-23T05:55:44.640" Score="1" Body="&lt;p&gt;I assume you have information about the signal itself (Not the noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is use LS to estimate the signal (Easily compensate for the missing samples in the Model Matrix).&lt;br&gt;&#xA;Once you have it estimated you can do 2 things (Which are the same):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Recreate the samples using the model. Subtract the measurements. You'd be left with IID Samples of the noise -&gt; Use the empirical STD / Variance estimator.&lt;/li&gt;&#xA;&lt;li&gt;If it is Linear Least Squares use its internal estimation of the noise Variance.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Good Luck!&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-05-23T05:55:44.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16454" PostTypeId="1" AcceptedAnswerId="16458" CreationDate="2014-05-23T08:47:48.470" Score="1" ViewCount="7370" Body="&lt;p&gt;I want to calculate averaged power of a time-domain signal by means of its spectrum. I guess Parseval is the right tool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I sample a sinus of 100 Hz 10000x within one second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the sum of the squared samples euqals not the sum of the FFT amplitudes (weighted by the number of FFT bins). Where is the mistake?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Some python code&#xA;&#xA;import numpy&#xA;import matplotlib.pyplot as plt&#xA;&#xA;# Create Time Domain Signal for 1 sec&#xA;fs = n = 10000    # Samplingfrequency&#xA;ti = numpy.linspace(0,1,num=fs)&#xA;sx = 1*numpy.sin(2*numpy.pi*100*ti)    &#xA;&#xA;# Calculate spectrum via FFT and account for scaling n/2&#xA;# taking the real fft (rfft) only the positive frequencies are calculated&#xA;fx = numpy.fft.rfft(sx)/(n/2)&#xA;no_of_points = fx.shape[0]&#xA;&#xA;# Calculate RMS for time domains signal + spectrum&#xA;parseval_sx = numpy.sum(sx**2)&#xA;parseval_fx = numpy.sum(numpy.abs(fx)**2)/no_of_points&#xA;&#xA;print parseval_sx, &quot; equals not &quot;, parseval_fx&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;4999.5  equals not  0.000199940012002&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8940" LastActivityDate="2014-05-23T14:32:24.540" Title="Parseval's theorem - Average Power" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16455" PostTypeId="2" ParentId="16424" CreationDate="2014-05-23T08:52:06.647" Score="7" Body="&lt;p&gt;While I completely agree with Jason R's answer, I would like to add a few things that I consider important. First of all, it is a misunderstanding to believe that for least squares designs the transition band width is smaller than for equi-ripple designs. The width of the transition band depends on many design parameters but it is independent of the optimality criterion. With both criteria you can define arbitrary transition bands (&quot;don't care regions&quot;) where you simply do not specify a desired response. This has to be done explicitly for the Parks-McClellan algorithm, but it can (and should) also be done for least squares designs. The most basic least squares design which is to simply truncate the Fourier series of a (often discontinuous) desired frequency response, is definitely no benchmark for comparing least squares designs with other optimality criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second important thing to notice is that the least-squares design and the equi-ripple design are two extreme points on a trade-off curve between maximum error and error energy. While the least squares design minimizes the error energy, its maximum error is relatively large, and the opposite holds for the equi-ripple design. So it is desirable - and possible - to mix the two criteria. One way of doing this is to use a constrained least squares criterion which minimizes the error energy while constraining the maximum error to some desired limit. In many cases it is desirable to have an equi-ripple design in the passband of a filter and to minimize the (weighted) least squares error in the stopbands, because then the maximum distortion of the signal is minimized, while the noise power in the stopbands is also minimized. The following example shows such a design. It is a linear-phase FIR bandpass filter of order 100, with a constraint on the maximum error in the passband (in this case resulting in an equi-ripple design in the passband), and with minimal error energy in the stopbands. The top figure shows the magnitude of the frequency response in dB, and the bottom figure shows the magnitude of the frequency response in the passband. Clearly, we have an equi-ripple approximation in the passband, and a least squares approximation in the stopbands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GVNbD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-23T08:52:06.647" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16456" PostTypeId="2" ParentId="1708" CreationDate="2014-05-23T09:00:15.793" Score="2" Body="&lt;p&gt;I just want to mention one limitation of Canny detector, which hinders its application, and that is parameter setting. I think parameter setting is not only a problem for Canny detector but also a problem for other edge detection methods. &lt;/p&gt;&#xA;" OwnerUserId="1674" LastActivityDate="2014-05-23T09:00:15.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16457" PostTypeId="1" AcceptedAnswerId="16466" CreationDate="2014-05-23T09:23:47.340" Score="1" ViewCount="189" Body="&lt;p&gt;I need help solving the following blurring function question.Assume an image $f(x,y)$ is moving in front of a camera so that $_0()$ and $_0()$ are the time-varying components of motion in the x- and y- directions respectively. The camera’s shutter opens at  = 0 and closes at  = . Assume that the shutter opening and closing operations are instantaneous. The blurred image (, ) captured by the camera is calculated as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; g(x,y) = \int_{0}^{T} f( x - x_0(t), y - y_0(t)) dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the blurring transfer function $H(u,v) = G(u,v) / F(u, v)$ in  frequency domain with respect to $_0()$ and $_0()$, where $(,)$ and $(,)$ are the Fourier transforms of $(,)$ and $(,)$ respectively and then calculate the blurring transfer function for the case where the image $(, )$ moves in only x- direction with a constant speed $\frac{a}{T}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt&lt;/strong&gt;: I really have no idea how to set up this blurring function.It is clear that the speed, $v$, is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; v = x_0(t)i + y_0(t)j&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and also that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; \mathcal F \{ f(x - x_0, y - y_0) \} = \text{exp}( (-2\pi i (x_0u + y_0v) ) )F(u,v)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G(u,v) = \mathcal F \{ g(x,y) \} = \mathcal F \left\{\int_{0}^{T} f( x - x_0(t), y - y_0(t))\right\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I don't know how to proceed from there.Any help appreciated&lt;/p&gt;&#xA;" OwnerUserId="4376" LastActivityDate="2014-06-22T13:12:28.380" Title="Blurring transfer function of image" Tags="|image-processing|filtering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16458" PostTypeId="2" ParentId="16454" CreationDate="2014-05-23T09:31:42.197" Score="1" Body="&lt;p&gt;There are several things going on. First of all, the real FFT function (&lt;code&gt;rfft&lt;/code&gt;) returns data in a &quot;&lt;a href=&quot;http://www.qft.iqfr.csic.es/docs/intel/mkl/mkl_manual/fft/fft_PackedFormats.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;packed&lt;/a&gt;&quot; format, which means that you don't get the actual FFT data, but its shortened convenient representation. Use the regunal &lt;code&gt;fft&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, I don't know where you got the number by which you scale your results on these two lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fx = numpy.fft.rfft(sx)/(n/2)&#xA;parseval_fx = numpy.sum(numpy.abs(fx)**2)/no_of_points&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;None of those make sense to me. So let's fix that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to take an &lt;a href=&quot;https://math.stackexchange.com/questions/370089/confused-as-to-how-to-prove-the-basis-of-dft-is-orthonormal&quot;&gt;orthonormal&lt;/a&gt; FFT transform (no scaling of components), we need to scale by the square root of the number of points. So here's what I propose:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Some python code&#xA;&#xA;import numpy&#xA;import math&#xA;&#xA;# Create Time Domain Signal for 1 sec&#xA;fs = n = 10000    # Samplingfrequency&#xA;ti = numpy.linspace(0,1,num=fs)&#xA;sx = 1*numpy.sin(2*numpy.pi*100*ti)    &#xA;&#xA;# Calculate spectrum via FFT and account for scaling 1/sqrt(N)&#xA;# taking the real fft (rfft) only the positive frequencies are calculated&#xA;fx = numpy.fft.fft(sx)/(math.sqrt(len(sx)))&#xA;&#xA;# Calculate RMS for time domains signal + spectrum&#xA;parseval_sx = numpy.sum(sx**2)&#xA;parseval_fx = numpy.sum(numpy.abs(fx)**2)&#xA;&#xA;print parseval_sx, &quot; equals &quot;, parseval_fx&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2014-05-23T09:31:42.197" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="16462" PostTypeId="1" AcceptedAnswerId="16468" CreationDate="2014-05-23T12:08:39.753" Score="4" ViewCount="1013" Body="&lt;p&gt;Hello everyone i want to do dynamic texture video sementation using the Fourier transform in MATLAB. I am applying 3-D fft on dynamic texture video frames (using matlab function 'fftn') and reconstructing video frames back from the phase spectrum only (using matlab function 'ifftn').&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I have found moving part pixel intensity values becomes dominant&#xA;(means its intensity values are increased so much) compared to&#xA;stationary part intensities in reconstructed frames of original&#xA;frames .(e.g.in waterfall and traffic on road, water part and moving&#xA;car's intensity values are increased respectively compared to the stationary background). how does this&#xA;happen?&lt;/li&gt;&#xA;&lt;li&gt;Also What is the relation between time shift and phase change if we take Fourier transform of video frames?&lt;/li&gt;&#xA;&lt;li&gt;I want know that what changes will occur in magnitude and phase spectrum amongst the frames and can we derive any relation amongst the interframe magnitude or phase spectrum changes?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2014-05-23T18:48:42.907" LastActivityDate="2014-05-23T18:48:42.907" Title="How moving part pixel intensity values of video frames becomes dominant compared to stationary part intensities in reconstructed frames?" Tags="|image-processing|discrete-signals|fourier-transform|signal-analysis|math|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16463" PostTypeId="1" AcceptedAnswerId="16464" CreationDate="2014-05-23T12:16:50.193" Score="2" ViewCount="924" Body="&lt;p&gt;I'm looking for some advice on where and what to start reading for learning to solve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've the time series of the position coordinates (x,y) of an animal in an open field (just a cage). I want to detect the time instants when the animal stops or starts &quot;walking&quot; (i.e.: moving from one place to another, not in the same place).&#xA;I  thought it couldnt be so difficult, but I'm finding some trouble solving it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm looking for the times from which the signal will be flat, or the instant where the signal starts changing from flatness:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zFria.jpg&quot; alt=&quot;signal&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Fcd7d.jpg&quot; alt=&quot;detail&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gB2Ri.png&quot; alt=&quot;what I want to detect&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RZSld.png&quot; alt=&quot;what I want to detect&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this thing may be related with step detection but I'm not sure.&#xA;I would start with just one coordinate for simplicity. Is seems that step detection could be what im looking for, but:&#xA;a. my signal &quot;baseline&quot; will be different every time. the animal will move and stop somewhere else, and so. &#xA;b. the signal can be VERY &quot;noisy&quot; since the animal could and will move a lot while staying in the same place (ie: grooming)&#xA;c. this changes can be whether slow or fast, and I need both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, i ll be glad if i can solve this problem for just one coordinate, although I will have to look for this changes in the two coordinate system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, my questions are:&#xA;1. is step detection a good aproach to this problem? what else if not?&#xA;2. any suggestion in doing this for both (x,y) coordinates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I get (x,y) coordinates by acquiring an overhead image with a camera and tracking a led attached to the animal's head. Tracking is done by color filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT2: copy of the data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/oph33szu891rgrl/data_sample.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/oph33szu891rgrl/data_sample.txt&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/idulfdr965eeh7i/data_sample.mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/idulfdr965eeh7i/data_sample.mat&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;data format is (x,y,t)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT3:&#xA;I've been trying smoothing the data but it is not really what I expected. I need to clean not high frequencies but low amplitudes. The movements I look for can be either fast or slow, but with big amplitude.&#xA;here, an example of signal with matlab function smooth()&#xA;note that I'm looking for the green moments, which I lose when smoothing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oq8AY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="9008" LastEditorUserId="9008" LastEditDate="2014-05-25T21:15:06.617" LastActivityDate="2014-05-25T21:15:06.617" Title="Is step detection the correct approach to this problem? what if not?" Tags="|signal-analysis|signal-detection|moving-average|position|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16464" PostTypeId="2" ParentId="16463" CreationDate="2014-05-23T12:35:54.387" Score="1" Body="&lt;p&gt;First off, I would start by applying a smoothing/averaging filter to your position data. This will get rid of a lot of the noise from your stationary motion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your first question, step detection is the way to go, but it depends on how you're detecting the steps. The best way in my mind would be to look at the derivative, the speed, and detect periods of non-zero speed. If you've smoothed out your position data, this should result in periods of time where the animal is moving in one direction, rather than back and forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach makes two dimensional analysis fairly simple. Once you've calculated your x and y speeds, you can combine them to get an absolute speed, independent of direction. You can use the same detection approach to find the periods of motion, which should give you the answer you're looking for.&lt;/p&gt;&#xA;" OwnerUserId="4439" LastActivityDate="2014-05-23T12:35:54.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16465" PostTypeId="1" CreationDate="2014-05-23T12:39:57.090" Score="0" ViewCount="1362" Body="&lt;p&gt;I have to process building floor plan images to extract walls from the structure. It is trivial in case of binary images; but the images in our case are colored, and have different colored walls. This restricts us from using any thresholding operation as we cannot assume the walls will always be the darkest. How can I come up with an algorithm that can work  on all sorts of images?&lt;/p&gt;&#xA;" OwnerUserId="7914" LastEditorUserId="10650" LastEditDate="2021-08-16T07:38:05.623" LastActivityDate="2022-05-13T09:01:50.200" Title="What are the various techniques for detecting walls in buildings (architectural) in floor plan images?" Tags="|image-processing|computer-vision|image-segmentation|thresholding|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16466" PostTypeId="2" ParentId="16457" CreationDate="2014-05-23T12:47:40.017" Score="1" Body="&lt;p&gt;Your start looks right, although I think your speed equation is wrong. To continue, the FT has no time dependance so you can take the integral out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(u, v) = \int_0^T \mathcal F\{f(x-x_0, y-y_0)\} dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = F(u,v) \int_0^T e^{-2\pi i(x_0u + y_0v)} dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Divide by $F$ to get the transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand the question correctly $x_0(t)$ and $y_0(t)$ are positions such that $x_0(t) = x_0(0) + v_x(t)t$ and similar for $y$. You can then put in an appropriate version of the speed given and do the integration.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-23T12:47:40.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16468" PostTypeId="2" ParentId="16462" CreationDate="2014-05-23T12:59:31.933" Score="4" Body="&lt;p&gt;Q1. As shown by &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1456290&quot; rel=&quot;nofollow&quot;&gt;Oppenheim's experiment&lt;/a&gt;, the phase spectrum contains most of the structural information about the image. In 2D this are things like lines and edges. In 3D it is things like lines and edges but also movement. Instead of 2D frames and time, imagine the video as a 3D solid where the z-axis is the frame number. If you took a slice along the z-axis (3rd dimension), movement appears like an edge in the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you reconstruct using just the phase spectrum, you give all the component sinusoids the same magnitude. This basically normalises the brightness everywhere in the image. Try it in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = double(imread('YOURIMAGE.TIF'));&#xA;f = fft(I);&#xA;f = f./abs(f);&#xA;I = real(ifft(f));&#xA;imagesc(I);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In a 3D image, such as a video, this normalisation is also in the time axis. Hence some smaller amplitude moving parts becoming greater in amplitude (and the opposite for high amplitude parts).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2. One video frame in your case is the same as 1 pixel in the x or y directions. The phase change depends on the movement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q3. Again that depends on the movement. Slow movement will fall into the lower frequency of the spectrum, high movement into the higher frequency. The spectrum is a global response though. It can only tell you about the entire signal. If you want to do analysis locally (i.e. restricted in location and time) you have to use quadrature filters if you want phase information.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-05-23T12:59:31.933" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16469" PostTypeId="2" ParentId="16454" CreationDate="2014-05-23T14:05:46.643" Score="3" Body="&lt;p&gt;It's possible to calculate average power (proportional to RMS amplitude) with the &lt;code&gt;rfft&lt;/code&gt;, but it's more complicated because the DC and Nyquist bins are not doubled in the full fft (and the Nyquist bin doesn't exist if &lt;em&gt;n&lt;/em&gt; is odd).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NumPy's &lt;code&gt;rfft&lt;/code&gt; is preferred over SciPy's, because it outputs complex numbers, which are compatible with N-dimensional arrays, rather than SciPy's &quot;packed&quot; format.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def rms_rfft(spectrum, n=None):&#xA;    &quot;&quot;&quot;&#xA;    Use Parseval's theorem to find the RMS value of an even-length signal&#xA;    from its rfft, without wasting time doing an inverse real FFT.&#xA;&#xA;    spectrum is produced as spectrum = numpy.fft.rfft(signal)&#xA;&#xA;    For a signal x with an even number of samples, these should produce the&#xA;    same result, to within numerical accuracy:&#xA;&#xA;    rms_flat(x) ~= rms_rfft(rfft(x))&#xA;&#xA;    If len(x) is odd, n must be included, or the result will only be&#xA;    approximate, due to the ambiguity of rfft for odd lengths.&#xA;    &quot;&quot;&quot;&#xA;    if n is None:&#xA;        n = (len(spectrum) - 1) * 2&#xA;    sq = real(spectrum * conj(spectrum))&#xA;    if n % 2:  # odd&#xA;        mean = (sq[0] + 2*sum(sq[1:])           )/n&#xA;    else:&#xA;        mean = (sq[0] + 2*sum(sq[1:-1]) + sq[-1])/n&#xA;    root = sqrt(mean)&#xA;    return root/sqrt(n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More details here: &lt;a href=&quot;https://gist.github.com/endolith/1257010&quot; rel=&quot;nofollow&quot;&gt;https://gist.github.com/endolith/1257010&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2014-05-23T14:32:24.540" LastActivityDate="2014-05-23T14:32:24.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16470" PostTypeId="1" CreationDate="2014-05-23T14:38:39.447" Score="1" ViewCount="3011" Body="&lt;p&gt;This might be a silly question, but I'm pretty rusty on my signals. The problem is the following:&#xA;I'm using a program which does not have a random signal generator, but I can sum up sines; and I need to have a &quot;white noise&quot; signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a good way to &quot;approximate&quot; a white noise signal with sines?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I'll need an infinite amount of sines... but understand that I can't do that, I'm limited to the program limitations. So my specific questions are the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Should the frequencies of the sine waves be below or(and?) above the Nyquist frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Say I've chosen I want &quot;white noise&quot; in frequencies 10Hz-100Hz, and I can only use 10 sines. Should I equally space the frequencies inside this range? Or choose them at random?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Now that I have my frequencies, what magnitudes should I assign these sines if I want to have a specific &quot;Gaussian&quot; distribution of my &quot;white noise&quot; signal values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this question doesn't cringe upon anybody that likes &quot;pure&quot; white noise!&lt;/p&gt;&#xA;" OwnerUserId="5237" LastEditorUserId="5237" LastEditDate="2014-05-23T19:15:41.597" LastActivityDate="2015-06-14T08:28:14.220" Title="A [Very] Rough Approximation to &quot;White Noise&quot; with Sine Waves" Tags="|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16471" PostTypeId="2" ParentId="16470" CreationDate="2014-05-23T14:57:06.227" Score="1" Body="&lt;p&gt;Phase and amplitude of this sinusoids should be random, so you need Gaussian random number generator. If you don't have the random number  generator then might want to think about implementing one, here is, I believe, the most popular algorithm: &lt;a href=&quot;http://en.wikipedia.org/wiki/Box_Muller_transform&quot; rel=&quot;nofollow&quot;&gt;Box-Muller transform&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your application and device, you might also want to use other noise source (i.e. Online generators, highly amplified signal from a probe).&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-23T14:57:06.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16472" PostTypeId="2" ParentId="16470" CreationDate="2014-05-23T14:57:34.077" Score="1" Body="&lt;p&gt;1) Below. Anything above will be aliased below anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Equally spaced. White noise has constant power spectral density and I imagine this would be a better approximation than random.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) From Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;under most types of discrete Fourier transform, such as FFT and Hartley, the transform W of w will be a Gaussian white noise vector, too; that is, its n Fourier coefficients will be independent Gaussian variables with zero mean and the same variance $\sigma^2$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Based on that I'd recommend random distribution of magnitudes. I'd use a complex number with real and imaginary parts as separate random variables, then use absolute value of the complex number as the magnitude of the sinusoid and the argument as the phase.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Disclaimer: not really my area of expertise, so a better answer may be out there.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="8202" LastEditDate="2015-06-14T08:28:14.220" LastActivityDate="2015-06-14T08:28:14.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16473" PostTypeId="1" CreationDate="2014-05-23T15:29:05.337" Score="1" ViewCount="60" Body="&lt;p&gt;It is possible to do IQ demodulation by using a zero crossing detector and a timer to take 4 samples of a sine wave if a reference signal is present. When there is no phase difference between the signals the 4 samples are taken at exactly 0, 90, 180 and 270 degrees by using the timer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this subset of lock-in/synchronous dectection have a special name? How can I best search for articles and information that has to do with this technique?&lt;/p&gt;&#xA;" OwnerUserId="4290" LastActivityDate="2014-05-23T15:29:05.337" Title="Does this technique have a name?" Tags="|demodulation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16475" PostTypeId="2" ParentId="16432" CreationDate="2014-05-23T19:12:39.633" Score="0" Body="&lt;p&gt;Most likely you should use the first principal component, i.e. the one with the largest eigenvalue.&lt;/p&gt;&#xA;" OwnerUserId="8920" LastActivityDate="2014-05-23T19:12:39.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16477" PostTypeId="1" AcceptedAnswerId="16480" CreationDate="2014-05-24T00:48:20.157" Score="1" ViewCount="349" Body="&lt;p&gt;From the definition I know:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\sum_{n=-\infty}^{+\infty}x[n] \cdot z^{-n}| &amp;lt; \infty\space\space\space(1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any sequence of x[n] which &lt;strong&gt;can not&lt;/strong&gt; be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = y[n] \cdot u[an-b]\space,\space\space\space a,b \in \mathbb{Z}$$&#xA;(where the dot means a multiplication and $u[k]$ means the discrete step function. In other words, x[n] is an infinity sequence)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but &lt;strong&gt;do satisfy&lt;/strong&gt; the definition in (1)?&lt;/p&gt;&#xA;" OwnerUserId="7389" LastEditorUserId="6" LastEditDate="2014-05-24T01:28:41.973" LastActivityDate="2014-05-24T13:52:26.453" Title="Z transform convergence" Tags="|z-transform|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16478" PostTypeId="2" ParentId="16443" CreationDate="2014-05-24T05:35:56.533" Score="2" Body="&lt;p&gt;There are libraries for nonequispaced/nonuniform fast Fourier transform. &lt;a href=&quot;http://www-user.tu-chemnitz.de/~potts/nfft/download.php&quot; rel=&quot;nofollow&quot;&gt;NFFT&lt;/a&gt; interpolates irregular data onto a regular grid followed by a standard FFT algorithm.&lt;/p&gt;&#xA;" OwnerUserId="9010" LastActivityDate="2014-05-24T05:35:56.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16479" PostTypeId="2" ParentId="16477" CreationDate="2014-05-24T07:36:31.870" Score="1" Body="&lt;p&gt;Nop. For an infinite sequence, the convergence of Z transform depends on the value of $z$ also. So as far as $n\rightarrow\pm\infty$, equation (1) will not be satisfied for all values of $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a simple case, $x(n) = u(n)$&#xA;$$X(z) = \sum_{n=0}^{\infty}z^{-n}$$&#xA;$$X(z) = 1 + z^{-1}+z^{-2}+z^{-3}+ \cdots$$&#xA;for $z=0.5$,&#xA;$$X(z) = 1 + 2+4+8+ \cdots = \infty$$&#xA;for this sequence to converge, $|z|&amp;gt;1$. &lt;/p&gt;&#xA;" OwnerUserId="8871" LastActivityDate="2014-05-24T07:36:31.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16480" PostTypeId="2" ParentId="16477" CreationDate="2014-05-24T11:02:55.820" Score="1" Body="&lt;p&gt;The answer is definitely yes. From your question you seem to think that the first equation can only be satisfied for sequences that vanish for $n&amp;gt;N$ or $n&amp;lt;N$ for some finite (positive or negative) $N$, i.e. for shifted versions of causal or anti-causal sequences. First of all note - as already pointed out in nidhin's answer - that your first equation only makes sense if you add &quot;for $z$ inside the region of convergence (ROC)&quot;. For two-sided sequences the ROC is a ring, so $r_1&amp;lt;|z|&amp;lt;r_2$. Outside the ROC, the $\mathcal{Z}$-transform has isolated singularities, which are the poles of the transfer function (for which $X(z)\rightarrow\infty$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a counter-example, i.e. a sequence which cannot be written as suggested in your question, but for which the $\mathcal{Z}$-transform exists, consider the sequence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\begin{cases}\frac{a^{n+1}}{a-b},&amp;amp;n\ge 0\\&#xA;\frac{b^{n+1}}{a-b},&amp;amp;n&amp;lt;0\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $0&amp;lt;|a|&amp;lt;1&amp;lt;|b|$. Note that this is a two-sided sequence, which is neither causal nor anti-causal, and for which $x[n]\neq 0$ is satisfied for all $n$. Its $\mathcal{Z}$-transform is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{z^2}{(z-a)(z-b)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its region of convergence is $|a|&amp;lt;|z|&amp;lt;|b|$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-05-24T11:12:26.880" LastActivityDate="2014-05-24T11:12:26.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16481" PostTypeId="1" CreationDate="2014-05-24T13:45:26.443" Score="1" ViewCount="5101" Body="&lt;p&gt;In OFDM system, after IFFT a CP is added at the beginning of the OFDM symbol by copying it from the end of the symbol.My question is that with CP why we use cyclic convolution instead of linear convolution. I would appreciate if someone please could explain the reason of cyclic convolution here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="9014" LastActivityDate="2018-03-08T23:44:23.993" Title="Reason of circular conv in OFDM" Tags="|fft|filters|noise|dft|modulation|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16482" PostTypeId="2" ParentId="16477" CreationDate="2014-05-24T13:52:26.453" Score="1" Body="&lt;p&gt;As indicated in nidhin and MattL's answers, the requirement for the existence of the $\mathcal{Z}$-transform must be restricted to a region of convergence. However, it should be noted that this region can be made arbitrarily large with functions such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  \begin{align}&#xA;  x[n] &amp;amp;= c^{-n^2}&#xA;  \end{align}&#xA;$$&#xA;For any real constant $c$ such that $|c|&amp;lt;1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The region of convergence for the $\mathcal{Z}$-transform of this sequence is $|z|&amp;lt;\infty$, so definition (1) in your post is satisfied (almost everywhere).&#xA;However, this sequence is strictly positive for all $n$ and as such cannot be expressed in the provided form. So, in short yes such sequences do exist.&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2014-05-24T13:52:26.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16483" PostTypeId="2" ParentId="16481" CreationDate="2014-05-24T14:26:29.110" Score="1" Body="&lt;p&gt;An operational equivalent to cyclic convolution is used and allowed in the transmission channel so that the OFDM signal can be decoded with an FFT, which is a fast efficient implementation of a DFT, which uses cyclically orthogonal basis vectors.  If linear convolution were used or allowed, then a less computationally simple and efficient deconvolution method (more matrix math) would have to be used to demodulate it, especially if multi-path distortion or other short enough linear filtering is possible in the transmission channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computational efficiency can be an advantage for mobile radio modems which run on limited battery energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the comments in this answer &lt;a href=&quot;https://dsp.stackexchange.com/questions/16049/cyclic-prefix-in-ofdm/16052#16052&quot;&gt;cyclic prefix in ofdm&lt;/a&gt; for more comments on equalization simplification.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-05-24T14:37:26.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16484" PostTypeId="2" ParentId="16481" CreationDate="2014-05-24T14:41:02.070" Score="6" Body="&lt;p&gt;OFDM systems are usually implemented using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fast_Fourier_transform&quot;&gt;FFT&lt;/a&gt; and its inverse. At the transmitter, information symbol values are assigned to the various OFDM subcarriers, resulting in a single OFDM symbol in the frequency domain. To obtain a time domain that can actually be transmitted over the channel, an inverse FFT is applied. The receiver on the other end of the link performs the reverse (it computes a forward FFT) on its observed signal, resulting (hopefully) in the original frequency-domain symbols, thus accomplishing OFDM demodulation.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Why add a prefix?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The short answer: multipath through the communication channel. You can think of multipath as a linear filter applied to the transmitted signal via propagation through the communication channel. Thus, the signal observed at the receiver is the original one from the transmitter, convolved with the channel response (and corrupted by noise). This results in &lt;a href=&quot;http://en.wikipedia.org/wiki/Intersymbol_interference&quot;&gt;intersymbol interference (ISI)&lt;/a&gt;, which degrades system performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Techniques to undo the effects of this channel response are called &lt;a href=&quot;http://en.wikipedia.org/wiki/Equalizer_%28communications%29&quot;&gt;equalizers&lt;/a&gt;, and are widely used in practical communications systems. However, their implementation and analysis can be somewhat complicated. It would be nice if, for your OFDM system, you could come up with a simpler equalization method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to mitigate multipath would be to insert some sort of guard time between symbols (a prefix) in order to allow the delay spread of the channel from one symbol to die out before the next. This strategy is used in many OFDM systems; the added prefix allows time between symbols for the channel's impulse response to die out, reducing or eliminating ISI. For most other systems, adding this overhead on each symbol would be prohibitively inefficient. However, since OFDM's effective symbol rate is much lower (since many modulated subcarriers are transmitted in each OFDM symbol time in parallel), the overhead of this approach is proportionally lower as well.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Why use cyclic prefixes?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Recall the fact that the OFDM symbols are modulated onto subcarriers in the frequency domain. Also recall the relationship between convolution and the discrete Fourier transform (DFT): convolution in the time domain corresponds to multiplication in the frequency domain. Therefore, the effects of the convolution with the channel response show up as pointwise multiplication of the frequency-domain subcarriers. This makes for a very simple equalizer structure: we just have to multiply each subcarrier by a (per-carrier) constant value at the receiver in order to undo the effects of multipath. This is typically called a &quot;one-tap&quot; equalizer, and is equivalent to assuming that any fading is flat across each subcarrier's bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However,&lt;/strong&gt; recall that multiplication in the DFT domain corresponds to &lt;em&gt;cyclic&lt;/em&gt; convolution in the time domain. So, in order for this strategy to work, we would need some way of turning the channel response into a cyclic convolution, not a linear convolution as typically happens in the real world. That's where the cyclic prefix comes in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The implementation:&lt;/strong&gt; for each time-domain symbol generated by the transmitter, a cyclic prefix is inserted before it. That cyclic prefix takes the last $L$ samples of the $N$-sample time-domain symbol and concatenates it to the front of the symbol to be transmitted. Therefore, for each $N$-sample OFDM symbol, the transmitter actually emits $N+L$ samples. The length of the prefix $L$ is chosen to be greater than the expected multipath spread.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Why does it work?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;With the cyclic prefix inserted, you can see conceptually how the linear convolution induced by the channel turns effectively into circular convolution; the cyclic prefix, which includes the end of the symbol, is smeared onto the beginning of the symbol by the channel's impulse response. This effect is quite literally defined as circular convolution, so the goal of achieving simple equalization is accomplished.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-05-24T14:41:02.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16485" PostTypeId="2" ParentId="13737" CreationDate="2014-05-24T15:03:08.467" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So, 2.048/262144 = 0.000007812volts Does that mean each level will represent, 0.000007812 &#xA;  volts ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;MCP3424 has differential input, it can take an input of -2.048V to +2.048V.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefor volt per level = (4.096/2^18) = 0.0000625 =&gt; 62.5uV per level&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, bit 18 is the sign bit.&lt;/p&gt;&#xA;" OwnerUserId="9015" LastActivityDate="2014-05-24T15:03:08.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16486" PostTypeId="1" AcceptedAnswerId="16512" CreationDate="2014-05-24T16:31:17.837" Score="0" ViewCount="1582" Body="&lt;p&gt;I'm studying image warping and I'm unsure how to warp a starting rectangular image into another image where the box corner points have been changed as I want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wAElk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(image from &lt;a href=&quot;http://www.inf.ethz.ch/personal/pomarc/courses/CompPhoto/cpv03.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.inf.ethz.ch/personal/pomarc/courses/CompPhoto/cpv03.pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I've understood, I need to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Decide the four points (e.g. by using direct mapping on the border cases of the transformation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Create a lattice of integer points on it (how?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Do reverse mapping on those integer points to get the values in the original image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't say I understood a lot of that, can somebody help me out please?&lt;/p&gt;&#xA;" OwnerUserId="9016" LastActivityDate="2014-05-26T08:18:12.553" Title="Image warping - how to proceed" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16487" PostTypeId="1" AcceptedAnswerId="16488" CreationDate="2014-05-24T19:10:12.040" Score="1" ViewCount="94" Body="&lt;p&gt;I will first describe the Independent Component Analysis (ICA) steps, so that the question becomes clearer, and more relevant to similar questions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume we have $N$ sensors distributed in space. From each sensor we obtain a time series of length $T$. We collect these time series as rows in an $N \times T$ matrix $X$. After performing ICA we obtain a decomposition of the form $X = DS$, where $D$ is an $N \times N$ matrix of weights, and $S$ is an $N \times T$ matrix whose rows are the independent sources. To find the contribution of the $i$-th component to the observed signal we then multiply the $i$-th column of the matrix $D$ with the $i$-th row of $S$. The result is an $N \times T$ matrix which we will denote as $X^{i} = D_{*,i}S_{i,*}$. Then we can write: $X = X^{1} + ... + X^{i} + ... + X^{N}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many domains I see single-picture visualizations of the spatial activation of the $i$-th component from ICA. However, it is not clear to me what metric to extract from each row of $X^{i}$ or from matrix $D$ in order to do this. Is it a summary statistic of the rows of $X^{i}$, e.g. the energy of the signals (rows) of $X^{i}$, the weighting coefficients from the $i$-th column of $D$, or something different altogether?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="9017" LastActivityDate="2014-05-25T00:35:37.717" Title="Suitable metrics for summarizing or visualizing the spatial activation of components after temporal Independent Component Analysis (ICA)" Tags="|signal-analysis|decomposition|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="16488" PostTypeId="2" ParentId="16487" CreationDate="2014-05-25T00:35:37.717" Score="0" Body="&lt;p&gt;As we know from the instantaneous mixture model of ICA, a signal mixture $X_{N,T}$ is composed of an unknown mixing matrix $D_{N,N}$, and an unknown signal matrix $S_{N,T}$, where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X = DS&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In ICA, we solve for $D_{N,N}$ and $S_{N,T}$ via maximization of absolute kurtosis. (As one method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we now look at the $i$th column of $D$, each element therein will now give us weight by which the $i$th signal gets weighted by in all $N$ mixtures. That is, each element $D_{n,i}$, (row $n$, column $i$), gives us signal $i$'s contribution to mixture $n$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OtQ5L.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those are called 'spatial weights' simply because in many ICA applications, we are de-mixing signals that sample a spatial field at different locations. Thus, each element of a column $D$ corresponds to a weight &lt;em&gt;in space&lt;/em&gt;, that weighs signal source $i$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way, we can show those weights in space as the heatmap above shows, and find the weight each signal gets weighted by, for a particular mixture, at different locations in space. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastActivityDate="2014-05-25T00:35:37.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16489" PostTypeId="2" ParentId="14603" CreationDate="2014-05-25T05:40:01.147" Score="1" Body="&lt;p&gt;The Conjugation is part of the definition of the Convolution as an &lt;a href=&quot;https://en.wikipedia.org/wiki/Inner_product_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;Inner Product&lt;/a&gt; operation.&lt;br&gt;&#xA;So you wrote the operation correctly.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually people uses &quot;Real&quot; Wavelets hence no need for that.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyhow, the definition is an inner product (Projecting the function onto the base of the wavelets) and it requires the conjugation operation.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-08-26T06:36:45.653" LastActivityDate="2018-08-26T06:36:45.653" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16490" PostTypeId="2" ParentId="2644" CreationDate="2014-05-25T05:40:20.593" Score="0" Body="&lt;p&gt;How about this code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=MKUWnz_obqQ&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=MKUWnz_obqQ&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/niitsuma/detect_laser_pointer&quot; rel=&quot;nofollow&quot;&gt;https://github.com/niitsuma/detect_laser_pointer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this code HSV color are compared using hotelling's t square test &lt;/p&gt;&#xA;" OwnerUserId="9019" LastActivityDate="2014-05-25T05:40:20.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16491" PostTypeId="2" ParentId="15215" CreationDate="2014-05-25T05:45:36.333" Score="1" Body="&lt;p&gt;I would implement it differently altogether.&lt;br&gt;&#xA;Since applying the Wiener filter is pretty &quot;cheap&quot; I would create an Image called &lt;code&gt;mWienerFilter&lt;/code&gt;.&lt;br&gt;&#xA;Then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vNoisePixels = (abs(I -  mMeanImage) &amp;gt; noiseThr);&#xA;I(vNoisePixels) = mWienerFilter(vNoisePixels);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That would be the best thing to do in my opinion.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-05-25T05:45:36.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16492" PostTypeId="1" CreationDate="2014-05-25T06:27:59.547" Score="0" ViewCount="155" Body="&lt;p&gt;I have a question which is closely related to this one:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/16330/fft-processing-gain&quot;&gt;FFT Processing Gain&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;^that discussion is a bit general so I want to ask a very objective question to see if I can apply that knowledge:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I collect one million time samples and perform a one million point DFT, roughly what DFT processing gain (in dB) improvement can I expect to achieve in pulling a weak spectral component up above background noise in comparison to a 100 point DFT? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that answer is 100,000. isn't it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we have 9999910 more bins.  &lt;/p&gt;&#xA;" OwnerDisplayName="user8769" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-05-25T06:27:59.547" Title="increase the # of points in a DFT, increase the processing" Tags="|fourier|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16493" PostTypeId="1" AcceptedAnswerId="16608" CreationDate="2014-05-25T08:45:30.803" Score="3" ViewCount="249" Body="&lt;p&gt;I have a problem of the following form.  There are two signals, x(t) and y(t).  The model for the system is such that:&#xA;$$x(t) = x'(t) + f(y(t))$$&#xA;where $f(y(t))$ is a variable offset introduced by interaction of $x$ with $y$.  The function $f$ is unknown.  As an additional constraint, $x'$ is expected to vary slowly and $y$ varies rapidly (and slowly as well).  $x$ has both slow and fast components as a result.  $f$ can probably be approximated pretty well by a linear function: it is monotonic increasing and fairly smooth.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is how to estimate $f$ and $x'$ given $x$ and $y$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0, 100, 100)&#xA;y = sin(pi * t / 5) + t/50 + 1&#xA;x = sin(pi * t/100) + 0.05 * y * y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EEmVR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x&lt;/code&gt; in blue, &lt;code&gt;y&lt;/code&gt; in green, &lt;code&gt;xprime&lt;/code&gt; in red&lt;/p&gt;&#xA;" OwnerUserId="3650" LastEditorUserId="8202" LastEditDate="2014-05-25T09:48:35.500" LastActivityDate="2014-06-02T10:53:21.093" Title="How to deconvolve dependent part of signal from independent part?" Tags="|deconvolution|source-separation|blind-deconvolution|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16495" PostTypeId="1" CreationDate="2014-05-25T11:00:58.427" Score="0" ViewCount="54" Body="&lt;p&gt;Studying for an exam I'll have I ran into a question about computing the localization of a Gaussian Filter in 1D, but sadly I have no idea of what such localization is. Can you give me a hint? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9021" LastActivityDate="2014-05-25T11:00:58.427" Title="Localization of a Gaussian" Tags="|filters|gaussian|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16497" PostTypeId="1" AcceptedAnswerId="16499" CreationDate="2014-05-25T13:20:00.190" Score="1" ViewCount="1350" Body="&lt;p&gt;In the diagram  below there are three multiplication operations required to &#xA;compute each filter output sample. I'd like to draw a block diagram of an equivalent filter but requiring fewer than three multiplies per filter output sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to transform the filter structure to Transformed Direct Form II, that it can be seen that number of multiplication can be reduced to 2. But, how to do that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pa6Yl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/be2AV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per the filter, are we talking about something like the picture below?&#xA;If that's the case, what's up with that unmarked node? What is he, addition? just redirection? I've never seen that before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to extract some generalizable rules about how to construct those neat equations you've made about the output and A &amp;amp; B but I'm not really able to put it into words, because I have only to foggiest notion of what you've done there, would you help me to do that? &lt;/p&gt;&#xA;" OwnerDisplayName="user8769" LastEditorUserId="4298" LastEditDate="2021-03-07T09:25:06.257" LastActivityDate="2021-03-07T09:25:06.257" Title="Transformed Direct Form II filter: Z transform: reduce multiplications" Tags="|filters|z-transform|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16498" PostTypeId="1" CreationDate="2014-05-25T13:33:03.240" Score="1" ViewCount="337" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FwBYs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These two filters have very similar frequency responses, but those responses are not identical except at a single frequency $\omega_0$. I want to find $\omega_0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way I've seen that done is like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$\begin{align}&#xA;Y_1(z)&amp;amp;=X(z)+2X(z)z^{-1}+X(z)z^{-2}\\&#xA;Y_2(z)&amp;amp;=X(z)+X(z)z^{-1}&#xA;\end{align}$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;if $Y_1(z)=Y_2(z)$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$&#xA;\begin{align}&#xA;\Longrightarrow 1+2z^{-1}+z^{-2}&amp;amp;=1+z^{-1}\\&#xA;\Longrightarrow z^{-1}+z^{-2}&amp;amp;=0\\&#xA;\Longrightarrow z\left(z+1\right)&amp;amp;=0\\&#xA;\Longrightarrow z=e^{j\omega}=-1\\&#xA;\Longrightarrow \omega=\pi\\&#xA;\omega_0=\frac{f_s}2&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But, to be perfectly frank that is quite confusing to me I don't quite know what's going on there, would someone please break it down for me? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way I've seen it done is like this: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$&#xA;H_1\left(\omega_0\right)= H_2\left(\omega_0\right)\rightarrow 1+2e^{-j\omega_0}+e^{-j2\omega_0}=1+e^{-j\omega_0}.&#xA;$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;With algebraic simplification the above equality can be written as:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$&#xA;e^{-j\omega_0}=-e^{-j2\omega_0}.&#xA;$$&#xA;  Here's the tricky part,...we multiply both sides of the above equation by $e^{j\omega_0}$ to give us:&#xA;  $$&#xA;1=-e^{-j\omega_0}.&#xA;$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I guess they're equivalent, but, in what ways specifically are they identical and in what ways are they divergent? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone could help me to see I would be so grateful. &lt;/p&gt;&#xA;" OwnerDisplayName="user8769" LastEditorUserId="28517" LastEditDate="2017-07-10T13:12:35.027" LastActivityDate="2017-07-10T13:12:35.027" Title="Linear-phase lowpass filters: frequency responses alignment" Tags="|filters|frequency|finite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16499" PostTypeId="2" ParentId="16497" CreationDate="2014-05-25T13:49:17.907" Score="4" Body="&lt;p&gt;It's instructive to look at the actual difference equation implemented by the system. If you define a sequence $w[n]$ as the output of the first (left-hand side) adder you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w[n] = x[n] + Aw[n-1]\\&#xA;y[n] = Bw[n] + Bw[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the $\mathcal{Z}$-transform gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W(z) = X(z) + A \ W(z)z^{-1}\\&#xA;Y(z) = B \ W(z)\left(1 + z^{-1}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which results in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W(z) = \frac{X(z)}{1-Az^{-1}}\\&#xA;Y(z) = \frac{B(1+z^{-1})}{1-Az^{-1}}X(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the time-domain this last equation is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = Ay[n-1]+B \left( x[n] + x[n-1] \right) \tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (1) shows that this system can obviously be implemented with only two multiplications. If you want to use the Transposed Direct-Form II structure then just use the structure shown &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Transposed_Direct_Forms.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; (bottom figure), set $a_1=-A$, remove the branches with multipliers $a_2$ and $b_2$ and the lower delay element (because you only have a first order filter), remove the multipliers $b_0$ and $b_1$, and multiply the input signal directly with $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; (in reaction to your updated question)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few mistakes in your figure. Note that in the figure I linked to, the input is on the right-hand side. This might have caused some confusion. Anyway, in your figure where you multiply by $B$, just multiply by $A$ instead. Then remove the multiplication by $-A$ and add a multiplication by $B$ to the input signal $x[n]$, &lt;em&gt;before&lt;/em&gt; the path splits. The node you refer to is simply an addition; they obviously forgot the 'plus' sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the equations, what I wanted to do is to get a difference equation for the output signal $y[n]$ in terms of $x[n]$ and of delayed versions of $x[n]$ and $y[n]$. This shows what the system actually does and in this way the description of the system becomes independent of the chosen filter structure. In order to do that, I used the $\mathcal{Z}$-transform which transforms difference equations into algebraic equations. So in the $\mathcal{Z}$-domain it is straightforward to eliminate the signal $w[n]$ and write $Y(z)$ directly in terms of $X(z)$. Transforming back to the time-domain yields the desired difference equation, which can then be implemented by any structure you like.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-05-29T11:49:01.097" LastActivityDate="2014-05-29T11:49:01.097" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16500" PostTypeId="2" ParentId="16498" CreationDate="2014-05-25T14:06:31.487" Score="1" Body="&lt;p&gt;Both methods are equivalent. Look at it like this: first write down the frequency responses (as already indicated in your question)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_1(e^{j\omega})=1+2e^{-j\omega}+e^{-2j\omega}\\&#xA;H_2(e^{j\omega})=1+e^{-j\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now want to find $\omega_0$ such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_1(e^{j\omega_0})=H_2(e^{j\omega_0})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1+2e^{-j\omega_0}+e^{-2j\omega_0}=1+e^{-j\omega_0}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or, equivalently,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{-j\omega_0}(1+e^{-j\omega_0})=0\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (1) can only be satisfied if the term in parentheses vanishes. So you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{-j\omega_0}=-1\Longrightarrow\omega_0=\pi$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since $\omega_0=2\pi f_0/f_s$ (where $f_s$ is the sampling frequency) you finally get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_0=f_s/2$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-25T14:06:31.487" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16501" PostTypeId="2" ParentId="16498" CreationDate="2014-05-25T14:15:35.587" Score="0" Body="&lt;p&gt;It's actually pretty easy to show that &#xA;$$H_2(\omega)=H_1(\omega)\cdot H_1(\omega)=H_1(\omega)^2$$&#xA;The second filter is equivalent to filtering twice with the first filter and hence the magnitude of the transfer function of second filters is the square of the first.&#xA;The only two numbers where the square is the same as the original number are 0 and 1, so the filters have the same magnitude at frequencies where the magnitude is 0 and 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both filters have DC gain (i.e. the magnitude is not 1 at low frequencies). Both have 0 gain at $\omega = \pi$ but the second filter is steeper.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-05-25T14:15:35.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16502" PostTypeId="1" CreationDate="2014-05-25T15:23:04.530" Score="4" ViewCount="868" Body="&lt;p&gt;I am currently working on a project which involves measuring the sound produced by the onset of a vapour bubble in boiling water. All the experiments went perfectly well and I'm now trying to obtain a frequency spectrum from the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sound-pulses produced by the bubbles only last about 40 ms max, simply too short to obtain a decent frequency resolution. That is why I'm measuring a numerous amount of almost identical pulses over a period of 5 seconds. The signal is being sampled at a rate of 100 kHz, which results in 500.000 samples. The interval between the sound-pulses is 95 ms ish as can be seen in the figure of the signal below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SmLGL.png&quot; alt=&quot;Signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Added an additional figure of the signal:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/IbF2M.png&quot; alt=&quot;Signal2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I create the frequency spectrum of the entire signal, I get this comb-like frequency spectrum with an interval of about 10 Hz between the peaks (which corresponds to the 95 ms time interval, but I would then rather expect a peak at 10 Hz in the spectrum):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i7Ji7.png&quot; alt=&quot;Spectrum1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't really get much information from this spectrum. I do know for instance that there should be a peak at around 167 Hz by looking at the time-domain (there's a small sine wave visible with about 6 ms peak to peak). The envelope of the spectrum does resemble the spectrum of a single sound pulse as shown below (but way less accurate):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k3tPk.png&quot; alt=&quot;Spectrum2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matlab code I used for the fourier transform was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y_fft = abs(fft(y-mean(y)));&lt;br&gt;&#xA;y_fft = y_fft(1:Nsamps/2);&lt;br&gt;&#xA;f = Fs*(0:Nsamps/2-1)/Nsamps;    %Prepare freq data for plot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyknow how to get a usefull spectrum in this situation or please tell me what I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Marc&lt;/p&gt;&#xA;" OwnerUserId="9022" LastEditorUserId="9022" LastEditDate="2014-05-25T21:07:03.077" LastActivityDate="2014-05-26T14:08:55.250" Title="Comb-like peaks in frequency spectrum" Tags="|fft|frequency-spectrum|signal-analysis|frequency|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16505" PostTypeId="2" ParentId="16502" CreationDate="2014-05-25T18:03:06.053" Score="1" Body="&lt;p&gt;That does not appear that wrong at all. As you said, the comb has the expected pattern. Maybe the base frequency is not that strong at all. Are the single pulses similar to each other, or do they maybe change sign occasionally?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are trying to measure the bubbling frequency, maybe you should change your approach. For example, you could use a triggering algorithm.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-05-25T18:03:06.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16506" PostTypeId="2" ParentId="16486" CreationDate="2014-05-25T20:07:56.040" Score="0" Body="&lt;p&gt;ImageMagick does that sort of thing, and it's open source.  Look at the source code in magick/distort.c of the current ImageMagick distribution, which you can get from imagemagick.org.  This assumes you have already selected the four control points and passed them in as an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The particular distortion method you described is called &quot;binlinear forward&quot; distortion in ImageMagick.  See &lt;a href=&quot;http://www.imagemagick.org/Usage/distorts/#bilinear_forward&quot; rel=&quot;nofollow&quot;&gt;http://www.imagemagick.org/Usage/distorts/#bilinear_forward&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8330" LastActivityDate="2014-05-25T20:07:56.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16507" PostTypeId="1" CreationDate="2014-05-26T00:54:48.440" Score="3" ViewCount="1366" Body="&lt;p&gt;I'm using Octave and trying to use the &quot;instfreq&quot; function from the &lt;a href=&quot;http://tftb.nongnu.org/&quot; rel=&quot;nofollow&quot;&gt;time frequency toolbox&lt;/a&gt; which requires an analytic signal input. To get this analytic signal I'm using the Octave function &quot;hilbert&quot; on my real valued signal thus:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;analytic_sig = hilbert( my_real_valued_signal ) ;&#xA;[ instf, t ] = instfreq( analytic_signal ) ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where instf is the instantaneous frequency I'm trying to obtain. However, the results are not quite what I expected. I suspect that the 90 degree phase shift induced by the hilbert transform is where the problem lies, so my question is how can I alter the output of the Octave &quot;hilbert&quot; function to compensate/adjust for this phase shift?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; in response to comments&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a simple test case I'm creating a signal x with instantaneous frequency ifl&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:1&amp;gt; [x ifl] = fmlin(10,0.05,0.35)&#xA;x =&#xA;&#xA;  -0.97815 - 0.20791i&#xA;  -0.80902 - 0.58779i&#xA;  -0.30902 - 0.95106i&#xA;   0.50000 - 0.86603i&#xA;   1.00000 + 0.00000i&#xA;   0.30902 + 0.95106i&#xA;  -0.91355 + 0.40674i&#xA;  -0.30902 - 0.95106i&#xA;   1.00000 - 0.00000i&#xA;  -0.50000 + 0.86603i&#xA;&#xA;ifl =&#xA;&#xA;   0.050000&#xA;   0.083333&#xA;   0.116667&#xA;   0.150000&#xA;   0.183333&#xA;   0.216667&#xA;   0.250000&#xA;   0.283333&#xA;   0.316667&#xA;   0.350000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but in my envisioned real life application I will only have data for the real component&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:2&amp;gt; real_sig = real(x)&#xA;real_sig =&#xA;&#xA; -0.97815&#xA; -0.80902&#xA; -0.30902&#xA;  0.50000&#xA;  1.00000&#xA;  0.30902&#xA; -0.91355&#xA; -0.30902&#xA;  1.00000&#xA; -0.50000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;using the hilbert function I create an analytic signal from my available real data&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:3&amp;gt; anal_sig = hilbert( real_sig )&#xA;anal_sig =&#xA;&#xA;  -0.97815 + 0.07265i&#xA;  -0.80902 - 0.41187i&#xA;  -0.30902 - 0.92331i&#xA;   0.50000 - 0.81514i&#xA;   1.00000 + 0.04490i&#xA;   0.30902 + 0.98765i&#xA;  -0.91355 + 0.52573i&#xA;  -0.30902 - 0.89042i&#xA;   1.00000 + 0.28002i&#xA;  -0.50000 + 1.12978i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and when this is put in to the instfreq function I get the measured instantaneous frequency instf&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:4&amp;gt; instf = instfreq( anal_sig )&#xA;instf =&#xA;&#xA;   0.10520&#xA;   0.13131&#xA;   0.15427&#xA;   0.18209&#xA;   0.20487&#xA;   0.24755&#xA;   0.31328&#xA;   0.30974&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The instfreq function returns values in the range [2:end-1] of its input, so padding to make an easy comparison&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:5&amp;gt; [ ifl [ 0 ; instf ; 0 ] ]&#xA;ans =&#xA;&#xA;   0.05000   0.00000&#xA;   0.08333   0.10520&#xA;   0.11667   0.13131&#xA;   0.15000   0.15427&#xA;   0.18333   0.18209&#xA;   0.21667   0.20487&#xA;   0.25000   0.24755&#xA;   0.28333   0.31328&#xA;   0.31667   0.30974&#xA;   0.35000   0.00000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it can be seen that the measured frequency is different from the true, known frequency. Thinking of a phasor diagram, I was thinking that perhaps some trigonometric manipulation of the real and imaginary components of the hilbert function output might correct this. &lt;/p&gt;&#xA;" OwnerUserId="260" LastEditorUserId="260" LastEditDate="2014-05-26T12:27:49.843" LastActivityDate="2014-05-26T16:54:19.400" Title="Compensate for phase shift of Hilbert transform" Tags="|phase|transform|time-frequency|octave|hilbert-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16508" PostTypeId="1" AcceptedAnswerId="16521" CreationDate="2014-05-26T01:43:05.430" Score="0" ViewCount="344" Body="&lt;p&gt;I created a white noise signal. I am trying to use the array I have created with the white noise to play in 2 channels. When the left channel I was trying to have 5000 samples and the right will have 0 and when in the right channel it will have 5000 samples and the left will be 0(which means no sound from this channel). I keep getting an error when trying to concatenate the sounds and I think I messed up with the loop because every time it loops it will do 5000 samples and I only need 5000 total with a 10000 sample pause in between the 2 sounds. I also had trouble writing the band-pass filter into the code but it worked when using the FDAToool. Any help would be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 44.1; %Sample Frequency khz&#xA;L=5000; %Sample length for the random signal  &#xA;P=10000; %Sample Pause Gap&#xA;mu=0;&#xA;sigma=2;&#xA;&#xA;Left_signal = [sigma*randn(L,1)+mu 0];&#xA;Right_signal = [0 sigma*randn(L,1)+mu];&#xA;&#xA;&#xA;%Loop thru all samples&#xA;for num = 2:L,&#xA;%Time&#xA;%t = num *(1/Fs);&#xA;Left_signal = [Left_signal; sigma*randn(L,1)+mu 0];&#xA;end&#xA;&#xA;Pause = zeros(P,2);&#xA;&#xA;for num2 = 2:L,&#xA;%time&#xA;%t = num2 * (1/Fs);&#xA;Right_signal = [Right_signal; 0 sigma*randn(L,1)+mu];&#xA;end&#xA;&#xA;Long_signal = [Left_signal; Pause; Right_signal];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2014-05-26T12:16:58.347" Title="How to Concatenate white noise signal and applying bandpass filter matlab" Tags="|matlab|signal-analysis|sound|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16509" PostTypeId="2" ParentId="8875" CreationDate="2014-05-26T05:30:15.523" Score="3" Body="&lt;p&gt;The easiest way to get good performance from phase correlation by whitening the signal is to take the log of the magnitude. You can also filter out the noise from the resulting correlation surface. For details see  “Improving Phase Correlation for Image Registration”, Proceedings of (ICVNZ2011) Image and Vision Computing New Zealand 2011, p.488-493, , &lt;a href=&quot;http://www98.griffith.edu.au/dspace/bitstream/handle/10072/44512/74188_1.pdf?sequence=1&quot; rel=&quot;nofollow&quot;&gt;http://www98.griffith.edu.au/dspace/bitstream/handle/10072/44512/74188_1.pdf?sequence=1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9026" LastEditorUserId="9026" LastEditDate="2014-05-26T07:34:17.197" LastActivityDate="2014-05-26T07:34:17.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16511" PostTypeId="1" CreationDate="2014-05-26T07:20:42.117" Score="0" ViewCount="249" Body="&lt;p&gt;I have signal, periodic with amplitude 10 with frequency about 10 kHz. It is hidden in Gaussian noise with standard deviation 100. Some idea how to extract periodic signal?&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2014-05-26T07:41:20.667" LastActivityDate="2014-05-26T11:36:55.500" Title="Extract signal from big gaussian noise" Tags="|noise|filtering|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16512" PostTypeId="2" ParentId="16486" CreationDate="2014-05-26T08:18:12.553" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;4 corresponding points defines a Homography matrix, which maps your coordinates in the first image to the second image (or from second to first, inversely). This is sort of a perspective transform for homogeneous coordinates. Read more about it here:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Homography&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Homography&lt;/a&gt;. (Since you have exact correspondences it is very easy to solve for Homography matrix.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert your image points to homogeneous representation: &#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Homogeneous_coordinates&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Homogeneous_coordinates&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a bilinear interpolation (backward mapping) using your matrix. That is to say, a homogeneous point $x_i$ is mapped to the corresponding point in the second image $x'_i$ as $x'_i=Hx_i$. Yet you have to de-homogenize the final coordinate as $x_i=\frac{x_i}{x^z_i}$, where $x^z_i$ is the $3^{rd}$ component of $x_i$. You can basically now, create your indices for the entire grid. Yet, as I said, you should interpolate by reverse lookup, so that you don't end up with black dots allover.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-05-26T08:18:12.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16513" PostTypeId="2" ParentId="8901" CreationDate="2014-05-26T08:41:34.803" Score="2" Body="&lt;p&gt;I think there is a mistake in those calculations. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How can you assume that $K$ has only a scaling effect? The principal point is integrated in $K$, it's not just a matrix of focal lengths.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How come is this true?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$det(K)K^{-T} = \left[\begin{matrix} 1&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\-u_x&amp;amp;-u_y&amp;amp;1 \end{matrix}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't end up with such equal numbers in the diagonal if you compute $det(K)K^{-T}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me, your question is a bit unclear and I guess some assumptions are fishy. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-06-20T20:45:47.870" LastActivityDate="2015-06-20T20:45:47.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16514" PostTypeId="2" ParentId="768" CreationDate="2014-05-26T08:51:58.310" Score="3" Body="&lt;p&gt;I guess this is a straightforward non-linear optimization problem (to be solved with Newton variations, such as Trust-Region methods), where you don't even need to compute the Jacobian analytically. It appears to me that the optimization problem is written over $K_i$, and thus is the input to the cost function. To compute the cost, at each call to this function, you basically compute the singular values of $K_i$ and compute the cost according to equation $4$ (in the paper). As your input parameter is $K$, the derivatives are computed over the elements of $K$. That makes your optimization $4$ dimensional (or $5$ if you consider the skew) per camera. The derivatives are computed automatically, and you don't need to care about that. If you are using MATLAB,&lt;code&gt;lsqnonlin&lt;/code&gt; would work for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weight computation is explained in a detailed fashion in the paper, so I skip this part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having checked &lt;a href=&quot;ftp://mi.eng.cam.ac.uk/pub/reports/mendonca_self-calibration.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the paper&lt;/a&gt; once again, I have noticed that the authors are actually using the numerical differentiation scheme I have mentioned. If you would like to understand more deeply how to differentiate an SVD, you might like to check out &lt;a href=&quot;http://qwone.com/~jason/writing/svdJacobian.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; or &lt;a href=&quot;https://hal.inria.fr/inria-00072686/document&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2017-04-18T20:41:33.747" LastActivityDate="2017-04-18T20:41:33.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16515" PostTypeId="1" CreationDate="2014-05-26T09:53:58.060" Score="5" ViewCount="9906" Body="&lt;p&gt;I am trying to understand the usage of Hermitian symmetry in OFDM systems and have a couple of questions regarding this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the reason of using the Hermitian symmetry in OFDM?&lt;/li&gt;&#xA;&lt;li&gt;How can we arrange the data in terms of Hermitian symmetry?&lt;/li&gt;&#xA;&lt;li&gt;In OFDM system where do we arrange our data as Hermitian symmetry?&lt;/li&gt;&#xA;&lt;li&gt;Is there any reference or documentation that explains Hermitian symmetry in OFDM system?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9014" LastEditorUserId="1606" LastEditDate="2014-05-26T11:22:07.910" LastActivityDate="2018-12-29T15:38:32.727" Title="Hermitian symmetry in OFDM systems" Tags="|fft|dft|estimation|ofdm|multi-channel|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16516" PostTypeId="1" CreationDate="2014-05-26T11:14:16.663" Score="0" ViewCount="1441" Body="&lt;p&gt;I was looking at performing a Stockwell transform on a matrix (or an image as it has two directions - the matrix I am interested in has a spatial dimension and a time dimension, but this should make no difference) instead of an array. Whilst there are a couple of codes that perform a Stockwell transform on an array (see &lt;a href=&quot;https://dsp.stackexchange.com/questions/11087/infomation-about-stockwell-transform&quot;&gt;infomation about Stockwell Transform&lt;/a&gt; for links to 2 of them and &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/45848-stockwell-transform--s-transform-&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/45848-stockwell-transform--s-transform-&lt;/a&gt; for one without for loops), I could not find one for a matrix/image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Mansinha et al. (1997), for a matrix $h(x,y)$ the S-transform can be defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ S(x,y,k_x,k_y) = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} H(\alpha + k_x, \beta + k_y) e^{-\frac{2\pi ^2 \alpha^2}{k_x^2}} e^{-\frac{2\pi ^2 \beta^2}{k_y^2}} e^{i2\pi (\alpha x + \beta y)} \mathrm{d}\alpha \mathrm{d}\beta$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $k_x \neq 0 $ and $k_y \neq 0 $; where $H(k_x,k_y)$ is the 2D Fourier transform of the matrix $h(x,y)$. $x$ and $y$ are spatial variables and $k_x$ and $k_y$ are the corresponding wavenumbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete form of the above according to the same paper is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ S(pT_x, qT_y, \frac{n}{NT_x}, \frac{m}{MT_y}) = \sum\limits_{n'=0}^{N-1}\sum\limits_{m'=0}^{M-1} H(\frac{n'+n}{NT_x},\frac{m'+m}{MT_y}) e^{-\frac{2\pi^2 n'^2}{n^2}} e^{-\frac{2\pi^2 m'^2}{m^2}} e^{\frac{i2\pi n'p}{N}} e^{\frac{i2\pi m'q}{M}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $n \neq 0$, $m \neq 0$; where $H$ is the 2D Fourier transform of the matrix $h(pT_x,qT_y)$ and $p=0...,N-1$, $q=0...,M-1$ and $T_x,T_y$ are the sampling intervals in the respective directions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore (if I understand it correctly) the above process is a inverse Fourier transform to a multiplication in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I was unable to code up because the 2D Fourier transform of $h(pT_x,qT_y)$ has the same dimensions as $h$ and thusthere is a mismatch with $H(\frac{n'+n}{NT_x},\frac{m'+m}{MT_y})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help in coding the above in MATLAB is greatly appreciated. This (&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/45848-stockwell-transform--s-transform-&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/45848-stockwell-transform--s-transform-&lt;/a&gt;) is a very efficient 1D transform which has helped me understand how it works. The link for the paper is &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0031920197000472&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.sciencedirect.com/science/article/pii/S0031920197000472&lt;/a&gt; (if you have access to it)&lt;/p&gt;&#xA;" OwnerUserId="8548" LastEditorUserId="8548" LastEditDate="2017-12-01T09:07:00.630" LastActivityDate="2022-04-10T01:04:35.453" Title="How to perform a Stockwell Transform on a 2D matrix" Tags="|image-processing|matlab|fourier-transform|transform|s-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16517" PostTypeId="2" ParentId="16515" CreationDate="2014-05-26T11:21:03.157" Score="7" Body="&lt;p&gt;The Hermitian symmetry is used to obtain a real-valued time-domain signal. It is a special case of OFDM called discrete multitone (DMT). It exploits a property of the discrete Fourier transform (DFT), namely that the DFT of a real-valued signal has Hermitian symmetry. The motivation is usually the channel: if the signal shall be transmitted over a low-pass channel without additional radio-frequency upconversion (which requires an oscillator at the transmitter and a local oscillator at the receiver) the transmit signal must be real-valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given an OFDM system with $N$ subcarriers the following conditions must hold&#xA;$$&#xA;c_{-k} = c^*_k\\&#xA;c_0\in \mathbb{R}&#xA;$$&#xA;where $c_k$ is the complex value of subcarrier with index $k\in[-N/2\ldots N/2-1]$. This can be achieved by mapping $N/2$ complex symbols to subcarriers $0$ to $N/2-1$ and then assigning the respective complex conjugate value to the according subcarrier with negative index. This would normally take place after the mapper and before the inverse DFT (IDFT) block.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-05-26T12:04:59.780" LastActivityDate="2014-05-26T12:04:59.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16518" PostTypeId="2" ParentId="16515" CreationDate="2014-05-26T11:32:43.090" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Hermitian Symmetry is used when you want the IFFT output to be real-valued, so that it could be transmitted directly over a wire, for example. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;2-3. At the input to the N-point IFFT, you should have f(N-n) = conj(f(n)) where n = 0 to N/2.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-05-26T11:32:43.090" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16519" PostTypeId="2" ParentId="16511" CreationDate="2014-05-26T11:36:55.500" Score="1" Body="&lt;p&gt;Rearrange the signal into a matrix containing one period in each row and average down the columns. &lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-05-26T11:36:55.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16520" PostTypeId="2" ParentId="16114" CreationDate="2014-05-26T11:46:34.030" Score="1" Body="&lt;p&gt;Both mapping techniques have practical significance:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For bandpass channels every subcarrier can be modulated with an individual complex value. The resulting time-domain signal (after inverse discrete Fourier transform (IDFT)) is generally complex-valued.&lt;/li&gt;&#xA;&lt;li&gt;For lowpass channels one often uses the complex-conjugate symmetry you describe in your question. It yields a real-valued time-domain signal (after IDFT). These systems are often referred to as discrete multitone (DMT). For more details see &lt;a href=&quot;https://dsp.stackexchange.com/questions/16515/hermitian-symmetry-in-ofdm-systems&quot;&gt;this recent question about Hermitian symmetry&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-05-26T11:46:34.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16521" PostTypeId="2" ParentId="16508" CreationDate="2014-05-26T12:16:58.347" Score="0" Body="&lt;p&gt;If I understand the question correctly this should solve your problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = 5000;&#xA;P = 10000;&#xA;sigma = 2;&#xA;mu = 0;&#xA;&#xA;left = sigma*randn(L,1) + mu;&#xA;right = sigma*randn(L,1) + mu;&#xA;&#xA;y = [left zeros(L,1); zeros(P,2); zeros(L,1) right];    % stereo sound matrix&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-26T12:16:58.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16522" PostTypeId="1" CreationDate="2014-05-26T12:29:03.570" Score="0" ViewCount="1015" Body="&lt;p&gt;I want to find the fundamental frequency for human voice in an Android Application. I want to use autocorrelation method. My code is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public double calculateFFT(double[] signal)&#xA;&#xA;     {&#xA;      final int mNumberOfFFTPoints =1024;&#xA;&#xA;      double[] magnitude = new double[mNumberOfFFTPoints/2];&#xA;      DoubleFFT_1D fft = new DoubleFFT_1D(mNumberOfFFTPoints);&#xA;      double[] fftData = new double[mNumberOfFFTPoints*2];&#xA;      double max_index=-1;&#xA;      double max_magnitude=-1;&#xA;&#xA;&#xA;      final float sampleRate=44100;&#xA;      double frequency;&#xA;&#xA;      for (int i=0;i&amp;lt;mNumberOfFFTPoints;i++){&#xA;&#xA;       //fftData[2 * i] = buffer[i+firstSample];&#xA;       fftData[2 * i] = signal[i];  //da controllare&#xA;       fftData[2 * i + 1] = 0;&#xA;&#xA;       fft.complexForward(fftData);&#xA;      }&#xA;&#xA;      for(int i = 0; i &amp;lt; mNumberOfFFTPoints/2; i++){&#xA;&#xA;       magnitude[i]=Math.sqrt((fftData[2*i] * fftData[2*i]) + (fftData[2*i + 1] * fftData[2*i + 1]));&#xA;&#xA;       if (max_magnitude&amp;lt;magnitude[i]){&#xA;        max_magnitude=magnitude[i];&#xA;        max_index=i;&#xA;       }&#xA;      }&#xA;      return frequency=sampleRate*(double)max_index/(double)mNumberOfFFTPoints;&#xA;&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I used &quot;edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D;&quot;&#xA;Is my &quot;return&quot;  the value of fundamental frequency or not? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I changed my code in this mode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    public double calculateFFT(double[] signal)&#xA;&#xA;    {&#xA;&#xA;        final int mNumberOfFFTPoints =1024;&#xA;        double[] magnitude = new double[mNumberOfFFTPoints/2];&#xA;        DoubleFFT_1D fft = new DoubleFFT_1D(mNumberOfFFTPoints);&#xA;        double[] fftData = new double[mNumberOfFFTPoints*2];&#xA;&#xA;        double max_index=-1;&#xA;        double max_magnitude=-1;&#xA;&#xA;        final float sampleRate=44100;&#xA;        double frequency;&#xA;&#xA;&#xA;        for (int i=0;i&amp;lt;mNumberOfFFTPoints;i++){&#xA;&#xA;            fftData[2 * i] = signal[i];  &#xA;            fftData[2 * i + 1] = 0;&#xA;&#xA;            }&#xA;&#xA;        fft.complexForward(fftData);&#xA;&#xA;        for(int i = 0,j=0; i &amp;lt; mNumberOfFFTPoints/2; i += 2,j++){&#xA;&#xA;            magnitude[j]=Math.sqrt((fftData[2*i] * fftData[2*i]) + (fftData[2*i + 1] * fftData[2*i + 1]));&#xA;&#xA;        }&#xA;         fft.complexInverse(fftData, false);&#xA;&#xA;         for(int i=0;i&amp;lt;magnitude.length;i++)&#xA;&#xA;            if (max_magnitude&amp;lt;magnitude[i]){&#xA;                max_magnitude=magnitude[i];&#xA;                max_index=i;&#xA;            }&#xA;&#xA;            return frequency=sampleRate*(double)max_index/(double)mNumberOfFFTPoints;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in this mode I calculate autocorrelation thanks inverse transform &quot;fft.complexInverse(fftData, false);&quot;; isn't it? &#xA;And also in this case isn't the &quot;return&quot; the fundamental frequency?&lt;/p&gt;&#xA;" OwnerUserId="9029" LastEditorUserId="6" LastEditDate="2014-05-27T18:24:56.930" LastActivityDate="2014-05-27T18:24:56.930" Title="Android: fundamental frequency" Tags="|fft|frequency|sound|pitch|java|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16523" PostTypeId="2" ParentId="16507" CreationDate="2014-05-26T13:31:18.250" Score="2" Body="&lt;p&gt;Your result is not wrong or strange at all. Note that the function 'hilbert' can only approximate a Hilbert transform. Furthermore, the function 'instfreq.m' can only estimate the instantaneous frequency. After all, the relative error between your and the original estimates is really not big at all (obviously apart from the first and last value).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-26T13:31:18.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16524" PostTypeId="2" ParentId="16502" CreationDate="2014-05-26T14:08:55.250" Score="2" Body="&lt;p&gt;Your signals look quite similar to vowel signals - in which a periodic pulse train is filtered by a resonant filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to look into AR modelling to decompose your signal into a residual, and a set of AR coefficients. The spectrum of the residual will give you the &quot;pulse train&quot; component of your signal (a sharp peak every time a bubble is produced) ; while the frequency response of the all-pole filter associated with the set of AR coefficients will contain information about the sound of each bubble. The 167 Hz peak you are looking will be easy to spot on the later.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-05-26T14:08:55.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16525" PostTypeId="1" CreationDate="2014-05-26T15:36:11.723" Score="1" ViewCount="410" Body="&lt;p&gt;I know this topic is not clearly relevant to the forum, but I think it's fun and interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for computer vision riddles - fun and interesting questions that have a clear and precise solution. For example the following: We have a binary image with paths (contours) that are one pixel wide. Come up with an algorithm to find the ends of the paths. I know of two solutions to this riddle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know of any other riddles? I'll be happy to hear some!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gil.&lt;/p&gt;&#xA;" OwnerUserId="8851" LastActivityDate="2014-05-27T07:41:32.123" Title="Computer Vision/Image Processing Riddles" Tags="|image-processing|computer-vision|algorithms|" AnswerCount="1" CommentCount="0" ClosedDate="2014-06-02T18:22:09.657" ContentLicense="CC BY-SA 3.0" />
  <row Id="16526" PostTypeId="2" ParentId="16522" CreationDate="2014-05-26T16:42:32.403" Score="2" Body="&lt;p&gt;Very often not.  Your posted code is for finding an FFT magnitude, not an autocorrelation result, and thus likely to fail at estimating the fundamental pitch of sound/voice/music with typically high overtone or harmonic content.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-26T16:42:32.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16527" PostTypeId="2" ParentId="16507" CreationDate="2014-05-26T16:54:19.400" Score="3" Body="&lt;p&gt;1) A Hilbert transform has a very very long impulse response (above some given noise floor), so you need a ton more data to manufacture an analytic signal, otherwise you won't have enough to span the width of the Hilbert impulse response filter without serious edge truncation effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Instantaneous frequency estimates from this type of artificially approximated analytic signal can be very noisy, so often has to be low pass filtered to significantly below half your sample rate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-26T16:54:19.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16528" PostTypeId="1" CreationDate="2014-05-26T18:46:06.903" Score="5" ViewCount="606" Body="&lt;p&gt;By Gabor uncertainty, I mean the &lt;a href=&quot;http://en.wikipedia.org/wiki/Uncertainty_principle#Signal_processing&quot; rel=&quot;noreferrer&quot;&gt;principle of uncertainty&lt;/a&gt; as applied to signals — with the result that you can't have arbitrary time and frequency localization. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By way of background to my question, I wrote about this recently &lt;a href=&quot;http://www.agilegeoscience.com/journal/2014/1/15/what-is-the-gabor-uncertainty-principle.html&quot; rel=&quot;noreferrer&quot;&gt;in a blog post&lt;/a&gt;. In the last paragraph, I stated:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Signals do not have arbitrarily precise time and frequency&#xA;  localization. It doesn’t matter how you compute a spectrum, if you&#xA;  want time information, you must pay for it with frequency information.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The point here is that, as I understand it, this uncertainty is an irreducible property of signals. It is not a 'feature' (or bug) in the Fourier transform or mathematics generally. And you can't get around it by using non-Fourier methods like matching pursuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm now unsure this is really true. Someone wrote to me recently:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...the uncertainty is there because of the math, not nature. A&#xA;  'signal' is a mathematical construct... The timing information of a&#xA;  signal is in the phase, and for a short-lived pure tone you can&#xA;  exactly recover the timing and frequency from the temporal phase.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I guess I buy this. But when we're measuring unknown, real, broadband, noisy signals does it still hold?&lt;/p&gt;&#xA;" OwnerUserId="8680" LastActivityDate="2014-05-27T15:33:33.180" Title="Is Gabor uncertainty a feature of the Fourier transform, or of nature?" Tags="|fourier-transform|time-frequency|gabor|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16530" PostTypeId="1" AcceptedAnswerId="16531" CreationDate="2014-05-26T20:52:03.443" Score="1" ViewCount="1393" Body="&lt;p&gt;Can I assume that the R.O.C. from a Z-Transform will always start from or end in a pole or 0/infinity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{(z+1)(z-1)(z+j)(z-j)}{z^4}\space,\space\space j=\sqrt{(-1)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have 4 zeros in the unit circle equally spaced by a $\frac{\pi}{2}$ angle and 4 poles in the origin ($z=0$). If not specified, can I assume the the ROC wil necessarily start from exclusive zero and go towards infinity? Or maybe possible to exist a ROC which is a ring in the Z-plane (which will not start/end in a pole)? &lt;/p&gt;&#xA;" OwnerUserId="7389" LastActivityDate="2014-05-27T01:35:51.363" Title="Does the ROC (Z-Transform) always start/end from/in a pole?" Tags="|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16531" PostTypeId="2" ParentId="16530" CreationDate="2014-05-26T22:26:26.673" Score="1" Body="&lt;p&gt;The region of convergence of a power series of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Meromorphic_function&quot; rel=&quot;nofollow&quot;&gt;meromorphic&lt;/a&gt; function $f:\mathbb{C}\to\mathbb{C}$ will always be a open disk with an essential singularity on the boundary. The z-transform of an LTE system is essentially an expansion of $H(z^{-1})$ into a power series of $z^{-1}$. $H$ is meromorphic and therefore the region of convergence of the power series will always end at a pole of $H(z^{-1})$.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-05-26T22:26:26.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16532" PostTypeId="2" ParentId="16530" CreationDate="2014-05-27T01:35:51.363" Score="1" Body="&lt;p&gt;Since the value of Z-transform tends to infinity at poles, poles can not be a part of ROC. So ROC either starts from a pole or end in a pole. For example,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If $x[n]$ is a right-sided sequence, then the ROC extends outward from the outermost pole in $X(z)$&lt;/li&gt;&#xA;&lt;li&gt;If $x[n]$ is a left-sided sequence, then the ROC extends inward from the innermost pole in $X(z)$&lt;/li&gt;&#xA;&lt;li&gt;If $x[n]$ is a two-sided sequence, the ROC will be a ring in the z-plane that is bounded on the interior and exterior by a pole&lt;/li&gt;&#xA;&lt;li&gt;If $x[n]$ is a finite-duration sequence, then the ROC is the entire z-plane, except possibly $z=0$ or $|z|=\infty$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From all these cases, one can say that poles decides the boundary of ROC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example you provided is a finite-duration sequence and its ROC is entire z-plane except at z =0.&lt;/p&gt;&#xA;" OwnerUserId="8871" LastActivityDate="2014-05-27T01:35:51.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16536" PostTypeId="2" ParentId="16525" CreationDate="2014-05-27T07:41:32.123" Score="1" Body="&lt;p&gt;Nice idea :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few years ago, the Instagram team proposed the &lt;a href=&quot;http://instagram-engineering.tumblr.com/post/12651721845/instagram-engineering-challenge-the-unshredder&quot; rel=&quot;nofollow&quot;&gt;Unshredder challenge&lt;/a&gt;. The chalélenge is over now, but the game is still interesting and could be extended to more difficult puzzles.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-05-27T07:41:32.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16538" PostTypeId="1" CreationDate="2014-05-27T09:52:17.207" Score="5" ViewCount="7345" Body="&lt;p&gt;Good Morning!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new in signal processing and I am trying to do a work in noise control of an electronic steering lock device (ESL). My aim is to calculate the loudness (Zwicker Method- ISO 532 B) of this device. To do so, first I need to obtain the 1/3 octave spectrum of a time signal that I measure with a microphone. The problem is I keep getting negative values in $\textrm{dB}$ for the 1/3 Octave bands after filtering the signal in the time domain to obtain the spectrum. I will explain here the procedure I have used and hope that anyone sees what I am doing wrong. Thanks in advance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done the following procedure by now:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Sampled the noise signal (impulsive noise) by using a microphone and a data logger (to record the data), which has a sample frequency of $50\textrm{ kHz}$. Then, after this step I have a Curve that it is Amplitude ($\textrm{dBA}$) vs. time ($\textrm{s}$), as shown below. Once the ($\textrm{dBA}$) value of a sound level meter is calculated by:&#xA;$$10\log_{10}\left(  \dfrac{p^2}{p_0^2} \right)$$&#xA;where $p_0$ is $2\cdot 10^{-6}\textrm{ Pa}$. I am able to evaluate the pressure variation ($\textrm{ Pa}$) vs. time and use it as INPUT of the 1/3 Octave filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J5Rd6.png&quot; alt=&quot;Amplitude (dBA) vs Time (s) of the impulsive noise generated by the device&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I get the vector INPUT (with $250000$ points of pressure ($\textrm{ Pa}$)-measurements of $5\textrm{ s}$) and use a function in MATLAB, in order to filter the signal in each each 1/3 octave band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9nM11.png&quot; alt=&quot;1/3 Octave Bank Filter&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then, the program calculates the RMS value of the OUTPUT (after filtering). And this is the value that represents each frequency band.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, I use the same expression used before to calculate the Magnitude in $\textrm{ dB}$ for each 1/3 Octave band. $10\log_{10}\left(  \dfrac{p^2}{p_0^2} \right)$, where $p_0$ is $2\cdot 10^{-6}\textrm{ Pa}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/H09KM.png&quot; alt=&quot;1/3 Octave Spectrum&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The thing is the obtained 1/3 Octave is lower then $0\textrm{ dB}$ and this doesn't make sense once I can hear the noise when I run the device, moreover it doesn't make sense to calculate the loudness following the ISO 532 B if we have negative third octave bands. &#xA;It seems like the pressure that I have in time domain that is higher then the reference pressure somehow is attenuated and gets lower than the reference pressure after filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know what I am doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="9034" LastEditorUserId="1629" LastEditDate="2016-06-16T16:05:51.807" LastActivityDate="2021-04-08T19:00:50.113" Title="1/3 Octave Analysis" Tags="|filters|frequency-spectrum|signal-analysis|power-spectral-density|" AnswerCount="3" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="16539" PostTypeId="2" ParentId="16522" CreationDate="2014-05-27T09:55:10.427" Score="1" Body="&lt;p&gt;Your code displays a common misconception of fundamental frequency i.e. assuming the frequency of greatest magnitude is the fundamental. If you google 'the missing fundamental problem' you will soon realise this is not the case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Autocorrelation or summary autocorrelation are the way to go for this problem.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2014-05-27T09:55:10.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16540" PostTypeId="1" CreationDate="2014-05-27T10:33:22.867" Score="6" ViewCount="13174" Body="&lt;p&gt;My input signal is phase vector. I want to differentiate it to get frequency vector. My input signal is somewhat noisy. Here is the input signal.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5nqBj.png&quot; alt=&quot;Input signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the derivative of the input signal as calculated using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;diff(inputSig)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rsObi.png&quot; alt=&quot;Derrivative of input signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i differentiate this signal, I am not getting a smooth curve. &#xA;The output looks 'spikey'. I am guessing it is because of the noise in the input signal (is this 'derivative kick'?). How to avoid this and get a smooth derivative curve?&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="6940" LastEditDate="2014-05-27T10:40:17.637" LastActivityDate="2022-12-18T18:35:11.660" Title="Derivative of noisy signal" Tags="|filters|noise|smoothing|derivative|" AnswerCount="7" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16541" PostTypeId="1" CreationDate="2014-05-27T10:49:23.307" Score="3" ViewCount="522" Body="&lt;p&gt;I'm currently working on a library to generate synthetic fingerprints using the SFinGe method (by Maltoni, Maio and Cappelli) link :&lt;a href=&quot;http://biolab.csr.unibo.it/research.asp?organize=Activities&amp;amp;select=&amp;amp;selObj=12&amp;amp;pathSubj=111%7C%7C12&amp;amp;&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://biolab.csr.unibo.it/research.asp?organize=Activities&amp;amp;select=&amp;amp;selObj=12&amp;amp;pathSubj=111%7C%7C12&amp;amp;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the steps requires me to apply different gabor filters to an image, each pixel in the image have an orientation and a frequency associated, so the convolution is not done with one kernel over the entire image but the filter must change during the process depending on those attributes of the pixels, that way each pixel on the image is altered in a different way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply the filters this way, and convolve the image several times(you also have to binarize the image after each convolution) you obtain this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GbXHs.png&quot; alt=&quot;https://i.stack.imgur.com/GbXHs.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A master fingerprint, I have currently implemented the standard gabor filter using 2d convolution. I would like it to be faster, Im trying to separate the filter but the problems with separable ﬁltering is convolution in the complex domain. Im working on C++ usin openCV and Im not sure how to perform such convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now reading &lt;a href=&quot;http://cbcl.mit.edu/publications/ai-publications/2011/MIT-CSAIL-TR-2011-021.pdf&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;this&quot;&gt;this&lt;/a&gt; paper from a different &lt;a href=&quot;https://dsp.stackexchange.com/questions/13945/apply-singular-value-decomposition-on-gabor-filters/13946#13946&quot;&gt;answer&lt;/a&gt;, I saw an additional method, box ﬁlter approximation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qXhm7.png&quot; alt=&quot;https://i.stack.imgur.com/qXhm7.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now from reading the paper is not clear to me how to approximate the gabor filter using this method, what is B(x, y)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im not very knowledgeable in image processing (or mathematics). I would appreciate it a lot if someone could explain to me how this approximation works :).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also an important note, can this be done in a contextual matter? The way in which I have to apply the filter in order to generate the master fingerprint is that I have to witch the kernel in each step of the convolution according to some local properties of the current pixel being convolved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading!&lt;/p&gt;&#xA;" OwnerUserId="9036" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-05-27T10:49:23.307" Title="Box ﬁlter approximations for oriented gabor ﬁlters" Tags="|filters|image-processing|gabor|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16542" PostTypeId="2" ParentId="16540" CreationDate="2014-05-27T10:57:24.373" Score="1" Body="&lt;p&gt;Look into the &quot;Savitsky Golay Differentiation Filter&quot;&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-05-27T10:57:24.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16543" PostTypeId="2" ParentId="3192" CreationDate="2014-05-27T13:49:57.310" Score="10" Body="&lt;p&gt;This derivation is a tricky one. The approach suggested before has a flaw. Let me demonstrate this first; then I will give the correct solution.&lt;/p&gt;&#xA;&lt;p&gt;We wish to relate the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform of the downsampled signal, &lt;span class=&quot;math-container&quot;&gt;$Y_D(z) = \mathcal{Z}\{x[Mn]\}$&lt;/span&gt;, to the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform of the original signal &lt;span class=&quot;math-container&quot;&gt;$X(z) = \mathcal{Z}\{x[n]\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h1&gt;The wrong way&lt;/h1&gt;&#xA;&lt;p&gt;One could think of simply plugging the expression for the downsampled signal into the expression of the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y_D(z) = \sum\limits_{n=-\infty}^{+\infty}{x[Mn] z^{-n}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A change of variable &lt;span class=&quot;math-container&quot;&gt;$n'=Mn$&lt;/span&gt; seems obvious:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y_D(z) = \sum\limits_{n' \in M\mathbb{Z}}{x[n'] z^{-n'/M}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, it is important to realize that even though the new summation index &lt;span class=&quot;math-container&quot;&gt;$n'$&lt;/span&gt; still runs from &lt;span class=&quot;math-container&quot;&gt;$-\infty$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;, &lt;strong&gt;the sum is now over 1 out of M integer numbers&lt;/strong&gt;. In other words,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$n' \in M\mathbb{Z}=\{...,-2M,-M,0,M,2M,...\}$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;while the definition of the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform requires&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$n \in \{...,-2,-1,0,1,2,...\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since this is no longer a &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform, we &lt;strong&gt;cannot&lt;/strong&gt; write:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y_D(z) = X(z^{1/M})$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h1&gt;The right way&lt;/h1&gt;&#xA;&lt;p&gt;Let us first define a 'helper' impulse train signal &lt;span class=&quot;math-container&quot;&gt;$t_M[n]$&lt;/span&gt; as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{align*}&#xA;t_M[n]&#xA;&amp;amp; = \sum\limits_{k=-\infty}^{+\infty}{\delta[n-kM]} \\&#xA;&amp;amp; =&#xA;\left\{&#xA;     \begin{array}{lr}&#xA;       1 &amp;amp; : n \in M\mathbb{Z}\\&#xA;       0 &amp;amp; : n \notin M\mathbb{Z}&#xA;     \end{array}&#xA;   \right.&#xA;\end{align*}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This function is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; at one out of every &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; samples, and zero everywhere else.&lt;/p&gt;&#xA;&lt;p&gt;Equivalently, the pulse train function can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ t_M[n] = \frac{1}{M} \sum\limits_{k=0}^{M-1}{e^{j2\pi k n / M}} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof:&lt;/strong&gt; We need to consider separately the cases &lt;span class=&quot;math-container&quot;&gt;$n \in M\mathbb{Z}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n \notin M\mathbb{Z}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}&#xA; t_M[n] &#xA;&amp;amp; = \frac{1}{M} \sum\limits_{k=0}^{M-1}{e^{j2\pi k n / M}} \\&#xA;&amp;amp; = &#xA;\left\{&#xA;     \begin{array}{lr}&#xA;       \frac{1}{M} \sum\limits_{k=0}^{M-1}{1} &amp;amp;&amp;amp; : n \in M\mathbb{Z}\\&#xA;       \frac{1}{M} \frac{1-e^{j2\pi n}}{1-e^{j2\pi n / M}} &amp;amp;&amp;amp; : n \notin M\mathbb{Z}&#xA;     \end{array}&#xA;   \right. \\&#xA;&amp;amp; = &#xA;\left\{&#xA;     \begin{array}{lr}&#xA;       \frac{1}{M} M &amp;amp;&amp;amp; : n \in M\mathbb{Z}\\&#xA;       \frac{1}{M} \frac{1-1}{1-e^{j2\pi n / M}} &amp;amp;&amp;amp; : n \notin M\mathbb{Z}&#xA;     \end{array}&#xA;   \right. \\&#xA;&amp;amp; = &#xA;\left\{&#xA;     \begin{array}{lr}&#xA;       1 &amp;amp;&amp;amp; : n \in M\mathbb{Z}\\&#xA;       0 &amp;amp;&amp;amp; : n \notin M\mathbb{Z}&#xA;     \end{array}&#xA;   \right. &#xA;\end{align*}$$&lt;/span&gt;&#xA;In the case &lt;span class=&quot;math-container&quot;&gt;$n \notin M\mathbb{Z}$&lt;/span&gt;, we used the expression for &lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_geometric_series#Geometric_series&quot; rel=&quot;nofollow noreferrer&quot;&gt;the finite sum of a geometric series&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now let's go back to our original problem of finding the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform of a downsampler:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y_D(z) = \sum\limits_{n=-\infty}^{+\infty}{x[Mn] z^{-n}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We apply the substitution &lt;span class=&quot;math-container&quot;&gt;$n'=Mn$&lt;/span&gt;, keeping in mind that this makes the summation run only over integer multiples of M:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y_D(z) = \sum\limits_{n' \in M\mathbb{Z}}{x[n'] z^{-n'/M}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can now use the above impulse train function to safely rewrite this as a summation over all &lt;span class=&quot;math-container&quot;&gt;$n \in \mathbb{Z}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y_D(z) = \sum\limits_{n=-\infty}^{+\infty}{t_M[n] x[n] z^{-n/M}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using the above formulation for the impulse train function as a finite sum of exponentials, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{align*}&#xA;Y_D(z) &#xA;&amp;amp;= \sum\limits_{n=-\infty}^{+\infty}{(\frac{1}{M} \sum\limits_{k=0}^{M-1}{e^{j2\pi k n / M}}) x[n] z^{-n/M}} \\&#xA;&amp;amp;= \frac{1}{M} \sum\limits_{k=0}^{M-1}{\sum\limits_{n=-\infty}^{+\infty}{e^{j2\pi k n / M} x[n] z^{-n/M}}} \\&#xA;&amp;amp;= \frac{1}{M} \sum\limits_{k=0}^{M-1}{\sum\limits_{n=-\infty}^{+\infty}{x[n] (e^{-j2\pi k / M} z^{1/M})^{-n}}}&#xA;\end{align*}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The summation on the right &lt;em&gt;is&lt;/em&gt; a summation over all integers, and is therefore a valid &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform in terms of &lt;span class=&quot;math-container&quot;&gt;$z'=e^{-j2\pi k / M} z^{1/M}$&lt;/span&gt;. Therefore, we can write:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;Y_D(z) = \frac{1}{M} \sum\limits_{k=0}^{M-1}{X(e^{-j2\pi k / M} z^{1/M})}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the formula for the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform of a downsampler.&lt;/p&gt;&#xA;" OwnerUserId="9037" LastEditorUserId="54799" LastEditDate="2020-12-24T14:57:15.003" LastActivityDate="2020-12-24T14:57:15.003" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16544" PostTypeId="2" ParentId="8432" CreationDate="2014-05-27T14:15:08.880" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it correct to return the maximum autocorrelation value divide by 2 as the fundamental frequency? I keep getting wrong answers when I do that. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No.  The position of the peak of the autocorrelation (&lt;code&gt;argmax(autocorrelation_values)&lt;/code&gt;) is the &lt;em&gt;period&lt;/em&gt; of the waveform (often written &lt;em&gt;T&lt;/em&gt;), in samples, so to convert to a frequency in Hz, for instance, you would do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f = \frac{f_\mathrm{s}}{T}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;fs&lt;/em&gt; is samples/second, and &lt;em&gt;T&lt;/em&gt; is samples/cycle, so divided you get cycles/second = Hz.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2014-05-27T14:15:08.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16545" PostTypeId="2" ParentId="16528" CreationDate="2014-05-27T15:33:06.277" Score="1" Body="&lt;p&gt;Time/frequency uncertainty is a property of the meanings or definitions attached to the terms &quot;time&quot; localization and &quot;frequency&quot; estimation.  It also alludes to some apriori knowledge, or lack of it, about the characteristics of the signal in question.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-05-27T15:33:06.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16546" PostTypeId="2" ParentId="16528" CreationDate="2014-05-27T15:33:33.180" Score="0" Body="&lt;p&gt;Assuming this a a real-world signal, the inevitable presence of noise will to some degree result in uncertainty. Anything beyond the Nyquist of a Fourier transform is not modeled and therefore by definition there is uncertainty about higher frequency components of the signal. For the real world signal, Gabor uncertainty probably has to exist because even if localization in time is possible, there is a limit beyond which localization of phase or frequency is impossible. Separately, as frequency can only be measured within a window of time, there will always be a degree of limitation beyond which only time or frequency can be accurately measured, and not both.&lt;/p&gt;&#xA;" OwnerUserId="9039" LastActivityDate="2014-05-27T15:33:33.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16547" PostTypeId="1" AcceptedAnswerId="16548" CreationDate="2014-05-27T15:48:59.113" Score="1" ViewCount="11483" Body="&lt;p&gt;I am trying to recover my baseband signal that was AM modulated. I am using the filter command in MATLAB to perform the low pass filtering ...the code is given below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fsig=10;                    Fc=100;              Fsamp=10.*Fc;&#xA;t = 0:1/Fsamp:2*pi;&#xA;&#xA;Tx = cos(2.*pi.*Fsig.*t);               % Transmitted Signal&#xA;Carrier = cos(600.*t);                  % Carrier Signal&#xA;Modulated = Tx.*Carrier;                % Modulated Signal&#xA;Demodulated = Modulated.*Carrier;       % Demodulated Signal&#xA;&#xA;Rx= filter([1 1],[1 -0.8],Demodulated);&#xA;&#xA;figure(6);&#xA;plot(t,Tx,'r',t,Modulated,'b',t,Demodulated,'g',t,Rx,'k','LineWidth',1.5); grid on;&#xA;legend('Trans.','Modulated','Demodulated','Baseband')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I select the coefficients of the filter to perfectly recover my baseband signal?&#xA;Is there any other technique/command that can be used in matlab to recover the baseband signal other than this?&lt;/p&gt;&#xA;" OwnerUserId="8504" LastActivityDate="2014-10-01T22:41:28.267" Title="Low Pass Filter in AM Demodulation" Tags="|matlab|filters|fourier-transform|filter-design|digital-communications|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16548" PostTypeId="2" ParentId="16547" CreationDate="2014-05-27T16:15:13.623" Score="1" Body="&lt;p&gt;MATLAB has &lt;code&gt;amdemod&lt;/code&gt; (see &lt;a href=&quot;http://www.mathworks.com/help/comm/ref/amdemod.html&quot; rel=&quot;nofollow&quot;&gt;MATLAB documentation&lt;/a&gt;) which can be used to recover suppressed carrier AM modulated signal. From the documentation, the demodulator uses a low-pass filter generated using &lt;code&gt;[num,den] = butter(5,Fc*2/Fs)&lt;/code&gt;. This can be a good start.&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2014-05-27T16:15:13.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16549" PostTypeId="1" AcceptedAnswerId="16551" CreationDate="2014-05-27T17:22:40.480" Score="0" ViewCount="6872" Body="&lt;p&gt;Please Help, I have a white noise signal that I created and need help to apply the Short-time fourier transform to my code so that it can do the bandpass filtering. I am trying to put it in the code so that I don't have to use the FDA tool. Also be able to plot the graphs from the output of the STFT being applied.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = 5000; %Sample length for the random signal&#xA;Pause = 10000; %Sample Pause Gap&#xA;mu = 0;&#xA;sigma = 2;&#xA;&#xA;%Need to see left signal is not displaying&#xA;Left_signal = sigma*randn(L,1) + mu;&#xA;Right_signal = sigma*randn(L,1) + mu;&#xA;&#xA;Long_signal = [Left_signal zeros(L,1); zeros(Pause,2); zeros(L,1) Right_signal];&#xA;&#xA;%Plots subplots in graph&#xA;figure&#xA;subplot(211);&#xA;plot(Left_signal, 'b'); grid on;&#xA;subplot(212);&#xA;plot(Right_signal, 'r'); grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2018-12-16T20:18:17.603" Title="how to apply Short-time fourier transform to code in matlab" Tags="|matlab|filters|discrete-signals|signal-analysis|sound|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16551" PostTypeId="2" ParentId="16549" CreationDate="2014-05-27T19:23:59.737" Score="2" Body="&lt;p&gt;this is very simplistic, but it &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;inputs a wav file and uses only one channel of it&lt;/li&gt;&#xA;&lt;li&gt;breaks it up into windowed frames,&lt;/li&gt;&#xA;&lt;li&gt;transforms it to the frequency domain,&lt;/li&gt;&#xA;&lt;li&gt;does nothing to it in the frequency domain,&lt;/li&gt;&#xA;&lt;li&gt;transforms back to the time domain, &lt;/li&gt;&#xA;&lt;li&gt;overlap-adds that frame back into a time-domain array, and &lt;/li&gt;&#xA;&lt;li&gt;eventually writes it back out to a different .wave file.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;try it out.  can't guarantee there ain't typos.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;if ~exist('inFile')&#xA;    inFile = 'input.wav';&#xA;end&#xA;&#xA;if ~exist('outFile')&#xA;    outFile = 'output.wav';&#xA;end&#xA;&#xA;if ~exist('frameWidth')&#xA;    frameWidth = 4096;          % size of FFT frame, better be a power of 2&#xA;end&#xA;frameHop = frameWidth/2;&#xA;&#xA;analWindow = hanning(frameWidth);&#xA;&#xA;[inBuffer, Fs] = wavread(inFile);&#xA;&#xA;x = [inBuffer(:,1); linspace(0, 0, frameWidth)'];                   % use left channel only, zeropad one frame at the end&#xA;&#xA;clear inBuffer;&#xA;&#xA;numSamples = length(x);&#xA;&#xA;numFrames = floor((numSamples-frameWidth)/frameHop);&#xA;&#xA;y = linspace(0, 0, numSamples)';&#xA;&#xA;&#xA;n = 0;                              % init sample pointer.  unlike MATLAB, i like counting from 0&#xA;&#xA;for frameIndex = 1:numFrames&#xA;&#xA;     xWindowed = x(n+1:n+frameWidth) .* analWindow;     % get and window the input audio frame&#xA;&#xA;     X = fft(fftshift(xWindowed));              % do the FFT&#xA;&#xA;     Y = X;                         % copy the input spectrum to output&#xA;&#xA;                                % do whatever processing to Y that you like&#xA;&#xA;     yWindowed = fftshift(real(ifft(Y)));           % convert back to time domain, toss the imaginary part&#xA;&#xA;     y(n+1:n+frameWidth) = y(n+1:n+frameWidth) + yWindowed;&#xA;&#xA;     n = n + frameHop;&#xA;end&#xA;&#xA;wavwrite(y, Fs, outFile);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-07-13T03:08:28.403" LastActivityDate="2014-07-13T03:08:28.403" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16552" PostTypeId="2" ParentId="16538" CreationDate="2014-05-27T20:49:27.347" Score="1" Body="&lt;p&gt;My guess would be that $p_0$ is a constant pressure, you shouldn't assume that it's spread out across all bins of your DFT. In fact, it's only going to contribute to the 0 Hz frequency component. If you look at the spectrum of a signal which has nothing but constant pressure, this should give you a benchmark you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, since this is the entire energy of your idle signal, the the sum of square magnitudes of your spectrum should add up to $p_0^2$, but not every bin individually. In other words, it looks like your comparing energy of each bin separately to the energy of the &lt;em&gt;entire&lt;/em&gt; baseline noise signal, so I would indeed expect things to go below 0 most places.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-05-27T20:49:27.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16553" PostTypeId="1" AcceptedAnswerId="16573" CreationDate="2014-05-27T20:51:50.233" Score="4" ViewCount="132" Body="&lt;p&gt;Say I have an exponential smoothing for certain $\Delta t$, $t_{i+1} = t_i + \Delta t$. In this sampling, I choose a particular $\alpha$ to &lt;em&gt;filter&lt;/em&gt; signal $z_i$ like&#xA;$$&#xA;v_1 = z_0 \\&#xA;v_{i+1} = \alpha\:z_i + (1-\alpha)\:v_i  &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we have some sort of agreement as to what $\alpha$ to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, someone comes along and tells me that I am able to get, say, five times more samples in the same $\Delta t$ period. I need to modify the smoothing factor $\alpha$. It seems to me, intuitively, that the new factor, say $\alpha'$, that has the same &lt;em&gt;discount effect&lt;/em&gt; for previous values but with five times more &lt;em&gt;iterations&lt;/em&gt; should be&#xA;$$&#xA;(1-\alpha')^5 = 1-\alpha&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this correct? Is there any principled approaches to justify this?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The formula above seems sensible in the sense that the original &lt;em&gt;asymptotic&lt;/em&gt; variance (for a constant model) &#xA;$$&#xA;\mathbb{V}ar[v] \to \frac{\alpha}{2-\alpha} \sigma^2&#xA;$$&#xA;becomes&#xA;$$&#xA;\mathbb{V}ar[v'] \to \frac{\alpha'}{2-\alpha'} \sigma^2&#xA;$$&#xA;which, under the equation above, is actually smaller (I checked this). This makes sense as more data would give more precision for $v_t$ as &lt;em&gt;estimator&lt;/em&gt; of a constant $z_t = k + \epsilon$, where $\epsilon \sim \mathcal{N}(0,\sigma)$.&lt;/p&gt;&#xA;" OwnerUserId="9042" LastEditorUserId="9042" LastEditDate="2014-05-28T02:21:12.897" LastActivityDate="2014-05-28T20:24:00.047" Title="oversampled coefficient for existing exponential smoothing" Tags="|sampling|smoothing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16554" PostTypeId="2" ParentId="16540" CreationDate="2014-05-27T21:06:02.760" Score="1" Body="&lt;p&gt;You can find the wavelet transform, and use derivatives of wavelets. In this spirit, there is a procedure to directly calculate derivatives based on them.&lt;/p&gt;&#xA;&lt;p&gt;The beauty of the wavelet transform is that you should be able to discard high-frequency components, theoretically coming from the underlying noise and sampling rate.&lt;/p&gt;&#xA;&lt;p&gt;If you can get your hands on &lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S0169743903001370&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://ieeexplore.ieee.org/document/721435&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, for example, you should be able to apply them.&lt;/p&gt;&#xA;" OwnerUserId="9042" LastEditorUserId="7092" LastEditDate="2022-06-30T12:14:29.290" LastActivityDate="2022-06-30T12:14:29.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16555" PostTypeId="1" CreationDate="2014-05-28T00:04:27.150" Score="0" ViewCount="1679" Body="&lt;p&gt;I'm trying to generate sounds as described in a scientific paper that I found on the Internet.&#xA;What I need to do is to generate simple tones in a certain pattern, however I have some issues understanding how to do this correctly.&#xA;The attached image contains the full description of the method. I'm stuck at  &quot;Thirteen tones of this sound ..&quot; .I'm confused about how this thirteen tones are selected and how to arrange them correctly.&#xA;If anyone could provide some help, it would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZJRXy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function testaudio()&#xA;&#xA;sampleRate = 44100;&#xA;duration  = 0.5;&#xA;freqs = [100 200 300 400 500 600 700 800 900 1000 1100 1200];&#xA;&#xA;[signal t] = generateTone(freqs, sampleRate, duration);&#xA;sound(signal, sampleRate);&#xA;&#xA;%generates a tone (pure or complex)&#xA;function [y t] = generateTone(freqs, sampleRate, duration)&#xA;    timeSamples = duration * sampleRate;&#xA;&#xA;    t = linspace(0, duration, timeSamples);&#xA;    y = zeros(size(t));&#xA;    env = generateEnvelope(t);&#xA;&#xA;    for i=1:length(freqs)&#xA;        temp = env.*sin(2*pi*freqs(i)*t);&#xA;        y = y + temp;&#xA;    end&#xA;&#xA;&#xA;    % amplitude normalisation&#xA;    y = y' / max(abs(y));&#xA;&#xA;end&#xA;&#xA;function y = generateEnvelope(t, alfa)&#xA;    alfa = 1;&#xA;    y = (-t.^alfa) .* log(t./max(t));&#xA;    y(1) = 0;&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9044" LastActivityDate="2014-05-28T15:05:57.813" Title="Tone generation in Matlab (scientific paper)" Tags="|matlab|tone-generation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16557" PostTypeId="2" ParentId="8432" CreationDate="2014-05-28T03:16:59.020" Score="3" Body="&lt;p&gt;there are two more issues to worry about so that you choose the &lt;strong&gt;correct&lt;/strong&gt; peak which corresponds to the local period in a quasi-periodic waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;first, if you are using FFT -&gt; magnitude squared -&gt; inverse FFT to get the autocorrelation, your FFT length needs to be twice the length of the segment of signal which is zero-padded of equal length.  this is necessary to prevent time-aliasing due to the circular convolution that occurs when using this technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now that is windowing with a rectangular window and the consequence of that is that the autocorrelation will be governed by an envelope that is a triangular function.  so, even where there is a perfect correlation, the apparent autocorrelation at that lag does not rise to the level of lag 0.  but this effect can be compensated, if you're careful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the second issue, which is sorta the opposite problem of the first, is that if a lag of one period results in high autocorrelation, so also is a lag of two periods or three periods.  actually two periods &lt;strong&gt;can&lt;/strong&gt; be viewed as a single period of a periodic waveform (it's just that all odd harmonics would be zero).  and numerical issues might make that second peak &lt;em&gt;slightly&lt;/em&gt; higher than the first and you'll pick the wrong peak.  so you may need to do something that emphasizes the first peak &lt;em&gt;slightly&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-05-28T03:16:59.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16558" PostTypeId="1" AcceptedAnswerId="35080" CreationDate="2014-05-28T03:49:48.127" Score="5" ViewCount="3618" Body="&lt;p&gt;I have two signals sampled at $100\textrm{ Hz}$ during $3\textrm{ seconds}$. So I have $300$ sample points at each signal series. &#xA;I want to calculate coherence values between these two time series and would like to know whether this coherence value is statistically significant. I found two resources online. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;a href=&quot;http://journals.ametsoc.org/doi/pdf/10.1175/1520-0469%281979%29036%3C2020%3ACSL%3E2.0.CO%3B2&quot; rel=&quot;nofollow&quot;&gt;the first resource&lt;/a&gt;, there is a parameter $n$ (it is the sample size as I could interpret). A significant coherence value for that $n$ is:&#xA;$$c = \sqrt{1-\alpha^{1/(n-1)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this formula does not include any frequency component, unless $n$ is related to frequency instead of sample size.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;a href=&quot;http://pmc.ucsc.edu/~dmk/notes/cohere_signif/&quot; rel=&quot;nofollow&quot;&gt;the second resource&lt;/a&gt;, the function returns degree of freedom and significance level at each frequency. However I am not sure whether this function returns the correct computation or not. Besides I couldn't interpret the results of this function. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; How can I find the significance of my computed coherence value at a certain frequency (or frequency band) preferably using MATLAB in the light of the above resources?&lt;/p&gt;&#xA;" OwnerUserId="9046" LastEditorUserId="1629" LastEditDate="2016-06-07T13:31:18.543" LastActivityDate="2020-12-21T21:09:35.783" Title="Statistical significance of coherence values" Tags="|coherence|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16559" PostTypeId="1" AcceptedAnswerId="16646" CreationDate="2014-05-28T08:54:01.287" Score="3" ViewCount="132" Body="&lt;p&gt;i know that texture refers to surface characteristics and appearance of an object given by the size, shape, density, arrangement, proportion of its elementary parts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But i am more interested in dynamic textures.&lt;/strong&gt;&#xA; Can anyone give me information about what are Dynamic Textures? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;also in papers it is written that they exhibits some stationarity properties. but what do you mean by the stationarity property regarding dynamic textures?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="9035" LastEditDate="2014-07-03T11:37:33.957" LastActivityDate="2014-07-03T11:37:33.957" Title="Dynamic Textures" Tags="|matlab|computer-vision|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16560" PostTypeId="1" AcceptedAnswerId="16561" CreationDate="2014-05-28T09:18:03.077" Score="2" ViewCount="1584" Body="&lt;p&gt;I am trying to design a low pass filter to apply before resampling the sensor's output at a lower rate, however I am not quite sure how to choose between the IIR and FIR fitlers. Matlab by default, filters the data with an 8th order Chebyshev Type I lowpass filter with&#xA;cutoff frequency .8*(Fs/2)/R, before resampling. but how can I choose the best low pass filter type ? &lt;/p&gt;&#xA;" OwnerUserId="9047" LastEditorUserId="39" LastEditDate="2014-05-28T10:10:37.543" LastActivityDate="2014-05-28T10:10:37.543" Title="IIR/FIR filtering before decimation?" Tags="|filters|decimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16561" PostTypeId="2" ParentId="16560" CreationDate="2014-05-28T09:47:53.660" Score="3" Body="&lt;p&gt;It depends on your specification really. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're decimating, some degree of aliasing will occur. Your tolerance of this aliasing, signal delay, and changes in the phase response of your input signal will determine the best approach to take.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very long FIR might provide a very steep cutoff and linear phase performance (depending on design), but will delay the signal (group delay), may cause pre-ringing and can be computationally demanding. FIRs however also allow for elegant 'polyphase' implementations (which reduce computational demand by effectively breaking the filter down into smaller component filters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IIRs on the other hand have the potential to have a shorter delay, at the expense of a non linear phase response and perhaps a more shallow roll-off. You could achieve a steep rolloff with an IIR but it would likely be quite high order and hence susceptible to coefficient quantisation and/or stability problems.&lt;/p&gt;&#xA;" OwnerUserId="369" LastActivityDate="2014-05-28T09:47:53.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16562" PostTypeId="1" AcceptedAnswerId="16571" CreationDate="2014-05-28T10:21:06.873" Score="1" ViewCount="3409" Body="&lt;p&gt;What is the transfer function of a line, can i ignore it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gZFH8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After simplification i got the diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DDLJz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what to do with the empty feedback&lt;/p&gt;&#xA;" OwnerUserId="8855" LastEditorUserId="8855" LastEditDate="2014-05-28T11:47:22.797" LastActivityDate="2021-10-13T16:04:45.533" Title="Block diagram transfer function of a line" Tags="|transfer-function|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16565" PostTypeId="1" CreationDate="2014-05-28T11:11:13.067" Score="1" ViewCount="945" Body="&lt;p&gt;How do I set the frequency for a low pass filter illustrated below? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/szOIn.png&quot; alt=&quot;Band Pass Filter&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8942" LastEditorUserId="26573" LastEditDate="2019-01-08T20:03:05.587" LastActivityDate="2019-01-08T20:03:05.587" Title="How to set the frequency cut-off for a low pass RC filter?" Tags="|lowpass-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16566" PostTypeId="2" ParentId="16565" CreationDate="2014-05-28T11:33:53.770" Score="4" Body="&lt;p&gt;You probably know that the frequency response of this first order low-pass filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=\frac{1}{1+j\omega RC}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now compute its magnitude&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(\omega)|=\frac{1}{\sqrt{1+\omega^2R^2C^2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to find the 3-dB cut-off point $\omega_0$, you have to solve $|H(\omega_0)|=1/\sqrt{2}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{\sqrt{1+\omega_0^2R^2C^2}}=\frac{1}{\sqrt{2}}\Rightarrow&#xA;\omega_0=\frac{1}{RC}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since the frequency in Hertz is $f=\omega/2\pi$, you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_0=\frac{1}{2\pi RC}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-28T11:33:53.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16567" PostTypeId="2" ParentId="16565" CreationDate="2014-05-28T12:25:32.787" Score="1" Body="&lt;p&gt;To set cut-off frequency, design $R$ and $C$ values such that $$f_c = \frac{1}{2\pi RC}$$$$\small{\text{(see Matt's answer to see how this equation is obtained)}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming a standard value for capacitor and then calculating the value for $R$ as, $$R=\frac{1}{2\pi f_cC}$$ is the usual method followed. &lt;/p&gt;&#xA;" OwnerUserId="8871" LastEditorUserId="8871" LastEditDate="2014-05-28T12:31:09.713" LastActivityDate="2014-05-28T12:31:09.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16568" PostTypeId="2" ParentId="16555" CreationDate="2014-05-28T15:05:57.813" Score="1" Body="&lt;p&gt;The section on 12 added sidetones is referring to something different to the section on thirteen notes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In regards to 13 notes: By diatonic I think the mean a diatonic musical scale, with the lowest note at 148.83Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this site:  &lt;a href=&quot;http://www.phy.mtu.edu/~suits/notefreq446.html&quot; rel=&quot;nofollow&quot;&gt;http://www.phy.mtu.edu/~suits/notefreq446.html&lt;/a&gt;   148.83Hz is note $D_3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would choose 13 consecutive notes in the D-scale starting with $D_3$. The notes are played according to Figure 1. Each note lasts 8.40s/72 = 7/60 s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the notes look equally spaced in frequency in Figure 1. So I think they might mean a chromatic scale with equal temperament. That would make more sense as the 13th note would be one octave above the first note, and each note would be $^{12}\sqrt{2}$ apart. Code then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;low_note = 148.83;&#xA;notes = low_note .* nthroot(2,12).^(0:1:12);&#xA;&#xA;signal = [];&#xA;&#xA;% First section&#xA;for k = 1:12&#xA;    signal = [signal, generateTone(notes(13-k+1), 44100, 7/60); % High note&#xA;    signal = [signal, generateTone(notes(k), 44100, 7/60); % Low note&#xA;end&#xA;% Second section&#xA;for k = 13:-1:2    % Reverse&#xA;    signal = [signal, generateTone(notes(13-k+1), 44100, 7/60); % High note&#xA;    signal = [signal, generateTone(notes(k), 44100, 7/60); % Low note&#xA;end&#xA;% Third section&#xA;for k = 1:12&#xA;    signal = [signal, generateTone(notes(13-k+1), 44100, 7/60); % High note&#xA;    signal = [signal, generateTone(notes(k), 44100, 7/60); % Low note&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-05-28T15:05:57.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16569" PostTypeId="2" ParentId="16196" CreationDate="2014-05-28T15:21:32.183" Score="6" Body="&lt;p&gt;The basic concept of OFDM is to divide a high-bitrate datastream into $N$ low-bitrate datastreams and to multiplex these low-bitrate datastreams in frequency. That is, every datastream is assigned to a distinct frequency band (so-called subcarrier) that does not interfere with the other frequency bands. Orthogonality allows the frequency bands to be packed close together which increases the spectral efficiency of OFDM. As it turns out the frequency multiplex can be implemented very efficiently using the IFFT algorithm that transforms a frequency-domain signal into a time-domain signal. Every $N$ complex QAM symbols are one input vector to the IFFT which produces a vector of $N$ time-domain samples that are then transmitted sequentially over the channel. The construction of the transmit signal in frequency domain has several advantages:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fast fading channels (often the case for multipath mobile channels) might significantly attenuate some frequencies. OFDM enables adaption to such a channel by switching off some subcarriers or decreasing the modulation order on the respective subcarriers.&lt;/li&gt;&#xA;&lt;li&gt;Usage of cyclic prefix as guard interval makes channel equalization easy to implement.&lt;/li&gt;&#xA;&lt;li&gt;Dynamic resource allocation is possible (see LTE uplink)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Your suggestion to take $N$ QAM symbols, apply the FFT and then transmit the FFT output corresponds to transmitting the spectral analysis of some time-domain signal one bin per symbol interval. This is totally different from applying the IFFT and I don't see any advantage in doing so.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the reason for alamouti code to be implemented before IFFT? Can it also be implemented the way I thought after cyclic prefixer block?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let's assume we apply the Alamouti space time block code (STBC) after the cyclic prefix. Let $x_k$ be the discrete-time output of the cylcic prefix block. Then the coded signal vector is given by&#xA;$$&#xA;\mathbf{x} =&#xA;\left( &#xA;\begin{matrix}&#xA;  x_{k+1} &amp;amp; -x_k^*\\&#xA;  x_k     &amp;amp; x_{k+1}^*&#xA;\end{matrix}&#xA;\right)&#xA;$$&#xA;If we assume a perfect channel with channel matrix $\mathbf H = (1\quad1)$ and if we ignore noise, the received signal is&#xA;$$&#xA;\mathbf r = \mathbf H \mathbf x =&#xA;\left( &#xA;\begin{matrix}&#xA;  x_{k+1} + x_k &amp;amp; -x_k^* + x_{k+1}^*&#xA;\end{matrix}&#xA;\right)&#xA;$$&#xA;It is clear that we first have to decode $\mathbf r$ before we can demodulate it with the FFT. For doing so, the channel matrix has to be known. In general, the channel matrix is unknown at the receiver and thus has to be estimated. This channel estimation is done in frequency domain in OFDM systems, i. e. &lt;em&gt;after&lt;/em&gt; the FFT block. As a consequence the STBC decoder has to be placed after the FFT as can be seen from the following figure:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8NCen.png&quot; alt=&quot;Block diagram of OFDM system with Alamouti space-time block code&quot;&gt;&#xA;(Figure is taken from Kim, J et al.: &lt;em&gt;Receiver Designs for Alamouti Coded OFDM&#xA;Systems in Fast Fading Channels&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This in turn means that the STBC &lt;em&gt;encoder&lt;/em&gt; has to be placed &lt;em&gt;before&lt;/em&gt; the IFFT. &lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-05-28T15:21:32.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16571" PostTypeId="2" ParentId="16562" CreationDate="2014-05-28T15:49:44.923" Score="4" Body="&lt;p&gt;The transfer function of a line is 1.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And hence you can reduce your blocks into a single block with transfer function&#xA;$$\frac{C(s)}{R(s)} = \frac{G(s)}{1+G(s)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where, $$G(s) = \frac{K}{s(s+2)(s+3)+s}$$&lt;/p&gt;&#xA;" OwnerUserId="8871" LastActivityDate="2014-05-28T15:49:44.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16572" PostTypeId="1" CreationDate="2014-05-28T18:29:41.710" Score="1" ViewCount="135" Body="&lt;p&gt;This is the first time I'm posting a question on here so I hope I'm doing it right. I've tried searching on here for an answer but haven't found anything particularly relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some data collected from a line array of 32 hydrophones. I'm trying to estimate the power spectral density of the underwater noise at different tow speeds of the array using Welch's method. I think the noise should be approximately Gaussian, however on examination of the time series from each hydrophone, there are loud &quot;bangs&quot; occurring at random times on random hydrophones. The bangs are about 10 times the amplitude of most of the time-series values lasting for only fractions of a second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct in assuming that the &quot;bangs&quot; will distort the estimate of the spectrum? Will the averaging used in Welch's method help to overcome this and if so is there any way to quantify the effects? Or is there any way of removing the &quot;bangs&quot; without distorting the PSD too much?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have much formal background in signal processing so I apologise if the question is basic or lacking in information.&lt;/p&gt;&#xA;" OwnerUserId="9053" LastActivityDate="2014-05-28T18:29:41.710" Title="Spectral estimation from noisy time-series data" Tags="|frequency-spectrum|noise|estimation|power-spectral-density|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16573" PostTypeId="2" ParentId="16553" CreationDate="2014-05-28T20:24:00.047" Score="2" Body="&lt;p&gt;I think it's instructive to take a look at the impulse responses, taking absolute time into account. I'm assuming the following recursion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_n=\alpha x_n+(1-\alpha)y_{n-1}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impulse response corresponding to the recursive system described by (1) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_n=\alpha(1-\alpha)^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume now that we have a discrete-time system with sample interval $T$, and another one with sample interval $T^{\prime}=T/L$. Let $\beta=1-\alpha$, and let $\alpha^{\prime}$ and $\beta^{\prime}$ be the constants of the system with sample interval $T^{\prime}$. In order for the two systems to have the same time constant and the same scaling we require (considering a point in time $t_n=nT=nLT^{\prime}$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha\beta^{n}=\alpha^{\prime}{\beta^{\prime}}^{nL}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (2) we see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha=\alpha^{\prime},\quad \beta=\beta^{\prime L}\quad&#xA;\text{(i.e. $\beta^{\prime}\neq 1-\alpha^{\prime}$)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case the impulse response of the system with the higher sampling rate is simply an interpolated version of the other system's impulse response. Note that the condition on $\beta^{\prime}$ is the one that you came up with intuitively, and it is also the more important of the two because it affects the time constant of the system. The choice $\alpha=\alpha^{\prime}$ only affects the scaling and in this sense is secondary. Choosing $\alpha^{\prime}=1-\beta^{\prime}$ is of course also possible and just changes the scaling.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-28T20:24:00.047" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16574" PostTypeId="1" CreationDate="2014-05-28T21:38:23.643" Score="1" ViewCount="871" Body="&lt;p&gt;Assume I have a random process $X(t)$ that is white gaussian noise with psd $S(f)$.  Now, let's filter that noise through a LPF of bandwidth $B$.  How would I evaluate the following expression:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E[S(f_1)S(f_2)]$$&lt;/p&gt;&#xA;" OwnerUserId="9056" LastActivityDate="2014-05-29T00:49:49.890" Title="Expectation of product of Filtered White Gaussian Noise" Tags="|autocorrelation|gaussian|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16575" PostTypeId="1" CreationDate="2014-05-29T00:38:57.903" Score="1" ViewCount="4321" Body="&lt;p&gt;I am trying to use the example from &lt;a href=&quot;http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; to detect a stop sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I change the image to search for stop signs in there are a huge number of false positives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong? &lt;/p&gt;&#xA;" OwnerUserId="8919" LastEditorUserId="53" LastEditDate="2014-05-29T01:39:01.383" LastActivityDate="2015-03-25T10:31:32.510" Title="Train Cascade Object Detector example in MATLAB" Tags="|image-processing|matlab|computer-vision|matlab-cvst|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16576" PostTypeId="2" ParentId="16574" CreationDate="2014-05-29T00:49:49.890" Score="3" Body="&lt;p&gt;In general, for an input signal $x$ with power-spectrum density $S_x(f)$ passed through a linear-time-invariant (LTI) system with transfer function $H(f)$, the power-spectrum density of the output, $S_y(f)$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  \begin{align}&#xA;    S_y(f) &amp;amp;= S_x(f)\left|H(f)\right|^2&#xA;  \end{align}&#xA;$$&#xA;A complete derivation can be found in various textbooks (such as &quot;Communication Systems Engineering&quot;, by John G. Proakis and Masoud Salehi) and lecture notes (such as &lt;a href=&quot;http://www.idsc.ethz.ch/Courses/signals_and_systems/ArchiveFall10/lectureNotes8.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;these&lt;/a&gt;). Note that a consequence of this result for Gaussian noise is also quoted &lt;a href=&quot;https://dsp.stackexchange.com/questions/8629/variance-of-white-gaussian-noise&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if evaluating the output PSD at $f_1$ and $f_2$, we have&#xA;$$&#xA;  \begin{align}&#xA;    S_y(f_1) &amp;amp;= S_x(f_1)\left|H(f_1)\right|^2 \\&#xA;    S_y(f_2) &amp;amp;= S_x(f_2)\left|H(f_2)\right|^2&#xA;  \end{align}&#xA;$$&#xA;And consequently,&#xA;$$&#xA;  \begin{align}&#xA;    E[S_y(f_1)S_y(f_2)]&#xA;      &amp;amp;= S_y(f_1)S_y(f_2) \\&#xA;      &amp;amp;= S_x(f_1)S_x(f_2)\left|H(f_1)H(f_2)\right|^2&#xA;  \end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for an input consisting of white (or at least white over some finite observable bandwidth much greater than B) Gaussian noise with power-spectral density $N_0/2$, we get:&#xA;$$&#xA;  \begin{align}&#xA;    E[S_y(f_1)S_y(f_2)] &amp;amp;= \frac{1}{4} N_0^2\left|H(f_1)H(f_2)\right|^2&#xA;  \end{align}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-05-29T00:49:49.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16579" PostTypeId="2" ParentId="16575" CreationDate="2014-05-29T01:29:55.463" Score="2" Body="&lt;p&gt;You are not doing anything wrong.  This particular example is there for a quick illustration, and it does not produce a very good detector. It trains a 5-stage detector from a very small training set.  A decent detector may have 20 stages or more, and you would need thousands of positive samples and negative images to train it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at this &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/train-a-cascade-object-detector.html&quot; rel=&quot;nofollow&quot;&gt;tutorial&lt;/a&gt; for more information.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2014-05-29T01:38:42.277" LastActivityDate="2014-05-29T01:38:42.277" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16580" PostTypeId="5" CreationDate="2014-05-29T01:41:51.543" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2014-05-29T01:41:51.543" LastActivityDate="2014-05-29T01:41:51.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16581" PostTypeId="4" CreationDate="2014-05-29T01:41:51.543" Score="0" Body="In Matlab, the Computer Vision System Toolbox provides algorithms and tools for the design and simulation of computer vision and video processing systems. The algorithms include feature extraction, motion detection, object detection, object tracking, stereo vision, video processing, and video analysis. Tools include video file I/O, video display, drawing graphics, and compositing. " OwnerUserId="53" LastEditorUserId="53" LastEditDate="2014-05-29T12:00:09.540" LastActivityDate="2014-05-29T12:00:09.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16582" PostTypeId="1" CreationDate="2014-05-29T02:43:57.053" Score="0" ViewCount="675" Body="&lt;p&gt;This is an example from my text book of a continuous signal:&#xA;$$x_{in}(t)=\sin \left( 2\pi \cdot 1000 \cdot t\right) + 0.5\sin \left( 2\pi \cdot 2000 \cdot t + \dfrac{3\pi}{4} \right) $$&#xA;So to perform a fourier transform on this signal, how to do that, isn't it a bit funny, since it has two sine components. Shouldn't complex numbers have a sine term and a cosine term? And it's got a scalar term applied to only one component, don't those usually apply across both terms of a complex component? And it's phase shifted, what to do about that?&lt;/p&gt;&#xA;" OwnerDisplayName="user8769" LastEditorUserId="8202" LastEditDate="2014-05-29T08:07:30.817" LastActivityDate="2014-05-29T08:38:08.797" Title="Fourier Transform Form: two sin components &amp; a phase shift &amp; a magnitude for only one term" Tags="|fourier-transform|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16585" PostTypeId="2" ParentId="16582" CreationDate="2014-05-29T08:38:08.797" Score="4" Body="&lt;p&gt;Fourier Transform is a linear one, so you can make use of superposition principle:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathscr{F} [\alpha x(t) + \beta y(t)] = \alpha \mathscr{F}[x(t)] + \beta \mathscr{F}[y(t)] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for the &lt;strong&gt;first component&lt;/strong&gt; $$x(t) = \sin \left( 2\pi \cdot 1000 \cdot t\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by &lt;a href=&quot;http://www.mechmat.ethz.ch/Lectures/tables.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;definition&lt;/strong&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathscr{F}\left[\sin(2\pi f_0 t + \phi) \right] = \dfrac{i}{2} \left[ e^{-i \phi}\delta(f+f_0) - e^{i \phi}\delta(f-f_0) \right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathscr{F}[x(t)]=\dfrac{i}{2} \left[ \delta(f+1000) - \delta(f-1000) \right]  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second component&lt;/strong&gt; is a sinusoid with shifted phase, so the complex exponent represents that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = \dfrac{1}{2} \sin \left( 2\pi \cdot 2000 \cdot t + \dfrac{3\pi}{4} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has following Fourier Transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathscr{F}[y(t)] = \dfrac{1}{2}\dfrac{i}{2} \left[ e^{\dfrac{-3\pi i}{4}}\delta(f+2000) - e^{\dfrac{3\pi i}{4}}\delta(f-2000) \right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By summing both results you get the Fourier Transform of your signal.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-29T08:38:08.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16586" PostTypeId="1" AcceptedAnswerId="16587" CreationDate="2014-05-29T10:07:26.633" Score="43" ViewCount="167142" Body="&lt;p&gt;I have read many articles about DTFT and DFT but am not able to discern the difference between the two except for a few visible things like DTFT goes till infinity while DFT is only till &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt;. Can anyone please explain the difference and when to use what? Wiki says&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The DFT differs from the discrete-time Fourier transform (DTFT) in&#xA;that its input and output sequences are both finite; it is therefore&#xA;said to be the Fourier analysis of finite-domain (or periodic)&#xA;discrete-time functions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Is it the only difference?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;&lt;a href=&quot;http://complextoreal.com/wp-content/uploads/2013/04/fft5.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; article nicely explains the difference&lt;/p&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="50076" LastEditDate="2023-05-24T18:58:33.200" LastActivityDate="2024-01-30T21:35:19.820" Title="Difference between Discrete Time Fourier Transform and Discrete Fourier Transform" Tags="|discrete-signals|fourier-transform|dft|dtft|" AnswerCount="5" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16587" PostTypeId="2" ParentId="16586" CreationDate="2014-05-29T11:09:41.890" Score="24" Body="&lt;p&gt;The discrete-time Fourier transform (DTFT) is the (conventional) Fourier transform of a discrete-time signal. Its output is continous in frequency and periodic. Example: to find the spectrum of the sampled version $x(kT)$ of a continous-time signal $x(t)$ the DTFT can be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete Fourier transform (DFT) can be seen as the sampled version (in frequency-domain) of the DTFT output. It's used to calculate the frequency spectrum of a discrete-time signal with a computer, because computers can only handle a finite number of values. I would argue against the DFT output being finite. It is periodic as well and can therefore be continued infinitely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum it up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                DTFT                | DFT&#xA;       input    discrete, infinite  | discrete, finite *)&#xA;       output   contin., periodic   | discrete, finite *)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;*) A mathematical property of the DFT is that both its input and output are periodic with the DFT length $N$. That is, although the input vector to the DFT is finite in practice, it's only correct to say that the DFT is the sampled spectrum if the DFT input is thought to be periodic.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-06-01T12:44:48.283" LastActivityDate="2014-06-01T12:44:48.283" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="16588" PostTypeId="2" ParentId="14252" CreationDate="2014-05-29T12:43:27.603" Score="0" Body="&lt;p&gt;I don't know anything about Apple Accelerate, but one method that could work is auto-correlation. If there are echos within your data, correlating it with itself should reveal multiple peaks - a large one for the correlation of the signal with itself and smaller peaks for the correlation of the signal with its echos. This assumes that the echo is constant throughout your collect, and would probably be difficult to implement if you are trying to identify the echos in real time.&lt;/p&gt;&#xA;" OwnerUserId="4439" LastActivityDate="2014-05-29T12:43:27.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16589" PostTypeId="2" ParentId="14426" CreationDate="2014-05-29T14:02:59.720" Score="0" Body="&lt;p&gt;Take a look at these examples from the Computer Vision System Toolbox:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mathworks.com/help/vision/ug/sparse-3-d-reconstruction-from-multiple-views.html&quot; rel=&quot;nofollow&quot;&gt;Sparse 3-D Reconstruction From Multiple Views&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mathworks.com/help/vision/ug/stereo-vision.html&quot; rel=&quot;nofollow&quot;&gt;Stereo Calibration and Scene Reconstruction&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2014-10-13T15:14:08.863" LastActivityDate="2014-10-13T15:14:08.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16590" PostTypeId="1" CreationDate="2014-05-29T15:59:43.167" Score="9" ViewCount="9970" Body="&lt;p&gt;Can FFTW perform the FFT on data which is not uniform in time? I can't seem to find a straight-forward answer to this question anywhere online.&lt;/p&gt;&#xA;" OwnerUserId="9060" LastEditorUserId="128" LastEditDate="2019-10-10T06:27:18.527" LastActivityDate="2019-10-10T06:27:18.527" Title="Non Uniform FFT / DFT with FFTW?" Tags="|fft|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16591" PostTypeId="2" ParentId="16590" CreationDate="2014-05-29T16:11:06.660" Score="9" Body="&lt;p&gt;The answer is &lt;a href=&quot;http://en.wikipedia.org/wiki/Non-uniform_discrete_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Non-uniform discrete Fourier transform&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to take a look in here: &lt;a href=&quot;http://www-user.tu-chemnitz.de/~potts/nfft/&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;NFFT library&lt;/strong&gt;&lt;/a&gt;. Tutorial for that purpose: &lt;a href=&quot;https://www-user.tu-chemnitz.de/~potts/nfft/guide/nfft3.pdfl&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;NFFT 3.0 Tutorial&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also find a Python wrapper: &lt;a href=&quot;https://github.com/ghisvail/pyNFFT&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;pyNFFT&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The generalisations of the NFFT include&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;NNFFT - nonequispaced in time and frequency fast Fourier transform,&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;NFCT/NFST - nonequispaced fast (co)sine transform, &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;NSFFT - nonequispaced sparse fast Fourier transform, &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;FPT - fast polynomial transform, &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;NFSFT - nonequispaced fast spherical Fourier transform,&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;NFSOFT - nonequispaced fast Fourier transform on the rotation group&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The NFFT is a C subroutine library for computing the nonequispaced&#xA;  discrete Fourier transform (NDFT) in one or more dimensions, of&#xA;  arbitrary input size, and of complex data. New: A Matlab interface is&#xA;  part of the NFFT3. We believe that our library, which is free&#xA;  software, and based on  FFTW (FFTW 3.x) should become the NFFT library&#xA;  of choice for most applications.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-07-10T16:18:35.903" LastActivityDate="2014-07-10T16:18:35.903" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="16592" PostTypeId="1" AcceptedAnswerId="16593" CreationDate="2014-05-29T16:16:15.723" Score="1" ViewCount="196" Body="&lt;p&gt;I am aware that this a simple question, but I haven't been able to find a single reference that explains this situation. The system function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{1-(0.3)(1+j)D}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can one draw a block diagram with only real components to represent something that is complex?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{Y}{x}  = \frac{1}{1-(0.3)(1+j)D} \implies Y(1-(0.3)(1+j)D)=X$$&#xA;where $Y$ is the output and $X$ is the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore $$Y-DY(0.3)(1+j)=X \implies y[n]=0.3y[n-1](1+j)+x[n]$$&lt;/p&gt;&#xA;" OwnerUserId="9061" LastEditorUserId="9061" LastEditDate="2014-05-29T16:25:17.407" LastActivityDate="2014-05-29T17:28:49.863" Title="How to represent the following system function in a block diagram?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16593" PostTypeId="2" ParentId="16592" CreationDate="2014-05-29T16:29:48.623" Score="3" Body="&lt;p&gt;It is a simple first-order recursive system like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1AgAP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case $b[0]=1$, $b[1]=0$, and $a[1]=-0.3(1+j)$. Of course the coefficient is complex if your system is complex. What you can do is split the real and imaginary parts and get two real-valued systems. The output of one is the real part of the output signal $y[n]$, and the output of the other is the imaginary part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_R[n]=0.3y_R[n-1]-0.3y_I[n-1]+x_R[n]\\&#xA;y_I[n]=0.3y_R[n-1]+0.3y_I[n-1]+x_I[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y_R[n]$ and $y_I[n]$ are the real and imaginary parts of $y[n]$, respectively (and the same for $x[n]$). If the input signal is real-valued then of course $x_I[n]=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for general complex-valued systems also have a look at this figure from the textbook &lt;em&gt;Digital Communication&lt;/em&gt; by Lee and Messerschmitt:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qu3Ns.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-05-29T17:28:49.863" LastActivityDate="2014-05-29T17:28:49.863" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="16594" PostTypeId="1" CreationDate="2014-05-29T16:46:18.310" Score="2" ViewCount="165" Body="&lt;p&gt;Suppose I have two time series $A:=[0,0,0,4,5,6]$ and $B:=[1,2,3,4,5,6]$. I implement the following filter (with initial value at the first element):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f(t) = f(t-1) + \alpha*(f(t)-f(t-1))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\alpha \in [0,1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can use filtered values of $B$ to recover the filtered values of $A$? For example suppose I can store all historical filtered values of $B$ for any choice of $\alpha$ in memory, is it possible to reconstruct what the filtered values for $A$ would have been for some choice of $\alpha$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively this would involve subtracting the some filtered value(s) of $B$ at time step $3$ from the filtered value(s) of $B$ at time step $6$, to recover an approximation of $A$.&lt;/p&gt;&#xA;" OwnerUserId="9062" LastActivityDate="2015-05-25T01:34:29.563" Title="How to remove historical values from exponential filter" Tags="|filters|filter-design|lowpass-filter|moving-average|signal-synthesis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16595" PostTypeId="2" ParentId="16594" CreationDate="2014-05-29T17:29:54.867" Score="1" Body="&lt;p&gt;Yes. Your filter $f(t)$ is an &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory&quot; rel=&quot;nofollow&quot;&gt;LTI system&lt;/a&gt;, so you can use that to your advantage. Let:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C(t) = B(t) - A(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, if $y_A(t)$, $y_B(t)$, and $y_C(t)$ are the system's responses to $A(t)$, $B(t)$, and $C(t)$ as inputs, then you can straightforwardly do what you want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;A(t) = B(t) - C(t) \rightarrow y_A(t) = y_B(t) - y_C(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, pass $B(t)$ through the filter, then pass $C(t) = [1, 2, 3, 0, 0, 0]$ through the filter and find the difference between the two filter outputs. That's exactly what you would get if you passed $A(t)$ through the filter on its own.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-05-29T17:29:54.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16596" PostTypeId="1" AcceptedAnswerId="16599" CreationDate="2014-05-29T18:30:01.620" Score="5" ViewCount="6057" Body="&lt;p&gt;I am trying to calculate the autocorrelation function for the telegraph process, but I somehow don't get the right results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am calculating the correlation function of a signal X which can take values 0 and 1 by calculating the spectral density $S(\omega)=|FFT(X)|^2$. The autocorrelation function is then given by the inverse fft of the spectral density $iFFT[S(\omega)](\tau)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this the autocorrelation functions never drops down to zero for $\tau \rightarrow\infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed if I take a constant signal $X = 1$, the autocorrelation should be $0$. But if I use the steps mentioned above the autocorrelation function will give $1$ instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really don't understand this, could you explain why I get these results?&lt;/p&gt;&#xA;" OwnerUserId="9066" LastActivityDate="2014-05-30T22:07:33.953" Title="Autocorrelation of a telegraph process/constant signal" Tags="|autocorrelation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16597" PostTypeId="1" CreationDate="2014-05-29T18:32:16.533" Score="1" ViewCount="202" Body="&lt;p&gt;I understand how to relate bin numbers of FFT output to frequency when dealing with a uniform FFT. How does this process work with a non-uniform FFT?&lt;/p&gt;&#xA;" OwnerUserId="9060" LastActivityDate="2014-05-29T19:46:40.637" Title="Relating bin numbers to frequency non uniform fft" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16598" PostTypeId="2" ParentId="16597" CreationDate="2014-05-29T19:46:40.637" Score="1" Body="&lt;p&gt;The magic of NUFFT is that you create a (oversampled) grid of equally spaced points by performing the interpolation and convolution of your unevenly spaced data. This is mostly done by using Gaussians. After that you apply the Fast Fourier Transform and minimise the effects of the filter you applied previously. Although this method was described by Dutt &amp;amp; Rokhlin in 1993. Currently you can find other, like ones based on Multiresolutional Analysis and Least Square Interpolation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, &lt;strong&gt;you always end up with evenly spaced frequency bins&lt;/strong&gt; - there are no unevenly spaced frequency bins due to jitter in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to dig into math, then please refer to (among many others): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www-user.tu-chemnitz.de/~mpip/paper/Heraeus.pdf&quot; rel=&quot;nofollow&quot;&gt;Particle Simulation Based on Nonequispaced FFT&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathnet.or.kr/real/2008/11/JunYeopLee.pdf&quot; rel=&quot;nofollow&quot;&gt;NUFFT and MRI&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-05-29T19:46:40.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16599" PostTypeId="2" ParentId="16596" CreationDate="2014-05-29T21:31:20.827" Score="4" Body="&lt;p&gt;The random telegraph signal with parameter $\lambda$ is derived from a Poisson process&#xA;of arrival rate $\lambda$. In the Poisson process, the number of arrivals in $(t_1, t_2]$ is a Poisson random variable with parameter $\lambda(t_2-t_1)$. Consider &lt;em&gt;counting&lt;/em&gt; the&#xA;Poisson arrivals in $(0,\infty)$ with a digital counter whose least significant bit (LSB)&#xA;is $0$ or $1$ with equal probability at time $t=0$.  The random telegraph signal is just&#xA;a model for the value of the LSB, or rather for the value of $(-1)^{\text{LSB}}$ which&#xA;has value $+1$ or $-1$ according as the LSB is $0$ or $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The random telegraph signal is a random process (collection of random variables)&#xA;$\{X_t \colon 0 \leq t &amp;lt; \infty\}$ where each $X_t \in \{+1,-1\}$ and $X_0$ is equally likely to be $+1$ and $-1$. For any $t_2 &amp;gt; t_1 \geq 0$, the &lt;em&gt;number&lt;/em&gt; of arrivals in&#xA;$(t_1,t_2]$ is Poisson with parameter $\lambda(t_2-t_1)$ and thus is an&#xA;&lt;em&gt;even number&lt;/em&gt; with probability $\exp(-\lambda(t_2-t_1))\cosh(\lambda(t_2-t_1))&#xA;= \frac 12 + \frac 12 \exp(-2\lambda(t_2-t_1))$.&#xA;It follows that the LSB is in the same state at time $t_2$ as it was at &#xA;time $t_1$, that is, $X_{t_2} = X_{t_1}$ &#xA;with probability $\frac 12 + \frac 12\exp(-2\lambda(t_2-t_1))$ while $X_{t_2} = -X_{t_1}$ &#xA;with probability $\frac 12 - \frac 12\exp(-2\lambda(t_2-t_1))$. It is&#xA;readily verified that $P\{X_t = +1\} = P\{X_t = -1\} = \frac 12$ and so the&#xA;process has mean function $0$ while the autocorrelation&#xA;function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}R_X(t_1,t_2) &amp;amp;= E[X_{t_1}X_{t_2}]\\&#xA;&amp;amp;= (+1)\left[\frac 12 + \exp(-2\lambda(t_2-t_1))\right]&#xA;+ (-1)\left[\frac 12 - \exp(-2\lambda(t_2-t_1))\right]\\&#xA;&amp;amp;= \exp(-2\lambda(t_2-t_1))\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a function of the time difference only.  Thus&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The random telegraph signal is a zero-mean WSS process with&#xA;  autocorrelation function $R_X(\tau) =  E[X_tX_{t+\tau}]= \exp(-2\lambda \tau)$&#xA;  and its power spectral density is of the form of a Cauchy density&#xA;  function.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is worth emphasizing that if one takes a finite segment of an&#xA;actual &lt;em&gt;realization&lt;/em&gt; or &lt;em&gt;sample path&lt;/em&gt; of a random telegraph signal,&#xA;one does &lt;em&gt;not&lt;/em&gt; get the nice and smooth&#xA;autocorrelation function described above but rather a piecewise linear&#xA;function that decays away slowly.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, can we get any of this from a DFT?  The answer is that we could&#xA;get an approximate answer, but we need to take care in setting up&#xA;the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The random telegraph signal shifts back and forth between $+1$ and&#xA;$-1$ at random times.  Thus, when we take $N$ samples spaced $T$&#xA;seconds apart of a &lt;em&gt;realization&lt;/em&gt; of this signal, each sample value is &#xA;$+1$ and $-1$,&#xA;but since this is &lt;em&gt;not&lt;/em&gt; a band-limited signal, the samples cannot be&#xA;used to reconstruct the realization at all. Note also that unless&#xA;$T$ is carefully chosen to be quite small so that we can be virtually&#xA;certain (i.e. with very high probability)&#xA;that there is &lt;em&gt;at most&lt;/em&gt; one transition from $+1$ to $-1$ (or vice versa),&#xA;we will have missed a lot of the nuances (a.k.a transitions)&#xA;in the signal.  But, if $T$ is very very small and $N$ is very very large,&#xA;our time-domain vector will have reasonably long &lt;em&gt;runs&lt;/em&gt; of consecutive&#xA;$+1$s or consecutive $-1$s during which interval there are no&#xA;transitions at all.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Now, the autocorrelation function that we need&#xA;  is the &lt;em&gt;aperiodic&lt;/em&gt; autocorrelation function, and not the periodic&#xA;  autocorrelation function, and so we need to &lt;em&gt;zero-pad&lt;/em&gt; our signal&#xA;  vector of length $N$ with $N-1$ or more $0$s (say $N$ for&#xA;  concreteness) and compute the DFT of this vector of length $2N$.&#xA;  An FFT algorithm could be used for this. &lt;em&gt;Now&lt;/em&gt;  $|X[k]|^2$ will &#xA;  roughly resemble the Cauchy spectrum of the random telegraph&#xA;  signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-05-30T22:07:33.953" LastActivityDate="2014-05-30T22:07:33.953" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16600" PostTypeId="1" CreationDate="2014-05-29T22:21:43.573" Score="1" ViewCount="130" Body="&lt;p&gt;I have an difference image produced by substracting two images of a certain location taken a two different time steps. The resulting image of this operation shows a histogram with a very large peak centered a 0. Since this naturally can be identified with no-change between dates I interpret this as a difference image showing a very small amount of change. Yet by the magnitudes of the observations located at the tails; strong change. I would like to threshold this image to identify three classes: negative change, no-change and positive change. I have been experimenting with classical thresholding techniques (Otsus, Kapurs, Rosins, etc) applied to each of the sides of this unimodal distribution to achieve this. I beleive I am not getting to good results because these techniques are not designed for a very spikey &quot;distribution&quot; with very long tails. Can anyone propose a method that can be suitable for this problem or some sort of preprocessing of the original data (difference image) which can help me out on this? &lt;/p&gt;&#xA;" OwnerUserId="8346" LastEditorUserId="8346" LastEditDate="2014-05-30T14:52:31.137" LastActivityDate="2014-05-30T14:52:31.137" Title="Thresholding a difference image with a very high kurtosis" Tags="|image-processing|image-segmentation|thresholding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16601" PostTypeId="1" AcceptedAnswerId="16607" CreationDate="2014-05-30T04:02:06.957" Score="0" ViewCount="45" Body="&lt;p&gt;Let us say i have some digital data placed in a wav file by lpcm method. At a sampling rate of 44.1khz i can place 5.5kb of data per second of audio by choosing two amplitudes (quantas) for each sample: 0 and 255. I can now save this audio file on an analog media and can retrieve the original digital data easily later. My question is this: What is the maximum number of quanta I could have used instead of 2 in the beginning so as to guarantee the integrity of my digital data on an analog media?&lt;/p&gt;&#xA;" OwnerUserId="9069" LastActivityDate="2014-05-30T15:01:15.810" Title="Lpcm encoded data kept on an analog source" Tags="|analog|digitize|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16604" PostTypeId="2" ParentId="16600" CreationDate="2014-05-30T10:29:19.353" Score="1" Body="&lt;p&gt;The first thing that jumps to my mind is that you want to test if your data is significantly different from zero. Determining if it is positive or negative should be trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would set a threshold based on the standard deviation of the results. Anything greater than say $\pm2\sigma$ from the mean (zero) are considered to be significant changes. The suitable value of sigma to choose on how peaked your distribution is and how many and how big changes you expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sort of approach is traditionally used to look for outliers, conventionally with $\pm3\sigma$, which is quite similar to what you want.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-05-30T10:29:19.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16605" PostTypeId="1" AcceptedAnswerId="16618" CreationDate="2014-05-30T13:33:11.260" Score="0" ViewCount="884" Body="&lt;p&gt;Might be a simple question, but I keep second guessing my algorithm, so a confirmation would be good. I first do bandpass filtering, then PCA, then FFT of the top principle components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also do some sine wave fitting on the filtered data, and on the principle components, but it doesnt make sense to do it on the fft data? Right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your patience on this stupid question.&lt;/p&gt;&#xA;" OwnerUserId="8990" LastActivityDate="2014-05-31T05:05:02.357" Title="Which come first, PCA, FFT, filtering" Tags="|fft|filters|algorithms|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16607" PostTypeId="2" ParentId="16601" CreationDate="2014-05-30T15:01:15.810" Score="0" Body="&lt;p&gt;The theoretical max number of bits you can get is function of the bandwidth and the signal to noise ratio of your media. It's often referred to as &quot;Channel Capacity&quot;, see&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Shannon%E2%80%93Hartley_theorem&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Shannon%E2%80%93Hartley_theorem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice this depends a lot on the specific properties of your channel (transfer function, noise properties etc.) and there are many technologies you can deploy effectively deal with these properties. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-05-30T15:01:15.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16608" PostTypeId="2" ParentId="16493" CreationDate="2014-05-30T16:11:46.877" Score="3" Body="&lt;p&gt;First of all note that there is a certain ambiguity in the problem formulation because the approximation of $x(t)$ has to be divided into the part represented by $x^{\prime}(t)$ and the part represented by $f(y(t))$, and this division is not unique. The approach I chose is to start with a parametrization of $f(y(t))$, and approximate the given $x(t)$ as well as possible by this function. The remaining approximation error is then taken care of by $x^{\prime}(t)$. I use a least squares criterion for approximating $x(t)$ by $f(y(t))$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the following parametrization for $f(y(t))$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(y(t))=a_1y^2(t)+a_2y(t)+a_3\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with unknown parameters $a_i$, which need to be determined given the known functions $x(t)$ and $y(t)$.&#xA;Of course other choices for $f(t)$ are possible, but let's for illustration purposes use the above parametrization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you need to define a grid of values $t_i$ and set up an overdetermined system of equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t_i)=x^{\prime}(t_i)+a_1y^2(t_i)+a_2y(t_i)+a_3,\quad i=0,1,\ldots N-1\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with some $N$ (which must of course be much greater than 3, the number of unknowns). Define now a $N\times 3$ matrix $\mathbf{Y}$ with rows $Y_i=[y^2(t_i), y(t_i),1]$, a $N\times 1$ vector $\mathbf{x}$ with elements $\mathbf{x}_i=x(t_i)$, and an unknown $3\times 1$ vector $\mathbf{a}$ with elements $a_i$. The optimal least squares solution for $\mathbf{a}$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{a}=(\mathbf{Y}^T\mathbf{Y})^{-1}\mathbf{Y}^T\mathbf{x}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which in Matlab or Octave is simply implemented by the command&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = Y\x;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The values $x^{\prime}(t_i)$ are then simply given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x^{\prime}(t_i)=x(t_i)-[a_1y^2(t)+a_2y(t_i)+a_3]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the parameters $a_i$ as determined from (3). Note that $x^{\prime}(t)$ as defined by (4) is zero-mean. This is no restriction of generality because the parameter $a_3$ defining the constant part of $f(y(t))$ can as well be added to $x^{\prime}(t)$. This is part of the ambiguity inherent to the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using your example, the corresponding Matlab/Octave code would be something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0, 100, 100);&#xA;y = sin(pi * t / 5) + t/50 + 1;&#xA;x = sin(pi * t/100) + 0.05 * y .* y;&#xA;x=x(:); y=y(:);&#xA;Y = [y.*y,y,ones(100,1)];&#xA;a = Y\x;&#xA;f = a(1)*y.*y+a(2)*y+a(3)*ones(100,1);&#xA;xprime = x - f;&#xA;plot(t,x,t,xprime,t,f)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From which you get the following plot ('x' blue, 'xprime' green, 'f' red):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9XCov.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, 'xprime' is zero mean, but his could easily be changed by adding the constant term determined by $a_3$ to 'xprime' (and subtracting it from 'f').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far no constraints have been imposed on $x^{\prime}$. If smoothness of $x^{\prime}$ is desired, this can be accomplished by adding more equations to the overdetermined system (2). These equations can be of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w\left[a_1(y^2(t_i)-y^2(t_{i-1}))+a_2(y(t_i)-y(t_{i-1}))\right]=w[x(t_i)-x(t_{i-1})],\\\quad i=1,\ldots,N-1\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with some positive weight factor $w$ determining the relative importance of these additional smoothness constraints. If the matrix $\mathbf{Y}$ and the vector $\mathbf{x}$ are augmented by the values given in (5), the overdetermined system can be solved as before by solving equation (3). I computed the solution for $w=10$. Furthermore I added the constant term $a_3$ to $x^{\prime}$, which is an arbitrary choice (you might as well attribute the constant term to $f(y(t))$). The result is shown below (same functions and colors as in the above plot):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n6Y2t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot was created in Octave by the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0, 100, 100);&#xA;y = sin(pi * t / 5) + t/50 + 1;&#xA;x = sin(pi * t/100) + 0.05 * y .* y;&#xA;x=x(:); y=y(:);&#xA;Y = [y.*y,y,ones(100,1)];&#xA;w = 10;&#xA;y2 = y(2:100); y1 = y(1:99);&#xA;x2 = x(2:100) - x(1:99);&#xA;Y2 = w * [ y2.*y2 - y1.*y1, y2 - y1, zeros(99,1)];&#xA;Y = [Y;Y2];&#xA;X = [x;w*x2];&#xA;a = Y\X&#xA;f = a(1)*y.*y+a(2)*y;&#xA;xprime = x - f;&#xA;plot(t,x,t,xprime,t,f+a(3))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-06-02T10:53:21.093" LastActivityDate="2014-06-02T10:53:21.093" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16609" PostTypeId="2" ParentId="14289" CreationDate="2014-05-30T17:59:35.533" Score="0" Body="&lt;p&gt;A good measure of the audio quality if it is speech that you want to quantify is PESQ (perceptual evaluation of speech quality)&#xA;this a MATLAB link that provides the code for the evaluation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/30815-phase-spectrum-compensation/content/psc/pesq.m&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/30815-phase-spectrum-compensation/content/psc/pesq.m&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9075" LastActivityDate="2014-05-30T17:59:35.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16610" PostTypeId="1" AcceptedAnswerId="16613" CreationDate="2014-05-30T21:11:39.170" Score="0" ViewCount="500" Body="&lt;p&gt;I edited the initial question to make it general and thus applicable in more situations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the Fourier Transform of $x(t^2)$ is some function of $\omega^2$. Then what is the Fourier Transform of $x(bt^2)$, for $b&amp;gt;0$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it $\dfrac{1}{b}$ times a function of $\left(\dfrac{\omega}{b}\right)^2$, or $\left(\dfrac{1}{\sqrt{b}}\right)$ times a function of $\left( \dfrac{\omega}{\sqrt{b}} \right)^2$, or neither?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time.&lt;/p&gt;&#xA;" OwnerUserId="7761" LastEditorUserId="8202" LastEditDate="2014-06-01T11:11:16.257" LastActivityDate="2014-06-01T11:11:16.257" Title="Fourier Transform Time Scaling" Tags="|transform|fourier|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16611" PostTypeId="2" ParentId="13016" CreationDate="2014-05-30T21:25:01.767" Score="1" Body="&lt;p&gt;For initializing window you need the start point would depend on your overlap. If the overlap is 50% then you would start at window_length/2&#xA;If you are using a rectangular window and with 50% overlap in that case you want to use a square root rectangular window on the input and output so that there are no scaling issues. so basically you window will be scaled also dependent on your overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also it would be worthwhile to consider using other windows dependent on your application. As in a lot of other windows the scaling is taking into account. &lt;/p&gt;&#xA;" OwnerUserId="9075" LastActivityDate="2014-05-30T21:25:01.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16613" PostTypeId="2" ParentId="16610" CreationDate="2014-05-30T23:53:45.403" Score="1" Body="&lt;p&gt;Let $y(t) = x(t^2)$, and $a$ be such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;  y(at) &#xA;   &amp;amp;= x((at)^2) \\&#xA;   &amp;amp;= x(a^2t^2) \\&#xA;   &amp;amp;= x(bt^2)&#xA;\end{align}&#xA;$$&#xA;In other words, $a^2 = b$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier Transform time-scaling property states that given the Fourier Transform pair:&#xA;$$&#xA;\begin{align}&#xA;  y(t) \leftrightarrow Y(w)&#xA;\end{align}&#xA;$$&#xA;and $a&amp;gt;0$, we have the relation:&#xA;$$&#xA;\begin{align}&#xA;  y(at) &amp;amp;\leftrightarrow \frac{1}{a}Y(\frac{w}{a})&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus,&#xA;$$&#xA;\begin{align}&#xA;  x(bt^2) &amp;amp;\leftrightarrow \frac{1}{a}Y(\frac{w}{a}) \\&#xA;          &amp;amp;\leftrightarrow \frac{1}{\sqrt{b}}Y(\frac{w}{\sqrt{b}})&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if we define&#xA;$$&#xA;\begin{align}&#xA;Y(w) = G(w^2)&#xA;\end{align}&#xA;$$&#xA;Then,&#xA;$$&#xA;\begin{align}&#xA;Y(w/a) &amp;amp;= G(w^2/a^2) \\&#xA;Y(\frac{w}{\sqrt{b}}) &amp;amp;= G(\frac{w^2}{b})&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yielding,&#xA;$$&#xA;\begin{align}&#xA;x(bt^2) &amp;amp;\leftrightarrow \frac{1}{a}Y(\frac{w}{a}) \\&#xA;        &amp;amp;\leftrightarrow \frac{1}{\sqrt{b}}G(\frac{w^2}{b}) \\&#xA;        &amp;amp;\leftrightarrow \frac{1}{\sqrt{b}}G((\frac{w}{\sqrt{b}})^2)&#xA;\end{align}&#xA;$$&#xA;Or, in prose (1/sqrt(b)) times a function of (w/sqrt(b))^2.&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2014-05-30T23:53:45.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16614" PostTypeId="1" CreationDate="2014-05-31T00:35:35.703" Score="2" ViewCount="200" Body="&lt;p&gt;I am trying to figure out speech features that can be inverted to recover the audio back with no loss or as less loss as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently using the power spectrum which is completely reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also read about MFCC and LPC as potential features but both of them seem to be lossy in terms of recovering the audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also is there a way to compute the power spectrum in the Wavelet domain and is it any better a feature than the power spectrum computed using FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are any other features it would be great to know about that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help. &lt;/p&gt;&#xA;" OwnerUserId="9075" LastActivityDate="2014-05-31T00:35:35.703" Title="Speech features that can be inverted?" Tags="|audio|transform|speech-processing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16615" PostTypeId="2" ParentId="11139" CreationDate="2014-05-31T01:52:45.033" Score="0" Body="&lt;p&gt;The triangle centeted at 0 and spreads from $-f_m$ to $+f_m$ shows the frequency spectrum of the signal. The spectrum says that the signal has frequency components ranging from 0 to $f_mHz$ or the signal is band-limitted. Nothing special about triangle you can use any band limited shape. A few books uses inverted parabola instead of triangle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On sampling the above signal, its spectrum changes. Using fourier analysis it can be proved that the new spectrum can be obtained by adding the shifted versions of the original  spectrum by integer multiples of $f_s$. Where $f_s$ is the sampling frequency.' That is why you see a lot of equally spaced triangles, one centered at 0,  at $\pm f_s$, at $\pm 2f_s$... and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the spectrum, it is obvious that reconstruction can be done by just removing all the triangles except the one centered at 0. Which can be done with a low pass filter of cut off frequency $f_m$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $f_s &amp;lt; 2f_m$, then the triangles overlap and the signal obtained after passing through a low pass filter won't be the original one. This phenomenon is called aliasing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the theorem: &lt;em&gt;A band limited signal may be reconstructed from its sampled version if the sampling frequency is atleast twice the bandwidth&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="8871" LastEditorUserId="8871" LastEditDate="2014-05-31T02:16:52.800" LastActivityDate="2014-05-31T02:16:52.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16616" PostTypeId="1" AcceptedAnswerId="16621" CreationDate="2014-05-31T03:18:56.757" Score="1" ViewCount="55" Body="&lt;p&gt;I wanted to know the meaning of &quot;deep zeros&quot; in the spectrum of the input data. I came across this terminology while going through the introduction of chapter 2 (Bussgang techniques for blind deconvolution and equalization) of the book named &quot;Blind Deconvolution&quot; by Simon Haykin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;JK&lt;/p&gt;&#xA;" OwnerUserId="9079" LastActivityDate="2014-05-31T09:04:01.343" Title="Deep zeros in the spectrum of the input data?" Tags="|frequency-spectrum|frequency-response|adaptive-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16618" PostTypeId="2" ParentId="16605" CreationDate="2014-05-31T05:05:02.357" Score="1" Body="&lt;p&gt;Functionally PCA, FFT could be interchanged without changing anything.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[U,~,~] = svd(A);&#xA;[FU,~,~] = svd(fft(A));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;fft(U) and FU are the same (up to an arbitrary phase rotation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it may help speed to do BPF first, then FFT, and discard the stopband to reduce dimensionality before doing PCA.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-05-31T05:05:02.357" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16619" PostTypeId="1" AcceptedAnswerId="16628" CreationDate="2014-05-31T06:04:20.883" Score="3" ViewCount="1911" Body="&lt;p&gt;I am beginner in the image processing &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know what is difference between Texture and Image? or whether they are same? can anyone explain it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also,if i want to do texture segmentation,can i use same algorithms as applicable to the image segmentation?&lt;/p&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="9035" LastEditDate="2019-04-27T06:04:53.337" LastActivityDate="2019-04-27T06:04:53.337" Title="What is the Difference between Texture and Image?" Tags="|computer-vision|image-processing|image-segmentation|image-compression|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16621" PostTypeId="2" ParentId="16616" CreationDate="2014-05-31T09:04:01.343" Score="3" Body="&lt;p&gt;&quot;Deep zeros&quot; in the input spectrum are caused by a channel which strongly attenuates one or several frequencies, often due to multipath fading. This causes problems for a (linear) equalizer because it tries to compensate for these &quot;deep zeros&quot; by strong amplification of the corresponding frequency bands, which leads to noise enhancement. Non-linear equalizers are better at dealing with such problematic channel conditions.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-05-31T09:04:01.343" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16622" PostTypeId="1" CreationDate="2014-05-31T09:29:54.650" Score="1" ViewCount="547" Body="&lt;p&gt;I am reading a paper on frequency warping and I need to do a little manipulation of the Z-transform. Can somebody help me on how can I go about deriving equations $(3)$ and $(4)$ from equations $(1)$ and $(2)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tag{1}&#xA;\bar{A}(z) = \sum_{k=0}^{p}\bar{a}_k\bar{z}^{-k}(z), \ \ \ \ \ \ \bar{a}_0=1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tag{2}&#xA;\bar{z}^{-1} = \dfrac{(1-a^2)z^{-1}}{1-az^{-1}}-a&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;putting $(2)$ in $(1)$ and using binomial formulas:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tag{3}&#xA;\bar{A}(z) = \sum_{k=0}^{p}b_k\tilde{z}^{-k}(1-az^{-1})^{-k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tag{4}&#xA;b_k=\sum_{n=k}^{p}C_{kn}\bar{a}_n, \ \ \ \ \ \ C_{kn}= {n \choose k}(1-a^2)^k(-a)^{n-k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="9080" LastEditorUserId="8202" LastEditDate="2014-05-31T12:39:31.577" LastActivityDate="2014-05-31T12:39:31.577" Title="Z-transform and binomial series" Tags="|z-transform|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16623" PostTypeId="1" AcceptedAnswerId="16624" CreationDate="2014-05-31T11:25:05.020" Score="1" ViewCount="966" Body="&lt;p&gt;I've been using a Gaussian Filter and know how to use it but I don't understand the physical significance behind using the filter. We use it but why? What is the significance? I'm just starting out in image processing, so please no high level responses. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8801" LastActivityDate="2014-05-31T12:04:14.273" Title="Intuition behind the Gaussian Filter in Image Processing" Tags="|image-processing|filters|gaussian|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16624" PostTypeId="2" ParentId="16623" CreationDate="2014-05-31T11:52:18.493" Score="1" Body="&lt;p&gt;As far as your comment suggests, you are using a LP Gaussian Filter.&#xA;LP = Low pass.&#xA;This means it passes the low frequency component of the image, and prevents the high frequency component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In image processing, you can imagine the high frequency component as the places in the image where you have a sudden jump in pixel values. Like moving from a black background and suddenly to white one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These components are associated with edge detection normally, but at the same type they are associated with noise. It's because noise has a high frequency.&#xA;How come?&#xA;There is for example a type of noise known as &quot;Salt and Pepper&quot; where there appears spikes in the image. You see the it as a weird dot in the image.&#xA;These normally have way different value than the surrounding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this sort of a filter (Low Pass Gaussian Filter) you can suppress the noise, but you will lose some sharpness in the image due to killing some parts of the edges.&#xA;Therefore; this is called smoothing. It's because you tend to make the image smooth in a way that pixel values are not changing rapidly but rather in an elegant way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can imagine this as averaging. It's because you are substituting the values in a certain region of the image by it's average. That will help in smoothing the image.&lt;/p&gt;&#xA;" OwnerUserId="8348" LastEditorUserId="8348" LastEditDate="2014-05-31T12:04:14.273" LastActivityDate="2014-05-31T12:04:14.273" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16625" PostTypeId="1" AcceptedAnswerId="16634" CreationDate="2014-05-31T22:37:39.643" Score="6" ViewCount="2538" Body="&lt;p&gt;I was wondering how to calculate the autocorrelation of a deterministic signal $x(t)$ multiplied by a stochastic process $M(t)$, whose autocorellation $R_M(\tau)$ is known a priori. In my case, $x(t)$ is a truncated monolateral exponentially decaying function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose that the result of such multiplication  $y(t) = x(t) \cdot M(t)$ is again a stochastic process, but when approaching the calculation of the autocorrelation of $y(t)$ I obtain something that is not even, therefore I suppose I am making some mistakes. I know that the definition of autocorrelation for deterministic signals is different from the one of stochastic processes, but I do not know how to connect the two of them.&lt;/p&gt;&#xA;" OwnerUserId="8930" LastActivityDate="2014-06-01T16:25:01.073" Title="Autocorrelation of the product of deterministic and random signal" Tags="|filters|autocorrelation|random|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16626" PostTypeId="2" ParentId="16610" CreationDate="2014-06-01T03:13:13.893" Score="0" Body="&lt;p&gt;If $x(t)$ is a time signal, then its Fourier transform can be taken to be&#xA;$$X(f) = \int_{-\infty}^\infty x(t) \exp(-j2\pi ft)\,\mathrm dt.$$&#xA;But what is &lt;em&gt;meant&lt;/em&gt; by $x(t)$? Well, $x(t)$ is a real function of a real&#xA;variable $t$ by which is meant that for each (real number) value of $t$, &#xA;the &lt;em&gt;function&lt;/em&gt; $x(\cdot)$ assigns a real number that we denote by $x(t)$.&#xA;Usually, $x(t)$ is described by a &lt;em&gt;formula&lt;/em&gt; such as&#xA;$x(t) = \exp(-\pi |t|)$ which says in words that we &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;take the absolute value of whatever is inside the parentheses, multiply it&#xA;  by $-\pi$ and raise $e$ to the result of the multiplication.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;With this, we consider the function $y(t)$ whose value at any $t$&#xA;is defined to be the value of $x(t^2)$ where $x(t)$&#xA;happens to be $\exp(-\pi |t|)$. Thus, $y(t) = \exp(-\pi t^2)$&#xA;whose Fourier transform happens to be $\exp(-\pi f^2)$. This matches&#xA;what the OP wants: the &quot;function $x(t^2)$ has Fourier transform&#xA;that is a function of $f^2$.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now, let's turn the problem around. We are &lt;em&gt;not told&lt;/em&gt; what&#xA;the function $x(t)$ is, but we do know that $y(t) = x(t^2)$&#xA;happens to equal $\exp(-\pi t^2)$.  How can we deduce that&#xA;$x(t) = \exp(-\pi |t|)$?  &lt;em&gt;We can't&lt;/em&gt; because if $x(t)$ were&#xA;chosen to be $\exp(-\pi t)$ for which the prescription is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;take &lt;strike&gt;the absolute value of&lt;/strike&gt; whatever is inside the parentheses, multiply it&#xA;    by $-\pi$ and raise $e$ to the result of the multiplication.&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;then $x(t^2) = \exp(-\pi t^2)$ also. So, did our $y(t) = \exp(-\pi t^2)$&#xA;come from $x(t) = \exp(-\pi |t|)$ or $x(t) = \exp(-\pi t)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, asking about the Fourier transform of $x(bt^2)$ is futile&#xA;unless you specify what you mean by $x(t)$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-06-01T03:13:13.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16627" PostTypeId="1" CreationDate="2014-06-01T05:49:34.207" Score="1" ViewCount="86" Body="&lt;p&gt;I am working in image processing. I am confused while getting into wavelet. I applied the fft2() function on Lena image and I got frequency information for the same. But when I applied bior4.4, a popular bi-orthogonal wavelet, I got edge information HORIZONTAL, VERTICAL and DIAGONAL orientation. May you plz. tell me how to get frequency information in wavelet? How time-frequency is localized in bior4.4 wavelet after two level decomposition for Lena image?&lt;/p&gt;&#xA;" OwnerUserId="9082" LastActivityDate="2014-06-01T05:49:34.207" Title="How can I get frequency information in wavelet?" Tags="|wavelet|time-frequency|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16628" PostTypeId="2" ParentId="16619" CreationDate="2014-06-01T07:11:04.967" Score="2" Body="&lt;p&gt;An image (2D) is the projection of a natural scene or man made drawing on to a plane. The output of an optical sensor when displayed is an image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Texture is a picture created by repeating a basic element called 'texel'. The texel can be a natural image or an artificial one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The edge detection algorithms works on matrices. So if it is a normal image or texture image, you can do in the same way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In texture images, recognizing the texel makes the rest of processing easy. Because you need to work on a smaller sized matrix. &lt;/p&gt;&#xA;" OwnerUserId="8871" LastEditorUserId="8871" LastEditDate="2014-06-01T07:28:56.127" LastActivityDate="2014-06-01T07:28:56.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16629" PostTypeId="1" AcceptedAnswerId="17153" CreationDate="2014-06-01T11:49:55.120" Score="0" ViewCount="443" Body="&lt;p&gt;in my attempts to synthesize a plucked electric guitar string (using supercollider's digital waveguide, which is based on the Karplus-Strong algorithm) I came to a dead end and decided to look that the Cepstrums of a sampled string and my synthesized string, to nail down the audible differences. They look like this (A-string - 110Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bmobx.png&quot; alt=&quot;Cepstrum of smapled and synthesized plucked A string&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The sampled signal has something in the right half, which the synthesized signal does not. I cannot see how to interpret this as &quot;excitation&quot;. So what does it stand for?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it safe to say, that the spectrum of the synthesized spectrum is more &quot;harmonic&quot; than the one of the sampled signal? When I look at the spectra themselves it does appear this way. The sampled spectrum (left) looks more &quot;noisy&quot;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JhglF.png&quot; alt=&quot;Spectra&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Could it be that the regularity (and the dull sound) of the synthesized signal is a consequence of the digital waverguide itself. The way I understand Karplus-Strong, after some time only the fundamental and its harmonics survive, which would indeed lead to a &quot;harmonic&quot; spectrum. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If that is the case, what could be the cause of the irregularties of a real plucked string. IOW: what does a real string have, which Karplus-Strong doesn't have?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As a side note: what does the sharp peak at the end of the Cepstrum stand for? Is it caused by the 1 second window?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8553" LastEditorUserId="8553" LastEditDate="2014-06-01T14:50:29.027" LastActivityDate="2014-07-01T16:45:08.503" Title="Interpreting Cepstrum of plucked string" Tags="|frequency-spectrum|cepstral-analysis|signal-synthesis|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16630" PostTypeId="1" CreationDate="2014-06-01T12:22:42.430" Score="0" ViewCount="790" Body="&lt;p&gt;I attempted to implement a real-time audio filtering in a callback function using the simplest moving-average filter with coefficients [0.5 0.5] :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void process(void* in_, void* out_, DWORD length, void* user) {&#xA;&#xA;    //data is float, mono&#xA;    int n = length/sizeof(float);&#xA;    float* in = (float*)in_;&#xA;    float* out = (float*)out_;&#xA;    float* buff = (float*)user;&#xA;&#xA;    //buff holds the last input sample from the previous block&#xA;    //if this is a first block, it is 0&#xA;    out[0] = 0.5*in[0] + 0.5*buff;&#xA;&#xA;    for (int i = 1; i &amp;lt; n; ++i)&#xA;    {&#xA;         out[i] = 0.5*in[i] + 0.5*in[i - 1];&#xA;    }&#xA;&#xA;    buff[0] = in[n-1];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;however, i get a distortion in the output, like an aliasing of some sort or clipping. But, to my knowledge none of this is possible to occur in this case. I've implemented the same code in Matlab ( although not in real-time ) and everything was fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a BASS library. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if i am missing something obvious here, cause i am running out of ideas. Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Thanks everyone for the answers. The above function is in the form for simplicity, but in actual from it looks like below (there is no output buffer, filtering must be done in-place) but it does exact same thing, although I will write it for convenience: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void CALLBACK filterDSPMono(HDSP handle, DWORD channel, void* buffer, DWORD length, void* user)&#xA;{&#xA;    float* x = (float*) buffer;&#xA;    int n = length / sizeof(float);&#xA;    float* buff = (float*) user;&#xA;    float temp;&#xA;&#xA;&#xA;    int i = 0;&#xA;    for (; i &amp;lt; n; ++i)&#xA;    {&#xA;        temp = x[i];&#xA;        x[i] = 0.5*x[i] + 0.5*buff[0];&#xA;        buff[0] = temp;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT2: Ok, so it turns out the problem was with the buffer size set in the library that my sound card drivers didn't like for some reason. After I changed that, everything is fine. Thank you for all the answers unfortunately I cant mark any as The Answer due to the fault being on my part. This question now can be considered as resolved.&lt;/p&gt;&#xA;" OwnerUserId="5364" LastEditorUserId="5364" LastEditDate="2014-06-08T13:39:42.083" LastActivityDate="2014-06-08T13:39:42.083" Title="Audio distortion while implementing a low-pass filter" Tags="|audio|lowpass-filter|real-time|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="16633" PostTypeId="2" ParentId="16629" CreationDate="2014-06-01T14:47:15.860" Score="2" Body="&lt;p&gt;IIRC, Karplus-Strong is usually a single linear harmonic waveguide.  Plucking a stringed instrument starts several things in vibration other that the string (sound board, air in cavity, etc.), many of them producing inharmonic overtones due to material stiffness, thickness and non-uniformity, some of which exchange energy and/of change in a non-linear fashion over time. The sharp peak high in the Cepstrum could indicate some kind of tiny but sudden frequency modulation(s) of the fundamental pitch.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-01T14:47:15.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16634" PostTypeId="2" ParentId="16625" CreationDate="2014-06-01T16:25:01.073" Score="5" Body="&lt;p&gt;As correctly pointed out in the comments, in general the process $Y(t)=x(t)M(t)$ is not wide-sense stationary (WSS), i.e. its autocorrelation function depends not only on the time difference parameter $\tau$, but also on the absolute time $t$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_Y(\tau,t)=E[Y(t+\tau)Y^*(t)]=E[x(t+\tau)M(t+\tau)x^*(t)M^*(t)]=\\&#xA;=x(t+\tau)x^*(t)E[M(t+\tau)M^*(t)]=x(t+\tau)x^*(t)R_M(\tau)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you just need to evaluate (1) with the given function $x(t)$. However, as expected you will end up with a function of two variables because $Y(t)$ is not WSS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few special cases in which the resulting process is indeed WSS or can be easily made WSS. The first case is modulation by a complex exponential:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=e^{j\omega_ct}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in which case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t+\tau)x^*(t)=e^{j\omega_c(t+\tau)}e^{-j\omega_ct}=e^{j\omega_c\tau}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;only depends on $\tau$ and not on $t$. Another case of interest is the case where $x(t)$ is $T$-periodic. In this case the process $x(t)M(t)$ can be made WSS by introducing a random phase epoch $\Theta$ with uniform distribution in the interval $[0,T]$ which is independent of $M(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(t)=x(t+\Theta)M(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The autocorrelation function of $Y(t)$ is then given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_Y(\tau)=R_M(\tau)\frac{1}{T}\int_0^Tx(\alpha+\tau)x^*(\alpha)d\alpha$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-01T16:25:01.073" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16635" PostTypeId="1" AcceptedAnswerId="42460" CreationDate="2014-06-01T18:00:50.233" Score="6" ViewCount="1587" Body="&lt;p&gt;An excellent answer to this &lt;a href=&quot;https://dsp.stackexchange.com/questions/9967/1-n-octave-smoothing&quot;&gt;post&lt;/a&gt; explains how to do $1/n$ octave energy smoothing and mentions complex smoothing can be done as well, but it's tricky business because of phase wrapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is phase wrapping solved in $1/n$ complex smoothing?&lt;/p&gt;&#xA;" OwnerUserId="3602" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2020-05-22T16:06:35.690" Title="$1/n$ octave complex smoothing" Tags="|fft|audio|smoothing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16636" PostTypeId="1" CreationDate="2014-06-01T18:20:32.003" Score="1" ViewCount="1731" Body="&lt;p&gt;I'm reading this book &quot;&lt;a href=&quot;http://www.amazon.ca/Applied-Estimation-Analytic-Sciences-Corporation/dp/0262570483&quot; rel=&quot;nofollow&quot;&gt;Applied Optimal Estimation&quot;&lt;/a&gt; by A. Gelb. In the example 1.0-1, there are two measurements $z_{1}$ and $z_{2}$ with some noise for measuring $x$ as following &#xA;$$&#xA;z_{1} = x + v_{1} \\&#xA;z_{2} = x + v_{2}&#xA;$$&#xA;Now to design estimator for $x$, we need the estimated and the actual value of $x$, so we define the estimating error $\tilde{x}$ to be &#xA;$$&#xA;\tilde{x} = \hat{x} - x&#xA;$$&#xA;where $\hat{x} = k_{1}z_{1} + k_{2}z_{2}$. My question is that why $\hat{x}$ is the summation of the two measurements? Shouldn't it be one of the measurements or at least the summation divided by 2 so that we can make the subtraction between the ideal $x$ and observed $\hat{x}$ measurements.&lt;/p&gt;&#xA;" OwnerUserId="5788" LastActivityDate="2014-06-02T03:25:42.887" Title="minimizing the mean squared error?" Tags="|estimation|estimators|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16639" PostTypeId="1" CreationDate="2014-06-02T00:06:27.810" Score="1" ViewCount="955" Body="&lt;p&gt;If a digital LTI filter has phase response on the form $arg[H(e^{jw})] = -\alpha\omega$, what could one say about it's causality (and consequently, the causality of it's impulse response)? Also is Linear Phase a characteristic of only Causal FIR Symmetric Systems?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2014-06-03T03:18:33.380" Title="Causality of Linear Phase Filter" Tags="|filters|discrete-signals|linear-systems|linear-phase|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16640" PostTypeId="2" ParentId="16442" CreationDate="2014-06-02T00:30:38.487" Score="1" Body="&lt;p&gt;For the first question, in Kalman filter there are two noises namely process and observation noises. Kalman filter assumes the noise to be Gaussian with zero mean and some variance $\mathcal{N}(0, \sigma^{2})$. Let's say we have a sensor that measures a constant quantity but random, for example distance. Let's say $x = 1$m, however the sensor gives us $z=0.9$m. In reality we don't know $x$ for certain so we rely on our sensor. In Matlab, we can simulate this sensor &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = 1; % true value&#xA;z = x + randn(); % observed value&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;randn()&lt;/code&gt; is normal distribution with zero mean and variance one $\mathcal{N}(0, 1)$. If you want to increase the accuracy of your sensor, then multiply the normal distribution &lt;code&gt;randn()&lt;/code&gt; with some small value that you think it is the error of your sensor. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i = 1:6&#xA;    x = 1; % true value&#xA;    z = x + 0.01*randn() % observed value&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will notice the observed value varies from the true value however still close to the true value because of &lt;code&gt;0.01&lt;/code&gt;. Remember that Kalman filter is a matter of modeling your system accurately. For kalman filter, you need the motion and observation models given in advanced. Also, your system must be linear and if this is not the case then you should use Extended kalman filter. Moreover, the noise must be Gaussian noise. Now your job to determine these parameters. &lt;/p&gt;&#xA;" OwnerUserId="5788" LastEditorUserId="5788" LastEditDate="2014-06-02T00:46:34.163" LastActivityDate="2014-06-02T00:46:34.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16641" PostTypeId="2" ParentId="16639" CreationDate="2014-06-02T01:44:10.863" Score="1" Body="&lt;p&gt;For a generic value of the group delay $\alpha$, the filter has a 2-sided infinite impulse, and is therefore not causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Causal linear phase systems are (almost) always FIR systems with any of the &lt;a href=&quot;http://cnx.org/content/m10706/latest/&quot; rel=&quot;nofollow&quot;&gt;4 types&lt;/a&gt; of symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In these cases, the group delay is multiple of 1/2 (0, 1/2, 1, 3/2, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can have causal linear phase IIR filters, but these are not of finite-order (cannot be implemented with a difference equation), so they are of little use in practice.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2014-06-02T01:44:10.863" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16642" PostTypeId="2" ParentId="16639" CreationDate="2014-06-02T02:23:52.807" Score="1" Body="&lt;p&gt;You cannot really tell whether the filter is causal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can tell whether the filter is definitely not causal (at least for FIR filters). We have&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\alpha &amp;lt; 0$: not causal (whether it is acausal or anti-causal is not known).&lt;/li&gt;&#xA;&lt;li&gt;$\alpha \neq 0,1/2,1,3/2,2,\ldots$: acausal (but not anti-causal)&lt;/li&gt;&#xA;&lt;li&gt;$\alpha = 0,1/2,1,3/2,2,\ldots$: unknown (can be causal or acausal)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The reason is (as Juancho) already pointed out, the symmetry in the impulse response for linear phase filters (which makes the group delay $\alpha$ equal to half of the length of the impulse response minus one ($(N-1)/2$).&lt;/p&gt;&#xA;" OwnerUserId="5145" LastEditorUserId="5145" LastEditDate="2014-06-03T03:18:33.380" LastActivityDate="2014-06-03T03:18:33.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16643" PostTypeId="2" ParentId="16636" CreationDate="2014-06-02T03:25:42.887" Score="6" Body="&lt;p&gt;Given measurements&#xA;$$\begin{align}&#xA;Z_1 &amp;amp;= x + N_1\\&#xA;Z_2 &amp;amp;= x + N_2&#xA;\end{align}$$&#xA;where $N_1$ and $N_2$ are independent zero-mean &lt;em&gt;Gaussian&lt;/em&gt; random variables&#xA;with variances $\sigma_1^2$ and $\sigma_2^2$ respectively, it can be shown&#xA;that the minimum-mean-square-error (MMSE) estimate of $x$ in terms of $Z_1$ and&#xA;$Z_2$ is a &lt;em&gt;linear function&lt;/em&gt; of $Z_1$ and $Z_2$.  Note that this linearity&#xA;is a consequence of the Gaussian assumption; for other kinds of distributions&#xA;that might be assumed for the noise variables $N_1$ and $N_2$, the MMSE&#xA;estimate is usually not a linear function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let us consider the estimate $\hat{X} = k_0 + k_1Z_1 + k_2Z_2$ for the&#xA;unknown parameter $x$.  The mean-square error is thus&#xA;$$\begin{align}&#xA;E[(\hat{X}-x)^2] &amp;amp;=  E[(k_0 + k_1Z_1 + k_2Z_2 - x)^2]\\&#xA;&amp;amp;= E[(k_0 + (k_1+k_2-1)x + k_1N_1+k_2N_2)^2]\\&#xA;&amp;amp;= \operatorname{var}(k_1N_1+k_2N_2) + (k_0 + (k_1+k_2-1)x)^2&#xA;&amp;amp;{\scriptstyle{\text{because}~E[(Y+a)^2=\operatorname{var}(Y)+(\mu_Y+a)^2}}\\&#xA;&amp;amp;\geq \operatorname{var}(k_1N_1+k_2N_2)&#xA;\end{align}$$&#xA;where equality holds in that last inequality if we choose $k_0=0$ and $k_1+k_2=1$. With a slight change of notation to incorporate these&#xA;constraints into our calculations,&#xA;let us write &#xA;$$\begin{align}&#xA;E[(\hat{X}-x)^2] &amp;amp;= \operatorname{var}(\alpha N_1+(1-\alpha)N_2)\\&#xA;&amp;amp;= \alpha^2\sigma_1^2 + (1-\alpha)^2 \sigma_2^2&#xA;&amp;amp;{\scriptstyle{\text{because}~N_1, N_2 ~\text{are independent random variables}}}\\&#xA;&amp;amp;= \alpha^2(\sigma_1^2 + \sigma_2^2) -2\alpha\sigma_2^2 +  \sigma_2^2&#xA;\end{align}$$&#xA;where it is easily shown that the minimum value of that quadratic function&#xA;of $\alpha$ occurs when we choose&#xA;$$\alpha = \frac{\sigma_2^2}{\sigma_1^2 + \sigma_2^2} = k_1, \qquad&#xA;1-\alpha = \frac{\sigma_1^2}{\sigma_1^2 + \sigma_2^2} = k_2,$$&#xA;that is, when the two measurements are afflicted with Gaussian&#xA;noise of &lt;em&gt;different&lt;/em&gt; variances (say with $\sigma_2^2 &amp;gt; \sigma_1^2$),&#xA;then the measurement with the &lt;em&gt;smaller variance&lt;/em&gt; ($N_1$ in this&#xA;example) is given &lt;em&gt;greater weight&lt;/em&gt; &#xA;$k_1=\frac{\sigma_2^2}{\sigma_1^2 + \sigma_2^2}$&#xA;than the measurement with the larger variance ($N_2$ in this case)&#xA;which has smaller weight $k_2 = \frac{\sigma_1^2}{\sigma_1^2 + \sigma_2^2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When $\sigma_2^2 = \sigma_1^2$, the measurements are given equal weight&#xA;$\frac 12$ which is, according to the OP's insistence, the weight that&#xA;must be&#xA;assigned in all circumstances so as to minimize the mean-square error&#xA;because that is the only weighting that makes sense to the OP.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-06-02T03:25:42.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16644" PostTypeId="1" CreationDate="2014-06-02T04:52:16.987" Score="2" ViewCount="166" Body="&lt;p&gt;Services like Siri and Google Now perform speech recognition (speech-to-text) on mobile phones by doing part of the computation on a server in the cloud.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do they upload to the cloud?  Do they upload the raw audio?  Or do they do some feature extraction and only upload features (e.g., MFCC coefficients or something) to the cloud?  Is uploading the full audio important/useful for obtaining the best results (e.g., best accuracy of speech recognition)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm curious about understanding the technical details of what is uploaded to Google/Apple, e.g., to better understand the privacy implications.  Note that I'm not asking about their privacy policy, or what they do with the data, or whether I should be concerned about privacy, or any of that stuff.  My interest is in the technical details of how speech recognition computation is split between your phone and their servers.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The research I've done, and what I've found:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Based on &lt;a href=&quot;http://mashable.com/2012/06/28/apple-siri-stores-voiceprint/&quot; rel=&quot;nofollow&quot;&gt;public statements that Apple has made&lt;/a&gt;, it appears that Siri works by uploading full audio clips (not just features) to Apple's server.  The article also discusses some speculation about whether doing local processing would be feasible.  (See also &lt;a href=&quot;http://www.wired.com/2013/04/siri-two-years/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Back in 2011, Applidium &lt;a href=&quot;https://web.archive.org/web/20111120164130/http://applidium.com/en/news/cracking_siri&quot; rel=&quot;nofollow&quot;&gt;reverse-engineered the Siri protocol&lt;/a&gt;.  They reported that the phone is uploading a full audio clip to Apple's servers: the only computation done on the phone is to compress the audio using Speex.  The scripts they used to help them &lt;a href=&quot;https://github.com/applidium/Cracking-Siri&quot; rel=&quot;nofollow&quot;&gt;are available on Github&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I haven't been able to find anything on Google Now.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5874" LastActivityDate="2014-06-02T16:31:58.307" Title="What do cloud-based speech-to-text services upload to the cloud?" Tags="|speech-recognition|speech-processing|voice|software-implementation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16645" PostTypeId="1" CreationDate="2014-06-02T06:12:59.563" Score="0" ViewCount="188" Body="&lt;p&gt;I am using a DSP kit TMS320c6711. It has a fixed sampling rate of 8000 samples per second. As I have to do real time  filtering of frequencies above 5oHz with sharp cut off, I must reduce the sampling frequency to around 1000 samples per second. Suggestions are highly appreciable.&lt;/p&gt;&#xA;" OwnerUserId="8814" LastActivityDate="2014-12-29T22:40:32.880" Title="Is it possible to change sampling frequency of DSP kit if the sampling rate is fixed?" Tags="|filters|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16646" PostTypeId="2" ParentId="16559" CreationDate="2014-06-02T08:21:02.270" Score="4" Body="&lt;p&gt;A dynamic texture is a texture that is a function of &lt;em&gt;space and time&lt;/em&gt;. In Image Synthesis papers, it is a term often used to designate things like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a flame,&lt;/li&gt;&#xA;&lt;li&gt;a waving flag,&lt;/li&gt;&#xA;&lt;li&gt;specular reflections on water.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can see some classic examples &lt;a href=&quot;http://www.cc.gatech.edu/cpl/projects/graphcuttextures/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2014-06-02T08:21:02.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16647" PostTypeId="1" CreationDate="2014-06-02T10:06:39.467" Score="1" ViewCount="60" Body="&lt;p&gt;I'm currently trying to perform analysis of a spectrogram, with the use of PCA.&#xA;I'm confused about what the dimensions of the result should therefore be. Currently, the dimensions are: &lt;code&gt;451x128&lt;/code&gt;. But I thought that it was a standard image, and therefore it should have 2 dimensions. &lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-06-03T19:21:32.963" Title="Dimensions of a spectral representation" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="2" ClosedDate="2014-06-09T21:45:22.663" ContentLicense="CC BY-SA 3.0" />
  <row Id="16648" PostTypeId="2" ParentId="16644" CreationDate="2014-06-02T16:24:40.887" Score="2" Body="&lt;p&gt;Its probably safe to assume that all of the major companies send enough information to reconstruct the audio. This is because having that audio for training is such a valuable resource. A certain percentage of the audio segments will be listened to and transcribed by a human annotator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also features in these systems are more complicated than MFCCs. You obviously want to offload computing to the cloud so that's another reason to expect that they send the whole audio.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-06-02T16:24:40.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16649" PostTypeId="2" ParentId="16644" CreationDate="2014-06-02T16:31:58.307" Score="2" Body="&lt;p&gt;To give more variants to Aaron's answer, speech recognition pipeline has multiple stages where you can cut the line between client and server. There are the following variants:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Lossless audio (flac)&lt;/li&gt;&#xA;&lt;li&gt;Lossy audio (speex 8kb/s)&lt;/li&gt;&#xA;&lt;li&gt;MFCC features (about 6.3kb/s bitrate)&lt;/li&gt;&#xA;&lt;li&gt;Compressed MFCC features &lt;a href=&quot;http://www.etsi.org/technologies-clusters/technologies/past-work/speech-recognition&quot; rel=&quot;nofollow&quot;&gt;ETSI distributed speech recognition standard&lt;/a&gt;, 4.4 kb/s bitrate&lt;/li&gt;&#xA;&lt;li&gt;Phonetic or word lattice or other intermediate results from the first-pass decoding as described in &lt;a href=&quot;http://www.lti.cs.cmu.edu/sites/default/files/research/thesis/2011/david_hugginsdaines.pdf&quot; rel=&quot;nofollow&quot;&gt;Architecture of Scalable Speech Recognition&lt;/a&gt; and just rescore them on the server (less than 1kb/s bitrate)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Most of the services upload audio though it's not really necessary to do that. It's just that they need to collect some data for the future updates of the system. Once the accuracy will be stable there will services with reduced bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2014-06-02T16:31:58.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16650" PostTypeId="1" CreationDate="2014-06-02T17:42:26.253" Score="2" ViewCount="114" Body="&lt;p&gt;Hough transform is a very powerful tool to find dominant straight lines in a black-and-white image. A very common practice of analyzing Hough transform result is to find some local maximum points in the Hough transform image, and then try to analyze the straight line segments in the image domain that correspond to the local maximum point. Then the question arises: how can we quickly calculate all the line segments when their coordinate in the Hough transform is given? For the time being, I have a awkward way to solve this problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;first calculate the straight line function that correspond to the&#xA;Hough transform point. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;after that, find all the line segments    that have intersections&#xA;with the calculated straight line. In the    meantime, I make sure&#xA;that all the pixels in the line segments are    near to the&#xA;calculated straight line by setting a some threshold.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any ideas will be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="1674" LastActivityDate="2014-06-02T17:42:26.253" Title="How to quickly calculate all the line segments when their coordinate in the Hough transform is given" Tags="|image-processing|hough-transform|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16652" PostTypeId="1" CreationDate="2014-06-02T19:36:52.243" Score="1" ViewCount="152" Body="&lt;p&gt;My code works in the following manner:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.First, it obtains several images from the training set&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.After loading these images, we find the normalized faces,mean face and perform several calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.Next, we ask for the name of an image we want to recognize&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4.We then project the input image into the eigenspace, and based on the difference from the eigenfaces we make a decision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5.Depending on eigen weight vector for each input image we make clusters using kmeans command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source code i tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;close all&#xA;clc&#xA;% number of images on your training set.&#xA;M=1200;&#xA;&#xA;%Chosen std and mean. &#xA;%It can be any number that it is close to the std and mean of most of the images.&#xA;um=60;&#xA;ustd=32;&#xA;&#xA;%read and show images(bmp);&#xA;S=[];   %img matrix&#xA;&#xA;for i=1:M&#xA;    str=strcat(int2str(i),'.jpg');   %concatenates two strings that form the name of the image&#xA;    eval('img=imread(str);');&#xA;&#xA;&#xA;       [irow icol d]=size(img); % get the number of rows (N1) and columns (N2)&#xA;       temp=reshape(permute(img,[2,1,3]),[irow*icol,d]);     %creates a (N1*N2)x1 matrix&#xA;    S=[S temp];         %X is a N1*N2xM matrix after finishing the sequence&#xA;                        %this is our S&#xA;end&#xA;&#xA;&#xA;%Here we change the mean and std of all images. We normalize all images.&#xA;%This is done to reduce the error due to lighting conditions.&#xA;for i=1:size(S,2)&#xA;    temp=double(S(:,i));&#xA;    m=mean(temp);&#xA;    st=std(temp);&#xA;    S(:,i)=(temp-m)*ustd/st+um;&#xA;end&#xA;&#xA;%show normalized images&#xA;&#xA;for i=1:M&#xA;    str=strcat(int2str(i),'.jpg');&#xA;    img=reshape(S(:,i),icol,irow);&#xA;    img=img';&#xA;&#xA;end&#xA;&#xA;&#xA;%mean image;&#xA;m=mean(S,2);   %obtains the mean of each row instead of each column&#xA;tmimg=uint8(m);   %converts to unsigned 8-bit integer. Values range from 0 to 255&#xA;img=reshape(tmimg,icol,irow);    %takes the N1*N2x1 vector and creates a N2xN1 matrix&#xA;img=img';       %creates a N1xN2 matrix by transposing the image.&#xA;&#xA;% Change image for manipulation&#xA;dbx=[];   % A matrix&#xA;for i=1:M&#xA;    temp=double(S(:,i));&#xA;    dbx=[dbx temp];&#xA;end&#xA;&#xA;%Covariance matrix C=A'A, L=AA'&#xA;A=dbx';&#xA;L=A*A';&#xA;% vv are the eigenvector for L&#xA;% dd are the eigenvalue for both L=dbx'*dbx and C=dbx*dbx';&#xA;[vv dd]=eig(L);&#xA;% Sort and eliminate those whose eigenvalue is zero&#xA;v=[];&#xA;d=[];&#xA;for i=1:size(vv,2)&#xA;    if(dd(i,i)&amp;gt;1e-4)&#xA;        v=[v vv(:,i)];&#xA;        d=[d dd(i,i)];&#xA;    end&#xA; end&#xA;&#xA; %sort,  will return an ascending sequence&#xA; [B index]=sort(d);&#xA; ind=zeros(size(index));&#xA; dtemp=zeros(size(index));&#xA; vtemp=zeros(size(v));&#xA; len=length(index);&#xA; for i=1:len&#xA;    dtemp(i)=B(len+1-i);&#xA;    ind(i)=len+1-index(i);&#xA;    vtemp(:,ind(i))=v(:,i);&#xA; end&#xA; d=dtemp;&#xA; v=vtemp;&#xA;&#xA;&#xA;%Normalization of eigenvectors&#xA; for i=1:size(v,2)       %access each column&#xA;   kk=v(:,i);&#xA;   temp=sqrt(sum(kk.^2));&#xA;   v(:,i)=v(:,i)./temp;&#xA;end&#xA;&#xA;%Eigenvectors of C matrix&#xA;u=[];&#xA;for i=1:size(v,2)&#xA;    temp=sqrt(d(i));&#xA;    u=[u (dbx*v(:,i))./temp];&#xA;end&#xA;&#xA;%Normalization of eigenvectors&#xA;for i=1:size(u,2)&#xA;   kk=u(:,i);&#xA;   temp=sqrt(sum(kk.^2));&#xA;    u(:,i)=u(:,i)./temp;&#xA;end&#xA;&#xA;&#xA;% show eigenfaces;&#xA;&#xA;for i=1:size(u,2)&#xA;    img=reshape(u(:,i),icol,irow);&#xA;    img=img';&#xA;    img=histeq(img,255);&#xA;&#xA;end&#xA;&#xA;&#xA;% Find the weight of each face in the training set.&#xA;omega = [];&#xA;for h=1:size(dbx,2)&#xA;    WW=[];    &#xA;    for i=1:size(u,2)&#xA;        t = u(:,i)';    &#xA;        WeightOfImage = dot(t,dbx(:,h)');&#xA;        WW = [WW; WeightOfImage];&#xA;    end&#xA;    omega = [omega WW];&#xA;end&#xA;&#xA;&#xA;% Acquire new image&#xA;% Note: the input image must have a bmp or jpg extension. &#xA;%       It should have the same size as the ones in your training set. &#xA;%       It should be placed on your desktop&#xA;ed_min=[];&#xA;&#xA;srcFiles = dir('G:\newdatabase\*.jpg');  % the folder in which ur images exists&#xA;for b = 1 : length(srcFiles)&#xA;    filename = strcat('G:\newdatabase\',srcFiles(b).name);&#xA;    Imgdata = imread(filename);&#xA;&#xA;        InputImage=Imgdata;&#xA;&#xA;InImage=reshape(permute((double(InputImage)),[2,1,3]),[irow*icol,1]);&#xA;temp=InImage;&#xA;me=mean(temp);&#xA;st=std(temp);&#xA;temp=(temp-me)*ustd/st+um;&#xA;NormImage = temp;&#xA;Difference = temp-m;&#xA;&#xA;p = [];&#xA;aa=size(u,2);&#xA;for i = 1:aa&#xA;    pare = dot(NormImage,u(:,i));&#xA;    p = [p; pare];&#xA;end&#xA;&#xA;&#xA;InImWeight = [];&#xA;for i=1:size(u,2)&#xA;    t = u(:,i)';&#xA;    WeightOfInputImage = dot(t,Difference');&#xA;    InImWeight = [InImWeight; WeightOfInputImage];&#xA;end&#xA;noe=numel(InImWeight);&#xA;&#xA;&#xA;% Find Euclidean distance&#xA;e=[];&#xA;for i=1:size(omega,2)&#xA;    q = omega(:,i);&#xA;    DiffWeight = InImWeight-q;&#xA;    mag = norm(DiffWeight);&#xA;    e = [e mag];&#xA;&#xA;end&#xA;&#xA;ed_min=[ed_min MinimumValue];&#xA;&#xA;theta=6.0e+03;&#xA;%disp(e)&#xA;&#xA;z(b,:)=InImWeight;&#xA;&#xA;end&#xA;&#xA;&#xA;IDX = kmeans(z,5);&#xA;clustercount=accumarray(IDX, ones(size(IDX)));&#xA;&#xA;disp(clustercount);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Running time for 50 images:Elapsed time is 103.947573 seconds.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;QUESTIONS:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.It is working fine for M=50(i.e Training set contains 50 images) but not for M=1200(i.e Training set contains 1200 images).It is not showing any error.There is no output.I waited for 10 min still there is no output. I think it is going infinite loop.What is the problem?Where i was wrong?&lt;/p&gt;&#xA;" OwnerUserId="9091" LastEditorUserId="9091" LastEditDate="2014-06-03T11:39:29.530" LastActivityDate="2014-06-03T11:39:29.530" Title="How to store generated eigen faces for future face recognition?" Tags="|image-processing|matlab|face-detection|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16654" PostTypeId="1" CreationDate="2014-06-03T05:19:03.130" Score="1" ViewCount="456" Body="&lt;p&gt;I should say which of the filters from the following image implements an ideal low-pass filter with cutoff frequency $\frac{\pi}{4}$. In the picture, Sa is a zero insertion filter, which inserts a zero sample after each input sample and Sb is a decimator, which extracts every second sample of its input. The first filter is fine and the second one does not represent the desired low-pass (that's the answer on my book).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MGMFu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've not been able to explain why is the second filter wrong.&#xA;I know that up-sampling compresses the frequency content of a signal and that down-sampling expands it. So for the first filter, we first compress the input band by 2 and conclude that if the original limits were less than or equal to $\frac{\pi}{4}$, nothing gets filtered out (because $\frac{\pi}{4}$ becomes $\frac{\pi}{8}$ after Sa). And then, Sb recovers the original spectrum by multiplying by 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I analysed the second filter in a similar way, just noticing that Sb was switched with Sa thus making a multiplication by 2 first. The first Frequency Response would not filter anything from inputs with frequency lower than $\frac{\pi}{4}$ (which becomes $\frac{\pi}{2}$ after Sb). Then, after Sa, we have a division by 2 which restores the original spectrum and anything less than $\frac{\pi}{4}$ can proceed to the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2014-07-03T07:01:31.857" Title="Implementations of Low-Pass Filter" Tags="|filters|discrete-signals|sampling|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16655" PostTypeId="2" ParentId="16654" CreationDate="2014-06-03T06:56:15.010" Score="1" Body="&lt;p&gt;If the input sequence is band limited to $\pi/2$, the second alternative is also OK (as you realized with your argument). However, if it not band limited you will get aliasing, so it is not a feasible solution in the general case.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-06-03T06:56:15.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16656" PostTypeId="1" CreationDate="2014-06-03T07:50:36.163" Score="3" ViewCount="2206" Body="&lt;p&gt;I am analyzing the spectral components of a time series using the continuous wavelet transform following Torrence and Compo (1998). I would like to partition the signal variability or spectral power across different scales (e.g. 50% of the variability is in the scales X to Y). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As pointed out &lt;a href=&quot;http://paos.colorado.edu/research/wavelets/faq.html#bias&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; the global wavelet spectrum is a biased estimator of the power spectrum, so is there a way to plot the power spectrum in a normalized way, where I can compare the power at different frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be correct to just reconstruct each scale range I am interested in and calculate the variance over time?&lt;/p&gt;&#xA;" OwnerUserId="9094" LastActivityDate="2014-06-03T19:12:03.810" Title="Normalized Wavelet power spectrum" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16657" PostTypeId="1" CreationDate="2014-06-03T09:17:23.177" Score="3" ViewCount="84" Body="&lt;p&gt;I need to calculate $\frac{E\left[|x(n)|^4\right]}{E\left[x^2(n)\right]}$ in real time, where $x(n)$ is complex. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $E\left[|x(n)|^4\right]$ I plan to take the absolute, raise it to the power $4$ and do exponential averaging with weights $0.999$ and $0.001$. I have no clue on how to calculate $E\left[x^2(n)\right]$. I know that this gives the total signal power. Will this be equivalent to $E\left[|x(n)|^2\right]$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, JK&lt;/p&gt;&#xA;" OwnerUserId="9079" LastEditorUserId="8202" LastEditDate="2014-06-03T10:53:13.073" LastActivityDate="2014-06-04T06:28:31.067" Title="Need to calculate $\frac{E\left[|x(n)|^4\right]}{E\left[x^2(n)\right]}$" Tags="|signal-analysis|real-time|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16659" PostTypeId="2" ParentId="16657" CreationDate="2014-06-03T13:16:23.390" Score="2" Body="&lt;p&gt;The most efficient way that I can think of to do it would be as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For each input sample $x[n]$, calculate $|x[n]|^2$. This is more efficient than calculating $|x[n]|$, because you don't have to do the square root:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|x[n]| = \sqrt{\text{Re}\{x[n]\}^2+\text{Im}\{x[n]\}^2} \\&#xA;|x[n]|^2 = \text{Re}\{x[n]\}^2+\text{Im}\{x[n]\}^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Average the instantaneous power estimate $|x[n]|^2$ as needed for your application (you mentioned exponential averaging).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Note that you can also get $|x[n]|^4$ efficiently using this method; you just square the measurement of $|x[n]|^2$ that you made above, then average again as desired.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-06-03T13:16:23.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16660" PostTypeId="1" CreationDate="2014-06-03T15:19:08.083" Score="4" ViewCount="226" Body="&lt;p&gt;Can someone help me with this interview question? It is about the sampling frequency rate.&#xA;Under what condition the available bandwidth is $f_s$ instead of $\frac{f_s}{2}$?&lt;/p&gt;&#xA;" OwnerUserId="9098" LastEditorUserId="29" LastEditDate="2014-06-03T20:14:24.210" LastActivityDate="2014-06-04T13:02:34.093" Title="Under what condition is the available bandwidth $f_s$ instead of $\frac{f_s}{2}$?" Tags="|discrete-signals|frequency-spectrum|dsp-core|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16661" PostTypeId="2" ParentId="16660" CreationDate="2014-06-03T15:48:34.570" Score="7" Body="&lt;p&gt;If your signal is real-valued, then it's spectrum is conjugate symmetric. That means, that negative frequencies (or frequencies from $\frac{f_s}{2}$ up to $f_s$) are mirrored. Thus we can always neglect frequencies above Nyquist range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although, &lt;strong&gt;if your signal is complex valued&lt;/strong&gt;, then such symmetry won't exist, and frequencies above $\frac{f_s}{2}$ contain extra information. So you can indeed say that &lt;strong&gt;the bandwidth of your signal is $f_s$&lt;/strong&gt;. This somewhat makes sense, because you might represent now both real and imaginary part of your signal on your frequency axis (twice as much space is necessary). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some small example of sawtooth signal ($f_s=105Hz$), with fundamental frequency of $f_0=10 Hz$ and same signal modulated by the complex exponential with $f_{mod}=5Hz$. In such way we get time domain signal with complex values:&#xA; $$x_{mod}(t)=x(t)e^{2\pi if_{mod}t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, amplitude (phase also) spectrum for real valued signal is symmetrical around the Nyquist frequency (aliasing is also visible whilst aliased harmonics are not covered by genuine). On the contrary same sawtooth modulated by complex sinusoid (and cosinusoid) is no longer symmetrical. Probably you will notice another &quot;feature&quot; of this signal, while taking a closer look at peak frequencies and relating it to $f_{mod}$...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7yx2w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And traditionally, code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Time domain parameters&#xA;fs = 105;&#xA;dt = 1/fs;&#xA;T = 10*pi;&#xA;t = 0:dt:T-dt;&#xA;N = length(t);&#xA;%% Sawtooth signal generation&#xA;f0 = 10;&#xA;x = sawtooth(2*pi*f0*t);&#xA;X = abs(fft(x))/N;&#xA;freqs = (0:N-1).*(fs/N);&#xA;subplot(211)&#xA;plot(freqs, X)&#xA;grid on&#xA;hold on&#xA;plot([fs/2 fs/2], [0 max(X)], '--r')&#xA;xlim([0 max(freqs)])&#xA;xlabel('Frequency [Hz]')&#xA;ylabel('Amplitude')&#xA;title('FT of real-valued signal')&#xA;l=legend({'sawtooth','$\frac{f_s}{2}$'});&#xA;set(l,'Interpreter','Latex');&#xA;%% Complex modulated sawtooth signal&#xA;f0_cplx = 15;&#xA;y = x.*exp(2*1i*pi*f0_cplx*t);&#xA;Y = abs(fft(y))/N;&#xA;subplot(212)&#xA;plot(freqs, Y)&#xA;grid on&#xA;hold on&#xA;plot([fs/2 fs/2], [0 max(Y)], '--r')&#xA;xlim([0 max(freqs)])&#xA;xlabel('Frequency [Hz]')&#xA;ylabel('Amplitude')&#xA;title('FT of complex-valued signal')&#xA;l=legend({'complex mod-sawtooth','$\frac{f_s}{2}$'});&#xA;set(l,'Interpreter','Latex');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-04T13:02:34.093" LastActivityDate="2014-06-04T13:02:34.093" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16662" PostTypeId="1" AcceptedAnswerId="16664" CreationDate="2014-06-03T16:38:42.993" Score="1" ViewCount="1324" Body="&lt;p&gt;I'm experimenting with image resizing techniques and algorithms. Specifically, I'm significantly downsizing images, e. g. from 2048x1536 to 64x48 - 32 times.&lt;br&gt;&#xA;Now, say I'm using a 4x4 kernel. Right now I'm upscaling the image to be by a factor of power of 4 larger than the target (2048x1536 becomes 4096x3072), and then process the image 3 times, each time obtaining a new image 4 times smaller than the source. Seems ineffecient. Is there a trick to it?&lt;/p&gt;&#xA;" OwnerUserId="9100" LastActivityDate="2014-06-03T17:34:22.797" Title="How to downscale an image with interpolation by a factor larger than interpolation kernel size?" Tags="|image-processing|interpolation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16663" PostTypeId="1" AcceptedAnswerId="16683" CreationDate="2014-06-03T17:09:00.083" Score="1" ViewCount="593" Body="&lt;p&gt;I am currently reading &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=479986&quot; rel=&quot;nofollow&quot;&gt;SEGMENTATION AND RECOGNITION OF SYMBOLS WITHIN HANDWRITTEN MATHEMATICAL EXPRESSIONS&lt;/a&gt;. There is one sentence I don't understand:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The preprocessing stage is subdivided into three steps: &lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;smoothing the input data by lowpass-filtering.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In this context your data usually looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[(x1, y1), (x2, y2), ...], &#xA; [(x12, y12), ...],&#xA; ...&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you have list of coordinates that are ordered by time. Each sublist is exactly one line or a single point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've only heard of low-pass filters in the context of acoustics / electronics so far (I don't know much about these topics). In those contexts it's obvious what it means to let low frequencies pass / cut high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is a low-pass filter in the context of handwritten symbol recogntion?&lt;/p&gt;&#xA;" OwnerUserId="9101" LastActivityDate="2014-06-04T18:14:10.987" Title="What is a low-pass filter for a sequence of tuples?" Tags="|lowpass-filter|text-recognition|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16664" PostTypeId="2" ParentId="16662" CreationDate="2014-06-03T17:34:22.797" Score="2" Body="&lt;p&gt;It is arguably inefficient. You could achieve the same results with a single processing step using a single kernel. You can do this by convolving all of the kernels together, then applying your resize using this larger kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar process to this is used in most digital painting packages. The resizing usually offers some fixed kernel sizes (e.g. bilinear / bicubic - these may be referred to as 'smoother' / 'sharper') as well as some form of intelligent resize (sometimes called 'smart' or 'best quality') where the resampling kernel size is a factor of the image size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need more information you should add some details about what precisely you are trying to achieve.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2014-06-03T17:34:22.797" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16665" PostTypeId="2" ParentId="16656" CreationDate="2014-06-03T19:12:03.810" Score="3" Body="&lt;p&gt;I've used the &lt;a href=&quot;http://ocg6.marine.usf.edu/~liu/Papers/Liu_etal_2007_JAOT_wavelet.pdf&quot; rel=&quot;nofollow&quot;&gt;Liu-Liang-Weisberg paper&lt;/a&gt; before, and it worked pretty well. There's some example &lt;a href=&quot;http://ocg6.marine.usf.edu/~liu/wavelet_test_ElNino3_YLiu.m&quot; rel=&quot;nofollow&quot;&gt;code on this page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, they propose that squaring wavelet coefficients and dividing them by their respective scales normalizes the spectrum. The paper provides proof and motivation.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-06-03T19:12:03.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16666" PostTypeId="2" ParentId="16647" CreationDate="2014-06-03T19:21:32.963" Score="0" Body="&lt;p&gt;It &lt;em&gt;does&lt;/em&gt; have two dimensions. An image of size $N \times M$ has two dimensions. Three dimensions would be $N \times M \times L$, and so on. For each pixel with coordinates $x$ and $y$, in two dimensions, you have a spectrum magnitude value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you start treating rows or columns of your spectrogram as vectors, then you're interpreting them as 451 points in 128-dimensional space or 128 points in 451-dimensional space. This is different.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-06-03T19:21:32.963" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16667" PostTypeId="1" CreationDate="2014-06-03T21:22:19.630" Score="1" ViewCount="184" Body="&lt;p&gt;Say I've got a signal that I know is composed of periodic components. However, I'm worried that there are &quot;spiky&quot; events that are embedded in this signal, and potentially occurring periodically. I can't just look at the power spectrum of the signal, because the spiky event will show up across many frequencies in the power spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kinds of methods are out there to tease apart components of a signal that &lt;em&gt;can&lt;/em&gt; reasonably be decomposed into sine waves, from those that &lt;em&gt;cannot&lt;/em&gt; (like a spike)?&lt;/p&gt;&#xA;" OwnerUserId="9102" LastActivityDate="2014-06-03T21:32:26.767" Title="How to detect a spiky signal embedded in a periodic signal" Tags="|filters|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16668" PostTypeId="2" ParentId="16667" CreationDate="2014-06-03T21:32:26.767" Score="2" Body="&lt;p&gt;You can use linear prediction: look at the residual of an AR model. If the signal is a sum of sinusoidal components - and provided the order of the model is appropriately chosen - the prediction error will be small. Unexpected spikes will directly show up in the error signal.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-06-03T21:32:26.767" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16669" PostTypeId="1" AcceptedAnswerId="16685" CreationDate="2014-06-04T01:14:13.467" Score="0" ViewCount="281" Body="&lt;p&gt;I wish to find the maximum frequency of $\sin(\varphi(t))$, where $\varphi(t)=u(t)$. We have $\omega(t)=d\varphi(t)/dt=\delta(t)$. What is the the maximum instantaneous frequency $\omega_{\max}$? &lt;/p&gt;&#xA;" OwnerUserId="9092" LastEditorUserId="9092" LastEditDate="2014-06-04T19:18:29.910" LastActivityDate="2014-06-04T19:18:29.910" Title="what is the maximum instantaneous frequency of Dirac delta?" Tags="|frequency|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16670" PostTypeId="1" AcceptedAnswerId="16676" CreationDate="2014-06-04T02:30:23.643" Score="0" ViewCount="1886" Body="&lt;p&gt;I'm new to dsp.stackexchange and digital signal processing. I'm required to develop an app to measure the similarity of two signals.for an example I need to compare breathing of a man whether it is abnormal or normal. I have recorded two breathing signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8710/calculating-similarity-between-two-signal-plots&quot;&gt;Relative error of two signals&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have compared two signals and obtained correlation of two signal. It gives crazy result (because I'm using Android phone it might contain noise). I would like to calculate the  relative error of two signals. In the above link there is an answer on how to get the relative error. But I can't understand the formula. I have two double arrays containing values after doing FFT. I'm stuck at applying above formula. How can I go through this?&lt;/p&gt;&#xA;" OwnerUserId="9103" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-06-04T09:07:08.620" Title="calculate relative error of two signals" Tags="|correlation|" AnswerCount="1" CommentCount="2" ClosedDate="2014-06-16T05:31:24.653" ContentLicense="CC BY-SA 3.0" />
  <row Id="16671" PostTypeId="1" AcceptedAnswerId="16672" CreationDate="2014-06-04T02:33:03.967" Score="2" ViewCount="11905" Body="&lt;p&gt;I have an exercise that gives me the transfer function of a system &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s) = \frac{3s^2+27}{s^4+8s^3 + 16s^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and an input&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \frac13 cos(3t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ask's what is the output&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't whant the answer but the steps to calculate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where to start? I need to find the inverse or there's a shorcut? &lt;/p&gt;&#xA;" OwnerUserId="8855" LastEditorUserId="8855" LastEditDate="2014-06-04T12:28:47.067" LastActivityDate="2014-06-04T12:28:47.067" Title="Output of a system given it's transfer function and input (beginner)" Tags="|transfer-function|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16672" PostTypeId="2" ParentId="16671" CreationDate="2014-06-04T04:19:41.363" Score="5" Body="&lt;p&gt;For an LTI system, output $y(t)$ is given by&#xA;$$y(t) = h(t)\otimes x(t)$$&#xA;Where $x(t)$ is input and $h(t)$ is impulse response of the system. The operator $\otimes$ represents convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution operation is mapped into multiplication in Laplace domain. ie,&#xA;$$Y(s) = H(s)\times X(s)$$&#xA;Where, $Y(s)$, $H(s)$ and $X(s)$ are the Laplace transform of $y(t)$, $h(t)$ and $x(t)$ respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use any one of the above equation to solve your problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two ways: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find $h(t)$ from $H(s)$ and use first equation. &lt;strong&gt;OR&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Find $X(s)$ from $x(t)$, use second equation to find $Y(s)$ and then find $y(t)$ from it.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I prefer second method.&lt;/p&gt;&#xA;" OwnerUserId="8871" LastEditorUserId="8871" LastEditDate="2014-06-04T09:29:16.143" LastActivityDate="2014-06-04T09:29:16.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16675" PostTypeId="2" ParentId="16657" CreationDate="2014-06-04T06:28:31.067" Score="0" Body="&lt;p&gt;&lt;strong&gt;Focusing on denominator:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By definition $x^2(n)$ is complex:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x^2(n) = \Re\{x(n)\}^2 - \Im\{x(n)\}^2 + i2\Re\{x(n)\}\Im\{x(n)\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Re\{x^2(n)\} = \Re\{x(n)\}^2 - \Im\{x(n)\}^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Im\{x^2(n)\} = 2\Re\{x(n)\}\Im\{x(n)\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for division: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1}{E[x^2(n)]} =  \frac{E[\Re\{x^2(n)\}] - iE[\Im\{x^2(n)\}]}{|E[\Re\{x^2(n)\}]|^2 - |E[\Re\{x^2(n)\}]|^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end the division operation requires two integration (using 1st order recursive or decaying exponential) one for real part and other for imaginary. Two multiplications to compute the square, one subtraction and one division. I cannot think of any savings in terms of computations here. Others might pitch in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Numerator&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree with Jason's approach. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-06-04T06:28:31.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16676" PostTypeId="2" ParentId="16670" CreationDate="2014-06-04T09:07:08.620" Score="0" Body="&lt;p&gt;So from the other post your error is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;ERR = \sum \left | G_1(n) - G_2(n) \right|^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate this should be quite simple. Do an element wise subtraction to get the difference between the two frequency responses at each point. Then square each element (magnitude squared if you have any imaginary components for some reason). Then sum over all the elements to get the total difference/error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned in the other post you probably want to normalise this by the reference signal to make detecting abnormality easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly you could just take the absolute difference rather than squaring. Squaring is more conventional though as it emphasises big differences more and is related to the variance.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-06-04T09:07:08.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16677" PostTypeId="1" CreationDate="2014-06-04T09:36:18.417" Score="1" ViewCount="52" Body="&lt;p&gt;I have 2 satellite transponders closely situated, transmitting the same signal. At the receiver I receive this composite signal. I have to equalize it in such a way that the demodulator sees only one of the two signals from the composite signal. So, I modelled this situation as a channel with input $x(n)$ given to a channel whose output response is given by, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(n)=x(n)+s*x(n-D)&#xA;$$&#xA;where &#xA;$$&#xA;\text{0}\leq\text{s}\leq\text{1}\\&#xA;D=delay&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I don't have a reference signal at the receiver, I am performing blind-equalization using a traversal structure. I know that ideally I need an IIR structure for perfect equalization. Since, the modulation schemes used are QPSK and BPSK I am using CMA (constant modulus algorithm) based zero-memory predictor for generating the reference signal to generate the error signal from the filter output. I am using LMS algorithm for updating the filter taps with mu=0.0001. The reason for choosing CMA is that it can also work on signals with frequency offsets. We have frequency offsets due to Doppler shifts in this case. I have also gone through non-linear equalization techniques like MMSE+Viterbi algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you comment on the strategy I followed and suggest any other ways to investigate this situation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, JK&lt;/p&gt;&#xA;" OwnerUserId="9079" LastActivityDate="2014-06-04T09:36:18.417" Title="Need suggestions on the class of blind adaptive filters that can be used in my situation" Tags="|blind-deconvolution|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16678" PostTypeId="1" CreationDate="2014-06-04T10:31:32.550" Score="1" ViewCount="194" Body="&lt;p&gt;0 down vote favorite&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am totally new to Image processing. I just started my Master thesis in the area of Computer vision and Machine learning. My background is Informatics. Now, my first task is to register the images of some fishes(Image registration) as they come out of water. I have got stream of images and I want to come up with a model of the fish by aligning the temporally different images of a fish. As, I can understand, I will have to fist of all remove the background and water from the images to work on just fishes, am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone give me a brief idea of how I should go forward or the things I should read first before I can understand the things. For example, should I read the basics of Image Processing, Feature detection, Image segmentation....? and regarding the programming language I can use - one where I can find good libraries, forums, other help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be really grateful, if anyone can help. Thanks&lt;/p&gt;&#xA;" OwnerUserId="9108" LastEditorUserId="128" LastEditDate="2020-08-13T06:56:40.873" LastActivityDate="2020-08-13T06:56:40.873" Title="Background Removal and Object Tracking - Track Fish Jumping Out of the Water" Tags="|computer-vision|image-processing|image-segmentation|image-registration|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16679" PostTypeId="2" ParentId="16678" CreationDate="2014-06-04T11:00:46.087" Score="1" Body="&lt;p&gt;I`d recommend you to go through any of this courses (they include lectures, references and task for labs)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cw.felk.cvut.cz/wiki/courses/ae4m33mpv/start&quot; rel=&quot;nofollow&quot;&gt;https://cw.felk.cvut.cz/wiki/courses/ae4m33mpv/start&lt;/a&gt; - course from Czech Technical University &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://cs.brown.edu/courses/cs143/&quot; rel=&quot;nofollow&quot;&gt;http://cs.brown.edu/courses/cs143/&lt;/a&gt; from Brown University&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7030" LastActivityDate="2014-06-04T11:00:46.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16681" PostTypeId="2" ParentId="16678" CreationDate="2014-06-04T12:37:51.400" Score="1" Body="&lt;p&gt;Check out the Computer Vision System Toolbox for MATLAB. &#xA;Here's an example of &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/motion-based-multiple-object-tracking.html&quot; rel=&quot;nofollow&quot;&gt;detecting and tracking moving objects&lt;/a&gt;.&#xA;Here's an example of &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/find-image-rotation-and-scale-using-automated-feature-matching.html&quot; rel=&quot;nofollow&quot;&gt;image alignment&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-06-04T12:37:51.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16682" PostTypeId="1" AcceptedAnswerId="16684" CreationDate="2014-06-04T13:34:50.523" Score="1" ViewCount="104" Body="&lt;p&gt;I very simply have a .wav audio file, but there is a note with it that says &quot;This audio has been sped up by 10x&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering, what does it mean exactly from a signal processing perspective for an audio signal to be 'sped up' by some factor, and secondly, how can I undo this? Is it possible?&lt;/p&gt;&#xA;" OwnerUserId="1329" LastActivityDate="2014-06-04T13:48:30.747" Title="What does it mean for audio to be 'sped up'? How can I undo it?" Tags="|audio|signal-analysis|sampling|sound|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16683" PostTypeId="2" ParentId="16663" CreationDate="2014-06-04T13:42:42.980" Score="2" Body="&lt;p&gt;'&lt;em&gt;Frequency&lt;/em&gt;' for a sequence of values is the measure of how sharp the values in that sequence change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the sequence $x_1(n)=[\begin{array}[cccccccc]&amp;amp;\cdots &amp;amp;1, &amp;amp;1, &amp;amp;1, &amp;amp;1, &amp;amp;\cdots\end{array}]$ has a frequency 0 but the  $x_2(n)=[\begin{array}[cccccccc] &amp;amp;\cdots &amp;amp;1 &amp;amp;1 &amp;amp;7 &amp;amp;1 &amp;amp;\cdots\end{array}]$ is a  higher frequency signal since there is a sharp change in sequence value (1 to 7 and 7 to 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A low pass filter is a system which attenuates the high frequency components. OR it reduces the sharpness (or introduces blur) in case of an image. OR a low pass filter does not allow sudden changes in values and smoothens these changes. Figure below shows low passing various sequences ($\style{color:blue}{blue:input}$ $\style{color:red}{red:output}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6G5yn.gif&quot; alt=&quot;Mean filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a system whose output is a sequence $y(n)$ where n$^{th}$ value in $y(n)$ is the average of n$^{th}$, (n-1)$^{th}$ and (n+1)$^{th}$ value of input sequence is a simple low pass filter. If $x_2(n)$ is fed as input to this filter, then output, will  be $[\begin{array}[cccccccc] &amp;amp;\cdots &amp;amp;1 &amp;amp;3 &amp;amp;3 &amp;amp;3 &amp;amp;1 &amp;amp;\cdots\end{array}]$ and it is clear that the magnitude of change between consecutive values are reduced. or the high frequency components are attenuated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you have a tuple, you have to separate it into two sequences ([x1,x2,....] and [y1,y2,....]). The low pass filtering should be done on these sequences separately. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In character recognition algorithms, low pass filtering is used in pre-processing to remove noises or unwanted small dots, having a width of one or two pixels. see an example of low pass filtering used for noise removal in image processing.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8MhAE.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8871" LastEditorUserId="8871" LastEditDate="2014-06-04T18:14:10.987" LastActivityDate="2014-06-04T18:14:10.987" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16684" PostTypeId="2" ParentId="16682" CreationDate="2014-06-04T13:48:30.747" Score="3" Body="&lt;p&gt;It could mean:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;That the metadata in the .wav file wrongly indicates that the signal was recorded at a sample rate 10x higher than the true value (for example it is advertised as having been recorded at 80kHz while it has been recorded at 8kHz). Simply fixing the metadata undoes this.&lt;/li&gt;&#xA;&lt;li&gt;That the signal has been downsampled by a factor of 10, but is still tagged as having been recorded at the original sample rate. This can be undone by dividing by 10 the playback sample rate (by tweaking the metadata); or by upsampling the signal by a factor of 10 without changing the playback sample rate. Note that in any case, 90% of the bandwidth of the original signal (the high frequency content) has been lost and cannot be restored (or only very approximately through &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_band_replication&quot; rel=&quot;nofollow&quot;&gt;spectral band replication&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;That a &lt;a href=&quot;http://en.wikipedia.org/wiki/Audio_timescale-pitch_modification&quot; rel=&quot;nofollow&quot;&gt;time-stretching&lt;/a&gt; (time-scale modification) algorithm has been applied to it. This is a lossy process, and cannot be undone without severe loss at such a high stretch factor. The &quot;antidote&quot; is simply to use any time-stretching algorithm with a stretch factor of 10x.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-06-04T13:48:30.747" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="16685" PostTypeId="2" ParentId="16669" CreationDate="2014-06-04T14:38:16.403" Score="1" Body="&lt;p&gt;It's not very sensible to even try to assign an instantaneous frequency to signals like yours. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your specific example fails for more fundamental reasons than usual however, namely for the fact that the Dirac delta is not a function but something mathematicians call a &quot;distribution&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This for example implies that we cannot assign a value to $\delta(0)$ even though we know $\delta(x)=0$ for all $x\neq0$. The definition of the delta distribution is, that $\int_\mathbb{R} \delta(x) f(x) dx=f(0)$. From here it follows that $\delta(0)$ cannot have a finite value. However, stating that it is &quot;infinite&quot; there is also not enough. There's simply no way to think of any value at $0$ that makes sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the answer to your question is that the instantaneous frequency is $0$ almost everywhere, and undefined at $t=0$. So the maximum (and minimum!) value of $\omega$ is $0$!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can avoid this situation by replacing the unit step with a smooth approximation of a unit step. With this you can give your maximum instantaneous frequency any value you desire, even if you take a limit of a function sequence that results in the unit step itself. So the answer is absolutely arbitrary.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-06-04T14:38:16.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16686" PostTypeId="1" CreationDate="2014-06-04T15:11:54.607" Score="5" ViewCount="588" Body="&lt;p&gt;I'm searching for a method that can smooth a 3D volume whilst preserving the edges in my volume.&lt;/p&gt;&#xA;&lt;p&gt;I researched anisotropic diffusion filtering and bilateral filtering, but I'm having trouble to evaluate if they can be efficiently used on +30M voxels volumes.&lt;/p&gt;&#xA;&lt;p&gt;So I need:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Relatively fast algorithm even with 512x512x200 volumes&lt;/li&gt;&#xA;&lt;li&gt;Good edge preserving properties&lt;/li&gt;&#xA;&lt;li&gt;Any help to understand those methods.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="33605" LastEditDate="2023-12-03T03:39:06.920" LastActivityDate="2023-12-03T03:39:06.920" Title="Image Edge Preserving Smoothing" Tags="|image-processing|edge-detection|smoothing|edge-preserving-filter|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16687" PostTypeId="1" CreationDate="2014-06-04T17:10:54.277" Score="1" ViewCount="575" Body="&lt;p&gt;I understand, that image padding is necessary in order to prevent wrap-around effects due to circular convolution. My set of questions are related to different padding schemes. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Zero Padding is easy to visualize in the context of reducing wrap-around effects. In the case of schemes like mirror reflection, I have a doubt that since these are non-zero paddings, so doesn't this kind of padding distort the true spectral content of the image (in the sense that the relative spectral content of two frequencies getting changed ) ? &lt;/li&gt;&#xA;&lt;li&gt;Could someone present examples of effects due to different padding schemes (in MATLAB, mirror, symmetric and zero padding are available) and point out subtle differences arising due to different schemes and possibly pointing out their importance ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would be very grateful for the patience of reading this question and giving your consideration to it.&lt;/p&gt;&#xA;" OwnerUserId="3566" LastActivityDate="2014-06-04T17:10:54.277" Title="Impact of different padding schemes in Frequency domain image filtering" Tags="|image-processing|convolution|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16691" PostTypeId="2" ParentId="16630" CreationDate="2014-06-04T18:31:16.013" Score="1" Body="&lt;p&gt;I suspect that most likely the audio coming in is integer, and not floating point. Depending on your device, operating system and type of file input, you can get one or the other. Read documentation for audio input API you're using to see which format the audio is in. Also, if it's integer, it's likely to be 16 bit rather than 32 bit. In any case, again, read the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;BASS library has a flag you can set to get floating point values everywhere:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BASS_SetConfig(&#xA;    BASS_CONFIG_FLOATDSP,&#xA;    BOOL floatdsp&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-06-04T18:31:16.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16692" PostTypeId="1" AcceptedAnswerId="16695" CreationDate="2014-06-04T20:05:14.367" Score="3" ViewCount="2761" Body="&lt;p&gt;I'm learning some basics of image processing. Recently I've read about image filtering and two-dimensional Fourier transform, because I'm preparing for exam. And I have one question I don't know answer for: is it possible to do filtering in frequency domain (by using Fourier transform), which in spatial domain is implemented by computing magnitude of gradient of the image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that gradient operator is defined:&#xA;$$&#xA;\nabla f \equiv grad(f) = \begin{bmatrix}g_{x} \\ g_{y}\end{bmatrix}&#xA;$$&#xA;and the magnitude of gradient:&#xA;$$&#xA;M(x,y) = \sqrt{g_{x}^{2} + g_{y}^{2}}&#xA;$$&#xA;In spatial domain we can use gradient to find edges. High frequencies are responsible for edges. High frequency means the rate of change is high, thus gradient has high value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But can we do similar thing in frequency domain? Has the magnitude of gradient operator any equivalent in frequency domain?&lt;/p&gt;&#xA;" OwnerUserId="9117" LastEditorUserId="128" LastEditDate="2019-10-19T20:58:52.747" LastActivityDate="2019-10-19T20:58:52.747" Title="Magnitude of the Gradient in Frequency Domain" Tags="|image-processing|filters|fourier-transform|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16693" PostTypeId="1" AcceptedAnswerId="49965" CreationDate="2014-06-04T20:11:54.653" Score="7" ViewCount="358" Body="&lt;p&gt;Sorry if this is too damned long. I did what I could to abbreviate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is about &lt;a href=&quot;https://en.wikipedia.org/wiki/Least-angle_regression&quot; rel=&quot;nofollow noreferrer&quot;&gt;Least Angle Regression&lt;/a&gt; (LARS).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to numerical work with matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I have a way to compute Least Angle without explicit matrix inversion. I'm hoping someone with more experience can check my work to see if I'm doing anything dangerous, illegal, or otherwise ignorant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper: &lt;a href=&quot;http://www.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Least Angle Regression&lt;/a&gt;, says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;...we compute $m−k$ inner products $c_{jk}$ of the non-active $x_j$&#xA;  with the current residuals to identify the next active variable, and&#xA;  then &lt;strong&gt;invert&lt;/strong&gt; the $k \times  k$ matrix $\mathcal{G}_k = X'_kX_k$ to&#xA;  find the next LARS direction.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(Emphasis mine.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They update the Cholesky decomposition in each iteration, so it seems they're doing something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;At $k$th iteration:&lt;/li&gt;&#xA;&lt;li&gt;$X_k$ is a matrix formed from $k$ predictors.&lt;/li&gt;&#xA;&lt;li&gt;$X'_k X_k = \mathcal{G}_{k}$&lt;/li&gt;&#xA;&lt;li&gt;We already have $\mathcal{G}_{k-1}$, and $\mathcal{G}_{k} = \mathcal{G}_{k-1}$ except for a new row and column of dot products, so let's say $$\mathcal{G}_{k} = \left[ \begin{array}{cc}&#xA;\mathcal{G}_{k-1} &amp;amp; \mathbf{p} \\&#xA;\mathbf{p}' &amp;amp; x \end{array} \right]$$&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We can find the Cholesky decomposition $L_k$ from $L_{k-1}$:&#xA;$$L_{k} = \left[ \begin{array}{cc}&#xA;L_{k-1} &amp;amp; \mathbf{r}=L_{k-1}^{-1}\mathbf{p} \\&#xA;\mathbf{r}' &amp;amp; y=(x - \mathbf{r}\cdot\mathbf{r})^{-\frac12} \end{array} \right]$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find $L_k^{-1}$. &lt;strong&gt;Note this explicit inversion.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;$\mathcal{G}^{-1}_k = {L'}_k^{-1} L_k^{-1}$&lt;/li&gt;&#xA;&lt;li&gt;$A_k = (1'_k \mathcal{G}^{-1}_k 1_k)^{-\frac12}$, where $1_k$ is a vector of $k$ 1s.&lt;/li&gt;&#xA;&lt;li&gt;${\mathbf w}_k = A_k {\mathcal G}_k^{-1} 1_k$&lt;/li&gt;&#xA;&lt;li&gt;Use ${\mathbf w}_k$ to select the $(k+1)$th predictor.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now here's my approach&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;At $k$th iteration:&lt;/li&gt;&#xA;&lt;li&gt;Find $L_k$, $\mathbf{r}$, and $y$ as above&lt;/li&gt;&#xA;&lt;li&gt;Define $L_k {\mathbf q}_k = 1_k$&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find $\mathbf{q}_k$:&#xA;$${\mathbf q}_{k} = \left[ \begin{array}{c}&#xA;{\mathbf q}_{k-1} \\&#xA;\text{$\scriptsize{(1 - {\mathbf q}_{k-1} \cdot \mathbf{r})/y}$} \end{array} \right]$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\begin{align}A_k &amp;amp;= (1'_k \mathcal{G}^{-1}_k 1_k)^{-\frac12} \\&#xA;                     &amp;amp;= (1'_k L'{_k}^{-1} L_k^{-1} 1_k)^{-\frac12} \\&#xA;                     &amp;amp;= \left[(L_k^{-1} 1_k)' (L_k^{-1} 1_k)\right]^{-\frac12} \\&#xA;                     &amp;amp;= ({\mathbf q}'_k {\mathbf q}_k)^{-\frac12} \end{align}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;$\begin{align}{\mathbf w}_k &amp;amp;= A_k {\mathcal G}_k^{-1} 1_k \\&#xA;                               &amp;amp;= A_k L'{_k}^{-1} {\mathbf q}_k \end{align}$&lt;/li&gt;&#xA;&lt;li&gt;So solve for ${\mathbf w}_k$: $\frac{1}{A_k} L'_k {\mathbf w}_k = {\mathbf q}_k$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Comments? Does it even matter if I'm right?&lt;/p&gt;&#xA;" OwnerUserId="7883" LastEditorUserId="128" LastEditDate="2020-03-22T00:52:50.863" LastActivityDate="2022-03-28T08:14:44.853" Title="Least Angle Regression (LARS) without Matrix Inversion" Tags="|matlab|matrix|linear-algebra|least-squares|convex-optimization|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="16695" PostTypeId="2" ParentId="16692" CreationDate="2014-06-04T22:59:21.530" Score="4" Body="&lt;p&gt;Remember that as part of computing the &lt;a href=&quot;http://en.wikipedia.org/wiki/Image_gradient&quot; rel=&quot;nofollow&quot;&gt;gradients of an image&lt;/a&gt;, you are really just convolving your image, with (two) spatial filters. This then gives you two 'gradient' images, which you can then combine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, to compute the x-direction-gradient-image $G_x$, you would convolve your image with a filter $f_x$ that might look like this $\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; -1\end{bmatrix}$. Similarly, to attain the y-direction-gradient-image,  $G_y$, you might convolve your image with a filter $f_y$ that looks like this $\begin{bmatrix} 1 \\ 0 \\ -1\end{bmatrix}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, your final gradient image would be $G = \sqrt{G_x^2 + G_y^2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good. However, you don't need to do the convolution pixel by pixel. Instead, you could simply take the 2D DFT of $f_x$, multiply it pixel by pixel with the 2D DFT of the image, and then take the 2D IDFT back into the spatial domain. This would then also give you $G_x$. (Do the same to find $G_y$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the answer is at least a partial yes, in that you can compute the x and y gradient images via the FFT algorithm, (an implementation of the DFT), and then simply treating each of them as an element in a vector, and finding the L2 norm. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="4619" LastEditDate="2014-07-19T15:27:25.867" LastActivityDate="2014-07-19T15:27:25.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16696" PostTypeId="1" AcceptedAnswerId="16706" CreationDate="2014-06-05T00:36:27.157" Score="0" ViewCount="6607" Body="&lt;p&gt;Given I have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a camera with estimated rigid motion 3x4 matrix $P = [R|t]$ that starts from the origin of the reference coordinate system&lt;/li&gt;&#xA;&lt;li&gt;an intrinsics 3x4 projection matrix $K$&lt;/li&gt;&#xA;&lt;li&gt;a 3D point $X$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How would I find its projection in the second camera/image? Is the following correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x = K*[R|t]*X$&lt;/p&gt;&#xA;" OwnerUserId="9120" LastActivityDate="2017-09-09T07:39:15.287" Title="Projecting a 3D point into new camera coordinates" Tags="|computer-vision|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16697" PostTypeId="1" CreationDate="2014-06-05T03:45:03.390" Score="9" ViewCount="4568" Body="&lt;p&gt;This is now a second time I am attempting to ask this very important but simple question here. What I want to know is can you do deconvolution by convolving a signal. It is often stated that, for example by cutting and boosting the same frequency on an equalizer the result is the original signal. Is that the case? Can convolution be removed by convolving? That would certainly brake the identity that the convolved signal must be n+m-1 in length. I tried this with an equalizer and the results seem to be close to perfect, just some quantization distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the above can be done, I can not arrive at this conclusion. For example If I convolve (1) with (1, 1) the result is (1, 1). I can not find any impulse response that if convolved with (1, 1) would result in (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is the truth here?&lt;/p&gt;&#xA;" OwnerUserId="9121" LastEditorUserId="128" LastEditDate="2018-08-19T15:22:06.933" LastActivityDate="2024-02-22T17:44:50.127" Title="Deconvolution by Convolution" Tags="|filters|convolution|deconvolution|inverse-problem|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16699" PostTypeId="2" ParentId="16697" CreationDate="2014-06-05T05:38:47.300" Score="12" Body="&lt;p&gt;Since convolution describes the operation of a linear time-invariant (LTI) system, the question is if the effect of an LTI system can be compensated by another LTI system. In the discrete-time domain you can use the $\mathcal{Z}$-transform to analyze LTI systems. If a signal $x(n)$ (with $\mathcal{Z}$-transform $X(z)$) is filtered by a system with impulse response $h(n)$ (with $\mathcal{Z}$-transform $H(z)$), then the $\mathcal{Z}$-transform of the resulting output signal $y(n)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=X(z)H(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recovering $X(z)$ from $Y(z)$ can theoretically be done by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{Y(z)}{H(z)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;except at points $z$ where $H(z)=0$. The above equation corresponds to convolution with an impulse response $g(n)$ with $\mathcal{Z}$-transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(z)=\frac{1}{H(z)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is if this system can be realized by a causal and stable filter. This is indeed the case if $H(z)$ is a minimum-phase system. Assuming rational transfer functions (which we always get when discrete-time systems consist of adders, multipliers, and delay elements), this means that $H(z)$ is a causal and stable system with all its zeros inside the unit circle of the complex plane (its poles are of course also inside the unit circle because of stability). Due the inversion in (1), the zeros of $H(z)$ are the poles of $G(z)$ and vice versa, i.e. if the zeros of $H(z)$ are inside the unit circle, then $G(z)$ is stable. One more thing that can be seen from (1) is that if $H(z)$ is an FIR system, then $G(z)$ is IIR. Nevertheless, in practice equalization if often done by FIR filters, which approximate the inverse filter in some optimal sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at a simple example. Assume an FIR system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(n)=\delta(n)-a\delta(n-1),\quad |a|&amp;lt;1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=1-az^{-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z)$ is a minimum-phase system because it has one pole at $z=0$ and a zero at $z=a$, which is inside the unit circle if $|a|&amp;lt;1$.&#xA;The inverse system is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(z)=\frac{1}{1-az^{-1}}=\sum_{n=0}^{\infty}a^nz^{-n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the impulse response of which is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(n)=a^n,\quad n\ge 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is of course IIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in this case the convolution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=(x*h)(n)=x(n)-ax(n-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be perfectly compensated for by the convolution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=(y*g)(n)=\sum_{k=0}^{\infty}g(k)y(n-k)=\sum_{k=0}^{\infty}a^ky(n-k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that exact deconvolution of a minimum-phase FIR system can only be achieved by an IIR system. The only systems that can be inverted (exactly) by FIR systems are all-pole IIR systems, i.e. systems with all their zeros at the origin of the complex plane (like $g(n)$ in the example above). Note however that in practice exact compensation is usually not the goal. E.g., in digital communications, almost all (linear) equalizers are implemented by transversal (FIR) filters, because they can be adapted more easily and because they are always stable.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-06-05T08:12:31.270" LastActivityDate="2014-06-05T08:12:31.270" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="16700" PostTypeId="2" ParentId="16697" CreationDate="2014-06-05T05:51:40.110" Score="4" Body="&lt;p&gt;What you want is &#xA;$$x(t) = (x(t)\otimes h(t))\otimes h'(t)$$&#xA;where $\otimes$ denotes convolution. Taking $Z$ transform,&#xA;$$X(z) = X(z) \times H(z) \times H'(z)$$&#xA;or&#xA;$$H'(z) = \frac{1}{H(z)} \tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can deconvolve a convolution sum if you you have inverse transfer function as expressed in (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For causal and stable system, the ROC of $H'(z)$ must extend to infinity and ROC should contain the unit circle. &lt;/p&gt;&#xA;" OwnerUserId="8871" LastEditorUserId="8871" LastEditDate="2014-06-05T08:38:35.233" LastActivityDate="2014-06-05T08:38:35.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16701" PostTypeId="1" CreationDate="2014-06-05T08:29:48.830" Score="2" ViewCount="208" Body="&lt;p&gt;Are transmit diversity signal and the multi-path signal same? Multi-path contains LOS+delayed and attenuated/distorted versions of it and transmit diversity signal contains LOS1+delayed LOS2+ +delayed and attenuated/distorted versions of the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kindly, elucidate in terms of the impact of each type of signal on the equalization used at the receiver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, JK&lt;/p&gt;&#xA;" OwnerUserId="9079" LastActivityDate="2014-06-06T11:52:10.050" Title="Transmit diversity vs multi-path?" Tags="|equalization|multipath|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16702" PostTypeId="2" ParentId="16701" CreationDate="2014-06-05T09:29:32.527" Score="3" Body="&lt;p&gt;Multi-path is a property of the communication channel (mostly the wireless channel). The received signal $r(t)$ is the sum of delayed and weighted versions of the transmit signal $x(t)$:&#xA;$$&#xA;r(t) = \sum_{i} a_i x(t-\tau_i)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transmit diversity is a property of the transmitter. It describes a technique using multiple transmit antennas, thus creating multiple communication channels that are different because the antennas are placed at different locations in space. The idea is to transmit the same information at the same time at different antennas. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's assume one receive antenna and two transmit antennas (2x1 multiple-input single-output (MISO)) the received signal is a superposition of both multi-path channels:&#xA;$$&#xA;r(t) = \sum_{i} a_i x(t-\tau_i)+\sum_{j} b_j x(t-\tau_j)&#xA;$$&#xA;The hope is that if transmission on one channel fails you will still receive a useful signal through the other channel thereby increasing the robustness of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the concept of receive diversity where multiple receive antennas are used (SIMO). And of course you can use multiple antennas on both receiver and transmitter side (MIMO).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using the scheme of transmitting the same data at the same time, an FIR filter can be used no matter if transmit diversity is applied or not, because to the receiver it will just appear like an ordinary multi-path channel. Advanced equalizer structures include the fractionally spaced equalizer and the decision-feedback equalizer. If you apply some space-time coding a the transmitter an according space-time decoder is required at the receiver.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-06-06T11:52:10.050" LastActivityDate="2014-06-06T11:52:10.050" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16703" PostTypeId="1" CreationDate="2014-06-05T10:40:39.240" Score="1" ViewCount="479" Body="&lt;p&gt;I am trying to understand the basics of the cross/auto-correlation if the noisy signal $y(t)$ which is received from the channel at the receiver. Here at receiver we want to estimate the noise in the received signal and then get a clear signal of $y(t)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are below:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How autocorrelation or cross-correlation is performed for this $y(t)$&#xA;signal? And what does tell us from the correlation function?&lt;/li&gt;&#xA;&lt;li&gt;What does the Fourier Transform of the correlation function say about&#xA;the noisy signal?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="9014" LastEditorUserId="8202" LastEditDate="2014-06-05T10:53:37.347" LastActivityDate="2014-06-05T10:53:37.347" Title="Noisy Signal auto/cross-correlation" Tags="|discrete-signals|fourier-transform|noise|autocorrelation|cross-correlation|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16705" PostTypeId="1" AcceptedAnswerId="16707" CreationDate="2014-06-05T11:21:26.920" Score="2" ViewCount="62" Body="&lt;p&gt;know that dynamic textures are spatially repetitive and temporally varying patterns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.I read one sentence in one paper &lt;strong&gt;i.e. They are sequences of frames exhibiting certain stationarity properties over time. They exhibit spatial self-similarity and temporal self-similarity.&lt;/strong&gt; but i don't understand how it does?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.&lt;strong&gt;Also how examples like &quot;traffic on road&quot; or &quot;rafting&quot; can be considered as Dynamic Textures&lt;/strong&gt;? Because i don't thing they exhibit any stationarity property over time.is it? &lt;/p&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="9035" LastEditDate="2014-06-05T11:40:17.773" LastActivityDate="2014-06-05T15:30:27.383" Title="which spatio-temporal properties does dynamic textures exhibits?" Tags="|computer-vision|image-processing|text-recognition|photo|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16706" PostTypeId="2" ParentId="16696" CreationDate="2014-06-05T11:22:39.940" Score="4" Body="&lt;p&gt;Your formula is correct. Here are some precisions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the matrix $P$ takes a scene point to an image reference coordinate frame;&lt;/li&gt;&#xA;&lt;li&gt;the matrix $K$ takes the coordinates of the point in the reference image frame and makes the necessary frame changes to fit with the actual camera (origin of the frame, pixel size...);&lt;/li&gt;&#xA;&lt;li&gt;$X$ is a 3D point in projective coordinates, i.e., $X = (x, y, z, 1)^T$, otherwise the dimensionality of the point is not correct with the projection matrix;&lt;/li&gt;&#xA;&lt;li&gt;$x$ will be actually a column of 3 rows: $x = (u,v,w)^T$, and the final image coordinates are given by diving $u$ and $v$ by $w$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A few answers to your comments:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the equation assumes an &lt;em&gt;ideal pinhole&lt;/em&gt; camera model. Thus, the coordinates are undistorted. You can actually find all these equations by yourself using basic triangular geometry and Thales's theorem;&lt;/li&gt;&#xA;&lt;li&gt;you don't add the projective coordinate (&quot;the 1&quot;) twice! The product $P \times (X,1)^T$ will create as output a projected (2D) point that has 3 coordinates, i.e., a 2D point in projective coordinates. What you need only is to &quot;remove&quot; the projective coordinate by dividing by $w$ at the end;&lt;/li&gt;&#xA;&lt;li&gt;to get the order always right, the best way is to think of these equations as I wrote then in plain English. You take a 3D world and project it onto the world plane given by the camera position ($P$, &lt;em&gt;extrinsic&lt;/em&gt; parameters). Then, you consider what happens for this particular camera model/sensor (&lt;em&gt;intrinsic&lt;/em&gt; parameters). The extrinsic parameter matrix describes the camera with respect to the world, while the intrinsic parameters are always teh same wherever you put your camera.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2014-06-06T07:29:17.370" LastActivityDate="2014-06-06T07:29:17.370" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16707" PostTypeId="2" ParentId="16705" CreationDate="2014-06-05T15:30:27.383" Score="3" Body="&lt;p&gt;Stationarity over time just means that if you come back and look at the traffic sometime later it will look pretty much the same as it did when you first saw it. Sure there will be different cars but even the new cars will look similar to the first ones. The cars might be in different positions but their random arrangement will have the same properties as the original arrangement. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-06-05T15:30:27.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16709" PostTypeId="1" CreationDate="2014-06-05T17:31:57.283" Score="2" ViewCount="676" Body="&lt;p&gt;I have &lt;span class=&quot;math-container&quot;&gt;$1200$&lt;/span&gt; face images in my training set. There are &lt;span class=&quot;math-container&quot;&gt;$2989$&lt;/span&gt; test face images. I am using &lt;a href=&quot;https://en.wikipedia.org/wiki/Eigenface&quot; rel=&quot;nofollow noreferrer&quot;&gt;eigenfaces&lt;/a&gt; (PCA) for feature extraction and &lt;a href=&quot;https://en.wikipedia.org/wiki/K-means_clustering&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-means clustering&lt;/a&gt;. I even tried all &lt;span class=&quot;math-container&quot;&gt;$2989$&lt;/span&gt; test face images as training set images, but no accuracy is achieved.&lt;/p&gt;&#xA;&lt;p&gt;Source code i tried:&lt;/p&gt;&#xA;&lt;pre class=&quot;lang-matlab prettyprint-override&quot;&gt;&lt;code&gt;tic&#xA;&#xA;clear all&#xA;close all&#xA;clc&#xA;% number of images on your training set.&#xA;M=100;&#xA;&#xA;% Chosen std and mean. &#xA;% It can be any number that it is close to the std and mean of most of the images.&#xA;um=60;&#xA;ustd=32;&#xA;&#xA;% read and show images(bmp);&#xA;S=[];   %img matrix&#xA;&#xA;for i=1:M&#xA;    str=strcat(int2str(i),'.jpg');   %concatenates two strings that form the name of the image&#xA;    eval('img=imread(str);');&#xA;&#xA;       [irow icol d]=size(img); % get the number of rows (N1) and columns (N2)&#xA;       temp=reshape(permute(img,[2,1,3]),[irow*icol,d]);     %creates a (N1*N2)x1 matrix&#xA;    S=[S temp];         %X is a N1*N2xM matrix after finishing the sequence&#xA;                        %this is our S&#xA;end&#xA;&#xA;&#xA;% Here we change the mean and std of all images. We normalize all images.&#xA;% This is done to reduce the error due to lighting conditions.&#xA;for i=1:size(S,2)&#xA;    temp=double(S(:,i));&#xA;    m=mean(temp);&#xA;    st=std(temp);&#xA;    S(:,i)=(temp-m)*ustd/st+um;&#xA;end&#xA;&#xA;% show normalized images&#xA;&#xA;for i=1:M&#xA;    str=strcat(int2str(i),'.jpg');&#xA;    img=reshape(S(:,i),icol,irow);&#xA;    img=img';&#xA;&#xA;&#xA;end&#xA;&#xA;&#xA;% mean image;&#xA;m=mean(S,2);   %obtains the mean of each row instead of each column&#xA;tmimg=uint8(m);   %converts to unsigned 8-bit integer. Values range from 0 to 255&#xA;img=reshape(tmimg,icol,irow);    %takes the N1*N2x1 vector and creates a N2xN1 matrix&#xA;img=img';       %creates a N1xN2 matrix by transposing the image.&#xA;&#xA;% Change image for manipulation&#xA;dbx=[];   % A matrix&#xA;for i=1:M&#xA;    temp=double(S(:,i));&#xA;    dbx=[dbx temp];&#xA;end&#xA;&#xA;% Covariance matrix C=A'A, L=AA'&#xA;A=dbx';&#xA;L=A*A';&#xA;% vv are the eigenvector for L&#xA;% dd are the eigenvalue for both L=dbx'*dbx and C=dbx*dbx';&#xA;[vv dd]=eig(L);&#xA;% Sort and eliminate those whose eigenvalue is zero&#xA;v=[];&#xA;d=[];&#xA;for i=1:size(vv,2)&#xA;    if(dd(i,i)&amp;gt;1e-4)&#xA;        v=[v vv(:,i)];&#xA;        d=[d dd(i,i)];&#xA;    end&#xA; end&#xA;&#xA; % sort,  will return an ascending sequence&#xA; [B index]=sort(d);&#xA; ind=zeros(size(index));&#xA; dtemp=zeros(size(index));&#xA; vtemp=zeros(size(v));&#xA; len=length(index);&#xA; for i=1:len&#xA;    dtemp(i)=B(len+1-i);&#xA;    ind(i)=len+1-index(i);&#xA;    vtemp(:,ind(i))=v(:,i);&#xA; end&#xA; d=dtemp;&#xA; v=vtemp;&#xA;&#xA;&#xA;% Normalization of eigenvectors&#xA; for i=1:size(v,2)       %access each column&#xA;   kk=v(:,i);&#xA;   temp=sqrt(sum(kk.^2));&#xA;   v(:,i)=v(:,i)./temp;&#xA;end&#xA;&#xA;% Eigenvectors of C matrix&#xA;u=[];&#xA;for i=1:size(v,2)&#xA;    temp=sqrt(d(i));&#xA;    u=[u (dbx*v(:,i))./temp];&#xA;end&#xA;&#xA;% Normalization of eigenvectors&#xA;for i=1:size(u,2)&#xA;   kk=u(:,i);&#xA;   temp=sqrt(sum(kk.^2));&#xA;    u(:,i)=u(:,i)./temp;&#xA;end&#xA;&#xA;&#xA;% show eigenfaces;&#xA;&#xA;for i=1:size(u,2)&#xA;    img=reshape(u(:,i),icol,irow);&#xA;    img=img';&#xA;    img=histeq(img,255);&#xA;&#xA;end&#xA;&#xA;&#xA;% Find the weight of each face in the training set.&#xA;omega = [];&#xA;for h=1:size(dbx,2)&#xA;    WW=[];    &#xA;    for i=1:size(u,2)&#xA;        t = u(:,i)';    &#xA;        WeightOfImage = dot(t,dbx(:,h)');&#xA;        WW = [WW; WeightOfImage];&#xA;    end&#xA;    omega = [omega WW];&#xA;end&#xA;toc&#xA;tic&#xA;% Acquire new image&#xA;% Note: the input image must have a bmp or jpg extension. &#xA;%       It should have the same size as the ones in your training set. &#xA;%       It should be placed on your desktop&#xA;ed_min=[];&#xA;srcFiles = dir('F:\mat2012 instaled\bin\database\100 trainingset\test\*.jpg');  % the folder in which ur images exists&#xA;&#xA;&#xA;for b = 1 : length(srcFiles)&#xA;    filename = strcat('F:\mat2012 instaled\bin\database\100 trainingset\test\',srcFiles(b).name);&#xA;    Imgdata = imread(filename);&#xA;    %figure, imshow(Imgdata);&#xA;&#xA;        InputImage=Imgdata;&#xA;&#xA;InImage=reshape(permute((double(InputImage)),[2,1,3]),[irow*icol,1]);&#xA;temp=InImage;&#xA;me=mean(temp);&#xA;st=std(temp);&#xA;temp=(temp-me)*ustd/st+um;&#xA;NormImage = temp;&#xA;Difference = temp-m;&#xA;&#xA;p = [];&#xA;aa=size(u,2);&#xA;for i = 1:aa&#xA;    pare = dot(NormImage,u(:,i));&#xA;    p = [p; pare];&#xA;&#xA;end&#xA;&#xA;InImWeight = [];&#xA;for i=1:size(u,2)&#xA;    t = u(:,i)';&#xA;    WeightOfInputImage = dot(t,Difference');&#xA;    InImWeight = [InImWeight; WeightOfInputImage];&#xA;end&#xA;noe=numel(InImWeight);&#xA;&#xA;z(b,:)=InImWeight;&#xA;&#xA;end&#xA;&#xA;&#xA;IDX = kmeans(z,5)&#xA;clustercount=accumarray(IDX, ones(size(IDX)));&#xA;%disp(clustercount);&#xA;toc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;5 different faces are shown below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hjjS1.png&quot; alt=&quot;a handful of faces&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately, images are not clustered properly. Same faces should be clustered, but different faces are being clustered.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Should I have to use still more face images for training?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can accurate clustering be achieved? What is the solution?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9091" LastEditorUserId="128" LastEditDate="2023-07-15T12:28:46.587" LastActivityDate="2023-12-12T19:02:30.320" Title="Face Recognition by Eigen Faces Algorithm" Tags="|computer-vision|machine-learning|pca|dimensionality-reduction|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16710" PostTypeId="1" AcceptedAnswerId="16713" CreationDate="2014-06-05T18:29:17.927" Score="4" ViewCount="2178" Body="&lt;p&gt;I am trying to segment and label white blood cells from this image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RSCaQ.jpg&quot; alt=&quot;Original Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using K-Means I managed to segment most of what I wanted:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UFcLX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as you can see, there are some cells connected to each other which I would like to label as separate objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my questions is:&#xA;Can you point me to some known algorithms that perform the task of automatically separating them?&#xA;This image comes from a data set with annotations of the cell centers, in case machine learning is involved...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, but much less important, it would be nice to hear suggestions about improving the K-Means segmentation (Discarding the 'Stains').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;Thanks! &#xA;After playing around with the regional minima function &#xA;(inextendedmin), I managed to segment all of the cells in the center, except for the bottom left in that cluster at first, but some cleaning up of the segmented image did the trick in the second watershed segmentation:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7c1Wu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit2:&lt;/strong&gt;&#xA;For anyone who still follows (or even cares), I managed to improve segmentation using &#xA;K-means for spatial clustering on the original bw image, where the number of cells I obtained via watershed was defined as k (number of clusters). The result provided a bit finer segmentation:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/CWRkM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The cells image is taken from &lt;a href=&quot;http://crema.di.unimi.it/~fscotti/all/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ALL-IDB&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7464" LastEditorUserId="7464" LastEditDate="2016-02-16T18:22:35.387" LastActivityDate="2018-10-24T21:07:31.260" Title="Segmentation and Labeling of White Blood Cells" Tags="|matlab|segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16711" PostTypeId="1" CreationDate="2014-06-05T18:41:44.703" Score="3" ViewCount="299" Body="&lt;p&gt;I have a set of objects, which may be spherical or elongated, which may or may not have a tail like structure attached to one or two ends. The tail may be long or short. It may also have a curve to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently looking over the information returned by regionprops and trying to see if anything jumps out at me which could be used to discriminate between normals and tails. I am also playing around with some morphological operations.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An opening operation followed by a comparison to the original mask is my current thought, but I'm not certain that this will be reliable enough in the presence of elongated cells, and I haven't yet found the &quot;perfect&quot; structuring element.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I am not highly experienced in the IA field (more of an intermediate level), I am thinking that it may be a good idea to reach out and see if others have any ideas that I have not yet considered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Test images are below.  The effective dynamic range is 12-bits, but I've normalized them so that they can be viewed more easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GM19K.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/FwWd2.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/IrLpA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is a &quot;normal&quot; for comparison:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bqBz5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5429" LastEditorUserId="5429" LastEditDate="2014-06-05T21:31:33.893" LastActivityDate="2016-05-04T08:33:34.483" Title="Detecting the Prescence of a &quot;Tail&quot;" Tags="|image-processing|image-segmentation|object-recognition|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16712" PostTypeId="1" AcceptedAnswerId="16717" CreationDate="2014-06-05T20:07:01.380" Score="0" ViewCount="68" Body="&lt;p&gt;Here goes the problem I faced:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sig1= A*sin(w*n)&#xA;Sig2= B*sin(w*n+phi)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Length of both signal is &lt;code&gt;L&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I put them in &lt;code&gt;F(1:2:2*L)=Sig1&lt;/code&gt; and &lt;code&gt;F(2:2:2*L)=Sig2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we know what would be the frequency response of &lt;code&gt;Sig1&lt;/code&gt; and &lt;code&gt;Sig2&lt;/code&gt; but is there any way we can find frequency response of &lt;code&gt;F&lt;/code&gt;? FFT of sinusoid is the delta function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9132" LastEditorUserId="8202" LastEditDate="2014-06-05T20:20:24.120" LastActivityDate="2014-06-05T21:49:36.917" Title="frequency response of a signal in which two signal added in" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16713" PostTypeId="2" ParentId="16710" CreationDate="2014-06-05T20:14:47.150" Score="1" Body="&lt;p&gt;I can't recommend anything in the realm of your clustering algorithm, but this looks to be pretty simple. The initial segmentation worked nicely; a simple &lt;a href=&quot;http://en.wikipedia.org/wiki/Watershed_%28image_processing%29&quot; rel=&quot;nofollow&quot;&gt;watershed&lt;/a&gt; should separate those cells. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function W = dowatershed(I)&#xA;    %% I is a logical mask (i.e., im2bw)&#xA;    d = -bwdist(~I);    &#xA;    l = watershed(d);&#xA;    W = I;&#xA;    W(l == 0) = 0;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5429" LastEditorUserId="5429" LastEditDate="2014-06-05T20:47:27.197" LastActivityDate="2014-06-05T20:47:27.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16714" PostTypeId="1" AcceptedAnswerId="16719" CreationDate="2014-06-05T20:38:44.767" Score="4" ViewCount="3829" Body="&lt;p&gt;In many applications such as estimation theory, when we need to estimate a parameter then we usually consider in presence of white gaussian noise of zero mean and some standard deviation. During Maximum likelihood estimation, we also use this assumption. So, my question is -&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Do we consider noise to be uncorrelated or correlated in estimation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the difference between correlated and uncorrelated noise and its significance&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why do we consider such a property of correlated or uncorrelated in estimation and when we say that measurement noise is gaussian.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="128" LastEditDate="2018-07-25T03:49:58.753" LastActivityDate="2018-07-25T03:49:58.753" Title="What Is Uncorrelated Noise" Tags="|noise|estimation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16716" PostTypeId="1" AcceptedAnswerId="16721" CreationDate="2014-06-05T21:41:28.673" Score="6" ViewCount="15091" Body="&lt;p&gt;I am calling &lt;code&gt;fspecial()&lt;/code&gt; in MATLAB to create a Guassian blur of an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Create Gaussian Filter&#xA;G = fspecial('gaussian', [5 5], 2);&#xA;&#xA;% Blur Image&#xA;blurredImage = imfilter(nonBlurredImage,G,'same')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The parameter [5 5] is hsize which defines the extent to which the Gaussian filter is applied ... which according to user &quot;Try Hard&quot; ... &quot;In the case of a gaussian filter, the intensity at each pixel around the central one is weighted according to a gaussian function prior to performing a box average over the region.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameter 2 is sigma ... with units of pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say the size of nonBlurredImage is 200x200. And that the side of each pixel represents a length of 0.25 mm. Then the image could resolve objects with a &quot;resolution&quot; of 1 line pair/mm without aliasing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I pass G = fspecial('gaussian', [5 5], 1) to the filter function, and then produce the blurred image. What would be the &quot;resolution&quot; of this image? How does it relate to hsize? If I instead used [10 10] or [1 1], how would that affect things?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9133" LastEditorUserId="128" LastEditDate="2019-11-17T17:48:44.217" LastActivityDate="2021-06-12T11:01:12.767" Title="Gaussian Blur In MATLAB and Connection to Image Resolution" Tags="|image-processing|matlab|blur|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16717" PostTypeId="2" ParentId="16712" CreationDate="2014-06-05T21:49:36.917" Score="0" Body="&lt;p&gt;What you ask for should rather be called a frequency spectrum or Fourier transform of the resulting signal. The term frequency response is reserved for linear time invariant systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, the answer to your question can be found using the z-transform of the signals involved. First let's expand the two source signals into a series of unit delays:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_1(z) = \sum_{k\in\mathbb{Z}} a_k z^k$$&#xA;$$S_2(z) = \sum_{k\in\mathbb{Z}} b_k z^k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your combined signal can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(z) = \sum_{k\in\mathbb{Z}} a_k z^{2k} + \sum_{k\in\mathbb{Z}} b_k z^{2k+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we can plug in $z=\exp(i\omega)$ to get the Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega) = \sum_{k\in\mathbb{Z}} a_k \exp(ki2\omega)+\sum_{k\in\mathbb{Z}} b_k \exp(ki2\omega)\exp(i\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the Fourier transforms from the z-transforms above we can see that this actually equals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega) = S_1(2\omega) + S_2(2\omega)\exp(i\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can interpret this result as the additive combination of the two original signal spectra, each scaled in frequency direction by $1/2$ and one phase shifted proportionally to $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your original signals are of finite length, your initial spectra are &lt;em&gt;sinc&lt;/em&gt;-shaped, centered at the same frequency and with a constant phase shift. I'll leave working out the details to you.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-06-05T21:49:36.917" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16718" PostTypeId="2" ParentId="14796" CreationDate="2014-06-06T01:53:26.400" Score="1" Body="&lt;p&gt;Processing for vibration analysis can be quite involved, depending on what type of machinery you're testing, the kind of faults you're looking for, the technique(s) you're using, and the test equipment you have available.  Without more specific information, I presume you're doing something like that described in the 'Envelope Detection' section of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.bksv.com/doc/bo0501.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.bksv.com/doc/bo0501.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your spectrum is not clear, there could be any number of things wrong, such as: 1) improper placement of accelerometer, 2) improper synchronization, 3) improper analysis bandwidth, etc., etc., etc.  A lot of things can go wrong, and it's not an area for amateurs. No company wants their million dollar engine or generator to burn out or blow up because some technician didn't detect an impending failure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an extensive field of literature, and a host of companies that train people to do vibration analysis (e.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mobiusinstitute.com/site2/landing.asp?LinkID=106&quot; rel=&quot;nofollow&quot;&gt;http://www.mobiusinstitute.com/site2/landing.asp?LinkID=106&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.mobiusinstitute.com/site2/detail.asp?LinkID=53&quot; rel=&quot;nofollow&quot;&gt;http://www.mobiusinstitute.com/site2/detail.asp?LinkID=53&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A brief bit of googling can easily lead to hundreds of thousands of hits, some of which may be quite specific to your machinery, measurement set-up, etc. &lt;/p&gt;&#xA;" OwnerUserId="1926" LastActivityDate="2014-06-06T01:53:26.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16719" PostTypeId="2" ParentId="16714" CreationDate="2014-06-06T03:35:34.883" Score="5" Body="&lt;p&gt;1) It depends on the application, but in general, both. In some cases we can &lt;a href=&quot;http://en.wikipedia.org/wiki/Whitening_transformation&quot; rel=&quot;noreferrer&quot;&gt;whiten the noise&lt;/a&gt;, say in the following situation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y = x+ \eta\text{ where }\eta \sim N(0, \Sigma)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we want to estimate $x \in \mathcal{A}$ for some set $\mathcal{A}$ from $Y$. In this case, we multiply both sides by the inverse of the square root of $\Sigma$, and we have an estimation problem where $\Sigma^{-1/2} x \in \Sigma^{-1/2} \mathcal{A}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Two random variables are said to be correlated if their covariance is non-zero. In the cause of jointly Gaussian random variables, uncorrelated is equivalent to independent. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Uncorrelated things are often easier to deal with since things decouple (for example, when estimating in the MMSE sense, uncorrelated is a form of orthogonality (perpendicularity, geometrically)). Its the next best thing to independence (and in the most important case, the jointly Gaussian case, they coincide). As for when things are Gaussian, one may justify things via central limit theorem or just by saying the answer is usually easy to find, and several estimators coincide in the jointly Gaussian case (MAP, MMSE, MMAE) [In the jointly Gaussian MMSE case, the estimator is the linear MMSE estimator, which is quite easy to calculate and only relies on first and second order moments, which makes life a lot easier instead of relying on higher order moments]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;MLE is just a paradigm for non-random parameter estimation (where as in Bayesian settings such as MAP, MMSE, MMAE, the quantity you are trying to estimate is modeled as random). None of these methods impose a constraint of signal+additive noise for parameter estimation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should try reading a &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0387941738&quot; rel=&quot;noreferrer&quot;&gt;book&lt;/a&gt; or &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0387765425&quot; rel=&quot;noreferrer&quot;&gt;two&lt;/a&gt; on the topic.  &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-06-06T03:35:34.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16721" PostTypeId="2" ParentId="16716" CreationDate="2014-06-06T08:06:25.173" Score="1" Body="&lt;p&gt;When applying Gaussian Blur on an image you should care for the STD only.&lt;br&gt;&#xA;The rest should be set as following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;STD_TO_RADIUS_FACTOR = 5;&#xA;kernelRadius = ceil(STD_TO_RADIUS_FACTOR * kernelStd);&#xA;kernelLength = (2 * kernelRadius ) + 1;&#xA;mGaussianKernel = fspecial('gaussian', [kernelLength, kernelLength], kernelRadius);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, regarding the resolution of the image, this is tricky since it has many parameters in it.&lt;br&gt;&#xA;If you want to measure it in Cycles in Spatial (As DFT), you can see the spectrum properties (Cut Off Frequency) of a Gaussian Kernel.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Update&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;STD_TO_RADIUS_FACTOR&lt;/code&gt; should be determined by the balance between accuracy and performance.&lt;br&gt;&#xA;The above is basically a truncated version of the Gaussian Kernel (Which is infinite). The balance sets how good is the approximation vs. how long the Convolution Kernel is (The longer the higher computational resources it requires).&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-07-02T08:58:09.547" LastActivityDate="2018-07-02T08:58:09.547" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16723" PostTypeId="1" CreationDate="2014-06-06T09:50:34.553" Score="1" ViewCount="4462" Body="&lt;p&gt;I want to know the characteristic differences between real and complex impulse responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, JK&lt;/p&gt;&#xA;" OwnerUserId="9079" LastActivityDate="2014-06-06T10:06:35.183" Title="Difference between real and complex impulse responses?" Tags="|impulse-response|" AnswerCount="1" CommentCount="0" ClosedDate="2014-06-10T00:24:19.930" ContentLicense="CC BY-SA 3.0" />
  <row Id="16724" PostTypeId="2" ParentId="16723" CreationDate="2014-06-06T10:06:35.183" Score="4" Body="&lt;p&gt;Your question might be the result of a misunderstanding. There is only one type of impulse response, and this is a system's response to a Dirac impulse $\delta(t)$ (in continuous time), or - in discrete time - to a discrete impulse $\delta(n)$. For a real-valued system, i.e. a system with real-valued parameters, the impulse response is always real-valued. For a complex-valued system, i.e. a system with complex-valued parameters (e.g. complex-valued filter coefficients), the impulse response is complex-valued. Note, however, that complex-valued systems are just a convenient way to describe certain real systems, just like complex numbers are often more convenient to establish certain mathematical results.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-06T10:06:35.183" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16725" PostTypeId="1" CreationDate="2014-06-06T10:17:57.843" Score="2" ViewCount="1675" Body="&lt;p&gt;&lt;strong&gt;Some introductory questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the unit of the group delay in a digital filter (is it samples?)&lt;/li&gt;&#xA;&lt;li&gt;What is $\Omega$ in the equations below (is it $\Omega=2 \pi\frac{f}{f_{sample}} ?) $&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If I got any of these wrong, then there is no point reading the rest of this question. Just correct me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I want to achieve&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a Karplus-Strong algorithm to simulate a steel string. I noticed, that &lt;strong&gt;I need to detune the harmonics to higher frequencies&lt;/strong&gt;, so it really sounds like a steel string (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Inharmonicity#Guitar&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;). To achive this, I added an allpass to the delay in the feedback loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{a + z^{-1}}{1 + az^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the allpass adds an additional delay and detunes my string (lower). So I tried compensating for that additional delay by subtracting the group delay of the allpass from the main delay. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result was: it still detunes, but in the opposite direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The allpass delay:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matt L.  gave me this formula for the group delay&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_g(\Omega) = \frac{1 - a^2}{1 + 2a \cos(\Omega) + a^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta t = \frac{\tau_g}{f_{sample}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But robert pointed out that it is the phase delay which determines the pitch and gave me this formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tau_\phi(\Omega) \ = \ \frac{1}{\Omega} \arctan\left(\frac{(1-a^2)\sin(\Omega)}{(1+a^2)\cos(\Omega) + 2a} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But alas, when I subtract either of the two from the total delay in the feedback loop (i.e. the regular delay plus the allpass) it appears I am overcompensating. There is no problem with posive $a$ which leaves the fundamental undelayed, but for negative $a$ (e.g. $a=-0.93$) the string is about half a semitone too high. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit (1)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had an error in the formulas which is fixed by now (thanks to Matt L.). Originally my string was tuned too low, after the fix it is too high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit(2)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meanwhile (thanks to Matt L. and robert) I have little doubt, that my calculations are basically correct. I ran my allpass through scilab and the group delay is reported as apx. 30 samples. With the formulas from Matt and Robert I get values around 31 samples. Hoever, to tune the string correctly (by ear) I must compensate for 24 samples only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly Miguel Negrão who did some research on plucked steel strings wrote in &lt;a href=&quot;http://www.friendlyvirus.org/artists/zlb/files/miguel_negrao_thesis.pdf&quot; rel=&quot;nofollow&quot;&gt;his thesis&lt;/a&gt;: &lt;em&gt;Generally a negative value of a would have been used, which would have delayed the lower frequencies more than the high frequencies (phase delay), and would require a re-tuning of the main delay in the string loop to keep the string at the same fundamental frequency. In the SupaStrings system case, after some listening tests, a positive value of&#xA;a was used instead (non-physical) which keeps the low partials more a less in the same frequency but detunes the high partials down to a lower frequency.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like he faced similar difficulties and couldn't solve them, even though he is quite a brilliant guy.&lt;/p&gt;&#xA;" OwnerUserId="8553" LastEditorUserId="4346" LastEditDate="2014-06-10T01:53:57.507" LastActivityDate="2014-06-10T01:53:57.507" Title="Allpass group delay formula and effect on Karplus-Strong" Tags="|filters|allpass|group-delay|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16726" PostTypeId="1" AcceptedAnswerId="16729" CreationDate="2014-06-06T12:06:08.373" Score="1" ViewCount="280" Body="&lt;p&gt;In the development of Hilbert transform relationships, Prof. Oppenheim has chosen&#xA;\begin{equation}&#xA;\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)\sum_{k=-\infty}^{\infty}\delta(\omega-\theta-2\pi{}k)d\theta&#xA;=X_R\left(e^{j\omega}\right)&#xA;\end{equation}&#xA;in his book &quot;Discrete-Time Signal Processing, 2e&quot; Chapter 11 pp807, Eq. 11-24. I failed to understand how he arrives at it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody any idea how has derived, please let me know?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried some BUT IT DID NOT GIVE the above relationship:&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;1:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)&#xA;\sum_{k=-\infty}^{\infty}\delta(\omega-\theta-2\pi{}k)d\theta&amp;amp;=\frac{1}{2\pi}\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)2\pi\sum_{k=-\infty}^{\infty}&#xA;\delta(\omega-\theta-2\pi{}k)d\theta\\&amp;amp;&#xA;=\frac{1}{2\pi}\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)e^{j\theta{}n}d\theta\\&amp;amp;&#xA;=x_e(n)&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;2:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)&#xA;\sum_{k=-\infty}^{\infty}\delta(\omega-\theta-2\pi{}k)d\theta&amp;amp;=\sum_{k=-\infty}^{\infty}\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)&#xA;\delta(\omega-\theta-2\pi{}k)d\theta\\&amp;amp;&#xA;=\sum_{k=-\infty}^{\infty}X_R\left(e^{j(\omega-2\pi{}k)}\right)&#xA;\end{align*}&lt;/p&gt;&#xA;" OwnerUserId="3682" LastEditorUserId="4298" LastEditDate="2018-07-17T14:15:05.673" LastActivityDate="2018-07-17T14:15:05.673" Title="Development of Hilbert transform relationship" Tags="|fourier-transform|transfer-function|transform|hilbert-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16727" PostTypeId="2" ParentId="16725" CreationDate="2014-06-06T12:46:04.973" Score="3" Body="&lt;p&gt;As I mentioned in my comment, you're right that the unit of group delay of a discrete-time system is samples. And $\Omega$ is indeed the normalized frequency in radians.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that your final formula for the group delay of a first-order allpass filter is wrong (I didn't check the original formula). If you have an allpass system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{a+z^{-1}}{1+az^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then its group delay is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau(\Omega)=\frac{1-a^2}{1+2a\cos\Omega +a^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try what you did using formula (1). I'm curious to see if this solves your problem.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-06T12:46:04.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16728" PostTypeId="1" AcceptedAnswerId="16737" CreationDate="2014-06-06T13:43:43.483" Score="9" ViewCount="2921" Body="&lt;p&gt;It seems that the most advanced pure mathematics course most EE engineers take is Fourier analysis, and after that it's basically 'applied' courses. There's probably a good reason for this, but I'm not sure what it is. Functional analysis seems like it pops up all the time in signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would exploring functional analysis be worthwhile for an aspiring communications engineer?&lt;/p&gt;&#xA;" OwnerUserId="9140" LastActivityDate="2017-08-19T16:27:56.983" Title="Functional analysis for signal processing engineers" Tags="|math|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16729" PostTypeId="2" ParentId="16726" CreationDate="2014-06-06T14:09:14.403" Score="3" Body="&lt;p&gt;Your second try was already close. However, you treated the integral as if its limits were $-\infty$ and $\infty$. With the given integration limits there is only &lt;em&gt;one&lt;/em&gt; delta impulse in the integration interval, i.e. only one index of the sum is relevant, all others are outside the integration interval. So if for some given value $\omega$ this index is $k=l$, then the result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)&#xA;\sum_{k=-\infty}^{\infty}\delta(\omega-\theta-2\pi{}k)d\theta=X_R(e^{j(\omega-2\pi l)})=X_R(e^{j\omega}\cdot e^{-j2\pi l})=X_R(e^{j\omega})$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-06-06T16:03:48.160" LastActivityDate="2014-06-06T16:03:48.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16730" PostTypeId="2" ParentId="16716" CreationDate="2014-06-06T14:16:10.647" Score="2" Body="&lt;p&gt;The size of the filter, as you correctly point out, determines the area over which it has averages the pixels.&lt;/p&gt;&#xA;&lt;p&gt;In theory a gaussian filter has non-zero weights for all distances from the centre. In practise however it is not feasible to do this as computation time would be large. Therefore the gaussian is cut-off outside the filter size and the weights outside are set to zero.&lt;/p&gt;&#xA;&lt;p&gt;To ensure a good representation of a real gaussian the filter size should be large enough that the weights outside the filter would be small, if not your result is significantly distorted from a real gaussian.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; of the filter is what determines the weights so this should be used to determine the filter size too. I then to use a filter of at least &lt;span class=&quot;math-container&quot;&gt;$6\sigma$&lt;/span&gt; (make sure answer is odd), although the other answer has a different suggestion.&lt;/p&gt;&#xA;&lt;p&gt;For resolution the answer somewhat depends on your definition of resolution. I would generally say the resolution after filtering is &lt;span class=&quot;math-container&quot;&gt;$2\sigma$&lt;/span&gt;, ignoring any other effects such as pixel size and optical resolution. If the filter size is too small this will change, although I'm not sure its always well defined as you'll get some ringing effects from the sharp cut-off.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastEditorUserId="128" LastEditDate="2021-06-12T11:01:12.767" LastActivityDate="2021-06-12T11:01:12.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16731" PostTypeId="2" ParentId="16728" CreationDate="2014-06-06T14:44:25.290" Score="3" Body="&lt;p&gt;There are two questions here: Would studying functional analysis be useful and why don't more engineers study it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I will say there's definitely no harm in studying it and if you find it an interesting subject and are of a more mathematical bent its probably quite useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now why don't most engineers study functional analysis. Well in short while its useful its not particularly necessary particularly if studied from a pure mathematics point of view. Mathematicians tend introduce lots unnecessary formalism and proofs that engineers (and anyone else) don't really need to be able to apply the principles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I compare how I was taught Fourier analysis (as a Physicist) to how Mathematicians where taught it I would not describe my course as a pure Maths course. It involved little to no formal proofs or theorems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect this is why all engineers study Fourier but few do more advanced Maths courses such as functional analysis. More advanced courses have less direct applications to engineering and require more mathematical formalism to teach properly but the key principles can still be picked up and applied without formal training where necessary.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-06-06T14:44:25.290" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16732" PostTypeId="1" CreationDate="2014-06-06T16:51:15.650" Score="1" ViewCount="626" Body="&lt;p&gt;I am processing data which was put through a low pass filter at some point. Looking at the FFT, I can see that it is less than the Nyquist rate. I am trying to filter another set of data so that the spectral content will be better matched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a good way to calculate the cutoff frequency or bandwidth of data? I know I can just look at the FFT and eyeball it, but I would like to be able to do this repeatedly for different sets of data. I am using MATLAB, so any included functions could be useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thought I had was to smooth out the spectrum data and apply thresholds to detect the upper and lower ends of the crossover region. This could definitely work, but I feel like there should be a more elegant solution out there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some example plots of the entire spectrum, and zoomed in on the knee. All of the data files have similar spectra, but with different sampling rates and different cutoff frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/inUZ1.png&quot; alt=&quot;spectrum&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/D2Jut.png&quot; alt=&quot;spectrum_zoom&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4439" LastEditorUserId="4439" LastEditDate="2014-06-06T18:20:23.943" LastActivityDate="2014-06-06T18:20:23.943" Title="Calculate cutoff frequency of filtered data" Tags="|matlab|lowpass-filter|bandwidth|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16733" PostTypeId="1" CreationDate="2014-06-06T18:58:07.990" Score="1" ViewCount="72" Body="&lt;p&gt;Kevin Murphy's Kalman Filter toolbox (for Matlab) contains an example where it's the fact that the state space system in not identifiable causes problems. I include the example in it's entirety but you won't actually be able to run the code without installing the toolbox first. See the comments between the code blocks where he notes the systems lack of identifiability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1.) Can someone please explain why the system below is not identifiable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2.) Can someone please given general rules for determining whether a time invariant state space system is identifiable or not.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% X(t+1) = F X(t) + noise(Q)&#xA;% Y(t) = H X(t) + noise(R)&#xA;&#xA;ss = 4; % state size&#xA;os = 2; % observation size&#xA;F = [1 0 1 0; 0 1 0 1; 0 0 1 0; 0 0 0 1];&#xA;H = [1 0 0 0; 0 1 0 0];&#xA;Q = 0.1*eye(ss);&#xA;R = 1*eye(os);&#xA;initx = [10 10 1 0]';&#xA;initV = 10*eye(ss);&#xA;&#xA;seed = 1;&#xA;rand('state', seed);&#xA;randn('state', seed);&#xA;T = 10000;&#xA;[x,y] = sample_lds(F, H, Q, R, initx, T);&#xA;&#xA;% Initializing the params to sensible values is crucial.&#xA;% Here, we use the true values for everything except F and H,&#xA;% which we initialize randomly (bad idea!)&#xA;% Lack of identifiability means the learned params. are often far from the true ones.&#xA;% All that EM guarantees is that the likelihood will increase.&#xA;F1 = randn(ss,ss);&#xA;H1 = randn(os,ss);&#xA;Q1 = Q;&#xA;R1 = R;&#xA;initx1 = initx;&#xA;initV1 = initV;&#xA;max_iter = 100;&#xA;[F2, H2, Q2, R2, initx2, initV2, LL] =  learn_kalman(y, F1, H1, Q1, R1, initx1, initV1, max_iter,1,1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Baz&lt;/p&gt;&#xA;" OwnerUserId="8943" LastEditorUserId="6" LastEditDate="2014-06-06T19:50:16.687" LastActivityDate="2014-06-06T19:50:16.687" Title="Identifiability for Time Invariant State Space Models" Tags="|matlab|kalman-filters|state-space|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16734" PostTypeId="2" ParentId="16725" CreationDate="2014-06-06T19:25:27.487" Score="4" Body="&lt;p&gt;For the Karplus-Strong algorithm, your primary concern is for &lt;strong&gt;phase&lt;/strong&gt; delay,&#xA;$$ \tau_\phi(\omega) \ = \ - \frac{\phi(\omega)}{\omega} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;rather than group delay.&#xA;$$ \tau_g(\omega) \ = \ - \frac{d \phi(\omega)}{d \omega} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&#xA;$$ \phi(\omega) \ \triangleq \ \arg \left\{ H(e^{j \omega}) \right\} $$&#xA;and $H(z)$ is the transfer function of your filter, and&#xA;$$  H(e^{i \omega}) \ = \ \left| H(e^{j \omega}) \right| e^{j \phi(\omega)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For phase delay, it is important to unwrap the phase, which is not necessary for 1st-order APFs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because, for a sinusoid, it's the phase delay that is the actual delay, in units of time, that the filter delays a simple sinusoid.  The group delay is the amount the &lt;strong&gt;envelope&lt;/strong&gt; of the sinusoid is delayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For linear-phase filters, $\tau_\phi(\omega)=\tau_g(\omega)$ for all $\omega$ and for any filter $\tau_\phi(0)=\tau_g(0)$.  Phase delay and group delay are not generally the same value in other circumstances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the 1st-order APF with its pole at $p$:&#xA;$$ H(z) \ = \ \frac{1-pz}{z-p}$$&#xA;the phase delay in sample units is&#xA;$$ \tau_\phi(\omega) \ = \ \frac{1}{\omega} \arctan\left(\frac{(1-p^2)\sin(\omega)}{(1+p^2)\cos(\omega) - 2p} \right) $$&#xA;and the group delay in sample units is (same expression MattL gets)&#xA;$$ \tau_g(\omega) \ = \ \frac{1-p^2}{1+p^2 - 2p\cos(\omega)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the delay (phase or group) at DC is $\tau_\phi(0) = \tau_g(0) = \frac{1+p}{1-p}$ and we normally have $-1 \le p \le 0$ to get a delay of between 0 and 1 sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in the Karplus-Strong algorithm, the frequency of every harmonic (perhaps better called a &quot;partial&quot;), including the 1st harmonic (which we'll call the &quot;fundamental&quot;) is the reciprocal of the total loop delay (&lt;strong&gt;phase&lt;/strong&gt; delay) at the frequency of that partial.  That is a circular mathematical relationship.  For the $k$th partial (and assuming normalized sampling frequency $f_s=1$):&#xA;$$ f_k \ = \ \frac{k}{n + \tau_\phi(2 \pi f_k)} $$&#xA;where $n$ are the integer number of samples in the delay line that is in series with the APF.  Given your fundamental frequency $f_1$, the value of $n$ is $$ n \ = \ \left\lfloor \frac{1}{f_1} \right\rfloor \ = \ \mbox{floor}\left(\frac{1}{f_1}\right) $$&#xA; (Be sure to add 1 sample that is necessary in a digital filter with feedback.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, often we approximate using the DC delay, but to design this exactly, you need to somehow solve that frequency-dependent phase delay &lt;strong&gt;at&lt;/strong&gt; the frequency of each partial.  That's a bitch.  So you would need to solve&#xA;$$ \frac{k}{f_k} \ = \ n + \tau_\phi(2 \pi f_k) \ = \ n + \frac{1}{2 \pi f_k} \arctan\left(\frac{(1-p^2)\sin(2 \pi f_k)}{(1+p^2)\cos(2 \pi f_k) - 2p} \right) $$&#xA;for $f_k$ given every integer $k$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-06-08T18:09:10.463" LastActivityDate="2014-06-08T18:09:10.463" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="16735" PostTypeId="1" CreationDate="2014-06-06T22:22:25.343" Score="1" ViewCount="857" Body="&lt;p&gt;I mean, does exists some state of the art algorithm able to extract music features, classify them and identify similar music or find lyrics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that there are many topics or steps involved on my question, like digital signal processing, feature extraction, machine learning, pattern recognition, etc. I'm a computer science student and I would like to know if there is a methodology to identify music as it does musixmatc. For example, this program is able to find the lyrics of a song from a very short audio sample, even with some noise. As I know, &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf&quot; rel=&quot;nofollow&quot;&gt;[1]&lt;/a&gt; is the unique related paper that is available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt; An Industrial-Strength Audio Search Algorithm&lt;/p&gt;&#xA;" OwnerUserId="4812" LastActivityDate="2014-11-04T14:30:31.570" Title="how can I analize music as spotify/musixmath/shazam does?" Tags="|audio|music|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16736" PostTypeId="2" ParentId="16735" CreationDate="2014-06-07T00:52:04.170" Score="2" Body="&lt;p&gt;The general idea for the algorithm is well presented in the linked paper. As is the case with applied machine learning and related fields, the secret sauce (which features to select, how to tweak your algorithms, etc.) is found by trial and error by people who know things about audio/audio signal processing (see for example, &lt;a href=&quot;https://ccrma.stanford.edu/~jos/&quot; rel=&quot;nofollow&quot;&gt;Julius O. Smith III's page at CCRMA @ Stanford&lt;/a&gt;) and by just trying a ton of things. Unfortunately, to become (and stay) the state of the art, the secret sauce has to be kept, well, secret. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, the wikipedia article on &lt;a href=&quot;http://en.wikipedia.org/wiki/Acoustic_fingerprint&quot; rel=&quot;nofollow&quot;&gt;acoustic fingerprinting&lt;/a&gt; is a decent place to look for some alternatives (and some links to some open source ones like Acoustid).&lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-06-07T00:52:04.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16737" PostTypeId="2" ParentId="16728" CreationDate="2014-06-07T01:02:07.630" Score="3" Body="&lt;p&gt;It depends on what you want to do. At the graduate level, many electrical engineers in signal processing, communications and control have taken some functional analysis course, and courses based on A.V. Balakrishan's Applied Functional Analysis/ Luenberger's Optimization by Vector Space Methods or similar are pretty common as well as courses based on Naylor &amp;amp; Sell's Linear Operator Theory in Engineering and Science and a lesser extent Young's An Introduction to Hilbert Space (I have been told that undergraduates in EE at Rice use this for a bit - it is really an undergrad book). Kreyszig's Introductory functional analysis with applications is also another decent choice for undergrads. At some point though, the line between &quot;mathematician&quot; and &quot;engineer&quot; does get blurred. Its a useful course thing to know in some cases if you're an engineer whose doing research heavy in probability or control theory, especially. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, those books differ considerably from whats typically offered in a math department (usually start with something like Rudin's Functional Analysis or Conway's A Course In Functional Analysis). In math department courses, you are dealing with operators to study properties of Hilbert/Banach spaces. In contrast, in engineering, we typically have the properties of the vector spaces (usually something nice like $L^p$) and want to study the properties of operators (such as minimizing some functional or something). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all though, for most people, if they have to ask the question, I'd say they should probably be looking for something else to take, especially if they tend to the more applied side of things. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2017-08-19T16:27:56.983" LastActivityDate="2017-08-19T16:27:56.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16738" PostTypeId="2" ParentId="16728" CreationDate="2014-06-07T02:13:51.417" Score="3" Body="&lt;p&gt;It depends on whether you intend to enter academia or industry. Academics write papers and can use all the maths they can get. In industry not so much, unless you intend to enter a research lab, which is like academia.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the most important branches of mathematics for telecommunications are probability, statistics, linear algebra, and information theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that it depends on what branch of telecommunications you want to go into. No-one knows it all; everybody has their niche.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2014-06-07T02:20:57.973" LastActivityDate="2014-06-07T02:20:57.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16739" PostTypeId="1" AcceptedAnswerId="16742" CreationDate="2014-06-07T05:39:21.657" Score="1" ViewCount="779" Body="&lt;p&gt;Currently, I'm working on removing 50 Hz power line interference from an ECG signal. Before trying out notch filters, I decided to try out a simple lowpass filter with a cutoff less than 50 Hz. Here's the MATLAB code I used to make the filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs=500; %Sampling rate in Hz&#xA;Ast = 120; %Stopband attenuation&#xA;Ap = 1; %Passband ripple&#xA;Fp = 30; %Passband end&#xA;Fst = 45; %Stopband beginning&#xA;Hd=fdesign.lowpass('Fp,Fst,Ap,Ast',Fp,Fst,Ap,Ast,Fs);&#xA;d=design(Hd,'butter'); % Design a butterworth filter with the given characteristics&#xA;fvtool(d);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The magnitude response of the filter is:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hVGqw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the filter has around a 180 dB attenuation at 50 Hz and even more at higher frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I run this filter on my data. Here's the original data, in the time and frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gWUbK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's the data after applying the filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PfmuY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the attenuation at 50 Hz is nowhere near the 180 dB that the filter advertised. For a better look, here's the plot of the magnitude response computed by taking the ratio of the FFTs of the signal before and after filtering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EKqxb.jpg&quot; alt=&quot;The FFT ratio is in image 4.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, the attenuation is nowhere near the level it is supposed to be at. Is this the way it's supposed to be or am I doing something wrong in the implementation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for all the help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit : Here's an enlarged view of a single beat of the ECG after applying the filter. Note the 50Hz noise right after the tall peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SU8YS.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="9147" LastEditorUserId="9147" LastEditDate="2014-06-09T05:09:36.103" LastActivityDate="2014-06-09T05:09:36.103" Title="MATLAB filter not attenuating enough" Tags="|matlab|filters|filtering|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16740" PostTypeId="1" CreationDate="2014-06-07T07:48:16.147" Score="1" ViewCount="474" Body="&lt;p&gt;OK,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to ask the same question in the math site on stack exchange but no real joy. Apologises I'd this is the wrong forum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to compute the PCA of a spectrogram.. It is 486x128 after I compute the covariance matrix, the resulting matrix is a square matrix containing 128x128 dimensions. Now, I want to compute the Eigen values for this. So far, I have computed the eigen values for a 2x2, 3x3 as well as a 4x4 matrix and this makes sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot for the life of me think how I would take the concepts from this and apply it to a 128x128 matrix. When I compute the Eigenvalues and vectors in Matlab, returned is a similar or same size 128x128 matrix containing the eigenvalues and eigenvectors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to solve this problem, shall I therefore compute the eigen value for each of the blocks contained in the spectrogram (I.e. this will give me 128 eigen values) or is there another way to calculate based off this size of a matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope someone can help&lt;/p&gt;&#xA;" OwnerUserId="5182" LastActivityDate="2014-06-07T07:48:16.147" Title="Understanding PCA" Tags="|spectrogram|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16741" PostTypeId="2" ParentId="16726" CreationDate="2014-06-07T09:57:20.017" Score="0" Body="&lt;p&gt;I searched through many books and found this way only yesterday night:&#xA;[source: Encyclopedia of Mathematics and its Applications 124: &#xA;Hilbert transforms Vol.1, pp659 Eq.13.122 written by Frederick W. King]&#xA;\begin{align*}&#xA;\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)&#xA;\sum_{k=-\infty}^{\infty}\delta(\omega-\theta-2\pi{}k)d\theta&amp;amp;&#xA;=\sum_{k=-\infty}^{\infty}\int_{-\pi+2\pi{}k}^{\pi+2\pi{}k}X_R\left(e^{j(\theta-2\pi{}k)}\right)&#xA;\delta\left(\omega-\theta\right)d\theta\\&amp;amp;&#xA;=\sum_{k=-\infty}^{\infty}\int_{(2k-1)\pi}^{(2k+1)\pi}X_R\left(e^{j(\theta-2\pi{}k)}\right)&#xA;\delta\left(\omega-\theta\right)d\theta\\&amp;amp;&#xA;=\left\{\ldots+\int_{-3\pi}^{-\pi}X_R\left(e^{j(\theta+2\pi{})}\right)&#xA;\delta\left(\omega-\theta\right)d\theta\right.\\&amp;amp;&#xA;\quad+\int_{-\pi}^{\pi}X_R\left(e^{j\theta}\right)&#xA;\delta\left(\omega-\theta\right)d\theta\\&amp;amp;&#xA;\quad+\left.\int_{\pi}^{3\pi}X_R\left(e^{j(\theta-2\pi{})}\right)&#xA;\delta\left(\omega-\theta\right)d\theta+\ldots\right\}\\&amp;amp;&#xA;=X_R\left(e^{j\omega}\right)&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then, I think a similar logical conclusion given by Matt L. is still required here too.&lt;/p&gt;&#xA;" OwnerUserId="3682" LastEditorUserId="3682" LastEditDate="2014-06-07T10:25:52.390" LastActivityDate="2014-06-07T10:25:52.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16742" PostTypeId="2" ParentId="16739" CreationDate="2014-06-07T12:58:33.213" Score="1" Body="&lt;p&gt;(&lt;em&gt;Disclaimer&lt;/em&gt;: I don't have a Matlab license for trying your example.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, your ECG signal is quite short, and you don't seem to be applying any windowing before the FFT (which is equivalent to applying a rectangular window). So your final spectrum will be the circular convolution of your signal with the window transform, and hence the tails above 40Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you are designing for hundreds of dB attenuation. This yields filters of very high order, which are &lt;em&gt;very&lt;/em&gt; sensitive to numerical precision errors during calculations. In real life you think in tens of dB, not hundreds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, the best approach for cleaning ECG signals is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Notch filter at 50 Hz (a band-pass of order 6 to 8 should suffice).&lt;/li&gt;&#xA;&lt;li&gt;Low-pass filter with cutoff around 100 Hz (notice where you stop having ECG harmonics and start having only acquisition noise).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit for the downvoter:&lt;/strong&gt; The filtered signal is OK, but using FFT without care gives a misleading result. At least you should apply a smooth window function to the signal (in this case, the already filtered signal) in order to get a more faithful spectrum representation. Try with a Hamming window: &lt;code&gt;plot(abs(fft(y .* hamming(length(y)))))&lt;/code&gt;, where &lt;code&gt;y&lt;/code&gt; is the filtered signal.&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2014-06-07T15:38:33.683" LastActivityDate="2014-06-07T15:38:33.683" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16743" PostTypeId="1" AcceptedAnswerId="16744" CreationDate="2014-06-07T17:25:16.643" Score="1" ViewCount="488" Body="&lt;p&gt;How to get the conjugate symmetric of the complex matrix using matlab&lt;/p&gt;&#xA;" OwnerUserId="9149" LastActivityDate="2014-06-07T17:44:36.173" Title="How to get the conjugate symmetry of the complex matrix using MATLAB?" Tags="|matlab|" AnswerCount="1" CommentCount="2" ClosedDate="2014-06-09T05:33:30.800" ContentLicense="CC BY-SA 3.0" />
  <row Id="16744" PostTypeId="2" ParentId="16743" CreationDate="2014-06-07T17:44:36.173" Score="0" Body="&lt;p&gt;This question is off-topic, but:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;At = A';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;At&lt;/code&gt; is the conjugate transpose of &lt;code&gt;A&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-06-07T17:44:36.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16745" PostTypeId="1" CreationDate="2014-06-08T00:40:49.130" Score="0" ViewCount="765" Body="&lt;p&gt;I perform FFT of two real sequences using &quot;two for the price of one&quot; - array $x[n]$ and $y[n]$ is packed as a complex number - $z[n] = x[n] + j y[n]$ - using FFT2 and FFTW. I am able to decode the half-complex output format of FFTW and the result match with the output of FFT2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output conversion goes like this. If FFT of complex sequence $z[n]$ is $Z[k]$ where $Z[k] = FFT\{z[n]\}$. The equations look something like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$FFT\{x[n]\} = (Z[k] + Z^*[N-k]) / 2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$FFT\{y[n]\} = (Z[k] - Z^*[N-k]) / (2j) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I perform inverse FFT with FFTW I am unable to understand the output format of FFTW and the inverse output or FFT2 do not agree with FFTW. Any clue on   how to transform the output of inverse FFT to generate inverse FFT of two sequences.&lt;/p&gt;&#xA;" OwnerUserId="9150" LastEditorUserId="4346" LastEditDate="2014-06-08T07:05:28.550" LastActivityDate="2014-06-08T07:05:28.550" Title="Inverse FFT data format with FFTW" Tags="|fft|ifft|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16747" PostTypeId="1" CreationDate="2014-06-08T01:03:34.850" Score="3" ViewCount="293" Body="&lt;p&gt;I'm trying to study a nonlinear system by sending a pulsed signal into the system and look at the response spectrum. The signal I send to the system is something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ihMXc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the response spectrum from I get from the system is something like (note the spectrum is plotted log scale, ie, (frequency, log of absolute value of Fourier transform at that frequency))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Byr3F.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we can see that there is a stair like structure in the spectrum. So what is the general feature the time domain response signal should have in order to give a stair like spectrum like this? And have you ever encountered a spectrum like this, and is there something in general we can say about the system just from the stair like spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you give a model of this behavior that generate stair like spectrum?&lt;/p&gt;&#xA;" OwnerUserId="5278" LastEditorUserId="5278" LastEditDate="2014-06-10T01:36:16.493" LastActivityDate="2014-08-10T00:35:29.907" Title="What is the general feature of a time domain signal that gives a step like spectrum?" Tags="|fourier-transform|signal-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16749" PostTypeId="1" AcceptedAnswerId="16750" CreationDate="2014-06-08T04:23:34.340" Score="0" ViewCount="1810" Body="&lt;p&gt;&lt;strong&gt;Brief introduction:&lt;/strong&gt;&#xA;I am working on my university project. My task is to develop application that captures sound from mobile phone and removes/reduces noise (this simpilied version of task).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I never faced with DSP before, I spend a lot of time to figure out how to get audio signal from phone (no direct API is porvided), so I have only few weeks left to study DSP.&#xA;There are a lot of information on that field, my basic source of information was: &lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dspguide.com/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My work, to be accepted should include some work(algorithms) in the field of DSP (so I should avoid ready libraries). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I need&lt;/strong&gt;&#xA;simple algorithm(easy to understand) for noise reduction, I am very limited in time (I got only one day left, after that I should present my work)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;refernces to resources for understanding FFT &amp;amp; inverse FFT (although I implemented that algorithms in code, I simply adopted code from the book)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;what I have done&lt;/strong&gt;&#xA;FFT, Inverse FFT&#xA;I tried to remove frequencies by applying FFT to signal in time domain and zeroing needed ranges in result frequency domain (ranges &amp;lt; 300 &amp;amp;&amp;amp; ranges &gt;3700 - as human voice is in range [300;3700] - so doing that I tried to remove sounds not related to human voice, but I got very bad results (&lt;a href=&quot;https://stackoverflow.com/questions/24101814/why-ideal-band-pass-filter-not-working-as-expected&quot;&gt;https://stackoverflow.com/questions/24101814/why-ideal-band-pass-filter-not-working-as-expected&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please suggest me how I can based on the results of FFT reduce noise (I don't need super efficient method, I need something that I can present in my work and explain how I did it)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help!&lt;/p&gt;&#xA;" OwnerUserId="9151" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2015-08-31T13:08:49.200" Title="How to implement simple noise filter based on the frequency domain information?" Tags="|fft|filters|audio|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16750" PostTypeId="2" ParentId="16749" CreationDate="2014-06-08T05:02:43.790" Score="2" Body="&lt;p&gt;Fast convolution filtering with an FFT/IFFT requires zero padding and using overlap add or overlap save methods to remove circular convolution artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also use a frequency domain response that has a shorter impulse response than a rectangle (which zeroing bins is).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-08T05:02:43.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16751" PostTypeId="2" ParentId="16747" CreationDate="2014-06-08T05:16:20.187" Score="1" Body="&lt;p&gt;If there is a time invariant linear response region in your non-linear system, then a time domain input resembling a Sinc function $\frac{\sin(x)}{x}$ in that linear region, will produce an approximation to rectangular frequency response in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="8202" LastEditDate="2014-06-10T08:05:11.653" LastActivityDate="2014-06-10T08:05:11.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16752" PostTypeId="2" ParentId="16630" CreationDate="2014-06-08T06:56:41.400" Score="0" Body="&lt;p&gt;okay, i am not sure how the function &lt;code&gt;process()&lt;/code&gt; must be set up.  i am going to suggest that &lt;code&gt;process()&lt;/code&gt; assumes floats going in and out and rather than pass &lt;code&gt;length&lt;/code&gt;, let's call it &lt;code&gt;nSamples&lt;/code&gt; and instead of &lt;code&gt;user&lt;/code&gt;, we'll call it &lt;code&gt;state&lt;/code&gt;.  i'm doing this to simplify it.  this is portable and doesn't give a rat's ass about BASS or any library.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void process(float* in, float* out, int nSamples, float* state) {&#xA;&#xA;    //data is float, mono&#xA;&#xA;    // *state holds the last input sample from the previous block&#xA;    // if this is a first block, it is 0&#xA;&#xA;    out[0] = 0.5*in[0] + 0.5*(*state); &#xA;    for (int n=1; n&amp;lt;nSamples; n++)&#xA;    {&#xA;         out[n] = 0.5*in[n] + 0.5*in[n-1];&#xA;    }&#xA;    *state = in[nSamples-1];&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;that should work.  if there is any casting needed from void* to float*, i would suggest it is done by whoever calls &lt;code&gt;process()&lt;/code&gt;.  looks like you have it as a callback function, but i still don't see why the casting need be done in &lt;code&gt;process()&lt;/code&gt;.  if you do this as simply and cleanly as possible, there is less room for funky bugs to slip it.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-06-08T06:56:41.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16753" PostTypeId="1" AcceptedAnswerId="16754" CreationDate="2014-06-08T09:42:50.353" Score="0" ViewCount="172" Body="&lt;p&gt;I'm trying to retrieve a melody from a signal (simple sine with 3 notes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've windowed the signal and performed autocorrelation to get the fundamental frequency of each window and then converted frequency to note. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for a signal with notes &quot;G A E&quot; I am getting something like &quot;G G G A A B E E E E F&quot;. It makes sense that notes are repeated and there are some mistakes... But how should I deal with this? If I use a bigger window then I might miss some notes with shorter duration. I can think of a really naive algorithm to get the melody for this example but what are some real techniques that are usually applied?&lt;/p&gt;&#xA;" OwnerUserId="9153" LastEditorUserId="9153" LastEditDate="2014-06-08T16:08:03.327" LastActivityDate="2014-06-08T16:08:03.327" Title="How to get the melody from a signal" Tags="|autocorrelation|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16754" PostTypeId="2" ParentId="16753" CreationDate="2014-06-08T11:36:10.117" Score="2" Body="&lt;p&gt;Some common approaches:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Simple post-processing&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply a mode filter on your resulting sequence of pitches. This will increase temporal inaccuracies though!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Pre-segmentation&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of analyzing your signal according to a grid of fixed-size windows, try to detect first the boundaries between notes using an onset detection algorithm. Once you have performed the onset detection, your signal is divided into segments in which you can make the assumption that the pitch is constant. You then apply your pitch detection algorithm to each segment. This works best for instruments with a sharp attack - like guitar or piano (playing monophonic melodies) - but not very well in which the pitch of a held note is modulated without sharp attacks between notes (flute, whistling, singing voice).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Dynamic programming&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You define a function $C_i(f)$ which indicates how unlikely it is that frequency $f$ is the fundamental frequency of the $i$-th signal window. You can use, for example, the reciprocal of the autocorrelation function; or sort your pitch hypotheses. For example, if the 4 highest peaks in the autocorrelation function of the 6th signal window are at 220 Hz, 440 Hz, 500 Hz and 250 Hz, $C_6(220) = 0$, $C_6(440) = 1$, $C_6(500) = 2$ and so on. The higher the function, the most unlikely the argument is to be true fundamental frequency.&lt;/li&gt;&#xA;&lt;li&gt;You define a transition cost $T(f_1, f_2)$ which indicates how unlikely it is that a window with fundamental frequency $f_1$ will be followed by a window with fundamental frequency $f_2$. This transition cost can embed basic musicological knowledge (which notes are more likely to follow other notes) but will mostly serve as temporal smoothing.&lt;/li&gt;&#xA;&lt;li&gt;You use dynamic programming to find the sequence $f^*$ that minimizes:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$\sum_i C_i(f^*_i) + T(f^*_{i - 1}, f^*_i)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, this searches for a sequence of pitches that is both compatible with your observations, but also doesn't change too much. Adjusting the relative weight between $C$ and $T$ will allow you to control the amount of smoothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;HMM&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Manually annotate a large collection of files. Train a HMM using autocorrelation vectors as your feature vectors, and musical notes as your states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To transcribe a melody, find the most likely sequence of states that explain your autocorrelation vectors. This is done by the Viterbi algorithm, which will take exactly the same form as the dynamic programming method given above. The only difference is that there is this time a rigorous statistical framework for defining and learning the scoring and transition functions.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-06-08T14:58:33.453" LastActivityDate="2014-06-08T14:58:33.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16755" PostTypeId="1" AcceptedAnswerId="16771" CreationDate="2014-06-08T11:44:47.030" Score="1" ViewCount="975" Body="&lt;p&gt;i am working on object tracking. i want to use background subtraction. i have tried to find out papers on background subtraction but i am really confused to use which one. I have already done tracking using just gray scale subtraction and thresholding. but now i want to model the background and then use it for tracking. i do not know much about background modelling.So, if anyone can suggest me some techniques and good papers on background subtraction and modelling, i will be greatly thankful.&lt;/p&gt;&#xA;" OwnerUserId="7084" LastEditorUserId="53" LastEditDate="2014-06-09T18:35:21.567" LastActivityDate="2014-06-09T18:55:23.960" Title="Background subtraction for object tracking" Tags="|image-processing|computer-vision|background-subtraction|matlab-cvst|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16756" PostTypeId="1" AcceptedAnswerId="16757" CreationDate="2014-06-08T19:08:31.460" Score="1" ViewCount="629" Body="&lt;p&gt;I've been trying to solve the following problem, but I noticed that I get two different answers by means of two different techniques:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the impulse response, $h(n)$, of the following system, described in frequency:&#xA;$Y(e^{j\omega}) = e^{-j\omega}X(e^{j\omega}) + \frac{dX(e^{j\omega})}{d\omega}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Try #1:&lt;/strong&gt; I found the difference equation for the system and iterated while making $x(n) = \delta(n)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n) = x(n-1)+\frac{n}{j}x(n)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(0) = 0 + 0$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(1) = 0 + 1$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(2) = 0 + 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so on. Which yields $h(n) = \delta(n-1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this same result by noticing that $X(e^{j\omega}) = 1$ for $x(n) = \delta(n)$, which gives: $Y(e^{j\omega}) = e^{-j\omega}$ and by using the time shift property we find that $h(n) = \delta(n-1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Try #2:&lt;/strong&gt; I used the inversion formula for $Y(e^{j\omega}) = e^{-j\omega}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n) = \frac{1}{2\pi}\int_{-\pi}^{\pi}e^{-j\omega}e^{j\omega n}d\omega$ which yields $y(n) = \frac{sin(\pi(n-1))}{\pi(n-1)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did I miss something? What is the correct result?&lt;/p&gt;&#xA;" OwnerUserId="5257" LastActivityDate="2014-06-08T20:23:05.777" Title="Inverse DTFT of $e^{-j\omega}$" Tags="|discrete-signals|fourier-transform|frequency-spectrum|impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16757" PostTypeId="2" ParentId="16756" CreationDate="2014-06-08T20:23:05.777" Score="3" Body="&lt;p&gt;Your second try yielded a normalized sinc function. That function has a zero-crossing whenever $\pi(n-1)$ ia a nonzero multiple of $\pi$, which is for every $n\ne 1$ (assuming n is an integer) and is equal to 1 when $\pi(n-1)=0$.&lt;br&gt;&#xA;Therefore, both solutions are the same.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-06-08T20:23:05.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16758" PostTypeId="1" AcceptedAnswerId="16768" CreationDate="2014-06-08T22:55:24.960" Score="0" ViewCount="1573" Body="&lt;p&gt;Given a function $x(t)$ and a first order low-pass filter $\frac{dy}{dt} = \frac{1}{\alpha} (x(t) - y(t))$, is there a way to choose $\alpha$ analytically such that the derivative of $y(t)$ is bounded, i.e. $\forall t \frac{dy}{dt} \leq c$ for some given constant $c$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this question is similar to the one &lt;a href=&quot;https://math.stackexchange.com/questions/823952/low-pass-filter-as-linear-ode-with-bounded-derivative&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10156" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2014-06-09T12:22:41.647" Title="First-order low pass filter with bounded derivative" Tags="|filters|filter-design|lowpass-filter|continuous-signals|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16761" PostTypeId="2" ParentId="16445" CreationDate="2014-06-09T04:37:21.267" Score="1" Body="&lt;p&gt;Actually much less than 1 sample/chip will work for DSSS. Doing so erodes the spreading gain and makes &lt;em&gt;chip&lt;/em&gt; level detection impractical, but it works. The undersampled spreading sequence simply acts as a vector (subspace) for the undersampled signal.  Matched filtering is still matched filtering -- as long as you are still sampled well above the &lt;em&gt;symbol&lt;/em&gt; (not chip) rate.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-06-09T04:37:21.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16763" PostTypeId="2" ParentId="16208" CreationDate="2014-06-09T09:21:30.520" Score="0" Body="&lt;p&gt;You can use the double difference method or you can also use the hough transform,Bounding Box method by which you can segment the document image by detecting the table in the given document image.&lt;/p&gt;&#xA;" OwnerUserId="8886" LastActivityDate="2014-06-09T09:21:30.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16764" PostTypeId="2" ParentId="13761" CreationDate="2014-06-09T09:38:23.853" Score="1" Body="&lt;p&gt;You can detect the table from a normal text paragraph using the Hough Transform by which you can differentiate the text from the image. You can also use the bounding box method to detect the table and differentiate from the normal text rows.&lt;/p&gt;&#xA;" OwnerUserId="8886" LastEditorUserId="8202" LastEditDate="2014-06-09T10:10:06.117" LastActivityDate="2014-06-09T10:10:06.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16765" PostTypeId="1" CreationDate="2014-06-09T10:48:26.290" Score="10" ViewCount="952" Body="&lt;p&gt;Let’s assume that we have two audio signals, x(t) and y(t) affected by the noise as shown below. &#xA;And we would like to cross-correlate these two signals and the cross-correlation plot is shown as below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TD0S4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zEW2T.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this correlation plot there is a peak value around -11 msec. &#xA;I am trying to understand how we interpret this peak in this plot? What does it mean?&#xA;Please also explain me what do we obtain from the Fourier transform of the correlation function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="9014" LastActivityDate="2015-06-06T11:16:53.980" Title="What is obtained from the cross correlation plot?" Tags="|fft|fourier-transform|noise|correlation|peak-detection|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16766" PostTypeId="1" AcceptedAnswerId="16777" CreationDate="2014-06-09T11:41:05.090" Score="4" ViewCount="2946" Body="&lt;p&gt;I am learning image processing. I want to ask very basic question related to FFT topic&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Which information do we actually get from &lt;strong&gt;&quot;phase spectrum&quot;&lt;/strong&gt; and &lt;strong&gt;&quot;magnitude spectrum&quot; about an image&lt;/strong&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="9035" LastEditDate="2015-06-15T08:44:57.917" LastActivityDate="2015-06-15T08:44:57.917" Title="Which information do we get from magnitude and phase spectrum?" Tags="|image-processing|fft|fourier-transform|frequency-domain|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16767" PostTypeId="1" CreationDate="2014-06-09T11:51:58.093" Score="9" ViewCount="3873" Body="&lt;p&gt;I have captured car positions at different frames from the &lt;a href=&quot;https://www.youtube.com/watch?v=ukMFR0IQ3Yc&quot; rel=&quot;noreferrer&quot;&gt;video&lt;/a&gt;.&#xA;&lt;strong&gt;Suppose car's&lt;/strong&gt;(e.g.left side car which is coming towards us in the images) &lt;strong&gt;centroid  at video frame1 is P(x1,y1) and Q(x2,y2) at video frame4.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is it possible to represent P and Q points into 3D? so that i can calculate correct pixel distance d(PQ) and finally compute actual distance&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note:u can assume that camera is stationary, placed at height 10 m from ground level .u can also assume any suitable data if u want &lt;img src=&quot;https://i.stack.imgur.com/Gs6fD.jpg&quot; alt=&quot;car moving on road&quot;&gt;&#xA;also u can refer the next figure also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l9lZv.png&quot; alt=&quot;side view and front view&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="53" LastEditDate="2015-01-14T14:54:58.270" LastActivityDate="2015-01-14T14:58:28.113" Title="Is it possible to convert from 2D to 3D form?" Tags="|matlab|computer-vision|opencv|3d|matlab-cvst|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16768" PostTypeId="2" ParentId="16758" CreationDate="2014-06-09T12:22:41.647" Score="1" Body="&lt;p&gt;I will show you two bounds on the derivative of the output signal, both based on the system's impulse response. First, by taking the Laplace transform of the time-domain equation and rearranging you get the Laplace transform of the output signal in terms of the transform of the input signal and of the system's transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(s)=X(s)H(s)=X(s)\frac{1/\alpha}{s+1/\alpha}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse Laplace transform of $H(s)$ is the system's impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t)=\frac{1}{\alpha}e^{-t/\alpha}u(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u(t)$ is the step function. In the following I will assume that $\alpha&amp;gt;0$ is satisfied, because otherwise the system is not stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transform of the derivative $y^{\prime}(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$sY(s)=sX(s)H(s)=[sX(s)]H(s)=X(s)[sH(s)]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which it can be seen that the derivative $y^{\prime}(t)$ can be obtained either from filtering the derivative of the input signal $x^{\prime}(t)$ with $h(t)$, or by filtering $x(t)$ with a system with transfer function $sH(s)$. The impulse response of this system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h^{\prime}(t)=\frac{1}{\alpha}\delta(t)-\frac{1}{\alpha^2}e^{-t/\alpha}u(t)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From these two interpretations we can now derive two bounds on $|y^{\prime}(t)|$. First note that the magnitude of the output of a linear time-invariant system can be bounded as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|y(t)|=\left|\int_{-\infty}^{\infty}h(\tau)x(t-\tau)d\tau\right|\le&#xA;\int_{-\infty}^{\infty}|h(\tau)||x(t-\tau)|d\tau\le&#xA;|x(t)|_{max}\int_{-\infty}^{\infty}|h(\tau)|d\tau\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $y^{\prime}(t)$ can be obtained from filtering $x^{\prime}(t)$ with $h(t)$ we get the following bound&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|y^{\prime}(t)|\le|x^{\prime}(t)|_{max}\int_{-\infty}^{\infty}|h(\tau)|d\tau=&#xA;|x^{\prime}(t)|_{max}\frac{1}{\alpha}\int_{0}^{\infty}e^{-\tau/\alpha}d\tau=|x^{\prime}(t)|_{max}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the first bound on $|y^{\prime}(t)|$, which is of course only useful if one knows an upper bound on $|x^{\prime}(t)|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other bound is obtained by noting that $y^{\prime}(t)$ can also be interpreted as filtering $x(t)$ with the impulse response $h^{\prime}(t)$ given by (2):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y^{\prime}(t)=(x*h^{\prime})(t)=\frac{1}{\alpha}x(t)-\frac{1}{\alpha^2}\int_0^{\infty}e^{-\tau/\alpha}x(t-\tau)d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leads to the following bound&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|y^{\prime}(t)|\le\frac{1}{\alpha}|x(t)|_{max}+\frac{1}{\alpha^2}|x(t)|_{max}\int_0^{\infty}e^{-\tau/\alpha}d\tau=\frac{2}{\alpha}|x(t)|_{max}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining (4) and (5) we obtain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|y^{\prime}(t)|\le\min\left\{|x^{\prime}(t)|_{max},\frac{2}{\alpha}|x(t)|_{max}\right\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, both bounds depend on properties of the input signal $x(t)$, and only one of them depends on the system parameter $\alpha$. In sum, without knowing anything about the input signal $x(t)$, there is no way to choose $\alpha$ such that $y^{\prime}(t)$ is bounded for all input signals.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-09T12:22:41.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16770" PostTypeId="2" ParentId="16767" CreationDate="2014-06-09T13:27:47.563" Score="5" Body="&lt;p&gt;[EDITED] Here's how it's done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steps:&#xA;1. Isolate the Road Divider Part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eDWtH.jpg&quot; alt=&quot;Cropped Image&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RJbw8.jpg&quot; alt=&quot;Isolate the  Yellow strips&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, using Houghlines, find out the longest lines in Image. Find out the extrema points that cross image boundary. You got the Quadilateral points. I skipped this part by Manually Choosing them. In my case, the width of road at top of image is 10, and at bottom is 60.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/usn1P.png&quot; alt=&quot;The Quadilateral to Transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for the Destination, we have to Image so that Divider Quadilateral has uniform width of 60, so we save in another array new points, which have same bottom points, but top points are modified as they form a rectangle with height same as image (or bigger, you can adjust as it suits you after running it once and seeing the results), but width 60. Remember, we are transforming our image such that the divider fits into this Rectangular Area. Image will change automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, using &#xA;&lt;code&gt;Mat TransformMat = getPerspectiveTransform(ipPts, opPts);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;of opencv on initial and destination quadilateral Points, we get a Transform Matrix, Which we apply to our Test Image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;warpPerspective(ipImg, opImg, TransformMat, ipImg.size());&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/y8I5f.png&quot; alt=&quot;Transformed Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll see a lot of Area is Cropped to fit the Output in InputImage Size. However you'll notice that Image is Transformed to get parallel Divider, as we Expected. By performing some Translation and Stuff, and taking a bigger Size Output Image, You'll get this. We can never get a perfectly wrapped Output Image, since its size can be very large. But we'll reach some constraint that'll fulfill our task. Here's Last image :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qiBFE.jpg&quot; alt=&quot;Final Tansformed Image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7914" LastEditorUserId="7914" LastEditDate="2014-06-20T10:33:35.153" LastActivityDate="2014-06-20T10:33:35.153" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="16771" PostTypeId="2" ParentId="16755" CreationDate="2014-06-09T14:24:24.273" Score="2" Body="&lt;p&gt;The seminal paper on background modeling is &lt;a href=&quot;http://www.ai.mit.edu/projects/vsam/Publications/stauffer_cvpr98_track.pdf&quot; rel=&quot;nofollow&quot;&gt;Adaptive background mixture models for real-time tracking&lt;/a&gt; by Stauffer and Grimson. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have Matlab and the Computer Vision System Toolbox, then you can try using &lt;code&gt;vision.ForegroundDetector&lt;/code&gt;, which implements a version of their algorithm.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2014-06-09T18:55:23.960" LastActivityDate="2014-06-09T18:55:23.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16772" PostTypeId="1" CreationDate="2014-06-09T14:45:57.807" Score="2" ViewCount="192" Body="&lt;p&gt;I have a fairly good understanding of Wavelet Analysis, but what are these bilinear distributions and how do they differ from Wavelet Transform?&lt;/p&gt;&#xA;" OwnerUserId="4142" LastActivityDate="2014-06-09T15:50:32.787" Title="Intuitively explain Bi-linear time frequency distributions, someone please?" Tags="|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16773" PostTypeId="2" ParentId="16772" CreationDate="2014-06-09T15:50:32.787" Score="3" Body="&lt;p&gt;As you mentioned - all these methods share common principle, they allow for representation of our signal in time-frequency domain. First thing to notice is that wavelets are very different from the STFT-like (linear) methods as they provide scale dependent frequency resolution (which in case of STFT is constant and governed by Heisenberg uncertainty principle). Probably you've seen this famous picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GBJbU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So called bi-linear transform mostly refers to Wigner Transform which can be considered as the Fourier Transform of signals' instantaneous autocorrelation function. It is governed by following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W(t,f)=\int_{-\infty}^{\infty} x \left( t+ \frac{\tau}{2} \right) x^* \left( t-\frac{\tau}{2} \right) e^{-2\pi i f \tau} d\tau$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $^*$ denotes complex conjugate and $\tau$ is the time delay. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One might notice that in analogy to STFT, the shifted signal itself is considered as a window. It is also worth of mentioning, that Wigner Transform provides &lt;strong&gt;perfect time and frequency resolution at the same time&lt;/strong&gt; - this is simply great for signals with fast changes of instantaneous frequency. On the other hand WT is the bi-linear transform, which implies major disadvantage: for each linear combination of two signals $x(t)$ and $y(t)$, result consists of two parts: auto-terms and &lt;strong&gt;cross-terms&lt;/strong&gt;. This issue produces interferences in time-frequency representation known as &quot;beats&quot;, which can make interpretation of WT difficult. If you are looking for more specific mathematical description, then please refer to article posted below - I see no point in rewriting equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example is shown on a figure below, where two linear chirps were analysed. Cross-term is clearly visible in between, which makes interpretation of results troublesome. Sometimes it happens, that magnitude of cross-term is even higher than auto-terms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WWFpg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although some methods were described in literature how to deal with this problem. Please refer to the following article for more details.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.google.co.uk/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;ved=0CDUQFjAB&amp;amp;url=http%3A%2F%2Fwww.researchgate.net%2Fpublication%2F229062547_A_new_technique_to_reduce_cross_terms_in_the_Wigner_distribution%2Ffile%2F72e7e526e15fc3627a.pdf&amp;amp;ei=n9SVU_jYAuic0AWzu4HIDA&amp;amp;usg=AFQjCNEE53Qk9GHWJknSCCYtNh1gy2WyGg&amp;amp;sig2=rK8hGvi3QoHNk1SEL6GCPg&amp;amp;bvm=bv.68445247,d.ZGU&amp;amp;cad=rja&quot; rel=&quot;nofollow noreferrer&quot;&gt;R.B. Pachori and P. Sircar - &lt;em&gt;A new technique to reduce cross terms in the Wigner distribution&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-09T15:50:32.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16774" PostTypeId="1" AcceptedAnswerId="16776" CreationDate="2014-06-09T16:01:38.703" Score="1" ViewCount="1849" Body="&lt;p&gt;I have very limited knowledge of DSP, so I apologize if my question is trivial :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an EEG signal from which I need to extract different frequency bands. For example, waves in the the frequency band of 8-12 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After noise filtering, I was planning to simply feed the data into the &lt;a href=&quot;https://www.ffmpeg.org/ffmpeg-filters.html#bandpass&quot; rel=&quot;nofollow&quot;&gt;FFmpeg bandpass filter&lt;/a&gt;, setting the 'frequency' to 10 Hz, and 'width' to 2 Hz. Is this the way to do it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to ask this since I'm not sure how to check if I got the correct wave in the end.&lt;/p&gt;&#xA;" OwnerUserId="10161" LastEditorUserId="8202" LastEditDate="2014-06-09T18:43:30.293" LastActivityDate="2017-12-02T10:54:22.897" Title="Filtering the EEG signals" Tags="|bandpass|eeg|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16776" PostTypeId="2" ParentId="16774" CreationDate="2014-06-09T16:53:00.073" Score="2" Body="&lt;p&gt;It is &lt;strong&gt;one&lt;/strong&gt; way to do it, yes. You will get frequencies between 8 an 12 Hz less attenuated compared to others, but both the 8 and 12 Hz components will be attenuated 3 dB ($\frac{1}{\sqrt{2}}$ the original magnitude) and frequencies just outside the band will be attenuated only slightly more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The&lt;/strong&gt; way depends on how much you would like to attenuate and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a proper filter design you would like to specify a passband (between 8 and 12 in your case), a stopband (where the filter should attenuate according to your specification, there must be a transition band), maximum allowed attenuation in the passband and minimum required attenuation in the stopband. The exact numbers can be hard to determine, but once you have some you can rather straightforwardly input them into any appropriate filter design method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you should obtain some filtering using the FFmpeg approach, although there may be artifacts which you did not expect/want.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2014-06-10T11:25:44.920" LastActivityDate="2014-06-10T11:25:44.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16777" PostTypeId="2" ParentId="16766" CreationDate="2014-06-09T19:42:53.573" Score="7" Body="&lt;p&gt;You get the exact same information you will receive if you analyse a 1-D signal using the Fourier analysis tools, for example. To illustrate this consider the following examples&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CQcNR.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;We perform Fourier Transform on it and obtain the following spectrum&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GKt4S.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As you can see there are two symmetric dots representing the frequency that is present in the image and the central, DC, component.&lt;/p&gt;&#xA;&lt;p&gt;Next up&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UJoBp.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Again the Fourier Transform&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rndrt.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It is obvious that the higher frequencies are further away from the DC, central, component. To understand the logic behind this you shall remember that we are actually working with complex numbers and their properties kick in.&lt;/p&gt;&#xA;&lt;p&gt;To answer your second question: You are usually working with sparse data structures (vectors, arrays, tensors, etc.) in the frequency domain. Now you tell me which is easier: Working on the original data set consisting of &lt;code&gt;500&lt;/code&gt; different values or the transformed one with half of them &lt;code&gt;0&lt;/code&gt;s ?&lt;/p&gt;&#xA;&lt;p&gt;Now, the importance of phase - &lt;em&gt;drum rolls&lt;/em&gt; - it is the same, meaning &lt;strong&gt;HUGE&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Again, a sample image&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m4eQG.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Fourier Magnitude Spectrum&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xslRe.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Fourier Phase Spectrum&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sQ8q1.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Now, we inverse the transformation by using just the amplitude and then just the phase information&lt;/p&gt;&#xA;&lt;p&gt;Inverted amplitude spectrum&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Aq0Qt.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Inverted phase spectrum&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N8Jxr.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I think you get the idea :D&lt;/p&gt;&#xA;&lt;p&gt;Now, here are some sample images and their respective amplitude and phase spectra, so you can practice a wee bit&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EysbU.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rny6h.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wjcA5.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gTdIw.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/assN7.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uWMnB.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dGh3D.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UpdPF.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0pXWd.png&quot; alt=&quot;Mathematica graphics&quot; /&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7477" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-06-09T19:42:53.573" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16779" PostTypeId="1" CreationDate="2014-06-09T21:41:52.357" Score="2" ViewCount="102" Body="&lt;p&gt;Apologies for the poorly formulated question -- I've been away from DSP for a while.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us say I have amplitude vs time data for N signals. where amplitude is -127 to 127.&#xA;For each signal I have say 900 to 1100 time samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a priori knowledge that the N signals can be grouped into n clusters where n &amp;lt;&amp;lt; N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can take a guess at n. So for example if N=1000 I can guess that n=10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a signal belongs to a cluster -- then the sum of square error of the amplitude/time between the signal and the mean of the aplitude/time of the cluster is less than a equivalent measurement between all other such clusters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that all of these signals are not aligned at time. So there is uncertainty when the first measurement was taken. The uncertainty for any signal is much less than the size of the signal. So say I have 1000 time measurements for a signal then the first measurement is at most 10 units of time delayed from zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: Given the above how to I cluster the signals given such phase distortions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8259" LastActivityDate="2014-06-09T21:41:52.357" Title="Remove phase mis-alighnment in digital signals" Tags="|phase|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16781" PostTypeId="1" CreationDate="2014-06-10T09:18:02.730" Score="4" ViewCount="797" Body="&lt;p&gt;I am trying to design a filter whose magnitude is the same as that of a given signal. The given signal is wind turbine noise, so it has significant low-frequency content. After designing the filter, I want to filter white Gaussian noise so as to create a model of wind turbine noise. The two signals, that is the original and the filtered noise should sound similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using arbitrary magnitude filter design in Matlab for that (FIR, Order: 900, Single rate, 1-band, response specified by amplitudes, Sample rate 44100 Hz, Design method: firls). The problem is that, although I design the filter using the values from the original signal's magnitude, the filter magnitude fails to follow the magnitude at higher frequencies. Could you please help me with that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is that I am using a polynomial curve, to fit the shape of the spectrum of the original sound. Then, I filter the magnitude of the generated noise, by multiplying the extracted polynomial curve with the generated noise magnitude. Finally, after calculating the new magnitude and phase, I get back to the time domain.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x,fs] = audioread('cotton_0115-0145.wav');  % original noise sample&#xA;x = x(:,1);                                  % extract one channel&#xA;x = x.';&#xA;N = length (x);&#xA;&#xA;% fft of original signal&#xA;Y = fft(x,N)/N; &#xA;fy = (0:N-1)'*fs/N;&#xA;&#xA;% half-bandwidth selection for original signal&#xA;mag = abs(Y(1:N/2));&#xA;fmag = fy(1:N/2);&#xA;&#xA;% polynomial fitting&#xA;degreesOfFreedom=40;  &#xA;tempMag=20*log10(mag)';  % desired magnitude in dB&#xA;tempFmag=fmag;&#xA;&#xA;figure(1)&#xA;plot(tempFmag,tempMag,'b');&#xA;title('Spectrum of original signal-Polynomial fitting')&#xA;xlabel('Frequency (Hz)'); &#xA;ylabel('20log10(abs(fft(x)))');&#xA;axis([tempFmag(1) tempFmag(end) min(tempMag) 0]);&#xA;&#xA;hold on&#xA;p = [];&#xA;&#xA;for i=1:4&#xA;    p=polyfit(tempFmag,tempMag,degreesOfFreedom);&#xA;    pmag=polyval(p,tempFmag);&#xA;&#xA;    plot(tempFmag,pmag,'r');&#xA;    pause&#xA;&#xA;    above=pmag&amp;lt;tempMag;&#xA;    abovemag=tempMag(above);&#xA;    abovefmag=tempFmag(above);&#xA;&#xA;    tempMag=abovemag;&#xA;    tempFmag=abovefmag;&#xA;&#xA;end&#xA;&#xA;hold on&#xA;legend('signal magnitude','polynomial');&#xA;&#xA;%&#xA;loc1 = find(fmag == 0);&#xA;loc2 = find(fmag == 22050);&#xA;Nmag = length(mag);&#xA;&#xA;M=((Nmag-1)*max(tempFmag))/(tempFmag(end)-tempFmag(1));&#xA;freqFinal=tempFmag(1):max(tempFmag)/M:max(tempFmag);&#xA;freqFinal=tempFmag(1):max(tempFmag)/length(mag):max(tempFmag);&#xA;magnitudesFinal=polyval(p,freqFinal);&#xA;&#xA;figure(2) &#xA;plot(fmag,20*log10(mag)');&#xA;hold on;&#xA;plot(freqFinal,magnitudesFinal,'g');&#xA;title('Spectrum of original signal-Choice of polynomial curve')&#xA;xlabel('Frequency (Hz)'); &#xA;ylabel('abs(fft(x))');&#xA;axis([freqFinal(1) freqFinal(end) min(magnitudesFinal) max(magnitudesFinal)]);&#xA;&#xA;%%&#xA;% noise generation&#xA;Nn  = N;&#xA;noise =  wgn(1,Nn,0);&#xA;noise = noise/(max(abs(noise)));&#xA;Ynoise = fft(noise,Nn)/Nn;&#xA;fn = (0:Nn-1)'*fs/Nn;&#xA;&#xA;% polynomial for whole f range&#xA;newmagA = 10.^(magnitudesFinal/20);&#xA;newmagB = fliplr(newmagA);&#xA;newmagB(end+1) = newmagB(end);&#xA;newmag = [newmagA newmagB];&#xA;&#xA;%filtering&#xA;Ynoisenew = newmag .* Ynoise;&#xA;figure(3)&#xA;magnoise = 20*log10(abs(Ynoisenew(1:Nn/2)));&#xA;fnoise = fn(1:Nn/2);&#xA;plot(fnoise, magnoise);&#xA;&#xA;% magnitude and phase of filtered noise&#xA;magn = abs(Ynoisenew);&#xA;phn = unwrap(angle(Ynoisenew));&#xA;&#xA;% Back to Time domain&#xA;sig_new=real(ifft(magn.*exp(1i*phn)));&#xA;&#xA;figure(4)&#xA;sig_new = sig_new / max(abs(sig_new));&#xA;plot(t, sig_new);&#xA;&#xA;Ysignew = fft(sig_new,Nn)/Nn;&#xA;fn = (0:Nn-1)'*fs/Nn;&#xA;figure(5); plot(fn(1:Nn/2),20*log10(abs(Ysignew(1:Nn/2))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10166" LastEditorUserId="80" LastEditDate="2016-11-02T18:36:11.727" LastActivityDate="2017-01-01T20:38:51.513" Title="How to design a filter with a certain magnitude response" Tags="|matlab|filtering|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16782" PostTypeId="1" CreationDate="2014-06-10T10:28:03.620" Score="3" ViewCount="372" Body="&lt;p&gt;I am running a stationary wavelet transformation on a brain image. I can't understand why it shifts with each level so that the image is no longer centered. You can see that the X component shifts to the right, the Y to the bottom, the diags up and to the left. This makes it hard to reach my goal of using the SWT to detect edge activity at each scale, as it looks like I will have to re-align the images to do the calculation. Why is it like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FsxHQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="8202" LastEditDate="2014-06-10T10:36:06.093" LastActivityDate="2019-01-02T14:32:27.933" Title="Why does the Stationary Wavelet Transform shift this image?" Tags="|matlab|wavelet|transform|stationary|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16783" PostTypeId="2" ParentId="16208" CreationDate="2014-06-10T10:46:38.960" Score="1" Body="&lt;p&gt;Why do not use hough transform for finding lines and then finding table region?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can use hough transform to find horizontal and vertical lines. and then extract region of lines.&lt;/p&gt;&#xA;" OwnerUserId="9055" LastActivityDate="2014-06-10T10:46:38.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16784" PostTypeId="2" ParentId="16767" CreationDate="2014-06-10T10:48:50.507" Score="4" Body="&lt;p&gt;This looks like a sort of &lt;a href=&quot;http://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29&quot; rel=&quot;nofollow&quot;&gt;ray tracing&lt;/a&gt; problem. If you know the position and orientation of your camera you should be able to calculate the &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/EPSRC_SSAZ/node3.html&quot; rel=&quot;nofollow&quot;&gt;3x4 projection matrix&lt;/a&gt; and its inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should allow you to convert from image points to 3d position (on the road). This discussion &lt;a href=&quot;http://opencv-users.1802565.n2.nabble.com/2D-to-3D-projection-with-given-plane-td7272428.html&quot; rel=&quot;nofollow&quot;&gt;http://opencv-users.1802565.n2.nabble.com/2D-to-3D-projection-with-given-plane-td7272428.html&lt;/a&gt; might have more useful information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for applying it in matlab. There is an &lt;a href=&quot;http://www.mathworks.co.uk/help/images/ref/affine3d-class.html&quot; rel=&quot;nofollow&quot;&gt;affine3d&lt;/a&gt; which you can use for storing the transform. There might also be useful things for projections/ray-tracing in the file exchange such as &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/25974-raytracer&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/25974-raytracer&lt;/a&gt; but I haven't looked in detail to find what is relevant for what you want.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-06-10T10:48:50.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16785" PostTypeId="2" ParentId="16765" CreationDate="2014-06-10T10:50:31.393" Score="1" Body="&lt;p&gt;I may answer things that you already know,but i will do my best anyway (i had similar problems once..).&#xA;When you do the Correlation of the two sequences you simply shift the one relatively to the other (as you may already know) so each time you shift it you get lets say one &quot;dot&quot; for your plot over there,one single point.This points in a row construct the plot you are getting there.Now,in order to get each one of them you perform one operation,lets say better one calculation which is:the number of equal/same bits minus the number of non equal/same bits,after you perform that you shift again and calculate again....Now when it come to the point that two identical sequences are perfectly aligned,you can understand that the number of &quot;non equal bits&quot; will be zero (cause apparently will be matching perfectly and the result will be a massive number (compared to the rest) that will be YOUR CORRELATION PEAK,meaning that you have reached correlation.As i see there that is something similar to BOC for satellite coms that i have been using in the past,is that case that time   you need to shift the waveform in order to reach to the peak is the time that you need to uses to calculate the distance in your GPS system!&#xA;I hope that helps...    &lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2014-06-10T10:50:31.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16786" PostTypeId="1" CreationDate="2014-06-10T11:06:03.583" Score="3" ViewCount="5166" Body="&lt;p&gt;I'm working with cross-sectional CT scans of the leg using matlab's image processing toolbox.  Part of what I'm attempting to do is to automatically isolate the leg in any image, which requires removing any extraneous objects that are present in the image.  So far my code is able to take out most objects, which works for the majority of my images.  However, some of the images have an object that is flush with the leg, which my code isn't able to remove.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example of the problem: The first image shows the original image, and the second one shows the &quot;filtered&quot; image, after it has gotten rid of extraneous objects.  But as you can see, there is still something outside of the leg cross-section that I would like to get rid of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lfgmr.jpg&quot; alt=&quot;Original CT Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2CozN.jpg&quot; alt=&quot;&amp;quot;Filtered&amp;quot; CT Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've thought of using something to detect ellipses, but unfortunately some of my images are not very good homogenous shapes (like the one below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IgkrR.jpg&quot; alt=&quot;Different shape&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's the current code I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Read input file&#xA;inputfile = dlmread(filename,';');&#xA;&#xA;% Normalise input file (0 to 1) &amp;amp; show original image&#xA;I_original = mat2gray(inputfile,[min(inputfile(:)) max(inputfile(:))]);&#xA;figure; imshow(I_original)&#xA;&#xA;% Detect leg&#xA;BW1 = im2bw(I_original,.2);&#xA;BW2 = imfill(BW1,'holes');&#xA;&#xA;% Remove misc. objects around leg (i.e., stray objects &amp;lt;5000 pixels)&#xA;BW_final = bwareaopen(BW2,5000);&#xA;&#xA;% Generate filtered image&#xA;I_filtered = I_original;&#xA;I_filtered(imcomplement(BW_final)) = NaN;&#xA;figure; imshow(I_filtered)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how to fix this would be appreciated!  Thanks!&lt;/p&gt;&#xA;" OwnerUserId="10167" LastEditorUserId="10167" LastEditDate="2014-06-11T08:39:04.240" LastActivityDate="2016-05-30T07:48:35.467" Title="Detecting and isolating part of an image" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16787" PostTypeId="1" AcceptedAnswerId="16799" CreationDate="2014-06-10T12:25:13.827" Score="0" ViewCount="1295" Body="&lt;p&gt;I have several Images of shape H, F, I, L.. which have curved corners. How do I process them to give sharp right-angled corners? I tried approximating them with inner rectangles, but this takes a LOT of time.. How do I proceed with it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the sample Image. I want to process it such that I get rid of rounded corneres.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1QeCn.jpg&quot; alt=&quot;Sample Image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7914" LastEditorUserId="7914" LastEditDate="2014-06-11T05:22:37.710" LastActivityDate="2014-06-28T13:53:39.790" Title="How to proceess Image with curved corners and edges to give sharp Corners?" Tags="|image-processing|computer-vision|opencv|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16789" PostTypeId="1" CreationDate="2014-06-10T13:58:57.470" Score="0" ViewCount="229" Body="&lt;p&gt;I am have the code from &lt;a href=&quot;https://github.com/mlefebvre/OpenHGR/blob/master/BowTutorial/main.cpp&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. I have changed the images with some of my own and I have seen that &lt;code&gt;SVM&lt;/code&gt; is not working. That is not a problem because I have found on another question the answer. Now I have changed the evaluation to &lt;code&gt;NormalBayesClassifier&lt;/code&gt;. I am waiting for more than half an hour for the classifier to train. Is the &lt;code&gt;NormalBayesClassifier&lt;/code&gt;::train function so slow? I have put 7 images in one class and 7 in the other (the size is about 640x480). (I have just 2 classes). I have changed the size of the images to much more smaller: around 180x100 and I have cropped the area where was too much background, but I am still waiting for training. What could be wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing: Is trainer working? I can do a lot of things meanwhile the training and my comp is not running slow...&lt;/p&gt;&#xA;" OwnerUserId="8992" LastActivityDate="2014-06-10T13:58:57.470" Title="OpenCV: Is NormalBayesClassifier::train function running ok?" Tags="|opencv|classification|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16791" PostTypeId="1" AcceptedAnswerId="16796" CreationDate="2014-06-10T18:15:33.493" Score="2" ViewCount="121" Body="&lt;p&gt;Given a state vector, &lt;span class=&quot;math-container&quot;&gt;$ x $&lt;/span&gt;, given by &lt;span class=&quot;math-container&quot;&gt;$ x = {[r, v, a]}^{T} $&lt;/span&gt; (Range, Velocity, Acceleration) the Time to Hit is the the time which holds the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ r + v {T}_{tth} + \frac{a {T}_{tth}^{2}}{2} = 0 $$&lt;/span&gt;&#xA;Now, given the State Vector covariance &lt;span class=&quot;math-container&quot;&gt;$ P $&lt;/span&gt; what would the the Time to Hit Covariance?&lt;/p&gt;&#xA;&lt;p&gt;If the Time to Hit was given by a regular function it would be easy to do given its Jacobian, yet how can it be for this kind of calculation (Implicit Function)?&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="54457" LastEditDate="2021-07-17T07:55:01.790" LastActivityDate="2021-07-17T07:55:01.790" Title="Variance of an Implicit Function of Kalman State Vector" Tags="|signal-analysis|estimation|kalman-filters|random-process|covariance|" AnswerCount="1" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16792" PostTypeId="1" CreationDate="2014-06-10T20:39:16.847" Score="0" ViewCount="1152" Body="&lt;p&gt;I am working to understand and use the Chirp Z-Transform.  I want to use the algorithm for simple signal processing on data sets that are not a power of two.  I need to be able to inverse transform as I want to transform a set of data to the frequency domain and operate on the (complex) frequency coefficients, and then transform back to time.  So for example, one operation I perform is to integrate the signal using the Omega method.  Once I operate on the coefficients I need to transform back to the time domain.  I believe I have the Chirp Z-Transform algorithm figured out.  I can for example, pass in a 100 point time series made up of a few tones, and transform the series to the frequency domain using the Chirp Z-Transform.  I get spectral content right where it should be.  The question is, what do I do with those 100 complex valued coefficients to transform them back to a time series.  At first I thought I would use a power of 2 FFT with the additional coefficients padded to zero.  That didn't work and I now understand why that isn't the same thing as transforming only the 100 coefficients back to time.  Could someone help me to understand how to inverse transform a non-power of 2 set of Fourier coefficients.&lt;/p&gt;&#xA;" OwnerUserId="8820" LastActivityDate="2014-06-10T20:39:16.847" Title="Inverse Chirp Z Transform" Tags="|fft|fourier-transform|z-transform|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16793" PostTypeId="1" CreationDate="2014-06-10T21:11:52.080" Score="2" ViewCount="65" Body="&lt;p&gt;I have developped an application for image inpainting. Now I want to claim that it can be used for realtime purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does somebody know a paper which gives some boundaries for realtime applications? I want to refer to a paper to prove my assumption.&lt;/p&gt;&#xA;" OwnerUserId="8756" LastActivityDate="2014-06-12T04:25:47.713" Title="Upper bound for realtime application" Tags="|real-time|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16794" PostTypeId="2" ParentId="16793" CreationDate="2014-06-11T01:26:44.240" Score="1" Body="&lt;p&gt;Real time means that your algorithm can process the video faster than the time it takes to watch the video. In other words, if you were collecting the video live you would be able to finish processing it as soon as you stopped collecting it with no extra work needed to be done after.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-06-11T01:26:44.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16795" PostTypeId="1" CreationDate="2014-06-11T03:10:49.853" Score="2" ViewCount="1422" Body="&lt;p&gt;I have two cameras with rotation and translation starting from the world origin and a patch in the first camera's reference coordinate system. I want to warp this patch into the second camera's reference coordinate system. My idea is to transform every pixel like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T=T_2-T_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R=R_1^{T}R_2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x' = \left[(x  K_{inv} R) + T\right]\;K$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $R$ and $T$ are the transformation matrices between the cameras and $K$ is the affine transformation matrix that describes the camera properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct? I know that when you go from 3D to 2D you need to project, but that matrix is not invertible, so you cannot really do it here? Am I missing something really big?&lt;/p&gt;&#xA;" OwnerUserId="9120" LastEditorUserId="37293" LastEditDate="2018-08-22T15:11:26.713" LastActivityDate="2022-04-04T06:05:10.440" Title="How to warp a pixel patch to another camera" Tags="|computer-vision|camera-calibration|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16796" PostTypeId="2" ParentId="16791" CreationDate="2014-06-11T06:00:16.970" Score="2" Body="&lt;p&gt;I think I have the solution.&lt;br&gt;&#xA;I'd be happy to hear others' thought.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Defining $ F \left(r, v, a, {T}_{tth} \right) = r + v {T}_{tth} + \frac{a {{T}_{tth}}^{2}}{2} $ which is the implicit function which connects all variables.&#xA;Since we're dealing with non linear function the variance is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ var \left( {T}_{tth} \right) = J P {J}^{T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ P $ is the state vector covariance at a given time and $ J = \left[ \frac{\partial {T}_{tth} }{\partial r} \frac{\partial {T}_{tth} }{\partial v} \frac{\partial {T}_{tth} }{\partial a} \right] $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_derivative&quot; rel=&quot;noreferrer&quot;&gt;Total Derivative&lt;/a&gt; Law on the Implicit Function:&#xA;$$ \frac{\partial {T}_{tth} }{\partial r} = -\frac{{F}_{r}}{{F}_{{T}_{tth}}}, \frac{\partial {T}_{tth} }{\partial v} = -\frac{{F}_{v}}{{F}_{{T}_{tth}}}, \frac{\partial {T}_{tth} }{\partial a} = -\frac{{F}_{a}}{{F}_{{T}_{tth}}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ {F}_{x} $ is the partial derivative of $ F $ with respect to $ x $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each individual component would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{\partial {T}_{tth} }{\partial r}=-\frac{1}{v+aT_{tth}}, \frac{\partial {T}_{tth} }{\partial v}=-\frac{T_{tth}}{v+aT_{tth}}, \frac{\partial {T}_{tth} }{\partial a}=-\frac{T^2_{tth}}{2\left(v+aT_{tth}\right)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transform the state covariance matrix with $J P {J}^{T}$ and you'd have the right solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a diagonal state covariance matrix, we should have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P_{tth}=\frac{\sigma^2_r}{\left(v+aT_{tth}\right)^2}+\frac{T^2_{tth}\sigma^2_v}{\left(v+aT_{tth}\right)^2}+\frac{T^4_{tth}\sigma^2_a}{4\left(v+aT_{tth}\right)^2}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="10183" LastEditDate="2014-06-11T18:56:46.100" LastActivityDate="2014-06-11T18:56:46.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16797" PostTypeId="1" CreationDate="2014-06-11T07:49:57.153" Score="0" ViewCount="1673" Body="&lt;p&gt;I want to do boat detection in almost real time around 2-3 frames/sec and my computation power is not very high. I want to keep the computations as low as possible. Which is the best method to do it? &lt;a href=&quot;https://www.google.com.sg/search?q=singapore%20river%20taxi&amp;amp;espv=2&amp;amp;source=lnms&amp;amp;tbm=isch&amp;amp;sa=X&amp;amp;ei=jQaYU93XCczm8AW2g4LQAg&amp;amp;ved=0CAYQ_AUoAQ&amp;amp;biw=1164&amp;amp;bih=562&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; are some examples of images where I want to detect the boat.&lt;/p&gt;&#xA;" OwnerUserId="10175" LastActivityDate="2014-06-22T16:12:17.463" Title="Ship/Boat Detection" Tags="|image-processing|computer-vision|object-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16798" PostTypeId="2" ParentId="16797" CreationDate="2014-06-11T08:26:50.747" Score="1" Body="&lt;p&gt;As for the simplest algorithm, you can try detecting Water in each image, and any occlusion in that area of Water, will be considered as a boat. You can try grabcut, with water as background, and ship/boat as foreground object.&lt;/p&gt;&#xA;" OwnerUserId="7914" LastActivityDate="2014-06-11T08:26:50.747" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16799" PostTypeId="2" ParentId="16787" CreationDate="2014-06-11T08:42:34.693" Score="3" Body="&lt;p&gt;here's how houghLinesP would look like. Not a solution yet, but maybe you can work with that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    int main()&#xA;    {&#xA;&#xA;        cv::Mat image = cv::imread(&quot;SharpenCorners.jpg&quot;);&#xA;&#xA;        cv::imshow(&quot;image&quot;, image);&#xA;&#xA;        cv::Mat gray;&#xA;        cv::cvtColor(image,gray,CV_BGR2GRAY);&#xA;&#xA;        cv::imshow(&quot;gray&quot;, gray);&#xA;&#xA;        cv::Mat output; image.copyTo(output);&#xA;&#xA;        // gradient:&#xA;        cv::Mat gx, gy;&#xA;        cv::Sobel(gray, gx, CV_32F, 1, 0, 3 );&#xA;        cv::Sobel(gray, gy, CV_32F, 0, 1, 3 );&#xA;        cv::Mat gm;&#xA;        cv::magnitude(gx,gy,gm);&#xA;&#xA;        //cv::Mat g_thres = gray &amp;lt; 100;&#xA;        cv::Mat g_thres = gm &amp;gt; 100;&#xA;&#xA;        //int lineThres = 5;    // 1st image&#xA;        //int lineThres = 10;// 2nd image&#xA;        //int lineThres = 25;// 3rd image&#xA;        int lineThres = 50;// 4th image&#xA;&#xA;        std::vector&amp;lt;cv::Vec4i&amp;gt; lines;&#xA;        cv::HoughLinesP( g_thres, lines, 1, CV_PI/(4*180.0), lineThres, 10, 10 );&#xA;&#xA;        for( size_t i = 0; i &amp;lt; lines.size(); i++ )&#xA;        {&#xA;            cv::line( output, cv::Point(lines[i][0], lines[i][1]),&#xA;                    cv::Point(lines[i][2], lines[i][3]), cv::Scalar(155,255,155), 2, 8 );&#xA;        }&#xA;&#xA;        cv::imwrite(&quot;houghpSharpen4.png&quot;, output);&#xA;        cv::imshow(&quot;g thres&quot;, g_thres);&#xA;        cv::namedWindow(&quot;output&quot;); cv::imshow(&quot;output&quot;, output);&#xA;        cv::waitKey(-1);&#xA;&#xA;        return 0;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with these results for given thresholds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1st: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZReWl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2nd: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vbmfw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3rd:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t3Muu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4th: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jNznf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional idea:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Giving your own comment, that you might try to approximate each contour with rectangles, you could start with houghLinesP results (with a pretty high threshold to get at least all &quot;long&quot; line elements) and try to create the rectangles based on those lines&lt;/p&gt;&#xA;" OwnerUserId="10176" LastActivityDate="2014-06-11T08:42:34.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16800" PostTypeId="2" ParentId="16786" CreationDate="2014-06-11T09:10:21.250" Score="2" Body="&lt;p&gt;Since the Extraneous part is connected with leg section via a small thread like thing, Try converting it to binary Image, and then eroding the image to get rid of smaller objects. That should disconnect your both objects. Then choose the object with biggest area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Helpful functions - im2bw, imerode, rogionprops.&lt;/p&gt;&#xA;" OwnerUserId="7914" LastActivityDate="2014-06-11T09:10:21.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16801" PostTypeId="1" CreationDate="2014-06-11T09:16:46.073" Score="2" ViewCount="179" Body="&lt;p&gt;I am trying to find the analytic expression of the autocorrelation function for a signal $X(t)$ which is defined as follows.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$X(t = 0) = 1$&lt;/li&gt;&#xA;&lt;li&gt;At random times jumps to $X(t) = 0$ happen&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The jump probability in each infinitesimal time-step is $\Gamma dt$&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;After the jump the signal stays at $0$ for time $\tau$&lt;/li&gt;&#xA;&lt;li&gt;Then the signal jumps back to $1$ &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Do you know how or even if it is possible to calculate the autocorrelation function of such a signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal should describe the following scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine you have a house with a window. In front of the window there is a railway where trains can pass. Each train takes a fixed time $\tau$ to pass the window and trains arrive at random times. Assume that I am pointing a laser across the railway trough the window. If I can see the laser $X(t) = 1$ else the laser is hidden by the train and $X(t) = 0$. I want to calculate the autocorrelation function of such a signal.&lt;/p&gt;&#xA;" OwnerUserId="9066" LastEditorUserId="9066" LastEditDate="2014-06-11T21:07:34.923" LastActivityDate="2014-06-11T21:07:34.923" Title="Autocorrelation of a signal with gaps" Tags="|autocorrelation|" AnswerCount="0" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="16804" PostTypeId="2" ParentId="14303" CreationDate="2014-06-11T13:59:59.777" Score="2" Body="&lt;p&gt;It looks like the author implicitly makes the substitution $x(nT) \rightarrow x(n)$, but even if they were making this explicit, there are more clear ways to get to Eq. 4.3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to do this is to denote the continuous (analog) and discrete time-domain signals as $x_a$ and $x$, respectively. Your text, using this convention, would then look like this (starting from Eq. 4.2):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_a(t) \xrightarrow{sampling} x_a(nT)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(e^{j\omega})\ =\ \sum_{n = -\infty}^{\infty} x_a(nT) e^{-j\Omega nT}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Note the right-hand-side exponent: it is $-j\Omega nT$, not $-j\Omega nt$ as it appears in your text; this looks like an error to me.)&lt;/em&gt; Then if you take into account the following equality (assuming uniform sampling):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(n)\ =\  x_a(nT), \quad -\infty &amp;lt; n &amp;lt; \infty,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you end up with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(e^{j\omega})\ =\ \sum_{n = -\infty}^{\infty} x(n) e^{-j(\Omega T)n},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or (noting that $\omega = \Omega T$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(e^{j\omega})\ =\ \sum_{n = -\infty}^{\infty} x(n) e^{-j\omega n}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, this is a derivation from CFT to DTFT operation, not CFT to DFT one (as you say in the title of your question).&lt;/p&gt;&#xA;" OwnerUserId="9155" LastActivityDate="2014-06-11T13:59:59.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16805" PostTypeId="1" AcceptedAnswerId="16806" CreationDate="2014-06-11T14:26:36.257" Score="0" ViewCount="3562" Body="&lt;p&gt;I'm currently reading about segmentation, and have come across finding edges in an image. I then have this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r2bUi.png&quot; alt=&quot;First and second order derivative&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I understand how the mask used for the second-derivative works, and give the values for that, but I can't figure out how the mask for first-order derivative works ?&#xA;The second-order 1D mask is just [1 -2 1], but how does the first-order one look like ? If there even is anyone. Of course I do know, that the first-order derivative is just the slope of the line, and from that it's easy to see what the values should be. But mask wise, I'm not sure how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="10181" LastActivityDate="2014-06-11T14:48:12.163" Title="1D first-order derivative mask" Tags="|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16806" PostTypeId="2" ParentId="16805" CreationDate="2014-06-11T14:48:12.163" Score="1" Body="&lt;p&gt;As you can see in the following image, the image shows the first order 1D derivative.&#xA;Now you can write this equation in terms of the previous pixel rather than the following pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a 1D differentiation, you are only interested in either the x direction (Horizontal) changes of pixel intensity values or the y direction (Vertical).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore the mask will be [0 -1 1] in case of next intensity value.&#xA;Or [1 -1 0] for previous intensity value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can apply the same idea for vertical differentiation by taking the transpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g6Fhf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8348" LastActivityDate="2014-06-11T14:48:12.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16807" PostTypeId="2" ParentId="16795" CreationDate="2014-06-11T16:53:54.683" Score="1" Body="&lt;p&gt;$x  K_{inv}$, with $x(3) = 1$, produces the pixels as 3D points &quot;stuck on the screen&quot; of the first camera. After transforming you get the same 3D points, but in the coordinate frame of the second camera, and then you project in that camera. So, overall, what you are doing is looking at the first camera from the point of view of the second one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that is not what you want....&lt;/p&gt;&#xA;" OwnerUserId="9110" LastEditorUserId="8202" LastEditDate="2014-06-11T17:31:37.007" LastActivityDate="2014-06-11T17:31:37.007" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16809" PostTypeId="2" ParentId="16786" CreationDate="2014-06-12T02:56:01.063" Score="2" Body="&lt;p&gt;Behold the power of shortest path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Prepare image&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the image in the question for this so there are some extra steps&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('leg.jpg');&#xA;I = rgb2gray(I);&#xA;I = double(I);&#xA;I = I(56:682,411:1027);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nrCJs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bandpass filter&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are interested in finding the edges of the oval sections. The first step is to make a bandpass filter, in this case a difference of Gaussians, to isolate the smaller features.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H1 = fspecial('gaussian',[60,60],5);&#xA;H2 = fspecial('gaussian',[60,60],2);&#xA;H = H2-H1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zQlej.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edge filter&lt;/strong&gt;&#xA;Use the Hilbert transform to make two edge filters, one in the x and one in the y direction.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Hedge = imag(hilbert(H));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8MO5v.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6IZEd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Filtered images&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filter the image with the edge filters. Square each of the edge filter responses, add them together, then take the square root. The result is the magnitude of the edges.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Iodd = sqrt(imfilter(I,Hedge).^2 + imfilter(I,Hedge.').^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q39II.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Shortest Path&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shortest phase looks for the path of lowest energy (but not negative), so invert the edge values. We use the &lt;em&gt;log&lt;/em&gt; of the edge values here as that makes strong and weak edges a little closer together in value&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;G = log(Iodd);&#xA;G = max(G(:)) - G;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Grwku.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perform shortest path. I won't explain this fully as it would require an entire paper.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ path, energy, lastIndex, pathImage ] = ...&#xA;    circularShortestPath(G, 0.1, [300,300], [100,400], [400,720]);&#xA;&#xA;imagesc(G);&#xA;hold on;&#xA;plot(path(:,1),path(:,2),'r','LineWidth',2);&#xA;hold off;&#xA;pause;&#xA;&#xA;imagesc(G);&#xA;hold on;&#xA;fill(path(:,1),path(:,2),'r');&#xA;hold off;&#xA;pause;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rq2MQ.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/C0rdM.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/I1hdf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Segment&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the path to segment the image&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;J = zeros(size(I));&#xA;mask = roipoly(J,path(:,1),path(:,2));&#xA;segmentedI = I .* mask;&#xA;imagesc(segmentedI); title('segmented image'); colormap gray(256); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LAJaL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the centre point of the shortest path you can segment other things as well:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ path, energy, lastIndex, pathImage ] = ...&#xA;    circularShortestPath(G, 0.1, [114,394], [10,400], [400,720]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dNe5C.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UrRcU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code available on my neglected website:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://imageprocessing.com.au/research/code/polarTransform.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imageprocessing.com.au/research/code/polarTransform.m&lt;/a&gt;&#xA;&lt;a href=&quot;http://imageprocessing.com.au/research/code/circularShortestPath.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imageprocessing.com.au/research/code/circularShortestPath.m&lt;/a&gt;&#xA;&lt;a href=&quot;http://imageprocessing.com.au/research/code/linearShortestPath.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imageprocessing.com.au/research/code/linearShortestPath.m&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2014-06-12T03:02:05.390" LastActivityDate="2014-06-12T03:02:05.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16810" PostTypeId="2" ParentId="16793" CreationDate="2014-06-12T04:25:47.713" Score="1" Body="&lt;p&gt;Real time does not have a fixed definition, rather it describes processing speed and is qualified by the image size, frame rate, depth and any other relevant information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you should may write:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The method can process 640 x 480 grayscale video at 25 fps in real time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This means that is takes less that 1/25s to process one frame and doesn't slow down video playback.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-06-12T04:25:47.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16811" PostTypeId="1" AcceptedAnswerId="16830" CreationDate="2014-06-12T06:30:01.780" Score="1" ViewCount="341" Body="&lt;p&gt;By uniform noise I mean a band of a fixed width, no spikes, etc.  This has to be one of the simplest examples. I'm looking for the appropriate theoretical approach as much as something relatively computationally efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The true signal changes slowly (slower than 1Hz, a battery voltage).  The noise band remains fairly constant (~50mV noise on a ~4V signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initial ideas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Long moving average (e.g. a 32-point moving average).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Leaky-integrator/low-pass filter/FIR filter:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1004/low-pass-filter-in-non-ee-software-api-contexts/14795#14795&quot;&gt;&amp;quot;Low-pass filter&amp;quot; in non-EE, software API contexts&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Recursive arithmetic average:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;y_new = (new_sample + y_last) / 2&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd love to learn more about what I think is a geometric average.  I'm not sure I can quantify the time-to-settle/time-to-seed for these options either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are more standard approaches, I'd love to learn about those as well.&lt;/p&gt;&#xA;" OwnerUserId="8116" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-06-13T10:48:25.210" Title="How to filter uniform noise in a microcontroller?" Tags="|noise|lowpass-filter|moving-average|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16812" PostTypeId="1" CreationDate="2014-06-12T09:23:27.843" Score="1" ViewCount="78" Body="&lt;p&gt;I am currently doing a project that attempts to reconstruct the 3D structures from slices, i.e. the tomographic approach.  After many steps of image processing, the last task is to connect the “points” (the centroid of the sections) to create the skeletons. The skeletons have been confirmed to be a forest of &lt;em&gt;binary&lt;/em&gt; trees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem here is that the data are very noisy. Would you please suggest some techniques to perform data fitting to extract the trees?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KSEjE.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4105" LastEditorUserId="4105" LastEditDate="2014-11-13T02:23:54.797" LastActivityDate="2015-01-07T11:34:15.567" Title="extract the tree structure from a noisy data set" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16813" PostTypeId="2" ParentId="16812" CreationDate="2014-06-12T11:44:55.293" Score="1" Body="&lt;p&gt;I guess a very good resource about that is &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.42.2266&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; (Implementation might be tough, but even reading it will give you a lot of insight about the extraction of 3D centerlines)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, please take a look at &lt;a href=&quot;http://www.siue.edu/~sumbaug/RetinalProjectPapers/Review%20of%20Blood%20Vessel%20Extraction%20Techniques%20and%20Algorithms.pdf&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt; and &lt;a href=&quot;https://www.cse.ust.hk/~achung/eccv08_law_chung.pdf&quot; rel=&quot;nofollow&quot;&gt;2&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-01-07T11:34:15.567" LastActivityDate="2015-01-07T11:34:15.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16814" PostTypeId="2" ParentId="12895" CreationDate="2014-06-12T12:20:59.663" Score="3" Body="&lt;p&gt;I would suggest you to take a closer look on this publications:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.eecs.qmul.ac.uk/~simond/pub/2005/ismir05.pdf&quot; rel=&quot;nofollow&quot;&gt;MATCH: A Music Alignment Tool&#xA;  Chest&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://www.eecs.qmul.ac.uk/~simond/pub/2005/dafx05.pdf&quot; rel=&quot;nofollow&quot;&gt;Live Tracking of Musical Performances Using on-line Time&#xA;  Warping&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Shortly speaking, algorithm is following::&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Extract temporal features of your signals (Audio Spectral Flatness, MFCC's, Onset, etc.).&lt;/li&gt;&#xA;&lt;li&gt;Using Dynamic Time Warping with some constraints, i.e. path must be monotonically  increasing and be bounded.&lt;/li&gt;&#xA;&lt;li&gt;Apply the warping to the signal and you are done.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This algorithm might be bit of overkill as it's mainly used for synchronization of two the same songs played by different artist. Although you can successfully use it (worked in my case) to perform time alignment between your tracks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some implementations please refer to: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.eecs.qmul.ac.uk/~simond/match/index.html&quot; rel=&quot;nofollow&quot;&gt;MATCH Download&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.vamp-plugins.org/download.html&quot; rel=&quot;nofollow&quot;&gt;Vamp Plugins&lt;/a&gt; - you might want to install &lt;a href=&quot;http://www.sonicvisualiser.org/&quot; rel=&quot;nofollow&quot;&gt;Sonic Visualizer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-12T12:20:59.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16815" PostTypeId="1" CreationDate="2014-06-12T15:20:01.510" Score="1" ViewCount="79" Body="&lt;p&gt;The Rayleigh quotient for a covariance matrix $\mathbf{C}$ and a non-zero steering vector $\mathbf{a}$ is given by &#xA;$$&#xA;R(\mathbf{C},\mathbf{a}) := \frac{\mathbf{a}^H\mathbf{C}\mathbf{a}}{\mathbf{a}^H\mathbf{a}}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this context, it can be shown that under the constraint $\mathbf{a}^H\mathbf{a}=1$&#xA;$$&#xA;\lambda_m \leq \mathbf{a}^H\mathbf{C}\mathbf{a} \leq \lambda_1,&#xA;$$&#xA;where $\lambda_i, i = 1,...,m$ are the eigenvalues of $\mathbf{C}$ sorted in nonincreasing order. These equalities can be achieved when $\mathbf{a}$ is equal to the eigenvector of $\mathbf{C}$ associated with the smallest (i.e. $\lambda_m$) and the largest (i.e. $\lambda_1$) eigenvalue, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was therefore thinking, that under the assumption that &#xA;$$&#xA;\mathbf{a} = \exp(j \cdot \mathbf{k}x)&#xA;$$&#xA;with&#xA;$$&#xA;\mathbf{k} = [k_1,...,k_m]^T&#xA;$$&#xA;I were able to solve for $\mathbf{x}$ by&#xA;$$&#xA;x = (\tilde{\mathbf{a}}^H\tilde{\mathbf{a}})^{-1}\tilde{\mathbf{a}}^H\tilde{\mathbf{e}}_1,&#xA;$$&#xA;where &#xA;$$&#xA;\tilde{\mathbf{a}} =  j \cdot \mathbf{k}&#xA;$$&#xA;is the &quot;model&quot; contained in $\mathbf{a}$ and&#xA;$$&#xA;\tilde{\mathbf{e}}_1 = \ln(\mathbf{e_1})&#xA;$$&#xA;is the logarithm of the eigenvector corresponding to the largest eigenvalue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I seem to have messed up something in my considerations: Actually, I expect $x$ to be a real-valued scalar result. However, as $\tilde{\mathbf{a}}$ is complex-valued (but containing an imaginary part only), $\tilde{\mathbf{a}}^H\tilde{\mathbf{a}}$ is a real-valued scalar. $\tilde{\mathbf{e}}_1$ is a complex-valued vector, i.e. $\tilde{\mathbf{a}}^H\tilde{\mathbf{e}}_1$ is a complex-valued scalar. Therefore, I will always receive a complex-valued scalar $x$ as a result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me identifying my fallacy?&lt;/p&gt;&#xA;" OwnerUserId="4689" LastEditorUserId="128" LastEditDate="2019-06-26T08:53:32.287" LastActivityDate="2019-06-26T08:53:32.287" Title="Solving an Array Signal Processing Estimation Problem based on the Rayleigh Quotient" Tags="|estimation|statistics|matrix|least-squares|covariance|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16817" PostTypeId="1" AcceptedAnswerId="16819" CreationDate="2014-06-12T20:35:35.130" Score="-1" ViewCount="609" Body="&lt;p&gt;Please help! I am trying to figure out why in the code i have below my input signal is being cropped but in the code I have a full signal created. The white noise created is 5000 samples for the right channel with the left channel silent then a 10000 pause sample and then 5000 samples for the left with the right channel silent. When i run it through my STFT  function is when it is being cropped and throwing me off on trying to do the spectrogram of signal before the STFT and after.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function newwhitenoise()&#xA;L = 5000; %Sample length for the random signal&#xA;Pause = 10000; %Sample Pause Gap&#xA;mu = 0;&#xA;sigma = 2;&#xA;&#xA;%Need to see left signal is not displaying&#xA;Left_signal = sigma*randn(L,1) + mu;&#xA;Right_signal = sigma*randn(L,1) + mu;&#xA;&#xA;Long_signal = [Left_signal zeros(L,1); zeros(Pause,2); zeros(L,1) Right_signal];&#xA;&#xA;%Player Object&#xA;soundRecord(Long_signal);&#xA;&#xA;&#xA;disp([Left_signal zeros(L,1)]);&#xA;%sound(Long_signal, Fs);&#xA;&#xA;%Plots subplots in graph&#xA;%figure&#xA;%subplot(211);&#xA;%plot(Left_signal, 'b'); grid on;&#xA;%subplot(212);&#xA;%plot(Right_signal, 'r'); grid on;&#xA;end&#xA;&#xA;function signalplayer(signal)&#xA;    %load(signal);&#xA;    fs = 44100; %Sample Frequency&#xA;    obj = audioplayer(signal,fs);&#xA;    play(obj);&#xA;end&#xA;&#xA;function soundRecord (signal)&#xA;fs = 44100; %Sample Frequency&#xA;recObj = audiorecorder(44100, 16, 2);&#xA;get(recObj)&#xA;&#xA;%save sound to wave file&#xA;%filename = 'location.flac';&#xA;audiowrite('input.wav',signal, fs);&#xA;&#xA;&#xA;if ~exist('inFile')&#xA;    inFile = 'input.wav';&#xA;end&#xA;&#xA;if ~exist('outFile')&#xA;    outFile = 'output.wav';&#xA;end&#xA;&#xA;if ~exist('frameWidth')&#xA;    frameWidth = 4096;          % size of FFT frame, better be a power of 2&#xA;end&#xA;frameHop = frameWidth/2;&#xA;&#xA;analWindow = hanning(frameWidth);&#xA;&#xA;[inBuffer, Fs] = wavread(inFile);&#xA;&#xA;x = [inBuffer(:,1); linspace(0, 0, frameWidth)'];                   % use left channel only, zeropad one frame at the end&#xA;&#xA;clear inBuffer;&#xA;&#xA;numSamples = length(x);&#xA;&#xA;numFrames = floor(numSamples/frameHop)-1;&#xA;&#xA;% disp(frameWidth);&#xA;% disp(numSamples);&#xA;% disp(frameHop);&#xA;% disp(numFrames);&#xA;% disp(size(analWindow));&#xA;% disp(size(transpose(analWindow)));&#xA;&#xA;y = linspace(0, 0, numSamples)';&#xA;&#xA;&#xA;n = 0;                              % init sample pointer.  unlike MATLAB, i like counting from 0&#xA;&#xA;for frameIndex = 1:numFrames&#xA;&#xA;     xWindowed = x(n+1:n+frameWidth) .* analWindow;     % get and window the input audio frame&#xA;&#xA;     X = fft(fftshift(xWindowed));              % do the FFT&#xA;&#xA;     Y = X;                         % copy the input spectrum to output&#xA;&#xA;                                % do whatever processing to Y that you like&#xA;&#xA;     yWindowed = fftshift(real(ifft(Y)));           % convert back to time domain, toss the imaginary part&#xA; %disp(size(x(1:frameWidth)));&#xA; %disp(size(yWindowed));&#xA;&#xA;     y(n+1:n+frameWidth) = y(n+1:n+frameWidth) + yWindowed;&#xA;&#xA;     n = n + frameHop;&#xA;&#xA;&#xA;end&#xA;&#xA;spectrogram(y,256,250,256,fs,'yaxis')&#xA; title 'Spectra using Short-time Fourier Transform'&#xA;&#xA;wavwrite(y, Fs, 'output.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2018-12-16T09:57:41.797" Title="how to read full input signal with STFT in matlab" Tags="|matlab|signal-analysis|sound|stft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16818" PostTypeId="2" ParentId="11250" CreationDate="2014-06-12T23:11:55.653" Score="2" Body="&lt;p&gt;In the end I managed to do this myself, working in collaboration with &lt;a href=&quot;http://ir-ltd.net/&quot; rel=&quot;nofollow&quot;&gt;http://ir-ltd.net/&lt;/a&gt; to get the scan of my head, Blender to refine the mesh and position a cloud of microphone points, &lt;a href=&quot;http://www.waveller.com/Waveller_Cloud/&quot; rel=&quot;nofollow&quot;&gt;http://www.waveller.com/Waveller_Cloud/&lt;/a&gt; to compute the frequency responses for these points, and finally some Python/NumPy scripting to convert these into impulse responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have collaborated on a joint paper which is being presented at the forthcoming AES conference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please leave a message after July '14 if you would like me to link the paper. There is currently no link as it is still in draft form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the results of the simulation and I'm happy with the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;a href=&quot;http://www.aes.org/e-lib/browse.cfm?elib=17365&quot; rel=&quot;nofollow&quot;&gt;http://www.aes.org/e-lib/browse.cfm?elib=17365&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2014-11-10T14:00:13.677" LastActivityDate="2014-11-10T14:00:13.677" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16819" PostTypeId="2" ParentId="16817" CreationDate="2014-06-12T23:50:34.303" Score="1" Body="&lt;p&gt;okay, i recognize some of my code (that i grabbed from an old file and trimmed just to show how you can window and overlap-add frames of audio, and how you can DFT and inverse DFT the windowed segments).  a couple things, &lt;code&gt;wavread()&lt;/code&gt; and &lt;code&gt;wavwrite()&lt;/code&gt; are being deprecated in favor of &lt;code&gt;audioread()&lt;/code&gt; and &lt;code&gt;audiowrite()&lt;/code&gt;.  also &lt;code&gt;exist()&lt;/code&gt; has changed slightly since the olden days.  &lt;code&gt;if ~exist('myVariableName')&lt;/code&gt; should probabably be changed to &lt;code&gt;if ~exist('myVariableName', 'var')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that said, what should come out on &lt;code&gt;y&lt;/code&gt; should be the same as what goes into &lt;code&gt;x&lt;/code&gt; with the exception of the first half-frame (which is 2048 samples long) and the last half-frame will have the Hann (called &quot;&lt;code&gt;hanning()&lt;/code&gt;&quot; in MATLAB, i hate that) window applied and will not be overlap adding with any other frames.  but in-between &lt;code&gt;y(2048)&lt;/code&gt; and &lt;code&gt;y(numSamples-2048)&lt;/code&gt; should be the same as &lt;code&gt;x(..)&lt;/code&gt;.  you need to verify that such is the case.  that's a significant portion of &lt;code&gt;long_Signal&lt;/code&gt;.  it might not be long enough for you to not care about the edge effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;just for shits and grins, you could make plot a 3D plot of the magnitude of the spectra of all of the &lt;code&gt;xWindowed&lt;/code&gt; (or of &lt;code&gt;yWindowed&lt;/code&gt;) frames and compare the looks of it to what comes outa &lt;code&gt;spectrogram(..)&lt;/code&gt;.  they should look similar except for the different painting schemes the two plots would have.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-06-12T23:50:34.303" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="16820" PostTypeId="2" ParentId="16153" CreationDate="2014-06-13T00:08:33.110" Score="0" Body="&lt;p&gt;I think that you two ways for this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Read image processing books and implement algorithm by yourself &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Find a library for this purpose such as &lt;a href=&quot;http://www.emgu.com&quot; rel=&quot;nofollow&quot;&gt;EmguCV&lt;/a&gt;, &lt;a href=&quot;http://www.aforgenet.com/&quot; rel=&quot;nofollow&quot;&gt;AfogeNET&lt;/a&gt; or &lt;a href=&quot;http://opencv.org&quot; rel=&quot;nofollow&quot;&gt;OpenCV&lt;/a&gt;. Emgu and Aforge are based on OpenCV and Emgu is availabe for android. You can find a lot of filters from simple ones to complicated ones. also they have a good documentation and support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is better to start from way 2. Because they works correctly at highest performance. Also there is no need to learn about complicated algorithms.&lt;/p&gt;&#xA;" OwnerUserId="9055" LastActivityDate="2014-06-13T00:08:33.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16821" PostTypeId="1" AcceptedAnswerId="16822" CreationDate="2014-06-13T00:11:36.240" Score="8" ViewCount="102132" Body="&lt;p&gt;What is the procedure to check the signal type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x(t) = A  \sin (\omega t) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ y(t) = A e^ {-\lambda |t|} $&lt;/p&gt;&#xA;" OwnerUserId="8855" LastEditorUserId="4346" LastEditDate="2014-06-13T01:40:49.580" LastActivityDate="2023-10-06T20:33:29.277" Title="How to check if a signal is power signal or energy signal?" Tags="|signal-analysis|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16822" PostTypeId="2" ParentId="16821" CreationDate="2014-06-13T00:49:15.717" Score="8" Body="&lt;p&gt;Let's assume the signal, &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is not identically zero for all &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An &amp;quot;&lt;em&gt;energy signal&lt;/em&gt;&amp;quot; (what I would prefer to call a &amp;quot;&lt;em&gt;finite energy signal&lt;/em&gt;&amp;quot;) is such a signal, &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; with a finite energy:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 0 \ &amp;lt; \ \int\limits_{-\infty}^{\infty} \big|x(t)\big|^2 \ \mathrm{d}t \ &amp;lt; \ \infty $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;BTW, sometimes for mathematical ease, we require a stricter sense of finite &amp;quot;energy&amp;quot;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 0 \ &amp;lt; \ \int\limits_{-\infty}^{\infty} \big|x(t)\big| \ \mathrm{d}t \ &amp;lt; \ \infty $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And a &amp;quot;&lt;em&gt;power signal&lt;/em&gt;&amp;quot; (what I would prefer to call a &amp;quot;&lt;em&gt;finite power signal&lt;/em&gt;&amp;quot;) is such a signal, &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; with finite power:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 0 \ &amp;lt; \ \lim_{T \to \infty} \frac{1}{T}\int\limits_{-\frac{T}2}^{\frac{T}2} \big|x(t)\big|^2 \ \mathrm{d}t \ &amp;lt; \ \infty $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I think that is the most fundamental definitions of the two classes of continuous-time signals.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;You can do a very similar definitions for discrete-time signals, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;.  Let's assume the signal, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is not identically zero for all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An &amp;quot;&lt;em&gt;energy signal&lt;/em&gt;&amp;quot; (what I would prefer to call a &amp;quot;&lt;em&gt;finite energy signal&lt;/em&gt;&amp;quot;) is such a signal, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; with a finite energy:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 0 \ &amp;lt; \ \sum\limits_{n=-\infty}^{\infty} \big|x[n]\big|^2 \ &amp;lt; \ \infty $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And for mathematical ease, we sometimes require a stricter sense of finite &amp;quot;energy&amp;quot;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 0 \ &amp;lt; \ \sum\limits_{n=-\infty}^{\infty} \big|x[n]\big| \ &amp;lt; \ \infty $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And a &amp;quot;&lt;em&gt;power signal&lt;/em&gt;&amp;quot; (what I would prefer to call a &amp;quot;&lt;em&gt;finite power signal&lt;/em&gt;&amp;quot;) is such a signal, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; with finite power:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 0 \ &amp;lt; \ \lim_{N \to \infty} \frac{1}{2N+1}\sum\limits_{n=-N}^N \big|x[n]\big|^2 \ &amp;lt; \ \infty $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I think that is the most fundamental definitions of the two classes of discrete-time signals.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-10-06T20:33:29.277" LastActivityDate="2023-10-06T20:33:29.277" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16823" PostTypeId="1" AcceptedAnswerId="16825" CreationDate="2014-06-13T07:02:43.107" Score="0" ViewCount="1015" Body="&lt;p&gt;I am trying to port a MATLAB code into C++ and found the usage of &lt;code&gt;rand&lt;/code&gt; in MATLAB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is MATLAB's &lt;code&gt;rand&lt;/code&gt; function and C++ &lt;code&gt;rand()&lt;/code&gt; function same? If not, is there any inbuilt function for MATLAB's &lt;code&gt;rand&lt;/code&gt; in C++ or OpenCV?&lt;/p&gt;&#xA;" OwnerUserId="10197" LastEditorUserId="8202" LastEditDate="2014-06-13T07:25:00.270" LastActivityDate="2014-06-13T07:25:00.270" Title="MATLAB rand and C++ rand()" Tags="|matlab|opencv|" AnswerCount="1" CommentCount="3" ClosedDate="2014-06-14T23:22:30.890" ContentLicense="CC BY-SA 3.0" />
  <row Id="16824" PostTypeId="1" AcceptedAnswerId="16836" CreationDate="2014-06-13T07:12:40.907" Score="4" ViewCount="198" Body="&lt;p&gt;I couldn't figure out below paragraph on SURF paper and hope that someone can help me to understand it. Why image rotations around odd multiples of $\frac{\pi}{4}$ lead to a loss of repeatability?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;ftp://ftp.vision.ee.ethz.ch/publications/articles/eth_biwi_00517.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Bay H., Ess A., Tuytelaars T. Van Gool L. - &lt;em&gt;Speed-Up Robust Features&#xA;  (SURF)&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;, page 3, column 2&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Gaussians are optimal for scale-space analysis, but in practice they&#xA;  have to be discretized and cropped (figure 2 left half). This leads to&#xA;  a loss in repeatability under image rotations around odd multiples of&#xA;  $\frac{\pi}{4}$. This weakness holds for Hessian-based detectors in general.&#xA;  Figure 3 shows the repeatability rate of two detectors based on the&#xA;  Hessian matrix for pure image rotation. The repeatability attains a&#xA;  maximum around multiples of $\frac{\pi}{2}$. This is due to the square shape of&#xA;  the filter.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cq7hF.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;  &lt;img src=&quot;https://i.stack.imgur.com/JezPv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8956" LastEditorUserId="128" LastEditDate="2018-07-02T09:02:03.220" LastActivityDate="2018-07-02T09:02:03.220" Title="Why Does the Odd Multiple of $ \frac{\pi}{4} $ on Gaussian Cause Loss in Repeatability Under Image Rotations?" Tags="|image-processing|convolution|gaussian|sift|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16825" PostTypeId="2" ParentId="16823" CreationDate="2014-06-13T07:23:10.583" Score="4" Body="&lt;p&gt;It is a programming question, not a signal processing question - keep that in mind, and next time use the StackOverflow.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MATLAB &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/rand.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;rand&lt;/strong&gt;&lt;/a&gt; function returns uniformly distributed variable on interval $[0,1]$.&lt;/li&gt;&#xA;&lt;li&gt;C++ &lt;a href=&quot;http://www.cplusplus.com/reference/cstdlib/rand/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;rand&lt;/strong&gt;&lt;/a&gt; function returns integer between &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;RAND_MAX&lt;/code&gt;, additionally it is not very 'random' function. You would also have to normalize its output. For more info please refer here: &lt;a href=&quot;https://stackoverflow.com/questions/9878965/c-rand-between-0-and-1&quot;&gt;C++ rand() between 0 and 1&lt;/a&gt;. Although I think that you should use the &lt;a href=&quot;http://www.cplusplus.com/reference/random/uniform_int_distribution/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;uniform_int_distribution&lt;/strong&gt;&lt;/a&gt; function, providing you can take the advantage of C++11 standard. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I believe that you should use OpenCV after all, instead of playing with new standards and some tricky functions. It contains the &lt;a href=&quot;http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#rng&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;RNG&lt;/strong&gt;&lt;/a&gt; class that you can easily use for generating of uniformly distributed sequence. Here is the example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RNG rng;&#xA;float r_num = rng.uniform(0, 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-06-13T07:23:10.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16827" PostTypeId="2" ParentId="16711" CreationDate="2014-06-13T08:49:26.853" Score="0" Body="&lt;p&gt;To distinguish between round shapes and tails, you could simply use statistical tools:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have a density map $P(x, y)$ (which you may approximate simply by your image if you want). The center of mass is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;(\bar{x}, \bar{y}) = (\int x \cdot P(x,y) dx, \int y \cdot P(x,y) dy )&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I use the $\int$ symbol for convenience, it generalizes the sum over more complex spaces. In your case, use the sum over pixels.)&#xA;Similarly, you can compute the covariance matrix :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;C_{xx} = (\int (x - \bar{x})^2 \cdot P(x,y) dx \\&#xA;C_{yy} = (\int (y - \bar{y})^2 \cdot P(x,y) dy \\&#xA;C_{xy} = (\int (x - \bar{x}) \cdot (y - \bar{y}) \cdot P(x,y) dx &#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would give the shape that best approximates your object &lt;em&gt;with the hypothesis it is round&lt;/em&gt; (that is, fitted by a Gaussian shape $G(x,y)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can examine the deviation of your actual shape $P$ (measure)  with the model (gaussian $G$). A natural solution is to use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence&quot; rel=&quot;nofollow&quot;&gt;Kullback-Leibler pseudo-distance&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;D( P || G ) = \int P(x, y) \frac{\ln P(x, y)}{\ln G(x, y)} dx dy&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If qualitatively, you see 2 populations (tailed vs non-tailed), the histogram of these distances should be quantitatively bimodal.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2014-06-13T08:49:26.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16830" PostTypeId="2" ParentId="16811" CreationDate="2014-06-13T10:48:25.210" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;You need to check the noise bandwidth using an oscilloscope. By saying noise I mean the hardware noises before digitalization by ADC. &lt;/li&gt;&#xA;&lt;li&gt;If the noises have high frequency component, remove it by analog filters. High frequency is defined as frequency higher than 1/2 of the sampling rate. And in practice, usually a sampling rate of 8-10 times of the pass band of the analog low pass filter is used. You may try simple RC filters.&lt;/li&gt;&#xA;&lt;li&gt;Use FIR in a MCU to manipulate your data. Depends on the speed requirement, you can choose number of taps to use and etc. You should be able to find libraries provided by your chip manufacture, since FIR is very common in use. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope it helps!&lt;/p&gt;&#xA;" OwnerUserId="10200" LastActivityDate="2014-06-13T10:48:25.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16831" PostTypeId="1" AcceptedAnswerId="16832" CreationDate="2014-06-13T12:30:10.347" Score="1" ViewCount="220" Body="&lt;p&gt;I am trying to understand the Allocation property of Spectral Transformations. I can't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that every function can be separated into an even part and into an odd part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is understanding proof for that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=s_e(t)+s_o(t)$$&#xA;where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$s_e(t)$ - even part of function&lt;/li&gt;&#xA;&lt;li&gt;$s_o(t)$ - odd part of function&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem is that in next step at every site I looked so far, it goes something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_e(t) =\dfrac{s(t)+s(-t)}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why did they do this? Where did $\frac{1}{2}$ come from, and why is $s(t)+s(-t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please explain it to me, or point me to a good resource where I could read more about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!!!&lt;/p&gt;&#xA;" OwnerUserId="10201" LastEditorUserId="8202" LastEditDate="2014-06-13T13:04:41.327" LastActivityDate="2014-06-13T15:20:42.177" Title="Properties of Spectral Transformations - Allocation (decomposition into even and odd part)" Tags="|fourier-transform|fourier|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16832" PostTypeId="2" ParentId="16831" CreationDate="2014-06-13T12:58:15.317" Score="4" Body="&lt;p&gt;Let's say that your signal is composed of two parts: even and odd:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=s_e(t)+s_o(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also know following properties of this type of functions: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Even: $f(-x)=f(x)$&lt;/li&gt;&#xA;&lt;li&gt;Odd:  $f(-x)=-f(x)$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Let's calculate the time inversion of your signal $s(-t)$ and apply above properties:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(-t)=s_e(-t)+s_o(-t)=s_e(t)-s_o(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now let's do the trick and add the: $s(t)$ and $s(-t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\require{cancel} s(t)+s(-t) = \color{blue}{s_e(t)}+ \cancel{\color{red}{s_o(t)}} + \color{blue}{s_e(t)}-\cancel{\color{red}{s_o(t)}}=\color{blue}{2s_e(t)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solve it for $\color{blue}{s_e(t)}$, and you will get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\boxed{\color{blue}{s_e(t)}=\dfrac{s(t)+s(-t)}{2}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end let's subtract $s(t)$ and $s(-t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)-s(-t) = \cancel{\color{blue}{s_e(t)}} + \color{red}{s_o(t)} - \cancel{\color{blue}{s_e(t)}} + \color{red}{s_o(t)}=\color{red}{2s_o(t)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rearrange and you will get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\boxed{\color{red}{s_o(t)}=\dfrac{s(t)-s(-t)}{2}} $$&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-13T15:20:42.177" LastActivityDate="2014-06-13T15:20:42.177" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16833" PostTypeId="2" ParentId="16831" CreationDate="2014-06-13T13:40:11.440" Score="0" Body="&lt;p&gt;Suppose that you have available to you $s(t)$ as a known function of time.  What this is means is that if I ask you what if the value of $s(t)$ when, say,&#xA;$t = 1.23$, you can provide me with the value, say $4.56$ which is&#xA;conventionally written as $s(1.23) = 4.56$. But there is nothing magical about&#xA;$1.23$. I can choose &lt;em&gt;any&lt;/em&gt; real number value for $t$ and you are able to tell&#xA;me what the value of $s$ is at that point in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now I ask you for the values of $s(1.23)$ and $s(-1.23)$, and the values&#xA;of $s(4.56)$ and $(-4.56)$ etc. until you are sick and tired of answering&#xA;my questions, and build for myself &lt;em&gt;two&lt;/em&gt; functions that I&#xA;name as $s_e(t)$ and $s_o(t)$. Their values are as follows:&#xA;$$\begin{align}&#xA;s_e(1.23) &amp;amp;= \frac{s(1.23) + s(-1.23)}{2}\\&#xA;s_e(4.56) &amp;amp;= \frac{s(4.56) + s(-4.56)}{2}\\&#xA;\end{align}$$&#xA;and, more generally&#xA;$\displaystyle \qquad\qquad \qquad \quad  s_e(t) = \frac{s(t) + s(-t)}{2}\quad$ for &lt;strong&gt;each and every&lt;/strong&gt; value of $t$.&#xA;Similarly,$\displaystyle \qquad\qquad\qquad\qquad \qquad \quad  s_o(t) = \frac{s(t) - s(-t)}{2}\quad$ for &lt;strong&gt;each and every&lt;/strong&gt; value of $t$.&lt;br&gt;&#xA;That bold-faced stuff is important: I can apply the definition even&#xA;when $t$ is a negative number: there is nothing in the definition&#xA;that requires that $t$ be a positive number because there is no $-$ &#xA;sign in front of it in the formula. It is perfectly OK for $t$ to&#xA;be $-1.23$ and $-t = 1.23$ in the formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These functions that I have built for myself, and which you could build&#xA;for yourself too, have the following interesting properties. I know that&#xA;$$s_e(1.23) = \frac{s(1.23) + s(-1.23)}{2}.$$&#xA;But,&#xA;$$s_e(-1.23) = \frac{s(-1.23) + s(1.23)}{2} = s_e(1.23)$$ and more&#xA;generally, $s_e(t) = s_e(-t)$ for &lt;strong&gt;all&lt;/strong&gt; values of $t$.  In other&#xA;words, $s_e(t)$ is an &lt;strong&gt;even&lt;/strong&gt; function of $t$. Similarly, it can&#xA;be shown that $s_o(t)$ is an &lt;strong&gt;odd&lt;/strong&gt; function of $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I have built my functions, I tell you about them and say&lt;br&gt;&#xA;&quot;Hey, lookit, these functions that I just made up have a very&#xA;special property:&#xA;$$\text{For each and every value of} ~~t, ~s(t) = s_e(t)+s_o(t).&#xA;~~\text{Isn't that interesting?&quot;}$$&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-06-13T13:40:11.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16834" PostTypeId="1" AcceptedAnswerId="16835" CreationDate="2014-06-13T16:30:02.207" Score="1" ViewCount="1825" Body="&lt;p&gt;I'm working on a wav audio file using MATLAB. What i would like to do is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;load a wav file and divide it into frames of the same dimension&lt;/li&gt;&#xA;&lt;li&gt;filter these frames (with a different filter for each different frame) using, for instance, &lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/iirnotch.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;iirnotch&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;put all the &lt;strong&gt;filtered frames together again without having discontinuities&lt;/strong&gt; between them&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I already wrote a script using the overlap-and-add technique using a &quot;Hann&quot; window and it works quite well but between the different frames I'm not able to avoid the &lt;strong&gt;discontinuities&lt;/strong&gt; so that when I listen to the wav file (made by adding these frames together again) I hear an annoying &lt;strong&gt;glitch disturbance&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Anyone know how to avoid this problem?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="10202" LastEditorUserId="29" LastEditDate="2014-06-16T13:57:49.043" LastActivityDate="2014-06-16T13:57:49.043" Title="How can I load a wav file, split it in frames, apply different filters do different frames and then recombine the filtered frames into a single file?" Tags="|matlab|filters|discrete-signals|audio|window-functions|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16835" PostTypeId="2" ParentId="16834" CreationDate="2014-06-13T20:54:03.583" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;add technique using ann &quot;hann&quot; window and it works quite well but between the different frames I'm not able to avoid the discontinuities&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's probably because the filtering has tails that extend beyond the frame.  The window is supposed to taper the signal to 0 at the edges, but after filtering it is no longer 0 at the edges, which introduces discontinuities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you zero-padding before filtering to keep these response tails?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe you need to &lt;a href=&quot;http://www.dsprelated.com/dspbooks/sasp/Choice_WOLA_Window.html&quot; rel=&quot;nofollow&quot;&gt;apply a sqrt(window)&lt;/a&gt; before filtering (&quot;analysis window&quot;), and then another sqrt(window) &lt;em&gt;after&lt;/em&gt; filtering (&quot;synthesis window&quot;), so the combination is a normal window, and the tails are tapered to 0, and then overlap the windows by &lt;a href=&quot;http://www.dsprelated.com/dspbooks/sasp/COLA_Examples.html&quot; rel=&quot;nofollow&quot;&gt;the appropriate amount&lt;/a&gt; so that they sum back to unity.  Maybe also need to zero-pad before filtering so that the filtering tails don't wrap around, if you're doing FFT filtering, for instance.  More information here: &lt;a href=&quot;http://www.dsprelated.com/dspbooks/sasp/Weighted_Overlap_Add.html&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/dspbooks/sasp/Weighted_Overlap_Add.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If you're doing positive-phase time-domain filtering, it might be sufficient to use a regular window, zero-pad before filtering, and then instead of windowing again, just keep the entire zero-pad region with the tail in it when you sum back together, but I haven't tried it so I'm not sure.)&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2014-06-13T21:01:37.423" LastActivityDate="2014-06-13T21:01:37.423" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16836" PostTypeId="2" ParentId="16824" CreationDate="2014-06-13T22:42:04.017" Score="1" Body="&lt;p&gt;The answer boils down to 2 issues with the practical approximations of the Gaussian Kernel:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Though the Gaussian Kernel is radially symmetric its discrete approximation has a rectangle support. Unless this support will have infinite length a rotation by any angle different from a multiplication of 90 degrees will yield a shape which has to modified to fit a rectangle. Either choice (Cropping or extending) will yield different results as the weights will be different from the original approximation.&#xA;One must pay attention that the longer the support of the filter the less this issue is pronounced.&lt;/li&gt;&#xA;&lt;li&gt;If I remember correctly, the SURF algorithm uses Box Blur based approximation of the Gaussian Kernel. This approximation, though can be very close visually, doesn't retain the radial symmetry of the Gaussian Blur hence even with large length ha different results when rotated.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope this clarifies the issue.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-06-13T22:42:04.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16837" PostTypeId="1" AcceptedAnswerId="16853" CreationDate="2014-06-14T03:24:05.320" Score="7" ViewCount="1855" Body="&lt;p&gt;I am trying to test system identification in presence of measurement noise (1) A white Gaussian noise (2) Colored noise - pink, violet. When we are estimating parameters we do so in presence of iid, zero mean uncorrelated noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: I would like to know if the colored noise are correlated or not. I think they have different distribution but I could not find any information if the samples will be correlated or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: In estimation we assume that noise is additive white gaussian noise which is uncorrelated iid. What happens when the noise is not gaussian then how do we estimate theta?&#xA;For ex: $x = s(\theta) + Colored noise$&#xA;where we are trying to estimate $\theta$. Will the performance i.e, MSE vary with different levels of colored and non colored noise?&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="128" LastEditDate="2018-07-25T03:49:35.007" LastActivityDate="2018-07-25T03:49:35.007" Title="Maximum Likelihood Estimation in Presence of Colored Noise" Tags="|noise|estimation|maximum-likelihood-estimation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16839" PostTypeId="1" CreationDate="2014-06-14T06:47:49.430" Score="1" ViewCount="791" Body="&lt;p&gt;I don't fully grasp how polarity inversion is performed in the polar coordinates of frequency domain. The frequency components of the signal do not change, so the amplitude part is going to stay whatever it is. That means the phase must change, but how? If I multiply the phase by -1 the time domain gets reversed. Phase shifting on the other hand only generates a delay...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I can think off is to reverse the amplitudes, but as far as I am aware the amplitudes are always positive in polar format. Am I wrong on this?&lt;/p&gt;&#xA;" OwnerUserId="9121" LastActivityDate="2014-07-14T17:28:53.817" Title="Polarity inversion in frequency domain (polar coordinates)" Tags="|fft|frequency|dft|transform|fourier|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16840" PostTypeId="2" ParentId="16154" CreationDate="2014-06-14T07:58:13.420" Score="-1" Body="&lt;p&gt;I think there is a relation between LP order (which you supposed 2) and frame length. Selecting low order means just low frequency is predicted that's why block size with large length gives you better results. The low frequency better predicted in larger block size. I hope it helps. &lt;/p&gt;&#xA;" OwnerUserId="4327" LastActivityDate="2014-06-14T07:58:13.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16842" PostTypeId="1" AcceptedAnswerId="16879" CreationDate="2014-06-14T08:31:31.573" Score="5" ViewCount="582" Body="&lt;p&gt;I am reading image processing book.while reading i am getting terms like image detection,image recognition and image segmentation. it seems that all above terms are one and the same.i am totally confused amongst them.so can anybody help me to understand or distinguish between the above?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2014-06-16T17:19:53.653" LastActivityDate="2014-09-24T18:05:22.207" Title="How do we distinguish between Image Recognition,Detection and Segmentation?" Tags="|image-processing|matlab|computer-vision|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16844" PostTypeId="1" CreationDate="2014-06-14T09:14:30.830" Score="1" ViewCount="131" Body="&lt;p&gt;A question on this topic has been asked before: &lt;a href=&quot;https://stats.stackexchange.com/questions/35346/combining-a-linear-kalman-filter-with-additional-linear-constraints&quot;&gt;Combining a linear Kalman Filter with additional linear constraints&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I checked out some of &lt;a href=&quot;http://academic.csuohio.edu/simond/pubs/IETKalman.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;these references&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will probably use estimate projection. However I have a couple of questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For the log-likelihood calculation, (i.e. when fitting the model) should I use the original or projected estimates? I presume the former ?&lt;/li&gt;&#xA;&lt;li&gt;When forecasting should I use the original or projected estimates, in this case I think the latter ? Could someone please confirm which to use in each case and ideally why.&lt;/li&gt;&#xA;&lt;li&gt;Lastly for the prefect measurement method shown in the link above, why is the number of restrictions forced to be less than the number of variables ? I would have thought mathematically they could also be equal to the number of variables ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Baz&lt;/p&gt;&#xA;" OwnerUserId="8943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2016-02-15T08:18:39.657" Title="Kalman Filtering with Restrictions" Tags="|kalman-filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16845" PostTypeId="1" AcceptedAnswerId="16846" CreationDate="2014-06-14T10:01:28.897" Score="3" ViewCount="5718" Body="&lt;p&gt;I want to generate and play sound for tones with frequency 100 Hz and 200 Hz for 10 sec and 5 sec respectively using MATLAB with sampling frequency equal to 20500 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I want to plot their frequency spectrum. Is it possible to do this using MATLAB? &lt;/p&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="4346" LastEditDate="2014-06-14T16:29:54.183" LastActivityDate="2016-04-25T04:41:11.880" Title="How do I generate sound using MATLAB?" Tags="|matlab|fft|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16846" PostTypeId="2" ParentId="16845" CreationDate="2014-06-14T10:35:53.157" Score="5" Body="&lt;p&gt;Something like that should do. Please keep in mind that this code can be further improved by windowing your signal, using decibel scale for spectrum, taking only first half of a spectrum, etc. This is all cosmetic stuff and you can do it on your own (or maybe I will edit this answer at some point).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Time domain parameters&#xA;fs = 20500;    % Sampling frequency&#xA;dt = 1/fs;     % Time resolution&#xA;T = 10;        % Signal duration&#xA;t = 0:dt:T-dt; % Total duration&#xA;N = length(t); % Number of time samples&#xA;&#xA;%% Signal generation&#xA;f0_1 = 100; % fundamental frequency of first sinusoid&#xA;f0_2 = 200; % fundamental frequency of second sinusoid&#xA;x1 = sin(2*pi*f0_1*t); % first sinusoid&#xA;x2 = sin(2*pi*f0_2*t); % second sinusoid&#xA;&#xA;% We want 200 Hz signal to last for half of a time, therefore zero-out&#xA;% second half - use the logical indexing of time variable&#xA;x2(t&amp;gt;5)=0;&#xA;&#xA;% Now add two signals&#xA;x = x1+x2;&#xA;&#xA;% Calculate spectrum&#xA;X = abs(fft(x))/N;&#xA;% Prepare frequency axis&#xA;freqs = (0:N-1).*(fs/N);&#xA;&#xA;%% Plotting time and frequency domain&#xA;% Time domain signal plot&#xA;subplot(211)&#xA;plot(t, x)&#xA;grid on&#xA;xlabel('Time [s]')&#xA;ylabel('Amplitude')&#xA;title('Time domain signal')&#xA;&#xA;% Spectrum plot&#xA;subplot(212)&#xA;plot(freqs, X)&#xA;grid on&#xA;xlim([0 max(freqs)])&#xA;xlabel('Frequency [Hz]')&#xA;ylabel('Amplitude')&#xA;title('Spectrum')&#xA;&#xA;%% Playing back signal&#xA;% Normalize the audio:&#xA;x = 0.99*x/max(abs(x));&#xA;&#xA;% For MATLAB R2014a use audioplayer&#xA;player = audioplayer(x, fs);&#xA;play(player)&#xA;&#xA;% For older versions use wavplay&#xA;% wavplay(x, fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And apart from playing back it will also produce:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/do2DZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-14T11:15:54.633" LastActivityDate="2014-06-14T11:15:54.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16847" PostTypeId="1" CreationDate="2014-06-14T11:37:52.770" Score="7" ViewCount="2589" Body="&lt;p&gt;I am trying to apply a window function to smooth my signal and finally obtain the peaks of the signal. Yet, for spectral leakage I apply window function in time domain. After taking the Fourier amplitude spectrum ı want to further smooth the signal. Yet I do not know how to apply smoothing windows for frequency domain. Should I use convolution for the Fourier amplitude spectrum of the window and Fourier amplitude spectrum of the data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the meaning of smoothing window length with 0.1 Hz or 0.2 Hz?&lt;/p&gt;&#xA;" OwnerUserId="9005" LastEditorUserId="128" LastEditDate="2018-08-22T06:52:25.977" LastActivityDate="2018-08-22T06:52:25.977" Title="How to Apply Window Functions in Frequency Domain?" Tags="|fft|frequency-domain|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16848" PostTypeId="2" ParentId="16847" CreationDate="2014-06-14T12:32:51.613" Score="2" Body="&lt;p&gt;You need to use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution_theorem&quot; rel=&quot;noreferrer&quot;&gt;Convolution Theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely, when you want to apply an LPF Kernel in one domain (Using convolution) you can use multiplication in the other domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tricky part is the dimensions of the signals (Since we're dealing with Discrete signals).&lt;br&gt;&#xA;Since the LPF Kernel in the convolution domain might be different then the size of the signal it is applied to, so how do we multiply?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, the solution is given by interpolation to the correct dimension.&lt;br&gt;&#xA;This is done by adding zeros at the end of the signals.&lt;br&gt;&#xA;Pay attention that the end of the signal in the frequency domain is tricky.&lt;br&gt;&#xA;The end are the samples before the sampling frequency (On both sides as it is symmetric), add zeros and keep the signal symmetric (If you signals are real in the other domain).&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-06-14T12:32:51.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16849" PostTypeId="2" ParentId="16839" CreationDate="2014-06-14T17:03:09.320" Score="2" Body="&lt;p&gt;This is really basic, but here's how it works. If $X(\omega)$ is the Fourier transform of $x(t)$, then we obviously have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}\{-x(t)\}=-\mathcal{F}\{x(t)\}=-X(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=|X(\omega)|e^{j\phi(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi(\omega)$ is the phase. From this we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-X(\omega)=-|X(\omega)|e^{j\phi(\omega)}=|X(\omega)|e^{j(\phi(\omega)\pm\pi)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $e^{\pm j\pi}=-1$. So Jazzmaniac's comment that the phase needs to be shifed by $\pm \pi$ (or any odd multiple of $\pi$ for that matter) is of course correct.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-14T17:03:09.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16851" PostTypeId="2" ParentId="16847" CreationDate="2014-06-14T19:59:54.840" Score="2" Body="&lt;p&gt;To smooth as if a non-rectangular window was applied in the time domain, you need to do a complex convolution of the transform of the window with the complex FT of the data.   A convolution using just the amplitudes (magnitudes) won't work.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-14T19:59:54.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16852" PostTypeId="1" CreationDate="2014-06-14T20:47:08.923" Score="1" ViewCount="54" Body="&lt;p&gt;Some of the things I'd like to accomplish:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Strip the vocals from a recorded song as best as possible&lt;/li&gt;&#xA;&lt;li&gt;Recreate someone's song voice (like a famous artists') using someone else's voice as input&lt;/li&gt;&#xA;&lt;li&gt;Adjust parameters of the algorithm to slightly modify the output voice&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What math, algorithms, research is out there?  Or is the above impossible?&lt;/p&gt;&#xA;" OwnerUserId="10209" LastActivityDate="2014-06-14T20:47:08.923" Title="I'm interested in the state-of-the-art of vocal sound synthesis. Please advise me" Tags="|signal-analysis|algorithms|speech-processing|voice|signal-synthesis|" AnswerCount="0" CommentCount="0" ClosedDate="2014-06-16T05:32:23.533" ContentLicense="CC BY-SA 3.0" />
  <row Id="16853" PostTypeId="2" ParentId="16837" CreationDate="2014-06-14T23:21:33.240" Score="6" Body="&lt;p&gt;Samples of colored noise (taken at different times) generally &#xA;&lt;em&gt;are&lt;/em&gt; correlated random variables because the&#xA;autocorrelation function of the noise process is not a delta function&#xA;as it is in the case of white noise. Thus, if we assume a zero-mean&#xA;process (noise is generally assumed to be regardless of its color),&#xA;then the covariance of two signals separated in time by $\tau$ seconds is&#xA;$R(\tau)$ where $R(t) = \mathcal F^{-1}(S(f)$ is the autocorrelation &#xA;function of the process (inverse&#xA;Fourier transform of power spectral density). Note that is is possible&#xA;for $R(t)$ to be zero for &lt;em&gt;some&lt;/em&gt; values of $t$ (e.g. $R(t) = \operatorname{sinc}(t)$ is a valid autocorrelation function),&#xA;but it cannot be zero&#xA;for &lt;em&gt;all&lt;/em&gt; nonzero $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as the &lt;em&gt;density&lt;/em&gt; function of any sample, if the process is&#xA;Gaussian, the sample is Gaussian even if the process has been filtered&#xA;with a &lt;em&gt;linear&lt;/em&gt; filter before sampling. But if the process is &lt;em&gt;not&lt;/em&gt; &#xA;Gaussian (it is,&#xA;let us say, LaPlacian), then while each sample will be LaPlacian, the&#xA;same cannot be said generally of samples of the process after filtering&#xA;of any kind. In other words, Gaussianity&#xA;survives linear filtering, LaPlacism generally does not.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, how does maximum-likelihood estimation work when samples have&#xA;correlated noise? Consider the case when we wish to estimate the&#xA;unknown mean of a $\mathcal N(\mu, 1)$ random variable, and we&#xA;have two observations $x$ and $y$. In the standard case of &#xA;independent observations, the likelihood function is&#xA;$$L(\mu) = \frac{1}{2\pi}\exp\left(-\frac{1}{2}\left[(x-\mu)^2+(y-\mu)^2\right]\right).$$&#xA;The _maximum-likelihood estimator for $\mu$ is the number $\hat{\mu}$&#xA;that maximizes $L(\mu)$, which works out to be the number $\hat{\mu}$&#xA;that &lt;em&gt;minimizes&lt;/em&gt; $(x-\mu)^2+(y-\mu)^2$. This is a &lt;em&gt;quadratic&lt;/em&gt; in $\mu$&#xA;and the maximum-likelihood estimate turns out to be &#xA;$\hat{\mu}=\frac{x+y}{2}$. When the observations are correlated with&#xA;correlation coefficient $\rho$, then&#xA;$$L(\mu) = \frac{1}{2\pi\sqrt{1-\rho^2}}&#xA;\exp\left(-\frac{1}{2\sqrt{1-\rho^2}}&#xA;\left[(x-\mu)^2-2\rho(x-\mu)(y-\mu)+(y-\mu)^2\right]\right).$$&#xA;Once again we need to find the $\hat{\mu}$ where &#xA;$(x-\mu)^2-2\rho(x-\mu)(y-\mu)+(y-\mu)^2$ has a minimum.&#xA;We still have a &lt;em&gt;quadratic&lt;/em&gt; in $\mu$ but now we get terms&#xA;like $xy$ in the coefficients. What $\hat{\mu}$ works out to&#xA;be is left for you to work out.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And what if we have $n$ observations where $n &amp;gt; 2$? All the above&#xA;still applies. For independent identically distributed Gaussian noise&#xA;in the samples, the sample mean&#xA;$n^{-1}\sum_i x_i$ is the maximum-likelihood estimate of $\mu$ but&#xA;in the case of correlated Gaussian random variables we get very&#xA;messy minimization problems because the quadratic that we are trying&#xA;to minimize depends on the inverse of the covariance matrix and&#xA;the result is a nonlinear function of the data instead of a simple&#xA;easy-to-remember result like the sample mean.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What if the noise is not Gaussian? The same principles apply -- set up the&#xA;likelihood function and find where it attains its maximum value --  but&#xA;the calculations are quite a bit different, all depending on&#xA;what you assume or know is the joint density of the observations.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-06-16T11:09:35.173" LastActivityDate="2014-06-16T11:09:35.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16854" PostTypeId="1" AcceptedAnswerId="16866" CreationDate="2014-06-15T09:21:14.730" Score="3" ViewCount="535" Body="&lt;p&gt;I would like to simulate a sensor that provides range and direction of a beacon. This is for EKF localization, so the noise must be Gaussian (i.e. $\mathcal{N}(0, \sigma^{2})$. Also, I would like to compute the measurement noise matrix $Q_{k}$ which is&#xA;$$&#xA;Q_{k} = \begin{bmatrix} \sigma^{2}_{r} &amp;amp; 0 \\ 0 &amp;amp; \sigma^{2}_{\theta} \end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've done &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sigma_range = 1;&#xA;sigma_angle = degtorad(5);&#xA;Q = [sigma_range^2,               0;&#xA;                 0, sigma_angle^2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the sensor, this is I've done&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% add Gaussian noise with zero mean and some variance&#xA;Z(1) = Z(1) + sigma_range*randn(); % Z(1) the distance btw robot and beacon&#xA;Z(2) = Z(2) + sigma_angle*randn(); % Z(2) the angle btw robot and beacon&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="5788" LastEditorUserId="128" LastEditDate="2018-05-21T22:52:20.887" LastActivityDate="2019-04-28T17:01:30.280" Title="Simulating Range Bearing Sensor with MATLAB with Gaussian Noise (Generating Gaussian Colored Random Vector)" Tags="|noise|kalman-filters|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16855" PostTypeId="1" CreationDate="2014-06-15T10:58:53.700" Score="2" ViewCount="801" Body="&lt;p&gt;I have taken an image in height 2 meters of the ground as the original image and I want to simulate another image in 50 cm's of the ground, such as the simulated image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The focal length of my camera is 3.7 mm (&lt;code&gt;f = 3.7&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used from planar homography: &lt;code&gt;H = k'*(eye(3) - ((t*n')/d))*inv(k)&lt;/code&gt; for each plane in original image in MATLAB where in the camera coordinate system:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;x axis is perpendicular to buildings in the right side of the ground,&lt;/li&gt;&#xA;&lt;li&gt;y axis is parallel to the ground,&lt;/li&gt;&#xA;&lt;li&gt;and hence z axis is upward perpendicular to the ground.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The origin is camera location in original image and &lt;code&gt;k&lt;/code&gt; is 3x3 camera calibration matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[f 0 0;&#xA;  0 f 0;&#xA;  0 0 1]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;t&lt;/code&gt; is the transfer matrix &lt;code&gt;[0 0 -1.5]&lt;/code&gt;, &lt;code&gt;n&lt;/code&gt; is the normal vector of a plane, &lt;code&gt;d&lt;/code&gt; is the plane distance to the origin, and &lt;code&gt;eye(3)&lt;/code&gt; is camera rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the plane of the ground has &lt;code&gt;n=[0 0 1]&lt;/code&gt; and &lt;code&gt;d = 2&lt;/code&gt;, is it true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me with implementation of other planes (sky, buildings) in MATLAB.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1xg3k.jpg&quot; alt=&quot;original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simulated image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OCVS7.jpg&quot; alt=&quot;simulated image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10211" LastEditorUserId="8202" LastEditDate="2014-06-18T07:52:32.210" LastActivityDate="2014-06-18T07:52:32.210" Title="Planar Homographies in MATLAB" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16856" PostTypeId="2" ParentId="9877" CreationDate="2014-06-15T12:24:40.283" Score="4" Body="&lt;p&gt;I had a bit of a hard time to understand the answer of @edouard, which is doing the right thing. Compare to &lt;a href=&quot;https://dsp.stackexchange.com/a/3410/9031&quot;&gt;https://dsp.stackexchange.com/a/3410/9031&lt;/a&gt; , which I used to implement my reconstruction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $i$ is the imaginary number, and $x_n$ is the reconstructed signal at the $n^{\text{th}}$ iteration. Start with $x_0$ being a random vector of length of the audio signal. For me a few iterations were sufficient to get a result that sounded alright. The absolute error to the original signal was nevertheless quite high. Also the generated spectrogram I generated from the reconstructed signal, although showing the same structures in general, had quite different magnitudes.&lt;/p&gt;&#xA;" OwnerUserId="9031" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-06-15T12:24:40.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16858" PostTypeId="2" ParentId="16821" CreationDate="2014-06-15T12:45:10.527" Score="0" Body="&lt;p&gt;The assumption is that the signals under consideration are deterministic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Power signals&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A periodic signal is always a power signal if its Fourier transform is a set of discrete components comprising of a fundamental and its harmonics. In case of sinusoid it has only the fundamental component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Energy Signal&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An aperiodic signal is an energy signal if its Fourier transform is continuous. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastEditorUserId="8832" LastEditDate="2014-06-15T16:51:58.323" LastActivityDate="2014-06-15T16:51:58.323" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16859" PostTypeId="1" AcceptedAnswerId="16867" CreationDate="2014-06-15T13:03:54.683" Score="0" ViewCount="2610" Body="&lt;p&gt;i am trying to understand the error metrics for images. i had no statistics class or anything and i'm having a bit of problem with even the simplest things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have started reading this &lt;a href=&quot;http://unitstep.net/downloads/school/image-qa-presentation/&quot; rel=&quot;nofollow&quot;&gt;http://unitstep.net/downloads/school/image-qa-presentation/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;just for starters, it says that mean squared error is (page 3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sum_over_i_j( |ImageA(i,j)-ImageB(i,j)|^2 ) / amount_of_pixels&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i understand that this is trying to be something like euclidean distance between two points, but why is there no square root then?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then when you go to the next page of the presentation it tells you that this is a special case of minkowski distance and there IS the square root included in case of mean squared error!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then, shouldn't we calculate distance of two points by summing the powers of the differences &lt;strong&gt;of their dimension components&lt;/strong&gt;? (`[ (x1-x2)^2 + (y1-y2)^2 + ...] ) and only then square root the sum? then do it for all the pixels and average it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while on the page 4 it says that we power, sum and square root the pixels &lt;strong&gt;first&lt;/strong&gt; and then do this for all the channels (dimensions) separately?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i don't understand :(&lt;/p&gt;&#xA;" OwnerUserId="4540" LastActivityDate="2014-06-15T21:41:20.230" Title="understanding image error metrics, mean squared error" Tags="|distance-metrics|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16861" PostTypeId="2" ParentId="16781" CreationDate="2014-06-15T14:22:55.887" Score="1" Body="&lt;p&gt;if you are only interested in designing a signal representing the wind turbine noise, you could just generate it from your magnitude. E.g., with your magnitude $A$ over frequency $f$ you can generate a random phase $\phi$ for each frequency and over a time $t$ and then add all together. Here a small code for illustration (I tried to use your varibles. However you need to check orientation etc.):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;phi         = rand(size(fmag))*2*pi;&#xA;x           = (mag*sin(2*pi*fmag*t+repmat(phi,1,N)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="4583" LastEditorUserId="4583" LastEditDate="2014-06-15T14:54:09.260" LastActivityDate="2014-06-15T14:54:09.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16862" PostTypeId="1" CreationDate="2014-06-15T17:41:05.193" Score="0" ViewCount="582" Body="&lt;p&gt;I've written an application that estimates pitch based on autocorrelation function. I did peak picking by comparing vector values to determine whether the central one is a peak or not, but this method is not working well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone indicate a reliable peak picking algorithm?&lt;/p&gt;&#xA;" OwnerUserId="8354" LastActivityDate="2014-06-15T17:41:05.193" Title="Reliable peak picking algorithm?" Tags="|autocorrelation|peak-detection|soft-question|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16863" PostTypeId="2" ParentId="13541" CreationDate="2014-06-15T18:15:16.780" Score="1" Body="&lt;p&gt;The correct code is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;metrics.Beta = sum(sum((I1 - I_1).*(I2 - I_2)))./(sqrt(sum(sum((I1 - I_1).^2))).*(sum(sum((I2 - I_2).^2))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reference you have shown is incorrect, reffr paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2013 August Gregorio - &lt;em&gt;‘A suitable threshold for speckle reduction in&#xA;  ultrasound images’&lt;/em&gt;,  IEEE transactions on instrumentations and&#xA;  measurement&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="10214" LastEditorUserId="8202" LastEditDate="2014-06-15T22:12:47.533" LastActivityDate="2014-06-15T22:12:47.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16864" PostTypeId="1" AcceptedAnswerId="16865" CreationDate="2014-06-15T18:50:27.743" Score="5" ViewCount="1144" Body="&lt;p&gt;I have a periodic time domain sensor signal sampled at $500 \text{ Hz}$ whose amplitude spectrum I compute and obtain. From the periodicity of the signal, I was expecting the fundamental frequency to be around $f = 1.2\text{ Hz}$, and this is what I observe with amplitude say $A_1$. But besides the minuscule diminishing harmonics at integer multiples of $f$;  what may be the cause of having the harmonic at $f_2$ around $2.4 \text{ Hz}$ that has an amplitude $A_2\approx1.25A_1$  ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal is of $29 \text{ sec.} \Rightarrow N = 14500 \text{ samples}$. Down is a section with a full period of the signal, the &lt;em&gt;blue&lt;/em&gt; one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CAHAM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a section of the amplitude spectrum. &lt;code&gt;NFFT = 2^nextpow2(N);&lt;/code&gt; &#xA;I have rectified the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nXQTx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2014-06-15T20:27:52.493" LastActivityDate="2017-10-16T10:45:53.283" Title="Time domain distortion vs Harmonics" Tags="|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16865" PostTypeId="2" ParentId="16864" CreationDate="2014-06-15T21:05:35.703" Score="5" Body="&lt;p&gt;I think this is simply a property of your signal and you indeed have two significant frequency components. I don't really know the nature of your signal, but for me, it makes perfect sense, you can distinguish two periods in your signal, as shown on the plot below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/K8uEh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see there is period $\color{green}{T_1}$ and $\color{brown}{T_2}$ between consecutive &quot;peaks&quot;. So by doing &lt;strong&gt;very rough&lt;/strong&gt; approximations from your plot:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Corresponding frequency for $\color{green}{T_1}$ can be estimated as: $\dfrac{1}{7.1-6.3}=\dfrac{1}{0.8}=1.25 \mathtt{Hz} $&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In case of $\color{brown}{T_2}$ you get: $\dfrac{1}{6.7-6.3}=\dfrac{1}{0.4}=2.5 \mathtt{Hz} $&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some quick and dirty plot of such case with two sinusoids of a given frequencies and amplitudes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PhhGd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So indeed you have two frequencies present in your signal. What's more, component around $2.5 \mathtt{Hz} $ can be stronger. Please consider that your signal also has very prominent DC component (also visible at your spectrum).&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2017-10-16T10:45:53.283" LastActivityDate="2017-10-16T10:45:53.283" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="16866" PostTypeId="2" ParentId="16854" CreationDate="2014-06-15T21:19:04.333" Score="1" Body="&lt;p&gt;Few notes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First you should multiply the noise by the Standard Deviation (Root of the Variance for zero mean noise).&lt;/li&gt;&#xA;&lt;li&gt;You can do that by multiplying the Lower Cholesky Decomposition of matrix by a column vector of Gaussian noise. Yet since you assume no correlation, you can do that by independent multiplication.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vZ = vZ + [sigma_range; sigma_angle] .* randn([2, 1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-07-02T09:04:54.400" LastActivityDate="2018-07-02T09:04:54.400" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16867" PostTypeId="2" ParentId="16859" CreationDate="2014-06-15T21:41:20.230" Score="1" Body="&lt;p&gt;First of all, the mean squared error should not have a square root. As the name implies, it is the mean of the squared difference. What you are referring to is the &lt;em&gt;root&lt;/em&gt; mean squared error. Second, the this is a pixel-wise comparison between to images. Therefore the number of pixels is the dimension, and the sum is performed on it. There is even a comment on that page about color images. &lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-06-15T21:41:20.230" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16868" PostTypeId="2" ParentId="16855" CreationDate="2014-06-15T23:12:52.667" Score="2" Body="&lt;p&gt;No can do. Your scene is not not planar, nor the camera motion you want to simulate is a pure rotation about the camera's center (a &quot;pan-tilt&quot;). These are the only cases where an image transformation with a pure homography will yield a realistic result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing you can do is select one of the planes apparent in the image, and then&#xA;warp the whole image applying a homography to it - for example, you could make the left-side wall appear frontal. But your example has real parallax between the views, so it cannot be achieved with a homography.&lt;/p&gt;&#xA;" OwnerUserId="9110" LastEditorUserId="9110" LastEditDate="2014-06-16T16:18:46.700" LastActivityDate="2014-06-16T16:18:46.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16869" PostTypeId="1" AcceptedAnswerId="16956" CreationDate="2014-06-16T05:21:30.280" Score="7" ViewCount="4474" Body="&lt;p&gt;I've made a simple first order IIR highpass filter with a zero at z = 1 and a pole at z = 0.9. Its frequency response looks like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bDtTx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, I filter a DC signal using this filter. Here's the MATLAB code I use to do it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;b = [1 -1]; % Zero at z = 1&#xA;a = [1 -0.9]; %Pole at z = 0.9&#xA;&#xA;figure(1)&#xA;freqz(b, a)&#xA;&#xA;t = 1:100;&#xA;x(1:length(t)) = 1; % Constant function&#xA;&#xA;y = filter(b, a, x);&#xA;&#xA;figure(2)&#xA;plot(t, x)&#xA;xlabel('Time');&#xA;ylabel('Input Signal');&#xA;&#xA;figure(3)&#xA;plot(t, y)&#xA;xlabel('Time');&#xA;ylabel('Output Signal');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As my filter is highpass, I expect the DC to become zero, or atleast become severely attenuated. However, the output signal I get looks like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rdh2d.png&quot; alt=&quot;Exponentially decaying output signal&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;From my understanding, this exponential output is a transient produced because I haven't set the initial conditions correctly. Sure enough, setting x[-1] = 1 solves the problem. However, this works only for this particular input DC signal. For any general input signal, how do I set the initial conditions so that transients aren't produced?&lt;/p&gt;&#xA;&lt;p&gt;Edit : I'm aware that the filtfilt() function does forward-backward filtering with transient minimization, but I really want to port the filter to an embedded platform, so I need to understand how transient removal works. Thanks in advance for the help!&lt;/p&gt;&#xA;&lt;p&gt;Edit 2 : As suggested by Kuba Ober, I tried setting x[-1] as the value that it actually should have been. It works fine for a DC input, but here's what happened for a sinusoidal input:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;clc; clear all;&#xA;p = 0.9&#xA;&#xA;a = [1 -p]&#xA;b = [1 -1]&#xA;&#xA;&#xA;n = 1:100; % Samples&#xA;f = 0.2; % Frequency in Hz&#xA;Fs = 10; % Sampling rate in samples per second&#xA;t = n/Fs; % Time axis&#xA;&#xA;x = sin(2*pi*f*t);&#xA;&#xA;% Filter with the appropriate initial conditions&#xA;y = filter(b, a, x, filtic(b, a, [], [sin(2*pi*f*0)])); &#xA;&#xA;figure(1)&#xA;plot(t, x)&#xA;xlabel('Time');&#xA;ylabel('Input Signal');&#xA;&#xA;figure(2)&#xA;plot(t, y)&#xA;xlabel('Time');&#xA;ylabel('Output Signal');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here's the input signal :&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I3lfv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;And here's the output :&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rxaFC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first peak is visibly smaller than the second, which indicates some transients being present. I'm not entirely sure about this, but I think the reason it doesn't work is because just setting x[-1] is not enough, I also need to set y[-1]. The problem here is that there's no way to find out what y[-1] actually should be.&lt;/p&gt;&#xA;&lt;p&gt;Edit 3 : Let me provide a little more info on the problem I'm working on. I'm trying to use filters to remove noise from ECG (Electrocardiogram) signals in an embedded platform. Here's a typical ECG signal, after filtering:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/poWOy.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's what an ECG signal looks before filtering:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zbfFC.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note the DC offset in the signal before filtering. For filtering, I need a notch filter to remove high frequency power line noise and a highpass filter to remove the DC and the low frequency &amp;quot;drifting&amp;quot; of the signal.&lt;/p&gt;&#xA;&lt;p&gt;The filters I use need to be linear phase, since the time domain morphology of an ECG signal is very important for diagnosis. However, my filter doesn't need to be real-time, as I'm doing the processing offline after acquiring the ECG signal from the patient. So, for implementing nonlinear phase IIR filters, I'm currently using forward-backward zero phase filtering.&lt;/p&gt;&#xA;&lt;p&gt;One opinion that's shared by @Matt L. and @Royi is that transients are unavoidable in real-time filtering and that I should use a longer input signal and crop off the first few seconds of the filtered output instead. This is something I'd like to avoid, as acquiring long ECGs from a living patient is somewhat difficult. Also, I do not have to filter in real-time, so any technique of transient removal that hinges on knowing the entire signal in advance is perfectly all right. Any help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="9147" LastEditorUserId="128" LastEditDate="2021-06-12T11:03:06.510" LastActivityDate="2021-06-12T11:03:06.510" Title="Removing transients in highpass filtering with MATLAB" Tags="|matlab|filtering|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="16870" PostTypeId="1" CreationDate="2014-06-16T05:59:04.770" Score="4" ViewCount="7207" Body="&lt;p&gt;i have two sets of signals whose spectrum looks like shown in the figure. The first column of signals belongs to category 1 and the second belongs to category 2.&#xA;Looking at the spectrums I want to identify features which will differentiate the two.&#xA;Eg:mean,variance etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5bKeN.jpg&quot; alt=&quot;Column 1 and Column 2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10217" LastActivityDate="2016-11-14T07:19:49.080" Title="Feature extraction from spectrum to aid categorisation" Tags="|signal-analysis|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16871" PostTypeId="1" CreationDate="2014-06-16T06:08:36.987" Score="0" ViewCount="155" Body="&lt;p&gt;My problem is as follows: I decompose the 4th level &lt;strong&gt;detail&lt;/strong&gt; coefficient of an ECG signal further up to the fourth level and I want to reject the approx. coeff. at this level, which corresponds to the powerline interference. I reject this by using upcoef() with 'd' and then specifying only the detail coefficient. Then I want to keep on using idwt() to get back at the previous level , but this is not being possible because of the length mismatch of the new reconstucted detail coeffs. and the original approx. coeffs.&lt;br&gt;&#xA;I would like to know if at all it is possible (in MATLAB) to reject a frequency band corresponding to the further decomposition of the &lt;strong&gt;detail&lt;/strong&gt; coefficient, because when you go back up, the reconstructed coefficient lengths are different because of the inherent convolution operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am posting my code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[C1, L1]=wavedec(detrendedecg, 4, 'db8');&#xA;[cd4]=detcoef(C1,L1,[4]);&#xA;&#xA;[aa1,dd1]=dwt(cd4, 'db8');&#xA;[aa2,dd2]=dwt(dd1, 'db8');&#xA;[aa3,dd3]=dwt(dd2, 'db8');&#xA;[aa4,dd4]=dwt(dd3, 'db8');&#xA;newdd3=idwt([],dd4,'db8');&#xA;&#xA;newdd2=idwt([aa3],[newdd3],'db8');&#xA;newdd1=idwt([aa2],[newdd2],'db8');&#xA;newcd4=idwt([aa1],[newdd1],'db8');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the original signal is &lt;code&gt;detrendedecg&lt;/code&gt;. It is decomposed upto level 4 to get &lt;code&gt;cd4&lt;/code&gt; as detail coefficient. &lt;code&gt;cd4&lt;/code&gt; is decomposed again up to 4 levels to obtain &lt;code&gt;dd4&lt;/code&gt;  as the detail coefficient at level 4. I want to reject the approx coefficient at this level, i.e., &lt;code&gt;aa4&lt;/code&gt;. But this code doesn't help. It gives a matrix dimension mismatch error on the third line from thee end. What do I do now?&lt;/p&gt;&#xA;" OwnerUserId="10218" LastEditorUserId="10218" LastEditDate="2014-06-16T16:12:06.443" LastActivityDate="2014-06-16T16:12:06.443" Title="Rejecting a particular frequency band using DWT" Tags="|matlab|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16872" PostTypeId="1" AcceptedAnswerId="16875" CreationDate="2014-06-16T07:05:52.207" Score="1" ViewCount="1526" Body="&lt;p&gt;I'm new to signal processing. And I just read &lt;a href=&quot;http://www.itu.int/rec/T-REC-G.720.1/en&quot; rel=&quot;nofollow&quot;&gt;G.720.1&lt;/a&gt;. I find there is a lot of moving average used.&#xA;And I can also recall there is a lot of moving average been used in other audio processing algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example in G.720.1, the ZCR (The zero crossing rate of the input 10ms frame) are input of moving average algorithm and the result are used for sound detect. But I assume ZCR should have big change in continues frames.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;So when will you think you need moving average in an algorithm design? &lt;/li&gt;&#xA;&lt;li&gt;And if we need one, how we should select the weight?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7388" LastEditorUserId="1629" LastEditDate="2016-07-06T04:35:29.227" LastActivityDate="2016-07-06T04:39:21.447" Title="When should we using moving average in algorithm design?" Tags="|discrete-signals|audio|signal-detection|speech-processing|moving-average|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16873" PostTypeId="2" ParentId="16870" CreationDate="2014-06-16T08:09:53.297" Score="6" Body="&lt;p&gt;First thing to mention is that you must have some kind of Machine Learning algorithm to perform your recognition. You might want to use the following - what's yours?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Neural Networks (easy to implement)&lt;/li&gt;&#xA;&lt;li&gt;SVM's (should perform best)&lt;/li&gt;&#xA;&lt;li&gt;k-NN (eventually, but needs lot's of data to store)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Regarding features, it's hard to determine which to use for your application just by looking at spectra - both of categories have peaks at lower and higher part of range. Also there might be some significant information in time domain or a specific method valid for processing this type of signals. You never said what these signals are and what's the application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I notice is that class 2 has some harmonic content occurring at frequencies $160 \mathtt{Hz}$, and $200 - 225 \mathtt{Hz}$. I don't think that simple mean and variance will do. Probably you should try different and choose best performing ones. My suggestions of features you've asked for (to start with), are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Spectral Slope&lt;/strong&gt; (what's the gradient of the linear regression of your spectrum)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Audio Spectrum Flatness&lt;/strong&gt; (calculated in frequency banks - tells you if signal is noisy or harmonic)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Audio Spectrum Centroid&lt;/strong&gt; (kind of 'mean value' you mentioned)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Audio Spectrum Envelope&lt;/strong&gt; (can be understood as very general spectrum descriptor - envelope)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;MFCC&lt;/strong&gt; (well defined and described - they are describing your spectrum by using cepstral analysis)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For more info about implementations you can refer to this great book (easy to get): &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/047009334X&quot; rel=&quot;noreferrer&quot;&gt;MPEG-7 Audio and Beyond&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-16T08:09:53.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16874" PostTypeId="2" ParentId="2610" CreationDate="2014-06-16T09:43:31.867" Score="12" Body="&lt;p&gt;Personally I find Python one of the best choices out there and did myself some work in area of audio identification. You are welcomed to check for instance my software for automatic identification of birds from noisy audio recordings: &lt;a href=&quot;https://github.com/tracek/Ornithokrites&quot;&gt;Ornithokrites&lt;/a&gt;. The program is used by Department of Conservation of New Zealand and they are happy about it. Based on this example I would like to point out several advantages of using Python:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Huge, fast developing community providing tons of libraries. SciPy provides plethora of methods for signal processing (granted, not that many and mature as Matlab). Mind though that SciPy, although one of the most important, is only one of hundreds that can help you in your endeavours. I found &lt;a href=&quot;http://aubio.org/&quot;&gt;Aubio&lt;/a&gt; best for music analysis. For speech and music recognition for sure you will enjoy great number of audio features &lt;a href=&quot;http://yaafe.sourceforge.net/&quot;&gt;Yaafe&lt;/a&gt; can extract.&lt;/li&gt;&#xA;&lt;li&gt;It's free! Once out of academia, you quickly find out that Matlab is rather expensive. And even if you can afford it, then your perspective users will not be happy about this dependency. For instance, mentioned Department of Conservation would not accept proprietary software.&lt;/li&gt;&#xA;&lt;li&gt;Identification often requires machine learning and Python has great toolkit for it: sklearn. It is state of the art library - and easy to use. Have a look at &lt;a href=&quot;https://www.kaggle.com/&quot;&gt;Kaggle competitions&lt;/a&gt;  (machine learning) and check how many top programmers are using Python and sklearn. &lt;/li&gt;&#xA;&lt;li&gt;You can manage &quot;big data&quot;. If you want to run analysis against huge networked databases of recordings, then Python has well established set of tools. I don't think Matlab / Octave  interface easily with e.g. Hadoop, although please do correct me if I am wrong. R does better this area. &lt;/li&gt;&#xA;&lt;li&gt;Speaking of interfacing, you can easily interface your program with a web site. This is the way I manage Ornithokrites (bird recognition): the program runs on Amazon Web Services cloud computing service. Great if you want to provide your software to other people who do not necessarily want to go through installation procedure of all required libraries.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My second choice would be R. Although not that feature-rich as Python, it has great number of useful libraries (check e.g. &lt;a href=&quot;http://rug.mnhn.fr/seewave/&quot;&gt;seewave&lt;/a&gt; for your applications). Installation of those on both Windows and Linux is piece of cake, which is important if you would like others to use your program. However, to my experience high-performance computing in R is more difficult - an important thing to notice if you need to do A LOT of processing and identification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples of music classification in Python:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ifs.tuwien.ac.at/~schindler/lectures/MIR_Feature_Extraction.html&quot;&gt;Lecture&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://willdrevo.com/fingerprinting-and-audio-recognition-with-python.html&quot;&gt;Audio fingerprinting&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://jack.minardi.org/software/computational-synesthesia/&quot;&gt;Jack Minardi blog&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Book &lt;a href=&quot;http://www.packtpub.com/building-machine-learning-systems-with-python/book&quot;&gt;Building Machine Learning Systems with Python&lt;/a&gt; has a chapter on music classification&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other tools (list by no means complete): &lt;a href=&quot;https://wiki.python.org/moin/PythonInMusic&quot;&gt;Python in Music&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5785" LastActivityDate="2014-06-16T09:43:31.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16875" PostTypeId="2" ParentId="16872" CreationDate="2014-06-16T09:51:38.127" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So when will you think you need moving average in an algorithm design? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you mean moving average filters; moving averages as the name suggest are computed as averages of samples say,  $M-1$ previous samples (+ current sample) from input $x[n]$ to get an average output $y[n]$, repeating the process to get all $y$ samples. Computing their mean to get an averaged $y[n]$ signal. What you get is a smoothing effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As explained by Sanjit Mitra in the chapter on Discrete-Time Systems in his &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/007736676X&quot; rel=&quot;nofollow&quot;&gt;book&lt;/a&gt;. When your data is corrupted with noise and you happen to have multiple measurements of the same data samples, a good estimation of your signal is doing the ensemble average. But if you only have one set of measurement, then moving averages is a way of doing it. The result is a smoothing of your noisy signal. An &lt;em&gt;M&lt;/em&gt;-point moving average is defined as a FIR system as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ &#xA;y[n] = \frac{1}{M}\sum_{k=0}^{M-1} x[n-k],\quad 0\leq n-k \leq M-1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And if we need one, how we should select the weight?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As seen in the equation, all the weights are equal and dependent on the length of the chosen filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h[n] = \frac{1}{M}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The choice of the length is critical. An efficient implementation however is done by introducing a recursive form and requires only 2 additions and 1 division. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, depending on your application, there are other &lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average&quot; rel=&quot;nofollow&quot;&gt;variants &lt;/a&gt; of the moving average that may be more suited to your signals.&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-07-06T04:39:21.447" LastActivityDate="2016-07-06T04:39:21.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16876" PostTypeId="1" CreationDate="2014-06-16T13:13:23.447" Score="0" ViewCount="420" Body="&lt;p&gt;I have sampling problem that I am trying to solve analytically&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have sampling frequency, let say 1kHz.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have number of target frequencies, let say 10kHz,100kHz,1MHz&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For each  target frequency I need to find nearest frequency so that after 20 cycles of &#xA;sampling I will have 20 points that will be evenly distributed within cycle of sampled signal.  I mean that for each sample sampling point will be shifted 1/20 of period of sampled signal.  The target is to get approximation of amplitude of fast signal with slow sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do anyone have any idea how can i solve it?&lt;/p&gt;&#xA;" OwnerUserId="1664" LastEditorUserId="1664" LastEditDate="2014-06-16T13:20:00.697" LastActivityDate="2014-11-13T22:04:14.770" Title="Sampling fast sinusoidal signal with low sampling rate" Tags="|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16877" PostTypeId="2" ParentId="16876" CreationDate="2014-06-16T13:37:54.177" Score="0" Body="&lt;p&gt;I think you could work this out by expressing the difference between your target frequency and some 'n' multiples of your sampling frequency (i.e. modulo the sampling frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your target frequency was 1.1kHz and sampling frequency 1kHz, the difference would be a tenth of the sampling frequency, hence you would have a complete periodic representation of the target waveform every 10 cycles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you would observe the same thing if the target frequency was 2.1kHz, as the difference (modulo sampling frequency) is a tenth of the sampling frequency.&lt;/p&gt;&#xA;" OwnerUserId="369" LastActivityDate="2014-06-16T13:37:54.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16878" PostTypeId="2" ParentId="16870" CreationDate="2014-06-16T14:30:04.930" Score="3" Body="&lt;p&gt;I've successfully distinguished such spectra using a fairly simple feature. After calculating the FFT and then energy per bin, sum all bins to get the total energy and then sort the bins &lt;em&gt;by their energy&lt;/em&gt;, highest first. Calculate the total energy in the first &lt;code&gt;N&lt;/code&gt; bins until that exceeds 90% of the total energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectra on the left will have 90% of their energy in just ~10% of the bins; the spectra on the right will have 90% of their energy in ~25% of the bins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More formally, sort &lt;code&gt;E[]&lt;/code&gt; by value descending, and then solve &lt;code&gt;Σ(i=0..N) E[i] = 0.9 * Σ E[i]&lt;/code&gt; for N.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-06-16T14:30:04.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16879" PostTypeId="2" ParentId="16842" CreationDate="2014-06-16T15:11:13.423" Score="7" Body="&lt;p&gt;It can be a little confusing at times, and the terms are not completely independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Detection:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In detection, you are simply detection the presence of something. For example, you might design an algorithm to detect beach-balls from pictures of a beach. You would feed an image into your algorithm, and it will spit out an answer 'yes', if there was a beach ball, and 'no' if there was no beach ball. This is very simply what it means to 'detect' something. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Segmentation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Segmentation is a &lt;em&gt;method&lt;/em&gt; - a &lt;em&gt;technique&lt;/em&gt; - an &lt;em&gt;algorithm&lt;/em&gt;. So for example, if someone says &quot;&lt;strong&gt;How&lt;/strong&gt; did you design your beach-ball detection algorithm?&quot;, you might say &quot;I used a segmentation algorithm&quot;. Or you might say, &quot;I used a template-matching algorithm&quot;. Or you might say &quot;I used a scale and shift-invariant matching score algorithm&quot;, etc. Those are all &lt;em&gt;methods&lt;/em&gt; of doing something, and segmentation is just a &lt;em&gt;method&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, segmentation simply means a thresholding of your image into various areas. In a simple case, say you want to separate background from foreground. Then, you &lt;em&gt;segment&lt;/em&gt; the image into two regions: A region that corresponds to the background, and a region that corresponds to the foreground. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Image Recognition:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, there is image recognition, which is simply, a very broad &lt;strong&gt;goal&lt;/strong&gt;.  For example, you might say, &quot;I achieved &lt;em&gt;image recognition&lt;/em&gt; for beach scenes, by &lt;em&gt;detecting&lt;/em&gt; beach balls using the method of &lt;em&gt;segmentation&lt;/em&gt;, &lt;em&gt;detecting&lt;/em&gt; water using the method of &lt;em&gt;k-means&lt;/em&gt;, and &lt;em&gt;detecting&lt;/em&gt; bikinis using the method of &lt;em&gt;template matching&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Of course, those are just examples, but broadly speaking, this is how you should parse the different words and terminologies you come across in this field. Hope that helped! &lt;/p&gt;&#xA;" OwnerUserId="4619" LastActivityDate="2014-06-16T15:11:13.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16880" PostTypeId="2" ParentId="16872" CreationDate="2014-06-16T16:20:36.930" Score="1" Body="&lt;p&gt;A moving average is simply a finite impulse response (FIR) process with a constant finite impulse response. If you feed an impulse into a moving average, you get the constant weights as the output, followed by zeroes once you're past the length of the response. The constant is the weight of the average. The impulse response looks like a rectangular step if you plot it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a process happens to act like a low-pass filter with steepest cut-off and poorest out-of-band rejection for a given finite impulse response length. It also has a comb of frequencies that are completely rejected - this might be useful if there are strong narrowband interfering signals you wish to reject. The number of rejected frequencies is proportional to M, the length of the finite response in samples. Adjusting the number of averaged samples tunes the filter, obviously with only discrete frequencies to choose from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A moving average is cheap to compute, requiring M additions and 1 multiplication to produce one output sample. That's why it's often used if the refined control over the response of a generalized, multi-valued finite impulse response, is not needed. If it works and when it works, it's cheap.&lt;/p&gt;&#xA;" OwnerUserId="8388" LastActivityDate="2014-06-16T16:20:36.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16881" PostTypeId="1" CreationDate="2014-06-16T17:08:35.737" Score="-1" ViewCount="1932" Body="&lt;p&gt;I have several related questions about camera resolutions.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If I calibrate my camera to a particular resolution say 640x360, can I use it for another resolution like 1024x768?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, I want to know as to how many centimeters does 1 pixel contain in my image. It varies from system to system. How do I find that?. Also, it is not compulsorily square in shape? So I have to find the length and width of it. How do I do that?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I am using a logitech c170 which is a low speed cam. Is it okay to get an error around 8mm when I am trying to measure the distances in the image and compare them with real-time distances?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10225" LastEditorUserId="6" LastEditDate="2014-06-17T18:51:26.540" LastActivityDate="2014-06-18T23:48:24.620" Title="Image processing and Camera Calibration" Tags="|image-processing|resolution|camera|camera-calibration|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16882" PostTypeId="1" CreationDate="2014-06-16T19:54:02.827" Score="0" ViewCount="161" Body="&lt;p&gt;There are a &lt;a href=&quot;http://www.pcmag.com/article2/0,2817,2423004,00.asp&quot; rel=&quot;nofollow&quot;&gt;new noise cancellation headphones&lt;/a&gt; that almost fully cancel human noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kinds of algorithms could achieve that ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:by human noise , i mean talking. In general, previous audio cancellation headphones didn't work that well for attenuating talking. &lt;/p&gt;&#xA;" OwnerUserId="10223" LastEditorUserId="29" LastEditDate="2014-06-17T15:13:44.240" LastActivityDate="2014-06-17T15:13:44.240" Title="noise cancellation of non-repetitive noise" Tags="|audio|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16883" PostTypeId="1" CreationDate="2014-06-17T04:50:59.510" Score="0" ViewCount="2674" Body="&lt;p&gt;I am new to digital filters and trying to understand parameters behind them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Scenario&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to get DC value from signals sampled at 100kHz sampling rate. such high frequency is used due to system hardware limitations. A very sharp low-pass filter is to be used with cut-off frequency at 1Hz. The plan is to capture 10000 ponints first and then FIR-Decimate the income signal with several stages:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;stage 1: decimation factor 10, FIR cutoff frequency 1/20 (128 taps), 100kHz-&gt;10kHz&#xA;&lt;ul&gt;&#xA;&lt;li&gt;income 10000 points, result 1000 points&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;stage 2: decimation factor 10, FIR cutoff frequency 1/20 (128 taps), 10kHz-&gt;1kHz&#xA;&lt;ul&gt;&#xA;&lt;li&gt;income 1000 points, result 100 points&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;stage 3: decimation factor 10, FIR cutoff frequency 1/20 (128 taps), 1kHz-&gt;100Hz&#xA;&lt;ul&gt;&#xA;&lt;li&gt;income 100 points, result 10 points&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;stage 4: decimation factor 10, FIR cutoff frequency 1/20 (128 taps), 100Hz-&gt;10Hz&#xA;&lt;ul&gt;&#xA;&lt;li&gt;income 10 points, result 1 point&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Then a FIR with cut off frequency will be implemented with cutoff frequency 1/10. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In the FIR decimation, the FIR cut-off frequency is always stricter than the decimation factor to avoid aliasing, is this design necessary?&lt;/li&gt;&#xA;&lt;li&gt;What are the tradeoffs of choosing number of decimation stages and decimation factors?&lt;/li&gt;&#xA;&lt;li&gt;At stage 4, there are only 10 income points. However, FIR has 64 taps... Would the one point result still be valid?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10200" LastActivityDate="2018-04-25T01:17:08.853" Title="FIR-Decimation and Low-pass filter (taps vs number of input points vs number of decimation stages)" Tags="|matlab|filters|filter-design|finite-impulse-response|decimation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16884" PostTypeId="2" ParentId="16882" CreationDate="2014-06-17T04:56:46.137" Score="3" Body="&lt;p&gt;Since I cannot comment, here comes a short answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, there are microphones outside the earphone. The microphones record the outside noise and generate sounds with 180 phase shift to cancel the noises. The noises are canceled actively.&lt;/p&gt;&#xA;" OwnerUserId="10200" LastActivityDate="2014-06-17T04:56:46.137" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16885" PostTypeId="1" AcceptedAnswerId="16888" CreationDate="2014-06-17T05:25:56.107" Score="18" ViewCount="31975" Body="&lt;p&gt;I have code like below that applies a bandpass filter onto a signal. I am quite a noob at DSP and I want to understand what is going on behind the scenes before I proceed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, I want to know how to plot the frequency response of the filter without using &lt;code&gt;freqz&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b, a] = butter(order, [flo fhi]);&#xA;filtered_signal = filter(b, a, unfiltered_signal)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given the outputs &lt;code&gt;[b, a]&lt;/code&gt; how would I do this? This seems like it would be a simple task, but I'm having a hard time finding what I need in the documentation or online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd also like to understand how to do this as quickly as possible, e.g. using an &lt;code&gt;fft&lt;/code&gt; or other fast algorithm.&lt;/p&gt;&#xA;" OwnerUserId="10228" LastEditorUserId="80" LastEditDate="2015-10-14T11:45:22.650" LastActivityDate="2018-10-15T15:19:38.527" Title="How do I manually plot the frequency response of a bandpass Butterworth filter in MATLAB without freqz function?" Tags="|matlab|filters|filter-design|bandpass|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16886" PostTypeId="1" CreationDate="2014-06-17T07:06:20.517" Score="5" ViewCount="789" Body="&lt;p&gt;I have read that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Using Fourier decomposition any arbitrary image can be represented as&#xA;  summation of orthogonal basis images.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I want to see the basis images for any image say Lena or Cameraman, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can anybody help me to decompose an image into basis images and reconstruct back the same image from basis images using MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="8202" LastEditDate="2014-06-17T08:10:31.220" LastActivityDate="2016-08-31T02:05:20.630" Title="Is it possible to decompose an image into basis images using MATLAB?" Tags="|image-processing|matlab|fft|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16888" PostTypeId="2" ParentId="16885" CreationDate="2014-06-17T08:04:01.927" Score="30" Body="&lt;p&gt;We know that in general transfer function of a filter is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(z)=\dfrac{\sum_{k=0}^{M}b_kz^{-k}}{\sum_{k=0}^{N}a_kz^{-k}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now substitute &lt;span class=&quot;math-container&quot;&gt;$z=e^{j\omega}$&lt;/span&gt; to evaluate the transfer function on the unit circle:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(e^{j\omega})=\dfrac{\sum_{k=0}^{M}b_ke^{-j\omega k}}{\sum_{k=0}^{N}a_ke^{-j\omega k}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus this becomes only a problem of polynomial evaluation at a given &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;. Here are the steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a vector of angular frequencies &lt;span class=&quot;math-container&quot;&gt;$\omega = [0, \ldots,\pi]$&lt;/span&gt; for the first half of spectrum (no need to go up to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;) and save it in &lt;code&gt;w&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Pre-compute exponent &lt;span class=&quot;math-container&quot;&gt;$e^{-j\omega}$&lt;/span&gt; at all of them and store it in variable &lt;code&gt;ze&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Use the &lt;code&gt;polyval&lt;/code&gt; function to calculate the values of numerator and denominator by calling: &lt;code&gt;polyval(b, ze)&lt;/code&gt;, divide them and store in &lt;code&gt;H&lt;/code&gt;. Because we are interested in amplitude, then take the absolute value of the result.&lt;/li&gt;&#xA;&lt;li&gt;Convert to dB scale by using: &lt;span class=&quot;math-container&quot;&gt;$H_{dB}=20\log_{10} H $&lt;/span&gt; - in this case &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is the reference value.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Putting all of that in code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Filter definition&#xA;a = [1 -0.5 -0.25]; % Some filter with lot's of static gain&#xA;b = [1 3 2];&#xA;&#xA;%% My freqz calculation&#xA;N = 1024; % Number of points to evaluate at&#xA;upp = pi; % Evaluate only up to fs/2&#xA;% Create the vector of angular frequencies at one more point.&#xA;% After that remove the last element (Nyquist frequency)&#xA;w = linspace(0, pi, N+1); &#xA;w(end) = [];&#xA;ze = exp(-1j*w); % Pre-compute exponent&#xA;H = polyval(b, ze)./polyval(a, ze); % Evaluate transfer function and take the amplitude&#xA;Ha = abs(H);&#xA;Hdb  = 20*log10(Ha); % Convert to dB scale&#xA;wn   = w/pi;&#xA;% Plot and set axis limits&#xA;xlim = ([0 1]);&#xA;plot(wn, Hdb)&#xA;grid on&#xA;&#xA;%% MATLAB freqz&#xA;figure&#xA;freqz(b,a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Original output of &lt;code&gt;freqz&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PE03p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the output of my script:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2vt53.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And quick comparison in linear scale - looks great!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[h_f, w_f] = freqz(b,a);&#xA;figure&#xA;xlim = ([0 1]);&#xA;plot(w, Ha) % mine&#xA;grid on&#xA;hold on&#xA;plot(w_f, abs(h_f), '--r') % MATLAB&#xA;legend({'my freqz','MATLAB freqz'})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mByGv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can rewrite it into some function and add few conditions to make it more useful.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another way (previously proposed is more reliable) would be to use the fundamental property, that frequency response of a filter is a Fourier Transform of its impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(\omega)=\mathcal{F}\{h(t)\} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore you must feed into your system &lt;span class=&quot;math-container&quot;&gt;$\delta(t)$&lt;/span&gt; signal, calculate the response of your filter and take the FFT of it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;d = [zeros(1,length(w_f)) 1 zeros(1,length(w_f)-1)];&#xA;h = filter(b, a, d);&#xA;HH = abs(fft(h));&#xA;HH = HH(1:length(w_f));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In comparison this will produce the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D98lD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2018-10-15T15:19:38.527" LastActivityDate="2018-10-15T15:19:38.527" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16889" PostTypeId="2" ParentId="16883" CreationDate="2014-06-17T08:39:30.873" Score="1" Body="&lt;p&gt;I'll answer your questions first:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You should look at the final decimation factor when designing the earlier filters. Hence, for the first stage you can have a cutoff frequency of 1Hz and stopband frequency of 100000/10 - 1 = 9999 Hz, since this is what is folded/aliased into your band of interest. You would actually prefer to have several stopbands 9999-10001, 19999-20001, 29999-30001, 39999-40001, and 49999-50000 Hz /you'll have to normalize yourself...). This would require a rather low order filters, which is nice since it runs at the highest sample rate. For the next stage, 999-1001, 1999-2001, and so on. Higher order (about ten times), but ten times lower sample rate. And so on.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Roughly more stages =&gt; fewer multiplications per input sample (given that you do a proper design as above). This holds up to some limit which can be quite straightforwardly determined by searching some combinations. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After the first stage you will have $1000 + 2 \times 127$ samples (with 128 taps) and so on.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you want to get the DC value you can just average the sequence. This is, apart from the possibly obvious observation that the DC level should be the average &quot;offset&quot; of the otherwise AC signal, also what the DC component of the DFT evaluates to.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-06-17T08:39:30.873" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16892" PostTypeId="1" CreationDate="2014-06-17T11:18:42.390" Score="0" ViewCount="297" Body="&lt;p&gt;I want to compare time and frequency marginals of Wigner-Ville distribution and STFT. I can calculate WVD's marginals by simple sum operation since WVD is real. But I could not figure out how to deal with STFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For WVD, &lt;code&gt;sum(WVD(x))&lt;/code&gt; and &lt;code&gt;sum((WVD(x))')&lt;/code&gt; give the marginals where &lt;code&gt;'&lt;/code&gt; denotes the matrix transpose operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for STFT, I think I should do two summations, but there are two problems. STFT is complex, and length of STFT is based on the window length and overlap length. In order to compare, length of STFT and WVD should be equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will compare these to the real frequency and time densities, which are $|x(t)|^2$ and $|X(\omega)|^2$, where $X(\omega)$ is the Fourier spectrum of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? Thanks...&lt;/p&gt;&#xA;" OwnerUserId="2024" LastEditorUserId="8202" LastEditDate="2014-06-17T11:24:52.890" LastActivityDate="2014-06-17T11:24:52.890" Title="Frequency and time marginals of STFT and Wigner-Ville Distribution" Tags="|stft|time-frequency|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16893" PostTypeId="2" ParentId="16882" CreationDate="2014-06-17T12:00:59.120" Score="1" Body="&lt;p&gt;Noise cancelling headsets work in various different ways. The main technologies of choice are &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Passive sound attenuation&lt;/li&gt;&#xA;&lt;li&gt;Active cancellation using feedback loops&lt;/li&gt;&#xA;&lt;li&gt;Active cancellation using feed-forward noise prediction&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The later two require microphones some place. The best sound reduction can be achieved by using all three technologies in a highly coordinated way. For example, the active technologies are very efficient at low frequencies but perform poorly at high frequencies. Passive attenuation (if it's well designed) is very effective at high frequencies.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-06-17T12:00:59.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16896" PostTypeId="2" ParentId="15206" CreationDate="2014-06-17T15:06:41.090" Score="3" Body="&lt;p&gt;I know of 3 ways to exceed Shannon - &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) MIMO exceeds Shannon.  Technically each MIMO channel is limited by Shannon, but the sum of the channels exceeds the limit.  The practical limit is the ability to distinguish each MIMO channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Dr. Solyman Ashrafi (CTO at MetroPCS) owns a patent for a technique using naturally orthogonal wavelets (or Hermite functions), and has assigned it to his company called QuantumXtel.  Each wavelet is bound by Shannon, but you can stack wavelets.  There are some issues to be worked out, but UTD made a prototype some years ago.  I'm not sure what's going on with that now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Dr. Jerrold Prothero owns a patent for a technique using non-periodic symbols, and has started to company called Astrapi to develop them into a practical solution.  He claims that Shannon's Law is incomplete because it only considers periodic functions, and has created a new theorem (that incidentally reduces back down to Shannon in the case of periodic only functions).  The paper is available for peer review.  The new function is based on slew rate and sampling rate, and may allow far more data to be passed than currently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Who knows?  Maybe one of these will actually work.  At least no-one here is a kook.&lt;/p&gt;&#xA;" OwnerUserId="10238" LastEditorUserId="8202" LastEditDate="2014-06-17T15:18:32.813" LastActivityDate="2014-06-17T15:18:32.813" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16897" PostTypeId="1" AcceptedAnswerId="16898" CreationDate="2014-06-17T18:40:28.940" Score="2" ViewCount="2309" Body="&lt;p&gt;I have a program which plots data obtained in a NI USB DAQ realtime to a spectrogram plot using the surf function. I'd like to improve the appearance of the plot using some sort of windowing function. My questions are: Which windowing function is the best to use for this? and How do I implement it?&#xA;Here's a sample of my current code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fprintf('Initializing DAQ\n');&#xA;s = daq.createSession ('ni');&#xA;addAnalogInputChannel(s, 'Dev1','ai1', 'Voltage'); &#xA;&#xA;&#xA;s.NumberOfScans = Fs*Record_Time;&#xA;s.Rate = Fs;&#xA;s.Channels.Range = [-1 1];&#xA;s.DurationInSeconds = 5;&#xA;&#xA;Spect_nFFT = 2^8;&#xA;num_overlap = 19*round(Spect_nFFT/20);&#xA;start_sample = 1;&#xA;&#xA;DataRdy = true;&#xA;% Run in background session&#xA;&#xA;Lh = s.addlistener('DataAvailable', @(src,event) CaptureData(event.TimeStamps, event.Data));&#xA;s.NotifyWhenDataAvailableExceeds = 100000*.1;&#xA;s.IsContinuous = true;&#xA;s.startBackground();&#xA;NFFT = 2^nextpow2(L);&#xA;P = zeros(8193,50);&#xA;F = Fs/2*linspace(0,1,NFFT/2+1);&#xA;g=0;&#xA;&#xA;while g==0&#xA;&#xA;    while DataRdy == 0&#xA;        pause(.01)&#xA;    end&#xA;    pause(.5)&#xA;&#xA;    Min_Threshold = 10^12;&#xA;&#xA;    start_sample = 1;&#xA;    NFFT = 2^nextpow2(L); % Next power of 2 from length of myRecording&#xA;    FFT_Out = fft(myRecording(start_sample:end),NFFT)/size(myRecording(start_sample:end),1);&#xA;    FFT_Out = FFT_Out(1:NFFT/2+1);&#xA;&#xA;    A = sqrt(FFT_Out.*conj(FFT_Out));&#xA;    P = [P(:,2:end), sqrt(FFT_Out.*conj(FFT_Out))];&#xA;    P(P&amp;lt;=max(max(P))/Min_Threshold)=max(max(P))/Min_Threshold;&#xA;    surf(1:size(P,2),F,10*log10(P),'edgecolor','none'); axis tight; &#xA;&#xA;&#xA;    % Create updating spectrogram&#xA;    view(0,90); &#xA;&#xA;    xlabel('Time'); &#xA;    ylabel('Hz');&#xA;&#xA;&#xA;    drawnow;&#xA;&#xA;    DataRdy = 0;&#xA;    uicontrol('Style', 'pushbutton', 'String', 'Exit',...&#xA;    'Position', [20 20 50 20],...&#xA;    'Callback', 'g=g+1');&#xA;&#xA;end&#xA;delete(Lh);&#xA;stop(s);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="10240" LastActivityDate="2015-09-16T21:08:51.573" Title="Improve spectrogram appearance using windowing functions MATLAB" Tags="|matlab|window-functions|spectrogram|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16898" PostTypeId="2" ParentId="16897" CreationDate="2014-06-17T19:09:34.240" Score="3" Body="&lt;p&gt;Windowing is nothing more than element-wise multiplication of your signal by window function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume that you want to apply Hanning window. In your case signal is stored inside &lt;code&gt;myRecording(start_sample:end)&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create the window values vector of your signal length: &lt;code&gt;win =&#xA;hann(length(myRecording(start_sample:end)))&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Multiply by your signal and store it in variable: &lt;code&gt;sig = win.*size(myRecording(start_sample:end)&lt;/code&gt;. &lt;/li&gt;&#xA;&lt;li&gt;Perform the FFT, but keep in mind that now you cannot simply normalize but your signal length (as you do within FFT function), but you should (very simply speaking) divide by sum of your window values: &lt;code&gt;sum(win)&lt;/code&gt;. Probably you will notice that in case of no window applied = rectangular window, that is also true.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Answering second part of your question, which window to choose? You can start from this great white paper (on figure 8 you have recomendations for different window types): &lt;a href=&quot;http://www.ni.com/white-paper/4844/en/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Windowing: Optimizing FFTs Using Window Functions&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lzzsQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just keep in mind that if you you increase side-lobe attenuation then you also make your main-lobe wider (worse frequency resolution). Hanning is a good start. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info you can refer to literature:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Harris F.J. - On the Use of Windows for Harmonic Analysis with the&#xA;  Discrete Fourier&#xA;  Transform&lt;/a&gt;&#xA;  &lt;a href=&quot;http://holometer.fnal.gov/GH_FFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heinzel G. - Spectrum and spectral density estimation by the DFT&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Also I've noticed in your code that you are normalizing by the number of samples and then taking only first half of your spectrum. That's perfectly ok, but you must also multiply amplitude by 2 in order to compensate for removing of half of your energy in components above $\frac{f_s}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you have more queries you can search for questions and answers regarding windowing and leakage - you will find plenty.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-17T19:18:34.547" LastActivityDate="2014-06-17T19:18:34.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16899" PostTypeId="1" CreationDate="2014-06-17T20:51:40.430" Score="1" ViewCount="31" Body="&lt;p&gt;I have a large set of photographs of pieces of rocks. In each photo there is a 4 inch ruler bar placed next to the rock, consistently on the left near the edge, see example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k3fq9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Over 10 years the photographers moved in and out, and used different file resolutions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to normalize all of them to the same DPI before I can stitch them together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have approx 10,000 to process...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance and any thoughts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;R&lt;/p&gt;&#xA;" OwnerUserId="10242" LastEditorUserId="8202" LastEditDate="2014-06-18T14:54:47.527" LastActivityDate="2014-06-18T14:54:47.527" Title="Need to batch detect, measure, calc DPI for a consistently placed ruler in large set of technical images" Tags="|edge-detection|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16900" PostTypeId="1" AcceptedAnswerId="16902" CreationDate="2014-06-17T22:35:20.607" Score="1" ViewCount="221" Body="&lt;p&gt;In a book i have there's an exercise that want to find the output of a system for a given  signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;system: $ 2y(n)=2x(n)+x(n+1)+x(n-1) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;input : $ Χ=[\underline1, -1, 2, 0, -2, 0, 1 ]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Χ1=Χ[0] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What represent's the underlined value?&lt;/p&gt;&#xA;" OwnerUserId="8855" LastActivityDate="2014-06-18T04:11:08.973" Title="Discrete signals notation underlined value" Tags="|discrete-signals|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16902" PostTypeId="2" ParentId="16900" CreationDate="2014-06-18T04:05:24.143" Score="1" Body="&lt;p&gt;An arrow or an underline is used to indicate the value at $n=0$. Example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) = \begin{array}{ccccc}[&amp;amp;9 &amp;amp;8 &amp;amp;\underline7 &amp;amp;6 &amp;amp;5 &amp;amp;]\end{array}$$ means that,&#xA;$$\begin{array}{ccccc}&amp;amp;y(-2) = 9, &amp;amp;y(-1) =8, &amp;amp;y(0)=7, &amp;amp;y(1) = 6 &amp;amp;\mathrm{and} &amp;amp;y(2) =5\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, it says that $$\begin{array}{ccccc}&amp;amp;X(0) = 1, &amp;amp;X(1) =-1, &amp;amp;X(2)=2, &amp;amp;\ldots\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; No underline or arrow is equivalent to underlining the first value.&lt;/p&gt;&#xA;" OwnerUserId="8871" LastEditorUserId="8871" LastEditDate="2014-06-18T04:11:08.973" LastActivityDate="2014-06-18T04:11:08.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16903" PostTypeId="1" AcceptedAnswerId="21599" CreationDate="2014-06-18T09:12:07.693" Score="5" ViewCount="390" Body="&lt;p&gt;I am tracking a car using particle filter by making a rectangle around it, and I am using the state vector $[x, y, u, v, a, h]$, where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$x$, $y$ is the position of the body&lt;/li&gt;&#xA;&lt;li&gt;$u$ and $v$ are velocity in $x$ and $y$ direction&lt;/li&gt;&#xA;&lt;li&gt;$h = \mathit{height}$, and $a = \mathit{width/height}$ , height and width of the rectangle&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My state equations for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x = x' + uT$$&#xA;$$y=y'+vT$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u$ and $v$ remain same, and I am adding some random noise to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am not able to figure out, how should I change my $a$ and $h$ value, what should be the state equations for that. I am using histogram matching as the likelihood function.  &lt;/p&gt;&#xA;" OwnerUserId="10197" LastEditorUserId="10197" LastEditDate="2014-06-18T11:01:44.247" LastActivityDate="2015-02-18T01:39:33.873" Title="Particle filter Tracking" Tags="|kalman-filters|particle-filter|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16904" PostTypeId="1" CreationDate="2014-06-18T12:36:48.050" Score="1" ViewCount="429" Body="&lt;p&gt;I have seen that the SNR is measured for optical fibers &quot;OSNR&quot;. What is the difference? Is there any equivalent?&lt;/p&gt;&#xA;" OwnerUserId="10244" LastActivityDate="2014-06-18T12:36:48.050" Title="What is OSNR in Fiber Optics?" Tags="|noise|power-spectral-density|snr|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16905" PostTypeId="1" CreationDate="2014-06-18T13:28:58.813" Score="1" ViewCount="50" Body="&lt;p&gt;I have four sensors which make measurements $y_k(t)$ that can be modeled as complex time series:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_1(t) = h_1(t) * x(t) + n_1(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_2(t) = h_2(t) * x(t) + n_2(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_3(t) = h_3(t) * x(t) + n_3(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_4(t) = h_4(t) * x(t) + n_4(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in extracting the $n_k(t)$ signals; the $x(t)$ is a nuisance common mode signal that I don't care about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $n_k(t)$ signals are uncorrelated noisy signals. $x(t)$ is band limited. Looking at the coherence between a pair of signals, it seems the $h_k(t)$ are fairly benign and can probably be treated as a scaling factor and a delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like I can get reasonable separation of the power spectra by looking at&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S_{ii}-|S_{ij}|^2/S_{jj}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I computed $S_{ii}$ using matplotlib: &lt;code&gt;mlab.psd(y1)&lt;/code&gt; and $S_{ij}$ as &lt;code&gt;mlab.csd(y1,y2)&lt;/code&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd ideally like to recover the time domain $n_k(t)$ as best as I can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;G&lt;/p&gt;&#xA;" OwnerUserId="10245" LastEditorUserId="8202" LastEditDate="2014-06-18T14:25:06.210" LastActivityDate="2014-06-18T14:25:06.210" Title="variation of the source separation problem" Tags="|deconvolution|source-separation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16906" PostTypeId="1" CreationDate="2014-06-18T14:46:41.497" Score="0" ViewCount="111" Body="&lt;p&gt;I am using Erdas 2014 to run a 5x5 focal median filter on a batch of images (Raster Tab &gt; Spatial &gt; Focal Analysis (batch)). These images will eventually be resampled to a different pixel size, and therefore I do not want to spend the processing time calculating pyramids. How can I turn off pyramids while performing batch image processing in Erdas 2014?&lt;/p&gt;&#xA;" OwnerUserId="1562" LastActivityDate="2014-06-18T15:06:02.980" Title="How to turn off calculating pyramids during image processing?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16907" PostTypeId="2" ParentId="16906" CreationDate="2014-06-18T15:06:02.980" Score="1" Body="&lt;p&gt;Pyramids can be toggled on and off using the Erdas preferences: File &gt; Preferences &gt; File Formats &gt; Image Files (General).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xkuVt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1562" LastActivityDate="2014-06-18T15:06:02.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16908" PostTypeId="1" AcceptedAnswerId="16919" CreationDate="2014-06-18T15:35:15.750" Score="1" ViewCount="222" Body="&lt;p&gt;Making static 3D image is very simple - we just take image pair with something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W8XAI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then we can see 3D image by putting the left and right eye image side by side and crossing eyes or overlapping the images and using color filters for each eye. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;VR headsets (e.g. Oculus Rift) now allows seeing the 3D image directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However, I would like to incorporate slight movements and tilting of the head.&lt;/strong&gt; Of course, this would immediately spoil the 3D effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First idea for better capture is using more cameras (e.g. 2x2 or 3x3 array) to acquire necessary viewpoints (e.g. top and bottom camera is necessary to reconstruct 3D when viewed with head leaned on one side). But how to interpolate between these views based on shifted and rotated head pose? &lt;strong&gt;Is depth/3D reconstruction necessary or are there any computational photography techniques to generate appropriate left/right eye images (for a given viewpoint/pose)?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found various articles regarding depth reconstruction, 3D reconstruction and light fields, but nothing leads me toward the goal of interpolating the views.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, I am planning to create a panorama viewer for VR glasses (something like &lt;a href=&quot;http://krpano.com/stereo3d/&quot; rel=&quot;nofollow noreferrer&quot;&gt;krpano's web viewer&lt;/a&gt; supporting Oculus Rift). However, the viewer can account for limited head movements (pan, tilt) and the 3D impression does not hold for leaning, slight head shifts and correct for different eye-to-eye distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any pointing to appropriate articles will be appreciated, thanks!&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2014-07-19T05:04:11.020" Title="Beyond cross-eyed 3D (VR application)" Tags="|3d|reconstruction|stereo-vision|panorama|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16910" PostTypeId="1" CreationDate="2014-06-18T17:23:26.433" Score="-1" ViewCount="177" Body="&lt;p&gt;I am extremely new to signal analysis. And before posting I did a lot of reading on signal analysis, FFT and windowing. I am working on my thesis which involves comparison of speech signals lets say about 100 speech samples for a given sentence. I have the recordings and all the data. I have a few questions in order of what I think I should do.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I need to be able to separate noise from the signal. What parameters should I use for that? If I have to use a window function then what sort of window should I apply for that? Hanning, Kaiser or Rectangular.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What parameters should I look for to find out the similarities and the differences in the speech signals? Should I see the spectral densities, or the amplitudes and intensities?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sorry for being so naive, I'm a real noob here. I hope you can help me out and bear with me patiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For software I am using PRAAT and for noise removal I think Audacity would be good. I used a Sony voice recorder for recording the speech samples.&lt;/p&gt;&#xA;" OwnerUserId="10248" LastEditorUserId="8202" LastEditDate="2014-06-18T20:13:10.390" LastActivityDate="2014-06-18T23:03:35.310" Title="Parameters for signal analysis" Tags="|filters|signal-analysis|noise|speech|speech-processing|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="16911" PostTypeId="2" ParentId="16885" CreationDate="2014-06-18T17:54:59.650" Score="20" Body="&lt;p&gt;this is just an addendum to jojek's answer which is more general and perfectly good when double-precision math is used.  when there is less precision, there is a &quot;cosine problem&quot; that crops up when either the frequency in the frequency response is very low (much lower than Nyquist) and also when the resonant frequencies of the filter are very low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when you compute the magnitude (squared) frequency response $|H(e^{j\omega})|^2$ these complex exponentials will be converted to sines and cosines, but when the math is cranked out, only the cosines will survive.  this should be clear because the magnitude is an even function $|H(e^{-j\omega})| = |H(e^{j\omega})|$ w.r.t. frequency and only the cosines are even functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;consider this trig identity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \cos(\omega) \ = \ 1 - 2 \sin^2 \left( \frac{\omega}{2} \right)  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, looking at the right-hand side of the equation, all of the information regarding frequency is in the $ \sin^2 \left( \frac{\omega}{2} \right) $ term which is being subtracted from 1.  and this term gets exceedingly small as $\omega \to 0$.  so small that the term and the frequency information in that term are getting lost when the term (or it's negative) are added to 1.  this is the case even with floating point, but is less a problem with double-precision floats.  but some of us putting this frequency response function into gear might not have the resource of double-precision floating point, or any floating point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, what i have done is use the trig identity above and eliminate all of the cosine terms, essentially replacing them with terms looking like $\sin^2 \left( \frac{\omega}{2} \right)$ and some constants that get combined with other constants.  i'll show you the answer for the case of a 2nd-order IIR filter (a.k.a. a &quot;biquad&quot;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2}}{a_0 + a_1 z^{-1} + a_2 z^{-2}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has complex frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(e^{j\omega}) = \frac{b_0 + b_1 e^{-j\omega} + b_2 e^{-j2\omega}}{a_0 + a_1 e^{-j\omega} + a_2 e^{-j2\omega}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has magnitude squared:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;|H(e^{j\omega})|^2 &amp;amp;= \frac{|b_0 + b_1 e^{-j\omega} + b_2 e^{-j2\omega}|^2}{|a_0 + a_1 e^{-j\omega} + a_2 e^{-j2\omega}|^2}  \\&#xA;\\&#xA;&amp;amp;= \frac{\big(b_0 + b_1\cos(\omega) + b_2\cos(2\omega)\big)^2 + \big(b_1\sin(\omega) + b_2\sin(2\omega)\big)^2}{\big(a_0 + a_1\cos(\omega) + a_2\cos(2\omega)\big)^2 + \big(a_1\sin(\omega) + a_2\sin(2\omega)\big)^2}  \\&#xA;\\&#xA;&amp;amp;= \frac{b_0^2+b_1^2+b_2^2 + 2b_1(b_0+b_2)\cos(\omega) + 2b_0b_2\cos(2\omega)}{a_0^2+a_1^2+a_2^2 + 2a_1(a_0+a_2)\cos(\omega) + 2a_0a_2\cos(2\omega)}  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, one can see that the magnitude frequency response $|H(e^{j\omega})|$ is an even symmetry function and depends only on the cosines $\cos(\omega)$ and $\cos(2\omega)$.  for very low $\omega$, the values of those cosines are so close to $1$ that, with single-precision fixed &lt;strong&gt;or&lt;/strong&gt; floating point, there are few bits remaining that differentiate those values from $1$.  that is the &lt;strong&gt;&quot;cosine problem&quot;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using the trig identity above, you get for magnitude squared:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;|H(e^{j\omega})|^2 &amp;amp;= \frac{b_0^2+b_1^2+b_2^2 + 2b_1(b_0+b_2)\cos(\omega) + 2b_0b_2\cos(2\omega)}{a_0^2+a_1^2+a_2^2 + 2a_1(a_0+a_2)\cos(\omega) + 2a_0a_2\cos(2\omega)}  \\&#xA;\\&#xA;&amp;amp;= \frac{b_0^2+b_1^2+b_2^2 + 2b_1(b_0+b_2)\left(1 - 2 \sin^2 \left( \tfrac{\omega}{2}\right)\right) + 2b_0b_2\left(1 - 2 \sin^2(\omega)\right)}{a_0^2+a_1^2+a_2^2 + 2a_1(a_0+a_2)\left(1 - 2 \sin^2 \left( \tfrac{\omega}{2}\right)\right) + 2a_0a_2\left(1 - 2 \sin^2(\omega)\right)}  \\&#xA;\\&#xA;&amp;amp;= \frac{b_0^2+b_1^2+b_2^2 + 2b_1(b_0+b_2)\left(1 - 2 \sin^2 \left( \tfrac{\omega}{2}\right)\right) + 2b_0b_2\left(2\cos^2(\omega) - 1\right)}{a_0^2+a_1^2+a_2^2 + 2a_1(a_0+a_2)\left(1 - 2 \sin^2 \left( \tfrac{\omega}{2}\right)\right) + 2a_0a_2\left(2\cos^2(\omega) - 1\right)}  \\&#xA;\\&#xA;&amp;amp;= \frac{b_0^2+b_1^2+b_2^2 + 2b_1(b_0+b_2)\left(1 - 2 \sin^2 \left( \tfrac{\omega}{2}\right)\right) + 2b_0b_2\left(2\left(1 - 2 \sin^2 \left( \tfrac{\omega}{2}\right)\right)^2 - 1\right)}{a_0^2+a_1^2+a_2^2 + 2a_1(a_0+a_2)\left(1 - 2 \sin^2 \left( \tfrac{\omega}{2}\right)\right) + 2a_0a_2\left(2\left(1 - 2 \sin^2 \left( \tfrac{\omega}{2}\right)\right)^2 - 1\right)}  \\&#xA;\\&#xA;&amp;amp;= \frac{b_0^2+b_1^2+b_2^2 + 2b_1(b_0+b_2)(1 - 2\phi) + 2b_0b_2\left(2(1 - 2\phi )^2 - 1\right)}{a_0^2+a_1^2+a_2^2 + 2a_1(a_0+a_2)(1 - 2\phi) + 2a_0a_2\left(2(1 - 2\phi)^2 - 1\right)}  \\&#xA;\\&#xA;&amp;amp;= \frac{b_0^2+b_1^2+b_2^2 + 2b_1(b_0+b_2)(1 - 2\phi) + 2b_0b_2(1 - 8\phi + 8\phi^2)}{a_0^2+a_1^2+a_2^2 + 2a_1(a_0+a_2)(1 - 2\phi) + 2a_0a_2(1 - 8\phi + 8\phi^2)}  \\&#xA;\\&#xA;&amp;amp;= \frac{b_0^2+b_1^2+b_2^2 + 2b_1b_0+2b_1b_2 - 4(b_1b_0+b_1b_2)\phi + 2b_0b_2 - 16b_0b_2\phi + 16b_0b_2\phi^2}{a_0^2+a_1^2+a_2^2 + 2a_1a_0+2a_1a_2 - 4(a_1a_0+a_1a_2)\phi + 2a_0a_2 - 16a_0a_2\phi + 16a_0a_2\phi^2}  \\&#xA;\\&#xA;&amp;amp;= \frac{\big(b_0^2+b_1^2+b_2^2 + 2b_1b_0+2b_1b_2+2b_0b_2\big) - 4(b_1b_0+b_1b_2-4b_0b_2)\phi + 16b_0b_2\phi^2}{\big(a_0^2+a_1^2+a_2^2 + 2a_1a_0+2a_1a_2+2a_0a_2\big) - 4(a_1a_0+a_1a_2-4a_0a_2)\phi + 16a_0a_2\phi^2}  \\&#xA;\\&#xA;&amp;amp;= \frac{\tfrac14\big(b_0^2+b_1^2+b_2^2 + 2b_1b_0+2b_1b_2+2b_0b_2\big) - (b_1b_0+b_1b_2-4b_0b_2)\phi + 4b_0b_2\phi^2}{\tfrac14\big(a_0^2+a_1^2+a_2^2 + 2a_1a_0+2a_1a_2+2a_0a_2\big) - (a_1a_0+a_1a_2-4a_0a_2)\phi + 4a_0a_2\phi^2}  \\&#xA;\\&#xA;&amp;amp;= \frac{\left(\frac{b_0+b_1+b_2}{2}\right)^2 - \phi \big(4b_0b_2(1-\phi) + b_1(b_0+b_2)\big)}{\left(\frac{a_0+a_1+a_2}{2}\right)^2 - \phi \big(4a_0a_2(1-\phi) + a_1(a_0+a_2)\big)}  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ \phi \triangleq \sin^2 \left( \frac{\omega}{2} \right) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if your gear is intending to plot this as dB, it comes out as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 20 \log_{10}|H(e^{j\omega})| \ = \ 10 \log_{10}\left( \left(\tfrac{b_0+b_1+b_2}{2}\right)^2 - \phi \big(4b_0b_2(1-\phi) + b_1(b_0+b_2)\big) \right) \\ - 10 \log_{10}\left(\left(\tfrac{a_0+a_1+a_2}{2}\right)^2 - \phi \big(4a_0a_2(1-\phi) + a_1(a_0+a_2)\big) \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so your division turns into subtraction, but you have to be able to compute logarithms to some base or another.  numerically, you will have much less trouble with this for low frequencies than doing it the apparent way.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2018-04-27T21:13:54.790" LastActivityDate="2018-04-27T21:13:54.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16912" PostTypeId="1" CreationDate="2014-06-18T19:48:51.933" Score="1" ViewCount="97" Body="&lt;p&gt;I know that the phase spectrum contains most of the structural information about the image&#xA;&lt;a href=&quot;http://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0CB0QFjAA&amp;amp;url=http://ieeexplore.ieee.org/iel5/5/31301/01456290.pdf?arnumber=1456290&amp;amp;ei=g-yhU77QMcq9uAS594C4Dg&amp;amp;usg=AFQjCNFn2y9YtbbhQTDF3qDQvFi3P71HyA&amp;amp;sig2=WgPIBUhEGv2UJie2rEDQ-Q&amp;amp;bvm=bv.69137298,d.c2E&quot; rel=&quot;nofollow&quot;&gt;importance of phase&lt;/a&gt;. But I want to know more about importance of phase spectrum related to video signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read that temporal variations of phase values are able to capture most of the dynamical characteristics of the video sequence like global motion in the video &lt;a href=&quot;http://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0CCIQFjAA&amp;amp;url=http://vision.ai.illinois.edu/publications/iccv2007_bghanem_ahuja_dynamictexture.pdf&amp;amp;ei=pe6hU_7LGdG6uASf-YCYBw&amp;amp;usg=AFQjCNHSM76jvsVZoUpFKWdjZ-iCygp8LA&amp;amp;sig2=sFo0Ri5e-t4I0SiRmfdkyQ&amp;amp;bvm=bv.69137298,d.c2E&quot; rel=&quot;nofollow&quot;&gt;phase based modelling&lt;/a&gt;, but I don't understand how it does?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please consider any real time example say video of rotating wheel or wave (or video of traffic on road) if I compute its phase spectrum using Fourier Transform, the phase values captures motion of rotating wheel (or complex motion of moving car on road), but I don't understand how it does? By which property of Fourier transform could anybody can explain it to me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also can anybody explain the mathematical relation between motion and phase? Please correct  if I am getting wrong.&lt;/p&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="9035" LastEditDate="2014-06-20T08:37:47.950" LastActivityDate="2014-06-20T08:37:47.950" Title="How are phase values able to capture motion from video?" Tags="|image-processing|matlab|fourier-transform|frequency-spectrum|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16913" PostTypeId="1" AcceptedAnswerId="17052" CreationDate="2014-06-18T20:01:16.837" Score="0" ViewCount="86" Body="&lt;p&gt;I am wondering the detail of the filtered backprojection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a projection file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p(s,\theta)$=&lt;code&gt;[1 2 3 1 2]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then to get its filtered backprojection version using ramp filter, I should &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;apply FFT to it, to get its Fourier version $P(\omega,\theta)$&lt;/li&gt;&#xA;&lt;li&gt;To use |$\omega$| to multiply $P(\omega,\theta)$&lt;/li&gt;&#xA;&lt;li&gt;Backprojection&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am a little confused at second step here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the numeric example above, to apply FFT to &lt;code&gt;[1 2 3 1 2]&lt;/code&gt;, we will get a complex sequence&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   9.0000 + 0.0000i &#xA;  -1.0000 - 1.1756i&#xA;  -1.0000 + 1.9021i&#xA;  -1.0000 - 1.9021i&#xA;  -1.0000 + 1.1756i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should I apply |$\omega$| to both real and complex part  of the sequence above, then do inverse FFT? Or should I only take the magnitude of above sequence, apply |$\omega$| to the magnitude, then do inverse FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, it seems I will get a complex sequence as the final results, but shouldn't the filtered projection be a real sequence? Anyone give me some pointers here? Thanks&lt;/p&gt;&#xA;" OwnerUserId="10249" LastActivityDate="2014-06-25T21:39:45.427" Title="Filtered backprojection implementatoin" Tags="|filters|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16914" PostTypeId="1" AcceptedAnswerId="16916" CreationDate="2014-06-18T20:09:04.180" Score="2" ViewCount="243" Body="&lt;p&gt;What is the best possible runtime for extracting SIFT keypoints and Descriptors?&lt;br&gt;&#xA;I know it depends on #keypoints extracted. So, say for image of size 640x640, the code that I have been using requires around 3 seconds for description of ~2000 keypoints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best runtime achieved and how (on similar grounds)? How can I make it run in realtime?&lt;br&gt;&#xA;Is hadoop with 100 clusters a solution?&lt;/p&gt;&#xA;" OwnerUserId="7904" LastActivityDate="2014-06-18T23:33:19.547" Title="Can SIFT run in realtime?" Tags="|image-processing|local-features|sift|real-time|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16915" PostTypeId="2" ParentId="16910" CreationDate="2014-06-18T23:03:35.310" Score="-1" Body="&lt;p&gt;&lt;strong&gt;Noise removal&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should use a Gaussian convolution filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Similarities in signal&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally this is done by spectrum analysis - like a Fourier transform. get the DTFT of say every second or half-second (you will need to experiment with window size to get best results) and then match that to a database of Fourier transforms for your reference sounds. You'll probably want to pull out frequencies with the highest amplitudes and make a histogram, which you can query your database to find the closest histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure, you could do parts of this with Audacity or other software, but if you want to learn more about DSP i suggest you use Matlab or Python+numpy/scipy to code the processing yourself! It will be a lot more flexible, maybe frustrating at times, but I highly recommend it.&lt;/p&gt;&#xA;" OwnerUserId="10250" LastActivityDate="2014-06-18T23:03:35.310" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16916" PostTypeId="2" ParentId="16914" CreationDate="2014-06-18T23:33:19.547" Score="0" Body="&lt;p&gt;SIFT implemented on a GPU can run in realtime!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cs.unc.edu/~ccwu/siftgpu/&quot; rel=&quot;nofollow&quot;&gt;http://cs.unc.edu/~ccwu/siftgpu/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10250" LastActivityDate="2014-06-18T23:33:19.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16917" PostTypeId="2" ParentId="16881" CreationDate="2014-06-18T23:48:24.620" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, the center pixel and focal length in pixels will change, as described in the link above. However, if you learn distortion parameters (radial and tangential) then they shouldn't change as resolution changes because they operate on the projective image plane (before multiplying by camera matrix) instead of pixel coordinates (after multiplying by camera matrix). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Size of pixel (if i understand you correctly) will depend on the distance of the object at that pixel, and the camera field of view. In some cameras, pixels are not exactly square, but that will be determined by camera calibration. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For instance, if you're viewing a plane at 1m away, and your camera has a horizontal field of view of 57.5 degrees, you can use the tangent function to find the total width of the image at that distance, and then divide by resolution to find pixel width (say, 640) :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ &#xA;\frac{distance \times 2 \times tan(\frac{\theta}{2}) } {horizontal resolution} = \frac{1m\times 2\times tan(\frac{57.5}{2}) } {640px} = 0.0016m/px = 1.6mm/px&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3.This could be caused by not knowing the exact distance from the camera, which will have a huge effect on any measurements you're trying to get out of pixel coordinates. &lt;/p&gt;&#xA;" OwnerUserId="10250" LastActivityDate="2014-06-18T23:48:24.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16918" PostTypeId="1" CreationDate="2014-06-19T00:54:54.593" Score="2" ViewCount="1150" Body="&lt;p&gt;I'm trying to increase the pitch of a wav file using MATLAB. (I don't expect it to sound very good, but I'm trying to figure out how wavelets in MATLAB work.) Here's what I'm doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;scales = {2.34375,0.5,21};&#xA;result = cwtft(b5,'scales',scales);&#xA;result.scales = 2*scales;&#xA;b5high = icwtft(result);&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(&lt;code&gt;b5&lt;/code&gt; is just the opening of Beethoven's Fifth, but it could be any sound file. It happens to have a sample rate of 48 kHz.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To my thinking, I'm doing a wavelet transform of &lt;code&gt;b5&lt;/code&gt; using a Morlet wavelet. The scales that I'm using capture the human-audible frequencies for a 48-kHz signal. I then double the scales vector--resulting in a shift upward of 1 octave, and then convert back into a signal. However, when I play &lt;code&gt;b5high&lt;/code&gt;, it sounds exactly like &lt;code&gt;b5&lt;/code&gt; - no pitch shifting at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's wrong with my logic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10251" LastEditorUserId="8202" LastEditDate="2014-06-19T09:31:49.407" LastActivityDate="2014-06-23T15:58:54.040" Title="How do you change pitch with wavelet transforms in MATLAB?" Tags="|matlab|audio|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16919" PostTypeId="2" ParentId="16908" CreationDate="2014-06-19T03:33:13.577" Score="0" Body="&lt;p&gt;I have finally found a great overview video on the topic from Richard Szeliski: &quot;&lt;a href=&quot;http://youtu.be/j90_0Ndk7XM&quot; rel=&quot;nofollow&quot;&gt;Reflections of Image-Based Modelling and Rendering&lt;/a&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The research started with stereo and depth estimation. The depth map can be used to &quot;warp&quot; image in 3D to give it some perceived depth. This does not create parallax effects though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach called &lt;strong&gt;Layered Depth Images&lt;/strong&gt; used segmentation to several depth layers each having its own depth map. This allows parallax effect to occur, but extra care must be taken to matte foreground and background layers during rendering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fast 3D reconstruction of the sorrounding is possible using primitives (boxes, cylinders) matched to scene points. The 3D reconstruction is tedious and requires many images and extensive walk around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, more image-based (rather than geometry-based) approach are presented, which are &lt;strong&gt;Lumigraphs&lt;/strong&gt; and &lt;strong&gt;Light Fields&lt;/strong&gt;. These allow some level of reconstruction of the plenoptic function and solve for rays crossing given viewing plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, &lt;strong&gt;Concentric Mosaics&lt;/strong&gt; is the no. 1 solution I have been looking for. A camera travelling around circle (tangential direction) is able to capture 3D plenoptic function of the scene. Each point thus can be viewed from different angles and the viewer can move inside the circle, see parallax, reflections, transparency and occlussion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extension is possible by adding support for rays in vertical direction - this will lead to capturing 4D plenoptic function from a camera moving on sphere (tangetial direction) or by using a spherical rig of many cameras.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further advances in the field are expected with the introduction of plenoptic cameras (e.g. Lytro) that can capture the 4D plenoptic function directly. Some work on making plenoptic mosaics is already there (e.g. &quot;&lt;a href=&quot;http://www.jku.at/cg/content/e152197/e155483/PLFI.pdf&quot; rel=&quot;nofollow&quot;&gt;Panorama Light Field Imaging&lt;/a&gt;&quot;).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2014-06-19T03:33:13.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16921" PostTypeId="1" AcceptedAnswerId="16925" CreationDate="2014-06-19T04:24:48.613" Score="-2" ViewCount="76" Body="&lt;p&gt;I have an exercise in DSP. I learnt about discrete filter but I don't know how to apply it to produce an output from an input signal. Please guide me to do this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Assume fundamental sample time is 1 and Step time is 1, the result of&#xA;  output at time 5 is?&#xA;  &lt;img src=&quot;https://i.stack.imgur.com/mQCdm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="10254" LastActivityDate="2014-06-19T16:13:21.303" Title="Applying Discrete Filters" Tags="|filters|filter-design|dft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16924" PostTypeId="2" ParentId="16912" CreationDate="2014-06-19T07:41:52.577" Score="1" Body="&lt;p&gt;If you move an impulse in the spatial domain (perhaps representing a pixel on some object in a scene), the unwrapped phase of all the spectra associated with that point will be rotated in the frequency domain by an amount proportional to the distance of the move and the frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-19T07:41:52.577" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16925" PostTypeId="2" ParentId="16921" CreationDate="2014-06-19T08:37:33.547" Score="2" Body="&lt;p&gt;Assuming that you have knowledge of DSP you claim, it is a very simple task. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all convert the difference block into proper filter representation (negative powers of $z$ reflect delay of samples), simply divide it by $z$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dfrac{z-1}{z}=\dfrac{\frac{z}{z}-\frac{1}{z}}{\frac{z}{z}}=\boxed{\dfrac{1-z^{-1}}{1}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we have two filter blocks connected one after another, thus the transfer functions have to be multiplied to obtain general transfer function $H(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\dfrac{Y(z)}{X(z)}=\dfrac{1-z^{-1}}{1} \cdot \dfrac{1}{1+z^{-2}}=\boxed{\dfrac{1-z^{-1}}{1+z^{-2}}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having the transfer function of our IIR filter, we can convert back to difference equation, let's multiply both sides of the above equation and use the time-shifting property of the Z-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)\left(1+z^{-2}\right)=X(z)\left( 1-z^{-1}\right)$$&#xA;$$Y(z)+Y(z)z^{-2}=X(z)-X(z)z^{-1}$$&#xA;$$y[n]+y[n-2]=x[n]-x[n-1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus our difference equation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\boxed{y[n]=x[n]-x[n-1]-y[n-2]}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can now calculate signal samples of our system, input signal is the unit step. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Simulink note:&lt;/strong&gt; As far as I remember Simulink by default is using unit step that is one for $n=1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u[n]=&#xA;\begin{cases}&#xA;0 &amp;amp; n \le 0 \\&#xA;1 &amp;amp; n &amp;gt; 0&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of people, including me prefer definition when $u[n]$ has non-zero sample at $n=0$. Obviously you can very easily change it with the initial value, but let me stick to the default behaviour, because you didn't provided enough informations about your simulation to make it 100% repeatable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/r9EFY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Calculation of samples is straightforward while having difference equation, but let's do it for completion sake. Here it comes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;y[0]=&amp;amp;0-0-0=\color{blue}{0} \\&#xA;y[1]=&amp;amp;1-0-0=\color{red}{1} \\&#xA;y[2]=&amp;amp;1-1-\color{blue}{0}=\color{cyan}{0} \\&#xA;y[3]=&amp;amp;1-1-\color{red}{1}=\color{magenta}{-1} \\&#xA;y[4]=&amp;amp;1-1-\color{cyan}{0}=0 \\&#xA;y[5]=&amp;amp;1-1-(\color{magenta}{-1})=\boxed{1} \\&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that's your solution, voila!&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-19T16:13:21.303" LastActivityDate="2014-06-19T16:13:21.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16930" PostTypeId="1" AcceptedAnswerId="16935" CreationDate="2014-06-19T13:43:20.563" Score="2" ViewCount="83" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2IRdF.png&quot; alt=&quot;enter imdfgxhgfhfghgfhfff here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wAg0Q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n9Ruw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now K(s) is obviously the negative feedback loop which is ${H(s) \over 1+H(s)G(s)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I substitute ${H(s) = {1 \over s-2}}$ I get  K(s) = ${ 1 \over s-2 +G(s) }$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the system to be stable I know that the poles have to be on the negative half of th imaginary plane. Not sure how to find G(s). &lt;/p&gt;&#xA;" OwnerUserId="10258" LastActivityDate="2014-06-19T16:31:06.010" Title="Stability of transfer function" Tags="|homework|transfer-function|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16931" PostTypeId="1" CreationDate="2014-06-19T15:17:10.230" Score="1" ViewCount="204" Body="&lt;p&gt;If I'm given a autocorrelation matrix of a WSS process what interpretation should I put on the resulting vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More concretely the matrix takes the form &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{bmatrix} x_1 &amp;amp; x_2 &amp;amp; \ldots &amp;amp; x_n \\ x_2 &amp;amp; x_1 &amp;amp; \ldots &amp;amp; x_{n-1} \\ \ldots &amp;amp; \\ x_n &amp;amp; x_2 &amp;amp; \ldots &amp;amp; x_1 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I multiply it with a vector defined on the same space, what interpretation should I give $y = Mv$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, any matrix which has constant diagonals is ok for my purposes. So circular matrices are ok. I.e the matrix could describe the circular autocorrelation function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the rvs $\{X_i\}$ could be independent Gaussian on $\mathbb{R}^n$, with $v$ being some vector of length n in $\mathbb{R}^n$ also.&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="805" LastEditDate="2014-06-19T17:08:50.097" LastActivityDate="2014-06-19T17:08:50.097" Title="The autocorrelation of a WSS process as a linear operator" Tags="|autocorrelation|statistics|stationary|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16933" PostTypeId="1" AcceptedAnswerId="17084" CreationDate="2014-06-19T16:17:57.387" Score="0" ViewCount="306" Body="&lt;p&gt;I couldn't figure out below paragraph on SURF paper and hope that someone can help me to understand it. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;ftp://ftp.vision.ee.ethz.ch/publications/articles/eth_biwi_00517.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Bay H., Ess A., Tuytelaars T. Van Gool L. - &lt;em&gt;Speed-Up Robust Features&#xA;  (SURF)&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;, page 4, column 2&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The large scale changes, especially between the first filter within these octaves (from 9 to 15 is a change of 1:7),&#xA;  renders the sampling of scales quite crude. Therefore, we&#xA;  have also implemented a scale space with a finer sampling&#xA;  of the scales. This first doubles the size of the image, using&#xA;  linear interpolation, and then starts the first octave by filtering with a filter of size 15. Additional filter sizes are 21,&#xA;  27, 33, and 39. Then a second octave starts, again using filter which now increase their sizes by 12 pixels, after which&#xA;  a third and fourth octave follow. Now the scale change be-&#xA;  tween the first two filter is only 1.4 (21/15). The lowest&#xA;  scale for the accurate version that can be detected through&#xA;  quadratic interpolation is s = (1.2(18/9)/2)=1.2.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;is that mean they used two different scale space at same time or they used each one individually and choose the one with better result?&lt;/p&gt;&#xA;" OwnerUserId="8956" LastEditorUserId="8956" LastEditDate="2014-06-20T08:03:22.800" LastActivityDate="2014-06-27T13:40:35.733" Title="Is there two Types of Scale Space in SURF algorithm?" Tags="|image-processing|filters|sift|octave|scale-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16935" PostTypeId="2" ParentId="16930" CreationDate="2014-06-19T16:31:06.010" Score="1" Body="&lt;p&gt;Hint:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $K(s) = \frac{1}{s-2+G(s)}$, then the roots of $s-2+G(s)$ must lie on the left side of the complex plane. Let's suppose that $G(s)$ is of the form $as + b$. Can you solve it then?&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-06-19T16:31:06.010" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16936" PostTypeId="1" CreationDate="2014-06-19T16:56:28.040" Score="0" ViewCount="62" Body="&lt;p&gt;I am trying to implement particle filter to track a car bounded by a box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First i used color histogram as my likelihood function and implemented PF, where i was using the bhattacharya distance to get weights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Later I used motion technique, In which i am subtracting the  consecutive images, and then finding the contour in the image, which will be the object to be tracked(Camera is static), and I am using the gaussian distribution as the likelihood function to get weights and I have applied PF to it. Now I want to fuse both the techniques in one and use Particle filter . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i do it? I tried to search online, But I couldn't find any nice explanation or material.&lt;/p&gt;&#xA;" OwnerUserId="10197" LastActivityDate="2014-06-20T08:00:33.167" Title="Fusing motion and color in particle filter" Tags="|image-processing|estimation|visual-tracking|particle-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16937" PostTypeId="1" CreationDate="2014-06-19T16:59:55.703" Score="4" ViewCount="6896" Body="&lt;p&gt;I have some input and output data that I believe adequately includes excitation of the important dynamics of a system. I know it is at most a 4th-order transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I identify the transfer function? I have Python available. (I have MATLAB but do not have access to the System ID Toolbox and need to limit my dependencies on MATLAB)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to do least-squares fits, but I have no idea how to apply the idea to transfer functions, where using the absolute error in the transfer function doesn't make sense (relative error seems to be the appropriate thing to fit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm vaguely familiar with ARX/ARMA/ARMAX approaches but they always seem to overemphasize the high-frequency response, because they solve for the impulse response.&lt;/p&gt;&#xA;" OwnerUserId="829" LastActivityDate="2014-06-20T04:45:48.243" Title="Transfer function determination from input and output data" Tags="|python|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16938" PostTypeId="1" AcceptedAnswerId="16944" CreationDate="2014-06-19T18:20:11.950" Score="2" ViewCount="299" Body="&lt;p&gt;I have a 3D object which I have segmented and represented as a 3D binary array. I need to find the longest line which fits inside of the object in three dimensional space. What would be an efficient method I could use to approach this problem.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The following is an example of what I am trying to do but in 2 dimensions. The black part of the image is the background and the white is a segmented object. The red line is the longest line which can be drawn inside the object. I would like to find the length of this line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DKn2W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could do this by calculating the distance between each pair of two points on the surface of the object and taking the longest distance as my result, but this seems horribly inefficient particularity when solving the problem in 3 dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to solve this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10182" LastEditorUserId="10182" LastEditDate="2014-06-19T21:47:53.533" LastActivityDate="2014-06-19T22:33:30.330" Title="Longest line inside of 3D object" Tags="|image-processing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16939" PostTypeId="1" CreationDate="2014-06-19T19:13:41.153" Score="22" ViewCount="2602" Body="&lt;p&gt;I don't know what to call these images, but they're very often used in the image processing world as standard examples to show the output of a particular operation. &lt;a href=&quot;http://en.wikipedia.org/wiki/Lenna&quot;&gt;Here's a link to the page describing Lena as a &quot;standard test image&quot;&lt;/a&gt;. Are there similar canonical audio clips used to demonstrate the effects of certain audio filters or operations?&lt;/p&gt;&#xA;" OwnerUserId="10263" LastEditorUserId="10263" LastEditDate="2014-06-19T19:21:19.143" LastActivityDate="2015-06-26T15:38:16.290" Title="What are the audio equivalents of images like &quot;Lena&quot;, &quot;Mandrill&quot;, and &quot;Cameraman&quot;?" Tags="|image-processing|audio|sound|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16940" PostTypeId="2" ParentId="16939" CreationDate="2014-06-19T19:34:04.247" Score="17" Body="&lt;p&gt;The closest example I can think of is the beginning of Suzanne Vega's &lt;a href=&quot;http://mentalfloss.com/article/19727/how-toms-diner-tuned-mp3&quot;&gt;&quot;Tom's Diner&quot;&lt;/a&gt; which has been used for the mpeg-1 layer 3 development, and is still occasionally used to demo audio codecs.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-06-19T19:34:04.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16941" PostTypeId="1" AcceptedAnswerId="16945" CreationDate="2014-06-19T20:10:52.367" Score="0" ViewCount="232" Body="&lt;p&gt;I see these terms everyday in every lecture, I do read stuff from wikipedia, follow lecture notes, study solved exercises. All in all I do have a rough idea about these, I know a little from everything, but the picture is not complete, far from complete, I would like to understand all of them and improve myself because in 2 weeks I will have an exam, is there a website which you can suggest, describing these very well? Animations would be great, I'm clueless from where shall I start and how do I close all these gaps :(&lt;/p&gt;&#xA;" OwnerUserId="8888" LastActivityDate="2014-06-19T22:59:41.550" Title="Understanding IIR , Low Pass, High Pass, Chebyshev, Elliptic Filter?" Tags="|fft|dft|lowpass-filter|infinite-impulse-response|finite-impulse-response|" AnswerCount="1" CommentCount="0" ClosedDate="2014-06-20T01:00:32.857" ContentLicense="CC BY-SA 3.0" />
  <row Id="16942" PostTypeId="2" ParentId="16939" CreationDate="2014-06-19T20:28:35.877" Score="16" Body="&lt;p&gt;Audio processing is a large field, but specifically in speech processing, an open database of samples known as &lt;a href=&quot;http://en.wikipedia.org/wiki/Harvard_sentences&quot;&gt;Harvard Sentences&lt;/a&gt; is widely used. Harvard sentences are phonetically balanced collections of sentences in American English. Many equivalent databases exist for other languages as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actual files with Harvard Sentences speech can be found &lt;a href=&quot;http://www.voiptroubleshooter.com/open_speech/american.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-06-19T20:28:35.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16943" PostTypeId="1" CreationDate="2014-06-19T20:53:20.597" Score="1" ViewCount="593" Body="&lt;p&gt;For a signal that is not corrupted with noise, how is the time-bandwidth product affecting the uncertainty or error introduced when extracting the fundamental frequency ? I mean, instead of choosing the fundamental frequency of the signal at $f_0$, you choose a harmonic $f_k$ at $k\cdot f_0$ and divide by $k$ to get $f_0$. How is the uncertainty related to $k$ for a given frequency resolution ?&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2015-09-22T20:55:33.807" LastActivityDate="2015-09-22T20:55:33.807" Title="Time-bandwidth product and uncertainty on harmonics" Tags="|frequency-spectrum|dft|bandwidth|resolution|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16944" PostTypeId="2" ParentId="16938" CreationDate="2014-06-19T22:33:30.330" Score="2" Body="&lt;p&gt;These are very computationally expensive problems and it also depends if your polygons are convex. Also in your case you don't have any extra constraints and it can be any line within. I think that the best read for you is the following publication:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.cs.bgu.ac.il/~matya/Papers/soda06.pdf&quot; rel=&quot;nofollow&quot;&gt;Hall-Holt O., et al. - &lt;em&gt;Finding large sticks and potatoes in polygons&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You will definitely find few algorithms among ones they described (computational complexities are given). Here is some brief presentation concerning their work: &lt;a href=&quot;http://www.compgeom.com/~piyush/talks/soda_06.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;click&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-19T22:33:30.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16945" PostTypeId="2" ParentId="16941" CreationDate="2014-06-19T22:59:41.550" Score="1" Body="&lt;p&gt;You did not posed any particular problems and asking for animations? I think that books are way better. We don't know what are your topics, but knowing you did all the studying and have two weeks so I suggest to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Do the &lt;a href=&quot;http://web.ece.rice.edu/richb/2013/08/18/elec301x-discrete-time-signals-and-systems-coming-in-january-2014-to-edx/&quot; rel=&quot;nofollow&quot;&gt;ELEC301x – Discrete Time Signals and Systems&lt;/a&gt; course from the Rice University. They do have a good part about design of digital filters, especially about differences between different topologies (including placement of zeros and poles), just &lt;a href=&quot;https://www.youtube.com/watch?v=JX2owQF3Cq8&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;watch&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Design few filters in MATLAB, do some filtering and try to understand their characteristics. &lt;code&gt;fvtool&lt;/code&gt; is great, especially if you want to visualize anything you need.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do the exams from past and if you feel confident then just go for a pint!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Read all the questions and answers on DSP SE regarding digital filters ;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Yep, and after typing into google &quot;digital filter applet&quot; for example you can get: &#xA;&lt;a href=&quot;http://ptolemy.eecs.berkeley.edu/java/Filter.html&quot; rel=&quot;nofollow&quot;&gt;link1&lt;/a&gt;, &lt;a href=&quot;http://iowahills.com/4IIRFilterPage.html&quot; rel=&quot;nofollow&quot;&gt;link2&lt;/a&gt;, &lt;a href=&quot;http://t-filter.appspot.com/fir/index.html&quot; rel=&quot;nofollow&quot;&gt;link3&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-19T22:59:41.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16946" PostTypeId="2" ParentId="16943" CreationDate="2014-06-20T01:02:11.613" Score="2" Body="&lt;p&gt;If you a-priori assume that $k \cdot f$ is a stationary harmonic of periodic waveform of frequency $f$, that implies that you don't have any separable time locality of that harmonic.  But any tighter bandwidth of a frequency estimation might come from the a-priori assumptions regarding the stationarity of the harmonics, not from the data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="1629" LastEditDate="2014-06-20T13:35:06.847" LastActivityDate="2014-06-20T13:35:06.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16947" PostTypeId="2" ParentId="1195" CreationDate="2014-06-20T03:30:15.280" Score="1" Body="&lt;p&gt;It depends on the type of noise and type of signal.  Show an example if you want a good answer.  But, that said, in general you probably want to low-pass filter the signal.  If I were you, I'd take a Fourier power spectrum to see if most of the noise is high frequency, and the signal I care about mostly in a lower range.  If they overlap, oh well that's life. I would have to think more about things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One low-pass filter that's good for noisy signal in many cases is the Savitzky-Golay filter.  It is described in Numerical Recipes, and for Python there's a function in the Python Numpy Cookbook.  It is merely a convolution with a small kernel.   You pick the window size based on the width of the peaks or other features, wide enough to mush out the noise, but not wider than the features.  It can be small, say five points, or bigger like dozens, a hundred maybe.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also pick a polynomial order - usually I use 2 or 4.  Order 2 is fine for when the window is small, &amp;lt; 10 points or it spans less than half a cycle or so (if your signal resembles a sine) while order 4 is better at matching distorted peak shapes, but likes to have around 9 or more points.  But a lot depends on the shape and frequency of the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As other say in the comments, finding derivatives probably isn't the best strategy, but if you want find derivatives anyway, the Savitzky-Golay filter can do that - simultaneously smoothing and reporting the derivative instead of the signal.   &lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2014-06-20T03:30:15.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16948" PostTypeId="2" ParentId="16937" CreationDate="2014-06-20T04:45:48.243" Score="2" Body="&lt;p&gt;if your input excitation signal (call it $x[n]$) is arbitrarily long and so also your output $y[n]$, then you should be able to take as long of block (let's call that length $N$) of each and, using the DFT and division compute&#xA;$$ H[k] = \frac{Y[k]}{X[k]} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in audio, we call that method of system identification the &quot;dual-channel FFT&quot;.  the DFT of $h[n]$ is equal to the the DTFT of $h[n]$ (wrapped-around and overlapped and added every $N$ samples) which is the Z-transform of the same wrapped (and aliased) $h[n]$ sampled at $N$ equally-spaced points around the unit circle.&#xA;$$ H(e^{j 2 \pi k/N}) = H[k]  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if your 4th-order IIR transfer function is&#xA;$$ G(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2} + b_3 z^{-3} + b_4 z^{-4}}{1 + a_1 z^{-1} + a_2 z^{-2} + a_3 z^{-3} + a_4 z^{-4}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what you want to do is choose $ \{ b_0, b_1, b_2, b_3, b_4, a_1, a_2, a_3, a_4 \} $ in such a way to minimize&#xA;$$ \sum_{k=0}^{N-1} \left| G(e^{j 2 \pi k/N}) - H(e^{j 2 \pi k/N}) \right|^2 \ = \  \sum_{k=0}^{N-1} \left| G(e^{j 2 \pi k/N}) - H[k] \right|^2 $$&#xA;or, perhaps a weighted version of that, &#xA;$$ \sum_{k=0}^{N-1} W[k] \left| G(e^{j 2 \pi k/N}) - H[k] \right|^2 $$&#xA;where $W[k]$ is known.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-06-20T04:45:48.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16949" PostTypeId="1" AcceptedAnswerId="16954" CreationDate="2014-06-20T06:11:48.493" Score="3" ViewCount="4213" Body="&lt;p&gt;I am trying to generate a band limited noise signal on a Raspberry Pi. I calculate samples at every 1/48000 sec on the Pi. If I generate normally distributed random numbers as data points at every sample would it be gaussian noise signal. Here is what i am having a hard time to understand, how to interpret the frequency of the noise signal. And also how to limit the frequency values to be between a band?&lt;/p&gt;&#xA;" OwnerUserId="10266" LastActivityDate="2014-06-20T09:14:52.570" Title="Digital Gaussian White noise signal generation in C++" Tags="|discrete-signals|noise|digital|random|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16950" PostTypeId="1" AcceptedAnswerId="16951" CreationDate="2014-06-20T07:35:17.153" Score="-1" ViewCount="94" Body="&lt;p&gt;In real time audio, one cannot program the way they usually do: with new delete or even &lt;code&gt;malloc&lt;/code&gt;: it introduces glitches when creating memories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By if I pass by value, a copy is made right, so let's suppose I pass a vector by value, its value will be copied, thus creating a memory thus it's forbidden with real-time audio?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have to pass the vector by reference and copy it using pre allocated buffers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is it safe to pass by value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="8202" LastEditDate="2014-06-20T17:00:34.440" LastActivityDate="2014-06-20T17:00:34.440" Title="Real-time audio : passing by value" Tags="|audio|" AnswerCount="2" CommentCount="0" ClosedDate="2015-03-04T09:02:34.137" ContentLicense="CC BY-SA 3.0" />
  <row Id="16951" PostTypeId="2" ParentId="16950" CreationDate="2014-06-20T07:43:35.760" Score="3" Body="&lt;p&gt;This is clearly a programming question, but to give you an answer...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;its value will be copied, thus creating a memory thus it's forbidden with real-time audio?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When you pass an argument by value, it is copied onto the stack, so there is no memory allocation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;so i have to pass the vector by reference and copy it using pre allocated buffers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Or write your code in a way that data can be safely passed by reference without having to be copied anywhere?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;safe to pass by value?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Safe but waste of resources.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-06-20T07:43:35.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16953" PostTypeId="2" ParentId="16936" CreationDate="2014-06-20T08:00:33.167" Score="1" Body="&lt;p&gt;If you can make the assumption that the two observations are independent then the the likelihood function you need is just the product of the two likelihood functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If for particle &lt;code&gt;x&lt;/code&gt;, the likelihood of it in terms of the colour distribution is &lt;code&gt;p(z_c|x)&lt;/code&gt; and the likelihood of it in terms of the motion contour is &lt;code&gt;p(z_m|x)&lt;/code&gt; then the likeliood of both observations combined is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; p(z|x)&#xA;=p(z_c,z_m|x)&#xA;=p(z_m|z_c,x)p(z_c|x)&#xA;=p(z_c|z_m,x)p(z_m|x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the assumption of independence this becomes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;=p(z_c|x)p(z_m|x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So just calculate the likelihoods as you have been doing and multiply them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would rather not make this assumption then you need to specify &lt;code&gt;p(z_m|z_c,x)&lt;/code&gt; or &lt;code&gt;p(z_c|z_m,x)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9138" LastActivityDate="2014-06-20T08:00:33.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16954" PostTypeId="2" ParentId="16949" CreationDate="2014-06-20T09:14:52.570" Score="2" Body="&lt;p&gt;If you are generating sample of white noise (Normal distribution value) with frequency of 48 kHz, then you already have this in frequency range of 0 - 24 kHz (at least you should if generator is truly random). If you use same samples with different sampling frequency, then they will also be a white noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you want to make it a band-limited white noise, then you must use a digital filter. Choice is up to you, but for sake of simplicity I would recommend FIR filter. You must use it to filter in real time your incoming samples. How to do it? Well, that's totally up to you, you can even use short buffer to perform filtering by linear convolution for each generated sample but it won't be very efficient. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-20T09:14:52.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16955" PostTypeId="1" AcceptedAnswerId="16966" CreationDate="2014-06-20T09:32:44.207" Score="3" ViewCount="117" Body="&lt;p&gt;Suppose you produce a pulse &lt;code&gt;x&lt;/code&gt; in discrete samples of duration &lt;code&gt;dt&lt;/code&gt; each (e.g. in Matlab) according to a function.&#xA;I was given some notes in which it shows that if I want it to let it have a specific power I have to first normalize it by doing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;energy = sum((x.^2).*dt) %first calculate the pulse energy&#xA;x = x./sqrt(energy) %normalize its energy to 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then you calculate the target energy&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;power = 0 %target power in dBm&#xA;power = (10^(power/10))/1000 %target power in W&#xA;energy = power*len(x)*dt %target energy of the pulse&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and finally you scale the pulse so that it has the target power&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = x .* sqrt(energy) %the pulse at the target power&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is, how does that really work? Why dividing &lt;code&gt;x&lt;/code&gt; by &lt;code&gt;sqrt(E)&lt;/code&gt; normalize it to unit energy? And why multiplying the resulting normalized &lt;code&gt;x&lt;/code&gt; by the new &lt;code&gt;sqrt(E)&lt;/code&gt; brings it to the target power? Why not just divide by &lt;code&gt;E&lt;/code&gt; for example? and then multiply by &lt;code&gt;E&lt;/code&gt;? Does it have any relation to RMS values? And finally is it something that can be used in any arbitrary pulses, e.g. in sinusoids as well?&lt;/p&gt;&#xA;" OwnerUserId="10271" LastActivityDate="2014-06-21T11:46:35.323" Title="Simulate a pulse of specific power" Tags="|matlab|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16956" PostTypeId="2" ParentId="16869" CreationDate="2014-06-20T09:56:04.967" Score="9" Body="&lt;p&gt;Your first order filter recursion for some real constants $a,b,c$ is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = a x[n] + b x[n-1] - c y[n-1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the two initial memory states $x[-1]$ and $y[-1]$ at $n=0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your &quot;no transient&quot; condition can be translated to $y[0]=0$ and a necessary second condition so that you can solve for both of your memory states. The second condition could be, that the discrete derivative of $y$ also vanishes at $n=0$, so $y[0]-y[-1]=0$. You can also take any other condition that seems sensible to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two equations give you a unique solution for the two unknown memories, namely:&#xA;$$y[-1] = 0$$&#xA; and &#xA;$$x[-1] = -\frac{a}{b}x[0] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, your conditions may better be chosen as $y[0]=0$ and $y[0]-y[-1]=x[0]-x[-1]$ in order to capture the initial slope of the input. The resulting recursion equation at $n=0$ is then&#xA;$$0=a x[0]+b x[-1]+c(x[0]-x[-1])$$&#xA;giving you the solution&#xA;$$x[-1]=-\frac{a+c}{b-c}x[0]$$&#xA;and&#xA;$$ y[-1]= -\left(1+\frac{a+c}{b-c}\right)x[0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please check my calculations!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in general you cannot expect a simple initial condition to give you the same result as knowing the signal history. So you can only take this to a certain point and in general it would probably be better if you just discarded the transient response of your output.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-06-20T09:56:04.967" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16957" PostTypeId="1" CreationDate="2014-06-20T12:46:29.977" Score="1" ViewCount="317" Body="&lt;p&gt;Basically I want the hand gesture recognition even when I have an object in hand by using a camera (MS Kinect) in front. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My fingers are not visible directly to the camera due to the object. For example if I could project some electromagnetic rays which can pass through the object but not through the hand so that I get some trace of hand in the image. Even using markers on the fingers can be an option. The material of the object can be plastic or something of this sort.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or reference material would be highly appreciated. Thanks&lt;/p&gt;&#xA;" OwnerUserId="10270" LastEditorUserId="8202" LastEditDate="2014-06-20T14:26:01.330" LastActivityDate="2014-08-21T09:48:45.517" Title="How to do Finger Tracking which is occluded by an object?" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16958" PostTypeId="1" AcceptedAnswerId="16960" CreationDate="2014-06-20T12:55:44.803" Score="1" ViewCount="290" Body="&lt;p&gt;I have a training set of 4000 for ML with 36 features, two-class classifier. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Consider that due to some discrepancy feature no. 25 is missing for half of the data. But during data acquisition I know what class it belongs to. &lt;/li&gt;&#xA;&lt;li&gt;I have defined a specified value (-1000) for that missing data. Other feature values are relatively smaller than -1000.&lt;/li&gt;&#xA;&lt;li&gt;If I train the data with the same data set, it might not train the&#xA;data with high accuracy. Can I somehow extrapolate the data to create&#xA;the data set that may be present (near-by values) or is it fine to&#xA;train the model with that data-set? (or any other suggestion).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10270" LastEditorUserId="20995" LastEditDate="2017-08-25T09:53:07.623" LastActivityDate="2017-08-25T09:53:07.623" Title="Missing Data in Machine Learning Classification" Tags="|classification|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16959" PostTypeId="2" ParentId="16950" CreationDate="2014-06-20T14:09:35.160" Score="3" Body="&lt;p&gt;If you pass audio data by value on the stack, a copy will still have to be made, as the parameters and local variables on the stack are transient (alive only during the time-limited subroutine set-up, call and/or callback).  So better to preallocate buffers, and pass them by reference, to avoid extra copies in and out of transient memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, sufficient stack growth could potentially invoke the OS virtual memory system, which might also add to real-time latency, so best to keep large amounts of data off the local variable and parameter stack.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In dynamic message passing languages, such as Objective C on iOS, it might also be necessary to avoid passing data using any object messages that might miss the message lookup cache inside real-time audio callback threads.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-06-20T14:18:17.860" LastActivityDate="2014-06-20T14:18:17.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16960" PostTypeId="2" ParentId="16958" CreationDate="2014-06-20T14:22:26.030" Score="3" Body="&lt;p&gt;Labelling a missing value as -1000 (assuming a non-missing value is much smaller in absolute value) will not cause problems with anything based on decision trees/stumps (bagged/boosted). You might also have some success with mixture models, for example a GMM - the learning algorithm will allocate some components to cover the missing data. Same for non-parametric density estimators, nearest neighbours, or SVM with RBF kernels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in all these cases, even if the model works, there will be a waste of resources (&quot;model space budget&quot;) if feature #25 is always present in your testing data. In other words, your model will have learnt how to deal with tricky examples that will never occur when classifying new data! But if feature #25 will sometimes be missing in some of the data you will encounter &quot;in the field&quot;, this is the way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do not expect things to work with algorithms such as neural networks or support vector machines with linear or low order polynomial kernels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If feature #25 will never be missing &quot;in the field&quot;, it might be simpler to just extrapolate feature 25 in your training data. To do so, you can proceed as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 1: Nearest neighbor&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Normalize all features (except #25).&lt;/li&gt;&#xA;&lt;li&gt;For each training example in which feature #25 is missing, search for the nearest training sample, according to features (1 .. 24 and 26 .. 36), for which feature #25 is present.&lt;/li&gt;&#xA;&lt;li&gt;Assign to feature #25 the value taken from the nearest neighbour.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Works best when you have lots of data (but not too much so as to make the search feasible) with kinky distributions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Option 2: Regression&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use any regression method of your choice to find a relation ship between feature #25 and the other features, on the subset of your dataset in which feature #25 is not missing. For example, a linear regression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the result to predict feature #25 on the remaining training instances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works best when your features are &quot;well behaved&quot; for the regression method you plan to use (for example, see the prerequisites for &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_regression#Assumptions&quot; rel=&quot;nofollow&quot;&gt;linear regression&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-06-20T14:22:26.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16961" PostTypeId="2" ParentId="16401" CreationDate="2014-06-20T15:56:09.473" Score="3" Body="&lt;p&gt;Pad image and smooth:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xzFbQ.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FKv3v.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make image of value 1 same size as original. Pad and smooth:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bZ7yO.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TvNd3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Divide original image by '1' image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6fL6D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And crop:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5Onl5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB demo code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = double(imread('lena.tif'));&#xA;g = fspecial('gaussian',60,10);&#xA;Ipad = padarray(I,[10,10]);&#xA;imagesc(Ipad); colormap gray(256); pause;&#xA;Ipadg = imfilter(Ipad,g);&#xA;imagesc(Ipadg); colormap gray(256); pause;&#xA;A = ones(size(I));&#xA;Apad = padarray(A,[10,10]);&#xA;imagesc(Apad); colormap gray(256); pause;&#xA;Apadg = imfilter(Apad,g);&#xA;imagesc(Apadg); colormap gray(256); pause;&#xA;IA = Ipadg./Apadg;&#xA;imagesc(IA); colormap gray(256); pause;&#xA;I = IA(11:end-10,11:end-10);&#xA;imagesc(I); colormap gray(256); pause;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;*Note: * MATLAB &lt;code&gt;imfilter&lt;/code&gt; already does zero padding. The pad array step is not needed, it is just for demonstration. Actual code would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = double(imread('lena.tif'));&#xA;g = fspecial('gaussian',60,10);&#xA;Ig = imfilter(I,g);&#xA;A = ones(size(I));&#xA;Ag = imfilter(A,g);;&#xA;Ismooth = Ig./Ag;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2014-06-21T03:44:20.357" LastActivityDate="2014-06-21T03:44:20.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16962" PostTypeId="1" AcceptedAnswerId="16973" CreationDate="2014-06-20T20:59:25.103" Score="3" ViewCount="2695" Body="&lt;p&gt;I'm struggling with a basic concept.  Suppose I have a system $y(t)=e^{-at}u(t)\ast x(t)$ and I want to plot impulse response and step response using Matlab conv() function at various sampling rates.  I'm having trouble understanding what gain I should apply and why.  I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = 0.05;&#xA;cutoffTime = 250;&#xA;T = 1/samplingRates(i);  %assume this is defined somewhere [1, 10, 20]&#xA;timeRange = 0:T:cutoffTime;&#xA;step = ones(1, length(timeRange));&#xA;impulse = zeros(1, length(timeRange));&#xA;impulse(1) = 1;&#xA;exponential = exp(-a*timeRange);&#xA;stepResponse = conv(exponential, step, 'full');  &#xA;impulseResponse = conv(exponential, step, 'full');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I understand that mathematically sampling is modeled as multiplication by a pulse train, which introduces gain of $1/T$ to the discrete system.  So the reconstruction filter needs gain of T.  In the above code, for different sampling rates (say 1, 10, 20 samples/second) if I don't apply the gain of T to step response, I get different sized step response.  However if I apply the gain T to impulse response, I don't get the impulse response I expect for all 3 sampling rates.  Can anyone clarify where I'm going wrong in my implementation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="10160" LastEditorUserId="10160" LastEditDate="2014-06-23T17:24:10.057" LastActivityDate="2014-06-24T22:42:03.293" Title="How to calculate step and impulse response at multiple sampling rates" Tags="|matlab|convolution|impulse-response|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16963" PostTypeId="2" ParentId="16962" CreationDate="2014-06-20T23:24:58.587" Score="4" Body="&lt;p&gt;This is not the full answer you want, but the problem is that you can't permute sampling and convolution. Let's say that the $D(\cdot)$ operator takes a continuous signal and returns its sampled version. What you're doing is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y'(n) = D\left(e^{-at}u(t)\right) * D\left(x(t)\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want to get is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D\left(y(t)\right) = D\left(e^{-at}u(t) * x(t)\right) \neq y'(n).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is in general impossible to do what you're trying to do, but I'm sure that good approximations exist. I'm not an expert on what they are or how to use them.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-06-20T23:24:58.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16964" PostTypeId="2" ParentId="16903" CreationDate="2014-06-21T09:03:26.527" Score="0" Body="&lt;p&gt;You should change these variables according to a relevant generative model.&#xA;In that case, this corresponds to the size of the car. Assuming cars having constant sizes this model should incorporate forinstance the laws of perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you describe your setting more precisely I could be more explicit.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2014-06-21T09:03:26.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16965" PostTypeId="2" ParentId="16939" CreationDate="2014-06-21T09:30:57.707" Score="5" Body="&lt;p&gt;I also think that NIST database is very popular when it comes to speech recognition tasks. In fact it is a standard for comparison of new algorithms and techniques during yearly challenges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally MATLAB's &lt;code&gt;load handel&lt;/code&gt; containing snippet of &lt;em&gt;G.F.Handel - Hallelujah&lt;/em&gt; is quite commonly used.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-03-12T09:29:24.697" LastActivityDate="2015-03-12T09:29:24.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16966" PostTypeId="2" ParentId="16955" CreationDate="2014-06-21T11:46:35.323" Score="1" Body="&lt;p&gt;Well, for a signal $x[k]$, the energy is:&#xA;\begin{equation}&#xA;E=dt*\sum_{k=-\infty}^{\infty}x^2[k]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want the energy to be one by dividing $x[k]$ through a value $a$, hence:&#xA;\begin{equation}&#xA;1=dt*\sum_{k=-\infty}^{\infty}(\frac{x}{a})^2[k]&#xA;\end{equation}&#xA;which by multiplying with $a^2$ becomes&#xA;\begin{equation}&#xA;a^2=dt*\sum_{k=-\infty}^{\infty}x^2[k]&#xA;\end{equation}&#xA;Comparing this to the first equation, it can be easily seen that $a^2=E$ and since $E$ is always positive, we can conclude $a=\sqrt{E}$. And that is why you divide by the square root of $E$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there it should be easy to see why multiplying this with $\sqrt{E'}$ makes a signal of energy $E'$.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-06-21T11:46:35.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16967" PostTypeId="2" ParentId="16444" CreationDate="2014-06-21T14:44:10.267" Score="0" Body="&lt;p&gt;Ok, apparently, it is not much different from an update of the mean, given the accumulated statistics (mode statistics). Basically, when the mean and the number of elements are known, the idf weights can be re-computed whenever a new element is inserted. This can be achieved in two ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Allocate your tree with the maximum number of features. Keep all the elements inserted. Whenever a new insert occurs, re-compute TF-IDF over the entire set.&lt;/li&gt;&#xA;&lt;li&gt;Only keep the statistics which are required to update the weights. This way, an entire pass over the data is not necessary.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Normalization is again performed over the entire dataset once the idf is updated. Removal is not much different from the insertion, but one needs to use a suitable pointer-wise data structure if it is desired to have the computational complexity both for insertion and deletion.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-06-21T14:44:10.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16968" PostTypeId="1" CreationDate="2014-06-21T16:27:14.250" Score="0" ViewCount="2893" Body="&lt;p&gt;I am doing one example from my book as a preparation for exam.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The assignment is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is given that: &#xA;  $$\mathbb{rect}(t)=pf(t) \leftrightarrow PF(f)=2AT_0 \cdot \mathbb{sinc}(2\pi fT_0)$$&#xA;  you need to calculate frequency spectrum of:&#xA;  $$pf(t)=\mathbb{sinc}(\omega t)$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Truthfully, I have no idea where to start. I presume that the solutions is absolute value of sinc function, because I read it from solution, but in the solution there was only diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to solve directly using Fourier transformation on sinc function, but I got very messy equation at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is: How can I solve this assignment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks you very much!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;I found this pdf, on the 7(162) side it explains what I want to do, but this is only with pictures. I want to understand it. &#xA;&lt;a href=&quot;http://ultrasound.ee.ntu.edu.tw/classnotes/ckt2/Chapter12.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ultrasound.ee.ntu.edu.tw/classnotes/ckt2/Chapter12.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10201" LastEditorUserId="10201" LastEditDate="2014-06-21T16:50:07.643" LastActivityDate="2014-06-22T14:51:22.727" Title="Frequency spectrum of a sinc function" Tags="|fourier-transform|frequency-spectrum|homework|fourier|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16969" PostTypeId="2" ParentId="16968" CreationDate="2014-06-21T18:57:52.143" Score="3" Body="&lt;p&gt;Look at the forms of the functions, and remember the &lt;a href=&quot;http://ocw.usu.edu/Electrical_and_Computer_Engineering/Signals_and_Systems/5_6node6.html&quot; rel=&quot;nofollow&quot;&gt;duality property&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I invite you the read the Wikipedia article: &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Fourier_transform&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2014-06-21T19:53:53.370" LastActivityDate="2014-06-21T19:53:53.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16970" PostTypeId="1" AcceptedAnswerId="16971" CreationDate="2014-06-21T18:58:22.667" Score="1" ViewCount="130" Body="&lt;p&gt;I need to create a vector of sine signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm trying to figure out what the structure of the function that describe sine signal ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the function   $\sin 2x$  meets the requirements?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer is no, then what is the reason?&lt;/p&gt;&#xA;" OwnerUserId="10259" LastActivityDate="2014-06-22T16:00:27.600" Title="Structure of function that describes sine signal" Tags="|wave|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16971" PostTypeId="2" ParentId="16970" CreationDate="2014-06-21T19:36:25.923" Score="4" Body="&lt;p&gt;I think you posted similar question 3 days ago, regarding your teacher claiming that $\sin 2x$ is not a sinusoidal function. Nevertheless this function is definitely sinusoidal. Otherwise how come we can say that signals &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;can be decomposed&lt;/strong&gt;&lt;/a&gt; into sums of sinusoids (and cosinusoids)? You have plenty of orthogonal waves: $\sin x, \ \sin 2x, \ \sin 3x, \ldots$, and all of them are sinusoids. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing that is coming into my mind, is that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Discrete-time sinusoid is periodic only if its fundamental frequency &#xA;  $f_0$ is a rational number&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For a sinusoid with frequency $f_0$ to be periodic, we should have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sin[2\pi f_0 (N+n)+\theta] = \sin[2\pi f_0 n + \theta]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This relations is true if and only if there exists an integer $k$ such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2\pi f_0N=2\pi k $$&#xA;or, equivalently:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_0 = \dfrac{k}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine the fundamental frequency of a periodic sinusoid, we express its frequency as above and cancel common factors so that $k$ and $N$ have no common divisors. Then the fundamental period of the sinusoid is equal to N. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$f_0 = \dfrac{31}{60}$ implies that $N=60$&lt;/li&gt;&#xA;&lt;li&gt;$f_0 = \dfrac{30}{60}$ implies that $N=2$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus if you define your discrete sinusoid to be: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$\sin[2 f_0 t]$, or &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\sin[\sqrt{2} f_0 t]$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;then these are no longer periodic in digital domain. Why? Think of that in following way: each sample at start of the new period will be shifted slightly - it's not a rational multiple of $\pi$. Below is some plot for two signals:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\sin [2 \pi t]$&lt;/li&gt;&#xA;&lt;li&gt;$\sin [2 \pi \sqrt{2} t]$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sampling frequency is $10 \ \mathtt{Hz}$ and upper time limit is $8 \ \mathtt{s} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nhrZD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see a first sinusoid is periodic - every 10 samples (1 second) you get repeating pattern. On the contrary second one, of which fundamental frequency cannot be represented as a rational number (no way to decompose $\sqrt{2}$) periods are not the same - thus your signal has no period. Check the figure below for overlay of 11 periods:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s0NvJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-22T16:00:27.600" LastActivityDate="2014-06-22T16:00:27.600" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16973" PostTypeId="2" ParentId="16962" CreationDate="2014-06-22T02:53:18.107" Score="4" Body="&lt;p&gt;To talk about gain you have to be able to compare the &lt;a href=&quot;http://en.wikipedia.org/wiki/Root_mean_square&quot; rel=&quot;nofollow&quot;&gt;RMS values&lt;/a&gt; of your discrete and continuous functions, and the discrete function will only have an RMS value if you choose a way to connect the points of your discrete signal in $\mathbb{R}^2$. We can use rectangles since most DACs maintain the voltage constant in between samples, and in the limit when the sample rate tends to infinity it converges to the function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the RMS value of your set of points $\{{x_1,x_2, ...,x_n}\}$ would be the square root of the summation of your $x_i^2$ times the length of the base of the rectangle $1/f_s$ divided by the total length of the interval $n/f_s$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_{_{RMS}}=\sqrt{\frac{1}{n}\sum_{i=0}^{n}x_i^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the RMS value for your continuous signal, calculating the area of the squared function divided by the length of the interval, and considering the beginning of the interval is $t = 0$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{_{RMS}}=\sqrt{\frac{1}{t}\int_{0}^{t}[f(t)]^2dt}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you would have to find a normalization constant that makes &lt;a href=&quot;http://en.wikipedia.org/wiki/Gain&quot; rel=&quot;nofollow&quot;&gt;the gain&lt;/a&gt; 0. It means:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ 0=\ln{(\frac{\alpha x_{_{RMS}}}{f_{_{RMS}}})} \Rightarrow \frac{\alpha x_{_{RMS}}} {f_{_{RMS}}}=1 \Rightarrow \frac{f_{_{RMS}}}{ x_{_{RMS}}} =\alpha$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\alpha$ is your normalization constant, and as you can see it would depend on the function involved. However, it is important to notice that for the same time interval, $x_{_{RMS}}$ may change if the sampling rate changes, so the normalization value (if it exists, since f might not be integrable in the chosen interval) may depend on the sample rate, tending to be closer to 1 as the sample rate increases. The normalization constant for most functions will in fact depend on the chosen interval, so thinking in terms of a normalization constant is just an approximation. In particular calculating the gain of a filter is not a simple problem, and in many cases the gain depends on the frequency, so you choose a particular frequency to estimate the gain of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say that the responses are not what you expect, but maybe providing more details on what you expect and what are you obtaining would allow us to provide you with a better answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also in your code, you are using the step function for both the impulse response and step response, and your impulse response has only zeroes. You have to set one value to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also keep in mind that when analyzing impulse and step responses of a filter the way you are doing it, it is a common practice to use sample period as the time unit and not seconds, and the units for the frequency response would then be in terms of sampling frequency so you have a more general idea of the response of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&#xA;DP&lt;/p&gt;&#xA;" OwnerUserId="10234" LastEditorUserId="10234" LastEditDate="2014-06-24T22:42:03.293" LastActivityDate="2014-06-24T22:42:03.293" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16974" PostTypeId="1" AcceptedAnswerId="16979" CreationDate="2014-06-22T04:42:11.030" Score="2" ViewCount="214" Body="&lt;p&gt;I have a .wav file which came off of a cd with a scratch, so there is a periodic &quot;clicking&quot; of about 6 Hz.  I was playing around with trying to squash the clicking by taking FFT and filtering the range around this frequency, but with no success.  I tried smoothing the low end of the FFT spectrum, but it didn't change anything.  Then I tried zeroing this part of the spectrum up to higher and higher indices, but it still wouldn't kill the click.  Eventually it started to attenuate the entire signal, but the click was still there, and perhaps even more prominent than before (relative to the rest of the signal).  Why is this the case?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first speculation is that the click is somehow not quite steady enough to be localized in a single region of the spectrum.  Can anyone confirm this hypothesis or else explain the true source of the issue?  Also, is there a better means of eliminating the click?&lt;/p&gt;&#xA;" OwnerUserId="10284" LastActivityDate="2021-01-01T16:27:14.547" Title="FFT filter to remove cd scratch" Tags="|fft|filters|audio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16976" PostTypeId="1" CreationDate="2014-06-22T07:36:48.240" Score="2" ViewCount="149" Body="&lt;p&gt;I have read the DSP literature and I get why:&#xA;$$e^{j(\omega+2 \pi m)n}=e^{j\omega n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But can't we prove the same in continuous domain also in the following way:&#xA;$$e^{j\omega t}$$&#xA;$$e^{j(\omega+2 \pi m)t}$$&#xA;$$\left( e^{j\omega} \cdot e^{2j\pi m}\right) e^t$$&#xA;$$e^{j\omega t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my above reasoning is correct, then does not it mean that analog frequencies separated by $2\pi$ are same? But I know this is not the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me in this case. &lt;/p&gt;&#xA;" OwnerUserId="10287" LastEditorUserId="8202" LastEditDate="2014-06-23T17:48:24.763" LastActivityDate="2014-06-23T17:48:24.763" Title="Non-uniqueness of continuous time sinusoids?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="16977" PostTypeId="2" ParentId="16957" CreationDate="2014-06-22T08:40:44.953" Score="1" Body="&lt;p&gt;Use a hand model (using say the kinematics) in order to hypothesize the pose of the articulated movement. For example you can look into:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cvrlcode.ics.forth.gr/handtracking/&quot; rel=&quot;nofollow&quot;&gt;http://cvrlcode.ics.forth.gr/handtracking/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.ics.forth.gr/~argyros/mypapers/2012_06_cvpr_twohands.pdf&quot; rel=&quot;nofollow&quot;&gt;http://users.ics.forth.gr/~argyros/mypapers/2012_06_cvpr_twohands.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://robohow.eu/_media/special/bib/isuvr13.pdf&quot; rel=&quot;nofollow&quot;&gt;http://robohow.eu/_media/special/bib/isuvr13.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After robustly tracking in presence of the occlusions, you could use a machine learning method such as HMM to recognize the gesture.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-06-22T08:40:44.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16979" PostTypeId="2" ParentId="16974" CreationDate="2014-06-22T12:13:16.187" Score="3" Body="&lt;p&gt;This approach with notch filter with not work. All clicks are impulse-like sounds and we know that an impulse has frequency content at almost every frequency. What you are trying to do, by applying the &lt;span class=&quot;math-container&quot;&gt;$6 \ \texttt{Hz}$&lt;/span&gt; notch filter is to remove sinusoid with that particular frequency in your signal, isn't it? So do you hear that your clicks are such low-frequency sounds? Definitely not! Those clicks are spreading into whole of your spectrum (like very short burst of noise), and filtering out &lt;span class=&quot;math-container&quot;&gt;$6 \ \texttt{Hz}$&lt;/span&gt; won't help!.&lt;/p&gt;&#xA;&lt;p&gt;You also didn't shared any more informations about nature of your clicks and a signal (spectrogram, waveform or even recording would be great), because it might be the case that your signal is also impulse-like (i.e. recording of a shooting range), which will make the recognition and cleaning task bit more complicated. Also are your clicks the same over time? This could be also the case for digital systems, and simple correlation calculation should do the job. Additionally if you can sacrifice some of your recording quality and click's are very short, then you can use the median filtering. You can also use some time-frequency methods (based on wavelets, spectrogram calculation, LPC's) or  statistical approach, such as AR modelling, etc.&lt;/p&gt;&#xA;&lt;p&gt;Here is some reading for you - I hope it will guide you and you will find appropriate method for your kind of signals.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ee.columbia.edu/%7Edpwe/classes/e4810-2004-09/projects/knapp-bashir.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audio Click Removal using LPC&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www-dsp.elet.polimi.it/ispg/images/pdf/audio/materiale/godsill-reiner_paper.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Godsil S., Rayner P. - Digital Audio Restoration&lt;/a&gt; - lot's of references&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://dl.dropboxusercontent.com/u/33600147/Digital%20Audio%20Restoration%202.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;AR modelling based approach - book chapter&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://dafx04.na.infn.it/WebProc/Proc/P_027.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Detection of clicks using sinusoidal modelling for the confirmation of the clicks&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ipol.im/pub/art/2015/64&quot; rel=&quot;nofollow noreferrer&quot;&gt;Automatic detection and removal of impulsive noise in audio signals&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2021-01-01T16:27:14.547" LastActivityDate="2021-01-01T16:27:14.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16981" PostTypeId="2" ParentId="16968" CreationDate="2014-06-22T14:51:22.727" Score="1" Body="&lt;p&gt;Note the relationship of calculating the Fourier Transform to that of calculating the inverse Fourier Transform.  If you already have one result, what does that say about computing the other?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-22T14:51:22.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16982" PostTypeId="1" CreationDate="2014-06-22T16:07:05.063" Score="0" ViewCount="253" Body="&lt;p&gt;How can I determine the poles and zeros of a system given its frequency Response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can understand how one can find the Frequency response from poles and zeros of a system. Is it possible to do it the other way round?&lt;/p&gt;&#xA;" OwnerUserId="10289" LastActivityDate="2014-06-22T16:07:05.063" Title="Poles and zeros from FRF" Tags="|frequency-response|frequency-domain|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16983" PostTypeId="2" ParentId="16797" CreationDate="2014-06-22T16:12:17.463" Score="3" Body="&lt;p&gt;You can use Caffe's deep convulutional net that was trained on the ImageNet DB to extract some very strong features:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://caffe.berkeleyvision.org/&quot; rel=&quot;nofollow&quot;&gt;http://caffe.berkeleyvision.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Caffe framework is implemented in C++ and runs very fast. It enables you to extract features that are much more powerful than LBP or HOG for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extract features from a training set and use them to train a classifier, for example and SVM. Then, in the detection phase - given an input image, extract features from it, using the pre-trained net and feed those features to the pre-trained classidfier.&lt;/p&gt;&#xA;" OwnerUserId="8851" LastActivityDate="2014-06-22T16:12:17.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16984" PostTypeId="1" AcceptedAnswerId="17001" CreationDate="2014-06-22T18:43:00.080" Score="2" ViewCount="1167" Body="&lt;p&gt;Does anyone have a mechanism to understand intuitively  (and automatically) why the Fourier Transform of certain functions have certain shapes (at least for some functions, not necessarily for all)? I know what kind of operator the Fourier Transform is and what it does to a function but somehow I can't see intuitively and automatically why why the Fourier Transform of certain functions have certain shapes. For example, is there a intuitive reason why the Fourier Transform of a pulse (box function) is in the $\mathbb{sinc}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4370" LastEditorUserId="8202" LastEditDate="2014-06-23T07:40:12.850" LastActivityDate="2014-06-24T14:33:16.927" Title="Intuitive explanation of the Fourier Transform for some of the functions" Tags="|fourier-transform|fourier|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16985" PostTypeId="1" AcceptedAnswerId="17018" CreationDate="2014-06-22T19:17:06.900" Score="3" ViewCount="1445" Body="&lt;p&gt;I want to find the channel frequency response of a digital communications system. I have the functions of the input symbol (a triangle) and the output symbol - a distorted triangle: $$\dfrac{1}{1 + \left( \frac{2t}{T} \right)^2 }$$&#xA;I want to plot the frequency response of the channel as if it was a digital filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this in MATLAB?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using symbolic variables, computing Fourier transforms of the input and the output signal using &lt;code&gt;fourier&lt;/code&gt; command, and then finding the numerical values using &lt;code&gt;subs&lt;/code&gt; and &lt;code&gt;double&lt;/code&gt; commands, with no success. &lt;/p&gt;&#xA;" OwnerUserId="10292" LastEditorUserId="128" LastEditDate="2018-09-09T10:41:14.253" LastActivityDate="2018-09-09T10:41:14.253" Title="How to Find the Frequency Response of a Communication Channel from Input and Output Symbols in MATLAB?" Tags="|matlab|digital-communications|infinite-impulse-response|deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16986" PostTypeId="1" AcceptedAnswerId="16992" CreationDate="2014-06-22T21:13:11.943" Score="3" ViewCount="302" Body="&lt;p&gt;Consider the following question that I toke from &lt;a href=&quot;http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/assignments/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Signals and systems: Part I&lt;/em&gt;&lt;/a&gt; exercises, question 1:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(b) With $x(t) = \cos(\omega_x(t + \tau_x) + \theta_x)$ and&#xA;  $y(t) = sin(\omega_y(t + \tau_y)+ \theta_y)$, determine for which of the&#xA;  following combinations $x(t)$ and $y(t)$ are identically equal for all&#xA;  $t$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Given that:&#xA;$$&#xA;\begin{matrix}&#xA;\omega_x &amp;amp; \tau_x &amp;amp; \theta_x &amp;amp; \omega_y &amp;amp; \tau_y &amp;amp; \theta_y \\&#xA;\hline&#xA;\pi/3    &amp;amp; 0      &amp;amp; 2\pi     &amp;amp; \pi/3    &amp;amp; 1      &amp;amp; -\pi/3 &#xA;\end{matrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/assignments/MITRES_6_007S11_hw02_sol.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;solutions manual&lt;/a&gt; shows that $x(t)$ and $y(t)$ are identical with these values:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\omega_x = \omega_y$, $\omega_x\tau_x + \theta_x = 2\pi$, $\omega_y\tau_y + \theta_y = \frac{\pi}{3}(1) - \frac{\pi}{3} = 0 + 2\pi k$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Thus, $x(t) = y(t)$ for all $t$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It toke me sometime to understand this, but still I'm not sure how these signals are identical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we substitute the constants we will get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;x(t) &amp;amp;= \cos(\frac{\pi}{3}(t + 0) + 2\pi) \\&#xA;     &amp;amp;= \cos(\frac{\pi}{3} t + 2\pi) \\&#xA;     &amp;amp;= \cos(\frac{\pi}{3}t) \\&#xA;\\&#xA;y(t) &amp;amp;= \sin(\frac{\pi}{3}(t + 1) - \frac{\pi}{3}) \\&#xA;     &amp;amp;= \sin(\frac{\pi}{3}t + \frac{\pi}{3} - \frac{\pi}{3}) \\&#xA;     &amp;amp;= \sin(\frac{\pi}{3}t)&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is clear that $x(t) = \cos(\frac{\pi}{3}t)$ and $y(t) = \sin(\frac{\pi}{3}t)$ are not identical:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fEWCj.png&quot; alt=&quot;plot x(t) = cos((pi/3) * t, y(t) = sin((pi/3) * t&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please explain what I'm missing?&lt;/p&gt;&#xA;" OwnerDisplayName="user10293" LastActivityDate="2014-06-23T07:47:38.547" Title="Why $x(t) = \cos(\frac{\pi}{3}t)$ and $y(t) = \sin(\frac{\pi}{3}t)$ are considered identical signals?" Tags="|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16987" PostTypeId="1" AcceptedAnswerId="16988" CreationDate="2014-06-22T21:52:15.510" Score="1" ViewCount="156" Body="&lt;p&gt;Can you give me an example for this MATLAB snippet to generate sine wav with specified phase?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function synthesize_fp(file,f,d,p,gamma)&#xA;% Matlab function synthesize_fp(file,f,d,p,gamma) &#xA;% creates a .wav audio file of a sound where all frequencies, &#xA;% amplitudes(power) and phase may be specified.&#xA;%&#xA;% file is a string which is the name of the .wav file.&#xA;% f is a length n vector of frequencies in Hz&#xA;% d is the duration in seconds&#xA;% p is a length n vector of amplitudes&#xA;% gamma is a length n vector of phase shifts, as a fraction of the &#xA;%  period of the first harmonic f1.&#xA;%&#xA;% Mark R. Petersen, U. of Colorado Boulder Applied Math Dept, Feb 2004&#xA;&#xA;Fs=22050; nbits=8;              % frequency and bit rate of wav file&#xA;&#xA;t = linspace(1/Fs, d, d*Fs);    % time&#xA;y = zeros(1,Fs*d);              % initialize sound data&#xA;for j=1:length(p);&#xA;  y = y + p(j)*cos(2*pi*f(j)*(t-gamma(j)/f(1))); % sythesize waveform&#xA;end&#xA;y = .5*y/max(y);                % normalize.  Coefficent controls volume.&#xA;wavwrite( y, Fs, nbits, file)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10294" LastEditorUserId="8202" LastEditDate="2014-06-22T22:15:24.323" LastActivityDate="2014-06-22T22:25:25.907" Title="How can I run this MATLAB code snippet for the waveform synthesis?" Tags="|matlab|" AnswerCount="1" CommentCount="0" ClosedDate="2014-06-26T02:29:43.007" ContentLicense="CC BY-SA 3.0" />
  <row Id="16988" PostTypeId="2" ParentId="16987" CreationDate="2014-06-22T22:13:04.200" Score="1" Body="&lt;p&gt;This is a programming question (won't benefit anyone apart from you) and what's more, you are using program rather different from application you described. In order to generate the sinusoidal wave with given phase you don't need to use that. Above script is used mainly for synthesis of a wave with harmonic content depending on type of sound (flute, violin, etc), and personally I don't like it as it is terribly written using a for loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For general answer you can refer to &lt;a href=&quot;https://dsp.stackexchange.com/a/16228/8202&quot;&gt;&lt;strong&gt;Phase information&lt;/strong&gt;&lt;/a&gt;. Additionally usage description is very clear - did you tried to follow it? For example more complicated sound would be defined as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;file = 'output.wav';&#xA;f = [100 200 300 400];&#xA;d = 5;&#xA;p = [1 0.5 0.25 0.124];&#xA;gamma = zeros(1, 4); % Start with no phase-shift&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For pure cosinusoid use the:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;file = 'output.wav';&#xA;f = 100&#xA;d = 5;&#xA;p = 1;&#xA;gamma = 0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Application of phase shift is not very straightforward as its described by relative shift with respect to fundamental frequency. Therefore I rather suggest to write it on your own and keep it clean:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 400; % sampling frequency&#xA;d = 1; % duration&#xA;f = 10; % wave frequency&#xA;phi = pi/2; % phase shift - will produce cosinusoid for pi/2&#xA;t = linspace(1/fs, d, d*fs); % time vector&#xA;y = sin(2*pi*f*t + phi);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-06-22T22:25:25.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16989" PostTypeId="1" AcceptedAnswerId="17013" CreationDate="2014-06-22T22:32:27.830" Score="0" ViewCount="71" Body="&lt;p&gt;Here is a &lt;a href=&quot;http://www.ti.com/product/cc8520&quot; rel=&quot;nofollow&quot;&gt;radio chip for audio&lt;/a&gt; that sends at a CD-level data rate.  Could you sample an analog signal (for instance from a guitar pick-up or microphone) in such a way that you could transmit using two radio chips (and receive using two radio chips), then recombine the signal on the receiver side into one that has double the data rate of the same basic circuit that uses only one transmitter chip (and one receiver)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also can this be done with an analog circuit rather than expensive A/D converters?&lt;/p&gt;&#xA;" OwnerUserId="10209" LastEditorUserId="10209" LastEditDate="2014-06-22T22:38:45.850" LastActivityDate="2014-06-23T20:33:25.450" Title="Is there a way to break an analog sound signal up and send it through two radio chips at double the data rate of one?" Tags="|audio|filter-design|sampling|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16990" PostTypeId="1" CreationDate="2014-06-22T23:56:44.440" Score="2" ViewCount="255" Body="&lt;p&gt;I'm working through exercises in a book called &lt;em&gt;The Audio Programming Book&lt;/em&gt; and have been doing okay for nearly 300 pages, but have just got stuck. (I'm a musician, not programmer or audio specialist BTW, so sorry if this is a dumb question…)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand what pulse-width modulation is, and I've managed to write some C code to apply it to a square-wave. The book suggests using a function prototype that includes a frequency parameter; I assumed this would be the same as the frequency of the square-wave. But now I'm thinking that this frequency parameter may be for a LFO that constantly changes the level of pulse-width modulation. &lt;strong&gt;Does dynamic pulse-width modulation suggest a constantly changing level of pulse-width modulation, governed by a LFO?&lt;/strong&gt; The next exercise in the book asks for &quot;breakpoint&quot; control over this function - but the values put into this would be dependent upon whether the frequency of pulse-width modulation change is changing, or just pulse-width modulation is changing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect I may have coded so far for &lt;em&gt;static&lt;/em&gt; pulse-width modulation of a square wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; here's some code…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following struct holds oscillator information, it is from code in the book (although I added curPWMod):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;typedef struct t_oscil&#xA;{&#xA;    double twoPiOvrSR;&#xA;    double curFreq;&#xA;    double curPWMod;&#xA;    double curPhase;&#xA;    double incr;&#xA;} OSCIL;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following macro updates values if the frequency value passed into functions changes (I wrote this as an exercise from the book, originally code for this was in every function):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define UPDATE_FREQ \&#xA;        if (p_osc-&amp;gt;curFreq != freq) \&#xA;            do { \&#xA;                p_osc-&amp;gt;curFreq = freq; \&#xA;                p_osc-&amp;gt;incr = p_osc-&amp;gt;twoPiOvrSR * freq; \&#xA;            } while (0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following function is from the book, used to create values for a square wave (originally values set were 1.0, I changed to 0.99 as my audio files were clipping):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double squareTick(OSCIL *p_osc, double freq)&#xA;{&#xA;    double val;&#xA;    UPDATE_FREQ;&#xA;    if (p_osc-&amp;gt;curPhase &amp;lt;= M_PI) {&#xA;        val = 0.99; // to avoid clipping&#xA;    } else {&#xA;        val = -0.99; // to avoid clipping&#xA;    }&#xA;    p_osc-&amp;gt;curPhase += p_osc-&amp;gt;incr;&#xA;    if (p_osc-&amp;gt;curPhase &amp;gt;= TWO_PI) {&#xA;        p_osc-&amp;gt;curPhase -= TWO_PI;&#xA;    }&#xA;    if (p_osc-&amp;gt;curPhase &amp;lt; 0.0) {&#xA;        p_osc-&amp;gt;curPhase += TWO_PI;&#xA;    }&#xA;    return val;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is my similar function to return values for a pulse-width modulated square wave (the constant value of 0.02 is used, because a pwMod value of 50 should give a square-wave):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// the next function is for pulse-width-modulated square wave&#xA;double pwmTick(OSCIL *p_osc, double freq, double pwMod)&#xA;{&#xA;    // this should BASICALLY be the same as the square wave function, but adjusting for the pwMod input&#xA;    double val;&#xA;    UPDATE_FREQ;&#xA;    if (p_osc-&amp;gt;curPWMod != pwMod) {&#xA;        p_osc-&amp;gt;curPWMod = pwMod;&#xA;        if (p_osc-&amp;gt;curPWMod &amp;lt; 1.0) {&#xA;            p_osc-&amp;gt;curPWMod = 1.0;&#xA;        }&#xA;        if (p_osc-&amp;gt;curPWMod &amp;gt; 99.0) {&#xA;            p_osc-&amp;gt;curPWMod = 99.0;&#xA;        }&#xA;    } // only changed if pwMod value has changed&#xA;&#xA;    if (p_osc-&amp;gt;curPhase &amp;lt;= (M_PI * p_osc-&amp;gt;curPWMod * 0.02)) {&#xA;        val = 0.99; // to avoid clipping&#xA;    } else {&#xA;        val = -0.99;&#xA;    }&#xA;&#xA;    // the next 7 lines are the same in every function - so should probably be replaced with a macro&#xA;    p_osc-&amp;gt;curPhase += p_osc-&amp;gt;incr;&#xA;    if (p_osc-&amp;gt;curPhase &amp;gt;= TWO_PI) {&#xA;        p_osc-&amp;gt;curPhase -= TWO_PI;&#xA;    }&#xA;    if (p_osc-&amp;gt;curPhase &amp;lt; 0.0) {&#xA;        p_osc-&amp;gt;curPhase += TWO_PI;&#xA;    }&#xA;&#xA;    return val;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This function does exactly what I expected, but I have no idea if this is what the exercise in the book is asking me to do! Is this &lt;strong&gt;dynamic pulse-width modulation&lt;/strong&gt;? My solution uses a different oscillator (and oscillator function), rather than applying another oscillator (sine?) and oscillator function to the pwMod argument passed into this function (which I suspect I'm supposed to do…)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This book doesn't mention pulse-width modulation before this point, and then gives no explanation of what it is; I don't mind this, it requires the reader to find information themselves, but it is hard work!&lt;/strong&gt; The only clue given by the book, as to what this exercise requires, is the given function prototype:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double pwmtick(OSCIL* p_osc, double freq, double pwmod);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As I say above, I've managed to write a function using this prototype, but am now not sure if the freq parameter refers to the same frequency as in the square-wave function above (which is how I've interpreted it), or if it should be interpreted as a frequency for changing the amount of pwMod applied...&lt;/p&gt;&#xA;" OwnerUserId="7208" LastEditorUserId="7208" LastEditDate="2014-06-23T08:28:57.413" LastActivityDate="2014-06-23T08:28:57.413" Title="What is dynamic pulse-width modulation?" Tags="|modulation|c|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="16991" PostTypeId="2" ParentId="16984" CreationDate="2014-06-23T04:08:55.430" Score="2" Body="&lt;p&gt;functions in time that wiggle a lot will have a greater portion of its energy in the frequency domain at higher frequencies.  because of duality, you can switch the roles of time and frequency.  a function in time that has the greater portion of its energy at times much earlier and later than $t=0$ will wiggle a lot in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-06-24T14:33:16.927" LastActivityDate="2014-06-24T14:33:16.927" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="16992" PostTypeId="2" ParentId="16986" CreationDate="2014-06-23T07:47:38.547" Score="2" Body="&lt;p&gt;There is obviously an error in the problem formulation. From the given solution, the problem should read&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;With $x(t) = \cos(\omega_x(t + \tau_x) + \theta_x)$ and&#xA;  $y(t) = \cos(\omega_y(t + \tau_y)+ \theta_y)$, determine for which of the&#xA;  following combinations $x(t)$ and $y(t)$ are identically equal for all&#xA;  $t$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In this case the given solution $\omega_x=\omega_y$ and $\omega_x\tau_x+\theta_x=\omega_y\tau_y+\theta_y+2\pi k$ makes sense. The solution to the problem as it is given (with $y(t)=\sin(\omega_y(t + \tau_y)+ \theta_y)$), would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_x\tau_x+\theta_x=\omega_y\tau_y+\theta_y-\frac{\pi}{2}+2\pi k$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-23T07:47:38.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="16993" PostTypeId="2" ParentId="16976" CreationDate="2014-06-23T08:20:20.800" Score="3" Body="&lt;p&gt;In discrete-time we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{j\omega_0n}=e^{j(\omega_0+2\pi k)n},\quad \forall n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $2\pi kn$ is an integer multiple of $2\pi$ if $k$ and $n$ are integers, and, consequently, $e^{j2\pi kn}=1$. In continuous time you generally have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{j\omega_0t}\neq e^{j(\omega_0+2\pi k)t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $2\pi k t$ is (for arbitrary $t$) not an integer.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-06-23T13:25:16.303" LastActivityDate="2014-06-23T13:25:16.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16994" PostTypeId="1" AcceptedAnswerId="16996" CreationDate="2014-06-23T09:45:55.253" Score="18" ViewCount="35268" Body="&lt;p&gt;I'm trying to extract features from a sound file and classify the sound as belonging to a particular category (eg : dog bark, vehicle engine e.t.c). I'd like some clarity on the following things :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is this doable at all? There are programs that can recognize speech, and differentiate between different types of dog bark. But is it possible to have a program that can receive a sound sample and just say what kind of a sound it is? (Assume there's a database containing a lot of sound samples to refer to). The input sound samples can be a bit noisy (microphone input).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I assume that the first step is audio feature extraction. &lt;a href=&quot;http://practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/&quot; rel=&quot;noreferrer&quot;&gt;This&lt;/a&gt; article suggests extracting MFCCs and feeding them to a machine learning algorithm. Is MFCC enough? Are there any other features that are generally used for sound classification?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time.&lt;/p&gt;&#xA;" OwnerUserId="5116" LastEditorUserId="8202" LastEditDate="2017-11-14T15:10:37.697" LastActivityDate="2019-10-13T23:39:48.947" Title="Feature extraction for sound classification" Tags="|audio|mfcc|machine-learning|classification|sound-recognition|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16995" PostTypeId="1" AcceptedAnswerId="16998" CreationDate="2014-06-23T09:59:33.530" Score="16" ViewCount="34333" Body="&lt;p&gt;Figure 1.(c) shows the Test image reconstructed from MAGNITUDE spectrum only. We can say that the intensity values of LOW frequency pixels are comparatively more than HIGH frequency pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 1.(d) shows the Test image reconstructed from PHASE spectrum only. We can say that intensity values of HIGH frequency (edges,lines) pixels are comparatively more than LOW frequency pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why this magical contradiction of intensity change (or exchange) is present between Test image reconstructed from MAGNITUDE spectrum only and Test image reconstructed from PHASE spectrum only, which when combined together form the original Test image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3UwSm.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;clear all;&#xA;close all;&#xA;i1=imread('C:\Users\Admin\Desktop\rough\Capture1.png');&#xA;i1=rgb2gray(i1);&#xA;&#xA;f1=fftn(i1);&#xA;mag1=abs(f1);&#xA;s=log(1+fftshift(f1));&#xA;phase1=angle(f1);&#xA;&#xA;r1=ifftshift(ifftn(mag1));&#xA;r2=ifftn(exp(1i*phase1));&#xA;figure,imshow(i1);&#xA;figure,imshow(s,[]);&#xA;figure,imshow(uint8(r1));&#xA;figure,imshow(r2,[]);&#xA;r2=histeq(r2);&#xA;r3=histeq(uint8(r2));     &#xA;figure,imshow(r2);&#xA;figure,imshow(r3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="9035" LastEditDate="2015-04-13T16:56:17.617" LastActivityDate="2015-04-13T16:56:17.617" Title="Image Reconstruction:Phase vs. Magnitude" Tags="|image-processing|matlab|fft|fourier-transform|frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16996" PostTypeId="2" ParentId="16994" CreationDate="2014-06-23T11:24:48.060" Score="16" Body="&lt;ol&gt;&#xA;&lt;li&gt;By long shot it is doable - to what extend? You will see. This task of environmental sound classification is not very well studied. Also choice of machine learning paradigm is crucial - statistical approach or maybe binary classifier? You can start with GMM's, ANN's and SVM's - I opt for GMM's and ANN's.&lt;/li&gt;&#xA;&lt;li&gt;Yes, most of people are using MFCC's because they are well correlated with what people are actually hearing and also no one came up with anything better since. You might also want to add extra features such as MPEG-7 descriptors.  Proper feature optimisation must be performed because sometimes you don't need so many features, especially when they are do not separable. For more info please refer to my previous answers:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/16873/8202&quot;&gt;Feature extraction from spectrum&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/15938/is-this-a-correct-interpretation-of-the-dct-step-in-mfcc-calculation/15945#15945&quot;&gt;MFCC extraction&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/14984/8202&quot;&gt;Detection of sounds&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-06-23T11:39:59.857" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="16997" PostTypeId="1" AcceptedAnswerId="17000" CreationDate="2014-06-23T11:25:54.887" Score="3" ViewCount="128" Body="&lt;p&gt;Newbie to Signal processing, sorry if the question is basic.&#xA;I have a data set consisting of 601 values. The values being time Vs voltage . The voltage values have transients in them. My aim is to filter out these transients using an FIR filter. But i'm still far from doing that.&#xA;This is my voltage Vs Time plot.&lt;img src=&quot;https://i.stack.imgur.com/pcjmJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plotted the fft of voltage and this is what i got.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/rzi1t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read up that fft basically divides my sampling frequency,Fs, into N equal parts (N= 601, Total number of values). According to my (voltage Vs Time) plot, my Fs=2500Hz (by calculating Ts as the difference between consecutive values of time from data set).Then,2500/601 gives 4.159 as the first point in my fft. Is this even correct? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going by the above,the strength of the signal is greatest at the 11th value (ie,10*4.159 =41.59 Hz) and the 592nd value (591*4.159=2458 Hz).Now, What significance does this information hold if i need to design a filter to eliminate the transients? What do information do i take away exactly, by performing the fft of the voltage signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10274" LastActivityDate="2014-06-23T11:57:38.637" Title="deciphering the frequency response from the input data" Tags="|fft|filters|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="16998" PostTypeId="2" ParentId="16995" CreationDate="2014-06-23T11:32:59.203" Score="17" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Figure 1.(c) shows the Test image reconstructed from MAGNITUDE spectrum only. We can say that the intensity values of LOW frequency pixels are comparatively more than HIGH frequency pixels.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Actually, this is not correct. The phase values determine the shift in the sinusoid components of the image. With zero phase, all the sinusoids are centred at the same location and you get a symmetric image whose structure has no real correlation with the original image at all. Being centred at the same location means that the sinusoids are a maximum at that location, and is why there is a big white patch in the middle of Figure 1.c. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase-only reconstruction preserve features because of the principle of &lt;strong&gt;phase congruency&lt;/strong&gt;. At the location of edges and lines, most of the sinusoid components have the same phase. See &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT7/node2.html&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT7/node2.html&lt;/a&gt;  This properly alone can be used to detect lines and edges, &lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/pkpapers/phasecorners.pdf&quot;&gt;http://www.csse.uwa.edu.au/~pk/research/pkpapers/phasecorners.pdf&lt;/a&gt; , without regard to magnitude. So you can see that the phase information is most important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the magnitude of the various component sinusoids changes the shape of the feature. When you do a phase-only reconstruction, you set all the magnitudes to one, which changes the shape of the features, but not their location. In many images the low frequency components have a magnitude higher than the high frequency components, so phase-only reconstruction does look like a high-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, phase contains the information about the locations of features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You cannot &lt;em&gt;add&lt;/em&gt; the phase-only and magnitude-only images to get the original. You can multiply them in the Fourier domain and transform back to get the original.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-06-23T11:32:59.203" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="16999" PostTypeId="2" ParentId="16995" CreationDate="2014-06-23T11:35:02.330" Score="5" Body="&lt;p&gt;In your line &#xA;&lt;code&gt;mag1=abs(f1);&lt;/code&gt; &#xA;you are leaving the total intensity of the image unchanged (test this by summing up the intensities over all pixels). Rejecting the phase information in Fourier space just leads to a spatial redistribution of the intensity in real space, such that r1 will have the same total insity as i1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your line&#xA;&lt;code&gt;phase1=angle(f1);&lt;/code&gt;&#xA;you are normalizing the amplitudes of each pixel (in Fourier space) to 1, so the total intensity of the image will be changed. As the phase carries a large part of the spatial information of the image, major features of the image are nevertheless preserved. &lt;/p&gt;&#xA;" OwnerUserId="10295" LastActivityDate="2014-06-23T11:35:02.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17000" PostTypeId="2" ParentId="16997" CreationDate="2014-06-23T11:57:38.637" Score="1" Body="&lt;p&gt;Since the signal is most certainly real-valued, you can ignore the FFT values after $f_s/2$ (or sample 300 in your plot) since they will mirror the first ones. With a sampling frequency of 2500Hz, the highest frequency in your signal can be 1250Hz. If you have higher frequencies and don't filter them prior to sampling, you will get aliasing. Look up the sampling theorem for more information, it's quite important when working with sampled signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your actual question I'm not sure what you want to achieve. With an FIR filter you can attenuate certain frequencies. If your transients are strictly not within your desired frequency range, that might work. If they are in the same frequencies as your actual signal, an FIR filter won't help. Is that supposed to be a transient in the first plot where the signal goes from being clean to jiggly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, you could probably just use a lowpass filter which cuts off at 50Hz or similar.&lt;/p&gt;&#xA;" OwnerUserId="5069" LastActivityDate="2014-06-23T11:57:38.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17001" PostTypeId="2" ParentId="16984" CreationDate="2014-06-23T12:23:41.067" Score="6" Body="&lt;p&gt;What might seem intuitive differs greatly between individuals.  But let's start with a few basic things about a Fourier transform that people who have studied it might know about it.  Intuitively or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic concept 1:&#xA;Something symmetric around t=0 in the time domain is strictly real in the frequency domain (as only cosine functions and DC are purely symmetric in the time domain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic concept 2:&#xA;The duality principle of the FT implies that if any transform looks intuitive in one direction, the transform in the opposite direction should also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transform 1:&#xA;A DC level in the time domain corresponds to an impulse at 0 in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transform !B:&#xA;Getting away from impulses and infinities, but staying with the same picture, a strictly real and really skinny Gaussian pulse in the frequency domain at DC must convert to a really really wide Gaussian envelope in the time domain, also symmetric around t=0.  And vice versa.  Going in between those two (and depending on your graph scaling), a medium width Gaussian in one domain should correspond to a medium width Gaussian in its transform domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible intuitive transform concept 2 (if you have studied signal modulation concepts):&#xA;Adding strictly real and symmetric sidebands to a carrier in the frequency domain corresponds to AM modulation with a cosine sinusoid in the time domain.  The farther away the sidebands from the carrier center, the higher the frequency of the modulation.  The closer the sidebands, the lower the frequency of the modulating sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus if we add symmetric wide sidebands to a wide Gaussian, that will correspond to a narrow Gaussian that is high frequency AM modulated in the other domain.  If we add only narrow sidebands close in to a narrow Gaussian, that will correspond to a really wide Gaussian with a low frequency AM modulation in the other domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible intuitive transform concept 3 (if you have done much filter design):&#xA;If you have had to design  FIR filters, you might know that the sharper the cut-off and the flatter the pass-band desired in the frequency domain, the longer the FIR filter becomes to meet those requirements, corresponding to a longer and wider impulse response in the time domain.  Or, in the other direction, the sharper-edged and flatter-topped a pulse becomes in the time domain, the wider the bulk of its frequency response spans in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's take that Gaussian pulse, and add some similar shaped side-bands within the bulk of its main lobe so that its top become flatter. The Gaussian in the other domain will get amplitude (AM) modulated with sinusoidal modulators, mostly of frequencies where the tops of the added sidebands are much higher that the original Gaussian roll-off. (To make it even flatter, perhaps remove the some or all of carrier (original Gaussian) to produce a modulation over 100%, e.g. that crosses zero.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's also chop off the tails of the Gaussian with a brick wall filter and increase the flatness of the pass-band top even more to “square it up” in one domain.  In the other domain, that will cause lots of added ripples extending wider than before, or a “fattening up” of the tails of the original Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as we “square up” a Gaussian in one domain, it gets amplitude modulated plus fatter tails in the other domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, a skinny “squared up” Gaussian pulse in one domain might corresponds to a wide slowly AC modulated pulse with fat tails in the other domain,  And a wide but “squared up” Gaussian might correspond to something like a narrow pulse with fast AC modulation, but also with fat tails, in the other domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An AC modulated hump with fat tails starts to approach looking more similar to a Sinc waveform than the original Gaussian waveform, and with a width inversely proportional to the width of the &quot;squared up&quot; looking waveform in the other domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitive?  Who knows…&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-06-23T23:47:42.163" LastActivityDate="2014-06-23T23:47:42.163" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17003" PostTypeId="1" AcceptedAnswerId="17006" CreationDate="2014-06-23T15:48:04.853" Score="1" ViewCount="1661" Body="&lt;p&gt;I am trying to understand if there is an inherent advantage to using CIELAB for color-based segmentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/glbuL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I segmented the cytoplasm from the image above, where the left image below is from RGB color clustering, and the right one is from CIELAB clustering, where a and b matrices were used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eUOJT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that there are very slight differences between the methods, where in this case, CIELAB clustering seems to work a bit better, but there are other examples where it doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, can you give me the reasons for using CIELAB?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's too much of a bother to explain, a good article reference would be nice, it would be better if it includes some mathematical explanation as well.&lt;/p&gt;&#xA;" OwnerUserId="7464" LastActivityDate="2014-06-24T10:00:25.327" Title="CIELAB Color Clustering" Tags="|image-segmentation|color|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17004" PostTypeId="1" CreationDate="2014-06-23T15:50:41.387" Score="1" ViewCount="1224" Body="&lt;p&gt;I am trying to create something like a heat map for sounds originating in a classroom to study the discussions inside the classroom. For this I am instaling directional microphones in various parts of the classroom and inputing the amplitude of sounds captured by them. I need to take the inputs from the microphones and process all of them separately. What hardware/software should I use for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I have a mixer board but it'll give me a single channel input. I want separate inputs from all the microphones&lt;/p&gt;&#xA;" OwnerUserId="10299" LastActivityDate="2014-06-23T16:19:15.553" Title="How can I connect multiple microphones to my computer (more than 4) and process the outputs independently?" Tags="|sound|source-separation|" AnswerCount="1" CommentCount="2" ClosedDate="2014-06-26T18:47:03.897" ContentLicense="CC BY-SA 3.0" />
  <row Id="17005" PostTypeId="2" ParentId="16918" CreationDate="2014-06-23T15:58:54.040" Score="1" Body="&lt;p&gt;I haven't implemented a pitch shifter using wavelets, but I am currently learning about them. From what I understand scales are the inverse of frequency, therefore to get your desired result you'd have to divide the scales instead of multiplying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, according to '&lt;a href=&quot;ftp://ftp.esat.kuleuven.ac.be/sista/degersem/reports/report97-17.ps.gz&quot; rel=&quot;nofollow&quot;&gt;Applications of the Continuous Wavelet Transform in the Processing of Musical Signals&lt;/a&gt;', you also have to update the phase as adjusting the scales isn't enough. The algorithm outlined in the paper is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;semitone = 12;&#xA;pitchFactor = 2^(semitone/12);&#xA;&#xA;wt = cwtft(input);&#xA;&#xA;mag = abs(wt.cfs);&#xA;phase = angle(wt.cfs);&#xA;unwrapped = unwrap(phase);&#xA;&#xA;wt.cfs = mag.*exp(1i*unwrapped*pitchFactor);&#xA;wt.scales = wt.scales./pitchFactor;&#xA;&#xA;result = icwtft(wt);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sadly, that's all I can offer until I learn more.&lt;/p&gt;&#xA;" OwnerUserId="5378" LastActivityDate="2014-06-23T15:58:54.040" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17006" PostTypeId="2" ParentId="17003" CreationDate="2014-06-23T16:12:41.827" Score="4" Body="&lt;p&gt;Generally speaking, a change of color space is essentially a nonlinear transform that stretches and distorts the coordinates. The transform is also continuous, except maybe on a singularity line or half-plane. It does not preserve the distances, but preserves the neighborhoods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of RGB &gt; Lab, you can see it as a linear transform (change of basis, from RGB to XYZ) followed by a nonlinear transform of every coordinate independently (rescaling of XYZ to Lab). The topology is essentially preserved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, image segmentation algorithms do their best to delimit clusters of similar colors and separate the clusters from other clusters. So if you just deform the clusters, a good segmentation algorithm will adjust the boundaries and somehow undo the transform. If you repeat the experiment with XYZ or YUV coordinates, you should see no big difference either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A stronger qualitative difference can be observed if the topology of the space is modified, for example by moving to the HSV space (Cartesian to cylindrical coordinates), of by performing some projection to lower the dimensionality such as XYZ &gt; xyz. But beware of the physical interpretation of what you are doing.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2014-06-23T22:35:07.143" LastActivityDate="2014-06-23T22:35:07.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17007" PostTypeId="2" ParentId="17004" CreationDate="2014-06-23T16:19:15.553" Score="2" Body="&lt;p&gt;Depending on what kind of application is that and what kind of microphones (dynamic, condenser, home-made electret ones) solutions can be different. Are you going to process everything in real-time or to make your analysis offline?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If your microphones doesn't require Phantom power and can be plugged into mic-in, then you can buy few of cheapest USB sound cards, plug them to your laptop, run your linux, create virtual device with JACK and you can record. &lt;strong&gt;But&lt;/strong&gt; do not expect to run in real time - most likely there will occur lot's of problems with synchronisation (had them on my own).  So it is good for not a real-time application. Here is some article about that: &lt;a href=&quot;http://www.penguinproducer.com/Blog/2011/11/using-multiple-devices-with-jack/&quot; rel=&quot;nofollow&quot;&gt;Using Multiple Devices with JACK&lt;/a&gt; and topic from &lt;a href=&quot;http://forum.audacityteam.org/viewtopic.php?f=27&amp;amp;t=56492&quot; rel=&quot;nofollow&quot;&gt;Audacity guys&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you want to use microphones that require a phantom power, then you should buy/borrow some 4+ channel USB/FireWire audio interface. You plug it into your computer and record whatever you want. No problems with latency, everything is synchronised. What program can you use? That's up to you - on linux I suggest Ardour on Windows I am using REAPER a lot. But for scientific applications just use the ASIO drivers and record tracks.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-23T16:19:15.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17008" PostTypeId="2" ParentId="15172" CreationDate="2014-06-23T17:16:17.043" Score="1" Body="&lt;p&gt;Given that the transmittances are equal, there is no difference at all in the global behavior of the two systems, including stability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference in the input error is fully compensated by the fact that the input signal of System 1 is prefiltered by the transmittance $\frac rp$ instead of $r$ for System 2.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2014-06-23T17:16:17.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17009" PostTypeId="1" AcceptedAnswerId="17012" CreationDate="2014-06-23T17:55:46.647" Score="2" ViewCount="5924" Body="&lt;p&gt;I have some trouble to understand what is going on with signal in frequency spectrum when it is time shifted in time spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am hoping that somebody will help me to understand that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks you very much.&lt;/p&gt;&#xA;" OwnerUserId="10201" LastActivityDate="2014-06-24T07:58:32.390" Title="What happens with signal in frequency spectrum when it is time shifted in time spectrum?" Tags="|fourier-transform|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17010" PostTypeId="2" ParentId="17009" CreationDate="2014-06-23T18:45:15.757" Score="3" Body="&lt;p&gt;The magnitude of the FT is unaffected by a time shift of x seconds, i.e. for $f(t-x)$ the phase of the FT is multiplied by $\exp{(-j2 \pi f x)}$.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastEditorUserId="3434" LastEditDate="2014-06-24T07:58:32.390" LastActivityDate="2014-06-24T07:58:32.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17011" PostTypeId="1" AcceptedAnswerId="17017" CreationDate="2014-06-23T19:01:28.673" Score="4" ViewCount="230" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cq2AS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you find the phase and inverse Fourier transform of this frequency spectrum?&lt;/p&gt;&#xA;" OwnerUserId="10258" LastEditorUserId="128" LastEditDate="2018-09-09T10:40:08.800" LastActivityDate="2018-09-09T10:40:08.800" Title="Frequency Spectrum Analysis" Tags="|signal-analysis|frequency-spectrum|dft|frequency-domain|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17012" PostTypeId="2" ParentId="17009" CreationDate="2014-06-23T19:22:23.333" Score="4" Body="&lt;p&gt;Each frequency in the FT of a time shifted waveform is rotated in phase by an amount proportional to the frequency and proportional to the amount of time shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you delay a pure sinusoid by 25% of its period, it's phase referenced to any fixed point in time will change by pi/2 radians.  Delay a slightly higher frequency sinusoid by the same amount of absolute time, and it's phase will change more.  So the phase change will change with frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If looking at a 3d plot of the FT of a time shifted signal, it looks like taking the FT before the time shift and twisting it.  The twist will be linear, e.g. proportional to frequency.  The more time shift, the greater the amount twist per unit of frequency (or twist revolutions per graph width).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-06-23T19:28:02.393" LastActivityDate="2014-06-23T19:28:02.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17013" PostTypeId="2" ParentId="16989" CreationDate="2014-06-23T20:33:25.450" Score="1" Body="&lt;p&gt;This is problematic because I don't see any guarantees that a pair of those chips will provide you with same end-to-end latencies. You can probably cheat a bit if you clock both chips in the pair with the same clock, and provide the pair with a common &lt;em&gt;synchronous&lt;/em&gt; reset signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the end-to-end latency is equal down to a single sample, you can leverage the fact that this chip family can take digital audio input and provide digital audio output. Thus you can sample the audio at a double data rate, and split it digitally between two chips using a bit of discrete logic or a small CPLD. The reverse of this process can be applied at the receiving end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to align the signals at the receiving end in spite of no provisions for this by the chipset itself, you can be inserting synchronization marks (single-sample clicks) at the transmitting end. Those clicks are easy to detect on the receiving end, and can be &quot;fixed&quot; by interpolating over two adjacent samples. If the clicks are sent on a random schedule - say uniformly distributed between 0.5 and 2 seconds, they won't appreciably affect the signal. Any errors from the click removal will be spread-spectrum.&lt;/p&gt;&#xA;" OwnerUserId="8388" LastActivityDate="2014-06-23T20:33:25.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17014" PostTypeId="1" CreationDate="2014-06-23T22:55:35.583" Score="3" ViewCount="1824" Body="&lt;p&gt;I have a question about signal processing. Experienced with embedded design and code, but DSP is in new territory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus far I am using the CMSIS DSP library functions, which are working well. I am sampling a low frequency signal. Using a timer interrupt, the sampling rate is 40x higher than the highest signal I expect to see. The &quot;buffer&quot; size I process is 2048. I first apply a low pass FIR (&lt;code&gt;arm_fir_f32&lt;/code&gt;), and then to the &lt;code&gt;arm_cfft_f32&lt;/code&gt; function so I can then calculate the frequency information. It works well enough to a point where the frequency is +/- 1Hz. However, I am hoping to get this to +/-200mHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that I need to reduce the power (noise) at the endpoints, and the Hann window should be the best (better?) choice. Thus my questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At which point do I apply the Hann algorithm? (as follows)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w[n] = 0.5 - 0.5 \cos \left( \frac{2 \pi n}{N - 1}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should $N$ be the size of my sample block?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code for windowing function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(INPUT_SAMPLES=2048) &#xA;for(uint16_t i = 0; i &amp;lt; INPUT_SAMPLES; i++) &#xA;{ &#xA;    ADC_Values[i] = 0.5 - (0.5 * cos ( (2.0 * PI * ADC_Values[i]) / (INPUT_SAMPLES - 1)));&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help on this,&#xA;Roger&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;jojek,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;creating the window and changing the calculation as suggested has fixed it. Although the window has not improved resolution as much as I'd like, it's better, and close enough to be quite usable. Fantastic...thanks for all the replies everyone.&lt;/p&gt;&#xA;" OwnerUserId="10300" LastEditorUserId="8202" LastEditDate="2014-06-25T22:00:49.457" LastActivityDate="2014-07-03T22:37:09.187" Title="At which point in the signal processing chain to use Hann Window?" Tags="|fft|window-functions|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17015" PostTypeId="2" ParentId="17014" CreationDate="2014-06-23T23:07:51.360" Score="0" Body="&lt;p&gt;The N parameter for the size of the Hann window should be the size of your FFT (or, if you plan on zero-padding the data to use a longer FFT, the size of the sample block).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-23T23:07:51.360" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17016" PostTypeId="2" ParentId="17014" CreationDate="2014-06-23T23:22:53.867" Score="2" Body="&lt;p&gt;You should apply window in &lt;strong&gt;time domain&lt;/strong&gt;. The purpose is to make your signal go to zero at boundaries of your frame/sample block. It is necessary because DFT assumes signal to be periodic, and zeroing it at the ends makes it so. Obviously if length of your frame is constant, then precompute window values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enough words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yrL7M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It just occured to me that you want to get the frequency resolution of 0.2 Hz - is that correct? You must keep in mind that frequency resolution is given by: $\Delta f = \frac{f_s}{N} $. So unless your sampling frequency $f_s$ is not lower than approx. 410 Hz (unlikely) you won't achieve the resolution of 200 mHz. You need to extend your observation window. Also padding your signal with zeros will not help too much - this will be only an interpolation of your spectrum points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you perform any FIR filtering, then apply the window afterwards. Windowing should be done just before the FFT calculation to make your signal 'disappear' at the ends (especially when filtering produces artifacts for first output samples). Regarding your frequency resolution, with 2kHz of $f_s$ and $N$ equal to 2048 you get approximately 0.98 Hz of a resolution. If  you want more than that, then you might think about extending your sample block or decreasing the sampling frequency. Just keep in mind equation I mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presume that the function you pasted (and one I moved to your original question) is only for calculation of window. Do I understand you correctly? Or is it function that is performing windowing of your signal (variable &lt;code&gt;ADC_Values[i]&lt;/code&gt; is present). Check the following things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I corrected your equation for window function - notice that it is&#xA;dependent only on &lt;code&gt;n&lt;/code&gt; - there are no signal samples.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you want to perform windowing within your function then code&#xA;should look more like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ADC_Values[i] = (0.5 - (0.5 * cos ( (2.0 * PI * i) / (INPUT_SAMPLES - 1)))*ADC_Values[i];&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Window calculation itself is given by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`win[i] = (0.5 - (0.5 * cos ( (2.0 * PI * i) / (INPUT_SAMPLES - 1)));`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Therefore I suggest you to precompute the &lt;code&gt;win&lt;/code&gt; once and for all, passing it later to your function and performing &lt;code&gt;ADC_Values[i] *= win[i];&lt;/code&gt;. This will save some time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am assuming that you making typecasting correctly. If you have any doubts, then extract your signal block before and after filtering, together with window samples and windowed signal. This should help you to debug the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am afraid that you still do not understand the principle. Changing of window can only remove leakage effects - kind of noise covering your harmonics. &lt;strong&gt;It will not increase your frequency resolution&lt;/strong&gt;. In the matter of fact, it will make it worse - as rectangular window has narrowest main-lobe. Let me repeat once again - if you want to increase your frequency resolution then you &lt;strong&gt;must use&lt;/strong&gt; the appropriate buffer size and sampling frequency, according to equation $\Delta f = \frac{f_s}{N} $.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-25T22:05:19.443" LastActivityDate="2014-06-25T22:05:19.443" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17017" PostTypeId="2" ParentId="17011" CreationDate="2014-06-24T05:53:48.030" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;The magnitude is given by $ {\left| X \left( f \right) \right|} $ hence it is 6.&lt;/li&gt;&#xA;&lt;li&gt;Assuming all data is given in the graph, the function isn't complex it is only negative -&gt; Phase is -180 degrees.&lt;/li&gt;&#xA;&lt;li&gt;You should use its symmetry. Without over thinking it, It could be generated by a window on the center convolved with 2 deltas (Shifted) -&gt; Sinc in time multiplied by 2 exponentials.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-06-24T07:50:31.463" LastActivityDate="2014-06-24T07:50:31.463" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17018" PostTypeId="2" ParentId="16985" CreationDate="2014-06-24T05:57:50.620" Score="0" Body="&lt;p&gt;I'm not sure about the symbols.&lt;br&gt;&#xA;Yet if you have a function in time as the input of the channel and another function in time which is the output of the channel and assuming the channel doesn't have zeros in the spectrum and the input function as well, the channel Transfer Function is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{{X}_{Out}(f)}{{X}_{In}(f)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, just apply FFT on each, and do element by element division.&lt;br&gt;&#xA;This will give you the DFT of the transfer function.&lt;br&gt;&#xA;Apply IFFT to see the time response function.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-06-24T05:57:50.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17019" PostTypeId="2" ParentId="17009" CreationDate="2014-06-24T07:51:50.360" Score="4" Body="&lt;p&gt;Just to give you yet another way to look at it: try to see what happens to the Fourier transform. If $X(\omega)$ is the Fourier transform (i.e. the spectrum) of $x(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\int_{-\infty}^{\infty}x(t)e^{-j\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the transform of a time-shifted version of $x(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t-\tau)\Longleftrightarrow \int_{-\infty}^{\infty}x(t-\tau)e^{-j\omega t}dt=&#xA;\int_{-\infty}^{\infty}x(t)e^{-j\omega (t+\tau)}dt=&#xA;e^{-j\omega\tau}\int_{-\infty}^{\infty}x(t)e^{-j\omega t}dt=e^{-j\omega\tau}X(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the magnitude of the spectrum remains unchanged, whereas a linear phase term $-\omega\tau$ is added to the original phase.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-24T07:51:50.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17020" PostTypeId="1" AcceptedAnswerId="17022" CreationDate="2014-06-24T08:01:32.890" Score="1" ViewCount="11321" Body="&lt;p&gt;If the difference equation that defines the DT system is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z[n] = (1-x[n]) + (1-y[n]) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we determine in the system is LTI or not when:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$x[n]$ is the input &lt;/li&gt;&#xA;&lt;li&gt;$y[n]$ is the input&lt;/li&gt;&#xA;&lt;li&gt;both are inputs&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Using the definitions is somewhat vague in this case, so I am lost how to &lt;em&gt;explicitly&lt;/em&gt; explain that they are not linear and time invariant for 1 and 2 at least.&lt;/p&gt;&#xA;" OwnerUserId="9061" LastEditorUserId="8202" LastEditDate="2014-06-24T08:30:51.060" LastActivityDate="2014-06-24T09:48:29.667" Title="How to determine if a system is LTI?" Tags="|linear-systems|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17021" PostTypeId="1" CreationDate="2014-06-24T08:07:53.093" Score="3" ViewCount="6978" Body="&lt;p&gt;Here's a sample image of my experiment which is to be processed for finding the information of all the blobs (centre, dimension etc.). Basically the image contains some noise, few bold lines, and of course few blobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NCxQ8.jpg&quot; alt=&quot;resized pic&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/13rktxy4vi89mjg/h120_s%280%29.bmp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Full size image (12Mb)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to program a FPGA using an image processing package &quot;Sapera APF&quot;. Sapera APF is an application for programming Teledyne DALSA frame grabbers to perform image processing. And unfortunately it doesn't allow us to write code in conventional way, neither allows to use basic coding features (if else statements, loops etc.) but only supports some inbuilt functions in form of code blocks, and we can only arrange these blocks.&#xA;FYI, Here's a link to a list of functions supported by Sapera:&#xA;&lt;a href=&quot;https://www.dropbox.com/s/9f5qc9uki0lsalu/sapera_functions.docx&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/9f5qc9uki0lsalu/sapera_functions.docx&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my first objective was to test my algorithm on matlab thereafter implementing it on Sapera. Here is my approach in matlab:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Applied mean filter (for step 3)&lt;/li&gt;&#xA;&lt;li&gt;Thresholded image using adaptive thresholding (returning a binary image)&lt;/li&gt;&#xA;&lt;li&gt;Removed lines by checking connectivity, all lines are connected with above 100 pixels      (for better connectivity mean filter was applied first)&lt;/li&gt;&#xA;&lt;li&gt;Now since only blobs were remaining, their locations were identified (with grayvalue=255) and corresponding pixels were taken in original image.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is a simple algorithm which works fine in matlab. But the real problem is that for step 2 (i.e. connectivity) of course I had to write loops going to each pixel checking for connectivity, which can't be done in Sapera. So I am looking for some other simpler algorithm to separate blobs in my images, without using loops and conditional statement, so that it can be implemented in Sapera, but now I just need its matlab code or algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;I cannot crop out strip containing blobs because other images may contain lines very close (maybe overlapping) to blob. For example, &lt;a href=&quot;https://www.dropbox.com/s/m2j5pqo6stg4s1z/h125_s_-30.bmp&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/s/m2j5pqo6stg4s1z/h125_s_-30.bmp&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10305" LastEditorUserId="10308" LastEditDate="2014-06-24T14:10:31.683" LastActivityDate="2018-08-04T03:02:58.377" Title="An alternative algorithm for blob detection" Tags="|matlab|image-processing|edge-detection|detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17022" PostTypeId="2" ParentId="17020" CreationDate="2014-06-24T09:48:29.667" Score="2" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $z_1[n]$ is the response to input $x_1[n]$ (and $y[n]$ is NOT an input signal), and $z_2[n]$ is the response to $x_2[n]$, then it is straightforward to show that the response to a linear combination $ax_1[n]+bx_2[n]$ is NOT equal to $az_1[n]+bz_2[n]$, which would be a requirement for linearity. And due to symmetry, the same is the case if $y[n]$ is the input (and $x[n]$ is NOT an input signal). The test for time-invariance also fails in both of these cases, because only the input signal is shifted (and not the other nuisance signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When both $x[n]$ and $y[n]$ are input signals, the linearity test above still fails, so the system is non-linear (because it is an affine mapping due to the constants in the system equation). It is, however, time-invariant because if both input signals are shifted by some constant, the output is shifted by the same constant (which is not the case if only one of the two signals is an input signal).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-24T09:48:29.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17023" PostTypeId="2" ParentId="17003" CreationDate="2014-06-24T10:00:25.327" Score="1" Body="&lt;p&gt;The problem is that the B channel in your image is uninformative, and the A channel does not get you where you want to go with clustering by itself. In this case, your subject is circular, so I would use morphological analysis instead of color segmentation. It's easy to detect ellipses and circles with the right software; e.g., Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = Import[&quot;https://i.stack.imgur.com/glbuL.png&quot;]&#xA;cells = SelectComponents[ChanVeseBinarize@img, &quot;FilledCircularity&quot;, # &amp;gt; 0.7 &amp;amp;]&#xA;circles = ComponentMeasurements[ImageMultiply[img, cells], {&quot;Centroid&quot;, &quot;SemiAxes&quot;}][[All, 2]] // &#xA;           List[{#1[[1, 1]], #[[1, 2]] // Reverse}] &amp;amp;&#xA;Show[img, Graphics[{Red, Thick, Circle @@ # &amp;amp; /@ circles}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vz9VW.png&quot; alt=&quot;The binarized image and the overlayed ellipse&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-06-24T10:00:25.327" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17025" PostTypeId="1" CreationDate="2014-06-24T12:38:14.857" Score="1" ViewCount="699" Body="&lt;p&gt;I want to calculate the loudness of a given sound over time (like, in a graph) from its spectrogram. Can I do this from the spectrogram or is it better to do from the raw sound?&lt;/p&gt;&#xA;" OwnerUserId="10174" LastActivityDate="2014-06-24T17:24:03.763" Title="Given a spectrogram, how do I calculate loudness over time?" Tags="|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17026" PostTypeId="2" ParentId="17025" CreationDate="2014-06-24T12:59:16.517" Score="1" Body="&lt;p&gt;Yes, in fact it's not a bad idea at all to use some kind of spectrogram representation to calculate a loudness envelope. Depending on what exactly you need you can either just sum the spectral magnitude over all frequencies at a given time, or first apply some kind of perception based weighting functions &#xA;to make your loudness measure more related to actual auditory perception.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you give some more detail about the application you have in mind you will likely receive a more accurate answer.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-06-24T17:24:03.763" LastActivityDate="2014-06-24T17:24:03.763" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17027" PostTypeId="1" CreationDate="2014-06-24T13:34:43.077" Score="1" ViewCount="505" Body="&lt;p&gt;I need to get position $x$ (integration) from velocity $v$. One could use 1st order Euler integration as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_{t+1} = x_t + \Delta v_t$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, doing so leads to errors proportional to sampling time delta. &#xA;Do you know any more accurate solution please?&lt;/p&gt;&#xA;" OwnerUserId="10309" LastEditorUserId="8202" LastEditDate="2014-06-24T13:56:17.600" LastActivityDate="2014-06-24T13:56:17.600" Title="One of the best ways to numerically integrate a signal?" Tags="|position|integration|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17028" PostTypeId="1" AcceptedAnswerId="17059" CreationDate="2014-06-24T13:54:50.513" Score="0" ViewCount="289" Body="&lt;p&gt;I have just a few questions regarding the rise time of filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A rise time seems to be measured by using a step input, with an input typically from 0 to 1. However this is what I cannot seem to find out...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Does the rise time stay the same if input is from say 0 to 0.5 or some other arbitrary input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;strong&gt;&lt;em&gt;If not&lt;/em&gt;&lt;/strong&gt;, how can I predict the rise time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;strong&gt;&lt;em&gt;If so&lt;/em&gt;&lt;/strong&gt;, what happens if I input 0 to 0.5, hold at 0.5, and then step to 1? Does another rise time occur?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any information!&lt;/p&gt;&#xA;" OwnerUserId="10311" LastActivityDate="2014-08-25T12:52:58.920" Title="About a filter's rise time" Tags="|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17030" PostTypeId="1" CreationDate="2014-06-24T14:03:07.147" Score="1" ViewCount="70" Body="&lt;p&gt;Basically, I'm running a server and two clients of the Unreal Engine and trying to figure out if there is lag in player movement on one of the clients (the clients are different in  way that's not important). For each client I am sampling the (X,Y,Z) location in world space every frame. Here's a sample from one player of frames 577-580:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0037.70] ScriptLog: @@ player  577  Loc  -262.53,565.64,79.15&#xA;[0037.71] ScriptLog: @@ player  578  Loc  -261.30,563.43,79.15&#xA;[0037.72] ScriptLog: @@ player  579  Loc  -260.14,561.10,79.15&#xA;[0037.73] ScriptLog: @@ player  580  Loc  -259.15,558.78,79.15&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;X,Y,Z are independent. So, I have this data for two players and one player does not have lag, and so serves as the reference signal. However the second player is visibly laggy. I think a good informal definition of lag would be &quot;large values between consecutive frames&quot;, but how do I make this notion a little bit more rigorous and also testable in a signal sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an image of the x coordinate of the two signals. The blue player is the normal player, and the red player is the laggy player.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LCS0K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I'm not looking for the time delay between the two signals. Player 2 is programmed to follow Player 1 only to ensure that the trends are the same. If you zoom into the graph above, you can see that the blue line is smooth and the red line is jagged. It's the &quot;relative jaggedness&quot; of the red line that I want to quantify and test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also mention the goal is to identify lag so that the game can start running alternative emergency routines to mitigate the lag.&lt;/p&gt;&#xA;" OwnerUserId="10310" LastEditorUserId="10310" LastEditDate="2014-06-25T02:13:26.483" LastActivityDate="2014-06-25T02:13:26.483" Title="Comparing two signal outputs from two clients on a networked computer game to identify lag" Tags="|classification|software-implementation|distance-metrics|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17031" PostTypeId="2" ParentId="17021" CreationDate="2014-06-24T14:43:47.447" Score="1" Body="&lt;p&gt;Since you have convolution and dilation you can use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Blob_detection&quot; rel=&quot;nofollow&quot;&gt;Laplacian of Gaussian blob detector&lt;/a&gt; to detect the blobs and dilation to find the centre points. In MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sigma = 3;&#xA;&#xA;% Filter image with LoG&#xA;I = double(rgb2gray(imread('NCxQ8.jpg')));&#xA;h = fspecial('log', sigma*6, sigma);&#xA;B = -imfilter(I,h);&#xA;imagesc(B); pause;&#xA;&#xA;% Threshold&#xA;B(B &amp;lt; 5) = 0;&#xA;imagesc(B); pause;&#xA;&#xA;% Dilate then compare to get all &#xA;% local maximum in 3 pixel radius&#xA;Bd = imdilate(B,strel('disk',3));&#xA;imagesc(Bd); pause;&#xA;P = (B == Bd) .* B;&#xA;imagesc(P);&#xA;&#xA;% Get point locations&#xA;loc = find(P &amp;gt; 0);&#xA;fprintf('There are %d blobs\n',numel(loc));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note: &quot;NCxQ8.jpg&quot; is the smaller image embedded in the post. Adjust sigma for larger ones.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2014-06-24T14:43:47.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17032" PostTypeId="1" CreationDate="2014-06-24T15:36:43.057" Score="1" ViewCount="433" Body="&lt;p&gt;As stated by the convolution theorem, a convolution in spatial domain is equivalent to a&lt;br&gt;&#xA;multiplication in the frequency domain.Nevertheless, when should the first be preferred over the latter?&lt;/p&gt;&#xA;" OwnerUserId="10312" LastActivityDate="2014-06-24T18:43:07.163" Title="Convolution theorem" Tags="|convolution|frequency-domain|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17033" PostTypeId="2" ParentId="17032" CreationDate="2014-06-24T15:48:34.770" Score="1" Body="&lt;p&gt;It is very broad question. But few things to remember:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;convolution in time domain is the &lt;strong&gt;linear convolution&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;convolution in frequency domain with usage of DFT is a &lt;strong&gt;circular convolution&lt;/strong&gt;, that's because DFT 'repeats' your signal - assumes it is periodic. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Additionally convolution in time domain is slower than one in frequency domain. It is therefore preferred to do it by FFT. For that case we are using algorithms such as &lt;strong&gt;overlap-add&lt;/strong&gt; and &lt;strong&gt;overlap-save&lt;/strong&gt;. These are widely used for performing of fast filtering or correlation calculation. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-24T15:48:34.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17034" PostTypeId="2" ParentId="13226" CreationDate="2014-06-24T16:16:34.760" Score="1" Body="&lt;p&gt;Your proposed solution - calculating a sinusoid in the time domain based on the peak in the FFT, then subtracting it - should work, but there's an easier way to do essentially the same thing: modify that peak value in the FFT, then take the inverse transform.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for your rasterized video &lt;code&gt;M[nframes, npixels]&lt;/code&gt; you find the frequency bin holding the artifact, then systematically flatten it (e.g., set its magnitude to the average of its neighbors) for every pixel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;nframes, npixels = np.shape(M)&#xA;# Identify the bin containing the sinusoidal artifact&#xA;# Use the average intensity for each image&#xA;m = np.mean(M, axis=1)&#xA;# Calculate the FFT&#xA;Fm = np.fft.rfft(m)&#xA;# Find the largest bin away from the low-frequency region&#xA;lowfreq = 100  # or something&#xA;badbin = lowfreq + np.argmax(Fm[lowfreq:]**2)&#xA;&#xA;# Now adjust the amplitude of that bin in the FFT of each pixel&#xA;for pixel in range(npixels):&#xA;   Fpix = np.fft.rfft(M[:, pixel])&#xA;   # Scale magnitude of artifact bin to be the mean of its neighbors&#xA;   Fpix[badbin] *= np.mean(np.absolute(Fpix[[badbin-1, badbin+1]]))/np.absolute(Fpix[badbin])&#xA;   # Rewrite the time sequence of that pixel&#xA;   M[:,pixel] = np.fft.irfft(Fpix)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should work if the artifact is exactly constant amplitude and frequency, and its frequency falls right on to a submultiple of the sequence length (i.e., the sinusoids represented by the FFT).  In general, you might want to flatten out one or two bins either side of &lt;code&gt;badbin&lt;/code&gt; to deal with a slightly broader set of narrowband corruptions, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# ...&#xA;&#xA;   # Scale magnitude of artifact binS to be the mean of neighbors&#xA;   spread = 3  # flatten bins from (badbin - (spread-1)) to (badbin + (spread-1))&#xA;   # target value for new bins&#xA;   targetmag = np.mean(np.absolute(Fpix[[badbin-spread, badbin+spread]]))&#xA;   bins = range(badbin - (spread-1), badbin + spread)&#xA;   Fpix[bins] *= targetmag/np.abs(Fpix[bins])&#xA;   # ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to constrain the component removed from each pixel to have the same frequency &lt;em&gt;and phase&lt;/em&gt; of the artifact detected in the mean intensity, you could remove just the projection of the &lt;code&gt;badbin&lt;/code&gt; magnitude onto that phase, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;badbinphase = np.angle(Fm[badbin])&#xA;# ...&#xA;&#xA;   Ncomponent = np.abs(Fpix[badbin])*np.cos(np.angle(Fpix[badbin]) - badbinphase)&#xA;   Fpix[badbin] -= Ncomponent * np.exp(0+1j * badbinphase)&#xA;   # ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the resulting component at &lt;code&gt;badbin&lt;/code&gt; will now always be 90\deg phase shifted (orthogonal) from the global &lt;code&gt;badbinphase&lt;/code&gt; in every pixel - any signal component at exactly that frequency and phase cannot be separated from the artifact.&lt;/p&gt;&#xA;" OwnerUserId="9099" LastEditorUserId="9099" LastEditDate="2014-06-25T00:52:41.203" LastActivityDate="2014-06-25T00:52:41.203" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17035" PostTypeId="1" AcceptedAnswerId="17039" CreationDate="2014-06-24T16:46:02.497" Score="2" ViewCount="9838" Body="&lt;p&gt;Convolution is used to find the output when the input and the impulse response is known. I am curious if there is a similar operator, like convolution, or a method that can determine the output of a system. I am asking this question, right of the top of my head, so I don't have any concrete example to apply it to. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am not wrong, one can use deconvolution to find the impulse response and go from there, but this is not what I am searching for.&lt;/p&gt;&#xA;" OwnerUserId="9061" LastEditorUserId="9061" LastEditDate="2014-06-24T17:02:34.000" LastActivityDate="2014-06-25T10:10:33.947" Title="How to find the output of a system with the unit-step response and the input?" Tags="|linear-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17036" PostTypeId="1" CreationDate="2014-06-24T18:17:31.647" Score="-1" ViewCount="111" Body="&lt;p&gt;I have a time-series signal (voltage, specifically) that was divided by 1000 before doing an FFT-based Power Spectral Density (PSD) (using LabView), giving the output in dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: What is the effect of this de-amplification on the validity of the PSD? And how can I amplify it back?&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="8825" LastEditDate="2014-06-24T19:13:31.720" LastActivityDate="2014-06-25T00:45:42.147" Title="Signal de-amplified before doing Power Spectral Density. Any effect?" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17037" PostTypeId="2" ParentId="17032" CreationDate="2014-06-24T18:43:07.163" Score="1" Body="&lt;p&gt;If your data is originally in the time or spatial domain, converting that data into the frequency domain and back has costs (in computational cycles, energy, etc., possibly including some added costs due to any needed zero-padding).  There is also added latency due to both the conversion(s), plus waiting for enough data to make the FFT/IFFT block conversions for overlap-add/save fast-convolution more efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the convolution is short enough, it might cost less (in MACs, cycles, energy, etc.) than the above conversion(s) to do the convolution directly in the time or spatial domain.  And direct convolution can be done on a per-sample basis, potentially minimizing latency by a significant amount, compared to block-based FFT/IFFTs.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-24T18:43:07.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17038" PostTypeId="1" CreationDate="2014-06-24T20:32:19.910" Score="0" ViewCount="42" Body="&lt;p&gt;Given a length-n vector (the elements of vector describe samples of any time changes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are $m$ elements​​, and other values $n-m$ (coming right after the first n elements)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to predict what their value of other $n-m$ elements​​ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know which &lt;strong&gt;prediction method&lt;/strong&gt; is recommended to use for solving the above problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;for example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%create vector of sampling&#xA;Fs= 1/200;&#xA;n=200;&#xA;m=50;&#xA;t=0:Fs:2*pi;&#xA;x=sin(t);&#xA;&#xA;&#xA;%call prediction function &#xA;fprediction(x, Fs ,m); % x:vector, Fs: frequency sampling, m:number of element to predict&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to predict what their value of other n−m (&lt;strong&gt;50&lt;/strong&gt;) elements, relying only on the first 150 elements​​ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use in sampling rate to resolve the problem  is optional&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10259" LastEditorUserId="10259" LastEditDate="2014-06-27T12:05:38.257" LastActivityDate="2014-06-27T12:05:38.257" Title="Prediction values ​​of the vector" Tags="|self-study|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17039" PostTypeId="2" ParentId="17035" CreationDate="2014-06-24T20:58:44.653" Score="4" Body="&lt;p&gt;This can indeed be done. Write the input function $x(t)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=x(-\infty)+\int_{-\infty}^t x^{\prime}(\tau)d\tau=&#xA;x(-\infty)+\int_{-\infty}^{\infty} x^{\prime}(\tau)u(t-\tau)d\tau\tag{1}=\\&#xA;=x(-\infty)+(x^{\prime}*u)(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x^{\prime}(t)$ is the derivative of $x(t)$, and $u(t)$ is the unit step function. From (1), the system's response $y(t)$ to the input $x(t)$ can be written in terms of the step response $a(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=a(\infty)x(-\infty)+\int_{-\infty}^{\infty} x^{\prime}(\tau)a(t-\tau)d\tau\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, apart from the first constant term, the output signal $y(t)$ is given by the convolution of the derivative of the input signal with the system's step response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (2) is valid because the system's response to the constant $x(-\infty)$ is $H(0)x(-\infty)$, where $H(0)$ is the system's frequency response at DC:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(0)=\int_{-\infty}^{\infty}h(t)dt=a(\infty)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The integral on the right-hand side of (2) is the convolution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$((x^{\prime}*u)*h)(t)=(x^{\prime}*(u*h))(t)=(x^{\prime}*a)(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; The discrete-time case is completely analogous. Write the input sequence as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=x[-\infty]+\sum_{k=-\infty}^n(x[k]-x[k-1])=x[-\infty]+\sum_{k=-\infty}^{\infty}(x[k]-x[k-1])u[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This results in the following expression for the output sequence in terms of the step response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[-\infty]a[\infty]+\sum_{k=-\infty}^{\infty}(x[k]-x[k-1])a[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, apart from the constant first term, the output sequence is obtained by convolving the first order difference of the input sequence with the system's step response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-06-25T10:10:33.947" LastActivityDate="2014-06-25T10:10:33.947" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17040" PostTypeId="2" ParentId="17036" CreationDate="2014-06-24T22:40:30.220" Score="-1" Body="&lt;p&gt;Scaling a signal is not problematic and a FFT-based PSD is valid. You can easily scale back in the log scale by adding the appropriate factor. If you have single-sided power spectrum non-DC components have heights of $\frac{A_{k}^2}{2}$ Where $A_{k}$ is peak amplitude at frequency $k$. In your case $\frac{A_{k}^2}{2*1000^2}$ this would mean adding 60 dB to value converted to dBx. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally you must also consider gain of the window function used in FFT calculation if you are calculating power this way. But LabView probably takes care of this things automatically.&lt;/p&gt;&#xA;" OwnerUserId="7828" LastActivityDate="2014-06-24T22:40:30.220" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17042" PostTypeId="2" ParentId="17036" CreationDate="2014-06-25T00:45:42.147" Score="0" Body="&lt;p&gt;For integer data, scaling down a digitized sampled signal by 1000 increases quantization noise by 10 bits.  That may or may not be a significant enough change (in S/N) to affect the accuracy of your subsequent analysis.  It is also an information lossy process that cannot be reversed (unless you also have access to the data before it was scaled down).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above does not apply to data in floating point format before scaling it down, as long as it does not underflow during scaling or analysis.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-25T00:45:42.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17043" PostTypeId="1" CreationDate="2014-06-25T05:58:30.143" Score="0" ViewCount="72" Body="&lt;p&gt;I am designing a schematic in which a Counter is to be increased whenever a particular band of frequencies is received at the Audio input.&#xA;We are receiving the audio input as electrical Signal and I have already designed the bandpass filter with the required passband. How can I design the Counter for the same purpose?&lt;/p&gt;&#xA;" OwnerUserId="7914" LastActivityDate="2014-06-25T14:57:42.380" Title="Counter design for audio signals" Tags="|audio|signal-analysis|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17044" PostTypeId="1" CreationDate="2014-06-25T08:07:08.843" Score="0" ViewCount="162" Body="&lt;p&gt;my field of engineering is condition monitoring. I use vibration analysis to determine the current state of health of a machine and then recommend any course of action required to ensure it does not fail during a production period. See www.efftek-uk.com for further description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most important tool I have is ESP which stands for envelope signal processing in other words, demodulation. The instrument I use to collect my vibration readings does this in the analog realm. The steps involved in this are as follows. The signal from the accelerometer is first passed through a high pass filter, then it is rectified and finally passed through a low pass filter before acquisition. The values of the LP and HP filters are selected according to the speed of the machine being tested for instance 2.5 &amp;amp; 5 kHz filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another point which may not be relevant is that in VA, we use spectras with multiples of 400 lines, the top 112, 224 etc. are discarded for anti-aliasing. For example, we would use a 2.5-5kHz ESP filter and take 1024 samples at 1280 samples per second giving us a 512 line spectra of 0-640Hz and a final 400 line spectra of 0-500Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have developed an ADC board for the Raspberry Pi (available of eBay at £19.50 - shameless advertising!!!) which was originally for use with displacement sensors so I could plot shaft centreline positions during operation of a gearbox to detect bending forces. I have decided to experiment using the board with MEMS accelerometers and would like to try and emulate what my very expensive data collector does in the analog realm with DSP. This is where I would like some advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already written code to sample, window and do fft's so I can look at the unfiltered acceleration and velocity spectras. Now I would like to implement filtering especially demod filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did read a thesis paper a while ago from a Swedish student who did demodulation using matlab and his results were encouraging but a) I don't have matlab and b) I can't find his paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want anyone to write my code for me (but I may be back if my code doesn't seem to be living up to expectations) I simply want some advice on the process involved in DSP demodulation - is it the same as I mentioned above - HP filter, turn all values positive (rectification) then LP filter followed by FFT? and if so, what filters do I use - as a newbie to DSP, I don't know the difference between IIR and FIR etc. - what should I use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am coding on the Pi in C++ and have installed the Aquila-DSP library though as of yet, I haven't made use of it, I wrote the window function myself as the only window recommended for VA is Hanning and that was quite straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading, any advice will be gratefully accepted and do go to eBay if you are interested in an 8 channel 12 bit ADC with trimmers so the input voltage can be calibrated for each channel up to 0-20V for the Raspberry Pi.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best wishes, Steve.&#xA;s.ferry @ efftek-uk.com&lt;/p&gt;&#xA;" OwnerUserId="10318" LastActivityDate="2014-06-25T08:07:08.843" Title="DSP Demodulation advice sought - please help" Tags="|fft|filters|demodulation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17045" PostTypeId="2" ParentId="17043" CreationDate="2014-06-25T11:24:11.940" Score="-3" Body="&lt;pre&gt;&lt;code&gt;def doppler(x):&#xA;    &quot;&quot;&quot;&#xA;    Parameters&#xA;    ----------&#xA;    x : array-like&#xA;        Domain of x is in (0,1]&#xA;&#xA;    &quot;&quot;&quot;&#xA;    if not np.all((x &amp;gt;= 0) &amp;amp; (x &amp;lt;= 1)):&#xA;        raise ValueError(&quot;Domain of doppler is x in (0,1]&quot;)&#xA;    return np.sqrt(x*(1-x))*np.sin((2.1*np.pi)/(x+.05))&#xA;&#xA;def blocks(x):&#xA;    &quot;&quot;&quot;&#xA;    Piecewise constant function with jumps at t.&#xA;&#xA;    Constant scaler is not present in Donoho and Johnstone.&#xA;    &quot;&quot;&quot;&#xA;    K = lambda x : (1 + np.sign(x))/2.&#xA;    t = np.array([[.1, .13, .15, .23, .25, .4, .44, .65, .76, .78, .81]]).T&#xA;    h = np.array([[4, -5, 3, -4, 5, -4.2, 2.1, 4.3, -3.1, 2.1, -4.2]]).T&#xA;    return 3.655606 * np.sum(h*K(x-t), axis=0)&#xA;&#xA;def bumps(x):&#xA;    &quot;&quot;&quot;&#xA;    A sum of bumps with locations t at the same places as jumps in blocks.&#xA;    The heights h and widths s vary and the individual bumps are of the&#xA;    form K(t) = 1/(1+|x|)**4&#xA;    &quot;&quot;&quot;&#xA;    K = lambda x : (1. + np.abs(x)) ** -4.&#xA;    t = np.array([[.1, .13, .15, .23, .25, .4, .44, .65, .76, .78, .81]]).T&#xA;    h = np.array([[4, 5, 3, 4, 5, 4.2, 2.1, 4.3, 3.1, 2.1, 4.2]]).T&#xA;    w = np.array([[.005, .005, .006, .01, .01, .03, .01, .01, .005, .008, .005]]).T&#xA;    return np.sum(h*K((x-t)/w), axis=0)&#xA;&#xA;def heavisine(x):&#xA;    &quot;&quot;&quot;&#xA;    Sinusoid of period 1 with two jumps at t = .3 and .72&#xA;    &quot;&quot;&quot;&#xA;    return 4 * np.sin(4*np.pi*x) - np.sign(x - .3) - np.sign(.72 - x)&#xA;In [5]:&#xA;x = np.linspace(0,1,2**11)&#xA;dop = doppler(x)&#xA;blk = blocks(x)&#xA;bmp = bumps(x)&#xA;hsin = heavisine(x)&#xA;In [6]:&#xA;fig, axes = plt.subplots(2, 2, figsize=(10,10))&#xA;ax1 = axes[0,0]&#xA;ax2 = axes[0,1]&#xA;ax3 = axes[1,0]&#xA;ax4 = axes[1,1]&#xA;&#xA;ax1.plot(x,dop)&#xA;ax1.set_title(&quot;Doppler&quot;)&#xA;&#xA;ax2.plot(x,blk)&#xA;ax2.set_title(&quot;Blocks&quot;)&#xA;&#xA;ax3.plot(x,bmp)&#xA;ax3.set_title(&quot;Bumps&quot;)&#xA;&#xA;ax4.set_title(&quot;HeaviSine&quot;)&#xA;ax4.plot(x,hsin)&#xA;&#xA;for ax in fig.axes:&#xA;    ax.tick_params(labelbottom=False, labelleft=False, bottom=False, &#xA;                   top=False, left=False, right=False)&#xA;&#xA;fig.tight_layout();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10321" LastEditorUserId="8202" LastEditDate="2014-06-25T14:57:42.380" LastActivityDate="2014-06-25T14:57:42.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17046" PostTypeId="1" CreationDate="2014-06-25T12:25:02.247" Score="1" ViewCount="513" Body="&lt;p&gt;I am currently replacing a hand-made image processing library by OpenCV. The programmer who worked on this library had implemented the sobel gradient function. This implementation is right except that he first converts his image to grayscale with the formula thereafter (the arithmetic mean):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = 0.333 * R + 0.333 * G + 0.333 * B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In OpenCV, I see that they use the formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = 0.299 * R + 0.587 * G + 0.114 * B&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To convert an image to grayscale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the hand-made implementation wrong or can it be motivated by some purpose. Should I always use the OpenCV conversion version?&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2014-06-29T06:50:28.333" Title="Grayscale conversion before applying sobel gradient operator" Tags="|opencv|conversion|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17047" PostTypeId="2" ParentId="17046" CreationDate="2014-06-25T13:12:08.543" Score="1" Body="&lt;p&gt;The values used by OpenCV are &lt;a href=&quot;http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems&quot; rel=&quot;nofollow&quot;&gt;values used by Luma coding in video systems&lt;/a&gt;. Your original code just used an equal weight for each channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may or may not be important for your application (probably not really).&lt;/p&gt;&#xA;" OwnerUserId="163" LastEditorUserId="163" LastEditDate="2014-06-29T06:50:28.333" LastActivityDate="2014-06-29T06:50:28.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17048" PostTypeId="2" ParentId="17046" CreationDate="2014-06-25T15:14:07.013" Score="1" Body="&lt;p&gt;The correct way to compute the luminance depends on how the color primaries (red, green blues) were defined when capturing the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients in OpenCV are taken from the CCIR 601 recommendation (and there are other similar standards).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The arithmetic average is more a Q&amp;amp;D approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @Adi said, the nuance is probably qualitatively unimportant for you, except if you need identical reproduction of the results.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2014-06-25T15:14:07.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17049" PostTypeId="1" AcceptedAnswerId="17055" CreationDate="2014-06-25T17:21:17.250" Score="3" ViewCount="244" Body="&lt;p&gt;I have a bunch of data that went through a hardware filter before being digitized. The data has been taken this way for quite some time, and everyone is fine with that. Now, there is a new application in development that requires unfiltered data. Rather than wait a year to collect new data, we would like to &quot;unfilter&quot; this old data. The transfer function of the hardware filter is: $$H(s)=\dfrac{24.2s+1}{2.2s+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first throught was to take the inverse of this transfer function, and go straight to the z domain by applying the Eurler approximation. $$f_s=30Hz$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\dfrac{67-66z^{-1}}{727-726z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Converted to the difference equation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$V_{in}[n]=10.8507V_{out}[n]-10.8538V_{out}[n-1]+0.9851V_{in}[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've run data through that difference equation in Scilab, and got a result. I want to validate the difference equation by running the result through the difference equation of the original filter, but I haven't been able to get the original data out of the second difference equation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which leads me to question, is what I've done here even valid? Is what I'm trying to do even possible?&lt;/p&gt;&#xA;" OwnerUserId="3495" LastEditorUserId="3495" LastEditDate="2014-06-25T20:21:56.807" LastActivityDate="2014-06-26T00:53:04.967" Title="Digitally undoing a hardware filter" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17052" PostTypeId="2" ParentId="16913" CreationDate="2014-06-25T21:39:45.427" Score="0" Body="&lt;p&gt;I did it by creating a convolution kernel, then FFT the kernel, FFT the projection file, then multiply these two, then do IFFT to the product. Then the result of the IFFT is the filtered backprojection.&lt;/p&gt;&#xA;" OwnerUserId="10249" LastActivityDate="2014-06-25T21:39:45.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17054" PostTypeId="2" ParentId="17028" CreationDate="2014-06-26T00:27:33.517" Score="1" Body="&lt;p&gt;The rise time of a low pass filter is proportional to its bandwidth. A good estimate is: rise time = 0.35 / bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this link form Kansas State University for a nice derivation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.k-state.edu/ksuedl/publications/Technote%202%20-%20Bandwidth%20and%20Risetime.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.k-state.edu/ksuedl/publications/Technote%202%20-%20Bandwidth%20and%20Risetime.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question regarding the amplitude of the signal indicates you need to read up on the definition of rise time. The above article should help you.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastEditorUserId="5108" LastEditDate="2014-06-26T12:14:16.130" LastActivityDate="2014-06-26T12:14:16.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17055" PostTypeId="2" ParentId="17049" CreationDate="2014-06-26T00:53:04.967" Score="1" Body="&lt;p&gt;Using the Euler approximation, the mapping between the $s$-plane and the $z$-plane would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  s \rightarrow \frac{z - 1}{T}&#xA;$$&#xA;where $1/T = f_s = 30$ (thus $s \rightarrow 30(z-1)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting back in the original transfer function yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;  H(z) &amp;amp;= \frac{24.2\cdot 30 (z-1) + 1}{2.2\cdot 30 (z-1) + 1} \\&#xA;       &amp;amp;= \frac{726 (z-1) + 1}{66 (z-1) + 1} \\&#xA;       &amp;amp;= \frac{726z - 725}{66z-65} \\&#xA;       &amp;amp;= \frac{726 - 725z^{-1}}{66-65z^{-1}}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which converted to a difference equation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V_{in}[n] \approx 0.0909V_{out}[n] - 0.0895V_{out}[n-1] + 0.9986V_{in}[n-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as whether retrieving the original signal is possible partly depends on whether the original signal did not in fact include significant energy above $f_s/2$. &lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2014-06-26T00:53:04.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17057" PostTypeId="1" AcceptedAnswerId="17127" CreationDate="2014-06-26T02:14:33.833" Score="1" ViewCount="964" Body="&lt;p&gt;To reduce out of band energy, it is common to apply a Raised Cosine filter to the front and back of an OFDM symbol. It is also common to overlap the windowed portions of adjacent symbols to eliminate amplitude dips.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an OFDM symbol consisting of a Cyclic Prefix followed by NFFT points from an IFFT, is it common to insert an additional prefix and suffix for the windowed portion? If that isn't done then the CP and the IFFT data are shaped by the window, distorting the constellation. A pretty good description of what I am talking about is here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/373725A-01/wlangen/windowing/&quot; rel=&quot;nofollow&quot;&gt;http://zone.ni.com/reference/en-XX/help/373725A-01/wlangen/windowing/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-06-30T11:59:39.130" Title="Additional prefix and suffix required when windowing an OFDM symbol?" Tags="|ofdm|window|cosine|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17058" PostTypeId="1" CreationDate="2014-06-26T03:33:56.893" Score="5" ViewCount="355" Body="&lt;p&gt;For linear time-frequency representation, the resolution is limited by &lt;a href=&quot;https://en.wikipedia.org/wiki/Gabor_limit#Signal_processing&quot; rel=&quot;noreferrer&quot;&gt;Gabor limit&lt;/a&gt;. However, if interference is allowed, the resolution may be higher. What is the possible resolution in such a case? In &quot;Electroencephalography Feature Extraction Using High Time-Frequency Resolution Analysis &quot;, they stated &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We  all  know  that  the  Wigner-Ville  distribution  achieves  to  the  lower  bound  of  the &#xA;  uncertainty  principle  and  have  the  highest  resolution  in  all  time-frequency  distributions&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is this statement true?&lt;/p&gt;&#xA;" OwnerUserId="7602" LastActivityDate="2014-08-25T08:52:55.250" Title="Does Wigner-Ville distribution provide the highest resolution?" Tags="|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17059" PostTypeId="2" ParentId="17028" CreationDate="2014-06-26T06:48:26.877" Score="2" Body="&lt;p&gt;When a system is &lt;strong&gt;linear&lt;/strong&gt;, effects are proportional to causes. You can multiply the input by any constant, you'll get the same output multiplied by the same constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at how the rise time is defined, you'll see that it is independent of any amplification factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also add two inputs, and the output will be the sum of the separate outputs corresponding to the separate inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it you apply a second, delayed step, there can be two situations&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;steady state (constant output) has been reached after the first step: then you can consider two distinct rises with equal times;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;steady state has not been reached yet: there is a single, combined rise, with a different rise time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2014-06-26T07:01:59.550" LastActivityDate="2014-06-26T07:01:59.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17060" PostTypeId="1" AcceptedAnswerId="17061" CreationDate="2014-06-26T07:11:50.277" Score="0" ViewCount="2409" Body="&lt;p&gt;I would like to know, why does the periodic signal in time always give a discrete frequency spectrum in FT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the equations, but I simply dont understand why is it so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="10201" LastActivityDate="2014-06-26T07:50:34.020" Title="Why does the periodic signal in time always give a discrete frequency spectrum" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17061" PostTypeId="2" ParentId="17060" CreationDate="2014-06-26T07:50:34.020" Score="2" Body="&lt;p&gt;Here's an intuitive explanation if the convolution theorem is taken for granted:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the time-domain signal is periodic, one can say that it can be built by &quot;copying and pasting&quot; the same block of signal every period: your periodic signal can be expressed as a little block of signal (spanning one period) &lt;strong&gt;convolved&lt;/strong&gt; with a dirac comb.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, its Fourier transform will be the Fourier transform of the little block &lt;strong&gt;multiplied&lt;/strong&gt; by the Fourier transform of a Dirac comb (which is another Dirac comb). Multiplying a continuous signal by a Dirac comb yields a discrete signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same reasoning is also true the other way round (discrete in time implies periodic in frequency).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-06-26T07:50:34.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17062" PostTypeId="2" ParentId="17058" CreationDate="2014-06-26T08:07:52.893" Score="3" Body="&lt;p&gt;The statement is true if you restrict it to all TF distributions in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_time%E2%80%93frequency_distribution&quot; rel=&quot;nofollow&quot;&gt;Cohen Class&lt;/a&gt;. That is rather easy to see, because the Wigner distribution generates all other distribution in that class by convolution with a non-negative time frequency kernel and therefore attains the minimal uncertainty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond the Cohen class things get much more complicated. First of all, the very simple concept of uncertainty in the Cohen class is not necessarily useful for non-bilinear distributions. So it's not obvious how to even generalise the question. So statements that attempt to be more general than the Cohen class first need some clarification about mathematical terminology and possibly even concepts. Outside the Cohen class you will also find distributions without time-frequency translation invariance. If they're bilinear they can have a TF uncertainty that is just as good as the Wigner-Ville distribution. Dropping bilinearity too, you can even beat WV with reassignment distributions of all sorts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So summing up, the statement is true with the (possibly implcit) restriction to the Cohen class, which is the most common theoretical framework for TF distributions. Without that restriction it is not accurate.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-06-26T08:07:52.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17063" PostTypeId="1" CreationDate="2014-06-26T09:07:06.813" Score="1" ViewCount="117" Body="&lt;p&gt;I'm working on a project on which we use WebRTC and the RecordRTC library to record audio files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to be able to process the audio files server-side to ensure a good synchronisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do so, I'm thinking about marking the start of each record with an inaudible sound marker in order to analyse new records and then manipulate the starting offset with ffmpeg (which I already use to compress the raw files created by RecordRTC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is I've never done any advanced audio processing before, I'm looking around and cannot find what would be the proper way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there another, better, way to handle synchronisation? And if not, I would be grateful if I could get some tips on the marker technique. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I forgot to mention for those who don't know how RecordRTC works that the record is done client-side in Javascript. The synchronisation issue comes from the fact that javascript is not good at synchronising calls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process is done as follow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) A user records himself&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[User 1] -&gt; Records on his browser an audio file -&gt; Saves raw audio file (call it audio_1.ogg) -&gt; [Server]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) Another user wants to join user_1's project&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[User 2]  &amp;lt;--- Fetch audio_1.ogg (in an audio html tag) --- [Server] -&gt; Press record&#xA; -&gt; [Webapp] Plays audio_1.ogg and starts recording audio_2.ogg -&gt; Saves audio_2.ogg when record is over -&gt;[Server]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The synchronisation issue comes from the fact that there are no way in Javascript to ensure that both the functions handling that starts record and the one responsible for beginning playing the existing audio file happen on the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I end up with ~50/100 ms of gap depending on how many audio files are already on the project (since it's not limited to two).&lt;/p&gt;&#xA;" OwnerUserId="10330" LastActivityDate="2014-06-26T09:07:06.813" Title="How to synchronise two audio files using a marker" Tags="|audio|signal-analysis|sound|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17067" PostTypeId="1" CreationDate="2014-06-26T15:40:41.120" Score="0" ViewCount="800" Body="&lt;p&gt;I have a  matrix [66 x 100,000] (it's some EEG data, across 66 electrodes) and want to find the mean power in the 8-13hz range. How can I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have so far: &lt;code&gt;x = fft(data)&lt;/code&gt; What do I have to do next?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, when I plot this I get the following:&lt;img src=&quot;https://i.stack.imgur.com/2tJT0.png&quot; alt=&quot;enter image description here&quot;&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping for something more like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t4qKt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10334" LastActivityDate="2022-07-13T10:06:45.650" Title="I have run an FFT now want to get the mean value in the 8hz - 13hz range?" Tags="|matlab|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17068" PostTypeId="2" ParentId="17067" CreationDate="2014-06-26T16:08:45.230" Score="1" Body="&lt;p&gt;Did you ever tried to follow example from MATLAB help? Result of the FFT is complex, containing information both for magnitude and phase. Thus in order to extract the magnitude you must take the absolute value of your result - &lt;code&gt;abs&lt;/code&gt; function. What you are doing currently is plotting complex values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please refer to basics of DFT if you have any doubts (i.e. to understand why DFT spectrum is mirrored) and mentioned example for &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/fft.html&quot; rel=&quot;nofollow&quot;&gt;MATLAB fft&lt;/a&gt;. Here is one of ways to create frequency vector for magnitude response.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% fs --&amp;gt; sampling frequency to be defined.&#xA;N = length(data);&#xA;X = abs(fft(data))/N;&#xA;f = (0:N-1).*(fs/N);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wish to show your results in decibel scale, then convert the values with usage of &lt;code&gt;20*log10(X/ref);&lt;/code&gt; where &lt;code&gt;ref&lt;/code&gt; is your reference value - can be &lt;code&gt;max(abs(X))&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure that having the frequency vector and magnitude values you can take it from here in order to calculate the mean value in appropriate range. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extra things you might want to consider: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply the windowing to your signal if it is necessary (probably it is). When windowing is applied, scale not by &lt;code&gt;N&lt;/code&gt;, but use the sum of window samples.&lt;/li&gt;&#xA;&lt;li&gt;Use the Power Spectral Density estimation instead of FFT. Second figure you provided is the example of PSD - in fact this is copied from MATLAB help regarding &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ug/psd-estimate-using-fft.html&quot; rel=&quot;nofollow&quot;&gt;PSD estimates using FFT&lt;/a&gt;. I believe you have all necessary info in there regarding &lt;code&gt;periodogram&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-26T16:18:11.377" LastActivityDate="2014-06-26T16:18:11.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17070" PostTypeId="2" ParentId="13261" CreationDate="2014-06-26T18:39:13.287" Score="2" Body="&lt;p&gt;Most fixed-point DSP chips have 16, 24 or 32 bit integer operations. That said, most of them also provide fixed-point DSP libraries that usually operate in a specific Q format. For example, some 24-bit arithmetic chips (e.g. Wolfson) supplies a DSP library that operates on Q3.20 fixed-point numbers.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-06-26T18:39:13.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17071" PostTypeId="1" CreationDate="2014-06-27T02:29:55.380" Score="1" ViewCount="196" Body="&lt;p&gt;The 2D discrete image signal's quaternionic fourier transform can be described as F(u,v), and its 2D analytic signal often be described as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F_q(u,v) = (1 + \mbox{sgn}(u))(1 + \mbox{sgn}(v)) F(u,v)  &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mbox{sgn}(u) \triangleq&#xA;\begin{cases}&#xA;1&amp;amp;, u&amp;gt;0\\&#xA;0&amp;amp;, u=0\\&#xA;-1&amp;amp;, u&amp;lt;0&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F_q(u,v)$: quaternionic analytic signal, F is the fourier trans of f)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;QQF(u,v) = (1 + \mbox{sgn}(u))(1 + \mbox{sgn}(v)) F(u,v) H_b(u,v)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$QQF(u,v)$: quaternionic quadrature filter;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$F(u,v)$: quaternionic fourier transform of image $f(x,y)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_b(u,v)$: a band-pass filter, i.e. log-gabor, cauchy, 2d gaussian derivative filter, .etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in many papers, after the define of quaternionic analytic signal, the author usually gives a specific quaternionic filter (such as quaternionic gabor filter, or quaternionic log-gabor filter) in image processing to demonstrate the useful of this method. (such as use this quaternionic quadrature filter for a image filtering)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;after fourier transform, when will u&amp;lt;0.&lt;/li&gt;&#xA;&lt;li&gt;what is the meaning of this quaternionic analytic signal&lt;/li&gt;&#xA;&lt;li&gt;How to implement the code of quaternion gabor filtering(QGF) with matlab?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: maybe my understanding of this concept is weak, and welcome to give a specific detailed demonstration.&lt;/p&gt;&#xA;" OwnerUserId="10338" LastEditorUserId="10338" LastEditDate="2014-06-27T09:13:04.610" LastActivityDate="2014-06-27T09:13:04.610" Title="How to get the quaternionic analytic signal of a image?" Tags="|image-processing|fourier-transform|hilbert-transform|analytic-signal|quadrature|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17074" PostTypeId="1" CreationDate="2014-06-27T10:24:19.387" Score="0" ViewCount="246" Body="&lt;p&gt;I am working on a system processing ultrasonic echo reflection. The transmitter creates a short ultrasonic pulse and the receiver analyses the reflection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I send two pulses (back to back or with some small defined delay) I receive two superimposed reflections.&#xA;I can process these superimposed reflection with the IIR filter described in this post:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/14951/trivial-echo-separation&quot;&gt;Trivial echo separation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to restore the single reflection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, could I get a signal with better signal to noise ratio by using two or more transmit pulses compared to the signal from a single pulse? &lt;/p&gt;&#xA;" OwnerUserId="10331" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-09-28T10:14:48.050" Title="Could multiple echo reflections be combined to improve signal to noise ratio?" Tags="|filters|signal-analysis|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17075" PostTypeId="1" AcceptedAnswerId="17076" CreationDate="2014-06-27T10:57:18.143" Score="0" ViewCount="43" Body="&lt;p&gt;I have the following vector:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%create vector of sampling&#xA;t=0:pi/100:2*pi;&#xA;x=sin(t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the sampling frequency (of this vector) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10259" LastActivityDate="2014-06-28T18:23:00.710" Title="Identification of sampling frequency" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17076" PostTypeId="2" ParentId="17075" CreationDate="2014-06-27T11:06:40.827" Score="0" Body="&lt;p&gt;A discrete sine wave is defined as&#xA;$$\sin (2\pi  f n)$$&#xA;Now your index is &lt;code&gt;n=2*pi*(0:1/200:1)&lt;/code&gt;. This means your sampling frequency is 200Hz. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastEditorUserId="8202" LastEditDate="2014-06-28T18:23:00.710" LastActivityDate="2014-06-28T18:23:00.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17077" PostTypeId="2" ParentId="13261" CreationDate="2014-06-27T11:28:36.433" Score="0" Body="&lt;p&gt;The choice of bits is specific to the algorithm and the perfomance required from it. For example an echo cancellation algorithm might not work at all at 8 bit or 12 bit precision and we might need to go for 16 or 24 bit precision. Usually we search of lowest number of bits that can satisfy our requirements. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-06-27T11:28:36.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17078" PostTypeId="1" CreationDate="2014-06-27T11:42:29.680" Score="0" ViewCount="143" Body="&lt;p&gt;I am trying to estimate the fundamental frequency in a signal to corroborate the result which I have got by FPGA implementation of an FFT algorithm. Hence, could someone give me some idea how to do so?&lt;/p&gt;&#xA;" OwnerUserId="10342" LastActivityDate="2014-06-27T13:04:18.173" Title="What are some ways to detect the fundamental frequency in a signal using without using FFT?" Tags="|fft|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17079" PostTypeId="1" AcceptedAnswerId="17082" CreationDate="2014-06-27T12:13:39.853" Score="1" ViewCount="36" Body="&lt;p&gt;How to create a vector of random numbers(in Matlab), when each value is [0,1] .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the sampling rate should be fixed ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="10259" LastActivityDate="2014-06-27T13:13:12.503" Title="Vector of random numbers with fixed sampling rate" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17080" PostTypeId="1" AcceptedAnswerId="17083" CreationDate="2014-06-27T12:47:30.533" Score="0" ViewCount="193" Body="&lt;p&gt;I have a question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have a signal $x(n)$, length (samples) $N=400$ which have been sampled with $f_s=8000 \mathtt{Hz}$. Also suppose $X(k)$ - the DFT transform of this signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many zeros we must add at the end of $x(n)$ in order to change the frequency resolution of the DFT to $1 \mathtt{Hz}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: Is $7600$ zeros the right answer? Because $\Delta f = \frac{f_s}{N}$, so: $$1\mathtt{Hz} = \frac{8000}{x+400} \Rightarrow x=7600$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, I appreciate.&lt;/p&gt;&#xA;" OwnerUserId="10343" LastEditorUserId="8202" LastEditDate="2014-06-27T16:42:32.283" LastActivityDate="2014-06-29T23:33:51.003" Title="Signal Resolution" Tags="|dft|resolution|zero-padding|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17081" PostTypeId="2" ParentId="17078" CreationDate="2014-06-27T13:04:18.173" Score="1" Body="&lt;ul&gt;&#xA;&lt;li&gt;Count the time interval between zero-crossings (if the waveform/SNR allows...).&lt;/li&gt;&#xA;&lt;li&gt;Autocorrelation, average magnitude difference function and their variants (YIN...).&lt;/li&gt;&#xA;&lt;li&gt;Estimating the parameters of a damped sinusoids model (MUSIC/ESPRIT).&lt;/li&gt;&#xA;&lt;li&gt;Several instances of Goertzel algorithm, or more generally other filterbanks (band-pass, comb) - in case there is only a small number of candidate frequencies that you want to discriminate.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-06-27T13:04:18.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17082" PostTypeId="2" ParentId="17079" CreationDate="2014-06-27T13:13:12.503" Score="1" Body="&lt;p&gt;Sampling rate doesn't change anything. Simply call &lt;a href=&quot;http://www.mathworks.co.uk/help/matlab/ref/rand.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;rand&lt;/strong&gt;&lt;/a&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1, N);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-06-27T13:13:12.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17083" PostTypeId="2" ParentId="17080" CreationDate="2014-06-27T13:20:22.660" Score="1" Body="&lt;p&gt;One very important thing - zero padding &lt;strong&gt;does not increase&lt;/strong&gt; your spectral resolution. What does matter is how many meaningful samples is in your signal ($N=400$). This is defining your frequency resolution, which is in fact 20Hz. Adding extra zeros to your signal is only interpolating values between your frequency bins - what you will observe is the side-lobes of your window. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To wrap up - if you want to increase the spectral resolution then you must take a longer analysis window. Below you have example of spectrum for simple rectangular signal (blue) and zero padded version with factor of 10 (red). Sampling frequency is 10 Hz. You can see that you are interpolating samples of &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sinc function&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4REmL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-27T13:59:10.730" LastActivityDate="2014-06-27T13:59:10.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17084" PostTypeId="2" ParentId="16933" CreationDate="2014-06-27T13:40:35.733" Score="-1" Body="&lt;p&gt;They implemented each one separately, then compared their results to each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CIyIM.jpg&quot; alt=&quot;Repeatibility scores&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FH-9  ---&gt;  it's a detector that it's initial filter size is 9x9&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FH-15 --&gt;  it's a detector that it's initial filter size is 15x15&lt;/p&gt;&#xA;" OwnerUserId="8956" LastActivityDate="2014-06-27T13:40:35.733" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17085" PostTypeId="1" CreationDate="2014-06-27T14:27:49.580" Score="-2" ViewCount="310" Body="&lt;p&gt;Is it possible to compute the output from one linear time invariant system which unit impulse sequence is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(n) = \left(\frac{1}{3}\right)^nu(n)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the entry in the system is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=u(n)-u(n-2)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u(n)$ is the unit step sequence?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or I need more information (so something missing)&lt;/p&gt;&#xA;" OwnerUserId="10343" LastEditorUserId="8202" LastEditDate="2014-06-27T14:33:36.653" LastActivityDate="2014-06-27T16:29:17.800" Title="Compute output of a LTI system" Tags="|linear-systems|" AnswerCount="1" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17086" PostTypeId="1" AcceptedAnswerId="17091" CreationDate="2014-06-27T14:40:57.310" Score="2" ViewCount="1127" Body="&lt;p&gt;I am reading the &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiki for DFT&lt;/a&gt;. There is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Convolution_theorem_duality&quot; rel=&quot;nofollow noreferrer&quot;&gt;part&lt;/a&gt; for circular convolution theorem which sounds a bit odd saying:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathcal{F} \left \{ \mathbf{x\cdot y} \right \}_k \ \stackrel{\mathrm{def}}{=} \sum_{n=0}^{N-1} x_n \cdot y_n \cdot e^{-\frac{2\pi i}{N} k n}&#xA;=\frac{1}{N} (\mathbf{X * Y_N})_k, \,$$ &amp;nbsp; which is the circular convolution of $\mathbf{X}$ and $\mathbf{Y}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel it's incorrect because writing $y_n$ in Fourier basis, and multiplying it by $e^{-\frac{2\pi i}{N} k n}$ will result in a shift in index by $k$, and that means the result should be the cross-corrolation of two signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And secondly if either this or my argument is correct why this does not hold for continuous signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. The question has been asked &lt;a href=&quot;https://math.stackexchange.com/questions/849503/discrete-fourier-transform-and-opposite-convolution-theorem&quot;&gt;here&lt;/a&gt; as well since I was unaware of the most proper domain for my question.&lt;/p&gt;&#xA;" OwnerUserId="9065" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2014-06-27T18:17:35.697" Title="Discrete Fourier Transform and Opposite Convolution Theorem" Tags="|fourier-transform|convolution|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17089" PostTypeId="1" CreationDate="2014-06-27T16:10:49.100" Score="0" ViewCount="849" Body="&lt;p&gt;I am currently writing my bachelors thesis about on-line handwriting recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this context, there are different methods to make the input data more useful to classifiers / to make learning more effective:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Scaling the drawn symbol&lt;/li&gt;&#xA;&lt;li&gt;Shifting the drawn symbol&lt;/li&gt;&#xA;&lt;li&gt;Rotating&lt;/li&gt;&#xA;&lt;li&gt;Re-sampling&lt;/li&gt;&#xA;&lt;li&gt;Wild point detection&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think all of those techniques are preprocessing, because I apply them before the image is &quot;processed&quot; by the training / recognition algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But aren't all of those techniques also normalization techniques? &#xA;Where is the difference between &quot;preprocessing&quot; and &quot;normalization&quot;?&lt;/p&gt;&#xA;" OwnerUserId="9101" LastActivityDate="2014-06-27T16:10:49.100" Title="What is the difference between &quot;preprocessing&quot; and &quot;normalization&quot;?" Tags="|machine-learning|preprocessing|normalization|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17090" PostTypeId="2" ParentId="17085" CreationDate="2014-06-27T16:29:17.800" Score="1" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=\delta(n)+\delta(n-1)\Longrightarrow y(n)=h(n)+h(n-1)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-27T16:29:17.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17091" PostTypeId="2" ParentId="17086" CreationDate="2014-06-27T18:17:35.697" Score="1" Body="&lt;p&gt;I'm not sure I understand your argument, but here's a proof which should make the relationship clear:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$IDFT\left\{\frac{1}{N}(X*Y_N)_k\right\}=\frac{1}{N^2}\sum_{k=0}^{N-1}(X*Y_N)_ke^{i2\pi nk/N}=\\&#xA;=\frac{1}{N^2}\sum_{k=0}^{N-1}\sum_{l=0}^{N-1}X_lY_{(k-l)_N}e^{i2\pi nk/N}=&#xA;\frac{1}{N^2}\sum_{l=0}^{N-1}X_l\sum_{k=0}^{N-1}Y_{(k-l)_N}e^{i2\pi nk/N}=\\&#xA;\frac{1}{N^2}\sum_{l=0}^{N-1}X_le^{i2\pi nl/N}\sum_{k=0}^{N-1}Y_{(k-l)_N}e^{i2\pi n(k-l)/N}=\\=\frac{1}{N}\sum_{l=0}^{N-1}X_le^{i2\pi nl/N}\cdot\frac{1}{N}\sum_{k=0}^{N-1}Y_{k}e^{i2\pi nk/N}=x_ny_n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $(k-l)_N$ means $(k-l)$ modulo $N$. I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-06-27T18:17:35.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17092" PostTypeId="2" ParentId="15127" CreationDate="2014-06-27T19:25:25.333" Score="2" Body="&lt;p&gt;There's little chance of getting any useful info from that one photo.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would help is to have a series of photos.  With a series, even all from the same angle, one could average out the moving waves and align the suspected object.  It would be interesting to see if the object is tilting, bobbing up and down, or otherwise moving.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images from different angles would help determine the 3D shape of the object, and determine if it's on the water surface, partially submerged, or entirely under but near the surface. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's unlikely to be any interesting image processing work here, just routine contrast adjustment, some smoothing out of noise, maybe a bit of sharpening.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2014-06-27T19:25:25.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17093" PostTypeId="2" ParentId="13899" CreationDate="2014-06-27T19:34:57.410" Score="1" Body="&lt;p&gt;If you know anything at all about the time-domain signal, for example that it's piecewise linear, or should never be negative, or should look like a series of spikes with exponentially decaying tails, you could define a cost function that measures how well a proposed signal meets those criterea.  How to do that is hard to describe in a generic way.  Then feed that cost function into your favorite multi-variable optimizer.  The phases of the Fourier amplitudes are the variables to be optimized.   Try a variety of initial values, beware local minima, and all the other usual cautions for optimization apply.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2014-06-27T19:34:57.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17095" PostTypeId="1" CreationDate="2014-06-28T06:39:49.150" Score="0" ViewCount="4761" Body="&lt;p&gt;From my understanding, the Fourier series is a way to describe an arbitrary continuous signal in terms of sinusoids of varying frequencies and amplitudes, as shown here in &lt;a href=&quot;http://www.thefouriertransform.com/series/coefficients.php&quot; rel=&quot;nofollow&quot;&gt;Equation 1&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are the phases of the sinusoids not considered?&lt;/p&gt;&#xA;" OwnerUserId="3374" LastEditorUserId="3374" LastEditDate="2014-07-01T02:36:05.873" LastActivityDate="2014-08-14T08:26:36.190" Title="Why does the Fourier series not include phase information?" Tags="|fourier-series|" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17096" PostTypeId="1" AcceptedAnswerId="17111" CreationDate="2014-06-28T07:34:07.437" Score="1" ViewCount="45" Body="&lt;p&gt;I would like to know is there any possible approach to recognise digits of the first (and second as well, as you can see in the example figure) order of magnitude. I've thought of neural network with full, half and possibly quarter training samples of the digits I want to recognise, but I don't think this is the best approach. You see, I am new to computer vision and I'd like to see what path should I take to study if there are any for this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CsZZI.jpg&quot; alt=&quot;Indicator camera shot&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10350" LastActivityDate="2014-06-29T07:07:22.353" Title="How to recognise partial text on mechanical indicators" Tags="|computer-vision|machine-learning|optical-char-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17097" PostTypeId="2" ParentId="17095" CreationDate="2014-06-28T08:16:33.653" Score="4" Body="&lt;p&gt;(The following is the answer to the original version of the question asking about the Fourier &lt;strong&gt;Transform&lt;/strong&gt;. But exactly the same argument also applies to Fourier series).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are. Assume that $F(\omega)$ is the Fourier transform of the signal $f(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=\int_{-\infty}^{\infty}f(t)e^{-j\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, $F(\omega)$ is a complex-valued function and can be written in polar form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=|F(\omega)|e^{j\phi(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi(\omega)$ is the phase of $F(\omega)$.&#xA;The signal $f(t)$ can be written in terms of $F(\omega)$ by virtue of the inverse Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty}F(\omega)e^{j\omega t}d\omega=&#xA;\frac{1}{2\pi}\int_{-\infty}^{\infty}|F(\omega)|e^{j(\omega t+\phi(\omega))}d\omega\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) it can be seen that $f(t)$ is represented by complex sinusoids with varying amplitudes $|F(\omega)|$, phases $\phi(\omega)$, and frequencies $\omega$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-06-30T15:58:55.093" LastActivityDate="2014-06-30T15:58:55.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17098" PostTypeId="1" CreationDate="2014-06-28T10:38:36.670" Score="2" ViewCount="771" Body="&lt;p&gt;I have three questions regarding the correlation meters used in audio.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How are they calculated? I have heard correlation is performed by convolving one signal with the time flipped version of a other, but this seems impossible in real time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How does this differ from the pearson's correlation coefficient used in statistics?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sometimes the correlation meter takes a round shape representation. Is there any place to read more about the exact details on how this representation works?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thankyou.&lt;/p&gt;&#xA;" OwnerUserId="9121" LastActivityDate="2014-06-29T11:19:54.783" Title="Correlation meter" Tags="|autocorrelation|correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17099" PostTypeId="1" CreationDate="2014-06-28T12:59:05.920" Score="3" ViewCount="4072" Body="&lt;p&gt;I have recorded samples of lungs sound (person breath) signals from electronic stethoscope.&lt;/p&gt;&#xA;&lt;p&gt;How can I measure (In percentage) the similarity between two audio signals (lung sound), the general idea is to take a clean recorded signal(without environmental noises, Laboratory conditions) and compare it with the regular recorded lung sound. If the percent is high enough then it is valid, else it is with too much environmental noises.&#xA;I thought to do it by cross-correlation but after a research I found out that it is more suitable for time lag between signals. Any good idea to start with? I want to implement it in MATLAB.&lt;/p&gt;&#xA;&lt;p&gt;** the recorded files are in AAC format.&lt;/p&gt;&#xA;" OwnerUserId="10352" LastEditorUserId="128" LastEditDate="2020-09-29T06:29:14.423" LastActivityDate="2021-07-23T10:47:49.277" Title="Measuring Audio Signal Similarities" Tags="|matlab|audio|signal-analysis|algorithms|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17100" PostTypeId="2" ParentId="16787" CreationDate="2014-06-28T13:53:39.790" Score="-1" Body="&lt;p&gt;It is easy to find the contour for each character. You can analyze the contour to find the points at the corners. Using one line to connect two adjacent points can produce right angle corners.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2014-06-28T13:53:39.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17101" PostTypeId="2" ParentId="17099" CreationDate="2014-06-28T15:20:01.180" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Correlation_and_dependence&quot; rel=&quot;nofollow noreferrer&quot;&gt;Normalized Cross Correlation&lt;/a&gt; for that.&lt;/p&gt;&#xA;&lt;p&gt;Basically, representing each recorded sound as a vector, this gives the angle between them.&lt;/p&gt;&#xA;&lt;p&gt;Another approach is dealing with features of the sound instead of the signal itself.&lt;br /&gt;&#xA;You can start by reading how Shazam works:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.reddit.com/r/askscience/comments/1mdb08&quot; rel=&quot;nofollow noreferrer&quot;&gt;How do apps like Soundhound and Shazam work?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://gizmodo.com/5647458&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gizmodo - How Shazam Works To Identify (Nearly) Every Song You Throw At It&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.quora.com/How-does-SoundHound-work&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quora - How Does SoundHound Work?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/SoundHound&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipeida - SoundHound&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://everythingelsematterstoo.blogspot.com/2010/06/how-shazam-works.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Everything Else Matters Too - How Shazam Works&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.slate.com/articles/technology/technology/2009/10/that_tune_named.2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Slate - How does the music identifying app Shazam work its magic&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="128" LastEditorUserId="54457" LastEditDate="2021-07-23T10:47:49.277" LastActivityDate="2021-07-23T10:47:49.277" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17103" PostTypeId="2" ParentId="17098" CreationDate="2014-06-28T20:53:44.873" Score="3" Body="&lt;p&gt;Let me answer in slightly different order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) It seems you're really asking for a &quot;Goniometer&quot;, which is a 2 channel oscilloscope with the left and right signal components plotted in two orthogonal directions on the scope screen. These directions are typically chosen so that the signal channels make an angle of 45 degrees to the horizontal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The correlation meter is often part of a Goniometer display and displays a value between -1 and +1 indicating the relative correlation between left and right channel. It is calculated using three different low pass filters acting on the left channel squared, the right channel squared and the product of the left and right channel. In math terms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ c(t) = \frac{H_l ( L(t) \cdot R(t) )}{\sqrt{H_l( L(t)^2 ) \cdot H_l(R(t)^2)}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $L(t)$ and $R(t)$ are the channel signals and $H_l$ is the low pass filter. The low pass filter mimics a windowed integral, and the correlation is measured as average over the integration time. The equivalent integration time for audio use is typically in the range of 10 to 100 milliseconds, which gives a low pass cutoff of around 100 to 10 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) And this definition coincides with Pearson's definition for a time range of length $T$ of the two channels exactly if the low pass filter used above is a box-filter with support of duration $T$.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-06-29T11:19:54.783" LastActivityDate="2014-06-29T11:19:54.783" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17104" PostTypeId="2" ParentId="17099" CreationDate="2014-06-28T22:11:28.980" Score="0" Body="&lt;p&gt;In the past i did the shazam algorithm, I dont know if it can give to you the expected results, but you can try do it using the same principles, you can measure using scoring system of ascending order and why not if you want you can measure in percentage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First look at sounds lungs and analizer to find where are the bands frequencies of you interest or what are the best bands that can define your breath signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I consider the basic idea behind the shazam algorithm very easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Construct database song&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1. Record your Full Song&#xA;2. Transform the sound to spectrum&#xA;3. slice your Spectrogram in chunks(three or four bands) and get the high Frequencies&#xA;4. Store all the points&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Match the song&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1. Record one short sample or another full song.&#xA;2. Transform the sound into another spectrum &#xA;3. slice your Spectrogram in chunks(three or four bands) and get hight Frequencies&#xA;4. Compare the collected frequencies with your database song.&#xA;5. your match is the song with have the high hit !&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I remember that when i test it in a relative large database my results was amazing, but I used it for audio fingerprint, your approach seems to be a little different.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2014-06-28T22:11:28.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17105" PostTypeId="2" ParentId="17074" CreationDate="2014-06-29T00:14:51.930" Score="1" Body="&lt;p&gt;Here is an example for a signal processing of a reflection crated by three transmit pulses spaced in 10 samples. I can represent the reflection in three ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sk = Tk + (Tk-10) + (Tk-20)&lt;/li&gt;&#xA;&lt;li&gt;Sk’ = (Tk-10) + Tk + (Tk+10)&lt;/li&gt;&#xA;&lt;li&gt;Sk’’ = Tk + (Tk+10) + (Tk+20)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now I can restore three signals with three IIR filters.&#xA;The first signal will be derived from the first equation above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tk = Sk – (Tk-10) – (Tk-20)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second signal will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tk = Sk’ – (Tk-10) – (Tk+10)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third signal will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tk = Sk’’ – (Tk+10) – (Tk+20)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the three signals above are aligned by a delay line (the second signal is delayed by 10 samples and the third one by 20), added together and finally the result divided by 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My expectation is the result would have three times better signal to noise ratio compared with a reflection signal created by a single transmit pulse.&lt;/p&gt;&#xA;" OwnerUserId="10331" LastActivityDate="2014-06-29T00:14:51.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17106" PostTypeId="1" CreationDate="2014-06-29T00:38:26.590" Score="0" ViewCount="681" Body="&lt;p&gt;I am doing a baseband simulation for IEEE 802.11 g. The standard uses 64 IFFT length ($3.2 \mu s$) and 20 Msamples per second. This result in one sample per symbol. I am wondering what the structure will be if I use 40 Msample per second, i.e will the IFFT size change, or interpolation will be used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="10354" LastEditorUserId="8202" LastEditDate="2014-06-29T09:23:54.767" LastActivityDate="2014-07-29T13:59:29.100" Title="How may samples per symbol in ieee 802.11 g" Tags="|sampling|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17107" PostTypeId="1" AcceptedAnswerId="17112" CreationDate="2014-06-29T04:16:09.960" Score="6" ViewCount="3491" Body="&lt;p&gt;Literature says that a stationary signal is ergodic, if its ensemble average = time averages. Should it be the statistics computed by time averaging = statistics computed by ensemble averaging?The way I understood from the book in the link is as follows : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Case1: There are N samples in a time series I compute the mean1,skewness1,kurtosis1 . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Case2: Next, with the N samples, T experiments are conducted and in each of the experiment is calculate the statistics. After, T experiments are done, we calculate the average of these statistics - mean_avg,skewness_avg, kurtosis_avg. This is called as Ensemble averaging or Probabilistic averaging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If mean1 = mean_avg and so on, the the process/signal is ergodic. Is my understanding correct?&lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="128" LastEditDate="2020-09-29T13:37:19.583" LastActivityDate="2020-09-29T13:37:19.583" Title="Understanding Ergodicity and Ensemble Averaging" Tags="|matlab|random-process|stochastic|random|ergodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17108" PostTypeId="2" ParentId="17074" CreationDate="2014-06-29T04:25:16.537" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;My question is, could I get a signal with better signal to noise ratio by using two or more transmit pulses compared to the signal from a single pulse? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. Adding more energy to your probe (ie using more pulses) can always increase your SNR. You just have to figure out how to process the received reflected pulses, which you already seem to understand.&lt;/p&gt;&#xA;" OwnerUserId="7361" LastActivityDate="2014-06-29T04:25:16.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17110" PostTypeId="1" CreationDate="2014-06-29T06:12:37.207" Score="0" ViewCount="2570" Body="&lt;p&gt;I have made a &lt;code&gt;stft_func&lt;/code&gt; in MATLAB which takes window length i.e &lt;code&gt;t_short&lt;/code&gt;  as a parameter for window length. Now, this function is giving me a very blurred image with $f_s=1000\mathtt{Hz}$, radar target $10\mathtt{GHz}$ (fm) and $T_{short}=0.5 \mathtt{s}$&#xA;How to find frequency resolution from spectrogram.?&lt;/p&gt;&#xA;" OwnerUserId="10356" LastEditorUserId="8202" LastEditDate="2014-06-29T08:58:52.937" LastActivityDate="2014-07-29T09:56:49.930" Title="Frequency resolution" Tags="|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17111" PostTypeId="2" ParentId="17096" CreationDate="2014-06-29T07:07:22.353" Score="1" Body="&lt;p&gt;If you are using an out-of-the box OCR engine, then there's not much you can do with significantly occluded letters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you are rolling your own OCR, say with some template-matching, then, there is nothing preventing you from learning/teaching partial letters and their valid combinations (like the 8-9 and 9-0 above). Just treat it as another letter in the set to be recognized.&lt;/p&gt;&#xA;" OwnerUserId="163" LastActivityDate="2014-06-29T07:07:22.353" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17112" PostTypeId="2" ParentId="17107" CreationDate="2014-06-29T07:55:20.620" Score="2" Body="&lt;p&gt;I will try to explain this practically using MATLAB notation.&lt;br&gt;&#xA;Yet before that I must say the ergodic property sometime is limited to a level of moment, namely ergodic in the 1st , 2nd, 3rd moment, etc...&lt;br&gt;&#xA;If the process is IID it is promised to be ergodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assume we have a function &lt;code&gt;myRandomProcess&lt;/code&gt; in MATLAB.&lt;br&gt;&#xA;It returns a row vector of length &lt;code&gt;n&lt;/code&gt; with the random properties of our random process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assume we build a matrix &lt;code&gt;A&lt;/code&gt; which is $ m $ by $ n $ matrix which each row is a different vector created using the above function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, using the &lt;code&gt;mean&lt;/code&gt; and &lt;code&gt;var&lt;/code&gt; functions in MATLAB we can compute the properties of the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we apply &lt;code&gt;mean&lt;/code&gt; a long the columns (Namely, on each row) we will get $ m $ results.&lt;br&gt;&#xA;If those are close enough to the $ n $ results yielded by applying the &lt;code&gt;mean&lt;/code&gt; function along the rows (On each column by itself) we can assume the process is ergodic in its first moment.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if $ m $ and $ n $ approaches infinity &quot;close enough&quot; can be small as we want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most properties of random process related to its ergodicity can be inferred by looking on its auto correlation function.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Update&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Simple MATLAB code to convey the idea:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Ergodic Random Process&#xA;&#xA;% The Prbability dimension is a long rows (Vertical) and the time dimension&#xA;% is a long the columns (Horizontal).&#xA;&#xA;numSamples  = 1000;&#xA;numTrials   = 1000;&#xA;&#xA;% Ergodic Process - IID Random Samples&#xA;&#xA;mRandomProcess = randn(numTrials, numSamples);&#xA;&#xA;vTimeAverage = mean(mRandomProcess, 2);&#xA;vSampleAverage = mean(mRandomProcess, 1);&#xA;&#xA;vTimeVariance = var(mRandomProcess, 1, 2);&#xA;vSampleVariance = var(mRandomProcess, 1, 1);&#xA;&#xA;disp(['Ergodic Process Statistics']);&#xA;disp(['1st Moment Ergodicity - ', num2str(mean([vTimeAverage(:) - vSampleAverage(:)] .^ 2))]);&#xA;disp(['2nd Moment Ergodicity - ', num2str(mean([vTimeVariance(:) - vSampleVariance(:)] .^ 2))]);&#xA;&#xA;% Un Ergodic Process&#xA;&#xA;% The DC Level is drawed once per random process (Realization)&#xA;vDcLevel = (10 * rand(numTrials, 1)) - 5;&#xA;&#xA;mRandomProcess = randn(numTrials, numSamples) + repmat(vDcLevel, [1, numSamples]);&#xA;&#xA;vTimeAverage = mean(mRandomProcess, 2);&#xA;vSampleAverage = mean(mRandomProcess, 1);&#xA;&#xA;vTimeVariance = var(mRandomProcess, 1, 2);&#xA;vSampleVariance = var(mRandomProcess, 1, 1);&#xA;&#xA;disp(['Un Ergodic Process Statistics']);&#xA;disp(['1st Moment Ergodicity - ', num2str(mean([vTimeAverage(:) - vSampleAverage(:)] .^ 2))]);&#xA;disp(['2nd Moment Ergodicity - ', num2str(mean([vTimeVariance(:) - vSampleVariance(:)] .^ 2))]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you'll be able to see, the first process is Ergodic (As any IID process), as it is equivalent to calculate its moment along the time dimension or the sample dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the second one isn't Ergodic.&lt;br&gt;&#xA;Since its mean along the rows is zero (Drawn from a uniformly random variable [-5, 5]) yet along its columns its mean is the value of the specific realization of the uniform variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this clarifies it.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2016-11-03T08:07:03.417" LastActivityDate="2016-11-03T08:07:03.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17113" PostTypeId="2" ParentId="17110" CreationDate="2014-06-29T08:57:06.197" Score="2" Body="&lt;p&gt;Frequency resolution of your spectrogram is connected to time window length and sampling frequency by following relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta f = \dfrac{f_s}{N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sampling frequency, and $N$ is length of your time window in samples. $N$ can be easily expressed in seconds, in your case length of window is $T=0.5 \mathtt{s} $ and $f_s = 1000 \mathtt{Hz} $. Therefore window length in samples is: $$N=T\cdot f_s = 0.5 \cdot 1000=500$$&#xA;Which is giving you frequency resolution to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta f = \dfrac{1000}{500}= 2 \mathtt{Hz}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also notice that substitution of $N$ with respect to $T$ and $f_s$ yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta f = \dfrac{f_s}{T\cdot f_s}= \dfrac{1}{T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is obviously length of your window.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-06-29T09:05:34.143" LastActivityDate="2014-06-29T09:05:34.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17114" PostTypeId="2" ParentId="17099" CreationDate="2014-06-29T10:59:24.667" Score="1" Body="&lt;p&gt;&lt;strong&gt;Music&lt;/strong&gt; fingerprinting algorithms (like the one used by Shazam) will not work. They work by identifying areas of the spectrogram in which there are sharp increase of energy in a narrow frequency band (the attack of a note partial) - and &quot;noisy&quot; sounds like breathing never have such features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross-correlation will not work either because of the predominantly noisy component in breathing signals. For example, two realizations of white gaussian noise filtered by the same band-pass filter will sound absolutely identical but the correlation between waveforms will be null. The notion of similarity given by our ears, or by the experience of a physician, is &lt;strong&gt;not&lt;/strong&gt; waveform correlation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not clear from your question if what you want to measure is just how &quot;clean&quot; the signal (&quot;is it similar enough to this clean recording of breathing?&quot;) or if you will actually need to match a recorded sample to several reference recordings (for example for diagnosis). In both cases, you will have to define your own features using your own expertise of the field, and probably rely on statistical/machine learning techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The former situation is easier because temporal information probably doesn't matter much. It seems doable with features like spectral envelope (for example, energy in a handful of frequency band), a contrast measure on the spectral envelope (smooth the spectrum, compute kurtosis or geometric/arithmetic mean ratio), and a contrast measure on the correlation (to discriminate against sounds which are too &quot;pitched&quot; - just like voiced/unvoiced detection in speech analysis). From there, you could have a few examples of &quot;good&quot; and &quot;bad&quot; signals, and train a classifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For diagnosis, you would have to define features taking into account temporal information (such as the autocorrelation of the envelope).&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-06-29T10:59:24.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17115" PostTypeId="2" ParentId="17106" CreationDate="2014-06-29T13:21:00.223" Score="1" Body="&lt;p&gt;If you oversample the signal by a factor of 2 as you've suggested, then you will have a bunch of empty subcarriers that are outside the specified signal bandwidth. When you modulate the OFDM frame to a time-domain signal, therefore, you'll have to use an IFFT that is twice as long. The result will be a discrete-time signal that is interpolated by a factor of 2 compared to using the nominal sample rate.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-06-29T13:21:00.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17116" PostTypeId="2" ParentId="17095" CreationDate="2014-06-29T13:39:39.197" Score="1" Body="&lt;p&gt;The Fourier transform does include phase information.  The result of the transform is complex data, a real and imaginary component for each bin.  The real and imaginary components contain both magnitude and phase information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in some applications the phase information may get discarded.  If the end user is primarily interested in the magnitude information then the system may automatically convert the real and imaginary components into magnitude data and discard the phase information.  This way the system produces an array of magnitude data that can be more easily plotted as a spectrum (i.e., less computations required for the user).  And the magnitude-only data can be represented with half the data of the real and imaginary components so if the data is going to be transferred or stored then the magnitude-only data requires half the bandwidth and storage space.  These are a couple reasons why the phase information may get discarded in some applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that after you discard the phase information, you can not reproduce the original waveform from the magnitude-only data.  You need the real and imaginary components in order to reproduce the waveform.&lt;/p&gt;&#xA;" OwnerUserId="7419" LastActivityDate="2014-06-29T13:39:39.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17118" PostTypeId="1" CreationDate="2014-06-29T21:31:38.103" Score="1" ViewCount="164" Body="&lt;p&gt;I have the following (experimental) image, with its correponding raw data in .csv format &lt;a href=&quot;https://gist.github.com/berceanu/151111e591fc9098df77&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AA3Wn.png&quot; alt=&quot;waves&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pattern represents the scattering of a laser field off a point defect located in the center. One can clearly see a V-like shape of the scattered waves (here drawn in green). Unfortunately, there is also quite a lot of back-scattering going on, resulting in the very closely spaced parabolic waves running in the opposite direction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to find an fft-based method for filtering out all the secondary waves, leaving only the V-shaped ones.&lt;/p&gt;&#xA;" OwnerUserId="10358" LastEditorUserId="10358" LastEditDate="2014-07-01T13:32:29.917" LastActivityDate="2014-07-01T21:33:11.250" Title="filtering out specific waves in scattering pattern" Tags="|image-processing|fft|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17119" PostTypeId="2" ParentId="17080" CreationDate="2014-06-29T23:33:51.003" Score="0" Body="&lt;p&gt;Adding 7600 in zero-padding will increase the number of sample points in your FFT result plot.  But it won't increase the the resolution in terms of being able to separate 2 or more signals with nearby frequencies.  It might help interpolate some spectral peaks that are &quot;between bins&quot; given a shorter FFT size, but that is no more an increase in informational resolution than any other high-quality interpolation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-06-29T23:33:51.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17120" PostTypeId="2" ParentId="470" CreationDate="2014-06-29T23:51:07.920" Score="9" Body="&lt;p&gt;Additionally to &lt;a href=&quot;https://dsp.stackexchange.com/a/472/10349&quot;&gt;Lorem Ipsum's answer&lt;/a&gt; explaining the Hough transform as a discretized form of Radon transform, I like this descriptive explanation - also according to &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.2.9419&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;noreferrer&quot;&gt;Ginkel and others&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both Radon and Hough are a mapping from the image space to a parameter space of $\rho$ and $\theta$, but they differ in their point of view.&#xA;While the Radon transform derives a point in parameter space from image space (the &lt;em&gt;reading paradigm&lt;/em&gt;), the Hough transform explicitly maps data points from image space to parameter space (the &lt;em&gt;writing paradigm&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This becomes clear by comparing their (discrete) algorithms. &#xA;For each $\theta$ in parameter space Radon projects the image points on a line described by (its angle) $\theta$ using buckets of size $\Delta\rho$.&#xA;Hough on the other hand takes each image point $(x,y)$ and adds the appropriate intensity to all corresponding parameter space bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result Hough suffers artifacts whereas Radon allows for high resolution in parameter space (by adjusting $\Delta\theta$ and $\Delta\rho$ and dividing pixels into subpixels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hough is usually faster though the whole transformation needs to be performed (which is the intention in most cases anyway).&#xA;Radon allows to compute only a short interval (in $\theta$) of the parameter space due to the &lt;em&gt;reading paradigm&lt;/em&gt;. This can significantly reduce computation time if you have some a priori knowledge (like in which $\theta$ intervals your peaks probably are).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess Hough is dominant in many fields because of its simple algorithm, whereas Radon is used where accuracy is crucial or a priori knowledge available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also Matlab references (expand the &lt;em&gt;Algorithm&lt;/em&gt; tab):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/images/ref/radon.html&quot; rel=&quot;noreferrer&quot;&gt;www.mathworks.com/help/images/ref/radon.html&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/images/ref/hough.html&quot; rel=&quot;noreferrer&quot;&gt;www.mathworks.com/help/images/ref/hough.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="10349" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-07-01T11:46:06.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17121" PostTypeId="1" AcceptedAnswerId="17123" CreationDate="2014-06-30T05:23:25.300" Score="8" ViewCount="19967" Body="&lt;p&gt;I have some confusions regarding reverberation time (RT60). I need to calculate reverberation time from a given power envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I get. As you might see the line is curved close to zero (at top left corner) and then becomes straight. Is t-intercept equal to RT60, or do I need to extend the straight line at the top then shift the line left so that I get a straight line starting from the top left corner and then see the t-intercept? Any help would be appreciated. Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J1Dht.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10360" LastEditorUserId="8202" LastEditDate="2017-03-21T08:58:32.217" LastActivityDate="2022-07-26T18:13:54.593" Title="Calculation of Reverberation Time (RT60) from the Impulse Response" Tags="|impulse-response|speech-processing|acoustics|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17122" PostTypeId="1" AcceptedAnswerId="17124" CreationDate="2014-06-30T05:55:17.940" Score="2" ViewCount="2708" Body="&lt;p&gt;Despite,reading up on this I'm unable to find crystal clear clarity on the differences b/w phase and grpdelay functions and interpretation of grpdelay's output. I have designed a low pass &lt;strong&gt;butterworth filter having a cut off frequency of 0.04Hz&lt;/strong&gt;. There is a delay in my filtered output compared to my original signal. I wish to know this delay. I used the grpdelay function in matlab (grpdelay(b,a,N/2) ). And this is the output i got.&lt;img src=&quot;https://i.stack.imgur.com/I58Oj.png&quot; alt=&quot;enter image description here&quot;&gt;.&#xA; I read that grpdelay is supposed to give the phase responses as a function of frequencies. In my image, the cursor points to the cut-off freq. How exactly do I know the delay in my filtered output through this? Is it the corresponding value on the Y-axis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plotting the phasedelay(b,a), gave this as the output.&lt;img src=&quot;https://i.stack.imgur.com/NlYVY.png&quot; alt=&quot;enter image description here&quot;&gt;.Here,the phasedelay value at cut-off is different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, to figure out how much the filter has delayed the signal,which function do I use? And how do I interpret the output exactly, of that function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my original signal in blue and the filtered signal which has the delay in red&lt;img src=&quot;https://i.stack.imgur.com/p7R1z.png&quot; alt=&quot;enter image description here&quot;&gt; .&lt;img src=&quot;https://i.stack.imgur.com/WGIce.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10274" LastEditorUserId="10274" LastEditDate="2014-06-30T09:37:02.280" LastActivityDate="2014-06-30T20:32:54.540" Title="once again,confusion between phase and group delay" Tags="|lowpass-filter|phase|group-delay|" AnswerCount="1" CommentCount="4" ClosedDate="2014-08-02T01:17:31.190" ContentLicense="CC BY-SA 3.0" />
  <row Id="17123" PostTypeId="2" ParentId="17121" CreationDate="2014-06-30T08:24:22.900" Score="23" Body="&lt;p&gt;Encouraged by Hilmar, I've decided to update the answer with all the steps necessary to calculate the Reverberation Time from a scratch. Presumably, it will be useful for others interested in this area. Obviously, it is the simplest approach because more advanced are definitely beyond a scope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the beginning, you must obtain the impulse response of a room. It can be done in various ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Firing a starter gun&lt;/strong&gt;, &lt;strong&gt;popping a balloon&lt;/strong&gt;, etc. - basically recording any impulsive-like signal with broad frequency content and omnidirectional characteristic. This is the simplest method of obtaining impulse response.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Sweep Sine&lt;/strong&gt; measurement with a usage of either linear or exponential sweep. This method is my favorite as it allows you to extract many different parameters of your system at the same time.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;MLS&lt;/strong&gt; (Maximum Length Sequence) measurement with this kind of noise and using Hadamard transform to obtain the impulse response. Some comparison with sweep sine technique can be found &lt;a href=&quot;http://ev.fe.uni-lj.si/3-2011/Policardi.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After getting the impulse response &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt; of your acoustic space you are able to calculate the reverberation time and other speech related parameters such as &lt;span class=&quot;math-container&quot;&gt;$C_{80}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$STI$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$D_{50}$&lt;/span&gt; (Clarity, Speech Transmission Index, Definition), etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very first step is to filter your impulse response in an appropriate frequency band. This is due to fact that reverberation time is a function of position in the room and frequency. Obviously, we assume that sound field is diffused and at each position in a room decay rate is the same. Thus we must still consider dependency on the frequency band. We are using 1/1 octave or 1/3 octave filters. Its desired parameters are defined by &lt;a href=&quot;https://law.resource.org/pub/in/bis/S04/is.6964.2001.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;EN 61260&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; standard, preferably you always wish to use the filter of class 0. For most of the time, Butterworth 3rd order filter is enough (although for frequencies below 125 Hz you might experience some problems with characteristic not meeting specifications). I did the whole implementation on my own with few tweaks, but for usual applications widely used &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22512-nth-oct-hand-arm---ac-filter-tool-box&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;MATLAB implementation&lt;/strong&gt;&lt;/a&gt; is good enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next step after filtering the &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt; and obtaining &lt;span class=&quot;math-container&quot;&gt;$h_f(t)$&lt;/span&gt;, is to make the response as smooth as possible before conversion to the logarithmic scale. For that purpose, Hilbert Transform is a widely used tool. The goal is to create the analytic signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h_A(t)=h(t)+j\tilde{h}(t) $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\tilde{h}(t) $&lt;/span&gt; is the HT of your filtered impulse response and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is a complex unit. Now, knowing that your analytic signal is complex, two things are coming from its representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h_A(t)=A(t)e^{j \psi (t)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$A(t)$&lt;/span&gt; is the envelope of your signal and &lt;span class=&quot;math-container&quot;&gt;$\psi (t)$&lt;/span&gt; is an instantaneous phase. Obviously, we are interested mainly in the envelope (magnitude of the analytic signal). Below you can see overlayed filtered response and its envelope:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IZo1D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One clue for people speaking MATLAB'ish. The &lt;code&gt;hilbert&lt;/code&gt; function returns the analytic signal, so no need of multiplying by &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; and adding original &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt;. Just use &lt;code&gt;abs(hilbert(h))&lt;/code&gt; to get the envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we have the smoothed version of our impulse response, but it must be smoothed further. It is optional and one might consider it unnecessary. It is based on Moving Average filter of appropriate length &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. Everyone knows the moving average filter, it is basically a low-pass FIR filter with frequency response given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(f)=\frac{\sin (\pi f M)}{M\sin (\pi f)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plots for different lengths &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; are shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vBszu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And on the following figure you can observe the effect of smoothing of the previously calculated energy curve (&lt;span class=&quot;math-container&quot;&gt;$A(t)$&lt;/span&gt; in logarithmic scale becomes &lt;span class=&quot;math-container&quot;&gt;$E(t)$&lt;/span&gt;) for two different values of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. For sampling frequency of &lt;span class=&quot;math-container&quot;&gt;$48\mathtt{kHz}$&lt;/span&gt; I've used &lt;span class=&quot;math-container&quot;&gt;$M=5001$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AZp7m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now we have the Energy Curve (not a Power) which is simply the smoothed Hilbert envelope in logarithmic scale. Conversion to decibel scale is done by equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E(t) = 20\log_{10} \frac{A(t)}{\max A(t)}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Curve &lt;span class=&quot;math-container&quot;&gt;$A(t)$&lt;/span&gt; can be further smoothed for calculations by using the &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/Schro65-reverb.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Schroeder Integration method&lt;/strong&gt;&lt;/a&gt; of your envelope (also known as inversed time integration). This method gives you maximally flat decay curve and is very easy to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$L(t)=10 \log_{10} \left[ \dfrac{\int_t^{\infty}h^2(\tau )d\tau}{\int_0^{\infty}h^2(\tau )d\tau} \right] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again for MATLAB people:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L(td:-1:1)=10*log10(cumsum(hA(td:-1:1).^2)/sum(hA(1:td).^2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Mind that limit of integration (&lt;code&gt;td&lt;/code&gt;) is equal to &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;. It is true when we do not have any environmental noise. Otherwise, you will see that decaying sound 'dives into noise level'. It is depicted below. The red curve is based on the correct limit, where decay crosses noise floor. If you choose your limit of integration to be too short, then as in green curve, the estimate is not long enough, so you will get under-estimation while doing linear interpolation. On the contrary, the orange curve has too large integration limit and you will get over-estimated. You always want to find the correct limit. If you didn't obtain curve in such way, then please do so. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/15esi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many different methods for estimation of integration limit in Schroeder integral, I think that easiest to implement is the one proposed by &lt;a href=&quot;http://www.ingentaconnect.com/content/dav/aaua/1995/00000081/00000004/art00009&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Lundeby et al.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding calculation of RT itself. It must be done by performing linear interpolation of your decay curve (or should I say Schroeder curve) with linear function: &lt;span class=&quot;math-container&quot;&gt;$L=A\cdot t+B$&lt;/span&gt; on the correct range (which is described below). When it's done, you calculate the reverberation time from the equation. You can see that point of intercept doesn't really matter (per se), you care about the gradient of your line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$RT = \dfrac{-60}{A} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a slope coefficient from interpolated line (in dB/s). While you have that, you can also calculate the correlation coefficient of your linear fit (or r-value), that is telling you how good is the fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally - limits. You cannot really calculate &lt;span class=&quot;math-container&quot;&gt;$T_{60}$&lt;/span&gt; having &lt;span class=&quot;math-container&quot;&gt;$60 \mathtt{dB}$&lt;/span&gt; of dynamic range as you are trying to do - you always need more (unless you really know what you are doing). So you are doing linear fit on decay curve at following dynamic ranges, and the result is being extrapolated, according to &lt;em&gt;ISO 3382-2&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$EDT$&lt;/span&gt; (Early Decay Time): upper limit is &lt;span class=&quot;math-container&quot;&gt;$0 \mathtt{dB}$&lt;/span&gt; and lower is &lt;span class=&quot;math-container&quot;&gt;$-10 \mathtt{dB}$&lt;/span&gt;. This parameter correlates well with perceived reverberation time. In practice, though beginning for the sake of algorithms, people are using an interval of &lt;span class=&quot;math-container&quot;&gt;$-1 \mathtt{dB}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-10 \mathtt{dB}$&lt;/span&gt; (i.e. in Norsonic analyzers).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_{10}$&lt;/span&gt;: upper limit must start at &lt;span class=&quot;math-container&quot;&gt;$-5 \mathtt{dB}$&lt;/span&gt; to remove any fluctuations and then lower limit is taken to be &lt;span class=&quot;math-container&quot;&gt;$-15 \mathtt{dB}$&lt;/span&gt;, but it always must be at least &lt;span class=&quot;math-container&quot;&gt;$10 \mathtt{dB}$&lt;/span&gt; above the noise floor. So in fact you need at least &lt;span class=&quot;math-container&quot;&gt;$25 \mathtt{dB}$&lt;/span&gt; of dynamic range (or INR) to be able to calculate &lt;span class=&quot;math-container&quot;&gt;$T_{10}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$5+10+10$&lt;/span&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_{20}$&lt;/span&gt;: upper limit at &lt;span class=&quot;math-container&quot;&gt;$-5 \mathtt{dB}$&lt;/span&gt;, lower at &lt;span class=&quot;math-container&quot;&gt;$-25 \mathtt{dB}$&lt;/span&gt;. Minimum dynamic range needed is &lt;span class=&quot;math-container&quot;&gt;$35\mathtt{dB}$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_{30}$&lt;/span&gt;: upper limit of &lt;span class=&quot;math-container&quot;&gt;$-5 \mathtt{dB}$&lt;/span&gt;, lower at &lt;span class=&quot;math-container&quot;&gt;$-35 \mathtt{dB}$&lt;/span&gt;, with minimum &lt;span class=&quot;math-container&quot;&gt;$45 \mathtt{dB}$&lt;/span&gt; of dynamic range.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Why are people using these values? Well, because you very rarely have &lt;span class=&quot;math-container&quot;&gt;$75 \mathtt{dB}$&lt;/span&gt; of dynamic range to be able to estimate &lt;span class=&quot;math-container&quot;&gt;$T_{60}$&lt;/span&gt;. For very smooth decay these values should be equal. Some more detailed analysis of effects can be found in this publication: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://purl.tue.nl/352481346918469.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Measuring Room Impulse Responses: Impact of the Decay Range on&#xA;  Derived Room Acoustic&#xA;  Parameters&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you will not perform Schroeder integration, then most probably they will diverge a lot. For the very nasty room you can get something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1uRiX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory: &lt;span class=&quot;math-container&quot;&gt;$EDT$&lt;/span&gt;  = &lt;span class=&quot;math-container&quot;&gt;$T_{10}$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$T_{20}$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$T_{30}$&lt;/span&gt;. Although they are not necessarily going to be. For example, if your small room is coupled with large one (let's think of small chapel coupled with cathedral by a small doorway), then you will get very sharp decay for smaller one at the beginning of the curve, and very long tail in the end:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q3hkJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To wrap up. According to standards, you should always estimate your reverberation time &lt;span class=&quot;math-container&quot;&gt;$T_{N}$&lt;/span&gt; starting from &lt;span class=&quot;math-container&quot;&gt;$-5 \mathtt{dB}$&lt;/span&gt; and down to &lt;span class=&quot;math-container&quot;&gt;$(-5-N) \ \mathtt{dB}$&lt;/span&gt;. Also, ensure that you are at least &lt;span class=&quot;math-container&quot;&gt;$10 \mathtt{dB}$&lt;/span&gt; above the noise floor. If not, then you must use another estimate. In your case, I suggest using the &lt;span class=&quot;math-container&quot;&gt;$T_{30}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below you have example of &lt;span class=&quot;math-container&quot;&gt;$T_{20}$&lt;/span&gt; estimation for a troublesome impulse response. &lt;span class=&quot;math-container&quot;&gt;$E(t)$&lt;/span&gt; is the energy decay curve obtained by taking the logarithm of impulse response Hilbert envelope. &lt;span class=&quot;math-container&quot;&gt;$L(t)$&lt;/span&gt; is the Schroeder integral. Correlation coefficient between linear fit and &lt;span class=&quot;math-container&quot;&gt;$E(t)$&lt;/span&gt; on a given range (&lt;span class=&quot;math-container&quot;&gt;$-5 \mathtt{dB}$&lt;/span&gt; - &lt;span class=&quot;math-container&quot;&gt;$-25 \mathtt{dB}$&lt;/span&gt;) for this case is: &lt;span class=&quot;math-container&quot;&gt;$cc=-0.9987$&lt;/span&gt;. Calculated RT is &lt;span class=&quot;math-container&quot;&gt;$T_{20}=1.15 \mathtt{s}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/474by.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that should do. If anyone will follow these steps, then he should get an accuracy of &lt;span class=&quot;math-container&quot;&gt;$0.1 \mathtt{s} $&lt;/span&gt; against widely used &lt;a href=&quot;http://www.acoustics-engineering.com/html/dirac.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Dirac&lt;/strong&gt;&lt;/a&gt;. Anyway, it must be remembered that even different software tend to give different results (i.e. EASERA and Dirac), so you should be totally fine. For more complicated impulse responses with artifacts at the end of impulse response one might get worse performance, but anyway, such measurements are not reliable and reflect wrongly conducted an experiment.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="50902" LastEditDate="2020-06-08T23:16:48.853" LastActivityDate="2020-06-08T23:16:48.853" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17124" PostTypeId="2" ParentId="17122" CreationDate="2014-06-30T08:28:58.317" Score="7" Body="&lt;p&gt;If you are looking for a frequency-independent delay applied to any given input signal by the filter (apart from amplifying and attenuating certain frequency components), then you won't be able to find it because there is no such delay. As you can see in your plots, group delay and phase delay are generally frequency dependent. Furthermore, for general input signals, the terms group delay and phase delay have no meaning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two cases for which the terms &lt;em&gt;group delay&lt;/em&gt; and &lt;em&gt;phase delay&lt;/em&gt; have a clear meaning. The first is for narrow-band input signals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=a(t) \cos(\omega_0 t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a(t)$ is a  low-pass signal. If the system has an approximately constant amplitude response in the frequency range of $x(t)$ (i.e., around $\omega_0$) which is $\left|H(j \omega_0)\right|$, and if its phase is approximately linear in this frequency range, then it can be shown that the output signal is approximately given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) \approx \left| H(j \omega_0) \right| a(t-\tau_g(\omega_0)) \cos\left( \omega_0(t-\tau_\phi(\omega_0)) \right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\tau_g(\omega_0)$ is the system's group delay evaluated at the carrier frequency $\omega_0$, and $\tau_\phi(\omega_0)$ is the phase delay at $\omega_0$. So in this case the group delay is the delay of the envelope, whereas the phase delay equals the delay of the carrier. A special example of such a narrow band input signal is a pure sinusoid. From (1) it is clear that the delay of a pure sinusoid when passing through a linear time-invariant (LTI) filter equals the phase delay evaluated at the sinusoid's frequency (and not the group delay). Note that in the case of a pure sinusoid (i.e. $a(t)=\mbox{const}$), Equation (1) becomes exact for any LTI system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other case where these terms are meaningful is when the system has exactly linear phase. This is only possible for FIR systems. For FIR filters with even symmetry of the impulse response, the group delay and the phase delay are equal and constant. In this case, they simply specify the delay of the input signal. This is possible because both group delay and phase delay are constant, i.e. frequency independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your question, I believe that you are looking for such a delay. However, as explained above, such delay only exists for linear-phase FIR systems, not for the Butterworth filter you are considering.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4346" LastEditDate="2014-06-30T20:32:54.540" LastActivityDate="2014-06-30T20:32:54.540" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="17125" PostTypeId="2" ParentId="17095" CreationDate="2014-06-30T08:31:18.807" Score="1" Body="&lt;p&gt;The link you provided doesn't use sines with phases, but sums of sines and cosines. Since &lt;code&gt;sin(f*t + phi) = sin(f*t) * cos(phi) + cos(f*t) * sin(phi)&lt;/code&gt; the two are fundamentally equivalent. The phase &lt;code&gt;phi&lt;/code&gt; just ends up in the coefficients of the sine and cosine terms.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-06-30T08:31:18.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17126" PostTypeId="2" ParentId="16939" CreationDate="2014-06-30T09:42:17.453" Score="4" Body="&lt;p&gt;The European Broadcasting Union's (EBU) Sound Quality Assessment Material (SQAM) resource is pretty popular. &lt;a href=&quot;https://tech.ebu.ch/publications/sqamcd&quot; rel=&quot;nofollow&quot;&gt;https://tech.ebu.ch/publications/sqamcd&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2014-06-30T09:42:17.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17127" PostTypeId="2" ParentId="17057" CreationDate="2014-06-30T11:59:39.130" Score="2" Body="&lt;p&gt;Yes, it is necessary to add an additional pre/suffix to the OFDM symbol that corresponds to the window length when windowing is applied. As the length of the already existing cyclic prefix is usually chosen as the maximum delay spread of the channel no further Inter-symbol interference (ISI) must be introduced or otherwise orthogonality is lost. The windowing method described in the link you referenced is introducing additional ISI by overlapping consecutive symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, weighting some samples of the OFDM time-domain signal with different factors is a distortion that also distorts the constellation in frequency domain, as you say.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that windowing is not filtering. Windowing is the multiplication of the OFDM signal $x_k$ with some window function $w_k$. In contrast, a filter has a memory.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-06-30T11:59:39.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17128" PostTypeId="1" AcceptedAnswerId="17137" CreationDate="2014-06-30T12:29:09.203" Score="0" ViewCount="587" Body="&lt;p&gt;Does modified Morlet wavelet function satisfy the admissibility condition ?&lt;br&gt;&#xA;Do you have any reference for the answer please.&lt;br&gt;&#xA;Thanks.  &lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2014-06-30T19:27:16.470" Title="Does modified Morlet wavelet function satisfy the admissibility condition?" Tags="|signal-analysis|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17129" PostTypeId="1" CreationDate="2014-06-30T12:49:05.453" Score="0" ViewCount="1548" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Iylkd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that we can get the phasor representation(frequency domain) of a signal through Fourier transform, but the picture above gives a method that can get the phasor representation of a signal in a different way, in this method according to the writer, it numerically &quot;demodulate&quot; the signal to create a phasor representation of the signal, however, i can't understand that, anyone can help me? Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="10362" LastActivityDate="2014-06-30T18:50:56.083" Title="how to get the phasor(frequency domain) representation of a digitalized signal?" Tags="|discrete-signals|fourier-transform|signal-analysis|demodulation|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17130" PostTypeId="2" ParentId="17121" CreationDate="2014-06-30T13:02:47.300" Score="2" Body="&lt;p&gt;Excellent answer: Only thing I would add is that the Reverb Time is often a heavily dependent on frequency. Hence the definition and calculation only make sense within a given frequency band and the measured impulse responses should be bandpass filtered before processing. This also makes the decay curve look a lot straighter than the ones from a broad band impulse response.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-06-30T13:02:47.300" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17131" PostTypeId="2" ParentId="17129" CreationDate="2014-06-30T14:31:11.287" Score="1" Body="&lt;p&gt;This is simply about representing a sinusoidal signal $x(t)$ in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) \ = \ \cos(\omega_0t+\phi) \ = \ a \cos(\omega_0 t) \ - \ b \sin(\omega_0 t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'method' described in your question is about identifying the constants $a$ and $b$. The phasor of $x(t)$ is then $X=a+jb$, because&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\text{Re}\{Xe^{j\omega_0t}\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using basic trigonometric identities you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a=\cos\phi\quad\text{and}\quad b=\sin\phi$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can also compute these values by correlation (as shown in your question), which is equivalent to computing the Fourier coefficients of $x(t)$ (apart from a sign difference for the coefficient $b$). Of course, the only non-zero coefficients are the coefficients corresponding to the fundamental:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a=\frac{2}{T}\int_0^Tx(t)\cos(\omega_0 t) \ dt,\quad  T=\frac{2\pi}{\omega_0}\\&#xA;b=-\frac{2}{T}\int_0^Tx(t)\sin(\omega_0 t) \ dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These last two equations correspond to the first two steps described in your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4346" LastEditDate="2014-06-30T18:50:56.083" LastActivityDate="2014-06-30T18:50:56.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17132" PostTypeId="2" ParentId="17095" CreationDate="2014-06-30T15:07:36.220" Score="2" Body="&lt;p&gt;Now when your question is updated and corrected, here is the explanation. The Fourier Series &lt;strong&gt;do contain&lt;/strong&gt; phase information. As you are getting two types of coefficients $a_n$ and $b_n$ corresponding to correlation with sinusoids and cosines, then you can very easily extract phase information. Both magnitude $c_n$ and phase $\theta_n$ are given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n = \sqrt{a_n^2+b_n^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\theta_n=\tan^{-1}\left(-\frac{b_n}{a_n} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And apart from standard representation of Fourier Series which you probably know:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n \cos( n\omega x)+ b_n \sin(n\omega x)\right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also express it with usage of phase and magnitude:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = \frac{a_0}{2}+\sum_{n=1}^{\infty}c_n\cos(n \omega x+\theta_n) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or even if you wish, complex exponential notation can be used. In case of link you provided, think of $a_n$ and $b_n$ as of real and imaginary part of the Fourier Transform coefficients (very naive, but intuitive), from which you can extract the magnitude and phase information.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-08-14T08:26:36.190" LastActivityDate="2014-08-14T08:26:36.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17133" PostTypeId="1" CreationDate="2014-06-30T15:34:41.210" Score="1" ViewCount="88" Body="&lt;p&gt;Today, a news blurb appeared that claimed that attackers could identify the location in which an audio record was taken by matching the mains hum to known data. Sadly, I fear that this might be feasible. The mains hum has quite a tight tolerance, but any aberrations (that cannot be done away with) could be spotted easily. In fact, power suppliers have to observe the hum and adjust their stations accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could you manipulate a record such that this information is destroyed completely, so that it is not reconstructible by any means? Filtering alone might leave enough remains to still perform that identification. After all, all filters have a finite number of poles.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-07-06T13:00:15.533" Title="Masking the mains hum to improve anonymity" Tags="|filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17134" PostTypeId="2" ParentId="17133" CreationDate="2014-06-30T16:59:13.443" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;This seems like a highly unlikely scenario. The signal properties of the power grid are tightly controlled so thinks like frequency and/or harmonic content vary very little over 1000s of miles and millions of locations&lt;/li&gt;&#xA;&lt;li&gt;A lot of recordings these days are done with battery powered devices: portable recorders, cell phones, &quot;bugs&quot; etc. Since they are not connected to the AC line there is virtual no hum in the recordings&lt;/li&gt;&#xA;&lt;li&gt;If you really care enough, a set of sharp notch filters at the fundamental and a few harmonics (primarily 60Hz and 180 Hz in the US) will do the trick. This may degrade the original audio to a small extent but this may be tolerable in this specific application&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-06-30T16:59:13.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17135" PostTypeId="2" ParentId="17133" CreationDate="2014-06-30T18:01:07.847" Score="9" Body="&lt;p&gt;I believe it's possible to get location information from 50/60 Hz hum, particularly if the recording is long-duration.  See this paper by &lt;a href=&quot;http://www.aes.org/e-lib/browse.cfm?elib=14835&quot; rel=&quot;nofollow&quot;&gt;Catalin Grigoras&lt;/a&gt; from 2009.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to defeat this would be to add enough sampling rate jitter to your recording so as to swamp the small variations in mains hum.  That paper showed information from variations of around 1 part in 1000, with sampling every 10 sec or so.  If you let the sampling rate of your signal drift around randomly on that kind of scale (which would have no perceptible effect), it would obscure the variations in the hum.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for instance, if you let your sampling rate drift by +/- 0.1% (e.g., 44,050 to 44,150), with a maximum rate of change of, say, 1 Hz in 10 sec, that would impose a random component on top of the underlying power-grid-derived variations, making them hard to separate.  This modification would be completely inaudible.&lt;/p&gt;&#xA;" OwnerUserId="9099" LastEditorUserId="9099" LastEditDate="2014-07-06T13:00:15.533" LastActivityDate="2014-07-06T13:00:15.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17136" PostTypeId="1" CreationDate="2014-06-30T18:41:22.363" Score="2" ViewCount="2398" Body="&lt;p&gt;I'm looking for implementation of MPEG-7 descriptors which are compatible with OpenCV's recent versions and containing &quot;region-based shape descriptor ART(Angular Radial Transformation)&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I encountered an &lt;a href=&quot;https://stackoverflow.com/questions/882521/opencv-mpeg7-descriptors&quot;&gt;stackoverflow question&lt;/a&gt; which had very informative answers: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/882521/opencv-mpeg7-descriptors/5713222#5713222&quot;&gt;Link in one answer&lt;/a&gt; was containing only the following descriptors:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Color Structure Descriptor (CSD)&lt;/li&gt;&#xA;&lt;li&gt;Scalable Color Descriptor (SCD)&lt;/li&gt;&#xA;&lt;li&gt;GoF/GoP Color Descriptor (GoF/GoP)&lt;/li&gt;&#xA;&lt;li&gt;Color Layout Descriptor (CLD)&lt;/li&gt;&#xA;&lt;li&gt;Dominant Color Descriptor (DCD)&lt;/li&gt;&#xA;&lt;li&gt;Homogeneous Texture Descriptor (HTD)&lt;/li&gt;&#xA;&lt;li&gt;Edge Histogram Descriptor (EHD)&lt;/li&gt;&#xA;&lt;li&gt;Face Recognition Descriptor (FRD)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/882521/opencv-mpeg7-descriptors/1031946#1031946&quot;&gt;Link in another answer&lt;/a&gt; was looking too outdated and wasn't containing documentation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is another implementation I would like to go through it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8948" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-06-30T19:35:49.317" Title="MPEG-7 descriptors' implementation in OpenCV" Tags="|image-processing|computer-vision|opencv|local-features|shape-analysis|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17137" PostTypeId="2" ParentId="17128" CreationDate="2014-06-30T19:17:46.873" Score="1" Body="&lt;p&gt;No, it doesn't (at least not in theory). You know that the admissibility condition is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}\frac{|\Psi(\omega)|^2}{|\omega|}d\omega&amp;lt;\infty$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\Psi(\omega)$ is the Fourier transform of the mother wavelet $\psi(t)$. If $\Psi(\omega)$ decays sufficiently fast (which is the case for the Morlet wavelet) then the admissibility condition reduces to $\Psi(0)=0$, i.e. $\psi(t)$ must satisfy a zero-mean condition. However, this condition is not satisfied for the Morlet wavelet. So the Morlet wavelet is not admissible, but in practice this is no problem because $\Psi(0)$ is very small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] M. Vetterli, J. Kovačević: &lt;em&gt;Wavelets and Subband Coding&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-06-30T19:27:16.470" LastActivityDate="2014-06-30T19:27:16.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17138" PostTypeId="1" AcceptedAnswerId="17143" CreationDate="2014-06-30T22:08:48.050" Score="3" ViewCount="1713" Body="&lt;p&gt;I try to design a FIR All-pass filter with random phase in the frequency domain. I am a bit confused by my result and am not sure if the reason is a programming error or a misconception about convolution and impulse response of myself. I use Python and Numpy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;mag = np.ones(129) # magnitude is unitiy&#xA;phase = np.zeros(129)&#xA;random_numbers = (np.random.rand(128)-0.5)*2.0&#xA;phase[1:] = random_numbers * np.pi # phase is random except for dc offset&#xA;spec = mag*np.exp(phase * 1j) # get spectrum from magnitude and phase&#xA;coefficients = np.fft.irfft(spec) # do inverse fft to get coefficents, result is of length 256&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I do a fft on my coefficients the magnitude looks nearly right. My first question: Why is the highest frequency suppressed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yP8f6.png&quot; alt=&quot;Magnitude Spectrum of coefficients&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And secondly, if I use my coefficients for convolving with an impulse, I thought that should reproduce the coefficients? But it does not. Why are there these &quot;random variations&quot; around 1.0?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;impulse = np.zeros(256, dtype=np.float64) # create impulse&#xA;impulse[256/2] = 1.0&#xA;result = np.convolve(impulse, coefficients, &quot;same&quot;) # convolve it&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4qATp.png&quot; alt=&quot;Magnitude Spectrum of result of convolution of coefficients and impulse&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any explanations or hints are much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8462" LastEditorUserId="4298" LastEditDate="2020-11-25T13:36:46.880" LastActivityDate="2020-11-25T13:36:46.880" Title="Confusion about result of FIR All-pass filter design" Tags="|filters|filter-design|python|convolution|allpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17139" PostTypeId="1" CreationDate="2014-06-30T22:43:23.567" Score="1" ViewCount="1003" Body="&lt;p&gt;I am acquiring data through an oscilloscope, which I am then filtering. I am doing all of this in Python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need a bandpass filter with stop bands from 0 to .4MHz, and 4MHz and up. My pass band needs to be in the remaining region and would ideally be as large as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked out a text from the library to help design a filter. The first filter I built was a Butterworth filter. However, the time domain response was awful for any decent frequency range, as I need an order 5+ filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now using the Remez (in scipy.signal) algorithm to generate my Transfer function coefficients. It looks All right, but I'm wondering if there is a better filtering option for flat time domain a fast frequency response?&lt;/p&gt;&#xA;" OwnerUserId="10366" LastActivityDate="2014-07-01T13:46:43.110" Title="Filtering method that minimizes ringing in time domain, implementable in Python" Tags="|filters|python|bandpass|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17140" PostTypeId="2" ParentId="7644" CreationDate="2014-07-01T06:31:33.853" Score="0" Body="&lt;p&gt;Without your image its very hard to suggest any method or solution for your problem. But anyway see my answer to another question may be it work for you. &lt;a href=&quot;https://dsp.stackexchange.com/questions/15920/which-method-to-remove-small-unwanted-region-and-fill-holes/15924#15924&quot;&gt;Link here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="8733" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-07-01T06:31:33.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17142" PostTypeId="1" CreationDate="2014-07-01T07:24:26.633" Score="0" ViewCount="418" Body="&lt;p&gt;How can I analyze a basic sine wave for its frequency phase and amplitude at a particular point in time in MATLAB? Are there any tools to do that? I am trying to do additive synthesis of inharmonic sounds in MATLAB, but having a great difficulty to extract the needed phase amplitude and frequency data of the partials I am trying to generate. Can someone shed some light regarding signal analysis in MATLAB?   &lt;/p&gt;&#xA;" OwnerUserId="10296" LastEditorUserId="8202" LastEditDate="2014-07-01T07:41:34.860" LastActivityDate="2015-07-29T11:08:39.633" Title="how can I analyze a basic sine wave for its frequency phase and amplitude at a particular point in time in matlab" Tags="|matlab|fft|signal-analysis|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17143" PostTypeId="2" ParentId="17138" CreationDate="2014-07-01T07:32:43.480" Score="3" Body="&lt;p&gt;The dip at Nyquist has to do with the fact that you didn't assign the value $0$ to the desired phase at Nyquist. You correctly assigned $0$ to the phase at DC, but you have to do the same at Nyquist, because a filter with real-valued coefficients has a real-valued frequency response at DC &lt;em&gt;and&lt;/em&gt; Nyquist. So you just need 127 random numbers, not 128.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the plot of the magnitude response of the designed filter is deceptive, because by taking an FFT (of length 256) of the coefficients you basically just plot the desired magnitude (apart from the Nyquist point), because you just invert your design process. Try to zero-pad your coefficients and take an FFT of length 1024 or more. You will be surprised to see that your filter doesn't at all resemble a very good all-pass filter. You see some indication of this in your second plot, which is more realistic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a non-trivial FIR filter (i.e. one which is not just a single delta impulse) can never have an exactly constant magnitude response, because its transfer function is a polynomial which can't be constant (unless it is a trivial polynomial). Your all-pass filter has an especially poor magnitude response because it is very hard for the filter to approximate those random phase jumps.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-01T07:32:43.480" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17145" PostTypeId="1" CreationDate="2014-07-01T09:50:29.097" Score="2" ViewCount="409" Body="&lt;p&gt;I was searching on the Internet hopelessly about some materials regarding detecting a sound in another sound. Say, I've got a recorded short sound (which may be anything, fragment of speech, fragment of music, noise, their combination or something else) and a longer sample, which contains this sound somewhere. The problem is, that the sound may be partially mixed with some ambient sounds. I know though, that despite mixing with other sounds, this will be &lt;em&gt;exactly&lt;/em&gt; the sample I have recorded earlier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which algorithm may I use to perform such search?&lt;/p&gt;&#xA;" OwnerUserId="10370" LastActivityDate="2014-10-30T17:16:14.940" Title="Detecting sound inside a sound" Tags="|discrete-signals|signal-analysis|signal-detection|local-features|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17146" PostTypeId="2" ParentId="17145" CreationDate="2014-07-01T10:00:55.330" Score="0" Body="&lt;p&gt;If your exact sample is present, you want to use circular cross-correlation between your signal and your recorded short sound:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Cross-correlation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because it is a measure of correlation, consider that if an absolute value of normalized cross-correlation is over 0.7 in the results, it is very likely that your signal is located at that index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross-correlation can be computed using the sum formulas if the data set is relatively small, and can be computed using Fourier transforms and the fft for improved speed with larger data sets:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Circular_convolution_theorem_and_cross-correlation_theorem&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Circular_convolution_theorem_and_cross-correlation_theorem&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5779" LastActivityDate="2014-07-01T10:00:55.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17147" PostTypeId="2" ParentId="17139" CreationDate="2014-07-01T13:46:43.110" Score="1" Body="&lt;p&gt;It would appear by your question that you are new to filter design, which makes it difficult to answer questions about your filtering needs, so you might want to try this link.  &lt;a href=&quot;http://www.iowahills.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This site has free FIR and IIR filter design programs that make it point and click simple to design and compare filters. The programs make it easy to see the how the various filter parameters such as pole count, tap count, response type (Butterworth, Chebyshev, Adjustable Gauss, etc.), linear phase, minimum phase, etc., affect a filter's response in both the time and frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These programs can't replace Python, (they only design filters and filter data on the program's test bench), but they will make it quite easy to choose a filter design to use within Python.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2014-07-01T13:46:43.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17148" PostTypeId="1" AcceptedAnswerId="17161" CreationDate="2014-07-01T15:08:09.993" Score="4" ViewCount="237" Body="&lt;p&gt;We all know the famous Wiener Filter,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega_1 , \omega_2)=\dfrac{H^*(\omega_1 , \omega_2)}{|H(\omega_1 , \omega_2)|^2 + \dfrac{N(\omega_1 , \omega_2)}{S(\omega_1 , \omega_2)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to we use it practically? Meaning, given $y = s * h + n$ where $s$ is the original image, $h$ is a LSI operator, and $n$ is some noise (independent of $s$), how to calulate (or estimate) $N(\omega_1 , \omega_2)$ and $S(\omega_1 , \omega_2)$ in order to reconstruct $s$ from $y$?&lt;/p&gt;&#xA;" OwnerUserId="10372" LastEditorUserId="128" LastEditDate="2019-12-29T09:24:13.243" LastActivityDate="2019-12-29T09:24:13.243" Title="Wiener Filters - Obtaining / Estimating Image and Noise Spectrum" Tags="|image-processing|filters|estimation|wiener-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17149" PostTypeId="1" AcceptedAnswerId="17152" CreationDate="2014-07-01T15:44:42.880" Score="1" ViewCount="60" Body="&lt;p&gt;I am having trouble understand what I think should be a pretty simple concept.  Conceptually I can understand that a signal that has been down-converted, and then delayed in time is different than a signal that has been delayed in time and then down-converted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to compensate for this difference on an FPGA (I am down-converting the signal, delaying in time, and then up-converting)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I see it, the delayed (and attenuated signal) looks like:&#xA;$A e^{i(\omega_{\text{c}}-\omega_{\text{lo}})(t-\tau_1)} m(t-\tau_1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is different from a down-converted delayed signal, so I need a phase correction constant:&#xA;$\phi = e^{i\omega_{\text{lo}}\tau_1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which gives:&#xA;$A e^{i(\omega_{\text{c}}-\omega_{\text{lo}})t - i\omega_{\text{c}}\tau_1} m(t-\tau_1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the correction is a function of the LO and the delay itself, right?  I have my sampled signal in I and Q, but I need to multiply it by the correction before up-converting, and that is where I am lost.  &lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2014-07-01T16:33:49.210" Title="Difference between delayed down-converted signal and a down-converted delayed signal" Tags="|filters|digital-communications|conversion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17150" PostTypeId="1" CreationDate="2014-07-01T15:51:44.753" Score="0" ViewCount="4855" Body="&lt;p&gt;I &lt;strong&gt;know&lt;/strong&gt; that frequency is not the same as the rate of change of amplitude, but &lt;strong&gt;why?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surely a high frequency is when your amplitude changes rapidly. Does an FFT perform something &lt;strong&gt;similar&lt;/strong&gt; to differentiation of a function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, what else is needed other than my amplitude values to plug into an FFT to get frequencies?&lt;img src=&quot;https://i.stack.imgur.com/6Le44.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8312" LastEditorUserId="8312" LastEditDate="2014-07-01T15:59:20.820" LastActivityDate="2014-07-01T17:15:31.650" Title="What is the rate of change of amplitude? Frequency?" Tags="|fft|frequency|amplitude|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17151" PostTypeId="2" ParentId="17150" CreationDate="2014-07-01T16:29:05.723" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;but why?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Some counter examples showing why it would be hard to try to define frequency from rate of change:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rate of change scales with amplitude (multiply a signal by 1000, the rate of change will be multiplied by 1000 too) ; while frequency should be amplitude independent.&lt;/li&gt;&#xA;&lt;li&gt;A sine wave has constant frequency but its rate of change varies over the course of the waveform (and gets null at minima maxima).&lt;/li&gt;&#xA;&lt;li&gt;Consider a 10 Hz sine wave, of amplitude 1V, to which are added spiky bursts of noise of amplitude 1µV with an attack time of 1ns. The rate of change will become extremely high at these points - but the noise is absolutely irrelevant in determining the dominant frequency of the signal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does an FFT perform something similar to differentiation of a&#xA;  function?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what else is needed other than my amplitude values to plug into an FFT to get frequencies?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;FFT does not give frequencies. It gives complex amplitudes for a set of equally spaced frequencies.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-07-01T16:29:05.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17152" PostTypeId="2" ParentId="17149" CreationDate="2014-07-01T16:33:49.210" Score="2" Body="&lt;p&gt;Let your original signal be (leaving out any constant multiplicative factor):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=e^{i\omega_ct}m(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the down-converted signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{s}(t)=e^{i(\omega_c-\omega_{lo})t}m(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its delayed version is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{s}(t-\tau)=e^{i(\omega_c-\omega_{lo})(t-\tau)}m(t-\tau)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whereas the delayed and down-converted signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t-\tau)e^{-i\omega_{lo}t}=e^{i\omega_c(t-\tau)}e^{-i\omega_{lo}t}m(t-\tau)=&#xA;\tilde{s}(t-\tau)e^{-i\omega_{lo}\tau}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the correction factor $e^{-i\omega_{lo}\tau}$ indeed depends on both $\omega_{lo}$ and the delay $\tau$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-01T16:33:49.210" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17153" PostTypeId="2" ParentId="16629" CreationDate="2014-07-01T16:45:08.503" Score="2" Body="&lt;p&gt;Real strings don't have a perfect integer overtone series. Responsible for this is the stiffness of the string that gives higher frequencies (i.e. shorter wavelength) a greater force towards the equilibrium position and increases the frequency of the higher order modes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This small inharmonicity is responsible for the general shape of your cepstrum. Our auditory system still manages to assign a single pitch sensation to the guitar string signal. This sensation does however not have to coincide with the cepstral peak you see, because that depends a lot on the duration of your signal frame and the window you apply to it. You can probably tune these parameters so that you get a reading that matches the nominal pitch of the guitar string, but it will then not give the right result for other inharmonic signals with a clear pitch sensation.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-07-01T16:45:08.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17154" PostTypeId="2" ParentId="17150" CreationDate="2014-07-01T17:15:31.650" Score="2" Body="&lt;p&gt;Fourier transforms and differentiation are indeed very different, but your intuition is still not entirely wrong. Here's how to make sense of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume you have a signal that is essentially sine-shaped locally, i.e. we can write it as $s(t) = a \sin(2 \pi f t)$ for a times $t$ close to some time $t_0$. In other words: The signal oscillates like a sine and has a sufficiently slowly changing envelope and instantaneous frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The time derivative of this signal is $s'(t) = 2 a \pi f \cos(2 \pi f t)$. This signal is also oscillating with the same frequency and its amplitude is scaled by $2\pi f$ compared to the original signal. So the frequency is encoded in the derivative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few different methods for decoding the frequency from this derivative, and I'll describe the one that is probably closest to your intuition. We have to get rid of the oscillating part. So let's take first the magnitude of both signals and afterwards apply a low pass filter $H_l$ that removes the residual oscillation and leaves you with just the average value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_l(|s(t)|) = a \frac{2}{\pi}$$&#xA;$$H_l(|s'(t)|) = 2 a \pi f \frac{2}{\pi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;( The 2/$\pi$  comes from averaging over $|\sin(t)|$. ) With this, we can find the quotient of the two results and have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{H_l(|s'(t)|)}{H_l(|s(t)|)}=2\pi f$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which demonstrates that the derivative of the signal in fact yields a very accurate approximation of the frequency under the assumptions we made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more general signals this method calculates not the instantaneous frequency but the so called spectral centroid frequency.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-07-01T17:15:31.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17155" PostTypeId="1" AcceptedAnswerId="17156" CreationDate="2014-07-02T05:08:43.393" Score="0" ViewCount="282" Body="&lt;p&gt;Why do people calculate impulse response? Generally systems are designed after modelling the possible input signals and calculating the appropriate filters for the desired outputs. Where does impulse response calculation become important?&lt;/p&gt;&#xA;" OwnerUserId="6940" LastActivityDate="2014-07-02T11:40:46.323" Title="Why impulse response" Tags="|filters|impulse-response|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17156" PostTypeId="2" ParentId="17155" CreationDate="2014-07-02T06:51:30.007" Score="2" Body="&lt;p&gt;Having the impulse response allows one to simplify the input of a sampled linear time-invariant system down to one single unit-magnitude input sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is usually fairly simple to build any time domain input from a single unit input (with a linear combination thereof), and thus, given the impulse response for that single input, the output for any time-domain-described input for that system.  Other basis vectors are possible, but may require more or less work (computational effort) for a given type of description of the input.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-02T06:51:30.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17158" PostTypeId="1" AcceptedAnswerId="17387" CreationDate="2014-07-02T07:30:16.767" Score="2" ViewCount="5355" Body="&lt;p&gt;The reason why Hu moments were implemented in OpenCV and why Zernike moments were not implemented is looking like their performance similar as stated in &lt;a href=&quot;http://www.smartcr.org/view/download.php?filename=smartcr_vol3no3p3.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As stated in the paper Zernike moments' advantage is their reconstruction facility. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a reliable implementation of Zernike moments compatible with OpenCV I would like to test their shape matching performance with &lt;a href=&quot;http://docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html#matchshapes&quot; rel=&quot;nofollow&quot;&gt;OpenCV's Hu moments shape matching&lt;/a&gt; performance and if possible reconstruction facility. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8948" LastEditorUserId="8948" LastEditDate="2014-07-02T09:42:40.730" LastActivityDate="2014-07-17T18:24:18.180" Title="Zernike Moments' implementation in OpenCV" Tags="|image-processing|computer-vision|opencv|local-features|shape-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17159" PostTypeId="1" AcceptedAnswerId="17175" CreationDate="2014-07-02T07:46:12.610" Score="4" ViewCount="234" Body="&lt;p&gt;I am working on building detection from aerial images using Image Processing in MATLAB.&lt;/p&gt;&#xA;&lt;p&gt;I am doing an image segmentation based on the local homogeneity of image. I want to apply &lt;a href=&quot;https://en.wikipedia.org/wiki/K-means_clustering&quot; rel=&quot;nofollow noreferrer&quot;&gt;K Means Clustering&lt;/a&gt; in &lt;a href=&quot;https://en.wikipedia.org/wiki/CIELAB_color_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;CIE LAB Color Space&lt;/a&gt; with some clusters on the anisotropic diffused image for color quantization and generate the image for further processing.&lt;br /&gt;&#xA;My RGB image is of 877 X 454 dimension.&lt;/p&gt;&#xA;&lt;p&gt;How do I do that?&lt;/p&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10377" LastEditorUserId="7092" LastEditDate="2022-01-20T19:33:37.517" LastActivityDate="2022-01-20T19:33:37.517" Title="How to Cluster Image Colors Using K Means Clustering in CIE a*b Domain?" Tags="|image-processing|image-segmentation|clustering|unsupervised-learning|k-means|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17161" PostTypeId="2" ParentId="17148" CreationDate="2014-07-02T09:42:36.973" Score="2" Body="&lt;p&gt;You are speaking about so called Wiener deconvolution, because Wiener filter is set by equation $ w = R^{-1}r $, where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$ R = E[y(n)y(n)^H] $ - autocorrelation matrix of input signal&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$ r = E[y(n)s(n)^*] $ - crosscorrelation vector of input signal and original signal. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So the practical solution when statistics $R$ and $r$ are unknown is the Method of Least Squares, where only data matrix $F$ and part of original signal $s$ are needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you should have some &lt;em&gt;a priori&lt;/em&gt; knowledge about formula entities. Try:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.umanitoba.ca/faculties/medicine/radiology/Dick_Gordon_papers/Dhawan%20et%CAal.%20%281985%29.pdf&quot; rel=&quot;nofollow&quot;&gt;https://www.umanitoba.ca/faculties/medicine/radiology/Dick_Gordon_papers/Dhawan%20et%CAal.%20%281985%29.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;or: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.eos.ubc.ca/research/cdsst/members/6_96.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.eos.ubc.ca/research/cdsst/members/6_96.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's a pity I only concern this subject in radio applications so there is nothing more to advise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="8202" LastEditDate="2014-07-02T12:56:52.523" LastActivityDate="2014-07-02T12:56:52.523" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17162" PostTypeId="2" ParentId="17155" CreationDate="2014-07-02T11:40:46.323" Score="1" Body="&lt;p&gt;The impulse response of an LTI system fully characterizes the system. It is unique to the LTI system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to give you some examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The impulse response lets you make statements about the stability of the system&lt;/li&gt;&#xA;&lt;li&gt;The impulse response convoluted with an input will give you the output of a system. This makes it especially easy in cases of DT signals.&lt;/li&gt;&#xA;&lt;li&gt;When cascading systems (i.e. constructing a series of systems) the complete impulse response is simple the convolution of all of the system impulse responses if the systems are LTI.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8103" LastActivityDate="2014-07-02T11:40:46.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17163" PostTypeId="1" AcceptedAnswerId="17164" CreationDate="2014-07-02T11:52:46.133" Score="2" ViewCount="3961" Body="&lt;p&gt;I'm currently stuck on a problem. I have a DT LTI system $\mathcal{T}$ that depicts the first backward difference: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = \mathcal{T} \{ {x[n] \} } = x[n] - x[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its impulse response is therefore: $h[n] = \delta[n] - \delta[n-1]$, where $\delta[n]$ is the DT unit impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to compute the impulse response $h'$ of the system $\mathcal{T}'$ that, when cascaded with $\mathcal{T}$, recovers my input: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{T}'\{\mathcal{T}\{x[n]\}\} = x[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the answer is that $h'[n]$ is the DT unit step $u[n]$, but I can't quite figure out why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my idea so far:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I know that the impulse response of the cascaded system is: $$h_{casc}[n] = \mathcal{T}'\{\mathcal{T}\{\delta[n]\}\} = \delta[n]$$&lt;/li&gt;&#xA;&lt;li&gt;I know that this impulse response is the convolution of the impulse responses of $\mathcal{T}'$ and $\mathcal{T}$, so: $$\delta[n] = h[n] \ast h'[n] = h'[n] \ast (\delta[n] - \delta[n-1]) = h'[n] - h'[n-1]$$&lt;/li&gt;&#xA;&lt;li&gt;So for $n=0$ I have: $$h'[0] - h'[-1] = 1$$&lt;/li&gt;&#xA;&lt;li&gt;And for $n \ne 0$ I have: $$h'[n] - h'[n-1] = 0 \Leftrightarrow h'[n] = h'[n-1]$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Still, this isn't enough to solve for $h'$ if I am not mistaken, as for example the following different signals would satisfy this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$... 4 \ 4 \ 4 \ 4 \ 4 \ 5 \ 5 \ 5 \ 5 \ 5 \ldots$, Here: $h'[-1] = 4$, $h'[0] = 5$&lt;/li&gt;&#xA;&lt;li&gt;$... 2 \ 2 \ 2 \ 2 \ 2 \ 3 \ 3 \ 3 \ 3 \ 3 \ldots$, Here: $h'[-1] = 2$, $h'[0] = 3$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can anyone give me a hint what I am missing here or perhaps point me to an error or in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="8103" LastEditorUserId="8202" LastEditDate="2014-07-02T12:04:51.587" LastActivityDate="2017-07-18T05:51:29.533" Title="Impulse response of the inverse system to the backward difference" Tags="|impulse-response|linear-systems|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17164" PostTypeId="2" ParentId="17163" CreationDate="2014-07-02T12:01:05.417" Score="2" Body="&lt;p&gt;You're on the right track. Let's call the impulse response of the second system (equalizing the first one) $h_2(n)$. The trick is to assume causality of the second system, i.e. $h_2(n)=0$ for $n&amp;lt;0$. By doing so, the solution for $h_2(n)$ becomes unique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The total impulse response of the cascaded system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(n)=h_2(n)-h_2(n-1)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this must equal $\delta(n)$. So we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_2(0)=1\\&#xA;h_2(n)=h_2(n-1),\quad n\ge 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_2(1)=h_2(0)=1\\&#xA;h_2(2)=h_2(1)=1\\&#xA;h_2(3)=h_2(2)=1\\\vdots$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $h_2(n)=u(n)$, where $u(n)$ is the discrete-time step function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you can also find an anti-causal filter $h_2(n)$ satisfying the requirement $h(n)=\delta(n)$. This anti-causal solution is $h_2(n)=-u(-n-1)$. You can easily convince yourself that for this choice of $h_2(n)$ the total impulse response $h(n)$ given by (1) also equals $\delta(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that all the solutions you gave at the end of the question have the form $h_2(n)=u(n)+c$ where $c$ is some constant. It is indeed true that all these systems are solutions to the problem because the frequency response of the first system has a zero at DC, compensating for any DC component of $h_2(n)$. However, all of these systems with $c\neq 0$ are neither causal nor stable.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-07-02T13:01:35.640" LastActivityDate="2014-07-02T13:01:35.640" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17166" PostTypeId="5" CreationDate="2014-07-02T13:56:54.353" Score="0" Body="&lt;p&gt;MFCCs are commonly derived as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take the Fourier transform of (a windowed excerpt of) a signal.&lt;/li&gt;&#xA;&lt;li&gt;Map the powers of the spectrum obtained above onto the mel scale, using triangular overlapping windows.&lt;/li&gt;&#xA;&lt;li&gt;Take the logs of the powers at each of the mel frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Take the discrete cosine transform of the list of mel log powers, as if it were a signal.&#xA;The MFCCs are the amplitudes of the resulting spectrum.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Great tutorial on MFCC: &lt;a href=&quot;http://practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/&quot; rel=&quot;nofollow&quot;&gt;MFCC Tutorial on Practical Cryptography&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10291" LastEditorUserId="10291" LastEditDate="2014-07-03T08:22:35.053" LastActivityDate="2014-07-03T08:22:35.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17167" PostTypeId="4" CreationDate="2014-07-02T13:56:54.353" Score="0" Body="Related to the calculation, verification, usage, and requirements for Mel Frequency Cepstral Coefficients." OwnerUserId="17486" LastEditorUserId="20203" LastEditDate="2017-01-04T00:40:38.903" LastActivityDate="2017-01-04T00:40:38.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17168" PostTypeId="1" AcceptedAnswerId="17182" CreationDate="2014-07-02T16:25:23.510" Score="0" ViewCount="101" Body="&lt;p&gt;I'm working this summer on a very interesting, albeit difficult to understand at 100 %, project and it turns around reducing the glare effect than could be applied on a receiver when he gets signals coming from two emitters sending $X(t)$ (more energy for this signal compared to the other) and $s(t)$ (much weaker).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me put it in other words.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The receiver gets a signal mixture $Y(t)=H(t)*X(t)+g(t)*s(t)$ but we don't know $H$ nor $X$ nor $g$ nor $s$ nor the frequencies of the emitted signals. The only thing we know is $Y(t)$ and the fact that their spectra are dissociated in the best cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A picture speaks a thousand words, so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O9htW.png&quot; alt=&quot;Excuse the terrible drawing&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the signal $X(t)$ overpowers $s(t)$. So I was thinking of a way to get the $s(t)$ and the $X(t)$ and with the few info I've gotten, I couldn't implement the generic solutions. However, I still have one card which is the &lt;strong&gt;FASTICA&lt;/strong&gt; but that would suppose having many samples of &quot;mixed &quot; signal to extract the two important signals. What do you think about it?  I'm open to any software and/or mechanic suggestion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read an interesting paper on this but they were talking about the near-far effect for GPS signals. &#xA;Thanks for the help!!&lt;/p&gt;&#xA;" OwnerUserId="10380" LastEditorUserId="90" LastEditDate="2014-07-02T17:35:46.953" LastActivityDate="2014-07-03T15:09:46.040" Title="Reduce the &quot;glare&quot; effect of a receiver within a system" Tags="|signal-analysis|signal-detection|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17169" PostTypeId="1" AcceptedAnswerId="17191" CreationDate="2014-07-02T21:49:57.770" Score="3" ViewCount="1168" Body="&lt;p&gt;I'm testing a background subtraction algorithm with sample image sequences. I am wondering how one can evaluate the accuracy of a background subtraction algorithm results given ground truths? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only idea I have in mind right now is to take the difference between a result image and its corresponding ground truth image and calculate difference/total_white_pixels_of(ground_truth).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &#xA;Dear all, by ground truth image I mean binary image with foreground as white blobs and background as black pixels. This is an example of input image and its ground truth:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HxcQo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/siLeX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;source: &lt;a href=&quot;http://wordpress-jodoin.dmi.usherb.ca/dataset2014/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://wordpress-jodoin.dmi.usherb.ca/dataset2014/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7685" LastEditorUserId="7685" LastEditDate="2014-07-04T00:47:33.143" LastActivityDate="2014-07-07T19:23:05.753" Title="How to evaluate a background subtraction algorithm given ground truths?" Tags="|background-subtraction|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17170" PostTypeId="2" ParentId="17142" CreationDate="2014-07-03T02:02:25.070" Score="0" Body="&lt;p&gt;if the sinusoid, $x(t)$, is uncontaminated, i s'pose you can measure all three by first computing the Hilbert transform of it, $\hat{x}(t)$ and, from the two, construct the &lt;a href=&quot;http://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;analytic signal&lt;/a&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_a(t) \ \triangleq \ x(t) \ + \ j\hat{x}(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the amplitude will be $|x_a(t)|$, the instantaneous phase will be $\phi(t) = \arg\{x_a(t)\}$ and, if the phase is unwrapped the derivative of the phase w.r.t. time is the instantaneous (angular) frequency is this derivative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega(t) \ = \ \frac{d}{dt}\phi(t) \ = \ \frac{d}{dt}\arg\{x(t) \ + \ j\hat{x}(t)\} $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-07-03T02:02:25.070" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17171" PostTypeId="1" AcceptedAnswerId="17172" CreationDate="2014-07-03T04:08:40.653" Score="0" ViewCount="283" Body="&lt;p&gt;I am a beginner in DSP and is familiar with $\sin(\theta)$ declaration (as studied in trigonometry) - where $\theta$ is the angle it makes with X - axis. Please tell me what does $\sin(2\pi f t  + \phi)$ equation means and how $\theta = 2\pi ft + \phi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="10384" LastEditorUserId="8202" LastEditDate="2014-07-03T06:45:37.387" LastActivityDate="2014-07-03T06:45:37.387" Title="DSP - Sinewave: what is $2\pi f t $?" Tags="|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17172" PostTypeId="2" ParentId="17171" CreationDate="2014-07-03T04:35:39.120" Score="1" Body="&lt;p&gt;A 1D sinusoidal wave, time dependent, is described by the next formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = A\sin(2\pi f t + \phi)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick here is just the concept. When you use the formula $A\sin(\theta) $ you aren't specifying if $\theta$ is time-dependent and you are not thinking in the formula as a wave, but as a mere function. But when you use the argument $2\pi f t$ you are considering the angular frequency $2\pi f$ ($rad/s$), where $ f $ is the normal frequency, and the wave's phase $\phi$ (which represents a shift in the wave).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are working with a simple sine wave, you can assume a zero-shift, $\phi = 0$, and select a working frequency. Sample the wave and work normally with your DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check sine wave description in &lt;a href=&quot;http://en.wikipedia.org/wiki/Sine_wave&quot; rel=&quot;nofollow&quot;&gt;WIKI&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10385" LastActivityDate="2014-07-03T04:35:39.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17173" PostTypeId="1" AcceptedAnswerId="17174" CreationDate="2014-07-03T04:40:09.687" Score="-1" ViewCount="190" Body="&lt;p&gt;I am a beginner in DSP but get confused when some formulas like below are referred:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cos(φt) · { A·cos(φt+Δ) } = ½·A·{ cos(Δ) + cos(2φt+Δ) } &#xA;x(n) = Acos(ω0n+φ)&#xA;T= 2kπ/ω&#xA;...........&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that I do not know what terms like 'φ' or How T is equal to 2kπ/ω.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I am lacking some elementary knowledge - but please let me know what are the topics / subjects I should hence first cover up such that when I read DSP related formulas, I understand them properly. &lt;/p&gt;&#xA;" OwnerUserId="10384" LastActivityDate="2014-07-03T05:01:39.513" Title="DSP - Understanding Formulas" Tags="|discrete-signals|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17174" PostTypeId="2" ParentId="17173" CreationDate="2014-07-03T05:01:39.513" Score="-1" Body="&lt;p&gt;First, the formulas by itself are from sine/cosine waves, so you should read a little about them first. &lt;a href=&quot;http://www.algebralab.org/lessons/lesson.aspx?file=trigonometry_trigperiodfreq.xml&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the rest, you only have to keep in mind the unities $\phi$ in $\frac{rad}{s}$, $\Delta$ in $rad$ and finally in x(n) is a discrete sine-wave (or sampled) that is why the $n$ in the formula. It is basically the same thing as with the $t$ but in discrete, or sampled, time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $T$ stands for the Period of the wave. You can perform simply math there to check the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T = \frac{2k\pi}{\omega}&#xA;$$&#xA;$$&#xA;T = \frac{1}{f}&#xA;$$&#xA;$$&#xA;\omega = 2\pi f= \frac{2\pi}{T}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you seen why we can obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T = \frac{2\pi}{\omega}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the $k$ stands, normally, for each of the cycle the wave is repeated. Then you can have $k$ = 0, 1, 2, ..., N&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand more how to work with this on DPS you only should read about Sine-waves and its representation. Basic knowledge in shifting and characteristics as Period, Frequency, Angular velocity and phase is a must.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bests!&lt;/p&gt;&#xA;" OwnerUserId="10385" LastActivityDate="2014-07-03T05:01:39.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17175" PostTypeId="2" ParentId="17159" CreationDate="2014-07-03T05:30:37.510" Score="1" Body="&lt;p&gt;You should use &lt;a href=&quot;http://www.mathworks.com/help/images/ref/makecform.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;makecform&lt;/code&gt;&lt;/a&gt; to create a color transfer structure.&lt;br&gt;&#xA;You should use &lt;code&gt;srgb2lab&lt;/code&gt; to create a structure which will convert you to LAB.&lt;br&gt;&#xA;To apply the color transformation use &lt;a href=&quot;http://www.mathworks.com/help/images/ref/applycform.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;applycform&lt;/code&gt;&lt;/a&gt;.&lt;br&gt;&#xA;Then, as a result you'll have an image in the LAB domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use &lt;a href=&quot;http://www.mathworks.com/help/stats/kmeans.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;kmeans&lt;/code&gt;&lt;/a&gt; to cluster the image colors on the AB channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good Luck...&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-07-03T05:30:37.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17176" PostTypeId="1" CreationDate="2014-07-03T06:33:29.493" Score="-1" ViewCount="2431" Body="&lt;p&gt;Let us consider following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=100;&#xA;N=1000;&#xA;t=0:1/fs:N-1;&#xA;y=10*sin(2*pi*100*t)+0.5*randn(size(t));&#xA;plot(y)&#xA;plot(t,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qzlpG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have applied following  threshold  methods:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;thr = 0.4;&#xA;% Perform hard thresholding. &#xA;ythard = wthresh(y,'h',thr);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/18LE0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2jyNc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't see any difference, also soft threshold method,codes are below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ythard = wthresh(y,'h',thr);&#xA;plot(ythard)&#xA;ytsoft = wthresh(y,'s',thr);&#xA;plot(ytsoft)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So what is wrong? I have also done thresholding time domain without calculation of the wavelet coefficients. Are they equal to each other? I mean if I will generate wavelet coefficients and threshold this coefficients, will they give me same result? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="8202" LastEditDate="2014-07-03T07:03:35.517" LastActivityDate="2014-07-16T16:16:09.757" Title="Denosing signal using soft and hard thresholding" Tags="|matlab|noise|wavelet|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17177" PostTypeId="2" ParentId="17176" CreationDate="2014-07-03T07:28:35.093" Score="0" Body="&lt;p&gt;Where exactly is wavelet calculation in your code? Code you posted is some kind of strange thresholding of amplitude. For example what you are doing for 'hard' case, is zeroing of all samples lower than 0.4 (zoom in your plots):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WDo7g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This operation is pointless (unless you really want to do so) and has nothing to do with thresholding of wavelet coefficients and they are not equal. Extract the wavelet coefficients, threshold them and reconstruct a signal. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-07-03T07:28:35.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17178" PostTypeId="1" AcceptedAnswerId="17179" CreationDate="2014-07-03T09:29:30.433" Score="0" ViewCount="218" Body="&lt;p&gt;Here is a small MATLAB function that computes B in B/A given A and the impulse response h of B/A&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function b = numf(h,a,nb)&#xA;%NUMF   Find numerator B given impulse-response h of B/A and denominator A&#xA;%   NB is the numerator order. &#xA;&#xA;nh = max(size(h)); &#xA;impr = filter(1,a,[1 zeros(1,nh-1)]);&#xA;&#xA;egqs = toeplitz(impr,[1 zeros(1,nb)]);&#xA;&#xA;b = h/egqs';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could someone help me understand why these steps give B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get what &lt;code&gt;filter()&lt;/code&gt; and &lt;code&gt;toeplitz()&lt;/code&gt; do, but not the last line : &lt;code&gt;b = h/egqs'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="8202" LastEditDate="2014-07-03T09:46:01.243" LastActivityDate="2014-07-03T11:00:59.000" Title="Find B given A and impulse response of B/A" Tags="|matlab|impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17179" PostTypeId="2" ParentId="17178" CreationDate="2014-07-03T10:07:41.483" Score="2" Body="&lt;p&gt;The vector &lt;code&gt;impr&lt;/code&gt; holds the impulse response of length &lt;code&gt;nh&lt;/code&gt; of an all-pole filter with denominator coefficients given by &lt;code&gt;a&lt;/code&gt;. Let's call this impulse response $g(n)$. The impulse response $h(n)$ must satisfy the equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(n)=(g*b)(n)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where * denotes convolution. With the given data, this results in an overdetermined system of linear equations, the system matrix of which is the Toeplitz matrix &lt;code&gt;egqs&lt;/code&gt;. The last line in the code solves this overdetermined system of linear equations corresponding to (1) in a least-squares sense. You could achieve the same using the backslash operator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = egqs\h';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-07-03T11:00:59.000" LastActivityDate="2014-07-03T11:00:59.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17180" PostTypeId="1" AcceptedAnswerId="17181" CreationDate="2014-07-03T11:58:05.533" Score="0" ViewCount="57" Body="&lt;p&gt;The following text is from &lt;em&gt;Digital Image Processing(Gonzalez and Woods)[3ed, Ch 2.2,p46]&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If a sensor can detect energy radiated by a band of electromagnetic spectrum, we can image events in that band. But the wavelength of electromagnetic wave required to “see” an object must be same size or smaller than the object.For example, a water molecule has diameter $10^{-10}$ m. To study water molecules, &lt;strong&gt;a source capable of emitting&lt;/strong&gt; in far ultraviolet or soft X-ray region is required.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For the water molecule example, why do the authors refer to &lt;strong&gt;a source emitting&lt;/strong&gt; ? As an analogy, for X-rays, the bones absorb waves in X-ray region and this renders them opaque on the film. Therefore, to image water molecules, a source which emits far ultraviolet/soft X-rays is needed. Passing this through water would somehow let us image water molecules. Is that what they mean ?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2014-07-03T12:30:31.393" Title="Relationship between sensors and materials in terms of electromagnetic spectrum" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17181" PostTypeId="2" ParentId="17180" CreationDate="2014-07-03T12:30:31.393" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;But the wavelength of electromagnetic wave required to “see” an object must be same size or smaller than the object.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Essentially, the waves are unaffected (at least not enough to be detected) by objects that are smaller than the wavelength. Since we look at the distortion in the waveform to image objects, no distortion would mean an object is undetectable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine you are walking down a rocky path. Small rocks and pebbles would not change your gait at all, so they would be undetectable to you. Large stones, however, would force you to change your step, making them detectable. If you were much smaller and took shorter steps (or a shorter wavelength), then these small objects would become detectable to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to answer your questions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For the water molecule example, why do the authors refer to a source&#xA;  emitting ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Because it is the wavelength of the radiation source which matters for imaging.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Therefore, to image water molecules, a source which emits far&#xA;  ultraviolet/soft X-rays is needed. Passing this through water would&#xA;  somehow let us image water molecules. Is that what they mean ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;At that wavelength or smaller, yes. Operating at that wavelength, with the proper detection equipment, should allow you to image water molecules and larger.&lt;/p&gt;&#xA;" OwnerUserId="4439" LastActivityDate="2014-07-03T12:30:31.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17182" PostTypeId="2" ParentId="17168" CreationDate="2014-07-03T15:09:46.040" Score="0" Body="&lt;p&gt;If you want to separate two sources you need some kind of diversity. Your know almost nothing about these signals so the only diversity you can exploit is frequency one. So &lt;em&gt;first&lt;/em&gt; both spectrum should not be overlapped. And &lt;em&gt;the second&lt;/em&gt;: as you know not all transmitted energy of the strong source (that you called $X(t)$) is allocated in the band you draw. Some out of band emission exists and its power depends on shape filter and power amplifier. So if even $X(t)$ and $s(t)$ are not overlaped at all, $s(t)$ may be totally shaded by out of band emission of $X(t)$. And you can't filter it out. You may refer to the problem of multiple access interference (MAI) problem of multi-user systems for details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose frequency diversity is big enough and no out of band emission of $X(t)$ interferes with $s(t)$. As you were told &lt;strong&gt;FFT&lt;/strong&gt; can be used to allocate both of the signals and further we can do bandpass filtering to completely distinguish them. But you probably need a large amount of data to achieve high resolution with &lt;strong&gt;FFT&lt;/strong&gt; approach. Though you can improve &lt;strong&gt;FFT&lt;/strong&gt; performance by windowning data set. The main advantage of &lt;strong&gt;FFT&lt;/strong&gt; in this case is its ability to allocate signal even at very bad SNR (0 or less). You only need to increase its size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative is using some correlation properties and second order statistics. As I understand Blind source separation rely on it (PCA, ICA, but I can mistake). You may estimate input signal autocorrelation matrix as $R = E[xx^H]$. Further if you make $svd(R)$ you'll get singular eigen values of the signal mixture. Using these methods you can separate sources only if their eigenvalues are distinguishable from each other and noise ones (noise subspace). If the diversity is low or signal is too weak its eigen value decreases and it becomes &quot;invisible&quot; to the algorithm. The main advantage is much less amount of data is needed to allocate sources in comparison with &lt;strong&gt;FFT&lt;/strong&gt; approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also important how large band of search is. It restricts complexity of the computations required. Furthermore $svd$ based methods (e.g. spectrum estimation) are good for narrowband sources (as I've seen, can mistake) while &lt;strong&gt;FFT&lt;/strong&gt; is well enough for both narrow- and broadband cases. &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-07-03T15:09:46.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17184" PostTypeId="2" ParentId="9654" CreationDate="2014-07-03T22:31:00.597" Score="2" Body="&lt;p&gt;i realize this question popped up in current view because @Drazick modified his/her 2013 answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you generate a &lt;strong&gt;good&lt;/strong&gt; uniform p.d.f. pseudo-random number $x$ (say using &lt;code&gt;rand()&lt;/code&gt; or &lt;code&gt;frand()&lt;/code&gt;, if it's a good version) that ranges from 0 to 1 (that is $0 \le x &amp;lt; 1$), then if you do that 12 times, add up all 12 of the supposedly independent and uncorrelated values, and subtract 6.0 from that sum, you will have something that is &lt;strong&gt;very&lt;/strong&gt; close to a unit-variance and zero-mean gaussian random number.  if the uniform p.d.f. pseudo-random numbers are &quot;good&quot; (that is they exhibit independence from each other), this sum will be as &quot;white&quot; as you can get a discrete-time signal to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&quot;white noise&quot;&lt;/em&gt; is, of course a misnomer, even for analog signals.  a &quot;power signal&quot; with flat spectrum all the way to infinity also has infinite power.  the virtually-gaussian and &quot;white&quot; signal generated as described has a finite power (which is the variance and is 1) and finite bandwidth which, expressed as one-sided, is Nyquist.  (so the 'power spectral density&quot; or power per unit frequency is 1/Nyquist.)  scale it and offset it however you please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i s'pose i can edit this later and add some C-like pseudo-code to show this explicitly.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-07-03T22:31:00.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17186" PostTypeId="1" AcceptedAnswerId="17197" CreationDate="2014-07-04T00:41:43.207" Score="0" ViewCount="689" Body="&lt;p&gt;I've a fundamental problem with understanding terminology used in DSP. What does it mean to tune a radio (for example, a software defined radio) to a certain carrier frequency $f$? The received signal is an arbitrary waveform and not a sine wave of frequency $f$. I understand AM modulation: you take a sine and manipulate its amplitude. The FM modulation I don't get: the modulated signal is not a sine, so why do we say that we tune a radio to a certain frequency in that case?&lt;/p&gt;&#xA;" OwnerUserId="10396" LastActivityDate="2014-07-04T18:45:15.080" Title="Tuning a radio to a certain frequency" Tags="|frequency|modulation|amplitude|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17187" PostTypeId="1" AcceptedAnswerId="17188" CreationDate="2014-07-04T02:49:26.670" Score="1" ViewCount="3098" Body="&lt;p&gt;I want to match a small template to a larger image, that the distance between the template and the subimage with the same size of the template is minimized. It can be solved directly or by applying 2D cross correlation, and both methods have an O(n^4) time complexity. Are there any method to simplify the algorithm by either reducing the complexity or applying pre-processing?&lt;/p&gt;&#xA;" OwnerUserId="7103" LastActivityDate="2014-09-17T18:08:07.810" Title="fast 2D cross correlation algorithm" Tags="|image-processing|algorithms|cross-correlation|template-matching|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17188" PostTypeId="2" ParentId="17187" CreationDate="2014-07-04T03:21:03.380" Score="3" Body="&lt;p&gt;If your template or kernel is small, then straight convolution might be the fastest approach. There's a crossover point when performing convolution in the frequency domain is faster than straight time/spatial domain convolution and it can be hardware dependent, but usually when the kernel (template) approaches 1/4-1/2 the size of the image frequency domain convolution is faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a multicore machine you can split the larger image into say 4 quadrants and run the spatial convolution on 4 threads and fuse the results together. That should actually be pretty speedy.&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-07-04T03:21:03.380" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17189" PostTypeId="1" AcceptedAnswerId="17210" CreationDate="2014-07-04T06:18:48.930" Score="3" ViewCount="183" Body="&lt;p&gt;I was reading my book where the z-transform of a signal is derived to be ${1-e^{-2bT}z^{-1}}$ . Then it goes on to say that by applying the bilinear transform we can get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2(1+bT+(bT-1)z^{-1})}{T(1+z^{-1})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know a little bit about bilinear transform but this example is using it in a different context. Can someone please help me understand how the bilinear transform is being used here.&lt;/p&gt;&#xA;" OwnerUserId="10360" LastEditorUserId="128" LastEditDate="2019-03-29T11:28:10.033" LastActivityDate="2019-03-29T11:28:10.033" Title="Confusion Regarding Bi Linear Transform" Tags="|z-transform|speech-processing|laplace-transform|bilinear-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17191" PostTypeId="2" ParentId="17169" CreationDate="2014-07-04T09:01:09.193" Score="2" Body="&lt;p&gt;One way would be to create a simple signal-to-noise estimate, using the pixel intensity and the ground truth image as a mask. Here's an example of what I mean in Python:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;# Sample data &#xA;# Indices [0, 1, 2, 6] are background, [3, 4, 5] are object&#xA;original  = np.array([1, 2, 2, 5, 6, 8, 2])&#xA;truth     = np.array([0, 0, 0, 1, 1, 1, 0])&#xA;back_mask = 1 - truth&#xA;result    = np.array([0, 1, 0, 4, 5, 7, 1]) # Result of background subtraction&#xA;&#xA;def non_masked_mean(input_array, mask):&#xA;    &quot;&quot;&quot;mean of non-masked elements in the array&quot;&quot;&quot;&#xA;    return np.ma.masked_array(input_array, mask).mean()&#xA;&#xA;def snr(input_array, back_mask):&#xA;    &quot;&quot;&quot;ratio of non-masked to masked mean intensities&quot;&quot;&quot;&#xA;    with np.errstate(all='ignore'):&#xA;        snr = non_masked_mean(input_array, back_mask) / non_masked_mean(input_array, (1-back_mask))&#xA;    return 0 if np.isnan(snr) else snr&#xA;&#xA;snr_before = snr(original, back_mask)  # (mean of objects / mean of background), before&#xA;snr_after  = snr(result, back_mask)    # (mean of objects / mean of background), after&#xA;snr_ratio  = snr_after / snr_before&#xA;&#xA;if snr_after == np.inf:&#xA;    print &quot;Perfect SNR in result! Either great or suspect...&quot;&#xA;elif snr_after == 0:&#xA;    print &quot;Image was flattened :(&quot;&#xA;else:&#xA;    print &quot;SNR changed by a multiple of %.2f&quot; % (snr_ratio)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem with this is that you get a perfect score by favouring a heavy-handed background subtraction. Even if only 1 pixel of the object survives this SNR will be infinite. Another approach would be to consider the background and the signal separately, and weight the results of the two. Then you can decide if it's more important to flatten the background, or preserve the original.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def non_masked_mean_ratio(input_array, result_array, mask):&#xA;    &quot;&quot;&quot;ratio of two array means, with the same mask&quot;&quot;&quot;&#xA;    return non_masked_mean(result_array, mask) / non_masked_mean(input_array, mask) &#xA;&#xA;signal_ratio     = non_masked_mean_ratio(original, result, back_mask)     # (mean of objects after) / (mean of objects before)&#xA;background_ratio = non_masked_mean_ratio(original, result, truth)         # (mean of background after) / (mean of background before)&#xA;weight           = 0.5   # Higher weight favours preservation of objects&#xA;&#xA;score = (weight*signal_ratio) + ((1-weight) * (1-background_ratio))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives the score a nice expected range of about 0-1, where 1 is the ideal result. It's not perfect though, as you can boost it by increasing the intensity of the objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're expecting a binary result, you can use a similar strategy except using the number of non-zero pixels instead of the mean:&lt;/p&gt;&#xA;&#xA;   &#xA;&#xA;&lt;pre&gt;&lt;code&gt;def nonzero_count_ratio(result_array, ideal_array):&#xA;    &quot;&quot;&quot;ratio of actual number of non-zero pixels vs ideal non-zero pixels&quot;&quot;&quot;&#xA;    return float(np.count_nonzero(result_array*ideal_array)) / np.count_nonzero(ideal_array)&#xA;&#xA;true_obj_ratio   = nonzero_count_ratio(result, truth)     # Number of correct object pixels vs number of potential correct&#xA;false_back_ratio = nonzero_count_ratio(result, back_mask) # Number of false background pixels vs number of potential false&#xA;weight           = 0.5&#xA;&#xA;score = (weight*true_obj_ratio) + ((1-weight) * (1-false_back_ratio))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7911" LastEditorUserId="7911" LastEditDate="2014-07-07T19:23:05.753" LastActivityDate="2014-07-07T19:23:05.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17192" PostTypeId="2" ParentId="17189" CreationDate="2014-07-04T11:47:27.870" Score="2" Body="&lt;p&gt;The bi linear transform is the transform from the Laplace Transform Domain to the Z Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Laplace Transform Domain is a regular plane.&lt;br&gt;&#xA;This transform transforms vertical lines in the Laplace domain into circles in the Z Domain.&lt;br&gt;&#xA;Hence the Fourier Vertical Line in Laplace Domain (The Y Vertical Lines) is transformed into the unit circle in the Z Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a little inaccurate here, since the whole left side of the plane is transformed into the inner part of the Z Plane and the right hand of the Laplace transform it transformed to the outer part of the Z Plane (Out of the unit circle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This transform is used to derive Digital Filters from their Analog Laplace domain representation.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-03-29T11:27:26.740" LastActivityDate="2019-03-29T11:27:26.740" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17193" PostTypeId="1" CreationDate="2014-07-04T12:19:06.007" Score="0" ViewCount="87" Body="&lt;p&gt;&lt;strong&gt;FIR Networks&lt;/strong&gt; are a really great kind of Neural Networks. It allows very precise &lt;strong&gt;predictions&lt;/strong&gt; of missing samples for example when ones wants to reconstruct missing signals or adaptive noise cancellations, etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to understand &lt;strong&gt;how they work&lt;/strong&gt; and a great paper about it is the one by &lt;strong&gt;WAN in 1993&lt;/strong&gt; : &lt;a href=&quot;http://www.cslu.ogi.edu/publications/ps/wan93c.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cslu.ogi.edu/publications/ps/wan93c.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is an &lt;strong&gt;example&lt;/strong&gt; of a FIR connection, and the computation of the &lt;strong&gt;weight changes&lt;/strong&gt; knowing weights $b()$ or $a()$, inputs $u(k)$, $x(k)$ and error $e(k)$&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UPOPy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is said in the paper that : as the signal has to be &lt;strong&gt;&lt;em&gt;propagated&lt;/em&gt;&lt;/strong&gt; through the network, the resulting error has to be &lt;strong&gt;&lt;em&gt;back-propagated&lt;/em&gt;&lt;/strong&gt; through the same network&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is a simple image explanation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/irWff.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so &lt;strong&gt;the goal is to find&lt;/strong&gt; $\delta$(k) for a given neuron to be able to work backwards the gradient (the error)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is the formula of the weights ($a()$, $b()$) updates:&#xA;$$\bigtriangleup  \bf w \rm ^l _{ij} = - \mu \delta^{l+1} _j (k) \cdot \bf a\rm^l_i(k) \ \ (1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\delta^l_j(k) = -2e_j(k)f'(s^L_j(k)) \ \ (2)\normalsize \\\ if \ l = L \ (last \ layer) $$&#xA;and &#xA;$$\delta^l_j(k) = f'(s^l_j(k))\cdot\sum_m \bf\delta\rm ^{l+1}_m(k)\cdot\bf w\rm ^{l+1}_{jm} \ \ (3) \normalsize \\\ if \ 1 \leq l \leq L -1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f'$ is the derivate of the activation function. An important point is that $\bf w \rm ^l _{ij}$ and $\bf \delta$ are &lt;strong&gt;&lt;em&gt;vectors&lt;/em&gt;&lt;/strong&gt;, not scalars.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;page 26 we see : &#xA;$$\bf w\rm^l_{ij} = [ w^l_{i,j}(0), w^l_{i,j}(1), \ ... \ ,w^l_{i,j}(M^l)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the vector of delayed activation values is :&#xA;$$ \bf a\rm ^l _i (k) = [a^l_i(k), a^l_i(k-1), \ ... \ , a^l_i(k - M^{l+1})]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So let's take the first step&lt;/strong&gt; : it is the last layer L (filter b in this example) and we have the error $y(k) = e(k)$, the actual weights $b(0), b(1), b(2)$ and the signal values $\bf a\rm^l_i(k) = [u(k), u(k-1) ...]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to understand fully how to compute each weight change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using (2) we first compute the weight change &#xA;$$\bigtriangleup w_{b(2)} = - \mu \delta^{l+1} _j (k) \cdot \bf a\rm^l_i(k)$$&#xA;$$\bigtriangleup w_{b(2)} = 2 \mu e_j(k)f'(s^L_j(k)) \cdot u(k-2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we have the new weight &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$b(2) = b(2) + \bigtriangleup w$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;is this first assertion correct?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and if it is, i have trouble understanding what is the next step:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;do we have to multiply $e(k)$ by the new weigth $b(2)$ to get the error for the next backward step (at weight $b(1)$) ?&#xA;so for b(1) we use $$\bigtriangleup w_{b(1)} = 2 \mu e_j(k)b(2)f'(s^L_j(k)) \cdot u(k-1)$$&lt;/li&gt;&#xA;&lt;li&gt;or do we have to use always the same value of e(k) for the next weight update : $b(1) = b(1) - \mu \delta^l_j(k) \cdot u(k-1)$ ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;for the second FIR filter&lt;/em&gt;&lt;/strong&gt; there is a difference.&#xA;Here we use eq (3) as &lt;strong&gt;it is not the last layer L.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this simple case of two cascaded FIR filters, i think $(1)$ could be rewrote as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\bigtriangleup  \bf w \rm ^l  = - \mu \delta^{L} (k) \cdot \bf x\rm(k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta^{L} _j (k)$ is the previously calculated $\delta$ and $x(k) = [x(k), x(k-1), \ ... \ , x(k-M)]$&#xA;and as before we multiply the gradient $\delta$ by the updated weights and go backward to the start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;is it right?&lt;/strong&gt; or am i wrong (and where)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also it would be very nice if ones could possibly put some general pseudo-code to compute the whole FIR network or point to some existing code so i can compare the algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thanks for help&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="8366" LastEditDate="2014-07-04T13:20:00.723" LastActivityDate="2014-07-04T13:20:00.723" Title="Backward propagation of error in FIR Neural Networks" Tags="|finite-impulse-response|machine-learning|system-identification|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17196" PostTypeId="1" CreationDate="2014-07-04T15:04:10.937" Score="3" ViewCount="66" Body="&lt;p&gt;I need to model the dispersion which is introduced by an EML in Matlab. The parameters are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lambda: 1310nm &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PAM4 power:&#xA;Pmax = 1.09 mW&#xA;Pmin = 0.13 mW&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bandwidth = 56Gbps&lt;/p&gt;&#xA;" OwnerUserId="10244" LastEditorUserId="128" LastEditDate="2019-03-29T11:28:57.017" LastActivityDate="2019-03-29T11:28:57.017" Title="How to Model the Dispersion Which Is Introduced by an Electro Absorption Modulator (EML)?" Tags="|filters|discrete-signals|modulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17197" PostTypeId="2" ParentId="17186" CreationDate="2014-07-04T15:27:07.293" Score="0" Body="&lt;p&gt;there are a lot of misconceptions in the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&quot;The received signal is an arbitrary waveform and not [only] a sine wave of frequency $f$.&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it's a collection of sine waves at different frequencies.  and &quot;tuning&quot; a radio or a filter or whatever is selecting frequency components in the neighborhood of $f$ while rejecting the others.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-07-04T15:27:07.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17198" PostTypeId="1" AcceptedAnswerId="17204" CreationDate="2014-07-04T17:48:12.330" Score="0" ViewCount="168" Body="&lt;p&gt;As I understand it, FIR filtering is a linear process. That mean for me that the whole filtering process will have a fully predictable behavior. &#xA;So, could someone explain why a universal deterministic and optimal filter design method  to obtain the desired response doesn't exist and why recursive approach seems to be of great interest in practice ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: just to clarify, my question is about an &quot;optimal&quot; method, that is one which compute the shortest filter response while staying the closest to the design criteria.&lt;/p&gt;&#xA;" OwnerUserId="9020" LastEditorUserId="9020" LastEditDate="2014-07-04T21:53:46.243" LastActivityDate="2014-07-21T14:28:57.230" Title="Why are recursives methods useful for FIR filter design?" Tags="|filter-design|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17199" PostTypeId="2" ParentId="17186" CreationDate="2014-07-04T18:45:15.080" Score="0" Body="&lt;p&gt;A mathematical theorem (named after Fourier) says that (non-pathological) signals that are &quot;not a sine&quot; are, for all practical purposes, identical to (or can be accurately described as) the sum of a bunch of pure sinusoids (of various phases and magnitudes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As practical radios don't have infinitely narrow bandwidths, when tuning to a single pure frequency, you actually get a suitable range of frequencies corresponding to a bunch of pure sinusoids, enough to reasonably describe and thus demodulate your &quot;not a sine&quot; original signal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-04T18:45:15.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17200" PostTypeId="2" ParentId="17198" CreationDate="2014-07-04T18:48:06.583" Score="1" Body="&lt;p&gt;The question seems a bit vague - there are plenty of other situations where the system (or its model) is considered to be completely deterministic, but you have tradeoffs, or a complex 'quality metric' which makes good design a challenge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One observation that may help: The frequency response of an FIR filter is continuous in all of its derivatives (since it can be written as a sum of continuous functions via fourier transform). So, if the filter's response is completely (mathematically) flat for any finite part (however small) of the spectrum, then it must be completely flat throughout the spectrum, and is therefore not very useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you clearly can't have an FIR filter with a perfect passband or stopband. You can get very close with a large enough filter, though. Designing the filter is a tradeoff amongst all the imperfect, feasible filters; balancing whatever design criteria you have (this applies equally to IIR filters).&lt;/p&gt;&#xA;" OwnerUserId="10402" LastEditorUserId="10402" LastEditDate="2014-07-21T14:28:57.230" LastActivityDate="2014-07-21T14:28:57.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17203" PostTypeId="2" ParentId="17198" CreationDate="2014-07-04T19:20:33.820" Score="0" Body="&lt;p&gt;IIR filters are also linear (and time-invariant).  what that means is that the mapping from input samples $x[n]$ to output samples $y[n]$ satisfies the superposition (and time-shifting) properties:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $$y[n] \triangleq \mbox{LTI} \{ x[n] \}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then $$y_1[n] + y_2[n] = \mbox{LTI} \{ x_1[n] + x_2[n] \}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $$ y[n-D] = \mbox{LTI} \{ x[n-D] \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, as a result, the convolution summation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = \mbox{LTI} \{ x[n] \} = \sum_{k=-\infty}^{+\infty} h[k] x[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for some impulse response $h[n]$ (which are the coefficients for the FIR) that is dependent only on the filter, not the input.  that's what linear and time-invariant means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but in both cases, FIR or IIR, the mapping of the &lt;strong&gt;specifications&lt;/strong&gt; of the filter to those coefficients $h[n]$ is the &quot;filter design&quot; process.  why would &lt;em&gt;that&lt;/em&gt; be linear?  there is no reason for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, perhaps one method might be you make a guess at what the coefficients are, see what you get regarding the coefficients, and then somehow tweek or adjust your guess to be a better guess in the next recursion.  now algorithms like the Parks-McClellan (based on the Remez exchange algorithm) are more complicated than &quot;guess and tweek&quot;, but that &lt;strong&gt;is&lt;/strong&gt; what they are doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can get very good results with the &quot;windowing method&quot; (if you use a good window function, like the Kaiser) and that is not recursive.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-07-04T19:20:33.820" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17204" PostTypeId="2" ParentId="17198" CreationDate="2014-07-04T21:43:15.620" Score="3" Body="&lt;p&gt;Sure, FIR filters are &quot;simple&quot; linear objects. But a typical FIR filter design task looks like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Find a set of numbers (the filter coefficients) such that the&#xA;  magnitude of their Discrete Fourier Transform is as close as possible to a&#xA;  target response. &quot;As close as possible&quot; being defined as &quot;by&#xA;  minimizing the $L_\infty$ norm of the difference between ideal and actual&#xA;  response over some frequency ranges&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a non-linear, sometimes non-convex optimization problem and there is no universal, trivial procedure to solve those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have to use procedures like the Parks-McClellan algorithm because the real-world engineering constraints we want to impose when designing FIR filters do not translate into simple linear or quadratic constraints. For example, a least-square error criterion (L2 norm often leads to more tractable procedures than other norms...) would not be an acceptable choice for engineering applications, because it could allow solutions that are close to the required response &lt;strong&gt;on average&lt;/strong&gt;, but with an outlier value.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-07-05T11:11:49.547" LastActivityDate="2014-07-05T11:11:49.547" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17205" PostTypeId="1" AcceptedAnswerId="17282" CreationDate="2014-07-04T22:45:11.330" Score="2" ViewCount="629" Body="&lt;p&gt;Since Fourier transform of a random stationary process in time (in the case of existence) is not necessarily real, my question is what is the relation between the covariance of real and imaginary parts of the transformed random variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, according to Wiener-Khinchin theorem for the time function &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; with some conditions the Fourier transform &lt;span class=&quot;math-container&quot;&gt;$X(\omega)$&lt;/span&gt; exists. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is can one recover  &lt;span class=&quot;math-container&quot;&gt;$$\mathbb{E}\left[\Re\{X(\omega)\},\Re\{X(\omega')\}\right]-\mathbb{E}\left[\Re\{X(\omega)\}\right]\mathbb{E}\left[\Re\{X(\omega')\}\right]$$&lt;/span&gt; &#xA;and &lt;span class=&quot;math-container&quot;&gt;$$\mathbb{E}\left[\Im\{X(\omega)\},\Im\{X(\omega')\}\right]-\mathbb{E}\left[\Im\{X(\omega)\}\right]\mathbb{E}\left[\Im\{X(\omega')\}\right]$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;from &lt;span class=&quot;math-container&quot;&gt;$$\mathbb{E}\left[\bar{x}(t),x(s)\right]-\mathbb{E}\left[\bar{x}(t)\right]\mathbb{E}\left[x(s)\right]\;?$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be happy to be guided to a reference as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the most general case but the simpler case where the input signal is real is the main concern for me. I would be happy to be guided to a reference as well.&lt;/p&gt;&#xA;" OwnerUserId="9065" LastEditorUserId="4298" LastEditDate="2021-02-10T17:22:40.283" LastActivityDate="2021-02-10T17:22:40.283" Title="Covariance between real and imaginary parts of Fourier transform of a stationary time series" Tags="|fourier-transform|autocorrelation|gaussian|statistics|stationary|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17206" PostTypeId="1" CreationDate="2014-07-05T00:34:25.397" Score="0" ViewCount="390" Body="&lt;p&gt;Under the simulation of a communication system suffering from noise (AWGN) and co-channel interference, what is the appropriate way of calculating SINR? &#xA;Could one calculate it at a packet level as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;SINR_{packet} = \frac{\sum{\left \| x \right \|^{2}}}{\sum \left \| n \right \|^{2}+\sum \left \| z \right \|^{2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x$ is the total useful waveform for that packet, $n$ is the corresponding noise waveform and $z$ is the waveform of the interferer, or is it necessary to calculate it on a per bit basis as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;SINR_{bit} = \frac{\sum{\left \| x_{b} \right \|^{2}}}{\sum \left \| n_{b} \right \|^{2}+\sum \left \| z_{b} \right \|^{2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_{b}$ is the useful waveform for that particular bit, $n_{b}$ is the corresponding noise waveform for that bit and $z_{b}$ is the waveform of the interferer for that bit and then take the average across all bits of the same packet like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;SINR_{packet} = \frac{1}{k}\sum_{bit=1}^{bit=k}{SINR_{bit} = \frac{1}{k}\sum_{bit=1}^{bit=k}{\frac{\sum{\left \| x_{bit} \right \|^{2}}}{\sum \left \| n_{bit} \right \|^{2}+\sum \left \| z_{bit} \right \|^{2}}}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one is supposed to converge more quickly and give more realistic results? Which one would be better related to bit error rate (BER) and which to packet error rate (PER)? Finally could Central Limit Theorem be of any use proving that the first and last expression converge to the same number for large number of bits in a packet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe real systems calculate SNR as in the first formula, except of course for the $z$ term.&lt;/p&gt;&#xA;" OwnerUserId="10271" LastEditorUserId="10271" LastEditDate="2014-07-05T07:24:44.650" LastActivityDate="2021-02-19T19:03:54.130" Title="SINR averaging in communication system" Tags="|digital-communications|snr|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17207" PostTypeId="2" ParentId="17206" CreationDate="2014-07-05T06:22:13.887" Score="1" Body="&lt;p&gt;Signal-to-interference-plus-noise ratio (SINR) is by definition &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$SINR = \frac{P}{I+N}$, &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where $P$ - is useful signal power, $I$ - interference signal power and $N$ - noise power in the band of interest. Look &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;http://en.wikipedia.org/wiki/Signal-to-interference-plus-noise_ratio&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the first formula you've presented seems to be rigth one. Time span of calculation $SINR$ depends on your needs and interference nature. The common way is using duration of $x$. In general you have to distinguish both $x$ and $i$ at first, because $i$ is non-stationary random process so you can't think it as receiver noise. So in most common case in real life you can estimate $SINR$ only if you are able to combat such an interference in you system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If inteference appears as short pulses in time you can do measurement with relatively short sliding window to estimate $SINR$ in dynamics. If signal power is quite stationary in short averaging you can use previously estimated $P$ in formula above to find out $SINR$ even if demodulator fails to defeat it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can combine measurement of $SINR$ at the input of demodulator, $MSE$ at its output and $BER$ at the decoder's output to make some sophisticated modem quality control. &lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2014-07-05T06:43:58.187" LastActivityDate="2014-07-05T06:43:58.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17209" PostTypeId="2" ParentId="17196" CreationDate="2014-07-05T08:15:03.860" Score="1" Body="&lt;p&gt;Dispersion is a frequency dependent phase (Instead of Linear phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just transform your data into Fourier Transform and apply the phase per frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course the data must be transformed back into time domain as @Deve noted.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-08-04T18:56:28.480" LastActivityDate="2014-08-04T18:56:28.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17210" PostTypeId="2" ParentId="17189" CreationDate="2014-07-05T10:16:26.517" Score="5" Body="&lt;p&gt;As already mentioned by other people, the bilinear transform is often used to map a continuous-time system described in the $s$-domain to a discrete-time system described in the $z$-domain. However, a bilinear transform is a more general tool that can also be used to transform a discrete-time system to another discrete-time system. Since you didn't give any context I do not know about the author's motivation to do so, so I can't tell you &lt;em&gt;why&lt;/em&gt; this is done, but I believe I can tell you &lt;em&gt;how&lt;/em&gt; it is done (up to a constant factor):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to show how the discrete-time system is transformed to the other discrete-time system, I'll use the $s$-domain as an intermediate step. The function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1-e^{-2bT}z^{-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be represented in the $s$-domain by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1-e^{-(s+2b)T}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because a unit delay $z^{-1}$ is exactly equivalent to $e^{-sT}$ in the continuous domain. By using a linear approximation $e^x\approx 1+x$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1-e^{-(s+2b)T}\approx (s+2b)T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can apply the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform#Discrete-time_approximation&quot; rel=&quot;noreferrer&quot;&gt;bilinear transform&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s=\frac{2}{T}\frac{1-z^{-1}}{1+z^{-1}}$$ which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(s+2b)T=2\left(\frac{1-z^{-1}}{1+z^{-1}}+bT\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula in your question is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2(1+bT+(bT-1)z^{-1})}{T(1+z^{-1})}=\frac{2}{T}\left(\frac{1-z^{-1}}{1+z^{-1}}+bT\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which differs from (1) by a factor $1/T$. I can't explain this difference, but I'm pretty sure that the basic idea of the transformation is as I've described it above.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-05T10:16:26.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17212" PostTypeId="1" CreationDate="2014-07-05T12:18:23.270" Score="4" ViewCount="6371" Body="&lt;p&gt;Fourier transform of a continuous signal is just the projection of the signal on the sinusoidal family for imaginary part and the same family with phase offseted by a quarter of period for the real part. &lt;br/&gt;&#xA;Beside the magical Euler's formula $e^{ix} = \cos x + i\sin x$ that ease the analysis of the transform and the fact that sinusoidal functions happen to be the solution of a prefect harmonic oscillator, I always wondered where the Fourier supremacy came from. Sinusoidal signals aren't so common in everyday's life. Even with human speech, vocal tract function isn't sinusoisdal. &lt;br/&gt; &#xA;For example, one transform basis that would seams interesting to me would that with a saw tooth function as signals with fast attack and slow release aren't uncommon...&lt;br/&gt;&#xA;I guess that the transform need to be inversible and that might not be the case for every basis, but aren't there any alternative basis that provide a bijective forward and inverse transform ? (And if so, what would be the conditions ?) &#xA;&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;I will elaborate a little. I'm looking for a basis family of periodicals functions named $B(t)$ for example with B of unitary periods such as : $$ S(f) = T\{s(t)\}(f) = \int s(t) B\left( t * f\right) dt + i \int s(t) B\left((t - \frac{1}{4})*f\right)dt$$ with T inversible in some way...&lt;br/&gt;&lt;/p&gt;&#xA;" OwnerUserId="9020" LastEditorUserId="9020" LastEditDate="2014-07-06T13:17:46.940" LastActivityDate="2014-07-06T15:23:53.703" Title="Is there any alternative basis for a fourier-like transform?" Tags="|fourier-transform|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17213" PostTypeId="1" CreationDate="2014-07-05T13:09:56.547" Score="2" ViewCount="616" Body="&lt;p&gt;I am trying to implement speech recognition but I'm struck with a few questions:   &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There are 12 Coefficients of MFCC. What are their names?  &lt;/li&gt;&#xA;&lt;li&gt;What is the range of values of MFCC coefficients? &lt;/li&gt;&#xA;&lt;li&gt;If I want to relate MFCC coefficients graphically, what will be unit of weights on their edges?  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10406" LastEditorUserId="39" LastEditDate="2015-12-09T14:43:31.987" LastActivityDate="2015-12-09T14:43:31.987" Title="Regarding MFCC feature of a speech signal" Tags="|mfcc|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17214" PostTypeId="2" ParentId="7651" CreationDate="2014-07-05T13:57:17.753" Score="1" Body="&lt;p&gt;There might be much discrepency in the signal's characteristics of the interviewee that depends partialy on the phones they're using, their mobile operator, etc... &lt;br/&gt;&#xA;It is much easier to extract the radio's speaker signal. Then, everything that does not come form the radio's host must be from one of the interviewees. &lt;br/&gt;&#xA;What you need to do is to analyse the signal of the radio's speaker that might contains more prominent low-pitched components for example (depends obviously on the station you recorded from). Also use a window of analysis sufficiently large to take into account that every stream must last at least 500/1000ms. That might introduce a little stability in your extraction.&lt;br/&gt;&#xA;If you want to split the different interviewees, you can pose the simple condition that interviewee/host must alternate.&lt;/p&gt;&#xA;" OwnerUserId="9020" LastActivityDate="2014-07-05T13:57:17.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17215" PostTypeId="2" ParentId="17213" CreationDate="2014-07-05T14:08:04.797" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;You can have as many MFCC coefficients as you want, 12 is just only a widely used number. As you probably know (or if not then please refer to the &lt;a href=&quot;https://dsp.stackexchange.com/a/15945/8202&quot;&gt;&lt;strong&gt;old answer&lt;/strong&gt;&lt;/a&gt;), coefficients are being obtained via fitting of cosinusoids to log energies in your filter banks. Usually 12 is enough, more is not improving recognition rate too much. It is better to calculate their derivatives ($\Delta $'s and $\Delta\Delta$'s across time). Regarding names - they are simply MFCC's (first, second, and so on). Although coefficient $c_0$ is usually called the &lt;em&gt;energy&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Question about range is not straightforward to answer. Usually in my applications they are in $[-12, \ 12] $. Although if you perform the Cepstral Mean Normalisation on yours, then you can expect them to have values of Gaussian Distribution with $95\%$ of them being in range of $[-2, \ 2] $.&lt;/li&gt;&#xA;&lt;li&gt;I do not really understand that question - you must be more specific about what you are asking. Edges of what? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-07-05T14:17:17.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17218" PostTypeId="2" ParentId="17212" CreationDate="2014-07-05T18:23:46.583" Score="-1" Body="&lt;p&gt;There's plenty. Laplace transform is just one example. There's uncountably many bijective transformations. So the question would be if there are other useful transforms. Turns out, there are some.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2014-07-05T18:23:46.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17219" PostTypeId="1" CreationDate="2014-07-05T18:31:03.613" Score="0" ViewCount="318" Body="&lt;p&gt;The way I understand it, computational science covers a wide range of fields, all of which use computers and mathematical models to solve a problem involving one of the sciences (physical, life etc.). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is DSP, which does use maths to manipulate a signal, a form of computational science?&lt;/p&gt;&#xA;" OwnerUserId="8312" LastActivityDate="2014-07-09T22:02:16.537" Title="Is DSP a branch of Computational Science?" Tags="|soft-question|" AnswerCount="2" CommentCount="2" ClosedDate="2014-07-10T10:27:34.380" ContentLicense="CC BY-SA 3.0" />
  <row Id="17221" PostTypeId="1" CreationDate="2014-07-06T07:36:55.667" Score="0" ViewCount="134" Body="&lt;p&gt;I'm trying to do a program that can judge whether 2 audio files have the same pronunciation or not by comparing the frequency of them with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step, finding the magnitude and phase data from the audio file by using Discrete Fourier Transform, is done. I now have a list of the DFT data from both files in 2 arrays with 10k data points in each. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is from that, how do I calculate the energy spectral density? What I plan to do next is to compute the Mean Squared Error of the energy spectral density between the 2 voice's data, and the result will be put under a threshold to see whether those 2 files are similar or not.&lt;/p&gt;&#xA;" OwnerUserId="10410" LastEditorUserId="10282" LastEditDate="2014-07-06T19:53:50.043" LastActivityDate="2014-07-06T19:53:50.043" Title="Calculating Energy Spectral Density from Magnitude and Phase data" Tags="|frequency|dft|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17222" PostTypeId="2" ParentId="17212" CreationDate="2014-07-06T10:07:26.113" Score="8" Body="&lt;p&gt;The most important reason for the &quot;Fourier supremacy&quot;, as you called it, has been pointed out by Jazzmaniac in his comment. The complex exponential $e^{st}$ with $s=\sigma+j\omega$ is an eigenfunction of the convolution operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{st}*f(t)=\int_{-\infty}^{\infty}e^{s(t-\tau)}f(\tau)d\tau=&#xA;e^{st}\int_{-\infty}^{\infty}e^{-s\tau}f(\tau)d\tau=e^{st}F(s)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the eigenvalue $F(s)$, if it exists, is the Laplace transform of $f(t)$, and for $\sigma=0$, i.e. for $s=j\omega$, $F(j\omega)$ is the Fourier transform of $f(t)$ (again, if it exists). Even though there are several important differences between the Fourier and the Laplace transform, they are deeply related, and for answering your question their differences are not important. By analogy, the same is true for the discrete-time Fourier transform and for the $\mathcal{Z}$-transform in the discrete domain. So when in the remainder of my answer I mention the Fourier transform, you might as well replace it by &lt;em&gt;Laplace transform&lt;/em&gt; or &lt;em&gt;$\mathcal{Z}$-transform&lt;/em&gt;, and everything will remain valid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why should we be concerned with eigenfunctions of the convolution operator? Because convolution describes the input-output relation of linear time-invariant (LTI) systems, and these systems are often very good approximations of practically important systems such as frequency selective filters, integrators, differentiators, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from being an invaluable tool for the analysis of LTI systems, the Fourier transform also has an important physical interpretation as the &lt;em&gt;spectrum&lt;/em&gt;, i.e. the frequency content, of a signal. Furthermore, the FFT is a highly efficient algorithm for the computation of its discrete version for finite length signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why don't we just say we're doing fine with the Fourier transform and its siblings? Because there are applications where we are looking for other properties of a transform. One example would be time localization in signal analysis, since the basis functions of the Fourier transform have no time localization at all because of their infinite extent. In such cases other transforms have become widely used, such as the short-time Fourier transform and the wavelet transform. For discrete-time signals, filter banks provide very general signal expansions. They can be designed to match the desired properties of the signal expansion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you mentioned the saw-tooth function as a possible basis function I would like to point out to you the &lt;em&gt;Slant transform&lt;/em&gt; (mentioned in &lt;a href=&quot;https://dsp.stackexchange.com/questions/9020/dft-like-transform-using-triangle-waves-instead-of-sin-waves/9031#9031&quot;&gt;this answer&lt;/a&gt;), which is used in image coding. Furthermore, there is the related &lt;em&gt;Slantlet transform&lt;/em&gt;, which is a special type of discrete wavelet transform with piecewise linear basis functions. You can see the basis function in Fig. 5 of &lt;a href=&quot;http://eeweb.poly.edu/iselesni/slantlet/slantlet.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-07-06T10:07:26.113" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17223" PostTypeId="1" CreationDate="2014-07-06T10:20:21.870" Score="2" ViewCount="1115" Body="&lt;p&gt;Suppose two continuous complex domain signals are convolved, how is the magnitude and phase of the resultant signal related to the magnitudes and phase of the original signals? &lt;/p&gt;&#xA;" OwnerUserId="5641" LastActivityDate="2014-07-06T10:20:21.870" Title="Convolving two complex signals - relationship between phase" Tags="|convolution|continuous-signals|phase|" AnswerCount="0" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17224" PostTypeId="1" CreationDate="2014-07-06T11:14:36.600" Score="5" ViewCount="14464" Body="&lt;p&gt;I am not sure why zig zag manner scan is used in DCT. I can guess that might because it moves from low frequency component to high frequency component and as most of the energy is stored in low frequency component that's why this way of scan is favored but not quite sure.&lt;/p&gt;&#xA;" OwnerUserId="10411" LastEditorUserId="6" LastEditDate="2014-07-17T18:56:03.310" LastActivityDate="2023-06-17T13:03:45.863" Title="Why zig zag manner scan is used in DCT for image compression?" Tags="|dct|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17227" PostTypeId="2" ParentId="17224" CreationDate="2014-07-06T13:13:36.617" Score="5" Body="&lt;p&gt;You are right! When it comes to quantization, bit allocation or issues like that scanning in zig zag manner seems to be most efficient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you said, (and I emphasize) in Natural Signals, lower frequency coefficients contain most of the energy. In a DCT matrix, as you go along a row the frequency is increasing in the first dimension and as you go along a column the frequency is increasing in the second dimension. A high frequency in any dimension probably contains less energy. So for example the &#xA;$(2,2)$ entry in an $8\times 8$ DCT matrix $\bf{usually}$ contains more energy than the entry $(1,8)$ in the same matrix. &lt;/p&gt;&#xA;" OwnerUserId="7057" LastActivityDate="2014-07-06T13:13:36.617" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17229" PostTypeId="2" ParentId="17212" CreationDate="2014-07-06T15:23:53.703" Score="2" Body="&lt;p&gt;I'll try to derive the necessary and sufficient conditions for finding a basis of periodic functions for a discrete signal space, i.e. the set $S_N:=\{f:{\mathbb{Z}}/{N\mathbb{Z}}\to\mathbb{C} :\sum_n |f(n)|^2 &amp;lt;\infty\}$ of all square magnitude summable $N$-periodic function from the integers to the complex numbers. The continuous case is interesting too, but out of the scope of a simple answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two statements about the basis we can immediately see to be true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The number of basis functions is identical to the number of fourier basis functions (assuming complex basis functions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The periods of the basis functions must divide $N$, i.e an integer number of basis periods must fit into the period $N$ of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the second condition does not always lead to integer sample periods for the basis functions. The periodicity of the basis functions is therefore realized as discretely sampled function of periodic continuous functions, and the discrete representation itself is not necessarily strictly periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two statements above allow us to enumerate the basis functions. The number of integer divisors of $N$ is surely not greater than $N$, which implies that all integer divisor periods are realised as base function periods. Let's assume $N$ is even ( I leave the odd case to you ), then $N/2$ is an integer divisor and realised as a basis function period. This basis function is even exactly periodic on the discrete sample grid and can be written as the number sequence $(a,b,a,b,\dots)\in\mathbb{C}^N$ with $N/2$ repetitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can write this basis vector as a complex Fourier series, and we find that only the DC and the Nyquist coefficients do not vanish. That means the basis function can be written as a linear superposition of the periodic continuations of $(1,1)$ and $(1,-1)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, we can assume that your basis functions have zero mean, just to make things a little simpler. In this case the DC component of the Fourier decomposition also vanishes and the basis function looks just like the corresponding Fourier basis function. There is also no other linear independent basis function of that same period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here on, things get simpler. The next basis function candidate has fits one more period into $N$, that means $N/2+1$ repetitions and a period of $N/(N/2+1)$. The basis functions candidates for this period have a Fourier decomposition (again, zero-mean is assumed) that is only non-zero at Nyquist and Nyquist-1. This is only linearly independent from the basis function we already know if the coefficient at Nyquist-1 does not vanish. That also means we can have two independent basis functions for this period (This will typically be one basis function and its complex conjugate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can continue with this construction by adding another basis period, looking at the Fourier series, enforce linear independence and finding two independent basis functions. This procedure can be repeated $N/2-1$ times, and together with the constant basis function responsible for the DC component we get exactly the $N$ basis functions that we require for invertibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constructed basis is precisely then a &quot;transformation&quot; (i.e. a bijective map) if the assumptions we made in the process are true. The necessary conditions were, that the lowest order Fourier coefficient of your periodic basis, expanded in its own intrinsic period, doesn't vanish. We also assumed, that the basis was zero-mean (apart from the constant basis function) and that $N$ was even. These are not necessary but just convenient. You can drop them if you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's summarise. A periodic function gives rise to a basis on a discrete space iff the Fourier coefficient of the base period is non-zero. Then the basis implies a discrete Fourier-like transformation, i.e. it is invertible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jazz&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2014-07-06T15:23:53.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17230" PostTypeId="1" AcceptedAnswerId="17231" CreationDate="2014-07-06T16:39:34.110" Score="0" ViewCount="907" Body="&lt;p&gt;I'd like to estimate the power spectral density of the signal attached &lt;a href=&quot;https://www.dropbox.com/s/vk3620w91f26guf/x.json&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, the sampling rate is 100 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I don't do windowing (i.e., use boxcar window), the result seems to be a simple $1/f^2$ noise:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import json&#xA;from scipy import signal&#xA;from pylab import *&#xA;x = json.load(open('x.json'))&#xA;f, p = signal.welch(x, fs=100, nperseg=256, window=signal.get_window('boxcar', 256))&#xA;plot(f[1:-1], log(p[1:-1])) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QSGgq.png&quot; alt=&quot;boxcar window&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I apply, e.g., hanning window, there will be an unexpected additional peak at 25 Hz:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f, p = signal.welch(x, fs=100, nperseg=256, window=signal.get_window('hanning', 256))&#xA;plot(f[1:-1], log(p[1:-1]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DjIoF.png&quot; alt=&quot;hanning window&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this some artifact?&lt;/p&gt;&#xA;" OwnerUserId="5537" LastActivityDate="2014-07-07T08:52:08.723" Title="Will using window in Welch's method introduce artificial peak in estimated PSD?" Tags="|power-spectral-density|window|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17231" PostTypeId="2" ParentId="17230" CreationDate="2014-07-06T19:46:57.440" Score="1" Body="&lt;p&gt;It is not any artifact. When you calculate the DFT of your signal you will get following magnitude spectra:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gmDEO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can clearly see that around $25 \mathtt{Hz}$, and $50 \mathtt{Hz}$ there is some harmonic content present. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reason why you don't see your harmonics on PSD in first case is that you are not using any windowing. Probably you are aware of side-lobes attenuation in characteristic of the window functions. For rectangular window it is approximately $13.3 \mathtt{dB} $ and for Hanning you get $31.5 \mathtt{dB} $. It is therefore possible that sidelobes will cover some harmonics of your signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please take a look on your figures; for rectangular window lowest value of noise is approx. $-14$, whereas for Hanning you are getting around $-18$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below you can see frequency domain representation of these two windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8hOBn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info about windows, please refer to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;F. J. Harris - On the Use of Windows for Harmonic Analysis with the DFT&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-07-07T08:52:08.723" LastActivityDate="2014-07-07T08:52:08.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17232" PostTypeId="1" CreationDate="2014-07-06T23:35:05.320" Score="1" ViewCount="62" Body="&lt;p&gt;-----------------deleted by author to merge with valid account&lt;/p&gt;&#xA;" OwnerUserId="10418" LastEditorUserId="10450" LastEditDate="2014-08-24T09:10:15.693" LastActivityDate="2014-08-24T09:10:15.693" Title="Interpolation methods for radar and acoustic imaging" Tags="|image-processing|power-spectral-density|interpolation|" AnswerCount="0" CommentCount="0" FavoriteCount="0" ClosedDate="2014-08-24T11:15:06.640" ContentLicense="CC BY-SA 3.0" />
  <row Id="17233" PostTypeId="1" AcceptedAnswerId="17237" CreationDate="2014-07-07T01:15:51.447" Score="0" ViewCount="348" Body="&lt;p&gt;I am working on a system that is implementing a digital filter that was designed for another system that had an FPU and a 12bit ADC. The system that I am working on is using the same filter without an FPU using a 12 ADC and fixed point arithmetic.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The ADC resolution is 3.3v / 2^12 = 0.000805664062v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With an FPU each ADC integer value could be scaled with the above resolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the system using fixed point where &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m2^-e, e = 10 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resolution would be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2^-10 = 0.0009765625&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This leads me to think that the use of fixed point is giving me slightly lower resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at it differently and representing a delta between ADC integers with 14bits for the fraction the resolution could be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2^(-11) + 2^(-12) + 2^(-14) = 0.000793457031&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but then the range would be perceived as less than 3.3V&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this thinking correct?&lt;/p&gt;&#xA;" OwnerUserId="5697" LastEditorUserId="5697" LastEditDate="2014-07-07T21:52:36.497" LastActivityDate="2014-07-07T21:52:36.497" Title="Does perceived ADC resolution, range and precision depend on fixed point format? What is the best way to deal with this for signal processing?" Tags="|filters|resolution|analog-to-digital|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17234" PostTypeId="2" ParentId="17233" CreationDate="2014-07-07T01:44:24.300" Score="1" Body="&lt;p&gt;it may turn out to be very inconvenient, but you can do essentially anything in fixed-point that you can do in floating.  as long as you got &quot;Add-with-carry&quot; as an instruction and enough MIPS to do all of the multiword instructions you may need.  the 12 bits that come from your ADC don't care if it's fixed or floating and your ADC resolution is the same regardless.  can't promise that the quality of code coming out of a C compiler will be any good.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-07-07T01:44:24.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17235" PostTypeId="1" CreationDate="2014-07-07T02:30:05.953" Score="3" ViewCount="4052" Body="&lt;p&gt;I am trying to filter EEG signals using butterworth filter and filtfilt. I have gone through a lot of documentation and these 2 commands seem sufficient for filtering. However, the results are bizarre.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy.signal import butter, filtfilt&#xA;import sys, pickle&#xA;from numpy import *&#xA;import matplotlib.pyplot as plt&#xA;&#xA;def butter_bandpass(lowcut, highcut, fs, order=5):&#xA;    nyq = 0.5 * fs&#xA;    low = lowcut / nyq&#xA;    high = highcut / nyq&#xA;    b, a = butter(order, [low, high], btype='band')&#xA;    return b, a&#xA;&#xA;def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):&#xA;    b, a = butter_bandpass(lowcut, highcut, fs, order=order)&#xA;    y = filtfilt(b, a, data)&#xA;    return y&#xA;&#xA;with open(sys.argv[1]) as eeg:&#xA;    eeg_data = pickle.load(eeg)&#xA;    eeg_data = eeg_data[:,3]&#xA;&#xA;fs = 128&#xA;lowcut = 1&#xA;highcut = 40.0&#xA;&#xA;y = butter_bandpass_filter(eeg_data, lowcut, highcut, fs, order = 9)&#xA;plt.plot(y,'r')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2EDhz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the eeg data&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6AVKd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, isn't the output in time domain? It seems incorrect irrespective of the domain. The order is too high i.e. 1e28 for the first 1000 points. I checked for the other points and the order is 1e17, even for points after 4000. Is this what I should expect?&lt;/p&gt;&#xA;" OwnerUserId="10420" LastEditorUserId="10420" LastEditDate="2014-07-07T04:16:39.570" LastActivityDate="2019-01-08T14:30:13.010" Title="filtfilt giving unexpected results" Tags="|filters|bandpass|eeg|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17236" PostTypeId="1" AcceptedAnswerId="17239" CreationDate="2014-07-07T06:41:40.710" Score="0" ViewCount="100" Body="&lt;p&gt;There are two real signals in the form of $A_i sin(wt+p_i), i=1,2$. Suppose frequency $w$ of both the signals is the same and amplitude $A_i$ and phase $p_i$ are different. The first signal has unknown $A$ and $p$, but they are constant in the time of observation (for simplicity only, actually they aren't). The second signal is under control. We only have it's difference $x(t) = s_1(t)-s_2(t)$. Some iterative algorithm is needed to minimize power of $x(t)$. So $x(t)$ is available input and $A_2(t)$, $p_2(t)$ are parameters under control. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is: is it some robust and rapid algorithm for jointly control both amplitude and phase to minimize power of $x(t)$? My idea was to implement complex gradient method: phase and amplitude at each step are represented as a complex number $C(t)$. Signal $s_2(t)$ can be set as $Re[C(t) exp(iwt)]$. But I can't understand how to define cost function and gradient in this case and also this approach seems to be computationally redundant. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="128" LastEditDate="2018-07-07T22:18:24.870" LastActivityDate="2018-07-07T22:18:24.870" Title="Iterative Blind Sinus Signal Suppression" Tags="|control-systems|optimization|gradient|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17237" PostTypeId="2" ParentId="17233" CreationDate="2014-07-07T07:58:00.347" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this thinking correct?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, if you insist on storing in your variables a fixed-point number representing a voltage, in Volts. Then you are loosing $2 - \log_2{3.3} = 0.28$ bits of resolution. But why would you have to do so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your ADC conversion routine will give you a raw 12-bit value. Don't touch it, or shift it left, and nothing will be lost - as long as you remember that what you are manipulation are in units of $3.3/2^{12}$ Volts.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-07-07T07:58:00.347" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17238" PostTypeId="2" ParentId="17233" CreationDate="2014-07-07T08:01:55.393" Score="1" Body="&lt;p&gt;Well, fixed-point has a higher average resolution than floating-point using the same number of bits, although that result is not so much of interest here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question you have to ask yourself is: does the fact that the maximum input is interpreted as 3.3 and not, say, 4 pose a major constraint in your system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As pichenettes answered while writing this answer: just remember the scale of the input once you interpret the output of the filter.  What you will need to think about though, implementing the filter in fixed-point is scaling, i.e., avoiding overflow and utilizing as much of the numerical range as possible.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2014-07-07T10:04:41.153" LastActivityDate="2014-07-07T10:04:41.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17239" PostTypeId="2" ParentId="17236" CreationDate="2014-07-07T09:28:51.440" Score="1" Body="&lt;p&gt;I assume you do everything in discrete time. If I understood correctly then the observed signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=s(n)-A\sin(\omega_0n+\phi)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $s(n)$ is a sinusoidal signal with frequency $\omega_0$ and unknown amplitude and phase. The parameters $A$ and $\phi$ are to be optimized such that the power of $x(n)$ is minimized. In a real-time algorithm you can define the cost function as the sum of $x^2(n)$ over a fixed length $N$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(A,\phi,n)=\sum_{k=n-N+1}^{n}x^2(k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n$ is the current sample. For a steepest descent algorithm you need the gradient:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial F}{\partial A}=-2\sum_{k=n-N+1}^{n}x(k)\sin(\omega_0k+\phi)\\&#xA;\frac{\partial F}{\partial \phi}=-2A\sum_{k=n-N+1}^{n}x(k)\cos(\omega_0k+\phi)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameters are now updated in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A_n=A_{n-1}-\mu\frac{\partial F_{n-1}}{\partial A}\\&#xA;\phi_n=\phi_{n-1}-\mu\frac{\partial F_{n-1}}{\partial \phi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mu$ is the step size. Note that in every iteration you need to recompute the gradients with the current values of $A$ and $\phi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figure below is a simulation of this gradient algorithm with the unknown signal $s(n)=2\sin(\pi n/3+\pi/2)$, $N=50$, $\mu=0.01$, and with zero initialization of both amplitude and phase (amplitude $A$ in blue, phase $\phi$ in green).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eibc3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-07T09:28:51.440" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17240" PostTypeId="1" AcceptedAnswerId="17242" CreationDate="2014-07-07T12:56:29.403" Score="0" ViewCount="507" Body="&lt;p&gt;I have a real signal that is being sampled via ADC and passed to a Xilinx V6 FPGA.  I then do a Hilbert transform on it using the FIR compiler core and get the complex signal (I and Q) to tweak the signal some.  Now I am struggling with how to do the inverse Hilbert to get back to a real signal again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand in theory that H(H(u)) = -u.  But the FIR compiler simply does not allow for a complex input and a real output.  Is there a trick to get around this?&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2014-07-07T14:21:52.530" Title="Best way to inverse Hilbert on FPGA?" Tags="|filters|filter-design|dsp-core|" AnswerCount="1" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="17241" PostTypeId="1" CreationDate="2014-07-07T14:01:27.477" Score="0" ViewCount="259" Body="&lt;p&gt;I have a UWB radar that Im playing with. The problem is that my algorithms at the moment can clearly, reliably and validly pick up 1-2mm movements of a pendulum i've set up. However, when I use it on my chest to find my heart, things doesnt work. The radar should be set up so that the waves penetrate skin and bone, but I am not entirely sure. The antennae are specced specifically to be able to pick up a heartbeat (or penetrate human tissues).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of math, I first do despiking and a bandpass filter around 0.1 - 5 hz, followed by a principle component analysis to reduce the number of samples/sensors. Then I either do a FFT plus some stuff to find the most pronounced frequencies of the top 5 principle components, or I search for the best fit sinuswave (as the heartbeat can be described as such afaik) to the top 5 principle components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While these methods give similar results when used on a pendulum, they break down when trying to find the heartbeat. The radar can nicely penetrate wood, and plastic and other stuff. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus question: We had some ultrasound gel at the lab, and i tried to see if removing the &quot;air&quot; component would help, but then all signal dropped. Is ultrasound gel absorbing the radar pulses?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks alot!&lt;/p&gt;&#xA;" OwnerUserId="8990" LastActivityDate="2014-10-02T11:50:03.817" Title="UWB radar to find heartbeat" Tags="|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17242" PostTypeId="2" ParentId="17240" CreationDate="2014-07-07T14:21:52.530" Score="1" Body="&lt;p&gt;Just take the real part of the complex signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(And if you do not believe it: &lt;a href=&quot;http://www.dsprelated.com/showmessage/849/1.php&quot; rel=&quot;nofollow&quot;&gt;click here&lt;/a&gt;.) &lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-07-07T14:21:52.530" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17243" PostTypeId="1" CreationDate="2014-07-07T15:17:18.297" Score="0" ViewCount="444" Body="&lt;p&gt;For a project I am working on, I need to incorporate GPS data into an audio file. As things currently are, the easiest way for me is to record the audio in a multi-channel .wav file, and add the GPS data as a square wave in a separate channel.&lt;/p&gt;&#xA;&lt;p&gt;GPS data will be binary, i.e. either an arbitrary high or low signal for an arbitrary time period. I do not need to reconstruct an analog value.&lt;/p&gt;&#xA;&lt;p&gt;My question is: at which frequency will I be able to faithfully record a square wave, &amp;gt;= Nyquist frequency or &amp;gt;= the sampling frequency?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit: elaborating on the setup I have in mind&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am preparing a series of binaural recordings of me walking around town in hours nobody is around. A modified headphone will act as two separate microphones, going into two separate channels of a handheld recorder.&lt;/p&gt;&#xA;&lt;p&gt;I will use my cellphone as a GPS device. My idea is to translate that GPS data into a series of pulses and output it to the phones' jack, which I then will connect to the handheld recorder. I prefer to have this data on a separate audio channel, because I like to keep the recorded audio as clean as possible, and because extracting data embedded in audio channels is beyond my capabilities at the moment.&lt;/p&gt;&#xA;&lt;p&gt;This is what I came up with (note: this is a mock-up)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nFL87.png&quot; alt=&quot;Two channels with recorded audio, one with a pulse train of GPS data&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;As both encoding and decoding the GPS data is going to be a custom job, i have a lot of liberty in writing the 'protocol'.&lt;/p&gt;&#xA;&lt;p&gt;Again, what is the fastest rate at which i could toggle the data signal? Is it the sampling frequency of the audio file, because I am only interested in a binary representation? Or am I missing something very obvious? Bear in mind, this is my first step in signal processing.&lt;/p&gt;&#xA;" OwnerUserId="10423" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-07-07T20:29:42.347" Title="Recording square waves at sample frequency" Tags="|sampling|nyquist|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17244" PostTypeId="1" AcceptedAnswerId="17273" CreationDate="2014-07-07T15:23:59.030" Score="3" ViewCount="1126" Body="&lt;p&gt;I'm trying to make some simply autofocus algorithm for my device and pretty confused with 2D FFT results.&#xA;As I know for now - number of high-frequency's components in 2D FFT will say me that image is more focused, than other one where 2D FFT got more low-frequency's components. And i do not know how to calculate this parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking about applying high-pass filter, but how i should choose cut-off frequency? In 1D FFT it's pretty simple to determine just looking at the picture of 1D FFT..&lt;/p&gt;&#xA;" OwnerUserId="8889" LastEditorUserId="128" LastEditDate="2019-03-29T11:33:20.900" LastActivityDate="2019-03-29T11:33:20.900" Title="2D FFT of Image and Sharpness" Tags="|image-processing|fft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17246" PostTypeId="1" CreationDate="2014-07-07T23:49:30.253" Score="2" ViewCount="315" Body="&lt;p&gt;A reviewer has asked me to re-filter my data to remove baseline drift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each sweep is 170ms sampled at 1000Hz and the reviewer wants it high-pass filtered at 0.5Hz.  The original bandpass settings on the hardware were 0.15 to 1000Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although this is easy to code in matlab, the epoch is very short compared with the stop frequency.  How does the epoch length affect the filter order selection and is there any point attempting it at all?&lt;/p&gt;&#xA;" OwnerUserId="10428" LastActivityDate="2014-07-07T23:49:30.253" Title="digital filter and epoch length" Tags="|filters|highpass-filter|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17248" PostTypeId="1" AcceptedAnswerId="17250" CreationDate="2014-07-08T06:50:27.933" Score="1" ViewCount="11272" Body="&lt;p&gt;Autocorrelation of white noise should have a strong peak at &quot;0&quot; and absolutely zero for all other $\tau$ according to &lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;. Then why is output of this code a cone shape (with the expected of &lt;strong&gt;strong peak&lt;/strong&gt; at &quot;0&quot; instead of being flat elsewhere except at &quot;0&quot;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = ones(1,1000);&#xA;z = awgn(y,1);&#xA;[m l] = xcorr(z);&#xA;plot(l,m);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6940" LastEditorUserId="11684" LastEditDate="2018-06-01T09:30:10.557" LastActivityDate="2018-06-02T01:12:26.947" Title="Autocorrelation of white noise" Tags="|noise|autocorrelation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17250" PostTypeId="2" ParentId="17248" CreationDate="2014-07-08T07:22:09.000" Score="5" Body="&lt;p&gt;Problem 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As pointed by learner, awgn adds noise to the sequence y. So you are not plotting the autocorrelation of white gaussian noise, but the autocorrelation of white gaussian noise plus a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use zeros instead of ones ; or analyze the difference $z - y$ ; or since $y$ is a constant signal, remove the mean of $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once point 1 is solved, and since your sequence is of finite length, you will be plotting the autocorrelation of white noise multiplied by a square window. What you will see is thus the autocorrelation of white noise convolved by the autocorrelation of a square window. The autocorrelation of a square window has a triangular shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to look at it: the further you move from 0, the less data is present in your input vector. For example, in the sequence:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$-1, 4, 5, 6, -2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 4 pairs of samples distant by a lag of 1, 3 pairs of samples distant by a lag of 2 (-1 and 5 ; 4 and 6 ; 5 and -2), and only two pairs of samples distant by a lag of 3 (-1 and 6, 4 and -2). Thus, there won't be as much data to estimate correctly the autocorrelation function for the larger values of the lag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can artificially compensate for the windowing by providing the 'unbiased' argument to xcorr.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that the theory is about infinite length sequences (or for finite length sequences, about the expected value of the result).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-07-08T11:28:45.473" LastActivityDate="2014-07-08T11:28:45.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17251" PostTypeId="1" CreationDate="2014-07-08T08:53:11.703" Score="2" ViewCount="738" Body="&lt;p&gt;I am getting a signal from a device. This signal contains a non-random noise signal in it. I want to remove that noise from the signal. This noise is correlated to the motion the device is having. So now I've attached a accelerometer to the device to measure the motion produced by the device. I'm getting the data of X, Y, Z-axis from 3-axis accelerometer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is the process I thought to remove the noise.First get a motion signal from the 3 axis data which correlate to the motion noise present in the main signal. Then pass the main signal and the correlated noise signal through a LMS filter to get a filtered data. I've already designed a LMS filter but I'm stuck at how to get the motion signal(from the data of the 3-axis from accelerometer) which will correlate to the motion noise present in the main signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me with this plz??&lt;/p&gt;&#xA;" OwnerUserId="10431" LastActivityDate="2015-06-03T21:44:20.173" Title="Correlating accelerometer data" Tags="|filters|adaptive-filters|motion-detection|motion|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17253" PostTypeId="2" ParentId="4849" CreationDate="2014-07-08T11:18:04.570" Score="0" Body="&lt;p&gt;When you understand HSV/HSB it should not be hard to understand YCbCr. The B channel in HSB corresponds with the chroma (chroma = saturation &lt;a href=&quot;http://vident.com/products/shade-management/color-theory/understanding-color-overview/hue-value-and-chroma/&quot; rel=&quot;nofollow&quot;&gt;http://vident.com/products/shade-management/color-theory/understanding-color-overview/hue-value-and-chroma/&lt;/a&gt; ). You could take rgb image and convert it to grayscale or you could convert every channel of the RGB to grayscale and they merge them into one channel. For simplification, let's have pixel with 100% red, 100% green and 70% blue. You will calculate average ... (100+100+70) / 3 and you get value 90% , which means 90% of brightness. So in grayscale it is very light gray color. Now, if we would like to express the original colors towards the grayscale channel we would need 3 formulas for every color (red, green, blue). You would calculate difference of value R vs grayscale, G vs grayscale and B vs grayscale. This would need 4 channels (RGB + chroma). But we can do the same with 3 channels. We can do small correction to the green channel. Let's calculate difference to green channel. Original green is 100%, new value of green converted to gray is 90%. Difference is -10%. So let's change R and B channels of this pixel by this difference. We just did gamma correction or all channels. Green channel values will be same as for grayscale image. So we do not calculate with green channel anymore. Green is &quot;encoded&quot; in the Y ... chroma channel. The rest of colors (R,B), is also adjusted. R` = 90% of original or 100% of Y because R and B are equal in this example. The B compound has difference +20% towards original, but after it was changed with gamma correction it has difference +30% towards Y. To simplify it yet more, it is like formula where you need to make addition for all three compounds. The differences which you get for red and blue are Cb and Cr. The characters just say that you compared Blue channel to chroma Channel and Red channel to Chromma channel. Hence Cb and Cr.&lt;/p&gt;&#xA;" OwnerUserId="10432" LastActivityDate="2014-07-08T11:18:04.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17254" PostTypeId="2" ParentId="17251" CreationDate="2014-07-08T12:43:14.237" Score="2" Body="&lt;p&gt;Motion can be described using displacement with time, velocity or acceleration. To get these quantities from the accelerometer data the following link may help.&#xA;&lt;a href=&quot;http://www.chrobotics.com/library/accel-position-velocity&quot; rel=&quot;nofollow&quot;&gt;http://www.chrobotics.com/library/accel-position-velocity&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9080" LastActivityDate="2014-07-08T12:43:14.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17255" PostTypeId="2" ParentId="17235" CreationDate="2014-07-08T12:52:28.843" Score="8" Body="&lt;p&gt;So the issue is that your filter order is too high.  There are 2 problems with this:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;SciPy has a bug that generates inaccurate filters at high orders.&lt;/li&gt;&#xA;&lt;li&gt;On any platform, higher-order filters cannot be done in a single stage.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;SciPy bug:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;SciPy was previously generating prototype filters as a list of poles and zeros, then converting them to transfer functions, then transforming them to their new frequency and band-type, then converting them back into poles and zeros.  This is bad because transfer function representation has numerical problems and loses precision.  So your filter currently has these poles and zeros:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/21Hfv.png&quot; alt=&quot;Z plane pole-zero plot&quot; /&gt;&lt;img src=&quot;https://i.stack.imgur.com/lydp1.png&quot; alt=&quot;closeup of 1+0j&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;but it's supposed to look like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J0whX.png&quot; alt=&quot;Z plane pole-zero plot&quot; /&gt;&lt;img src=&quot;https://i.stack.imgur.com/8rpyC.png&quot; alt=&quot;closeup of 1+0j&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;This probably isn't your problem, since these poles and zeros are still approximately the bandpass filter you asked for.  At even higher orders the poles can be so wrong they jump outside the unit circle and make the filter explode.  This has been &lt;a href=&quot;https://github.com/scipy/scipy/pull/3085&quot; rel=&quot;nofollow noreferrer&quot;&gt;fixed&lt;/a&gt; in &lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/release.0.14.0.html#scipy-signal-improvements&quot; rel=&quot;nofollow noreferrer&quot;&gt;SciPy 0.14.0&lt;/a&gt;, as long as you use &lt;code&gt;output='zpk'&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Second-order sections:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you actually do the filtering, you have to use a transfer function, not a list of poles and zeros, so your high-order filter would suffer the same numerical corruption if you tried to do the entire filter in a single stage.  What we do instead is (starting from the list of poles and zeros, not from the inaccurate transfer function) break up the filter into &lt;a href=&quot;https://ccrma.stanford.edu/%7Ejos/fp/Series_Second_Order_Sections.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;second-order sections&lt;/a&gt;, which each have minimal numerical problems, and cascade the sections together to get the final equivalent output.&lt;/p&gt;&#xA;&lt;p&gt;This is true for any platform, hardware or software, but Matlab and Octave have functions like &lt;code&gt;sosfilt&lt;/code&gt; to do the work for you.  SciPy does not, but &lt;a href=&quot;https://github.com/scipy/scipy/pull/3717&quot; rel=&quot;nofollow noreferrer&quot;&gt;it will in the future&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For now, you can break up the sections manually and use &lt;code&gt;lfilter&lt;/code&gt; repeatedly with each section to get the desired output or copy the code from that pull request.&lt;/p&gt;&#xA;&lt;h1&gt;Update&lt;/h1&gt;&#xA;&lt;p&gt;SciPy has SOS now.  So the best general-purpose filtering method is to generate your filter in SOS format, something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sos = butter(order, [low, high], btype='band', output='sos')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and then filter using &lt;a href=&quot;http://scipy.github.io/devdocs/generated/scipy.signal.sosfiltfilt.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;sosfiltfilt&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;y = sosfiltfilt(sos, data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-01-08T14:30:13.010" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17257" PostTypeId="1" CreationDate="2014-07-08T13:04:41.857" Score="1" ViewCount="103" Body="&lt;p&gt;As a part of my research i have to use the following z-transform in matlab 'filter' function so as to derive the convoluted signal from the original one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{{\rm Li}_{k}(z^{-1}e^{-b})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since i read that the polylogarithm  can be expressed as a function only for specific values of k (k can take many values, not necessarily integers). Can anyone guide me as to how can i use it for my matlab codes. Will i have to derive the FIR. Can it be derived in this case ?&lt;/p&gt;&#xA;" OwnerUserId="10360" LastEditorUserId="4298" LastEditDate="2014-07-08T13:06:07.040" LastActivityDate="2014-07-08T13:06:07.040" Title="Deriving finite impulse response for polylogarithm" Tags="|matlab|infinite-impulse-response|z-transform|finite-impulse-response|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17258" PostTypeId="1" CreationDate="2014-07-08T13:11:51.640" Score="2" ViewCount="116" Body="&lt;p&gt;This question is a follow-up for my previous one: &lt;a href=&quot;https://dsp.stackexchange.com/questions/17168/reduce-the-glare-effect-of-a-receiver-within-a-system&quot;&gt;Reduce the &amp;quot;glare&amp;quot; effect of a receiver within a system&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have broken the problem into pieces and I humbly think that I've got a way to solve it it with Duet BSS. However, there is still a problem: I have got &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(t)=h_1(t)\otimes X(t) + h_2(t)\otimes s(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way be it a hardware or a software solution to use ONE mixture to get my two signals of which I only know that $X$ is much stronger than $s$ and that on the spectrogram they don't overlap?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about putting a relay mast between the emitters and the receptor so I can get two rich mixtures. However, there is a risk that I increase, by doing so, the &quot;blinding&quot; effect on the receptor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jtpQp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signals are not periodic but could be seen as cyclostationary.&lt;/p&gt;&#xA;" OwnerUserId="10380" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-05-19T07:31:57.973" Title="Is there a way to apply blind source separation using ONE mixture?" Tags="|signal-detection|source-separation|" AnswerCount="0" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17259" PostTypeId="1" AcceptedAnswerId="17265" CreationDate="2014-07-09T04:12:09.397" Score="1" ViewCount="1438" Body="&lt;p&gt;I have a set of data over which I would like to interpolate, with a sampling rate say &lt;em&gt;about&lt;/em&gt; $f_0$ Hz with a significant uniform random sampling jitter, such that it's more or less:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_0 - \frac{1}{4}f_0 \le f_s \le f_0 + \frac{1}{4}f_0.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, with uniform sampling, I can perform sinc interpolation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum\limits_{n=-\infty}^\infty x[n] \cdot \mathrm{sinc}\left(\frac{t-nT}{T}\right), \quad \text{with}\quad T = \frac{1}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I do something similar if my sampling rate is non-uniform?&lt;/p&gt;&#xA;" OwnerUserId="7220" LastEditorUserId="1629" LastEditDate="2016-06-24T17:50:44.930" LastActivityDate="2016-06-24T17:50:44.930" Title="Variable sample rate interpolation" Tags="|interpolation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17260" PostTypeId="1" AcceptedAnswerId="17261" CreationDate="2014-07-09T05:11:53.703" Score="5" ViewCount="21757" Body="&lt;p&gt;I'm reading the book &lt;a href=&quot;http://www.amazon.ca/Digital-Signal-Processing-Using-MATLAB%C2%AE/dp/1111427372/ref=sr_1_sc_2?ie=UTF8&amp;amp;qid=1404882340&amp;amp;sr=8-2-spell&amp;amp;keywords=signal%20processing%20using%20matalb&quot; rel=&quot;noreferrer&quot;&gt;&#xA;Vinay Ingle, John Proakis - Digital Signal Processing Using MATLAB® (3rd Edition)&lt;/a&gt; and I came across a function to shift sequences. Mathematically, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;y(n) = \{x(n-k) \}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if &lt;span class=&quot;math-container&quot;&gt;$m = n-k$&lt;/span&gt;, then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;y(m+k) = \{ x(m) \}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [y,n] = sigshift(x,m,k)&#xA;n = m + k;&#xA;y = x;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This function shifts nothing. I've tried to find errata list of the book, but I couldn't find it. Is this function correct?&lt;/p&gt;&#xA;" OwnerUserId="5788" LastEditorUserId="37293" LastEditDate="2019-10-01T00:23:41.643" LastActivityDate="2019-10-02T00:58:11.190" Title="Shifting Sequences Using MATLAB" Tags="|matlab|discrete-signals|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17261" PostTypeId="2" ParentId="17260" CreationDate="2014-07-09T07:20:47.797" Score="3" Body="&lt;p&gt;This function just changes the x-axis for plotting signals. It's indeed pretty trivial but the idea is to use it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 0:4;&#xA;x = [1 2 3 2 1];           % some signal&#xA;[y,m] = sigshift(x,n,3);   % shift to the right by 3 samples&#xA;subplot(2,1,1), stem(n,x)&#xA;subplot(2,1,2), stem(m,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tzK06.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-09T07:20:47.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17262" PostTypeId="2" ParentId="17260" CreationDate="2014-07-09T07:21:19.053" Score="1" Body="&lt;p&gt;In order to shift in MATLAB you need to play with the indices of the signal vector.&#xA;for example, given vector x - &lt;code&gt;vX&lt;/code&gt; of length &lt;code&gt;L&lt;/code&gt;, to shift it in time such that the first sample is the fifth you'll do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vXShifted = x(5:L);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Pay attention that the signal is shorter by 4 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, sometimes, for periodic signals, a cyclic shifting is required which can be done using &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/circshift.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;circshift()&lt;/code&gt;&lt;/a&gt; function in MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-10-02T00:58:11.190" LastActivityDate="2019-10-02T00:58:11.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17263" PostTypeId="1" AcceptedAnswerId="17264" CreationDate="2014-07-09T10:01:11.893" Score="0" ViewCount="485" Body="&lt;p&gt;I'm reading a book about dsp and doing some exercises.&#xA;Here is question that confused me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A peak appears at index number 19  when a 256 point DFT is taken of a signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) What is the frequency of the peak expressed as a fraction of the sampling rate? Do we need to know the actual sampling rate to answer this question?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What is the sampling rate if the peak corresponds to 21.5 kHz in analog signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My answers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) 19/256; no we don't need to know actual sampling rate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I think that we can't answer this question without additional info. Or maybe it is  ((21.5/19)*256)*2 kHz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7052" LastActivityDate="2014-07-09T10:11:11.750" Title="Simple questions related to dft" Tags="|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17264" PostTypeId="2" ParentId="17263" CreationDate="2014-07-09T10:11:11.750" Score="2" Body="&lt;p&gt;The actual frequency in Hertz corresponding to DFT index $i$ with a DFT length of $N$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f=\frac{i}{N}f_s,\quad i=0,1,\ldots N-1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sampling frequency. So if indices are numbered starting from $0$ (and index number $19$ is indeed the $20^{th}$ frequency bin, as assumed in (1)), then your answer is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for part 2 of the question, the answer is also given by (1), so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_s=\frac{Nf}{i}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives $f_s=289.7\text{ kHz}$ for the given values of $i$, $N$, and $f$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-09T10:11:11.750" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17265" PostTypeId="2" ParentId="17259" CreationDate="2014-07-09T14:30:33.947" Score="2" Body="&lt;p&gt;Apart from the fact that $\rm{sinc}(x)=\sin(\pi x)/(\pi x)$ is smooth and bandlimited, the important property for interpolation is that $\rm{sinc}(k)=\delta(k)$ for $k\in\mathbb{Z}$ and the Kronecker symbol $\delta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an irregular sampling grid you want a function with similar properties, i.e. smooth, (approximately) bandlimited and vanishing on the grid points other than some $k_0$, where it should evaluate to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, the sinc function is an analytic function, and for functions of that kind knowing all the zeros already defines the function up to a global factor. Let's look how that works for the sinc function. We know the zeros are at $\mathbb{Z}\setminus\{0\}$ (and fortunately there are no non-real zeros) and the scale factor is determined by $\rm{sinc}(0)=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this we can rewrite the function as a collection of infinitely many linear factors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\rm{sinc}(x)=\frac{\prod_{k\in\mathbb{Z}\setminus\{0\}}(x-k)}{\prod_{k\in\mathbb{Z}\setminus\{0\}}(0-k)}=\prod_{k\in\mathbb{Z}\setminus\{0\}}\frac{(k-x)}{k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This function keeps behaving well if you replace the zeros that are at the integers $k$ with slightly individually shifted zeros at $x_k$, which are in general non-integer. Since the grid is non-regular, it makes sense to define a distorted sinc-like function with a center index $k_0$ in mind, which corresponds to a position $x_{k_0}$, at which the function evaluates to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the new generalized interpolation function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\rm{sinc}_{\{x_k\}}(x,k_0):=\prod_{k\in\mathbb{Z}\setminus\{k_0\}}\frac{x_k-x}{x_k-x_{k_0}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for a given set $\{x_k\}$ of sample points and the center sample $x_{k_0}$. The resulting interpolation function is the sinc function for a regular grid and a slightly deformed smooth function for a non-regular grid. The bandwidth of the function is a continuous function of the grid points, that means small deviations from the regular grid will preserve band-limitedness quite well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To evaluate this function you have to multiply infinitely many fractions, so this is not suitable for numerical evaluation. The function does also not converge very quickly, so that in practice the number of terms is still rather large. This changes if you apply a window function first so, that the interpolation is practically restricted to a small neighbourhood of the center sample. Then it suffices to evaluate a rather small number of terms to get a very good approximation.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-07-09T15:32:02.180" LastActivityDate="2014-07-09T15:32:02.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17266" PostTypeId="2" ParentId="9501" CreationDate="2014-07-09T15:22:58.477" Score="2" Body="&lt;p&gt;If your goal is to find only the frequency then its an easy task . &#xA;Magnitude = sqrt(real*real + img*img)&#xA;This number will always be positive. Now , find the maximum value of magnitude in the array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;also, &#xA;                   frequency = max magnitude*(Fs/N)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fs = sampling Frequency(44100 in your case) , N = size of FFT&#xA;Now you have the frequency. But the numerical value depends upon the fft size that you are using i.e 512 size will result in accuracy of 86Hz (+- 86) , 1024 =&gt; 43Hz and so on. So , the frequency will be 189__ or 190__ something :)&lt;/p&gt;&#xA;" OwnerUserId="8444" LastActivityDate="2014-07-09T15:22:58.477" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17267" PostTypeId="2" ParentId="17219" CreationDate="2014-07-09T15:40:30.707" Score="1" Body="&lt;p&gt;Nope. Its not . Although , computational sciences covers very wide range of subjects but to be able to implement DSP , one must have a thorough understanding of signal fundamentals . That is not a part of computational sciences . &lt;/p&gt;&#xA;" OwnerUserId="8444" LastActivityDate="2014-07-09T15:40:30.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17268" PostTypeId="1" CreationDate="2014-07-09T15:59:15.680" Score="1" ViewCount="946" Body="&lt;p&gt;I was pointed here by a chain of stackoverflow posts. I'm a software developer looking to make a module that recognizes noises like snorts and coughs. &lt;a href=&quot;https://stackoverflow.com/questions/24654967/recognize-bodily-noises-ie-snort-cough-sniffle&quot;&gt;Here was my original question on stackoverflow&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/8284725/real-time-identification-of-non-speech-non-music-sound-from-a-continuous-microp/8285673#8285673&quot;&gt;here is where I found this SE board&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, I'm trying to use a Raspberry Pi and a microphone to pick up noises like snorts, coughs, sneezes, etc as a proof of concept to tell if someone is sick. I'm not quite sure where to start, as those posts I linked above have a lot of information. I've also come across &lt;a href=&quot;https://dsp.stackexchange.com/questions/2461/is-there-any-free-software-that-can-recognize-and-classify-sounds&quot;&gt;this post&lt;/a&gt;, but I'm not sure if that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm very new here and to this particular concept, so any and all help would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="10444" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-07-09T17:57:35.720" Title="Recognizing bodily noises (ie, not spoken words)" Tags="|audio|sound|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17269" PostTypeId="1" CreationDate="2014-07-09T17:10:20.663" Score="14" ViewCount="5844" Body="&lt;p&gt;I have very limited resources as I'm working with a microcontroller.  Is there a taylor-series expansion, common lookup table, or recursive approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd prefer to do something without using math.h's sqrt()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cplusplus.com/reference/cmath/sqrt/&quot; rel=&quot;noreferrer&quot;&gt;http://www.cplusplus.com/reference/cmath/sqrt/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8116" LastEditorUserId="128" LastEditDate="2019-03-29T11:32:58.163" LastActivityDate="2021-08-11T07:36:07.383" Title="What Approximation Techniques Exist for Computing the Square Root?" Tags="|algorithms|c|numerical-algorithms|" AnswerCount="6" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17270" PostTypeId="2" ParentId="17268" CreationDate="2014-07-09T17:27:48.087" Score="2" Body="&lt;p&gt;As I've understood, your project is to detect and distinguish sounds like snorts, coughs, etc. from a domestic environment. So you are NOT interested in other sounds, like human speech, or other possible noises there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is right, an ostensible approach is to use a learning scheme along with an efficient set of features to $\bf{classify}$ the input sounds to the system. A function which can tell you whether a particular frame of audio ( fed to the system ) is of the sort that you are looking for or is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A promising fact about your project, is that the voices made by the human body are usually pretty distinctive from the background sounds. It is the consequence of the special features of the vocal track of men, which can posses (more or less) unique properties. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I suggest that you carry out the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Gather a sufficient database of the sounds that you are looking for, produced by different types of humans (men, women, children, elderly, etc.) all by your own microphone and with high quality. You should also gather a database of the opposite class: those which you wish to omit.&lt;/li&gt;&#xA;&lt;li&gt;Start analyzing the sounds. This might be a little technical and you will need to search  for features that can make a reasonable difference between the 2 classes. This might be a combination of features like pitch period, cepstral coefficients, decay rate of harmonic energy,etc. By the way, finding useful features is probably the paramount step of the project.&lt;/li&gt;&#xA;&lt;li&gt;Use a learning scheme ( a classification routine ) like SVM to separate the classes. Actually, you are going to train the machine on your collected database to classify new test inputs. &lt;/li&gt;&#xA;&lt;li&gt;Check out for real, new data. Test your classification with audio frames that are not included in your training database and observe the results. An small percentage of error is usual but large errors should be modified by either modifying the features and training set or changing the classification method.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope that helps, and good luck!&lt;/p&gt;&#xA;" OwnerUserId="7057" LastActivityDate="2014-07-09T17:27:48.087" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17271" PostTypeId="2" ParentId="17268" CreationDate="2014-07-09T17:57:35.720" Score="3" Body="&lt;p&gt;Most likely you are interested in a very simple approach that will run on your Pi. Some of methods I am going to mention are possible to run in real-time with not-badly written C code. Probably you will start with HMM's and MFCC's - it's not a bad idea for the beginning, but as you will see - people developed more advanced methods for such application. Choice of features is rather obvious, pre-processing and Machine Learning is up to you - this will have biggest impact onto your results.&lt;/p&gt;&#xA;&lt;p&gt;Here is a list of some papers you might find interesting. All of them are targeting cough recognition problem and are applicable to other types of sounds.&lt;/p&gt;&#xA;&lt;p&gt;HMM-&lt;em&gt;like&lt;/em&gt; approach:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Takahashi S., et al. - &lt;em&gt;&lt;strong&gt;Cough Detection in Spoken Dialogue System for Home Health Care&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Shasha Le, Weiping Hu - &lt;em&gt;&lt;strong&gt;Cough sound recognition based on Hilbert marginal spectrum&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Matos S., et al. - &lt;em&gt;&lt;strong&gt;Detection of cough signals in continuous audio recordings using HMM's&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Chunmei Z., et al. - &lt;em&gt;&lt;strong&gt;Recognition of cough using features improved by sub-band energy transformation&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hu W., et al. - &lt;em&gt;&lt;strong&gt;Cough sound detection bases on EMD analysis and HMM recognition&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Karhunen–Loève-&lt;em&gt;like&lt;/em&gt; approach:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Liu Y., et al. - &lt;em&gt;&lt;strong&gt;A cough sound recognition algorithm based on time-frequency energy distribution&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Decision Trees-&lt;em&gt;like&lt;/em&gt; approach:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Larson. E, et al. - &lt;em&gt;&lt;strong&gt;Accurate and Privacy Preserving Cough Sensing using a Low-Cost Microphone&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Martinek J., et al. - &lt;em&gt;&lt;strong&gt;Distinction of cough from other sounds produced by daily activities in the upper airways&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;SVM-&lt;em&gt;like&lt;/em&gt; approach:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Jia-Ming L., et al. - &lt;em&gt;&lt;strong&gt;Cough signal recognition with Gammatone Cepstral Coefficients&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;And &lt;a href=&quot;http://www.prairieswine.com/pdf/38998.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;/a&gt; is absolutely lovely ;)&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-07-09T17:57:35.720" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17272" PostTypeId="2" ParentId="17269" CreationDate="2014-07-09T18:55:59.803" Score="4" Body="&lt;p&gt;Actually it is done by solving an quadratic equation using Newton Method - &lt;a href=&quot;http://en.wikipedia.org/wiki/Methods_of_computing_square_roots&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Methods of Computing Square Roots&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For numbers greater than one you can use the following &lt;a href=&quot;http://planetmath.org/taylorexpansionofsqrt1x&quot; rel=&quot;nofollow noreferrer&quot;&gt;Taylor Expansion - Planet Math - Taylor Expansion for &lt;span class=&quot;math-container&quot;&gt;$\sqrt{x + 1}$&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="37293" LastEditDate="2021-08-11T07:36:07.383" LastActivityDate="2021-08-11T07:36:07.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17273" PostTypeId="2" ParentId="17244" CreationDate="2014-07-09T19:09:06.537" Score="0" Body="&lt;p&gt;What about just integrating the energy in the high frequencies?&lt;br&gt;&#xA;You can do that after applying High Pass filter which is equivalent of weighting high frequencies differently.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-07-09T19:09:06.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17275" PostTypeId="1" CreationDate="2014-07-09T20:07:24.887" Score="0" ViewCount="148" Body="&lt;p&gt;Is there a type of filter for processing spectrum data that will subtract spikes in intensity? I was thinking of something like a low-pass filter but that takes away data if the intensity is too high. I am trying to do this since there is a lot of bright intensity measurements in a certain frequency range that are making it hard for me to see other data.&lt;/p&gt;&#xA;" OwnerUserId="10446" LastActivityDate="2014-07-09T20:07:24.887" Title="Filter that is like low-pass filter but for intensity?" Tags="|filters|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17276" PostTypeId="2" ParentId="17269" CreationDate="2014-07-09T20:17:06.187" Score="16" Body="&lt;p&gt;if you want a cheap and dirty optimized power-series expansion (the coefficients for Taylor series converge slowly) for &lt;code&gt;sqrt()&lt;/code&gt; and a bunch of other trancendentals, i have some code from long ago.  i used to sell this code, but no one has paid me for it for nearly a decade.  so i think i'll release it for public consumption.  this particular file was for an application where the processor had floating point (IEEE-754 single precision) and they had a C compiler and dev system, but they did &lt;em&gt;not&lt;/em&gt; have (or they didn't want to link in) the stdlib that would have had the standard math functions.  they did not need perfect precision, but they wanted things to be fast.  you can pretty easily reverse engineer the code to see what the power series coefficients are and write your own code.  this code assumes IEEE-754 and masked off the bits for mantissa and exponent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it appears that the &quot;code markup&quot; that SE has is unfriendly with angle characters (you know &quot;&gt;&quot; or &quot;&amp;lt;&quot;), so you'll probably have to hit &quot;edit&quot; to see all of it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//&#xA;//    FILE: __functions.h&#xA;//&#xA;//    fast and approximate transcendental functions&#xA;//&#xA;//    copyright (c) 2004  Robert Bristow-Johnson&#xA;//&#xA;//    rbj@audioimagination.com&#xA;//&#xA;&#xA;&#xA;#ifndef __FUNCTIONS_H&#xA;#define __FUNCTIONS_H&#xA;&#xA;#define TINY 1.0e-8&#xA;#define HUGE 1.0e8&#xA;&#xA;#define PI              (3.1415926535897932384626433832795028841972)        /* pi */&#xA;#define ONE_OVER_PI     (0.3183098861837906661338147750939)&#xA;#define TWOPI           (6.2831853071795864769252867665590057683943)        /* 2*pi */&#xA;#define ONE_OVER_TWOPI  (0.15915494309189535682609381638)&#xA;#define PI_2            (1.5707963267948966192313216916397514420986)        /* pi/2 */&#xA;#define TWO_OVER_PI     (0.636619772367581332267629550188)&#xA;#define LN2             (0.6931471805599453094172321214581765680755)        /* ln(2) */&#xA;#define ONE_OVER_LN2    (1.44269504088896333066907387547)&#xA;#define LN10            (2.3025850929940456840179914546843642076011)        /* ln(10) */&#xA;#define ONE_OVER_LN10   (0.43429448190325177635683940025)&#xA;#define ROOT2           (1.4142135623730950488016887242096980785697)        /* sqrt(2) */&#xA;#define ONE_OVER_ROOT2  (0.707106781186547438494264988549)&#xA;&#xA;#define DB_LOG2_ENERGY          (3.01029995663981154631945610163)           /* dB = DB_LOG2_ENERGY*__log2(energy) */&#xA;#define DB_LOG2_AMPL            (6.02059991327962309263891220326)           /* dB = DB_LOG2_AMPL*__log2(amplitude) */&#xA;#define ONE_OVER_DB_LOG2_AMPL   (0.16609640474436811218256075335)           /* amplitude = __exp2(ONE_OVER_DB_LOG2_AMPL*dB) */&#xA;&#xA;#define LONG_OFFSET     4096L&#xA;#define FLOAT_OFFSET    4096.0&#xA;&#xA;&#xA;&#xA;float   __sqrt(float x);&#xA;&#xA;float   __log2(float x);&#xA;float   __exp2(float x);&#xA;&#xA;float   __log(float x);&#xA;float   __exp(float x);&#xA;&#xA;float   __pow(float x, float y);&#xA;&#xA;float   __sin_pi(float x);&#xA;float   __cos_pi(float x);&#xA;&#xA;float   __sin(float x);&#xA;float   __cos(float x);&#xA;float   __tan(float x);&#xA;&#xA;float   __atan(float x);&#xA;float   __asin(float x);&#xA;float   __acos(float x);&#xA;&#xA;float   __arg(float Imag, float Real);&#xA;&#xA;float   __poly(float *a, int order, float x);&#xA;float   __map(float *f, float scaler, float x);&#xA;float   __discreteMap(float *f, float scaler, float x);&#xA;&#xA;unsigned long __random();&#xA;&#xA;#endif&#xA;&#xA;&#xA;&#xA;&#xA;//&#xA;//    FILE: __functions.c&#xA;//&#xA;//    fast and approximate transcendental functions&#xA;//&#xA;//    copyright (c) 2004  Robert Bristow-Johnson&#xA;//&#xA;//    rbj@audioimagination.com&#xA;//&#xA;&#xA;#define STD_MATH_LIB 0&#xA;&#xA;#include &quot;__functions.h&quot;&#xA;&#xA;#if STD_MATH_LIB&#xA;#include &quot;math.h&quot;   // angle brackets don't work with SE markup&#xA;#endif&#xA;&#xA;&#xA;&#xA;&#xA;float   __sqrt(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) sqrt((double)x);&#xA;#else&#xA;    if (x &amp;gt; 5.877471754e-39)&#xA;        {&#xA;        register float accumulator, xPower;&#xA;        register long intPart;&#xA;        register union {float f; long i;} xBits;&#xA;&#xA;        xBits.f = x;&#xA;&#xA;        intPart = ((xBits.i)&amp;gt;&amp;gt;23);                  /* get biased exponent */&#xA;        intPart -= 127;                             /* unbias it */&#xA;&#xA;        x = (float)(xBits.i &amp;amp; 0x007FFFFF);          /* mask off exponent leaving 0x800000*(mantissa - 1) */&#xA;        x *= 1.192092895507812e-07;                 /* divide by 0x800000 */&#xA;&#xA;        accumulator =  1.0 + 0.49959804148061*x;&#xA;        xPower = x*x;&#xA;        accumulator += -0.12047308243453*xPower;&#xA;        xPower *= x;&#xA;        accumulator += 0.04585425015501*xPower;&#xA;        xPower *= x;&#xA;        accumulator += -0.01076564682800*xPower;&#xA;&#xA;        if (intPart &amp;amp; 0x00000001)&#xA;            {&#xA;            accumulator *= ROOT2;                   /* an odd input exponent means an extra sqrt(2) in the output */&#xA;            }&#xA;&#xA;        xBits.i = intPart &amp;gt;&amp;gt; 1;                     /* divide exponent by 2, lose LSB */&#xA;        xBits.i += 127;                             /* rebias exponent */&#xA;        xBits.i &amp;lt;&amp;lt;= 23;                             /* move biased exponent into exponent bits */&#xA;&#xA;        return accumulator * xBits.f;&#xA;        }&#xA;     else&#xA;        {&#xA;        return 0.0;&#xA;        }&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;&#xA;&#xA;float   __log2(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) (ONE_OVER_LN2*log((double)x));&#xA;#else&#xA;    if (x &amp;gt; 5.877471754e-39)&#xA;        {&#xA;        register float accumulator, xPower;&#xA;        register long intPart;&#xA;&#xA;        register union {float f; long i;} xBits;&#xA;&#xA;        xBits.f = x;&#xA;&#xA;        intPart = ((xBits.i)&amp;gt;&amp;gt;23);                  /* get biased exponent */&#xA;        intPart -= 127;                             /* unbias it */&#xA;&#xA;        x = (float)(xBits.i &amp;amp; 0x007FFFFF);          /* mask off exponent leaving 0x800000*(mantissa - 1) */&#xA;        x *= 1.192092895507812e-07;                 /* divide by 0x800000 */&#xA;&#xA;        accumulator = 1.44254494359510*x;&#xA;        xPower = x*x;&#xA;        accumulator += -0.71814525675041*xPower;&#xA;        xPower *= x;&#xA;        accumulator += 0.45754919692582*xPower;&#xA;        xPower *= x;&#xA;        accumulator += -0.27790534462866*xPower;&#xA;        xPower *= x;&#xA;        accumulator += 0.12179791068782*xPower;&#xA;        xPower *= x;&#xA;        accumulator += -0.02584144982967*xPower;&#xA;&#xA;        return accumulator + (float)intPart;&#xA;        }&#xA;     else&#xA;        {&#xA;        return -HUGE;&#xA;        }&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;float   __exp2(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) exp(LN2*(double)x);&#xA;#else&#xA;    if (x &amp;gt;= -127.0)&#xA;        {&#xA;        register float accumulator, xPower;&#xA;        register union {float f; long i;} xBits;&#xA;&#xA;        xBits.i = (long)(x + FLOAT_OFFSET) - LONG_OFFSET;       /* integer part */&#xA;        x -= (float)(xBits.i);                                  /* fractional part */&#xA;&#xA;        accumulator = 1.0 + 0.69303212081966*x;&#xA;        xPower = x*x;&#xA;        accumulator += 0.24137976293709*xPower;&#xA;        xPower *= x;&#xA;        accumulator += 0.05203236900844*xPower;&#xA;        xPower *= x;&#xA;        accumulator += 0.01355574723481*xPower;&#xA;&#xA;        xBits.i += 127;                                         /* bias integer part */&#xA;        xBits.i &amp;lt;&amp;lt;= 23;                                         /* move biased int part into exponent bits */&#xA;&#xA;        return accumulator * xBits.f;&#xA;        }&#xA;     else&#xA;        {&#xA;        return 0.0;&#xA;        }&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;float   __log(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) log((double)x);&#xA;#else&#xA;    return LN2*__log2(x);&#xA;#endif&#xA;    }&#xA;&#xA;float   __exp(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) exp((double)x);&#xA;#else&#xA;    return __exp2(ONE_OVER_LN2*x);&#xA;#endif&#xA;    }&#xA;&#xA;float   __pow(float x, float y)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) pow((double)x, (double)y);&#xA;#else&#xA;    return __exp2(y*__log2(x));&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;&#xA;&#xA;float   __sin_pi(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) sin(PI*(double)x);&#xA;#else&#xA;    register float accumulator, xPower, xSquared;&#xA;&#xA;    register long evenIntPart = ((long)(0.5*x + 1024.5) - 1024)&amp;lt;&amp;lt;1;&#xA;    x -= (float)evenIntPart;&#xA;&#xA;    xSquared = x*x;&#xA;    accumulator = 3.14159265358979*x;&#xA;    xPower = xSquared*x;&#xA;    accumulator += -5.16731953364340*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += 2.54620566822659*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += -0.586027023087261*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += 0.06554823491427*xPower;&#xA;&#xA;    return accumulator;&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;float   __cos_pi(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) cos(PI*(double)x);&#xA;#else&#xA;    register float accumulator, xPower, xSquared;&#xA;&#xA;    register long evenIntPart = ((long)(0.5*x + 1024.5) - 1024)&amp;lt;&amp;lt;1;&#xA;    x -= (float)evenIntPart;&#xA;&#xA;    xSquared = x*x;&#xA;    accumulator = 1.57079632679490*x;                       /* series for sin(PI/2*x) */&#xA;    xPower = xSquared*x;&#xA;    accumulator += -0.64596406188166*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += 0.07969158490912*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += -0.00467687997706*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += 0.00015303015470*xPower;&#xA;&#xA;    return 1.0 - 2.0*accumulator*accumulator;               /* cos(w) = 1 - 2*(sin(w/2))^2 */&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;float   __sin(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) sin((double)x);&#xA;#else&#xA;    x *= ONE_OVER_PI;&#xA;    return __sin_pi(x);&#xA;#endif&#xA;    }&#xA;&#xA;float   __cos(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) cos((double)x);&#xA;#else&#xA;    x *= ONE_OVER_PI;&#xA;    return __cos_pi(x);&#xA;#endif&#xA;    }&#xA;&#xA;float   __tan(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) tan((double)x);&#xA;#else&#xA;    x *= ONE_OVER_PI;&#xA;    return __sin_pi(x)/__cos_pi(x);&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;&#xA;&#xA;float   __atan(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) atan((double)x);&#xA;#else&#xA;    register float accumulator, xPower, xSquared, offset;&#xA;&#xA;    offset = 0.0;&#xA;&#xA;    if (x &amp;lt; -1.0)&#xA;        {&#xA;        offset = -PI_2;&#xA;        x = -1.0/x;&#xA;        }&#xA;     else if (x &amp;gt; 1.0)&#xA;        {&#xA;        offset = PI_2;&#xA;        x = -1.0/x;&#xA;        }&#xA;    xSquared = x*x;&#xA;    accumulator = 1.0;&#xA;    xPower = xSquared;&#xA;    accumulator += 0.33288950512027*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += -0.08467922817644*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += 0.03252232640125*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += -0.00749305860992*xPower;&#xA;&#xA;    return offset + x/accumulator;&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;float   __asin(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) asin((double)x);&#xA;#else&#xA;    return __atan(x/__sqrt(1.0 - x*x));&#xA;#endif&#xA;    }&#xA;&#xA;float   __acos(register float x)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) acos((double)x);&#xA;#else&#xA;    return __atan(__sqrt(1.0 - x*x)/x);&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;float   __arg(float Imag, float Real)&#xA;    {&#xA;#if STD_MATH_LIB&#xA;    return (float) atan2((double)Imag, (double)Real);&#xA;#else&#xA;    register float accumulator, xPower, xSquared, offset, x;&#xA;&#xA;    if (Imag &amp;gt; 0.0)&#xA;        {&#xA;        if (Imag &amp;lt;= -Real)&#xA;            {&#xA;            offset = PI;&#xA;            x = Imag/Real;&#xA;            }&#xA;         else if (Imag &amp;gt; Real)&#xA;            {&#xA;            offset = PI_2;&#xA;            x = -Real/Imag;&#xA;            }&#xA;         else&#xA;            {&#xA;            offset = 0.0;&#xA;            x = Imag/Real;&#xA;            }&#xA;        }&#xA;     else&#xA;        {&#xA;        if (Imag &amp;gt;= Real)&#xA;            {&#xA;            offset = -PI;&#xA;            x = Imag/Real;&#xA;            }&#xA;         else if (Imag &amp;lt; -Real)&#xA;            {&#xA;            offset = -PI_2;&#xA;            x = -Real/Imag;&#xA;            }&#xA;         else&#xA;            {&#xA;            offset = 0.0;&#xA;            x = Imag/Real;&#xA;            }&#xA;        }&#xA;&#xA;    xSquared = x*x;&#xA;    accumulator = 1.0;&#xA;    xPower = xSquared;&#xA;    accumulator += 0.33288950512027*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += -0.08467922817644*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += 0.03252232640125*xPower;&#xA;    xPower *= xSquared;&#xA;    accumulator += -0.00749305860992*xPower;&#xA;&#xA;    return offset + x/accumulator;&#xA;#endif&#xA;    }&#xA;&#xA;&#xA;&#xA;&#xA;float   __poly(float *a, int order, float x)&#xA;    {&#xA;    register float accumulator = 0.0, xPower;&#xA;    register int n;&#xA;&#xA;    accumulator = a[0];&#xA;    xPower = x;&#xA;    for (n=1; n&amp;lt;=order; n++)&#xA;        {&#xA;        accumulator += a[n]*xPower;&#xA;        xPower *= x;&#xA;        }&#xA;&#xA;    return accumulator;&#xA;    }&#xA;&#xA;&#xA;float   __map(float *f, float scaler, float x)&#xA;    {&#xA;    register long i;&#xA;&#xA;    x *= scaler;&#xA;&#xA;    i = (long)(x + FLOAT_OFFSET) - LONG_OFFSET;         /* round down without floor() */&#xA;&#xA;    return f[i] + (f[i+1] - f[i])*(x - (float)i);       /* linear interpolate between points */&#xA;    }&#xA;&#xA;&#xA;float   __discreteMap(float *f, float scaler, float x)&#xA;    {&#xA;    register long i;&#xA;&#xA;    x *= scaler;&#xA;&#xA;    i = (long)(x + (FLOAT_OFFSET+0.5)) - LONG_OFFSET;   /* round to nearest */&#xA;&#xA;    return f[i];&#xA;    }&#xA;&#xA;&#xA;unsigned long __random()&#xA;    {&#xA;    static unsigned long seed0 = 0x5B7A2775, seed1 = 0x80C7169F;&#xA;&#xA;    seed0 += seed1;&#xA;    seed1 += seed0;&#xA;&#xA;    return seed1;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="10449" LastEditDate="2014-07-10T03:06:08.117" LastActivityDate="2014-07-10T03:06:08.117" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17277" PostTypeId="2" ParentId="17219" CreationDate="2014-07-09T22:02:16.537" Score="-1" Body="&lt;p&gt;DSP is a branch of electrical engineering, not science.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-07-09T22:02:16.537" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17278" PostTypeId="2" ParentId="17269" CreationDate="2014-07-09T22:29:54.803" Score="6" Body="&lt;p&gt;because the code markup for SE seems to work like shit, i'll try to answer this more directly, specifically for the $\sqrt{x}$ function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;yes, a &lt;em&gt;power series&lt;/em&gt; can quickly and efficiently &lt;strong&gt;approximate&lt;/strong&gt; the square root function, and only over a limited domain.  the wider the domain, the more terms you will need in your power series to keep the error sufficiently low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $ 1 \le x \le 2 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;\sqrt{x} \ &amp;amp;\approx \  1 + a_1 (x-1) + a_2 (x-1)^2 + a_3 (x-1)^3 + a_4 (x-1)^4 \\&#xA;\\&#xA;&amp;amp; = 1 + (x-1)\bigg( a_1 + (x-1)\Big( a_2 + (x-1)\big( a_3 + (x-1)a_4 \big) \Big) \bigg) \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_1$ =  0.49959804148061&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_2$ = -0.12047308243453&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_3$ =  0.04585425015501&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_4$ = -0.01076564682800&lt;/p&gt;&#xA;&#xA;&lt;p&gt;these coefficients were determined using a modified Remez exchange algorithm such that equality is at $x=1$ and $x=2$ and the maximum &lt;em&gt;relative&lt;/em&gt; error in between is minimized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, if your implementation is fixed point, then you need to shift your bits (counting the number of bit positions shifted) until your values is between 1 and 2 using the scaling of your fixed-point scheme.  if you shift right[left] the argument by $2n$ bits to get the argument to be between 1 and 2, the result should be shift left[right] by $n$ bits.  if the number of shift bits is odd, the extra bit shift is compensated with an additional multiplication of $\sqrt{2}$, which can be stored as a constant in your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if it's floating point, you need to separate the exponent and mantissa like my C code does in the other answer.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2017-07-17T22:16:38.983" LastActivityDate="2017-07-17T22:16:38.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17279" PostTypeId="2" ParentId="17269" CreationDate="2014-07-09T22:35:12.287" Score="7" Body="&lt;p&gt;If you haven't seen it, the &quot;Quake square root&quot; is simply mystifying. It uses some bit-level magic to give you a very good first approximation, and then uses a round or two of Newton's approximation to revise. It might help you if you're working with limited resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fast_inverse_square_root&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Fast_inverse_square_root&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/&quot; rel=&quot;noreferrer&quot;&gt;http://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10251" LastActivityDate="2014-07-09T22:35:12.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17280" PostTypeId="1" AcceptedAnswerId="17281" CreationDate="2014-07-10T07:08:07.377" Score="0" ViewCount="51" Body="&lt;p&gt;I want to do some simulations of speech recorded on microphones. In order to simulate the channel response, are there any standard (FIR) filter parameters available that I can use?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastActivityDate="2014-07-10T07:34:38.737" Title="Parameters of standard audio channel filters" Tags="|filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17281" PostTypeId="2" ParentId="17280" CreationDate="2014-07-10T07:34:38.737" Score="1" Body="&lt;p&gt;Your question is not very specific, nor the answer will be. For example what do you mean by 'standard filter parameters'? I assume that you want to make given speech signals sound like ones being recorded with a specific microphone. Solutions would be&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Hard way. You must obtain the impulse response of your microphone, for example by using Maximum Length Sequence or Sweep Sine method. In theory such measurement should be performed in anechoic environment (free space outside, well damped room, anechoic chamber), otherwise you will add even more reverberation. When you have your impulse response, simply convolve it with your signal and you will get very good approximation of how your microphone modifies the sound. Obviously speaker characteristics are also part of this impulse response, so you might want to use one with most linear amplitude response. In theory speaker response can be deconvolved to some extend by using reference microphone.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Easy way. Measure the frequency response of your microphone by using signals described above. You also measure the frequency response of the reference (maximally flat) microphone. Just subtract two amplitude characteristics and you get how your microphone distorts signals. Having that, use it as the input for the Parks–McClellan algorithm and design FIR filter that resembles this response in a best way.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Dummy way. Take the frequency characteristic provided by manufacturer in the manual, trust him, sample it, and use as the input for algorithm mentioned above. In MATLAB that would be &lt;code&gt;firpm&lt;/code&gt; function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-07-10T07:34:38.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17282" PostTypeId="2" ParentId="17205" CreationDate="2014-07-10T09:15:18.240" Score="5" Body="&lt;p&gt;Note that in general the Fourier transform of a stationary process $x(t)$ does not exist. The Wiener-Khinchin theorem only states that under certain conditions the &lt;em&gt;power spectral density&lt;/em&gt; of $x(t)$ exists, and it can be computed as the Fourier transform of the &lt;em&gt;autocorrelation function&lt;/em&gt; of $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, if for some reason one assumes that the Fourier transform of $x(t)$ exists, then you can do the math and see if you get a useful result. So, let's see. I assume that $x(t)$ is real-valued. This is not at all necessary, but just simplifies things a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $\text{Re}\{X(\omega)\}=\frac12[X(\omega)+X^*(\omega)]$ and $\text{Im}\{X(\omega)\}=\frac{1}{2j}[X(\omega)-X^*(\omega)]$, we can compute the desired expectations from $E\{X(\omega)X(\omega')\}$ and $E\{X^*(\omega)X(\omega')\}$. For the first of these expectations we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{X(\omega)X(\omega')\}=E\left\{\int_{-\infty}^{\infty}x(t)e^{-j\omega t}dt&#xA;\int_{-\infty}^{\infty}x(t')e^{-j\omega' t'}dt'  \right\}=\\&#xA;=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}E\{x(t)x(t')\}e^{-j\omega t}e^{-j\omega't'}dtdt'$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the substution $\tau=t'-t$ and with the autocorrelation function $R_x(\tau)=E\{x(t)x(t+\tau)\}$ (assuming wide-sense stationarity of $x(t)$) we obtain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{X(\omega)X(\omega')\}=\int_{-\infty}^{\infty}R_x(\tau)e^{-j\omega'\tau}d\tau\int_{-\infty}^{\infty}e^{-j(\omega+\omega')t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interpreting the second integral as a distribution, and with the power spectrum $S_x(\omega)=\mathcal{F}\{R_x(\tau)\}$ we finally get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{X(\omega)X(\omega')\}=2\pi\delta(\omega+\omega')S_x(\omega')=&#xA;2\pi\delta(\omega+\omega')S_x(-\omega)=2\pi\delta(\omega+\omega')S_x(\omega)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $S_x(\omega)$ is an even function (we assumed $x(t)$ to be real-valued). The other expectation $E\{X^*(\omega)X(\omega')\}$ can be derived in a completely analogous manner. The result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{X^*(\omega)X(\omega')\}=2\pi\delta(\omega-\omega')S_x(\omega)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) and (2) we can obtain the desired expectations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{\text{Re}\{X(\omega)\}\text{Re}\{X(\omega')\}\}=&#xA;\pi S_x(\omega)[\delta(\omega-\omega')+\delta(\omega+\omega')]\\&#xA;E\{\text{Im}\{X(\omega)\}\text{Im}\{X(\omega')\}\}=&#xA;\pi S_x(\omega)[\delta(\omega-\omega')-\delta(\omega+\omega')]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It remains to compute the quantities $E\{\text{Re}\{X(\omega)\}$ and $E\{\text{Im}\{X(\omega)\}$. We can easily derive them from the expectations $E\{X(\omega)\}$ and $E\{X^*(\omega)\}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{X(\omega)\}=E\left\{ \int_{-\infty}^{\infty}x(t)e^{-j\omega t}dt \right\}=&#xA;\int_{-\infty}^{\infty}E\{x(t)\}e^{-j\omega t}dt=&#xA;\mu_x\int_{-\infty}^{\infty}e^{-j\omega t}dt=2\pi\mu_x\delta(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\mu_x=E\{x(t)\}$, where we have again assumed wide-sense stationarity of $x(t)$. Obviously, we get the same result for $E\{X^*(\omega)\}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{X^*(\omega)\}=2\pi\mu_x\delta(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This results in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{\text{Re}\{X(\omega)\}\}=2\pi\mu_x\delta(\omega)\quad\text{and}\quad&#xA;E\{\text{Im}\{X(\omega)\}\}=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{\text{Re}\{X(\omega)\}\}\cdot E\{\text{Re}\{X(\omega')\}\}=4\pi^2\mu_x^2\delta(\omega)\delta(\omega')\\&#xA;E\{\text{Im}\{X(\omega)\}\}\cdot E\{\text{Im}\{X(\omega')\}\}=0\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining (3) with (1) and (2) you obtain the desired result. From the result you can see that the covariances of the real parts of $X(\omega)$ and $X(\omega')$ vanish everywhere except for $\omega=\pm\omega'$. The same is true for the covariances of the imaginary parts. The difference is an additional term for $\omega=\omega'=0$ for the covariance of the real parts.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-07-10T10:41:46.017" LastActivityDate="2014-07-10T10:41:46.017" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="17286" PostTypeId="1" AcceptedAnswerId="17291" CreationDate="2014-07-10T15:37:43.627" Score="4" ViewCount="401" Body="&lt;p&gt;What is the proper way to calculate the frequency content or spectrum of a signal with a variable (but measured) sample rate?  I.e. get similar results as you would from an FFT, but for data not evenly spaced in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can resample the data by interpolating on an evenly-spaced time vector then apply a FFT, but this seems less than ideal.&lt;/p&gt;&#xA;" OwnerUserId="10458" LastEditorUserId="128" LastEditDate="2018-08-22T07:03:42.220" LastActivityDate="2018-08-22T07:03:42.220" Title="Determine Frequency Content of Variable Rate Signal (Non Uniform Sampling of Signal)" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="0" ClosedDate="2016-07-14T13:55:14.287" ContentLicense="CC BY-SA 4.0" />
  <row Id="17287" PostTypeId="1" CreationDate="2014-07-10T17:37:18.987" Score="0" ViewCount="32" Body="&lt;p&gt;I want to implement ETSI/BRAN Indoor Model A channel, i have the delays for the paths tau=[0 10 20 30 40 50 60 70 80 90 110 140 170 200 240 290 340 390]*10^(-9); and the Average Relative Power (dB) pdb=[0 -0.9 -1.7 -2.6 -3.5 -4.3 -5.2 -6.1 -6.9 -7.8 -4.7 -7.3 -9.9 -12.5 -13.7 -18 -22.4 -26.7]; and i want to create time varying channel using Mont Carlo Method (i have no idea about it), please help me how can i implement it in matlab  &lt;/p&gt;&#xA;" OwnerUserId="10354" LastEditorUserId="10354" LastEditDate="2014-07-10T18:35:27.523" LastActivityDate="2014-07-10T18:35:27.523" Title="Can someone help me with ETSI/BRAN Indoor wireless channel specification and implementation in MATLAB" Tags="|multi-channel|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17288" PostTypeId="1" AcceptedAnswerId="17306" CreationDate="2014-07-10T18:20:35.490" Score="1" ViewCount="230" Body="&lt;p&gt;I want to filter sensor signals for a data acquisition application on an ATmega microcontroller. The interesting parts of the signal are in the range 0-5Hz, and I'd like to leave these mostly unchanged, but strongly attenuate 50Hz power line hum and anything above that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal will later be evaluated in the time domain, especially the time and amplitude of large peaks (typically lasting well over a second), and the area under those peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the signal is generated by a different device with its own power supply, I expect to see some power supply hum as well as general noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to minimize hardware components I plan to use a simple RC filter (-3dB at 18Hz) for antialiasing, combined with a fairly high sample rate (&gt; 1kHz), and then apply digital filtering. The signal will then be sent on to a PC at a much lower sampling rate (probably &amp;lt;10Hz). However, I'm not very experienced with filtering, so I'm a bit overwhelmed with the choices available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the fast sampling rate and very limited CPU power, filters that require many floating point operations would at best be a good deal of work to implement. I played around with filter design tools a bit and looked at the properties of Butterworth and Bessel filters or just chaining several first-order filters in a row (since they can be implemented very efficiently), and finally found an interesting section about the humble &quot;moving average&quot; filter on dspguide.com.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After playing around in Octave a bit, it seems to me that by chaining four moving average filters, two with 1/50s and two with 1/60s window, would give me&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;around 0.5dB attenuation at 5Hz, the outer limit of what might still be interesting signal&lt;/li&gt;&#xA;&lt;li&gt;over 100dB attenuation at both 50Hz and 60Hz, even if the frequency is 1% off&lt;/li&gt;&#xA;&lt;li&gt;over 80dB attenuation for anything above 100Hz&lt;/li&gt;&#xA;&lt;li&gt;linear phase shift in the signal band, for a fixed delay of &amp;lt;40ms&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This looks very promising, but since I only started playing with all of this very recently, I'm not completely sure my results are valid. Is this a good filter for my task, or would you recommend something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There might also still be noise left in the range of 5Hz to 50Hz which would cause aliasing when the signal is sampled at 10Hz by the PC. Then again, I don't expect to see much noise in that range and don't want to needlessly distort the signal. Should I just send the latest sample, or perhaps take the average of all samples between two &quot;PC sample points&quot;? What would you recommend?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; to address Oscar's questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there will be much signal above 5Hz and the SNR should be pretty good without any filtering already, but I'll try recording some examples soon. Different environments and different source equipment for the signal could also look quite different, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, a different device that we use for the same purpose samples the input at only 2Hz without extra filtering after the A/D, but the &lt;a href=&quot;http://www.beckhoff.de/english/bus_terminal/kl3102.htm&quot; rel=&quot;nofollow&quot;&gt;A/D module&lt;/a&gt; in that device seems to filter quite a bit already. Trying to get the requirements, I got the &quot;at most 5Hz&quot; figure from a colleague (though I'm not even sure if he meant samplerate or nyquist frequency), so I adjusted the sample rate up in order to remain consistent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll probably have to handle four channels sampled at 12 bits, and the filtering is the only CPU-intensive task the controller has to perform. The number of cycles per sample is a tradeoff against sample rate (ammount of aliasing) and code maintainability (perform calculations while communicating with the ADC?), but I think 400 cycles would be a pretty good result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't push the full sample rate to the PC, but 100-200sps per channel should be ok.&lt;/p&gt;&#xA;" OwnerUserId="10459" LastEditorUserId="10459" LastEditDate="2014-07-11T15:06:13.563" LastActivityDate="2014-07-11T15:46:01.833" Title="Designing the filtering for a time domain data acquisition application" Tags="|filter-design|lowpass-filter|aliasing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17289" PostTypeId="1" AcceptedAnswerId="17313" CreationDate="2014-07-10T18:37:33.397" Score="2" ViewCount="4262" Body="&lt;p&gt;I read a paper that said about correlation kernel that defined:&#xA;$$W(x-y)=(α/1+d(|y − x|))$$&#xA;where $α =  (\int(1+d(y − x)dy)^{-1}$, $(d(|y − x|))$  is spatial Euclidean distance from the central pixel.&#xA;My question is what is correlation kernel and benifit of that kernel comparison with gaussian kernel? Thank you so much. &lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="8264" LastEditDate="2014-07-12T10:19:38.117" LastActivityDate="2014-07-12T10:19:38.117" Title="What is correlation kernel and compare with gaussian kernel" Tags="|image-processing|matlab|gaussian|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17290" PostTypeId="1" CreationDate="2014-07-10T20:11:19.250" Score="0" ViewCount="520" Body="&lt;p&gt;I am searching for the algorithm that takes (audio) signal as an input and outputs weighted intensity of the frequencies of some narrow band (axis X) in time  (axis Y). Frequency in the middle of that band would have highest weight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words: It is like spectrograph but I am interested only for the weighted average of small band on X axis where middle of that band would have highest weight. And to have it as function of the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another try: I am looking for an algorithm that computes weighted average of frequencies intensity from narrow band in spectrograph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if this algorithm has some specific name. I think it would include some FFT and other &quot;magic&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best would be to have a link to some (java) library that can do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am total newbie in signal processing so please be more verbose.&lt;/p&gt;&#xA;" OwnerUserId="10460" LastActivityDate="2014-07-10T20:11:19.250" Title="Looking for an algorithm that computes weighted average of frequencies intensity from narrow band in spectrograph" Tags="|fft|power-spectral-density|spectrogram|bandwidth|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17291" PostTypeId="2" ParentId="17286" CreationDate="2014-07-10T20:38:44.317" Score="1" Body="&lt;p&gt;Basically what you have is data which isn't evenly spaced in time.&lt;br&gt;&#xA;The conventional way to take care of the is using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Non-uniform_discrete_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Non Uniform Discrete Fourier Transform&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach would be looking at the Fourier Transform as a weighted sum of the signal in time.&lt;br&gt;&#xA;Since you know the time shift between the samples you can build the right &quot;Weights&quot; for this kind of sampling.&#xA;Once you have the weights, all you need is to calculate the weighted sum for each frequency you're interested in.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-08-22T07:00:27.370" LastActivityDate="2018-08-22T07:00:27.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17292" PostTypeId="1" AcceptedAnswerId="17295" CreationDate="2014-07-11T06:36:37.327" Score="5" ViewCount="283" Body="&lt;p&gt;If $x[n]$ is input signal, $y[m]$ is output signal, $h[m]$ is impulse response of the channel, then the following relation holds&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert Y(\omega)\rvert = \lvert H(\omega)\rvert^2 . \lvert X(\omega)\rvert$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $F(\omega)$ is the DFT of $f[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To verify this, I wrote following MATLAB code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = randn(1,1000);&#xA;h = [1 2 3 4 5];&#xA;y = conv(x,h);&#xA;plot((abs(fft(h,1024)).^2).*(abs(fft(x,1024))));&#xA;hold on&#xA;plot(abs(fft(y,1024)),'r')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result shows that second plot is at a much lower level than first plot. When I multiply second plot by $1024$ i.e. NFFT then both the plots overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is wrong with the original equation? I remember learning it that way in class. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FQPMZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="128" LastEditDate="2019-03-29T11:33:40.037" LastActivityDate="2019-03-29T11:33:40.037" Title="Verifying Channel Response Identity" Tags="|matlab|fft|dsp-core|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17293" PostTypeId="2" ParentId="17292" CreationDate="2014-07-11T06:49:51.207" Score="3" Body="&lt;p&gt;I think you made a mistake between the power spectrum and the Fourier Transform.&#xA;This is the right form of the Convolution Theory (Nothing is squared):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \lvert Y(\omega)\rvert = \lvert H(\omega) X(\omega)\rvert $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this and it will work for you on MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;MATLAB Code&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Calculating the Magnitude of the Filtered Signal&#xA;&#xA;vFilterCoeff = [1; 2; 3; 4; 5];&#xA;vInputSignal = randn(1000, 1);&#xA;&#xA;vOutputSginal = conv(vInputSignal, vFilterCoeff);&#xA;&#xA;fftNumPoints = 1024;&#xA;&#xA;vOutputSignalDftMagnitude = abs(fft(vOutputSginal, fftNumPoints));&#xA;vFilteredSignalDftMagnitude = abs(fft(vFilterCoeff, fftNumPoints) .* fft(vInputSignal, fftNumPoints));&#xA;&#xA;hFigure = figure();&#xA;hAxes   = axes();&#xA;plot([vOutputSignalDftMagnitude, vFilteredSignalDftMagnitude]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gaFYn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As can be seen there's a &lt;strong&gt;full equality&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-07-12T10:26:03.323" LastActivityDate="2014-07-12T10:26:03.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17294" PostTypeId="1" AcceptedAnswerId="17334" CreationDate="2014-07-11T07:55:21.810" Score="2" ViewCount="1974" Body="&lt;p&gt;I want to compare the performance of SIFT and SURF against some standard image set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a bit of research, I found that ROC curves are one of the best ways to do this task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to plot ROC curve TP rate and FP rate are needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output of SIFT and SURF are detected keypoints. How exactly can I generate ROC curves from those keypoints ?&lt;/p&gt;&#xA;" OwnerUserId="10465" LastActivityDate="2014-07-14T00:04:32.347" Title="Using ROC curves for comparing the performance of SIFT and SURF" Tags="|image-processing|opencv|sift|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17295" PostTypeId="2" ParentId="17292" CreationDate="2014-07-11T08:02:37.053" Score="4" Body="&lt;p&gt;Just change the code to the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = randn(1,1000);&#xA;h = [1 2 3 4 5];&#xA;y = conv(x,h);&#xA;plot((abs(fft(h,1024))).*(abs(fft(x,1024)))); % It's |H(w)||X(w)|&#xA;hold on&#xA;plot(abs(fft(y,1024)),'--r')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By mistake you raised the DFT of an impulse response to the second power. You could see that magnitudes are bit off, but peaks and valleys are more-less at the same point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cnsj9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally I've noticed in my MATLAB 2014a, that you get an error after running your original code. That's because vector &lt;code&gt;x&lt;/code&gt; was a row vector, and &lt;code&gt;y&lt;/code&gt; a column one. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This part is to answer &lt;strong&gt;Drazick&lt;/strong&gt;, claiming that this approach will produce some errors (already present in my solution). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In @jojek code there is no equality since he neglected the phase by&#xA;  applying the abs operator on both signals before the multiplication&#xA;  (As opposed to the Convolution Theorem).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If the filter had a more harsh phase his result would have much bigger&#xA;  error.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;First of all please read my MATLAB code, maybe you will notice &lt;code&gt;--r&lt;/code&gt; switch in second plot function. I intentionally used a dashed line, otherwise we would have just red plot and no blue at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But let's cut to the chase. Code is now slightly modified, as random signal is being filtered by long filter with random coefficients. This is what we get for comparison of $|H(\omega)X(\omega)|$ and $|H(\omega)||X(\omega)|$ with convolution in time domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MWGc8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's zoom in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7SlJC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all three are equal. Also script provides maximum difference between two methods to be around $10^{-13}$. Below script to reproduce the results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc, close all&#xA;x = randn(1,1000);&#xA;h = randn(1,200); % some crazy filter&#xA;y = conv(x,h);&#xA;N = length(y);&#xA;&#xA;Y =  abs(fft(h,N)).*abs(fft(x,N)); % |H(w)||X(w)|&#xA;YY = abs(fft(h,N).*fft(x,N));      % |H(w)X(w)|&#xA;&#xA;plot(YY,'go'); &#xA;hold on&#xA;plot(Y,'b')    &#xA;plot(abs(fft(y,N)),'--r')&#xA;grid on&#xA;legend({'|H(w)X(w)|','|H(w)||X(w)|','conv'})&#xA;&#xA;display(sprintf('Max error: %e', max(abs(YY-Y))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-09-06T09:36:55.087" LastActivityDate="2014-09-06T09:36:55.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17296" PostTypeId="1" AcceptedAnswerId="17311" CreationDate="2014-07-11T08:16:29.533" Score="2" ViewCount="588" Body="&lt;p&gt;I am trying to make a panadapter for a software defined radio and I am a little bit stuck and hope someone can help me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an I Q signal from my radio. (Actually I am using an IQ wav file from the internet recorded at 44800 2 channels 16bit). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use HDSDR the spectrum looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MXVUB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The display from my app looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cY2Rq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing something wrong and I do not know exactly what (I am new to this and I am not very sure I completly understand the concept behind...) I will try to describe what I am doing and hope you can help me fix it&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I open the file and start reading from it in a byte buffer (1024 bytes at a time)&lt;/li&gt;&#xA;&lt;li&gt;I convert every 2 bytes into shorts (ByteOrder.LITTLE_ENDIAN)&lt;/li&gt;&#xA;&lt;li&gt;I apply HanningWindow to the buffer&lt;/li&gt;&#xA;&lt;li&gt;I split the buffer in 2 buffers each for a channel (the %2==0 as&#xA;left and %2==1 right )&lt;/li&gt;&#xA;&lt;li&gt;I create and array of Complex numbers considering the left[i] as the&#xA;real part &amp;amp; right[i] as imag part&lt;/li&gt;&#xA;&lt;li&gt;I do FFT on the complex array (wavenumber table with size 512)&lt;/li&gt;&#xA;&lt;li&gt;I do an FFT shift (from [1,2,..,n/2,n/2+1,..,n-1,n] to [n,n-1,..,n/2+1,1,2,..,n/2] )&lt;/li&gt;&#xA;&lt;li&gt;I plot the result&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Do I need to process the IQ signal before somehow (demodulate it ?) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am reading in a wrong way the file? (I know that the file is starting with header &amp;amp; everything but after that the data part starts)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do a pitch /amplitude correction to remove the unwanted image existing in a not ideal IQ recorded by soundcard?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&#xA;Bogdan&lt;/p&gt;&#xA;" OwnerUserId="10464" LastActivityDate="2019-12-08T21:27:57.803" Title="Software defined radio panadapter" Tags="|fft|quadrature|software-defined-radio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17297" PostTypeId="1" CreationDate="2014-07-11T10:11:01.887" Score="3" ViewCount="3411" Body="&lt;p&gt;How to recover the carrier of a PSK signal that has high modulation index (eg. 750 symbols per second at carrier frequency 1500 Hz)?  I guess that a PLL will not be able to lock onto it with such frequent phase transitions. Maybe upconverting or frequency multiplication of the signal before the PLL is the solution?&lt;/p&gt;&#xA;" OwnerUserId="10454" LastEditorUserId="10454" LastEditDate="2014-07-11T11:55:58.713" LastActivityDate="2020-09-15T18:24:29.550" Title="High modulation index PSK - carrier recovery" Tags="|bpsk|pll|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17298" PostTypeId="1" CreationDate="2014-07-11T10:51:29.197" Score="0" ViewCount="5666" Body="&lt;p&gt;I am using the FFT to calculate the amplitude and phase of AC cos signal. Regarding amplitude it gives me an accurate result but I get wrong result for a phase: 6 degrees instead of 36 degrees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My MATLAB code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=3840;                 % sampling frequency&#xA;N=64;                    % number of sample&#xA;f=60;                    % signal frequency in hz&#xA;w=2*pi*f;&#xA;amp=220;                 % ampitude of signal   &#xA;delt=[1:N]*2*pi/N;       % sampling time interval&#xA;noise=randn(size(delt)); % added noise&#xA;&#xA;sig=zeros(size(delt));&#xA;for i=1:1:length(delt)&#xA;    sig(i)=noise(i)+amp*cos(w*delt(i)+pi/5);&#xA;end&#xA;&#xA;FF=fft(sig,N);&#xA;stem(abs(FF))&#xA;grid on&#xA;&#xA;REAL=real(FF);&#xA;SUM_REAL=sum(REAL)&#xA;IMAG=abs(imag(FF));&#xA;SUM_IMAG=sum(IMAG)&#xA;&#xA;% *******************************PHASOR REPRESENTATION*******************&#xA;&#xA;real_amp=sqrt(SUM_REAL)                  % Amplitude of real part&#xA;imag_amp=sqrt(SUM_IMAG)                  % Amplitude of imaginary part&#xA;sumation=real_amp+imag_amp;&#xA;amplitude_nominal=sqrt(sumation)/N&#xA;phase=atan(abs(imag(FF))/abs(real(FF))) % phase in radians&#xA;PHI=abs(phase)*180/pi                   % phase angle in degrees&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10467" LastEditorUserId="8202" LastEditDate="2014-07-11T17:33:48.417" LastActivityDate="2020-08-25T09:00:40.080" Title="Finding phase angle via FFT" Tags="|matlab|fft|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17300" PostTypeId="1" AcceptedAnswerId="17301" CreationDate="2014-07-11T12:08:02.750" Score="1" ViewCount="3023" Body="&lt;p&gt;In framing of audio samples' in audio feature extraction, what is need of &lt;strong&gt;&lt;em&gt;frame shift&lt;/em&gt;&lt;/strong&gt; while giving frame size?? &#xA;i.e. frame size  = 20ms,&#xA;     &lt;strong&gt;&lt;em&gt;frame shift&lt;/em&gt;&lt;/strong&gt; = 10ms.&#xA;Rather then shifting/overlapping why can't we use continuous frames then of overlapped??&lt;/p&gt;&#xA;" OwnerUserId="10401" LastActivityDate="2014-07-11T12:25:08.867" Title="In framing of audio samples', what is need of frame shift while giving frame size??" Tags="|speech-recognition|speech-processing|speech-synthesis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17301" PostTypeId="2" ParentId="17300" CreationDate="2014-07-11T12:25:08.867" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;By performing the windowing with overlap we are artificially increasing our time resolution (larger granularity of features in time). This is especially useful when frame duration is long (bad time resolution, very good frequency resolution), thus yielding kind of extra 'time resolution'.&lt;/li&gt;&#xA;&lt;li&gt;Usually no one is using the rectangular window, but other types such as Hamming, Hann, etc. As you probably know, windows tend to zero samples at both of their ends. By doing data you are kind of loosing some data. Let's imagine that you have some very short event you want to detect, at point where two windows are joined. If there is no overlap, then these samples will be almost removed. But if you perform 50% of overlap, there will be another window, right in the centre, and you won't lose anything. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-07-11T12:25:08.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17302" PostTypeId="1" AcceptedAnswerId="17304" CreationDate="2014-07-11T13:09:50.963" Score="1" ViewCount="2142" Body="&lt;p&gt;I've already asked this question on SO, but didn't get an answer, I tqake a shot here.&#xA;I am trying to get the PSD of a real data set by making use of  &lt;code&gt;fftw3&lt;/code&gt; library&#xA;To test I wrote a small program as shown below ,that generates the  a signal which follows sinusoidal function&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;#define PI 3.14&#xA;&#xA;int main (){&#xA;    double  value= 0.0;&#xA;    float frequency = 5;&#xA;    float  length = 2;&#xA;    int index = 4;&#xA;    double i = 0 ; &#xA;    double time = 0.0;&#xA;    FILE* outputFile = NULL;&#xA;    outputFile = fopen(&amp;quot;sinvalues&amp;quot;,&amp;quot;wb&amp;quot;);&#xA;    if(outputFile==NULL){&#xA;        printf(&amp;quot; couldn't open the file \n&amp;quot;);&#xA;        return -1;&#xA;    }&#xA;&#xA;    for (i = 0; i&amp;lt;=5000;i++){&#xA;        &#xA;        value =  sin(2*PI*frequency*zeit);&#xA;        fwrite(&amp;amp;value,sizeof(double),1,outputFile);&#xA;        zeit += (1.0/frequency);&#xA;    }&#xA;    fclose(outputFile);&#xA;    return 0;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now I'm reading the output file of above program and trying to calculate its PSD like as shown below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;fftw3.h&amp;gt;&#xA;#include &amp;lt;complex.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;#define PI 3.14&#xA;int main (){&#xA;    FILE* inp = NULL;&#xA;    FILE* oup = NULL;&#xA;    double* value;// = 0.0;&#xA;    double* result;&#xA;    double spectr = 0.0 ;&#xA;    int windowsSize =512;&#xA;    double  power_spectrum = 0.0;&#xA;    fftw_plan plan;&#xA;&#xA;    int index=0,i ,k;&#xA;    double multiplier =0.0;&#xA;    inp = fopen(&amp;quot;1&amp;quot;,&amp;quot;rb&amp;quot;);&#xA;    oup = fopen(&amp;quot;psd&amp;quot;,&amp;quot;wb+&amp;quot;);&#xA;&#xA;    value=(double*)malloc(sizeof(double)*windowsSize);&#xA;    result = (double*)malloc(sizeof(double)*(windowsSize)); // what is the length that I have to choose here ? &#xA;        plan =fftw_plan_r2r_1d(windowsSize,value,result,FFTW_R2HC,FFTW_ESTIMATE);&#xA;&#xA;    while(!feof(inp)){&#xA;        &#xA;        index =fread(value,sizeof(double),windowsSize,inp);&#xA;            // zero padding &#xA;        if( index != windowsSize){&#xA;            for(i=index;i&amp;lt;windowsSize;i++){&#xA;                    value[i] = 0.0;&#xA;                        }&#xA;&#xA;        }&#xA;        &#xA;&#xA;        // windowing  Hann &#xA;           &#xA;        for (i=0; i&amp;lt;windowsSize; i++){&#xA;            multiplier = 0.5*(1-cos(2*PI*i/(windowsSize-1)));&#xA;            value[i] *= multiplier;&#xA;        }&#xA;&#xA;        &#xA;        fftw_execute(plan);&#xA;&#xA;        &#xA;        for(i = 0;i&amp;lt;(windowsSize/2 +1) ;i++){ //why only tell the half size of the window&#xA;            power_spectrum = result[i]*result[i] +result[windowsSize/2 +1 -i]*result[windowsSize/2 +1 -i];&#xA;            printf(&amp;quot;%lf \t\t\t %d \n&amp;quot;,power_spectrum,i);&#xA;            fprintf(oup,&amp;quot; %lf \n &amp;quot;,power_spectrum);&#xA;        }&#xA;        &#xA;    }&#xA;    fclose(oup);&#xA;    fclose(inp);&#xA;    return 0;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Iam not sure about the correctness of the way I am doing this, but below are the results i have obtained:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5VBKI.png&quot; alt=&quot;PSD&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can any one help me in tracing the errors of the above approach&lt;/p&gt;&#xA;&lt;p&gt;and the input data look like :&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/penpP.png&quot; alt=&quot;sinus&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-07-31T10:55:32.220" Title="Calculating the Power spectral density" Tags="|fft|c|power-spectral-density|" AnswerCount="1" CommentCount="3" ClosedDate="2016-08-01T15:48:40.610" ContentLicense="CC BY-SA 3.0" />
  <row Id="17303" PostTypeId="1" CreationDate="2014-07-11T13:19:48.937" Score="4" ViewCount="1916" Body="&lt;p&gt;There are many descriptions of how to turn a 2D image into a 3D one, however I want to do the opposite, in particular to a ball. As an example, consider the following ball:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DOX7f.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If only the (relatively) slow change in intensity due to the light could be removed, the ball would look 2D. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first approach was to try get a low frequency version of the original, and divide through by that image. A simple way to do that is to blur the image. Here is a sample result using that approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jUNy4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does the job of flattening the light, but there are some problems:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is a light 'halo' around sharp edges.&lt;/li&gt;&#xA;&lt;li&gt;Large flat patches (e.g. the black patches) lose their uniformity in the middle.&lt;/li&gt;&#xA;&lt;li&gt;The edges of the ball are affected by the background during the blurring (there's a dark ring around the ball, particularly noticeable at the bottom right corner).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've tried mucking about with filters (e.g. bilinear) but haven't really found anything that works. I've also tried to use wavelets (a frequency based approach makes sense to me), but those approaches tended to distort the fine detail, which is very important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to do this are greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="7911" LastEditorUserId="7911" LastEditDate="2014-07-13T15:27:20.957" LastActivityDate="2014-07-24T19:04:55.140" Title="Image Processing: Flatten a 3D Ball" Tags="|image-processing|python|adaptive-filters|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17304" PostTypeId="2" ParentId="17302" CreationDate="2014-07-11T13:53:10.383" Score="0" Body="&lt;p&gt;Well, first of all you should note that you are taking batches of 512 samples. It basically means that the first FFT will perform a transform of the first 512 samples, slightly more than a quarter of a period, assuming that signal is periodic. (The windowing tries to compensate for this to some extent.) However, the information from that signal is not really what brings you any information about the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I haven't read the code, I suggest that you try one of these things (maybe both):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Increase the signal frequency&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Increase the window length&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Ideally, there should be at least one full period of the sinusoidal in the window if you want to interpret the result in a straightforward way.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2014-07-11T15:49:53.220" LastActivityDate="2014-07-11T15:49:53.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17306" PostTypeId="2" ParentId="17288" CreationDate="2014-07-11T15:46:01.833" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this a good filter for my task, or would you recommend something else?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It might be given that you do not need to get rid of any other noise/signal in that band. The advantage will be the lack of multiplications and therefore most likely fewer cycles in your implementation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Should I just send the latest sample, or perhaps take the average of all samples between two &quot;PC sample points&quot;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Taking the average is just like using another moving average filter, so this may or may not be a good idea. It is easily analyzed in a similar way. Given that your signal is &quot;good enough&quot; to downsample, filtering again will, while removing a bit of noise, primarily mess up with the passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is worth noting though that it may be worthwhile to use a so called polyphase decomposition. You do not really want to spend time computing intermediate samples which are not transferred to the PC anyway. Hence, you do in fact have quite a bit more cycles per sample. The straightforward way to go about this to use an (or several) FIR filter. In the case of several compute the convolution of all. Only apply the filter such that it computes exactly the output you want. If you go with this approach you might just as well design a single FIR filter using general multipliers (since the convolution of the moving average filters will have general coefficients anyway).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you have the signal package for Octave (and that the call is identical to Matlab), you can try something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=1000&#xA;fn = fs/2 % To simplify things&#xA;delta = 3 % range in Hz around the power line frequencies, should be less than 5...&#xA;eps = 1e-7 % Some small number....&#xA;N = 50 % Filter order&#xA;W = 10 % How much more you'd like to attenuate the power compared to generic noise&#xA;&#xA;h = firpm(N, [0 5 (50-delta) (50+delta) (50+delta+eps) (60-delta-eps)  (60-delta)  (60+delta) (60+delta+eps) fn]/fn,[1 1 0 0 0 0 0 0 0 0], [1 W 1 W 1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The lesser you pick delta, the more likely that you will get a notch exactly where you want it...&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-07-11T15:46:01.833" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17307" PostTypeId="1" AcceptedAnswerId="17309" CreationDate="2014-07-11T18:24:23.917" Score="3" ViewCount="3691" Body="&lt;p&gt;I'm currently studying the Z-transform, and I'm having issues in understanding the time shift and differentiation properties, to be precise: calculating a Z-transform explicitly, and obtaining it by using those properties yields different results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a common Z-transform is the transform of the discrete unit step function:&#xA;$$&#xA;\mathcal{Z}\left\{ u\left[n\right]\right\} =\frac{1}{1-z^{-1}}=\frac{z}{z-1}&#xA;$$&#xA;The time shifting property of the Z-transform states (leaving aside its effects on the ROC for the moment) that $\mathcal{Z}\left\{ x\left[n-k\right]\right\} =z^{-k}\mathcal{Z}\left\{ x\left[n\right]\right\} \quad\forall k\in\mathbb{Z}&#xA; $, thus it implies that:&#xA;$$&#xA;\mathcal{Z}\left\{ u\left[n-1\right]\right\} =z^{-1}\frac{z}{z-1}=\frac{1}{z-1}&#xA; $$&#xA;Since $\frac{d}{dz}\frac{1}{z-1}=\frac{1}{\left(z-1\right)^{2}}$, the differentiation property, which states that $\mathcal{Z}\left\{ n\, x\left[n\right]\right\} =-z\frac{d\mathcal{Z}\left\{ x\left[n\right]\right\} }{dz}$ gives:&#xA;$$&#xA;\mathcal{Z}\left\{ n\, u\left[n-1\right]\right\} =-z\frac{1}{\left(z-1\right)^{2}}=-\frac{z^{-1}}{\left(1-z^{-1}\right)^{2}}&#xA;$$&#xA;which appears to be wrong, since the correct result should be:&#xA;$$&#xA;\mathcal{Z}\left\{ n\, u\left[n\right]\right\} =\frac{z^{-1}}{\left(1-z^{-1}\right)^{2}}&#xA;$$&#xA;What am I doing wrong? Is there perhaps any case in which those properties cannot be applied?&lt;/p&gt;&#xA;" OwnerUserId="10471" LastActivityDate="2014-07-11T18:55:04.190" Title="Are Z-transform time shifting and differentiation properties always compatible?" Tags="|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17308" PostTypeId="2" ParentId="17307" CreationDate="2014-07-11T18:54:40.277" Score="1" Body="&lt;p&gt;Note that $$\frac{d}{dz} \frac{1}{z-1} = -\frac{1}{(z-1)^2}$$ (emphasis on the negative sign on the right-hand side of the equation). I think you missed the negative sign in your above derivation, which would account for the difference in the two results that you got to.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-07-11T18:54:40.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17309" PostTypeId="2" ParentId="17307" CreationDate="2014-07-11T18:55:04.190" Score="2" Body="&lt;p&gt;First&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{d}{dz}\frac{1}{z-1}=-\frac{1}{(z-1)^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(with a minus sign in front). So you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{Z}\{nu[n-1]\}=z\frac{1}{(z-1)^2}=\frac{z^{-1}}{(1-z^{-1})^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now everything is OK because&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$nu[n-1]=nu[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because for $n=0$ also the right-hand side vanishes, and for $n&amp;gt;0$ both are equal anyway.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-11T18:55:04.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17310" PostTypeId="1" CreationDate="2014-07-11T20:39:05.280" Score="3" ViewCount="281" Body="&lt;p&gt;I have random variables $X_1, X_2, \cdots, X_m $, which can take $n$ values and is distributed iid according to $\Theta=(\theta_1, \theta_2, \cdots, \theta_n)$. That is $X_k$ can take values $\{1,2,\cdots,n\}$ and $P(X_k=i)=\theta_i, \ 1\leq k \leq m, \ 1 \leq i \leq n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I observe a random variables $Y_1, Y_2, \cdots, Y_m$, where I have that $P(Y_k=j|X_k=i)=c_{j,i}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $C$ be the matrix $[C_{j,i}]_{1\leq j,i \leq n}$. I have that $C$ is a full rank matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get an ML estimate of $\Theta$, from observations $Y_1, Y_2, \cdots, Y_m$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\Psi=(\psi_1,\cdots, \psi_n)$, where ${\psi}_i=P(Y_k=i)$. The ML estimate of  $\Psi$ is clearly the vector of empirical frequencies. That is, we have the ML estimate of $\psi_i$, is $\hat{\psi}_i = \sum_{\ell=1}^{k} I(Y_{\ell}=i)$, where $I$ is an indicator function. Let us call this $\hat{\Psi}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to know if the ML estimate of $\Theta$, $\hat{\Theta}= C^{-1}\hat{\Psi}$. I can prove it if $n=2$, but do not seem to be able to show this for a general $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to put this is that I have a discrete memory-less source, which has a support of $\{ 1,2, \cdots, n\}$. I can observe this though a discrete memoryless channel, with transition probability matrix $C$. I want to estimate the source symbol probabilities. An ML estimate the observed symbol probabilities can be easily derived to be the empirical frequencies. I wanted to know if it can be shown that the ML estimate of the source symbol probabilities is $C^{-1}$ times the ML estimate of the observed symbol probabilities.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="128" LastEditDate="2018-07-25T04:01:50.543" LastActivityDate="2018-07-25T04:01:50.543" Title="Maximum Likelihood Through a Noisy Channel" Tags="|estimation|parameter-estimation|maximum-likelihood-estimation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17311" PostTypeId="2" ParentId="17296" CreationDate="2014-07-11T21:20:52.023" Score="0" Body="&lt;p&gt;There are a number of things that could be going wrong; you haven't provided enough information to definitively diagnose your the problem. (A link to the wav file you obtained would be useful, so we can try it out ourselves.) Here are some observations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You're &lt;em&gt;assuming&lt;/em&gt; the file is uncompressed 16-bit little-endian samples, and ignoring the presence of the header. This could be wrong, either because the format is not what you think, or the header is not a multiple of 4 bytes long. Instead, use an audio-editing program such as &lt;a href=&quot;http://audacity.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;Audacity&lt;/a&gt; to read the file and write it out again as a raw file where you have &lt;em&gt;specified&lt;/em&gt; the parameters. That, or use a WAV-reading library in your program.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your lengths don't match up. If you read 1024 bytes, then you have 512 shorts, or 256 complex-shorts — but you say your FFT size is 512, not 256. Either your program is not as you say or it might be reading uninitialized memory.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your output appears to have &lt;em&gt;four&lt;/em&gt; almost-copies of the spectrum. Two mirrored copies are explainable if you are misreading the input such that the I and Q components are not aligned properly — a symmetric spectrum is to be expected if one of I or Q is zero, constant, or otherwise not properly aligned with the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other copy might be due to an error in your FFT shift code or graphics code, or because you are trying to display both components of the complex FFT output separately rather than taking the magnitude.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I would suggest adjusting the scaling of your color shading so that it is more similar to the HDSDR output, and increasing the FFT size (bin count). (You may also need to take the log of the magnitude.) This will make the result look more like HDSDR's, which will help you match up parts of the spectrum.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Do I need to process the IQ signal before somehow (demodulate it ?)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. The sorts of processing that could be done to refine a panadapter display would be done &lt;em&gt;after&lt;/em&gt; the FFT. The only things to do before would be things like IQ imbalance correction, which are just as appropriate for a signal being demodulated and played as audio (or whatever sort of information) as one going to the panadapter.&lt;/p&gt;&#xA;" OwnerUserId="4655" LastEditorUserId="4655" LastEditDate="2014-07-11T23:51:50.453" LastActivityDate="2014-07-11T23:51:50.453" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17313" PostTypeId="2" ParentId="17289" CreationDate="2014-07-12T04:41:05.253" Score="2" Body="&lt;p&gt;Referencing the paper, the convolution kernel can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ot9uF.gif&quot; alt=&quot;eqn1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$d(|y-x|)$ is the Euclidean distance between the centre pixel $y$ and a location in the kernel $x$.  $\alpha$ is used to ensure that the entire area under the kernel is 1.  However, you did not specify how &lt;strong&gt;big&lt;/strong&gt; this kernel is.  As such, we will specify the rows and columns of this kernel to be &lt;code&gt;M&lt;/code&gt; and &lt;code&gt;N&lt;/code&gt; respectively.  Let's also assume that the size of the kernel for each dimension is &lt;strong&gt;odd&lt;/strong&gt;.  The reason why is because the shape of the kernel will be an even square and makes implementation easier.  As such, here are the steps that I would perform to do this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Define a grid of &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;Y&lt;/code&gt; co-ordinates, and ensure that the centre pixel is at 0.&lt;/li&gt;&#xA;&lt;li&gt;Compute each term in the convolution kernel &lt;strong&gt;without&lt;/strong&gt; the $\alpha$ term.&lt;/li&gt;&#xA;&lt;li&gt;Sum up all of the terms in the kernel, then divide every value in this kernel by this term so that the entire area of the kernel is 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Let's do this step by step:&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Step #1&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;We can do this by using &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/meshgrid.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;meshgrid&lt;/code&gt;&lt;/a&gt;.  &lt;code&gt;meshgrid&lt;/code&gt; (in this case) creates a 2D grid of &lt;code&gt;(X,Y)&lt;/code&gt; co-ordinates.  &lt;code&gt;X&lt;/code&gt; defines the horizontal co-ordinate for each location in &lt;code&gt;X&lt;/code&gt;, while &lt;code&gt;Y&lt;/code&gt; defines this vertically. By calling &lt;code&gt;meshgrid(1:m, 1:n)&lt;/code&gt;, I am creating a &lt;code&gt;n x m&lt;/code&gt; grid for both &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;Y&lt;/code&gt;, where each row of &lt;code&gt;X&lt;/code&gt; progresses from 1 to &lt;code&gt;m&lt;/code&gt;, while each column of &lt;code&gt;Y&lt;/code&gt; progresses from 1 to &lt;code&gt;n&lt;/code&gt;.  Therefore, these will both be &lt;code&gt;n x m&lt;/code&gt; matrices.  Calling the above with &lt;code&gt;m = 4&lt;/code&gt; and &lt;code&gt;n = 4&lt;/code&gt; computes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m = 4;&#xA;n = 4;&#xA;[X,Y] = meshgrid(1:m, 1:n)&#xA;&#xA;X =&#xA;&#xA; 1     2     3     4&#xA; 1     2     3     4&#xA; 1     2     3     4&#xA; 1     2     3     4&#xA;&#xA;Y =&#xA;&#xA; 1     1     1     1&#xA; 2     2     2     2&#xA; 3     3     3     3&#xA; 4     4     4     4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As such, we simply have to modify this, but we ensure that the middle is at &lt;code&gt;(0,0)&lt;/code&gt;, and also ensure that the size of &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;Y&lt;/code&gt; are odd.  Let's say that &lt;code&gt;M = 5&lt;/code&gt; and &lt;code&gt;N = 5&lt;/code&gt;.  We can then define our &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;Y&lt;/code&gt; co-ordinates like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = 5;&#xA;N = 5;&#xA;[X,Y] = meshgrid(-floor(N/2):floor(N/2), -floor(M/2):floor(M/2))&#xA;&#xA;X =&#xA;&#xA;-2    -1     0     1     2&#xA;-2    -1     0     1     2&#xA;-2    -1     0     1     2&#xA;-2    -1     0     1     2&#xA;-2    -1     0     1     2&#xA;&#xA;&#xA;Y =&#xA;&#xA;-2    -2    -2    -2    -2&#xA;-1    -1    -1    -1    -1&#xA; 0     0     0     0     0&#xA; 1     1     1     1     1&#xA; 2     2     2     2     2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see here, the centre pixel for both &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;Y&lt;/code&gt; are defined as &lt;code&gt;(0,0)&lt;/code&gt;.  Everywhere else has its &lt;code&gt;(X,Y)&lt;/code&gt; co-ordinates defined &lt;strong&gt;with respect to the centre&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Step #2&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;We simply have to compute the Euclidean distance between the centre pixel to every point in the kernel.  This can be done by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dis = sqrt(X.^2 + Y.^2)&#xA;&#xA;dis =&#xA;&#xA;2.8284    2.2361    2.0000    2.2361    2.8284&#xA;2.2361    1.4142    1.0000    1.4142    2.2361&#xA;2.0000    1.0000         0    1.0000    2.0000&#xA;2.2361    1.4142    1.0000    1.4142    2.2361&#xA;2.8284    2.2361    2.0000    2.2361    2.8284&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing some quick calculation checks, you can see that this agrees with our understanding of Euclidean distance.  Moving to the left by 1 from the centre is a distance of 1.  Moving to the left by 1 then up by 1 gives us a Euclidean distance of $\sqrt{1^2 + 1^2} = \sqrt{2} = 1.4142$.  Doing similar checks with each element will demonstrate that this is indeed a Euclidean distance field from the centre pixel.  After we do this, let's compute the kernel terms &lt;strong&gt;without&lt;/strong&gt; the $\alpha$ term.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;kern = 1 ./ (1 + dis)&#xA;&#xA;kern =&#xA;&#xA;0.2612    0.3090    0.3333    0.3090    0.2612&#xA;0.3090    0.4142    0.5000    0.4142    0.3090&#xA;0.3333    0.5000    1.0000    0.5000    0.3333&#xA;0.3090    0.4142    0.5000    0.4142    0.3090&#xA;0.2612    0.3090    0.3333    0.3090    0.2612&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Step #3&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The last step we need is to normalize the mask so that the total sum of the kernel is 1.  This can simply be done by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;kernFinal = kern / sum(kern(:))&#xA;&#xA;kernFinal =&#xA;&#xA;0.0275    0.0325    0.0351    0.0325    0.0275&#xA;0.0325    0.0436    0.0526    0.0436    0.0325&#xA;0.0351    0.0526    0.1052    0.0526    0.0351&#xA;0.0325    0.0436    0.0526    0.0436    0.0325&#xA;0.0275    0.0325    0.0351    0.0325    0.0275&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should finally give you the correlation kernel that you are seeking.  You can now use this in convolution (i.e. using &lt;code&gt;imfilter&lt;/code&gt; or &lt;code&gt;conv2&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hopefully I have answered your question adequately.  Good luck!&lt;/p&gt;&#xA;" OwnerUserId="8480" LastEditorUserId="8480" LastEditDate="2014-07-12T07:55:48.580" LastActivityDate="2014-07-12T07:55:48.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17314" PostTypeId="2" ParentId="17269" CreationDate="2014-07-12T05:37:20.687" Score="6" Body="&lt;p&gt;You could also approximate the square root function by using &lt;a href=&quot;http://en.wikipedia.org/wiki/Newton%27s_method&quot; rel=&quot;noreferrer&quot;&gt;Newton's Method&lt;/a&gt;.  Newton's Method is a way of approximating where the roots of a function are.  It is also an &lt;strong&gt;iterative&lt;/strong&gt; method where the result from the previous iteration is used in the next iteration until convergence.  The equation for Newton's method to guess where the root is of a function $f(x)$ given an initial guess $x_0$ is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_1 = x_0 - \frac{f(x_0)}{f'(x_0)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_1$ is the first guess of where the root is located.  We keep recycling the equation and using results from previous iterations until the answer doesn't change.  In general, to determine the guess of the root at the $(n+1)$ iteration, given the guess at the $n$ iteration is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use Newton's method to approximate for the square root, suppose that we are given a number $a$.  As such, to compute the square root, we need to compute $\sqrt{a}$  As such, we seek to find an answer such that $x = \sqrt{a}$.  Square both sides, and moving $a$ to the other side of the equation yields $x^2 - a = 0$.  As such, the answer to this equation is $\sqrt{a}$ and is thus the &lt;strong&gt;root&lt;/strong&gt; of the function.  As such, let $f(x) = x^2 - a$ be the equation we want to find the root of.  By substituting this into Newton's method, $f'(x) = 2x$, and therefore:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_{n+1} = x_n - \frac{x_{n}^2 - a}{2x_{n}}$$&#xA;$$x_{n+1} = \frac{1}{2}\left(x_n + \frac{a}{x_n}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, to compute the square root of $a$, we simply need to compute Newton's method until we converge.  However, as noted by @robertbristow-johnson, division is a very expensive operation - especially for microcontrollers / DSPs with limited resources.  In addition, there may be a case where a guess may be 0, which would result in a divide by 0 error due to the division operation.  As such, what we can do is use Newton's method and solve for the &lt;strong&gt;reciprocal&lt;/strong&gt; function instead, i.e. $\frac{1}{x} = \sqrt{a}$.  This also avoids any division, as we will see later.  Squaring both sides, and moving $\sqrt{a}$ over to the left hand side thus gives $\frac{1}{x^2} - a = 0$.  Therefore, the solution to this would be $\frac{1}{\sqrt{a}}$.  By multiplying by $a$, we would get our intended result.  Again, using Newton's method, we thus have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_{n+1} = x_{n} - \frac{f(x_n)}{f'(x_n)}$$&#xA;$$x_{n+1} = x_{n} - \frac{\frac{1}{(x_n)^2} - a}{\frac{-2}{(x_n)^3}}$$&#xA;$$x_{n+1} = \frac{1}{2}\left(3x_n - (x_n)^3a\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is a warning that we should consider when looking at the above equation.  For square roots, the solution should be positive and so in order for the iterations (and the result) to be positive, the following condition must be satisfied:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$3x_n - (x_n)^3a &amp;gt; 0$$&#xA;$$3x_n &amp;gt; (x_n)^3a$$&#xA;$$(x_n)^2a &amp;lt; 3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(x_0)^2a &amp;lt; 3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, given the number we wish to compute the square root of, the initial guess &lt;strong&gt;must&lt;/strong&gt; satisfy the above condition.  As this is going to ultimately be placed on a microcontroller, we could start with any value of $x_0$ (say 1), then keep looping and decreasing the value of $x_0$ until the above condition is satisfied.  Note that I avoided doing division to directly compute what the value of $x_0$ should be as division is an expensive operation.  Once we have our initial guess, iterate through Newton's method.  Note that depending on the initial guess, it may take a shorter or longer amount of time to converge.  It all depends on how close you are to the actual answer.  You can either cap the number of iterations, or wait until the relative difference between the two roots is less than some threshold (like $10^{-6}$ or so).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As your tag is looking for an algorithm in &lt;code&gt;C&lt;/code&gt;, let's write one very quickly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt; // For printf&#xA;#include &amp;lt;math.h&amp;gt; // For fabs&#xA;void main() &#xA;{&#xA;   float a = 5.0; // Number we want to take the square root of&#xA;   float x = 1.0; // Initial guess&#xA;   float xprev; // Root for previous iteration&#xA;   int count; // Counter for iterations&#xA;&#xA;   // Find a better initial guess&#xA;   // Half at each step until condition is satisfied&#xA;   while (x*x*a &amp;gt;= 3.0)&#xA;       x *= 0.5;&#xA;&#xA;   printf(&quot;Initial guess: %f\n&quot;, x);&#xA;&#xA;   count = 1; &#xA;   do { &#xA;       xprev = x; // Save for previous iteration&#xA;       printf(&quot;Iteration #%d: %f\n&quot;, count++, x);                   &#xA;       x = 0.5*(3*xprev - (xprev*xprev*xprev)*a); // Find square root of the reciprocal&#xA;   } while (fabs(x - xprev) &amp;gt; 1e-6); &#xA;&#xA;   x *= a; // Actual answer - Multiply by a&#xA;   printf(&quot;Square root is: %f\n&quot;, x);&#xA;   printf(&quot;Done!&quot;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is a pretty basic implementation of Newton's method.  Note that I keep decreasing the initial guess by half until the condition we talked about earlier is satisfied.  I am also trying to find the square root of 5.  We know that this is roughly equal to 2.236 or so.  Using the above code gives the following output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Initial guess: 0.500000&#xA;Iteration #1: 0.500000&#xA;Iteration #2: 0.437500&#xA;Iteration #3: 0.446899&#xA;Iteration #4: 0.447213&#xA;Square root is: 2.236068&#xA;Done!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that Newton's method is finding the solution of the reciprocal solution and we multiply by $a$ at the end to get our final answer.  Also, take note that the initial guess was changed to ensure that the criteria I talked about above is satisfied. Just for fun, let's try finding the square root of 9876.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Initial guess: 0.015625&#xA;Iteration #1: 0.015625&#xA;Iteration #2: 0.004601&#xA;Iteration #3: 0.006420&#xA;Iteration #4: 0.008323&#xA;Iteration #5: 0.009638&#xA;Iteration #6: 0.010036&#xA;Iteration #7: 0.010062&#xA;Square root is: 99.378067&#xA;Done!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, the only thing that is different is &lt;strong&gt;how many iterations&lt;/strong&gt; are required to compute the square root.  The higher the number of what you want to compute, the more iterations it will take.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that this method has already been suggested in an earlier post, but I figured I'd derive the method as well as provide some code!&lt;/p&gt;&#xA;" OwnerUserId="8480" LastEditorUserId="8480" LastEditDate="2014-07-12T07:53:23.827" LastActivityDate="2014-07-12T07:53:23.827" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17315" PostTypeId="2" ParentId="17298" CreationDate="2014-07-12T08:16:14.887" Score="1" Body="&lt;p&gt;Since the length of your FFT is exactly one period of your sinusoidal input signal (N = Fs/F0) , the signal will appear in bin 1 (the one above DC) of the FFT result (the conjugate mirror is redundant for strictly real input).  To estimate the phase of the sinusoid of frequency F0, referenced to the start of the data window, just compute the atan2() of the signed imaginary and real components from that single complex bin 1.  No need to abs() components or sum or window or estimate the amplitude or examine any other bin.  Unless you want to sanity check the magnitude of bin 1 to make sure it isn't zero or just numerical noise.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-07-12T08:22:02.020" LastActivityDate="2014-07-12T08:22:02.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17317" PostTypeId="1" AcceptedAnswerId="17318" CreationDate="2014-07-12T10:46:58.870" Score="1" ViewCount="1227" Body="&lt;p&gt;What is best practice/algorithms  to remove static noise from speech ? static noise aka Stationary Signal/static noise due to &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1.humming sound due to of telephonic line/channel, &lt;/li&gt;&#xA;&lt;li&gt;2.moving Vehicle,or due to&lt;/li&gt;&#xA;&lt;li&gt;3.constant noise of fan or other nearby instrument .&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10401" LastActivityDate="2014-07-12T11:46:35.940" Title="What is best practice to remove static noise?" Tags="|noise|speech-recognition|speech-processing|signal-synthesis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17318" PostTypeId="2" ParentId="17317" CreationDate="2014-07-12T11:46:35.940" Score="4" Body="&lt;p&gt;The standard method to remove stationary noise is &lt;a href=&quot;http://www.cslu.ogi.edu/nsel/wan_manuscript/node10.html&quot; rel=&quot;nofollow&quot;&gt;spectral subtraction&lt;/a&gt;, where&#xA;the magnitudes of the short-time Fourier transform of the noisy signal are modified based on an SNR estimate in the respective frequency bin. The algorithm by Ephraim and Malah (see &lt;a href=&quot;http://www.cmap.polytechnique.fr/~bacry/MVA/EM.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;) and its variants are used a lot. Note that the basic principle of spectral subtraction is very simple, but that a lot of engineering is necessary to make it sound good. A very important ingredient is the noise/SNR-estimator.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-12T11:46:35.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17319" PostTypeId="1" CreationDate="2014-07-12T13:33:44.587" Score="1" ViewCount="947" Body="&lt;p&gt;I have a $512$ sample frame, lets call it &lt;code&gt;X&lt;/code&gt;. The frame is further divided into four sub-frames of $128$ samples each. Each of these sub-frames have a different frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For STFT, I use MATLAB's &lt;code&gt;gausswin(N)&lt;/code&gt; function where &lt;code&gt;N&lt;/code&gt; is equal to $128$ in my case to generate a Gaussian window, let's call it &lt;code&gt;W&lt;/code&gt;. I zero-pad my windows &lt;code&gt;W&lt;/code&gt; to make it equal to $512$ samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now multiply my original frame &lt;code&gt;X&lt;/code&gt; point by point with &lt;code&gt;W&lt;/code&gt; to get &lt;code&gt;y&lt;/code&gt;. I then take &lt;code&gt;FFT&lt;/code&gt; of &lt;code&gt;y&lt;/code&gt; to get &lt;code&gt;Y&lt;/code&gt;. It works till here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, naturally the next logical step should be to shift my zero-padded window &lt;code&gt;W&lt;/code&gt; to right by 128 samples and repeat the multiply and &lt;code&gt;FFT&lt;/code&gt; procedure again. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;But how do I accumulate these results? &lt;/li&gt;&#xA;&lt;li&gt;Concretely, how do I convert it into a time-frequency plot?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4142" LastEditorUserId="1629" LastEditDate="2016-07-26T20:14:08.440" LastActivityDate="2016-07-26T20:14:08.440" Title="Implementing short-time Fourier transform" Tags="|fft|stft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17320" PostTypeId="1" CreationDate="2014-07-12T13:48:06.087" Score="2" ViewCount="245" Body="&lt;p&gt;I don't understand what happened in my simulation.&#xA;I would like to perform a trade off between 2 ways to estimate power in frequency bands. I want to detect spurious frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First method:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I constructed a vector of noise and computed the periodogram without&#xA;  windowing. As example, for a vector length of 1048576 and a FFT length&#xA;  of 1024, I have reduced the noise variance by a factor of&#xA;  $\sqrt{1024}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second method:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I constructed a vector of noise and computed the periodogram without&#xA;  windowing. As example, for a vector length of 1048576 and a FFT length&#xA;  of 262144, I have reduce the noise variance by a factor of&#xA;  $\sqrt{16}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Between these 2 methods I can perform a lower peak detection with the first one (equal to the noise power in a bin). But if my peak have a large power; $26 \mathtt{dB}$ greater than my noise, many FFT bins shall be affected as in the second. But the frequency separation of the second method is better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a test mix of both methods. Add the 16 successive bins to reconstruct an equivalent periodogram of the first method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me, I've increased the noise variance because I've summed 16 &quot;normal&quot; ($\chi^2 $ in fact) law, but I've increased my spurious compare to the result of the first method.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact I've reduced my noise variance. It is the same as in the first method: $\sqrt{1024}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first reaction is to think I have made a mistake to consider law as independent, but how can I verify that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone can help me with any document reference or demonstration please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below an example in Scilab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nfft  = 1024;&#xA;nbPts = 1024*nfft;&#xA;nfft2 = 16*nfft;&#xA;&#xA;noise  =  (grand(1, nbPts, &quot;nor&quot;, 0, 1) +%i * grand(1, nbPts, &quot;nor&quot;, 0, 1))/sqrt(2);&#xA;&#xA;myfft = zeros(1,nfft);&#xA;myfft2 = zeros(1,nfft2);&#xA;&#xA;// perform 1st periodogram&#xA;for cnt=1:nbPts/nfft&#xA;    myfft = myfft + abs(fft(noise((cnt-1)*nfft+1:cnt*nfft))/nfft).^2; &#xA;end&#xA;&#xA;myfft = 10*log10(myfft/(nbPts/nfft));&#xA;&#xA;&#xA;// perform 2nd periodogram&#xA;for cnt=1:nbPts/nfft2&#xA;    myfft2 = myfft2 + abs(fft(noise((cnt-1)*nfft2+1:cnt*nfft2))/nfft2).^2; &#xA;end&#xA;&#xA;// sum it&#xA;fftsum = zeros(1,nfft);&#xA;for cnt=1:nfft,&#xA;    fftsum(cnt) = 10*log10(sum(myfft2((cnt-1)*nfft2/nfft+1:cnt*nfft2/nfft))/(nbPts/nfft2));&#xA;&#xA;end&#xA;&#xA;// visualization&#xA;figure(0)&#xA;set(gca(),&quot;auto_clear&quot;,&quot;on&quot;)&#xA;plot(1:nfft,myfft)&#xA;set(gca(),&quot;auto_clear&quot;,&quot;off&quot;)&#xA;plot(1:nfft,fftsum,'r')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="8202" LastEditDate="2014-07-14T09:33:42.880" LastActivityDate="2014-07-14T09:33:42.880" Title="Noise analysis with periodogram. problem with different resolutions" Tags="|fft|noise|power-spectral-density|bandwidth|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17321" PostTypeId="2" ParentId="17319" CreationDate="2014-07-12T14:31:01.017" Score="-1" Body="&lt;ol&gt;&#xA;&lt;li&gt;To make things easier, I suggest you to use MATLAB function&#xA;&lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ref/buffer.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;buffer&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Regarding storage of your results I recommend to save it into matrix with dimensions  &lt;code&gt;no_frames&lt;/code&gt; and $512$. So if your current frame index is &lt;code&gt;i&lt;/code&gt;, then do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;S(:,i) = spec;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;S&lt;/code&gt; is your output matrix and &lt;code&gt;spec&lt;/code&gt; is the spectrum calculated for a given frame. Please mind that the &lt;code&gt;S(:,i)&lt;/code&gt; will assign &lt;code&gt;spec&lt;/code&gt; as i'th column in resulting matrix. If you need to transpose results, then just do &lt;code&gt;S(i,:)&lt;/code&gt; or flip the spectrum by doing &lt;code&gt;spec'&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-07-12T14:31:01.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17322" PostTypeId="1" AcceptedAnswerId="17324" CreationDate="2014-07-12T16:03:43.800" Score="2" ViewCount="1140" Body="&lt;p&gt;I am new to the study of time series. Recently I have asked a question about the &lt;a href=&quot;https://dsp.stackexchange.com/questions/17205/covariance-between-real-and-imaginary-parts-of-fourier-transform-of-a-stationary&quot;&gt;covariance of real and imaginary part of a real(in time domain) stochastic time series &lt;/a&gt; and I have received an answer for it. The problem is that for continuous time series the variance of each point in frequency domain is infinite. I've been told there that its the reason that they use power spectrum. Now the confusion comes from the fact that I don't know whether power spectrum is time averaged or not? More precisely as wiki says:&#xA;$$S_{xx}(\omega)=\lim\limits_{T\to \infty}\mathbf{E} \left[ | \hat{x}_T(\omega) |^2 \right] = \lim\limits_{T\to \infty}\mathbf{E} \left[ \frac{1}{T} \int\limits_0^T x^*(t) e^{i\omega t}\, dt \int\limits_0^T x(t') e^{-i\omega t'}\, dt' \right] = \lim\limits_{T\to \infty}\frac{1}{T} \int\limits_0^T \int\limits_0^T \mathbf{E}\left[x^*(t) x(t')\right] e^{i\omega (t-t')}\, dt\, dt$$&#xA;OR&#xA;$$S_{xx}(\omega)=\mathbf{E} \left[ | \hat{x}_T(\omega) |^2 \right] = \mathbf{E} \left[  \int\limits_0^\infty x^*(t) e^{i\omega t}\, dt \int\limits_0^\infty x(t') e^{-i\omega t'}\, dt' \right] =  \int\limits_0^\infty \int\limits_0^\infty \mathbf{E}\left[x^*(t) x(t')\right] e^{i\omega (t-t')}\, dt\, dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example in Wiener-Khintchine theorem &lt;a href=&quot;https://en.wikipedia.org/wiki/Wiener%E2%80%93Khinchin_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;as far as I can see&lt;/a&gt; there is no time averaging:&#xA;$$r_{xx} (\tau) = \int_{-\infty}^\infty S_{xx}(f) e^{2\pi i\tau f} df$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And is there any difference when the signal is discrete?&lt;/p&gt;&#xA;" OwnerUserId="9065" LastEditorUserId="4298" LastEditDate="2018-12-19T10:56:27.530" LastActivityDate="2018-12-19T10:56:27.530" Title="Power Spectrum: Definition" Tags="|fourier-transform|frequency-spectrum|power-spectral-density|random-process|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17323" PostTypeId="2" ParentId="17319" CreationDate="2014-07-12T16:26:32.310" Score="2" Body="&lt;p&gt;admittedly, i have never used the &lt;code&gt;buffer()&lt;/code&gt; function in matlab.  for doing STFT analysis and processing, i have just broken it into frames myself with code similar to &lt;a href=&quot;https://dsp.stackexchange.com/questions/16549/how-to-apply-short-time-fourier-transform-to-code-in-matlab/16551#16551&quot;&gt;this answer&lt;/a&gt;.  it's easier to see what's going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while you can use a gaussian window for analysis (i found it mathematically useful in &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=969581&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, email me if you want a pdf copy), you must use a &lt;em&gt;complementary&lt;/em&gt; window, one that adds to 1 with the windows of its adjacent frames, for the reconstruction of the signal.  at least if you want this to pass the signal unchanged when the processing is set to &quot;null&quot;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-07-12T16:26:32.310" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17324" PostTypeId="2" ParentId="17322" CreationDate="2014-07-12T21:18:11.963" Score="3" Body="&lt;p&gt;The first definition of the power spectrum is the correct one (at least for causal signals, otherwise you need symmetrical integration limits). The second one assumes that the Fourier transform of $x(t)$ exists, which is generally not the case for random signals. The fact that the power spectrum and the autocorrelation function form a Fourier transform pair is no contradiction with the first definition of the power spectrum. This can be shown as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_x(\omega)=\lim_{T\rightarrow\infty}E\left\{ \frac{1}{T}\left| \int_{-T/2}^{T/2}x(t)e^{-j\omega t}dt \right|^2 \right\}=\\=&#xA;\lim_{T\rightarrow\infty}E\left\{ \frac{1}{T} \int_{-T/2}^{T/2}x^*(t)e^{j\omega t}dt \int_{-T/2}^{T/2}x(t')e^{-j\omega t'}dt'  \right\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse Fourier transform of the power spectrum $S_x(\omega)$ should equal the autocorrelation function $R_x(\tau)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}^{-1}\{S_x(\omega)\}=\frac{1}{2\pi}\int_{-\infty}^{\infty}S_x(\omega)e^{j\omega \tau}d\omega=\\=&#xA;\lim_{T\rightarrow\infty}E\left\{ \frac{1}{2\pi T} \int_{-\infty}^{\infty}\int_{-T/2}^{T/2}x^*(t)e^{j\omega t}dt \int_{-T/2}^{T/2}x(t')e^{-j\omega t'}dt'e^{j\omega \tau}d\omega  \right\}=\\=&#xA;\lim_{T\rightarrow\infty}E\left\{ \frac{1}{T} \int_{-T/2}^{T/2}x^*(t) \int_{-T/2}^{T/2}x(t')\left[\frac{1}{2\pi}\int_{-\infty}^{\infty}e^{j\omega (t+ \tau-t')}d\omega\right]dtdt'  \right\}&#xA;$$&#xA;The expression in brackets equals $\delta(t+\tau-t')$, which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}^{-1}\{S_x(\omega)\}=&#xA;\lim_{T\rightarrow\infty}E\left\{ \frac{1}{T} \int_{-T/2}^{T/2}x^*(t) x(t+\tau)dt  \right\}=\\&#xA;=\lim_{T\rightarrow\infty} \frac{1}{T} \int_{-T/2}^{T/2}E\{x^*(t) x(t+\tau)\}dt=\\&#xA;= \lim_{T\rightarrow\infty} \frac{1}{T} \int_{-T/2}^{T/2}R_x(\tau)dt=&#xA;R_x(\tau)\lim_{T\rightarrow\infty} \frac{1}{T} \int_{-T/2}^{T/2}dt=R_x(\tau)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which shows that the chosen definition of the power spectrum is compatible with the fact that the power spectrum and the autocorrelation function are Fourier transform pairs. A similar derivation can be done for discrete-time signals.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-07-14T06:51:18.130" LastActivityDate="2014-07-14T06:51:18.130" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17326" PostTypeId="1" AcceptedAnswerId="17327" CreationDate="2014-07-13T18:03:11.913" Score="4" ViewCount="12428" Body="&lt;p&gt;This is my understanding of 'energy compaction' and want to know if it is right.  Take a vector.  The energy of the vector is the sum of the squares of its elements.  If A is the transformation matrix that is unitary, it can be proved that the energy in x and Ax are same.  Energy conservation property.  Energy compaction means that the energy of Ax=y is more concentrated in some elements compared to the distribution of energy in x.  DCT is said to have energy compaction property.  Does that mean, for any x, if A is DCT matrix, energy of y will be more concentrated when compared to the x.  Does this happen to every x or x has to satisfy some properties to get this energy compaction?  &lt;/p&gt;&#xA;" OwnerUserId="10488" LastActivityDate="2014-07-13T19:13:28.453" Title="What is 'energy compaction' in simple terms?" Tags="|image-processing|discrete-signals|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17327" PostTypeId="2" ParentId="17326" CreationDate="2014-07-13T19:00:06.070" Score="6" Body="&lt;p&gt;Yes, I believe that your understanding of energy compaction is correct.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does that mean, for any x, if A is DCT matrix, energy of y will be&#xA;  more concentrated when compared to the x.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, it does not.  All that is needed to prove that such is not the case is to show that there is an $x$ that is not compacted by the DCT.  White noise, for example, would not be compacted by the DCT.  The DCT is useful because in many real life situations the &quot;signal&quot; (e.g. audio, images, videos, etc.) tend to be &quot;pinkish&quot;, i.e. tend to have most of their energy in the lower frequencies and so there is a natural assymetry that can be used to our advantage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to look at this is from an information theory perspective.  If a signal is not &quot;white&quot; (i.e. it doesn't have the same power at all frequencies) that implies that there is some correlation between samples in the time domain, which means that the samples have &quot;information&quot; about the value of other samples.  This mutual information implies that there is redundancy, and thus should be able to reduce the amount of data without losing information.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does this happen to every x or x has to satisfy some properties to get this energy compaction?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For frequency-based transforms like the DCT it is clear from the above that what is needed is for the signal to be non-white.  The more non-white it is, the more compaction can be achieved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other kinds of transforms though, which presumably could compact signals based on other features.  That is pretty much the whole point of &lt;a href=&quot;http://en.wikipedia.org/wiki/Compressed_sensing&quot; rel=&quot;noreferrer&quot;&gt;compressed sensing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-07-13T19:00:06.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17328" PostTypeId="1" AcceptedAnswerId="17342" CreationDate="2014-07-13T19:01:08.660" Score="3" ViewCount="7929" Body="&lt;p&gt;How an algorithm can be developed to count numbers and bolts in the image below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lBGU1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10489" LastActivityDate="2020-06-23T10:51:55.980" Title="Count objects in the image" Tags="|image-processing|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17329" PostTypeId="2" ParentId="17326" CreationDate="2014-07-13T19:13:28.453" Score="6" Body="&lt;p&gt;Energy compaction means that a large proportion of the total signal energy is contained in a handful of coefficients. Several metrics could be defined to assess this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The number of coefficients accounting for a given percentage (for example 95%) of the total energy.&lt;/li&gt;&#xA;&lt;li&gt;The number of coefficients whose energy falls below a given percentage of the total energy.&lt;/li&gt;&#xA;&lt;li&gt;Any statistical measure of distribution peakedness - considering the coefficients as samples from a random distribution.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does that mean, for any x, if A is DCT matrix, energy of y will be&#xA;  more concentrated when compared to the x. Does this happen to every x&#xA;  or x has to satisfy some properties to get this energy compaction?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This property is clearly not valid for any $x$. Otherwise, the transform could be applied iteratively on its result until data ends up being concentrated in a single coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this may sound tautological, one could say that DCT has good energy compaction properties on signals which are made by combining a small number of sinusoidal elements; and more generally on signals in which there is an imbalance in the distribution of energy. This happens to be a good description of speech, music and &quot;natural&quot; images. Speech or music sounds are mostly made of a handful of sinusoidal harmonics, with less energy in the high frequencies. Images contain large uniform regions (Consider that a $N \times N$ pixels square has $N^2$ interior pixels and only $4N$ edge pixels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But DCT will provide very poor energy compaction on signals with plenty of abrupt transitions, or any noise-like signal. In particular, if a sequence of DCT coefficients has good energy compaction, it will have abrupt transitions (a high coefficient surrounded by small values), and applying the DCT on this sequence itself will produce a sequence with poor energy compaction. There is no free lunch, repeatedly applying the transform on the transform's results will get you nowhere...&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-07-13T19:13:28.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17330" PostTypeId="1" AcceptedAnswerId="17332" CreationDate="2014-07-13T19:50:06.797" Score="4" ViewCount="353" Body="&lt;p&gt;Does anybody know why we need 2 different tone signals: one high frequency and one low frequency to create a tone burst in Dual-Tone Multi Frequency signalling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, to create a tone burst of 3, we need a high frequency $1477 \mathtt{Hz}$ and a low frequency $697 \mathtt{Hz}$. Does anyone know the reason for that?&lt;/p&gt;&#xA;" OwnerUserId="10411" LastEditorUserId="8202" LastEditDate="2014-07-14T05:22:52.757" LastActivityDate="2014-07-16T13:52:49.407" Title="Dual-Tone Multi Frequency signalling" Tags="|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17331" PostTypeId="1" AcceptedAnswerId="17344" CreationDate="2014-07-13T20:18:52.420" Score="3" ViewCount="270" Body="&lt;p&gt;Like energy compaction transforms, the inverse transforms like IDCT are energy spreading transforms?&lt;/p&gt;&#xA;" OwnerUserId="10488" LastEditorUserId="128" LastEditDate="2019-03-29T11:34:47.803" LastActivityDate="2019-03-29T11:34:47.803" Title="As DCT Does Compaction of Energy, Can We Say IDCT Does Energy Spreading?" Tags="|image-processing|signal-analysis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17332" PostTypeId="2" ParentId="17330" CreationDate="2014-07-13T22:40:13.727" Score="7" Body="&lt;p&gt;Essentially, the reason why you need two tones is to ensure that a normal human voice &lt;strong&gt;can't replicate&lt;/strong&gt; the tones.  As such, by simultaneously generating a tone from a high-frequency group and low-frequency group, it is highly improbable that a human voice can replicate a sound from such differing ends of the frequency spectrum at the same time.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we were to adopt single tone dialing, wouldn't it be annoying if you were to talk to someone, your voice matches one of the dialing frequencies and it would randomly dial that number while talking?  It would certainly annoy me!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Dual-Tone Multi Frequency tones (or DTMF for short) for a particular key is split up in the following grid:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1     |    2     |   3    |    A    |   697Hz&#xA;4     |    5     |   6    |    B    |   770Hz&#xA;7     |    8     |   9    |    C    |   852Hz&#xA;*     |    0     |   #    |    D    |   941Hz&#xA;--------------------------------------&#xA;1209Hz   1336Hz    1477Hz    1633Hz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For example, by pushing &lt;code&gt;1&lt;/code&gt;, you would generate two tones: 697 Hz and 1209 Hz from the low and high frequency ranges respectively.  In your post, you have already identified the frequencies used when dialing the number &lt;code&gt;3&lt;/code&gt;.  &lt;code&gt;A,B,C,D&lt;/code&gt; are probably something you haven't seen before.  &lt;code&gt;A,B,C,D&lt;/code&gt; were actually used as keys for the US Military's Autovon phone system.  They were used for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;A&lt;/code&gt; - Flash Override&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;B&lt;/code&gt; - Flash&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;C&lt;/code&gt; - Immediate&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;D&lt;/code&gt; - Priority&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Pushing one of these keys gave your call priority with Flash Override being the highest.  The Autovon system has been disbanded for a long time, but many non-telephone applications still use those keys today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One question that you may ask is &lt;strong&gt;how&lt;/strong&gt; they decided to come up with these frequencies?  The frequencies were chosen to avoid harmonics - as in no frequency being a multiple of another.  Also, the difference between any two frequencies doesn't equal any of the other frequencies and the sum of any two frequencies isn't equal to any of the frequencies too.  The frequencies were generated within a &lt;code&gt;+/- 1.5%&lt;/code&gt; tolerance of each other, the highest frequency must be &lt;strong&gt;as loud&lt;/strong&gt; as the lowest frequency and as much as &lt;code&gt;4 dB&lt;/code&gt; louder.  This level difference is referred to as a &quot;twist&quot;.&lt;/p&gt;&#xA;" OwnerUserId="8480" LastEditorUserId="8480" LastEditDate="2014-07-16T13:52:49.407" LastActivityDate="2014-07-16T13:52:49.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17333" PostTypeId="1" AcceptedAnswerId="17338" CreationDate="2014-07-13T22:59:52.693" Score="4" ViewCount="1432" Body="&lt;p&gt;The example that I've seen on state estimation involves deriving the ABCD matrix of a physical system (i.e. falling object) and tracking that object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to use Kalman Filter for signal denoising applications (specifically EEG signal). How could I apply KF in this situation since ABCD matrix cannot be derived for a signal.&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2016-08-03T05:52:17.887" Title="How do you apply Kalman Filter to track a signal?" Tags="|kalman-filters|eeg|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17334" PostTypeId="2" ParentId="17294" CreationDate="2014-07-14T00:04:32.347" Score="2" Body="&lt;p&gt;The ROC:&#xA;ROC curves are popularly used as performance metric for classification tasks. If the images in your dataset has class labels, then you can employ supervised learning to train a classifier (SVM for example). The dataset is split into training and testing and predicted class score from the classifier for images in the test set are compared to ground truth labels. The ROC curve is acquired by applying a threshold value to the classifier predicted score and obtaining a (TP,FP) value for each threshold to generate the curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The features:&#xA;SIFT and SURF are detectors and image local-patch descriptors (you can also use these without the detector in what is now more successful approach called 'dense sampling' where the keypoints are uniformly sampled in the image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several approaches, but the most popular and recommended for first use is the 'Bag-of-Words' (BoW) model based approach. The reason is that: each image has one label (ignoring multi-class and multi-label scenario for now) and several hundred keypoints and each keypoint has an associated high-dimensional feature vector. The feature for an image at this stage is a matrix and we would like a vector (a point in feature space for each image with its label). The BoW approach does just this job for us.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BoW approach:&#xA;All the feature vectors for every image in the training set are collated and clustered (ignoring labels and location data) to compute a 'dictionary', using unsupervised learning. The dictionary is a set of cluster centroids, most commonly computed using k-means clustering. The dictionary follows data compression scheme to succinctly represent the data distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subsequently, each image is 'encoded' using its keypoints and the computed dictionary. Using vector quantization VQ, each keypoint is associated with a dictionary element to compute a occurrence histogram of keypoint associations. The consequence is that each image now has a feature vector which is the normalized occurrence histogram of keypoints assigned to dictionary elements. The dimensionality of this encoded feature vector is the size of the dictionary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This normalized histogram for each image along with the label is used to training a classifier and then acquire classification results measured in terms of ROC curve. The sequence is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Images] -&gt; (SIFT/SURF) -&gt; [SIFT/SURF feature matrix] -&gt; (collate and cluster) -&gt; [dictionary] -&gt; (BoW histogram by VQ encoding) -&gt; [feature vector, label] -&gt; Classifier training (training data) -&gt; Classifier testing (validation/test data) -&gt; ROC curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggestions:&#xA;Besides ROC, there are other performance measures available like accuracy, mean average precision, F1 score, etc. Your choice depends on the imageset, label ratio balance, objective of the classifier, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is plenty of code available online for baseline Bag-of-words model for images. One sample in Matlab using the Caltech101 dataset is at:&#xA;&lt;a href=&quot;http://www.vlfeat.org/applications/apps.html#apps.caltech-101&quot; rel=&quot;nofollow&quot;&gt;http://www.vlfeat.org/applications/apps.html#apps.caltech-101&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The performance of SIFT and SURF is also provided in the original paper on SURF, so you can compare your results if you choose to work with the same dataset.&lt;/p&gt;&#xA;" OwnerUserId="10491" LastActivityDate="2014-07-14T00:04:32.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17335" PostTypeId="2" ParentId="2422" CreationDate="2014-07-14T00:21:16.760" Score="1" Body="&lt;p&gt;Building on previous responses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) You can use SIFT (or another improved variant of this local-patch descriptor) with dense sampling, instead of the inbuilt detector. You can choose the size of the local patch and the sampling density to suit your requirements of performance and computational cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) SIFT is an affine invariant descriptor for wide baseline stereo matching. This means that SIFT works well when you take an image and induce affine transform to it, wherein the 'template' must be present in the target image albeit with transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggestions: &#xA;(a) Create a database of template images (if possible) to improve your chances of detecting the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(b) You can use BoW model as baseline if you choose to adopt a CBIR approach to your task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(c) Crop your template image to only the relevant part and use a highly dense SIFT.&#xA;&lt;a href=&quot;http://www.vlfeat.org/overview/dsift.html&quot; rel=&quot;nofollow&quot;&gt;http://www.vlfeat.org/overview/dsift.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4) Later you may want to try a mutli-scale descriptor like PHOG (Pyramidal Histogram of Gradients), etc. which could potentially improve results.&#xA;&lt;a href=&quot;http://www.vlfeat.org/overview/dsift.html#tut.dsift.phow&quot; rel=&quot;nofollow&quot;&gt;http://www.vlfeat.org/overview/dsift.html#tut.dsift.phow&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10491" LastEditorUserId="10491" LastEditDate="2014-07-14T09:13:16.097" LastActivityDate="2014-07-14T09:13:16.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17336" PostTypeId="1" CreationDate="2014-07-14T01:56:03.073" Score="1" ViewCount="8880" Body="&lt;p&gt;Is it common to find systems having signal to noise ratio (SNR) less than 1 i.e. noise is more than signal? I am currently working with SNR of -5db to -20db. And how useful is it to work with sensor readings having negative SNR? I am asking it because the algorithm I am using to solve a problem works well with negative SNR but at positive and higher SNR, it is numerically unstable. This instability arises because of computation of hypergeometric function $_pF_q\left(;;\frac{z}{σ^2}\right)$. At high SNR, i.e. low $σ^2$, the argument $\frac{z}{σ^2}$ becomes very high, making the convergence of hypergeometric function very slow and the algorithm becomes numerically unstable.&lt;/p&gt;&#xA;" OwnerUserId="10493" LastEditorUserId="4346" LastEditDate="2014-07-14T02:55:32.653" LastActivityDate="2014-09-12T05:02:38.130" Title="Negative dB signal to noise ratio" Tags="|discrete-signals|signal-analysis|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17337" PostTypeId="2" ParentId="17336" CreationDate="2014-07-14T02:29:58.107" Score="3" Body="&lt;p&gt;Yes, GPS signals are below the noise floor. &lt;a href=&quot;http://www.gpssource.com/faqs/15&quot; rel=&quot;nofollow&quot;&gt;Link&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5205" LastActivityDate="2014-07-14T02:29:58.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17338" PostTypeId="2" ParentId="17333" CreationDate="2014-07-14T03:26:42.683" Score="1" Body="&lt;p&gt;You'd probably be better off with a an adaptive filter like LMS (Least Mean Squares) or RLS (Recursive Least Squares) than Kalman for something like an EEG signal. As you've pointed out, it can be difficult or even impossible to develop the state model for Kalman for that type of signal.  LMS and RLS are &quot;learning&quot; algorithms and better suited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_filter&quot; rel=&quot;nofollow&quot;&gt;The Wikipedia article on adaptive filters&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mentions the case of an ECG signal as an example application, although it doesn't go into detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simon Haykin's &quot;Adaptive Filter Theory&quot; is a good reference on these types of filters.&lt;/p&gt;&#xA;" OwnerUserId="10282" LastEditorUserId="10282" LastEditDate="2014-07-18T20:24:59.213" LastActivityDate="2014-07-18T20:24:59.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17339" PostTypeId="2" ParentId="17336" CreationDate="2014-07-14T03:57:10.677" Score="-1" Body="&lt;p&gt;It's quite common to work with signals that are below the noise. If you use signal of some length more than 1 you can exploit it to overcome noise impact so it's all right. As I've understood the issue is with algorithm convergence. It's unknown and it's difficult to define what the problem is (write some details if you're allowed). But maybe you should use $\frac{z}{\sigma^2+1}$ instead? So if SNR is pretty low, $\sigma^2$ is the major one and your algorithm will work well as you've written. And while SNR is high the argument will not be very high no more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you describe your approach briefly, somebody can probably tell you more about how to improve your algorithm. &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-07-14T03:57:10.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17342" PostTypeId="2" ParentId="17328" CreationDate="2014-07-14T04:50:16.283" Score="4" Body="&lt;p&gt;I will be using MATLAB as part of my solution.  The basic algorithm will be this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Read in the image and convert to black and white&lt;/li&gt;&#xA;&lt;li&gt;Invert the intensities and fill in the holes.  There are speckles in the image where when you convert the image to black and white, the objects are not solid.  We want to ensure these are solid&lt;/li&gt;&#xA;&lt;li&gt;Count how many unique objects there are using &lt;code&gt;bwlabel&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You'll need the Image Processing Toolbox for this algorithm.  If you don't have this and are using MATLAB, let me know and I'll edit my post.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Without further ado:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Read in image, convert to black and white - Link comes from your image posted here&#xA;im = imread('https://i.stack.imgur.com/lBGU1.png');&#xA;imBW = im2bw(im, 0.3); %// Specify manual threshold of 0.3&#xA;&#xA;% Invert intensities and fill in holes&#xA;imBWFilled = imfill(~imBW, 'holes');&#xA;&#xA;% Count how many unique objects there are&#xA;[L,num] = bwlabel(imBWFilled);&#xA;&#xA;% Show final image and display number of objects counted in the title&#xA;imshow(imBWFilled);&#xA;title(['Total number of objects: ' num2str(num)]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;L&lt;/code&gt; contains a map where each pixel is an ID of which object that belongs to.  0 means that the pixel belongs to the background while any pixel that has values greater than or equal to 1 means that the pixel belongs to a particular object associated with that ID number.  &lt;code&gt;num&lt;/code&gt; gives you the total number of objects seen in the image.  The output of this code thus gives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FYAIh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you don't have MATLAB and want to compute this using another language, let me know.  You can find the number of objects by considering an image as a connected graph.  If you don't have &lt;code&gt;bwlabel&lt;/code&gt;, you can use any graph searching algorithm (breadth-first search, depth-first search, etc.) to help you compute this.  Start with any pixel that belongs to an object, and perform BFS / DFS to visit those pixels that belong to the object.  You then set all of these pixels to belong to an ID number.  When the queue / stack is empty, you then select another pixel that belongs to an object and repeat the algorithm.  You stop when you have visited all pixels that belong to objects.  The total number of IDs you have issued will essentially be how many unique objects you have in your image.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Edit - July 14th, 2014&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Seeing your comments, you wish to be able to distinguish between what is a nut and what is a bolt.  As such, we can simply add on top of the current code.  The algorithm that I have developed is loosely based on circularity:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For each object, find the centre of mass.  This is simply taking all of the X and Y co-ordinates and averaging them.&lt;/li&gt;&#xA;&lt;li&gt;For each object, find their boundaries / perimeters&lt;/li&gt;&#xA;&lt;li&gt;For each centre of mass we have, calculate the distance between this point and all of the object boundary points.&lt;/li&gt;&#xA;&lt;li&gt;Find the difference between the maximum and minimum of these distances - denote this the range&lt;/li&gt;&#xA;&lt;li&gt;We will have N ranges for N objects.  Simply take a look at these ranges and threshold the array.  If you take a look at the bolts, they have a longer vertical direction than horizontal direction.  For the bolts, the vertical and horizontal direction is pretty much the same.  As such, the range should give us an idea of what is a nut and bolt because the difference between the maximum distance to the centre and the minimum distances should be very large in comparison to the nut.  As such, for each object we have, check to see if the range is below a certain value (nut) or above a certain value (bolt).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Without further ado, here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%%% For each object in the image, find the centre of mass&#xA;centres = zeros(num,2);&#xA;% Cycle through each unique object label and extract (X,Y) co-ordinates&#xA;% that belong to each object.  Compute centre of mass for each.&#xA;for n = 1 : num&#xA;    bmap = L == n;&#xA;    [rows,cols] = find(bmap == 1);&#xA;    centres(n,:) = [mean(cols) mean(rows)];&#xA;end&#xA;&#xA;% Find boundaries of all objects&#xA;bwBound = bwperim(imBWFilled, 8);&#xA;&#xA;% For each object, find the distances between the centre of mass with all&#xA;% of the pixels along the boundary for each object.  Find the range (max -&#xA;% min).&#xA;ranges = zeros(num,1);&#xA;for n = 1 : num&#xA;    bmap = L == n; % Obtain all pixels for an object&#xA;    boundPix = bwBound &amp;amp; bmap; % Logical AND with boundaries map to extract&#xA;                               % only those pixels around the perimeter&#xA;    [rows,cols] = find(boundPix == 1); % Find these locations&#xA;    % Compute the distances between the centre of mass with these points&#xA;    dists = sqrt((cols - centres(n,1)).^2 + (rows - centres(n,2)).^2);&#xA;&#xA;    % Find the difference between the maximum and minimum distances&#xA;    ranges(n) = max(dists(:)) - min(dists(:));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This isn't complete yet.  I stopped here so you can see what the ranges for all of the objects look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ranges =&#xA;&#xA;37.9615&#xA;63.9613&#xA;54.9266&#xA; 5.0716&#xA; 4.1578&#xA; 6.3114&#xA; 7.2356&#xA;41.6381&#xA;10.3123&#xA;34.0938&#xA; 5.0021&#xA;67.3290&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, there are some ranges that are quite small ($&amp;lt; 10$) while there are some ranges that are large.  To be safe, let's choose a threshold of 15.  As such, for those ranges that are less than 15, this is classified as a nut while those that are larger are classified as a bolt.  When we're done, we simply count how many of these fall within each range, and those are the number of nuts and bolts we have.  Let's continue with the algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Find those object IDs that have less than a range of 15.  These are the&#xA;% bolts&#xA;% The rest are nuts&#xA;indBolts = find(ranges &amp;lt; 15);&#xA;indNuts =  find(ranges &amp;gt;= 15);&#xA;&#xA;% Total number of nuts and bolts&#xA;numBolts = numel(indBolts);&#xA;numNuts = numel(indNuts);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will give you 6 and 6 respectively as you expected.  Now to finish up the algorithm, I'm going to give you an added bonus.  For each unique object we have, I'm going to colour their interiors to be a certain shade of gray.  The background will be black, while a nut is gray and a bolt is white.  The code to do this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;finalMap = uint8(zeros(size(imBW)));&#xA;&#xA;for n = 1 : numBolts&#xA;    finalMap(L == indBolts(n)) = 128;&#xA;end&#xA;for n = 1 : numNuts&#xA;    finalMap(L == indNuts(n)) = 255;&#xA;end&#xA;&#xA;figure;&#xA;imshow(finalMap);&#xA;title(['Number of Nuts: ' num2str(numNuts) ', Number of Bolts: ' num2str(numBolts)]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The final image we get is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2wBX2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8480" LastEditorUserId="8480" LastEditDate="2014-07-14T15:21:27.103" LastActivityDate="2014-07-14T15:21:27.103" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17343" PostTypeId="2" ParentId="17331" CreationDate="2014-07-14T05:05:08.537" Score="0" Body="&lt;p&gt;I am not sure what is the question.&lt;br&gt;&#xA;The concept is to think there are many bases to represent Vectors / Signals.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of them is using the DCT base.&lt;br&gt;&#xA;Now every base has its own advantages on different type of signals.&lt;br&gt;&#xA;It happens to be that images are very sparse and energy compact in their DCT representation.&lt;br&gt;&#xA;Hence it is used for &quot;Compression&quot; (JPEG).&lt;br&gt;&#xA;Yet, not all signals will have this property with respect to the DCT base.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-07-14T05:05:08.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17344" PostTypeId="2" ParentId="17331" CreationDate="2014-07-14T05:13:59.967" Score="4" Body="&lt;p&gt;For certain kinds of signals (voiced speech, most music, etc.), the DCT is likely to compact, and thus the IDCT to (re)spread that more compact DCT result; but that is not true in general.  An impulse in either domain will be spread in the other domain, and vice versa, for that spread result, when inverse transformed.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-07-14T20:27:25.217" LastActivityDate="2014-07-14T20:27:25.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17345" PostTypeId="2" ParentId="17328" CreationDate="2014-07-14T06:46:55.943" Score="2" Body="&lt;p&gt;Let me give a solution in Mathematica, for good measure. Like Ray, I simply binarized the image, then counted the number of connected, filled components: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = Import[&quot;https://i.stack.imgur.com/lBGU1.png&quot;]&#xA;ComponentMeasurements[ColorNegate@Binarize@img, &quot;FilledCount&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{1 -&amp;gt; 5779, 2 -&amp;gt; 3426, 3 -&amp;gt; 3433, 4 -&amp;gt; 4716, 5 -&amp;gt; 6680, 6 -&amp;gt; 4294, &#xA; 7 -&amp;gt; 1734, 8 -&amp;gt; 5807, 9 -&amp;gt; 3406, 10 -&amp;gt; 6345, 11 -&amp;gt; 3371, 12 -&amp;gt; 2696}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you want to count the nuts and bolts separately, we can leverage the fact that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Genus_%28mathematics%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;genus&lt;/a&gt; of the two object types is different: 0 for the bolts, and 1 for the nuts.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ComponentMeasurements[ColorNegate@Binarize@Opening[img, 2], &quot;Holes&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Opening is to smooth over the tiny holes caused by compression noise. The output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{1 -&amp;gt; 0, 2 -&amp;gt; 1, 3 -&amp;gt; 1, 4 -&amp;gt; 0, 5 -&amp;gt; 0, 6 -&amp;gt; 0, 7 -&amp;gt; 1, 8 -&amp;gt; 1, &#xA; 9 -&amp;gt; 1, 10 -&amp;gt; 0, 11 -&amp;gt; 1, 12 -&amp;gt; 0}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We can easily collate like items using &lt;code&gt;Last /@ % // BinCounts&lt;/code&gt;. This simply takes the last item (i.e., the genus) of each element in the previous result, and bins them. The final answer is &lt;code&gt;{0, 6, 6}&lt;/code&gt;; six bolts and six nuts.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2014-07-14T08:11:02.213" LastActivityDate="2014-07-14T08:11:02.213" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17346" PostTypeId="2" ParentId="17297" CreationDate="2014-07-14T08:07:58.663" Score="-1" Body="&lt;p&gt;Did you try this &lt;a href=&quot;http://read.pudn.com/downloads161/ebook/733842/PSK%20Demodulation%20%28Part%201%29.pdf&quot; rel=&quot;nofollow&quot;&gt;implementation&lt;/a&gt; ? &lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2014-07-14T08:07:58.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17347" PostTypeId="1" AcceptedAnswerId="17348" CreationDate="2014-07-14T14:04:31.310" Score="5" ViewCount="4307" Body="&lt;p&gt;In Oppenheim's &amp;quot;discrete time signal processing&amp;quot;, it says,&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GUgic.png&quot; alt=&quot;from Oppenheim's book.&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;How is the equation (10.65) derived?&lt;/p&gt;&#xA;&lt;p&gt;PS:&#xA;you may try to derive it with Fourier transform of the original and the sampled signals.&#xA;But i think it is not appropriate.&#xA;Because when you are considering about the PSD of a signal, the assumption will be the fourier transform of the signal doesn't exist...&lt;/p&gt;&#xA;&lt;p&gt;the definition of the PSD of a signal actually comes with a truncated signal:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/syxYV.png&quot; alt=&quot;PSD of a continuous signal.&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;the same is for the discrete version:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QkQXL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I guess there may exist something like... &amp;quot;sampling a random process&amp;quot; theory?&lt;/p&gt;&#xA;&lt;p&gt;Regards.&lt;/p&gt;&#xA;" OwnerUserId="4467" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-07-14T14:47:47.633" Title="What is the relationship between the PSD of a continuous signal and the PSD of its periodically sampled one?" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17348" PostTypeId="2" ParentId="17347" CreationDate="2014-07-14T14:33:07.023" Score="5" Body="&lt;p&gt;If you sample a finite-power continuous-time random process $x(t)$ you get a discrete-time random process $y_k$. If $x(t)$ is wide-sense stationary (WSS) you get for the autocorrelation function of $y_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_y(k,l)=E\{X(kT)X^*(lT)\}=R_x((k-l)T)=R_x(mT)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is the sampling period. Obviously, $y_k$ is also WSS (it only depends on the difference $m=k-l$), and its autocorrelation function is a sampled version of the autocorrelation $R_x(\tau)$ of the original continuous-time process. Since the power spectrum is the Fourier transform of the autocorrelation function, the relation between the two power spectra is the same as the relation between the spectrum of a continuous signal and its sampled version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_y(e^{j\omega T})=\frac{1}{T}\sum_{k=-\infty}^{\infty}S_x(\omega-2\pi k/T)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the anti-aliasing filter has a cut-off frequency of $\pi/T$ it is sufficient to consider the interval $-\pi/T\le\omega&amp;lt;\pi/T$ (i.e. just consider the term $k=0$ in (1)):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_y(e^{j\omega T})=\frac{1}{T}S_x(\omega)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This equation is equivalent to Eq. (10.65) in your question. Just note that I've used $\omega$ in a different way (analog frequency in radians), whereas Oppenheim uses $\omega$ as the normalized angular frequency. So with $\omega'=\omega T$ you finally get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_y(e^{j\omega'})=\frac{1}{T}S_x\left(\frac{\omega'}{T}\right)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-07-14T14:47:47.633" LastActivityDate="2014-07-14T14:47:47.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17349" PostTypeId="1" CreationDate="2014-07-14T16:27:58.900" Score="1" ViewCount="803" Body="&lt;p&gt;After filtering my noisy input signal using an anti-aliasing and FIR filter, I now wish to get the basic signal information (peak voltage and impedance; $R$ and $X$) from the pre-filtered as well as the post filtered signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A method to find the peak value that was strongly recommended to me was, Fourier Full Cycle Algorithm (DFT Technique). Not having a firm theoretical grounding yet, (going to take a DSP next semester), I fail to understand the significance of this method, or if this is a better way to find peak values than the ones I've read about such as, taking the first derivative of signal and looking at the zero crossings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to this method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$V_{sin}=\frac{2}{K}\sum_{n=0}^{k-1}V_n\sin \omega $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$V_{cos}=\frac{2}{K}\sum_{n=0}^{k-1}V_n\cos \omega $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$V_{peak}=\sqrt{V_{sin}^2+V_{cos}^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$V_n $ - stored samples of voltage (basically my raw input signal)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$K$ - number of samples chosen per cycle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\omega=\frac{2\pi n}{K}$  (if $K=60$ samples, then $\omega =6^o $ for $n=1$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I found the peak of the &lt;strong&gt;pre-filtered signal&lt;/strong&gt; (raw-input) was by smoothing it out using a moving average filter using 4 points and then finding the global maxima using statement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[max_value, index_number]=max(Vn)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also coded in MATLAB, to find the peak value of voltage using the above mentioned DFT algorithm. &lt;strong&gt;The peak values don't match.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My raw input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dJo75.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Smoothed out data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qbd1q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd be grateful if someone can can tell me if the above mentioned DFT algorithm can even be implemented for an input signal that looks like mine and why the peak values obtained using both the methods don't match. Sorry that I sound confused, I truly am!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, a normalised FFT plot of the pre-filtered signal and the code to find peak using Fourier full cycle algorithm, as requested:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2u9Dy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;pre&gt;&lt;code&gt;&#xA;K=600; %Number of samples chosen per cycle&#xA;x=1;&#xA;y=1;&#xA;f=0;g=0;&#xA;angle=1;&lt;/p&gt;&#xA;&#xA;while (x&amp;lt;600) &#xA;   theta=(2*pi*angle)/K;&#xA;   f=f+(VolTime(x,2)*sin(theta)); %VolTime is the matrix [601X2],2nd column contains the input voltage values &#xA;   g=g+(VolTime(x,2)*cos(theta));&#xA;   x=x+1;&#xA;   angle=angle+1;&#xA;end&#xA;Vsine= (2/K)*f;&#xA;Vcos=(2/K)*g;&#xA;disp('Peak voltage')&#xA;VPeak=sqrt(Vsine^2 + Vcos^2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10274" LastEditorUserId="10274" LastEditDate="2014-07-15T11:57:19.790" LastActivityDate="2014-07-15T11:57:19.790" Title="Extraction of fundamental signal information-Fourier full cycle algorithm" Tags="|dft|peak-detection|fourier|moving-average|" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="17350" PostTypeId="1" AcceptedAnswerId="17352" CreationDate="2014-07-14T17:09:18.967" Score="14" ViewCount="2430" Body="&lt;p&gt;I stumble quite often upon the notion that two or more parts of a signal are correlated to describe semi-formally that they belong together. For example in image processing, two pixels on an edge feature tend to be correlated whereas two adjacent parts of a 3D structure that represents water droplets in a particle simulation are less correlated. My question is what is the exact idea behind this notion.&lt;/p&gt;&#xA;" OwnerUserId="7535" LastEditorUserId="128" LastEditDate="2019-03-29T11:35:18.890" LastActivityDate="2021-08-13T12:44:37.673" Title="What Does It Mean Exactly When Two Parts of a Signal Are Correlated?" Tags="|statistics|correlation|terminology|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17351" PostTypeId="2" ParentId="17350" CreationDate="2014-07-14T19:12:11.037" Score="2" Body="&lt;p&gt;Usually this refers to the autocorrelation coefficient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider any 1D signal with periodicity $\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's look at the autocorrelation integral:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R(\tau)=\int_{-\infty}^{\infty}\! f(t)f(t-\tau)\,\mathrm{d}t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For varying $\tau$, the autocorrelation will have a maximum for $\tau$ equalling $\pi$ and its multiples. Thus autocorrelation can be used to study the periodicity of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is often sort of colloquially used to indicate that certain parts of a signal are very similar or even identical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The analogue for two different signals would be the cross correlation. It can be used to study the similarity of two separate signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(f \star g)(\tau) = \int_{-\infty}^{\infty}\! f(t)g(t-\tau)\,\mathrm{d}t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of the cross correlation $\tau$ has no significance over periodicity of the single signals but if for a given $\tau$ the correlation is high, $\tau$ indicates the phase shift between the signals. &lt;/p&gt;&#xA;" OwnerUserId="10503" LastEditorUserId="10503" LastEditDate="2014-07-15T09:48:31.347" LastActivityDate="2014-07-15T09:48:31.347" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17352" PostTypeId="2" ParentId="17350" CreationDate="2014-07-14T19:21:57.507" Score="10" Body="&lt;p&gt;Yeah, it can mess you up pretty badly if you don't get the fundamentals right off the get-go.  This is how I interpret correlation, and it has worked for me for what I do for a living.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start off with a relatively simple example.  Take a look at the following figure (pulled from &lt;a href=&quot;https://i.stack.imgur.com/VCyOf.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;dspguide&lt;/a&gt;... this is actually a great online book for knowing the basics of DSP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VCyOf.gif&quot; alt=&quot;blah&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have an antenna that transmits a short burst of radio wave energy in some direction. If the propagating wave strikes an object.... like a helicopter in this figure, a small fraction of the energy is reflected back toward a radio receiver.  This receiver is close to the transmitting antenna.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This short burst of radio energy, for the sake of this example, is a small triangular shape.  When the signal is reflected off of the helicopter, and then echoed back to the receiver, this signal will consist of two parts: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A shifted and scaled version of the transmitted pulse, and&lt;/li&gt;&#xA;&lt;li&gt;Random noise, resulting from interfering radio waves, thermal noise in the electronics and other factors.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Loosely speaking, we can actually figure out &lt;strong&gt;how far&lt;/strong&gt; the object is by using this concept.   Since radio signals travel roughly at the speed of light, the shift between the transmitted and received pulse is a rough measure of the distance to the object being detected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, this is our general problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given a signal of some known shape, what is the best way to determine where (or if) the signal occurs in another signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The best way to answer this is &lt;strong&gt;correlation&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two different paradigms for computing correlation.  The first one is called &lt;strong&gt;auto-correlation&lt;/strong&gt;, where you are comparing a signal with shifted time offsets of itself.  This paradigm that we are describing (also seen in the figure) is defined as &lt;strong&gt;cross-correlation&lt;/strong&gt;, where we are comparing with &lt;strong&gt;another signal&lt;/strong&gt;, notably the received signal.  We essentially are comparing the received signal with shifted versions of the original transmitted signal.  Basically, we take a look at what we have received and what was transmitted.  We take what was received, and time shift the original transmitted signal over by different time values.  We then do a comparison with each of these signals and the received result.  Whichever gives us the &lt;strong&gt;highest&lt;/strong&gt; value will denote how far away the helicopter is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude of each sample in the cross-correlation signal is a measure of how much the received signal &lt;strong&gt;resembles&lt;/strong&gt; the target signal, at that location. This means that a peak will occur in the cross-correlation signal for every target signal that is present in the received signal. In other words, the value of the cross-correlation is maximized when the target signal is aligned with the same features in the received signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is noise on the received signal, there will also be noise on the cross-correlation signal. It is an unavoidable fact that random noise looks a certain amount like any target signal you can choose. The noise on the cross-correlation signal is simply measuring this similarity. Except for this noise, the peak generated in the cross-correlation signal is symmetrical between its left and right. This is true even if the target signal isn't symmetrical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good thing to remember is that the cross-correlation is trying to detect the target signal, not recreate it. There is no reason to expect that the peak will even look like the target signal.  Correlation is the &lt;strong&gt;optimal&lt;/strong&gt; technique for detecting a known waveform in random noise. To be perfectly correct, it is only optimal for random white noise. Using correlation to detect a known waveform is frequently called &lt;strong&gt;matched filtering&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;tl;dr&lt;/code&gt; - Correlation is a measure of how much one signal &lt;strong&gt;resembles&lt;/strong&gt; another.  The signal can be images, features, edges, etc.  It is simply a measure of resemblance between one signal and another.&lt;/p&gt;&#xA;" OwnerUserId="8480" LastEditorUserId="26573" LastEditDate="2019-01-10T07:55:55.913" LastActivityDate="2019-01-10T07:55:55.913" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17353" PostTypeId="2" ParentId="17303" CreationDate="2014-07-15T00:49:22.690" Score="2" Body="&lt;p&gt;I tried a 2-D CA-CFAR approach the result and the code is as follows: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% image flattening&#xA;clear all; close all;&#xA;x = imread('DOX7f.png');&#xA;[r, c] = size(x);&#xA;&#xA;N =10;&#xA;N2 = N/2;&#xA;R = r/N;&#xA;C = c/N;&#xA;y = zeros(r, c);&#xA;K = ones(N+1,N+1);&#xA;K(N2:N2+2, :) = 0;&#xA;K(:, N2:N2+2) = 0;&#xA;K = K/sum(K(:));&#xA;y2 = filter2(K, x);&#xA;y2 = x &amp;gt; 0.98*y2;&#xA;&#xA;figure(1);&#xA;imshow(y2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The 2-D kernel&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xlUVB.jpg&quot; alt=&quot;The Kernel&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The output&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6W228.jpg&quot; alt=&quot;The Flattened&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it what you were looking for?&lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-07-15T00:49:22.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17355" PostTypeId="2" ParentId="11452" CreationDate="2014-07-15T08:48:38.157" Score="2" Body="&lt;p&gt;Assumptions: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Continuous time domain&lt;/strong&gt;: Let $h(t)$ - impulse response, and $s(t)$ - step response&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Discrete time domain&lt;/strong&gt;: Let $h[n]$ - unit impulse response, and $s[n]$ - unit step response&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Intuitively speaking, integration in continuous time domain is equivalent to summation in discrete time domain. Similarly, derivative in continuous time domain is equivalent to finite difference in discrete domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this intuitive understanding, consider the relation between $u$ and $\delta$ (left side of the second equation in your post):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Continuous time domain:  $u(t) = \int \delta(t)$&lt;/li&gt;&#xA;&lt;li&gt;Discrete time domain:  $u[n] = 	\sum_{k=0}^{\infty} \delta[n-k]$  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Similarly, consider the relation between $s$ and $h$ (right side of the second equation in your post):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Continuous time domain:  $s(t) = 	\int h(t)$&lt;/li&gt;&#xA;&lt;li&gt;Discrete time domain:  $s[n] = \sum_{k=0}^{\infty} h[n-k]$ &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, if you carefully look at last equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s[n] = \sum_{k=0}^{\infty}h[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now $h[n]$ can be found from this equation using finite difference of $s[n]$ with a delayed version of itself, i.e. with $s[n-1]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n] = s[n] - s[n-1]$$&lt;/p&gt;&#xA;" OwnerUserId="10414" LastEditorUserId="10414" LastEditDate="2016-08-08T13:52:33.437" LastActivityDate="2016-08-08T13:52:33.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17356" PostTypeId="1" AcceptedAnswerId="50230" CreationDate="2014-07-15T09:39:44.653" Score="0" ViewCount="2402" Body="&lt;p&gt;Given a signal with zero mean and a standard deviation of 0.1 sampled at 5000 Hz.&lt;br&gt;&#xA;What would be the Standard Deviation of its 1st, 2nd and 'n' derivative?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, let's say we measure the distance to a constant range target.&#xA;The STD of the sensor measurements of the range is 0.1 [Meter] (Assume the error is white) and its sampling rate is 5000 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the standard deviation of the acceleration process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-07-15T11:02:07.873" LastActivityDate="2022-01-12T07:22:02.570" Title="The Standard Deviation of The Derivative of a Signal" Tags="|estimation|random|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17357" PostTypeId="2" ParentId="17356" CreationDate="2014-07-15T09:50:31.217" Score="3" Body="&lt;p&gt;It depends on the frequency content of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider sinusoidal signals with an amplitude of 1 and frequencies of 1Hz and 1kHz. Both have the same standard deviation, but the standard deviation of their derivatives are different - 1000 times as large for the latter.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-07-15T09:50:31.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17358" PostTypeId="2" ParentId="17356" CreationDate="2014-07-15T10:46:15.747" Score="4" Body="&lt;p&gt;As pointed out in pichenettes' answer, you need to know more about the original signal $x(t)$. If the signal's power spectrum $S_x(\omega)$ is known then the power spectrum of its $n^{th}$ derivative is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_y(\omega)=\omega^{2n}S_x(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The power of the $n^{th}$ derivative can then be computed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{|y(t)|^2\}=\frac{1}{2\pi}\int_{-\infty}^{\infty}\omega^{2n}S_x(\omega)d\omega\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(assuming convergence of the integral, e.g. by assuming that $x(t)$ is band-limited). Since the mean of the derivative is zero (even if the mean of the original signal isn't), the variance of $y(t)$ equals its power, and so the standard deviation is the square root of the expression in (1).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-15T10:46:15.747" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17359" PostTypeId="2" ParentId="17303" CreationDate="2014-07-15T11:11:10.097" Score="3" Body="&lt;p&gt;My best attempt at this so far is kind of inspired by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Difference_of_Gaussians#Details_and_applications&quot; rel=&quot;nofollow noreferrer&quot;&gt;difference of Gaussians&lt;/a&gt;. I'm putting it as an answer, even though I'm not totally happy with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I made a blurred version of the image using two different Gaussian kernels. One captures the fine detail (small kernel) and the other captures the broad detail (large kernel). These two were then merged. This new blurred image is then subtracted from the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: Made the process iterative, added contrast equalisation and changed blur divide to blur subtract.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output_image = get_input_image()&#xA;&#xA;for i in xrange(4):&#xA;    # Magic numbers&#xA;    sigma_broad = 301&#xA;    sigma_fine  = 5&#xA;    merge_ratio = 0.5&#xA;&#xA;    # Get blur&#xA;    broad_detail = cv2.GaussianBlur(output_image, (sigma_broad, sigma_broad), 0)&#xA;    fine_detail  = cv2.GaussianBlur(output_image, (sigma_fine, sigma_fine), 0)&#xA;    blurred = merge_ratio*broad_detail + (1-merge_ratio)*fine_detail&#xA;&#xA;    # Subtract blur from original (and correct for average drop in intensity)&#xA;    output_image = (output_image + np.mean(blurred)) - blurred&#xA;&#xA;# Contrast equalisation&#xA;clahe = cv2.createCLAHE(clipLimit=1.0, tileGridSize=(4,4))&#xA;output_image = clahe.apply(output_image.astype(np.uint8))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fiQED.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reasons that I'm not totally satisfied with this result:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The information I want is altered. The objects in the ball (e.g. the dark patches) are disproportionally reduced.&lt;/li&gt;&#xA;&lt;li&gt;There are some artefacts.&lt;/li&gt;&#xA;&lt;li&gt;There are lots of magic numbers and parameters to fiddle with. Ideally the algorithm should be robust for a variety of balls.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;ANOTHER UPDATE:&#xA;I had a go at a Laplacian Pyramid filter, which I adapted from &lt;a href=&quot;https://github.com/Itseez/opencv/blob/master/samples/python2/lappyr.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I got decent results, posting mainly for interest. This strategy allows for targeting frequency bands, but it's very fiddly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/x9oNh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7911" LastEditorUserId="7911" LastEditDate="2014-07-24T19:04:55.140" LastActivityDate="2014-07-24T19:04:55.140" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17360" PostTypeId="2" ParentId="17350" CreationDate="2014-07-15T17:18:22.340" Score="2" Body="&lt;p&gt;Correlation between 2 signals means you can say something about one of them by observing the other.&lt;/p&gt;&#xA;&lt;p&gt;If you mean the standard correlation, &lt;span class=&quot;math-container&quot;&gt;$ E \left[ x y \right] $&lt;/span&gt;, it means you knowledge second moment statistics.&lt;br /&gt;&#xA;Which implies one can, using only linear functions, estimate one from the other to some level.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2021-08-13T12:44:37.673" LastActivityDate="2021-08-13T12:44:37.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17362" PostTypeId="1" CreationDate="2014-07-16T05:25:53.190" Score="0" ViewCount="1418" Body="&lt;p&gt;Regarding extraction of MFCC from speech signal...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have checked for the detailed procedure of extraction of MFCC from &lt;a href=&quot;http://practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/&quot; rel=&quot;nofollow&quot;&gt;http://practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each frame they have extracted the features..&#xA;If the signal consists of 100 frames..&#xA;then each frame will give 39 values as such..&#xA;there by we will get a 39 X 100 matrix for a single speech signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how to get 39 MFCC coefficients for the whole single signal?&#xA;People are saying that they have used 39 MFCCs for a signal, How?&lt;/p&gt;&#xA;" OwnerUserId="10477" LastActivityDate="2014-07-16T08:15:18.017" Title="MFCC extraction for speaker verification" Tags="|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17364" PostTypeId="2" ParentId="17362" CreationDate="2014-07-16T08:15:18.017" Score="4" Body="&lt;p&gt;You get a vector of 39 coefficients for each short frame of the signal; not for the entire signal. A speech signal contains segments of voice and silence, and of course when voice is present, there are different phonemes spoken in sequence - so the signal is not stationary and the MFCCs will fluctuate. Extracting the coefficients on a single frame spanning the entire signal would blur all this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also be tempted to compute the average of the MFCC vectors. There are indeed a handful of applications in which this might work (for example categorizing sounds, or very coarse music genre classification), but I don't advise you to do this for speaker verification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In speaker verification or recognition applications, you perform the classification or model scoring for each frame. For example, let us say you have trained a GMM for a speaker, and then are given another signal and want to know if this was spoken by the same person. Extracting the MFCC on the signal will give you a sequence of 100 MFCC vectors. You score each vector with the GMM and make a yes/no decision for each vector. Finally, you use voting to aggregate the decisions over the 100 frames. Or alternatively, you average the GMM scores for the 100 frames and use the result to make the yes/no classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When people report that they have used 39 coefficients, they mean &quot;per frame&quot;.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-07-16T08:15:18.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17365" PostTypeId="1" CreationDate="2014-07-16T09:07:41.183" Score="2" ViewCount="5327" Body="&lt;p&gt;I am trying to train a cascade object detector in MATLAB using the built in functionality from the Computer Vision Toolbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve taken 500 photo’s of the sole of my shoe.  Every photo is taken from the same angle, so there is very little shifting in rotation and scaling from all of the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the negative images I am using 500 photo’s of the background that is behind the shoe in the positive images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I am using the background as the negative photo’s is to train the classifier to overlook the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After I train the cascade classifier with these positive and negative images and apply it to another image of my shoe (taken from the same angle as one of the positive images) the detector does not detect the shoe!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two of the photo's I am using for the negative and positive image (with bounding box shown).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L6V3x.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/84uCx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here is the code I have written that performs this task:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Load Positive Images with Bounding Boxes from the &quot;Training Image Labeler App&quot;&#xA;data = positiveInstances; &#xA;&#xA;% Load Negative Images &#xA;negativeFolder = fullfile('C:\shoes\neg'); &#xA;&#xA;% Train Detector &#xA;trainCascadeObjectDetector('detector.xml', data, negativeFolder); &#xA;&#xA;% Use Detector &#xA;detector = vision.CascadeObjectDetector('detector.xml'); &#xA;test_image = imread('C:\shoes\test.jpg'); &#xA;bbox = step(detector, test_image); &#xA;detectedImage = insertObjectAnnotation(test_image, 'rectangle', ... &#xA;                                       bbox,       'shoe'); &#xA;&#xA;figure; &#xA;imshow(detectedImage)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8919" LastEditorUserId="8919" LastEditDate="2014-07-18T07:42:58.607" LastActivityDate="2015-03-16T02:53:12.897" Title="Train a Cascade Object Detector in MATLAB" Tags="|image-processing|matlab|computer-vision|matlab-cvst|" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="17366" PostTypeId="1" AcceptedAnswerId="17367" CreationDate="2014-07-16T09:45:43.780" Score="3" ViewCount="1826" Body="&lt;p&gt;How would you describe this signal? It's like a sinusoid but as if its frequency was constantly increasing: could you write down a mathematical description? Thanks. And no, this is not homework...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EqQaV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="735" LastActivityDate="2014-07-16T10:05:06.237" Title="Sinusoid with increasing frequency" Tags="|continuous-signals|cosine|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17367" PostTypeId="2" ParentId="17366" CreationDate="2014-07-16T09:59:12.687" Score="6" Body="&lt;p&gt;Frequency is more likely decreasing (period is getting longer). This is a sweep sine signal or as some people used to call it - chirp tone. No point in rewriting the literature, so here are some links with very good explanation for both linear and exponential frequency change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For linear sweep you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=\sin\left(\omega_1t+\frac{\omega_2-\omega_1}{T}\cdot \frac{t^2}{2}\right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\omega_1 $, $\omega_2$ - initial and final angular frequency respectively &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T$  - sweep duration.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Meng Q., et al. - &lt;a href=&quot;http://guillaume.perrin74.free.fr/ChalmersMT2012/Papers/Impulse%20Response/IEEE_2008_LSP_IR_SineSweep.pdf&quot;&gt;&lt;em&gt;Impulse Response Measurement With Sine Sweeps and&#xA;  Amplitude Modulation&#xA;  Schemes&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Farina A. - &lt;a href=&quot;http://pcfarina.eng.unipr.it/Public/Papers/226-AES122.pdf&quot;&gt;&lt;em&gt;Advancements in impulse response measurements by sine&#xA;  sweeps&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-07-16T10:05:06.237" LastActivityDate="2014-07-16T10:05:06.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17372" PostTypeId="1" CreationDate="2014-07-16T10:06:17.613" Score="1" ViewCount="81" Body="&lt;p&gt;I am working on a project to compare images in the database. I use color and gradient orientation as  features of the image and these features are not rotation invariance, therefore to compare well I proposed to warp the images using 5 parameter affine transformation and optimise the 5 parameters to obtain the best match between the images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For image comparison I use histogram matching distance within the range of 0-1 therefore 1 represents the best match. I set the threshold of match to 0.75 (this is the fitness function).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as I am not familiar with simulated annealing method, I am confused if it can be used to optimise the parameters of affine transformation matrix. I read other methods like Genetic algorithm, and cross entropy optizmiation but I found Simulated annealing more understandable but I am not sure if it can do the job. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although this might be a more theoretical question than coding, I just want to confirm my doubts. I have implemented the codes for simulated annealing and it seems to be working well but not that fast in terms of optimisation. Please confirm if u think that theoretical simulated annealing can be used in my project. I have no problem with my coding so I won't put up any codes. &lt;/p&gt;&#xA;" OwnerUserId="10559" OwnerDisplayName="user1965914" LastActivityDate="2014-07-16T11:20:16.977" Title="Affine Parameter Optimization using simulated annealing" Tags="|image-processing|computer-vision|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17373" PostTypeId="2" ParentId="17310" CreationDate="2014-07-16T12:03:46.510" Score="1" Body="&lt;p&gt;I'm inclined to think this is true, but so far I've only gotten a counterexample:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the channel:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{bmatrix}0.5 &amp;amp; 0.5 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0.5 &amp;amp; 0.5 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0.5 &amp;amp; 0.5 \\ 0.5 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0.5\end{bmatrix}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This a typewriter channel. This matrix is not invertible (it has zero determinant, and rank 2). So the ML estimate of $\Theta$ cannot be gotten from this channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for $p \neq 0.5$ I think it could well be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: In fact I think the noisy channel aspect of this may well be a red-herring. The ML estimator of $\Theta$ is as you describe, simply because you have a linear model. You don't need any conditions of $C$ other than it should be invertible (i.e. all rows are linearly independent). &lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="805" LastEditDate="2014-07-16T12:24:33.590" LastActivityDate="2014-07-16T12:24:33.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17374" PostTypeId="1" CreationDate="2014-07-16T15:21:34.507" Score="0" ViewCount="370" Body="&lt;p&gt;I am calculating the average power of a vector. I would like to compare the final expression with the simulation. However, they are not equal. Please help me to point out which steps are wrong. Thank you very much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the average power of a vector: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n) = \sum\limits_{i = 1}^{L - 1} {\sum\limits_{l = 0}^{L - 1} {\frac{1}{L}{e^{ - j2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right){r_l}}}} } {e^{ - j2\pi \frac{i}{L}l}}s\left( {n- \frac{i}{L}N} \right),n = 0,...,N - 1$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $s$ is independent and identically distributed data symbols with zero mean and variance $\sigma _s^2$, $r = ({r_0},...,{r_{L - 1}})$ has Gaussian distribution with mean ${\mu _r}$ and variance $\sigma _r^2$, and $\frac{N}{L}$ is integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The average power of $x$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\bar P = \frac{1}{N}\sum\limits_{n = 0}^{N - 1} {E\left\{ {{{\left| {x\{ n\} } \right|}^2}} \right\}}$ (1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{array}{l}&#xA;E\left\{ {{{\left| {x\{ n\} } \right|}^2}} \right\} = \sum\limits_{i = 1}^{L - 1} {\frac{{\sigma _s^2}}{{{L^2}}}} E\left\{ {{{\left| {\sum\limits_{l = 0}^{L - 1} {{e^{ - j2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right){r_l}}}{e^{ - j2\pi \frac{i}{L}l}}} } \right|}^2}} \right\}\\&#xA; = \sum\limits_{i = 1}^{L - 1} {\frac{{\sigma _s^2}}{{{L^2}}}} \sum\limits_{l = 0}^{L - 1} {\sum\limits_{m = 0}^{L - 1} E } \left\{ {{e^{ - j2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right)({r_l} - {r_m})}}{e^{ - j2\pi \frac{i}{L}(l - m)}}} \right\}&#xA;\end{array}$  (2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When $l=m$, then $E\left\{ {{{\left| {x\{ n\} } \right|}^2}} \right\} = \sum\limits_{i = 1}^{L - 1} {\frac{{\sigma _s^2}}{{{L^2}}}} \sum\limits_{l = 0}^{L - 1} E \left\{ {{e^{ - j2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right)({r_l} - {r_l})}}{e^{ - j2\pi \frac{i}{L}(l - l)}}} \right\} = \frac{{\sigma _s^2}}{{{L^2}}}(L - 1)L = \frac{{\sigma _s^2}}{L}(L - 1)$   (3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When $l \ne m$, then $\begin{array}{l}&#xA;E\left\{ {{{\left| {x\{ n\} } \right|}^2}} \right\} = \sum\limits_{i = 1}^{L - 1} {\frac{{\sigma _s^2}}{{{L^2}}}} \sum\limits_{l = 0}^{L - 1} {\sum\limits_{m = 0\atop&#xA;m \ne l}^{L - 1} E } \left\{ {{e^{ - j2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right){r_l}}}{e^{ - j2\pi \frac{i}{L}l}}} \right\}\left\{ {{e^{j2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right){r_m}}}{e^{ - j2\pi \frac{i}{L}m}}} \right\}\\&#xA; = \sum\limits_{i = 1}^{L - 1} {\frac{{\sigma _s^2}}{{{L^2}}}} ({L^2} - L){\left| {{\Phi _r}\left( {2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right)} \right)} \right|^2} = \frac{{\sigma _s^2}}{L}(L - 1)\sum\limits_{i = 1}^{L - 1} {{{\left| {{\Phi _r}\left( {2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right)} \right)} \right|}^2}} &#xA;\end{array}$    (4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where ${{\Phi _r}\left( {2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right)} \right)}$ is the characteristic function of the random variable $r$, which is defined as (for Gaussian distribution):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;${\left| {{\Phi _r}\left( {2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right)} \right)} \right|^2} = {e^{ - {{\left( {2\pi \left( {\frac{n}{N} - \frac{i}{L}} \right)} \right)}^2}\sigma _r^2}} \approx 1 - 4{\pi ^2}{\left( {\frac{n}{N} - \frac{i}{L}} \right)^2}\sigma _r^2$    (5)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, from (2), (3), (4), and (5), we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{array}{l}&#xA;E\left\{ {{{\left| {x\{ n\} } \right|}^2}} \right\} = \frac{{\sigma _s^2}}{L}(L - 1) + \frac{{\sigma _s^2}}{L}(L - 1)\sum\limits_{i = 1}^{L - 1} {\left( {1 - 4{\pi ^2}{{\left( {\frac{n}{N} - \frac{i}{L}} \right)}^2}\sigma _r^2} \right)} \\&#xA; = \frac{{\sigma _s^2}}{L}(L - 1) + \frac{{\sigma _s^2}}{L}{(L - 1)^2} - \frac{{4{\pi ^2}\sigma _s^2\sigma _r^2}}{L}(L - 1)\sum\limits_{i = 1}^{L - 1} {\left( {\frac{{{n^2}}}{{{N^2}}} - 2\frac{n}{N}\frac{i}{L} + \frac{{{i^2}}}{{{L^2}}}} \right)} \\&#xA; = \frac{{\sigma _s^2}}{L}(L - 1) + \frac{{\sigma _s^2}}{L}{(L - 1)^2} - \frac{{4{\pi ^2}\sigma _s^2\sigma _r^2}}{L}(L - 1)\left( {\frac{{{n^2}}}{{{N^2}}}(L - 1) - 2\frac{n}{N}\frac{{L(L - 1)}}{{2L}} + \frac{{(L - 1)L(2L - 1)}}{{6{L^2}}}} \right)\\&#xA; = \frac{{\sigma _s^2}}{L}(L - 1) + \frac{{\sigma _s^2}}{L}{(L - 1)^2} - \frac{{4{\pi ^2}\sigma _s^2\sigma _r^2}}{L}{(L - 1)^2}\left( {\frac{{{n^2}}}{{{N^2}}} - \frac{n}{N} + \frac{{2L - 1}}{{6L}}} \right)&#xA;\end{array}$     (6)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) and (6), the average power of $x$ becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{array}{l}&#xA;\bar P = \frac{{\sigma _s^2}}{L}(L - 1) + \frac{{\sigma _s^2}}{L}{(L - 1)^2} - \frac{{4{\pi ^2}\sigma _s^2\sigma _r^2}}{{NL}}{(L - 1)^2}\sum\limits_{n = 0}^{N - 1} {\left( {\frac{{{n^2}}}{{{N^2}}} - \frac{n}{N} + \frac{{2L - 1}}{{6L}}} \right)} \\&#xA; = \frac{{\sigma _s^2}}{L}(L - 1) + \frac{{\sigma _s^2}}{L}{(L - 1)^2} - \frac{{4{\pi ^2}\sigma _s^2\sigma _r^2}}{{NL}}{(L - 1)^2}\left( {\frac{{(N - 1)(2N - 1)}}{{6N}} - \frac{{N - 1}}{2} + \frac{{N(2L - 1)}}{{6L}}} \right)&#xA;\end{array}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which steps are not correct?&lt;/p&gt;&#xA;" OwnerUserId="10521" LastEditorUserId="10521" LastEditDate="2014-07-17T11:33:28.030" LastActivityDate="2014-07-17T11:33:28.030" Title="Problem calculating the average power of a vector?" Tags="|power-spectral-density|math|covariance|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17375" PostTypeId="2" ParentId="17176" CreationDate="2014-07-16T16:16:09.757" Score="0" Body="&lt;p&gt;If you have the wavelet toolbox in Matlab you can immediately try:&#xA;[XD,CXD,LXD] = wden(X,TPTR,SORH,SCAL,N,'wname') returns a de-noised version XD of input signal X obtained by thresholding the wavelet coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conceptual explanantion: think of decomposing the signal 'y = x + e' in frequency domain only. In order to attenuate 'e', you must attenuate the coefficients in the frequency spectrum that correspond to 'e' while preserving the coefficients taht correspond to 'x'. When you reconstruct the signal, the contribution of 'e' is reduced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In real world signals, there is always some overlap between coefficients of x and e in the frequency domain. Therefore is not possible to eliminate 'e' without also losing 'x'. i.e. further reduction of noise 'e' comes hand in hand with loss of information 'x'. The strategy here is to use soft-thresholding in the zone where coefficients of 'x' and 'e' overlap so as to achieve the best tradeoff between noise reduction and information preservation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelets improves on frequency domain analysis by using a joint time-frequency (or scale-space) decomposition of the signal. But the core concept of denoising using thresholding remains the same: transform signal into domain where signal and noise a best seperated and then find optimal threshold value that achieve best reconstruction (measured in terms of SNR for example).&lt;/p&gt;&#xA;" OwnerUserId="10491" LastActivityDate="2014-07-16T16:16:09.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17376" PostTypeId="1" CreationDate="2014-07-16T17:14:14.963" Score="0" ViewCount="211" Body="&lt;p&gt;I am research about correlation kernel and I have some questions that need your help. Let see the pp. 3302-3303 in the paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=6517250&amp;amp;tag=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Changyang Li, et al., &lt;em&gt;Robust Model for Segmenting Images With/Without Intensity Inhomogeneities&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The special kernel is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W(|y-x|)=\dfrac{\gamma}{1+\dfrac{1}{\sqrt{2\pi\omega^2}}e^{\dfrac{(y-x)^2}{2\omega^2}}} $$&#xA;where $\gamma$ is a normalizing weight obtained by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\gamma=\left(\int \left( 1+\dfrac{1}{\sqrt{2\pi\omega^2}}e^{\dfrac{(y-x)^2}{2\omega^2}}\right)^{-1} \mathrm{d}y\right)^{-1} $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $\omega$ is a Gaussian kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I implement it with support from Mr. Rayryeng. This is comparison of Gaussian filter (right side) and correlation filter (left side). The gaussian looks like the low pass filter, whereas correlation kernel is as high pass filter. Could you help me explain the purpose of correlation kernel comparison with gaussian kernel? Which is benefit? To what kind of images apply the correlation kernel to? Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CHETY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="8202" LastEditDate="2014-07-16T17:37:58.910" LastActivityDate="2014-07-16T17:37:58.910" Title="What is purpose of correlation kernel? IIs it high pass filter or low pass filter?" Tags="|image-processing|matlab|image-segmentation|gaussian|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17377" PostTypeId="2" ParentId="16876" CreationDate="2014-07-16T19:25:48.360" Score="1" Body="&lt;p&gt;In practice it sounds difficult to measure the amplitude of a 1 MHz signal (or some other very high frequency) with a 1 kHz sampler; in general, the 1 kHz analog-to-digital converter will probably rely on the input voltage being stable for some small fraction of the 1 ms sampling period; if the signal is oscillating 1000 times within that period, it's likely that the sample-and-hold will effect some smoothing/low-pass filtering, or that the conversion may be completely wrong because the signal changed so much during the conversion process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you really do have some very fast sample-and-hold so you can record the level of your high-frequency signal &quot;instantaneously&quot;, then your best strategy might be to sample at random times (preferably without any quantization of the sampling instant).  If you sample at a fixed rate, you run the risk of sampling at an exact multiple of the high-frequency signal's period.  So if you were taking a snapshot of a 1 MHz signal every 1 ms (i.e., every 1000 cycles) -- so your signal periods were exactly 1000:1 -- you'd see the same part of the cycle every time, and you'd have no idea what the actual waveform looked like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is statistically unlikely.  In general, when undersampling a sinusoid, you see what looks like a sinusoid with frequency $\Omega_{alias} = |\Omega_{true} - r.\Omega_{sampling}|$ rad/sec, where $r$ is the integer that makes the result of the expression less than or equal to the nyquist rate, $\Omega_{sampling}/2$ .  Except in the case where some value of $r$ makes this evaluate to zero (aliased signal appears as a constant value), you'll sample a sinusoid whose amplitude follows the true amplitude of the underlying high-frequency signal.  But of course you have no idea what the value of $r$ actually is, so you don't know the true frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, if you want to know the peak amplitude, you're going to need to observe for a complete cycle of $\Omega_{alias}$, which could be arbitrarily small (or zero, as discussed).  But assuming it's somewhat uniformly distributed, the chance of getting an $\Omega_{alias}$ smaller than 1 Hz with 1 kHz sampling is only 1 in 500 (because we have to include -1..1 Hz, i.e. 1/500th of the 1 kHz interval), so for almost every case we'd be fine just taking the largest value over 1 sec.  You could reduce the chance of error by increasing the observation period.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you could have multiple, irrationally-related sampling periods, on the assumption that even if one of them happens to be close to an exact subdivision of the high-frequency period, the others will not.  There will always be a frequency that is the product of each of the individual sampling frequencies that they are all exact submultiples of, but you can make that pretty large if you have more than a few sampling systems.&lt;/p&gt;&#xA;" OwnerUserId="9099" LastActivityDate="2014-07-16T19:25:48.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17378" PostTypeId="1" CreationDate="2014-07-16T19:59:20.200" Score="2" ViewCount="1008" Body="&lt;p&gt;Given a camera, permanently located at the same position, angle and distance from what is being captured, and a single calibration image ( a row of vertical lines [ | | | | ] ), how would one go about using the image to apply correction (barrel distortion) to all subsequent images?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Numerous examples exist online for the camera calibration problem, but most attempt to achieve the correction through guess-work, or highly involved processes to correct real-world images. However, I cannot find anything on calibrating a camera whose position and subject is always at the same position, and where the expected positions of vertical lines are known prior to correction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest I've come to my approach is the plumb-line calibration method described by brown (1971).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any algorithms or pseudo code out there which describes an approach to calibrate using a single input image of vertical lines (where distortion would be clealry visible by the gap between each line)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.rose-hulman.edu/Users/faculty/young/CS-Classes/csse461/handouts/Day21/Brown71.pdf&quot; rel=&quot;nofollow&quot;&gt;Close-Range Camera Calibration - D.C, Brown&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10528" LastActivityDate="2015-09-01T16:56:59.673" Title="Camera Calibration using Single Input Image" Tags="|image-processing|computer-vision|distortion|camera-calibration|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17379" PostTypeId="2" ParentId="17378" CreationDate="2014-07-16T21:27:14.867" Score="1" Body="&lt;p&gt;Is there any reason why you do not want to use multiple calibration images?  Take a look at the &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/find-camera-parameters-with-the-camera-calibrator.html&quot; rel=&quot;nofollow&quot;&gt;Camera Calibrator app&lt;/a&gt; in the Computer Vision System Toolbox for MATLAB. It takes most of the guess-work out of the process.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-07-16T21:27:14.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17380" PostTypeId="1" AcceptedAnswerId="17792" CreationDate="2014-07-17T02:41:59.827" Score="0" ViewCount="749" Body="&lt;p&gt;After clustering in image, I want to visualize the result. To do so, I first reshape an RGB image to 3*size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of BSMC is the set of indices after clustering. So I change the value at the pixel. But the result is not what I wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to show correctly segmentation result?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = imread('image3.jpg');&#xA;%X = imresize(X, 0.2);&#xA;[height width depth] = size(X);&#xA;X = reshape(X, [depth height*width]);&#xA;X = double(X);&#xA;ppp = BSMC(X);&#xA;ppp = ppp.partition;&#xA;&#xA;ppp = BSMC(X, 'initial_partition', ppp);&#xA;ppp = ppp.partition;&#xA;&#xA;for (i = 1:size(ppp, 2) )&#xA;    color = zeros(3, 1);&#xA;    color(1) = randi([0,255]);&#xA;    color(2) = randi([0,255]);&#xA;    color(3) = randi([0,255]);&#xA;&#xA;    for (j = 1:size(ppp(i).indices, 2) )&#xA;        X(:, ppp(i).indices(j) ) = color;&#xA;    end&#xA;end&#xA;&#xA;X = reshape(X, [height width depth]);&#xA;X = uint8(X);&#xA;figure;&#xA;imshow(X);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sTXfm.png&quot; alt=&quot;original image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/wMbxJ.png&quot; alt=&quot;my result&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4367" LastActivityDate="2014-08-15T14:47:02.123" Title="how to visualize image segmentation using matlab" Tags="|matlab|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17381" PostTypeId="2" ParentId="9339" CreationDate="2014-07-17T13:47:41.603" Score="0" Body="&lt;p&gt;The bandwidth of the lowpass filter is the one-sided bandwidth i.e. $B_{LPF} = f_{max}-0$. If you shift this LPF up to some center frequency, $f_c$, then the bandwidth becomes $B=(f_c + B_{LPF}) - (f_c - B_{LPF}) = 2B_{LPF}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the LPF is centered on DC (0 Hz) the we are only considering the one sided bandwidth of real signals - due to the symmetry of positive and negative frequencies. When the filter is shifted up to some non-zero frequency, then you need to consider the frequencies from the other half of the filter. &lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2014-07-21T13:19:25.430" LastActivityDate="2014-07-21T13:19:25.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17383" PostTypeId="1" CreationDate="2014-07-17T14:08:42.553" Score="2" ViewCount="3783" Body="&lt;p&gt;I need to design a filter to reduce noise from accelerometer readings and use this data to a control system. One of the problems of a simple low-pass filter (like a single pole IIR filter) is the delay introduced by the filter. As an alternative I saw many people using a kalman filter or a median filter. I'm very interested in this median filter due to its simple formulation. But then I realize that it will always have some samples lag in the output. For the filter being able to output the present term, it should be able to read N/2 (or (N-1)/2) terms from the future which is obviously not possible in real time systems. So, at best, its output would be N/2 samples late.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference I see in terms of delay between these two filters is that the low-pass may have different delays for different frequencies input while the median-filter has a constant sample lag. The larger the window size is(which is also related to how smooth our output will be), larger will be this lag. So it might be interesting to reconsider a single pole filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that reasoning correct?&lt;/p&gt;&#xA;" OwnerUserId="7389" LastActivityDate="2014-07-17T15:54:19.440" Title="Low-pass vs median filter delay" Tags="|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17384" PostTypeId="2" ParentId="17383" CreationDate="2014-07-17T15:21:48.573" Score="-1" Body="&lt;p&gt;Your reasoning is correct. Note, however, that nobody forces you to use a symmetric window for the median filter. You could use more past values than future values and in this way reduce the delay. You need to experiment with window size and lag to see whether an asymmetrical window gives you sufficient noise reduction.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-07-17T15:21:48.573" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17385" PostTypeId="2" ParentId="17383" CreationDate="2014-07-17T15:54:19.440" Score="4" Body="&lt;p&gt;i would say that your reasoning is a &lt;em&gt;teeny&lt;/em&gt; bit flawed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the delay of an LTI filter is a deterministic function (of frequency) that is unambiguous.  a sinusoid of some known frequency goes in and the sinusoid that comes out will be delayed by a predetermined amount of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a &lt;em&gt;median&lt;/em&gt; filter is &lt;strong&gt;not&lt;/strong&gt; linear.  and, if a sinusoid goes in, it will &lt;strong&gt;not&lt;/strong&gt; be a sinusoid coming out.  let's say that your causal median filter is outputting the median value of the current input sample and the most recent past $N-1$ samples (the &quot;formulation&quot; may seem &quot;simple&quot;, but you're gonna need to repeatedly sort $N$ samples to pick out your median value), you &lt;strong&gt;can&lt;/strong&gt; come up with an &lt;em&gt;expected value&lt;/em&gt; of the delay and, since the sample that is eventually chosen to be the median value can be any one those $N$ samples with equal likelihood, then the &lt;em&gt;expected value&lt;/em&gt; of the delay is $\frac{N-1}{2}$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-07-17T15:54:19.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17386" PostTypeId="1" AcceptedAnswerId="17392" CreationDate="2014-07-17T17:04:58.270" Score="1" ViewCount="4178" Body="&lt;p&gt;I need to draw an outline of text in an image. Consider the below image as an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vfliL.png&quot; alt=&quot;Outline a text in an image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest me a direction to achieve this? I don't have experience in image processing. Any tools/lib or anything that can generate this kind of image will be helpful.&lt;/p&gt;&#xA;" OwnerUserId="10535" LastActivityDate="2014-07-20T22:39:59.387" Title="Draw outline of a text in an image" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17387" PostTypeId="2" ParentId="17158" CreationDate="2014-07-17T18:24:18.180" Score="1" Body="&lt;p&gt;I haven't used the Zernike module from &lt;a href=&quot;http://robots.engin.umich.edu/&quot; rel=&quot;nofollow&quot;&gt;PeRL&lt;/a&gt;'s myself, but check out their implementation &lt;a href=&quot;https://robots.engin.umich.edu/svn/perls/branches/acfr/src/perls-vision/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's written as an OpenCV module and looks well optimized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;! I have no idea what their license on this is, so definitely check before you integrate it into anything you're going to distribute or sell.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-07-17T18:24:18.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17388" PostTypeId="2" ParentId="630" CreationDate="2014-07-17T22:00:01.100" Score="2" Body="&lt;p&gt;There is a generally simple method of whitening a vector $\bf x$ given an example data set. It is not clear from your question if the dimension of $\bf x$ would be 2 or if you are including a sliding temporal window. Anyway you want to decorrelate the components of $\bf x$. Doing it in the frequency domain for such a simple problem is arduous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that you start with an example data set consisting of samples of the data vectors - this might be a set of samples of the two signals at different times. You subtract the data set mean so that the mean of $\bf x$ is zero. Then you need to compute the covariance matrix of the data $C_{ij} = \frac{1}{N}\sum_{{\bf x}\in Data}x_i x_j$ where $N$ is the number of data examples and $i,j$ are indices of the components of $\bf x$, which if there are 2 signals just go from 0 to 1. The covariance matrix in this case will just be 2x2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have this covariance matrix you can compute a whitening transform in the form of a matrix to multiply the data in order to get the whitened version. The covariance of this new whitened data is the identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whitened data will be ${\bf y} = C^{-1/2}{\bf x}$. This is just a matrix version of calculating the variance over an example dataset and then dividing any new data by the square root of the variance in order to normalize its standard deviation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can calculate $C^{-1/2}$ by using Cholesky decomposition where $C=LL^T$. For a 2x2 matrix it is very easy using &lt;a href=&quot;http://metamerist.blogspot.com/2008/03/googlaziness-cholesky-2x2.html&quot; rel=&quot;nofollow&quot;&gt;simple algebra&lt;/a&gt;. The whitened data is given by ${\bf y}=L^{-1}{\bf x}$, which since $L$ is lower triangular can efficiently be computed by common solvers without forming the inverse.&lt;/p&gt;&#xA;" OwnerUserId="10536" LastActivityDate="2014-07-17T22:00:01.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17389" PostTypeId="2" ParentId="17386" CreationDate="2014-07-18T00:41:16.773" Score="1" Body="&lt;p&gt;You just need to binarize the image then find the hull. In Mathematica it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt; ComputationalGeometry`&#xA;img = EdgeDetect@Rasterize[&quot;managers. In\n more lean\n result of\nss\nkforce and\nt \&#xA;points and&quot;]&#xA;pts = Position[ImageData@img, 1]&#xA;pgp = PlanarGraphPlot[pts, ConvexHull@pts][[1, 2]]&#xA;Graphics[{Black, Point@pts, pgp}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ajkbm.png&quot; alt=&quot;The convex Hull&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is inadequate I would find the convex hull of the text two lines at a time, then fuse the results.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-07-18T00:41:16.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17390" PostTypeId="1" AcceptedAnswerId="17391" CreationDate="2014-07-18T00:41:52.967" Score="1" ViewCount="1050" Body="&lt;p&gt;Is there any difference between the terms &lt;em&gt;sample&lt;/em&gt; and &lt;em&gt;sample value&lt;/em&gt; in DSP? In statistics, those are &lt;a href=&quot;https://math.stackexchange.com/q/173337/24265&quot;&gt;very different concepts&lt;/a&gt;: a sample is a subset of a population: it is a set of random variables. A sample value is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Realization_(probability)&quot; rel=&quot;nofollow noreferrer&quot;&gt;realization&lt;/a&gt; (aka. observed value) of this set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xbY5X.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In DSP, I feel that &lt;em&gt;sample&lt;/em&gt; is often used with the same meaning as &lt;em&gt;sample value&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bKFMQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1632" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2014-07-18T00:57:17.483" Title="Sample vs. sample values" Tags="|sampling|terminology|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17391" PostTypeId="2" ParentId="17390" CreationDate="2014-07-18T00:57:17.483" Score="2" Body="&lt;p&gt;Yes, the confusion comes from &lt;em&gt;sampling theory&lt;/em&gt;. Thus, when you &lt;em&gt;sample&lt;/em&gt; a signal, you get ... &lt;em&gt;samples&lt;/em&gt;. If you want to be clear you can call the other one a &lt;em&gt;statistical sample&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-07-18T00:57:17.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17392" PostTypeId="2" ParentId="17386" CreationDate="2014-07-18T03:27:18.807" Score="2" Body="&lt;p&gt;Here's a rudimentary answer using MATLAB that provides a good alternative to the convex hull as Emre has mentioned.  The basic algorithm is the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Binarize the image and invert the text so white is text while black is background&lt;/li&gt;&#xA;&lt;li&gt;Find the minimum spanning bounding boxes for each of the characters&lt;/li&gt;&#xA;&lt;li&gt;Create a new output image that takes the co-ordinates of each of the bounding boxes and fills them in with white.&lt;/li&gt;&#xA;&lt;li&gt;Do a morphological closing with a relatively large structuring square element to mash all of the text into a single object&lt;/li&gt;&#xA;&lt;li&gt;Find the perimeter of this object - This is your boundary of your text&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A small note: I had to play around with the size of my structuring element until the results looked right.  You should choose the size of it based on how big the tallest letter is, and a few more pixels around the structuring element so that when you close, you are able to join neighbouring bounding boxes together.  Also, as noted by Selim Arikan in the comment below, it is recommended to add a few pixels of dilation to the perimeter depending on the typeface size.  I haven't done that in this implementation, but it's fairly simple to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without further ado, here's my code, along with the example image that I used:&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Input Image&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uOyDn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Code&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Clear all varibles and close all windows&#xA;clear all;&#xA;close all;&#xA;&#xA;% Read in image&#xA;imorig = imread('https://i.stack.imgur.com/uOyDn.png');&#xA;&#xA;% Threshold and invert&#xA;im = ~im2bw(imorig);&#xA;&#xA;% Find bounding boxes of all characters&#xA;s = regionprops(im, 'BoundingBox');&#xA;bbox = round(reshape([s.BoundingBox], 4, []).');&#xA;&#xA;% Create a blank image and for each box, fill in with white&#xA;outImg = false(size(im));&#xA;for idx = 1 : size(bbox,1)&#xA;    outImg(bbox(idx,2):bbox(idx,2)+bbox(idx,4), ...&#xA;        bbox(idx,1):bbox(idx,1)+bbox(idx,3)) = true;&#xA;end&#xA;&#xA;% Close with a very large structuring element&#xA;se = strel('square', 20);&#xA;outImg2 = imclose(outImg, se);&#xA;&#xA;% Find the perimeter of this object, then take the original image and&#xA;% the pixels that belong to this boundary.  Colour all of these pixels red&#xA;% for illustration&#xA;redChan = imorig(:,:,1);&#xA;greenChan = imorig(:,:,2);&#xA;blueChan = imorig(:,:,3);&#xA;perim = bwperim(outImg2,8);&#xA;redChan(perim) = 255;&#xA;greenChan(perim) = 0;&#xA;blueChan(perim) = 0;&#xA;out = cat(3,redChan,greenChan,blueChan);&#xA;&#xA;figure;&#xA;subplot(1,2,1);&#xA;imshow(imorig);&#xA;title('Original image');&#xA;subplot(1,2,2);&#xA;imshow(out);&#xA;title('Image with perimeter overlaid');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Output Image&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nbUiI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Edit: July 20th, 2014&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Here is an OpenCV / Python implementation of what I did above.  The main differences are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;code&gt;regionprops&lt;/code&gt; method in MATLAB does not exist in Python / OpenCV.  However, there is a &lt;code&gt;findContours&lt;/code&gt; method which provides a list of points that traces over every boundary of each of the letters in the image.  This is essentially a &lt;strong&gt;list&lt;/strong&gt; of a list of points... woah!  Basically, this returns a list.  For each element in this list, this contains a list of 2D points that trace around a particular object.&lt;/li&gt;&#xA;&lt;li&gt;For each object, I find the minimum and maximum of the rows and columns and this denotes the minimum spanning bounding box for each object.  I then fill in this box with white.&lt;/li&gt;&#xA;&lt;li&gt;It's also a good idea where if an image serves as input into the function, you provide a &lt;strong&gt;copy&lt;/strong&gt; of the image as the input to avoid shadowing and accidental overwriting.  You use the &lt;code&gt;.copy()&lt;/code&gt; method for each of these images.&lt;/li&gt;&#xA;&lt;li&gt;I padded the boundaries of the image by 20 pixels to allow for a tighter boundary as per your request.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You will need the &lt;code&gt;numpy&lt;/code&gt;, &lt;code&gt;scipy&lt;/code&gt; and &lt;code&gt;opencv&lt;/code&gt; modules before you run this method.  If you need help in installing these modules, let me know in a comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without further ado, here's the code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cv2 # For OpenCV modules (Morphology and Contour Finding)&#xA;import numpy as np # For general purpose array manipulation&#xA;&#xA;# Load in image&#xA;img = cv2.imread('uOyDn.png', 0)&#xA;&#xA;# Create a new image that pads each side by 20 pixels&#xA;# This will allow the outlining of the text to be tighter&#xA;# Create an image of all white&#xA;imgPad = 255*np.ones((img.shape[0] + 40, img.shape[1] + 40), &#xA;    dtype='uint8')&#xA;&#xA;# Place the original image in the middle&#xA;imgPad[20:imgPad.shape[0]-20, 20:imgPad.shape[1]-20] = img&#xA;&#xA;# Invert image&#xA;# White becomes black and black becomes white&#xA;imgBW = imgPad &amp;lt; 128&#xA;imgBW = 255*imgBW.astype('uint8')&#xA;&#xA;# Find all of the contours in the image&#xA;contours,hierarchy = cv2.findContours(imgBW.copy(), cv2.RETR_LIST, &#xA;    cv2.CHAIN_APPROX_NONE)&#xA;&#xA;# New image that places square blocks over all letters&#xA;imgBlocks = np.zeros(imgBW.shape, dtype='uint8')&#xA;&#xA;# For each contour...&#xA;for idx in range(len(contours)):&#xA;    # Reshape each contour into a 2D array&#xA;    # First co-ordinate is the column, second is the row&#xA;    cnt = np.reshape(contours[idx], (contours[idx].shape[0], &#xA;        contours[idx].shape[2]))&#xA;    # Transpose to allow for max and min calls&#xA;    cnt = cnt.T&#xA;&#xA;    # Find the max and min of each contour&#xA;    maxCol = np.max(cnt[0])&#xA;    minCol = np.min(cnt[0])&#xA;    maxRow = np.max(cnt[1])&#xA;    minRow = np.min(cnt[1])&#xA;&#xA;    # Use the previous to fill in a minimum spanning bounding&#xA;    # box around each contour&#xA;    for row in np.arange(minRow, maxRow+1):&#xA;        for col in np.arange(minCol, maxCol+1):&#xA;            imgBlocks[row,col] = 255&#xA;&#xA;# Morphological closing on the image with a 20 x 20 structuring element&#xA;structuringElement = cv2.getStructuringElement(cv2.MORPH_RECT, (20,20))&#xA;imgClose = cv2.morphologyEx(imgBlocks.copy(), cv2.MORPH_CLOSE, structuringElement)&#xA;&#xA;# Find the contour of this structure&#xA;contoursFinal,hierarchyFinal = cv2.findContours(imgClose.copy(), cv2.RETR_LIST, &#xA;    cv2.CHAIN_APPROX_NONE)  &#xA;&#xA;# Take the padded image, and draw a red boundary around the font&#xA;# First, create a colour image&#xA;imgPadColour = np.dstack((imgPad, imgPad, imgPad))&#xA;&#xA;# Reshape the contour points like we did before&#xA;cnt = np.reshape(contoursFinal[0], (contoursFinal[0].shape[0], &#xA;    contoursFinal[0].shape[2]))&#xA;&#xA;# Careful - pixels are packed in BGR format&#xA;# As such, for each point in the outer shape, set to red&#xA;for (col,row) in cnt:&#xA;    imgPadColour[row][col][0] = 0&#xA;    imgPadColour[row][col][1] = 0&#xA;    imgPadColour[row][col][2] = 255&#xA;&#xA;# Crop out image for final one&#xA;imgFinal = imgPadColour[20:imgPad.shape[0]-20, 20:imgPad.shape[1]-20]&#xA;&#xA;# Show both images&#xA;cv2.imshow('Original Image', img)&#xA;cv2.imshow('Image with red outline over text', imgFinal)&#xA;cv2.waitKey(0)&#xA;cv2.destroyAllWindows()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The output will show you two windows.  One of the original image, and the other is the output.  You'll need to move one of the windows out of the way, as they will appear one on top of the other.  Note that you need to download the images to your computer before you run this method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l0EPV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8480" LastEditorUserId="8480" LastEditDate="2014-07-20T22:39:59.387" LastActivityDate="2014-07-20T22:39:59.387" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="17394" PostTypeId="1" CreationDate="2014-07-18T09:21:14.423" Score="1" ViewCount="950" Body="&lt;p&gt;For a visual regression test I need to compare screenshots of webpages (different release-versions). I started with pixel by pixel compare. Actually I split the screenshot in different parts (maybe 10x10 rectangles) and compare the histograms of correspondending parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I try to find an approach to find regions of interest (with coordinates and/or bounding box) automatically (tried edge detection and so on) like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BbWEW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://browserbite.com/cross-browser-testing-using-machine-learning/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example of image segmentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found different articles on the web dealing with blob-detection. One method for that is Maximally stable extremal regions (MSER) which is provided in OpenCV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.opencv.org/modules/features2d/doc/feature_detection_and_description.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feature Detection and Description&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is MSER applicable for the given problem&lt;/li&gt;&#xA;&lt;li&gt;Are there simpler approaches then MSER&lt;/li&gt;&#xA;&lt;li&gt;Can someone give me some introductions to use MSER from OpenCV in Java (unfortunately I haven´t experience with OpenCV or JavaCV. Anyway I installed it on my machine.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10538" LastEditorUserId="10538" LastEditDate="2014-07-18T10:25:30.353" LastActivityDate="2014-07-18T10:25:30.353" Title="Visual regression test - Extract elements of GUI-Screenshot - MSER OpenCV" Tags="|image-processing|opencv|image-segmentation|edge-detection|local-features|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17395" PostTypeId="1" CreationDate="2014-07-18T10:34:50.860" Score="4" ViewCount="747" Body="&lt;p&gt;Ok, so suppose I've got a phone with gyroscope, compass and 3-d accelerometer.&#xA;I wanted to track position of the moving phone for about 1 minute with let's say 50 mm accuracy. Actually let's say that I wan't to create some sort of pedometer.&#xA;Is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already know that the signal from accelerometer is too noisy to calculate position through double integration after really small amounts of time because of the giant drift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I want to know if it's possible with some domain knowledge using Kalman filter?&#xA;So in my case I know that the phone would be in the users hand and it wouldn't accelerate more than some amount X m/s^2 and that velocity wouldn't be more than some V m/s and so on. Would that be possible in that case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also how to create covariation matrix for the accelerometer, gyroscope and compass?&lt;/p&gt;&#xA;" OwnerUserId="7936" LastActivityDate="2015-04-09T09:37:17.590" Title="Intertial navigation on android phone with Kalman filter" Tags="|discrete-signals|kalman-filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17396" PostTypeId="2" ParentId="17333" CreationDate="2014-07-18T12:07:16.753" Score="2" Body="&lt;p&gt;The power of the Kalman filter lies in the effect that it predicts the next &quot;state&quot; of the signal/object by using an internal model of the process. That why it is very effective for physical processes, because they can (often) be modelled with quite large precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that you point out that it is impossible to derive a model for your signal renders the effect of using (and even the possibility of using)  Kalman filter usesless/impossible.&lt;/p&gt;&#xA;" OwnerUserId="10539" LastActivityDate="2014-07-18T12:07:16.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17398" PostTypeId="1" AcceptedAnswerId="17405" CreationDate="2014-07-18T15:20:27.287" Score="5" ViewCount="1275" Body="&lt;p&gt;This is my testing image, it is taken from the paper &lt;a href=&quot;https://ieeexplore.ieee.org/document/6457042&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Restoration for Linear Local Motion-Blur Based on Cepstrum&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fen6p.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I tried to transform it into its real cepstrum domain with this simple MATLAB code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cepstrum_img=ifft2(log(1+abs(fft2(img(:,:,1)))));&#xA;imshow((abs(cepstrum_img)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But my result is very weird: The maximum is not at the center of image, they are at the 4 corners. And here is the zoomed-in picture with the  maximum at the left top corner:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nbkpx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;But the result in &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6457042&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; is like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ugOj1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The maximum is actually at the center!!&lt;/p&gt;&#xA;&lt;p&gt;As I didn't do any &lt;code&gt;fftshift&lt;/code&gt; ,  I don't think I need to do any &lt;code&gt;ifftshift&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This makes me so confused. Is there something wrong with my code?&#xA;or my understanding about 2D real cepstrum with DFT?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 1:&lt;/strong&gt; &lt;em&gt;Why do I think that&lt;/em&gt; &lt;code&gt;fftshift&lt;/code&gt; &lt;em&gt;or&lt;/em&gt; &lt;code&gt;ifftshift&lt;/code&gt; &lt;em&gt;is not needed here&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For a length-&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; sequence &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, you do an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-point DFT. You will get another length-&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; sequence &lt;span class=&quot;math-container&quot;&gt;$X[n]$&lt;/span&gt;. The first element of the resulting sequence is corresponded to the zero frequency. Then we do &lt;code&gt;fftshift&lt;/code&gt; to the resulting length-&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; sequence, and we get a third length-&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; sequence &lt;span class=&quot;math-container&quot;&gt;$X'[n]$&lt;/span&gt;, because we want to make the center (may not be at the center if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is even) of the element in &lt;span class=&quot;math-container&quot;&gt;$X'[n]$&lt;/span&gt; corresponded to the zero frequency.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The question is how can you get the original  &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; with IDFT?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\textrm{IDFT}(X[n])$&lt;/span&gt; is right. &lt;span class=&quot;math-container&quot;&gt;$\textrm{IDFT}(X'[n])$&lt;/span&gt; is wrong.&lt;/p&gt;&#xA;&lt;p&gt;Check this MATLAB code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;% the original sequence&#xA;x=1:8&#xA;% this will give you the original sequence&#xA;ifft(fft(x))&#xA;% but this won't&#xA;ifft(fftshift(fft(x)))&#xA;% anyway, the amplitude is the same.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The case would be the same for images and &lt;code&gt;fft2&lt;/code&gt; &amp;amp; &lt;code&gt;ifft2&lt;/code&gt;. i.e.this will get you the original &lt;code&gt;img&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; ifft2(fft2(img))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And if the cepstrum is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C=\mathcal F^{-1}\left\{\ln\left(\lvert \mathcal F\left\{I(x,y)\right\}\rvert\right)\right\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; = &lt;code&gt;img&lt;/code&gt;. This is something like transforming from Fourier domain back to the spatial domain.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2:&lt;/strong&gt; &lt;em&gt;I found where I am wrong..&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;When the papers are saying&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The Cepstrum (Calculated with FT) has the maximum at the center&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I misunderstood it as&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The Cepstrum calculated with DFT &amp;amp; IDFT has the maximum at the&#xA;center&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If the Cepstrum above is really calculated with Fourier transform, the Cepstrum will be with the maximum at the origin. That means if I calculate this with DFT &amp;amp; IDFT,the maximum should be at the corners. The same as FT vs DFT, I have assumed the Cepstrum calculated with DFT should have its maximums at the center. That's where I am wrong.&lt;/p&gt;&#xA;" OwnerUserId="4467" LastEditorUserId="7092" LastEditDate="2022-01-22T14:44:44.607" LastActivityDate="2022-01-22T14:44:44.607" Title="Image 2D Real Cepstrum with DFT, Is `ifftshift` Needed?" Tags="|image-processing|dft|frequency-domain|2d|cepstral-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17399" PostTypeId="1" CreationDate="2014-07-18T16:06:22.047" Score="0" ViewCount="144" Body="&lt;p&gt;A little background: I have an FPGA (running at 200MHz) that I am creating multipath events using buffers, all of that works.  I take RF, mix down to IF, sample, make adjustments, out the DAC, and back up to RF.  I use a windowed-sinc algorithm (like described &lt;a href=&quot;http://www.labbookpages.co.uk/audio/beamforming/fractionalDelay.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do fractional delays, I compute the coefficients in a Java app and pass them to the FPGA.  Each coefficient is a separate tap in the path on the FPGA, and then everything is summed up before outputting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like I mentioned, this all works, but I would like to make it work better.  What I see is that for delays that work out to be closer to the middle of an FPGA clock &quot;bin&quot;, I get the worst results.  When the delay is closer to one of the edges of a bin I get better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a test, I have 2462MHz for my RF, 2437MHz for my LO, and get an IF of 25MHz (just using pure tones out a signal generator).  I have the tone going straight through on one tap, and I sum it with a fractional delay of itself.  I looked at the output signal level on a spectrum analyzer for the first 15 completely out of phase points and plotted the results (in an ideal world they would cancel each other out).  In this image the very first plot is actually where the second tap has a delay of 0 (completely in phase) to give a point of reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XgZ9z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the out of phase signals that fall near the beginning and end of a bin perform pretty well (and seem totally acceptable to me), the ones that fall near the center of a bin have the hardest time cancelling out.  It might be acceptable (and as good as I can do), but I am curious if there is a way to perform better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an FYI, if I look at points within the first 2 periods of the RF signal (not just the 180 degree out of phase points) at 0.05ns increments, it looks very nice and smooth, the only thing that catches your eye is that there is a slight rise to the output, but that can be attributed to the fact that as I go along, I am getting closer to the center of a bin, and the results are getting worse.&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2014-07-18T16:06:22.047" Title="Any way to compensate for fractional delay filter's weakness between taps?" Tags="|filters|filter-design|filtering|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17401" PostTypeId="2" ParentId="17378" CreationDate="2014-07-18T17:10:40.053" Score="0" Body="&lt;p&gt;Yes, it can be done. The quality of results may be so-so, though. I'd recommend taking multiple images of slightly different targets (e.g. varying the spacing and/or the orientation of the lines), then merging the data in a single dataset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the data themselves, my preference would be for a discrete set of well-defined points at known spacing - hence a checkerboard pattern. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see &lt;a href=&quot;https://stackoverflow.com/questions/24527815/barrel-distortion-correcting-image-when-expected-received-control-points-are-k/24536201#24536201&quot;&gt;my other answer&lt;/a&gt; to a similar problem on S.O. for reference.&lt;/p&gt;&#xA;" OwnerUserId="9110" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-07-18T17:10:40.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17403" PostTypeId="2" ParentId="13267" CreationDate="2014-07-19T00:12:29.247" Score="1" Body="&lt;p&gt;I might be wrong, but my guess is that these ripples appear as a result of your chirp function being finite in time, generating discontinuities at both ends of your signal. The classic way to reduce ripples caused by discontinuities is multiplying your signal by a window, making the transition smoother. In Matlab you could try something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;smoothChirp = chirp.*hamming(l);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where l is the length of your signal. Of course the spectrum of your chirp won't have a &quot;flat&quot; characteristic anymore, so in the end we have a trade-off between perfectly linear frequency variation and the appearance of ripples in the signal spectrum.&lt;/p&gt;&#xA;" OwnerUserId="10547" LastActivityDate="2014-07-19T00:12:29.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17404" PostTypeId="1" CreationDate="2014-07-19T04:52:59.217" Score="1" ViewCount="1267" Body="&lt;p&gt;This is just an outline of what I did (assume that all my dimensions fit):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    (code that imports audio to read audio as function x)&#xA;    X=fft(x);&#xA;    (code to define time t and frequency f)&#xA;&#xA;    H=L+M*exp(-1i*2*pi*f*N)+O*exp(-1i*2*pi*f*P);&#xA;    % This is where it gets tricky &#xA;    % In the frequency domain I have the function above where f is the frequency &#xA;    % variable and L M N O P are arbitrary values&#xA;&#xA;    Y=X.*H;   &#xA;    % again assume dimensions fit&#xA;&#xA;    y=real(ifftshift(ifft(Y)*length(t)));&#xA;    %Taking the inverse fft and fftshift was the only way I could get back a signal&#xA;    % Once again assume the dimensions fit &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here L M N O P = [.9 .75 1.0 .5 .5]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gsyVm.jpg&quot; alt=&quot;signal x with respect to time&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/az4Wd.jpg&quot; alt=&quot;output y with respect to time&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this legit? or am I just pulling my own leg?&#xA;Is it an actual &quot;echo?&quot; Or am I just manipulating the signal to make it seem like an echo?&lt;/p&gt;&#xA;" OwnerUserId="10548" LastEditorUserId="10548" LastEditDate="2014-07-20T03:47:15.943" LastActivityDate="2014-07-25T08:18:04.157" Title="Created Matlab echo signal: Is it an actual &quot;echo?&quot; Or am I just manipulating the signal to make it seem like an echo?" Tags="|matlab|fft|audio|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17405" PostTypeId="2" ParentId="17398" CreationDate="2014-07-19T06:43:03.797" Score="2" Body="&lt;p&gt;If you have image in the spatial domain, in order to calculate its DFT transform you should use &lt;code&gt;fft&lt;/code&gt;.&lt;br&gt;&#xA;Once you have its DFT in order to get back to the spatial domain use the function &lt;code&gt;ifft&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, the DFT transform gives you the data in the [0, 2pi] axis.&lt;br&gt;&#xA;Use &lt;code&gt;fftshift&lt;/code&gt; to move it into the [-pi, pi] domain as seen in the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good Luck.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;MATLAB Code&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This code worked for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mInputImage = imread('3.png');&#xA;mInputImage = double(mInputImage) / 255;&#xA;mInputImage = mean(mInputImage, 3);&#xA;&#xA;mImageDft = (fft2(mInputImage));&#xA;&#xA;mImageDft = log(1 + abs(mImageDft));&#xA;&#xA;mImageCepstrum = abs(fftshift(ifft2(mImageDft)));&#xA;&#xA;mImageCepstrum = mImageCepstrum / max(mImageCepstrum(:));&#xA;&#xA;figure();&#xA;imshow(mImageCepstrum);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Enjoy...&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-07-19T07:52:35.450" LastActivityDate="2014-07-19T07:52:35.450" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17407" PostTypeId="2" ParentId="17395" CreationDate="2014-07-19T11:12:43.153" Score="1" Body="&lt;p&gt;The quick answer is that its not really possible to get the position information from a phone IMU with gyroscope, compass and accelerometer. Even with a Kalman filter its too unreliable to get any linear acceleration signal that can be integrated to give position. I have looked at a lot of Kalman filter papers for IMUs and at best, the linear acceleration is treated as a nuisance term. The three sensor IMU with Kalman filter does however give pretty solid 3D rotation estimates.&lt;/p&gt;&#xA;" OwnerUserId="10536" LastActivityDate="2014-07-19T11:12:43.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17409" PostTypeId="1" AcceptedAnswerId="17415" CreationDate="2014-07-19T20:22:24.657" Score="0" ViewCount="2860" Body="&lt;p&gt;Suppose I want to encrypt the voice data before sending using a ham radio, for example &lt;a href=&quot;http://www.weierweiradios.com/home/9-vev-v3288s-vhfuhf.html&quot; rel=&quot;nofollow&quot;&gt;this unit&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the encryption is simply AES encryption/decryption using predefined fixed key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking of the following implementation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Between the radio's transmitter/receiver and its logic unit, I'll place my circuit.&#xA;2) Low pass filter the signal then ADC it (with 10-bit accuracy, but this is irrelevant) with sampling frequency identical to that used by the radio. Ideally, this rate will already be higher than the max. freq. so as to avoid aliasing. &#xA;3) Apply the AES algorithm to each 128-bit segment of data.&#xA;4) DAC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going forward, I would implement some digital signature methods, thus signing the hash of the data, every 100 128-bit segment (or any other number). This will add 512-bit of data every 100*128 bits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: 1) Is there any comment on the implementation, from a signal processing / communication point of view? 2) The added 512-bit signature will decrease the bit rate by (12800-512)/12800 =&gt; 4.16%. Is this a problem? &lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="8825" LastEditDate="2014-07-19T21:03:23.967" LastActivityDate="2014-07-28T17:45:30.403" Title="Adding encryption to a ham radio" Tags="|digital-communications|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17411" PostTypeId="1" AcceptedAnswerId="17412" CreationDate="2014-07-20T03:03:25.337" Score="0" ViewCount="691" Body="&lt;p&gt;in beamforming literature, people generally quote the following as a starting point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(k) = \sum_{i} w_i^*\cdot x_i(k)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i varies from 1 to N where N is the number of sensors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w_i^*$ is the complex conjugate of the ith weight vector&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_i(k)$ is the kth sample received at the ith sensor &lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(k) is the output of the beamformer for kth sample&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is why is the complex conjugate of the weight vector $w_i^*$ used(instead of the complex weight vector $w_i$ iteslf). The literature seems to suggest that it simplifies notation but I can't see how. &lt;/p&gt;&#xA;" OwnerUserId="4673" LastActivityDate="2014-07-20T03:14:56.057" Title="use of complex conjugate of weight vectors in beamforming literature" Tags="|beamforming|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17412" PostTypeId="2" ParentId="17411" CreationDate="2014-07-20T03:14:56.057" Score="1" Body="&lt;p&gt;This comes from the fact that the convolution operator for discrete-time linear systems is typically defined as the inner product between the input signal $x_i(k)$ in your example) and the system's impulse response ($w_i$). &lt;a href=&quot;http://en.wikipedia.org/wiki/Dot_product#Complex_vectors&quot; rel=&quot;nofollow&quot;&gt;The definition of the inner product for complex vectors&lt;/a&gt; includes the conjugation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a \cdot b = \sum a_i b_i^*&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the above definition, note that there doesn't seem to be consistent agreement over which of the arguments to the dot operator gets conjugated, so be careful when reading the literature. For the application of discrete-time FIR filters (which your example is), the typical convention is to conjugate the vector of filter taps, hence the $w_i^*$ term in the sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this convention is not universal in the FIR filtering literature; I have seen papers where the convolution sum for a system with complex-valued impulse response does not include the conjugate operator. However, I prefer to use the form that you showed in your question.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-07-20T03:14:56.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17413" PostTypeId="1" CreationDate="2014-07-20T04:25:29.677" Score="11" ViewCount="1415" Body="&lt;p&gt;The detail-preserving upsampling algorithm in &lt;a href=&quot;https://www.youtube.com/watch?v=S29pVImGNJE&quot;&gt;Photoshop CC&lt;/a&gt; is truly amazing. It can upscale any image while preserving details in almost real-time. And I truly wonder how it is implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've started by searching papers with keywords &lt;code&gt;single image super resolution&lt;/code&gt;. And seems the current state-of-art algorithms require an trained external database to guess the missing high frequency information. And I believe it is really hard to train &amp;amp; distribute a complete dictionary, right? Also, I don't think it's possible to train a dictionary with image pyramid in real-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that I've turned to the area of &lt;code&gt;image upsampling&lt;/code&gt;, which seems fast enough comparing with &lt;code&gt;super resolution&lt;/code&gt; algorithms, but there are so many algorithms, I'm totally lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, does anyone have any guesses or hints on how can that tool is implemented? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="10556" LastEditorUserId="128" LastEditDate="2019-03-18T16:05:38.680" LastActivityDate="2019-03-18T16:05:38.680" Title="What's the Underlying Algorithm for Detail Preserving Upsampling in Photoshop CC?" Tags="|image-processing|algorithms|superresolution|supersampling|reverse-engineering|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17415" PostTypeId="2" ParentId="17409" CreationDate="2014-07-20T15:49:47.967" Score="1" Body="&lt;p&gt;Digital audio data that is transmitted wirelessly is usually encoded in some efficient format. It sounds like you're talking about broadcasting raw PCM samples that are encrypted before transmission. That's certainly unusual. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you are already following some kind of standard that I'm not aware of, you're probably best suited by packing your audio data into the payload some higher-level protocol that includes synchronization data to recover framing, the encryption that you desire, and most likely error correction. Your approach of just encrypting raw PCM samples with no error correction has the unpleasant side effect that a single bit error in the encrypted data will turn your entire block of samples into garbage.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-07-20T15:49:47.967" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17416" PostTypeId="1" AcceptedAnswerId="24238" CreationDate="2014-07-20T17:28:52.037" Score="3" ViewCount="2888" Body="&lt;p&gt;I have recently taken up studying compressive sensing related papers. Some things are not very clear to me or may be I am not able to visualize the scenario as is said. Like how $l_0$ norm minimization is NP hard? Can somebody explain with an example (step by step example may be?) of a matrix and vector for an equation $y=Ax$, how $l_0$ minimization of the same can be NP hard?&lt;/p&gt;&#xA;" OwnerUserId="10566" LastEditorUserId="128" LastEditDate="2018-07-07T22:16:45.760" LastActivityDate="2018-07-07T22:16:45.760" Title="$ {L}_{0} $ Pseudo Norm Minimization in Compressive Sensing" Tags="|compressive-sensing|optimization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17417" PostTypeId="2" ParentId="17413" CreationDate="2014-07-20T19:39:46.647" Score="0" Body="&lt;p&gt;It's really nothing beyond Bi Cubic Interpolation with &quot;Sharpening&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.lynda.com/Photoshop-tutorials/interpolation-settings/124096/140573-4.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.lynda.com/Photoshop-tutorials/interpolation-settings/124096/140573-4.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They haven't updated their interpolation algorithms for ages.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-07-20T19:45:28.037" LastActivityDate="2014-07-20T19:45:28.037" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17418" PostTypeId="1" CreationDate="2014-07-20T20:07:06.127" Score="5" ViewCount="2899" Body="&lt;p&gt;We know that a convolution can be replaced by a multiplication with a Toeplitz / Circulant Matrix. Meaning, assume I have convolution kernel &lt;span class=&quot;math-container&quot;&gt;$ h $&lt;/span&gt; and matrix &lt;span class=&quot;math-container&quot;&gt;$ I $&lt;/span&gt; (Of size &lt;span class=&quot;math-container&quot;&gt;$ m \times m $&lt;/span&gt; for example), then there is a matrix &lt;span class=&quot;math-container&quot;&gt;$ H $&lt;/span&gt; of size &lt;span class=&quot;math-container&quot;&gt;$ m^2 \times m^2 $&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$ h \ast I $&lt;/span&gt; is the same as &lt;span class=&quot;math-container&quot;&gt;$ H I^{cs} $&lt;/span&gt; Where &lt;code&gt;cs&lt;/code&gt; for column stacked image resized to &lt;span class=&quot;math-container&quot;&gt;$m \times m$&lt;/span&gt; (&lt;code&gt;reshape(H*I(:), [m, m])&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is - how to construct &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;? I know that every row of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is responsible for single entry of the resulting multiplication (H(1,:)*I(:) gives the (1,1) entry of the convolution result), so I can try to work very hard to calculate each entry of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; (e.g. if the kernel &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is of size &lt;span class=&quot;math-container&quot;&gt;$3 \times 3$&lt;/span&gt;, than the convolution result in entry (i,j) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ h_{11}\cdot I(i-1,j-1) + h_{12}\cdot I(i-1,j) + h_{13}\cdot I(i-1,j+1) + h_{21}\cdot I(i,j-1) + h_{22}\cdot I(i,j) + h_{23}\cdot I(i,j+1) + h_{31}\cdot I(i+1,j-1) + h_{32}\cdot I(i+1,j) + h_{33}\cdot I(i+1,j+1) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;except for near the edges of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. so it's somewhat possible with a lot of hard work to construct &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; such that when multiplying by &lt;span class=&quot;math-container&quot;&gt;$I^{cs}$&lt;/span&gt; I will get that result). But is there a 'generic' way for this construction? Or perhaps a made MATLAB function? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware of the &lt;a href=&quot;https://www.mathworks.com/help/images/ref/convmtx2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;convmtx2()&lt;/code&gt;&lt;/a&gt; function in MATLAB, but the resulting matrix is not in the proper dimensions (not even square).&lt;/p&gt;&#xA;" OwnerUserId="10372" LastEditorUserId="37293" LastEditDate="2020-03-28T13:21:57.503" LastActivityDate="2022-04-15T11:31:20.493" Title="Generate the Matrix Form of 2D Convolution Kernel" Tags="|image-processing|matlab|convolution|linear-algebra|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17419" PostTypeId="1" CreationDate="2014-07-21T00:41:12.870" Score="0" ViewCount="8968" Body="&lt;p&gt;Is there a library written in C/C++ that offers functions like QPSK modulation?&lt;/p&gt;&#xA;" OwnerUserId="10568" LastActivityDate="2014-07-21T05:54:38.407" Title="C/C++ library for digital modulation" Tags="|modulation|c|digital|" AnswerCount="2" CommentCount="0" ClosedDate="2014-07-28T20:29:44.353" ContentLicense="CC BY-SA 3.0" />
  <row Id="17420" PostTypeId="2" ParentId="17419" CreationDate="2014-07-21T01:49:16.553" Score="1" Body="&lt;p&gt;I have created a C++ library that I haven't officially released yet that could be used for modulation.  It is called &lt;a href=&quot;https://github.com/JimClay/NimbleDSP&quot; rel=&quot;nofollow&quot;&gt;NimbleDSP&lt;/a&gt;.  It doesn't have a function or method called &quot;modulation&quot;, but it does have interpolation and supports complex numbers, so it could easily be used to do modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://liquidsdr.org/&quot; rel=&quot;nofollow&quot;&gt;Liquid-dsp&lt;/a&gt; appears to be a mature SDR library, and it is used by the government framework RED HAWK that was recently open sourced.  My main problem with the library is that it uses the GPL license (may not be a problem for you) and the interface seems complicated.  Having said that, I looked at it fairly briefly so I could be wrong about that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also &lt;a href=&quot;http://spuc.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;SPUC&lt;/a&gt; (Signal Processing Using C++) and &lt;a href=&quot;http://aquila-dsp.org/&quot; rel=&quot;nofollow&quot;&gt;Aquila&lt;/a&gt;.  SPUC is also GPL I believe, but looks to be simpler than liquid-dsp while still being very comprehensive.  Aquila has a very permissive license but has some odd holes in its functionality.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-07-21T01:49:16.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17421" PostTypeId="1" CreationDate="2014-07-21T01:49:52.140" Score="2" ViewCount="122" Body="&lt;p&gt;I have implemented a 2D-&gt;3D point triangulation method, which uses 2 poses P1 and P2 and 2 points back-projected to z=1 point1 and point2 to recover depth:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Matx14d A1 = point1(0) * P1.row(2) - P1.row(0),&#xA;        A2 = point1(1) * P1.row(2) - P1.row(1),&#xA;        A3 = point2(0) * P2.row(2) - P2.row(0),&#xA;        A4 = point2(1) * P2.row(2) - P2.row(1);&#xA;double normA1 = norm(A1), normA2 = norm(A2), normA3 = norm(A3), normA4 = norm(A4);&#xA;Matx44d A(A1(0)/normA1, A1(1)/normA1, A1(2)/normA1, A1(3)/normA1,&#xA;          A2(0)/normA2, A2(1)/normA2, A2(2)/normA2, A2(3)/normA2,&#xA;          A3(0)/normA3, A3(1)/normA3, A3(2)/normA3, A3(3)/normA3,&#xA;          A4(0)/normA4, A4(1)/normA4, A4(2)/normA4, A4(3)/normA4);&#xA;&#xA;SVD svd(A, SVD::MODIFY_A);&#xA;Mat_&amp;lt;double&amp;gt; svdVT = svd.vt;&#xA;Mat smallest = svdVT.row(3);&#xA;double scale = smallest.at&amp;lt;double&amp;gt;(0,3);&#xA;&#xA;if (scale == 0.0)&#xA;    scale = 0.00001;&#xA;&#xA;Point3d point3D(smallest.at&amp;lt;double&amp;gt;(0,0)/scale, smallest.at&amp;lt;double&amp;gt;(0,1)/scale, smallest.at&amp;lt;double&amp;gt;(0,2)/scale);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is based on the book &lt;em&gt;Multiple View Geometry in Computer Vision&lt;/em&gt;.&#xA;However, this doesn't seem to provide the right results visually and in fact, when I calculate the difference between the projected 3D point and the original image point  coordinates, there is an error of &gt;100px.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the problem? Even with synthetic values and transformations I can't get a good enough triangulation.&lt;/p&gt;&#xA;" OwnerUserId="9120" LastEditorUserId="9120" LastEditDate="2014-07-21T01:55:18.610" LastActivityDate="2014-07-21T01:55:18.610" Title="High triangulation error" Tags="|computer-vision|opencv|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17422" PostTypeId="2" ParentId="17419" CreationDate="2014-07-21T05:54:38.407" Score="1" Body="&lt;p&gt;GNU Radio is an SDR platform you can look at.The signal processing blocks in this library are  written in C++. It has all the modulation techniques you need including qpsk. The libraries for digital modulation and demodulation are all well written and tested. The signal processing blocks written in C++ are connected using python. You can just install GNU Radio on your computer and then play around,check if transmission and reception is happening as expected on software without need of any hardware.I have attached the links of gnuradio wiki page and documentation.&#xA;Good Luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://gnuradio.org/redmine/projects/gnuradio/wiki&quot; rel=&quot;nofollow&quot;&gt;http://gnuradio.org/redmine/projects/gnuradio/wiki&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://gnuradio.org/doc/doxygen/index.html&quot; rel=&quot;nofollow&quot;&gt;http://gnuradio.org/doc/doxygen/index.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4375" LastActivityDate="2014-07-21T05:54:38.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17424" PostTypeId="1" AcceptedAnswerId="17427" CreationDate="2014-07-21T08:14:30.970" Score="0" ViewCount="112" Body="&lt;p&gt;I need measure timing of an signal that is send through a noise band limited channel (wireless).&#xA;By measure timing, I mean measure as exactly as possible when the signal has arrived at the receiver. &#xA;My idea is to use a matched filter (correlator) to match some symbol send by the transmitter and then locate the maximum point to find the exact time of arrival. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is this the best way to do it?&lt;/p&gt;&#xA;" OwnerUserId="10570" LastActivityDate="2014-07-22T05:20:35.763" Title="Timing synchronization in limited channel" Tags="|digital-communications|correlation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17425" PostTypeId="1" AcceptedAnswerId="17430" CreationDate="2014-07-21T19:37:08.593" Score="0" ViewCount="183" Body="&lt;p&gt;In the bag of words model, generally is it better to have more codewords or less? For example, if I have 1000 x 20 raw features, then what would be good value for codebooks? I am thinking of smaller size codebook ( such as 20) so that it forces the representation to be sparse.&lt;/p&gt;&#xA;" OwnerUserId="3802" LastActivityDate="2014-07-22T13:44:30.430" Title="How to choose the number of codewords in bag of words model" Tags="|computer-vision|classification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17427" PostTypeId="2" ParentId="17424" CreationDate="2014-07-22T05:14:25.200" Score="1" Body="&lt;p&gt;There are numerous approaches to make timing synchronization at the receiver. Yes, they are based on correlation in general. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But some rought methods also exist, e.g. you can track power of the input signal by two windows, and comparing measured window power values, you can detect begining of the signal. Of course it will work unreliably at bad SNR scenario. And also some time uncertainty will exist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the matched filter is quite good idea. If you are dealing with streaming modem, you can use partly signal periodicity to detect signal at first and then make timing (like it's done in DVB-T for example). If packet modem is your case, you have to use frame header for the detection and timing problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main idea here that if you work with stream you can loose some data, while you are in synchronization process (you can trade off synchronization rapidness and its hardware complexity). But if you work with packet communications you're not allowed to loose frames if it's possible. So you must complete your synchronization with the aid of frame header only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you're not sure about the type of sync symbol yet, try maximum length sequences for example, they are quite common for such a task. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.     &lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2014-07-22T05:20:35.763" LastActivityDate="2014-07-22T05:20:35.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17429" PostTypeId="2" ParentId="11092" CreationDate="2014-07-22T12:50:24.303" Score="5" Body="&lt;p&gt;Unless I'm missing something here it would just be the difference in frequency between the highest frequency sine wave and the lowest:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BW = Fmax - Fmin&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="39" LastActivityDate="2014-07-22T12:50:24.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17430" PostTypeId="2" ParentId="17425" CreationDate="2014-07-22T13:44:30.430" Score="1" Body="&lt;p&gt;It is a trade-off between recall and precision. If you have only one codeword in your codebook then everything will map to it and you will have high recall. If you have 20,000 codewords in your codebook then you will have high precision and low recall. You can use a validation set to try different codebook sizes and see which one works best for your application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a smaller size codebook I don't think that will help you get a sparse feature. It will just mean that more features map onto the same small set of codewords, increasing the recall.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-07-22T13:44:30.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17431" PostTypeId="1" CreationDate="2014-07-22T14:45:01.147" Score="8" ViewCount="6848" Body="&lt;p&gt;Is there a way to compute the main lobe width of windows of the generalized Hamming window family (i.e. Hann, Hamming, etc.)? By &lt;em&gt;main lobe&lt;/em&gt; I mean the first zeros left and right of the center of the Fourier transform of the windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could not find any derivation in any of the standard textbooks. In Oppenheim/Schafer 'Discrete-time signal processing' (2nd Ed., p. 471), only the 'approximate width' of the main lobe is provided without proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to give you some background: Windows of the generalized Hamming window family are given by the following equation:&#xA;$w_H(n) = w_R(n) \cdot (\alpha + 2\beta \cdot cos(\Omega_M n))$ (see e.g. &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Generalized_Hamming_Window_Family.html&quot;&gt;here&lt;/a&gt;), where $w_R(n)$ is the rectangular window of length $M$, and $\Omega_M = \frac{2\pi}{M}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform (FT) of these windows is given by:&#xA;$W_H(\omega) = \alpha W_R(\omega) + \beta W_R(\omega - \Omega_M) + \beta W_R(\omega + \Omega_M)$.&#xA;In this equation $W_R(\omega)$ denotes the Fourier transform of the rectangular window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$W_R(\omega)$ is simply a sinc-function, so $W_H(\omega)$ consists of the sum of three sinc functions with centers at different positions of the frequency axis.&lt;/p&gt;&#xA;" OwnerUserId="8539" LastActivityDate="2016-09-07T20:53:44.337" Title="How to compute the main lobe width of generalized Hamming windows (i.e. Hann, Hamming, etc.)?" Tags="|fourier-transform|window-functions|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="17432" PostTypeId="1" AcceptedAnswerId="17433" CreationDate="2014-07-22T15:09:32.037" Score="12" ViewCount="11394" Body="&lt;p&gt;I know that for the Hough Transform to work on an image, it needs to be a binary image. To convert from a grayscale image, an edge detection algorithm should be employed. I notice that people always use Canny edge detection instead of others (e.g., Sobel). Why is that?&lt;/p&gt;&#xA;" OwnerUserId="8861" LastEditorUserId="7092" LastEditDate="2022-01-22T14:45:12.280" LastActivityDate="2022-01-22T14:45:12.280" Title="Why Is the Canny Edge Detection Used Instead of Sobel / Prewitt Edge Detection Before Hough Transformation?" Tags="|image-processing|computer-vision|hough-transform|canny-edge-detector|image-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17433" PostTypeId="2" ParentId="17432" CreationDate="2014-07-22T16:54:39.913" Score="12" Body="&lt;p&gt;Canny Edge Detection is considered to be a better (In False Alarm sense) edge detection than those you mentioned.&lt;br&gt;&#xA;This is, mainly, due to 2 steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Non Maximum Suppression - Edges candidates which are not dominant in their neighborhood aren't considered to be edges.&lt;/li&gt;&#xA;&lt;li&gt;Hysteresis Process - While moving along the candidates, given a candidate which is in the neighborhood of an edge the threshold is lower.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Those 2 steps reduce the number of &quot;False&quot; edges and hence create a better starting point for farther process like Hough Transformation.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-07-22T16:54:39.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17434" PostTypeId="2" ParentId="179" CreationDate="2014-07-22T19:02:50.263" Score="2" Body="&lt;p&gt;I have made a benchmark on a Freescale K70 (Arm Cortex M4 120MHz) at &#xA;&lt;a href=&quot;https://community.freescale.com/thread/327833&quot; rel=&quot;nofollow&quot;&gt;https://community.freescale.com/thread/327833&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Poul-Erik.&lt;/p&gt;&#xA;" OwnerUserId="10589" LastActivityDate="2014-07-22T19:02:50.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17436" PostTypeId="2" ParentId="17404" CreationDate="2014-07-22T23:26:23.543" Score="1" Body="&lt;p&gt;To generate a repetitive echo all you need to do is pass your signal through an appropriate AR filter with a delay corresponding to the echo period. For instance the following code generates (for a damped 1 Hz sinusoid sampled at 100 Hz) an echo which repeats every 1000 samples. The strength of the echo can be adjusted by the AR filter coefficient (0.5 here)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example Matlab code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% generate 10000 samples of a damped sinusoid at 100 Hz&#xA;sig = sin(2*pi*(0:9999)/100).*exp(-(0:9999)/200);&#xA;&#xA;% AR filter to generate a repetitive echo, period 1000 samples (10 seconds)&#xA;b = 1;&#xA;a= [1 zeros(1,999), 0.5];&#xA;&#xA;echo = filter(b,a,sig);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may want to experiment with your AR filter to match your echo decay. Also look into 'gapped deconvolution'&#xA;&lt;img src=&quot;https://i.stack.imgur.com/k51Cm.jpg&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="10593" LastEditorUserId="8202" LastEditDate="2014-07-23T08:11:30.783" LastActivityDate="2014-07-23T08:11:30.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17437" PostTypeId="1" CreationDate="2014-07-22T23:54:35.410" Score="0" ViewCount="104" Body="&lt;p&gt;I'm a programmer/engineer that is getting into developing prototype wearable technology. I would like to be in a position to interpret raw accelerometer data and categorised the data into activities like running/walking/rest, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The building and coding of the hardware and software is relatively straight forward, but I do not know the terminology and mathematical processes required in order to take the raw data and turn it into a training set that can be used for a real time system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is this: What is a good DSP starting point to take a time based linear series and extract features so that they may be identified at a later stage?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At present, I have an tri-axis accelerometer device which samples at 50Hz with a range of -/+4g. I would like the capability of being able to readily identify activities based upon a training set, or machine learning process, if that's even possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apologies that this isn't necessarily a specific DSP question, thanks for you assistance.&lt;/p&gt;&#xA;" OwnerUserId="10594" LastActivityDate="2015-01-24T20:53:24.170" Title="Introduction to Clustering and Classification of Linear Sequence" Tags="|linear-systems|time-frequency|machine-learning|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17438" PostTypeId="2" ParentId="17431" CreationDate="2014-07-23T01:43:47.697" Score="3" Body="&lt;p&gt;(This used to be a partial answer, but I have edited it to include the requested result at the bottom.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, you can view a Hamming family window as the sum of a Hann window and a rectangular window: If $W_N$ is the fourier transform of a Hann window, then $W_H(\omega)=(\alpha-2\beta)W_R(\omega)+4\beta W_N(\omega)$. If, for simplicity, we assume unit amplitude ($\beta=\frac{1-\alpha}{2}$), then $x:=4\beta=2-2\alpha$ determines the weighting of the Hann window against the rectangular window ($\alpha-2\beta=1-x$ in that case). In the general case, you just need to factor out the coefficient $\alpha+2\beta$ first and let $x:=\frac{4\beta}{\alpha+2\beta}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here is a plot of $W_H$ (green) and its two components for $x=0.5$ (assuming $M=2$, I guess, so that $W_R(\omega)=\frac{\sin \omega}{\omega}$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XZaMU.png&quot; alt=&quot;Hanning window composition for x=0.5&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, giving the Hann window more weight by increasing $x$ also increases the main lobe width. However, plotting this relationship reveals an interesting effect:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yYBUH.png&quot; alt=&quot;Plot of main lobe width depending on weighting factor&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $W_R(2\Omega_M)=W_N(2\Omega_M)=0$, as soon as the Hann window component completely cancels out the first side lobe of the rectangular window component, the main lobe width stays constant at $4\Omega_M$. By calculating the derivatives at this point, it is easy to find out that this is the case for $x\geq\frac{6}{7}$ (equivalently, $\alpha\leq\frac{4}{7}$ in the unit amplitude case, or $3\alpha\leq 8\beta$ in the general case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, from the plot, I haven't successfully guessed anything about the remaining $\frac{6}{7}$. ;-) Hopefully someone else will figure this out, if it is possible at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Don't know why I didn't go for the simplest route first. Maxima (open-source CAS) gives $\Omega_M \sqrt{2\frac{x-2}{x-1}}$ for the remaining part. So, in general, the main lobe width is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{cases}&#xA;2\Omega_M \sqrt{\frac{\alpha}{\alpha-2\beta}} &amp;amp; \text{if } 8\beta&amp;lt;3\alpha\\&#xA;4\Omega_M &amp;amp; \text{otherwise}&#xA;\end{cases}$&lt;/p&gt;&#xA;" OwnerUserId="443" LastEditorUserId="443" LastEditDate="2014-07-31T16:10:01.730" LastActivityDate="2014-07-31T16:10:01.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17439" PostTypeId="1" AcceptedAnswerId="17448" CreationDate="2014-07-23T09:27:11.847" Score="1" ViewCount="1139" Body="&lt;p&gt;I am building a morse code decoder in Python.  I am using SciPy and Numpy for FFT, filter, etc.  It is coming along ok, but the signal is noisy.  I am extracting the dominant frequency from the FFT of the input signal (which is audio from a wav file), and sampling at a rate great enough to detect whether a signal is present at these intervals.  Would I benefit from implementing a filter around this dominant frequency before processing the signal?  If so, what sort of filter, how wide, etc?  The dominant frequency is variable, but I determine it at each invocation programmatically (fft).&lt;/p&gt;&#xA;" OwnerUserId="10591" LastActivityDate="2014-07-24T03:24:54.933" Title="Filtering a Morse code (CW, OOK) signal" Tags="|filters|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17440" PostTypeId="2" ParentId="17378" CreationDate="2014-07-23T09:32:56.053" Score="2" Body="&lt;p&gt;Take a look at this paper here: &quot;Straight lines have to be straight&quot; by Faugeras et al.&#xA;&lt;a href=&quot;http://link.springer.com/article/10.1007/PL00013269#page-1&quot; rel=&quot;nofollow&quot;&gt;http://link.springer.com/article/10.1007/PL00013269#page-1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is straight forward to implement, but essentially removes distortions by observing the straightness of lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be straight forward to implement if you remove some automation (e.g. you click on the lines manually rather than relying on image processing).&lt;/p&gt;&#xA;" OwnerUserId="3603" LastActivityDate="2014-07-23T09:32:56.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17441" PostTypeId="2" ParentId="17439" CreationDate="2014-07-23T12:17:56.517" Score="1" Body="&lt;p&gt;When I did this once I did use a bandpass filter around the estimated tone frequency. I used a fairly large passband. You can use your favorite type of bandpass filter. One thing to check is that if the transmission rate is very fast compared to the tone frequency there may not be that many cycles of the tone when transmitting a dot. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-07-23T12:17:56.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17442" PostTypeId="1" CreationDate="2014-07-23T15:13:02.437" Score="4" ViewCount="1669" Body="&lt;p&gt;I plan to calculate a signal's phase using Goertzel Algorithm. I have 2 signals coming to microcontroller's ADC. Need to measure the phase difference between them. Signals are 15MHz sinusoids. Sample rate will be about 1MHz or lower. Is it possible to use Goertzel with under-sampling? It would be much easier than calculating FFT of both signals, then search for highest beams and count phase of them. Does anyone tried it? &#xA;Here is nice article about Goertzel: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://courses.cs.washington.edu/courses/cse466/12au/calendar/Goertzel-EETimes.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Banks K. - The Goertzel&#xA;  Algorithm&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And here is the code from 'listing1': &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Listing 1: a Goertzel implementation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;&#xA;#define FLOATING    float&#xA;#define SAMPLE  unsigned char&#xA;&#xA;#define SAMPLING_RATE   8000.0  //8kHz&#xA;#define TARGET_FREQUENCY    941.0   //941 Hz&#xA;#define N   205 //Block size&#xA;&#xA;FLOATING coeff;&#xA;FLOATING Q1;&#xA;FLOATING Q2;&#xA;FLOATING sine;&#xA;FLOATING cosine;&#xA;&#xA;SAMPLE testData[N];&#xA;&#xA;/* Call this routine before every &quot;block&quot; (size=N) of samples. */&#xA;void ResetGoertzel(void)&#xA;{&#xA;  Q2 = 0;&#xA;  Q1 = 0;&#xA;}&#xA;&#xA;/* Call this once, to precompute the constants. */&#xA;void InitGoertzel(void)&#xA;{&#xA;  int   k;&#xA;  FLOATING  floatN;&#xA;  FLOATING  omega;&#xA;&#xA;  floatN = (FLOATING) N;&#xA;  k = (int) (0.5 + ((floatN * TARGET_FREQUENCY) / SAMPLING_RATE));&#xA;  omega = (2.0 * PI * k) / floatN;&#xA;  sine = sin(omega);&#xA;  cosine = cos(omega);&#xA;  coeff = 2.0 * cosine;&#xA;&#xA;  printf(&quot;For SAMPLING_RATE = %f&quot;, SAMPLING_RATE);&#xA;  printf(&quot; N = %d&quot;, N);&#xA;  printf(&quot; and FREQUENCY = %f,\n&quot;, TARGET_FREQUENCY);&#xA;  printf(&quot;k = %d and coeff = %f\n\n&quot;, k, coeff);&#xA;&#xA;  ResetGoertzel();&#xA;}&#xA;&#xA;/* Call this routine for every sample. */&#xA;void ProcessSample(SAMPLE sample)&#xA;{&#xA;  FLOATING Q0;&#xA;  Q0 = coeff * Q1 - Q2 + (FLOATING) sample;&#xA;  Q2 = Q1;&#xA;  Q1 = Q0;&#xA;}&#xA;&#xA;&#xA;/* Basic Goertzel */&#xA;/* Call this routine after every block to get the complex result. */&#xA;void GetRealImag(FLOATING *realPart, FLOATING *imagPart)&#xA;{&#xA;  *realPart = (Q1 - Q2 * cosine);&#xA;  *imagPart = (Q2 * sine);&#xA;}&#xA;&#xA;/* Optimized Goertzel */&#xA;/* Call this after every block to get the RELATIVE magnitude squared. */&#xA;FLOATING GetMagnitudeSquared(void)&#xA;{&#xA;  FLOATING result;&#xA;&#xA;  result = Q1 * Q1 + Q2 * Q2 - Q1 * Q2 * coeff;&#xA;  return result;&#xA;}&#xA;&#xA;/*** End of Goertzel-specific code, the remainder is test code. */&#xA;&#xA;/* Synthesize some test data at a given frequency. */&#xA;void Generate(FLOATING frequency)&#xA;{&#xA;  int   index;&#xA;  FLOATING  step;&#xA;&#xA;  step = frequency * ((2.0 * PI) / SAMPLING_RATE);&#xA;&#xA;  /* Generate the test data */&#xA;  for (index = 0; index &amp;lt; N; index++)&#xA;  {&#xA;    testData[index] = (SAMPLE) (100.0 * sin(index * step) + 100.0);&#xA;  }&#xA;}&#xA;&#xA;/* Demo 1 */&#xA;void GenerateAndTest(FLOATING frequency)&#xA;{&#xA;  int   index;&#xA;&#xA;  FLOATING  magnitudeSquared;&#xA;  FLOATING  magnitude;&#xA;  FLOATING  real;&#xA;  FLOATING  imag;&#xA;&#xA;  printf(&quot;For test frequency %f:\n&quot;, frequency);&#xA;  Generate(frequency);&#xA;&#xA;  /* Process the samples */&#xA;  for (index = 0; index &amp;lt; N; index++)&#xA;  {&#xA;    ProcessSample(testData[index]);&#xA;  }&#xA;&#xA;  /* Do the &quot;basic Goertzel&quot; processing. */&#xA;  GetRealImag(&amp;amp;real, &amp;amp;imag);&#xA;&#xA;  printf(&quot;real = %f imag = %f\n&quot;, real, imag);&#xA;&#xA;  magnitudeSquared = real*real + imag*imag;&#xA;  printf(&quot;Relative magnitude squared = %f\n&quot;, magnitudeSquared);&#xA;  magnitude = sqrt(magnitudeSquared);&#xA;  printf(&quot;Relative magnitude = %f\n&quot;, magnitude);&#xA;&#xA;  /* Do the &quot;optimized Goertzel&quot; processing */&#xA;  magnitudeSquared = GetMagnitudeSquared();&#xA;  printf(&quot;Relative magnitude squared = %f\n&quot;, magnitudeSquared);&#xA;  magnitude = sqrt(magnitudeSquared);&#xA;  printf(&quot;Relative magnitude = %f\n\n&quot;, magnitude);&#xA;&#xA;  ResetGoertzel();&#xA;}&#xA;&#xA;/* Demo 2 */&#xA;void GenerateAndTest2(FLOATING frequency)&#xA;{&#xA;  int   index;&#xA;&#xA;  FLOATING  magnitudeSquared;&#xA;  FLOATING  magnitude;&#xA;  FLOATING  real;&#xA;  FLOATING  imag;&#xA;&#xA;  printf(&quot;Freq=%7.1f   &quot;, frequency);&#xA;  Generate(frequency);&#xA;&#xA;  /* Process the samples. */&#xA;  for (index = 0; index &amp;lt; N; index++)&#xA;  {&#xA;    ProcessSample(testData[index]);&#xA;  }&#xA;&#xA;  /* Do the &quot;standard Goertzel&quot; processing. */&#xA;  GetRealImag(&amp;amp;real, &amp;amp;imag);&#xA;&#xA;  magnitudeSquared = real*real + imag*imag;&#xA;  printf(&quot;rel mag^2=%16.5f   &quot;, magnitudeSquared);&#xA;  magnitude = sqrt(magnitudeSquared);&#xA;  printf(&quot;rel mag=%12.5f\n&quot;, magnitude);&#xA;&#xA;  ResetGoertzel();&#xA;}&#xA;&#xA;int main(void)&#xA;{&#xA;  FLOATING freq;&#xA;&#xA;  InitGoertzel();&#xA;&#xA;  /* Demo 1 */&#xA;  GenerateAndTest(TARGET_FREQUENCY - 250);&#xA;  GenerateAndTest(TARGET_FREQUENCY);&#xA;  GenerateAndTest(TARGET_FREQUENCY + 250);&#xA;&#xA;  /* Demo 2 */&#xA;  for (freq = TARGET_FREQUENCY - 300; freq &amp;lt;= TARGET_FREQUENCY + 300; freq += 15)&#xA;  {&#xA;    GenerateAndTest2(freq);&#xA;  }&#xA;&#xA;  return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What changes I should do in the code to play well with under-sampling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&#xA;Mariusz &lt;/p&gt;&#xA;" OwnerUserId="10596" LastEditorUserId="8202" LastEditDate="2014-07-23T15:58:53.367" LastActivityDate="2018-07-04T18:35:47.047" Title="Using Goertzel Algorithm in under-sampling" Tags="|fourier-transform|signal-analysis|dft|sampling|phase|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17443" PostTypeId="1" AcceptedAnswerId="17444" CreationDate="2014-07-23T15:43:45.447" Score="0" ViewCount="759" Body="&lt;p&gt;If I want to amplify a certain frequency in a digital signal, can I just take the FFT, increase the real part of the value for the frequency I want (leaving the imaginary part alone), and then take the inverse FFT?  I am wanting to do this to increase the frequency at which tones are detected, for a Morse code decoder.&lt;/p&gt;&#xA;" OwnerUserId="10591" LastActivityDate="2014-07-23T19:30:20.313" Title="Amplifying part of a signal" Tags="|fft|python|amplitude|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17444" PostTypeId="2" ParentId="17443" CreationDate="2014-07-23T16:45:45.620" Score="2" Body="&lt;p&gt;A few reasons why this is a terrible idea:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Unless your frequency is an exact multiple of the FFT window size, it'll be spread over adjacent FFT bins.&lt;/li&gt;&#xA;&lt;li&gt;You're mentioning Morse code, so your carrier is modulated. This is not a constant tone, it has a changing envelope, and thus, its spectrum is convolved by the spectrum of the envelope. As a result, you won't see just a spectral peak at the carrier frequency. Instead, it'll be spread over a frequency band proportional to the symbol rate.&lt;/li&gt;&#xA;&lt;li&gt;Selectively &quot;editing&quot; FFT coefficients is equivalent to multiplying the spectrum by a function with sharp edges, and thus is equivalent to convolving in the time domain by a window with lots of ripples - causing ringing (&lt;a href=&quot;https://dsp.stackexchange.com/questions/6220/why-is-it-a-bad-idea-to-filter-by-zeroing-out-fft-bins&quot;&gt;More on this here&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Unless you want something ridiculously selective, a bandpass/peaking filter is cheaper in terms of computational cost. Moreover, using the FFT/IFFT approach on long signals (or in realtime) is possible only through the overlap-add method, which is less straightforward to implement than a filter.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Finally, there's no reason why you would want to leave the imaginary part unmodified.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-07-23T16:45:45.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17445" PostTypeId="2" ParentId="16436" CreationDate="2014-07-23T17:49:10.480" Score="2" Body="&lt;h2&gt;Impossible?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;At first glance, it sounds like you are asking for the impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me give you an analogy: let's replace &quot;DC offset&quot; (&quot;0 Hz&quot;) with red marbles, &quot;20 Hz&quot; with green marbles, and &quot;40 Hz&quot; with blue marbles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine Bob dumps all of a jar of red and green marbles into the swimming pool.&#xA;Then Mallory dumps all of a jar of red and blue marbles in the swimming pool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Later, we make a measurement at a single point in time and find roughly 22 thousand red marbles, 10 thousand green marbles, and 5 thousand blue marbles in the pool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So Bob's jar must have had about 10 thousand green marbles in it, and Mallory's jar must have had about 5 thousand blue marbles in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many red marbles did Bob's jar have in it?&#xA;It's not possible to calculate it from the given information.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;more information&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There are several ways to estimate the DC offset of these signals, but all of them require more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Off the top of my head, here are a few:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Somehow measure Bob's red marbles and Mallory's red marbles in isolation, before they are mixed together.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Somehow measure Mallory's red marbles in isolation, and then subtract that number from the total in the pool to estimate Bob's red marbles.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If one of the signals is somehow varying (say, it's connected for a second, then disconnected for a second, then connected again, over and over), then it's &quot;DC&quot; value can be estimated by doing a FFT of the mixture over a very long time, and looking at the the amplitude of mixed signal at the connect/disconnect rate (in this case, the 0.5 Hz bin). The &quot;long time&quot; is necessary to discriminate the 0.5 Hz bin from the ideal 0 Hz bin.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make several measurements at different proportions. After Bob has dumped in half his jar and Mallory has dumped in a quarter of his jar, stop and count the total red marbles in the pool. Then count the total after both jars are completely emptied into the pool.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Try to measure the proportions of green to red. If you grab a handful of marbles from Bob's jar ahead of time, and you count 5 red marbles and 10 green marbles in your hand before returning them to Bob's jar, you can estimate that there are about half as many red marbles as green marbles in Bob's jar. So since we later find out there were about 10 thousand green marbles in Bob's jar, there must have been about 5 thousand red marbles in Bob's jar.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There's probably many other techniques, all requiring more information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="484" LastActivityDate="2014-07-23T17:49:10.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17446" PostTypeId="2" ParentId="17443" CreationDate="2014-07-23T19:30:20.313" Score="0" Body="&lt;p&gt;No.  Amplifying only the real part of an FFT result will only amplify signals that are symmetric in the FFT window.  What if your desired tone happens to be anti-symmetric in that window?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-23T19:30:20.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17447" PostTypeId="2" ParentId="17442" CreationDate="2014-07-23T19:35:02.560" Score="0" Body="&lt;p&gt;If you know the approximate frequency of your signal well enough to know which peak FFT result bin in which it will end up, a complex output Goertzel filter at that bin's frequency over the same length as the FFT will give you the same result for that bin (plus or minus slight numerical differences).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-23T19:35:02.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17448" PostTypeId="2" ParentId="17439" CreationDate="2014-07-23T19:57:53.147" Score="3" Body="&lt;p&gt;The bandwidth of the message content of a CW signal in Hz is roughly at least 4 times the WPM at which the dots and dashes of each Morse Code character are being keyed.  The actual signal may take up a several multiples of that bandwidth, depending on the envelope shaping or the rise/fall time of the CW transmitter used to prevent key clicks. (Plus a few harmonics of a Morse Code dot's AM modulation envelope may be required for a typical radio operator to reliably copy dots by ear, requiring a bandwidth multiple corresponding to that harmonic number).  So any audio filter bandwidth needs to be at least that wide to pass a Morse Code signal, either by measuring the WPM of the signal, or using some maximum WPM expected.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-07-24T03:24:54.933" LastActivityDate="2014-07-24T03:24:54.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17449" PostTypeId="1" CreationDate="2014-05-30T18:57:19.603" Score="3" ViewCount="434" Body="&lt;p&gt;I'm taking a multidimensional discrete cosine transform (&lt;code&gt;FFTW_REDFT11&lt;/code&gt;) in FFTW, and am unsure how to compute the scaling factor.  According to the &lt;a href=&quot;http://www.fftw.org/doc/Real-even_002fodd-DFTs-_0028cosine_002fsine-transforms_0029.html&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;, taking the forward and reverse transforms results in the original image multiplied by a scaling factor:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[C]omputing a transform followed by its inverse yields the original&#xA;  array scaled by N, where N is the logical DFT size. For REDFT00,&#xA;  N=2(n-1); for RODFT00, N=2(n+1); otherwise, N=2n.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The documentation also defines logical arrays for 1D transforms:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[I]f you specify a size-5 REDFT00 (DCT-I) of the data abcde, it&#xA;  corresponds to the DFT of the logical even array abcdedcb of size 8. A&#xA;  size-4 REDFT10 (DCT-II) of the data abcd corresponds to the size-8&#xA;  logical DFT of the even array abcddcba, shifted by half a sample.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what &lt;code&gt;n&lt;/code&gt; is in a multidimensional transform.  Say I have a 10x10 matrix.  Is n twice the total number of pixels (200)?  Or is it the number of pixels in the image if it were reflected in all dimensions (400)?&lt;/p&gt;&#xA;" OwnerUserId="10793" OwnerDisplayName="PyNewb" LastActivityDate="2016-07-16T10:22:31.410" Title="FFTW: Logical array size in r2r transform?" Tags="|dct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17451" PostTypeId="2" ParentId="17442" CreationDate="2014-07-24T04:22:22.633" Score="1" Body="&lt;p&gt;Goertzel algorithm is derived from DFT definition of one frequency bin:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$X(k) = \displaystyle\sum_{m=0}^{N-1} x(n)e^{-j\cdot2\cdot\pi\cdot nk/N}$,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and also it can be rewritten:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$X(k) = \displaystyle\sum_{m=0}^{N-1} x(n)e^{-j\cdot2\cdot\pi\cdot -k(N-n)/N}$, since $W_{N}^{-kN} = 1$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Frome the property above recurrent equation can be derived (there is no sense to show all the conclusion here, I suppose):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$y_r(k) = W_{N}^{-k} \cdot (s(r) + y_{r-1}(k))$,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where $s(r)$ is the sample of the input signal. It is also prooved that $y_r(k) = X(k)$ for $r = N-1$. So after $N$ iterations you have exact DFT bin value $X(k)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the other side FFT also calulates the exact DFT bins. Both of the algorithms exploit DFT equation and DFT properties in the origin to compute frequency bins, there is no approximation. So for both algorithms you will get the equivalent results (the same input signal is assumed, of course). The only differences may occure due to impementation of 2d order IIR filter which is in the core of Goertzel algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.   &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-07-24T04:22:22.633" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17452" PostTypeId="1" AcceptedAnswerId="17454" CreationDate="2014-07-24T07:50:56.963" Score="0" ViewCount="128" Body="&lt;p&gt;I am trying to decode Morse code from an audio (wav) file.  Here is the technique I am using to detect the presence of the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a window of size (sampling_freq/tone), where tone is the frequency of the Morse code tone, as determined by the fft (most prominent tone).  I move this window across the entire recording, and for each window location, I detect if there is any signal above a user-defined threshold by checking the samples in that window (sample freq is 11025, tone is 981 Hz.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This pretty much works, giving dots and dashes where they should appear.  HOWEVER: these dots and dashes are not solid; if I zoom in, there are lots of empty spaces which make it difficult (impossible?) to determine where the real dots and dashes are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix this, or is there a better approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I am detecting where dots and dashes are as: when I detect a signal in the window, I make all the entries in a corresponding output array '1' for that same window.&lt;/p&gt;&#xA;" OwnerUserId="10591" LastEditorUserId="10591" LastEditDate="2014-07-24T08:26:05.927" LastActivityDate="2014-07-24T22:57:21.930" Title="What is wrong with this method of detecting the presence of a signal?" Tags="|filters|digital-communications|python|demodulation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17453" PostTypeId="1" CreationDate="2014-07-24T09:01:25.300" Score="5" ViewCount="20377" Body="&lt;p&gt;I want to design a high pass filter (f0*S/1+f0*S) in order to remove the dc offset from a signal ? (i.e. how to choose the frequency f0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Hacene&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ps : the filter is for MATLAB implementation, this is why i would like to have it in continuous time.&lt;/p&gt;&#xA;" OwnerUserId="10604" LastEditorUserId="128" LastEditDate="2019-03-29T11:36:48.027" LastActivityDate="2019-03-29T11:36:48.027" Title="Designing High Pass Filter to Remove DC Offset from a Signal" Tags="|filter-design|frequency|highpass-filter|" AnswerCount="4" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="17454" PostTypeId="2" ParentId="17452" CreationDate="2014-07-24T14:00:27.430" Score="0" Body="&lt;p&gt;Let's ignore the practical implementation and assume you have a pure sine : $$y = \sin(2\pi x)$$Now assume you shift your window somewhat: $$y=\sin(2\pi x' + \pi/2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly it's still the same signal, but a naive signal detector would find no signal when it should be present, and yet find a signal when there shouldn't be one. How naive is your detector?&lt;/p&gt;&#xA;" OwnerUserId="21" LastEditorUserId="8202" LastEditDate="2014-07-24T14:06:27.380" LastActivityDate="2014-07-24T14:06:27.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17455" PostTypeId="1" AcceptedAnswerId="17492" CreationDate="2014-07-24T15:52:57.477" Score="2" ViewCount="1298" Body="&lt;p&gt;I am trying to teach myself some signal processing and control theory. I'm currently working through &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.124.7043&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;THIS&lt;/a&gt; tutorial. I've started an &lt;a href=&quot;http://nbviewer.ipython.org/github/ahwillia/notebooks/blob/master/ControlTheory.ipynb&quot; rel=&quot;nofollow&quot;&gt;ipython notebook&lt;/a&gt; to keep my notes in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, something is wrong with my very first simulation of a simple first-order low pass filter. The differential equation is&#xA;$$\dot{x} = \omega_0(u-x)$$&#xA;where $u(t)$ is a sinusoidal input. My understanding is that this system is described by the transfer function:&#xA;$$G(s) = \frac{x(s)}{u(s)} = \frac{1}{1+s/\omega_0}$$&#xA;I am interested in using this transfer function to calculate the amplitude and phase lag of $x(t)$. To do this, we evaluate $G$ at $s=i\omega$:&#xA;$$|G(i\omega)| = \frac{|x(t)|}{|u(t)|} = \frac{1}{\sqrt{1+\omega^2/\omega_0^2}}$$&#xA;$$\arg G(i\omega) = \text{phase lag} = -\tan^{-1}\frac{\omega}{\omega_0}$$&#xA;Are the above equations correct? Is my interpretation of them correct? Because when I numerically simulate the above differential equation in python, I get results that do not agree. Particularly, the blue dots and red dots should line up with the black lines &lt;a href=&quot;http://nbviewer.ipython.org/github/ahwillia/notebooks/blob/master/ControlTheory.ipynb&quot; rel=&quot;nofollow&quot;&gt;in my plots&lt;/a&gt;. In other words, I have been unable to reproduce &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.124.7043&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Fig. 3 in this tutorial&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ode is so simple, I don't see how I could have messed up the simulation. You can see my code in the links above. Thanks in advance for any comments/suggestions. (P.S. I hope I picked the right stackexchange site for this question, let me know if I got it wrong).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I have tried decreasing the time step for the numerical integration routine, but this does not improve the fit. The code is still available at the same url: &lt;a href=&quot;http://nbviewer.ipython.org/github/ahwillia/notebooks/blob/master/ControlTheory.ipynb&quot; rel=&quot;nofollow&quot;&gt;[Click here for code]&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7635" LastEditorUserId="7635" LastEditDate="2014-07-26T02:21:09.143" LastActivityDate="2014-07-26T16:41:28.193" Title="Simulation and theory of first-order low pass filter" Tags="|lowpass-filter|python|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17456" PostTypeId="2" ParentId="13951" CreationDate="2014-07-24T16:01:27.463" Score="2" Body="&lt;p&gt;Recall that windowing in the time domain is the equivalent of convolution in the frequency domain. Multiplying a signal in the time domain with a Hanning window is the equivalent of convolving the frequency domain signal with the kernel [-1 2 -1]/4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if $H(f)$ represents the (non-windowed) frequency response, a corresponding windowed frequency response would be:&#xA;$$H_w(f) = -0.25H(f-\Delta f) + 0.5H(f) -0.25H(f+\Delta f)$$&#xA;where $\Delta f$ is the frequency resolution - else you could write this (with $n$ being a frequency index) as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_w[n] = -0.25H[n-1] + 0.5H[n] -0.25H[n+1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;( windowed frequency response in terms of 'non-windowed' frequency response )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the phase difference you are looking for is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;delta_phase = angle(Hw(n)) - angle(H(n))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps &lt;/p&gt;&#xA;" OwnerUserId="10607" LastEditorUserId="8202" LastEditDate="2014-07-24T16:26:01.933" LastActivityDate="2014-07-24T16:26:01.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17458" PostTypeId="1" CreationDate="2014-07-24T18:13:25.660" Score="3" ViewCount="181" Body="&lt;p&gt;I have an image that includes object and background. However, the object appears some inhomogeneity region due to illumination. My work is that how to detect inhomogeneity region. Which is feature can represent it? Example: low inhomogeneity-high/low feature value....Thank you so much&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jWi3z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IPIAN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="128" LastEditDate="2019-03-29T11:35:50.913" LastActivityDate="2019-03-29T11:35:50.913" Title="How to Detect a Inhomogeneity Region in Image" Tags="|computer-vision|image-processing|image-segmentation|information-theory|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17459" PostTypeId="1" CreationDate="2014-07-24T18:31:48.847" Score="4" ViewCount="827" Body="&lt;p&gt;I've just learned that the A/D converter I am using is not sampling at my desired sampling rate.  I request 20 seconds of data at 1920Hz and I receive 38400 points of data that were actually sampled at 1920.93Hz.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, if I sample a 30Hz sine wave and chop the signal up into 300 sections, the phase of the sine wave in section 1 differs from the sine wave in section 300.  If my sampling rate was 1920Hz, as expected, the phase of each section would line up perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to correct for this, is there any way of processing the signal such that it appears as if it was sampled at the correct sampling rate through interpolation or other means?&lt;/p&gt;&#xA;" OwnerUserId="4334" LastEditorUserId="128" LastEditDate="2018-08-22T16:23:18.763" LastActivityDate="2020-12-05T14:55:31.347" Title="Upsample / Downsample a Signal from 1920.93Hz to 1920Hz" Tags="|discrete-signals|sampling|downsampling|decimation|" AnswerCount="3" CommentCount="4" ClosedDate="2014-08-02T01:18:57.290" ContentLicense="CC BY-SA 4.0" />
  <row Id="17460" PostTypeId="1" CreationDate="2014-07-24T18:38:55.043" Score="-1" ViewCount="235" Body="&lt;p&gt;I have come up with a new descriptor(floating point). I want to evaluate this descriptor against SIFT, GLOH, etc etc. I am using the K. Mikolajczyk, C. Schmid, approach.  The method is described in the link &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/research/affine/descriptors.html&quot; rel=&quot;nofollow&quot;&gt;http://www.robots.ox.ac.uk/~vgg/research/affine/descriptors.html&lt;/a&gt;. They have provided the binaries and the data set. I extract the patches(41x41) and apply my descriptor on these patches. But the problem is, these patches are not rotational normalized. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;SIFT achieves rotation in-variance by rotating the patch in the direction of the dominant angle of the patch. My query is ,how to rotate the patch or achieve rotation normalization? I want the original patch(41x41) and the rotated patch to have the same dimension (41x41). For example, If i use the matlab function imrotate and rotate the original patch by 60 degrees. The rotated patch has a dimension bigger than (41x41). And there are blank spaces in the border of the rotated image. I think applying my descriptor on these rotated and enlarged patches gives wrong results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;M question is, How do i rotate the patches or rotational normalize the patch(Such that the original patch and the rotated patch have the same size 41x41) to apply my descriptor?&lt;/p&gt;&#xA;" OwnerUserId="10610" LastActivityDate="2022-03-23T07:03:35.307" Title="Floating point Descriptor evaluation" Tags="|computer-vision|object-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17462" PostTypeId="1" CreationDate="2014-07-24T19:38:57.707" Score="1" ViewCount="952" Body="&lt;p&gt;I've need to remove a DPL/DCS signal from a recording. Roughly speaking, a DCS signal is a low frequency (67.15Hz) square wave sent at the same time, over the same carrier, as speech. Because it is a square wave, it has many strong harmonics that overlap with speech. Obviously, the speech must be preserved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the surface, this seems like a problem that might be solved the same way as removing 60Hz power-line noise: lots of notch filters. However, power-line noise tends to be weaker and comes from a source that is much closer to a sine wave. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is: is there a better way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This link contains more info about DCS: &lt;a href=&quot;http://onfreq.com/syntorx/dcs.html&quot; rel=&quot;nofollow&quot;&gt;http://onfreq.com/syntorx/dcs.html&lt;/a&gt;&#xA;It mentions &quot;Since DCS creates audio harmonics well above 300 Hz (i.e. into the audible portion of the band from 300 to 3000 Hz), radios must have good filters to remove the unwanted DCS noise.&quot; Ha!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: DCS is not a &quot;square wave&quot;. I think the correct way to explain it is to say it's a &lt;a href=&quot;http://en.wikipedia.org/wiki/Non-return-to-zero&quot; rel=&quot;nofollow&quot;&gt;NRZ&lt;/a&gt; binary code clocked at 67.15 Hz.&lt;/p&gt;&#xA;" OwnerUserId="1543" LastEditorUserId="1543" LastEditDate="2014-07-30T20:27:50.623" LastActivityDate="2015-10-19T19:40:36.610" Title="Filtering out unwanted square wave (Radio: DCS/DPL signal)" Tags="|filters|audio|infinite-impulse-response|radio|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17463" PostTypeId="2" ParentId="17459" CreationDate="2014-07-24T19:43:02.193" Score="-1" Body="&lt;p&gt;You can attack this in 2 approaches:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Interpolation.&lt;/li&gt;&#xA;&lt;li&gt;Resample.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3&gt;Interpolation&lt;/h3&gt;&#xA;&lt;p&gt;Build a new time grid as you wish and use Kernel to interpolate data.&lt;br /&gt;&#xA;Since you need to make a small change even a &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linear Interpolation&lt;/a&gt; should work very well.&lt;/p&gt;&#xA;&lt;h3&gt;Resample&lt;/h3&gt;&#xA;&lt;p&gt;You can use Upsample and then Downsample to have any rational sampling rate you want.&lt;/p&gt;&#xA;&lt;p&gt;For example, upsample by a factor of 192000 and then downsample by 192093 to get the sampling rate you wanted.&lt;/p&gt;&#xA;&lt;p&gt;Have a look at:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://cnx.org/content/m10448/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Resampling with Rational Factor&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.dspguru.com/dsp/faqs/multirate/resampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;DSP Guru - Resampling&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;MATLAB - &lt;a href=&quot;http://ttp://www.mathworks.com/help/signal/ref/resample.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;resample()&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;It will be much less efficient than Interpolation.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="54457" LastEditDate="2020-12-05T14:55:31.347" LastActivityDate="2020-12-05T14:55:31.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17464" PostTypeId="2" ParentId="17458" CreationDate="2014-07-24T19:45:32.383" Score="1" Body="&lt;p&gt;There are many properties of inhomogeneity:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Local Variance / STD.&lt;/li&gt;&#xA;&lt;li&gt;Local Histogram.&lt;/li&gt;&#xA;&lt;li&gt;The Gradient Function&lt;/li&gt;&#xA;&lt;li&gt;Histogram of the Gradient.&lt;/li&gt;&#xA;&lt;li&gt;Mean versus the Median / Mode.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-07-24T19:45:32.383" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17465" PostTypeId="2" ParentId="17404" CreationDate="2014-07-24T21:16:20.920" Score="0" Body="&lt;p&gt;Addendum to my earlier post - the AR model for echo generation leads to an infinite number of echos (most of them damped out after a while depending upon the filter coefficient). To generate a finite number of echos use the MA approximation to the AR model, which is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{1}{1 - az^{-N}}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $|a| &amp;lt; 1.0$, and $N$ is the reverberant delay in samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MA approximation (series expansion) of the AR transfer function $H(z)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{MA}(z) = 1 + az^{-N} + a^2z^{-2N} + \ldots$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for instance, to generate just one echo you may want to just filter your signal through an MA filter of the form &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{MA}(z) = 1 + az^{-N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To generate two unequally spaced echoes with differing intensities you could, for example, use an MA filter of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{MA,2}(z) = 1 + az^{-N} + bz^{-M}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matlab code below generates (a) one echo and (b) two unequally spaced echoes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% generate 10000 samples of a damped sinusoid at 100 Hz&#xA;sig = sin(2*pi*(0:9999)/100).*exp(-(0:9999)/200);&#xA;&#xA;% MA filter to generate an echo beginning at 1000 samples (10 seconds)&#xA;a = 1;&#xA;b= [1 zeros(1,999), 0.5];&#xA;&#xA;% generate echo&#xA;reverb1 = filter(b,a,sig);&#xA;&#xA;% MA filter to generate two echos beginning at samples 1000 and 3000&#xA;a = 1;&#xA;b= [1 zeros(1,999), 0.5 zeros(1,1999) 0.25];&#xA;&#xA;% generate signal with 2 echoes&#xA;reverb2 = filter(b,a,sig);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The figure below shows the original signal and the signal with echoes suprimposed from the Matlab output&lt;img src=&quot;https://i.stack.imgur.com/XaiJP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10614" LastEditorUserId="8202" LastEditDate="2014-07-25T08:18:04.157" LastActivityDate="2014-07-25T08:18:04.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17466" PostTypeId="2" ParentId="17459" CreationDate="2014-07-24T22:48:50.850" Score="1" Body="&lt;p&gt;Assuming the signal was reasonably band-limited before sampling, you can just use a high quality interpolation, such as a Sinc interpolation kernel, to calculate new equally spaced points at any lower density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For small frequency deltas, even a long interpolation kernel or high degree polynomial interpolation can be a lot more efficient than naively upsampling and then downsampling.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-24T22:48:50.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17467" PostTypeId="2" ParentId="17452" CreationDate="2014-07-24T22:57:21.930" Score="0" Body="&lt;p&gt;Some statistical analysis of your input signals may be in order.  You need to determine how long an FFT window you need for the tone detection probability to be high enough for your reliability goals, as well as the statistics for the noise level to be low enough to differentiate between signal presence and false-positive noise registration.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-24T22:57:21.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17468" PostTypeId="2" ParentId="4770" CreationDate="2014-07-25T07:10:16.220" Score="1" Body="&lt;p&gt;RAW images do show color. Is green due to the double number of green cells of other basic components (RGB) having a Bayer filter or similar. It is on that where you have to apply the demosaicing algorithms to complete each color plane with values ​​in incomplete depending on their own neighbors pixels RAW image. nACHO (also looking those images)&lt;/p&gt;&#xA;" OwnerUserId="10616" LastActivityDate="2014-07-25T07:10:16.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17469" PostTypeId="2" ParentId="17460" CreationDate="2014-07-25T07:29:42.207" Score="0" Body="&lt;p&gt;You don't. Only circles can be rotated by an arbitrary degree and still have the same shape. A 41x41 image is an axis-aligned square, and only 90 degree rotations keep the shape. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so rotating over 60 degrees means that the width and height needed to fit the square have increased by &lt;code&gt;sqrt(3/2)&lt;/code&gt;..&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-07-25T07:29:42.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17470" PostTypeId="1" AcceptedAnswerId="20392" CreationDate="2014-07-25T08:03:25.127" Score="2" ViewCount="611" Body="&lt;p&gt;I am studying on the implementation of a continuous stream OFDM baseband modem. Googling and also searching here on stackexchange for synchronization techniques I found the descriptions of several existing algorithms, depending on the specific system features, but no detailed implementation of a time-frequency synchronization algorithm for continuous stream systems (like DVB-T/T2, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest any link/reference? Any other information will be welcome of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, many technical papers report synch algorithms for packet oriented systems like 802.11 or WiMax. A continuous stream system should need a less complex synch technique, with the possibility to average the received signal metrics over the time, is my assumption correct?&lt;/p&gt;&#xA;" OwnerUserId="10617" LastEditorUserId="10617" LastEditDate="2014-07-25T10:25:06.583" LastActivityDate="2015-02-06T18:06:32.270" Title="Time-frequency synchronization algorithm for OFDM continuous stream" Tags="|ofdm|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17471" PostTypeId="1" CreationDate="2014-07-25T09:22:41.307" Score="0" ViewCount="883" Body="&lt;p&gt;A plot showing two S21 peaks through a resonator is given below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/REIB8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the first resonance peak occurs at 4.43GHz. The fit applied to this peak is given below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = A - 10 \log_{10} {\left[ 1.0 + \left( 4Q^2 \left(1-\frac{\omega_d}{\omega_0}\right)^2\right) \right]}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This fit gives a nice curve and physically sensible values of $A$, $Q$ and $\omega_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second peak occurs at a frequency close to 4.99GHz. This peak is different to the first, it is a peak sharply followed by a trough. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the second resonance peak at 4.99GHz, are there any tricks for fitting such a peak properly? My main concern is determining the true $A$, $Q$ and $\omega_0$ values for this peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers for any ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if anybody has any ideas why such a resonance peak takes the form of that at 4.99GHz, please share.&lt;/p&gt;&#xA;" OwnerUserId="10619" LastEditorUserId="10636" LastEditDate="2014-07-28T07:53:18.813" LastActivityDate="2015-02-23T12:38:27.370" Title="Lorentzian signal fit" Tags="|signal-analysis|transfer-function|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17472" PostTypeId="1" AcceptedAnswerId="19975" CreationDate="2014-07-25T10:14:57.383" Score="6" ViewCount="429" Body="&lt;p&gt;In The GIMP, and also in photoshop, you have the DODGE/BURN tool to enhance colors in shaded or highlighted regions, which would otherwise be blackish or whiteish. I found empirically that this filter is a good preprocessing step for a computer vision task I am implementing.&lt;/p&gt;&#xA;&lt;p&gt;I found in &lt;a href=&quot;http://losingfight.com/blog/2007/09/27/how-to-implement-dodge-and-burn-tools/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Andy Finnell - How to implement dodge and burn tools&lt;/a&gt; that there are 6 formulas which simply map RGB values to other RGB values independently of channel or pixel location. According to the link the transformation is &lt;code&gt;y=x+0.25*sin(x)&lt;/code&gt; for midtone dodging.&lt;/p&gt;&#xA;&lt;p&gt;However, I could not verify this with the gimp source code, an excerpt from gimpoperationdodgemode.c:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gboolean&#xA;gimp_operation_dodge_mode_process_pixels (gfloat              *in,&#xA;                                      gfloat              *layer,&#xA;                                      gfloat              *mask,&#xA;                                      gfloat              *out,&#xA;                                      gfloat               opacity,&#xA;                                      glong                samples,&#xA;                                      const GeglRectangle *roi,&#xA;                                      gint                 level)&#xA;{&#xA;  const gboolean has_mask = mask != NULL;&#xA;&#xA;  while (samples--)&#xA;    {&#xA;      gfloat comp_alpha, new_alpha;&#xA;&#xA;      comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;&#xA;      if (has_mask)&#xA;    comp_alpha *= *mask;&#xA;&#xA;      new_alpha = in[ALPHA] + (1.0 - in[ALPHA]) * comp_alpha;&#xA;&#xA;      if (comp_alpha &amp;amp;&amp;amp; new_alpha)&#xA;    {&#xA;      gint   b;&#xA;      gfloat ratio = comp_alpha / new_alpha;&#xA;&#xA;      for (b = RED; b &amp;lt; ALPHA; b++)&#xA;        {&#xA;          gfloat comp = in[b] / (1.0 - layer[b]);&#xA;          comp = MIN (comp, 1.0);&#xA;&#xA;          out[b] = comp * ratio + in[b] * (1.0 - ratio);&#xA;        }&#xA;    }&#xA;      else&#xA;    {&#xA;      gint b;&#xA;&#xA;      for (b = RED; b &amp;lt; ALPHA; b++)&#xA;        {&#xA;          out[b] = in[b];&#xA;        }&#xA;    }&#xA;&#xA;      out[ALPHA] = in[ALPHA];&#xA;&#xA;      in    += 4;&#xA;      layer += 4;&#xA;      out   += 4;&#xA;&#xA;      if (has_mask)&#xA;    mask++;&#xA;    }&#xA;&#xA;  return TRUE;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The essence of the code would boil down to these two lines. The other code is for handling transparency of the brush and iterating over pixels and color channels.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gfloat comp = in[b] / (1.0 - layer[b]);&#xA;comp = MIN (comp, 1.0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Suggesting a general formula for all tones and both burn and dodge of  &lt;code&gt;y = x / (1- f(x))&lt;/code&gt;. I could not trace the value of layer[b] back to anything sensible, and hence do not know what &lt;code&gt;f(x)&lt;/code&gt; is supposed to be.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, the Wikipedia page on dodge and burn, and general pages about tone mapping, only mention the principle, but not any formulas.&lt;/p&gt;&#xA;&lt;p&gt;Are there different &lt;em&gt;definitions&lt;/em&gt; of dodge and burn filters? What is the definition, in the form of a formula &lt;code&gt;y=g(x)&lt;/code&gt;, of the gimp tool?&lt;/p&gt;&#xA;" OwnerUserId="10618" LastEditorUserId="7092" LastEditDate="2021-08-23T04:40:04.640" LastActivityDate="2021-09-20T05:49:00.910" Title="What is the Implementation of a Low, Mid or High Tone Dodge or Burn in GIMP?" Tags="|image-processing|color|software-implementation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17473" PostTypeId="1" CreationDate="2014-07-25T11:19:15.973" Score="1" ViewCount="135" Body="&lt;p&gt;I am extracting a property of a signal which I represent with either a 0 for absent or 1 for present. This property is extracted for each data point in a time series and in the end I am left with a binary sequence for each signal. These sequences are somewhat similar, since their origin is related, but they are different signals (not just a delayed version of each other).&#xA;I am currently using cross-correlation to estimate a &quot;delay&quot; between them, but I just read that cross-correlation is mostly suited for delayed versions of the same signal. I would like to know what alternatives I could use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get an example of the data here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/64uci3juok0qrd2/states.mat&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/64uci3juok0qrd2/states.mat&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8664" LastActivityDate="2014-07-25T11:19:15.973" Title="Time delay analysis in different binary sequences" Tags="|matlab|discrete-signals|signal-analysis|cross-correlation|delay|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17474" PostTypeId="2" ParentId="16432" CreationDate="2014-07-25T13:59:59.723" Score="1" Body="&lt;p&gt;By doing PCA, the principal components you will get will not correspond to a single recording, but rather to a mix between them. PCA is a feature extraction method, whereas what you are looking for, seems to me, as a feature selection problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you have so many simultaneous recordings, all affected by the same sources of noise, why not perform active noise cancelation?&lt;/p&gt;&#xA;" OwnerUserId="8664" LastActivityDate="2014-07-25T13:59:59.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17475" PostTypeId="1" AcceptedAnswerId="17488" CreationDate="2014-07-25T15:34:46.733" Score="-1" ViewCount="2571" Body="&lt;p&gt;I have read in all books that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Impulse(n) = 1 when n=0 , 0 otherwise&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So when we state impulse response of signal x(n) I do not understand what is its actual meaning -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it means that for n=1,2,3,4... value of :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(n) . Impulse(0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hence in that case if n &gt;= 0 we would always get y(n)(output) as x(n) as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(n) . Impulse(0) = x(n) . 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Its a known fact that anything into 1 would result in same i.e. the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in many DSP problems I see that impulse response (h(n)) is = (1/2)n(u-3) for example. I am not able to understand what then is the function and technical meaning of Impulse Response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please correct my understanding on same.&lt;/p&gt;&#xA;" OwnerUserId="10384" LastActivityDate="2014-07-26T16:57:49.423" Title="What is meant by Impulse Response" Tags="|impulse-response|dsp-core|" AnswerCount="4" CommentCount="2" ClosedDate="2014-08-02T01:18:18.080" ContentLicense="CC BY-SA 3.0" />
  <row Id="17476" PostTypeId="2" ParentId="17475" CreationDate="2014-07-25T16:28:23.580" Score="-2" Body="&lt;p&gt;A system $\mathcal{G}$ is said linear and time invariant (LTI) if it is linear and its behaviour does not change with time or in other words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linearity&#xA;   $$\mathcal{G}[k_1i_1(t)+k_2i_2(t)] = k_1\mathcal{G}[i_1]+k_2\mathcal{G}[i_2]$$ &#xA;Time Invariance (a delay in the input corresponds to a delay in the output)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n-r) = \mathcal{G}[i(n-r)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $i$'s are input functions and k's are scalars and y output function. Now in general a lot of systems belong to/can be approximated with this class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important fact that I think you are looking for is that these systems are completely characterised by their impulse response. The impulse is the function you wrote, in general the impulse response is how your system reacts to this function: you take your system, you feed it with the impulse and you get the impulse response as the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you keep the impulse response: when your system is fed with another input, you can calculate the new output by performing the convolution in time between the impulse response and your new input. That is why the system is completely characterised by the impulse response: whatever input function you take, you can calculate the output with the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another important fact is that if you perform the Fourier Transform (FT) of the impulse response you get the behaviour of your system in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering this, you can calculate the output also by taking the FT of your input, the FT of the impulse response, multiply them (in the frequency domain) and then perform the Inverse Fourier Transform (IFT) of the product: the result is the output signal of your system.&lt;/p&gt;&#xA;" OwnerUserId="10622" LastEditorUserId="10622" LastEditDate="2014-07-25T17:10:28.753" LastActivityDate="2014-07-25T17:10:28.753" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17477" PostTypeId="1" AcceptedAnswerId="17505" CreationDate="2014-07-25T16:28:54.797" Score="1" ViewCount="1958" Body="&lt;p&gt;I am reading a paper, in which the author defines gabor kernels as :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\psi_{\mu,\nu}(x,y)=\frac{\lVert \mathbf{k}_{\mu,\nu} \rVert}{\sigma^{2}}\exp \left(-\frac{\lVert \mathbf{k}_{\mu,\nu}\rVert^{2}\lVert \mathbf{z}\rVert^{2}}{2\sigma^{2}}\right)\times\left[\exp\left(i\mathbf{k}_{\mu,\nu}^{T}\mathbf{z}\right)-\exp\left(-\frac{\sigma^{2}}{2}\right)\right]&#xA;$$&#xA;where $\mu$ and $\nu$ define the orientation and scale of tghe Gabor kernels, respectively, $\mathbf{z}=(x,y)^{T}$, and the wave vector is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{k}_{\mu,\nu} = \left(k_{\nu}\cos{\phi_{\mu}},k_{\nu}\sin{\phi_{\mu}}\right)^{T}&#xA;\quad\text{with}\quad k_{\nu} = \frac{k_{\rm max}}{f^{\nu}}, k_{\rm max}=\frac{\pi}2,f=\sqrt{2},\quad\text{and}\quad\phi_{\mu}=\frac{\pi\mu}{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I want to plot the graph of this function using matlab to visually see and understand the Gabor filter. I have very basic knowledge in using matlab.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I am interested in viewing these Gabor Kernels at single scale $(\nu=0)$ and four orientations $(\mu\in\{0,2,4,6\})$ with $\sigma=1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now I am trying to understand Gabor filters. Any help will be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="10621" LastEditorUserId="1629" LastEditDate="2016-09-10T16:19:55.050" LastActivityDate="2016-09-10T16:19:55.050" Title="How to visualize and understand Gabor filter using MATLAB" Tags="|matlab|filters|gabor|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17478" PostTypeId="2" ParentId="17453" CreationDate="2014-07-25T21:04:14.050" Score="2" Body="&lt;p&gt;If the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;DFT&lt;/a&gt; is the Uniform sampling from $ 0 $ to $ 2 \pi $ then the first bin is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[k] = \sum_{n = 0}^{N - 1} x[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely it is the sum of all the samples.&lt;br&gt;&#xA;Hence in order to remove the DC (Mean) all you need is a filter which has zero in its DC bin.&#xA;Since, the filtered signal, which is a convolution (Circular) of the DFT of the input signal and the filter will have zero at the first bin which means the sum of the output is zero which means its mean is also zero, as wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple and intuitive FIT would be an FIR with the length of signal which removes from the current sample the mean of all samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[m] = x[m] - \frac{1}{N} \sum_{n = 0}^{N - 1} x[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a simple FIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pay attention I assumed you have all the samples.&#xA;If you don't, you need to make this FIR casual by only &quot;Calculating&quot; the sum of given samples.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-07-25T21:04:14.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17479" PostTypeId="2" ParentId="17471" CreationDate="2014-07-25T21:44:58.817" Score="1" Body="&lt;p&gt;What you have for your 2nd 'resonance' is actually a vibrational mode with a transfer function of the form ('s' being the Laplace variable)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H(s) = (s^2 + 2*zeta1*omega1*s + omega1^2) / (s^2 + 2*zeta2*omega2*s + omega2^2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The denominator 'omega2' term corresponds to the peak at 4.99GHz, and the numerator 'omega1' term corresponds to the deep trough that follows the peak at 4.99 GHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can demonstrate this behavior in Matlab very simply using the code below&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;zeta1 = .01; omega1 = 1.02; zeta2 = .011; omega2 = 1.0; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;num = [1 2*zeta1*omega1 omega1^2];&lt;/p&gt;&#xA;&#xA;&lt;p&gt;den = [1 2*zeta2*omega2 omega2^2];&lt;/p&gt;&#xA;&#xA;&lt;p&gt;freqs(num,den)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The frequency response is shown in the figure below which mimics your 2nd 'resonance'.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hIkfJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do for your 2nd 'resonance' is to estimate 4 (not 2) parameters, viz., omega2 and zeta2 (for the peak) and omega1 and zeta1 (for the trough). Depending on your data a nonlinear least squares optimization scheme should do. As a start, you could assume zeta1 and zeta2 to be equal (say zeta) and get an initial estimate of the terms 'omega1' and 'omega2' from your graph (or data). This leaves you with solving for just 'zeta'. Then you could iterate the model to get zeta1 and zeta2, etc., etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the 'Q' term that you used is directly related to the quantity 'zeta' in my exposition here.&lt;/p&gt;&#xA;" OwnerUserId="10614" LastEditorUserId="-1" LastEditDate="2014-07-27T05:00:34.580" LastActivityDate="2014-07-27T05:00:34.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17480" PostTypeId="2" ParentId="17475" CreationDate="2014-07-26T00:16:37.867" Score="-5" Body="&lt;p&gt;Have just &lt;a href=&quot;https://en.wikibooks.org/wiki/Talk:Control_Systems/Transfer_Functions#Eigenvector_treatment&quot; rel=&quot;nofollow noreferrer&quot;&gt;complained today that dons expose the topic very vaguely&lt;/a&gt;. I advise you to read that along with the glance at &lt;a href=&quot;https://en.wikipedia.org/wiki/Talk:Convolution#Why_the_time_inversion.3F&quot; rel=&quot;nofollow noreferrer&quot;&gt;time diagram&lt;/a&gt;. Basically, if your question is not about Matlab, input response is a way you can compute response of your system, given input $\vec x = [x_0, x_1, x_2, \ldots x_t \ldots]$. That is a vector with a signal value at every moment of time. That is a waveform (or PCM encoding) of your known signal and you want to know what is response $\vec y = [y_0, y_2, y_3, \ldots y_t \ldots]$. This is a vector of unknown components. Again, every component specifies output signal value at time t. The idea is that you can compute $\vec y$ if you know the response of the system for a couple of test signals and how your input signal is composed of these test signals. You should be able to expand your $\vec x$ into a sum of test signals (aka basis vectors, as they are called in Linear Algebra).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I advise you to look at Linear Algebra course which teaches that every vector can be represented in terms of some chosen basis vectors $\vec x_{in} = a\,\vec b_0 + b\,\vec b_1 + c\, \vec b_2 + \ldots$. Here, &lt;code&gt;a&lt;/code&gt; is amount of vector $\vec b_0$ in your signal, &lt;code&gt;b&lt;/code&gt; is amount of vector $\vec b_1$ in your signal and so on. There is noting more in your signal. It is just a weighted sum of these basis signals. You may call the coefficients [a, b, c, ..] the &quot;specturm&quot; of your signal (although this word is reserved for a special, fourier/frequency basis), so $[a, b, c, ...]$ are just &lt;a href=&quot;http://en.wikipedia.org/wiki/Coordinate_vector&quot; rel=&quot;nofollow noreferrer&quot;&gt;coordinates&lt;/a&gt; of your signal in basis $[\vec b_0 \vec b_1 \vec b_2]$. The point is that &lt;strike&gt;the systems are just &quot;matrices&quot; that transform applied vectors into the others, like functions transform input value into output value&lt;/strike&gt;. once you have measured response of your system to every $\vec b_i$, you know the response of the system for your $\vec x.$ That is it, by virtue of system linearity. That is, suppose that you know (by measurement or system definition) that system maps $\vec b_i$ to $\vec e_i$. Your output will then be $\vec x_{out} = a \vec e_0 + b \vec e_1 + \ldots$! Voila! However, the impulse response is even greater than that. It allows to know every $\vec e_i$ once you determine response for nothing more but $\vec b_0$ alone!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basis vectors for impulse response are $\vec b_0 = [1 0 0 0 ...], \vec b_1= [0 1 0 0 ...], \vec b_2 [0 0 1 0 0...]$ and etc. That is, your vector [a b c d e ...] means that you have a of [1 0 0 0 0] (a pulse of height a at time 0), b of [0 1 0 0 0 ...] (pulse of height b at time 1) and so on. The system system response to the reference impulse function $\vec b_0 = [1 0 0 0 0]$ (aka $\delta$-function) is known as $\vec h = [h_0 h_1 h_2 \ldots]$. It looks like a short onset, followed by infinite (excluding FIR filters) decay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I84t8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a picture I advised you to study in the convolution reference. Here is why you do convolution to find the output using the response characteristic $\vec h.$ As you see, it is a vector, the waveform, likewise your input $\vec x$. These signals both have a value at every time index. The reaction of the system, $h$, to the single pulse means that it will respond with $[x_0, h_0, x_0 h_1, x_0 h_2, \ldots] = x_0 [h_0, h_1, h_2, ...] = x_0 \vec h$ when you apply the first pulse of your signal $\vec x = [x_0, x_1, x_2, \ldots]$. The first component of response is the output at time 0, $y_0 = h_0\, x_0$. The rest of the response vector is contribution for the future. You will apply other input pulses in the future. They will produce other response waveforms. But, the system keeps the past waveforms in mind and they add up. That is, at time 1, you apply the next input pulse, $x_1$. It will produce another response, $x_1 [h_0, h_1, h_2, ...]$. The output at time 1 is however a sum of current response, $y_1 = x_1 h_0$ and previous one $x_0 h_1$. The output of a signal at time t will be the integral of responses of all input pulses applied to the system so far, $y_t = \sum_0 {x_i \cdot h_{t-i}}.$ That is a convolution. This operation must stand for . in your example (you are right that convolving with const-1 would reproduce x(n) but seem to confuse zero series 10000... with identity 111111..., impulse function with impulse response and Impulse(0) with Impulse(n) there). I have told you that [1,0,0,0,0..] provides info about responses to all other basis vectors, e.g. [0,1,0,0,0,...], because shifted (time-delayed) input implies shifted (time-delayed) output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, frequency domain is more natural for the convolution, if you read about eigenvectors. However, because pulse in time domain is a constant 1 over all frequencies in the spectrum domain (and vice-versa), determined the system response to a single pulse, gives you the frequency response for all frequencies (frequencies, aka sine/consine or complex exponentials are the alternative basis functions, natural for convolution operator). Basically, it costs t multiplications to compute a single components of output vector and $t^2/2$ to compute the whole output vector. In the frequency domain, by virtue of eigenbasis, you obtain the response by simply pairwise multiplying the spectrum of your input signal, X(W), with frequency spectrum of the system impulse response H(W).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope, this will make things clear.&lt;/p&gt;&#xA;" OwnerUserId="4701" LastEditorUserId="4701" LastEditDate="2014-07-26T09:40:29.657" LastActivityDate="2014-07-26T09:40:29.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17482" PostTypeId="1" CreationDate="2014-07-26T02:09:53.050" Score="1" ViewCount="288" Body="&lt;p&gt;It seems to be &lt;a href=&quot;http://www.analog.com/library/analogdialogue/anniversary/15.html&quot; rel=&quot;nofollow&quot;&gt;reasonably&lt;/a&gt; &lt;a href=&quot;http://e2e.ti.com/support/data_converters/precision_data_converters/f/73/t/160037.aspx&quot; rel=&quot;nofollow&quot;&gt;well&lt;/a&gt; &lt;a href=&quot;http://www.ni.com/white-paper/11342/en/&quot; rel=&quot;nofollow&quot;&gt;accepted&lt;/a&gt; that Sigma-Delta ADCs have much looser requirements for the anti-aliasing filter due to both the &lt;a href=&quot;http://en.wikipedia.org/wiki/Delta-sigma_modulation&quot; rel=&quot;nofollow&quot;&gt;noise shaping&lt;/a&gt; and high modulation frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it seems to implicitly assume that the input signal is continually sampled by the converter.  Many sigma-delta ADCs such as the &lt;a href=&quot;http://www.ti.com/product/ads1256&quot; rel=&quot;nofollow&quot;&gt;TI ADS1256&lt;/a&gt; and &lt;a href=&quot;http://www.analog.com/en/analog-to-digital-converters/ad-converters/ad7192/products/product.html&quot; rel=&quot;nofollow&quot;&gt;Analog Devices AD7192&lt;/a&gt; have an input mux.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume that four signals are connected to the mux, and each is given one quarter of the time on the actual converter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the mux, the signal is no longer being continually converted, but is being sampled, albeit for long periods of time.  Since it is no longer being continually integrated, how does this affect the anti-aliasing requirements for the converter?  Is there a reference that goes through this case in detail?&lt;/p&gt;&#xA;" OwnerUserId="1904" LastEditorUserId="21075" LastEditDate="2020-05-01T13:10:22.570" LastActivityDate="2020-05-01T13:10:22.570" Title="Anti-aliasing requirements for a Muxed Sigma-Delta Converter" Tags="|sampling|anti-aliasing-filter|delta-sigma|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17483" PostTypeId="2" ParentId="17459" CreationDate="2014-07-26T03:08:27.290" Score="1" Body="&lt;p&gt;I would have rather this be a comment but due to a lack of reputation I cannot do such.&lt;br /&gt;Anyways I all wanted to say was:&lt;br /&gt;Instead of worrying about how to resample the data just yet, have you tried correcting your code or investigating why you are getting too much data? I do not know of any ADC where you just &quot;tell&quot; it to give you n amount of seconds worth of data at a frequency. There is more to it than that. Could you post more details about the ADC and code that reads data from the ADC?&lt;/p&gt;&#xA;" OwnerUserId="10625" LastActivityDate="2014-07-26T03:08:27.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17484" PostTypeId="1" AcceptedAnswerId="17491" CreationDate="2014-07-26T03:26:28.277" Score="0" ViewCount="89" Body="&lt;p&gt;I'm trying to write a C program that can get the PSD of an recorded audio file, I'm using for the &lt;code&gt;fftw3&lt;/code&gt; library. I wrote a program that calculate the PSD so far only for sinus function, but the result is correct, my problem is that I have some trouble to use the windowing method on my data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that the audio file has following properties :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 44100;&#xA;length = 10sec;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I got &lt;code&gt;441000&lt;/code&gt;samples, and I want to use windows, doesn't matter which one, with the size of 512, 25% overlapping, and shift my windows for the data. How could I know which value of the result is representing which frequency? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab it was easy here what I've done for example  : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  [x,fs] = audioread('fileName.wav');&#xA;  [xPSD,f] = pwelch(x,hanning(8192),4096,8192*4 ,fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help or explanation! &lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="8202" LastEditDate="2014-07-26T08:42:07.397" LastActivityDate="2014-07-26T11:42:01.380" Title="Using the windowing Method" Tags="|continuous-signals|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17485" PostTypeId="1" AcceptedAnswerId="17486" CreationDate="2014-07-26T05:52:42.333" Score="3" ViewCount="875" Body="&lt;p&gt;I am trying to listen &lt;a href=&quot;http://en.wikipedia.org/wiki/Very_low_frequency&quot; rel=&quot;noreferrer&quot;&gt;VLF&lt;/a&gt; radio signals. I have a recorded wave file (&lt;a href=&quot;https://drive.google.com/file/d/0B_EcB1A8sYhYdEI1dm5VTnlHa2M/edit?usp=sharing&quot; rel=&quot;noreferrer&quot;&gt;download&lt;/a&gt;) and here is the frequency spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JGPll.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JGPll.jpg&quot; alt=&quot;Frequency Spectrum&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have produced this spectrum using this matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal= wavread('/Users/ecabuk/Downloads/DR0000_0165.wav');&#xA;X_mags = abs(fft(signal));&#xA;bin_vals = [0 : N-1];&#xA;fax_Hz = bin_vals*fs/N;&#xA;N_2 = ceil(N/2);&#xA;plot(fax_Hz(1:N_2), 10*log10(X_mags(1:N_2)))&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('Magnitude (dB)');&#xA;title('Single-sided Magnitude spectrum (Hertz)');&#xA;axis tight&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It has two clear picks near at ~24KHz and ~25KHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I crop 24KHz and then return to time domain and save as a wave file, so I can hear that. (and same thing for 25KHz of course)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure but am I trying to make a &lt;a href=&quot;http://en.wikipedia.org/wiki/Demodulation&quot; rel=&quot;noreferrer&quot;&gt;Demodulation&lt;/a&gt; process?&lt;/p&gt;&#xA;" OwnerUserId="10627" LastEditorUserId="128" LastEditDate="2019-03-29T11:36:59.367" LastActivityDate="2021-08-09T16:09:26.237" Title="Demodulation with MATLAB" Tags="|matlab|frequency-spectrum|demodulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17486" PostTypeId="2" ParentId="17485" CreationDate="2014-07-26T06:37:13.750" Score="1" Body="&lt;p&gt;You are asking 2 questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to extract those labeled frequencies and remove the rest of the data?&lt;/li&gt;&#xA;&lt;li&gt;How to do Demodulation?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Well, regarding your first question, a dirty solution would be by working the the DFT data.&lt;br /&gt;&#xA;Just zero all frequencies but those you're after and apply Inverse DFT (&lt;code&gt;ifft&lt;/code&gt;).&lt;br /&gt;&#xA;Leave some margin around your wanted frequencies.&lt;/p&gt;&#xA;&lt;p&gt;About the second question, look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Demodulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Demodulation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Basically, in order to shift data in the frequency domain you multiply by pure harmonic signal in the time domain.&lt;br /&gt;&#xA;You chose the frequency of this harmonic signal s.t. (At least this is the classic case) the frequency you want will move to the DC frequency.&lt;br /&gt;&#xA;Then you apply Low Pass Filter to leave only the data you wanted.&lt;/p&gt;&#xA;&lt;p&gt;This is the opposite of the Modulation process.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="54457" LastEditDate="2021-08-09T16:09:26.237" LastActivityDate="2021-08-09T16:09:26.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17487" PostTypeId="2" ParentId="17477" CreationDate="2014-07-26T08:52:14.700" Score="0" Body="&lt;p&gt;I checked out the code. I think in the &lt;code&gt;exp3&lt;/code&gt; line, while using the dot product there is a problem. The correct format for dot product of &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; is: &lt;code&gt;a.*b&lt;/code&gt; - you have written it as &lt;code&gt;a*b&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also while taking dot product you have arranged it as  2x1 with a 1x2 vector. Try it in the other orders, i.e.: a 1x2 with a 2x1  or a 2x1 with a 2x1 or a 1x2 with a 1x2 vector product. I'm not very sure about which order is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that your title reflects the content of the question to get better visibility in these websites. Your title is about concepts but the question is about correcting the MATLAB code. &lt;/p&gt;&#xA;" OwnerUserId="10629" LastEditorUserId="8202" LastEditDate="2014-07-26T16:53:13.243" LastActivityDate="2014-07-26T16:53:13.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17488" PostTypeId="2" ParentId="17475" CreationDate="2014-07-26T10:10:46.753" Score="4" Body="&lt;p&gt;Suppose you have given an input signal to a system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(n)=\begin{cases}&#xA;1, &amp;amp; \mbox{if   } n=0 \\&#xA;0, &amp;amp; \mbox{if   } n\ne 0&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the output response of that system is known as the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example  $h(n) = \frac{1}{2}u(n-3)$. This means that if you apply a unit impulse to this system, you will get an output signal $y(n) = \frac{1}{2}$ for $n \ge 3$, and zero otherwise.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="8202" LastEditDate="2014-07-26T16:57:49.423" LastActivityDate="2014-07-26T16:57:49.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17490" PostTypeId="1" CreationDate="2014-07-26T11:16:58.113" Score="3" ViewCount="2358" Body="&lt;p&gt;I know all about conversion of frequency from HZ to normalized frequency and from normalized frequency to angular frequency ,but I wonder how it is done in MATLAB.&#xA;I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f:0:0.001:1;&#xA;omega=pi*f&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;here f=normalized frequency and omega=angular frequency. My question is how do we get the interval value(0.001) for our normalized frequncy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help&lt;/p&gt;&#xA;" OwnerUserId="10411" LastEditorUserId="128" LastEditDate="2019-03-29T11:37:19.573" LastActivityDate="2019-03-29T11:37:19.573" Title="How to Normalize Frequency in MATLAB" Tags="|matlab|frequency|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17491" PostTypeId="2" ParentId="17484" CreationDate="2014-07-26T11:42:01.380" Score="1" Body="&lt;p&gt;The $k$-th FFT bin will contain the complex amplitude for frequency $\frac{k}{512} \times 44100$.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-07-26T11:42:01.380" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17492" PostTypeId="2" ParentId="17455" CreationDate="2014-07-26T14:01:29.067" Score="3" Body="&lt;p&gt;I think, the reason for the difference between both results could be the difference between the angular frequency $\omega=2\pi f$ and the &quot;normal&quot; frequency $f$.&#xA;That means: In the time domain you have defined the frequency $f$, but after processing you (perhaps?) have interpreted the results as $\omega$. &lt;/p&gt;&#xA;" OwnerUserId="10631" LastEditorUserId="8202" LastEditDate="2014-07-26T16:41:28.193" LastActivityDate="2014-07-26T16:41:28.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17493" PostTypeId="1" AcceptedAnswerId="17500" CreationDate="2014-07-26T14:28:28.740" Score="8" ViewCount="6555" Body="&lt;p&gt;I am using YIN algorithm in a school project of mine which uses pitch detection on guitar sound. I when I play a note I get random frequencies at the beginning until they stabilize. I am thinking those are probably from action of pick on the strings.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going through the original paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://audition.ens.fr/adc/pdf/2002_JASA_YIN.pdf&quot; rel=&quot;noreferrer&quot;&gt;Cheveigne A, Kawahara H. - &lt;em&gt;YIN, a fundamental frequency estimator&#xA;  for speech and&#xA;  music&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;trying to reverse engineer the library and improve my results.&#xA;I am studying computer science and my knowledge of signal processing is limited. &#xA;A summary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1)&#xA;&lt;code&gt;Auto-correlation&lt;/code&gt; :- We try to find the correlation of the signal with itself shifted by a lag within a window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KDqSx.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Function can possibly have infinite values. We chose the highest peak with non-zero lag. Within a lag range.(Why the highest peak? Does it mean the loudest frequency?). The paper says if upper limit for $\tau$ is high. The algorithm may chose higher order peak (what are higher order peak?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following steps are to improve the accuracy of the results&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2)&#xA;&lt;code&gt;Difference Function&lt;/code&gt; :- Model the signal in form of a difference function.&#xA;$$ d(\tau) = \sum_{j=1}^{j=W} (x_j - x_{j+\tau})^2 $$. Which gives : &#xA;$$ d(\tau) = \sum_{j=1}^{j=W} (r_t(0) + r_{t+ \tau}(0) -2r_t(\tau)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we're basically using amplitude as bias.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;step 3)&#xA;&lt;code&gt;Cumulative mean normalization&lt;/code&gt;  Replace the difference function by cumulative normalized difference to avoid selecting value with zero lag:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d_t(\tau')=\frac{d_t(\tau)}{(1/\tau)\sum_{j=1}^{\tau}d_t(j)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;step 4) &#xA;&lt;code&gt;Absolute Threshold&lt;/code&gt; ( Could Anyone explain this section?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;step 5) &#xA;&lt;code&gt;Parabolic Interpolation&lt;/code&gt; : Fit the $d(\tau)$ estimates to a parabolic curve. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;step 6) &#xA;&lt;code&gt;Choose The Best Local Estimate&lt;/code&gt; : Self explanatory &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to compare guitar sound with a monophonic midi. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the parameters I should be thinking about tinkering with are window size and threshold to improve my results or I could discard first few frames. &#xA;Could anyone point me in the right direction? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameters I am using :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SAMPLE RATE : 44100&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WINDOW SIZE : 1024&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HOP SIZE : 512&lt;/p&gt;&#xA;&#xA;&lt;p&gt;THRESHOLD : 0.1&lt;/p&gt;&#xA;" OwnerUserId="7395" LastEditorUserId="7395" LastEditDate="2014-07-26T21:34:32.740" LastActivityDate="2019-07-18T20:27:45.107" Title="YIN Pitch detection Algortithm ( how do I improve my results )" Tags="|pitch|real-time|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17494" PostTypeId="1" AcceptedAnswerId="17495" CreationDate="2014-07-26T15:01:31.477" Score="6" ViewCount="5497" Body="&lt;p&gt;I am trying to generate a AWGN waveform to add it to the signal of my simulated communication system. The operating bandwidth of the communication system is about &lt;code&gt;B=3GHz&lt;/code&gt; and suppose that &lt;code&gt;T=300K&lt;/code&gt; (my signal is comprised of very short pulses, I am simulating an IR-UWB system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have done so far is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = k*T*B&#xA;sigma = sqrt(N./2)&#xA;noise = sigma.*randn(1,s_length)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;s_length&lt;/code&gt; is the number of samples for my useful signal and &lt;code&gt;noise&lt;/code&gt; the awgn waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this procedure correct? I have browsed through different questions but was unable to clarify it.&lt;/p&gt;&#xA;" OwnerUserId="10271" LastEditorUserId="128" LastEditDate="2018-07-02T08:26:52.403" LastActivityDate="2023-03-08T01:59:18.947" Title="How to Simulate AWGN (Additive White Gaussian Noise) in Communication Systems for Specific Bandwidth" Tags="|matlab|noise|digital-communications|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17495" PostTypeId="2" ParentId="17494" CreationDate="2014-07-26T15:36:26.313" Score="6" Body="&lt;p&gt;To create Band Limited AWGN all you need is &lt;code&gt;randn&lt;/code&gt; in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question lies only in how to set its Standard Deviation.&#xA;To illustrate that, let's assume our AWGN generator has PSD which equals to $ {N}_{0} $.&lt;br&gt;&#xA;Namely we have AWGN with zero mean and variance equals to $ \delta(0) {N}_{0} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming we have limited bandwidth channel, hence an ideal LPF is applied.&#xA;Assume its cutoff frequency is $ {F}_{LPF} = \frac{{F}_{S}}{2} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the Variance of the band limited AWGN is (Multiplication in frequency) the integral over its PSD multiplied by the Norm of the LPF (The factor 2 is for integration over the range $ -{F}_{LPF}:{F}_{LPF} $):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {Var}_{BandLimitedAWGN} = 2 {F}_{LPF} {N}_{0} = {F}_{S} {N}_{0} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, generate in MATLAB, using &lt;code&gt;randn&lt;/code&gt; noise with the corresponding STD (By the data of your simulation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good Luck!&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Some Remarks&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Variance of the noise is independent of the signal (At least in the classic model).&lt;/li&gt;&#xA;&lt;li&gt;The Variance of the noise is a function only of the analog channel and the Analog to Digital converter.&lt;br&gt;&#xA;The classic model assumes that if the signal is sampled at $ {F}_{s} $ an ideal LPF with a cut off frequency of $ {F}_{LPF} = \frac{{F}_{S}}{2} $.&lt;br&gt;&#xA;As I said, this is the frequency which sets the variance of the Band Limited noise.&lt;/li&gt;&#xA;&lt;li&gt;The input signal (Which is the transmitted signal + noise) may have any bandwidth it might have, after the LPF its bandwidth is limited.&lt;/li&gt;&#xA;&lt;li&gt;In order to minimize the energy of the noise in the system the LPF band width and the sampling rate should be as low as possible (Namely, the bandwidth of the signal in interest).&lt;br&gt;&#xA;Though if the next step is &quot;Matched Filter&quot; the SNR will be maximized for any finite energy white noise (Or colored if the &quot;Colorization&quot; is known and the Matched Filter is accordingly updated).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-07-27T10:56:38.837" LastActivityDate="2014-07-27T10:56:38.837" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="17496" PostTypeId="2" ParentId="17490" CreationDate="2014-07-26T15:42:16.003" Score="2" Body="&lt;p&gt;The interval resolution should be determined according to data you want to analyze.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is equivalent to the question, what magnification of your Micro Scope would you use?&lt;br&gt;&#xA;Well, it depends on the size of the things I want to look at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your data within the sampling frequency you set has different energy in each frequency bin and you'd like to see it, use small intervals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though,&#xA;The real question, how do you intend to use the Frequency Vector?&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-07-26T15:42:16.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17497" PostTypeId="2" ParentId="17475" CreationDate="2014-07-26T16:49:47.850" Score="-1" Body="&lt;p&gt;I believe you are confusing an impulse with and impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For digital signals, an impulse is a signal that is equal to 1 for n=0 and is equal to zero otherwise, so:&#xA;Impulse(0) = 1; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Impulse(1) = Impulse(2) = ... = Impulse(n) = 0; for n~=0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also means that, for example h(n-3), will be equal to 1 at n=3.&#xA;n=0 =&gt; h(0-3)=0; n=1 =&gt; h(1-3) =h(2) = 0; n=2 =&gt; h(1)=0; n=3 =&gt; h(0)=1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equivalente for analogical systems is the dirac delta function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An impulse response is how a system respondes to a single impulse. This is a straight forward way of determining a systems transfer function. &#xA;In your example, I'm not sure of the nomenclature you're using, but I believe you meant u(n-3) instead of n(u-3), which would mean a unit step function that starts at time 3. This means that after you give a pulse to your system, you get:&#xA;y(n) = (1/2)u(n-3)&#xA;Which gives:&#xA;n y&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 1/2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 1/2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on unit step function, look at Heaviside step function.&lt;/p&gt;&#xA;" OwnerUserId="8664" LastActivityDate="2014-07-26T16:49:47.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17498" PostTypeId="1" AcceptedAnswerId="17499" CreationDate="2014-07-26T18:39:45.027" Score="3" ViewCount="129" Body="&lt;p&gt;&lt;a href=&quot;http://papers.nips.cc/paper/1765-learning-informative-statistics-a-nonparametnic-approach.pdf&quot; rel=&quot;nofollow&quot;&gt;Learning&#xA;Informative&#xA;Statistics:&#xA;A&#xA;Nonparametric&#xA;Approach &lt;/a&gt; paper presents an approach to parameter estimation by entropy minimization. There are other related works &quot;Minimum-entropy estimation in semi-parametric models&quot;  download link ( &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=1195853&quot; rel=&quot;nofollow&quot;&gt;http://dl.acm.org/citation.cfm?id=1195853&lt;/a&gt;). The rationale provided is that minimization of error entropy is equivalent to maximization of likelihood. I am new to this area and find it hard to understand the intuition behind why entropy of the error minimization will yield the parameters. What happens when entropy is minimized?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What happens when Shannon Entropy is maximized? Entropy (Shannon's) is the uncertainty  = average information or uncertainty (unsure). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And what happens when entropy is minimized and &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the meaning of minimizing entropy of error? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="780" LastActivityDate="2014-07-26T23:16:14.610" Title="Conceptual question on entropy and its relation to information" Tags="|information-theory|estimators|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17499" PostTypeId="2" ParentId="17498" CreationDate="2014-07-26T19:00:17.233" Score="2" Body="&lt;p&gt;The basic idea behind maximum entropy models is that you want to make the least assumption about the data. This is considered equivalent to retaining as much unpredictability as possible, as quantified by entropy. For more information I refer you to &lt;a href=&quot;http://en.wikipedia.org/wiki/Maximum_Entropy&quot; rel=&quot;nofollow&quot;&gt;this Wikipedia article&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Information and unpredictability are closely related. If you think of the signal as a stochastic process, its information content is determined by unpredictable it is. At one extreme, if the signal tends towards being deterministic, you can tell what it will be any an arbitrary time so there is no value in sampling the signal; it has no information content. Entropy formalizes this notion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the density that maximizes the entropy we have to use the calculus of variations, and that involves determining several coefficients called &lt;em&gt;Lagrange multipliers&lt;/em&gt;. This is where the moments come in: they're the constraints that determine the multipliers. We set the $n$'th absolute moment for n=1..N to constants and we get the corresponding maximum entropy distribution. For example, the maximum entropy distribution whose first two moments are $\mu$ and $\sigma^2$ is the Gaussian distribution $N(\mu, \sigma^2)$. For details of the derivation please refer to &lt;a href=&quot;http://books.google.com/books?id=1a6lSRbQ4YsC&amp;amp;pg=PA914&amp;amp;dq=entropy+error+moment+minimize+lagrange&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=1gTUU-q3O6b8igL95ICIDw&amp;amp;ved=0CCcQ6AEwAg&quot; rel=&quot;nofollow&quot;&gt;a textbook&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't read the paper but I'm guessing the rationale is that if you're trying to fit a model, you want to capture as much information of the signal as possible. Equivalently, you want to leave as little residual information as possible on the table; i.e., in the error. For details see &lt;a href=&quot;http://books.google.com/books?id=oJSkBXWctsgC&amp;amp;pg=PA111&quot; rel=&quot;nofollow&quot;&gt;3.4 Minimum error entropy algorithm&lt;/a&gt; in &lt;em&gt;Information Theoretic Learning: Renyi's Entropy and Kernel Perspectives&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2014-07-26T23:16:14.610" LastActivityDate="2014-07-26T23:16:14.610" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17500" PostTypeId="2" ParentId="17493" CreationDate="2014-07-26T19:55:18.610" Score="3" Body="&lt;p&gt;If you are not doing this in low-latency real-time, you can work backwards from the stable portion of the pitch estimate to the transient attack portion of the waveform at the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sound of a plucked guitar string evolves in a possibly predictable pattern over time (e.g. more so than voice).  If you can estimate the onset time and/or have neighboring pitch estimates, you can adaptively set window sizes and threshold levels over time to more optimal values, as potentially determined by experimentation on some data set of guitar notes.  You can also use statistical decision theory to determine if any local pitch estimate fits the history of a reasonable spectral evolution of any guitar note, and reject outliers as noise, transients, harmonics or octave errors (harmonic and octave errors potentially being correctable errors).  This is especially useful working backwards in time, as the attack is usually noisier than the sustain/decay portion of a note's evolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some improvement in steps 4) and 6) can also be acquired from psycho-acoustic experimentation with human listeners.  For instance: For an octave difference to be perceived above a certain error rate by typical human listeners, how much normalized difference in octave pitch estimate peaks over what amount of time is required?  Any difference over a smaller amount of time might be imperceptible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDED: A window size of 1024 at a sample rate of 44100 only allows correlating/using a little more than 2 periods of the pitch of the lowest string of a guitar (E4 = 82.40Hz).  A 3X or 4X longer window might be more reliable for the lowest guitar notes, but shorter windows would be more responsive or provide better time locality for the higher fretted notes.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2019-07-18T20:27:45.107" LastActivityDate="2019-07-18T20:27:45.107" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17501" PostTypeId="1" CreationDate="2014-07-26T20:39:55.750" Score="1" ViewCount="3285" Body="&lt;p&gt;What is the method for generating coefficients for the Farrow structure in Matlab? I am designing a low pass filter using &lt;code&gt;firpm&lt;/code&gt;, but the output of the Farrow structure is not delayed.&lt;/p&gt;&#xA;" OwnerUserId="10633" LastEditorUserId="11256" LastEditDate="2014-11-24T01:00:57.903" LastActivityDate="2017-02-08T11:31:32.260" Title="Coefficients of Farrow structure?" Tags="|matlab|filters|" AnswerCount="3" CommentCount="1" ClosedDate="2017-02-08T13:55:42.583" ContentLicense="CC BY-SA 3.0" />
  <row Id="17502" PostTypeId="2" ParentId="17501" CreationDate="2014-07-26T21:00:20.287" Score="0" Body="&lt;p&gt;If you are using a Farrow structure for resampling or interpolation, one way of looking at it is as the sum of multiple polynomial evaluation structures, where each polynomial is fit to a portion of the impulse response of the low-pass filter function (for example, a polynomial fit to each sub-section or lobe of a windowed Sinc, which the first few lobes of a firpm impulse response may resemble at sufficient resolution).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-26T21:00:20.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17503" PostTypeId="2" ParentId="17413" CreationDate="2014-07-26T21:04:05.967" Score="2" Body="&lt;p&gt;There are many algorithms for &quot;edge-aware&quot; upsampling. Not sure what Photoshop itself uses, but for example Alien Skin Blow Up plugin gives similar results and they use vectorization using triangulation. The triangles are carefully smoothed while keeping the upsampled image sharp enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also take a look on NEDI (New Edge-Directed Interpolation), or &quot;&lt;a href=&quot;http://www.cs.huji.ac.il/~raananf/projects/upsampling/upsampling.html&quot; rel=&quot;nofollow&quot;&gt;Upsampling via Imposed Edges Statistics&lt;/a&gt;&quot; from Raanan Fattal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet another approach is to convert image to vector field (vectors go along edges), enlarge this field and then recompute spatial domain using some PDE solver (fast Poisson solvers are a popular option).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Genuine Fractals from OnOne Software shows yet another approach, using fractal geometry, particulary IFS (iterated function systems), exploiting self-similarity and allowing to recreate natural-looking texture data, not only edges. The fractal-approximated image is by definition resolution independent. I once wrote similar software, but computing fractal representation is costly, the rendering is very fast on the other hand.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2014-07-26T21:04:05.967" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17505" PostTypeId="2" ParentId="17477" CreationDate="2014-07-27T07:16:59.047" Score="2" Body="&lt;p&gt;The following is my implementation, of the above problem :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;em&gt;my_gabor_filter.m&lt;/em&gt;, I have the following code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function psi = my_gabor_filter(x,y,mu,nu,sigma) &#xA;    phi = pi*mu/8;&#xA;    f = sqrt(2);&#xA;    k_max = pi/2;&#xA;    k_nu = k_max/(f^nu);&#xA;&#xA;    % This is the wave vector&#xA;    k_vec = [k_nu*cos(phi),k_nu*sin(phi)]';&#xA;    z_vec = [x,y]';&#xA;&#xA;    k_vec_norm = norm(k_vec);&#xA;    z_vec_norm = norm(z_vec);&#xA;&#xA;    exp1 = (k_vec_norm/(sigma^2));&#xA;    exp2 = (exp(-((k_vec_norm^2)*(z_vec_norm^2)/(2*sigma^2))));&#xA;    exp3 = (exp(complex(0,k_vec'*z_vec))-exp(-(sigma^2/2)));&#xA;&#xA;    psi = exp1*exp2*exp3;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and, in &lt;em&gt;plot_gabor_filter.m&lt;/em&gt; I did the following :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function plot_gabor_filter()&#xA;    mu = 0;&#xA;    nu = 0;&#xA;    sigma = 1;&#xA;&#xA;    [X,Y] = meshgrid(-2:0.1:2,-2:0.1:2);&#xA;&#xA;    Z = zeros(41,41);&#xA;&#xA;    for i = 1:1:41&#xA;        for j = 1:1:41&#xA;            Z(i,j) = imag(my_gabor_filter(X(i,j),Y(i,j),mu,nu,sigma));&#xA;        end&#xA;    end&#xA;&#xA;    surf(X,Y,Z,'EdgeColor','black')&#xA;&#xA;    xlabel('x axis');&#xA;    ylabel('y axis');&#xA;    zlabel('g(x,y)');&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and when I run &lt;em&gt;plot_gabor_filter&lt;/em&gt;, I get the following output, which helped me in visualizing the gabor function :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/imX1P.png&quot; alt=&quot;Gabor Filter&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10621" LastActivityDate="2014-07-27T07:16:59.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17507" PostTypeId="1" CreationDate="2014-07-27T11:25:42.813" Score="1" ViewCount="55" Body="&lt;p&gt;I'm a physics Phd student and just have a self-taught knowledge about lti-systems. After a while I found out that several techniques such as heat capacity or thermal-conductance measurements can be modeled as lti-systems. The current approach to estimate the physical quantities is a nonlinear fit of the solution of the differential equations to the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But knowing that the system can be modeled as an lti-system, it's equivalent to estimating the state space matrices A, B, C, D. After some research I found out there are several techniques such as subspace identification which do not need non linear regression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what are the state of the art techniques for identifiing low dimensional models with only a few in- and outputs?&lt;/p&gt;&#xA;" OwnerUserId="851" LastActivityDate="2014-07-27T11:25:42.813" Title="Low dimensional system identification algorithms" Tags="|algorithms|linear-systems|system-identification|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17508" PostTypeId="1" AcceptedAnswerId="17509" CreationDate="2014-07-27T11:41:52.417" Score="5" ViewCount="5909" Body="&lt;p&gt;I have 10 images in the folder say &quot;D:\images\&quot; named as frame1,frame2,...,frame10. I want to make a movie from the color images &lt;strong&gt;with frame rate as per choice&lt;/strong&gt;.Also i want to save created video file in .mp4 format at the location &quot;D:\video\&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do so in MATLAB?how? &lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="128" LastEditDate="2021-08-08T14:29:40.167" LastActivityDate="2021-08-08T14:29:40.167" Title="Make a Movie from Multiple Images in MATLAB" Tags="|image-processing|matlab|video-processing|" AnswerCount="1" CommentCount="1" ClosedDate="2014-08-02T01:15:06.717" ContentLicense="CC BY-SA 4.0" />
  <row Id="17509" PostTypeId="2" ParentId="17508" CreationDate="2014-07-27T12:21:29.873" Score="1" Body="&lt;p&gt;It is easy to do using the &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/videowriter-class.html&quot; rel=&quot;noreferrer&quot;&gt;VideoWriter class&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You easily add frame (Image) using the proper method which is &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/videowriter.writevideo.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;writeVideo&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After creating a video object, &lt;code&gt;videoObject&lt;/code&gt; and given an image by &lt;code&gt;mImage001&lt;/code&gt;, adding frame is done by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;writeVideo(videoObject, mImage001);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Enjoy...&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Code Sample&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Here is a code sample based on Mathworks documentation with some remarks of mine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Creating Video Writer Object&#xA;writerObj = VideoWriter('peaks.avi');&#xA;% Using the 'Open` method to open the file&#xA;open(writerObj);&#xA;&#xA;% Creating a figure.&#xA;% Each frame will be a figure data&#xA;Z = peaks; surf(Z); &#xA;axis tight&#xA;set(gca,'nextplot','replacechildren');&#xA;set(gcf,'Renderer','zbuffer');&#xA;&#xA;for k = 1:20 &#xA;   surf(sin(2*pi*k/20)*Z,Z)&#xA;   % Frame includes image data&#xA;   frame = getframe;&#xA;   % Adding the frame to the video object using the 'writeVideo' method&#xA;   writeVideo(writerObj,frame);&#xA;end&#xA;&#xA;% Closing the file and the object using the 'Close' method&#xA;close(writerObj);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should be straight forward.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-07-27T17:01:28.193" LastActivityDate="2014-07-27T17:01:28.193" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17510" PostTypeId="1" CreationDate="2014-07-27T15:55:41.693" Score="0" ViewCount="3467" Body="&lt;p&gt;I'm giving a lecture on LTI systems. I encountered some questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;for a discrete LTI system H with impulse response h, is the system applied on signal x(t) equals x*h - normal discrete convolution or the cyclic convolution?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;can you please give me some examples of useful LTI systems? such as Prewitt or Roberts edge detection, and gauss smoothing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10637" LastEditorUserId="128" LastEditDate="2019-03-29T11:38:04.087" LastActivityDate="2019-03-29T11:38:04.087" Title="What Are Some Examples of Applications of LTI Systems" Tags="|filters|linear-systems|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17511" PostTypeId="1" CreationDate="2014-07-27T17:20:29.167" Score="3" ViewCount="205" Body="&lt;p&gt;suppose I know the frequency response of a (linear) model approximating a real physical system but only at a specific frequency $f_0$ (so basically I have a complex number whose module is the magnitude response and the phase is the phase response).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab I want to filter a sinusoidal signal whose frequency is $f_0$ by a filter that approximates the response of my system at $f_0$ without altering the other frequencies. The filtering process must be done simulating the on-line behaviour, assuming that the next samples of the signal are unknown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words my question is this: how can I build a filter whose behaviour at $f_0$ is the same of my system and does not modify the other frequency components?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motivation I am asking this is that I need to perform some transformations on the frequency response at $f_0$ of the real system exploiting the results of the Singular Value Decomposition performed on the frequency response at $f_0$ of the identified (linear MIMO) model that approximates the real system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="10622" LastEditorUserId="128" LastEditDate="2018-08-22T06:15:56.497" LastActivityDate="2018-08-22T06:15:56.497" Title="Approximate a System Frequency Response with a Filter in MATLAB" Tags="|matlab|filter-design|frequency-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17512" PostTypeId="2" ParentId="17510" CreationDate="2014-07-27T17:30:11.123" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;The normal convolution.&lt;br&gt;&#xA;The only difference is that all the frequency domain analysis is made under the assumption of periodic signal.  &lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;Matched Filter&lt;/code&gt;&lt;/a&gt; used for estimation and detection.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-07-27T17:30:11.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17513" PostTypeId="2" ParentId="17511" CreationDate="2014-07-27T18:01:57.637" Score="1" Body="&lt;p&gt;Convolve the input signal with (Real Part) harmonic signal $ \alpha {e}^{-2 \pi i {f}_{0} t + \phi} $.&lt;br&gt;&#xA;Let's call this output as $ {y}_{1} $.&lt;br&gt;&#xA;The parameters $ \alpha $ and $ \phi $ are from your reference system response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will give you the output of the reference system on your input signal only at your desired frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now convolve the input signal with (Real Part) harmonic signal $ 1 {e}^{-2 \pi i {f}_{0} t} $.&lt;br&gt;&#xA;Let's call this output as $ {y}_{2} $.&lt;br&gt;&#xA;This will extract this component of your input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate $ {y}_{3} = {y}_{1} - {y}_{2} $ and all you need is to add $ {y}_{3}  $ to your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are trickier and more efficient way to do so.&lt;br&gt;&#xA;Yet I wanted to keep it simple and intuitive.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-08-22T06:14:00.217" LastActivityDate="2018-08-22T06:14:00.217" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17514" PostTypeId="1" AcceptedAnswerId="17515" CreationDate="2014-07-27T18:33:32.070" Score="5" ViewCount="236" Body="&lt;ol&gt;&#xA;&lt;li&gt;What does mutual information (MI) convey? If 2 signals are independent then MI is zero; What does this imply and mean in the case of mutual information of error, and in general definition of MI and entropy.&#xA;What is the interpretation if MI of error is decreasing or getting minimized? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="780" LastEditorUserId="780" LastEditDate="2014-08-08T05:14:45.923" LastActivityDate="2014-08-08T05:14:45.923" Title="Difficulties in understanding mutual information concept" Tags="|information-theory|terminology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17515" PostTypeId="2" ParentId="17514" CreationDate="2014-07-27T19:25:45.393" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What does mutual information (MI) convey?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It indicates that there is a relationship between the two signals- i.e. that they are not independent.  It could be that they are correlated, but the relationship does not have to be that simple.  The higher the mutual information, the stronger the relationship (i.e. the more one of the signals can &quot;tell&quot; you about the other).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What does this imply and mean in the case of mutual information of error, and in general definition of MI and entropy.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If the error has mutual information with the observation this implies that the receiver did not use all of the information in the observation- i.e. the receiver is not ideal.  If the receiver was ideal it would have used all of the information in the observation, so what was left in the error signal would be independent of the observation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the interpretation if MI of error is decreasing or getting minimized?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Decreasing MI of error implies that the receiver is doing a better job.  Once the MI is zero it is impossible to do any better.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-07-27T19:25:45.393" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17518" PostTypeId="1" AcceptedAnswerId="17525" CreationDate="2014-07-28T04:40:45.213" Score="3" ViewCount="143" Body="&lt;p&gt;Ideally, a gyroscope and an accelerometer would be enough for a complete navigation solution (attitude + position), using dead reckoning. This comprise the Inertial Navigation System, INS. In non-ideal world, we would couple the INS with GPS. The GPS helps 'fix' the navigation solution at certain times, to help mitigate the drift in the INS output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question.&#xA;Suppose I have no access to a GPS, but have access to a &lt;a href=&quot;http://en.wikipedia.org/wiki/Spirit_level&quot; rel=&quot;nofollow&quot;&gt;Spirit level&lt;/a&gt; instrument with associated camera and image processing algorithms. This system serves to provide an absolute values of pitch and roll angles, but with slower update rate and lower resolution. Still, it is assumed to be drift-free. Can such a system be used in place of normal GPS to achieve dead reckoning solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. The reason for not using GPS is that I am trying to find a self-supporting navigation solution...&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="1904" LastEditDate="2014-07-29T16:50:59.570" LastActivityDate="2014-07-29T16:50:59.570" Title="The role of GPS in INS/GPS navigation systems" Tags="|kalman-filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17519" PostTypeId="2" ParentId="14125" CreationDate="2014-07-28T04:54:41.523" Score="0" Body="&lt;p&gt;I think the OP is on to something here.&#xA;The complete parameterization of a band-limited signal of bandwidth B will be 3-dimensional surface (magnitude as a function of complex freq). Sampling at 2B yields only a 2-dimensional surface (magnitude as a function of 'real' freq). Will there not be overlap in the mapping between the two, and thus loss of information?&#xA;$S(f) \{f \in C \} \rightarrow S(|f|) \{f \in C \}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that to completely capture the signal the I and Q components need to be sampled.&lt;/p&gt;&#xA;" OwnerUserId="10640" LastEditorUserId="8202" LastEditDate="2014-07-28T08:04:04.520" LastActivityDate="2014-07-28T08:04:04.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17521" PostTypeId="2" ParentId="17470" CreationDate="2014-07-28T10:51:36.100" Score="0" Body="&lt;p&gt;I don't know if it is correct for me to answer my own question but I found &lt;a href=&quot;http://www.intechopen.com/books/recent-advances-in-wireless-communications-and-networks/synchronization-for-ofdm-based-systems&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt; which seems to provide the information I requested, at lease partially, describing an NDA synchronization algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am following Serj's suggestion trying to implement the algorithm described but I don't understand one thing: at page 31, eq. (16) shows the formulas for time and frequency offsets. The time offset (Step 1) is calculated as a function of &lt;em&gt;ρ&lt;/em&gt; which depends on the signal and noise power, as reported at page 30. Is the algorithm incomplete or, otherwise, how can I estimate the noise power at the receiver end?&lt;/p&gt;&#xA;" OwnerUserId="10617" LastActivityDate="2014-07-28T10:51:36.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17525" PostTypeId="2" ParentId="17518" CreationDate="2014-07-28T12:31:05.650" Score="2" Body="&lt;p&gt;&lt;strong&gt;By itself, no, it cannot.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your method of fixing the INS system is pretty clever, but it only accounts for drift in the gyroscope. Accelerometers are also (very) prone to drift, generally showing up as an increasing velocity bias. The typical method to account for accelerometer drift is to use zero-velocity updates. By detecting points when you are not moving, you can periodically remove any non-zero velocities from your model.&lt;/p&gt;&#xA;" OwnerUserId="4439" LastActivityDate="2014-07-28T12:31:05.650" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17526" PostTypeId="1" AcceptedAnswerId="17556" CreationDate="2014-07-28T13:04:21.317" Score="4" ViewCount="6043" Body="&lt;p&gt;I'm looking for info that would help me to build a Tape Saturation process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with the WebAudio API. The API provides a number of DSP nodes that perform basic processes, such as a Convolver node and a WaveShaper node. The WaveShaper seems to suggest it is designed for distortion effects (&lt;a href=&quot;http://www.w3.org/TR/webaudio/#WaveShaperNode-section&quot; rel=&quot;nofollow&quot;&gt;http://www.w3.org/TR/webaudio/#WaveShaperNode-section&lt;/a&gt;). But tape saturation would seem to me more than a simple mapping of input to output values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the principal processes I should be modelling? Can anyone point me in the right direction?&lt;/p&gt;&#xA;" OwnerUserId="10643" LastActivityDate="2014-07-29T22:48:37.813" Title="How to model Tape Saturation (Audio DSP)?" Tags="|audio|distortion|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17527" PostTypeId="1" CreationDate="2014-07-28T12:49:15.533" Score="2" ViewCount="2618" Body="&lt;p&gt;I'm working on a project at my university and it involves background noise recognition/classification.  I'm very new to this so I'm unsure what to really search/google or where to really begin any research.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to remove background noise from any audio file and analyze THAT and not the primary signal (for example, if you had a recording of someone talking on a phone, remove their voice and keep the remaining background noise).  I then wish to train a classifier to cluster or group possible sound samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does one do this (extraction and preseervation of background noise)?  I'm guessing I need to do a FFT on the raw data?  Are there proper file formats one needs to have an audio file in to do this?  Additionally, what are proper learning or classification techniques for audio recognition?&lt;/p&gt;&#xA;" OwnerUserId="10649" OwnerDisplayName="WildBill" LastActivityDate="2014-07-28T15:55:23.243" Title="How to remove background noise from sound file for analysis" Tags="|audio|machine-learning|fft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17528" PostTypeId="2" ParentId="17527" CreationDate="2014-07-28T15:55:23.243" Score="2" Body="&lt;p&gt;So you basically have a noisy speech signal and want to analyze only the noise without speech? This seems like a task for a voice activity detector (VAD). Assuming it works properly it should give you the parts of the signal containing speech and the parts of the signal containing noise. This approach is often used in speech enhancement where an estimate of the noise is required in order to suppress it from the noisy speech signal (usually the noise power spectral density or PSD is calculated). This seems to be pretty close to what you want to do apart from the speech enhancement part which you don't need. This is the way to go instead of &quot;removing the voice&quot; as this is more difficult. If you have access to the Digital Speech transmission book by Peter Vary, it has a nice section on VADs. You can also look at &lt;a href=&quot;http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html&quot; rel=&quot;nofollow&quot;&gt;http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html&lt;/a&gt; - very useful toolbox for any type of audio processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say you have the parts of the signal containing only noise. So you then want to classify it in how many classes? The most important thing for the classification is your choice of classification features - basically, how will the different noise types differ. You can have external/ambient noise as a property of the environment in which the communication is taking place but also internal noise as a property of the communication system itself. Keep in mind that competing speakers can also be considered noise, based on the application. In that case the VAD will have more problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you need to define your features and then you can extract them. Yes, you can do the FFT on raw data and calculate the PSD for example and look at the energy in certain frequency bands. This is a nice (and free) book on spectral analysis you can use as a reference: &lt;a href=&quot;http://user.it.uu.se/~ps/SAS-new.pdf&quot; rel=&quot;nofollow&quot;&gt;http://user.it.uu.se/~ps/SAS-new.pdf&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyhow, try to get started on it (people have already done similar things -google noise classification) and do it step by step. So there's no use worrying about classification when you don't know what features you'll use to distinguish between the signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps &lt;/p&gt;&#xA;" OwnerUserId="10646" LastActivityDate="2014-07-28T15:55:23.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17529" PostTypeId="1" AcceptedAnswerId="17587" CreationDate="2014-07-28T16:20:36.557" Score="4" ViewCount="2653" Body="&lt;p&gt;I know the FIR approach, I have seen IIR, to, but I'd like to know if it's possible to implement a Hilbert transformer in analog domain, i.e. with integrators instead of delays. Is it possible? If yes, how?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[edit]&#xA;After some searching on my own, I stumbled upon an answer in &lt;strong&gt;sci.electronics.design - &quot;Analog delay??&quot;&lt;/strong&gt; (I'm not posting the link as it seems it involves some character string and I don't know what influence will that have). A simple search will do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, this involves a translation of a digital delay into its analog counterpart, clock, etc, no continuous-time values. Could this mean that there is no other way to do it (analog)?&lt;/p&gt;&#xA;" OwnerUserId="10647" LastEditorUserId="10647" LastEditDate="2014-08-01T13:17:53.897" LastActivityDate="2016-11-22T19:23:11.743" Title="Analog Hilbert transformer" Tags="|hilbert-transform|analog|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17533" PostTypeId="2" ParentId="17409" CreationDate="2014-07-28T17:45:30.403" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The radio you linked to is strictly analog, at least as far as I can tell.  The linked page mentions no digital capability of any kind, but references a couple of analog signalling methods.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Encryption is not allowed on amateur radio systems. &lt;a href=&quot;http://www.arrl.org/news/fcc-dismisses-encryption-petition&quot; rel=&quot;nofollow&quot;&gt;site: ARRL, the national association for Amateur Radio&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you ignore (2,) you still have to deal with (1.)&#xA;You are going to have to make something that amounts to the codecs used on old analog modems.  You will have to find a way to reduce the data rate of the digital data to something that you can push through a (very) narrow bandwidth.&#xA;Your original scheme also doesn't allow for any way for your receiver to sychronize itself with the data stream. &lt;a href=&quot;http://w5vwp.com/blog/?page_id=151&quot; rel=&quot;nofollow&quot;&gt;The info on this amateuer radio site should give you some idea of what you'll have to deal with.&lt;/a&gt;  Note, that though they do digital transmission of data, they do NOT encrypt it.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-07-28T17:45:30.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17534" PostTypeId="2" ParentId="17437" CreationDate="2014-07-28T17:56:03.053" Score="0" Body="&lt;p&gt;For periodic activities, such as running and walking, calculating the autocorrelation of sequences at least the length of several likely periods and reducing that to some number of maxima lags and local maxima values might provide a more useful feature vector than the raw data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-28T17:56:03.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17536" PostTypeId="1" CreationDate="2014-07-29T01:13:14.440" Score="3" ViewCount="79" Body="&lt;p&gt;I was maximising a likelihood function, which is convex. I know that the system has a K-sparse solution. I wanted to know the conditions (or some sufficient conditions) on the likelihood function under which l1-regularisation is guaranteed to give me the sparse solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, I am trying to solve the following problem&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\max_{x \in \mathbb{R}^n} f(x),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f$ is a concave function. However I know that the true solution is K-sparse. I wanted to know the conditions under which the following optimisation returns the correct solution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\max_{x \in \mathbb{R}^n} f(x) - \lambda ||x||_1.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found online that if $f=||y-Ax||_2^2$, then we need $A$ to satisfy a property called the restricted eigenvalue property. I wanted to know if anything is known in the general case or even special cases where such guarantees were known.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="128" LastEditDate="2018-06-19T11:45:38.977" LastActivityDate="2018-06-19T11:45:38.977" Title="When Does $ {L}_{1} $ Regularization Give a Sparse Solution?" Tags="|estimation|optimization|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17537" PostTypeId="1" AcceptedAnswerId="17538" CreationDate="2014-07-29T04:14:00.603" Score="2" ViewCount="3166" Body="&lt;p&gt;I'm following a tutorial about the FFT. It's well explained but I don't understand the meaning of the frequency vector:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 150; % Sampling frequency&#xA;t = 0:1/Fs:1; % Time vector of 1 second &#xA;f = 5; % Create a sine wave of f Hz.&#xA;x = sin(2*pi*t*f); &#xA;nfft = 1024; % Length of FFT&#xA;&#xA;% Take fft, padding with zeros so that length(X) &#xA;is equal to nfft &#xA;X = fft(x,nfft);&#xA;% FFT is symmetric, throw away second half&#xA;X = X(1:nfft/2); &#xA;% Take the magnitude of fft of x&#xA;mx = abs(X);&#xA;% Frequency vector&#xA;f = (0:nfft/2-1)*Fs/nfft; &#xA;&#xA;% Generate the plot, title and labels. &#xA;figure(1);&#xA;plot(t,x);&#xA;title('Sine Wave Signal'); &#xA;xlabel('Time (s)'); &#xA;ylabel('Amplitude'); &#xA;figure(2);&#xA;plot(f,mx);&#xA;title('Power Spectrum of a Sine Wave'); &#xA;xlabel('Frequency (Hz)'); &#xA;ylabel('Power');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone explain me what is this for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;f= (0:nfft/2-1)*Fs/nfft;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the &lt;a href=&quot;https://www.utdallas.edu/~dlm/3350%20comm%20sys/FFTandMatLab-wanjun%20huang.pdf&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10555" LastEditorUserId="8202" LastEditDate="2014-07-29T07:10:11.163" LastActivityDate="2017-09-21T10:40:51.187" Title="FFT Matlab - Meaning of Frequency Vector" Tags="|matlab|fft|fourier-transform|fourier|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17538" PostTypeId="2" ParentId="17537" CreationDate="2014-07-29T05:02:51.150" Score="3" Body="&lt;p&gt;Specifically,&lt;br&gt;&#xA;&lt;strong&gt;nfft = 1024&lt;/strong&gt;&lt;br&gt;&#xA;&lt;strong&gt;Fs = 150&lt;/strong&gt;&lt;br&gt;&#xA;so &lt;strong&gt;f = (0:511)x(150/1024)&lt;/strong&gt;&lt;br&gt;&#xA;ie &lt;strong&gt;f&lt;/strong&gt; will go from &lt;strong&gt;0x(150/1024) = 0&lt;/strong&gt; to &lt;strong&gt;511x(150/1024) = 75&lt;/strong&gt;&lt;br&gt;&#xA;So, you are plotting the magnitude of the frequency spectrum from 0 to 75 Hz.&lt;br&gt;&#xA;The spectrum is periodic &amp;amp; will repeat for 75 to 150 Hz hence you are plotting from 0 to Fs/2&lt;/p&gt;&#xA;" OwnerUserId="4875" LastEditorUserId="4875" LastEditDate="2014-07-29T05:50:19.777" LastActivityDate="2014-07-29T05:50:19.777" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17539" PostTypeId="2" ParentId="17432" CreationDate="2014-07-29T06:27:28.090" Score="6" Body="&lt;p&gt;Your statement that the Hough transform (HT) needs to be applied on a binary image is not true. The original HT indeed was formulated that way, though in the meanwhile different authors extended the HT in numerous ways -- for example, to consider the gray scale values of each image pixel. As a consequence, the step of edge detection can be omitted.&lt;/p&gt;&#xA;&lt;p&gt;Citations concerning grey scale values taken from &lt;a href=&quot;http://dx.doi.org/10.1109/JSEN.2014.2311160&quot; rel=&quot;nofollow noreferrer&quot;&gt;Extraction of Spatial Ultrasonic Wave Packet Features by Exploiting a Modified Hough Transform&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[23] F. O’Gorman and M. B. Clowes, “Finding picture edges through&#xA;collinearity of feature points,” IEEE Trans. Comput., vol. 25, no. 4,&#xA;pp. 449–456, Apr. 1976.&lt;/p&gt;&#xA;&lt;p&gt;[24] J. Skingley and A. J. Rye, “The Hough transform applied to SAR&#xA;images for thin line detection,” Pattern Recognit. Lett., vol. 6, no.&#xA;1, pp. 61–67,&#xA;1987.&lt;/p&gt;&#xA;&lt;p&gt;[25] C. Trayner, N. J. Bailey, and B. R. Haynes, “Time-gradient Hough&#xA;transforms–constraining object identification by speed of motion,”&#xA;Real-Time Imag., vol. 6, no. 2, pp. 143–153, 2000.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1470" LastEditorUserId="7092" LastEditDate="2021-08-13T11:48:11.407" LastActivityDate="2021-08-13T11:48:11.407" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17541" PostTypeId="1" CreationDate="2014-07-29T08:31:22.203" Score="1" ViewCount="146" Body="&lt;p&gt;How we can track a single selected object from multiple detected moving objects using single fixed camara?&lt;/p&gt;&#xA;" OwnerUserId="10653" LastActivityDate="2014-07-29T17:08:42.993" Title="Real Time Object Tracking using image processing" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="1" ClosedDate="2014-08-02T01:15:29.517" ContentLicense="CC BY-SA 3.0" />
  <row Id="17542" PostTypeId="1" CreationDate="2014-07-29T09:16:03.777" Score="1" ViewCount="12940" Body="&lt;p&gt;Here is my signal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Cos(n/2)*cos(pi*n/4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;cos(n/2) has period 4pi and cos(pi*n/4) has period 8&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the question is will the signal be periodic for fundamental period 32pi ?&lt;/p&gt;&#xA;" OwnerUserId="10485" LastActivityDate="2020-02-27T20:01:15.083" Title="Determine whether a signal is periodic or not and get fundamental period" Tags="|discrete-signals|frequency|periodic|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17543" PostTypeId="2" ParentId="17542" CreationDate="2014-07-29T10:16:05.813" Score="-2" Body="&lt;p&gt;You can try using this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(1) cos(a+b) = cos(a)*cos(b)+sin(a)*sin(b)&#xA;(2) cos(a-b) = cos(a)*cos(b)-sin(a)*sin(b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can do (1)+(2) and get that&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cos(a)*cos(b)=1/2(cos(a+b)+cos(a-b))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can identify the period of cos(a+b)-cos(a-b) by using this for example&#xA;&lt;a href=&quot;http://fourier.eng.hmc.edu/e101/lectures/Fundamental_Frequency.pdf&quot; rel=&quot;nofollow&quot;&gt;http://fourier.eng.hmc.edu/e101/lectures/Fundamental_Frequency.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="10646" LastEditorUserId="10646" LastEditDate="2014-07-29T10:56:29.727" LastActivityDate="2014-07-29T10:56:29.727" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17544" PostTypeId="2" ParentId="17518" CreationDate="2014-07-29T11:37:14.943" Score="1" Body="&lt;p&gt;(MEMS) Inclinometers are just accelerometers with a narrow bandwidth, but higher stability properties. For example, compare the &lt;a href=&quot;http://www.muratamems.fi/en/products/inclinometers/sca103t-inclinometers&quot; rel=&quot;nofollow&quot;&gt;SCA103T&lt;/a&gt; vs the &lt;a href=&quot;http://www.muratamems.fi/en/products/accelerometers/sca1000-accelerometers&quot; rel=&quot;nofollow&quot;&gt;SCA1000&lt;/a&gt; from the same manufacturer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even considering this, the original answer is still incomplete.  The real problem is drift in height - you have about &lt;strong&gt;9 minutes&lt;/strong&gt; of useful navigation before it essentially becomes useless.  This is true, even for insanely expensive &lt;a href=&quot;http://en.wikipedia.org/wiki/Ring_laser_gyroscope&quot; rel=&quot;nofollow&quot;&gt;ring laser gyros&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that errors in height cause an error in your predicted gravity, which you need to remove from the accelerometers before double-integrating.  If the predicted gravity is wrong, then the error on the accelerometers will get larger, which causes more drift in height, which causes the gravity error to be even more wrong, which causes ....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the error in height is &lt;strong&gt;exponential.&lt;/strong&gt;  This is why typical &quot;standalone&quot; INS systems always have something like barometric altitude for aiding.  GPS will do a similar thing (and have other benefits too).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/3110159031&quot; rel=&quot;nofollow&quot;&gt;Jekeli, &quot;Inertial Navigation Systems with Geodetic Applications&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1904" LastActivityDate="2014-07-29T11:37:14.943" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17545" PostTypeId="1" CreationDate="2014-07-29T12:06:46.003" Score="1" ViewCount="293" Body="&lt;p&gt;I'm generating a sinus by using a lut method on a DSPic33f. My sample rate is 48 kHz, so I saved 12000 of the first value (unsigned int, 16 bits) and use trigonometric formulas to calculate the other parts of the sinusoid. I can change the frequency of this sine by turning a rotary encoder. Every 2 ms, a timer interrupt read the value of the rotary encoder, and the value (frequency in Hz) will be the new index to read my lut.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit of the code for you to understand :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ANGLE += FREQUENCY_VALUE;&#xA;if(ANGLE &amp;lt; SINE_TABLE_LEN)&#xA;{&#xA;    index  = ANGLE;&#xA;    sign = 1;&#xA;}&#xA;else if((ANGLE &amp;gt;= SINE_TABLE_LEN) &amp;amp;&amp;amp; (ANGLE &amp;lt; SINE_TABLE_LEN2))&#xA;{&#xA;    index = SINE_TABLE_LEN2 - ANGLE;&#xA;    sign = 1;&#xA;}&#xA;else if((ANGLE &amp;gt;= SINE_TABLE_LEN2) &amp;amp;&amp;amp; (ANGLE &amp;lt; SINE_TABLE_LEN3))&#xA;{&#xA;     index = ANGLE - SINE_TABLE_LEN2;&#xA;     sign = -1;&#xA;}&#xA;else if((ANGLE &amp;gt;= SINE_TABLE_LEN3) &amp;amp;&amp;amp; (ANGLE &amp;lt; SINE_TABLE_LEN4))&#xA;{&#xA;     index = SINE_TABLE_LEN4 - ANGLE;&#xA;     sign = -1;&#xA;}&#xA;else&#xA;{&#xA;     ANGLE -= SINE_TABLE_LEN4;&#xA;     index = ANGLE;&#xA;     sign = 1;&#xA;}&#xA;audio_sample_l = sign * sine_lut[index-1];&#xA;audio_sample_r = audio_sample_l;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I initialize my variable ANGLE at 0 and FREQUENCY_VALUE at 1. When a plot the fft of my sinus I get some odd harmonic noise that I can not explain. When I compare the output samples with the one from my lut, they are the same (no index error). The problem may come from the fact that I do not start at the beginning of my lut but at the previous sample to avoid phase changes. There may be some rounded error also. My third lead is the initialization values and the index calculation (test in the loop also). What do you think ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PDqVT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have some ideas to change that ?&lt;/p&gt;&#xA;" OwnerUserId="10606" LastActivityDate="2015-03-26T19:16:29.000" Title="Generating a high SNR sinusoide with lut on a DSP" Tags="|discrete-signals|audio|tone-generation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17546" PostTypeId="1" CreationDate="2014-07-29T14:14:19.447" Score="0" ViewCount="419" Body="&lt;p&gt;I have a non realtime application where I need to run a bandpass FFT filter on a data array of between 5k and 10k data points. Do I break it up into (say) 256 point chunks, run the FFT on that and simply move onto the next 256 items, or is that too naive?&lt;/p&gt;&#xA;" OwnerUserId="7233" LastEditorUserId="4346" LastEditDate="2017-01-05T04:13:52.377" LastActivityDate="2017-01-05T04:13:52.377" Title="Running an FFT filter on a large data set" Tags="|fft|fast-convolution|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17547" PostTypeId="2" ParentId="10413" CreationDate="2014-07-29T14:36:15.053" Score="-4" Body="&lt;p&gt;Linear convolution:&#xA;     For aperiodic and infinite sequence.&#xA;Circular convolution:&#xA;     For periodic and finite sequence. &lt;/p&gt;&#xA;" OwnerUserId="10654" LastActivityDate="2014-07-29T14:36:15.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17548" PostTypeId="2" ParentId="17545" CreationDate="2014-07-29T15:06:47.430" Score="2" Body="&lt;p&gt;Trace your logic when ANGLE is incremented to SINE_TABLE_LEN4 -- you'll find you are accessing below the buffer.  You should really adopt a zero-based index scheme when coding in C.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-07-29T15:06:47.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17549" PostTypeId="2" ParentId="17545" CreationDate="2014-07-29T15:23:56.830" Score="1" Body="&lt;p&gt;You are generating a stair-stepped sine wave, which is why you get so many harmonics.&#xA;Since you are using 12000 points for your LUT, the stair steps are small so the harmonics are already fairly low - your picture says that your generated signal (100Hz) is 80dB above the strongest harmonic. Any frequency that you try to generate that doesn't divide evenly into 48000 will cause the harmonics to be worse to some extent because your FREQUECY_VALUE won't be an integer in those cases, causing the the value that you look up to be slightly off the correct value.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is pretty much what you can expect for the method you are using.&lt;a href=&quot;http://www.rossbencina.com/code/sinusoids&quot; rel=&quot;nofollow&quot;&gt;See the examples here for comparison.&lt;/a&gt;&#xA;You could follow the suggestions on that linked page and get the same performance from a smaller LUT, or get much better performance from your monster LUT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How clean do you really need your generated signal to be?&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-07-29T15:29:05.053" LastActivityDate="2014-07-29T15:29:05.053" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17550" PostTypeId="1" CreationDate="2014-07-29T15:34:01.687" Score="4" ViewCount="427" Body="&lt;p&gt;Say you have a linear chirp, which is a bit like a sinusoid with a gradually increasing period, but instead of the linearly increasing period, could you pick an arbitrary value, like the red line in the image below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xi606.jpg&quot; alt=&quot;a linear chirp, its period, and the period it should have (in red)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you write the definition of this? Say that the period variable is called AP (arbitrary period).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the linear chirp I refer to &lt;a href=&quot;http://en.wikipedia.org/wiki/Chirp#Linear_chirp&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="735" LastActivityDate="2014-07-30T13:23:01.163" Title="&quot;chirp&quot; with arbitrary period" Tags="|continuous-signals|linear-chirp|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17551" PostTypeId="2" ParentId="17546" CreationDate="2014-07-29T16:30:15.500" Score="3" Body="&lt;p&gt;You need to know the length of the impulse response of your bandpass filter, and use an FFT longer than 256 by that length (to prevent circular convolution boundary artifacts).  Combine the longer FFT results back into a sequence of length 256 windows by overlap-add or overlap-save.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-07-29T16:30:15.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17552" PostTypeId="2" ParentId="17541" CreationDate="2014-07-29T17:08:42.993" Score="1" Body="&lt;p&gt;What kind of an object?  If it is a compact object moving in some predictable fashion, you can use the Kalman filter to track based on its motion.  If the object has some texture, and doesn't move very fast relative to the frame rate, you can use the KLT (Kanade, Lucas, Tomasi) algorithm to track points on it.  If it has a distinctive color pattern you can use a Mean-shift tracker to track it.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-07-29T17:08:42.993" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17554" PostTypeId="2" ParentId="17550" CreationDate="2014-07-29T20:48:19.780" Score="2" Body="&lt;p&gt;If I understand correctly, you are trying to create a chirp an arbitrary instantaneous frequency, $f(t)$.&lt;br&gt;&#xA;In that case, the phase of the chirp is given by $\varphi(t) = 2 \pi \int f(t)dt$ and your signal in time domain is given by $s(t) = \sin(\varphi(t))$.&lt;br&gt;&#xA;For example, in case of a linear chirp  you mentioned, $f(t) = f_0 + \beta t$ (where $\beta$ is the sweep rate) and therefore $s(t) = \sin \left(2 \pi (f_0 t+\frac{1}{2}\beta t^2) \right)$.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="4346" LastEditDate="2014-07-30T13:23:01.163" LastActivityDate="2014-07-30T13:23:01.163" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17555" PostTypeId="2" ParentId="17462" CreationDate="2014-07-29T22:29:39.350" Score="2" Body="&lt;p&gt;If you know that it is a square wave, and the frequency is roughly constant, I would think about synthesizing an inverted copy of it and adding it to the signal.  The remainder would be your speech, plus some residual harmonics of the square wave frequency, which might be dealt with by a 1-channel adaptive filter (see Sec. IIC of this link: &lt;a href=&quot;http://www.cs.cmu.edu/~aarti/pubs/ANC.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.cmu.edu/~aarti/pubs/ANC.pdf&lt;/a&gt;).  It's possible that the adaptive filter will do it all by itself--I have used them with good results on periodic interfering signals with attention to the delay setting involved.&#xA;In order to get the parameters of the inverted signal, you would do one of two things:&lt;br&gt;&#xA;1. Fit a two-parameter square wave to the signal using least squares minimization (two parameters being the initial time delay and the amplitude, or add other parameters as you see fit).&#xA;2. Use an FFT to estimate phase and amplitude of the fundamental sine wave, then use the theoretical ratio of the amplitude of a square wave to its fundamental (isn't it 2/pi?) to reconstruct the square wave from that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which of these two approaches you pick depends on the bandwidth of the speech and its amplitude relative to your DCS signal.  Good Luck!&lt;/p&gt;&#xA;" OwnerUserId="10657" LastActivityDate="2014-07-29T22:29:39.350" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17556" PostTypeId="2" ParentId="17526" CreationDate="2014-07-29T22:48:37.813" Score="4" Body="&lt;p&gt;Saturation can be modeled to first order as a symmetrical distortion of the signal, but it also has history dependence--hence the term hysteresis in describing magnetic response to a field that is applied.  Bias (an AC field applied to the tape at the same time as the signal to be recorded) linearizes the curve and reduces hysteresis effects by eradicating the memory of the medium.  If your objective is to simulate the sound of a tape recorder, you should consider hysteresis effects, and the fact that high frequency signals are self-biasing, so that they effectively saturate at a different (lower) level than low-frequency ones.  (This was the insight behind Dolby HX processing, which really made cassette tapes sound a lot better.)&lt;/p&gt;&#xA;" OwnerUserId="10657" LastActivityDate="2014-07-29T22:48:37.813" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17557" PostTypeId="1" CreationDate="2014-07-30T07:13:45.630" Score="3" ViewCount="1715" Body="&lt;p&gt;I obtain the cross power spectra by the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;compute the FFT of signal A and B&lt;/li&gt;&#xA;&lt;li&gt;Multiply A with the conjugate of B store it in C (cross power spectra)&lt;/li&gt;&#xA;&lt;li&gt;Now looking at the Phase of this cross power spectra C, what all information can I deduce about the two signals A and B?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10412" LastActivityDate="2014-07-30T08:05:06.717" Title="What Information does the phase of a cross power spectra give me?" Tags="|fft|frequency-spectrum|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17558" PostTypeId="2" ParentId="17557" CreationDate="2014-07-30T08:05:06.717" Score="3" Body="&lt;p&gt;If the two signal show a significant correlation at some frequency $f$ then the phase measured in the cross spectrum gives you the phase lag of the signals at that frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, take $$ A = \sin(2\pi f t ) $$ and $$ B = \sin(2\pi f t - \phi) $$ then the cross spectral phase at frequency $f$ will give you $\phi$.&lt;/p&gt;&#xA;" OwnerUserId="10660" LastActivityDate="2014-07-30T08:05:06.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17559" PostTypeId="2" ParentId="17546" CreationDate="2014-07-30T14:44:02.890" Score="1" Body="&lt;p&gt;I am not sure I understand your question, and I am not sure whether you are looking for expert help with a rather esoteric filtering problem, or if you are new to digital filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am guessing you are new to this subject and you don't realize there is a much simpler way to filter data, other than with the FFT approach. If so, take a look at this: &lt;a href=&quot;http://www.iowahills.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try using either the FIR or IIR programs (free) so you can see how easy filtering is done by using the more standard convolution approach. It will take just a few minutes to design a bandpass filter and test it on your data. There is also source code available that shows how to implement FIR and IIR filters in C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please ignore this if you must use the FFT approach.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2014-07-30T14:44:02.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17560" PostTypeId="1" CreationDate="2014-07-30T15:03:04.283" Score="0" ViewCount="1126" Body="&lt;p&gt;I have quite a few noisy signals and I want to calculate their spectral tilt over time, preferably using a method from literature. So far, I can only come up with the slope of the line between the F0 and F1 peaks. The problem is, I don't know how to calculate the spectral tilt by hand for the below example (which is a cross-cut of the energy-frequency spectrum), because F1 is so low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IRgSR.png&quot; alt=&quot;I am not using a spectrogram here, but a cochleogram, but it should work the same.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequencies and energies of all the peaks are the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Freq (Hz) Energy (dB)&#xA;    95.465 -46.700&#xA;   142.06  -43.072&#xA;   178.24  -43.564&#xA;   269.82  -14.422&#xA;   405.93  -34.140&#xA;   537.26  -19.539&#xA;   803.47  - 2.081&#xA;  1060.3   -10.409&#xA;  1315.0   -14.574&#xA;  1581.0   -24.363&#xA;  1843.0   -29.801&#xA;  2214.9   -34.464&#xA;  2744.3   -28.979&#xA;  3197.9   -26.913&#xA;  3961.1   -30.493&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone help me with this?&lt;/p&gt;&#xA;" OwnerUserId="10174" LastEditorUserId="10174" LastEditDate="2014-07-30T15:09:34.703" LastActivityDate="2014-07-30T15:09:34.703" Title="Measuring spectral tilt" Tags="|frequency-spectrum|gradient|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17561" PostTypeId="2" ParentId="9094" CreationDate="2014-07-30T15:40:50.830" Score="2" Body="&lt;p&gt;I cannot answer your question in theory, however I can answer it practically - You may see it using a matched filter simulator (&lt;a href=&quot;http://www.grauonline.de/alexwww/ardumower/filter/filter.html&quot; rel=&quot;nofollow&quot;&gt;http://www.grauonline.de/alexwww/ardumower/filter/filter.html&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="10665" LastActivityDate="2014-07-30T15:40:50.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17566" PostTypeId="1" AcceptedAnswerId="17694" CreationDate="2014-07-31T14:48:33.747" Score="0" ViewCount="685" Body="&lt;p&gt;I have found the definition of the following formulas in a paper regarding active vibration control, where they are called sine and cosine modulated integrals.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is measurement signal with a strong periodic component of frequency &lt;span class=&quot;math-container&quot;&gt;$N\Omega$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y^{(i)}_{Nc}=\frac{2}{T}\int^{T}_{0}y^{(i)}(ϕ)\cos(Nϕ)dϕ$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y^{(i)}_{Ns}=\frac{2}{T}\int^{T}_{0}y^{(i)}(ϕ)\sin(Nϕ)dϕ$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\phi=\Omega t$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;From these the vector &lt;span class=&quot;math-container&quot;&gt;$y_N^{(i)}$&lt;/span&gt; is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$y_N^{(i)} = \begin{bmatrix} y_{Nc}^{(1)}\\ y_{Ns}^{(1)}\\\vdots\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The same is done for the control input(s) &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;.&#xA;Then a quadratic cost function to be minimized at each step is defined using these newly introduced signals in this way:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$J(k) = y^T_NQy_N+u^T_NRu_N $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; are just two weighing matrices.&lt;/p&gt;&#xA;&lt;p&gt;Are they introduced to consider the sine and cosine components at the considered frequency of the signal?&lt;/p&gt;&#xA;&lt;p&gt;Can someone explain their meaning and why are they introduced?&lt;/p&gt;&#xA;&lt;p&gt;Another question: suppose I have the value &lt;span class=&quot;math-container&quot;&gt;$y_N$&lt;/span&gt;, how can I invert the relationship to get &lt;span class=&quot;math-container&quot;&gt;$y^{(i)}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/6859468&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is the link for the paper.&lt;/p&gt;&#xA;" OwnerUserId="10622" LastEditorUserId="7092" LastEditDate="2022-05-03T12:05:41.977" LastActivityDate="2022-05-03T12:05:41.977" Title="What are and why are sine and cosine modulated integrals used?" Tags="|modulation|integration|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17567" PostTypeId="1" AcceptedAnswerId="17583" CreationDate="2014-07-31T15:49:48.000" Score="1" ViewCount="270" Body="&lt;p&gt;I would like to write a DFT program using FFT. This is actually used for very large matrix-vector multiplication (10^8 * 10^8), which is simplified to a vector-to-vector convolution, and further reduced to a Discrete Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;May I ask whether DFT is accurate? Because the matrix has all discrete binary elements, and the multiplication process would not tolerate any non-zero error probability in result. However from the things I currently learnt about DFT it seems to be an approximation algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, may I ask roughly how long would the code be? i.e. would this be something I could start from scratch and compose in C++ in perhaps one or two hundred lines? Cause actually this is for a paper...and all I need is that the complexity analyis is $\mathcal{O}(n \log n)$ and the coefficient in front of it doesn't really matter :) So the simplest implementation would be best. (Although I did see some packages like kissfft and FFTW, but they are very lengthy and probably an overkill for my purpose...)&lt;/p&gt;&#xA;" OwnerUserId="10680" LastEditorUserId="8202" LastEditDate="2014-08-01T07:54:06.867" LastActivityDate="2014-08-01T07:54:06.867" Title="Writing a Discrete Fourier Transform program" Tags="|fft|dft|convolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17568" PostTypeId="1" CreationDate="2014-07-31T16:42:00.623" Score="-1" ViewCount="1398" Body="&lt;p&gt;I have to calculate asymptotic coding gain with soft decision decoding over an uncoded reference system. Lets say the coded system requires a bandwidth $k$ times higher than the bandwidth of the uncoded system. Does the variance of the white additive Gausian  noise of the coded system is $k$ times the variance of the same noise in the uncoded sytem?&lt;/p&gt;&#xA;" OwnerUserId="10681" LastActivityDate="2014-07-31T18:11:11.170" Title="How is noise variance related to bandwidth?" Tags="|bandwidth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17569" PostTypeId="1" CreationDate="2014-07-31T17:10:35.027" Score="0" ViewCount="881" Body="&lt;p&gt;I currently work in a project of clinical software (C#) which deals with clinical biosignals, specifically EMG and other low-frequency signals (load-cells, goniometers, and other biomechanical instruments).&lt;/p&gt;&#xA;&lt;p&gt;We have to be able to:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create filters based on cuttoff frequencies (low and high) and filter order, for a given sampling frequency; The band-pass could be a cascading of one low-pass and one high-pass filters;&lt;/li&gt;&#xA;&lt;li&gt;Apply filters in real-time, that is, adding a new input sample and immediately taking a new output sample, in a loop;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I have read a lot about filter types, but explanations are usually based on math notation, while I would need a more computational explanation.&lt;/p&gt;&#xA;&lt;p&gt;Also, reading source code (mostly from Octave-Forge) I can only &amp;quot;see&amp;quot; a lot of numbercrunching without actually understanding what is happening.&lt;/p&gt;&#xA;&lt;p&gt;As I understand (correct me if I am wrong), an implementation of what I need would involve:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Choose some input parameters for filter creation, that is, Low Frequency, High Frequency, Sampling Rate, and Filter Order;&lt;/li&gt;&#xA;&lt;li&gt;Execute some magic operation on these parameters, that would give me a recurrence relation; This recurrence relation would be contained in an instance of a filter;&lt;/li&gt;&#xA;&lt;li&gt;This filter instance would have a buffer of size N. As I start to collect data, the following loop would start to run:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add new input sample to filter;&lt;/li&gt;&#xA;&lt;li&gt;Apply recurrence relation;&lt;/li&gt;&#xA;&lt;li&gt;Read new output sample;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So what I have to ask is:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Does my computational rationale about filter design and usage (as explained in the bullet-list just above) makes sense from a DSP perspective? That is, would it be a feasible plan to implement some Filter class according to such rationale?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Which concepts should I know / read about in order to properly implement such filter? For example, I understand that recurrence relation, order, sampling rate, (implicit) impulse response, are a bare minimum to define a filter, but I also read about number of taps, poles and zeros, gain, direct form, cascaded sections, and I am not sure it is necessary to deal with all the concepts to satisfy my requirements.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there any conceptual topic or resource (link, book) I should take a look? Preferrably one focusing on implementation (that is, without heavy math notation)?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1558" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-07-31T21:26:16.563" Title="Design and implementation of causal band-pass filter for biosignals - what to consider?" Tags="|filters|filter-design|bandpass|software-implementation|" AnswerCount="1" CommentCount="6" ClosedDate="2014-08-02T01:19:55.857" ContentLicense="CC BY-SA 3.0" />
  <row Id="17570" PostTypeId="1" AcceptedAnswerId="17577" CreationDate="2014-07-31T17:31:47.013" Score="3" ViewCount="271" Body="&lt;p&gt;While learning Fourier series I read the definitions of representation for a continuous time signal $x(t)$ as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=A_0 + 2 \sum_{k=1}^{\infty} A_k \cos(k \omega_0 t) - B_k \sin(k \omega_0 t) \tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A_k$ and $B_k$ are real.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another definition was:&#xA;$$x(t)=a_0 + \sum_{k=1}^{\infty} a_k \cos(k \omega_0 t) + b_k \sin(k \omega_0 t) \tag{2}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why two different definitions?  I mean in $(1)$ there is a coefficient of $2$ for sinusoids and sine coefficients are negated.&lt;/p&gt;&#xA;" OwnerUserId="7724" LastEditorUserId="4346" LastEditDate="2014-07-31T20:53:38.740" LastActivityDate="2014-08-01T08:12:07.383" Title="Trignometric Fourier series representation of a continous time signal" Tags="|fourier-series|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17572" PostTypeId="2" ParentId="17568" CreationDate="2014-07-31T18:11:11.170" Score="1" Body="&lt;p&gt;White noise has a flat power spectrum (i.e. its power spectral density is the same at all frequencies). For a white noise process with power spectral density $S_n(f) = \frac{N_0}{2}\text{ W/Hz}$, the noise power within a bandwidth of $B\text{ Hz}$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P_n = BS_n(f) = \frac{N_0}{2}B\text{ (Watts)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as you asked, for a white noise process, the total noise power over a particular bandwidth is proportional to the bandwidth. Therefore, if you increase a signal's bandwidth by a factor $k$, then the total noise power across the newly-expanded signal bandwidth also increases by the same factor $k$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-07-31T18:11:11.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17573" PostTypeId="2" ParentId="17570" CreationDate="2014-07-31T18:26:21.163" Score="-2" Body="&lt;p&gt;The first represented is single sided (only positive frequency) that usually is introduced with reference to the double ended complex form of the Fourier series. The coefficients B and C are real because of how they relate to the generally complex coefficients from the negative and positive frequency components in the complex form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going back to the first form, the complex representation uses a sum from $-\infty$ to $+\infty$.  Typically a complex exponential is used in the sum, but $\cos + i\sin$ works just fine.  Say the sum is defined with COMPLEX coefficients using the letter $a$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a relationship between the two sets of coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B_k = 2\operatorname{Re}(a_k)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C_k = -2\operatorname{Im}(a_k)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the negative sign on $C$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2nd representation is a valid representation but because the series is defined only in terms of positive frequency and real functions, the coefficients are calculated differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This answer is correct.  For anyone that doesn't understand what a singled ended representation of a Fourier series is, please read the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/371361J-01/lvanlsconcepts/lvac_convert_twosided_power_spec_to_singlesided/&quot; rel=&quot;nofollow&quot;&gt;http://zone.ni.com/reference/en-XX/help/371361J-01/lvanlsconcepts/lvac_convert_twosided_power_spec_to_singlesided/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. robert bristow-johnson&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also consult the standard bearer on LTI systems, Athanasios Papoulis, &quot;Circuits and Systems&quot; pp 336.&lt;/p&gt;&#xA;" OwnerUserId="3562" LastEditorUserId="8202" LastEditDate="2014-08-01T08:12:07.383" LastActivityDate="2014-08-01T08:12:07.383" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="17576" PostTypeId="2" ParentId="17569" CreationDate="2014-07-31T21:26:16.563" Score="1" Body="&lt;p&gt;Your bullet list makes sense and you seem to have the right idea. I think you mostly want a link that will show you how to get started, so let me suggest this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, start with an FIR filter. A very good FIR filter can be generated with as little as 10 lines of code, and implemented with another 10 lines of code. Basically, with FIR, if it's complicated, you are doing it wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This link has source code for Windowed FIR, Parks McClellan FIR, and IIR filters, as well as code for implementing both FIR and IIR filters. Start with the Windowed FIR. They work great and are the simplest to generate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.iowahills.com/A7ExampleCodePage.html&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/A7ExampleCodePage.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2014-07-31T21:26:16.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17577" PostTypeId="2" ParentId="17570" CreationDate="2014-07-31T21:54:54.573" Score="6" Body="&lt;p&gt;alright, let's review a little bit of Euler before we get to the Fourier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ e^{j \theta} \ = \ \cos(\theta) \ + \ j \sin(\theta) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from that you can get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \cos(\theta) = \frac{e^{j \theta} + e^{-j \theta}}{2} \quad\quad\quad \sin(\theta) = \frac{e^{j \theta} - e^{-j \theta}}{2j} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so now let's look at Eq (1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x(t) \ &amp;amp;= \ A_0 \ + \ 2 \sum_{k=1}^{\infty} A_k \cos(k \omega_0 t) - B_k \sin(k \omega_0 t) \\&#xA; &amp;amp;= \ A_0 \ + \ 2 \sum_{k=1}^{\infty} A_k \frac{e^{j k \omega_0 t} + e^{-j k \omega_0 t}}{2} \ - \ B_k \frac{e^{j k \omega_0 t} - e^{-j k \omega_0 t}}{2j} \\&#xA; &amp;amp;= \ A_0 \ + \ \sum_{k=1}^{\infty} (A_k + jB_k) e^{j k \omega_0 t} \ + \ (A_k - jB_k) e^{-j k \omega_0 t} \\&#xA; &amp;amp;= \ \sum_{k=-\infty}^{\infty} c_k \ e^{j k \omega_0 t} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ c_k =&#xA;\begin{cases}&#xA;A_{-k} - jB_{-k}, &amp;amp; \quad \text{for } k &amp;lt; 0 \\&#xA;A_0, &amp;amp; \quad\quad k = 0 \\&#xA;A_k + jB_k, &amp;amp; \quad\quad k &amp;gt; 0 &#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, going in the other direction,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{array}{lcl}&#xA;A_0 &amp;amp; = &amp;amp; c_0 \\&#xA;A_k &amp;amp; = &amp;amp; \Re\{c_k \} \quad\quad \text{for } k&amp;gt;0\\&#xA;B_k &amp;amp; = &amp;amp; \Im\{c_k \} \quad\quad\quad k&amp;gt;0&#xA;\end{array} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that for real $A_k$ and real $B_k$, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ c_{-k} = c_k^* = \text{&quot;complex conjugate of } c_k \text{ &quot;}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, for Eq (1), the simplicity of having the real and imaginary parts of the $c_k$ coefficients be simply $A_k$ and $B_k$ (for $k \ge 0$) is the motivation for the &lt;strong&gt;convention&lt;/strong&gt; of the leading &quot;2&quot; before the summation and for the minus sign.  it's just a convention.  this convention is useful because it's much easier to derive the coefficients $c_k$ than it is to derive the coefficients $A_k$ and $B_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ c_k \ = \ \frac{\omega_0}{2 \pi}\int_{t_0 - \pi/\omega_0}^{t_0 + \pi/\omega_0} x(t) \ e^{-j k \omega_0 t} \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ -\infty &amp;lt; t_0 &amp;lt; +\infty $ can be any convenient real value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the convention for Eq. (2) comes about from looking at Fourier series first as a real analysis problem without the use of complex variables.  then this is a simple first statement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) \ = \ a_0 \ + \ \sum_{k=1}^{\infty} a_k \cos(k \omega_0 t) + b_k \sin(k \omega_0 t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as you can see $a_k$ and $b_k$ are related to $A_k$ and $B_k$ in a very simple and straight forward manner.  you can derive that simple relationship.  but the formulae for getting $a_k$ and $b_k$ from $x(t)$ (and $\omega_0$) is less straight forward to derive and to express.  if fact, it's &lt;strong&gt;two&lt;/strong&gt; equations, not one simpler equation.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-07-31T23:49:16.210" LastActivityDate="2014-07-31T23:49:16.210" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17578" PostTypeId="1" CreationDate="2014-08-01T03:14:55.017" Score="2" ViewCount="2512" Body="&lt;p&gt;In image processing, we have two kinds of major kernels that are average kernel and Gaussian kernel. For image segmentation, which is difference between average kernel and Gaussian kernel? I found some paper said that they are similar, and average kernel implement faster than Gaussian kernel, right?When we use average kernel&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="128" LastEditDate="2018-05-11T20:57:46.987" LastActivityDate="2024-04-03T09:05:55.717" Title="Comparison Between Average Kernel (Box Kernel) and Gaussian Kernel" Tags="|image-processing|computer-vision|image-segmentation|gaussian|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17579" PostTypeId="1" AcceptedAnswerId="17580" CreationDate="2014-08-01T05:12:06.813" Score="9" ViewCount="31655" Body="&lt;p&gt;I have a bandpass signal centered at 2 MHz and bandwidth of 50 kHz (the signal frequency varies from 2 MHz - 25 kHz to 2 MHz + 25 kHz). This signal is being sampled at 10 MHz.&#xA;I want a frequency resolution of 100 Hz in FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How many samples of the signal should I take to achieve this frequency resolution.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What should be the number of points in FFT for this frequency resolution.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My thoughts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Minimum frequency in the bandpass signal = 1.975 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To complete one period of the minimum frequency = 5.0633e-07 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No of samples in 5.0633e-07 seconds = 5.0633 ~ 6 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at least 6 samples should be taken to complete one cycle of min frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the frequency resolution is 100 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the sampling frequency is 10 MHz, Maximum frequency can be detected is 5 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So 5MHz/100Hz = 50000 points will be there in first half of FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second half of the FFT is redundant (complex conjugation of the first half).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I should take 2*50000 = 1,00,000 point FFT (2^17 = 131072 point FFT) for the above specifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will this work?&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="128" LastEditDate="2018-09-17T22:19:04.607" LastActivityDate="2018-09-17T22:19:04.607" Title="Number of DFT (FFT) Points Required for a Specific Frequency Resolution for an Oversampled Signal" Tags="|fft|frequency-spectrum|dft|frequency-domain|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17580" PostTypeId="2" ParentId="17579" CreationDate="2014-08-01T06:41:00.750" Score="7" Body="&lt;ol&gt;&#xA;&lt;li&gt;The resolution in the DFT is given by: $ \frac{{F}_{s}}{N} $.&lt;br&gt;&#xA;Hence you need 10e6 / 100 = 100,000 samples to get the resolution you want.&lt;/li&gt;&#xA;&lt;li&gt;You may bring the signal to the baseband (demodulation) and then you'll need a lower frequency of sampling to achieve what you want.&lt;br&gt;&#xA;Since the effective bandwidth of the signal is (Two Sided) 50 [KHz], it can be sampled at $ {F}_{S} = 50 [KHz] $ and only 500 samples would be required for the asked resolution.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-08-01T08:47:57.030" LastActivityDate="2014-08-01T08:47:57.030" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17581" PostTypeId="2" ParentId="17579" CreationDate="2014-08-01T06:42:01.993" Score="5" Body="&lt;p&gt;The frequency resolution $f_\Delta$ is&#xA;$$&#xA;f_\Delta = \frac{f_\mathrm{s}}{N},&#xA;$$&#xA;where $f_\mathrm{s}$ is the sampling frequency and $N$ is the FFT size. So&#xA;$$&#xA;N = \frac{f_\mathrm{s}}{f_\Delta} = \frac{10^7}{100} = 10^5.&#xA;$$&#xA;This means your calculation is correct. Assuming that you don't zero-pad the FFT input vector, $N$ is the number of samples you should acquire and then feed into the FFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use $M$ samples, with $M&amp;lt;N$ you can append $N-M$ zeros to the FFT input which will result in an interpolation of the &quot;missing&quot; frequency bins.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-08-01T08:30:55.790" LastActivityDate="2014-08-01T08:30:55.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17582" PostTypeId="2" ParentId="17578" CreationDate="2014-08-01T06:42:40.423" Score="0" Body="&lt;p&gt;If you pre calculate the filter coefficients the complexity of the convolution is set by its radius only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, if all coefficients are the same, it could be reduced into summation and one normalization multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, I don't think it will have major effect on modern CPU's.&lt;br&gt;&#xA;Certainly not on those who supports fused multiply and addition.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2014-08-01T07:19:10.983" LastActivityDate="2014-08-01T07:19:10.983" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17583" PostTypeId="2" ParentId="17567" CreationDate="2014-08-01T07:41:46.897" Score="0" Body="&lt;p&gt;When applied correctly, the DFT yields exactly the same result as convolution, it is no approximation (neglecting rounding errors due to limited precision of floating point calculations, of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate the &lt;em&gt;circular&lt;/em&gt; convolution of vectors $x$ and $y$ (both of length $N$):&#xA;$$&#xA;x \circledast y = \operatorname{IDFT}_N\left[\operatorname{DFT}_N[x]\cdot\operatorname{DFT}_N[y]\right]&#xA;$$&#xA;To calculate the &lt;em&gt;linear&lt;/em&gt; convolution first append $N-1$ zeros to both vectors yielding the zero-padded vectors $\tilde x$ and $\tilde y$. Then:&#xA;$$&#xA;x * y = \operatorname{IDFT}_{2N-1}\left[\operatorname{DFT}_{2N-1}[\tilde x]\cdot\operatorname{DFT}_{2N-1}[\tilde y]\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement the [I]DFT I highly recommend the FFTW library. I promise that it will take you less time to learn its usage than to write your own implementation. For the special case of $x$ and $y$ containing only $1$ and $0$ their might be a more efficient algorithm, though. You would have to look into the Cooley-Tukey algorithm that is used for the FFT and see if you can simplify it for your needs. Whether it gets simpler will also depend on how you define computational complexity - if you define it in terms of additions and multiplications a custom FFT implementation probably won't buy you much. But if you go down to the hardware implementation level you can save some multipliers in the first butterfly stage by replacing them with multiplexers. Anyway, it is well known that the FFT algorithm complexity is of order $N\log N$ as you say. I would like to think that you don't have to show this again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like to play around with IFFT and FFT I recommend Octave (an open source Matlab clone).&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-08-01T07:41:46.897" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17585" PostTypeId="1" AcceptedAnswerId="17586" CreationDate="2014-08-01T11:08:45.797" Score="4" ViewCount="581" Body="&lt;p&gt;I'm studying a book about DSP and trying to make exercises. Here is one I'm interested in:&lt;/p&gt;&#xA;&lt;p&gt;A scientist acquires 65,536 samples from an experiment at a sampling rate&#xA;of 1 MHz.  He knows that the signal contains a sinusoid at 100 kHz.  He&#xA;needs to determine is if there is a second sinusoid at 103 kHz.  As a start,&#xA;he takes a 65,536 point DFT of the signal.  To his surprise, all he can see&#xA;in the spectrum is noise.  He estimates that the signal he is looking for is&#xA;4 times lower in amplitude than the random noise (i.e., SNR = 0.25). He also&#xA;estimates that the SNR will need to be at least 3.0 for the signal to be&#xA;detected, if present.  To improve the SNR, he decides to break the signal&#xA;into segments, and average their spectra.  Arrange your answers to the&#xA;following questions in a table.&lt;/p&gt;&#xA;&lt;p&gt;a. If he uses a segment length of 16,384 samples, what will be the frequency&#xA;resolution (i.e., the spacing between data points) in the averaged spectrum?&#xA;Give your answer in hertz.  How many segments will be averaged?  What is the&#xA;SNR of the averaged spectrum?  Does this have the required frequency&#xA;resolution?  Does this have the required SNR?&lt;/p&gt;&#xA;&lt;p&gt;b. Repeat for segment lengths of: 8192, 4096, 2048, 1024, 512, 256, and 128.&lt;/p&gt;&#xA;&lt;p&gt;Here is my solutions:&lt;/p&gt;&#xA;&lt;p&gt;1)&lt;/p&gt;&#xA;&lt;p&gt;16384 samples&lt;/p&gt;&#xA;&lt;p&gt;4 segments will be averaged&lt;/p&gt;&#xA;&lt;p&gt;freq. resolution would be (25*10^4)/8193Hz ~ 30Hz&lt;/p&gt;&#xA;&lt;p&gt;(it is told in the book that random noise reduces in proportion to the square-root of the number of segments)&#xA;snr = 0.25 *&lt;span class=&quot;math-container&quot;&gt;$\sqrt{4}$&lt;/span&gt; =0.5 (not enough)&lt;/p&gt;&#xA;&lt;p&gt;freq. resolution is enough to resolve between 100kHz and 103kHz sinusoid&lt;/p&gt;&#xA;&lt;p&gt;2)&lt;/p&gt;&#xA;&lt;p&gt;2048 samples&lt;/p&gt;&#xA;&lt;p&gt;32 segments will be averaged&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$10^6$&lt;/span&gt;/32 = 31250&lt;/p&gt;&#xA;&lt;p&gt;freq. resolution would be 31250/1025Hz ~ 30Hz&lt;/p&gt;&#xA;&lt;p&gt;snr = 0.25 *&lt;span class=&quot;math-container&quot;&gt;$\sqrt{32}$&lt;/span&gt; = 1.4 (not enoght)&lt;/p&gt;&#xA;&lt;p&gt;freq. resolution is ok&lt;/p&gt;&#xA;&lt;p&gt;3)&lt;/p&gt;&#xA;&lt;p&gt;128 samples&lt;/p&gt;&#xA;&lt;p&gt;512 segments will be averaged&lt;/p&gt;&#xA;&lt;p&gt;freq. resolution would be 1953/65Hz ~ 30Hz&lt;/p&gt;&#xA;&lt;p&gt;snr = 0.25 *&lt;span class=&quot;math-container&quot;&gt;$\sqrt{512}$&lt;/span&gt; = 5.6 (is ok)&lt;/p&gt;&#xA;&lt;p&gt;freq. resolution is ok&lt;/p&gt;&#xA;&lt;p&gt;Am I right or wrong? Where I can be wrong?&lt;/p&gt;&#xA;&lt;p&gt;Thank you so much in advance!&lt;/p&gt;&#xA;" OwnerUserId="7052" LastEditorUserId="128" LastEditDate="2020-10-05T15:07:39.943" LastActivityDate="2020-10-05T15:07:39.943" Title="Exercise Related to Frequency Resolution and SNR" Tags="|frequency-spectrum|dft|frequency-domain|snr|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17586" PostTypeId="2" ParentId="17585" CreationDate="2014-08-01T11:22:12.820" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Your calculation of the SNR is right and the DFT Bin Resolution is also OK.&lt;/li&gt;&#xA;&lt;li&gt;One thing you're missing is the effective resolution due to &quot;Windowing&quot; effect.&lt;br&gt;&#xA;The DFT of finite number of samples is interpolated by a Dirichlet Kernel (Like Sinc).  It means you resolution is also limited by the main lobe width of the Sinc which is proportional to the inverse of the window length.&lt;br&gt;&#xA;Namely, using less samples means wider lobe which reduces the resolution and the ability to differ between two harmonic signals.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-08-01T11:22:12.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17587" PostTypeId="2" ParentId="17529" CreationDate="2014-08-01T13:57:53.310" Score="1" Body="&lt;p&gt;Yes, it is possible to implement a Hilbert transform in the analog domain, although it is difficult to get the desired phase shift over a significant bandwidth when you take component uncertainties and imperfections into account. There is some discussion of the topic &lt;a href=&quot;http://home.comcast.net/~szemengtan/LinearSystems/hilbert.pdf&quot; rel=&quot;nofollow&quot;&gt;in this document&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why you think you would use an integrator instead of a delay. The analog counterpart of a discrete-time delay is a continuous-time delay. This can be implemented in various ways, although as noted before, achieving precise delays in analog electronics is quite difficult. Some methods that I've seen before for inducing delays include introducing capacitive delays (e.g. with an RC filter) or using &lt;a href=&quot;http://en.wikipedia.org/wiki/Surface_acoustic_wave#SAW_devices&quot; rel=&quot;nofollow&quot;&gt;surface acoustic wave (SAW) devices&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2014-08-01T15:55:32.663" LastActivityDate="2014-08-01T15:55:32.663" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17590" PostTypeId="2" ParentId="17579" CreationDate="2014-08-01T16:35:11.997" Score="2" Body="&lt;p&gt;Given that the result of an FFT can be interpolated (possibly very accurately using Sinc interpolation), the number of FFT points required to estimate the frequency depends on the signal-to-noise ratio of the data containing your signal, and the type of resolution you require (peak separation, or peak estimation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the extreme case of zero noise or other interference, only 3 or 4 non-aliased points are required to exactly reconstruct a pure sinusoid and thus estimate its frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At another extreme, with equal levels of closely neighboring interference, over 2 FFT bin results of separation from the noise may be required, possibly requiring over 200000 samples in your case, to resolve a distinct peak clearly separated from adjacent noise by at least 100 Hz and at least 3dB above the local noise floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very rarely is the noise level exactly such that one has a noise-added resolution error of around Fs/N.  At often typical lower noise levels, you can interpolate an estimated frequency peak between FFT result bins to some fraction of the bin spacing, and thus use an FFT some fraction shorter than N = Fs/dF.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-02T06:37:41.100" LastActivityDate="2014-08-02T06:37:41.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17591" PostTypeId="1" CreationDate="2014-08-01T20:19:14.410" Score="3" ViewCount="459" Body="&lt;p&gt;I am looking for a kernel acting as a low pass filter that satisfies these conditions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$K(-\mathbf{u})=K(\mathbf{u}) \tag{1}$$&#xA;$$K(\mathbf{u}) \ge K(\mathbf{v}), \;\; \text{if} \;\; |\mathbf{u}|&amp;lt;|\mathbf{v}|, \;\; \text{and} \;\; \lim_{|\mathbf{u}|\rightarrow\infty} K(\mathbf{u})=0  \tag{2}$$&#xA;$$\int K(\mathbf{x})d\mathbf{x} = 1 \tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the reference paper, the author suggested a Gaussian kernel that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$K_\sigma(\mathbf{u})=\frac{1}{\left(\sqrt{2\pi}\sigma\right)^n}e^{-|\mathbf{u}|^2/2\sigma^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with a scale parameter $\sigma &amp;gt; 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Gaussian kernel is very good at approximating the required properties. But the kernel reduces edge information when the kernel size is large. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you suggest to me any kernel that can satisfy the three conditions above, and is more robust than Gaussian in noise reduction, while maintaining edge information? I found a modified kernel, but it was very difficult to implement. Thank you so much. &lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="128" LastEditDate="2020-09-15T05:57:19.183" LastActivityDate="2022-01-30T12:44:28.840" Title="Low Pass Filter to Maintain Edge Information" Tags="|image-processing|filters|computer-vision|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="17593" PostTypeId="1" AcceptedAnswerId="19809" CreationDate="2014-08-02T06:13:38.533" Score="2" ViewCount="24728" Body="&lt;p&gt;Doppler frequency is calculated by the formula $f_{d} = 2*v_{r}/\lambda$, where $v_{r}$ is the radial velocity and $\lambda$ is the radar wavelength. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally FFT is used to detect the doppler frequency(A bank of FFT filters is used for Doppler frequency estimation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that sampling frequency is fixed as $4*f_{max}$, where $f_{max}$ is the maximum $f_{d}$ corresponding to the maximum radial velocity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have to determine the number of FFT points to be employed in the FFT calculation. How can I determine this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, which target parameter determines the Doppler frequency resolution.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastActivityDate="2021-03-16T14:16:03.903" Title="Doppler Frequency Resolution for Radar" Tags="|fft|resolution|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17594" PostTypeId="1" AcceptedAnswerId="17601" CreationDate="2014-08-02T06:55:28.577" Score="4" ViewCount="920" Body="&lt;p&gt;I am working with images and Fourier transforms.  I am trying to understand what might be causing some artifacts in my output image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am starting with a 512x512, RGB image of Lenna.  I FFT the image, and run a low-pass filter on it.  Unchanged for everything inside the circle, 0 for everything outside the circle.  Here is what the mask looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KAcge.jpg&quot; alt=&quot;Mask&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good.  When I inverse FFT back to an image, I get bright green artifacts:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TM3bS.jpg&quot; alt=&quot;Lenna&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These look out of place to me, what might be causing them?  Is it the sharp cutoff in my filter?  I would have guessed that would creating ringing artifacts, but nothing like a sharp color blob.  Also why green only?  It's not like there's a lot of green in the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using numpy on python 2.7.6 in 64-bit Linux, if that matters.&lt;/p&gt;&#xA;" OwnerUserId="10692" LastEditorUserId="128" LastEditDate="2019-03-29T11:38:52.750" LastActivityDate="2022-06-30T05:56:12.987" Title="Color Artifacts in Fourier Transformed Image" Tags="|image-processing|fft|dft|python|frequency-domain|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17595" PostTypeId="2" ParentId="15190" CreationDate="2014-08-02T09:56:54.637" Score="1" Body="&lt;p&gt;Let's try to think of it intuitively.&lt;br&gt;&#xA;Given the LPF what would make the inverse &quot;Hard&quot;?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sections we won't be able to recover are where the LPF is 0, since there is no inverse for that we can multiply the result by.&lt;br&gt;&#xA;Real world LPF won't reach &quot;Real&quot; zero as usually.&lt;br&gt;&#xA;But what would make it hard to recover is where there are big ratios between the biggest and the smallest magnitude.&lt;br&gt;&#xA;As close and fast your LPF goes to zero (And has magnitudes which are big) the harder the recovery will be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now just build analog LPF which this requirements at different scales, digitize it, create the Convolution Matrix and there you have it...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A practical example is given in &lt;a href=&quot;https://dsp.stackexchange.com/a/43973/128&quot;&gt;my answer&lt;/a&gt; to &lt;a href=&quot;https://dsp.stackexchange.com/questions/23350&quot;&gt;1D Deconvolution with Gaussian Kernel (MATLAB)&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-02-08T09:41:19.693" LastActivityDate="2019-02-08T09:41:19.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17596" PostTypeId="2" ParentId="17594" CreationDate="2014-08-02T10:01:57.637" Score="2" Body="&lt;p&gt;Some things you should keep in mind:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your image is real, keep your DFT Symmetric.&lt;/li&gt;&#xA;&lt;li&gt;Numerical issues might cause that after the Inverse DFT imaginary parts are lefts.&lt;br /&gt;&#xA;Use either &lt;code&gt;abs&lt;/code&gt; or &lt;code&gt;real&lt;/code&gt; to get rid of them. Most people use &lt;code&gt;real()&lt;/code&gt; as it is a linear operation to the least.&lt;/li&gt;&#xA;&lt;li&gt;One should understand what it means to &amp;quot;Zero&amp;quot; out by mask DFT values.&lt;br /&gt;&#xA;It is not the &amp;quot;Ideal LPF&amp;quot;. It causes Ringing / Halos due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Gibbs_phenomenon&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gibbs Phenomenon&lt;/a&gt;. One should use better designed LPF.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-06-30T05:56:12.987" LastActivityDate="2022-06-30T05:56:12.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17597" PostTypeId="2" ParentId="17593" CreationDate="2014-08-02T10:04:39.127" Score="0" Body="&lt;p&gt;Depends on the resolution you want for doppler frequency.  Doppler frequency resolution determines how well you can observe targets of different radial velocities.  If you want to resolve targets that are closely spaced in radial velocities you will need to have higher doppler resolution measurement.  That means you will have to have more number of points in your FFT calculation.  That means you have to observe the signal for a longer time.  Fsampling/N will give you the frequency bin resolution where N is the number of points in FFT and Fsampling is the sampling frequency.&lt;/p&gt;&#xA;" OwnerUserId="10488" LastActivityDate="2014-08-02T10:04:39.127" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17598" PostTypeId="1" CreationDate="2014-08-02T10:53:16.553" Score="0" ViewCount="75" Body="&lt;p&gt;I have a device that connect with USB to my computer. This device have digital signal that I can sample it every few seconds. The signal that the device perform, is a digital signal with $X$ seconds of $1$ and $Y$ seconds of $0$ ($X$ and $Y$ are integers and consts).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is to estimate if in $Z$ seconds from now, the signal will be $1$. The problem is that I don't know what are $X$ and $Y$ (I don't know how much time $1$ and $0$ are), so I don't know how can I estimate it, and I can sample it every 10 seconds ($X$ and $Y$ can be less then 5).&#xA;But if I sample $0$ at some moment, the device tells me in how much seconds $1$ will appear again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have basic knowledge in signal analysis and I don't know how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible at all? If it is, how can I do it?&lt;/p&gt;&#xA;" OwnerUserId="10693" LastEditorUserId="10693" LastEditDate="2014-08-02T12:04:55.567" LastActivityDate="2014-08-02T17:41:48.343" Title="Estimate digital signal" Tags="|signal-analysis|digital|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17599" PostTypeId="2" ParentId="17593" CreationDate="2014-08-02T16:26:04.253" Score="1" Body="&lt;p&gt;Similar to spectral estimation problems, if you need better resolution, (aka narrower mainlobe in your estimate), then you need to have a larger set of data to FFT. A larger set of data means you have a longer record, and thus, when FFT'd, your mainlobe becomes narrower. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NS1z8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ability to discriminate between peaks of overlapping main lobes is what is commonly used as a metric for resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If however you want to keep the frame size the same, but increase your frequency &lt;em&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/10293/zero-padding-in-fft/10295#10295&quot;&gt;granularity&lt;/a&gt;&lt;/em&gt;, then you can zero-pad your data pre-FFT, (but post-windowed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In pulse-doppler radar applications, that means you need more pulse-records whose constant-range samples are to be FFT'd across records. This in turn means you need to transmit more pulses. This also makes intuitive sense: If you want to estimate the velocity of a target, you need to probe it longer - aka - you need to send out more pulses - aka - more data, and thus, a larger record length. &lt;/p&gt;&#xA;" OwnerUserId="4619" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-08-02T17:00:59.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17600" PostTypeId="2" ParentId="17598" CreationDate="2014-08-02T17:31:02.510" Score="1" Body="&lt;p&gt;If X plus Y is longer than twice your sample rate, 20 seconds, but not an exact rational multiple of your sample rate, then with a large enough number of samples you might be able to make a frequency and duty cycle estimate by calculating the statistics and spectrum of the sample vector.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-02T17:41:48.343" LastActivityDate="2014-08-02T17:41:48.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17601" PostTypeId="2" ParentId="17594" CreationDate="2014-08-03T04:52:17.230" Score="2" Body="&lt;p&gt;Sharp filter cutoffs (such as caused by just zeroing FFT bins) can cause ringing (look up &lt;a href=&quot;https://en.wikipedia.org/wiki/Gibbs_phenomenon&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gibbs horns&lt;/a&gt;). If any ringing artifacts go outside the legal range of color values (e.g. without being clamped), they can overflow or numerically wrap and cause these bright color spot artifacts in dark areas of the image.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2022-06-30T04:18:10.377" LastActivityDate="2022-06-30T04:18:10.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17605" PostTypeId="1" AcceptedAnswerId="17607" CreationDate="2014-08-03T11:19:24.513" Score="4" ViewCount="8883" Body="&lt;p&gt;I have some issues understanding the use of a window (it doesn't matter which one) to calculate the &lt;strong&gt;Power Spectral Density&lt;/strong&gt; of a signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example say I want to use the hann window, with $N = 1024$, knowing that my signal length is $X &amp;gt; N$, $X$ is arbitrary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I calculate the PSD : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take 1024 samples from the signal, multiply them in the time domain  with window function. Then transform those 1024 time values. After that take the next 1024 samples of the signal and do the same thing, then add the result to the spectrum that I got the first time and so on? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the way I understood this, but to be honest I'm not sure that it is a right way?&lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="128" LastEditDate="2018-06-16T19:13:13.947" LastActivityDate="2018-06-16T19:13:13.947" Title="Understanding the Windowing Method in PSD Calculation" Tags="|discrete-signals|power-spectral-density|spectrum-estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17606" PostTypeId="1" CreationDate="2014-08-03T11:29:05.757" Score="1" ViewCount="2934" Body="&lt;p&gt;I have designed my filter using &lt;code&gt;firhalfband(N,Fo,A)&lt;/code&gt;, which gives me the filter coefficients. Then I try to see the frequency response of it. I use these two function: &lt;code&gt;fft&lt;/code&gt;, and &lt;code&gt;freqz&lt;/code&gt;, but they are giving me different result in my figure, why is that? I wonder how these two MATLAB functions operate when taking the frequency response of a signal. I am expecting them to be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="10411" LastEditorUserId="4875" LastEditDate="2014-08-04T07:17:43.887" LastActivityDate="2014-08-04T07:17:43.887" Title="Frequency response of a filter - fft vs. freqz" Tags="|matlab|fft|filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17607" PostTypeId="2" ParentId="17605" CreationDate="2014-08-03T12:40:20.653" Score="7" Body="&lt;p&gt;I don't really understand what do you mean by &lt;em&gt;multiply them in the time domain and multiply them with window function&lt;/em&gt;. I think that you are trying to implement the Welch's PSD calculation. If so, steps should be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Split your data into possibly overlapping segments of length $N$&lt;/li&gt;&#xA;&lt;li&gt;Preferably remove the mean of each segment.&lt;/li&gt;&#xA;&lt;li&gt;Window each of the segments by multiplying with window function $w$ of your choice.&lt;/li&gt;&#xA;&lt;li&gt;Compute the Fourier Spectrum of such segment (you just calculated the modified periodogram)&lt;/li&gt;&#xA;&lt;li&gt;Continue until all segments are processed, then average all of them. This will produce your PSD.&lt;/li&gt;&#xA;&lt;li&gt;The last step is to scale your average by a proper factor.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For more details I am suggesting you refer to this document (Chapter 12 should be interesting for you, as well as previous ones):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://holometer.fnal.gov/GH_FFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heinzel G., et al. - &lt;strong&gt;Spectrum and spectral density estimation by&#xA;  the DFT, including a comprehensive list of window functions and some&#xA;  new flat-top windows&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Possibly you can compare your results with &lt;code&gt;pwelch&lt;/code&gt; function. For more theory, you can refer &lt;a href=&quot;http://user.it.uu.se/~ps/SAS-new.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt; (guys from Mathworks were most likely using this book). If you are using MATLAB, then this code should be helpful - very quick and dirty comparison I used years ago for &lt;code&gt;pwelch&lt;/code&gt;. No overlapping, just two segments, but I am sure it could be a good starting point for you.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Generate the random signal&#xA;N = 2048;&#xA;x = randn(2*N,1); &#xA;% Create the window and precompute scale&#xA;win   = hann(N);&#xA;s_win = norm(win,2)^2;&#xA;% Calculate the Welch's PSD&#xA;Pxx_welch = pwelch(x,win,0,N);&#xA;% Initialize the variable to store all segments&#xA;Pxx = zeros(N,2);&#xA;for k = 0:1&#xA;    x1 = x(1+k*N:(k+1)*N); % Take a segment&#xA;    xw = x1.*win;          % Multiply by window&#xA;    % Square the magnitude and scale&#xA;    Pxx(:,k+1) = abs(fft(xw)).^2./s_win; &#xA;end&#xA;% Average all segments&#xA;Pxx = mean(Pxx,2);&#xA;% Normalize accordingly to pwelch&#xA;Pxx = Pxx./(2*pi);&#xA;% Take only first half of frequencies&#xA;Pxx = Pxx(1:length(Pxx)/2+1);&#xA;% Preserve the energy (we just chopped-off half of spectrum), but do not &#xA;% modify first frequency bin as it is unique (mean value of a signal)&#xA;Pxx(2:end-1) = 2*Pxx(2:end-1);&#xA;% Plot the difference between two PSD's&#xA;plot(abs(Pxx_welch-Pxx))&#xA;title('Difference between pwelch and implementation')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Below is the plot of the difference between &lt;code&gt;pwelch&lt;/code&gt; and the above implementation. One might notice that it is purely related to a round-off error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R3TqA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2017-12-14T16:05:37.197" LastActivityDate="2017-12-14T16:05:37.197" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17609" PostTypeId="1" AcceptedAnswerId="17611" CreationDate="2014-08-03T16:32:31.623" Score="0" ViewCount="94" Body="&lt;p&gt;The Spread Spectrum technologies such as DSSS and FHSS are successful against frequency-selective fading because the original signal is spread to a larger bandwidth and different frequencies are used a different times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do these technologies also mitigate the problems imposed by time-selective fading?&lt;/p&gt;&#xA;" OwnerUserId="8963" LastActivityDate="2014-08-03T17:24:49.720" Title="Do Spread Spectrum technologies combat time-selective fading of a channel?" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17610" PostTypeId="2" ParentId="16184" CreationDate="2014-08-03T17:06:37.270" Score="2" Body="&lt;p&gt;When you say lower frequency waves travel far, you are referring to electromagnetic waves that travel longer distances compared to higher frequency electromagnetic waves such TV waves.  When you say speech signals do not travel long distances you are referring to acoustic waves which are mechanical waves - altogether different from EM waves.  If speech or any information for that  matter is transmitted using low frequency waves they travel long distances.&lt;/p&gt;&#xA;" OwnerUserId="10488" LastActivityDate="2014-08-03T17:06:37.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17611" PostTypeId="2" ParentId="17609" CreationDate="2014-08-03T17:24:49.720" Score="1" Body="&lt;p&gt;I hadn't heard the term &quot;time-selective fading&quot; before, and after a bit of research it appears that it refers to the effects of doppler spreading.  Given that, the answer is &quot;not really&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DSSS is typically extremely sensitive to carrier offset since the pseudo-random chipping sequence is usually quite long.  The long time means that a little carrier offset can lead to destructive interference.  This is dealt with by transmitting the data with a pilot.  It is easy to search for the pilot across multiple carrier offsets by correlating using FFT techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FHSS does not really have any particular advantages or disadvantages that I am aware of when it comes to handling doppler.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-08-03T17:24:49.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17612" PostTypeId="1" AcceptedAnswerId="17614" CreationDate="2014-08-03T18:07:19.097" Score="2" ViewCount="737" Body="&lt;p&gt;I'm reading through some material on wavelet and I'm finding it difficult to see why the following is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\Psi(\omega)$ is the Fourier transform of the mother wavelet $\psi(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}\frac{|\Psi(\omega)|^2}{|\omega|}d\omega&amp;lt;\infty$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then many paper on wavelet would immediate jump to, is obvious that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Psi(0)=0$                              &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But wouldn't the above yield a 0/0 condition? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried relaxing the limits and take a derivative on both side, but this would only imply that the mother wavelet is zero at some frequency $\omega$ not $\omega$ = 0. How do you rigorously prove the above relation?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2014-10-03T02:08:26.770" Title="Wavelets: How does the admissibility condition imply this $\Psi(0)=0$" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17614" PostTypeId="2" ParentId="17612" CreationDate="2014-08-04T00:57:41.933" Score="1" Body="&lt;p&gt;It's obvious that Fourier transform of the mother wavelet is zero at the origin, otherwise the integral, whose argument is nonnegative, would be unbounded. Just because both the numerator and the denominator are zero, it does not mean it does not have a &lt;em&gt;limit&lt;/em&gt;. So we know that $\Psi(0)=0$, but this is merely necessary, not sufficient for the integral to be bounded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the function $f: \omega \to |\sin(\omega)|^2/|\omega|$. How does this function's integral from $(-T,T)$ behave as $T \to \infty$. I hope that gives you some ideas.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-08-04T00:57:41.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17615" PostTypeId="1" CreationDate="2014-08-04T03:09:28.877" Score="2" ViewCount="83" Body="&lt;p&gt;I am working in medical and nature images processing.&lt;br /&gt;&#xA;I want to find a popular method to segment texture image.&lt;br /&gt;&#xA;Could you suggest an approach to do so?&lt;/p&gt;&#xA;&lt;p&gt;Both the feature extraction and classification.&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="128" LastEditDate="2023-07-01T16:34:24.130" LastActivityDate="2023-07-01T16:42:19.523" Title="How to Apply a Texture Classification" Tags="|image-processing|computer-vision|image-segmentation|machine-learning|classification|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17616" PostTypeId="2" ParentId="17606" CreationDate="2014-08-04T05:27:22.480" Score="-2" Body="&lt;p&gt;If you have the filter coefficients, freqz is the way to go - the various optional input arguments and the expected outputs are documented in MATLAB which you can see using help freqz. Snippets given below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot; freqz Digital filter frequency response.&#xA;    [H,W] = freqz(B,A,N) returns the N-point complex frequency response&#xA;    vector H and the N-point frequency vector W in radians/sample of&#xA;    the filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[H,F] = freqz(B,A,N,Fs) and [H,F] = freqz(B,A,N,'whole',Fs) return &#xA;    frequency vector F (in Hz), where Fs is the sampling frequency (in Hz).  &quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have filter's impulse response - which will be different from the filter coefficients - you can use it to find the frequency response of the filter using the FFT.   &lt;/p&gt;&#xA;" OwnerUserId="10488" LastActivityDate="2014-08-04T05:27:22.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17617" PostTypeId="1" AcceptedAnswerId="17625" CreationDate="2014-08-04T07:27:10.233" Score="1" ViewCount="301" Body="&lt;p&gt;I have 3 sensor inputs: $a(t)$, $b(t)$ and $c(t)$. I want to design a filter such that the weighted linear combination of the three is always a constant. Kind of like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w_1(t)a(t) + w_2(t)b(t) + w_3(t)c(t) = k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So from my undergrad modules I think I need a adaptive filters. I can perform training to find $k$ and filter weights at initialization. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;May I know what is the best filter to implement in my case? $a(t)$, $b(t)$ and $c(t)$ are not independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kelvin &lt;/p&gt;&#xA;" OwnerUserId="8546" LastEditorUserId="8202" LastEditDate="2014-08-04T07:34:03.073" LastActivityDate="2014-08-05T02:34:52.017" Title="Adaptive filter weight adjustment" Tags="|adaptive-filters|adaptive-algorithms|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17618" PostTypeId="2" ParentId="10347" CreationDate="2014-08-04T08:23:31.880" Score="-2" Body="&lt;p&gt;In mathematics it is called interpolation.  If you fill data in between data points (in signal processing we call them samples) it is called interpolation.  If you try to fill missing data outside the range of the collected data/samples, it is called extrapolation.  In signal processing, the operation of filling the data in between samples is called interpolation and the blocks that do this operation are called interpolation filters.  &lt;/p&gt;&#xA;" OwnerUserId="10488" LastActivityDate="2014-08-04T08:23:31.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17619" PostTypeId="1" AcceptedAnswerId="17648" CreationDate="2014-08-04T10:52:26.607" Score="6" ViewCount="1362" Body="&lt;p&gt;I wrote an algorithm to do bicubic interpolation of an image.&#xA;I used the method desribed in the wikipedia page.&#xA;On simple images, the result looks good, but on more complex ones, I got strange artifacts in non-smooth zones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could be a probable source of those artifacts, and what can I try to get rid of them ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is on &lt;a href=&quot;https://github.com/gwenzek/scrimage/blob/interpolator/core/src/main/scala/com/sksamuel/scrimage/Interpolator.scala&quot; rel=&quot;nofollow noreferrer&quot;&gt;github&lt;/a&gt;, but I checked it several times, so I don't think the problem comes from it but rather from the simple implementation suggested in &lt;a href=&quot;http://en.wikipedia.org/wiki/Bicubic_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using this particular equation (3rd-order Hermite polynomial interpolation) to do the interpolation (in one dimension):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n+t)=\frac{1}{2}&#xA;\begin{bmatrix}&#xA;1 &amp;amp; t &amp;amp; t^2 &amp;amp; t^3 \\&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;0 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 \\&#xA;-1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;2 &amp;amp; -5 &amp;amp; 4 &amp;amp; -1 \\&#xA;-1 &amp;amp; 3 &amp;amp; -3 &amp;amp; 1 \\&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;x[n-1] \\&#xA;x[n] \\&#xA;x[n+1] \\&#xA;x[n+2] \\&#xA;\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n-1]$, ... $x[n+2]$, .. are the values of the surrounding pixels (in one dimension), and $t$ is the fractional coordinate (where $0 \le t &amp;lt; 1$) of the interpolated pixel between the adjacent pixels $x[n]$, $x[n+1]$. $n$ is an integer and $x(n)=x[n]$ for any integer $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expected output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1r1Ex.png&quot; alt=&quot;The expected output&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My result, look closely at the bird head,a lot of white pixels have appeared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/98MeH.png&quot; alt=&quot;My result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---EDIT---&#xA;To show that my code does produce coherent results, here is the example of my scaling up on simple image with 16 red pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eQeOg.png&quot; alt=&quot;input 4*4 px&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the ouput of the library (which also use 3rd-order Hermite polynomial interpolation):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k57sH.png&quot; alt=&quot;the outpout of the library 200x200&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is my results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5QOpc.png&quot; alt=&quot;the outpout of my code 200x200&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case the difference are IMO totally acceptable, but it shows that my interpolation does something legit.&lt;/p&gt;&#xA;" OwnerUserId="10701" LastEditorUserId="10701" LastEditDate="2014-08-06T15:13:32.623" LastActivityDate="2014-08-07T13:30:16.073" Title="Artifact in Bicubic interpolation" Tags="|interpolation|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17620" PostTypeId="1" AcceptedAnswerId="17621" CreationDate="2014-08-04T15:25:49.897" Score="1" ViewCount="229" Body="&lt;p&gt;Following information is given about a signal $x[n]$&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$x[n]$ is real and even signal&lt;/li&gt;&#xA;&lt;li&gt;$x[n]$ has a period $N=10$ and Fourier coefficients $a_k$&lt;/li&gt;&#xA;&lt;li&gt;$a_{11}=5$&lt;/li&gt;&#xA;&lt;li&gt;$\frac1 {10}\sum_{n=0}^9 |x[n]|^2=50$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;strong&gt;How can we obtain $x[n]$ from these information?&lt;/strong&gt;&lt;br&gt;&#xA;I know the first info makes the Fourier coefficients real and even, third info makes the Fourier coefficient $a_1=a_{11}=5$(since Fourier coeffs are also periodic with N=10) and fourth info is Parsevals theorem.&lt;/p&gt;&#xA;" OwnerUserId="7724" LastEditorUserId="7724" LastEditDate="2014-08-07T17:39:16.590" LastActivityDate="2014-08-07T17:39:16.590" Title="Synthesis discrete time signal from fourier coefficients" Tags="|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17621" PostTypeId="2" ParentId="17620" CreationDate="2014-08-04T17:03:58.183" Score="2" Body="&lt;p&gt;As you indicated, Fourier coefficients are even from first point. This tells you that $a_9 = a_1$, so $a_9 = 5$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from Parseval's theorem, you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;   \begin{align}&#xA;    \frac{1}{10} \sum_{n=0}^9 \left|x[n]\right|^2 &amp;amp;= \sum_{k=0}^9 \left|a_k\right|^2 \\&#xA;     &amp;amp;= 50&#xA;   \end{align}&#xA;   $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $a_1^2 + a_9^2 = 50$, the other coefficients must be 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then $x[n]$ can be computed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;   \begin{align}&#xA;    x[n] &amp;amp;= \sum_{k=0}^9 a_k \exp(2\pi j n k / 10) \\&#xA;         &amp;amp;= a_1 \exp(2\pi j n / 10) + a_9 \exp(2\pi j n \cdot 9 /10) \\&#xA;         &amp;amp;= a_1 \exp(2\pi j n / 10) + a_9 \exp(-2\pi j n /10) \\&#xA;         &amp;amp;= a_1\left[\exp(2\pi j n / 10) + \exp(-2\pi j n /10)\right] \\&#xA;         &amp;amp;= 2 a_1 \cos(2\pi n/10) \\&#xA;         &amp;amp;= 10 \cos(2\pi n/10)&#xA;   \end{align}&#xA;   $$&lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="8952" LastEditDate="2014-08-04T17:33:09.420" LastActivityDate="2014-08-04T17:33:09.420" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17622" PostTypeId="1" CreationDate="2014-08-04T18:40:27.167" Score="0" ViewCount="369" Body="&lt;p&gt;I have a setup with an embedded DSPIC. This is used to link multiple audio inputs to the outputs and changed between them either when told to, or when one is active. This changing takes place on a hardware that is purchased and from what I can tell uses a relay. I have DSP software using a heterodyne filter to remove static noise as the system runs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when the output switches from silent to one output on, there is a large spike in amplitude that lasts for about 3 to 4 milliseconds. This is similar to the click a walkie talkie makes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there was any way to determine when this happened and then do some sort of amplitude reduction. My sample rate is only 8khz and the signal has been checked on the scope to run at 1khz during this period. I tried doing a 5 point median filter which kind of worked, but on a larger speaker system would still be loud. I also looked into doing a differentiation filter and seeing if the derivative was large. If it was I would cut the next sample point in half and continue. This had no apparent effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="10704" LastActivityDate="2014-08-04T19:14:01.620" Title="Long burst of high amplitude noise removal" Tags="|audio|noise|embedded-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17623" PostTypeId="2" ParentId="17591" CreationDate="2014-08-04T19:01:52.203" Score="1" Body="&lt;p&gt;There are many &amp;quot;Edge Preserving&amp;quot; filters in the image processing world.&lt;br /&gt;&#xA;2 very popular would be:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Bilateral_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bilateral Filter&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Anisotropic_diffusion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Anisotropic Diffusion Filter&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Google search on each of the terms will give you plenty of data and code samples of each.&lt;/p&gt;&#xA;&lt;p&gt;For any specific question about them, let me know, I'd be happy to assist.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="7092" LastEditDate="2022-01-30T12:44:28.840" LastActivityDate="2022-01-30T12:44:28.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17624" PostTypeId="2" ParentId="17622" CreationDate="2014-08-04T19:14:01.620" Score="2" Body="&lt;p&gt;If I understand you correctly, then your issue is connected with transient that is present when switching on your device, because it is a RLC circuit. Most likely these spikes are not changing over time (because values of passive components are constant), if so, then you can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create the template of such spike and use the normalised correlation for detection. If it's above a given threshold, then substitute samples with linear/spline or whatever interpolation.&lt;/li&gt;&#xA;&lt;li&gt;Use the Matched Filtering approach (which is almost the same as above approach, but offers better SNR performance) and remove detected samples accordingly&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If your spikes are of random nature, then there is many methods that are allowing to remove any crackles and clicks. You might refer to the literature for such solutions:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ipol.im/pub/pre/64/preprint.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Oudre L. - Automatic detection and removal of impulsive noise in audio signals&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ee.columbia.edu/%7Edpwe/classes/e4810-2004-09/projects/knapp-bashir.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Knapp M., Bashir R. - Audio Click Removal using LPC&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www-dsp.elet.polimi.it/ispg/images/pdf/audio/materiale/godsill-reiner_paper.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Godsil S., Rayner P. - Digital Audio Restoration&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://dafx04.na.infn.it/WebProc/Proc/P_027.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Alvarez E., et al. - Detection of clicks using sinusoidal modelling for the confirmation of the clicks&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-08-04T19:14:01.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17625" PostTypeId="2" ParentId="17617" CreationDate="2014-08-05T02:34:52.017" Score="0" Body="&lt;p&gt;What I was getting at in the comments above is that the linear system $w_1(t)a(t) + w_2(t)b(t) + w_3(t)c(t) = k$ has an infinite number of solutions, so you need to state some criterion that allows you to choose a unique solution. I think you have pointed out a constraint that is worth examining.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea: note that the linear equation I gave above is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Plane_%28geometry%29#Point-normal_form_and_general_form_of_the_equation_of_a_plane&quot; rel=&quot;nofollow&quot;&gt;equation for a plane in $\mathbb{R}^3$&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w_1(t)a(t) + w_2(t)b(t) + w_3(t)c(t) = k$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;This defines a plane in three-dimensional Euclidean space. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\left[a(t), b(t), c(t) \right]$ is a vector that is normal to the plane. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The collection of all vectors in $\mathbb{R}^3$ of the form $\left[w_1(t),\ w_2(t),\ w_3(t)\right]$that satisfy the above equation are points on the plane.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since you said that $w_1(t), w_2(t), w_3(t)$ don't change much over a short time duration, then you can assume that the point $\left[w_1(t+\Delta t),\ w_2(t+\Delta t),\ w_3(t+\Delta t)\right]$ should be geometrically close to the point at the previous time instant, $\left[w_1(t),\ w_2(t),\ w_3(t)\right]$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, the algorithm would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Initialize your algorithm by finding $k$, which you said you can do.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Solve for the initial weights $w_1(t), w_2(t), w_3(t)$, which you said you can do.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;On subsequent time steps, measure $a(t)$, $b(t)$, and $c(t)$. This defines the plane in $\mathbb{R}^3$ that the filter weight vector can possibly lie upon.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the point on the plane that is closest to the filter weights from the previous iteration. Use this point as the new vector of filter weights.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Repeat.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this will give the desired effect or not (as your inquiry is light on details), but it has an intuitive geometric explanation. It might be worth a try.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-08-05T02:34:52.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17628" PostTypeId="1" CreationDate="2014-08-05T18:20:44.853" Score="9" ViewCount="28468" Body="&lt;p&gt;I have real-time audio application written in python, and I have question about detecting silence.&#xA;What's the most efficient way to distinguish silence from non-silence, in an input audio signal? By non-silence I mean any sound, even noise. I need to know when silence-period is in the process, as accurately as possible. I don't necessarily ask for some code-algorithm; theoretical tips and explanations would be also useful. I know that silence have low level of oscillations (signal is flat); in &lt;code&gt;numpy.fft.fft&lt;/code&gt; output, silence has highest amplitude in [1] bin, and so on, there are several significant things when silence is there. &#xA;But using any of these conditions in code,  cannot give me absolutely accurate result to  detect silence and completely split it from sound. Any advanced techniques for this task?&lt;/p&gt;&#xA;" OwnerUserId="7929" LastEditorUserId="7929" LastEditDate="2014-08-06T14:27:37.863" LastActivityDate="2020-03-29T06:46:08.923" Title="python; audio; detecting silence in audio signal" Tags="|audio|python|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17629" PostTypeId="2" ParentId="17628" CreationDate="2014-08-05T18:56:06.130" Score="17" Body="&lt;p&gt;i'm not gonna deal with python nor numpy nor any other parochial computational platform.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;first, since &quot;silence&quot; is a perceptual property, you need to apply a weighting filter, such as &lt;a href=&quot;https://en.wikipedia.org/wiki/A-weighting&quot; rel=&quot;noreferrer&quot;&gt;A-weighting&lt;/a&gt; to boost the frequency components of the audio that our ears are more sensitive to and attenuate the portions we're less sensitive to.  there are other weighting curves besides A-weighting.  i like Robert Wannamaker's &lt;a href=&quot;http://www.aes.org/e-lib/browse.cfm?elib=5956&quot; rel=&quot;noreferrer&quot;&gt;E-weighting&lt;/a&gt; the best.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;then square the filtered signal (to get power or energy).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;then low-pass filter the squared and filtered signal (to get an envelope).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;then compare this envelope to a threshold that will correspond to the threshold of hearing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;lastly, you may need to put in a little hysteresis in the threshold comparison so that the silence/no-silence result does not jitter as your envelope crosses the threshold.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;this is similar to the &quot;gate&quot; function in a compressor/limiter/gate process that sometimes finds expression in audio applications.  the &quot;gate&quot; was to make sure that something that's perceived as silence (or sufficiently low-level that it &lt;em&gt;should&lt;/em&gt; be perceived as silence) becomes &lt;em&gt;zero&lt;/em&gt; during the &quot;silent&quot; periods of time.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-08-05T18:56:06.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17630" PostTypeId="2" ParentId="17619" CreationDate="2014-08-05T23:07:05.213" Score="-1" Body="&lt;p&gt;I'm not sure what the problem is, but my first guess is that somehow&#xA;the 16 pixels that the code is pulling from the image is getting interpreted in the wrong order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, perhaps the block of code currently&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;val b_1 = q(x1, x2, x3)(extracted(0), extracted(1), extracted(2), extracted(3))&#xA;val b0  = q(x1, x2, x3)(extracted(4), extracted(5), extracted(6), extracted(7))&#xA;val b1  = q(x1, x2, x3)(extracted(8), extracted(9), extracted(10), extracted(11))&#xA;val b2  = q(x1, x2, x3)(extracted(12), extracted(13), extracted(14), extracted(15))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;needs to be something else, perhaps something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;val b_1 = q(x1, x2, x3)(extracted(0), extracted(4), extracted(8), extracted(12))&#xA;val b0  = q(x1, x2, x3)(extracted(1), extracted(5), extracted(9), extracted(13))&#xA;val b1  = q(x1, x2, x3)(extracted(2), extracted(6), extracted(10), extracted(14))&#xA;val b2  = q(x1, x2, x3)(extracted(3), extracted(7), extracted(11), extracted(15))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That sort of shuffling pixels around would give results similar to what you are seeing -- the output looks fine in &quot;smooth&quot; regions, but the results are more obviously wrong in non-smooth regions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &quot;nonscaling&quot; test (run the &quot;interpolation&quot; to generate an image of exactly the same size) is a great first test -- it should give pixel-for-pixel exactly the same output image as the input image.&#xA;(Tests that expand or shrink the image, it's not as clear exactly what the output image ought to be).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also consider running a nonscaling test (or perhaps even a scaling test) on a very simple image, small enough that a human can single-step through every pixel in the image -- perhaps something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 0&#xA;0 5 6&#xA;0 8 9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you get this &quot;nonscaling&quot; test working, I agree with Robert that to really test the interpolation, you need to &lt;em&gt;also&lt;/em&gt; run some tests that expand or shrink the image.&lt;/p&gt;&#xA;" OwnerUserId="484" LastActivityDate="2014-08-05T23:07:05.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17631" PostTypeId="2" ParentId="16040" CreationDate="2014-08-05T23:38:43.677" Score="0" Body="&lt;p&gt;For the extremely special case where you can use a Fourier transform(*),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you collect p real sample points (in this case, p = 294),&#xA;and then you feed that though a &lt;a href=&quot;http://en.wikibooks.org/wiki/Digital_Signal_Processing/Discrete_Fourier_Transform&quot; rel=&quot;nofollow&quot;&gt;discrete Fourier transform&lt;/a&gt;,&#xA;it gives you 2 components at n = p/2 (in this case, n = 147) different frequencies.&#xA;(Internally we practically always calculate a in-phase I and a quadrature Q component at each frequency, but many times we take the I and Q at each frequency and transform them to the amplitude A and the phase phi at that frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those 2 components at n=p/2 different frequencies can be used to exactly reconstruct the original series of sample points -- there is no more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, we practically always want to have anti-aliasing filters and we usually have DC-blocking filters, so we usually find that the first few and the last few of those n=p/2 frequency components have zero amplitude,&#xA;and in some situations we find that only 1 or 2 or 16 (DTMF) frequencies ever have amplitudes significantly more than zero.&#xA;In those cases you only need 1 or 2 sinusoids (or however many the Fourier transform indicates have nonzero amplitude) in order to exactly reconstruct the original series of sample points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in other situations we find that every one of the n=p/2 (in this case, 147) components has a large amplitude -- in those cases, you need all those amplitudes to exactly reconstruct the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(*) the sample-time values are evenly spaced from t0=0 to tp,&#xA;the lowest non-zero frequency w1 = 1/(tp),&#xA;the frequencies are evenly spaced integer multiples of w1, etc.&lt;/p&gt;&#xA;" OwnerUserId="484" LastActivityDate="2014-08-05T23:38:43.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17632" PostTypeId="1" CreationDate="2014-08-06T07:11:17.220" Score="7" ViewCount="2987" Body="&lt;p&gt;In adaptive filters,  the development of LMS algorithm typically starts from the Weiner-Hopf equation, while the development of RLS algorithm starts from the normal equation. As I understand, these two equations are the same, and both their solutions is the optimal coefficients that the adaptive filter has to find. Is this true or am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="10711" LastActivityDate="2015-04-09T11:52:04.367" Title="What is the difference between the Weiner-Hopf equation and the normal equation?" Tags="|adaptive-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17633" PostTypeId="1" CreationDate="2014-08-06T13:18:45.227" Score="-1" ViewCount="148" Body="&lt;p&gt;I am trying to use generalized cross correlation with phase transform (GCC_PHAT) on some audio processing indoor, with the existence of low noise. I ve read &lt;a href=&quot;http://www.xavieranguera.com/phdthesis/node92.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; that by canceling the magnitude factor, which what pretty much PHAT does, the result of the correlation will be resistant to reverberation and low noise, but i cannot seem to understand why.&#xA;I want to know what is the explanation behind that, what is the relationship between reverberation and magnitude ?&lt;/p&gt;&#xA;" OwnerUserId="10716" LastEditorUserId="10716" LastEditDate="2014-08-06T13:24:56.083" LastActivityDate="2014-09-07T10:24:10.797" Title="phase amplitude transform as a solution to reverberation" Tags="|audio|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17634" PostTypeId="1" CreationDate="2014-08-06T14:11:40.810" Score="1" ViewCount="708" Body="&lt;p&gt;The original idea is to calculate distance from accelerometer input. However, accelerometer reading also contains the gravitational values, thus to remove gravity, I tried using Gyroscope. The idea was to calculate angle of rotation from gyroscope and then calculate gravity at this angle and subtract it from accelerometer. However, gyroscope values drift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried using Kalman Filter for this. However, Kalman Filter is working very slow. So now finally, I am thinking of converting the gyroscope values in frequency domain with the help of Fourier Transform, and then trying to calculate angle of rotation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone tried such crazy idea before? Any leads? I managed to calculate Fourier Transform of Rotation Rate of Gyroscope, however, I am not sure how I should go ahead with these transformed values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. -  I am working on Windows 8 device, and coding in c#.&lt;/p&gt;&#xA;" OwnerUserId="10718" LastActivityDate="2014-08-06T14:11:40.810" Title="Using Fourier Transform on Gyroscope" Tags="|fft|dft|kalman-filters|fourier|c#|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17635" PostTypeId="1" CreationDate="2014-08-06T14:54:17.780" Score="3" ViewCount="1495" Body="&lt;p&gt;I'm about to tackle implementing a Viterbi equalizer fo a GSM system in gnuradio.&#xA;I went through the internet and ieeexplore and I think that this document explains it best:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://cnx.org/content/m26738/1.1/&quot; rel=&quot;nofollow&quot;&gt;Application of Viterbi Equalizer in GSM&#xA;  System&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My question concerns the Matched Filter in the block diagram. &#xA;Normal Burst in GSM has 8 possible midambles. First of all, the Matched Filter block should determine which midable has been transmited. Midambles have highly-peaked auto-correlation function, so the first thing to do is to compute the modulated version of the 8 midambles and then convolve each of them with the received midamble and the one with the most peak-like is the most likely to have been sent. Once I have that done, it's easy to compute the channel response estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have much background in DSP and I was hoping someone could let me know if I understand it correctly.&lt;/p&gt;&#xA;" OwnerUserId="10719" LastEditorUserId="1606" LastEditDate="2014-08-08T07:00:09.723" LastActivityDate="2014-10-20T16:32:35.850" Title="Viterbi equalizer in a GSM system" Tags="|digital-communications|viterbi-algorithm|equalizer|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17636" PostTypeId="1" AcceptedAnswerId="17638" CreationDate="2014-08-06T18:57:14.853" Score="1" ViewCount="238" Body="&lt;p&gt;if we create a continuous signal from epoched data (say, EEG data with 100 epoches), what kind of problems it may cause( i am only aware of edge artifacts ) and how i can avoid them in analysis (say, power analysis)? Thanks in advance,&lt;/p&gt;&#xA;" OwnerUserId="10721" LastActivityDate="2014-08-07T20:01:54.867" Title="Epoched data to a continuous signal" Tags="|signal-analysis|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17637" PostTypeId="1" AcceptedAnswerId="17644" CreationDate="2014-08-06T19:04:19.100" Score="2" ViewCount="191" Body="&lt;p&gt;Suppose you have the ability to inject any arbitrary waveform into a piece of analog rf hardware and collect and digitize the output for analysis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to characterize/estimate the transfer function of the hardware, what waveforms would you use?&lt;/p&gt;&#xA;" OwnerUserId="5843" LastActivityDate="2014-08-07T09:11:14.543" Title="Hardware Transfer Function Estimation" Tags="|estimation|transfer-function|hardware|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17638" PostTypeId="2" ParentId="17636" CreationDate="2014-08-06T19:41:54.893" Score="2" Body="&lt;p&gt;You may have problems related to discontinuity and this can give small glitches in your signal, if you hear your signal you will notice pops/clicks artifacts at every 100 epoches edge, one way to try avoid this problem is apply one window function in a overlapped segments between your Epoches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you apply a window like a Hann window this reduces the amplitude of the components of the outlet ends of the window and its suppress the edge artifacts when reconstructing your signal to be continuos, for it you need use technics like overlap and add to works like a crossfading between every overlapped segments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK you asked for example, i can show you the basic concept, imagine two sinusoids at 100hz, if you try join you will have problems, take a look:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7qaJp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this plot is clear that the end of the sine wave does not match with the beginning of another, and this cause the problem described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to do try avoid it is apply a crossfade, here an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs=22050;&#xA;f=100&#xA;winsize=2048;&#xA;&#xA;%creating signal&#xA;signal1= 0.9*sin(2*pi*f/Fs*(1:winsize));&#xA;signal2= 0.9*sin(2*pi*f/Fs*(1:winsize));&#xA;&#xA;%use plot(in) to see the first image plot in this answer&#xA;in=[signal1 signal2];&#xA;&#xA;&#xA;%create a hann window&#xA;window1=hann(winsize)';&#xA;window2=hann(winsize)';&#xA;&#xA;%i'm using just the last half values of the hann window to skip fade in     &#xA;window1(1:winsize/2)=ones;&#xA;&#xA;%i'm using just the first half values of the hann window to skip fade out  &#xA;window2(winsize-(winsize/2):winsize)=ones;&#xA;&#xA;%apply window in signal1 and signal2&#xA;teste1=(signal1.*window1);&#xA;teste2=(signal2.*window2);&#xA;&#xA;%apply 50% crossfade between signal1 and signal2&#xA;OverlapCrossfade=teste1(length(teste1)/2:length(teste1)-1) +  teste2(1:length(teste2)/2);&#xA;&#xA;%rebuild the signal after crossfade&#xA;join = [teste1(1:length(teste1)/2) OverlapCrossfade teste2(length(teste2)/2:length(teste2)-1)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now if you do &lt;code&gt;plot(join)&lt;/code&gt; you can see it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VZtef.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OW this is better i cant see glitches (but we can see amplitude variation), now all that you need to do is apply some type of envelope adjust.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2014-08-07T20:01:54.867" LastActivityDate="2014-08-07T20:01:54.867" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17639" PostTypeId="2" ParentId="17637" CreationDate="2014-08-06T20:49:41.817" Score="1" Body="&lt;p&gt;My first guess would be: Use a swept sinus signal and signal analyzer.&lt;/p&gt;&#xA;" OwnerUserId="10631" LastActivityDate="2014-08-06T20:49:41.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17641" PostTypeId="1" CreationDate="2014-08-07T04:43:17.320" Score="2" ViewCount="365" Body="&lt;p&gt;Hey I want to remove DC offset from tetra signal captured as inphase and quadrature phase samples(I and Q samples). I and and Q samples are 16 bit signed values. I tried averaging 2000 I and Q samples out of 2040 sample burst and subtracting corresponding averages from I and Q sample values recieved.But it doesn't seem to work well. Average values I'm calculating seems to vary widely from burst to burst..But if I'm getting DC offset value as average ,it should not be varying much from burst to burst right???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These I and Q samples correspond to pi/4 dqpsk modulated signals .when we average suffiecient number of theses samples to get the DC offset present ,I think we should get a less varying value when we perform same averaging procedure in every burst .. I wanted to know if my reasoning is correct??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;could you suggest or point me to any techniques to remove DC ofset from unpredictably varying pi/4 dqpsk modulated I and Q samples. My I and Q sample values are signed 16 bit integer values.So I and Q values could be 32768 to -32767. I see 10481 to -11090 values as my I and Q sample when information is present .When I average 2000 message bearing I samples I get -361 in first time ,10 second time ,-778 next,598 an other time. So I kinda see a variation in average from say -800 to + 800. Could that be the DC offset. I think DC offset should not vary much like above&lt;/p&gt;&#xA;" OwnerUserId="10726" LastActivityDate="2014-08-07T04:43:17.320" Title="DC offset removal from tetra signal" Tags="|filters|discrete-signals|digital-communications|dsp-core|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17643" PostTypeId="2" ParentId="672" CreationDate="2014-08-07T08:16:31.790" Score="3" Body="&lt;p&gt;There is also a simple approach to explain this:&#xA;If you real baseband signal has a spectrum from -B to +B you sample with 2B, so you make sure that the spectral repetitions of the spectrum don't overlap. A overlap would mean that you get aliasing and cannot reconstruct the original spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now with a complex signal, the spectrum ranges, as mentioned by Jason, from 0 to B. (Theoretically it can also have spectrum at negative frequencies, but for most of practical cases it will range from 0 to B.) If you sample with rate B, since there is are no parts at negative frequencies in original spectrum, the repetitions of spectrum will not overlap --&gt; unambiguous reconstruction is possible!&lt;/p&gt;&#xA;" OwnerUserId="10729" LastActivityDate="2014-08-07T08:16:31.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17644" PostTypeId="2" ParentId="17637" CreationDate="2014-08-07T08:34:33.210" Score="3" Body="&lt;p&gt;You can use adaptive filters for this task. Feed the hardware with uniform white noise and collect the output. Then feed the adaptive filter with exactly the same noise sequence and use the output of the hardware you recorded as the desired response of the adaptive filter. The filter can then be trained with standard algorithm such as LMS. Of course, you will not get the exact transfer function, but the trained adaptive filter's transfer function should be close enough to serve as model of the hardware in question.&lt;/p&gt;&#xA;" OwnerUserId="10711" LastActivityDate="2014-08-07T08:34:33.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17645" PostTypeId="2" ParentId="17635" CreationDate="2014-08-07T08:47:38.733" Score="2" Body="&lt;p&gt;From the referenced description and also from [1] it seems to me that the training sequence (here: midamble) is assumed to be known already. This knowledge has probably been acquired before in the synchronization burst. The first block in Fig. 2 extracts the training sequence from the received signal. This suggests that the receiver is already synchronized to the transmitter otherwise the training sequence extraction would not be possible. (Unless the extraction block includes frame synchronization - but why the synchronization burst then?) Every base station has a so-called color code, 3 bit long. This color code indentifies the base station and determines the training sequence. The channel estimation using the midamble is done during data transmission, i.e. when communication has already been established. I think that the color code of the base station must already be known by then and hence the training sequence must be known as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm no GSM expert so I might be mistaken. In this case the transmitted training sequence could be found as you propose: try every of the eight possible matched filter impulse responses and choose the one that yields the highest distance between main and side lobe at the matched filter output, when the matched filter input is the received training sequence.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1] Raymond Steele and Lajos Hanzo: &quot;Mobile Radio Communications&quot;, 2nd edition, Wiley&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-08-07T08:47:38.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17646" PostTypeId="2" ParentId="17637" CreationDate="2014-08-07T09:11:14.543" Score="0" Body="&lt;p&gt;For the sake of completeness: you could also feed a Dirac impulse into your hardware and sample the impulse response at its output. Then apply a DFT to the measured impulse response in order to get the transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideal Dirac impulses cannot be generated, though. So in practice a very narrow impulse will have to do. I would therefore prefer white noise in practice.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-08-07T09:11:14.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17648" PostTypeId="2" ParentId="17619" CreationDate="2014-08-07T11:51:27.517" Score="4" Body="&lt;p&gt;What you're seeing is &lt;a href=&quot;http://en.wikipedia.org/wiki/Acutance&quot; rel=&quot;nofollow&quot;&gt;acutance&lt;/a&gt;, as described in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bicubic_interpolation#Use_in_computer_graphics&quot; rel=&quot;nofollow&quot;&gt;wikipedia article&lt;/a&gt; on bicubic interpolation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for downsampling an image, cubic interpolation is perhaps not the ideal choice, but makes more sense for upsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you're downsampling by more than a facor of 4, there will be many pixels in the original image that are simply never used in the downsampled version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to get around this is to downsample by iteratively taking the mean value of 4 neighbouring pixels, until you're within a factor of 2 of the desired image size. Then you can do the last part by cubic interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're want high quality resampling, try taking a look at the &lt;a href=&quot;http://www.imagemagick.org/Usage/filter/#filter&quot; rel=&quot;nofollow&quot;&gt;ImageMagik documentation&lt;/a&gt; for inspiration. In particular they recommend using windowed filters for downsampling, such as Lanczos or Sinc.&lt;/p&gt;&#xA;" OwnerUserId="10731" LastEditorUserId="10731" LastEditDate="2014-08-07T13:30:16.073" LastActivityDate="2014-08-07T13:30:16.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17649" PostTypeId="1" AcceptedAnswerId="17678" CreationDate="2014-08-07T11:53:30.603" Score="0" ViewCount="72" Body="&lt;p&gt;I have a signal that is composed of a sinusoid.  I will send it over the air through radios.  Part of the signal will go through processing on a computer, which means that it will be converted from analog to digital, and back again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions.  How can I model any frequency shift that will occur in this system?  And, how can I model how the time of the signal may change?  That is, if the signal occurs in bursts (e.g. 200 ms of tone followed by 100 ms of absence of tone), how can I determine how the time may decrease?  Is the time changed only by the digital part of the system (due to sampling), or might the radio path also affect the duration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="10591" LastActivityDate="2014-08-11T03:28:05.667" Title="Modeling a signal through the environment" Tags="|radio|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17652" PostTypeId="2" ParentId="17633" CreationDate="2014-08-08T09:37:01.340" Score="0" Body="&lt;p&gt;First of all, what do you mean by &quot;cancelling the magnitude factor&quot;? According to the paper by Knapp and Carter (1976), the phase transform (PHAT) was developed as an ad hoc technique. What the transform does is place equal emphasis on each frequency (pre-whitening), but according to the paper by Braindstein and Silverman (1997), the PHAT-weight is suboptimal under ideal conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also not sure what you mean by &quot;the relationship between reverberation and magnitude&quot;. Reverberation is the effect of reflection subject to room geometry/materials. Basically this means that lots of delayed and attenuated copies of the signal is added to the signal itself.&lt;/p&gt;&#xA;" OwnerUserId="10740" LastEditorUserId="10740" LastEditDate="2014-08-08T10:01:23.010" LastActivityDate="2014-08-08T10:01:23.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17653" PostTypeId="1" AcceptedAnswerId="17661" CreationDate="2014-08-08T11:03:48.340" Score="0" ViewCount="5020" Body="&lt;p&gt;I have a signal which is a matched filter output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YNGAQ.jpg&quot; alt=&quot;Impulse Peaks at 2201,3005,4443,4444,6524 within noise&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whose values are given here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://pastebin.com/642TUCxA&quot; rel=&quot;nofollow noreferrer&quot;&gt;Amplitude values&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input to this matched filter is radar return signals mixed with additive gaussian random noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its impulse like peaks are at indices 2201,3005,4443,4444,6524(by manual inspection).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I detect these peaks programmatically.&#xA;I have tried findpeaks function in matlab. &#xA;Not got the result I wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help me out.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastActivityDate="2014-08-08T15:51:27.550" Title="How to detect impulse like peaks - Matlab" Tags="|matlab|peak-detection|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17654" PostTypeId="2" ParentId="17653" CreationDate="2014-08-08T12:14:15.977" Score="1" Body="&lt;p&gt;It appears that each peak stands out clearly (+15 dB or so) from it's neighbors, but certainly the peak at 6524 isn't that much higher than the noise near 2500. Have you tried &lt;code&gt;findpeaks&lt;/code&gt; on smaller intervals, say 250 points at a time?&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-08-08T12:14:15.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17655" PostTypeId="2" ParentId="17653" CreationDate="2014-08-08T12:27:58.650" Score="1" Body="&lt;p&gt;Since your noise floor changes across the data, you can't just apply a simple threshold. Instead, have a sliding window that will calculate the average energy for a smaller subset (I like RMS) and compare the peak to that average. If you have a data point that is so many dB above your calculated noise level, you can mark that as a peak. You'll have to play around with that method to determine the correct threshold and window size for your data.&lt;/p&gt;&#xA;" OwnerUserId="4439" LastActivityDate="2014-08-08T12:27:58.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17657" PostTypeId="1" AcceptedAnswerId="17662" CreationDate="2014-08-08T14:05:10.147" Score="0" ViewCount="1535" Body="&lt;p&gt;If I have a white noise fed into a filter what would be the output of the filter - what would you expect to see?&#xA;I know that white noise has a unit power spectral density (PSD), how these thing relate to each other?&lt;/p&gt;&#xA;" OwnerUserId="10411" LastEditorUserId="8202" LastEditDate="2014-08-08T14:07:14.513" LastActivityDate="2014-08-08T16:09:49.460" Title="white noise filtering" Tags="|noise|dsp-core|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17658" PostTypeId="2" ParentId="17653" CreationDate="2014-08-08T14:12:49.120" Score="0" Body="&lt;p&gt;Slide three non-overlapping windows across the data: left, middle, and right. Apply the following tests:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Largest value in middle window is at the center of middle window&lt;/li&gt;&#xA;&lt;li&gt;Largest value in middle window is &gt; X dB larger than largest value in left window&lt;/li&gt;&#xA;&lt;li&gt;Largest value in middle window is &gt; X dB larger than largest value in right window&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There can be a gap between the windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When all tests pass, mark the center value in the middle window as a peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;John&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-08-08T14:12:49.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17659" PostTypeId="2" ParentId="17653" CreationDate="2014-08-08T14:37:07.210" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Convert all values to dB (looks like you've already done this.)&lt;/li&gt;&#xA;&lt;li&gt;Run the resulting data through a high pass filter with a cut off of 1/4 of your sampling rate.&lt;/li&gt;&#xA;&lt;li&gt;Select a threshold (looks like 10dB would be good.)  Anything above the threshold is peak.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You'll probably want to use a FIR filter for the highpass - the signal will be delayed depending on the length of your filter, but you can account for that easily since it will be an integer number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been thinking of making an acoustic echogram, and this is the method I thought up to get rid of clutter and show just the sharp reflections.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-08-08T14:37:07.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17660" PostTypeId="1" AcceptedAnswerId="17852" CreationDate="2014-08-08T15:44:31.920" Score="3" ViewCount="222" Body="&lt;h2&gt;Problem statement&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VM8Vc.png&quot; alt=&quot;dataset&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the dataset above, you can notice a continuous path and then a noise-band at around 320-400 on the x-axis. I want to be able to apply a filter that amplifies the continuous path while suppressing the noise-band. The data inside the noise-band is useless.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Attempt 1&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I am new to signal processing, but I took a shot at designing my own filter. I tried designing a minimum filter. I defined it to make the output signal $ S $ the minimum of the next $ w $ terms in the input signal $ F $: $ S[n] = \min \{F[x] | x \in \{n, n+1, n+2, ..., n+w\}\} $&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i in range(len(original_signal) - window_len):&#xA;    filtered_signal[i:i+window_len] = min(original_signal[i:i+window_len])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It represents each pixel by the lowest pixel in the area which should make the noise go away because the noise band will have a lot of low values in between a lot of high values. It takes out too much of the signal as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an image showing what the filter took away (the difference between the original signal and the filtered signal)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jnbNC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Attempt 2&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A median filter will not work, because the median of the noise-band is relatively high (1e4):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zfSPm.png&quot; alt=&quot;Noise-band histogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whereas the median of empty space is not that high (1e3):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OHbcO.png&quot; alt=&quot;Empty space histogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the median filter would not reduce the noise to be even with empty space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know any filters I could try?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Additional Data&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Histogram of desired signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fNr9G.png&quot; alt=&quot;Signal histogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All histograms normalized and put on the same axes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LbEFe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10742" LastEditorUserId="10742" LastEditDate="2014-08-10T02:04:10.797" LastActivityDate="2014-08-18T23:26:04.350" Title="How to filter noise from continuous path in image" Tags="|filters|filter-design|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17661" PostTypeId="2" ParentId="17653" CreationDate="2014-08-08T15:51:27.550" Score="2" Body="&lt;p&gt;Well I get your values in pastebin to test i get near results, take a look:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original values from pastebin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lq2MK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;lessen you values from the mean and put zero all values lower than &lt;code&gt;threshold *  Standard deviation&lt;/code&gt; from your values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;valuesfrompastebin( abs(valuesfrompastebin-mean(valuesfrompastebin)) &amp;lt; 4*std(valuesfrompastebin) ) = 0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After it my plot was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sJeSF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the locs from the findpeaks:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[pks, locs] = findpeaks(teste2)&#xA;&#xA;&#xA;&#xA;        2201&#xA;        3005&#xA;        4441&#xA;        4443&#xA;        6524&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2014-08-08T15:51:27.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17662" PostTypeId="2" ParentId="17657" CreationDate="2014-08-08T16:09:49.460" Score="1" Body="&lt;p&gt;For a linear time-invariant filter, the output of the filter would be coloured noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again assuming linear time-invariant filter, the effect of the filter on the output can be further characterized in terms of its power spectrum density (PSD).&#xA;Specifically, for an input $X(f)$ with power spectrum density $S_x(f)$ to a linear time-invariant filter with frequency response $H(f)$, the power-spectrum density $S_y(f)$ of the output of the filter is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  S_y(f) = |H(f)|^2 S_x(f)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for a white noise input with unit power spectrum density $S_x(f)=1$, the corresponding PSD of the output would be&#xA;$$&#xA;  S_y(f) = |H(f)|^2&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2014-08-08T16:09:49.460" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17664" PostTypeId="1" AcceptedAnswerId="17673" CreationDate="2014-08-09T01:22:46.647" Score="2" ViewCount="351" Body="&lt;p&gt;I was reading a DSP book where they had a problem on Z Transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determine the z-transform and ROC for signal $\displaystyle x(n) = a^nu(n)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution states that &#xA;$$&#xA;\displaystyle X(z) = \displaystyle\sum_{n=0}^\infty (az{^{-1}})^n&#xA;$$&#xA;So &#xA;$$&#xA;\displaystyle X(z) = \frac{ \displaystyle {z} }{z-a}&#xA;$$&#xA;Hence ROC $|z| &amp;gt; a$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which I understand that for all values of z &gt; a the series $\frac{ \displaystyle {z} }{z-a} $ has finite values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for $|z| &amp;lt; a$ their exists a value : $z = 5$ and $a = 10$ the series has a finite value of -1 and so on. So why -1 is not taken as a set for which ROC exists - or rather my understanding on ROC is wrong?&lt;/p&gt;&#xA;" OwnerUserId="10384" LastEditorUserId="80" LastEditDate="2014-08-09T01:31:46.120" LastActivityDate="2014-08-10T00:13:20.177" Title="Z Transform - ROC values" Tags="|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17665" PostTypeId="1" AcceptedAnswerId="17677" CreationDate="2014-08-09T02:25:02.550" Score="2" ViewCount="379" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/14523/relationship-between-entropy-and-snr&quot;&gt;Relation of Entropy and SNR&lt;/a&gt; : Based on this question and answer, I had another question that struck me and I am curious to know, if somebody can shed some light, on the following situation: $y= desired_{signal} + noise$ is received by the receiver and the $error = y - \hat{y}$ where $\hat{y}$ is simulated at the receiver by using guessed parameters with the knowledge of the kind of model used at the transmitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For increasing SNR (attenuating noise) would Entropy of error decrease? In the link provided, the entropy of the transmitted signal decreases with increasing SNR since the uncertainty decreases when noise is getting attenuated. But what about the entropy of error? Should error entropy increase with increasing SNR? I am confused about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: The way I calculated entropy of error:&#xA;Let the system model be AR(2): $y(t)= a1y(t-1) + b1y(t-2) + noise$. At the receiver end, I have $z(t) = y(t) - (a2y(t-1) + b2y(t-2))$ where $(a2,b2)$ are close guesses to ($a1,b1$). I calculated 2 entropies H1 for y(t)  and H2 for z(t).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;z(t) will be close to zero when a2,b2 will be equal to a1,b1 in which case entropy of z(t) is found to be minimum among all different z(t) for a particular SNR value of noise. &#xA; So, for a particular noise value, I have 10 pairs of (a2,b2) and for each I get 10 values of H2(z(t)). I chose the minimum among all H2 for a particular SNR level. But, for different noise levels, as I increase the SNR at the transmitter end, the minimum entropy, H2(z(t)), increases with increasing SNR. &#xA;I found that H1 decreases with increasing SNR but the reverse happens for H2.&#xA;Is this trend correct?  &lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-08-14T17:41:26.643" Title="Effect of noise and entropy" Tags="|noise|signal-detection|snr|information-theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17669" PostTypeId="2" ParentId="17660" CreationDate="2014-08-09T11:34:28.127" Score="0" Body="&lt;p&gt;Disclaimer: I'm wildly speculating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would try a bilateral kind of filter. In a patch (size depending on your image size) around each pixel, evaluate the &lt;a href=&quot;http://www.mathworks.se/help/images/ref/entropy.html&quot; rel=&quot;nofollow&quot;&gt;entropy&lt;/a&gt;. You should have a significantly higher entropy outside the noise band, so you could simply use the minimum filter on that particular pixel if the entropy was lower than some threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with this approach is that the naive implementation in python will be somewhat slow. You would probably have to use Cython, Numba or something similar for implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Or you could simply use the &lt;a href=&quot;http://scikit-image.org/docs/0.10.x/api/skimage.filter.rank.html#entropy&quot; rel=&quot;nofollow&quot;&gt;entropy filter&lt;/a&gt; from scikit-image.&lt;/p&gt;&#xA;" OwnerUserId="10731" LastActivityDate="2014-08-09T11:34:28.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17670" PostTypeId="1" CreationDate="2014-08-09T17:26:38.663" Score="2" ViewCount="66" Body="&lt;p&gt;Given a signal $$x(t)=16\cos(20\pi t+\frac\pi 4)+6\cos(30\pi t+\frac\pi 6)+4\cos(40\pi t+\frac\pi 3)$$how can I calculate the &lt;strong&gt;power contained in a frequency interval, say 12Hz to 22Hz&lt;/strong&gt;.&#xA;The total power is $\frac{16^2}{2}+\frac{6^2}{2}+\frac{4^2}{2}=154$&lt;/p&gt;&#xA;" OwnerUserId="7724" LastEditorUserId="7724" LastEditDate="2014-08-09T18:14:40.397" LastActivityDate="2014-08-09T18:14:40.397" Title="Power contained in a signal" Tags="|power-spectral-density|fourier-series|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17671" PostTypeId="2" ParentId="17660" CreationDate="2014-08-09T21:23:40.283" Score="0" Body="&lt;p&gt;I don't think there's anything in the noise band to recover.  I've done several horrible things to your image in GIMP, and in no case is there any thing visible that would suggest that there's any of your signal in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look, you will see that there's a sort of repeating green tinge to the noise band - from the top down you will see sections of the noise where there's a little more green.  It appears at first to be connected to the signal, but if you look closer, you will see that there's a green section where there's no corresponding signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might do better working from the original signal, but I don't think you are going to get anything out of the picture.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-08-09T21:23:40.283" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17673" PostTypeId="2" ParentId="17664" CreationDate="2014-08-10T00:13:20.177" Score="1" Body="&lt;p&gt;The fact that evaluating the function&#xA;$$&#xA; \begin{align}&#xA;   \frac{z}{z-a}&#xA; \end{align}&#xA;$$&#xA;yields a finite value for some given values of $z$ and $a$, does not mean that the original series (from $\mathcal{Z}$-transform definition)&#xA;$$&#xA; \begin{align}&#xA;   X(z) = \sum_{n=0}^\infty(az^{-1})^n&#xA; \end{align}&#xA;$$&#xA;converges at all for those same values of $z$ and $a$. Before we determine the region of convergence, the only thing we can say is that &lt;strong&gt;&lt;em&gt;if&lt;/em&gt;&lt;/strong&gt; the series converges, then it will converge to $\frac{z}{z-a}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case $z=5$ and $a=10$, looking at the sequence&#xA;$$&#xA; \begin{align}&#xA;   \left\{\sum_{n=0}^N (az^{-1})^n \right\}&#xA; \end{align}&#xA;$$&#xA;as $N$ increases yields:&#xA;$$&#xA;  \{1, 3, 7, 15, 31, 63, ...\}&#xA;$$&#xA;which as you may notice does not converge to -1, and in fact diverges as $N\rightarrow\infty$. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Region_of_convergence&quot; rel=&quot;nofollow&quot;&gt;region of convergence&lt;/a&gt; tells you where this sequence converges (and in this case it is $|z|&amp;gt;|a|$).&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2014-08-10T00:13:20.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17674" PostTypeId="1" CreationDate="2014-08-10T03:50:16.200" Score="1" ViewCount="1127" Body="&lt;p&gt;There are several state-of-the-art algorithms in image denoising including Non-Local Means, BM3D and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering whether there is some well-known state-of-the-art algorithms in image edge detection (with reproducible code) ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot for your answering.&lt;/p&gt;&#xA;" OwnerUserId="4813" LastActivityDate="2014-08-15T02:15:40.783" Title="What's the state-of-the-art algorithms in image edge detection?" Tags="|image-processing|edge-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17675" PostTypeId="1" AcceptedAnswerId="17676" CreationDate="2014-08-10T05:06:19.580" Score="0" ViewCount="168" Body="&lt;p&gt;How is FT of $ \delta $(t) equal to 1 ? Normal FT gives the result $\infty$. Can someone please explain? I did the normal integration and substituted the limits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it because  $ \delta $(t) is a unit impulse function so as it's height is large it's width is very small so no matter what the FT will always be equal to 1 ? (I'm just trying to figure out the logic)&lt;/p&gt;&#xA;" OwnerUserId="10737" LastActivityDate="2014-10-03T09:34:09.107" Title="Unit Impulse funciton FT" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17676" PostTypeId="2" ParentId="17675" CreationDate="2014-08-10T09:48:05.157" Score="3" Body="&lt;p&gt;If follows directly from the definition of the Dirac delta distribution. It is defined so that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_\mathbb{R} \delta(x) f(x) dx := f(0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for any test function $f(x)$. In other words, the Dirac distribution is the generator of the linear functional that extracts a single function value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this definition the Fourier transform of the Dirac distribution is simply:&#xA;$$\int_\mathbb{R} \delta(t) \exp(-2\pi i \omega t) dt=\exp(-2\pi i \omega\cdot 0)=\exp(0)=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't make much sense to say the Dirac distribution is infinitely high or infinitely narrow. Just use the definition given above and apply it. If you really need to, you can understand the distribution as the limit of a sequence of certain functions, but it's not a function itself. And specifically it doesn't have a graph.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-10-03T09:34:09.107" LastActivityDate="2014-10-03T09:34:09.107" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17677" PostTypeId="2" ParentId="17665" CreationDate="2014-08-10T09:48:23.550" Score="1" Body="&lt;p&gt;According to the link you provided: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(error) = H(y-\hat{y}) = H(Var[y]+Var[\hat{y}])$. While $Var[y]$ decreases with increasing of SNR, $Var[\hat{y}]$ stays the same (because it's not dependent of the noise, it depends on the signal alphabet only). So we may guess $H(error)$ decreases with increasing of SNR. &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-08-10T09:48:23.550" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17678" PostTypeId="2" ParentId="17649" CreationDate="2014-08-10T10:09:01.890" Score="0" Body="&lt;p&gt;You can model frequency shift this way:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$s = s \circ exp(j \cdot 2\pi \cdot (f-\hat{f}) \cdot t)$,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where $\circ$ means Hadamard product and $s$ is input signal vector (e.g. frame or part of data stream of interest). You can implement this operation in the baseband or in carrier frequency. The effect will be generally the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you've told your signal time can increas if multipath exists. You can model it as FIR filter of the order of your impulse response length. Refer to the channel modeling techniques for details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also your signal time can vary (increase and decrease) if relative motion of receiver and transmitter exists. This effect appears in the case of so called wideband model, e.g. sonic channel in the underwater communications. For such a case signal bandwidth is comparable to carrier frequency so Doppler shift is very different for low frequencies and high ones in the band of interest. It causes varying of signal duration in the receiver end. If you deal with radio signals your signal model is probably narrowband so this effect is neglectable.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2014-08-11T03:28:05.667" LastActivityDate="2014-08-11T03:28:05.667" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17679" PostTypeId="1" CreationDate="2014-08-10T12:58:30.413" Score="1" ViewCount="502" Body="&lt;p&gt;Can someone please confirm if this is indeed the correct way to compute DWT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;load image&#xA;load Haar wavelet&#xA;&#xA;for i = 1: Level&#xA;  periodize edges of image&#xA;  convolve image with Low pass Haar wavelet filter and store result in G&#xA;  convolve image with Low pass Haar wavelet filter and store result in H&#xA;&#xA;  convolve G with low pass Haar to calculate approximation co-eff&#xA;  convolve G with high pass Haar to calculate horizontal co-eff&#xA;&#xA;  convolve H with low pass Haar to calculate vertical co-eff&#xA;  convolve H with high pass Haar to calculate diagonal co-eff&#xA;&#xA;  i = i + 1&#xA;  downsample approximation by 2 &#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In case of SWT, instead of down-sampling the approximation, Haar filter co-efficients are up-sampled twice at each level and the same process is repeated. Am I correct here?&lt;/p&gt;&#xA;" OwnerUserId="4142" LastActivityDate="2015-03-09T03:22:14.853" Title="Correct way to implement Discrete and Stationary Wavelet Transform?" Tags="|matlab|wavelet|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17680" PostTypeId="1" CreationDate="2014-08-10T13:19:16.573" Score="0" ViewCount="67" Body="&lt;p&gt;I read that in A/D converter we usually use rounding or two's complement truncation and not the sign magnitude or 1's complement truncation as in this case the quantization error is correlated to the input signal.&#xA;Can some one with A/D quatization knowledge alabaret this for me.&#xA;Is the quantization error in two's complement truncation between(-delta,+delta) or is it (-delta,0), with delta being the quatization error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help&lt;/p&gt;&#xA;" OwnerUserId="10411" LastEditorUserId="21075" LastEditDate="2020-04-29T20:56:34.313" LastActivityDate="2020-04-29T20:56:34.313" Title="A/D converter quantization noise" Tags="|dsp-core|quantization|analog-to-digital|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17681" PostTypeId="2" ParentId="10398" CreationDate="2014-08-10T16:40:36.307" Score="0" Body="&lt;p&gt;Sudarsun is correct. You aren't seeing the additional frequencies because your sample rate is only 1.5Hz. You are limited due to the periodicity of the fourrier transform to a band of &#xA;.0.75Hz to 0.75Hz. If you do it on paper you will see that sure enough by repeating the spectrum of the 5Hz sinewave by n*1.5Hz  in both the + and - direction you will see&#xA;exactly what you show in your graphics for a frequency span of -0.75Hz to 0.75Hz.&#xA;You were mistaken to increase the resolution of the FFT, no need for that that. what you needed to do was increase the sampling rate without changing your original signal.&#xA;To do that just pack 7 zeros between sample points. This will give you a sampling rate of&#xA;1.5*8 = 12Hz. I'll bet you see all the frequencies you think you should see... &lt;/p&gt;&#xA;" OwnerUserId="7567" LastActivityDate="2014-08-10T16:40:36.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17682" PostTypeId="1" CreationDate="2014-08-10T19:57:54.470" Score="7" ViewCount="2362" Body="&lt;p&gt;&lt;strong&gt;Input:&lt;/strong&gt; Microphone recordings of digits from 0 to 9 from different speakers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt; The digit from 0 to 9. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing this for fun. So first I will train my neural network using some samples and then use it to classify digits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is every person takes different amount of time to say the digit also every person takes different amount of time to say different digits. This gives me sound signal of different time duration. But input to the neural network  must be of some fixed size. How can I make all my input signals of same length so that I can give input it to neural network? Is there any standard technique? Fourier transform? &lt;/p&gt;&#xA;" OwnerUserId="10759" LastActivityDate="2016-02-02T23:08:04.427" Title="How do I construct input to neural network from audio signals?" Tags="|audio|fourier-transform|speech-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17683" PostTypeId="2" ParentId="17679" CreationDate="2014-08-10T23:17:23.737" Score="-1" Body="&lt;p&gt;In the Haar wavelet case, I just used the following NumPy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# assume x is passed in as a variable&#xA;haar_transform = zeros(N)&#xA;i = arange(N/2, dtype=int)&#xA;haar_tranform[i]      = x[2*i] + x[2*i + 1]&#xA;haar_transform[i+N/2] = x[2*i] - x[2*i + 1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe the mathematical description includes some scaling by $1/\sqrt{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've learned that while academic papers may describe something very complicated there's a simple way to compute it.&lt;/p&gt;&#xA;" OwnerUserId="4112" LastActivityDate="2014-08-10T23:17:23.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17684" PostTypeId="1" CreationDate="2014-08-11T03:57:13.240" Score="2" ViewCount="1339" Body="&lt;p&gt;Why is frequency modulation (FM) not used on the current amplitude modulation (AM) radio stations? The Police have FM 2 way radios that use only 5 kilocycles of modulation. Instead of the current AM radio stations that use the same bandwidth of 5 kilocycles. The limiter &amp;amp; discriminator or ratio detector filter out the static &amp;amp; loud pops that are on AM; Thus the FM would have much less static &amp;amp; noise than AM. FM channels would occupy the same bandwidth as AM channels. For example if WABC in New York used frequency modulation over the current frequency of 770 they would need to have the oscillator changed but the power amp would stay the same. But the receiving radios would need to be replaced with a radio to demodulate frequency modulation at 770.&lt;/p&gt;&#xA;" OwnerUserId="10766" LastEditorUserId="1606" LastEditDate="2014-08-11T08:58:51.333" LastActivityDate="2014-08-11T09:58:13.233" Title="Why do some radio stations still use amplitude instead of frequency modulation?" Tags="|signal-detection|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17685" PostTypeId="1" AcceptedAnswerId="17702" CreationDate="2014-08-11T04:18:21.083" Score="29" ViewCount="24180" Body="&lt;p&gt;Peoples' ears can hear sound whose frequencies range from 20&amp;nbsp;Hz to 20&amp;nbsp;kHz. Based on the Nyquist theorem, the recording rate should be at least 40&amp;nbsp;kHz. Is it the reason for choosing 44.1 kHz?&lt;/p&gt;&#xA;" OwnerUserId="10767" LastEditorUserId="207" LastEditDate="2017-03-17T21:21:34.050" LastActivityDate="2023-11-10T18:12:25.983" Title="Why do we choose 44.1 kHz as recording sampling rate?" Tags="|audio|sampling|" AnswerCount="7" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17686" PostTypeId="1" AcceptedAnswerId="17688" CreationDate="2014-08-11T04:34:48.130" Score="3" ViewCount="4569" Body="&lt;p&gt;Let's say sampling rate is $Fs = 44\mathtt{kHz}$, now I have $N = 2048$ samples, then I can get $N/2 + 1 = 1025$ frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused by &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/fft.html&quot; rel=&quot;nofollow&quot;&gt;Matlab's FFT documentation&lt;/a&gt; that says the frequencies are present at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;(Fs/2) * linspace(0, 1, N/2+1)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is very probable that the real frequencies are not among  the frequencies generated. What should we do to get the real frequencies?&lt;/p&gt;&#xA;" OwnerUserId="10767" LastEditorUserId="8202" LastEditDate="2014-08-11T07:45:57.070" LastActivityDate="2014-08-11T17:08:48.313" Title="disadvantages of FFT, it can not extract enough frequencies without enough samples" Tags="|matlab|fft|discrete-signals|fourier-transform|dft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17687" PostTypeId="2" ParentId="17685" CreationDate="2014-08-11T06:01:08.300" Score="10" Body="&lt;p&gt;Look &lt;a href=&quot;http://www1.cs.columbia.edu/~hgs/audio/44.1.html&quot;&gt;http://www1.cs.columbia.edu/~hgs/audio/44.1.html&lt;/a&gt; for example. You should use sampling rate more than 40 kHz because of anti-aliasing filters. You should have some reserve in frequency to prevent signal distortion due to filter's reponse slope. The actual value of 44.1 kHz was suggested by Sony corp when audio recording standard was under discussion in 1979. They used this rate widely for that moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's generally historical reason.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-08-11T06:01:08.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17688" PostTypeId="2" ParentId="17686" CreationDate="2014-08-11T06:17:42.403" Score="6" Body="&lt;p&gt;Any measurement has a finite precision. You can't find real frequency exactly in general. You can evaluate it with necessary precision instead. In the case of FFT if the real frequency doesn't match FFT frequency grid exactly, power spectrum is spreading mostly among neighbouring frequency bins (among all bins in general, but most of it is focused in a few adjacent ones). Nevertheless you can estimate the real frequency by finding maximum of such a spectrum. Dealing with FFT you can improve the precision of frequency search by increasing the number of samples. If you can't, you should use another power spectrum estimation techniques but it's the separate question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2014-08-11T08:30:30.137" LastActivityDate="2014-08-11T08:30:30.137" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17691" PostTypeId="2" ParentId="17686" CreationDate="2014-08-11T09:06:38.133" Score="2" Body="&lt;p&gt;For computing a few frequency components the &lt;a href=&quot;http://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow&quot;&gt;Goertzel algorithm&lt;/a&gt; is usually used. Note that the frequencies do not need to lie on a grid (as is the case with the FFT).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-11T09:06:38.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17692" PostTypeId="2" ParentId="17684" CreationDate="2014-08-11T09:40:02.470" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;Because (as you note) all the receivers would have to be replaced.&lt;/li&gt;&#xA;&lt;li&gt;Because international agreements allot that part of the spectrum to AM.&lt;/li&gt;&#xA;&lt;li&gt;Because an FM transmitter with 5kHz modulation needs 25kHz channel spacing to avoid problems with adjacent channels.&lt;/li&gt;&#xA;&lt;li&gt;Because an FM transmitter with 5kHz modulation only has an audio bandwidth of 3kHz - which is far less than AM (depending on the standard used 5khz, 10kHz or 15kHz.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-08-11T09:40:02.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17693" PostTypeId="2" ParentId="17684" CreationDate="2014-08-11T09:52:43.823" Score="2" Body="&lt;p&gt;I'll list a couple of main reasons:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First reason is compatibility! You'd have to leave behind a few generations worth of AM receivers, all of which would suddenly be unuseable. Then there's also equipment at existing stations that needs to be changed, which requires more investments. Furthermore, will listen to your FM radio station in the AM band? There's also regulatory angle that needs to be taken into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, even the analog FM itself is outdated. Today, we're moving towards the digital systems and in the short-wave region, the main systems are &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_Radio_Mondiale&quot; rel=&quot;nofollow&quot;&gt;Digital Radio Mondiale&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/HD_Radio&quot; rel=&quot;nofollow&quot;&gt;HD Radio&lt;/a&gt;. Both can provide in certain configurations performance as good as broadcast FM and can be used in configurations which are compatible with already existing AM equipment.  There are similar solutions for VHF radio as well, which are intended to replace the broadcast FM stations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, there's the claim of Police two-way FM radios which use 5 kHz bandwidth. I'd really like a source for that claim! Most FM professional radios do use today 2,5 kHz or 5 kHz of FM deviation, but deviation is not FM bandwidth.&#xA;A popular method of determining FM bandwidth is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Carson%27s_rule&quot; rel=&quot;nofollow&quot;&gt;Carson's rule&lt;/a&gt;, which states that the majority of sideband energy is within bandwidth of $B=2( \Delta f +f_m)$, where $\Delta f$ is the peak deviation and the $f_m$ is the maximum frequency transferred. &#xA;Common channel spacings for two-way radios are 12,5 kHz and 25 kHz. They both provide good enough quality to understand words, but are insufficient to transfer music.&#xA;When using 5 kHz deviation, traditionally, highest frequency transferred is 3 kHz, which gives us 16 kHz occupied bandwidth plus a bit of extra space for co-channel interference. In the 12,5 kHz case, 2,5 kHz deviation is used and the highest transferable frequency is also around 2,5 kHz, which gives us 10 kHz of bandwidth and a bit extra for co-channel interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &quot;narrow&quot; FM does give us comparable bandwidth to AM, but maximum useable frequency is much lower. I don't have a good reference for AM broadcasting at the moment, but if I remember correctly, the maximum frequency that can be transferred in medium-wave AM is a bit less than 5 kHz. That's twice as good as narrow FM and still has a bit lower bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I forgot the power-amp part that was mentioned in the question....&#xA;There is a difference between power amplifiers for AM and FM broadcasting. AM output power is (lot's of hand-waving here!) proportional to input power of the signal, so louder input will provide louder output. On the other hand FM has (again lot's of hand-waving here) power output that's closer to constant and doesn't depend as much in the input signal. This is important, because for same peak output power, FM transmitter's average output will me much closer to peak than for AM transmitter. This requires that FM transmitters be much more conservatively rated.&lt;/p&gt;&#xA;" OwnerUserId="4977" LastEditorUserId="4977" LastEditDate="2014-08-11T09:58:13.233" LastActivityDate="2014-08-11T09:58:13.233" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17694" PostTypeId="2" ParentId="17566" CreationDate="2014-08-11T10:36:11.537" Score="0" Body="&lt;p&gt;As someone made me notice in the comments, the integrals are just the coefficients of the Fourier Series for that frequency component (when the series is expressed with the cosine and sine parts separately).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The integral is performed on a period much bigger then the period corresponding to the frequency of the disturbance so that a better averaged is obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get back the signal in the time domain it is sufficient to multiply the two components by the cosine and sine respectively. Of course in this way the signal has only one frequency component.&lt;/p&gt;&#xA;" OwnerUserId="10622" LastEditorUserId="8202" LastEditDate="2014-08-11T10:48:04.443" LastActivityDate="2014-08-11T10:48:04.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17697" PostTypeId="1" CreationDate="2014-08-11T12:49:28.867" Score="1" ViewCount="675" Body="&lt;p&gt;I am doing the project on speech recognition.I have implemented both the mfcc features and neural network.I am a bit confused in joining the two blocks.For example i have three different words with their '.wav' files.I extract 13 mfcc features from these three words respectively.There will be a matrix of mfcc e.g (13x100) for each word.I convert this matrix to a vetor.Than i will have three vectors of 1300 length (assuming each word is of same length).Than i pass these vectors as input to my neural network.I am confused about my training output.Whether it will be the same wav files from which i extracted the mfcc features or will it be something else.&lt;/p&gt;&#xA;" OwnerUserId="10774" LastActivityDate="2014-11-09T15:32:19.993" Title="Speech recognition using mfcc and neural network" Tags="|signal-analysis|speech-recognition|mfcc|" AnswerCount="1" CommentCount="2" ClosedDate="2015-12-05T23:15:10.477" ContentLicense="CC BY-SA 3.0" />
  <row Id="17698" PostTypeId="1" AcceptedAnswerId="17699" CreationDate="2014-08-11T13:09:04.110" Score="0" ViewCount="123" Body="&lt;p&gt;I was reading the book &quot;Spectral Analysis of Time Series&quot; By Herman Koopmans.&#xA;On &lt;a href=&quot;http://books.google.de/books?id=F09lhyXw4mcC&amp;amp;lpg=PP1&amp;amp;dq=herman%20koopman%20time%20series&amp;amp;pg=PA55#v=onepage&amp;amp;q=A%20Nonstationary%20Process%20with%20a%20Wiener%20Spectrum&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;Page 55&lt;/a&gt;, he explains that a specific type of non-stationary signal which is the result of adding weakly stationary ergodic noise to a deterministic signal can be decomposed to Wiener spectra. I wonder why there is a need for signal to be ergodic and why weakly stationarity is not enough to derive spectral summation formula for noise and deterministic part?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically based on those assumptions he shows that one has:&#xA;$$C_X(\tau) = \lim\limits_{&#xA;\tau\to\infty}\frac{1}{2T}\int^{T}_{-T}&#xA;X(t + \tau)X(t) dt = C_S(\tau) + C_N(\tau),&#xA;\text{ almost surely}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then&#xA;$$F_X(A)=F_S(A)+F_N(A)$$&#xA;where $F_Z$ is the spectral distribution of stochastic process $Z(t)$, where &#xA;$$X(t)=N(t)+S(t)$$&lt;/p&gt;&#xA;" OwnerUserId="9065" LastEditorUserId="9065" LastEditDate="2014-08-11T13:19:38.370" LastActivityDate="2014-08-11T13:44:26.653" Title="Signal Plus Weakly Stationary Noise" Tags="|fourier-transform|frequency-spectrum|power-spectral-density|stationary|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17699" PostTypeId="2" ParentId="17698" CreationDate="2014-08-11T13:44:26.653" Score="0" Body="&lt;p&gt;For ergodic processes, time averages (defined by integrals over time) and ensemble averages (defined by expectations with respect to probability distributions) are identical. This means that the autocovariance is the same, no matter if defined by a time integral or by an expectation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C_X(\tau)=\lim_{T\rightarrow\infty}\frac{1}{2T}\int_{-T}^{T}X(t+\tau)X(t)dt=&#xA;E\{X(t+\tau)X(t)\}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-11T13:44:26.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17700" PostTypeId="2" ParentId="17697" CreationDate="2014-08-11T13:56:56.083" Score="2" Body="&lt;p&gt;Usually your training data and your test data are different, otherwise your results will be unrealistically good. However, for a first test of your implementation, you can simply use your training data as test material. In this case, the recognition performance should be very good. If this is not the case you know that something went wrong.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-11T13:56:56.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17701" PostTypeId="1" CreationDate="2014-08-11T14:05:46.407" Score="0" ViewCount="728" Body="&lt;p&gt;I'm trying to estimate the power spectrum and time delay for random signals. the signals were taken from two sensors, 10 cm apart. My aim is to estimate the PSD first then estimate the time delay in order to obtain the structure velocity. &#xA;I've tried the traditional way by using matlab built-in functions like fft, xcorr. however the results were not as I expected.&#xA;is there a better way to analyse the attached signals please? Does it need filtering?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signals represent the void fraction data that was measured for 60s with sampling frequency of 1000hz. the time delay expected to be in ms( around 500ms).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/41tW1.png&quot; alt=&quot;SIGNAL1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PfUUt.png&quot; alt=&quot;SIGNAL2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.Cross Correlation&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kNStK.png&quot; alt=&quot;CROSSCORELATION&quot;&gt;&#xA;2.AUTO_CORRELATION&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zMlyb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;PSD&#xA;&lt;img src=&quot;https://i.stack.imgur.com/pYvgu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;4.Cross Correlation after subtracting the average&#xA;60000 points&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FqfhW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2000 points&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sNW52.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;HERE'S THE DATA&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/jl0fo21gjfbyj14/run1_p1.avr&quot; rel=&quot;nofollow noreferrer&quot;&gt;RUN1_P1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/s/r21np9xt71p4m83/run1_p2.avr&quot; rel=&quot;nofollow noreferrer&quot;&gt;RUN1_P2&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10772" LastEditorUserId="10772" LastEditDate="2014-08-13T11:50:12.943" LastActivityDate="2014-08-13T11:50:12.943" Title="How to estimate PSD, and time delay of a random signal?" Tags="|fft|filters|noise|" AnswerCount="0" CommentCount="23" ContentLicense="CC BY-SA 3.0" />
  <row Id="17702" PostTypeId="2" ParentId="17685" CreationDate="2014-08-11T15:55:28.370" Score="45" Body="&lt;p&gt;It is true that, like any convention, the choice of 44.1 kHz is sort of a historical accident. There are a few other historical reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the sampling rate must exceed 40 kHz if you want high quality audio with a bandwidth of 20 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was discussion of making it 48.0 kHz (it was nicely congruent with 24 frame/second films and the ostensible 30 frames/second in North American TV), but given the physical size of 120 mm, there was a limit to how much data the CD could hold, and given that an &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-interleaved_Reed-Solomon_coding&quot; rel=&quot;noreferrer&quot;&gt;error detection and correction scheme&lt;/a&gt; was needed and that requires &lt;em&gt;some&lt;/em&gt; redundancy in data, the amount of logical data the CD could store (about 700 MB) is about half of the amount of physical data. Given all of that, at the rate of 48 kHz, we were told that it could not hold all of Beethoven's 9th, but that it &lt;em&gt;could&lt;/em&gt; hold the entire 9th on one disc at a slightly slower rate.  So 48 kHz is out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, why 44.1 and not 44.0 or 45.0 kHz or some nice round number?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then at the time, there existed a product in the late 1970s called the &lt;a href=&quot;http://www.thevintageknob.org/sony-PCM-F1.html&quot; rel=&quot;noreferrer&quot;&gt;Sony F1&lt;/a&gt; that was designed to record digital audio onto readily-available video tape (Betamax, not VHS). That was at 44.1 kHz (or more precisely 44.056 kHz).  So this would make it easy to transfer recordings, without resampling and interpolation, from the F1 to CD or in the other direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of how it gets there is that the horizontal scan rate of NTSC TV was 15.750 kHz and 44.1 kHz is exactly 2.8 times that. I'm not entirely sure, but I believe what that means is that you can have three stereo sample pairs per horizontal line, and for every 5 lines, where you would normally have 15 samples, there are 14 samples plus one additional sample for some parity check or redundancy in the F1.  14 samples for 5 lines is the same as 2.8 samples per horizontal line and with 15,750 lines per second, that comes out to be 44,100 samples per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since color TV was introduced, they had to bump down slightly the horizontal line rate to 15734 lines per second. That adjustment leads to the 44,056 samples per second in the Sony F1.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="207" LastEditDate="2017-03-17T21:21:18.063" LastActivityDate="2017-03-17T21:21:18.063" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17703" PostTypeId="2" ParentId="17686" CreationDate="2014-08-11T17:08:48.313" Score="2" Body="&lt;p&gt;This is not an inherent disadvantage of the FFT.  This is an inherent disadvantage more related to the limited length window or number of samples and any a-priori assumptions or analysis of the S/N ratio.  In low noise, narrow-band &quot;real&quot; frequency peaks can be estimated between FFT result bins by interpolation.  See: &lt;a href=&quot;https://dsp.stackexchange.com/questions/17579/number-of-fft-points-required-for-a-specific-frequency-resolution-for-an-oversam/17590#17590&quot;&gt;Number of FFT points required for a specific frequency resolution for an oversampled signal&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-08-11T17:08:48.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17704" PostTypeId="1" AcceptedAnswerId="17706" CreationDate="2014-08-11T23:49:33.587" Score="1" ViewCount="322" Body="&lt;p&gt;I'm trying to teach myself about the basics of feature extraction from digital signals. Specifically, I want to try monophonic then polyphonic pitch recognition. I don't have any university level math or computing science experience (I'm self-taught), so I find the formulas in many texts and websites to be a road-block because I don't understand what most of the Greek symbols mean. E.g. I had to search and find that $ \Sigma $ is called Sigma and that it means &quot;summation&quot;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a self-taught recording engineer I have a decent understanding of what needs to happen from a high level:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Separate digital signal into component frequencies&lt;/li&gt;&#xA;&lt;li&gt;Analyse the relative strength of each frequency bin&lt;/li&gt;&#xA;&lt;li&gt;Evaluate the strongest frequencies and compare against known values to determine most likely chord&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I start trying to do any reading about these theories I can't translate it into code because I have no idea what the mathematical explanations are trying to tell me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe this is a question for a math forum, but I figured that a group of DSP enthusiasts and experts could help me fill in the gaps between my coding knowledge and my basic understanding of sound. I get that a Fast Fourier Transform takes a signal and transforms it from the time domain into the frequency domain, but I don't understand the process when I see it laid out in mathematical terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does someone in my position move forward? What kind of resources exist to help someone with high-school algebra (but a &quot;can-do&quot; attitude!) learn enough to get comfortable with basic signal processing? Is there a less &quot;math-intensive&quot; way to gain an understanding of what needs to happen that could lead to a better understanding of the symbols and formulas commonly used?&lt;/p&gt;&#xA;" OwnerUserId="8950" LastEditorUserId="8950" LastEditDate="2014-08-12T00:01:12.260" LastActivityDate="2014-08-12T04:24:30.503" Title="Crash course on turning engineering formulae into computer code?" Tags="|fft|pitch|self-study|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17705" PostTypeId="2" ParentId="17632" CreationDate="2014-08-12T03:26:42.263" Score="1" Body="&lt;p&gt;Weiner-Hopf equation leads to Wiener filter that is optimal filter. For the case of stationarity in some time span it's the only filter minimizing MSE at its output. LMS and RLS algorithms are the adaptive approaches and they converge to Wiener optimal solution (as you can see from their convegence curves). While LMS is the simple steepest descent method of finding such an optimum, RLS solves Least Squares estimation problem at every step recursively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LS estimation problem can be treated as a practical approach of Wiener filter. Look:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$w = \hat{R}^{-1} \cdot \hat{r}$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;is the normal equation in matrix form for the LS problem, $\hat{R}$ and $\hat{r}$ are estimations of autocorrelation matrix and cross-correlation vector respectively. So if these estimations is properly done this solution leads us to the Wiener-Hopf eq., i.e. to Wiener filter. But it's only true if estimations are valid. So in general LS solution is &lt;strong&gt;not&lt;/strong&gt; a Wiener solution, it's an approximation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;RLS approach is derived from LS (as it can be viewed from abbreviation):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$w(k) = S(k) \cdot \hat{r}(k)$,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where $S(k)$ is recursive estimation of $R^{-1}$ and $\hat{r}(k)$ is a recursive estimation of $r$. From the equation above one can see RLS try to solve LS problem at every step. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the conclusion might be both LMS and RLS try to converge to Wiener solution and Wiener filter theory is in the core of these algorithms. But ways they do this are different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my own understanding, maybe some discrepancies are possible. There is very good reference about adaptive filters: &lt;a href=&quot;http://books.google.ru/books/about/Adaptive_Filter_Theory.html?id=MdDi_PF7gMsC&amp;amp;redir_esc=y&quot; rel=&quot;nofollow&quot;&gt;http://books.google.ru/books/about/Adaptive_Filter_Theory.html?id=MdDi_PF7gMsC&amp;amp;redir_esc=y&lt;/a&gt;      &lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2014-08-12T07:38:06.010" LastActivityDate="2014-08-12T07:38:06.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17706" PostTypeId="2" ParentId="17704" CreationDate="2014-08-12T04:24:30.503" Score="1" Body="&lt;p&gt;I don't usually recommend this series, but &lt;a href=&quot;http://www.dummies.com/store/product/Linear-Algebra-For-Dummies.productCd-0470430907.html&quot; rel=&quot;nofollow&quot;&gt;Linear Algebra For Dummies&lt;/a&gt; might be right for you. Chapter 19, for example, covers all the Greek symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also complement this with an introductory book on DSP, like &lt;a href=&quot;http://www.cambridge.org/9780521110020&quot; rel=&quot;nofollow&quot;&gt;Applied digital signal processing : theory and practice&lt;/a&gt; and DSP for audio &lt;a href=&quot;http://www.wiley.com/WileyCDA/WileyTitle/productCd-111826682X.html&quot; rel=&quot;nofollow&quot;&gt;An Introduction to Audio Content Analysis: Applications in Signal Processing and Music Informatics&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-08-12T04:24:30.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17708" PostTypeId="1" CreationDate="2014-08-12T07:05:37.617" Score="0" ViewCount="217" Body="&lt;p&gt;Audio is a sequence of waveforms which have peaks, troughs, 0, just like below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qfb0n.jpg&quot; alt=&quot;audio_waveform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to define the x axis (y = 0) in the picture, how to choose the 0 point in the waveform since there are so many points on the waveform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why not move the waveform above or below the x axis(y=0)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question seems a little stupid. But I still hope someone can help with it.&lt;/p&gt;&#xA;" OwnerUserId="10767" LastActivityDate="2014-11-10T09:38:35.703" Title="Basics of waveform, how to define the zero point" Tags="|matlab|discrete-signals|fourier-transform|dft|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17709" PostTypeId="2" ParentId="17708" CreationDate="2014-08-12T07:25:09.040" Score="1" Body="&lt;p&gt;You can't produce a DC component with speech, so the line $y=0$ is defined by the speech signal having zero mean.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-12T07:25:09.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17711" PostTypeId="1" AcceptedAnswerId="17798" CreationDate="2014-08-12T09:17:22.177" Score="4" ViewCount="1411" Body="&lt;p&gt;I'm trying to estimate the average coherence of discontinuous snippets of a signal in MATLAB. For Welch's spectrum estimates, the following works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w = blackmanharris(50);  % window&#xA;n = numel(w);            % fft length&#xA;o = 0;                   % overlap&#xA;&#xA;x = rand(200,1); x1 = x(1:100); x2 = x(101:200);&#xA;&#xA;s  = pwelch(x,  w, o, n);&#xA;s1 = pwelch(x1, w, o, n);&#xA;s2 = pwelch(x2, w, o, n);&#xA;sa = (s1+s2)/2;&#xA;&#xA;max(abs(s-sa))  % almost zero&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when estimating coherences using Welch's method, the arithmetic mean yields an incorrect result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = rand(200,1); y1 = y(1:100); y2 = y(101:200);&#xA;&#xA;c  = mscohere(x,  y,  w, o, n);&#xA;c1 = mscohere(x1, y1, w, o, n);&#xA;c2 = mscohere(x2, y2, w, o, n);&#xA;ca = (c1+c2)/2;&#xA;&#xA;max(abs(c-ca))  % very different from zero&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I average two coherence estimates correctly?&lt;/p&gt;&#xA;" OwnerUserId="10781" LastActivityDate="2018-03-10T04:11:07.793" Title="How to average coherences estimated using Welch's method in MATLAB" Tags="|matlab|power-spectral-density|coherence|averaging|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17714" PostTypeId="1" AcceptedAnswerId="17715" CreationDate="2014-08-12T11:40:20.180" Score="3" ViewCount="459" Body="&lt;p&gt;So, I'm completely new to digital signal processing, but while reading a piece this morning about quantization it got me daydreaming: could a machine ever be fast enough to sample the position and amplitude of each particle that makes up a wave?&lt;/p&gt;&#xA;" OwnerUserId="8950" LastActivityDate="2020-02-11T10:31:49.470" Title="Is it theoretically possible to perfectly quantize a continuous signal?" Tags="|wave|theory|analog-to-digital|quantization|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17715" PostTypeId="2" ParentId="17714" CreationDate="2014-08-12T12:11:30.120" Score="5" Body="&lt;p&gt;Depends on assumptions you are willing to make and what type of signals are you trying to sample, but in theory I think that sampling rate equal to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Planck_time&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Planck time&lt;/strong&gt;&lt;/a&gt; would be a gold standard for anything...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This translates to sampling frequency of $1.855 \times 10 ^ {43} \mathtt{Hz}$ ($18.55$ tredecillion hertz). Personally I believe that machines will never be so fast. Obviously we can limit our assumptions to more realistic ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously there is more constraints, such as: what sensor is capable of measuring displacement/velocity with such accuracy? Obviously this assumption is applicable even for subatomic scale, and most likely we don't need such accuracy in measurements of sound signals. Additionally when frequency is increasing, sound attenuation in media (air in this case) is increasing to enormous amounts and ultra-sonic sound waves are not propagating on large distances. At some point you will start measuring the Brownian motion. You also mentioned about possibility of measuring each particle separately and it is another, very difficult problem to tackle.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-08-12T13:07:19.873" LastActivityDate="2014-08-12T13:07:19.873" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17717" PostTypeId="1" AcceptedAnswerId="17727" CreationDate="2014-08-12T13:59:16.983" Score="2" ViewCount="102" Body="&lt;p&gt;In the process of trying to learn dialup, I've managed to learn/figure out everything except how to convert a demodulated/filtered signal back into the original data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I have a random two-bit signal (red) sampled at 16000Hz at 2400 symbols/s (gray lines separate symbols), as well as the filtered signal (blue). The filter is a raised-cosine filter with α=1200Hz, β=0.5, and a length of 27 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mUjQU.png&quot; alt=&quot;original signal vs filtered&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the filtered signal, it's clear that a simple A/D converter is insufficient; for example, at about 7 symbols in (about a third from the left), the original signal crosses zero four times, whereas the filtered signal only crosses twice. I imagine this is due to higher frequencies being attenuated more than lower frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize that because the signal is being filtered at half the symbol rate, there shouldn't be any loss of information. How do I go about reconstructing the original signal from the filtered version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it helps any: because the dialup training signal consists of known, pseudo-random data, should I use that to construct an adaptive filter/equalizer? Is it as &quot;simple&quot; as &quot;un-attenuating&quot; the higher frequencies?&lt;/p&gt;&#xA;" OwnerUserId="5696" LastActivityDate="2014-08-12T16:55:08.477" Title="Quantizing a filtered signal" Tags="|filters|equalization|quantization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17718" PostTypeId="1" AcceptedAnswerId="17719" CreationDate="2014-08-12T14:02:02.933" Score="0" ViewCount="1083" Body="&lt;p&gt;I have two related questions on this topic.  First, about how wide should the filter be around the carrier frequency?  What is used to determine this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, in Python, I must use 'numtaps' when implementing a filter.  What exactly are numtaps?  How can I determine what to set this value to?  Setting it to about the carrier frequency seems to make decoding more successful.&lt;/p&gt;&#xA;" OwnerUserId="10591" LastActivityDate="2014-08-12T15:05:48.330" Title="How to decode Morse code (CW)" Tags="|filters|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17719" PostTypeId="2" ParentId="17718" CreationDate="2014-08-12T15:00:15.847" Score="4" Body="&lt;p&gt;From another stackexchange question (&lt;a href=&quot;https://ham.stackexchange.com/a/2018&quot;&gt;https://ham.stackexchange.com/a/2018&lt;/a&gt;) you should use a filter approximately 4 times as wide in Hz as the expected words per minute of the morse code.  That answer also includes some links and more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value &quot;numtaps&quot; says how long to make the filter.  You are using an FIR filter.  The sharpness and the stop band attenuation (how much the stuff you don't want to hear gets reduced) are both dependent (amongst other things) on the value of numtaps.  Higher values gets you better filter performance, but it is more work for the computer.&lt;br&gt;&#xA;If you find that you need high values, then you are not using an optimal filter.  There is another factor that influences the quality of the filter, and that is the &quot;window&quot; that is used to shape the filter.  If you don't use a window, then the stop band will not be reduced far enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The length of the filter (numtaps) is also relevant to the lowest frequency you can work with.  If you try to make a band pass filter, for example, then numtaps needs to be at least as long as the lowest frequency (in samples.)  Say you are sampling at 1000Hz and want to make a band pass from 1Hz to 3Hz.  You will need for numtaps to be a least 1000.  If you used instead only 333 for numtaps then you would end up with a lowpass that lets through everything below 3 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You seem to be using scipy - here is the description of the FIR-filter designer &quot;firwin.&quot; &lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.signal.firwin.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.signal.firwin.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also refer to the windows page: &lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.signal.get_window.html#scipy.signal.get_window&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.signal.get_window.html#scipy.signal.get_window&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you should try a blackmanharris or some other window that doesn't require parameters - otherwise you will have to start guessing numbers that you don't understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply using a window at all (other than boxcar) should improve things considerably so that you don't need such long filters - numtaps equivalent to the beep frequency should not be needed - you should be able to get away with well under 100 for numtaps&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="-1" LastEditDate="2017-04-13T12:59:21.280" LastActivityDate="2014-08-12T15:05:48.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17720" PostTypeId="1" AcceptedAnswerId="17728" CreationDate="2014-08-12T15:25:39.010" Score="2" ViewCount="9552" Body="&lt;p&gt;I was reading in a book that  below stated are the Properties of Discrete-time Sinusoidal Signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Property 1. The discrete time sinusoids whose frequency are separated by an integer multiple of 2$\pi$ are identical. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Property 2. The frequency of oscillation of discrete time sinusoids sequence increases  as $\omega$ increases from 0 to $\pi$. If $\omega$ is increased from $\pi$ to 2$\pi$ then frequency of oscillation decreases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to understand the mathematical property implementation of above two property but have some basic questions for clarification:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it that the above properties are applicable for &lt;strong&gt;all Discrete-time periodic Signals&lt;/strong&gt;?&lt;/li&gt;&#xA;&lt;li&gt;As per property 1 - if two sinusoids signal has frequency separated by integer multiple of 2$\pi$ - then the signal having the greater frequency will have more cycles than other. Then how they both can be same?&lt;/li&gt;&#xA;&lt;li&gt;As per property 2 - what is meant by &quot;frequency of oscillation&quot;? How can a frequency of a signal vary (increase) from 0 to $\pi$ and (decrease) from $\pi$ to 2$\pi$ - isn't it should be same from 0 to $2\pi$?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10384" LastEditorUserId="10384" LastEditDate="2014-08-12T15:46:08.023" LastActivityDate="2014-08-12T17:20:01.930" Title="Properties of Discrete-time Sinusoidal Signal" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17721" PostTypeId="1" AcceptedAnswerId="17723" CreationDate="2014-08-12T15:44:14.723" Score="1" ViewCount="21211" Body="&lt;p&gt;I was trying to solve the below system is a Time variant or Time Invariant System:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n)=nx^{2}(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for a system to be time invariant the system property should be :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(n,k) = T[x(n-k)] &#xA;&#xA;OR&#xA;&#xA;y(n,k) = y(n-k)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for all possible values of k.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming back to system equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n,k) = T[x(n-k)] = nx^{2}(n-k)$ delayed by k sample&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n-k) = nx^{2}(n-k)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n,k) = y(n-k)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The the system is time invariant, but the solution in book states that the system is time variant. I am not sure where I am going wrong or my understanding is not correct?&lt;/p&gt;&#xA;" OwnerUserId="10384" LastEditorUserId="8202" LastEditDate="2016-08-29T08:56:33.627" LastActivityDate="2021-03-02T16:52:19.963" Title="Time variant and Time Invariant Systems" Tags="|linear-systems|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17722" PostTypeId="2" ParentId="17721" CreationDate="2014-08-12T16:07:35.490" Score="1" Body="&lt;p&gt;The $y(n-k)=(n-k)x^2(n-k)$ is not equal too $nx^2(n-k)$. Hence it's not a time invariant system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They actually have the exact same example here :) &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Showing_Linearity_Time_Invariance.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/fp/Showing_Linearity_Time_Invariance.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10646" LastEditorUserId="8202" LastEditDate="2014-08-12T16:52:03.770" LastActivityDate="2014-08-12T16:52:03.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17723" PostTypeId="2" ParentId="17721" CreationDate="2014-08-12T16:18:22.403" Score="3" Body="&lt;p&gt;Here is a simple way of looking at it which avoids any algebra and uses minimal symbolism. Let us calculate the output $y$ for an input $x$ which is a unit pulse function. We have that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$y[-2] = (-2)(x[-2])^2 = 0$ since $x[-2] = 0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$y[-1] = (-1)(x[-1])^2 = 0$ since $x[-1] = 0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$y[0] = (0)(x[0])^2 = 0$ (regardless of the value of $x[0]$).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$y[1] = (1)(x[1])^2 = 0$ since $x[1] = 0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$y[2] = (2)(x[2])^2 = 0$ since $x[2] = 0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and so on.  The &lt;em&gt;entire&lt;/em&gt; input is blocked and the output $y$ is &lt;em&gt;always&lt;/em&gt; $0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about the output $\hat{y}$ when the input $\hat{x}$ is just the previous $x$&#xA;&lt;em&gt;delayed&lt;/em&gt; by one time unit? The only difference now is that $\hat{x}[1] = 1$ and&#xA;we have that &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\hat{y}[1] = (1)(\hat{x}[1])^2 = 1$ since $\hat{x}[1] = 1$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is, I hope, obvious that $\hat{x}[n] = 0$ for all integers $n$ &lt;em&gt;except&lt;/em&gt; $n=1$.&#xA;So, since the input $\hat{x}$ is just a delayed version of input $x$, is&#xA;is true that the output $\hat{y}$ is just a delayed version of output $y$?&#xA;What, if anything, does this tell you about the system properties?&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-08-13T01:45:20.363" LastActivityDate="2014-08-13T01:45:20.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17724" PostTypeId="1" CreationDate="2014-08-12T16:25:47.420" Score="2" ViewCount="150" Body="&lt;p&gt;I am working with Gabor filter with level set method as in &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.7.3145&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Level-Set and Gabor-based Active Contour Algorithm for Segmenting Textured Images&lt;/a&gt;. As you known, Gabor filter gave many filter output. Some of them is not necessary. Could you suggest to me some method that can choose best filter output that satisfy maximum the difference between object (zebra) and background that are separated by a contour (white circle)as figure. Thank you. Now, I am working in image segmentation, hence, these best filter outputs will give more accuracy&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wenNH.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="7092" LastEditDate="2023-07-22T20:11:51.003" LastActivityDate="2023-12-19T22:03:00.273" Title="Feature selection of Gabor filter" Tags="|image-processing|filters|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17725" PostTypeId="1" AcceptedAnswerId="17726" CreationDate="2014-08-12T16:28:02.830" Score="1" ViewCount="741" Body="&lt;p&gt;This is my first time working with Mel-frequency cepstral coefficients and I have two questions....&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Are some of the 13 coefficients strictly related to some sound properties like frequencies, amplitude, pitch or something ? For example if I'm interested only in sound pitch, are there some coefficients that carry that information and I can exclude the rest of the coefficients that carry other information to reduce the size of the vector ? Or those coefficients means nothing individually and they must be used all together as a whole ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I'm trying to learn Chord recognition methods. I was thinking for calculating MFCC from a short Wave file where chord is played. (It is just a chord played on piano, there is no ambient noise or other instruments). And after I get the 13 MFCCs, cluster them to a centroid which describes the appropriate chord. (24 centroids, 12 for minor chords, 12 for major). I'm just wondering, are the MFCCs good descriptor for the present pitches in the sound ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="10789" LastActivityDate="2014-08-12T16:42:34.307" Title="MFCCs and chord recognition" Tags="|mfcc|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17726" PostTypeId="2" ParentId="17725" CreationDate="2014-08-12T16:36:21.490" Score="2" Body="&lt;p&gt;MFCC's are related strictly to spectrum shape and what's more - these are relaying on the mel scale. Additionally each coefficient is a DCT value from fitted cosinusoids to log-energies. Thus interpretation of pitch would be troublesome for you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chord recognition is usually based on chromagram calculation or so called chroma features. Check out work and publications of guys from &lt;a href=&quot;http://c4dm.eecs.qmul.ac.uk/&quot; rel=&quot;nofollow&quot;&gt;QMUL&lt;/a&gt;, i.e: &lt;a href=&quot;http://www.eecs.qmul.ac.uk/~markp/2009/StarkPlumbley09-icmc.pdf&quot; rel=&quot;nofollow&quot;&gt;Real-time Chord Recognition for live performance&lt;/a&gt; - in here you will find another references. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also find their software useful: &lt;a href=&quot;http://www.sonicvisualiser.org/&quot; rel=&quot;nofollow&quot;&gt;Sonic Visualizer&lt;/a&gt; together with lot's of so called &lt;a href=&quot;http://www.vamp-plugins.org/&quot; rel=&quot;nofollow&quot;&gt;Vamp plugins&lt;/a&gt;. You can check out the code and even use command line tool to extract features you want.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-08-12T16:42:34.307" LastActivityDate="2014-08-12T16:42:34.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17727" PostTypeId="2" ParentId="17717" CreationDate="2014-08-12T16:55:08.477" Score="3" Body="&lt;p&gt;Your low-pass filter's pass band is smaller than your signal's bandwidth, so it is destroying a significant portion of your signal.  Given that, you cannot reliably reproduce the original signal without using sophisticated techniques like error correction codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would try increasing $\alpha$ to 2400 Hz.  Then the rolloff point will be 2400 * .5 = 1200.  The resulting signal should look much better.  If that filter bandwidth is too large you can find your sweet spot somewhere between 1200 and 2400 Hz.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-08-12T16:55:08.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17728" PostTypeId="2" ParentId="17720" CreationDate="2014-08-12T16:55:57.933" Score="3" Body="&lt;p&gt;Any discrete-time periodic signal with period $N$ can be written in terms of its DFT coefficients $X_k$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=\frac{1}{N}\sum_{k=0}^{N-1}X_ke^{j(2\pi/N) nk}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So whatever is true for a single sinusoid (or complex exponential) remains true for a general periodic signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two discrete-time sinusoids with a frequency separation of $2\pi k$ are identical because the sine function is periodic with period $2\pi$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=\sin(\omega n)\\&#xA;y(n)=\sin[(\omega+2\pi k)n]=\sin(\omega n +2\pi k n)=\sin(\omega n)=x(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the maximum frequency for a discrete-time sinusoid (and consequently for any discrete-time signal) is $\omega=\pi$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos(\pi n)=(-1)^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency is further increased you will observe aliasing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos[(\pi+\Delta\omega)n]=\cos[(\pi+\Delta\omega)n-2\pi n]=\cos[(\Delta\omega-\pi)n]=\\=\cos[(\pi-\Delta\omega)n],\quad 0\le\Delta\omega\le\pi$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So from the maximum frequency of $\pi$ you get a decrease in frequency down to frequency $0$ (for $\Delta\omega=\pi$).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-12T17:20:01.930" LastActivityDate="2014-08-12T17:20:01.930" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17730" PostTypeId="1" AcceptedAnswerId="17739" CreationDate="2014-08-12T19:49:06.893" Score="6" ViewCount="2268" Body="&lt;p&gt;Suppose I have  impulse response like [1/25,2/25,3/25,4/25,5/25,4/25,3/25,2/25,1/25].&#xA;I did convolution with 600 samples of test signal (it seems that I did some filtering). &#xA;Then I calculated the same thing in frequency domain: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Found frequency spectrum of test signal and frequency response.&lt;/li&gt;&#xA;&lt;li&gt;Multiplied them and via IDFT convert back to time domain.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then I plotted difference between these two signals and I got that difference between&#xA;these to signals is about |0.4|. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it ok? It seems a little bit huge for me -- the difference is about one-tenth.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function generateConvolution2(x, impResp)&#xA;{&#xA;    var xVal = x();&#xA;    var irVal = impResp();&#xA;&#xA;    var convolution = [];&#xA;    var data = [];&#xA;&#xA;    for (var i = 0; i &amp;lt; xVal.length + irVal.length - 1; i++)&#xA;    {&#xA;        convolution[i] = 0;&#xA;        for (var j = 0; j &amp;lt; irVal.length; j++)&#xA;        {&#xA;            if (i - j &amp;lt; 0) convolution[i] += 0;&#xA;            else convolution[i] += irVal[j] * xVal[i - j];&#xA;        }&#xA;&#xA;        data.push(convolution[i]);&#xA;    }&#xA;    return data;&#xA;}&#xA;&#xA;//calculate dft magnitude and spectrum of a function&#xA;function magnitudeAndPhase(length, dftLength, func)&#xA;{&#xA;    var data = [];&#xA;    for (var j = 0; j &amp;lt;= dftLength; j++)&#xA;    {&#xA;        var f = 0;&#xA;        var re = 0;&#xA;        var im = 0;&#xA;&#xA;        for (var i = 0; i &amp;lt; length; i++)&#xA;        {&#xA;            f = func(i);&#xA;            re += f * Math.cos(2 * Math.PI * j * i / length);&#xA;            im -= f * Math.sin(2 * Math.PI * j * i / length);&#xA;        }&#xA;&#xA;        //calculate magnitude&#xA;        var mag = Math.sqrt(re * re + im * im);&#xA;&#xA;        //calculate phase&#xA;        var phase;&#xA;        if (re === 0)&#xA;        {&#xA;            re = 1e-20;&#xA;        }&#xA;        phase = Math.atan(im / re);&#xA;        if (re &amp;lt; 0 &amp;amp;&amp;amp; im &amp;lt; 0) phase -= Math.PI;&#xA;        if (re &amp;lt; 0 &amp;amp;&amp;amp; im &amp;gt;= 0) phase += Math.PI;&#xA;        data.push({mag: mag, phase: phase});&#xA;    }&#xA;    return data;&#xA;}&#xA;&#xA;&#xA;function multDFt(length, dftLength, func1, func2)&#xA;{&#xA;    var data1 = magnitudeAndPhase(length, dftLength, func1);&#xA;    var data2 = magnitudeAndPhase(length, dftLength, func2);&#xA;    var result = [];&#xA;    //1)multiply magnitudes&#xA;    //2)add phase&#xA;    for (var i = 0; i &amp;lt;= dftLength; i++)&#xA;    {&#xA;        result.push({mag: data1[i].mag * data2[i].mag, phase: data1[i].phase + data2[i].phase });&#xA;    }&#xA;&#xA;    return result;&#xA;}&#xA;&#xA;//using magnitude and phase calculate IDFT&#xA;function IDFT2(mainLength, length, dftLength, testSignal, imprResp)&#xA;{&#xA;    var rea = [];&#xA;    var ima = [];&#xA;&#xA;    var dftMagResult = multDFt(length, dftLength, testSignal, imprResp);&#xA;    //create re and im part of coefficients&#xA;    for (var i = 0; i &amp;lt;= dftLength; i++)&#xA;    {&#xA;        rea.push(dftMagResult[i].mag * Math.cos(dftMagResult[i].phase));&#xA;        ima.push(dftMagResult[i].mag * Math.sin(dftMagResult[i].phase));&#xA;    }&#xA;&#xA;    //prepare re and im coefficients&#xA;    rea[0] /= length;&#xA;    rea[dftLength] /= length;&#xA;    for (var j = 1; j &amp;lt; dftLength; j++)&#xA;    {&#xA;        rea[j] /= (length / 2  );&#xA;        ima[j] /= -1 * (length / 2  );&#xA;    }&#xA;    var vala = [];&#xA;    for (var i = 0; i &amp;lt; mainLength; i++)&#xA;    {&#xA;        vala.push(0);&#xA;    }&#xA;    //calculate idft&#xA;    for (var j = 0; j &amp;lt;= dftLength; j++)&#xA;    {&#xA;        for (var i = 0; i &amp;lt; length; i++)&#xA;        {&#xA;            vala[i] += rea[j] * Math.cos(2 * Math.PI * j * i / length);&#xA;            vala[i] += ima[j] * Math.sin(2 * Math.PI * j * i / length);&#xA;        }&#xA;    }&#xA;&#xA;    return vala;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: Added my js code. Don't bother with my js style (I'm beginner) and some inconsistent naming. Every func. return array because it is needed for plotting libs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7052" LastEditorUserId="128" LastEditDate="2020-09-15T05:58:06.737" LastActivityDate="2020-09-15T05:58:06.737" Title="Difference Between Convolution and Multiplication of Frequency Response and Frequency Spectrum" Tags="|dft|convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17733" PostTypeId="2" ParentId="17730" CreationDate="2014-08-12T21:14:12.840" Score="4" Body="&lt;p&gt;Few notes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Pay attention to the &quot;Factors&quot; in the DFT. Some use $ \frac{1}{2 \pi} $ some use others, pay attention you normalize accordingly.&lt;/li&gt;&#xA;&lt;li&gt;Multiplication of the DFT is equivalent of &lt;a href=&quot;http://en.wikipedia.org/wiki/Circular_convolution&quot; rel=&quot;noreferrer&quot;&gt;Circular Convolution&lt;/a&gt;.&lt;br&gt;&#xA;You should pad the signals accordingly to get the &quot;Classic Convolution&quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastActivityDate="2014-08-12T21:14:12.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17734" PostTypeId="1" AcceptedAnswerId="42554" CreationDate="2014-08-12T21:21:25.870" Score="4" ViewCount="899" Body="&lt;p&gt;Assuming we have a discrete signal &lt;span class=&quot;math-container&quot;&gt;$ { \left\{ x \left[ n \right] \right\}}_{n = 1}^{N} $&lt;/span&gt;.&lt;br&gt;&#xA;Which has a Discrete Fourier Transform / Series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assume I'd like to estimate its Discrete Fourier Series coefficient yet some samples of &lt;span class=&quot;math-container&quot;&gt;$ x \left[ n \right] $&lt;/span&gt; are missing (The indices are known).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could that be done efficiently without computing the Pseudo Inverse of the adapting Fourier Series matrix?&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2020-03-16T21:42:38.027" LastActivityDate="2022-03-24T13:38:51.097" Title="Estimate the Discrete Fourier Transform / Series of a Signal with Missing Samples" Tags="|discrete-signals|signal-analysis|dft|estimation|fourier-series|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17738" PostTypeId="1" CreationDate="2014-08-13T06:47:23.957" Score="0" ViewCount="1215" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3DUJw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;i have a measured signal (e.g. voltage sine wave) and i would like to generate a sine wave which matches this meausred signal (with the generated sine wave i remove the harmonics from my measured signal), just like a PLL block in simulink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for that i have to do the 2 steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Calculate the frequency of the measured signal from detecting the Zerocrossing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- calcualte the sine function using sin(2*pi*f(t)*t).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- calcuating the frequency by counting the samples between two zerocrossing would results in getting the frequency at one point so my calcualted fequency does not match my sampled measured signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- even when interpolating or using the repmat function i am able to get the f(t) to be the same length as the time (t) vector yet my sine wave is not correctly calcualted. i know that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am adding the zerocrossing times on my time vector which makes the last one inconsistance which mean the sampling rate is changing also. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so how to genereate a sine wave which changing frequency and changing sampling rate of the time signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best Reagrds &lt;/p&gt;&#xA;" OwnerUserId="10798" LastActivityDate="2014-08-13T14:14:27.740" Title="Generating a Sine Signal (for example a voltage sine wave) with changing frequency and changing sample rate (time)?" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17739" PostTypeId="2" ParentId="17730" CreationDate="2014-08-13T08:32:06.160" Score="4" Body="&lt;p&gt;Usually linear and circular convolution are two different operations, but you can get them equal under some conditions, thus speed-up your convolution through FFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having two input vectors $x$ and $h$ of length $N$ and $L$ respectively, we compute linear convolution $y_l=x\ast h$. A resulting vector has length $M=N+L-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to compute the same result using FFT, then you must pad both of your signals with zeros up to length of $M$. Last step is to use the formula for circular convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_c = \mathtt{IFFT}\{\mathtt{FFT}\{x_{pad}\}\times \mathtt{FFT}\{h_{pad}\}\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now both results are equal, $y_c=y_l$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below you can find some example in MATLAB for your filter coefficients and signal being white noise. Please remember that &lt;code&gt;fft&lt;/code&gt; function automatically pads signal with zeros to length specified as second argument.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Signals used&#xA;randn('seed',0) % still prefer an old-way...&#xA;x = randn(1,600);&#xA;h = [1/25,2/25,3/25,4/25,5/25,4/25,3/25,2/25,1/25];&#xA;&#xA;% Linear convolution&#xA;y_l = conv(x,h);&#xA;&#xA;% Linear convolution through circular&#xA;M = length(x)+length(h)-1;&#xA;y_c = ifft(fft(x, M).*fft(h, M)); % pad to M&#xA;&#xA;% Plotting of results&#xA;hold on&#xA;plot(y_l,'b')&#xA;plot(y_c, 'r--')&#xA;grid on&#xA;xlabel('Sample')&#xA;ylabel('Amplitude')&#xA;title('Result of linear and circular convolution')&#xA;legend({'linear','circular'})&#xA;display(sprintf('Max difference is: %e', max(abs((y_l-y_c)))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see that results are equal (please mind that red line is dashed so the blue one could be seen- some people tend to think that it is error), and the maximum difference given by MATLAB is: &lt;code&gt;4.440892e-16&lt;/code&gt; which is pretty close to the relative accuracy of floating-point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/624Y3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also please keep in mind that if you are using any external libraries, check what scaling factors are being used. As far as I remember FFTW is not performing any scaling and everything is up to you.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;One might notice, that for long signals it might produce lengths which are making the FFT algorithm not very efficient, i.e. not being powers of 2. We can therefore pad the signal to a nearest power of 2 in order to speed up the computations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you mentioned 1024. This will produce trailing zeros after 608'th sample, which should be removed. Here's the plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tLts0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So answering your question; it is possible to use $M=1024$ instead of $M=600+9-1=608$. Just remember to truncate the output to $M=608$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also including a Python code for the same procedure as some people don't have MATLAB. Resulting code which pads to power of 2, could be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;def nextpow2(N):&#xA;    &quot;&quot;&quot; Function for finding the next power of 2 &quot;&quot;&quot;&#xA;    n = 1&#xA;    while n &amp;lt; N: n *= 2&#xA;    return n&#xA;&#xA;if __name__ == &quot;__main__&quot;:&#xA;    # Signals used&#xA;    x = np.random.randn(600)&#xA;    h = np.array([1,2,3,4,5,4,3,2,1])/25.0&#xA;&#xA;    # Linear convolution&#xA;    y_l = np.convolve(x, h)&#xA;&#xA;    # Circular convolution&#xA;    M = x.size + h.size - 1&#xA;    M2 = nextpow2(M)&#xA;    y_c = np.fft.ifft(np.fft.fft(x,M2) * np.fft.fft(h,M2))&#xA;    # Truncate the output and get rid of small imaginary parts&#xA;    y_c = np.real(y_c[0:M])&#xA;&#xA;    # Plotting of results&#xA;    plt.plot(y_l, 'b', label='linear')&#xA;    plt.grid(True)&#xA;    plt.hold(True)&#xA;    plt.plot(y_c, 'r--', label='circular')&#xA;    plt.title('Result of linear and circular convolution')&#xA;    plt.xlabel('Samples')&#xA;    plt.ylabel('Amplitude')&#xA;    plt.legend()&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-08-13T12:19:14.233" LastActivityDate="2014-08-13T12:19:14.233" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17741" PostTypeId="2" ParentId="17685" CreationDate="2014-08-13T09:25:19.507" Score="-2" Body="&lt;p&gt;Look [&lt;a href=&quot;http://batmobile.blogs.ilrt.org/audio-analysis-on-an-iphone&quot; rel=&quot;nofollow&quot;&gt;http://batmobile.blogs.ilrt.org/audio-analysis-on-an-iphone&lt;/a&gt; for description&#xA;.&#xA; .A theorem called the Nyquist sampling theorem states that in order to sample a signal of X Hz without significant loss of quality, you need to sample at 2X the frequency.  The limit of human hearing is approximately 20kHz, which hence requires a sample rate of approximately 40Khz.  This is why CDs are sampled at 44Khz.  i.e. each second of recording in a CD contains 44,000 measurements of the highest possible frequency contained in the recording.&lt;/p&gt;&#xA;" OwnerUserId="10799" LastActivityDate="2014-08-13T09:25:19.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17742" PostTypeId="2" ParentId="17738" CreationDate="2014-08-13T14:14:27.740" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;If you are doing this in realtime, then your generated signal WILL ALWAYS lag behind the original.&lt;/li&gt;&#xA;&lt;li&gt;Your sampling rate will not change because of anything your calculation does.&lt;/li&gt;&#xA;&lt;li&gt;You have a problem with discontinuities when the frequency of your measured signal changes - you are abruptly changing from the old to the new frequency.  This will cause skips in the generated signal.&lt;/li&gt;&#xA;&lt;li&gt;You will not always be able to exactly match the real signal - the zero crossing may take place between two samples.  This will cause your calculated frequency to be wrong.&lt;/li&gt;&#xA;&lt;li&gt;The calculated frequency won't necessarily fit well with your sampling rate, so that it won't end exactly on a sample - this will cause another skip in your generated signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You will have to gradually change f(t) in order to avoid the abrupt changes.  So, you measure f one time and it is (say) 1000Hz, then the next time it is 1100hz.  You cannot simply change from one to the other.  You will have to &quot;walk&quot; the value for f from 1000Hz to 1100Hz over the length of time it takes for one half cycle of 1100Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should improve things a good bit.  &lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-08-13T14:14:27.740" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17743" PostTypeId="1" AcceptedAnswerId="17744" CreationDate="2014-08-13T14:33:46.347" Score="0" ViewCount="1899" Body="&lt;p&gt;In Welch periodogram Power Spectral Density estimate, we devide the N-long signal into K segments, each of length L with overlapping D, such that N=L+(K-1)*D. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;http://arxiv.org/pdf/cond-mat/0402130v1.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;, just above eqn (7), the authors mention that the step of performing the DFT is to be done to each (windowed) segment (of length L) such that the length of the resulting DFT is L/2. Finally all DFT's will be averaged and normalized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end, you get a PSD of a max. length L/2. Why is that? I would expect the length of the resulting PSD to be related to N, not to L...&lt;/p&gt;&#xA;" OwnerUserId="8825" LastActivityDate="2019-02-26T14:55:14.247" Title="What's the number of data points in a Welch-based PSD?" Tags="|power-spectral-density|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17744" PostTypeId="2" ParentId="17743" CreationDate="2014-08-13T14:51:46.200" Score="2" Body="&lt;p&gt;And that's absolutely correct. As you mentioned, procedure can be described as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take long signal of length $N$ and slice it with some overlap and window into segments of length $L$.&lt;/li&gt;&#xA;&lt;li&gt;For each of these segments calculate the DFT. Assuming no zero padding, you will get spectrum with $L$ points - same as segment length. &lt;/li&gt;&#xA;&lt;li&gt;Because signals are real, then we just care about first half of spectra (squred magnitude to be correct), thus take only $L/2$ points.&lt;/li&gt;&#xA;&lt;li&gt;Do this procedure for each segment and you will end up with lot's of vectors (dependent of overlapping and signal length $N$) of length $L/2$. &lt;/li&gt;&#xA;&lt;li&gt;Now you need to average all the spectra. This is simply average for each frequency bin across number of segments and PSD is calculated.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Let's assume you will end up with 50 segments of length $L$, then you must average 50 spectra of length $L/2$. The longer is your signal, more segments will be averaged (better estimate), but obviously their length is not changing - you've chosen it in the beginning.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-08-13T14:51:46.200" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17745" PostTypeId="2" ParentId="16269" CreationDate="2014-08-13T15:57:35.143" Score="2" Body="&lt;p&gt;Some tips that might help:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your FFT should be shorter than the features you are trying to detect.  An FFT will be calculated for a specific number of samples.  This represents a certain length of time (1024 samples at 1kHz sampling rate is 1024 milliseconds.)  If the time period of your FFT is longer than your signal features then they will all be smeared together - you won't be able to identify the features.  You will have to find a compromise for your FFT length between enough frequency resolution and enough time resolution.  The needed frequency resolution depends on the frequency content of features you need to detect, time resolution depndes on the length of the features (as well as the length of time when there are no features - which is itself perhaps a feature you need to take note of.)&lt;/li&gt;&#xA;&lt;li&gt;Classify the features as to frequency range.  Make an average of the FFT-points for those ranges - this will give you the intensity of that feature.&lt;/li&gt;&#xA;&lt;li&gt;Plot the intensity of the features against time.&lt;/li&gt;&#xA;&lt;li&gt;Locate groupings of feature intensities that are unique for each type of heart defect - these are the things you need to be able to recognize.  For example: Pulmonic stenosis has low frequency (normal heart beat sound) with high frequency (murmur) at the same time, but no murmur type sound between beats - but it also has a click that you will need to detect. &lt;/li&gt;&#xA;&lt;li&gt;You will need to detect the S1 and S2 by the pause between beats - long pause followed by short means that the last beat is the S2.&lt;/li&gt;&#xA;&lt;li&gt;The examples on the site you referenced have been cleaned up, but they still have things that might try to sneak in as features.  I hear a 60Hz power hum, and some ringing from the filters that were used to clean things up.  There is also some sone background &quot;white&quot; noise in some of them.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would try loading the files into &lt;a href=&quot;http://www.baudline.com/download.html&quot; rel=&quot;nofollow&quot;&gt;Baudline&lt;/a&gt; and seeing how to identify the features and their combinations by eye first.  Baudline can show you how the freqeuncy content varies with time so that you can see the relationships between features and relative timing.  Use &lt;a href=&quot;http://audacity.sourceforge.net/?lang=de&quot; rel=&quot;nofollow&quot;&gt;Audacity&lt;/a&gt; to convert the mp3 files to wav and to downsample to 1000Hz sampling rate before loading in Baudline.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Baudline Color Aperture is handy for making certain parts of the diagram standout - this can make it easier to identify features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Baudline is for Unix type systems only (Linux, BSD, Mac OSX) but I'm sure there's similar software for Windows.  Audacity is available for Windows as well as Linux and OSX.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-08-13T16:20:47.763" LastActivityDate="2014-08-13T16:20:47.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17747" PostTypeId="1" AcceptedAnswerId="17749" CreationDate="2014-08-13T19:42:13.393" Score="0" ViewCount="352" Body="&lt;p&gt;This question is related to my other recent questions.  In the last question, I learned that I should filter about 4 * WPM (words per minute) around the carrier frequency if I want to recover Morse code.  One problem is, learning the words per minute.  I filter because I want to differentiate times when the system is keyed, to times that are just noise.  Filtering requires WPM, WPM seems to require filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am simply going through the whole audio, and if a window has an element above a certain threshold, the whole window is marked as being 'on' or 'keyed'.  The window is big enough for a whole alternation of the carrier to be examined (sampling frequency over carrier freq, or fs/fc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there better ways to approach this?  I have been working on this for awhile now.  I am doing this in Python.&lt;/p&gt;&#xA;" OwnerUserId="10591" LastActivityDate="2014-08-13T21:12:16.613" Title="Advice on filtering a CW signal for processing" Tags="|filters|python|signal-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17749" PostTypeId="2" ParentId="17747" CreationDate="2014-08-13T21:12:16.613" Score="1" Body="&lt;p&gt;The recommendation to use 4* WPM just means that you should estimate the upper limit of the WPM that you expect to receive.  High speed CW starts around 40 WPM (usually too fast to write or type the decoded signal.) So, 50WPM would be a good upper limit which means you could use a bandwidth of 200Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative to what you are doing, you could use the goertzel algorithm.  That algorithm works like a narrow bandpass with a signal level detector.  You run your signal through it, and it delivers a number that tells you how strong the signal is at the center frequency that you gave the goertzel method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://netwerkt.wordpress.com/2011/08/25/goertzel-filter/&quot; rel=&quot;nofollow&quot;&gt;This web site &lt;/a&gt; gives a clear example of how to write a goertzel method to do what you are trying to accomplish.  Use the tandem goertzel to work in real time.  The example is in C, but it should be clear enough that you can translate it to python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Varying the RESETSAMPLES value will allow you to change how narrow the filter is.  The higher RESETSAMPLES is, the narrower the filter will be.  The article suggests 200 samples, so I would start there.  If your signal is too noisy and you get a lot of bad morse code symbols, then you can make the number larger.  What I usually do is make it some multiple of the wave length of the frequency I am trying to detect in samples.  So, to detect 1kHz using 44100Hz sampling, I would first try 44 (44100/1000.) If that is too &quot;loose&quot; then 88, then 132 and so forth until I get a filter that is narrow enough.  If you go too high, though, you will start &quot;smearing&quot; the morse code symbols and won't be able to tell when one ends and the next begins.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-08-13T21:12:16.613" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17750" PostTypeId="1" AcceptedAnswerId="17757" CreationDate="2014-08-14T02:23:10.200" Score="-3" ViewCount="464" Body="&lt;p&gt;I'm implementing a BCI-Wheel Chair Control System where signal are extracted from the arm into MATLAB -&gt; feature extraction -&gt; classification -&gt; Control signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The delay should be minimal between muscle movement and when control signal is sent&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read that windows is not optimal for this purpose (not even 8.1?) Can anyone suggest any solutions to speed up the process as I've described from a OS/hardware perspective?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2014-08-14T08:59:52.843" Title="What is the best OS for real time signal processing?" Tags="|eeg|hardware-implementation|emg|" AnswerCount="2" CommentCount="1" ClosedDate="2014-08-18T08:59:44.653" ContentLicense="CC BY-SA 3.0" />
  <row Id="17751" PostTypeId="1" CreationDate="2014-08-14T02:35:20.547" Score="1" ViewCount="433" Body="&lt;p&gt;I am trying to estimate the signal-to-noise ratio of a wave file (The wave file is a recording of a conversation in a room). I found examples where the Matlab scripts compare the wave file data to a noisy wave file. This noisy wave file is generated by either mixing Gaussian noise into the actual recording or they have mixed other sounds into the wave file and estimate the SNR. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I determine the noise floor for calculating SNR of a wave file? The reason for estimating the SNR of the recorded wave files is to determine if the speech content recorded in the file is useful or rendered by useless due to noise in the background. &lt;/p&gt;&#xA;" OwnerUserId="10808" LastActivityDate="2014-11-12T18:55:49.113" Title="Generation of noise floor file for estimating signal-to-noise ratio of a wave file" Tags="|audio|snr|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17752" PostTypeId="1" AcceptedAnswerId="17753" CreationDate="2014-08-14T07:46:37.133" Score="1" ViewCount="1185" Body="&lt;p&gt;Here is a bunch of code from MATLAB documentation: &lt;a href=&quot;http://www.mathworks.in/help/phased/examples/designing-a-basic-monostatic-pulse-radar.html&quot; rel=&quot;nofollow&quot;&gt;Designing a Basic Monostatic Pulse Radar&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wav = phased.RectangularWaveform(...&#xA;    'PulseWidth',1/pulseBandwidth,...&#xA;    'PRF',PRF,...&#xA;    'SampleRate',Fs);&#xA;matchingcoeff = getMatchedFilter(wav);&#xA;&#xA;hmf = phased.MatchedFilter(...&#xA;    'Coefficients',matchingcoeff,...&#xA;    'GainOutputPort',true);&#xA;&#xA;&#xA;[rx_pulses, mfgain] = step(hmf,rx_pulses);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How MATLAB calculates the &lt;code&gt;mfgain&lt;/code&gt; (matched filter gain)? Any formula for that?&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="1629" LastEditDate="2016-06-02T09:10:17.543" LastActivityDate="2017-01-13T20:40:33.157" Title="How MATLAB calculates matched filter gain" Tags="|matched-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17753" PostTypeId="2" ParentId="17752" CreationDate="2014-08-14T08:12:32.583" Score="2" Body="&lt;p&gt;Matched filter gain is calculated as (in dB):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$G_{dB} = 10 \cdot \log_{10}(L)$,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where $L$ - is filter length. It's maximum possible SNR improvement that filter can provide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this formula and compare result with MATLAB one. I suppose it will be the same.  &lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="1629" LastEditDate="2016-06-02T09:10:37.603" LastActivityDate="2016-06-02T09:10:37.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17754" PostTypeId="1" CreationDate="2014-08-14T08:13:10.790" Score="-1" ViewCount="1859" Body="&lt;p&gt;I understand what books states about cross-correlation of signals and their mathematical representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For continuous functions f and g, the cross-correlation is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(f \star g)(\tau)\ \stackrel{\mathrm{def}}{=} \int_{-\infty}^{\infty} f^*(t)\ g(t+\tau)\,dt$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f*$ denotes the complex conjugate of $f$ and $\tau$ is the time lag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for discrete functions, the cross-correlation is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(f \star g)[n]\ \stackrel{\mathrm{def}}{=} \sum_{m=-\infty}^{\infty} f^*[m]\ g[m+n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I understand that for CT we always should do Integral and weighted sum for discrete  functions. Am I correct in my understanding?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my question is why we need to do signal samples multiplication to find cross-correlation - I mean how it is different from addition of samples or rather when we should do addition / multiplication of signals samples and what would it mean?&lt;/p&gt;&#xA;" OwnerUserId="10810" LastEditorUserId="10810" LastEditDate="2014-08-14T09:09:15.250" LastActivityDate="2014-09-13T10:21:35.183" Title="Correlation : Cross correlation why we need to multiply the samples" Tags="|autocorrelation|cross-correlation|correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17755" PostTypeId="2" ParentId="14306" CreationDate="2014-08-14T08:33:44.353" Score="-3" Body="&lt;p&gt;You can use this command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(T,100*(var1-var2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope it might solve your problem although you don't need a plot command.&lt;/p&gt;&#xA;" OwnerUserId="10811" LastEditorUserId="8202" LastEditDate="2014-08-14T09:32:02.803" LastActivityDate="2014-08-14T09:32:02.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17756" PostTypeId="2" ParentId="17750" CreationDate="2014-08-14T08:37:14.943" Score="0" Body="&lt;p&gt;Linux and Real-Time Linux patch are the answer.&#xA;Especially if you are dealing with ARM boards, it gives you the minimum overhead possible, using an headless or terminal-only system.&#xA;Quoting the an article (&#xA;&lt;a href=&quot;http://www.linux.com/news/featured-blogs/200-libby-clark/710319-intro-to-real-time-linux-for-embedded-developers&quot; rel=&quot;nofollow&quot;&gt;http://www.linux.com/news/featured-blogs/200-libby-clark/710319-intro-to-real-time-linux-for-embedded-developers&lt;/a&gt;) featured on linux.com,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;if your embedded device has some &quot;must have&quot; deadlines to respond to&#xA;  then the PREEMPT_RT patch would probably be sufficient. I've heard&#xA;  that some of the Garmin navigational devices run with Linux patched&#xA;  with the PREEMPT_RT kernel.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;What PREEMPT_RT gives you over the normal kernel is not only faster&#xA;  response times, but more importantly, it removes all unbounded&#xA;  latencies. An unbounded latency is where the amount of delay that can&#xA;  occur is dependent on the situation&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can get more infos about Real Time patch and RTLinux (Real Time Linux with the applied patch) here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://rt.wiki.kernel.org/index.php/Main_Page&quot; rel=&quot;nofollow&quot;&gt;https://rt.wiki.kernel.org/index.php/Main_Page&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7760" LastActivityDate="2014-08-14T08:37:14.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17757" PostTypeId="2" ParentId="17750" CreationDate="2014-08-14T08:59:52.843" Score="0" Body="&lt;p&gt;Your choices are Windows (various flavors,) Mac OSX, and Linux (even more flavors.)  Those are the operating systems that Matlab runs on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;blackibiza's comments about ARM aren't relevant here, because Matlab only runs on Intel or AMD x86 processors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of the three, linux is more customizable.  You can strip a linux system down so that there's less stuff going on in the background, and you can use the realtime patches to improve things more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are using Matlab directly, I would assume you are still protoyping your system.  At that stage, I would think you would work with whatever you are most comfortable with so long as it doesn't cause an obvious unacceptable performance problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are trying to move beyond the prototype stage, then I think you should look at the MathWorks &lt;a href=&quot;http://www.mathworks.de/hardware-support/index.html?q=%20product:%22Embedded%20Coder%22&quot; rel=&quot;nofollow&quot;&gt;Embedded Coder&lt;/a&gt; pages.  This offers support for converting Matlab code into C code that you can compile and run on various embedded systems - including ARM.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-08-14T08:59:52.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17758" PostTypeId="1" AcceptedAnswerId="17843" CreationDate="2014-08-14T09:01:17.713" Score="3" ViewCount="2552" Body="&lt;p&gt;I am working on a tuning app. I have so far tried 3 different libraries with a number of different algorithms. However, when I compare to other tuner apps, I seem to be getting frequency doubling on certain notes with certain instruments. Sometimes frequency halving depending on other factors. I have tried adjusting the buffer size (size of array of samples) and also the sampling frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Algorithms include: Auto-Correlation, YINFFT, Dynamic Wavelet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there sometimes a need to filter the signal before hitting the algorithm? &lt;/p&gt;&#xA;" OwnerUserId="10812" LastActivityDate="2014-08-18T17:06:23.673" Title="Pitch Detection: avoiding frequency doubling / halving" Tags="|audio|sound|pitch|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17760" PostTypeId="2" ParentId="17758" CreationDate="2014-08-14T09:24:57.417" Score="1" Body="&lt;p&gt;You are most likely running up against the fact that some notes that you hear don't include the fundamental frequency.  As an example, you play a note at 100Hz.  The instrument doesn't actually produce the 100Hz.  What it produces is a seris of harmonics (multiples) of the fundamental.  So, you measure and find 200Hz as the loudest tone instead 100Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to detect the pitch as you've been doing, but detect harmonics as well and check the distance between harmonics.  If they aren't multiples of your measured primary, then your true primary will be the difference between the the detected higher notes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To stay with the example, you play a 100Hz note and detect 200Hz, 300Hz, and 400Hz.  The diffence between the higher notes is 100Hz, which is not the &quot;primary&quot; of 200Hz you thought you had so your true primary is 100Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a lot of information on the internet about this kind of thing.  Root around and look for information on detecting suppressed fundamentals.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-08-14T09:24:57.417" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17761" PostTypeId="1" CreationDate="2014-08-14T09:28:24.370" Score="1" ViewCount="243" Body="&lt;p&gt;I have an aerial image, like this&lt;img src=&quot;https://i.stack.imgur.com/JNt7S.png&quot; alt=&quot;ship on top-right&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to detect the outline of the ship without shadow. How can I do it? I tried threshold in both graylevel, RGB and HSV. It doesn't work perfectly.&lt;/p&gt;&#xA;" OwnerUserId="10433" LastEditorUserId="13320" LastEditDate="2016-11-21T13:06:24.353" LastActivityDate="2018-09-20T13:50:53.353" Title="Ship detection from aerial image" Tags="|image-processing|object-recognition|detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17762" PostTypeId="2" ParentId="17754" CreationDate="2014-08-14T09:47:25.257" Score="1" Body="&lt;p&gt;I am not entirely sure if I understood your question, so this might be completely irrelevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we need to multiply and shift the signal samples:&#xA;The objective of the cross-correlation operation between signal $x$ and signal $y$ is to find how well they correlate (resemble each other) and when they correlate the best. In other words, if $y$ is a delayed version of $x$ as in:&#xA;$y = x(t - d)$, where $d$ is a positive time delay, then $y$ would appear identical to $x$ if $y$ was shifted by $d$ seconds to the left on the time axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if we have no prior knowledge of the value of $d$? An approach would be to take $y$ and shift it by an amount $\tau$ to the left on the time axis. If we try this operation for an infinite range of $\tau$ values, would you agree with me that, at $\tau$ == $d$, the shifted $y$ signal would appear identical to the $x$ signal? That is more or less the justification for shifting the samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a signal $z$ given by $z = Ax(t-d)$, where $A$ is a scalar. $z$ is a scaled, and time-delayed version of $x$.&#xA;During the shifting by $\tau$ operation in the previous paragraph, if you were to take the difference/sum of $z$ and $x$, the outcome would not be very informative if $A$ were very large. e.g if $A$ = 1000, the output difference/sum $R$ would not vary significantly over the range of possible $\tau$. What I mean is that $R$ would appear mostly flat, and you would not be able to figure out the value of the time delay $d$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were to use division instead, how would you deal with the divisor signal being 0 sometimes? i.e. division by zero?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplication is the best option, since relative amplitudes do not affect the results too much. You'll then get a peak in the cross-correlation output which will signify the time delay $d$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this answers your question.&lt;/p&gt;&#xA;" OwnerUserId="8861" LastActivityDate="2014-08-14T09:47:25.257" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17763" PostTypeId="2" ParentId="17761" CreationDate="2014-08-14T09:56:49.307" Score="0" Body="&lt;p&gt;How's this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sMxxs.png&quot; alt=&quot;This is what I managed.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I converted it to LAB space, took only the A channel, sharpened the contrast, and used a sobel edge detection.  The outline is kind of rough, but pretty much only the ship shows up.  If you are trying to find ships, then that seems like a good direction to start from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or how does this suit you:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7gem4.png&quot; alt=&quot;Blurred and sharpened&quot;&gt;&#xA;This is the first image aftr blurring, sharpening the contrast and doing an unsharp mask.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-08-14T10:29:54.207" LastActivityDate="2014-08-14T10:29:54.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17766" PostTypeId="2" ParentId="17761" CreationDate="2014-08-14T10:45:36.520" Score="2" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PK4Ij.png&quot; alt=&quot;Laplacian of Gaussian&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have used Laplacian of a gaussian filtered image with sigma value of 3.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have thresholded the LoG image with a high-pass filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have used gray closing morphologic operator.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have filtered the blobs according to their area.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are several more ways to do it depending on the images, conditions(sea), illumination, ships etc.&#xA;For this image, non-color methods are preferable as shadows are not always predictable.&lt;/p&gt;&#xA;" OwnerUserId="8423" LastActivityDate="2014-08-14T10:45:36.520" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17767" PostTypeId="1" CreationDate="2014-08-14T11:05:35.430" Score="3" ViewCount="595" Body="&lt;p&gt;&lt;strong&gt;Brief background&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is a known problem that high order modulation schemes suffers from phase noise of reference generator. It's very important issue for e.g. line-of-sight (LOS) modems exploiting QAM-256 or even higher. Some compensation schemes are possible to solve this task. The main challenge in these schemes is to estimate phase noise in a time span of data reception. Knowing actual samples of phase noise we can eliminate it from data symbols significantly improving BER for high order modulation. Such estimation is possible due to phase noise is in general low band random process which can be adaptively predicted/estimated. One can trade off communication speed inserting known pilots in data flow to estimate phase noise at some moments of time. Phase noise from pilots' time span could be used to evaluate phase noise for the interval of data samples. So the question is about pilot mapping scheme and estimation techniques.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Point&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Gathering some information about this topic, I can pick out two major approaches:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Sending a group of pilots (QPSK) &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; eliminating pilot modulation to get phase noise (PN) samples &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; learning of adaptive prediction filter (e.g. by LMS) &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; finding predictive PN samples &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; eliminating PN from data samples &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; wait for the next pilot group and repeat. It's &lt;strong&gt;extrapolation&lt;/strong&gt; method.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Inserting pilot sample (QPSK) periodically in the data stream, e.g. 1 pilot/32 data &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; evaluating PN at pilots (like discussed above) &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; finding PN between pilots by interpolation, number of pilots from left and right are used &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; eliminating PN from data samples. It's &lt;strong&gt;interpolation&lt;/strong&gt; method.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Has someone any experience with similar technologies? Or maybe someone face to phase noise compensation problem in practice?&lt;/p&gt;&#xA;&lt;p&gt;I wonder to know which of these approaches (I mean pilot-based, &lt;em&gt;interpolation&lt;/em&gt; or &lt;em&gt;extrapolation&lt;/em&gt;) is more preferable/robust in real life modem design?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Work environment is to be considered as a channel with AWGN. SNR is pretty high, e.g. 40-50 dB. Phase noise is in the order of -70...-90 dB/Hz. Phase noise bandwidth is significantly less then signal's one.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is an interesting article in IEEE:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/966296&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simon V., et el. - &lt;em&gt;Phase noise estimation via adapted&#xA;interpolation&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It's about the second approach. Adaptive interpolation via LMS is discussed. Does someone know any interesting references, I'm curious to learn about.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UmRq2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;In the picture above the first case is illustrated.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="7092" LastEditDate="2022-05-06T11:55:24.757" LastActivityDate="2022-05-06T11:55:24.757" Title="Phase noise estimation and compensation schemes" Tags="|digital-communications|interpolation|adaptive-filters|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17768" PostTypeId="1" AcceptedAnswerId="17769" CreationDate="2014-08-14T12:56:00.503" Score="0" ViewCount="1650" Body="&lt;p&gt;I read across places that cross-correlation of two signal (a radar sending a signal and receiving it back) one can detect the location (distance) of a target from a point and that cross-correlation can be used for comparing signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I solved a question to find cross-correlation of two finite length sequences where:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(l)={1,2,1,1}&#xA;y(l)={1,1,2,1}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The cross-correlation sequence came as: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{1,4,6,6,5,2,1}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The answer was also correct as per my verification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am not able to understand how using the above cross-correlation sequence value I can state it to be used for -&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a)location of a target? b)comparing signals x and y?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="10384" LastActivityDate="2014-08-14T13:24:13.930" Title="Cross-Correlation : Comparing two signals or finding the location of a target" Tags="|autocorrelation|cross-correlation|correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17769" PostTypeId="2" ParentId="17768" CreationDate="2014-08-14T13:24:13.930" Score="1" Body="&lt;p&gt;Your example would be more illuminating for you if you did this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(l)={1,2,1,1}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(l)={0,0,0,0,0,0,0,1,2,1,1}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The peak of the crosscorrelation would then tell you how far into y(1) the contents of x(1) are.  If x(1) represents a radar pulse, then y(1) represents the received reflection.  The peak of the cross correlation then tells you how long it took for the reflection to return.  This tells you how far away the obect that reflected your signal - you then know where that object is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross correlating also tells you how similar two signals are.  The higher the peak, the more the two signals are alike.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try these to see what I mean:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These have a relatively low peak&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(l)={1,2,0,0}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(l)={0,1,1,1}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;compared to this next set which has a relatively high peak:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(l)={1,2,0,0}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(l)={1,2,0,0}&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-08-14T13:24:13.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17771" PostTypeId="1" AcceptedAnswerId="17779" CreationDate="2014-08-14T13:47:32.630" Score="3" ViewCount="1800" Body="&lt;p&gt;Given some frequency-domain representation of an impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does the number of frequency-domain sampling points influence the outcome of an inverse FFT, if I keep the sampling frequency constant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 1&lt;/strong&gt;&#xA;Take x(t) = e^(-t)*sin(t) for t in (0,10). Sample the signal, take its fft. Omit every second point of the fft and on the result do an inverse fft. Here is the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9oEiz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it looks as if the frequency-domain downsampling had removed the second portion of my signal, while dividing the first part by two. (Indeed multiplying the result by two results in a curve lying exactly above the first part of the original signal.)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why did it remove the second part and not some arbitrary other part? I guess this is related to the second part being nearly zero everywhere, but I can't seem to find the exact reason.&lt;/li&gt;&#xA;&lt;li&gt;Why is the result divided by two?&lt;/li&gt;&#xA;&lt;li&gt;How does this generalize to other time signals?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 2 (pathological)&lt;/strong&gt;&#xA;Same as above, this time with a signal that is linearly decreasing from 1 to 0.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pPuhQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; There was a mistake here: I accidentally used an uneven number of sampling points, which resulted in a complex signal after the ifft. Here is the fixed plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/38ydC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in mathematical/theoretical as well as intuitive explanations of what's going on, as well as pointers on where to read on. I even had trouble finding a correct term for what I am doing.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here's the &lt;a href=&quot;http://www.r-project.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;R&lt;/a&gt; code that produced the above plots.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# First plot&#xA;t &amp;lt;- seq(0.01, 10, 0.01)&#xA;z &amp;lt;- exp(-t)*sin(t)&#xA;Z &amp;lt;- fft(z)/length(z)&#xA;Z2 &amp;lt;- Z[seq(1,length(Z),2)]&#xA;z2 &amp;lt;- fft(Z2, inverse=T)&#xA;plot(z)&#xA;points(Re(z2), col=&quot;red&quot;)&#xA;legend(&quot;topright&quot;, legend=c(&quot;original&quot;, &quot;half-sampled&quot;), fill=c(&quot;black&quot;, &quot;red&quot;, &quot;blue&quot;))&#xA;&#xA;# Second plot&#xA;x &amp;lt;- seq(1,0.101, -0.001)&#xA;X &amp;lt;- fft(x)/length(x)&#xA;X2 &amp;lt;- X[seq(1,length(X),2)]&#xA;x2 &amp;lt;- fft(X2, inverse=T)&#xA;plot(x)&#xA;points(Re(x2), col=&quot;red&quot;)     &#xA;legend(&quot;topright&quot;, legend=c(&quot;original&quot;, &quot;half-sampled&quot;), fill=c(&quot;black&quot;, &quot;red&quot;, &quot;blue&quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10816" LastEditorUserId="10816" LastEditDate="2014-08-14T21:20:37.527" LastActivityDate="2014-08-14T21:20:37.527" Title="How does the number of frequency-domain sampling points influence the outcome of an inverse FFT?" Tags="|fft|sampling|frequency-domain|ifft|aliasing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17773" PostTypeId="2" ParentId="17758" CreationDate="2014-08-14T14:42:26.107" Score="0" Body="&lt;p&gt;Summary autocorrelation works well. This split the signal into several frequency bands, autocorrelates each one and then sums the autocorrelation functions. The peak value of the SACF is the time period of the fundamental frequency.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2014-08-14T14:42:26.107" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17774" PostTypeId="1" AcceptedAnswerId="17783" CreationDate="2014-08-14T14:49:51.293" Score="7" ViewCount="5943" Body="&lt;p&gt;Suppose you have k samples from each of the N elements of a uniform linear array (ULA) of sensors:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the physical meaning of a covariance matrix?&lt;/li&gt;&#xA;&lt;li&gt;How do you form a covariance matrix with the samples?&lt;/li&gt;&#xA;&lt;li&gt;How do you decide how many samples you need to use to form the covariance matrix?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5843" LastActivityDate="2014-08-15T04:53:11.540" Title="What is a covariance matrix?" Tags="|statistics|matrix|covariance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17775" PostTypeId="2" ParentId="17751" CreationDate="2014-08-14T15:24:59.800" Score="1" Body="&lt;p&gt;One method that is reasonable for white noise is to use a spectrogram. For each spectrum, compute a quantile value of the power bins and use that as the estimated noise floor. The quantile should be less than the maximum spectral occupancy of the speech. For example if the speech never fills more than 50% of the spectrum then the median (quantile 0.5) might be reasonable. If the speech fills more than half the spectrum then use a smaller quantile.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-08-14T15:24:59.800" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17776" PostTypeId="2" ParentId="17758" CreationDate="2014-08-14T15:29:03.393" Score="3" Body="&lt;p&gt;so Adamski, what you have here is what we call &lt;em&gt;&quot;the &lt;strong&gt;Octave Problem&lt;/strong&gt;&quot;&lt;/em&gt; and is well-known and oft discussed with people who work on the pitch detection problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;first, some definitions.  given a quasi-periodic signal, $x(t)$, where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) \approx x(t+T) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in some local region where $t \approx t_0$, we normally define &lt;em&gt;&quot;pitch&quot;&lt;/em&gt;, measured in octaves as the base-2 logarithm of the local fundamental frequency, $f_0$, of a note relative to some reference frequency $f_R$.  &quot;pitch&quot; is &lt;em&gt;always&lt;/em&gt; about an interval, which means it's expressed relative to &lt;em&gt;something&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ p = p_R + \log_2 \left( \frac{f_0}{f_R} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the local fundamental frequency is the reciprocal of the local period&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f_0 \triangleq \frac{1}{T}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if $p = p_R$ it's because the fundamental frequency $f_0$ is equal to the reference frequency $f_R$.  sometimes we use A440 as the reference, most often i use MIDI note 0 as the reference and measure pitch in semitones which are $\frac{1}{12}$ octave.  in the MIDI convention, middle C is MIDI note 60 and A440 is MIDI note 69.  then the definition of pitch (relative to MIDI note 0) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;p &amp;amp; = 69 + 12 \log_2 \left( \frac{f_0}{440 \text{Hz}} \right) \\&#xA;&amp;amp; = 0 + 12 \log_2 \left( \frac{f_0}{8.1758 \text{Hz}} \right) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so when $f_0$ = 8.1758 Hz (5 octaves below middle C), the pitch is &quot;0&quot; and when $f_0$ is an octave above that, the pitch is &quot;12&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;alright, so the basic issue regarding the octave problem is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1)  given that $x(t)$ is &lt;em&gt;fully&lt;/em&gt; periodic with period $T$, that is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = x(t+T)  \quad \quad \forall t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the same is also true that $x(t)$ is periodic with period $2T$ or $3T$ or any integer multiple of $T$.  that is easy to show.  the same is &lt;em&gt;nearly&lt;/em&gt; true for quasi-periodic $x(t)$, so there are many candidates of possible periods $T$ to choose from, which one do we choose?  usually the candidate period $T$ that is smaller than all the other candidate periods is the one we choose.  in other words, A440 (A just above middle C) sounds like A440 with period $\frac{1}{440}$ second, but mathematically it is also periodic with period $\frac{2}{440}=\frac{1}{220}$ second, but we don't hear it as A220 (the A just below middle C).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2)  now here's the rub:  suppose we add &lt;em&gt;just a teeny bit&lt;/em&gt; of a 220 Hz waveform to our A440.  but this 220 Hz waveform is, say, 60 dB lower in level than the A440.  what are we going to hear and, mathematically, what is the period of this waveform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, your assignment for the day is to think about that and, maybe tomorrow i'll come back and tell you maybe one or two &quot;secrets&quot; (they belong to me, so i think i can tell them, but lacking contracting with me to develop an alg for you, i won't be too explicit) about how to deal with this, but you first have to understand the nature of the &lt;em&gt;Octave Problem&lt;/em&gt; which you get a hint of by answering for yourself the question in (2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;stay tuned.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-08-14T15:29:03.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17777" PostTypeId="1" AcceptedAnswerId="17778" CreationDate="2014-08-14T16:03:25.050" Score="-1" ViewCount="1494" Body="&lt;p&gt;I am planning to use Slepian or DPSS window in my application where I want central lobe to be concentrated and also have low bandwidth:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function#DPSS_or_Slepian_window&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Window_function#DPSS_or_Slepian_window&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since the generating function is missing and looking at some online resources was not very helpful. So, I am wondering if someone can explain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone has DPSS window code (C++, Matlab) and would be willing to share.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE (after getting answer from @jojek):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, @jojek,&#xA;I was just reading numerical recipe in C (third edition) to understand Slepian window. In their terminology, every Slepian window is defined by two indices jres and kT . Here kT indicates eigen vectors and  “jres” some sort of frequency resolution. In their terminology, I am interested in Slepian(2,0) and Slepian(3,0). (Please refer sample page no 664: &lt;a href=&quot;http://www.nr.com/nr3sample.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.nr.com/nr3sample.pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question. 1:&lt;/strong&gt; If I understand it right, your solution give me kT = 0 which is what I am also looking for. However, I am still confused about how to choose frequency cut-off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question. 2:&lt;/strong&gt; Numerical recipe in C discusses the origin of this Slepian window and I am interested in knowing where the relevant expression [1] comes from:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&quot;Copying from Numerical recipe in C&quot;&lt;/strong&gt;&#xA;There are two key ideas in multitaper methods, somewhat independent of each other, originating in the work of Slepian. &#xA;The first idea is that, for a given data length N and choice jres, one can actually solve for the best possible weights w , meaning the ones that make the leakage smallest among all possible choices. The beautiful and nonobvious answer is that the vector of optimal weights is the eigenvector corresponding to the smallest eigenvalue of the symmetric tridiagonal matrix with diagonal elements&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;¼ [N^2 –(N-1-2j)^2 cos(2 pi jres/ N) ];     j = 0, 1, …. N-1&#xA;And off-diagonal element:&#xA;-1/2 j (N-j)                                                  --------------------[1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Dushyant&lt;/p&gt;&#xA;" OwnerUserId="10820" LastEditorUserId="10820" LastEditDate="2014-08-14T19:36:14.210" LastActivityDate="2014-08-14T19:36:14.210" Title="Slepian or DPSS window" Tags="|filter-design|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17778" PostTypeId="2" ParentId="17777" CreationDate="2014-08-14T16:12:34.213" Score="5" Body="&lt;p&gt;If you follow the reference link no. &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function#cite_note-JOSKaiserDPSS-45&quot; rel=&quot;nofollow&quot;&gt;43&lt;/a&gt; from Wikipedia, then you will end up on &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Slepian_DPSS_Window.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;this website&lt;/strong&gt;&lt;/a&gt; of Stanford University. They are providing all necessary theory behind DPSS window, together with this MATLAB function (not to mention, that MATLAB already has the &lt;a href=&quot;http://www.mathworks.co.uk/help/signal/ref/dpss.html&quot; rel=&quot;nofollow&quot;&gt;dpss&lt;/a&gt; function) :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [w,A,V] = dpssw(M,Wc);&#xA;&#xA;% DPSSW - Compute Digital Prolate Spheroidal Sequence window of&#xA;%     length M, having cut-off frequency Wc in (0,pi).&#xA;&#xA;k = (1:M-1);&#xA;s = sin(Wc*k)./ k;&#xA;c0 = [Wc,s];&#xA;A = toeplitz(c0);&#xA;[V,evals] = eig(A); % Only need the principal eigenvector&#xA;[emax,imax] = max(abs(diag(evals)));&#xA;w = V(:,imax);&#xA;w = w / max(w);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-08-14T17:14:38.443" LastActivityDate="2014-08-14T17:14:38.443" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17779" PostTypeId="2" ParentId="17771" CreationDate="2014-08-14T16:32:15.423" Score="6" Body="&lt;p&gt;Regarding example 1:&lt;br&gt;&#xA;first of all, either the &lt;code&gt;fft&lt;/code&gt; or the &lt;code&gt;ifft&lt;/code&gt; needs to be normalised by the number of sampling points as you have done (actually you can normalise each by a factor of the square root of the number of points, it is just a meter of definition). However, in your case the &lt;code&gt;ifft&lt;/code&gt; is half the length of the &lt;code&gt;fft&lt;/code&gt; you performed. Hence your signal is divided by 2. If you would perform the normalisation when calling the &lt;code&gt;ifft&lt;/code&gt; (using half the original number of samples) you should get the correct height.&lt;br&gt;&#xA;Now, regrading the second part of the signal, it is not truncated. What you see is some kind of aliasing. Since you downsampled  without filtering, you get aliasing. This is the same concept as frequency aliasing (DFT and IDFT are basically the same). You should try to flip the input signal in the time domain and witness the results.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, regarding example 2:&lt;br&gt;&#xA;Your problem is with the number of sampling points. Let me start by mentioning that since your signal is real, the frequency domain is symmetric.&lt;br&gt;&#xA;In your first example you had even number of points. when you downsampled the frequency you still got a symmetric signal. In the second example you have odd number of samples. Therefore your decimated frequencies are not symmetric and the result is a complex signal. If you try it with one less (or more) sample it should give a similar result to example 1. On the other hand you can perform the frequency decimation while keeping the signal symmetric.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-08-14T16:32:15.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17780" PostTypeId="2" ParentId="17758" CreationDate="2014-08-14T20:43:49.633" Score="2" Body="&lt;p&gt;Simply pre-filtering is unlikely to help, unless there is coloring noise with a spectrum disjoint from your pitched signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any autocorrelation based pitch estimator needs to be perceptually weighted to remove additive but inaudible levels of sub-pitch correlation, which can cause sub-pitch estimation errors.  What weighting to use falls into the field of experimental human psycho-acoustics.  This weighting may also be time dependent, due to pattern matching expectations and masking effects from the immediately preceding audio.  There may be academic papers on this topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For FFT based pitch estimation of overtone rich sounds, the Harmonic Product Spectrum method looks at multiple potential overtone spacings to find a good pitch hypothesis.  One can sometimes also use the overtone spacings to reject other pitch estimate hypothesis, such as pitch multiples due to a harmonic stronger than the fundamental.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-14T21:43:37.250" LastActivityDate="2014-08-14T21:43:37.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17782" PostTypeId="2" ParentId="17674" CreationDate="2014-08-15T02:15:40.783" Score="3" Body="&lt;p&gt;Despite its age, Canny Edge Detection is still a state of the art filter. The results produced by this algorithm make for it always being included in image editing software. Solid and descriptive edges that are often overly represented by other filters. It lacks the simplicity of, say, the Boolean Edge Detection, included in the paper, &quot;Edge Detection Techniques: Evaluations and Comparisons&quot; by Ehsan Nadernejad, Sara Sharifzadeh, Hamid Hassanpour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quality of Edge Detection and Segmentation filters are difficult to appraise, and algorithm speed is usually the most important consideration when implementing them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For code and discussion, you should take your research to codeproject.com, and lookup Image Edge Detection.&lt;/p&gt;&#xA;" OwnerUserId="8777" LastActivityDate="2014-08-15T02:15:40.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17783" PostTypeId="2" ParentId="17774" CreationDate="2014-08-15T04:12:02.587" Score="5" Body="&lt;p&gt;It's the key point of array signal processing, I suppose. Say $x$ is the input vector of $[N,1]$ dimension collected from $N$ array sensors. $x(k)$ is its realization at the $k$ moment of time. By its definition covariance matrix (sometimes it's called autocorrelation matrix):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$R = E[x\cdot x^H]$ ,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where $E[]$ is expectation operator and $x^H$ is Hermitian conjugate. For the ergodic process&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$R = \lim_{M\to\infty} 1/M \cdot \displaystyle\sum_{k=0}^M x(k) \cdot [x(k)]^H$ .&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But in practice we can estimate $R$ with necessary precision with the snapshot of finite length. &lt;em&gt;In the array processing theory snapshot is a group of vectors&lt;/em&gt; $x(k)$. &lt;em&gt;It's the basic data block for array processing algorithms&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$R = 1/K \cdot \displaystyle\sum_{k=0}^K x(k) \cdot [x(k)]^H$ ,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where $K$ is the number of &lt;em&gt;spatial vectors&lt;/em&gt; or snapshot size. The interesting question is what is optimal value for $K$. In models I've done, $K$ varies from 64 to 256. The estimation precision is enough for MVDR beamformer or Capon spectral estimation. There is interesting trick for adaptive beamformer design (if you have further interest). You can reduce $K$ (and accelerate adaptation process) if you use so-called &lt;em&gt;diagonal loading&lt;/em&gt;, look:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$R = R + \sigma^2 \cdot I$,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where $\sigma$ is some variable depending on SNR (&lt;em&gt;maybe someone define it more precisely?&lt;/em&gt;) and $I$ is identity matrix of the size $[N, N]$, same size as $R$ actually. But if you want to do spectral estimation procedure by your array (DoA estimation), you shouldn't perform diagonal loading because it will rise noise floor of the estimation and some weak signals of interest will be lost. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Covariance matrix is the second order statistic of the random process which is measured at the array sensors. It contains information about the sources in space (number, strength, direction) and can be used for sources detection and separation. Actually the number of independent spatial signals at the input of array and the &lt;em&gt;rank&lt;/em&gt; of $R$ is the same. Singular values decomposition (SVD) of $R$ gives the information about signal subspace which is necessary for subspace-based DoA estimation techniques like MUSIC or ESPRIT. It is worth to say algorithms based upon covariance matrix inversion/decomposition suffers from source correlation. If the sources is highly correlated (have the same waveforms or too close direction) they can't be separated. And also the system performance degrades in highly correlated scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very good reference about the topic will be&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://books.google.ru/books/about/Detection_Estimation_and_Modulation_Theo.html?id=K5XJC_fMMAwC&amp;amp;redir_esc=y&quot; rel=&quot;nofollow&quot;&gt;Harry L. Van Trees - &lt;em&gt;Detection, Estimation, and Modulation Theory, Optimum Array Processing&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the book more general form of covariance matrix is discussed. It's shown that it can be defined either in time domain or in frequency domain. And furthermore frequency domain interpretation is more common since it allows us to solve the problem of wideband beamformer (or DoA estimation) very easy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2014-08-15T04:53:11.540" LastActivityDate="2014-08-15T04:53:11.540" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17784" PostTypeId="1" AcceptedAnswerId="17786" CreationDate="2014-08-15T06:54:27.453" Score="1" ViewCount="770" Body="&lt;p&gt;Suppose we have the following signal model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = A_1\sin(\omega_1 t+\phi_1) + A_2\sin(\omega_2 t+\phi_2) + ... + A_p\sin(\omega_p t+\phi_p) + z(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we are sampling at sampling frequency $f_\mathrm s$ we know that the sampling frequency must be at least 2 times the maximum frequency, but what about a condition for the minimum frequency (largest period)? Is there any reasonable limit below which it is useless existence of frequency? Suppose that the sampling frequency is $100\,\text{Hz}$, then the maximum frequency can be $50\,\text{Hz}$, but what about the minimum frequency?&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorUserId="1606" LastEditDate="2014-08-15T08:08:16.557" LastActivityDate="2014-08-15T08:13:53.940" Title="minimum frequency in periodic components" Tags="|discrete-signals|signal-analysis|continuous-signals|periodic|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17786" PostTypeId="2" ParentId="17784" CreationDate="2014-08-15T08:04:38.563" Score="0" Body="&lt;p&gt;No, there is no lower bound to the sampling theorem. Any signal $x(t)$ sampled at rate $f_\mathrm s$ can be reconstructed from its sampled version if it contains only spectral components lower than (1) $f_\mathrm{s}/2$. I.e. the frequencies contained in $x(t)$ are allowed to be as low as 0 Hz. Note however, that perfect reconstruction of $x(t)$ is only possible if an infinite number of samples $N$ has been drawn from $x(t)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to spectral &lt;em&gt;analysis&lt;/em&gt; of $x(t)$ using its sampled version $x_n = x(n/f_\mathrm s)$ the number of acquired samples $N$ plays an important role because it determines the frequency resolution of the DFT. In order to be still distinguishable the lowest frequency cannot be arbitrarily low. This is intuitively understandable as the lower the frequency the longer the period and thus the signal should be measured for a sufficently long time. Here is some further reading about DFT frequency resolution and spectral leakage&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/17579/number-of-fft-points-required-for-a-specific-frequency-resolution-for-an-oversam&quot;&gt;Number of FFT points required for a specific frequency resolution for an oversampled signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8604/fft-of-sine-wave-not-coming-as-expected-i-e-single-point&quot;&gt;FFT of sine wave not coming as expected i.e single point&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(1) Actually $x(t)$ must not contain a sine wave with exact frequency $f_\mathrm s$. For an interesting discussion here on dsp.se see &lt;a href=&quot;https://dsp.stackexchange.com/questions/14125/nyquist-frequency-phase-shift&quot;&gt;Nyquist Frequency Phase Shift&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-08-15T08:13:53.940" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17788" PostTypeId="1" AcceptedAnswerId="17790" CreationDate="2014-08-15T10:08:57.243" Score="5" ViewCount="4472" Body="&lt;p&gt;How is the periodogram defined? I have been searching the internet a lot, and I find two different definitions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;periodogram is the squared magnitude of the DFT&lt;/li&gt;&#xA;&lt;li&gt;periodogram is the squared average of the DFT&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;which one is correct?&lt;/p&gt;&#xA;" OwnerUserId="10826" LastActivityDate="2014-08-15T10:20:08.653" Title="Is the periodogram squared-magnitude DFT or squared-average DFT?" Tags="|fft|power-spectral-density|periodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17790" PostTypeId="2" ParentId="17788" CreationDate="2014-08-15T10:20:08.653" Score="6" Body="&lt;p&gt;The periodogram is simply the squared magnitude of the DFT. Since the periodogram is a rather poor estimate of the power density spectrum of a random process there are methods which use averaging of periodograms to obtain better estimates of the power spectrum. Two such methods are &lt;a href=&quot;http://en.wikipedia.org/wiki/Welch%27s_method&quot; rel=&quot;noreferrer&quot;&gt;Welch's method&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Bartlett%27s_method&quot; rel=&quot;noreferrer&quot;&gt;Bartlett's method&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-15T10:20:08.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17792" PostTypeId="2" ParentId="17380" CreationDate="2014-08-15T14:47:02.123" Score="0" Body="&lt;p&gt;some pointers for you to figure out the solution:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;you can convert segmentation results to CONTOURS and then plot contours, with thick boundary lines.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;first convert the image to grayscale,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x = rgb2gray(x);&lt;br&gt;&#xA;img(:,:,1) = x;&#xA;img(:,:,2) = x;&#xA;img(:,:,3) = x;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, for each cluster you can modify the color for that part of image. say for example row1, col1, keep the index for class 1:&#xA;  for i=1:size(row1,1)&#xA;        img2(row1(i), col1(i), 1) = 200;&#xA;    end&#xA;in the end show image with modified colors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;show image, then hold on, then show ONLY one cluster at a time as a region filled with a solid color, then set transparency to 50%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;two ways &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;to set transparencey: &#xA;set(h, 'AlphaData', alpha_data); % e.g. alpha_data = 0.5&#xA;or &#xA;h=imagesc(img2);&#xA;alpha(h,0.5);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10829" LastActivityDate="2014-08-15T14:47:02.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17793" PostTypeId="1" CreationDate="2014-08-15T15:54:30.727" Score="1" ViewCount="201" Body="&lt;p&gt;I am trying to implement what's called the &quot;second spectrum&quot;. Basically, you do this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take a time series of length $N$.&lt;/li&gt;&#xA;&lt;li&gt;Divide it into $m$ segment, each of length $N'=N/m$.&lt;/li&gt;&#xA;&lt;li&gt;For each segment $m$, do a Fourier Transform. The result is the 'first&#xA;spectrum',$S_i^{(1)}(f_1), i=1:m$&lt;/li&gt;&#xA;&lt;li&gt;Divide each spectrum into $n$ octaves, an octave starts at $f_L=f_0 \times 2^p$ and ends at $f_H=f_0 \times 2^{p+1}$, where $p=0,1,2, etc$, and $f_0$ is the lowest frequency in $S_i^{(1)}(f_1)$. For $f_0 = 1$ Hz, The octaves will be like: 1-2 Hz, 2-4 Hz, 4-8 Hz, 8-16 Hz, etc.&lt;/li&gt;&#xA;&lt;li&gt;For each octave in each spectrum, sum all spectrum values in that octave.&lt;/li&gt;&#xA;&lt;li&gt;Construct a time-series for each octave. There will be $n$ time series each of length $m$.&lt;/li&gt;&#xA;&lt;li&gt;Take the Fourier Transform of these time series. This is the second spectrum, $S_n^{(2)}(f_2)$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have already implemented this algorithm (in c++), but I have a question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q: in step 4, can I simply divide the spectrum signal into octaves &quot;just like that&quot;? I mean, without any kind of band-pass filtering to these octaves? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: what I mean by the &quot;just like that&quot; is as if I am passing the spectrum through a rectangular window (in freq. domain).&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="8825" LastEditDate="2014-08-15T20:47:24.937" LastActivityDate="2015-09-12T03:38:57.743" Title="Segmenting a frequency series: do we need band-pass filtering?" Tags="|power-spectral-density|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17794" PostTypeId="1" CreationDate="2014-08-15T17:39:45.853" Score="0" ViewCount="1067" Body="&lt;p&gt;Having just read the rather long article on Wikipedia about &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window functions&lt;/a&gt;, I still do not see the mathematical point in using window functions when calculating spectral estimates (using e.g. Welch's method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Fourier transform of the function cos ωt is zero, except at frequency ±ω. However, many other functions and waveforms do not have convenient closed form transforms&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;what is this supposed to mean? I doubt any sampled and digitized signal has a convenient closed form transform anymore.&lt;/p&gt;&#xA;" OwnerUserId="10830" LastActivityDate="2014-08-17T16:44:45.190" Title="Why are window functions used when calculating spectral estimates, really?" Tags="|fft|frequency-spectrum|window-functions|window|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17795" PostTypeId="1" AcceptedAnswerId="17796" CreationDate="2014-08-15T19:10:32.507" Score="0" ViewCount="108" Body="&lt;p&gt;I cant understand this when I have a system thar compress the input as follows&#xA;$$y(t)=x(2t)$$&#xA;Now to check for time invariance now I should input $x(t)$ to get&#xA;$$y_1(t) = x(2t)$$&#xA;Then I should input $x(t-t_\circ)$ to get&#xA;$$y_2(t) =x(2(t - t_\circ)) = x( 2t - 2t_\circ)$$&#xA;Now checking the output shifted we get&#xA;$$y_1(t-t_\circ) = x(2(t - t_\circ)) = x( 2t - 2t_\circ)$$&#xA;And since $y_2(t) =y_1(t-t_\circ)$ then this is time invariance though I know from my book that this last step of shifting $y_1(t)$ is not correct but I cant understand why?!!&lt;/p&gt;&#xA;" OwnerUserId="10831" LastActivityDate="2014-08-15T19:40:10.667" Title="Time Invariance" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17796" PostTypeId="2" ParentId="17795" CreationDate="2014-08-15T19:40:10.667" Score="1" Body="&lt;p&gt;If $y(t)=x(2t)$ then for time-invariance the response to the input signal $x(t-t_0)$ should be $y(t-t_0)=x(2(t-t_0))$. Let's call the new input $z(t)=x(t-t_0)$. The corresponding output is $y(t)=z(2t)=x(2t-t_0)\neq x(2(t-t_0))$, which shows that the system is indeed time-varying.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-15T19:40:10.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17797" PostTypeId="2" ParentId="17794" CreationDate="2014-08-15T20:29:59.050" Score="3" Body="&lt;p&gt;You are right that no real-world signal will have a &quot;convenient closed form&quot; transform. I also find the quoted sentence misleading, and in my opinion it does not motivate the use of windowing. From your question I believe that you do not actually ask about the pros and cons of different window functions, but if I understand you correctly you ask yourself why people cut signals into pieces anyway if they want to analyze their spectrum. The reason is that many real-world signals are simply too long and/or their length is not known. So you don't want to wait till the signal is 'complete', and you also don't want the complexity of processing such a long signal. So you do block-processing, which reduces computational complexity and gives you quickly a spectral estimate. When you cut the signal into blocks you have many parameters that will influence the result of the spectral estimate: the block length, the type of window, the overlap between blocks, etc. This is a complex topic but you'll find a lot of literature about it. If you have access to Oppenheim and Schafer's &lt;em&gt;Discrete-time Signal Processing&lt;/em&gt; I would recommend the chapter on &lt;em&gt;Fourier Analysis of Signals Using the Discrete Fourier Transform&lt;/em&gt;. It has a lot of valuable information about block processing and windowing.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-15T20:29:59.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17798" PostTypeId="2" ParentId="17711" CreationDate="2014-08-16T01:14:16.737" Score="4" Body="&lt;p&gt;If you look at the documentation of &lt;code&gt;mscohere&lt;/code&gt; which contains the definition of magnitude squared coherence, you will see that it is the absolute squared of the cross spectral density, divided by the product of the two separate spectral densities. Since power densities enter numerator &lt;em&gt;and&lt;/em&gt; denominator of the expression, the MSC estimate from a full time series is not simply the average of the estimates from the parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a good &quot;average&quot; MSC estimate, do the following: estimate in each segment separately cross and single spectral densities, average these three over the segments, and then combine them in the end into an average MSC. Continuing your code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sx1 = pwelch(x1, w, o, n);&#xA;sy1 = pwelch(y1, w, o, n);&#xA;sxy1 = cpsd(x1, y1, w, o, n);&#xA;&#xA;sx2 = pwelch(x2, w, o, n);&#xA;sy2 = pwelch(y2, w, o, n);&#xA;sxy2 = cpsd(x2, y2, w, o, n);&#xA;&#xA;sxa = (sx1 + sx2) / 2;&#xA;sya = (sy1 + sy2) / 2;&#xA;sxya = (sxy1 + sxy2) / 2;&#xA;ca = abs(sxya) .^ 2 ./ sxa ./ sya;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now &lt;code&gt;max(abs(c-ca))&lt;/code&gt; is almost zero.&lt;/p&gt;&#xA;" OwnerUserId="5834" LastActivityDate="2014-08-16T01:14:16.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17799" PostTypeId="1" AcceptedAnswerId="17800" CreationDate="2014-08-16T04:12:20.940" Score="0" ViewCount="849" Body="&lt;p&gt;In MATLAB I generated a signal and its autocorrealtion function using:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;signal = ones(1,500).*5; % a vector of the number 5&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;acf = autocorr(signal,numel(signal)-1));&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To my suprise the resulting ACF vector is all NaN. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But If i generate the signal with numbers between zero and one (0.3 in this case),&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;signal = ones(1,500).*0.3; % a vector of the number 0.3&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;acf = autocorr(signal,numel(signal)-1)); &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I get the following plot,&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UpRFh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am just confused as to what is going on here. I would think in either case the autocorrelation of the same number will produce just all '1's indicating no decay what so ever? So why do I get NaN when the signal is above 1 but a linear decaying signal when its between 0 and 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="10833" LastActivityDate="2014-08-16T08:48:29.713" Title="Autocorrelation of a signal comprised of only the same number" Tags="|discrete-signals|autocorrelation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17800" PostTypeId="2" ParentId="17799" CreationDate="2014-08-16T08:48:29.713" Score="4" Body="&lt;p&gt;What you see are mainly numerical effects, even though the second result is actually correct, but not according to what Matlab intends to compute. But let's go slow ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab computes the autocorrelation function by first subtracting the mean of the signal and then correlating it with itself. Then the autocorrelation function is normalized such that its value for lag 0 equals 1 (this is where you get the NaNs from).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens in your case is that the signal equals its mean (because it is constant), so by subtracting the mean you generate a zero signal, the autocorrelation of which is zero. Then in the normalization step you divide the zero signal by its first value (which is zero), and you get NaNs. This shouldn't happen in a well written function, so you could complain with Mathworks about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is even worse, is that this behavior is not consistent. You found some scaling values for which you actually get a reasonably looking autocorrelation function. This is really weird but I think I understand what's going on. Try the following. Look at the values of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;signal - mean(signal)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what Matlab bases its computiation on. What you'll see is that for the scaling values which give you NaNs, this difference is exactly zero (which is the correct result). For the other scaling values (which give a well-behaved autocorrelation function), this difference will be some constant in the order of $10^{-17}$. So you're again left with a constant signal, albeit it much smaller than before. The autocorrelation function of such a constant signal (without subtracting the mean, because this has already been done) is triangular, simply because it is the convolution of two rectangular functions. The normalization gets rid of the $10^{-17}$ factor and you actually get a nice looking autocorrelation of your signal. This one is even correct if you were to compute the autocorrelation without subtracting the mean of the signal (but this is not what the Matlab function intends to do!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conclusion: the first result (NaNs) is useless but at least consistent with the definition of the autocorrelation function used by Matlab (even though a division by zero should be prevented in a good program). The second result is not consistent with Matlab's definition of the autocorrelation, but it is - due to numerical errors (!) - correct when the autocorrelation is defined without first subtracting the mean of the signal. Note that both definitions are used in practice so it's always important to check what is actually meant by 'autocorrelation'.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-16T08:48:29.713" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17801" PostTypeId="1" CreationDate="2014-08-16T13:53:57.247" Score="2" ViewCount="18528" Body="&lt;p&gt;I read LTE PHY profile and do not understand the relationship between number of FFT and bandwidth. For example LTE downlink channel bandwidth 1.25MHz and 5MHz have 128 FFTs and 512 FFTs accordingly. Another example is 802.11 a bandwidth 20MHz, FFT size 52.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I design an OFDM system system at carrier frequency 910MHz, with FFT size for example 64, how much coherent bandwidth that the system need? What is the formula? What other factors should be taken into account?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add &gt;&gt; 18 Aug (I don't have enough reputaiton to add comment on Jason R reply)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I test a simple software defined radio OFDM system with parameters as FFT = 256, data carrier per symbol = 125, number of pilot = 25, bandwidth = 5MHz, carrier frequency = 910MHz, the channel estimation wouks fine. If I change bandwidth to 1MHz, then the channel estimation goes wrong. In this case I reduce sampling frequency 5 times, so carrier spacing is reduced 5 times too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the carrier spacing must be greater than a limit so that intersymbol interference (or inter-carrier interference?) is small enough to not cause channel estimation failture. How to find the carrier spacing limit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or delay spread $\tau \ll T$ where T is symbol interval may cause the problem. How to calculate the limit $\tau$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10834" LastEditorUserId="10842" LastEditDate="2014-08-18T07:59:45.390" LastActivityDate="2018-02-20T11:26:45.020" Title="How to calculate bandwidth require for OFDM" Tags="|fft|ofdm|bandwidth|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17803" PostTypeId="1" CreationDate="2014-08-16T15:10:28.853" Score="1" ViewCount="2514" Body="&lt;p&gt;I'm reading up on fourier theory, especially the transforms. I implement the math as spectrograms in C++ to get a better understanding of what is going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made an implementation of the short time discrete fourier transform which works well, however as for transforms derived from the fourier transform, they seem to be bounded by the so called uncertainty principle which basically is a tradeoff between time and frequency resolution - which in effect means, that if you want better frequency resolution, you need a larger sample size - which again means you lose time resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I always wanted a spectrum analyzer with increased resolution at lower frequencies, so that a logarithmic display of the spectrum would have equal resolution over the entire frequency range - this is obviously not the case with FFTs or short time DFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing this, I went ahead and researched constant Q transforms and wavelets (from which the constant Q should be a special case of) which promises geometric spacing and constant q of the bins compared to your standard fast fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to implement the algorithm on &lt;a href=&quot;http://en.wikipedia.org/wiki/Constant_q_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;, but i find the definitions poorly explained and similarly confusing, so it doesn't currently work. Here's my current implementation - i would appreciate if anyone could find the error(s):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;typedef std::uint_fast32_t fint_t;&#xA;&#xA;template&amp;lt;typename Scalar, class Vector&amp;gt;&#xA;    std::complex&amp;lt;Scalar&amp;gt; constantQTransform(Vector input, &#xA;        size_t size,&#xA;        fint_t kbin, &#xA;        Scalar lowestFreq, &#xA;        Scalar numFiltersPerOctave, &#xA;        Scalar sampleRate)&#xA;    {&#xA;        // &quot;spectral width&quot; per filter&#xA;        Scalar filterWidth = std::pow(2, Scalar(1.0) / numFiltersPerOctave); // r = 2 ^ (1 / n)&#xA;        filterWidth = std::pow(filterWidth, kbin) * lowestFreq; // r ^ k * fmin == fk&#xA;&#xA;        // centre frequency&#xA;        Scalar centreFrequency = std::pow(2, kbin * 1 / numFiltersPerOctave) * lowestFreq;&#xA;&#xA;        // window length for bin&#xA;        Scalar windowLength = sampleRate / filterWidth; // fs / fk == N[k]&#xA;        fint_t end = static_cast&amp;lt;fint_t&amp;gt;(std::floor(windowLength));&#xA;        const Scalar Q = centreFrequency / filterWidth;&#xA;        // bounds check&#xA;        if (end &amp;gt; size)&#xA;            return 0;&#xA;        auto hammingWindow = [&amp;amp;](fint_t n) // W[k, n]&#xA;        {&#xA;            auto const a = 25.0 / 46.0;&#xA;            return a - (1 - a) * std::cos((TAU * n) / windowLength);&#xA;        };&#xA;&#xA;        std::complex&amp;lt;Scalar&amp;gt; acc;&#xA;        Scalar real, imag, sample;&#xA;&#xA;        for (fint_t n = 0; n &amp;lt; end; ++n)&#xA;        {&#xA;            sample = input[n] * hammingWindow(n);&#xA;            real = std::cos((TAU * Q * n) / windowLength) * sample;&#xA;            imag = std::sin((TAU * Q * n) / windowLength) * sample;&#xA;            acc += std::complex&amp;lt;Scalar&amp;gt;(real, -imag);&#xA;&#xA;        }&#xA;        return acc / windowLength; // normalize&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the spectrum of this function:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/3uXUk.png&quot; alt=&quot;Spectrum of constantQ for a square wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is how it should look like, using my short time dft with logarithmic spacing:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PyM9K.png&quot; alt=&quot;Spectrum of short time dft for a square wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So obviously, something is wrong - I'm not sure what, but it 'reacts' to different frequencies, ie. the first two bubbles move accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, here's my short time (unoptimized) dft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;template&amp;lt;typename Scalar, class Vector, bool scale = false&amp;gt;&#xA;    std::complex&amp;lt;Scalar&amp;gt; fourierTransform(const Vector &amp;amp; data, &#xA;        Scalar frequency, &#xA;        Scalar sampleRate, &#xA;        size_t a, &#xA;        size_t b)&#xA;    {&#xA;        std::complex&amp;lt;Scalar&amp;gt; acc = 0;&#xA;        Scalar real = 0, imag = 0;&#xA;        //std::complex&amp;lt;Scalar&amp;gt; z = 0; &#xA;&#xA;        Scalar w = frequency * 2 * PI / sampleRate;&#xA;        double i = 1.0;&#xA;        for (int t = a; t &amp;lt; b; ++t)&#xA;        {&#xA;            // e^(-i*w*t) == cos(w*t) + -i * sin(w * t) ?&#xA;            //real = std::cos(w * t);&#xA;            //imag = -i * std::sin(w * t);&#xA;            //z = data[t] * std::complex&amp;lt;Scalar&amp;gt;(std::cos(w * t), -std::sin(w * t));&#xA;            // integrate(a, b, { f(t) * e^(-i*w*t) }) &amp;lt;- fourier transform&#xA;            acc += Scalar(data[t]) * std::complex&amp;lt;Scalar&amp;gt;(std::cos(w * t), -std::sin(w * t));&#xA;        }&#xA;        if (scale)&#xA;        {&#xA;            return acc / std::complex&amp;lt;Scalar&amp;gt;((b - a) / 2.0);&#xA;        }&#xA;        else&#xA;            return acc;&#xA;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;, if we take a look at the constant Q transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tjBsS.png&quot; alt=&quot;Constant Q transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where this is the standard short time fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mtfVu.png&quot; alt=&quot;Short time fourier transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What basically seems to happen is that it runs a simple short time dft on a windowed subset of the signal, where the subsets size is a function of the frequency being analyzed, thereby artificially generating a small bandwidth for lower frequencies and vice-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leads me to a couple of conclusions and questions, i hope you can help me with...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Given that the constant q effectively just is a dft, it is limited by the very same uncertainty principle that the fourier transform suffers from?&lt;/li&gt;&#xA;&lt;li&gt;is this the case with wavelet transforms like morlet as well?&lt;/li&gt;&#xA;&lt;li&gt;and in general, is it just completely impossible to achieve higher resolution without directly altering the sample size of the transform?&lt;/li&gt;&#xA;&lt;li&gt;Since the constant Q transform only takes a subset of the samples for higher frequencies, am i correct in assuming that for the following sample, it may very well report no high frequency content?:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/saKg0.png&quot; alt=&quot;sample&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the previous 4 questions are true, why would anyone ever want to compute the constant q transform given that it can be calculated directly, and more precise, using the short time fourier transform? The only answer i can come up with, is that you can compute it at fft speed, where your bins are geometrically spaced - instead of linearly - but still with no additional resolution.&lt;/li&gt;&#xA;&lt;li&gt;If i am correct in the previous assumptions, then don't bother helping with the constant-Q code, because i might as well use my DFT then!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks for your interest in an newbie's confused mind - i hope you can help with some of my questions.&lt;/p&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2022-04-07T08:00:25.077" Title="Implementation of the constant Q transform + property questions" Tags="|fourier-transform|software-implementation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17804" PostTypeId="1" AcceptedAnswerId="17805" CreationDate="2014-08-16T17:21:33.810" Score="0" ViewCount="99" Body="&lt;p&gt;When windowing non-overlapped segments of data stream, part of the data is being &quot;ignored&quot; at the boundaries of the segments due to the tapering of window functions (non-rectangular). Some information is lost in further processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: for a given window function, does overlapping the segments by $50 \%$ preserve $100\%$ of the data stream information ?&lt;/p&gt;&#xA;" OwnerUserId="1629" LastActivityDate="2014-08-16T19:03:51.560" Title="Overlap-windowing vs preserved information" Tags="|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17805" PostTypeId="2" ParentId="17804" CreationDate="2014-08-16T19:03:51.560" Score="1" Body="&lt;p&gt;Depending what do you mean by preserve $100\%$ of data stream information. Usually $50\%$ of overlap is enough and you are not loosing too much information. Amount of data within your observation window is definitely sufficient for further analysis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although there are some windows, such as Hanning or modified Gaussian window which that are &lt;strong&gt;complementary&lt;/strong&gt;. This allows you to perfectly reconstruct original signal from windowed segments.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-08-16T19:03:51.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17806" PostTypeId="1" AcceptedAnswerId="17830" CreationDate="2014-08-16T20:06:19.440" Score="0" ViewCount="2606" Body="&lt;p&gt;I am trying to code audio signal processing software in java.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Purpose: It will use audio signal processing library to filter out noise from the raw PCM based input (.wav) of heartbeat recording.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steps involved&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select input .wav file. &lt;/li&gt;&#xA;&lt;li&gt;Apply Low Pass filter at 33 Hz. &lt;/li&gt;&#xA;&lt;li&gt;Apply High Pass Filter at 2 Hz. &lt;/li&gt;&#xA;&lt;li&gt;Apply Amplification with Max Gain.&lt;/li&gt;&#xA;&lt;li&gt;Store back it as .wav file&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are many C++ library which will cover most of the requirement. But looking for Java for this particular project. Need input from Audio Signal Processing engineers for their input if these steps will be sufficient to able to hear the heartbeats. Also please let me know which order of filtering and which window will be most effective in this scenario.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4Yynn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input is taken from&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.lehman.edu/faculty/hoffmann/itc/techteach/audio/sound2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.lehman.edu/faculty/hoffmann/itc/techteach/audio/sound2.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10836" LastEditorUserId="10836" LastEditDate="2014-08-23T03:16:45.370" LastActivityDate="2014-08-23T03:16:45.370" Title="Audio signal processing" Tags="|audio|lowpass-filter|highpass-filter|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17807" PostTypeId="1" AcceptedAnswerId="17809" CreationDate="2014-08-16T21:43:33.963" Score="0" ViewCount="7541" Body="&lt;p&gt;lets assume following signal&#xA;$$x=a_1 \sin(2\pi f_1 t) + a_2 \sin(2\pi f_2 t).$$&#xA;This is passed through a simple single-pole filter with cut-off frequency $f_c$. How is $x$ delayed by the filter (peak of the cross-correlation)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case $a_2=0$, the time delay between the original and the filtered frequency is &#xA;$$T_1=\arctan(f_1/f_c)/(2\pi f_1).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case $a_1=0$, the time delay between the original and the filtered frequency is &#xA;$$T_2=\arctan(f_2/f_c)/(2\pi f_2).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can we calculate the time delay $T_{12}$ in the case $a_1\neq0$ and $a_2\neq0$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not the group delay: It must depend in some way on the values of $a_1$ and $a_2$, because if $a_1&amp;gt;&amp;gt;a_2$, then $T_{12}\approx T_1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any light on this would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4583" LastEditorUserId="4583" LastEditDate="2014-08-16T22:08:04.613" LastActivityDate="2014-08-17T09:06:43.890" Title="How to calculate the time delay of a signal by a first-order filter" Tags="|filters|lowpass-filter|phase|delay|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17808" PostTypeId="2" ParentId="17801" CreationDate="2014-08-16T22:04:24.790" Score="3" Body="&lt;p&gt;The channel bandwidth and FFT size alone don't provide enough information to describe the entire structure of the OFDM signal. Recall the following relationship:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Delta f = \frac{f_s}{N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\Delta f$ is the subcarrier spacing, $f_s$ is the sample rate used at the modulator input, and $N$ is the FFT size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your LTE examples, the two channel bandwidths must use the same subcarrier spacing, as it takes four times as much bandwidth to carry four times the subcarriers (512 versus 128). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 802.11a, however, the FFT size is typically 64; with a sample rate of 20 MHz, this yields a subcarrier spacing of 312.5 kHz. Of these 64 potential subcarriers, 12 of them are unused (sometimes referred to as &quot;virtual carriers&quot;). Of the remaining 52 subcarriers, 4 contain pilot tones, so only 48 subcarriers carry information at any given time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your notional OFDM system, you can choose the amount of bandwidth required by your system, as required based on your throughput requirements. Choose the sample rate that you will input to the modulator, then choose a convenient FFT size. This defines your number of subcarriers and therefore the subcarrier frequency spacing.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-08-16T22:04:24.790" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17809" PostTypeId="2" ParentId="17807" CreationDate="2014-08-16T22:22:51.970" Score="1" Body="&lt;p&gt;The answer is that the output signal for the case $a_1\neq 0$ and $a_2\neq 0$ is not simply a delayed version of the input signal anymore, as it would be if the input were just a single sinusoid. With $T_1$ and $T_2$ as given in your question, the response to the combined input signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\frac{a_1}{\sqrt{1+(f_1/f_c)^2}}\sin(2\pi f_1(t-T_1))+\frac{a_2}{\sqrt{1+(f_2/f_c)^2}}\sin(2\pi f_2(t-T_2))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which cannot be written as $x(t-T_x)$ with some unknown delay $T_x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as you suggested, you could define some 'global delay' by the first maximum of the cross-correlation between the input signal and the output signal. This cross-correlation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{xy}(\tau)=\frac{a_1^2}{2\sqrt{1+(f_1/f_c)^2}}\cos(2\pi f_1(\tau-T_1))+\\+&#xA;\frac{a_2^2}{2\sqrt{1+(f_2/f_c)^2}}\cos(2\pi f_2(\tau-T_2))\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $a_2=0$, there is obviously a maximum of $R_{xy}(\tau)$ at $\tau=T_1$. The same is true for $a_1=0$, which gives $\tau=T_2$ as the location of the maximum. However, for $a_1\neq 0$ and $a_2\neq 0$ I don't see how to compute the first maximum of (1) analytically. A numerical solution is of course possible.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-17T09:06:43.890" LastActivityDate="2014-08-17T09:06:43.890" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17811" PostTypeId="1" AcceptedAnswerId="17812" CreationDate="2014-08-17T09:28:44.837" Score="0" ViewCount="4720" Body="&lt;p&gt;I am trying to learn how to solve a bunch of digital signal problems and I have trouble understanding the solutions provided by this book I'm using. Basically, this problem asks me to determine spectrum amplitudes for half-wave rectified sine, as the title mentions. The signal looks like this: &lt;img src=&quot;https://i.stack.imgur.com/IAlIj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The development in complex (exponential) Fourier series will be given by&lt;img src=&quot;https://i.stack.imgur.com/ZpPsA.png&quot; alt=&quot;enter image description here&quot;&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What properties are used to get to this answer? I don't get from where did the &#xA;&lt;img src=&quot;https://i.stack.imgur.com/rgouF.png&quot; alt=&quot;enter image description here&quot;&gt; came from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xAPvD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was missing the red n. From that and using &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cPMKH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;solved it.&lt;/p&gt;&#xA;" OwnerUserId="10837" LastEditorUserId="10837" LastEditDate="2014-08-21T13:33:11.523" LastActivityDate="2014-08-21T13:33:11.523" Title="Determine spectrum amplitudes for half-wave rectified sine" Tags="|frequency-spectrum|fourier-series|integration|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17812" PostTypeId="2" ParentId="17811" CreationDate="2014-08-17T10:18:14.327" Score="1" Body="&lt;p&gt;You have to integrate by parts twice. Leaving out constants you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_0^{T/2}\sin(\omega_0t)e^{-jn\omega_0t}dt=-\frac{\cos(\omega_0t)}{\omega_0}e^{-jn\omega_0t}\bigg|_0^{T/2}-jn\int_0^{T/2}\cos(\omega_0t)e^{-jn\omega_0t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you again perform integration by parts on the integral on the right-hand side of the above equation you get the final result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_0^{T/2}\sin(\omega_0t)e^{-jn\omega_0t}dt=\frac{1+(-1)^n}{\omega_0}+n^2\int_0^{T/2}\sin(\omega_0t)e^{-jn\omega_0t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $I$ is the integral on the left-hand side you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I=\frac{1+(-1)^n}{\omega_0}+n^2I$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and finally&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I=\frac{1+(-1)^n}{\omega_0(1-n^2)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you have to consider the case $n=1$ separately. Also note that you could also compute the coefficients $c_n$ by direct integration using $\sin(\omega_0t)=(e^{j\omega_0t}-e^{-j\omega_0t})/2j$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-17T10:42:30.773" LastActivityDate="2014-08-17T10:42:30.773" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17813" PostTypeId="1" AcceptedAnswerId="17823" CreationDate="2014-08-17T10:45:13.010" Score="9" ViewCount="630" Body="&lt;p&gt;The human eye has 3 types of color cones: red, green and blue. Their spectral sensitivity peaks in short (S, 420–440 nm), middle (M, 530–540 nm), and long (L, 560–580 nm) wavelengths. See diagram below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vg8au.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we have the CIE standard observer. Wikipedia says it can be thought as the spectral sensitivity curves of three linear light detectors yielding the CIE tristimulus values X, Y and Z. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n91Gg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't get why the red line in the CIE standard observer color matching function also peaks at 440 nm. To be more specific: What causes the x-line in a CIE standard observer color matching function to peak at around 440nm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain me that?&lt;/p&gt;&#xA;" OwnerUserId="10838" LastActivityDate="2017-06-20T15:27:53.280" Title="The small red peak in the CIE standard observer" Tags="|image-processing|computer-vision|color|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17814" PostTypeId="1" CreationDate="2014-08-17T11:13:02.960" Score="17" ViewCount="21980" Body="&lt;p&gt;In many signal processing books, it is claimed that the DFT assumes the transformed signal to be periodic (and that this is the reason why spectral leakage for example may occur).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you look at the definition of the DFT, there is simply no that kind of assumption. However, in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia article&lt;/a&gt; about the discrete-time Fourier transform (DTFT), it is stated that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When the input data sequence $x[n]$ is $N$-periodic, Eq.2 can be computationally reduced to a discrete Fourier transform (DFT)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;So, does this assumption stems from the DTFT? &lt;/li&gt;&#xA;&lt;li&gt;Actually, when calculating the DFT, am I in fact calculating the DTFT &lt;em&gt;with the assumption&lt;/em&gt; that the signal is periodic?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10839" LastEditorUserId="128" LastEditDate="2020-02-07T06:58:13.407" LastActivityDate="2023-05-24T15:05:51.127" Title="Why Does the DFT Assume the Transformed Signal Is Periodic?" Tags="|discrete-signals|signal-analysis|fourier-transform|dft|" AnswerCount="8" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17815" PostTypeId="2" ParentId="17814" CreationDate="2014-08-17T11:33:23.310" Score="5" Body="&lt;p&gt;It comes from the definition of the time domain signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x \left[ n \right] = \sum_{k = 0}^{N - 1} X \left[ k \right] {e}^{\frac{2 \pi i n k}{N}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see by definition that &lt;span class=&quot;math-container&quot;&gt;$ x \left[ n \right] = x \left[ n + N \right] $&lt;/span&gt;.&lt;br&gt;&#xA;On the other hand the DFT reconstruct perfectly the N samples of the signal.&lt;br&gt;&#xA;Hence you can conclude it assumes a periodic continuation of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another point of view would be looking at the DFT as a Finite Discrete Fourier Series (It actually is, Have a look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_series&quot; rel=&quot;nofollow noreferrer&quot;&gt;Discrete Fourier Series - DFS&lt;/a&gt;), which of course points that the signal is periodic (Finite summation of signals with period &lt;span class=&quot;math-container&quot;&gt;$ T $&lt;/span&gt; is a signal which has a period &lt;span class=&quot;math-container&quot;&gt;$ T $&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-10-31T14:09:54.367" LastActivityDate="2019-10-31T14:09:54.367" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17816" PostTypeId="2" ParentId="17814" CreationDate="2014-08-17T13:03:01.963" Score="2" Body="&lt;p&gt;DFT is discrete. DTFT is continuous. We can get DFT from DTFT by sampling it with the pulse train of the right period, which is actually equal to multiplying it with the pulse train. Multiplication in the transform domain is equal to convolution in discrete-time domain, this implies periodicity of signal. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-08-17T13:03:01.963" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17817" PostTypeId="2" ParentId="17814" CreationDate="2014-08-17T14:24:55.023" Score="8" Body="&lt;p&gt;It's an un-necessary (and often false) assumption.  The DFT is just a basis transform of a finite vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basis vectors of the DFT just happen to be snippets of infinitely extensible periodic functions.  But there is nothing inherently periodic about the DFT input or results unless you extend the basis vectors outside the DFT aperture.  Many forms of signal analysis do not require any extension or assumptions outside the sampled window or finite data vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any &quot;leakage&quot; artifacts can also be assumed to be from a convolution of the default rectangular window with a signal that is not periodic or is of unknown periodicity or stationarity.  This makes much more sense when analyzing overlapped FFT windows, where any assumption of periodicity outside of any one DFT or FFT window can be inconsistent with the data in other windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Periodicity may make the math relating the DFT to the DTFT more tractable.  But any relationship to the DTFT may or may not be necessary when actually using an FFT for signal processing (depending on exactly which Fourier transform properties are needed for further analysis of the processing method).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-17T15:36:57.700" LastActivityDate="2014-08-17T15:36:57.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17818" PostTypeId="2" ParentId="17814" CreationDate="2014-08-17T15:29:01.417" Score="15" Body="&lt;p&gt;There are already some good answers, but I still feel like adding yet another explanation, because I consider this topic extremely important for the understanding of many aspects of digital signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all it is important to understand that the DFT does not 'assume' periodicity of the signal to be transformed. The DFT is simply applied to a finite signal of length $N$ and the corresponding DFT coefficients are defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N},\quad k=0,1,\ldots,N-1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) it is obvious that only samples of $x[n]$ in the interval $[0,N-1]$ are considered, so no periodicity is assumed. On the other hand, the coefficients $X[k]$ can be interpreted as Fourier coefficients of the periodic continuation of the signal $x[n]$. This can be seen from the inverse transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which computes $x[n]$ correctly in the interval $[0,N-1]$, but it also computes its periodic continuation outside this interval because the right-hand side of (2) is periodic with period $N$. This property is inherent in the definition of the DFT, but it need not bother us because normally we're only interested in the interval $[0,N-1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering the DTFT of $x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\sum_{n=-\infty}^{\infty}x[n]e^{-jn\omega}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can see by comparing (3) with (1), that if $x[n]$ is a &lt;em&gt;finite&lt;/em&gt; sequence in the interval $[0,N-1]$, the DFT coefficients $X[k]$ are samples of the DTFT $X(\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=X(2\pi k/N)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So one use of the DFT (but certainly not the only one) is to compute samples of the DTFT. But this only works if the signal to be analyzed is of &lt;em&gt;finite length&lt;/em&gt;. Usually this finite length signal is constructed by windowing a longer signal. And it is this windowing which causes spectral leakage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a last remark, note that the DTFT of the periodic continuation $\tilde{x}[n]$ of the finite sequence $x[n]$ can be expressed in terms of the DFT coefficients of $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{x}[n]=\sum_{k=-\infty}^{\infty}x[n-kN]\tag{5}$$&#xA;$$\tilde{X}(\omega)=\frac{2\pi}{N}\sum_{k=-\infty}^{\infty}X[k]\delta(\omega-2\pi k/N)\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; The fact that $\tilde{x}[n]$ and $\tilde{X}(\omega)$ given above are a DTFT transform pair can be shown as follows. First note that the DTFT of a discrete time impulse comb is a Dirac comb:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{k=-\infty}^{\infty}\delta[n-kN]\Longleftrightarrow\frac{2\pi}{N}\sum_{k=-\infty}^{\infty}\delta(\omega-2\pi k/N)\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sequence $\tilde{x}[n]$ can be written as the convolution of $x[n]$ with an impulse comb:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{x}[n]=x[n]\star \sum_{k=-\infty}^{\infty}\delta[n-kN]\tag{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since convolution corresponds to multiplication in the DTFT domain, the DTFT $\tilde{X}(\omega)$ of $\tilde{x}[n]$ is given by the multiplication of $X(\omega)$ with a Dirac comb:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\tilde{X}(\omega)&amp;amp;=X(\omega)\cdot\frac{2\pi}{N}\sum_{k=-\infty}^{\infty}\delta(\omega-2\pi k/N)\\&amp;amp;=\frac{2\pi}{N}\sum_{k=-\infty}^{\infty}X(2\pi k/N)\delta(\omega-2\pi k/N)\end{align}\tag{9}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining $(9)$ with $(4)$ establishes the result $(6)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-19T20:12:40.850" LastActivityDate="2016-01-19T20:12:40.850" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17820" PostTypeId="2" ParentId="17794" CreationDate="2014-08-17T16:44:45.190" Score="2" Body="&lt;p&gt;The DFT has a built-in implicit rectangular window.  You're taking a chunk of a stream of input data and transforming it.  But by just slicing it out of the input, you leave very sharp edges on it.  This gives the overall transform a rectangular shape, which after transforming gives you a sinc envelope in the frequency domain (DFT(rect) = sinc).  Sincs have very poor sidelobe characteristics (-13dB first sidelobe).  So you can get a lot of energy leaking back into your passband that you didn't want.  Windowing the data before transforming smoothes out those sharp edges and dramatically reduces the sidelobes.&lt;/p&gt;&#xA;" OwnerUserId="3382" LastActivityDate="2014-08-17T16:44:45.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17821" PostTypeId="2" ParentId="17793" CreationDate="2014-08-17T16:51:11.617" Score="1" Body="&lt;p&gt;I haven't heard of the second spectrum before, but yes, you can slice out a region in the frequency domain just like that.  This is equivalent to a maximal-length bandpass filter in the time domain and is in fact the best filter you can implement for a given FFT length.&lt;/p&gt;&#xA;" OwnerUserId="3382" LastActivityDate="2014-08-17T16:51:11.617" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17823" PostTypeId="2" ParentId="17813" CreationDate="2014-08-17T17:41:02.273" Score="8" Body="&lt;p&gt;Probably you've noticed that primarities are $\mathbf{X}$, $\mathbf{Y}$, $\mathbf{Z}$, not $\mathbf{R}$, $\mathbf{G}$, $\mathbf{B}$ (which are corresponding to the color values $R$,$G$,$B$). This is the aftermath of original work conducted by &lt;a href=&quot;http://diyhpl.us/~bryan/papers2/paperbot/2555e9178fafa24612d7f4decae7b267.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wright&lt;/a&gt; and &lt;a href=&quot;http://rsta.royalsocietypublishing.org/content/230/681-693/149&quot; rel=&quot;nofollow noreferrer&quot;&gt;Guild&lt;/a&gt; yielded the &lt;em&gt;Color Matching functions&lt;/em&gt;: $r(\lambda)$, $g(\lambda)$, and $b(\lambda)$ having a negative value of the red primarity around $522 \;\texttt{nm}$ (figure below). Everyone will agree that it is non-intuitive and somewhat confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why values of $r(\lambda)$ are negative? Well after tristimulus color matching experiments, it turned out that not every color can be created with the preset primarities ($700\; \mathtt{nm}$, $564.1\; \mathtt{nm}$, and $435.8\; \mathtt{nm}$). So for example, if you wanted to create the blue-green color of wavelength $\lambda = 490 \; \mathtt{nm}$ it cannot be done only by adding blue and green primarity alone. You also need to subtract the red one. Mathematically speaking, the color equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{C}=r\mathbf{R} + g\mathbf{G} + b\mathbf{B} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Must by modified by adding the outer mixture $-r_{out}\mathbf{R}$ to both side of the above equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{C} + r_{out}\mathbf{R} = g\mathbf{G} + b\mathbf{B} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SRRHE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is why CIE introduced new set of so-called &lt;strong&gt;virtual primarities&lt;/strong&gt;: $\mathbf{X}$, $\mathbf{Y}$, $\mathbf{Z}$. In order to obtain only positive or null values of the Color Matching Functions. That's how $2^{\circ}$ observer &lt;em&gt;Standard Color Matching Functions&lt;/em&gt; (also called CIE 1931) were created. By doing so they ensured that (amongst other assumptions):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;New SCMF's  $x(\lambda)$, $y(\lambda)$, $z(\lambda)$ have values $\ge 0$ (not like $r(\lambda)$).&lt;/li&gt;&#xA;&lt;li&gt;Are related to previous CMF's ($x$,$y$,$z$) by a appropriate transform.&lt;/li&gt;&#xA;&lt;li&gt;$\mathbf{X}$, $\mathbf{Y}$, $\mathbf{Z}$ must be independent (kind of orthogonal).&lt;/li&gt;&#xA;&lt;li&gt;Only color value $Y$ is proportional the the lightness of a colour.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Newly obtained color quantities $X$,$Y$,$Z$ are called &lt;em&gt;Standard Color Values&lt;/em&gt;. The relation between CMF's and SCMF's is given by a following linear transform:&#xA;$$&#xA;\left( \begin{array}{c}&#xA;x(\lambda) \\&#xA;y(\lambda) \\&#xA;z(\lambda) \\ &#xA;\end{array} \right)&#xA;=&#xA;\left( \begin{array}{ccc}&#xA;2.7689 &amp;amp; 1.7517 &amp;amp; 1.1302 \\&#xA;1 &amp;amp; 4.5907 &amp;amp; 0.0601 \\&#xA;0 &amp;amp; 0.0565 &amp;amp; 5.5943 &#xA;\end{array} \right)&#xA;\cdot&#xA;\left( \begin{array}{c}&#xA;r(\lambda) \\&#xA;g(\lambda) \\&#xA;b(\lambda) \\ &#xA;\end{array} \right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After over a three decades people from CIE had realised that $2^{\circ}$ observation angle might not be enough for adequate color assessment. That's why in 1946 they introduced the $10^{\circ}$ observer, also known as CIE 1964 observer. Latter is recommended for visual angles above $4^{\circ}$, whereas CIE 1931 should be used for any angle below that. Of course there is no sudden change in perception of colour at $4^{\circ}$, this number is just arbitrary. Comparison of these two standards is depicted of a following plot, on which you can see the 'bump' mentioned by you for the $x(\lambda)$ standard color value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lio6t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2017-06-20T15:27:53.280" LastActivityDate="2017-06-20T15:27:53.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17824" PostTypeId="1" AcceptedAnswerId="17826" CreationDate="2014-08-17T20:30:20.993" Score="-1" ViewCount="1868" Body="&lt;p&gt;I have the following signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hMpHj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this as the solution to the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;X(j\omega) &amp;amp;= \int_{-\infty}^{+\infty}x(t)e^{-j\omega t}dt \\&#xA;&amp;amp;= \int_0^\tau \frac{E}{\tau}t\; e^{-j\omega t}dt + \int_\tau^T E \; e^{-j\omega t}dt \\&#xA;&amp;amp;= \frac{jE}{\omega}\left[e^{-j\omega T}-e^{\dfrac{-j\omega \tau}{2}} \mathrm{sinc} \frac{\omega \tau}{2} \right]&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did the following, but it doesn't seem I'm getting near to their result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;\frac{E}{\tau}&amp;amp; \left[\left.-jt\omega\,e^{-j\omega t} \; \right|_0^\tau-\int_0^\tau e^{-j\omega t}dt + \int_\tau^T e^{-j\omega t}dt \right]\\&#xA;&amp;amp;=\frac{E}{\tau} -j\omega\tau e^{-j\omega t}-\left.\dfrac{e^{-j\omega t}}{-j\omega} \right|_0^\tau + E\left.\dfrac{e^{-j\omega t}}{-j\omega}\right|_\tau^T \\&#xA;&amp;amp;=-j\omega E e^{-j\omega t}+ \dfrac{e^{-j\omega t}}{j\omega}-\dfrac{E}{j\omega t}+E\dfrac{e^{-j\omega T}}{-j\omega}-E\dfrac{e^{-j\omega \tau}}{-j\omega}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Could've bet my life that integration by parts formula looked like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\require{cancel}\cancel{\int u(x)v(x)dx = u(x)v'(x) - \int u'(x)v(x)dx} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would've never guessed I would forget something like this. I saw that I'm prone to integrate instead of derive when applying the formula I thought I knew, but I thought it's just the time that passed since I did integrals. I mean I was doing like above or something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int f(x)g(x)dx = F(x)g(x)-\int f(x)g'(x)dx$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please pardon my mistake. Greetings!&lt;/p&gt;&#xA;" OwnerUserId="10837" LastEditorUserId="8202" LastEditDate="2014-08-27T10:25:01.803" LastActivityDate="2014-08-27T10:25:01.803" Title="How to compute the Fourier Transform of this ramp-like signal?" Tags="|fourier-transform|theory|integration|" AnswerCount="2" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17825" PostTypeId="2" ParentId="17824" CreationDate="2014-08-17T22:20:10.207" Score="3" Body="&lt;p&gt;&lt;strong&gt;Hint:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your integration by parts is wrong. The second integral looks OK. The first integral should be solved like this (leaving out constant factors):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_0^{\tau}te^{-j\omega t}dt=\frac{te^{-j\omega t}}{-j\omega}\bigg|_0^{\tau}+\frac{1}{j\omega}\int_0^{\tau}e^{-j\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure you can take it from here.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-17T22:20:10.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17826" PostTypeId="2" ParentId="17824" CreationDate="2014-08-17T23:05:07.470" Score="1" Body="&lt;p&gt;\begin{align*}&#xA;X\left(j\omega \right) &amp;amp;= \int_0^{\tau}\frac{E}{\tau}\cdot t \cdot e^{-j\omega t}dt + \int_{\tau}^T E\cdot e^{-j\omega t}dt\\&#xA;&amp;amp;=\frac{E}{\tau} \left[ \frac{-t}{j\omega} e^{-j\omega t}\right]_0^{\tau} - \frac{E}{\tau}\int_0^{\tau}\left( \frac{-1}{j\omega}e^{-j\omega t}\right)dt + E \left[ \frac{e^{-j\omega t}}{-j\omega} \right]_{\tau}^T\\&#xA;&amp;amp;=\frac{jE}{\omega}e^{-j\omega \tau} + \frac{E}{\omega^2 \tau}\left( e^{-j\omega \tau} - 1\right) + \frac{jE}{\omega}\left( e^{-j\omega T} - e^{-j\omega \tau}\right)\\&#xA;&amp;amp;=\frac{jE}{\omega}\left[ e^{-j\omega T}  + e^{-j\frac{\omega \tau}{2}}\left(\frac{e^{-j\frac{\omega \tau}{2}} - e^{j\frac{\omega \tau}{2}}}{2j\frac{\omega\tau}{2}}\right)\right]\\&#xA;\Rightarrow X\left(j\omega \right) &amp;amp;= \frac{jE}{\omega} \left(e^{-j\omega T} - e^{-j\frac{\omega \tau}{2}} \text{sinc}\left( \frac{\omega \tau}{2}\right) \right)&#xA;\end{align*} &lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2014-08-18T09:16:48.037" LastActivityDate="2014-08-18T09:16:48.037" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17828" PostTypeId="1" AcceptedAnswerId="17831" CreationDate="2014-08-18T08:24:13.920" Score="0" ViewCount="950" Body="&lt;p&gt;Excuse my silly question, but i really want to know does changing the sampling rate affects the energy (bandwidth) of a signal? therefore improves cross correlation output?&lt;/p&gt;&#xA;" OwnerUserId="10716" LastActivityDate="2019-11-21T17:12:23.293" Title="relationship between energy and sampling rate" Tags="|audio|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17829" PostTypeId="1" AcceptedAnswerId="17832" CreationDate="2014-08-18T08:40:28.037" Score="0" ViewCount="1971" Body="&lt;p&gt;I am studying the mel-frequency cepstral coefficient&#xA; (MFCC) and have downloaded a pdf which is related to MFCC from this link. It is about the &quot;ETSI ES 201 108&quot; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.etsi.org/deliver/etsi_es/201100_201199/201108/01.01.02_60/es_201108v010102p.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;ETSI ES 201 108 - Speech Processing, Transmission and Quality&#xA;  aspects (STQ); Distributed speech recognition; Front-end feature&#xA;  extraction algorithm; Compression&#xA;  algorithms&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am curious about the 4.2.5 Energy Measure&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6ktJ0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can they calculate a floor that makes sure that the result is not less than -50? I don't know the reason why the result is not less than -50. Would you know why and explain for me?&lt;/p&gt;&#xA;" OwnerUserId="10537" LastEditorUserId="1606" LastEditDate="2014-08-25T07:16:41.500" LastActivityDate="2014-08-25T07:16:41.500" Title="The logarithm Energy measure in Speech" Tags="|speech-recognition|speech-processing|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17830" PostTypeId="2" ParentId="17806" CreationDate="2014-08-18T08:44:30.513" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;Your low pass should be higher - probably 40 or so.&lt;/li&gt;&#xA;&lt;li&gt;Your high pass can be higher - around thirty&lt;/li&gt;&#xA;&lt;li&gt;Your gain should be variable else you will amplify it into distortion - what you want is called normalisation.  You will need to find the maximum volume of your signal and calculate a scaling factor that will bring this up to full scale.  (Say full scale is 1.0 and your maximum value is 0.01 then multiply all samples by 100.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;When I experiment with heart sounds, I find the beat itself to be around 34Hz - I usually do a band pass from 30 to 40 in order to isolate just the beat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do this, you will have a clean recording of ONLY the heartbeat.  If all you want is to count heartbeats or listen to them you will be fine.  If you need to listen for heart defects or other things, then you will need to change the parameters.  You will need higher frequencies and a wider bandwidth for those types of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other thing you need to consider:  30 to 40 Hz doesn't really come through headphones and ears all that well.  Even when you isolate the hearbeat and amplify it to full scale, it is still hard to hear.  Earphones will attenuate it some, and your ears even more so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to actually doing the filtering:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You can use IIR filters at higher orders to isolate the heart sounds.  Avoid using chebyshev filters, though.  The &quot;ring&quot; badly and can make one beat &quot;smear&quot; into the next.&lt;/li&gt;&#xA;&lt;li&gt;If you use an FIR, you may want to downsample first.  It depends on your sampling rate.  If your sampling rate is high (say the typical 44100) then an FIR than can bandpass something around 30Hz will have to be VERY long.  If you downsample to 1000 Hz, then shorter filters can be used.  You could get away with maybe 100 taps at 1000Hz.  Downsampling consists of doing a low pass filter to remove everything above half of your new sampling rate, then &quot;throwing away&quot; a lot of your samples - downsampling by two would throw away every second sample, downsampling by 4 keeps one out of four samples.  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;When I do audio in Java, I usually import libpd, and use pd to develop the actually processing stuff.  Then the same pd &quot;patch&quot; can be used with libpd in the java programm.&#xA;&lt;a href=&quot;http://puredata.info/&quot; rel=&quot;nofollow&quot;&gt;pd&lt;/a&gt;  &lt;a href=&quot;http://libpd.cc/get-it/&quot; rel=&quot;nofollow&quot;&gt;libpd&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The order in which you apply the filters (for your  bandpass) shouldn't matter.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-08-18T09:59:33.847" LastActivityDate="2014-08-18T09:59:33.847" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17831" PostTypeId="2" ParentId="17828" CreationDate="2014-08-18T08:59:10.720" Score="1" Body="&lt;p&gt;You must observe the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow&quot;&gt;nyquist frequency&lt;/a&gt; when sampling a signal. &#xA;In order to sample a signal without introducing artifacts, you must first filter out everything in the signal that has a frequency higher than half of your sampling rate.  If you sample a 1000Hz, then you must first filter out everything above 500Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, changing the sampling rate can change the bandwidth of digital representation of the signal.  A lower sampling rate means a smaller bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will only improve crosscorrelation if the noise is all high frequency stuff, and the signal you are trying to detect is in the lower frequencies.  You could get the same effect, however, by using a low pass filter  on the sampled data.  That would also remove the high frequencies and make the correlation clearer.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-08-18T09:04:28.100" LastActivityDate="2014-08-18T09:04:28.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17832" PostTypeId="2" ParentId="17829" CreationDate="2014-08-18T09:10:19.703" Score="2" Body="&lt;p&gt;You compute the energy (before the log operation) as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\max\left\{\sum_i s^2(i),\epsilon\right\}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with some small constant $\epsilon$ (they suggest $\epsilon=2e-22$ which gives $\ln\epsilon\approx -50$) to prevent the energy to become too small. The reason for this is that the logarithm of zero is $-\infty$ and gives you numerical trouble. So you always want to take the logarithm of a strictly positive number, never of zero. As far as I understand, the choice of $\epsilon=2e-22$ corresponding to a log value of $-50$ is rather arbitrary.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-18T09:10:19.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17833" PostTypeId="2" ParentId="10531" CreationDate="2014-08-18T09:49:57.610" Score="1" Body="&lt;p&gt;In the course of the year since I asked this question, I found a very easy to implement algorithm that does not rely on the very complicated equivalence table that I used to in this question. I put it in Wikipedia under the title: &lt;a href=&quot;https://en.wikipedia.org/wiki/Connected-component_labeling#One_component_at_a_time&quot; rel=&quot;nofollow&quot;&gt;one component at a time method&lt;/a&gt; so it can have a more general audience.&lt;/p&gt;&#xA;" OwnerUserId="5290" LastEditorUserId="5290" LastEditDate="2014-08-22T04:46:45.243" LastActivityDate="2014-08-22T04:46:45.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17834" PostTypeId="1" CreationDate="2014-08-18T10:09:06.513" Score="3" ViewCount="2212" Body="&lt;p&gt;I have a digitally sampled signal(sampling frequency = 4000 Hz) which contains analog frequencies from 0 to 1000 Hz.&#xA;I wish to have a frequency resolution of 100 Hz(like 0,100,200,300 Hz .. 1000 Hz) and I have to improve the frequency resolution at the 0 to 100 Hz range by 10 Hz. That is at the frequencies 0,10,20,30,... 100.&#xA;So the frequency components I wish to detect are [0,10,20,...,100,200,300,...,1000].&#xA;In other words, I want more frequency resolution at the 0-100Hz range and less resolution at 100-1000Hz range.&#xA;How this is possible through FFT or related methods.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastActivityDate="2020-04-14T23:22:25.767" Title="Selectively improve the frequency resolution of FFT (DFT)" Tags="|fft|resolution|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17835" PostTypeId="1" AcceptedAnswerId="17837" CreationDate="2014-08-18T10:32:15.273" Score="0" ViewCount="2914" Body="&lt;p&gt;Can anybody explain the meaning of Doppler tolerance for the waveforms(Linear frequency modulated, Barker code, Polyphase codes) used for Pulse compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Doppler frequency shift $f_{d}$ due to a moving target of velocity $v_{r}$ is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{d} = 2*v_{r}/\lambda$ where $\lambda$ is the wavelength of the transmitted signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Polyphase codes are known to be having high Doppler tolerance compared to LFM waveforms.&#xA;Can anybody explain this fact in simple terms.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="8202" LastEditDate="2014-08-18T11:04:55.153" LastActivityDate="2014-08-18T11:15:04.033" Title="What is doppler tolerance" Tags="|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17836" PostTypeId="2" ParentId="17834" CreationDate="2014-08-18T10:58:26.333" Score="0" Body="&lt;p&gt;The frequency resolution of the FFT is Fs/N where N is the FFT size. The FFT gives you a uniform resolution at all frequencies. Therefore, you require N &gt;= 400 points to get 10 Hz resolution.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-08-18T10:58:26.333" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17837" PostTypeId="2" ParentId="17835" CreationDate="2014-08-18T11:15:04.033" Score="3" Body="&lt;p&gt;In pulse radars you perform matched filtering in receiver where you compute cross-correlation of the received waveform and reference one. Due to Doppler shift matched filter performance  will decrease. It's like decreasing of correlation function with increasing of time delay between waveforms. Doppler tolerance defines the maximum available Doppler shift for given waveform such that you can still achieve correlation peak bigger than some threshold (SNR is assumed high enough to produce such a correlation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is fundamental property of all waveforms used in Radar (and other apps): ambiguity function. Look &lt;a href=&quot;https://en.wikipedia.org/wiki/Ambiguity_function&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Ambiguity_function&lt;/a&gt;. In a few words this function determines how correlation between 2 identical waveforms changes with time delay and also with doppler shift. Some waveforms have very narrow ambiguity function, while others - more spreading. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example maximum length sequences have narrow AF both in time and frequency shifts. LFM has slightly wide AF especially in frequency shift. They are actually very tolerable to Doppler shift. COZAC sequences (used in LTE) have narrow AF in time axe but wide in frequency one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you are choosing waveform for your application you should refer to its AF at first.   &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-08-18T11:15:04.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17838" PostTypeId="1" CreationDate="2014-08-18T11:55:53.097" Score="4" ViewCount="595" Body="&lt;p&gt;I am quite new to the idea of equalization. I have a few queries regarding the same.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In my application I require to equalize a channel whose impulse response is an IIR response. Is it possible to design an adaptive equalizer based on LMS algorithm to equalize it? I tried some MATLAB simulations and it worked well (the estimation error reduced with each step and converged) for FIR channels but not for IIR responses. So is there any restrictions on the channel characteristics (like FIR/IIR response) for the adaptive filter to function properly?&lt;/li&gt;&#xA;&lt;li&gt;Also, from my simulations for FIR channels I observed that, in absence of noise, the adaptive filter after converging had a response that is inverse of the channel response which is the same as that of a Zero-Forcing equalizer. So is it always true that, LMS adaptive filter will tend to a Zero-forcing equalizing filter in the absence of noise? If yes, can someone refer me to the proof of this?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have another doubt. Say I am measuring the channel output in presence of an additive zero mean noise,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=X(z)H_c(z)+N(z),$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $H_c(z)$ is the channel response, I still would like the equalizer to estimate the inverse response of the channel. I thought this should work, as if I try to derive the Weiner-Hopf filter, in presence of noise, I end up getting  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{dx}(k) - R_xW -E\left[n(l)x^{*}(n-l]\right],$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $R_{dx}$ is the cross correlation between the desired signal $d(n)$ and the filter output $x(n)$, and $R_x$ is the auto-correlation matrix, and $W$ is the filter weights. Since the noise is independent of $x$ and has zero mean, $E\left[n(l)x^{*}(n-l)\right]$ becomes 0 and I again get the same equation. So I thought that the same algorithm could potentially work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also in the LMS algorithm, instead of using $E\left[e(n)x^{*}(n)\right]$, directly as $e(n)x^{*}(n)$, I tried to take an $L$ point average of the product, with the intention that, since the error $e(n)$ will consist components both due to ISI as well as the additive noise, averaging it will remove the additive noise and retain the ISI, and so the filter coefficients will converge to give the inverse response of the channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But MATLAB simulations do not agree with my argument above. I want to know the mistake in my argument and also I would like to know if there is any means by which I could still estimate the inverse response of the channel to a good approximation even in presence of a zero mean noise.&lt;/p&gt;&#xA;" OwnerUserId="10845" LastEditorUserId="1629" LastEditDate="2016-03-26T16:51:25.937" LastActivityDate="2016-03-26T16:51:25.937" Title="Adaptive equalizer for IIR channel?" Tags="|adaptive-filters|adaptive-algorithms|equalizer|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17839" PostTypeId="1" CreationDate="2014-08-18T12:03:56.293" Score="0" ViewCount="59" Body="&lt;p&gt;I have a stereo sound for Inter  aural time difference consisting of sine wave(16 samples as 16 bit PCM Data) for left and right audio. From time to time I would like to advance either the left or right audio so that sound in one ear comes earlier than the other. If I just put another sine wave of different frequency in between my normal sine samples to give an illusion of changing sound in one ear, I hear a click. I am playing a buffer of 1024 samples at a time containing looped sine wave samples. If I drop one sample it generates a click as well. Can someone suggest a way of speeding up the Sine wave without generating a click. &#xA;e.g loop the sine wave separately for both ears. Now advance the sine wave in one ear so that it feels like a frequency change and then play the normal sound again in both ears. I have fixed sine samples with me. (I work in java so can't do any heavy computations). I have tried to clarify but the question could still be confusing. Ask for specific details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10844" LastActivityDate="2014-08-18T19:10:27.320" Title="Inter aural time difference generation using sine waves" Tags="|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17840" PostTypeId="2" ParentId="17838" CreationDate="2014-08-18T12:48:28.177" Score="6" Body="&lt;p&gt;Note that the inverse of an FIR system is IIR, and the same is true for the inverse of an IIR system, unless it is an all-pole system, the inverse of which would be FIR. So in most cases the ideal equalizer should have an infinitely long impulse response in order to perfectly invert the channel. In practice almost all adaptive equalizers are FIR filters which can only partly compensate for the channel response. This is why I think that there should be no reason for your equalizer to perform worse for IIR channels than for FIR channels. You could post some more information about the channel responses and the convergence of your equalizer to make it easier to see what's going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the zero forcing criterion, such criteria for designing an equalizer only make sense for noisy channels, because otherwise there is no trade-off between equalizing the channel response and noise enhancement. Zero-forcing and MSE criteria result in the same equalizer in the absence of noise. If you have no noise, the only problem is the (hopefully linear) distortion of the channel and naturally this is the only thing the equalizer would compensate for. However, with an FIR equalizer exact zero-forcing is usually impossible as discussed above.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-18T13:02:31.700" LastActivityDate="2014-08-18T13:02:31.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17841" PostTypeId="2" ParentId="17834" CreationDate="2014-08-18T14:53:24.377" Score="2" Body="&lt;p&gt;You can compute any single FFT result bin using a complex Goertzel  algorithm or filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Realize however that if you want to compute a number of bins on the order of log N or greater (such as 10 extra bins with 10 Hz bandwidth and spacing), it may be faster to do the full longer FFT and throw away all the extra FFT result bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So just compute 2 FFTs of 2 different lengths and ignore all the unwanted results.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-19T06:15:59.033" LastActivityDate="2014-08-19T06:15:59.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17842" PostTypeId="1" CreationDate="2014-08-18T16:14:17.350" Score="1" ViewCount="1730" Body="&lt;p&gt;in mixed (digital and analogue application) where you have to convert a signal from continuous to digital time domain and then back again to continuous time an anti-aliasing LPF is needed and in general also a LP reconstruction filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there some applications (if so what are) in which the reconstruction filter is not needed or not strictly necessary?&lt;/p&gt;&#xA;" OwnerUserId="10622" LastEditorUserId="10622" LastEditDate="2014-08-18T16:35:40.250" LastActivityDate="2014-08-19T08:19:21.200" Title="Are reconstruction filter always needed?" Tags="|filters|reconstruction|" AnswerCount="3" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17843" PostTypeId="2" ParentId="17758" CreationDate="2014-08-18T16:25:21.860" Score="2" Body="&lt;p&gt;okay, this is answer &lt;em&gt;Part 2&lt;/em&gt;.  doing it as a separate answer because, as soon as there are LaTeX equations put in, the simultaneous rendering and typing get very slow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so my questions (1) and (2) were meant to lead you to make a couple of basic conclusions that can help in understanding the source of the &lt;em&gt;Octave Problem&lt;/em&gt; and, with such understanding, maybe craft code that can avoid &lt;em&gt;some&lt;/em&gt; (maybe not all) of the octave errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;about (1), the issue is, &lt;strong&gt;we&lt;/strong&gt; hear stuff with our ears and brain (and as such we hear a &quot;pitch&quot; of a tone that is most often associated with the fundamental frequency $f_0$) but the &lt;em&gt;Pitch Detection Algorithm&lt;/em&gt; (PDA) is not hearing anything but is doing math and making logical decision that it is programmed to do.  so, &lt;strong&gt;&lt;em&gt;mathematically&lt;/em&gt;&lt;/strong&gt;, if a tone is judged to be periodic with fundamental frequency of 440 Hz, it is just as well a tone of 220 Hz or 146.67 Hz or 110 Hz or 88 Hz or 55 Hz.  it is actually just as periodic with those fundamentals (and the periods associated with those fundamentals) as it is at 440 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so then, how do we choose which one.  since these are all periods that are integer multiples of the same &lt;em&gt;root&lt;/em&gt; period (1/440 second), we &lt;strong&gt;normally&lt;/strong&gt; choose the smallest such period that satisfies the conditions of periodicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so then, what's the problem?  seems like we have a well-defined rule: &quot;choose the &lt;strong&gt;smallest&lt;/strong&gt; value of $T$ that satisfies $x(t) \approx x(t+T)$.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;problem 1: satisfying $x(t) \approx x(t+T)$ is the same as satisfying $x(t) - x(t+T) \approx 0$.  how do you determine that?  because this difference can be either positive or negative, then, to be consistent we try to pick $T$ to minimize something like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Q(T) \triangleq \int_{-\infty}^{+\infty} |x(t)-x(t+T)|^p w(t-t_0) \ dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w(t-t_0)$ is a window function centered at $t_0$ (the portion of the tone of current interest) and $p$ is some power.  if $p=1$, then we have the &lt;em&gt;Average Magnitude Difference Function&lt;/em&gt; (AMDF) and if $p=2$, we have the &lt;em&gt;Average Squared Difference Function&lt;/em&gt; (ASDF), which i prefer for a number of nice mathematical reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so when we say &quot;$x(t) \approx x(t+T)$&quot;, we are also saying &quot;$Q(T)$ is small&quot;.  how small?  and how small is necessary to say that $T$ is a potential period?  &lt;strong&gt;that&lt;/strong&gt; is a &lt;em&gt;&quot;thresholding problem&quot;&lt;/em&gt; (the bane of many a DSP algorithm because of the ungraceful failures that occur when the threshold is not met).  now, the way we sometimes get around threshold problems is to use a reasonably loose and inclusive threshold and get &lt;strong&gt;lots&lt;/strong&gt; of pitch candidates (of which only one is the candidate you will ultimately choose).  two criteria to pick one candidate over another is (a) which candidate has the shortest period (so we pick $T$ over $2T$) and (b) which candidate has the lowest $Q(T)$?  but these two criteria do not always agree.  so then which candidate do you choose?  &lt;strong&gt;&lt;em&gt;that&lt;/em&gt;&lt;/strong&gt; is what IP, patents, and trade secrets are made of so i will go no further with that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;problem 2: this has to do with question (2) of the previous answer.  Adamski, you almost got it right, but i would say that &lt;em&gt;&quot;but with a very slightly deeper tone&quot;&lt;/em&gt; is off-the-mark.  what if the 220 Hz added to the 440 Hz is 80 dB down (instead of 60 dB as i originally posed the question)?  no one would hear &lt;strong&gt;any&lt;/strong&gt; difference at all.  &lt;strong&gt;&lt;em&gt;yet&lt;/em&gt;&lt;/strong&gt;, mathematically, it is a periodic function with period 1/220 second and not quite one of period 1/440 second.  if you &lt;strong&gt;always&lt;/strong&gt; choose the mathematically truest and bestest period, a little bit of inaudible sub-harmonic will screw you.  so, somehow, you need to bias or prefer period candidates that are shorter over the longer periods that &lt;strong&gt;may&lt;/strong&gt; fit better, mathematically.  how to do that is also stuff that secret sauce is made of, so i am going no further with that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;problem 3: jitter or jumping around in pitch selection.  usually, when you hear an octave error, it isn't that the pitch of whole note was judged to be an octave off (high or low) but that, while most of the note had the correct pitch assigned, as the note evolves in time (with changing timbre), some small snippet of that note jumps up or down an octave and, if that drives a synthesizer, will sound quite annoying.  so, somehow, you need to put in a little hysteresis and make the pitch you select at earlier times be a little &lt;em&gt;&quot;sticky&quot;&lt;/em&gt; and preferred, so that when there is suddenly a &lt;em&gt;single&lt;/em&gt; frame that concludes that another candidate an octave high or low is the pitch, you can stick with the pitch you already have chosen for earlier frames.  a clean way of doing that is &lt;em&gt;also&lt;/em&gt; stuff of which commercial solutions are made, so i won't tell you exactly how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, even though i didn't spell out a solution (i will if you pay me), i have hopefully pointed you in the right direction for you to figure it out with a little creative thinking.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-08-18T17:06:23.673" LastActivityDate="2014-08-18T17:06:23.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17844" PostTypeId="2" ParentId="17842" CreationDate="2014-08-18T17:26:41.523" Score="-1" Body="&lt;p&gt;No it not always needed.&lt;br&gt;&#xA;For example in sound application that some weird sound is acceptable (not intended at DSP level).&lt;br&gt;&#xA;Lets say I make up some sound using 8-bit microcontroller (without dedicated DSP module or DAC). I can just use R-2R Ladder to generate analog output from normal digital output pin. The output will not smooth at all but it is acceptable (It's art).&lt;br&gt;&#xA;Depend on application requirement sometimes you may not need it.&lt;/p&gt;&#xA;" OwnerUserId="10849" LastActivityDate="2014-08-18T17:26:41.523" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17845" PostTypeId="2" ParentId="17814" CreationDate="2014-08-18T17:53:49.240" Score="1" Body="&lt;p&gt;Only DFT is practical in discrete digital world because of periodic assumption on both domains. (If you call it like that.)&#xA;Because non periodic signal on one domain cause continuous signal on the other and you can only store discrete signal in digital memory. So you need to assume the signals are periodic on both domains to make it discrete on both domains.&lt;br&gt;&#xA;&lt;br&gt;&#xA;When you calculate DTFT you get continuous signal in frequency domain as the output.&lt;br&gt;&#xA;I don't think you will use the same procedure when you calculate DFT in practical. When you actually calculated both DTFT and DFT you will understand that both transform calculation are different stories.&lt;/p&gt;&#xA;" OwnerUserId="10849" LastActivityDate="2014-08-18T17:53:49.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17846" PostTypeId="1" CreationDate="2014-08-18T18:13:56.360" Score="2" ViewCount="3179" Body="&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; I have a photo of an object (a manufactured part like the attached photo below), using my Andoird phone camera I want to verify if the object in camera preview matches to the template or not. (in other words, is it the same part as the template or not)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I can make the user to move the camera in order to have similar view of the template in camera preview as the template however there will be different noise level and/or lighting and maybe different background.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;  What do you recommend me to use for solving this problem? I was thinking of Canny edge extraction and then matching the camera frames towards the canny edge extract from template? is this a good idea? if yes would you please tell me how can I implement this? any resources? samples? (I can do the Canny edge extraction but couldn't find a way to do the matching)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if Not a good idea then what do you recommend? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Things I have tried:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Feature Extract and Matching: I used few different extractor and matcher implementations from OpenCV and my app is working and drawing the detected feature points and matches, etc. however being a beginner with image processing I cannot make sense of the result and also how to know what is a match. any idea, help, good resources?&lt;/li&gt;&#xA;&lt;li&gt;Template Matching: I used OpenCV template matching however the performance was horrible and I decided that this cannot be the solution.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AnJhz.jpg&quot; alt=&quot;sample template photo&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10846" LastActivityDate="2014-08-27T11:47:25.090" Title="Template matching or object recognition?" Tags="|image-processing|opencv|object-recognition|template-matching|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17847" PostTypeId="2" ParentId="17846" CreationDate="2014-08-18T18:47:30.963" Score="2" Body="&lt;p&gt;That's hard. I'm not even sure I can do this myself before I actually try.&#xA;It is definitely not something that can be described in a DSP.SE answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About canny edge even if it is precise you will just get an image like a line drawing as an output. The point is what's next. There are many things to try the are many theory about pattern matching from the edge but it not that easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will try something easier before going that path for example I will try to locate coordination and radius of those circles. (nuts, holes, etc) And see if I can identify the part using just those info. Then I'm going for the straight lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that I know just an overview of theories in this field and not generally do image processing but you can try what I suggested using OpenCV for sure.&lt;/p&gt;&#xA;" OwnerUserId="10849" LastActivityDate="2014-08-18T18:47:30.963" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17848" PostTypeId="2" ParentId="17839" CreationDate="2014-08-18T19:10:27.320" Score="-1" Body="&lt;p&gt;I understand the point.&lt;br&gt;&#xA;If you are outputting signal[i] you cant jump to signal[i+n] instantaneously.&#xA;You should just fade it to the new point with some window function. Allow some period of fading time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: If I currently output signal[i] and I want to shift it to signal[i+n] in 1 second. I will use half of Hann window to fade it in and out. So I time scaling Hann from pi to 1 second.&#xA;and output $signal[i+n]*Hann[i]+signal[i]*(1-Hann[i])$ for 1 second before I switch to signal[i+n] at full scale. This should not generate a click.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may want to try other window function or different fading period.&lt;/p&gt;&#xA;" OwnerUserId="10849" LastActivityDate="2014-08-18T19:10:27.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17849" PostTypeId="2" ParentId="17842" CreationDate="2014-08-18T19:24:46.877" Score="1" Body="&lt;p&gt;If the system naturally has only a low enough frequency response (say a very heavy object relative to the forces involved), and the noise tolerance is high enough, then the effects of any aliasing, due to the lack of any additional low-pass and anti-aliasing filtering, may already be rolled-off below your desired or required noise floor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-19T06:15:17.487" LastActivityDate="2014-08-19T06:15:17.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17850" PostTypeId="1" AcceptedAnswerId="17886" CreationDate="2014-08-18T20:26:28.163" Score="-1" ViewCount="1976" Body="&lt;p&gt;I am trying to combine two sets of data together, each of them having different sampling rates. For example if I sampled a 100 Hz sin wave at 1KSPS, and another 150Hz sin wave at 1.5KSPS, would it be possible to combine them for FFT without using non-uniform FFT techniques? Or would my best case be interpolating the slower one so that they match in sampling rate? Or would it be valid to superposition the result of FFT of the 2 signals for magnitude and phase plots?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(for combining, I mean that I want to do FFT on both signals together such that I see both signals in terms of magnitude and phase plots)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="8481" LastActivityDate="2014-08-20T17:40:35.820" Title="FFT of signals with different sampling frequency" Tags="|fft|sampling|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17852" PostTypeId="2" ParentId="17660" CreationDate="2014-08-18T23:26:04.350" Score="1" Body="&lt;p&gt;So entropy filter sounded good, but it didn't really work because the actual signal is also considered high entropy, even after adjusting the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did was take a derivative of all of the data in the time axis (left to right). Then I capped the maximum value. Then I integrated the derivative.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;deriv = data[i, 1:] - data[i, :-1]&#xA;deriv[deriv &amp;gt; max_] = max_&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The derivitave is $ \frac{dy}{dx }$. In my mind dy is a vertical line segment, dx is a horizontal line segment. Putting them together makes a right triangle, where the function is the hypotenuse is f, the horizontal leg is dx and the vertical leg is dy. Thus $ tan^{-1} {\frac{dy}{dx}} $ is the angle of elevation for f. In my mind, putting a maximum on the derivative is like putting a maximum angle on f. It is like saying, &quot;Cap the angle of elevation for f. If it goes above 150 degrees from the horizon, make it smaller.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to work. It limits the maximum angle of elevation for the signal. You can see the original signal (in red) and the signal after derivative filter (in green).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/HuNS1.png&quot; alt=&quot;derivative filter in time direction&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I take original signal minus derivative filter applied to original signal. This leaves me with just the noise band, which I can amplify, blur, and then subtract out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lec75.png&quot; alt=&quot;noise band&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/3cKpv.png&quot; alt=&quot;good data&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10742" LastActivityDate="2014-08-18T23:26:04.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17853" PostTypeId="1" CreationDate="2014-08-19T01:56:59.910" Score="1" ViewCount="248" Body="&lt;p&gt;If I have a signal with frequencies up to 2000 Hz but I'm only interested in the frequency range up to 500 Hz, is it correct to sample at 1000 Hz $(f_\mathrm s \geq 2 \cdot f_\mathrm{max})$? Or do I have to apply an analog lowpass filter with cut-off frequency 500 Hz first?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read this similar post, but didn't understand it well:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/11368/ignoring-nyquist&quot;&gt;Ignoring Nyquist&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10555" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-08-19T11:47:49.677" Title="Can I ignore the Nyquist criterion?" Tags="|fft|frequency|nyquist|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17854" PostTypeId="2" ParentId="17834" CreationDate="2014-08-19T03:27:35.610" Score="-1" Body="&lt;p&gt;You can't improve frequency resolution in a given frequency region without increasing a number of samples to be analysed. The picture is for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Px949.png&quot; alt=&quot;&quot;&gt;&#xA;There are two input signals of the same frequency, but one is 64us duration while other is 256us duration. Their Fourier transforms are represented in the picture by blue and green curves respectively. Now we say that DFT (and also FFT) is sampling of the Fourier transform. Red line and circles in the picture are DFT bins of the short signal. They are obviously uniformly spaced, but changing coefficients of DFT matrix we can of course sample the spectrum in the interesting region more precisely. But the main idea is: the frequency resolution stays the same. It's dependent on signal duration (or number of samples under processing). It's clearly seen from the picture: green curve shows greater frequency resolution because it was calculated from more signal samples.    &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-08-19T03:27:35.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17858" PostTypeId="2" ParentId="17853" CreationDate="2014-08-19T06:41:18.220" Score="3" Body="&lt;p&gt;You can only &quot;ignore Nyquist&quot; if you a-priori know that there is no higher frequency content (above your desired or required noise floor) that will alias down (or up!) to your band of interest.  But since your signal has content at and above half your sample rate, you will need to low pass filter that signal before sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will also need a sampling rate ABOVE 1000 Hz, if you are interested in a finite length of signal at 500 Hz.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-08-19T06:41:18.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17859" PostTypeId="2" ParentId="17842" CreationDate="2014-08-19T08:19:21.200" Score="0" Body="&lt;p&gt;While the lowpass (LP) before analog-to-digital conversion (ADC) is generally required in order to avoid aliasing effects the reconstruction lowpass after digital-to-analog conversion (DAC) can be omitted if the bandwidth of the analog signal is allowed to have a high bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In radio communication systems the reconstruction LP is very important because neighbouring channels must not be distorted and bandwidth is a valuable ressource. Thus the transmit signal (1) bandwidth should be as low as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But especially if you transmit your signal over a lowpass channel (e.g. wireline) and you have no frequency-multiplexed signals the reconstruction LP might be avoidable. I would consider the following points for the decision&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What's the bandwidth of the DAC output signal?&lt;/li&gt;&#xA;&lt;li&gt;Is there an amplifier after the DAC? Can it handle high frequencies?&lt;/li&gt;&#xA;&lt;li&gt;Is a modulator used? Can it handle high frequencies?&lt;/li&gt;&#xA;&lt;li&gt;Are there any other signals on the transmission medium and can they get distorted by your transmit signal?&lt;/li&gt;&#xA;&lt;li&gt;Are there non-linear components that could cause mixing of higher frequencies into the baseband (i.e. into the usefule frequency band)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As it has been noted before, some components of your transmitter (DAC, Amp, ...) or the channel might already reduce the bandwidth of your signal considerably so that an additional LP is not required.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(1) With &lt;em&gt;transmit signal&lt;/em&gt; I mean the analogue signal.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-08-19T08:19:21.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17860" PostTypeId="2" ParentId="17806" CreationDate="2014-08-19T09:53:36.910" Score="-1" Body="&lt;p&gt;I think you're mixing up things here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Acoustically, 2 Hz is inaudible, and 33 Hz is barely audible. The audible range is 20 Hz to 20.0000 Hz. Heartbeats are somewhere between 40 BPM and 180 BPM, so 0.7 Hz to 3 Hz. So your filter seems to match neither well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the main challenge here is exactly what &quot;noise&quot; you have to filter. For medical purposes, some sounds are clinically relevant which to laymen sound like noise. But if you just need to count the beats, you don't care about noise at all - just determine the envelope, resample it to 100 Hz or so, pass several seconds to an FFT, done.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-08-19T09:53:36.910" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17861" PostTypeId="1" CreationDate="2014-08-19T11:08:51.383" Score="0" ViewCount="1729" Body="&lt;p&gt;The frequency resolution of DFT is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Delta f = \frac{1}{T_{0}} = \frac{1}{NT} = \frac{f_{s}}{N}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_{s}$ is sampling frequency, $T_{0}$ is sampling time, $N$ is number samples, and $T$ is the sampling interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where does this definition come from? Espescially the $1/T_{0}$, why this equality?&lt;/p&gt;&#xA;" OwnerUserId="10853" LastActivityDate="2014-08-26T14:26:57.703" Title="About frequency resolution" Tags="|frequency|dft|" AnswerCount="2" CommentCount="3" ClosedDate="2014-08-26T17:19:54.730" ContentLicense="CC BY-SA 3.0" />
  <row Id="17863" PostTypeId="1" CreationDate="2014-08-19T12:44:11.463" Score="1" ViewCount="119" Body="&lt;p&gt;Let &#xA;$$&#xA;A=&#xA;  \begin{bmatrix}&#xA;    a_{1,1} &amp;amp; a_{1,2} &amp;amp; a_{1,3}\\&#xA;    a_{2,1} &amp;amp; a_{2,2} &amp;amp; a_{2,3}\\&#xA;    a_{3,1} &amp;amp; a_{3,2} &amp;amp; a_{3,3}\\&#xA;  \end{bmatrix}&#xA;$$&#xA; and &#xA;$$&#xA;B=&#xA;  \begin{bmatrix}&#xA;    b_{1,1} &amp;amp; b_{1,2} &amp;amp; b_{1,3}\\&#xA;    b_{2,1} &amp;amp; b_{2,2} &amp;amp; b_{2,3}\\&#xA;    b_{3,1} &amp;amp; b_{3,2} &amp;amp; b_{3,3}\\&#xA;  \end{bmatrix}&#xA;$$&#xA;and $C=A\circ B$, i.e., &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C=&#xA;  \begin{bmatrix}&#xA;    a_{1,1} \times b_{1,1} &amp;amp; a_{1,2}\times b_{1,2} &amp;amp; a_{1,3}\times b_{1,3}\\&#xA;    a_{2,1}\times  b_{2,1} &amp;amp; a_{2,2}\times b_{2,2} &amp;amp; a_{2,3}\times b_{2,3}\\&#xA;    a_{3,1}\times  b_{3,1} &amp;amp; a_{3,2}\times b_{3,2} &amp;amp; a_{3,3}\times b_{3,3}\\&#xA;  \end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then I have to column-wise addition of $C$, i.e.,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C'=[c_{1,1}+c_{2,1}+c_{3,1}, c_{1,2}+c_{2,2}+c_{3,2}, c_{1,3}+c_{2,3}+c_{3,3}]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other way to represent $C'$ in terms of column-wise addition of $A$ (i.e., $A'$) and column-wise addition of $B$ (i.e., $B'$)? or $A$ and $B'$?&lt;/p&gt;&#xA;" OwnerUserId="8583" LastEditorUserId="1606" LastEditDate="2014-08-19T12:54:24.653" LastActivityDate="2014-08-19T12:54:24.653" Title="How to replace Hadamard Product and Column wise addition with new Matrix operation?" Tags="|signal-analysis|matrix|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17864" PostTypeId="1" AcceptedAnswerId="17867" CreationDate="2014-08-19T14:13:36.057" Score="4" ViewCount="505" Body="&lt;p&gt;$X$ represents sample in frequency domain and $x$ represents samples in time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTATION 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ X[k] = \sum\limits_{n=0}^{N-1} x[n] \ e^{-j \frac{2\pi}{N} n k} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x[n] = \frac{1}{N} \sum\limits_{k=0}^{N-1} X[k] \ e^{j \frac{2\pi}{N} n k} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTATION 2&lt;/strong&gt;     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ X[k] = \frac{1}{N} \sum\limits_{n=0}^{N-1} x[n] \ e^{-j \frac{2\pi}{N} n k} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x[n] = \sum\limits_{k=0}^{N-1} X[k] \ e^{j \frac{2\pi}{N} n k} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTATION 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ X[k] = \frac{1}{\sqrt{N}} \sum\limits_{n=0}^{N-1} x[n] \ e^{-j \frac{2\pi}{N} n k} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x[n] = \frac{1}{\sqrt{N}} \sum\limits_{k=0}^{N-1} X[k] \ e^{j \frac{2\pi}{N} n k} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTATION 4&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ X[k] = \sum\limits_{n=0}^{N-1} x[n] \ e^{j \frac{2\pi}{N} n k} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x[n] = \frac{1}{N}\sum\limits_{k=0}^{N-1} X[k] \ e^{-j \frac{2\pi}{N} n k} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please observe the scaling factor $\frac{1}{N}$ and change of a negative sign $-$ over the exponent term ${e^{\pm j\frac{{2\pi }}{N}nk} }$. Why is every notation of DFT valid?&lt;/p&gt;&#xA;" OwnerUserId="10681" LastEditorUserId="4346" LastEditDate="2014-08-20T17:06:49.950" LastActivityDate="2014-08-20T18:15:37.483" Title="please give the reason why every notation for DFT is valid?" Tags="|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17865" PostTypeId="1" CreationDate="2014-08-19T14:23:25.320" Score="1" ViewCount="769" Body="&lt;p&gt;I am asked to extract three curves from palm images.  &lt;img src=&quot;https://i.stack.imgur.com/0XGUQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;               original image&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cjQi8.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;                   expected result.&#xA;The curves has lower intensity than neighboring pixels. So I try to morphology to extract the pixels. The matlab code is followed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RGBImage = imread('E:\ImageProcessing\Palm\Matlab\IMG_20140817_144549.jpg');&#xA;GrayImage = rgb2gray(RGBImage);&#xA;GrayImage = imresize(GrayImage, [768, 1024]);&#xA;se = strel('disk', 10);&#xA;GrayImage = imbothat(GrayImage, se);&#xA;figure; imshow(GrayImage);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is shown below&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TmTFb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The curves still have a little higher intensity values than neighboring pixels.  Maybe I need use ridge filter to enhance the curves. I use the filter from matlab file exhange(&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/24409-hessian-based-frangi-vesselness-filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/24409-hessian-based-frangi-vesselness-filter&lt;/a&gt;). The filtered result is not satisfactory.  I hope to get any advance or links or papers.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2014-08-19T14:23:25.320" Title="Ways to find three curves from palm image" Tags="|image-processing|matlab|image-segmentation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17866" PostTypeId="2" ParentId="17861" CreationDate="2014-08-19T18:06:44.320" Score="0" Body="&lt;p&gt;The longer the total sample window (T0), the smaller the frequency difference between two sinusoids with exactly M periods and exactly M+1 periods (for integer M &amp;lt;= N/2) in that window, which is required for orthogonality between adjacent DFT bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the bin spacing is not the resolution. The frequency resolution can be greater or less than the DFT bin spacing, depending on the S/N ratio and your resolution needs (separation or estimation).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-08-19T18:06:44.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17867" PostTypeId="2" ParentId="17864" CreationDate="2014-08-19T19:19:07.477" Score="3" Body="&lt;p&gt;It simply does not matter and it is just a matter of convention which version is used. I always use the first definition, which is also the one you will find in (almost) all textbooks on DSP. If you take always the same time domain signal $x[n]$ then it is obvious that $X_2[k]$ (according to notation 2) and $X_3[k]$ (according to notation 3) are simply scaled versions of $X[k]$ (according to notation 1). The one with scaling $1/\sqrt{N}$ is the &lt;em&gt;unitary&lt;/em&gt; version of the DFT (i.e. the DFT becomes a unitary transformation). It's just notation number 4 that is a bit weird. In this case, $X_4[k]=X[-k]$, but I have never seen the sign convention like this. In this case, $x[n]$ can be interpreted as the Fourier series coefficients of $X[k]$. But again, all four versions are OK and you're free to use any of them as long as everybody knows which version of the DFT you mean.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-20T18:14:52.257" LastActivityDate="2014-08-20T18:14:52.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17868" PostTypeId="1" CreationDate="2014-08-19T20:03:30.477" Score="7" ViewCount="1914" Body="&lt;p&gt;I am trying to detect if a car did accelerate or did brake by using the accelerometer of the iPhone. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the figure below I plotted the collected data. (To collect the data the phone was laying flat in the car facing the top of the phone to the front). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I am having now is that visually I can clearly see where the car accelerated and where it did brake (see below). But can't figure out how to do that programatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I basically want is to know how often a car did brake or accelerate during a certain time window. (Window size around 10-30 seconds).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be highly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&#xA;&lt;img src=&quot;https://i.stack.imgur.com/u7cl0.png&quot; alt=&quot;Acceleration | Braking of a car&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10859" LastEditorUserId="10859" LastEditDate="2014-08-20T13:21:03.130" LastActivityDate="2017-07-09T16:12:17.287" Title="How to classify accelerometer data?" Tags="|signal-detection|classification|detection|" AnswerCount="3" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17869" PostTypeId="1" CreationDate="2014-08-19T20:45:22.157" Score="2" ViewCount="3454" Body="&lt;p&gt;I am digging into Haar like and LBP features. More precisely its implementation in OpenCV. Every article or forum entry I found states, that LBP is faster than Haar. My local tests also confirm this expectation. Yet I don´t understand why are LBP faster. As far as I know, OpenCV uses MB LBP features. I looked into some trained LBP cascade, and found out that leafe values as well as stage thresholds are floating point values, similiar to Haar cascade. Also, both features are very similiar, Haar sums up regions in rectangles together to get threshold values where MB LBP does 8 thresholding with neighbours. But both alghoritms use Integral image for quick summation. So by very naive approach, it seems to me that 8 comparisions are actually slower than few additions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what is the expensive part of Haar feature evaluation vs MB LBP? I know I am wrong, based on practical testing, I just don´t know why.&lt;/p&gt;&#xA;" OwnerUserId="10861" LastActivityDate="2015-09-14T12:06:21.950" Title="Why is LBP generaly faster than HAAR?" Tags="|opencv|local-features|detection|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17870" PostTypeId="1" CreationDate="2014-08-19T20:55:17.150" Score="5" ViewCount="1459" Body="&lt;p&gt;The task is to detect arrow from medical images. After segmenting, arrow-like objects can be connected with other connected components (noise). In this context, detecting a part of the object that characterizes an arrowhead would be a solution since template based shape descriptor does not perform well.&#xA;Please help!&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/56zgh.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xd1fH.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/v7fzJ.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="10862" LastEditorUserId="7092" LastEditDate="2022-06-08T21:08:45.627" LastActivityDate="2022-06-08T21:08:45.627" Title="How to detect whether the object has triangular shape?" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17871" PostTypeId="1" AcceptedAnswerId="17875" CreationDate="2014-08-19T22:49:54.883" Score="4" ViewCount="33142" Body="&lt;p&gt;I am doing some analysis in python working with a photodiode. The signal is more or less periodic with some phase shifting in certain areas that give rise to faster or slower periods but overall still very periodic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to see how &quot;good&quot; our signal is by computing the Signal-to-Noise ratio (SNR), but so far I have only read from a book on DSP that SNR is defined only as the mean divided by the standard deviation of the signal. Also the book defines Coefficient of variation (CV) as the standard deviation divided by the mean, multiplied by 100. They say a good signal has high SNR and low CV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this simply the definition of SNR or is it something that should be adjusted depending on the signal? How would i go about calculating SNR for my signal?&lt;/p&gt;&#xA;" OwnerUserId="10863" LastEditorUserId="8202" LastEditDate="2014-08-20T07:52:03.407" LastActivityDate="2014-08-20T07:52:03.407" Title="How to calculate Signal-To-Noise Ratio" Tags="|signal-analysis|snr|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17873" PostTypeId="2" ParentId="8113" CreationDate="2014-08-20T00:19:43.610" Score="1" Body="&lt;p&gt;Here there is a nice implementation of a hilbert transformation applied onto a discreet signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/10693590/source-for-a-good-simple-soft-modem-library&quot;&gt;https://stackoverflow.com/questions/10693590/source-for-a-good-simple-soft-modem-library&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That codes starts by generating the hilbert transform in the frequency domain. To apply the hilbert transform to a sigal in the frequency space all you have to do is to multiply the negative frequencies by -j and the positives by j. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it uses the idft to convert the hilbert transform into the time domain. The hilbert transform, that in the frequency domanin is just a multiplication, in the time domain becomes a convolution. Note that in that implementation, in the frequency domain, the hiltbert transform has some of coefficients set to zero, it does that for the frequencies we are not interested in. That helps filter out those unwanted frequencies. &lt;/p&gt;&#xA;" OwnerUserId="10864" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-08-20T00:19:43.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17874" PostTypeId="2" ParentId="17870" CreationDate="2014-08-20T03:25:03.017" Score="5" Body="&lt;p&gt;I think you can find the orientation of the arrow using principal component analysis (or fitting an ellipse and taking major/minor axis directions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To locate the arrow head, use distance transform. You'll have to preprocess the image, like flood-filling the region. Because the arrow head base is usually the widest part of the image, you should get a peak there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can use this point along with the two orthogonal vectors calculated earlier. In the image below I've translated those vectors to go through the distance-transform peak(I didn't do any calculations, the image is just for illustration).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hfkar.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blue axis (second component in PCA or the minor axis of ellipse) now divides the image into two halves, and if you take projection of each half on to the blue axis, the half that contains the arrow head should give you a triangular profile (blue and orange profiles in the image below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T8pqF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to use the distance transform peak to isolate the neighborhood of the arrow head. If we threshold the distance transformed image by some fraction of the peak value, for the arrow head we should still get a triangular shape. Now we can prepare a mask centered on the peak to extract this region. Below is a simple Matlab code that does this for a specific image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = imread('arrow.jpg');&#xA;gray = rgb2gray(im);&#xA;bw = im2bw(gray, graythresh(gray));&#xA;di = bwdist(bw);&#xA;[mx, mxidx] = max(di(:));&#xA;[ypeak, xpeak] = ind2sub(size(di), mxidx);&#xA;bw2 = di &amp;gt; mx*.5;&#xA;se = strel('disk', double(ceil(mx*1.5)), 0);&#xA;mask = zeros(size(bw2));&#xA;mask(ypeak, xpeak) = 1;&#xA;mask = imdilate(mask, se);&#xA;figure,&#xA;subplot(1, 3, 1), imshow(bw), title('binary')&#xA;subplot(1, 3, 2), imshow(bw2.*di, []), title('thresholded dist')&#xA;subplot(1, 3, 3), imshow(mask.*di.*bw2, []), title('masked')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the result is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wcGtf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8833" LastEditorUserId="8833" LastEditDate="2014-08-23T15:59:26.093" LastActivityDate="2014-08-23T15:59:26.093" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17875" PostTypeId="2" ParentId="17871" CreationDate="2014-08-20T03:30:52.293" Score="12" Body="&lt;p&gt;If you can get input signal when it doesn't contain any useful signal (I mean only noise is presented), you can estimate average noise power at first. Simply find a power of such a signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$P_n=1/N \cdot \displaystyle\sum_{k=0}^{N-1}|s(k)|^2$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Choose $N$ in $2^{12}\ldots 2^{15}$ range for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can measure a power of $signal+noise$ mixture, $P_s$, by the same way, when input signal is presented at the input. &lt;em&gt;Caution: the measurement of $P_s$ is only valid if the signal exists all the measurement time.&lt;/em&gt; SNR could be calculated by:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$SNR=10 \cdot \log_{10} \frac {P_s - P_n}{P_n}$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If your noise is stationary and white it's possible to measure it once in the setup and use $P_n$ as a constant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't measure noise power at any reason, you can try to estimate SNR in the frequency domain via FFT. But you have to know your signal's band. The point is the same but you should use FFT frequency indexes instead of sample numbers $k$ while estimating integral power. $P_s$ is now power of $signal+noise$ in the band of interest, while $P_n$ is the noise power in total band ($0...fs$). In this case power spectral density of the noise in your system should be evaluated at first. This method could be far too complex for your task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both methods show you pointless result in the case of low SNR &lt;em&gt;in the signal band&lt;/em&gt; (not total band in general). Frequency domain method will be preferable if your signal's band is quite less than $f_s$, otherwise time domain method will be good enough. To estimate SNR of the order of 5 dB or lower it's better to know signal and noise power (or power spectral density) &lt;em&gt;a priory&lt;/em&gt;. So the task has robust analitical solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps. &lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="8202" LastEditDate="2014-08-20T07:51:37.020" LastActivityDate="2014-08-20T07:51:37.020" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17878" PostTypeId="1" CreationDate="2014-08-20T08:16:24.270" Score="0" ViewCount="171" Body="&lt;p&gt;i recorded a tone between two  devices and applied cross correlation on the recorded and the sent signals. &#xA;I want to know if there is a multipath effect on my result (on MATLAB). what can i use for that?&lt;/p&gt;&#xA;" OwnerUserId="10716" LastActivityDate="2014-08-20T08:16:24.270" Title="multipath propagation" Tags="|audio|multipath|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="17879" PostTypeId="1" AcceptedAnswerId="17880" CreationDate="2014-08-20T08:44:20.590" Score="1" ViewCount="2560" Body="&lt;p&gt;I am a self-learner of DSP by reading related books.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While reading Time domain Analysis of DT (Discrete Time) system, I suddenly got introduced to difference equation representing a system. It then further stated -&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The response of any DT system can be decomposed as :&#xA;&#xA;Total Response = Zero State Response + Zero Input response&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where Zero state response is system response due to input alone and zero input response is when input is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It goes further on to explain Natural, Forced and Total System Response - but unfortunately I am unable to map it to a concept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me its like response of a car engine (example per say or anything - a system) is like response when engine is not started + when engine is started - but this does not makes any  sense for me. The engine system why should it consider zero input response at all. Its just a change of its state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly I am trying to understand Natural / Forced response but do not get the concept quiet clear. Also What is the role of studying them and where can we apply these concepts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is meant by recursive and non-recursive system - though my understanding is when system output is fed again into system as its input, it would then make the system call as recursive system - but why does a system need to do that? &lt;/p&gt;&#xA;" OwnerUserId="10384" LastActivityDate="2019-10-19T10:10:28.017" Title="Natural, Forced and Total System Response - Time domain Analysis of DT" Tags="|discrete-signals|linear-systems|dsp-core|system-identification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17880" PostTypeId="2" ParentId="17879" CreationDate="2014-08-20T09:21:20.310" Score="2" Body="&lt;p&gt;First of all, many textbooks use the following definition (but see &lt;a href=&quot;https://dsp.stackexchange.com/a/29743/4298&quot;&gt;this answer&lt;/a&gt; for a different one):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;zero-state response (ZSR) = forced response&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;zero-input response (ZIR) = natural response&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Zero_Input_Response&quot; rel=&quot;nofollow noreferrer&quot;&gt;zero-state response&lt;/a&gt; is the response of a system to an input signal &lt;em&gt;given that the initial state of the system is zero&lt;/em&gt;. The zero-input response is the output of the system due to a non-zero initial state. For a discrete-time system, the initial state is given by the values stored in memory (i.e. in the delay elements). Since we're dealing with &lt;em&gt;linear&lt;/em&gt; systems, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Superposition_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;superposition principle&lt;/a&gt; can be applied, and the total response of the system is given by ZSR+ZIR. So if the initial state is zero, the total response equals the ZSR, and if there's no input signal, the output is given by the ZIR, which always decays if the system is stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In analog circuit theory you have exactly the same. There the initial state is the energy stored in capacitors and inductors. Your car engine analogy is less fortunate because it doesn't really work. You could come up with a mechanical analogy though as long as the system is linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be a good idea to formulate a new question concerning recursive systems (after having searched the internet and this site). But you're right that a system is recursive if not only the input but also past output values determine the current output. The reason why this is done is the fact that in this way certain system properties can be implemented much more efficiently than by only using the current and past input values. The problem with recursive systems is that they can be unstable, and that quantization effects (in signals and filter coefficients) can more easily result in numerical problems than for non-recursive systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: If you teach yourself I strongly recommend &lt;a href=&quot;http://ocw.mit.edu/index.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIT's open courseware&lt;/a&gt;. You should probably start with &lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-fall-2011/&quot; rel=&quot;nofollow noreferrer&quot;&gt;6.003 Signals and Systems&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2019-10-19T10:10:28.017" LastActivityDate="2019-10-19T10:10:28.017" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17881" PostTypeId="1" CreationDate="2014-08-20T13:14:39.597" Score="0" ViewCount="1368" Body="&lt;p&gt;I'm working on image project using Matlab &amp;amp; I heard about 2D-otsu algorithm as effective segmentation with low SNR and low contrast images, but I can't find enough information about it or how to implement it. I'll be thankful if anyone can help me in such case.&lt;/p&gt;&#xA;" OwnerUserId="5714" LastActivityDate="2015-02-27T14:11:39.927" Title="2D-otsu algorithm in Digital image processing" Tags="|matlab|image-processing|image-segmentation|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17882" PostTypeId="1" CreationDate="2014-08-20T14:09:01.110" Score="1" ViewCount="1915" Body="&lt;p&gt;I need to alter an FIR filter which I know very little about. I have a signal which need to be altered, and looking at a Python script used for this task, I see that it uses Scipy's signal library, more specifically the &lt;code&gt;firwin&lt;/code&gt; function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I input &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cutoff_freq = 5400&#xA;num_taps = 51 &#xA;coeffs = signal.firwin(numtaps = num_taps, cutoff = cutoff_freq, window = &quot;hamming&quot;, nyq = 72000)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;scipy\signal\filter_design.py:338: BadCoefficients: Badly conditioned&#xA;  filter coefficients (numerator): the results may be meaningless&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The same occurs when &lt;code&gt;num_taps&lt;/code&gt; is 52, 53, 54 and 55, but 56, 57, 58 and 59 does not give this warning. &#xA;What does this mean and how should I be sure to avoid it? &lt;/p&gt;&#xA;" OwnerUserId="3575" LastActivityDate="2014-08-20T14:09:01.110" Title="Using Python with scipy.signal firwin, how do I know how many taps/coefficients should be used?" Tags="|filter-design|python|finite-impulse-response|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17883" PostTypeId="1" CreationDate="2014-08-20T15:48:53.277" Score="2" ViewCount="84" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c2efs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c2efs.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt; What filters are used to get an image like one on the left? I need to find the body pose of a person in a picture. &lt;/p&gt;&#xA;" OwnerUserId="10868" LastEditorUserId="128" LastEditDate="2023-07-16T13:19:39.957" LastActivityDate="2023-12-13T15:07:16.013" Title="How to Generate the Kinect Images" Tags="|image-processing|filters|computer-vision|machine-learning|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17884" PostTypeId="2" ParentId="10127" CreationDate="2014-08-20T15:51:38.243" Score="0" Body="&lt;p&gt;Not sure if you still need help... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want frequency vs. magnitude use a &quot;mesh/surf&quot; command to plot the coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then change the orientation of the plot so that you have the result you seek. For this see the &quot;view&quot; command.&lt;/p&gt;&#xA;" OwnerUserId="10869" LastActivityDate="2014-08-20T15:51:38.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17886" PostTypeId="2" ParentId="17850" CreationDate="2014-08-20T17:40:35.820" Score="1" Body="&lt;p&gt;The only proper way to take the FFT on both simultaneously is to resample one or the other, add them, and take the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are OK w/ taking two independent FFTs, then when you plot them, plot them in terms of absolute units (i.e., determine which absolute frequency each DFT bin corresponds to).&lt;/p&gt;&#xA;" OwnerUserId="788" LastActivityDate="2014-08-20T17:40:35.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17887" PostTypeId="2" ParentId="17864" CreationDate="2014-08-20T18:10:16.907" Score="0" Body="&lt;p&gt;likewise to @MattL.'s answer, just observe that $x[n]$ in &lt;strong&gt;NOTATION 2&lt;/strong&gt; is scaled to be $N$ times larger than the $x[n]$ in &lt;strong&gt;NOTATION 1&lt;/strong&gt;.  and $x[n]$ in &lt;strong&gt;NOTATION 3&lt;/strong&gt; is scaled to be $\sqrt{N}$ times larger than the $x[n]$ in &lt;strong&gt;NOTATION 1&lt;/strong&gt;.  that's all that change of convention means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in &lt;strong&gt;NOTATION 4&lt;/strong&gt;, just note that there is &lt;strong&gt;no&lt;/strong&gt; operational difference between $-j$ and $+j$.  both numbers are purely imaginary and they both have equal claim to squaring to be $-1$ or have equal claim to being the $\sqrt{-1}$ (stating it loosely).  these two numbers are not &lt;strong&gt;&lt;em&gt;equal&lt;/em&gt;&lt;/strong&gt;, but they &lt;em&gt;are&lt;/em&gt; &lt;strong&gt;equivalent&lt;/strong&gt;.  they have identical properties (which are simply that they are not real numbers and they square to be $-1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so as long as all occurrences of $j$ are replaced by $-j$ (which means that all occurances of $-j$ are replaced by $+j$) in &lt;strong&gt;all&lt;/strong&gt; of the theorems that come with the DFT, then &lt;strong&gt;NOTATION 4&lt;/strong&gt; will be fine as a convention and is just as valid as &lt;strong&gt;NOTATION 1&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in both cases, the scaling case and the case of swapping of $-j$ and $+j$, note that the theorems associated with the DFT must also be modified slightly for them to be &quot;equally valid&quot; conventions.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-08-20T18:15:37.483" LastActivityDate="2014-08-20T18:15:37.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17888" PostTypeId="2" ParentId="17881" CreationDate="2014-08-20T23:11:56.383" Score="0" Body="&lt;p&gt;The Otsu's method works on the histogram of the image, and it is implemented by the &lt;a href=&quot;http://www.mathworks.com/help/images/ref/graythresh.html&quot; rel=&quot;nofollow&quot;&gt;graythresh&lt;/a&gt; function.  I don't know what 2D-otsu algorithm is...&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-08-20T23:11:56.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17889" PostTypeId="1" AcceptedAnswerId="17893" CreationDate="2014-08-21T06:47:29.423" Score="0" ViewCount="124" Body="&lt;p&gt;We know that that the difference equation formula for computing an output sample at time &lt;span class=&quot;math-container&quot;&gt;$ n$&lt;/span&gt; is based upon its past/present input samples and past output samples in time domain:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;y(n) &amp;amp;= b_0 \,x(n) + b_1 \,x(n - 1) + \cdots + b_M \,x(n - M) \\ &#xA;&amp;amp;\qquad- a_1 \,y(n - 1) - \cdots - a_N \,y(n - N) \\ 	 &#xA;&amp;amp;=\sum_{i=0}^M b_i \,x(n-i) - \sum_{j=1}^N a_j \,y(n-j)&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; begins from 1 rather than from value 0 like for &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and also how can we write the below output equation in difference equation form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;y(n) &amp;amp;= 0.01\ x(n - 5) + 0.002\ x(n - 1) + 0.99\ y(n - 1)\\&#xA;y(n) &amp;amp;= 0.01\ x(n) + 0.002\ x(n - 1) \\&#xA;y(5) &amp;amp;= 0.01\ x(3) + x(1) \\&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly why &lt;span class=&quot;math-container&quot;&gt;$y(n)$&lt;/span&gt; sequence values are calculated as a sum of a series of input / output, cause I have been studying that &lt;span class=&quot;math-container&quot;&gt;$$y(n) = \{2,4,6,8\}$$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$$x(n) = \{1,2,3,4\}$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$n =\{1,2,3,4\}$$&lt;/span&gt; (example per say) i.e. &lt;span class=&quot;math-container&quot;&gt;$y(n) = 2\cdot x(n)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There was no mention that for &lt;span class=&quot;math-container&quot;&gt;$y(n)$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$y(2)$&lt;/span&gt; say) value we need to add values of &lt;span class=&quot;math-container&quot;&gt;$x(n)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y(n)$&lt;/span&gt; i.e. (take values of &lt;span class=&quot;math-container&quot;&gt;$x(1)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$y(1)$&lt;/span&gt;) or &lt;span class=&quot;math-container&quot;&gt;$y(n-1)$&lt;/span&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="10384" LastEditorUserId="47251" LastEditDate="2020-02-17T22:45:27.517" LastActivityDate="2020-02-17T22:45:27.517" Title="Difference Equation - Time Response analysis of Discrete Systems" Tags="|filters|discrete-signals|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17891" PostTypeId="1" AcceptedAnswerId="17905" CreationDate="2014-08-21T10:26:00.920" Score="2" ViewCount="1242" Body="&lt;p&gt;I am conducting experiments to collect wind speed data from wind anemometers placed on a moving platform. Closely, there is a fixed wind mast holding a wind vane. Prior to analysing the wind data from the moving platform, I binned the data with 1-minute average wind direction. Each bin contains a number of continuous data sets (Set 1, Set 2, Set 3 etc.) which may not necessarily have the same number of data points. For example, Set 1 has 20,000 data points, Set 2 has 6,000 data points, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am performing an FFT on each of the sets to detect any periodicities in the signal. I am plotting the real amplitude of the sinusoids present in the signal on the y-axis vs. the frequency of the sinusoid. The FFT of each data set is yielding different amplitude results, on the y-axis and I'm not sure whether this is a result of the different length of the arrays. I am interested in an average value of the y-axis of the spectrum. However, I don't think that it is suitable to just calculate the average due to the different array size. Can someone please suggest a method? I am not used to analysis of signals in this way so I'm a bit confused. Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="10881" LastActivityDate="2014-08-22T07:56:56.637" Title="FFT analysis of binned data of different length" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="17892" PostTypeId="2" ParentId="17881" CreationDate="2014-08-21T14:20:12.867" Score="0" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Otsu%27s_method&quot; rel=&quot;nofollow&quot;&gt;Otsu's method&lt;/a&gt; sets a threshold on the image such that the intra class variance is minimized. The wikipedia article has a reasonable description and example implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Dima points out it is implentented by &lt;a href=&quot;http://www.mathworks.co.uk/help/images/ref/graythresh.html&quot; rel=&quot;nofollow&quot;&gt;graythresh&lt;/a&gt; in matlab, but only if you have the image processing toolbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see Otsu's original article it is &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=4310076&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; (might be paywalled I didn't check).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a bit of a misnomer to call it the 2D-Otsu as the method set the threshold only on the pixel intensity and does not account for position/dimensionality of the image.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-08-21T14:20:12.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17893" PostTypeId="2" ParentId="17889" CreationDate="2014-08-21T15:21:24.237" Score="1" Body="&lt;p&gt;The answer to your first question (why $j$ starts at $1$) is contained in your first sentence: the output is computed from the current input value ($i=0$), from past input values ($i\ge 1$), and from past output values (i.e. $j\ge 1$). Imagine that you had the following difference equation with $j$ starting at $0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=0}^Na_jy(n-j)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could rewrite (1) as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=1}^Na_jy(n-j)-a_0y(n)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and consequently&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)(1+a_0)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=1}^Na_jy(n-j)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can divide (3) by $1+a_0$ to arrive at an equation like the one given in your question (with $j$ starting at $1$) (and with all coefficients scaled by the constant $1+a_0$). So you can always use the difference equation with $j$ starting at $1$ without loss of generality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the 3 examples of difference equations you gave I'll just discuss the first one, the others are totally analogous. Here you have $M=5$ and $N=1$ with coefficients $b_1=0.002$, $b_5=0.01$, and $b_0=b_2=b_3=b_4=0$, and $a_1=-0.99$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, concerning your last question about the system $y(n)=2x(n)$. That's again a special case of your general difference equation with all $a_i=0$ (i.e. no recursion) and with $b_0=1$ (and all other $b_i=0$, $i\ge 1$). So all your examples are special cases of the general difference equation.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-21T15:21:24.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17894" PostTypeId="1" CreationDate="2014-08-21T16:58:57.423" Score="0" ViewCount="95" Body="&lt;p&gt;Any idea on separating multi-panel figures?&lt;img src=&quot;https://i.stack.imgur.com/NR8U6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 2 different sub-figures connected each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="10862" LastActivityDate="2014-08-22T18:36:43.857" Title="Separate sub-figures!" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17895" PostTypeId="1" AcceptedAnswerId="17913" CreationDate="2014-08-21T18:00:08.370" Score="1" ViewCount="286" Body="&lt;p&gt;I have a source of noise in a duct, on either side of the noise source I have a microphone, which register the pressure, so that I get two pressure signals: $p_1$ and $p_2$. I want to get the acoustic Sound Pressure Level (SPL) spectrum which can be estimated using a periodogram approach, more specifically using the &lt;a href=&quot;http://www.dsprelated.com/dspbooks/sasp/Welch_s_Method.html&quot; rel=&quot;nofollow&quot;&gt;welch&lt;/a&gt; procedure. This function is readily available in Matlab as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pwelch&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or in python using &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;scipy.signal.welch&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;The Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The question is, since I have two channels of audio, how do I combine them to get a representation of the total SPL spectrum? Or is the mean SPL more appropriate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some ideas:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that for two sound sources giving rise to $p_1$ and $p_2$ then we have two cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlated sound: $&amp;lt;p_{tot}^2&amp;gt; = \frac{1}{2}(p_1^2+p_2^2)$&lt;br&gt;&#xA;Uncorrelated sound: $&amp;lt;p_{tot}^2&amp;gt; = \frac{1}{2}(p_1+p_2)^2$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case I'm guessing I should consider the time series $p_1$ and $p_2$ to be correlated since they come from the same source but are measured on separate sides, and this would imply that the total SPL spectrum would be given by averaging the resulting spectra given by welch on the individual channels. Thoughts? &lt;/p&gt;&#xA;" OwnerUserId="5466" LastActivityDate="2014-08-22T16:24:38.463" Title="How to obtain mean Power Spectrum from two audio channels?" Tags="|discrete-signals|audio|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17897" PostTypeId="1" AcceptedAnswerId="17899" CreationDate="2014-08-21T23:34:19.590" Score="4" ViewCount="3253" Body="&lt;p&gt;I'm trying to understand how speech recognition works, when using HMM. I know this post is very long, but that's mainly because I'm a complete beginner, and I since I have no idea what is clear and what is not, I try to write everything as clearly as possible (which takes a lot of space). Help would be really appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be using O for observation sequence, X for state sequence, M for a HMM model with defined parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My understanding&lt;/strong&gt; - please correct me where I am wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand it correctly, the 3 basic operations with HMMs are:&#xA;1, Evaluation - how likely is observation O to happen, given a HMM model M - P(O|M). This is done by using the forward algorithm (dynamic programming).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2, Classification - I'm not sure I understand what this one is - is it finding out which state sequence is the most likely one to cause the observation O, given a model M? If yes, then it it is again done with dynamic programming, very similar to the forward algorithm, except you will be taking maximums instead of sums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3, Training - You change the parameters of M, to raise the probability of an observation O happening with your given model. The forward-backward algorithm can be used for this, and it is proven that it finds a local maximum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual speech recognition, here in the context of isolated word recognition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each word you want to recognize, you have a specific HMM model - here, the example I will use is that if you want to recognize 'one', 'two', 'three' you will have 3 HMM models M_1, M_2, M_3, each with say 3 states and 3 emmissions (that might be enough for 3 words?).&#xA;You make training samples of the specific words, and you train the models with these sounds - you do this, by  breaking up each utterance/sound of a certain word into small parts (~10ms), to each part you map a certain vector, with the vector being based on some spectral quality of this 10ms part - this is the observation at a certain time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you want to recognize a word, you say the word, and you pick such a model M_i, that it is the maximum of P(O|M_i), i element of L, L being the number of words (and specific HMM models) that you have trained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I don't get&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What exactly can the vector/observation be? Can it be a relatively simple function, say approximation of the spectral envelope? Or is it usually a vector of R^n? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is it, that if you say &quot;ooone&quot; instead of &quot;one&quot;, P(&quot;ooone&quot;|M_1) will still be the highest of the three trained HMM models? Is it because if the model was trained with 'one', the model already favors the observation that happens when the sound of 'o' is said, and the state transition of x_1 -&gt; x_1 (where x_1 is likely to emit this observation) is also favored? Basically, is there some convincing proof/intuition, that pronouncing a certain word very slowly at certain parts will not cause it to be recognized incorrectly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of isolated word recognition, does the classification HMM operation happen at all? All I see is training, and evaluation (for finding the maximum of P(O|M_i).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, could some please explain how continuous speech recognition differs from this? Apparently, unlike the above, classification happens at some point - I don't really understand how it can be used. I can imagine that maybe for each phoneme, a certain HMM model will be used, and then in a long sentence, this sentence will consist of many of these models tied together.&#xA;How many HMM models will there be, how many states will there be? How will it be done, that a certain state sequence will define the words in the utterance?&lt;/p&gt;&#xA;" OwnerUserId="10888" LastActivityDate="2014-08-22T08:22:35.297" Title="Using HMM for speech recognition" Tags="|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17898" PostTypeId="1" AcceptedAnswerId="17901" CreationDate="2014-08-21T23:46:06.260" Score="0" ViewCount="69" Body="&lt;p&gt;In their textbook(Example 1.1), Oppenheim and Willsky provide the following method for obtaining $g(t)=x(-t+1)$ from $x(t)$ : Replace $t$ with $-t$ in $x(t+1)$. In other words, advance the signal by 1 unit and flip the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there could be another interpretation as well. Based on the fact that $-t+1 = -(t-1)$, we can have the desired signal as $h(t)=x(-t+1) = x(-(t-1))$,i.e. Delay the signal by 1 unit and flip the result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the two signals $g(t)$ and $h(t)$ are not identical. Why is the latter interpretation incorrect ?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2014-08-22T02:18:35.310" Title="Time shift -- two interpretations" Tags="|signal-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17899" PostTypeId="2" ParentId="17897" CreationDate="2014-08-22T00:29:06.110" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What exactly can the vector/observation be? Can it be a relatively simple function, say approximation of the spectral envelope? Or is it usually a vector of R^n?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You won't go very far by summarizing the entire spectral envelope of a sound by a single real, so yes, observations are vectors - their dimensionality is in the 10 to 100 components bucket...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, the features used are &lt;a href=&quot;http://en.wikipedia.org/wiki/Mel-frequency_cepstrum&quot; rel=&quot;nofollow&quot;&gt;MFCC&lt;/a&gt; and their first/second order derivatives. They capture spectral envelope (in short: dimensionality reduction applied to a low-resolution spectrum computed on a perceptual scale) and have several invariance properties that make them relatively robust.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How is it, that if you say &quot;ooone&quot; instead of &quot;one&quot;, P(&quot;ooone&quot;|M_1) will still be the highest of the three trained HMM models? Is it because if the model was trained with 'one', the model already favors the observation that happens when the sound of 'o' is said, and the state transition of x_1 -&gt; x_1 (where x_1 is likely to emit this observation) is also favored?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, this is what happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cost of stretching the &quot;o&quot; is high, but still lower than having the emission probabilities totally wrong by matching the &quot;o&quot;s or the &quot;n&quot; that follows with other phonemes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Basically, is there some convincing proof/intuition, that pronouncing a certain word very slowly at certain parts will not cause it to be recognized incorrectly?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If the features used for the observation vector are robust, and if the model is trained on the same speaker as for recognition (or if suitable model adaptation measures are used), the emission probabilities can get very low when confusing phonemes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing that could cause confusions would be a HMM trained on utterances of &quot;five&quot; and another trained on utterances of &quot;fiiiiiiiiiiile&quot;. In this case, &quot;fiiiiiiiiiiiive&quot; might be recognized as &quot;fiiiiiiiiiiiile&quot; - the cost of repeatedly stretching the &quot;i&quot; might be enough to counterbalance the confusion from &quot;v&quot; and &quot;l&quot; on a handful of frames. So an abnormal utterance could be confused with another abnormal utterance for which a model is available. The thing is, abnormal utterances are &quot;averaged out&quot; during the training process.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;does the classification HMM operation happen at all?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For recognition, it is not relevant to know the most likely sequence of states. However, there are applications for which knowing the sequence of state is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, we sometimes want to exactly synchronize the recognized sequence with the original audio recording. This could be useful for subtitling, or recording a timestamped transcription of a recording. This is also used during Viterbi training, an alternative to the Baum-Welch algorithm that uses state decoding (classification) in the training loop.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Lastly, could some please explain how continuous speech recognition differs from this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Left-right models with a handful of states are used to describes diphones or triphones. States have hundreds to thousands mixture components (or nowadays we eschew GMMs and use other emission models). This is already a ridiculously large model space, so there are tied-states - that is to say some states in the model share the same emission probabilities with other states in the model. Anything that pools together the parameters from several parts of the model ensures that more training data will be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the triphone models are concatenated together to build word models - using pronunciation dictionaries (lexicons). The lexicon maps a word into a sequence of phones. While there are approaches to automatically learn it, this data primarily comes from linguists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then word models are concatenated together to build a language model. The result is an extremely big FST, which is not even fully composed in memory from its component - but only traversed on the fly during recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course the whole thing is not trained with Baum-Welch... We train separately each level... Tri-phone HMMs are trained on aligned speech data; lexicons are curated by linguists; language models trained separately on purely textual data...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically a small amount of aligned speech data (in which the transcription are aligned with the audio) is used to bootstrap the triphones model. Then this inexact model can be used to align a larger set of unaligned training data, and the process is iterated.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-08-22T08:22:35.297" LastActivityDate="2014-08-22T08:22:35.297" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17901" PostTypeId="2" ParentId="17898" CreationDate="2014-08-22T02:18:35.310" Score="1" Body="&lt;p&gt;Let &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_1(t) = x(t-1) ~~ \text{ for all }~ t, \tag{1}$$&#xA;that is, $h_1(t)$ is just&#xA;$x(t)$ delayed by one unit. Let $h(t)$ be the result of &quot;flipping&quot; $h_1(t)$, that is, &#xA;$$h(t) = h_1(-t) ~~ \text{ for all }~ t, \tag{2}.$$&#xA;But, $(1)$ says that $h_1(-t)$ is the same as $x(-t-1)$ for all $t$,&#xA;and so we conclude that&#xA;$h(t)$, the result of delaying $x(t)$ by one time unit and then flipping the&#xA;result gives us &#xA;$$h(t) = x(-t-1)~~ \text{ for all }~ t, \tag{3}$$&#xA;which of course is not the desired $x(-t+1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's try O&amp;amp;W's prescription. Let $g_1(t) = x(t+1)$ for all $t$&#xA;be the result of&#xA;advancing $x(t)$ by one time unit. Now flip $g_1(t)$ to get&#xA;$$g(t) = g_1(-t) = x(-t+1)$$&#xA;which is what is desired, no?&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-08-22T02:18:35.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17902" PostTypeId="2" ParentId="17894" CreationDate="2014-08-22T05:21:40.830" Score="1" Body="&lt;p&gt;Conceptually, it's straightforward. Let's consider &lt;a href=&quot;http://englishwalle.files.wordpress.com/2013/08/9-image-grid-no-logo1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;a more general case, involving a grid&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P74SQ.jpg&quot; alt=&quot;Complex image panel&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First run &lt;a href=&quot;http://en.wikipedia.org/wiki/Ridge_detection&quot; rel=&quot;nofollow noreferrer&quot;&gt;ridge detection&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Box_blur&quot; rel=&quot;nofollow noreferrer&quot;&gt;box blurring&lt;/a&gt;, then &lt;a href=&quot;http://en.wikipedia.org/wiki/Line_detection&quot; rel=&quot;nofollow noreferrer&quot;&gt;line detection&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CIJq3.png&quot; alt=&quot;First run ridge detection, and box blurring&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of this preprocessing is to make line detection more successful. Finally, partition the image vertically (only first partition shown): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WcDRn.jpg&quot; alt=&quot;First horizontal partition&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then horizontally:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e2ZFN.jpg&quot; alt=&quot;The finished result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Mathematica it can be done as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = Import[&quot;http://englishwalle.files.wordpress.com/2013/08/9-image-grid-no-logo1.jpg&quot;]&#xA;{W, H} = ImageDimensions[img]&#xA;edges = ImageConvolve[Binarize@RidgeFilter[img, 0.001], BoxMatrix[2]]&#xA;lines = ImageLines[edges, 2, 0.1]&#xA;hlines = Select[lines, Norm[#[[1]] - #[[2]]] == W &amp;amp;]&#xA;offsets = Flatten@{0, #[[1 , 2]] &amp;amp; /@ hlines, ImageDimensions[img][[2]]}&#xA;hparts = Partition[H - # &amp;amp; /@ offsets // Sort, 2, 1]&#xA;vsections = ImageTake[img, #] &amp;amp; /@ hparts&#xA;&#xA;(* Part 2 *)&#xA;hmask = ImageAdjust[ImageAdjust@RidgeFilter[Blur[#, {100, 0}], 5], 1] &amp;amp; /@ vsections&#xA;lines = ImageLines[#, 0.075, 0.25] &amp;amp; /@ hmask&#xA;vlines = #[[1, 1]] &amp;amp; /@ # &amp;amp; /@ lines&#xA;vlinesUnique = W*DeleteDuplicates@MeanShift[#, 1] &amp;amp; /@ vlines/W&#xA;vparts = Partition[Flatten[{0, Sort@#, W}], 2, 1] &amp;amp; /@ vlines_uniq&#xA;hsections = Outer[ImageTake, {#[[1]]}, {{0, W}}, #[[2]], 1] &amp;amp; /@ Transpose[{vsections, vparts}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I leave it to you to translate this into your language of choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: With your image, I had better results with a derivative filter than a ridge filter (though that worked too, but the seam was not exactly at the right place). This is what directional blurring and derivative filtering (&lt;code&gt;hmask = DerivativeFilter[Blur[img, {100, 0}], {0, 1}]&lt;/code&gt;) looks like on your image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HLjWV.jpg&quot; alt=&quot;After vertical blurring&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hVs1U.jpg&quot; alt=&quot;After derivative filtering&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Line detection works trivially after this.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2014-08-22T18:36:43.857" LastActivityDate="2014-08-22T18:36:43.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17903" PostTypeId="2" ParentId="10531" CreationDate="2014-08-22T06:53:20.983" Score="0" Body="&lt;p&gt;A very efficient algorithm to resolve the equivalence classes is the union-find algorithm. Check it as in the links below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.geeksforgeeks.org/union-find/&quot; rel=&quot;nofollow&quot;&gt;http://www.geeksforgeeks.org/union-find/&lt;/a&gt;&#xA;&lt;a href=&quot;https://www.cs.duke.edu/courses/cps100e/fall09/notes/UnionFind.pdf&quot; rel=&quot;nofollow&quot;&gt;https://www.cs.duke.edu/courses/cps100e/fall09/notes/UnionFind.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB also provides nice applications:&#xA;&lt;a href=&quot;http://blogs.mathworks.com/steve/2007/05/25/connected-component-labeling-part-6/&quot; rel=&quot;nofollow&quot;&gt;http://blogs.mathworks.com/steve/2007/05/25/connected-component-labeling-part-6/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-08-22T06:53:20.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17905" PostTypeId="2" ParentId="17891" CreationDate="2014-08-22T07:56:56.637" Score="0" Body="&lt;p&gt;Let's say you have several data sets $x_i$ and $N_i$ is the length of the $i$th data set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you're right that the amplitude of the FFT output scales with its length. To normalize all data sets they have to be divided by $N_i$. (Note that depending on the implementation of the FFT there might be a scaling involved already, check the Doc or see &lt;a href=&quot;https://dsp.stackexchange.com/questions/17864/please-give-the-reason-why-every-notation-for-dft-is-valid&quot;&gt;this question&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To combine all data sets you should append $(\max_i N_i) - N_i$ zeros to every data set before taking the FFT. The frequency axes are then aligned correctly and you can calculate the average of all FFT outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Btw, I would plot the absolute value of the FFT output, not the real part. And sometimes I find it useful to &quot;smooth&quot; the spectrum by averaging every $M$ neighbouring FFT bins. Last, I have assumed that the data of every set has been acquired at equidistant time steps, otherwise the FFT isn't applicable at all.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-08-22T07:56:56.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17906" PostTypeId="1" CreationDate="2014-08-22T07:58:28.530" Score="1" ViewCount="890" Body="&lt;p&gt;I am working on something like cartoon, but the character's mouth shape is automatically detected and matched by the word they are saying. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;my guess is to use speech recognize algorithm to analyze the wav file, and get the content(word) at the exactly moment, for the exactly word, prepare corresponding mouth shape picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it look like a dumb way... is there any convenient way to work this out? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw many games support this, how did they achieve that?&lt;/p&gt;&#xA;" OwnerUserId="10891" LastEditorUserId="13320" LastEditDate="2016-05-13T10:38:23.583" LastActivityDate="2016-05-13T10:38:23.583" Title="matching the mouth shape of an audio file(lip sync)" Tags="|audio|sound|waveform-similarity|synchronization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17907" PostTypeId="2" ParentId="17906" CreationDate="2014-08-22T08:21:11.680" Score="2" Body="&lt;p&gt;The simplest solution I can think of is to use an envelope follower, the higher the amplitude, the more open the mouth is. This is pretty simple but will one give tell you how 'open' the mouth should be, not the shape. This should already be quite effective for a cartoon. To make it more realistic you should probably try to detect vowels (Oh and Ah for instance) by measuring the formants. &lt;a href=&quot;http://en.wikipedia.org/wiki/Formant&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Formant&lt;/a&gt; gives a list of average frequency's for some vowels. Of course these are only average, so you need to experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think you need to recognize exactly which words are spoken, this will be much more complex, and there are quite a lot of words in each language, and quite a lot of languages... :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you add consonant detection as well, you probably have all the information you need...&lt;/p&gt;&#xA;" OwnerUserId="10892" LastActivityDate="2014-08-22T08:21:11.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17908" PostTypeId="1" AcceptedAnswerId="17911" CreationDate="2014-08-22T08:25:39.033" Score="2" ViewCount="1915" Body="&lt;p&gt;I have a signal $x$ which is corrupted by Gaussian noise.&#xA;The signal $x$ is convolved with a filter with coefficients $h = [1, -2, 1]$, to generate signal $y$. Now the signal is taken to Discrete Fourier Transform (DFT) domain by FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = conv(x,h);&#xA;z = fft(y);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I compensate for the modulation caused by $h$ in the DFT domain.&#xA;I have attenuated the frequency components of $x$ by the filter $h$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that to invert an FIR filtered signal, IIR filters are required.&#xA;Can I do some compensation (multiplying coefficients of $z$) on Fourier domain.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="8202" LastEditDate="2014-08-22T08:28:22.210" LastActivityDate="2014-08-22T12:32:29.587" Title="How to reconstruct the signal which is subjected to FIR filtering - Matlab" Tags="|matlab|fft|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17909" PostTypeId="1" CreationDate="2014-08-22T09:52:04.017" Score="1" ViewCount="168" Body="&lt;p&gt;It seems there are several papers from the seventies but backtracking from the references gets quickly difficult. Who calculated for the first time a time-frequency representation of a signal?&lt;/p&gt;&#xA;" OwnerUserId="10893" LastActivityDate="2022-07-03T14:49:31.240" Title="When was the time-frequency analysis invented?" Tags="|signal-analysis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17911" PostTypeId="2" ParentId="17908" CreationDate="2014-08-22T10:14:22.783" Score="3" Body="&lt;p&gt;You can if the filter does not introduce any zeros in the frequency domain, which your filter unfortunately does because its frequency response is zero for $\omega=0$. What you normally have to do is zero-pad the impulse response $h(n)$ to the same length as the result of the convolution, i.e. $y(n)$. Then you compute the DFT (FFT) of the two zero-padded sequences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(k)=DFT\{h(n)\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(k)=DFT\{y(n)\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(k)=H(k)X(k)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $X(k)$ is the DFT (FFT) of the zero-padded input signal (such that it has the same length as $y(n)$). From (1) you can compute $X(k)$ for all indices $k$ for which $H(k)\neq 0$. In your case $H(0)=0$, so you can't compute $X(0)$. You can, however, compute all other values of $X(k)$ from (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your example this means that you can determine the original time signal $x(n)$ from $X(k)$ up to its mean value. E.g., if you choose $X(0)=0$ and apply an inverse DFT you'll get the original signal but with a mean value of zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Nx = 100; x = randn(Nx,1);    % some input signal&#xA;h = [1,-2,1]'; Nh = 3;        % impulse response&#xA;y = conv(x,h);                % convolution&#xA;h0 = [h;zeros(Nx-1,1)];       % zero-padding&#xA;Y = fft(y); H = fft(h0);&#xA;X = Y(2:end)./H(2:end);       % undo filtering except for DC&#xA;X = [0;X];                    % add arbitrary DC value&#xA;x_ = real(ifft(X));           % reconstruct input signal (up to mean)&#xA;plot(x-x_(1:Nx));             % should be constant&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-22T12:32:29.587" LastActivityDate="2014-08-22T12:32:29.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17912" PostTypeId="1" CreationDate="2014-08-22T11:56:56.033" Score="0" ViewCount="71" Body="&lt;p&gt;I have two iron pipes, one bent and cracked, and one whole. On one end Ive attached a vibration motor (200hz) and on the other end Ive attached a vibration sensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do a fft and then get out the amplitudes of the different frequencies I pick up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: I want to compare the signal picked up from the broken pipe to the signal from the whole pipe, how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I calculate the &quot;total&quot; energy in the signal, by summing the amplitudes. However, this sometimes fail, especially if im testing a very broken pipe. I can reliably detect smaller damages to the pipes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlation does not work, due to the shape of the signal would be similar, but there would be small variations in the harmonics of the main signal. Also the vibration motor is 200 hz +/- 10hz approximately. Suggestions? Visual check doesnt work as I want to build a completely automated system, where a LED light turns on if the difference in the signal is above some treshhold.&lt;/p&gt;&#xA;" OwnerUserId="8990" LastActivityDate="2014-08-22T11:56:56.033" Title="Comparing vibration frequencies" Tags="|fft|frequency-spectrum|frequency-response|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17913" PostTypeId="2" ParentId="17895" CreationDate="2014-08-22T16:24:38.463" Score="1" Body="&lt;p&gt;The sound pressure level (and derived metrics such as the SPL spectrum) are dependent on the position of the listener, since it is a measure of the pressure of the wavefront moving through space. As such it doesn't make all that much sense to try to combine SPL's from different positions into a single value, except perhaps if the listeners were exactly the same distance from a single omnidirectional audio source and there was no possibility of reflections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equations you have posted are for two audio sources, not two listeners, so I am not sure they are relevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only value of any use I can imagine you being able to calculate from two listeners would be the peak SPL / spectrum, this would simply be the maximum value of both channels for any given sample.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2014-08-22T16:24:38.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17915" PostTypeId="2" ParentId="17909" CreationDate="2014-08-22T22:12:43.083" Score="4" Body="&lt;p&gt;According to the preface of &lt;a href=&quot;https://books.google.com/books?id=sjN2qq99-WwC&amp;amp;lpg=PR1&amp;amp;pg=PR1#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Foundations of Time-Frequency Analysis&lt;/a&gt;, a rough timeline is as follows:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1930 - Early development of quantum mechanics by H. Weyl, E.Wigner, and J. von Neumann.&lt;/li&gt;&#xA;&lt;li&gt;1946 - Theoretical foundation of information theory and signal analysis by D. Gabor (cf. &lt;a href=&quot;https://web.archive.org/web/20200806201955/https://ieeexplore.ieee.org/document/5298517&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Theory of communication&amp;quot;&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;1980 - Time-frequency analysis established as an independent mathematical field (apart from engineering) by Guido Janssen.&lt;/li&gt;&#xA;&lt;li&gt;1990 - Development of wavelet theory. Overview of the mutual influence given in &lt;a href=&quot;https://ieeexplore.ieee.org/document/57199&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;The wavelet transform, time-frequency localization and signal analysis&amp;quot;&lt;/a&gt; by Ingrid Daubechies.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="35" LastEditorUserId="7092" LastEditDate="2022-07-03T14:49:31.240" LastActivityDate="2022-07-03T14:49:31.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17917" PostTypeId="1" AcceptedAnswerId="17919" CreationDate="2014-08-23T04:42:01.777" Score="2" ViewCount="4151" Body="&lt;p&gt;I'm filtering a real signal with a single complex pole with a complex coefficient (a_re [real part] and a_im [imaginary part]), I also have a gain coefficient but I'm gonna leave it out for the sake of simplicity. The filter has two outputs, one for the real and another for the imaginary part. Here's the filter equation in time for both outputs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real part output: &#xA;$$y_1[n] = x_1[0] + a_{R}  y_1[-1] - a_{I} y_2[-1]$$&#xA;Imaginary part output: &#xA;$$y_2[n] = a_{I}  y_1[-1] + a_{R} y_2[-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $n$ is the sample number, $x_1[0]$ is the real input, $a_{R}$ &amp;amp; $a_{I}$ are, respectively, the real and imaginary part of the coefficient, $y_1[-1]$ is the previous output of &quot;real part output&quot; and $y_2[-1]$ is the previous output of &quot;imaginary part output&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I need to plot the frequency response based on the Z transform. I've already succeeded in dealing with the real version of all this (a real pole), and I'm struggling with the complex version. Anyway, the equation for the real pole is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = x[0] + a y[-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $a$ is the coefficient of the real pole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the Z-transform of the real pole is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tag{1}H(z) = \dfrac{1}{ 1 - a z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where, again, $a$ is the coefficient of the real pole. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my code I am solving it and dealing  with the z-transform in this way, the input of the function is the $a$ coefficient and the $\omega$ variable (which is the angular frequency in radians per sample). I'm only interested in getting the magnitude output, so I don't care about the phase response of the filter. Anyway, here is how I get it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a \rightarrow$ coefficient&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w \rightarrow$ angular frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{R} = \cos(\omega)$; $\;\;\;\;f_{I} = \sin(\omega)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{R} = 1 - a  f_{R}$; $\;\;\mathbf{I} = -a f_{I}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{Mag} = \sqrt{\mathbf{R}^{2} + \mathbf{I}^{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H = \frac{1}{\mathbf{Mag}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole thing would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tag{2}|H(z)| = \dfrac{1}{\sqrt{(1 - a \cos \omega)^2 + (-a \sin \omega)^2)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my trouble is adapting it to the complex version of this z transform, which is supposed to be the same formula as the real pole's z transform in Eq. (1), but I don't know how to adapt the formula/code for the complex pole. Bearing in mind that I want to have the frequency response of the two outputs (the real and imaginary part of the complex filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, I'd like some help on reaching the frequency response from the coefficient as a function of angular frequency as I've written above for the real pole version of this in Eq.(2)!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts, considerations, hints, help is highly welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot&lt;/p&gt;&#xA;" OwnerUserId="10896" LastEditorUserId="10896" LastEditDate="2014-11-11T02:26:25.240" LastActivityDate="2014-11-11T02:26:25.240" Title="Real and Imaginary Frequency Responses of a single complex pole" Tags="|filters|filter-design|frequency-response|z-transform|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17919" PostTypeId="2" ParentId="17917" CreationDate="2014-08-23T09:06:48.973" Score="0" Body="&lt;p&gt;If I understood you correctly you want a formula for the magnitude of the frequency response of a filter with a single complex pole. As you've already noticed, the system function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{1-az^{-1}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is valid regardless of whether $a$ is real-valued or complex-valued. Let's assume that $a=a_r+ja_i$ is a complex-valued number. If we also assume that $|a|&amp;lt;1$ (i.e. the system is causal and stable), then we get the systems frequency response by replacing $z$ by $e^{j\omega}$ in (1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\frac{1}{1-ae^{-j\omega}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you just have to compute the magnitude of (2). Using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|1-u|^2=1-2\text{Re}\{u\}+|u|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for any complex $u$, we get with $u=ae^{-j\omega}$ from (2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(e^{j\omega})|=\frac{1}{\sqrt{1-2\text{Re}\{ae^{-j\omega}\}+|a|^2}}=&#xA;\frac{1}{\sqrt{1-2(a_r\cos\omega+a_i\sin\omega)+|a|^2}}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how you can derive the transfer functions relating the real-valued input to the real part and the imaginary part of the output, respectively. Let $y(n)=y_r(n)+jy_i(n)$. Then you have the following two difference equations for the two real-valued output signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_r(n)=x(n)+a_ry_r(n-1)-a_iy_i(n-1)\\&#xA;y_i(n)=a_ry_i(n-1)+a_iy_r(n-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transforming these equations to the $\mathcal{Z}$-domain gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y_r(z)=X(z)+a_rz^{-1}Y_r(z)-a_iz^{-1}Y_i(z)\\&#xA;Y_i(z)=a_rz^{-1}Y_i(z)+a_iz^{-1}Y_r(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have two equations for the two unknowns $Y_r(z)$ and $Y_i(z)$. After some algebra you arrive at&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y_r(z)=H_r(z)X(z)=\frac{1-a_rz^{-1}}{1-2a_rz^{-1}+(a_r^2+a_i^2)z^{-2}}X(z)\\&#xA;Y_i(z)=H_i(z)X(z)=\frac{a_iz^{-1}}{1-2a_rz^{-1}+(a_r^2+a_i^2)z^{-2}}X(z)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that even though&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=H_r(e^{j\omega})+jH_i(e^{j\omega})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_r(e^{j\omega})$ and $H_i(e^{j\omega})$ are not the real and imaginary parts of the total frequency response $H(e^{j\omega})$ of the complex-valued system because they are both themselves complex-valued. You can obtain the magnitudes of the frequency responses by computing the magnitudes of $H_r(e^{j\omega})$ and $H_i(e^{j\omega})$ as given in (4), i.e. by replacing $z$ by $e^{j\omega}$ and computing the magnitudes of the two complex functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to express the frequency responses $H_r(e^{j\omega})$ and $H_i(e^{j\omega})$ using the total frequency response $H(e^{j\omega})$ (2):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_r(e^{j\omega})=\frac12[H(e^{j\omega})+H^*(e^{-j\omega})]\\&#xA;H_i(e^{j\omega})=\frac{1}{2j}[H(e^{j\omega})-H^*(e^{-j\omega})]\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (5), the magnitudes can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H_r(e^{j\omega})|=\frac{1}{2}\sqrt{|H(e^{j\omega})|^2+2\text{Re}\{H(e^{j\omega})H(e^{-j\omega})\}+|H(e^{-j\omega})|^2\}}\\&#xA;|H_i(e^{j\omega})|=\frac{1}{2}\sqrt{|H(e^{j\omega})|^2-2\text{Re}\{H(e^{j\omega})H(e^{-j\omega})\}+|H(e^{-j\omega})|^2\}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $|H(e^{j\omega})|$ is given by (3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some Matlab/Octave code using equation (4) to plot the different transfer functions. $|H_r(e^{j\omega})|$ and $|H_i(e^{j\omega})|$ are of course symmetrical because they correspond to real-valued systems, whereas $|H(e^{j\omega})|$ is not due to the complex pole.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w = linspace(0,2*pi,300);          % frequency vector&#xA;ar = .4; ai = -.3; a = ar+j*ai;    % complex pole&#xA;u = exp(-j*w);                     % u = z^(-1)&#xA;Hr = (1-ar*u)./(1-2*ar*u+(ar^2+ai^2)*u.^2);&#xA;Hi = (ai*u)./(1-2*ar*u+(ar^2+ai^2)*u.^2);&#xA;H = 1./(1-a*u);&#xA;plot(w/pi,abs(Hr),w/pi,abs(Hi),w/pi,abs(H))&#xA;legend('Hr', 'Hi', 'H');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GxvSF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to split the numerators and denominators of (4) into real and imaginary parts, here's what you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_r(e^{j\omega})=\frac{1-a_r\cos\omega+ja_r\sin\omega}{\left[1-2a_r\cos\omega+(a_r^2+a_i^2)\cos(2\omega)\right]+j\left[2a_r\sin\omega-(a_r^2+a_i^2)\sin(2\omega)\right]}\\&#xA;H_i(e^{j\omega})=\frac{a_i\cos\omega-ja_i\sin\omega}{\left[1-2a_r\cos\omega+(a_r^2+a_i^2)\cos(2\omega)\right]+j\left[2a_r\sin\omega-(a_r^2+a_i^2)\sin(2\omega)\right]}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-24T16:32:00.640" LastActivityDate="2014-08-24T16:32:00.640" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="17920" PostTypeId="1" AcceptedAnswerId="17921" CreationDate="2014-08-23T09:30:25.347" Score="-1" ViewCount="547" Body="&lt;p&gt;As explained in &lt;a href=&quot;http://www.ni.com/white-paper/4450/en/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Gold sequences help generate more sequences out of a pair of&#xA;  m-sequences giving now many more different sequences to have multiple&#xA;  users. Gold sequences are based on preferred pairs m-sequences.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For example, take the polynomials $x^5+x^2+1$ and&#xA;  $x^5+x^4+x^3+x^2+x+1$:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QQvdK.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;By combining two of these sequences, we can obtain up to 31 plus the two m-sequences themselves, generate 33 sequences.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I do understand why there are 31 ($2^5 - 1$) sequence length for a single m-sequence, but I am not sure why there are $2^5 + 1$ for the gold sequence.&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2014-08-23T10:01:02.477" LastActivityDate="2014-08-23T15:30:35.207" Title="Why does a gold sequence have $2^m + 1$ symbols while a single m-sequence has only $2^m - 1$" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17921" PostTypeId="2" ParentId="17920" CreationDate="2014-08-23T09:53:07.083" Score="2" Body="&lt;p&gt;You have the preferred pair, each of length $2^m-1$. The other sequences are generated by modulo-2 addition of one of these sequences with cyclical shifts of the other sequence. There are $2^m-1$ possible shifts, so you get $2^m-1$ new sequences from the modulo-2 additions (one for each possible shift). And you still have the two original sequences of the preferred pair giving a total of $2^m-1+2=2^m+1$ sequences.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-23T09:53:07.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17922" PostTypeId="1" CreationDate="2014-08-23T13:33:46.230" Score="0" ViewCount="39" Body="&lt;p&gt;I'm analysing the frequencies of something I'm recording (whistling), which is resulting like this (yes, it's super mario bros' beginning song:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aB36Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to filter it to make it remain like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k77id.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in order to convert them as MIDI notes after the processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I do it ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried with a simple low-pass filter but it doesn't work very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm already rounding it when passing to MIDI:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7mk7B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and sometimes it goes on + - 1 note.&lt;/p&gt;&#xA;" OwnerUserId="10898" LastEditorUserId="10898" LastEditDate="2014-08-23T13:51:49.440" LastActivityDate="2014-08-23T13:51:49.440" Title="What filter should I pass to these signals to make them constant on every piece" Tags="|filters|frequency-spectrum|frequency|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17925" PostTypeId="1" CreationDate="2014-08-23T19:09:52.890" Score="5" ViewCount="2564" Body="&lt;p&gt;I created a sinusoidal wave in some noise, and plotted the power spectrum of the signal using two periodogram estimates (welch procedure). One estimate is 'high resolution' - i.e. it uses a longer window than the corresponding 'low resolution' estimate. The result and code used to generate it are shown below. For reference: the y-axis will have units of |signal|^2 and the x-axis are just FFT samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: From the plot, it would appear that there is overall more power content in the low resolution (red) plot, although this is obviously not the case, the input signal is the same in both cases. This poses some questions about how we compare signals, it seems it is critical to use the same parameter values (like window lengths) when comparing the energy content of different signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, I do understand that the length of the window in the welch estimate will determine the resolution of my spectrum, and that the number of FFT points used will determine the smoothness of my output, which has nothing to do with resolution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HMrKO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;&#xA;t = 0:1/Fs:1-1/Fs;&#xA;x = cos(2*pi*100*t)+randn(size(t));&#xA;&#xA;nWindow1 = 100;&#xA;noverlap1 = 0*nWindow1;&#xA;nfft1 = 1000;&#xA;[pxx1, f1] = pwelch(x,hann(nWindow1), noverlap1, nfft1, Fs, 'centered', 'power');&#xA;&#xA;nWindow2 = 1000;&#xA;noverlap2 = 0*nWindow2;&#xA;nfft2 = 1000;&#xA;[pxx2, f2] = pwelch(x,hann(nWindow2), noverlap2, nfft2, Fs, 'centered', 'power');&#xA;&#xA;figure&#xA;hold on&#xA;plot(f1, 10*log10(pxx1),'r')&#xA;plot(f2, 10*log10(pxx2),'b')&#xA;legend('Low Resolution Estimate', 'High Resolution Estimate')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5466" LastActivityDate="2015-10-05T19:32:37.787" Title="Why is level of power spectrum dependent on FFT resolution?" Tags="|matlab|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17926" PostTypeId="1" AcceptedAnswerId="17927" CreationDate="2014-08-23T20:35:24.627" Score="1" ViewCount="501" Body="&lt;p&gt;I don't understand how this works. Help would be really appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we have a 10 second sound input, we make a feature vector every 10ms - so we have 1000 vectors - $\mathbf{o}=o_1, \cdots,o_{1000}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity, let's say that all we want to know, is what sequence of phones $p=p_1,\cdots,p_n$ is the answer to $\text{argmax } P(o|p)$ for $p$, or at least what's a good estimate/close answer. For all phones, we have a seperate left to right HMM model (I think that's what makes sense in this scenario).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly is this done? &#xA;Will similar enough vectors be &quot;put together&quot; and only treated as 1?&#xA;The input is probably not one phone or a thousand phones - but we don't know that... so for what $p$ will $P(o|p)$ be computed?&lt;/p&gt;&#xA;" OwnerUserId="10888" LastEditorUserId="1629" LastEditDate="2014-08-24T00:36:21.003" LastActivityDate="2014-08-24T00:36:21.003" Title="Continuous speech recognition with HMM" Tags="|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17927" PostTypeId="2" ParentId="17926" CreationDate="2014-08-23T21:16:14.660" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Will similar enough vectors be &quot;put together&quot; and only treated as 1?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, this is not how it is done.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;so for what p will P(o|p) be computed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your assumption that recognition is performed by considering one by one all possible phone or word sequences and scoring them is wrong. For just a few seconds of speech the number of possible words would be extremely large! This approach - scoring each candidate model among the entire space and picking up the one with the largest score, is actually used only for some small vocabulary / single-word applications (say recognizing several options on a voice menu). I think this confusion stems from the fact that the classic Rabiner tutorial on HMM makes a lot of sense for finite-vocabulary applications, but stays away from all the difficulties/technicalities of continuous applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In continuous speech recognition there are several layers on top of the phones models. Phone models are joined together to form words models, and words models are joined together to form a language model. The recognition problem is formulated as searching the path of least cost through this graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One could do the same by piecing together HMMs, though... Let's take a simpler example... You have 5 phones and you want to recognize any sequence of them (no words models, no language models - let's consider meaningless speech for this example). You train one left-right HMM per phone, say 3 or 4 states - maybe on clean individual recordings of each phone. To perform continuous recognition, you build a big HMM by adding transition states between the last state of each phone and the first state of each phone. Performing recognition with this new model is done by finding the most likely sequence of states given the sequence of observation vectors - with the Viterbi algorithm. You will know exactly which sequence of states (and thus phones) is the most compatible with the observation. Practically, things are never done this way, and this is why I downplayed in my previous reply the importance of Rabiner's &quot;problem 2&quot;: in a true continuous application, the size of the vocabulary is such that considering this giant HMM made of all possibles connections between phones to make words, and words to make sentences would make the naive use of the Viterbi algorithm impossible. We stop reasoning in terms of HMM and we start thinking in terms of FST.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-08-23T21:16:14.660" CommentCount="19" ContentLicense="CC BY-SA 3.0" />
  <row Id="17928" PostTypeId="1" AcceptedAnswerId="17940" CreationDate="2014-08-23T21:53:26.617" Score="0" ViewCount="145" Body="&lt;p&gt;do any of you know how to convert a FM index to a phase mod index equivalent considering they both have the same carrier and modulator frequency? Is it even possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in respect for sound synthesis and I'm talking about one sinusoid modulating another sinusoidal oscillator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm being able to get very similar sounds with these parameters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FM: carrier freq 200Hz, modulator freq 480Hz, index 400*&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;this means the carrier freq oscillates 400Hz up then back to original frequency and then down 400Hz and back 480 times a second&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Phase Mod: carrier freq 200Hz, modulator freq 480Hz, index pi/4 **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;** this index means the phase goes up 1/8 of a cycle and then back, down the same amount and back to the original point&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FM and Phase Mod are clearly two independent processes, but I've seen people mention it can be equivalent, but I've never read anything that would tell me how to get the same results with both. So I don't know if it can really be done even if it sounds practically the same thing or if I just got lucky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks &lt;/p&gt;&#xA;" OwnerUserId="10896" LastActivityDate="2014-08-24T20:37:06.290" Title="phase mod x freq mod equivalence" Tags="|modulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17929" PostTypeId="1" CreationDate="2014-08-24T04:27:11.463" Score="2" ViewCount="1016" Body="&lt;p&gt;One way to describe a practical integrator (&quot;leaky integrator&quot;) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s) = \frac{g R}{1 + sRC}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand how to choose the values $g$, $R$ and $C$ because in practice, I will have constraints on them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my attempt: Suppose for a moment, that $R \rightarrow \infty$, then it becomes an ideal integrator&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s) = \frac{g}{sC}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I just look at this equation (or look it its time domain version) it seems that g and C do not matter because it's just a scalar. Do I understand it correctly that $g/C$ relates to saturation (practically, there is a maximum output value). Suppose I want to implement a finite integration:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_i = \frac{g}{C} \int_0^{T_w} x(t) \, dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I know that $x(t)$ and $x_i$ can have a maximum value of $K$.&#xA;Then I could derive (to avoid saturation in the worst case):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;K &amp;lt; \frac{g}{C} T_w K \Rightarrow \frac{g}{C} &amp;gt; T_w&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would restrict the ratio between $g$ and $C$. Does this make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back to the non-ideal integrator used for a finite integration interval. In this case, $1/RC$ can be interpreted as the first pole and after this frequency, the ideal integrator starts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I integrate over a finite period $T_w$, is it valid to say that the lowest integrateable frequency is $1/T_w$ and hence $1/RC \ll 2\pi/T_w$ ?&lt;/p&gt;&#xA;" OwnerUserId="10514" LastEditorUserId="10514" LastEditDate="2015-04-07T18:38:36.980" LastActivityDate="2015-04-07T18:38:36.980" Title="Designing a practical integrator" Tags="|filters|analog|integration|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17930" PostTypeId="1" AcceptedAnswerId="17944" CreationDate="2014-08-24T06:24:05.217" Score="1" ViewCount="757" Body="&lt;p&gt;I am confused about the need to change color space for color comparison. I have read about delta E, the Lab format, and I do understand that comparisons in the RGB color space will not seem appropriate to the human eye. However, my program uses a linear color scale to calculate velocity, from a color flow Doppler signal. It takes the mean color of a sample region and compares it to the colors of the scale to find its nearest neighbor using Euclidian distance. I do that entirely in the BGR (OpenCV) color space, as the example image below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ARCU8.png&quot; alt=&quot;example signal image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, I obtain seemingly correct velocity values for each color circle, but is it only by chance, or &lt;strong&gt;is my assumption correct that since the color comparisons take place internally, it does not matter what color space I am in?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="7213" LastActivityDate="2014-08-25T07:08:20.717" Title="Is a change in colorspace needed when comparing colors only evaluated by the computer?" Tags="|opencv|color|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17931" PostTypeId="1" CreationDate="2014-08-24T07:22:51.540" Score="1" ViewCount="88" Body="&lt;p&gt;A) What are the most common methods used to remap data for current generation imaging radars and acoustic sensors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B) What are some of the pitfalls in these methods?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the past,  at least, cubic splines have been used to map slant-range image data from synthetic aperture radar to a uniform &quot;ground&quot; grid. This can introduce spurious signals in ocean wave spectra.&lt;/p&gt;&#xA;" OwnerUserId="10450" LastEditorUserId="128" LastEditDate="2023-07-16T09:08:01.417" LastActivityDate="2023-07-16T09:08:01.417" Title="Interpolation methods for radar and acoustic imaging and potential pitfalls" Tags="|image-processing|signal-analysis|interpolation|radar|spatial|" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17932" PostTypeId="1" AcceptedAnswerId="17976" CreationDate="2014-08-24T08:03:23.493" Score="0" ViewCount="9810" Body="&lt;p&gt;I want to find points (of a processed image) that are the brightest in their local region. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I want all of the points whose 8 neighbors are all smaller but I want to have brighter maxima block out nearby dimmer maxima. So, for example, the 8-neighbor maximas could be sorted by descending brightness then yielded in order while excluding points covered by previously-yielded points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to implement this logic, but because I'm using python there's a huge runtime speed advantage to using built-in opencv/numpy functions.&lt;/p&gt;&#xA;" OwnerUserId="10155" LastEditorUserId="7338" LastEditDate="2017-06-15T15:51:17.387" LastActivityDate="2017-06-15T15:51:17.387" Title="Finding local brightness maximas with OpenCV" Tags="|image-processing|opencv|local-features|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17933" PostTypeId="2" ParentId="17932" CreationDate="2014-08-24T08:22:40.647" Score="1" Body="&lt;p&gt;A really simple strategy I'm using at the moment, though not particularly fast, is to just roll-and-max the image against itself (I think this might be equivalent to dilating the image?). This basically replaces every pixel with a nearby maximum, and so a pixel not equal to itself after roll-and-max'ing can be excluded.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def findIsolatedLocalMaxima(greyScaleImage):&#xA;    squareDiameterLog3 = 3 #27x27&#xA;&#xA;    total = greyScaleImage&#xA;    for axis in range(2):&#xA;        d = 1&#xA;        for i in range(squareDiameterLog3):&#xA;            total = np.maximum(total, np.roll(total, d, axis))&#xA;            total = np.maximum(total, np.roll(total, -d, axis))&#xA;            d *= 3&#xA;&#xA;    maxima = total == greyScaleImage&#xA;    h,w = greyScaleImage.shape&#xA;&#xA;    result = []&#xA;    for j in range(h):&#xA;        for i in range(w):&#xA;            if maxima[j][i]:&#xA;                result.append((i, j))&#xA;    return result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10155" LastEditorUserId="10155" LastEditDate="2014-08-24T22:25:48.783" LastActivityDate="2014-08-24T22:25:48.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17934" PostTypeId="1" CreationDate="2014-08-24T10:03:33.257" Score="0" ViewCount="728" Body="&lt;p&gt;Correct me please if I am wrong...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have just started working in the domain of signal processing using the Fourier Transform ($\mathbf{FFT}$) and Power Spectral Density ($\mathbf{PSD}$). I am trying to adjust the Frequency Response Function ($\mathbf{FRF}$) so that response $Y$ computed using relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{FFT}(Y)=\mathbf{FRF} \cdot \mathbf{FFT}(X)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;match with actual response. $X$ is the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was successful in determining $\mathbf{FRF}$ of system concerned. Then I realized that the input signal used ($X$) is a random one. Literature suggested that instead of above approach $\mathbf{FRF}$ should be obtained by using power spectral density approach, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{PSD}(Y)=|\mathbf{FRF}|^2 \cdot \mathbf{PSD}(X)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I adjusted the Frequency Response Function to match actual $\mathbf{PSD}(Y)$ with $\mathbf{PSD}(Y)$ computed by $|\mathbf{FRF}|^2 \cdot \mathbf{PSD}(X)$. FRF obtained by this approach is much different from FRF obtained by FFT approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PSD was determined by FFT of autocorrelation of a signal, as it was simple for me to code. Signal is collected once, one realization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Do $$\mathbf{FFT}(Y)=\mathbf{FRF} \cdot \mathbf{FFT}(X)$$and&#xA;$$\mathbf{PSD}(Y)=|\mathbf{FRF}|^2 \cdot \mathbf{PSD}(X)$$ give same FRF for same input $X$ and response $Y$?&lt;/li&gt;&#xA;&lt;li&gt;If yes then what could have gone wrong in my case?&lt;/li&gt;&#xA;&lt;li&gt;If no then what are reasons for difference?&lt;/li&gt;&#xA;&lt;li&gt;Is there any connection between these to relations (FFT and PSD).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Dinesh Zanwar,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nagpur, India&lt;/p&gt;&#xA;" OwnerUserId="10900" LastEditorUserId="8202" LastEditDate="2014-08-24T10:35:57.960" LastActivityDate="2016-07-26T03:40:09.497" Title="Equivalence of FFT and PSD based output based on the Frequency Response Function" Tags="|autocorrelation|power-spectral-density|transfer-function|system-identification|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17935" PostTypeId="1" CreationDate="2014-08-24T16:33:47.160" Score="0" ViewCount="663" Body="&lt;p&gt;Ok, I'm new to the whole Dsp thing, so sorry if the question is a lame one&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to extract frequencies from a signal provided by a radio Device (Win Radio G31DDC- IFstream).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The radio provides a 16-bit  signal stream with 50MHz bandwidth and 100MHz sample rate.&#xA;when I set my FFT length to 32768 everything seems to work fine and the spectrum view is very similar to bundled application with radio, however the precision of 3051.75Hz (100Mhz/32768) is not enough for my needs, so I increased FFT length to 65536, but at this length I got mirrored data in real part of FFT result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose I should be able to increase the length to provided sample rate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using NAudio.DSP library for FFT calculations and using Hamming window with length of FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_fftLength=32768;&#xA;_m = (int) Math.Log(_fftLength, 2.0);&#xA;&#xA;for (var n = 0; n &amp;lt; e.RawData.Length; n ++)&#xA;{&#xA;   var r=e.RawData[n];&#xA;   var i=0;&#xA;&#xA;   _fftBuffer[n].X = (float) (r*FastFourierTransform.HammingWindow(n,_fftLength));&#xA;   _fftBuffer[n].Y=i;&#xA;}&#xA;&#xA;FastFourierTransform.FFT(true, _m, _fftBuffer);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6DwsK.png&quot; alt=&quot;FFT with length 32768&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nhAjy.png&quot; alt=&quot;FFT with length 65536&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain what I'm doing wrong here, please?&lt;/p&gt;&#xA;" OwnerUserId="10903" LastActivityDate="2014-08-24T16:33:47.160" Title="Get Mirrored FFT Results in Real part" Tags="|fft|frequency-spectrum|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17936" PostTypeId="1" AcceptedAnswerId="17938" CreationDate="2014-08-24T17:14:31.540" Score="0" ViewCount="986" Body="&lt;p&gt;In Welch or Bartlett method, original signal is divided into L segments, of D overlapping (D=0 in Bartlett method). Then FFT is done for each segment, and the result is the average of all segments' FFTs. Averaging reduces the variance. But apart from this effect, is there anything else to take into account when choosing the number of segments for a given signal?&lt;/p&gt;&#xA;" OwnerUserId="8825" LastActivityDate="2014-08-24T17:46:25.033" Title="Effect of number of data segments in Periodogram-based PSD" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17938" PostTypeId="2" ParentId="17936" CreationDate="2014-08-24T17:46:25.033" Score="2" Body="&lt;p&gt;If you increase the number of segments for a fixed total signal length, each segment becomes shorter. This means that you'll have a trade-off between the estimate's variance and the frequency resolution. Averaging many segments will reduce the variance but by using shorter windows, the ability to resolve closely spaced narrow band components is decreased. Shorter windows also decrease the peak amplitudes of any narrow band component. Shorter windows basically average out any details in the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-24T17:46:25.033" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17939" PostTypeId="2" ParentId="16516" CreationDate="2014-08-24T18:41:29.813" Score="1" Body="&lt;p&gt;There is a MATLAB code available for the Stockwell transform &lt;a href=&quot;http://scien.stanford.edu/pages/labsite/2008/psych221/projects/08/AdamWang/project_report.htm&quot; rel=&quot;nofollow&quot; title=&quot;check the appendix&quot;&gt;here&lt;/a&gt;. It also includes a code for the one-dimensional transform but it is less efficient that the Mathworks file exchange code that is mentioned in the question. This is because one uses for loops and the other doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this 2D S-transform function, you can quickly run into memory issues. You can easily modify the code to specify the exact positions of x and y that you need, so that S is not 4 dimensional.&lt;/p&gt;&#xA;" OwnerUserId="8548" LastActivityDate="2014-08-24T18:41:29.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17940" PostTypeId="2" ParentId="17928" CreationDate="2014-08-24T20:37:06.290" Score="0" Body="&lt;p&gt;phase is the integral (w.r.t. time) of frequency.  and they are definitely &lt;strong&gt;not&lt;/strong&gt; two independent processes.  back in, i dunno, the 30s, Armstrong implemented FM for the first time using AM and a synchronized carrier that was 90° out of phase with the AM.  so he was first accomplishing phase modulation (PM) out of AM (for which they had the existing technology - they didn't really have VCOs back in that day), then he implemented FM out of the PM by integrating the audio modulation signal and applying that to the PM modulation input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is all in a basic communications systems textbook like that of AB Carlson.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-08-24T20:37:06.290" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="17941" PostTypeId="1" CreationDate="2014-08-24T23:49:01.743" Score="1" ViewCount="700" Body="&lt;p&gt;I am currently reading Chapter 5, Applications to the Gas Markets, in &lt;em&gt;Stochastic Modelling of Electricity and Related Markets&lt;/em&gt; by Benth, Benth and Koekebakker, World Scientific, 2008.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the subchapter 5.3.1 Kalman filtering they assume that the detrended and deseasonalized logarithmic spot price dynamics for gas follow the process $X_1(t) + X_2(t)$ with&#xA;$$dX_i(t) = -\alpha_i X_i(t) + \sigma_i dB_i(t)$$&#xA;for $i=1,2$ with two independent Brownian motions $B_1, B_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They cite Barlow, Gusev and Lai, 2004, which have shown that the confidence bands on the mean reversion estimates are quite wide. For this reason, they are proposing to use the empirical ACF to estimate the mean reversion parameters, assuming stationarity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stationary ACF of $X_1(t) + X_2(t)$ is given by&#xA;$$ \rho(\tau) = \hat{\omega}_1 e^{-\alpha_1 \tau} + \hat{\omega}_2 e^{-\alpha_2 \tau}$$&#xA;with the lag $\tau$ and the coefficients&#xA;$$\hat{\omega}_i = \frac{\frac{\sigma_i^2}{2\alpha_i}}{\frac{\sigma_1^2}{2\alpha_1}+\frac{\sigma_2^2}{2\alpha_2}}$$&#xA;for $i=1,2$. Using least squares they arrive at the values $\hat{\omega}_1 = 0.73$, $\hat{\omega}_2 = 0.27$, $\alpha_1 = 0.02$, $\alpha_2 = 0.28$. Using&#xA;$$\sigma_i^2 = 2\alpha_i \times \text{Var}(X_1(t)+X_2(t))$$&#xA;for $i = 1,2$ and estimating $\text{Var}(X_1(t)+X_2(t))$ to be $0.11$ they get as a starting point for the Kalman filter $\sigma_1 = 0.057$ and $\sigma_2 = 0.129$, which then yields $\hat{\sigma}_1 = 0.065$ and $\hat{\sigma}_2 = 0.573$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can the difference between the Kalman filter estimates $\hat{\sigma}_1$ and $\hat{\sigma}_2$  and the implicit least squares ACF values for $\sigma_1$ and $\sigma_2$ be explained? Where does it come from and why would the Kalman filter estimate be the right one in contrast to the ACF least squares estimate? In general, is the difference large?       &lt;/p&gt;&#xA;" OwnerUserId="10907" LastActivityDate="2015-10-20T00:49:26.617" Title="Kalman Filter Estimate vs ACF Least Squares Estimate" Tags="|autocorrelation|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17942" PostTypeId="2" ParentId="17941" CreationDate="2014-08-25T01:52:58.677" Score="1" Body="&lt;p&gt;As noted on p. 11 of this site: &lt;a href=&quot;http://www.pages.drexel.edu/~pyo22/mem640/lecture04-Estimation/mem640Lecture-Estimation.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.pages.drexel.edu/~pyo22/mem640/lecture04-Estimation/mem640Lecture-Estimation.pdf&lt;/a&gt;  least squares is a &quot;special&quot; case of Kalman Filtering. Additional details can also be found on other web sites, such as: &lt;a href=&quot;http://www.insidegnss.com/node/3445&quot; rel=&quot;nofollow&quot;&gt;http://www.insidegnss.com/node/3445&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, as noted in both links above - although least squares is a special case of Kalman Filtering - the two algorithms differ from each other.  Note that the 'weighting matrix' W reduces to the identity matrix in the least squares case.  So you might expect that the results would also differ when you process the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to which one will be more accurate - it all depends on how closely the 'signal processing model' of your algorithm matches the process that generates your input data.  I've programmed Kalman Filters whose results were completely wrong because: 1) it started with a bad first guess, or 2) the state model being used was wrong, or 3) the input data was far too noisy.  I've also programmed 'hypothesis testing' arrays of Kalman Filters, where all filters operated on the same data, but each filter was set up to match a particular target motion (ie: zig right, zig left, go straight, etc.) - in that case, only the filter that closely predicted the actual input data was the correct one (ie: residuals were very small), and the residuals of all the others were way out of range.&lt;/p&gt;&#xA;" OwnerUserId="1926" LastEditorUserId="1926" LastEditDate="2014-08-25T19:37:52.330" LastActivityDate="2014-08-25T19:37:52.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17943" PostTypeId="2" ParentId="17834" CreationDate="2014-08-25T04:47:55.703" Score="0" Body="&lt;p&gt;I haven't seen this answer here, so I'll post it.  You can resample the signal to a lower sample rate before doing the FFT, which reduces the size of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know that the only frequencies that you are interested in are from 0..1000Hz, you can safely resample the original signal to an FS of 2000Hz and then do the FFT.  This decreases the required FFT by a factor of 2 for the higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the 10Hz divisions, resample the original signal again to an FS of 200Hz, and do the same FFT on the result to get your results from 0..100Hz.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resampling the signal first increases the frequency resolution for the same size FFT, by limiting the FFT to only the frequencies you are interested in.  It effectively increases the length of the FFT over the lower frequencies while throwing out the higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case:&#xA;Input signal 4000Hz.&#xA;Resample to 2000Hz and use FFT of size 64 gives a resolution of 2000/64 or 31.25Hz.&#xA;Resample to 200Hz and use FFT of size 64 gives a resolution of 200/64 or 3.125Hz.&lt;/p&gt;&#xA;" OwnerUserId="3985" LastEditorUserId="3985" LastEditDate="2014-08-25T08:32:42.280" LastActivityDate="2014-08-25T08:32:42.280" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17944" PostTypeId="2" ParentId="17930" CreationDate="2014-08-25T07:08:20.717" Score="1" Body="&lt;p&gt;Delta E color difference formula is based on CIELAB color space and human perception. To convert from RGB to CIELAB space, you would need a base whitepoint (standard illuminant) which in this situation you do not have and need. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your assumption is correct. You do not specifically need to have a color difference similar to human perception. Additionally color distance metric should be based on your needs (you can use weighting depending on your needs).&lt;/p&gt;&#xA;" OwnerUserId="8423" LastActivityDate="2014-08-25T07:08:20.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17946" PostTypeId="2" ParentId="14003" CreationDate="2014-08-25T10:24:10.543" Score="1" Body="&lt;p&gt;Audio volume is usually measured in decibels (a logarithmic scale) precisely because there's such a wide range of input energies. But in your case, it's unlikely that you need volume at all. What you need is relative volume: what fraction of the total energy in the signal is in each FFT bin? Since the energy in each FFT bin is positive, it follows that the relative contribution of each FFT bin is strictly in the range [0,1]. Multiply by 2, subtract 1, and you're in the correct range. And as a bonus, the extremes of the range are quite unlikely in practice.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-08-25T10:24:10.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17947" PostTypeId="1" CreationDate="2014-08-25T15:41:48.137" Score="0" ViewCount="850" Body="&lt;p&gt;My Matlab FFT plot keeps showing the mirrored values of my frequency of interest. In this example I am looking for 250Hz with a 3200Hz sampling freq.  The FFT plots my value at 266Hz as well as 1330 Hz.  I assume my sampling freq is a little off which is why it isn't exactly at 250Hz.  Matlab code is below, any help is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Tmax = (N-1)*Ts&#xA;% largest freq = Fs/2&#xA;% smalles = -fs/2&#xA;&#xA;fid = fopen('250Hz.bin');&#xA;AA = fread(fid, 'short');&#xA;length(AA);&#xA;flenbytes = ftell(fid);&#xA;flenshorts = floor(flenbytes/2);&#xA;FF = floor(flenshorts/16)*16;&#xA;fseek(fid,0, 'bof');&#xA;BB = fread(fid, [8 (FF/8)], 'short');&#xA;CC = BB';&#xA;DataSet = CC ./2^3;&#xA;Z1Axis = DataSet(:,4);&#xA;&#xA;N = length(DataSet)&#xA;Fs = 3200;&#xA;ts = 1/Fs;&#xA;tmax = (N-1)*ts; &#xA;t = 0:ts:tmax;  %start at 0 increment by ts up to tmax&#xA;plot(t,Z1Axis)&#xA;&#xA;f = (0:N-1)*(Fs/N)/2; % start with -Fs/2, increment by Fs/(N-1), goes to Fs/2&#xA;z = fft(Z1Axis);&#xA;%zreal =&#xA;%plot(f,z)&#xA;plot(f,abs(z));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10912" LastEditorUserId="1606" LastEditDate="2014-08-25T15:48:05.073" LastActivityDate="2014-08-25T16:09:35.157" Title="Matlab FFT keeps plotting mirrored values" Tags="|matlab|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17948" PostTypeId="2" ParentId="17947" CreationDate="2014-08-25T16:09:35.157" Score="1" Body="&lt;p&gt;It is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_real-input_DFT&quot; rel=&quot;nofollow&quot;&gt;mathematical property of the DFT&lt;/a&gt; that its output is conjugate symmetric if its input is real-valued. That means that for the magnitude of the DFT output signal $X_k$ of length $N$ it holds&#xA;$$&#xA;|X_{N-k}| = |X_k|.&#xA;$$&#xA;So what you see is to be expected. (In your example $3200\,\mathrm{Hz}/2 - 266\,\mathrm{Hz}\approx1330\,\mathrm{Hz})$ If you're only interested in the positive frequencies, just plot the first $N/2$ elements of the DFT output, the rest is redundant.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-08-25T16:09:35.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17950" PostTypeId="1" CreationDate="2014-08-25T17:53:24.183" Score="-1" ViewCount="336" Body="&lt;p&gt;Let's talk about a standard saturation model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Iz6Un.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with bounds $bound_{lower}$ and $bound_{upper}$. So in this example the output $y$ will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation} &#xA;	y(u) = &#xA;	\begin{cases}&#xA;    	bound_{lower} &amp;amp; u &amp;lt; bound_{lower} \\&#xA;        u             &amp;amp; bound_{lower} \leqslant u \leqslant bound_{upper} \\&#xA;        bound_{upper} &amp;amp; u &amp;gt; bound_{upper} \\&#xA;	\end{cases}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can use a describing function to describe the magnitude of such nonlinear system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a symmetric saturation model (i.e. the $bound_{lower} = -\delta$ and $bound_{uppwer} = \delta$  for some given constant $\delta$), the describing function, $N(a)$ for it is simple:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation} &#xA;	N(a) = &#xA;	\begin{cases}&#xA;    	1 &amp;amp;a \leqslant \delta \\&#xA;    	\frac{1}{\pi}(2\alpha + \sin(2\alpha)) \quad &amp;amp;a &amp;gt; \delta&#xA;	\end{cases}&#xA;\end{equation}&#xA;where $\alpha = \arcsin(\delta/a)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what is a describing function for a non-symmetric saturation model? In this case, $bound_{lower} = \delta_1$ and $bound_{uppwer} = \delta_2$ with $\delta_2 &amp;gt; \delta_1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, the case I am interested is for the case of $\delta_1 = 0$ and $\delta_2$ being some positive value.&lt;/p&gt;&#xA;" OwnerUserId="8600" LastEditorUserId="8600" LastEditDate="2014-08-25T18:19:28.460" LastActivityDate="2014-08-28T11:49:22.550" Title="Describing Function for non-symmetric Saturation Model" Tags="|signal-analysis|control-systems|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17951" PostTypeId="1" CreationDate="2014-08-25T22:32:49.520" Score="1" ViewCount="54" Body="&lt;p&gt;I have 20 audio recordings (raw format) of people reciting the same ~50 word transcript. I would like to use audio signal analysis to decode speaker gender from audio recording. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, it seems I need to align the audio signals and then cluster them. Assuming this is correct,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For alignment, would you recommend cross-correlation?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For clustering, would you recommend principal component analysis vs independent coordination analysis?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="10917" LastActivityDate="2014-08-26T02:10:33.930" Title="How to decode speaker gender from spoken transcript" Tags="|signal-analysis|cross-correlation|ica|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17952" PostTypeId="1" CreationDate="2014-08-26T00:19:35.290" Score="0" ViewCount="84" Body="&lt;p&gt;I'm making an interpolator (filter) to remove aliasing but this doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see also some strange behaviour: &lt;code&gt;x[i - j]&lt;/code&gt;, but what if &lt;code&gt;j &amp;gt; i&lt;/code&gt;? I simply followed FIR definition but still don't understand why this doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;const size_t M = 200;&#xA;double h[M + 1]; // h is filled with coeff&#xA;&#xA;inline void process(double* x, double* y, size_t len)&#xA;{&#xA;    for (size_t i = 0; i &amp;lt; len; ++i)&#xA;    {&#xA;        y[i] = 0.;&#xA;        for (size_t j = 0; j &amp;lt; M + 1; ++j)&#xA;        {&#xA;            y[i] = y[i] + x[i - j] * h[j];&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10920" LastEditorUserId="8202" LastEditDate="2014-08-26T07:02:23.673" LastActivityDate="2014-09-25T10:02:53.897" Title="Problem with a code of FIR Lowpass filter" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17953" PostTypeId="2" ParentId="17951" CreationDate="2014-08-26T02:10:33.930" Score="1" Body="&lt;p&gt;From your question, I take it that you are attempting to analyze, in a completely unsupervised way, unlabelled speech data so as to unveil two groups that should (hopefully) line up well with the &quot;male&quot; and &quot;female&quot; labels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Cross-correlation is useless for speech application. The notion of speech similarity (be it at the higher level of the actual words pronounced, or at the lower level of the perceived timbre) does not line up at all with the raw waveform correlation. If you really want to align pairs of recordings, you'll rather have to match sequences of feature vectors (such as MFCC) rather than waveforms. Even then, the MFCC of two different speakers saying the same words do not match - at the very least you have to consider a linear transform from one set of vectors to the other.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have not explained how you planned to use principal component analysis here (PCA is not a clustering method in itself). I assume that your intention was to represent each speaker with a humongous $N$-dimension vector representing the entire waveform of the recording for this speaker; run a PCA on this $20 \times N$ matrix to get a lower dimensional representation of say $20 \times 2$, and use this for clustering. It won't work because without further feature extraction, the raw waveform does not carry any meaningful information for speech analysis.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's how I would naively do it (and this wouldn't require any alignment):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For each recording, extract the pitch and MFCCs (and maybe their first and second derivatives) and train a GMM on them.&lt;/li&gt;&#xA;&lt;li&gt;Compute the pairwise distance between the models. This gives you a $20 \times 20$ matrix with the distance between each model.&lt;/li&gt;&#xA;&lt;li&gt;Once you have this matrix, it is ripe for use with &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_clustering&quot; rel=&quot;nofollow&quot;&gt;spectral clustering techniques&lt;/a&gt;, or maybe something as simple as &lt;a href=&quot;http://en.wikipedia.org/wiki/Hierarchical_clustering&quot; rel=&quot;nofollow&quot;&gt;hierarchical agglomerative clustering&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that in this answer I have tried to follow your &quot;clustering&quot; approach - how to make difference in genders apparent in a collection of speech recordings, without any prior annotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your problem is truly that of recognizing gender, and if you can afford a supervised approach (annotating data + training a model), then things would have to be done differently...&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-08-26T02:10:33.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17955" PostTypeId="1" CreationDate="2014-08-26T06:23:59.167" Score="0" ViewCount="54" Body="&lt;p&gt;I am reading a document on Image processing and couldn't analyze a statement in it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For any $k \in \Psi_s$, the family of values $\{u[\varphi(p+l)+k-l]:l \in \Psi_s \}$ is&#xA;  representative of the value of...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The variables are explained below&lt;br&gt;&#xA;$k$,$p$,$l$ &amp;nbsp;- pixels&lt;br&gt;&#xA;$u()$   &amp;nbsp;&amp;nbsp;&amp;nbsp;- image intensity&lt;br&gt;&#xA;$\Psi_s$ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- patch of size 5x5 or 9x9 and so on.&lt;br&gt;&#xA;$\varphi()$ &amp;nbsp;&amp;nbsp;&amp;nbsp;- mapping function corresponding to that pixel  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;how do i get the values mentioned? i have tried to check other documents but couldn't find any.&lt;/p&gt;&#xA;" OwnerUserId="10922" LastEditorUserId="8202" LastEditDate="2014-08-26T07:19:33.490" LastActivityDate="2014-08-26T07:19:33.490" Title="Understanding a mathematical statement in image processing" Tags="|image-processing|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17956" PostTypeId="2" ParentId="17952" CreationDate="2014-08-26T07:21:07.840" Score="1" Body="&lt;p&gt;The problem is, as you've already pointed out, the choice of the summation limits. Obviously, the array index shouldn't become negative. Look at the definition of convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\sum_{k=-\infty}^{\infty}h(k)x(n-k)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assume, as in your case, that the filter length (i.e. the number of coefficients) equals $M+1$, and that the input signal is a finite length sequence in the range $0\le n&amp;lt;N$. Then you have two conditions on the summation index $k$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$0\le k \le M\quad\text{and}\quad 0\le n-k \le N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With these conditions the sum in (1) becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\sum_{k=\max\{0,n-N+1\}}^{\min\{M,n\}}h(k)x(n-k)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is the sum in (2) that you need to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that if you want to implement convolution, then the output signal will be longer than the input signal, so you would need to define two different variables &lt;code&gt;len&lt;/code&gt;. But if you only want to compute the output signal as long as there is a non-zero input signal present, then your implementation is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another improvement would be to have a routine that just takes a scalar input value (the current input sample) and computes the corresponding output sample. In this way you don't need to know the length of the input signal and you don't need to store the complete input signal in an array because you just process each incoming sample directly. Of course you need an internal buffer storing the last $M$ input values. Your version is appropriate for offline-processing of not too long signals.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-26T09:56:19.627" LastActivityDate="2014-08-26T09:56:19.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17957" PostTypeId="1" AcceptedAnswerId="17959" CreationDate="2014-08-26T09:34:55.577" Score="0" ViewCount="10269" Body="&lt;p&gt;Consider a sine wave having an amplitude of 9 and a frequency of 0.3 Hz. I wish to perform an fft and plot the frequency on the x-axis and the real amplitude (i.e. 9) on the y-axis. I am using the following MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 10;&#xA;data = xlsread('Signal.xlsx');&#xA;Y(1)=0;&#xA;Y = fft(data);&#xA;N = length(Y);&#xA;freq = 0:Fs/N:Fs/2-Fs/N;&#xA;freq = freq';&#xA;amplitude = abs(Y(1:floor(N/2)))/floor(N/2);&#xA;plot(freq,amplitude);&#xA;xlabel('Frequency [Hz]');&#xA;ylabel('Amplitude');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When running the code, an amplitude close to 9 is obtained at a frequency of 0.3 Hz. In reality, I have a sinusoidal signal of a rotating motor shaft. I am measuring the angle using an encoder. The data can be found at: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dropbox.com/s/pe3g44b48ugauqp/Signal.xlsx?dl=0&amp;amp;m=&quot; rel=&quot;nofollow&quot;&gt;http://www.dropbox.com/s/pe3g44b48ugauqp/Signal.xlsx?dl=0&amp;amp;m=&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the amplitude of the sine wave should be about 0.6 m but when conducting an fft, it is indicating that the amplitude is around 0.4 m. I am sampling at 10Hz and have about 185 000 data points. When trying to reduce the data, the amplitude of the sine wave is approximating the desired one i.e. 0.6 m. As far as I know, the more data points you have, the better will the resolution be when conducting an fft. So why am I getting the opposite? Can someone please help me? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10881" LastEditorUserId="10881" LastEditDate="2014-08-26T12:57:57.423" LastActivityDate="2014-08-28T20:57:07.277" Title="Plotting Real Amplitude of Sine Wave in FFT" Tags="|matlab|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17958" PostTypeId="1" AcceptedAnswerId="17973" CreationDate="2014-08-26T10:52:18.587" Score="-1" ViewCount="287" Body="&lt;p&gt;I have the following signal for which amplitude and phase spectrums have to be computed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HGlnW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This exercise also has a solution which begins by deriving the signal twice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, they say the spectral density function for the given signal is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(j\omega)=\dfrac{X''(j\omega)}{(j\omega)^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my attempt to figure out how did they get to that, I found the derivative property of the Fourier transform in the few pages of notes I have(there should be an &lt;strong&gt;F&lt;/strong&gt; above the equivalency sign):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x''(t) \Leftrightarrow (j\omega)^2X(j\omega) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks quite a lot to what they have, but I do not know what do from here in order to reach their equation(formula). Also, can this property be applied to this signal or it only applies to non-periodic signals? &lt;/p&gt;&#xA;" OwnerUserId="10837" LastEditorUserId="10837" LastEditDate="2014-08-29T09:41:02.910" LastActivityDate="2014-08-29T09:41:02.910" Title="Fourier transform properties. Spectral density function" Tags="|fourier-transform|power-spectral-density|" AnswerCount="1" CommentCount="1" ClosedDate="2014-08-28T16:26:30.103" ContentLicense="CC BY-SA 3.0" />
  <row Id="17959" PostTypeId="2" ParentId="17957" CreationDate="2014-08-26T10:59:14.390" Score="5" Body="&lt;p&gt;Judging from your post, you have over 5 hours of data, your are using to calculate the spectrum. This is a lot of data points to process with FFT. Let's focus on your code and modify it a little bit to generate the $0.3\; \mathtt{Hz}$ sinusoid with an amplitude of $9$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 10;&#xA;t = 0:0.1:1000;&#xA;A = 9;&#xA;f0 = 0.3;&#xA;data = A*sin(2*pi*f0*t);&#xA;N = length(data);    &#xA;&#xA;Y(1)=0;&#xA;Y = fft(data);&#xA;&#xA;freq = 0:Fs/N:Fs/2-Fs/N;&#xA;freq = freq';&#xA;amplitude = abs(Y(1:floor(N/2)))/floor(N/2);&#xA;&#xA;subplot(211)&#xA;plot(t, data)&#xA;xlabel('Time [s]')&#xA;ylabel('Amplitude')&#xA;title('Time domain signal')&#xA;grid on&#xA;&#xA;subplot(212)&#xA;plot(freq, amplitude);&#xA;xlabel('Frequency [Hz]');&#xA;ylabel('Amplitude');&#xA;title('Amplitude spectrum')&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives us what you expect to obtain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YHz9p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's assume that your $0.3\; \mathtt{Hz}$ signal is not always present (sometimes there is only noise present). I suspect this is how your data looks like, especially over so many hours. I will approximate this situation by adding the random noise after half of a sinusoid duration: &lt;code&gt;data(5000:10000)=randn(1,5001);&#xA;&lt;/code&gt; (consider it as someone turned off the machine halfway through the experiment). Obviously you can make it even more intelligent by having signal for 1 second, followed by 1 second of noise, and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How it will affect your amplitude spectrum? Obviously you won't get $9$ as an amplitude because there is only half of the energy present before at $0.3\; \mathtt{Hz}$. Thus you will observe something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RdmNJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to detect a true amplitude, then I suggest you to use the Time-Frequency analysis tools. Easiest one is the Short-Time Fourier Transform. You will be able to observe the amplitude of your component at a given time, and extract it later on.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;After analysing your signal indeed you can expect the peak with an amplitude of $0.62$ at $0.2\; \mathtt{Hz}$ (not as you claiming $0.3\; \mathtt{Hz}$):  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WadZp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You problem relates to the leakage as you get lot's of frequency bins and likelihood of your frequency falling exactly between get's lower. Indeed, to many is also not a good idea. Below you can observe two spectra for two synthesized sinusoids with same amount of samples as your dataset and amplitude $0.62$. Frequencies are $f=0.2\; \mathtt{Hz}$, and $f=0.2003\; \mathtt{Hz}$. You can observe that for a perfect match, amplitude is estimated correctly, although for $0.2003\; \mathtt{Hz}$ you get $0.41$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D6O3a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One workaround to deal with that problem in your case, would be to apply windowing to your signal. Although it will decrease amount of leakage, but still it won't remove it absolutely. Below you can observe example for the Hamming window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hNfe1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion better solution would be to use less samples. For example if you expect your frequency to be around $0.2\; \mathtt{Hz}$, then you can choose $100$ samples (I know - very crude), which will give you resolution of  $0.1\; \mathtt{Hz}$ and component will fall exactly inside. Here is the example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g6H5H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One last remark, regarding your code. I do not understand what your declaration &lt;code&gt;Y(1)=0&lt;/code&gt; is suppose to do? If it's initialization, then it is unnecessary. If you are trying to remove the DC component, then it's not a good place nor way.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In case of using other window than rectangular one, i.e. Hamming you must normalize it properly. In case of DFT you must divide your output samples by sum of all window samples. In case of 'no windowing' which is in fact rectangular window you get sum of all samples being equal to &lt;code&gt;N&lt;/code&gt;. Putting it into code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;win = hamming(N); % rectwin(N), hann(N), ...&#xA;data = data .* win;&#xA;Y = fft(data)/sum(win);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For more theory please refer to other posts on DSP SE or take a look into this &lt;a href=&quot;http://holometer.fnal.gov/GH_FFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;great paper&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-08-28T20:57:07.277" LastActivityDate="2014-08-28T20:57:07.277" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17960" PostTypeId="1" AcceptedAnswerId="17962" CreationDate="2014-08-26T13:50:29.453" Score="2" ViewCount="1320" Body="&lt;p&gt;I've just one question :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I write a model like y = x + w,( with w a white gaussian noise) with a fixed SNR and a noise variance equal to 1. What coefficient may I have before x ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks !&lt;/p&gt;&#xA;" OwnerUserId="10923" LastActivityDate="2014-08-27T14:35:35.703" Title="Fixed SNR with unitary noise variance" Tags="|matlab|noise|gaussian|statistics|snr|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17961" PostTypeId="2" ParentId="17861" CreationDate="2014-08-26T14:26:57.703" Score="-1" Body="&lt;p&gt;The resolution comes from the Rayleigh resolution - it is the distance from the peak of the main lobe of the response to the first null or zero in the response. In the continuous Fourier Transform this is a sinc() function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets examine the DFT of a rectangular window (note - an arbitrary frequency can be created by multiplying by a complex exponential and using DFT transform properties i.e. frequency shifting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the time being lets ignore the sampling rate and just use indices in the time and frequency domain. So if we have a rectangular pulse of length $K$ samples and take a DFT of length $N$ then if $X(m)$ denotes the DFT of the rectangular pulse $x(n)$. Then (&lt;a href=&quot;http://flylib.com/books/en/2.729.1.40/1/&quot; rel=&quot;nofollow&quot;&gt;see here&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(m) =e^{j\phi(m)} \frac{\sin(\pi mK/N)}{\sin(\pi m/N)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The peak of the response occurs when $m=0$. The first null in the response occurs when&#xA;$$\pi m K/N=\pi $$ or $$ m=N/K.$$ Now to convert this index into a frequency - we know that the DFT frequency bin spacing is given by $f_s/N$ where $f_s=1/T$ is the sampling frequency and $T$ is time domain sample spacing. This gives:&#xA;$$ f_{res} = m\frac{f_s}{N} =\frac{N}{K} \frac{f_s}{N}=\frac{f_s}{K}=\frac{1}{KT}=\frac{1}{T_0},$$&#xA;where $T_0$ is the time duration of the signal (as per your original post).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note - Using $\Delta f$ to denote resolution is problematic because it is also used to denote the DFT bin spacing - which is not the same thing as resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note - The phase term $\phi(m)$ is kind of complicated (see the link I provided), but it is irrelevant to this analysis because we are only interested in the magnitude of the response i.e. where is the peak and where is the first zero/null.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-08-26T14:26:57.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17962" PostTypeId="2" ParentId="17960" CreationDate="2014-08-26T18:43:12.570" Score="4" Body="&lt;p&gt;If you define the SNR as the ratio of the signal power and the noise power in dB, you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$SNR_{dB}=10\log \left(\frac{P_s}{P_w}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $P_s$ is the power of the desired signal and $P_w$ is the noise poiwer. If the noise $w$ has a mean of zero, then $P_w=\sigma^2_w=1$. From (1) (with $P_w=1)$ you get the desired value of $P_s$ for a given value of $SNR_{dB}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s=10^{SNR_{dB}/10}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to normalize the signal $x$ such that it has the desired power $P_s$ you first need to know its power $P_x$. Dividing $x$ by $\sqrt{P_x}$ will give you a unity power signal, which can then be multiplied by $\sqrt{P_s}$ in order to obtain the desired SNR:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s=\sqrt{P_s}\frac{x}{\sqrt{P_x}}=10^{SNR_{dB}/20}\frac{x}{\sqrt{P_x}}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-26T18:43:12.570" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17964" PostTypeId="2" ParentId="17957" CreationDate="2014-08-26T19:34:31.467" Score="2" Body="&lt;p&gt;When doing an FFT of a length on the order of 100k samples, the frequency resolution will be on the order of 0.001%, which means even tiny variations in the signal frequency (from being perfectly integer periodic in the FFT length) or the sampling frequency can spread the energy of a sinusoid out into more than one FFT result bin, thus reducing the magnitude of the peak bin.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-08-26T19:34:31.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17967" PostTypeId="1" AcceptedAnswerId="18050" CreationDate="2014-08-27T05:42:19.760" Score="2" ViewCount="3007" Body="&lt;p&gt;I used the continuous wavelet transform (CWT) to analyze the behavior of a 1-D smooth signal (extracting its modal property, damping and frequency components) in my research. Now someone asked:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why the presented CWT algorithm is better than Ridgelet transform?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I thought it is better to ask in this forum about disadvantages of Ridgelets. &#xA;For example: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it is said that Wavelet can handle point discontinuities whereas&#xA;Ridgelet is better to deal with line discontinuities. So, do we have&#xA;any line discontinuities in a 1-D signal?&lt;/li&gt;&#xA;&lt;li&gt;what is computational complexity of Ridgelet in term of big $O$ i.e.&#xA;(like $O(N)$), for both continuous (in scale) and discrete versions?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="15892" LastEditDate="2017-08-09T15:20:26.720" LastActivityDate="2017-08-09T15:20:26.720" Title="What are the advantages and disadvantages of the Ridgelet transform?" Tags="|signal-analysis|wavelet|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17968" PostTypeId="1" AcceptedAnswerId="17971" CreationDate="2014-08-27T08:06:27.020" Score="2" ViewCount="7273" Body="&lt;p&gt;In a Wifi 802.11n context, I'm looking to find the sampling rate to perform some processing on the signal and I've something I cannot understand : in the book &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1107016762&quot; rel=&quot;nofollow&quot;&gt;Next Generation Wireless LAN's: 802.11n and 802.11ac&lt;/a&gt;, I would like to know the meaning of this sentence :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In 802.11a, the fundamental sampling rate is 20 MHz, with a 64-point&#xA;  FFT/IFFT. The Fourier transform symbol period, T, is 3.2 μs in&#xA;  duration and F is 312.5 kHz.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is the sampling rate « 20 MHz » ?  The bandwitch of the Wifi 802.11 is 20 MHz so my first idea would be to double this value to validate the Nyquist-Shannon criterion. In addition, the guard interval is not included ?&lt;/p&gt;&#xA;" OwnerUserId="10927" LastEditorUserId="8202" LastEditDate="2014-08-27T10:46:52.940" LastActivityDate="2015-02-05T19:35:22.697" Title="Sampling rate in Wifi 802.11 -&gt; 20 MHz enough with a BW of 20 MHz?" Tags="|sampling|digital-communications|ofdm|bandwidth|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17970" PostTypeId="1" CreationDate="2014-08-27T08:25:40.693" Score="0" ViewCount="353" Body="&lt;p&gt;I wonder is there any algorithm or method that I can map two RGB images together in Matlab. I mean assume I have following images &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8ZQGv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pURgu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I find what number I should multiply each channel of one them to get the other one, or any other method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried something like: looking at destination image and see what color is dominating then adjust the other image by multiplying by different value using brute force method but that is very inefficient and tedious. &lt;/p&gt;&#xA;" OwnerUserId="10929" LastActivityDate="2014-08-31T02:08:28.190" Title="map two RGB images in Matlab" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17971" PostTypeId="2" ParentId="17968" CreationDate="2014-08-27T08:35:57.740" Score="2" Body="&lt;p&gt;The radio-frequency signal of 802.11n can have a bandwidth of 20 MHz or 40 MHz. But even if it is 20 MHz, it can be sampled at 20 MSa/s if an I/Q demodulator is used: at the receiver the radio-frequency signal is downconverted to the baseband. The I/Q demodulator has two lowpass output signals (Inhphase/Quadrature or real/imaginary part) with bandwidth 10 MHz each. Two samplers with 20 MSa/s each are then sufficient to fulfill the sampling criterion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other receiver architectures where the received signal is first downconverted to an intermediate frequency (for example 10 MHz) and is then sampled at a higher rate (for example 40 MSa/s). In this case only one sampler is necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The guard interval has only a negligible influence on the signal bandwidth. It is not included in the &quot;Fourier transform period $T$&quot;, because it is only added after the transform. The symbol duration after the transmitter IFFT is therefore&#xA;$$&#xA;T = N/f_\mathrm s = 64/(20\,\text{MHz}) = 3.2\,\mathrm{\mu s}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-08-27T08:35:57.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17972" PostTypeId="1" CreationDate="2014-08-12T08:38:40.370" Score="0" ViewCount="26" Body="&lt;p&gt;i have a measured signal (e.g. voltage sine wave) and i would like to generate a sine wave which matches this meausred signal (with the generated sine wave i remove the harmonics from my measured signal), just like a PLL block in simulink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for that i have to do the 2 steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Calculate the frequency of the measured signal from detecting the Zerocrossing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- calcualte the sine function using sin(2*pi*f(t)*t).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- calcuating the frequency by counting the samples between two zerocrossing would results in getting the frequency at one point so my calcualted fequency does not match my sampled measured signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- even when interpolating or using the repmat function i am able to get the f(t) to be the same length as the time (t) vector yet my sine wave is not correctly calcualted. i know that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am adding the zerocrossing times on my time vector which makes the last one inconsistance which mean the sampling rate is changing also. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so how to genereate a sine wave which changing frequency and changing sampling rate of the time signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best Reagrds&lt;img src=&quot;https://i.stack.imgur.com/qVuJa.jpg&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="10798" OwnerDisplayName="user2573266" LastActivityDate="2014-08-27T08:44:36.117" Title="Generating a Sine Signal (for example a voltage sine wave) with changing frequency and changing sample rate (time)?" Tags="|matlab|" AnswerCount="0" CommentCount="4" ClosedDate="2014-08-27T09:06:57.383" ContentLicense="CC BY-SA 3.0" />
  <row Id="17973" PostTypeId="2" ParentId="17958" CreationDate="2014-08-27T08:46:19.317" Score="2" Body="&lt;p&gt;I'll try to give you some clues so you'll be able to understand and solve this problem by yourself. First of all it's important to understand what they mean by $X''(j\omega)$. This looks like the second derivative of the function $X(j\omega)$, but it isn't! What they mean is the Fourier transform of the second derivative of $x(t)$, and this is exactly the correspondence you wrote down in your question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X''(j\omega)=\mathcal{F}\{x''(t)\}=(j\omega)^2X(j\omega)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to compute $X(j\omega)$ you might as well compute $X''(j\omega)$ and divide by $(j\omega)^2$ (for $\omega\neq 0)$. You still have to figure out $X(0)$ because you can't compute it form Eq. (1). But since this is just the DC component of $x(t)$ it's usually quite easy to compute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why they chose to compute $X(j\omega)$ from $X''(j\omega)$ is because for the given function $x(t)$ it's much easier to compute the Fourier transform of the second derivative of $x(t)$. Since $x(t)$ is a piecewise linear function, the first derivative $x'(t)$ is a piecewise constant function, and the second derivative $x''(t)$ just has delta impulses at $t=0$ and $t=\tau$ (and at $t=nT$ and $t=nT+\tau$), i.e. where $x'(t)$ has jumps. Computing the Fourier coefficients or the Fourier transform is now easy because you just have to integrate delta impulses. After having obtained $X''(j\omega)$ in this way, you can compute $X(j\omega)$ (apart from $\omega=0$) by using (1).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-27T08:46:19.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17975" PostTypeId="2" ParentId="17846" CreationDate="2014-08-27T11:47:25.090" Score="1" Body="&lt;p&gt;Okay, Feature Extract and Matching is the way to go for a beginner. Other methods such as relative pose estimation, triangulation, 3d matching etc. would be much more complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your object is metallic and thus shiny. Also, without correct lighting it is quite difficult to match features. But still, as much as I could see from that picture, you have plentiful number of features out there. Extract your descriptors and match them using FLANN. If you use Sift features, it will provide you with enough perspective invariance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that most of your template is planar. For that reason, after computing the matches with Sift+FLANN, you might as well go for a homography computation using RANSAC. Because RANSAC could tolerate significant number of outliers (~50%), you will end up with a nice homography. Luckily, OpenCV has that too. Of course, this homography will not always be a very good one and you could detect this, with something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;bool validate_homography(const double h[9])&#xA;{&#xA;    const double det = h[0] * h[4]   - h[3] * h[1];&#xA;    if (det &amp;lt; 0)&#xA;        return false;&#xA;    const double N1 = sqrt(h[0] * h[0] + h[3] * h[3]);&#xA;    if (N1 &gt; 4 || N1 &amp;lt; 0.1)&#xA;        return false;&#xA;    const double N2 = sqrt(h[1] * h[1] + h[4] * h[4]);&#xA;    if (N2 &gt; 4 || N2 &amp;lt; 0.1)&#xA;        return false;&#xA;    const double N3 = sqrt(h[6] * h[6] + h[7] * h[7]);&#xA;    if (N3 &gt; 0.002)&#xA;        return false;&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this returns true, you could accept your match.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-08-27T11:47:25.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17976" PostTypeId="2" ParentId="17932" CreationDate="2014-08-27T11:58:48.807" Score="3" Body="&lt;p&gt;Haralick's primal topograhic sketch is the answer to that. Check-out the peak section of :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.dig.cs.gc.cuny.edu/seminars/IPCV/pres09.pdf&quot; rel=&quot;nofollow&quot;&gt;Haralick R., et al. - &lt;em&gt;The Topographic Primal&#xA;  Sketch&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you also look at the notation and Hessian parts, you will grasp how to implement peak finding (local-max) as a convolution operator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your comments below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course you get multiple peaks, but this is also the case when you convolve with a simple 3x3 mask. However, the technique is more robust because:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If you do the classification from the eigenvalues/vectors of the structure tensor, you will be reasonably robust against the noise. &lt;/li&gt;&#xA;&lt;li&gt;Of course you get multiple peaks, but this is also the case when you convolve with a simple 3x3 mask. However, such peaks can be avoided using appropriate thresholds. If such threhsolds are not available, dynamic thresholding might be an option.&lt;/li&gt;&#xA;&lt;li&gt;This is better than checking all the neighbors mainly for your question, because every operation can be done through OpenCV routines. And also because you will have a much much better result.&lt;/li&gt;&#xA;&lt;li&gt;I would like to direct you to Haralick's original paper, which is fun to read.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://haralick.org/book_chapters/facet_model_topo_primal_sketch.pdf&quot; rel=&quot;nofollow&quot;&gt;Harlick R., et al. - &lt;em&gt;The Use of the Facet Model and the Topographic&#xA;  Primal Sketch in Image&#xA;  Analysis&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and also check out other important works such as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.researchgate.net/publication/44046945_Stable_Estimation_of_a_Topographic_Primal_Sketch_for_Range_Image_Interpretation/links/0c96051f2f53327cce000000&quot; rel=&quot;nofollow&quot;&gt;Boulanger P., Cohen P. - &lt;em&gt;Stable Estimation of a Topographic Primal&#xA;  Sketch for Range Image&#xA;  Interpretation&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Consider using the Facet model for approximating the local image structures with polynomials. Read Haralick's paper for more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, for more information on the structure tensor, you can checkout the wiki pages and here: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://hci.iwr.uni-heidelberg.de/Staff/bgoldlue/cuda_ss_2012/cuda_ss_2012_01_structure_tensor.pdf&quot; rel=&quot;nofollow&quot;&gt;Goldlückel B. - &lt;em&gt;The Structure Tensor of an&#xA;  Image&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="8202" LastEditDate="2014-08-28T15:59:45.063" LastActivityDate="2014-08-28T15:59:45.063" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17977" PostTypeId="1" CreationDate="2014-08-27T13:36:33.803" Score="1" ViewCount="91" Body="&lt;p&gt;I'm searching for a an algorithm or an idea of implementation. I need to filter a signal in real time, and want to change the length of it (number of taps) in order to change the delay.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In low signal environment I want a high order filter and care less&#xA;about delay&lt;/li&gt;&#xA;&lt;li&gt;In high signal environment I want a low order filter in order to&#xA;minimize the delay.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've tried to search &lt;em&gt;&quot;variable length filter...&quot;&lt;/em&gt; on google but all of the results were versions of the LMS algorithm, but I don't have a &quot;clean noise&quot; reference signal which I can use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have anyone heard of something like this?&#xA;Thanks :)&lt;/p&gt;&#xA;" OwnerUserId="10932" LastEditorUserId="8202" LastEditDate="2014-08-27T14:27:06.437" LastActivityDate="2014-08-29T14:24:03.357" Title="variable length no-refrence filter algorithm" Tags="|filters|algorithms|adaptive-filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17978" PostTypeId="1" CreationDate="2014-08-27T14:07:23.047" Score="5" ViewCount="1675" Body="&lt;p&gt;I have a signal and from 'standard information' I know the predominant frequency is at $1\textrm{ Hz}$ and then there should be three harmonics at lower amplitudes. My signal however has a lower amplitude at $1\textrm{ Hz}$, higher at the first harmonic and then several harmonics, more than what should be present. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to design a comb filter to rectify this but I am not sure where to start. Any advice from anyone who has some experience with this filter would be great.&lt;/p&gt;&#xA;" OwnerUserId="10933" LastEditorUserId="1629" LastEditDate="2016-06-20T03:05:18.383" LastActivityDate="2023-04-30T18:43:05.850" Title="Comb filter - attenuation" Tags="|filters|noise|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17980" PostTypeId="1" AcceptedAnswerId="17986" CreationDate="2014-08-27T14:41:54.127" Score="3" ViewCount="1419" Body="&lt;p&gt;Assume signal $x$, sampled at $f_s = 44100\; \mathrm{Hz}$. I tried to filter it using the Butterworth bandpass filter ( $30\; \mathrm{Hz} - 70\; \mathrm{Hz}$) of order $8$. However, as a result I get a vector with most elements being &lt;code&gt;NaN&lt;/code&gt; (and some of them extremely small, approx.  $-2.5 \cdot 10^{306}$`).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try the same filter of order $6$, I get results as expected. What could be possible reason for order $8$ filter to 'explode'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the MATLAB code, just in case I made an error which I don't see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b, a] = butter(4, [60 / fs, 140/fs]);&#xA;x_filtered = filter(b, a, x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10934" LastEditorUserId="8202" LastEditDate="2014-08-27T15:11:07.110" LastActivityDate="2014-08-28T10:28:45.723" Title="The reasons for filter explosion" Tags="|filters|bandpass|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17982" PostTypeId="2" ParentId="17978" CreationDate="2014-08-27T15:07:51.587" Score="3" Body="&lt;p&gt;Comb filters involve adding a delayed version of a signal to itself, they are generally used for musical effects processing and are unlikely to be of much help to you here. You may have been slightly misled by the frequency response which appears as a series of peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To increase the amplitude around a particular frequency, for example your dominant 1Hz, you can consider a peaking filter. To eliminate the additional harmonics you may consider band stop filters. Bear in mind you can apply multiple independent filters to the signal in sequence to achieve the changes in frequency response that you desire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably could achieve the desired result with a single filter but you have a set of conditions which I suspect would lead to a complicated and expensive filter, so multiple passes will be an easier approach.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2014-08-27T15:07:51.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17983" PostTypeId="2" ParentId="17980" CreationDate="2014-08-27T15:32:45.900" Score="-1" Body="&lt;p&gt;Read the limitations section  of the documentation of the butter function. &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/butter.html#bt5pm8a&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/signal/ref/butter.html#bt5pm8a&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-08-27T15:32:45.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17985" PostTypeId="2" ParentId="17980" CreationDate="2014-08-27T15:43:01.093" Score="3" Body="&lt;p&gt;The higher the order, the more poles that need to be fit around a small semi-circular-like ring, and right at the edge of the unit circle.  The smaller the ratio of the filter's frequency to the sample rate, the smaller this circular ring becomes in relationship to the unit circle. Try to stuff enough poles into a small enough area and normal numerical noise might move one around to a bad location (one that amplifies anything to infinity, or a divide by zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One technique to possibly improve stability would be to down-sample your signal by a very large ratio before the Butterworth low-pass filter.  This will enlarge the semi-circular-like ring, and thus move the poles farther apart and away from the unit circle.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-28T00:44:40.890" LastActivityDate="2014-08-28T00:44:40.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17986" PostTypeId="2" ParentId="17980" CreationDate="2014-08-27T16:05:23.990" Score="4" Body="&lt;p&gt;Basically you never want to use the Transfer Function representation (with &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;a&lt;/code&gt;) and rather use the Zeros-Poles-Gain (&lt;code&gt;z&lt;/code&gt;,&lt;code&gt;p&lt;/code&gt;,&lt;code&gt;k&lt;/code&gt;). This will allow you to avoid the numerical errors. In your case you might design your filter in following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 44100;           % Sampling frequency&#xA;Wp = [30, 70]/(fs/2); % Pass band frequencies (as normalized frequency)&#xA;Ws = [20, 90]/(fs/2); % Stop band frequencies&#xA;Rp = 3;               % Ripple at pass band&#xA;Rs = 50;              % Ripple at stop band&#xA;&#xA;[n, Wn] = buttord(Wp, Ws, Rp, Rs);     % Get order and omega vector&#xA;[z, p, k] = butter(n, Wn, 'bandpass'); % Design filter accordingly&#xA;[sos, g] = zp2sos(z, p, k);            % Convert to state matrix&#xA;Hd = dfilt.df2sos(sos, g);             % Create the filter object&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which for some dummy random signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1,100000);&#xA;y = filter(Hd, x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will produce a stable output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zkx2D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the filter frequency response (everything looks as requested):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kqPN2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-08-28T10:28:45.723" LastActivityDate="2014-08-28T10:28:45.723" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="17987" PostTypeId="2" ParentId="17980" CreationDate="2014-08-27T16:20:10.870" Score="1" Body="&lt;p&gt;Other answers explain how to avoid this, but to clarify the actual cause, it is caused by exceeding the precision limit of the data type used to store the sample values (which I believe is double precision floating point in MATLAB) resulting in an underflow. The reason it only happens with higher orders of the filter is that the higher the order the smaller the coefficients may become. Very small coefficients multiplied by very small signal values can lead to floating point denormals, which in turn can lead to floating point NaN (not a number).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jargon busting links:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/IEEE_754-1985&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/IEEE_754-1985&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Arithmetic_underflow&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Arithmetic_underflow&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2014-08-27T16:20:10.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17988" PostTypeId="1" CreationDate="2014-08-27T17:15:55.270" Score="0" ViewCount="431" Body="&lt;p&gt;I'm trying to resample a digital communication signal in SciPy or Matlab. Suppose the signal was sampled at 3 samples per second, and I want to resample it to 2 samples per second, the thing is I also want to be able to change the new sampling point so the new samples doesn't necessarily start at the same point as the orignal samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.resample.html&quot; rel=&quot;nofollow&quot;&gt;Scipy resample&lt;/a&gt; function, but it doesn't have the flexibility to change the sample point, it only allows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The resampled signal starts at the same value as x ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/resample.html&quot; rel=&quot;nofollow&quot;&gt;Matlab resample&lt;/a&gt; function can't do that either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to shift the start point by a small amount, say $\alpha T$ where $T$ is the symbol duration and $0 \le \alpha &amp;lt; 1$ ? I guess what I need is the generic resampling algorithm underneath these resample functions so I can see if there's anything I can tweak. &lt;/p&gt;&#xA;" OwnerUserId="4083" LastEditorUserId="4346" LastEditDate="2014-11-26T00:33:40.770" LastActivityDate="2014-11-26T19:20:21.133" Title="How to change the start point of resampling process?" Tags="|matlab|python|resampling|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17989" PostTypeId="1" AcceptedAnswerId="17993" CreationDate="2014-08-27T17:45:47.107" Score="3" ViewCount="11122" Body="&lt;p&gt;SNR is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$SNR=10 \log_{10}\left(\frac{\sigma_s^2}{\sigma_n^2}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, when we say the SNR of 10 dB is 10 times higher than that of 20 dB, it is higher in what unit? Amplitude, power or what?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, could you relate as to why it's 10 times higher for the above example.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="15329" LastEditDate="2020-01-29T20:12:03.463" LastActivityDate="2020-01-29T20:12:03.463" Title="What is the unit of SNR?" Tags="|noise|snr|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17990" PostTypeId="1" AcceptedAnswerId="17997" CreationDate="2014-08-27T17:56:08.637" Score="8" ViewCount="13253" Body="&lt;p&gt;Gaussian noise with different SNR levels are usually used in research works to simulate a realistic environment. How can researchers guarantee that Gaussian noise can simulate the reality of a System? &lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2016-05-16T15:39:26.350" Title="why Gaussian noise is usually used?" Tags="|noise|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="17991" PostTypeId="2" ParentId="17989" CreationDate="2014-08-27T18:02:22.133" Score="1" Body="&lt;p&gt;SNR is unitless, because when you divide the signal by the noise they have the same units, thus canceling the units out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, SNR is a power ratio, but mathematically there is no reason you can't do a dB measurement of amplitudes, or anything else.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-08-27T18:02:22.133" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="17992" PostTypeId="2" ParentId="17990" CreationDate="2014-08-27T18:07:57.113" Score="1" Body="&lt;pre&gt;&lt;code&gt;How can researchers guarantee that Gaussian noise can simulate the reality of a System?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They cannot guarantee that it is an accurate reflection of all systems.  In fact, though it is a decent approximation of many systems we know that there are many systems that it doesn't accurately reflect at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why do we use gaussian noise?  Two reasons.  First, because it does accurately reflect many systems.  Second, because it is very easy to deal with mathematically, making it an attractive model to use.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-08-27T18:07:57.113" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17993" PostTypeId="2" ParentId="17989" CreationDate="2014-08-27T18:09:13.753" Score="9" Body="&lt;p&gt;SNR stands for Signal to Noise Ratio. It is a ratio and as such does not have any units, it describes the proportion of signal to undesired noise. There is no single correct measure of SNR, it differs depending on the application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the equation you have given, the SNR is broken down in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Calculate the &lt;em&gt;power ratio&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\sigma_s^2}{\sigma_n^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your equation requires us to know the variance of the signal and the noise, dividing one by the other gives the power ratio. To answer one of your questions, this is the ratio of power, not amplitude, we could achieve the same result by taking a ratio of the root mean square of the signal and noise - another measure of power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Express the ratio in decibels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$10\log_{10}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is simply a convenience, the SNR may be a very large number so expressing the value on a logarithmic scale can make the information more manageable. Converting a unit to decibels simply involves taking the log10 of the value and multiplying by 10.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastEditorUserId="4346" LastEditDate="2014-08-29T18:20:41.743" LastActivityDate="2014-08-29T18:20:41.743" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="17994" PostTypeId="2" ParentId="17990" CreationDate="2014-08-27T18:30:29.740" Score="2" Body="&lt;p&gt;A realistic environment is created by characterizing the noise, and then using a distribution or simulation with that characterization (or as close an approximation as can be used.). If an accurate characterization of the system's noise turns out to be Gaussian, then the researcher is good to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the event that one does not have a good characterization (nor even know the number of possible noise and error sources), a Gaussian distribution is the limit of the sum of a large number of unknown (but bounded?) noise sources, so might be a reasonable guess.  But that's only a guess, so beware trusting the simulation as being the same as reality.  (An unbounded noise source, &quot;fat tail&quot; or &quot;Black Swan&quot; event, can easily have reality do something never seen in a simulation that uses only Gaussian noise sources.  Thus, no guarantee for the research work.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-27T21:14:46.460" LastActivityDate="2014-08-27T21:14:46.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="17995" PostTypeId="2" ParentId="17988" CreationDate="2014-08-27T18:49:25.350" Score="0" Body="&lt;p&gt;If the resampling is not a ratio of small integers, the it might be possible to approximate a fractional delay by added some number leading zero samples before resampling and the removing some number after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can also resample to any rate by interpolation (Sinc kernel for high quality) of each new sample, after any needed low pass filtering of course.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-08-27T18:49:25.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17996" PostTypeId="2" ParentId="17977" CreationDate="2014-08-27T18:58:00.287" Score="2" Body="&lt;p&gt;One possible implementation would be to run two (or more) different order filters in parallel, and use a mixer to blend them by ramping the gains up and down depending on your selection criteria.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-08-27T18:58:00.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17997" PostTypeId="2" ParentId="17990" CreationDate="2014-08-27T19:02:07.313" Score="6" Body="&lt;p&gt;Gaussian is a very good assumption for every process or system that's subject to the Central Limit Theorem. See &lt;a href=&quot;http://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Central_limit_theorem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this means is that when gaussian random variables are added, the result is gaussian (so you can apply similar statistics after the addition as were before), and besides that, when &lt;strong&gt;any&lt;/strong&gt; random variables (that have finite variance, so Cauchy r.v. does not apply) are added, they tend to become more gaussian in their p.d.f. as you add 'em up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's also very cool about the &quot;normalized&quot; gaussian function, $e^{-\pi t^2}$ is that its Fourier transform is exactly the same:&#xA;$$\mathcal{F}\left\{e^{-\pi t^2}\right\}=e^{-\pi f^2}$$&#xA;that sometimes makes the math fun and easy. Regarding the gaussian p.d.f., that means the corresponding &lt;a href=&quot;https://en.wikipedia.org/wiki/Characteristic_function_%28probability_theory%29&quot; rel=&quot;nofollow&quot;&gt;characteristic function&lt;/a&gt; is also gaussian.  And when you add random variables, you convolve their p.d.f.'s and that means you multiply their &lt;em&gt;characteristic functions&lt;/em&gt;. When you multiply two gaussians, what then do you get?&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="4346" LastEditDate="2014-08-29T18:39:18.410" LastActivityDate="2014-08-29T18:39:18.410" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="17998" PostTypeId="2" ParentId="17990" CreationDate="2014-08-27T19:58:55.917" Score="6" Body="&lt;p&gt;As pointed out in other answers, the Central Limit Theorem is one reason why Gaussian noise is so important as a model. One other reason that hasn't been explicitly mentioned and that I would like to point out is the fact that Gaussian noise is &lt;em&gt;completely described by second order statistics&lt;/em&gt;, which are relatively easy to measure. E.g., if you have a univariate distribution and if it is Gaussian, then you know everything you can ever know about it by knowing (measuring) its mean (first order) and its variance (second order). There are no higher order statistics, which is good because they are much harder to measure reliably. This fact is of course no justification for using a Gaussian model, but it is a very handy property &lt;strong&gt;if&lt;/strong&gt; we think that a Gaussian model is justified.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-27T19:58:55.917" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="17999" PostTypeId="1" CreationDate="2014-08-27T21:02:16.390" Score="2" ViewCount="2947" Body="&lt;p&gt;I have implemented a python butterworth filter but it seems to shift the data a lot, the x location of my data is very important to me for my analysis. Is there a way to correct for this shift precisely?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it shift all the data uniformly? Or does certain areas get shifted further/less far that others?&lt;/p&gt;&#xA;" OwnerUserId="10863" LastActivityDate="2014-08-27T21:37:46.853" Title="correct for shift from butterworth filter?" Tags="|filters|filter-design|lowpass-filter|python|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18000" PostTypeId="2" ParentId="17999" CreationDate="2014-08-27T21:37:46.853" Score="2" Body="&lt;p&gt;The delay or &quot;shift&quot; of an IIR butterworth filter varies with frequency.  If you want a constant delay that you can correct for in a simple manner, you need to instead use a linear phase FIR filter, not an IIR filter.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-08-27T21:37:46.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18004" PostTypeId="1" CreationDate="2014-08-28T08:29:47.067" Score="3" ViewCount="2551" Body="&lt;p&gt;I have written a piece of code in MATLAB to &lt;a href=&quot;http://pastebin.com/bbC9ZEbF&quot; rel=&quot;nofollow&quot; title=&quot;generate Frank codes&quot;&gt;generate Frank codes - &lt;em&gt;Pastebin link&lt;/em&gt;&lt;/a&gt; for pulse compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that Frank codes are stepped frequency approximations to Linear Frequency modulation(LFM).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LFM Parameters are obtained here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PW = 100e-6;% Pulse Width&#xA;PCR = 100; % Pulse Compression Ratio&#xA;CPW = PW/PCR;% Compressed pulse width&#xA;Fm = 2/CPW; %Frequency sweep&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Stepped frequency approximation to LFM:&lt;pre&gt;steppedFreq = 0:Fm/(N-1):Fm;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;The phase matrix is generated in the line:&lt;pre&gt;Matrix = mod(Matrix*incPhi,360);&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;Frank code is generated inside the for loop: &lt;pre&gt;FCP = [FCP,exp(1j*(2*pi&lt;em&gt;f&lt;/em&gt;t + Matrix(i,p)*pi/180))];&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;The autocorrelation in dB is calculated here:&lt;pre&gt;AutoCorrelationdB = 20*log10(abs(AutoCorrelation)/max(abs(AutoCorrelation)));&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Peak side lobe level obtained is only around $3.5\textrm{ dB}$. Am I following a correct method for generating Frank codes? The peak side lobe level is given by the formula &lt;code&gt;20*log10(1/(N*sin(pi/M)))&lt;/code&gt; as per the book &lt;a href=&quot;http://www.scitechpub.com/pomr/&quot; rel=&quot;nofollow&quot;&gt;Principles of Modern Radar: Basic Principles by M.A. Richards - Page 825&lt;/a&gt; which is equal to $29\textrm{ dB}$ for my case($N = 100,M = 10$).&lt;/p&gt;&#xA;" OwnerUserId="4434" LastEditorUserId="1629" LastEditDate="2016-08-18T21:02:58.680" LastActivityDate="2016-12-16T23:46:32.750" Title="How to construct Polyphase (Frank) codes in MATLAB" Tags="|autocorrelation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18005" PostTypeId="1" AcceptedAnswerId="18016" CreationDate="2014-08-28T10:05:18.503" Score="1" ViewCount="620" Body="&lt;p&gt;I have two approximately sine truncated waveforms of different amplitudes and I want a numerical measure of how similar they are to each other. I am sending a sonic pulse train whose multiple reflections I am receiving. I want to know which of those reflections most closely correlate with each other in terms of wave shape.&#xA;Any standard methods?&lt;/p&gt;&#xA;" OwnerUserId="7233" LastEditorUserId="7233" LastEditDate="2014-08-28T11:06:36.657" LastActivityDate="2014-08-29T13:06:23.147" Title="Measuring the similarity of two waveforms" Tags="|correlation|measurement|" AnswerCount="1" CommentCount="2" ClosedDate="2014-09-01T04:44:28.260" ContentLicense="CC BY-SA 3.0" />
  <row Id="18006" PostTypeId="2" ParentId="17950" CreationDate="2014-08-28T11:49:22.550" Score="0" Body="&lt;p&gt;The type of describing function $N(A)$ that you mention in your question describes the behavior of a (memoryless) non-linear system when excited by a sinusoidal input signal $x(t)=A\sin(\omega_0t)$. The describing function neglects all harmonics above the fundamental and the output signal is represented as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=|N(A)|A\sin(\omega_0t+\phi_N(A))\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi_N(A)=\arg\{N(A)\}$ ($N(A)$ is generally complex-valued). Note that (1) resembles the output of a linear time-invariant system with 'transfer function' $N(A)$, the only important difference being that this 'transfer function' depends on the amplitude of the input signal, which of course can't be the case for a linear system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we write the output signal as a Fourier series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\sum_{n=-\infty}^{\infty}c_ne^{jn\omega_0t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the complex Fourier coefficients given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n=\frac{1}{T}\int_{0}^{T}y(t)e^{-jn\omega_0t}dt,\quad\quad T=\frac{2\pi}{\omega_0}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and if we neglect all terms with $|n|&amp;gt;1$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)\approx c_0+2\text{Re}\{c_1 e^{j\omega_0t}\}=c_0+2|c_1|\cos(\omega_0t+\phi_1)=\\=c_0+2|c_1|\sin(\omega_0t+\phi_1+\pi/2),\quad\phi_1=\arg\{c_1\}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing (3) to (1) we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$N(A)=\frac{2jc_1}{A}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in order to compute the describing function $N(A)$ we just need to compute the complex Fourier coefficient $c_1$ of the output of the non-linear system when the input signal is $x(t)=A\sin(\omega_0t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluating (2) for the output signal of an asymmetrical clipper with upper limit $\delta_u$ and lower limit $-\delta_l$, we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_1=-\frac{jA}{2\pi}\left[\sin(\alpha+\beta)\cos(\alpha-\beta)+(\alpha+\beta)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\alpha=\arcsin(\delta_u/A)$ and $\beta=\arcsin(\delta_l/A)$. From (4), the corresponding describing function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$N(A)=\frac{1}{\pi}\left[\sin(\alpha+\beta)\cos(\alpha-\beta)+(\alpha+\beta)\right]\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which for $\alpha=\beta$ (i.e. for symmetrical clipping with $\delta_u=\delta_l$) is equal to the describing function in your question. Note that for asymmetrical clipping the describing function does not completely describe the output $y(t)$ because there is a non-zero DC component $c_0$ which must be added (cf. Eq. (3)).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-28T11:49:22.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18007" PostTypeId="2" ParentId="2969" CreationDate="2014-08-28T12:35:07.910" Score="4" Body="&lt;p&gt;Deconvolution of a noisy data is known to be an ill-posed problem, since the noise is arbitrarily magnified in the reconstructed signal. Therefore, a regularization method is required to stabilize the solution. Here, you can find a MATLAB package that addresses this issue by implementing the Tikhonov's regularization algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/soheil-soltani/TranKin&quot; rel=&quot;nofollow&quot;&gt;https://github.com/soheil-soltani/TranKin&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10939" LastActivityDate="2014-08-28T12:35:07.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18008" PostTypeId="1" CreationDate="2014-08-28T20:41:02.767" Score="1" ViewCount="177" Body="&lt;p&gt;1)Suppose that we have low-pass filter with cf equal to 0.1. How frequency response would look like  if I multiply filter kernel by sine with frequency say 0.3?  How this is related to converting &#xA;low-pass filter algorithm into  bandpass filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)What is the difference between multiplying filter kernel by sine and cosine?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm still don't quite understand the difference between multiplying  filter kernel by sine and cosine. It is said that with help of cosine it is possible to transform lpf to hpf. But I don't understand why? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency spectrum for cosine is similar to sine (is it?) So what's the difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance again.&lt;/p&gt;&#xA;" OwnerUserId="7052" LastEditorUserId="7052" LastEditDate="2014-09-01T19:33:05.563" LastActivityDate="2014-09-01T19:33:05.563" Title="Multiply filter kernel by sine" Tags="|dft|lowpass-filter|homework|bandpass|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18009" PostTypeId="1" CreationDate="2014-08-28T23:43:39.000" Score="1" ViewCount="369" Body="&lt;p&gt;I have a multispectral satellite image and I would like to &quot;transform&quot; each of the image bands into one with integer values. For example to stretch? the image between 0 and 255. Not sure how to proceed with this. I also thought I could make a histogram and replace each pixel value with the bin edge in which it falls into. I'm not sure. I'm currently working in python. Any thoughts on this?&lt;/p&gt;&#xA;" OwnerUserId="8346" LastEditorUserId="8346" LastEditDate="2014-08-29T02:43:48.217" LastActivityDate="2015-01-27T07:54:15.847" Title="float image to integer type image" Tags="|discrete-signals|image-processing|python|histogram|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18010" PostTypeId="2" ParentId="18009" CreationDate="2014-08-29T02:40:36.093" Score="2" Body="&lt;p&gt;You should check the Envi documentation (a standard tool for working with multi/hyper spectral images) on the stretches it uses to fit multi/hyperspectral data into 8 bits for display. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the page on some of the &lt;a href=&quot;http://www.exelisvis.com/docs/BackgroundOptimizedLinearStretch.html&quot; rel=&quot;nofollow&quot;&gt;stretches&lt;/a&gt; used, which apply an affine function to the pixel values and clip the values to the lowest and highest displayable value. In particular, look at the optimized linear stretch, which is the default one Envi uses to display things. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-08-29T02:40:36.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18013" PostTypeId="2" ParentId="15939" CreationDate="2014-08-29T07:49:36.230" Score="1" Body="&lt;p&gt;Let's go step by step.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First of all you can remove perspective distortion without camera calibration. e.g. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Robust Radial Distortion from a Single Image, Faisal Bukhari and Matthew N. Dailey&lt;/em&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;em&gt;Robust Line Based Calibration of Radial Distortion from a Single View, Thorsten Thormahlen, Hellward Broszio, Ingolf Wassermann&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For any given image, Hough transform might find multiple lines, many of those would be an indicator of the same edge. But luckily you could easily merge the lines which overlap. To detect the overlap you could well use the angle between the lines and the distance of lines. This way, you obtain a clustering of the lines. In any case, finding a short line on each edge would be sufficient for you to recover the projective quad.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are always sure that the orientation of this quad is more or less fronto parallel, then you could as well use directed gradients (X or Y) to emphasize the vertical or horizontal lines, during the edge detection step. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I agree with the other comments on Gaussian smoothing and anti aliasing. I would not recommend the use of convex hulls though, as they are very noise sensitive.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-12-27T10:20:17.647" LastActivityDate="2014-12-27T10:20:17.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18014" PostTypeId="1" CreationDate="2014-08-29T08:02:56.590" Score="1" ViewCount="1102" Body="&lt;p&gt;In my research area, instantaneous power in a specific frequency band is commonly estimated by the following procedure: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Apply a bandpass filter on the raw signal (e.g. 80-90Hz bandpass).&lt;/li&gt;&#xA;&lt;li&gt;Estimate the analytical signal by DFT (in Matlab: hilbert())&lt;/li&gt;&#xA;&lt;li&gt;Take the absolute of the result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm wondering how far this procedure smooths. In other words, if I perturb x(t) and then recalculate the instantaneous power, what is the most distant point that will be affected? I understand that the answer will depend on the particular bandpass filter applied. Is there an easy way to approach this?&lt;/p&gt;&#xA;" OwnerUserId="10948" LastEditorUserId="10948" LastEditDate="2014-08-29T10:46:12.383" LastActivityDate="2014-08-29T10:46:12.383" Title="Instantaneous power estimation by discrete hilbert transform - how far does it smooth?" Tags="|matlab|dft|filtering|hilbert-transform|analytic-signal|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18016" PostTypeId="2" ParentId="18005" CreationDate="2014-08-29T08:41:59.580" Score="0" Body="&lt;p&gt;It seems the term (and process) I am looking for is &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow&quot;&gt;autocorrelation&lt;/a&gt;&quot;. &lt;/p&gt;&#xA;" OwnerUserId="7233" LastEditorUserId="7233" LastEditDate="2014-08-29T13:06:23.147" LastActivityDate="2014-08-29T13:06:23.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18017" PostTypeId="1" CreationDate="2014-08-29T12:10:26.183" Score="0" ViewCount="1454" Body="&lt;p&gt;Some posts evocate the computation of convolution or cross-correlation using &lt;a href=&quot;https://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar&quot;&gt;FFT&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/741/why-should-i-zero-pad-a-signal-before-taking-the-fourier-transform&quot;&gt;zero-padding&lt;/a&gt; the temporal signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to compute the autocorrelation of a 3D array using FFTW (2 dimensions are periodic). The file is very large (dimension 256*256*49995, double precision, 25GB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 : Is padding necessary for periodic dimensions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 : Is it possible to avoid zero-padding to limit memory usage? (&lt;a href=&quot;http://www.math.ualberta.ca/~bowman/publications/dealias.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;fftw++&lt;/a&gt; seems to answer yes)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 : From the 3d FFT of the non-padded signal, is it possible to compute the cross-correlation using a Discrete Cosine Transform? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Cross-correlation = DCT[ FFT(signal)*Conjugate(FFT(signal)) ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT - 4 : Is it mandatory to use a &lt;a href=&quot;http://lingpipe-blog.com/2012/06/08/autocorrelation-fft-kiss-eigen/&quot; rel=&quot;nofollow noreferrer&quot;&gt;mask&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10951" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-08-29T13:22:28.643" Title="Autocorrelation and FFT : avoid zero-padding" Tags="|dft|autocorrelation|3d|zero-padding|periodic|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18018" PostTypeId="2" ParentId="17977" CreationDate="2014-08-29T14:24:03.357" Score="1" Body="&lt;p&gt;I would use one delay line for both filters. Of course the delay line must be chosen according to the filter with the highest order. Depending on the SNR (or whatever your criterion is) you can switch between two sets of filter coefficients. For the lower order filter you will get some zero coefficients, so for an efficient implementation you may want to avoid the unnecessary multiplications and additions with zeros. If necessary you can also implement a gradual change from one set of filter coefficients to the other. You can do this by computing the difference between the two sets of coefficients and by adding or subtracting a fraction of this difference to the current coefficients in each time step.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-29T14:24:03.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18019" PostTypeId="1" CreationDate="2014-08-29T16:59:47.917" Score="2" ViewCount="521" Body="&lt;p&gt;I am writing a lens correctionion code and the process should do several things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Inverse fisheye projection to obtain rectilinear image&lt;/li&gt;&#xA;&lt;li&gt;Barrel/pincushion correction&lt;/li&gt;&#xA;&lt;li&gt;Vignetting correction&lt;/li&gt;&#xA;&lt;li&gt;Lateral chromatic aberration correction&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem is - in what order apply these steps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should the image be first &quot;de-fished&quot; or the chromatic aberration, vignetting etc. affects already formed fisheye image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not familiar with optics so maybe any ordering is okay as long as correct models/parameters are used - but I would like to go for simplest solution in that case - e.g. if chromatic aberration is most easily corrected in rectilinear images, then de-fishing should go first.&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2015-02-25T22:09:35.140" Title="Fisheye lens calibration" Tags="|projection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18022" PostTypeId="2" ParentId="18019" CreationDate="2014-08-29T20:58:40.440" Score="1" Body="&lt;p&gt;It seems I found an answer on the &lt;a href=&quot;http://wiki.panotools.org/Lens_correction_model&quot; rel=&quot;nofollow&quot;&gt;Panotools Wiki&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unlike rectilinear lenses, fish-eye lenses do not follow the&#xA;  tangent-plane geometry, but instead have built-in distortions designed&#xA;  to achieve wide fields of view. The radial lens distortion parameters&#xA;  are used the same way for rectilinear lenses and fisheye lenses, but&#xA;  they should never be used to attempt to remap a fisheye to a&#xA;  rectilinear image. This is done by selecting the proper source and&#xA;  destination projection. Fisheye geometry follows a rapidly-changing&#xA;  trigonometric function which can hardly be approximated by a third&#xA;  degree polynomial.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For fisheyes, the lens correction parameters correct for the deviation&#xA;  between a real lens and the ideal fisheye geometry.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The last sentence suggests that the lens correction is done to get a proper geometry of whatever lens it is. The fisheye is therefore remapped &lt;em&gt;after&lt;/em&gt; the lens corrections are done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the &lt;a href=&quot;http://hugin.sourceforge.net/docs/manual/Fulla.html&quot; rel=&quot;nofollow&quot;&gt;Fulla&lt;/a&gt; tool source code from Hugin, it seems that it performs corrections in the following order:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Flat-field correction (i.e. removing vignetting&lt;/li&gt;&#xA;&lt;li&gt;Radial distortion correction (barrel, pincushion, wavy distortion)&lt;/li&gt;&#xA;&lt;li&gt;TCA correction (i.e. removing one type of chromatic aberration)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2014-08-29T20:58:40.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18023" PostTypeId="1" CreationDate="2014-08-29T21:22:02.307" Score="0" ViewCount="898" Body="&lt;p&gt;Suppose I have an input signal which represents a vehicle front suspension response that has been measured using an accelerometer. It is seen that the measured rear suspension response is effectively just a time delayed version of the front suspension response and shifting the rear signal forward in time by the delay causes the signals to align rather well. The intention now is to simulate this rear suspension response without needing an accelerometer to measure it. Knowing the time delay between the two signals, I am trying to simulate the rear suspension response using a set of transfer functions that have been measured on the vehicle.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;s1&lt;/code&gt; is the front signal, &lt;code&gt;s2&lt;/code&gt; is the rear signal. &lt;code&gt;s2sim&lt;/code&gt; is the rear signal that I want to simulate. &lt;code&gt;h11&lt;/code&gt;, &lt;code&gt;h12&lt;/code&gt;, &lt;code&gt;h21&lt;/code&gt; and &lt;code&gt;h22&lt;/code&gt; are the transfer functions used to try and simulate the rear signal. &lt;code&gt;h11= a11/f1&lt;/code&gt; where &lt;code&gt;a11&lt;/code&gt; is the acceleration measured at point 1 when a force is applied at point 1 and &lt;code&gt;h12 = a12/f2&lt;/code&gt; where a2 is acceleration measured at point 1 when force is applied at point 2 and so on. I am also looking at the phase information and making sure that the rear suspension response is replicated rather than the front suspension response.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;S1=fft(s1);    &#xA;Fop1= S1./(h11+(h12.*exp(-1j*w*timedelay)));    &#xA;Fop2=Fop1.*exp(-1j*w*timedelay);    &#xA;S2SIM=(h21.*Fop1)+(h22.*Fop2); % where Fop1 and Fop2 are the operational&#xA;                               % forces at the front and rear respectively&#xA;s2sim=ifft(S2SIM) % or real(ifft(S2SIM));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I look at the phase information, it is nearly identical to the front suspension response rather than the rear and when i take the inverse fft and use the cross correlation to find out the time delay between s1 and s2sim in the time domain, it is seen that the time delay is 0 which means the signal hasn't been delayed so I am doing something wrong. Can anybody help me out here. &lt;/p&gt;&#xA;" OwnerUserId="10854" LastEditorUserId="1606" LastEditDate="2014-08-30T13:41:32.973" LastActivityDate="2014-08-30T13:41:32.973" Title="Why does a phase shift in the frequency domain not produce a time delay in the time domain?" Tags="|matlab|correlation|ifft|delay|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18024" PostTypeId="1" CreationDate="2014-08-30T02:18:45.263" Score="1" ViewCount="362" Body="&lt;p&gt;I want to find the orientation of 2x2 checkerboard cubes, like these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fAK3w.jpg&quot; alt=&quot;Three cubes on the floor&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is to say, I want to recover their positions and rotations within the image relative to the camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my particular case, I care more about the rotation than the position (and the depth barely matters at all). I know the colors ahead of time, and can change them to be more convenient. I want to pick up the cubes, so a hand may be in the frame. The lighting may not be uniform, but the background should be simple (e.g. carpet, table, pavement).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do have a partially working solution, which I've included below as an answer (it makes the question too specific to include it here). But I'm looking for suggestions on how to approach the problem and what techniques to apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other things I've been considering:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use a line detection algorithm to detect edges, and use those to seed hypotheses (instead of the center saddle point).&lt;/li&gt;&#xA;&lt;li&gt;Do a cartesian-to-polar transform at the detected saddle points to turn the angled lines into straight lines (expensive?).&lt;/li&gt;&#xA;&lt;li&gt;Score hypotheses by using them to unskew a face then dot product-ing that against a reference image of the face (but what about lightning changes?).&lt;/li&gt;&#xA;&lt;li&gt;Random combinations of dilation and erosion throughout (invariably doesn't seem to help).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10155" LastEditorUserId="10155" LastEditDate="2014-09-01T18:59:07.997" LastActivityDate="2014-09-05T17:16:25.190" Title="Pose estimation of colored checkerboard cubes" Tags="|image-processing|algorithms|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18025" PostTypeId="2" ParentId="18024" CreationDate="2014-08-30T03:30:57.317" Score="1" Body="&lt;p&gt;This is the partial solution alluded to in the question. Should I be using a totally different approach (probably)? Are there standard operations that do what I've cobbled together (definitely)?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Sample circularly at a radius of ~6 around each pixel and compute the sum of the absolute differences to the opposite side. This seems to do a pretty good job of picking up edges, and smoothing noise:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MLkQU.png&quot; alt=&quot;Half-turn edges&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do the same thing again but, instead of comparing across to the 180 degree counterpart, compute differences to the 90 degree counterparts. This still picks up edges, but &lt;em&gt;especially&lt;/em&gt; picks up the saddle points at the centers of each face (less so when tilted, though):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qM4hO.png&quot; alt=&quot;Quarter-turn edges&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Subtract the previous two transformations, cancelling the edges and keeping the saddle points. This seems to work quite well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1PH9t.png&quot; alt=&quot;Saddle points&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find isolated local maxima in the saddle point image. At each one over some threshold, sample every pixel a distance of ~10 away. Find the alternating colors via a kmeans with k=2 on those pixels' colors. Use the resulting labels and a simple maximization algorithm to estimate the angles where the colors switch. If the kmeans match is terrible or there's lots of mismatches between the angles, discard the point as a false-positive::&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AolwO.png&quot; alt=&quot;Saddle points with directions&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each remaining saddle point, offset by ~15 along each of its diagonal directions and do a flood fill against a finer version of the half-turn-edges image, made by sampling at a radius of ~2 instead of ~6:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nFUCE.jpg&quot; alt=&quot;Finer half-turn edges (not flood-filled)&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each flooded area, compute its contour and fit a rectangle. If the rectangle covers significantly more area than the contour, the flood fill probably escaped the face. For the flood fills that worked, use the furthest points along the diagonals (the support points) to estimate the position of the corners and the side-centers. If the two flood fills adjacent to a side succeed, average the points. When 2/4 or 1/4 of the flood fills for a saddle point failed, use the existing points to infer the missing ones:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k934U.png&quot; alt=&quot;Face cells&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the four estimated corners to compute a perspective warp. Try to refine the warp by tweaking the points and preferring lots of brightness near the sides and equators of the half-turn-difference transformed image... and otherwise lots of darkness in the interior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DWmfc.png&quot; alt=&quot;Faces&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(todo) Fuse the found faces into cubes. Recover the entire 3d pose.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From my experimenting, the weaknesses of this method are mainly:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bad at finding saddle points on faces titled more than ~45 degrees.&lt;/li&gt;&#xA;&lt;li&gt;Bad at refining the faces, unless the flood fill gets it extremely close to correct.&lt;/li&gt;&#xA;&lt;li&gt;Bad at excluding close false positives, like if the saddle point on an edge is assumed to be a center.&lt;/li&gt;&#xA;&lt;li&gt;Any blurring from motion ruins the saddle point discovery.&lt;/li&gt;&#xA;&lt;li&gt;Doesn't infer poses from the faces, yet.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also its kind of slow, running at about 1fps, but I haven't put much effort into optimizing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="10155" LastEditorUserId="10155" LastEditDate="2014-09-01T19:02:04.783" LastActivityDate="2014-09-01T19:02:04.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18026" PostTypeId="1" AcceptedAnswerId="18031" CreationDate="2014-08-30T03:40:58.983" Score="2" ViewCount="597" Body="&lt;p&gt;Does anyone know what the heck is a coupled-air microphone? I know that they were used for recording internal body sounds in papers like &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/19002477&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://onlinelibrary.wiley.com/doi/10.1111/j.1365-2036.2010.04559.x/full&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;. I googled the term, but I couldn't find any circuitry schema or place where to buy one. Are they some kind of diaphragm, condenser or contact microphone?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7316" LastActivityDate="2016-01-27T08:50:26.060" Title="Air-coupled microphone" Tags="|sound|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18028" PostTypeId="1" CreationDate="2014-08-30T07:25:17.350" Score="0" ViewCount="147" Body="&lt;p&gt;I wanna experiment k-means clustering method on different kind of images, so I am trying to find different kind of images used in image segmentation such as MRI images.I want to gather some more categories.&lt;br&gt;&#xA;Any suggestion would be gratefully appreciated.   &lt;/p&gt;&#xA;" OwnerUserId="10957" LastActivityDate="2015-01-30T20:35:05.517" Title="Image Segmentation applications" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18031" PostTypeId="2" ParentId="18026" CreationDate="2014-08-30T11:57:14.823" Score="3" Body="&lt;p&gt;Problem you are aiming at is connected with Phonocardiography (recording bodily sounds). Traditionally contact sensors (such as stethoscopes) were used for this task, but problem is that you must raise and lower the device between two measurements. In case of air-coupled microphone (meaning that it is not touching the body) you can move it constantly, performing a continuous measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously there is some disadvantage, such that it is prone to environmental noise, but shielding (tubes) are used, as well as microphone arrays for noise cancellation. Problem of coupling the membrane with patient body is very hard to tackle, as big mismatch exists between air characteristic impedance and body impedance, but using a conical shape is helping to transform these impedances. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of microphones were being used? These are almost the same used widely in recordings:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Condenser&lt;/li&gt;&#xA;&lt;li&gt;Electret&lt;/li&gt;&#xA;&lt;li&gt;Piezoelectric&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some of these were adapted for recording of infra-sounds, i.e. Brüel &amp;amp; Kjaer, model 4117 or other great, 4135. Although people are also using quite cheap electret microphones for this task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This article can shed some light on that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.ndt.net/article/wcndt2012/papers/410_wcndtfinal00410.pdf&quot; rel=&quot;nofollow&quot;&gt;Algernon D., et al. - &lt;em&gt;Signal Processing for Air-Coupled Impact-Echo&#xA;  using Microphone&#xA;  Arrays&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2016-01-27T08:50:26.060" LastActivityDate="2016-01-27T08:50:26.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18032" PostTypeId="1" AcceptedAnswerId="18034" CreationDate="2014-08-30T13:45:26.957" Score="2" ViewCount="3149" Body="&lt;p&gt;There is a lot of tools for designing FIR filters. Using one such tool I have designed a filter that satisfies my needs. It's coefficients are as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0.000106519966569472&#xA; 0.000164942422133671&#xA; 0.000154198611135164&#xA;-0.000051344150552581&#xA;-0.000527514219352601&#xA;-0.001228193882673074&#xA; ...&#xA; 0.176493072494376790&#xA; ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my system, 0.0001 / 0.1764 is about the same as ADC noise (well, not quite, but close). I'd like to know if a shorter filter, with some taps stripped off (zeroed) on either side still satisfies my requirements. This could be done by taking the modified array of the coefficients and reconstructing the frequency response of the modified filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tools for it (the cheaper the better)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tool works great. I post the result below. Good news is that only higher frequency response is visibly altered. Bad news is that by quite a lot. I am more interested in pass-band and slope, but I will look at more filter design tools to see if any of them has this sort of tradeoff built in. Thanks jojek.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JNDfu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7098" LastEditorUserId="7098" LastEditDate="2014-08-30T16:49:50.290" LastActivityDate="2014-08-30T16:49:50.290" Title="Reconstruct FIR frequency response from the coefficients" Tags="|filters|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18033" PostTypeId="2" ParentId="18032" CreationDate="2014-08-30T14:36:59.380" Score="0" Body="&lt;p&gt;You could use a smooth window function to make the filter shorter, i.e. you multiply the coefficient vector element-wise by a shorter window function in a way that you only get rid of the small coefficients on both ends of the impulse response. Performing an FFT on the windowed filter coefficients will show you if the filter still satisfies your specs. BUT, why don't you just use the filter design tool to design another shorter filter and see if it satisfies the specs? This second approach will most likely yield a better filter for a given filter length than the first one.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-08-30T14:36:59.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18034" PostTypeId="2" ParentId="18032" CreationDate="2014-08-30T15:02:48.337" Score="3" Body="&lt;p&gt;You can try to window the filter with some window function, i.e. Gaussian, to get rid of small coefficients (taper them). Although it won't really work very well and you might really want to think about redesigning your filter - it's the best solution in my opinion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example for a bandpass filter, showing that it is not really working well and is affecting the frequency response. Everything is done in Python so presumably  it's meeting your requirements of not spending a single penny.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M9MPa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;# Some sampling frequency&#xA;fs = 48000.0    &#xA;# Size of FFT analysis&#xA;N = 1024&#xA;&#xA;def fir_freqz(b):&#xA;    # Get the frequency response&#xA;    X = np.fft.fft(b, N)&#xA;    # Take the magnitude&#xA;    Xm = np.abs(X)&#xA;    # Convert the magnitude to decibel scale&#xA;    Xdb = 20*np.log10(Xm/Xm.max())&#xA;    # Frequency vector&#xA;    f = np.arange(N)*fs/N        &#xA;&#xA;    return Xdb, f&#xA;&#xA;if __name__ == &quot;__main__&quot;:&#xA;&#xA;    # FIR filter coefficients&#xA;    b = np.array([-0.0159147603287189,  0.000745724267485,  &#xA;                   0.0404251831063147,  0.019042013872129,  &#xA;                  -0.0644535904607569, -0.054523709591490,&#xA;                   0.0787623967281351,  0.105430811100048,&#xA;                  -0.0645610841865355, -0.148306808873938,&#xA;                   0.0257418551415616,  0.166568575042643,&#xA;                   0.0257418551415616, -0.148306808873938,&#xA;                  -0.0645610841865355,  0.105430811100048,&#xA;                   0.0787623967281351, -0.054523709591490,&#xA;                  -0.0644535904607569,  0.019042013872129,&#xA;                   0.0404251831063147,  0.000745724267485,&#xA;                  -0.0159147603287189])&#xA;&#xA;    # Window to be used&#xA;    win = np.kaiser(len(b), 15)&#xA;    # Windowed filter coefficients&#xA;    b_win = win*b&#xA;&#xA;    # Get frequency response of filter&#xA;    Xdb, f = fir_freqz(b)&#xA;    # ... and it mirrored version&#xA;    Xdb_win, f = fir_freqz(b_win)&#xA;&#xA;&#xA;    # Plot the impulse response&#xA;    plt.subplot(211)&#xA;    plt.stem(b, linefmt='b-', markerfmt='bo', basefmt='k-', label='Orig. coeff.')&#xA;    plt.grid(True)&#xA;    plt.hold(True)&#xA;    plt.stem(b_win, linefmt='r-', markerfmt='ro', basefmt='k-', label='Windowed coeff.')&#xA;    plt.plot(win*b.max(), '--g', label='Window function')&#xA;&#xA;    plt.title('Impulse reponse')&#xA;    plt.xlabel('Sample')&#xA;    plt.ylabel('Amplitude')&#xA;    plt.legend()&#xA;&#xA;    # Plot the frequency response&#xA;    plt.subplot(212)&#xA;    plt.plot(f, Xdb, 'b', label='Orig. coeff.')&#xA;    plt.grid(True)&#xA;    plt.hold(True)&#xA;    plt.plot(f, Xdb_win, 'r', label='Windowed coeff.')&#xA;&#xA;    plt.title('Frequency reponse')&#xA;    plt.xlabel('Frequency [Hz]')&#xA;    plt.ylabel('Amplitude [dB]')&#xA;    plt.xlim((0, fs/2)) # Set the frequency limit - being lazy&#xA;    plt.legend()&#xA;&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-08-30T15:02:48.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18036" PostTypeId="1" AcceptedAnswerId="18037" CreationDate="2014-08-30T21:04:59.523" Score="0" ViewCount="460" Body="&lt;p&gt;I'm working on creating a simple program to render spectrograms like &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectrogram#mediaviewer/File:Spectrogram_of_violin.png&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;. In this plot, the X-axis is time, the Y-axis is frequency, and the color represents the magnitude of the DFT at that frequency and time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have most of this working, but I'm not exactly sure how to interpret the magnitude value. I'm computing it as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;real * real + imaginary * imaginary&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that I'm not square rooting it, since Wikipedia indicates that the spectrogram should be related to the &lt;em&gt;square of the magnitude&lt;/em&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen certain spectrograms which work with magnitude on the &lt;a href=&quot;http://en.wikipedia.org/wiki/DBFS&quot; rel=&quot;nofollow&quot;&gt;dBFS&lt;/a&gt; scale. What's the process to translate these magnitudes to this scale? Or, alternatively, is there some easier way to go about this?&lt;/p&gt;&#xA;" OwnerUserId="10962" LastActivityDate="2014-08-30T21:27:08.903" Title="Interpreting magnitude of DFT results" Tags="|dft|stft|magnitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18037" PostTypeId="2" ParentId="18036" CreationDate="2014-08-30T21:21:12.050" Score="1" Body="&lt;p&gt;One common practice is to take the log of the squared magnitude of the DFT frames, as in log(re*re+im*im), scale that, and use the scaled log as an integer index into an RGB color lookup table (&quot;hotter&quot; colors for larger magnitudes).  The scale is determined so that the range in your data fits within the color index table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A log scale is used, since it's a closer match to human perception of loudness than a linear scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A square root is un-needed, as that's the same as adjusting the scale after the log by 0.5.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-30T21:27:08.903" LastActivityDate="2014-08-30T21:27:08.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18038" PostTypeId="1" CreationDate="2014-08-30T23:55:57.303" Score="4" ViewCount="693" Body="&lt;p&gt;I am using MUSIC (Multiple Signal Classification) to determine Direction Of Arrival (DOA) and frequency of signals impinging on an Antenna Array. I am using a function &lt;code&gt;MUSIC(U,V)&lt;/code&gt; which accepts left and right singular vectors of a matrix &lt;code&gt;X&lt;/code&gt;. &lt;code&gt;U&lt;/code&gt; is used to determine frequencies whereas &lt;code&gt;V&lt;/code&gt; is used to determine the DOA (&lt;strong&gt;Method I&lt;/strong&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to reduce SVD computation by making &lt;code&gt;X&lt;/code&gt; sparse. Assuming, &lt;code&gt;X&lt;/code&gt; has no noise, taking DFT of &lt;code&gt;X&lt;/code&gt; results in sparse matrix with peaks only at indexes relating to frequency of a signal and sine of the direction of arrival. The rest are zero. &lt;code&gt;SVD()&lt;/code&gt; function in MATLAB is used to calculate reduced singular vectors which on which later inverse DFT is performed. Feeding them to &lt;code&gt;MUSIC(S,V)&lt;/code&gt; gives same results as without taking the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Matrix obtained after DFT is not sparse as it contains some value instead of zero. It is because of precision error. If filtering is performed, although there is no noise present, these precision errors are treated as noise and are set to zero. (&lt;strong&gt;Method II&lt;/strong&gt;) This results in inaccurate peaks for frequency. DOA remains unaffected. The original matrix can still be reconstructed without any noticeable difference. However, if SVD is performed after reconstructing the original matrix from svd of filtered matrix, the inaccurate peaks in frequency vanish. (&lt;strong&gt;Method V&lt;/strong&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please follow the post below for further clarification. Methods in parentheses are further explained below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let:  $$X =&#xA;\begin{pmatrix}&#xA;x_{11} &amp;amp;  x_{12}  &amp;amp; \ldots &amp;amp; x_{1L}\\&#xA;x_{21}  &amp;amp;  x_{22} &amp;amp; \ldots &amp;amp; x_{2L}\\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \vdots\\&#xA;x_{N1}  &amp;amp;   x_{N1}       &amp;amp;\ldots &amp;amp; x_{NL}&#xA;\end{pmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L$ - no of antennas&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N$ - no of samples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, columns specify antenna number, whereas row specifies sample. For example: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$x_{11}$ - means first sample of first antenna&lt;/li&gt;&#xA;&lt;li&gt;$x_{1L}$ - means first sample Lth antenna&lt;/li&gt;&#xA;&lt;li&gt;$x_{51}$ - means fifth sample of first antenna&lt;/li&gt;&#xA;&lt;li&gt;$x_{NL}$ - means Nth sample of Lth antenna&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Calculating SVD, &lt;code&gt;[U,S,V] = svd(X)&lt;/code&gt;, is computationally intensive so I would like to reduce &lt;code&gt;X&lt;/code&gt; to sparse matrix. One method for doing that is to take double sided DFT and filter noise. In MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ &#xA;F_{f} = \frac{1}{\sqrt{N}} * \mathrm{FFT}(I_N) \\ &#xA;F_d = \frac{1}{\sqrt{L}} * \mathrm{FFT}(I_L)&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $I_N$ and $I_L$ are square identity matrix of size $N$ and $L$ respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ XDF = F_f \times X \times F_d $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets suppose $X$ had no noise. Also, lets suppose that taking DFT doesn't result in signal leakage. Then if no of signals impinging on antenna array = $D$, with every signal having an orthogonal frequency, &lt;code&gt;XDF&lt;/code&gt; will have peaks at $D$ locations, the rest being zero. Since a double sided DFT was performed, row index corresponds to normalised frequencies and column index corresponds to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2\pi \frac{\lambda}{c}\sin(\theta)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta$ is a direction of arrival&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Method I&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;IF $X$ had originally no noise, and $D$ signals with orthogonal frequencies impinged on antenna array, &lt;code&gt;XDF&lt;/code&gt; (matrix of $M$ x $L$) would contain $D$ non-zero values. Then &lt;code&gt;[U,S,V] = svd(X,0)&lt;/code&gt; is calculated. Inverse Fourier Transform performed by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;U = Ff' * U&#xA;V = Fd * V&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Resulting &lt;code&gt;U&lt;/code&gt;,&lt;code&gt;V&lt;/code&gt; are passed to &lt;code&gt;MUSIC(U,V)&lt;/code&gt; and frequencies are determined without error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Follwoing are graphs of frequency and sparsity of &lt;code&gt;XDF&lt;/code&gt; when $D=3$, $N = 30$ and $L = 20$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lbDPP.png&quot; alt=&quot;Freqquency&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/L6jxd.png&quot; alt=&quot;Sparsity&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Method II&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We see that despite what we expected, &lt;code&gt;XDF&lt;/code&gt; is not sparse. The reason lies in the fact that instead of zero, there are precision errors to the order of $10^{-16}$ which nevertheless appear as a blue dot. Lets suppose a noise filter was applied that was supposed to remove all values smaller than $10^{-6}$, we get the following sparse matrix just as desired, with the precision errors exclusively forced to $0$.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ihKZW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it creates the aliasing in frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9qj9K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Method III&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;However, if noise of minute order ($10^{-4}$) is re-added to &lt;code&gt;XDF&lt;/code&gt;, aliases disappear. &lt;strong&gt;Adding noise is improving the MUSIC!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;density_ = 0.1;&#xA;coeff = 0.0001;&#xA;randomr = sprand(N,L,density_);&#xA;randomi = sprand(N,L,density_);}&#xA;XDF = XDF + 0.0001*(full(randomr) + sqrt(-1)*full(randomi));&#xA;[U,S,V] = svd(XDF,0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IfT5y.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Hftlj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Method IV&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;However, if MATLAB function &lt;code&gt;svds&lt;/code&gt; (&lt;code&gt;svd&lt;/code&gt; for sparse) is used, which calculates using &lt;code&gt;evds&lt;/code&gt; (eigen values for sparse) which in turn uses Lanczos Algorithm, we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B4QvB.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tX3uD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Method V&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If $$ [U,S] = XDF\times XDF^H \\&#xA;[V,S] = XDF^H \times XDF \\&#xA;U = F_{f}^{H} \times U \\&#xA;V = F_{d} \times V $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;MUSIC(U,V)&lt;/code&gt; also gives the same result as above, i.e. method &lt;strong&gt;IV&lt;/strong&gt;. It can be argued that a possible reason for inaccurate results in &lt;strong&gt;II&lt;/strong&gt; are errors induced by setting precision errors to zero. However, &lt;code&gt;X&lt;/code&gt; calculated by multiplying &lt;code&gt;U*S*V'&lt;/code&gt; is only slightly different from the original &lt;code&gt;X&lt;/code&gt;. On the order of $10^{-16}$. Also, if &lt;code&gt;X&lt;/code&gt; is again decomposed into its singular vectors, we again get the accurate results as in &lt;strong&gt;III&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;My question is:&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Problem in &lt;strong&gt;II&lt;/strong&gt; gets solved if we make $L&amp;gt;M$. Make number of columns more than number of rows.&lt;/li&gt;&#xA;&lt;li&gt;In &lt;strong&gt;II&lt;/strong&gt;, if instead of economical SVD, full SVD is used, problems still disappear&lt;/li&gt;&#xA;&lt;li&gt;In &lt;strong&gt;II&lt;/strong&gt;, if &lt;code&gt;[U,S,V] = svd(XDF,0)&lt;/code&gt; and next step is &lt;code&gt;U = Ff*U', V = Fd*V;&lt;/code&gt;, &lt;code&gt;abs(U)&lt;/code&gt; shows that magnitude of every entry in &lt;code&gt;U&lt;/code&gt; is equal to $1/\sqrt{N}$. This is not the case for &lt;strong&gt;I&lt;/strong&gt;, &lt;strong&gt;III&lt;/strong&gt; and &lt;strong&gt;IV&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I tried to try other methods of calculating svd such as &lt;a href=&quot;http://www.math.pitt.edu/~sussmanm/2071Spring08/lab09/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Jacobi SVD&lt;/strong&gt;&lt;/a&gt;. However, since &lt;code&gt;XDF&lt;/code&gt; is sparse, Jacobi Rotation matrices are zero and division by zero results in undefined &lt;code&gt;U&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I have considered using pre-developed C++ libraries such as &lt;em&gt;Eigen&lt;/em&gt;, &lt;em&gt;Alglib&lt;/em&gt;, but creating their MEX file is really cumbersome. Some libraries such as &lt;em&gt;ARmadillo&lt;/em&gt; and &lt;em&gt;redsvd&lt;/em&gt; are already based on LAPACK - same as MATLAB so it is useless.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate if anyone could help me regarding in these issues. I would love to narrow down my problem by trying other SVD algorithms but like i said, it is very time consuming to make MEX file for all those C++ libraries. Then, I am not even sure if the problem lies in different methods of SVD calculation. The singular matrices themselves are not incorrect. Since, they successfully reconstruct the initial matrix &lt;code&gt;X&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, somehow, in &lt;strong&gt;II&lt;/strong&gt;, for sparse matrix it requires full left singular matrix to identify frequencies. Furthermore, this problem is faced only when finding frequencies and not for DOA. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a description of how &lt;code&gt;MUSIC(U,V)&lt;/code&gt; works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a function &lt;code&gt;MUSIC(U,V)&lt;/code&gt; to determine frequencies and DOA. &#xA;$$[U_{s} U_{n}] = U \\ [V_{s} V_{n}] = V$$&lt;br&gt;&#xA;if number of incoming signals is $D$, size of&#xA;$$&#xA;U = M \text{  x  } L\\ V = L \text{  x  } L \\ U_{s} = M \text{  x  } D \\ U_{n} = M \text{  x  } (L-D) \\ V_{s} = L \text{  x  } D \\ V_{n} = L \text{  x  } (L-D)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since, signal and noise singular vectors are supposed to be orthogonal to each other, Vector $a$, defined as &#xA;$$&#xA;a = \begin{bmatrix} e^{-j2\pi f0} \\ e^{-j2\pi f1} \\ \vdots \\ e^{-j2\pi f(M-1)} &#xA;\end{bmatrix}&#xA;$$ &#xA;If $f$ is a frequency of one of the arriving signals: &#xA;$$&#xA;a\cdot U_n = 0, \text{ and } \frac{1}{a\cdot U_n} = \infty $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, what &lt;code&gt;MUSIC(S,V)&lt;/code&gt; does is search for peaks over frequency range from $-0.5$ to $0.5$. $f$ is a normalised frequency.&lt;/p&gt;&#xA;" OwnerUserId="10963" LastEditorUserId="8202" LastEditDate="2014-08-31T00:50:33.810" LastActivityDate="2014-08-31T00:50:33.810" Title="Incorrect Frequency results when using Multiple Signal Classification (MUSIC)" Tags="|frequency|dft|signal-detection|music|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18040" PostTypeId="2" ParentId="17970" CreationDate="2014-08-31T01:31:34.930" Score="1" Body="&lt;p&gt;It is easier to do this in &lt;code&gt;HSV&lt;/code&gt; color space than &lt;code&gt;RGB&lt;/code&gt; color space.&lt;br&gt;&#xA;Assume the &lt;code&gt;first image&lt;/code&gt;(the pinky one) is imported into matlab workplace as &lt;code&gt;variable A&lt;/code&gt;,and the &lt;code&gt;second&lt;/code&gt;(the yellowish one) as &lt;code&gt;variable B&lt;/code&gt;.&lt;br&gt;&#xA;First, I removed the white margin of both A and B with a same Rect:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Rect=[82.51 32.51 511.98 509.98]; % I found this with [~,Rect]=imcrop(A);&#xA;A_c=imcrop(A,Rect);&#xA;B_c=imcrop(B,Rect);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am going to find a simple way to transform image A_c to B_c in HSV color space;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A_c_hsv=rgb2hsv(A_c);&#xA;B_c_hsv=rgb2hsv(B_c);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Read the wikipedia page of HSV.. you will find that most different parts  between the two images must be in the &lt;code&gt;Hue&lt;/code&gt; parts,i.e,  between &lt;code&gt;A_c_hsv(:,:,1)&lt;/code&gt;  &amp;amp;  &lt;code&gt;B_c_hsv(:,:,1)&lt;/code&gt; ;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the average difference between their hues is:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ave_dif_in_hue=mean(mean(B_c_hsv(:,:,1)-A_c_hsv(:,:,1)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I just used the hue parts in my transform:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A_c_hsv_transformed=A_c_hsv; % make a copy of A_c_hsv&#xA;A_c_hsv_transformed(:,:,1)=A_c_hsv_transformed(:,:,1)+ave_dif_in_hue; % change the hue parts only&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;let's check our transform:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure;&#xA;subplot(1,3,1);imshow(A_c);title('original A_c');&#xA;subplot(1,3,2);imshow(B_c);title('original B_c');&#xA;subplot(1,3,3);imshow(hsv2rgb(A_c_hsv_transformed));title('transformed from A_c');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;here is the result:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9C28P.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;you can optimize the transform further, with dealing with the other two channel in HSV color space..&lt;br&gt;&#xA;Or.Maybe something more needed.&lt;/p&gt;&#xA;" OwnerUserId="4467" LastEditorUserId="4467" LastEditDate="2014-08-31T02:08:28.190" LastActivityDate="2014-08-31T02:08:28.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18041" PostTypeId="1" CreationDate="2014-08-31T07:52:58.383" Score="3" ViewCount="282" Body="&lt;p&gt;Assume i have a discrete signal, which i want to up-sample by factor 100.&#xA;Up-sampling using poly-phase algorithm sounds like a bad idea, in terms of cache low-efficiency due to low space-locality of the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Itay&lt;/p&gt;&#xA;" OwnerUserId="10966" LastActivityDate="2014-09-02T20:55:40.207" Title="upsampling by huge factor" Tags="|interpolation|supersampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18042" PostTypeId="2" ParentId="18041" CreationDate="2014-08-31T10:48:26.627" Score="2" Body="&lt;p&gt;Upsampling by 100 can be factored into upsampling by 2X, 2X, 5X and 5X for each output block (output blocks sized to be data cache resident), thus requiring a smaller phase table for each FIR interpolation kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some output points may either need to be overlapped across blocks or re-calculated, depending on computation speed vs cache load latency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-08-31T10:54:28.577" LastActivityDate="2014-08-31T10:54:28.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18043" PostTypeId="1" AcceptedAnswerId="18044" CreationDate="2014-08-31T11:47:07.707" Score="2" ViewCount="9764" Body="&lt;p&gt;trying simply to create femtosecond pulse in MATLAB exactly like in the attached image, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J6aGs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the carrier frequency is around 374THz, and my sampling frequency is 10 times the carrier. &#xA;The results of the fft yields nothing understandable... tried to change some of the variables, fs,t-around zero, fftshift...&#xA;but could not conclude what's wrong with code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;my code follows matlab fft example :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all ; close all ; clc&#xA;f=374.7e12;%Thz&#xA;fs=f*10; %sampling frequency&#xA;T=1/fs;&#xA;L=1000;&#xA;sigma=5e-15;&#xA;t=(0:L-1)*T; %time base&#xA;&#xA;&#xA;&#xA;x=(exp(-(t-50e-15).^2/(2*sigma)^2)).*exp(-1i*2*pi*f*t);&#xA;subplot(2,1,1)&#xA;plot(t,real(x),'b');&#xA;title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);&#xA;xlabel('Time(s)');&#xA;ylabel('Amplitude');&#xA;ylim([-1 1]) &#xA;xlim([10e-15 90e-15])&#xA;&#xA;NFFT = 2^nextpow2(L);&#xA;X = fft(x,NFFT)/L;&#xA;Pxx=X.*conj(X)/(NFFT*NFFT); %computing power with proper scaling&#xA;f = fs/2*linspace(0,1,NFFT/2+1); %Frequency Vector&#xA;&#xA;subplot(2,1,2)&#xA;plot(f,2*abs(X(1:NFFT/2+1)))&#xA;title('Magnitude of FFT');&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('Magnitude |X(f)|');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the results are : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NVsdK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5674" LastActivityDate="2019-04-04T08:52:51.600" Title="Simple fft to Gaussian pulse with MATLAB" Tags="|matlab|fft|gaussian|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18044" PostTypeId="2" ParentId="18043" CreationDate="2014-08-31T12:23:08.670" Score="0" Body="&lt;p&gt;You simply don't plot what you want to see. Note that your time domain signal is complex-valued and you modulate by a &lt;em&gt;negative&lt;/em&gt; frequency. So the range of frequencies where things are happening are the negative frequencies (or - by periodicity - the frequencies in the range $[f_s/2,f_s]$), but those you don't plot. If you change the definition of your frequency vector and the corresponding plot command you'll see what you expect to see (i.e. a Gaussian in the frequency domain centered at $f_s-f=3.37e15$ Hz):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = fs*linspace(0,1,NFFT); % (full range) Frequency Vector&#xA;...&#xA;plot(f,2*abs(X)) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/j2Tnc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR, simply change the negative modulation frequency to a positive one&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=(exp(-(t-50e-15).^2/(2*sigma)^2)).*exp(1i*2*pi*f*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and leave everything else unchanged. Then the Gaussian in the frequency domain is centered at $f=374.7$ THz. This is probably what you expected to see in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/32Frb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-08-31T12:44:05.233" LastActivityDate="2014-08-31T12:44:05.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18046" PostTypeId="1" CreationDate="2014-09-01T14:11:11.257" Score="0" ViewCount="893" Body="&lt;p&gt;I have generated sinsuoids containing fundamental with harmonics using C++. Fundamental frequency is 50 Hz and each of the harmonic has phase offset of 60 degrees. I have applied flattop window before performing and N point FFT. Magnitude repose is correct. Phase reponse is wrong. I should expect 60 degree in all 100,150,200,250 Hz.&#xA;I have attached the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling rate : 40000&#xA;Timeduration : 1s&#xA;Maximim amplitude of each of the harmonic : 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be highly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Iwf56.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yPKpF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Faisal&lt;/p&gt;&#xA;" OwnerUserId="10970" LastActivityDate="2015-02-28T23:52:07.193" Title="phase angle of harmonic" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18047" PostTypeId="2" ParentId="15107" CreationDate="2014-09-01T15:40:28.757" Score="2" Body="&lt;p&gt;Since visoft requested i post the solution, here goes. It has been a while so not all the details are still fresh so feel free to ask anything if things are unclear!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we have an image $I$ and apply a filter, which is given by convolution by some $F$. The pixel values of $I$ convolved with $F$ are all the output of the inner product of $I$ with a translated (and less importantly: mirrored) version of $F$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i missed at the time was that each pixel should be seen as a coefficient of the new representation of the image. So instead of the 16 subbands i mentioned, the number of coefficients of our new representation is 16 &lt;em&gt;times the number of pixels in the image&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some notation: for pixel number $(a,b)$, let us write $F_{(a,b)}$ for $F$ translated $(a,b)$ steps (and mirrored) and $(I * F)(a,b)$ for the $(a,b)$-th pixel of $I$ convolved with $F$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, let us call all the translated versions of $F$ our &lt;em&gt;basisfunctions&lt;/em&gt;. One can check from the definition of convolution that if we convolve our filter output again with $F$, this results in multiplying every basisfunction $F_{(a,b)}$ by the coefficient $(I * F)(a,b)$ and adding them up. This results in&#xA;\begin{align*}&#xA;I * F * F &amp;amp;= \sum_{(a,b)} (I * F)(a,b) \cdot F_{(a,b)}\\&#xA;&amp;amp;= \sum_{(a,b)} \langle I, F_{(a,b)}\rangle \cdot F_{(a,b)} &#xA;\end{align*}&#xA;where the last equality follows by definition of convolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, one easily recognizes something that comes up using an orthogonal basis. Now the collection of $F_{(a,b)}$ for all $(a,b)$ is called a tight frame if the above mathematical expression is equal to $I$ itself! It is thus very similar to an orthogonal basis, except that one does not need the set $\{F_{(a,b)}\}_{(a,b)}$ to be linearly independent (if you are very sharp you will note that in this particular case it most likely &lt;em&gt;will&lt;/em&gt; be linearly independent, but see the following).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the paper, actually about 16 of these $F's$ are used. Let's number them $F_1$ up to $F_n$. This is called a tight frame if the following holds:&#xA;$$&#xA;I = \sum_n \sum_{(a,b)} \langle I, F_{n,(a,b)} \rangle \cdot F_{n,(a,b)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This expression is equal to (check this):&#xA;$$&#xA;I = \sum_n (I * F_n * F_n).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since convolution is equivalent to multiplication in the fourier domain, one can check this by going to the fourier domain, squaring all the $F_n$ pointwise and adding them up. That's simple to do. If that adds to an image that is equal to 1 in every pixel, we are dealing with a tight frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So concluding, i missed two things: convolving with one $F$ gives as much coefficients as there are pixels in the image, and convolving twice actually multiplies the basisfunctions with the coefficients and adds them up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said, I wrote this quickly and it has been a while, so if anything is unclear feel free to ask again!&lt;/p&gt;&#xA;" OwnerUserId="8289" LastActivityDate="2014-09-01T15:40:28.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18048" PostTypeId="2" ParentId="18046" CreationDate="2014-09-01T16:32:48.887" Score="2" Body="&lt;p&gt;Your window is centered around the middle of the time window. This corresponds (roughly speaking) to a delay of half the window size and corresponding additional phase of $e^{-j \cdot \omega \cdot t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;wiggles&quot; that you see is a steep linear phase that wraps around 2*pi occasionally. There a few ways to fix this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;circularly shift the time domain signal so that the max of the window is at 0. This will be better but still isn't great since the windowing will significantly impact the phase. &lt;/li&gt;&#xA;&lt;li&gt;Make sure that the fundamental fits into your time window and integer amount of times. Then do an FFT without windowing. This should give you an exact result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-09-01T16:32:48.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18049" PostTypeId="1" CreationDate="2014-09-01T17:48:04.280" Score="1" ViewCount="188" Body="&lt;p&gt;I have to compute the some operations (say sum and subtraction) between 2 signals.&#xA;I have data in PDM domain:&#xA;x1_pdm(t)=[0101011....];&#xA;and&#xA;x2_pdm(t)=[0101011....];&#xA;What I do now is:&#xA;convert x1_pdm and x2_pdm in PCM domain (low pass filter and decimation factor M=64) and that compute the sum and difference (or any other operation). Is it possible to perform this sum and sub in PDM domani with bitwise operation ? and then compute one pdm to pcm conversion...&#xA;thank you &#xA;mattia&lt;/p&gt;&#xA;" OwnerUserId="8209" LastActivityDate="2020-08-22T05:01:05.180" Title="Is possible to perform algebric operation with bitwise operations in PDM domain?" Tags="|conversion|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18050" PostTypeId="2" ParentId="17967" CreationDate="2014-09-01T18:20:00.637" Score="2" Body="&lt;p&gt;Because of their ability to better represent signals, Ridgelet transforms are preferred over Wavelet transforms in general. However, to be used in practice it has to be discretized. Now, the discretization of Ridglet transform is a challenging task on its own as it involves interpolation in polar coordinates which makes perfect reconstructions (inversions) difficult. For example, Minh N. Do and Martin Vetterli propose an orthonormal version of Ridgelet Transform to achieve better invertability [1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ridgelet transform enhances the idea of point-to-point mapping of singularities to point-to-line mappings, which is more effective in handling directions. Yet, even Ridgelets might be ineffective for certain applications such as image processing, where edges are curved rather than being straight lines. In such cases, better transforms such as Curvelets are already proposed and proven to be more powerful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this regard, the method of choice really depends on your application. As wiki quotes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Continuous Wavelet Transform (CWT) is very efficient in determining the damping ratio of oscillating signals (e.g. identification of damping in dynamical systems). CWT is also very resistant to the noise in the signal. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If your problem is suitable to CWT, then you will be perfectly fine with using it. The Academia involves a lot of works in comparing and demonstrating the strengths of all of these transforms. Some of these would be [2,3,4].&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Under the shade of the comments below, I now elaborate more on the theory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, singularity is simply the concept of point where the function or its derivative is not defined, the point of cusp, double point or any other simlar undefinedness, which I won't go into details here. You can check the wiki &quot;Mathematical Singularity&quot;. A good measure of singularity strength would be Lipschitz exponent, which can well be characterized by Wavelet transforms. For more information on that take a look at [5]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, as you ask, why are you interested in the singularities anyway? Well, because such irregularities basically play an important role in carrying the information that characterizes the signal [6]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having explained the singularities a bit, I certainly agree that singular lines are a concern of multidimensional structures, more specifically $R^2$ ($L^2$ etc.). This is why transforms like Ridgelets and Curvelets are good at image denoising than Wavelets. Yet, this doesn't violate the fact that 2D Wavelets would also be useful in image analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the computational complexity, even before analyzing the equations, you could rely on your knowledge that computation of the Ridgelet transform involves a Wavelet transform in the Radon domain. That is why it should definitely be heavier in terms of computational complexity, compared to a Wavelet transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;.  &lt;strong&gt;REFERENCES&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ifp.illinois.edu/~minhdo/publications/FRIT_trans.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ifp.illinois.edu/~minhdo/publications/FRIT_trans.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://jstarck.free.fr/curvencyclop09.pdf&quot; rel=&quot;nofollow&quot;&gt;http://jstarck.free.fr/curvencyclop09.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://authors.library.caltech.edu/1381/1/STAieeetip02.pdf&quot; rel=&quot;nofollow&quot;&gt;http://authors.library.caltech.edu/1381/1/STAieeetip02.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.iro.umontreal.ca/~mignotte/IFT6150/ComplementCours/CurveletTransform.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.iro.umontreal.ca/~mignotte/IFT6150/ComplementCours/CurveletTransform.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.iis.sinica.edu.tw/papers/whwang/5114-F.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.iis.sinica.edu.tw/papers/whwang/5114-F.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cmap.polytechnique.fr/~mallat/papiers/MallatSingDet92.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cmap.polytechnique.fr/~mallat/papiers/MallatSingDet92.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-09-03T17:05:32.150" LastActivityDate="2014-09-03T17:05:32.150" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18051" PostTypeId="2" ParentId="18046" CreationDate="2014-09-01T19:22:23.077" Score="0" Body="&lt;p&gt;If you reference phase to the beginning of your FFT aperture, then any sinusoid that is not exactly integer periodic within that window width will be discontinuous across the two window edges, thus providing a phase (phase of a discontinuity?) that doesn't really make much intuitive sense at that measurement point, as well as alternating in phase between successive FFT result bins.  Also, most common &quot;hump&quot; shaped windows reduce the signal to nothing, or nearly so, at the window edges, which again doesn't make much sense, as the measurement of the phase of almost nothing at the reference point can be quite noisy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prevent this seeming nonsense, do an FFTshift, which moves the phase reference to the center of your signal window.  You can so this by rotating the data (and window) so that the peak of the window hump is at the FFT's phase measurement point (time index 0), and the discontinuity and/or window-edge-attenuation is far from the phase reference measurement point.  This FFTshift or data rotation will also prevent the phase of a non-integer-periodic sinusoid from alternating between FFT result bins, thus allowing simpler phase interpolation between FFT result bins.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-09-01T19:27:33.377" LastActivityDate="2014-09-01T19:27:33.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18052" PostTypeId="1" AcceptedAnswerId="18055" CreationDate="2014-09-01T19:50:10.357" Score="0" ViewCount="848" Body="&lt;p&gt;I'm working on creating an application which will render a spectrogram of the audio in an MP3 file. I'm having some trouble, though - after running the audio samples through my program, the resulting magnitudes are all very close together, and don't seem to be very patterned like one would expect. I'm coloring my spectrogram using a pretty typical black/blue/purple/red/yellow/white gradient. The current result I get is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z6m5O.png&quot; alt=&quot;My current spectrogram output&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps I'm performing to get this are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Decode the MP3 file using libmad, getting raw signed 16-bit PCM samples back. The samples are stereo, but at this point (for debugging, mostly) I'm just ignoring the right channel. I've verified that this step works by writing the raw samples back out to a file, importing them into Audacity, and then playing the audio - and it sounds correct.&lt;/li&gt;&#xA;&lt;li&gt;Compute the STFT of these samples (each sample is converted to a complex number of &lt;code&gt;sample + 0i&lt;/code&gt; - I realize this isn't the most efficient, but it's very simple and my understanding is that it should produce the same result). I'm &lt;strong&gt;not&lt;/strong&gt; scaling the samples, or converting them from signed to unsigned, or anything else. I'm using a window size of 8192 samples, which is about 185ms of audio data (sampled at 44.1KHz). I'm also applying the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hann_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hann function&lt;/a&gt; to each of these windows, and overlapping them by about 800 samples. I'm using my own implementation of the FFT, however I've verified it by comparing its outputs to those from Numpy over a very large list of inputs.&lt;/li&gt;&#xA;&lt;li&gt;Plot the result. Each column in the graph is a DFT from list of STFT results (time), and each row is a particular value in the DFT result (a frequency). I'm only plotting the results in DFT bins &lt;code&gt;[1, N/2 - 1]&lt;/code&gt;, since I'm using real inputs. I'm computing the magnitude as &lt;code&gt;log10(sqrt(r*r + i*i))&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The color range is from &lt;code&gt;[minimum magnitude, maximum magnitude]&lt;/code&gt;. I've tried shrinking the range, thinking that outliers may be screwing it up, but even with a range of &lt;code&gt;[5.6, 5.8]&lt;/code&gt; the data is still not a real spectrogram. The magnitudes seem to be more or less randomly distributed in that &lt;code&gt;[5.6, 5.8]&lt;/code&gt; range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What issue might be causing this type of output?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to post code or go into more detail, but as I'm not sure what area the problem might lie in I'm not sure what to expand upon. For what it's worth (although obviously I don't expect anyone to look at all of my code and fix my bug), this project is on GitHub &lt;a href=&quot;https://github.com/CmdrMoozy/spectr&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: I generated a wave file with a single 1000Hz sine wave as suggested, and for the first time ever my application actually produces some (maybe?) useful output. Here's what I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CV77a.png&quot; alt=&quot;Spectrogram of a sine wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps this provides some more insight as to what's going wrong?&lt;/p&gt;&#xA;" OwnerUserId="10962" LastEditorUserId="10962" LastEditDate="2014-09-01T20:37:29.337" LastActivityDate="2014-09-02T15:24:59.643" Title="Rendering a spectrogram of audio data - resulting magnitudes are all too close together" Tags="|fft|spectrogram|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18053" PostTypeId="1" AcceptedAnswerId="19727" CreationDate="2014-09-01T22:34:03.167" Score="1" ViewCount="311" Body="&lt;p&gt;In control systems, the Laplace transform is often used to analyze the stability and the performance of &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory&quot; rel=&quot;nofollow&quot;&gt;LTI system&lt;/a&gt;. For instance, the LTI system is stable if and only if the &lt;a href=&quot;http://en.wikipedia.org/wiki/Transfer_function&quot; rel=&quot;nofollow&quot;&gt;transfer function&lt;/a&gt;, which is the quotient between the Laplace transform of the output of the system and the Laplace transform of the input, has all of its poles in the left half complex plane. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does wavelet transforms also found applications in analysis or design of control systems?&lt;/p&gt;&#xA;" OwnerUserId="5388" LastActivityDate="2014-12-23T22:21:51.267" Title="Wavelet transform in control systems" Tags="|control-systems|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18054" PostTypeId="2" ParentId="10743" CreationDate="2014-09-02T00:25:42.977" Score="1" Body="&lt;p&gt;Once you get the spectrogram part working, I would recommend using &lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.find_peaks_cwt.html&quot; rel=&quot;nofollow&quot;&gt;scipy.signal.find_peaks_cwt&lt;/a&gt; for the peak finding; its pretty good. It uses user defined thresholds for the SNR and a wavelet transform and ridge tracking to distinguish real peaks from noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do have to give it a range for the peak widths you expect, but that's not too much of a hassle. For standard music with a 4:4 beat you can just pick the SFT time to match the beat.&lt;/p&gt;&#xA;" OwnerUserId="8656" LastActivityDate="2014-09-02T00:25:42.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18055" PostTypeId="2" ParentId="18052" CreationDate="2014-09-02T03:37:48.520" Score="2" Body="&lt;p&gt;A periodic looking output from an FFT could mean a bug such that the FFT did nothing (output == input, unchanged), or that the input to the FFT only had a single large magnitude or non-zero data point (input == garbage).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-09-02T03:37:48.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18056" PostTypeId="1" CreationDate="2014-09-02T06:26:15.907" Score="1" ViewCount="190" Body="&lt;p&gt;What would be my options to decimate a large input signal available only in sections (or blocks) due to DMA type of interface? The FIR should be about order of 18 only and the total decimation factor of 8. I've made a quick MATLAB function to illustrate this issue.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function decimFilt(varargin)&#xA;% Multi-Stage Block-By-Block Decimation Filtering&#xA;&#xA;%% Check input args&#xA;enPlot = false;&#xA;if nargin&amp;gt;0&#xA;    enPlot = varargin{1};&#xA;end&#xA;%%&#xA;&#xA;%% Definitions&#xA;&#xA;% Sample rate and period&#xA;fs = 44.440e6;&#xA;ts = 1/fs;&#xA;&#xA;% Input&#xA;N = 38400;              % Nbr of samples&#xA;B = 12;                 % Nbr of blocks&#xA;f1 = 0.0125*fs;&#xA;f2 = 0.25*fs;&#xA;n = (0:ts:N*ts-ts).';&#xA;x = sin(2*pi*f1*n) + ...&#xA;    sin(2*pi*f2*n+pi/6) + ...&#xA;    0.25*randn(size(n));&#xA;%% &#xA;&#xA;%% Filter design&#xA;O = 18;&#xA;b = fir1(O,0.125);      % Linear-phase FIR filter.&#xA;%% &#xA;&#xA;%% Filter and decimate entire signal in one block (REFERENCE).&#xA;m = 2;&#xA;%   1. stage&#xA;[yRef,Z1rf] = decFirFilt(b,x,m);&#xA;%   2. stage&#xA;[yRef,Z2rf] = decFirFilt(b,yRef,m);&#xA;%   2. stage&#xA;[yRef,Z3rf] = decFirFilt(b,yRef,m);&#xA;%% &#xA;&#xA;%% Filtering and decimating the data as sections (BLOCK-BY-BLOCK)&#xA;xBlock = reshape(x,[N/B B]);&#xA;%   1. stage&#xA;y1m = zeros(N/(m*B),B);&#xA;Z1mf = zeros(O,B+1);        % Note! State vector needed per stage!&#xA;%   2. stage&#xA;y2m = zeros(N/(m*m*B),B);&#xA;Z2mf = zeros(O,B+1);        % Note! State vector needed per stage!&#xA;%   3. stage&#xA;y3m = zeros(N/(m*m*m*B),B);&#xA;Z3mf = zeros(O,B+1);        % Note! State vector needed per stage!&#xA;for i=1:B,&#xA;    % Load previous section final condition to the initial condition&#xA;    Zi = Z1mf(:,i);&#xA;    [y1m(:,i),Z1mf(:,i+1)] = decFirFiltCond(b,xBlock(:,i),m,Zi);&#xA;    % Load previous section final condition to the initial condition&#xA;    Zi = Z2mf(:,i);&#xA;    [y2m(:,i),Z2mf(:,i+1)] = decFirFiltCond(b,y1m(:,i),m,Zi);&#xA;    % Load previous section final condition to the initial condition&#xA;    Zi = Z3mf(:,i);&#xA;    [y3m(:,i),Z3mf(:,i+1)] = decFirFiltCond(b,y2m(:,i),m,Zi);&#xA;end&#xA;%% &#xA;&#xA;%% Results&#xA;% Plot&#xA;if enPlot&#xA;figure, ...&#xA;    stem(yRef,'bo'), grid on, hold on, ...&#xA;    stem(y3m(:),'kx')&#xA;end&#xA;&#xA;% MSE results&#xA;mse = mean(abs(y3m(:) - yRef).^2);&#xA;fprintf('decimFilt\n MSE:%.4e\n', mse)&#xA;%%&#xA;&#xA;end&#xA;&#xA;%% Internal functions&#xA;% Decimation filter&#xA;function [y, z] = decFirFilt(b, x, m)&#xA;[yUnDec, z] = filter(b,1,x);&#xA;y = yUnDec(1:m:end);&#xA;end&#xA;&#xA;% Decimation filter with  access to initial and final conditions of the delays.&#xA;function [y, zo] = decFirFiltCond(b, x, m, zi)&#xA;[yUnDec, zo] = filter(b,1,x,zi);&#xA;y = yUnDec(1:m:end);&#xA;end&#xA;%%&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm guessing some polyphase FIR or FFT-based overlap-add or -save implementations could also be used? What I've calculated the FFT-based overlap-add or -save would not be more efficient for this problem?&lt;/p&gt;&#xA;" OwnerUserId="10190" LastActivityDate="2014-09-02T06:26:15.907" Title="Filtering and decimating input as sections in multiple stages" Tags="|filters|decimation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18057" PostTypeId="2" ParentId="18052" CreationDate="2014-09-02T10:25:32.890" Score="0" Body="&lt;p&gt;The FFT result is so entirely wrong that I suspect you're taking the FFT of the raw MP3 data. You may have decompressed the MP3 data, but did you then pass the buffer holding the uncompressed data to the FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check if the problem lies in your FFT or in your MP3 code, generate the sine wave numerically instead of reading it from an MP3. &lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-09-02T10:25:32.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18058" PostTypeId="1" CreationDate="2014-09-02T10:29:54.540" Score="0" ViewCount="363" Body="&lt;p&gt;I am currently doing analysis on Photoplethysmograph (PPG) data and I want to know the frequency (heart rate) at every time point so a windowed FFT might not be the best option. I am looking at wavelet to generate frequency and time information. I have been working with matlab example code however I have trouble determining what is the best wavelet to use for this application. I do now know much about wavelet. Does the wavelet used being dictated by the shape of my signal. In my case PPG signal which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L2VBx.gif&quot; alt=&quot;http://home.lu.lv/~spigulis/PPG-bios02_files/image004.gif&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or some other consideration is needed when choosing wavelet? How critical is the choice of wavelet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Kelvin&lt;/p&gt;&#xA;" OwnerUserId="8546" LastEditorUserId="8202" LastEditDate="2014-09-02T11:16:51.630" LastActivityDate="2014-09-02T16:58:02.890" Title="time frequency localization using wavelet transform" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18059" PostTypeId="1" AcceptedAnswerId="18060" CreationDate="2014-09-02T11:30:02.107" Score="-1" ViewCount="1628" Body="&lt;p&gt;Are there any algorithms out there that can do a FFT of 2D or XY data (not sure of the exact terminology here), I don't mean XY data like in a graph I mean XY/2D data points like a circle or a smiley face for example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dave&lt;/p&gt;&#xA;" OwnerUserId="7545" LastActivityDate="2014-09-02T14:29:35.480" Title="FFT on XY data points" Tags="|fft|transform|fourier|2d|" AnswerCount="1" CommentCount="2" ClosedDate="2014-09-24T22:03:30.697" ContentLicense="CC BY-SA 3.0" />
  <row Id="18060" PostTypeId="2" ParentId="18059" CreationDate="2014-09-02T12:51:00.587" Score="1" Body="&lt;p&gt;If there is a notion of &quot;time&quot; or order in your data - for example, if your points are acquired as coordinates on a touch-screen or stylus as someone draws the figure, you can treat your X and Y coordinates as the real and imaginary part of a complex number. Then, this is just an instance of a 1D FFT with complex-valued input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In response to the comment that any kind of data could be processed this way, without the need for an explicit &quot;time axis&quot; or &quot;order&quot; in the data)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data order matters! For example, if you take your data and sort it according to the X coordinate, the real part of your signal (corresponding to the X coordinate) will be an irregularly increasing line - I expect the spectrum to be roughly that of a sawtooth wave. However, if you randomly shuffle your data, the real part of your signal will be like white noise. So the exact same plot will lead to totally different spectra.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-09-02T14:29:35.480" LastActivityDate="2014-09-02T14:29:35.480" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18062" PostTypeId="2" ParentId="18052" CreationDate="2014-09-02T15:24:59.643" Score="0" Body="&lt;p&gt;There were some smaller issues in my code, but the main one was that &lt;strong&gt;I was interpreting the PCM data with the wrong endianness&lt;/strong&gt;. @hotpaw2's suggestion was what pushed me in the right direction: try plotting a pure sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should've from the beginning been testing with a single sine wave generated in memory, rather than fussing with reading and decompressing files. That would've made it much easier to get the FFT/spectrogram portion working, and then I could've focused on interpreting MP3 data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was too focused on finding the bug in the (arguably) more complex portions of my program - the math heavy portions - that I didn't look too hard at the inputs I was getting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the suggestions, all!&lt;/p&gt;&#xA;" OwnerUserId="10962" LastActivityDate="2014-09-02T15:24:59.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18063" PostTypeId="2" ParentId="18058" CreationDate="2014-09-02T16:58:02.890" Score="1" Body="&lt;p&gt;What information are you trying to extract from your signal?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I want to know the frequency (heart rate) at every time point&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If this is the information you want then any sort of frequency analysis is unlikely to be very useful. It will show you that you have a 1 or 2 hz periodic signal with a particular frequency profile, but you already know all of this information so that won't be especially illuminating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are probably better off with peak detection, or local minima/maxima detection to extrapolate beats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can provide a sample of your data, and/or more details about the exact information you are trying to extract then it will help us to find a more precise solution to your problem.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2014-09-02T16:58:02.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18064" PostTypeId="2" ParentId="18028" CreationDate="2014-09-02T17:07:10.467" Score="1" Body="&lt;p&gt;I would search for &quot;segmentation benchmark dataset&quot; or so. One of the first results seems to be useful for your task:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/segbench/BSDS300/html/dataset/images.html&quot; rel=&quot;nofollow&quot;&gt;https://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/segbench/BSDS300/html/dataset/images.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="156" LastActivityDate="2014-09-02T17:07:10.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18065" PostTypeId="1" CreationDate="2014-09-02T18:08:43.800" Score="2" ViewCount="3535" Body="&lt;p&gt;I have two images: A and B. Image A is a screenshot of image B, the original image. While there is noise in image A, the original features are still distinguishable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Histogram intersection tells us that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$K(a,b) = \sum_{i=1}^{n}\min(a_i,b_i)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where if $K$ is large, $a$ and $b$ are similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we process image A to create a histogram with an optimal amount of ($n \pm x$) bins, how do we apply histogram intersection in this case where image A and B don't have the same amount of histogram bins? &lt;/p&gt;&#xA;" OwnerUserId="10975" LastEditorUserId="10975" LastEditDate="2014-09-02T18:56:13.930" LastActivityDate="2014-12-01T21:59:28.943" Title="Histogram Intersection with two different bin sizes?" Tags="|image-processing|computer-vision|histogram|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18067" PostTypeId="2" ParentId="18065" CreationDate="2014-09-02T20:19:04.187" Score="2" Body="&lt;p&gt;I don't see any other way than to adapt one of the histograms such that both histograms have the same number of bins before performing histogram intersection. This will always involve some guesswork since the histograms themselves don't give you enough information to do this accurately. I would adapt the histogram with the larger number of bins to the number of bins of the other histogram. This is a simple example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h1 = [12 17]&#xA;h2 = [9 10 11]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in this case you want to change &lt;code&gt;h2&lt;/code&gt; such that it has two bins like &lt;code&gt;h1&lt;/code&gt;. Since the interval boundary between the two intervals of &lt;code&gt;h1&lt;/code&gt; is right in the middle of bin 2 of &lt;code&gt;h2&lt;/code&gt;, it is reasonable to divide bin 2 of &lt;code&gt;h2&lt;/code&gt; evenly between the two other bins. So you get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h2_new = [14 16]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the new boundary falls somewhere else inside a bin interval just divide the interval by the respective percentage. This step of course involves guesswork and it would be much better if you could avoid it by making sure that both histograms are computed using the same number of bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final note, usually histogram intersection is normalized such that its maximum value is $1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$K(a,b)=\frac{\sum_{i=1}^n\min (a_i,b_i)}{\min\left(\sum_i a_i,\sum_i b_i\right)}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-02T20:19:04.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18068" PostTypeId="1" CreationDate="2014-09-02T20:51:10.450" Score="0" ViewCount="1965" Body="&lt;p&gt;I am trying to implement GCC-PHAT in python. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach is similar to the following two links:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/7788005/i-am-trying-to-write-a-code-to-cross-correlate-a-transmitted-signal-with-a-recei&quot;&gt;link1&lt;/a&gt; and &lt;a href=&quot;http://www1.icsi.berkeley.edu/Speech/papers/multimic/phat_delaysum.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;link2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems the only difference between GCC-PHAT and normal cross-correlation using FFT is the division by the magnitude. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;from scipy.fftpack import rfft, irfft, fftfreq, fft, ifft&#xA;&#xA;def xcorr_freq(s1,s2):&#xA;    pad1 = np.zeros(len(s1))&#xA;    pad2 = np.zeros(len(s2))&#xA;    s1 = np.hstack([s1,pad1])&#xA;    s2 = np.hstack([pad2,s2])&#xA;    f_s1 = fft(s1)&#xA;    f_s2 = fft(s2)&#xA;    f_s2c = np.conj(f_s2)&#xA;    f_s = f_s1 * f_s2c&#xA;    denom = abs(f_s)&#xA;    denom[denom &amp;lt; 1e-6] = 1e-6&#xA;    f_s = f_s / denom  # This line is the only difference between GCC-PHAT and normal cross correlation&#xA;    return np.abs(ifft(f_s))[1:]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have checked by commenting out &lt;code&gt;fs = fs / denom&lt;/code&gt; The function produces the same result as normal cross correlation for a wide band signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a sample test code which shows the GCC-PHAT code above performs worse than normal cross-correlation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;LENG = 500&#xA;a = np.array(np.random.rand(LENG))&#xA;b = np.array(np.random.rand(LENG))&#xA;plt.plot(xcorr_freq(a,b))&#xA;plt.figure()&#xA;plt.plot(np.correlate(s1,s2,'full'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the result with GCC-PHAT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bJz2e.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the result with normal cross-correlation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/plR9a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since GCC-PHAT should give better cross-correlation performance for wide band signal, I know there is something wrong with my code. Any help is very appreciated!&lt;/p&gt;&#xA;" OwnerUserId="10977" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2022-07-06T09:23:15.170" Title="GCC-PHAT cross correlation" Tags="|filters|algorithms|python|sound|cross-correlation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18069" PostTypeId="2" ParentId="18041" CreationDate="2014-09-02T20:55:40.207" Score="2" Body="&lt;p&gt;You can use a multirate structure where the stages have increasingly wider transition bands. This is very close to the situation answered in &lt;a href=&quot;https://dsp.stackexchange.com/questions/134/how-can-i-design-a-very-narrow-filter/144#144&quot;&gt;another question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-09-02T20:55:40.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18072" PostTypeId="2" ParentId="17635" CreationDate="2014-09-03T09:14:25.430" Score="3" Body="&lt;p&gt;Thanks for the answer. You are correct - the training sequence is known by the time you establish any communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case if somebody stumbles upon this in the future, here's how to get this done:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The synchronization burst contains an extended training sequence. It's longer than the regular one and there is only one sequence. You are supposed to use that to equalize, demodulate and decode the SCH burst. Among other useful information, it contains the color code of the BTS, which identifies the training sequence used by that BTS. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The procedure is nicely explained in this book:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sajal Kumar Das: &quot;Mobile Handset Design&quot;&lt;/p&gt;&#xA;" OwnerUserId="10719" LastActivityDate="2014-09-03T09:14:25.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18074" PostTypeId="1" AcceptedAnswerId="18075" CreationDate="2014-09-03T12:25:00.863" Score="-1" ViewCount="114" Body="&lt;p&gt;Hello What are the numbers of Daubechies and Complex Gaussian are called?&lt;br&gt;&#xA; I dont know what to call db4 or cgau8.  &lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2014-09-03T13:09:34.833" Title="What are the settings of Daubechies and Complex Gaussian are called?" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18075" PostTypeId="2" ParentId="18074" CreationDate="2014-09-03T13:09:34.833" Score="1" Body="&lt;p&gt;For Daubechies wavelet, convention is &lt;strong&gt;dbN&lt;/strong&gt;, where &lt;strong&gt;N&lt;/strong&gt; is the number of &lt;a href=&quot;https://math.stackexchange.com/questions/128165/what-is-a-vanishing-moment&quot;&gt;&lt;em&gt;vanishing moments&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of Complex Gaussian wavelet number describes derivative order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathrm{cgau}(x)=C_n\left[e^{-ix}e^{-x^2}\right]^{(p)}$$&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2014-09-03T13:09:34.833" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18078" PostTypeId="1" CreationDate="2014-09-03T20:22:32.493" Score="1" ViewCount="1878" Body="&lt;p&gt;I want to the start time and end time for the peak shown below.&#xA;The start and end are shown by the marked circles in the fig&#xA;As there are number of such plots and want to know start and end time for each plot. So if its an automatic procdure thats good.&#xA;Can any one help me with this&#xA;Thanks&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SKz76.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10987" LastEditorUserId="10987" LastEditDate="2014-09-04T14:48:01.377" LastActivityDate="2014-09-04T14:48:01.377" Title="In a signal there is a peak, I want to find the start of the peak and the end of the peak" Tags="|signal-analysis|python|peak-detection|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="18080" PostTypeId="1" AcceptedAnswerId="18083" CreationDate="2014-09-04T02:16:21.230" Score="1" ViewCount="208" Body="&lt;p&gt;I'd like approach to Legendre polynomial.&#xA;But i don't make concept with Legendre polynomial.&#xA;So if you know where and when does L.P used and how L.P used, would you please let me know about this? To more understand it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hmm.. specifically in the application.&lt;/p&gt;&#xA;" OwnerUserId="10979" LastEditorUserId="10979" LastEditDate="2014-09-04T05:56:52.480" LastActivityDate="2017-10-17T20:41:39.083" Title="Does anyone know how and when and where used Legendre polynomial?" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18081" PostTypeId="1" CreationDate="2014-09-04T05:16:57.860" Score="3" ViewCount="1467" Body="&lt;p&gt;I know that for a given signal, the sampling frequency $F_s$ must be twice or more than maximum frequency of the signal $F_m$. It is easy to understand the concept for a 1D signal. But I don't know how to calculate sampling frequency or Nyquist rate for a 2D image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also what is effect of over-sampling and under-sampling in case of image shown below (dimensions $\text{width} \cdot \text{height}=204\cdot226$)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HHLIV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10990" LastEditorUserId="8202" LastEditDate="2014-09-04T14:26:16.913" LastActivityDate="2015-02-01T19:46:47.183" Title="Calculation of sampling rate and its effect on an Image?" Tags="|matlab|fft|frequency-spectrum|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18083" PostTypeId="2" ParentId="18080" CreationDate="2014-09-04T08:06:28.287" Score="2" Body="&lt;p&gt;Legendre polynomials are orthogonal on the interval $[-1,1]$ and are therefore useful for approximating functions on a finite interval in a least squares sense. I.e., if you are looking for a polynomial $p^*_K(t)$ of degree $K$ which approximates a given function $f(t)$ on the interval $[-1,1]$ - other intervals are possible by shifting and scaling - by minimizing the error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\epsilon=\int_{-1}^1[f(t)-p_K(t)]^2dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the optimal polynomial $p^*_K(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p^*_K(t)=\sum_{k=0}^Ka_k\bar{L}_k(t)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\bar{L}_k(t)=\sqrt{\frac{2k+1}{2}}L_k(t),\quad k\in\mathbf{N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;are the normalized Legendre polynomials $L_k(t)$ (i.e., $\bar{L}_k(t)$ are orthonormal, not only orthogonal). Because of the orthonormality of $\bar{L}_k(t)$ the coefficients $a_k$ in (1) can be easily found by computing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_k=\int_{-1}^1\bar{L}_k(t)x(t)dt$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-04T08:06:28.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18084" PostTypeId="2" ParentId="1714" CreationDate="2014-09-04T09:38:57.583" Score="0" Body="&lt;p&gt;As part of my last year of engineering studies assignment, I had to study segmentation methods for blood vessels in eye fundus images.&#xA;I found &lt;a href=&quot;http://basepub.dauphine.fr/handle/123456789/9419?show=full&quot; rel=&quot;nofollow&quot;&gt;this tree reconstruction method (by Cohen, Laurent D. and Mille, Julien&lt;/a&gt; particularly interesting to use along with Fast-Marching Methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other papers you might want to look into : &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Geodesic Active Contours&lt;/li&gt;&#xA;&lt;li&gt;On the implementation of fast marching methods for 3D lattices&lt;/li&gt;&#xA;&lt;li&gt;Multistencils FMM : a highly accurate solution to the Eikonal Equation on Cartesian Domains&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Useful links : &#xA;- &lt;a href=&quot;https://www.ceremade.dauphine.fr/~peyre/teaching/manifold/tp2.html&quot; rel=&quot;nofollow&quot;&gt;Front propagation&#xA;in 2D and 3D&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps a bit, though it's not exactly state of the art.&lt;/p&gt;&#xA;" OwnerUserId="10993" LastActivityDate="2014-09-04T09:38:57.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18087" PostTypeId="1" CreationDate="2014-09-04T15:09:47.500" Score="1" ViewCount="42" Body="&lt;p&gt;I am exploring methods for reducing computations required by MUSIC (Multiple Signal Classification) Algorithm. Most of the computational power is spent on calculating SVD. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach is to take fourier transform of signal matrix and perform filtering to make it sparse; calculating SVD on sparse matrix takes much lesser time.&#xA;Usually, when filtering, the determining factor is not the noise itself, but spectrum leakage due to DFT. Smaller terms due to spectrum leakage also get removed when filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there limit in MIMO systems as to how much difference in power of two signals can be. For example, lets suppose, no of signals transmitted are 10. Is there a rule as to how high in power Signal 1 can be in comparison to Signal X.&#xA;$$ \frac{Signal-1}{Signal-X} &amp;lt;= K $$ whre X is not equal to 1. Can K be indefinitely large ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, do you think sparseFFT with Cheby-Shev or any other proper filter can help in containing the leakages ? Deconvolving using windows is entirely out of question because it would increase the computations to the point of making the whole approach infeasible.&lt;/p&gt;&#xA;" OwnerUserId="10963" LastActivityDate="2014-09-04T15:09:47.500" Title="Variation in Signal Power in Mimo system" Tags="|filters|discrete-signals|dft|signal-detection|music|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18089" PostTypeId="2" ParentId="18081" CreationDate="2014-09-04T17:02:47.653" Score="2" Body="&lt;p&gt;Depends on how the image is created.  If by photography, the focus cone and Airy disk for the given lens have a somewhat low-pass filter effect.  Figure out the effective transition frequency at the imaging plane, and have a sampler with a bit over twice that resolution to diminish aliasing effects during image capture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you undersample (either during capture or with later processing) without low pass filtering, then you may get alias artifacts such as Moire patterns on high contrast fine detail.  Classic example is a pin striped shirt at SD TV resolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-09-04T17:02:47.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18090" PostTypeId="1" AcceptedAnswerId="18096" CreationDate="2014-09-04T20:39:58.727" Score="3" ViewCount="2863" Body="&lt;p&gt;It is said, do not use &lt;em&gt;derivative&lt;/em&gt; operator in a the control system. because it will amplify the &lt;em&gt;noise&lt;/em&gt; effect. Can someone explain it and give some &lt;strong&gt;mathematical&lt;/strong&gt; reference about it please?&lt;br&gt;&#xA;Also I heard, we shouldn't use &lt;em&gt;logarithm&lt;/em&gt; operator too, for the same reason. How come?&lt;br&gt;&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="5132" LastActivityDate="2014-09-05T08:25:58.067" Title="why derivative and logarithm operators amplify the noise effects?" Tags="|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18091" PostTypeId="1" CreationDate="2014-09-05T03:09:38.603" Score="-2" ViewCount="135" Body="&lt;p&gt;I want to generate a BPSK modulated signal with non zero mean. I don't know how to add a non zero mean.&lt;/p&gt;&#xA;" OwnerUserId="11000" LastEditorUserId="1606" LastEditDate="2014-09-05T07:33:21.377" LastActivityDate="2014-09-05T14:54:00.007" Title="Generate a BPSK modulated signal with non zero mean" Tags="|continuous-signals|" AnswerCount="2" CommentCount="1" ClosedDate="2014-09-12T01:01:17.247" ContentLicense="CC BY-SA 3.0" />
  <row Id="18092" PostTypeId="1" AcceptedAnswerId="18095" CreationDate="2014-09-05T04:15:06.890" Score="-2" ViewCount="1021" Body="&lt;p&gt;As i know, taylor series is used for analysis f(x).&#xA;So if i have many orders, i can approximate f(x).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this point of view, what is difference Legendre Polynomials?&lt;/p&gt;&#xA;" OwnerUserId="10979" LastActivityDate="2014-09-05T06:59:57.247" Title="What is difference between Taylor series and Legendre polynomial?" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18094" PostTypeId="2" ParentId="18091" CreationDate="2014-09-05T06:16:17.630" Score="1" Body="&lt;p&gt;The signal will have a non-zero mean if there are more ones than zeros, or vice-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In academic exercises we usually assume that the data is random with even probabilities so there will be about the same number of ones as zeros.  In real life we use scramblers to makes sure that the modulated data has about the same number of ones as zeros, regardless of what the payload data is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At any rate, if there are more &quot;ones&quot; symbols than there are &quot;zeros&quot; symbols (or vice versa), there will be a non-zero mean.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-09-05T06:16:17.630" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18095" PostTypeId="2" ParentId="18092" CreationDate="2014-09-05T06:59:57.247" Score="2" Body="&lt;p&gt;Taylor series approximation of a function involves matching derivatives of the function and the polynomial &lt;em&gt;at one point&lt;/em&gt;. All information to construct the Taylor series is obtained from the function and its derivatives at that point. So you get a smooth approximation around that chosen point. In the case of approximation by Legendre polynomials, you approximate a function &lt;em&gt;in an interval&lt;/em&gt; in a least squares sense. The function values in this interval as well as its derivatives will generally be different from the corresponding values of the approximating polynomial, but the mean squared error in the chosen interval attains a minimum for a given degree of the polynomial.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-05T06:59:57.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18096" PostTypeId="2" ParentId="18090" CreationDate="2014-09-05T07:17:42.480" Score="7" Body="&lt;p&gt;The derivative operator is linear and time-invariant and can be described by its frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(j\omega)=j\omega\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) it is obvious that its gain increases linearly with frequency, and high frequencies (where the SNR is usually bad) are greatly amplified (as already pointed out in endolith's comment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logarithm is a memoryless nonlinearity and it compresses the input signal. This operation is used in many signal processing algorithms, such as feature extraction for speech recognition. In these algorithms this operation is essential to the performance and it definitely does not deteriorate the signal. What is important, however, is to deal with the singularity of the logarithm as its argument approaches zero because: $$\lim_{x\rightarrow 0+}\log(x)=-\infty$$&#xA;If nothing is done about it, the logarithm will produce very high negative peaks during periods where the signal is almost zero (i.e. when there's only noise). This problem is easily handled by defining a threshold, either on the value of the logarithm or on the input signal. Note that the logarithm can only be applied to non-negative signals (usually magnitudes or squared magnitudes of frequency domain data).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="8202" LastEditDate="2014-09-05T08:25:58.067" LastActivityDate="2014-09-05T08:25:58.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18097" PostTypeId="2" ParentId="18091" CreationDate="2014-09-05T07:34:30.950" Score="-1" Body="&lt;p&gt;You could of course generate a &quot;normal&quot; BPSK signal with equal probability of input bits '1' and '0' and then add a constant offset value after BPSK modulation.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-09-05T14:54:00.007" LastActivityDate="2014-09-05T14:54:00.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18098" PostTypeId="1" CreationDate="2014-09-05T08:41:24.913" Score="1" ViewCount="136" Body="&lt;p&gt;If I have the histogram of an input image as Gaussian probability density function of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_r(r)=\dfrac{1}{\sqrt{2\pi}\sigma}e^{-\dfrac{(r-\mu)^2}{2\sigma^2}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where: $\mu$ and $\sigma$ are the mean and standard deviation of the Gaussian PDF respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach is to let $\mu$ and $\sigma$ be the measures of average grey level and contrast of a given image. What is the transformation function that can be used for histogram equalization?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I found that I have to take small value for sigma and make some integration. So any help to do that please?&lt;/p&gt;&#xA;" OwnerUserId="10686" LastEditorUserId="128" LastEditDate="2023-07-16T09:11:02.243" LastActivityDate="2023-07-16T09:11:02.243" Title="Convert Gaussian Like Histogram into Uniform Analytically" Tags="|image-processing|transfer-function|histogram|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="18099" PostTypeId="1" AcceptedAnswerId="18102" CreationDate="2014-09-05T09:11:03.877" Score="0" ViewCount="1076" Body="&lt;p&gt;I am a self-learner of DSP by reading various books. I have accomplished basic understanding of Signals - CT and DT and a few transforms. I recently started to learn FIR / IIR Filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part that I cannot understand is that they are termed as 'Filters' which for me logically means blocking / allowing from a threshold value - ex. lower values would be passed higher would be filtered or removed. So if we have a low pass filter - it would lead us to remove high values from a sequence and vice versa for high pass filters - is my understanding correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like HPF (High Pass Filter):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(n)={1,2,3,4,5,6,7,8,9}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Set threshold as &lt;strong&gt;&gt;=5&lt;/strong&gt; so output sequence would be {5,6,7,8,9}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK but the document states FIR / IIR about :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Finite Impulse Response (FIR) : this type of filter gives a finite&#xA;  number of nonzero outputs (response) to an impulse function input. It&#xA;  does not use feed-back.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Infinite Impulse Response (IIR) : this type of filter uses feed-back,&#xA;  so it could have an infinite number of nonzero outputs (response) to&#xA;  an impulse function input.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now I cannot understand what FIR / IIR has to do with my concept of filters - allow / block high / low values. Where does the question of Feedback comes here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly for wavelets - &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We call an octave a level of resolution, where each octave can be&#xA;  envisioned as a pair of FIR filters, at least for the one-dimensional&#xA;  case. One filter of the analysis (wavelet transform) pair is a lowpass&#xA;  filter (LPF), while the other is a highpass filter (HPF). Each filter&#xA;  has a down-sampler after it, to make the transform efficient.  For&#xA;  example, a simple lowpass filter may have coefficients {1/2,1/2},&#xA;  producing outputs (x[n] + x[n - 1])/2, which is clearly the average of&#xA;  two samples. A corresponding simple highpass filter would have&#xA;  coefficients {1/2,-1/2}, producing outputs (x[n] - x[n - 1])/2, half&#xA;  the difference of the samples.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am not able to get the concept of how and why here equation : (x[n] + x[n - 1])/2 and (x[n] - x[n - 1])/2 is being referred?&lt;/p&gt;&#xA;" OwnerUserId="10384" LastActivityDate="2014-09-05T20:01:45.910" Title="FIR / IIR and Wavelets" Tags="|filters|wavelet|infinite-impulse-response|finite-impulse-response|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18100" PostTypeId="2" ParentId="18099" CreationDate="2014-09-05T09:55:06.620" Score="2" Body="&lt;p&gt;A filter applies a frequency-dependent gain to be applied to a signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process you describe - removing values below a certain threshold -  is not filtering in a DSP sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical FIR filter is shown below. It consists of delays, z^-1, and gains, the $b$ terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3rnpm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compare with the IIR filter shown below which has part of its output fed back into the delay structure (the gains are missing on this diagram).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zm3Sl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2014-09-05T09:55:06.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18101" PostTypeId="1" CreationDate="2014-09-05T10:00:27.923" Score="1" ViewCount="273" Body="&lt;p&gt;I want to carry out a binary classification/segmentation on a grayscale image with very little texture. The only prior knowledge that's supposed to be available is that the object of interest is rather dark (i.e. low gray values) and comprises a significant portion of the image (maybe around 30%-70%). The object of interest should basically be a connected component (although this needn't be the case every single time), but can contain &quot;blobs&quot; of brighter clutter objects. Also, there might be patches of dark pixels in the clutter areas as well, but they should not be as homogeneous and as large as the object of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, I have already checked on simple thresholding (e.g. Otsu's method) or 2-means classification followed by some kind of in-painting, which both lead to similar results. However, these results are only satisfactory if the object of interest is very homogeneous and clearly separable from the clutter object's brighter gray value range. For rather heterogeneous sample images, there is often also clutter, which is put into the object class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore my question: Is there any interesting literature available about single-channel image classification without exploitation of texture features, but maybe incorporating spatial context? I have already done some research on google, but I have a hard time coming up with proper search terms...`&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDITION:&#xA;Active Contours is very close tho the solution I am looking for. However, they generally work best for one distinct, convex, object, which is enclosed by background. In my situation, however, many convex objects are located in front of the background, so either one active contour for every foreground object is needed or a special case of active contours considering the background as object, being able to deal with clutter objects WITHIN the shape of the object, is needed. Any such method or literature available?&lt;/p&gt;&#xA;" OwnerUserId="4689" LastEditorUserId="4689" LastEditDate="2014-11-04T12:12:14.590" LastActivityDate="2014-11-04T12:12:14.590" Title="Binary classification of grayscale image with little texture" Tags="|image-segmentation|classification|thresholding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18102" PostTypeId="2" ParentId="18099" CreationDate="2014-09-05T10:22:54.427" Score="2" Body="&lt;p&gt;Filters block or allow to pass, but in the frequency domain.   So you first you have to transform your vector into the frequency domain, a sum of sinusoids (Fourier, et.al., said this was possible), then apply the filter to attenuate or block some of them and pass others, then transform back to your original domain to see what the result looks like.  For linear systems, IIR and FIR computations just happen to produce the same result, but without having to do the 2 transforms.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-09-05T10:22:54.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18104" PostTypeId="2" ParentId="15358" CreationDate="2014-09-05T12:02:04.257" Score="5" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/scipy/scipy/commit/c12a7e9be50783262787dad260a4940c8f072dd0&quot; rel=&quot;nofollow&quot;&gt;complex morlet&lt;/a&gt; was added Aug 10, 2007&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/scipy/scipy/commit/60727aa5f2d9a27c617927a93b914c4573ef9aa1&quot; rel=&quot;nofollow&quot;&gt;ricker&lt;/a&gt; and &lt;a href=&quot;https://github.com/scipy/scipy/commit/a5beac97bc29a0b1813c076f36cf1bdd93bb3d35&quot; rel=&quot;nofollow&quot;&gt;cwt&lt;/a&gt; were added Sep 20, 2011&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There's no indication that &lt;code&gt;cwt&lt;/code&gt; is meant to be compatible with &lt;code&gt;morlet&lt;/code&gt;.  As &lt;code&gt;cwt&lt;/code&gt; docstring says: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Wavelet function, which should take 2 arguments. ... second is a width parameter, defining the size of the wavelet (e.g. standard deviation of a gaussian).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;morlet&lt;/code&gt; function takes 4 arguments, the second of which is not a width parameter, it's a frequency parameter, so I don't think it is meant to be used with &lt;code&gt;cwt&lt;/code&gt;. Using &lt;code&gt;ricker&lt;/code&gt; as a template, you are supposed to define your own functions to use with &lt;code&gt;cwt&lt;/code&gt;. In addition, &lt;code&gt;cwt&lt;/code&gt; cannot handle complex wavelets (as of v0.18).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd suggest you try a different implementation that has this done for you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://web.archive.org/web/20150711022023/http://www.phy.uct.ac.za/courses/python/examples/moreexamples.html#wavelet-analysis-continuous-wavelet-transform&quot; rel=&quot;nofollow&quot;&gt;Pyscellania&lt;/a&gt; has a &lt;a href=&quot;http://web.archive.org/web/20150406051023/http://www.phy.uct.ac.za/courses/python/examples/Wavelets.py&quot; rel=&quot;nofollow&quot;&gt;Wavelets&lt;/a&gt; module (now &lt;a href=&quot;https://github.com/emanuele/cwt&quot; rel=&quot;nofollow&quot;&gt;mirrored at github&lt;/a&gt;) which implements real/complex Morlet, MexicanHat, Paul order 2, Paul order 4, 1st Derivative Of Gaussian, 4th Derivative Of Gaussian, Unnormalised version of continuous Haar transform, Normalised Haar&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/aaren/wavelets&quot; rel=&quot;nofollow&quot;&gt;aaren/wavelets&lt;/a&gt; supports Morlet, Paul, DOG, Ricker&lt;/li&gt;&#xA;&lt;li&gt;Machine Learning PYthon (mlpy) has &lt;a href=&quot;http://mlpy.sourceforge.net/docs/3.1/wavelet.html#continuous-wavelet-transform&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;mlpy.wavelet.cwt&lt;/code&gt;&lt;/a&gt; that supports Morlet, Paul, and Derivative Of Gaussian wavelets&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/Dapid/fast-pycwt&quot; rel=&quot;nofollow&quot;&gt;Dapid/fast-pycwt&lt;/a&gt; supports Morlet and Ricker&lt;/li&gt;&#xA;&lt;li&gt;ObsPy (seismological observatories) has a &lt;a href=&quot;http://docs.obspy.org/master/tutorial/code_snippets/continuous_wavelet_transform.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;cwt&lt;/code&gt; module&lt;/a&gt; and &quot;for now only 'morlet' is implemented&quot;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/Unidata/pyCWT&quot; rel=&quot;nofollow&quot;&gt;pyCWT&lt;/a&gt; has Morlet wavelet&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="29" LastEditorUserId="2030" LastEditDate="2016-09-26T19:34:53.557" LastActivityDate="2016-09-26T19:34:53.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18106" PostTypeId="1" AcceptedAnswerId="18109" CreationDate="2014-09-05T12:46:28.457" Score="4" ViewCount="4249" Body="&lt;p&gt;I have a system with limited memory. So basically the question is this: If I have (say) 24KB of data space and 4096 data samples of single precision floats (16KB) can I do an FFT on the data? More generally, what is the minimum data space required to do an FFT?&lt;/p&gt;&#xA;" OwnerUserId="7233" LastActivityDate="2014-09-05T15:22:57.437" Title="Memory requirements for FFT" Tags="|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18109" PostTypeId="2" ParentId="18106" CreationDate="2014-09-05T15:22:57.437" Score="4" Body="&lt;p&gt;From the &lt;a href=&quot;http://www.keil.com/pack/doc/CMSIS/DSP/html/group___complex_f_f_t.html&quot; rel=&quot;nofollow&quot;&gt;documentation of the CMSIS-DSP FFT function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The FFT functions operate in-place. That is, the array holding the&#xA;  input data will also be used to hold the corresponding result. The&#xA;  input data is complex and contains 2*fftLen interleaved values as&#xA;  shown below.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is possible to implement the FFT in such a way, that it does not require additional buffers but uses the memory of the input array for its output. This method is usually referred to as &quot;in-place&quot; calculation. From the above citation I think that the CMSIS-DSP library does exactly that (though we can not know for sure without the source code).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in this case, yes, a memory size of 16 KB is sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That an in-place calculation is possible can be understood from the butterfly diagram, see for example &lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/5/54/FFT_Butterfly_radix8.svg/420px-FFT_Butterfly_radix8.svg.png&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-09-05T15:22:57.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18110" PostTypeId="1" AcceptedAnswerId="18115" CreationDate="2014-09-05T15:26:33.650" Score="2" ViewCount="992" Body="&lt;p&gt;I have an intensity image, similar to the image below.  I would like to very quickly, segment this image, into separate peaks.  Where each peak is labelled, and segmented.  A notional segmentation of 3 blobs is given below by the black lines.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Definition of a peak segment is:  The contour that just crosses the highest saddle point between this peak and an adjacent peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has to be a well studied problem, but I can't figure it out.  I have been looking at the Matlab functions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mathworks.com/help/images/ref/imregionalmax.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;imregionalmax&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mathworks.com/help/images/ref/imreconstruct.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;imreconstruct&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mathworks.com/help/images/ref/imhmax.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;imhmax&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;all of which are close.... It is not hard to write an algorithm to do this (see below) using imreconstruct to operate on the tallest peak, segment out the first peak, and repeat.  The algorithm below is O(N) in number of peaks.  Such an algorithm can and should be O(1) in number of peaks (and this is important for my application.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wUU1s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above image was rendered in matlab with the command &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imagesc(peaks)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is an algorithm that performs the segmentation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = peaks;&#xA;peakValsX = [21, 25, 35];&#xA;peakValsY = [20, 38, 25];&#xA;&#xA;N = numel(peakValsX);&#xA;&#xA;clear('peakImgs', 'peakMask');&#xA;for ix = 1 : N;&#xA;    aptImg       = zeros(size(a));&#xA;    aptImg(peakValsY(ix), peakValsX(ix)) = a(peakValsY(ix),peakValsX(ix));&#xA;    peakImgs(:,:,ix) =  imreconstruct(aptImg,a);&#xA;    % All we've done is eliminated the other peaks.&#xA;    assert(all(reshape(peakImgs(:,:,ix) &amp;lt;= a,[],1)));&#xA;end&#xA;&#xA;for ix = 1 : N&#xA;    peakMask(:,:,ix) = ix*(max(peakImgs(:,:,setdiff(1:N, ix)),[],3) &amp;lt; a);&#xA;end&#xA;&#xA;peakMaskResult = max(peakMask,[],3);&#xA;imagesc(peakMaskResult);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the resulting segmentation:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FGSoC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To Reiterate.  The question is, &quot;Is there a matlab implementation of the peak segmentation algorithm (as described above) that can be executed in O(1) of number of peaks?&quot;&lt;/p&gt;&#xA;" OwnerUserId="11008" LastEditorUserId="11008" LastEditDate="2014-09-08T14:10:24.503" LastActivityDate="2014-09-08T14:10:24.503" Title="O(1) peak segmentation algorithm in matlab?" Tags="|image-processing|matlab|image-segmentation|peak-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18112" PostTypeId="2" ParentId="18101" CreationDate="2014-09-05T17:00:41.777" Score="2" Body="&lt;p&gt;Two large classes of techniques that may be of interest to you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mumford Shah functional based techniques.&lt;/li&gt;&#xA;&lt;li&gt;Active Contour techniques.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some googling on these terms should open some new doors for you.&lt;/p&gt;&#xA;" OwnerUserId="11008" LastActivityDate="2014-09-05T17:00:41.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18113" PostTypeId="1" CreationDate="2014-09-05T17:07:48.407" Score="4" ViewCount="1032" Body="&lt;p&gt;Here I am again (&lt;a href=&quot;https://dsp.stackexchange.com/questions/17803/implementation-of-the-constant-q-transform-property-questions&quot;&gt;Implementation of the constant Q transform + property questions&lt;/a&gt;) :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was reading &lt;a href=&quot;http://academics.wellesley.edu/Physics/brown/pubs/effalgV92P2698-P2701.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; on a constant-q transform algorithm, where they managed to turn the following equation for the constant-q transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ihucs.png&quot; alt=&quot;cq&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;into this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sCiBt.png&quot; alt=&quot;cqfft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(where X[k] is the fourier transform of x[n], and K*[k, kcq] is the complex conjugate of the fourier transform of the w[n, kcq]) &#xA;- claiming it to be an efficient algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I'm still new to algorithmic complexity, I tried to derive the big-O complexity. I'm assuming the transforms of the windows (ie. K*[], the kernels) are pre-calculated. Let N be the size of the transform, and K the number of components (kernels / filters / results). &lt;strong&gt;Would this be correct&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t3YAM.png&quot; alt=&quot;ocqfft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So thats the FFT (N * log2(N)) plus K loops of N multiplies (the convolution) + additional stuff done at each loop (done K times). &#xA;Also, since the kernels are precalculated, that incurs both a certain amount of memory storage needed + a lot of memory access during the calculation. With their implementation, they store the kernels in full size (that is, N), so the required storage memory for the calculation would be K kernels of N size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm defining M() to be the amount of memory used during an calculation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OSunH.png&quot; alt=&quot;mcqfft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, we need to load the whole signal (N), also K number of N-sized complex (2) kernels. That is quite different from algorithms like the standard fft and direct evaluation of the constant-q transform which requires no working storage, and as of such are defined to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WnMEO.png&quot; alt=&quot;mfft&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/trXKk.png&quot; alt=&quot;mcq&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Since they only need to load the signal. If we define the complexity of the FFT and the direct evaluation of the constant-q transform to the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/acwgE.png&quot; alt=&quot;ocq&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This assumes direct evaluation of the CQ-transform which incurs at least N&lt;em&gt;K operations, together with N&lt;/em&gt;K operations calculating the discrete window for each component.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TbhE0.png&quot; alt=&quot;offt&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can create a small comparison table for an example. If the transform is of size 2048, and the wanted number of components is 1048 (N = 2048, K = 1048), we get the following results:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PkhhC.png&quot; alt=&quot;table&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would seem the cqfft algorithm (theirs) incurs a rather extreme memory cost (that in practical appliances could dominate computational speed) for a mere ~2x increase in computation speed. &lt;strong&gt;Is this correctly derived&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a reference-pseudocode of their implementation i wrote, as i understand it. If i have misunderstood their algorithm, it will probably show here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;std::vector&amp;lt;complex&amp;lt;float&amp;gt;&amp;gt; fft(float[], size_t);&#xA;&#xA;class kTransform&#xA;{&#xA;    vector&amp;lt;complex&amp;lt;float&amp;gt;&amp;gt; cqfft(vector&amp;lt;float&amp;gt; signal)&#xA;    {&#xA;        vector&amp;lt;complex&amp;lt;float&amp;gt;&amp;gt; fftdata = fft(signal, size);&#xA;        for (int kernel = 0; kernel &amp;lt; kernels.size(); ++kernel)&#xA;        {&#xA;            complex&amp;lt;float&amp;gt; accumulator;&#xA;            for (int k = 0; k &amp;lt; size; ++k)&#xA;            {&#xA;                accumulator += fftdata[k] * conj(kernels[kernel][k]);&#xA;            }&#xA;            fftdata[kernel] = accumulator / size;&#xA;        }&#xA;        return fftdata;&#xA;    }&#xA;&#xA;    void compileKernels(vector&amp;lt;float&amp;gt; freqs, size_t dftSize)&#xA;    {&#xA;        auto numKernels = freqs.size();&#xA;        kernels.resize(numKernels);&#xA;        size = dftSize;&#xA;        for (int kernel = 0; kernel &amp;lt; numKernels; ++kernel)&#xA;        {&#xA;            kernels[kernel] = fft(Window(freqs[kernel]));&#xA;        }&#xA;    }&#xA;    size_t size;&#xA;    vector&amp;lt;vector&amp;lt;complex&amp;lt;float&amp;gt;&amp;gt;&amp;gt; kernels; &#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any insight. As a bonus question, does anyone know what the complexity of a fast implementation of the Gabor transform is?&lt;/p&gt;&#xA;" OwnerUserId="8650" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2014-12-19T13:05:53.907" Title="Analysis and algorithmic complexity of the Constant Q transform" Tags="|fft|algorithms|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18114" PostTypeId="2" ParentId="18024" CreationDate="2014-09-05T17:16:25.190" Score="1" Body="&lt;p&gt;This is not a complete answer to your problem, but the Matlab Calibration Toolbox tackles a number of these problems directly, although with more repetition in the target.&#xA;&lt;a href=&quot;http://www.vision.caltech.edu/bouguetj/calib_doc/&quot; rel=&quot;nofollow&quot;&gt;http://www.vision.caltech.edu/bouguetj/calib_doc/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A huge issue in these problems is the lighting.  It seems you have control over the lighting, so &quot;simple&quot; vs. &quot;hard&quot; solutions should be good, and I would focus on those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One very robust option is to use a generalized hough transform to identify these shapes in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you seem to not have tried matched filtering.  Again, a bit slow, but extremely robust.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of the above can be massively sped up with image pyramids.&lt;/p&gt;&#xA;" OwnerUserId="11008" LastActivityDate="2014-09-05T17:16:25.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18115" PostTypeId="2" ParentId="18110" CreationDate="2014-09-05T18:38:24.183" Score="1" Body="&lt;p&gt;I'm not sure why you need to call &lt;code&gt;imreconstruct&lt;/code&gt; more than once. The way you normally use morphological reconstruction is &lt;a href=&quot;http://www.mathworks.de/de/help/images/morphological-reconstruction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;described here&lt;/a&gt;: You basically subtract some constant (the peak threshold) from your source image, then reconstruct it. What you get is an image that is identical to your original image except at the peaks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rtvHO.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you simply take the difference and binarize, or compare the two images pixel-wise.&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2014-09-05T18:38:24.183" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18117" PostTypeId="2" ParentId="18099" CreationDate="2014-09-05T20:01:45.910" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Like HPF (High Pass Filter):&lt;/p&gt;&#xA;  &#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;x(n)={1,2,3,4,5,6,7,8,9}&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;  &#xA;  &lt;p&gt;Set threshold as &gt;=5 so output sequence would be {5,6,7,8,9}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, that's not an HPF at all.  An HPF is like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    x[n]  = [ 1, 3, 1, 3, 1, 3, 1, 3, 1]&#xA;&#xA;HPF(x[n]) = [-1, 1,-1, 1,-1, 1,-1, 1,-1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It throws away the low-frequency information (the constant offset of 2), and keeps the high-frequency information (the oscillation up and down every other sample).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An LPF would keep the average offset while throwing away the high-frequency changes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;LPF(x[n]) = [ 2, 2, 2, 2, 2, 2, 2, 2, 2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="29" LastActivityDate="2014-09-05T20:01:45.910" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18120" PostTypeId="1" CreationDate="2014-09-06T06:48:58.780" Score="0" ViewCount="767" Body="&lt;p&gt;For example, when playing piano, at the same time, print out the key notes by analyzing the signal of piano sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to do some pre-processing to remove the noise? When calculate with FFT, noise will influence the result?&lt;/p&gt;&#xA;" OwnerUserId="10767" LastActivityDate="2014-09-06T17:16:09.213" Title="Best method to do piano key pitch detection?" Tags="|fft|discrete-signals|fourier-transform|dsp-core|pitch|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18122" PostTypeId="2" ParentId="18120" CreationDate="2014-09-06T09:22:00.607" Score="3" Body="&lt;p&gt;There is no easy answer to that question. Plenty of algorithms exists which are suitable to that task. Nowadays Non-negative Matrix Factorisation (NMF) is getting more and more popular in this field of research. If you have enough of resources and knowledge then you can try it. It's just a 'fancy' SVD decomposition with some 'constraints and tweaks'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some literature for you that might be useful in terms of choosing the approach. First one contains some vast overview of the problem as well as lot's of references:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.eecs.qmul.ac.uk/~simond/pub/2013/10.1007_s10844-013-0258-3.pdf&quot; rel=&quot;nofollow&quot;&gt;Benetos E., et al. - &lt;strong&gt;Automatic music transcription: challenges and future&#xA;  directions&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://www.eecs.qmul.ac.uk/~emmanouilb/papers/benetosdixon_jstsp_postprint.pdf&quot; rel=&quot;nofollow&quot;&gt;Benetos E., Dixon S. - &lt;strong&gt;Joint Multi-pitch Detection using Harmonic&#xA;  Envelope Estimation for Polyphonic Music&#xA;  Transcription&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://www.eecs.qmul.ac.uk/~ewerts/publications/2014_BenetosEwertWeyde_HarmonicPercussiveTranscription_ICASSP.pdf&quot; rel=&quot;nofollow&quot;&gt;Benetos E., et al. - &lt;strong&gt;Automatic Transcription of Pitched and&#xA;  Unpitched Sounds from Polyphonic&#xA;  Music&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://qmro.qmul.ac.uk/jspui/bitstream/123456789/3368/1/BENETOSAutomaticTranscription2012.pdf&quot; rel=&quot;nofollow&quot;&gt;Benetos E. - &lt;strong&gt;Automatic Transcription of Polyphonic Music Exploiting Temporal Evolution&lt;/strong&gt; - PhD Thesis&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://www.eecs.qmul.ac.uk/~markp/2013/OHanlonPlumbley13-icassp_accepted.pdf&quot; rel=&quot;nofollow&quot;&gt;O'Hanlon K., Plumbley M. - &lt;strong&gt;Automatic Music Transcription using Row&#xA;  Weighted&#xA;  Decompositions&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-09-06T09:22:00.607" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18123" PostTypeId="1" CreationDate="2014-09-06T10:01:39.730" Score="0" ViewCount="315" Body="&lt;p&gt;I am applying simple FFT to estimate the frequencies of the oscillations. The real values of frequencies are known to me as I made a synthesis signal for simulation.Thus, I can calculate the error simply. The signal contains 4 different frequencies. FFT can estimate these components fairly accurate.&lt;br&gt;&#xA; when, the noise is added to the signal it is expected to see an increase in estimation errors. also increasing the noise strength must increase the error size naturally.&lt;br&gt;&#xA; &lt;strong&gt;The question is this, in most case the error is increased in with noise. But for some cases,'one or two modes out of four', the error is decreased and better accuracy is obtained in noisy environment. why this is happening.&lt;/strong&gt;&lt;br&gt;&#xA;please provide some rational reasons with some references to this unexpected phenomenon.&lt;br&gt;&#xA;Thanks in the best way&lt;br&gt;&#xA;P.S The added noise is zero mean Guassian&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="1606" LastEditDate="2014-09-06T11:02:56.567" LastActivityDate="2014-09-06T11:02:56.567" Title="why adding noise enhances the accuracy sometimes?" Tags="|noise|estimation|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18124" PostTypeId="2" ParentId="6112" CreationDate="2014-09-06T11:01:20.340" Score="4" Body="&lt;p&gt;I will explain two approaches for this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)&#xA;One approach would require a line matching algorithm. After matching the lines, you could simply use the end points of the lines in order to compute homography. To achieve that EDLine or LSD based descriptors are recently proposed in OpenCV. Also, hashing and fast matching of them are also implemented. Check out the videos here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=MqMjvSkM39k&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.youtube.com/watch?v=MqMjvSkM39k&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=naSWTlbg3To&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.youtube.com/watch?v=naSWTlbg3To&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The recent opencv_contrib repository contains the source code to these methods.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case that the line end points are noisy, you could then directly utilize the lines to compute the homographies. Such papers would then read:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Internal Report: 2005-V04 Computing Homographies from Three Lines or&#xA;  Points in an Image Pair&#xA;  &lt;em&gt;G. Lopez-Nicolas, J.J. Guerrero, O.A. Pellejero, C. Sagues&lt;/em&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Internal Report: 2003-V01 Robust line matching and estimate of homographies simultaneously &lt;em&gt;G. Lopez-Nicolas&lt;/em&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Probabilistic Matching of Lines for Their Homography &lt;em&gt;Taemin Kim, Jihwan Woo, and In So Kweon&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;2) There is one method specific to the fields are given here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;&lt;a href=&quot;http://www.cs.ubc.ca/nest/lci/thesis/ankgupta/gupta11crv.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using line and ellipse features for rectification of broadcast hockey video&lt;/a&gt;.&quot;, &lt;em&gt;Gupta, Ankur, James J. Little, and Robert J. Woodham&lt;/em&gt;&#xA;  Computer and Robot Vision (CRV), 2011 Canadian Conference on. IEEE,&#xA;  2011.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;&lt;a href=&quot;https://pdfs.semanticscholar.org/3e39/49e2b92fdff9dd8d21c6bfda3e387a68d5cf.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Combining line and point correspondences for homography estimation&lt;/a&gt;.&quot;, &lt;em&gt;Dubrofsky, Elan, and Robert J. Woodham&lt;/em&gt;. International Symposium on Visual Computing. Springer Berlin Heidelberg, 2008.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The idea is as follows: Any line, parametrized by its coefficients $\mathbf{l}_i=(u,v,1)^T$ maps to $\mathbf{l}_i^{'}=(x,y,1)^T$ in the other image using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{l}_i^{'} = \mathbf{H}^T \mathbf{l}_i&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this form the equation can be directly plugged into the DLT method: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;A_i =&#xA;\begin{bmatrix}&#xA;-u &amp;amp; 0 &amp;amp; ux &amp;amp; -v &amp;amp; 0 &amp;amp; vx &amp;amp; -1 &amp;amp; 0 &amp;amp; x  \\&#xA;0 &amp;amp; -u &amp;amp; uy &amp;amp; 0 &amp;amp; -v &amp;amp; vy &amp;amp; 0 &amp;amp; -1 &amp;amp; y &#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference is the normalization, which you will find in the references above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Adding Ellipses:&lt;/strong&gt;&#xA;Any point $x$ lies on the conic section $C$ if $x^TCx=0$. This gives rise to the transformation relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C' = H^{-T}CH^{-1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The references above also explain how to insert this constraint to the DLT algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using ellipses and lines, it is possible to derive a robust projective relationship.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2017-01-30T23:07:04.750" LastActivityDate="2017-01-30T23:07:04.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18125" PostTypeId="2" ParentId="18120" CreationDate="2014-09-06T15:32:09.517" Score="1" Body="&lt;p&gt;Pitch detection/estimation is different from FFT peak frequency estimation.  The &quot;noise&quot; you may be seeing in the FFT result could instead be harmonic components of the spectral structure of the pitched note, thus should not be filtered out, as they may be important to creating the perception of pitch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try a pitch detection or estimation algorithm instead of a peak frequency estimator.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-09-06T17:16:09.213" LastActivityDate="2014-09-06T17:16:09.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18126" PostTypeId="1" AcceptedAnswerId="18128" CreationDate="2014-09-07T13:28:14.140" Score="1" ViewCount="42364" Body="&lt;p&gt;I am a little new to matlab and would like to get some help on how to write a program or a function that can calculate the energy/power of a signal depending on whether the signal is an energy or a power signal.&#xA;Here is the program the I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ ] = power_or_energy( s,t)&#xA;%UNTITLED Summary of this function goes here&#xA;%   s is the input signal&#xA;%   t is the independent variable&#xA;&#xA;s2=s.^2;&#xA;energy=int(s2,t,-inf,inf);&#xA;&#xA;if energy~=inf &amp;amp;&amp;amp; energy~=-inf&#xA;    disp ('the signal is an energy signal with energy equal to ' );&#xA;    disp(energy);&#xA;end&#xA;&#xA;power=limit((int(s2,t,-t/2,t/2))/t,t,inf);&#xA;&#xA;if power~=inf &amp;amp;&amp;amp; power~=-inf&#xA;    disp('the signal is a power signal with power equal to ');&#xA;    disp(power);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the problem here is that when i want to check it for a function like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=0:0.01:10;&#xA;s=sin(t);&#xA;power_or_energy(s,t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then i get the following error:&#xA;&lt;em&gt;&quot;Undefined function 'int' for input arguments of&#xA;type 'double'.&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how to i actually calculate the energy for such signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the above function works fine with the below input:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;syms t;&#xA;s=sin(t);&#xA;power_or_energy(s,t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please help me in writing a function that can be used to find the energy of any input signal.&lt;/p&gt;&#xA;" OwnerUserId="11018" LastEditorUserId="4298" LastEditDate="2020-11-08T17:01:07.373" LastActivityDate="2020-11-08T17:01:07.373" Title="Calculating power and energy of a signal in matlab" Tags="|matlab|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18127" PostTypeId="1" AcceptedAnswerId="18129" CreationDate="2014-09-07T13:31:46.820" Score="2" ViewCount="360" Body="&lt;p&gt;I've been trying to get my head around digital plls from knowing nothing and seen that most examples only use the positive zero crossing, not the negative. I've tried to find the answer but the best i could find is a textbook that said &quot;complications arise when using the negative zero crossing so this type of PLL isn't as common&quot; without further explanation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only reason that i can think of is that it would require more processing, but surely this would be worthwhile as you would be able to achieve faster lock times?&lt;/p&gt;&#xA;" OwnerUserId="11020" LastActivityDate="2014-09-07T21:52:21.510" Title="Why do most digital pll's only use the positive zero crossing?" Tags="|pll|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18128" PostTypeId="2" ParentId="18126" CreationDate="2014-09-07T13:54:01.523" Score="1" Body="&lt;p&gt;The Matlab function &lt;code&gt;int&lt;/code&gt; needs a symbolic expression as an integrand, and a symbolic variable as an integration variable. In your example &lt;code&gt;s&lt;/code&gt; and &lt;code&gt;t&lt;/code&gt; are both vectors, and you can't use &lt;code&gt;int&lt;/code&gt; in this case. If you want to compute the power or energy of discrete time signals, then you need to use the corresponding definitions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_x=\sum_{n=-\infty}^{\infty}|x_n|^2\\&#xA;P_x=\lim_{N\rightarrow\infty}\frac{1}{2N+1}\sum_{n=-N}^N|x_n|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice you will need to consider finite length signals unless you have an analytic formula for $x_n$ and some software package that can deal with the analytic evaluation of infinite sums. Obviously, finite length signals always have finite energy and $P_x=0$ according to above definition.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-09-07T14:01:39.463" LastActivityDate="2014-09-07T14:01:39.463" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18129" PostTypeId="2" ParentId="18127" CreationDate="2014-09-07T21:52:21.510" Score="1" Body="&lt;p&gt;Getting accurate lock when using both edges or zero-crossings requires that the duty cycles of both the PLL local oscillator and the reference signal match and/or be as stable as the frequency.  If the duty cycles don't match when using both edges, then you would have to filter out some twice per cycle jitter which could well slow down lock speed.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-09-07T21:52:21.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18130" PostTypeId="1" AcceptedAnswerId="18139" CreationDate="2014-09-07T22:35:26.280" Score="0" ViewCount="1146" Body="&lt;p&gt;I'm trying to understand the discrete-time convolution for LTIs and its graphical representation. standard explanations (like: &lt;a href=&quot;http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/video-lectures/lecture-4-convolution/MITRES_6_007S11_lec04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;) start with the idea of decomposing an input signal &lt;span class=&quot;math-container&quot;&gt;$x[t]$&lt;/span&gt; into a sum of unit impulses. We have unit impulse function &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\delta[n]= &#xA;\begin{cases}&#xA;    1,&amp;amp; \text{if}\ n = 0\\&#xA;    0,&amp;amp; \text{if}\ n\neq0&#xA;\end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then &lt;span class=&quot;math-container&quot;&gt;$x[t]$&lt;/span&gt; can be represented as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x[t] = \sum_{k = -\infty}^{+\infty}x[k]\cdot\delta[t-k]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the input signal at &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x[t]$&lt;/span&gt;, can be represented this way because &lt;span class=&quot;math-container&quot;&gt;$\delta[t-k]$&lt;/span&gt; is going to be 1 only if &lt;span class=&quot;math-container&quot;&gt;$t = k$&lt;/span&gt;, and 0 elsewhere. this makes great sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the confusion for me begins in &lt;strong&gt;Transparency 4.2&lt;/strong&gt; of above &lt;a href=&quot;http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/video-lectures/lecture-4-convolution/MITRES_6_007S11_lec04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;. the left hand side makes perfect sense, but what does the right represent? how does one unit impulse generate a sequence of responses? what does &lt;span class=&quot;math-container&quot;&gt;$x[0]h[n]$&lt;/span&gt; represent here? How do you go from this to &lt;strong&gt;Transparency 4.9&lt;/strong&gt; where &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is used instead of &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;put differently: can someone explain the intuition behind &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; (the response of a an LTI system) being reflected and time shifted? in the above trick for representing simply the input signal &lt;span class=&quot;math-container&quot;&gt;$x[t]$&lt;/span&gt;, there's no time shifting really; &lt;span class=&quot;math-container&quot;&gt;$\delta[t-k]$&lt;/span&gt; seems like just a mathematical trick for getting a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in the right place and zero elsewhere; it's not intuitive for me to think of it as time shifted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if we use the fact that in LTI, the response of a system to input &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt;, is just the superposition of the responses to unit impulses of input signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, why can't we write convolution this way instead?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = \sum_{k=-\infty}^{+\infty}x[k]h[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="11021" LastEditorUserId="47251" LastEditDate="2020-02-17T22:45:25.430" LastActivityDate="2020-02-17T22:45:25.430" Title="understanding discrete-time convolution in LTI systems" Tags="|discrete-signals|signal-analysis|convolution|impulse-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="18131" PostTypeId="1" CreationDate="2014-09-08T02:01:28.570" Score="4" ViewCount="1694" Body="&lt;p&gt;For multi-pitch detection, I mean for example pressing several piano keys at the same time. For signal pitch detection (pressing one key at a time), after FFT, mostly the frequency with the largest magnitude is desired frequency.  However, for multi-pitch detection, let's just say press two piano keys, the two frequencies with the first two largest magnitudes are not the frequencies of keys I pressed. &lt;/p&gt;&#xA;" OwnerUserId="10767" LastEditorUserId="8202" LastEditDate="2014-09-08T10:56:39.157" LastActivityDate="2014-09-08T10:56:39.157" Title="Thoretically, what makes multi-pitch detection so difficult?" Tags="|fft|discrete-signals|signal-detection|dsp-core|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18132" PostTypeId="2" ParentId="18131" CreationDate="2014-09-08T03:00:42.080" Score="2" Body="&lt;p&gt;First of all:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;mostly the frequency with the largest magnitude is desired frequency&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a very naive and flawed approach, as what you are measuring here is very different from the perceptual notion of pitch. Not to mention that you hit the limited resolution of FFT...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the challenges one has to face in multi-pitch detection:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Octaves are difficult to tell apart. Play two Cs one octave apart, and the harmonics of the highest note reinforces the harmonics of the lowest note, rather than create new peaks in the spectrum, to the point that one could hear one single &quot;C&quot; note with a different timbre. When mixing several notes together, some of their partials can reinforce or cancel each other.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Pitch detection can no longer be seen as a problem of period estimation. The most successful monophonic pitch detection algorithms are time-domain and based on metrics like the average magnitude (or square) difference function, and the underlying assumption is that the signal has a salient periodicity - it is almost similar to itself when translated in time. These methods cannot be applied to polyphonic signals, as the period of a mixture of periodic signals is the LCD of the components' periods. Knowing this LCD does not give away the factors...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The fact that the number of notes is not known in advance increases the size of the search space, and makes it an ill-posed problem. You are no longer ranking hypothesis like &quot;this is a C3&quot; vs &quot;this is a C#3&quot;, but instead, &quot;this is a C3 and a G4&quot; vs &quot;this is just a C3&quot; vs &quot;this is a C2 and a C3&quot;. For example, take a single piano note. One could describe its spectra as a &quot;single C3 piano note&quot;. Or one could describe its spectra as &quot;a C3, a C4, a G4, etc... all played together by an instrument producing purely sinusoidal notes&quot;. Distinguishing among these two options requires prior knowledge of the spectral shape of a piano note.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-09-08T03:00:42.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18133" PostTypeId="1" AcceptedAnswerId="18134" CreationDate="2014-09-08T03:41:49.900" Score="0" ViewCount="638" Body="&lt;p&gt;given this block diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aRqMg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can someone please clarify how to interpret the second delay (the one prior to $Y$)? to convert this block diagram into a simple equation, I interpret the diagram as:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;bottom path: take input at $n$, multiply by $-1$ and delay by $1$, gives: $-1x[n-1]$&lt;/li&gt;&#xA;&lt;li&gt;top path: take input at $n$ and sum it by result of bottom path, gives: $x[n] + -1x[n-1]$&lt;/li&gt;&#xA;&lt;li&gt;take sum of bottom and top path and delay it (?) - this is the part I'm confused about. it doesn't make sense to write: $(x[n] + -1x[n-1])[n-1]$ which is what the diagram looks like to me.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;what is the right way to read this diagram?&lt;/p&gt;&#xA;" OwnerUserId="11021" LastActivityDate="2014-09-08T07:33:31.850" Title="converting block diagrams with delays to equations" Tags="|discrete-signals|signal-analysis|visualization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18134" PostTypeId="2" ParentId="18133" CreationDate="2014-09-08T04:33:27.080" Score="1" Body="&lt;p&gt;If you are confused about the interpretation, why not divide the diagram into 2 parts. The signal to the left of the rightmost delay element is assumed to be z[n].  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, now $$y[n] = z[n-1]$$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z[n] = x[n] + (-1)\cdot x[n-1]$$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = x[n-1]  -x[n-2]$$&lt;/p&gt;&#xA;" OwnerUserId="4875" LastEditorUserId="4298" LastEditDate="2014-09-08T07:33:31.850" LastActivityDate="2014-09-08T07:33:31.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18136" PostTypeId="1" AcceptedAnswerId="18137" CreationDate="2014-09-08T07:10:10.557" Score="0" ViewCount="125" Body="&lt;p&gt;I came across this below question, (which was a homework assignment question for Signal Processing class, which my friend mailed me for help solving), mulled over it for an hour and had no idea how to proceed with solving it.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $C(x) = A(x)B(x)$ where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(x)=\sum_{n=0}^{N_1}a(n)x^n$$ &#xA;$$B(x)=\sum_{n=0}^{N_2}b(n)x^{2n}$$ &#xA;$$C(x)=\sum_{n=0}^{N_3}c(n)x^n$$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find expressions for $N_3$ and $c(n)$ as functions of $N_1$,$N_2$, the $a(n)$ and $b(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently, it has something to do with convolution, as in $c(n)$ is the convolution result of $a(n)$ &amp;amp; $b(n)$ or something like that.&lt;br&gt;&#xA;But I still can't figure out how that is. Can anybody please explain me the answer of $N_3$ and $c(n)$&lt;/p&gt;&#xA;" OwnerUserId="4875" LastEditorUserId="8202" LastEditDate="2014-09-10T08:10:10.430" LastActivityDate="2014-09-10T08:10:10.430" Title="How to derive the answer to this convolution problem?" Tags="|convolution|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18137" PostTypeId="2" ParentId="18136" CreationDate="2014-09-08T07:31:02.943" Score="2" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt; what is the highest power of $x$ after multiplying $A(x)$ and $B(x)$? This gives you directly the value of $N_3$. Then rewrite $B(x)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$B(x)=\sum_{n=0}^{2N_2}\hat{b}_nx^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you can use normal convolution of $a(n)$ and $\hat{b}(n)$ to derive $c(n)$. Now you just need to express $\hat{b}(n)$ in terms of $b(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; OK, so here's the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(x)=\sum_{n=0}^{N_3}c_nx^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $C(x)=A(x)B(x)$, the highest power of $C(x)$ must be $N_3=N_1+2N_2$. You can rewrite $B(x)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$B(x)=\sum_{n=0}^{2N_2}\hat{b}_nx^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{b}_n=\begin{cases}b_{n/2},&amp;amp;n \text{ even}\\&#xA;0,&amp;amp;n \text{ odd}\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the coefficients $c_n$ can be written as the convolution of $a_n$ and  $\hat{b}_n$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n=\sum_k\hat{b}_ka_{n-k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the index $k$ in the above sum we have the following constraints:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$0\le k\le 2N_2\quad\text{and}\quad 0\le n-k\le N_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which results in the summation limits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n=\sum_{k=\max\{0,n-N_1\}}^{\min\{n,2N_2\}}\hat{b}_ka_{n-k},\quad 0\le n\le N_3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sum only over even $k$, you can replace $\hat{b}_k$ by the coefficients $b_{k/2}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n=\sum_{k=\max\{0,n-N_1\},k\text{ even}}^{\min\{n,2N_2\}}b_{k/2}a_{n-k},\quad 0\le n\le N_3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be rewritten once more as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n=\sum_{k=\lceil{\max\{0,n-N_1\}/2}\rceil}^{\lfloor{\min\{n,2N_2\}/2}\rfloor}b_{k}a_{n-2k},\quad 0\le n\le N_3$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-09-10T07:55:49.603" LastActivityDate="2014-09-10T07:55:49.603" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18138" PostTypeId="2" ParentId="18131" CreationDate="2014-09-08T07:44:08.197" Score="0" Body="&lt;p&gt;Intervals in Western music are usually close to having their pitch frequencies related by low integer ratios.  Therefore, the composite of 2 notes can create an overtone sequence with many more than 2 possible groupings that contain tones that are roughly equally spaced in frequency (a problem for Harmonic Product Spectrum and other related methods.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of equal temperament tuning, the interval notes are not always related by exact low integer ratios... they are only very close.  Close enough for different overtones from different base pitch notes to beat.  Which means any single short FFT frame might be in the null of beat note of two overtones beating.  This further compounds the problem of multiple pitch candidates appearing and disappearing, for the multiple possible overtone sequences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of your frequency search space being points related by simple sequences of ratios of 2,3,4,5,etc. for a single pitch, the search space will need to contain sequences of all the fractional ratios of all the overtones of all the notes in  all the possible interval chords and intervals.  So many the sequences usually end up all overlapping, given any windowing noise (FFT length limited fattened spectral humps), instead of being distinct peaks in the pitch search space.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-09-08T07:44:08.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18139" PostTypeId="2" ParentId="18130" CreationDate="2014-09-08T07:47:50.237" Score="1" Body="&lt;p&gt;You know that $h(n)$ is the system's response to the input $x(n)=\delta(n)$. Because of time-invariance, the response to $x(n)=\delta(n-k)$ is given by $h(n-k)$. If you write the input signal as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=\sum_kx(k)\delta(n-k)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then, due to linearity, you can write the output signal as the sum of the responses to each individual term $x(k)\delta(n-k)$ in (1), which is $x(k)h(n-k)$. So you get the convolution sum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\sum_k x(k)h(n-k)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compute (2) for a given value of $n$ you need to multiply $x(k)$ with $h(n-k)$ for all relevant values of $k$. Since you have $h(n\color{red}{-k})$ in (2) (i.e. with a minus sign before $k$) you need to flip the impulse response (shifted by the current value of $n$), multiply it with $x(k)$ and compute the sum.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-08T07:47:50.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18140" PostTypeId="1" CreationDate="2014-09-08T08:48:51.270" Score="0" ViewCount="546" Body="&lt;p&gt;The histogram in Photoshop for a 16-bit image downsamples to 8 bits, showing a tonal range of 0 to 255. I appreciate to show tonal ranges for a 16 bit image a horizontal zoom function would be necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the mean, std deviation,... statistics also get downsampled to 8 bits with a corresponding loss of accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of seeing the true mean, std deviation etc of a 16 bit image?&lt;/p&gt;&#xA;" OwnerUserId="7420" LastActivityDate="2014-09-09T02:36:49.587" Title="Getting 16 bit image statistics in Photoshop" Tags="|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18141" PostTypeId="2" ParentId="18140" CreationDate="2014-09-08T15:08:45.250" Score="1" Body="&lt;p&gt;A lot of tools do this by default (even matlab's image processing tools for the most part). I'd load the image up in matlab and use the hist, std, mean, etc function by treating the image as a vector. Tools like EnvI also handle 16 bit images properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matlab/octave code would be roughly as follows (assuming 16 bit greyscale png):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img=double(imread('image.png'));&#xA;mean(img(:))&#xA;std(img(:))&#xA;hist(img(:),number of bins)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2014-09-09T02:36:49.587" LastActivityDate="2014-09-09T02:36:49.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18142" PostTypeId="1" CreationDate="2014-09-08T16:10:25.920" Score="2" ViewCount="1206" Body="&lt;p&gt;&lt;strong&gt;The background:&lt;/strong&gt; &#xA;I conducted an experiment where I rotated an object (with three-fold symmetry) many times and recorded the projection of the object. I should be able to tomographically reconstruct the object using an inverse Radon transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, first, I need to know the exact angle of the object at each step. Unfortunately, our experiment was not perfectly stable and the object did not rotate in perfectly consistent steps. The object has a &quot;three-leaf clover&quot; shape, and if I plot the &quot;asymmetry&quot; of the projection (top-bottom/(top+bottom)), then it should look like a sine wave that has a peak every 120 degrees of phase (due to the three-fold symmetry).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Anyway, here is the real problem&lt;/strong&gt;: In the figure below, I plotted the real asymmetry of the images in blue. In red, I plot a simple sine wave of what the asymmetry should be if there was no experimental jitter. If you look at the blue data with your eye, you can clearly see where it deviates from the model and you can infer what the actual phase of the wave should be. However, I have no idea how to convince python to assign a phase to each datapoint based on its actual asymmetry value. Any ideas??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dSt53.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the data and the code used to make the simple plot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;text = &quot;&quot;&quot;0.58018836  0.54719772  0.35009603 -0.07093418 -0.38495609 -0.56433715&#xA; -0.58238798 -0.58197763 -0.79733289 -0.91822821 -0.88177671 -0.71078292&#xA; -0.1013863   0.53490235  0.50354981  0.05747148 -0.49258035 -0.86043242&#xA; -0.73366264 -0.11736485  0.40830017  0.75403686  0.76892275  0.74578394&#xA;  0.67759482  0.58632213  0.38615145 -0.04784894 -0.58773909 -0.80827248&#xA; -0.70176645 -0.3018048   0.33288852  0.75568507  0.52563443 -0.09271778&#xA; -0.74360484 -0.93751009 -0.84840137 -0.62956237 -0.18022792  0.23716647&#xA;  0.58545184  0.70021713  0.61602417  0.39086982 -0.09830602 -0.73635755&#xA; -0.83658372 -0.36582787  0.12293982  0.51728333  0.72395964  0.77727396&#xA;  0.71986029  0.43646683  0.0821097  -0.33721973 -0.75678586 -0.59755965&#xA;  0.08786262  0.59804408  0.76638545  0.4829408  -0.01587402 -0.42493757&#xA; -0.63032865 -0.70086101 -0.71030878 -0.55375893 -0.16074062  0.42243708&#xA;  0.78208721  0.58585221  0.14783457 -0.32854651 -0.73844163 -0.74110153&#xA; -0.28917785 -0.03469134 -0.03392741  0.10028943  0.5273808   0.8099916&#xA;  0.60887728 -0.0270428  -0.64313701 -0.8553194  -0.82824477 -0.60014313&#xA; -0.2471473   0.2198018   0.56404379  0.71217775  0.81460569  0.66100642 &quot;&quot;&quot;&#xA;&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;asym = np.array(text.split())&#xA;plt.plot(asym)&#xA;&#xA;step = 11.76&#xA;theta = np.linspace(0,np.shape(asym)[0]*step,np.shape(asym)[0])&#xA;&#xA;plt.plot(np.sin(3*theta/180*np.pi),color='r')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11013" LastActivityDate="2014-09-08T16:10:25.920" Title="Extracting the phase of a jittering sine wave using python" Tags="|discrete-signals|signal-analysis|python|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18144" PostTypeId="1" AcceptedAnswerId="18145" CreationDate="2014-09-08T18:57:49.117" Score="6" ViewCount="9746" Body="&lt;p&gt;I am new to the field of signal processing. I am wondering what is the difference between DFS(Fourier Series) vs. DFT(Fourier Transform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For common applications, usually we get a segment(length &lt;code&gt;N&lt;/code&gt;) of digital waveform(like a audio segment), and then we apply FFT(DFT) and then do post-analysis with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if we can use DFS(thus not using DFT at all) all the time and just assume the waveform segment is repeated with period &lt;code&gt;N&lt;/code&gt;.  Would this naive thinking/approach cause any problems? &lt;/p&gt;&#xA;" OwnerUserId="10977" LastEditorUserId="10977" LastEditDate="2014-09-08T19:14:32.037" LastActivityDate="2023-05-24T15:16:11.167" Title="About Discrete Fourier Transform vs. Discrete Fourier Series" Tags="|fft|fourier-transform|" AnswerCount="5" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18145" PostTypeId="2" ParentId="18144" CreationDate="2014-09-08T19:26:51.153" Score="9" Body="&lt;p&gt;There is no operational difference between what is commonly called the Discrete Fourier Series (DFS) and the Discrete Fourier Transform (DFT).  On the USENET newsgroup &lt;em&gt;comp.dsp&lt;/em&gt;, we have had fights about this topic multiple times (if Google Groups wasn't so badly broken and messed up, I might be able to point you to the threads) and, despite the deniers, there is &lt;strong&gt;no&lt;/strong&gt;, none whatsoever, &lt;em&gt;operational&lt;/em&gt; difference between what is sometimes labeled as the DFS but most commonly labeled as the DFT.  (The &lt;em&gt;&quot;FFT&quot;&lt;/em&gt; is essentially an efficient or &lt;em&gt;fast&lt;/em&gt; method of calculating the DFT.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-02-27T15:14:17.383" LastActivityDate="2015-02-27T15:14:17.383" CommentCount="19" ContentLicense="CC BY-SA 3.0" />
  <row Id="18146" PostTypeId="2" ParentId="18144" CreationDate="2014-09-08T19:38:03.590" Score="2" Body="&lt;p&gt;If the assumption matches the actual data (the FFT length comes from shaft synchronous sampling, etc.) then it may be useful.  If the assumption is false, as it often is for a random audio frame, then false assumptions can produce false or misleading results.  For example, windowing artifacts (&quot;leakage&quot;) are often not actual spectral frequencies present in the longer audio stream.  An extended reconstruction with these artifacts would contain stuff not present in the actual longer audio stream.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-09-08T19:38:03.590" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18147" PostTypeId="1" CreationDate="2014-09-08T20:12:41.083" Score="0" ViewCount="88" Body="&lt;p&gt;What is the &lt;strong&gt;actual meaning of frequency&lt;/strong&gt;? what if the signal is aperiodic??&#xA;In general, we say that frequency means the repeatition of an event in unit time. But what about a speech signal? how can we say that a speech signal is having 4KHz Bandwidth(say)?&lt;/p&gt;&#xA;" OwnerUserId="11032" LastActivityDate="2014-09-11T03:14:47.780" Title="how can i get to know the frequency of a speech signal?" Tags="|image-processing|signal-analysis|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18148" PostTypeId="1" CreationDate="2014-09-08T20:43:14.990" Score="0" ViewCount="1073" Body="&lt;p&gt;I use the following code to calculate the fft of 1024 samples of a 200 Hz windowed sinusoid (code taken from aurio touch apple example app):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//take fft&#xA;vDSP_ctoz((DSPComplex *)input.data(), 2, &amp;amp;inputComplex, 1, mFftSize);&#xA;vDSP_fft_zrop(fftSetup, &amp;amp;inputComplex, 1, &amp;amp;output.complex, 1, log2n, FFT_FORWARD);&#xA;&#xA;//scale&#xA;float scale = 0.5 / mSize;&#xA;vDSP_vsmul(output.complex.realp, 1, &amp;amp;scale, output.complex.realp, 1, mFftSize);&#xA;vDSP_vsmul(output.complex.imagp, 1, &amp;amp;scale, output.complex.imagp, 1, mFftSize);&#xA;output.complex.imagp[0] = 0.0;&#xA;&#xA;//Convert the fft data to dB&#xA;//memset(output.mMagnitude, 0, sizeof(float) * mFftSize);&#xA;vDSP_zvmags(&amp;amp;output.complex, 1, output.mMagnitude, 1, mFftSize);&#xA;&#xA;//In order to avoid taking log10 of zero, an adjusting factor is added in to make the minimum value equal -128dB&#xA;//memset(output.mDecibel, 0, sizeof(float) * mFftSize);&#xA;vDSP_vsadd(output.mMagnitude, 1, &amp;amp;kAdjust0DB, output.mDecibel, 1, mFftSize);&#xA;Float32 one = 1;&#xA;vDSP_vdbcon(output.mDecibel, 1, &amp;amp;one, output.mDecibel, 1, mFftSize, 0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Taking the inverse fft results in the initial windowed waveform as expected. What's bothering me are the values in output.mMagnitude, I would expect it to be close to 1 at the 200 Hz bin, yet it's barely above 0. What am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My windowed sine (1024 samples range -1 to 1 at 200 Hz)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nppfr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Magnitude spectrum (512 bins from 0 to 1, all there is is this tiny bump at the 200Hz bin)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2Re1K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DB spectrum (-128 to 0, this seems appropriate)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RP8jf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11031" LastActivityDate="2014-09-08T20:43:14.990" Title="fft magnitude scaling" Tags="|fft|frequency-spectrum|magnitude|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18149" PostTypeId="2" ParentId="18147" CreationDate="2014-09-09T01:50:09.267" Score="1" Body="&lt;p&gt;A speech signal can contain a lot more than 4kHz bandwidth, however experiments showed that if you removed all but the spectrum below 3kHz (thus allowing the use of cheaper circuitry), it was still reasonably understandable by another human.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-09-09T22:38:50.280" LastActivityDate="2014-09-09T22:38:50.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18150" PostTypeId="1" CreationDate="2014-09-09T02:13:10.127" Score="2" ViewCount="1528" Body="&lt;p&gt;I have video with text which can be rotated in any direction. If I trained a neural network on images of each letter at all possible degrees of rotation, would it be possible to classify the characters accurately? Alternatively would another technique like HAAR, or KNN be better?&lt;/p&gt;&#xA;" OwnerUserId="8615" LastActivityDate="2014-12-11T23:12:28.897" Title="Using neural networks for rotation invariant OCR" Tags="|machine-learning|ocr|text-recognition|knn|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18151" PostTypeId="1" AcceptedAnswerId="18162" CreationDate="2014-09-09T04:09:36.607" Score="1" ViewCount="237" Body="&lt;p&gt;In short I'm recreating a program that reads 3 sinusoidal signals through an ADC performs some manipulations and then reproduces these signals through a DAC. In order to reproduce these signals I need the instantaneous phase of one of these manipulations. So I recreated a charge pump zero crossing pll in software. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why you would go to the trouble of working out the analogue loop filter transfer function, convert it to the z domain, when in software when I could just implement a program that reads the amount of samples between zeros, and the instantaneous phase is just.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(current sample#-last zero sample#)/(pi*(number of samples between zeroes))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I've obviously missed something, but I don't know what to google to find out what.&lt;/p&gt;&#xA;" OwnerUserId="11020" LastActivityDate="2014-09-10T23:06:01.767" Title="Software implemented PLLs for signal synchronization, why use them?" Tags="|pll|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18152" PostTypeId="2" ParentId="13119" CreationDate="2014-09-09T08:43:27.197" Score="1" Body="&lt;p&gt;Just &quot;eyeballing&quot; your signal, it looks like the interesting things are all down below 1Hz.  The peaks in your signal browser diagramm seem to be spaced at every 5 to 10 Seconds, which would be 0.1 to 0.2 Hz.  Your spectrum plot goes from zero to 25 Hz, and doesn't show anything really interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try zooming in on the spectrum and see what lies below 1 Hz.  Yo may well find that the signal itself lives down in the very low frequencies, and that separating the noise from the signal is as simple as using a low pass filter.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-09-09T08:43:27.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18153" PostTypeId="1" AcceptedAnswerId="18155" CreationDate="2014-09-09T10:37:29.080" Score="0" ViewCount="902" Body="&lt;p&gt;With the intention of converting a single rate LPF FIR filter to multi rate equivalent: what is the largest possible downsampling factor? I found one source that said it was the sampling frequency divided by the frequency at the centre of the transition band, but am seeking verification.&lt;/p&gt;&#xA;" OwnerUserId="11037" LastActivityDate="2014-09-09T10:49:40.477" Title="Largest possible downsampling factor" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18154" PostTypeId="1" AcceptedAnswerId="18156" CreationDate="2014-09-09T10:41:53.913" Score="0" ViewCount="70" Body="&lt;p&gt;I don't understand this: the HT works as it should but in an .AC simulation, the phase shows up like this (wrapped):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/y1cm7.png&quot; alt=&quot;HT phase&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why doesn't it look like a constant -90deg phase, like in a differentiator?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I39QZ.png&quot; alt=&quot;differentiator&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[edit]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing that also confuses me is that a regular low-pass FIR has the same phase, so does that mean the FIR also adds constant -90deg? Obviously not, and I can't see the explanation. Can someone please shed some light?&lt;/p&gt;&#xA;" OwnerUserId="10647" LastEditorUserId="10647" LastEditDate="2014-09-09T10:51:07.970" LastActivityDate="2014-09-09T13:30:28.160" Title="Hilbert transformer's phase in .AC simulation" Tags="|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18155" PostTypeId="2" ParentId="18153" CreationDate="2014-09-09T10:49:40.477" Score="4" Body="&lt;p&gt;There is not one correct answer to this question, other than the theoretical one which would be that the maximum downsampling factor $M$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M=\frac{f_s}{f_c}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_c$ is the highest frequency of the (ideally band-limited) signal. Since there's no ideally band-limited signal, it depends on the application how much aliasing can be tolerated. The frequency $f_c$ must be chosen as the frequency above which the signal (after low pass filtering) has no significant energy. What 'significant' means is determined by the application.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-09T10:49:40.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18156" PostTypeId="2" ParentId="18154" CreationDate="2014-09-09T10:55:03.623" Score="2" Body="&lt;p&gt;You have a linear phase because you probably implemented a causal filter. This just means that you have the desired phase shift of $-\pi/2$ plus a constant delay. The additional delay, which corresponds to a linear phase term, usually causes no problems. It is necessary to make the filter causal and therefore implementable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference between an FIR lowpass filter and a Hilbert transformer is the phase value at frequency zero: it should be zero for a lowpass filter, and $-\pi/2$ for a Hilbert transformer.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-09-09T13:30:28.160" LastActivityDate="2014-09-09T13:30:28.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18157" PostTypeId="2" ParentId="18144" CreationDate="2014-09-09T15:13:14.120" Score="8" Body="&lt;p&gt;Okay, I'm gonna expound a little.&lt;/p&gt;&#xA;&lt;p&gt;Quoting (except for any typos that may result) from the 1989 text of O&amp;amp;S (Introduction to Chapter 8, The Discrete Fourier Transform, p 514):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Although several points of view can be taken toward the derivation and interpretation of the DFT representation of a finite-duration sequence, we have chosen to base our presentation on the relationship between periodic sequences and finite-length sequences. We will begin by considering the Fourier series representation of periodic sequences.  While this representation is important in its own right, we are most often interested in the application of Fourier series results to the representation of finite-length sequences. We accomplish this by constructing a periodic sequence for which each period is identical to the finite-length sequence. As we will see, the Fourier series representation of the periodic sequence corresponds to the DFT of the finite-length sequence. Thus our approach is to define the Fourier series representation for periodic sequences and to study the properties of such representations. Then we repeat essentially the same derivations assuming that the sequence to be represented is a finite-length sequence. This approach to the DFT emphasizes the fundamental inherent periodicity of the DFT representation and ensures that this periodicity is not overlooked in applications of the DFT.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Section 8.1, p 516 on the DFS:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Eq. (8.11) &lt;span class=&quot;math-container&quot;&gt;$\quad \tilde{X}[k] = \sum\limits^{N-1}_{n=0} \tilde{x}[n] \ e^{-j2\pi n k/N} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Eq. (8.12) &lt;span class=&quot;math-container&quot;&gt;$\quad \tilde{x}[n] = \frac{1}{N} \sum\limits^{N-1}_{k=0} \tilde{X}[k] \ e^{+j2\pi n k/N} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Regarding the DFS, &lt;span class=&quot;math-container&quot;&gt;$\tilde{x}[n]$&lt;/span&gt; (with the tilde) is defined to be periodic with period &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$ \tilde{x}[n+N] = \tilde{x}[n] \quad \forall n $$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tilde{X}[k]$&lt;/span&gt; turns out to also be periodic with period &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (so &lt;span class=&quot;math-container&quot;&gt;$ \tilde{X}[k+N] = \tilde{X}[k] \quad \forall k $&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Later, in section 8.6, p 532 on the DFT:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Eq. (8.59) &lt;span class=&quot;math-container&quot;&gt;$\quad X[k] = \begin{cases} \sum\limits^{N-1}_{n=0} x[n] \ e^{-j2\pi n k/N}, &amp;amp; 0 \le k \le N-1 \\ 0, &amp;amp; \text{otherwise} \end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Eq. (8.60) &lt;span class=&quot;math-container&quot;&gt;$\quad x[n] = \begin{cases} \frac{1}{N} \sum\limits^{N-1}_{k=0} X[k] \ e^{+j2\pi n k/N}, &amp;amp; 0 \le n \le N-1 \\ 0, &amp;amp; \text{otherwise} \end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Generally the DFT analysis and synthesis equations are written as&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Eq. (8.61) &lt;span class=&quot;math-container&quot;&gt;$\quad X[k] = \sum\limits^{N-1}_{n=0} x[n] \ e^{-j2\pi n k/N} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Eq. (8.62) &lt;span class=&quot;math-container&quot;&gt;$\quad x[n] = \frac{1}{N} \sum\limits^{N-1}_{k=0} X[k] \ e^{+j2\pi n k/N} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In recasting Eqs. (8.11) and (8.12) in the form of Eqs. (8.61) and (8.62) for the finite-duration sequences, we have not eliminated the inherent periodicity. As with the DFS, the DFT &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; is equal to samples of the periodic Fourier transform &lt;span class=&quot;math-container&quot;&gt;$X(e^{j\omega})$&lt;/span&gt;, and if Eq. (8.62) is evaluated for values of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; outside the interval &lt;span class=&quot;math-container&quot;&gt;$0 \le n \le N-1$&lt;/span&gt;, the result will not be zero but rather a periodic extension of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;. The inherent periodicity is always present. Sometimes it causes us difficulty and sometimes we can exploit it, but to totally ignore it is to invite trouble.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So the first obvious thing i would say is that the tildes used for the DFS (to explicitly depict a periodic sequence) are symbols and &lt;strong&gt;still&lt;/strong&gt; do not change any mathematical fact.  The direct relationship between the periodic &lt;span class=&quot;math-container&quot;&gt;$\tilde{x}[n]$&lt;/span&gt; and the &lt;em&gt;&amp;quot;finite-length&amp;quot;&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \tilde{x}[n] = x[n \bmod N] \qquad \forall n \in \mathbb{Z}, \ N \in \mathbb{Z}&amp;gt;0$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ \qquad\qquad\qquad n \bmod N = n - N \left\lfloor \frac{n}{N} \right\rfloor  $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now I &lt;strong&gt;know&lt;/strong&gt; some folks will point to the Eqs. (8.59) and (8.60) definition of the DFT that has truncated (to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;) values outside of the interval &lt;span class=&quot;math-container&quot;&gt;$0 \le n,k \le N-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, that definition is contrived.  It could just as well be expressed as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\quad X[k] = \begin{cases}&#xA;\sum\limits^{N-1}_{n=0} x[n] \ e^{-j2\pi n k/N}, &amp;amp; 0 \le k \le N-1 \\&#xA;5, &amp;amp; \text{otherwise}&#xA;\end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\quad x[n] = \begin{cases}&#xA;\frac{1}{N} \sum\limits^{N-1}_{k=0} X[k] \ e^{+j2\pi n k/N}, &amp;amp; 0 \le n \le N-1 \\ 5, &amp;amp; \text{otherwise} &#xA;\end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\quad X[k] = \begin{cases}&#xA;\sum\limits^{N-1}_{n=0} x[n] \ e^{-j2\pi n k/N}, &amp;amp; 0 \le k \le N-1 \\&#xA;5000, &amp;amp; \text{otherwise}&#xA;\end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\quad x[n] = \begin{cases}&#xA;\frac{1}{N} \sum\limits^{N-1}_{k=0} X[k] \ e^{+j2\pi n k/N}, &amp;amp; 0 \le n \le N-1 \\ 5000, &amp;amp; \text{otherwise} &#xA;\end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\quad X[k] = \begin{cases}&#xA;\sum\limits^{N-1}_{n=0} x[n] \ e^{-j2\pi n k/N}, &amp;amp; 0 \le k \le N-1 \\&#xA;\text{the man on the moon}, &amp;amp; \text{otherwise}&#xA;\end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\quad x[n] = \begin{cases}&#xA;\frac{1}{N} \sum\limits^{N-1}_{k=0} X[k] \ e^{+j2\pi n k/N}, &amp;amp; 0 \le n \le N-1 \\ \text{and his hot girlfriend}, &amp;amp; \text{otherwise} &#xA;\end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because that &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; in that contrived DFT definition will &lt;strong&gt;never ever&lt;/strong&gt; be used in any theorems regarding the DFT.  When that contrived definition is used for the DFT, then when using &lt;em&gt;any&lt;/em&gt; DFT theorems to do any real work (other than the linearity and scaling by constant theorems), then one &lt;strong&gt;must&lt;/strong&gt; use modulo arithmetic in the arguments of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;.  And using that modulo arithmetic is &lt;strong&gt;explicitly&lt;/strong&gt; periodically extending the sequence.&lt;/p&gt;&#xA;&lt;p&gt;So (sorta responding to hotpaw) there are two or three processes that you should think about when using the DFT on a real signal.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;The sampling process:&lt;/strong&gt; what happens to the spectrum of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; when you sample it with a &amp;quot;dirac comb&amp;quot; or whatever you want to call the sampling function?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Windowing to finite length:&lt;/strong&gt; what happens when you window either &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; or the sampled version, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, with a rectangular window of length &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Periodic extension:&lt;/strong&gt; what happens when you periodically extend it by repeatedly shifting the windowed &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples and overlap and add it?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Deal with each step by itself.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-05-24T15:16:11.167" LastActivityDate="2023-05-24T15:16:11.167" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="18159" PostTypeId="1" AcceptedAnswerId="18165" CreationDate="2014-09-09T23:58:23.920" Score="2" ViewCount="120" Body="&lt;p&gt;In paper: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A. Vlad, A. Luca, and M. Frunzete, &quot;&lt;em&gt;Computational measurements of the&#xA;  transient time and of the sampling distance that enables statistical&#xA;  independence in the logistic map&lt;/em&gt;,&quot; in Proc. Int. Conf. Computational&#xA;  Science and its applications, Berlin, 2009, pp. 703-718&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;it is mentioned that for a time series $X = \{x_k,x_{k+1},\ldots,x_{k+n},\ldots\}$, $x_n$ and $x_{k+d}$ are statistically independent when $d \rightarrow \infty$ where $d$ is an integer denoting the sampling distance.&#xA;Let's say $d = 5$, then for a time series that is generated by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_{k+1} = Rx_k(1-x_k) \tag{1}$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the the parameter $R$ enables chaotic behavior. The distribution is not Gaussian and the Authors performed Kolmogorov-Smirnov test based for showing statistical independence. Quote : pg: 705&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This test method is here required because the investigated random variables are not normally distributed, they are even of unknown statistical law. For&#xA;      each and every investigated $R$ value we used Smirnov tests to verify if two experimental data sets are coming out from the same probability law or not.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;EDIT: Sampling distance as defined in paper &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Vlad, Adriana, Adrian Luca, and Madalin Frunzete. &quot;Computational measurements of the transient time and of the sampling distance that enables statistical independence in the logistic map.&quot; Computational Science and Its Applications–ICCSA 2009. Springer Berlin Heidelberg, 2009. 703-718.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(direct Quote)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The two random variables $X$ and $Y$ submitted to the&#xA;      statistical test are sampled from the random process assigned to (1) at two iterations $k_1$ and $k_1 + d$. We attempted to measure the minimum sampling distance&#xA;      $d$ which enables the statistical independence between $X$ and $Y$. &#xA;      We wanted to establish which is the minimum $d$ sampling distance which enables to accept that two random variables,&#xA;      $X$ and $Y$ extracted from the random&#xA;      process (1) at  iterations are statistically independent. Our measurements bring into evidence that the minimum&#xA;      $d$ statistical independence distance is affected by&#xA;      $R$ parameter. The overall experimental study performed&#xA;      on all mentioned values of&#xA;      $R$ parameter (4; 3.9999; 3.999; 3.99; 3.95; 3.9; 3.8; 3.78) indicates that&#xA;      d minimum sampling distance is about: 15 iterations for R = 4; 20 iterations for R =3.9999 and R = 3.999; 30 iterations for R =3.99 (etc). The statistical independence distance is important in practice mainly for the stationarity region of the chaotic map, so that the quantitative results are not dependent on the initial distribution law of the chaotic process. Referring to the overall results, we can say that for initial conditions $x_0$ (for generating the random process in (1)) is uniformly distributed in (0,1) interval, a value of about 40-50 iterations is quite enough to ensure both the transient time (the time  interval elapsed from an initial condition of the chaotic signal up to its entrance in stationarity) and the minimum statistical independence sampling distance for all R investigated values.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In Paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Yu, Lei, et al. &quot;Compressive sensing with chaotic sequence.&quot; Signal Processing Letters, IEEE 17.8 (2010): 731-734.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://hal.inria.fr/docs/00/53/00/58/PDF/RIPCHAOS_V_final_2cols.pdf&quot; rel=&quot;nofollow&quot;&gt;download link&lt;/a&gt;, under Section C and Remark 2.2: it is mentioned that the output of (1) is not independent but its independence can be measured through higher order correlations which is determined by the sampling distance. If the sampling distance is chosen large enough, for distance $d$ = 15, then for any positive integer $m_0$, $m_1 &amp;lt; 2^d$, $X$ has&#xA; $E(x_k^{m_0} x_{k+d}^{m_1}) = E(x_k^{m_0}) E(x_{k+d}^{m_1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on this, I have the following question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: Can somebody please show with an example time series vector what is meant by sampling distance? Will a sampling distance of say $d = 5$ mean that the resulting sampled time series, say $Z$ will have data points taken after every 5 samples?&#xA;For example, if $X$ is represented as $X = \{x_n,x_{n+1},\ldots,x_{n+k},\ldots\}$ and $Z = \{z_n,z_{n+d},\ldots,z_{n+kd}\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that from equation 1  $$X = [x_1,\, x_2,\, x_3,\, x_4,\, x_5,\, x_6,\, x_7,\, x_8,\, x_9,\, x_{10},\, x_{11},\, x_{12},\, x_{13},\, x_{14},\, x_{15},\, x_{16},\, x_{17},\, x_{18},\, x_{19},\, x_{20}]$$&#xA;then will $Z$ be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Z = [x_6,\, x_7,\, x_8,\, x_9,\, x_{10},\, x_{16},\, x_{17},\, x_{18},\, x_{19},\, x_{20}]$$&lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="4298" LastEditDate="2014-09-10T17:15:26.660" LastActivityDate="2014-09-10T17:30:12.013" Title="Sampling distance" Tags="|sampling|terminology|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18160" PostTypeId="1" AcceptedAnswerId="18161" CreationDate="2014-09-10T09:58:07.360" Score="0" ViewCount="6369" Body="&lt;p&gt;I am having difficulty in developing an algorithm for checking if a given system is time invariant or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let there be 2 systems with input output relation given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=x(t-2)$$ or $$ y(t)=tx(t-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the first system is time invariant whereas the second one is not. But how do I write a function in MATLAB that would take the input output relationship and find out if the system is time invariant or not.&lt;/p&gt;&#xA;" OwnerUserId="11018" LastEditorUserId="235" LastEditDate="2014-09-10T13:05:54.657" LastActivityDate="2017-04-19T20:01:02.283" Title="Check for time invariance of a _system_ using MATLAB?" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18161" PostTypeId="2" ParentId="18160" CreationDate="2014-09-10T11:06:59.570" Score="1" Body="&lt;p&gt;You can't do that. What you can do is write a function that computes the output given the input signal, then shifts the input signal (the shift could be an input parameter), and then checks if the output signal is a shifted version of the original output signal. If this is NOT the case, then you know that the system is time varying. However, if the output signal is just a shifted version of the original output signal then you don't know anything, because you would need to try all possible (i.e. infinitely many) shifts (and all possible input signals) and verify this condition for all these cases. Only after having checked infinitely many shifts (and all possible input signals) would you be able to assert that the system is indeed time-invariant.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-09-10T11:12:23.567" LastActivityDate="2014-09-10T11:12:23.567" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18162" PostTypeId="2" ParentId="18151" CreationDate="2014-09-10T14:44:22.653" Score="5" Body="&lt;p&gt;For very high SNR signals locating the zero crossings will work pretty well.  You use PLL's when the signal doesn't have a high SNR, like the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wVbMv.png&quot; alt=&quot;Noisy sinusoid&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see by inspection, a zero-crossing algorithm wouldn't have a prayer of working on this signal.  A PLL, on the other hand, could do just fine.  That is, by the way, a tone with an SNR of 8 dB.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-09-10T14:44:22.653" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18164" PostTypeId="1" AcceptedAnswerId="31376" CreationDate="2014-09-10T17:07:28.410" Score="15" ViewCount="14981" Body="&lt;p&gt;Consider how the Hanning window is defined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.5 - 0.5 * cos(n*2*Pi/(N-1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By this definition, it has a gain of 0.5, which is simply the average value of the coefficients. By contrast, Flattop windows, as defined, have unity gain, presumably by design. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would seem appropriate to scale the Hanning window by a factor of 2, but I have never seen this discussed anywhere. It would seem that all windows should be scaled for unity gain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, are windows typically corrected for their gain?  If not, why not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since nobody has given an answer, I'll elaborate a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is quite easy to find papers that report the gain of the more common windows. But nowhere have I seen anyone refer to correcting the gain before using it for spectral analysis. Maybe I have always missed that statement, or everyone assumes gain correction to be an obvious requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like common sense to set the gain of a window to unity so that signal's energy level is preserved. Furthermore, how can one compare the various windows for amplitude accuracy if one has 0 dB gain, as a flattop does, and the other has nearly 10 dB loss, as the Gauss does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windows are also widely used for FIR filter design. In this application, it should be clear that the signal to be windowed, a sinc pulse, has most of its energy in the center of the window. Consequently, the window does little to reduce the sinc pulse's total energy. Thus, when used for filter design, we don't want unity gain, but rather unity peak amplitude, as most windows have, except the flattops. Something other than unity peak amplitude would affect the gain of the resulting FIR filter.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastEditorUserId="5108" LastEditDate="2014-09-13T15:12:33.387" LastActivityDate="2016-06-08T07:13:17.133" Title="Is it customary to correct for the gain of a window?" Tags="|fft|window-functions|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18165" PostTypeId="2" ParentId="18159" CreationDate="2014-09-10T17:30:12.013" Score="1" Body="&lt;p&gt;The authors you mention don't talk about a &quot;resulting time series&quot;, but only about the correlation of two random variables (or their powers) of the original sequence $X$. They consider the expectation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{x^{m_0}_nx^{m_1}_{n+d}\}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and discuss for which values of $d$ (the sampling distance) (and of $m_0$ and $m_1$) the expectation in (1) equals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{x^{m_0}_n\}E\{x^{m_1}_{n+d}\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e., for which values of $d$ and of $m_0$ and $m_1$ the variables (not sequences!) $x_n^{m_0}$ and $x_{n+d}^{m_1}$ are uncorrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think your confusion arose because you thought that $x_n$ and $x_{n+d}$ refer to sequences, when in fact they refer to the $n^{th}$ and $(n+d)^{th}$ values of the sequence $X$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-10T17:30:12.013" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18166" PostTypeId="1" CreationDate="2014-09-10T18:26:14.203" Score="-1" ViewCount="1559" Body="&lt;p&gt;I have a signal with half-amplitude $A$ and period $T$ and I want to calculate the average power of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I remember the power of a signal $x(t)$ to be $$\frac{1}{T}\int_{0}^{T}|x(t)|^2dt$$ but how do I apply this to a square wave?&lt;/p&gt;&#xA;" OwnerUserId="11049" LastEditorUserId="11049" LastEditDate="2014-09-10T18:45:33.780" LastActivityDate="2014-09-12T02:21:23.147" Title="Power of a square wave signal" Tags="|wave|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18167" PostTypeId="1" CreationDate="2014-09-10T19:42:34.880" Score="1" ViewCount="491" Body="&lt;p&gt;From my understanding of Fourier transform, a Fourier transform of a signal in time domain will give the different frequency components of the signal in frequency domain, specified by their contributions(energies) in the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of rectangular function is a sinc function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I take Fourier transform of two different rectangular pulses, with width w1 and w2, with w1&gt;w2, the sinc function of one width w1 is narrow and has large peak as compared to the one with width w2(wider and smaller peak). How do I intuitively understand this behavior?&lt;/p&gt;&#xA;" OwnerUserId="11051" LastActivityDate="2015-01-09T04:38:28.107" Title="intuitive interpretation Fourier Transform of two different Rectangular pulses" Tags="|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18168" PostTypeId="1" CreationDate="2014-09-10T20:13:34.370" Score="5" ViewCount="904" Body="&lt;p&gt;I have data that looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/RBbfN.png&quot; alt=&quot;Data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes the data has a higher point in the middle of the shallow slope&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mXr7I.png&quot; alt=&quot;Data with peak in shallow slope&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find a way to filter the data such that it smooths it and leaves the first rising edge as the peak like so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TxL1c.png&quot; alt=&quot;Ideal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a weighted average a good way to achieve this? or would that not do the trick? Are there better methods&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now i have been using a weight average to smooth it but it leaves me with a peak in the center of the slope instead of towards the rising edge.&lt;/p&gt;&#xA;" OwnerUserId="10943" LastActivityDate="2016-02-06T09:57:38.570" Title="Filtering data so that only rising edge is left" Tags="|filters|smoothing|peak-detection|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18169" PostTypeId="2" ParentId="18167" CreationDate="2014-09-10T22:00:22.567" Score="1" Body="&lt;p&gt;Note that the peak height of the Fourier transform of a wider rectangular function is proportionally higher.  This is necessary to preserve total energy, as per Parseval's theorem.  However, the energy required to create the sharp edges of a rectangle in the time domain is still out there on the tails of the Sinc function in the frequency domain, roughly the same (but more wiggly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when you scale the vertical axis of 2 plots so that they have the same peak height, the envelope of the FT of a wider rect function &lt;strong&gt;looks&lt;/strong&gt; narrower in the plots of that transform.  But that's only in relation to the peak with a scaling applied.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-09-10T22:06:05.430" LastActivityDate="2014-09-10T22:06:05.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18172" PostTypeId="1" AcceptedAnswerId="18173" CreationDate="2014-09-11T01:47:43.190" Score="1" ViewCount="277" Body="&lt;p&gt;I have a question: Do DCT each output coefficients have to be orthogonal?&#xA;Here DCT is DCT-II type. It is used by the jpeg compression algorithm.&lt;/p&gt;&#xA;" OwnerUserId="10979" LastEditorUserId="5662" LastEditDate="2014-09-11T02:37:53.433" LastActivityDate="2014-09-11T02:41:33.320" Title="Do DCT each output coefficients have to be orthogonal?" Tags="|dct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18173" PostTypeId="2" ParentId="18172" CreationDate="2014-09-11T02:41:33.320" Score="0" Body="&lt;p&gt;It doesn't have much meaning to ask if the coefficients are orthogonal. If you do a 1-d DCT transform then you get a 1-d vector as output. You need at least two vectors to talk about orthogonality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DCT transform however, is an orthogonal transform. This means that there exists an orthogonal matrix that transforms the input data into the dct coefficients.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-09-11T02:41:33.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18174" PostTypeId="2" ParentId="2584" CreationDate="2014-09-11T03:09:22.827" Score="-2" Body="&lt;p&gt;Try NCH Software&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;http://en.wikipedia.org/wiki/NCH_Software&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;NCH Software is a software development company founded in 1993 in&#xA;  Canberra, Australia. The Colorado office was started in April 2008 due&#xA;  to the large U.S. customer base. NCH Software primarily sells to&#xA;  individuals via their website.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And further&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Browser Toolbar&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;During the installation process NCH Software also by default (but you&#xA;  can uncheck the option during install) installs Google Chrome. This&#xA;  can be unselected during install or removed after install. In older&#xA;  versions of their software a browser toolbar powered by Conduit,[11]&#xA;  was installed as well as making changes to the default homepage and&#xA;  search engine.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="11053" LastEditorUserId="1606" LastEditDate="2014-09-11T07:19:41.993" LastActivityDate="2014-09-11T07:19:41.993" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18175" PostTypeId="2" ParentId="18147" CreationDate="2014-09-11T03:14:47.780" Score="1" Body="&lt;p&gt;You are right that the only thing that has a frequency of 4 kHz is a 4 kHz sine wave. We don't say that a speech signal has a particular frequency. Instead, we say that the energy of the speech signal is spread over various frequencies. We use the Fourier transform to decompose the energy of a speech signal across various frequencies. This is visualized by way of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;nofollow&quot;&gt;spectrogram&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-09-11T03:14:47.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18176" PostTypeId="2" ParentId="18150" CreationDate="2014-09-11T03:19:45.403" Score="0" Body="&lt;p&gt;If you can find the center of the text then you can apply a polar transform to get a feature where rotations in the input become translations in the feature space. That might be easier to work with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can choose what type of symbol you are using as a marker and it doesn't have to be a letter, consider using a rotationally invariant symbol. You can make lots of patterns from rings and circles that would appear the same from every rotation angle.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-09-11T03:19:45.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18178" PostTypeId="1" CreationDate="2014-09-11T09:14:20.740" Score="1" ViewCount="82" Body="&lt;p&gt;I want to detect multiple rectangles in a video, each of which features a different content, but running simultaneously. This is typically seen during debates on news channels. For example, in the image below, there are 5 rectangles (each containing a person) that are of interest to me and I want to keep a track of them. I am planning to use C++ and OpenCV. Any help will be appreciated.&#xA;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ouz0I.jpg&quot; alt=&quot;Frame&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11054" LastActivityDate="2014-09-11T09:14:20.740" Title="Detecting inset images/videos from a video" Tags="|image-processing|video-processing|face-detection|video-compression|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18180" PostTypeId="1" CreationDate="2014-09-11T13:15:28.790" Score="0" ViewCount="262" Body="&lt;p&gt;As we know, a complex analytic signal can be obtained through Fourier transformation of a real value function, and the imaginary part can be reconstructed by Hilbert transform of real part. But I have simulated a real value function using Matlab and performance FFT on it, the imaginary part obtained through FFT is very different from that obtained through Hilbert transformation of real part, Does anyone know why.  &lt;/p&gt;&#xA;" OwnerUserId="11055" LastEditorUserId="4298" LastEditDate="2014-09-11T16:25:26.660" LastActivityDate="2015-10-07T21:03:12.287" Title="The error between the theoretical value and the simulation value of imaginary part of the FFT results" Tags="|matlab|fft|hilbert-transform|analytic-signal|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18181" PostTypeId="2" ParentId="18168" CreationDate="2014-09-11T14:18:12.410" Score="2" Body="&lt;p&gt;You could use a median filter like Matt suggested. Or, if you are sure your data will always look like the third image, then you can use it as a template and &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;correlate&lt;/a&gt; it with the test signal. You can come up with some measure as to how far away from the correlated peaks is your actual ascent point in template, and use the same for rest of the correlated peaks. &lt;/p&gt;&#xA;" OwnerUserId="11050" LastActivityDate="2014-09-11T14:18:12.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18182" PostTypeId="2" ParentId="18180" CreationDate="2014-09-11T15:36:20.830" Score="1" Body="&lt;p&gt;Judging from your question, I think that you're confusing two related but different Hilbert relations. The first one holds for &lt;em&gt;causal signals&lt;/em&gt;, for which the real and imaginary parts of their Fourier transforms are related via the Hilbert transform. The other one holds for &lt;em&gt;analytic signals&lt;/em&gt; (whose spectrum is zero for negative frequencies), for which the real and imaginary parts of the time domain signal are related via the Hilbert transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you have a real valued function, as described in your question, and you take its Fourier transform, then the imaginary part of the Fourier transform can only be obtained from its real part via the Hilbert transform, if the signal is causal. Also note that the corresponding time domain signal is generally not analytic (because in that case its spectrum must be zero for negative frequencies and, consequently, the time domain signal must be complex-valued).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-11T15:36:20.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18183" PostTypeId="1" CreationDate="2014-09-10T15:01:21.637" Score="4" ViewCount="264" Body="&lt;p&gt;I need to perform a deformable image registration (DIR) for delineation of the different brain parts on the brain MRI 3D image. I faced with a problem that there are a lot of different approaches for solving this problem while I don't have enough experience to choose the right approach. First off I tried a lot of different algorithms from the itk library. After that I made several conclusions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Affine registration is not appropriate for general case of this problem (I mean I always can find such examples that require not affine transformation for proper registration).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) All itk cpu based algorithms for DIR takes at least several minutes to get the appropriate results. The only way to reduce this time is to use gpu based algorithms. (I use 256*256 and 512*512 T1 images)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Demons algorithm is really good approach for solving the general purpose registration, I just need to find the right parameters and number of iterations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are this conclusions right? &#xA;What other fast algorithms for DRI can you suggest? (I have found such algorithms as 6 types of Demon's, SG-LDDMM, IC-LDDMM, BSpline and fluid registration, but I can't find out do they really efficient for solving my problem)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.&#xA;I would appreciate any links for gpu based source code for DRI.&lt;/p&gt;&#xA;" OwnerDisplayName="Stepan Loginov" LastActivityDate="2014-09-11T17:36:23.187" Title="Algorithms for deformable image registration" Tags="|algorithms|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18184" PostTypeId="2" ParentId="18183" CreationDate="2014-09-11T14:24:53.530" Score="2" Body="&lt;p&gt;Like Paul suggested, you may want to ask this question at the signal processing stackexchange as well. They may be able to provide you with more information. I am at best a talented amateur in the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start with the biggest problem in image registration: &lt;strong&gt;there is no catch-all algorithm that just works for everything&lt;/strong&gt;. Results are heavily dependent on image modality, site and also what you wish to use it for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily for you, brain mri is a fairly standard application. I would have a look at &lt;a href=&quot;http://elastix.isi.uu.nl/index.php&quot; rel=&quot;nofollow&quot;&gt;elastix&lt;/a&gt;, which is ITK based and used quite a bit at my department. It also has a &lt;a href=&quot;http://elastix.bigr.nl/wiki/index.php/Parameter_file_database&quot; rel=&quot;nofollow&quot;&gt;nice database&lt;/a&gt; of parameter files for different applications, including several for brain mri. A quick glance reveals that most use B-spline registration for the brain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have mainly used registration for lung, where my personal experience was that Demons performed best. Note that Demons is NOT one single algorithm, although it is often presented as such. Rather it's a plethora of variations of the same basic idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, some commercial software has registration algorithms that perform very well for specific applications. If you're associated with a hospital, ask researchers at your radiology or oncology department if they have access to something that works well. &lt;/p&gt;&#xA;" OwnerUserId="10731" OwnerDisplayName="LKlevin" LastActivityDate="2014-09-11T14:24:53.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18187" PostTypeId="2" ParentId="18183" CreationDate="2014-09-11T17:36:23.187" Score="2" Body="&lt;p&gt;It is likely that Demons algorithm is the correct approach to take, there is quite extensive research into using it for medical image registration so you should not have too much difficulty finding papers relating to your problem.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What other fast algorithms for DRI can you suggest? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A step up from affine registration is polynomial registration. You can essentially generalise affine transformations to polynomial transformations with a pretty negligible difference in performance. These approaches are typically implemented as matrix operations which are extremely fast, so if performance is a priority they are worth investigating.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I would appreciate any links for gpu based source code for DRI&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would recommend solving your problem at a high level and subsequently optimising it based on your requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you provide more details about your problem domain it will be easier to provide recommendations, DRI and related fields often require a lot of fine tuning based on the specific problem being solved.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2014-09-11T17:36:23.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18188" PostTypeId="1" AcceptedAnswerId="18189" CreationDate="2014-09-11T17:59:50.507" Score="0" ViewCount="201" Body="&lt;p&gt;Suppose I have a DFT matrix $F$ of dimensions $N \times N$ where $N$ is a power of $2$. I convert it into a unitary matrix $\displaystyle U = \frac{F}{\sqrt{N}}$ and compute $S = U^* U^* $. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S$ seems to have a pattern. $S$ has at most one $1$ per row. Applying $S$ on my $N$-sample signal $x$ essentially provides me either a permutation of $x$(if $N$ is an even power of $2$) or a subset of $x$(if $N$ is odd power of $2$). &lt;em&gt;By subset, the length of $x$ remains the same, but some of the elements get truncated to $0$&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Translated to MATLAB code for $N=8$,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=8;&#xA;F = dftmtx(N);&#xA;U = F/sqrt(N);&#xA;S=ctranspose(U)*ctranspose(U);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$S$ above looks like the following:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/grNxM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is the following: Given $N$, can I determine how to pick elements of $x$ without having to resort to multiplying by $S$ ? (For the curious, let's say the matrix multiplication is expensive for my situation). &lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="4515" LastEditDate="2014-09-11T18:18:44.710" LastActivityDate="2014-09-11T18:20:02.427" Title="Determining effect of powers of DFT matrix conjugate on input without multiplying" Tags="|matlab|fft|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18189" PostTypeId="2" ParentId="18188" CreationDate="2014-09-11T18:14:40.583" Score="0" Body="&lt;p&gt;In both cases (odd and even powers of 2) you should get as a result simply a time inversion of your original signal. Because of the implicit periodicity you get from the original vector&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[x_1,x_2,x_3,\ldots,x_N]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the following time-inverted (and periodically continued) vector&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[x_1,x_N,x_{N-1},\ldots,x_2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an 'odd power' example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=8;F=dftmtx(N);U=F/sqrt(N);&#xA;x=[1 2 3 4 5 6 7 8]';&#xA;y=U'*U'*x;&#xA;y =&#xA;&#xA;1.00000 - 0.00000i&#xA;8.00000 + 0.00000i&#xA;7.00000 + 0.00000i&#xA;6.00000 - 0.00000i&#xA;5.00000 + 0.00000i&#xA;4.00000 + 0.00000i&#xA;3.00000 + 0.00000i&#xA;2.00000 - 0.00000i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-09-11T18:20:02.427" LastActivityDate="2014-09-11T18:20:02.427" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18192" PostTypeId="1" CreationDate="2014-09-12T00:48:28.810" Score="2" ViewCount="10589" Body="&lt;p&gt;I'm trying to determine whether or not a system with impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h(t) = \sum_{n=-\infty}^{\infty} \delta(t-2n)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is BIBO stable. I haven't touched this material for a very long time -- could anyone lend a helping hand? I recall needing to show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{-\infty}^{\infty} |h(t)| \, dt &amp;lt; \infty,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but $h(t)$ is defined in a very weird way, and calculating the integral is proving to be difficult.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT: Does the following argument seem reasonable? Since were summing an infinite number of $\delta$ functions, each will have an argument of $0$ for some unique value of $t$. Thus, there are infinitely many values of $t$ for which $\delta(t-2n)=1$, so the integral diverges.&lt;/p&gt;&#xA;" OwnerUserId="11060" LastActivityDate="2014-09-12T20:56:22.870" Title="Determining whether or not a system is BIBO stable" Tags="|impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18193" PostTypeId="2" ParentId="18192" CreationDate="2014-09-12T01:23:12.720" Score="1" Body="&lt;p&gt;Hint:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simplify the expression from the inside outward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, look at $|h(t)|$. Does $h(t)$ ever go negative? Can you simplify the absolute value expression?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you do that, your argument works. There are several ways of evaluating this integral. One of them is to show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lim_{N\rightarrow \infty} \int^N_{-N}\left( \sum_{n=-\infty}^{\infty}\delta(t-2n) \right)dt \rightarrow \infty.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As $N$ grows large, you're capturing more and more impulses under the integral.&lt;/p&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2014-09-12T20:56:22.870" LastActivityDate="2014-09-12T20:56:22.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18194" PostTypeId="2" ParentId="18166" CreationDate="2014-09-12T02:21:23.147" Score="1" Body="&lt;p&gt;Hint:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the absolute value of a square wave? Once you get that, the integral becomes very easy.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2014-09-12T02:21:23.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18195" PostTypeId="1" AcceptedAnswerId="18197" CreationDate="2014-09-12T03:40:05.293" Score="4" ViewCount="763" Body="&lt;p&gt;How would you compare the SNR gain from a longer FFT (more samples) to overlapping FFTs? Given the choice, which one would you pick and why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: Suppose you have 2048 samples of a signal. Assuming the sampling rate divided by the fundamental frequency is an integer, compare/constrast the SNR gain/noise variance reduction of the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A single 2048 point FFT.&lt;/li&gt;&#xA;&lt;li&gt;16, 128 point FFTs added coherently.&lt;/li&gt;&#xA;&lt;li&gt;16, 128 point FFTs added incoherently.&lt;/li&gt;&#xA;&lt;li&gt;24, 128 point FFTs (50% overlap), added incoherently.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2014-09-15T04:39:56.867" LastActivityDate="2021-03-19T17:11:52.027" Title="Compare Overlapping FFTs to a longer FFT" Tags="|matlab|fft|snr|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18196" PostTypeId="2" ParentId="18192" CreationDate="2014-09-12T07:08:28.117" Score="2" Body="&lt;p&gt;In your case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}|h(t)|dt=\int_{-\infty}^{\infty}h(t)dt=&#xA;\int_{-\infty}^{\infty}\sum_{n=-\infty}^{\infty}\delta(t-2n)dt=&#xA;\sum_{n=-\infty}^{\infty}\int_{-\infty}^{\infty}\delta(t-2n)dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}\delta(t-2n)dt=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(as correctly pointed out by Dilip Sarwate in his comment to Phonon's answer), the above sum is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}1=1+1+1+\ldots=\infty$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that this is basically the argument you gave in your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-09-12T09:57:37.580" LastActivityDate="2014-09-12T09:57:37.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18197" PostTypeId="2" ParentId="18195" CreationDate="2014-09-12T11:44:40.313" Score="2" Body="&lt;p&gt;That depends on your application, signal and noise.&lt;br&gt;&#xA;Increasing the FFT length means better frequency resolution.&lt;br&gt;&#xA;It can be shown that the FFT of a zero-mean white noise is also white noise.&#xA;Now, given that observation, this is the motivation to performing multiple shorter FFTs since the noise averages and its variance decreases by a factor of the number of FFTs.&lt;br&gt;&#xA;For a stationary signal, e.g. a sine wave, the FFT should not (theoretically) change over time. Thus, averaging would have no effect. So in this case, since the noise decreases, you should expect a gain in SNR by a factor of the number of FFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, one should also take into account the scalloping loss (or &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot; rel=&quot;nofollow&quot;&gt;spectral leakage&lt;/a&gt;) which can reduce the SNR significantly, and choose the FFT length correctly, according to the application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I always use overlapping if possible.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-09-12T11:44:40.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18200" PostTypeId="1" AcceptedAnswerId="18202" CreationDate="2014-09-12T17:54:20.007" Score="0" ViewCount="77" Body="&lt;p&gt;Like the title says...&#xA;I want to split audio file where a single instrument is played (not so fast)...&#xA;I just need to detect the attack phase of the waveform to know where a played note begins. Can someone suggest a way to do this? It should be robust, not to react to isolated peaks...&#xA;If there are open source implementations please share.... or even pseudocode is fine ?&#xA;Cheers&lt;/p&gt;&#xA;" OwnerUserId="10789" LastActivityDate="2014-09-13T11:27:39.287" Title="Segmenting a sound file before each of its attacks" Tags="|audio|sound|segmentation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18201" PostTypeId="1" CreationDate="2014-09-13T08:12:03.870" Score="6" ViewCount="1690" Body="&lt;p&gt;The &lt;a href=&quot;http://www.lia.ufc.br/~rafaelstv/pdi/FFT_Cooley_Tukey.pdf&quot; rel=&quot;noreferrer&quot; title=&quot;seminal paper of Cooley and Tukey&quot;&gt;seminal paper of Cooley and Tukey&lt;/a&gt;  provides an iterative method for computing the DFT for a sequence of length $N$. Specifically, they mention a method which utilizes the fact that $N$ can be written as $N = r_1 r_2$. The two intermediate results during computations themselves are DFT computations, therefore, their computation in turn can be recursively estimated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a reference/method of recursive formulation for computing DFT using the $N=r_1 r_2$ factorization ?  The versions of FFT I come across use factorizations where $r_1 = \frac{N}{2}$ and $r_2=2$. I would like to know if there are recursive formulations for general factorization of $N$.&lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="4515" LastEditDate="2014-09-13T08:55:53.913" LastActivityDate="2022-01-07T23:21:03.533" Title="Recursive version of DFT as presented in Cooley-Tukey paper" Tags="|fft|dft|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18202" PostTypeId="2" ParentId="18200" CreationDate="2014-09-13T11:27:39.287" Score="0" Body="&lt;p&gt;If it is a single instrument playing without any background noise/instruments, then the problem becomes simple. All you have to do is keep track of energy, which is calculated at a defined window size (say 40 milliseconds). Wherever you see the energy increasing and sustaining for a while (you'll have to define how long a note is good for you to split your audio), you can mark the ascent of such an energy plot as the point to split. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also split audio when a particular note is played, for this you'll have to track energy in the respective spectrum band of the note you want to split the audio on. For example to track note A4 (a') which has 440Hz frequency. You might have to track the energy in a band around 440 Hz, say 420 to 460 Hz. Mind you, this splitting business based on notes played gets more complicated when complex notes are played.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this problem gets really difficult when you have multiple instruments.&lt;/p&gt;&#xA;" OwnerUserId="11050" LastActivityDate="2014-09-13T11:27:39.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18203" PostTypeId="2" ParentId="18164" CreationDate="2014-09-13T15:25:31.013" Score="1" Body="&lt;p&gt;one way of &lt;em&gt;&quot;correcting the gain of a window&quot;&lt;/em&gt; is to do that in the definition of the window.  what would this mean?  correcting the gain &lt;em&gt;where&lt;/em&gt;? at &lt;em&gt;which&lt;/em&gt; frequency?  at DC?  if you're correcting the gain, at DC, of a window, it means that all coefficients add to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sum\limits^{+\infty}_{n=-\infty} w[n] = 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \int\limits^{+\infty}_{-\infty} w(t) \ dt = 1 $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-09-13T15:25:31.013" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18206" PostTypeId="2" ParentId="14471" CreationDate="2014-09-14T20:41:32.500" Score="2" Body="&lt;p&gt;Jason R's answer is correct, but a little more information is needed in order to know how to apply it specifically to FDLS. That information may be found here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://groups.google.com/forum/?hl=en#!original/comp.dsp/qgYsnf5aIXs/NSg6VSXhkqoJ&quot; rel=&quot;nofollow&quot;&gt;https://groups.google.com/forum/?hl=en#!original/comp.dsp/qgYsnf5aIXs/NSg6VSXhkqoJ&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using my MATLAB code for FDLS, then you will have to modify it as indicated in that link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Greg Berchin&lt;/p&gt;&#xA;" OwnerUserId="11085" LastActivityDate="2014-09-14T20:41:32.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18207" PostTypeId="2" ParentId="10428" CreationDate="2014-09-14T20:50:28.150" Score="7" Body="&lt;p&gt;FDLS &lt;em&gt;requires&lt;/em&gt; a causal frequency response. Your prototype frequency response has zero phase everywhere, which is most definitely &lt;em&gt;not&lt;/em&gt; causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An IIR filter order of 50 is &lt;em&gt;humongous&lt;/em&gt;. When FDLS has too many poles and zeroes available, it &quot;tries&quot; to cancel excess poles with excess zeroes. Unfortunately, due to numerical limitations, the cancellation is often pretty poor. For your notch filter, try 2nd or 4th order numerator and denominator, after making the response causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though (number of measurements) = (number of coefficients) = [(numerator order) + (denominator order) + 1] is mathematically sufficient, I find that FDLS likes many more measurements than that. I recommend an absolute minimum of twice as many measurements as coefficients, and prefer 5x to 10x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Greg Berchin&lt;/p&gt;&#xA;" OwnerUserId="11085" LastEditorUserId="4346" LastEditDate="2014-09-17T17:29:04.810" LastActivityDate="2014-09-17T17:29:04.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18208" PostTypeId="1" AcceptedAnswerId="18209" CreationDate="2014-09-14T23:40:22.983" Score="4" ViewCount="327" Body="&lt;p&gt;I was thinking, if a realtime system is one in which the processing time is shorter than the sampling period, how does a feedback filter such as a biquad perform the computation without waiting for, say, in the case of the biquad, two additional samples?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2014-09-15T00:30:08.517" Title="How is a realtime BiQuad/IIR possible?" Tags="|real-time|biquad|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18209" PostTypeId="2" ParentId="18208" CreationDate="2014-09-15T00:30:08.517" Score="5" Body="&lt;p&gt;You are confusing &quot;processing time&quot; with &lt;a href=&quot;http://en.wikipedia.org/wiki/Latency_(engineering)&quot; rel=&quot;noreferrer&quot;&gt;&quot;latency&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real-time filters are able to generate output samples at the same rate as they receive inputs.&#xA;They would however induce latency, meaning that the bulk of the energy generated for an input appears later in time with respect to that input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider for example the following input/output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time  : 0 1 2 3 4 5 6 7&#xA;-----------------------&#xA;input : 1 2 3 2 1 0 0 0&#xA;output: 0 0 1 2 3 2 1 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is generated at the same rate as the input is received, so the system can perform in real-time. However, there is a latency of 2 samples in the output when comparing with the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever the expression of the filter relies on past samples which have not yet been received (at the start of an input sequence), initial conditions are assumed (often assuming that those previous values were zeros).&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2014-09-15T00:30:08.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18210" PostTypeId="1" AcceptedAnswerId="18211" CreationDate="2014-09-15T00:32:28.277" Score="0" ViewCount="7161" Body="&lt;p&gt;I'm familiar with the general methodology for checking if a system is linear:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Define output $y_1[n]$ for input $x_1[n]$, define output $y_2[n]$ for input $x_2[n]$&lt;/li&gt;&#xA;&lt;li&gt;Define $x_3[n] = ax_1[n] + bx_2[n]$&lt;/li&gt;&#xA;&lt;li&gt;Compute output $y_3[n]$ for input $x_3[n]$ and verify whether $y_3[n]=ay_1[n]+by_2[n]$. If it is, the system is linear.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, I am having trouble applying this method to systems that are recursive. Some recursive systems can be converted to an iterative form by inspection. For example:&#xA;$y[n] - y[n-1] = x[n] \implies y[n] = x[n] + y[n-1] \implies y[n] = \sum\limits_{k=-\infty}^n x[k]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For others, I am having more trouble, such as $y[n]+y[n+1]=x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I do a change of variables:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$k = n+1 \implies y[k]+y[k-1]=x[k-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the general approach: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_1[k]+y_1[k-1] = x_1[k-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_2[k]+y_2[k-1] = x_2[k-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_3[k] = ax_1[k]+bx_2[k]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_3[k]+y_3[k-1] = x_3[k-1] = ax_1[k-1]+bx_2[k-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is where I got stuck. I was anticipating that the system should be linear, but due to the recursive term, I do not see how the approach I took could yield $y_3[n] = ay_1[n]+by_2[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know where I made a mistake, or if there is a different approach I should be taking? (For instance, is there a general process for going from a recursive expression to an iterative one that I could use?) I'm a student using Oppenheim and Schafer for reference.&lt;/p&gt;&#xA;" OwnerUserId="11086" LastActivityDate="2014-10-03T00:30:12.247" Title="Checking linearity/time-invariance etc. for recursive system" Tags="|discrete-signals|linear-systems|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18211" PostTypeId="2" ParentId="18210" CreationDate="2014-09-15T07:46:21.067" Score="1" Body="&lt;p&gt;You made no mistake. Following the hint in Dilip Sarwate's comment, you will be able to show the following input-output relation of the system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n-1]-x[n-2]+x[n-3]-+\ldots=\sum_{k=-\infty}^{n-1}(-1)^{n-k-1}x[k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this relation, showing linearity will be much easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, note that any system described by a linear difference equation with constant coefficients is linear and time-invariant (if the initial conditions are zero!). And your system obviously belongs to this class.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-15T07:46:21.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18212" PostTypeId="1" CreationDate="2014-09-15T10:15:04.200" Score="0" ViewCount="94" Body="&lt;p&gt;I am not overly familiar with image processing. I know a little about it from University, but I have not really done any for a while and I have found myself with a problem that requires it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have is frames of a video which may or may not have blocks (usually 16x16) of solid colour (either purple or green) randomly distributed throughout. What I would like to be able to do is pick out each block of colour and count up the pixels in each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked into things, and I realise I could perform some sort of edge detection which would produce an image with just the edges highlighted, but that seems to only produce the further problem of how to then identify the blocks from their edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am hoping somebody can point me in the right direction for how to solve this problem, because so far my research has been rather fruitless. There doesn't seem to be a whole lot of useful material out there for a beginner such as myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using C++, though I would prefer to avoid using external libraries if possible. I am prepared to develop my own implementations.&lt;/p&gt;&#xA;" OwnerUserId="11088" LastActivityDate="2014-09-15T10:15:04.200" Title="Image Processing - Identifing/locating Random Solid Blocks of Colour" Tags="|image-processing|edge-detection|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18213" PostTypeId="1" CreationDate="2014-09-15T14:07:08.617" Score="2" ViewCount="282" Body="&lt;p&gt;I've written my own FFT but wanted to know if there was perhaps a way to combine the Cooley and Turkey methods. So far I've got N/2 log N real multiplies for transforming a real signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &lt;a href=&quot;http://pastebin.com/GV9WiwBu&quot; rel=&quot;nofollow&quot;&gt;current implementation&lt;/a&gt; has N log N multiplies (well a little more because I've not optimised out the case of the complex sinusoid at 0 radians), but I have an optimisation that reduces the number of multiplies by 50%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: this is &lt;strong&gt;absolutely not homework&lt;/strong&gt;, I've written this algorithm because I found the explanations of the Cooley/Turkey method far too convoluted, and at the same time I wanted the ability to select which bins I processed in both the FFT and IFFT as well as being able to output the IFFT to multiple channels. So I just decided to figure out my own radix-2 while at the same time understanding how and why the transform works (which I have).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ORIGINAL QUESTION (edited for clarity) ---&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example code: &lt;a href=&quot;http://pastebin.com/GV9WiwBu&quot; rel=&quot;nofollow&quot;&gt;kfft.c&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to know whether there is a similar FFT algorithm to mine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I basically perform FFT by factorising calculations by recursively subtracting the second half of a signal from the first, meaning x[n] only needs to be multiplied by the complex sinusoid for only half of the duration, resulting in N/2 log N real multiplies (shown below). The summed signal is for multiplying with complex sinusoids that are multiples of the sampling period. For example groups {2, 6} are multiples of 2, and therefore have a periodicity of 4 samples.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// For bins { 1, 3, 5 and 7 }&#xA;&#xA;x1[0] = x0[0] - x0[4]&#xA;x1[1] = x0[1] - x0[5]&#xA;x1[2] = x0[2] - x0[6]&#xA;x1[3] = x0[3] - x0[7]&#xA;// Calculate sum (required for the next level of bins)&#xA;x0[0] = x0[0] + x0[4]&#xA;x0[1] = x0[1] + x0[5]&#xA;x0[2] = x0[2] + x0[6]&#xA;x0[3] = x0[3] + x0[7]&#xA;&#xA;// For bins { 2 and 6 }&#xA;&#xA;x2[0] = x0[0] - x0[2]&#xA;x2[1] = x0[1] - x0[3]&#xA;// Calculate sum (required for the next level of bins)&#xA;x0[2] = x0[0] + x0[2]&#xA;x0[3] = x0[1] + x0[3]&#xA;&#xA;// For bin { 4 }&#xA;x3[0] = x0[0] - x0[1]&#xA;x3[1] = x0[0] + x0[1] // &amp;lt;-- This is the 0hz bin (sum)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11092" LastEditorUserId="8202" LastEditDate="2014-09-18T14:06:09.853" LastActivityDate="2014-09-18T14:06:09.853" Title="Is there a way to further optimise my FFT?" Tags="|fft|fourier-transform|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18214" PostTypeId="2" ParentId="18213" CreationDate="2014-09-15T15:07:16.943" Score="1" Body="&lt;p&gt;Indeed, this is more or less the usual butterfly used in radix-2 FFT (can be extended to any prime number): &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterfly_diagram&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Butterfly_diagram&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11093" LastActivityDate="2014-09-15T15:07:16.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18217" PostTypeId="1" CreationDate="2014-09-15T22:10:53.163" Score="1" ViewCount="1488" Body="&lt;p&gt;Weighed overlap add Filterbank structure is often used in speech coding.&#xA;(&lt;a href=&quot;https://www.onsemi.com/site/pdf/Filtering_Hearing_Ai.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.onsemi.com/site/pdf/Filtering_Hearing_Ai.pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have basic question with respect to analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is the difference conceptually between:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) direct analysis: e.g La=R=N1=256  This includes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;extract R=La samples of frame from speech &lt;/li&gt;&#xA;&lt;li&gt;window it with window of length R=N1&lt;/li&gt;&#xA;&lt;li&gt;compute its R=N1, point FFT&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;vs&lt;br&gt;&#xA;b) WOLA( let La=256 = 8*32=&gt;k=8,N1=32, R=16    . the diagram for this is:&lt;br&gt;&#xA;      &lt;img src=&quot;https://i.stack.imgur.com/FKTi4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA; 1.Extract R samples of speech( R'&amp;lt;'N1)&lt;br&gt;&#xA; 2. Put these into FIFO of length La= k*N1&lt;br&gt;&#xA; 3. window this by window of length La samples&lt;br&gt;&#xA; 4. divide the buffer into k buffers, each of length N1&lt;br&gt;&#xA; 5. add the buffers&lt;br&gt;&#xA; 6. compute   (block_no)mod(R)  circular shift of buffer&lt;br&gt;&#xA; 7. compute N1 point FFT &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input was a delta function, after analysis, what would be the difference in frequency response of the system(or the window) and what advantage we get by doing WOLA?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks  for any help that i can get&lt;br&gt;&#xA;sedy&lt;/p&gt;&#xA;" OwnerUserId="11096" LastActivityDate="2014-09-15T22:10:53.163" Title="Weighted overlap Add query" Tags="|filter-bank|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18219" PostTypeId="1" AcceptedAnswerId="18221" CreationDate="2014-09-16T02:29:35.463" Score="0" ViewCount="58" Body="&lt;p&gt;I have found this interesting question here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which of these two waveforms has a richer spectral content, and why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uV5eo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively speaking, I think that the first one is richer, but I cant really justify it! Cheers for any input.&lt;/p&gt;&#xA;" OwnerUserId="11098" LastEditorUserId="4298" LastEditDate="2014-09-16T07:13:48.310" LastActivityDate="2014-09-16T07:21:51.340" Title="Spectral Content of two waveforms" Tags="|discrete-signals|frequency-spectrum|continuous-signals|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18221" PostTypeId="2" ParentId="18219" CreationDate="2014-09-16T07:21:51.340" Score="0" Body="&lt;p&gt;Your intuition is correct. The reason is that the rectangular pulse train has  discontinuities, whereas the rectified sine is continuous (but its derivative has discontinuities). The consequence of this is that the Fourier coefficients of the rectangular pulse train decay as $1/n$, whereas the coefficients of the rectified sine decay as $1/n^2$ (where $n$ is the index of the Fourier coefficients).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-16T07:21:51.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18223" PostTypeId="1" AcceptedAnswerId="18271" CreationDate="2014-09-16T12:23:12.947" Score="0" ViewCount="132" Body="&lt;p&gt;I am doing template maching using &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation#Normalized_cross-correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Normalized Cross-Correlation&lt;/a&gt; for measuring similarity between template and image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, some images from my dataset contain saturated pixels (overshoot) which should be avoided in the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to update the cross-correlation computation to avoid saturated pixels?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L0IcG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2014-09-19T09:29:08.593" Title="Avoid saturated pixels in cross-correlation computation" Tags="|image-processing|cross-correlation|template-matching|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18225" PostTypeId="1" AcceptedAnswerId="18227" CreationDate="2014-09-16T13:17:06.140" Score="2" ViewCount="4714" Body="&lt;p&gt;I have data from an experiment and apply a lowpass filter (digital Butterworth filter, in Matlab).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question ist what happens if I apply the same filter e. g. 2 times on the data?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is changing? Is it like I have the double order?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The question refers to the filtfilt function in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.de/de/help/signal/ref/filtfilt.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.de/de/help/signal/ref/filtfilt.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source [1] says on page 336:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In many filtering problems, we would prefer that the phase&#xA;  characteristics be zero or linear. For causal filters, it is&#xA;  impossible to have zero phase. However, for many filtering&#xA;  applications, it is not necessary that the impulse response of the&#xA;  filter be zero for n &amp;lt; 0 if the processing is not to be carried out in&#xA;  real time. &lt;strong&gt;One technique commonly used&lt;/strong&gt; in discrete-time filtering when&#xA;  the data to be filtered are of finite duration and are stored, for&#xA;  example, in computer memory &lt;strong&gt;is to process the data forward and then&#xA;  backward through the same filter&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;[1] Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. Discrete-Time Signal Processing. 2nd Ed. Upper Saddle River, NJ: Prentice Hall, 1999.&lt;/p&gt;&#xA;" OwnerUserId="11103" LastEditorUserId="11103" LastEditDate="2014-09-18T19:13:58.740" LastActivityDate="2014-09-18T21:50:12.293" Title="Appying a Filter Several Times on Data" Tags="|matlab|filters|lowpass-filter|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18227" PostTypeId="2" ParentId="18225" CreationDate="2014-09-16T13:40:54.850" Score="2" Body="&lt;p&gt;Silly me! The &lt;a href=&quot;http://www.mathworks.de/de/help/signal/ref/filtfilt.html&quot; rel=&quot;nofollow&quot;&gt;Matlab help&lt;/a&gt; includes the answer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A filter transfer function, which equals the squared magnitude of the&#xA;original filter transfer function &lt;/li&gt;&#xA;&lt;li&gt;A filter order that is double the order of the filter specified by &#xA;filter coefficients $b_0$, $b_1$, $b_2$,... and  $a_1$, $a_2$....&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11103" LastEditorUserId="4346" LastEditDate="2014-09-16T17:05:16.273" LastActivityDate="2014-09-16T17:05:16.273" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18229" PostTypeId="1" CreationDate="2014-09-16T14:51:01.390" Score="1" ViewCount="402" Body="&lt;p&gt;With help from &lt;a href=&quot;http://www.dspguide.com/ch17/1.htm&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;the DSP Guide&quot;&gt;the dsp guide&lt;/a&gt; and &lt;a href=&quot;http://www.dsprelated.com/dspbooks/sasp/Example_Overlap_Add_Convolution.html&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;DSP Related&quot;&gt;DSP-Related&lt;/a&gt;, I tried to implement a leaky integrator in octave/matlab. It seems to work in general, but there are a few problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that's what I do:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the optimal integrator (1/jω, damping below &lt;em&gt;fc&lt;/em&gt; Hz) in the frequency domain&lt;/li&gt;&#xA;&lt;li&gt;Band limit this filter (using custom_filter.m)&lt;/li&gt;&#xA;&lt;li&gt;Apply the overlap-add method&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The result can be seen in the images Fig 1 to Fig 4. As Fig 3 shows, the band limiter makes a linear phase shift from the desired constant phase shift, due to shift in time domain (see custom_filter.m). So my integrator isn't working, because the phase shift is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;There's an explanation in the update below the code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BFrDY.png&quot; alt=&quot;No distortion, wrong phase response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I undo the shift in time domain, I get a filter that looks quite good (phase shift is at least constant...), but the resulting signal looks very distorted (second image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1yrBK.png&quot; alt=&quot;Distortion, but better phase response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So where does this distortion come from? And more important, how can I avoid it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here's the code. I was hoping I could attach it as a zip but couldn't find how...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear;&#xA;&#xA;% --------------------------------------------------------------------------------&#xA;%&#xA;% Helper functions, used below. All in one file to copy and paste it&#xA;% to stackexchange.&#xA;%&#xA;&#xA;#&#xA;#  y = spec_integrate( f, fc )&#xA;#  Integrates the f Hz line of a complex spectrum&#xA;#  with a fc Hz highpass&#xA;#&#xA;function y=spec_integrator(f, fc)&#xA;  if f==0,&#xA;    y=0;&#xA;  else&#xA;    y=1* 1000/( i * 2*pi*f );&#xA;&#xA;    # attenuate at f &amp;lt; fc&#xA;    if f &amp;lt; fc,&#xA;      d=(f/fc)^2;&#xA;    else&#xA;      d=1;&#xA;    end&#xA;    y = y*d;&#xA;  end&#xA;endfunction;&#xA;&#xA;%&#xA;% y = ccmirror( x ) &quot;complex conjugate mirror&quot; where:&#xA;%&#xA;% length( x ) = 2^N&#xA;% x contains the positive frequencies of a spectrum&#xA;% x(1    )   is DC&#xA;% x(N/2+1)   is the folding frequency&#xA;% x((N/2+2):N) is ignored&#xA;%&#xA;% y is created from x so that its negative frequencies y((N/2+2):N)&#xA;% are the complex conjugate of the positive frequencies.&#xA;%&#xA;% This means imag(ifft( y ) ) = 0&#xA;%&#xA;function y = ccmirror( x )&#xA;   N=length(x);&#xA;   y = x;&#xA;   y((N/2+2):N) = conj(y((N/2):-1:2));&#xA;endfunction;&#xA;&#xA;%&#xA;% [impulse_response actual_frequency_response] = custom_filter( desired_frequency_response, M)&#xA;%&#xA;% Band limit a filter that has been customized in frequency domain&#xA;%&#xA;% desired_frequency_response is the custom filter definition&#xA;% M is the size of the filter kernel / impulse response&#xA;%&#xA;% impulse_response is the bandlimited impulse response, for&#xA;%                  informational purpose.&#xA;% actual_frequency_response is the bandlimited frequency response&#xA;%&#xA;% This is taken from [DSP-Related][2]&#xA;%&#xA;function [impulse_response actual_frequency_response] = custom_filter( desired_frequency_response, M)&#xA;&#xA;  N=length(desired_frequency_response);&#xA;  %&#xA;  % Get the aliased impulse response&#xA;  %&#xA;  impulse_response=ifft( desired_frequency_response );&#xA;  %&#xA;  % Rotate the signal M/2 points to the right&#xA;  % Note: translation in time domain means a phase shift in frequency&#xA;  % domain! The phase of the frequency response is modified!&#xA;  %&#xA;  impulse_response=circshift( impulse_response, [0,M/2] );&#xA;&#xA;  %&#xA;  % Truncate and window the signal&#xA;  %&#xA;  impulse_response=impulse_response .* [ hanning(M)' zeros(1,N-M)];&#xA;&#xA;  %% One could undo the phase shift from above ... but it gives ugly&#xA;  %% results. Why?&#xA;  %% impulse_response=circshift( impulse_response, [0,-M/2] );&#xA;&#xA;  actual_frequency_response=fft(impulse_response);&#xA;endfunction;&#xA;&#xA;% --------------------------------------------------------------------------------&#xA;%  Now comes the more interesting stuff&#xA;% --------------------------------------------------------------------------------&#xA;&#xA;% Set up simulation parameters&#xA;&#xA;L = 1024;                                 % FIR filter length in taps&#xA;fc = 10;                                  % lowpass cutoff frequency in Hz&#xA;fs = 4000;                                % sampling rate in Hz&#xA;&#xA;Nsig = 8192;                               % signal length in samples&#xA;fsig = 159;                               % Frequency of the demo signal&#xA;asig = 1;                                 % Amplitude of the demo signal&#xA;&#xA;%FFT processing parameters:&#xA;&#xA;M = L;                                    % nominal window length&#xA;Nfft = 2^(ceil(log2(M+L-1)));             % FFT Length&#xA;M = Nfft-L+1;                             % efficient window length&#xA;R = M;                                    % hop size for rectangular window&#xA;Nframes = 1+floor((Nsig-M)/R);            % no. complete frames&#xA;&#xA;lc = round(fc * Nfft/fs);                 % line of the corner frequency&#xA;&#xA;% Generate the test signal:&#xA;&#xA;sig = asig * sin( 2 * pi * (0:(Nsig-1)) * fsig/fs );&#xA;&#xA;% Define the filter in frequency domain&#xA;&#xA;%&#xA;% integrator&#xA;%&#xA;H = zeros( 1, Nfft );&#xA;for f = 1:(Nfft/2+1)&#xA;  H(f) = spec_integrator( (f-1) *fs/Nfft, fc );&#xA;end&#xA;H = ccmirror( H );&#xA;&#xA;Hoptimal = H;&#xA;&#xA;[impulse_response Hactual] = custom_filter( Hoptimal, L);&#xA;H = Hactual;&#xA;&#xA;&#xA;% Carry out the overlap-add FFT processing:&#xA;&#xA;y = zeros(1,Nsig + Nfft);                 % allocate output+'ringing' vector&#xA;for m = 0:(Nframes-1)&#xA;    index = m*R+1:min(m*R+M,Nsig);        % indices for the mth frame&#xA;    xm = sig(index);                      % windowed mth frame (rectangular window)&#xA;    xmzp = [xm zeros(1,Nfft-length(xm))]; % zero pad the signal&#xA;    Xm = fft(xmzp);&#xA;    Ym = Xm .* H;                         % freq domain multiplication&#xA;    ym = real(ifft(Ym));                  % inverse transform&#xA;    outindex = m*R+1:(m*R+Nfft);&#xA;    y(outindex) = y(outindex) + ym;       % overlap add&#xA;end&#xA;&#xA;f=(0:(Nfft-1))*fs/Nfft;                   % frequencies for plotting&#xA;tin=(0:(length(sig)-1))/fs;               % times for plotting&#xA;&#xA;figure 1 % input&#xA;clf&#xA;plot( tin, sig );&#xA;hold on;&#xA;for m = 1:Nframes&#xA;  plot( [ m*L m*L ]/fs, [ min(sig), max(sig) ], &quot;r&quot;);&#xA;end&#xA;ylabel('Amplitude')&#xA;xlabel('Time/s')&#xA;title( &quot;Fig 1: Input signal&quot;)&#xA;legend( sprintf(&quot;%g Hz&quot;, fsig), &quot;Overlap-Add-Frames&quot;);&#xA;&#xA;figure 2 % transfer function (abs)&#xA;clf&#xA;loglog( f, abs(H), &quot;r&quot; );&#xA;hold on;&#xA;loglog( f, abs(Hoptimal));&#xA;hold off;&#xA;ylabel('Amplitude')&#xA;xlabel('Frequency/Hz')&#xA;title( &quot;Fig 2: Filter magnitude&quot;)&#xA;legend( &quot;Band limited&quot;, &quot;Optimal&quot;);&#xA;&#xA;figure 3 % transfer function (phase)&#xA;clf&#xA;plot( f, unwrap(arg(H)), &quot;r&quot; );&#xA;hold on;&#xA;plot( f, unwrap(arg(Hoptimal)));&#xA;hold off;&#xA;ylabel('Phase/rad')&#xA;xlabel('Frequency/Hz')&#xA;title( &quot;Fig 3: Filter phase&quot;)&#xA;legend( &quot;Band limited&quot;, &quot;Optimal&quot;);&#xA;&#xA;tout=(0:(length(y)-1))/fs;&#xA;&#xA;figure 4 % result&#xA;clf&#xA;plot( tout, y );&#xA;hold on;&#xA;plot( [ L/2 L/2 ]/fs, [ min(y) max(y) ], &quot;r&quot;);&#xA;plot( [ L L ]/fs, [ min(y) max(y) ], &quot;r&quot;);&#xA;plot( [ length(y)-Nfft length(y)-Nfft ]/fs, [ min(y) max(y) ], &quot;r&quot; )&#xA;plot( [ length(y)-Nfft-L/2 length(y)-Nfft-L/2 ]/fs, [ min(y) max(y) ], &quot;r&quot; )&#xA;plot( [ length(y)-Nfft-L length(y)-Nfft-L ]/fs, [ min(y) max(y) ], &quot;r&quot; )&#xA;hold off;&#xA;ylabel('Amplitude')&#xA;xlabel('Time/s')&#xA;title( &quot;Fig 4: Filtered signal&quot;)&#xA;legend( sprintf(&quot;%g Hz&quot;, fsig), sprintf( &quot;L/2=%d samples / %gs&quot;, L/2, L/2/fs));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so I was thinking a bit about the phase response in image 1, Figure 3: The bandlimiter shifts the signal in time domain, which means a change of the gradient of the phase response. That's what we see in Figure 3. I've been unsettled by this because I didn't know what this means for my integrator.&#xA;But then I went on and thought about the group delay. The derivative of my phase response is constant, so there is a constant group delay which just means that the time domain signal is shifted by a constant value - which is just what the bandlimiter did :) So the integrator is in fact working and to be exact I'd have to shift the final signal back to where it belongs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great, so now I think the integrator works. Now only one thing is left: &lt;em&gt;why is the result distorted when I undo the time shift of the bandlimiter?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="8068" LastEditorUserId="8068" LastEditDate="2014-09-17T07:38:15.820" LastActivityDate="2014-09-17T07:38:15.820" Title="Why does my overlap-add integrator in frequency domain result in distorted signals?" Tags="|frequency-domain|integration|distortion|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18230" PostTypeId="1" AcceptedAnswerId="18244" CreationDate="2014-09-16T16:43:05.657" Score="4" ViewCount="569" Body="&lt;p&gt;Consider a noise-cancelling headphone:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a noise signal from the outside world, mic it, flip the polarity by multiplying by -1 (with an op-amp or digitally), delay by the appropriate amount, and playback out of the speaker -- the summation of the noise and anti-noise at the ears should approach zero (with better performance at low frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does FXLMS or LMS improve upon this? Why is polarity inversion ('phase cancellation') not as effective at cancelling noise, at least in the literature (e.g. Kuo 1994)?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2023-06-22T11:16:31.230" Title="How is LMS/FXLMS noise cancelling different than simple polarity inversion?" Tags="|noise|acoustics|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18233" PostTypeId="1" AcceptedAnswerId="18235" CreationDate="2014-09-17T06:16:37.617" Score="0" ViewCount="1930" Body="&lt;p&gt;There are 2 audio signals, &lt;strong&gt;X&lt;/strong&gt; &amp;amp; &lt;strong&gt;Y&lt;/strong&gt;.&lt;br&gt;&#xA;&lt;strong&gt;X&lt;/strong&gt; is of 15 second duration. The duration of &lt;strong&gt;Y&lt;/strong&gt; is not given.&lt;br&gt;&#xA;&lt;strong&gt;Y&lt;/strong&gt; is a part of signal &lt;strong&gt;X&lt;/strong&gt; (ie a small part of audio &lt;strong&gt;X&lt;/strong&gt; is extracted &amp;amp; made into audio &lt;strong&gt;Y&lt;/strong&gt;)&lt;br&gt;&#xA;I have to find the starting &amp;amp; ending location, in seconds, in the signal &lt;strong&gt;X&lt;/strong&gt; from where signal &lt;strong&gt;Y&lt;/strong&gt; is derived.&lt;br&gt;&#xA;I was told to &lt;strong&gt;NOT&lt;/strong&gt; use built-in MATLAB functions like conv, xcorr etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I wrote a MATLAB code which compares sample by sample of &lt;strong&gt;X&lt;/strong&gt; &amp;amp; &lt;strong&gt;Y&lt;/strong&gt; starting from the 1st sample.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear;&#xA;[A1,FS1,NBITS1]=wavread('x.wav');&#xA;[A2,FS2,NBITS2]=wavread('y.wav');&#xA;&#xA;for i=1:(length(A1)-length(A2)),&#xA;    if(A1(i:i+length(A2)-1) == A2)&#xA;        found = 1;&#xA;        time1 = i/FS1;&#xA;        time2 = (i+length(A2))/FS1;&#xA;        break;&#xA;    else&#xA;        found=0;&#xA;    end&#xA;end   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A1&lt;/strong&gt; has 120000 samples, &lt;strong&gt;FS1&lt;/strong&gt; = 8000, NBITS1 = 16&lt;br&gt;&#xA;&lt;strong&gt;A2&lt;/strong&gt; has 20000 samples, &lt;strong&gt;FS2&lt;/strong&gt; = 8000, NBITS2 = 16&lt;br&gt;&#xA;Therefore,&lt;br&gt;&#xA;120000/8000 = 15 sec(length of audio &lt;strong&gt;X&lt;/strong&gt;)&lt;br&gt;&#xA;20000/8000 = 2.5 sec(length of audio &lt;strong&gt;Y&lt;/strong&gt;)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;time1&lt;/strong&gt;(starting time) = 6.5001 sec&lt;br&gt;&#xA;&lt;strong&gt;time2&lt;/strong&gt;(ending time) = 9.0001 sec  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to make sure the code was correct, I plotted the impulse response of &lt;strong&gt;X&lt;/strong&gt; &amp;amp; &lt;strong&gt;Y&lt;/strong&gt; using fvtool &amp;amp; found that the impulse response of &lt;strong&gt;Y&lt;/strong&gt; matches that of &lt;strong&gt;X&lt;/strong&gt; between 6.5 to 9 seconds.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to verify the result using built-in MATLAB functions, namely xcorr&lt;br&gt;&#xA;So I used   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A3 = xcorr(A1,A2);  &#xA;plot(A3);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5ZAqx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;A3 is 239999 samples long. Then using  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[max idx] = max(A3)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using the above index location I found the location of maximum correlation value to be at sample 172000. which gives the midpoint at 172000/8000=21.5sec(clearly wrong). However, the location of the maximum correlation value must come to 7.7501 samples. How do I obtain that from the above value?&lt;/p&gt;&#xA;" OwnerUserId="4875" LastEditorUserId="4875" LastEditDate="2014-09-17T09:55:29.160" LastActivityDate="2014-09-17T11:03:24.160" Title="Solution to Cross-correlation problem of 2 audio signals" Tags="|matlab|cross-correlation|homework|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18234" PostTypeId="1" CreationDate="2014-09-17T08:52:23.523" Score="0" ViewCount="67" Body="&lt;p&gt;I'm not sure that's the right forum to ask this question but I'll do it anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my project, I've to listen to different machines using a MEMS &lt;a href=&quot;http://www.analog.com/static/imported-files/data_sheets/ADMP401.pdf&quot; rel=&quot;nofollow&quot;&gt;mic&lt;/a&gt; by fixing the microphone directly on to the machine. The problem that I get, is  that all of the records that I need, are overcharged (clipped) so useless. My question is how should I choose the microphone for really loud measurements?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any hint. &lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="8202" LastEditDate="2015-02-20T12:44:16.953" LastActivityDate="2016-07-01T05:43:26.297" Title="How to choose a microphone and make sure not to overcharge (clip) it?" Tags="|sound|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18235" PostTypeId="2" ParentId="18233" CreationDate="2014-09-17T09:22:37.910" Score="1" Body="&lt;p&gt;Having looked at how xcorr is defined I think I know what is happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two issues:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The range of xcorr is $2N-1$ (N = length of signal X). The initial values are for negative shifts and the second half is positive shifts. Therefore subtract 120000 to get the correct shift.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;xcorr pads Y with zeros to the same length as X. The first 20000 points will be sample Y and the rest of the data zeros. Therefore the value of the maximum correlation will be the start point, not the mid point of the signal (as I originally thought). To prove this think what would happen if Y was the beginning of signal X.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If we now do this on your data we get a start point of (172000-12000)/8000=6.5seconds as expected. The 0.0001 sec comes from how you've defined the first point in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is a pretty bad way to do it as any noise in the signal Y will cause your algorithm to fail. I suspect the aim of this task is to manually right code to calculate the correlation function in a similar way to corr does and then find the maximum.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastEditorUserId="8662" LastEditDate="2014-09-17T11:03:24.160" LastActivityDate="2014-09-17T11:03:24.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18236" PostTypeId="1" CreationDate="2014-09-17T11:35:11.680" Score="0" ViewCount="2830" Body="&lt;p&gt;Long term evolution (LTE) systems use single-carrier frequency division multiplex (SC-FDMA) in the uplink. In such a system, there is a DFT block and a sub carrier mapping block before the IFFT block. What is the significance of DFT and sub carrier mapping? And how do these blocks make the system single carrier?&lt;/p&gt;&#xA;" OwnerUserId="7926" LastEditorUserId="1606" LastEditDate="2014-09-20T07:57:17.877" LastActivityDate="2014-09-20T09:13:02.557" Title="What is the significance of the DFT in SC-FDMA systems?" Tags="|fft|dft|digital-communications|" AnswerCount="1" CommentCount="4" ClosedDate="2015-02-06T12:30:27.237" ContentLicense="CC BY-SA 3.0" />
  <row Id="18237" PostTypeId="1" CreationDate="2014-09-17T12:37:56.260" Score="1" ViewCount="322" Body="&lt;p&gt;in wireless communication,compared to the OFDM system , why does the SC-FDMA (single carrier FDMA) system has a lower PAPR (peak to average power ratio)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-09-17T14:22:19.707" Title="PAPR in the SC-FDMA system" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18239" PostTypeId="2" ParentId="18234" CreationDate="2014-09-17T12:44:20.403" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Choose a commercial Sound Pressure Level meter to roughly measure the noise level close to the machine&lt;/li&gt;&#xA;&lt;li&gt;Look at the data sheet of the MEMS and see if the specification matches the expected level with enough head room (at least 10 dB). IF not, chose a MEMS that meets this spec&lt;/li&gt;&#xA;&lt;li&gt;Maker sure the MEMS is mechanically de-coupled from the machine, i.e. picks up only sound and NOT vibration.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-09-17T12:44:20.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18240" PostTypeId="1" AcceptedAnswerId="18245" CreationDate="2014-09-17T13:05:12.093" Score="0" ViewCount="4457" Body="&lt;p&gt;I am applying a flat-top window to signal because I am very interested in its actual amplitude in the time-domain. I have read that overlapping will improve results. I am using MATLAB and the following is the code that I am using to compute FFT with flat-top window:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time = 0:0.1:500;  &#xA;data = 1.8*sin(2*pi*0.2003*time);Fs = 10;  &#xA;N = length(data);  &#xA;w = flattopwin(N);  &#xA;wdata = data(:).*w;  &#xA;ws = sum(w);  &#xA;Y = fft(wdata)/ws;  &#xA;freq = 0:Fs/N:Fs/2-Fs/N;  &#xA;freq = freq';  &#xA;amplitude = 2*abs(Y(1:floor(N/2)));  &#xA;plot(freq,amplitude);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can someone please help me to modify the code so that I can include overlapping? I am relatively new in this field and am still confused. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10881" LastEditorUserId="1081" LastEditDate="2014-09-17T13:59:03.553" LastActivityDate="2015-01-04T12:53:48.467" Title="Overlapping with flat-top window MATLAB" Tags="|fft|window|" AnswerCount="1" CommentCount="0" ClosedDate="2015-01-04T16:02:44.767" ContentLicense="CC BY-SA 3.0" />
  <row Id="18241" PostTypeId="1" AcceptedAnswerId="18250" CreationDate="2014-09-17T14:05:41.557" Score="2" ViewCount="3581" Body="&lt;p&gt;I know LTE doesn't use the DC subcarrier for OFDM/OFDMA modulation for the downlink, but no author gives a detailed explanation to this stuff. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you tell me the reason behind it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7285" LastActivityDate="2014-09-17T18:44:06.947" Title="why LTE doesn't use DC subcarrier in the downlink?" Tags="|modulation|demodulation|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18242" PostTypeId="2" ParentId="18237" CreationDate="2014-09-17T14:22:19.707" Score="3" Body="&lt;p&gt;This can be explained with the help of some knowledge of probability theory. &#xA;Since the output signal is a hybrid signal consists of many(say,Nfft=2048) single carrier signals, which are QAM-modulated by the complex symbols derived from the information bits. Thus leads to(according to the Central Limit Theorem in probability theory) a near Gaussian distributed signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As is known to us, Gaussian distribution is not bounded in its range, hence resulting in a high PAPR in OFDM signal. While, in SC_FDMA, things are different. The output signal is essentially a single carrier modulated by the complex symbol, no summation of Nfft signals here. Thus a low PAPR is obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can also explained intuitively in the time domain. Say, you have a single carrier(in SC-FDMA) modulated by A QAM modulated scheme. The peak of the signal waveform is almost bounded by the carrier amplitude it self. Whilst, in OFDM, where you have a large number of carriers, each with a different frequency. The peak of the output signal is not necessarily bounded by the highest amplitude, since at some time point, all the peaks of the carriers maybe coincide together and thus sum up to form a ultra high peak. While, at some time point, its negative counterpart can be appeared. Although both of the positive ultra high peaks and negative of it are rare in time, it indeed leads to a high PAPR.&lt;/p&gt;&#xA;" OwnerUserId="7285" LastActivityDate="2014-09-17T14:22:19.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18244" PostTypeId="2" ParentId="18230" CreationDate="2014-09-17T15:25:50.047" Score="4" Body="&lt;p&gt;Your polarity inversion method simply applies the same phase shift (delay) and gain to all frequencies, and is presumably not adaptive (or even closed loop). It may work reasonably well for some limited cases, where the phase and gain have been tailored for that particular environment, but any change to the environment will tend to reduce its effectiveness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LMS however is an &lt;em&gt;adaptive&lt;/em&gt; method which constantly &quot;tunes&quot; a filter to give you optimum cancellation using an appropriate gain and phase response which varies with frequency, and which adapts to a changing environment.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2014-09-17T15:25:50.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18245" PostTypeId="2" ParentId="18240" CreationDate="2014-09-17T15:56:28.057" Score="0" Body="&lt;p&gt;Higher size of your FFT best the resolution of frequencies, but of course it has a cost resulting in a longer to process !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To apply overlap you need define one window size to analyse and one hop/step to walk around your data!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This picture illustrates how this works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/X4SHJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here a simple code using Window size = 2048pts and 50% overlap step!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n_samples = length(yourdata);&#xA;winSize = 2048;&#xA;&#xA;%50% overlap or 0 to not use overlap&#xA;OverlapStep = 50;&#xA;&#xA;if OverlapStep &amp;gt; 0&#xA;&#xA;    Overlap = floor((OverlapStep*winSize) / 100); &#xA;    nFrames=floor(n_samples/Overlap)-1; &#xA;else&#xA;    Overlap= winSize;&#xA;    nFrames=floor(n_samples/Overlap)-1;&#xA;end&#xA;&#xA;&#xA;k=1;&#xA;while ( (k+winSize-1) &amp;lt;= n_samples )&#xA;&#xA;    FrameSignal = yourdata(k:k+winSize-1);&#xA;&#xA;    %%%%%%%%%% Start process FFT here  %%%%%%%%%%%%%%%%%&#xA;    w = flattopwin(winSize);  &#xA;    wdata = FrameSignal(:).*w;&#xA;    Y = fft(wdata)&#xA;    .&#xA;    .&#xA;    .&#xA;&#xA;   k=k+Overlap;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2014-09-17T16:02:04.563" LastActivityDate="2014-09-17T16:02:04.563" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18246" PostTypeId="1" AcceptedAnswerId="18247" CreationDate="2014-09-17T16:21:25.093" Score="0" ViewCount="52" Body="&lt;p&gt;I have a problem in my DSP class that I could use some advice with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An analog signal of length 2.5s is sampled with a Nyquist frequency and the sampled sequence has 5001 values. What is the highest frequency contained in the analog signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've gathered that the sampling frequency is $5001/2.5 = 2000.4 \text{ Hz}$ and thus $T=1/2000.4$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My textbook says that $\Omega_T \geq 2\Omega_m$, where $\Omega_T = 2\pi/T$ and $\Omega_m$ is the Nyquist frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I've found that $\Omega_T = 2\pi 2000.4$ so I get $2\pi 2000.4 \geq 2\Omega_m$ which leads to the highest frequency being $\Omega_m = 2000.4\pi$ or $f_m = \Omega_m/2\pi = 1000.2 \text{ Hz}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I approaching this correctly?&lt;/p&gt;&#xA;" OwnerUserId="11049" LastEditorUserId="11049" LastEditDate="2014-09-17T16:27:33.277" LastActivityDate="2014-09-17T17:45:52.573" Title="Basic sampling problem - could use some advice" Tags="|sampling|nyquist|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18247" PostTypeId="2" ParentId="18246" CreationDate="2014-09-17T17:45:52.573" Score="1" Body="&lt;p&gt;You are doing it correctly.  One minor change that I would make is to divide 2.5 into 5000, not 5001, to get the sample rate.  Two reasons- one, it appears that they purposely set up the problem to have a nice, neat number.  Two, because they are implicitly saying that there was a sample at time 0 and a sample at time 2.5, so there is an &quot;extra sample&quot; because there is a sample at both ends, so you should subtract one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, that is a triviality.  You got the important concepts, and that is what matters.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-09-17T17:45:52.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18249" PostTypeId="2" ParentId="17187" CreationDate="2014-09-17T18:08:07.810" Score="0" Body="&lt;p&gt;ya know, i've never done 2D signal processing other than using MATLAB's &lt;em&gt;surf( )&lt;/em&gt; function naïvely, but i would bet that if you 2D-FFT your 2D data (possibly doubling both length and width by mirror reflecting the data to reduce edge effects, or maybe you should zero-pad), pointwise multiply the FFT of the data with the complex conjugate of the FFT of the template, and iFFT the result, you will get the 2D cross-correlation.  and the first &quot;F&quot; in &quot;FFT&quot; stands for &quot;fast&quot;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-09-17T18:08:07.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18250" PostTypeId="2" ParentId="18241" CreationDate="2014-09-17T18:44:06.947" Score="6" Body="&lt;p&gt;The DC subcarrier is normally omitted because in a zero-IF receiver it overlaps with DC offsets in the hardware which are very difficult to remove.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-09-17T18:44:06.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18251" PostTypeId="1" CreationDate="2014-09-17T19:16:32.390" Score="2" ViewCount="9061" Body="&lt;p&gt;Ok, so we have an image that is a Fourier inverse of the original picture. We want to get the original picture back. We use Matlab to get that job done. We import the image and then we invert it with the help of ifft(), this gives us a matrix with complex numbers. But to get the original picture we need to do some operation on the complex numbers to get it. But what is that operations. I tried the magnitude, real and imaginary part but this doesn't create the picture we want.&lt;/p&gt;&#xA;" OwnerUserId="11118" LastActivityDate="2015-09-21T23:59:28.517" Title="What part of complex number of inverse discrete Fourier transform?" Tags="|fourier-transform|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18252" PostTypeId="2" ParentId="18251" CreationDate="2014-09-17T20:03:08.713" Score="2" Body="&lt;p&gt;To apply &lt;code&gt;IFFT&lt;/code&gt; you need back the signal do complex numbers, you need use magnitude and phase information to rebuild correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real part is = &lt;code&gt;magnitude * cos(phase)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imaginary part is = &lt;code&gt;magnitude * sin(phase)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use square roots of −1 (&lt;code&gt;sqrt(-1)&lt;/code&gt;) to get Imaginary unit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now multiply imaginary unit with imaginary part and sum with real part, OK now are you done to apply &lt;code&gt;IFFT&lt;/code&gt; !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end I apply a mat2gray function to convert the matrix to the intensity!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here how it is really done in matlab: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=imread('C:\Users\Eder\Pictures\download.jpg');&#xA;figure(1);imshow(x);&#xA;%Make FFT&#xA;y=fft(x);&#xA;%Amplitude of the FFT&#xA;mx=abs(y);&#xA;%get Phase Information&#xA;ma=angle(y);&#xA;%back the signal to complex&#xA;y2= mx .* ( cos(ma) + sqrt(-1) * sin(ma) );&#xA;%Apply Inverse FFT&#xA;x2=real(ifft(y2));&#xA;result=mat2gray(x2);&#xA;figure(2);imshow(result);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2014-09-17T20:34:30.270" LastActivityDate="2014-09-17T20:34:30.270" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18253" PostTypeId="1" CreationDate="2014-09-17T20:56:07.567" Score="2" ViewCount="90" Body="&lt;p&gt;Have you ever seen any articles about using morphological-like technique for denoising color images?&lt;/p&gt;&#xA;" OwnerUserId="11038" LastActivityDate="2017-08-23T10:39:32.300" Title="Using morphological operations for color images processing" Tags="|image-processing|morphological-operations|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18255" PostTypeId="1" CreationDate="2014-09-18T04:45:52.277" Score="0" ViewCount="1164" Body="&lt;p&gt;in an OFDM system having a radix two FFT (Say N=64) . all of these sub-carriers are not utilized. while some of the carriers are nulls to prevent leakage in to adjacent bands, say a four to five carriers will be pilots. and the remaining will be the data carriers. what is the significance of pilot carriers in OFDM system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-09-18T13:59:11.117" Title="what is the significance of pilot carriers in ofdm" Tags="|fft|digital-communications|" AnswerCount="1" CommentCount="0" ClosedDate="2014-09-24T12:38:54.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="18256" PostTypeId="1" AcceptedAnswerId="18258" CreationDate="2014-09-18T05:28:10.210" Score="-1" ViewCount="56" Body="&lt;p&gt;I'm learning (trying to learn) how to find a frequency response. I have a discrete time equation and want to understand the process for finding a frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ex:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(n) = 2\,\delta(n)-5\,\delta(n-1) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11120" LastEditorUserId="8202" LastEditDate="2014-09-18T08:02:10.680" LastActivityDate="2014-09-18T08:02:10.680" Title="Discrete Time to Frequency Response" Tags="|discrete-signals|homework|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18258" PostTypeId="2" ParentId="18256" CreationDate="2014-09-18T06:08:52.913" Score="0" Body="&lt;p&gt;While I didn't get a response, this video was helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=Bj-Wf2Rpn2A&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=Bj-Wf2Rpn2A&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11120" LastActivityDate="2014-09-18T06:08:52.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18262" PostTypeId="2" ParentId="18255" CreationDate="2014-09-18T13:59:11.117" Score="0" Body="&lt;p&gt;OFDM pilot symbols are used to measure channel conditions and/or obtain synchronization information.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-09-18T13:59:11.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18264" PostTypeId="1" CreationDate="2014-09-18T17:23:02.287" Score="1" ViewCount="1040" Body="&lt;p&gt;This is an image processing question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In 2-D Euclidean space a pillbox function, $f(x)$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x,y) = 1\text{  if } x^2 + y^2 &amp;lt; R, 0 \text{ otherwise } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R$ is come constant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to approximate the top hat when I'm looking at an image matrix of points, a naive algorithm would make some of the image pixels 1 inside a given radius and the others 0 outside that radius.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I'm looking at a 4 x 4 grid of points, the shape I'd approximate would look like a square if I tried to naively create a discrete top-hat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I create a discrete top-hat function that accurately approximates it's continuous counterpart, even when my image matrix is small? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:  I believe the comment about the edge image pixels having a value equal to the area of the pixel contained within the pillbox is correct. However, implementing this algorithm seems difficult. A reference would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: Matlab has an algorithm for computing a discrete pillbox function in it's fspecial function (disk option). This is the algorithm I'm after, though I still need a reference or an explanation of the geometry, as the function is quite complicated.&lt;/p&gt;&#xA;" OwnerUserId="2007" LastEditorUserId="2007" LastEditDate="2014-09-22T00:55:26.727" LastActivityDate="2014-09-28T08:03:09.923" Title="Discrete version of pillbox function" Tags="|image-processing|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18265" PostTypeId="1" AcceptedAnswerId="18273" CreationDate="2014-09-18T17:28:43.977" Score="4" ViewCount="10463" Body="&lt;p&gt;I'm trying to do bicubic interpolation on an 8*8 matrix(image) shown below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = 10   20  30  40  50  60  70  80&#xA;    90  100 110 120 130 140 150 160&#xA;    170 180 190 200 210 220 230 240&#xA;    250  10  20  30  40  50  60  70&#xA;     80  90 100 110 120 130 140 150&#xA;    160 170 180 190 200 210 220 230&#xA;    240 250  10  20  30  40  50  60&#xA;     70  80  90 100 110 120 130 140&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I used the following matlab code for it and I got an output&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;interp2(A,'bicubic')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But even after googling I'm not getting how to do it manually. Can anyone help me to get the idea using this example(only for few pixels)?&lt;/p&gt;&#xA;" OwnerUserId="10965" LastActivityDate="2014-09-20T20:30:54.260" Title="Bicubic Interpolation" Tags="|image-processing|matlab|interpolation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18266" PostTypeId="1" CreationDate="2014-09-18T18:36:06.607" Score="0" ViewCount="857" Body="&lt;p&gt;I’ve been trying to estimate the frequency of a signal I obtained at 1000Hz sampling frequency. The dominant frequency is expected to be not more than 4 or 5 Hz. I’ve estimated the PSD using autocorrelation method however for some signal it seems to noisy and it’s difficult to find the dominant frequency. I’ve tested the method for 60 signals and the output was not as expected (the frequency goes up and down when it should either increase or decrease according to the process).&#xA;I shall be grateful for any suggestions&#xA;The details of the signal can be found in this post: &lt;a href=&quot;https://dsp.stackexchange.com/questions/17701/how-to-estimate-psd-and-time-delay-of-a-random-signal&quot;&gt;How to estimate PSD, and time delay of a random signal?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here's the code I used&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% estimate the power spectral density, where the spectrum is the FFT of the autocorrelation sequence.&#xA;&#xA;for i=1:numel(files)&#xA;   N=length(Rxx{1,i}(1:4000));&#xA;   nfft{i} = 2^nextpow2(length(Rxx{1,i}));&#xA;   % Compute Fourier transform of x using nfft&#xA;   Xxx{i} = fft(Rxx{1,i}(1:4000),nfft{1,i});&#xA;&#xA;   % Frequency vector&#xA;&#xA;   fs=1000;&#xA;   F{i}= 0 : fs/(nfft{1,i}-1) : fs;&#xA;&#xA;   % Powerspectral density &#xA;&#xA;   Pxx1{i} =2* abs(Xxx{1,i}).^2/N;     &#xA;   [mx{i},ind{i}] = max(Pxx1{i});    &#xA;   maxxfreq{i}=F{1,i}(ind{i});    &#xA;   figure     &#xA;   plot(F{i},Pxx1{1,i}), grid &#xA;   axis([0 10 0 max(Pxx1{1,i})])&#xA;   xlabel('Frequency')&#xA;   ylabel('Power')&#xA;   title('power spectrum')&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10772" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-09-19T14:08:42.850" Title="What is the best method to estimate the frequency(PSD) for noise signal" Tags="|matlab|frequency|power-spectral-density|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18267" PostTypeId="1" AcceptedAnswerId="18270" CreationDate="2014-09-18T18:59:58.367" Score="5" ViewCount="2393" Body="&lt;p&gt;Inside ADC we have a quantizer, when the sampled signal is passed through it, the signal values get discretized. The number of discrete levels in which the signal is discretized is called the resolution of the quantizer. I read that if we oversample the input signal and then pass it through the quantizer and pass the output again through a low pass filter called decimation filter the signal to quantization noise (SQNR) of the quantizer improves resulting in better resolution of the quantizer.&lt;br&gt;&#xA;How is this possible? True that the SQNR improves but how does that  affect the resolution of the Quantizer? Isn't the number of levels inside the quantizer fixed by its hardware and thus resolution of the quantizer i.e., the number of dicrete levels in which it breaks the input fixed?&lt;/p&gt;&#xA;" OwnerUserId="11128" LastActivityDate="2016-07-03T03:39:18.770" Title="How increasing the Signal to Quantization noise increases the resolution of ADC" Tags="|discrete-signals|analog|analog-to-digital|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18268" PostTypeId="2" ParentId="18225" CreationDate="2014-09-18T20:01:03.103" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;digital Butterworth filter, in Matlab).&lt;/p&gt;&#xA;&lt;p&gt;My question ist what happens if I apply the same filter e. g. 2 times on the data?&lt;/p&gt;&#xA;&lt;p&gt;What is changing? Is it like I have the double order?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Not quite.  A 2nd-order Butterworth cascaded with a 2nd-order Butterworth &lt;em&gt;will&lt;/em&gt; produce a 4th-order filter, but it will &lt;em&gt;not&lt;/em&gt; be a 4th-order Butterworth.  It will have 6 dB down at the cutoff frequency instead of 3 dB down.&lt;/p&gt;&#xA;&lt;p&gt;To make the total frequency response Butterworth, you'd need to use different Qs for the forward and backward biquads.  I'm not sure what effect it would have for them to be asymmetrical.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-09-18T20:01:03.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18269" PostTypeId="2" ParentId="18225" CreationDate="2014-09-18T21:50:12.293" Score="4" Body="&lt;p&gt;How about answer your question in an ultimate way? What will happens to if you apply a low pass filter infinite times or practically a large number of times? I believe it is more meaningful for you to understand this one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to first emphasize the fact that apply a filter $F$ to $d$ for $k$ times, is equivalent to apply a filter $F'$ to $d$ for once, if we have &#xA;$$F' = \underbrace{F*F*\cdots*F}_{k \,{\rm times}} $$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer to the 'ultimate' version of your question is that: no matter where you start with your lowpass filter, say $F=[f_0,f_1,\cdots,f_n]$, with $\sum_{i=0}^{n} f_i = 1$ and $f_i \geq 0$, you will end up to apply a Gaussian filter $G$ when you apply filter $F$ to some discrete signal $d=[d_0,d_1,\cdots,d_m]$ for $k\rightarrow\infty$ times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: this conclusion does not rely on&#xA;1) what is the signal to be processed $d$, &#xA;2) which $F$ you use, as along as it is &lt;strong&gt;lowpass&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some &lt;strong&gt;ipython&lt;/strong&gt; code, you might play with.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;# generate a random low pass filter&#xA;F = np.random.randint(0,1000,(100,1) ).astype('float').ravel();&#xA;# ensures sum to 1&#xA;F = F / F.sum();&#xA;print &quot;sum(F) = &quot;, F.sum();&#xA;# create copy to buffer the last version of convolving F for k times&#xA;Fk = F.copy();&#xA;Fk_list = [];&#xA;for k in range( 5 ) :&#xA;    Fk = np.convolve( Fk, F, 'full' );&#xA;    Fk = Fk / Fk.sum();&#xA;    # donot worry about this line, see comments below&#xA;    Fk = np.asarray( filter( lambda x : x &amp;gt; 1e-6, Fk ) );&#xA;    Fk = Fk / Fk.sum();&#xA;    Fk_list.append( Fk );&#xA;# plot results&#xA;f, axarr = pyplot.subplots( 3, 2 );&#xA;# plot data&#xA;axarr[0,0].plot( F ),&#xA;axarr[0,0].set_title( 'k = 0' );&#xA;axarr[0,1].plot( Fk_list[0] ),&#xA;axarr[0,1].set_title( 'k = 1' );&#xA;axarr[1,0].plot( Fk_list[1] ),&#xA;axarr[1,0].set_title( 'k = 2' );&#xA;axarr[1,1].plot( Fk_list[2] ),&#xA;axarr[1,1].set_title( 'k = 3' );&#xA;axarr[2,0].plot( Fk_list[3] ),&#xA;axarr[2,0].set_title( 'k = 4' );&#xA;axarr[2,1].plot( Fk_list[4] ),&#xA;axarr[2,1].set_title( 'k = 5' );&#xA;pyplot.show();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the line that with filter keyword is simply to discard very small components, because I want to keep you see beautiful bell shape Gaussian. Otherwise, the results are still Gassuian, but since we might include many things outside of 4 times of standard deviation, you will see something like a peak instead. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here are the results of the above ipython code. As you can see, the more times of convolve to $F$ self, the resulting lowpass filter is more similar to a Gaussian. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BUzKY.png&quot; alt=&quot;convolve a random low pass filter &quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let me give you another visual demonstration by using a very different $F$, which only contains two nonzero values. Though this time you cannot see $F$ to be Gaussian like in 5 times of convolution, the long term behaviour namely, $k\rightarrow\infty$ does not change. It will be Gaussian like after a large number of self-convolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0IqKm.png&quot; alt=&quot;convolve a very sparse low pass filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you might ask why this thing happens? Because &lt;em&gt;God loves Gaussian&lt;/em&gt;. This conclusion is so-called the '&lt;strong&gt;Central Limit Theorem&lt;/strong&gt;' ( see details in &lt;a href=&quot;http://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Central_limit_theorem&lt;/a&gt; ). I am not gonna to explain everything for you, because I wish you could learn this on your own. But here is a hint: probability / discrete distribution, arithmetic mean, low-pass filter coefficients, linear operators, and convolution, they are all related. If you have any difficulty to understand something new, try to understand it via something you already knew with close relationships. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2014-09-18T21:50:12.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18270" PostTypeId="2" ParentId="18267" CreationDate="2014-09-18T23:27:49.907" Score="4" Body="&lt;p&gt;There are two aspects to how this works.  First, since the signal is oversampled there is a great deal of correlation between samples that we can take advantage of via the low-pass filter.  The noise, on the other hand, has no correlation (assuming it is white noise), and thus will often destructively interfere with itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question seems to be more about how the actual bit growth happens though.  If we have, for example, a 12-bit ADC, how can the number of bits grow to, say, 16-bits?  It is actually very simple.  FIR filters (and the same basic argument applies to IIR filters as well) essentially do a lot of multiplying and adding.  When you multiply two 12-bit values you get a 24-bit value.  When you add two of those 24-bit values together you get a 25-bit value.  The non-scaled bit width of a FIR filter is:&#xA;$$&#xA;(bw_i * 2) + log_2(numTaps)&#xA;$$&#xA;where $bw_i$ is the bit width of the input and $numTaps$ is the number of taps in the filter.  As you can see, if we have 12-bit inputs and we want 16-bit outputs there is no trouble getting the 16-bits.  You usually have to scale down the filter outputs, in fact, to restrict them to the bit widths that you want.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-09-18T23:27:49.907" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18271" PostTypeId="2" ParentId="18223" CreationDate="2014-09-19T08:30:27.730" Score="0" Body="&lt;p&gt;I have finally found an aswer in a technical report &quot;&lt;a href=&quot;http://research.microsoft.com/apps/pubs/default.aspx?id=70092&quot; rel=&quot;nofollow&quot;&gt;Image Alignment and Stitching: A Tutorial&lt;/a&gt;&quot; from Richard Szeliski.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A weighted SSD (Sum of Suqared Differences) function is presented on page 13:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_{WSSD}(u)=\sum_{i}w_{0}(x)w_{1}(x_{i}+u)\left[I_{1}(x_{i}+u)-I_{0}(x_{i})\right]^{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w_{0},w_{1}$ are spatially-varying weight functions (for template and the image). $u$ is a template offset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result may be divided by the overlap area to avoid bias towards smaller overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This however works for SSD metric, not NCC. But it may suffice once images are normalized beforehand (using contrast/brightness adjustment computed using linear regression over corresponding pixel intensities).&lt;/p&gt;&#xA;" OwnerUserId="1031" LastEditorUserId="1031" LastEditDate="2014-09-19T09:29:08.593" LastActivityDate="2014-09-19T09:29:08.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18273" PostTypeId="2" ParentId="18265" CreationDate="2014-09-19T10:23:07.340" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://www.paulinternet.nl/?page=bicubic&quot; rel=&quot;noreferrer&quot;&gt;Here&lt;/a&gt; pretty good explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll start by consider the 1D case of cubic interpolation (because its easier to explain) and then go onto the 2D case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea of cubic interpolation is to estimate the values between any two points by as a cubic function, $f(x)$, with first derivative, $f'(x)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = ax^3 + bx^2 + cx + d$$&#xA;$$f'(x) = 3ax^2 + 2bx + c$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that, when spliced to the adjacent cubic splines on the left and on the right, the interpolated function (the &quot;zeroth derivative&quot;) and its first derivative are continuous.  That means, at the left boundary of some given spline, the zeroth and first derivatives are equal to the those of the right boundary of the adjacent spline immediately to the left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without loss of generality, we can assume that we are interpolating between $x=0$ and $x=1$.  On the left and right boundaries, we see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(0) = d$$&#xA;$$f(1) = a+b+c+d$$&#xA;$$f'(0) = c$$&#xA;$$f'(1) = 3a+2b+c$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solving for the polynomial coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a = 2f(0) - 2f(1) + f'(0) + f'(1)$$&#xA;$$b = -3f(0) + 3f(1) - 2f'(0) - f'(1)$$&#xA;$$c = f'(0)$$&#xA;$$d = f(0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the four points around the region being estimated, which are $(-1,y_{-1})$, $(0,y_0)$, $(1,y_1)$, $(2,y_2)$, and impose boundary conditions that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(0) = y_0$$&#xA;$$f(1) = y_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and define the two boundary derivatives as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f'(0) = \frac{y_1-y_{-1}}{2}$$&#xA;$$f'(1) = \frac{y_2-y_0}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is consistent to how they will be defined for the adjacent splines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a = -\frac{y_{-1}}{2} + \frac{3y_0}{2} - \frac{3y_1}{2} + \frac{y_2}{2}$$&#xA;$$b = y_{-1} - \frac{5y_0}{2} + 2y_1 - \frac{y_2}{2}$$&#xA;$$c = -\frac{y_{-1}}{2} + \frac{y_1}{2}$$&#xA;$$d = y_0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;once the coefficients are known you can interpolate $f(x)$ for any point between the central 2 points, $(0,y_0)$ and $(1,y_1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For bicubic interpolation the principle is pretty much the same but you estimate a surface using 16 points (4x4 grid) rather than just a curve. One simple way to do this is to first interpolate the columns and then interpolate the resulting rows.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastEditorUserId="4346" LastEditDate="2014-09-20T20:30:54.260" LastActivityDate="2014-09-20T20:30:54.260" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18274" PostTypeId="1" CreationDate="2014-09-19T10:36:45.157" Score="2" ViewCount="153" Body="&lt;p&gt;I am trying to calculate the disparity between stereo image pairs.  I'm using what appears to be the standard approach of correlating between a window of pixels from one image and a sliding window from the other.  The horizontal shift that gives the best correlation is the disparity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the images contain large almost featureless areas.  In those areas, the calculated disparity is frequently wrong.  I would like to introduce a correlation confidence measure, so that the results in these areas can be discarded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a common measure of confidence that is suitable for this application?  At the moment I am struggling to distinguish between truly featureless areas, and those with low contrast that still have recognisable features.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-06-22T18:36:58.020" Title="Image correlation confidence measure" Tags="|image-processing|correlation|stereo-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18278" PostTypeId="1" AcceptedAnswerId="18279" CreationDate="2014-09-19T16:12:22.010" Score="1" ViewCount="1670" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sfSVb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As seen from the image below, an ideal high pass filter was applied. Hence, stark changes in pixels from lighter to darker or vice versa show up on the filtered image. However, slower changes such as on the cheekbone appear to be this gray color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is this gray color? It seems to be quite prevalent in all my grayscale images.&lt;/p&gt;&#xA;" OwnerUserId="11137" LastActivityDate="2014-09-19T16:21:48.427" Title="Why does an ideal high pass filter on this image generate gray values" Tags="|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18279" PostTypeId="2" ParentId="18278" CreationDate="2014-09-19T16:21:48.427" Score="1" Body="&lt;p&gt;Extreme positive values are black and extreme negative values are white. Values near zero are grey. Where there is not much change the high pass filter outputs values near zero. Hence the grey regions in the image. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-09-19T16:21:48.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18280" PostTypeId="1" CreationDate="2014-09-19T21:30:11.390" Score="1" ViewCount="383" Body="&lt;p&gt;I'd Like to ask two questions :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the difference between studying Signal processing (both Deterministic and statistical) in Department of Electrical Engineering versus Department of Mathematics and statistics&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's All the mathematical topics (both time/n-domain and f/S f/Z domain ) which is a prerequisites of studying Signal Processing (Both continuous and discrete) or reading a book like &quot;signals and systems&quot; by &quot;Alan Oppenheim&quot; ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks All&lt;/p&gt;&#xA;" OwnerUserId="11140" LastActivityDate="2014-09-22T08:12:37.827" Title="Study Signal Processing" Tags="|discrete-signals|signal-analysis|statistics|z-transform|fourier|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18281" PostTypeId="1" AcceptedAnswerId="18285" CreationDate="2014-09-20T05:05:16.677" Score="3" ViewCount="3888" Body="&lt;p&gt;Say for example, I have a signal with maximum frequency at 600Hz, and I originally oversampled it at 2000Hz. Afterwards I was only interested in frequency less than 500Hz. I guess I could first filter out frequency &gt;500Hz, then downsample by taking every second sample point; or I could first downsample by taking every second sample, then filter out frequency &gt;500Hz. Is there any problem with the two methods? Do they generate different results? &lt;/p&gt;&#xA;" OwnerUserId="8907" LastActivityDate="2014-09-20T12:13:02.997" Title="Can the order of filtering and downsampling be exchanged?" Tags="|signal-analysis|sampling|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18283" PostTypeId="2" ParentId="18281" CreationDate="2014-09-20T07:02:07.317" Score="4" Body="&lt;p&gt;In Short: The order does matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Detailed:&lt;br&gt;&#xA;Downsampling by a factor of 2 without filtering, will cause aliasing in frequencies of 500Hz and more.&lt;br&gt;&#xA;Since your signal is bandlimited to 600Hz, the frequency range of 400Hz-500Hz will be corrupted.&lt;br&gt;&#xA;So (theoretically) the frequency range 0Hz-400Hz will be the same with or without filtering.&lt;br&gt;&#xA;If you were only interested in this range, it would have been possible to avoid the filtering.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-09-20T07:02:07.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18284" PostTypeId="2" ParentId="18236" CreationDate="2014-09-20T09:13:02.557" Score="1" Body="&lt;p&gt;In the LTE uplink, user equipments (UE) of different users share the same frequency band when sending data to the base station (BS). This frequency band is divided into smaller resource units which must be used by only one UE at a time. This technique is called frequency-division multiple access (FDMA).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's first assume that there are $M$ UEs and that every UE uses conventional orthogonal frequency division multiple access (OFDMA). That is, every UE has an IDFT block of length $N$. Different UEs must not use the same subcarriers at a time so their transmit data is distributed onto orthogonal sets of subcarriers. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Example: Let $N=30$ and $M=3$. To implement FDMA we could assign&#xA;  subcarriers 1 to 10 to UE1, 11 to 20 to UE2 and 21 to 30 to UE3.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The drawback of this technique is that the resulting transmit signals have a relatively high peak-to-average power ratio (PAPR).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The prinicple of SC-FDMA is to generate (in every UE) a single-carrier signal and to shift this signal to the frequency resource that is assigned to the respective UE. The necessary frequency shift is implemented by the $N$-IDFT. The three principal blocks are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;DFT&lt;/strong&gt;: Take $M$ QAM symbols $y(n)$ (which can be interpreted as $M$ consecutive symbols of a single-carrier signal) and calculate the frequency-domain representation $Y(k)$ of this signal by an $M$-DFT.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Subcarrier mapper&lt;/strong&gt;: &quot;Place&quot; $Y(k)$ in the freq. domain at the freq. resource that is assigned to the UE. This is done by assigning $Y(k)$ to the  $M$ IDFT inputs that represent the wanted freq. resource and by setting the remaining $N-M$ IDFT inputs to zero.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;IDFT&lt;/strong&gt;: Calculate the time domain signal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Example: Again, $N=30$, $M=3$. In every UE, calculate the DFT of $N/M=10$ QAM transmit symbols. In UE1, assign the result to IDFT inputs 1 to 10. In UE2, assign the result to IDFT inputs 11 to 20. In UE3, assign the result to IDFT inputs 21 to 30. The remaining IDFT inputs are set to zero, respectively.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The DFT makes SC-FDMA a single-carrier signal because the input to the IDFT is a &quot;spectrum&quot; already not QAM symbols. Therefore, the result of the IDFT is a frequency-shifted single-carrier signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to point out, that the whole purpose of SC-FDMA is to reduce the PAPR. Especially, SC-FDMA is not necessary to implement FDMA. This can also be done by OFDMA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, there are different subcarrier mapping schemes. In my answer I have assumed the so-called localized FDMA (LFDMA) which assigns $Y(k)$ to neighbouring IDFT inputs. Another technique is the interleaved FDMA (IFDMA) which assigns $Y(k)$ to IDFT inputs with distance $M$ in an interleaved way. It has an even lower PAPR. The PAPR of OFDMA, LFDMA and IFDMA are compared in [1].&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1] Myung, H., Lim, J., &amp;amp; Goodman, D. (2006). Peak-To-Average Power Ratio of Single Carrier FDMA Signals with Pulse Shaping. &lt;em&gt;2006 IEEE 17th International Symposium on Personal, Indoor and Mobile Radio Communications&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-09-20T09:13:02.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18285" PostTypeId="2" ParentId="18281" CreationDate="2014-09-20T12:13:02.997" Score="5" Body="&lt;p&gt;Yes, the order does matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a real system with noise (as opposed to an idealized model) if you decimate before filtering, all the noise in the bands you aren't interested in will alias back in, raising the noise floor of your system.  In your example, if you downsample by two before filtering you would have twice the noise in your bands of interest compared to if you filtered everything above 500 Hz then down-sampled (note this does assume a perfect filter, in reality some noise in the stop-band will still alias in but not nearly as much).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even in an idealized model, if you downsample before filtering you will get aliasing from signals above the Nyquist rate.  In your example, everything from 500 - 600 Hz would fold back in from 500 Hz to 400 Hz (e.g. a signal at 525 Hz would fold back to 475 Hz).  If you filter first, you can exclude those signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that in your example applying a low-pass filter with a cutoff of 500 Hz would not do anything after downsampling because now all the frequency content above 500 Hz has already aliased back down below 500 Hz.&lt;/p&gt;&#xA;" OwnerUserId="11146" LastActivityDate="2014-09-20T12:13:02.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18287" PostTypeId="1" CreationDate="2014-09-20T15:21:49.970" Score="0" ViewCount="120" Body="&lt;p&gt;Discrete time systems work on sampled continuous time signals. We need samples only at discrete time to be fed as input to a discrete time system. Does this mean discrete time systems are clocked so that the values only at discrete time are available to the system? How are these discrete time systems implemented physically?&lt;/p&gt;&#xA;" OwnerUserId="11128" LastEditorUserId="11128" LastEditDate="2014-09-20T15:29:56.063" LastActivityDate="2014-09-20T15:39:35.503" Title="Implementing discrete time systems" Tags="|discrete-signals|sampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18289" PostTypeId="2" ParentId="18287" CreationDate="2014-09-20T15:39:35.503" Score="1" Body="&lt;p&gt;&lt;em&gt;&quot;Does this mean discrete time systems are clocked so that the values only at discrete time are available to the system?&quot;&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;yes, but the system can do some mathematics to interpolate values in between the discrete times of the samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&quot;How are these discrete time systems implemented physically?&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;well, it's called &quot;electronics&quot; and the discipline to learn is &quot;electrical engineering&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the most essential part is a computer of some form.  DSP chips are little computers of a form that are optimized to perform the most common DSP algorithms.  you will likely also need something like an A/D converter and D/A converter, but without more specific information about what the discrete-time system is supposed to do, i wouldn't know that for sure.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-09-20T15:39:35.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18290" PostTypeId="1" CreationDate="2014-09-20T15:57:48.590" Score="3" ViewCount="112" Body="&lt;p&gt;We try to multiplication operation of a black &amp;amp; white image with RGB image in same image but their class is not same: BW -&gt; logical, RGB -&gt; UINT8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I convert from Logical to UNIT*? Or, can we do images which is in different class multiplication?&lt;/p&gt;&#xA;" OwnerUserId="11148" LastEditorUserId="128" LastEditDate="2020-03-13T08:54:06.810" LastActivityDate="2023-08-04T21:02:50.293" Title="Image Processing in MATLAB" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="18291" PostTypeId="2" ParentId="18264" CreationDate="2014-09-20T16:34:50.210" Score="0" Body="&lt;p&gt;You will need to use continuous values if you want a better approximation on small images.  As Paul R mentioned a natural choice here would be to choose the ratio of each pixel's area inside the circle to the area of the pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could perform an integral to give you the area of a pixel inside the circle, however, a Riemann sum is much less tedious.  Partition each pixel into a grid of N x N equal-sized squares.  If the center of a square is inside the circle then its area is added to the sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;br&gt;&#xA;The discrete pixel coordinates represent the center of a $1 \times 1$ square in the Cartesian coordinate system.  The origin of the coordinate system is chosen to be the center of the circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coordinate system: &lt;a href=&quot;https://i.stack.imgur.com/fxvIP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;pillbox-3x3-grid&lt;/a&gt;&lt;br&gt;&#xA;Labeled diagram: &lt;a href=&quot;https://i.stack.imgur.com/XBVxK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;pillbox-3x3-labelled&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is labeled using $(x,y)$ Cartesian coordinates to make the math consistent, however, since a circle is symmetric you don't need to worry about it.  The relationship is of course that $(x,y)$ coordinates correspond to $[-y,x]$ pixel coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the diagram you can set up the appropriate integrations to find out the areas within each pixel's box.  Then you just need to normalize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to create pillboxes in code then it would be simpler to use a Riemann sum albeit at the cost of computational time.  From a signal processing standpoint this Riemann sum would be equivalent to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Upsample \rightarrow Calculation \rightarrow Downsample$&lt;/p&gt;&#xA;" OwnerUserId="11145" LastEditorUserId="11145" LastEditDate="2014-09-26T16:27:23.980" LastActivityDate="2014-09-26T16:27:23.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18294" PostTypeId="2" ParentId="18290" CreationDate="2014-09-20T21:32:01.503" Score="1" Body="&lt;p&gt;I guess you have a Binary (Logic) mask you want to multiply the image by.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mMask = double(mMaskBinary);&#xA;&#xA;for ii = 1:numChannels&#xA;&#xA;    mOutImage(:, :, ii) = mMask  .* mInputImage(:, :, ii);&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the latest MATLAB releases (From R2016b) expansion is done implicitly.&lt;br&gt;&#xA;Hence if you want to do a multiplication between &lt;span class=&quot;math-container&quot;&gt;$ M \times N $&lt;/span&gt; image to &lt;span class=&quot;math-container&quot;&gt;$ M \times N \times 3 $&lt;/span&gt; image you can just multiply them element by element and the expansion to the 3rd dimension will happen automatically like in the loop above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enjoy.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2020-03-13T08:56:13.277" LastActivityDate="2020-03-13T08:56:13.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18295" PostTypeId="2" ParentId="18280" CreationDate="2014-09-21T03:44:05.013" Score="1" Body="&lt;p&gt;Well the main difference would be that studying engineering signal processing would be like studying applied signals, while going in the math direction would be studying just in the theory domain.  Engineers don't always use &quot;correct&quot; math, but they use the math needed to get the job done.  If you're interested in using the theory to build systems, go engineering, if you are more interested in learning the ins and outs of the theory, go math.&lt;/p&gt;&#xA;" OwnerUserId="11152" LastActivityDate="2014-09-21T03:44:05.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18296" PostTypeId="1" CreationDate="2014-09-21T04:00:34.783" Score="0" ViewCount="7928" Body="&lt;p&gt;I know MATLAB has a built in Radon function, but I am working on implementing the radon transform in order to perform filtered back projection.  As I started, my idea was multiple nested for loops for the summations at different theta values, this became pretty complex.  I am not looking for source code, just suggestions on an approach.  Any ideas are welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;Here is what I have come up with so far, it works fairly well to perform the radon transform and create a sinogram&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%%%This function takes an image, theta max and theta step  %%%&#xA;%%%and returns a 2D matrix where each row is the projection%%%&#xA;%%%of the original image at different angles               %%%&#xA;%%%by rotating the image and summing the pixels            %%%&#xA;function [R] = RadonTransform(img, theta, thetaStep)&#xA;&#xA;    %Obtain the image size in the x-direction&#xA;    [x,y] = size(img);&#xA;    %Set a matrix R to hold the projection data&#xA;    R = zeros((theta/thetaStep)+1,x);&#xA;    %Set vector for the angles to take projections at&#xA;    angles = 0:thetaStep:theta;&#xA;    %Matrix to hold all the rotated images separately to prevent blurring&#xA;    rotatedImage = zeros(x,y,length(angles));&#xA;&#xA;    %Loop to rotate image and add up values for the projections&#xA;    for i = 1:(length(angles))&#xA;        %rotate the image starting with theta = 0 degrees&#xA;        rotatedImage(:,:,i) = imrotate(img,angles(i),'nearest', 'crop');&#xA;        %Sum the columns of img to get projection data&#xA;        %Each row of R contains a projection at a certain theta&#xA;        R(i,:) = sum(rotatedImage(:,:,i),1);&#xA;    end&#xA;&#xA;    %Convert the matrix to a gray scale image in the range 0 to 255&#xA;    R = mat2gray(R);&#xA;&#xA;    figure&#xA;    imshow(R)&#xA;    title('My Sinogram')&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11152" LastEditorUserId="13320" LastEditDate="2016-11-21T13:17:03.547" LastActivityDate="2016-11-21T13:17:03.547" Title="Radon Transform Implementation In Matlab" Tags="|matlab|image-processing|projection|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18297" PostTypeId="2" ParentId="18280" CreationDate="2014-09-21T04:09:41.920" Score="2" Body="&lt;p&gt;i remember this question being asked on USENET at &lt;em&gt;comp.dsp&lt;/em&gt;, but i don't remember all of my answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there are &lt;em&gt;several&lt;/em&gt; mathematic disciplines that inform signal processing and formalize some of the concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let's assume you have &lt;em&gt;calculus of one and many variables&lt;/em&gt; and &lt;em&gt;differential equations&lt;/em&gt; (any scientist or engineer should have those).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;well, &lt;em&gt;Complex Variables&lt;/em&gt; and &lt;em&gt;Analysis of Complex functions&lt;/em&gt; to start with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Linear Algebra: Matrices and Determinants&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Fourier Series and Transforms&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Probability, Random Variables, and Random Processes&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Numerical Techniques&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Metric Spaces and Functional Analysis&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all those are useful math topics, sufficiently useful that i would recommend taking math classes in these if you end up in grad school in EE.  there are many signal processing topics that make reference to one or more of the above math topics.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-09-21T04:09:41.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18298" PostTypeId="1" AcceptedAnswerId="18302" CreationDate="2014-09-21T16:44:27.410" Score="-1" ViewCount="269" Body="&lt;p&gt;I have one confusion in QAM about in-phase I and quadrature Q part, i.e. do they transmit identical data or not? For e.g. if i have 11001001 as a byte to be transferred, so will 4-QAM separate it like?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I 01 00&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q 10 11&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or both I and Q are similar at any instant of time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for answers&lt;/p&gt;&#xA;" OwnerUserId="11154" LastActivityDate="2014-09-21T22:24:12.120" Title="Q and I part in QAM" Tags="|signal-analysis|digital-communications|ofdm|decomposition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18302" PostTypeId="2" ParentId="18298" CreationDate="2014-09-21T22:24:12.120" Score="1" Body="&lt;p&gt;No, both the I and Q parts carry only one bit at any time, and a total of two bits are carried by the 4-QAM signal during each signaling interval. The data bits in the two parts (during a signaling interval) might &lt;em&gt;happen&lt;/em&gt; to have the same &lt;em&gt;value&lt;/em&gt; (both $0$ or both $1$) or they might &lt;em&gt;happen&lt;/em&gt; to have &lt;em&gt;different&lt;/em&gt; values (one of the bits is $0$ and the other is $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a lot of detail about how all this happens, read &lt;a href=&quot;https://dsp.stackexchange.com/a/6447/235&quot;&gt;this answer&lt;/a&gt; that I wrote some time ago..&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-09-21T22:24:12.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18303" PostTypeId="2" ParentId="18280" CreationDate="2014-09-22T08:12:37.827" Score="1" Body="&lt;p&gt;Engineering is applied science. But to apply any science, u have to develop a concept behind it, a theory. And mathematics is a tool to prove your theoretical assumption. Bcoz if u prove anything in mathematics, it can be implemented in real life. The signal processing is nothing but mathematical operation on real world signals and the amount of math in this subject is very heavy. So, in math department u get in very depth of what it is, how u show that in graphical data, how u prove it etc. An engineer then uses this proofs to apply in real life with few changes.&#xA;A signal have few basic parameters like frequency/wavelength, amplitude/intensity etc. These parameters u show/model in mathematics using complex numbers and vectors which can be mathematically processed i.e. added, subtracted etc. to produced desired output. U need to learn basic differentiation, integration, summation then using that fouriour, z &amp;amp; s-domain (complex) analysis, wavelet, and time domain analysis like convolution etc. need to be learned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it also depend on application or type of data like image processing, digital communication, etc. So, if u wish to learn specific application, start from basic for that application. Once u learn one application, learning another will be pretty easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="11154" LastActivityDate="2014-09-22T08:12:37.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18304" PostTypeId="2" ParentId="18290" CreationDate="2014-09-22T08:50:32.720" Score="1" Body="&lt;p&gt;The simplest way to convert type is: a=uint8(a) where a is your bw image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can convert to any type in this way e.g a=double(a).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For multiplication remember to use .* for element wise multiplication. * does matrix multiplication.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-09-22T08:50:32.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18305" PostTypeId="1" AcceptedAnswerId="18309" CreationDate="2014-09-22T09:31:06.853" Score="0" ViewCount="114" Body="&lt;p&gt;Let assume we have a signal as:&lt;br&gt;&#xA;$\color{blue} {x(t)=M e^{(-\beta.t)} e^{j(\sigma .t+\delta )}}$&lt;br&gt;&#xA;By applying phase angle operator we have:&lt;br&gt;&#xA;$\color{blue} {Phase[x(t)]=Phase[M e^{-\beta.t} e^{j(\sigma .t+\delta )}]=\sigma.t+\delta}$&lt;br&gt;&#xA;I have two questions:&lt;br&gt;&#xA; 1. How can I implement the Phase angle operator, i.e. &lt;em&gt;Phase&lt;/em&gt;, in practice ,like a chip.&lt;br&gt;&#xA; 2. Does phase angle operator increase the effect of noise in a noisy signal?(for example some operators like derivative operator increases the noise effect in a noisy signal)&lt;br&gt;&#xA;Kind Regards&lt;/p&gt;&#xA;" OwnerUserId="5132" LastEditorUserId="5132" LastEditDate="2014-09-22T13:43:10.050" LastActivityDate="2014-09-22T17:39:36.560" Title="Phase angle operator, Implemention and drawbacks" Tags="|noise|phase|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18309" PostTypeId="2" ParentId="18305" CreationDate="2014-09-22T17:39:36.560" Score="1" Body="&lt;p&gt;As mentioned in my comment, you need the &lt;code&gt;atan2&lt;/code&gt; function. If it is not implemented in the library you're using, you can implement it yourself quite easily according to &lt;a href=&quot;http://en.wikipedia.org/wiki/Atan2#Definition_and_computation&quot; rel=&quot;nofollow&quot;&gt;this definition&lt;/a&gt;. If your signal is $x(t)=x_r(t)+jx_i(t)$, where $x_r(t)$ and $x_i(t)$ are the real and imaginary parts, respectively, then for a given time $t$, the phase is computed as $\phi(t)=\text{atan2}(x_i(t),x_r(t))$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computation of the phase of a signal is indeed sensitive to noise. Note that - no matter how you implement it - there is always some direct or approximate computation of the ratio of the imaginary and the real part of the signal, and since both are corrupted by noise, the ratio can be very noisy. The computation of the ratio can also become numerically problematic if the denominator (i.e. the real part) becomes very small.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-22T17:39:36.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18310" PostTypeId="1" CreationDate="2014-09-22T18:23:26.597" Score="1" ViewCount="1004" Body="&lt;p&gt;I have a sound that is being recorded but I am trying to apply bandpass filtering to the sound so that it filters out anything above and below a selected frequency range. I have tried the tool in matlab to create the filter but for some reason can not get it to work. The code below is the record portion that I have the sound being recorded but need help applying the filter. Any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function soundRecord (signal)&#xA;fs = 44100; %Sample Frequency&#xA;f = 15:22; %Frequency range&#xA;recObj = audiorecorder(44100, 16, 2);&#xA;get(recObj)&#xA;&#xA;%save sound to wave file&#xA;%filename = 'location.flac';&#xA;audiowrite('input.wav',signal, fs);&#xA;&#xA;&#xA;if ~exist('inFile')&#xA;inFile = 'input.wav';&#xA;end&#xA;&#xA;if ~exist('outFile')&#xA;outFile = 'output.wav';&#xA;end&#xA;&#xA;if ~exist('frameWidth')&#xA;frameWidth = 4096;          % size of FFT frame, better be a power of 2&#xA;end&#xA;frameHop = frameWidth/2;&#xA;&#xA; analWindow = hanning(frameWidth);&#xA;&#xA; [inBuffer, Fs] = wavread(inFile);&#xA;&#xA; for arrayCol = 1:2&#xA; % if(arrayCol == 1)&#xA; %     x = [inBuffer(:,arrayCol); linspace(0, 0, frameWidth)'];                   %     `    left channel passed through, zeropad one frame at the end`&#xA; % end&#xA; %if(arrayCol==2)&#xA;    x = inBuffer(:,arrayCol);&#xA;    %x = inBuffer;                   % left channel passed through, zeropad one frame `    at the end`&#xA;%end&#xA;%clear inBuffer;&#xA;&#xA;numSamples = length(x);&#xA;&#xA;numFrames = floor(numSamples/frameHop)-1;&#xA;&#xA;% disp(frameWidth);&#xA;% disp(numSamples);&#xA;% disp(frameHop);&#xA;% disp(numFrames);&#xA;% disp(size(analWindow));&#xA;% disp(size(transpose(analWindow)));&#xA;&#xA;y = linspace(0, 0, numSamples)';&#xA;&#xA;&#xA;n = 0;                              % init sample pointer.  unlike MATLAB, i like `   counting from 0`&#xA;&#xA;for frameIndex = 1:numFrames&#xA;&#xA;&#xA;&#xA;     xWindowed = x(n+1:n+frameWidth) .* analWindow;     % get and window the input        `    audio frame`&#xA;&#xA;     X = fft(fftshift(xWindowed));              % do the FFT&#xA;&#xA;     Y = X;                         % copy the input spectrum to output&#xA;&#xA;                                % do whatever processing to Y that you like&#xA;&#xA;     yWindowed = fftshift(real(ifft(Y)));           % convert back to time domain,           `    toss the imaginary part`&#xA;&#xA;     %disp(size(x(1:frameWidth)));&#xA;     %disp(size(yWindowed));&#xA;&#xA;     y(n+1:n+frameWidth) = y(n+1:n+frameWidth) + yWindowed;&#xA;&#xA;     n = n + frameHop;&#xA;%spectrogram(X,256,250,f,1E3,'yaxis');&#xA;%surf(f,10*log10(abs(p)),'EdgeColor','none'); &#xA;%axis xy; axis tight; colormap(jet); view(0,90);&#xA;%xlabel('Time');grid on;&#xA;%ylabel('Frequency (Hz)');grid on;&#xA;&#xA;pwelch(X);grid on;&#xA;end&#xA;&#xA;soundArray(:,arrayCol) = y;&#xA;&#xA;end    &#xA;&#xA;%wavwrite(y, Fs, 'output.wav');&#xA;wavwrite(soundArray, Fs, 'output.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2014-09-22T18:23:26.597" Title="How to add bandpass filter to recorded sound in matlab" Tags="|matlab|discrete-signals|sound|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18311" PostTypeId="1" CreationDate="2014-09-22T18:58:20.357" Score="4" ViewCount="250" Body="&lt;p&gt;I am currently pursuing a Master degree of Engineering and I will have to write a thesis about solving a specific Machine Vision application. I have done some CV projects in the past but now I am tinkering about the methods of problem solving in the broad field of object detection. What I noticed is that it looks like there are about two kind of people trying to solve CV problems and asking about them on a SE site. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first kind of people needs to solve a specific problem (like, finding faces or horses or else in a picture) and is asking questions like &quot;Oh, I need to find an algorithm to detect face&quot; or &quot;How can I detect cars with SIFT and OPENCV&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second kind of people is writing academic papers on some new algorithms (like SIFT, ORB, etc.). They might have questions like &quot;How to best compute the Hamming distance&quot; or else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both kind of people and questions are relevant and fine to me (if my opinion matters). I wonder though if there is somewhere I could ask questions or share thoughts about more &lt;em&gt;structured&lt;/em&gt; methods of computer vision problem solving. I mean, I would like to know a place where I could ask questions such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;em&gt;What are the general steps of solving an object detection (or recognition) in a 'graduate' manner, and being able to demonstrate that all the steps used where necessary and to a high confidence the best method was chosen?&lt;/em&gt;&quot;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to post on Signal Processing Meta but you need 5 rep in order to...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, the &lt;em&gt;question&lt;/em&gt; asked is a real one that I would like to ask here, simply it might not be the place or respect the guidelines of this SE site. In the same way, I feel this might be too CV related to ask on Academia SE...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;br&gt;&#xA;What I mean by &quot;a graduate manner&quot; is the rigorous approach to problem solving that one should use in the course of graduate studies. What I mean is that sometime (especially when you work in a company vs working in academia), you must rapidly get a solution that work to solve a problem, instead of doing an entire review of the possible methods and doing benchmarks and etc... (This is a generalization and I don't want to imply that working in a company makes you use somewhat botched methodology, see it more like a &quot;Perfect is the enemy of good&quot;.)&lt;/p&gt;&#xA;" OwnerUserId="9090" LastEditorUserId="9090" LastEditDate="2014-09-23T12:41:05.383" LastActivityDate="2014-09-23T12:41:05.383" Title="Academic problem solving in Computer Vision" Tags="|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18313" PostTypeId="2" ParentId="18311" CreationDate="2014-09-22T19:19:21.917" Score="3" Body="&lt;p&gt;With all due respect, your question is rather vague...  For example, it is not clear to me what you mean by &quot;structured methods of computer vision problem solving&quot;, or what you mean by a &quot;graduate manner&quot; of object detection or recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are doing a Master's thesis in computer vision then presumably you have an adviser, who is supposed to be knowledgeable in this field, and who is supposed to help you define your problem, and point you to the relevant papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, defining and constraining your problem is the key here. &quot;general steps of solving an object detection (or recognition)&quot; is not a very well defined problem.  Are you trying to detect a specific object, such as a particular book or your favorite coffee mug? Or are you trying to detect members of broad categories of objects, such as faces, cars, people, or chairs? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does your method need to be invariant to in-plane rotation?  The answer is probably &quot;no&quot; for faces, which are rarely upside down, but &quot;yes&quot; for detecting cars in aerial images.  There are many more questions like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my point is that object detection, let alone recognition, is a broad area, and it is best to talk to your adviser about scoping it down.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-09-22T19:19:21.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18315" PostTypeId="1" CreationDate="2014-09-22T20:26:49.120" Score="1" ViewCount="78" Body="&lt;p&gt;&lt;em&gt;How to constrain the object detection problem?&lt;/em&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be tempting to ask for precision such as: &quot;It depends, does it have to be viewpoint invariant, is there going to be viewpoint changes, etc.?&quot; Actually, it is exactly what I want to know. I have a specific application in mind and I need a structured way to help me constrain and define correctly the problem. I am pursuing a graduate degree but I am new to the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, at first I read the literature about things such as binary keypoint descriptor, etc. but in the end, I am putting the cart before the horse, not having constrained my problem correctly, I cannot know or prove whether binary keypoint descriptors or else are a good starting point for my application...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately my adviser is unavailable for a week or two and my colleagues are not specialized in that field.&lt;/p&gt;&#xA;" OwnerUserId="9090" LastEditorUserId="9090" LastEditDate="2014-09-23T13:21:41.910" LastActivityDate="2014-09-23T13:35:21.703" Title="How to constrain the object detection problem?" Tags="|computer-vision|object-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18316" PostTypeId="1" AcceptedAnswerId="18356" CreationDate="2014-09-23T00:50:01.820" Score="4" ViewCount="437" Body="&lt;p&gt;so, first let's do this for the circular correlation case (it might be easier).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let's say we have three real and periodic functions or signals $x(t)$, $y(t)$, $z(t)$ all with period $2 \pi$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t+2\pi) = x(t) \quad \forall t $$&#xA;$$ y(t+2\pi) = y(t) \quad \forall t $$&#xA;$$ z(t+2\pi) = z(t) \quad \forall t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define the cross-correlation between any two, say $x(t)$ and $y(t)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{xy}(\tau) \triangleq \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} x(t) y(t+\tau) \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let's say that the maximum value of $R_{xy}(\tau)$ occurs at $\tau=\tau_{xy}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{xy}(\tau_{xy}) &amp;gt; R_{xy}(\tau) \quad \forall \tau \in (\tau_{xy},\tau_{xy}+2\pi) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(since $x(t)$, $y(t)$, and $z(t)$ are all periodic with period $2 \pi$, so also are any cross-correlation between any pair.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{xy}(\tau_{xy}) = R_{xy}(\tau_{xy} + k \ 2\pi) \quad \forall k \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so here's the question: except for a difference of some multiple of $2\pi$, is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tau_{xz} = \tau_{xy} + \tau_{yz}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tau_{xz} = \tau_{xy} + \tau_{yz} + k \ 2\pi $$ for some integer $k$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i think this should be true, but it would be nice if it is proved to be so.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-09-25T21:46:43.503" LastActivityDate="2014-09-28T10:31:21.947" Title="&quot;cascaded&quot; cross-correlation" Tags="|cross-correlation|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18317" PostTypeId="1" CreationDate="2014-09-23T01:06:41.557" Score="1" ViewCount="411" Body="&lt;p&gt;I hear the word warp a lot, but cannot quite get a feel for what it really means&lt;br&gt;&#xA;I suppose it's literal meaning would be to change in shape, but what does it mean with respect to DSP?&lt;br&gt;&#xA;More specifically, I have a DSP chip manual that says a certain parameter &lt;code&gt;adjusts warp for DACs&lt;/code&gt; and another one that &lt;code&gt;adjusts warp for ADCs&lt;/code&gt;. What does warp mean in this context?&lt;br&gt;&#xA;If possible, please explain it without technical jargon.&lt;/p&gt;&#xA;" OwnerUserId="3121" LastEditorUserId="3121" LastEditDate="2014-09-23T01:26:28.890" LastActivityDate="2014-09-23T01:38:05.033" Title="What does &quot;warp&quot; mean in DSP?" Tags="|terminology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18318" PostTypeId="2" ParentId="18317" CreationDate="2014-09-23T01:20:24.900" Score="1" Body="&lt;p&gt;I've never really heard of &quot;warp&quot; regarding ADCs or DACs, but I imagine it's because the analog-to-digital (or vise versa) mapping function, which is supposed to be linear, a straight line, is curved slightly due to variation in parts.  I don't see how this would happen with sigma-delta ADCs or DACs (unless the summer at the input with the delta feedback is non-linear).  but with an R-2R DAC, if the R's aren't all perfectly the same, the digital-to-analog mapping function will not be a straight line.  For a flash ADC, if all of the resistors in the voltage divider line are not all perfectly equal, that analog-to-digital mapping function will also not be linear and would be &quot;warped&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, somehow, one can measure or determine the &quot;warpness&quot; of the mapping function, I suppose it can be compensated in the DSP software.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="3121" LastEditDate="2014-09-23T01:38:05.033" LastActivityDate="2014-09-23T01:38:05.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18319" PostTypeId="1" CreationDate="2014-09-23T05:51:59.753" Score="1" ViewCount="1663" Body="&lt;p&gt;On Video recording with IR camera, a file in .ptw is obtained. I want to analyze the file using standard software, like MATLAB. However, video processing in MATLAB requires the file to be converted to some standard formats like .avi or .mp4 or .wmv files. Please provide a way to make similar conversions, with the help of a software tool or any matlab function etc.&lt;/p&gt;&#xA;" OwnerUserId="7328" LastActivityDate="2017-10-28T00:30:20.120" Title=".ptw Video conversion" Tags="|matlab|computer-vision|video-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18320" PostTypeId="1" CreationDate="2014-09-23T10:29:17.220" Score="0" ViewCount="401" Body="&lt;p&gt;I am measuring wind speed using a number of different anemometers. These anemometers are placed on a structure which exhibits sinusoidal motion. Thus, the signal of the anemometers contains both the wind speed as well as the sine wave to which they were exposed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to accurately determine the amplitude of the sine wave from the anemometer signal. Thus, I decided to use a flat-top window when calculating the FFT. However, since the signal is 'noisy' the resulting amplitude of the sine wave is not correct. Sometimes, the amplitude given on the spectrum is greater than the actual amplitude of the sine wave!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am considering using Welch's overlapped method (pwelch in MATLAB). Can someone please tell me whether such a method is suitable for my application? I have read that this method should only be used with stationary signals? I am confused whether my signal is considered as stationary. Can someone please help me? Thanks. &lt;/p&gt;&#xA;" OwnerUserId="10881" LastEditorUserId="10881" LastEditDate="2014-09-23T10:53:50.480" LastActivityDate="2014-09-23T10:53:50.480" Title="Welch's Overlapped Method" Tags="|fft|power-spectral-density|window|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18321" PostTypeId="1" AcceptedAnswerId="18322" CreationDate="2014-09-23T11:46:34.877" Score="0" ViewCount="680" Body="&lt;p&gt;I am currently struggling with a problem when calculating the instantaneous phase of a wavefield using a &lt;strong&gt;1D Hilbert transformation&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scheme is as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1D Hilbert transformation of wave field $U(x,z)$&lt;/strong&gt;&#xA;$$&#xA;q_z(x,z) = H_z[U(x,z)] = \int_R U(x-\xi,z)\frac{d\xi}{\xi}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Calculation of the instantaneous phase $\phi(x,z)$&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\phi(x,z) = arctan\left(\frac{q_z(x,z)}{U(x,z}\right),&#xA;$$&#xA;where $x$ and $z$ are the coordinates and $H_z$ is the 1D Hilbert transformation over the vertical direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is, that $\phi(x,z)$ which is implemented using the intrinsic function $atan2()$ contains phase shifts [$\pi \rightarrow -\pi$].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the instantaneous phase for further calculations in which its gradient is derived hence leads to imaging artifacts as shown in the attached pictures:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TOP LEFT:&lt;/strong&gt; input wavefield $U(x,z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TOP RIGHT:&lt;/strong&gt; Hilbert transformed wavefield $q_z(x,z) = H_z[U(x,z)]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BOTTOM LEFT:&lt;/strong&gt; instantaneous phase $\phi(x,z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BOTTOM RIGHT:&lt;/strong&gt; derived propagation angle with artifacts&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; I am able to overcome this problem using Gauss filtering or Median filtering. Yet this does not wotrk properly for more complicated wavefields and higher frequencies. Is there another way to overcome those sharp transitions in the area of my wavefield? (not the noise around)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks alot!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/51ZrL.jpg&quot; alt=&quot;(left) input wavefield (right) Hilbert transformed wavefield&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/LPfy6.jpg&quot; alt=&quot;(left) instantaneous phase phi (right) derived propagation angle using the gradient of the instantaneous phase&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8071" LastActivityDate="2014-09-23T12:30:27.023" Title="Instantaneous phase calculation problems" Tags="|phase|wave|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18322" PostTypeId="2" ParentId="18321" CreationDate="2014-09-23T12:30:27.023" Score="1" Body="&lt;p&gt;One way to overcome this problem is &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Phase_Unwrapping.html&quot; rel=&quot;nofollow&quot;&gt;phase unwrapping&lt;/a&gt;, which is also implemented by the Matlab function &lt;code&gt;unwrap&lt;/code&gt;. But I believe that the best option for obtaining the derivative of the phase is to avoid a direct computation, but instead start out from the complex function itself. To simplify notation, let's use $U$ (without arguments):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$U=re^{j\phi}=a+ib$$&#xA;where $r$ is the magnitude and $\phi$ is the phase. The derivative of $U$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$U'=r'e^{j\phi}+rj\phi'e^{j\phi}\\&#xA;\frac{U'}{U}=\frac{r'}{r}+j\phi'$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $r'/r$ is real-valued, we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi'=\text{Im}\left\{\frac{U'}{U}\right\}=\frac{ab'-a'b}{a^2+b^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ and $b$ are the real and imaginary parts of $U$, respectively. Using (1) instead of a direct derivative of the phase should solve the problem.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-23T12:30:27.023" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18323" PostTypeId="1" AcceptedAnswerId="18333" CreationDate="2014-09-23T13:19:57.097" Score="0" ViewCount="2095" Body="&lt;p&gt;I am making a 9th order digital bandpass filter with lower and upper corners of 200 kHz and 40 MHz respectively. I am using this filter to filter a 1D time domain signal which is 64k samples long sampled at a frequency of 150MHz.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done some digital filtering before in university, so I know what to expect, but it's been a while. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used this site: &lt;a href=&quot;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&quot; rel=&quot;nofollow&quot;&gt;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&lt;/a&gt;&#xA;to generate the filter coefficients and the gain, and I can see how the code works, my question is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I start with the value of X[0], then to calculate the value of Y[0] I need values for Y[-1] ... Y[-18] and x[-1] ... X[-18]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know these do not exist, so I think (from what I remember from university) that I pad with zeros, however, doing a bit or reading I heard it mentioned that padding with zeros changes the sampling frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I go about calculating this new sampling frequency (if indeed required..)?    &lt;/p&gt;&#xA;" OwnerUserId="11171" LastActivityDate="2014-09-24T10:50:07.173" Title="Implementing digital filter by padding with zeros" Tags="|filter-design|bandpass|zero-padding|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18324" PostTypeId="2" ParentId="18315" CreationDate="2014-09-23T13:35:21.703" Score="2" Body="&lt;p&gt;A long time ago I have come across a very good advice: research should be problem-oriented, not approach oriented. That means find a problem you want to solve, and then look for appropriate methods.  Not the other way around. So, I would recommend starting with a specific problem, such as a real-world application.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, maybe you want to build a system with a camera looking at your bookshelf, which detects a particular book.  Or maybe you want to build a mobile robot with a camera, which can follow you around.  Or a video player program, which detects whether you are looking at your computer screen, and pauses the video when you look away (some cell phones do that now).  Or a program that can organize your photo collection by detecting and recognizing people, and maybe landmarks, like the Eiffel Tower.  The possibilities are endless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the algorithm is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find a real-world vision problem that you find interesting.&lt;/li&gt;&#xA;&lt;li&gt;Make as many restrictive assumptions as you can to scope it down and still keep it interesting.&lt;/li&gt;&#xA;&lt;li&gt;Start reading papers to find applicable algorithms.&lt;/li&gt;&#xA;&lt;li&gt;Understand the limitations of existing algorithms, and come up with your own ideas to address them.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-09-23T13:35:21.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18326" PostTypeId="2" ParentId="471" CreationDate="2014-09-23T16:26:06.387" Score="1" Body="&lt;p&gt;i dunno why the original DSP &quot;blog&quot; (it's actually more of a BBS) on USENET is not mentioned.  that is the newsgroup &lt;em&gt;comp.dsp&lt;/em&gt; .  one can get it the traditional way (an NNTP server like &lt;a href=&quot;http://www.eternal-september.org/&quot; rel=&quot;nofollow&quot;&gt;Eternal September&lt;/a&gt;) but you will need a mail client that knows how to do NNTP (the one i am using is Thunderbird) or with &lt;a href=&quot;https://groups.google.com/forum/#!forum/comp.dsp&quot; rel=&quot;nofollow&quot;&gt;Google Groups&lt;/a&gt; which has gotten progressively suckier as time rolls on.  &lt;a href=&quot;http://www.dsprelated.com/&quot; rel=&quot;nofollow&quot;&gt;DSP Related&lt;/a&gt; (mentioned above) also has a port to &lt;em&gt;comp.dsp&lt;/em&gt;.  the newsgroup is unmoderated so sometimes we just shoot the shit and discuss life (sometimes through the engineering lens).&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-09-23T16:26:06.387" CommentCount="0" CommunityOwnedDate="2014-09-23T16:26:06.387" ContentLicense="CC BY-SA 3.0" />
  <row Id="18327" PostTypeId="1" CreationDate="2014-09-23T18:48:06.380" Score="1" ViewCount="357" Body="&lt;p&gt;I am looking for a treatment of fundamental DSP theory where only discrete/finite signal models are used. To make a concrete example, every time standard textbooks write a convolution as a continuous integral, I would like to see instead a product between a Toeplitz matrix and a vector. It seems to me that developing such a theory from linear algebra would make implementing concrete DSP algorithm much easier. Think also of multirate/filter banks, etc... Except maybe for the book of Strang on Wavelets I have not seen any other book based this approach. Any book titles I have missed?  &lt;/p&gt;&#xA;" OwnerUserId="1696" LastActivityDate="2014-09-23T19:14:26.207" Title="Looking for integral-free DSP textbooks" Tags="|linear-algebra|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18328" PostTypeId="2" ParentId="18327" CreationDate="2014-09-23T19:14:26.207" Score="6" Body="&lt;p&gt;I would like to recommend a great book to you (see below), but before that I would like to point out that there is some confusion in your question. If you see a convolution integral in a textbook, then this refers to the convolution of two continuous time signals, which can't be represented by a matrix/vector multiplication. You must be referring to the convolution of two sequences (discrete-time signals), but this convolution is always written as an infinite sum (and not as an integral). For finite length sequences, this sum can indeed be written as a (finite) matrix/vector product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book I was referring to is the excellent (and free!) book &lt;em&gt;&lt;a href=&quot;http://www.fourierandwavelets.org/FSP_v1.1_2014.pdf&quot;&gt;Foundations of Signal Processing&lt;/a&gt;&lt;/em&gt; by Vetterli et al. It also stresses (among many other things) the matrix view of linear operators on sequences. I'm especially referring to chapter 3 ('sequences and discrete-time systems'), but I would actually recommend to read the whole book if you want a thorough and modern treatment of signal processing. Disclaimer: the book is not integral-free, but this shouldn't put you off, just give it a try.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-23T19:14:26.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18329" PostTypeId="1" CreationDate="2014-09-24T02:32:53.043" Score="2" ViewCount="1179" Body="&lt;p&gt;I'm trying to create a digital filter in code(C) but any language is fine. Now I've got an analogue filter that I have represented by an equation in the Laplace domain and I want to try and implement it digitally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my filter has this form in the Laplace domain:&#xA;$$\frac{as+b}{cs^2+ds}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then use MATLAB's &lt;code&gt;c2d&lt;/code&gt; command which uses the zero order hold transformation (I have a really poor grasp on this, so this might be wrong) and it gives me this formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\left(5\cdot 10^5\right)z-67}{z^2-z}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried following an &lt;a href=&quot;http://liquidsdr.org/blog/pll-howto/&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; that I found that used the Tustin's method, though when I use the &lt;code&gt;c2d&lt;/code&gt; function in MATLAB with Tustin it gives me an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt has been&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{hz-i}{jz^2-kz}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$b_0=-i, b_1=h, b_2=0, a_0=0, a_1=-k, a_2=j$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then from this I've tried (which is wrong) &#xA;\begin{align}&#xA;\text{output}&amp;amp;=z_0 b_0+z_1b_1+z_2b_2\\&#xA;z_2&amp;amp;=z_1\\&#xA;z_1&amp;amp;=z_0\\&#xA;z_0&amp;amp;=\text{input}-a_0z_0-a_1z_1-a_2z_2&#xA;\end{align}&lt;/p&gt;&#xA;" OwnerUserId="11020" LastEditorUserId="1629" LastEditDate="2016-04-05T15:01:37.833" LastActivityDate="2018-01-26T13:22:22.777" Title="Creating a digital filter, from Laplace to $\mathcal Z$-transform (zero order hold) to code?" Tags="|filter-design|digital|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18330" PostTypeId="1" CreationDate="2014-09-24T03:27:47.700" Score="1" ViewCount="10" Body="&lt;p&gt;The code in &lt;a href=&quot;http://www.acsu.buffalo.edu/~johnc/second_ed/chapter1/example1_2.m&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; solves the Least Squares problem for the following dynamic model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dot{y}=ay+bu$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ and $b$ are constants, $u$ is an input. The code is as follow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=[0:0.1:10];&#xA;m=length(t);&#xA;y=zeros(m,1);&#xA;a=-1;b=1;c=1;d=0;u=[100;zeros(m-1,1)]; % u: impulse with magnitude of 100&#xA;[ad,bd]=c2d(a,b,0.1);&#xA;y=dlsim(ad,bd,c,d,u);&#xA;ym=y+0.08*randn(m,1); %adding Gaussian noise&#xA;&#xA;w=inv(0.08^2);&#xA;h=[ym(1:m-1) u(1:m-1)];&#xA;xe=inv(h'*w*h)*h'*w*ym(2:m)&#xA;&#xA;ye=dlsim(xe(1),xe(2),c,d,u);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's is not clear to me is why $a=-1$ and $b=1$. The model as given does not specify a value for either of $a$ and $b$. ($c=1$ and $d=0$ are fine, however).&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="8825" LastEditDate="2014-09-24T03:40:03.330" LastActivityDate="2014-09-24T03:40:03.330" Title="State Space model of a differential eqn. for use in Least Squares" Tags="|state-space|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18331" PostTypeId="1" CreationDate="2014-09-24T06:03:48.223" Score="3" ViewCount="280" Body="&lt;p&gt;I am having a comparison of different feature detection methods. So if we compare the SIFT (Scale-invariant feature transform) and Shi-Tomasi method, will their feature locations agree and why? Are they comparable? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="11175" LastActivityDate="2014-09-25T18:04:07.033" Title="Would the locations of SIFT features generally agree with features detected by Shi-Tomasi method?" Tags="|image-processing|computer-vision|sift|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18332" PostTypeId="1" CreationDate="2014-09-24T10:23:48.737" Score="0" ViewCount="38" Body="&lt;p&gt;I am trying to add a few samples for a publication on identification of clean signal from the one which has echo on it. For this purpose I need data set that includes playback of an already available signal in a big room/hall and the recording of the signal with a mic in this hall that includes the echo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know of any available online source for such data samples.&lt;/p&gt;&#xA;" OwnerUserId="9065" LastActivityDate="2014-09-24T13:42:54.923" Title="Available Online Recordings for Acoustic Echo Identifiablity" Tags="|audio|reference-request|deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18333" PostTypeId="2" ParentId="18323" CreationDate="2014-09-24T10:50:07.173" Score="1" Body="&lt;p&gt;Zero padding your input signal does not change your sampling frequency, it just changes (in this case probably very slightly) the time duration of your input signal.  An example would be that whether you filter one second's worth of data or two second's worth of data doesn't have any impact on the sampling frequency of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to keep in mind is that there will be a start up transient when zero-padding because your input signal instantaneously goes from zero to the value of the signal, essentially applying a step function on top of your signal of interest.  Generally speaking, you'll want to make sure you have some amount of data before a feature you're really interested in to make sure the start up effects have sufficient time to decay.  The website you mention gives the step response of the generated filter so you can check to see what effect it will have on your signal of interest.&lt;/p&gt;&#xA;" OwnerUserId="11146" LastActivityDate="2014-09-24T10:50:07.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18334" PostTypeId="2" ParentId="18332" CreationDate="2014-09-24T13:27:12.297" Score="1" Body="&lt;p&gt;I don't know of any online recordings, but you could try using the &lt;a href=&quot;http://www.silophone.net/eng/play/index.html&quot; rel=&quot;nofollow&quot;&gt;Silophone player&lt;/a&gt; to create some.  Play your original file, then record what the silophone plays back.&#xA;&lt;a href=&quot;http://www.silophone.net/&quot; rel=&quot;nofollow&quot;&gt;Silophone homepage&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Silophone uses an old grain silo as an echo chamber.  It also plays the echoed audio locally over a speaker outside the silo, so you might want to avoid using anything obnoxious or private or copyrighted.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-09-24T13:42:54.923" LastActivityDate="2014-09-24T13:42:54.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18335" PostTypeId="2" ParentId="18331" CreationDate="2014-09-24T14:24:22.113" Score="3" Body="&lt;p&gt;Probably not. The SIFT detector finds centers of blob-like features. Shi-Tomasi detector finds corners. Furthermore, SIFT detector operates at multiple scales, while the classic Shi-Tomasi does not.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-09-24T14:24:22.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18336" PostTypeId="2" ParentId="18316" CreationDate="2014-09-24T16:12:22.590" Score="0" Body="&lt;p&gt;i'm gonna &lt;em&gt;start&lt;/em&gt; answering the question.  actually, i am &lt;em&gt;exploring&lt;/em&gt; an answer.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, first, think of this in terms of an Inner Product Space or Hilbert Space (but in this case there are no complex conjugates that those familiar with Hilbert Spaces might miss).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let $\mathbf{x}$ be the point or element in that space that is fully defined by the real and periodic function $x(t)$ where $x(t+2\pi)=x(t) \quad \forall t$.  if i remember correctly Hilbert Spaces are also Normed Linear Spaces (Banach Spaces).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there's an inner product&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \langle \mathbf{x}, \mathbf{y} \rangle \triangleq \int\limits_{-\pi}^{\pi} x(t) y(t) \ dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a norm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \| \mathbf{x} \| = \sqrt{ \langle \mathbf{x}, \mathbf{x} \rangle } $$&#xA;$$ \| \mathbf{x} \|^2 = \langle \mathbf{x}, \mathbf{x} \rangle $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the distance that $\mathbf{x}$ is from the $\mathbf{0}$ element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there are distance metrics between two points.  the more general distance function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;\| \mathbf{x}-\mathbf{y} \| &amp;amp; = \sqrt{\| \mathbf{x}-\mathbf{y} \|^2} \\&#xA;&amp;amp; = \sqrt{ \langle \mathbf{x}-\mathbf{y}, \mathbf{x}-\mathbf{y} \rangle } \\&#xA;&amp;amp; = \sqrt{ \langle \mathbf{x}, \mathbf{x}-\mathbf{y} \rangle - \langle \mathbf{y}, \mathbf{x}-\mathbf{y} \rangle } \\&#xA;&amp;amp; = \sqrt{ \langle \mathbf{x}, \mathbf{x} \rangle + \langle \mathbf{y}, \mathbf{y} \rangle - 2 \langle \mathbf{x}, \mathbf{y} \rangle } \\&#xA;&amp;amp; = \sqrt{ \| \mathbf{x} \|^2 + \| \mathbf{y} \|^2 - 2 \langle \mathbf{x}, \mathbf{y} \rangle } \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what this means is that, as long as the norms of $\mathbf{x}$ and $\mathbf{y}$ remain constant, the distance between $\mathbf{x}$ and $\mathbf{y}$ is minimized when the inner product between the two is maximized.  and vise versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so now let's generalize $\mathbf{x}$ or $\mathbf{y}$ or $\mathbf{z}$ a little more.  the point $\mathbf{x}$ corresponds to the periodic $x(t)$ and $\mathbf{y}$ corresponds to $y(t)$.  another point in this Hilbert space, we'll call $\mathbf{x}(\tau)$ corresponds to the periodic function $x(t+\tau)$, and naturally $\mathbf{y}(\tau)$ corresponds to $y(t+\tau)$.  so as $\tau$ moves from $0$ to $2\pi$, $\mathbf{y}(\tau)$ traces out a curve (what we used to call a parametric line curve) in this Hilbert space that is a closed curve, because $\mathbf{y}(2\pi) = \mathbf{y}(0) = \mathbf{y}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that no matter what real value $\tau$ is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \| \mathbf{y}(\tau) \| = \| \mathbf{y} \| . $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means that all of the points on this closed curve are equal distance from the origin $\mathbf{0}$ no matter what $\tau$ is.  and the same is true for $\mathbf{x}(\tau)$ and $\mathbf{z}(\tau)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, without loss of generality, i think we can assume that $\tau_{xy}$ and $\tau_{yz}$ are zero, for which we then have to prove that $\tau_{xz}=0$ ($\pm k 2 \pi$, which i'm not gonna worry about).  that means that the distance that $\mathbf{x}(0)$ is from $\mathbf{y}(0)$ is less than the distance $\mathbf{x}(0)$ is from $\mathbf{y}(\tau)$ for any other $\tau \ne k 2 \pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but this curve $\mathbf{x}(\tau)$ is parallel in some sense to the curve $\mathbf{y}(\tau)$ because we know that $\mathbf{x}(\tau_1)$ is closest to the point $\mathbf{y}(\tau_1)$ and $\mathbf{x}(\tau_2)$ is closest to the point $\mathbf{y}(\tau_2)$ for any values of $\tau_1$ and $\tau_2$ for the same reason that $\mathbf{x}(0)$ is closest to the point $\mathbf{y}(0)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the same can be said of the curves $\mathbf{y}(\tau)$ and $\mathbf{z}(\tau)$ because of the assumption $\tau_{yz}=0$ which means that the distance that $\mathbf{y}(0)$ is from $\mathbf{z}(0)$ is less than the distance $\mathbf{y}(0)$ is from $\mathbf{z}(\tau)$ for any other $\tau \ne k 2 \pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, somehow, in a formal manner, can't we say that if $\mathbf{y}(0)$ is the element of $\mathbf{y}(\tau)$ closest to $\mathbf{x}(0)$ and $\mathbf{z}(0)$ is the element of $\mathbf{z}(\tau)$ that is closest to $\mathbf{y}(0)$, doesn't this mean that $\mathbf{z}(0)$ is the element of $\mathbf{z}(\tau)$ closest to $\mathbf{x}(0)$??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can we make this into a decent proof?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as you can see, i am willing to pay some bounty to whomever can help me formalize this (or to persuasively disprove my reasoning above).&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-09-25T21:36:26.537" LastActivityDate="2014-09-25T21:36:26.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18337" PostTypeId="2" ParentId="9855" CreationDate="2014-09-24T16:21:18.023" Score="0" Body="&lt;p&gt;cross spectral match 2 audio wav&lt;img src=&quot;https://i.stack.imgur.com/MV9kT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/llpassarelli/cross_spec_lab&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/llpassarelli/cross_spec_lab&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11181" LastActivityDate="2014-09-24T16:21:18.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18338" PostTypeId="2" ParentId="18316" CreationDate="2014-09-24T16:58:02.877" Score="1" Body="&lt;p&gt;if you don't like the language of the metric spaces (i am not sure i do either), another way to look at this is besides defining the cross correlation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{xy}(\tau) \triangleq \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} x(t) y(t+\tau) \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can define this &lt;em&gt;&quot;distance measure&quot;&lt;/em&gt; (it's actually the ASDF, &lt;em&gt;Average Squared Difference Function&lt;/em&gt;, a variant of the AMDF or &lt;em&gt;Average Magnitude Difference Function&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Q_{xy}(\tau) \triangleq \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} \left( x(t) - y(t+\tau) \right)^2 \ dt \ge 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then neat thing is that delaying $y(t)$ by $\tau$, doesn't change its power or &quot;norm&quot;.  so this is true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;Q_{xy}(\tau) &amp;amp; = \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} \left( x(t) - y(t+\tau) \right)^2 \ dt \\&#xA;&amp;amp; = \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} x^2(t) + y^2(t+\tau) - 2 x(t)y(t+\tau)  \ dt \\&#xA;&amp;amp; = \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} x^2(t) \ dt + \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} y^2(t+\tau) \ dt - 2 \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} x(t)y(t+\tau)  \ dt \\&#xA;&amp;amp; = \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} x^2(t) \ dt + \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} y^2(t) \ dt - 2 \frac{1}{2\pi} \int\limits_{-\pi}^{\pi} x(t)y(t+\tau) \ dt \\&#xA;&amp;amp; = R_{xx}(0) + R_{yy}(0) - 2 R_{xy}(\tau) \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{xy}(\tau) = \frac{R_{xx}(0) + R_{yy}(0)}{2}  - \frac{1}{2} Q_{xy}(\tau) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;again, because spinning $y(t)$ by a time of $\tau$ does not change its power (which is $R_{yy}(0)$), $R_{xy}(\tau)$ is maximized when $Q_{xy}(\tau)$ is minimized.  so we are at the same place we are in the other answer.  not yet complete, but this is the direction i am going with it.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-09-24T16:58:02.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18339" PostTypeId="2" ParentId="16435" CreationDate="2014-09-24T17:13:13.957" Score="1" Body="&lt;p&gt;This is not a complete answer (I would comment directly your question but not allowed to due to rep), but you could look at &quot;Learning and detecting shape models v1.3 (September 2009)&quot; (&lt;a href=&quot;http://groups.inf.ed.ac.uk/calvin/software.html&quot; rel=&quot;nofollow&quot;&gt;http://groups.inf.ed.ac.uk/calvin/software.html&lt;/a&gt;). The paper's name is: &quot;From images to shape models for object detection&quot; by Ferrari, Jurie &amp;amp; Schmid&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to learn a contour based model of object which is then possible to deform. Actually, you have to segment a &lt;em&gt;little bit&lt;/em&gt; by providing simply bounding boxes (x-y coordinates of the top-left and bottom-right corner) of the object in the training images. You may also use training images that are already cropped around the object which you want to learn the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried their Matlab implementation and creating the bounding boxes for my training images was about as fast as manually cropping them in Gimp or else...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; BTW, if you wonder how to create groundtruth files with this program, I used a text editor such as &quot;Notepad++&quot; to create a text file. In the file, I wrote, separated by spaces, the coordinates of the bounding box, e.g.:&quot; 10 33 572 458 &quot; (no quote) then saved the file with an appropriate name (check how they do for their sample files) with the dummy extension &quot;.groundtruth&quot;, their Matlab implementation will recognize the files.&lt;/p&gt;&#xA;" OwnerUserId="9090" LastEditorUserId="9090" LastEditDate="2014-09-24T17:44:10.363" LastActivityDate="2014-09-24T17:44:10.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18340" PostTypeId="2" ParentId="16842" CreationDate="2014-09-24T18:05:22.207" Score="2" Body="&lt;p&gt;If I could add something to @user4619's great answer (not yet allowed to comment so... ;) ), I would say that object detection is also often about providing the &lt;em&gt;location&lt;/em&gt; of the object. While I think I have come through the expression &quot;object localization&quot; at least once in the literature, I have seen more often &quot;object detection&quot; for locating some object in a given image. Some methods are able to provide only the presence/absence of the object, others are able to give the coordinates of a &quot;centroid-like&quot; feature of the object and some methods provide even the boundaries of the object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though, what was said before is still true and a pretty relevant explanation (maybe I could suggest the OP to mark the answer as correct if it is satisfying to him/her?)&lt;/p&gt;&#xA;" OwnerUserId="9090" LastActivityDate="2014-09-24T18:05:22.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18341" PostTypeId="1" AcceptedAnswerId="18346" CreationDate="2014-09-24T20:50:23.673" Score="2" ViewCount="8011" Body="&lt;p&gt;I have written the following code which is supposed to put echo over an available sound file. Unfortunately the output is a very noisy result which I don't exactly understand. Can anybody help me with regard to this? Is there any skipped step?&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#convolving a room impulse response function with a sound sample both of stereo type&#xA;from scipy.io import wavfile&#xA;inp = wavfile.read(sound_path + sound_file_name)&#xA;IR = wavfile.read(IR_path + IR_file_name)&#xA;if inp[0] != IR[0]:&#xA;    print &quot;Size mismatch&quot;&#xA;    sys.exit(-1)&#xA;else:&#xA;    rate = inp[0]&#xA;print sound_file_name&#xA;out_0 = fftconvolve(inp[1][:, 1], IR[1][:, 1])&#xA;out_1 = fftconvolve(inp[1][:, 1], IR[1][:, 1])&#xA;in_counter += 1&#xA;out = np.vstack((out_0, out_1)).T&#xA;wavfile.write(sound_path + sound_file_name + '_echoed.wav', rate, out)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9065" LastEditorUserId="29" LastEditDate="2014-09-25T14:03:02.087" LastActivityDate="2020-05-30T17:22:50.170" Title="Convolving Room Impulse Response with a Wav File (python)" Tags="|convolution|impulse-response|acoustics|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18342" PostTypeId="1" CreationDate="2014-09-25T02:47:41.503" Score="1" ViewCount="282" Body="&lt;p&gt;We know that OFDM eliminates the inter-block intereference. But there are still multipath interference in a single OFDM block(symbol). How does LTE handle this intra-block interference induced by multipath components so as to successfully demod. the signal ?&lt;/p&gt;&#xA;" OwnerUserId="7285" LastActivityDate="2017-04-30T08:20:57.690" Title="OFDM intra-block multipath interference" Tags="|ofdm|multipath|fading-channel|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18343" PostTypeId="1" CreationDate="2014-09-25T06:24:11.833" Score="5" ViewCount="522" Body="&lt;p&gt;I was actually preparing for my semester project and decided to take up Frequency estimation. I ll directly come to the point that I want to know how should I learn &lt;a href=&quot;http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/www/node5.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MUSIC&lt;/a&gt; algorithm. How do I start it? What are the pre-requisites? Do I need to learn any specific mathematics?&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="11185" LastEditorUserId="7092" LastEditDate="2021-07-15T17:51:20.150" LastActivityDate="2021-07-15T17:51:20.150" Title="How to learn MUSIC algorithm?" Tags="|discrete-signals|signal-analysis|frequency-spectrum|estimation|spatial|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18344" PostTypeId="1" AcceptedAnswerId="18345" CreationDate="2014-09-25T09:14:36.593" Score="1" ViewCount="145" Body="&lt;p&gt;I have 2 data sets sampled at regular intervals which represent the input and the output of a system. A quick analysis of the plots shows the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is a proportional factor between the input and the output.&lt;/li&gt;&#xA;&lt;li&gt;There is a delay before a change in the input is observable in the output. This delay depends on the scale of the change: larger changes in the input are observable in the output after a longer delay than smaller changes in the input.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would like to approximate the system with a function, but I am novice in signal processing and I have no idea how to get started. I don't even know if this is a solvable problem. Any idea? I am comfortable using Matlab/Octave, and computer programming in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get more data from the system if required, but I cannot control the input. This is because the system is only observable when a PID controller keeps it stable.&lt;/p&gt;&#xA;" OwnerUserId="11187" LastActivityDate="2014-09-25T10:17:16.093" Title="Characterising a system from its input and output" Tags="|matlab|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18345" PostTypeId="2" ParentId="18344" CreationDate="2014-09-25T10:17:16.093" Score="0" Body="&lt;p&gt;Use the matlab cpsd (cross power spectral density) function on your two signals.&lt;br&gt;&#xA;That will give you the frequency response.&lt;br&gt;&#xA;Do an xcorr (cross correlation) to find the time delay between the two signals.&lt;br&gt;&#xA;Do this for several pairs of input and output files and see if the results match between different pairs.&lt;br&gt;&#xA;If they are (reasonably) similar then you could create an FIR filter that reproduces the frequency response and delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then apply the filter to a set of input data to approximate the expected output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a PID controller in the middle, however,  I don't know if this procedure will be enough.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-09-25T10:17:16.093" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18346" PostTypeId="2" ParentId="18341" CreationDate="2014-09-25T13:09:29.190" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;The way you read the files is a little odd.  The method &lt;a href=&quot;http://nbviewer.ipython.org/github/mgeier/python-audio/blob/master/audio-files/audio-files-with-scipy-io.ipynb&quot; rel=&quot;nofollow&quot;&gt;used here&lt;/a&gt; is clearer with respect to the sampling rate and the signal.&lt;/li&gt;&#xA;&lt;li&gt;You will note that the above example calls pcm2float after reading.  This may be the cause of your problem.  The wave reader returns an array of ints.  Processing those (quite large) values may well cause problems.  Try converting your wave data to floats before doing the convolution.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-09-25T13:09:29.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18347" PostTypeId="2" ParentId="18274" CreationDate="2014-09-25T14:10:11.913" Score="1" Body="&lt;p&gt;First, on distinguishing low contrast features from noise, then on a possible alternate course of action to solve what I &lt;em&gt;think&lt;/em&gt; you are trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my experience, distinguishing between noise and low contrast features is a hard thing to do. The problem arises quite often when you try to do edge detection on an image. Using the most common algorithms such as Canny, Sobel, LoG, etc. generally results in a good deal of noise, which is dependant of the parameters you set (e.g.: a 'threshold' needs to be set (chosen) in order to define at which intensity value an edge-candidate pixel is classified as part of the edge or not, so what if the noise is more 'intense' than the correct edge?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what's the point with stereo correspondence/disparity? Some scholars tackled on the problem of noisy edge detection and there is right now a pretty good edge detector, namely the Berkeley edge detector, which use machine learning techniques to 'improve' the edge detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are 3 images, left is original, centre is with Canny edge and right is with Berkeley. (Images credit: ETHZ-Shape-Class Dataset)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4IUa2.jpg&quot; alt=&quot;ETHZ-Shape-Classes&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J3QFH.jpg&quot; alt=&quot;ETHZ-Shape-Classes-Canny&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kk4Za.jpg&quot; alt=&quot;ETHZ-Shape-Classes-Berkeley&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that (while maybe some tuning could have been done on Canny) Berkeley is providing a 'better' (less noisy) edgemap than Canny.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you could see that there are techniques that you could possibly try to adapt in order to tell the salient features from the noise. I can't guaranty it will work since I haven't done it myself. Also, please note that these machine learning algorithms are pretty &lt;em&gt;slow&lt;/em&gt; which prevent their use in realtime processing of images.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This said, what you really want to do is measure the dissimilarity between the to images by mean of correlation techniques, which was not successful apparently. Let me tell you about what is known as keypoint-descriptors. You could read on this topic &lt;a href=&quot;https://dsp.stackexchange.com/questions/10423/why-do-we-use-keypoint-descriptors&quot; title=&quot;there&quot;&gt;there&lt;/a&gt;. The broad idea is to be able to evaluate the correspondence of some (a lot of) features between two images. It is often used in object detection (where you want to find the presence and location of a certain object in an input image) or in image stitching (such as panoramas maker, where you want to 'align' two or more images). Now, how can you tell that you have two images corresponding to the same object? These methods using keypoint-descriptors are, in the end, giving a &lt;em&gt;measure of similarity&lt;/em&gt; between both images. Actually, lots of them are measuring the dissimilarity between the features to tell if they are similar or not...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope you will be able to better understand the situation with this. This is not a direct pre made solution, but it could help you in your work!&lt;/p&gt;&#xA;" OwnerUserId="9090" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-09-25T14:10:11.913" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18348" PostTypeId="2" ParentId="18343" CreationDate="2014-09-25T14:17:52.263" Score="13" Body="&lt;p&gt;Read the original paper: Schmidt, R. O. &quot;Multiple Emitter Location and Signal Parameter Estimation.&quot; IEEE Transactions on Antennas and Propagation. Vol. AP-34, March, 1986, pp. 276–280&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to look up &quot;Pisarenko's Method&quot;, &quot;Prony's Method&quot; and read about related problems such as ESPRIT (Roy, R.; Kailath, T. (1989). &quot;Esprit - Estimation Of Signal Parameters Via Rotational Invariance Techniques&quot;. IEEE Trans. Acoustics, Speech and Signal Processing 37 (7): 984–995.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find a lot of this in statistical signal processing books like &quot;Statistical Digital Signal Processing and Modeling&quot; by Monson Hayes and look at the cited references therein.  Another reference is Mathematical Methods for Signal Processing by Moon &amp;amp; Stirling. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2014-09-29T19:10:05.517" LastActivityDate="2014-09-29T19:10:05.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18349" PostTypeId="1" CreationDate="2014-09-25T15:00:15.977" Score="1" ViewCount="5826" Body="&lt;p&gt;Hi someone please explain me the translation property of $\textrm{DFT}$. I am not able to understand it neither from Gonzalez nor from internet. I have done extensive study on this but not able to get it. Really Frustrated!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how shifting is done? What is the difference between $f(x-x_0, y-y_0)$ and $f(x+x_0, y+y_0)$ and what are their corresponding $\textrm{DFT}$'s?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sBZdc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11189" LastEditorUserId="1629" LastEditDate="2015-07-23T15:25:20.670" LastActivityDate="2016-02-18T17:46:00.530" Title="What is a translation property in DFT" Tags="|image-processing|fourier-transform|frequency-spectrum|dft|dsp-core|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18350" PostTypeId="2" ParentId="18349" CreationDate="2014-09-25T15:04:46.790" Score="1" Body="&lt;p&gt;The idea is the same as the 1D case. Start with the regular old continuous time fourier transform definition (the integral) and calculate the Fourier transform of $e^{j \omega_0 t} f(t)$. Similarly, calculate the inverse Fourier transform (using the integral) for $e^{j \alpha \omega} F(\omega)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, do this with the discrete time fourier transform (so the transform is a sum and the inverse transform is an integral). &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-09-25T15:04:46.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18351" PostTypeId="2" ParentId="18264" CreationDate="2014-09-25T15:30:42.473" Score="0" Body="&lt;p&gt;Building on your comment about assigning 1 to pixels inside the circle and 0 to pixels entirely outside, with values in between for ones that are on the edge, I would try this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create you circle as 10N*10N instead of N*N.  Maybe even use a higher value in place of 10.&#xA;Draw your circle with your naive algorithm - 1 inside, 0 outside.&#xA;Now scale this image down from 10N*10N to N*N.  This will automatically give you fractional values for the pixels that are on the border at the lower resolution.&#xA;You could also at this point split it into 0 and 1 again with a threshold function.  Doing that with 4*4 gives you something like this (colors inverted:)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cHscy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-09-25T15:38:57.957" LastActivityDate="2014-09-25T15:38:57.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18352" PostTypeId="2" ParentId="18341" CreationDate="2014-09-25T17:45:52.663" Score="1" Body="&lt;p&gt;I have finally made some manipulations that was mainly based on what @JRE suggested and I have independently found out too. I have posted this answer on &lt;a href=&quot;https://stackoverflow.com/questions/26026242&quot;&gt;SO&lt;/a&gt; earlier. Manipulations(like convolution) on signal need to be done after converting the wave file to float type and to be finally reconverted to original 16 bit Wav. There also need to be an additional step of adding the original signal with the convolved signal which I added to the below code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from utility import pcm2float,float2pcm&#xA;input_rate,input_sig=wavfile.read(sound_path+sound_file_name)&#xA;input_sig=pcm2float(input_sig,'float32')&#xA;IR_rate,IR_sig=wavfile.read(IR_path+IR_file_name)&#xA;IR_sig=pcm2float(IR_sig,'float32')&#xA;&#xA;if input_rate!=IR_rate:&#xA;    print &quot;Size mismatch&quot;&#xA;    sys.exit(-1)&#xA;else:&#xA;    rate=input_rate&#xA;print sound_file_name&#xA;    out_0=fftconvolve(input_sig[:,0],IR_sig[:,0])&#xA;out_0=out_0/np.max(np.abs(out_0))&#xA;out_1=fftconvolve(input_sig[:,1],IR_sig[:,1])&#xA;out_1=out_1/np.max(np.abs(out_1))&#xA;out=np.vstack((out_0,out_1)).T&#xA;out=float2pcm(out,'int16')&#xA;out[:input_sig[:,0].shape[0]]=out[:input_sig[:,0].shape[0]]+input_sig&#xA;wavfile.write(sound_path+'echoed outputs/'+sound_file_name+'_'+IR_file_name+'_echoed.wav',rate,out)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am still not completely happy with the results. The results using openair website is far better than mine and I still don't know the reason for that:&#xA;&lt;a href=&quot;http://www.openairlib.net/auralizationdb/content/elveden-hall-suffolk-england&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.openairlib.net/auralizationdb/content/elveden-hall-suffolk-england&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9065" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-09-25T17:58:31.140" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18353" PostTypeId="2" ParentId="18331" CreationDate="2014-09-25T18:04:07.033" Score="1" Body="&lt;p&gt;Depends. If you use two separate pre-canned libraries to compute them, likely not.&#xA;However, note that when people talk about &quot;SIFT features&quot; they refer to two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Point locations on the images&lt;/li&gt;&#xA;&lt;li&gt;Descriptors, a.k.a. collections of numbers computed from the pixels &#xA;around the point locations.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What defines SIFT is really the descriptors, whereas the point locations can be computed any way you choose. A common choice is Harris corners, but nobody prevents you from using your method of choice - in particular, the Shi-Tomasi &quot;best features to track&quot; algorithm (I think this is the one you refer to).  &lt;/p&gt;&#xA;" OwnerUserId="9110" LastActivityDate="2014-09-25T18:04:07.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18354" PostTypeId="1" CreationDate="2014-09-25T18:14:44.057" Score="0" ViewCount="904" Body="&lt;p&gt;I have a signal from a photodiode sensor that has two types of noise. One type of noise is ambient light white noise that gets introduced just from the surrounding environemnt. The other type of noise is due to the motion of the sensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently i don't seem to have a problem filtering out the white noise when the sensor is held still. But when the sensor is moving i get very large noise from motion, this noise is much larger than the signal i am interested in and as a result makes the signal I want look like noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal i am interested is anywhere between 0.75Hz and 4Hz, the motion signal can be anywhere from 0.25Hz to 5Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently using a butterworth filter between 0.5 and 4 Hz and then a moving average to smooth it out. But this causes the signal to be lost in the motion noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked into adaptive filters but am not sure whether i should try to implement them or not because i do not have enough experience with them to tell whether they will help my problem or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there techniques that are used to pick out signals that share frequency with noise?&lt;/p&gt;&#xA;" OwnerUserId="10943" LastActivityDate="2016-01-21T05:10:31.270" Title="Picking out a signal that appears to be noise inside a large signal" Tags="|filters|filter-design|noise|kalman-filters|adaptive-filters|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18355" PostTypeId="2" ParentId="18354" CreationDate="2014-09-25T20:18:57.613" Score="0" Body="&lt;p&gt;First, filtering can be touchy. A moving average is kind of destroying the information contained in the signal. It would be of use in situations where the real signal doesn't vary much, such as if you were reading a noisy DC voltage and wanted to have an good idea of the average voltage. I don't want to get into all the details of using a moving average (and I can't pretend I know them all), but since the signal of you photodiode sensor varies quickly, a moving average will smooth it indiscriminately from noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, you should give at look at the frequency response of your butterworth filter. Again, don't want to get into to much details but when you use a filter, you generally need to use lower and upper frequencies a little bit lower and higher than the min and max ones present in your signal. The reason is that a real (non-ideal) filter won't simply cut everything lower than 0.75Hz and higher than 4Hz and allow the rest to pass undeterred; it starts to attenuate the signal before the cutoff frequency and finishes after. You could check the frequency response on an illustration on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, is your signal of interest somewhat of a characteristic signature? I mean, do you have an idea of what it is supposed to look like?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes, you could use an auto correlation technique. The idea is to convolve a copy of the known signal to your noisy input signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: Imagine that you have a (somewhat simplified) sonar and that you emit a &lt;a href=&quot;http://en.wikipedia.org/wiki/Chirp&quot; rel=&quot;nofollow noreferrer&quot;&gt;chirp&lt;/a&gt; signal, which is of a known form. You listen with an antenna for echoes of the chirp who could have bounced on some object. The signal you get form your antenna is pretty noisy and you cannot distinguish the chirp from the noise. Still, you want to detect it because the time elapsed since it's emission (and the speed of sound) allows to calculate the distance at which the object is in regard to the chirp emitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good and simple way to go would be to auto correlate the chirp with the antenna signal. You could think of it as a kind of AND operation, in the sense that as a result you will have a signal where the amplitude would be very low where the chirp is not present and higher where the chirp is present. For more visual people it should look like something like this: &lt;img src=&quot;https://i.stack.imgur.com/0zAJO.jpg&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top &quot;x(n)&quot; shows two &quot;chirps&quot; emitted at some time. (There is no link between them, just an image I generated in the past for an assignment.) In the middle, there is the signal &quot;y(n)&quot; captured by the antenna. At the bottom, you have the output signal &quot;Rxy3&quot;, which is the result of the autocorrelation between &quot;x(n)&quot; and &quot;y(n)&quot;. As you can see, some time after the emission of the chirp, you can identify the location of the echoes (the peaks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for &lt;em&gt;how&lt;/em&gt; to implement it, you could check at this example: &lt;a href=&quot;http://www.mathworks.com/help/signal/examples/measuring-signal-similarities.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/help/signal/examples/measuring-signal-similarities.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9090" LastEditorUserId="9090" LastEditDate="2014-09-26T13:24:36.483" LastActivityDate="2014-09-26T13:24:36.483" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18356" PostTypeId="2" ParentId="18316" CreationDate="2014-09-25T21:01:22.637" Score="4" Body="&lt;p&gt;I'm afraid your statement isn't true. This can best be seen in a suitable choice of basis, one that simplifies the cross correlation. This basis if of course the shift invariant periodic Fourier basis on your support interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's label the basis vectors $F_n$ for integer $n$. The cross correlation of two different such basis vectors vanishes, because the vectors are orthogonal and shift invariant: $\langle F_n,F_m \rangle =0$ for $m\neq n$. If we slightly generalize the cross correlation to work for complex signals as in $$\langle A,B \rangle (\tau):=\int_{-\pi}^\pi A^*(t)B(t+\tau)dt$$ and assume normalization of the Fourier basis, then $\langle F_n,F_n \rangle (\tau)=F_n(\tau)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this, we can construct your $x(t)$,$y(t)$ and $z(t)$ signals like follows:&#xA;$$x(t) := c_{xy} F_{n}(t) + c_{xz} F_{k}(t)$$&#xA;$$y(t) := c_{yx} F_{n}(t) + c_{yz} F_{m}(t)$$&#xA;$$z(t) := c_{zy} F_{m}(t) + c_{zx} F_{k}(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with mutually different integer indices $k,m,n$. The complex coefficients $c_{ab}$ for $a,b\in\{x,y,z\}$ can be chosen arbitrarily and independently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding correlation functions are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\langle x,y \rangle (\tau) = c^*_{xy} c_{yx} F_n(\tau)$$&#xA;$$\langle y,z \rangle (\tau) = c^*_{yz} c_{zy} F_m(\tau)$$&#xA;$$\langle x,z \rangle (\tau) = c^*_{xz} c_{zx} F_k(\tau)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So each cross correlation function is a complex sinusoid with a phase factor in front. The phase factors and the sinusoids of all three correlation functions can be chosen absolutely independently. If you want to talk about maxima instead of phase factors you can take the whole setup to the reals by either adding the conjugate basis functions or just take the real part of these correlation functions. Either way, you can chose the coefficients to give you any set of maximum lags $\tau_{xy,zy,xz}$ without the requirement of the connection between them you conjectured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as requested let's get more explicit. The construction principle that guarantees independence of the three cross correlation functions should be relatively obvious: The orthogonality of the Fourier basis allows us to construct the signals so that the signals $x,y,z$ only overlap pairwise. In other words, the example above demonstrates that there is no transitivity for cross correlations that would allow general statements about $\langle x,z \rangle$ from $\langle x,y \rangle$ and $\langle y,z \rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simple construction from above makes them overlap with just one basis function, which is a complex sinusoid. This is probably why the result cannot be immediately seen to apply to the original question. If you want maxima we need to use real numbers, and single real basis functions also do not have a single maximum, so we need to have more than one basis function of overlap between the signals (except for $F_1$, which already only has one maximum per period).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest full example that I can come up with right now and that follows the design principle described above is:&#xA;$$x(t)=\sin(t)+\cos(4t)+\cos(5t)$$&#xA;$$y(t)=\sin(t)+\sin(2t)+\sin(3t)$$&#xA;$$z(t)=\sin(2t)+\sin(3t)+\sin(4t)+\sin(5t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The base indices that overlap between the signals are $1$ for $xy$, $2$ and $3$ for $yz$, and finally $4$ and $5$ for $xz$. The latter have a phase shift introduced to realise your requirement. The overlaps group adjacent basis functions so that we have a single guaranteed maximum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point it's probably easier to inspect the resulting correlation functions graphically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, $\langle x,y \rangle$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/giILG.png&quot; alt=&quot;Crosscorrelation between x and y&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\langle y,z \rangle$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jv413.png&quot; alt=&quot;Crosscorrelation between y and z&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and finally the independent third pair $\langle x,z \rangle$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R78EW.png&quot; alt=&quot;Crosscorrelation between x and z&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maxima of the first two cross correlations are clearly at $\tau=0$, while the third pair correlates best at some $\tau&amp;gt;0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example works in both discrete and continuous time, as it only uses properties of the Fourier basis that are realised in both domains.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-09-26T08:51:36.703" LastActivityDate="2014-09-26T08:51:36.703" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="18357" PostTypeId="2" ParentId="18349" CreationDate="2014-09-26T01:40:12.997" Score="0" Body="&lt;p&gt;I think all the question is trying to show is that a rotation or phase shift in one domain causes a shift or translation in the other domain.  Multiplying by exp(jx) or exp(-jx) is nothing but a phase shift by angle x.  I know these are correct properties but I don't know if that answers your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-K&lt;/p&gt;&#xA;" OwnerUserId="11152" LastActivityDate="2014-09-26T01:40:12.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18358" PostTypeId="1" AcceptedAnswerId="18362" CreationDate="2014-09-26T02:06:07.413" Score="1" ViewCount="154" Body="&lt;p&gt;I'm working on some problems that instruct me to find the impulse response of a given system. For example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=4y(n-1)-4y(n-2)+x(n)-x(n-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step I take is to find the homogeneous solution of the equation like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \lambda^n-4\lambda^{n-1}+4\lambda^{n-2}=0&#xA;\\\lambda^{n-2}(\lambda^2-4\lambda+4)=0&#xA;\\\lambda^{n-2}(\lambda-2)(\lambda-2)=0&#xA;\\\lambda = 2,2&#xA;\\y_{h}(n) = C_{1}(2)^n + C_{2}(2)^n&#xA; $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct homogeneous form for when you have two of the same values for lambda? I know it is when the values are different from each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have another question about this practice. When I've finished this step, I then plug n=0 and n=1 into the original equation to find the values of C1 and C2. How do I know how any times to plug a value into the original equation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="11191" LastActivityDate="2014-09-26T09:40:36.400" Title="Solving for impulse response" Tags="|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18360" PostTypeId="1" AcceptedAnswerId="18363" CreationDate="2014-09-26T02:36:44.890" Score="0" ViewCount="332" Body="&lt;p&gt;I want to try to improve an image processing technique for finding faces in images. I want to stop the Viola Jones face detector before it finds all faces, and do histogram equalization and other techniques on &quot;candidate&quot; faces. For example, say we have an image with one face. I would like to cut off facial detection before it has determined there is only one face, i.e. where there might be 3 prospective faces and Viola Jones has not yet taken out those regions which are not actually faces. Is this possible, and if so how do I do it?&lt;/p&gt;&#xA;" OwnerUserId="11192" LastActivityDate="2014-09-26T11:00:12.250" Title="Stopping Viola Jones Face Detection early" Tags="|image-processing|detection|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18362" PostTypeId="2" ParentId="18358" CreationDate="2014-09-26T09:40:36.400" Score="2" Body="&lt;p&gt;Your characteristic polynomial is indeed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lambda^2-4\lambda+4=(\lambda-2)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you had two distinct roots $r_1$ and $r_2$ the general solution would have the form you suggested:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=C_1r_1^n+C_2r_2^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in your case you have a double root $r=2$ which results in a general solution of the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=C_12^n+C_2n2^n\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constants $C_1$ and $C_2$ are chosen to match the initial conditions and the input signal $x(n)$, which in order to compute the impulse response is a delta impulse $\delta(n)$. Assuming $y(-1)=y(-2)=0$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(0)=x(0)-x(-1)=1\\&#xA;y(1)=4y(0)+x(1)-x(0)=4+0-1=3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing to (1) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(0)=C_1=1\\&#xA;y(1)=2C_1+2C_2=3\Rightarrow C_2=1/2$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-26T09:40:36.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18363" PostTypeId="2" ParentId="18360" CreationDate="2014-09-26T11:00:12.250" Score="0" Body="&lt;p&gt;Viola-Jones works in stages.  Only areas of the image that have a high enough &quot;maybe&quot; score get passed to the next stages.  If you implement your own Viola-Jones detector, then you should be able to stop between each stage and apply color/lighting corrections before going on to the next stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative to implementing your own, you might take a look at the openCV implementation.  You might be able to modify it for your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source is &lt;a href=&quot;https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/cascadedetect.cpp&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for the cascade detector, which is the openCV Viola-Jones implementation.  You will need to examine the area after the comment //---------------------------------------- Classifier Cascade&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is where the actual detector is implemented.  I think the interesting places are operator and ocl_detectMultiScaleNoGrouping, and I really think operator is where you would need to start.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-09-26T11:00:12.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18365" PostTypeId="1" CreationDate="2014-09-26T17:40:56.567" Score="3" ViewCount="11047" Body="&lt;p&gt;I have seen a lot of posts here and on SO and on various websites, using Matlab, OpenCV, name it, on how to detect rectangles in an image. I have done it myself too, using Matlab. My usual steps were:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Grayscale the image (if not done)&lt;/li&gt;&#xA;&lt;li&gt;Blur the image (if needed)&lt;/li&gt;&#xA;&lt;li&gt;Apply an edge detector (e.g. Canny, LoG, etc., tried a lot of them)&lt;/li&gt;&#xA;&lt;li&gt;Apply the various steps of Hough Transform to find lines&lt;/li&gt;&#xA;&lt;li&gt;Use some logic in order to tell which line combinations are forming rectangles&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have no problem with these. The problem is that (and with most of other posts I found) it works with relatively simple images, generally synthetics one with few textures, or with high contrast (like a black rectangle surrounding text on a white sheet of paper). Well, maybe that's only me, but I can't make it work with more complex images, where the edgemap might be quite noisy, where I can't afford to manually tune all sort of parameters and thresholds to &quot;make it work&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a dummy project to illustrate the kind of situation I want to address. Imagine that I have a lot of books (dozens) layered and overlapping on a table and I have a camera above, at the right distance to view all of the scene and only the scene. There is no distortion of lens, no blur from the lighting and the resolution is pretty good. The books may be rotated at any angle, they may be of different sizes (though one could assume there is a min and max size), their cover may or may not be different from each others, with possibly images, text, etc. but no colour information is present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to identify the location of every book in that scene. Then, knowing their location, I will be able to extract the appearance of their covers and maybe retrieve their names from a database using these covers (just an example, this part is not important now). Oh, I cannot turn the problem around and use the database to search for the presence of a given book (it would be quite long and I try to constrain this example to rectangle detection).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, imagine that, given all the information known about the problem at hand, I conclude that the best solution would be to search for the presence of rectangles in the scene, knowing that books are indeed rectangles and finding all the rectangle could give me a good start. Oh, and I want to do it in real time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would you do? I have looked at a some papers from the literature, a lot are doing contour detection to detect horses, mugs, bottles, but they are quite slow to detect the shapes and more I have noticed that often just plain simple rectangles are, well, too simple, not enough distinctive for the algorithms to find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not looking for a ready made answer. I just wonder if anyone has a thought on this. I have not included a list of papers or implementation I tested partly because this question is quite long enough and also I don't want to orient the answers. Remember, this example is made up and what I really want is to detect rectangles. And, &lt;strong&gt;disclosure&lt;/strong&gt;, eventually in my career I assume I will have to detect rectangles (or other shapes) so I was quite ashamed that I wasn't able to do it on real images with the knowledge I have right now   :S &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9090" LastActivityDate="2019-11-20T17:08:19.170" Title="Rectangle detection in &quot;real life&quot; images" Tags="|computer-vision|edge-detection|object-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18366" PostTypeId="2" ParentId="17978" CreationDate="2014-09-26T17:48:00.090" Score="5" Body="&lt;p&gt;Just something to add, there are two kinds of canonical comb filters.  there are those made with only feedforward paths and those that have feedback.  In fact, you can have additional long delay elements of length &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{f_0}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt; is the frequency of the spacing between the teeth of the comb.&lt;/p&gt;&#xA;&lt;p&gt;In fact, a comb filter can be designed as generally as an FIR or IIR filter, but with the unit delay elements replaced by delay elements with delay &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{f_0}$&lt;/span&gt;.  Whatever frequency response you design for a low-pass filter (either FIR or IIR) can be used to design the shape of the &lt;em&gt;teeth&lt;/em&gt; of the comb filter.&lt;/p&gt;&#xA;&lt;p&gt;If you use a delay of half that above, a delay of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2 f_0}$&lt;/span&gt;, your comb filter will be tuned to only the even-numbered harmonics.  In addition, you can instead design for a prototype high-pass filter (again with delay elements of half length &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2 f_0}$&lt;/span&gt;) and your comb filter will pass only the odd-numbered harmonics.&lt;/p&gt;&#xA;&lt;p&gt;In continuous-time, using the Direct Form II, it's&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ v(t) = x(t) - \sum\limits_{n=1}^N a_n v(t - n/f_0) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ y(t) = \sum\limits_{n=0}^N b_n v(t - n/f_0) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The transfer function is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H(s) = \frac{Y(s)}{X(s)} = \frac{\sum\limits_{n=0}^N b_n e^{-n s/f_0}}{1+ \sum\limits_{n=1}^N a_n e^{-n s/f_0}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or frequency response&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H(j2 \pi f) = \frac{Y(j2 \pi f)}{X(j2 \pi f)} = \frac{\sum\limits_{n=0}^N b_n e^{-j n 2 \pi f/f_0}}{1+ \sum\limits_{n=1}^N a_n e^{-j n 2 \pi f/f_0}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can discuss how you might design your LPF prototype that depicts the shape of the teeth.  And also, maybe we should discuss how to do a precision delay that has sub-sample precision so that &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt; can be precisely tuned.&lt;/p&gt;&#xA;&lt;p&gt;In the other answer, the precision delay &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; would be integer multiples of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{f_0}$&lt;/span&gt; in seconds. and the normalized (to the sample period) precision delay (with integer and fractional part) is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{D}{T} = f_\text{s} D = i_D + f_D = \frac{n f_\text{s}}{f_0} \qquad n=1,2,... N $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(Don't conflate or confuse the symbols &lt;span class=&quot;math-container&quot;&gt;$f_\text{s}$&lt;/span&gt;, the sample rate, with &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt;, the fundamental frequency or &amp;quot;pitch&amp;quot;, or the fractional delay &lt;span class=&quot;math-container&quot;&gt;$f_D$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-04-30T18:43:05.850" LastActivityDate="2023-04-30T18:43:05.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18368" PostTypeId="2" ParentId="18365" CreationDate="2014-09-26T20:51:42.710" Score="3" Body="&lt;p&gt;I think you would use a &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;2D Matched Filter&lt;/a&gt;. You would convolve your image with a series of rectangles. The peaks in the resulting images would be the location of your books. You could do this quickly in by Fourier transforming your image and using the known function for a rectange in 2D Fourier space (its two sinc functions, multiplied). &lt;/p&gt;&#xA;" OwnerUserId="11202" LastActivityDate="2014-09-26T20:51:42.710" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18370" PostTypeId="1" CreationDate="2014-09-27T05:37:48.437" Score="-1" ViewCount="61" Body="&lt;p&gt;I really having a hard time to tackle the following question. &#xA;It is asked to load a &quot;.mat&quot; file using &lt;code&gt;load file.mat&lt;/code&gt;. And the result is two variables: Fs varaible contains the sampling frequency=44100, y is a 441344x1 matrix that contains data points of this audio. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is asked to amplitude modulate this audio by multiplying a cosine function of frequency 4 Hz. This is to micmic the tremolo effect. &#xA; This corresponds to &lt;code&gt;y.*cos(2*pi*4.*n)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my question is, how should I define the length of n? If I do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=transpose(0:1/441343:1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting audio sounds very weird. Then, how should I define n then?&lt;/p&gt;&#xA;" OwnerUserId="11203" LastActivityDate="2014-09-27T10:00:10.537" Title="Can someone please help me out with audio, sampling frequency question" Tags="|audio|frequency|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18372" PostTypeId="2" ParentId="18370" CreationDate="2014-09-27T10:00:10.537" Score="1" Body="&lt;p&gt;Your modulation signal must be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$m(n)=\cos(2\pi f/f_sn)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f=4\;Hz$, $f_s=44100\;Hz$ is the sampling frequency, and $n$ is the integer sample index. In Matlab this looks like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = 441344;&#xA;n = (0:L-1);&#xA;f = 4/44100;        % normalized frequency&#xA;m = cos(2*pi*f*n);&#xA;ym = y(:).*m(:);    % modulated signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-27T10:00:10.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18373" PostTypeId="1" CreationDate="2014-09-27T13:27:49.303" Score="2" ViewCount="262" Body="&lt;p&gt;I once learnt that the Huffman Encoding is used to rid of redundant information, thus reducing file size. I am not sure how using a DCT, or FFT on an image can help in reducing file size. It does not work on redundancy, then how does it reduce the total amount of data?&lt;/p&gt;&#xA;" OwnerUserId="4464" LastActivityDate="2014-09-27T15:48:45.887" Title="How does using DCT help in image compression" Tags="|dct|image-compression|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18374" PostTypeId="2" ParentId="18373" CreationDate="2014-09-27T14:02:35.970" Score="1" Body="&lt;p&gt;The reason it works is that for &lt;em&gt;most&lt;/em&gt; images, most of the energy is in the low frequencies and can be captured by relatively few DCT coefficients.  So what happens is the algorithms compute the DCT and only keep the high energy coefficients.  The rest are simply thrown away.  This results in some degradation in the image of course, but, assuming the algorithm did its job well, not much.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-09-27T14:02:35.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18375" PostTypeId="2" ParentId="18373" CreationDate="2014-09-27T15:48:45.887" Score="3" Body="&lt;p&gt;If you take an image as is (especially a photograph, as opposed to line art, a document scan...), there's very little redundancy in it for Huffman encoding to do its work - because the image contains many small fluctuations and details which are not perceptible to the human eye but nevertheless present in the data. DCT followed by &lt;em&gt;coefficient truncation/quantization&lt;/em&gt; eliminates the barely perceptible details and creates redundancy for Huffman compression to work on.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-09-27T15:48:45.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18376" PostTypeId="1" AcceptedAnswerId="18379" CreationDate="2014-09-27T16:23:30.873" Score="1" ViewCount="1273" Body="&lt;p&gt;From wikipedia:&#xA;&quot;Modern general-purpose speech recognition systems are based on Hidden Markov Models. These are statistical models that output a sequence of symbols or quantities. HMMs are used in speech recognition because a speech signal can be viewed as a piecewise stationary signal or a short-time stationary signal. In a short time-scale (e.g., 10 milliseconds), speech can be approximated as a stationary process. Speech can be thought of as a Markov model for many stochastic purposes.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get that if you break a speech signal into small enough parts, then a every part will make a very specific, basic sound, which I presume, has the same (or very similar) type of spectral envelope, as many other parts around it/close to it.. but I don't quite understand what the stationary process is, especially not in this context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be exact, I don't understand what exactly the stochastic process/it's random variables are, or even the motivation for describing a piece of signal as a stochastic process. &#xA;I mean the actual input is not a stochastic process, it's a concrete input, it's an observation - is the quote saying that basically any small enough piece of the input can be considered as a certain sample of some stationary process? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do we call it stationary, because while we know that the small part has some sort of quality of being very repetitive, we don't know exactly where we've seperated it/where it starts? Similar to something like a stationary process of sin(t+Y), Y being a random variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty confused about this whole thing- if I see a specific sample of white noise, is it correct to call it 'stationary'? I mean, the original distribution that generated this sample, that is a stationary process, but does that mean you call the sample/signal itself 'stationary'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly does the fact that sound is piecewise stationary imply it a good idea to use HMM? I simply get stuck at that - maybe a slow, thorough explanation of this implication (and what exactly it means that it's piecewise stationary) would be the most helpful to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if the questions are not understandable or not concrete enough. I'm simply very confused and don't know enough about this.&lt;/p&gt;&#xA;" OwnerUserId="10888" LastActivityDate="2014-09-27T18:45:27.763" Title="Confusion about speech being piecewise stationary" Tags="|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18377" PostTypeId="1" CreationDate="2014-09-27T16:25:03.353" Score="-1" ViewCount="613" Body="&lt;p&gt;Is there any way I can apply the concept of FIR filters in chroma key composition, where I will remove a green background to focus on a subject and replace a different image on the removed part, sort of like how they impose graphics on weather reports? If so, how can I implement it in MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="11207" LastActivityDate="2014-09-27T22:39:46.137" Title="Implementing image chroma keying with FIR filter in MATLAB" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18379" PostTypeId="2" ParentId="18376" CreationDate="2014-09-27T18:45:27.763" Score="1" Body="&lt;p&gt;In this context, stationary usually means that the spectral density is (theoretically) the same throughout the observation window.&lt;br&gt;&#xA;So, piecewise stationary means that if you divide the signal into short enough time frames, the signal in each frame can be described, accurately enough, as sum of sinusoids in presence of white noise (which is stationary as well).&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-09-27T18:45:27.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18380" PostTypeId="2" ParentId="18377" CreationDate="2014-09-27T21:36:18.603" Score="-1" Body="&lt;p&gt;FIR is not a direct method to do chroma keying. Yet, it is hardly related. But let me give you an algorithm to perform a basic idea:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the training stage:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take a set of training images and for each set of image obtain the RGB histogram.&lt;/li&gt;&#xA;&lt;li&gt;Merge the histograms into a single one by simply addition.&lt;/li&gt;&#xA;&lt;li&gt;Fit a minimum enclosing volume ellipsoid to the &quot;marked&quot; voxels in the 3D histogram. This will be your &quot;keying&quot; model. It will then used in the estimation stage (Check below) Use Kachiyan's algorithm. A sample implementation is here: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/9542-minimum-volume-enclosing-ellipsoid&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/9542-minimum-volume-enclosing-ellipsoid&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Enlarge your ellipsoid a little bit to account for unseen data.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;After having the ellipsoid, you are left with segmenting out the object from the green screen. Do that as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;For each pixel in the new input image, check whether the pixels RGB values fall inside the ellipsoid. If it is inside the ellipsoid obtained at stage (3), it belongs to background. If it lies outside of the ellipsoid (4), it is in the foreground. If it lies in between, the foreground and background should be combined using a linearly implemented alpha mapping.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compute the distance to the ellipsoid, use Mahalanobis distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see this work (3D Keying) :&#xA;&lt;a href=&quot;http://www.tzi.de/tzikeyer/keying_report.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.tzi.de/tzikeyer/keying_report.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-09-27T22:39:46.137" LastActivityDate="2014-09-27T22:39:46.137" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18381" PostTypeId="2" ParentId="18377" CreationDate="2014-09-27T22:26:41.000" Score="1" Body="&lt;p&gt;No, chroma keying and FIR filters are unrelated concepts.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-09-27T22:26:41.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18382" PostTypeId="2" ParentId="18264" CreationDate="2014-09-28T08:03:09.923" Score="2" Body="&lt;p&gt;I think you should first construct a smooth function of $r$ (where $r=\sqrt{x^2+y^2}$). For example, your original solution was based on the following function of one variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_1(r) = \begin{cases} 1 &amp;amp; r &amp;lt; R \\&#xA;0 &amp;amp; \text{otherwise} \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but you might try using a &quot;softer&quot; step function such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_2(r) = \begin{cases} 1 &amp;amp; r&amp;lt;R-\frac{s}{2} \\&#xA;0 &amp;amp; r\ge R+\frac{s}{2} \\&#xA;\frac{1}{2} - \frac{r-R}{s} &amp;amp; otherwise&#xA; \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you can create smoother variants, such as $$f_3(r) = 3f_2(r)^2-2f_2(r)^3$$ since $f_3$ is simply formed by mapping the linear ramp function of $f_2$ to smoother cubic shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transition width of the ramp, $s$, should be set to $\frac{1}{2}$ or $\frac{1}{\sqrt2}$ if the linear ramp, $f_2$, is used, and you may need a larger value of $s$ (say, $s=1$) if the cubic function, $f_3$ is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, strictly speaking, what you are trying to do is sample the original pillar-box function at discrete sample-points, so if you think about the function prior to discrete sampling (let's call this the &lt;em&gt;pre-sampling&lt;/em&gt; function, $f(x,y)$ being defined over the Cartesian plane, for all real $x$,$y$)  the problem with your original &lt;em&gt;pre-sampling&lt;/em&gt; function was that it contained a step-discontinuity (a $0^{th}$order discontinuity), which contains large amounts of high-frequency energy (in 2D spatial frequency), so you need to remove some of this high-frequency energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The radial function, $f_2(r)$, removes the $0^{th}$order discontinuity, resulting in far less high-(spatial)-frequency energy in the &lt;em&gt;pre-sampling&lt;/em&gt; signal (but the resulting signal still has a $1^{st}$order disconinuity, since it's first derivative is not continuous). Likewise, the cubic function, $f_3(r)$, has even more reduced high-frequency energy, since it has no $0^{th}$ or $1^{st}$order disconinuities (but it's second derivative is discontinuous).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, if you make sure your &lt;em&gt;pre-sampling&lt;/em&gt; function has it's first $n-1$ derivatives being continuous (and it's $n^{th}$ is disconinuous), then the amplitude of it's high frequencies will fall of like $\left(\frac{1}{f}\right)^{n+1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps...&lt;/p&gt;&#xA;" OwnerUserId="11204" LastActivityDate="2014-09-28T08:03:09.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18383" PostTypeId="2" ParentId="17074" CreationDate="2014-09-28T10:14:48.050" Score="2" Body="&lt;p&gt;You need to be careful to look at your bunch of impulses in the fequency domain, to make sure you are really transmitting more energy at all frequencies. Your chain of 3 identical impulses will contain zero energy at certain frequencies. As a result, your echo-separation method (Tk = Sk – (Tk-10) – (Tk-20)) will have infinite gain at those frequencies (this is an IIR filter with 2 poles on the unit-circle), and hence it will be unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, I built 4 different &quot;pulse train&quot; signals (in Matlab), by the following method (an I've plotted the magnitude of the FFT):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; S1 = [1;0;0;0;0;0;0;0;0;0;0];&#xA;&amp;gt;&amp;gt; S2 = [1;0;0;0;0;1;0;0;0;0;0];&#xA;&amp;gt;&amp;gt; S3 = [1;0;0;0;0;1;0;0;0;0;1];&#xA;&amp;gt;&amp;gt; S4 = [1;0;0;0;0;1;0;0;0;0;-1];&#xA;&amp;gt;&amp;gt; plot( abs([fft(S1,256),fft(S2,256),fft(S3,256),fft(S4,256)]) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IGv9r.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that S1 has a constant magnitude respnnse (equal to 1), as expected. S2 (made up of 2 impulses) has a magnitude response that goes to 0 at several frequencies (even though, on average, it has twice the power of S1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;S3 has three times the average power as S1, but unfortunately it also has zero energy at some frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;S4 is built with a -1 in the last sample. As a result, it still has 3 times the average energy compared to S1, with the added property that is it never less than unity energy in any one frequency band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The (simplistic) recovery-filter, for use with S4, would be :  Tk = Sk – (Tk-5) + (Tk-10)), but unfortunately this is also an unstable filter (having some poles outside the unit circle). The trick to making a filter like this stable is split it into two parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you run a regular IIR filter over the signal as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T'_k = S_k + g \times T'_{k-5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $g=\frac{\sqrt5-1}{2}$. Next, you run this filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T_k = T'_k - g \times T_{k+5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the trick, with this second filter, is to compute the samples of $T_k$ in reverse order (if you want to compute 100 samples, start with sample 99, and work your way down to sample 0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The overarching principles here are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Spread your energy out over multiple samples, in the transmitted signal, to allow you to send more energy&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Try to always ensure there is lots of energy in all frequencies of the transmitted signal (look at the FFT of the signal)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Build an inverse filter&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My inverse filter method shown here is a bit perverse, using a time-reversed IIR filter. If you have plenty of CPU cycles, you can compute the correct inverse filter by building it as a long FIR filter (in theory, you need an infinitely long filter, but a long enough FIR will approximate it OK).&lt;/p&gt;&#xA;" OwnerUserId="11204" LastActivityDate="2014-09-28T10:14:48.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18384" PostTypeId="2" ParentId="18316" CreationDate="2014-09-28T10:31:21.947" Score="2" Body="&lt;p&gt;We can easily create three real, $2\pi$-periodic signals that have zero cross correlation with each other, simply by ensuring they contain no common frequency components. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(t) = a_1 \sin t + a_2 \sin 2t \\&#xA;b(t) = b_1 \sin 3t + b_2 \sin 4t \\&#xA;c(t) = c_1 \sin 5t + c_2 \sin 6t $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I can construct $x(t)$, $y(t)$ and $z(t)$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = a(t) + b(t) \\&#xA;y(t) = b(t) + c(t) \\&#xA;z(t) = c(t) + a(t-\tau_{xz}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These functions will have the property that $\tau_{xy}=0$, $\tau_{yz}=0$, and $\tau_{zx}$ will take on whatever value we chose when we constructed $z(t)$.&lt;/p&gt;&#xA;" OwnerUserId="11204" LastActivityDate="2014-09-28T10:31:21.947" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18385" PostTypeId="1" AcceptedAnswerId="18386" CreationDate="2014-09-28T17:00:24.633" Score="0" ViewCount="777" Body="&lt;p&gt;Please check the link&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/509/what-effect-does-a-delay-in-the-time-domain-have-in-the-frequency-domain&quot;&gt;What effect does a delay in the time domain have in the frequency domain?&lt;/a&gt;         &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it is said that if you delay your input signal by D samples, then each complex value in the FFT of the signal is multiplied by the constant exp(−j2πkD/N). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is that if i have a DFT vector F(u)={11,-3+2j,-1,-3-2j} and D=2,N=4 then I will get {11,3-2j,-1,3+2j}. But if we see this new vector we can see that here no translation&#xA;of the signal is done. Signal has not moved to the new location. Just the value of each coefficient has changed in it own location. According to the translation property the answer should be {-1,-3-2j,11,-3+2j}. What is the problem ? Please explain .&lt;/p&gt;&#xA;" OwnerUserId="11189" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-09-28T18:10:17.990" Title="Explain Shift property of DFT" Tags="|fft|dft|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18386" PostTypeId="2" ParentId="18385" CreationDate="2014-09-28T17:24:45.483" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;But if we see this new vector we can see that here no translation of the signal is done.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You have modified the data in the frequency domain, by multiplying by exp(−j2πkD/N). The translation thus occurs in the time domain. It would be indeed weird if multiplyig a vector by exp(−j2πkD/N) would shift this same vector!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse DFT of [11,3-2j,-1,3+2j] is: [4, 4, 1, 2].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse DFT of [11,-3+2j,-1,-3-2j] is: [1, 2, 4, 4].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The shift property is observed - the signal has been shifted by 2 (modulo 4).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-09-28T18:10:17.990" LastActivityDate="2014-09-28T18:10:17.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18387" PostTypeId="1" CreationDate="2014-09-28T04:45:57.803" Score="1" ViewCount="1024" Body="&lt;p&gt;I am trying to take a section of a song (approx 1.5 seconds)  44100 sample rate equals sample size of 65536 which is 2**16.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the frequency of the piano note that is played in the window of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have implemented the four1 function - real data starting at array pos 1 and I data at 2 ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;four1 uses are rewritten fortran function so the array does not start at index 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My I data is all 0.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have verified that input data looks good ... small sample:  Idx is index into data array&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Idx 22023   R -1876.000000   I 0.000000 &#xA;Idx 22025   R -1720.000000   I 0.000000 &#xA;Idx 22027   R -1453.000000   I 0.000000 &#xA;Idx 22029   R -1203.000000   I 0.000000 &#xA;Idx 22031   R -1017.000000   I 0.000000 &#xA;Idx 22033   R -799.000000   I 0.000000 &#xA;Idx 22035   R -386.000000   I 0.000000 &#xA;Idx 22037   R 75.000000   I 0.000000 &#xA;Idx 22039   R 243.000000   I 0.000000 &#xA;Idx 22041   R 327.000000   I 0.000000 &#xA;Idx 22043   R 759.000000   I 0.000000 &#xA;Idx 22045   R 1238.000000   I 0.000000 &#xA;Idx 22047   R 1317.000000   I 0.000000 &#xA;Idx 22049   R 1335.000000   I 0.000000 &#xA;Idx 22051   R 1639.000000   I 0.000000 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Upon return -- the array contains the R and I of the freq component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the first half (real frequency half) -- I get a range of different R and I values but when I calculate the Magnitude (srq of sum sqrs) --- the magnitudes are almost constant the complete real half of the freq range &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample of output -- I normalized the Magnitude to the Max Magnitude found&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Idx 13841   R -605090688.000000   I -74311704.000000    M 0.958672 &#xA;Idx 13843   R -605982336.000000   I -74471496.000000    M 0.960094 &#xA;Idx 13845   R -605715712.000000   I -74230088.000000    M 0.959632 &#xA;Idx 13847   R -605639744.000000   I -74081136.000000    M 0.959485 &#xA;Idx 13849   R -605420992.000000   I -74552360.000000    M 0.959234 &#xA;Idx 13851   R -606319744.000000   I -73444392.000000    M 0.960425 &#xA;Idx 13853   R -605728512.000000   I -73858336.000000    M 0.959581 &#xA;Idx 13855   R -605823424.000000   I -73527352.000000    M 0.959666 &#xA;Idx 13857   R -605311424.000000   I -73650440.000000    M 0.958890 &#xA;Idx 13859   R -606479360.000000   I -73952432.000000    M 0.960771 &#xA;Idx 13861   R -606198336.000000   I -74041552.000000    M 0.960349 &#xA;Idx 13863   R -605836544.000000   I -74178936.000000    M 0.959811 &#xA;Idx 13865   R -605548864.000000   I -73529936.000000    M 0.959238 &#xA;Idx 13867   R -605573312.000000   I -73070880.000000    M 0.959189 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is little to no change in Magnitude across freq bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I not be able to detect the frequency of that piano note played in that time window?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I misusing the FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any reply.&lt;/p&gt;&#xA;" OwnerDisplayName="JHinkle" LastEditorUserId="923" LastEditDate="2014-10-29T11:31:27.120" LastActivityDate="2014-11-28T12:02:12.437" Title="What do you get applying FFT to Music?" Tags="|fft|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18388" PostTypeId="2" ParentId="18387" CreationDate="2014-09-28T06:00:52.403" Score="1" Body="&lt;p&gt;Yes, you should be able to see the component of the piano note. But there are quite a few pitfalls on the way. I would suggest you experiment a little to get a 'feel' on how fft works first. Use GNU Octave or Matlab to do simple experiments, and then you can plug in your real data, and see if it works. For example, in Octave I can easily generate a sine wave of 440 Hz and do the FFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0, 2*pi, 44100);&#xA;s = sin(440.0 * t)              % This is the 440 Hz tone&#xA;f = abs(fft(s))                 % Take the fft (magnitude)&#xA;plot(f)&#xA;xlim([0,1000])                  % Show only the 1000 first bins&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can read your samples and do the same. At least, this way you&#xA;exclude insecurity about the fft function you're using. You could also&#xA;save the generated sine, and feed it to your four1 function, and check&#xA;if the result is correct.&lt;/p&gt;&#xA;" OwnerUserId="56861" OwnerDisplayName="jcoppens" LastActivityDate="2014-09-28T06:00:52.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18389" PostTypeId="2" ParentId="17978" CreationDate="2014-09-28T18:45:35.130" Score="6" Body="&lt;p&gt;I'm sorta writing this as a separate answer because it's about a sub-topic (how to get an arbitrary delay with continuous-time precision in a discrete-time system).&lt;/p&gt;&#xA;&lt;p&gt;The simplest way to think about fractional-sample interpolation, in my opinion, is just to consider the reconstruction half of the Nyquist-Shannon-Whittaker-Kotelnikov-whomever sampling and reconstruction theorem.  If a continuous-time signal &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is sampled sufficiently at sample rate &lt;span class=&quot;math-container&quot;&gt;$f_s=\frac{1}{T}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the sampling period)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x[n] \triangleq x(nT) \quad n \in \mathbb{Z} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is reconstructed from the samples &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;  x(t) &amp;amp; = \sum\limits_{n=-\infty}^{+\infty} x[n] \cdot \frac{\sin\left(\pi \tfrac{t-nT}{T} \right)}{\pi \tfrac{t-nT}{T}}\\&#xA;\\&#xA;       &amp;amp; = \sum\limits_{n=-\infty}^{+\infty} x[n] \cdot \operatorname{sinc}\left( \tfrac{t-nT}{T} \right) \\&#xA;\\&#xA;       &amp;amp; = \sum\limits_{n=-\infty}^{+\infty} x[n] \cdot \operatorname{sinc}\left( \tfrac{t}{T} - n \right) \\&#xA;   \end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{sinc}(u) \triangleq \begin{cases}&#xA; \frac{\sin(\pi u)}{\pi u} \qquad &amp;amp; u \ne 0 \\ &#xA; 1 &amp;amp; u = 0&#xA;\end{cases} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{sinc}(u)$&lt;/span&gt; is an even-symmetry function&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{sinc}(-u) = \operatorname{sinc}(u) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, without loss of generality, let's say that &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt; is the present instant of time (which means that &lt;span class=&quot;math-container&quot;&gt;$x[0]$&lt;/span&gt; is the most current sample of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;, all past samples, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, have negative indices, and none of the future samples with positive indices exist) and we want to know what &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is at some delayed time &lt;span class=&quot;math-container&quot;&gt;$x(-D)$&lt;/span&gt; where delay &lt;span class=&quot;math-container&quot;&gt;$D&amp;gt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x(-D) = \sum\limits_{n=-\infty}^{+\infty} x[n] \cdot \operatorname{sinc}\left( \tfrac{-D}{T} - n \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;First thing to do is split the normalized delay, &lt;span class=&quot;math-container&quot;&gt;$\frac{D}{T}$&lt;/span&gt;, which is dimensionless, into integer, &lt;span class=&quot;math-container&quot;&gt;$i_D$&lt;/span&gt;, and fractional, &lt;span class=&quot;math-container&quot;&gt;$f_D$&lt;/span&gt; parts:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \tfrac{D}{T} = i_D + f_D $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ i_D \triangleq \left\lfloor \tfrac{D}{T} \right\rfloor = \operatorname{floor}\left( \tfrac{D}{T} \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ f_D = \tfrac{D}{T}- i_D = \tfrac{D}{T} - \left\lfloor \tfrac{D}{T} \right\rfloor $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$$\tfrac{D}{T} - 1 &amp;lt; i_D \le \tfrac{D}{T} &amp;lt; i_D + 1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$ 0 \le f_D &amp;lt; 1 $&lt;/span&gt; .&lt;/p&gt;&#xA;&lt;p&gt;Then &lt;span class=&quot;math-container&quot;&gt;$x(-D)$&lt;/span&gt; is reconstructed from the samples &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;  x(-D) &amp;amp; = \sum\limits_{n=-\infty}^{+\infty} x[n] \cdot \operatorname{sinc}\left( \tfrac{-D}{T} - n \right) \\&#xA;\\&#xA;       &amp;amp; = \sum\limits_{n=-\infty}^{+\infty} x[n] \cdot \operatorname{sinc}\left( -(i_D + f_D) - n \right) \\&#xA;   \end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To make this summation finite, we have to toss out all of the samples of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; but those closest to &lt;span class=&quot;math-container&quot;&gt;$x[-i_D]$&lt;/span&gt;.  This is essentially what windowing is about.  If we're keeping the &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is even) closest samples on the left and right of the interpolated value at a time precisely &lt;span class=&quot;math-container&quot;&gt;$\tfrac{D}{T}$&lt;/span&gt; samples in the past:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;  x(-D) &amp;amp; \approx \sum\limits_{n=-i_D - L/2}^{-i_D + L/2 - 1} x[n] \cdot \operatorname{sinc}\left( -(i_D + f_D) - n \right) w(n + i_D + f_D) \\&#xA;\\&#xA;       &amp;amp; = \sum\limits_{n= -L/2}^{L/2 - 1} x[n - i_D] \cdot \operatorname{sinc}\left( -f_D - n \right) w(n + f_D) \\&#xA;\\&#xA;       &amp;amp; = \sum\limits_{n= -L/2}^{L/2 - 1} x[n - i_D] \cdot \operatorname{sinc}( f_D + n ) w(n + f_D) \\&#xA;   \end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$w(t)$&lt;/span&gt; is some window function.  If it were a Hamming Window, it would be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ w(t) = \begin{cases}&#xA;  0.54 \ + \ 0.46 \cdot \cos\left(\pi \frac{t}{L/2} \right) \qquad &amp;amp; |t| \le \tfrac{L}{2} \\&#xA;  0 &amp;amp; |t| &amp;gt; \tfrac{L}{2} \\&#xA;\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If it were a Kaiser window it would be&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ w(t) = \begin{cases}&#xA;  \frac{1}{I_0(\beta)} \, I_0\left(\beta \sqrt{1 -  \left(\frac{t}{L/2}\right)^2 } \right) \qquad &amp;amp; |t| \le \tfrac{L}{2} \\&#xA;  0 &amp;amp; |t| &amp;gt; \tfrac{L}{2} \\&#xA;\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ I_0(u) \triangleq \sum\limits_{k=0}^{\infty} \frac{(-1)^k \big( \tfrac{u}{2} \big)^{2k}}{(k!)^2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is the zeroth-order Bessel function of the first kind.  With the Kaiser window, knowing the length &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; (like &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; might be 16 samples, or 32 if you want it really good) you can choose &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; to tradeoff between the stopband attenuation and transition bandwidth of the reconstruction brickwall filter.  A good value of &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is 6 or 7, to get you about 63 dB or 72 dB of stopband attenuation to make your reconstruction brick wall filter have very solid bricks.&lt;/p&gt;&#xA;&lt;p&gt;Again, assuming for simplicity that &lt;span class=&quot;math-container&quot;&gt;$x[0]$&lt;/span&gt; is your current sample, if the normalized delay is at least as long as &lt;span class=&quot;math-container&quot;&gt;$\tfrac{L}{2}-1$&lt;/span&gt; samples, then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;  y_D(0) &amp;amp; \triangleq x(0-D) \\&#xA;   &amp;amp; \approx \sum\limits_{n= -L/2}^{L/2 - 1} x[n - i_D] \cdot \operatorname{sinc}\left( n + f_D \right) w(n + f_D) \\&#xA;\\&#xA;   &amp;amp; = \sum\limits_{n= -L}^{-1} x[n + \tfrac{L}{2} - i_D] \cdot \operatorname{sinc}\left(n + f_D + \tfrac{L}{2} \right) w(n + f_D + \tfrac{L}{2}) \\&#xA;\\&#xA;   &amp;amp; = \sum\limits_{n= -L+1}^{0} x[n + \tfrac{L}{2} - 1 - i_D] \cdot \operatorname{sinc}\left(n + f_D + \tfrac{L}{2}-1 \right) w(n + f_D + \tfrac{L}{2}-1) \\&#xA;\\&#xA;   &amp;amp; = \sum\limits_{n= -L+1}^{0} x[n - (i_D-\tfrac{L}{2}+1)] \cdot h_{f_D}[0-n] \\&#xA;\\&#xA;   &amp;amp; = \ \sum\limits_{n=0}^{L-1} \ x[(\tfrac{L}{2}-1-i_D)-n] \cdot h_{f_D}[n] \\&#xA;   \end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That's a simple dot product of the &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; samples from &lt;span class=&quot;math-container&quot;&gt;$x[-i_D+\tfrac{L}{2}-1]$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$x[-i_D-\tfrac{L}{2}]$&lt;/span&gt; with a set of FIR tap coefficients &lt;span class=&quot;math-container&quot;&gt;$h_{f_D}[n]$&lt;/span&gt;, (remember, here we're defining the most current sample as &lt;span class=&quot;math-container&quot;&gt;$x[0]$&lt;/span&gt; and we know &lt;span class=&quot;math-container&quot;&gt;$x[0], x[-1], x[-2], ...$&lt;/span&gt; ) and where &lt;span class=&quot;math-container&quot;&gt;$i_D$&lt;/span&gt; is the integer part of the delay and &lt;span class=&quot;math-container&quot;&gt;$i_D \ge \tfrac{L}{2}-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The FIR tap coefficients:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ h_{f_D}[n] = \operatorname{sinc}\left(n + 1 - f_D - \tfrac{L}{2} \right) w(n + 1 - f_D - \tfrac{L}{2}) \qquad 0 \le n \le L-1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;are dependent only on the fractional part &lt;span class=&quot;math-container&quot;&gt;$f_D$&lt;/span&gt; of the delay.&lt;/p&gt;&#xA;&lt;p&gt;So this is how you implement a precision delay of &lt;span class=&quot;math-container&quot;&gt;$\frac{D}{T}$&lt;/span&gt; samples, or &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; seconds of delay (assuming &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is expressed in seconds).  In the continuous-time domain, this would be a delay of &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; seconds with a Laplace transfer function of&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_D(s) \triangleq \frac{\mathscr{L}\{y_D(t)\}}{\mathscr{L}\{x(t)\}} = \frac{Y_D(s)}{X(s)} \approx e^{-sD} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which in the other partial answer would replace &lt;span class=&quot;math-container&quot;&gt;$z^{-1}$&lt;/span&gt; in your Direct Form II filter structure to get you a comb filter with an IIR or FIR design of a digital low-pass filter &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-04-30T18:37:33.370" LastActivityDate="2023-04-30T18:37:33.370" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="18390" PostTypeId="1" AcceptedAnswerId="18443" CreationDate="2014-09-28T23:56:03.703" Score="2" ViewCount="6428" Body="&lt;p&gt;One method of producing a discrete approximation kernel to a Gaussian filter of variance $\sigma^2$ is to assume a cutoff of $5\sigma$. This seems to suggest the following procedure:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a uniform grid $\mathbb{x}$ of size $11(=2*5+1)$ between $[-5\sigma,5\sigma]$ &lt;/li&gt;&#xA;&lt;li&gt;Evaluate $\mathcal{N}(\mathbb{x};0,\sigma)$ and obtain the discrete approximation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The blue lines in the second plot below depict the discretized values(for $\sigma=1.5$). &#xA;In this case, the result is not a proper filter kernel since the sum of values is not $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But MATLAB's &lt;code&gt;fspecial&lt;/code&gt; does things a bit differently. For the call &lt;code&gt;fspecial('gaussian',[1 11],sigma)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a uniform grid $\mathbb{x}$ of size $11(=2*5+1)$ between $[-5,5]$ &lt;/li&gt;&#xA;&lt;li&gt;Compute $\mathbb{x}'= e^{\frac{-\mathbb{x}^2}{2\sigma^2}}$&lt;/li&gt;&#xA;&lt;li&gt;Normalize $\mathbb{x}'$ so that it sums to $1$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The green lines in the first plot below the values as computed by MATLAB's &lt;code&gt;fspecial&lt;/code&gt;(for $\sigma=1.5$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bcu58.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;What is the difference between both methods ?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="4515" LastEditDate="2014-10-01T23:47:44.653" LastActivityDate="2014-10-03T09:00:17.687" Title="Discrete approximation to Gaussian filter" Tags="|filters|gaussian|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18391" PostTypeId="2" ParentId="18387" CreationDate="2014-09-29T01:14:30.083" Score="0" Body="&lt;p&gt;I think that you don't get the relation between the window size and results ... that's why you were surprised from the results.... &lt;br/&gt;&#xA;SamplingFrequency/WindowsSize gives you the distance(in Hz) between points in the frequency spectrum. &lt;br/&gt;&#xA;WindowsSize/SamplingFrequency gives you the distance(in seconds) between each calculated spectrum in time. &lt;br/&gt;&lt;br/&gt;&#xA;So for 44100hz and window size 65536 you have spectrum where values are spaced on 0.6hz. That's why they have similar values...&#xA;After that when you changed window size to 1024, you have spectrum where values are spaced on 43hz, so difference is noticeable&lt;/p&gt;&#xA;" OwnerUserId="10789" LastActivityDate="2014-09-29T01:14:30.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18393" PostTypeId="2" ParentId="18390" CreationDate="2014-09-29T06:15:56.800" Score="0" Body="&lt;p&gt;The difference between the two should be slight but the MATLAB one has the property that it preserves the signal energy content. That is a property that you expect to have when using a Gaussian filter. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-09-29T06:15:56.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18394" PostTypeId="1" CreationDate="2014-09-29T08:09:53.737" Score="-2" ViewCount="8503" Body="&lt;p&gt;I am new to dsp and just have a vague understanding of fft process. i know fft is used to convert time to freq domain.... i need to generate a sequence of frequencies such that F=[F1,F2,.....Fn-1] where n=16 and then need to do the ifft of it.... i need these freq sequences to be random... My friend told me that the sequence should have both Cos and sin wave making up (a+ib) an complex waveform.... Because i chose random signal in matlab using command rand and he told it generates random signals but only in positive x axis... he said something about choosing any random points from a circle.. i didn't quite understand what he meant by circle... can someone pls explain in simple words... I browsed all over and found fft only for sin or cos wave... how can i input a complex waveform to the fft so that i get a complex freq sequence becoz i read a fft returns a complex value... so am i supposed to input either sin or cos wave and get a complex output or should i input a complex wave... can someone give me a brief code in matlab since i'm trying to implement on matlab so that i can build on the code.. Also i know we input a time domain signal and th signal is sampled and we get bins which builds the freq.. i'm not quite clear in wat way we r supposed to sample and how it is build.. can someone also give an explanation not involving too much maths... Thank you&lt;/p&gt;&#xA;" OwnerUserId="11217" LastActivityDate="2014-09-30T12:03:58.807" Title="fft of a complex signal" Tags="|matlab|fft|ifft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18396" PostTypeId="1" AcceptedAnswerId="18398" CreationDate="2014-09-29T15:20:47.003" Score="-1" ViewCount="237" Body="&lt;p&gt;I am using an accumulator in the form of&#xA;X + [Y-1], X plus the unit delay of the output.&#xA;Is there an accumulator that follows this form, but will fall to 0 over time, similar to a differentiator?&lt;/p&gt;&#xA;" OwnerUserId="11221" LastActivityDate="2014-09-29T16:52:21.910" Title="Accumulator with decay?" Tags="|signal-analysis|filter-design|math|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18398" PostTypeId="2" ParentId="18396" CreationDate="2014-09-29T16:52:21.910" Score="0" Body="&lt;p&gt;You can use a &lt;em&gt;leaky accumulator&lt;/em&gt; (in analogy with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Leaky_integrator&quot; rel=&quot;nofollow&quot;&gt;leaky integrator&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\alpha x(n)+(1-\alpha)y(n-1),\quad 0&amp;lt;\alpha&amp;lt;1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also just multiply $y(n-1)$ with a constant less than 1. The reason why in (1) $x(n)$ is multiplied by $\alpha$ is to guarantee a DC gain of 1. &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-29T16:52:21.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18399" PostTypeId="1" CreationDate="2014-09-29T19:05:48.797" Score="-1" ViewCount="226" Body="&lt;p&gt;I'm trying to understand the aim of overlapping frames in the short term fourier transform. Why is it important to do it? I have been told that it's to avoid &quot;problems&quot; at the frontiers of frames. But does anyone have a more precise or mathematical explanation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="11225" LastActivityDate="2014-09-29T19:27:58.790" Title="Overlap frames in short term fourier transform" Tags="|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18401" PostTypeId="2" ParentId="18399" CreationDate="2014-09-29T19:27:58.790" Score="0" Body="&lt;p&gt;Short answer: bigger frames have more frequency resolution but less time resolution. In a really big frame you would know exactly what frequencies were present but not what time. The solution is to use overlapping frames to get more frequency resolution and still know what time those frequencies were present. &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-09-29T19:27:58.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18402" PostTypeId="1" AcceptedAnswerId="18403" CreationDate="2014-09-29T20:03:40.993" Score="0" ViewCount="1156" Body="&lt;p&gt;I came across this root locus diagram in my DSP class. It has a pole at the origin, another pole within the unit circle and a zero just outside the unit circle. I understand that the poles and zeros should be complex conjugates for an all pass filter. So will a pole or a zero at the origin prevent the system from being an all pass?My professor tells me that the pole at the origin is allowed. So that is basically leaving me confused.Can anyone explain how this is possible?&lt;/p&gt;&#xA;" OwnerUserId="11227" LastActivityDate="2014-09-29T20:55:34.180" Title="Can all pass filers have a pole/zero at the origin of the root locus" Tags="|filters|discrete-signals|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18403" PostTypeId="2" ParentId="18402" CreationDate="2014-09-29T20:55:34.180" Score="1" Body="&lt;p&gt;a delay is also an APF of sorts.  it passes the same magnitude and it affects the phase (in a linear manner w.r.t. frequency).  a delay of one sample has transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = z^{-1} = \frac{1}{z} = \frac{1}{z-0} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means there is a pole at $z=0$.  and it is true that $\left|H\left( e^{j \omega} \right)\right| = 1$, so it's an APF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, if the remaining pole/zero pairs are at reciprocal values this extra delay changes the phase of your APF a little, but not the magnitude response, so i think, strictly speaking, that it's still an APF.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-09-29T20:55:34.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18404" PostTypeId="1" CreationDate="2014-09-29T21:46:39.640" Score="0" ViewCount="688" Body="&lt;p&gt;I have data from a power transformer that has a frequency of 60 hz.  Sometimes there are faults in the system and causes a large spike in the reading of the transformer.  What I want to do is run the data into a signal processor to detect when these large spikes occur and either remove the spike value or present the time of occurrence.  how would I be able to detect this spike in Octave?&lt;/p&gt;&#xA;" OwnerUserId="11229" LastActivityDate="2014-09-30T19:29:24.980" Title="how to detect signal noise" Tags="|discrete-signals|noise|signal-detection|peak-detection|analog|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18408" PostTypeId="1" CreationDate="2014-09-30T06:56:47.333" Score="0" ViewCount="267" Body="&lt;p&gt;can anyone please help me with finding Convolution for following problem .....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) $h(n) = \delta[\sin(1 + |n|)]\quad \text{and}\quad x(n) = \sin(n^2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) $h(n) = \delta[\sin(2\pi n/N)] \quad \text{and}\quad x(n) = n^2$ where $N$ is odd.&lt;/p&gt;&#xA;" OwnerUserId="11097" LastEditorUserId="4298" LastEditDate="2014-09-30T07:20:13.760" LastActivityDate="2014-09-30T07:27:46.863" Title="Convolution of h(n) &amp; x(n)" Tags="|convolution|homework|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18409" PostTypeId="2" ParentId="18408" CreationDate="2014-09-30T07:27:46.863" Score="1" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that $n$ is an integer and that we're talking about discrete-time signals. You need to simplify the expressions for $h(n)$ by noting that $\delta(n)=1$ for $n=0$ and zero otherwise. So, for which values of $n$ does $\sin(1+|n|)$ equal zero, and for which values of $n$ does $\sin(2\pi n/N)$ equal zero?&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-09-30T07:27:46.863" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18410" PostTypeId="1" CreationDate="2014-09-30T09:04:21.923" Score="1" ViewCount="57" Body="&lt;p&gt;Suppose we have two signals( focus to audio) recorded with different methods,&#xA;or more simply, suppose we have two audio signals recorded with different microphone, and  we want to confirm that these signals are of the same audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the available alogorithms or libraries that make this possible?&lt;/p&gt;&#xA;" OwnerUserId="11234" LastActivityDate="2014-09-30T12:22:00.303" Title="Comparing signals recorded using diffrent methods" Tags="|speech-processing|speech|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18411" PostTypeId="2" ParentId="18394" CreationDate="2014-09-30T12:03:58.807" Score="1" Body="&lt;p&gt;The FFT converts a time-domain signal, which is a series of real numbers, into the frequency domain, as a series of complex numbers.  The IFFT converts back again - from the frequency to the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly, you are trying to produce a series of random amplitudes in the frequency domain, so that you get a random signal back in the time domain when you apply the IFFT.  However, convential random numbers are all real-valued, not complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of an FFT is a sequence of complex numbers of the form (x + iy).  This is equivalent to the Cartesian coordinates (x, y).  However, it is often easier to think of the FFT results in terms of polar coordinates (r, θ).  Here, r represents the amplitude and θ the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So one way to do what you want is to generate a random amplitude r, and a random phase 0 ≤ θ &amp;lt; 2π.  Then convert that from polar to Cartesian form.  Convert the Cartesian pair to a complex number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the circles - once you've picked your amplitude r, then picking the phase θ is effectively picking one point at random around a circle of radius r.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside: The only difference between a sine wave and a cosine wave is the phase.  If you feed a pure sine wave into an FFT, you will get a particular complex number out.  If you feed in a cosine wave of the same frequency and amplitude, the FFT result will have the same amplitude but a different phase.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2014-09-30T12:03:58.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18412" PostTypeId="2" ParentId="18410" CreationDate="2014-09-30T12:22:00.303" Score="2" Body="&lt;p&gt;Different flavors of cross correlation are probably the best choice here. It really depends on how exactly the recordings are different. Two microphones side by side behave very differently than two microphones in different spots in the room. Your best method will depend on a clear understanding of what your application needs to cover and what doesn't.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-09-30T12:22:00.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18413" PostTypeId="1" AcceptedAnswerId="18415" CreationDate="2014-09-30T13:14:57.907" Score="1" ViewCount="9004" Body="&lt;p&gt;I calculated the order of the FIR filter to be 31(N). so, the number of coefficients has to be 32 (N+1). so, I have to increase it to 33 to make it an odd number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the number of filter coefficients is required to be an odd number?&lt;/p&gt;&#xA;" OwnerUserId="11235" LastActivityDate="2014-09-30T13:39:30.667" Title="why the number of filter coefficients in FIR filter has to be an odd number?" Tags="|filter-design|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18414" PostTypeId="2" ParentId="18413" CreationDate="2014-09-30T13:35:59.070" Score="7" Body="&lt;p&gt;There is no such requirement. However, for linear-phase (symmetric) FIR filters, the delay can be expressed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;D = \frac{order}{2} = \frac{N_{taps} - 1}{2} \text{ samples}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the number of taps is odd, then the delay of the filter is an integer number of samples, which is desirable for some applications. If you have an even number of taps, then you end up with a half-sample delay.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-09-30T13:35:59.070" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18415" PostTypeId="2" ParentId="18413" CreationDate="2014-09-30T13:39:30.667" Score="3" Body="&lt;p&gt;I think it is about having a linear phase. Having a linear phase is often what you want because it means the delay introduced by the filter will be the same across all the frequency. Then, if you want a linear phase filter, you need to have a symmetrical arrangement of coefficient &lt;em&gt;around&lt;/em&gt; the centre coefficient. As for why you have to have a symmetrical number of coefficient around the centre to be of linear phase, I need to verify something then I will update the answer. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Jason R got the answer while I was looking for it! +1&lt;/p&gt;&#xA;" OwnerUserId="9090" LastActivityDate="2014-09-30T13:39:30.667" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18416" PostTypeId="1" CreationDate="2014-09-30T15:02:01.103" Score="0" ViewCount="234" Body="&lt;p&gt;I'm writing a modulator in matlab to simulate IQ data that I would get from my radio to test my demodulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read that $I = x(t) cos(\omega t)$ and $Q = x(t)  sin(\omega t)$.  What is the $\omega$ term?  If it is $2 \pi f$ then what is the frequency value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a modulated composite signal that I need to split into I and Q parts for my demodulator.  What should be the frequency value in the above equations? &lt;/p&gt;&#xA;" OwnerUserId="11237" LastEditorUserId="11237" LastEditDate="2014-10-01T17:04:39.283" LastActivityDate="2014-10-01T17:04:39.283" Title="Extracing IQ samples from a composite signal?" Tags="|demodulation|" AnswerCount="0" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18418" PostTypeId="1" AcceptedAnswerId="18420" CreationDate="2014-09-30T17:02:47.190" Score="0" ViewCount="53" Body="&lt;p&gt;I want to transform a studio audio dataset into a smartphone audio dataset (used for a speech recognition application). &lt;strong&gt;Would there be any difference in the resulting audio files using one of the following two aproaches?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Replay all audio files and record with smartphone.&lt;/li&gt;&#xA;&lt;li&gt;Convolute files with smartphone microphone impulse response, assuming the impulse response was determined using the same setup as&#xA;    in &quot;1.&quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11116" LastActivityDate="2014-09-30T17:13:06.170" Title="Re-recording audio vs. convoluting old audio data - differences?" Tags="|audio|impulse-response|speech-recognition|speech-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18419" PostTypeId="2" ParentId="18418" CreationDate="2014-09-30T17:06:26.380" Score="0" Body="&lt;p&gt;There would be no difference in the resulting audio files if you take the impulse response from the exactly same setup. This is because the impulse response describes exactly the transformation you would do manually in 1.&lt;/p&gt;&#xA;" OwnerUserId="11239" LastActivityDate="2014-09-30T17:06:26.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18420" PostTypeId="2" ParentId="18418" CreationDate="2014-09-30T17:13:06.170" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Would there be any difference in the resulting audio files using one of the following two aproaches?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There would be a difference - probably negligible - which would represent the non-linearity or time-dependence in the system.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-09-30T17:13:06.170" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18422" PostTypeId="2" ParentId="18404" CreationDate="2014-09-30T19:29:24.980" Score="2" Body="&lt;p&gt;I'll assume that your data is in the form of discrete samples equispaced in time (as given by a standard analog-to-digital converter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the nominal signal is a clean 60Hz sine wave, I would suggest filtering out the 60Hz with a digital notch filter. This will essentially subtract the correct signal, leaving you with the noise. Then, compare the magnitude of the filter output to a threshold (which you will choose empirically) in order to detect the spikes. Note that the filter may or may not introduce a delay between the original signal and the filter output (esp, if you are doing this in realtime), which you will need to compensate in your time-of-occurrence estimate. This time compensation may also apply to the methods below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the nominal signal is not a clean sine wave, you can probably track the nominal frequency characteristics of the signal, e.g. using short time fourier transform, and watch for undesirable deviations from this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also be able to perform a linear prediction on the signal, and detect spike noise events based on the magnitude of the prediction error signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are all just suggestions, many other approaches likely exist.&lt;/p&gt;&#xA;" OwnerUserId="11240" LastActivityDate="2014-09-30T19:29:24.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18423" PostTypeId="1" AcceptedAnswerId="19038" CreationDate="2014-10-01T02:19:36.377" Score="3" ViewCount="1910" Body="&lt;p&gt;I'm trying to do bandpass filtering of a EEG signal samples at 250Hz and benchmarking the following 4 methods of FIR filtering for different filter orders. The length of the signal is 15000 samples.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Time Domain Approach (convolution)&lt;/li&gt;&#xA;&lt;li&gt;Direct frequency domain approach&lt;/li&gt;&#xA;&lt;li&gt;Overlap-add &lt;/li&gt;&#xA;&lt;li&gt;Overlap-save&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For follow the procedure listed in the following Wiki pages for overlap-add and overlap-save&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&lt;/a&gt;&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For frequency domain approach I do FFT for the entire length of the signal, multiply with the frequency response of filter H and then IFFT the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For overlap and add, I chose M(overlap) to be 1+length_of_response and L to be twice of M.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although one would expect Overlap-add to outperform Direct Frequency domain approach, this is not what I see in my benchmark results(see attached figure).&lt;img src=&quot;https://i.stack.imgur.com/V6dEL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me out in understanding where I might be going wrong.&lt;/p&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="4346" LastEditDate="2017-01-05T04:12:09.690" LastActivityDate="2022-08-31T19:50:58.910" Title="direct Frequency domain FIR filtering vs Overlap-add method" Tags="|fft|filter-design|eeg|fast-convolution|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18424" PostTypeId="1" CreationDate="2014-10-01T04:33:58.263" Score="3" ViewCount="6371" Body="&lt;p&gt;Have many audio files 1 minute long. Some of them are normal. Some of them are noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a normal file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FhRWF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a noise:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/A3aBV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is noise too:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LwwDq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do auto detect noise using python?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW: if you suggest any external console program which can do that it will be cool too.&lt;/p&gt;&#xA;" OwnerUserId="11241" LastActivityDate="2015-01-29T09:30:08.517" Title="Audio noise detection with python" Tags="|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18425" PostTypeId="1" CreationDate="2014-10-01T05:50:02.777" Score="0" ViewCount="169" Body="&lt;p&gt;In LTE systems the in the scrambling section, a gold sequence is used. But I've studied that gold sequences are used in spread spectrum communication. This generally increases the bandwidth. So doesn't this mean that scrambling results in an increase of bandwidth.?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-10-01T10:22:37.313" Title="does scrambling increse the bandwidth" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18426" PostTypeId="2" ParentId="18424" CreationDate="2014-10-01T06:24:01.170" Score="3" Body="&lt;p&gt;First, there are many ways to do your task. Depending on your background, some might be easier than others for you to understand and use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are familiar with signal processing, you might construct a noise model and based on this noise model to detect whether or not a given signal is of pure noise. This type of method often involves hypothesis tests, and test statistics. Based on these things, it rejects or fails to reject a given sample accordingly. This is a quite traditional way to solve your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really donot care about details here, you might complete ignore signal and audio. Purely consider what you have are different data streams, and you can use all kind of machine learning methods to differentiate two classes of things, in your case, one is noise and the other is non-noise. If you are going to adopt this approach, python sklearn package will be your good friend with many great tutorials teaching 0-level people to do machine learning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, let me remind you that one big difference of the later approach from the former one is that you need prepare labels of each signal sample. Otherwise, ML algorithms will have a better chance to differentiate these two classes when you have labels and many samples. Anyhow, both approaches are belonging to the pattern recognition family, and thus they are definitely related to each other. For example, you might view a probabilistic noise model is somewhat a naive bayes classifier. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2014-10-01T06:24:01.170" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18427" PostTypeId="1" CreationDate="2014-10-01T09:27:33.213" Score="-1" ViewCount="3029" Body="&lt;p&gt;let us consider following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; fs=100;&#xA;&amp;gt;&amp;gt; t=0:1/fs:2.93;&#xA;&amp;gt;&amp;gt; x=25*sin(2*pi*30*t)+20*cos(2*pi*25*t)+10*rand(size(t));&#xA;&amp;gt;&amp;gt; y=23*sin(2*pi*30*t)+21*cos(2*pi*25*t)+11*rand(size(t));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i would like to ask question related to  Cross Power Spectral Density  function , which in matlab can be easily estimated using function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; cpsd(x,y,[],[],1024,fs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xGboQ.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;can this method used tool for identify if two time series have identical spectral structure? i mean suppose we have two time series  which is supposed to have same  spectral structure(periodic components with same frequencies as it is given in our case) can this function help us to proof that give two series have same structure? thanks in advance&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorDisplayName="user350" LastEditDate="2014-10-01T09:36:39.117" LastActivityDate="2014-10-01T14:24:34.777" Title="cross power spectral density explanation in matlab" Tags="|matlab|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18428" PostTypeId="2" ParentId="18425" CreationDate="2014-10-01T10:22:37.313" Score="1" Body="&lt;p&gt;No, scrambling does not increase the bandwidth.  Scrambling does even out the bandwidth, such that the power is spread evenly over the signal bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are thinking of chipping, which is used in &lt;a href=&quot;http://en.wikipedia.org/wiki/Direct-sequence_spread_spectrum&quot; rel=&quot;nofollow&quot;&gt;DSSS&lt;/a&gt; systems.  Scrambling and chipping are different processes.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-10-01T10:22:37.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18429" PostTypeId="1" CreationDate="2014-10-01T10:23:01.967" Score="1" ViewCount="545" Body="&lt;p&gt;I've studied that when the bandwidth increases, the number of taps we consider for channel modelling increases(example in WLAN or LTE). why is that happening. why signals with lower bandwidth (example : voice channel) see only a single tap/ a flat fading channel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-10-01T19:04:03.817" Title="what is the relation between bandwidth and channel taps" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18431" PostTypeId="1" CreationDate="2014-10-01T11:55:05.060" Score="1" ViewCount="760" Body="&lt;p&gt;I have this system: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = -\frac{1}{2}  x[n+2] - y[n+1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea how to prove if the system is linear or not, because, it depends on future outputs...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help&lt;/p&gt;&#xA;" OwnerUserId="11250" LastEditorUserId="4298" LastEditDate="2021-03-07T11:22:17.527" LastActivityDate="2021-03-07T11:22:17.527" Title="Is this system linear?" Tags="|discrete-signals|linear-systems|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18433" PostTypeId="2" ParentId="18431" CreationDate="2014-10-01T13:31:27.627" Score="3" Body="&lt;p&gt;For linearity it is irrelevant if the output depends on future values. This only affects the system's causality. For linearity you just need to check whether the response to the signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ax_1[n] + bx_2[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;equals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ay_1[n] + by_2[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y_1[n]$ and $y_2[n]$ are the individual responses to inputs $x_1[n]$ and $x_2[n]$, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And of course you can write the input/output relation as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n+1] = -\frac12 x[n+2] - y[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will now characterize all sequences that satisfy the recursion (1) for the specific input signal $x[n]=\delta[n]$. Applying the $\mathcal{Z}$-transform to (1) we get (with $X(z)=1$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=-\frac12\frac{z^2}{1+z}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function $Y(z)$ corresponds to one left-sided sequence and to one right-sided sequence. Note that left-sided and right-sided doesn't necessarily mean anti-causal and causal, but it only means that $y(n)=0$ for $n&amp;gt;N$ or for $n&amp;lt;N$, respectively, for some positive or negative integer $N$. These two sequences are given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_{p1}[n]=\frac12 (-1)^{n}u(n+1)\tag{3}$$&#xA;and&#xA;$$y_{p2}[n]=-\frac12 (-1)^n u(-n-2)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that neither (3) nor (4) is causal. The sequences $y_{p1}[n]$ and $y_{p2}[n]$ are particular solutions of the difference equation (1) for $x[n]=\delta[n]$. They are in fact impulse responses of two different linear time-invariant (LTI) systems described by the difference equation (1). The impulse response $y_{p1}[n]$ was mentioned by Dilip Sarwate in a comment below, and something similar to $y_{p2}[n]$ was mentioned by Robert B.-J. I completely agree with them that the difference equation (1) describes an LTI system, if it is used to describe a system with either (3) or (4) as impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the sequences (3) and (4) are not the only sequences that satisfy (1). Looking at the homogeneous difference equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n+1]=-y[n]\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_h[n]=c(-1)^n,\quad c\in\mathbf{R}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is a solution of (5). Consequently, the general solution of (1) (with $x[n]=\delta[n]$) can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=y_{p1}[n]+y_h[n]=\frac12 (-1)^{n}u(n+1) + c(-1)^n\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course we could as well have used $y_{p2}[n]$ to define the general solution. Note that $y_{p2}[n]$ is obtained from (7) by choosing $c=-1/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assume that we scale the input signal and use $x[n]=2\delta[n]$ instead. Obviously, the solutions $y_{p1}[n]$ and $y_{p2}[n]$ will change accordingly, but the general solution (7) will not (unless $c=0$ or $c=-1/2$), because the homogeneous solution (6) does not depend on $x[n]$. This is why I claim that the difference equation (1) does not necessarily describe an LTI system. In our case, it describes exactly two LTI systems &lt;em&gt;and&lt;/em&gt; an infinite number of systems which are neither linear nor time-invariant.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-10-08T12:02:26.703" LastActivityDate="2014-10-08T12:02:26.703" CommentCount="27" ContentLicense="CC BY-SA 3.0" />
  <row Id="18434" PostTypeId="2" ParentId="18427" CreationDate="2014-10-01T14:24:34.777" Score="0" Body="&lt;p&gt;I think that the picture is more or less what should be expected.  There are strong components at 25 Hz and 30 Hz, which are the frequencies of the tones in $x$ and $y$.  There is also a strong DC (0 Hz) component because the noise has a strong mean, because it ranges from 0 to 1, not -1 to 1.  Without the noise the cpsd looks like this-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gwNp4.png&quot; alt=&quot;CPSD&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-10-01T14:24:34.777" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18435" PostTypeId="1" CreationDate="2014-10-01T16:47:43.753" Score="8" ViewCount="47986" Body="&lt;p&gt;For an FIR filter, with symmetrical tap values $h[N-1-n]=h[n]$, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;why is the group delay $\frac{N-1}{2} T$ (where $N$ is the number of taps of the FIR filter and $T$ is the sampling time)?  &lt;/li&gt;&#xA;&lt;li&gt;Why is linear phase so important for the filter response?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11235" LastEditorUserId="1629" LastEditDate="2018-03-12T18:42:19.543" LastActivityDate="2022-09-03T13:33:36.657" Title="Group delay of the FIR filter" Tags="|filters|filter-design|finite-impulse-response|linear-phase|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18436" PostTypeId="2" ParentId="18435" CreationDate="2014-10-01T16:54:10.187" Score="9" Body="&lt;p&gt;To be precise the group delay of a linear phase FIR filter is $(N-1)/2$ samples, where $N$ is the filter length (i.e. the number of taps). The group delay is constant for all frequencies, because the filter has a linear phase, i.e. its impulse response is symmetrical (or asymmetric). A linear phase means that all frequency components of the input signal experience the same delay, i.e. there are no phase distortions. So for a frequency selective filter (e.g., a low pass filter), if the input signal is in the passband of the filter, the output signal is approximately equal to the input signal delayed by the group delay of the filter. Note that in general FIR filters do not have a linear phase response. In this case, the group delay is a function of frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider an odd length FIR filter with even symmetry (&quot;type I filter&quot;). In this case the group delay is an integer number of samples $K=(N-1)/2$. The filter has a linear phase response (because the group delay is the negative derivative of the phase) and the filter's frequency response can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=A(\omega)e^{-jK\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A(\omega)$ is the real-valued amplitude function, and $\phi(\omega)=-K\omega$ is the (linear) phase. If the input signal's Fourier transform is $X(\omega)$, then the Fourier transform of the output signal is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(\omega)=H(\omega)X(\omega)=A(\omega)X(\omega)e^{-jK\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assume that the frequency content of the input signal is in the passband of the filter, i.e. in the frequency region where $A(\omega)\approx 1$ holds. Then from (1) the output signal's spectrum can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(\omega)\approx X(\omega)e^{-jK\omega}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, from the shift property of the Fourier transform, the output signal is (approximately) given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)\approx x(n-K)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. $y(n)$ is a delayed version of the input signal, where the delay is given by the group delay $K$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-10-02T14:58:20.043" LastActivityDate="2014-10-02T14:58:20.043" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18437" PostTypeId="1" AcceptedAnswerId="18439" CreationDate="2014-10-01T18:43:24.793" Score="0" ViewCount="790" Body="&lt;p&gt;I am attempting to write a FFSK (differentially encoded MSK) modulator.  I have found and implemented a demodulator that works with sample data taken from a radio of a FFSK signal.  The demodulator uses a FM Discriminator to transform the IQ data to a FFSK signal that can be decoded.  I am using the method described in the article &quot;Minimum Shift Keying: A Spectrally Efficient Modulation&quot; by Subbarayan Pasupathy to modulate a FFSK signal.  When a FM Discriminator is applied to the output of the modulator a square wave alternating between +/- 4.5 deg is produced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a snippet of my matlab code used for modulation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% differentially encode to produce a 1-to-1 mapping between input bits and output frequency for FFSK&#xA;diffBits = [bits(1) zeros(1, length(bits) - 1)];&#xA;for i=2:length(diffBits)&#xA;    diffBits(i) = xor(diffBits(i - 1), bits(i));&#xA;end&#xA;iBits = diffBits(1:2:end);&#xA;qBits = diffBits(2:2:end);&#xA;&#xA;% rectangular pulses of duration 2*T w/ Q delayed from I by T&#xA;iPulses = [kron(iBits * 2 - 1, ones(1, 2 * SYMBOL_SAMPLES)) zeros(1, SYMBOL_SAMPLES)];&#xA;qPulses = [zeros(1, SYMBOL_SAMPLES) kron(qBits * 2 - 1, ones(1,2 * SYMBOL_SAMPLES))];&#xA;t = -T:SAMPLE_PERIOD:(MESSAGE_DURATION - SAMPLE_PERIOD);&#xA;plotTime = t/T;&#xA;&#xA;% baseband symbols (Parallel generation of Type I MSK, see Couch Figure 5-36)&#xA;iSymbols = iPulses .* cos(pi * t / (2 * T));&#xA;qSymbols = qPulses .* sin(pi * t / (2 * T));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a graph of the output of the FM discriminator from the sample data:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Nwad7.png&quot; alt=&quot;Sample data - FM discriminator&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a graph of the output of the FM discriminator from the modulator data:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cJQd6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what is different between the real data and my modulator that could produce this different output?  I am looking for a way to make my modulator produce data similar to the sample data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this helps, here is the FFT of the baseband of the sample data (derotated and resampled down):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% samples are complex int16 values read in from a file&#xA;num_samples_fft = 4096*2;&#xA;Fs = 781250;&#xA;freqOffset = -25200&#xA;shifted_samples = samples .* exp(2*j*pi*freqOffset/Fs*(0:length(samples)-1));&#xA;resampled_samples = resample(shifted_samples, 96, 3125);&#xA;resampled_samples_fft = fft(resampled_samples,num_samples_fft);&#xA;resampled_samples_fft = resampled_samples_fft([num_samples_fft/2+1:end 1:num_samples_fft/2]);&#xA;figure;&#xA;plot(f,2*abs(resampled_samples_fft(1:num_samples_fft)));&#xA;title('Sample Data FFT');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qhbl5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas if I do the same process to data that I modulate this is the resulting FFT graph:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hX6VX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11237" LastEditorUserId="11237" LastEditDate="2014-10-03T18:54:49.280" LastActivityDate="2014-10-03T18:54:49.280" Title="MSK signal recoverd though FM Discriminator?" Tags="|signal-analysis|modulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18438" PostTypeId="2" ParentId="18429" CreationDate="2014-10-01T19:04:03.817" Score="3" Body="&lt;p&gt;Just as you sample a signal to process or model it digitally, you also sample the channel's impulse response. Each sample corresponds to one tap. When the signal's bandwidth increases, you increase the sampling rate, so your channel model now has more taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, a channel is modelled as having a single tap (flat fading) when the channel's impulse response is different than zero only for the first sample. You can then ignore all other taps, since they're zero. This means that the largest path delay through the channel is shorter than the sampling interval. The implication is that a symbol will not interfere with its neighbors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, if you oversample, you can get a channel impulse response with more than one tap and still have flat fading. Flat fading means that, at the sample corresponding to the symbol time (and all subsequent samples), the channel's impluse response is zero.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-01T19:04:03.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18439" PostTypeId="2" ParentId="18437" CreationDate="2014-10-01T20:59:30.897" Score="0" Body="&lt;p&gt;It is possible that the sample data has a pulse-shaping filter before the frequency modulator. That would explain the first plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the power spectrum of the sample data and check the sidelobe levels as compared to textbook MSK and your modulator. A pulse shaping filter will reduce the sidelobe levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Square waves are expected in the second plot, because the data entering the modulator has no pulse shaping on it. The spectrum should be textbook MSK.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2014-10-01T20:59:30.897" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="18441" PostTypeId="2" ParentId="16547" CreationDate="2014-10-01T22:41:28.267" Score="0" Body="&lt;p&gt;In your simulation, the sampling frequency is 1000 Hz, which means the Nyquist frequency is 500 Hz. The carrier frequency is very close to 95.5 Hz (&lt;code&gt;600/(2*pi)&lt;/code&gt;). The message has frequency 10 Hz. This means the signal &lt;code&gt;Demodulated&lt;/code&gt; has harmonics at frequencies 10, 181, and 201 Hz. So, the cut-off frequency of your low-pass filter can be set at any frequency above 10 and below 181. Let's say you want it at 100 Hz. Matlab has many commands to design filters. A simple one is &lt;code&gt;fir1&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = fir1(10,100/500);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;100/500&lt;/code&gt; is your cutoff frequency divided by the Nyquist frequency. The first argument, &lt;code&gt;10&lt;/code&gt;, is the filter order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To recover the message, you can convolve &lt;code&gt;Demodulated&lt;/code&gt; with the filter's impulse response &lt;code&gt;b&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Rx = conv(Demodulated, b);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By the way, I would change the name of the signal &lt;code&gt;Demodulated&lt;/code&gt;, since it's not really demodulated yet. A better name might be &lt;code&gt;rx_mixed&lt;/code&gt; or something along those lines.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-01T22:41:28.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18442" PostTypeId="1" CreationDate="2014-10-01T23:21:18.097" Score="0" ViewCount="66" Body="&lt;p&gt;I compared the difference between seperable and direct filtering for MATLAB's cameraman image. The difference is huge. I would like to understand the reason for this. Code below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('cameraman.tif');&#xA;&#xA;% Do seperable 1-D filtering&#xA;H = 11;&#xA;sigma = 2;&#xA;g1 = fspecial('gaussian',[1 H],sigma);&#xA;&#xA;I2 = double(I);&#xA;I_seperable = double(I);&#xA;for i = 1:size(I,1)&#xA;   I2(i,:) = imfilter(double(I(i,:)),g1,'circular','same','conv');&#xA;end&#xA;for j = 1:size(I,2)&#xA;  I_seperable(:,j) = imfilter(double(I2(:,j)),g1,'circular','same','conv');&#xA;end&#xA;&#xA;% Do direct 2-D filtering &#xA;g2 = fspecial('gaussian',[H H],sigma);&#xA;&#xA;% How much do the results differ ?&#xA;I_direct = imfilter(double(I),g2,'circular','same','conv');&#xA;delta_I = double(I_direct) - double(I_seperable);&#xA;norm(delta_I,'fro')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result of last computation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ans =&#xA;&#xA;    2.1879e+03&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2022-07-13T06:06:30.687" Title="Different results for seperable filtering v/s direct filtering on 2-D image in MATLAB" Tags="|matlab|convolution|gaussian|filtering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18443" PostTypeId="2" ParentId="18390" CreationDate="2014-10-01T23:48:21.480" Score="0" Body="&lt;p&gt;The first method involves computation of the Gaussian function including its normalization factor. The normalization factor is relevant for the full distribution. In fact, evaluating it at discrete points is not correct since it is meant to be used for a continuous distribution. However, even if we omit the normalization factor from the function, we could still use the uniformly discretized $[-5\sigma,5\sigma]$ to compute the filter. In fact, the first method has the nice property that filter values fall at intervals of $\sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely, the second method(MATLAB's) is used since we are guaranteed to have uniform discretization (stepping in integer increments) unlike the first method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, while plotting, we do need to use the normalization factor to ensure the vertical lines(green,blue lines in plots shown) line up nicely.&lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="4515" LastEditDate="2014-10-03T09:00:17.687" LastActivityDate="2014-10-03T09:00:17.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18444" PostTypeId="2" ParentId="18442" CreationDate="2014-10-02T00:00:30.750" Score="1" Body="&lt;p&gt;Turns out that when doing filtering by columns, i.e. for the following section&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for j = 1:size(I,2)&#xA;   I_seperable(:,j) = imfilter(double(I2(:,j)),g1,'circular','same','conv');&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we need to make sure the filter is aligned &lt;strong&gt;along columns&lt;/strong&gt;. Changing &lt;code&gt;g1&lt;/code&gt; to &lt;code&gt;g1'&lt;/code&gt; makes the difference almost zero as seen below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ans =&#xA;&#xA;   1.9782e-11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2014-10-02T00:00:30.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18446" PostTypeId="2" ParentId="8971" CreationDate="2014-10-02T01:26:21.710" Score="1" Body="&lt;p&gt;The sampling frequency depends not only on the carrier frequency and the symbol (baud) rate, but also on the pulse shape. If you transmit with square pulses, you'll need a very large bandwidth (in theory, infinite). If you transmit with sinc pulses, then the base-band bandwidth is half the pulse rate. Other pulses will fall somewhere in between.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To expand on Peter K.'s comment: you should look into using the complex envelope for simulation. The advantage is that, when you use it, the sampling frequency depends only on the symbol rate and pulse shape, not on the carrier frequency.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-02T01:26:21.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18449" PostTypeId="2" ParentId="17241" CreationDate="2014-10-02T11:50:03.817" Score="-1" Body="&lt;p&gt;I am also working on UWB bio radar to detect the heart beats. But the problem is that breath signal is also mixed up with heart signal. I am trying to remove the breath signal (0.25 to 0.7 Hz) and to get the heart frequency signal (1  to 4 Hz). Currently I am also using an ultrasound sensor to detect heart signal. &lt;/p&gt;&#xA;" OwnerUserId="11262" LastActivityDate="2014-10-02T11:50:03.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18451" PostTypeId="1" CreationDate="2014-10-02T13:20:57.367" Score="1" ViewCount="183" Body="&lt;p&gt;I am trying to use FFT as a fast way to convolve a image, however one of the downsides of this is that the &quot;kernel&quot; image will repeat when reaching the edges of the sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to avoid this to make it more like a classic convolution, that cuts off at the edges?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LUUky.jpg&quot; alt=&quot;Edge repeating&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11263" LastActivityDate="2014-10-08T02:03:11.793" Title="Avoiding edge repeats in a FFT convolution" Tags="|fft|image-processing|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18452" PostTypeId="2" ParentId="17593" CreationDate="2014-10-02T13:38:51.027" Score="1" Body="&lt;p&gt;The Doppler frequency resolution is not determined by any characteristic of the moving target. It is determined by the Radar system parameters. If you are using a FFT to to determine the Doppler shift, this assumes that you're transmitting a sinusoidal pulse. The length of the pulse then determines the Doppler resolution for that single pulse. This assumes the radial velocity of the target is relatively constant for the pulse - usually this is not too bad an assumption&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can increase the resolution by coherently integrating multiple pulses. There are design constraints on the Pulse Repetition Frequency (PRF). The PRF needs to be high enough to sample the Doppler frequency bandwidth of interest. PRF needs to be low enough to allow the pulse to propagate to the target range and back, or else you will suffer from pulse ambiguities. Note that at a fixed PRF you will also have blind velocities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of pulses you integrate is referred to as the Coherent Processing Interval (CPI). As mentioned elsewhere, if your target does not maintain a constant radial velocity throughout the CPI, this will result is some spectral spreading across your FFT bins. &lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2014-10-02T13:38:51.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18453" PostTypeId="1" AcceptedAnswerId="18455" CreationDate="2014-10-02T13:43:28.210" Score="0" ViewCount="1172" Body="&lt;p&gt;Well, I am new to DSP so I apologize for the basic question. I am trying to transform audio 16bit PCM (which I store in normalized 0.0-1.0 range) samples into frequency domain using fft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that FFT transforms N points of time domain into two N sized frequency domain array. My problem is determining the size of N. For example if I have a 5mins PCM signal sampled at 8000 Hz/sec I can't find a way to get the spectrum of the whole signal, and not several arrays of size (e.g. 1024, 2048 etc..).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can I transform the whole signal at once ?&lt;/li&gt;&#xA;&lt;li&gt;If I cannot, is there away to combine the spectrum of different N sized segments?&lt;/li&gt;&#xA;&lt;li&gt;Is it reasonable to study the spectrum of a whole large signal at once ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7918" LastActivityDate="2014-10-02T14:46:58.460" Title="How to transform large set of audio samples using FFT?" Tags="|fft|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18454" PostTypeId="1" CreationDate="2014-10-02T14:19:19.617" Score="3" ViewCount="178" Body="&lt;p&gt;How can I periodically estimate the states of a discrete &lt;a href=&quot;http://en.wikipedia.org/wiki/LTI_system_theory&quot; rel=&quot;nofollow&quot;&gt;linear time-invariant system&lt;/a&gt; in the form $$\dot{\vec{x}}=\textbf{A}\vec{x}+\textbf{B}\vec{u}$$ &#xA;$$\vec{y}=\textbf{C}\vec{x}+\textbf{D}\vec{u} $$if the measurements of its output $y$ are performed in irregular intervals? (suppose the input can always be measured).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My initial approach was to design a &lt;a href=&quot;http://en.wikipedia.org/wiki/State_observer&quot; rel=&quot;nofollow&quot;&gt;Luenberger observer&lt;/a&gt; using estimates $\hat{\textbf{A}}$, $\hat{\textbf{B}}$, $\hat{\textbf{C}}$ and $\hat{\textbf{D}}$ of the abovementioned matrices, and then update it periodically every $T_s$ seconds according the following rule:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If there has been a measurement of $y$ since the last update: $$\dot{\hat{x}}=\hat{\textbf{A}}\hat{x}+\hat{\textbf{B}}\hat{u}+\textbf{L}(y_{measured}-\hat{\textbf{C}}\hat{x})$$&#xA;  If not:&#xA;  $$\dot{x}=\hat{\textbf{A}}\hat{x}+\hat{\textbf{B}}\hat{u}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(I have omitted the superscript arrows for clarity)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that there may be a better way to do this, since I'm updating the observer using an outdated measurement of $y$ (which is outdated by $T_s$ seconds in the worst case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank's in advance.&lt;/p&gt;&#xA;" OwnerUserId="11264" LastActivityDate="2017-11-22T17:32:08.520" Title="How to periodically estimate states of a LTI if the output is measured irregularly?" Tags="|filter-design|estimation|linear-systems|control-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18455" PostTypeId="2" ParentId="18453" CreationDate="2014-10-02T14:36:49.093" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Can I transform the whole signal at once ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, this would be a 2400000 points FFT - something that is easy for a modern desktop computer (note that the sample rate is measured in Hz or samples/sec, not in Hz/s).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I cannot, is there away to combine the spectrum of different N sized segments?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Averaging the spectrum obtained on successive short windows is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Welch&amp;#39;s_method&quot; rel=&quot;nofollow&quot;&gt;common spectral estimation technique&lt;/a&gt; - but I'm not sure this is really what you need here.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it reasonable to study the spectrum of a whole large signal at once ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It makes sense if the signal is stationary. I can think of some applications in which this would be the case (for example you record 5 min of continuous hum/noise generated by a machine), but this would be an exception more than a rule - and I can't think of a practical reason why one would have to perform a FFT on such a large chunk of signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For signals whose characteristics change with time - such as speech or music - spectral analysis is more commonly performed on short segments. It all depends on what you want to do with the result of the FFT. If it is to extract a property of the signal (such as its pitch, or a metric like spectral centroid), make sure it is reasonable to assume that the property you want to extract is constant over the duration of the signal. If not, break down the signal into short segments during which this property can be considered constant.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-10-02T14:36:49.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18456" PostTypeId="2" ParentId="18453" CreationDate="2014-10-02T14:46:58.460" Score="3" Body="&lt;p&gt;I completely agree with pichenettes' answer, but one term that I miss there and that is probably useful for you is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform#Discrete-time_STFT&quot; rel=&quot;nofollow&quot;&gt;Short-time Fourier Transform&lt;/a&gt; (STFT), which gives you a time-frequency analysis of your signal. I.e., you get to see the change of the signal's spectrum over time. This time information becomes completely invisible if you just take a Fourier transform of the whole signal. Also from a computational and storage perspective the computation of one long FFT is not very attractive. Since your signal is an audio signal I assume that it is not stationary over the time interval you consider, and for this reason the STFT will give you additional useful information.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-02T14:46:58.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18458" PostTypeId="1" CreationDate="2014-10-02T16:37:01.723" Score="-1" ViewCount="3840" Body="&lt;p&gt;Say you are given a vector t =[...] for the time to be used to generate a sine wave of a certain frequency say FHz. I have all the data for t so I can conclude what dt is (my dt = 1d-5). Now I am to do an FFT analysis and plot magnitude vs frequency so I expect to get my original amplitude and also get back the original phase&#xA;This what I do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;frequency = ...; %This in Hz&#xA;&#xA;dt = t(2) - t(1); %which is equal to 1d-5&#xA;&#xA;fs = 2*frequency; % should this be 1/dt? or something else?&#xA;&#xA;Nfft = fs;&#xA;&#xA;intensity = sin(2*pi*frequency*t);&#xA;&#xA;FFT_intensity =fft(intensity,Nfft)/Nfft;&#xA;&#xA;magIntensity = abs(FFT_intensity);&#xA;&#xA;f=linspace(-fs/2, fs/2, Nfft); &#xA;&#xA;plot(f,fftshift(magIntensity))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results I get are sometimes correct and sometimes incorrect, it seems like when I chop the length of the t vector or change fs (say fs = 1/dt instead) I get the wrong amplitude ( and wrong phase, not shown here)... In general how to relate FHz, Fs and t?&#xA;I can actually include the numbers I am using if that makes any difference.&#xA;Thank you for any input.&lt;/p&gt;&#xA;" OwnerUserId="11266" LastActivityDate="2022-07-13T07:07:05.657" Title="Relationship between Fs (the Nyquist frequency), and the frequency used with a sine wave" Tags="|fft|nyquist|amplitude|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18459" PostTypeId="2" ParentId="18431" CreationDate="2014-10-02T17:15:20.820" Score="4" Body="&lt;p&gt;Matt's &lt;em&gt;original&lt;/em&gt; answer, regarding linearity, is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\mathbb{T}\{ . \}$ be the linear operator that maps input $x[n]$ to output $y[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = \mathbb{T}\{ x[n] \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the &lt;strong&gt;sole&lt;/strong&gt; necessary definition for linearity is simply whether superposition applies for all possible inputs.  for a discrete-time system, if, for two completely arbitrary inputs, $x_1[n]$ and $x_2[n]$, this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y_1[n] + y_2[n] = \mathbb{T}\{ x_1[n] \} + \mathbb{T}\{ x_2[n] \} =  \mathbb{T}\{ x_1[n] + x_2[n] \} \quad \forall n \in \mathbb{Z}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is true, then the system is Linear.  that is the sole criterion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the scaling property&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; a \cdot y[n] &amp;amp;= a \cdot \mathbb{T}\{ x[n] \}  \\&#xA; &amp;amp; = \mathbb{T}\{ a \cdot x[n] \} \quad \forall n \in \mathbb{Z}, a \in \mathbb{C} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be derived directly from the superposition property, first for integer $a$, then for reciprocal integer $a$, then for real and rational $a$.  a little more handwaving regarding continuity and limits is needed to extend this to any real $a$, and not much else is needed to extend to $a \in \mathbb{C} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linearity is &lt;strong&gt;solely&lt;/strong&gt; a property of the system.  it is not a property of the input.  so if it is true for one particular input, &lt;strong&gt;if&lt;/strong&gt; the system is Linear, it's also true for &lt;strong&gt;any&lt;/strong&gt; other input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;similarly, for Time-Invariance, if, for a discrete-time $y[n] = \mathbb{T}\{ x[n] \}$, then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n-N] = \mathbb{T}\{ x[n-N] \} \quad \forall n,N \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the discrete-time system satisfies that criterion, it's Time-Invariant.  likewise, Time-Invariancy is a property solely of the system, not of the inputs to the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if a system satisfies &lt;strong&gt;both&lt;/strong&gt; criteria for Linearity and Time-Invariancy, then it is &quot;LTI&quot; and we get to use all this cool Fourier and Z-transform technique on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the system as depicted by the OP is LTI, however, it is also anti-causal (which is also &quot;acausal&quot;, but &quot;acausal&quot; is a less specific property than &quot;anti-causal&quot;) .&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-10-02T17:26:21.170" LastActivityDate="2014-10-02T17:26:21.170" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="18460" PostTypeId="2" ParentId="18458" CreationDate="2014-10-02T18:30:11.387" Score="0" Body="&lt;p&gt;The sampling frequency &lt;code&gt;fs&lt;/code&gt; is &lt;code&gt;1/dt&lt;/code&gt;. Conceptually, if the time between samples is $T$, then you have $1/T$ samples per second, which is the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, you need to make sure that &lt;code&gt;frequency&lt;/code&gt;, the sine wave's frequency, is less than the Nyquist frequency, which is &lt;code&gt;fs/2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For interpreting the spectrum (&lt;code&gt;FFT_intensity&lt;/code&gt;), please see the answer pointed to by Matt L.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-02T18:30:11.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18461" PostTypeId="1" AcceptedAnswerId="18484" CreationDate="2014-10-02T18:33:12.617" Score="2" ViewCount="6430" Body="&lt;p&gt;I have an assignment where I'm given the DFT of a sequence $x[n]$ as $X[k]=\{4,3,2,1,0,1,2,3\}$ and also&#xA;$$y[n] = \left\{ \begin{array}[cc]&#xA;xx[n/2] &amp;amp; \text{if n is even} \\&#xA;0 &amp;amp; \text{otherwise}&#xA;\end{array} \right. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I'm supposed to find and sketch the DFT of $y[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $y[n] = \{x[0], 0, x[1], 0 ... x[7], 0\}$ and it's not complicated to find $Y[k]$ if we know $x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to use the definition of the DFT and IDFT to calculate $x[n]$ but it's a tedious task to do by hand, especially when the sequence is longer than a few items. Is there a quicker way to calculate the DFT and IDFT by hand without using a program like Matlab?&lt;/p&gt;&#xA;" OwnerUserId="11049" LastEditorUserId="11049" LastEditDate="2014-10-03T10:06:28.147" LastActivityDate="2014-10-04T14:07:11.310" Title="Discrete Fourier Transform by hand" Tags="|fourier-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18462" PostTypeId="2" ParentId="18431" CreationDate="2014-10-02T21:31:37.143" Score="0" Body="&lt;p&gt;so, using Matt's &lt;strong&gt;original&lt;/strong&gt; criterion for the property of &quot;Linearity&quot;: if $y_1[n]$ is the output when $x_1[n]$ is the input and $y_2[n]$ is the output when $x_2[n]$ is input, is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a \ y_1[n] + b \ y_2[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the output of the &lt;strong&gt;same system&lt;/strong&gt; when &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a \ x_1[n] + b \ x_2[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is the input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since the system is fully and solely described as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = -\frac12  x[n+2] - y[n+1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;, this depends on whether equality is maintained with the above substitution.  is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a \ y_1[n] + b \ y_2[n] \ = \ -\frac12 \left(a \ x_1[n+2] + b \ x_2[n+2] \right) - \left(a \ y_1[n+1] + b \ y_2[n+1] \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;true or not?  if it's true, the system is linear according to the criterion Matt L first held out.  if not, it's not linear.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-10-03T01:32:17.893" LastActivityDate="2014-10-03T01:32:17.893" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18463" PostTypeId="1" AcceptedAnswerId="18502" CreationDate="2014-10-03T00:02:45.073" Score="0" ViewCount="295" Body="&lt;p&gt;In their &lt;a href=&quot;http://web.mit.edu/persci/people/adelson/pub_pdfs/pyramid83.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper on Image Pyramids&lt;/a&gt;, Burt and Adelson state the following about pyramid generation. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An additional constraint is called equal contribution. This stipulates that all nodes at a particular level must contribute the same total weight($=\frac{1}{4}$) to nodes at the next higher level. Let $\hat{w}(0)=a$,$\hat{w}(-1)=\hat{w}(1)=b$,$\hat{w}(-2)=\hat{w}(2)=c$. In this case, equal contribution requires that $a+2c = 2b$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How is this weight condition derived and why is the weight $\frac{1}{4}$? For a larger context of the question, the screenshot of the relevant section in the paper can be seen below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/prlFJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="4515" LastEditDate="2014-10-03T11:06:50.760" LastActivityDate="2014-10-05T23:50:46.497" Title="Equal contribution criteria during image pyramid construction" Tags="|image-processing|computer-vision|scale-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18464" PostTypeId="2" ParentId="18210" CreationDate="2014-10-03T00:16:27.607" Score="0" Body="&lt;p&gt;you can apply the linearity and time-invarancy tests to the original recursive difference equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this case it's:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] - y[n-1] = x[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is really&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = x[n] + y[n-1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, as a &lt;strong&gt;premise&lt;/strong&gt; you say that $y_1[n]$ is the output when the input is $x_1[n]$ and that $y_2[n]$ is the output when the input is $x_2[n]$, and that $x_1[n]$ and $x_2[n]$ are totally arbitrary.  &lt;strong&gt;you&lt;/strong&gt; don't get to choose a convenient $x_1[n]$ and $x_2[n]$, the Devil hands you a pair $x_1[n]$ and $x_2[n]$ (which have some resulting outputs $y_1[n]$ and $y_2[n]$) and you have to deal with whatever the Devil gives you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, assuming $x_1[n]$ and $x_2[n]$ (along with their respective $y_1[n]$ and $y_2[n]$) satisfy the above difference equation.  and let's label $y_3[n]$ as the result from an input that is the sum $x_1[n] + x_2[n]$, does $y_3[n]$ satisfy the above difference equation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;y_3[n] &amp;amp; = (x_1[n] + x_2[n]) + y_3[n-1] \\&#xA;y_1[n] + y_2[n] &amp;amp; = (x_1[n] + x_2[n]) + (y_1[n-1] + y_2[n-1]) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is that mathematical statement true or not?  if it is for &lt;strong&gt;any&lt;/strong&gt; possible set of inputs $x_1[n]$ and $x_2[n]$, the system is linear.  if not, it's not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, for time-invariancy, it's the same thing but a different criterion to test.  again you &lt;em&gt;assume&lt;/em&gt; the premise that when $x[n]$ is the input, $y[n]$ is the output.  then ask if $x[n-N]$ is the input, &lt;em&gt;is&lt;/em&gt; $y[n-N]$ the output?  it is if it satisfies the defining difference equation.  so if $ y[n] = x[n] + y[n-1] $ is true, is or is not this also true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n-N] = x[n-N] + y[n-N-1] \quad \forall n, N \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;??  if it is true, it's time-invariant, if not, it's not.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-10-03T00:30:12.247" LastActivityDate="2014-10-03T00:30:12.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18466" PostTypeId="2" ParentId="18458" CreationDate="2014-10-03T04:01:54.573" Score="0" Body="&lt;p&gt;The un-interpolated FFT result peak bin amplitude will only be correct for frequencies that are exactly integer periodic for the length of your FFT.  Other frequencies will show rectangular windowing artifacts (so called &quot;leakage&quot;) which will scallop the peak bin amplitude.  There do exist interpolation methods to correct for the amplitude of these between-FFT-bin-center frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase for these (not exactly integer periodic within the FFT aperture length or between-FFT-bin-center) frequencies will be the phase at the center of the FFT aperture (not at the start), and with the phase referenced to this center point flipped 180 degrees for all odd numbered FFT result bins.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-10-03T05:02:05.310" LastActivityDate="2014-10-03T05:02:05.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18469" PostTypeId="1" CreationDate="2014-10-03T09:23:38.043" Score="2" ViewCount="207" Body="&lt;p&gt;I need to get information about contrast of an image, and I compute its value in this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;contrast=Pmax/Pmin&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;Pmax&lt;/code&gt; is the pixel of the image with the highest value, an &lt;code&gt;Pmin&lt;/code&gt; is the pixel of the image with the lower value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the correct way, or there is another approach?&lt;/p&gt;&#xA;" OwnerUserId="11272" LastEditorUserId="7092" LastEditDate="2014-10-03T14:33:30.793" LastActivityDate="2014-10-03T14:33:30.793" Title="compute image contrast" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18473" PostTypeId="2" ParentId="18469" CreationDate="2014-10-03T12:05:16.633" Score="2" Body="&lt;p&gt;There are many approaches to achieve this. For example, check the following work by Pederson et. al.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluation of contrast measures in relation to observers perceived contrast &lt;em&gt;Marius Pedersen1, Alessandro Rizzi2, Jon Yngve Hardeberg1 and Gabriele Simone1.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-10-03T12:05:16.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18475" PostTypeId="1" AcceptedAnswerId="18478" CreationDate="2014-10-03T16:14:25.177" Score="0" ViewCount="618" Body="&lt;p&gt;I need to process an audio signal in an Android app. As shown in the two examples below, there is a 16kHz carrier signal and a lower frequency signal of varying frequency (0-4kHz). Does anyone know of an efficient algorithm to extract the lower frequecy signal in an Androd app?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mc.weatherflow.com.s3.amazonaws.com/media/IMG_03102014_135912.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mc.weatherflow.com.s3.amazonaws.com/media/IMG_03102014_135912.png&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11276" LastEditorUserId="11276" LastEditDate="2014-10-03T18:05:29.227" LastActivityDate="2014-10-04T12:29:22.310" Title="Is there an efficient algorithm to extract low frequency signal from audio with high frequency carrier?" Tags="|demodulation|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18476" PostTypeId="1" AcceptedAnswerId="28880" CreationDate="2014-10-03T19:19:45.853" Score="1" ViewCount="1225" Body="&lt;p&gt;I have a signal which contains sinusoidal components that oscillate at different frequencies. I think the phase of the sinusoids is changing with time. I could do a Fourier transform on small chunks of the signal and the phase of the sinusoids from that, but is there a better way to do this with a wavelet transform? I'm new to the concept of wavelets. From what I understand, it's good at doing what an FFT does but with time resolution. Could you get the phase of a sinusoid as a function of time from a wavelet transform ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1NC41.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10985" LastActivityDate="2016-02-15T06:59:43.583" Title="Can a wavelet transform give time dependent phase of sinusoids in signal" Tags="|wavelet|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18477" PostTypeId="2" ParentId="10549" CreationDate="2014-10-03T20:35:38.263" Score="1" Body="&lt;p&gt;You are actually drawing the skeleton of the background (brighter region).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;change &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::threshold(image, image, threshold, 255, cv::THRESH_BINARY);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in your codes to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::threshold(image, image, threshold, 255, cv::THRESH_BINARY_INV); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should be able to get the right skeleton. &lt;/p&gt;&#xA;" OwnerUserId="11270" LastEditorUserId="7092" LastEditDate="2014-10-03T21:18:21.163" LastActivityDate="2014-10-03T21:18:21.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18478" PostTypeId="2" ParentId="18475" CreationDate="2014-10-03T22:14:32.600" Score="2" Body="&lt;p&gt;If you know your carrier is always exactly 16kHz (within a few percent or so), and you have sampled the audio at 48kHz, you can try a simple 3-tap FIR filter approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Smoothed(k) = \frac{1}{3}( Sig(k) + Sig(k-1) + Sig(k-2) )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This assumes your original signal is called $Sig()$, and it computes a new signal, $Smoothed()$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method exploits the fact that three sample periods equates to one entire cycle of a  16kHz sine wave, so an 16kHz component in the input signal will be cancelled (since summing all the samples of a full sine wave cycle will result in zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting $Smoothed()$ signal should look like you original plots, with the furry 16kHz components gone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your sample rate is not 48kHz (let's call it $F_s$), or if your interfering sine wave is at some other frequency (let's call it $F_i$), you can craft the 3-tap filter as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Smoothed(k) = \frac{1}{2-2\cos(\omega)}( Sig(k) - 2\cos(\omega) Sig(k-1) + Sig(k-2) )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega = 2\pi\frac{F_i}{F_s}$ (note that, if $F_i=16000$ and $F_s=48000$, we get $\omega=\frac{2\pi}{3}$ and hence $\cos(\omega)=-\frac{1}{2}$. If you substitute this into the second equation, you will simply get the first equation again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method is simply creating a $2^{nd}$ order FIR filter with zeros at $\pm F_i$, and with the gain at DC normalised to unity.&lt;/p&gt;&#xA;" OwnerUserId="11204" LastActivityDate="2014-10-03T22:14:32.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18479" PostTypeId="1" AcceptedAnswerId="18482" CreationDate="2014-10-04T03:20:16.543" Score="0" ViewCount="216" Body="&lt;p&gt;I performed an image downsampling with averaging operation(The image is divided into 2 by 2 blocks,then it is downsampled by 4 times.New pixel values od downsampled image is replaced with the mean of each block) as follows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = imread('cameraman.gif');&#xA;avgfilter = fspecial('average', [2 2]);&#xA;avgimg = filter2(avgfilter, img);&#xA;down1 = avgimg(1:2:end,1:2:end);&#xA;imshow(down1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I used a graysacle image as input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ltQI5.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I'm getting a complete white image as output on downsampling.&lt;br&gt;&#xA;I tried with jpg image also. Why this happened?&lt;br&gt;&#xA;Please help.&lt;/p&gt;&#xA;" OwnerUserId="10965" LastEditorUserId="8140" LastEditDate="2014-10-04T10:42:39.220" LastActivityDate="2014-10-04T10:42:39.220" Title="Image getting completely white on downsampling" Tags="|image-processing|matlab|downsampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18480" PostTypeId="1" CreationDate="2014-10-04T05:23:44.453" Score="3" ViewCount="14078" Body="&lt;p&gt;Convolution of two sine waves (or tones as called in audio) is theoretically not defined as the integral is infinite. Taking finite duration windowed sine waves and doing there convolution computationally always contains a fundamental frequency equal to that of the lower frequency sine wave. I am not getting an intuitive understanding of this. Anybody who can share more understanding in this?&lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2016-01-25T20:05:35.270" Title="What is convolution of two sine waves (tones)?" Tags="|convolution|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18482" PostTypeId="2" ParentId="18479" CreationDate="2014-10-04T06:48:01.280" Score="1" Body="&lt;p&gt;When you open an image using &lt;code&gt;imread&lt;/code&gt;, you get the image as a &lt;code&gt;uint8&lt;/code&gt; matrix with grayscale (or color) values of 0-255. However, filtering is no possible for this type. Therefore, &lt;code&gt;filter2&lt;/code&gt; converts your image to &lt;code&gt;double&lt;/code&gt;.&lt;br&gt;&#xA;The function &lt;code&gt;imshow&lt;/code&gt; accepts both &lt;code&gt;uint8&lt;/code&gt; and &lt;code&gt;double&lt;/code&gt; type. When the input is &lt;code&gt;uint8&lt;/code&gt; it also assumes color values of 0-255. But, when the input is &lt;code&gt;double&lt;/code&gt;, it assumes the values are normalised to the range of 0-1. Therefore you should tell &lt;code&gt;imshow&lt;/code&gt; that although your input is of type &lt;code&gt;double&lt;/code&gt; it has color values of 0-255 by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imshow(down1,[0 255]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-10-04T06:48:01.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18483" PostTypeId="2" ParentId="1450" CreationDate="2014-10-04T06:59:33.607" Score="1" Body="&lt;p&gt;Pastec &lt;a href=&quot;http://www.pastec.io&quot; rel=&quot;nofollow&quot;&gt;http://www.pastec.io&lt;/a&gt; should meet the requirements of the initial question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is an &lt;strong&gt;open source&lt;/strong&gt; index and search engine for image recognition released under the LGPL. It allows to easily add, remove and search for matching images in the index using a simple HTTP API. It is based on OpenCV and uses the ORB descriptor, which is patent free unlike SURF and SIFT.&lt;/p&gt;&#xA;" OwnerUserId="11281" LastActivityDate="2014-10-04T06:59:33.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18484" PostTypeId="2" ParentId="18461" CreationDate="2014-10-04T07:12:06.100" Score="1" Body="&lt;p&gt;If you use the DFT formula, you get:&lt;br&gt;&#xA;$$&#xA;Y[k] = \sum_{n=0}^{2N-1}y[n]e^{\frac{-2\pi k n}{2N}} &#xA;$$&#xA;Now, substituting the definition of $y[n]$ you get:&lt;br&gt;&#xA;$$&#xA;Y[k] = \sum_{n=0}^{N-1}x[n]e^{\frac{-2\pi k (2n)}{2N}} = \sum_{n=0}^{N-1}x[n]e^{\frac{-2\pi k n}{N}}&#xA;$$&lt;br&gt;&#xA;So, for $0\leq k &amp;lt; N$ you get that&#xA;$$ Y[k] = X[k]$$&#xA;and for $k\geq N$ you get&#xA;$$&#xA;Y[k] = \sum_{n=0}^{N-1}x[n]e^{\frac{-2\pi k n}{N}} = \sum_{n=0}^{N-1}x[n]e^{\frac{-2\pi (k-N) n}{N}} = Y[k-N]&#xA;$$&lt;br&gt;&#xA;Therfore, &#xA;$$&#xA;Y[k] = \begin{cases}X[k] &amp;amp; 0\leq k &amp;lt; N \\ X[k-N] &amp;amp; k\geq N\end{cases}&#xA;$$&#xA;or $X[k]=\{4,3,2,1,0,1,2,3,4,3,2,1,0,1,2,3\}$&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-10-04T07:12:06.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18485" PostTypeId="2" ParentId="18475" CreationDate="2014-10-04T12:29:22.310" Score="2" Body="&lt;p&gt;Similar to &lt;a href=&quot;https://dsp.stackexchange.com/a/18478/923&quot;&gt;dave_mc's answer&lt;/a&gt;, the basic approach to do is to run the data through a low-pass filter that will eliminate the 16 kHz noise.  The passband edge would be the highest frequency of your signal of interest- 4 kHz in this case.  The stopband edge would be the lowest frequency of your noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If dave_mc's targeted FIR approach works, then great.  If you want a more generalized low-pass filter that is computationally efficient than I would probably use an IIR filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the noise is removed I would search for local peaks and use them to determine where the cycles are repeating.  You should then be able to determine the cycle frequency.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2014-10-04T12:29:22.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18486" PostTypeId="2" ParentId="18476" CreationDate="2014-10-04T14:19:35.527" Score="-1" Body="&lt;p&gt;I would look into the short-time fourier transform. The wavelet transform is closely related to the STFT, more so than the FFT. I am not sure about getting phase information, but if you want to understand the wavelet transform more, start with the STFT. &lt;/p&gt;&#xA;" OwnerUserId="11102" LastActivityDate="2014-10-04T14:19:35.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18488" PostTypeId="1" AcceptedAnswerId="18489" CreationDate="2014-10-04T21:42:23.213" Score="-1" ViewCount="222" Body="&lt;p&gt;I am using real data of wind, which is a random one to get the power spectral density of these values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do to get this PSD in matlab, and Can I get an analytical expression for this psd.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="11285" LastActivityDate="2014-10-05T17:16:14.097" Title="Get a power spectral density from real random data" Tags="|matlab|autocorrelation|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18489" PostTypeId="2" ParentId="18488" CreationDate="2014-10-04T22:12:53.917" Score="0" Body="&lt;p&gt;The standard method is to use Welch's algorithm, which you can access via the &lt;code&gt;pwelch&lt;/code&gt; command in Matlab. It is pretty well documented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get an analytical expression you'll have to use some kind of &lt;a href=&quot;http://en.wikipedia.org/wiki/Curve_fitting&quot; rel=&quot;nofollow&quot;&gt;curve fitting&lt;/a&gt;. The difficulty of doing this will depend on the particulars of the PSD estimate (it could be nearly constant, for example, or have many maxima and minima, or somewhere in between). Matlab has several methods to calculate curve fittings.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-04T22:12:53.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18490" PostTypeId="2" ParentId="18480" CreationDate="2014-10-04T22:40:11.720" Score="1" Body="&lt;p&gt;Maybe try utilizing the properties of fourier transform.  Off the top of my head maybe utilizing the duality property would help you along.&lt;/p&gt;&#xA;" OwnerUserId="11152" LastActivityDate="2014-10-04T22:40:11.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18491" PostTypeId="2" ParentId="18480" CreationDate="2014-10-05T03:11:29.603" Score="3" Body="&lt;p&gt;The convolution of two windowed sinusoidal signals of different frequencies $f_1$&#xA;and $f_2$ can be viewed as the result of passing a windowed sinusoid at frequency&#xA;$f_1$ through a hypothetical linear filter whose &lt;em&gt;impulse response&lt;/em&gt; is&#xA;a windowed sinusoid at frequency $f_2$. When a linear filter is excited by&#xA;a tone at frequency $f_1$, the &lt;em&gt;steady-state&lt;/em&gt; output is a tone at frequency &#xA;$f_1$.  But, there is also an &lt;em&gt;artifact&lt;/em&gt; in the output due to the &lt;em&gt;transient&lt;/em&gt;&#xA;response of the system which wants to put out a signal at frequency $f_2$ if&#xA;it can.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input signal (tone at frequency $f_1$) began at $t = -\infty$ and&#xA;is continuing unabated into the future eternity, the transient response &#xA;(which began at $t = -\infty$) will&#xA;have died away a long time ago and we observe only the steady-state&#xA;response at ordinary times (say between $t = 0$ and $t = T$).&#xA;With the input being a &lt;em&gt;windowed&lt;/em&gt; signal that is beginning at $t=0$,&#xA;say, &lt;em&gt;both&lt;/em&gt; the steady-state response (tone at frequency $f_1$)&#xA;as well as the transient response (decaying tone at frequency $f_2$)&#xA;are observed for $t \geq 0$.  Thus, &lt;em&gt;both&lt;/em&gt; frequencies should be&#xA;observable in the output when convolving two windowed tones, and&#xA;in particular, the smaller frequency should be observable.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2014-10-05T03:11:29.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18492" PostTypeId="2" ParentId="18480" CreationDate="2014-10-05T03:57:42.387" Score="9" Body="&lt;p&gt;Convolution in the time domain is equivalent to multiplication in the frequency domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you window two sinusoids in the time domain to get finite length waveforms, and the two sinusoids are exactly integer periodic in the window width, then the DFT will be impulses.  If the frequencies are different, the impulses in the two DFT will be disjoint, and the multiplication of the two spectrum will result in zero output.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one or both of the two sinusoids are not exactly integer periodic in your window width, then the FT will result in a Sinc function.  Then the convolution will be equivalent to multiplying a Sinc function against an impulse or another Sinc function, which will produce a non-zero result.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-10-05T05:09:02.110" LastActivityDate="2014-10-05T05:09:02.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18493" PostTypeId="2" ParentId="18480" CreationDate="2014-10-05T12:03:55.007" Score="1" Body="&lt;p&gt;I think it's worth looking at this without windowing. The OP didn't mention windowing and there should be an answer without it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's stay in the analog domain for now. We can try to solve this in the frequency domain: The FT of a sine wave is $k\cdot(\delta(\omega_1)+\delta(-\omega_1))$ . Convolution in the time domain is equivalent to multiplication in the frequency domain so the answer would be &quot;0 unless the frequencies are the same&quot;. The operation still is a little awkward since you need to multiply zero with something infinite but while the $\delta()$ function has infinite value it has finite energy and so the energy of the multiplication is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The time domain looks a little more awkward. For each output we need to multiply the two sine waves at some time lag and then integrate from $-\infty$ to $+\infty$. The product of two sine waves are two sine waves at the sum and the difference frequencies. However the integral is awkward and at first look doesn't seem to converge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may be a trick. First we can split it into two integrals, one over the sum and one over the difference and then evaluate the integrals like this&#xA;$$\lim_{T \to \infty}\int_{\varphi -T}^{\varphi +T}sin(\omega \cdot t-\varphi )\cdot dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This integral is ALWAYS zero, for any value of T including T = $\infty$. The trick here is to chose the integration interval so that the it's always symmetric around a zero of the sine wave. So the integral over the lower half of the interval is always the negative of the integral over the upper half and both halves will cancel each other out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not entirely sure though whether this is a &quot;legal&quot; trick, i.e. whether it's okay to force convergence by intelligent selection of the integration interval.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-10-05T12:03:55.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18498" PostTypeId="1" AcceptedAnswerId="18507" CreationDate="2014-10-05T17:22:30.113" Score="0" ViewCount="47" Body="&lt;p&gt;I have a few questions about this assignment I am solving. &#xA;It is q3.33(a) from oppenheim's DSP book 2nd edition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;basically, the question gives you a pole zero plot, from which I was able to determine the correct x[n]. (Couple classmates confirmed my answer on that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and it also gives you the y[n] of the form $(0.5)^n \cdot x[n]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And wants you to work out a pole-zero of y[n] in the z plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my question is this: given that I already know X[z], can i just do z transform of $0.5^n$ as if it was $a^n \cdot u[n]$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I will have $[\frac{1}{1-0.5z^{-1}}] \cdot X[z]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks everyone.&lt;/p&gt;&#xA;" OwnerUserId="11151" LastEditorUserId="11151" LastEditDate="2014-10-05T19:09:50.507" LastActivityDate="2014-10-06T10:36:07.107" Title="z transform property question" Tags="|digital|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18500" PostTypeId="1" AcceptedAnswerId="18506" CreationDate="2014-10-05T22:58:57.040" Score="2" ViewCount="8376" Body="&lt;p&gt;I want to try to summarize some relationships between z transform, ROC and causality. But I am getting confused between left/right sided sequences, the ROC and causal. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If you need stability then the ROC must contain the unit circle. I can understand that.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you need a causal system then the ROC must contain infinity and the system function will be a right-sided sequence. I am fine with  that too.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you need an anticausal system then the ROC must contain the origin and the system function will be a left-sided sequence. Yes that's fine.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you need both, stability and causality, all the poles of the system function must be inside the unit circle.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But #4, doesn't it violate number 2 because we don't include infinity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Got it from here: &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Example_2_.28causal_ROC.29&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Z-transform#Example_2_.28causal_ROC.29&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11151" LastEditorUserId="47984" LastEditDate="2020-04-30T06:06:19.823" LastActivityDate="2020-04-30T06:06:19.823" Title="Causality, Region of Convergence and which side is the system on" Tags="|discrete-signals|digital-communications|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18501" PostTypeId="1" CreationDate="2014-10-05T23:34:18.303" Score="3" ViewCount="257" Body="&lt;p&gt;I am quit puzzled about a notation I found in Gardner's 1986 book titled &lt;em&gt;Introduction to Random Processes&lt;/em&gt;. It is in the chapter on &lt;em&gt;Cyclostationary Processes&lt;/em&gt; at section 12.4 which pertains to &lt;em&gt;Linear Periodically Time-Variant Transformations&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(...) many modulation systems can be modelled as the scalar response&#xA;  of a multi-input LPTV transformation with stationary excitation. This&#xA;  includes amplitude modulation, phase and frequency modulation,&#xA;  quadrature amplitude modulation, pulse-amplitude modulation, all&#xA;  synchronous digital modulations such as phase-shift keying,&#xA;  frequency-shift keying, and so on. Consequently, the study of&#xA;  cyclostationarity is facilitated by general formulas that describes&#xA;  cyclic spectra in terms of the parameters of LPTV transformations.&#xA;  This includes cyclic spectra that are generated by LPTV&#xA;  transformations of processes that exhibit no cyclostationarity, as&#xA;  well as cyclic spectra that are transformed by LPTV transformations of&#xA;  processes that do exhibit cyclostationarity. Let us consider the LPTV&#xA;  transformation $$ Y(t) = \int_{-\infty}^\infty&#xA;\textbf{h}(t,u)\textbf{X}(u)du $$ for which $\textbf{X}(t)$ is a&#xA;  (column) vector excitation, $Y(t)$ is a scalar response, and&#xA;  $\textbf{h}(t, u)=\textbf{h}(t+T, u+T)$ is the (row) vector of&#xA;  impulse-response functions that specify the transformation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The subject of LPTV Transformations is new for me and I don’t understand the usefulness of using non-scalars for $\textbf{h}(t, u)$ and $\textbf{X}(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a commonly used notation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why should a matrix product be used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying to make sense of this for some days now and I have really made no progress whatsoever. I hope someone here has an idea...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With thanks!&lt;/p&gt;&#xA;" OwnerUserId="11252" LastEditorUserId="128" LastEditDate="2018-07-28T16:22:41.297" LastActivityDate="2019-04-25T05:01:25.303" Title="Usefulness of Matrix Notation for Linear Periodically Time Variant Transformations" Tags="|signal-analysis|continuous-signals|transform|periodic|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="18502" PostTypeId="2" ParentId="18463" CreationDate="2014-10-05T23:50:46.497" Score="0" Body="&lt;p&gt;The following picture &lt;a href=&quot;http://cs.haifa.ac.il/hagit/courses/ip/Lectures/Ip11_MultiscaleRepx4.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;from this set of lecture slides&lt;/a&gt; explains the equal contribution. The contribution from two nodes in the same layer must be equal. With reference to the figure, the sum of weights on green edges must match the sum of weights on the blue edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wuU4I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2014-10-05T23:50:46.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18504" PostTypeId="1" CreationDate="2014-10-06T04:35:44.653" Score="1" ViewCount="1977" Body="&lt;p&gt;I want to find out PSNR and SNR values of two images A and B of same dimension in Matlab.I used the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[peaksnr, snr] = psnr(A,B)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and getting an error &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Undefined function 'psnr' for input arguments of type 'uint8'.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I converted both the images into double as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = double(A);&#xA;B = double(B);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and again PSNR is calculated.Now I'm getting an error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Undefined function 'psnr' for input arguments of type 'double'.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why this is happening?Please help me to troubleshoot the error.&lt;/p&gt;&#xA;" OwnerUserId="10965" LastActivityDate="2016-03-04T12:15:03.603" Title="Getting error in PSNR calculation using Matlab" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="3" ClosedDate="2016-03-05T09:15:44.243" ContentLicense="CC BY-SA 3.0" />
  <row Id="18506" PostTypeId="2" ParentId="18500" CreationDate="2014-10-06T10:28:18.050" Score="6" Body="&lt;p&gt;If you combine the two requirements (stability =&gt; the unit circle must be inside the ROC), and causality (the ROC is given by $|z|&amp;gt;r$ with some real-valued radius $r$), then it follows that $r&amp;lt;1$ must be satisfied. This means that the ROC is &lt;em&gt;outside&lt;/em&gt; a circle with radius $r&amp;lt;1$, and, consequently, all poles must be &lt;em&gt;inside&lt;/em&gt; this circle with radius $r&amp;lt;1$. So all poles are inside the unit circle (because, by definition, there are no poles in the ROC).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-06T10:28:18.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18507" PostTypeId="2" ParentId="18498" CreationDate="2014-10-06T10:36:07.107" Score="0" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the property&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z_0^nx[n]\Longleftrightarrow X(z/z_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $z_0=1/2$. You can find this property in Table 3.2 on page 126. It's quite straightforward to show this property by using the definition of the $\mathcal{Z}$-transform.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-06T10:36:07.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18508" PostTypeId="2" ParentId="18423" CreationDate="2014-10-06T11:13:57.147" Score="1" Body="&lt;p&gt;Actually I think the results you obtained are correct. Indeed the computation savings made with overlap-add and overlap-save methods generally increases with the FFT block size. What you are doing in your direct frequency domain approach, provided you use adequate zero padding to prevent circular convolution, is simply the overlap-add method performed with a single block, i.e. with the longest possible block length given your signal. Thus it should prove to be the less computationally intensive of all methods.&lt;/p&gt;&#xA;" OwnerUserId="11252" LastActivityDate="2014-10-06T11:13:57.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18509" PostTypeId="1" CreationDate="2014-10-06T11:22:49.840" Score="2" ViewCount="842" Body="&lt;p&gt;I am working on a position controller for a marine vessel. I have a measurement signal containing the y-position of the vessel that consists of both low frequency (&amp;lt;.1 rad/s) and high frequency (&amp;gt;.6 rad/s) motions. I am currently using a state observer that separates that combined motion in two separate states (a LF and WF states). The gains are calculated using the discrete time Kalman filter algorithm.&lt;/p&gt;&#xA;&lt;p&gt;At every timestep I receive a new incoming measurement and my state observer corrects the predicted state with the measurement.&lt;/p&gt;&#xA;&lt;p&gt;I want to compare the performance of this approach with using a low pass filter on the measurement signal instead of using an Kalman filter. The theory seems to be that a Kalman filter has a much lower phase lag, but I am seeing some amplifications in the magnitude bode plot of my outgoing LF signal compared to the incoming measurements and the filter thus amplifies motions that are between the LF and the WF frequencies...&lt;/p&gt;&#xA;&lt;p&gt;I need some advice on how to implement a nth-order low pass filter in such a discrete time system. Is there an algorithm to filter the incoming measurements at every time step, or do i need to take the entire time trace of the measurement and filter that signal? I am using Matlab.&lt;/p&gt;&#xA;&lt;p&gt;Any tips are more than welcome,&#xA;Scott&lt;/p&gt;&#xA;" OwnerUserId="10539" LastEditorUserId="24461" LastEditDate="2020-12-07T23:40:43.133" LastActivityDate="2020-12-07T23:40:43.133" Title="Discrete algorithm for low pass filter" Tags="|matlab|filters|lowpass-filter|kalman-filters|estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18510" PostTypeId="1" CreationDate="2014-09-04T04:49:18.290" Score="0" ViewCount="51" Body="&lt;p&gt;I need to implement an fft of size &lt;code&gt;2^20&lt;/code&gt;, but the hardware has imposed a limit of &lt;code&gt;2^10 fft size&lt;/code&gt;.Then how can i implement the &lt;code&gt;FFT&lt;/code&gt;. please point me to some literature where i can go through the process&lt;/p&gt;&#xA;" OwnerUserId="14903" OwnerDisplayName="Murali Krishna Reddy" LastActivityDate="2014-10-06T12:42:16.530" Title="how can i do a 2^20 FFT if the hardware imposes a limit of 2^10 FFT size?" Tags="|fft|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18511" PostTypeId="2" ParentId="18509" CreationDate="2014-10-06T13:11:18.190" Score="1" Body="&lt;p&gt;You can probably use Matlab's &lt;code&gt;filter&lt;/code&gt; command. If you call it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Y,Zf] = filter(B,A,X,Zi);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the variable &lt;code&gt;Zf&lt;/code&gt; contains the state of the filter after filtering, and &lt;code&gt;Zi&lt;/code&gt; contains the filter's state before filtering. You could proceed roughly like this (in pseudocode):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Acquire several samples and store them in vector Samples&#xA;[Y,Z] = filter(B,1,Samples); % assuming FIR filter stored in B&#xA;while 1&#xA;    acquire new sample and store it in Sample&#xA;    [Y,Z] = filter(B,1,Sample,Z);  % Y contains the updated filter output&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To design the filter, I'd start by looking at the &lt;code&gt;fir1&lt;/code&gt; command.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-06T13:11:18.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18512" PostTypeId="1" AcceptedAnswerId="18516" CreationDate="2014-10-06T13:26:03.960" Score="2" ViewCount="65" Body="&lt;p&gt;I have a bunch of piezo elements, that I want to use as &quot;Mics&quot;, for that I will test their reaction in a Anechoic chamber. My question is what the are characteristics that I can measure that describe those elements and can help me analysing the generated sound later, I already have in mind the following :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Amplitude response&lt;/li&gt;&#xA;&lt;li&gt;Phase response&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help in advance !&lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="8202" LastEditDate="2015-02-20T12:45:38.743" LastActivityDate="2015-02-20T12:56:48.027" Title="What are the parameters of transducer that I can get from an Anechoic chamber?" Tags="|sound|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18514" PostTypeId="1" CreationDate="2014-10-03T17:44:37.017" Score="0" ViewCount="85" Body="&lt;p&gt;I understand this question may have been addressed however I have a major difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started out with a sinusoid of form &lt;code&gt;A*sin(2 pi freq t + phase)&lt;/code&gt; and I know all the components, this represents a force a system and produces a response that has a delay and that is periodic in a way, no fully sinusoidal though (I can post pics and any relevant material). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus for the response signal I know the frequency and the time vector, I need to find the amplitude and the phase. I have been using &lt;strong&gt;FFT&lt;/strong&gt; but I am not sure if that is the best way.&#xA;Can someone please help me out here, this seems fairly simple, however I am struggling,&#xA;Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I can post/email anything that is relevant, please do ask.&lt;/p&gt;&#xA;" OwnerDisplayName="Amani Lama" LastActivityDate="2014-10-06T14:41:06.143" Title="Phase difference betwen 2 signals, 1 signal with unknown function" Tags="|fft|phase|amplitude|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18515" PostTypeId="1" AcceptedAnswerId="18616" CreationDate="2014-10-06T14:50:58.153" Score="2" ViewCount="4749" Body="&lt;p&gt;How does one recover the complex IQ data from the output of a FM modulator.  I have combined my signals correctly and performed FM modulation on them, now I'm looking for a way to find the IQ values that correspond to each sample output of the FM modulator?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am writing a modulator for my signal to test the performance of my demodulator and my demodulator depends on complex samples it would receive from a radio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, how do I perform the down conversion that happens within a tuned radio to produce IQ data?&lt;/p&gt;&#xA;" OwnerUserId="11237" LastEditorUserId="11237" LastEditDate="2014-10-06T15:49:47.993" LastActivityDate="2018-08-10T11:13:43.593" Title="How to recover complex values (downconvert) from FM modulation (composite signal)?" Tags="|modulation|demodulation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18516" PostTypeId="2" ParentId="18512" CreationDate="2014-10-06T16:21:59.807" Score="2" Body="&lt;p&gt;Mainly frequency response as a function of the 3D direction of incidence. Also known as &quot;polar pattern&quot; or &quot;polar balloon&quot;. You can also look at distortion and noise but that's more tricky.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-10-06T16:21:59.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18517" PostTypeId="1" CreationDate="2014-10-06T17:55:42.977" Score="0" ViewCount="458" Body="&lt;p&gt;I have a system that is forced by a sinusoidal function with specific amplitude, phase and frequency ( all these are known ahead of time). I get a deformation of sinusoidal form as well (think of a damped harmonic response), and I would like to find the phase lag. I was advised to use correlation but I don't have the function that produces the response, only gathered data. This what I am doing but honestly I am not confident in my findings:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    y =[] %this is the gathered data, first column is time, second is deformation&#xA;    frequency =1000; %Hz,i know this for a fact&#xA;    t=y(:,1);        %just getting the time to produce a sine wave for calibrating&#xA;&#xA;    fs =  14*frequency; %this is random, i m just making sure i m above 2*frequency.&#xA;    Nfft = fs ;&#xA;&#xA;    sine_wave = 1+sin(2*pi*frequency*t + pi/2);%I need to 1 + for physical reasons&#xA;&#xA;    FFT_sine_wave =fft(sine_wave,Nfft)/Nfft; %FFT of sine_wave&#xA;    FFT_Y2 =fft(y(:,2),Nfft)/Nfft;           %FFT of response&#xA;&#xA;    magsine_wave = abs(FFT_sine_wave);       %magnitude of sine_wave&#xA;    magY2 = abs(FFT_Y2);                     %magnitude of response&#xA;&#xA;    f=linspace(-fs/2, fs/2, Nfft);           %frequency vector &#xA;&#xA;   [old_max_sine_wave index_sine_wave] = max(magsine_wave);&#xA;   magsine_wave(index_sine_wave) = -Inf;  %getting rid of the DC offset&#xA;&#xA;    [old_max_Y2 index_Y2] = max(magY2);&#xA;    magY2(index_Y2) = -Inf;&#xA;&#xA;    [maxAmp_sine_wave index_sine_wave] = max(magsine_wave); %Finding new amplitudes&#xA;    [maxAmp_Y2 index_Y2] = max(magY2);&#xA;&#xA;    new_ang = angle(FFT_sine_wave);    %getting the angles of sin wave&#xA;&#xA;    ang_miew = new_ang(8002)*(180/pi)+180 % 8002 is where f = 1000 Hz falls in frequency  &#xA;                                          %vector, so i use the index to find angle&#xA;&#xA;    amp_miew = 2*abs(FFT_sine_wave(index_sine_wave)) %this gives me the correct amplitude&#xA;&#xA;     new_angY2 = angle(FFT_Y2)*(180/pi);  %same reasoning as above&#xA;     ang_miewY2 = new_angY2(8002)+180&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please help me out, if any of you need the y vector that gives the time and deformation please let me know. I am in dire need of help!&#xA;Thank you in advance&lt;/p&gt;&#xA;" OwnerUserId="11266" LastEditorUserId="11266" LastEditDate="2014-10-06T18:02:43.690" LastActivityDate="2015-01-05T20:58:41.830" Title="How to find phase difference between 2 signals, one has an unknown function" Tags="|fft|phase|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18518" PostTypeId="2" ParentId="18517" CreationDate="2014-10-06T18:09:29.283" Score="1" Body="&lt;p&gt;I don't fully understand your question, or what your code is supposed to do. However, this line is wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs =  14*frequency;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should use the same sampling frequency as was used to acquire the data. Assuming uniform sampling, you can do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dt = t(2) - t(1);&#xA;fs = 1/dt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, be aware that estimating the actual phase from the FFT is not straigthforward. Here is a quick and dirty example showing one way to do it. Start with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 1000;&#xA;t = 0:1/fs:0.1;&#xA;f = 100;    % signal frequency&#xA;phase = 0;  % signal phase&#xA;y = cos(2*pi*f*t+phase);&#xA;Y = fftshift(fft(y,2^nextpow2(length(y))));&#xA;Ym = abs(Y);&#xA;[m, idx] = max(Ym);&#xA;Ym(idx) = 0;&#xA;[m, idx] = max(Ym);  % index of f&#xA;Ya = angle(Y);&#xA;ph_e = Ya(idx);&#xA;fprintf('Actual phase is: %1.5f\n', phase);&#xA;fprintf('Estimated phase is: %1.5f\n', ph_e);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you run this code you'll get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Actual phase is: 0.00000&#xA;Estimated phase is: -0.49087&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The phase estimate depends on many factors, including the start and end times of your time vector. The thing is that, in this particular setup, the FFT interprets a phase of zero as -0.49087. Then, modify the third to last line in the script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ph_e = Ya(idx) + 0.49087;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the script will properly identify the phase. Try it by setting the phase in line 4 to, say, &lt;code&gt;pi/3&lt;/code&gt;, then run the script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Actual phase is: 1.04720&#xA;Estimated phase is: 1.03347&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is pretty good accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps you to get going.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2014-10-07T17:59:02.903" LastActivityDate="2014-10-07T17:59:02.903" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18519" PostTypeId="1" CreationDate="2014-10-06T19:21:30.280" Score="0" ViewCount="117" Body="&lt;p&gt;Is there any known way of differentiating between frames of real footage and animated content?  It seems like there's probably range of colors more likely to appear in a histogram for real footage, or maybe a level of color variation more likely to be in animation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The case I'm looking at is converting GIF images to h264, so there's a max of 256 colors to work with.  I'm mostly trying to figure out when I should use the animation profile so the output is screwed up as little as possible in the transcode.&lt;/p&gt;&#xA;" OwnerUserId="11294" LastEditorUserId="1059" LastEditDate="2014-10-07T00:53:48.170" LastActivityDate="2014-10-07T18:15:41.420" Title="Classifying animated GIFs as animation or film" Tags="|image-processing|computer-vision|classification|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18520" PostTypeId="1" CreationDate="2014-10-06T21:16:36.610" Score="0" ViewCount="78" Body="&lt;p&gt;I know what I am attempting is not easy but I have a spectrum with peaks at 10Hz 20Hz and 30Hz. I also have various amplitudes at these peaks. I want to recreate my original signal. I initially thought this could be done by adding up sine waves&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(t) = a1sin(2*pi*ff1*t)+a2sin(4*pi*ff1*t)+a3sin(6*pi*ff1*t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with a1 , a2 and a3 based on the amplitudes of the peaks however, When I recreate my time signal and so this in two axes the trace I get is not what I would expect, where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="8478" LastActivityDate="2014-10-13T23:49:39.923" Title="Fourier synthesis" Tags="|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18521" PostTypeId="1" CreationDate="2014-10-07T04:51:14.043" Score="0" ViewCount="2080" Body="&lt;p&gt;Can anyone give some tips how to obtain Skeleton from distance map?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already managed to obtain skeleton using erased method (e.g. zhang suen) but it's time consuming because it's an iterative method (the thicker the object the longer it takes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OpenCV has well optimized &lt;code&gt;distance transform&lt;/code&gt; function than can be calculated in &lt;code&gt;O(n)&lt;/code&gt; time. Is there any paper or even better code sample that achieves that (ideally quite fast)? &lt;/p&gt;&#xA;" OwnerUserId="3187" LastActivityDate="2014-10-07T08:47:26.507" Title="Skeleton from distance map" Tags="|image-processing|computer-vision|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18522" PostTypeId="1" CreationDate="2014-10-07T06:49:13.537" Score="-1" ViewCount="680" Body="&lt;p&gt;this is a newbie question.&#xA;My goal is to create audio filter that cleans human speech from noise. I started with learning all about fft filters. At first I've created simple fft filter with rectangular window. But it was bad, I heard distortions in sound. So I decided to apply some window. I choose sinus window and now i hear noise because of window corrupts my signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: what did i understood wrong about applying window? Should I perform some post-processing for result after ifft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote the code on python, you can make experiments with it. &#xA;It can be executed this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;python wfilter.py sample.wav &amp;gt; sample_filtered.wav&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or, if wav file has more than one channel&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;python wfilter.py sample.wav -c 0 &amp;gt; sample_filtered.wav&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My code (python):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import sys, re&#xA;import numpy as np&#xA;from scipy import fft, ifft, arange, fftpack&#xA;from scipy.io import wavfile&#xA;import math&#xA;&#xA;rate, data = wavfile.read(sys.argv[1])&#xA;data_dtype = data.dtype&#xA;# duration in seconds&#xA;dur = len(data) / float(rate)&#xA;&#xA;WINSIZE = 2048&#xA;BUFSIZE = WINSIZE * 3&#xA;&#xA;def filter(data):    &#xA;    n = len(data) # length of the signal&#xA;    freqs = fftpack.fftfreq(n, d=(1.0 / rate)) &#xA;&#xA;    sig_fft = fft(data)&#xA;&#xA;    sound = ifft(sig_fft).astype(data_dtype)&#xA;    return sound&#xA;&#xA;def rect(buf):&#xA;    return buf&#xA;&#xA;def sin(buf):&#xA;    N = len(buf)&#xA;    def fun(n):&#xA;        return math.sin(math.pi * n / N)          &#xA;    return buf * np.array([fun(x) for x in range(len(buf))] )&#xA;&#xA;def wfilter(win = rect):&#xA;    result = None&#xA;    for left in xrange(0, len(data), WINSIZE):&#xA;        right = left + BUFSIZE&#xA;        buf = win(data[left:right])&#xA;        filter_buf = filter(buf)[:WINSIZE]&#xA;        if result is None:&#xA;            result = filter_buf&#xA;        else:&#xA;            result = np.concatenate([result, filter_buf])&#xA;&#xA;    wavfile.write(sys.stdout, rate, result)&#xA;&#xA;&#xA;if __name__=='__main__':&#xA;    if &quot;-c&quot; in sys.argv:&#xA;        index = sys.argv.index(&quot;-c&quot;) + 1&#xA;        channel = int(sys.argv[index])&#xA;        chdata = np.array([x[channel] for x in data])&#xA;        data = chdata&#xA;&#xA;    if hasattr(data[0], '__len__'):&#xA;        print &quot;please specify channel, there are {} channels&quot;.format(len(data[0]))&#xA;        exit(1)&#xA;&#xA;    wfilter(sin)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11296" LastEditorUserId="11296" LastEditDate="2014-10-07T07:23:55.113" LastActivityDate="2014-10-07T08:40:49.383" Title="FFT window corrupts signal" Tags="|fft|distortion|window|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18523" PostTypeId="2" ParentId="18520" CreationDate="2014-10-07T07:19:47.020" Score="1" Body="&lt;p&gt;Amplitude is only half of the information, you also need to take phase into account - you can reconstruct your signal only then. In general sinusoidal signal is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=A\sin(2\pi f t+\theta)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For you that would mean adding extra terms:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(t) = a1*sin(2*pi*ff1*t+ph1)+a2*sin(4*pi*ff1*t+ph2)+a3*sin(6*pi*ff1*t+ph3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-10-07T07:19:47.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18524" PostTypeId="1" AcceptedAnswerId="18534" CreationDate="2014-10-07T08:23:01.610" Score="2" ViewCount="712" Body="&lt;p&gt;I'm moderately skilled in programming classic microcontrollers. Embedded C, built-in peripherals, interrupts, the daily bread of an Embedded programmer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in expanding my skillset onto programming DSP. Of course the basic steps would be grabbing some development kit, some manuals and tutorials and get to writing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I've seen microcontroller code written by a seasoned Java developer starting with embedded. I've seen an Embedded engineer trying to write web apps. I myself moved from desktop applications development to writing backends running on server farms with thousands requests per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results are not pretty - the paradigms, habits, styles, hang-ups result in using design patterns simply not applicable, optimizing elements that given platform should not have optimized, and so on. It took some tutoring from someone experienced to learn the necessities and unlearn the wrong parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So - as a beginning programmer of DSP with background in standard MPUs (ARM7, 8052 etc) what must I learn, and what must I unlearn to write good DSP code? What are the basic differences between the styles and prerequisites of programming the two?&lt;/p&gt;&#xA;" OwnerUserId="11300" LastActivityDate="2014-10-07T14:05:04.747" Title="Differences between DSP programming vs MPU programming" Tags="|dsp-core|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18525" PostTypeId="2" ParentId="18522" CreationDate="2014-10-07T08:24:44.550" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You need to apply a window too on the result of the ifft (&lt;code&gt;filter_buf&lt;/code&gt; in your code). The reason is that there will be some point at which you will do transformations to your &lt;code&gt;sig_fft&lt;/code&gt; variable - not merely reconstruct as is. This transformations might not preserve the property that the signal fades at the edges of its window, so what you get out of your &lt;code&gt;filter&lt;/code&gt; function is not guaranteed to be properly windowed. Another way to look at it: you cannot simply cancel the effect of the window by dividing by &quot;1/window&quot; because whatever modification you will do in your &lt;code&gt;filter&lt;/code&gt; function will not preserve the shape of the window.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Because of point 1., you need to have an overlap between your consecutive windows, otherwise the data on the edges of the windows will always be lost.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Because of point 2., to get perfect reconstruction, you need to chose a window function such that its square plus its square shifted by your overlap ratio equals one. Good start: overlap of 50% and sine window.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course, all this is needed if what you are doing with the fft data (&lt;code&gt;sig_fft&lt;/code&gt;) cannot be done by other methods like classic FIR or IIR filters. If you plan to zero some coefficients to eliminate some frequencies, you're using the very wrong tool.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-10-07T08:40:49.383" LastActivityDate="2014-10-07T08:40:49.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18526" PostTypeId="2" ParentId="18521" CreationDate="2014-10-07T08:47:26.507" Score="1" Body="&lt;p&gt;The skeleton is a connected set of ridges of the distance transform. It is not a local maximum. The image should be analyzed through derivatives. See Haralick's pioneering work on that:&#xA;&lt;a href=&quot;http://haralick.org/journals/ridges_and_valleys.pdf&quot; rel=&quot;nofollow&quot;&gt;http://haralick.org/journals/ridges_and_valleys.pdf&lt;/a&gt;&#xA;&lt;a href=&quot;http://haralick.org/journals/topographic_primal_sketch.pdf&quot; rel=&quot;nofollow&quot;&gt;http://haralick.org/journals/topographic_primal_sketch.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And some MATLAB source code is here: &#xA;&lt;a href=&quot;http://www.cs.utah.edu/~tch/notes/matlab/tchlib/tpslab.m&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.utah.edu/~tch/notes/matlab/tchlib/tpslab.m&lt;/a&gt;&#xA;(and here of course: &lt;a href=&quot;http://www.cs.utah.edu/~tch/notes/matlab/analysis/&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.utah.edu/~tch/notes/matlab/analysis/&lt;/a&gt;)&#xA;The source code obtains a Topographic Primal Sketch as described by Haralick. Ridges are only a part of that.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Optionally, you could invert the depth map as in $D^{-1}=1/D$, where $D$ is the distance map and $D^{-1}$ denotes the inverse distance function. Then start from a point with the highest distance and compute the shortest distance map using $D^{-1}$ as weights of the undirected graph. You should then select the points on the boundary to compute the shortest path from/to. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-10-07T08:47:26.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18532" PostTypeId="2" ParentId="18524" CreationDate="2014-10-07T12:28:34.930" Score="1" Body="&lt;p&gt;DSP algorithm are defined in equation and understanding those equation is important. The c/c++ coding complexity is not very high and it similar to driver code.&lt;/p&gt;&#xA;" OwnerUserId="11305" LastActivityDate="2014-10-07T12:28:34.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18534" PostTypeId="2" ParentId="18524" CreationDate="2014-10-07T13:27:23.940" Score="2" Body="&lt;p&gt;first of all, you certainly &lt;strong&gt;can&lt;/strong&gt; use an ARM or Intel or Arduino or whatever.  DSP chips are MPUs that are optimized for the most common DSP operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;consider an FIR filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = \sum\limits_{i=0}^{N-1} h[i] x[n-i] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to perform that in $N$ instructions the DSP has to do, in &lt;em&gt;one&lt;/em&gt; instruction, the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;multiply coefficient $h[i]$ and sample $x[n-i]$.&lt;/li&gt;&#xA;&lt;li&gt;add the product $h[i] x[n-i]$ into an accumulator.&lt;/li&gt;&#xA;&lt;li&gt;pre-fetch, for the next instruction both $h[i+1]$ and $x[n-(i+1)]$ and&lt;/li&gt;&#xA;&lt;li&gt;post-increment the pointers to point to $h[i+2]$ and $x[n-(i+2)]$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;if the accumulator is fixed-point, the width of it should be wide enough that there is no rounding on the right and with enough guard bits on the left for overflow.  then there should be a saturate instruction (or the saturation is done automatically when the word is moved to the output).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;finally, the pointer that points to $x[n-i]$ must have a circular or modulo-addressing mode so that it &lt;em&gt;&quot;wraps around&quot;&lt;/em&gt; since the data in the $x[n]$ is stored in a circular FIFO buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, a DSP chip will probably do all that with its specialized hardware, but you need not use a DSP as long as &lt;strong&gt;you&lt;/strong&gt;, the programmer, are willing to deal with these details.  given that some MPUs run at a much faster clock rate than most inexpensive DSPs, even &lt;em&gt;if&lt;/em&gt; you must do all of these operations with multiple instructions, it still might run faster on, say, an ARM than on a SHArC.  maybe not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in doing circular addressing, the simplest way to do that is to use a regular array (like in C) but define the size of that array to be a power of 2 (say $2^p$).  then use the &lt;em&gt;AND&lt;/em&gt; operation (like &lt;em&gt;&quot;&amp;amp;&quot;&lt;/em&gt; in C) to mask off all but the lower $p$ bits.  that will accomplish the modulo arithmetic on the index or address of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;other than that, it's mostly a matter of knowing the math for DSP, understanding a little about the numerical issues regarding finite-width words, whether they be fixed or floating point and being careful.  DSP programming is really no different than any other mathematical programming.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-10-07T14:05:04.747" LastActivityDate="2014-10-07T14:05:04.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18535" PostTypeId="1" AcceptedAnswerId="18547" CreationDate="2014-10-07T15:04:05.320" Score="1" ViewCount="1385" Body="&lt;p&gt;I am trying to use cross correlation instead of FFT to find lags between 2 signals. I am trying to understand cross correlation by using it on sin and cos and expecting phase lag to be pi/2 but it is not:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc&#xA;clear&#xA;&#xA;frequency =1000;&#xA;t= linspace(-1000,0.1,1000);&#xA;&#xA;&#xA;sine_wave = sin(2*pi*frequency*t);&#xA;cos_wave  = cos(2*pi*frequency*t);&#xA;&#xA;[xc,lags] = xcorr(cos_wave,sine_wave);&#xA;[~,I] = max(abs(xc));&#xA;&#xA;figure&#xA;stem(lags,xc,'filled')&#xA;legend(sprintf('Maximum at lag %d',lags(I)))&#xA;title('Sample Cross-Correlation Sequence')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am getting a maximum at lag 22 (if you copy and paste the code provided you ll see it in the plot) and I understand that phase lag = 2*pi&lt;em&gt;f&lt;/em&gt; (time delay) so in my case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;phase lag = 2*pi*1000*22 which is by no means close to pi/2...&#xA;What am I missing here?&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="11266" LastActivityDate="2014-10-08T01:05:47.450" Title="Validating cross corrolation between sine and cos, shouldn't pahse lag be pi/2?" Tags="|phase|cosine|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18536" PostTypeId="2" ParentId="18535" CreationDate="2014-10-07T15:51:25.000" Score="1" Body="&lt;p&gt;To start with there is a local maxima at 2 lags. If you zoom the x-axis (say axis[-200 200 -500 500]) you can see it more clearly. However, it is not the global maxima and the one at lag 22 is higher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is due to the digitization of your sample. If you plot one of your waves against t and zoom the x-axis to say a 200 width box you will see that the peaks clearly have different heights. You therefore get a ringing effect in the resulting cross-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could reduce this effect by significantly increasing your sampling rate or decreasing the signal frequency. You currently have ~5 points per $\pi$ of phase which is very low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also adjust your sampling rate/frequency such that an integer number of samples fit exactly in $2\pi$ of phase.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-10-07T15:51:25.000" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18537" PostTypeId="1" CreationDate="2014-10-07T16:07:38.667" Score="1" ViewCount="1451" Body="&lt;p&gt;I have been studying about Frequency Domain from many days but still i am not able to clear one of the confusion. We say that in frequency domain an image is represented as waves. What I am able to think is that if we take out an intensity profile column wise (i.e one row of intensity values), we have pixel location and at each pixel location we have some intensity value. So using these values with instensity values on y axis and location on x axis, we can draw a wave for one particular row. Now we find DFT coefficients. These DFT coefficients are multiplied with various waves of different frequencies and added. Ultimately we get the original image. Similarly we do it for 2nd row , 3rd row and so on. But when I saw the following image I got confused. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0BLQm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take its fourier transform and see its image in frequency domain we get 3 dots in the middle at frequency location 4. I know we get these dots at frequency location 4 because the image has frequency 4. Now the question is why do I get only one row of 3 dots? Why not each row contains 3 dots as I have discussed earlier? Please explain. Thank You.&lt;/p&gt;&#xA;" OwnerUserId="11189" LastActivityDate="2014-10-07T16:49:39.583" Title="Frequency Spectrum of an image" Tags="|image-processing|fft|discrete-signals|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18538" PostTypeId="1" CreationDate="2014-10-07T16:46:48.567" Score="2" ViewCount="126" Body="&lt;p&gt;i am working recently on a project in which i want to implement a Kalman filter as being an observer, and i couple this observer with a state feedback controller that produces control actions necessary to control a mobile robot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the governing equations for the mobile robot's motion contain errors, and this will affect the control actions produced, and at the same time the miss modelling error covariance matrix is hard to get as well as the measurement error covariance matrix. I though about using some arbitrary values for these matrices and go on with the filtration process, but i thought that it would be much better if there is anything like a kalman filter formulation that has the ability to estimate closer values for system parameters so better control actions can be obtained. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="11293" LastEditorUserId="80" LastEditDate="2015-02-05T16:16:09.447" LastActivityDate="2015-02-05T16:16:09.447" Title="Iterative Kalman filters and system parameters estimation" Tags="|filters|kalman-filters|dsp-core|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18539" PostTypeId="2" ParentId="18537" CreationDate="2014-10-07T16:49:39.583" Score="1" Body="&lt;p&gt;You only get one row of three dots because the image is constant in the vertical direction.  That means that vertically speaking, the image only has 0 Hz content.  Thus, you get the three dots in row 0 (the 0 Hz row), and nothing in any of the others.  If you made one of the image's rows different than the others then you would see differences in the FFT's rows as well.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-10-07T16:49:39.583" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18540" PostTypeId="1" CreationDate="2014-10-07T16:50:06.433" Score="1" ViewCount="241" Body="&lt;p&gt;If I have a vibrating string, then there will be no motion at the endpoints. If I move away a bit from an endpoint then I'll get a signal, but particularly the fundamental will still be attenuated. Higher modes may suffer less or even benefit. This explains why the bridge pickup (closer to the edge) of an electric guitar suppresses the fundamental more than the neck pickup and sounds &quot;thinner&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude of the signal obviously depends on the position of the pickup and the frequency. The relationship is some $sin(\frac{\omega x}{c})$ function.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The question is: if I have a string signal, can I emulate this position dependant behavior with delays?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Suppose the pickup is at $\frac 14$ of the string. I can then add a delay with an amplification of $-1$ which reflects (sic!) the wave bouncing back from the near edge of the string. I will get an attenuated fundamental and all that, but is it physically correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why not do the same with the far end of the string and use a delay which stands for $\frac 34$ of the string. It will also attenuate the fundamental, but the notches will be at different frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I realize, that I am about to model the string itself. If this model was done correctly, I could excite the string and pick it up anywhere I want. But I already have a string signal (from a Karplus-Strong algorithm).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What would I have to do, to add just the effect of the pickup position to this? &lt;/li&gt;&#xA;&lt;li&gt;What wiring of delays would produce this  $sin(\frac{\omega x}{c})$ frequency response?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8553" LastActivityDate="2015-04-06T19:02:37.690" Title="Emulating guitar pickup position with delays" Tags="|frequency-response|delay|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18541" PostTypeId="1" CreationDate="2014-10-07T17:41:23.730" Score="0" ViewCount="378" Body="&lt;p&gt;I'm working with cascaded second-order allpass filters. Each filter is characterized by conjugate pole/zero pairs. In a long (&gt;50) cascade of identical filters, the pole locations of the overall transfer function begin to diverge from their initial, theoretical location. They seem to fan out in a ring around where the true pole should be. This occasionally leads to instability, as the poles can end up outside the unit circle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming this is some kind of round-off or accuracy error, but haven't had any luck locating resources on this problem. Can anyone point me in the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a code snippet demonstrating the problem. Uses Numpy/Scipy and the zplane function found here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/showcode/244.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showcode/244.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = [0.72986695907729304, -1.0592380171923862e-16, 1]&#xA;a = [1, -1.0592380171923862e-16, 0.72986695907729304]&#xA;&#xA;bN = array(1);&#xA;aN = array(1);&#xA;&#xA;Nf = 10&#xA;&#xA;for nf in range(Nf):&#xA;  bN = array(convolve(b, bN), dtype=float32);&#xA;  aN = array(convolve(a, aN), dtype=float32);&#xA;&#xA;z_casc, p_casc, g_casc = zplane(bN, aN)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11307" LastEditorUserId="11307" LastEditDate="2014-10-09T02:16:07.450" LastActivityDate="2014-10-09T02:16:07.450" Title="Unstable Cascade of Allpass Filters" Tags="|filters|allpass|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18542" PostTypeId="2" ParentId="18519" CreationDate="2014-10-07T18:15:41.420" Score="1" Body="&lt;p&gt;It's a studied problem. Here are some relevant papers:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.uv.es/~tzveta/invwork.pdf&quot; rel=&quot;nofollow&quot;&gt;Detecting cartoons: a case study in automatic video-genre classification&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://alpha.imag.pub.ro/~bionescu/index_files/ICMRIonescu2010.pdf&quot; rel=&quot;nofollow&quot;&gt;A color-action perceptual approach to the classification of animated movies&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5576551&quot; rel=&quot;nofollow&quot;&gt;Detecting Cartoons: Automatic Video Genre Classification&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-10-07T18:15:41.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18543" PostTypeId="2" ParentId="18540" CreationDate="2014-10-07T19:59:33.900" Score="1" Body="&lt;p&gt;i won't divulge some proprietary information i have about how to do this, but i'll tell you this hint:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;the vibrations on the guitar strings are standing waves.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;standing waves as well as any waves on a string are made of of sinusoidal components with frequencies at harmonic intervals, that is each harmonic sinusoid has a frequency that is an integer multiple of the &lt;strong&gt;fundamental&lt;/strong&gt; which is the frequency we will normally associate with the &lt;strong&gt;pitch&lt;/strong&gt; of the note.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;with standing waves, there are nodal points for each harmonic at distance that is a submultiple of the length of the string between the bridge on the right and the fret that is terminating the string on the left.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;even-numbered harmonics will have a nodal point at the middle of the string and odd-numbered harmonics will &lt;strong&gt;not&lt;/strong&gt; have a nodal point there.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;there is a relationship between ration of the even-harmonic energy to the odd-harmonic energy and the position of the pickup and with the position of the pick.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;have phun figgering it out.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-10-07T19:59:33.900" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18547" PostTypeId="2" ParentId="18535" CreationDate="2014-10-08T01:05:47.450" Score="1" Body="&lt;p&gt;The following modification to your code shows what you want. Note that you need sufficiently dense sampling of the sine and cosine, far above the nyquist sampling frequency, to get the correlation result you are going for. You also need to convert lags into radians. You also want to discard integer multiples of the wavelength from the lag, since the cross correlation should be periodic as such. I did this all in the code shown below. Check that the label applied to the graph shows the $\frac{\pi}{2}$ radians lag.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;frequency = 1000;&#xA;% VERY IMPORTANT&#xA;% need at least 2 samples for every 1/frequency seconds, i.e. 1 sample per&#xA;%      1/(2*frequency) seconds&#xA;% let's actually use Oversample samples for every 1/(2*frequency) seconds&#xA;Oversample = 1024;&#xA;% that means one sample every 1/frequence/100 seconds per sample&#xA;% Let's just use NumPeriods periods = time from 0 to NumPeriods/frequency&#xA;WavePeriods = 10;&#xA;SamplePeriod = 1/frequency/2/Oversample;&#xA;% start from time=0&#xA;t= (0:SamplePeriod:WavePeriods/frequency);&#xA;t2= (0:SamplePeriod:2*WavePeriods/frequency);&#xA;&#xA;&#xA;sine_wave = sin(2*pi*frequency*t);&#xA;cos_wave  = cos(2*pi*frequency*t2);&#xA;[xc,lags] = xcorr(cos_wave,sine_wave);&#xA;[~,I] = max(abs(xc));&#xA;&#xA;figure&#xA;% set (gca,'FontName','Symbol');&#xA;stem(lags,xc,'filled');&#xA;% discard integer multiples of the wavelength&#xA;NumWavelengthsLag = mod(lags(I) * SamplePeriod * frequency,1);&#xA;legend(sprintf('Maximum at lag %d wavelengths = pi * %d radians',NumWavelengthsLag,NumWavelengthsLag*2))&#xA;title('Sample Cross-Correlation Sequence')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11240" LastActivityDate="2014-10-08T01:05:47.450" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18549" PostTypeId="2" ParentId="18501" CreationDate="2014-10-08T01:26:54.610" Score="1" Body="&lt;p&gt;I don't have the book, so my answer unfortunately cannot be very detailed. However, just based on the excerpt, this could be useful if you are modulating a number of different data streams $\mathbf{X}(u)$ onto a single transmit signal. For example, this would be the case if you have a number of frequency bins that you will use for different data, as would be done for OFDM (orthogonal frequency devision multiplexed) transmissions or DMT (discrete multitone) as is used in DSL modems. I'm personally curious why $\mathbf{h}(t,u)$ is not a matrix and $Y(t)$ a vector, since it is perfectly plausible to have a system with multiple transmitting antennas.&lt;/p&gt;&#xA;" OwnerUserId="11240" LastActivityDate="2014-10-08T01:26:54.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18550" PostTypeId="2" ParentId="18454" CreationDate="2014-10-08T01:59:22.910" Score="1" Body="&lt;p&gt;My intuition on this is that you would actually perform a single instantaneous update in the moment that you receive a measurement, where this update is dependent upon the time since the last update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this intuition goes as follows: Consider finely discretizing the system. Let's assume tht the matrices $A,B,C,D$ are known. In fact, let's just ignore the matrix $D$, since we can equivalently define observation $\tilde{y} = \mathbf{C}\vec{x} = \vec{y} - \mathbf{D}\vec{u}$. Finally, let's assume some distribution over the initial value $\vec{x}(0)$. In fact, call it gaussian for the niceties of it. This gives us a hidden markov model which can be solved by gaussian message passing on the resultant probabilistic graphical model. By &quot;solve&quot; I mean solving $E[\vec{x}[t]]$, where $\vec{x}[t]$ is the discretized version of the original $\vec{x}$. The factor graph (see paper Factor Graphs and the Sum-Product Algorithm) corresponding to the (hidden, since $\vec{x}$ is not observed) markov system with simply be a long chain of $\vec{x}$ variables and the deterministic relationship between them, every once in a while having an observation coming in. Realtime inference in this graph would consist of essentially a kalman filter, except that most of the time is just the &quot;prediction&quot; step. Only in the instances that there is an observation would you have an &quot;update&quot; step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, what I'm speculating is that you should actually do something like the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If there is no measurement at time $t$, then simply carry on as&#xA;  $$\dot{\hat{x}} = \mathbf{A}\hat{x}+\mathbf{B}\vec{u}$$&#xA;  However, when an observation is received at time $t$, Update $\hat{x}$ as&#xA;  $$\hat{x}(t) = \hat{x}(t^-) + \mathbf{L}(\vec{y} - \mathbf{C}\vec{x}(t^-))$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;where $t^-$ is the simulated state up until right before the observation was received. This $\mathbf{L}$ would be designed by you, and should depend on the time since the last observation. Exactly the right way to do this escapes me so far unfortunately, but the finely discretized kalman filter analogy may shed some light on what is reasonable here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is only considering obtaining an estimate for the hidden state $\vec{x}$. If the state estimate is then to be used for control purposes, one needs to take care about the fact that there are discontinuities in the derivative $\dot{\hat{x}}(t)$ for each $t$ when an observation is received. This can likely be mitigated by simply assigning to those values of $t$ the left or right limits of $\dot{\hat{x}}$ around that observation time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I obtain more information on this, I will update.&lt;/p&gt;&#xA;" OwnerUserId="11240" LastEditorUserId="11240" LastEditDate="2014-10-08T06:25:16.553" LastActivityDate="2014-10-08T06:25:16.553" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18551" PostTypeId="2" ParentId="18451" CreationDate="2014-10-08T02:03:11.793" Score="2" Body="&lt;p&gt;Zero-pad the edges of the image, then truncate the excess edge from the result&lt;/p&gt;&#xA;" OwnerUserId="11240" LastActivityDate="2014-10-08T02:03:11.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18552" PostTypeId="1" CreationDate="2014-10-08T06:03:53.617" Score="3" ViewCount="493" Body="&lt;p&gt;I am having question about the HPF. In particular, it is having a high pass guassian filter which is applied to the original image below. High pass filter should only detect edge (lots of change in terms of intensity of the pixel). But how come the resulting image, still contains the two &quot;white&quot; things in the middle? Since they are not edge (no change in terms of intensity), should they be filtered out as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y5rkc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11314" LastEditorUserId="128" LastEditDate="2023-07-01T16:46:40.190" LastActivityDate="2024-04-01T11:01:30.170" Title="High Pass Filter Effect on Different Scales of Elements" Tags="|image-processing|edge-detection|highpass-filter|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="18553" PostTypeId="2" ParentId="3171" CreationDate="2014-10-08T06:31:49.890" Score="0" Body="&lt;p&gt;Interleaved convolution coding can be used to reduce the ECC overhead and wastage/saving of bandwidth used for parity information.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Split the data into N streams. Assume there are 8 streams and therefore each bit of a byte goes in a separate stream.&lt;/li&gt;&#xA;&lt;li&gt;Transmit the convoluted bit of each stream sequentially.&lt;/li&gt;&#xA;&lt;li&gt;Thus if there is a burst error of say 5-bits it will just affect a single bit of each stream.&lt;/li&gt;&#xA;&lt;li&gt;The maximum length of recoverable burst error is number of streams N x sequential correction capability of each stream.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For instance if your convolution coding is capable of correcting up to 2 consequent bit errors then for an 8 stream interleaved coding you can correct up to 16 errors.&lt;/p&gt;&#xA;" OwnerUserId="11315" LastEditorUserId="8202" LastEditDate="2014-10-08T08:46:41.147" LastActivityDate="2014-10-08T08:46:41.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18557" PostTypeId="1" CreationDate="2014-10-08T13:57:07.127" Score="7" ViewCount="559" Body="&lt;p&gt;I am spinning this question off from the &lt;a href=&quot;https://dsp.stackexchange.com/questions/18431/is-this-system-linear&quot;&gt;question from johnny&lt;/a&gt;.  Matt L. and I have had directly opposite conclusions to johnny's question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to decouple the question from issues of causality and other goofy stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have a simple first-order recursive system described with time-domain I/O equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = p \cdot y[n-1] \ + \ x[n] \quad \quad \forall n \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the Z-transform of this is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y(z) = p \cdot z^{-1} Y(z) \ + \ X(z) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) \triangleq \frac{Y(z)}{X(z)} = \frac{z}{z-p} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would normally identify this as a simple and realizable LTI system with a zero at $0$ and a pole at $p$.  But in the other question, there is an issue regarding linearity and time-invariance for the case when $p=-1 \ $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what values $p$ is this system linear?  For what values $p$ is this system time-invariant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is, I believe, the kernel of the disagreement I have with Dr. Matt L.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-10-11T13:43:02.577" Title="Does instability make an otherwise LTI system nonlinear (or time-variant)?" Tags="|linear-systems|transfer-function|" AnswerCount="4" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="18558" PostTypeId="1" CreationDate="2014-10-08T14:30:22.547" Score="0" ViewCount="3392" Body="&lt;p&gt;In ~2006 the FAST corner detector was introduced. One of it characteristics is that you have to train a decision tree from some test image in order to learn the types of corners present and relevant in the test image. One of the consequences is that the images in which you will be applying the detector have to be somewhat similar in relation to the pose (perspective), global illumination, etc. to the test image used in the training phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feature descriptors such as BRIEF and ORB make use of FAST or a modified version of FAST in their reference papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in ~2010 the AGAST corner detection was proposed to address this issue. According to the authors, you should not have to retrain the detector on a test image (but you may if you really want to or think this is really necessary).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then feature descriptors such as BRISK and FREAK showed up, using a modified version of AGAST in their reference papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; Since AGAST is an evolution of FAST aimed at solving some of its issues, should someone simply use AGAST from now on when building a detection application? (I am not speaking of doing pure research on the topic of detectors)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some paper proving or at least showing convincingly that you should now use AGAST? I know I could simply test them both every time I build a detection application, but honestly, if there is a relatively good point I should use AGAST, it would be time saving.&lt;/p&gt;&#xA;" OwnerUserId="9090" LastActivityDate="2014-10-08T14:55:41.307" Title="AGAST vs FAST evaluation" Tags="|computer-vision|algorithms|object-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18559" PostTypeId="1" AcceptedAnswerId="18562" CreationDate="2014-10-08T14:42:54.277" Score="1" ViewCount="474" Body="&lt;p&gt;I ve been researching about harmonic distortion and THD. From what i ve seen on the internet, HD is caused by non-linear signal processing. I want to calculate it using an digital signal processor. For this, i suppose i need to compare the distorted signal with the original one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is it possible to generate THD in a digital signal only by digital processing? Or i need to cause it in an analogic enviroment then convert to digital for detection?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cause i ve only found examples of it being caused by analogic processing like amplifiers.&lt;/p&gt;&#xA;" OwnerUserId="8734" LastActivityDate="2014-10-08T15:31:02.057" Title="Total Harmonic Distortion calculation and its origins" Tags="|digital|distortion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18560" PostTypeId="2" ParentId="18558" CreationDate="2014-10-08T14:55:41.307" Score="1" Body="&lt;p&gt;I am not aware of a direct comparison, other than the agast paper:&#xA;&lt;a href=&quot;http://www6.in.tum.de/Main/Publications/Mair2010c.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www6.in.tum.de/Main/Publications/Mair2010c.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Agast is also based on AST, which is developed by the authors of FAST -Edward Rosten (et al.). It is just a better training. So it might be safe to assume the improvements, based on the original Agast paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, here is a tracker I implemented based on Agast features:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=rZWu4LxmsME&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=rZWu4LxmsME&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works fairly well in many cases and was able to convince me on the power of Agast (Doesn't work as good with FAST features).&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-10-08T14:55:41.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18561" PostTypeId="2" ParentId="18540" CreationDate="2014-10-08T15:04:16.537" Score="0" Body="&lt;p&gt;Most of your questions will be answered &lt;a href=&quot;http://www.till.com/articles/PickupResponse/&quot; rel=&quot;nofollow&quot;&gt;on this page&lt;/a&gt;, or in the Roland patents they link to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Comb_filter&quot; rel=&quot;nofollow&quot;&gt;Comb filters&lt;/a&gt; are implemented with a delay line + an allpass or just interpolation, for the fractional part.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-10-08T15:10:41.353" LastActivityDate="2014-10-08T15:10:41.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18562" PostTypeId="2" ParentId="18559" CreationDate="2014-10-08T15:31:02.057" Score="2" Body="&lt;p&gt;You can create non-linear digital systems (an example would be a system that finds the absolute value of the input). You can also simulate an analog non-linear system using DSP. The easiest way is to use a power series. Assuming that the non-linear system you're modeling is time-invariant and memoryless, you can approximate it as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(t) = a0 + a1*x(t) + a2*x(t).*x(t) + a3*x(t).*x(t).*x(t) + ....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;y(t)&lt;/code&gt; is the system output, &lt;code&gt;x(t)&lt;/code&gt; is the input, and &lt;code&gt;an&lt;/code&gt; are coefficients that depend on the system you're modeling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, you can do a simple simulation of mild harmonic distortion by setting &lt;code&gt;x(t)&lt;/code&gt; equal to the a cosine signal, and setting &lt;code&gt;a1=2&lt;/code&gt;, &lt;code&gt;a3=-0.1&lt;/code&gt;, and all other coefficients equal to 0. &lt;code&gt;a1&lt;/code&gt; is the system gain, and &lt;code&gt;a3&lt;/code&gt; is the non-linear gain. By setting &lt;code&gt;a3&lt;/code&gt; to larger negative values, you increase the nonlinear effect -- you can think of it as an amplifier getting closer to saturation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you plot the spectra of &lt;code&gt;x(t)&lt;/code&gt; and &lt;code&gt;y(t)&lt;/code&gt;, you'll clearly see harmonic distortion occuring.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-08T15:31:02.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18563" PostTypeId="1" AcceptedAnswerId="18567" CreationDate="2014-10-08T15:33:14.720" Score="0" ViewCount="86" Body="&lt;p&gt;If we have a 1-dimensional wave in time domain, it can be represented in frequency domain with x axis indicating the frequency of the wave and y axis indicating amplitude/magnitude of the wave. But what about a 2-dimensional wave in case of images in Frequency Domain? Because in 2-dimensional wave we have a cordinate (x,y) to denote the magnitude. So what is the frequency in this case?&lt;/p&gt;&#xA;" OwnerUserId="11189" LastActivityDate="2014-10-08T16:05:06.213" Title="Frequency of the wave in frequency domain" Tags="|image-processing|fft|fourier-transform|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18564" PostTypeId="1" CreationDate="2014-10-08T15:44:12.873" Score="3" ViewCount="2280" Body="&lt;p&gt;I have some basic maths skill up to derivatives. &#xA;I ask you if you know any simple/concise book that can introduce me to DSP world. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="11320" LastEditorUserId="8202" LastEditDate="2014-10-08T20:02:26.093" LastActivityDate="2014-10-08T21:25:37.077" Title="A DSP simple book/reference?" Tags="|reference-request|" AnswerCount="2" CommentCount="0" ClosedDate="2014-10-09T01:35:56.460" ContentLicense="CC BY-SA 3.0" />
  <row Id="18565" PostTypeId="1" AcceptedAnswerId="18572" CreationDate="2014-10-08T16:00:38.970" Score="2" ViewCount="1385" Body="&lt;p&gt;I want to apply the following steps in matlab&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Read the audio data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Apply window function on that data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Apply fft on the result of window function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Make power spectrum of fft&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) divide power spectrum in Barks bands&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,Fs,bits] = wavread('file1.wav');&#xA;Nsamps = length(y); &#xA;ham= hamming(Nsamps);&#xA;ham_fft = abs(fft(ham));&#xA;ham_fft = ham_fft(1:Nsamps/2);      %Discard Half of Points&#xA;plot(f, ham_fft)&#xA;xlim([0 1000])  &#xA;xlabel('Frequency (Hz)')&#xA;ylabel('Amplitude')&#xA;title('FFT of Hamming Window of  a an audio');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not getting the correct waveform , want to draw the spectrum and then Divide into barks bands .&lt;/p&gt;&#xA;" OwnerUserId="11321" LastActivityDate="2014-10-09T20:33:55.350" Title="Dividing Audio signals into Barks Bands" Tags="|fft|power-spectral-density|speech-processing|fingerprint-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18566" PostTypeId="2" ParentId="18538" CreationDate="2014-10-08T16:02:01.060" Score="2" Body="&lt;p&gt;Regarding the miss modeling, I am not sure how you can handle that because a good mathematical model is important inorder to get kalman filter getting to work. usually the more complex your model is, the better results you can obtain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the process and measurement noise, that noise will not effect much of your result but even then if you want to estimate that noise covariance matrix, you can use iterative algorithms like LMS or RLS to fine tune your Noise parameters for some observations and use it further.&lt;/p&gt;&#xA;" OwnerUserId="11303" LastActivityDate="2014-10-08T16:02:01.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18567" PostTypeId="2" ParentId="18563" CreationDate="2014-10-08T16:05:06.213" Score="0" Body="&lt;p&gt;If you're working with a 2 dimensional data set, you need to do a 2D FFT on it (which can be dome using many 1D FFTs: doing all the rows and then all the columns, or if you prefer, the columns and then the rows).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2D FFT gives you a 2D array of complex numbers.  Horizontal waves will give peaks on the horizontal axis.  Vertical ones will give peaks on the vertical axis, and diagonal waves will give peaks away from both axes.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2014-10-08T16:05:06.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18568" PostTypeId="2" ParentId="18564" CreationDate="2014-10-08T16:07:55.560" Score="4" Body="&lt;p&gt;I can recommend the following two books (which are free!):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to Signal Processing&lt;/a&gt; by S.J. Orfanidis&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.sp4comm.org/getit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Signal Processing for Communications&lt;/a&gt; by P. Prandoni and M. Vetterli&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also take a look at the answers to &lt;a href=&quot;https://dsp.stackexchange.com/questions/427/what-resources-are-recommended-for-an-introduction-to-dsp&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-10-08T16:07:55.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18571" PostTypeId="2" ParentId="18564" CreationDate="2014-10-08T21:25:37.077" Score="1" Body="&lt;p&gt;I can tell you that the best book I found was &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0137027419&quot; rel=&quot;nofollow&quot;&gt;Understanding Digital Signal Processing by Richard G. Lyons&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It help me a lot, and dont need to understand complex math :)&lt;/p&gt;&#xA;" OwnerUserId="10555" LastActivityDate="2014-10-08T21:25:37.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18572" PostTypeId="2" ParentId="18565" CreationDate="2014-10-08T21:46:27.540" Score="1" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Read the audio data&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,Fs,bits] = wavread('file1.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply window function on that data&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ham=hamming(Nsamps);&#xA;windowed = y .* ham;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply fft on the result of window function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ham_fft = fft(windowed);&#xA;ham_fft = ham_fft(1:Nsamps/2);      %Discard Half of Points&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make power spectrum of fft&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;PowSpec = abs(fft(ham_fft)).^2;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;divide power spectrum in Barks bands&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So here maybe start interesting things, based in &lt;a href=&quot;http://en.wikipedia.org/wiki/Bark_scale&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt; the 24 Critical Barks Bands in Hertz is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;20,100,200,300,400,510,630,770,920,1080,1270,1480,1720,2000,2320,2700,3150,3700,4400,5300 6400,7700,9500,12000,15500&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now to split the power spectrum in Barks bands you need to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BandBarks = [20 100 200 300 400 510 630 770 920 1080 1270 1480 1720 2000 2320 2700 3150 3700 4400 5300 6400 7700 9500 12000 15500];&#xA;&#xA;&#xA;for l = 1:length(BandBarks)-1 &#xA;    CurrentBand = [BandBarks(l):BandBarks(l+1)];&#xA;    PowSpec(CurrentBand,:) %% here is the power spectrum for each Barks bands&#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;OK by your commented error seems that your audios are in stereo, convert to mono, or get just one channel!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my example above assumes that each BIN number is the equivalent frequency (course this is nothing common was just an example), to find what bin is your frequency you need calculate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ BandBarks * (\frac{Fs}{length(FFT)})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So based in this equation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Bins = zeros(length(BandBarks),1);&#xA;for j = 1:length(BandBarks)&#xA;&#xA;    Bins(j)=round(BandBarks(j)/(Fs/length(FFT)))&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now here how to plot individually each Bark band:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for l = 1:length(Bins)-1 &#xA;    CurrentBand = [Bins(l):Bins(l+1)];&#xA;    figure(l);&#xA;    plot(PowSpec(CurrentBand,:));&#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think I can not be clearer than that&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2014-10-09T20:33:55.350" LastActivityDate="2014-10-09T20:33:55.350" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18573" PostTypeId="1" AcceptedAnswerId="18576" CreationDate="2014-10-08T23:47:05.960" Score="2" ViewCount="1459" Body="&lt;p&gt;How can poles and zeros exist at infinity?Can anybody explain using a system function?&lt;/p&gt;&#xA;" OwnerUserId="11227" LastActivityDate="2014-10-09T16:05:50.773" Title="Pole/Zero existence at infinity" Tags="|discrete-signals|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18576" PostTypeId="2" ParentId="18573" CreationDate="2014-10-09T05:39:52.763" Score="1" Body="&lt;p&gt;consider a general rational transfer function of order $N$, first with an equal number of zeros and poles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;H(z) &amp;amp; = A \prod_{n=1}^N \frac{z - q_n}{z - p_n} \\&#xA;&amp;amp; =  A \frac{\prod_{n=1}^N z - q_n}{\prod_{n=1}^N z - p_n} \\&#xA;&amp;amp; =  A \frac{\prod_{n=1}^N q_n - z }{\prod_{n=1}^N p_n - z} \\&#xA;&amp;amp; =  B \frac{\prod_{n=1}^N 1 - \frac{z}{q_n} }{\prod_{n=1}^N 1 - \frac{z}{p_n}} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ B = A \prod_{n=1}^N \frac{q_n}{p_n}$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now suppose that the number of zeros is actually less than the number of poles.  we &lt;em&gt;could&lt;/em&gt; express the transfer function as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = C \frac{\prod_{n=1}^M 1 - \frac{z}{q_n} }{\prod_{n=1}^N 1 - \frac{z} {p_n}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $M&amp;lt;N$. or we can express it as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = B \frac{\prod_{n=1}^N 1 - \frac{z}{q_n} }{\prod_{n=1}^N 1 - \frac{z} {p_n}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $(N-M)$ zeros have values of $\infty$ which make $\frac{z}{q_n}$ disappear (for those zeros), leaving only $1$ as a factor in the transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;at the moment, i am not sure what to do with the $A$, $B$, or $C$ factors which might have an $\infty$ in them.  i'll worry about that later.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-10-09T05:39:52.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18578" PostTypeId="2" ParentId="18573" CreationDate="2014-10-09T07:40:34.810" Score="1" Body="&lt;p&gt;I will show you two simple examples to build up some intuition. Imagine a causal impulse response with $h[0]=0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=h[1]z^{-1}+h[2]z^{-2}+\ldots\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lim_{z\rightarrow \infty}H(z)=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is of course due to the negative powers of $z$ in (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine a non-causal impulse response that starts at $n=-1$, such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=h[-1]z+h[0]+h[1]z^{-1}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lim_{z\rightarrow\infty}H(z)=\infty$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This pole is of course caused by the positive power of $z$ in (2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the transfer function of a causal impulse response can never have poles at infinity because you don't get any positive powers of $z$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-10-09T16:05:50.773" LastActivityDate="2014-10-09T16:05:50.773" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18580" PostTypeId="1" AcceptedAnswerId="18583" CreationDate="2014-10-09T10:24:53.627" Score="0" ViewCount="314" Body="&lt;p&gt;I'm creating windowed sinc filters to apply them to certain signals that I'm dealing with. To design the filters, I'm using the approach described in the book &quot;The Scientist and Engineer's Guide to DSP&quot;. Here's a brief resuming:&lt;/p&gt;&#xA;&#xA;&#xA;\[h[i] = &#xA;\left\{&#xA;\begin{matrix} &#xA;Kw(i)\frac{\sin(2\pi f_c(i - \frac{M}{2}))}{i - M/2} &amp;amp; 0\le i \le (M+1)\\ &#xA;\\&#xA;0 &amp;amp; \text{otherwise} &#xA;\end{matrix}&#xA;\right.&#xA;\]&#xA;&#xA;\[&#xA;w(i): \text{A window function}\\ K: \text{DC gain}\\ f_c: \text{The cut frequency expressed as a fraction of the signal sampling rate}&#xA;\]&#xA;&#xA;&lt;p&gt;After calculating the filter kernel, I obtain the frequency response of the filter by taking the FFT of h[i] using an algorithm that approach the filter length to the nearest power of two(to get better performance). The same procedure it's also applied to the input signal in order to get its frequency response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To my understanding, the next step would be multiply the two frequency responses to get the filtered signal in the frequency domain, but the problem is that both signals are not the same size and I haven't found an explanation on how to deal with this problem. So people, how should I pad the filter signal to make this point-wise multiplication? Should I fill the end of the filter with zeros to match with the signal size or should I do it symmetrically putting zeros to the left and right of the filter response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="10982" LastActivityDate="2014-10-11T10:21:54.030" Title="How to pad a windowed sinc filter in the frequency domain" Tags="|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18581" PostTypeId="2" ParentId="18557" CreationDate="2014-10-09T11:56:34.037" Score="0" Body="&lt;p&gt;Linearity and time-invariance do not depend on the value of $p$. The two possible linear and time-invariant (LTI) systems described by the difference equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=p\cdot y[n-1]+x[n]\tag{1},\quad p\neq 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;are given by the inverse $\mathcal{Z}$-transform of the transfer function as formulated in the question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{z}{z-p}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that (2) does not uniquely define an impulse response unless the region of convergence (ROC) of $H(z)$ is given. For the transfer function (2), there are two possible ROCs: $|z|&amp;gt;|p|$ and $|z|&amp;lt;|p|$. In the first case, the corresponding impulse response is right-sided and corresponds to a causal LTI system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_1[n]=p^nu[n]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u[n]$ is the unit step function. If we choose $|z|&amp;lt;|p|$ as the ROC, we get a left-sided impulse response corresponding to an anti-causal system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_2[n]=-p^nu[-n-1]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $|p|&amp;lt;1$ then the causal LTI system characterized by $h_1[n]$ is stable, and the anti-causal LTI system characterized by $h_2[n]$ is unstable, and if $|p|\ge 1$ the opposite holds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far we have seen that the difference equation (1) defines two LTI systems, one causal and the other one anti-causal. The two corresponding impulse responses $h_1[n]$ and $h_2[n]$ are solutions of the difference equation (1) for $x[n]=\delta[n]$. However, these are not the only solutions of (1). It is well-known from the theory of linear difference equations that the general solution is given by a particular solution for some given $x[n]$, and by a solution to the homogeneous equation defined by $x[n]=0$. For the given difference equation, the corresponding homogeneous equation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=p\cdot y[n-1]\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution of (5) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_h[n]=c\cdot p^n,\quad c\in \mathbf{R}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can express the general solution of (1) (with $x[n]=\delta[n]$) by combining a particular solution (either $h_1[n]$ or $h_2[n]$) with $y_h[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=h_1[n]+y_h[n]=h_1[n]+c\cdot p^n\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the solution $h_2[n]$ can be obtained from (7) by choosing $c=-1$. Also note that (7) is valid for all $n\in\mathbf{Z}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we were to scale the input signal and use $x_1[n]=a\delta[n]$ with some $a\in\mathbf{R}$, the resulting output would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_1[n]=a\cdot h_1[n]+c\cdot p^n\tag{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This output signal is generally not equal to $a\cdot y[n]$ (with $y[n]$ given by (7)), unless $c=0$ or $c=-1$. Consequently, the corresponding system is not linear. For the input signal $x_2=\delta[n-n_0]$ the output is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_2[n]=h_1[n-n_0]+c\cdot p^n\tag{9}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is generally not equal to $y[n-n_0]$ (again, unless $c=0$ or $c=-1$). So the corresponding system is also not time-invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, the difference equation (1) describes infinitely many systems with responses to the input signal $x[n]=\delta[n]$ given by (7). Only two of these systems are LTI, the others are not. The two LTI systems are described by the impulse responses $h_1[n]$ and $h_2[n]$ given by (3) and (4), respectively.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-10-12T09:17:20.297" LastActivityDate="2014-10-12T09:17:20.297" CommentCount="19" ContentLicense="CC BY-SA 3.0" />
  <row Id="18582" PostTypeId="1" CreationDate="2014-10-09T13:10:39.700" Score="0" ViewCount="594" Body="&lt;p&gt;I run into the following filter that is supposed to do some type of time averaging of $x$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=G\cdot y[n-1]+(1-G)\cdot\dfrac{x[n]-x[n-1]}{T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G=e^{-2\pi c T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T$ is a time interval, and the samples of $x$ and $y$ come every $T$ seconds (we can assume $y[0] = 0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition includes a quantity $c$ that I think acts as some sort of cut-off frequency, but I am not sure.  Can this type of time-averaging be seen as a low-pass filter? If so what type of filter, and how can I relate $c$ to $T$ considering that the samples come every $T$ seconds?&lt;/p&gt;&#xA;" OwnerUserId="1026" LastEditorUserId="8202" LastEditDate="2014-10-10T12:38:46.417" LastActivityDate="2014-10-10T12:38:46.417" Title="Time-averaging as a low-pass filter?" Tags="|lowpass-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18583" PostTypeId="2" ParentId="18580" CreationDate="2014-10-09T13:32:16.310" Score="0" Body="&lt;p&gt;You don't pad it in the frequency domain, you pad it in the time domain (i.e. before you calculate the FFT).  You can put the zeros either symmetrically or after the filter.  Either way works, it just results in a shift in the output.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-10-09T13:32:16.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18584" PostTypeId="1" CreationDate="2014-10-09T14:40:49.590" Score="0" ViewCount="402" Body="&lt;p&gt;I come from a background of computer science and I got interested in image processing but it requires a lot of signal processing, so could someone provide me a good beginner's book, that maybe first year college/uni students use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that dsp is crucial for image processing, so I focus on the first thing for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="11330" LastEditorUserId="4346" LastEditDate="2014-10-09T15:06:26.017" LastActivityDate="2014-10-11T10:18:10.047" Title="Beginner's Books" Tags="|image-processing|dsp-core|" AnswerCount="1" CommentCount="1" ClosedDate="2014-10-11T12:15:48.137" ContentLicense="CC BY-SA 3.0" />
  <row Id="18586" PostTypeId="2" ParentId="18582" CreationDate="2014-10-09T16:12:13.210" Score="2" Body="&lt;p&gt;first of all, if i were the OP, i would fix the notation a bit.  $x(t)$, $y(t)$ are continuous-time signals and $t\in\mathbb{R}$ is a continuous argument.  $x[n] \triangleq x(nT)$ and $y[n] \triangleq y(nT)$ are discrete=time signals and and $n\in\mathbb{Z}$ is a discrete argument, an integer.  square brackets mean that an integer goes into them.  the normal convention is that $T=\frac{1}{f_s}$ is your sampling period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a simple moving-average filter with equal-weighting in the average is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} &#xA;   y[n] &amp;amp; = \frac{1}{N} \sum\limits_{i=0}^{N-1} x[n-i] \\&#xA;        &amp;amp; = \frac{1}{N} \left(x[0] + \sum\limits_{i=1}^{N} x[n-i] - x[n-N]\right) \\&#xA;        &amp;amp; =  \frac{1}{N} \sum\limits_{i=1}^{N} x[n-i] + \frac{1}{N} \left(x[0]  - x[n-N]\right) \\&#xA;        &amp;amp; =  \frac{1}{N} \sum\limits_{i=0}^{N-1} x[n-1-i] + \frac{1}{N} \left(x[0]  - x[n-N]\right) \\&#xA;        &amp;amp; =  y[n-1] + \frac{1}{N} \left(x[0]  - x[n-N]\right) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is representing &lt;strong&gt;both&lt;/strong&gt; the non-recursive implementation and the recursive.  the recursive implementation works as long as you subtract exactly what you earlier added, something that might not happen in a floating-point context.  both are FIR, even though the recursive implementation is something we would call a &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pdf/tiir.pdf&quot; rel=&quot;nofollow&quot;&gt;Truncated IIR&lt;/a&gt;,  still an FIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to get the frequency response, apply the Z-Transform to either form, and solve for $Y(z)$ in terms of $X(z)$.  then compute the transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) \triangleq \frac{Y(z)}{X(z)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then substitute $z = e^{j \omega}$  and solve for the $\omega$ such that $\left|H(e^{j \omega})\right|^2 = \frac{1}{2}$.  that $\omega= 2\pi f T$ is your -3.01 dB cut-off frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;try doing that math yourself.  we'll be here to help guide you.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-10-09T16:12:13.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18587" PostTypeId="1" AcceptedAnswerId="18602" CreationDate="2014-10-09T17:07:25.687" Score="2" ViewCount="3466" Body="&lt;p&gt;Can anyone please clarify the difference between correlation/convolution and matrix multiplication? As I thought either convolution or correlation is similar to matrix multiplication. I read this question &lt;a href=&quot;https://dsp.stackexchange.com/questions/15710/difference-between-convolution-and-multiplication&quot;&gt;difference between convolution and multiplication&lt;/a&gt;, that is about simple multiplication.I am asking about matrix multiplication.&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="4581" LastEditorUserId="128" LastEditDate="2020-03-22T01:01:45.490" LastActivityDate="2020-03-22T01:01:45.490" Title="Difference Between Correlation / Convolution and Matrix Multiplication" Tags="|convolution|cross-correlation|matrix|linear-algebra|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18588" PostTypeId="1" AcceptedAnswerId="18597" CreationDate="2014-10-09T19:34:16.017" Score="0" ViewCount="2004" Body="&lt;p&gt;This has to do with creating the synchronization circuit for MSK in a DSP as described in &quot;Minimum Shift Keying&quot; by Subbarayan Pasupathy published in IEEE Communications Magazine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the beginning of the circuit he shows signal passing through a &quot;squarer&quot;.  The explanation reads:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Although the MSK signal $s(t)$ has no discrete components which can be&#xA;  used for synchronization, it produces string discrete spectral&#xA;  components at $2f_+$ and $2f_-$ when passed through the squarer. (The&#xA;  squarer, in effect, doubles the modulation index and produces an FSK&#xA;  signal with $\delta_f = 1/T$, known as Sunde's FSK.  Sunde's FSK has 50&#xA;  percent of its total power in the line components at the two&#xA;  transmitter frequencies.)&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$s(t)$ consists of a signal containing components at $\pm 300 \mathrm{Hz}$ around the carrier frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused by this because when I multiply the signal by itself it doesn't seem to produce a signal with components at twice the offset frequencies.  Is squaring a signal different than multiplying it by itself (sample by sample, not convolution with itself)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="11237" LastEditorUserId="13320" LastEditDate="2016-05-13T10:38:06.910" LastActivityDate="2016-05-13T10:38:06.910" Title="Spectral effects of multiplying a signal by itself?" Tags="|frequency-spectrum|demodulation|fsk|synchronization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18589" PostTypeId="1" CreationDate="2014-10-09T22:15:24.620" Score="0" ViewCount="119" Body="&lt;p&gt;I have come know of Huffman and Arithmatic encoding that try to curtail redundant data and thus compress data. Why are they called Entropy encoding? What does that mean? Why not just call them compression encoding?&lt;/p&gt;&#xA;" OwnerUserId="4464" LastActivityDate="2014-10-10T13:53:59.543" Title="What does the word Entropy refer to in Entropy encoding" Tags="|compression|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18591" PostTypeId="1" CreationDate="2014-10-10T06:14:42.617" Score="0" ViewCount="529" Body="&lt;p&gt;I am not sure if the question is off topic but I need some input before I can finalize anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually to do my higher studies (in research) I wanted to make sure that I land my career in Digital Image / Signal Processing only. I have a strong background in Computer Application development. Now the Signal Processing course comes under Electronics And Communication Engineering / domain while Computer Vision &amp;amp; Speech Recognition subjects comes under Computer Science.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if these subjects are different or doing Computer Vision / Speech Recognition is nothing but DSP / DIP. Is MATLAB being used for Computer Vision / Speech Recognition software?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I opt for Electronics And Communication Engineering course or one from Computer Science? Kindly guide me appropriately&lt;/p&gt;&#xA;" OwnerUserId="10384" LastActivityDate="2014-10-10T15:44:04.090" Title="Computer Vision / Speech Recognition" Tags="|image-processing|discrete-signals|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18592" PostTypeId="1" CreationDate="2014-10-10T09:26:49.123" Score="1" ViewCount="804" Body="&lt;p&gt;I'm implementing (in software) FIR filters. I have done two implementation: convolutional one and based on multiplication in frequency domain with FFT/IFFT. I'm using standard FFT implementation (not my own) and overlap-add processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT parameters are automatically selected to be like this: $fftSize = 2 * 2^{\lceil\log2(nTaps)\rceil}$, $samplesPerOp = fftSize - nTaps + 1$ and $overlapSize = nTaps - 1$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm testing my implementation. I've generated signal as $\cos(F_1*2*pi*n/F_s) + \cos(F_2*2*pi*n/F_s)$, where $F_1 = 10$, $F_2 = 1000$ and $F_s = 44100$. Also, I design two set of taps via windowed-sinc method: one for low-pass, with transition band $110Hz - 900Hz$ and other high-pass with same transition band. I've tried different windows - Hamming, Blackman-Harris and others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apply these two filters to signal, with convoluted and FFT implementations. Low-pass filter works perfectly well in both cases: when I select $nTaps$ large enough (via estimation formula from textbook - &quot;Multirate signal processing&quot; by frederic j. harris, for 90dB attenuation it gives me $nTaps = 327$ taps) I got clean 10Hz signal from both implementations (they are differ on edges of signal, but it is expected, of course)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But high-pass filter behaves strange. Convolutional implementation works. It gives almost undesturbed 1000Hz sine wave. And FFT implementation returns a mess. Result of FFT filtering looks like 1000Hz signal, but it is very corrupted - phase jitter, amplitude jitter, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like, I do something wrong, but I could not understand what. Each textbook, tutorial and article about using FFT for FIR filtering doesn't mention something like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, I'm using &lt;code&gt;double&lt;/code&gt;, not fixed-point arithmetic, so precision loss should not be a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, not, it is not HW :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are pictures from gnuplot (1/5 of «second»):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low-Pass, convolution on top, FFT on down: &lt;a href=&quot;http://lev.serebryakov.spb.ru/dsp/dsp-low-pass-side-by-side.png&quot; rel=&quot;nofollow&quot;&gt;http://lev.serebryakov.spb.ru/dsp/dsp-low-pass-side-by-side.png&lt;/a&gt;&lt;br&gt;&#xA;High-Pass, convolution on top, FFT on down: &lt;a href=&quot;http://lev.serebryakov.spb.ru/dsp/dsp-high-pass-side-by-side.png&quot; rel=&quot;nofollow&quot;&gt;http://lev.serebryakov.spb.ru/dsp/dsp-high-pass-side-by-side.png&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="11340" OwnerDisplayName="blacklion" LastEditorUserId="11340" LastEditDate="2014-10-10T11:30:15.563" LastActivityDate="2014-10-10T15:14:43.183" Title="FIR implemented via FFT -- low-pass works good, high-pass gives distorted results. What's wrong?" Tags="|fft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18593" PostTypeId="1" CreationDate="2014-10-10T12:27:11.450" Score="0" ViewCount="814" Body="&lt;p&gt;I am learning Fourier Transform from many days but till now I am not able to understand what does phase angle image show us or tell us? They say that MAGNITUDE tells &quot;how much&quot; of a certain frequency component is present and the PHASE tells &quot;where&quot; the frequency component is in the image. I understood about the MAGNITUDE part but not able to understand PHASE part. Please explain what it means by &quot;PHASE tells &quot;where&quot; the frequency component is in the image&quot;. Thanks&lt;/p&gt;&#xA;" OwnerUserId="11189" LastActivityDate="2022-07-13T14:04:50.563" Title="Purpose of Phase Information" Tags="|fft|discrete-signals|fourier-transform|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18594" PostTypeId="2" ParentId="18592" CreationDate="2014-10-10T12:37:11.667" Score="1" Body="&lt;p&gt;Looks like your approach is correct in principle so it's probably a bug in the actual implementation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your corrupted output is clearly &quot;blocky&quot; so it looks like a framing error of sorts. Your corrupted high pass output has clearly blocks of constant amplitude that look like the all the same length. This length is most likely related to either the filter length or the FFT size. It's also worth checking whether you have a phase discontinuity at the block boundary as well. The more info you can provide, the easier it is to speculate about the potential problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hard to tell without actually seeing the code.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-10-10T12:37:11.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18595" PostTypeId="2" ParentId="18593" CreationDate="2014-10-10T13:22:01.577" Score="1" Body="&lt;p&gt;I don't think of the phase as providing information related to position or location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example might be illustrative. In 1-D, consider these two signals, &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:0.001:0.1;&#xA;x = cos(2*pi*20*t) + cos(2*pi*30*t);&#xA;y = cos(2*pi*20*t + pi/4) + cos(2*pi*30*t - pi/6);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The magnitude spectrums of &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; are the same, but they're not the same signal; if you plot them, you'll see that they're different. In the frequency domain, you need both the magnitude and the phase to fully describe the signals. It doesn't make sense to refer to the harmonics as &quot;being somewhere&quot;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-10T13:22:01.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18596" PostTypeId="2" ParentId="18589" CreationDate="2014-10-10T13:53:59.543" Score="1" Body="&lt;p&gt;The term &lt;a href=&quot;http://en.wikipedia.org/wiki/Entropy_(information_theory)&quot; rel=&quot;nofollow&quot;&gt;entropy&lt;/a&gt; comes from the field of &lt;a href=&quot;http://en.wikipedia.org/wiki/Information_theory&quot; rel=&quot;nofollow&quot;&gt;information theory&lt;/a&gt;.  Information theory posits that unexpected messages bear more information than expected ones.  For instance, saying that there will be a solar eclipse tomorrow has much more information (assuming it's true) than saying the sun will rise tomorrow.  Saying the sun will rise tomorrow, while true (and important!), has very little information for most recipients because they have pretty much 100% expectation of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, you can prove mathematically that information is maximized when all of the possible messages have equal probability.  This maximizes the randomness or &quot;entropy&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A perfect, lossless compression scheme could theoretically reduce the number of bits of a message to $ceil(log_2(entropy))$ but no further.  Lossy compression schemes can reduce further, but information will be lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I personally am not fond of the term &quot;entropy&quot; because I associate it more with the 2nd law of thermodynamics.  I believe that that association was intentional though, in the sense that entropy (in the thermodynamics sense) implies randomness and chaos, while low entropy implies orderliness.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-10-10T13:53:59.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18597" PostTypeId="2" ParentId="18588" CreationDate="2014-10-10T14:03:13.793" Score="0" Body="&lt;pre&gt;&lt;code&gt;Is squaring a signal different than multiplying it by itself &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No, it is not different.  Squaring the signal is multiplying it by itself, sample by sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain this is equivalent to convolving the original frequency spectrum with itself.  The convolution &quot;spreads&quot; the signal out.  If the signal is at $\pm300$ Hz around a carrier frequency $f_c$, then you should see energy at $\pm(2f_c + 600)$ Hz, $\pm2f_c$ Hz, $\pm(2f_c - 600)$ Hz, $0$ Hz, and $\pm600$ Hz.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2014-10-10T15:30:56.653" LastActivityDate="2014-10-10T15:30:56.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18598" PostTypeId="2" ParentId="18329" CreationDate="2014-10-10T14:11:22.753" Score="1" Body="&lt;p&gt;The example I looked at used a tustin or bilinear conversion not a zero order hold(the default for matlabs &quot;c2d&quot; command). So this is more an answer to what i wanted to do rather than the question that i asked above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I solved the following (converting the s domain function into code) by taking the s domain function.&#xA;$$\frac{as+b}{cs^2+ds}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and putting this into matlab (matlab command &quot;g=tf([a b],[c d 0])&quot;). Then performed the bilenear conversion with the matlab command &quot;c2d(g,Ts,'tustin')&quot; where g was my transfer funtion and Ts my sampling rate. This produced the output&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{ez^2+fz+g}{iz^2+jz+k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The a and b coeficients can then be taken from this equation such that(if $i!=1$ the equation needs to be multiplied through by the inverse of &quot;i&quot;):&#xA;$b0=e$ $b1=f$  $b2=g$ &#xA; $a0=i$  $a1=j$ $a2=k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this can then be converted to code by setting the initial states for simplicity let $$z0=z1=z2=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then set up a loop that repeats the following algorithm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$output=z0*b0+z1*b1+z2*b2$$&#xA;$$z2=z1$$&#xA;$$z1=z0$$&#xA;$$z0=input-a1*z1-a2*z2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anyone else that got lost like me, this is known as an IIR filter and googling IIR filter design helped sooo much. &lt;/p&gt;&#xA;" OwnerUserId="11020" LastActivityDate="2014-10-10T14:11:22.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18599" PostTypeId="2" ParentId="18592" CreationDate="2014-10-10T15:14:43.183" Score="2" Body="&lt;p&gt;Ok, I found bug in my code, and it could be useful to post answer here, as I use «standard» FFT library, and somebody could repeat my mistake in future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using JTransforms library for Java to make FFT. It uses very compact representation of results for FFT of pure-real signal: it returns only half of components and, what is really important here, first two elements of result array are &lt;em&gt;not&lt;/em&gt; (re, im) pair but two &lt;em&gt;real numbers&lt;/em&gt; for $X_0$ and $X_{N/2}$ (which are real in case of pure-real data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My mistake was, that I multiply two vectors (&lt;code&gt;fft(taps)&lt;/code&gt; and &lt;code&gt;fft(signal)&lt;/code&gt;) as vectors of complex numbers and thrash these two first components! In low-pass version it doesn't matter much, but for high-pass it is critical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, proper procedure if you use results of JTransform, is to multiple first two elements as real numbers, and only multiple next $N-2$ elements as $N/2-1$ complex numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works!&lt;/p&gt;&#xA;" OwnerUserId="11340" LastActivityDate="2014-10-10T15:14:43.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18601" PostTypeId="2" ParentId="18591" CreationDate="2014-10-10T15:44:04.090" Score="1" Body="&lt;p&gt;These fall under signal processing and mostly you will find electrical engineers who are working in domain of speech recognition. The thing with computer vision is that it overlaps between both field.But as you mentioned you only have option of Electronics/Communications, Electronics is not much related to these field ,well in communications, we all use statistical signal processing which is also useful in speech processing and computer vision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can get into Electrical Engineering(signal processing) that would be much better but out of these two I would suggest go for Computer Science if you plan a future in these field.&lt;/p&gt;&#xA;" OwnerUserId="11303" LastActivityDate="2014-10-10T15:44:04.090" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18602" PostTypeId="2" ParentId="18587" CreationDate="2014-10-10T16:21:50.160" Score="2" Body="&lt;p&gt;Well I will try to explain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us first discission in time domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Let us say you have two signals, x and y. By Convolution in time domain, you mean that you flip(invert) one of the signals(lets say ,y) and then slide it over the other(x). By corerlation, you just don't flip them, rest is the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Now when we talk about correlation, we first discuss 1-D case, where you have just one signal(x) and then for multiple signals(x,y...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;One Variable:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variance for x will tell you how spread or varied that signal is, i.e. a small will correspond to signal which is changing very much. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As as engineers, we like that just at looking at value we can make prediction about the nature of the signal. For that reason, variance is not a good estimate, as you cannot compare signals easily by just looking at their variance. For that reason we introduce Standard Deviation, which is infact the underroot of variance, but by looking at it you can easily compare the nature of two signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Multi Variable:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As variance is in one signal case, in mutli variable, where you have X,Y ...etc signals, we replace it by Covariance. A covariance will tell you how much X and Y vary with each other. But again like variance, we cannot compare just based on co-variance, so we introduce correlation(Standard deviation in one signal case). Now by looking at correlation, you can compare the signals. And then a correlation coefficient,which is just the normalization of correlation, and it ranges from 1 to -1. If the correlation coefficient between 2 signals(x and y) in this case, near to 1, means these both signals are same or same behavior, whenever one signal goes up, the other also and vice versa. 0 means that they have no relationship at all and -1 means inverse relationship.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Computing:&lt;/strong&gt;&#xA;Now to compute the convolution/correlation, we use matrix multiplication as a tool, just like  you use variable multiplication for calculating variance or mean in 1 signal case. In multi dimension case(x,y,...) you use matrix usually instead of variables to make your computations easy(especially on computers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For calculating, convolution, in time domain, you had to flip and then slide(slide means that each and every element of variable needs to be slided) which is computationally very expensive. Instead, in frequency domain, the same result as that of convolution is achieved just by multiplication and yes when you signal is in freq. domain, you simply multiply the signal(X)-which is matrix with Signal(Y), which is also a matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now you will be able to understand that, Yes convolution is same as matrix multiplication(where matrix X and Y matrix of signal) but ONLY IN FREQUENCY DOMAIN.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: Simple mulitplication is done in theory, when you are writing equation, but when you have a real signal , then you sample it and it gives a matrix, which you further multiply in matlab.&lt;/p&gt;&#xA;" OwnerUserId="11303" LastActivityDate="2014-10-10T16:21:50.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18603" PostTypeId="1" CreationDate="2014-10-10T16:34:36.553" Score="1" ViewCount="316" Body="&lt;p&gt;I’ve got what it looks like a periodic signal but the periods seem not equally repeated, I want to estimate the PSD, particularly I need to obtain the dominant frequency of this data. I’ve estimated the autocorrelation and then applied FFT, the results as shown in the figures below.&lt;br&gt;&#xA;It seems that FFT algorithm is not the best option for this kind of data. Could anyone please suggest another solution?. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Time series&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kqkpn.jpg&quot; alt=&quot;Time_Series&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;autocorrelation&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KLUBx.jpg&quot; alt=&quot;autocorrelation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;PSD&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/15evq.jpg&quot; alt=&quot;PSD&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10772" LastActivityDate="2015-04-08T19:39:06.740" Title="What is the best Algorithm to estimate the frequency for Almost-Periodic Data or complex periodic data?" Tags="|matlab|fourier-transform|frequency|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18604" PostTypeId="2" ParentId="18603" CreationDate="2014-10-10T16:51:23.123" Score="1" Body="&lt;p&gt;The dominant frequency always have the highest power and by looking at the PSD plot you can easily compute it. The dominant frequency in your case is where the PSD has the highest peak. In this case it is somewhere at around f = 2.7. &lt;/p&gt;&#xA;" OwnerUserId="11303" LastActivityDate="2014-10-10T16:51:23.123" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18605" PostTypeId="1" AcceptedAnswerId="18708" CreationDate="2014-10-10T16:52:33.787" Score="0" ViewCount="1118" Body="&lt;p&gt;How would one implement a frequency divider?  I know I can resample up and then treat it as if I'm at the same frequency, however I want to divide the frequency of my signal by 2 and keep the same number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried multiplying by a cosine wave at half the frequency then low pass filtering.  However the problem with this approach is the timing of the output wave matches the signal mixed in and not the original signal.  I need the timing to match the original signal, just be at half the frequency.&lt;/p&gt;&#xA;" OwnerUserId="11237" LastEditorUserId="11237" LastEditDate="2014-10-15T20:32:59.343" LastActivityDate="2021-04-13T15:48:34.943" Title="frequency divider" Tags="|frequency|resampling|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="18606" PostTypeId="1" CreationDate="2014-10-10T21:27:12.043" Score="1" ViewCount="389" Body="&lt;p&gt;I'm currently in the process of writing DSP code, based on the amazing RTLSDR project, and using this as a vehicle to teach myself the basics of DSP (I have an extensive background in software development, but none whatsoever in physics, EE or DSP.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I am trying to implement FSK from scratch using only the most basic building blocks of DSP, and writing all the code by myself. Up until now I have managed to do the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Extract a stream of I/Q samples via the RTLSDR interface&lt;/li&gt;&#xA;&lt;li&gt;Calculate the angle of each I/Q pair on the unit circle by calculating &lt;code&gt;atan2(q, i)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Calculate the phase by subtracting each pair of two consecutive I/Q samples &lt;code&gt;atan2(q_2, i_2) - atan2(q_1, i_1)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So now I have a stream of phases, and I can basically &quot;see&quot; the signal going round and round on the unit circle with values between &lt;code&gt;[0-2*PI)&lt;/code&gt;. If we look at FSK, this stream will be moving slightly faster whenever a high bit is transmitted, and slightly slower on the low bits. This is where I'm stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The implementation I'm testing right now basically counts how many samples have passed since the last time a full circle has completed, but this seems very prone to errors due to noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I calculate, from this stream, whether I am currently on a high bit, or a low bit? Since I am just teaching myself here, I'm looking for the most basic method for this step, no complicated algorithms, just yet. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="11341" LastEditorUserId="7338" LastEditDate="2014-10-11T07:22:23.780" LastActivityDate="2014-10-11T07:22:23.780" Title="Detect FSK high/low bits in presence of noise with only simple processing" Tags="|demodulation|fsk|self-study|software-defined-radio|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18607" PostTypeId="1" CreationDate="2014-10-10T21:30:09.620" Score="1" ViewCount="1156" Body="&lt;p&gt;I am designing an algorithm for image processing. I am using MATLAB for the processing of the images(video). How I can detect the position of the corners in the image?&lt;/p&gt;&#xA;" OwnerUserId="11235" LastEditorUserId="53" LastEditDate="2014-10-13T15:13:25.047" LastActivityDate="2014-10-20T15:11:05.193" Title="how to detect corner in a digital image using MATLAB?" Tags="|image-processing|matlab|image-segmentation|matlab-cvst|" AnswerCount="2" CommentCount="1" ClosedDate="2014-10-22T12:23:47.543" ContentLicense="CC BY-SA 3.0" />
  <row Id="18610" PostTypeId="2" ParentId="18584" CreationDate="2014-10-11T10:18:10.047" Score="-1" Body="&lt;p&gt;Discrete time signal processing - Oppenheim and Schafer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has excellent notation and simple explanation&lt;/p&gt;&#xA;" OwnerUserId="11345" LastActivityDate="2014-10-11T10:18:10.047" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18611" PostTypeId="2" ParentId="18580" CreationDate="2014-10-11T10:21:54.030" Score="-1" Body="&lt;p&gt;You will have to pad both $h[i]$ and the signal $x[i]$ with zeros so that both their lengths are &lt;em&gt;atleast&lt;/em&gt; $M+N+1$ where $N$ is the length of $x[i]$. You can pad more so that the length of the padded vectors are powers of $2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has to be done to ensure that circular convolution behaves like linear convolution. &lt;/p&gt;&#xA;" OwnerUserId="11345" LastActivityDate="2014-10-11T10:21:54.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18612" PostTypeId="2" ParentId="18593" CreationDate="2014-10-11T22:53:23.823" Score="1" Body="&lt;p&gt;The fourier transform decomposes a signal into basic sinusoidal waves that are &lt;strong&gt;phase shifted&lt;/strong&gt; in such a way that when added together, they sum up to form the original time domain signal. The magnitude, is the energy that that particular frequency contributes to the summation.  &lt;/p&gt;&#xA;" OwnerUserId="11349" LastActivityDate="2014-10-11T22:53:23.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18614" PostTypeId="1" AcceptedAnswerId="18617" CreationDate="2014-10-12T15:58:12.353" Score="0" ViewCount="210" Body="&lt;p&gt;I have a continuous-time signal that is of the form&#xA;$$x(t)=A \sin(2 \pi f t+\phi_1)+B \sin(2 \pi (5f) t+\phi_2)+C \sin(2 \pi (7f) t+\phi_3)+n(t)$$&#xA;sampled at 50us where $f$ is the frequency I want to find out A,B and C are constants where $$0.15 \cdot A&amp;gt;B+C+|n(t)|$$. I don't need to know the value of any of the phases or amplitudes. I also know that the value of $f$ is 50Hz +/-15 Hz though i want to know it to at least +/- 1 Hz accuracy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What ive tried so far:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A PLL-because $f$ is quite a low frequency and my frequency range is so wide and harmonics were present, the bandwidth of my loop filter was quite limited, I couldn't beat a settling time of 100ms(within 1 HZ).&lt;/li&gt;&#xA;&lt;li&gt;DFT-Sampled over 100ms, the spectra was only really clear when $f$=50Hz.&lt;img src=&quot;https://i.stack.imgur.com/vledG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;li&gt;Measuring the time between zero crossings(Though this falls apart when the amplitudes of the harmonics and noise gets quite high)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Code used for DFT&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T = 0.1; % sample time 100ms&#xA;Ts = 50e-6; % Sampling period&#xA;fs = 1/Ts; % Sampling rate&#xA;t = 0:Ts:T-Ts; % Time vector of length 100ms&#xA;f1=50;&#xA;f2=35;&#xA;f3=65;&#xA;x1 = sin(f1*2*pi*t)+0.1*sin(3*f1*2*pi*t+pi/3)+0.1*sin(5*f1*2*pi*t+pi/3)+0.01*sin(50*f1*2*pi*t+pi/3); &#xA;x2 = sin(f2*2*pi*t)+0.1*sin(3*f2*2*pi*t+pi/3)+0.1*sin(5*f2*2*pi*t+pi/3)+0.01*sin(50*f2*2*pi*t+pi/3);&#xA;x3 = sin(f3*2*pi*t)+0.1*sin(3*f3*2*pi*t+pi/3)+0.1*sin(5*f3*2*pi*t+pi/3)+0.01*sin(50*f3*2*pi*t+pi/3);&#xA;N = length(t); % Number of elements in the time vector&#xA;F = fs/(N); % Frequency step for FFT display&#xA;f = (-fs/2):F:(fs/2)-F; % Frequency vector(same length as the time vector)&#xA;&#xA;X=fftshift(fft(x1))/N; % FFT of the signal x1  (blue) &#xA;X2=fftshift(fft(x2))/N; % FFT of the signal x2 from task 2 (red)&#xA;X3=fftshift(fft(x3))/N; % FFT of the signal x3 from task 3 (black)&#xA;&#xA;figure(2);&#xA;subplot(2,1,1), plot(t, x1, 'b', t, x2, 'r', t, x3, 'k'), axis([0 .1 -1.5 1.5]);&#xA;legend('x=50Hz','x=35Hz','x=65Hz')&#xA;subplot(2,1,2), plot(f, abs(X), 'b', f, abs(X2), 'r', f, abs(X3), 'k'), axis([-100 100 0 0.5]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11020" LastEditorUserId="4346" LastEditDate="2014-10-13T01:55:17.283" LastActivityDate="2014-10-13T01:55:17.283" Title="What is the shortest time period that can be used to find the frequency of a signal burried in noise and harmonics?" Tags="|frequency|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18615" PostTypeId="1" CreationDate="2014-10-12T16:11:17.393" Score="1" ViewCount="2684" Body="&lt;p&gt;I need to do a DFE for QPSK simulation in MATLAB.&#xA;The system consists of a QPSK signal transmitted with power = 1 which is then pulse shaped with a square raised-cosine filter. Add AWGN and a filter receptor with ISI = [0.25 1 0.25]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summarizing and clarifying, the sequence is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;QPSK signal -&gt; Upsample -&gt; Rcosine -&gt; AWGN -&gt; ISI [0.25 1 0.25] -&gt; Downsample -&gt; DFE -&gt; BER counting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have coded the algorithm, with guidance from &lt;code&gt;Dig. Comm. Lee-M.&lt;/code&gt;, but I am thinking about problems with the Feed-Forward filter. The objetive is to obtain a signal with NO ISI, and the correct BER for a given SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% DFE.&#xA;tapsffe=7;&#xA;tapsdfe=8;&#xA;% Gain&#xA;betaf=0.0001;&#xA;betab=0.0001;&#xA;% Coefficients init. Ck for FFE and Dk for DFE&#xA;ck=zeros(1,tapsffe);&#xA;ck(7)=1;               % Last tap for FFE=1&#xA;dk=zeros(1,tapsdfe);&#xA;&#xA;% Signal to filtering&#xA;rk=zeros(1,tapsffe);  % Signal to filter in FFE&#xA;ak=zeros(1,tapsdfe);  % Signal to filter in DFE&#xA;&#xA;% Filtered signal, and correspondings error&#xA;n=length(s6);&#xA;s7=zeros(1,n);&#xA;e7=zeros(1,n);&#xA;&#xA;for k=1:n&#xA;&#xA;    rk = [s6(k), rk(1:tapsffe-1)]; % FILTERING in FFE&#xA;&#xA;    % Output from Feed-Forward and FeedBack&#xA;    ykf = sum(rk.*ck);&#xA;    ykd = sum(ak.*dk);&#xA;    yk = ykf-ykd;&#xA;&#xA;    % Slicer for QPSK. sqrt(2) for POWER = 1.&#xA;    dec = (-1*(real(yk)&amp;lt;0)+1*(real(yk)&amp;gt;=0) + 1i*(-1*(imag(yk)&amp;lt;0)+1*(imag(yk)&amp;gt;=0)))/sqrt(2);&#xA;&#xA;    % Obtained value for filter ecualized signal&#xA;    s7(k) = dec;   &#xA;&#xA;    % Error:&#xA;    error = dec-yk;&#xA;    e7(k) = error;&#xA;&#xA;    % Coefficient adaptation&#xA;    ck = ck - betaf*error*conj(rk); &#xA;    dk = dk + betab*error*conj(ak);&#xA;&#xA;    % FILTERING for Feedback filter with SLICER decisions&#xA;    ak = [dec, ak(1:tapsdfe-1)];&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apparently I have problems with the FFE, because I do not see ck taps to accommodate to the inverse of the channel response with ISI. I have little doubt of its coefficients adaptation. Signal for BETA, and adaptation for ck with the corresponding rk, or the fliplr coefficient...&lt;/p&gt;&#xA;" OwnerUserId="10244" LastEditorUserId="1212" LastEditDate="2015-07-13T13:49:34.100" LastActivityDate="2021-04-06T13:03:25.300" Title="DFE for QPSK in MATLAB" Tags="|matlab|filters|discrete-signals|equalization|qpsk|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18616" PostTypeId="2" ParentId="18515" CreationDate="2014-10-12T23:03:59.220" Score="3" Body="&lt;p&gt;I am not quite sure if you are asking how to perform the demodulation or how to down-mix a signal at some intermediate frequency to baseband prior to demodulation.  I will assume the prior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the modulated signal it is quite easy to perform demodulation and recover the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply take the angle (atan2) of the output of a delay discriminator.  If you are concerned with efficiency you can get fancier with your implementation.  Example python code would look like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Calculate the complex vector between two adjacent data points&#xA;vectorDiff = data[1::1] * np.conjugate(data[0:-1:1]);&#xA;# Record the angle of the complex difference vectors&#xA;fmDemod = np.angle(tmp);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I recently wrote a blog post detailing an FM demodulator I wrote using Python.  Here is a &lt;a href=&quot;http://davidswiston.blogspot.com/2014/10/pyfmradio-stereo-fm-receiver-for-your-pc.html&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;.  I used this project as an excuse to learn python and numpy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;** EDIT ** Quick and dirty way to perform down-conversion using the hilbert transform prior to FM demodulation (in python)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Import the plotting library&#xA;from matplotlib import pyplot as plot&#xA;import scipy.signal&#xA;import numpy as np&#xA;&#xA;# Define the setup&#xA;fCarrier = 10;&#xA;fAudio = 1;&#xA;fs = 1000;&#xA;timeEnd = 1;&#xA;time = np.linspace(0,2,fs*timeEnd);&#xA;&#xA;# Create the signals&#xA;carrier = np.sin(2*np.pi*fCarrier*time);&#xA;audio = np.sin(2*np.pi*fAudio*time);&#xA;audioInt = -np.cos(2*np.pi*fAudio*time);&#xA;freqMod = np.sin(2*np.pi*fCarrier*time + 2*np.pi*1*audioInt);&#xA;&#xA;# Downconvert&#xA;analyticSignal = scipy.signal.hilbert(freqMod); # wikipedia analytic signal&#xA;baseband = analyticSignal * np.exp(-2*np.pi*fCarrier*time*1j); # complex mixing&#xA;audioDemod = np.angle( baseband[1::1] * np.conjugate(baseband[0:-1:1]) ); # fm demod&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11355" LastEditorUserId="5067" LastEditDate="2015-09-24T21:40:16.110" LastActivityDate="2015-09-24T21:40:16.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18617" PostTypeId="2" ParentId="18614" CreationDate="2014-10-13T01:10:46.867" Score="1" Body="&lt;p&gt;if you know that the 5th and 7th harmonic are precise harmonics of the fundamental at frequency $f$, you can use them along with the fundamental to help against the noise.  (the signal is &lt;strong&gt;not&lt;/strong&gt; &quot;buried&quot; in its own harmonics, the harmonics are part of the signal, unlike the noise.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is the &quot;pitch detection&quot; problem (even if you're only interested in frequencies around 50 Hz).  perhaps considering computing the Average Squared Difference Function (ASDF)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Q(L) = \frac{1}{M} \sum\limits_{i=0}^{M-1} \left(x[n-i] - x[n-L-i] \right)^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;try computing that for lags $L$ around the period length ($\frac{1}{50}$ second).  pick the $L$ such that $Q(L)$ is minimum.  the noise will keep it from getting to zero, but it will get close to zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as to the question in the title of this thread, the shortest time to estimate the frequency is about 1 period ($\frac{1}{50}$ second) plus a little more.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-10-13T01:24:29.753" LastActivityDate="2014-10-13T01:24:29.753" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18618" PostTypeId="1" AcceptedAnswerId="18624" CreationDate="2014-10-13T02:39:21.673" Score="1" ViewCount="6557" Body="&lt;p&gt;For my course I need to implement a 30 point Cooley-Tukey DFT by transforming it into a 5x6 matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to implement using the following Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc; clf; close all; clear all;&#xA;N = 30;&#xA;rows = 5;&#xA;columns=6;&#xA;data = linspace(0, 2*pi, N);&#xA;data = sin(data)+0.1*sin(pi*data);&#xA;plot(data);&#xA;count=1;&#xA;matrix=(reshape(data, 6, 5))'; % Read in row wise&#xA;test = matrix;&#xA;%Perform column-wise dft&#xA;for x=1:columns&#xA;    matrix(:,x)=dft(matrix(:,x));&#xA;end&#xA;%Perform Twiddles&#xA;for x=1:columns&#xA;    for y=1:rows&#xA;        matrix(y,x)=matrix(y,x)*exp((-2*pi*y*x/N)*1i);&#xA;    end&#xA;end&#xA;%Perform FFT on rows&#xA;for y=1:rows&#xA;    matrix(y,:)=dft(matrix(y,:));&#xA;end&#xA;out=20*log10(abs(reshape(matrix,1,N)));&#xA;figure&#xA;subplot(211);&#xA;stem(out); title('Using cooley-tukey');&#xA;subplot(212);&#xA;stem(20*log10(abs(fft(data)))); title('Using fft');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where dft is defined as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function output = dft(input)&#xA; n = length(input);&#xA; output = zeros(size(input));&#xA; for k = 0 : n - 1  % For each output element&#xA;   s = 0;&#xA;    for t = 0 : n - 1  % For each input element&#xA;     s = s + input(t + 1) * exp(-2i * pi * t * k / n);&#xA;   end&#xA;   output(k + 1) = s;&#xA; end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The instructions that were in our lecture were:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Load 2D array by rows &lt;/li&gt;&#xA;&lt;li&gt;Transform each column &lt;/li&gt;&#xA;&lt;li&gt;Twiddle each element&lt;/li&gt;&#xA;&lt;li&gt;Transform each row &lt;/li&gt;&#xA;&lt;li&gt;Unload 2D array by columns&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now it outputs some very different outputs:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Kilwi.png&quot; alt=&quot;For example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know what I am doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="11356" LastEditorUserId="11356" LastEditDate="2014-10-13T05:29:17.170" LastActivityDate="2014-10-13T12:23:36.067" Title="Cooley-Tukey Implementation of FFT in Matlab" Tags="|matlab|fft|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18619" PostTypeId="1" AcceptedAnswerId="18626" CreationDate="2014-10-13T07:32:05.937" Score="0" ViewCount="1114" Body="&lt;p&gt;The Fourier spectrum is in the Figure, how to find the essential bandwidth?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5PKSi.png&quot; alt=&quot;The Fourier spectrum&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11360" LastActivityDate="2014-10-13T14:50:12.807" Title="What's the essential bandwidth of the unit step function?" Tags="|fourier|bandwidth|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18621" PostTypeId="1" AcceptedAnswerId="46070" CreationDate="2014-10-13T09:31:31.613" Score="1" ViewCount="2521" Body="&lt;p&gt;I seek a scaled audio file format for my dsp output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to produce &quot;scaled wav files&quot;, when I've done my pre processing. Eg. if the amplitude is 15.5 (of whatever unit), you should be able to open a standard wav/whatever file and see &quot;15.5&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you produce a normal 16 bit wav file, you have to tell the user, to scale all values with value xx.xx. This would be ok, if the scale factor could be included in the file, in a standardized fashion. But so far I haven't been able to find any &quot;scale factor&quot; field in the wav format?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way could be to produce a 32 bit float wav file. This could actually contain the value &quot;15.5&quot;. Problem is that wav float values are defined to be in the range [ -1.0 : 1.0 ]. I've tried opening such a file in different freewares like eg. Audacity. But they don't take well to the larger scale. They still only display the [ -1.0 : 1.0 ]. &#xA;Do you know a program that will display large scale float wav files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Btw I do realize that the &quot;scaled audio&quot; is not &quot;audio&quot; anymore.)&lt;/p&gt;&#xA;" OwnerUserId="11362" LastEditorUserId="11362" LastEditDate="2014-10-14T08:20:55.530" LastActivityDate="2020-05-03T00:02:07.933" Title="Wav file scale factor" Tags="|audio|software-implementation|wave|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18622" PostTypeId="1" CreationDate="2014-10-13T11:00:54.340" Score="0" ViewCount="168" Body="&lt;p&gt;I am designing an FIR filter.my specs are fs=300MHz, Fc=45MHz, Fs=75MHz, passband gain=3dB , stopband attn=&gt;40dB. what parameters I values of &lt;em&gt;a&lt;/em&gt; have to provide in &lt;em&gt;firpm&lt;/em&gt; for the minimum order filter design. &#xA;I am putting &lt;em&gt;a=[0.01 0.01]&lt;/em&gt;. is it correct?&lt;/p&gt;&#xA;" OwnerUserId="11235" LastActivityDate="2016-01-31T10:42:00.313" Title="FIR filter design" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18623" PostTypeId="2" ParentId="18622" CreationDate="2014-10-13T11:39:05.403" Score="1" Body="&lt;p&gt;I suppose you want a low pass filter. Such a filter has one passband and one stopband, and accordingly you need an &lt;code&gt;a&lt;/code&gt; vector with 4 elements:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the desired magnitude at frequency $0$&lt;/li&gt;&#xA;&lt;li&gt;the desired magnitude at the passband edge ($f_c$)&lt;/li&gt;&#xA;&lt;li&gt;the desired magnitude at the stopband edge ($f_s$)&lt;/li&gt;&#xA;&lt;li&gt;the desired magnitude at Nyquist&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If I understood your specs correctly, you should use &lt;code&gt;a = [sqrt(2) sqrt(2) 0 0]&lt;/code&gt;, and your &lt;code&gt;f&lt;/code&gt; vector is &lt;code&gt;f = [0 0.3 0.5 1]&lt;/code&gt; because you need to normalize $f_c$ and $f_s$ by the Nyquist frequency $f_s/2=150$MHz. I would suggest you just try some values of &lt;code&gt;n&lt;/code&gt; until you reach the desired stopband attenuation. Since you didn't specify any maximum passband ripple, the response in the passband will be fine anyway. If not, you can add a weight vector to trade off maximum passband ripple with stopband attenuation. See the &lt;a href=&quot;http://www.mathworks.nl/help/signal/ref/firpm.html&quot; rel=&quot;nofollow&quot;&gt;MathWorks documentation&lt;/a&gt; on how to do this.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-31T10:42:00.313" LastActivityDate="2016-01-31T10:42:00.313" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="18624" PostTypeId="2" ParentId="18618" CreationDate="2014-10-13T12:23:36.067" Score="1" Body="&lt;p&gt;The problem is in the definition of the twiddle factors. Your indices go from 1 to &lt;code&gt;columns&lt;/code&gt; and from 1 to &lt;code&gt;rows&lt;/code&gt;, whereas the indices in the power of the exponential function should go from 0 to &lt;code&gt;columns-1&lt;/code&gt; and from 0 to &lt;code&gt;rows-1&lt;/code&gt;. So with this line of code in the twiddle factor loop everything should be fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;matrix(y,x)=matrix(y,x)*exp((-2*pi*(y-1)*(x-1)/N)*1i);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-13T12:23:36.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18626" PostTypeId="2" ParentId="18619" CreationDate="2014-10-13T14:50:12.807" Score="0" Body="&lt;p&gt;there &lt;strong&gt;can be no&lt;/strong&gt; essential bandwidth of the unit step function.  defining such would lead you to self-contradiction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;suppose you have a function $x(t)$ which has Fourier Transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(f) = \int\limits_{-\infty}^{+\infty} x(t) e^{-j 2 \pi f t} \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and from $X(f)$, you defined some consistent measure of bandwidth $B_x$ in such a way that is independent of the amplitude of $X$ and is dimensionally consistent with $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now suppose you scale the time argument of $x(t)$ to speed it up or slow it down:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = x(a t) \quad \text{for } a &amp;gt; 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we know that the the Fourier Transform of $y(t)$ would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y(f) = \frac{1}{a} X\left(\frac{f}{a} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the bandwidth of $Y(f)$ defined in the same manner as $B_x$ would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ B_y = a B_x $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, suppose $a&amp;gt;1$, then you speed up $x(t)$ by the factor $a$ and the bandwidth is increased by the same factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but if you &lt;em&gt;&quot;speed up&quot;&lt;/em&gt; (or &lt;em&gt;slow down&lt;/em&gt;) the unit step function, you still have the &lt;strong&gt;very same&lt;/strong&gt; unit step function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u(t) = u(a t) \quad \text{for } a &amp;gt; 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u(t) \triangleq \begin{cases}&#xA;1, &amp;amp; \text{if } t &amp;gt; 0 \\&#xA;0, &amp;amp; \text{if } t &amp;lt; 0 \\&#xA;\end{cases} $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so scaling time for the unit step does not change it, yet &lt;strong&gt;if&lt;/strong&gt; it had a bandwidth, scaling the time &lt;strong&gt;must&lt;/strong&gt; change that bandwidth.  a contradiction results.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-10-13T14:50:12.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18627" PostTypeId="1" CreationDate="2014-10-13T15:03:04.703" Score="1" ViewCount="87" Body="&lt;p&gt;I have some two tone origami paper. This particular paper comes in six types, each with a different pair of colors. Here's an image that shows all six:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wFUqe.jpg&quot; alt=&quot;Two tone paper&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a picture of one of these sheets, I want to figure out which type it is, and do so in a way that's resilient to common changes in lighting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extracting the actual color pair isn't too hard. I find the saddle point at the center of the sheet, do four flood fills (with some sanity checks for square-ness) to estimate the layout and correct the perspective, then average the RGB values of the top-right and bottom-left separately from the top-left and bottom-right (with some margin to avoid the borders).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current method to classify the sampled color pair is to just pre-measure each known sheet, hard-code the rgb pairs they measure as, then assume new samples are whatever color pair they're closest to. The distance metric I'm using is just simple euclidean distance in the 6d r1,g1,b1,r2,g2,b2 space, except I also compute the distance after swapping the first and second color and take the minimum (to account for the fact that they may be out of order).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with this approach is that it's very sensitive to lighting. For example, I can consistently distinguish between RedBlue and RedBlack but if I make the room brighter or dimmer then one will tend to dominate the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I've considered doing is to divide the rgb values by the average of the whole pair. This would tend to cancel luminosity out, I think. But lighting also varies in color, and I'd prefer this to work whether or not the lights are incandescent or LED. One way I might be able to deal with that is to take the ratio of each color channel within a pair, and then treat that as a point in 3d euclidean space to compare. Or maybe the difference? It's hard to say without a variety of rooms to test in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideas? Insight? Experience?&lt;/p&gt;&#xA;" OwnerUserId="10155" LastEditorUserId="10155" LastEditDate="2014-10-13T18:56:10.110" LastActivityDate="2014-10-13T18:56:10.110" Title="Good color distance metric for classifying color pairs" Tags="|classification|color|distance-metrics|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18628" PostTypeId="2" ParentId="18607" CreationDate="2014-10-13T15:12:58.833" Score="0" Body="&lt;p&gt;There is a function &lt;code&gt;corner&lt;/code&gt; in the Image Processing Toolbox.  There are several functions for detecting different types of corners in the Computer Vision System Toolbox: &lt;code&gt;detectHarrisFeatures&lt;/code&gt;, &lt;code&gt;detectMinEigenFeatures&lt;/code&gt;, and &lt;code&gt;detectFASTFeatures&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-10-13T15:12:58.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18629" PostTypeId="1" AcceptedAnswerId="23351" CreationDate="2014-10-13T15:26:39.340" Score="5" ViewCount="686" Body="&lt;p&gt;I have some data $(X,Y,Z)$, which is a set of measurements $Z$ over a $2D$ space $X$,$Y$. The $Z$ data on this space is continuous except for some discontinuous jumps in certain &#xA;domains of $X$,$Y$ (due to calibration errors). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's say $X$ and $Y$ are both between $[0,1)$, and let's say my underlying true function is $Z=f(X,Y)$. For most of the $X$,$Y$ space $Z$ will equal my true function, but perhaps for $0.25 &amp;lt; X &amp;lt; 0.5$, $0.25 &amp;lt; Y &amp;lt; 0.5$, my data will show $Z=f(X,Y)+4$, an offset of $4$ from the true function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can brute-force look for discontinuous jumps and then correct for them in the data set (by setting the edge points in the error region equal to their nearest points in the non-error region), but this can be problematic for certain functions and certain domains that I'm working with. I'm wondering if there's a signal processing method that is designed to work for these types of problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: To be clear, I only need to learn the function $f(X,Y)$ up to a constant, so it doesn't matter what part of the space I consider the &quot;error-free&quot; region or not. I simply can't have the function exhibiting different offsets in different regions of the 2D $X,Y$ space.&lt;/p&gt;&#xA;" OwnerUserId="11368" LastEditorUserId="128" LastEditDate="2019-10-25T07:16:21.293" LastActivityDate="2019-10-25T07:16:21.293" Title="Smooth 2D Data with Discontinuous and Artificial Jumps" Tags="|image-processing|python|smoothing|spatial|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="18630" PostTypeId="1" AcceptedAnswerId="18634" CreationDate="2014-10-13T16:11:51.067" Score="3" ViewCount="4697" Body="&lt;p&gt;I have been struggling with this issue for months now, trying to understand which one to pick: FFT or cross correlation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am given a sine wave (with phase, amplitude, frequency and time vector known), and I have to extract the phase shift between that sine wave and another signal. The new signal has the same frequency and the same time vector as the sine wave, however the amplitude and the phase are unknowns. What would you guys suggest? I am at a loss.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="11266" LastEditorUserId="11256" LastEditDate="2014-10-13T19:31:36.110" LastActivityDate="2014-10-13T19:46:46.260" Title="Cross correlation vs FFT for finding phase between 2 signals" Tags="|fft|cross-correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18631" PostTypeId="1" CreationDate="2014-10-13T18:20:31.103" Score="19" ViewCount="6999" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ips0H.jpg&quot; alt=&quot;photo of Barbara&quot; /&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In recent years, I have started doing work in image analysis and have used the Barbara and &lt;a href=&quot;https://en.wikipedia.org/wiki/Lenna&quot; rel=&quot;noreferrer&quot;&gt;Lena&lt;/a&gt; images. Early on, I became aware of the interesting history surrounding the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lenna&quot; rel=&quot;noreferrer&quot;&gt;Lena&lt;/a&gt; image and that got me wondering:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Who is Barbara?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Where was the photograph shot?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What was the original intent of the photographer? Presumably, the photograph wasn't taken for image research.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Many people cite &lt;a href=&quot;https://en.wikipedia.org/wiki/Allen_Gersho&quot; rel=&quot;noreferrer&quot;&gt;Allen Gersho&lt;/a&gt;'s lab or Marco Schmidt's (now defunct) test image database. However, this is a bit unsatisfying to me.&lt;/p&gt;&#xA;" OwnerUserId="11371" LastEditorUserId="50076" LastEditDate="2023-05-08T19:07:05.963" LastActivityDate="2023-05-08T19:07:05.963" Title="Who is Barbara?" Tags="|image-processing|reference-request|signals-history|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="18632" PostTypeId="2" ParentId="18631" CreationDate="2014-10-13T19:04:33.087" Score="12" Body="&lt;p&gt;The appeal of this image is obviously in the numerous lines, which test the aliasing properties of resizing, denoising, and super-resolution algorithms.&lt;/p&gt;&#xA;&lt;p&gt;It seems &lt;a href=&quot;https://en.wikipedia.org/wiki/Allen_Gersho&quot; rel=&quot;nofollow noreferrer&quot;&gt;Allen Gersho&lt;/a&gt; is the source, according to the Acknowledgement section of Shapiro's &lt;a href=&quot;https://doi.org/10.1109/78.258085&quot; rel=&quot;nofollow noreferrer&quot;&gt;Embedded image coding using zerotrees of wavelet coefficients&lt;/a&gt; &lt;a href=&quot;http://hpds.ee.kuas.edu.tw/download/Seminar/2008-09-26/1993_Embedded%20Image%20Coding%20Using%20Z.of%20W.%20Coes.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[PDF&lt;/a&gt;] (1993).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/87viw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/87viw.png&quot; alt=&quot;screenshot&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The author would like to thank Joel Zdepski who suggested incorporating the sign of the significant values into the significance map to aid embedding, Rajesh Hingorani who wrote much of the original C code for the QMF-pyramids, Allen Gersho who provided the original &amp;quot;Barbara&amp;quot; image, and Gregory Wornell whose fruitful discussions convinced me to develop a more mathematical analysis of zerotrees in terms of bounding an optimal estimator. I would also like to thank the editor and the anonymous reviewers whose comments led to a greatly improved manuscript.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you want more specific information you could ask him or one of his students from the early 90s, when this image first seems to have appeared.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="7092" LastEditDate="2023-05-08T16:46:11.037" LastActivityDate="2023-05-08T16:46:11.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="18633" PostTypeId="2" ParentId="14398" CreationDate="2014-10-13T19:26:52.027" Score="1" Body="&lt;p&gt;You should use k fold cross validation to average over the different ways of dividing up the training images.&lt;a href=&quot;http://en.m.wikipedia.org/wiki/Cross-validation_(statistics)#k-fold_cross-validation&quot; rel=&quot;nofollow&quot;&gt;http://en.m.wikipedia.org/wiki/Cross-validation_(statistics)#k-fold_cross-validation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes a particular split of training and testing images is lucky or unlucky. You can get more reliable estimates of the accuracy with some form of cross validation.  &lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-10-13T19:26:52.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18634" PostTypeId="2" ParentId="18630" CreationDate="2014-10-13T19:46:46.260" Score="0" Body="&lt;p&gt;I don't see it as one or the other. You can use the FFT to more efficiently compute a cross-correlation (versus computing the cross-correlation in the time-domain). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is lots of good information on this &lt;a href=&quot;https://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar&quot;&gt;thread&lt;/a&gt;, about computing the &quot;phase shift&quot;, from the offset of the peak in the cross-correlation function.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-10-13T19:46:46.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18636" PostTypeId="2" ParentId="18168" CreationDate="2014-10-13T22:01:56.907" Score="3" Body="&lt;p&gt;Try looking into posts on &quot;onset detection&quot;, where typically &quot;flux&quot; (or first order difference, typically of spectral magnitude) is used to compute the &quot;rate of change&quot; of a signal. The high rate of change is the most salient feature of the images you drew above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, your third image seems to translate the maximum of the curve (to the left) is that your intent?&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2014-10-13T22:01:56.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18639" PostTypeId="2" ParentId="18629" CreationDate="2014-10-13T23:58:17.173" Score="2" Body="&lt;p&gt;Try a &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;Median Filter&lt;/a&gt; with a large enough sliding window, to pull the outliers (discontinuous jumps) back within tolerance.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2014-10-13T23:58:17.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18640" PostTypeId="1" CreationDate="2014-10-14T01:58:16.857" Score="1" ViewCount="215" Body="&lt;p&gt;To create a scale space, I applied a Laplacian of Gaussian filter on the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9F5o9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the scale space was created, I plotted circles around local maxima in scale space. However, instead of $9$ circles, I got many more as shown below(image below not to scale).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t0WXj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following video shows the LoG filter responses as scale is varied from $\sigma=1$ to $16$ in steps of $0.01$ -- &lt;a href=&quot;http://youtu.be/m4LyXBI_6w0&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;this link&quot;&gt;http://youtu.be/m4LyXBI_6w0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shows additional maxima being created at higher scales. But this should not be the case since LoG was especially chosen so as not to create additional maxima. What could be the explanation here ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE: Thresholding the magnitude of scale space responses eliminates the additional maxima as shown below. Could it be that the additional maxima being absent holds only up to a certain degree ?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Wjtnf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2014-10-14T13:16:54.480" Title="LoG filter creating additional maxima in scale space" Tags="|image-processing|computer-vision|local-features|scale-space|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18641" PostTypeId="1" CreationDate="2014-10-14T06:31:10.823" Score="1" ViewCount="1630" Body="&lt;p&gt;I have a sine tone, doing some math, and finally gets an harmonically accumulated sine tone in complex numbers. I do want to preserve the phase information of imaginary part on the other end, which will continue processing the complex signal. So, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way i can safely pack the complex number into any of standard file formats, such as &lt;code&gt;wav&lt;/code&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note : Currently I am  writing this signal's byte values to a .bin file&lt;/p&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="5662" LastEditDate="2014-10-14T16:37:46.257" LastActivityDate="2014-10-14T16:37:46.257" Title="Does Wav format supports writing complex values" Tags="|signal-analysis|music|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18644" PostTypeId="2" ParentId="18640" CreationDate="2014-10-14T08:07:05.613" Score="0" Body="&lt;p&gt;My interpretation would be that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the 4 large circles really make sense. Think of it like a &lt;a href=&quot;http://en.wikipedia.org/wiki/Illusory_contours&quot; rel=&quot;nofollow&quot;&gt;Kanisza's Triangle&lt;/a&gt; or a &lt;a href=&quot;http://en.wikipedia.org/wiki/Negative_space&quot; rel=&quot;nofollow&quot;&gt;Negative Space optical illusion&lt;/a&gt;: You can either look at 9 white points, or at a grid of 4 black rectangles. If you look at the image on a coarse scale (e.g. through an out of focus lens) you really would see 4 black blobs in a thin white grid.&lt;/li&gt;&#xA;&lt;li&gt;the medium-sized 12 circles between each pair of white blobs probably have a similar explanation: there's a black blob between two white blobs. Or, alternatively: If you think of two &quot;mexican hat&quot; functions centered at two of the white circles, then that's where the mexican hats would intersect, and thus form a small peak.&lt;/li&gt;&#xA;&lt;li&gt;the 4 small circles around each of the white circles are probably artifacts: Again, if you think about a &quot;mexican hat&quot; centered on a circle, there would be a circular &quot;moat&quot; around each white circle. But since neither the circles nor the LoG filter are perfectly isotropic, the moat isn't perfectly symmetric either, and contains points that are slightly higher (or lower?) than the points around them. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="291" LastActivityDate="2014-10-14T08:07:05.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18645" PostTypeId="1" CreationDate="2014-10-14T08:10:44.353" Score="0" ViewCount="2449" Body="&lt;p&gt;I want a image. Firstly I want to do fourier transform and get the magnitude and phase information. And then make a new random phase, finally use the changed random phase and original magnitude to make the inverse fourier transform. But I can not achieve it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is shown here. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; img   = imread('flag.jpg');&#xA; imafft = fftn(double(img));&#xA; mag = abs(imafft);&#xA; phi= angle(imafft);&#xA; s= size (img);&#xA; rand_phase= 4*pi*(rand(s(1),s(2))-0.5);&#xA; newfft = mag.*exp(i*rand_phase);&#xA; ima_out = ifft2(newfft); &#xA; figure(2);&#xA; imagesc(abs(ima_out));&#xA; axis image;&#xA; title('Ramdom phase version');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is in the sentence of &lt;code&gt;newfft = mag.*exp(i*rand_phase);&lt;/code&gt; I do not know how to modify. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Who can help me? Thank you so much.&lt;/p&gt;&#xA;" OwnerUserId="11381" LastEditorUserId="8202" LastEditDate="2014-10-14T09:44:09.307" LastActivityDate="2017-01-18T02:48:22.397" Title="Inverse fourier transform by using a random phase and an original magnitude (matlab)" Tags="|image-processing|fft|ifft|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18646" PostTypeId="2" ParentId="18641" CreationDate="2014-10-14T08:34:41.637" Score="2" Body="&lt;p&gt;You could create a standard 2 channel wav file. 1 channel for the real part and 1 for the imag. Wav files supports both 16bit integer, 32bit integer and 32bit floats etc. The channel data will be interleaved (I believed it's called). Meaning that your data will be written: [REAL][IMAG][REAL][IMAGE]...&#xA;Prolly just like your own bin file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard programs like Audacity will be able to read the file and make calculations on each (or both) channels. &lt;/p&gt;&#xA;" OwnerUserId="11362" LastActivityDate="2014-10-14T08:34:41.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18647" PostTypeId="2" ParentId="18621" CreationDate="2014-10-14T08:40:40.930" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://www.helpdoc-online.com/cool_edit_pro_2_help/32bit.htm&quot; rel=&quot;nofollow&quot;&gt;This link&lt;/a&gt; implies that .wav files have several standards for storing 32 bit floating point.  It looks like foramt 32-bit 16.8 float (type 1 - 32-bit) would do what you want.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As best I can see, SOX (&lt;a href=&quot;http://sourceforge.net/p/sox/mailman/message/21646295/&quot; rel=&quot;nofollow&quot;&gt;reference&lt;/a&gt;) can work (read it at least) with this type of format, so you could look at the source code to see how to generate/read these files.  CoolEdit claims to be able read and write this format (see first link.)&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-10-14T08:40:40.930" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18648" PostTypeId="1" CreationDate="2014-10-14T09:46:01.597" Score="2" ViewCount="2031" Body="&lt;p&gt;The result of calculating the fourier transform using numerical integration is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BhVGj.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;the result of using Matlab's FFT is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J1zyd.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;So where did I go wrong here? I know the FT of a Gaussian should be another Gaussian.  Shouldn't they be the same? Furthermore I would have thought the&lt;/p&gt;&#xA;&lt;h1&gt;Edit:&lt;/h1&gt;&#xA;&lt;p&gt;Following a suggestion using the &lt;code&gt;fftshift&lt;/code&gt; function gets me to the following plot, but this looks very different to the original &lt;code&gt;fft&lt;/code&gt; despite documentation stating that it just centres the result around zero frequency.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KqY12.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is more resembling what I would expect.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;omega = linspace(-30,30,1000);&#xA;&#xA;t = linspace(-10,10,1000);&#xA;y = exp(-t.^2./2)/sqrt(2*pi);&#xA;Yft = fft(y);&#xA;&#xA;% Pre-allocate results of integration.&#xA;Y = zeros(size(omega)); &#xA;&#xA;%Integrate.&#xA;for k=1:length(omega)&#xA;    Y(k) = trapz(t, exp(-t.^2./2)/sqrt(2*pi).*exp(1j*omega(k).*t)); &#xA;end&#xA;&#xA;figure()&#xA;plot(omega, real(Y), omega, imag(Y));&#xA;&#xA;figure()&#xA;plot(omega, real(Yft), omega, imag(Yft));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5466" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-10-14T10:22:08.460" Title="Comparing the FFT to numerical integration in Matlab" Tags="|matlab|fourier-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18649" PostTypeId="1" AcceptedAnswerId="18659" CreationDate="2014-10-14T10:00:24.653" Score="1" ViewCount="4401" Body="&lt;p&gt;I'm confused by the SMA. I'm reading a paper which states that &quot;SMA is the square root of the summation of the filtered acceleration signal&quot;. So I understand that it's $sma = \sqrt{\sum{samples}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I check the referenced paper, which says that &quot;SMA is calculated after dividing area under the acceleration curve with the time interval&quot;. So $sma = {1 \over T} \sum samples$, which is some kind of average, which looks like what is on this &lt;a href=&quot;https://stackoverflow.com/questions/19702753/matlab-compute-normalized-signal-magnitude-area&quot;&gt;StackOverflow&lt;/a&gt; question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the &lt;a href=&quot;https://en.wikipedia.org/wiki/Signal_magnitude_area&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article&lt;/a&gt; is so new I'm not sure it's reliable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, what is exactly SMA as I couldn't find a proper definition online?&lt;/p&gt;&#xA;" OwnerUserId="11384" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2020-12-23T13:56:46.680" Title="Signal magnitude area" Tags="|signal-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18650" PostTypeId="2" ParentId="18648" CreationDate="2014-10-14T10:22:08.460" Score="2" Body="&lt;p&gt;There are two reasons why you get different results. The first is that you define a vector &lt;code&gt;t&lt;/code&gt; between $-10$ and $10$, but the &lt;code&gt;fft&lt;/code&gt; command doesn't know that. So the data are interpreted as starting at $0$. This means the first difference is that the FFT computes the transform of a delayed Gaussian impulse, not of an impulse centered at time zero. This is why you get a non-zero imaginary part in the result of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second problem is - as pointed out by nivag in a comment - that the first index of the result of the FFT corresponds to frequency zero, and the negative frequencies appear in the second half of the resulting vector.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-14T10:22:08.460" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="18651" PostTypeId="1" AcceptedAnswerId="24652" CreationDate="2014-10-14T10:25:03.583" Score="0" ViewCount="809" Body="&lt;p&gt;I need to find the similarity between two signals, i.e., measured signal and the reference signal(e.g. a simple sinusoidal signal). What I mean by similarity is, if there is any decentralized glitch or any change in freq for one particular cycle, the similarity measure should give 'False' or a value in 0 - 1 scale for that cycle. Phase difference also should be considered. Could this be done using correlation? Or is it possible to use wavelets? Or any other method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many Thanks...&lt;/p&gt;&#xA;" OwnerUserId="11385" LastActivityDate="2015-07-13T01:35:33.900" Title="Similarity between two Signals: cycle by cycle" Tags="|wavelet|correlation|waveform-similarity|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18652" PostTypeId="1" AcceptedAnswerId="18657" CreationDate="2014-10-14T12:37:51.257" Score="1" ViewCount="697" Body="&lt;p&gt;I'm a newbie and I have a few questions regarding ECG signal. Here is my plot of raw ECG signal with a sampling frequency 200Hz in Matlab.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fIxZs.jpg&quot; alt=&quot;whole ECG signal&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/wuD4K.jpg&quot; alt=&quot;part of ECG signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it look good to you? Why is it flipped? &lt;/p&gt;&#xA;" OwnerUserId="4695" LastEditorUserId="47790" LastEditDate="2020-04-02T12:08:38.223" LastActivityDate="2020-04-02T12:31:10.010" Title="ECG signal analysis" Tags="|matlab|ecg|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18653" PostTypeId="2" ParentId="18640" CreationDate="2014-10-14T13:16:54.480" Score="1" Body="&lt;p&gt;Without exactly seeing your code it is hard to know for certain, but I suspect this is because you are not tracking your maxima well through scale space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The position of the maxima will move in scale space. At the smallest scales you get the 4 small blobs around each circle. These are due to digitization and possibly noise/irregularities in the boundary edge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These maxima will expand as the scale increases and merge together to form the &quot;correct&quot; blobs around the circles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the other side of the peaks will also merge together resulting in the 12 medium size blobs and finally these will merge to form the four largest blobs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note at each stage here the number of maxima decreases 36-&gt;21 (9+12) -&gt; 13 (9+4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is as you only look for local maxima in scale-space you lose  a lot of the relationship between the maxima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One option may be to look for all local maxima at each scale and track these through scales. However, I'm not sure how straightforward this would be or how you determine which are the significant peaks using this approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possibly better option may be similar to what you suggested by thresholding the responses. &lt;a href=&quot;http://www.sci.utah.edu/~weiliu/class/aip/p1/&quot; rel=&quot;nofollow&quot;&gt;This article&lt;/a&gt; does basically the same thing as you. It applies a threshold on the mean blob volume over all scales. Which it claims it better than thresholding the peak response.&lt;/p&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-10-14T13:16:54.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18654" PostTypeId="1" AcceptedAnswerId="18660" CreationDate="2014-10-14T14:03:44.323" Score="3" ViewCount="954" Body="&lt;p&gt;I'm currently working on a project that involves using an electron gun and it would be really nice to know the spot shape of the electrons coming out of the gun (the frequency of electrons at some x,y away from the center of the beam).  Our current assumption is that the beam's spot shape is somewhat gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a picoammeter hooked up to a detector that outputs that current corresponding to the number of electrons that hit the detector.  The detector is circular with some radius, R.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm not mistaken, sweeping the beam and recording readings from the picoammeter will result in an matrix that is the convolution of the beam spot shape and a 2D step function that's 0 outside of R and non-zero inside R.  I have looked through a few previous questions about deconvolutions related to images with a gaussian blur and it seems like this is very similar except the function is a step function instead of a gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using Matlab's conv2, FFT2, and iFFT2 functions to get the deconvolution &lt;a href=&quot;https://stackoverflow.com/questions/19150516/2d-deconvolution-using-fft-in-matlab-problems&quot;&gt;as this thread suggests&lt;/a&gt;, but it produces something looking like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2Qaqr.png&quot; alt=&quot;Deconvolution Attempt&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code that produced this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mu = [0 0]; &#xA;Sigma = [1 0; 0 1]; &#xA;x = -3:.2:3;&#xA;[X1,X2] = meshgrid(x,x);&#xA;F = mvnpdf([X1(:) X2(:)],mu,Sigma);&#xA;F = reshape(F,length(x),length(x));&#xA;for i=1:31&#xA;    for j=1:31 &#xA;        if x1(i)^2+x2(i)^2 &amp;gt;= 4 &#xA;            circ(i,j)=0; &#xA;        else&#xA;            circ(i,j)=1; &#xA;        end &#xA;    end &#xA;end &#xA;conv = conv2(F,circ,'same');&#xA;D = ifft2( fft2(conv) ./ fft2(circ) ); &#xA;surf(x1,x2,D);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there something inherently wrong with trying to deconvolves a step function?  Also, I tried using the full convolution, but that seemed to produce an even weirder deconvolution...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I just going about this the wrong way? (I've included python because I would prefer to use python if a solution exists, but matlab is fine too)&lt;/p&gt;&#xA;" OwnerUserId="11390" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-10-15T08:39:03.870" Title="2D deconvolution of recorded electron beam data" Tags="|fft|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18656" PostTypeId="1" AcceptedAnswerId="18664" CreationDate="2014-10-14T15:40:48.973" Score="0" ViewCount="5408" Body="&lt;p&gt;I am currently working on a frequency domain real-time application on a digital signal processor. Currently for one time frame of my algorithm I read in time domain data into a buffer, perform a Fourier transform with a Hanning window (win), which I generate using MATLAB with the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;win = 2*hanning(N,'periodic')/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where N is my transform length, (usually 2048 in my case). The window coefficients are then stored in a header file as single floating point data to be included into a C project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain I execute my algorithm, then convert it back to the time domain to be outputted in a third buffer. I am certain the forward and reverse transforms work correctly having thoroughly tested them (and having used them for several months).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I output the data I use the following 'window' to reverse the effects (i.e. the energy level of the time domain signal to remove the 'oscillating' effect of the reconstructed signal) of the original window that I applied (in MATLAB code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;win_out = win ./ (win.^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've seen the divide by energy (win.^2) in other peoples code, and assume that the line of MATLAB code above is equivalent to (it gives the same result of course):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;win_out = 1./ win;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I implement this in my real time application the values on the edge of my 'output' window (win_out) are very large (of the factor x10^8, see image below) and are in fact too big. This results in the edges of my time period being amplified too much resulting in a 'clippy' effect in my time domain signal when I listen to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've illustrated the problem below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wWaLO.png&quot; alt=&quot;Original reconstructed time domain signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above is the original reconstructed time domain signal, if this was to be outputted it would have an oscillating effect on the output, which I try and fix by applying an 'inverse' window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hLYka.png&quot; alt=&quot;&amp;#39;Inverse&amp;#39; window (zoomed in)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the inverse window that generated by the above MATLAB code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ljqWk.png&quot; alt=&quot;T-domain with window zoomed out&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time domain signal with my 'inverse' window (note: spikes at each end).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eE7qO.png&quot; alt=&quot;T-domain with window zoomed in&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First spike zoomed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NB: I don't use overlapping (yet!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: how do a choose an 'inverse' (if that is the correct term?) window to ensure those spikes aren't present in fully reconstructed time domain signal with window?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks ! &lt;/p&gt;&#xA;" OwnerUserId="8165" LastEditorUserId="8165" LastEditDate="2014-10-14T16:15:34.063" LastActivityDate="2015-02-11T22:25:56.533" Title="Reconstructing time domain signal with Hanning window" Tags="|fft|spectrogram|real-time|reconstruction|window|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18657" PostTypeId="2" ParentId="18652" CreationDate="2014-10-14T16:37:21.690" Score="1" Body="&lt;p&gt;It's perfectly normal for the peaks to be at the bottom if that's what you're referring to. Even though on tv they are always on the top.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example from wikipedia.&#xA;&lt;a href=&quot;https://commons.wikimedia.org/wiki/File:Pulmonary_embolism_ECG.jpg&quot; rel=&quot;nofollow&quot;&gt;https://commons.wikimedia.org/wiki/File:Pulmonary_embolism_ECG.jpg&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-10-14T16:37:21.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18658" PostTypeId="1" CreationDate="2014-10-14T16:44:20.617" Score="1" ViewCount="558" Body="&lt;p&gt;I'm trying to process an audio stream through a series of peak filters at static frequencies that range from 0 to nyquist. If I start the range from anything below about 25Hz, the audio gets corrupted in some way (I haven't looked at the values yet, so I don't know what the corruption looks like) that results in no sound. But making the range ~25Hz to nyquist is fine. This happens even when all the filters are at zero gain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anyone aware of theoretical problems with using a low frequency peak filter? Maybe it's a problem when its bandwidth might cross over 0Hz? (Do standard biquad equations address that possibility?) &lt;/p&gt;&#xA;" OwnerUserId="11392" LastActivityDate="2014-10-14T17:47:19.837" Title="Signal corrupted using peak (biquad) filter at low frequencies" Tags="|filters|audio|frequency-spectrum|frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18659" PostTypeId="2" ParentId="18649" CreationDate="2014-10-14T17:03:25.250" Score="3" Body="&lt;p&gt;I've found a proper definition thanks to the following article:&#xA;&lt;a href=&quot;http://www.rehab.research.va.gov/jour/2013/509/jrrd-2012-12-0233.html&quot; rel=&quot;nofollow&quot;&gt;http://www.rehab.research.va.gov/jour/2013/509/jrrd-2012-12-0233.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I've edited Wikipedia with:&#xA;$$f_{sma}= {1 \over {T}} {\int_{0}^{T} |x(t)-a_x|+|y(t)-a_y|+|z(t)-a_z| dt}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It wasn't because of text-search but images-search. Algorithms are sometimes surprising)&lt;/p&gt;&#xA;" OwnerUserId="11384" LastActivityDate="2014-10-14T17:03:25.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18660" PostTypeId="2" ParentId="18654" CreationDate="2014-10-14T17:25:31.367" Score="0" Body="&lt;p&gt;Your method of deconvolving seems to work.  Below is some Gnu Octave (more or less Matlab) code that implements your deconvolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feed it two files that represent your target and your beam and it will perform a convolution of the two, then use your method to reverse the convolution.&lt;br&gt;&#xA;The result shows the original two images, the convolved image, and the recovered shape of the beam.&lt;br&gt;&#xA;The attached picture shows the results from my test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top left is the target (50x50px)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lower left is the beam (14x16px)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top right is the convolution of the two (the map of your electron counts)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lower right is the recovered beam shape&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The padding is a little off, so there's some wrap-around in the recovered image.  The result is clear enough, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would check the images that you used for beam and target, and also check the convolved image to see if it is what you expected.  Part of the problem might also be the &quot;same&quot; that you used in the convolution.  That returns an image the same size as one of the convolved images, which will cause you to lose a lot of information.  If I use &quot;same&quot; then I don't get a recovered shape at all.  The convolved image is larger than the larger of the two images, so you have to use &quot;full&quot; then pad the target image to do the deconvolution.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;ETA:&#xA;I got so busy looking at the details of the deconvolution that I forgot to mention your thoughts on the effect of scanning the beam across the target.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree that this is equivalent to convolving the beam shape with the target shape, so that I think you are on the right track to determining the beam shape - if I weren't convinced of that I wouldn't have bothered to check the deconvolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a few things that you will need to keep an eye on when you go to actually do the scan to determine the beam shape:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Scan area - you will need to overscan the target.  Take the radius of the target as R and the maximum radius (estimated) of the beam as r, then you will need to scan a square of at least R*2+2*(r*2) - actually more, but that is the absolute minimum.  Since you don't know the beam shape (and therefore its true size,) it may be better to go overboard here rather than have to repeat the measurements&lt;/li&gt;&#xA;&lt;li&gt;The image you use to do the deconvolution must match (as perfectly as possible) the true shape and size of your target.  The position of the target shape within the image isn't as important.&lt;/li&gt;&#xA;&lt;li&gt;When you pad your target shape image, center the image in the padding.  As I've done it, the padding is all on the top and left side.  This puts the right and bottom edges of the target shape right at the edges of the image.  Rounding errors can (and do, as you can see) cause part of the image to wrap around.  Since you will be creating the images, you could just create your image with the appropriate border instead of padding it in code.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/K0THX.png&quot; alt=&quot;Sample deconvolution&quot;&gt;&#xA;&lt;code&gt;&#xA;target=imread(&quot;target.png&quot;);&#xA;beam=imread(&quot;beam.png&quot;);&#xA;convolved=real(fftconv2(target,beam,&quot;full&quot;));&#xA;widthc=size(convolved,2);&#xA;heightc=size(convolved,1);&#xA;widtht=size(target,2);&#xA;heightt=size(target,1);&#xA;padw=int32(widthc-widtht);&#xA;padh=int32(heightc-heightt);&#xA;paddedtarget=padarray(target,[padh,padw],0,'pre'); &#xA;recovered=real(ifft2(fft2(convolved)./fft2(paddedtarget)));&#xA;subplot(2,2,1)&#xA;imshow(single(target));&#xA;subplot(2,2,2)&#xA;imshow(single(convolved));&#xA;subplot(2,2,3)&#xA;imshow(single(beam));&#xA;subplot(2,2,4)&#xA;imshow(single(recovered));&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-10-15T08:39:03.870" LastActivityDate="2014-10-15T08:39:03.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18661" PostTypeId="2" ParentId="18658" CreationDate="2014-10-14T17:45:12.873" Score="1" Body="&lt;p&gt;Looks a like a typical stability problem with the poles too close to the unit circle. A third octave wide parametric EQ filter at 25Hz sampled at 44.1kHz has a pole radius of &gt; 0.999 so it's getting VERY close to the unit circle. The lower the frequency, the large the pole radius.The pole section alone has a peak gain for more than 110 dB !!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the poles so close to being unstable, you may run into all sorts of problem: numerical noise, noise amplification, coefficient rounding or truncation errors, filter topology (do NOT use Direct Form II or transposed Form I), etc.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-10-14T17:45:12.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18662" PostTypeId="2" ParentId="18658" CreationDate="2014-10-14T17:47:19.837" Score="1" Body="&lt;p&gt;The greater the ratio between the sampling rate and a computed IIR filter's transition band frequencies, the more sensitive do certain forms of the recursion equations become to numerical issues, such as precision, rounding and quantization noise.  You may have reached a frequency ratio where your biquad's recursion computations round the resulting numbers to zero.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-10-14T17:47:19.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18663" PostTypeId="2" ParentId="18645" CreationDate="2014-10-14T18:29:00.950" Score="1" Body="&lt;p&gt;You image is not an $N \times M$ matrix. It's actually an $N \times M \times 3$ array of numbers. I assume that's why you're using &lt;code&gt;fftn&lt;/code&gt; instead of &lt;code&gt;fft2&lt;/code&gt; to take its Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to either &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;convert your image to grayscale; or&lt;/li&gt;&#xA;&lt;li&gt;process each component independently.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To work get grayscale, we can naïvely average over the RGB colors like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = mean(double(img),3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To work with all three components independently, your phase array needs to have an extra dimension:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rand_phase= 4*pi*(rand(s(1),s(2), s(3))-0.5);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6" LastEditorUserId="6" LastEditDate="2014-10-15T20:53:53.370" LastActivityDate="2014-10-15T20:53:53.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18664" PostTypeId="2" ParentId="18656" CreationDate="2014-10-14T19:36:20.670" Score="1" Body="&lt;p&gt;You should be using overlap.  That ought to take care of the &quot;oscillating&quot; and make it unnecessary to undo the Hanning window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect you are seeing comes about because the window values at the edges get very close to (and may even be) zero.  The window edges won't line up perfectly with the signal after you've done your processing in the frequency domain, so dividing by those very small values will cause the peaks you see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your place, I would first make sure that I could do the windowed FFT/IFFT and recover the original signal.  When you can do that without getting the &quot;oscillation&quot; you can put your processing back in.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-10-14T19:36:20.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18665" PostTypeId="1" CreationDate="2014-10-14T21:25:28.277" Score="0" ViewCount="82" Body="&lt;p&gt;Hello does any one know or at least can lead me to the right way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does not change pronunciation of words when someone is speaking. The idea is to create a app that checks if word/sentence is pronounced correctly. To do so I need something in pronunciation that does not change at all or changes in small range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example someone reads a text. His voice is recorded. Now someone else, who can not read so well reads it too. Then the recordings are compared to eacother. Then software displays on the computer screen how wrongly the second person pronounced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please do not suggest any software that does it!&lt;/p&gt;&#xA;" OwnerUserId="11396" LastActivityDate="2014-10-14T22:37:24.070" Title="Pronunciation research for app" Tags="|voice|" AnswerCount="1" CommentCount="2" ClosedDate="2014-10-22T00:38:17.150" ContentLicense="CC BY-SA 3.0" />
  <row Id="18668" PostTypeId="2" ParentId="18665" CreationDate="2014-10-14T22:37:24.070" Score="1" Body="&lt;p&gt;You need the right audio features, and the modern way to do this is with deep neural networks, which learn them automatically. I would use one built for speech recognition (it's basically the same problem), then model the users by the output of the top layers. Accents should manifest as clusters of the features, and languages as superclusters. I don't have much experience here but I'm making an educated guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/38131.pdf&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a relevant paper (&lt;em&gt;Deep Neural Networks for Acoustic Modeling in Speech Recognition&lt;/em&gt;), and &lt;a href=&quot;http://cs229.stanford.edu/proj2011/SealMurrayKhaleq-AccentRecognition.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; is a relevant student project (&lt;em&gt;Accent Recognition with Neural Network&lt;/em&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-10-14T22:37:24.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18670" PostTypeId="1" CreationDate="2014-10-14T23:46:18.863" Score="1" ViewCount="7568" Body="&lt;p&gt;I am confused with 2d magnitude plot of frequency spectra. So we have 2 images, the first one is shown at the top, and the dilated or enlarged version of the white box is shown at the second row. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bo19t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the dilated version, in the spatial domain when travelling in the $x$-direction, you see a fast change in intensity, and when you travel in the $y$ direction, the change is slower, so that the $v$ direction frequency component is smaller. In the frequency domain, $x$ maps to $u$, and $y$ maps to $v$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do understand that when you enlarge in one domain, you must do the opposite to the other domain. &#xA;The thing I don't understand is that in the dilated version, when you travel in $x$, and you still see the same rate of change as in the original image. Since $u$ maps to $x$ in the frequency domain, we expect that the frequency spectrum looks the same in the $u$ direction. However, the result is that, in the $u$ (or the horizontal) direction of frequency domain, its frequency component shrinks; the $v$ direction remains intact.  But we just change its $y$ direction!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&#xA;To be more precise, please refer to the area of the red box. In the second figure, it gets shrink.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pVPOe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11260" LastEditorUserId="15892" LastEditDate="2015-09-12T21:00:22.533" LastActivityDate="2017-03-06T12:26:08.360" Title="[2D fourier transform]: Most people can't explain this" Tags="|image-processing|fourier-transform|2d|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18672" PostTypeId="2" ParentId="18670" CreationDate="2014-10-15T07:19:53.157" Score="0" Body="&lt;p&gt;The frequency component shrinks in the $v$ direction in your image. For better understanding refer to the following MATLAB code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=zeros(200,200);&#xA;x(80:120,100)=1;&#xA;X=fft2(x);&#xA;y=zeros(200,200);&#xA;y(20:180,100)=1;&#xA;Y=fft2(y);&#xA;figure(1);imshow(x);&#xA;figure(2);imshow(y);&#xA;figure(3);imshow(fftshift(log(abs(X)+1)),[]);&#xA;figure(4);imshow(fftshift(log(abs(Y)+1)),[]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11360" LastEditorUserId="8202" LastEditDate="2014-10-15T08:20:41.817" LastActivityDate="2014-10-15T08:20:41.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18673" PostTypeId="1" CreationDate="2014-10-15T08:02:45.793" Score="4" ViewCount="2111" Body="&lt;p&gt;I have to compress an image using SVD. I did a few things, but all of them produced a black &amp;amp; white image. However, the output must be RGB. How can I compress an image without changing its original format?&lt;/p&gt;&#xA;" OwnerUserId="11399" LastEditorUserId="128" LastEditDate="2023-02-14T10:50:18.157" LastActivityDate="2023-02-14T10:50:18.157" Title="Image Compression Using the SVD in MATLAB" Tags="|matlab|image-processing|image-compression|svd|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="18674" PostTypeId="2" ParentId="18673" CreationDate="2014-10-15T08:33:09.223" Score="3" Body="&lt;p&gt;The typical thing to do is the low-rank approximation on separate channels. Assume that $C$ is a channel of the RGB image $I$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rank = 10;&#xA;[U,S,V] = svd(C);&#xA;L = U(:,1:rank) * S(1:rank, 1:rank) * V(:, 1:rank)';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;code&gt;L&lt;/code&gt; should be the compressed image. If you do this operation and compose the channels back, you should get a compressed RGB image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, such a method in my opinion is only good for mathematical understanding. It is not very practical due to the fact that it depends on image dimensions too much and cannot generate high SNR results. Or better stated, as you decrease &lt;code&gt;rank&lt;/code&gt;, you drastically reduce the quality of the reconstruction. For this reason, one has to retain around ~50-100 components. Better methods doing this blockwise, or formulating the compression as an energy functional exist. Image denoising is a huge area of its own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might want to check some results with varying &lt;code&gt;rank&lt;/code&gt; in &lt;a href=&quot;http://math.arizona.edu/~brio/VIGRE/ThursdayTalk.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this presentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Also, a similar question has already been asked; please follow the &lt;a href=&quot;https://stackoverflow.com/questions/13614886/using-svd-to-compress-an-image-in-matlab&quot;&gt;Stack Exchange discussion here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-10-15T08:53:48.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18676" PostTypeId="1" CreationDate="2014-10-15T09:06:16.707" Score="1" ViewCount="76" Body="&lt;p&gt;I'm asking as I'm looking at Wavelet transforms, and I see that it is possible to have a TF decomposition or a representation of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for example at the code &lt;a href=&quot;https://github.com/mne-tools/mne-python/blob/master/mne/time_frequency/tfr.py&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; we can see that the TF representation&#xA;(&lt;a href=&quot;https://github.com/mne-tools/mne-python/blob/master/mne/time_frequency/tfr.py#L861&quot; rel=&quot;nofollow&quot;&gt;tfr_morlet function&lt;/a&gt;)of a signal returns the averaged power and optionally the intertrial coherence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The TF decomposition function (cwt_morlet, line 167) on the other hand returns Time Frequency Decompositions (n_signals x n_frequencies x n_times) arrays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does each process do in this sense?&lt;/p&gt;&#xA;" OwnerUserId="11401" LastActivityDate="2014-10-15T09:06:16.707" Title="What is the difference between Time-Frequency Represenation and TF Decomposition" Tags="|wavelet|convolution|decomposition|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18677" PostTypeId="5" CreationDate="2014-10-15T09:09:52.430" Score="0" Body="&lt;p&gt;The concept of signal decomposition relates to the need to separate one component from the others in a signal; this can be achieved through a filtering operation which require a filter design stage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such filtering is traditionally done in the time domain or in the frequency domain; however, this may not be possible in the case of non-stationary signals that are multicomponent as such components could overlap in both the time domain and also in the frequency domain; as a consequence, the only possible way to achieve component separation and therefore a signal decomposition is to implement a time–frequency filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Time%E2%80%93frequency_analysis#TF_filtering_and_signal_decomposition&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Time%E2%80%93frequency_analysis#TF_filtering_and_signal_decomposition&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11401" LastEditorUserId="11401" LastEditDate="2014-10-15T15:46:30.947" LastActivityDate="2014-10-15T15:46:30.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18678" PostTypeId="4" CreationDate="2014-10-15T09:09:52.430" Score="0" Body="The concept of signal decomposition relates to the need to separate one component from the others in a signal; this can be achieved through a filtering operation which require a filter design stage. " OwnerUserId="11401" LastEditorUserId="11401" LastEditDate="2014-10-15T15:46:33.377" LastActivityDate="2014-10-15T15:46:33.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18679" PostTypeId="2" ParentId="18670" CreationDate="2014-10-15T09:33:59.620" Score="-1" Body="&lt;p&gt;You increased the length of the white box. Now when you traverse in x direction , the rate of change remains the same. But now you have more number of pixels where intensity changes from black(0) to white (255). This has resulted in more energy along that direction. check your image. The u component is more brighter in expanded image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This energy can be represented using few harmonic coefficients. Check your image. You would see a denser grid along u direction.&lt;/p&gt;&#xA;" OwnerUserId="8435" LastActivityDate="2014-10-15T09:33:59.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18680" PostTypeId="2" ParentId="18651" CreationDate="2014-10-15T09:38:07.793" Score="0" Body="&lt;p&gt;Since you already have a reference signal, have you thought of computing the absolute error between the reference and the measured signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. if $x(t)$ is the reference signal and $y(t)$ is the measured signal, one of the approaches to find the difference is to evaluate the function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d(t) = \cases{0 \quad |x(t) - y(t)| &amp;lt; T \\ 1 \quad |x(t) - y(t)| &amp;gt; T } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is a threshold set by you.&lt;/p&gt;&#xA;" OwnerUserId="11345" LastActivityDate="2014-10-15T09:38:07.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18686" PostTypeId="1" CreationDate="2014-10-15T16:16:18.280" Score="1" ViewCount="851" Body="&lt;p&gt;Can someone please explain how to determine if a system is invertible or not. The particular systems that I am looking at are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \cos \left( x(t) \right)$ - I believe this is non-invertable because of the periodic function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = nx[n]$ - I think this is invertable and the inverse is $x[n]/n$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = x[4n + 1]$ - Is the inverse $x[1/4n - 1]$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = x[n - 2] - 2x[n - 8]$ - I do not know even how to begin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am really confused with systems... did not understand a single thing in the lecture today, and now reading the book (&quot;Signals and Systems&quot;, Oppenheim) I am getting frustrated. Is there an algebraic procedure for determining the inverse of a system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help. &lt;/p&gt;&#xA;" OwnerUserId="11406" LastEditorUserId="4346" LastEditDate="2014-10-15T16:31:19.437" LastActivityDate="2015-01-10T21:45:06.400" Title="System invertability" Tags="|signal-analysis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18687" PostTypeId="2" ParentId="18686" CreationDate="2014-10-15T16:28:26.170" Score="1" Body="&lt;p&gt;$$ y[n] = x[n-2] - 2 x[x-8] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that's actually a linear and time-invariant system.  you invert it by computing the Z transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y(z) = z^{-2}X(z) - 2 z^{-8}X(z) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;solve for $X(z)$, then inverse Z transform.  you might find out that, to invert this system, you will have to look at future samples, so the inverse would not be &lt;em&gt;causal&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-10-15T16:28:26.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18688" PostTypeId="1" CreationDate="2014-10-15T18:56:44.307" Score="4" ViewCount="1151" Body="&lt;p&gt;We know that applying a filter on an image is called correlation or convolution depending on the filter angle. In Gonzalez I have read that we can apply linear convolution on an image. Here I have a doubt. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose we have a vector image of 4 elements and a filter/kernel also of 4 elements then we get the output of linear convolution which contains 7 elements (4+4-1). Does that mean now the image is represented by 7 elements? If not then what does these 7 elements represent?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also I want to know where do we use Circular Convolution. I have read many posts but not able to get it fully. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Last question is from filtering in frequency domain. We know that convolution of f(x,y)* h(x,y) in the spatial domain is equal to the product of DFT's of the image and the kernel i.e F(u,v).H(u,v) in the frequency domain. Then if we have a 64 *64 image and 3*3 filter, please tell me what will be the size of the sequence obtained by applying Linear Convolution in the spatial domain. Also Do we take the DFT of the image f(x,y) as it is or do we need to pad the image first before taking its DFT and if padding is needed how much? I know filter size should also be 64 * 64, so we need to change filter size from 3 * 3 to 64 * 64. It means padding of 61 rows and 61 columns of 0's but where should we pad these 0's. These 0's cannot be equally divided top,bottom,left , right as 61 * 61 is an odd number. Please explain.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11189" LastEditorUserId="128" LastEditDate="2019-03-15T22:41:33.067" LastActivityDate="2019-12-11T01:02:05.387" Title="Question About Linear and Circular Convolution - 1D and 2D" Tags="|image-processing|fft|discrete-signals|dft|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="18689" PostTypeId="1" CreationDate="2014-10-15T18:58:07.643" Score="0" ViewCount="1366" Body="&lt;p&gt;I am making an application where I record sound on an IOS device using the built-in microphone. I want to process the sound in such a way that only frequencies in the 16-18 kHz range remain; the other frequencies should be eliminated. I read in some posting that I can use a band pass filter to get this result. Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="11407" LastEditorUserId="7338" LastEditDate="2014-10-15T23:28:29.470" LastActivityDate="2014-10-30T19:53:29.967" Title="A filter in IOS to eliminate a certain frequency range" Tags="|filters|autocorrelation|bandpass|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18690" PostTypeId="1" CreationDate="2014-10-15T19:27:54.397" Score="0" ViewCount="108" Body="&lt;p&gt;I'll start off by saying, yes this is a homework problem, and no I do not want the answer. I simply need to know where to start. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input to a system with a frequency response of $H(\omega)$ is $x(n)=A\sin(\omega_0 n+\theta)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the expression for the systems output, $y(n)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said, I just am unsure of where to start.&lt;/p&gt;&#xA;" OwnerUserId="11408" LastEditorUserId="4298" LastEditDate="2014-10-15T20:17:59.930" LastActivityDate="2015-04-14T19:55:00.403" Title="Frequency Response Output" Tags="|homework|frequency-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18691" PostTypeId="2" ParentId="18690" CreationDate="2014-10-15T20:33:27.000" Score="1" Body="&lt;p&gt;&lt;strong&gt;Hint:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess we may assume that the system is real-valued, i.e. its impulse response $h(n)$ is real-valued. This means that the response to the imaginary part of some complex input signal $\hat{x}(n)$ equals the imaginary part of the response to the complex signal $\hat{x}(n)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{T}\{\Im\{\hat{x}(n)\}\}=\Im\{\mathcal{T}\{\hat{x}(n)\}\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathcal{T}$ is the system operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that your input signal $x(n)$ is the imaginary part of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{x}(n)=Ae^{j(\omega_0n+\theta)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response is related to $h(n)$ by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=\sum_{n=-\infty}^{\infty}h(n)e^{-jn\omega}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output $y(n)$ is given by the following convolution sum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=\sum_{k=-\infty}^{\infty}h(k)x(n-k)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now use (3) with the complex input signal $\hat{x}(n)$ given by (1), make use of (2), and then take the imaginary part to obtain $y(n)$. The response of a system with frequency response $H(\omega)$ to a complex exponential $e^{j(\omega_0n+\theta)}$ is a fundamental result which you should remember.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-15T20:33:27.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18692" PostTypeId="2" ParentId="18686" CreationDate="2014-10-15T21:17:13.477" Score="1" Body="&lt;p&gt;Let's look at each of the systems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;This is generally not invertible, simply because you can't invert the cosine function unless you have some additional information about its argument. E.g., if you knew that $0\le x(t)\le \pi$ were satisfied for all $t$, then you could uniquely reconstruct $x(t)$ from $y(t)$, but otherwise you can't.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In this case you have a problem with $n=0$. For $n=0$ you have $y(0)=0$ regardless of the value of $x(n)$. So the system can't be inverted.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The output is simply $\ldots, x[-7], x[-3], x[1], x[5], \ldots$, so you only take one sample out of four and throw the others away. No way you can reconstruct these values from $y[n]$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Here Robert already gave you a good hint in his answer. You can also look at it directly in the time domain. Exchanging the roles of $x[n]$ and $y[n]$ you get&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=y[n-2]-2y[n-8]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rearranging gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n-2]=x[n]+2y[n-8]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or, equivalently,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n+2]+2y[n-6]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a recursive system which (theoretically) inverts the given system. However, as pointed out by Robert, in order to compute $y[n]$ you need the value of the input two samples further in the future, i.e. this system is not causal. In general you would like a system that is causal and stable, but in this case there is no such system which inverts the given system.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-15T21:17:13.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18693" PostTypeId="2" ParentId="18689" CreationDate="2014-10-15T21:46:13.727" Score="1" Body="&lt;p&gt;You can think of a discrete signal as an array of values, a filter as another array of values (not necessarily of the same size), and filtering as performing an operation called convolution on both the filter and input arrays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the filter array by using programs such as Matlab, scientific python or octave (the last two are free). You can implement the filtering operation by coding the convolution operation in your own program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware that convolution can be cpu-intensive. The 'better' the filter (or, the higher its order), the larger the filter array. A better filter rejects more of the signal outside the 16-18 kHz range, and distorts less the signal inside the range. However, having more elements, a convolution using it requires more operations (basically multiplications and additions). This may be a concern on a mobile device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/signal.html&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; for detailed descriptions (including source code) of scientific python commands that do what you need. Look in particular for &lt;code&gt;convolve&lt;/code&gt; and &lt;code&gt;firwin2&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2014-10-15T22:45:26.503" LastActivityDate="2014-10-15T22:45:26.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18695" PostTypeId="2" ParentId="7725" CreationDate="2014-10-16T11:45:43.940" Score="2" Body="&lt;p&gt;The reason cyclic prefix is used in OFDM systems is to avoid complex equalizers in receivers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cyclic prefix converts linear convolution of fading channel(&lt;code&gt;h&lt;/code&gt;) &amp;amp; Tx data(&lt;code&gt;x&lt;/code&gt;) into circular convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without cyclic prefix: symbol at receiver &lt;code&gt;y = h*x;&lt;/code&gt; &lt;code&gt;*&lt;/code&gt;- linear convolution &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://web.archive.org/web/20140805162711/http://www.technicaljar.com/?p=237&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is a useful link for your question.&lt;/p&gt;&#xA;" OwnerUserId="8933" LastEditorUserId="25707" LastEditDate="2017-03-25T04:55:08.687" LastActivityDate="2017-03-25T04:55:08.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18696" PostTypeId="2" ParentId="7725" CreationDate="2014-10-16T12:22:27.833" Score="0" Body="&lt;p&gt;Cyclic prefix provides a guard period in front of each OFDM symbol to guard against multi-path delay spread introduced by the channel, while Raised Cosine Filter is used in OFDM for pulse-shaping or smoothing the discontinuities between adjacent OFDM symbols or to reduce out-of-channel emissions in the frequency domain view. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ieee802.org/3/bn/public/jan13/montreuil_01a_0113.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ieee802.org/3/bn/public/jan13/montreuil_01a_0113.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The length of the cyclic is directly proportional to the delay spread. In LTE systems 'normal' and 'extended' cyclic prefix is used for low and high delay spread scenarios within a LTE cell.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.lte-bullets.com/LTE%20in%20Bullets%20-%20Cyclic%20Prefix.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.lte-bullets.com/LTE%20in%20Bullets%20-%20Cyclic%20Prefix.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2014-10-16T12:22:27.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18698" PostTypeId="2" ParentId="16016" CreationDate="2014-10-16T13:41:01.913" Score="-3" Body="&lt;p&gt;Use the convolution instead of the correlation, you will get the two peaks that correspond to the ML estimator of delay time.&lt;/p&gt;&#xA;" OwnerUserId="11416" LastEditorUserId="11416" LastEditDate="2014-10-17T10:04:20.337" LastActivityDate="2014-10-17T10:04:20.337" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18699" PostTypeId="1" CreationDate="2014-10-16T14:44:14.627" Score="0" ViewCount="2664" Body="&lt;p&gt;In my filter the fs=300MHz. and no. of coefficients is 31. I have following queries.&#xA;(1) what will be the number of multiplications per second?&#xA;(2) can multiplication be done in one clock cycle?&#xA;(3) why normally multiplication per second is calculated and not addition/substraction per second in the filter implementation? &lt;/p&gt;&#xA;" OwnerUserId="11235" LastActivityDate="2015-01-14T17:01:02.927" Title="multiplications per second for FIR filter" Tags="|filters|filter-design|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18700" PostTypeId="1" CreationDate="2014-10-16T14:47:10.467" Score="2" ViewCount="172" Body="&lt;p&gt;Now that we can operate in the frequency domain by way of FFT. We can implement ideal lowpass, highpass and bandpass digital filters. then why there many textbooks talk about designing digital Butterworth filter, digital Chebyshev filter etc, by the so called impluse invariance method, bilinear transform method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot warp my mind around this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="7285" LastActivityDate="2014-11-15T20:20:03.113" Title="Why bother impluse invariance, bilinear transform?" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18701" PostTypeId="1" AcceptedAnswerId="18703" CreationDate="2014-10-16T15:21:23.320" Score="7" ViewCount="10099" Body="&lt;p&gt;In my filter design, FIR gives order 14 and IIR gives order 8 or 4.&#xA;so what are the disadvantages of IIR design?&lt;/p&gt;&#xA;" OwnerUserId="11235" LastActivityDate="2014-10-16T15:33:15.700" Title="FIR vs IIR filter" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18702" PostTypeId="2" ParentId="18700" CreationDate="2014-10-16T15:26:00.613" Score="1" Body="&lt;p&gt;Simply put, the digital implementations of the IIR filters (bilinear) are much cheaper in terms of computation time and memory.  An FIR or FFT takes much longer to process than an IIR, and requires much more memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FIR requires you have a buffer of the length of the FIR, and another buffer to hold the FIR values.  For every sample, you must convolve these two buffers.  Since FIR filters are often very long (hundreds of taps) it can be difficult to get enough memory or processing power in a small embedded system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even in desktop systems where you have gigabytes of RAM and gighertz of processing speed you can run more filters using IIR than you can FIR filters.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a desktop PC, your main limit would be processing speed rather than memory.  In an embedded system, you often have limits on memory and processing speed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using an IIR implemtation let you get away with cheaper hardware or to get more out of the hardware you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An IIR filter can be implemented with a handful of multiply and add steps for each sample.  An FIR requires as many multiply and add steps as the length of the filter.  Using the FFT to implement the FIR will save you some computation, but it will still take much more processing and ram than the IIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing is that an IIR filter with a sharp cutoff isn't much more complicated than one with a shallower cutoff.  An FIR requires some minimum of taps to work at all (depending on sampling rate and cutoff frequency,) and making it sharp and clean requires a greate many more taps than that minimum.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-10-16T15:26:00.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18703" PostTypeId="2" ParentId="18701" CreationDate="2014-10-16T15:30:49.527" Score="7" Body="&lt;p&gt;Typically the advantages of an FIR filter are that it is easy to obtain a linear phase response, and numerical stability is not normally a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An IIR filter typically requires fewer taps (as you have observed), so is more efficient computationally, but the phase response tends to be somewhat erratic, and numerical stability is more likely to be an issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it really depends on whether phase response or compute bandwidth are more important to you, and whether you are using limited precision arithmetic (e.g. on a microcontroller) that might cause problems with an IIR filter.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2014-10-16T15:30:49.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18704" PostTypeId="2" ParentId="18701" CreationDate="2014-10-16T15:33:15.700" Score="2" Body="&lt;p&gt;Disadvantage of IIR:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Phase delay dependent on frequency&lt;/li&gt;&#xA;&lt;li&gt;Ripple in passband&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Advantages IIR:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Requires less RAM to execute&lt;/li&gt;&#xA;&lt;li&gt;Requires fewer multiply and add steps&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Advantages of FIR:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can specify passband and stop band ripple&lt;/li&gt;&#xA;&lt;li&gt;Can specify phase delay&lt;/li&gt;&#xA;&lt;li&gt;Constant delay possible (absolute time for signal to emerge from filter)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Disadvantages of FIR:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Requires more taps to reach the same performance as an IIR - means more computations per sample (more work for the processor)&lt;/li&gt;&#xA;&lt;li&gt;Requires more taps to reach the same performance as an IIR - means you need more memory to do the job.  Not so much a problem on a PC, more of a problem in smaller systems where memory is tight.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-10-16T15:33:15.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18705" PostTypeId="2" ParentId="18699" CreationDate="2014-10-16T15:34:26.777" Score="0" Body="&lt;p&gt;It really depends on what CPU you are using, but most modern CPUs (including DSPs) can do a fused multiply-add in one instruction, so you effectively get the addition for free. Operations such as an FIR filter typically require N multiplies and N adds, so this can be treated as N fused multiply-add instructions. If your CPU can issue one multiply-add per cycle then you would need N clock cycles per output point.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2014-10-16T15:34:26.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18706" PostTypeId="1" CreationDate="2014-10-16T15:39:36.270" Score="0" ViewCount="166" Body="&lt;p&gt;In reading a paper on demodulation there was this sentence:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Using complex-envelope notation, the noise corrupted waveform at the&#xA;  IF filter output can be written as...&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've not heard this term, what does the complex-envelope notation mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation below that statement is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z(t) =  \mathrm{Re} \left\{ \widetilde{z}(t)e^{j2\pi f_0t+\theta} \right\}$$&lt;/p&gt;&#xA;" OwnerUserId="11237" LastEditorUserId="8202" LastEditDate="2014-10-16T15:50:04.010" LastActivityDate="2014-10-16T15:50:04.010" Title="What is the complex-envelope notation?" Tags="|demodulation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18707" PostTypeId="2" ParentId="18699" CreationDate="2014-10-16T15:44:33.627" Score="2" Body="&lt;p&gt;To answer your questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The number of multiplies is the number of taps times the number of sample per second.  Given a sampling rate of 300MHz and 31 taps, you will have to do 9300 million multiplies per second.&lt;/li&gt;&#xA;&lt;li&gt;As Paul R says, whether a multiply can be done in one cycle depends on the processor.  Some can, some can't, and some appear to by having a long pipeline - once the pipeline fills, the result of one multiply comes out per cycle.  You would have to find out what processor you are using to determine how many cycles it takes for each multiply.  Also note, this varies also with the type of number you are working with.  Integer multiplication is usually faster, but can cause you other difficulties (it is harder to do signal processing with integers.)&lt;/li&gt;&#xA;&lt;li&gt;As Paul R says, really only the multiplies are of interest since most processors have a combined multiply and add instruction.  If you are working with a processor without that type of instruction, though, you will have to remember to count the adds when budgeting your clock cycles.  Since there are as many adds as multiplies when doing an FIR, knowing how many multiplies there are also tells you the number of adds.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-10-16T15:44:33.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18708" PostTypeId="2" ParentId="18605" CreationDate="2014-10-16T16:03:44.570" Score="0" Body="&lt;p&gt;Going by your last comment, I assume I've hit the task you were trying to accomplish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is pretty easy to do in software.&#xA;We'll call you input signal I and your output signal C&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;C starts out at value zero.&lt;/li&gt;&#xA;&lt;li&gt;Watch the values for I.  When I goes from negative to positive ( or crosses some other threshold going up) set C to 1&lt;/li&gt;&#xA;&lt;li&gt;Watch the values for I.  When I goes from negative to positive ( or crosses some other threshold going up) set C to 0&lt;/li&gt;&#xA;&lt;li&gt;Repeat steps 2 and 3.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For every sample of I, you get a C that is either 0 or 1.  You can send the C value to a DAC or process it further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will generate a square wave at half of the frequency of the signal from I.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an analog system &quot;sharpening the rising edge&quot; (see my earlier comment) would be accomplished by amplifying the signal.  Digitally, you can either set a fixed threshold and multiply the incoming values, or lower the threshhold.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The accuracy of the synchronization depends on the sharpness of the rising edge.  The sharper the better.  With a perfectly vertical edge, the generated clock will be one sample behind the real signal.  The slower the rising edge goes up, the more the generated C will lag.  At worst you will be 1/2 of a cyle behind, but that takes a really flat rising edge.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-10-16T16:18:43.183" LastActivityDate="2014-10-16T16:18:43.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18709" PostTypeId="2" ParentId="9768" CreationDate="2014-10-16T16:51:50.233" Score="1" Body="&lt;p&gt;If you are really interested in voice recognition. Check out Hidden markovs model. It is used by several softwares to recognize your words&lt;/p&gt;&#xA;" OwnerUserId="11303" LastActivityDate="2014-10-16T16:51:50.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18710" PostTypeId="1" CreationDate="2014-10-16T16:52:59.403" Score="5" ViewCount="2611" Body="&lt;p&gt;This is a general question on the laplacian operator, which has two different versions. The first version is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{matrix}&#xA;  0 &amp;amp; 1 &amp;amp; 0 \\&#xA;  1 &amp;amp; -4 &amp;amp; 1 \\&#xA;  0 &amp;amp; 1 &amp;amp; 0&#xA; \end{matrix}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second version includes the diagonal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{matrix}&#xA;  1 &amp;amp; 1 &amp;amp; 1 \\&#xA;  1 &amp;amp; -8 &amp;amp;1 \\&#xA;  1 &amp;amp; 1 &amp;amp; 1&#xA; \end{matrix}&#xA;Including the diagonal direction will make the laplacian isotropic. But what exactly is isotropic? How would that affect the resulting image if the diagonal components are included? What happen if I don't include the diagonal components?&lt;/p&gt;&#xA;" OwnerUserId="11260" LastEditorUserId="128" LastEditDate="2019-10-17T11:33:28.237" LastActivityDate="2021-01-31T16:20:18.963" Title="Laplacian Operator with and without Diagonal Direction Elements in the Kernel" Tags="|image-processing|edge-detection|2d|kernel|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="18711" PostTypeId="2" ParentId="18690" CreationDate="2014-10-16T17:13:11.243" Score="0" Body="&lt;p&gt;Let me make it easier for you to solve:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(n) = x(n) (convolution operator) h(n)----&gt; in Discrete domain[ as also wrote in equation 3 by Matt.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But usually we avoid convolution. So in Frequency domain it is just multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y(w) = X(w)*H(w)  ---&gt; in Freuquency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To convert from discrete(n- domaain) to freq(w- domain) we use Fourier transform and to get back inverse fourier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope now you will be easily able to do your homework now&lt;/p&gt;&#xA;" OwnerUserId="11303" LastActivityDate="2014-10-16T17:13:11.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18712" PostTypeId="1" AcceptedAnswerId="18714" CreationDate="2014-10-16T19:10:11.710" Score="0" ViewCount="515" Body="&lt;p&gt;I have a signal that I am filtering on an MCU (STM32F405) that I get from a codec (CS42L52).  It is being sampled at a sampling frequency of 48kHz (actually between 48400 and 48600).  I have a ping pong buffer setup with DMA and am using I2S to send the signal between the MCU and codec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seem to have a glitch somewhere when filtering.  It is somehow related to the buffer size, it happens at (buffer_size / 4) samples, but only when I am filtering.  Below is a picture of both channels of my output, the top signal is the left channel unfiltered and the bottom is the right channel filtered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sKgB5.png&quot; alt=&quot;filtered signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can switch the channel that is filtered and have the same results on the opposite channel.  It is a fixed point filter with coefficients in Q29 format and look like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;531850828 (b0), -952252845 (b1), 507513243 (b2), 952252845 (a1), -502493159 (a2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for a center frequency of 3150Hz, Q of 7.2, Gain of -3, and sampling frequency of 48kHz. My filter uses the equation &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am able to process all of the data in my buffer in less than 5ms depending on buffer size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the glitch appears at all frequencies, it tends to be most prominent around the frequency that I am filtering.  Does this mean my coefficients are somehow incorrect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what I am doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Edit:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I am using the CMSIS library from ARM to do my filtering. I have followed this &lt;a href=&quot;http://www.keil.com/pack/doc/CMSIS/DSP/html/arm_graphic_equalizer_example_q31_8c-example.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt; from the CMSIS documentation.  According to the documentation, I need to scale my coefficients to be between [-1, +1) which is why I use Q29 format, and then shift them by 2. There is a postshift parameter coded into the Q31 filter.&#xA;&lt;a href=&quot;http://pastebin.com/HfJxsEre&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is the CMSIS code for the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the codec I get 24-bits of data which I pass through the filter and then send back to the codec.  The accumulator is 64 bit and the code is in C.  I guess I have made an assumption that 24-bits is small enough to not have overflow from the filter, but I am new to signal processing.  How do I correct for overflow?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Edit 2&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have been playing with the coefficients and when I set the gain to 0, the signal comes out clean.  If I leave all the parameters except gain the same and change the gain (I tried +1.0 and -1.0), then I have distorted output.  This is making me think more and more that it is arithmetic overflow. I tried multiplying the input of the filter by 0.125 to scale it down by 1/8, but that did not seem to help. What is the proper way to deal with this?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Edit 3&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Using the code RBJ provided, I get the same sort of output as before. This time I have converted the input into floating point format and then back to q31 for output.  If I change the coefficients to have a 0 gain, I get a clean output, but as soon as I change the gain to anything but 0, it creates noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/39ZPo.png&quot; alt=&quot;https://i.stack.imgur.com/39ZPo.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my code, I am filtering one value at a time through filterBuffer.  When I receive the data from DMA, I have to rotate the data right by 16 places to correct&#xA;for the DMA's FIFO packing the data in the wrong order. For example, when the codec sends 24-bits 0xABCD EF00, the DMA will pack it as 0xEF00 ABCD. This is fixed by using the asm ror #16 instruction.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// f0 = 3150, Q = 4.3, Gain = 3.0, Fs = 48000&#xA;sectionData *coeffs = malloc(sizeof(sectionData));&#xA;coeffs-&amp;gt;filterCoefficients[0] = 1.0155644882603565; // b0&#xA;coeffs-&amp;gt;filterCoefficients[1] = -1.7632428285856931; // b1&#xA;coeffs-&amp;gt;filterCoefficients[2] = 0.90897819415372805; // b2&#xA;coeffs-&amp;gt;filterCoefficients[3] = 1.7632428285856931; // -a1&#xA;coeffs-&amp;gt;filterCoefficients[4] = -0.92454268241408455; // -a2&#xA;&#xA;static float32_t states[4] = {0.0,0.0,0.0,0.0}&#xA;&#xA;/* loop in main after receiving data in rxbuf */&#xA;for (i = 0; i &amp;lt; BUFFERSIZE; i++) {&#xA;    *ptrIn = *rxbuf++;&#xA;    asm(&quot;mov %[result], %[value], ror #16&quot; : [result] &quot;=r&quot; (*ptrIn) : [value] &quot;r&quot; (*ptrIn));&#xA;&#xA;    fIn = (float32_t) *ptrIn / 2147483648u;&#xA;    filterBuffer(1, 1, &amp;amp;fIn, &amp;amp;fOut, &amp;amp;states[0], &amp;amp;coeffs);&#xA;    filtered[i] = fOut * 2147483648u;&#xA;&#xA;    asm(&quot;mov %[result], %[value], ror #16&quot; : [result] &quot;=r&quot; (*filtered[i]) : [value] &quot;r&quot; (filtered[i]));&#xA;    asm(&quot;mov %[result], %[value], ror #16&quot; : [result] &quot;=r&quot; (*ptrIn) : [value] &quot;r&quot; (*ptrIn));&#xA;&#xA;    // separate left and right channel, only filter left channel.    &#xA;    if (i%2 == 0)&#xA;        *txbuf++ = (uint32_t)filtered[i];&#xA;    else&#xA;        *txbuf++ = *ptrIn++;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11127" LastEditorUserId="11127" LastEditDate="2014-10-17T22:50:23.200" LastActivityDate="2014-10-17T22:50:23.200" Title="Strange Results from Biquad Peaking EQ Filter" Tags="|filters|sampling|equalization|equalizer|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="18713" PostTypeId="1" CreationDate="2014-10-17T02:02:08.233" Score="1" ViewCount="470" Body="&lt;p&gt;I'm computing discrete short time Fourier transform. Data is split into overlapping chunks and gaussian window is used for each chunk. However, I'm not sure how much overlap there should be between chunks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they are too sparce I will loose information between them (gaussian window for each chunks is shown here):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Sf6OJ.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other side, pack them to densely and I will do a lot of redundant computations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jvtoe.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something in between is necessary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3nb8R.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what exactly should it be?&lt;/p&gt;&#xA;" OwnerUserId="11420" LastActivityDate="2022-07-13T09:01:05.150" Title="Spacing between gaussian windows for STFT" Tags="|fourier-transform|window-functions|gaussian|stft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18714" PostTypeId="2" ParentId="18712" CreationDate="2014-10-17T02:57:04.130" Score="0" Body="&lt;p&gt;Rick, just because i'm lazy, i don't wanna rewrite your code, but i'm pasting a snippet of old code of mine that does cascaded biquad filtering.  it's in single-precision float, but could be modified to be Q3.29 (or i would recommend Q4.28) with use of the &lt;code&gt;q64_t&lt;/code&gt; and &lt;code&gt;q32_t&lt;/code&gt; types and a little right shifting.  it swaps the nesting of the sections and the block of samples, it does the sections (or &quot;stages&quot;) on the inside loop and reuses those states as i have described.  but your nesting (with the section loop on the outside) might be better (faster).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;just an idea about how to structure the code.  otherwise, it's gonna be about how to do the fixed-point arithmetic, and i surely don't see why you're doing this bit-field manipulation.  just shift the 64-bit acc to the right by 28 or 29 bits (depending on your scaling factor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;typedef struct&#xA;    {&#xA;    float filterCoefficients[5];    /* b0, b1, b2, a1, a2   (a0 is normalized to 1) */&#xA;    } sectionData;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;int filterBuffer(long Nsamples, int Nsections, float *input, float *output, float *filterStates, sectionData **sections)   {&#xA;    register long n;&#xA;    register int i;&#xA;    register sectionData **section_ptr;&#xA;    register float sampleValue, state1, state2, *state_ptr, *coef_ptr;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (n=0; n&amp;lt;Nsamples; n++)&#xA;    {&#xA;    section_ptr = sections;                         /* reset section pointer */&#xA;    state_ptr = filterStates;                       /* reset state pointer */&#xA;&#xA;    sampleValue = input[n];                         /* get input sample */&#xA;&#xA;        state2 = *state_ptr++;                      /*   x[n-2]            */&#xA;        state1 = *state_ptr--;                      /*   x[n-1]            */&#xA;        *state_ptr++ = state1;                      /*   x[n-1] -&amp;gt; x[n-2]  */&#xA;        *state_ptr++ = sampleValue;                 /*   x[n]   -&amp;gt; x[n-1]  */&#xA;&#xA;    i = Nsections;&#xA;    while (--i &amp;gt;= 0)&#xA;        {&#xA;        coef_ptr = &amp;amp;((*section_ptr++)-&amp;gt;filterCoefficients[0]);  /* point to section filter coefficients */&#xA;&#xA;        sampleValue =  *coef_ptr++ * sampleValue;   /*   b0*x[n]           */&#xA;        sampleValue += *coef_ptr++ * state1;        /*   b1*x[n-1]         */&#xA;        sampleValue += *coef_ptr++ * state2;        /*   b2*x[n-2]         */&#xA;&#xA;        state2 = *state_ptr++;                      /*   y[n-2]            */&#xA;        state1 = *state_ptr--;                      /*   y[n-1]            */&#xA;        *state_ptr++ = state1;                      /*   y[n-1] -&amp;gt; y[n-2]  */&#xA;&#xA;        sampleValue += *coef_ptr++ * state1;        /*  -a1*y[n-1]         */&#xA;        sampleValue += *coef_ptr++ * state2;        /*  -a2*y[n-2]         */&#xA;&#xA;        *state_ptr++ = sampleValue;                 /*   y[n]   -&amp;gt; y[n-1]  */`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;/*&#xA; *     at this point sampleValue is the output of the section just completed &#xA; *     and will be the input to the section about to be computed unless this &#xA; *     is the last section, in which case sampleValue is the input.&#xA; *     state1 and state2 are the output states of the section just completed&#xA; *     and will be the input states of of the section about to be computed.&#xA; */&lt;/code&gt;&#xA;            }&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    output[n] = sampleValue;                        /* store output sample */&#xA;    }&#xA;&#xA;return 0;&#xA;}`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-10-17T02:57:04.130" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="18715" PostTypeId="1" AcceptedAnswerId="18718" CreationDate="2014-10-17T03:05:33.033" Score="1" ViewCount="329" Body="&lt;p&gt;I have computed 12d-MFCC features on 3 consecutive audio frames, say:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;For 1st frame: a1 a2 a3 ... a12&#xA;For 2nd frame: b1 b2 b3 ... b12&#xA;For 3rd frame: c1 c2 c3 ... c12&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to organize these MFCC features, in &lt;code&gt;a1 a2 ... a12 b1 b2 ... b12 c1 c2 ... c12&lt;/code&gt; or &lt;code&gt;a1 b1 c1 ... a12 b12 c12&lt;/code&gt;? Is there any difference between these two organization styles (for audio processing)?&lt;/p&gt;&#xA;" OwnerUserId="7611" LastActivityDate="2015-11-22T16:01:20.903" Title="How to organize MFCC features?" Tags="|audio|mfcc|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18716" PostTypeId="2" ParentId="18713" CreationDate="2014-10-17T03:44:30.250" Score="-1" Body="&lt;p&gt;usually the overlap has more clear meaning when used with a complementary window such as the Hann window.  a complementary window is such that the tails of all overlapping window functions add to 1.  $$ \sum\limits_{k=-\infty}^{+\infty} w(t-kT_{\text{hop}}) \ = \ 1$$  that cannot be the case for overlapping gaussian window functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if your STFT is just for &lt;strong&gt;analysis&lt;/strong&gt;, not synthesis or reconstruction, then complementary windows do not usually matter.  then the issue is more about frequency resolution (which determines how wide the window is) and the STFT frame hop distance.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-10-17T03:44:30.250" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18717" PostTypeId="2" ParentId="18715" CreationDate="2014-10-17T06:37:21.343" Score="0" Body="&lt;p&gt;If you interleave your data you will have hard time adding new entries. Otherwise it make no differences.&lt;/p&gt;&#xA;" OwnerUserId="9020" LastActivityDate="2014-10-17T06:37:21.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18718" PostTypeId="2" ParentId="18715" CreationDate="2014-10-17T07:42:13.557" Score="2" Body="&lt;p&gt;Natural order would be to save it on frame by frame basis - that's the way you calculate them, otherwise you would need some gymnastics to do so. What's more, each 12 coefficients will be one vector in your 12D space - frame after frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also it is easier to manage that in memory. In MATLAB like environments you simply use the matrices to store each vector in separate column. For C++, you can use array and array of pointers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float **frames;&#xA;float  *data;&#xA;frames = new float*[num_frames];&#xA;data   = new float*[12 * num_frames];&#xA;memset(..) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that you just set all &lt;code&gt;frames&lt;/code&gt; pointers to first coefficient in each frame and you have easy way to access your features by using &lt;code&gt;frames&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With interleaved features it wouldn't be so easy.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-10-17T07:42:13.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18720" PostTypeId="1" AcceptedAnswerId="18725" CreationDate="2014-10-17T08:49:33.470" Score="0" ViewCount="956" Body="&lt;p&gt;Currently I am trying to use MFCC feature for audio training in order to do human voice classification (can later distinguish the person who speaks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have problems to determine the proper time length of audio training samples? To be clear, say I have computed 12d-MFCC features over 20ms window (10ms overlapping), if the length of the audio training samples is 1s, this will result in a &lt;code&gt;12 x 100&lt;/code&gt; feature vector (as there are 100 frames during the 1s time given 10ms shifting time step). In practice, what's the proper time length of audio training samples? Of course, long time length will results in long MFCC feature vector.&lt;/p&gt;&#xA;" OwnerUserId="7611" LastActivityDate="2014-10-17T16:13:13.197" Title="Determine the time length of audio training samples?" Tags="|audio|mfcc|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18722" PostTypeId="1" CreationDate="2014-10-17T15:28:47.663" Score="1" ViewCount="708" Body="&lt;p&gt;I'm trying some wavelet analysis of EEG signals, using the phase lock measures&#xA;from &lt;a href=&quot;http://brainimaging.waisman.wisc.edu/~lutz/LeVanQuyen_et_all_JNM_2001.pdf&quot; rel=&quot;nofollow&quot;&gt;[1]&lt;/a&gt;, specifically the S-PLV measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to calculate that we perform a wavelet transform on the signals and&#xA;one of the parameters we have to set is the number of cycles for the wavelet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors suggest that the number of cycles is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$nco = 6 f σ$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f$ is the frequency at which we are creating the wavelet transform at&#xA;and $σ$ is proportional to the inverse of $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors mention that in most of their studies they used $nco$ between 3 and 8,&#xA;but I was wondering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there any benefit in varying the number of cycles for different frequencies?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case I am calculating the Wavelet transform for a number of bands ranging&#xA;from 1Hz to 100Hz, so setting the number to a constant seems like a bad idea&#xA;given the wide spectrum of frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] : &lt;a href=&quot;http://brainimaging.waisman.wisc.edu/~lutz/LeVanQuyen_et_all_JNM_2001.pdf&quot; rel=&quot;nofollow&quot;&gt;Comparison of Hilbert transform and wavelet methods for the analysis of neuronal synchrony&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11401" LastActivityDate="2015-07-30T10:37:46.700" Title="Selecting the number of cycles for wavelet transform" Tags="|frequency|wavelet|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18724" PostTypeId="2" ParentId="18720" CreationDate="2014-10-17T16:08:59.007" Score="1" Body="&lt;p&gt;I would think the time length isn't so much the question as having enough varied training samples to get a good model of the speaker's voice.  Rather than being concerned with the length of each sample, you should be concerned with getting samples of the person speaking various words with various typical intonations for that person.  The length of each training sample would be more a question of how much time it takes for your test person to speak each representative sample rather than being some arbitrary time length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps the most important question you should be asking is:&#xA;How many training samples (and vectors from them) will my model need to be representative?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer to this question will depend on the accuracy you need and the particulars of the method you will use to match new samples to the training samples.  Since you don't say which method of modeling you will use, there's no way any one with more knowledge of those methods could help you find the needed number of training samples.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.hpl.hp.com/techreports/2003/HPL-2003-8.pdf&quot; rel=&quot;nofollow&quot;&gt;This&lt;/a&gt; is a link to a similar project.  It deals with recognizing singing voices rather than speaking, so they use LPC rather than MFCC.  Still, some of the methods and considerations will be similar.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-10-17T16:08:59.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18725" PostTypeId="2" ParentId="18720" CreationDate="2014-10-17T16:13:13.197" Score="3" Body="&lt;p&gt;It's a very bad idea to stack together consecutive frames in a single vector. By doing so, you are training a classifier to recognize the exact same sound as the one in your training database, pronounced at the exact same speed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your application (which appears to be speaker identification), you should consider each individual frame as a training instance (aka &quot;bag-of-frames&quot; models). That is to say, each training sample will give many 12-dimension feature vectors.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-10-17T16:13:13.197" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18726" PostTypeId="1" CreationDate="2014-10-17T17:49:46.397" Score="1" ViewCount="389" Body="&lt;p&gt;I am looking a way to make outputs match. For len 160 wouldnt the error be significant? For 40 ?  I have included some sample output showing the error.&lt;br&gt;&#xA; &lt;strong&gt;Direct Form 2 Original&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void highpass(const short int *x, short int *y, int len, int filtID, long int *mem)&#xA;{&#xA;    int i;&#xA;&#xA;    const short int Pcoef[5][3] = { { 16384, -31313, 14991 }, { 16384, -31569, 15249 }, { 16384, -31677, 15328 }, { 16384, -32313, 15947 }, { 16384, -22446, 6537 } };&#xA;    const short int Zcoef[5][3] = { { 15672, -31344, 15672 }, { 15802, -31601, 15802 }, { 15847, -31694, 15847 }, { 16162, -32322, 16162 }, { 14418, -28836, 14418 } };&#xA;&#xA;    int j;&#xA;    const short int *den, *num;&#xA;    if (filtID &amp;gt; 4)&#xA;        filtID = 4;&#xA;&#xA;    den = Pcoef[filtID]; num = Zcoef[filtID];&#xA;    /*return;*/&#xA;    for (i = 0; i &amp;lt; len; i++)&#xA;    {&#xA;        short int yi;&#xA;&#xA;        long int vout = ADD32(MULT16_16(num[0], x[i]), mem[0]);&#xA;        yi = EXTRACT16(SATURATE(PSHR32(vout, 14), 32767));&#xA;        mem[0] = ADD32(MAC16_16(mem[1], num[1], x[i]),&#xA;            SHL32(MULT16_32_Q15(-den[1], vout), 1));&#xA;        mem[1] = ADD32(MULT16_16(num[2], x[i]), SHL32(MULT16_32_Q15(-den[2], vout), 1));&#xA;        y[i] = yi;&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Direct Form 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; void highpass24DF1(const short int *x, short int *y, int len, int filtID, long int *mem)&#xA;        {&#xA;            int i;&#xA;&#xA;            const short int Pcoef[5][3] = { { 16384, -31313, 14991 }, { 16384, -31569, 15249 }, { 16384, -31677, 15328 }, { 16384, -32313, 15947 }, { 16384, -22446, 6537 } };&#xA;            const short int Zcoef[5][3] = { { 15672, -31344, 15672 }, { 15802, -31601, 15802 }, { 15847, -31694, 15847 }, { 16162, -32322, 16162 }, { 14418, -28836, 14418 } };&#xA;&#xA;            int j;&#xA;            const short int *den, *num;&#xA;            if (filtID &amp;gt; 4)&#xA;                filtID = 4;&#xA;&#xA;            den = Pcoef[filtID]; num = Zcoef[filtID];&#xA;&#xA;            long yi1 = 0;&#xA;            long yi2 = 0;&#xA;            long yi = 0;&#xA;&#xA;            long mx1 = 0;&#xA;            long mx2 = 0;&#xA;&#xA;&#xA;            for (i = 0; i &amp;lt; len; i++)&#xA;            {&#xA;&#xA;                yi&#xA;&#xA;     += num[0] * x[i] + num[1] * mx1 + num[2] * mx2;&#xA;            yi -= den[1] * yi1 + den[2] * yi2;&#xA;&#xA;            yi = PSHR32(yi, 14);&#xA;&#xA;            y[i] = EXTRACT16(SATURATE(yi, 32767));&#xA;&#xA;            yi2 = yi1;&#xA;            yi1 = yi;&#xA;            mx2 = mx1;&#xA;            mx1 = x[i];&#xA;            yi = 0;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Input&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;short int entrada[10] = { 32494, 32494, 32494, -32494, -32494, 32494, 32494, -32494, 32494, 32494 };&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YImgF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="714" LastActivityDate="2014-10-17T17:49:46.397" Title="Direct Form I Filter from Direct Form II" Tags="|filters|c|" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18728" PostTypeId="1" CreationDate="2014-10-17T21:18:49.857" Score="0" ViewCount="305" Body="&lt;p&gt;I'm implementing an Speech Recognition System over a &lt;strong&gt;Cortex-M4&lt;/strong&gt; processor (STM32F4-Discovery) and I'm facing a problem when a compute the RIFFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that I'm passing to the function the vector in the right form, but when I compare the output to the one obtain by MATLAB, it's quite different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried to perform an FFT and right after that computing the IFFT, but it gives me a totally different signal as the one I gave it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what I'm doing wrong, can anyone help me on this?&lt;/p&gt;&#xA;" OwnerUserId="11428" LastActivityDate="2014-10-17T21:18:49.857" Title="Problem executing RIFFT in Cortex-M4" Tags="|speech-recognition|ifft|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18729" PostTypeId="1" AcceptedAnswerId="18732" CreationDate="2014-10-17T22:14:50.890" Score="0" ViewCount="1274" Body="&lt;p&gt;Given the input to the IIR filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n]=\delta [n]+0.25\delta[n-2205], \quad \text{where}\quad \delta[n]= \begin{cases}1, &amp;amp;n=0\\0, &amp;amp; n\neq 0\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is to design an IIR-filter that cancels the &quot;echo&quot;, such that I'm only left with the $\delta[n]$. To do so I of course make an IIR-filter, where you take the $\mathcal Z$-transform of the impulse response, and cascade it with the inverted &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathcal Z$-transform of the input: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(z)=1+0.25z^{-2205}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transfer function of the IIR filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z)=\frac{1}{1+0.25z^{-2205}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then our output naturally is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;Y(z)&amp;amp;=\left(1+0.25z^{-2205}\right)\cdot\frac{1}{1+0.25z^{-2205}}\\&#xA;&amp;amp; = 1\\&#xA;\Rightarrow y[n]&amp;amp;=\delta [n]&#xA;\end{align} &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the transfer function of my filter is $H(z)$. What I want to do is to find the difference equation for my filter, and possibly find the mathematical form of the impulse response. Since the order is so high I'm having difficulties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure the difference equation will not be infinite, while the impulse response will... why??&lt;/p&gt;&#xA;" OwnerUserId="11429" LastEditorUserId="19249" LastEditDate="2016-05-18T14:45:49.960" LastActivityDate="2016-05-18T14:45:49.960" Title="Difference equation and Impulse response of an IIR filter - deconvolution" Tags="|infinite-impulse-response|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18730" PostTypeId="1" AcceptedAnswerId="18731" CreationDate="2014-10-18T04:06:19.333" Score="0" ViewCount="1845" Body="&lt;p&gt;What is the important advantage of adopting a wavelet based denosing scheme such as SURE, SUREshrink, etc. than using approaches involving low pass, high pass, band pass, band reject filter for signal denosing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, what is the advantage of using wavelet denosing on EEG signals than other methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2014-10-18T09:18:48.327" Title="Why use Wavelet Denosing instead of Band pass Filtering" Tags="|noise|wavelet|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18731" PostTypeId="2" ParentId="18730" CreationDate="2014-10-18T09:18:48.327" Score="2" Body="&lt;p&gt;If you use frequency selective filters for denoising you implicitly assume that the desired signal and the noise occupy different frequency bands. You only remove noise in frequency regions where there is no desired signal, whereas in the passbands of the filter the noise is left unchanged. For some applications the assumption that noise and signal occupy different frequency regions is justified, for some it isn't. Wavelet based denoising methods compose a noisy signal into different scales and attempt to remove the noise while preserving the signal, regardless of the frequency content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice you have to look very carefully at the characteristics of the noise. It is always advisable to apply a frequency selective filter to suppress all out-of-band noise. For narrow band noise sources a notch filter is often sufficient. In cases where you can get a reference signal of the noise (i.e. an independent recording of the actual noise source) the best strategy is using an adaptive noise cancellation algorithm. Only if these more basic methods do not lead to a satisfactory result, and if signal and noise largely overlap in frequency and time, you should look into more sophisticated methods such as wavelet denoising, or blind source separation, which is discussed in the context of your application &lt;a href=&quot;http://www.dtic.mil/dtic/tr/fulltext/u2/a455940.pdf&quot; rel=&quot;nofollow&quot;&gt;in this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-18T09:18:48.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18732" PostTypeId="2" ParentId="18729" CreationDate="2014-10-18T09:34:39.503" Score="3" Body="&lt;p&gt;So your transfer function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{1+az^{-L}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $a=0.25$ and $L=2205$. If $Y(z)$ and $X(z)$ are the $\mathcal{Z}$-transforms of the output and input signal of the filter, respectively, then you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=H(z)X(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, using (1), is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)(1+az^{-L})=X(z)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transforming (2) back to the time domain results in the difference equation of the recursive filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]+ay[n-L]=x[n]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the corresponding impulse response either from the inverse $\mathcal{Z}$-transform of (1), or from setting $x[n]=\delta[n]$ in (3) and observing what happens to the output. In either case, the result should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=\begin{cases}(-a)^{n/L},&amp;amp;&amp;amp; n=0,L,2L,3L,\ldots\\&#xA;0,&amp;amp;&amp;amp; \text{otherwise}\end{cases}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-10-19T08:23:30.533" LastActivityDate="2014-10-19T08:23:30.533" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18733" PostTypeId="2" ParentId="18652" CreationDate="2014-10-18T15:24:11.257" Score="-1" Body="&lt;p&gt;It is not flipped. It is indicating a cardiac malfunction - deep Q wave...&lt;/p&gt;&#xA;" OwnerUserId="3344" LastEditorUserId="8202" LastEditDate="2014-10-18T15:44:45.017" LastActivityDate="2014-10-18T15:44:45.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18734" PostTypeId="1" CreationDate="2014-10-18T16:51:10.840" Score="0" ViewCount="652" Body="&lt;p&gt;I have amplitude modulated sound file signal and after demodulation using FFT I got fundamental frequency and its harmonics and of course noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to remove that fundamental modulation frequency and its harmonics from spectrum using Matlab… any suggestion… m-file…?&lt;/p&gt;&#xA;" OwnerUserId="11432" LastActivityDate="2014-10-18T16:51:10.840" Title="How to remove modulation frequency and its harmonics" Tags="|matlab|filters|frequency-spectrum|" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18735" PostTypeId="1" AcceptedAnswerId="18736" CreationDate="2014-10-18T17:01:54.110" Score="1" ViewCount="896" Body="&lt;p&gt;What is maximum data rate a wireless link can support using BPSK for &lt;code&gt;10^-6&lt;/code&gt; BER, Bandwidth of channel is &lt;code&gt;200 kHz&lt;/code&gt; and SNR &lt;code&gt;21.335dB&lt;/code&gt; ?&#xA;As per my understanding , &lt;code&gt;Eb/No&lt;/code&gt; can be calculated for BPSK for given BER using curves and value found is &lt;code&gt;11.29dB&lt;/code&gt;, and after that we can use relation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Eb/No = S/N * W/R&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;R&lt;/code&gt; comes out to be around &lt;code&gt;2 Mbps&lt;/code&gt;! Is it correct? Need your input!&lt;/p&gt;&#xA;" OwnerUserId="11434" LastEditorUserId="11256" LastEditDate="2014-10-18T23:13:28.030" LastActivityDate="2014-10-20T03:36:08.820" Title="What is the maximum data rate a wireless link can support using BPSK for given BER and SNR?" Tags="|digital-communications|bpsk|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18736" PostTypeId="2" ParentId="18735" CreationDate="2014-10-18T17:35:41.603" Score="2" Body="&lt;p&gt;In BPSK, BER is equal to $Q(\sqrt{2E_b/N_0})$, so you need $E_b/N_0&amp;gt;11.3$ to have a BER no larger than $10^{-6}$. Since the bandwidth is 200 kHz, the maximum rate is 400 kb/s. So, since $SNR\approx136$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{Eb}{N_0}=\frac{S}{N}\frac{W}{R}=136\frac{200\cdot10^3}{400\cdot10^3}=\frac{136}{2}=68$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $68&amp;gt;11.3$, you can be sure that you can transmit at 400 kb/s and meet your BER requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I'm assuming baseband transmission (so that the bit rate is twice the bandwidth). Note also that the question, as posed, does not make a lot of sense, since the bandwidth will essentially determine your bit rate.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2014-10-18T19:13:08.830" LastActivityDate="2014-10-18T19:13:08.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18737" PostTypeId="1" AcceptedAnswerId="18739" CreationDate="2014-10-18T20:15:05.557" Score="0" ViewCount="2439" Body="&lt;p&gt;Let's say that I have a sampled signal x[n], it is being, in this exact order, up sampled by 2, down sampled by4, up sampled by 4 and down sampled by 2 to produce y[n].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that it should be pretty self evident that since we up sampled the signal by 2 and down sampled it by 2, then up sampled it by 4 and down sampled by 4, I should just get the original x[n] back. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the real question is, can the various up/down sampling pieces be readily swapped?&lt;/p&gt;&#xA;" OwnerUserId="11151" LastActivityDate="2014-10-22T15:33:27.183" Title="up sample and down sample" Tags="|sampling|downsampling|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18738" PostTypeId="2" ParentId="18737" CreationDate="2014-10-18T21:03:15.297" Score="0" Body="&lt;p&gt;The downsampling by a factor of 4 can introduce aliasing (because you upsampled only by a factor 2 in the first stage). If this is the case, it cannot be undone by the following upsampling operation. So in general this system will not produce at its output the original input signal $x[n]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-18T21:03:15.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18739" PostTypeId="2" ParentId="18737" CreationDate="2014-10-18T22:19:16.607" Score="0" Body="&lt;p&gt;To make Matt L.'s answer more precise: whenever a downsampling operation results in a sampling frequency that is less than twice the maximum frequency in your signal, you'll end up losing some of the signal's energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the downsampling implementations I've seen, the signal is low-pass filtered prior to downsampling, so no actual aliasing occurs.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-18T22:19:16.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18740" PostTypeId="1" AcceptedAnswerId="18746" CreationDate="2014-10-19T09:01:29.480" Score="1" ViewCount="4356" Body="&lt;p&gt;I thought this was supposed to be an obvious question, until I finally set up my real time system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically I have a transmitter that sends 128 samples/second to a receiver. The transmitted information is stored as an object in MATLAB and continuously updated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When people talk about real time signal processing, I'm really confused as to what they mean by real time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say I want to extract the &quot;mean&quot; feature of this signal. Do I compute the mean when I receive one sample, two samples, all 128 samples, or ...what is this mean value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More intriguing for me is the prospect of doing real time wavelet transform for joint time frequency analysis. Again, the question of &quot;real time&quot; comes up. How many samples do I need to reliable compute the wavelet (or fourier) coefficients so I could get a good view of the energy contained in this signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone who is knowledgeable on this topic please elaborate how when and under what condition do you compute &quot;features&quot; or perform frequency domain analysis for a real time system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="10425" LastEditorUserId="10425" LastEditDate="2014-10-19T18:58:31.640" LastActivityDate="2014-10-19T19:00:49.900" Title="What does &quot;real time&quot; signal processing mean?" Tags="|wavelet|real-time|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18742" PostTypeId="1" AcceptedAnswerId="19689" CreationDate="2014-10-19T12:54:31.303" Score="3" ViewCount="759" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YAmve.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;textbook&quot; OFDM block diagram is as the below figure. But I wonder if it satisfies the sampling theorem. Here, we have N points $X[k]$ before IFFT, and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1} X[k] \mathrm{e}^{\displaystyle -j\frac{2\pi k n}{N}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This derives from the analog signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{k=0}^{N-1}\mathrm{e}^{\displaystyle -j 2\pi f_k t}=\sum_{k=0}^{N-1}\mathrm{e}^{\displaystyle -j 2\pi k\Delta f t} $$, where $\Delta f$ is the subcarrier space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then sample this signal with a  sampling frequency $f_s&amp;gt;2f_{max}=2(N-1)\Delta f$, which can be taken as $f_s=2N\Delta f$. The time domain sample points are at&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$nt_s=n/f_s=\frac{n}{2N\Delta f}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we define &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(nt_s):=x[n]=\sum_{k=0}^{N-1}\mathrm{e}^{\displaystyle -j \frac{2\pi k n}{2N}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then we define a expanded &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{x}[n]:=\begin{cases}&#xA;x[n], 0\le n\le N-1\\&#xA;0, 2N-1\ge n\ge N\\\end{cases}$$&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means we should do a length $2N$ IFFT rather than a length $N$ IFFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\tilde{x}[n]=\sum_{k=0}^{2N-1}\mathrm{e}^{\displaystyle -j \frac{2\pi k n}{2N}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the textbook wrong?&lt;/p&gt;&#xA;" OwnerUserId="7285" LastEditorUserId="4346" LastEditDate="2014-12-19T23:30:25.413" LastActivityDate="2019-09-20T05:16:04.043" Title="OFDM violates sampling theorem" Tags="|digital-communications|modulation|demodulation|ofdm|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18743" PostTypeId="2" ParentId="18742" CreationDate="2014-10-19T14:16:36.757" Score="0" Body="&lt;p&gt;No, you just made some random stuff up - you're not doing sampling, you're modulating things onto a carrier, so the sampling theorem is irrelevant. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-10-19T14:16:36.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18744" PostTypeId="1" CreationDate="2014-10-19T14:34:00.760" Score="1" ViewCount="206" Body="&lt;p&gt;I want to compute the autocorrelation matrix by using the covarience method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;X(n) is the harmonic process $X(n) = \sum\limits_{i=1}^3  A_i e^{jn\omega_i} + V(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$V(n)$ is unit variance noise.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ |A_i| = 2$ for $n = 1,2,3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phases of $A_i$ are uncorrelated random variables that are uniformly distributed between $–π$ and $π$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what I understand:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$R_{x(n)} = E[x_{n}\cdot x_{n}^H]$&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I should use a levinson or schur algorithm&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I need to compute random samples of the random process ( $randn(100,1$) )&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;I should use a for loop to compute the sum&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I don't understand:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;why is the auto correlation matrix a 7 x 7 matrix?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;how do I compute the auto correlation matrix&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11415" LastActivityDate="2014-10-19T14:34:00.760" Title="Construct a correlation matrix using the covariance method" Tags="|autocorrelation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18746" PostTypeId="2" ParentId="18740" CreationDate="2014-10-19T16:51:05.453" Score="3" Body="&lt;p&gt;'Real time' is a concept from computer engineering. A real time system is one that is guaranteed, by design, to execute a function or routine in a certain time T, or less. For example, a real-time avionics system is proven to react to signals coming from certain instruments in a time below a given threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, a more precise description (IMHO) of what you want is a &quot;streaming system&quot;. You want a receiver that can process a stream of incoming samples without &quot;dropping&quot; samples; in other words, without its buffer overflowing. The easiest way to achieve that is to provide large enough computing power that the probability of dropping samples is very small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This property is largely orthogonal to the problem of estimating signal features. Since the incoming signal is random, its features are going to vary. You may need to calculate, or find by experiment, how many samples do you need to process to have a useful feature estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, these days most, if not all, transmitted signals have no DC component, so the mean will be close to zero all the time (barring imperfections in your analog front-end). I wouldn't worry about updating the mean estimate very often.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In modulation recognition, in contrast, you may need a few thousand samples, and the processing could take some time. You may decide to do something like gathering 5,000 samples (which in your case would take ~40 seconds), and you may take five second to process them, so you'll be updating that estimate every 45 seconds or so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you see, it really varies by estimate, and you'll need to figure out the best number in each case, given your requirements and your processing resources.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2014-10-19T19:00:49.900" LastActivityDate="2014-10-19T19:00:49.900" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18748" PostTypeId="2" ParentId="18735" CreationDate="2014-10-20T03:36:08.820" Score="0" Body="&lt;p&gt;I finally got the answer.The design here is over specified. The point is we cannot specify all of these things: modulation, BER, SNR, and bandwidth.  Or else, it will cause a conflict. For example, if we don't specify BPSK, the resulting computation for finding the maximum data rate will be straightforward, and will also require higher-order signaling.  If we leave-out any one of the four items specified as fixed, we wll find what we desire without any conflict.&lt;/p&gt;&#xA;" OwnerUserId="11434" LastActivityDate="2014-10-20T03:36:08.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18752" PostTypeId="1" CreationDate="2014-10-20T10:29:46.107" Score="3" ViewCount="1849" Body="&lt;p&gt;I have data in which the signal we want is a few gaussian peaks superposed on a noisy background in which some of the 'noise' is periodic.  Simply suppressing the associated fourier modes is effective (e.g., a 'notch filter') but also suppresses the signal, since it has some power associated with those frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is a good approach for removing these periodic signals without removing the corresponding signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This figure shows the data (top; with X-axis labeled by pixel #) and the absolute value of its fourier transform (bottom; X-axis is pixel frequency) with relevant regions identified.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/J2xBi.png&quot; alt=&quot;Spectrum (top) and power spectrum (bottom)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An approach I've considered is least-squares fitting a series of sine functions with frequencies limited to the identified range and the signal-containing region masked out, but this is computationally expensive and it is difficult to automatically identify the affected frequency range.&lt;/p&gt;&#xA;" OwnerUserId="1402" LastActivityDate="2022-11-16T15:29:25.757" Title="Separating 'signal' from periodic 'noise'" Tags="|signal-analysis|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18753" PostTypeId="2" ParentId="18113" CreationDate="2014-10-20T12:34:19.230" Score="2" Body="&lt;p&gt;I didn't verify each exact step of your analysis, but it seems that you're overestimating the memory part by a huge margin. A lot of the kernels are identical except for the exact tiem moemnt at which they're applied. In fact, you only have one kernel per level. So for a typical music application you have only 12 levels per octave, and thus 12 kernels. Over a 10 octave range (20 Hz-20 kHz) that's still only 240 levels. The paper you reference uses quarter-tone resolution (24/octave) and 5 octaves. That's just a design choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, you state that &quot;With their implementation, they store the kernels in full size&quot;. I doubt it. The paper explicitly mentions the effect of trimming the kernels (see Figure 3) and states that the kernels are trimmed to 6 values max (and sometimes just 1 !). This saves both memory and time. The exact amount does depend on the trimming applied.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-10-20T12:34:19.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18754" PostTypeId="2" ParentId="18737" CreationDate="2014-10-20T12:51:59.150" Score="0" Body="&lt;p&gt;And to add a bit more information: if the up/down sampling factors are relative prime they can be &quot;interchanged&quot; (or at least all the filtering happening at the sample rate resulting from downsampling first). But then, you will not get the original signal back (since they will be at different sample rates).&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2014-10-20T12:51:59.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18755" PostTypeId="2" ParentId="18607" CreationDate="2014-10-20T14:10:17.033" Score="1" Body="&lt;p&gt;In the case of video, the best approach to use is the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/30822-lucas-kanade-tracker-with-pyramid-and-iteration/content//LK%20Tracker/corner_ST.m&quot; rel=&quot;nofollow&quot;&gt;ShiTomasi&lt;/a&gt; Corner Detector. (&lt;code&gt;detectMinEigenFeatures&lt;/code&gt;). Now, if you want to detect corners that contains some invariant featrues, you should use &lt;code&gt;SURF&lt;/code&gt;, &lt;code&gt;BRISK&lt;/code&gt;, &lt;code&gt;ORG&lt;/code&gt;, &lt;code&gt;AKAZE&lt;/code&gt;, &lt;code&gt;FREAK&lt;/code&gt;, etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = rgb2gray(imread('image.jpg'));&#xA;[r c] = corner_ST(im,20);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5668" LastEditorUserId="7092" LastEditDate="2014-10-20T15:11:05.193" LastActivityDate="2014-10-20T15:11:05.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18756" PostTypeId="2" ParentId="18752" CreationDate="2014-10-20T14:26:04.260" Score="1" Body="&lt;p&gt;If you just need to detect when a gaussian peak occurs, you could try this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the scipy hilbert function to determine the amplitude of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pass the result through a high pass to remove the DC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pass the result through a low pass to remove high frequency noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use a threshhold function to detect peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will tell you when a peak occurred, and should be good at rejecting constant frequency and amplitude signals, as well as rejecting white noise of more or less constant amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It won't necessarily give you the shape of the peak. The peak you will see in a plot of the result (before the threshholding) may well resemble the original peak, but it won't be a perfectly accurate representation of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The values of the high pass and low pass filters can be juggled to get rid of noise, and to provide an appropriate pass band for the signal you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-10-20T14:26:04.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18757" PostTypeId="2" ParentId="6346" CreationDate="2014-10-20T14:32:43.983" Score="0" Body="&lt;p&gt;If the filter is linear, then you could use the 2D deconvolution method discussed &lt;a href=&quot;https://dsp.stackexchange.com/questions/18654/2d-deconvolution-of-recorded-electron-beam-data/18660&quot;&gt;here&lt;/a&gt;&#xA;The problem is the same, and has the same original conditions:  The result of a convolution, and one of the images that was used in the convolution.&lt;br&gt;&#xA;You have the original image and the result of convolving it with a filter, so deconvolution should give you back the filter kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the filter isn't linear, then I don't think there's any simple and direct way to reconstruct it.  I think you would have to feed it various images and run deconvolutions on those results to try to zero in on what the filter does in which conditions - messy, manual, error prone.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-10-20T14:32:43.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18759" PostTypeId="1" CreationDate="2014-10-20T19:54:35.173" Score="2" ViewCount="275" Body="&lt;p&gt;I'm a beginner with absolutely no experience in signal processing, but it has been a long-term goal of mine to do something that mixes music (a hobby of mine) and computer science (my &quot;expertise&quot;).  I've been thinking of doing a project that involves learning notes from music, but I don't know where to begin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For one, there doesn't seem to be a name for this problem. However, it doesn't seem to be a solved problem.  I've searched terms including &quot;Audio recognition,&quot; &quot;note recognition,&quot; &quot;chord recognition,&quot; but I've only come up with this paper: &quot;Automatic Chord Recognition from Audio Using an HMM with Supervised Learning&quot; by Lee and stanley.  It seems to have some good references to processing and even a pointer to a dataset I could potentially use, but one paper doesn't seem to be enough for a good understanding.  Alternatively, I could skip the processing part entirely but I can't find data sets using terms like &quot;audio signal data set&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal processing seems to be a pretty broad field. To save time, I want to pick up a book more oriented towards my project.  Are there any books like this?  I've found this:&#xA;&lt;a href=&quot;http://www.dspguide.com/ch1/3.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch1/3.htm&lt;/a&gt; but I want to know if this is relevant before I jump into this 34 chapter book.  Are they any other search terms I can use such as &quot;audio feature extraction&quot; to get me closer to the ML part of the problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, to cut down on work, I want to use libraries for the signal processing part.  One library I found for Python is Pyo but are they any other alternatives for Python that people have used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I'm a little overwhelmed by how much I don't know and I would greatly appreciate a pointer in the right direction.  Even google search words would help.&lt;/p&gt;&#xA;" OwnerUserId="11449" LastActivityDate="2018-10-14T13:51:09.060" Title="Audio Recognition and Learning" Tags="|audio|signal-analysis|machine-learning|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18760" PostTypeId="1" CreationDate="2014-10-20T20:36:45.597" Score="0" ViewCount="294" Body="&lt;p&gt;I am using the exponential moving average filter (IIR): &#xA;$$y(n)=\alpha{}\cdot{}x(n)+(1-\alpha{})y(n-1)$$&#xA;in a foward-backward filtering scheme, in order to eliminate completely any phase response phenomena. But I do not know how to eliminate the startup transients, ie. the transients from the initial state of the filter before and after the duration of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help me please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have in mind the Gustafsson's paper, but I found it a bit messy...&lt;/p&gt;&#xA;" OwnerUserId="11450" LastActivityDate="2014-10-20T20:36:45.597" Title="Transient cancellation in non causal filtering" Tags="|filters|infinite-impulse-response|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18765" PostTypeId="1" CreationDate="2014-10-21T08:15:02.210" Score="1" ViewCount="468" Body="&lt;p&gt;We are looking for writing applications which would recognize Bird calls and Frog calls using Sound processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: I want to identify the species of bird / frog and do not want to differentiate whether the call is from a bird or a frog. There are about 1300+ bird species in India and about 300+ frog species which we are looking to identify based on the call.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a background of iOS application development and C / C++ programming but have never worked on Digital Signal Processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do have few researchers who would collect multiple calls of birds and frogs and categorize it as per species. These calls can be used as reference purpose (?) to identify the bird or frog species by recording the call and comparing this call in user's device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know the technical feasibility of it, but I would like to know:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are there any open source solutions which can be extended / used to achieve this?&lt;/li&gt;&#xA;&lt;li&gt;Is this really possible to achieve with some 80% to 90% accuracy?&lt;/li&gt;&#xA;&lt;li&gt;If open source solution does not exist, how to go ahead with the implementation?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I understand that the scope of this question is too broad and wide which should be ideally avoided in StackExchange. But would like to have your opinion.&lt;/p&gt;&#xA;" OwnerUserId="11456" LastEditorUserId="13320" LastEditDate="2016-11-21T13:16:42.310" LastActivityDate="2016-11-21T13:16:42.310" Title="Call recognition using Digital Signal Processing" Tags="|signal-analysis|speech-recognition|speech-processing|" AnswerCount="6" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="18766" PostTypeId="1" AcceptedAnswerId="18777" CreationDate="2014-10-21T10:55:29.630" Score="1" ViewCount="992" Body="&lt;p&gt;The continuous time Hilbert transform is&#xA;$$\hat x(t) := x(t) + j\left( p.v. \left\{\frac{1}{t\pi} \ast x \right\} (t)\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&#xA;$$ \theta(t) = \tan^{-1}\left( \frac{ p.v.  \left\{\frac{1}{t\pi} \ast x \right\} (t)}{x(t)} \right)$$&#xA;and&#xA;$$&#xA;         \omega(t) = \theta'(t) &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and since $\theta(t)$ is smooth, you can actually calculate the instantaneous frequency. But in the discrete time domain, the angle function is discrete, so given that in the dt domain, your hilbert transform filter is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h_{HT}[n] = \left\{&#xA;						\begin{array}{ll}&#xA;							\frac{1}{n\pi}  &amp;amp; \mbox{if}\ \  n \neq 0 \\&#xA;							 0               &amp;amp; \mbox{otherwise} \\&#xA;						\end{array}&#xA;					\right.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you get the approximate frequency? or are you really just getting $\Delta\theta[n]$? Sorry if this is me just getting hung up on something trivial, but most references don't seem to clearly address this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\theta[n] = \tan^{-1}\left(\frac{(h_{HT} \ast x)[n]}{x[n]}\right)$$&#xA;$$\omega[n] = \left\{&#xA;							\begin{array}{ll}&#xA;								\theta[n] \ast \frac{1}{T_s}(\delta[n] - \delta[n-1])  &amp;amp; ? \\&#xA;								\theta[n] \ast \frac{1}{2T_s}(\delta[n+1] - \delta[n-1])  &amp;amp; ? \\&#xA;								???&#xA;							\end{array}&#xA;						\right.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for what is typically done. The &quot;Standard&quot; approach.&lt;/p&gt;&#xA;" OwnerUserId="8982" LastEditorUserId="8202" LastEditDate="2014-10-21T11:14:38.007" LastActivityDate="2014-10-22T08:35:08.240" Title="How to extract IF (instantaneous frequency) from Discrete Hilbert Transform?" Tags="|filters|discrete-signals|transform|hilbert-transform|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="18767" PostTypeId="1" CreationDate="2014-10-21T13:05:21.573" Score="2" ViewCount="632" Body="&lt;p&gt;I am working on an application to classify Talas(a piece of music with onsets). For that, I have the spectrogram of a Tala, which I want to compare with the test Tala, or compare 2 Talas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this I intend to find the onsets in the spectrogram and then form a classifier based on the frequencies that I get at the onset points in the Tala.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now as we already know that a spectrogram contains multiple frequencies for a time &lt;code&gt;t&lt;/code&gt; , I wish to quantify this as a single value to be used in machine learning, so that I have &lt;code&gt;n&lt;/code&gt; values for the &lt;code&gt;n&lt;/code&gt; onsets(say), and not multiple frequency values for the same time &lt;code&gt;t&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is my question - Given all the frequencies at time &lt;code&gt;t&lt;/code&gt;, how can I get a value that represents all these frequencies(like mean, median, etc). What should be the measure I should go ahead with?&lt;/p&gt;&#xA;" OwnerUserId="11459" LastEditorUserId="7092" LastEditDate="2014-10-21T13:30:31.370" LastActivityDate="2022-05-03T12:06:00.633" Title="Choosing the best measure for machine learning on a Spectrogram" Tags="|matlab|audio|frequency-spectrum|spectrogram|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18769" PostTypeId="2" ParentId="18767" CreationDate="2014-10-21T15:09:45.297" Score="3" Body="&lt;p&gt;I'm only so familiar with your audio terminology but in your spectrogram matrix, you could seek to maximize between-class variance over in-class variance &lt;span class=&quot;math-container&quot;&gt;$$r_{ij} = \frac{|\sigma_{ij}^{Talas_1,Talas_2}|^2}{\sum_{c=1}^{2}|\sigma_{ij}^{Talas_c}|^2}$$&lt;/span&gt; , and pick &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; points in your ratio matrix &lt;span class=&quot;math-container&quot;&gt;$r_{ij}$&lt;/span&gt; of that have this maximum value. Unfortunately, this yields a decision surface that may be nonlinear so a neural network is used in the paper below, but you might try to fit a Guassian mixed model first to the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; points you pick to see how that works for your application. Here i've just used 2 classes but the ratio can be generalized to multiple classes.&lt;/p&gt;&#xA;&lt;p&gt;You can also look around in any papers where the goal is to classify non-stationary signals, as they often use time frequency representations for classification.&lt;/p&gt;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;https://www.ee.washington.edu/research/seal/pubfiles/57_05.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classification of power quality disturbances using time-frequency ambiguity plane and neural networks&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8982" LastEditorUserId="7092" LastEditDate="2022-05-03T12:06:00.633" LastActivityDate="2022-05-03T12:06:00.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18770" PostTypeId="2" ParentId="18765" CreationDate="2014-10-21T16:24:59.643" Score="1" Body="&lt;p&gt;Basically it is a classification problem. You can want to classify the incoming voice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many ways to tackle it. One of them would be to extract features ( by features, I mean frequency, pitch etc) and label it accordingly(if it is of bird or frog).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then shortlist the features, which will help you differentiate between these two classes(bird or frog) and make a dictionary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your dictionary , it will be like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Class&lt;br&gt;&#xA;   features&#xA;                  Pitch   Frequency etc etc  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Frog        (P)  = 5     (F)=  10&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Bird         (P)   =   1 (F) =       20&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Whenever, your new sound comes in, you compute it features, and based on which feature it closely corresponds to (or there are many methods to do it) you choose the class.&lt;/p&gt;&#xA;" OwnerUserId="11303" LastActivityDate="2014-10-21T16:24:59.643" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18771" PostTypeId="2" ParentId="18767" CreationDate="2014-10-21T16:46:30.013" Score="0" Body="&lt;p&gt;First thing: a spectrogram does not give the &quot;frequencies&quot; at time $t$. It gives &lt;em&gt;amplitudes&lt;/em&gt;, measured for a set of linearly spaced frequency bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, there is no &quot;right&quot; answer to your question, because it depends on which musicological aspect you want to focus on, and you need to enlighten us on that. If you want to focus on melody, extracting the fundamental frequency is the most relevant feature, but I suspect this is not the case here. If you want to discriminate different timbres, spectral centroid might be a better way of &quot;summarizing&quot; a slice of spectrogram into a single value - better, but still quite bad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed I can see several flaws in your methodology:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why extract information at time t only (assumedly at a small window centered at t) rather than on the entire segment of sound between onsets?&lt;/li&gt;&#xA;&lt;li&gt;Why do you have this constraint that for any onset you have to extract a single real value? Some properties of sound, like timbre, are multidimensional, so you won't be able to entirely capture them in one single value. If we take the example of discriminating tabla sounds (which might or might not relevant to your problem, since you mentioned tala...), we need several features to discriminate them (bayan/dayan discrimination relies on pitch information, while resonant vs non-resonant stroke discrimination relies on timbral features).&lt;/li&gt;&#xA;&lt;li&gt;You are completely discarding the rhythmic (time) information. Is that really wanted for your problem?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Tell us more about your problem, there's a good chance it has already been solved, and that you are asking the wrong questions to solve it...&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-10-21T22:07:33.400" LastActivityDate="2014-10-21T22:07:33.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18773" PostTypeId="1" AcceptedAnswerId="18774" CreationDate="2014-10-21T21:09:59.947" Score="0" ViewCount="11865" Body="&lt;p&gt;I'm having a little trouble plotting the DFT of a signal in dB. I can get the picture up nicely when using the magnitude but when I try converting the magnitude to decibels it all goes south. I've been using this for help: &lt;a href=&quot;http://dadorran.wordpress.com/2014/02/20/plotting-frequency-spectrum-using-matlab/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://dadorran.wordpress.com/2014/02/20/plotting-frequency-spectrum-using-matlab/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I'm running:&#xA;(y is the signal obtained from a .mat file and L is the length of the signal)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = fft(y);&#xA;MAG = abs(Y);&#xA;MAGshift = abs(fftshift(Y));&#xA;bin_vals = [0:L-1];&#xA;L2 = L/2;&#xA;f = Fs*(bin_vals - L2)/L;&#xA;&#xA;figure(1);&#xA;plot(f,MAGshift);&#xA;axis([-1000 1000 0 45000]);&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this I managed to get this lovely picture:&lt;img src=&quot;https://i.stack.imgur.com/sohLV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I convert the magnitude to decibels with mag2db(MAG) or 10*log10(MAG) and plot it, it does not look anything like this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/trPq3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help?&lt;/p&gt;&#xA;" OwnerUserId="11049" LastEditorUserId="8202" LastEditDate="2014-10-22T15:11:22.273" LastActivityDate="2014-10-22T15:11:22.273" Title="Plotting DFT in dB" Tags="|matlab|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18774" PostTypeId="2" ParentId="18773" CreationDate="2014-10-21T21:18:38.223" Score="3" Body="&lt;p&gt;I would suggest you to normalize the amplitude by the maximum if you don't know the exact reference or scaling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MAG_dB = 20*log10(MAG/max(MAG));&#xA;plot(MAG_dB);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will yield a logarithmic plot normamalised to 0 dBFS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Small example for two sinusoids with difference in amplitude of 3dB is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc, clear, close&#xA;&#xA;fs = 1000;&#xA;t = (0:1/fs:10-1/fs);&#xA;N = length(t)&#xA;% Two sinusoids, second one (@200Hz) has amplitude of -3dB.&#xA;s = sin(2*pi*100*t) + 1/sqrt(2)*sin(2*pi*200*t);&#xA;s = hamming(N)'.*s;&#xA;&#xA;X = abs(fft(s))/N;&#xA;X_db = 20*log10(X/max(X));&#xA;&#xA;plot(X_db)&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/c4O9v.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-10-22T09:12:12.150" LastActivityDate="2014-10-22T09:12:12.150" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18775" PostTypeId="1" AcceptedAnswerId="18776" CreationDate="2014-10-22T03:48:34.667" Score="0" ViewCount="105" Body="&lt;p&gt;I am trying to develop a classifier for Indian Taals, for which I would be focusing only on the Tabla. &#xA;Now once a extract a period of the Tala(a repetitive pattern), I want to develop some feature vectors for a Tala, which can be used to differentiate two Talas. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure what they should be. As of now, what I am planning to do is to find the beats of the Tala by beat tracking, or the onsets, and then take the median of the spectrogram values at the beat times to be my feature vector for a particular tala.  Also, there is the concept of Bayan/Dayan in Tabla which have different pitches. I am not very sure how to use this information into my feature vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also want to include the time(temporal characteristics) into my feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="11459" LastEditorUserId="11459" LastEditDate="2014-10-22T04:05:28.700" LastActivityDate="2014-10-22T07:35:34.997" Title="Developing a classifier for a periodic music" Tags="|matlab|frequency-spectrum|spectrogram|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18776" PostTypeId="2" ParentId="18775" CreationDate="2014-10-22T07:10:40.930" Score="2" Body="&lt;p&gt;Very first thing to do: there is literature describing systems doing exactly what you want to do. Look for it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your suggested approach - representing the sequence as a feature vector of dimension $n$ where $n$ is the number of onsets or beats - has many flaws:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What if you want to classify sequences which are longer/shorter than your training samples?&lt;/li&gt;&#xA;&lt;li&gt;What if the onset detector skips an event or detects a spurious event, and the entire vector is shifted left or right?&lt;/li&gt;&#xA;&lt;li&gt;What about timing information, which is essential in the perception of rhythm!&lt;/li&gt;&#xA;&lt;li&gt;A single real number computed from the spectrogram is unlikely to represent well the musicological dimension that matters to your problem (which &quot;stroke&quot; or &quot;bol&quot; has been played on the tabla).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Strings/sequence matching methods are more likely to be what you need. What matters to your classification problem is &quot;what follows what&quot; rather than &quot;what happens at the $n$-th position&quot; - because the concept of &quot;$n$-th&quot; position is not very robust, and also very relative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I would approach the problem:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Detect onsets on your audio signal, and for each onset, compute a vector of timbral features (MFCCs will be fine). At this point you have a sequence of onset times and a sequence of feature vectors.&lt;/li&gt;&#xA;&lt;li&gt;On your entire training database, train a vector-quantizer with a small-ish codebook (say 16 or 32 vectors) on the feature vectors. There's a good chance that it will map well to the tabla bols ('dha', 'ti', 're', 'tin'...) - each codeword will correspond to a distinct tabla stroke.&lt;/li&gt;&#xA;&lt;li&gt;Quantize your data using this vector quantizer. Your sequences will now be represented as a list of onset times and codeword id [(0.0, codeword_10), (0.51, codeword_7), (1.02, codeword_7), (1.27, codeword_16), (1.52, codeword_17), (2.03, codeword_10)...] etc.&lt;/li&gt;&#xA;&lt;li&gt;Use a classic tactus/tatum detection algorithm (they use inter-onset times as their input) to recover the temporal structure of the rhythm. This will allow you to group events into matras. The example above will become: codeword_10, codeword_7, codeword_7, codeword_16|codeword_17, codeword_10 (note the grouping - the fourth and fifth events are played in sequence within the same matra).&lt;/li&gt;&#xA;&lt;li&gt;Use any string/sequence modelling technique on the representation above:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Transforming the sequence obtained at step 4 into a sparse vector of n-gram counts is the most flexible method, since it allows you to use any text machine learning technique. The downside is that it needs lots of training data and works well on rather long sequences.&lt;/li&gt;&#xA;&lt;li&gt;You can also use HMMs. Collect a small corpus of sequences in various taal, train a HMM on them for each taal; use the HMM to compute the likelihood of each of the taal models given the observed sequence.&lt;/li&gt;&#xA;&lt;li&gt;Another option is to use an edit distance on the sequence obtained at step 4, in conjunction with nearest-neighbour classification. Compute the edit distance between the sequence to classify, and sequences representative of each of the different taals. Pick the taal with the smallest edit distance.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that if you have time to invest in manual annotation, steps 2 and 3 can be replaced by a supervised classifier: annotate a database of table sounds with the name or 'bol' of each stroke ('dha', 'dhin', 'ti', 're'...). Train a classifier from audio features (say MFCC) into bols. Use this classifier at step 3. You will now be able to work with a very meaningful representation of your sequences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A final note: There's a good chance that step 5 can be done with a handful of rules, rather than through machine learning. I know the entire purpose of your project is to do tala recognition with machine-learning; but what is the point if a bit of musicological knowledge can do the same job? What machine learning can do is transcribe the audio signal into a symbolic representation (a sequence of bols) - but further processing of this representation to extract meaningful musicological properties/categories does not necessarily require machine learning techniques...&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-10-22T07:35:34.997" LastActivityDate="2014-10-22T07:35:34.997" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="18777" PostTypeId="2" ParentId="18766" CreationDate="2014-10-22T08:35:08.240" Score="0" Body="&lt;p&gt;I have a nice solution for you that I'm always using whenever I need to compute the instantaneous frequency of a discrete analytical signal and which works much better then the common approach using $tan(.)$ where you need to introduce thresholds and fiddle around with adding/subtracting $2\pi$. In addition to that it is even faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a signal $x(t)$ and the corresponding analytical signal $$\xi(t) = x(t) + i\mathcal{H}x(t)$$ with $\mathcal{H}$ being the hilbert transform operator the instantaneous frequency $\omega(t)$ can be computed as followed. We have $\omega(t)=\dot{\varphi}(t)$ with $\varphi(t)=\Im log\xi(t)$ being the phase of the analytical signal $\xi$ ($\Im$ denotes the imaginary part). Combining these equations we get&#xA;$$&#xA;\omega(t)=\Im\frac{d}{dt}log\xi(t)=\Im\frac{\dot{\xi}(t)}{\xi(t)}&#xA;$$&#xA;This can also be seen be as follows:&#xA;$$&#xA;  \Im\frac{\dot{\xi}}{\xi} = \Im\frac{ \dot{A}e^{i\varphi} + iAe^{i\varphi}\dot{\varphi} }{Ae^{i\varphi}}&#xA;                       = \Im\Big[ \frac{\dot{A}}{A} + i\dot{\varphi} \Big]&#xA;                       = \dot{\varphi}&#xA;$$&#xA;Discretizing this equation you can now compute the discrete instantaneous frequency from the discrete analytical signal:&#xA;$$ \omega[n]\approx\Im\frac{\xi[n+1]-\xi[n]}{\xi[n]} $$&#xA;or second order:&#xA;$$ \omega[n]\approx\Im\frac{\xi[n+1]-\xi[n-1]}{2\xi[n]} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this is not &lt;em&gt;the&lt;/em&gt; exact solution as it is still requires a discrete differentiation of the signal. But this could be done using standard techniques.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2014-10-22T08:35:08.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18778" PostTypeId="1" AcceptedAnswerId="18779" CreationDate="2014-10-22T08:45:15.443" Score="0" ViewCount="142" Body="&lt;p&gt;How can I find the frequency response of the following linear system&#xA;&lt;img src=&quot;https://i.stack.imgur.com/L4vdx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7724" LastActivityDate="2014-10-22T14:37:22.060" Title="Find the frequency response of the system" Tags="|fourier-transform|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18779" PostTypeId="2" ParentId="18778" CreationDate="2014-10-22T12:04:02.493" Score="1" Body="&lt;p&gt;OK, in the comments you've shown that you can actually do it by yourself. This answer just summarizes the steps and shows you how to write your (correct) result in the form that you were given as an answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, note that you have two identical systems in series. If $G(\omega)$ is the frequency response of the system up to and including the first integrator (from the left), then the total frequency response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=G^2(\omega)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response $G(\omega)$ can be seen as a multiplication of two subsystems, the system up to and including the adder, and the integrator. The first of the two has a frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_1(\omega)=1-e^{-j\omega T}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $G_1(\omega)$ has a zero at $\omega=0$, we don't need to bother with any problems of the integrator at $\omega=0$ (I'm talking about the delta impulse). So for calculating $G(\omega)=G_1(\omega)G_2(\omega)$, we can simply use&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_2=\frac{1}{j\omega}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega)=\frac{1-e^{-j\omega T}}{j\omega}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, from (1),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=\frac{(1-e^{-j\omega T})^2}{(j\omega)^2}\tag{5}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to get from (5) the answer that you were given, use this trick to rewrite $G_1(\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_1(\omega)=e^{-j\omega T/2}(e^{j\omega T/2}-e^{-j\omega T/2})=2je^{-j\omega T/2}\sin(\omega T/2)\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using (6) you can rewrite $G(\omega)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega)=2e^{-j\omega T/2}\frac{\sin(\omega T/2)}{\omega}=&#xA;Te^{-j\omega T/2}\frac{\sin(\omega T/2)}{\omega T/2}\tag{7}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Squaring (7), using $\omega=2\pi f$ and $\text{sinc}(x)=\sin(\pi x)/(\pi x)$ will give you the final form of the result.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-22T12:04:02.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18780" PostTypeId="2" ParentId="18778" CreationDate="2014-10-22T14:37:22.060" Score="1" Body="&lt;p&gt;Neat. This one you could also do in the time domain. Let's make x(t) a dirac impulse. At t=0 that gets into the integrate and the output of the integrator is 1 for t &gt;=0. Now at T=t, the negative impulse gets into the integrator the result for this is -1 for t &gt;=T. This cancels the original impulse and the output becomes zero again. So the impulse response of the first stage is basically a rectangle: h(t) = 1, for 0&amp;lt;= t &amp;lt; T, 0 otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This corresponds, of course, to the sinc function in the frequency domain. Cascading two systems is done by convolving the two impulse response, so we have to convolve two rectangles which simply results in a triangle. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-10-22T14:37:22.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18783" PostTypeId="2" ParentId="18737" CreationDate="2014-10-22T15:33:27.183" Score="0" Body="&lt;p&gt;You will only get an approximation to your original signal.  By the time you have upsampled by 2 and downsampled by 4, you have an overall downsample of 2.  That means you have thrown away half your original data.  No amount of upsampling will perfectly re-construct that lost data.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2014-10-22T15:33:27.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18784" PostTypeId="1" CreationDate="2014-10-22T19:02:32.853" Score="1" ViewCount="4065" Body="&lt;p&gt;I have a vector with raw data (120 samples). From the frequency spectrum I can tell there is one dominant frequency component. Now I am supposed to use the fft data (magnitude and phase) to find a good sinusoidal fit and offset to fit the original data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am completely stuck on this one. Can anyone help?&lt;/p&gt;&#xA;" OwnerUserId="11049" LastActivityDate="2014-10-23T14:14:47.167" Title="Find a sinusoidal fit from data with fft" Tags="|matlab|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18785" PostTypeId="2" ParentId="18784" CreationDate="2014-10-22T20:32:00.363" Score="2" Body="&lt;p&gt;Depending on kind of signal you are dealing with I can think of the easiest method to do so.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take the DFT of your signal (remember about proper scaling of values).&lt;/li&gt;&#xA;&lt;li&gt;Find the dominant frequency $f_0$ and its amplitude $A$ at magnitude spectrum.&lt;/li&gt;&#xA;&lt;li&gt;From phase spectrum find the corresponding phase shift $\theta$ for this given frequency - usually it is given in radians.&lt;/li&gt;&#xA;&lt;li&gt;Reconstruct your signal as: $x(t)=A\sin(2\pi f_0t+\theta) $&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Some quick and dirty code is included below. No warranty of working whatsoever. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/env python&#xA;&#xA;import numpy as np&#xA;import scipy.signal as sig&#xA;import matplotlib.pyplot as plt&#xA;&#xA;if __name__ == &quot;__main__&quot;:&#xA;    # Signal and analysis parameters&#xA;    fs = 4000.0    # Sampling frequency&#xA;    T  = 2         # Duration of a signal&#xA;    f0 = 100       # Fundamental frequency&#xA;    A  = 1         # Sine amplitude&#xA;    #th = np.pi/4   # Phase shift in radians (45 degrees)&#xA;    th = 0&#xA;&#xA;    # Time vector&#xA;    t = np.arange(0, T*fs)/fs &#xA;&#xA;    # Generate the signal with higher harmonics&#xA;    x = A*np.sin(2*np.pi*f0*t + th) + \&#xA;        A*np.sin(2*np.pi*2*f0*t + 2*th)/8 + \&#xA;        A*np.sin(2*np.pi*3*f0*t + 3*th)/16&#xA;&#xA;    # Add some noise &#xA;    x += 0.5*np.random.randn(x.size)    &#xA;&#xA;    # Number of all samples&#xA;    N = x.size    &#xA;&#xA;    # Apply the window&#xA;    win = sig.gaussian(N, N)&#xA;    x = x*win    &#xA;&#xA;    # Perform the DFT&#xA;    X = np.fft.fft(x)&#xA;    # Get the frequency vector&#xA;    freq = np.linspace(0, fs-1/fs, N)&#xA;&#xA;    # Get the phase and magnitude&#xA;    Xmag = np.abs(X)/np.sum(win)*2&#xA;    Xph  = np.angle(X)&#xA;&#xA;    # Magnitude in logarithmic scale&#xA;    Xmagl = 10*np.log10(Xmag/Xmag.max())&#xA;&#xA;    # Find the amplitude of the dominant frequency    &#xA;    ind_max = np.argmax(Xmag[0:np.ceil(N/2)])&#xA;&#xA;    # Extract the amplitude ...&#xA;    A_ = Xmag[ind_max]&#xA;    # ... frequency ..&#xA;    f0_ = freq[ind_max]&#xA;    # ... phase&#xA;    th_ = Xph[ind_max] + np.pi/2&#xA;&#xA;    # Reconstruct the signal&#xA;    x_ = A_ * np.sin(2*np.pi*f0_*t + th_)&#xA;&#xA;    # Do some plotting&#xA;    plt.subplot(311)&#xA;    plt.plot(t, x)&#xA;    plt.grid(True)  &#xA;    plt.hold(True)&#xA;    plt.plot(t, x_, 'r')&#xA;    plt.title('Time domain signal')&#xA;&#xA;    plt.subplot(312)&#xA;    plt.plot(freq[0:N/2], Xmagl[0:N/2])&#xA;    plt.grid(True)&#xA;    plt.title('Magnitude')&#xA;&#xA;    plt.subplot(313)&#xA;    plt.plot(freq[0:N/2], Xph[0:N/2])&#xA;    plt.grid(True)&#xA;    plt.title('Phase')&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EvLyn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-10-23T14:14:47.167" LastActivityDate="2014-10-23T14:14:47.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18786" PostTypeId="1" CreationDate="2014-10-22T21:33:30.967" Score="1" ViewCount="601" Body="&lt;p&gt;The measure of a given frequency $\omega$ in a signal $x(t)$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1}{N}\sum\limits^N_{t=0}x\left(t\right)e^{^{-i \omega t}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is basically an average of the correlation between the signal and a complex sinusoid rotating at $\omega$ frequency over some time range (N).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to realize this as a IIR filter (the former definition is virtually a FIR filter), so that it can be implemented as a sort of resonator which is fed an input stream of data, from which the frequency over the last N samples can be measured, continuously?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I've made this working model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y\left(n\right)=e^{-i \omega n}x\left(n\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X\left(n\right)=y\left(n\right)+e^{\frac{-1}{N}}\left(X\left(n-1\right)-y\left(n\right)\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $X(n)$ will be the complex result of the correlation over the last N samples, utilizing a moving average IIR filter. While this works, it is quite inefficient in my current, naive implementation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for each sample:&#xA;    t0 = x * sample;&#xA;    real = t0 + pole * (real - t0);&#xA;&#xA;    t0 = -y * sample;&#xA;    imag = t0 + pole * (imag - t0);&#xA;&#xA;    t0 = x * c1 - y * c2;&#xA;    y = x * c2 + y * c1;&#xA;    x = t0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; corresponds to the cosine and the sine of the complex sinusoid, computed using a IIR oscillator filter. My hunch is that it will be possible to implement some standard filter with an adequate damping such that it will be equivalent to the former equation / code? And basically function like a resonator, where the amount of resonance is equal to the average of the correlation over the last N samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also been looking at the Goertzel algorithm, and possible ways to use that theory, even though it seems to suffer from scalloping/inability to resolve frequencies not quantized to integers between 0 and N?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the redundancy, I'm still very new to filters and DSP in general, I'm just hoping someone can point me in the right direction and tell me I'm not grasping for straws :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit - appendix: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;goertzel algorithm&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Scalar sine, cosine, coeff, q0(0), q1(0), q2(0);&#xA;&#xA;sine = sin(omega);&#xA;cosine = cos(omega);&#xA;coeff = 2.0 * cosine;&#xA;&#xA;for (int t = 0; t &amp;lt; size; t++)&#xA;{&#xA;    q0 = coeff * q1 - q2 + data[t];&#xA;    q2 = q1;&#xA;    q1 = q0;&#xA;}&#xA;&#xA;Scalar real = (q1 - q2 * cosine) / (size * 0.5);&#xA;Scalar imag = (q2 * sine) / (size * 0.5);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;goertzel vs. correlation of sinusoid&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/D7fAV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8650" LastEditorUserId="8650" LastEditDate="2014-10-26T13:18:36.983" LastActivityDate="2014-10-26T13:18:36.983" Title="Realization of IIR resonator" Tags="|fourier-transform|infinite-impulse-response|moving-average|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18787" PostTypeId="1" CreationDate="2014-10-23T00:21:52.823" Score="4" ViewCount="8928" Body="&lt;p&gt;I have a frequency-domain representation $X(e^{i\omega})$ of the complex discrete one-dimensional signal $x[n]$: $X(e^{i\omega})=\mathcal{F}\{x[n]\}$. Is there a frequency-domain transformation of $X(e^{i\omega})$ into $\hat{X}(e^{i\omega})=\mathcal{F}(|x[n]|)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, $\hat{X}(e^{i\omega})=\mathcal{F}\left\{\left|\mathcal{F}^{-1}\{X(e^{i\omega})\}\right|\right\}$ will do the trick, but I am interested if there is a dual to the absolute value function $|x|$ in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="802" LastEditorUserId="4346" LastEditDate="2015-02-20T17:30:23.480" LastActivityDate="2015-02-20T17:30:23.480" Title="How does taking the absolute value of a complex signal reflect in the frequency domain?" Tags="|fourier-transform|frequency-domain|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18788" PostTypeId="1" AcceptedAnswerId="18789" CreationDate="2014-10-23T00:23:57.520" Score="0" ViewCount="574" Body="&lt;p&gt;I am willing to overlay a equalized cdf with equalized histogram in matlab.&#xA;But it's really hard to find any recommends.&#xA;so if you can, would you please let me know about that?&lt;/p&gt;&#xA;" OwnerUserId="10979" LastActivityDate="2014-10-23T13:49:16.953" Title="Does anyone know how to overlay a equalized CDF plot with equalized histogram in matlab?" Tags="|histogram|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18789" PostTypeId="2" ParentId="18788" CreationDate="2014-10-23T01:36:11.230" Score="1" Body="&lt;p&gt;You can use 'hold on' with a histogram:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[n,x]=hist(rand(1,100),20);  % find the histogram&#xA;bar(x,n./sum(n))             % plot normalized histogram&#xA;hold on                      % don't delete current plot&#xA;plot([0 1],[0.1 0.1])        % plot a uniform pdf&#xA;axis([0 1 0 0.12])           % make room around the plot&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another example using a normal distribution, which shows how to normalize the histogram so that its area is one:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r=randn(1,1000);      % normal random variable&#xA;[n,x]=hist(r,25);&#xA;delta=x(2)-x(1);&#xA;n=n./(delta*sum(n));  % n is normalized so that its area is 1&#xA;bar(x,n)&#xA;hold on&#xA;d=-4:0.1:4;&#xA;plot(d,(1/sqrt(2*pi))*exp(-(d.*d)./2),'r')  % plot of the normal pdf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2014-10-23T13:49:16.953" LastActivityDate="2014-10-23T13:49:16.953" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="18790" PostTypeId="1" AcceptedAnswerId="18793" CreationDate="2014-10-23T02:23:50.033" Score="2" ViewCount="432" Body="&lt;p&gt;I know that JPEG uses 2D dct and splits the images in 8x8 blocks. Why doesn't it simply split the image in one-dimensional vectors in $\mathbb{R}^{64}$? Wouldn't it simplify the math? My guess is that this way doesn't take advantage of pixel correlation. Is this right or is there any other reason? &lt;/p&gt;&#xA;" OwnerUserId="11471" LastEditorUserId="11471" LastEditDate="2014-10-23T03:21:34.100" LastActivityDate="2014-10-23T03:39:45.820" Title="Why doesn't JPEG use 1D DCT for image compression?" Tags="|image-processing|fourier-transform|transform|dct|compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18791" PostTypeId="2" ParentId="18787" CreationDate="2014-10-23T02:51:26.967" Score="2" Body="&lt;p&gt;Absolute value is not a linear operation, so no, there is not a consistent dual in the frequency plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, though, it is somewhat similar to calculating the signal power, which involves multiplying $x[n]$ with it's complex conjugate.  Multiplication in the time domain is equivalent to convolution in the frequency domain.  The result in the time domain is real, so the result in the frequency domain is even (i.e. symmetric around 0 Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Absolute value will probably produce a similar effect to calculating the power since it is the square root of the power.  It is also real so it will be even in the frequency plane.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-10-23T02:51:26.967" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18793" PostTypeId="2" ParentId="18790" CreationDate="2014-10-23T03:39:45.820" Score="2" Body="&lt;p&gt;If JPEG used a 1d DCT it would only be eliminating the redundancy in a single direction. You could compress the image with a 1d DCT then turn it sideways and compress it again. Since the DCT is separable doing this double 1d compression procedure would be (roughly) the same as just using a 2d DCT transform to begin with.&lt;/p&gt;&#xA;" OwnerUserId="5662" LastActivityDate="2014-10-23T03:39:45.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18795" PostTypeId="2" ParentId="18787" CreationDate="2014-10-23T05:41:54.120" Score="-1" Body="&lt;p&gt;Well the Fourier transform of the absolute value function exists:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$-\frac{\sqrt{\frac{2}{\pi&#xA;   }}}{w^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source:&#xA;FourierTransform[Abs[x], x, w]&lt;/p&gt;&#xA;" OwnerUserId="941" LastActivityDate="2014-10-23T05:41:54.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18796" PostTypeId="1" AcceptedAnswerId="18800" CreationDate="2014-10-23T05:42:22.370" Score="5" ViewCount="2764" Body="&lt;p&gt;My question involves proper FFT Technique for AM demodulation, in the special&#xA;case where the modulation rate exceeds the carrier frequency.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question has a specific hobbyist application, the decoding of weather satellite pictures using minimal computing hardware and inexpensive receivers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Warning: this is necessarily long&lt;/strong&gt;, and you might want to skim it to see if you have time to read it. Or, perhaps just focus on what seems problematic.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;APT: How the NOAA satellites send low-resolution pictures&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;A simplified version of the APT encoding process is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;An 8 bit grayscale image that includes sync data, Visual and IR imagery and test/telemetry bars is fed to an 8 bit D/A converter at a rate of 2 lines per second, where each line is 2080 bytes, for an encoding rate of 4160 bytes/sec.&lt;/li&gt;&#xA;&lt;li&gt;The D/A converter AM modulates a 2400 hz tone (and therefore the modulation rate exceeds the carrier frequency) creating an analog audio stream.&lt;/li&gt;&#xA;&lt;li&gt;The analog audio stream FM modulates an RF carrier around 137 Mhz.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The above 1-3 summarizes more detailed descriptions at &lt;a href=&quot;http://en.wikipedia.org/wiki/Automatic_Picture_Transmission&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Automated Picture Transmission&lt;/a&gt;, and &lt;a href=&quot;http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/c4/sec4-2.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;NOAA KLM Users Guide 4.2 - APT System&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The satellites also send high resolution data on an S-band microwave downlink, but that is beyond the scope of this question.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Hobbyist decoding process&lt;/h1&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The rtl_fm program of the RTL-SDR package is used to command an inexpensive dongle to receive the RF signal and record audio samples of the decoded FM to a .wav file at a rate of 20800 samples/sec (5 x data rate).  The resolution of the RTL-SDR dongle is 8 bits/sample.  The raw digital audio is converted to a .wav file with &lt;code&gt;sox&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;A python program takes the real-valued digital audio sample from the .wav, demodulates the AM data from the audio, and arrange the decoded bytes to produce the received grayscale image.  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Most of the programs for step #2 are inexpensive but proprietary, thus the desire to develop an open source decoder.  Also open source is atpdec by Thierry Leconte F4DWV but it would not gracefully deal with missing samples and I was curious to see how far I could get writing my own.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For completeness, here is a &lt;a href=&quot;https://github.com/DrPaulBrewer/cqwx/blob/33ee008038216a176b55a6264d8d3ff9c5f937d7/APT.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;stable github repository for the version of my code under discussion&lt;/a&gt; and the &lt;a href=&quot;https://drive.google.com/file/d/0B-XXSCz5WC7NT3pTaTViNHdadGM/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;APT audio signal&lt;/a&gt; of the pictures posted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope to describe the procedures adequately and include snippets below.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;AM RMS Demodulation&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The most sensitive method I have found so far is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sample the real-valued audio signal at 5x the digital data encoding rate (20800 samples/sec)&lt;/li&gt;&#xA;&lt;li&gt;Work with one video line length of samples (10400 samples) at a time. &lt;/li&gt;&#xA;&lt;li&gt;In each line, group the samples into groups of 5, to correspond to the same transmitted digital value. Square and sum the samples within the groups of 5. The idea is that if &lt;code&gt;S(t) = A cos(wt)&lt;/code&gt; then &lt;code&gt;(S^2)(t) = A^2 (cos^2)(wt) = 0.5 A^2 + 0.5 A^2 cos(2wt)&lt;/code&gt; from the cos^2 trig identity and omega with the NOAA satellites is such that 5 omega is a little bigger than 180 degrees, so maybe the last term summed up over the 5 samples is small enough to get a noisy A out if we are lucky.&lt;/li&gt;&#xA;&lt;li&gt;(Noise reduction) For each line of video, deduct the minimum sum of squares from each of the sums.  If you consider a noisy discrete signal R(t) = S(t) + e(t) where e(t) ~ i.i.d. N (0, sigma^2) is a gaussian noise then it is clear that an RMS estimator of A is biased upwards by gaussian noise.  Since we know some of the As in a line of video are low (near black), especially in the sync pulses, then we might want to push the estimates back down towards 0 using the minimum of all the estimates as a poor, but practical, estimate of noise. &lt;/li&gt;&#xA;&lt;li&gt;Then multiply by 2/5 and take the square root of each of the sum-of-squares to obtain the amplitudes for each byte.&lt;/li&gt;&#xA;&lt;li&gt;Digitize linearly to 8 bits.&lt;/li&gt;&#xA;&lt;li&gt;(Advanced) Jiggle to try to get the 5x binning of samples to line up with what was sent by examining sync signals etc.  Estimate signal phase and use that to apply a correction which greatly reduces the near-vertical-line visual artifacts.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Python snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# _G5() reshapes an array to 2D - groups of 5 - i.e. (len/5 x 5)&#xA;ssq = np.sum(_G5(np.square(self.signal[start:end])), axis=1)&#xA;if denoise is True:&#xA;    denoiseAmt = np.min(ssq)&#xA;    ssq -= denoiseAmt&#xA;if phase is None:  # None means do not apply phase correction&#xA;    demod = np.sqrt(0.4*ssq)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a picture decoded with this AM RMS method without step #7.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nvKU7.jpg&quot; alt=&quot;http://i.imgur.com/b3mvR8X.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the picture is not perfectly aligned because of a doppler-like effect, and quite noisy, it is obviously the southeastern USA and a portion of the Atlantic Ocean.  &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;FFT-based AM demodulation&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Since the modulation rate exceeds the tone frequency, I decided to try to demodulate the upper sideband only.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT-based demodulator is coded to operate as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Have the code work with one video line at a time (10400 samples)  &lt;/li&gt;&#xA;&lt;li&gt;Create a sample of size 2^15 = 32768 consisting of zeros, the 10400 samples, and more zeroes so that the audio samples are in the middle of the zeroes.&lt;/li&gt;&#xA;&lt;li&gt;apply python's real FFT.  numpy.fft.rfft&lt;/li&gt;&#xA;&lt;li&gt;find the bin corresponding to the 2400 hz audio carrier.  &lt;/li&gt;&#xA;&lt;li&gt;shift the FFT left so that the zero'th bin corresponds to 2400 hz.&lt;/li&gt;&#xA;&lt;li&gt;zero the zeroth bin, and pad with zeroes on the right according to the shift.&lt;/li&gt;&#xA;&lt;li&gt;Take the inverse real FFT numpy.fft.irfft&lt;/li&gt;&#xA;&lt;li&gt;Remove the demodulated signal from the middle as the inverse of step #2&lt;/li&gt;&#xA;&lt;li&gt;Downsample by 5 by taking every 5th sample and throwing the others away&lt;/li&gt;&#xA;&lt;li&gt;Digitize&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Python code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def _demodAM_by_FFT(self, start=None, end=None, warn=True, minpower2=15):&#xA;    if start is None:&#xA;        start = 0&#xA;    if end is None:&#xA;        end = len(self.signal)&#xA;    # find a power of 2 that encloses the sample, then go up another power&#xA;    # minimum window of 2^15 = 32768&#xA;    power2 = max(minpower2, 1+math.ceil(math.log(end-start)/math.log(2.0)))&#xA;    fftsize = 2**power2&#xA;    binNOAACarrier = math.floor(fNOAACarrierHz*fftsize/self.rate)&#xA;    padding = fftsize-(end-start)&#xA;    padl = padding/2&#xA;    padr = padding-padl&#xA;    sample = np.concatenate( (np.zeros(padl, np.float),\&#xA;                              self.signal[start:end],\&#xA;                              np.zeros(padr, np.float)) )&#xA;    sample_fft = np.fft.rfft(sample)&#xA;    high_bin = np.argmax(np.abs(sample_fft))&#xA;    if warn:&#xA;        if high_bin!=binNOAACarrier:&#xA;            print &quot;warning: in _demodAM_by_FFT unexpected fft peak&quot;&#xA;            print &quot; peak occurs in bin &quot;,high_bin&#xA;            print &quot; expected carrier in bin &quot;,binNOAACarrier&#xA;        else:&#xA;            print &quot;fft peak as expected&quot;&#xA;    cutoff = binNOAACarrier&#xA;    demod_fft = np.concatenate( (np.copy(sample_fft[cutoff:]),\&#xA;                                 np.zeros(cutoff, np.complex) ) )&#xA;    demod_fft[0] = 0.0&#xA;    demod = np.fft.irfft(demod_fft)[padl:(padl+end-start)]&#xA;    demod5 =_G5(demod)&#xA;    demod5x2 = demod[:,2]&#xA;    return demod5x2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If one looks very carefully, the test/telemetry bars can be identified but the image is either not there or badly distorted.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fcqEZ.jpg&quot; alt=&quot;FFT-demodulated NOAA Satellite Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT based image does not change as the centered, zero-padded sample line is increased from 2^15 to 2^17.  Demodulating the entire signal instead of line by line also does not noticeably improve the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although data analysis plays a role in some of my work, I do not usually use FFT for anything. So I must admit some unfamiliarity with proper set up of FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for advice on whether an FFT demodulation method is salvageable for noisy signals such as this, and what techniques the code above is missing (such as windowing techniques or pre-filtering the samples in a certain way) to have a better chance at success.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;FOLLOW-UP&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;For completeness and comparison, here are some images obtained from the Hilbert transform technique suggested by the answer below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image from abs value of hilbert transform, single video line signal inputs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/niBv3.jpg&quot; alt=&quot;Line-By-Line decoding with Norm of Hilbert Transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if instead, all of the signal data  is processed in one operation, (about 19M samples for a 15 minute LEO satellite pass), and then a median filter is applied before downsampling, we get something a bit clearer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KqEXQ.jpg&quot; alt=&quot;Full-sample decoding with Median(3) of Norm of Hilbert Transform&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11065" LastEditorUserId="11065" LastEditDate="2014-10-24T00:15:06.043" LastActivityDate="2015-03-18T20:26:22.007" Title="How to improve an FFT AM demodulator for NOAA APT satellite imagery?" Tags="|fft|image-processing|demodulation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18797" PostTypeId="2" ParentId="18767" CreationDate="2014-10-23T06:07:37.097" Score="-1" Body="&lt;p&gt;When working with audio signals there are two tricks, first remove the DC from the spectrum and band-limit it to a reasonable size. If you are looking at 1000 point intervals only use a 30 point FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try to use ML to get the mean and variance and then use these vectors to evaluate test data. More advanced students might consider the MMI criteria. &lt;/p&gt;&#xA;" OwnerUserId="941" LastActivityDate="2014-10-23T06:07:37.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18798" PostTypeId="2" ParentId="18201" CreationDate="2014-10-23T11:47:36.810" Score="11" Body="&lt;p&gt;The Cooley Tukey method allows general factorizations $N=N_1N_2$. The easiest way to see this is to use index mapping. Consider the length-$N$ DFT of a sequence $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1}x[n]W_N^{nk}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $W_N=e^{-j2\pi/N}$. Let's assume that $N$ can be factored as $N=N_1N_2$. Now use the following index mapping&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$n=n_1N_2+n_2,\quad n_1=0,1,\ldots, N_1-1,\quad n_2=0,1,\ldots,N_2-1\\&#xA;k=k_1+N_1k_2,\quad k_1=0,1,\ldots, N_1-1,\quad k_2=0,1,\ldots,N_2-1\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging (2) into (1) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k_1+N_1k_2]=\sum_{n_2=0}^{N_2-1}\sum_{n_1=0}^{N_1-1}x[n_1N_2+n_2]W_N^{(n_1N_2+n_2)(k_1+k_2N_1)}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complex exponentials in (3) can be simplified as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W_N^{(n_1N_2+n_2)(k_1+k_2N_1)}=W_N^{N_2n_1k_1}W_N^{N_1N_2n_1k_2}W_N^{n_2k_1}W_N^{N_1n_2k_2}=\\=&#xA;W_{N_1}^{n_1k_1}\cdot 1\cdot W_{N}^{n_2k_1}W_{N_2}^{n_2k_2}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $W_N^{N_1}=W_{N_2}$, $W_N^{N_2}=W_{N_1}$, and $W_N^{N_1N_2}=W_N^N=1$. Plugging (4) back into (3) and rearranging terms gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k_1+N_1k_2]=\sum_{n_2=0}^{N_2-1}\left[W_N^{n_2k_1}\left(\sum_{n_1=0}^{N_1-1}x[n_1N_2+n_2]W_{N_1}^{n_1k_1}\right)\right]W_{N_2}^{n_2k_2}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (5) can be interpreted as follows: the result can be computed by computing $N_2$ length-$N_1$ DFTs of subsampled versions of the input sequence $x[n]$ (this is the inner sum in (5)), then multiplying the result by twiddle factors $W_N^{n_2k_1}$, and finally computing $N_1$ length-$N_2$ DFTs (the outer sum in (5)). This procedure is most easily visualized using matrices:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;read the data row-wise into a $N_1\times N_2$ matrix&lt;/li&gt;&#xA;&lt;li&gt;compute DFTs over all $N_2$ columns (this can be done in-place)&lt;/li&gt;&#xA;&lt;li&gt;multiply the result element-wise with twiddle factors&lt;/li&gt;&#xA;&lt;li&gt;compute DFTs over all $N_1$ rows (in-place)&lt;/li&gt;&#xA;&lt;li&gt;read out the data column-wise to get the final length-$N$ result&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This little octave/Matlab script illustrates the procedure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 1536;          % non-power of 2 FFT length used in LTE&#xA;N1 = 512; N2 = 3;  % 512 x 3 = 1536&#xA;x = randn(N,1);    % some input signal&#xA;&#xA;% generate N1 x N2 matrix of input data, reading them row wise&#xA;X = reshape(x,[N2,N1]).';&#xA;&#xA;% DFT over each column&#xA;X = fft(X);&#xA;&#xA;% Multiplication with twiddle factors&#xA;X = X.*exp(-1i*2*pi/N*(0:N1-1)'*(0:N2-1));&#xA;&#xA;% DFT over each row&#xA;X = (fft(X.')).';&#xA;&#xA;% read out column wise&#xA;X = X(:);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-10-24T11:31:48.497" LastActivityDate="2014-10-24T11:31:48.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18799" PostTypeId="2" ParentId="18765" CreationDate="2014-10-23T12:12:27.900" Score="1" Body="&lt;p&gt;I suggest going with Mel frequency cepstral coefficients because they encode timbral information. Extract MFCC (13 values) from the recording and clasiffy it with calculating distance. You need to have two MFCCs characteristic for your two types of sound calculated and hard-coded. In my case, it worked this way for about 7 different sounds, so for 2 it wouldn't be a problem at all...&lt;/p&gt;&#xA;" OwnerUserId="10789" LastActivityDate="2014-10-23T12:12:27.900" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18800" PostTypeId="2" ParentId="18796" CreationDate="2014-10-23T12:49:41.527" Score="1" Body="&lt;p&gt;As @Jason R says, your _demodAM_by_FFT method pretty much just applies a (bad) filter to the raw data.  It isn't an AM demodulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To demodulate the signal, you need to apply a hilbert transform.  You can either implement  this yourself, or you could use the scipy.signal.hilbert function, since you are already using scipy.  Implementing the hilbert transform is usually done by way of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to do (more or less) the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Hilbert transform of a set of samples&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each sample, take the square root of the sum of the squares of the real and imaginary parts of the hilbert result for that sample.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(2.) is your demodulated signal, still with 5 samples per pixel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Those three steps recover the modulated amplitude from the audio signal.  I may have explained that poorly.  Lets try some pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;hilb=scipy.signal.hilbert(signal)&#xA;demod=numpy.abs(hilb)&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think you will want to do the whole signal at once (way too much data for one FFT,) but breaking it into chunks of a 1024 (or 4096) samples should be OK.  Reassemble before filtering and downsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could at this point apply a low pass filter (cutoff over 1040Hz) and resample to get your image data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could alternatively apply some filtering at this point to clean up the signal before doing the lowpass and downsampling.  A median filter might be a good place to start (scipy.signal.medfilt)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would first implement a proper demodulator with the hilbert function and get that working before I started filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's probably more to the decoding once you get the demodulated data, but demodulation is the first step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you are interested in implementing the hilbert transform with the FFT, &lt;a href=&quot;http://www.katjaas.nl/hilbert/hilbert.html&quot; rel=&quot;nofollow&quot;&gt;here is a site that I found to be fairly easy to understand.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-10-24T06:43:21.033" LastActivityDate="2014-10-24T06:43:21.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18801" PostTypeId="1" CreationDate="2014-10-23T13:59:53.617" Score="0" ViewCount="82" Body="&lt;p&gt;I have some noise measurements and 4 different models that can generate a similar noises using estimated parameters from the real measurements. To compare the estimated noises I calculated the PDF, the CCDF and the PSD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compare the results I used the Kull-Back Leibler divergence of the PDF, the MSE of the CCDF and the RMSE and the corr2 matlab function for the PSD. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if I did the right thing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please tell me if what I did is correct and do you know any other way or function to make such comparison?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="11460" LastActivityDate="2014-10-30T20:04:35.440" Title="comparing different signals" Tags="|signal-analysis|noise|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18804" PostTypeId="1" AcceptedAnswerId="18811" CreationDate="2014-10-23T17:57:20.460" Score="0" ViewCount="1531" Body="&lt;p&gt;I performed bicubic interpolation on a 256*256 image(img)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; dest = interp2(img,'bicubic')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and  i got a 511 * 511 image.I want to compute PSNR of a 512 * 512 image(original) and the 'dest' image as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;original = double(original);&#xA;dest = double(dest);&#xA;[M N] = size(original);&#xA;error = original - dest;&#xA;MSE = sum(sum(error .* error)) / (M * N);&#xA;&#xA;if(MSE &amp;gt; 0)&#xA;PSNR = 10*log(255*255/MSE) / log(10);&#xA;disp(['PSNR = ', num2str(PSNR)])&#xA;else&#xA;PSNR = 99;&#xA;disp(['PSNR = ', num2str(PSNR)])&#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I'm getting error due to different matrix dimensions.How to avoid this error.Is it possible to calculate PSNR of images with different size?Please help&lt;/p&gt;&#xA;" OwnerUserId="10965" LastActivityDate="2016-02-10T06:36:57.293" Title="PSNR of two images of different size in matlab" Tags="|image-processing|matlab|interpolation|matrix|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18805" PostTypeId="1" AcceptedAnswerId="18806" CreationDate="2014-10-23T20:43:18.153" Score="0" ViewCount="10176" Body="&lt;p&gt;When designing a root raised cosine filter on Matlab, there is an option to set its &quot;roll-off factor&quot;. What does this mean? I have been looking around for a while but I can't seem to find a clear explanation. Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="11256" LastEditDate="2014-10-24T09:52:37.603" LastActivityDate="2014-10-24T09:52:37.603" Title="What is the Roll-Off factor of a Root Raised Cosine Filter?" Tags="|matlab|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18806" PostTypeId="2" ParentId="18805" CreationDate="2014-10-23T21:34:33.790" Score="2" Body="&lt;p&gt;Think of the root-raised cosine as a family of functions. The roll-off factor is a parameter that chooses one of the possible functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All root-raised cosine pulses look similar to the sinc pulse. The interesting thing about the roll-off factor is that it controls two features of the function:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The rate at which the function's lobes (or ripples) decrease. At one extreme, with roll-off set to 0, they decrease slowly (as $1/t$, with $t$ equal to time). At the other end, when the roll-off factor is 1, they decrease as $1/t^3$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As the roll-off factor increases, so does the function's bandwith. Basically, if the function's bandwidth is $B$ when the roll-off is 0, then it becomes $2B$ when the roll-off is 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can choose any value for the roll-off factor between 0 and 1, so you can select the function with the ripple and bandwidth that are best suited to your needs.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-23T21:34:33.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18807" PostTypeId="1" CreationDate="2014-10-24T02:01:51.943" Score="3" ViewCount="116" Body="&lt;p&gt;I have implemented &quot;normalized cut&quot; segmentation. The change here is that, instead of giving an image as input, I have given an matrix of image. As my output looks odd to me. I need to know whether my implementation is correct or not. &#xA;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;tic;&#xA;% im = imread('lena.pgm');&#xA;im =[94 122 99 101 111 101;&#xA;99 92 103 87 107 116;&#xA;93 109 113 84 86 106;&#xA;5 17 6 54 56 53;&#xA;13 11 5 56 44 50;&#xA;0 10 5 49 42 51];&#xA;% resizing to avoid out of memory error&#xA;% cim=imresize(im,[100 100]);&#xA;cim=im;&#xA;[r, c]=size(cim);  &#xA;ind=find(cim);&#xA;lind=length(ind);&#xA;[I,J]=ind2sub([r,c],ind);&#xA;&#xA;% % I've used linear indexing to speed up the partitioning&#xA;% vectoring the pixel nodes&#xA;for i=1:lind&#xA;       V1(i)=double(cim(ind(i)));&#xA;end&#xA;&#xA;% normalizing to [0-1] scale&#xA;V=(V1./255);   &#xA;&#xA;% w is the weight matrix (similarity matrix or adjacency matrix)&#xA;w=zeros(lind,lind);&#xA;&#xA;% r, sigmaI, sigmaX values&#xA;rad=4.5;&#xA;sigi=10;&#xA;sigx=25;&#xA;&#xA;% computing the weight matrix&#xA;for i=1:lind&#xA;    x1=I(i,1);&#xA;    y1=J(i,1);&#xA;&#xA;    for j=1:lind&#xA;         if (i==j)&#xA;                 w(i,j)=1;&#xA;         else          &#xA;                 x2=I(j,1);&#xA;                 y2=J(j,1);&#xA;&#xA;            dist=((x1-x2)^2 + (y1-y2)^2);  &#xA;            if sqrt(dist)&amp;gt;=rad&#xA;                dx=0;            &#xA;            else&#xA;                dx=exp(-((dist)/(sigx^2)));&#xA;            end&#xA;&#xA;            pdiff=(V(i)-V(j))^2;&#xA;            di=exp(-((pdiff)/(sigi)^2));  &#xA;            w(i,j)=di*dx;&#xA;        end&#xA;&#xA;    end&#xA;end&#xA;&#xA;d=zeros(lind,lind);&#xA;s=sum(w,2);&#xA;&#xA;% the diagonal matrix for computing the laplacian matrix&#xA;for i=1:lind&#xA;     d(i,i)=s(i);&#xA;end&#xA;&#xA;A=zeros(lind,lind);&#xA;A=(d-w); % A is the laplacian matrix&#xA;&#xA;%  vt has the eigen vectors corresponding to eigen values in vl&#xA;%  other eigs / eig functions in matlab can be used but I'm using the&#xA;%  function to compute the 5 smallest eigenvectors&#xA;[vt,vl]=eigs(A,d,5,'sm');&#xA;&#xA;% se has the second smallest eigen vector, third and so on&#xA;se=vt(:,2:4);&#xA;&#xA;% % % % % Simultaneous 'k' partitions&#xA;k=6;&#xA;id=kmeans(se,k);&#xA;imp=cell(1,k);&#xA;pic=cell(1,k);&#xA;&#xA;for i=1:k&#xA;    imp{1,i}= find(id(:,1)==i);&#xA;    mat=zeros(100,100);&#xA;    in=imp{1,i};&#xA;    mat(in)=cim(in);&#xA;    pic{1,i}=uint8(mat);&#xA;%     figure,imshow(pic{1,i});&#xA;end&#xA;&#xA;% pic has the sub graphs or partitiond sub images&#xA;figure;&#xA;subplot(2,4,1);imshow(uint8(im));title('Original image');&#xA;subplot(2,4,2);imshow(uint8(cim));title('Preprocessed image');&#xA;subplot(2,4,3);imshow(pic{1,1});title('Partition 1');&#xA;subplot(2,4,4);imshow(pic{1,2});title('Partition 2');&#xA;subplot(2,4,5);imshow(pic{1,3});title('Partition 3');&#xA;subplot(2,4,6);imshow(pic{1,4});title('Partition 4');&#xA;subplot(2,4,7);imshow(pic{1,5});title('Partition 5');&#xA;subplot(2,4,8);imshow(pic{1,6});title('Partition 6');&#xA;toc;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/awtpx.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="11394" LastEditorUserId="128" LastEditDate="2023-07-15T05:00:08.157" LastActivityDate="2023-12-12T06:07:30.833" Title="Implementation of Normalized Cut (Spectral Clustering) for Image Segmentation" Tags="|image-processing|matlab|computer-vision|image-segmentation|graph-theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="18809" PostTypeId="1" AcceptedAnswerId="18831" CreationDate="2014-10-24T08:02:19.243" Score="0" ViewCount="83" Body="&lt;p&gt;I need to apply successive interference cancellation (SIC) to an RF signal which is the result of collisions between 2 or more unsynchronised packets. For this question let's just assume that the number of packets is 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In SIC, you store the collided packets until one of the packets are repeated and use the 'clean' packet to extract the other packet from the collided data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what techniques can be used to extract an unknown packet from a collision between that packet and a known packet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you deal with the packet sources not being synchronised?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going through the possible tags for this question, it seems that 'deconvolution' is relevant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it is relevant, the context is RFID tag inventory, the channel access mechanism is framed slotted ALOHA (FSA) random access, the carrier is 868 MHz (EU) and subcarrier is 256 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="11101" LastActivityDate="2014-10-26T15:53:04.573" Title="How to extract unknown packet from collision between said packet and another, known packet?" Tags="|deconvolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18811" PostTypeId="2" ParentId="18804" CreationDate="2014-10-24T10:52:51.463" Score="1" Body="&lt;p&gt;When interpolating, why not use the same size as the image to compare with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% some random inputs&#xA;original = rand(435,782);&#xA;img = rand(100,200);&#xA;% position where to interpolate&#xA;[x,y] = meshgrid(linspace(1,size(img,2),size(original,2)),linspace(1,size(img,1),size(original,1)));&#xA;% interpolate&#xA;dest = interp2(img,x,y,'bicubic');&#xA;% display size of result&#xA;disp(size(dest));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11477" LastActivityDate="2014-10-24T10:52:51.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18812" PostTypeId="1" CreationDate="2014-10-24T11:33:47.397" Score="0" ViewCount="2395" Body="&lt;p&gt;I have a simple, but interesting question for you.&#xA;I have to compute the RMS (root mean square or standard deviation) value of a time signal which represents in my case a velocity mesasurement over time, of course sampled an stored in a computer. In your opinion, does the &lt;strong&gt;sampling frequency&lt;/strong&gt; have a strong impact on the RMS value or it is just the &lt;strong&gt;TOTAL number of samples&lt;/strong&gt; that matters the most?&#xA;Can you please, if possible, refer to some books where this topic is dealt with?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot, I'm looking forward to reading your answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bye&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.&lt;/p&gt;&#xA;" OwnerUserId="11479" LastActivityDate="2014-10-24T12:06:05.500" Title="Effect of Sampling frequency on RMS estimation" Tags="|frequency|sampling|estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18813" PostTypeId="2" ParentId="18812" CreationDate="2014-10-24T12:06:05.500" Score="1" Body="&lt;p&gt;If the sampling rate meets the nyquist criteria (sampling rate more than twice the highest frequency in the signal) then it won't be a factor in the accuracy of the RMS value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are measuring velocities the nyquist criteria could be a problem if you don't know the frequencies involved.  The frequencies would be related to the acceleration - higher acceleration means higher frequencies.  I don't know how to tell you to determine the needed sampling rate give the expected acceleration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can't determine the highest frequency (or are limited in your sampling frequency,) then you might run your sampling at the highest available rate, but filter the analog signal with a lowpass with a cutoff frequency lower than half of the sampling rate.  This will avoid the problems that arise when sampling a fast signal with a too slow sampling rate, at the expense of throwing away information if the sampling rate really is too slow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of samples only comes into it when trying to calculate the RMS value of a repeating signal, line a sine wave.  In that case you have to make sure to get a least one full cycle of the lowest frequency.  More could help make up for inaccuracies in the measurement or reduce some of the noise.  In this case, the longer sampling period averages out any measurement errors and noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summary: Make sure that your sampling is fast enough, that the samples are evenly spaced, and that you (obviously) have all the samples for the period of interest.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-10-24T12:06:05.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18814" PostTypeId="1" AcceptedAnswerId="18815" CreationDate="2014-10-24T12:29:27.097" Score="0" ViewCount="1662" Body="&lt;p&gt;I am working on a project, for which I am finding the onset times of an audio and then extracting the MFCC coefficients for all the times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus if I have n onset times, I would have n feature vectors, corresponding to the MFCC coefficients at those points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to characterize a &quot;bol&quot; of the tabla by the the waveform in between the start of one onset and the start of the next onset. This would essentially mean that for one onset time, I would have to take the MFCCs feature vectors at multiple points, and I would have a matrix of onset values for each onset point, instead of just a single vector at each point. Also, the matrix wouldnot always be of the same size, since the gap between 2 onsets might not always be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I combine these multiple MFCC vectors to one, or how to I use this matrix for machine learning?&lt;/p&gt;&#xA;" OwnerUserId="11459" LastActivityDate="2014-10-24T13:10:29.997" Title="Feature vector for MFCCs" Tags="|matlab|signal-analysis|mfcc|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18815" PostTypeId="2" ParentId="18814" CreationDate="2014-10-24T13:10:29.997" Score="1" Body="&lt;p&gt;If I understand the problem well, you have a segment of audio between two onsets, for example between an onset at t=2.0s and an onset at t=2.8s, and your MFCC function returns many MFCC vectors - corresponding to small analysis windows between these two instants (In our example, 80 vectors if your MFCC function is set for a rate of 100 analysis frames per second).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you want a single vector &quot;summarizing&quot; the MFCC for the entire region between the two onsets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Increase the window size / decrease the frame rate of your MFCC routine so that it yields fewer vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Option 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Build a feature vector with the mean and standard deviation of all the MFCC vectors collected within your time segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases, set an upper bound on the size of the segment analyzed by such a process - I'd say at most 200ms. For example, if you have an onset at t=5.0s and the next onset is at t=7.0s, the percussive event is likely to be located within the first couple of hundred ms (say between t=5.0s and t=5.5s) - the rest being silence or background noise.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-10-24T13:10:29.997" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18816" PostTypeId="2" ParentId="18765" CreationDate="2014-10-24T13:38:31.770" Score="1" Body="&lt;p&gt;This is off-the-shelf technology for &lt;a href=&quot;http://www.soundintel.com&quot; rel=&quot;nofollow&quot;&gt;us&lt;/a&gt; but we're not aware of Open Source equivalents. We're not bird of frog experts so we need experts to label the database, but after that we can turn that into a representative model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the other answers have some problems. For instance, the MFCC cefficients summarize energy at each frequency band. Trivially, if you move further away, energies decrease across the spectrum. This would mean you end up recognizing primarily how far away your sound source was. &quot;Frequency&quot; isn't a practical description of complex sounds like birds or frogs, even though you can classify use it to classify sirens. Calculating distance metrics, as both previous answers suggest fails due to anisotropy in feature space.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-10-24T13:38:31.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18817" PostTypeId="1" AcceptedAnswerId="88477" CreationDate="2014-10-25T06:34:08.310" Score="2" ViewCount="1424" Body="&lt;p&gt;For those who have either used Picasa/Photoshop, they would see different image enhancement options such as:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Change exposure&lt;/li&gt;&#xA;&lt;li&gt;Change shadow&lt;/li&gt;&#xA;&lt;li&gt;Change highlights&lt;/li&gt;&#xA;&lt;li&gt;Change vibrance&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have searched online a lot about algorithms for doing the above operations. I know that these can be achieved from basic operations such by changing /saturation/contrast or adjusting dynamic range of an image. However, if somebody has used these algorithms then it is clear that it is different than just naively changing the basic parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I found a &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/955-imageadjuster&quot; rel=&quot;nofollow noreferrer&quot;&gt;submission&lt;/a&gt; on MATLAB file exchange which has a nice GUI and implements the &lt;code&gt;imadjust&lt;/code&gt; (i.e. adjust the dynamic range of image) command. I think this command is the key to emulate the above listed effects. I am posting some examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not asking about the auto-color/auto-enhance functions as they may be complex. If someone knows how to implement any of these algorithms, it would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change exposure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ToRop.png&quot; alt=&quot;Exposure adjustment&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change shadow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IkJuf.png&quot; alt=&quot;Shadow adjustment&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contrast enhancement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VkUkq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11271" LastEditorUserId="11271" LastEditDate="2014-10-25T20:18:44.513" LastActivityDate="2023-07-01T16:51:06.803" Title="Image enhancement algorithms for adjusting shadow, exposure, contrast etc" Tags="|image-processing|enhancement|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18819" PostTypeId="2" ParentId="18765" CreationDate="2014-10-25T10:47:10.313" Score="0" Body="&lt;p&gt;Ok, coming from a computer vision background, I would say this is a &quot;fine-grained&quot; problem. In such a case pure MFCC might not be ideal due to significant similarity between the sounds/pitches etc. Lately, there has been a study by Inria and submitted to the well-known Clef challenge &lt;a href=&quot;http://ceur-ws.org/Vol-1180/CLEF2014wn-Life-JolyEt2014b.pdf&quot; rel=&quot;nofollow&quot;&gt;found here&lt;/a&gt;. Here the problem is not exactly the same, but their database they includes multiple species. Their work is again based on MFCC, but with a clever pruning and indexing strategy. As it is based on MFCC, you would find it an easy read.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The description of this challenge is also here: &lt;a href=&quot;http://ceur-ws.org/Vol-1180/CLEF2014wn-Life-GoeauEt2014a.pdf&quot; rel=&quot;nofollow&quot;&gt;clef challenge&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Also, in musical analysis community this is known as a problem of granularity. There are different features or methods of extraction in order to capture the grain / granularity, as many of the audio features are already provide a coarse representation. One such work is &lt;a href=&quot;http://drops.dagstuhl.de/opus/volltexte/2012/3471/pdf/10.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, which use the fine-grained features for audio retrieval. As you only have 1000-1500 classes, you would be fine with a moderate classification-retrieval algorithm. Larger scales of course demand the indexing schemes, which may not be relevant for your case.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-10-27T10:32:20.947" LastActivityDate="2014-10-27T10:32:20.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18824" PostTypeId="1" AcceptedAnswerId="18825" CreationDate="2014-10-25T20:15:00.313" Score="-2" ViewCount="1410" Body="&lt;p&gt;I'm trying to do the Hanning Window manually but didn't work, what I'm doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=[0:.1:10];&#xA;x=.5-.5*cos(2*pi*t/102);&#xA;plot(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YKV34.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure why I cant obtain the full hanning window..&lt;/p&gt;&#xA;" OwnerUserId="10555" LastEditorUserId="13475" LastEditDate="2016-05-03T11:44:21.320" LastActivityDate="2016-05-03T14:19:33.910" Title="Hanning Window Formula - Matlab didn't work" Tags="|matlab|window-functions|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18825" PostTypeId="2" ParentId="18824" CreationDate="2014-10-25T20:20:45.097" Score="1" Body="&lt;p&gt;You need to change &quot;102&quot; to &quot;10&quot;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=.5-.5*cos(2*pi*t/10);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-10-25T20:20:45.097" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18828" PostTypeId="1" CreationDate="2014-10-26T06:07:33.213" Score="0" ViewCount="70" Body="&lt;p&gt;What equation best describes the alpha content of a black colored pixel applied to a white pixel when measuring the resulting pixel intensity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;given a white pixel: argb : 255, 255, 255, 255&lt;/li&gt;&#xA;&lt;li&gt;drawing over it with a black pixel: argb : 78, 0, 0, 0 &lt;/li&gt;&#xA;&lt;li&gt;the result is argb : 255, 50.2, 50.2, 50.2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Measuring the pixel's intensity 50.2 should relate an alpha level of 78 when testing for black.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After trying for it, I settled on a rough formula ~&gt;  &lt;strong&gt;A = 1 - (I / 255) ^ 2.193&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here A = alpha, I = intensity. It could be  &lt;strong&gt;1 - I ^ 2.193&lt;/strong&gt;  if the values for I were in the range 0 - 1. This is just a gamma function subtracted from one to orient the values correctly. For white alpha pixels applied to a black image the formula would be  &lt;strong&gt;I ^ 2.193&lt;/strong&gt;.&lt;br&gt;&#xA;This may not be near the solution but I can't dream it up. I may have heard of this equation using a power of &lt;strong&gt;2.2&lt;/strong&gt;, maybe not. Its results are okay, but then again I also liked the results of a linear equation, happily adding 1 level of alpha for each 1 level of intensity less than 255 (white.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really love to read about the science behind this alpha relationship from one of you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT ...&lt;/strong&gt;&lt;br&gt;&#xA;Thanks to Emre my question is answered. And now that I have the solution I have added some figures to turn it into an example...  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tuzS4.jpg&quot; alt=&quot;Image of sphere&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iXrsz.jpg&quot; alt=&quot;Separated image - white part&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/XYqS9.jpg&quot; alt=&quot;Separated image - alpha part&quot;&gt;&lt;br&gt;&#xA;&lt;strong&gt;3 images ~&gt; a sphere separated into a white part and an alpha part&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OZKcM.jpg&quot; alt=&quot;Result obtained using gamma 2.2&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/e8pto.jpg&quot; alt=&quot;Result obtained using Linear relationship&quot;&gt;&lt;br&gt;&#xA;&lt;strong&gt;Images obtained using Gamma 2.2 result and Linear result&lt;br&gt;&#xA;re-applied to white layers, respectively&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fecIQ.jpg&quot; alt=&quot;Wikipedia sRGB image&quot;&gt;&lt;br&gt;&#xA;&lt;strong&gt;Graph from Wikipedia demonstrates the difference between sRGB (standard red green blue) and Gamma 2.2. Here sRGB is the red line plotting the intensity function, and Gamma 2.2 is a black dashed line drawn below the red line. Not much difference&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, &lt;strong&gt;A = 1 - I ^ 2.2&lt;/strong&gt;, is nearly correct choice&lt;/p&gt;&#xA;" OwnerUserId="8777" LastEditorUserId="8777" LastEditDate="2014-11-04T03:41:08.337" LastActivityDate="2014-11-04T03:41:08.337" Title="What equation describes black alpha on a white image?" Tags="|image-processing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18829" PostTypeId="1" CreationDate="2014-10-26T12:45:46.650" Score="1" ViewCount="54" Body="&lt;p&gt;I have a RLC circuit with transformation $$H(s) = \frac{R}{Ls+\frac{1}{Cs}+R}$$ and I know that by setting $s=j\omega$ I can obtain the frequency response of this system. What I don't understand is how I can use the frequency response graph to decide which values I should set on R and f $(L=2\pi f, C=1\mu F)$ to filter out a specific frequency from the input signal $u(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say that I have u(t) which I know consists of two signals, $400 Hz$ and $800 Hz$ (by calculating the amplitude spectrum $U(\omega)$ and plotting the graph). How do I design a filter to filter out one of them?&lt;/p&gt;&#xA;" OwnerUserId="11483" LastEditorUserId="7092" LastEditDate="2014-10-26T14:44:49.487" LastActivityDate="2014-10-26T14:44:49.487" Title="Which values do I use to filter a specific frequency with an RLC circuit?" Tags="|filter-design|" AnswerCount="0" CommentCount="3" ClosedDate="2014-12-02T22:37:15.410" ContentLicense="CC BY-SA 3.0" />
  <row Id="18831" PostTypeId="2" ParentId="18809" CreationDate="2014-10-26T15:53:04.573" Score="2" Body="&lt;p&gt;As JRE said, deconvolution is not what you need.  You need to subtract the known signal from the combined signal to leave the unknown signal by itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signals are baseband signals (I'm aware that yours are modulated- I will get to that later in the answer) then you need to know when the known signal started and how strong it is.  You can get an estimate of both of those things through cross-correlation.  You cross-correlate the combined signal with a clean reconstruction of the known signal.  You should get a strong peak at the location of the known signal.  From this you can determine when the signal started.  You can also estimate the signal amplitude using the peak's amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = \sum\limits_m x[m]r[n+m]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the definition of cross-correlation, where x[n] is the combined signal, r[n] is the reconstructed known signal, and y[n] is the cross-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = \sum\limits_m (s_1[m] + s_2[m] + noise[n])r[n+m] \approx \sum\limits_m s_2[m]r[m]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this equation I have broken x[n] into its constituent parts: $s_1[n]$ (the unknown signal, $s_2[n]$ (the known signal), and noise.  If we assume that $s_1[n]$ does not correlate strongly with $s_2[m]$ then we can simply disregard $s_1[n]$ and the noise term with the understanding that they will both likely add some error to the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the peak's amplitude is approximately equal to $\sum\limits_m s_2[m]r[n+m]$.  Since you know $r[n]$ completely, you can use this value to determine the amplitude of $s_2[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you know the start time and amplitude of $s_2[n]$, you can subtract it out of $x[n]$, leaving only $s_1[n]$, the noise term, and whatever error was in your estimate of $s_2[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the packets are modulated the same basic process is followed, except you will also have to find/determine any carrier offset in $s_2[n]$, and it's phase.  The phase you can get from the cross-correlation peak's phase.  The carrier offset you can find using the fourth power technique (for PSK signals), or by searching for the best cross-correlation result at various carrier offsets.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-10-26T15:53:04.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18832" PostTypeId="2" ParentId="17437" CreationDate="2014-10-26T19:51:59.847" Score="0" Body="&lt;p&gt;if you have a collection of feature templates, i s'pose cross-correlating the templates against the input sequence might show some of these features in the input.  this is essentially what a &lt;em&gt;&quot;matched filter&quot;&lt;/em&gt; does.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-10-26T19:51:59.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18833" PostTypeId="2" ParentId="17437" CreationDate="2014-10-26T20:22:03.657" Score="1" Body="&lt;p&gt;This seems very much like a fit for Hidden Markov Models (HMM). They are pretty powerful in handling sequence based input such as time series.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-10-26T20:22:03.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18834" PostTypeId="1" CreationDate="2014-10-26T20:27:16.447" Score="1" ViewCount="217" Body="&lt;p&gt;We are doing a test which consists in sending a waveform from Matlab to the signal generator SMB100A and sending it through a cable to the r&amp;amp;s spectrum analyzer just to have a channel. We set the trigger manually in the signal generator in the restart mode, then we set the frequency and the chip rate in our Matlab code as well as the buffer size and the connections. Finally, we read the waveform, which is already stored in the signal generator , and we set ARB state ON: we are using the arbitrary customized digital modulation. However, the channel impulse response is different every time that we run the test: there is a portion of the signal that looks like an offset; we think the signal is shifted because of an inversion in the phase. Any clue about why this happens?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DUMQe.png&quot; alt=&quot;Channel 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ajz0T.png&quot; alt=&quot;Channel 2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11502" LastEditorUserId="923" LastEditDate="2014-10-27T22:58:39.030" LastActivityDate="2014-10-27T22:58:39.030" Title="generating a waveform in matlab for rohde and schwarz signal generator" Tags="|matlab|discrete-signals|wave|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18836" PostTypeId="1" AcceptedAnswerId="18837" CreationDate="2014-10-27T08:03:14.067" Score="2" ViewCount="4333" Body="&lt;p&gt;According to wikipedia Onset detection:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Onset refers to the beginning of a musical note or other sound, in&#xA;  which the amplitude rises from zero to an initial peak. It is related&#xA;  to (but different from) the concept of a transient: all musical notes&#xA;  have an onset, but do not necessarily include an initial transient.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And the Pitch detection&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A pitch detection algorithm (PDA) is an algorithm designed to estimate&#xA;  the pitch or fundamental frequency of a quasiperiodic or virtually&#xA;  periodic signal, usually a digital recording of speech or a musical&#xA;  note or tone. This can be done in the time domain or the frequency&#xA;  domain or both the two domains.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The two definitions are clear to me. Onset tries to find the start of a musical note, pitch detection tries to detect the fundamental frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The confusion arise, because I think of the two concepts as highly related. For example if I want to track a musical note doesn't it mean that I already detected the pitch? or that frequency could be a harmonic and not the fundamental frequency ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain if the two are significantly different, or it's just a matter of different context of the same concept; tracking specific frequency vs tracking when that frequency starts.&lt;/p&gt;&#xA;" OwnerUserId="7918" LastActivityDate="2014-10-27T18:48:13.230" Title="What is the difference between pitch detection and Onset detection?" Tags="|audio|pitch|music|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18837" PostTypeId="2" ParentId="18836" CreationDate="2014-10-27T09:21:35.607" Score="5" Body="&lt;p&gt;The two concepts are related to two different dimensions or aspects of music which might or might not be correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Onset detection is concerned with finding the points in time at which sounds start. Doing this does not require prior knowledge of the particular pitch (or fundamental frequency) of the sound. It may indeed rely on the property that at the beginning of a sound, there is an increase of energy. Actually, you can very well perform onset detection on recordings which do not have a well-defined pitch (for example: drums, machine noises...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of pitch and onsets/rhythm as related to the &quot;vertical&quot; and &quot;horizontal&quot; organization of music. There exists types of material in which changes along these two dimensions coincide - so that a detection algorithm can take advantage of a change in one dimension to infer that a change has occurred on the other dimension. But this coincidence/correlation is contingent.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-10-27T17:58:24.897" LastActivityDate="2014-10-27T17:58:24.897" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18839" PostTypeId="1" CreationDate="2014-10-27T14:56:40.913" Score="1" ViewCount="313" Body="&lt;p&gt;I am using Audio Precision 2700 to test some test vectors.&lt;/p&gt;&#xA;&lt;p&gt;I have connected resistor banks as class - d power amp's load, and tap from this resistor using a XLR cable to the AP.&lt;/p&gt;&#xA;&lt;p&gt;When my power amp is powered up, but no song is playing(song is paused, not muted) i checked fft spectrum of the input channel , i get the following spectrum&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g2nx6.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can see the three peaks in frequency above 4k. (Likely, the 3 peaks in frontier band upto 200 hz). Which causes this harmonics?&lt;/p&gt;&#xA;&lt;p&gt;The test vector is playing at 48khz.&#xA;&lt;strong&gt;Note&lt;/strong&gt; : There's a passive filter after the power amp's output having cut off at 30khz.&lt;/p&gt;&#xA;&lt;p&gt;Please point me some insight. Does the passive filter aliases the input signal, so that i get undesired signal at folded frequency?[This is my initial doubt, because this is what i believe should be the cause, if it's not then some one please tell me why this couldn't be the problem]&lt;/p&gt;&#xA;&lt;p&gt;Thanks folks in advance...&lt;/p&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-09-23T07:35:16.637" Title="Why these harmonics always present?" Tags="|audio|signal-analysis|continuous-signals|signal-detection|measurement|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="18840" PostTypeId="1" CreationDate="2014-10-27T15:21:51.270" Score="1" ViewCount="514" Body="&lt;p&gt;I'm reading a paper where image classification is done. Their approach is to use the discrete wavelet transform with bi-orthogonal wavelets of degree 3.5 and decomposition of level 3 on images. Based on the 2d coefficients gotten from the DWT they calculate statistical features such as standard deviation, skew, kurtosis, mean, absolute deviation. These statistical features are used as input for classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is now, are these statistical features based on the DWT rotation/scale/translation invariant ? I personally do not think so. But I can't motivate my answer. Can someone explain this, I'd appreciate if you can quote a source if you anwer.&lt;/p&gt;&#xA;" OwnerUserId="569" LastEditorUserId="128" LastEditDate="2023-07-16T09:12:40.957" LastActivityDate="2023-07-16T09:12:40.957" Title="Are discrete wavelet transform based statistical features invariant to rotation/translation/scale?" Tags="|image-processing|wavelet|machine-learning|statistics|feature-extraction|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18841" PostTypeId="1" CreationDate="2014-10-27T17:43:17.170" Score="1" ViewCount="764" Body="&lt;p&gt;So if I were to have an $n$ length sample of a given sample rate and were to run it through an FFT, resulting in $n$ complex elements. How would I obtain the frequency bins, such that if I know the frequency of some noise, I can remove the noise?&lt;/p&gt;&#xA;" OwnerUserId="11508" LastEditorUserId="7092" LastEditDate="2014-10-27T18:07:55.557" LastActivityDate="2014-10-27T19:04:18.763" Title="Removing frequency using FFT" Tags="|fft|discrete-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18842" PostTypeId="2" ParentId="18836" CreationDate="2014-10-27T18:43:00.540" Score="2" Body="&lt;p&gt;okay, you can do pitch detection without onset detection.  that's for sure.  when you do pitch detection and the input is either mostly silent or not well pitched, usually the pitch detector will not update the pitch value from whatever was the most recent &quot;good&quot; pitch value.  also not-well-pitched sounds normally have a very low &quot;periodicity measure&quot; because the signal is not periodic nor quasi-periodic.  the &lt;strong&gt;attack&lt;/strong&gt; of pitched notes will also have a low periodicity measure and that information can sometimes be useful for onset detection.  sudden changes of pitch over more than a semitone can also be used for onset detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, in a typical audio-to-MIDI scheme, first pitch detection is done with results are more than just the pitch.  the output of the pitch detector will also have an amplitude parameter, a periodicity parameter (sometimes called &quot;pitch confidence&quot;), perhaps a timbre parameter (or a couple of timbre parameters), in addition to pitch.  a good onset detector might make use of all 3 or 4 parameters and look for &lt;em&gt;change&lt;/em&gt; or &lt;em&gt;&quot;novelty&quot;&lt;/em&gt; and will combine those parameters in an alchemical fashion to make the best guess of whether and when the onset is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;also check on &lt;a href=&quot;http://grfia.dlsi.ua.es/repositori/grfia/pubs/238/PI.pdf&quot; rel=&quot;nofollow&quot;&gt;publications like this&lt;/a&gt; and &lt;a href=&quot;http://pdf.aminer.org/000/439/233/using_a_pitch_detector_for_onset_detection.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.  changes in pitch are &lt;strong&gt;definitely&lt;/strong&gt; a cue about note onsets.  i just &lt;strong&gt;must&lt;/strong&gt; disagree with pichenettes original answer that they have nothing (or even little) to do with each other.  if you're humming a tune, changes in pitch might be the &lt;strong&gt;only&lt;/strong&gt; physical parameter that you hear changing to clue you in to the fact that there is a new note.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-10-27T18:48:13.230" LastActivityDate="2014-10-27T18:48:13.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18843" PostTypeId="2" ParentId="18841" CreationDate="2014-10-27T19:04:18.763" Score="1" Body="&lt;p&gt;If the noise is extremely narrow-band (a perfect sinusoid), exactly integer periodic within the length n samples, and completely disjoint in the frequency domain from the non-noise signal of interest, then you might be able to zero FFT bin number (F_noise * n / F_sample_rate) and IFFT the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the noise is wide band, or of a frequency not exactly at an FFT result bin center, then a time domain filter might be more suitable from removing noise without serious distortion artifacts.  Although you might be able to use an FFT/IFFT overlap add/save algorithm method to implement a time-domain FIR filter.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-10-27T19:04:18.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18844" PostTypeId="2" ParentId="18839" CreationDate="2014-10-27T19:17:30.340" Score="1" Body="&lt;p&gt;If your class-D amplifier's switching frequency is 5 kHz above a multiple of the sample rate of your audio analyzer, then the aliases of the attenuated harmonics of the switching frequency will march upwards in frequency by 5 kHz across (and around) the spectrum displayed by the analyzer, until they disappear below the noise floor of the system and analyzer.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-10-27T19:17:30.340" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18846" PostTypeId="1" CreationDate="2014-10-27T22:45:51.867" Score="5" ViewCount="1219" Body="&lt;h1&gt;Question:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Is there any software, source-code, or well documented and easily implementable research (I am not afraid for a little bit of Python) to do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take two similar videos from different sources (say a video file obtained from a VHS and a video file ripped from a DVD) and map an estimated time difference between the videos (this may not be based on the audio):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;video1 : video2   (in seconds)&#xA;0.00   : 2.00&#xA;1.00   : 3.10&#xA;2.00   : 4.20&#xA;3.00   : 5.25&#xA;4.00   : 6.30&#xA;5.00   : 7.33&#xA;6.00   : 8.38&#xA;7.00   : 9.40&#xA;8.00   : 10.50&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Possible avenue for implementation:&lt;/h1&gt;&#xA;&#xA;&lt;h2&gt;Convert video to a 1D time signal:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A simple solution might be to create a 1D signal by taking the average of each frame. Each signal from each video can then be splitted up into windows and be correlated to find the phase difference (the mapping between the two).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We might start by marking the same &quot;start&quot; and &quot;finish&quot; of the videos (it would obvious be at the same timestamps as our signals) and apply a transformation to scale video-signal-2 to the same time-size as video-signal-1. We can then proceed with the window matching as described above, find the mapping we are looking for and then apply the inverse of the transformation on the video 2 side of the mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some results. You can clearly see a correlation between the two video's. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Comparison between two similar video signals (frame# as x-axis):&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cQOP7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A video frame comparison:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8Xq20.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The videos I used for this example is from the series &lt;em&gt;Heidi: girl in the alps&lt;/em&gt;. The frame on the left is from a foreign rip, while the frame on the right is from a Afrikaans DVD I bought in South Africa (&lt;a href=&quot;http://www.takealot.com/afrikaanse-kinder-bundel-met-heidi-pinocchio-en-nils-holgersson/PLID32819763&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.takealot.com/afrikaanse-kinder-bundel-met-heidi-pinocchio-en-nils-holgersson/PLID32819763&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the extremely poor quality of the Afrikaans DVD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;It does not work yet:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A question regarding this approach is how do we correlate these signals? I tried normal correlation (the fft route), but unfortunately the signal is not zero-mean and therefore it is quite difficult to obtain a correct phase shift. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried high-pass filter this result, but the resulting signal is quite a mess and still does not correlate well.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Edit: (I got it working)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I used a new metric for the frames - I now used the mean of the right half of the frame minus the mean of the left half (now my data are more zero-mean). I normalise my data and use a high pass filter to convert my signal to a zero-mean signal (3rd order Butterworth filter). This is the result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7OfdD.png&quot; alt=&quot;Video frame data high-pass-filtered and Hamming-windowed&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initiated a mapping as &lt;code&gt;range(length)&lt;/code&gt; (a 1:1 mapping) and shifted the mapping according to the global phase shift (from phase correlating the signals).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then updated the mapping by repeating the following a few times:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;chose arbitrary sized (which change every iteration) time windows to chop the two signals into $n$ equal parts,&lt;/li&gt;&#xA;&lt;li&gt;used phase correlation to get the phase differences between part $i$ of signal 1 and signal 2 for $i \in 1,2,...,n$ ,&lt;/li&gt;&#xA;&lt;li&gt;added a Gaussian of that length with amplitude as the phase difference to the mapping (at the appropriate interval),&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Finally I applied the mapping to the video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is the final fit between the two time-series (each dot represents a frame):&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/73xRn.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2HbFv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;And here is a graph representing the lag (in frames) between the videos:&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uWxb3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Why I want this:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;My goal is find a mapping between Afrikaans dubbed videos from VHS, against foreign language DVDs/Blurays of the same video. I want to stretch the Afrikaans audio to fit the DVD/bluray's video according to this obtained mapping and then mux the video and audio tracks. As a result I will have superior video quality (compared to the original VHS video) with an Afrikaans audio track.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the foreseeable problems would be where some discontinuity is introduces (such as a advertisement in the VHS recording where a direct scene transition would be in the DVD). I will overcome this by filling discontinued audio with blank noise (or maybe a bit of white noise) in the one case or cutting out some audio in the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done this once with a video by time-distorting the audio manually, but I currently have a whole folder with such similar videos and thought to maybe write some code to do this automatically.&lt;/p&gt;&#xA;" OwnerUserId="11510" LastEditorUserId="11510" LastEditDate="2016-01-06T20:53:59.030" LastActivityDate="2016-01-06T20:53:59.030" Title="Map time difference between two similar videos" Tags="|cross-correlation|video-processing|" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18847" PostTypeId="2" ParentId="18846" CreationDate="2014-10-27T23:42:34.177" Score="2" Body="&lt;p&gt;To compute an offset between the two signals in the first image, I think that phase-correlation will give you much better results, than simply the basic correlation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can reuse your fft code but have to normalize your fft coefficients to unit magnitude prior to your inverse-fft, so the phase-correlation is based only on phase information and is insensitive to changes in magnitude/intensity.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2014-10-27T23:42:34.177" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18848" PostTypeId="2" ParentId="18846" CreationDate="2014-10-28T00:16:12.350" Score="2" Body="&lt;p&gt;Naive question: is it very common for the relationship between the two sequences of timestamps (the &quot;warping function&quot;) to be something else than a linear function? I assume it'll be almost always linear, in which case you just need to match two points (say the first and the last non-black frame), and then you can interpolate between that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to do something more robust, for different types of warping functions, you're on the right track by extracting a 1-D signal from the video. I would suggest the following normalization scheme: $x_{norm}(t) =\frac{x(t) - \mu(t)}{\sigma(t)}$ where $\mu(t)$ and $\sigma(t)$ are the mean and standard deviation of the signal in a 5s or 10s long window centered at time $t$ (replace mean and standard deviation by median and interquartile range if your data is too noisy). This works as a high-pass filter and ensures you're comparing two signals with a similar magnitude. You can then find the optimal alignment between the two with &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_time_warping&quot; rel=&quot;nofollow&quot;&gt;Dynamic Time Warping&lt;/a&gt; (DTW). If you know that the warping function between the two signals is piecewise linear (time offset and speed difference), you can fit a line through segments of the optimal path found by DTW to get a time offset and a speed ratio for each of these segments.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-10-28T00:24:01.880" LastActivityDate="2014-10-28T00:24:01.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18849" PostTypeId="2" ParentId="3581" CreationDate="2014-10-28T00:34:40.440" Score="1" Body="&lt;p&gt;I think the key is, if you have 16 bit values and your adding 2 values together that could potentially be more then the maximum value, then you have 2 options:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) cast both to 32 bit add then return the maximum value if the addition exceeds that value.  Then cast it back to 16 bits.  For example if your values are 32768 and 34567 it exceeds 65535 and the key is to then return 65535.   You would do the same thing if using signed values at the minimum value end.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) compress both values, then add them together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is essentially hard clipping, the second is soft clipping.  Analog systems are all hard clipping.  &lt;/p&gt;&#xA;" OwnerUserId="11511" LastActivityDate="2014-10-28T00:34:40.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18850" PostTypeId="1" CreationDate="2014-10-28T01:57:31.230" Score="0" ViewCount="194" Body="&lt;p&gt;The question says it all. In typical (wavelet-like) decomposition of a signal, why is only the low pass component chosen for successive decomposition ?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastEditorUserId="4515" LastEditDate="2014-10-28T15:57:58.403" LastActivityDate="2014-10-28T15:57:58.403" Title="Why is successive decomposition of a signal performed only on low pass component?" Tags="|wavelet|filtering|decomposition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18851" PostTypeId="1" AcceptedAnswerId="18858" CreationDate="2014-10-28T02:04:02.873" Score="0" ViewCount="87" Body="&lt;p&gt;There are a plethora of tools, both commercial and free, which I have found online for designing filters. The ones I have tried (so far) prompt for frequency response, number of steps (for FIR), then generate coefficients and a frequency response plot.&lt;p&gt;&#xA;&lt;strong&gt;Question&lt;/strong&gt;: are there any particular sites or programs, which allow you to input or modify the coefficients? Free would be preferable, but (especially for an FIR with a large number of taps) commercial will do in a pinch.&lt;br&gt;&#xA;(Matlab is too expensive for me, but I've heard of freeware Octave: if anyone recommends it for filter design I'd be willing to try it out)&lt;/p&gt;&#xA;" OwnerUserId="11512" LastActivityDate="2024-03-17T10:52:15.007" Title="Filter design / Analysis apps" Tags="|filter-design|" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18855" PostTypeId="1" CreationDate="2014-10-28T09:05:21.660" Score="0" ViewCount="190" Body="&lt;p&gt;I have some MP3s that are encoded at 44.1kHz with a bitrate of 160kbps. I hook these up to my car using an FM transmitter and the sound quality isn't particularly great. Low and high notes sound distorted and crackly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that I'll need to reduce the sampling frequency, but I am not sure. Reading up on FM broadcast radio, it seems that the FM radio channels have a bandwidth of 75kHz, so I do not understand why my audio sounds crackly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get my MP3s to play without crackling over FM radio?&lt;/p&gt;&#xA;" OwnerUserId="11513" LastActivityDate="2014-10-28T11:15:52.773" Title="Downsampling MP3 for FM broadcast" Tags="|downsampling|mp3|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18856" PostTypeId="2" ParentId="18850" CreationDate="2014-10-28T09:17:05.330" Score="1" Body="&lt;p&gt;Wavelets decomposition separates out the details/fluctuations/high-pass information from the image or signal. At each step details are separated out from the remaining of the signal. The processing is therefore only applied on the coarse part not the part that already has the details.      &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-10-28T09:17:05.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18857" PostTypeId="2" ParentId="18850" CreationDate="2014-10-28T09:20:08.150" Score="1" Body="&lt;p&gt;A filter bank is just one specific implementation of the wavelet transform. Typically wavelets are motivated and defined differently, namely as a family of (orthogonal) basis functions that are generated from a mother wavelet by translation and time scaling. It turns out that such a family can only be an orthogonal basis if the time-frequency plane is divided into a so called dyadic grid, pictured in this &lt;a href=&quot;http://www.ndt.net/article/v07n09/08/fig4.gif&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;. The resulting basis transform is then called the discrete wavelet transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This specific discrete wavelet transform comes with a fast algorithm, realised by recursive high and low pass filtering and downsampling. The first high pass filter creates the top most row of coefficients in the dyadic grid. The low pass component still contains the full information required for all the other rows. Taking the low pass component through the high pass filter again generates just the next row, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's helpful to not think of the filter bank as the defining property of the wavelet transform but just as a fast algorithm that returns the right result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, there are approaches to adapt the time-frequency decomposition to the signal content, grouping and subdividing filter bank bands as it appears useful. Mathematically, those approaches cannot be understood in terms of wavelets however.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-10-28T09:26:59.437" LastActivityDate="2014-10-28T09:26:59.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18858" PostTypeId="2" ParentId="18851" CreationDate="2014-10-28T10:45:18.660" Score="1" Body="&lt;p&gt;I believe that Octave and Python/Scipy are the most commonly used free software packages for digital signal processing (including filter design). They offer of course much more than you might be looking for. On the other hand, if you want to play around with the coefficients and get some quick feedback, it might be very helpful to have one of these (or similar) packages because then you can easily modify the filter, plot frequency responses, and even write your own little programs if necessary. I've used Octave for that purpose and for me it worked fine. If you use Octave, you'll need to install the signal processing toolbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A totally different approach would be to choose your favorite programming language and write some simple routines yourself. This is perfectly feasible for some common FIR design methods (such as windowing). In combination with some plotting software this may be all you need. In this case I would consult &lt;a href=&quot;http://dsp-book.narod.ru/DSPMW/11.PDF&quot; rel=&quot;nofollow&quot;&gt;this document&lt;/a&gt; on digital filtering. This latter approach is of course not the most efficient one because you'll be re-inventing the wheel, but in this way you'll learn how it all works and you will not just be using a black box design method.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-28T10:45:18.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18859" PostTypeId="2" ParentId="18855" CreationDate="2014-10-28T11:15:52.773" Score="3" Body="&lt;p&gt;MP3 doesn't really go as high as 44.1 kHz anyway. The first step in compression filters out audio above 18 kHz, so a 36 kHz sample rate would have been sufficient. But that's not really the problem anyway. FM is analog and therefore doesn't even &lt;em&gt;have&lt;/em&gt; a sample rate. A sample rate is the rate at which digital samples are taken. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FM &lt;em&gt;does&lt;/em&gt; have bandwitdh, as you figured out. But the 75 kHz radio bandwidth isn't directly equivalent to 75 kHz audio bandwidth. In fact, that's the whole point of FM. AM is the modulation type for which the correspondence is a lot easier, just a factor of 2. (That's because they send the same information both below and above the center frequency, for simplicity and quality - single side band radio eliminates that factor of 2 for a slightly lower quality). But this simplicity means AM has a low audio quality - best for voice. FM uses a more robust modulation (encoding) so that the audio amplitude becomes a radio frequency change. As a result, the radio signal amplitude isn't that important anymore. And it's that amplitude which is most easily disturbed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Effectivey you get 15 kHz audio bandwidth out of FM - a lot better than the 5 or so that AM gives you. Still, you lose about 3 kHz from the MP3 signal. In your case, that's probably just one of the causes. The limited MP3 bitrate causes some distortion, too, as does the whole digital-&gt;analog-&gt;FM path. They all add up. The easiest fix would be to obtain better quality MP3's, or a digital connection to your car sound system.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2014-10-28T11:15:52.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18861" PostTypeId="1" AcceptedAnswerId="18870" CreationDate="2014-10-28T13:17:42.770" Score="0" ViewCount="180" Body="&lt;p&gt;I was trying to solve the following problem . &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given an input x[n], consider upsampling by 2, followed&#xA;  by interpolation with a filter having z-transform H(z) for magnification of the signal.&#xA;  Then, to recover the original signal size, apply filtering by a decimation filter G(z) followed&#xA;  by downsampling by 2, in order to obtain a reconstruction ˆx[n].&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;using the results for upsampling as $Y(z) = X(z^2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and downsampling as $Y(z) = X(z^{1/2})+X(-z^{1/2})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I obtained&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{X}(z) = 1/2\bigg(G(z^{1/2})H(z^{1/2})X(z) + G(-z^{1/2})H(-z^{1/2})X(-z)\bigg)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however, the solution is listed as ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{X}(z) = 1/2X(z)\bigg(G(z^{1/2})H(z^{1/2}) + G(-z^{1/2})H(-z^{1/2})\bigg)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where have i gone wrong ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I solved in the following process ..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A(z) = X(z^2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B(z) = H(z)A(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C(z) = G(z)B(z))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{X}(z) = 1/2[C(z^{1/2})+C(-z^{1/2})]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and substituted them in a chain.&lt;/p&gt;&#xA;" OwnerUserId="11519" LastActivityDate="2015-04-27T01:29:44.237" Title="Perfect reconstruction ( Single Channel )" Tags="|filters|downsampling|supersampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18862" PostTypeId="1" CreationDate="2014-10-28T13:33:26.597" Score="3" ViewCount="2790" Body="&lt;p&gt;I am trying to generate a multitone signals with low crest factor and as suggested in the &lt;a href=&quot;https://web.stanford.edu/~boyd/papers/pdf/multitone_low_crest.pdf&quot; rel=&quot;nofollow&quot;&gt;Boyd's paper&lt;/a&gt; I am using the quadratic phase distribution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Phase(k) = \pi(k - 1)(k - 1)/N$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the number of tones in the signal and $k$ their frequency indexes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This formula works well, giving the expected crest factor ($CF &amp;lt;= 2$), only if the frequency indexes are strictly sequential (e.g. $k = 2,3,4,...$) but if the indexes are not sequential (e.g. $2,5,7,11,...$) or, even worst, logarithmically distributed (e.g. $1,2,4,8,...$) the resulting $CF$ is very often much higher than $2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I played quite a lot with the above formula, trying differ combination of $k$ and $ N$, but without any success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is strange, to me, is that the lowest $CF$ is always obtained by using sequential $k$ values ($k = 1,2,3,4,...$), regardless of the actual position of the frequency index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to complete the story, using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Rudin%E2%80%93Shapiro_sequence&quot; rel=&quot;nofollow&quot;&gt;Shapiro-Rudin sequence&lt;/a&gt; I get more or less the same behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is: do you know a way to amend the above formula to get low $CF$ with any arbitrary frequency index distribution or another phase generator algorithm suitable for this scope?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ciao and many thanks for the attention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Franco&lt;/p&gt;&#xA;" OwnerUserId="11520" LastEditorUserId="7092" LastEditDate="2014-10-28T15:39:43.980" LastActivityDate="2014-11-02T15:03:03.723" Title="Multitone signals with low crest factor" Tags="|algorithms|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18863" PostTypeId="2" ParentId="18851" CreationDate="2014-10-28T14:08:54.627" Score="1" Body="&lt;p&gt;In addition to Octave and SciPy, there is GnuRadio, which is also open source. They have a very nice interactive, graphical filter design tool, where you can play with filter's poles and zeros and see the effect immediately. It is not very well documented, though. There are some demos and tutorials on YouTube. A description is &lt;a href=&quot;http://gnuradio.squarespace.com/home/2012/12/19/update-on-filter-design-tool.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-28T14:08:54.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18864" PostTypeId="2" ParentId="18862" CreationDate="2014-10-28T14:52:49.937" Score="1" Body="&lt;p&gt;okay, there is a slightly newer paper by Ivo Mateljan titled &lt;a href=&quot;https://www.researchgate.net/publication/3830492_Signal_selection_for_the_room_acoustics_measurement&quot; rel=&quot;nofollow&quot;&gt;Signal selection for the room acoustics measurement&lt;/a&gt;.  i ended up reviewing the paper for the 1999 IEEE Mohonk conference, and when it turned up that Ivo was not going to make it to the conference to present the paper, they ask a reviewer to sorta stumble through the issues of the paper.  i ended up talking about &lt;a href=&quot;http://www.dspguru.com/dsp/tutorials/a-little-mls-tutorial&quot; rel=&quot;nofollow&quot;&gt;what's wrong with MLS&lt;/a&gt; more than about Ivo's technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you cannot get a copy of Ivo's paper (it costs money from IEEE), email me and i will send a pdf to you.  in that paper he has a section titled &lt;em&gt;The Low-Crest Multisine&lt;/em&gt; which i paste in the text below.  perhaps you can modify it to fit with your selected frequencies.  i dunno.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i still haven't figured out SE's formatting to make the code look like code.  someone else can edit this answer to do that.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Various algorithms were proposed for lowering the multisine crest factor. The following algorithm is slight modification of algorithms proposed in [9] and [10]. It has fast convergence and resulting multisine has good phase randomisation property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Algorithm: Low-crest multisine (LCMS) generation.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate uniform random sequence &lt;code&gt;u&lt;/code&gt; of length &lt;code&gt;N&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Transform the sequence to random sign sequence &lt;code&gt;s&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    for i = 1 : N &#xA;&#xA;        if (u(i) &amp;gt; 0.5) &#xA;&#xA;            s(i) = 1 &#xA;&#xA;        else &#xA;&#xA;            s(i) = -1 &#xA;&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate the multisine using the phase values of DFT(s).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the number of iterations is less then 10, clip the time series to 85% of the maximum value, else clip to 90% of the maximum value.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply DFT to the clipped time series.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate the new multisine using the phase values obtained in the step 5.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the crest factor. If it is higher than objective value go to the step 4.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Although there is no proof for the convergence of this&#xA;algorithm, it has never failed in a more than thousand runs with&#xA;different starting seed factor. The number of iterations grows&#xA;exponentially when decreasing crest factor. For a multisine&#xA;sequence of length 32768 it needs only 4-5 iterations to halve the&#xA;crest factor from 4 to 2, but to get the crest factor &amp;lt; 1.5 it needs&#xA;several hundreds or more than thousand iterations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase randomisation properties of this signal can be&#xA;estimated by testing how it distributes nonlinear distortion in the&#xA;estimated PIR. The following numerical experiment is done.&#xA;The input sequence of length 4096 drives 9th order bandpass&#xA;Butheworth filter (0.1-0.3 fs). The output signal is distorted with&#xA;2nd and 3rd order nonlinearities, which are equivalent to 1% of 2nd&#xA;harmonic distortion and 0.7% of the 3rd harmonic distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Impulse response is estimated using crosscorrelation and scaled&#xA;to maximum value 1. Tables I and II show the rms and peak level&#xA;of the impulse response distortion (in percentage of the maximum&#xA;value). First 50 values of the impulse response are excluded from distortion calculation to better estimate peak/rms tail distortion. Also, the crest factor of the generated discrete sequence and a crest factor at the filter output are shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These results show that low-crest multisine generates the same level and a distribution of distortions as a true random phase multisine, regardless the crest factor value. MLS sequence generates slightly lower distortion rms level (1-1.5dB), but peak/rms ratio is much higher, especially with 2nd order distortion (10dB higher than with multisine excitation). This high peak/rms ratio disqualifies MLS as a reliable excitation signal for echo detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For all type of an excitation signal the crest factor at the filter output is almost the same. This is a general conclusion for narrow band systems. The benefit of using signals with lower crest factor is significant only for wideband systems, and when it is necessary to use all of the available measurement dynamic range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;RPMS is the only signal, which do not exhibit a significant crest factor transformation. This fact, constant amplitude and true random phase property fully qualify it as a periodic white noise signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[9] Schoukens, J., Pinelton, R., Ven der Ouderaa, E., and Renneboog, J., &quot;Survey of Excitation Signals for FFT Based Signal Analysers&quot;, IEEE Trans. Instrumentation and Measurement, vol. 37, September 1988.&#xA;[10] Ven der Ouderaa, E., Schoukens, J., and Renneboog, J., &quot;Peak Factor Minimisation of Input and Output Signals of Linear Systems&quot;, IEEE Trans. Instrumentation and Measurement, vol. 37, June 1988.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="7092" LastEditDate="2014-10-28T17:15:05.983" LastActivityDate="2014-10-28T17:15:05.983" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18865" PostTypeId="2" ParentId="18862" CreationDate="2014-10-28T15:03:22.957" Score="0" Body="&lt;p&gt;Basically what RBJ said. Iteration can do this effectively. Below is crude (but working) example that creates a low-ish crest factor for a signal with a few hundred random frequencies and gains.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% script to do a mutlitone low crest factor noise signal&#xA;nx = 8192; % fft grid&#xA;nf = 200; % number of frequencies&#xA;% create a random set of frequencies and gains&#xA;ifr = round(nx/2*rand(nf,1))+1;&#xA;% gains from -10dB to 0 dB&#xA;gains =  10.^(.05*(-10 + 10*rand(nf,1)));&#xA;&#xA;% initialize&#xA;phi = 2*pi*rand(nf,1); % random phase&#xA;fx0 = zeros(nx/2+1,1);&#xA;fx = fx0;&#xA;fx(ifr,:) = gains.*exp(1i*phi);&#xA;fx0(ifr,:) = gains;&#xA;&#xA;%% main iteration loop&#xA;numIter = 1000;&#xA;for i = 1:numIter&#xA;  % make conjugate symmetric&#xA;  fx1 = [fx; conj(fx(end-1:-1:2))];&#xA;  % time domain&#xA;  x = ifft(fx1);&#xA;  % clip at a target crest factor of 2&#xA;  xmax = 2*rms(x);&#xA;  x( x &amp;gt; xmax)= xmax;&#xA;  x( x &amp;lt; -xmax) = -xmax;&#xA;  % go back to frequency domain&#xA;  fx1 = fft(x);&#xA;  % transfer phase&#xA;  fx(ifr,:) = gains.*fx1(ifr,:)./abs(fx1(ifr,:));&#xA;end&#xA;% final time domain signal&#xA;fx1 = [fx; conj(fx(end-1:-1:2))];&#xA;% time domain&#xA;x = ifft(fx1);&#xA;fprintf('final crest factor = %f\n', max(abs(x))./rms(x));  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-10-28T15:03:22.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18869" PostTypeId="1" AcceptedAnswerId="18871" CreationDate="2014-10-28T21:14:55.123" Score="-1" ViewCount="1768" Body="&lt;p&gt;Is there any way to use as single input an image (256x256 pixels) and get output of single value using Matlab neural network toolbox&lt;/p&gt;&#xA;" OwnerUserId="11529" LastActivityDate="2014-10-29T00:11:25.983" Title="Matlab Neural Network toolbox" Tags="|image-processing|matlab|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18870" PostTypeId="2" ParentId="18861" CreationDate="2014-10-28T21:52:02.743" Score="2" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt; Note that if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=X(z^2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then obviously&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z^{1/2})=X(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but also&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(-z^{1/2})=X((-z^{1/2})^2)=X(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which the desired result follows in a straightforward way.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-28T21:52:02.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18871" PostTypeId="2" ParentId="18869" CreationDate="2014-10-28T23:40:24.657" Score="1" Body="&lt;p&gt;Sure, import the image to the matlab workspace, divide the image matrix into two dimentional matrices like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;matrix1 = yourimage(:,:,1);&#xA;matrix2 = yourimage(:,:,2);&#xA;matrix3 = yourimage(:,:,3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;each being one colour component-as &lt;a href=&quot;http://www.mathworks.com/help/nnet/ref/nntool.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;nntool&lt;/code&gt;&lt;/a&gt; works with up to bidimensional matrices- and use them in the &lt;code&gt;nntool&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11530" LastEditorUserId="7092" LastEditDate="2014-10-29T00:11:25.983" LastActivityDate="2014-10-29T00:11:25.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18872" PostTypeId="1" CreationDate="2014-10-29T02:39:35.307" Score="1" ViewCount="210" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Let $s(t)$ be a signal that can be approximated by a uniform spline&#xA;  function of order $K$ (say $K=2$): $$s(t)\approx\sum_{n\in \mathbb{Z}}c_n\beta_+^{(K)}(t-n) $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Suppose that we know the values of $s(t)$ at integer locations&#xA;  $s(n)=x[n]$. Develop and implement a filter-based algorithm to recover&#xA;  sequence $c_n$ from $x_n$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;With the coefficient sequence $c_n$ we can easily compute the sampled&#xA;  version of the derivative or fractional translation of $s(t)$, i.e.&#xA;  $s(n)$ and $s(n+\tau)$ where $\tau$ is a fractional number. Test your&#xA;  results with function $s(t)=\sin(2\pi \cdot 0.001\cdot t)$for $t\in [0,100]$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Check the attached problem please. I am a beginner in spline fitting and have a few questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) How to find the coefficients $c[n]$. Is it by DTFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I understand how to find the derivative but not sure about how to deal with fractional translation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) What's the right function in Matlab to obtain the (discrete) samples of a uniform spline function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="11532" LastEditorUserId="8202" LastEditDate="2014-11-02T09:15:36.000" LastActivityDate="2014-11-02T09:15:36.000" Title="MATLAB implementation Spline Fitting" Tags="|matlab|filters|homework|interpolation|approximation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18873" PostTypeId="1" AcceptedAnswerId="19022" CreationDate="2014-10-29T03:52:24.707" Score="2" ViewCount="1342" Body="&lt;p&gt;So I was working on a program to comparing the similarity between the pronunciation of a word, First I got the audio file, and I use FFT on it to get the amplitude over frequency array, then I just square everything to get the Energy Spectral Density of it. The graph that can be drawn from those frequency of 4 sample of the same word I spoke myself look very similar to each other as shown in the picture I included here. All 4 sample have 2000 value, represent frequency from 0 to ~800Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since even when it's me saying the word 4 times, the frequency of the word cant be the same everytime I say that word, the graphs look visually similar but they are a few sample different from each other, like the 2nd highest point in the first graph is at the value number 1150, the 2nd graph have it at 1124, the 3rd have it at 1132 and the 4th have it at 1160, same thing happen with the first peak. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: how do I actually compare these 4 graph together to show how similar they are? Since what I was suggested to do the first time around was to using Mean Square Error but they didnt work well due to the slight different everywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QothA.png&quot; alt=&quot;4 sample&amp;#39;s graph&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10410" LastActivityDate="2014-11-06T07:29:26.433" Title="Find similarity of sound signal" Tags="|fft|signal-analysis|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18874" PostTypeId="1" CreationDate="2014-10-29T05:51:22.490" Score="4" ViewCount="289" Body="&lt;p&gt;I'm preparing interview and found this question. But I don't really understand what is the question. Does it ask about Fourier transform or Z transform?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;How the simple identity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$xy=\frac{1}{2}x^2 + \frac{1}{2}y^2 - \frac{1}{2}(x - y)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;was used in developing a significant transform in digital signal processing?&lt;/p&gt;&#xA;" OwnerDisplayName="user11535" LastEditorUserId="8202" LastEditDate="2014-10-29T08:31:27.710" LastActivityDate="2016-09-14T21:29:15.360" Title="DSP interview question: use of the identity in development of a significant transform" Tags="|filters|fourier-transform|dsp-core|z-transform|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18875" PostTypeId="1" CreationDate="2014-10-29T12:36:01.550" Score="0" ViewCount="920" Body="&lt;p&gt;A continuous signal $x_a(t)$ is a linear combination of sinusoids of frequency 250 Hz, 450 Hz, 1 kHz, 2.75 kHz and 4.05 kHz. The signal $x_a(t)$ is sampled at $f_s=$1.5 kHz, and the resulting digital signal is converted into analog using a reconstruction filter  with a low pass filter with cutoff frequency of 750 Hz. The resulting signals is $y_a(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, which frequency components will appear in $y_a(t)$'s spectrum? I tried writing a Matlab program where I simulated $x_a(t)$ and then filtered it with a Butterworth low pass filter. I then looked at its frequency spectrum and a component of 500 Hz appeared. I showed this to my professor but he said it was wrong, and he didn't explain why. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm asking you to tell me what is the real answer and why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot :)&lt;/p&gt;&#xA;" OwnerUserId="11537" LastEditorUserId="11256" LastEditDate="2014-10-29T19:38:35.537" LastActivityDate="2014-10-29T19:38:35.537" Title="What are the frequency components of a sampled signal after low-pass filtering?" Tags="|filters|frequency|sampling|homework|reconstruction|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18876" PostTypeId="1" AcceptedAnswerId="18877" CreationDate="2014-10-29T14:19:00.857" Score="0" ViewCount="602" Body="&lt;p&gt;The title says it all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two waves, Master and Slave.  Master is at 441 Hz and Slave at 700 Hz.  The sample-rate is 48 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know how to calculate the period of each wave in terms of samples.  How many samples long is each wave's period?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please show me how to calculate this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11391" LastActivityDate="2014-10-29T15:56:11.767" Title="Given two waves, 441 Hz and 700 Hz, how many samples long is each wave's period if the sample-rate is 48 kHz?" Tags="|frequency|sampling|wave|periodic|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18877" PostTypeId="2" ParentId="18876" CreationDate="2014-10-29T15:46:53.887" Score="3" Body="&lt;p&gt;Neither of these tones is an exact number of samples at 48 kHz, but you can calculate the periods as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{48000}{441} = 108.84$ samples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{48000}{700} = 68.57$ samples&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2014-10-29T15:56:11.767" LastActivityDate="2014-10-29T15:56:11.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18878" PostTypeId="1" CreationDate="2014-10-29T15:49:42.823" Score="1" ViewCount="496" Body="&lt;p&gt;I am working on Automated GUI components Segmentation problem. My Images are very simple as it has GUI components such as Buttons, text box and other polygons as you can see in the diagram (a).&#xA;Diagram (b) is the hypothetical and desired image of segmented portions.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;image A and B respectively &#xA;&lt;img src=&quot;https://i.stack.imgur.com/CwVcO.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;My approach&lt;/strong&gt;:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have implemented the Watershed transformation in this regard, but the results are not satisfying.&#xA;The regions are over segmented and thus are not useful for automation. The results include very large&#xA;number of small portions of background image.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, I couldn't get the right bg and fg markers to apply watershed upon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have followed this link:&#xA;&lt;a href=&quot;http://www.mathworks.com/help/images/examples/marker-controlled-watershed-segmentation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;www.mathworks.com/help/images/examples/marker-controlled-watershed-segmentation.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt; :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to select appropriate Markers to achieve desired result ?&lt;/li&gt;&#xA;&lt;li&gt;Are there any better approach to attain desired goals ?&lt;/li&gt;&#xA;&lt;li&gt;should the similar approach would work for text segmentation ? &lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11539" LastActivityDate="2014-10-29T15:49:42.823" Title="Polygon Segmentation technique" Tags="|image-processing|matlab|image-segmentation|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18879" PostTypeId="1" AcceptedAnswerId="18881" CreationDate="2014-10-29T17:46:23.797" Score="2" ViewCount="355" Body="&lt;p&gt;This question is probably more for fun and theory, but how will the sound quality be, if you create a sound with really high sampling rate (like 192kHz) and really low bit depth (e.g. 3bit)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you emulate 44.1kHz/16bit with 192kHz/3bit (+dithering)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can probably think this through and post an answer myself with, sound examples computed in MATLAB, but maybe someone has already done that :)&lt;/p&gt;&#xA;" OwnerUserId="3352" LastEditorUserId="3352" LastEditDate="2014-10-30T09:35:26.493" LastActivityDate="2022-07-06T12:02:26.323" Title="Sound quality with really high sampling rate, but really low bit depth with dithering?" Tags="|sampling|bitdepth|dithering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18880" PostTypeId="1" CreationDate="2014-10-29T18:08:37.100" Score="-1" ViewCount="266" Body="&lt;p&gt;I want to make a &lt;a href=&quot;https://en.wikipedia.org/wiki/Brain%E2%80%93computer_interface&quot; rel=&quot;nofollow&quot;&gt;BCI&lt;/a&gt; project, based on EEG signals, to control a robot using the brain's &lt;a href=&quot;https://en.wikipedia.org/wiki/P300_%28neuroscience%29&quot; rel=&quot;nofollow&quot;&gt;P300 wave&lt;/a&gt;.  I have read a lot of papers, which give me a wide knowledge on how to deal with those signals, but I get confused, there are many approaches that papers follow which is DSP, statistical and AI approach (usually AI approach combined with one of the first two approaches).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what is your advice and suggestions about what approach to follow?  (advice from senior to junior :)).&lt;/p&gt;&#xA;" OwnerUserId="11164" LastEditorUserId="29" LastEditDate="2014-10-29T21:33:10.587" LastActivityDate="2014-11-28T23:13:50.987" Title="BCI project using EEG signals" Tags="|signal-analysis|eeg|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18881" PostTypeId="2" ParentId="18879" CreationDate="2014-10-29T18:37:04.850" Score="6" Body="&lt;p&gt;Well, there is a sorta information-theory theorem regarding this (called the Gerzon-Craven limit) that was published long ago by Michael Gerzon and Peter Craven back in the late 80s.  i can't get a direct link to the paper reference, but type in &lt;em&gt;&amp;quot;Optimal Noise Shaping and Dither of Digital Signals&amp;quot;&lt;/em&gt; into the &lt;a href=&quot;https://www.aes.org/publications/conventions/&quot; rel=&quot;nofollow noreferrer&quot;&gt;AES Convention paper site&lt;/a&gt;.  this paper is a quarter-century old.  i just discovered that i have a camera copy of that old AES preprint and can send it to you if you send me an email to &lt;em&gt;rbj@audioimagination.com&lt;/em&gt; .&lt;/p&gt;&#xA;&lt;p&gt;I also have a copy of a paper making reference to the Gerzon-Craven limit &lt;a href=&quot;https://ieeexplore.ieee.org/document/1285808&quot; rel=&quot;nofollow noreferrer&quot;&gt;On psychoacoustic noise shaping for audio re-quantization&lt;/a&gt; .&lt;/p&gt;&#xA;&lt;p&gt;There is an interesting title regarding this called &lt;a href=&quot;https://kclpure.kcl.ac.uk/portal/en/publications/approaching-the-gerzoncraven-noise-shaping-limit-using-semiinfinite-programming-techniques%285a02ceda-b564-4766-9924-0137ee367013%29.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Approaching the Gerzon-Craven Noise Shaping Limit Using Semi-Infinite Programming Techniques&lt;/a&gt;. i don't have a copy of that and do not know how to get a free copy.&lt;/p&gt;&#xA;&lt;p&gt;Essentially, because of the Shannon Channel Capacity theorem, the answer to your question is &lt;em&gt;&amp;quot;yes almost, theoretically&amp;quot;&lt;/em&gt;, as long as you don't care about the magnitude of the quantization noise outside of your original 22.05 kHz baseband.  this is because the bit rate at 16-bit, 44.1 kHz is about the same (maybe just a teeny bit more) as the bit rate at 3-bit, 192 kHz and you can make an information-theory case that, because the information rate of the two cases are about the same, then the S/N ratio in the band of interest is also about the same.&lt;/p&gt;&#xA;&lt;p&gt;But the real answer is &lt;em&gt;&amp;quot;no, practically&amp;quot;&lt;/em&gt;, because of the difficulty in constructing a 3-bit noise-shaped modulator with such extreme specs and that remains stable.  with a higher sampling rate than 192 kHz, the specs get less extreme.&lt;/p&gt;&#xA;&lt;p&gt;If you have a working system (what's it coded in, MATLAB?), i would be interested in your noise-shaped modulator.  what order it is and how well it behaves.  sometimes these nasty high-order ΣΔ modulators behave badly in the presence of &lt;em&gt;silence&lt;/em&gt; and we get, what are called, &lt;em&gt;&amp;quot;idle tones&amp;quot;&lt;/em&gt;.  if you think you have a working solution, i would be interested in hearing how it works for very low-level input.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="7092" LastEditDate="2022-07-06T12:02:26.323" LastActivityDate="2022-07-06T12:02:26.323" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="18883" PostTypeId="2" ParentId="18880" CreationDate="2014-10-29T23:11:46.863" Score="0" Body="&lt;p&gt;Like @endolith said, can you be more specific what you need? and what your robot do? You can work for example with evoked potential, if you want your robot to walk and turn, you can send some visual stimulus and detect that p300 signal, only when the user are ready for that stimulus. So in p300 thats a very simple way. If there is a high-commands, for example show in a screen kitchen, bathroom, living room, and you can detect that p300 and program your robot to follow that path with Computer Vision or other techniques.&lt;/p&gt;&#xA;" OwnerUserId="10555" LastActivityDate="2014-10-29T23:11:46.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18886" PostTypeId="1" AcceptedAnswerId="18887" CreationDate="2014-10-30T10:33:57.983" Score="0" ViewCount="743" Body="&lt;p&gt;As part of a project I am doing, I have to investigate how having a carrier frequency offset would affect the constellation pattern of the received signal.This question has got me baffled because to me a carrier frequency offset should not affect the constellation pattern because any offset would be dealt with on the receiver side.I might not be understanding some concepts very clearly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie.  On Transmit side we transmit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    s(t) = x(t)\cos(2 \pi (f_c + f _\phi) t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then on receive side&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    r(t) = 2 \text { LPF  } (s(t) \cos(2 \pi (f_c + f_\phi)) t) = x(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So regardless of the offset we have on the carrier frequency there should no be no effect on the constellation diagram.Any help will be appreciated?&lt;/p&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="4376" LastEditDate="2014-10-30T17:19:58.687" LastActivityDate="2014-10-30T17:19:58.687" Title="Relationship between Carrier Frequency Offset and the Constellation Diagram" Tags="|digital-communications|modulation|demodulation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18887" PostTypeId="2" ParentId="18886" CreationDate="2014-10-30T10:44:37.237" Score="3" Body="&lt;p&gt;I think that you misunderstand the problem. The actual problem is that the frequency offset is &lt;em&gt;unknown&lt;/em&gt; to the receiver. I won't give away the answer since this appears to be a homework project, but I'll try to help you by giving a hint. First, imagine what would happen if there was an unknown carrier &lt;em&gt;phase&lt;/em&gt; offset at the receiver. How would this affect the constellation? If you know the answer to that question, then think of a carrier &lt;em&gt;frequency&lt;/em&gt; offset as a continuing change in phase offset. So how would this affect the constellation?&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-30T10:44:37.237" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18888" PostTypeId="2" ParentId="18886" CreationDate="2014-10-30T10:49:31.080" Score="3" Body="&lt;p&gt;&lt;strong&gt;Simplified Explanation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume a MPSK constellation: &#xA;$$ c_m = e^{(j2\pi m/M + j\pi/4)} $$&#xA;where $m = 0, ..., M-1$ and $M$ can be $4, 8, 16$ etc. Now the carrier offset will appear as another complex exponential&#xA;$$ x(k) = c_m e^{(j2\pi \Delta f k)} $$&#xA;Now by definition frequency $\Delta f$ is a changing phase. That means this offset will start changing the phase of the MPSK constellation. As a result I'll see a rotation constellation instead of a static once. My decision boundaries expect a nice static constellation. This will mess up the BER curves beyond recongnition. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-10-30T10:49:31.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18891" PostTypeId="2" ParentId="17145" CreationDate="2014-10-30T17:05:51.670" Score="3" Body="&lt;p&gt;I don't know if you are familiar with statistical signal processing and therefore will write my answer assuming that you are not. Everything I explain here is much better presented in any book about statistics. I would recommend &lt;a href=&quot;http://books.google.co.in/books/about/Fundamentals_of_Statistical_Signal_Proce.html?id=vA9LAQAAIAAJ&quot; rel=&quot;nofollow&quot;&gt;Kay's book about detection theory&lt;/a&gt;. I first summarize your question by reformulating the 2 points you made, first in comprehensive English and then from a signal processing point of view. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have access to two signals:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The signal you are looking for. Be it music, speech, or whatever. The only important assumption about this signal is that you &lt;em&gt;perfectly&lt;/em&gt; know it. We will name it the &lt;em&gt;signal of interest&lt;/em&gt; and denote it $s$. Let's say that it consists in $N$ samples denoted $s[n]$, with $0 \le n &amp;lt; N$.&lt;/li&gt;&#xA;&lt;li&gt;A recording that contains the signal of interest as well as many other sources. The recording will thereafter be named the &lt;em&gt;observation&lt;/em&gt; signal and denoted $x$. The other sources are all considered as &lt;em&gt;noise&lt;/em&gt; in that they consist in anything but the signal of interest, and we will denote the noise $w$. The observation is longer than the signal of interest. Let's say it consists in $K$ samples denoted $x[k]$, with $K \ge N$ and $0 \le k &amp;lt; K$. Same goes for $w$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You said you know what you are looking for ($s$), but you don't know  how badly it is &quot;drown&quot; ($w$) in what you are observing ($x$). From this point, the first thing I would try is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;matched filter (MF) approach&lt;/a&gt;. I can't say for sure it will work for your problem because you gave us nothing about $w$. What I can say for sure is that this is the easiest approach that is very likely to work, both from a theoretical and a programming point of view. If this does not work, then you can come back here again. The fun part will start from there :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for now, let's focus on the matched filter. $s$ is shorter that $x$, so you should be able to take $M$ successive snapshots of $x$ of the same length as $s$, each denoted $x_m$. From $s$ and those $M$ snapshots, you can construct a third signal $y$ of length $M$, with each sample defined as follows :&#xA;$$y[m] = \sum_{n=0}^{N-1}{x_m[n]s[n]}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $s$ is really in $x$, then you &lt;em&gt;may&lt;/em&gt; see a clear maximum in $y$, at the index $m$ of the snapshot that contains $s$. If not, two possible conclusions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$s$ is not in $x$. But that should not be the case, according to the presentation you gave of your problem.&lt;/li&gt;&#xA;&lt;li&gt;Either the &quot;level&quot; of $s$ is way too low as compared to $w$ (we talk about a &lt;em&gt;bad&lt;/em&gt; signal-to-noise ratio), or the statistical properties of $w$ are making this more complicated. The fun starts in the latter case.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11550" LastEditorUserId="11550" LastEditDate="2014-10-30T17:16:14.940" LastActivityDate="2014-10-30T17:16:14.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18892" PostTypeId="1" CreationDate="2014-10-30T17:30:26.580" Score="1" ViewCount="188" Body="&lt;p&gt;I am processing &lt;a href=&quot;http://kmkeen.com/rtl-demod-guide/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;rtl_fm&lt;/a&gt; output (in time domain), extracting &lt;a href=&quot;https://en.wikipedia.org/wiki/Manchester_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Manchester encoded&lt;/a&gt; bits. I can detect preamble and, therefore, decode the message which follows the preamble.&#xA;This is how my signal looks like (here I have 2 messages, the rest is noise):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ozr4U.png&quot; alt=&quot;noise and 2 messages&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this one of the messages zoomed in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JytAo.png&quot; alt=&quot;one of the messages zoomed in&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to know how strong was the signal that I've just decoded. I know what is the average amplitude for my symbols: &quot;1&quot; is 2900 and &quot;0&quot; is 1500 (for the amplitude range of -32768 .. 32767). Is it possible to know the signal strength in dB in this case?&lt;/p&gt;&#xA;" OwnerUserId="11551" LastActivityDate="2016-01-24T00:20:55.853" Title="Estimating signal strength from PCM-encoded signal" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18893" PostTypeId="2" ParentId="18892" CreationDate="2014-10-30T17:44:17.940" Score="1" Body="&lt;p&gt;In general, it is very hard to estimate the power of a signal after it has gone through an analog front-end and sampled. The front-end filters and mixes the signal, which can amplify or attenuate it. It's also common to have an automatic gain control (AGC) stage, which adjusts the signal's amplitude to match the ADC's input range and maximize dynamic range. In many cases, the digital back-end will also normalize the signal amplitude to a pre-defined range, such as -1 to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you understand every piece in the system very well, you may be able to estimate the signal's power from its samples. Another alternative is to use a scope or a spectrum analyzer to measure the signal as close as possible to the receiver's input.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-10-30T17:44:17.940" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18894" PostTypeId="2" ParentId="18689" CreationDate="2014-10-30T17:49:48.573" Score="0" Body="&lt;p&gt;Broadly speaking, you need an Audio Unit graph with a remoteIO unit doing the recording and you can then add filter audio units onto it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Core Audio is a C api though and it takes a bit of getting the hang of, if you are prepared to support iOS8 only you can check out AVAudioEngine - &lt;a href=&quot;https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioEngine_Class/&quot; rel=&quot;nofollow&quot;&gt;https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioEngine_Class/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11552" LastActivityDate="2014-10-30T17:49:48.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18895" PostTypeId="1" AcceptedAnswerId="18920" CreationDate="2014-10-30T18:05:11.850" Score="0" ViewCount="173" Body="&lt;p&gt;I have the generic problem of analysing a discretly sampled signal, lets&#xA;say at 100Hz, and would like to compute features (ML application) of this signal at different scales:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An instantiation of this problem is computing the FFT on real-signal with&#xA;N samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original signal: X[1],...,X[N]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have already computed the FFT of the following&#xA;subarrays:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X[N-k+1],...,X[N]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X[N-2*k+1],...,X[N-k]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X[N-3*k+1],...,X[N-2*k]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X[N-4*k+1],...,X[N-3*k]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is each of size k. Then I would like to compute the FFT&#xA;of the subarray&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X[N-4*k+1],...,X[N] &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(which is of size 4*k), WITHOUT reconstructing the original array X[.] and&#xA;running an ordinary FFT on the array of size 4k. Roughly I would like to do O(N) primitive operations in the best case if that is at all possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some recursive property I could use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: Note that if the goal of computing the FFT is substituted with e.g. finding the mean or the variance there exist easy recursive properties that allow merging of the results in constant time.&lt;/p&gt;&#xA;" OwnerUserId="8011" LastActivityDate="2014-11-01T10:26:52.807" Title="Merging pattern for FFT solutions" Tags="|fft|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18899" PostTypeId="1" CreationDate="2014-10-31T01:01:38.073" Score="0" ViewCount="4178" Body="&lt;p&gt;Let $f=A\sin{\omega t}=x_1$ and $\dot{f}=A\omega\cos{\omega t}=\dot{x}_1=x_2$. Let the output be $y=cA\omega$, where $c=1$ is a constant. I want to represent this in a state space formulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dot{x}=\underline{A}x+\underline{B}u$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y=\underline{C}x+\underline{D}u$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What will $C$ be? I tried: $A\omega=\frac{A}{t}\arcsin{\frac{x_1}{A}}$, but does this make sense? Another possibility is $A\omega=\frac{-x_2}{\cos{\omega t}}$. Which one should I choose?&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="8825" LastEditDate="2014-11-02T01:13:01.833" LastActivityDate="2014-12-03T23:03:47.107" Title="state space formulation of a sinusoidal system" Tags="|state-space|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18901" PostTypeId="1" CreationDate="2014-10-31T04:32:11.677" Score="0" ViewCount="103" Body="&lt;p&gt;in Digital Image Processing restoration ,from my understanding after reading articles , it's seems that the noise must be dominant in the histogram of the image , which is make it possible , to get the mean and variance of the noise from the histogram it self. &lt;br&gt;&#xA;My question is  if I have a little Gaussian noise in the image , which i means that the noise is not dominant in the image , it's seems that it's wrong to extract the mean and variance from the image , because if we do this ,  we finding the mean and variance of the distorted  image it self which is included the noise , yields that we  affect on the original image if we use the model , which is included the model of the noise and the original image together, So how could we avoid this problem ?&lt;/p&gt;&#xA;" OwnerUserId="11164" LastActivityDate="2014-12-30T07:52:33.493" Title="Noise in Digital image" Tags="|image-processing|histogram|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18902" PostTypeId="2" ParentId="18901" CreationDate="2014-10-31T07:02:13.113" Score="1" Body="&lt;p&gt;If the noise is a constant background/remains in the same place, you could take various photos in the absence of any light to create an image for background subtraction. My image processing expertise is limited to grayscale but i would imagine the same could be done for RGB. Produce several background images, from that make an average/low pass filter. Then in your desired programming language do some simple matrix manipulation.&lt;/p&gt;&#xA;" OwnerUserId="11542" LastActivityDate="2014-10-31T07:02:13.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18903" PostTypeId="1" CreationDate="2014-10-31T07:48:39.180" Score="0" ViewCount="550" Body="&lt;p&gt;Is there a method to find the relative direction of a Bluetooth device to the receiver?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick Google search on &quot;Bluetooth positioning&quot; returns several methods using triangulation, but I don't want to use multiple receivers. Also, I don't need to know the distance, only the relative angle to the receiver is enough.&lt;/p&gt;&#xA;" OwnerUserId="11559" LastActivityDate="2015-01-30T00:31:11.907" Title="Bluetooth locating with RSSI and only one receiver" Tags="|signal-analysis|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18905" PostTypeId="2" ParentId="16586" CreationDate="2014-10-31T11:36:28.647" Score="1" Body="&lt;p&gt;If I am correct, even if DFT input is periodic, although the number of samples is finite, the mathematics behind it treats it as an infinite sequence which periodically commences the &lt;code&gt;N&lt;/code&gt; samples after its termination. Please correct me if I am wrong.&lt;/p&gt;&#xA;" OwnerUserId="7608" LastEditorUserId="7092" LastEditDate="2014-10-31T13:16:19.553" LastActivityDate="2014-10-31T13:16:19.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18906" PostTypeId="1" AcceptedAnswerId="18910" CreationDate="2014-10-31T14:43:16.877" Score="1" ViewCount="3501" Body="&lt;p&gt;I'm studying for my midterm , and I'm struggling with finding bandwidths. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this energy spectral density : $\Psi(f)= { 1  \over \sqrt {  1 +  ({f \over B }) ^2} }$ ,  and I need to find  the $3$ $dB$ band and the band with $90%$ % power. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;About the $90%$ % case, do I need to find the total energy and then  $\int_0^W \Psi(f) = 0.9 \times  Total Energy$?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One think that doesn't make sense for me is that I'm dealing with an energy signal but I need to find something related to power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I had a power signal and wanted to find the 3 dB bandwidth, would I need to find the average power and then solve $\int_0^W S_x(f) = 0.5 \times TotalPower$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, and sorry for the bad english.&lt;/p&gt;&#xA;" OwnerUserId="11560" LastEditorUserId="11560" LastEditDate="2014-10-31T16:06:48.353" LastActivityDate="2014-10-31T17:23:17.853" Title="Bandwidth of an energy signal" Tags="|bandwidth|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18907" PostTypeId="2" ParentId="1625" CreationDate="2014-10-31T15:36:41.837" Score="-1" Body="&lt;pre&gt;&lt;code&gt;import sys&#xA;import numpy&#xA;import cv2&#xA;&#xA;cap = cv2.VideoCapture(0)&#xA;while(1):&#xA;    _, im = cap.read()&#xA;&#xA;    im_ycrcb = cv2.cvtColor(im, cv2.COLOR_BGR2YCR_CB)&#xA;&#xA;    skin_ycrcb_mint = numpy.array((0, 133, 77))&#xA;    skin_ycrcb_maxt = numpy.array((255, 173, 127))&#xA;    skin_ycrcb = cv2.inRange(im_ycrcb, skin_ycrcb_mint, skin_ycrcb_maxt)&#xA;&#xA;    cv2.imshow(&quot;Second Image&quot;, skin_ycrcb) # Second image&#xA;    contours, _ = cv2.findContours(skin_ycrcb, cv2.RETR_EXTERNAL, &#xA;        cv2.CHAIN_APPROX_SIMPLE)&#xA;    for i, c in enumerate(contours):&#xA;        area = cv2.contourArea(c)&#xA;            if area &amp;gt; 1000:&#xA;                cv2.drawContours(im, contours, i, (255, 0, 0), 3)&#xA;    cv2.imshow(&quot;Final Image&quot;, im)         # Final image&#xA;    cv2.waitKey(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11562" LastEditorUserId="8202" LastEditDate="2014-10-31T16:12:54.513" LastActivityDate="2014-10-31T16:12:54.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18909" PostTypeId="1" CreationDate="2014-10-31T16:47:38.897" Score="0" ViewCount="2555" Body="&lt;p&gt;I am currently working with a set of wavelet transforms that I came across in a paper. The paper suggests that I first apply the FFT on the source image and then perform the downsampling. So it says something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a source image of size 128*128.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;P = fft(source);&#xA;P(1:64,1:64) = P(1:64,1:64) + P(65:128,65:128);&#xA;P(65:128,1:64) = P(65:128,1:64) + P(1:64,65:128);&#xA;P = P(1:128,1:64); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Well this solution definitely works and I get the results, but could anyone give a possible explanation as to why I am supposed to add in this manner?&lt;/p&gt;&#xA;" OwnerUserId="11563" LastEditorUserId="7092" LastEditDate="2014-10-31T17:12:20.813" LastActivityDate="2014-11-01T18:07:02.150" Title="downsampling an fft signal" Tags="|matlab|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18910" PostTypeId="2" ParentId="18906" CreationDate="2014-10-31T17:23:17.853" Score="2" Body="&lt;p&gt;I'm using the following assumption: the &lt;em&gt;magnitude&lt;/em&gt; of the spectrum is given by the formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|X(f)|=\frac{1}{\sqrt{1+(f/B)^2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the energy spectral density is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|X(f)|^2=\frac{1}{1+(f/B)^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3 dB bandwidth is simply the frequency for which (1) becomes $0.5$, which is $W_{3dB}=B$. The bandwidth according to the 90% energy/power definition is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-W}^W|X(f)|^2df=0.9\cdot\int_{-\infty}^{\infty}|X(f)|^2df\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (2) is the reason why I assume the definition as given in (1), because otherwise the integral on the right-hand side of (2) does not converge, so the 90% energy/power definition would not make sense. With the definition (1) the integrals in (2) are easily solved using the $\arctan$ function, from which $W=const\cdot B$ follows, where $const=6.31$ (if I'm not mistaken), but I'm sure you can do the calculation yourself.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-10-31T17:23:17.853" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18911" PostTypeId="2" ParentId="18903" CreationDate="2014-10-31T19:27:08.183" Score="1" Body="&lt;p&gt;If the environment does not contain a lot of 2.4 GHz radio reflecting objects, you can try shielding one side of the BTLE receiver's antenna (it might be tiny) with a large conductive object, the rotating the shield and antenna configuration.   The difference between RSSI's will be greatest when the shield is between the source and receiver antenna compared to the opposite orientation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-10-31T19:27:08.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18912" PostTypeId="1" CreationDate="2014-10-31T19:45:14.727" Score="0" ViewCount="470" Body="&lt;p&gt;Apologies if this makes no sense or seems rather simple, I'm a Matlab newbie. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I've got a .wav audio waveform which I am resampling to various different frequencies and then trimming the length to a second (44100 samples). However, when resampling to certain tones, such as the note C3 or A5, I'm not left with enough samples to trim the note to an acceptable length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this means that the sample needs extending, which I've worked out can be done taking a sample period &lt;code&gt;s1&lt;/code&gt; to &lt;code&gt;s2&lt;/code&gt; and adding that onto the end as many times as is necessary. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;extendedSignal = x(1:s1-1);&#xA;&#xA;for i = 1:4&#xA;    extendedSignal = vertcat(extendedSignal, x(s1:s2));&#xA;end&#xA;&#xA;extendedSignal = vertcat(extendedSignal, x(s2:44100));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when it comes to finding a continuous period in which to sample, I cannot seem to find one for any note which does not sound like it is being repeated. Am I missing something really obvious? &lt;/p&gt;&#xA;" OwnerUserId="11566" LastEditorUserId="8202" LastEditDate="2014-11-01T09:05:48.723" LastActivityDate="2015-01-01T18:09:44.620" Title="Extending a waveform" Tags="|matlab|discrete-signals|signal-analysis|sampling|continuous-signals|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18913" PostTypeId="1" CreationDate="2014-10-31T23:14:49.433" Score="0" ViewCount="77" Body="&lt;p&gt;What do I need to know to difference a note for different musical instruments? for example, if they play the same note, (same frequency), how can I difference them if they have the same frequency?&lt;/p&gt;&#xA;" OwnerUserId="10555" LastActivityDate="2014-11-02T16:28:46.213" Title="Music note of different instruments" Tags="|music|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18914" PostTypeId="1" CreationDate="2014-10-31T23:53:04.333" Score="0" ViewCount="71" Body="&lt;p&gt;I am working on modelling some FM transmitted signals, and I'm trying to figure out how to model the effects of multipath channels.  The most obvious method is to delay the signal by some integral number of samples and then add it to itself (with some attenuation factor).  But, this is obviously not very realistic, since 1 sample's worth of time is a long time for a radio wave (at least at a reasonable sample rate).  It would be nice to be able to delay the signal by a fraction of a sample.  However, I don't know how to do this...  Can anyone enlighten me?  I am fairly new to the DSP field, I'm sure this isn't a particularly challenging task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is this actually a good method for modelling multipath effects?&lt;/p&gt;&#xA;" OwnerUserId="11567" LastActivityDate="2015-03-31T02:58:48.803" Title="Modeling multipath distortion and shifting by fractions of a sample" Tags="|interpolation|resampling|multipath|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18915" PostTypeId="1" CreationDate="2014-11-01T00:01:45.117" Score="0" ViewCount="149" Body="&lt;p&gt;I want to start studying image processing and need some tutorials for beginners. I am not bad at Mathematics and good when it comes to programming. I want to use the &lt;code&gt;CImg&lt;/code&gt; library and write code in &lt;code&gt;C++&lt;/code&gt;. Could you advice me some good tutorials or books to start with ?&lt;/p&gt;&#xA;" OwnerUserId="11568" LastActivityDate="2014-11-13T21:24:31.410" Title="How to get started in image processing" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18916" PostTypeId="2" ParentId="18914" CreationDate="2014-11-01T00:44:54.323" Score="1" Body="&lt;p&gt;One approach is to upsample the signal, then delay it, then downsample (or, if feasible, you can do the rest of the processing at the higher sampling rate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This general approach to modeling multipath is correct. However, you need to make sure that your model is realistic and/or useful for your purpose. A few things to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you add delayed/attenuated replicas of the signal to itself, then you're assuming you have line-of-sight between the transmit and receive antennas. The effect is different when you don't have line-of-sight.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The number of paths is important too. A channel with many paths is easier to understand theoretically, because you can make certain assumptions about the overall channel gain (e.g. that it's a Gaussian random variable).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The maximum delay is important too. A very large delay introduces very destructive effects on the received signal. Many, very small delays can be modeled as a single gain factor.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In a static environment, the channel is also static. If the antennas and/or obstacles in the environment are in movement, then the channel is dynamic, in the sense that the number of paths, and the gain of each, vary with time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-11-01T00:44:54.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18918" PostTypeId="1" CreationDate="2014-11-01T02:53:26.843" Score="0" ViewCount="669" Body="&lt;p&gt;I'm going through a Signal Processing &lt;a href=&quot;https://www.youtube.com/watch?v=6xaaeop7gJ8&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; where the professor mentions this fact and the argument given is:&#xA;Suppose you have a sinusoidal signal: $Acos(\omega t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you change the phase of the signal: $Acos(\omega t + p)$ then if it would correspond to a time shift, then&#xA;$Acos(\omega t + \omega t_0) = Acos(\omega t + p)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, $t_0 = p/\omega $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this can't always have integral values, which is contradictory since we're considering the discrete case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My argument is that, since we're considering the discrete case, the value of 'p' will be restricted to a certain set of values, right? And these values will only be those for which p/w is an integer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the definition &lt;a href=&quot;https://dsp.stackexchange.com/a/13245/11570&quot;&gt;here&lt;/a&gt; the phase ($p$ here) gives you how far the signal is in it's cycle. So by default the value of $p$ would only be those values that allow p/w to be integral, since our signal is discrete right? What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="11570" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-11-01T13:25:09.787" Title="For discrete signals, why does phase change not correspond to time shift?" Tags="|discrete-signals|phase|time-frequency|cosine|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18920" PostTypeId="2" ParentId="18895" CreationDate="2014-11-01T10:26:52.807" Score="0" Body="&lt;p&gt;You can compute the DFT of the total signal from the DFTs of its parts but this is not efficient. What you would need to do is interpolate each DFT to the length of the total array (which is equivalent to zero-padding the sub-blocks to length $N$ before computing the individual FFTs), and then combine the interpolated DFTs with appropriate complex factors. This is computationally less efficient than going back to the time domain and computing the FFT of the whole sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no recursion involved (unlike your examples of recursive mean and variance computation), simply because the data blocks are not related to each other. If you were to have a sliding window with a fixed length and you wanted to recompute the DFT after shifting the window by one sample, then you would indeed get a recursive formula for the DFT. This is known as the &lt;a href=&quot;http://www.cmlab.csie.ntu.edu.tw/DSPCourse/reference/Sliding%20DFT.pdf&quot; rel=&quot;nofollow&quot;&gt;sliding DFT&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-01T10:26:52.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18921" PostTypeId="1" AcceptedAnswerId="18922" CreationDate="2014-11-01T11:13:32.317" Score="0" ViewCount="1260" Body="&lt;p&gt;I have this triangle wave as input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i5aHW.png&quot; alt=&quot;Input&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I want to derive a sine wave out of it. How do I go about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I am doing this in Lua, so any piece of code close to that language would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="11573" LastActivityDate="2014-11-01T14:09:17.810" Title="Convert Triangle Wave to Sine Wave" Tags="|wave|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="18922" PostTypeId="2" ParentId="18921" CreationDate="2014-11-01T11:41:59.033" Score="1" Body="&lt;p&gt;Assuming $x(t)$ swings between -1 and 1, $\sin \frac{\pi}{2} x(t)$ might do the trick.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-11-01T14:09:17.810" LastActivityDate="2014-11-01T14:09:17.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18923" PostTypeId="2" ParentId="18765" CreationDate="2014-11-01T13:37:04.243" Score="2" Body="&lt;p&gt;See the article below for one of the methods we use for detecting andn classifying dolphin whistles. These methods may have some sucess with birds, but I can promise that they won't separate 300 different species. All methods are available in the open source PAMGUARD software (sourceforge or pamguard.org)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J Acoust Soc Am. 2013 Sep;134(3):2427-37. &#xA;Automatic detection and classification of odontocete whistles.&#xA;Gillespie D, Caillat M, Gordon J, White P.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Abstract&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Methods for the fully automatic detection and species classification of odontocete whistles are described. The detector applies a number of noise cancellation techniques to a spectrogram of sound data and then searches for connected regions of data which rise above a pre-determined threshold. When tested on a dataset of recordings which had been carefully annotated by a human operator, the detector was able to detect (recall) 79.6% of human identified sounds that had a signal-to-noise ratio above 10 dB, with 88% of the detections being valid. A significant problem with automatic detectors is that they tend to partially detect whistles or break whistles into several parts. A classifier has been developed specifically to work with fragmented whistle detections. By accumulating statistics over many whistle fragments, correct classification rates of over 94% have been achieved for four species. The success rate is, however, heavily dependent on the number of species included in the classifier mix, with the mean correct classification rate dropping to 58.5% when 12 species were included.&lt;/p&gt;&#xA;" OwnerUserId="11574" LastActivityDate="2014-11-01T13:37:04.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18924" PostTypeId="2" ParentId="18909" CreationDate="2014-11-01T15:48:13.230" Score="1" Body="&lt;p&gt;Downsampling and spectral stretching is earlier to show in 1D. I'll also analyze with the Fourier transform and discrete-time Fourier transform, not a DFT. The results are the same except for aliasing in time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To downsample by an integral multiple is to increase the sample period of a continuous-time signal $x(t)$ by an integer $M : T → M T$ . The replication period in the frequency domain is reduced by the same multiple. Rather than the first replica being centered at $\omega = 2\pi/T$ , the first replica of the down-sampled spectrum is centered at $\omega = 2\pi/MT$. Moreover, the amplitude is scaled by $1/M$. The figure illustrates $M = 2$. Sequencing the original series converts $x(nT ) → x[n]$. To downsample the sequence is to introduce a stride $M$ when reading off the values: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x^{\downarrow} [n] = x[nM ]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect on the angular sample frequency can be shown by a units analysis,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left(\frac{φ^↓\; \text{radians}}{1\; \text{sample}}\right)&#xA;=&#xA;\left(\frac{ω\; \text{radians}}{1\; \text{sec}}\right)&#xA;\left(\frac{T\; \text{sec}}{1\; \text{step}}\right)&#xA;\left(\frac{M\; \text{step}}{1\; \text{sample}}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or $φ^{\downarrow} = \omega M T$ . The range $ω ∈ [0, 2π/M T ]$ corresponds to $φ^↓ ∈ [0, 2π]$, thus $φ^↓$ is a stretched version of $ω$. The figure below compares $x[n]$ to $x^↓ [n]$ and $φ$ to $φ^↓$ . $x^↓ [n]$ has fewer samples than $x[n]$, and has a broader spectrum when plotted in $φ$ because the radians per sample has increased by $M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lKmgv.png&quot; alt=&quot;down-sampling, continuous and discrete, time and frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the 1D analogy to your case, refer to the continuous-frequency spectra $\omega$ above. Downsampling by 2:1 creates a spectral replica centered at $2\pi/MT$, $M=2$. That is what your first lines of code do (in 2D). Then, the spectrum is stretched so that the periodicity of the spectrum is restored to $2\pi$. This is shown to the right.&lt;/p&gt;&#xA;" OwnerUserId="7438" LastEditorUserId="7438" LastEditDate="2014-11-01T18:07:02.150" LastActivityDate="2014-11-01T18:07:02.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18925" PostTypeId="1" CreationDate="2014-11-01T21:34:05.360" Score="0" ViewCount="346" Body="&lt;p&gt;I was trying to understand convolution from &lt;a href=&quot;http://www.analog.com/static/imported-files/tech_docs/dsp_book_Ch6.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; book and came across this figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UQady.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the input signal is a combination of a sine wave and a ramp.&#xA;In fig a, the input signal is convolved with a special type of impulse response that is said to be a 'low pass filter' and the output is just the ramp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in fig b, impulse response is actually a high pass filter and the output is just the sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do is, just by looking at the wave-forms for the impulse response functions, trying to find an intuitive way of knowing what those impulse responses will do when convoluted with a given input signal. I can't 'see' how the first waveform will result only in the ramp as the output signal when given the mentioned input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you guys figure this intuitively in your head? If so, then how?&lt;/p&gt;&#xA;" OwnerUserId="11570" LastActivityDate="2014-11-01T22:16:39.477" Title="How can you intutively figure what the impulse response will behave like?" Tags="|filters|convolution|lowpass-filter|highpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18926" PostTypeId="2" ParentId="18925" CreationDate="2014-11-01T21:47:53.637" Score="0" Body="&lt;p&gt;I suggest that you switch books. I just scanned your reference and I'm not enthusiastic. (The code is in BASIC, how vintage). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For starters, visit the MIT Open Course Ware &lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-003-signals-and-systems-fall-2011/&quot; rel=&quot;nofollow&quot;&gt;6.003&lt;/a&gt; page. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of texts, I recommend:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0262192292&quot; rel=&quot;nofollow&quot;&gt;Circuits, Signals, and Systems, William Siebert&lt;/a&gt; (undergraduate)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0131988425&quot; rel=&quot;nofollow&quot;&gt;Discrete-Time Signal Processing, Oppenheim and Schafer&lt;/a&gt; (graduate)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To answer your question: no I cannot intuitively figure out the results you show. There is too little information. However, with a clearly defined impulse response one can certainly intuit input / output relationships. &lt;/p&gt;&#xA;" OwnerUserId="7438" LastActivityDate="2014-11-01T21:47:53.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18927" PostTypeId="2" ParentId="18925" CreationDate="2014-11-01T22:11:33.640" Score="1" Body="&lt;p&gt;Here's an idea...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first case, the impulse response has only positive coefficients. Groups of nearby samples will be averaged to yield the output signal. Thus, short term bumps/variations will be &quot;averaged out&quot;, so the signal will be smoother. Furthermore, it looks like all coefficients sum up to 1 (there about 30 of them, in a triangle-like shape, the maximum is about 0.06, I suspect they sum to 1), so the overall amplitude / magnitude of the output waveform will be preserved. Last bit of information: the impulse response has its center of gravity at $n=15$, so the output signal will be delayed by 15 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second impulse response looks like a kronecker delta (at $n=15$) minus the impulse response from the previous example. Because convolution is a linear operation, the result will be the original signal shifted by 15 samples, minus the smoothed signal obtained in the previous example. In other words, the result will be whatever has been smoothed out in the previous example because of averaging - only the fast wiggles will remain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summing the output signals from example 1 and example 2 will yield the input signal delayed by 15 samples.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-11-01T22:16:39.477" LastActivityDate="2014-11-01T22:16:39.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18928" PostTypeId="1" CreationDate="2014-11-01T22:21:46.123" Score="2" ViewCount="446" Body="&lt;p&gt;I have developed a spectrum scope that plots signal vs. frequency starting from IQ signals.  I currently do not have a way to balance the IQ signals, so am looking at various ways to do so.  I have come across &lt;a href=&quot;http://argus.naapo.org/~rchilders/swe_argus_pubs/iqbal.pdf&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;, which is reasonably easy for me to follow since I am fairly new to all DSP. The one question I have is concerning the notation of some of the equations:&#xA;For example, $a^2 = 2\langle t(i) * t(i)\rangle$. What does $\langle\cdot \rangle$ represent?  I can find no reference for these in mathematical symbol tables. &lt;/p&gt;&#xA;" OwnerUserId="7741" LastEditorUserId="1629" LastEditDate="2016-06-07T13:32:03.810" LastActivityDate="2022-04-08T17:05:40.520" Title="Help with IQ balance equations?" Tags="|signal-analysis|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18930" PostTypeId="1" AcceptedAnswerId="19947" CreationDate="2014-11-02T00:34:41.943" Score="0" ViewCount="153" Body="&lt;p&gt;I have some low quality audio from my native tongue on a VHS. I am using this audio to dub HQ released of the same program (from another language source). The video frames/second ratio is 25:23.98 . I do not want to tamper with the fps ratio, since I am still using the other audio tracks as alternative languages in my video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't notice a pitch difference from this conversion, I can only hear the pitch-changing VHS artefacts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a 25/23.98 ratio enough to need pitch correction? What is the rule of thumb? Would the VHS artefacts hide the pitch difference (too much pitch-noise to actually matter) or would the average pitch difference drive an audiophile up the wall?&lt;/p&gt;&#xA;" OwnerUserId="11510" LastEditorUserId="4346" LastEditDate="2016-07-05T22:07:24.287" LastActivityDate="2016-07-05T22:07:24.287" Title="At what time stretching ratio would an audiophile notice a wrong pitch" Tags="|audio|pitch|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18931" PostTypeId="2" ParentId="16586" CreationDate="2014-11-02T03:09:33.760" Score="25" Body="&lt;p&gt;Alright, I'm gonna answer this with an argument that &amp;quot;opponents&amp;quot; to my rigid nazi-like position regarding the DFT have.&lt;/p&gt;&#xA;&lt;p&gt;First of all, &lt;a href=&quot;https://dsp.stackexchange.com/questions/18144/about-discrete-fourier-transform-vs-discrete-fourier-series/18145#18145&quot;&gt;my rigid, nazi-like position&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The Discrete Fourier Transform and Discrete Fourier Series are one-and-the-same.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The DFT maps one infinite and periodic sequence, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; with period &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; in the &amp;quot;time&amp;quot; domain to another infinite and periodic sequence, &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;, again with period &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, in the &amp;quot;frequency&amp;quot; domain.  And the iDFT maps it back.  and they're &amp;quot;bijective&amp;quot; or &amp;quot;invertible&amp;quot; or &amp;quot;one-to-one&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;DFT:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ X[k] = \sum\limits_{n=0}^{N-1} x[n] e^{-j 2 \pi nk/N} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;iDFT:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ x[n] = \frac{1}{N} \sum\limits_{k=0}^{N-1} X[k] e^{j 2 \pi nk/N} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That is most fundamentally what the DFT is.  It is inherently a periodic or circular thing.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x[n+N]=x[n] \qquad \forall n \in \mathbb{Z} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ X[k+N]=X[k] \qquad \forall k \in \mathbb{Z} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But the &lt;em&gt;periodicity deniers&lt;/em&gt; like to say this about the DFT.  It is true, it just doesn't change any of the above.&lt;/p&gt;&#xA;&lt;p&gt;So, suppose you had a finite-length sequence &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; of length &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and, instead of periodically extending it (which is what the DFT inherently does), you append this finite-length sequence with zeros infinitely on both left and right.  So&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{x}[n] \triangleq \begin{cases}&#xA;x[n] \qquad &amp;amp; \text{for } 0 \le n \le N-1 \\&#xA;\\&#xA;0 &amp;amp; \text{otherwise}&#xA;\end{cases} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, this non-repeating infinite sequence &lt;strong&gt;does&lt;/strong&gt; have a DTFT:&lt;/p&gt;&#xA;&lt;p&gt;DTFT:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{X}\left(e^{j\omega}\right) = \sum\limits_{n=-\infty}^{+\infty} \hat{x}[n] e^{-j \omega n} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{X}\left(e^{j\omega}\right)$&lt;/span&gt; is the Z-transform of &lt;span class=&quot;math-container&quot;&gt;$\hat{x}[n]$&lt;/span&gt; evaluated on the unit circle &lt;span class=&quot;math-container&quot;&gt;$z=e^{j\omega}$&lt;/span&gt; for infinitely many &lt;strong&gt;real&lt;/strong&gt; values of &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;. Now, if you were to sample that DTFT &lt;span class=&quot;math-container&quot;&gt;$\hat{X}\left(e^{j\omega}\right)$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; equally spaced points on the unit circle, with one point at &lt;span class=&quot;math-container&quot;&gt;$z=e^{j\omega}=1$&lt;/span&gt;, you would get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align} &#xA;\hat{X}\left(e^{j\omega}\right)\Bigg|_{\omega = 2 \pi\frac{k}{N}} &amp;amp; = \sum\limits_{n=-\infty}^{+\infty} \hat{x}[n] e^{-j \omega n} \Bigg|_{\omega = 2 \pi\frac{k}{N}} \\&#xA;&amp;amp; = \sum\limits_{n=-\infty}^{+\infty} \hat{x}[n] e^{-j 2 \pi k n/N}  \\&#xA;&amp;amp; = \sum\limits_{n=0}^{N-1} \hat{x}[n] e^{-j 2 \pi k n/N}  \\&#xA;&amp;amp; = \sum\limits_{n=0}^{N-1} x[n] e^{-j 2 \pi k n/N}  \\&#xA;&amp;amp; = X[k]  \\&#xA; \end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That is precisely how the DFT and DTFT are related.  Sampling the DTFT at uniform intervals in the &amp;quot;frequency&amp;quot; domain causes, in the &amp;quot;time&amp;quot; domain, the original sequence &lt;span class=&quot;math-container&quot;&gt;$\hat{x}[n]$&lt;/span&gt; to be repeated and shifted by all multiples of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and overlap-added.  That's what uniform sampling in one domain causes in the other domain.  But, since &lt;span class=&quot;math-container&quot;&gt;$\hat{x}[n]$&lt;/span&gt; is hypothesized to be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; outside of the interval &lt;span class=&quot;math-container&quot;&gt;$0 \le n \le N-1$&lt;/span&gt;, that overlap-adding does nothing.  It just periodically extends the non-zero part of &lt;span class=&quot;math-container&quot;&gt;$\hat{x}[n]$&lt;/span&gt;, our original finite-length sequence, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2024-01-30T21:35:19.820" LastActivityDate="2024-01-30T21:35:19.820" CommentCount="16" ContentLicense="CC BY-SA 4.0" />
  <row Id="18932" PostTypeId="1" AcceptedAnswerId="18951" CreationDate="2014-11-02T06:06:14.647" Score="0" ViewCount="83" Body="&lt;p&gt;I'm currently tagging insects with reflective tags and filming them in night-mode on my camera which has an infrared light. I have some markings on the tags which I need to catch on film. Unfortunately, when I film about 2 metres back, the the contrast between the reflective tag and the marking is too great, resulting in the white reflection being the only thing visible. Does anyone have any ideas for how to fix this problem? For instance by using filters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MCAzv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9azwd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8615" LastEditorUserId="8615" LastEditDate="2014-11-02T14:05:26.717" LastActivityDate="2014-11-03T07:50:03.937" Title="Detecting characters in high contrast/oversaturated regions" Tags="|video-processing|video|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18933" PostTypeId="1" CreationDate="2014-11-02T07:29:03.797" Score="-2" ViewCount="2013" Body="&lt;p&gt;I want to apply Hamming window function the Audio sample then find out its fft..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,Fs,bits] = wavread('file1.wav');&#xA;Nsamps = length(y); &#xA;ham= hamming(Nsamps);&#xA;ham_fft = abs(fft(ham));&#xA;ham_fft = ham_fft(1:Nsamps/2); % discarding Half points&#xA;plot(ham_fft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xdcsi.png&quot; alt=&quot;This is my FFT of the song file1.wav&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know whether i am getting the correct fft or not ..&lt;/p&gt;&#xA;" OwnerUserId="11321" LastEditorUserId="8202" LastEditDate="2014-11-02T09:01:00.430" LastActivityDate="2014-11-02T09:01:00.430" Title="FFT on Hamming Window Function" Tags="|fft|signal-analysis|frequency-spectrum|sampling|window-functions|" AnswerCount="1" CommentCount="2" ClosedDate="2014-11-17T08:33:13.230" ContentLicense="CC BY-SA 3.0" />
  <row Id="18934" PostTypeId="2" ParentId="18933" CreationDate="2014-11-02T08:57:55.360" Score="0" Body="&lt;p&gt;Your procedure is kind of wrong. You should:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Read the signal from a file.&lt;/li&gt;&#xA;&lt;li&gt;Create the Hamming window of the same length&lt;/li&gt;&#xA;&lt;li&gt;Multiply window by signal (on sample-by-sample basis)&lt;/li&gt;&#xA;&lt;li&gt;Take the FFT&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Therefore code should be like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,Fs,bits] = wavread('file1.wav');&#xA;Nsamps = length(y); &#xA;ham= hamming(Nsamps);&#xA;y_ham = y.*ham';&#xA;ham_fft = abs(fft(y_ham));&#xA;ham_fft = ham_fft(1:Nsamps/2); % discarding Half points&#xA;plot(ham_fft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-11-02T08:57:55.360" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="18936" PostTypeId="2" ParentId="18930" CreationDate="2014-11-02T10:20:14.270" Score="4" Body="&lt;p&gt;Audiophiles don't hear anything unless they are told what to expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Joke aside, this is equivalent to transposition by a bit less than a semitone. The effect won't be noticed on voices - this is way too low for any kind &quot;chipmunk&quot; effect to be observed. As for music, some people very familiar with the original music might detect the change of tonality and/or tempo. But such stretching ratios are not unusual at all - DJs doing beat-matching, TV channels speeding up a sitcom to squeeze in more ads, and many, many movie to video conversions (telecine) have routinely used it.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-11-02T13:02:14.290" LastActivityDate="2014-11-02T13:02:14.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18937" PostTypeId="1" CreationDate="2014-11-02T10:24:06.953" Score="0" ViewCount="741" Body="&lt;p&gt;I am using Excel. If I have an input and an output, and I know that a recursive band-pass filter produced the output, how can I can find the coefficients of that filter?&lt;/p&gt;&#xA;" OwnerUserId="11573" LastEditorUserId="4298" LastEditDate="2014-11-02T19:52:01.310" LastActivityDate="2014-11-03T07:51:44.793" Title="Identify the system from input and output" Tags="|filter-design|infinite-impulse-response|bandpass|system-identification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18938" PostTypeId="1" AcceptedAnswerId="18942" CreationDate="2014-11-02T14:26:27.030" Score="4" ViewCount="3922" Body="&lt;p&gt;I understand the reasons for zero-padding a finite signal before FFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I was reading this book (&lt;a href=&quot;http://www.dsprelated.com/dspbooks/sasp/Zero_Phase_Zero_Padding.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dsprelated.com/dspbooks/sasp/Zero_Phase_Zero_Padding.html&lt;/a&gt;) where the topic is Zero Phase Zero Padding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wqq9u.png&quot; alt=&quot;Top image: windowed finite signal. Bottom image: Zero Phase Zero Padded version of the same signal.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Top image: windowed finite signal. &#xA;Bottom image: Zero Phase Zero Padded version of the same signal.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The merit of Zero Phase Zero Padding over &quot;regular&quot; zero padding (whether adding zeros before, after or at both ends of the finite signal) isn't obvious to me. What is its advantage?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To help anyone else who might have this question in the future, I am adding my comments here and things I tried in order to understand this more - hopefully this will save time for anyone with this question in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After @matt-l's comment, I wrote a matlab script for seeing the difference in the magnitude and phase responses of a symmetric signal that was zero-padded in 3 ways (signal000000, 000signal000 and nal000000sig). The third one is Zero-Phase Zero Padding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imaginary part of the frequency response in case 3 is very close to 0 (on the order of magnitude of the noise floor - eps in Matlab). However, the unwrapped phase still exists - which, as Matt pointed out might be due to numerical issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B6Osd.png&quot; alt=&quot;Matlab plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/B6Osd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;High-res&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The script I wrote is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NSIG = 128; % Signal length&#xA;NFFT = 512; % FFT length&#xA;&#xA;% Make signal&#xA;n = 0:NSIG - 1;&#xA;w1 = pi/8; &#xA;w2 = 3*pi/4; % w1 and w2 are normalized frequencies of the signal&#xA;&#xA;signal = 0.5*cos(w1*n) + cos(w2*n);&#xA;&#xA;% Make signal symmetric about NSIG/2&#xA;signal = [fliplr(signal), signal(2:end)]; % Make signal symmetric&#xA;NSIG = length(signal);&#xA;&#xA;% Window the input&#xA;window = ones (size(signal));&#xA;% window = hanning(NSIG)';&#xA;raw_in = signal.*window;&#xA;&#xA;%% A. Zero pad at the end only&#xA;NZERO = NFFT-NSIG;&#xA;in = [raw_in, zeros(1,NFFT-NSIG)];&#xA;show_spec1 = fft (in);&#xA;&#xA;%% B. Zero pad on both sides&#xA;in = [zeros(1, floor(NZERO/2)), raw_in, zeros(1,ceil(NZERO/2))];&#xA;show_spec2 = fft (in);&#xA;&#xA;%% C. Zero phase zero pad&#xA;in = [raw_in(floor(NSIG/2)+1:NSIG), zeros(1,NZERO), raw_in(1:floor(NSIG/2))];&#xA;show_spec3 = fft (in);&#xA;&#xA;% Prepare to plot&#xA;fs = 500;&#xA;fres = fs/NFFT;     % Freq resolution&#xA;w = fres.*([0:NFFT/2, -NFFT/2+1:-1]);&#xA;figure;&#xA;&#xA;%% PLOTS&#xA;titleStr = 'A. - s i g n a l 0 0 0 0 0 0 -';&#xA;h(1) = subplot (3,2,1); stem (w, abs(show_spec1),'.-'); axis tight; title (titleStr); grid on;&#xA;xlabel('Frequency (Hz)'); ylabel('Magnitude');&#xA;h(2) = subplot (3,2,2); plot (w, unwrap(angle(show_spec1)),'r'); axis tight; title (titleStr); grid on;&#xA;xlabel('Frequency (Hz)'); ylabel('Unwrapped Phase');&#xA;&#xA;titleStr = 'B. - 0 0 0 s i g n a l 0 0 0 -';&#xA;h(3) = subplot (3,2,3); stem (w, abs(show_spec2),'.-'); axis tight; title (titleStr); grid on;&#xA;xlabel('Frequency (Hz)'); ylabel('Magnitude');&#xA;h(4) = subplot (3,2,4); plot (w, unwrap(angle(show_spec2)),'r'); axis tight; title (titleStr); grid on;&#xA;xlabel('Frequency (Hz)'); ylabel('Unwrapped Phase');&#xA;&#xA;titleStr = 'C. - n a l 0 0 0 0 0 0 s i g -';&#xA;h(5) = subplot (3,2,5); stem (w, abs(show_spec3),'.-'); axis tight; title (titleStr); grid on;&#xA;xlabel('Frequency (Hz)'); ylabel('Magnitude');&#xA;h(6) = subplot (3,2,6); plot (w, unwrap(angle(show_spec3)),'r'); axis tight; title (titleStr); grid on;&#xA;xlabel('Frequency (Hz)'); ylabel('Unwrapped Phase');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11557" LastEditorUserId="11557" LastEditDate="2014-11-02T21:32:53.853" LastActivityDate="2014-11-02T21:32:53.853" Title="Merits of &quot;Zero-Phase&quot; Zero Padding" Tags="|fft|signal-analysis|zero-padding|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18940" PostTypeId="2" ParentId="18862" CreationDate="2014-11-02T15:03:03.723" Score="0" Body="&lt;p&gt;&lt;strong&gt;SOLVED&lt;/strong&gt;,&#xA;thanks to the RBJ and Hilmar suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do is to use the Hilmar algorithm, with two minor changes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;instead of using the Hilmar clipping factor (xmax = 2 * rms(x)), I use the RBJ method (from Ivo Mateljan paper) that converges faster to the target Crest Factor.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I then added an instruction to break the iteration loop when the last calculated CF is equal or less than the target.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But what is very, very nice with the Hilmar algorithm is the possibility to shape the signal spectrum with the &quot;gains&quot; coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I actually do is to to feed this calculated signal to an &quot;Arbitrary Wave Generator&quot;  that generates the stimulus signal for a &quot;Vector Impedance Analyzer&quot;; the response is then read with an A/D with only 8 bits of resolution (digital oscilloscope DSOX3024A).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the impedance presents large modulus variations over the measurement frequency range, e.g. with series resonators, the response signal at the frequencies near to resonance is very weak and get masked within the quantization error.&#xA;Now, after a first measurent with a flat spectrum stimulus, I shape the signal spectrum as the inverse of the impedance modulus obtaing, then, much better results.&lt;/p&gt;&#xA;" OwnerUserId="11520" LastActivityDate="2014-11-02T15:03:03.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18941" PostTypeId="2" ParentId="18915" CreationDate="2014-11-02T15:09:24.023" Score="1" Body="&lt;p&gt;You can use &quot;&lt;em&gt;A Concise Introduction to Image Processing using C++&lt;/em&gt; &quot;(Chapman &amp;amp; Hall/CRC Numerical Analysis and Scientific Computing Series). If you are interested you can go for OpenCV. It has a large number of tutorials available in the internet  &lt;/p&gt;&#xA;" OwnerUserId="11547" LastEditorUserId="8202" LastEditDate="2014-11-02T16:20:12.563" LastActivityDate="2014-11-02T16:20:12.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18942" PostTypeId="2" ParentId="18938" CreationDate="2014-11-02T15:46:07.287" Score="4" Body="&lt;p&gt;This is just about obtaining a symmetric signal &lt;em&gt;after&lt;/em&gt; zero-padding. Take a symmetric signal (w.r.t. to time index $n=0$) and append zeros. Due to the implicit periodicity of the time signal used as input to the DFT, it does not matter if you append all zeros to the right, to the left, or on both ends of the symmetric signal. In any case, since the DFT/FFT assumes the first sample in the buffer to be the time origin, the input vector to the FFT needs to be arranged as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[right half of the signal | left half of the signal]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is basically one period of the periodically continued zero-padded signal between $n=0$ and $n=N-1$, where $N$ is the FFT length, i.e. the length of the signal &lt;em&gt;after&lt;/em&gt; zero-padding. Note that now all the zeros end up in the middle of the vector to be transformed. If done correctly, the result of the FFT will be purely real-valued (apart from numerical errors). If the signal is asymmetrical, its FFT will be purely imaginary.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-02T15:46:07.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18944" PostTypeId="2" ParentId="18913" CreationDate="2014-11-02T16:28:46.213" Score="1" Body="&lt;p&gt;Any (melody) musical instrument note has a fundamental frequency (think &quot;a sine wave&quot;) which our ears tend to interpret as a &quot;pitch&quot;, and a number of harmonics (extra sine waves) which are integer multiples of that fundamental frequency. These extra sine waves with double, triple, ... times the fundamental frequency add up to something that our ears tend to interpret as a timbre. The reason for why you find this special relation between fundamental frequency and harmonics is a consequence of the physics of how real instruments make sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference between an &quot;A4&quot; note on a piano and an &quot;A4&quot; note on a violin is in which harmonics are present in the sound, and how strongly they are present. One way to examine this is by comparing their respective spectrograms. Several audio tools allow you to draw a spectrogram for a given sound (e.g. sonic visualizer or audacity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For percussive instruments there's no easy relation between fundamental frequency and harmonics and the spectrum typically looks much noisier (many more high frequency components). Also the spectrum at the start of a melody instrument note (the so-called &quot;attack&quot;) will typically look noisier.&lt;/p&gt;&#xA;" OwnerUserId="11579" LastActivityDate="2014-11-02T16:28:46.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18945" PostTypeId="2" ParentId="18938" CreationDate="2014-11-02T16:43:14.713" Score="0" Body="&lt;p&gt;[New reply because I can't edit my previous comments.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for zero-phase padding is indeed to keep the signal as symmetrical as possible after zero padding. I wanted to add just this: be sure to give the zero-phase padded signal an odd size to get rid of unwanted shifting distortions.&lt;/p&gt;&#xA;" OwnerUserId="11579" LastActivityDate="2014-11-02T16:43:14.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18946" PostTypeId="2" ParentId="18912" CreationDate="2014-11-02T17:00:39.103" Score="1" Body="&lt;p&gt;Although it's not entirely clear to what you try to do (maybe there are better ways to accomplish your goal), I'll try to give some hints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There exist &quot;time stretching&quot; techniques that can slow down a sample without changing its pitch, but they are not trivial to implement yourself. Some audio editors have plugins that support this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a poor man's implementation, if the sound has a single pitch, you can try something like the following (I've successfully used this in the past to extend a long, sung, single note):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I cut the sound in three parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sound -&gt; | Begin | Middle | End |&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Always cut at zero crossings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, if you make &quot;Middle&quot; short enough, like around 0.1 seconds or so, you can repeat it a number of times times to stretch your sound a bit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;| Begin | Middle | Middle | Middle | Middle | Middle | Middle | End |&lt;/p&gt;&#xA;" OwnerUserId="11579" LastActivityDate="2014-11-02T17:00:39.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18947" PostTypeId="2" ParentId="18937" CreationDate="2014-11-02T19:10:20.523" Score="2" Body="&lt;p&gt;You can use an equation error method and get an estimation of the coefficients by solving an overdetermined system of linear equations. The transfer function of an IIR filter is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{B(z)}{A(z)}=\frac{\sum_{m=0}^{M}b[m]z^{-m}}{1+\sum_{n=1}^{N}a[n]z^{-n}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1), for given input and output sequences $x[n]$ and $y[n]$, respectively, the following equation must be satisfied:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(a*y)[n]=(x*b)[n]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $*$ denotes convolution. Equation (2) can be written in matrix/vector form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{y}=\mathbf{Xb}-\mathbf{Ya}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{y}$ is the vector of the output signal, $\mathbf{b}$ and $\mathbf{a}$ are the unknown coefficient vectors (excluding $a[0]=1$), and $\mathbf{X}$ and $\mathbf{Y}$ are the convolution matrices consisting of the values of the input and output sequences, respectively. Equation (3) can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{y}=\mathbf{[-Y,X]\cdot[a,b]^T}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $^T$ denotes transposition. The overdetermined system (4) can be solved in a least squares sense using standard methods, such as the &lt;a href=&quot;http://www.mathworks.nl/help/matlab/ref/mldivide.html&quot; rel=&quot;nofollow&quot;&gt;one implemented in Matlab&lt;/a&gt; or Octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in any case you need to estimate/choose the orders $M$ and $N$ of the numerator and denominator polynomials in (1). For most standard filters you have $M=N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This little Matlab/Octave script shows how it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=randn(100,1);       % some input signal&#xA;a=[1 .3 -.4 .2 .1];   % denominator coefficients&#xA;b=[2 3 4 3 2];        % numerator coefficients&#xA;y=filter(b,a,x);      % filter output&#xA;M=3;                  % guessed numerator order&#xA;N=3;                  % guessed denominator order&#xA;&#xA;% build matrices and solve overdetermined linear system&#xA;A = flipud(hankel(flipud(y(:)))); A1 = A(:,1); A = A(:,2:N+1);&#xA;B = flipud(hankel(flipud(x(:)))); B = B(:,1:M+1);&#xA;C = [-A,B];&#xA;c = C\A1;&#xA;a1 = [1;c(1:N)];&#xA;b1 = c(N+1:M+N+1);&#xA;&#xA;% compare outputs of original and estimated filter&#xA;y1=filter(b1,a1,x);&#xA;n=1:100;&#xA;plot(n,y,n,y1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-03T07:51:44.793" LastActivityDate="2014-11-03T07:51:44.793" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18948" PostTypeId="2" ParentId="18932" CreationDate="2014-11-02T20:10:36.820" Score="0" Body="&lt;p&gt;Use your camera's RAW mode, if it has one, and underexpose. If these concepts are not familiar to you, head over to &lt;a href=&quot;https://photo.stackexchange.com/&quot;&gt;https://photo.stackexchange.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the first picture a close-up of the second one, because the letter K on the tag is quite legible? If not, you may also want to use a higher resolution camera, and/or not shoot from such a distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think about it, you are asking us to robustly encode roughly four bits (on letter of the English alphabet), judging by the first picture. You could simply map the binary representation of the letter to five boxes; four in a square and one on the side, so you don't get any confusion due to symmetry. (If you laid them side by side you wouldn't know which side is which.) If you need to encode multiple letters, you could try using QR or a barcode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your first order of business has to be getting the exposure under control. I'd investigate the possibility of using aftermarket firmware if the manufacturer's doesn't give you enough control.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="-1" LastEditDate="2017-04-13T12:43:53.770" LastActivityDate="2014-11-03T07:21:12.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18949" PostTypeId="1" CreationDate="2014-11-03T01:34:01.287" Score="0" ViewCount="52" Body="&lt;p&gt;I have to estimate the parameters of a 1st order transfer function, namely, the coefficients, through experiment. I ran a few experiments and I have a bunch of input-output data vectors. The experiment was a standard frequency response test, i.e., the inputs were a bunch of different frequency sine waves, around the frequency of our guess of where the pole should be. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, there is some &lt;strong&gt;nasty&lt;/strong&gt; noise involved. And I mean real &lt;strong&gt;nasty&lt;/strong&gt;. Sometimes the noise clearly has  amplitude as big as the signal itself, sometimes you just can't see any signal at all. Our first approach consisted on bandpass filtering the output and using &lt;code&gt;lsqcurvefit&lt;/code&gt; to estimate the parameters of the transfer function. However, it's not working all that great, mainly because of the terrible SNR (simulations with more reasonable SNR worked just fine). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to go about this? I've read about the kalman filter, which supposedly is the optimal filter, which should be good, but it seems to be a &lt;em&gt;state&lt;/em&gt; estimator and this is not what I'm looking for, I have a measured state, I need a &lt;em&gt;parameter&lt;/em&gt; estimator. Maybe there's a way to use the kalman filter for this? Can you explain/point me in the right direction to learn about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If kalman is not the way to go, what other way could we try, rather than butter + lsqcurvefit? Any general advice on dealing with noisy data other than bandpass filtering?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="5731" LastActivityDate="2014-11-03T01:34:01.287" Title="Estimating plant parameters from noisy frequecy response data" Tags="|noise|kalman-filters|estimation|denoising|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18950" PostTypeId="1" CreationDate="2014-11-03T01:58:41.453" Score="1" ViewCount="595" Body="&lt;p&gt;Given a (FFT-sized) frame of data, and detection of a spectral component statistically above the noise floor in the FFT of this window, what characteristics or signal analysis could be used to determine that this spectral component is more likely to be a linearly swept sinusoid, rather than one that is stationary across the frame?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, assuming the dF/dt sweep across the data window is small (from a fraction of an FFT bin to a couple bins), how can one estimate the sweep parameter (but, beyond answer offered to this &lt;a href=&quot;https://dsp.stackexchange.com/questions/3245/how-can-the-fft-be-used-for-estimating-linear-chirp-parameters&quot;&gt;question&lt;/a&gt;, assuming this is an estimation of a detected signal in noise.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One offered solution seems to be to segment the FFT frame into several shorter subframes, do shorter STFTs, and look for a linear best fit among the resulting set of subframe FFT peak magnitude frequency estimates (which all have poorer frequency resolution due to the shorter subframes).  Are there any other or better options for detection and estimation?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2018-06-20T18:15:05.780" Title="Detecting a frequency swept sinusoid and its parameters?" Tags="|signal-analysis|frequency-spectrum|signal-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18951" PostTypeId="2" ParentId="18932" CreationDate="2014-11-03T07:50:03.937" Score="0" Body="&lt;p&gt;Reducing exposure time should be enough to work with here. &#xA;Since you're video recording their movements (from my experience) there isn't much else you can do unless you can get a much higher resolution as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just an idea for an alternative way of tracking, (and I believe I'm treading dangerous waters here because &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) this is an idea and I don't even know what you want to do with the video, so I chose tracking as a possible application&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) not sure if it complies with the rules of answering a question) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can take a picture of the first shot with a high res camera (change exposure time, shutter speed etc.) and then immediately record a video with your hardware after that, you should be able to see the tags on the insects clearer in the image you first took. &#xA;If you want to track patters of a specific insect, perhaps extract the location of the corresponding tag in the image and the insect would be very close to the same location in the very beginning of the video (if not at the same spot)&#xA;Then you should be able to understand where which insect is in the video and track them.&#xA;The caveats here would be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i) Taking a low exposure high res image first and immediately taking a video after that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ii) if there's a cluster of insects all close to each other, you'd have to manually verify that the location in the video corresponding to the one you chose in the image has the right insect. Else you might end up tracking the wrong insect with the wrong tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iii) involves processing after capture of the entire video (or real time possible too)&lt;/p&gt;&#xA;" OwnerUserId="11433" LastActivityDate="2014-11-03T07:50:03.937" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18952" PostTypeId="2" ParentId="11290" CreationDate="2014-11-03T09:28:45.550" Score="2" Body="&lt;p&gt;I found a proper C-Code example on this page&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/showcode/173.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showcode/173.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It helped me a lot, so maybe some of you are also interested...&lt;/p&gt;&#xA;" OwnerUserId="11585" LastActivityDate="2014-11-03T09:28:45.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18956" PostTypeId="1" AcceptedAnswerId="18959" CreationDate="2014-11-03T15:45:34.553" Score="0" ViewCount="2658" Body="&lt;p&gt;IIR filters have feedback whereas FIR filters don't use feedback.&#xA;Then why is it said that FIR filters sometimes have the disadvantage that they require more memory and/or calculation to achieve a given filter response characteristic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please explain explain what is it that makes FIR filter computationally more complex compared to IIR although it doesnt use feedback?   &lt;/p&gt;&#xA;" OwnerUserId="11591" LastActivityDate="2014-11-03T17:01:44.847" Title="FIR vs IIR complexity" Tags="|filters|infinite-impulse-response|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18958" PostTypeId="1" CreationDate="2014-11-03T16:21:06.260" Score="0" ViewCount="60" Body="&lt;p&gt;A constellation diagram has points at the following coordinates: &lt;code&gt;(2,2)&lt;/code&gt;, &lt;code&gt;(2,-2)&lt;/code&gt;, &lt;code&gt;(-2,2)&lt;/code&gt;, &lt;code&gt;(0,-2)&lt;/code&gt;. What is the modulation used by the modem? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is literally never explained in my textbook and I can't do it by logic, since I have NO clue what a constellation diagram is.&lt;/p&gt;&#xA;" OwnerUserId="11593" LastEditorUserId="7092" LastEditDate="2014-11-03T16:24:40.723" LastActivityDate="2014-11-03T16:24:40.723" Title="Calculating the modulation based on the coordinates in the constellation diagram" Tags="|signal-analysis|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18959" PostTypeId="2" ParentId="18956" CreationDate="2014-11-03T17:01:44.847" Score="1" Body="&lt;p&gt;while it is true that FIR filters don't &lt;strong&gt;necessarily&lt;/strong&gt; use feedback, there &lt;strong&gt;are&lt;/strong&gt; FIR filters that &lt;strong&gt;do&lt;/strong&gt; use feedback.  the name for these kind of FIRs coined by Julius Smith and Avery Wang is &lt;em&gt;&quot;Truncated IIR&quot;&lt;/em&gt; or &quot;TIIR&quot;.  a moving average filter, where the moving sum is computed with an accumulator where the new sample is added and some old sample is subtracted, that is an example of a TIIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another method of doing an FIR is the use of the FFT and &lt;em&gt;&quot;fast convolution&quot;&lt;/em&gt;.  but there is no feedback with this method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the measure of &quot;complexity&quot; of filters is usually how many multiply-accumulate (or &quot;MAC&quot;) instructions, per sample, are needed to do the job.  if &lt;strong&gt;sharp&lt;/strong&gt; filtering is needed, impulse responses must be long and, for a simple FIR, that means many MAC instructions.  but a low-order IIR can still have a long impulse response, even if there are few MAC instructions &lt;strong&gt;because&lt;/strong&gt; of the feedback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if you can do the same basic job (like low-pass filtering) with a low-order IIR, in comparison to doing the essentially the same job with an FIR that would have scores or hundreds of MAC instructions, it should be clear what advantages regarding complexity the IIR method will have.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-11-03T17:01:44.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18961" PostTypeId="2" ParentId="16735" CreationDate="2014-11-03T21:33:08.453" Score="1" Body="&lt;p&gt;you could explore the possibilities of the essentia C++ audio analysis library&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see &lt;a href=&quot;http://essentia.upf.edu/&quot; rel=&quot;nofollow&quot;&gt;http://essentia.upf.edu/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is not a complete solution to your problem, but rather provides some of the building blocks you'd need to build a solution to your problem&lt;/p&gt;&#xA;" OwnerUserId="11579" LastActivityDate="2014-11-03T21:33:08.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18962" PostTypeId="2" ParentId="11442" CreationDate="2014-11-03T21:36:09.550" Score="1" Body="&lt;p&gt;The book &quot;Algorithmic Composition&quot; by Gerhard Nierhaus provides a very readable overview of approaches to automatic music composition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.springer.com/mathematics/applications/book/978-3-211-75539-6&quot; rel=&quot;nofollow&quot;&gt;https://www.springer.com/mathematics/applications/book/978-3-211-75539-6&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It may be cheaper on other book selling web sites)&lt;/p&gt;&#xA;" OwnerUserId="11579" LastActivityDate="2014-11-03T21:36:09.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18963" PostTypeId="2" ParentId="12998" CreationDate="2014-11-03T21:41:14.467" Score="0" Body="&lt;p&gt;There's an open source tool called zita-at1 that performs autotuning.&#xA;If you're interested in how these things work, you may want to check it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://kokkinizita.linuxaudio.org/linuxaudio/zita-at1-doc/quickguide.html&quot; rel=&quot;nofollow&quot;&gt;http://kokkinizita.linuxaudio.org/linuxaudio/zita-at1-doc/quickguide.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html&quot; rel=&quot;nofollow&quot;&gt;http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11579" LastActivityDate="2014-11-03T21:41:14.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18964" PostTypeId="2" ParentId="18899" CreationDate="2014-11-03T22:18:17.437" Score="1" Body="&lt;p&gt;I make you an example about how to write state-space equations using a dynamic second order equation to let you understand the procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The starting equation is: $$M a + C v + K  s = f $$ &#xA;$C$ is damping, $K$ is stiffness and $M$ is the mass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then build your state vector $x =\pmatrix{s\\ v}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now write the equation like $ a = 1/M (f - C v - K s)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dot{x} = \pmatrix{v\\ a}$ &#xA;is the derivative of the state vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the state space:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dot{x} = \pmatrix{0&amp;amp; 1, \\-K/M&amp;amp; -C/M} x + \pmatrix{0 \\ 1/M} f$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the displacement as output&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y = \pmatrix{1\\ 0} x $&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="8202" LastEditDate="2014-11-03T22:37:15.617" LastActivityDate="2014-11-03T22:37:15.617" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="18965" PostTypeId="1" AcceptedAnswerId="18971" CreationDate="2014-11-03T22:59:21.830" Score="0" ViewCount="1314" Body="&lt;p&gt;thanks for taking the time to help with this problem!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to prove the time-scaling property:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_{(m)}[n] =&#xA;\begin{cases}&#xA;x[n/m], &amp;amp; n=0,\pm m, \pm 2m,...\\&#xA;0, &amp;amp; otherwise&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, for part (a), Show  that   $$x_{(m)}[n]$$ has  a  period  of $$ mN$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, for part (b), Show  that   if $$\\x[n]=v[n]+w[n]\\$$ then$$\\x_{(m)}[n]=v_{(m)}[n]+w_{(m)}[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a bit more to the problem after this, but I'm mostly concerned with these first two pieces. I know that for a periodic function $$x[n]=x[n+N]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I supposed to somehow prove that $$x[n/m+mN]=x[n/m]$$&#xA;using the Discrete Fourier Series analysis equation? What is a rigorous way to prove this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For part (b), I'm unsure of how to prove the linearity in a way that doesn't seem trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5504" LastEditorUserId="7092" LastEditDate="2014-11-04T00:46:45.830" LastActivityDate="2014-11-04T06:52:41.253" Title="Deriving time-scaling property for Fourier Series" Tags="|discrete-signals|fourier-series|periodic|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18966" PostTypeId="1" CreationDate="2014-11-03T23:06:08.067" Score="0" ViewCount="147" Body="&lt;p&gt;Suppose I have a stationary process $\phi(t)$ with a known autocorrelation function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ A(\tau) \equiv \langle \phi(0) \phi(\tau) \rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and suppose I also know that $\phi(t)$ is Gaussian distributed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a particular realization of the process in which $\phi(0)=\phi_0$, what is the conditional distribution of $\phi(t)$ for later times in that realization?&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="7361" LastEditDate="2015-06-14T18:33:29.887" LastActivityDate="2015-06-15T20:23:50.623" Title="How do we compute distrubtions of the value of a random process conditional on initial conditions?" Tags="|autocorrelation|stochastic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18967" PostTypeId="1" AcceptedAnswerId="18975" CreationDate="2014-11-04T01:08:12.073" Score="0" ViewCount="556" Body="&lt;p&gt;I am given the following signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[e^{-at}cos(w_{o}t)]u(t),\ a&amp;gt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I am told to find the Fourier Transform, which tells me I need an answer of the form: &#xA;$$X(jw)=\int_{-\infty}^\infty \! x(t)e^{-jwt} \, \mathrm{d}t.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can reset the bounds of my integral with the unit step function, so my equation becomes&#xA;$$X(jw)=\int_{0}^\infty \! e^{-at}cos(w_ot)e^{-jwt} \, \mathrm{d}t.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here, can I essentially solve this out and get a correct answer, keeping $w$ and $w_o$ as separate variables?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also know I can solve it by using the relation &#xA;$$x(t)=a(t)b(t)\xrightarrow{\mathscr{F}} X(jw)=\frac{1}{2\pi}A(jw)*B(jw)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, essentially, I can figure out a transform for each part and convolve to find my answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the book examples, it seems $cos(w_ot)$ can be broken down into $\pi\delta(w-w_o)+\pi\delta(w+w_o).$ If we convolve this with the result from the transform of $e^{-at}u(t)$, a correct answer should be obtained. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is known that $X(jw)$ when $x(t)=e^{-at}$ is $\frac{1}{(a+jw)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, since impulses sift through the other function in a convolution to get the nonzero values, is the following a correct result? $$\frac{1}{2\pi}(\pi)(\frac{1}{(a+j(w-w_o))}+\frac{1}{(a+j(w+w_o))})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$=\frac{1}{2}(\frac{1}{(a+j(w-w_o))}+\frac{1}{(a+j(w+w_o))})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you, sorry for the long question!&lt;/p&gt;&#xA;" OwnerUserId="5504" LastActivityDate="2014-11-04T08:50:43.740" Title="Fourier Transform Problem - absolute value, time-saving tricks, etc" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18968" PostTypeId="1" CreationDate="2014-11-04T02:19:44.880" Score="0" ViewCount="28" Body="&lt;p&gt;This is part formula of command-response model (Fujisaki Model)：&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Analysis and synthesis of fundamental frequency contours of Standard Chinese using the command–response model &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0167639305001706&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.sciencedirect.com/science/article/pii/S0167639305001706&lt;/a&gt;&#xA; Why they are critically-damped second-order linear systems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0YTDn.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11595" LastEditorUserId="11595" LastEditDate="2014-11-04T02:34:21.123" LastActivityDate="2014-11-04T02:34:21.123" Title="Why the formula below are critically-damped second-order linear systems?" Tags="|speech-processing|speech|math|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="18971" PostTypeId="2" ParentId="18965" CreationDate="2014-11-04T06:52:41.253" Score="1" Body="&lt;p&gt;It looks more like zero padding to create up-sampling resolution to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prove&#xA;x[n/m+N]=x[n/m], since your argument is now n/m and not n.&lt;/p&gt;&#xA;" OwnerUserId="7608" LastActivityDate="2014-11-04T06:52:41.253" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18972" PostTypeId="2" ParentId="1740" CreationDate="2014-11-04T07:18:06.697" Score="0" Body="&lt;p&gt;If the modulus of the slope of your sawtooth voltage is A, then your Fourier Co-efficient, if you are talking about a continuous time fourier series, is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cn=-(A&lt;em&gt;To/((n&lt;/em&gt;pi)^2))&lt;em&gt;((Sin((n&lt;/em&gt;pi)/2))^2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hint: double differentiate your signal till you end up with dirac delta functions, they are easy to modify.&lt;/p&gt;&#xA;" OwnerUserId="7608" LastActivityDate="2014-11-04T07:18:06.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18974" PostTypeId="1" AcceptedAnswerId="18992" CreationDate="2014-11-04T08:35:21.970" Score="1" ViewCount="600" Body="&lt;p&gt;I have been studying about the box window and am unable to understand one thing, do we first sample a signal and then window it resulting in up-scaling or downscaling, or is windowing a practical case of sampling itself which is performed on a continuous time signal?  &lt;/p&gt;&#xA;" OwnerUserId="7608" LastEditorUserId="8202" LastEditDate="2014-11-04T09:36:15.730" LastActivityDate="2018-11-20T04:51:33.940" Title="Where do we use windowing?" Tags="|window-functions|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="18975" PostTypeId="2" ParentId="18967" CreationDate="2014-11-04T08:50:43.740" Score="0" Body="&lt;p&gt;As you suggested, you could simply solve the integral using $\cos(\omega_0t)=(e^{j\omega_0t}+e^{-j\omega_0t})/2$. But as you've also noted, with this type of problems there is usually some smart way using known transform pairs. And what you suggested appears to me a very sane approach: convolve the known transform of $\cos(\omega_0t)$ with the known transform of $e^{-at}u(t)$ and you're done. I would recommend to you to cross-check your result by solving the integral, which in this case is also quite straight-forward. But I can assure you that your result looks good.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-04T08:50:43.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18976" PostTypeId="1" AcceptedAnswerId="18978" CreationDate="2014-11-04T10:34:22.803" Score="-1" ViewCount="603" Body="&lt;p&gt;I need to do an ir convreverb on a lot of wav files i got, always with impulse responses of different rooms. it does not have to be zero latency so even calculating the convolutional reverb would be fine. I'm just searching for a possibility to do this from the commandline. Does anybody know a tool that can do what i'm searching for.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10949" LastActivityDate="2014-11-04T11:49:55.063" Title="linux commandline impulse response convolution reverb" Tags="|impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18977" PostTypeId="2" ParentId="18976" CreationDate="2014-11-04T10:53:49.857" Score="-1" Body="&lt;p&gt;You could do what you need with Matlab, or use Gnu Octave instead (Octave is free.)  Scipy would also be an alternative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, you will end up doing some coding to get what you want.  Whether you go with Matlab code, python code, or something else depends on your skills and programming experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.de/support/sysreq/current_release/index.html;jsessionid=a6bbef6ef3a124e7dc33191dd7a1?sec=linux&quot; rel=&quot;nofollow&quot;&gt;Matlab&lt;/a&gt; - commercial software.  I'm sure there is a download for a free demo on the site somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.gnu.org/software/octave/&quot; rel=&quot;nofollow&quot;&gt;Octave&lt;/a&gt; - you can probably install this through your distributions package management.  You will also want to install the signal processing package through the Octave internal package management.  Octave code is nearly one to one compatible with Matlab, so any Matlab examples you find will mostly just work und Octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.scipy.org/install.html&quot; rel=&quot;nofollow&quot;&gt;Scipy&lt;/a&gt; - you can probably install this through your distributions package management.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Matlab and Octave, the function you need is &lt;a href=&quot;http://octave.sourceforge.net/control/function/impulse.html&quot; rel=&quot;nofollow&quot;&gt;impulse&lt;/a&gt; - all you have to do is add the functionality for reading your files, using the impulse function, then writing the impulse response to another file.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-11-04T11:00:10.133" LastActivityDate="2014-11-04T11:00:10.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18978" PostTypeId="2" ParentId="18976" CreationDate="2014-11-04T11:49:55.063" Score="3" Body="&lt;p&gt;I use Jconvolver for that. It's a convolution reverb for JACK but it comes with a commandline utility called fconvolver. It takes some time setting up, but does the job nicely.&lt;/p&gt;&#xA;" OwnerUserId="10892" LastActivityDate="2014-11-04T11:49:55.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18979" PostTypeId="2" ParentId="18950" CreationDate="2014-11-04T12:32:51.690" Score="3" Body="&lt;p&gt;You could compute the instantaneous frequency of the signal in the frame. This can be done as outlined in &lt;a href=&quot;https://library.seg.org/doi/abs/10.1190/1.1443220?journalCode=gpysa7&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (e.g. Eq.(9)). You need to compute the analytic signal using a Hilbert transformer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_a[n]=x[n]+jx_h[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_h[n]$ is the Hilbert transform of $x[n]$. The instantaneous frequency is given by the (discrete-time) derivative of the phase of (1). If you use a first order difference for approximating the discrete-time derivative you'll get the formula given in Eq. (9) of the paper cited above. Given an estimate of the instantaneous frequency, you could simply fit a line to estimate the sweep parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This little Matlab/Octave script shows how this approach would work with a toy problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% create chirp signal&#xA;N = 256;&#xA;n=(0:N-1)';&#xA;fx=(0.1+0.01*n/N);&#xA;x=sin(2*pi*fx.*n);&#xA;&#xA;% compute analytic signal&#xA;xh=hilbert(x);&#xA;xr=real(xh);xi=imag(xh);&#xA;&#xA;% compute instanteneous frequency (could be done over fewer points)&#xA;tmp1 = xr(1:N-1).*xi(2:N) - xr(2:N).*xi(1:N-1);&#xA;tmp2 = xr(1:N-1).*xr(2:N) + xi(1:N-1).*xi(2:N);&#xA;f=atan2(tmp1,tmp2)/(2*pi);  % (biased) estimate of instanteneous frequency&#xA;&#xA;% linear regression over center values of f&#xA;skip = floor(N/4);    % skip unreliable points at beginning and end of f&#xA;na = skip:(N-skip);&#xA;A=[ones(length(na),1),na(:)];&#xA;u=A\f(na);&#xA;&#xA;f0=u(1); k=u(2)/2;  % remove bias&#xA;[f0,k]&#xA;&#xA;% reconstructed linear frequency&#xA;fr = f0 + k*n;&#xA;&#xA;plot(n,fx,(2:N),f-k*(2:N)',n,fr,':')&#xA;legend('exact','estimated','reconstructed')&#xA;axis([0,N,f0*.9,(f0+k*N)*1.1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plot shows the actual linear frequency of the signal (blue), the estimate from the analytic signal (green), and the reconstructed frequency obtained from fitting a line through the estimated frequency. Note that the estimate is unreliable at both ends, so the line is fitted to the center values of the frequency estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/f0Aqf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2018-06-20T18:15:05.780" LastActivityDate="2018-06-20T18:15:05.780" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="18980" PostTypeId="2" ParentId="18974" CreationDate="2014-11-04T12:46:32.630" Score="1" Body="&lt;p&gt;Windowing is something you do after sampling, but before calculating the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you sample a signal, you end up with a finite set of samples. Let's say you sample from $t=T_1$ to $t=T_2$. Usually, the signal around $T_1$ is very different from the signal around $T_2$. For example, the sample at $T_1$ could be large and positive, and the sample at $T_2$ could be large and negative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the FFT assumes that the set of samples corresponds to exactly one period of a periodic signal. The period is $T_2-T_1$. The (possibly large) discontinuity between the sample at $T_1$ and the sample at $T_2$ introduces large frequency content that is not present in the original, continuous-time signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Windowing the signal reduces that discontinuity, by reducing the samples' amplitude at both ends. There are many kinds of windows, each with particular advantages and disadvantages.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-11-04T12:46:32.630" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="18981" PostTypeId="1" AcceptedAnswerId="18983" CreationDate="2014-11-04T13:48:37.053" Score="0" ViewCount="456" Body="&lt;p&gt;So I have a signal which is caused by an impulse train. I can determine the impulse train with 500hz but sample my output signal with only 10hz. Then I want to calculate an impulse response function. So I have a binary &quot;signal&quot; for the impulses with 50 times more samplepoints then my actual signal. If I resample my binary signal using fourier which I would do with an ordinary signal, I get Gibbs ringing and I doubt my impulse response function would still make sense. I can choose the nearest neighbor to be 1 in my &quot;downsampled&quot; impulse train but then the timing is less accurate, I could divide the impulse over the two neirest neighbors bu then no single point will have the value of 1. What would be a correct way to go about this?&lt;/p&gt;&#xA;" OwnerUserId="5273" LastActivityDate="2014-11-04T15:53:05.773" Title="What is a correct way to downsample an impulse train" Tags="|sampling|impulse-response|downsampling|resampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18982" PostTypeId="2" ParentId="16735" CreationDate="2014-11-04T14:30:31.570" Score="2" Body="&lt;p&gt;The paper &quot;An Industrial-Strength Audio Search Algorithm&quot; is really a nice example of how extract audio fingerprints, the proposed algorithm works extremely well, you can realy hit audio with a lot of noise because you are always looking for the spectrogram peak and it can survive better in noisy conditions!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this paper show the BASIC idea behind shazam, there are many unrevealed secrets, but I can tell you that the BASIC works well because I did the steps described in this paper, and I can match a lot of songs in noise conditions, using samples of about 10 seconds was enough to get good results in my tests, for audio sampled at 44100hz I just used a window size of 4096 samples overlapping in 50% and I can match altered sounds with echo, reverb, WahWah, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another nice algorithm is an proposed by Philips &lt;a href=&quot;http://ismir2002.ismir.net/proceedings/02-FP04-2.pdf&quot; rel=&quot;nofollow&quot;&gt;A Highly Robust Audio Fingerprinting System&lt;/a&gt;, This algorithm show you how build fingerprints at every 3 seconds of sound, this mean that maybe you need just 3 seconds of sample to match one song, the paper show you how split the signal in 33 log spaced Frequency band and compute the Energy Difference from each Band to extract a 32-bit sub-fingerprint. In my tests got results similar to shazam, works especially if you want to have hits into small samples like 3 seconds.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2014-11-04T14:30:31.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18983" PostTypeId="2" ParentId="18981" CreationDate="2014-11-04T15:53:05.773" Score="1" Body="&lt;p&gt;The usual way to do this is with a low-pass decimating FIR filter.  If you are going to decimate by a factor of 50 then you will probably want to break it up into multiple LPF decimation filters.  I would probably do it as /10 followed by /5.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-11-04T15:53:05.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18985" PostTypeId="1" CreationDate="2014-11-04T17:56:50.510" Score="0" ViewCount="194" Body="&lt;p&gt;I know that to build Harmonizer I need pitch shift the signal in differents ways, my question is how know for what scale/factor/notes/frequency I need pitch shift to create harmony?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if i press a middle C piano key how create two or three harmonization for this key ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe to create 3 harmonizer the output should be similar to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MixHarmony = OriginalSound + Pitch_shifted_to_X + Pitch_shifted_to_Y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5325" LastActivityDate="2014-11-04T22:10:40.560" Title="Harmonizer Effect" Tags="|audio|" AnswerCount="1" CommentCount="2" ClosedDate="2014-12-02T22:25:22.233" ContentLicense="CC BY-SA 3.0" />
  <row Id="18988" PostTypeId="1" AcceptedAnswerId="18990" CreationDate="2014-11-04T19:51:22.330" Score="1" ViewCount="1485" Body="&lt;p&gt;I'm trying to understand why Matlab function upsample causes contraction in the spectrum, like the following figure shows. &lt;img src=&quot;https://i.stack.imgur.com/wHFWM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also showed in mathwork online document. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/ug/upsampling-imaging-artifacts.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;enter link description here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtering after upsampling removes the imaging artifacts, but contraction still stays, as shown below. Could anyone help explain in details why? &lt;img src=&quot;https://i.stack.imgur.com/gGaRY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/ug/filtering-after-upsampling-interpolation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;enter link description here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8907" LastActivityDate="2014-11-04T21:00:52.840" Title="why upsampling contracts the spectrum?" Tags="|matlab|signal-analysis|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18990" PostTypeId="2" ParentId="18988" CreationDate="2014-11-04T21:00:52.840" Score="3" Body="&lt;p&gt;I prefer to think of it as expanding the spectrum due to increasing the sample rate.  When you expand the frequency spectrum you reveal the aliases that were already there in the other Nyquist zones.  See &lt;a href=&quot;https://dsp.stackexchange.com/questions/1775/understanding-multirate-filtering-fundamentals/1781#1781&quot;&gt;this answer&lt;/a&gt; for more detail about this.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-11-04T21:00:52.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18991" PostTypeId="2" ParentId="18985" CreationDate="2014-11-04T22:10:40.560" Score="2" Body="&lt;p&gt;You have to have use some basic music theory to know &quot;how to harmonize middle-C&quot;. For example, if you play a G4 and E4, you will be making a harmony with a basic 3-note chord (C-E-G). However, this is only the simplest option and there are many combinations of notes in the theory of Harmony.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get from notes that create the harmony (C-E-G) to frequencies (to pitch-shift the signal), you need to use a pitch standard like &lt;a href=&quot;http://en.wikipedia.org/wiki/A440_%28pitch_standard%29&quot; rel=&quot;nofollow&quot;&gt;A440&lt;/a&gt; and a scale (from which to select notes). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps to start, it would be better to use the standard &lt;a href=&quot;http://en.wikipedia.org/wiki/Piano_key_frequencies&quot; rel=&quot;nofollow&quot;&gt;Piano key frequencies&lt;/a&gt;, to quickly get the required frequencies (note use of A440)&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2014-11-04T22:10:40.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="18992" PostTypeId="2" ParentId="18974" CreationDate="2014-11-05T04:22:04.567" Score="4" Body="&lt;p&gt;Alright, the way to think about the rectangular window (as well as all of the other windows) is that you begin with an infinite sequence of samples and you multiply the samples outside the window with 0 and the samples within the window with something non-zero (and usually, but not always, positive).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the DFT (of which the FFT is fast method of doing the DFT) &lt;strong&gt;does&lt;/strong&gt; periodically extend the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples passed to it.  But there are a couple of different ways of looking at it.  One way to look at it is with just the definitions of the DFT and iDFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ X[k] = \sum\limits_{n=0}^{N-1} x[n] \ e^{-j 2 \pi nk/N}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x[n] = \frac{1}{N}\sum\limits_{k=0}^{N-1} X[k] \ e^{j 2 \pi nk/N}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; that the DFT &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; is aware of is simply a periodic sequence with period of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. both &lt;span class=&quot;math-container&quot;&gt;$$ x[n+N]=x[n] $$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$ X[k+N]=X[k] $$&lt;/span&gt; are true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the alternative way to think about the DFT is that it is the sampling of the spectrum of the Discrete-Time Fourier Transform (DTFT):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{X}\left( e^{j \omega} \right) = \sum\limits_{n=-\infty}^{+\infty} \hat{x}[n] \ e^{-j \omega n}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ \hat{x}[n] =&#xA;\begin{cases}&#xA;0, &amp;amp; n &amp;lt; 0 \\&#xA;x[n], &amp;amp; \text{for }0 \le n &amp;lt; N \\&#xA;0, &amp;amp; N \le n&#xA;\end{cases} $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this is the same as multiplying by a rectangular window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{x}[n] \ = \ x[n] \ w[n]  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ w[n] =&#xA;\begin{cases}&#xA;0, &amp;amp; n &amp;lt; 0 \\&#xA;1, &amp;amp; \text{for }0 \le n &amp;lt; N \quad \quad \\&#xA;0, &amp;amp; N \le n&#xA;\end{cases} $&lt;/span&gt;  (length-&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; rectangular window)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here you cannot tell that you extracted &lt;span class=&quot;math-container&quot;&gt;$\hat{x}[n]$&lt;/span&gt; from a periodic &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; or if those &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples came from an infinitely long and non-repeating stream of samples.  Whatever it is, &lt;span class=&quot;math-container&quot;&gt;$\hat{x}[n]$&lt;/span&gt; is non-repeating, infinite in length (with all those zeros padded), and you can apply the DTFT to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't have to be the rectangular window, it could be any length-&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, finite-valued window for &lt;span class=&quot;math-container&quot;&gt;$w[n]$&lt;/span&gt; and the math that follows is the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now with that definition of &lt;span class=&quot;math-container&quot;&gt;$\hat{x}[n]$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$\hat{X}\left( e^{j \omega} \right)$&lt;/span&gt;, it's not hard to show that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{X}\left( e^{j \omega} \right) \Bigg|_{\omega = 2 \pi \frac{k}{N}} = \hat{X}\left( e^{j 2 \pi k/N} \right) = X[k] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what happens in either domain, is that when you uniformly sample the function (say, in this case, the spectrum &lt;span class=&quot;math-container&quot;&gt;$\hat{X}\left( e^{j \omega} \right)$&lt;/span&gt;)  in one domain, it causes in the other domain, the signal (&lt;span class=&quot;math-container&quot;&gt;$\hat{x}[n]$&lt;/span&gt;) to be repeatedly shifted (by &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples) and overlap-added:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x[n] = \sum\limits_{m=-\infty}^{+\infty} \hat{x}[n+mN] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is here where the discontinuity between &lt;span class=&quot;math-container&quot;&gt;$x[N-1]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x[N]$&lt;/span&gt; (which is the same as &lt;span class=&quot;math-container&quot;&gt;$x[0]$&lt;/span&gt;) becomes a concern, and tapered windowing to reduce or eliminate this discontinuity is perhaps indicated.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2018-11-20T04:51:33.940" LastActivityDate="2018-11-20T04:51:33.940" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="18993" PostTypeId="1" AcceptedAnswerId="43929" CreationDate="2014-11-05T09:07:08.787" Score="7" ViewCount="4967" Body="&lt;p&gt;I have an output signal &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; which is an input signal &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; convolved &lt;span class=&quot;math-container&quot;&gt;$\star$&lt;/span&gt; with an impulse response function &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; with some added noise &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y(t) = h(t) \star x(t) + n(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I know the input signal &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and output signal &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and would like to calculate &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; the impulse response function. I found that deconvolution is not as straightforward as convolution because the input signal contains zeros and then division in the frequency domain would not be defined. Looking around the internet for ways to &amp;quot;deconvolve&amp;quot; if found two methods: Wiener deconvolution and regularized deconvolution. The Wiener deconvolution seemed easier to understand so I wanted to try and implement it in Matlab (the Matlab function &lt;code&gt;deconv&lt;/code&gt; gives me errors about the input signal having a zero at the first entry and if I read the help file it only seems to work correctly for polynomials?).&lt;/p&gt;&#xA;&lt;p&gt;So per the &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Wiener Deconvolution&lt;/a&gt; explanation you want to find &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; so that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{x}(t) = g(t) \star y(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But then in the definition of how to calculate &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; they use all variables in the original equation. Also they only show how to find &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; but probably &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; can be exchanged because convolution is commutative, but I'm unsure about the correct length of both vectors. Currently they are the same length.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$G(f) = \frac{H^*(f) S(f)}{|H(f)|^2 S(f) + N(f)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$H = {\tt fft}(h)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$G = {\tt fft}(g)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S =$&lt;/span&gt; power spectral density of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; ? is this &lt;span class=&quot;math-container&quot;&gt;${\tt fft}(x)$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$N =  $&lt;/span&gt;mean power spectral density of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, don't really understand what this is&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;My question is how do I get the impulse response function &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; without already knowing it (as it is both in the definition of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; and in the original equation)? Since I know both input and output it should not be very different from finding the input with a known impulse response function. I want to do this in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="5273" LastEditorUserId="7092" LastEditDate="2021-10-01T05:04:37.493" LastActivityDate="2022-03-13T11:43:24.467" Title="Estimate the Filter Coefficients of 1D Filtration (Convolution)" Tags="|matlab|filters|impulse-response|frequency-domain|deconvolution|" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="18996" PostTypeId="1" AcceptedAnswerId="19001" CreationDate="2014-11-05T10:50:34.497" Score="1" ViewCount="849" Body="&lt;p&gt;I am going to plot the phase spectrum of a zero-phase ricker wavelet. I calculate the &lt;code&gt;fft&lt;/code&gt; of the wavelet and use the &lt;code&gt;phase&lt;/code&gt; or &lt;code&gt;angle&lt;/code&gt; to calculate the phase spectrum but the result is not zero! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 250;&#xA;t = 0:1/Fs:0.5*(Fs-1)/Fs;&#xA;f1 = 30;&#xA;w = (1-2*pi^2*f1^2.*t.^2) .* exp(-(pi*f1.*t).^2);&#xA;X = fft(w);&#xA;plot(angle(X));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11612" LastActivityDate="2014-11-05T12:34:52.070" Title="the phase spectrum of a zero-phase wavelet is not zero!" Tags="|matlab|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18997" PostTypeId="1" CreationDate="2014-11-05T10:59:46.333" Score="0" ViewCount="137" Body="&lt;p&gt;Consider $N$ discrete signals $x_1(n), x_2(n), \ldots,x_N(n)$ each a bounded support of size $M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To convolve them, we can zero-pad each of them, multiply their FFTs, and take the result's inverse FFT.&lt;br&gt;&#xA;I believe this requires taking $N$ FFTs of length $N(M-1)+1$ each, taking $O(MN\,\log(MN))$ time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what I need isn't the full convolution. I only need the area under the convolution above zero:&#xA;$$\sum_{k=0}^\infty y(n)$$&#xA;assuming $y$ is the convolution of our signals:&#xA;$$y = x_1 * x_2 * \ldots * x_N$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any algorithm that allows me to compute this value with a better time complexity than that required for computing the full convolution, or are the problems equally difficult?&lt;/p&gt;&#xA;" OwnerUserId="310" LastActivityDate="2014-11-05T16:39:12.113" Title="Efficient algorithm for computing area under convolution?" Tags="|fft|convolution|algorithms|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18998" PostTypeId="1" CreationDate="2014-11-05T10:59:56.610" Score="0" ViewCount="49" Body="&lt;p&gt;Theoretically in BPSK signal generation we will multiply the digital signal with the carrier and this output we will call as BPSK signl which is an analog signal. &#xA;    But in OFDM if the data is modulated at the base band by using BPSK we will directly take that BPSK modulated data as 1,-1's which is not an analog signal?&#xA;can any one tell me what is the difference?&lt;/p&gt;&#xA;" OwnerUserId="11587" LastActivityDate="2014-11-05T13:00:42.440" Title="digital modulation" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19000" PostTypeId="2" ParentId="18997" CreationDate="2014-11-05T12:14:41.517" Score="1" Body="&lt;p&gt;Note that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_ny[n]=Y[0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Y[k]$ is the DFT of $y[n]$. Since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y[k]=\prod_iX_i[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $X_i[k]$ the DFT of $x_i[n]$ (appropriately zero-padded), you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_ny[n]=Y[0]=\prod_iX_i[0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_i[0]=\sum_nx_i[n]$$ you get the final result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_ny[n]=\prod_i\sum_nx_i[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the computation of which requires $N-1$ multiplications and $N(M-1)$ additions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This little Matlab script illustrates how it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M=100;          % length of each signal&#xA;N=10;           % number of different signals&#xA;X=randn(M,N);   % each column of X contains a signal&#xA;Xs=sum(X);      % sums over each signal&#xA;Xsp=prod(Xs);   % product of the sums = desired result&#xA;&#xA;% compute convolution of N signals&#xA;y=X(:,1);&#xA;for i=2:N, y=conv(y,X(:,i)); end&#xA;ys=sum(y);      % this should equal Xsp&#xA;&#xA;[Xsp, ys]       % .. and it does&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-05T16:39:12.113" LastActivityDate="2014-11-05T16:39:12.113" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19001" PostTypeId="2" ParentId="18996" CreationDate="2014-11-05T12:26:53.427" Score="3" Body="&lt;p&gt;Your vector &lt;code&gt;w&lt;/code&gt; is not symmetric, so don't expect a zero-phase FFT result. Just do &lt;code&gt;plot(t,w)&lt;/code&gt; to see what the FFT sees as its input. The reason is that you computed &lt;code&gt;w&lt;/code&gt; only for positive &lt;code&gt;t&lt;/code&gt;. What you need to do is the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Choose an odd number of equidistant time domain points $2N+1$&lt;/li&gt;&#xA;&lt;li&gt;Compute N+1 points of the Ricker wavelet for non-negative $t$ starting with $t_0=0$&lt;/li&gt;&#xA;&lt;li&gt;Since the wavelet is symmetric, the $N$ points for $t&amp;lt;0$ are identical to the $N$ points for $t&amp;gt;0$&lt;/li&gt;&#xA;&lt;li&gt;append these values for negative $t$ at the end of the time domain vector to be transformed: &lt;code&gt;w = [r_0,r_1,...,r_N,r_N,r_{N-1},...,r_1]&lt;/code&gt;. The reason for doing this is that the DFT/FFT assumes the first vector entry to be the value for $t=0$. Appending the values for negative $t$ at the end simply reflects the implied periodicity of all signals transformed by the DFT.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The result will be a real-valued FFT up to numerical errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab this would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 250;&#xA;N = 50;&#xA;t = (0:50)/Fs;&#xA;f1 = 30;&#xA;w = (1-2*pi^2*f1^2.*t.^2) .* exp(-(pi*f1.*t).^2);&#xA;w = [w, w(N+1:-1:2)];&#xA;X = fft(w);&#xA;max(abs(imag(X)))     % 2.2682e-16 on my machine&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-05T12:34:52.070" LastActivityDate="2014-11-05T12:34:52.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19002" PostTypeId="1" CreationDate="2014-11-05T12:47:49.063" Score="2" ViewCount="5118" Body="&lt;p&gt;I'm trying to use a Butterworth filter in Python as described in &lt;a href=&quot;https://stackoverflow.com/questions/12093594/how-to-implement-band-pass-butterworth-filter-with-scipy-signal-butter&quot;&gt;this thread&lt;/a&gt; with these functions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def butter_bandpass(lowcut, highcut, fs, order=5):&#xA;    nyq = 0.5 * fs&#xA;    low = lowcut / nyq&#xA;    high = highcut / nyq&#xA;    b, a = butter(order, [low, high], btype='band')&#xA;    return b, a&#xA;&#xA;&#xA;def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):&#xA;    b, a = butter_bandpass(lowcut, highcut, fs, order=order)&#xA;    y = lfilter(b, a, data)&#xA;    return y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output of the FFT of my data &lt;strong&gt;without applying the filter&lt;/strong&gt; gives the following plot: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HMqAJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, after applying the filter above with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lowcut = 1.0&#xA;highcut = 50.0&#xA;x2_Vtcr = butter_bandpass_filter(x_Vtcr, lowcut, highcut, fs, order=4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where fs is the sampling frequency (250 in my case) I get as FFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rqieN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like the filter shifts the frequency to the left and I don't get the peak where it should be.&#xA;Any idea as to why this is happening? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="11302" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2018-10-11T11:11:44.587" Title="Butterworth filter in python" Tags="|filters|signal-analysis|python|filtering|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19003" PostTypeId="2" ParentId="18998" CreationDate="2014-11-05T13:00:42.440" Score="1" Body="&lt;p&gt;BPSK is, at heart, a digital signal.  It is comprised of +1, -1 symbols.  It is only analog in the sense that when things have to exist in the real world (in this case in radio waves) everything is analog.  Then we have to have things like transitions from one symbol to another, but those are necessary evils, not the raison d'etre of BPSK.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-11-05T13:00:42.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19004" PostTypeId="1" CreationDate="2014-11-05T13:22:56.857" Score="15" ViewCount="8926" Body="&lt;p&gt;could anyone explain why there is a need of negative exponent in fourier and laplace transform.I looked through the web but I couldn't get anything.Does anything happen if a positive exponent is placed in these transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While looking through &lt;a href=&quot;http://1drv.ms/1tbV45S&quot; rel=&quot;noreferrer&quot;&gt;http://1drv.ms/1tbV45S&lt;/a&gt; it says that if $s&amp;gt;0$  it becomes a rapidly decreasing function while if $s&amp;lt;0$ it becomes an rapidly increasing functin of t.I couldn't understand that.Can anyone illustrate this.&lt;/p&gt;&#xA;" OwnerUserId="11615" LastEditorUserId="4243" LastEditDate="2015-03-01T17:38:27.490" LastActivityDate="2020-03-17T07:04:21.967" Title="Why is a negative exponent present in Fourier and Laplace transform?" Tags="|fourier-transform|laplace-transform|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19005" PostTypeId="2" ParentId="19004" CreationDate="2014-11-05T14:08:50.313" Score="4" Body="&lt;p&gt;For the Fourier transform the sign of the exponent is pure convention. Note that for the inverse transform you have a positive sign in the exponent. You could also define the Laplace transform with a positive sign in the exponent. In any case, you want exponential damping of the time domain function to be transformed, so the real part of the complex exponent should be negative. If you changed $s$ to $-s$ then the region of convergence of the unilateral Laplace transform would change from $\Re\{s\}&amp;gt;a$ to $\Re\{s\}&amp;lt;a$ for some real-valued constant $a$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-05T14:08:50.313" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="19007" PostTypeId="2" ParentId="19004" CreationDate="2014-11-05T14:40:30.607" Score="8" Body="&lt;p&gt;Matt is correct that the sign is convention.  I think that there is a reason for it beyond that though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at complex frequencies in the complex plane, they look like a constant vectors that rotate in one direction or another.  Positive frequencies rotate counter-clockwise, negative frequencies rotate clockwise, and &quot;0 Hz&quot; frequencies don't rotate at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8RMih.png&quot; alt=&quot;Positive frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform has a negative sign to intentionally rotate in the opposite direction as the frequencies that they are &quot;looking&quot; for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W9k2C.png&quot; alt=&quot;Negative frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for the opposite rotation is that when the two frequency vectors are multiplied, their phases will repeatedly cancel out, so when the results are summed together there will be a massive vector due to all of the individual vectors lining up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X(f) = \sum\limits_{n=0}^{N-1}x(n)e^{-j2\pi kn/N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rtCv3.png&quot; alt=&quot;Fourier frequency vectors&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how the Fourier transform &quot;looks&quot; for frequencies.  If the two frequencies are the same or &quot;close&quot; (how close they need to be depends on the length of the DFT) they will line up well and cause a massive response in the summation.  I have showed how this works for the discrete Fourier transform (DFT), but the exact same reasoning applies to the continuous transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this explains why the Fourier transform would want the vectors rotating in the opposite direction.  To be perfectly honest I don't know the Laplace transform well enough to give solid reasoning for its negative sign.  Since the two transforms are very closely related though (the Laplace transform being a generalization of the Fourier transform), I assume that it is for similar reasons.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2014-11-06T11:18:18.383" LastActivityDate="2014-11-06T11:18:18.383" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="19009" PostTypeId="1" CreationDate="2014-11-05T16:05:15.823" Score="0" ViewCount="305" Body="&lt;p&gt;I have a lot of songs I made over the 20 years and was thinking it would be interesting to see how the overall EQ changed on the various songs I made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tool out there to help me with something like this ? &lt;/p&gt;&#xA;" OwnerUserId="11616" LastActivityDate="2014-11-05T21:06:02.410" Title="Is there any tool to anlyze audio specturm of a song and give the average visually ?" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19010" PostTypeId="2" ParentId="19002" CreationDate="2014-11-05T17:12:08.337" Score="1" Body="&lt;p&gt;(Not an answer, but can't post code in a comment)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works fine for me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; __future__ import division&#xA;from numpy.random import randn&#xA;from numpy.fft import rfft&#xA;from scipy.signal import butter, lfilter&#xA;from matplotlib.pyplot import loglog&#xA;&#xA;def butter_bandpass(lowcut, highcut, fs, order=5):&#xA;    nyq = 0.5 * fs&#xA;    low = lowcut / nyq&#xA;    high = highcut / nyq&#xA;    b, a = butter(order, [low, high], btype='band')&#xA;    return b, a&#xA;&#xA;def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):&#xA;    b, a = butter_bandpass(lowcut, highcut, fs, order=order)&#xA;    y = lfilter(b, a, data)&#xA;    return y&#xA;&#xA;fs = 250&#xA;lowcut = 1.0&#xA;highcut = 50.0&#xA;x_Vtcr = randn(10000)&#xA;x2_Vtcr = butter_bandpass_filter(x_Vtcr, lowcut, highcut, fs, order=4)&#xA;loglog(abs(rfft(x_Vtcr)))&#xA;loglog(abs(rfft(x2_Vtcr)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do you get that's different from this?&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2014-11-05T17:12:08.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19011" PostTypeId="1" CreationDate="2014-11-05T17:39:06.070" Score="1" ViewCount="825" Body="&lt;p&gt;I am working in a fingerprint recognition project using C code running on embedded system. After processing the fingerprint image, I have the minutiae now. I tried to matching two sets of minutiae by calculate the distance between each pair of minutiae and check if it is less than a threshold. But it seems not accurate.&#xA;So, is there another way/algorithm to match fingerprint minutiae? Please give me some document or source code. I dig around Google but there are theories, formulas and private matlab code ... I read them many times but I don't know how to implement them. I need something more clearly and easy to understand. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="10254" LastActivityDate="2018-12-11T11:17:33.200" Title="Fingerprint minutiae matching" Tags="|image-processing|matlab|algorithms|fingerprint-recognition|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19012" PostTypeId="2" ParentId="19009" CreationDate="2014-11-05T20:22:22.357" Score="-1" Body="&lt;p&gt;&lt;a href=&quot;http://audacity.sourceforge.net/?lang=zh-EN&quot; rel=&quot;nofollow&quot;&gt;Audacity&lt;/a&gt; will let you look at a song's spectrum/spectrogram, and it works with most audio formats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also free!&lt;/p&gt;&#xA;" OwnerUserId="11618" LastEditorUserId="7092" LastEditDate="2014-11-05T21:06:02.410" LastActivityDate="2014-11-05T21:06:02.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19015" PostTypeId="1" AcceptedAnswerId="19023" CreationDate="2014-11-05T21:52:26.347" Score="0" ViewCount="449" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4pu4y.jpg&quot; alt=&quot;Figure1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zqCIo.jpg&quot; alt=&quot;Figure2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stuck on a final step in this problem. Essentially, there are the two systems above, which we'll call System 1 (Fig. 4.26, with ideal lowpass $H(jw)$) and System 2 (with $H_1(jw)$). The question proposes that the output y(t) of System 2 is identical to that which would be obtained by retaining $\Re\{f(t)\}$ of System 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a couple questions - &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Why do we need to take the real part of system 1 and not system 2? Aren't they both already bandpass filters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) I solved out answers for $F(jw)$ and $Y(jw)$. $H_1(jw)=H(jw)$ is assumed (they seem to be the same):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(jw)=H(j(w+w_c))X(jw)\\Y(jw)=\frac{1}{2}(H(j(w-w_c))X(jw)+\frac{1}{2}H(j(w+w_c))X(jw)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm relatively confident this answer is correct, but I'm unsure of how to take the real part of $f(t)$. Can I take the real part of $F(jw)$ and get it to look like $Y(jw)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="5504" LastActivityDate="2018-10-27T06:07:18.680" Title="How do I take the real part of this bandpass filter system's output?" Tags="|filters|fourier-transform|filter-design|linear-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19017" PostTypeId="1" CreationDate="2014-11-05T22:22:46.860" Score="2" ViewCount="147" Body="&lt;p&gt;I am planning to use Pyramid Match Kernel method for object recognition from depth images: I am going to extract a set of feature vectors $x \in \mathbb{R}^d$ for each object instance and then I want to use the Pyramid Match Kernel as described in &lt;a href=&quot;http://jmlr.csail.mit.edu/papers/volume8/grauman07a/grauman07a.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://jmlr.csail.mit.edu/papers/volume8/grauman07a/grauman07a.pdf&lt;/a&gt; in Grauman's paper, in order to use the set of feature vectors for each object with a SVM classifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a problem to understand how exactly we are supposed to build bins around the data points to begin with. The paper gives the following definition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sPZ87.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does &quot;inter-vector&quot; distance mean here? I think of the following: We consider all $x_i$ values for each $X$ in $S$. Then we find two vectors with smallest distance $d$ ,(unique ones) and then scale all vectors with $1/d$. Then $D$ is the maximum absolute value of a vector element in $S$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this what the authors meant here? What about if we are going to test a new vector $y$, how should we scale it?&lt;/p&gt;&#xA;" OwnerUserId="11621" LastActivityDate="2014-11-06T13:39:42.880" Title="Pyramid Match Kernel: How to fit grid around data points?" Tags="|computer-vision|object-recognition|classification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19018" PostTypeId="2" ParentId="19004" CreationDate="2014-11-05T23:13:30.713" Score="2" Body="&lt;p&gt;i would just say that the original convention is to represent complex sinusoids with a positive exponent.  so a voltage &quot;phasor&quot; would be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ v(t) = V e^{j \omega t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;($V$ is a complex constant, and $|V|$ represents the magnitude of the phasor and $\arg\{V\}$ represents the phase of the phasor.) i s'pose we could define the convention as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ v(t) = V e^{-j \omega t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but my question would be &quot;why bother?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;why a complex exponential?  because $e^{s t}$ is an eigenfunction (essentially &lt;strong&gt;the&lt;/strong&gt; eigenfunction) of linear time-invariant (LTI) systems, which are what we apply Fourier and Laplace transforms to.  when $e^{s t}$ goes into an LTI system, something times $e^{s t}$ comes out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LTI systems can be completely described by, or have their input/output relationship completely described by their impulse response $h(t)$.  that description is convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = \int\limits_{-\infty}^{\infty} h(\tau) x(t-\tau) \ d \tau $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the input is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) =  e^{s t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the output is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;y(t) &amp;amp; = \int\limits_{-\infty}^{\infty} h(\tau) x(t-\tau) \ d \tau \\&#xA;&amp;amp; = \int\limits_{-\infty}^{\infty} h(\tau) e^{s (t-\tau)} \ d \tau \\&#xA;&amp;amp; = \int\limits_{-\infty}^{\infty} h(\tau) e^{-s \tau} \ d \tau \ \ e^{s t} \\&#xA;&amp;amp; = H(s) \ e^{s t} \\&#xA;&amp;amp; = H(s) \ x(t) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so $x(t)=e^{s t}$ is an eigenfunction and the eigenvalue, the thing that scales the eigenfunction in an LTI system is $H(s)$ and directly related to $h(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the rest is all about Fourier.  so Fourier generalizes a little, first with a periodic $x(t)$ that Fourier posits that can be represented with sinusoids all having the same period as $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t+T) = x(t) \quad \forall t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \sum\limits_{k=-\infty}^{\infty} X[k] \ e^{j \frac{2 \pi k}{T} t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it's still the original convention: define the signal as a phasor $e^{j \omega t}$.  the positive exponent remains.  $X[k]$ are the &lt;em&gt;&quot;Fourier coefficients&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we know that the output is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;y(t) &amp;amp; = \sum\limits_{k=-\infty}^{\infty} H\left(j \frac{2 \pi k}{T}  \right) X[k] \ e^{j \frac{2 \pi k}{T} t} \\&#xA;&amp;amp; = \sum\limits_{k=-\infty}^{\infty} Y[k] \ e^{j \frac{2 \pi k}{T} t} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another periodic function, having the same period, but with different Fourier coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, positive $\omega$ in the exponent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so what &lt;em&gt;are&lt;/em&gt; those Fourier coefficients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;\int\limits_{0}^{T} x(t) e^{-j \frac{2 \pi m}{T} t} \ dt &amp;amp; = \int\limits_{0}^{T} x(t) e^{-j \frac{2 \pi m}{T} t} \ dt \\&#xA;&amp;amp; = \int\limits_{0}^{T} \sum\limits_{k=-\infty}^{\infty} X[k] e^{j \frac{2 \pi k}{T} t} e^{-j \frac{2 \pi m}{T} t} \ dt \\&#xA;&amp;amp; = \int\limits_{0}^{T} \sum\limits_{k=-\infty}^{\infty} X[k] e^{j \frac{2 \pi (k-m)}{T} t} \ dt \\&#xA;&amp;amp; = \sum\limits_{k=-\infty}^{\infty} X[k] \int\limits_{0}^{T} e^{j \frac{2 \pi (k-m)}{T} t} \ dt \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for every $k$ in the sum where $k \ne m$, the integral is zero so the term in the summation is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \int\limits_{0}^{T} e^{j \frac{2 \pi (k-m)}{T} t} \ dt  =&#xA;\begin{cases}&#xA;0, &amp;amp; \text{for } k \ne m \\&#xA;T, &amp;amp; \text{for } k = m&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the single non-zero term, when $k=m$, we have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \int\limits_{0}^{T} x(t) e^{-j \frac{2 \pi m}{T} t} \ dt = X[m] T  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X[m] =  \frac{1}{T} \ \int\limits_{0}^{T} x(t) e^{-j \frac{2 \pi m}{T} t} \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is where the negative exponent comes from.  we need that exponent to be negative so that only the $m^{\text{th}}$ term in the summation survives (when $k=m$ and $e^{j \frac{2 \pi (k-m)}{T} t}=1$), thus isolating a single $X[m]$ so we know what it is.  otherwise it would be the $-m^{\text{th}}$ term surviving and we would have to change the convention in our original definition of $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this remains essentially the case as the Fourier series representation is generalized to non-periodic $x(t)$, where the summation becomes an integral.  because we define our signal as a sort of integral summation of these exponential (with positive exponents) eigenfunctions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \frac{1}{2 \pi} \int\limits_{-\infty}^{\infty} X(j \omega) e^{j \omega t} \ d \omega  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;again, to get those Fourier &quot;coefficients&quot;, we need a negative exponent:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(j \omega) = \int\limits_{-\infty}^{\infty} x(t) e^{-j \omega t} dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Laplace generalizes further by allowing that purely imaginary value $j \omega$ to be a more general complex value, $s = \sigma + j \omega$.  but that does not change the sign convention.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-11-06T13:25:31.110" LastActivityDate="2014-11-06T13:25:31.110" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19019" PostTypeId="1" AcceptedAnswerId="22706" CreationDate="2014-11-05T23:36:24.123" Score="2" ViewCount="1663" Body="&lt;p&gt;I would like to write a 3 Band &quot;EQ&quot; with BiQuad Filters but for some reason, I get some phase distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem already got discussed &lt;a href=&quot;http://www.dsprelated.com/showmessage/112896/1.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found out that I need to work with Allpass filters in order to compensate the phase response of my filters. Btw, the filters are Linkwitz-Riley 2nd order filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I try to copy the idea to my project, I still have some distortion.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// low pass calcuation for linkwitz riley filters&#xA;&#xA;float lowCutoff; // the lower cutoff frequency&#xA;float highCutoff; // the higher cutoff frequency&#xA;&#xA;double omega = M_PI * cutoffFrequency;  &#xA;double theta = omega / sampleRate;&#xA;double kappa = omega / tan(theta);&#xA;double delta = kappa * kappa + omega * omega + 2.0 * kappa * omega;&#xA;&#xA;double a0 = (omega * omega) / delta;&#xA;double a1 = 2.0 * a0;&#xA;double a2 = a0;&#xA;&#xA;double b1 = (-2.0 * kappa * kappa + 2.0 * omega * omega) / delta;&#xA;double b2 = (-2.0 * kappa * omega + kappa * kappa + omega * omega) / delta;&#xA;&#xA;// high pass, only the calculation of a0 to b2 changes&#xA;// the intermediate values stay the same&#xA;&#xA;double a0 = (kappa * kappa) / delta;&#xA;double a1 = -2.0 * a0;&#xA;double a2 = a0;&#xA;&#xA;double b1 = (-2.0 * kappa * kappa + 2.0 * omega * omega) / delta;&#xA;double b2 = (-2.0 * kappa * omega + kappa * kappa + omega * omega) / delta;&#xA;&#xA;// allpass filter to compensate phase response:&#xA;&#xA;double q = 0.5;&#xA;double alpha = (tan(M_PI*q/sampleRate) - 1) / (tan(M_PI*0.5/sampleRate) + 1);&#xA;double beta =   -cos(lowCutoff  * M_PI / sampleRate);&#xA;&#xA;double a0 = -alpha;&#xA;double a1 = beta*(1.0 - alpha);&#xA;double a2 = 1.0;&#xA;double b1 = beta*(1.0 - alpha);;&#xA;double b2 = -alpha;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since I use 2nd order filters, I also have to use a 2nd order all pass filter, right?&#xA;I've read that for those filters and with this calculation, I hav to use &lt;code&gt;q&lt;/code&gt;. So &lt;code&gt;q&lt;/code&gt; should be the same as the &lt;code&gt;q&lt;/code&gt; in the Linkwitz-Riley filter, which should be &lt;code&gt;0.5&lt;/code&gt; right? (I've read this somewhere, not sure about it.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, my actual processing looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// filter names:&#xA;// loAPF, lowHPF, ... low: lower cutoffhigh: higher cutoff&#xA;// APF: allpass, HPF: highpass, LPF: lowpass&#xA;&#xA;highSample =  lowAPF-&amp;gt;tick(highHPF-&amp;gt;tick(sample));&#xA;midSample =   lowHPF-&amp;gt;tick(highLPF-&amp;gt;tick(sample));&#xA;lowSample =   lowLPF-&amp;gt;tick(highLPF-&amp;gt;tick(sample));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does somebody have any idea, why I might have problems with the phase response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="11623" LastEditorUserId="7092" LastEditDate="2014-11-06T03:48:22.493" LastActivityDate="2019-08-16T06:08:07.430" Title="3 Band Crossover with Linkwitz Riley Filter" Tags="|filters|phase|allpass|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19022" PostTypeId="2" ParentId="18873" CreationDate="2014-11-06T07:29:26.433" Score="1" Body="&lt;p&gt;To compare the similarity between multiple pronunciations of a single word, the spectral power that you've computed is too general a feature and doesn't capture details of the shape of the vocal tract, where variations in pronunciation may come from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend you compute Mel Frequency Cepstral Coefficents (MFCCs), which is widely used in speech recognition systems because it captures the envelope of the short time power spectrum of the vocal tract. You can build on your &lt;a href=&quot;https://stackoverflow.com/questions/5835568/how-to-get-mfcc-from-an-fft-on-a-signal&quot;&gt;FFT&lt;/a&gt; code, but there are also many good &lt;a href=&quot;https://github.com/jameslyons/python_speech_features&quot; rel=&quot;nofollow noreferrer&quot;&gt;toolkits&lt;/a&gt; available. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have MFCCs sequences for each pronunciation you can use &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_time_warping&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Time Warping&lt;/a&gt; to compute the corresponding &quot;distance&quot; or &quot;similarity&quot; between them.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-11-06T07:29:26.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19023" PostTypeId="2" ParentId="19015" CreationDate="2014-11-06T07:56:04.890" Score="0" Body="&lt;p&gt;The signal $f(t)$ is a complex bandpass signal. Note that if $H(e^{j\omega})$ is an ideal lowpass filter (and $\omega_c&amp;gt;\omega_0$) then $f(t)$ only has positive frequency components. For a real-valued signal, the spectrum shows conjugate symmetry, so there have to be negative frequency components as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By taking the real part of $f(t)$ you get $y(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Re\{f(t)\}=\frac12\left[f(t)+f^*(t)\right]\Longleftrightarrow&#xA;\frac12\left[F(j\omega)+F^*(-j\omega)\right]=\\=\frac12\left[X(j\omega)H(j(\omega+\omega_c))+X^*(-j\omega)H^*(j(\omega_c-\omega))\right]\tag{1}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(where '$\Longleftrightarrow$' means Fourier transform pair).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $x(t)$ and $h(t)$ (the impulse response of the ideal lowpass filter) are real-valued, their Fourier transforms satisfy $X(j\omega)=X^*(-j\omega)$ and $H(j\omega)=H^*(-j\omega)$. Using this property, Eq. (1) can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Re\{f(t)\}\Longleftrightarrow\frac12 X(j\omega)\left[H(j(\omega+\omega_c))+H(j(\omega-\omega_c))\right]=Y(j\omega)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-06T09:29:46.440" LastActivityDate="2014-11-06T09:29:46.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19024" PostTypeId="1" CreationDate="2014-11-06T12:18:20.713" Score="4" ViewCount="3632" Body="&lt;p&gt;I'm trying to implement a simple Image super resolution algorithm (DWT-Based Resolution Enhancement&#xA;) in the following paper&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ripublication.com/aeee/52_pp%20%20%20405-412.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Discrete Wavelet Transform-Based Satellite Image Resolution Enhancement&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I tried to implement the algorithm in figure 3 of this paper using Matlab.Code is given below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;img1 = imread('lena1.jpg'); %original High resolution image&#xA;[height, width, dim] = size(img1);&#xA;&#xA;%%Downsampling the image by averaging&#xA;avgfilter = fspecial('average', [2 2]);&#xA;avgimg = filter2(avgfilter, img1);&#xA;img = avgimg(1:2:end,1:2:end); %Input low resolution image&#xA;&#xA;[LL,LH,HL,HH] = dwt2(img,'haar'); %Decomposing&#xA;&#xA;%Bicubic interpolation by factor 2 on each subbands&#xA;LL1 = imresize(LL,2,'bicubic');&#xA;LH1 = imresize(LH,2,'bicubic');&#xA;HL1 = imresize(HL,2,'bicubic');&#xA;HH1 = imresize(HH,2,'bicubic');&#xA;&#xA;%% Calculating Difference image&#xA;for i=1:256&#xA;    for j=1:256&#xA;        img3(i,j,:) = img(i,j,:) - LL1(i,j,:);&#xA;    end&#xA;end&#xA;&#xA;&#xA;for i=1:256&#xA;    for j=1:256&#xA;        LH13(i,j,:) = img3(i,j,:) + LH1(i,j,:);&#xA;        HL13(i,j,:) = img3(i,j,:) + HL1(i,j,:);&#xA;        HH13(i,j,:) = img3(i,j,:) + HH1(i,j,:);&#xA;    end&#xA; end&#xA;&#xA;%bicubic interpolation(Here alpha = 2;Hence alpha/2 = 1) &#xA; img31 = imresize(img3,1,'bicubic');&#xA; LH131 = imresize(LH13,1,'bicubic');&#xA; HL131 = imresize(HL13,1,'bicubic');&#xA; HH131 = imresize(HH13,1,'bicubic');&#xA;&#xA;img4 = idwt2(img31,LH131,HL131,HH131,'haar'); %IDWT&#xA;t = uint8(img4)&#xA;imshow(t);&#xA;imsave;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Input image that I used is given below&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ht9VG.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;But I'm getting a completely unexpected output as follows.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EAOn6.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;Why this is happening?&lt;/p&gt;&#xA;" OwnerUserId="10965" LastEditorUserId="128" LastEditDate="2023-07-01T15:20:37.277" LastActivityDate="2024-04-02T09:04:30.507" Title="Image Super Resolution Algorithm with Wavelets in MATLAB" Tags="|image-processing|matlab|discrete-signals|interpolation|superresolution|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="19025" PostTypeId="1" AcceptedAnswerId="19027" CreationDate="2014-11-06T13:14:54.130" Score="1" ViewCount="1508" Body="&lt;p&gt;$H(z) = G\cdot\displaystyle\frac{2b_0\left(1-z^{-2}\right)}{1-2a_1z^{-1}-2a_2z^{-2}} + 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a data sheet with the above transfer function, I need to calculate its frequency response in code. I have the functions to calculate $b_0$, $a_1$, $a_2$ and $G$, but it has been a loooooong time since I have handled $H(z)$ transfer functions and I can't for the life of me remember how to work it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have googled around and it mentions jw this and that and I have tried everything Ive found but I'm not getting a frequency response anything like what is expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a sampling rate of $48000\textrm{ Hz}$ and want to calculate the frequency response from $0-24000\textrm{ Hz}$ in $1\textrm{ Hz}$ steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8618" LastEditorUserId="1629" LastEditDate="2014-11-06T16:36:18.703" LastActivityDate="2014-11-06T16:36:18.703" Title="Biquad Filter Transfer Function Frequency Response" Tags="|audio|infinite-impulse-response|transfer-function|biquad|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19026" PostTypeId="2" ParentId="19017" CreationDate="2014-11-06T13:39:42.880" Score="2" Body="&lt;p&gt;No, that's not it. Look at the last sentence of your quote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... which may be enforced by scaling the data to some precision and&#xA;  truncating to integer values.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So this is exactly what you do. Take all your feature vectors, multiply them by 1000 (or some other factor), and truncate to integer. Then the distance between any two unique feature vectors will have to be &gt;= 1. If you have a new vector y, then you multiply it by the same factor and truncate.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-11-06T13:39:42.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19027" PostTypeId="2" ParentId="19025" CreationDate="2014-11-06T13:52:46.853" Score="2" Body="&lt;p&gt;To get the frequency response, replace $z$ in $H(z)$ by $e^{j2\pi f/f_s}=\cos(2\pi f/f_s)+j\sin(2\pi f/f_s)$ where $f_s$ is the sampling frequency in Hz and $f$ is the desired frequency in Hz. This will give you the value of the frequency response at frequency $f$. Note that the frequency response is a complex function, so you might want to look at its magnitude.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-06T13:52:46.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19028" PostTypeId="1" CreationDate="2014-11-06T14:29:33.047" Score="1" ViewCount="620" Body="&lt;p&gt;I've got two signals which are consecutive received signals by a radar system. The signals' values are complex (in form $x+\textrm iy$).&#xA;I have generated a trasmitted signal using the info available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now,  I have to calculate the range and motion(if any) of the objects using comparision of these signals in MATLAB. Comparing the real part using &lt;code&gt;xcorr&lt;/code&gt; in MATLAB, I got the range of the objects.&#xA;I am strugling with motion of the objects. How can I find if the objects found (4 in my case) were moving or not. I think it has to do something with the phase comparision of the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="11235" LastEditorUserId="1629" LastEditDate="2016-05-30T19:52:06.240" LastActivityDate="2017-02-25T01:36:30.277" Title="Range and motion in received signals by radar" Tags="|matlab|signal-analysis|cross-correlation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19029" PostTypeId="2" ParentId="19028" CreationDate="2014-11-06T15:07:20.593" Score="0" Body="&lt;p&gt;In a radar system, a transmitter sends out a signal, often pulsed in nature. At the same time, a receiver (usually colocated with the transmitter) looks for echoes of that transmitted signal that occur due to reflections off of the radar's targets. These reflections will vary in time delay, amplitude, and frequency from those that were transmitted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's hard to get any information from the received amplitude because so many factors can affect it, but the others are important:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Time delay (the measured time between the transmitted signal and the reception of its echo) corresponds to how far away the target is. If you know the time delay and the signal's speed of propagation, you can calculate the distance to the target that caused the reflection. In radar parlance, this quantity is often called &lt;em&gt;range&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Frequency offset (the difference in apparent carrier frequency between the transmitted signal and its echo) corresponds to the radial velocity between the target and the radar, due to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Doppler_effect&quot; rel=&quot;nofollow&quot;&gt;Doppler effect&lt;/a&gt;. Based on the observed change in frequency, one can calculate how fast the target is moving as a fraction of the signal's speed of propagatation. Note that only the velocity component in the vector direction between the radar and target can be measured in this way. Radar systems usually refer to this quantities as &lt;em&gt;range rate&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-11-06T15:07:20.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19030" PostTypeId="1" CreationDate="2014-11-06T23:01:43.420" Score="0" ViewCount="823" Body="&lt;p&gt;This is the impulse response:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VNQzh.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can anyone give a detailed method to prove that it is stable or not ?&lt;/p&gt;&#xA;" OwnerUserId="11628" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-10-27T12:10:01.043" Title="How to prove that this impulse response is stable?" Tags="|homework|impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19034" PostTypeId="1" CreationDate="2014-11-07T05:33:49.020" Score="0" ViewCount="1173" Body="&lt;p&gt;While we look at Fourier Series there are both $\sin$ and $\cos$ components.But I think $\sin$ component is ony needed to describe wave.why there is also an $\cos$ component in Fourier Series?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S_n(x)$=$A_0 + \sum_{n = 1}^{\infty} (A_n\cos(nx) + B_n\sin(nx))$&lt;/p&gt;&#xA;" OwnerUserId="11615" LastActivityDate="2014-11-07T11:17:01.457" Title="Why does Fourier Series have $\sin$ and $\cos$ Components" Tags="|fourier-series|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19036" PostTypeId="1" CreationDate="2014-11-07T07:20:06.387" Score="0" ViewCount="244" Body="&lt;p&gt;I have to find the gradient of the following term with respect to $X_{1}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\|\Phi\circ(X_{1}-X_{2})-u\|_F^2$ ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u\in\mathbb{R}^{n}$; $X_{1}, X_{2}\in\mathbb{R}^{N\times J}$ and $\Phi\in\mathbb{R}^{n\times NJ}$. The $\circ$ operation is defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Phi\circ X=\Sigma_{i=1}^{J}\Phi_{i} x_{i}$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_i$ are the columns of $X$ and $\Phi_{i}$ are $n\times N$ submatrices of $\Phi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that $\frac{\partial}{\partial X}\|X\|_{F}^{2}=2X$, but the $\circ$ operation is making it rather complicated. Can somebody help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Also, would changing the Frobenius norm to l2 norm make any difference here (since $(\Phi\circ(X_{1}-X_{2})-u)$ is a column vector)?&lt;/p&gt;&#xA;" OwnerUserId="11630" LastActivityDate="2015-07-06T20:39:25.603" Title="Finding the gradient of a norm in a minimization problem" Tags="|optimization|gradient|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19037" PostTypeId="2" ParentId="19034" CreationDate="2014-11-07T09:11:39.613" Score="5" Body="&lt;p&gt;Note that the value of the series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=1}^{\infty}B_n\sin(nx)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $x=0$ is always zero, regardless of the coefficients $B_n$ (assuming convergence). Furthermore, since the functions $\sin(nx)$ are odd, (1) can only represent odd functions. So you cannot represent general functions with the series (1). This is why you also need the cosine terms. As an alternative, you could as well use a representation with phases in the argument of the sine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x)=A_0+\sum_{n=1}^{\infty}C_n\sin(nx+\phi_n)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case you don't need any cosine terms because of the phases $\phi_n$. The representation in (2) is equivalent to the series in your question using sine and cosine terms. You can see this by using the identity $\sin(\alpha+\beta)=\cos\alpha\sin\beta+\sin\alpha\cos\beta$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=1}^{\infty}C_n\sin(nx+\phi_n)=\sum_{n=1}^{\infty}\left[C_n\sin\phi_n\cos(nx)+C_n\cos\phi_n\sin(nx)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the coefficients $A_n$ and $B_n$ in your question are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A_n=C_n\sin\phi_n\\&#xA;B_n=C_n\cos\phi_n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the other way around you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C_n=\sqrt{A_n^2+B_n^2}\\&#xA;\phi_n=\arctan\left(\frac{A_n}{B_n}\right)\quad(\pm\pi)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-07T11:17:01.457" LastActivityDate="2014-11-07T11:17:01.457" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="19038" PostTypeId="2" ParentId="18423" CreationDate="2014-11-07T13:10:29.820" Score="3" Body="&lt;p&gt;An FFT of twice the filter order is kind of short.  Take a look at the &amp;quot;Choice of FFT size&amp;quot; section from &lt;a href=&quot;https://ieeexplore.ieee.org/document/1598092&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; I wrote a while back.&lt;/p&gt;&#xA;&lt;p&gt;Also your whole signal will fit into a reasonable size FFT, so I think the single FFT approach is fine in this case.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="25" LastEditDate="2022-08-31T19:50:58.910" LastActivityDate="2022-08-31T19:50:58.910" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="19040" PostTypeId="1" AcceptedAnswerId="19041" CreationDate="2014-11-07T15:20:30.090" Score="0" ViewCount="212" Body="&lt;p&gt;I tried to understand the following source code of a Phaser:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define SR (44100.f)  //sample rate&#xA;#define F_PI (3.14159f)&#xA;&#xA; class Phaser{&#xA; public:&#xA;     Phaser()  //initialise to some usefull defaults...&#xA;      : _fb( .7f )&#xA;      , _lfoPhase( 0.f )&#xA;      , _depth( 1.f )&#xA;      , _zm1( 0.f )&#xA;  {&#xA;    Range( 440.f, 1600.f );&#xA;    Rate( .5f );&#xA;  }&#xA;&#xA;  void Range( float fMin, float fMax ){ // Hz&#xA;      _dmin = fMin / (SR/2.f);&#xA;      _dmax = fMax / (SR/2.f);&#xA;  }&#xA;&#xA;  void Rate( float rate ){ // cps&#xA;      _lfoInc = 2.f * F_PI * (rate / SR);&#xA;  }&#xA;&#xA;  void Feedback( float fb ){ // 0 -&amp;gt; &amp;lt;1.&#xA;      _fb = fb;&#xA;  }&#xA;&#xA;  void Depth( float depth ){  // 0 -&amp;gt; 1.&#xA;      _depth = depth;&#xA;  }&#xA;&#xA;  float Update( float inSamp ){&#xA;      //calculate and update phaser sweep lfo...&#xA;      float d  = _dmin + (_dmax-_dmin) * ((sin( _lfoPhase ) +  1.f)/2.f);&#xA;      _lfoPhase += _lfoInc;&#xA;      if( _lfoPhase &amp;gt;= F_PI * 2.f )&#xA;          _lfoPhase -= F_PI * 2.f;&#xA;&#xA;      //update filter coeffs&#xA;      for( int i=0; i&amp;lt;6; i++ )&#xA;          _alps[i].Delay( d );&#xA;&#xA;      //calculate output&#xA;      float y =     _alps[0].Update(&#xA;                   _alps[1].Update(&#xA;                    _alps[2].Update(&#xA;                     _alps[3].Update(&#xA;                      _alps[4].Update(&#xA;                       _alps[5].Update( inSamp + _zm1 * _fb ))))));&#xA;      _zm1 = y;&#xA;&#xA;      return inSamp + y * _depth;&#xA;  }&#xA; private:&#xA;     class AllpassDelay{&#xA;     public:&#xA;      AllpassDelay()&#xA;          : _a1( 0.f )&#xA;          , _zm1( 0.f )&#xA;          {}&#xA;&#xA;      void Delay( float delay ){ //sample delay time&#xA;          _a1 = (1.f - delay) / (1.f + delay);&#xA;      }&#xA;&#xA;      float Update( float inSamp ){&#xA;          float y = inSamp * -_a1 + _zm1;&#xA;          _zm1 = y * _a1 + inSamp;&#xA;&#xA;          return y;&#xA;      }&#xA;  private:&#xA;      float _a1, _zm1;&#xA;  };&#xA;&#xA;  AllpassDelay _alps[6];&#xA;&#xA;  float _dmin, _dmax; //range&#xA;  float _fb; //feedback&#xA;  float _lfoPhase;&#xA;  float _lfoInc;&#xA;  float _depth;&#xA;&#xA;  float _zm1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;};&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understood most of it but i can´t find out what the purpose of the &lt;code&gt;_zm1&lt;/code&gt; variables is. There are two of them one in the &lt;code&gt;AllpassDelay&lt;/code&gt; class, which are never used and one in the &lt;code&gt;Phaser&lt;/code&gt; class which modifies the feedback.&#xA;Can someone explain me what this does?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11633" LastEditorUserId="7092" LastEditDate="2014-11-07T17:05:21.053" LastActivityDate="2014-11-07T17:05:21.053" Title="Help me understanding this source code of a Phaser" Tags="|audio|algorithms|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19041" PostTypeId="2" ParentId="19040" CreationDate="2014-11-07T15:34:42.187" Score="0" Body="&lt;p&gt;_zm1 is the internal state variable of the allpass. The allpass is an IIR filter and hence it's current output is dependent on past inputs and outputs. This is the way to keep track of this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this particular case it's implemented using a set of coupled difference equation in so-called &quot;Transposed Form II&quot; filter topology. So $zm_1[n] = y[n]*a_1+x[n]*b_1 $ . For a first order allpass we have $b_1 = 1$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-11-07T15:34:42.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19044" PostTypeId="1" AcceptedAnswerId="19046" CreationDate="2014-11-07T19:12:23.343" Score="-1" ViewCount="1679" Body="&lt;p&gt;Given the following signal I would like to calculate the rate of damping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1MOfV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presume that I need to find out where the peaks are using some kind of smoothing on the sample data. After performing an FFT I get the following…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qAMa2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I could perform some kind of clipping (high/low pass) and then do an inverse FFT to get the smoothed result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I on the right track here? Are there some standard methods for achieving my goal?&lt;/p&gt;&#xA;" OwnerUserId="11636" LastEditorUserId="11636" LastEditDate="2014-11-08T00:01:32.363" LastActivityDate="2014-11-08T00:01:32.363" Title="Calculate Damping using FFT" Tags="|fft|smoothing|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19046" PostTypeId="2" ParentId="19044" CreationDate="2014-11-07T20:11:08.897" Score="1" Body="&lt;p&gt;The simplest method would be to detect the local maxima and then fit an exponential on these points only. It would be a bit approximate because it looks like your data contains more than one exponentially damped sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more proper solution is to use Prony's method (or ESPRIT, MUSIC) - any parametric method fitting a &quot;sum of exponentially damped sinusoids&quot; model to your data.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-11-07T20:11:08.897" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19047" PostTypeId="1" CreationDate="2014-11-07T21:21:19.717" Score="3" ViewCount="223" Body="&lt;p&gt;I am sending a chirp that sweeps form 20Hz to 500Hz to an audio codec, CS42L52, connected to an MCU, STM32F405, and I am receiving a &quot;wavy&quot; amplitude output.  There is no processing on the MCU, I pass the signal straight from the DMA in to the DMA out.  The DMA services the I2S lines.  If I change the time that the chirp takes to get from 20 to 500 Hz, the amplitude wave changes its frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This picture shows the chirp with a 10 second duration on top and 5 second duration on bottom, and shows that the amplitude frequency is twice as fast in the 5 second chirp vs the 10 second chirp. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(!&lt;img src=&quot;https://i.stack.imgur.com/yk7SH.png&quot; alt=&quot;chrip20to500&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the codec block diagram, it shows that I can bypass the MCU in two different spots. The first being right after the PGA inputs and the next after gain adjust and ALC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZF1EF.png&quot; alt=&quot;cs42l52AnalogInputs&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these pass to the codec's DSP and then out to the codec's DAC according to this block diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QoBtR.png&quot; alt=&quot;cs42l52AnalogOutputs&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I pass the signal through either of these lines, skipping the MCU, the output has a constant amplitude as it should.  The input signal is clean, no &quot;wavy&quot; amplitude. If I put one frequency through the device, no chirp, the amplitude stays constant.  I have played with a lot of the settings on the codec and can't seem to find any that affect the amplitude wave.  Maybe I am overlooking a setting?  This almost makes me think it is an MCU problem, but I am not manipulating the signal at all on the MCU.  Is it a problem that the DMA stores it as an unsigned integer?  What could be the problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My sampling frequency is set at 48 kHz, but I measure it at 48.5 kHz, could this affect it?&lt;/p&gt;&#xA;" OwnerUserId="11127" LastActivityDate="2015-03-08T01:17:51.477" Title="Codec Output has &quot;Wavy&quot; Amplitude on Chirp Input" Tags="|audio|frequency|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19048" PostTypeId="2" ParentId="16540" CreationDate="2014-11-07T21:45:27.800" Score="0" Body="&lt;p&gt;Try &lt;a href=&quot;http://en.wikipedia.org/wiki/Boxcar_function&quot; rel=&quot;nofollow&quot;&gt;boxcar&lt;/a&gt; line fitting with different length of times. This method filters and smooths the derivative&lt;/p&gt;&#xA;" OwnerUserId="11637" LastEditorUserId="7092" LastEditDate="2014-11-08T16:59:48.573" LastActivityDate="2014-11-08T16:59:48.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19051" PostTypeId="2" ParentId="19047" CreationDate="2014-11-07T23:17:19.523" Score="2" Body="&lt;p&gt;These could be ripples in the frequency response of an (ill-configured) anti-aliasing filter involved in the acquisition or restitution of the signal. It could be that the code running on your MCU and initializing the codec sends invalid configuration information to the codec; causing the codec to work with filters coefficients defined for a wrong sample rate. One thing worth noting is that the STM32F4 I2S master can only output an MCK at 256x FS. Check that your codec can work at 48kHz with such an MCK frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing I can think of is your software &quot;pass-through&quot; routine on the MCU dropping samples. Depending on the ratio between the block size and the period of the waveform, an amplitude modulation effect could appear.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-11-07T23:30:32.693" LastActivityDate="2014-11-07T23:30:32.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19053" PostTypeId="1" CreationDate="2014-11-08T06:42:44.287" Score="0" ViewCount="221" Body="&lt;p&gt;I stumbled upon an equation system as shown in the image below while designing an orthonormal wavelet filter. I tried solving the equation (5.63,5.64,5.65 =&gt; 5.66) but no avail. I'm not sure if there's any property or parameterization method to solve this equation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation below is taken from &quot;Introduction to wavelets and wavelets transform A Primer&quot; page 66&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0zKpe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4430" LastEditorUserId="4430" LastEditDate="2014-11-08T08:02:02.927" LastActivityDate="2014-11-13T13:40:19.470" Title="Orthornormal Wavelet scaling function coefficient calculation (filter design)" Tags="|filters|wavelet|orthornormal|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19054" PostTypeId="2" ParentId="16765" CreationDate="2014-11-08T06:45:09.523" Score="0" Body="&lt;p&gt;Correlation across two signals is typically used to figure out the time shift between the signals. The correlation operation simply time-shifts the signal and calculates a value each time for each sample. When you see a peak this means the signal and the shift signal both align maximally. This is without mathematics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlation mathematics multiplies a signal and the complex conjugate of another signal and this happens for each of the signal. Because of complex conjugation of the 2nd signal the final correlation value will produce a peak (-ve or +ve) when the product reach a maximum or minimum value.&lt;/p&gt;&#xA;" OwnerUserId="11640" LastActivityDate="2014-11-08T06:45:09.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19055" PostTypeId="2" ParentId="19036" CreationDate="2014-11-08T15:49:22.083" Score="1" Body="&lt;p&gt;This is the result of taking the derivative of $\|\Phi\circ(X_{1}-X_{2})-u\|_F^2$ w.r.t. $X_{1}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[\Phi^{1'}(\Phi\circ(X_{1}-X_{2})-u), ...,\Phi^{J'}(\Phi\circ(X_{1}-X_{2})-u)]$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be got by first finding the expression for the norm, and then taking the matrix derivative (w.r.t. $X_{1}$) to get an $N \times J$ matrix. This matrix is then represented in terms of the sub matrices $\Phi^{i}$.&lt;/p&gt;&#xA;" OwnerUserId="11630" LastActivityDate="2014-11-08T15:49:22.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19057" PostTypeId="1" AcceptedAnswerId="19063" CreationDate="2014-11-08T18:17:50.037" Score="6" ViewCount="16786" Body="&lt;p&gt;I need an algorithm to detect frequency and phase of a pure sine signal. The frequency of the input signal changes between 0 and 100 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of the signal gets captured with a frequency of 20 kHz (so I get 20000 values per second) - this is given and cannot be changed. I need to detect frequency and phase of this input signal and using PWM generate MCU interrupts with the same frequency as the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest what algorithm to use to do this simple and efficient? Maybe Goertzel algorithm?&lt;/p&gt;&#xA;" OwnerUserId="11644" LastEditorUserId="7092" LastEditDate="2014-11-09T02:48:11.373" LastActivityDate="2020-07-12T08:34:31.133" Title="Simple and efficient algorithm to detect frequency and phase of a sine signal" Tags="|signal-analysis|frequency|algorithms|signal-detection|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19059" PostTypeId="1" CreationDate="2014-11-08T18:57:55.993" Score="3" ViewCount="1202" Body="&lt;p&gt;When using the &lt;code&gt;fft&lt;/code&gt; function in Matlab to take the Fourier transform, one can specify the number of FFT points, &lt;code&gt;nfft&lt;/code&gt;, and the command is written &lt;code&gt;fft(x,nfft)&lt;/code&gt;. In this case, what is the frequency vector? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can the Fourier transform be calculated with the same &lt;code&gt;nfft&lt;/code&gt;, but over a narrower range of frequencies? How would the frequency vector be calculated?&lt;/p&gt;&#xA;" OwnerUserId="11612" LastEditorUserId="11256" LastEditDate="2014-11-08T20:53:23.193" LastActivityDate="2014-11-08T20:53:23.193" Title="How to take the FFT in a limited range of frequencies?" Tags="|matlab|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19060" PostTypeId="2" ParentId="19057" CreationDate="2014-11-08T19:15:41.427" Score="3" Body="&lt;p&gt;If the signal is pure sinusoidal and noise-free, you can simply count the number of samples between positive zero crossings - and use this as an estimate of the period of your signal, from which you deduce the frequency. If necessary, wait and average over several periods to get a more robust estimate. There's a good chance this can be achieved without having to sample your signal - directly through an input pin of your microcontroller and through one of its timers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the phase, well, phase relative to what?&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2014-11-08T19:15:41.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19061" PostTypeId="2" ParentId="19059" CreationDate="2014-11-08T19:22:33.153" Score="1" Body="&lt;p&gt;If your sampling frequency is $f_s$, and you calculate the FFT with $N$ samples, then the FFT calculates the signal's spectrum at $N$ frequencies from $-f_s/2$ to $f_s/2-f_s/N$, inclusive. In Matlab notation, this would be written as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freq_vector = (-N/2:N/2-1)./(f_s/N);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note that you have to shift the spectrum returned by the FFT operation to correspond to this vector; in Matlab, you would use &lt;code&gt;fftshift&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know of any FFT algorithm that lets you restrict the frequency range. I would suggest using &lt;a href=&quot;https://en.wikipedia.org/wiki/Goertzel_algorithm&quot; rel=&quot;nofollow&quot;&gt;Goertzel's Algorithm&lt;/a&gt; to find the spectrum at the particular frequencies you're interested in. You may also use a bandpass filter to eliminate the unwanted frequencies before performing the FFT.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-11-08T19:22:33.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19062" PostTypeId="1" AcceptedAnswerId="19066" CreationDate="2014-11-08T19:51:54.910" Score="1" ViewCount="2345" Body="&lt;p&gt;I'm attempting to design a FIR high pass filter than keeps signals above 200Hz and rejects signals below 60Hz with a sampling frequency of 500 samples/sec. This is my first time attempting this and I'm a little confused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started with looking at pole/zero placement. I'm not exactly sure how to go about this but this is what I did. I want a zero on the unit circle at the 60Hz point to minimize that frequency. To find this spot on the axis I did the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{60}{\frac{500}{2}}\pi=0.24\pi$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I believe I need a zero at 0.24pi on the unit circle on the z-plane. Does this sound right? How would I then transform it in a difference equation in the sequence domain?&lt;/p&gt;&#xA;" OwnerUserId="11191" LastActivityDate="2014-11-09T16:17:35.270" Title="Pole/Zero Placement for Filter" Tags="|filter-design|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19063" PostTypeId="2" ParentId="19057" CreationDate="2014-11-08T20:15:37.060" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Note: I originally posted this answer for the &lt;a href=&quot;https://stackoverflow.com/questions/26820342/simple-and-efficient-algorithm-to-detect-frequency-and-phase-of-a-sine-signal&quot;&gt;Stack Overflow copy&lt;/a&gt; of this question, before realizing that it had also been asked here.  It somewhat duplicates &lt;a href=&quot;https://dsp.stackexchange.com/a/19060&quot;&gt;pichenettes' answer&lt;/a&gt;, but I felt it still worth (re)posting here, since it includes some extra details.  (Whether those details are useful or not, I'll leave for you and the OP to judge.)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you know your signal is a pure sine wave, you can just use &lt;a href=&quot;//en.wikipedia.org/wiki/Zero_crossing&quot; rel=&quot;nofollow noreferrer&quot;&gt;zero crossing&lt;/a&gt; detection.  Each cycle of the sine wave will have two zero crossings: one from negative to positive, and one from positive to negative.  This will be a lot simpler and more efficient than trying to do something fancy like Fourier transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few details to keep in mind, though:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It's OK for the signal to be slightly &lt;a href=&quot;//en.wikipedia.org/wiki/DC_bias&quot; rel=&quot;nofollow noreferrer&quot;&gt;biased&lt;/a&gt;, but if the bias might exceed the amplitude of the signal, you'll need to correct it somehow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either do this before sampling with an analog high-pass filter, or you can track a &lt;a href=&quot;//en.wikipedia.org/wiki/Moving_average&quot; rel=&quot;nofollow noreferrer&quot;&gt;moving average&lt;/a&gt; of your sampled signal and use it as the &quot;zero level&quot; to compare to.  Or you can, instead, look at zero crossings of the difference between successive samples (which correspond to the maximum and minimum of each cycle in the signal) to avoid any bias issues.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If your input (or ADC) is noisy, your samples might randomly fluctuate around the zero level when the signal is close to it.  In such cases, naïvely comparing successive samples might detect multiple zero crossings where there's really just one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to fix this issue is to smooth your signal before processing it, but it may be easier and more efficient to implement &lt;a href=&quot;//en.wikipedia.org/wiki/Hysteresis#Electronic_circuits&quot; rel=&quot;nofollow noreferrer&quot;&gt;hysteresis&lt;/a&gt; in your zero-crossing detector.  That is, you'd only detect a positive-to-negative crossing when the signal dips below some pre-set threshold level &amp;minus;&amp;epsilon;, and a negative-to-positive crossing only when it rises above +&amp;epsilon;, like this pseudo-C code:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;boolean isPositive = (firstSample &amp;gt; 0);&#xA;while (running) {&#xA;    int signalLevel = getNextSample();&#xA;    if (isPositive &amp;amp;&amp;amp; signalLevel &amp;lt; -threshold) {&#xA;        isPositive = false;&#xA;        handleZeroCrossing();&#xA;    }&#xA;    else if (!isPositive &amp;amp;&amp;amp; signalLevel &amp;gt; +threshold) {&#xA;        isPositive = true;&#xA;        handleZeroCrossing();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In fact, you may not even need an algorithm for this at all, since, as noted in the comments below, you can implement zero-crossing detection with hysteresis in hardware with a simple &lt;a href=&quot;//en.wikipedia.org/wiki/Schmitt_trigger&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schmitt trigger&lt;/a&gt;, which basically converts the sine wave input into a square wave signal with the same frequency and (almost) the same phase, which you can then read as a simple digital input.  You might even be able to use the output of the Schmitt trigger to drive the MCU interrupt pin directly.&lt;/p&gt;&#xA;" OwnerUserId="724" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-11-09T01:18:08.357" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19064" PostTypeId="1" AcceptedAnswerId="19065" CreationDate="2014-11-09T01:47:39.197" Score="2" ViewCount="8473" Body="&lt;p&gt;So I am trying to determine whether the process of up sampling (zero padding) and downsampling are linear, causal and/or time-invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on some resources I found online, I am under the impression that it is linear, but not time-invariant. However I am unsure about causality (since it depends neither on future nor past values?).&lt;/p&gt;&#xA;" OwnerUserId="11356" LastActivityDate="2014-11-09T03:28:51.770" Title="Is digital up and down sampling linear/causal/time-invariant?" Tags="|sampling|linear-systems|downsampling|zero-padding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19065" PostTypeId="2" ParentId="19064" CreationDate="2014-11-09T03:28:51.770" Score="1" Body="&lt;p&gt;Upsampling and downsampling are both causal, since the output at time $m$ depends only on samples you've seen up time $m$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also linear (apply upsampling/downsampling to a x[n]+y[n] and see that you get a upsample/downsample x[n] + upsample/downsample y[n]). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Downsampling not time invariant though - what happens if you downsample by 2 and consider inputting x[n] and x[n] delayed by 1 time unit? Now, what about upsampling?&lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-11-09T03:28:51.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19066" PostTypeId="2" ParentId="19062" CreationDate="2014-11-09T11:32:08.417" Score="3" Body="&lt;p&gt;This is how you can try to design a short and simple FIR filter by hand. Note that this method is just supposed to be enlightening, a really useful filter can be designed using some software. If you want a zero at 60 Hz you indeed need to place it at an angle of $0.24\pi$ on the unit circle of the $z$-plane. The general relation between angle and frequency is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi=2\pi\frac{f}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f$ is the desired frequency, and $f_s$ is the sampling frequency. Note that if the filter coefficients are real-valued, zeros (and poles) always occur in complex conjugate pairs. So if you have a zero at $z=z_0$ you must also have a zero at $z=z_0^*$. This just reflects the fact that the spectrum of a real-valued filter is symmetric: $H(\omega)=H^*(-\omega)$. Since you want to design a causal FIR filter, all poles are at the origin of the $z$-plane, and you only have control over the zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's design an FIR filter of order $3$ (i.e. length $4$) with a zero at $z_0=e^{j0.24\pi}$, and - because it's a high pass filter - a zero at $z=0$. The zero at $z=0$ contributes a factor&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_1(z)=1-z^{-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to the total transfer function, and the zero at $z_0=e^{j0.24\pi}$ (and its complex conjugate counterpart at $z_0^*=e^{-j0.24\pi}$) contributes a factor&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_2(z)=(1-z_0z^{-1})(1-z_0^*z^{-1})=1-(z_0+z_0^*)z^{-1}+|z_0|^2z^{-2}=\\&#xA;=1-2\Re\{z_0\}z^{-1}+z^{-2}=1-2\cos(0.24\pi)z^{-1}+z^{-2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $z_0+z_0^*=2\Re\{z_0\}=2\cos(0.24\pi)$, and $|z_0|=1$ (the zero is on the unit circle). The total transfer function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=H_1(z)H_2(z)=(1-z^{-1})(1-2\cos(0.24\pi)z^{-1}+z^{-2})=\\&#xA;=1-[1+\cos(0.24\pi)]z^{-1}+[1+\cos(0.24\pi)]z^{-2}-z^{-3}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) you can read the filter coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_0=1,\quad h_1=-[1+\cos(0.24\pi)]=-2.4579,\quad h_2=-h_1,\quad h_3=-h_0\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that we just imposed the locations of the zeros but we didn't apply any normalization. A useful normalization for a highpass filter is to require $H(-1)=1$, i.e. the response at the Nyquist frequency (half the sampling frequency) is $1$. Since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(-1)=\sum_n(-1)^nh[n]=h[0]-h[1]+h[2]-h[3]=2h[0]-2h[1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can define new normalized filter coefficients by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{h}[n]=\frac{h[n]}{2(h[0]-h[1])},\quad n=0,1,2,3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitude of the resulting frequency response of this filter looks like this (the phase is linear due to the symmetry of the coefficients):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2rNXp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see that the three constraints (zeros at DC and at 60 Hz, and unity response at Nyquist) are satisfied. The transition from stopband to passband is of course not very steep but that's as good as it gets with an FIR filter of order 3.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-09T16:17:35.270" LastActivityDate="2014-11-09T16:17:35.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19067" PostTypeId="1" CreationDate="2014-11-09T13:28:22.627" Score="1" ViewCount="50" Body="&lt;p&gt;I'm trying to understand how a particular equation works.  The scenario is: there is a load of some resistance connected onto an amplifier with some noise figure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thermal noise of the load alone is:&#xA;$$&#xA;\langle i_{th}^2 \rangle = 4kTB/R&#xA;$$&#xA;but since there is an amplifier before it, the noise at the input of the amplifier is&#xA;$$&#xA;\langle i_{th}^2 \rangle = 4kTBF/R.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that&#xA;$$&#xA;F = \frac{SNR_{in}}{SNR_{out}} = \frac{S_i}{S_o} \frac{N_o}{N_i} = \frac{1}{G} \frac{N_o}{N_i}&#xA;$$&#xA;and I'm not seeing why multiplying $4kTB/R$ by $F$ is going to find the noise at the input of the amplifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Advice much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="1146" LastActivityDate="2014-11-09T13:28:22.627" Title="Noise Figure And Amplifier Equation" Tags="|noise|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19068" PostTypeId="1" AcceptedAnswerId="19069" CreationDate="2014-11-09T13:46:05.253" Score="1" ViewCount="101" Body="&lt;ul&gt;&#xA;&lt;li&gt;How to get the value of $y_p(n)$ using substitution method?&lt;/li&gt;&#xA;&lt;li&gt;What exactly do we need to substitute to get the value?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/brWBv.png&quot; alt=&quot;Sample Problem for Difference Equation&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11653" LastEditorUserId="7092" LastEditDate="2014-11-09T15:33:04.513" LastActivityDate="2014-11-09T15:33:04.513" Title="How to apply &quot;Substitution Method&quot; in Difference Equations?" Tags="|discrete-signals|signal-analysis|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19069" PostTypeId="2" ParentId="19068" CreationDate="2014-11-09T14:15:07.467" Score="1" Body="&lt;p&gt;Substitution is not a method to obtain the particular solution $y_p(n)$, but the author simply claims that $y_p(n)=e^{-\beta n}u(n)$ &lt;em&gt;is&lt;/em&gt; a particular solution of the recursion (1.70), and encourages you to &lt;em&gt;check&lt;/em&gt; his claim by substituting $y_p(n)$ for $y(n)$ in Eq. (1.70) and see if it's correct or not:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{-\beta n}u(n)=e^{-\beta}e^{-\beta (n-1)}u(n-1)+\delta(n)=e^{-\beta n}u(n-1)+\delta(n)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now check if (1) is satisfied. Distinguish 3 cases: $n&amp;lt;0$, $n=0$, and $n&amp;gt;0$. As a result you should be able to see that (1) (and, therefore, Eq. (1.70)) is satisfied for $y(n)=y_p(n)$, showing that the suggested sequence $y_p(n)$ indeed is a particular solution of (1.70).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-09T14:15:07.467" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19072" PostTypeId="2" ParentId="14862" CreationDate="2014-11-09T23:43:19.053" Score="1" Body="&lt;p&gt;If you know the SNR per sample in the time domain (SNRt) the SNR in the frequency domain (SNRf) will be &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$ SNR_f = SNR_t  \sqrt{N} $$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Standard_error#Standard_error_of_the_mean&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Standard_error#Standard_error_of_the_mean&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where N is the number of non zero elements in the basis vector in the Fourier transform. The fastest Fourier transforms (FFT with $n=2^{integer}$) has most zeros and thus lowest SNRf. The highest SNRf comes with $N$ as a prime number with no zeros in the basis vectors, which is also thus the most arithmetically intense choice of sample size. Quality costs. Also pay attention to the fact that the number of zeros in the basis vectors in the FFT depends on the frequency leading to SNRf being frequency dependent. Lowest SNRf is at the middle frequency where every second element of the cosine part is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now tell me why people still use sample sets of 2^integer when it is the choice of lowest quality? Today we have the means to do the extra computations of a zero free Fourier transform. It would led to better image quality, better sound and higher data rates.&lt;/p&gt;&#xA;" OwnerUserId="11657" LastEditorUserId="7092" LastEditDate="2014-11-10T01:50:59.490" LastActivityDate="2014-11-10T01:50:59.490" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19073" PostTypeId="1" CreationDate="2014-11-10T04:02:41.680" Score="0" ViewCount="123" Body="&lt;p&gt;I am working on training the output of the wavelet transform of a signal using a neural network in MATLAB. So I decided to use &lt;code&gt;3&lt;/code&gt; layer &lt;code&gt;db4&lt;/code&gt; wave filter for its wavelet transform. I have used an array of &lt;code&gt;240&lt;/code&gt; elements and after wavelet transform, I get an array &lt;code&gt;l&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;l = [36;36;65;123;240]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, since I have to train my neural network, I have to resample the wavelet transforms of length &lt;code&gt;36, 36, 65, 123&lt;/code&gt; to an array of 240 elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I did was, I did wavelet transform of the signal. I resampled each wavelet transform to &lt;code&gt;240&lt;/code&gt; points, and then resampled the wavelet to &lt;code&gt;36, 36, 65, 123&lt;/code&gt; points respectively. I got an error of &lt;code&gt;20.2668&lt;/code&gt;. What can be done to reduce error? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the following command to resample using MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[c1, l] = wavedec(signal, 3, 'db4');&#xA;&#xA;c1a = c1(1:l(1));&#xA;c1a = resample(c1a, length(signal), length(c1a));&#xA;&#xA;c1b = c1(1+l(1):l(1)+l(2));&#xA;c1b = resample(c1b, length(signal), length(c1b));&#xA;&#xA;c1c = c1(1+l(1)+l(2):l(1)+l(2)+l(3));&#xA;c1c = resample(c1c, length(signal), length(c1c));&#xA;&#xA;c1d = c1(1+l(1)+l(2)+l(3):l(1)+l(2)+l(3)+l(4));&#xA;c1d = resample(c1d, length(signal), length(c1d));&#xA;&#xA;c2a = resample(c1a, l(1), length(c1a));&#xA;c2b = resample(c1b, l(2), length(c1b));&#xA;c2c = resample(c1c, l(3), length(c1c));&#xA;c2d = resample(c1d, l(4), length(c1d));&#xA;&#xA;X = waverec([c2a; c2b; c2c; c2d], l, 'db4');&#xA;err = norm(X-signal)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, the error err is reported as   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;err = 20.26688&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What can I do to reduce this error? &#xA;Please help :)&lt;/p&gt;&#xA;" OwnerUserId="11658" LastEditorUserId="11658" LastEditDate="2014-11-10T04:11:58.393" LastActivityDate="2014-11-10T04:11:58.393" Title="High error due to resample function in MATLAB" Tags="|matlab|wavelet|transform|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19074" PostTypeId="2" ParentId="2064" CreationDate="2014-11-10T04:39:37.427" Score="-1" Body="&lt;p&gt;See this code from matlab website: &quot;Depth from gradient&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/45269-dfgbox&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/45269-dfgbox&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11659" LastActivityDate="2014-11-10T04:39:37.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19075" PostTypeId="1" CreationDate="2014-11-10T07:19:40.403" Score="0" ViewCount="78" Body="&lt;p&gt;An audio sampler (in &quot;music&quot; terms because I'm not experienced in dsp) is a software which loads an audio file and allows you to play it at different pitches by slowing it down and speeding it up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The audio file should be playable at any new frequency, and the frequency at which I'm playing it can change at any time, even continuously for &quot;pitch slides&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that if I am pitching it up, I should use a lowpass filter first so I don't create frequencies above nyquist that will alias. After that I need to use an interpolation function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of filter I should use? IIR or FIR? What type? Please also keep in mind that for audio the phase changes and the ringing in the time domain can be undesired because they change the way the transients sound.&lt;/p&gt;&#xA;" OwnerUserId="11660" LastActivityDate="2014-11-10T07:19:40.403" Title="Filter for audio sampler" Tags="|filters|audio|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19077" PostTypeId="1" AcceptedAnswerId="19079" CreationDate="2014-11-09T18:37:42.210" Score="1" ViewCount="125" Body="&lt;p&gt;The question is: &#xA;Are the following systems linear time invariant?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$y(t)=x(t)$, with $x(t)=u(t)$ (unit step function)&lt;/li&gt;&#xA;&lt;li&gt;$y[n]=x[n]$, with $x[n]=\delta[n]$ (Dirac delta function)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The reason I am asking is because I don't see the relevance of the values given to the input functions. LTI is a property of the system not its inputs, so I don't understand what is meant! &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is it a restriction? &lt;/li&gt;&#xA;&lt;li&gt;In that case how would I check for linearity? One probably can't, right?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11664" OwnerDisplayName="Undertherainbow" LastActivityDate="2014-11-11T23:39:20.357" Title="Is this HW question even valid? (linear systems)" Tags="|linear-systems|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19078" PostTypeId="2" ParentId="19077" CreationDate="2014-11-09T22:29:35.647" Score="2" Body="&lt;p&gt;there is an &lt;a href=&quot;https://dsp.stackexchange.com/&quot;&gt;SE&lt;/a&gt; specifically for signal processing.  sorta surprized to see tags for this at the Physics SE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what you are suspecting is precisely true.  LTI is a property of the system, not of the input.  both 1. and 2. are obviously linear and time-invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one slight misconception.  in DSP we usually use square brackets, as in &quot;$x[n]$&quot;, to depict discrete-time signals (as an alternative to &quot;$x_n$&quot;).  a discrete-time signal &lt;strong&gt;is&lt;/strong&gt; just a sequence, but we want to leave the subscript for the same purpose we might with continuous-time signals.  i.e. given a vector of continuous-time signals: $\{x_1(t), x_2(t), ... x_N(t) \}$, if we were to sample those signals, the corresponding discrete-time vector would be $\{x_1[n], x_2[n], ... x_N[n] \}$.  the argument (inside of square brackets) to a discrete-time signal is always an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that said, &quot;$\delta[n]$&quot; is the Kronecker delta, not the Dirac delta.  (the latter the math guys like to tell us is not even a &quot;function&quot;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \delta[n] \ \triangleq&#xA;\begin{cases}&#xA;1, &amp;amp; \text{if }n = 0 \\&#xA;0, &amp;amp; \text{if }n \ne 0&#xA;\end{cases} $$&lt;/p&gt;&#xA;" OwnerUserId="4346" OwnerDisplayName="robert bristow-johnson" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-11-09T22:29:35.647" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19079" PostTypeId="2" ParentId="19077" CreationDate="2014-11-10T04:28:28.357" Score="2" Body="&lt;p&gt;You are absolutely right: the data you are given say nothing on their own about whether the system concerned is linear or time shift invariant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check that a system is linear, you need to know its behaviour for sums of inputs and multiples of inputs to check that the sum / multiples of the outputs in response to different inputs is the response when the sum of those separate inputs is the lone system input. You only have the behaviour for one input $x(t) = u(t)$. You need to be able to say that $x(t)\mapsto A\,x(t)\Rightarrow y(t)\mapsto A\,y(t)\,\forall\,A\in\mathbb{R}$ and also that if $x_1(t),\,x_2(t)$ lead to outputs $y_1(t),\,y_2(t)$, then input $x_1(t)+x_2(t)$ gives rise to output $y_1(t)+y_2(t)$ for any &#xA;$x(t),\,x_1(t),\,x_2(t){}{}{}{}{}{}{}{}$ in a suitable space of functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check time shift invariance, you need to know how the system behaves when we input $y(t-t_0)$ instead of $y(t)$ to check whether the output is the same, but shifted by the amount $t_0$. You only know the behaviour for one value of the delay $t_0$, that is $t_0=0$. You need to be able to say that input $x(t)$ gives rise to output $y(t)$ implies that $x(t-t_0)$ gives rise to output $Y(t-t_0)$ for any constant $t_0\in\mathbb{R}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can say nothing about the linearity or the time shift invariance of this system.&lt;/p&gt;&#xA;" OwnerUserId="11670" OwnerDisplayName="WetSavannaAnimal aka Rod Vance" LastEditorUserId="235" LastEditDate="2014-11-11T23:39:20.357" LastActivityDate="2014-11-11T23:39:20.357" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19081" PostTypeId="1" CreationDate="2014-11-10T13:44:13.840" Score="0" ViewCount="1901" Body="&lt;p&gt;I was searching for a tutorial on how to implement a stereo Phaser in C++. All i´ve found was sourcecode with little or no explanations which did´nt help me much. Does anyone know a Tutorial with which i can learn and understand how to implement a stereo Phaser in C++? By the way im using the Juce Plugin.&lt;/p&gt;&#xA;" OwnerUserId="11633" LastEditorUserId="13320" LastEditDate="2016-11-21T13:16:11.877" LastActivityDate="2016-11-21T13:16:11.877" Title="Tutorial for a stereo Phaser in C++?" Tags="|phase|sound|" AnswerCount="2" CommentCount="1" ClosedDate="2016-11-21T15:18:16.923" ContentLicense="CC BY-SA 3.0" />
  <row Id="19083" PostTypeId="1" CreationDate="2014-11-10T15:45:11.130" Score="0" ViewCount="4018" Body="&lt;p&gt;I searched a lot but I didn't find a good answer. According to &lt;a href=&quot;http://en.wikipedia.org/wiki/Signal-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;wikipedia SNR page&lt;/a&gt;, SNR can be calculated by both ratio of Power of clean signal to its noise Power either ratio of variance of clean signal to variance of its noise, but actually power and variance are two different things so I am confused how we can use both of them equally. I should mention that I speak about two finite signal, first the original one and second the noisy one and want to calculate the SNR.&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="11666" LastActivityDate="2014-11-10T16:33:52.853" Title="Confusion about how to calculate signal to noise ratio(SNR)?" Tags="|noise|snr|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19084" PostTypeId="1" AcceptedAnswerId="19086" CreationDate="2014-11-10T15:55:58.843" Score="31" ViewCount="60724" Body="&lt;p&gt;I saw in a &lt;a href=&quot;https://stackoverflow.com/questions/13740348/how-to-apply-a-filter-to-a-signal-in-python/13740532#13740532&quot;&gt;SO thread&lt;/a&gt; a suggestion to use &lt;code&gt;filtfilt&lt;/code&gt; which performs backwards/forwards filtering instead of &lt;code&gt;lfilter&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the motivation for using one against the other technique?&lt;/p&gt;&#xA;" OwnerUserId="11401" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2018-07-31T07:34:44.070" Title="Applying filter in scipy.signal: Use lfilter or filtfilt?" Tags="|filters|python|infinite-impulse-response|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19085" PostTypeId="2" ParentId="19083" CreationDate="2014-11-10T16:33:52.853" Score="4" Body="&lt;p&gt;The SNR is the ratio of the powers. Note that for zero-mean signals, the variance equals the power, so the SNR is the ratio of the variances of signal and noise, but only if both are zero-mean.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-10T16:33:52.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19086" PostTypeId="2" ParentId="19084" CreationDate="2014-11-10T16:44:17.557" Score="45" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;filtfilt&lt;/code&gt; is zero-phase filtering, which doesn't shift the signal as it filters.  Since the phase is zero at all frequencies, it is also linear-phase.  Filtering backwards in time requires you to predict the future, so it can't be used in &quot;online&quot; real-life applications, only for offline processing of recordings of signals.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;lfilter&lt;/code&gt; is causal forward-in-time filtering only, similar to a real-life electronic filter.  It can't be zero-phase.  It can be linear-phase (symmetrical FIR), but usually isn't.  Usually it adds different amounts of delay at different frequencies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;An example and image should make it obvious.  Although the magnitude of the frequency response of the filters is identical (top left and top right), the zero-phase lowpass lines up with the original signal, just without high frequency content, while the minimum phase filtering delays the signal in a causal way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z4uVe.png&quot; alt=&quot;filtfilt vs lfilter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from __future__ import division, print_function&#xA;import numpy as np&#xA;from numpy.random import randn&#xA;from numpy.fft import rfft&#xA;from scipy import signal&#xA;import matplotlib.pyplot as plt&#xA;&#xA;b, a = signal.butter(4, 0.03, analog=False)&#xA;&#xA;# Show that frequency response is the same&#xA;impulse = np.zeros(1000)&#xA;impulse[500] = 1&#xA;&#xA;# Applies filter forward and backward in time&#xA;imp_ff = signal.filtfilt(b, a, impulse)&#xA;&#xA;# Applies filter forward in time twice (for same frequency response)&#xA;imp_lf = signal.lfilter(b, a, signal.lfilter(b, a, impulse))&#xA;&#xA;plt.subplot(2, 2, 1)&#xA;plt.semilogx(20*np.log10(np.abs(rfft(imp_lf))))&#xA;plt.ylim(-100, 20)&#xA;plt.grid(True, which='both')&#xA;plt.title('lfilter')&#xA;&#xA;plt.subplot(2, 2, 2)&#xA;plt.semilogx(20*np.log10(np.abs(rfft(imp_ff))))&#xA;plt.ylim(-100, 20)&#xA;plt.grid(True, which='both')&#xA;plt.title('filtfilt')&#xA;&#xA;sig = np.cumsum(randn(800))  # Brownian noise&#xA;sig_ff = signal.filtfilt(b, a, sig)&#xA;sig_lf = signal.lfilter(b, a, signal.lfilter(b, a, sig))&#xA;plt.subplot(2, 1, 2)&#xA;plt.plot(sig, color='silver', label='Original')&#xA;plt.plot(sig_ff, color='#3465a4', label='filtfilt')&#xA;plt.plot(sig_lf, color='#cc0000', label='lfilter')&#xA;plt.grid(True, which='both')&#xA;plt.legend(loc=&quot;best&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2018-02-02T19:39:00.223" LastActivityDate="2018-02-02T19:39:00.223" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19089" PostTypeId="2" ParentId="4684" CreationDate="2014-11-10T22:11:01.733" Score="3" Body="&lt;p&gt;Here is yet an alternative solution to your problem by modelling your question as a 'path optimization problem'. Though it is more complicated than the simple binarization-and-then-curvefitting solution, it is more robust in practice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the very high level, we should consider this image as a graph, where&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;each image pixel is a node on this graph&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;each node is connected to some other nodes, known as neighbours, and this connection definition is often referred as to the topology of this graph.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;each node has a weight (feature, cost, energy, or whatever you want to call it ), reflecting the likelihood that this node is in an optimal central-line we are looking for.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As long as we can model this likelihood, then your problem of finding 'the centerlines of the fringes' becomes to the problem to &lt;strong&gt;find local optimal paths on the graph&lt;/strong&gt;, which can be effectively solved by dynamic programming, e.g. Viterbi algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some pros of adopting this approach:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;all your results will be continuous ( unlike the threshold method that might break one center line into pieces )&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a lot of freedoms to construct such a graph, you can select different features, and graph topology.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;your results are optimal in the sense of path optimizations&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;your solution will be more robust against noise, because as long as noise is equally distributed among all pixels, those optimal paths remain stable. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is a short demonstration of the above idea. Since I donot use any prior knowledge to specify what are possible starting and ending nodes, I simply decode w.r.t every possible starting node. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/lS3Ri.png&quot; alt=&quot;Decoded Viterbi Paths&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the fuzzy endings, it is caused by the fact that we are looking for optimal paths for every possible ending nodes. As a result, though for some nodes located in dark areas, the highlighted path is still its local optimal one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the fuzzy path, you could either smooth it after you find it or use some smoothed features instead of raw intensity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to restore partial paths by changing starting and ending nodes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will not be difficult to prune these undesired local optimal paths. Because we have the likelihoods of all paths after viterbi decoding, and you may use various prior knowledge ( e.g. we see it is true that we only need one optimal path for those sharing the same source. ) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more details, you may refer to the paper. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Wu, Y.; Zha, S.; Cao, H.; Liu, D., &amp;amp; Natarajan, P.  (2014, February). A Markov Chain Line Segmentation Method for Text Recognition. In IS&amp;amp;T/SPIE 26th Annual Symposium on Electronic Imaging (DRR), pp. 90210C-90210C.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a short piece of python code using to make the above graph.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;import cv2&#xA;import numpy as np&#xA;from matplotlib import pyplot&#xA;# define your image path&#xA;image_path = ;&#xA;# read in an image&#xA;img = cv2.imread( image_path, 0 );&#xA;rgb = cv2.imread( image_path, -1 );&#xA;&#xA;# some feature to reflect how likely a node is in an optimal path&#xA;img = cv2.equalizeHist( img ); # equalization&#xA;img = img - img.mean(); # substract DC&#xA;img_pmax = img.max(); # get brightest intensity&#xA;img_nmin = img.min(); # get darkest intensity&#xA;# express our preknowledge&#xA;img[ img &gt; 0 ] *= +1.0  / img_pmax; &#xA;img[ img = 1 :&#xA;    prev_idx = vt_path[ -1 ].astype('int');&#xA;    vt_path.append( path_buffer[ prev_idx, time ] );&#xA;    time -= 1;&#xA;vt_path.reverse();    &#xA;vt_path = np.asarray( vt_path ).T;&#xA;&#xA;# plot found optimal paths for every 7 of them&#xA;pyplot.imshow( rgb, 'jet' ),&#xA;for row in range( 0, h, 7 ) :&#xA;    pyplot.hold(True), pyplot.plot( vt_path[row,:], c=np.random.rand(3,1), lw = 2 );&#xA;pyplot.xlim( ( 0, w ) );&#xA;pyplot.ylim( ( h, 0 ) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2014-11-10T22:11:01.733" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19091" PostTypeId="1" CreationDate="2014-11-11T10:15:00.287" Score="1" ViewCount="184" Body="&lt;p&gt;&lt;strong&gt;Signal Characteristics:&lt;/strong&gt;&#xA;The IF (I/Q) signal consists of a DC component and an AC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DC Component: 2.52V;&#xA;AC Component: 1.72 – 2.04 V (V P-P);&#xA;BW: 20Hz - 500kHz;&#xA;Power: 20dB&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Requirement:&lt;/strong&gt; Now I want to digitize this signal for further processing. I prefer a sampling at 1 MSPS with ADC and then porting digital data to PC using a FPGA over SPI interface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; The problem is, the signal with DC and AC component ranges from 3.5V to -1.5V with 2.5V from DC and almost 1V from positive cycle or negative cycle of the AC signal. Now I can use a coupled capacitor to block the Dcand use the AC for processing. My choice of ADC reference voltage is almost 2V-2.5V (for good resolution usability of ADC) so the signal can be amplified. But this signal have a negative part which I think is not good for a linear behavious for the ADC, as it has no negative reference voltage level. ADC reference is from 1V-5V. Using a rectifier is not a good choice from my view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; How can I digitize this signal? Also comment on my views if not correct  as I have only theoretical knowledge and never worked on a practical project.&lt;/p&gt;&#xA;" OwnerUserId="11676" LastEditorUserId="13320" LastEditDate="2016-11-21T13:08:05.200" LastActivityDate="2016-11-21T13:08:05.200" Title="Processing IQ signals" Tags="|sampling|analog-to-digital|" AnswerCount="0" CommentCount="4" ClosedDate="2015-01-16T14:59:29.820" ContentLicense="CC BY-SA 3.0" />
  <row Id="19093" PostTypeId="2" ParentId="19081" CreationDate="2014-11-11T12:17:38.637" Score="0" Body="&lt;p&gt;Felix - I went through this all last year.  I think you need to break it into separate parts. There's unlikely to be a specific JUCE Phasor tutorial out there - I couldn't find one either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, writing this stuff gets relatively complicated relatively quickly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So split it into the following steps: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(a) Get a plugin working (I presume you are thinking about a plugin) in JUCE that does something basic.  You need to know how to get a controller on the screen and have it control a value in the audio processing thread. A volume and pan control would be a good first project. That's hard enough the first time. Visit the JUCE forum if you get stuck on this bit - and there's a good example included in the distribution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once that's sorted, on to the fun stuff:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(b) get a phasor working in a high-level mock up in Reaktor, MAX/MSP or something where you can drag audio processing modules around quickly.  (Or Csound, or puredata...)  There are undoubtedly lots of ways of making a phaser work in stereo.  And you might want to experiment or investigate how effects you already like work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(c) identify the separate components in your phasor (probably an LFO, an all-pass filter and maybe some other bits).  Unlike complete phasers, you can probably find a well documented oscillator or all-pass filters&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(d) work out how to implement those components in C++ (the examples will make more sense now you've done a mock up or two).   You may want to test them separately (does the LFO actually oscillator, does the all-pass filter work).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(e) Glue it all together into a working phaser. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you've seen these? &#xA;&lt;a href=&quot;http://music.columbia.edu/pipermail/music-dsp/1998-August/053675.html&quot; rel=&quot;nofollow&quot;&gt;http://music.columbia.edu/pipermail/music-dsp/1998-August/053675.html&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.dsprelated.com/showcode/177.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showcode/177.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="10794" LastActivityDate="2014-11-11T12:17:38.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19094" PostTypeId="1" AcceptedAnswerId="19095" CreationDate="2014-11-11T13:29:17.013" Score="0" ViewCount="1437" Body="&lt;p&gt;simply put, let's say I have this array - &lt;code&gt;[1 2 1]&lt;/code&gt;&#xA;I want to try and get this output in Matlab&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[1 1 1&lt;/p&gt;&#xA;&lt;p&gt;1 2 1&lt;/p&gt;&#xA;&lt;p&gt;1 1 1]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It's like my array was 'rotated' into forming the above matrix such that if I start at any peripheral element and move through the center of the matrix (in a straight line of course) towards the other end, then I get back my original array ( &lt;code&gt;[1 2 1]&lt;/code&gt; )&lt;/p&gt;&#xA;&lt;p&gt;Can anyone help me achieve this?&lt;/p&gt;&#xA;" OwnerUserId="11433" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-11-12T01:04:07.190" Title="Convert a 1D array into a 'rotated' 2D matrix" Tags="|matlab|algorithms|matrix|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19095" PostTypeId="2" ParentId="19094" CreationDate="2014-11-11T14:00:34.660" Score="0" Body="&lt;p&gt;I assume that the length of the array is odd and that the array is symmetrical. Also note that from your requirements not all elements of the resulting matrix are specified. Those elements will be zero in the code shown below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v=[1,2,3,2,1];      % odd-length array&#xA;A=diag(v);&#xA;A=A+rot90(A);&#xA;n=(length(v)+1)/2;&#xA;A(n,:)=v;&#xA;A(:,n)=v;&#xA;A =&#xA;&#xA;1   0   1   0   1&#xA;0   2   2   2   0&#xA;1   2   3   2   1&#xA;0   2   2   2   0&#xA;1   0   1   0   1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-11T14:00:34.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19096" PostTypeId="1" CreationDate="2014-11-11T16:03:04.293" Score="0" ViewCount="207" Body="&lt;p&gt;Today I have heard, that is &quot;impossible&quot; to make low pass butterworth filter from cascading 1 order low pass filters(RC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to discover is that true, but I can find little to none information on their difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please explain to me, is that true, and if it is why. Thanks?&lt;/p&gt;&#xA;" OwnerUserId="10201" LastEditorUserId="10201" LastEditDate="2014-11-11T16:28:43.153" LastActivityDate="2014-11-11T19:53:51.677" Title="Is it possible from 1 order cascading low pass filters to make a butterworth filter" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19097" PostTypeId="2" ParentId="18150" CreationDate="2014-11-11T19:42:34.137" Score="1" Body="&lt;p&gt;Aha, this is a quite funny story that I've heard about CV. Are you a bio guy? Any way, here are my suggestions. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If you are a bio guy and just want to finish this project ( I mean successfully identify each insect in a video frame ), go for barcode, QR etc. They are labels though their contents are not directly readable by eyes. However, you will have a much better chance to handle all kind of problems you might encountered when you use manual labels, e.g. occlusion, error correction, lighting etc. There are libraries can decode these labels, and you simply call them. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In this way, you will save a lot of energy to not working on something you are in lack of experience, but use the state-of-the-art technologies. &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;If you are not a bio guy or these manual labels are not something can be changed, you should first locate these labels and then recognize them. Donot mess up these two things. The first task is detection, and the second one is recognition. In other words, you need to do two things:&#xA;a). Train a text/none-text classifier. In this classifier you can use those rotational invariant features. &#xA;b). Train a character classifier ( e.g. using NN ) to decide the class of a character candidate you found from (a).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;By the way, I donot believe you need to train a NN accepting character at an arbitrary angle. Instead, all you need is to train a NN accepting normal characters, and normalize a candidate using image moments or other techniques before you feed it into the classifier. Or simply rotate your candidate to a certain degree (e.g. for every 10 degree) and then feed them into your classifier and pick the result with the highest confidence. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2014-11-11T19:42:34.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19099" PostTypeId="1" CreationDate="2014-11-11T21:06:24.900" Score="1" ViewCount="1742" Body="&lt;p&gt;I have time domain strain gauge data from a structure which is subjected to low frequency, random loading. The signal / noise ratio is pretty good, but I would like to try to improve on it as much as possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/maX3y.png&quot; alt=&quot;MPa time series&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the FFT, I know that the dominant loading and response is below a frequency of around 1 Hz, but my signal has a constant level of noise up to the 10 Hz Nyquist frequency, above which any frequencies should have been removed by the low pass filter that was used with the measurement system - but I have very little knowledge of how this works. Although I can determine the dominant frequency response from my data in it's current form, I'm interested in processing the time domain data for fatigue calculations, and so any additional noise will introduce error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I basically have two questions that I'd like to ask anyone with a good understanding of modern measurement and signal processing systems;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) How is the low pass filter implemented in best practice for a measurement system like this? Is this done with the standard RC circuit prior to analogue to digital converter, or is this done after digital conversion with a processor and a suitable algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What would be the most suitable method to remove the noise present in my data above 1 Hz? I've had a bit of success with simple smoothing algorithms in the past (such as localised regression fitting; LOESS), but wondered whether there are more appropriate methods that I am not aware of, as smoothing seems a bit crude!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any responses or pointers in the right direction would be really appreciated,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trev&lt;/p&gt;&#xA;" OwnerUserId="11689" LastActivityDate="2016-01-08T00:31:55.840" Title="Digital low-pass filters; best practice application" Tags="|noise|lowpass-filter|digital|measurement|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19103" PostTypeId="2" ParentId="19099" CreationDate="2014-11-11T22:39:21.583" Score="1" Body="&lt;p&gt;I think a digital low-pass filter, applied after sampling, should be a good solution. One benefit of digital filtering is that you can obtain very sharp transition regions, and large rejection of out-of-band signals. The cost is relatively high computational complexity, in the sense that your processing code will execute many arithmetic operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another benefit of digital filtering is that you can make use of a very large, well tested array of algorithms to design the filer, without necessarily understanding how they work. Obtaining the frequency response of a particular filter is very easy, so you can quickly evaluate if the filter meets your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For illustration, this is how you would design and evaluate the filter in Matlab. I'll assume that the sampling frequency is 20 samples per second, and you want the cutoff frequency at 1 Hz.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% define frequencies:&#xA;fs = 20;&#xA;fn = fs/2;  % Nyquist frequency&#xA;fc = 1;     % cutoff frequency&#xA;&#xA;% define the filter&#xA;b = fir1(100, fc/fn);  % filter order is 100; cutoff frequency is 1 Hz&#xA;&#xA;% plot its frequency response&#xA;freqz(b);   % this command plots the filter's magnitude and phase responses.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The response obtained is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7tyNT.jpg&quot; alt=&quot;filter response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that the response is really nice: it is linear in the passband, and the rejection is around 60 dB to 80 dB out of band. Using this filter, though, requires around 100 multiplications and 100 additions per each processed sample.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-11-11T22:39:21.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19104" PostTypeId="1" CreationDate="2014-11-12T04:27:28.390" Score="1" ViewCount="558" Body="&lt;p&gt;I’m new to DSP programming and I’m trying to learn a bit about convolution and deconvolution and FFTs.  I have a project where I am taking a signal (a sine sweep) and convolving it with a shorter Impulse Response.  Then I take the convolved signal and deconvolve it with the original signal to recover the IR. I’m writing this in C using the Accelerate Framework’s vDSP functions on OS X. The output from the convolved stage is as expected, though scaled as discussed below, but the output from the deconvolve stage doesn’t match the original IR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the convolve stage I get a length for my FFT, N, as close as possible to double the length of the IR like this (because the &lt;code&gt;vDSP_fft_zrip()&lt;/code&gt; function takes a power of 2 parameter for the FFT length[1]):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vDSP_Length log2_N = ceil(log2(irLengthInSamples * 2));&#xA;UInt32 N = pow(2.0, log2_N);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I pad the signal out with 0s to be a multiple of N, and pad the IR out with 0s to length N. I iterate through the signal, taking N/2 samples and padding out to length N with 0s, FFT both this padded signal chunk and the padded IR, multiply the results, and IFFT back to the time domain.  I scale the results by multiplying by 1/2N to compensate for the scaling introduced by the forward and inverse calls to &lt;code&gt;vDSP_fft_zrip()&lt;/code&gt; [2].  Then I overlap-sum each iteration’s results in to an output array of length signal+IR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convolved output signal seems fine, except that it is has a peak loudness of around +10dB (the input signal is at -12dB and the IR has a peak of -15dB).  This seems weird, but I don’t know enough to know if this is expected or not.  So I normalise the convolved output to 0dB.  Normalising or not doesn’t make any significant change to the output of the deconvolve stage..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the deconvolution stage, I figure the IR length to be the convolved signal length minus the original signal length, and create an FFT length like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;irLengthInSamples = (convolvedSamplesCount - signalSamplesCount)&#xA;vDSP_Length log2_N = ceil(log2(rLengthInSamples));&#xA;UInt32 N = pow(2.0, log2_N);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I pad the convolved signal out to be a multiple of N, and pad the original signal to the same length.  Then I iterate through them in chunks of N length.  N samples of the convolved signal and N samples of the original signal are each FFT’d and the frequency values for the convolved signal are divided by the frequency values of the original signal. The results are IFFT’d, scaled again by 1/2N and summed into an output array of length N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the output does not match the original IR.  The image below shows the original IR waveform on top and the deconvolution output on the bottom.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://farm9.staticflickr.com/8668/15746597256_16e74f6e60_o.jpg&quot; alt=&quot;IR Waveforms&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One issue I'm aware of is that because the original signal is padded at the end with 0s, the last iteration through the deconvolve loop includes division by 0, producing NaNs.  I’ve been handling this by replacing NaNs with the equivalent samples from the convolved signal before summing them, but I suspect I shouldn’t be getting into this situation in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point out where I'm going wrong?  As I said, I'm new to DSP programming so I suspect I may be making a fundamental mistake somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]&#xA;&lt;a href=&quot;https://developer.apple.com/library/Mac/documentation/Accelerate/Reference/vDSPRef/index.html#//apple_ref/c/func/vDSP_fft_zrip&quot; rel=&quot;nofollow&quot;&gt;https://developer.apple.com/library/Mac/documentation/Accelerate/Reference/vDSPRef/index.html#//apple_ref/c/func/vDSP_fft_zrip&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] &lt;a href=&quot;https://developer.apple.com/library/mac/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html#//apple_ref/doc/uid/TP40005147-CH202-15952&quot; rel=&quot;nofollow&quot;&gt;https://developer.apple.com/library/mac/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html#//apple_ref/doc/uid/TP40005147-CH202-15952&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11680" LastActivityDate="2014-11-12T04:27:28.390" Title="Problem implementing deconvolution to recover an Impulse Response" Tags="|impulse-response|deconvolution|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19106" PostTypeId="2" ParentId="4684" CreationDate="2014-11-12T05:32:55.933" Score="3" Body="&lt;p&gt;Thought I should post my answer as it is bit different from other approaches. I tried this in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;sum all channels and create an image, so all channels are weighted equally&lt;/li&gt;&#xA;&lt;li&gt;perform morphological closing and Gaussian filtering on this image&lt;/li&gt;&#xA;&lt;li&gt;for each column of the resulting image, find the local maxima and construct an image&lt;/li&gt;&#xA;&lt;li&gt;find the connected components of this image&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One disadvantage I see here is that this approach will not perform well for some orientations of the stripes. In that case we have to correct its orientation and apply this procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = imread('m0sy7.png');&#xA;imsum = sum(im, 3); % sum all channels&#xA;h = fspecial('gaussian', 3);&#xA;im2 = imclose(imsum, ones(3)); % close&#xA;im2 = imfilter(im2, h); % smooth&#xA;% for each column, find regional max&#xA;mx = zeros(size(im2));&#xA;for c = 1:size(im2, 2)&#xA;    mx(:, c) = imregionalmax(im2(:, c));&#xA;end&#xA;% find connected components&#xA;ccomp = bwlabel(mx);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For example, if you take the mid column of the image, its profile should look like this:&#xA;(in blue is the profile. in green are the local maxima)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ESdWQ.png&quot; alt=&quot;mid profile and local maxima&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the image containing the local maxima for all columns looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OcJaE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the connected components (though some stripes are broken, most of them get a continuous region):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lNzoB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8833" LastEditorUserId="8833" LastEditDate="2014-11-12T05:48:06.967" LastActivityDate="2014-11-12T05:48:06.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19107" PostTypeId="1" AcceptedAnswerId="19108" CreationDate="2014-11-12T07:13:29.377" Score="1" ViewCount="889" Body="&lt;p&gt;fm=20000 and I am sampling following signal at 65000 Hz:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x=0.5*sin(2*pi*(fm-2500)*t)+0.6*sin(2*pi*(fm-1250)*t*1.05)+0.7*sin(2*pi*fm*t*1.1)+0.8*sin(2*pi*(fm+1250)*t*1.15)+0.9*sin(2*pi*(fm+2500)*t*1.2);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and looking at frequency spectrum is not as it should look like.&#xA;Please find attachment. &#xA;It has code and result also.&lt;img src=&quot;https://i.stack.imgur.com/30cwC.png&quot; alt=&quot;Code and results are there in image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11696" LastEditorUserId="39" LastEditDate="2014-11-12T08:56:49.717" LastActivityDate="2019-08-21T13:51:37.060" Title="why Sampling with higher than nyquist frequency is causing aliasing?" Tags="|fft|sampling|nyquist|aliasing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19108" PostTypeId="2" ParentId="19107" CreationDate="2014-11-12T08:42:46.420" Score="3" Body="&lt;p&gt;The effect you see has nothing to do with aliasing. First of all, due to &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot; rel=&quot;nofollow&quot;&gt;spectral leakage&lt;/a&gt; the maxima of the spectrum do not exactly reflect the amplitudes of the sinusoids. Second, note that the DFT (implemented by the FFT) only samples the actual spectrum (the discrete-time Fourier transform, DTFT) of the signal. Depending on the choice of the sampling frequency in your example, the actual spectrum (DTFT) and the location of the sample points of the DFT shift with respect to each other, and there's no guarantee that the samples of the DFT occur at (or close to) the maxima of the actual spectrum.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-12T08:42:46.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19109" PostTypeId="2" ParentId="19019" CreationDate="2014-11-12T13:17:03.950" Score="0" Body="&lt;p&gt;A 2nd-order Linkwitz-Riley crossover needs 1st-order allpass phase compensation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Lowpass half of the LR crossover is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dfrac{1}{s^2+2s+1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Highpass half of the LR crossover is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dfrac{s^2}{s^2+2s+1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With even-order LR crossovers, in order to sum-to-allpass one of the two sections has to have inverted polarity. Thus:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dfrac{s^2}{s^2 + 2s +1} - \dfrac{1}{s^2 + 2s +1}= \dfrac{(s-1)(s+1)}{(s+1)(s+1)} = \dfrac{(s-1)}{(s+1)}$$&lt;/p&gt;&#xA;" OwnerUserId="11085" LastEditorUserId="8202" LastEditDate="2014-11-12T13:40:06.483" LastActivityDate="2014-11-12T13:40:06.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19110" PostTypeId="1" CreationDate="2014-11-12T13:36:18.557" Score="0" ViewCount="157" Body="&lt;p&gt;I am simulating a feature detector in noisy environment which consist of AWGN Noise and Impulsive Noise. But I am getting a strange result as Signal with Impulsive+AWGN noise has better detection probability then with Signal with only AWGN. I know its wrong at some point. How Is it possible that signal with more noise like Impulsive noise has better detection possibility. Please share your experience.&lt;/p&gt;&#xA;" OwnerUserId="11700" LastActivityDate="2014-11-12T16:14:23.637" Title="Is it possible that adding noise to a signal can increase detection possibility?" Tags="|matlab|discrete-signals|noise|signal-detection|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19112" PostTypeId="2" ParentId="19110" CreationDate="2014-11-12T16:14:23.637" Score="1" Body="&lt;p&gt;Our ears have a hearing threshold- i.e. a minimum amount of sound power that is required for them to detect.  Thus, a pure tone that is less than the threshold will not be detected.  If white noise is added to the tone such that the total power of the tone and noise exceeds the threshold, then the ear can hear the tone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps you have some sort of similar non-linear effect going on.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-11-12T16:14:23.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19113" PostTypeId="2" ParentId="19053" CreationDate="2014-11-12T17:28:07.157" Score="2" Body="&lt;p&gt;Add twice 5.65 to 5.64, and let $j = h(0)+h(2)$ and $k = h(1)+h(3)$; then we get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;j + k = sqrt(2)&#xA;j*j + k*k = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which represents the intersection of a line with a circle, and we get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;j = k = 1/sqrt(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now subtract twice 5.65 from 5.64 and let $m = h(0)-h(2)$ and $n = h(1) - h(3)$; we get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m*m + n*n = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so for same angle $b$ say we get $m = cos(b)$ and $n = sin(b)$. We now have, for example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h(0) + h(2) = 1/sqrt(2)&#xA;h(0) - h(2) = cos(b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which we can solve for $h(0)$ and $h(2)$. Finally shifting $b$ to get a gives the required expressions.&lt;/p&gt;&#xA;" OwnerUserId="11707" LastEditorUserId="11707" LastEditDate="2014-11-13T13:40:19.470" LastActivityDate="2014-11-13T13:40:19.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19116" PostTypeId="1" AcceptedAnswerId="19118" CreationDate="2014-11-12T22:22:03.557" Score="3" ViewCount="2137" Body="&lt;p&gt;I'm working on a software defined radio project on a PIC32 MCU. I'm using a &lt;a href=&quot;http://www.cmlmicro.com/products/CMX973_RF_Quadrature_Modulator_Demodulator/&quot; rel=&quot;nofollow&quot;&gt;CMX 973&lt;/a&gt; quadrature frontend to provide I and Q. I'm independently low passing I and Q with carefully matched analog filters to reduce the overall bandwidth to 192 kHz, then digitizing it with an audio codec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to be receiving a couple of closely-spaced channels so I'll need to filter them separately (bandpass), mix, and downsample. I'll also need to do some filtering for pulse shaping and PLL. These operations are all on complex-valued signals (I-Q).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trouble is the PIC32 DSP library only provides an FIR filter implementation for real-valued filters. I can write my own complex filter implementation relatively easily, but it won't come with the benefit of optimization done by Microchip - I'll have to do it myself. I can do it, but I'd like to avoid it if I can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, is there any way to split a complex signal into I and Q and perform filtering using several real-valued filters which would have the same response as a complex-valued filter (particularly for bandpass filtering)? If so, how, and what are the limits to this approach?&lt;/p&gt;&#xA;" OwnerUserId="11638" LastActivityDate="2014-11-12T23:02:26.283" Title="Splitting a Complex FIR Filter into Real Filters" Tags="|filters|quadrature|software-defined-radio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19117" PostTypeId="2" ParentId="18759" CreationDate="2014-11-12T23:01:25.963" Score="0" Body="&lt;p&gt;If you're an absolute beginner, I recommend you start with a practical example (that you can see/hear). This will give you some &quot;hands-on&quot; experience before diving into papers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I highly recommend &lt;a href=&quot;https://github.com/bmcfee/librosa/&quot; rel=&quot;nofollow&quot;&gt;libROSA&lt;/a&gt; (and the introduction &lt;a href=&quot;http://nbviewer.ipython.org/github/bmcfee/librosa/blob/master/examples/LibROSA%20demo.ipynb&quot; rel=&quot;nofollow&quot;&gt;ipython notebook&lt;/a&gt; (all free software)) to quickly get some intuition about pitch-estimation (using chroma features), beat-detection (for rhythm and timing of notes) etc.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2014-11-12T23:01:25.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19118" PostTypeId="2" ParentId="19116" CreationDate="2014-11-12T23:02:26.283" Score="3" Body="&lt;p&gt;I'd say there are two ways to look at this problem.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If you're receiving a conventional $M$-QAM signal with AWGN noise, then the I and Q streams are actually two independent, real, $\sqrt{M}$-PAM signals. You can filter and process them independently. The same is true over the wireless channel, as long as the fading is flat and you do the appropriate detection in the receiver.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $s(t)=s_I(t)+js_Q(t)$ is a complex signal and $h(t)=h_I(t)+jh_Q(t)$ is a filter's complex impulse response, then&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$s(t)\star h(t)=s_I(t)\star h_I(t)-s_Q(t)\star h_Q(t)+j(s_I(t)\star  h_Q(t)+s_Q(t)\star h_I(t)),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where all the filters involved are real. This follows from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Convolution#Properties&quot; rel=&quot;nofollow&quot;&gt;convolution's properties&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-11-12T23:02:26.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19119" PostTypeId="1" CreationDate="2014-11-12T23:21:29.903" Score="-1" ViewCount="337" Body="&lt;p&gt;I am trying to find the 2-D derivative of an elongated Gaussian density.&#xA;The Gaussian has standard deviations $\sigma_x$ and $\sigma_y$. How can I get the scale-normalized 2-D Gaussian derivative in this case? Normally, I'd multiply by $\sigma^2$, but what to do when the standard deviation in different in each dimension? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="11711" LastEditorUserId="11256" LastEditDate="2014-11-13T02:39:38.810" LastActivityDate="2016-06-03T16:35:12.230" Title="How to find derivative of 2-D elliptical Gaussian function with different standard deviations along $x$ and $y$ directions?" Tags="|state-space|derivative|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19120" PostTypeId="1" CreationDate="2014-11-13T00:53:16.580" Score="3" ViewCount="249" Body="&lt;p&gt;Of the thousands to millions of frames that a video might have, how is a particular representative frame chosen to be the thumbnail?&lt;/p&gt;&#xA;" OwnerUserId="11054" LastActivityDate="2015-06-11T04:23:37.910" Title="How are video thumbnails chosen?" Tags="|video-processing|video|video-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19121" PostTypeId="2" ParentId="19119" CreationDate="2014-11-13T00:55:18.623" Score="0" Body="&lt;p&gt;If I understand the question, you have three options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You can take the &lt;a href=&quot;http://en.wikipedia.org/wiki/Partial_derivative&quot; rel=&quot;nofollow&quot;&gt;partial derivative&lt;/a&gt; with respect to either variable.&lt;/li&gt;&#xA;&lt;li&gt;You can take the &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_derivative&quot; rel=&quot;nofollow&quot;&gt;total derivative&lt;/a&gt; with respect to another variable on which they both depend.&lt;/li&gt;&#xA;&lt;li&gt;You can take the &lt;a href=&quot;http://en.wikipedia.org/wiki/Gradient&quot; rel=&quot;nofollow&quot;&gt;gradient&lt;/a&gt;, which is a vector whose components are the partial derivatives of the components.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem should determine the appropriate choice.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2014-11-13T03:10:11.867" LastActivityDate="2014-11-13T03:10:11.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19122" PostTypeId="2" ParentId="19120" CreationDate="2014-11-13T01:07:00.367" Score="4" Body="&lt;p&gt;There are many ways to skin this cat. I'll explain one way that I know is used in industry.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create candidate frames algorithmically using the image features; e.g., the histogram, sharpness, presence of humans, faces, and anything else you can think of.&lt;/li&gt;&#xA;&lt;li&gt;Serve different candidates to different users and see which ones are popular&lt;/li&gt;&#xA;&lt;li&gt;You can stop once the popularity contest results stabilize. However, for bonus points you can &lt;a href=&quot;http://en.wikipedia.org/wiki/Learning_to_rank&quot; rel=&quot;nofollow&quot;&gt;learn the ranking function&lt;/a&gt; that yielded the list based on the features enumerated in part one.&lt;/li&gt;&#xA;&lt;li&gt;Use the ranking function to select the best frame, or cull the list of candidates for subsequent tests.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2014-11-13T01:12:07.860" LastActivityDate="2014-11-13T01:12:07.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19123" PostTypeId="2" ParentId="8436" CreationDate="2014-11-13T02:26:38.657" Score="2" Body="&lt;pre&gt;&lt;code&gt;% test for stationary B&#xA;&#xA;xnbf = buffer(signal,100);&#xA;&#xA;mxn = mean(xnbf);&#xA;&#xA;sxn = std(xnbf);&#xA;&#xA;figure; errorbar(mxn, sxn, 'o'); title('Signal A')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above code the mean and the variance should be calculated on the &lt;code&gt;xnbf&lt;/code&gt; instead of &lt;code&gt;signal&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="11712" LastEditorUserId="7092" LastEditDate="2014-11-13T02:40:15.087" LastActivityDate="2014-11-13T02:40:15.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19124" PostTypeId="2" ParentId="15600" CreationDate="2014-11-13T04:01:35.127" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I know I am not extracting noise (they are all very similar)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You should first find or record a well understood set of signals with which you can test your feature extraction code to verify your setup is correct and that the extracted components are as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you'll have higher confidence that you're not extracting noise due to errors in your code and you can focus on tuning your algorithms or reproducing other's results.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2014-11-13T04:01:35.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19125" PostTypeId="1" CreationDate="2014-11-13T06:34:52.443" Score="3" ViewCount="344" Body="&lt;p&gt;I need to identify the coefficients of a linear, causal, time-invariant physical system that can be described by a classical state-space formulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of the example, suppose that the system has two states, only one of which is observed, and one input. Suppose that this state-space is described by the following matrices:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  a = &#xA;               x1          x2&#xA;   x1   -1.25e-05    1.25e-05&#xA;   x2   1.389e-05  -2.083e-05&#xA;&#xA;  b = &#xA;              u1&#xA;   x1          0&#xA;   x2  6.944e-06&#xA;&#xA;  c = &#xA;       x1  x2&#xA;   y1   1   0&#xA;&#xA;  d = &#xA;       u1&#xA;   y1   0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The discrete, equivalent, zeroth-order-hold transfer function is given by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  3.481e-05 z + 3.446e-05&#xA;  -----------------------&#xA;   z^2 - 1.97 z + 0.9704&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In filter terminology, this is clearly an IIR filter because of the higher-order coefficients in the denominator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a suitable adaptive filter algorithm that will:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;be numerically stable&lt;/li&gt;&#xA;&lt;li&gt;allow for online updates, i.e. be recursive&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From my research so far, I've read that if you treat the recorded signal values as inputs to this filter, then it's possible to treat this filter as a FIR filter. This is called the equation error approach. One can then apply, for example, the QR-RLS adaptive FIR filter to find the coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in my trials on the real system I often find filter coefficients that are not physically possible, and I just don't know if my hand-crafted adaptive filter is correct or not. I would like to try with an &quot;official&quot; implementation of such an adaptive filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, my question is whether there exists (for MATLAB or in C) a freely available implementation of an adaptive IIR filter that has the same advantages of a QR-RLS FIR adaptive filter.&lt;/p&gt;&#xA;" OwnerUserId="8053" LastActivityDate="2014-11-19T22:14:20.417" Title="Is there a widely available implementation of an adaptive, recursive, numerically stable IIR filter?" Tags="|infinite-impulse-response|adaptive-filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19127" PostTypeId="1" CreationDate="2014-11-13T08:41:17.577" Score="0" ViewCount="201" Body="&lt;p&gt;I am working with a signal acquired by a pulse oximeter, i.e. a device that records the change of light intensity reflected by a specific tissue depending on its blood perfusion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I am interest in the heart rate whose physiological frequency is in between let's say 30 beats per minute up to 300, I would like to bandpass filter my signal (especially high pass to remove baseline wandering).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to extract the heart rate in 10 seconds long windows. Should I apply frequency based filtering (bandpass) on the whole signal on on each 10 second chunk separately?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks :-) &lt;/p&gt;&#xA;" OwnerUserId="11714" LastActivityDate="2014-11-13T08:41:17.577" Title="Band-pass filtering on whole signal or overlapping chunks?" Tags="|stft|filtering|window|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19130" PostTypeId="2" ParentId="19125" CreationDate="2014-11-13T13:36:56.853" Score="1" Body="&lt;p&gt;While I may not be the final authority, I have looked into this. In short, no. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my own research, the problem is stability. When the filter is extended to have a wider bandwidth, which of course means that the y[n] values and lags 'move quickly', and then is quenched to a lower bandwidth, where the y[n] values and lags 'move slowly', the y[n] buffer may be loaded with fast oscillated entries that appear as initial conditions to the low bandwidth filter. The filter can easily go unstable. If the bandwidth is altered in an adiabatic manner this instability may be avoided (I'm supposing) but then there's an additional constraint on your adaptivity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you don't have to take my word for it. In &quot;Adaptive Filters: Theory and Applications&quot; (2nd) page 5 (&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1119979544&quot; rel=&quot;nofollow&quot;&gt;Amazon&lt;/a&gt;), Boroujeny writes, &quot;However, as we shall see in the later chapters, because of the many difficulties involved in adaptation of IIR filters, their application in the area of adaptive filters is rather limited.&quot; The author states that the adaptation process can place (digital) poles outside of the unit circle, even if they started within the unit circle. The rest of his book is mostly dedicated to FIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this information helps.&lt;/p&gt;&#xA;" OwnerUserId="7438" LastActivityDate="2014-11-13T13:36:56.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19132" PostTypeId="1" AcceptedAnswerId="19154" CreationDate="2014-11-13T16:10:01.003" Score="0" ViewCount="230" Body="&lt;p&gt;I am well versed in cross-correlations, as my masters thesis heavily relied on them for music classification and beat detection. So this question focuses more on the signals that I am running an &lt;code&gt;xcorr&lt;/code&gt; on as opposed to the actual cross correlation process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a simplified version of my setup:&lt;br&gt;&#xA;Suppose I have the original signal, which I time shift the signal (add a delay), and add noise/distort the signal. Then I run a cross-correlation on the two signals to find this time delay and get some value of R.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some formulation to come up with a signal that will reduce ambiguity errors and optimize my value of R?&lt;br&gt;&#xA;I know it will be some non-repeating, pseudo-random signal, but is there a formal formulation for this? Or should I be looking at other techniques?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps something like this would be perfect: &lt;a href=&quot;http://tedxtalks.ted.com/video/TEDxMIAMI-Scott-Rickard-The-Wor&quot; rel=&quot;nofollow&quot;&gt;http://tedxtalks.ted.com/video/TEDxMIAMI-Scott-Rickard-The-Wor&lt;/a&gt;. You see any issues with this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not talking about cross correlation processing techniques to improve the performance. I'm strictly talking about the shape of the waveform&lt;/p&gt;&#xA;" OwnerUserId="11719" LastEditorUserId="8140" LastEditDate="2014-11-13T17:34:08.710" LastActivityDate="2014-11-14T21:48:39.247" Title="&quot;Perfect waveform&quot; for cross-correlations?" Tags="|signal-analysis|continuous-signals|signal-detection|cross-correlation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19133" PostTypeId="2" ParentId="19132" CreationDate="2014-11-13T16:26:25.757" Score="2" Body="&lt;p&gt;In general, the resolution of the cross correlation is proportional to the bandwidth of the signal. This is way pseudo-random signals are common for that purpose.&lt;br&gt;&#xA;So if you are looking for a signal that will produce sharp and distinct cross-correlation, you should use such signals.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you are looking to improve the time-delay estimation for a given signal, you should pre-filter the signal with high-pass filter as the lower frequencies tend to produce more smooth cross correlation.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-11-13T16:26:25.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19134" PostTypeId="2" ParentId="69" CreationDate="2014-11-13T16:53:21.767" Score="3" Body="&lt;p&gt;the physics relevance of fourier transform is that it tells the relative amplitude of frequencies present in the signal . it can be defined for both discrete time and continuous  time signal.&#xA;Any signal can be represented as mixture of many harmonic frequencies. Fourier transform help in filter applications , where we need only certain range of frequencies then we first need to know what are the amplitudes of frequencies contains in the signal.&lt;/p&gt;&#xA;" OwnerUserId="11720" LastActivityDate="2014-11-13T16:53:21.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19136" PostTypeId="2" ParentId="18915" CreationDate="2014-11-13T20:08:19.637" Score="1" Body="&lt;p&gt;I suggest you check out &quot;Digital Image Processing using MATLAB, Gonzalez, Rafael C&quot;  if you're going to study image processing, MATLAB could be best choice. otherwise you can use &quot;A Concise Introduction to Image Processing using C++&quot;.&lt;/p&gt;&#xA;" OwnerUserId="11688" LastEditorUserId="7092" LastEditDate="2014-11-13T21:24:31.410" LastActivityDate="2014-11-13T21:24:31.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19140" PostTypeId="1" CreationDate="2014-11-14T12:30:56.997" Score="1" ViewCount="3654" Body="&lt;p&gt;I'm looking everywhere for solutions for audio downsampling. However for one reason or another they are incomplete, sometimes buggy, and sometimes are in a programming language I cannot understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here's my use case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an array containing two channels (left-right, it is a microphone) with Float32 data that gets interleaved and then converted to PCM like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function interleave(left, right) {&#xA;    var length = left.length + right.length;&#xA;    var result = new Float32Array(length);&#xA;    var _index = 0;&#xA;    for(var index = 0; index &amp;lt; length;) {&#xA;        result[index++] = left[_index];&#xA;        result[index++] = right[_index];&#xA;        _index++;&#xA;    }&#xA;    return result;&#xA;}&#xA;&#xA;function convertToPCM(raw) {&#xA;    var output = new Buffer(raw.length*2);&#xA;    for (var i = 0, offset = 0; i &amp;lt; raw.length; i++, offset += 2){&#xA;        var s = Math.max(-1, Math.min(1, raw[i]));&#xA;        output.writeInt16LE(s &amp;lt; 0 ? s*0x8000 : s*0x7FFF, offset);&#xA;    }&#xA;    return output;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is NodeJS\Javascript, but I think it's pretty clear how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here's the issue. The output of these function needs to generate a WAV file downsampled to 22000 or 16000, but the source has a sample rate of 44100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please highlight what algorithm should I use in order to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="11728" LastActivityDate="2014-11-14T19:57:19.380" Title="Downsampling PCM Audio" Tags="|downsampling|wave|floating-point|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19141" PostTypeId="1" CreationDate="2014-11-14T12:45:55.853" Score="1" ViewCount="1699" Body="&lt;p&gt;i have been segmented some image of retina. but the result is not good as i hope. for one image i can get good segmentation, like this image&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fcMep.jpg&quot; alt=&quot;image with good segmentation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KqrGC.jpg&quot; alt=&quot;image with bad segmentation&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my code is from some reference in internet, in below i will write my code and this code is start when i have got a filtered image (mean filtering) .&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;prewitthor = [-1 0 1; -1 0 1; -1 0 1]; &#xA;prewittver = [-1 -1 -1; 0 0 0; 1 1 1]; &#xA;Ix = imfilter(double(imgMeanfilter),prewitthor,'replicate'); &#xA;Iy = imfilter(double(imgMeanfilter),prewittver,'replicate');&#xA;J = sqrt((Ix.^2)+(Iy.^2)); &#xA;g = J - min(J(:));&#xA;g = g / max(g(:));&#xA;&#xA;th = graythresh(g); %# Otsu's method.&#xA;a = imhmax(g,th/2); %# Conservatively remove local maxima.&#xA;th = graythresh(a);&#xA;b = a &amp;gt; th/4; %# Conservative global threshold.&#xA;c = imclose(b,ones(3)); %# Try to close contours.&#xA;d = imfill(c,'holes'); %# Not a bad segmentation by itself.&#xA;%# Use the rough segmentation to define markers.&#xA;%  g2 = imimposemin(g, ~ imdilate( bwperim(a), ones(3) ));&#xA;L = watershed(c);&#xA;boundaries = L == 0;&#xA;redChanel(boundaries) = 255;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11729" LastEditorUserId="7092" LastEditDate="2014-11-14T13:29:44.267" LastActivityDate="2017-07-22T11:02:41.647" Title="how to get segmented OPTIC DISC from retinal image?" Tags="|image-processing|image-segmentation|segmentation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19144" PostTypeId="1" AcceptedAnswerId="19145" CreationDate="2014-11-14T13:28:39.207" Score="0" ViewCount="290" Body="&lt;p&gt;When the frequency domain's independent variable is labeled as a fraction of the sampling rate, the values along the horizontal axis always run between $0$ and $0.5$, since discrete data can only contain frequencies between DC ($0$) and half the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But why is the highest frequency pegged at exactly $0.5$ of the sampling rate? Isn't it possible to have a scenario where the highest frequency is less than half the sampling rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g., consider a speech signal that has been filtered to remove all frequencies above $3.3$ kHz and has been sampled at $10$ kHz. The highest frequency ($3.3$ kHz) is less than $0.5$ of the sampling rate ($5$ kHz). How would the frequency domain of this signal (labeled as a fraction of the sampling rate) look like?&lt;/p&gt;&#xA;" OwnerUserId="11730" LastEditorUserId="7092" LastEditDate="2014-11-14T15:26:38.770" LastActivityDate="2014-11-14T15:26:38.770" Title="DFT independent variable as fraction of sampling rate" Tags="|discrete-signals|dft|sampling|theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19145" PostTypeId="2" ParentId="19144" CreationDate="2014-11-14T13:48:45.790" Score="1" Body="&lt;p&gt;The DFT calculates spectral components up to $f_\mathrm{s}/2$, no matter what the input signal is. If the input signal to the DFT contains (absolutely) no spectral components between $0.33 f_\mathrm{s}$ and $0.5 f_\mathrm{s}$ the corresponding DFT outputs are zero (assuming that there is no &lt;a href=&quot;https://dsp.stackexchange.com/questions/10120/why-does-spectral-leakage-arise-in-an-fft&quot;&gt;spectral leakage&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2014-11-14T13:48:45.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19147" PostTypeId="2" ParentId="19140" CreationDate="2014-11-14T15:09:22.333" Score="1" Body="&lt;p&gt;Breaking down the conversion into an upsampling and a downsampling step as explained in mbaz's answer is not necessary - &lt;a href=&quot;https://ccrma.stanford.edu/~jos/resample/&quot; rel=&quot;nofollow&quot;&gt;band-limited interpolation&lt;/a&gt; achieves the same result in one single process, for any conversion ratio, and its quality is easy to fine-tune (through various approximations of the band-limited pulse).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mega-nerd.com/SRC/&quot; rel=&quot;nofollow&quot;&gt;libsamplerate&lt;/a&gt; is an example of open-source implementation that does not rely on upsampling/downsampling. It should be possible to bind it to NodeJS through an &lt;a href=&quot;http://nodejs.org/api/addons.html&quot; rel=&quot;nofollow&quot;&gt;add-on&lt;/a&gt;, or even to rewrite it in javascript - once stripped of the code handling corner cases (variable rate, compensation of processing delay), the code fits in a 50-line loop.&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-11-14T19:57:19.380" LastActivityDate="2014-11-14T19:57:19.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19148" PostTypeId="1" CreationDate="2014-11-14T16:53:12.047" Score="4" ViewCount="4048" Body="&lt;p&gt;For the analog S-plane, the Q factor depends on the angle of the complex pole $p$ from the horizontal axis, $\theta = \arg p$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/11fzI.gif&quot; alt=&quot;pole position and angle&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;damping factor $\zeta = \frac{1}{2Q}$, and $\zeta = \cos(\theta)$, and $\theta = \arg(p)$ so $Q = \frac{1}{2 \cos(\theta)}= \frac{1}{2 \cos(\arg(p))}$  Right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the Z plane, the curves of constant Q are more complicated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qcwyA.png&quot; alt=&quot;curves of constant Q and resonant frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do you get the Q of a complex pole?  To transform an analog pole to the Z plane, you use $z = e^{sT}$?  But when I try to apply this I must be doing something wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, maybe I got it.  Maxima was making assumptions about the pole location being real?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Q=-\frac{\sqrt{{\log(|p|)}^2+{\arg(p)}^2}}{2\log(|p|) }$$&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2014-11-14T17:23:34.783" LastActivityDate="2021-11-28T00:50:45.557" Title="What's the Q factor of a digital filter's pole?" Tags="|filter-design|poles-zeros|damping|digital-filters|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19149" PostTypeId="1" CreationDate="2014-11-14T17:10:59.443" Score="1" ViewCount="25268" Body="&lt;p&gt;I have seen some devices which specify their internal noise in RMS or Peak-to-peak value. How does one calculate RMS or p2p values for white noise?&lt;/p&gt;&#xA;" OwnerUserId="8136" LastActivityDate="2014-12-03T09:10:25.717" Title="How is RMS and Peak-to-peak of white noise calculated" Tags="|noise|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19150" PostTypeId="1" AcceptedAnswerId="24050" CreationDate="2014-11-14T17:17:07.983" Score="1" ViewCount="1918" Body="&lt;p&gt;Is there a way to decompose IIR filter into set of poly phase components, that are All pass. E.g. a an IIR filter  of order M, can be decomposed into a cascade of All zero filter of order 2*M( which can be implemented as polyphase) and all pole of same order( as Direct form), by rationalizing the Denominator. But, I have not been able to find a way to do it directly as sum of all pass polyphase components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help?&lt;/p&gt;&#xA;" OwnerUserId="11096" LastActivityDate="2015-06-12T09:00:26.457" Title="Polyphase decomposition of IIR filter" Tags="|infinite-impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19151" PostTypeId="2" ParentId="19148" CreationDate="2014-11-14T18:19:25.353" Score="4" Body="&lt;p&gt;it depends on how you map the analog filter to the digital filter and how the s-plane poles get mapped to the z-plane poles (ya know, the &amp;quot;bilinear transform&amp;quot; vs. &amp;quot;impulse invariant&amp;quot; vs. whatever else is out there).&lt;/p&gt;&#xA;&lt;p&gt;probably, if it were up to me, for the purpose of defining &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, i would map the poles as you would map &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ z = e^{sT} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$T \triangleq \frac{1}{f_\text{s}}$&lt;/span&gt; is the sampling period and &lt;span class=&quot;math-container&quot;&gt;$f_\text{s}$&lt;/span&gt; is the sample rate.  that would be assuming &lt;em&gt;impulse invariant&lt;/em&gt;.  the damping rate of the digital filter would be the same as the analog filter because both have the same exponential impulse responses (it's just that the digital filter's impulse response is the sampled analog impulse response).&lt;/p&gt;&#xA;&lt;p&gt;for &lt;em&gt;bilinear transform&lt;/em&gt; the &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; mapping is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ z = \frac{1 + sT/2}{1 - sT/2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;if you're using &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; to define the degree of resonance (like the dB boost you get around the resonant frequency, whether the filter is LPF, BPF or HPF), then this mapping will preserve the height of that bump for a given &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;i dunno if another mapping would be useful for this definition of digital Q.  in the &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audio EQ Cookbook&lt;/a&gt;, i worried a little about mapping BPF bandwidth from s-plane to z-plane and tossed in a fudge factor because bilinear transform sorta scrunches the bandwidth as the resonant frequency gets closer to Nyquist, &lt;span class=&quot;math-container&quot;&gt;$f_\text{s}/2$&lt;/span&gt;.  if preservation of bandwidth, as you map from s-plane to z-plane, is important to you, then i would take a look at that.&lt;/p&gt;&#xA;&lt;p&gt;so, given the s-plane pole location (which is a function of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;), map it to the z-plane and you'll get an expression for &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; based on the real and imaginary parts (or magnitude and angle) of the z-plane poles.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2021-11-28T00:50:45.557" LastActivityDate="2021-11-28T00:50:45.557" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="19152" PostTypeId="2" ParentId="19149" CreationDate="2014-11-14T20:03:36.457" Score="4" Body="&lt;p&gt;three things to think about:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;white&quot; describes the power spectrum, but to know the peak values, you need to know the probability density function (p.d.f.) of the noise process.  often, with &quot;white noise&quot;, we are assuming &quot;normal&quot; or &quot;gaussian&quot; p.d.f.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;even for a finite power (which means a finite variance for the p.d.f.), a gaussian random variable has infinite peak value (just that it hits whatever arbitrary high value with decreasing probability).  so for gaussian, you need to define like a &quot;1% likelihood peak value&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;true white noise (which does not exist in reality) has &lt;strong&gt;infinite&lt;/strong&gt; power and infinite variance.  this is because true white noise has infinite bandwidth.  so, in reality, we deal with bandlimited &quot;white&quot; noise, so the bandwidth might be a necessary parameter to know, before you can think about its r.m.s. (which is the square root of the variance, assuming no DC component) and peak.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-11-14T20:03:36.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19153" PostTypeId="1" CreationDate="2014-11-14T21:02:10.407" Score="1" ViewCount="57" Body="&lt;p&gt;Essentially I'm looking for an explanation how the second image results from a capture of the original. Possibly you've seen something like this before and you can tell just from looking at the result what's going on.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The original image: &lt;a href=&quot;https://i.stack.imgur.com/GBJ6P.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/GBJ6P.jpg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;The output image: &lt;a href=&quot;https://i.stack.imgur.com/uh89O.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/uh89O.jpg&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here's the capture process &lt;strong&gt;using Android 4.0.4&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Display original image on LCD monitor.&lt;/li&gt;&#xA;&lt;li&gt;Set rear-facing camera on an LG VS840PP with parameter &lt;code&gt;picture-size=3072x1728&lt;/code&gt;. Although this is listed as a setting in &lt;code&gt;picture-size-values&lt;/code&gt;, it may not be completely valid. The other settings (e.g. 2560x1920) are 4:3 and produce typical images. &lt;code&gt;picture-format&lt;/code&gt; remains set to &lt;code&gt;jpeg&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Point camera at original image on monitor.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;takePicture()&lt;/code&gt; via jpeg callback.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The resulting intermediate image, i.imgur.com/qw688u8.jpg (3072x1728), is resampled to produce the output image (2592x2048) using the Python Imaging Library code below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import Image&#xA;inm = Image.open(&quot;pattern-in.jpg&quot;, &quot;r&quot;)&#xA;pixels = inm.getdata()&#xA;&#xA;width = 2592&#xA;height = len(pixels) / width&#xA;outm = Image.new( &quot;RGB&quot;, (width, height), (128,128,128) )&#xA;&#xA;outm.putdata(pixels)&#xA;outm.save(&quot;out.jpg&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am not interested in getting the camera to work &quot;properly&quot;. I'm more curious to understand just what's going on. I'm including another set of images taken of only black with the lens obscured.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;camera output: i.imgur.com/BygbqKF.jpg&lt;/li&gt;&#xA;&lt;li&gt;after resampling: i.imgur.com/uWjNXxZ.jpg&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also here is the EXIF data provided by the camera for the color bar photo:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ExifTool Version Number         : 9.70&#xA;File Name                       : pattern-in.jpg&#xA;Directory                       : .&#xA;File Size                       : 3.1 MB&#xA;File Modification Date/Time     : 2014:11:11 16:09:16-08:00&#xA;File Access Date/Time           : 2014:11:11 16:10:43-08:00&#xA;File Creation Date/Time         : 2014:11:11 16:10:43-08:00&#xA;File Permissions                : rw-rw-rw-&#xA;File Type                       : JPEG&#xA;MIME Type                       : image/jpeg&#xA;Exif Byte Order                 : Big-endian (Motorola, MM)&#xA;Make                            : LG Electronics&#xA;Camera Model Name               : VS840PP&#xA;X Resolution                    : 72&#xA;Y Resolution                    : 72&#xA;Resolution Unit                 : inches&#xA;Y Cb Cr Positioning             : Centered&#xA;Exposure Time                   : 1/30&#xA;F Number                        : 2.4&#xA;ISO                             : 654&#xA;Exif Version                    : 0220&#xA;Date/Time Original              : 2002:12:08 12:00:00&#xA;Create Date                     : 2002:12:08 12:00:00&#xA;Components Configuration        : Y, Cb, Cr, -&#xA;Exposure Compensation           : 0&#xA;Flash                           : No Flash&#xA;Focal Length                    : 4.3 mm&#xA;Flashpix Version                : 0100&#xA;Color Space                     : sRGB&#xA;Exif Image Width                : 3072&#xA;Exif Image Height               : 1728&#xA;Interoperability Index          : R98 - DCF basic file (sRGB)&#xA;Interoperability Version        : 0100&#xA;Compression                     : JPEG (old-style)&#xA;Thumbnail Offset                : 550&#xA;Thumbnail Length                : 35981&#xA;Image Width                     : 3072&#xA;Image Height                    : 1728&#xA;Encoding Process                : Baseline DCT, Huffman coding&#xA;Bits Per Sample                 : 8&#xA;Color Components                : 3&#xA;Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)&#xA;Aperture                        : 2.4&#xA;Image Size                      : 3072x1728&#xA;Shutter Speed                   : 1/30&#xA;Thumbnail Image                 : (Binary data 35981 bytes, use -b option to extract)&#xA;Focal Length                    : 4.3 mm&#xA;Light Value                     : 4.7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks very much!&lt;/p&gt;&#xA;" OwnerUserId="11733" LastActivityDate="2014-11-14T21:02:10.407" Title="Looking to understand line artifacts in &quot;overscanned&quot; image" Tags="|image-processing|camera|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19154" PostTypeId="2" ParentId="19132" CreationDate="2014-11-14T21:48:39.247" Score="0" Body="&lt;p&gt;Finally, I found the answer I was looking for! A whole host of sequences have been analyzed and discussed in terms of their auto- and cross-correlation properties in the following thesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.openarchive.univpm.it/jspui/bitstream/123456789/472/1/Tesi.Andrenacci.pdf&quot; rel=&quot;nofollow&quot;&gt;De Bruijn Sequences in Spread Spectrum Systems: Problems and Performance in Vehicular Applications by Stefano Andrenacci&lt;/a&gt; &#xA;(&lt;a href=&quot;http://www.openarchive.univpm.it/jspui/bitstream/123456789/472/1/Tesi.Andrenacci.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.openarchive.univpm.it/jspui/bitstream/123456789/472/1/Tesi.Andrenacci.pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the possible candidates. I will have to research them further, but I will surely go with one of these:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M-Sequences&#xA;Gold Sequences&#xA;Chaos-Based Sequences&#xA;Kasami Sequences&#xA;OVSF Sequences&#xA;De Bruijn Sequences&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The author advocates De Bruijn Sequences, but I believe my case is mmost suited towards an M-Sequence.&lt;/p&gt;&#xA;" OwnerUserId="11719" LastActivityDate="2014-11-14T21:48:39.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19156" PostTypeId="1" CreationDate="2014-11-14T23:07:08.493" Score="1" ViewCount="90" Body="&lt;p&gt;I had this question in the exam without any further explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the time translation invariance is an important feature for time-frequency distributions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am writing to ask whether anyone can please explain what is time translation invariance? And why is it important feature?&lt;/p&gt;&#xA;" OwnerUserId="11654" LastActivityDate="2014-11-14T23:07:08.493" Title="Time-frequency analysis" Tags="|time-frequency|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19159" PostTypeId="1" AcceptedAnswerId="19162" CreationDate="2014-11-15T06:31:09.977" Score="6" ViewCount="16239" Body="&lt;p&gt;When attempting to spot activities on an EEG waveform given a stimuli, it is recommended that several trials be taken and their average is done to increase the SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, since noise is not stationary or localized, averaging different trials will have a smearing effect on the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how exactly does it increase the SNR since the noise is still present (but averaged out)? Can we more rigorously define the effect of averaging on the SNR?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2014-11-19T14:29:58.407" Title="How does averaging increase the Signal to Noise ratio?" Tags="|noise|eeg|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19162" PostTypeId="2" ParentId="19159" CreationDate="2014-11-15T12:35:34.430" Score="8" Body="&lt;p&gt;Intuitively this is true, because averaging a zero mean noise processes approximates its expectation value - which is zero. More rigorously:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal $x$ that you want to observe (estimate, actually) is constant for all observations $y$ we can write the $n\text{th}$ observation as&#xA;$$&#xA;y_n = x + r_n&#xA;$$&#xA;where $r_n$ is the noise which is different for every observation, of course. The SNR $\gamma_1$ of $y_n$ is&#xA;$$&#xA;\gamma_1=\frac{\operatorname{E}[|x|^2]}{\operatorname{E}[|r_n|^2]} &#xA;$$&#xA;where $\operatorname{E}$ is the expectation operator. By averaging $N$ observations of $y_n$ we get&#xA;$$&#xA;\hat x = \frac{1}{N}\sum_{n=1}^N( x+r_n) = x + \frac{1}{N}\sum_{n=1}^N r_n&#xA;$$&#xA;The SNR $\gamma_2$ of the averaged observations is&#xA;$$&#xA;\gamma_2=\frac{\operatorname{E}[|x|^2]}{\frac{1}{N^2}\operatorname{E}[|\sum_{n=1}^N r_n|^2]} &#xA;$$&#xA;To simplify that expression, we assume that the noise sequences $r_n$ are uncorrelated &lt;sup&gt;(1)&lt;/sup&gt;. In that case, the expectation of the squared sum of $r_n$ is equal to the sum of the expectations of the squared $r_n$, i.e.&#xA;$$&#xA;\operatorname{E}\left[|\sum_{n=1}^N r_n|^2\right] = \sum_{n=1}^N \operatorname{E}\left[|r_n|^2\right]=N\operatorname{E}\left[|r_n|^2\right]&#xA;$$&#xA;Inserting this in the expression for $\gamma_2$ yields&#xA;$$&#xA;\gamma_2=N \frac{\operatorname{E}[|x|^2]}{\operatorname{E}[|r_n|^2]}&#xA;$$&#xA;Comparing the SNR $\gamma_1$ of the single observation and the SNR $\gamma_2$ of the averaged observation we see that averaging increases the SNR by a factor of $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;(1)&lt;/sup&gt; This holds for a Gaussian noise process, for example. Right now I'm not sure for what classes of stochastic processes it holds. Comments on this are welcome.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-11-15T12:48:12.477" LastActivityDate="2014-11-15T12:48:12.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19163" PostTypeId="2" ParentId="19159" CreationDate="2014-11-15T14:53:37.287" Score="4" Body="&lt;p&gt;averaging only increases S/N if the &quot;S&quot; component of the items being averaged is correlated and the &quot;N&quot; component is not correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when adding perfectly correlated values, then the overall &lt;strong&gt;&quot;voltage&quot;&lt;/strong&gt; metrics are added and the values team up.  so adding the same thing to itself $N$ times increases that value by a factor of $N$ and the power (the mean square) increases by a factor of $N^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when you add $N$ totally &lt;em&gt;un&lt;/em&gt;correlated values together, the overall power metric adds to $N$ times bigger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;signal power goes up by $N^2$, noise power goes up by $N$, so the signal power to noise power ratio goes up by $\frac{N^2}{N} = N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in order to make this work, you must somehow synchronize your signal values so that they really do &quot;team up&quot;.  if you don't do that, your averaging won't help.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-11-15T15:20:51.187" LastActivityDate="2014-11-15T15:20:51.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19164" PostTypeId="1" CreationDate="2014-11-15T16:19:04.173" Score="0" ViewCount="22" Body="&lt;p&gt;A channel has a bandwith of 5MHz. If signal strength to spectral noise density S/N&lt;sub&gt;0&lt;/sub&gt; is 10&lt;sup&gt;7&lt;/sup&gt; Hz, calculate the channel capacity C and R. The problem&#xA;is that I can use Shannon-Hartley theorem because instead of S/N or SNR I have&#xA;S/N&lt;sub&gt;0&lt;/sub&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11738" LastActivityDate="2014-11-15T16:19:04.173" Title="Suppose we have the following data. How can we calculate the channel capacity and R?" Tags="|signal-analysis|frequency-spectrum|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19165" PostTypeId="1" AcceptedAnswerId="19172" CreationDate="2014-11-15T16:28:35.333" Score="0" ViewCount="2818" Body="&lt;p&gt;I'm trying to show that $y[n]=x[n]*h[n]$  turns into $Y(z) = X(z)H(z)$ in Z-domain by first applying convolution then by taking the inverse Z-transform of the $Y(z)$, stating that it's the same sequence after all. However, in power series expansion an extra term appears which kills the equation. You can find the question below; I added it as an image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd be grateful if you could help.&#xA;Thank you &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/H9tU5.jpg&quot; alt=&quot;The Question&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11469" LastEditorUserId="1606" LastEditDate="2014-11-15T17:48:57.703" LastActivityDate="2014-11-16T10:31:54.220" Title="How to show that y[n] = x[n] * h[n] turns into the Y(z) = X(z).H(z)?" Tags="|discrete-signals|convolution|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19166" PostTypeId="1" CreationDate="2014-11-15T18:05:26.793" Score="1" ViewCount="50" Body="&lt;p&gt;For instance, I believe we cannot detect global phase shifts.  And of course frequencies above ~20kHz or below ~20Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've heard of &quot;frequency masking&quot;, but don't know much about it and would appreciate a brief explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else is there?  &lt;/p&gt;&#xA;" OwnerUserId="11739" LastActivityDate="2014-11-15T18:05:26.793" Title="What are the known ways of changing an audio signal that are not audible to humans?" Tags="|audio|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19167" PostTypeId="2" ParentId="19148" CreationDate="2014-11-15T18:40:52.757" Score="1" Body="&lt;p&gt;okay, endolith, i will try to answer your question more specifically.  i will do this for a simple LPF analog prototype and first for the Impulse Invariant mapping of the s-plane LPF to the z-plane LPF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2nd-order Analog prototype:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalized resonant frequency:  $ \quad H(s) = \frac{1}{s^2 + \frac{1}{Q}s + 1} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;General resonant frequency of $\omega_0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;H(s) &amp;amp; = \frac{1}{\left(\frac{s}{\omega_0}\right)^{\ 2} + \frac{1}{Q}\left(\frac{s}{\omega_0}\right) + 1}  \\&#xA;&amp;amp; = \frac{\omega_0^2}{s^2 + \frac{\omega_0}{Q}s + \omega_0^2}  \\&#xA;&amp;amp; = \frac{\omega_0^2}{\left(s + \frac{\omega_0}{2Q} \right)^{2} + \omega_0^2\left(1 - \frac{1}{4Q^2} \right)}  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assuming that $Q &amp;gt; \frac{1}{2}$, we have complex conjugate poles&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s_\text{p} = \omega_0 \left(-\frac{1}{2Q} \pm j\sqrt{1-\frac{1}{4Q^2}} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |s_\text{p}| = \omega_0 $$&#xA;$$ \operatorname{Re}\{ s_\text{p} \} = -\frac{\omega_0}{2Q} &amp;lt; 0 $$&#xA;and&#xA;$$ Q = -\frac{|s_\text{p}|}{2 \operatorname{Re}\{ s_\text{p} \} } &amp;gt; \frac{1}{2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is how the analog poles are related to $Q$, at least for the case that they are complex conjugate and $Q&amp;gt;\frac{1}{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the impulse response for this continuous-time filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h(t) = \frac{\omega_0}{\sqrt{1-\frac{1}{4Q^2}}} e^{-\frac{\omega_0}{2Q}t} \sin\left(\sqrt{1-\frac{1}{4Q^2}} \omega_0 t \right) u(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u(t)$ is the unit step function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u(t) =&#xA;\begin{cases}&#xA;1, &amp;amp; \text{if }t&amp;gt;0 \\&#xA;0, &amp;amp; \text{if }t&amp;lt;0&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i am not worried about $u(0)$.)  so, even though we're calling the &quot;resonant frequency&quot; to be $\omega_0$, the impulse response &quot;rings&quot; at a frequency that is $\sqrt{1-\frac{1}{4Q^2}} \omega_0$.  as $Q \gg 1$, there is not much difference between the &quot;resonant frequency&quot; and the &quot;ringing frequency&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is &quot;Installment #1&quot;.  more to come.  please don't down arrow until i'm done.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-11-16T00:51:33.107" LastActivityDate="2014-11-16T00:51:33.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19168" PostTypeId="1" CreationDate="2014-11-15T18:50:45.180" Score="3" ViewCount="376" Body="&lt;p&gt;In circuit analysis, I understand the use of Laplace Transforms to obtain the impedance of a linear RLC circuit, ie transforming from the time domain to the frequency domain. In most texts I have seen and classes I have taken, the Bode plot looks at the rational transfer function of $H(j\omega)$, which is effectively the Fourier Transform, and not $H(s)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $\omega$ is considered to be the variable that represents frequency, what is $\sigma$ if $s = \sigma + j\omega$? Does $\sigma$ have a physical interpretation?&lt;/p&gt;&#xA;" OwnerUserId="11102" LastActivityDate="2020-02-04T11:27:49.803" Title="Regarding Bode plots; $H(s)$ and $H(j\omega)$" Tags="|fourier-transform|signal-analysis|fourier|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19169" PostTypeId="2" ParentId="19148" CreationDate="2014-11-15T19:26:15.740" Score="2" Body="&lt;p&gt;Installment #2: Digital filter mapped from analog using the Impulse Invariant mapping:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define $f_\text{s} = \frac{1}{T}$ as the sample rate and $T$ as the sampling period.  Impulse Invariant says to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h[n] \triangleq T \cdot h(nT) = \frac{\omega_0 T}{\sqrt{1-\frac{1}{4Q^2}}} e^{-\frac{\omega_0 T}{2Q} n} \sin\left(\sqrt{1-\frac{1}{4Q^2}} \omega_0 T n \right) u[n] $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u[n] \triangleq&#xA;\begin{cases}&#xA;0, &amp;amp; \text{if }n&amp;lt;0 \\&#xA;1, &amp;amp; \text{if }n\ge0&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;again, i am not particularly worried about $u[0]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the z-plane transfer function is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = \frac{e^{-\frac{\omega_0 T}{2Q}} \sin\left(\sqrt{1-\frac{1}{4Q^2}} \omega_0 T \right) \ z}{z^2 - 2e^{-\frac{\omega_0 T}{2Q}} \cos\left(\sqrt{1-\frac{1}{4Q^2}} \omega_0 T \right) z + e^{-\frac{\omega_0 T}{Q}}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so here, you can see that there is a zero at the origin (big deel) and show that the poles are at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ z_\text{p} = e^{-\frac{\omega_0 T}{2Q} \pm j \sqrt{1-\frac{1}{4Q^2}} \omega_0 T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |z_\text{p}| = e^{-\frac{\omega_0 T}{2Q}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \arg \{z_\text{p} \} = \pm \sqrt{1-\frac{1}{4Q^2}} \omega_0 T $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you might note that the z-plane poles are related to the s-plane poles as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ z_\text{p} =  e^{s_\text{p}T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see that the $Q$ is related to the distance that the poles are from the origin, but that distance is not constant.  with $Q$ constant, it changes with $\omega_0$ changing.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-11-16T00:56:25.623" LastActivityDate="2014-11-16T00:56:25.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19170" PostTypeId="2" ParentId="19148" CreationDate="2014-11-15T21:56:31.320" Score="2" Body="&lt;p&gt;Installment #3: Bilinear Transform.&lt;/p&gt;&#xA;&lt;p&gt;recall the analog LPF transfer function is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_\text{A}(s) = \frac{\omega_0^2}{s^2 + \frac{\omega_0}{Q}s + \omega_0^2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(note the &lt;span class=&quot;math-container&quot;&gt;$_\text{A}$&lt;/span&gt; subscript to keep confusion at a minimum.)  initially, the bilinear transform says to do this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ z = e^{sT} = \frac{e^{sT/2}}{e^{-sT/2}} \approx \frac{1+sT/2}{1-sT/2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;solving for &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ s = \frac{1}{T} \log(z) \approx \frac{2}{T}\frac{z-1}{z+1} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H(z) \triangleq H_\text{A}(s) \Bigg|_{s=\frac{2}{T}\frac{z-1}{z+1}} = H_\text{A}\left(\frac{2}{T}\frac{z-1}{z+1} \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but, upon examination, we have learned of this consequence called &amp;quot;frequency warping&amp;quot; and so we fudge this a little so that the resonant frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; is &amp;quot;pre-warped&amp;quot; and compensated to put it exactly where we were expecting.  the resulting fudge factor is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \omega_0 \leftarrow \frac{2}{T} \tan\left(\frac{\omega_0 T}{2} \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;this results in the following net substitution:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H(z) \triangleq H_\text{A}(s) \Bigg|_{s=\frac{\omega_0}{\tan(\omega_0 T/2 )}\frac{z-1}{z+1}} = H_\text{A}\left( \frac{\omega_0}{\tan(\omega_0 T/2 )}\frac{z-1}{z+1} \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;this is essentially what is done in the &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audio EQ Cookbook&lt;/a&gt;.  for the LPF, this results in the following z-plane transfer function&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H(z) = \frac{1-\cos(\omega_0 T)}{2(1+\alpha)} \frac{z^2 + 2z + 1}{z^2 - 2 \frac{\cos(\omega_0 T)}{1+\alpha} z + \frac{1-\alpha}{1+\alpha}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\alpha \triangleq \frac{\sin(\omega_0 T)}{2Q}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;this also just comes from the Cookbook.&lt;/p&gt;&#xA;&lt;p&gt;so here, there are two z-plane zeros at &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt; (we expect this with bilinear transform of a LPF) and the z-plane poles (assuming that they're complex conjugate) are at:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;z_\text{p} &amp;amp; = \frac{\cos(\omega_0 T)}{1+\alpha} \pm j \sqrt{\frac{1-\alpha}{1+\alpha} - \left( \frac{\cos(\omega_0 T)}{1+\alpha} \right)^2} \\&#xA;&amp;amp; = \frac{2Q}{2Q + \sin(\omega_0 T)}\left(\cos(\omega_0 T) \pm j \sin(\omega_0 T) \sqrt{1-\frac{1}{4 Q^2}} \right) \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |z_\text{p}| = \sqrt{\frac{1-\alpha}{1+\alpha}} = \sqrt{\frac{2Q - \sin(\omega_0 T)}{2Q + \sin(\omega_0 T)}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \arg\{z_\text{p} \} = \pm \arctan\left(\sqrt{1-\frac{1}{4 Q^2}} \tan(\omega_0 T) \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;this is &lt;strong&gt;different&lt;/strong&gt; from the Impulse Invariant case, but if &lt;span class=&quot;math-container&quot;&gt;$\omega_0 \ll \frac{1}{T}$&lt;/span&gt;, then i think they get to be about the same.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2021-11-27T23:10:57.183" LastActivityDate="2021-11-27T23:10:57.183" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19171" PostTypeId="1" CreationDate="2014-11-16T03:27:32.070" Score="1" ViewCount="199" Body="&lt;p&gt;The Welch lower bound on the maximum cross-correlation (inner product) of $m$ vectors, each of $n$ elements, is given by $c_{max} = f(m, n, k)$ (eg, see Wikipedia &lt;em&gt;Welch bounds&lt;/em&gt;). It is always assumed that $m \gt n$ (otherwise the bound is 0).  Apparently the Welch bound has been widely applied in the restricted case that the vectors are real-valued and $k = 1.\;$ In that case, $c_{max} = \left[ (m-n)/(n(m-1)) \right]^{1/2},\;$ and is always real. The function has practical use in allowing us to compare the $c_{max}\;$ calculated from any given set of vectors with the theoretical minimum possible value.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, when $k &amp;gt; 1,\;$ then $c_{max}\;$ is frequently a complex quantity, even if the vectors are real-valued.  $\;c_{max}$ becomes real only if $m &amp;gt;&amp;gt; n\;,$ or more specifically, when $m \gt \binom{n+k-1}{k}.\;$&lt;br&gt;&#xA;It is unclear to me whether $c_{max}$ has any use when $k \gt 1.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad$ &lt;strong&gt;Q1:&lt;/strong&gt;  Does $k$ have any physical interpretation?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\quad$ &lt;strong&gt;Q2:&lt;/strong&gt;  Is the Welch formula with $k \gt 1\;$ useful in any area of physics, computational science,&lt;br&gt;&#xA;$\quad\quad$ electrical engineering, or telecommunications? How do you interpret complex returned values?&lt;/p&gt;&#xA;" OwnerUserId="11741" LastActivityDate="2014-11-18T03:10:10.103" Title="What is the use of the Welch lower bound when k &gt; 1?" Tags="|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19172" PostTypeId="2" ParentId="19165" CreationDate="2014-11-16T10:31:54.220" Score="0" Body="&lt;p&gt;The correct sequence $y[n]$ is the one you obtained via the $\mathcal{Z}$-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac{1}{a-b}\left[a^{n+1}-b^{n+1}\right]u[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure where that $n+1$ term is coming from in your time-domain derivation, so I'll write out the convolution sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=-\infty}^{\infty}a^ku[k]b^{n-k}u[n-k]=u[n]\sum_{k=0}^{n}a^kb^{n-k}=u[n]b^n\sum_{k=0}^{n}\left(\frac{a}{b}\right)^k=\\=u[n]b^n\frac{1-\left(\frac{a}{b}\right)^{n+1}}{1-\frac{a}{b}}=u[n]b^{n+1}\frac{1-\left(\frac{a}{b}\right)^{n+1}}{b-a}=u[n]\frac{b^{n+1}-a^{n+1}}{b-a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which equals (1), as it should.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-16T10:31:54.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19174" PostTypeId="2" ParentId="19168" CreationDate="2014-11-16T11:25:25.663" Score="5" Body="&lt;p&gt;Note that each complex pole $s_{\infty}=\sigma + j\omega$ of the transfer function $H(s)$ contributes to the system's impulse response a complex exponential of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{s_{\infty}t}=e^{\sigma t}e^{j\omega t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term $e^{\sigma t}$ is real-valued and represents exponential damping (assuming that the system is causal and stable, i.e. $\sigma&amp;lt;0$), and the complex term $e^{j\omega t}$ represents an oscillation at frequency $\omega$. So $\sigma$ is a damping constant.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-16T20:43:56.713" LastActivityDate="2014-11-16T20:43:56.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19175" PostTypeId="1" CreationDate="2014-11-16T15:26:49.993" Score="3" ViewCount="5637" Body="&lt;p&gt;What would be the most significant difference when using either a sobel filter or a gaussian-derivative filter, apart from the obvious difference of the size of the 2 filters?&lt;/p&gt;&#xA;" OwnerUserId="11744" LastEditorUserId="7338" LastEditDate="2016-08-29T15:44:58.183" LastActivityDate="2016-08-29T15:46:14.263" Title="Sobel Vs Gaussian Derivative" Tags="|image-processing|filters|computer-vision|edge-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19176" PostTypeId="1" CreationDate="2014-11-16T18:47:14.023" Score="0" ViewCount="9359" Body="&lt;p&gt;Here is a question I have been trying to solve:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Estimate the &lt;em&gt;&quot;essential bandwidth&quot;&lt;/em&gt; of a rectangular pulse &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ g(t) = \operatorname{rect}\left(\frac{t}{T}\right), $$ with $T&amp;gt;0$, where this &quot;essential&quot; bandwidth contains 90% of the rectangular pulse energy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have so far is that the Fourier Transform of $\operatorname{rect}\left(\frac{t}{T}\right)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ G(f) = \mathcal{F}\{g(t)\} = \mathcal{F}\left\{ \operatorname{rect}\left(\frac{t}{T}\right) \right\} = T \operatorname{sinc}(fT) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $$\operatorname{rect}(u) \triangleq \begin{cases}&#xA;0 &amp;amp; \text{if } |u| &amp;gt; \frac{1}{2} \\&#xA;\frac{1}{2} &amp;amp; \text{if } |u| = \frac{1}{2} \\&#xA;1 &amp;amp; \text{if } |u| &amp;lt; \frac{1}{2} \\&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\operatorname{sinc}(u) \triangleq \begin{cases}&#xA;\frac{\sin(\pi u)}{\pi u} &amp;amp; \text{if } u \ne 0 \\&#xA;1 &amp;amp; \text{if } u = 0 \\&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(f) = \mathcal{F}\{x(t)\} \triangleq \int\limits_{-\infty}^{+\infty} x(t) \ e^{-i 2 \pi f t} \ dt $$&#xA;and&#xA;$$ x(t) = \int\limits_{-\infty}^{+\infty} X(f) \ e^{+i 2 \pi f t} \ df. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integrating $G(f)$ over $\pm \infty$ results in $1$. Also, integrating $|g(t)|^2$ over $\pm \infty$ results in $T$. This is about where I am lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated. &lt;/p&gt;&#xA;" OwnerUserId="11746" LastEditorUserId="11256" LastEditDate="2014-11-16T21:00:40.497" LastActivityDate="2014-11-17T11:08:30.143" Title="Essential Bandwidth of rect(t/T)" Tags="|fourier|bandwidth|analog|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19177" PostTypeId="2" ParentId="19176" CreationDate="2014-11-16T19:07:58.263" Score="0" Body="&lt;p&gt;You need to follow these steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Read up on &lt;a href=&quot;https://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's Theorem&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Find the correct Fourier Transform of $\operatorname{rect}(t)$ -- the one you give above doesn't seem right to me. &lt;em&gt;(note from r b-j, it's because of $\omega$ vs. $f$ in the Fourier Transform.  it wasn't &quot;wrong&quot;, but messy, so i changed it.)&lt;/em&gt; Also, I'd recommend working on &quot;ordinary frequency&quot; $f$ instead of angular frequency $\omega$.&lt;/li&gt;&#xA;&lt;li&gt;Find $E_g$, the energy of $g(t)$.&lt;/li&gt;&#xA;&lt;li&gt;Find the frequency $f_0$ such that the integral of the square of the magnitude of $G(f)$ on the interval from $-f_0$ to $f_0$ is equal to $0.9E_g$. Then, relying on Parserval, $f_0$ is your answer.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Intuitively, what is happening is this. Say you filter $g(t)$ with an ideal low-pass filter. Since the filter removes some frequency content from $g(t)$, then the energy of the filter's output is less than that of $g(t)$. You're trying to adjust the filter's cutoff frequency so that the output's energy is exactly 90% of the input's.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="4346" LastEditDate="2014-11-16T20:31:02.950" LastActivityDate="2014-11-16T20:31:02.950" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="19181" PostTypeId="1" CreationDate="2014-11-17T04:18:23.217" Score="1" ViewCount="193" Body="&lt;p&gt;I am new to signal processing and and having difficulty understanding how to implement an IIR filter.  The reference is athttp://www.dxatlas.com/rocky/Advanced.asp in the Band scope section.  It concerns applying an IIR filter to a power spectrum with this equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FilteredSpectrum[i] = FilteredSpectrum[i]*(1-gain) + NewSpectrum[i] * gain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that this is a classic 1st order IIR filter but to implement this, are you working data point by data point or are you using one complete spectra and then waiting for the next one (NewSpectrum) and calculating a whole new spectrum from the existing one and the new one that just came in?&#xA;I tried it this way, waiting to obtain the data for a whole spectrum, then waiting for the next one to come in and then doing the calculation. I then plot the resulting spectrum.  This then becomes the FilteredSpectrum while I wait for the next NewSpectrum.&#xA;Is this being done in the correct way?  I programmed this but saw no effect on the noise in the spectrum contrary to the article. &#xA;Can anyone tell me where I am going wrong?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7741" LastEditorUserId="4298" LastEditDate="2014-11-17T10:17:29.893" LastActivityDate="2014-12-17T10:50:53.343" Title="Help on implementing an IIR filter" Tags="|fft|frequency-spectrum|infinite-impulse-response|software-defined-radio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19183" PostTypeId="1" AcceptedAnswerId="19282" CreationDate="2014-11-17T07:21:20.933" Score="1" ViewCount="2346" Body="&lt;p&gt;I am working with a 30-state, 14-input linear model that is described by a state-space model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;model_state_space = ss(A, B, C, D);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The model is extremely slow (it describes the thermal behavior of a building), so when I discretize it I choose a sample time of 900 seconds and plot the step response from one of the inputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,t] = step(model_state_space);&#xA;plot(t, y(:,:,end))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TBaw0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I obtain a similar plot when I compute the step response of the discretized state-space model, or of the equivalent transfer function continuous model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hold on&#xA;[y,t] = step(c2d(model_state_space, 900));&#xA;plot(t,y(:,:,end), 'r')&#xA;[y,t] = step(tf(model_state_space));&#xA;plot(t,y(:,:,end), 'k')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P1nZ7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I compute the impulse response of the discretized transfer function, the system appears unstable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,t] = step(c2d(tf(model_state_space), 900));&#xA;plot(t,y(:,:,end), 'g')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7wSau.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please explain why this is so?&lt;/p&gt;&#xA;" OwnerUserId="8053" LastActivityDate="2014-11-22T18:59:47.663" Title="Why is my discretized transfer function unstable when my discretized state-space model is stable?" Tags="|matlab|discrete-signals|transfer-function|state-space|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19184" PostTypeId="1" CreationDate="2014-11-17T09:25:05.733" Score="0" ViewCount="209" Body="&lt;p&gt;I want to do one threshold method on high pass components of a wavelet frame decomposition approch,for edge detection in image. I have 14 high pass components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;for thresholding, I need keep the lowest 50% of the coefficients in absolute value of the high pass parts or in other words keep only the lowest 50% largest coefficients.I examine otsu and Hysteresis thresholding, but I can't find all edges. I also wrote one  matlab code, that does for each high pass part:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% x1 and x2 are largest pixel value of each of high pass parts}&#xA;% there is negative and positive pixels in high pass parts &#xA;&#xA;function Xt=Threshold(X,x1,x2)&#xA;&#xA;[m,n]=size(X);&#xA;Xt=zeros(m,n);&#xA;for k=1:m&#xA;    for l=1:n&#xA;        if(X(k,l)&amp;gt; min(min(X)) &amp;amp;&amp;amp; X(k,l)&amp;lt; x1 &amp;amp;&amp;amp; mod(X(k,l),2)~=0)&#xA;            Xt(k,l)=1;&#xA;        elseif(X(k,l)&amp;gt; x2  &amp;amp;&amp;amp; X(k,l)&amp;lt; max(max(X)) &amp;amp;&amp;amp; mod(X(k,l),2)==0)&#xA;            Xt(k,l)=1;&#xA;        end&#xA;    end&#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11754" LastEditorUserId="11477" LastEditDate="2014-11-17T18:41:28.167" LastActivityDate="2019-05-25T07:02:50.847" Title="what method for thresholding?" Tags="|image-processing|matlab|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19185" PostTypeId="2" ParentId="19181" CreationDate="2014-11-17T10:15:04.220" Score="1" Body="&lt;p&gt;The spectrum &lt;code&gt;NewSpectrum&lt;/code&gt; appears to be the output of the FFT of the current data block, and &lt;code&gt;FilteredSpectrum&lt;/code&gt; on the right-hand side of the equation is the filtered spectrum of the previous block. The index &lt;code&gt;i&lt;/code&gt; is the frequency index, so you use this recursion for each frequency point. Note that the value of &lt;code&gt;gain&lt;/code&gt; is crucial. It should be in the range $(0,1)$, where a value of $1$ means no filtering at all, and $0$ means no update at all.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-17T10:15:04.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19186" PostTypeId="2" ParentId="19176" CreationDate="2014-11-17T11:08:30.143" Score="2" Body="&lt;p&gt;I'll add another answer, even though MBaz's answer is correct, because I think that it doesn't actually address the problem you have with arriving at the final solution. Summarizing, you have to solve&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi}\int_{-W}^W|P(\omega)|^2d\omega=0.9\int_{-\infty}^{\infty}\text{rect}^2(t/T)dt=0.9\cdot T\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $W$ (which is the bandwidth in radians). If you like, rewrite (1) using $f$ instead of $\omega$. $P(\omega)$ is the Fourier transform of the rectangular pulse:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P(\omega)=2\frac{\sin(\omega T/2)}{\omega}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understood your question and your comments correctly, then you understand all of this, but your problem is solving (1) for $W$. Note that the integral has no closed-form solution, unless you consider an expression including the sine integral $\text{Si}(x)=\int_0^x\sin(t)/t\;dt$ closed form. With a little help from &lt;a href=&quot;http://www.wolframalpha.com/&quot; rel=&quot;nofollow&quot;&gt;WolframAlpha&lt;/a&gt;, Equation (1) can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2}{\pi W}\left[TW\cdot \text{Si}(TW)+\cos(TW)-1\right]=0.9\cdot T\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (3) has no closed-form solution for $W$, so it is not surprising that you got confused. You could of course try to solve (3) numerically but I do not think that this is the idea of the exercise. What you need to know is that obviously the largest portion of the energy is contained in the main lobe of the spectrum, i.e. between $-W_0$ and $W_0$, where $W_0$ is the first zero crossing of $P(\omega)$. From (2) it is clear that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W_0T/2=\pi\quad\Longrightarrow W_0=\frac{2\pi}{T}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this is the essential bandwidth in radians.&#xA;&lt;a href=&quot;http://www.wolframalpha.com/input/?i=%282+*+Si%282+%CF%80%29%29%2F%CF%80&quot; rel=&quot;nofollow&quot;&gt;Checking&lt;/a&gt; the exact percentage using the left-hand side of (3) we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2}{\pi W_0}\left[TW_0\cdot \text{Si}(TW_0)+\cos(TW_0)-1\right]=&#xA;\frac{2\;\text{Si}(2\pi)}{\pi}\cdot T=0.9028\cdot T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which seems close enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, the essential bandwidth of a rectangular pulse is given by the width of  the mainlobe of its spectrum, so you only need to be able to calculate the first zero of the spectrum and you're done.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-17T11:08:30.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19187" PostTypeId="1" CreationDate="2014-11-17T12:40:11.060" Score="2" ViewCount="8064" Body="&lt;p&gt;I am currently trying to detect heads in a sequence of real-footage images and am using HOG feature descriptor and SVM as classifier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am using &lt;strong&gt;Dalal's HOG implementation&lt;/strong&gt; code in MATLAB found in this link:&#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/46408-histogram-of-oriented-gradients--hog--code-using-matlab&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/46408-histogram-of-oriented-gradients--hog--code-using-matlab&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am using &lt;strong&gt;libSVM MATLAB&lt;/strong&gt; version found in this link:&#xA;&lt;a href=&quot;http://www.csie.ntu.edu.tw/~cjlin/libsvm/&quot; rel=&quot;nofollow&quot;&gt;http://www.csie.ntu.edu.tw/~cjlin/libsvm/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I prepared 350 positive training images and 1243 negative training images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hog feature vectors extracted from the training images are converted to libsvmFormat and inputted in the libsvm training method, to obtain a model. The hog vector length is that of 1764.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the libSVM I chose these as parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;-s 0  (i.e. C-SVC)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;-c 1  (i.e. cost = 1)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;-t 2  (i.e. kernel = RBF)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;-g 3  (i.e. gamma = 3 (this is for kernel))&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Regarding the HOG version, I left the cell, bin &amp;amp; block parameters as they were in the implementation shown in the link above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using a scanning window of size 128x128 and 256x256 to scan through the whole image to detect possible heads.  At each window, the hog feature vector is extracted for each image and is inputted in libsvm predict, to test whether it should be classified as a head or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, after doing all the above, I have a numerous amount of false negatives and can't figure out what I am doing wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone experience please offer some advice on what is possibly wrong?  I really need to figure this out please.  Much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="11755" LastActivityDate="2015-01-16T23:19:33.870" Title="Head detection using HOG and SVM" Tags="|image-processing|matlab|object-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19188" PostTypeId="1" CreationDate="2014-11-17T14:06:47.797" Score="2" ViewCount="477" Body="&lt;p&gt;I want to know &quot; Whether there is any Tool Box in Mathematica (MMA) for the Time-Frequency (TF) Signal Analysis&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am well-versed in MMA Programming, so want to do TF Signal Analysis in MMA. I think if there is toolbox of TF Analysis, then it will be of very much great help in long programming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in Advance!!!!&lt;/p&gt;&#xA;" OwnerUserId="11756" LastEditorUserId="7092" LastEditDate="2014-11-17T14:37:59.083" LastActivityDate="2014-11-18T12:23:38.047" Title="Time Frequency Signal Analysis in Mathematica (MMA)" Tags="|time-frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19189" PostTypeId="2" ParentId="19187" CreationDate="2014-11-17T14:57:42.083" Score="2" Body="&lt;p&gt;The thing to keep in mind here is that HOG is not invariant to in-plane rotation. A change in orientation of more than 10-15 degrees will probably throw it off.  So if your head can have different orientations in the image, you would either need to train multiple detectors or use something other than HOG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, there is a function &lt;code&gt;extractHOGFeatures&lt;/code&gt; in the Computer Vision System Toolbox, and SVM is available in the Statistics Toolbox. See &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/digit-classification-using-hog-features.html&quot; rel=&quot;nofollow&quot;&gt;this example&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: from your sample images it looks like in most cases you need to detect profile faces. &lt;code&gt;vision.CascadeObjectDetector&lt;/code&gt; in the Computer Vision System Toolbox can do that for you. For greater robustness, I would run two detectors in succession: one for profile faces and one for frontal faces.  And also, HOG may not be your best choice here. For face detection Haar or LBP features generally work better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No matter what you do, you will have some false negatives.  So, if you are using a video camera, I would also recommend tracking the faces.  See this &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/47105-detect-and-track-multiple-faces&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt;. This will give you an opportunity to correct mistakes made on individual frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit2&lt;/strong&gt;: You can also train your own detector with &lt;code&gt;trainCascadeObjectDetector&lt;/code&gt;, and you can use &lt;code&gt;trainingImageLabeler&lt;/code&gt; app to label the positive samples.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2014-11-17T18:38:07.080" LastActivityDate="2014-11-17T18:38:07.080" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="19190" PostTypeId="2" ParentId="19171" CreationDate="2014-11-17T15:09:56.407" Score="2" Body="&lt;p&gt;Given &lt;em&gt;any&lt;/em&gt; collection of $m$ &lt;em&gt;unit-norm&lt;/em&gt; (or unit-Euclidean-length)&#xA;vectors in a real or complex $n$-dimensional vector space $\mathbb R^n$ or&#xA;$\mathbb C^n$, let $c_{\max}$ be the maximum magnitude of the&#xA;inner product between two vectors in the set. How small can $c_{\max}$ be?&#xA;One answer to this question is given by the&#xA;Welch bounds which are a &lt;em&gt;collection&lt;/em&gt; of lower bounds on the &lt;em&gt;minimum&lt;/em&gt; possible&#xA;value of $c_{\max}$. These bounds apply to &lt;em&gt;all&lt;/em&gt; collections of $m$ unit-norm&#xA;vectors in $n$-dimensional space, &#xA;and they even hold for the case when the collection is a multiset (and thus &#xA;two vectors are identical, and so $c_{\max}$ necessarily equals $1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Welch bounds are of the form&#xA;$$c_{\max}^2 \geq \sqrt[k]{C_k(m,n)}, ~k = 1, 2, 3, \ldots \tag{1}$$&#xA;or more correctly&#xA;$$c_{\max}^2 \geq \sqrt[k]{\max\{C_k(m,n), 0\}},~ k = 1, 2, 3, \ldots \tag{2}$$&#xA;because the function $C_k(m,n)$ can have negative value. Note for&#xA;example, that for $k = 1$, $(1)$ becomes&#xA;$$c_{\max}^2 \geq \frac{m-n}{n(m-1)}$$&#xA;where the right side is negative when $m &amp;lt; n$ and $0$ when $m = n$. &#xA;This is as it should be because we know that in a $n$-dimensional&#xA;space, we can always find $m \leq n$ orthonormal vectors and so&#xA;$c_\max^2 = 0$ for this set.&#xA;Thus, $(2)$ which becomes&#xA;$$c_{\max}^2 \geq \max\left\{\frac{m-n}{n(m-1)}, 0\right\}\tag{3}$$&#xA;is a much better way of expressing the bound.&#xA;When $m \gg n$ and so $(m-n)/(m-1)$ is approximately $1$, then &#xA;(as Welch pointed out as also have you in your question) &#xA;the right side of $(3)$ approaches $n^{-1}$ as $m \to \infty$ and so&#xA;we have that&#xA;$$c_\max  \geq \frac{1}{\sqrt{n}}\tag{4}$$&#xA;as a limiting form of the lower bound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning to the question asked about Welch bounds for $k \geq 2$,&#xA;these are useful when $m \gg n$ and give larger lower bounds than&#xA;the right side of $(4)$. If I remember correctly, the Welch bound&#xA;for $k = 2$ gives something like&#xA;$$c_\max \geq \frac{2^{1/4}}{\sqrt{n}}$$&#xA;when $m \geq \frac{n^3+n^2}{2}$ which is an improvement on $(4)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a discussion of some of these points (as applied to&#xA;crosscorrelations and autocorrelations instead of inner products), &#xA;I refer you&#xA;to my paper &quot;Bounds on crosscorrelation and autocorrelation of sequences&quot;&#xA;in &lt;em&gt;IEEE Transactions on Information Theory&lt;/em&gt;, November 1979 which is&#xA;behind IEEE's paywall unless you have institutional access through your&#xA;employer or have paid personally for IEEExplore access.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2014-11-18T03:10:10.103" LastActivityDate="2014-11-18T03:10:10.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19191" PostTypeId="1" AcceptedAnswerId="19207" CreationDate="2014-11-17T16:47:21.510" Score="3" ViewCount="11301" Body="&lt;p&gt;If I take the FFT of a sinusoid I will get a plot whit all the energy of the signal concentrated at the sinusoid frequency. But what happens if I have a signal in which the frequency keeps changing?(like the chirp: linear and exponential) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to compute the FFT of a chirp signal? And what should I expect as result? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to do it in Matlab creating a chirp using the matlab function and then passing it to the FFT function but I do not know if this makes any sense and how to 'read ' the result I get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you also suggest me some readings (papers, books) on the topic?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2017-02-05T05:11:02.927" Title="Conceptual question on FFT and chirp signal" Tags="|fft|fourier-transform|linear-chirp|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19192" PostTypeId="2" ParentId="19184" CreationDate="2014-11-17T21:23:40.757" Score="1" Body="&lt;p&gt;I guess you had some misunderstandings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, strong edges correspond to wavelet coefficients with large magnitudes in high pass bands. Thus, instead of keeping small coefficients, you should keep large coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, in a high pass band, there should be a large number of coefficients with magnitude close to zero. This means edge pixels would almost impossible account for more than 50% of all pixels. Thus, the usage of 50% in your assumption is also doubtful. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the difficulty of edge detection often lies in differentiating weak edges from noise, but not the detection of strong edges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest to you to take look at the MATLAB source code of Canny Edge Detector, whose parameter adaption part ( when you do not provide the two canny thresholds to matlab ) might give you some thoughts on to automatically pick some good thresholds. Its idea is based on examining the edge histogram and determines threhsolds according to this distribution dynamically. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2014-11-17T21:23:40.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19193" PostTypeId="2" ParentId="19187" CreationDate="2014-11-17T21:54:51.373" Score="0" Body="&lt;p&gt;There are a lot of possible problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, you should do a quick check and see how your false alarms look like, especially how reasonable they are. If there are some false alarms quite similar to heads visually, then donot worry about them for now. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, often time you need to perform cross validations to determine the parameter set used in your classifier, instead of picking one set of default parameters. It is also common that one set of good parameters in one problem is inappropriate for another. Thus, you should verify whether or not your SVM params are optimal for your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thirdly, it is well known that object detection also need post-processing to prune detection results and to handle possible overlapping results. Sometimes, even simple heuristics will work well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, try to use boost + cascade to retrain false classified samples. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2014-11-17T21:54:51.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19194" PostTypeId="1" AcceptedAnswerId="19209" CreationDate="2014-11-18T00:36:39.250" Score="1" ViewCount="212" Body="&lt;p&gt;I have a question regarding Modulation and Demodulation.&lt;br&gt;&#xA;In question 5.21 (b) from the &quot;Discrete-time Signal Processing&quot; book by Oppennheim, he asks to find out the type of filter used in the attached figure:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ToFSS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;The question is what is the effect of $(-1)^n$ on the original filter and y[n].&lt;br&gt;&#xA;I saw the answer to be high-pass filter, but I am not sure why.&lt;br&gt;&#xA;Please help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11753" LastEditorUserId="8140" LastEditDate="2014-11-18T18:29:40.423" LastActivityDate="2014-11-18T20:58:29.800" Title="Modulation and DeModulation" Tags="|filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19196" PostTypeId="1" CreationDate="2014-11-18T05:19:52.720" Score="1" ViewCount="659" Body="&lt;p&gt;I'm new to dsp.  I've got a complex signal that was sampled at 192kHz then an fft of 16384 bins created.  This now needs to be plotted on a graph for a real time spectrum display.  The problem is if you want to plot the whole spectrum consisting of a 192kHz span, you will be plotting 16384 points on a display that many times will be 1600 pixels wide for example.  The result is you get an ugly mess on the screen.  So far I have been downsampling the signal by just plotting every 8th point. The problem is though, when I look at other spectrum displays that also perform 16384 fft's, they show much more data.  I have effectively dropped some on the peaks that the other software doesn't.&#xA;So the question is, how does one do the downsampling properly?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7741" LastActivityDate="2014-11-18T15:32:19.307" Title="Downsampling fft results to a graphics display" Tags="|frequency-spectrum|downsampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19198" PostTypeId="2" ParentId="19196" CreationDate="2014-11-18T07:22:51.637" Score="1" Body="&lt;p&gt;Ok, here is the answer...hopefully this will help someone else.  Read this thesis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://skemman.is/stream/get/1946/15343/37285/3/SS_MSthesis.pdf&quot; rel=&quot;nofollow&quot;&gt;http://skemman.is/stream/get/1946/15343/37285/3/SS_MSthesis.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives a very easy and comprehensive overview of how to do just what I needed. I do believe this particular case is different than the usual downsampling. It fits the situation perfectly.&#xA;The thesis describes several methods of downsampling for display purposes. For example the practice of just dropping every nth sample, performing an average over the bucket of samples corresponding to the downsample ratio and more advanced methods.  The one I will be looking at is called Largest Triangle Three Bucket.&#xA;Basically you divide your original samples into buckets consisting of samples equal to your downsampling factor.  For example if you have a sample set of 10,000 points and you want to only display 2000, you will divide your original samples into 2000 buckets containing 5 sample each.&#xA;You then rank every point in the bucket by calculating the area of a triangle it forms&#xA;with the selected point in the last bucket and the average point in the next&#xA;bucket.&#xA;This seems to work really well in preserving the visual representation of data.&lt;/p&gt;&#xA;" OwnerUserId="7741" LastEditorUserId="7741" LastEditDate="2014-11-18T15:32:19.307" LastActivityDate="2014-11-18T15:32:19.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19199" PostTypeId="1" CreationDate="2014-11-18T08:20:34.533" Score="1" ViewCount="1455" Body="&lt;p&gt;If we have a linear system, represented in State Space and the A matrix is singular (det(A) == 0), can we expect any special properties from the system?&lt;/p&gt;&#xA;" OwnerUserId="1575" LastActivityDate="2015-04-06T18:48:42.573" Title="Does the system matrix being singular tell us anything about the system?" Tags="|control-systems|state-space|theory|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19200" PostTypeId="2" ParentId="19199" CreationDate="2014-11-18T10:22:27.157" Score="1" Body="&lt;p&gt;If the system matrix $A$ is singular then it has at least one eigenvalue equal to $0$. Since the eigenvalues of $A$ represent the poles of the transfer function of the system, there is at least one pole at $s=0$, which makes the system unstable (or marginally stable if there is a single pole at $s=0$, but in any case not asymptotically stable).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-18T11:33:40.553" LastActivityDate="2014-11-18T11:33:40.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19203" PostTypeId="2" ParentId="19188" CreationDate="2014-11-18T12:23:38.047" Score="2" Body="&lt;p&gt;If you are using an older version of &lt;em&gt;Mathematica&lt;/em&gt; (pre v.8) and are interested in wavelets - yes, you need an add-on to perform wavelet analysis. More about it &lt;a href=&quot;http://library.wolfram.com/infocenter/TechNotes/4639/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. If you are using v.8 or above then everything wavelet-related is built-in. If you are interested in Fourier analysis - it is built in (since v.1). To showcase the capabilities of the time-frequency analysis functionality:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have the signal $2 \exp \left(-\frac{t^2}{10}\right) \cos (5 t)$&#xA;&lt;img src=&quot;https://i.stack.imgur.com/v6rh7.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can visualise its Gabor transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ePbIT.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wigner transform (notice the artifacts)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6yecE.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the (somewhat) corrected Gabor-Wigner transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rRoCX.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A second test signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W4Nq1.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its spectrogram calculated using partitions of length 256, offset 1 and BlackmanHarrisWindow&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yYXGp.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;its periodogram (with the same options as above)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EXdfb.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we move onto wavelets&#xA;Scalogram after a continuous wavelet transform with a Morlet wavelet&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qud3E.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the respective scalogram after performing a discrete wavelet transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CoO51.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just because I find it pretty - a scalogram of a simulated noise in 3D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0Mtj9.png&quot; alt=&quot;Noise&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7477" LastActivityDate="2014-11-18T12:23:38.047" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19206" PostTypeId="1" CreationDate="2014-11-18T14:45:42.630" Score="1" ViewCount="205" Body="&lt;p&gt;Does removing the mean value of the signal effect the estimation of power spectral density(PSD)? If it effects, how? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the advantage we can get by removing the mean of the signal in estimating the PSD ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can the advantage be in dealing with the signal points whose magnitude is very large and we can not see the changes(also frequency content) in the signal since the changes are very small comparing the magnitude of signal points?&lt;/p&gt;&#xA;" OwnerUserId="11654" LastEditorUserId="11654" LastEditDate="2014-11-18T20:05:43.633" LastActivityDate="2014-11-18T20:05:43.633" Title="Removing the mean in finding PSD" Tags="|signal-analysis|power-spectral-density|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19207" PostTypeId="2" ParentId="19191" CreationDate="2014-11-18T15:48:54.997" Score="1" Body="&lt;p&gt;&lt;strong&gt;FFT&lt;/strong&gt; is an fast algorithm to compute &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;DFT&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it works on finite length of samples. This fact has some side effects on the spectrum that it will generate for signal, but generally it consist only signal frequencies that it includes on its time window of length &lt;strong&gt;&lt;em&gt;nfft&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When u sweep frequency in your sinusoidal, in fact you are doing some sort of frequency modulation. when you calculate &lt;strong&gt;FFT&lt;/strong&gt; of this signal. You would see power in all frequencies that sinusoidal has been modulated to in the window that you calculate your &lt;strong&gt;FFT&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider following example I wrote in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 48e3;&#xA;t = 0:1/fs:20e-3;&#xA;x = sin(2.*pi.*(10e3 - (2e3 .*(abs(t-10e-3)/10e-3))).*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This signal would sweep frequency from 8K to 10K in [0 , 10ms] and from 10K to 8K in [10ms, 20ms] and has been sampled by 48KHz frequency. &#xA;To calculate its &lt;strong&gt;FFT&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = length(x);&#xA;xf = fft(x)/L;&#xA;xf_s = fftshift(xf);&#xA;f = Fs/2 * linspace(-1,1-2/L,L);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you can plot its DFT spectrum representation using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(f,abs(xf_s));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VE1uh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just like most of frequency modulated signals. Note that here we calculated &lt;strong&gt;FFT&lt;/strong&gt; for full length of signal, if we calculate it for only some portion of signal we would have frequencies power for that portion. &lt;/p&gt;&#xA;" OwnerUserId="11426" LastActivityDate="2014-11-18T15:48:54.997" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="19208" PostTypeId="2" ParentId="19183" CreationDate="2014-11-18T20:48:47.810" Score="2" Body="&lt;p&gt;You're using a high order model so you might be running into numerical precision issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure the realization of model_state_space is minimal. You can do this with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;min_model_state_space = minreal(model_state_space)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, not all state-space realizations are created equally. Some have better numerical properties, such as a balanced realization:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[balanced_model_state_space, G] = balreal(model_state_space)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If the vector G contains small values it means you can reduce the order of your model without giving up accuracy. Look up the matlab function &lt;em&gt;balred&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just from looking at your step response plot you probably don't need a 30th order model (1st or 2nd order might even be enough).&lt;/p&gt;&#xA;" OwnerUserId="11618" LastActivityDate="2014-11-18T20:48:47.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19209" PostTypeId="2" ParentId="19194" CreationDate="2014-11-18T20:58:29.800" Score="0" Body="&lt;p&gt;As hinted out, you firstly shift signal by π by multiplying it by cos(πn). Now, your low frequency components are around π. In the next step of diagram, you filter the components around frequency 0 since the filter in diagram is lowpass. But since your signal was shifted by π, you filter the high frequency components of the original signal. In the next step, you shift your original signal back to 0 frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, overall you filter the high frequency components.&lt;/p&gt;&#xA;" OwnerUserId="11654" LastActivityDate="2014-11-18T20:58:29.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19210" PostTypeId="2" ParentId="19159" CreationDate="2014-11-18T21:27:30.600" Score="-1" Body="&lt;p&gt;The above analysis's are correct if the signal is constant/DC; if the signal is varying but you know the shape you have to weight the samples.  In this case you are trying for the amplitude of the waveform with slow edges but you know the shape; and you are trying to improve your signal to noise by looking at the edges as well as the &quot;top&quot;; actually in the case I have in mind the &quot;top&quot; was never reached.&#xA;In this case the correct form of combining Gaussian contaminated  samples is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{i=0}^n(S_i\cdot \frac{W_i}{N_i^2})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $W_i$ is the pre-calculated relative value of the waveform at point j; typically you would make the sum of the weights one.  The ratio $\frac{W_i}{N_i^2}$ is pre-calculated and $S_j$   is the sample value.&#xA;As usual in signal in signal processing scaling is required but the formula is robust in calculating $(\frac{S}{N})^2 $&#xA;As a matter of fact you can see that the formula is a weighted sum of the squares of the S/N across the samples.&#xA;I deduced it via a symbolic algebra program a long time ago; if somebody wants I could reconstruct the proof.  As I recall the proof wasn't enlightening and the result looked accidental.  Sometime later I convinced myself that geometric vector space argument would work in an obvious manner but never wrote that down.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastEditorUserId="11607" LastEditDate="2014-11-19T14:29:58.407" LastActivityDate="2014-11-19T14:29:58.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19211" PostTypeId="2" ParentId="19148" CreationDate="2014-11-18T21:35:42.357" Score="1" Body="&lt;p&gt;Actually I would take the standard definition &#xA;2*pi *(Energy stored/Energy dissipated)_per-cycle&#xA;The relationship between standard signals x_j and &quot;power&quot; $x_j\cdot x_j^* $ is pretty much the same in the  z and the s domain.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2014-11-18T21:35:42.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19212" PostTypeId="2" ParentId="19191" CreationDate="2014-11-18T21:43:22.720" Score="1" Body="&lt;p&gt;If you were talking about a Laplace (or Fourier) transform then any function with time varying coefficients has a valid transform.  But you have to do the analog/continuous calculation.&#xA;I would imagine that the same holds true for z transforms except for aliasing; which is not trivial.  My experience is that this problem,chirp, is a standard example in Wavelet analysis.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some internet references:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some detail: &lt;a href=&quot;http://perso.ens-lyon.fr/patrick.flandrin/SPIE01_PF.pdf&quot; rel=&quot;nofollow&quot;&gt;http://perso.ens-lyon.fr/patrick.flandrin/SPIE01_PF.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practical application?: &lt;a href=&quot;http://www.phys.ufl.edu/ireu/IREU2014/pdf_reports/Eve_Report.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.phys.ufl.edu/ireu/IREU2014/pdf_reports/Eve_Report.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you become interested is line of analysis try:&#xA;@book{meyer1992wavelets,&#xA;  title={Wavelets and applications},&#xA;  author={Meyer, Yves},&#xA;  year={1992},&#xA;  publisher={Paris [etc.]: Masson; Berlin [etc.]: Springer-Verlag}&#xA;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quite dated but understandable since they were still in the justification phase.  Section 1a.  A comparison with short term Fourier analysis is 1b.  Except amazon lists \$83 new; looking at my copy I paid $7.50.  I really don't understand technical book pricing.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastEditorUserId="11607" LastEditDate="2014-11-21T19:58:38.297" LastActivityDate="2014-11-21T19:58:38.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19218" PostTypeId="1" CreationDate="2014-11-19T09:06:41.947" Score="1" ViewCount="67" Body="&lt;p&gt;Does anyone know , how the spread spectrum sequences are used in airports. I've attended a presentation this morning regarding spread spectrum in my college, the author mentioned that the sequences are helpful in landing of the aircraft, and also to mitigate interference between air crafts. How is that possible? Is it like assigning a unique code to every aircraft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2014-11-19T09:06:41.947" Title="spread spectrum communication in airport" Tags="|digital-communications|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19222" PostTypeId="1" CreationDate="2014-11-19T14:26:34.977" Score="2" ViewCount="538" Body="&lt;p&gt;I would like to ask how to design a digital filter to remove $50$ Hz interference on an ECG signal. Do I need to use notch filter? &#xA;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="11771" LastEditorUserId="47790" LastEditDate="2020-04-02T12:08:48.643" LastActivityDate="2022-03-26T00:06:45.687" Title="filter design for ECG" Tags="|noise|filter-design|lowpass-filter|ecg|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19224" PostTypeId="1" CreationDate="2014-11-19T14:46:11.127" Score="1" ViewCount="271" Body="&lt;p&gt;I am working on a FMCW radar and I want to sample the I/Q signals from the 2 receiving antenna (total 4 channels) simultaneoulsy and send the digital data to computer to extract range and velocity information using FFT.&#xA;The below diagram is a overall plan.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/QcSLg.png&quot; alt=&quot;Plan of work&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the diagram I have shown a ADC with 1MSPS but thats not based on any calculation, just a rough idea as the maximum frequency component is 500kHz. To make it simplier and test for short range I planned to limit the frequency to 100 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is how should I senlect the sampling rate? I don't think 2*fmax (Sampling Theorem) is enough for this purpose. The output from the radar frontend are I/Q signals, band limited from 30Hz to 100kHz. My target is to digitize the signal to the best for proper analysis. Should I consider the DAC (used for tuning the frontend) sample number calculated from the minimum and maximum voltage for tuning, to calculate my sampling rate?&lt;/p&gt;&#xA;" OwnerUserId="11676" LastActivityDate="2014-11-19T14:46:11.127" Title="How to choose sampling rate?" Tags="|discrete-signals|sampling|analog-to-digital|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19225" PostTypeId="1" CreationDate="2014-11-19T15:22:41.047" Score="8" ViewCount="6413" Body="&lt;p&gt;The famous &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.w3.org/TR/audio-eq-cookbook/&lt;/a&gt; offers a set of [real] biquad filter calculation formulas that generally work fine.&lt;/p&gt;&#xA;&lt;p&gt;However, when filter's frequency approaches Nyquist frequency the Q (bandwidth) specification of a filter becomes greatly distorted - usually it shrinks a lot (even though the author mentioned that he performed a necessary pre-warping).&lt;/p&gt;&#xA;&lt;p&gt;I'm in quest for filter formulas that do not have such strong bandwidth distortion. I need peaking/bell, band-pass, low-pass, high-pass, high-shelf, notch filters. I know this can be done as previously I've bought a peaking/bell/band-pass filter formulas with less distortion, but they are still not perfect and I need other filter types.&lt;/p&gt;&#xA;&lt;p&gt;So, I'm also willing to pay for the solution if the price is right.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively, if one could point me to an optimization algorithm that works with Z-domain filters that would be great, too. Unfortunately, most usual optimization algorithms do not work well in Z-domain - they can't optimize a set of parameters to match a desired frequency response (probably due to periodic functions used to calculate the frequency response).&lt;/p&gt;&#xA;" OwnerUserId="11772" LastEditorUserId="4346" LastEditDate="2021-11-27T22:47:52.483" LastActivityDate="2021-11-27T22:59:41.650" Title="Audio EQ Cookbook without frequency warping" Tags="|filter-design|" AnswerCount="4" CommentCount="36" ContentLicense="CC BY-SA 4.0" />
  <row Id="19227" PostTypeId="1" CreationDate="2014-11-19T16:56:54.390" Score="-1" ViewCount="2531" Body="&lt;p&gt;What does the graph of audio signal tells? what are negative samples?&lt;img src=&quot;https://i.stack.imgur.com/Q7wVU.png&quot; alt=&quot;Audio signal graph&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11774" LastActivityDate="2014-11-19T17:28:51.917" Title="What does the graph of audio signal tells? what are negative samples?" Tags="|audio|" AnswerCount="1" CommentCount="1" ClosedDate="2014-12-02T23:04:25.287" ContentLicense="CC BY-SA 3.0" />
  <row Id="19228" PostTypeId="2" ParentId="19227" CreationDate="2014-11-19T17:28:51.917" Score="3" Body="&lt;p&gt;Could be a lot of things.  But for typical recorded audio, it could be a graph of the change in air pressure, surrounding or in front of the microphone transducer(s), from ambient, over time, scaled by some factor.  Positive samples could represent the air pressure above ambient atmospheric pressure, and negative samples the pressure below.  Or both could be the opposite, as the sign can be arbitrary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Humans (and many animals) interpret a rapid change in air pressure, within certain frequency ranges (roughly 20 to 20k Hz) and within certain (but a very wide range of) amplitude levels, as sound.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-11-19T17:28:51.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19230" PostTypeId="1" AcceptedAnswerId="19236" CreationDate="2014-11-19T20:34:46.990" Score="1" ViewCount="3385" Body="&lt;p&gt;Say I have an FIR filter with desired magnitude characteristics. I could imagine using an allpass IIR in series with the FIR to alter the group delay characteristic to provide both a 'magnitude equalization' and 'delay equalization' curve custom for the application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine this would be simpler in the frequency domain where the imaginary component of each slice of the FFT would adjust the group delay of a bandwidth corresponding to the nyquist frequency of the system divided by the FFT length, and then IFFT'ing to find the impulse response, windowing that impulse response to design the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see Matlab has an IIR feature for custom group delay in fdatool. Why does it have to be an IIR? Can an FIR have a custom group delay?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any pointers!&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2017-07-22T11:49:05.187" Title="How to design a filter with custom group delay -- why is it an IIR?" Tags="|matlab|fft|infinite-impulse-response|group-delay|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19231" PostTypeId="2" ParentId="19230" CreationDate="2014-11-19T21:10:39.973" Score="3" Body="&lt;p&gt;Most FIR filters are linear phase as their coefficients are (anti-)symmetric. So, most FIR filter design techniques are targeted at linear phase designs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means FIR filters are not much good at equalizing group delay -- linear phase FIR filters all have constant group delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IIR filters, on the other hand, generally have non-linear phase. That means techniques have arisen that allow shaping of the phase and, therefore, the group delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's not to say that FIR filters without the (anti-)symmetry constraint can't be designed to improve group delay, though.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-11-19T21:10:39.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19236" PostTypeId="2" ParentId="19230" CreationDate="2014-11-19T22:07:20.920" Score="7" Body="&lt;p&gt;As pointed out by Peter K., it is true that many well-known techniques for designing FIR filters actually only design linear phase filters. However, FIR filters are very well suited for delay equalization, simply because the design process is much simpler than for IIR filters. The reason for this is the fact that the design problem can be formulated in such a way that it is still linear in the unknown filter coefficients, which is usually not the case for IIR filters. This type of design problem is known as &lt;em&gt;complex approximation&lt;/em&gt; problem, because in the case of a desired non-linear phase response a complex frequency response must be approximated by the filter, unlike a real one in the case of a linear phase filter. You can find a lot about this topic, including Matlab programs, in &lt;a href=&quot;http://mattsdsp.blogspot.nl/p/phd-thesis.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this thesis&lt;/a&gt;. Have a look at the design example #2 on page 119 ff. where an FIR magnitude and phase equalizer is designed compensating the effects of an analog anti-aliasing filter. The following figure is taken from the thesis and it shows the group delay of the analog low pass filter, the group delay of the equalizer(s) (there are two with different magnitude responses), and the total group delay of the cascade of analog and digital filter, which is supposed to be constant in the passband:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jw7xO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2017-07-22T11:49:05.187" LastActivityDate="2017-07-22T11:49:05.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19237" PostTypeId="2" ParentId="19125" CreationDate="2014-11-19T22:14:20.417" Score="1" Body="&lt;p&gt;The equation error approach should have worked (assuming your model was the same order as the unknown system). While it's not as efficient as QRD-RLS algorithms you can always use a Kalman filter to do recursive least squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's an open source Kalman filtering toolbox available &lt;a href=&quot;http://becs.aalto.fi/en/research/bayes/ekfukf/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Below is an example of how to solve the parameter estimation problem for the example system you provided. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to model the output of an unknown system as a weighted combination of delayed outputs and inputs (also known as an ARMA model). The weights are unknown so they become the states that the Kalman filter tries to estimate, while the inputs and outputs form a time-varying observation matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;close all&#xA;&#xA;addpath ekfukf&#xA;&#xA;% unknown system&#xA;z = tf('z');&#xA;unknown_tf = (3.481e-5*z + 3.446e-5)/(z^2 - 1.97*z + 0.9704);&#xA;unknown_ss = ss(unknown_tf);&#xA;A = unknown_ss.a;&#xA;B = unknown_ss.b;&#xA;C = unknown_ss.c;&#xA;D = unknown_ss.d;&#xA;x = zeros(2, 1);&#xA;&#xA;M = 1000; % simulation length&#xA;u = randn(M, 1); % vector of observed inputs&#xA;y = zeros(M, 1); % initialize output vector&#xA;e = zeros(M, 1); % output prediction error&#xA;&#xA;% kalman filter parameters&#xA;dim = 4; % number of unknown parameters (2 numerator coeffs, 2 denominator)&#xA;F = eye(dim); % state transition matrix&#xA;R = 1e-6; % measurement noise variance  &#xA;Q = 0*eye(dim); % process noise covariance&#xA;P = 10*eye(dim); % state-error covariance&#xA;alpha = zeros(2, 1); % initial estimate of denominator coefficiens &#xA;beta = zeros(2, 1); % initial estimate of numerator coefficients&#xA;state = [alpha; beta]; &#xA;Hu = zeros(2, 1); % observation vector containing observed inputs&#xA;Hy = zeros(2, 1); % observation vector containing observed outputs&#xA;&#xA;for k=2:M&#xA;    % compute kalman filter time-update&#xA;    [state, P] = kf_predict(state, P, F, Q);&#xA;&#xA;    % update observation vectors&#xA;    Hy = circshift(Hy, 1);&#xA;    Hy(1) = y(k-1);&#xA;    Hu = circshift(Hu, 1);&#xA;    Hu(1) = u(k);&#xA;&#xA;    % observe system output&#xA;    x = A*x + B*u(k);&#xA;    y(k) = C*x + D*u(k);&#xA;&#xA;    % compute kalman filter measurement update&#xA;    [state, P, K, yfilt, S, likelihood] = kf_update(state, P, y(k), [Hy; Hu]', R); &#xA;    e(k) = y(k) - yfilt;&#xA;end&#xA;&#xA;% exctract numerator and denominator coefficients&#xA;alpha = state(1:2);&#xA;beta = state(3:4);&#xA;&#xA;% construct numerator and denominator polynomial estimates&#xA;est_num = [0, beta'];&#xA;est_den = [1, -alpha'];&#xA;&#xA;% plot estimated and true frequency response&#xA;W = pi*logspace(-3, 0, 300);&#xA;Ghat = freqz(est_num, est_den, W);&#xA;G = freqz(unknown_tf.num{1}, unknown_tf.den{1}, W);&#xA;semilogx(W./pi, 20*log10(abs(G)), 'k', 'linewidth', 2)&#xA;hold on&#xA;semilogx(W./pi, 20*log10(abs(Ghat)), 'g')&#xA;title('estimated (green) and true (black) magnitude response')&#xA;ylabel('magnitude (dB)');&#xA;xlabel('normalized frequency');&#xA;&#xA;% plot prediction error &#xA;figure&#xA;plot(e)&#xA;title('prediction error vs. time');&#xA;ylabel('error');&#xA;xlabel('sample index');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It works!&#xA;&lt;img src=&quot;https://i.stack.imgur.com/jeBwe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The prediction error (trying to predict the output of the unknown system) gives us an idea of how quickly the model converged. Convergence speed is highly dependent on the measurement noise variance.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SX2eH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11618" LastActivityDate="2014-11-19T22:14:20.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19238" PostTypeId="1" CreationDate="2014-11-20T11:14:46.937" Score="0" ViewCount="100" Body="&lt;p&gt;I am applying 8 samples and triangular window to my fft engine. I am getting the results but not accurate (approximately equal with some tolerance).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am calculating MATLAB reference as below :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a=[1,2,3,4,5,6,7,8];&#xA;b=triang(8);&#xA;c=a*b;&#xA;d=fft(c) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it the correct way to apply window for signal processing unit?&lt;/p&gt;&#xA;" OwnerUserId="11785" LastEditorUserId="11785" LastEditDate="2015-03-03T04:34:06.907" LastActivityDate="2015-03-03T04:34:06.907" Title="FFT widow to dsp processor." Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19239" PostTypeId="2" ParentId="19238" CreationDate="2014-11-20T12:05:23.383" Score="1" Body="&lt;p&gt;No. You are doing a matrix mutliply and not a vector multiply. Correct version would be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a=[1,2,3,4,5,6,7,8]'; % column vector&#xA;b=triang(8); % also column vector&#xA;c=a.*b;    % vector multiply&#xA;d=fft(c) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-11-20T12:05:23.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19240" PostTypeId="1" CreationDate="2014-11-20T13:50:32.160" Score="1" ViewCount="102" Body="&lt;p&gt;I'm designing a QC-LDPC decoder in VHDL. It uses a layered decoding method - only a single block row of parity equations is evaluated each iteration (the bit values are still updated every iteration). Bit values are stored as log-likelihoods with the sign representing the respective bit symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A valid codeword is indicated by all parity equations being satisfied. I only ever evaluate a single block row of parity equations. What I want to know is how much information I need to gather to be certain that the current bit values represent a valid codeword.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it enough that each parity equation in $N_b$ successive rows was satisfied, where $N_b$ is the total number of block rows. To my mind that is not enough - bit values can change signs even when every equation is satisfied? Or am I wrong here? If true this might invalidate previously correct block rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is true, then I can only guarantee a codeword is correct by ensuring that for $N_b$ successive rows, all parity equations were satisfied and that no bits changed sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something simple? Or is this the way I need to go about this?&lt;/p&gt;&#xA;" OwnerUserId="5770" LastActivityDate="2014-11-20T13:50:32.160" Title="QC-LDPC Decoder - Is it a codeword?" Tags="|forward-error-correction|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19241" PostTypeId="1" CreationDate="2014-11-19T15:04:08.523" Score="0" ViewCount="501" Body="&lt;p&gt;For a project I’m currently working on, I composed a irregular ocean wave (function of time) by the summation of n regular waves. For the validation and further processing I’d like to produce the following graphs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Power Spectral Density&lt;/strong&gt; (PSD) &lt;strong&gt;spectrum&lt;/strong&gt; of the wave (single sided) with:&lt;/li&gt;&#xA;&lt;li&gt;Units: x-axis: [Hz], y-axis: [m^2/Hz]&lt;/li&gt;&#xA;&lt;li&gt;Units: x-axis: [rad/s], y-axis: [m^2/(rad/sec)]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2&lt;/strong&gt; In order to produce the single sided PSD graphs I found some code online. The peaks are shown at the right period or frequency however, the information on the y-axis has to be scaled some way (changing the amount of samples per second (i.e. parameter &quot;Fs&quot;) or lenght of the signal (i.e. parameter &quot;StopTime&quot;) results in other values on the y-axis). Is this value shown in &quot;bins&quot;? How to change this correctly when the periodogram function is used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CODE 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs          = 6;                     % samples per second&#xA;dt          = 1/Fs;                  % seconds per sample&#xA;StopTime    = 30*3600;               % seconds&#xA;t           = (0:dt:StopTime-dt)';   % seconds&#xA;N           = size(t,1);&#xA;&#xA;W = 5*cos(t) + 10*cos(8*t);&#xA;p = 5;  %number of periodograms&#xA;        %p=10;&#xA;        %p=5;&#xA;        %W is divided into 20 samples/periodograms 18000/20=900 samples/periodogram&#xA;        %W is divided into 10 periodograms 18000/10=1800 samples/peridogram&#xA;        %W is divided into 5 periodograms 18000/5=3600 samples/periodogram&#xA;        %Very long records needed!!! 90 min for 10 periodograms or 45 for 5.&#xA;&#xA;%Periodogram samples&#xA;%x=[];&#xA;for i=1:p&#xA;    x(:,i)=W((1+(i-1)*N/p):((N/p)*i));&#xA;end&#xA;&#xA;%Next power of 2 greater or equal to length of the sample vector to&#xA;%calculate fft. FFT needs a length power of 2 to be efficient. For a&#xA;%shorter record, zeros will be added to reach this value.&#xA;nfft=2^(nextpow2(length(x(:,1))));&#xA;&#xA;%Calculate PSD&#xA;Pxx = [];&#xA;for i=1:p&#xA;    [Pxx(:,i),f]=periodogram(x(:,i),[],nfft,Fs);&#xA;end&#xA;&#xA;mW=sum(Pxx,2)/p;    %Average periodograms&#xA;&#xA;ft=1./f; %Wave period vector for the plot. f represents the frequency vector&#xA;&#xA;%Wave frequency spectral density plot&#xA;figure;&#xA;plot(f,mW,'-')&#xA;xlabel('Frequency (Hz)')&#xA;title('Power wave Spectrum')&#xA;grid;&#xA;&#xA;%Wave Spectral density plot with wave period&#xA;figure;&#xA;plot(ft,mW);&#xA;xlabel('Wave period (s)')&#xA;xlim([0 25])&#xA;title('Power wave Spectrum')&#xA;grid;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="knarf" LastActivityDate="2014-11-20T13:54:30.417" Title="Wave-time trace to Amplitude and PSD spectrum" Tags="|matlab|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19242" PostTypeId="1" AcceptedAnswerId="19266" CreationDate="2014-11-20T13:55:29.590" Score="1" ViewCount="433" Body="&lt;p&gt;What does the output signal look like when you insert $2000 Hz$ square pulses to  chebyshev filter with parameters: (Matlab syntax). I tried to do it like this but I don't understand where it goes wrong.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Making the square pulses&#xA;&#xA;Fs = 1000000;&#xA;t = [0:1/Fs:50e-4]; &#xA;f = 2000;&#xA;&#xA;%square pulse with 50% duty cycle&#xA;&#xA;xt = 1*square(2*pi*f*t, 50);&#xA;&#xA;%Making the filter&#xA;&#xA;Wp = [1000 3000]; &#xA;Ws = [100 3900]; &#xA;[n,Wn] = cheb1ord(Wp,Ws,3,20,'s');&#xA;[b,a] = cheby1(n,3,Wn,'s');&#xA;&#xA;&#xA;&#xA;%Filtering with the coefficient &#xA;&#xA;xt_filtered = filter(b,a,xt);&#xA;&#xA;%Plotting the filtered signal&#xA;&#xA;plot(t,xt_filtered);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I get something like this which doesn't make sense..?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hOYqM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11787" LastEditorUserId="21075" LastEditDate="2020-04-29T21:45:13.300" LastActivityDate="2020-04-29T21:45:13.300" Title="Question on Chebyshev filter" Tags="|matlab|filters|signal-analysis|chebyshev-filters|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19244" PostTypeId="1" AcceptedAnswerId="19247" CreationDate="2014-11-20T15:32:04.410" Score="2" ViewCount="2538" Body="&lt;p&gt;If a system operates on a signal with a time-domain IIR or FIR, why would an acquisition system chunk the audio into powers of two? I can understand filling a buffer by a power of two for an FFT operation. Is there a difference? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am still confused by the difference between block processing and sample by sample processing. Some clarification would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2014-11-20T16:30:14.823" Title="Audio processing -- difference between block and sample-by-sample?" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19245" PostTypeId="1" CreationDate="2014-11-20T15:35:21.463" Score="1" ViewCount="2130" Body="&lt;p&gt;My data is sampled at $f_s = 32kHz$, and for a particular analysis I'm only interested in signals with certain frequencies from $f_{highpass} = \text{0.1Hz}$  to $f_{lowpass} = \text{300 Hz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I build and apply a 4th order butterworth filter to my data I get an error and there's not much left of the signal. Here's some Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;order = 4;&#xA;[b,a] = butter(order, [0.1 300]/(32000/2), 'bandpass');&#xA;y = filtfilt(b,a,data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error message I get is: &lt;code&gt;Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =  1.101227e-16.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried to apply a low pass filter first, then followed by a highpass filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FOI = [0.1 300]&#xA;SampleRate = 32000;&#xA;[b_l,a_l] = butter(order, FOI(2)/(SampleRate/2), 'low' );&#xA;[b_h,a_h] = butter(order, FOI(1)/(SampleRate/2), 'high' );&#xA;tempData = filtfilt(b_l, a_l, data);&#xA;output = filtfilt(b_h, a_h, tempData);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I keep getting the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;why does the filtering fail? &lt;/li&gt;&#xA;&lt;li&gt;why does the filtering with order 3 work but not with order 4?&lt;/li&gt;&#xA;&lt;li&gt;do I need to downsample the data (e.g. to 1kHz) before I can do the filtering? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;EDIT: other people have hit the same &lt;a href=&quot;http://www.mathworks.com/matlabcentral/answers/62553-filtfilt-function-returning-nan-at-certain-frequencies&quot; rel=&quot;nofollow&quot;&gt;problem&lt;/a&gt; but I'm looking for a definite answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT2:&lt;/strong&gt; if I change the highpass value to &lt;code&gt;1&lt;/code&gt; and do the highpass filtering before the lowpass filtering, everything works. But why? &lt;em&gt;Why is the cutoff of &lt;code&gt;0.1&lt;/code&gt; causing problems?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="11517" LastEditorUserId="9090" LastEditDate="2014-11-20T17:59:37.617" LastActivityDate="2014-11-20T17:59:37.617" Title="Is it necessary to downsample data for filtering of low frequencies?" Tags="|matlab|filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19246" PostTypeId="2" ParentId="19245" CreationDate="2014-11-20T16:25:25.357" Score="4" Body="&lt;p&gt;Yes, you can get much better results if you downsample your data first. The problem occurs because the width of your transition band relative to the original data sample rate is very small. This can cause numerical problems when designing or implementing digital filters. The problem only gets worse as the filter order increases, especially with IIR filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, in some cases, you might have more success (i.e. better numerical stability) if you convert the filter to &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_biquad_filter&quot; rel=&quot;nofollow&quot;&gt;second-order sections&lt;/a&gt;. However, for this case, I think the right answer is to downsample the data first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem likely occurs because of the very small cutoff frequency on the low end of your bandpass filter. There is very little room for the transition band (less than 0.1 Hz, which is 1/320000-th of the sample rate), which is difficult to implement. If you downsample the data as much as possible, then you can at least increase this ratio by a good amount, which should give you better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also try using FIR filter implementations if possible, as they typically have superior numerical stability due to their lack of feedback.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-11-20T16:25:25.357" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19247" PostTypeId="2" ParentId="19244" CreationDate="2014-11-20T16:30:14.823" Score="3" Body="&lt;p&gt;Note that FIR filters are sometimes implemented using an FFT (&lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;overlap-add&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;nofollow&quot;&gt;overlap-save&lt;/a&gt;). In that case it makes sense to have power of 2 buffers lengths (depending on the FFT implementation). This is of course an example of block processing, where you have to wait for a whole block before the computation of the output signal can begin. The consequence is that you always have some latency. Sample by sample processing is possible with a time-domain implementation, where you get one output sample for each input sample. Note that a time-domain implementation is not necessarily sample-by-sample but could also be using block processing.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-20T16:30:14.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19248" PostTypeId="2" ParentId="19225" CreationDate="2014-11-20T16:53:09.263" Score="2" Body="&lt;p&gt;@Jazz, one of the things we learned in electrical engineering is that &lt;strong&gt;any&lt;/strong&gt; order of differential equation can be broken down to a set (or &quot;system&quot;) of 1st-order diff eqs.  so if trapezoidal integration, with the same &quot;time step&quot; $\Delta t$ is being used &lt;em&gt;consistently&lt;/em&gt; for all continuous-time integrals, for a $N$th-order linear ODE, you can bust that up into $N$ first-order differential equations.  then consider just one of those 1st-order diff eqs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;again, consider emulating a capacitor.  let the sampling period be $T=\frac{1}{f_\text{s}}$ be the same as the &quot;$\Delta t$&quot; used in the trapezoid rule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ i(t) = C \frac{dv}{dt} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ v(t) = \frac{1}{C} \int\limits_{-\infty}^{t} i(u) \ du $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the s-domain it's&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ V(s) = \frac{1}{s} \left( \frac{1}{C} I(s) \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so trapazoidal integration at discrete times is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;v(nT)  &amp;amp; = \frac{1}{C} \int\limits_{-\infty}^{nT} i(u) \ du \\&#xA;&amp;amp; = \frac{1}{C} \sum\limits_{k=-\infty}^{n} \quad \int\limits_{kT-T}^{kT} i(u) \ du \\&#xA;&amp;amp; \approx \frac{1}{C} \sum\limits_{k=-\infty}^{n} \frac{T}{2} \left( i(kT-T) + i(kT) \right) \\&#xA;&amp;amp; = v((n-1)T) + \frac{1}{C} \frac{T}{2} \left( i((n-1)T) + i(nT) \right)  \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or as discrete-time sample values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ v[n]  =  v[n-1] + \frac{T}{2C} (i[n] + i[n-1]) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;applying the Z transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ V(z)  =  z^{-1} V(z) \ + \ \frac{T}{2C} \left(I(z) + z^{-1} I(z) \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;solving for $V$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$   V(z) = \frac{T}{2} \frac{1 + z^{-1}}{1 - z^{-1}} \left( \frac{1}{C} I(z) \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;looks like we're substituting&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1}{s} \leftarrow \frac{T}{2} \frac{1 + z^{-1}}{1 - z^{-1}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s \leftarrow \frac{2}{T} \frac{z-1}{z+1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is precisely what the bilinear &lt;em&gt;without&lt;/em&gt; compensation for frequency warping does.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-11-20T17:15:32.670" LastActivityDate="2014-11-20T17:15:32.670" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19249" PostTypeId="1" CreationDate="2014-11-20T17:25:12.077" Score="2" ViewCount="95" Body="&lt;p&gt;Our team develops an application that, in some feature, connects to a scanner (via TWAIN or WIA) and scans a document, and makes a PDF file out of it. The application is mostly used to process mail or documents with few images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We recently noticed that the PDF files generated by our application are four times larger (speaking of file size) than those generated by the scanner software, although similar scanner parameters are used (resolution, color, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I delved into the generated pdf files and this is what I got:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;With MuPDF component &lt;code&gt;mutool.exe&lt;/code&gt; I got information about the objects inside the PDFs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Our PDF contains one image (not surprising, it is made directly from the result of the scan):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ DCT ]      3302x4668 8bpc DevRGB&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The PDF file generated by the scanner software contains two images (aha!, this is more surprising), that differ in size and, that do not have the same color profile:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ DCT ]      1650x2334 8bpc DevRGB&#xA;[ CCITTFax ] 3176x4512 1bpc ImageMask&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Still using &lt;code&gt;mutool&lt;/code&gt;, I extracted the two images from the PDF generated by the scanner software:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The first image is what we could call the “Background”: here are a thumbnail of it, and a detail at 100% size:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/KZT3i.png&quot; alt=&quot;thumbnail&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/9kAoS.png&quot; alt=&quot;detail&quot;&gt;&lt;/li&gt;&#xA;&lt;li&gt;The second image is a pure B&amp;amp;W (1 bit per pixel) layer, with mostly black; here is a detail at 100% size:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/dkxgv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So it appears that the software that the scanner comes with uses an algorithm that detects that the document is mostly black and white, and then decomposes the image in two parts that it overlays; the first part consists of small details that can be downsampled (and therefore take less space), and the second part consists of only black or white dots, and with which better compression can be achieved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: how can we do something similar?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11791" LastActivityDate="2015-01-19T19:52:17.920" Title="Decompose an image into better compressible components" Tags="|image-processing|compression|decomposition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19251" PostTypeId="1" AcceptedAnswerId="19254" CreationDate="2014-11-20T17:41:29.923" Score="4" ViewCount="821" Body="&lt;p&gt;I have the following problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to detect changes between two more or less similar image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BVp1z.jpg&quot; alt=&quot;Before&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eta5Q.jpg&quot; alt=&quot;After&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, I want to detect the missing parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets assume that the displacement is no more that 2px, and there is no significant change in light (but there is some) or camera pose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want as an output, is a binary image about if there is a signifiacant change at that position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My naive idea was, to apply blur (aroud the size of expected displacement), and compare pixelwisely, but in practice its not working really well. (mainly it has a huge amount of noise around edges)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1y7oC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any better idea for this problem?&lt;/p&gt;&#xA;" OwnerUserId="11581" LastActivityDate="2018-07-13T10:39:47.537" Title="Detecting changes between two similar images" Tags="|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19253" PostTypeId="2" ParentId="19225" CreationDate="2014-11-20T18:06:47.963" Score="6" Body="&lt;p&gt;here is a quick look at how the 5 degrees of freedom for the parametric EQ can be viewed.  it's my take on what Knud Christensen of tc electronic came up with about a decade ago at &lt;a href=&quot;http://www.aes.org/e-lib/browse.cfm?elib=12429&quot; rel=&quot;nofollow&quot;&gt;an AES convention&lt;/a&gt; and &lt;a href=&quot;http://www.google.com/patents/WO2004054099A1&quot; rel=&quot;nofollow&quot;&gt;this patent&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, forget about the Cookbook (and the issues of Q and bandwidth therein) and consider (in the s-plane) the parametric EQ as the sum of a bandpass filter (with a $Q$ value) in parallel with a wire:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(s) = (G_\text{boost} - 1)\frac{\frac{1}{Q}\frac{s}{\omega_0}}{\left(\frac{s}{\omega_0}\right)^2 + \frac{1}{Q}\frac{s}{\omega_0} + 1} + 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$G_\text{boost} = 10^{\frac{dB}{20}}$ is the gain of the peak (or valley, if $dB&amp;lt;0$).  the gain at DC and at Nyquist is 0 dB. that's a 2nd-order IIR and there are 3 independent parameters. 2 more to go.  so we next add an overall gain parameter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(s) = G_0 \left((G_\text{boost} - 1)\frac{\frac{1}{Q}\frac{s}{\omega_0}}{\left(\frac{s}{\omega_0}\right)^2 + \frac{1}{Q}\frac{s}{\omega_0} + 1} + 1 \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that's 4 knobs to twist.  one more knob to add (without raising the filter order) and we will be done with adding more independent parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so what Knud does here is replace that &quot;wire&quot; (that trailing &quot;$1$&quot; in the transfer function) with a prototype shelving filter that &lt;strong&gt;must&lt;/strong&gt; have the same poles, the same $Q$ and $\omega_0$ as the BPF, so that the denominator is the same.  the transfer function of that shelf is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_\text{shelf}(s) = \frac{R\left(\frac{s}{\omega_0}\right)^2 + \frac{\sqrt{R}}{Q}\frac{s}{\omega_0} + 1}{\left(\frac{s}{\omega_0}\right)^2 + \frac{1}{Q}\frac{s}{\omega_0} + 1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $R \triangleq 10^{\frac{tilt}{20}}$ and $tilt$ is the gain differential of the shelf in dB.  this is what offsets the gain at Nyquist to be different than the gain at DC.  After bilinear transformation, Nyquist gets boosted by $tilt$ dB and the gain at DC remains unchanged.  Like the $dB$ boost parameter, the $tilt$ parameter can be either positive or negative.  $G_0 \cdot R$ is the linear gain at Nyquist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;put that all together and you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;H(s) &amp;amp; = G_0 \left((G_\text{boost} - 1)\frac{\frac{1}{Q}\frac{s}{\omega_0}}{\left(\frac{s}{\omega_0}\right)^2 + \frac{1}{Q}\frac{s}{\omega_0} + 1} + H_\text{shelf}(s) \right) \\&#xA; &amp;amp; = G_0 \left((G_\text{boost} - 1)\frac{\frac{1}{Q}\frac{s}{\omega_0}}{\left(\frac{s}{\omega_0}\right)^2 + \frac{1}{Q}\frac{s}{\omega_0} + 1} + \frac{R\left(\frac{s}{\omega_0}\right)^2 + \frac{\sqrt{R}}{Q}\frac{s}{\omega_0} + 1}{\left(\frac{s}{\omega_0}\right)^2 + \frac{1}{Q}\frac{s}{\omega_0} + 1} \right) \\&#xA;&amp;amp; = G_0 \frac{R\left(\frac{s}{\omega_0}\right)^2 + (G_\text{boost}+\sqrt{R}-1)\frac{1}{Q}\frac{s}{\omega_0} + 1}{\left(\frac{s}{\omega_0}\right)^2 + \frac{1}{Q}\frac{s}{\omega_0} + 1}  \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;no matter how you look at that, this has 5 degrees of freedom and those 5 biquad coefficients are &lt;strong&gt;fully&lt;/strong&gt; defined from these 5 parameters.  doesn't matter if you map from $s$ to $z$ using the blinear transform or the trapezoidal rule (effectively the same thing) or any other method that does &lt;em&gt;not&lt;/em&gt; change the order of the filter.  you may have to fudge the definition of $Q$ or bandwidth, you may have to compensate $\omega_0$ and/or $Q$ for frequency warping effects (like you get with the blinear transform), but if you paid big bucks for something that gets you a 2nd-order IIR filter, it doesn't matter if you implement it with any Direct Form or transposed Direct Form or Lattice or Normalized Ladder or Hal Chamberlin's State-Variable or Andrew Simpson's modeling of &lt;strong&gt;linear&lt;/strong&gt; analog with trapezoidal integration, eventually you get to 5 coefficients and they can be mapped to these 5 independent parameters.  &lt;strong&gt;it's all the same.&lt;/strong&gt;  whether or not you paid money for a license or not.  the math is stronger than any claims made by whomever you are licensing from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just FYI, i solved where the true peak or valley frequency is when there &lt;strong&gt;is&lt;/strong&gt; a $tilt$ that is not zero.  the frequency where the peak or valley has been nudged over by the tilt is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega_\text{peak} \ = \ \omega_0 \ &#xA;\sqrt{ \frac{Q^2 \left(R - \frac{1}{R}\right)}{G_\text{boost}^2 - R + 2 Q^2 (R - 1)} + \\ \sqrt{\frac{G_\text{boost}^2 - \frac{1}{R} + 2 Q^2 \left(\frac{1}{R} - 1\right)}{G_\text{boost}^2 - R + 2 Q^2 (R - 1)} + \frac{Q^4 \left(R - \frac{1}{R}\right)^2}{\left(G_\text{boost}^2 - R + 2 Q^2 (R - 1)\right)^2} } } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see that when $tilt = 0$, then $R=1$ and consequently $\omega_\text{peak} = \omega_0$.   the peak gain $G_\text{boost}$ might also have to be adjusted a little and that has yet to be worked out.  a good first guess would be $G_\text{boost} \leftarrow \frac{G_\text{boost}}{\sqrt{R}}$ or maybe $G_\text{boost} \leftarrow G_\text{boost}-(\sqrt{R}-1)$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-10-13T15:56:17.480" LastActivityDate="2016-10-13T15:56:17.480" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="19254" PostTypeId="2" ParentId="19251" CreationDate="2014-11-20T18:23:04.860" Score="4" Body="&lt;p&gt;The first part of the problem that you're describing is called &lt;em&gt;registration&lt;/em&gt;. &#xA;Assuming that the displacement is indeed small, and your problem has no time limits, you can use normalized cross-correlation on the images to find the displacement. It will also take care of amount of light normalization. (That means that you are assuming that the transformation between the two images is only displacement.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you found the displacement, you can normalize both of the images by their mean intensity, and do some simple pixel-by-pixel comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideas for improvement and variations: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use keypoints descriptors and matching to find transformation between two images, to save runtime.&lt;/li&gt;&#xA;&lt;li&gt;Use different models of transformation for different scenarios - rotation for in-plane camera rotation that is orthogonal, scale for zooming scenarios, perspective for out-of-plane rotations.&lt;/li&gt;&#xA;&lt;li&gt;Use smarter comparison between the two registered images, for example, only in the places where there are edges.&lt;/li&gt;&#xA;&lt;li&gt;Create a noise model by checking your camera characteristics in order to know what is a significant change. For example, more than two standard deviations of noise.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2014-12-03T10:59:09.553" LastActivityDate="2014-12-03T10:59:09.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19255" PostTypeId="2" ParentId="19249" CreationDate="2014-11-20T18:46:11.283" Score="1" Body="&lt;p&gt;Assuming that the image is gray level (not color)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use Otsu's thresholding method to detect whether the image has bi-modal histogram.&lt;/li&gt;&#xA;&lt;li&gt;If Otsu tells you with high confidence that the image is bi-modal, use the threshold that it gave you in order to binarize the image. That is your binary mask that can be effectively packed into bits.&lt;/li&gt;&#xA;&lt;li&gt;Find the gray values of the two histogram modes, create a mask where the &quot;white&quot; color is the gray value of the second mode and &quot;black&quot; color is the value of the first mode.&lt;/li&gt;&#xA;&lt;li&gt;Subtract previously made mask from the image. These are your small changes that you can compress by using lossy compression.&lt;/li&gt;&#xA;&lt;li&gt;Save the two modes as two integers together with the document.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="698" LastActivityDate="2014-11-20T18:46:11.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19256" PostTypeId="2" ParentId="19251" CreationDate="2014-11-20T19:01:03.900" Score="1" Body="&lt;p&gt;If I were to approach the problem here's what I might try...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;convert the images to greyscale&lt;/li&gt;&#xA;&lt;li&gt;as Andrey suggested, look at the normalized cross-correlation on a subregion of the images to find the displacement.&lt;/li&gt;&#xA;&lt;li&gt;shift and crop images to adjust for displacement.&lt;/li&gt;&#xA;&lt;li&gt;blur, then down-sample &lt;/li&gt;&#xA;&lt;li&gt;compute difference between resulting images&lt;/li&gt;&#xA;&lt;li&gt;threshold the difference to create a binary image&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11618" LastActivityDate="2014-11-20T19:01:03.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19257" PostTypeId="1" AcceptedAnswerId="19259" CreationDate="2014-11-21T03:22:35.497" Score="0" ViewCount="401" Body="&lt;p&gt;I hope someone can help me understand the meaning of variance in this case. I am reading an old research paper by Ephraim and Malah (for my DSP project) and it says:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3wUq2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing that $D_k$ is the FFT of white noise, what I am trying to find out is $\lambda_d(k)$. Can anyone explain to me the meaning of $E\lbrace|D_k|^2\rbrace$? I think it is the variance of a particular $D_k$ with respect to the mean, but since this is white noise, shouldn't it be zero?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help, I am stuck!!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="11753" LastEditorUserId="11256" LastEditDate="2014-11-21T17:44:58.663" LastActivityDate="2014-11-21T17:44:58.663" Title="Variance of white noise and the STFT" Tags="|noise|speech-processing|stft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19258" PostTypeId="2" ParentId="10994" CreationDate="2014-11-21T05:21:15.397" Score="1" Body="&lt;p&gt;In your code, the &lt;code&gt;D&lt;/code&gt; matrix should be the average of the magnitude &lt;strong&gt;squares&lt;/strong&gt; of the columns. I.e the average power spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;D = diag(mean(abs(X),2));&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;D = diag(mean(abs(X).^2,2));&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="11796" LastEditorUserId="11796" LastEditDate="2014-11-21T05:36:01.983" LastActivityDate="2014-11-21T05:36:01.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19259" PostTypeId="2" ParentId="19257" CreationDate="2014-11-21T07:53:10.660" Score="1" Body="&lt;p&gt;$E\{|D_k|^2\}$ is the expected value of the squared magnitude of the noise in the $k^{th}$ frequency bin. Since they assume that the noise is zero mean, this equals the noise variance. Remember that the variance of a random variable $X$ is defined as $\sigma_X^2=E\{|X-\mu_X|^2\}$, where $\mu_X=E\{X\}$ is the mean of $X$. So if $\mu_X=0$ (as assumed here for the noise) then $\sigma^2_X=E\{|X|^2\}$. Note that $E\{|D_k|^2\}$ is also the noise power in the $k^{th}$ bin, so it can't be zero unless there is no noise at all in that bin.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-21T07:53:10.660" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="19262" PostTypeId="1" CreationDate="2014-11-21T10:05:28.250" Score="3" ViewCount="5415" Body="&lt;p&gt;I want to design a Filter with a variable Cutoff Frequency and Resonance. However in the source I'm using there is a Bi-Quad Filter with two IIR and two FIR Filters designed like this : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tBMZI.jpg&quot; alt=&quot;Biquad Filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore I found that I can compute the coefficients for the different Filter types as stated in this table :  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5zekz.jpg&quot; alt=&quot;Coefficientmatrix&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to alter those coefficients that i can compute the samples with a variant FIlter Resonance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; Since I'm designing this filter for a software synthesiser, with resonance I mean the typical boost or reduction of the cutoff-frequency in a variable manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ksvYE.gif&quot; alt=&quot;Filter Resonance&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11466" LastEditorUserId="26573" LastEditDate="2019-01-14T08:11:05.607" LastActivityDate="2019-01-14T08:11:05.607" Title="Design a Filter with Resonance" Tags="|filters|biquad|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="19263" PostTypeId="1" CreationDate="2014-11-21T10:41:58.520" Score="0" ViewCount="2210" Body="&lt;p&gt;I would like to know how $\frac T2$ came for time period in the image below.Because I think the frequncy is 1 so time period should be 1.Is that correct? or can anyone help me.&lt;img src=&quot;https://i.stack.imgur.com/f9vEi.png&quot; alt=&quot;enter image description here&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article from where I got this image is &lt;a href=&quot;http://1drv.ms/1xJ4Rs8&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11615" LastActivityDate="2016-11-08T09:38:48.530" Title="Correlation between Sin and Square wave" Tags="|frequency|correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19264" PostTypeId="2" ParentId="19263" CreationDate="2014-11-21T10:52:19.083" Score="1" Body="&lt;p&gt;Note that the second half of the period of the sinusoid is simply equal to the first half times $-1$. Since the same is true for the square wave, the multiplication of the two is the same in both intervals $[0,T/2]$ and $[T/2,T]$. That's why the integral over the whole period equals twice the integral over the first half of the period.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-11-21T11:20:51.527" LastActivityDate="2014-11-21T11:20:51.527" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="19265" PostTypeId="2" ParentId="19225" CreationDate="2014-11-21T11:55:05.190" Score="1" Body="&lt;p&gt;I've come up with a design for the 10dB peaking EQ. I've chosen 20 filters with center frequencies between 500 Hz and 16 kHz (Fs = 48 kHz). The top plot below is the design according to RBJ's &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audio-EQ-Cookbook&lt;/a&gt;, which is good but which leads to bandwidth distortion when the center frequencies get closer to Nyquist. The bottom plot is the new design where the filters very closely match the analog prototype filters:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/H2D7F.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;And this is how the new notch filters look like compared to the Cookbook (bandwidth = 4 octaves, highest &lt;span class=&quot;math-container&quot;&gt;$f_0=23$&lt;/span&gt; kHz):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xmXUU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;The following figure shows a lowpass filter design (&lt;span class=&quot;math-container&quot;&gt;$Q=2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f_0=16$&lt;/span&gt; kHz, &lt;span class=&quot;math-container&quot;&gt;$F_s=48$&lt;/span&gt; kHz). Note that the new design approximates the analog prototype and for this reason it does not perform as a conventional lowpass filter (it has no zero at Nyquist):&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pRCiu.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4346" LastEditDate="2021-11-27T22:59:41.650" LastActivityDate="2021-11-27T22:59:41.650" CommentCount="32" ContentLicense="CC BY-SA 4.0" />
  <row Id="19266" PostTypeId="2" ParentId="19242" CreationDate="2014-11-21T11:58:47.763" Score="0" Body="&lt;p&gt;Allowing for differences between Matlab and Octave ( I only have Gnu Octave to play with,) and correcting the errors noted in the comments, I get the following:&lt;img src=&quot;https://i.stack.imgur.com/fYH6C.png&quot; alt=&quot;squarewave&quot;&gt;&#xA;Needed fixes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Values for Wp and Ws divided by half of sampling rate - the cheb1ord function requires frequencies be given relative to the Nyquist frequency.&lt;/li&gt;&#xA;&lt;li&gt;Removed 's' (not allowed for Octave anyway.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To make the code work for Octave, I had to make the following changes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Remove duty cycle value from square&lt;/li&gt;&#xA;&lt;li&gt;Remove 's' from cheb1ord and cheby1&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Code for Octave (should run under Matlab as well:)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Making the square pulses&#xA;Fs = 1000000;&#xA;nyq=Fs/2;&#xA;t = 0:1/Fs:50e-4; &#xA;f = 2000;&#xA;&#xA;%square pulse with 50% duty cycle&#xA;xt = square(2*pi*f*t);&#xA;&#xA;%Making the filter&#xA;Wp = [1000/nyq 3000/nyq]; &#xA;Ws = [100/nyq 3900/nyq];&#xA;[n,Wn] = cheb1ord(Wp,Ws,3,20);&#xA;[b,a] = cheby1(n,3,Wn,'s');&#xA;&#xA;%Filtering with the coefficients &#xA;xt_filtered = filter(b,a,xt);&#xA;&#xA;%Plotting the filtered signal&#xA;subplot (211);&#xA;plot(t,xt);&#xA;subplot(212);&#xA;plot(t,xt_filtered);    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2014-11-21T12:59:13.040" LastActivityDate="2014-11-21T12:59:13.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19270" PostTypeId="2" ParentId="3245" CreationDate="2014-11-21T17:49:20.197" Score="0" Body="&lt;p&gt;Using FFT on some signal vector, you would intermix signal frequency parameters for that signal vector. e.g. for a sweep frequency signal, after FFT you would know which frequency band signal have been swapped, but you can't easily distinguish between times that each frequency peek have been occurred. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So FFT alone can't help, one solution is to use FFT on shorter windows of input signal , called &lt;strong&gt;Spectrogram&lt;/strong&gt;, so by finding maximum frequency coefficient in each spectrogram frame, you would know the main frequency of signal in the related limited window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More General you need to use &lt;em&gt;frequency tracking&lt;/em&gt; or &lt;em&gt;frequency detection&lt;/em&gt; techniques. Based on accuracy  and speed you need to measure frequencies, and also your knowledge of input signal, there are various methods out there you can use. such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- As the other answer mentioned, the most simple way should be calculating zero crossing rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- More general methods derived from basis of &lt;em&gt;&quot;FM Demodulation&quot;&lt;/em&gt; techniques. there are multiple techniques, but the simplest is to differentiate the FM modulated signal, then the sweep frequency would be modulated to amplitude of signal, so you can detect the frequency changes using an envelope detector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- There are some other advanced methods such as Phase Locked Loop, or Pseudo-spectrum techniques, like &lt;em&gt;MUSIC&lt;/em&gt;, Stochastic techniques derived from &lt;em&gt;Hidden Markov Model&lt;/em&gt; or &lt;em&gt;Extended Kalman Filter&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11426" LastActivityDate="2014-11-21T17:49:20.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19271" PostTypeId="2" ParentId="8926" CreationDate="2014-11-21T19:05:40.373" Score="1" Body="&lt;p&gt;There is now support for the bag-of-words model in the &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/image-category-classification-using-bag-of-features.html&quot; rel=&quot;nofollow&quot;&gt;Computer Vision System Toolbox for MATLAB&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-11-21T19:05:40.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19273" PostTypeId="1" AcceptedAnswerId="19275" CreationDate="2014-11-21T22:11:25.250" Score="-1" ViewCount="808" Body="&lt;p&gt;I am writing some code which takes a signal of length $n$, and processes it in 20 ms chunks with 5 ms of overlap...  So basically I have a buffer of 20 ms worth of sampled data, and I am trying to apply a Hamming window to it. For some reason, when I listen back to the audio generated from this, I am getting nothing-- and the output of my Hamming window seems to be pretty static-- values that are all somewhere near 0.07999999989377744. I am wondering, what am I doing wrong in my calculations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, assuming &lt;code&gt;s[n]&lt;/code&gt; is my 20 ms sample buffer, this is the code I'm running:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sampleRate = 44100;&#xA;frames     = (sampleRate / 1000) * 20;  // 20 ms&#xA;&#xA;for (i = 0; i &amp;lt; frames; i++) {&#xA;    hammingWindowValue = (0.54 - 0.46) * Math.cos((2 * PI * s[i]) / frames));&#xA;    s[i] = hammingWindowValue;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11807" LastEditorUserId="11256" LastEditDate="2014-11-22T12:08:37.180" LastActivityDate="2014-11-22T12:08:37.180" Title="Confusion when applying Hamming window to signal" Tags="|discrete-signals|audio|signal-analysis|c|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19275" PostTypeId="2" ParentId="19273" CreationDate="2014-11-21T22:47:09.023" Score="0" Body="&lt;p&gt;You're not applying the Hamming window correctly. You should first calculate the Hamming window values, with something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (i = 0; i &amp;lt; frames; i++) {&#xA;    hammingWindowsValue[i] = 0.54 - 0.46 * Math.cos(2*PI*i / (frames-1) );&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note the lack of parenthesis around (0.54-0.46)). Then, you should multiply your signal by the window values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (i = 0; i &amp;lt; frames; i++) {&#xA;    s[i] = hammingWindowValue[i] * s[i];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Of course, in practice that code can be simplified. I separated it into two loops to make it conceptually clearer.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In brief: when windowing a signal, you first calculate the window samples, and then multiply the window and your signal.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-11-21T22:47:09.023" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19276" PostTypeId="1" CreationDate="2014-11-21T23:30:18.997" Score="0" ViewCount="247" Body="&lt;p&gt;I have a signal with components at 1200 and 1800 Hz.  When I mix this signal with a 1500 Hz signal to create components at -300 and +300 Hz (then LPF) a DC offset presents itself when the input signal is going form 1200 to 1800 Hz at a period of 1200 Hz (msk modulated signal).  This strange affect only occurs with specific time vectors.  What could cause this?  I understand how mixing two signals at different frequencies create signals at f1+f2 and f1-f2 however where is this power at DC coming from?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is an image to show my problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bukib.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first signal is the MSK signal, the second is the 1500 Hz signal I'm mixing with it, the third is the result and the fourth is the filtered version of the result to recover only the low frequency parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I believe lies in that at certain time offsets there exists an alias of 1500 at 300 (and -300) that is destructively mixing with my msk signal and producing a dc value.  The result in the center there when you see the dc value should be a series of half sine wave pulses at 300 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can avoid this problem and recover my +/- 300 Hz signal from the msk signal?&lt;/p&gt;&#xA;" OwnerUserId="11237" LastEditorUserId="11237" LastEditDate="2014-11-24T16:40:14.533" LastActivityDate="2014-11-24T16:40:14.533" Title="Mixing two signals creates power at dc?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19277" PostTypeId="2" ParentId="19276" CreationDate="2014-11-22T01:14:21.867" Score="1" Body="&lt;p&gt;If I understand correctly, you are mixing a 1500 Hz sinusoid with an MSK signal, which uses 1200 Hz to transmit 0 (or 1) and 1800 Hz to transmit 1 (or 0). The spectrum of the MSK signal, though, is quite large and includes energy at 1500 Hz. So, when mixing, you can expect to find a DC value.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-11-22T01:14:21.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19279" PostTypeId="1" CreationDate="2014-11-22T09:22:12.017" Score="0" ViewCount="380" Body="&lt;p&gt;I am trying to design a digital ButterWorth filter for the given specifications.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;rp=3;&#xA;rs=15;&#xA;FS=1;&#xA;wp=0.5*pi;&#xA;ws=0.75*pi;&#xA;pwp=2*FS*tan(wp/2);&#xA;pws=2*FS*tan(ws/2);&#xA;[n,wn]=buttord(pwp,pws,rp,rs,'s')&#xA;[b,a]=butter(n,wn,'s');&#xA;[bn,an]=bilinear(b,a,FS);%error&#xA;freqz(bn,an,512,FS);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If I design a filter manually i am getting different values for &lt;code&gt;bn&lt;/code&gt; and &lt;code&gt;an&lt;/code&gt; but Matlab gives different answer. Can anybody please help me?&lt;/p&gt;&#xA;" OwnerUserId="11809" LastEditorUserId="7092" LastEditDate="2023-11-21T22:03:44.407" LastActivityDate="2023-11-21T22:03:44.407" Title="Digital Butterworth filter design error" Tags="|matlab|filter-design|digital-filters|butterworth|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19281" PostTypeId="2" ParentId="19279" CreationDate="2014-11-22T14:55:40.133" Score="1" Body="&lt;p&gt;I cannot run your code because I have not matlab on this pc, but I can try to give you some advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing I will check is the way you defined the cut-off frequencies. The Matlab function uses normalized frequencies (look at the examples here &lt;a href=&quot;http://it.mathworks.com/help/signal/ref/buttord.html&quot; rel=&quot;nofollow&quot;&gt;http://it.mathworks.com/help/signal/ref/buttord.html&lt;/a&gt;), which means you have to define it in this way: lets assume you want to cut your signal at 5 Hz and your sampling frequency is $Fs$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cut_freq = 5;&#xA;Wn = cut_freq/(Fs/2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course if you have a band-pass filter you have to define 2 cut-off frequencies and therefore $Wn$ will be a vector of 2 elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps. As soon as I get my laptop I will try to run your code and see what happens.&lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2014-11-22T14:55:40.133" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19282" PostTypeId="2" ParentId="19183" CreationDate="2014-11-22T18:59:47.663" Score="0" Body="&lt;p&gt;I found a thread on MATLAB Central that deals with exactly this problem: &lt;a href=&quot;http://ch.mathworks.com/matlabcentral/newsreader/view_thread/7746&quot; rel=&quot;nofollow&quot;&gt;http://ch.mathworks.com/matlabcentral/newsreader/view_thread/7746&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8053" LastActivityDate="2014-11-22T18:59:47.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19284" PostTypeId="1" AcceptedAnswerId="19287" CreationDate="2014-11-23T04:17:05.573" Score="0" ViewCount="211" Body="&lt;p&gt;I'm having a hard time trying to understand signal modulation graphics and how can I calculate/find the properties of the signal. The properties I'm talking are: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Max. amplitude&lt;/li&gt;&#xA;&lt;li&gt;Carrier frequency&lt;/li&gt;&#xA;&lt;li&gt;the time it takes to code a bit&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can I do it just observing this two graphics? If not, can I do it using matlab?  I'm a little confused since I'm used to see amplitude and frequency graphics but with bars and discrete values, not with continuous functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one of the examples I was talking and what I believe is a FSK modulation:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/b3o7x.jpg&quot; alt=&quot;Modulation and frequency spectrum grapchics&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11818" LastActivityDate="2014-11-23T17:05:51.643" Title="Calculate properties of a given Modulated Signal" Tags="|matlab|modulation|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19285" PostTypeId="2" ParentId="976" CreationDate="2014-11-23T05:25:09.983" Score="1" Body="&lt;p&gt;Try using other Blind source  separation(BSS) algorithms,even Kernel BSS could be applied to remove if it is nonlinearly mixed.&lt;/p&gt;&#xA;" OwnerUserId="11819" LastEditorUserId="7092" LastEditDate="2014-11-24T01:00:49.320" LastActivityDate="2014-11-24T01:00:49.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19287" PostTypeId="2" ParentId="19284" CreationDate="2014-11-23T17:05:51.643" Score="1" Body="&lt;p&gt;Establishing the system's parameters from time/frequency plots with absolute certainty is impossible, but you can make educated guesses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, the signal seems to be binary FSK; it seems to have continuous phase. Assuming that is correct, then you can try guessing the parameters you're interested in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Maximum amplitude: from the time plot, you can see that the amplitude is 2. The units are not specified.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Carrier frequency. The carrier could be said to be the frequency at the middle of the two frequency peaks (seems to be around 350 Hz).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bit interval. It is the time interval for which the frequency stays constant. If we assume that the bits transmitted are 1,0,1,0,1, then it seems like the bit interval is 0.015 seconds or so. Note that the bits transmitted could be 1,1,0,0,1,1,0,0,1,1 with a bit interval of 0.015/2 seconds. This is a case where complete certainty is impossible without more information about the system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-11-23T17:05:51.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19289" PostTypeId="1" CreationDate="2014-11-23T23:15:39.897" Score="5" ViewCount="2943" Body="&lt;h2&gt;I need help figuring out a way to &lt;strong&gt;automatically synchronize two audio files that are both different recordings of the same source.&lt;/strong&gt; More info below.&lt;/h2&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This example is from a concert, where there is &lt;strong&gt;only one audio source&lt;/strong&gt; - the band.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In the first track of the image below, we have three minutes of audio&#xA;recorded from the soundboard of the concert venue. This contains a&#xA;crystal clear recording of the band's performance.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the second track of the image below, we have roughly a minute and &#xA;a quarter of audio recorded using an iPhone in the crowd. This audio &#xA;still sounds ok, but is not great by any means. Still, it's very&lt;br&gt;&#xA;useable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Since both of these recordings were taken at roughly the same time of the same performance, the audio in track two synchronizes somewhere with the audio in track 1.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/djFup.png&quot; alt=&quot;Waveforms Out-Of-Sync&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The image below shows where these two snippets of audio synchronize - about the 3 second mark. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rQMt6.png&quot; alt=&quot;Waveforms in Sync&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I know that it's pretty easy to synchronize these two audio files up by hand and by ear, but I need to develop a script that synchronizes the two snippets automatically.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The Spectrogram and Spectrogram Log match up pretty well. I'm not sure if I can work with that or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the spectrogram comparison:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/x7gEU.jpg&quot; alt=&quot;Spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Along with the spectrogram log comparison:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4yVJi.png&quot; alt=&quot;Spectrogram Log&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I've looked into &lt;a href=&quot;http://www.youtube.com/watch?v=RO8s1TrElEw&quot; rel=&quot;noreferrer&quot;&gt;Cross-Correlation of Waveforms using this video&lt;/a&gt;, FFT stuff, and other libraries. I'm lost and any help for my college project would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="11824" LastActivityDate="2016-04-08T15:15:53.413" Title="Find Short Clip of Audio Within Longer Clip Of Audio" Tags="|fft|audio|correlation|" AnswerCount="6" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19291" PostTypeId="1" AcceptedAnswerId="19303" CreationDate="2014-11-24T07:20:04.503" Score="2" ViewCount="3580" Body="&lt;p&gt;I have the output of a time series  &lt;code&gt;y(t)&lt;/code&gt; which is a vector  for &lt;code&gt;t = 1,2,...m&lt;/code&gt; denoting the number of data points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: If &lt;code&gt;E[y(t)]&lt;/code&gt; = mean of a process &lt;code&gt;y&lt;/code&gt;. This can be invoked using the command &lt;code&gt;mean(y)&lt;/code&gt; or &#xA;writing the statement&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m = size(y,1);&#xA;Expectation_y = sum(y)/m;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, how &#xA;do I  find the Expectation of the following expression as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; [E[y(t-1)*y(t-1)']]^-1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These kinds of related Expressions are found in the &#xA;&lt;a href=&quot;http://www.uio.no/studier/emner/matnat/ifi/INF4480/v10/undervisningsmateriale/spII_stocastic_processesIII_handout.pdf&quot; rel=&quot;nofollow&quot;&gt;Slide2&lt;/a&gt; mentions the Autocorrelation matrix. In the formula, there is the Expectation operator. So how do I implement the expectation of the product of the lagged random variable with itself and other such expressions without using the inbuilt commands?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is how do I implement them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: My confusion is what is the different between $E[\sum_{t = 1}^ N y(t-1)*y(t-1)^T]$ and expression  $E[y(t-1)*{y(t-1)}^T]$ which looks like the Autocorrelation of the lag and again how to implement them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="750" LastActivityDate="2014-11-25T18:32:54.560" Title="Matlab: How do I implement the Expectation operator for time series" Tags="|matlab|discrete-signals|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19294" PostTypeId="1" AcceptedAnswerId="19905" CreationDate="2014-11-24T15:12:37.397" Score="1" ViewCount="1671" Body="&lt;p&gt;I am having a very hard time to implement the DCT algorithm. I have quite a few requirements like it has to work with NxN matrix or at least power of 2, it has to be 2D, it has to produce same output as FFTW fftwf_plan_r2r_2d(FFTW_REDFT10) it has to use real data and I need DCT I, II and III. And it has to be fast!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I could use FFT to compute DCT and wikipedia mentions this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;One can also compute DCTs via FFTs combined with O(N) pre- and post-processing steps. In general, O(N log N) methods to compute DCTs are known as fast cosine transform (FCT) algorithms.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are those 2 steps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If I use Apples vDSP library is that even a good idea? since it needs an array twice as big as the DCT array (2N with radix2). And also vDSP is 1D only so I would end up doing it for each row and column to get a 2D result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Is it possible to use an algorithm that works on 8x8 blocks and adapt it for my needs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am very new to learning about DSP so any help is appreciated! Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps: Does anyone have any sample code for what I need? would help me a lot&lt;/p&gt;&#xA;" OwnerUserId="11832" LastEditorUserId="11832" LastEditDate="2014-11-24T15:18:21.223" LastActivityDate="2015-01-09T11:54:33.070" Title="Working with the DCT" Tags="|dct|real-time|2d|1d|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19295" PostTypeId="1" AcceptedAnswerId="19299" CreationDate="2014-11-24T16:32:32.947" Score="1" ViewCount="892" Body="&lt;p&gt;I would like to hear how &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;aliasing&lt;/a&gt; sounds like. How can I get this with Audacity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I was told that I should adjust the Fourier coefficients in Audacity. I have no idea where I can do so / how I should adjust them.)&lt;/p&gt;&#xA;" OwnerUserId="9101" LastActivityDate="2014-11-24T21:23:02.533" Title="How can I enforce aliasing with Audacity?" Tags="|audio|aliasing|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19296" PostTypeId="1" CreationDate="2014-11-24T16:41:37.940" Score="0" ViewCount="413" Body="&lt;p&gt;I have some noisy data that looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/irrux.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the components that are symmetric and antisymmetric with respect to magnetic field. The first thing I tried was just using:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Symmetric part $= \displaystyle \frac{1}{2}\left[y(x) + y(-x)\right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Antisymmetric part $= \displaystyle \frac{1}{2}\left[y(x) - y(-x)\right]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which gives this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/WD2UN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't totally horrible since I was expecting the antisymmetric part to be linear with approximately this slope. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: Is there a better way to do this, possibly by using an FFT to break this into sine and cosine components?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Edit: Fixed math)&lt;/p&gt;&#xA;" OwnerUserId="11833" LastEditorUserId="1629" LastEditDate="2014-11-24T20:05:45.510" LastActivityDate="2014-11-24T20:05:45.510" Title="Best way to reduce data to its symmetric and antisymmetric components" Tags="|fft|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19298" PostTypeId="1" CreationDate="2014-11-24T17:45:57.743" Score="1" ViewCount="441" Body="&lt;p&gt;I need to compute the amplitude of a certain frequency band as the input to a PID algorithm.  My system looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Sine Generator] -&amp;gt; [Actuator] -&amp;gt; [Physical complex coupling] -&amp;gt; [Sensor]&#xA;  ^                                                                 |&#xA;  |                                                                 |&#xA;  +--[PID Control Algorithm] &amp;lt;---- [FFT Amplitude computation] &amp;lt;----+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The PID controller adjusts the amplitude of the sine wave until the sensor and FFT register the correct amplitude in the output signal.  In order to have a performant system, I need to compute the amplitude as quickly as possible so that the PID controller can make adjustments based on the most recent events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In normal analysis, I would use data from the future to calculate the amplitude at a given point in time, but that information is not available when I need it.  As a result, the input data is all from the past. (Also, during the initial start-up of the system, I have no data at all!) The number of missed cycles is dependent on my window size - for accuracy, I would like it to be as large as possible, but for latency, I would like it to be as small as possible (I have abundant processing power, that's not  a significant constraint yet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to windowing, the dominant samples used as input to the FFT are several cycles before the present time and the most recent, most important samples are only very slightly weighted.  The obvious solution would be to adjust the windowing function such that the most recent cycles are heavily weighted - essentially, using just one side of a windowing function.  However, this does not seem to preserve the desired effects of the windowing function, as explained (somewhat circuitously) in this question: &lt;em&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2337/fft-with-asymmetric-windowing&quot;&gt;FFT with asymmetric windowing?&lt;/a&gt;&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried inverting and mirroring the data, which works when the input signal is a pure sine wave (of varying amplitude) at a zero-crossing, but introduces artifacts at other times.  I've begun looking into the Goertzel algorithm and sliding DFTs, but those seem to only improve the difficulty of the computation and not the latency of the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I reduce the lag associated with sampling a real-time signal?&lt;/p&gt;&#xA;" OwnerUserId="11799" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-11-24T17:45:57.743" Title="Reducing latency due to FFT windowing for a real-time signal" Tags="|fft|window-functions|real-time|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19299" PostTypeId="2" ParentId="19295" CreationDate="2014-11-24T20:28:21.207" Score="1" Body="&lt;p&gt;Here's a Python script that does what Matt L said:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/env python&#xA;# -*- coding: utf-8 -*-&#xA;&#xA;&quot;&quot;&quot;Enforce aliasing by reducing an audio-file to every n'th frame.&quot;&quot;&quot;&#xA;&#xA;from scipy.io.wavfile import read, write&#xA;&#xA;&#xA;def main(inputFilename, outputFilename, n):&#xA;    rate, data = read(inputFilename)&#xA;    write(outputFilename, rate/n, data[::n])&#xA;&#xA;&#xA;if __name__ == &quot;__main__&quot;:&#xA;    from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter&#xA;    parser = ArgumentParser(description=__doc__,&#xA;                            formatter_class=ArgumentDefaultsHelpFormatter)&#xA;    parser.add_argument(&quot;-i&quot;, &quot;--input&quot;, dest=&quot;inputfile&quot;,&#xA;                        help=&quot;input WAV file&quot;, metavar=&quot;FILE&quot;)&#xA;    parser.add_argument(&quot;-o&quot;, &quot;--output&quot;, dest=&quot;outputfile&quot;,&#xA;                        help=&quot;output WAV file&quot;, metavar=&quot;FILE&quot;)&#xA;    parser.add_argument(&quot;-n&quot;,&#xA;                        dest=&quot;n&quot;, default=2, type=int,&#xA;                        help=&quot;every n'th frame gets played&quot;)&#xA;    args = parser.parse_args()&#xA;    main(args.inputfile, args.outputfile, args.n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It might not be audible at factor = 2.  Try other powers of 2.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="9101" LastEditDate="2014-11-24T21:23:02.533" LastActivityDate="2014-11-24T21:23:02.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19300" PostTypeId="1" CreationDate="2014-11-24T20:56:17.417" Score="0" ViewCount="8313" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TnL2d.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determine $X(\omega)$.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$g(t)$: I understand how to create a box from [-1,1] of amplitude 1/2.&lt;/li&gt;&#xA;&lt;li&gt;$x(t) = g(t) * g(t)$&lt;/li&gt;&#xA;&lt;li&gt;$X(\omega) = G(\omega)G(\omega)$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;the solution I am seeing says that $G(\omega) = \frac{2\sin(\omega)}  {2\omega}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand where $\sin$ came from and that the values of the 2s correlate to. I've seen proofs, but can someone provide a simple explanation of what the variables are. Thanks&lt;/p&gt;&#xA;" OwnerUserId="11120" LastEditorUserId="4298" LastEditDate="2014-11-25T08:23:17.093" LastActivityDate="2014-12-26T09:07:51.080" Title="Fourier transform of triangular function" Tags="|fourier-transform|continuous-signals|homework|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19301" PostTypeId="2" ParentId="19294" CreationDate="2014-11-24T22:58:52.350" Score="0" Body="&lt;p&gt;While this is not much of an answer, here's a few comments while you wait for an expert to reply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is one of your first DSP projects, it might be a bit ambitious just to dive straight into the fast implementations - you might want to start out with a naive implementation and then work your way up to the faster algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the FFT-based approaches, you could check out how scipy does it:&#xA;&lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.fftpack.dct.html&quot; rel=&quot;nofollow&quot;&gt;http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.fftpack.dct.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a lot of papers on the subject, but they might be a bit tricky to chew through. A couple of examples through some brief searches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cin.ufpe.br/~vak/tg/papers/Chen-dct.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cin.ufpe.br/~vak/tg/papers/Chen-dct.pdf&lt;/a&gt; (1977 paper on a fast DCT)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://arxiv.org/pdf/1203.3442.pdf&quot; rel=&quot;nofollow&quot;&gt;http://arxiv.org/pdf/1203.3442.pdf&lt;/a&gt; (fast DCT-II)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It would probably be easier to understand from a book - I recall reading about the DCT and some fast algorithms with pretty elaborate explanations in &quot;JPEG Still image data compression standard&quot; by W. B. Pennebaker and J. L. Mitchell (I'm sure you can find loads of books on the DCT, specifically, though).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this seems to be how they do it over at FFmpeg: &lt;a href=&quot;http://www.ffmpeg.org/doxygen/2.1/dct_8c_source.html&quot; rel=&quot;nofollow&quot;&gt;http://www.ffmpeg.org/doxygen/2.1/dct_8c_source.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3829" LastActivityDate="2014-11-24T22:58:52.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19303" PostTypeId="2" ParentId="19291" CreationDate="2014-11-25T00:17:45.003" Score="1" Body="&lt;p&gt;I'm not sure I understand the question. If I'm missing something, leave a comment and I'll try to edit/expand/clarify as needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, &quot;mean&quot; and &quot;expected value&quot; are related concepts, but are not the same thing. You find the mean of a set of samples, or observations. If you sampled/observed properly, the mean will be close to the expected value, which is the theoretical, &quot;true mean&quot; of the underlying random process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you sample a random process, you end up with a set of random numbers. If you sample the same process again, you end up with a &lt;em&gt;different&lt;/em&gt; set of numbers. So, you can think of each sample as a random variable (a black box that produces random numbers); the random process is then a sequence of random variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These random variables may be correlated; that means, intuitively, that if one of them has a certain value, you can use it to predict the values of some of the other samples. For example, you may find that if one sample is positive, its neighboring samples tend to be positive too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your question you say that you have one set of samples, &lt;code&gt;y(t)&lt;/code&gt;. In general, you don't have enough information to generate the correlation matrix. However, you could do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = length(y);&#xA;C = zeros(M,M);&#xA;for i = 1:M&#xA;    for j = 1:M&#xA;        C(i,j) = mean(y(i)*y(j));  % Note that the mean is useless here,&#xA;                                   % since y(i)*y(j) is scalar&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To find a closer approximation to the actual correlation matrix of the underlying process, you need to gather many observations. Let's say that you have stored the observations in the rows of a matrix &lt;code&gt;Y&lt;/code&gt; (every row is a different set of observations). Then you could do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = size(Y,2);&#xA;C = zeros(M,M);&#xA;for i = 1:M&#xA;    for j = 1:M&#xA;        C(i,j) = mean(Y(:,i).*Y(:,j));  &#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To test this, let's try sampling a Gaussian process of zero mean and variance 1. Every time I look at the process, I'll gather three samples, and I'll look at the process 1000 times:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = randn(1000,3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I run the code above with matrix &lt;code&gt;Y&lt;/code&gt;, I obtain this correlation matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.9598    0.0590    0.0238&#xA;0.0590    0.9675   -0.0286&#xA;0.0238   -0.0286    1.0055&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is expected (the &quot;true&quot; correlation matrix is the identity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding calculating a time shift in Matlab, it's helpful to arrange vectors in a table as follows (I've assumed $t=1,2,\ldots$ and $y(t)=10t$):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t    | y(t)  |  y(t-1)  | y(t-2) &#xA;     |       |          |&#xA;1    |  10   |  --      | --&#xA;2    |  20   |  10      | --&#xA;3    |  30   |  20      | 10&#xA;4    |  40   |  30      | 20&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's clear from the table that, to find &lt;code&gt;yn=y(t-n)&lt;/code&gt;, you cut &lt;code&gt;n&lt;/code&gt; elements from the end of &lt;code&gt;y&lt;/code&gt;, and shift the time vector:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tn = t(n:end);    % shifted time vector&#xA;yn = y(1:end-n);  % shifted signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following code provides an example, which doesn't assume integer time or integer delay:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = 0:0.1:3;  % time vector&#xA;y = exp(t/5); % y(t)&#xA;n = 0.8;      % time delay&#xA;tn = t(t&amp;gt;n);  % delayed time vector&#xA;yn = y(1:length(tn));  % delayed signal&#xA;plot(t,y,'r',tn,yn,'g');  % plot&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This produces the following plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/msOgB.png&quot; alt=&quot;Plot&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2014-11-25T18:32:54.560" LastActivityDate="2014-11-25T18:32:54.560" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19304" PostTypeId="1" AcceptedAnswerId="19342" CreationDate="2014-11-25T00:47:52.303" Score="1" ViewCount="119" Body="&lt;p&gt;I have software that tracks an object moving (in the x-dimension only) across a video shot from a stationary camera. I need to find the velocity and acceleration of the object as functions of time. This calculation can be done offline, so there are no real-time constraints. The motion of the object is also pretty regular, decelerating approximately constantly throughout the duration of motion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally I would design an FIR differentiator to do the job, however the object in the video becomes occluded for up to a few frames at a time on a regular basis throughout it's motion, so I don't have a point for it for several frames. In other words, my data looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;frame_index = [1 2 3 6 7 8 9 13 14 15 16 17 18 21 22 ... ]&#xA;x_position  = [0 0.2 0.39 1.14 1.22 ... ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've thought about interpolating and then using an FIR differentiator but am unsure what a good scheme for interpolating irregular data like this would be. I've also thought about using a formulation based on Lagrange interpolating polynomials to calculate derivatives directly, but do not know enough about them to understand trade-offs. My goal is accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what would be the best way to go about calculating approximations of the first and second derivatives of the data?&lt;/p&gt;&#xA;" OwnerUserId="11796" LastEditorUserId="11796" LastEditDate="2014-11-26T14:05:23.227" LastActivityDate="2014-11-26T16:18:52.807" Title="Derivative of signal with missing samples" Tags="|discrete-signals|interpolation|derivative|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19306" PostTypeId="1" AcceptedAnswerId="19309" CreationDate="2014-11-25T01:55:23.203" Score="0" ViewCount="109" Body="&lt;p&gt;I have implemented a pre-emphasis filter by the following (pseudo) code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = 0.5;&#xA;s1[0] = s[0];&#xA;&#xA;for (n = 1; n &amp;lt; N; n++) {&#xA;  s1[n] = (s[n-1] * a) + s[n]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem I am finding is that due to summing, there is clipping happening.  I thought the solution would be to find the difference between the max value in s1[n] and 1.0 and then subtract s1[n] by that amount...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, that results in my audio turning into complete garbage, which I am confused as to why........  Subtracting a constant amount from an entire signal should simply lower it's amplitude by that amount, correct?&lt;/p&gt;&#xA;" OwnerUserId="11807" LastActivityDate="2014-11-25T05:43:39.870" Title="resolving clipping audio issues" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19307" PostTypeId="1" AcceptedAnswerId="19313" CreationDate="2014-11-25T02:15:36.427" Score="0" ViewCount="241" Body="&lt;p&gt;I am trying to implement an algorithm proposed in an old research paper by Ephraim and Malah for my DSP course project. I hope someone can help me with this difficult question. For the clean signal Amplitude Estimator, they used the following equation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AQqjc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand most of the variables in the equation except the Bessel function stuff. Why did they use a Bessel function in here? &#xA;and most importantly, how can I implement it in Matlab?&lt;/p&gt;&#xA;" OwnerUserId="11753" LastActivityDate="2014-11-25T08:05:21.590" Title="modified Bessel function for Speech enhancement Using MMSE in matlab" Tags="|matlab|stft|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19309" PostTypeId="2" ParentId="19306" CreationDate="2014-11-25T02:57:01.430" Score="0" Body="&lt;p&gt;Subtracting a constant value from all of your samples will just cause all the clipping to happen at -1, and will give you some nasty distortion. The proper way to remove clipping is to normalize the samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep track of the max value of s1 in your loop, then in a second loop divide all of of your points by the max value, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = 0.5;&#xA;s1[0] = s[0];&#xA;max_s1 = 0;&#xA;mean = 0;&#xA;&#xA;for (n = 1; n &amp;lt; N; n++) {&#xA;    s1[n] = (s[n-1] * a) + s[n]&#xA;    if (abs(s1[n]) &amp;gt; max_s1) {&#xA;        max_s1 = abs(s1[n]);&#xA;    }&#xA;    mean += s1[n];&#xA;}&#xA;mean /= N;&#xA;max_s1 -= mean;&#xA;for (n = 0; n &amp;lt; N; n++) {&#xA;    s1[n] = (s1[n] - mean) / max_s1;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: For bonus points your can also subtract the mean from your filtered signal prior to doing the normalization. This will ensure you get maximum level without distortion from clipping.&lt;/p&gt;&#xA;" OwnerUserId="11796" LastEditorUserId="11796" LastEditDate="2014-11-25T05:43:39.870" LastActivityDate="2014-11-25T05:43:39.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19311" PostTypeId="1" AcceptedAnswerId="19317" CreationDate="2014-11-25T06:49:56.473" Score="11" ViewCount="17409" Body="&lt;p&gt;For STFT, we impose window of certain size onto the original signal, then we perform fft on each window. The uncertanty about frequency and time is determined by the width of the window, however, I can't understand what is the point of having overlap windows...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have a signal, for instance, why can't we just divide the signal into 6 trunks (non-overlapping window), and then we perform fft on each of those trunks? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe let me make it more clearly in my application. I am going to mostly dealing with 60Hz power line wave, and occationally, we want to monitor the 180Hz transient effect at the power line. Since the signal will be mostly periodic, should I use window then?&lt;/p&gt;&#xA;" OwnerUserId="11260" LastEditorUserId="50076" LastEditDate="2023-06-05T10:27:39.453" LastActivityDate="2023-06-05T20:50:36.917" Title="STFT: why overlapping the window?" Tags="|fourier-transform|window-functions|stft|time-frequency|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19312" PostTypeId="1" CreationDate="2014-11-25T08:01:09.943" Score="1" ViewCount="538" Body="&lt;p&gt;Do you know of any algorithms for audio processing that make use of peaks in auto-correlation function? I am currently involved in research on mapping methodology for dynamic algorithms. I came recently over an algorithm for detection of fundamental frequency in audio signals, which has a dynamic structure I am looking for - the execution time of the algorithm varies with the number of peaks in the signal's auto-correlation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;while (i &amp;lt; hsize)&#xA;&#xA;    // Search for peaks in auto-correlation:&#xA;    if((r[i] &amp;gt; 0) &amp;amp;&amp;amp; (r[i]&amp;gt;r[i-1]) &amp;amp;&amp;amp; (r[i]&amp;gt;=r[i+1])){&#xA;&#xA;            temp = 0.25f*(r[i+1]-r[i-1]);&#xA;            temp = r[i] - temp*temp/(0.5f*(r[i+1]+r[i-1]) - r[i]);&#xA;            n = n1[i] + n2[i];&#xA;            if ((rmax*n) &amp;lt; (temp*nmax)) {imax=i; rmax=temp; nmax=n;}.&#xA;&#xA;            i++;}&#xA;    else{i++;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This would be perfect as a studying example for my methodology, but the problem is that there is only a couple of lines inside the loop, so the overhead of adding my techniques becomes too big for the problem of this size. Now I am wondering if there exist any similar algorithms in audio processing, i.e. also making use of peaks in auto-correlation function but perform more extensive calculations for each peak?&lt;/p&gt;&#xA;" OwnerUserId="11843" LastEditorUserId="8202" LastEditDate="2014-11-25T13:18:39.170" LastActivityDate="2015-03-26T11:12:16.383" Title="Uses of peaks in audio auto-correlation" Tags="|audio|autocorrelation|peak-detection|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19313" PostTypeId="2" ParentId="19307" CreationDate="2014-11-25T08:05:21.590" Score="0" Body="&lt;p&gt;The Bessel function just turns up as a result of the MMSE estimation problem given the assumed statistical model (cf. Appendix A of the paper). This modified Bessel function is implemented in Matlab as &lt;a href=&quot;http://nl.mathworks.com/help/matlab/ref/besseli.html&quot; rel=&quot;nofollow&quot;&gt;besseli&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-25T08:05:21.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19315" PostTypeId="1" AcceptedAnswerId="19359" CreationDate="2014-11-25T08:33:16.137" Score="1" ViewCount="722" Body="&lt;p&gt;I am studying the meaning of the power spectral density (PSD) and I am wondering whether I can see from the PSD of the input signal and output signal if a system is a LTI system?&lt;/p&gt;&#xA;" OwnerUserId="11556" LastEditorUserId="11556" LastEditDate="2014-11-26T11:26:19.900" LastActivityDate="2014-11-28T19:46:36.673" Title="Can I see from the PSD if a system is a LTI system?" Tags="|linear-systems|power-spectral-density|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19316" PostTypeId="2" ParentId="13899" CreationDate="2014-11-25T09:06:40.680" Score="0" Body="&lt;p&gt;This is not a proper answer, but I am not yet allowed to leave comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to convert your PSD into time history I think you could find useful to visit this website &lt;a href=&quot;http://www.vibrationdata.com/software.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.vibrationdata.com/software.htm&lt;/a&gt; . In the 'Random Vibration' section you can download a MATLAB .m file which does that conversion. It might be useful to have a look at it to understand how it works &lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2014-11-25T09:06:40.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19317" PostTypeId="2" ParentId="19311" CreationDate="2014-11-25T09:07:23.673" Score="12" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;We always want to apply some kind of a window function in order to minimize the effect of leakage. This makes rectangular window (lack of any windowing) case never used, this is why:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Any tapering function used is almost always decreasing to zero at boundaries.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/QUigc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This is why we are losing some data. In order to retrieve that somehow you will usually do 50% of overlap when processing. This will retrieve whatever was in between.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4apGY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Another thing is that if you apply the Inverse STFT, you should use complementary window, that is summing to 1, i.e. Hanning with 50%.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Finalising - yes, you should pretty much always use windowing in your applications.&lt;/p&gt;&#xA;&lt;p&gt;For more comprehensive informations please refer to great white-paper:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://pure.mpg.de/pubman/faces/ViewItemOverviewPage.jsp?itemId=item_152164&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Heinzel G.&lt;/strong&gt; - &lt;em&gt;&lt;strong&gt;Spectrum and spectral density estimation by the DFT,&#xA;including a comprehensive list of window functions and some new&#xA;flat-top windows&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2023-06-02T17:45:52.270" LastActivityDate="2023-06-02T17:45:52.270" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="19318" PostTypeId="2" ParentId="19300" CreationDate="2014-11-25T10:27:36.527" Score="0" Body="&lt;p&gt;OK, so you understand that the signal $x(t)$ is given by the convolution of two rectangular functions extending from $-1$ to $1$ with a height of $1/2$. The only thing that is left to do is determine the Fourier transform of this rectangular function. You can do this very easily by applying the definition of the Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega)=\int_{-\infty}^{\infty}g(t)e^{-j\omega t}dt=\frac12\int_{-1}^{1}e^{-j\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure you can solve this integral yourself. The sine function comes into play because&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin\omega = \frac{e^{j\omega}-e^{-j\omega}}{2j}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the Fourier transform of $x(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=G^2(\omega)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-25T10:27:36.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19320" PostTypeId="2" ParentId="19289" CreationDate="2014-11-25T13:33:54.817" Score="0" Body="&lt;p&gt;You can use this offline &lt;a href=&quot;http://labrosa.ee.columbia.edu/matlab/audfprint/&quot; rel=&quot;nofollow&quot;&gt;matlab package&lt;/a&gt; by Dan Ellis. I guess you'll figure out how to use it for your problem on reading his descriptive documentation. Good luck.&lt;/p&gt;&#xA;" OwnerUserId="11050" LastActivityDate="2014-11-25T13:33:54.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19321" PostTypeId="2" ParentId="19289" CreationDate="2014-11-25T15:42:03.747" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;http://labrosa.ee.columbia.edu/matlab/audfprint/&quot; rel=&quot;nofollow noreferrer&quot;&gt;AUDFPRINT&lt;/a&gt; Matlab package referenced by @Yakku could be used to do what you need - if all you are after is the proper offset (and sampling rate correction.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking to implement this yourself, then the &lt;a href=&quot;http://www.ee.columbia.edu/~dpwe/papers/Wang03-shazam.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shazam&lt;/a&gt; algorithm referenced by @Emre would be one way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AUDFPRINT seems to be an implementation of the Shazam algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source for AUDFPRINT is available at the referenced site, so that it would be possible for you to look at an implementation of the Shazam algorithm to see how the algorithm can be translated to (Matlab) code. If you don't have access to Matlab, there are also tips on using AUDFPRINT with Gnu Octave, which is a free system that is (in large part) comaptible with Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would like to develop your own solution, then cross correlation would be an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab and Octave both provide the xcorr method to compute the cross correlation.  From the peaks in the result from xcorr you can find the best match and use that to synchronize your two files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in implementing your own cross correlation, this &lt;a href=&quot;https://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar/739#739&quot;&gt;dsp.stackexchange.com question&lt;/a&gt; has a lot of good information on the algorithm and its implementation.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-11-25T15:42:03.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19322" PostTypeId="2" ParentId="19315" CreationDate="2014-11-25T16:22:32.760" Score="-1" Body="&lt;p&gt;Yes, the PSD of a time signal can give you infos about the linearity of the system under study.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, assume you are studying a symmetric duffing's oscillator described by the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$m \ddot{x} + c \dot{x} + k x + k_2 x^3 = p(t) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p(t) = A \sin{\omega t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you compute the PSD of the acceleration signal you will see a peak at the excitation frequency and then some harmonics generated by the non linearity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the nonlinearity is odd, the harmonics will be at odd multiples of the excitation frequency, so if $\omega$ is the excitation frequency, the harmonics will be at $3\omega$,  $5\omega$ and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For linear system these harmonics are not present, because the response of a linear system excited by a monoharmonic signal will be monoharmonic at the same frequency (after transients have died out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you to read the book written by Worden and Tomlinson if you are interested in nonlinear dynamics.&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="11580" LastEditDate="2014-11-25T16:54:08.430" LastActivityDate="2014-11-25T16:54:08.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19323" PostTypeId="1" CreationDate="2014-11-25T17:43:34.247" Score="0" ViewCount="1829" Body="&lt;p&gt;I've been lurking around these forums for a while and they've been a great help to me in the past. However, I've been researching this problem for the past 2 days or so and can't seem to find a solution even though I feel it should be fairly simple. What I want to do is read in the audio stream, and essentially ignore every frequency except for a specific one (or range), the particular one isn't really important at the moment. Anyways, I want to be able to detect when this frequency reaches a certain magnitude (ie the pi recognizes the frequency is playing) and record the time its detected. About I'll I've been able to figure out so far is how to record a wav file from the terminal using the arecord command. I seem to understand that I need to perform an fft on that file and read the magnitude of the corresponding frequency range, but I've hit a brick wall in attempting this. Any help would be greatly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;EDIT&lt;/em&gt;&#xA;Sorry, I am not allowed to comment until I have a minimum of 50 posts, and I've found that most forum type sites I use do not notify the others in the conversation of the change. As for the multiple accounts, one I created on stack exchange, and the next time I logged in I clicked the google log in and not the stack exchange one. I apologize for any inconvenience and appreciate you moving my mistaken answer box to the correct location. I'd appreciate it if you cold direct me in deleting one of the accounts, but more importantly how to get numeric level for a specific frequency(or range) for either a wav file or input stream in python haha :).&lt;/p&gt;&#xA;" OwnerUserId="11850" LastEditorUserId="11851" LastEditDate="2014-11-26T19:34:34.963" LastActivityDate="2014-11-26T19:34:34.963" Title="Detect Frequency of Incoming Audio on Raspberry Pi" Tags="|fft|frequency-spectrum|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19327" PostTypeId="1" AcceptedAnswerId="19335" CreationDate="2014-11-26T00:45:40.550" Score="2" ViewCount="1350" Body="&lt;p&gt;I have used an MMSE STSA estimator to obtain the magnitude of an audio signal. The original signal is combined with white noise and I used an algorithm given in an old research paper by Ephraim and Malah to estimate the amplitude of the clean signal. Now I just have the magnitude information and I don't have the phase. The question is: is this enough to reconstruct an audio signal using ifft. If not can I use any arbitrary phase like the white noise phase? Please let me know&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance  &lt;/p&gt;&#xA;" OwnerUserId="11753" LastActivityDate="2017-10-21T20:46:13.257" Title="Is magnitude information enough to reconstruct an audio signal" Tags="|matlab|audio|ifft|reconstruction|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19329" PostTypeId="1" CreationDate="2014-11-26T04:58:46.047" Score="1" ViewCount="1748" Body="&lt;p&gt;A very common homework question. You are given an audio file(.wav) which has the recording of the keys pressed during a telephone call. You have to identify the telephone number from this audio file when you are given the sampling frequency &amp;amp; the duration for which one key is pressed.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the given sampling frequency &amp;amp; duration of key press, I could manage to write a MATLAB code to identify the telephone number by taking (samp_freq * key_press_time) number of samples at a time, doing fft on it &amp;amp; finding the bin that gives me a peak. I used WAVREAD command to read the audio file.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One problem I noticed is that, if the duration of key press is different(1st key pressed for 1 sec, 2nd key for 2 sec, 3rd key for 0.5 sec &amp;amp; so on), my technique of separating the data &amp;amp; finding peak will fail.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to get around this problem of random duration key press? I could think of 2 inefficient ways to do this. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;During 1st iteration, take entire data &amp;amp; plot fft. If (no. of peaks &gt; 1), take half data at a time plot fft. Keep on doing this until there is only 1 peak in the plot. But this technique will take a lot of time  &lt;/li&gt;&#xA;&lt;li&gt;WAVREAD the file, each key press data is separated by 0's. Thus take data between the 0's one at a time, plot fft &amp;amp; find peak &amp;amp; frequency. But this looks too simple to be used.  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So is there any other effiecient method of finding the telephone number when the key press duration is random? &lt;/p&gt;&#xA;" OwnerUserId="4875" LastActivityDate="2015-12-30T09:53:30.503" Title="How to, efficiently, identify telephone number from the key pressed data audio file?" Tags="|matlab|fft|audio|signal-analysis|frequency-spectrum|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19330" PostTypeId="1" AcceptedAnswerId="19336" CreationDate="2014-11-26T05:30:22.743" Score="1" ViewCount="6254" Body="&lt;p&gt;Following &lt;a href=&quot;http://www.codeproject.com/Articles/729759/Android-Sensor-Fusion-Tutorial&quot; rel=&quot;nofollow&quot;&gt;http://www.codeproject.com/Articles/729759/Android-Sensor-Fusion-Tutorial&lt;/a&gt; , I get two orientation values. Then, I transform those values to rotation matrices R1, R2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the relative rotation matrix is $$R_{12} = R_1*R_2^T.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I test one case using matlab calibration toolbox. The ground truth for $R_{12}$ is&#xA;$$\begin{bmatrix} 0.9970 &amp;amp; -0.0715 &amp;amp; -0.0298\\&#xA;    0.0744 &amp;amp;   0.9909  &amp;amp;  0.1118\\&#xA;    0.0216  &amp;amp; -0.1137  &amp;amp;  0.9933\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The values I got from android are&#xA;$$ ori1  = [0.6268438, -0.07218649, -0.2109669]$$&#xA;$$ rot1  = [0.78306764, 0.5850639, -0.21096313 \\ -0.58581793, 0.80777377, 0.06571868 \\ 0.20886011, 0.07212382, 0.9752824]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ori2  = [0.81628907, -0.09071748, -0.28214455];$$&#xA;$$rot2 = [0.6394706, 0.7256131, -0.2540925;\\ -0.717076, 0.6821133, 0.14325997; \\0.27727118, 0.0905931, 0.95651114];$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;testR12 = rot1*rot2' =&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.9789   -0.1927    0.0683&#xA;0.1948    0.9805   -0.0264&#xA;-0.0619    0.0391    0.9973&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are many coordinates and I am lost. How to get correct value? What's wrong with that? I have been stuck for a week because of this problem.&lt;/p&gt;&#xA;" OwnerUserId="4367" LastActivityDate="2016-04-17T05:10:01.810" Title="How to get relative rotation matrix from two orientation values in android?" Tags="|matrix|sensor|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19331" PostTypeId="1" CreationDate="2014-11-26T05:40:01.540" Score="1" ViewCount="4975" Body="&lt;p&gt;In my Android App,I have to detect text lines in images.I want to use &lt;code&gt;Hough Transform&lt;/code&gt; to detect lines.You can see an image below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yABgZ.jpg&quot; alt=&quot;![image description](/upfiles/1416629511823866.jpg)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got edges in image by &lt;code&gt;canny&lt;/code&gt; filter,then I applied Hough Transform on canny image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Size size = canny.size();&#xA;Mat lines = new Mat();&#xA;int lineGap = 20;&#xA;double sum1 = 0;&#xA;Imgproc.HoughLinesP(canny, lines, 1, Math.PI / 180, 100, size.width / 2.f, lineGap);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result for above image, looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hECtI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see three text lines are detected.So I added line's thickness by applying &lt;code&gt;dilate&lt;/code&gt; on canny image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mat dilate = new Mat();&#xA;Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(10,10));&#xA;Imgproc.dilate(canny, dilate, kernel);&#xA;int lineGap = 20;&#xA;double sum1 = 0;&#xA;Imgproc.HoughLinesP(dilate, lines, 1, Math.PI / 180, 100, size.width / 2.f, lineGap);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I drew detected lines on empty black background.Result is shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gZU2H.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see number of detected text lines is decreased,although I had added thickness of lines and did not change amount of minLineLength or maxLineGap,also when I apply dilation no white pixel remove from image!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again I added thickness of lines by doing dilation with kernel of &lt;strong&gt;size(30,30)&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mat dilate = new Mat();&#xA;Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(30,30));&#xA;Imgproc.dilate(canny, dilate, kernel);&#xA;int lineGap = 20;&#xA;double sum1 = 0;&#xA;Imgproc.HoughLinesP(dilate, lines, 1, Math.PI / 180, 100, size.width / 2.f, lineGap);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yaeVj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is:&lt;br&gt;&#xA;Why in each level when I add number of white pixels (by dilation) and do not change minLineLength or maxLineGap,Hough Transform do not detect some lines that were detected in previous level with less white pixels? &lt;/p&gt;&#xA;" OwnerUserId="11856" LastActivityDate="2015-08-17T14:01:40.543" Title="Detecting text lines in image by means of Hough Transform" Tags="|opencv|hough-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19332" PostTypeId="1" AcceptedAnswerId="19352" CreationDate="2014-11-26T06:34:38.083" Score="3" ViewCount="2074" Body="&lt;p&gt;My understanding is that if I have a real signal, it can be called as the 'I' component and its Hilbert transform can be called the 'Q' component. Due to the property of Hilbert  transform, 'I' and 'Q' will have 90 degrees phase difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the case of a pure sine wave with constant amplitude. Let us say we sample it at 4 times its frequency, hence taking 4 samples per cycle. Consequently, each sample will have 90 degrees phase difference with respect to the previous sample. In this case, is it correct to say that &quot;the incoming signal delayed by one sample&quot; is the Hilbert transform, and hence the 'Q' component?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, now let us say we add random noise to this pure sine wave, thus making it non-periodic. Can we still say that &quot;the incoming signal delayed by one sample&quot; is off by 90 degrees?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope my question makes sense! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="11858" LastActivityDate="2018-08-17T15:34:49.960" Title="Generating I/Q samples from a real signal" Tags="|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19333" PostTypeId="1" CreationDate="2014-11-26T06:58:01.270" Score="0" ViewCount="413" Body="&lt;p&gt;I am currently in the process of taking on implementing the Gold-Rabiner pitch tracking algorithm, and I came across what seemed like a good explanation of it in David Meehan's &quot;A Code Excited Linear Predictive Coder&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am a bit confused with M5, which states:  &quot;the magnitude of the difference in amplitude between the current valley amplitude and the previous peak amplitude&quot;--  Where M3 is depicted as the &quot;previous peak&quot;, yet the arrow is going up to where M1 is, which is the &quot;current peak&quot;-- so either the instruction is wrong or the diagram is wrong-- or I am misunderstanding this entirely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, a side question is, because this is talking about magnitude, this means that the arrow pointing downward at M1, is pointing at 0, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QrjJb.png&quot; alt=&quot;page from David Meehan&amp;#39;s A Code Excited Linear Predictive Coder&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11807" LastActivityDate="2015-11-08T04:40:36.273" Title="Trying to understand the gold-rabiner pitch detection algorithm" Tags="|signal-analysis|algorithms|pitch|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19334" PostTypeId="2" ParentId="19331" CreationDate="2014-11-26T07:15:47.057" Score="1" Body="&lt;p&gt;OpenCV now has a text detection module included. You might want to take a look at it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Detector: &lt;a href=&quot;http://docs.opencv.org/master/modules/objdetect/doc/erfilter.html&quot; rel=&quot;nofollow&quot;&gt;http://docs.opencv.org/master/modules/objdetect/doc/erfilter.html&lt;/a&gt;&#xA;Recognizer: &lt;a href=&quot;http://docs.opencv.org/trunk/modules/text/doc/ocr.html&quot; rel=&quot;nofollow&quot;&gt;http://docs.opencv.org/trunk/modules/text/doc/ocr.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-11-26T07:15:47.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19335" PostTypeId="2" ParentId="19327" CreationDate="2014-11-26T07:55:12.600" Score="0" Body="&lt;p&gt;What you have to do is use the phase of the original noisy speech signal, i.e. only the magnitudes are improved by gain factors computed according to some optimality criterion (MMSE in this case). So the speech signal is reconstructed from the (hopefully) improved magnitude and the original phase. Why this works has already been explained in the comments (the main argument is usually that the human ear is insensitive to changes to the original phase, as long as they are not time-varying).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-26T07:55:12.600" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19336" PostTypeId="2" ParentId="19330" CreationDate="2014-11-26T08:00:13.893" Score="2" Body="&lt;p&gt;Your error might be due to the indices used. Nevertheless, it is always better to state the proper procedure to do it, so that you could find your error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume that a 3D scene point $P$ is related to the normalized coordinates of the camera $i$ with the extrinsic parameters $P'_i=R_iP+T_i$ and similarly to camera $j$ with $P'_j=R_jP+T_j$. To find the relative pose we could simply use these two equations to go from the camera coordinates of view $i$ to the real scene and then to the second view $j$. We could then write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P=R_i^{-1}(P_i-T_i)$ (from camera $i$ to world)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P'_j = R_j (R_i^{-1}(P_i-T_i)) +T_j$.  (from world to camera $j$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we re-arrange:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P'_j = R_{rel}P_i +T_{rel}$, where $R_{rel}=R_jR_i^{-1}$ and $T_{rel}=-R_{rel}T_i+T_j$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the subscript &lt;em&gt;rel&lt;/em&gt; refers to &quot;relative&quot; and is what we seek to find. Keep in mind that, as rotations are orthogonal, $R_i^{-1}=R_i^T$. You can always compute relative orientations in similar manners.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Throughout the computation we used the convention that the transformation $J=[R|T]$ is a mapping from scene to the camera (the inverse is hence the vice versa). The final pose transforms a point in camera $i$ to camera $j$.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-11-26T08:00:13.893" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19337" PostTypeId="1" AcceptedAnswerId="19339" CreationDate="2014-11-26T08:47:02.060" Score="5" ViewCount="35769" Body="&lt;p&gt;In some papers/books I found infos about a signal given as RMS value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the RMS value and what information does it contain? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I compute it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, if they say that the signal is a white noise with RMS $100$ band limited onto the interval $[0, 2000] Hz$, how can I use the RMS information to produce the signal they are talking about? &#xA;And if they say that the noise contributes to 5% of the signal RMS value?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2015-03-25T11:06:26.617" Title="What is the rms value of a signal and how to use it" Tags="|matlab|signal-analysis|noise|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19338" PostTypeId="2" ParentId="19312" CreationDate="2014-11-26T09:02:51.153" Score="1" Body="&lt;p&gt;The YIN Algorithm could be of interest to you. It's based on autocorrelation and is used for estimating the fundamental frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A. de Cheveigné, H. Kawahara: &lt;em&gt;YIN, a fundamental frequency estimator for speech and music&lt;/em&gt;, Proceedings of ICMC 2005. &lt;a href=&quot;http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf&quot; rel=&quot;nofollow&quot;&gt;Download PDF&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;http://mroy.chez-alice.fr/yin/index.html&quot; rel=&quot;nofollow&quot;&gt;C++ implementation&lt;/a&gt; is also available. &lt;/p&gt;&#xA;" OwnerUserId="8462" LastActivityDate="2014-11-26T09:02:51.153" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19339" PostTypeId="2" ParentId="19337" CreationDate="2014-11-26T10:14:46.007" Score="7" Body="&lt;p&gt;RMS is the root-mean-square value of a signal.  For a digitised signal, you can calculate it by squaring each value, finding the arithmetic mean of those squared values, and taking the square root of the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loosely speaking, it represents the average &quot;power&quot; of a signal.  In electrical terms, all signals with the same RMS voltage, when applied across a resistor, will produce the same amount of heat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that Matlab has an RMS function &lt;code&gt;Y = rms(X)&lt;/code&gt; in the signal processing toolbox.  if you don't have that toolbox, it shouldn't be hard to write your own function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the RMS value is only related to the signal amplitude, knowing it doesn't help you to create the waveform.  However, if you have a function that will generate the desired waveform, you could measure the RMS value of the result, and multiply by an appropriate scaling factor to give you the amplitude you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &quot;the noise contributes to 5% of the signal RMS value&quot;, then presumably the signal would only have an RMS value of 95% of the total before you added the noise.  But beware that RMS values don't simply add.  Adding noise of RMS amplitude 1 to a signal of amplitude 10 will not necessarily produce a new signal of RMS amplitude 11.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2014-11-26T10:14:46.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19342" PostTypeId="2" ParentId="19304" CreationDate="2014-11-26T16:18:52.807" Score="1" Body="&lt;p&gt;See &lt;a href=&quot;http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators/&quot; rel=&quot;nofollow&quot;&gt;Smooth noise-robust differentiators&lt;/a&gt;. While Pavel doesn't address your specific problem there, he and I corresponded about a similar &quot;missing samples&quot; problem earlier this year, and he has some good ideas that you can try. In particular, he recommends polynomial approximation in the region of the missing samples. In addition I'll mention that if you use Neville's Algorithm you can guarantee that the polynomial passes through your &quot;good&quot; sample values. You can find Pavel's contact info in various places on his Website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Greg Berchin&lt;/p&gt;&#xA;" OwnerUserId="11085" LastActivityDate="2014-11-26T16:18:52.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19346" PostTypeId="2" ParentId="17988" CreationDate="2014-11-26T19:20:21.133" Score="1" Body="&lt;p&gt;since @Community resurrected this question, i'll pick up a little where hotpaw left off.  i'm not gonna run this through MATLAB or Octave (i can never remember which are columns and which are rows).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let $r$ be the resampling ratio.  $r&amp;gt;1$ means that your sample rate has increased and you're making the sequence longer because there are more samples.  so if you pad a delay of $\tau$ at the beginning of the input $x[n]$, that should result in a delay of $r \cdot \tau$ at the output $y[n]$ (whether $\tau$ is an integer number of samples or not).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now suppose you pad (using concatenation) the input with $P$ samples of zero before $x[0]$.  $P$ is a positive integer. that will result in a pad in the resampled output $y[n]$ of $rP$ samples where $rP$ is not necessarily an integer.  but&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \lfloor rP \rfloor \triangleq \operatorname{floor}(rP) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;is&lt;/em&gt;&lt;/strong&gt; an integer, and you can strip those samples (which will be mostly zero) off of the beginning of $y[n]$.  $\lfloor u \rfloor$ is the most positive integer that is no greater than $u$.  this is always the case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \lfloor u \rfloor \le u &amp;lt; \lfloor u \rfloor + 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;at least for $u \ge 0$, we might say that $\lfloor u \rfloor$ is the &quot;integer part&quot; of $u$.  the &quot;fractional part&quot; of $u$ is whatever is left:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 0 \le u - \lfloor u \rfloor &amp;lt; 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, if what we want left is a fractional delay of $\alpha$ samples where $0 \le \alpha &amp;lt; 1$, then we want to choose an integer $P$ to pad the input such that $\alpha$ is the fractional part remaining in the output delay after stripping away the integer part, $\lfloor rP \rfloor$.  that is, given the sample rate ratio $r$, and fractional delay $\alpha$, we want to choose $P$ such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ rP = \lfloor rP \rfloor + \alpha $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \alpha = rP - \lfloor rP \rfloor \ . $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;after thinking about this a while, the only algorithm i can suggest is to start with $P=1$ and iteratively increment $P$ so that the above equation is close enough to be accurate.  that is, given an error constraint on $\alpha$, (call it $0 &amp;lt; \epsilon \ll 1$), increment $P$ until&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \left|\alpha - \left( rP - \lfloor rP \rfloor \right) \right| &amp;lt; \epsilon $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pad the input with $P$ samples of zero, and strip the output of $\lfloor rP \rfloor$ samples, and you will be left with $\left( rP - \lfloor rP \rfloor \right)$ samples of delay.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-11-26T19:20:21.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19347" PostTypeId="1" AcceptedAnswerId="19348" CreationDate="2014-11-26T21:01:13.510" Score="1" ViewCount="1299" Body="&lt;p&gt;When calibrating a camera with a chessboard, are more squares better or worse? When would you use more or less? And how does the size of the blocks effect the calibration results?&lt;/p&gt;&#xA;" OwnerUserId="11435" LastEditorUserId="53" LastEditDate="2015-07-27T17:41:57.327" LastActivityDate="2015-07-27T17:41:57.327" Title="How does chessboard configuration affect camera calibration?" Tags="|computer-vision|camera-calibration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19348" PostTypeId="2" ParentId="19347" CreationDate="2014-11-26T21:31:49.343" Score="2" Body="&lt;p&gt;Generally speaking, when you are estimating a model from data, the more (independent) data points, the better the estimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this particular case, the goal is to get as many 3d -&gt; 2d point correspondences as possible, filling as much as possible of the volume of space of interest that is observed by the camera. The size of the squares directly affects how many data points you get per image (larger squares implies less visible corners/points). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also important to ensure that the camera parameters you want to calibrate are observable given the data. For example, in order to calibrate the focal length (or the field of view, equivalently) you need to observe a significant perspective foreshortening of the (planar) checkerboard in a few images. In order to accurately calibrate the nonlinear (e.g. barrel) lens distortion, you'll need to observe plenty of aligned data points near the edge of the image, where the distortion is larger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a &lt;a href=&quot;https://stackoverflow.com/questions/12794876/how-to-verify-the-correctness-of-calibration-of-a-webcam/12821056#12821056&quot;&gt;longer response&lt;/a&gt; on StackOverflow that you may want to look up.  &lt;/p&gt;&#xA;" OwnerUserId="9110" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-11-26T21:31:49.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19350" PostTypeId="1" AcceptedAnswerId="67742" CreationDate="2014-11-27T01:01:31.043" Score="7" ViewCount="16672" Body="&lt;p&gt;I am looking to transition some of my MATLAB algorithms to C/C++ for deployment on target (PowerPC and/or ARM).  Mostly 1D FIR/IIR filter in this instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other domains, there are well-regarded general libraries (both speed and quality) with liberal licencing. For example, Linear Algebra has &lt;a href=&quot;http://www.netlib.org/lapack/&quot; rel=&quot;noreferrer&quot;&gt;LAPACK&lt;/a&gt; and &lt;a href=&quot;http://eigen.tuxfamily.org/index.php?title=Main_Page&quot; rel=&quot;noreferrer&quot;&gt;Eigen&lt;/a&gt; (amongst others), and computer vision has &lt;a href=&quot;http://opencv.org/&quot; rel=&quot;noreferrer&quot;&gt;OpenCV&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are well-regarded libraries for specific algorithms, such as &lt;a href=&quot;http://www.fftw.org/&quot; rel=&quot;noreferrer&quot;&gt;FFTW&lt;/a&gt;, but what about a collection of general algorithms for 1D signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not after DSP-specific libraries, such as for &lt;a href=&quot;http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&amp;amp;nodeId=2680&amp;amp;dDocName=en552827&quot; rel=&quot;noreferrer&quot;&gt;PIC32&lt;/a&gt;, &lt;a href=&quot;http://www.keil.com/pack/doc/CMSIS/DSP/html/index.html&quot; rel=&quot;noreferrer&quot;&gt;CMSIS (ARM Cortex M4)&lt;/a&gt;, &lt;a href=&quot;http://www.ti.com/tool/sprc265&quot; rel=&quot;noreferrer&quot;&gt;DSPLIB (C64x)&lt;/a&gt; or &lt;a href=&quot;http://am.renesas.com/products/tools/middleware_and_drivers/c_splib/a_dsp/index.jsp&quot; rel=&quot;noreferrer&quot;&gt;Renesas&lt;/a&gt;, but nonetheless has similar functionality.&lt;/p&gt;&#xA;" OwnerUserId="1904" LastEditorUserId="128" LastEditDate="2020-08-07T12:12:21.940" LastActivityDate="2023-02-28T08:12:21.690" Title="Recommended C/C++ General Purpose DSP Libraries" Tags="|software-implementation|c|c++|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="19351" PostTypeId="1" CreationDate="2014-11-27T02:02:09.397" Score="0" ViewCount="1481" Body="&lt;p&gt;In reading literature on the construction of impulse responses from sine sweeps (e.g. papers by Farina), I see it stated over &amp;amp; over that the way the impulse response is constructed from a (exponential) sine sweep is to take the original sine sweep signal $S(t)$, time reverse it ( $S(T-t)$ ), scale it somewhat in magnitude,  and convolve this with the recorded signal to obtain the impulse response of the (time-invariant, linear) system such as a room's reverberation..  i.e., the claim is that $S^{-1}(t)$ is proportional to $S(T-t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain how to prove this, or point me to a reference that actually shows a 'proof' of this?  The closest I've seen is &quot;it can be shown that...&quot;, and a few hand-waving comments about how time-reversal inverts the phase -- but it's not obvious that this 'does the job' for producing a proper inverse from a function with nonlinear time dependence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been &lt;em&gt;trying&lt;/em&gt; to show this explicitly (in the continuous-time case) for about 7 hours now, and have a few pages of integrals written out, even with a little help from WolframAlpha :-(.   The exponential term in the frequency makes it hard to compute the Fourier Transform explicitly (you get Gamma functions with two arguments), let alone try to take the reciprocal of the FT and then take the Inverse FT of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not a homework problem, I just want to understand why it works.  (I know it works because I've coded it up, but it still seems kind of like magic.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS- Thought I'd try a linear sine sweep as it might be easier, but you also get a frequency-squared term which again makes it...not at all obvious...that taking $t$ -&gt; $-t$ is going to invert all the phase terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.P.S.- Here are my notes so far; the calculation starts on page 4.  &lt;a href=&quot;https://www.dropbox.com/s/aawp5hx8vpseubn/Convo_IR_Calcs.pdf?dl=0&quot; rel=&quot;nofollow&quot;&gt;Dropbox link to PDF&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11869" LastEditorUserId="7092" LastEditDate="2014-11-27T02:39:05.987" LastActivityDate="2015-01-26T13:07:39.120" Title="Prove that time-reverse yields inverse filter for deconvolution?" Tags="|convolution|impulse-response|deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19352" PostTypeId="2" ParentId="19332" CreationDate="2014-11-27T02:46:49.000" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Let us say we sample it at 4 times its frequency, hence taking 4 samples per cycle. Consequently, each sample will have 90 degrees phase difference with respect to the previous sample. In this case, is it correct to say that &quot;the incoming signal delayed by one sample&quot; is the Hilbert transform, and hence the 'Q' component?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's true that the &quot;delay by one sample&quot; and &quot;Hilbert transform&quot; give &lt;strong&gt;the same result signal&lt;/strong&gt; when they are applied to this particular signal, but I wouldn't say they're the same — they're still different operators.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also, now let us say we add random noise to this pure sine wave, thus making it non-periodic. Can we still say that &quot;the incoming signal delayed by one sample&quot; is off by 90 degrees?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, because the noise contains other frequencies, and for those frequencies a one-sample delay will correspond to a phase shift which is &lt;em&gt;not&lt;/em&gt; 90 degrees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's one particular signal which is the Hilbert transform of your particular sine-plus-noise, and this is not it. &quot;Random noise&quot; is not a featureless blob which stays the same under phase shifts or delays — it's the opposite, in fact.&lt;/p&gt;&#xA;" OwnerUserId="4655" LastActivityDate="2014-11-27T02:46:49.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19353" PostTypeId="1" CreationDate="2014-11-27T05:58:29.267" Score="2" ViewCount="326" Body="&lt;p&gt;Do you have any idea about how we can find the principal eigenvectors of an unknown matrix ${H}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The elements of $H$ are unknown in general. If you are familiar with channel estimation procedure in wireless communications, $H$ is channel matrix, and every element $(i,j)$ represents the channel gain between antenna element $i$ of transmitter and antenna element $j$ of the receiver. The following are the information that we have: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;we do not know the channel matrix,&lt;/li&gt;&#xA;&lt;li&gt;we know second order statistics, covariance matrix of the channel, &lt;/li&gt;&#xA;&lt;li&gt;the channel matrix size tends to infinity (large number of antennas in Tx and Rx), &lt;/li&gt;&#xA;&lt;li&gt;the channel is sparse, that is, it has only two or three dominant eigenvectors regardless of the channel matrix size. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that the power method is not a good solution for me, since its complexity is huge, especially because it requires many iterations to find the dominant eigenvectors.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Some information about the interplay between channel and its covariance:&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We consider Rayleigh correlated channel coefficients $h_k\sim CN (0,\mathbf{R}_k)$, mutually independent across the users $k$, and $CN$ is circularly symmetric complex Gaussian. We let $\mathbf{R}_k = \mathbf{U}_k \mathbf{\Lambda}_k \mathbf{U}_{k}^{H}$, where $\mathbf{U}_{k}$ is a tall matrix of the eigenvectors corresponding to the non-zero eigenvalues of $\mathbf{R}_k$, given as the diagonal elements of the diagonal matrix $\mathbf{\Lambda}_{k}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Karhunen-Loeve representation of the user channel vector is given as $\mathbf{h}_{k} = \mathbf{U}_{k}\mathbf{\Lambda}_{k}^{\frac{1}{2}}\mathbf{w}_{k}$, where the entries of $\mathbf{w}_{k}$ are i.i.d. with zero mean Gaussian distributed with variance 1. &lt;/p&gt;&#xA;" OwnerUserId="11870" LastEditorUserId="21075" LastEditDate="2016-10-21T15:23:13.097" LastActivityDate="2016-10-21T15:23:13.097" Title="Dominant eigenvectors of an unknown matrix" Tags="|signal-analysis|estimation|matrix|compressive-sensing|information-theory|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19354" PostTypeId="2" ParentId="19351" CreationDate="2014-11-27T09:38:39.787" Score="1" Body="&lt;p&gt;This is not a general result. It specifically holds, iff the Fourier transform of the signal is of unit magnitude. In that case you can write the signal in frequency domain as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(\omega)=\exp(i \phi(\omega))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for a real function $\phi$. The time reversed signal (I'll ignore the constant time offset, it doesn't change anything relevant) is then the conjugate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\bar{S}(\omega)=\exp(-i \phi(\omega))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolving the two by multiplying the frequency domain representation gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\exp(i\phi(\omega))\times \exp(-i\phi(\omega)) = 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the response of the identity system and demonstrates that the signal and its time reversed are the responses of inverses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This result is only exact in this special case. Sweeps can belong to this class of signal, for example if they have been generated as an allpass filter response. You can also do that by constructing the sweep entirely in frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sweep that is synthesised in time domain using a modulated sinusoid is typically not of that form, but approximates it well. Especially near the endpoints of the frequency range you will get significant deviation from the unit response.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2014-11-27T12:50:58.843" LastActivityDate="2014-11-27T12:50:58.843" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19357" PostTypeId="1" CreationDate="2014-11-27T13:28:46.207" Score="1" ViewCount="165" Body="&lt;p&gt;I'm trying to create my own program for speaker identification (text-independent) and have used MFCC features for that. But result of recognition is very poor. My supervisor told me that using MFCC for such problem is not the best solution because we are loosing a lot of data about speaker and MFCC mostly used for speech recognition (&lt;strong&gt;what&lt;/strong&gt; is said, not &lt;strong&gt;who&lt;/strong&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know which features can give better result for speaker recognition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11877" LastActivityDate="2016-01-27T23:41:33.580" Title="Features for speaker recognition" Tags="|speech-processing|mfcc|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19358" PostTypeId="1" AcceptedAnswerId="19363" CreationDate="2014-11-27T20:36:13.690" Score="0" ViewCount="196" Body="&lt;p&gt;I am trying to reconstruct a signal from a noisy speech using an MMSE algorithm proposed long time ago by Ephraim and Malah (1984). After going through the algorithm, I got a matrix A which represents the magnitude of the reconstructed signal. With the help of this group, I now know that I need to use this magnitude with the phase of the noisy signal in order to recover the signal. Now the problem is that after doing an &lt;code&gt;ifft&lt;/code&gt;, I get complex numbers. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does this mean there is a mistake in implementing the algorithm? &lt;/li&gt;&#xA;&lt;li&gt;I read somewhere that I have to have symmetry in my input to an &lt;code&gt;ifft&lt;/code&gt; function, how do I ensure such symmetry is applied here?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is my MATLAB command and the equation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = A_hat.*exp(1i*nu);&#xA;x_new = ifft(A);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;\begin{align}&#xA;\hat A_k&amp;amp;=\Gamma\left(1.5\right)\frac{\sqrt{v_k}}{\gamma_k}M\left(-0.5;1;-v_k\right)R_k\\&#xA;&amp;amp;=\Gamma\left(1.5\right)\frac{\sqrt{v_k}}{\gamma_k}\exp\left(-\frac{v_k}{2}\right)\left[\left(1+v_k\right)I_0\left(\frac{v_k}{2}\right)+ v_k I_1\left(\frac{v_k}{2}\right)\right]R_k.\tag{7}&#xA;\end{align}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="11753" LastEditorUserId="1629" LastEditDate="2016-06-15T23:52:06.627" LastActivityDate="2016-06-15T23:52:06.627" Title="Complex numbers in $\tt ifft$ of an MMSE amplitude estimator" Tags="|matlab|audio|ifft|reconstruction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19359" PostTypeId="2" ParentId="19315" CreationDate="2014-11-27T21:36:39.900" Score="2" Body="&lt;p&gt;Suppose that the input signal to the system has power spectral density (PSD)&#xA;$S_i(f)$ while the output has PSD $S_o(f)$. Then, &lt;em&gt;if&lt;/em&gt; the system is an LTI&#xA;system, then it must be that&#xA;$$S_o(f) = |H(f)|^2 S_i(f) \tag{1}$$&#xA;where $H(f)$ is the transfer function of the system. So, for a given pair&#xA;of PSDs, is there a $H(f)$ such that $(1)$ holds? One obvious case when&#xA;$(1)$ cannot hold for &lt;em&gt;any&lt;/em&gt; choice of $H(f)$&#xA;is when the &lt;em&gt;supports&lt;/em&gt; of $S_i(f)$ and $S_o(f)$ are different (in the sense&#xA;that there are frequencies $f$ for which $S_o(f) &amp;gt; 0$ while $S_i(f) = 0$). &#xA;So in this&#xA;case we can say unequivocally that the system is &lt;em&gt;not&lt;/em&gt; an LTI system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about when the supports of $S_i(f)$ and $S_o(f)$ are identical or&#xA;the support of $S_o(f)$ is a subset of the support of $S_i(f)$ (think&#xA;bandstop or notch filter)?&#xA;Well, in this case, we do have a $|H(f)|^2$ from which we can &#xA;deduce $|H(f)|$. Throw in a conjugate-symmetric $\angle H(f)$ and we&#xA;have constructed the transfer function $H(f) = |H(f)|e^{\angle H(f)}$&#xA;of &lt;strong&gt;an&lt;/strong&gt; LTI system whose output&#xA;PSD is $S_o(f)$ when the input PSD is $S_i(f)$. Note that there can&#xA;be infinitely many LTI systems that will provide this specific&#xA;input-output relationship.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But,&lt;/strong&gt; the above does not allow us to say that the system that actually&#xA;produced the given output PSD from the given input PSD &lt;strong&gt;is&lt;/strong&gt; an LTI&#xA;system, let alone one having the specific transfer function that we have&#xA;constructed. The actual system that we are looking at might be nonlinear&#xA;or time-varying, etc. We cannot say. After all, the&#xA;$|H(f)|e^{\angle H(f)}$ that we have come up with&#xA;might be a &lt;em&gt;physically unrealizable&lt;/em&gt; transfer&#xA;function.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="4655" LastEditDate="2014-11-28T19:46:36.673" LastActivityDate="2014-11-28T19:46:36.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19360" PostTypeId="1" AcceptedAnswerId="19367" CreationDate="2014-11-28T03:25:51.207" Score="0" ViewCount="829" Body="&lt;p&gt;Is there a relation between Symbol Error Rate (SER) and the channel capacity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is {Modulation Order x (1-SER) / symbol duration [bps]} called?&lt;/p&gt;&#xA;" OwnerUserId="11883" LastActivityDate="2020-06-02T19:38:13.210" Title="Relation between SER and the channel capacity" Tags="|information-theory|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19361" PostTypeId="2" ParentId="19289" CreationDate="2014-11-28T04:29:54.827" Score="0" Body="&lt;p&gt;It might sound like overkill, but you can extract features (say, MFCC) from the spectrogram and apply Dynamic Time Warping (DTW) to locate the smaller clip. &#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_time_warping&quot; rel=&quot;nofollow&quot;&gt;DTW&lt;/a&gt; is a popular technique in speech recognition, known for being relatively simple and fast. It is invariant to playing speed, and offers a lot of improvisations customized to speech waveforms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;DTW can provide a measure of the distance (similarity) between two strings. &#xA;However, since the location of the smaller clip is necessary in your question, you might need to 'slide' it over the longer one and compute the distance measure at each location - &lt;a href=&quot;http://ceur-ws.org/Vol-807/Gautam_IIIT_SWS_me11wn.pdf&quot; rel=&quot;nofollow&quot;&gt;sliding window DTW&lt;/a&gt; (check 2.2)&lt;/p&gt;&#xA;" OwnerUserId="5641" LastActivityDate="2014-11-28T04:29:54.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19362" PostTypeId="1" CreationDate="2014-11-28T08:18:21.187" Score="0" ViewCount="874" Body="&lt;p&gt;I want to find roll-off (unit dB/decade) of highpass filter $H(z) = 1 - a \cdot z^{-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I derived magnitude response to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$1+a^2 - 2a\cdot \cos(\omega)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find out roll-off factor from above equation, how should I proceed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of doing &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$1+a^2 - 2a\cdot \cos(10\omega) \over {1+a^2 - 2a\cdot \cos(\omega)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But $\omega$ is a variable, how do I simplify this?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="8202" LastEditDate="2014-11-28T10:41:52.613" LastActivityDate="2014-11-30T01:12:46.487" Title="How to find roll-off from its transfer function equation?" Tags="|filters|transfer-function|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19363" PostTypeId="2" ParentId="19358" CreationDate="2014-11-28T10:34:50.743" Score="0" Body="&lt;p&gt;Note that the MMSE estimator gives you a real-valued gain function with which the noisy signal amplitude is modified. Equation (7) is actually&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{A}_k=G_kR_k\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the gain $G_k$ is a function of $v_k$ and $\gamma_k$. You want to reconstruct the original signal as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{X}_k=\hat{A}_ke^{j\phi_k}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi_k$ is the phase of the noisy signal $Y_k=R_ke^{j\phi_k}$. Combining (1) and (2) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{X}_k=G_kR_ke^{j\phi_k}=G_kY_k\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can simply multiply the complex spectral component of the noisy signal with the gain $G_k$ to get the estimation of the spectral component of the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab this is easily done. You just have to extend the gain vector to satisfy the symmetry condition for real-valued signals:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = Y.*[gain; gain(N-1:-1:2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where I assume that the vector &lt;code&gt;gain&lt;/code&gt; has elements $G_k$, and that &lt;code&gt;N&lt;/code&gt; is its length. The relation between the FFT length and &lt;code&gt;N&lt;/code&gt; is &lt;code&gt;N = Nfft/2+1&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-28T10:34:50.743" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="19365" PostTypeId="1" CreationDate="2014-11-28T14:25:02.730" Score="2" ViewCount="1754" Body="&lt;p&gt;When splitting higher order recursive filters into more convenient 2nd order sections (biquads), in matlab, we usually use &lt;code&gt;zp2sos&lt;/code&gt; to convert. In document, there's a couple of lines , which I am quoting below,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[sos,g] = zp2sos(z,p,k,''order') specifies the order of the rows in sos, where 'order' is&lt;/p&gt;&#xA;&lt;p&gt;'down', to order the sections so the first row of sos contains the poles closest to the unit circle&lt;/p&gt;&#xA;&lt;p&gt;'up', to order the sections so the first row of sos contains the poles farthest from the unit circle (default)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here i can't remember that I had read something relevant to arranging the biquads on the basis of poles location.&lt;/p&gt;&#xA;&lt;p&gt;Now Can anyone explain me,&#xA;why should we arrange the biquads in a specific manner while cascading them ?&lt;/p&gt;&#xA;&lt;p&gt;What that arrangement is to deal with the poles being closer or farthe from unit circle, as Matlab documents says?&lt;/p&gt;&#xA;&lt;p&gt;What specifics need to be considered while ordering the biquads to get higher order filters.&lt;/p&gt;&#xA;&lt;p&gt;It'll be so nice to illustrate by using some case study, for example, designing the A weighting filter (8th order IIR), and converting it ino biquads, and arranging them in a specific manner which is under discussion.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-11-29T04:55:27.813" Title="Understanding Arrangement of second order sections" Tags="|matlab|discrete-signals|filter-design|infinite-impulse-response|poles-zeros|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19366" PostTypeId="1" AcceptedAnswerId="19437" CreationDate="2014-11-28T14:31:56.487" Score="1" ViewCount="64" Body="&lt;p&gt;Is it OK to calibrate a camera using effects and filters such as increasing contrast and brightness etc. to improve the detection of corners of a chessboard?&#xA;Even if the used mode for detecting the chessboard is just plain gray scale?&lt;/p&gt;&#xA;" OwnerUserId="11435" LastActivityDate="2014-12-03T15:46:27.757" Title="Changing camera and image properties to calibrate a camera" Tags="|image-processing|camera|camera-calibration|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19367" PostTypeId="2" ParentId="19360" CreationDate="2014-11-28T14:41:58.900" Score="2" Body="&lt;p&gt;Yes, there is a relationship between SER and channel capacity.  The channel capacity equation is-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C = B\log_2(1 + \frac{S}{N})&#xA;$$&#xA;where $C$ is the channel capacity in bits/s, $B$ is the bandwidth in Hz, $S$ is the average received signal power, and $N$ is the average noise power across the bandwidth $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the equation, it is clear that increasing the SNR will increase the channel capacity.  Increasing SNR does, of course, also decrease the symbol error rate (SER).  Thus, there is an inverse relationship between SER and channel capacity.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is {Modulation Order x (1-SER) / symbol duration [bps]} called?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As far as I am aware it does not have a name.  Having a bit stream where some of the bits are good and some of the bits are bad is generally not very useful.  Shannon's theorem assumes that error correction codes are used to reduce the number of errors to an arbitrarily low rate.  This reduces the number of generated bits/s, but increases the reliability of those bits.  The &quot;channel capacity&quot; of a channel is the number of bits it can produce with an arbitrarily low error rate.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-11-28T14:41:58.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19368" PostTypeId="1" CreationDate="2014-11-28T17:10:55.473" Score="1" ViewCount="2962" Body="&lt;p&gt;In GNU Radio Companion, I have created a very simple flow graph where I generate a 1 kHz, 2.0 volts peak-to-peak sine wave, and feed it into an FFT sink and a time domain sink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/edPbx.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reference dB in the FFT sink is set to 0, and the reference scale is set to 2.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, I would expect to see 0 dB on the FFT display, but I instead see &amp;minus;10 dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/N52Xd.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this? Is it a problem in my understanding, or a problem in GNURadio?&lt;/p&gt;&#xA;" OwnerUserId="11890" LastEditorUserId="13320" LastEditDate="2016-04-08T14:53:20.037" LastActivityDate="2016-04-08T14:53:20.037" Title="FFT scaling in GNU Radio" Tags="|fft|gnuradio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19369" PostTypeId="2" ParentId="19365" CreationDate="2014-11-28T18:00:48.060" Score="2" Body="&lt;p&gt;Different orderings of second-order blocks have different behavior with respect to quantization noise and overflow. Usually it is best to avoid very peaky transfer functions in second order blocks, because these peaks may cause overflow and quantization noise amplification. This is why it is common to pair poles and zeros that are close to each other, so the zeros cancel part of the peaks caused by the poles. The pole-zero pairing determines the second-order sections, but not their order. Concerning the order, there is always a best choice minimizing the quantization noise, but this order needs to be determined individually for the filter under consideration. However, there are two types of ordering that work well in most cases. Depending on the way scaling is performed, either ordering the sections with increasing or decreasing pole radii is best. In Matlab, these two common ways of ordering are referred to as 'up' and 'down', respectively. Have a look at &lt;a href=&quot;http://www.emba.uvm.edu/~gmirchan/classes/EE270/EE275/Handouts_Ed4/Ch12%284e%29_Handouts/Ch12%284%29Handouts_4e.pdf&quot; rel=&quot;nofollow&quot;&gt;this document&lt;/a&gt; for more detailed information.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-11-28T18:00:48.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19370" PostTypeId="1" AcceptedAnswerId="19371" CreationDate="2014-11-28T20:29:13.690" Score="1" ViewCount="288" Body="&lt;p&gt;I am planning to do a self project on speech recognition for a vocabulary detection system using arduino. I know CMUsphinx or bitvoicer is probably the way to go. But I would like to code the project from the ground up as the purpose of the project is learning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been reading different papers like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://revistaie.ase.ro/content/46/s%20-%20furtuna.pdf&quot; rel=&quot;nofollow&quot;&gt;http://revistaie.ase.ro/content/46/s%20-%20furtuna.pdf&lt;/a&gt; (dynamic time warping)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://citeseer.ist.psu.edu/viewdoc/download;jsessionid=DEC7F40E5AE89F1508A3B6D0625CC1DA?doi=10.1.1.131.2084&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;http://citeseer.ist.psu.edu/viewdoc/download;jsessionid=DEC7F40E5AE89F1508A3B6D0625CC1DA?doi=10.1.1.131.2084&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&#xA;(HMM)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have encountered the following difficulties&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have a hard time reconciling the entire process with higher level algorithm. From what I have read so far the entire process is the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i. input signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ii. filter all noise, getting all signals that is high energy volume and low frequency. (How do I know what to compare against? What is consider high energy volume, and low freqency?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iii. divide the signal into phones using FFT (where do I get dataset for phones, what constitutes a boundary between two phones, and how similar does the detected phones have to match the dataset?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iv. matching the list of phones to each word using HMM or DTW&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For beginners like me I feel that steps 2-3 is the hardest part due to the difficulties I listed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me a direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11893" LastActivityDate="2014-11-29T12:37:11.563" Title="Filtering noise and identifying phones boundary in speech recongition" Tags="|sound|speech-recognition|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19371" PostTypeId="2" ParentId="19370" CreationDate="2014-11-29T01:00:58.203" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;system using arduino&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Arduino performance is not enough for any serious speech recognition. You should better play with your mobile phone instead. With mobile you can build at least some interesting applications. Or try Raspberry Pi.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;From what I have read so far the entire process is the following&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You probably need to read more papers (including the source code of existing software like CMUSphinx) to understand the details because the description of the process you have is not very accurate either. Ideally you need to read a textbook like &quot;Fundamentals of speech recognition&quot; by L. Rabiner.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;i. input signal&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is two lines of code.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;ii. filter all noise, getting all signals that is high energy volume and low frequency. (How do I know what to compare against? What is consider high energy volume, and low freqency?)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is not very accurate description, there is no such thing as &quot;low frequency&quot;. There is a voice activity detection (VAD) task which is pretty complex and has many dedicated algorithms. The simple form is VAD based on energy of the signal. You compare background energy level with current energy level and if the difference is higher than threshold you count audio as speech. This is not very accurate VAD but it is ok for many cases (no big noise, clean audio). It can be extended to frequency subbands and mixed with noise suppression by spectral subtraction. Noise suppression combined with VAD is even more complex task to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simple start you can implement energy-based VAD (google can give you many examples of implementation)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;iii. divide the signal into phones using FFT (where do I get dataset for phones, what constitutes a boundary between two phones, and how similar does the detected phones have to match the dataset?) &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For DTW comparison with the prerecorded audio you do not need to care about phones at all. For HMM-based recognition, HMM decoding algorithm finds boundaries between phones implicitly but actually it doesn't even need them. Speech is considered as a sequence of subphone states, not as phones. Phones are not very stable to model with HMM. You can find description of the algorithm in the Rabiner's paper linked above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The database of phone properties is extracted from transcribed recordings. There are many public databases available (some are mentioned on cmusphinx website).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;iv. matching the list of phones to each word using HMM or DTW&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is no such thing neither in HMM nor in DTW. You match the audio to the word model, not taking individual phones into account. You will have to implement a separate training algorithm.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For beginners like me I feel that steps 2-3 is the hardest part due to the difficulties I listed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Since your process is not very accurate the difficulty estimation is not very meaningful too. HMM training and decoding are quite complex tasks, VAD or FFT are simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The topic is not very easy, it is complex. You can not expect to implement calculus algorithm without knowing the theory of calculus, like what is integration and so on, so the speech recognition. There are many tutorials around, this one is ok to get started too:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://kastnerkyle.github.io/blog/2014/05/22/single-speaker-speech-recognition/&quot; rel=&quot;nofollow&quot;&gt;http://kastnerkyle.github.io/blog/2014/05/22/single-speaker-speech-recognition/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe it will be helpful for you. However, take into account that any simple tutorial is usually not very professional and doesn't really cover things. Speech recognition can not really be explained in 10 pages of text. If you really want to understand a topic, read a textbook or attend a course on ASR.&lt;/p&gt;&#xA;" OwnerUserId="3453" LastEditorUserId="3453" LastEditDate="2014-11-29T12:37:11.563" LastActivityDate="2014-11-29T12:37:11.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19372" PostTypeId="1" CreationDate="2014-11-29T03:54:09.663" Score="1" ViewCount="2019" Body="&lt;p&gt;I have not studied signal processing at all, so please forgive any ignorance in the following discussion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some noisy position measurements that I've been trying to smooth. I've been attempting Kalman filtering but getting either hf noise or lf oscillation depending on the constants I put in. What should I do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full story:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used a program which is basically like this (I read briefly about how the Kalman filter works and made my own version):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for z_measurement in samples:&#xA;    expected.r = old_estimate.r + old_estimate.r * delta_t&#xA;    expected.v = old_estimate.v + old_estimate.a * delta_t&#xA;    error = z_measurement - predicted.r&#xA;    new_estimate.r = old_estimate.r + gain.r * error&#xA;    new_estimate.v = old_estimate.v + gain.v * error&#xA;&#xA;    old_estimate = new_estimate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This worked fine for constant acceleration, but when I have a slowly changing (uncontrolled) acceleration (drag which appears slowly decrease) as another state variable, I had a trade off. As I lowered the position gain, I got rid of high frequency noise, but I got even worse low frequency noise which overwhelmed the signal in the acceleration. The position gain seemed to act like shock absorbers, but let through too much high frequency noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to learn real Kalman filtering to see if that could help. I do not have a control system, so I'm ignoring B and u. It seems to turn into a computer program like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for z_measurement in samples:&#xA;    x_prediction = A_update * x_old_estimate&#xA;    P_int_covariance = A_update * P_old_covariance * A_update + Q_process_error&#xA;    K_gain = P_int_covariance * H_measure * (H_measure * P_int_covariance * H_measure + R_measure_error)**-1&#xA;    x_new_estimate = x_prediction + K_gain * (z_measurement - H_measure * x_prediction)&#xA;    P_new_covariance = (Identity - K_gain)* P_int_covariance&#xA;&#xA;    x_old_estimate = x_new_estimate&#xA;    P_old_covariance = P_new_covariance&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine for calculating averages, but looks non-trivial to define &lt;strong&gt;P&lt;/strong&gt;, &lt;strong&gt;Q&lt;/strong&gt;, and &lt;strong&gt;R&lt;/strong&gt; right for a real system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I now understand of Kalman filtering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A&lt;/strong&gt; is the prediction model of the system. It corresponds exactly to my previous program:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;expected.r = old_estimate.r + old_estimate.r * delta_t&#xA;expected.v = old_estimate.v + old_estimate.a * delta_t&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;H&lt;/strong&gt; is a meaningless function used to access the measured parameter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;expected.r&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q&lt;/strong&gt; and &lt;strong&gt;R&lt;/strong&gt; are error matrices that define the expected noise/error at each stage, and P defines how error of one state variable increases the error of other variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However &lt;strong&gt;Q&lt;/strong&gt; and &lt;strong&gt;R&lt;/strong&gt; are constants, and &lt;strong&gt;P&lt;/strong&gt; and &lt;strong&gt;K_gain&lt;/strong&gt; quickly converges to constants when &lt;strong&gt;Q&lt;/strong&gt; exists. In fact &lt;strong&gt;K_gain&lt;/strong&gt; is the only useful matrix (the others are only used to calculate the eventually constant &lt;strong&gt;K_gain&lt;/strong&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that rather than using dark arts to guess &lt;strong&gt;Q&lt;/strong&gt; and &lt;strong&gt;R&lt;/strong&gt;, you can do it directly by playing with &lt;strong&gt;K_gain&lt;/strong&gt; until it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which a few days later leads me back to my original program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will persisting and correctly defining &lt;strong&gt;Q&lt;/strong&gt; and &lt;strong&gt;R&lt;/strong&gt;, (or &lt;strong&gt;K&lt;/strong&gt; directly) actually give me gain constants that get rid of my noise and oscillations, or would I be better off trying non-linear gain functions. Alternatively should I put up with the high-frequency noise and use a separate low-pass filter afterwards, but then would it be better to do simple low pass filtering and totally forget the Kalman filtering?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other filters I should try? I'm afraid that linear filtering will loose too much signal. I tried some quadratic filtering and ended up with oscillations with periods related to the length of the filtering window.&lt;/p&gt;&#xA;" OwnerUserId="11882" LastActivityDate="2015-02-27T12:56:13.047" Title="How to get rid of noise and oscillations using Kalman filtering" Tags="|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19373" PostTypeId="2" ParentId="19353" CreationDate="2014-11-29T04:47:41.810" Score="1" Body="&lt;p&gt;In the absence of other answers, and sorry if you have already considered this, but the power method can be very fast with a sparse matrix. You may like to check out how Google does it (eigenvectors are used for page rank, which is pretty fast).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.m.wikipedia.org/wiki/PageRank&quot; rel=&quot;nofollow&quot;&gt;http://en.m.wikipedia.org/wiki/PageRank&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Because of the large eigengap of the modified adjacency matrix&#xA;  above,[22] the values of the PageRank eigenvector can be approximated&#xA;  to within a high degree of accuracy within only a few iterations.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Footnote 22 points to: http: //www-cs-students.stanford.edu/~taherh/papers/secondeigenvalue.pdf&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Footnote 23 discusses how to make the calculation even faster&#xA;http: //projecteuclid.org/euclid.im/1150474883&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not read the papers, but I hope that you find one of them to be useful. (I had to break the links as new users can not post many links.)&lt;/p&gt;&#xA;" OwnerUserId="11882" LastActivityDate="2014-11-29T04:47:41.810" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19374" PostTypeId="2" ParentId="19365" CreationDate="2014-11-29T04:55:27.813" Score="0" Body="&lt;p&gt;Here is an example that you can play around with to get the better intuition that you seek. I.e. design a few different filters and hack the zp2sos method (which is not a MATLAB port, despite the name) to create biquad sections in different ways. There are also a couple other filter design codebases that may be of interest, referenced in the readme:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/ruohoruotsi/Butterworth-Filter-Design&quot; rel=&quot;nofollow&quot;&gt;https://github.com/ruohoruotsi/Butterworth-Filter-Design&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2014-11-29T04:55:27.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19375" PostTypeId="2" ParentId="19289" CreationDate="2014-11-29T05:11:30.793" Score="2" Body="&lt;p&gt;As good as AUDFPRINT is, I think it is overkill for your problem, as is solving a different problem (where the audio being compared can be arbitrary). You already know what that your shorter file and your longer file capture the same audio scene and you only need to calculate the &quot;offset&quot; between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This thread on cross-correlation has a lot of good info:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/18630/cross-correlation-vs-fft-for-finding-phase-between-2-signals/18634#18634&quot;&gt;Cross correlation vs FFT for finding phase between 2 signals&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar&quot;&gt;How do I implement cross-correlation to prove two audio files are similar?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go the cross-correlation route, I think that phase-correlation (variant) will give you much better results, than simply the basic cross-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The primary difference is that you normalize your fft coefficients to unit magnitude prior to your inverse-fft, so the phase-correlation is based only on phase information and is insensitive to changes in magnitude/intensity (which makes it more robust, able to synchronize quiet and loud recordings of the same scene)&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2014-11-29T05:11:30.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19376" PostTypeId="2" ParentId="19372" CreationDate="2014-11-29T08:44:07.903" Score="1" Body="&lt;p&gt;First, I think your motion equations are wrong. Assuming a constant acceleration model, the transition matrix, $\mathbf{A}$, should look like that:&lt;br&gt;&#xA;$$&#xA;\mathbf{A} = \left[\begin{array}&amp;amp; 1 &amp;amp; \Delta_t &amp;amp; 0.5\Delta^2_t \\ 0 &amp;amp; 1 &amp;amp; \Delta_t\\ 0 &amp;amp; 0 &amp;amp; 1\end{array}\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, for your question, if the measurement noise (defined by $\mathbf{R}$) and the model noise (defined by $\mathbf{Q}$) are Gaussian, then the Kalman filter is the linear MMSE. That means that it is the optimal linear estimator in the MMSE sense.&lt;br&gt;&#xA;Playing directly with the filter's gain yields a simple exponential averaging of the data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have access, I would recommend &lt;a href=&quot;http://books.google.co.il/books/about/Tracking_and_Data_Association.html?id=B_FQAAAAMAAJ&amp;amp;redir_esc=y&quot; rel=&quot;nofollow&quot;&gt;Tracking and Data Association by Bar-Shalom and Fortmann&lt;/a&gt;. This is an excellent book that covers Kalman filtering.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="90" LastEditDate="2015-02-27T12:56:13.047" LastActivityDate="2015-02-27T12:56:13.047" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19377" PostTypeId="2" ParentId="19366" CreationDate="2014-11-29T12:55:40.843" Score="1" Body="&lt;p&gt;You should not experience any major drawbacks. &#xA;Generally such techniques utilize adaptive thresholds and rely on gradient orientations (especially normalized ones), which are intrinsically invariant to uniform illumination and contrast changes. In other words, brightness changes will not effect your subpixel positions, if you are using an appropriate corner detection algorithm.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-11-29T12:55:40.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19379" PostTypeId="1" AcceptedAnswerId="22243" CreationDate="2014-11-29T16:43:13.167" Score="5" ViewCount="1980" Body="&lt;p&gt;I've seen many questions on this forum regarding pitch detection for musical instruments (commonly guitar), and spent a while reading through the answers to create a basic implementation of auto-correlation to make an Android guitar tuner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the algorithm I'm using (implemented in Java on an Android phone):&#xA;&lt;pre&gt;&lt;code&gt;1) Record a short[4096] array of raw audio data from an Android phone's microphone at 48kHz sample rate&#xA;2) Apply a Hanning window to the raw audio data&#xA;3) Zero-pad the result to double the length (8192)&#xA;4) Apply auto-correlation with FFTs&#xA;5) Normalize the auto-correlation result&#xA;6) Get the periodicity from the peak bin indexes&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that with an actual guitar it is not robust (around 50% accurate at best), and I don't know how to filter noise either (without any loud noise, just ambient white noise, it outputs garbage frequencies). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It fares much better when I whistle at it, or play a generated sine tone from a computer, but that's expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my search for ways to improve my implementation, many answers (on this forum and others) usually point to using a better algorithm like YIN, but I think its more likely that I've made a mistake in my implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anything seem obviously incorrect from the algorithm I posted? Are there tweaks I can apply? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;pre&gt;&lt;code&gt;1) Increase the Android microphone sensitivty&#xA;2) Band-pass the raw data before the algorithm&#xA;3) Record more samples&#xA;4) ???&lt;/pre&gt;&lt;/code&gt; And does anybody have any idea how I could filter out noise by using the auto-correlation result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="11885" LastActivityDate="2015-03-22T13:25:34.050" Title="Improving an auto-correlation based guitar pitch detector" Tags="|noise|autocorrelation|pitch|music|java|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19384" PostTypeId="2" ParentId="19362" CreationDate="2014-11-30T00:30:42.077" Score="1" Body="&lt;p&gt;Your method will work, but you need to first find the cutoff frequency by setting the magnitude response to $\sqrt {2} /2$. Then plug that in for $\omega$. &lt;/p&gt;&#xA;" OwnerUserId="11904" LastEditorUserId="7092" LastEditDate="2014-11-30T01:12:46.487" LastActivityDate="2014-11-30T01:12:46.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19386" PostTypeId="1" CreationDate="2014-11-30T03:28:06.770" Score="0" ViewCount="1080" Body="&lt;p&gt;I want to do a comparison of power spectral density of BFSK, 4FSK and 8FSK by using matlab &lt;code&gt;baseband&lt;/code&gt; module &lt;code&gt;&quot;fskmod&quot;&lt;/code&gt;.Following is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = 2;&#xA;freqsep = 32;&#xA;nsamp = 4;&#xA;Fs = 64;&#xA;x = randint(1000,1,M); % Random signal&#xA;y = fskmod(x,M,freqsep,nsamp,Fs); % Modulate.&#xA;ly = length(y);&#xA;% Create an FFT plot.&#xA;freq = [-Fs/2 : Fs/ly : Fs/2 - Fs/ly];&#xA;Syy = 10*log10(fftshift(abs(fft(y))));&#xA;plot(freq,Syy)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this configuration, I get a very good spectrum but when I change nsamp to 8 or any other value,multiple lobes start to appear between two frequencies. The confusion is in the understanding of the relation of nsamp and frequency separation. Could any one solve this confusion???&lt;/p&gt;&#xA;" OwnerUserId="11907" LastEditorUserId="7092" LastEditDate="2014-11-30T04:02:08.913" LastActivityDate="2015-01-10T08:06:42.230" Title="Confusion in the spectrum of FSK modulated signal by using matlab fskmod module" Tags="|matlab|frequency-spectrum|frequency|modulation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19388" PostTypeId="1" CreationDate="2014-11-30T14:57:15.297" Score="2" ViewCount="1592" Body="&lt;p&gt;I'm reading Szeliski's Computer Vision:Algorithms and Applications. On page 212-213, corner detector is discussed. I can understand upto equation 4.8. From then on, I don't understand how come eigenvectors of A specified the direction of slowest and fastest changes, and why does the shorter eigenvector specified the direction of fastest change?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book can be found here &lt;a href=&quot;http://szeliski.org/Book/drafts/SzeliskiBook_20100903_draft.pdf&quot; rel=&quot;nofollow&quot;&gt;http://szeliski.org/Book/drafts/SzeliskiBook_20100903_draft.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="11911" LastActivityDate="2014-12-03T19:42:35.550" Title="Why do eigenvectors specify the direction of fastest and slowest changes in the image" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19389" PostTypeId="2" ParentId="19262" CreationDate="2014-11-30T15:18:04.193" Score="2" Body="&lt;p&gt;First, you need to start with in the s domain where a 2nd order transfer function (2 pole low pass filter) which can be written as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H(s) = s^2 + 2zws + w^2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets start with omega = 1 and zeta = sqrt(2)/2, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H(s) = s^2 + 1.414 s + 1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This filter's response and pole locations are shown here.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/AiPmQ.png&quot; alt=&quot;2 pole Butterworth response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To peak the response, simply modify zeta. Here zeta = 0.17 and omega = 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H(s) = s^2 + 0.34 s  + 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4YWmn.png&quot; alt=&quot;2 pole with zeta = 0.17 and omega = 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then to move the frequncy, change Omega. &#xA;Here zeta = 0.17 and omega = 0.39&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H(s) = s^2 + 0.1326s + 0.1521&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EIT7O.png&quot; alt=&quot;2 pole with zeta = 0.17 and omega = 0.39&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now all that is left is to determine the z domain coefficients. To do this, use the bilinear transform as shown here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FzctI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the the last example I gave, use  A=1, B=0.136, C=0.1521, D=E=0, F=1, T=2 to calculate the a's and b's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://www.iowahills.com/A4IIRBilinearTransform.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt; for a derivation of the equations given here. Here is a rather &lt;a href=&quot;http://www.iowahills.com/FilterPolynomials.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple tool&lt;/a&gt; that can generate any 2nd order response you want.  &lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2014-11-30T15:18:04.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19391" PostTypeId="1" CreationDate="2014-12-01T00:57:51.047" Score="0" ViewCount="661" Body="&lt;p&gt;I have got a set of pressure data from a boiler which has been sampled at 45Hz and I need to extract a frequency component of 250Hz from the signal. Using a standard FFT method doesn't display anything apart from frequency components between 0 and 10Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read similar questions posted on the forum with no success in solving my problem. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Matlab code&#xA;&#xA;filename = 'boilerp.xlsx';&#xA;columnA = xlsread(filename,'A:A');&#xA;&#xA;Fs =45;&#xA;&#xA;L=length(columnA);&#xA;&#xA;nfft = 2^nextpow2(L);&#xA;&#xA;XT = fft(columnA, nfft)/L;&#xA;&#xA;f= Fs/2*linspace(0,1,nfft/2+1);&#xA;&#xA;plot(f, 2*abs(XT(1:nfft/2+1)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Khel&lt;/p&gt;&#xA;" OwnerUserId="11915" LastEditorUserId="8202" LastEditDate="2015-04-30T22:17:45.367" LastActivityDate="2016-02-25T04:15:11.440" Title="Signal processing for undersampled signal" Tags="|matlab|fft|" AnswerCount="2" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19392" PostTypeId="1" CreationDate="2014-12-01T04:57:52.390" Score="0" ViewCount="1216" Body="&lt;p&gt;I am trying to plot the magnitude of H(z), I got it to factore, and would like to sketch its plot of magnitude. But I am have trouble evaluating the function. &#xA;$$&#xA;H(z)= \frac{(1-2z^{-1})(1+0.5z^{-1})(1+0.9z^{-1})}{(1-z^{-1})(1-0.7jz^{-1})(1+0.7jz^{-1})}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know we replace z with $e^{jw}$ and try to evaluate it at various w such as pi, pi/2 etc. But that is really complicated and when I tried it I couldn't get the right answer as the text book. Is there an easier way to evaluating magnitude and phase by hand? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11151" LastActivityDate="2014-12-01T12:32:26.940" Title="sketching magnitude of frequency response of H(z)" Tags="|frequency-response|magnitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19393" PostTypeId="1" CreationDate="2014-12-01T05:27:58.550" Score="1" ViewCount="147" Body="&lt;p&gt;I came across this basic problem in DSP which is not my area owf expertise but I consider this problem to be a common problem which others might be addressing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have multiple time series data and I need to find a time series data that is a representative of all those data. One method that I am applying is averaging the signals but I am sure there will be some other sophisticated methods to do the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the other methods that I can apply? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks  &lt;/p&gt;&#xA;" OwnerUserId="11918" LastActivityDate="2015-06-29T15:59:32.853" Title="One representative time series signal from multiple time series data" Tags="|matlab|python|signal-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19396" PostTypeId="1" AcceptedAnswerId="19403" CreationDate="2014-12-01T07:33:07.710" Score="0" ViewCount="4510" Body="&lt;p&gt;Given a 128 Hz signal, in MATLAB I entered the following command&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[B,A] = butter(2,[1/64,63/64],'bandpass'); %construct second order all pass filter&#xA;Filtered_Data = filter(B,A, Data) %filter data using butterworth filter&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iyHO6.png&quot; alt=&quot;Original Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And got&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YrtRU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is far from what I expected since the filter should have passed all frequencies. an someone help point out what I'm doing incorrectly?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2014-12-01T13:36:42.137" Title="Why is this MATLAB butterworth filter giving me wrong results" Tags="|matlab|filters|bandpass|finite-impulse-response|eeg|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19397" PostTypeId="2" ParentId="19396" CreationDate="2014-12-01T08:47:18.490" Score="-1" Body="&lt;p&gt;The problem might be in the way you are defining the cut-off frequencies.&#xA;Matlab uses normalized frequencies (look at the examples here &lt;a href=&quot;http://it.mathworks.com/help/signal/ref/butter.html&quot; rel=&quot;nofollow&quot;&gt;http://it.mathworks.com/help/signal/ref/butter.html&lt;/a&gt;), therefore you have to define them in this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assuming you want to cut your signal at $5 Hz$ and $100 Hz$ and your sampling frequency is $Fs$ (which you haven't specify)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cut_f1 = 5;&#xA;cut_f2 = 100;&#xA;Wn = [cut_f1/(Fs/2) cut_f2/(Fs/2)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the $Wn$ you have to pass to the butter() function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, I suggest you to use the command&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filtfilt()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to filter your data in such a way to null the phase shift introduced by the filter (&lt;a href=&quot;http://it.mathworks.com/help/signal/ref/filtfilt.html&quot; rel=&quot;nofollow&quot;&gt;http://it.mathworks.com/help/signal/ref/filtfilt.html&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="11580" LastEditDate="2014-12-01T12:18:52.700" LastActivityDate="2014-12-01T12:18:52.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19400" PostTypeId="2" ParentId="19392" CreationDate="2014-12-01T11:00:05.900" Score="1" Body="&lt;p&gt;Since you have the transfer function factored into poles and zeros, it's easiest to draw the pole-zero diagram to get an idea of the overall shape of $H(z)$. The first thing you notice is the pole at $z=1$, i.e. at DC. So your filter is unstable and $|H(e^{j\omega})|$ goes to infinity at DC. Furthermore there's a complex conjugate pole pair on the imaginary axis, i.e. at half the Nyquist frequency. So you can expect a small bump around that frequency. Finally, I would calculate the value of $H(z)$ at Nyquist, i.e. at $z=-1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(-1)=\frac{3\cdot 0.5\cdot 0.1}{2\cdot 1.49}\approx 0.05$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more detailed sketch than that is indeed difficult, but that's probably not the idea of the exercise.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-12-01T12:32:26.940" LastActivityDate="2014-12-01T12:32:26.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19401" PostTypeId="1" CreationDate="2014-12-01T12:04:59.677" Score="1" ViewCount="182" Body="&lt;p&gt;I have a sample of graphs (more than 10000...).&#xA;that look like in the image below:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mBcIS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am searching for an unsupervised learning algorithms that can help me to detect anomalous observations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here what I suggest for beginning: for every observation I have a collection of points $(x,y)$. With this collection, I find Fourier series with regression (I compute coefficients with the base $\{1,\sin(x),\cos(x),\sin(2x),\cos(2x)\dots\}$).&#xA;Now I have a set of coefficients instead of waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somebody have an idea how to detect anomaly?&lt;/p&gt;&#xA;" OwnerUserId="11925" LastActivityDate="2015-05-02T10:34:18.433" Title="Unsupervised learning algorithms to detect anomaly in waves" Tags="|signal-analysis|signal-detection|statistics|machine-learning|wave|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19402" PostTypeId="2" ParentId="19393" CreationDate="2014-12-01T13:24:06.450" Score="2" Body="&lt;p&gt;Decision of representative is usually formulated as an optimization problem. The optimal representative minimizes sum of some dissimilarity measures from the observed signals. The average you indicated is optimal in the sense of minimization of Euclidean distance. If you want to minimize feet of perpendiculars, you can use the first principal component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the problem is how to choose the dissimilarity measure. In signal processing, we often consider some probabilistic model and use the dissimilarity measure proportional to the negative log likelihood. This is often referred to as maximum likelihood estimation. For example, Euclidean distance corresponds to the negative log likelihood of mean parameter of Gaussian distribution. Even using the same Gaussian distribution, there can be various ways of modeling, and various dissimilarity measures are derived such as Mahalanobis distance and Itakura-Saito distance.&lt;/p&gt;&#xA;" OwnerUserId="11922" LastActivityDate="2014-12-01T13:24:06.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19403" PostTypeId="2" ParentId="19396" CreationDate="2014-12-01T13:36:42.137" Score="2" Body="&lt;p&gt;Your filter is passing only between 1 and 63 Hz, assuming that you meant to say that the sampling rate is 128Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are removing everything below 1Hz, the plot you have looks reasonable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The range of values in your original signal is relatively small (4395 to 4420,) and the range of values in the output plot is also relatively small (cannot tell exactly due to scaling, but it looks small.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The high values (+4000, -2000) in your output plot are the step response of your filter.  Your data jumps from zero (before the first data point comes in) to around 4400 at the beginning.  This step causes the filter to overreact - the short peaks up to 4000 and down to -2000 are the result.  This damps out right away, and the rest looks pretty much like what would be expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The offset (about 4400) looks like a DC component to the filter.  Since DC is lower than 1Hz, it gets removed as well.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-12-01T13:36:42.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19404" PostTypeId="2" ParentId="19149" CreationDate="2014-12-01T14:12:50.107" Score="0" Body="&lt;p&gt;Let $r_k$ be the sequence of $N$ measured noise samples. Then&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Peak-to-peak value&#xA;$$&#xA;r_\mathrm{pp} = \operatorname{max}(r_k) - \operatorname{min}(r_k)&#xA;$$&lt;/li&gt;&#xA;&lt;li&gt;RMS value&#xA;$$&#xA;r_\mathrm{RMS} = \sqrt{\frac{1}{N}\sum_k r_k^2}&#xA;$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But Robert's answer should be taken seriously, especially the comment about peaks of Gaussian random variables. If your noise source is really Gaussian, the probability of a certain peak value increases with $N$. You should also take into account the limited range of values of your measurement device.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-12-03T09:10:25.717" LastActivityDate="2014-12-03T09:10:25.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19405" PostTypeId="2" ParentId="19391" CreationDate="2014-12-01T14:58:17.140" Score="0" Body="&lt;p&gt;According to Kotelnikov theorem, maximum frequency represented by a sampled signal is Fs/2, so there is no frequency of 250 Hz in the signal sampled by 45 Hz. I suggest center frequency of the original signal is 6*Fs=270 Hz. In this case, 250 Hz corresponds to -20 Hz for sampled signal.&lt;/p&gt;&#xA;" OwnerUserId="5643" LastActivityDate="2014-12-01T14:58:17.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19406" PostTypeId="2" ParentId="19391" CreationDate="2014-12-01T19:05:34.577" Score="1" Body="&lt;p&gt;Combining @JRE's comment and @Nikita's answer: if no anti-aliasing filter was applied to the signal, and no other frequencies alias to 20 Hz, then the 250 Hz component you're interested in will appear at 20 Hz in your sampled signal. See &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing#Sampling_sinusoidal_functions&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Aliasing#Sampling_sinusoidal_functions&lt;/a&gt; for more information on how this works.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-12-01T19:05:34.577" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19408" PostTypeId="1" CreationDate="2014-12-02T02:45:32.320" Score="0" ViewCount="62" Body="&lt;p&gt;My advisor wants me to take the area of visible light communication as my MS project, but I don't know whether there are any research value in this area, it seems most of the tenichnical difficulties are solved in this field. Any one has similar experience in this field? thank you !&lt;/p&gt;&#xA;" OwnerUserId="7285" LastActivityDate="2014-12-02T02:45:32.320" Title="Are there any research value in visible light communication?" Tags="|digital-communications|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19410" PostTypeId="1" AcceptedAnswerId="19413" CreationDate="2014-12-02T06:32:37.540" Score="0" ViewCount="437" Body="&lt;p&gt;Given a z transform with one pole can you have a 2 sided Region of convergence or does 1 pole limit it to being only left or right sided? I know when you have two poles the 2 sided scenario is when a &quot;ring&quot; forms between the two poles in the z-space but when you have one pole does the case when the entire z space is in the RoC excluding the ring formed by the one pole count as the two sided case?&lt;/p&gt;&#xA;" OwnerUserId="11934" LastActivityDate="2018-12-08T23:48:58.220" Title="2-sided Regions of convergence for Z transforms" Tags="|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19411" PostTypeId="1" CreationDate="2014-12-02T07:08:17.290" Score="0" ViewCount="81" Body="&lt;p&gt;Hilbert transform is used to transfer signal into analytical signal. But why after the transform, the envelop and instant frequency (if the signal is monogenic) can be calculated. What is happened in the transform? What is the relationship between these two signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, according to wiki page analytic signal is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In mathematics and signal processing, a signal which has no&#xA;  negative-frequency components is called an analytic signal&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;why to use Hilbert transform, instead of Fourier transform to calculate analytical signal? Is there a special reason to do so?&lt;/p&gt;&#xA;" OwnerUserId="7602" LastEditorUserId="8202" LastEditDate="2014-12-02T08:39:54.250" LastActivityDate="2014-12-02T08:39:54.250" Title="What is the relationship between signal and its analytical version?" Tags="|frequency|hilbert-transform|analytic-signal|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19412" PostTypeId="1" CreationDate="2014-12-02T07:44:27.167" Score="0" ViewCount="1257" Body="&lt;p&gt;I'm currently taking a course on signals and systems, and even though we are much ahead of frequency response, I still feel like I am missing an intuitive grasp of what the frequency response of a signal is. Specifically, when I look at the various CTFT pairs, it's difficult for me to intuitively understand why the pairs make sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If someone could provide an intuitive explanation of what frequency response is, that would be much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11935" LastActivityDate="2016-05-27T18:48:00.263" Title="Need intuition on the frequency response of a signal" Tags="|frequency-response|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19413" PostTypeId="2" ParentId="19410" CreationDate="2014-12-02T07:55:14.603" Score="1" Body="&lt;p&gt;With one pole you have only two possible regions of convergence, either $|z|&amp;lt;r$  (where $r$ is the pole radius), which corresponds to a left-sided sequence, or the region $|z|&amp;gt;r$, corresponding to a right-sided sequence. I think the misunderstanding lies in the concept of 'the ring formed by the one pole', because there is no such ring.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-02T07:55:14.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19415" PostTypeId="1" AcceptedAnswerId="19417" CreationDate="2014-12-02T10:04:51.130" Score="2" ViewCount="2198" Body="&lt;p&gt;I have a 50 Hz sine wave sampled at 1600 Samples/second.I'm computing the 16 point DFT.So my fundamental frequency is 100 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then decimated the 1600 samples to 400 samples.I then computed the 8 point DFT using this.Now my fundamental component is 50 Hz.The second harmonic is 100 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plotted the above two scenarios on matlab.In the first case (16 Point) the magnitude of the 100 Hz component is nearly 3.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second case (8 Point) the magnitude of the 100 Hz component is nearly zero.The magnitude of the 50 Hz component is nearly 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does this anomaly occur?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jose&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zjkmA.jpg&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code for this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%----------------------------Sine Wave------------------------------%&#xA;&#xA;f = 50;&#xA;&#xA;t = 0:(1/1600):(1-(1/1600))&#xA;&#xA;Signal = sin(2*pi*f*t);&#xA;&#xA;subplot(3,1,1)&#xA;&#xA;plot(t,Signal)&#xA;&#xA;ylabel('Amplitude')&#xA;&#xA;title('50 Hz Sine wave at 1600 samples/sec');&#xA;&#xA;%-------------------16 Point DFT-----------------------%&#xA;&#xA;DFT_app_16 = fft(Signal,16);&#xA;&#xA;subplot(3,1,2)&#xA;stem((0:100:1500),abs(DFT_app_16))&#xA;&#xA;ylabel('Magnitude')&#xA;title('16 Point DFT')&#xA;&#xA;%---------------------8 Point DFT--------------------------%&#xA;&#xA;Dec_Sample = [];&#xA;&#xA;for i = 1:4:1597&#xA;    Dec_Sample = [Dec_Sample ((Signal(1,i) + Signal(1,i+1) + Signal(1,i+2) + Signal(1,i+3))/4)]&#xA;&#xA;end&#xA;&#xA;&#xA;DFT_app_8 = fft(Dec_Sample,8);&#xA;&#xA;subplot(3,1,3)&#xA;stem((0:50:350),abs(DFT_app_8))&#xA;&#xA;xlabel('Frequency(Hz)')&#xA;ylabel('Magnitude')&#xA;&#xA;title('8 Point DFT')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11938" LastEditorUserId="1606" LastEditDate="2014-12-02T10:43:39.967" LastActivityDate="2014-12-02T18:05:57.180" Title="Why does an 8 point DFT behave differently from a 16 point?" Tags="|matlab|fft|dft|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19416" PostTypeId="1" CreationDate="2014-12-02T10:41:53.923" Score="0" ViewCount="59" Body="&lt;p&gt;I am trying to understand Haar transform of simple vector of numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some references I found say, that first level transform of $ X = (4,6,8,10,13,9,3,3)$ will be $\sqrt{2}(5,9,11,3, -1,-1,2,0)$. Others say, it will be $(5,9,11,3,-1,-1,2,0)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one is true? Or are they both correct in some way and am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And important question, which one do I use when I am performing Haar transform on image and this vector represents one row/column of pixels in image?&lt;/p&gt;&#xA;" OwnerUserId="11939" LastActivityDate="2014-12-02T21:11:47.620" Title="Haar transform definition" Tags="|image-processing|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19417" PostTypeId="2" ParentId="19415" CreationDate="2014-12-02T11:07:26.223" Score="5" Body="&lt;p&gt;Your sin frequency is 50 Hz, but in your 16 point DFT there is no 50 Hz bin.  There is a 0 Hz bin and a 100 Hz bin, and you can see that some of the signal power goes into both of them.  This is a non-ideal way of capturing a 50 Hz tone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 8 point DFT has a 50 Hz bin, and you can see that it captures almost all of the signal power.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-12-02T11:07:26.223" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19418" PostTypeId="2" ParentId="19416" CreationDate="2014-12-02T11:20:04.727" Score="1" Body="&lt;p&gt;The only difference between the two transform results is a gain factor.  The transform should have the same energy as the original data sequence, so we can use that to check for the right result.  The energy of $X$ is-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum X^2 = 484&#xA;$$&#xA;$$&#xA;\sum (5,9,11,3,−1,−1,2,0)^2 = 242&#xA;$$&#xA;$$&#xA;\sum (\sqrt{2}(5,9,11,3,−1,−1,2,0))^2 = 2\sum (5,9,11,3,−1,−1,2,0)^2 = 484&#xA;$$&#xA;This shows that of the two possible transforms, $\sqrt{2}(5,9,11,3,−1,−1,2,0)$ has the right energy and is thus the right choice.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2014-12-02T21:11:47.620" LastActivityDate="2014-12-02T21:11:47.620" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19419" PostTypeId="2" ParentId="19415" CreationDate="2014-12-02T11:21:04.797" Score="2" Body="&lt;p&gt;The difference isn't in the DFT.  The difference comes from the decimation.&#xA;Lowering the sampling rate by 4 changes the bins.&lt;br&gt;&#xA;Before decimation, and using  a sampling rate of 1600, you end up with frequency bins that are 100Hz wide.  Since 50Hz doesn't fit exactly, the energy for the 50Hz gets smeared across several bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After decimation, your sampling frequency is 400Hz.  With an 8 point fft, the bins are then 50Hz wide.  The full energy of the 50Hz signal is then contained entirely in one bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do an 8 point FFT on the signal before decimation, and you will see the smearing caused by the signal frequency being between bins just like you do with the 16 point FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use a 32 point FFT instead of a 16 point, then the smearing will also go away - 32 bins at 1600 give bins 50 Hz wide.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-12-02T11:21:04.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19420" PostTypeId="2" ParentId="19415" CreationDate="2014-12-02T18:05:57.180" Score="0" Body="&lt;p&gt;Each FFT result bin represents a spectrum that is 2 bins wide to the nearest zeros, and actually infinitely wide (but tapered) if you include all the lesser Sinc function ripples.  So any pure sine waves that are not exactly integer periodic in the FFT width will appear in all the FFT result bins, but mostly in the two nearest FFT result bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your second graph is for a sine wave that is exactly integer periodic in the FFT width, and thus centered only in one bin, as the Sinc function just happens to be zero at all the other FFT result bins when the FFT width is an exact integer multiple of the sine wave's period.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-12-02T18:05:57.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19421" PostTypeId="2" ParentId="19388" CreationDate="2014-12-02T20:53:35.403" Score="2" Body="&lt;p&gt;The eigenvector corresponding to the largest eigenvalue of the autocorrelation matrix indicates the direction of fastest change, while the eigenvector of the smallest eigenvalue indicates the direction of slowest change. Nothing strange here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's confusing is the Uncertainty Ellipse (Figure 4.6, page 213). The direction of slowest change is longer because it's scaled by the square root of the &lt;em&gt;inverse&lt;/em&gt; eigenvalue of A. Really what it represents is the direction of the highest uncertainty. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Uncertainty and speed of change are different sides of the same coin: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;high uncertainty &amp;lt;--&gt; slow change&lt;/li&gt;&#xA;&lt;li&gt;low uncertainty &amp;lt;--&gt; fast change&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The purpose of all this is to help us find good match points in an image. An example of a good match point is shown in Figure 4.5b. The reason it's &quot;good&quot; is because it has a well defined optimum. This occurs when the image has fast change in more than one direction (i.e. both eigenvalues of the autocorrelation matrix are large). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 4.5c shows a match point that doesn't have a well defined optimum (it's more like a  ridge). The fact that we cannot precisely point to the optimum means that there is uncertainty in the direction of the ridge. The autocorrelation function of this patch will have one large eigenvalue and one small eigenvalue. The large eigenvector is in the direction of fastest change (a direction perpendicular to the ridge), while the small eigenvector is in the direction of the ridge. &lt;/p&gt;&#xA;" OwnerUserId="11618" LastEditorUserId="11618" LastEditDate="2014-12-03T19:42:35.550" LastActivityDate="2014-12-03T19:42:35.550" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19422" PostTypeId="1" AcceptedAnswerId="19423" CreationDate="2014-12-02T22:57:19.620" Score="1" ViewCount="4928" Body="&lt;p&gt;I am trying to calculate the FFT of a signal stored in a WAV file using SciPy. I found a solution &lt;a href=&quot;https://stackoverflow.com/questions/23377665/python-scipy-fft-wav-files&quot; title=&quot;here&quot;&gt;here&lt;/a&gt;, but it seems like we need to perform this step before the FFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b=[(ele/2**8.)*2-1 for ele in a] # this is 8-bit track, b is now normalized on [-1,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the signal samples are stored in array &lt;code&gt;a&lt;/code&gt;. Can someone explain the significance of this step?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="11919" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2014-12-03T06:31:34.997" Title="Why do we need to normalize a WAV file before calculating the FFT?" Tags="|fft|signal-analysis|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19423" PostTypeId="2" ParentId="19422" CreationDate="2014-12-02T23:57:07.443" Score="1" Body="&lt;p&gt;It seems that the WAV file used in that example has samples with values between 0 and 255 (likely stored as unsigned chars). The normalization step just changes the samples to floating point values in the range [-1,1). This is, strictly speaking, not necessary to perform the FFT, but it is a good idea. For instance, it removes the large DC component that results from interpreting the unsigned char values as actual signal amplitudes.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-12-02T23:57:07.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19424" PostTypeId="1" AcceptedAnswerId="19436" CreationDate="2014-12-03T02:47:52.457" Score="2" ViewCount="332" Body="&lt;p&gt;If I perform a number of camera calibration routines at a fixed resolution, with various sizes of calibration patterns (like checkerboards), at various distances and get various values for focal lengths,  could I just average them out? Would this just give a more &quot;robust&quot; focal length? Is it a good idea?&lt;/p&gt;&#xA;" OwnerUserId="11435" LastActivityDate="2015-01-21T14:32:33.583" Title="Can you average out focal length from different camera calibration sessions?" Tags="|computer-vision|camera|camera-pose|camera-calibration|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19426" PostTypeId="1" AcceptedAnswerId="19428" CreationDate="2014-12-03T06:17:58.677" Score="0" ViewCount="511" Body="&lt;p&gt;I am reading the lecture slides from this site &lt;a href=&quot;http://luthuli.cs.uiuc.edu/~daf/courses/CS-498-DAF-P/Lecture%2018%20-%20Time%20series,%20DTW.pdf&quot; rel=&quot;nofollow&quot;&gt;http://luthuli.cs.uiuc.edu/~daf/courses/CS-498-DAF-P/Lecture%2018%20-%20Time%20series,%20DTW.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In slide 24, the lecture suggest using metric of the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;d(i, j) = ||f(i) - f(j)||&#xA;&#xA;select top frequency in i and top frequency in j, &#xA;    find the Euclidean distance between the two&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not exactly sure what do they mean by Euclidean distance between the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did they meant to have top n frequency sorted in order and match the order for subtraction and find the euclidean distance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f1 = [1, 2, 3, 4]&#xA;&#xA;f2 = [1, 100, 200 ,300]&#xA;&#xA;&#xA;d(1,2) = |1-1| + |100-2| + |200-3| + |300-4|&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11919" LastActivityDate="2014-12-03T07:39:38.350" Title="What is the distance metric in dynamic time warping?" Tags="|fft|signal-analysis|frequency-spectrum|speech-recognition|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19427" PostTypeId="2" ParentId="19412" CreationDate="2014-12-03T06:55:50.640" Score="0" Body="&lt;p&gt;There is a very intuitive explanation of Fourier representation of signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/&quot; rel=&quot;nofollow&quot;&gt;http://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you mean the frequency representation when you mentioned frequency response this might help you.&lt;/p&gt;&#xA;" OwnerUserId="11208" LastActivityDate="2014-12-03T06:55:50.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19428" PostTypeId="2" ParentId="19426" CreationDate="2014-12-03T07:39:38.350" Score="1" Body="&lt;p&gt;The Euclidean distance between two vectors $\mathbf a$ and $\mathbf b$ is $\mathrm d(\mathbf a, \mathbf b) \equiv \sqrt {\sum_i (a_i - b_i)^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example you forgot to square the differences. Remember the way you calculate hypotenuse of a triangle; it's the same idea.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2014-12-03T07:39:38.350" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19429" PostTypeId="1" CreationDate="2014-12-03T07:43:01.123" Score="1" ViewCount="111" Body="&lt;p&gt;Depending on the size of the original image and depending on the kind of &lt;a href=&quot;http://www.pybytes.com/pywavelets/ref/signal-extension-modes.html&quot; rel=&quot;nofollow&quot;&gt;padding&lt;/a&gt; used during 2D discrete wavelet transform and reconstruction, the reconstructed image has a larger size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a general method given a &lt;code&gt;mxn&lt;/code&gt; matrix and given some padding mode to crop the obtained &lt;code&gt;pxq&lt;/code&gt; matrix to the &lt;code&gt;mxn&lt;/code&gt; matrix (without trying every possibility in order to find the one with the least error)?&lt;/p&gt;&#xA;" OwnerUserId="11947" LastActivityDate="2020-03-02T20:56:50.367" Title="Larger image after wavelet reconstruction" Tags="|wavelet|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19430" PostTypeId="2" ParentId="19401" CreationDate="2014-12-03T09:06:49.027" Score="1" Body="&lt;p&gt;Try Nonparametric Statistics. &#xA;You may divide your random trajectories into parts and compare their statistic characteristics (mean and variance). Smth like this (but not exactly):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cscjournals.org/manuscript/Journals/SPIJ/volume7/Issue1/SPIJ-210.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cscjournals.org/manuscript/Journals/SPIJ/volume7/Issue1/SPIJ-210.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11948" LastActivityDate="2014-12-03T09:06:49.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19431" PostTypeId="1" AcceptedAnswerId="19432" CreationDate="2014-12-03T09:22:12.123" Score="1" ViewCount="164" Body="&lt;p&gt;Recently, I am thinking about a problem regarding image projection. I have a larger picture as bellow.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6JuCL.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the transformation matrix, x'=Hx. When the above image pass the transformation matrix H, I will get another smaller picture as bellow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JVPeF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to use SIFT to find four major points and use these points to implement DLT algorithm. However, after executing SIFT, I find that there are many matching error as bellow. The distRatio is 0.5&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/stkkg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have thought for almost two weeks. Is there any different ideas which can be use to solve this problem. Thank you very much. &lt;/p&gt;&#xA;" OwnerUserId="11826" LastActivityDate="2014-12-03T10:55:05.387" Title="Image Projection with SIFT" Tags="|image-processing|sift|projection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19432" PostTypeId="2" ParentId="19431" CreationDate="2014-12-03T10:55:05.387" Score="-1" Body="&lt;p&gt;The logo you are looking at is symmetric. For example, you could rotate it by 120 degrees and get the same pattern. If you take a look, many of the &quot;errors&quot; are not really errors. The same pattern appears in your image many times. It is called self-similarity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do several things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Change descriptors to avoid confusion between features that are similar in an image.&lt;/li&gt;&#xA;&lt;li&gt;Instead of finding one match for keypoint, find 3 matches and test multiple combinations by fitting a transformation and checking which fits better.&lt;/li&gt;&#xA;&lt;li&gt;Limit the transformation by rotation angle, mirror, etc. For example, angle must not be larger than 60 degrees&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="698" LastActivityDate="2014-12-03T10:55:05.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19433" PostTypeId="1" CreationDate="2014-12-03T13:45:50.407" Score="2" ViewCount="1111" Body="&lt;p&gt;I am new to the stream of digital signal processing, and hence my doubt may seem extremely stupid, but:&#xA;In tools such as matlab, signals are stored in a single array. If i convolute it with an LPF array, i get another array/signal, that has certain elements attenuated, can i find out which elements these are and completely remove them from the new array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does my question even make sense? :/&lt;/p&gt;&#xA;" OwnerUserId="11952" LastActivityDate="2014-12-04T07:53:30.123" Title="Removing 'high-frequency' components from an array?" Tags="|matlab|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19434" PostTypeId="2" ParentId="19433" CreationDate="2014-12-03T14:24:00.730" Score="1" Body="&lt;p&gt;You mention convolution which implies that your arrays represent time domain signals. As this is &lt;em&gt;digital&lt;/em&gt; signal processing, the time is discretized and every element of the array corresponds to a sample. Two consecutive samples have a fixed time distance, say $T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you convolve the discrete time signal with the impulse response of a low-pass filter (LPF) the resulting ouput signal will be longer than the input signal, because in general, linear time-invariant (LTI) systems have a memory (length of impulse response). You cannot reduce the array length without distorting the output signal (unless you use block-wise processing with overlap-add/-save, but that's another story). So, no matter what type of filter the impulse response of your LTI system represents, you cannot just remove elements from the output array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find out which frequency components are attenuated by a system you should analyze its transfer function (sometimes also refered to as frequency response). The transfer function is obtained by transforming the impulse reponse into the frequency domain. A tool for doing that with DSP is the discrete Fourier transform (DFT) which almost always comes in form of its FFT implementation (Fast Fourier transform). In case that the system in question is a black box and its impulse response is unknown the frequency domain representation of input and output signal can be compared to find out what frequencies are attenuated or amplified.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-12-03T14:24:00.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19435" PostTypeId="1" CreationDate="2014-12-03T14:45:19.617" Score="1" ViewCount="4233" Body="&lt;p&gt;I have a data vector which consists of calibrated pressure at each sampled point in time. I have also taken this signal, applied a filter bank to it using a butterworth filter with passbands according to third octave (i.e. band center frequency at 25, 31.5, 40,...,20,000), and for each band calculated $20\log(p_{rms}/p_{ref})$ where $p_{rms}$ is the root mean squared pressure for the resulting filtered signal in each band, and $p_{ref} =2\times10^{-5}$ Pa. This should give me the third octave &quot;spectrum&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now wish to calculate the total sound pressure level (SPL). I thought first I could say that $SPL = 20\log(p/p_{ref})$ where $p$ is just the root mean squared value of the entire data vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compare I thought I would then calculate the same quantity but this time starting from my third octave data. I would then hope to get the same answer by adding logarithmically (i.e. adding the rms values from each band and then converting to dB) the dB values from each third octave band. However this did not give matching results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I therefore suspect I am not converting from third octave to a single SPL quantity correctly, since my first calculation of SPL seems very straightforward. Am I missing something here? For instance does each third octave band need to be scaled by the frequency bin? This would imply I have some sort of density in third octave, but im not sure. &lt;/p&gt;&#xA;" OwnerUserId="5466" LastActivityDate="2014-12-03T16:11:00.240" Title="How to convert Third Octave data into single SPL quantity" Tags="|matlab|sound|octave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19436" PostTypeId="2" ParentId="19424" CreationDate="2014-12-03T15:42:00.703" Score="3" Body="&lt;p&gt;No, it is not a good idea.  Typically, you want to limit the volume of space relative to the camera in which you want to do your measurements, and you want to use a single calibration target appropriate for that volume.  In theory, you can calibrate with any number of different patterns.  In practice, however, most implementations assume that the pattern is the same in all calibration images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, if you insist on using multiple patterns, you still want to jointly optimize the parameters, not just to average them after the fact.  And you would most likely have to implement that yourself.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2015-01-21T14:32:33.583" LastActivityDate="2015-01-21T14:32:33.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19437" PostTypeId="2" ParentId="19366" CreationDate="2014-12-03T15:46:27.757" Score="0" Body="&lt;p&gt;Even though adjusting contrast or brightness is probably ok, you should be weary of tampering with your calibration images. Turning on more lights would be a better way to go.  On the other hand, definitely do not use any kind of filtering or sharpening, because that will change the position of the corners.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-12-03T15:46:27.757" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19438" PostTypeId="2" ParentId="19435" CreationDate="2014-12-03T16:02:41.403" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure that you are trying to compare same quantities, i.e. not $SEL$ with $L_{eq,C}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If third-octave levels were not measured with any kind of weighting and you are trying to calculate $L_{eq,A}$ for example, then you must apply &lt;a href=&quot;http://www.sengpielaudio.com/calculator-octave.htm&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;corrections&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each band calculate the anti-logarithm using the formula: $p_i=10^{L_i/10}$ (for example for $54.3 \mathrm{dB}$ that would be $218776.2$).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sum all values you obtained in previous step and calculate the total level as: $10\log_{10}\left(\sum p_i\right)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That will produce exact result - tested second ago on some data from SLM.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-12-03T16:11:00.240" LastActivityDate="2014-12-03T16:11:00.240" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19439" PostTypeId="2" ParentId="7636" CreationDate="2014-12-03T16:48:47.860" Score="1" Body="&lt;p&gt;Remember that the signal is not the samples; the signal passes &lt;em&gt;through&lt;/em&gt; the samples and exists &lt;em&gt;between&lt;/em&gt; them, too.  So the maximum value of one chunk cannot be less than the minimum value of the next; they can only be equal, as the signal passes from a lower sample in one chunk to a higher sample in the next chunk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plotting a solid line from the min of a chunk to the max sample value of a chunk is not a very accurate representation of the signal anyway (because of intersample peaks and not &lt;a href=&quot;https://dsp.stackexchange.com/q/184/29&quot;&gt;showing the density of the wave&lt;/a&gt;).  If that's good enough of a representation for you, I'd just approximate it by drawing to the midpoint in this case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;find max of chunk 1&#xA;find min of chunk 2&#xA;if max(chunk 1) &amp;lt; min(chunk 2):&#xA;    in column 1: draw line from min of chunk 1 to average(max(chunk 1), min(chunk 2))&#xA;    in column 2: draw line from average(max(chunk 1), min(chunk 2)) to max(chunk 2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to get fancier, you could upsample the signal to get a better idea of the intersample peaks, and then do the same thing based on those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the best is to use brightness to show the density of the wave at different amplitudes, but that's significantly more complicated: &lt;a href=&quot;https://flic.kr/p/7S8oHA&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://flic.kr/p/7S8oHA&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-12-03T18:21:48.810" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19440" PostTypeId="1" AcceptedAnswerId="19441" CreationDate="2014-12-03T16:49:23.400" Score="-3" ViewCount="171" Body="&lt;p&gt;Is there any way to detect water diseases using image processing ? and is there any way to develop it in android or in matlab thank you ?&lt;/p&gt;&#xA;" OwnerUserId="11955" LastActivityDate="2014-12-03T17:33:14.433" Title="Image processing to detect water diseases" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19441" PostTypeId="2" ParentId="19440" CreationDate="2014-12-03T17:33:14.433" Score="0" Body="&lt;p&gt;Sure you can.&#xA;You create a system able to collect samples from water periodically.&#xA;Them take a picture from sample using a microscopy.&#xA;And finally look for any protozoo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Amebiase, look for this man : &lt;a href=&quot;http://www.cdc.gov/parasites/amebiasis/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&#xA;Giardia, look for this: &lt;a href=&quot;http://www.cdc.gov/parasites/giardia/index.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is hard but always possible.&lt;/p&gt;&#xA;" OwnerUserId="11956" LastActivityDate="2014-12-03T17:33:14.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19442" PostTypeId="1" CreationDate="2014-12-03T18:54:54.167" Score="1" ViewCount="88" Body="&lt;p&gt;What I've learnt so far is that, if we change a time-domain signal into frequency domain, its bandwidth shows the range of frequency of radio waves that required to generate such signal. &#xA;However, for example in fiber optic,a 1550nm light is used to be the source and BPSK is used to modulate it, but if there is only a single frequency of light (1550nm) forming a signal, then what is the point of finding the bandwidth?&lt;/p&gt;&#xA;" OwnerUserId="11958" LastActivityDate="2014-12-04T04:25:49.857" Title="fundamental question regarding bandwidth" Tags="|frequency-spectrum|bandwidth|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19444" PostTypeId="1" CreationDate="2014-12-03T19:23:34.180" Score="0" ViewCount="804" Body="&lt;p&gt;I have an c5502 texas low cost DSP. &#xA;I can capture sound trough its P2 input and process every separated sample after sending it to the P2 output.&#xA;Im trying to implement some kind of effect in the sound, but this DSP has very low memory so i cant storage the signal to process it as a whole after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is any way of implementing effects like overdrive or even low pass filters in real time? I have tried somethings and it seems they arent enough to change the sound by modifying only sample by sample (using past results and samples)...&lt;/p&gt;&#xA;" OwnerUserId="8734" LastActivityDate="2021-11-27T22:58:24.390" Title="Guitar Effects/Filters in real time using low cost DSP?" Tags="|filters|real-time|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19445" PostTypeId="2" ParentId="19444" CreationDate="2014-12-03T19:46:14.780" Score="3" Body="&lt;p&gt;I'm sure you can implement a simple fuzz or overdrive effect on that board. Apply asymmetrical clipping to you your data, and filter the result with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_biquad_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;biquad IIR filter&lt;/a&gt;. You'll need a lowpass filter to smooth out some of the nasty high frequencies after clipping (try a cut-off frequency &lt;span class=&quot;math-container&quot;&gt;$f_c\in [4..7]$&lt;/span&gt;kHz), and you might want a parametric EQ to boost some mid frequencies. You can compute the filter coefficients using the &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audio EQ Cookbook&lt;/a&gt;. You can probably do much more than that but this should get you started.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4346" LastEditDate="2021-11-27T22:58:24.390" LastActivityDate="2021-11-27T22:58:24.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19446" PostTypeId="2" ParentId="19442" CreationDate="2014-12-03T20:11:09.983" Score="0" Body="&lt;p&gt;It's not a single frequency. You also have &lt;a href=&quot;http://en.wikipedia.org/wiki/Sideband&quot; rel=&quot;nofollow&quot;&gt;sidebands&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11618" LastActivityDate="2014-12-03T20:11:09.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19447" PostTypeId="1" CreationDate="2014-12-03T20:15:04.640" Score="-2" ViewCount="52" Body="&lt;p&gt;As the title says,w hat happens to the fourier transform of the sample output of $30KHz$ when sampled with sample frequency $44.1KHz$? I do not get how alias can appear, because fourier transform of pure sinusoidal signal contains impulse, not shape...&lt;/p&gt;&#xA;" OwnerUserId="11959" LastActivityDate="2014-12-04T04:21:39.163" Title="What happens to the fourier transform of sample result of $30kHz$ sinusoidal signal when sampled with sample frequency $44.1KHz$?" Tags="|signal-analysis|fourier-transform|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19448" PostTypeId="1" AcceptedAnswerId="19451" CreationDate="2014-12-03T20:41:52.290" Score="4" ViewCount="1779" Body="&lt;p&gt;For the last week or so I have been trying to understand how quantization error results in the noise floor outside of a mathematical perspective and I haven't really had any luck finding a source that discussed quantization noise without using equations to show where quantization error comes from.  I certainly have nothing against using math proofs but I was hoping to understand why quantization noise existed rather than how to calculate it.  I think I’ve been able to work through it but I was hoping someone would be able to double check my work or point me in the right direction if I’m missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is how I figure it so far:&#xA;Because the sample rate is allowing us to have a perfect recreation of the frequency of the wave the bit depth only determines the range of values available for the amplitude of a wave being converted to a digital signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the original signal gets rounded to the nearest bit it creates slight changes in the amplitude which result in a slightly altered waveform at each sample.  This new waveform is basically the same as the sum of our original signal and a new frequency.  So if we were to duplicate this in an analog signal we could do it by adding additional frequencies at very small amplitudes to our signal 44.1 thousand times a second (or whatever the sample rate is).  The lower the bit depth the bigger these changes to our original waveform will be, and so the larger the amplitude of the added waves will be raising the “noise” floor.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sampled a waveform that allowed for a slower sample rate, say sampling a 10 Hz wave 20 times a second.  Instead white noise as a result of quantization error would you hear a quick succession of random frequencies paired with your original wave (which would obviously be to low to hear)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can follow my logic up to this point I have one additional question because in my tests changing the phase of my sampled analog wave doesn't seem to change the frequencies of the quantization error like I thought it would. Am I making a mistake in my test? &lt;/p&gt;&#xA;" OwnerUserId="11855" LastEditorUserId="21075" LastEditDate="2020-04-29T20:56:18.857" LastActivityDate="2020-04-29T20:56:18.857" Title="From a physics perspective, why does D/A quantization error result in a noise floor?" Tags="|quantization|digital-to-analog|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19449" PostTypeId="2" ParentId="19448" CreationDate="2014-12-03T21:28:57.583" Score="4" Body="&lt;p&gt;Quantization error is usually modeled as additive &lt;a href=&quot;http://en.wikipedia.org/wiki/White_noise&quot; rel=&quot;nofollow&quot;&gt;white noise&lt;/a&gt;, uniformly distributed over the interval $[-\delta/2, \delta/2)$, where $\delta$ is the step size that the signal is quantized to. As you described, the quantized signal model is described by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s_Q[n] = s[n] + w[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $s[n]$ is the original signal and $w[n]$ is a white noise process that models the act of quantizing $s[n]$ to the nearest value $s_Q[n]$. That is, the quantization noise is modeled as if it was a source that added a small value to each sample, such that the result is a multiple of the quantization step size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The white noise assumption merely states that the quantization error in an arbitrary sample $n$ is independent of the quantization error in all other samples. The validity of this assumption varies from application to application, but it's typically taken to be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the noise is assumed to be white, its corresponding power spectral density is flat. This creates the flat &quot;noise floor&quot; that you typically see.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2014-12-03T21:28:57.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19450" PostTypeId="2" ParentId="19444" CreationDate="2014-12-03T21:36:32.173" Score="0" Body="&lt;p&gt;It would actually be a big problem if you implemented a guitar effect by recording the signal in a buffer, processing the entire block, and playing it back - there would be a long latency between the moment the note is played and the effect is heard!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, you can do a lot with little memory.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You don't need memory at all for very rough fuzz / distortion effects. In the same category are octaving effects based on rectification and modulation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With just a few words of memory to store the filter state you can implement IIR filters - and thus all kinds of EQ / tone-controller. A few more words to store a phase accumulator and you have a low-frequency oscillator for auto-wah or other modulated effects.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another class of effects that only require a handful of words of memory are dynamic processing effects - compression, limiting...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With a few kilowords of memory, you can get into (short) delay-based effects: flanger, chorus, phaser, and time-domain pitch-shifting (and by combining a few instances of those: harmonization).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;10-20 kilowords is long enough for actual echo effects.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can get a decent reverb in 30-40 kilowords.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2014-12-03T23:26:47.183" LastActivityDate="2014-12-03T23:26:47.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19451" PostTypeId="2" ParentId="19448" CreationDate="2014-12-03T23:02:07.983" Score="11" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;For the last week or so I have been trying to understand how quantization error results in the noise floor outside of a mathematical perspective and I haven't really had any luck finding a source that discussed quantization noise without using equations to show where quantization error comes from.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's because it's a purely mathematical effect, there's no physics involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's technically quantization &lt;em&gt;distortion&lt;/em&gt;, not noise, but we simplify the analysis by treating it as a noise source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it's really not; it's nonlinear distortion, so the spectrum of the quantization error varies with the signal.  Maybe that's where you're confused?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if you sample a sine wave that's a sub-multiple of the sampling rate and quantize it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AvOf6.png&quot; alt=&quot;time-domain waveform showing quantization steps&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you will get harmonic distortion only at specific frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L2krP.png&quot; alt=&quot;harmonic distortion spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's not an exact sub-multiple, the infinite number of harmonics produced by the distortion will alias and produce a more noise-like residual:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1hPCi.png&quot; alt=&quot;non-subharmonic distortion spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this sort of behavior is more common with arbitrary signals, it's usually treated like a noise source.  In addition, we usually randomize this distortion by adding a small amount of dither noise to the analog signal before quantization, which flattens out the spectrum, reducing the peak value of the distortion and making the noise unrelated to the signal, so we are actually forcing it to be a true noise source rather than a distortion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vCHho.png&quot; alt=&quot;with dither spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from __future__ import division&#xA;from numpy import linspace, round, abs, sin, log10, pi&#xA;from numpy.fft import rfft&#xA;from numpy.random import randn&#xA;from scipy.signal import hamming as window&#xA;import matplotlib.pyplot as plt&#xA;&#xA;fs = 5000  # Hz&#xA;t = linspace(0, 1, fs, endpoint=False)&#xA;f = 25  # Hz&#xA;x = sin(2*pi*f*t)&#xA;plt.figure(1)&#xA;plt.plot(x)&#xA;plt.figure(2)&#xA;&#xA;x += randn(fs)/20  # Dither&#xA;x = round(x*5)/5  # Quantization&#xA;&#xA;plt.plot(20*log10(1/fs * abs(rfft(window(fs)*x))))&#xA;plt.ylim(-100, 0)&#xA;plt.figure(1)&#xA;plt.plot(x)&#xA;plt.margins(0, 0.1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2014-12-09T01:22:25.020" LastActivityDate="2014-12-09T01:22:25.020" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19454" PostTypeId="2" ParentId="19447" CreationDate="2014-12-04T04:21:39.163" Score="2" Body="&lt;p&gt;What happens is you get an FT result that is identical to the FT of a 14.1 kHz input.  There is no way to tell from just the FT result the correct input frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-12-04T04:21:39.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19455" PostTypeId="2" ParentId="19442" CreationDate="2014-12-04T04:25:49.857" Score="2" Body="&lt;p&gt;A single frequency is a pure sinusoid, and thus unmodulated (no BPSK).  Once you add any modulation, you no longer have a pure sinusoid.  The FT of this distorted sinusoid will have a non-zero bandwidth from the sidebands required to change the sinusoid from just pure to somewhat distorted (same as modulated).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-12-04T04:25:49.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19457" PostTypeId="2" ParentId="19433" CreationDate="2014-12-04T07:53:30.123" Score="1" Body="&lt;p&gt;A low-pass filter partially attenuates some array elements in the array by a precise amount.  If you completely remove these attenuated array elements, you will attenuate them too much, which can lead to adding a lot more high-frequency spectrum to your original signal than removal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing a single element is the equivalent to adding a sharp glitch of the same magnitude but opposite phase.  A sharp glitch usually contains a lot of high-frequency noise.  So what a low pass filter does usually looks like smoothing multiple elements, some elements attenuated, some elements amplified.  Not a point removal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-12-04T07:53:30.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19458" PostTypeId="1" CreationDate="2014-12-04T12:10:23.927" Score="0" ViewCount="3047" Body="&lt;p&gt;I have a set of data, in the freqeuncy domain, corresponding to a structural test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have amplitude, phase and frequency for both the measured output and the input signal (accelerations are measured in the test). The input covers the frequency range $5-100 Hz$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can compute the frequency response:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RE = abs(amplitude)./sqrt(1+(tan(phase)).^2);&#xA;IM = RE.*tan(phase);&#xA;response = complex(RE,IM);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Having the frequency responses of both input and output I could compute the transfer function $H(\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H = abs(response)./abs(g_inp); % g_inp is the frequency response of the input&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem arises from the fact that the 2 vectors (&lt;code&gt;response&lt;/code&gt; and &lt;code&gt;g_inp&lt;/code&gt;) have not the same length: the first one has 849 samples and the second one 828.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I 'synchronize' them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried following the zero-padding method as suggested but I do not get the expected plot. Here my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% The input signal is a sine-sweep for which I have:&#xA;% ginz: amplitude of the input signal&#xA;% finz: frequency of the input signal&#xA;&#xA;% Sine sweep in time domain&#xA;R = 4; &#xA;tz = 60/R*log2(finz/finz(1));&#xA;u_swt = sin(2*pi*((60*finz(1)/(R*log(2.))*(2.^(R/60*tz)-1))));&#xA;base_acc_t = ginz.*u_swt;&#xA;&#xA;% zero-padding&#xA;acc_input = [base_acc_t; zeros(N-n,1)]; % N: length output signal (frequency domain)&#xA;                                        % n: length input signal (frequency domain)&#xA;input_freq = fft(acc_input);&#xA;&#xA;H = abs(response)./abs(input_freq);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I obtain a plot which has the peak value at the right frequency, but instead of a nice curve it looks really noisy&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="13320" LastEditDate="2016-05-13T10:37:00.863" LastActivityDate="2016-05-13T10:37:00.863" Title="How to compute transfer function (Frequency Response Function) from experimental data" Tags="|matlab|frequency-response|transfer-function|resampling|synchronization|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19463" PostTypeId="1" AcceptedAnswerId="19475" CreationDate="2014-12-04T18:01:07.087" Score="2" ViewCount="775" Body="&lt;p&gt;I am doing some project on medical image processing and I need some uncompressed medical images especially magnetic resonance angiography, vessel and so on. I have searched a lot but most of the available images are in JPEG format which is not a suitable format due to its lossy compression. Do you know any free dataset which have uncompressed medical images especially those mentioned?&lt;/p&gt;&#xA;" OwnerUserId="11205" LastActivityDate="2018-12-03T15:44:07.780" Title="Medical image dataset" Tags="|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19464" PostTypeId="2" ParentId="19448" CreationDate="2014-12-04T19:01:12.027" Score="-2" Body="&lt;p&gt;The physics interpretation has to do with the sources for noise. In my experience, if the analog portion of the electronics is &quot;clean&quot;, the limiting factor is quantum. Ultimately, you are counting electrons or photons. This gives you a Poisson distribution with standard deviation of the number of particles you are counting. That's the noise floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the electronics is not perfectly clean, it will pick up stray energy. This may be a fluctuation on the zero or full scale reference on the A/D converter. Or, it may have something to do with the detector/transducer. Or it could be longer term variation in the gain of a circuit leading to the A/D, often caused changes in temperature. Or, the detector itself may have a bias that fluctuates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my line of work, I often deal with detectors of light. These will often &quot;mistake&quot; a photon of heat for a photon of visible light. They call this dark current. Stray light can also be an issue... catching light that we didn't want to catch.&lt;/p&gt;&#xA;" OwnerUserId="11969" LastActivityDate="2014-12-04T19:01:12.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19467" PostTypeId="1" AcceptedAnswerId="19468" CreationDate="2014-12-04T21:41:05.140" Score="1" ViewCount="85" Body="&lt;p&gt;I have a series of images. I want to be able to draw a curve on the image and track the curve in the series. For example, in the figure below, the left image illustrates the original image at time &lt;code&gt;0&lt;/code&gt; and the one on the right is the curve I want to track in the next images in later times $t&amp;gt;0$. In fact, the edges that are marked as red change with time. In other words, the region, whose a portion of its boundary is shown in the figure, gets enlarged and shrunken in the subsequent images and I want to be able to track this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone kindly introduce me to one of the methods that is used to track a predefined curves according to the movement of the boundary which is the closest to it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IV2cP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10187" LastEditorUserId="10187" LastEditDate="2014-12-04T21:50:00.823" LastActivityDate="2014-12-04T21:56:39.733" Title="Tracking a Predefined Curve in a Series of Images" Tags="|image-processing|edge-detection|tracking|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19468" PostTypeId="2" ParentId="19467" CreationDate="2014-12-04T21:56:39.733" Score="2" Body="&lt;p&gt;From my experience, I have successfully utilized &lt;a href=&quot;http://webdocs.cs.ualberta.ca/~nray1/CMPUT615/MRF/grady2006random.pdf&quot; rel=&quot;nofollow&quot;&gt;Leo Grady's Random Walks method&lt;/a&gt; for this. The code is also available &lt;a href=&quot;http://cns.bu.edu/~lgrady/software.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. It works very well and can easily be made to run in real-time depending on the contour and image size. You could watch the video from my implementation &lt;a href=&quot;https://www.youtube.com/watch?v=LXnqfDa5Fc8&amp;amp;list=UUMSqZYDAmbiaAhyvLPJGhsg&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Note that though, it might perfom differently than the original.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-04T21:56:39.733" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19469" PostTypeId="1" AcceptedAnswerId="19478" CreationDate="2014-12-04T22:22:31.143" Score="3" ViewCount="852" Body="&lt;p&gt;Lets consider a pure sine signal at $\nu$ that is chopped using square pulses (like a burst mode on signal generators). My understanding is that instantaneous frequency is $\nu$ when oscillations are ON and 0 when they are OFF. On the other hand fourier spectrum is constant over time and contains also other frequencies, since it is not pure sine anymore. Is this correct? which one is used when calculating some frequency dependent physical quantity?&lt;/p&gt;&#xA;" OwnerUserId="11972" LastActivityDate="2014-12-05T14:30:03.947" Title="Instantaneous frequency vs fourier frequency" Tags="|fourier-transform|" AnswerCount="2" CommentCount="0" ClosedDate="2015-01-06T13:29:40.603" ContentLicense="CC BY-SA 3.0" />
  <row Id="19472" PostTypeId="2" ParentId="19469" CreationDate="2014-12-05T01:58:52.490" Score="1" Body="&lt;p&gt;the frequency of a sinusoid is normally thought to be undefined when there is no sinusoid (i.e. when it is turned &quot;OFF&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, there are at least a couple of different methods of turning it OFF.  the most obvious is to effectively multiply the waveform output by zero to disconnect the sinusoid from the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however if the output of your signal generator is &lt;strong&gt;always&lt;/strong&gt; connected (so there is no multiplication by zero) to the look-up table (LUT) that has the waveform values in it (and let's say that those waveform values follow a sinusoidal function), then another way to stop the output is to stop advancing position in the LUT.  that would be like setting the instantaneous frequency to zero.  but, unless you're watching out for this, it &lt;em&gt;could&lt;/em&gt; get stuck on a DC value that is non-zero.  so there are a lot of functions, besides the zero function, that have a frequency of zero.  &lt;strong&gt;any&lt;/strong&gt; DC function has instantaneous frequency of zero.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-12-05T01:58:52.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19473" PostTypeId="1" AcceptedAnswerId="19476" CreationDate="2014-12-05T03:32:21.157" Score="0" ViewCount="1290" Body="&lt;p&gt;I didn't mess around with the code here, it was straight from their website, I just want to see if it would work. However, whenever I run it, it has feedback in it, sometimes I can't hear anything at all. It is not the speaker because I can record and play things separately. Here is the code if you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried changing the frames per buffer to 5000 and it lost the feedback and started an echo. I also tried to have it record and then play back later, but it said that the input had overloaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NEW DEVELOPMENT: the feedback is the echo, for some reason when the frames per buffer or the CHUNK is decently high, there is an echo, when it is like the code below, the echo compounds and speeds up to result in feedback, multiple echos playing at once to become a high shrill noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PLEASE HELP!!!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pyaudio&#xA;&#xA;CHUNK = 1024&#xA;WIDTH = 2&#xA;CHANNELS = 2&#xA;RATE = 44100&#xA;RECORD_SECONDS = 5&#xA;&#xA;p = pyaudio.PyAudio()&#xA;&#xA;stream = p.open(format=p.get_format_from_width(WIDTH),&#xA;                channels=CHANNELS,&#xA;                rate=RATE,&#xA;                input=True,&#xA;                output=True,&#xA;                frames_per_buffer=CHUNK)&#xA;&#xA;print(&quot;* recording&quot;)&#xA;&#xA;for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):&#xA;    data = stream.read(CHUNK)&#xA;    stream.write(data, CHUNK)&#xA;&#xA;print(&quot;* done&quot;)&#xA;&#xA;stream.stop_stream()&#xA;stream.close()&#xA;&#xA;p.terminate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11974" LastEditorUserId="7092" LastEditDate="2014-12-05T03:38:30.970" LastActivityDate="2014-12-05T10:45:57.250" Title="Record and playback has echo/feedback" Tags="|audio|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19474" PostTypeId="1" CreationDate="2014-12-05T06:47:47.933" Score="1" ViewCount="2940" Body="&lt;p&gt;There are many tutorials and guides explaining how to create a &quot;robotic&quot; voice by using a vocoder or a mix of filters that change pitch, tempo and maybe add a slight echoed delay. However, is it possible to do that opposite? How would you take a &quot;robotic&quot; sounding voice and make it sound more natural? I know certain effects, like adding emphasis, is still a research problem, but is it easier to remove the &quot;tinny&quot; sound found in a lot of synthetic voices?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm specifically interested in a code solution (preferably Python), because I'd like to wrap it around a text-to-speech synthesizer (like Festival or Flite) to work in real-time. Unfortunately, I'm not sure where to begin since Googling &quot;how to make a robot voice sound more human&quot; just returns tutorials on doing the exact opposite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://soundcloud.com/user900454612/san-jose&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's&lt;/a&gt; an example voice of the Flite engine using an HTS voice. Especially near the end, the voice almost breaks up into a &quot;buzz&quot;. Can that be removed, or would that actually require adding audio data?&lt;/p&gt;&#xA;" OwnerUserId="451" LastEditorUserId="451" LastEditDate="2018-01-08T02:18:45.530" LastActivityDate="2020-07-19T08:12:37.453" Title="Removing vocoder effect from audio file" Tags="|speech|voice|speech-synthesis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19475" PostTypeId="2" ParentId="19463" CreationDate="2014-12-05T08:01:20.877" Score="3" Body="&lt;p&gt;The problem you are most likely having is that you need to search for files in the correct format.  DICOM is what you need to look for.&#xA;A few hits:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://physionet.org/physiobank/database/images/&quot; rel=&quot;nofollow&quot;&gt;One example&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.osirix-viewer.com/datasets/&quot; rel=&quot;nofollow&quot;&gt;A library from a DICOM viewer software producer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.healthcare.siemens.com/magnetic-resonance-imaging/magnetom-world/clinical-corner/protocols/dicom-images&quot; rel=&quot;nofollow&quot;&gt;A library of images from Siemens&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You will also need a DICOM viewer.&lt;br&gt;&#xA;&lt;a href=&quot;http://rsbweb.nih.gov/ij/download.html&quot; rel=&quot;nofollow&quot;&gt;Image J &lt;/a&gt; is free (non-commercial, no restrictions on use) and can be used under Windows, Mac, and Linux - it does require Java.&lt;br&gt;&#xA;There are other viewers available, free as well as commercial.  Just search for DICOM viewers.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2015-12-31T13:05:30.977" LastActivityDate="2015-12-31T13:05:30.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19476" PostTypeId="2" ParentId="19473" CreationDate="2014-12-05T10:45:57.250" Score="0" Body="&lt;p&gt;Feedback squeal or echo is pretty much the expected result of the given code.&lt;br&gt;&#xA;This program just takes audio in from the microphone and sends it back out through the speaker.  If the speaker is loud enough, the audio the microphone picks up from the speaker will be louder than what was sent to the speaker - with each go around, it gets louder.  This produces the infamous feedback squeal.  If the delay is long enough, you an echo that gets louder and louder instead of a squeal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also have a problem with your sound card configuration.  Some sound cards allow you to send the microphone input straight to the speaker output so that you can use headphones to monitor the recoring live.  If that is active on your sound card, then that may contribute to the feedback.  This will more likely cause a high pitched squeal that is independent of the length of the buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To break the feedback, do the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check that your sound card isn't routing the microphone straight to the speaker. (Stop your program and talk into the microphone.  If you hear your voice coming out of the speaker then you need to fix this in your sound card mixer.)&lt;/li&gt;&#xA;&lt;li&gt;User headphones instead of a speaker.&lt;/li&gt;&#xA;&lt;li&gt;Turn the speaker volume down or lower the microphone sensitivity (both can be done through the mixer, speaker can also be done on the speaker with the volume control.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-12-05T10:45:57.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19477" PostTypeId="2" ParentId="19474" CreationDate="2014-12-05T11:36:07.267" Score="1" Body="&lt;p&gt;I seriously doubt that there is a simple way to accomplish this.  Most of the work that I have seen tends to go in the direction of improving the synthesis, or using better (and more) phoneme recordings to get better quality.  If there were a simple way, I think someone would have found it by now rather than putting so much more effort into better synthesizers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, you could try using a bandpass filter on the output.  The sample you referred to sounds better (at least is doesn't buzz) if you filter out everything above 800Hz, and everything below 100Hz.  That does kind of make it sound like the person speaking has a blanket stuffed in to her mouth, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would like, I could put together some python code (though you will need numpy/scipy for it) or you could use audacity or sox to see if the results are even acceptable before implementig code.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2014-12-05T11:36:07.267" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19478" PostTypeId="2" ParentId="19469" CreationDate="2014-12-05T12:29:23.240" Score="1" Body="&lt;p&gt;Yes, your understanding ist correct. Instantaneous frequency is the time derivative of the sine argument. As Robert mentions in his answer, this argument is not defined where there is no sine (or complex exponential) function but I think its reasonable to consider it a sine with amplitude zero and constant argument. The function you describe is defined sectionwise. In sections where the sine is &quot;on&quot; the time derivative of its angle is $\nu$, in sections where the sine is &quot;off&quot; the time derivative is zero. So the instantaneous frequency is a function of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform is not the right tool to analyze the instantaneous frequency as a function of time. As you have realized the Fourier transform is constant in time. The FT of this special function is a shifted sinc function and thus contains other frequencies than $\nu$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; following your comment: 2 is correct. The output signal of a narrow bandpass filter with center frequency $\nu$ is not identical to the discussed &quot;chopped&quot; sine wave. The input signal has sharp transitions where it is forced to zero by the rectangular pulse train. These transitions are smoothed by the bandpass filter and you will see the dynamic behaviour of the filter in form of transients in the output signal where the input signal has sharp transitions. In other words: the bandpass filter can not &quot;react&quot; instantaneously to the sudden change of frequency because it has a memory.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-12-05T14:30:03.947" LastActivityDate="2014-12-05T14:30:03.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19480" PostTypeId="1" AcceptedAnswerId="19481" CreationDate="2014-12-05T13:14:12.570" Score="1" ViewCount="573" Body="&lt;p&gt;The generic IFFT OFDM transmitter takes $N$ serial input data symbols, parallelizes them, maps them to their signal constellation points, and processes all $N$ resultant complex values using the IFFT to produce $N$ subcarriers (assuming no virtual carriers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The IFFT takes $N$ input values and produces $N$ output values, such that changing a single input value will change all output values. Therefore each input symbol contributes to each of the $N$ subcarriers; each symbol is &quot;shredded&quot; across all subcarriers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, several sources state that in OFDM &quot;each modulation symbol is mainly confined to a relatively narrow bandwidth&quot; (Communications Engineering Desk Reference, Elsevier, 2009, 1st ed, p.287).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are these two different OFDM implementations, or is the IFFT implemented in a different way to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="11978" LastActivityDate="2014-12-06T08:51:00.260" Title="Spectral location of individual OFDM symbols" Tags="|ofdm|ifft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19481" PostTypeId="2" ParentId="19480" CreationDate="2014-12-05T14:48:31.207" Score="1" Body="&lt;p&gt;The IFFT transforms a discrete signal to the &lt;em&gt;time&lt;/em&gt; domain. Therefore, the input signal of the IFFT should be interpreted as a &lt;em&gt;frequency&lt;/em&gt; domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For OFDM this means that the subcarriers are defined before the IFFT. The IFFT ouput is the time domain representation that will eventually be transmitted over the channel. Before it can be transmitted it must first be converted to an analog signal. Analyzing this signal in time domain, e.g. by viewing it on an oscilloscope, won't tell you anything about the subcarrier bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see the bandwidth of one OFDM subcarrier you have to analyze the analog signal in the frequency domain, e.g. by using a spectrum analyzer. If you modulate all subcarriers the spectrum will look nearly rectangular, with a flat top, because the subcarriers are close together and overlap. If you modulate only one subcarrier (all inputs of the IFFT are set to zero except one), the spectrum will be much narrower, its bandwidth approximately reduced by a factor that is equal to the number of subcarriers. And it will have a sinc-like shape.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2014-12-05T14:48:31.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19484" PostTypeId="1" CreationDate="2014-12-04T21:07:17.220" Score="3" ViewCount="431" Body="&lt;p&gt;When attempting to take the Short Time Fourier Transform of a pulse, at the end of the pulse I'm running into problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal looks like this at the end (it is a simple $sin^2$ pulse envelope, with a carrier frequency $\omega$.  The only frequency that I care about in the STFT is $\omega$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ebDKP.png&quot; alt=&quot;signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when I perform a STFT on it using a flattop window of $6 * 2\pi/\omega$ width (and only look at the carrier frequency):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2zhaZ.png&quot; alt=&quot;stft signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error here for the STFT seems abnormally large towards the end.  When I look at the difference between the envelope ($A * sin^2(\frac{ t * \pi }{ T} )$ where A is fitted by hand to minimize the error  in the center of the pulse) and the absolute value of the STFT produced signal, I get something that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XZOML.png&quot; alt=&quot;error&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two lobes at the end are what the problem is.  Does anyone have any sources that discuss this source of error?  Properties, how to mitigate them, etc?&lt;/p&gt;&#xA;" OwnerUserId="11983" OwnerDisplayName="Andrew Spott" LastActivityDate="2014-12-05T19:11:09.250" Title="Aliasing in the Short time Fourier Transform of a pulse" Tags="|fourier-transform|stft|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19485" PostTypeId="1" CreationDate="2014-12-05T21:06:06.873" Score="5" ViewCount="963" Body="&lt;p&gt;I have been given a sound file of a plane passing over a rain forest filled with birds. I am supposed to filter out the sound of the plane as it flies over.  I've accomplished this with various types of filters in MATLAB, but I always run into one problem. I can either cut out all of the plane and lose some of the background rain forest noise, or leave (almost) all of the rainforest noise and leave a decent amount of airplane noise. This is the frequency spectrum of the original sound file:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BqTQ2.png&quot; alt=&quot;Frequency Spectrum&quot;&gt;&#xA;(Sorry for the crappy image.) Note the different colors represent left and right channels. From the plot, the majority of the plane's frequency is in the 0-1000 Hz range. The plane is clearly heard however until I use a high pass filter to remove everything from around 1700 Hz to 0 like so:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/HoMXN.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;I suspect that the plane is causing that spike around 1700 Hz but evidently the rain forest is still producing lower frequency noise than that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best method to remove that spike while keeping all that extra rain forest frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the plot of the time domain. Note how the plane gradually gets louder than fades away. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/TtUqo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling frequency is 22050 samples/sec. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the spectrogram.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YzOu3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11191" LastEditorUserId="11191" LastEditDate="2014-12-06T19:24:42.350" LastActivityDate="2015-10-06T09:34:54.970" Title="Filtering Overlapping Frequencies in sound file" Tags="|filtering|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="19487" PostTypeId="1" CreationDate="2014-12-05T23:50:35.247" Score="0" ViewCount="66" Body="&lt;p&gt;I want to know more about the latest attempts to create synthesizers for singing. I would ideally like to know more about both the most widely respected algorithms/models as well as mainstream software or programs that implement them (whether free or proprietary). Can someone offer me resources that would give me a decent grasp of the above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I chose to post this question on Signal Processing Stack Exchange since I know such software relies to some degree on signal processing type methods for analyzing or creating waves. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm very new to this area of research so any suggestions for where to start would be welcomed.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="11985" LastActivityDate="2014-12-06T20:28:41.513" Title="Methods in Singing Synthesis" Tags="|voice|" AnswerCount="1" CommentCount="0" ClosedDate="2015-01-05T22:52:14.523" ContentLicense="CC BY-SA 3.0" />
  <row Id="19488" PostTypeId="1" AcceptedAnswerId="19492" CreationDate="2014-12-06T01:51:31.283" Score="0" ViewCount="2036" Body="&lt;p&gt;I am studying for my DSP final and I came across this question from the Oppenhiem and Schafer book 3rd edition. The question says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;3.18&lt;/strong&gt; A casual LTI system has the system function&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$H(z)=\dfrac{1+2z^{-1}+z^{-2}}{\left(z+\frac{1}{2}z^{-1}&#xA;&amp;gt; \right)\left(1-z^{-1} \right)} $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;(a)&lt;/strong&gt; Find the impulse response of the system, $h[n]$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;(b)&lt;/strong&gt; Find the output of this system, $y[n]$, for the input&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$x[n]=e^{j(\pi/2)n} $$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For the first part, I got&#xA;$$h[n] =  -2 \delta[n]+\frac{1}{3}  \left(\frac{-1}{2}\right)^2 u[n]+\frac{8}{3} u[n]$$   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which matches the answer at the back of the book, but the second part is difficult. We are asked to find the function $y[n]$ if $x[n] = 2^n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that $2^n$ is an eigenfunction of $y[n]$, but I am not sure how to substitute it in $H(e^{j\omega})$. The answer at the back of the book is $y[n] = \frac{18}{5} 2^n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me? Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="11753" LastEditorUserId="8202" LastEditDate="2014-12-06T16:26:13.910" LastActivityDate="2014-12-06T19:27:12.717" Title="Eigenfunction of LTI causal system Z-transform" Tags="|impulse-response|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19489" PostTypeId="2" ParentId="19480" CreationDate="2014-12-06T08:51:00.260" Score="1" Body="&lt;p&gt;Your 2nd paragraph ends incorrectly.  Each IFFT input is &quot;shredded&quot; across the all values in the time domain, but only effects one subcarrier in the frequency domain.  Just as adding a single pure sinusoid will effect every value in the time domain (except at its zero crossings), but take up only one frequency (essentially no bandwidth) in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-12-06T08:51:00.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19490" PostTypeId="1" AcceptedAnswerId="19491" CreationDate="2014-12-06T12:22:16.143" Score="0" ViewCount="3337" Body="&lt;p&gt;How can I know exactly what frequencies are not influenced by the filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, I have a signal in the range of frequencies $5-100 Hz$ and I apply a high-pass, $4^{th}$ order Butterworth filter with cut-off frequency of $8 Hz$. The filter will not cut sharply at $8 Hz$, instead it will have a slope related to the filter order: the higher the order, the steeper the slope right?.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how can I compute the frequency from which the signal is left unchanged (so no attenuation due to the filter)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to obatin this info directly in matlab?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2014-12-12T13:39:53.323" Title="Filter order and cut off frequency" Tags="|matlab|filters|highpass-filter|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19491" PostTypeId="2" ParentId="19490" CreationDate="2014-12-06T14:32:32.157" Score="1" Body="&lt;p&gt;This answer is written in terms of low-pass but  the ideas directly translate to high pass. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A butterworth filter (low pass) of order $N$ with cutoff $\Omega_c$ is one which has a maximally flat passband, and has the squared magnitude response $|H(j \Omega)|^2 = \frac{1}{1+\left(\frac{j \Omega}{j \Omega_{cutoff}}\right)^{2N}}$. [I'm just writing it this way so that if you try to get a realizable transfer function via spectral factorization it is easy]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you specify the cutoff $\Omega_c$ and it gets sharper as you increase the filter order. Strictly speaking, from the the squared magnitude response, you see that $|H(j \Omega)|^2=1$ if and only if $\Omega=0$, i.e. only the DC component is un-modified. However, from that formula, you can calculate things like frequencies where the magnitude is within say 99% of the original magnitude, by finding $\Omega$ such that $|H(j \Omega)|^2 \geq 0.99^2$ (note that $|H(j \Omega)|^2 $ is monotone decreasing in $\Omega$, so your range will be of the form $[-\Omega_{0.99},\Omega_{0.99}]$). Similar properties of other filters will hold as well - see Appendix B of Discrete-Time Signal Processing 2e by Oppenheim, Schafer and Buck for more details. Make sure you're familiar with the basic types of filters as well -- elliptical, butterworth and chebyshev to make sure your characteristics you desire are matched to what you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to design filters with particular passband and stopband characteristics in the FIR case (such as controlling the maximum error), you may want to look at the Parks-Mclellan algorithm (described in Discrete-Time Signal Processing 2e by Oppenheim Schafer and Buck, ch. 7).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for Matlab usage, you can plot the magnitude response of the filter and determine these things. It can be done from the filter visualization tool. TI also makes a filter design tool which is quite nice, called FilterPro. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-12-06T14:32:32.157" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19492" PostTypeId="2" ParentId="19488" CreationDate="2014-12-06T14:41:28.557" Score="2" Body="&lt;p&gt;Hint: $y[n] = H(e^{j (\pi / 2)}) x[n]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $x[n]$ is a complex exponential, it is an eigenfunction of a LTI system with eigenvalue given by the frequency response at the frequency of $x[n]$ (which in this case is $H(e^{j (\pi/2)})$. In less fancy words, if you put a complex exponential into a LTI system, you get the same complex exponential out, except scaled by the transfer function evaluated at the frequency of the complex exponential. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-12-06T14:41:28.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19493" PostTypeId="2" ParentId="19490" CreationDate="2014-12-06T15:48:21.303" Score="0" Body="&lt;p&gt;Cut off frequency can be considered as the frequency till which the response is flat for practical purposes.In reality at cut off frequency it is 1/sqrt(2) times max amplitude&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2014-12-06T15:48:21.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19495" PostTypeId="2" ParentId="17453" CreationDate="2014-12-06T17:20:10.627" Score="2" Body="&lt;p&gt;This should be a comment, but my reputation is too low to leave one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, if you need to remove only the DC component you can just remove the mean value from your signal in this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = x-mean(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here you might find useful infos &lt;a href=&quot;https://stackoverflow.com/questions/5591278/high-pass-filtering-in-matlab&quot;&gt;https://stackoverflow.com/questions/5591278/high-pass-filtering-in-matlab&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2014-12-08T19:15:39.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19497" PostTypeId="2" ParentId="9467" CreationDate="2014-12-06T19:07:48.120" Score="21" Body="&lt;p&gt;I found &lt;a href=&quot;https://www.youtube.com/watch?v=ue4ba_wXV6A&quot; rel=&quot;noreferrer&quot;&gt;this video to be very, very helpful&lt;/a&gt; (it elaborates on Matt's answer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some key ideas from the video:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Zero-phase will result in no phase distortion, but will result in a non-causal filter. This means that if the data is being filtered as it's gathered, this will not be an option (only valid for stored data which we can post-process).&lt;img src=&quot;https://i.stack.imgur.com/B0u9K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;li&gt;When you implement a non-causal filter, transients get blurred forwards and backwards (e.g. if we want a 2dB ripple, the fact that we're going to be making a forward and backward run using the filter means that we'll want each of these to have 1dB).&lt;img src=&quot;https://i.stack.imgur.com/WPJ6k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;li&gt;Uses the time-reversal property of the discrete-time Fourier transform.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uExi0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;li&gt;The effective frequency response caused by FILTFILT is the magnitude of that in one direction, squared. You take your input signal, &lt;code&gt;x[n]&lt;/code&gt;, filter it, reverse the result, filter it again, and reverse it again (the time-reversal step requires that all data be available).&lt;img src=&quot;https://i.stack.imgur.com/p92qh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11916" LastActivityDate="2014-12-06T19:07:48.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19498" PostTypeId="2" ParentId="19488" CreationDate="2014-12-06T19:27:12.717" Score="0" Body="&lt;p&gt;&lt;code&gt;Y[z] = H[z]X[z]&lt;/code&gt;, and &lt;code&gt;y[n]&lt;/code&gt; is found by taking the inverse Z-transform of &lt;code&gt;Y[z]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have &lt;code&gt;H[z]&lt;/code&gt; already, so the next step is finding the Z-transform of &lt;code&gt;x[n] = 2^n&lt;/code&gt;. Assuming you need to find the &lt;em&gt;unilateral&lt;/em&gt; Z-transform of &lt;code&gt;x[n]&lt;/code&gt;, you can use a table of Z-transform pairs (&lt;a href=&quot;http://eeweb.poly.edu/iselesni/EE3054/EE3054_formulas.pdf&quot; rel=&quot;nofollow&quot;&gt;such as this one&lt;/a&gt;), you can see that &lt;code&gt;X[z] = z/(z-2)&lt;/code&gt;... again, this assumes that you need to take the unilateral transform or that &lt;code&gt;x[n] = (2^n)u[n]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, multiply &lt;code&gt;H[z]&lt;/code&gt; by &lt;code&gt;X[z]&lt;/code&gt; to get &lt;code&gt;Y[z]&lt;/code&gt;. Once you have &lt;code&gt;Y[z]&lt;/code&gt;, you take the inverse Z-transform and you get &lt;code&gt;y[n]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps,&lt;/p&gt;&#xA;" OwnerUserId="11916" LastActivityDate="2014-12-06T19:27:12.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19499" PostTypeId="1" AcceptedAnswerId="19506" CreationDate="2014-12-06T20:28:06.047" Score="0" ViewCount="80" Body="&lt;p&gt;I assume that the sampling rate is w_s = 2w_max if we have an ideal low-pass filter that nulls frequencies whose absolute value is higher than that of w_max. Therefore, that the only reason for oversampling is to compensate for the imperfect filters whose magnitude at the stop-band isn't exactly 0, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, one should oversample to limit the unwanted effects of the imperfect filters. But how much? What's a &quot;good&quot; sampling rate for a given filter of a given order e.g. the Butterworth of order 7?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="11916" LastActivityDate="2014-12-07T05:25:27.417" Title="Sampling: how to determine a “good” sampling rate based on a given filter" Tags="|sampling|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19500" PostTypeId="2" ParentId="19487" CreationDate="2014-12-06T20:28:41.513" Score="1" Body="&lt;p&gt;Well, there is sampling of singing voices.  it's not the latest.  one thing that you perhaps need to worry about is that, unless you get a sample root for &lt;strong&gt;each&lt;/strong&gt; note going up the MIDI note scale, then you will likely be pitch shifting the notes up or down a little.  it turns out that this causes a noticeable distortion sometimes called &quot;munchkinization&quot; or the &quot;Alvin the Chipmunk&quot; effect.  to avoid that, each cycle of the quasi-periodic note needs to be isolated into little &quot;wavelets&quot; (not to be confused by the wavelet transform) or &quot;grains&quot; or &lt;a href=&quot;https://ccrma.stanford.edu/~serafin/320/lab3/FOF_synthesis.html&quot; rel=&quot;nofollow&quot;&gt;&quot;FOFs&quot;&lt;/a&gt;.  then you would output the grains or FOFs at a rate of the fundamental frequency of the note &lt;strong&gt;without&lt;/strong&gt; stretching or scrunching the grain (this requires overlapping and adding).  there's an &lt;a href=&quot;http://www.jstor.org/discover/10.2307/3679554?uid=3739696&amp;amp;uid=2129&amp;amp;uid=2&amp;amp;uid=70&amp;amp;uid=4&amp;amp;uid=3739256&amp;amp;sid=21104773196971&quot; rel=&quot;nofollow&quot;&gt;old paper by Keith Lent&lt;/a&gt; that discusses pitch shifting vocal notes without shifting formants, and &lt;a href=&quot;http://www.aes.org/e-lib/browse.cfm?elib=7947&quot; rel=&quot;nofollow&quot;&gt;another paper by me&lt;/a&gt; that analyzes the algorithm a little more rigorously.  the latter, i can send a copy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but for &lt;strong&gt;synthesis&lt;/strong&gt;, you need not perform the real-time pitch detection that you would have to for pitch-shifting the voice live.  what you can do is sample some notes from these sung voices and perform analysis on them off-line and generate a file of these grains or FOFs and store them in your synthesizer.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-12-06T20:28:41.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19501" PostTypeId="1" AcceptedAnswerId="19502" CreationDate="2014-12-06T23:17:03.123" Score="1" ViewCount="379" Body="&lt;p&gt;Pose Estimation of single camera and planar pattern:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have an appropriate camera matrix with intrinsic parameters that allows me to calculate translation of the camera relative to a chessboard, for example, and it does so very accurately, does that mean my rotation calculations will also be accurate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may also be considered in the context of the &lt;a href=&quot;http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html&quot; rel=&quot;nofollow&quot;&gt;camera calibration documentation for opencv&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References to your answers would also be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;thanks to @tbirdal for the links&#xA;&quot;Pose and position&quot; is an incorrect phrase. Pose is a combination of position and orientation.&lt;/p&gt;&#xA;" OwnerUserId="11435" LastEditorUserId="11435" LastEditDate="2014-12-07T01:24:09.767" LastActivityDate="2014-12-07T01:24:09.767" Title="Does accurate translation estimation using a camera matrix mean the orientation estimation will also be accurate?" Tags="|computer-vision|opencv|camera-pose|camera-calibration|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19502" PostTypeId="2" ParentId="19501" CreationDate="2014-12-07T01:04:10.197" Score="1" Body="&lt;p&gt;If you pose estimation algorithm carefully minimizes the reprojection error using the standard non-linear techniques e.g., Levenberg Mardquardt, and your corner detection scheme is sufficiently accurate in the subpixel level, then yes. I would expect the residuals to be very small. Of course take into account the distortion parameters; they have to be calibrated as well. If you are using OpenCv and referring to the standard functions such as &lt;em&gt;findExtrinsicCameraParam&lt;/em&gt;, then you are good to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is also known as PnP due to the correspondences. Lepetit et. al. review it nicely &lt;a href=&quot;http://campar.in.tum.de/twiki/pub/Chair/TeachingWs09MATDCV/lepetit_ftcgv05-1.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, Grest et.al provide an overview of 3 methods &lt;a href=&quot;http://www.grest.org/publications/danielGrest_SCIA09.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-07T01:04:10.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19504" PostTypeId="1" AcceptedAnswerId="19516" CreationDate="2014-12-07T02:26:41.907" Score="0" ViewCount="1276" Body="&lt;p&gt;Suppose we have an added discrete noise signal defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]+w[n], $$ where $w$ is zero mean white Gaussian noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When we say &lt;strong&gt;white noise&lt;/strong&gt;, is it sufficient to say that it is always be uncorrelated with signal $x$, no matter what the distribution of signal is? (I think yes)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we conclude that both $x$ and $w$ are &lt;strong&gt;independent&lt;/strong&gt; IF noise is white Gaussian  BUT the signal have unknown distribution ? (I am Confused about it)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Lastly, What the information we glean-out of the model (&lt;strong&gt;intuitively&lt;/strong&gt;) if we are informed about noise that besides being zero mean, white and Gaussian, it is &lt;strong&gt;circular symmetric complex&lt;/strong&gt; as well? (I do know white noise has impulse auto-correlation but confused with circular-symmetric term).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5049" LastEditorUserId="128" LastEditDate="2018-07-25T03:50:26.890" LastActivityDate="2018-07-25T03:50:26.890" Title="What's the Intuitive Description of Circular Symmetric Complex Zero Mean White Gaussian Noise?" Tags="|signal-detection|estimation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19505" PostTypeId="1" AcceptedAnswerId="19513" CreationDate="2014-12-07T02:30:09.703" Score="0" ViewCount="908" Body="&lt;p&gt;I have this filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter_2 = firceqrip(2,0.6,[0.05 0.03]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to convert it to the frequency domain to multiply it by a signal (i.e filter in the frequency domain)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal and I have a filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I converted the signal into frequency domain and now I need to filter it with my filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Converting the signal into frequency domain is easy, but how do I filter the signal now?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqs = [0.08, 0.2, 0.32, 0.4];&#xA;periods = 1./ freqs;&#xA;t_max = 4 * periods(1);&#xA;t = linspace(0, t_max, 50);&#xA;&#xA;signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);&#xA;&#xA;% to find the fft of the signal&#xA;N = 64;&#xA;signal_spect = abs (fft(signal,N));&#xA;signal_spect = fftshift(signal_spect);&#xA;F = [-N/2:N/2-1]/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;now how do I filter the previous signal with my filter?&#xA;I tried doing this fft(filter_2) but it didn't work out, it's probably a wrong approach, but I do not know what else to do&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any help is appreicated&lt;/p&gt;&#xA;" OwnerUserId="11988" LastEditorUserId="11988" LastEditDate="2014-12-07T09:31:57.187" LastActivityDate="2014-12-07T10:41:33.513" Title="How to convert filter into frequency domain to do filtering?" Tags="|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19506" PostTypeId="2" ParentId="19499" CreationDate="2014-12-07T02:41:19.217" Score="1" Body="&lt;p&gt;Usually, one has a noise floor requirement.  So one can set the sampling rate to over twice the frequency where the filter response (and/or spectrum in the input) goes below this desired noise floor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2014-12-07T05:25:27.417" LastActivityDate="2014-12-07T05:25:27.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19509" PostTypeId="1" AcceptedAnswerId="19512" CreationDate="2014-12-07T05:02:15.533" Score="0" ViewCount="113" Body="&lt;p&gt;I have a x[n] = $\delta$[n]. &#xA;By formula is should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X[k]= \sum_{n=0}^{N-1} \delta[n]W_N^{kn}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X[k]= \sum_{n=0}^{N-1} e^{-j2*pi*kn/N}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formulae isn't showing for some reason. I took a screenshot of what I got here: &lt;a href=&quot;https://imgur.com/6j0Ibgu&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imgur.com/6j0Ibgu&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;basically why is the summation of an exponential term going to 1. $W_N=e^{-j*2*pi*k*n/N}$ in this case. I tried to prove it via $\sum\alpha^k=\frac{1-\alpha^N}{1-\alpha}$ but it doesn't work for me.&lt;/p&gt;&#xA;" OwnerUserId="11151" LastEditorUserId="11151" LastEditDate="2014-12-07T05:11:11.910" LastActivityDate="2014-12-07T08:46:40.073" Title="why is the DFS of a delta function equal to 1" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19510" PostTypeId="1" AcceptedAnswerId="19515" CreationDate="2014-12-07T05:35:28.167" Score="1" ViewCount="111" Body="&lt;p&gt;I have a sinusoidal signal namely:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;so the segment of the code becomes:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;freqs = [0.08, 0.2, 0.32, 0.4];&#xA;periods = 1./ freqs;&#xA;% Let the max value of t be 4 times the largest period&#xA;t_max = 4 * periods(1);&#xA;% Let us have 500 samples over the interval [0, t_max].&#xA;t = linspace(0, t_max, 500);&#xA;% The synthesized signal &#xA;signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now I wanna view the amplitude spectrum for the first 50 samples.&lt;/p&gt;&#xA;&lt;p&gt;So I did this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;signal_first_50_samples= signal (1:50);&#xA;% Display its magnitude spectrum. &#xA;N = 64;&#xA;signal_spect = abs (fft(signal_first_50_samples,N));&#xA;signal_spect = fftshift(signal_spect);&#xA;F = [-N/2:N/2-1]/N;&#xA;plot (F, signal_spect) &#xA;set(gca, 'XTick',[-0.5:0.1:1])&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I was expecting spikes at each of the frequencies, however, I got this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MX7vv.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I re-did the sampling part as follows, to include more samples:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%% Synthesizing a sampled signal that consists of 4 sine waves &#xA;% We are given 4 different frequencies &#xA;freqs = [0.08, 0.2, 0.32, 0.4];&#xA;periods = 1./ freqs;&#xA;% Let the max value of t be 4 times the largest period&#xA;t_max = 4 * periods(1);&#xA;% Let us have 500 samples over the interval [0, t_max].&#xA;t = linspace(0, t_max, 500);&#xA;% The synthesized signal &#xA;signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);&#xA;% Visualising the synthesized signal &#xA;plot(t, signal, 'b-', 'LineWidth', 1.5);&#xA;grid on;&#xA;title('The Synthesized Signal', 'FontSize', fontSize);&#xA;xlabel('t', 'FontSize', fontSize);&#xA;ylabel('Y', 'FontSize', fontSize);&#xA;% Display its magnitude spectrum. &#xA;% i was expecting spikes at each freq &#xA;N = 64;&#xA;signal_spect = abs (fft(signal,N));&#xA;signal_spect = fftshift(signal_spect);&#xA;F = [-N/2:N/2-1]/N;&#xA;plot (F, signal_spect) &#xA;%set(gca, 'XTick',[-0.5:0.05:1])&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but i still got approx the same result, not what i expected&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GuJwz.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;another edit:&#xA;i did something else i had only 50 samples for the singal and took all of them&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%% 50 samples taking 50&#xA;clc;    &#xA;clear;  &#xA;% We are given 4 different frequencies &#xA;freqs = [0.08, 0.2, 0.32, 0.4];&#xA;periods = 1./ freqs;&#xA;% Let the max value of t be 4 times the largest period&#xA;t_max = 4 * periods(1);&#xA;% Let us have 50 samples over the interval [0, t_max].&#xA;t = linspace(0, t_max, 50);&#xA;% The synthesized signal &#xA;signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);&#xA;% Determine the first 50 samples of this signal &#xA;% signal_first_50_samples= signal (1:50);&#xA;% Display its magnitude spectrum. &#xA;% ??????????????????????????????????????????????????????????????????????&#xA;% I was expecting spikes at each freq &#xA;N = 64;&#xA;signal_spect = abs (fft(signal,N));&#xA;signal_spect = fftshift(signal_spect);&#xA;F = [-N/2:N/2-1]/N;&#xA;figure&#xA;plot (F, signal_spect) &#xA;%set(gca, 'XTick',[-0.5:0.05:1])&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I got this&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7xHCO.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;which looks about right&#xA;but I wonder why it didn't work when i had 500 samples and i took all 500 of them&lt;/p&gt;&#xA;&lt;p&gt;any ideas?&lt;/p&gt;&#xA;" OwnerUserId="11988" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2014-12-07T17:46:15.647" Title="I can't make sense of the amplitude spectrum of a signal. Help please" Tags="|matlab|" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19512" PostTypeId="2" ParentId="19509" CreationDate="2014-12-07T08:46:40.073" Score="0" Body="&lt;p&gt;$X[k]= \sum_{n=0}^{N-1} \delta[n]W_N^{kn} \quad$, where $\&amp;gt;W_N^{kn}=e^{−j\,2\pi k\,n/N}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the value of $\delta[n]$ when $n \neq 0 \&amp;gt;$ ?&lt;/p&gt;&#xA;" OwnerUserId="11145" LastActivityDate="2014-12-07T08:46:40.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19513" PostTypeId="2" ParentId="19505" CreationDate="2014-12-07T10:41:33.513" Score="4" Body="&lt;p&gt;Your filter is an FIR filter, therefore its coefficients are simply the impulse response $h[n]$. Your signal $x[n]$ can be filtered in time domain by convolving with impulse response: $$y[n]=x[n]\star h[n]$$ &#xA;Knowing that convolution in time domain is equal to multiplication in frequency domain $$Y[f]=X[f]H[f]$$&#xA;you only need to calculate two DFT's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to remember - output will be of the same length as input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speaking Matlab'ish:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter_2 = firceqrip(2,0.6,[0.05 0.03]);&#xA;&#xA;freqs = [0.08, 0.2, 0.32, 0.4];&#xA;periods = 1./ freqs;&#xA;t_max = 4 * periods(1);&#xA;t = linspace(0, t_max, 50);&#xA;&#xA;signal = sin(2*pi*0.08*t) + sin(2*pi*0.2*t) + sin(2*pi*0.32*t) + sin(2*pi*0.4*t);&#xA;&#xA;%% NEW CODE HERE %%&#xA;% Output is same length as input signal&#xA;M = length(signal);&#xA;% Find next power of two for sake of calculations&#xA;M2 = 2^nextpow2(M);&#xA;% Calculate the FFT's&#xA;Hf = fft(filter_2, M2);&#xA;Xf = fft(signal, M2);&#xA;% Multiply in frequency domain&#xA;Yf = Hf .* Xf;&#xA;% Perform the IFFT&#xA;y = ifft(Yf);&#xA;% Take only M samples&#xA;y = y(1:M);&#xA;% Remove this nasty imaginary parts&#xA;% comming from round-off errors&#xA;y_r = real(y);&#xA;&#xA;% Call the in-built function for sake of comparison&#xA;y_l = filter(filter_2, 1, signal);&#xA;&#xA;% Plot the original signal&#xA;subplot(311)&#xA;plot(signal)&#xA;grid on&#xA;title('Original signal')&#xA;&#xA;% Plot the results&#xA;subplot(312)&#xA;plot(y_l);&#xA;hold on&#xA;plot(y_r, 'r--')&#xA;grid on&#xA;legend({'in-build function', 'user function'})&#xA;title('Filtered signal')&#xA;&#xA;% Plot the relative error&#xA;subplot(313)&#xA;plot(abs(y_l - y_r))&#xA;grid on&#xA;title('Relative error')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Comparison of results below. As you can see, it matches perfectly MATLAB &lt;code&gt;filter&lt;/code&gt; function.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0IF9y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2014-12-07T10:41:33.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19515" PostTypeId="2" ParentId="19510" CreationDate="2014-12-07T16:24:41.990" Score="0" Body="&lt;p&gt;A few suggestions and comments:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You calculate the frequency vector with &lt;code&gt;F = [-N/2:N/2-1]/N;&lt;/code&gt;. This is wrong. You need to take the sampling frequency into account.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The way you organized your code, you don't have direct control over the sampling frequency. I recommend specifying both the time length and the sampling frequency explicitly in your code.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You need to set up your analysis so that you get high resolution in the frequency domain (so that you can resolve peaks that are very near to each other). The only way to achieve this is to sample for a long time. The more you oversample the signal (that is, the higher the Nyquist frequency is), the longer time you need to observe the signal. This is the reason you want to have explicit control over sampling rate and signal duration.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do not limit the FFT size by choosing an explicit &lt;code&gt;N&lt;/code&gt;, since that may lower your frequency resolution. If you want to set the FFT to a power of 2, then use &lt;code&gt;nextpow2&lt;/code&gt; or similar.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2014-12-07T17:46:15.647" LastActivityDate="2014-12-07T17:46:15.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19516" PostTypeId="2" ParentId="19504" CreationDate="2014-12-07T16:45:49.710" Score="2" Body="&lt;p&gt;To expand on Dilip's comment:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The noise being white implies only a certain property of the noise itself, not its correlation with any other signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In digital communications, the independence and/or lack of correlation between the signal and the noise is assumed, if not explicitly stated. The reason is that this is what is observed in practice. Even if you can mathematically conclude that a given message signal and a given noise are independent and uncorrelated, there is not much point in doing so.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is meant by circularly symmetric Gaussian noise is that the noise looks the same in all directions. Imagine a certain Gaussian complex noise that (for some physical reason) produces larger noise in specific directions; for example, along a line at an angle of $\pi$/4 on the complex plane. You could then design a QAM constellation (and detector) that takes advantage of this behavior to get better than expected performance given the noise power in the channel. When a problem states that the noise is circularly symmetric, it's saying that you can't play this kind of game.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2014-12-07T18:10:22.777" LastActivityDate="2014-12-07T18:10:22.777" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19518" PostTypeId="1" AcceptedAnswerId="19520" CreationDate="2014-12-07T18:17:53.527" Score="0" ViewCount="1893" Body="&lt;p&gt;I am trying to understand the limits of down sampling on a signal, i.e. how far can I go without loss of information or overlapping. It says in the solution manual of the Oppenhiem and Schafer book (on a question where down sampling is 2) that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;There is no loss of information if X(e^(jw/2) ) and X( e^(j(w/2) - pi) ) do not overlap.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean that my original signal is periodic and when I down sample means that my frequency response X(e^jw) becomes X(e^(jw/2) ) ?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help,  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0hiRp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11753" LastEditorUserId="11753" LastEditDate="2014-12-07T21:12:27.393" LastActivityDate="2014-12-07T21:12:27.393" Title="down sampling and a factor of 2 without loss of information" Tags="|frequency-response|downsampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19519" PostTypeId="1" AcceptedAnswerId="19526" CreationDate="2014-12-07T18:29:23.423" Score="5" ViewCount="3381" Body="&lt;p&gt;(cross post of SO: &lt;a href=&quot;https://stackoverflow.com/questions/27345861/extending-1d-function-across-3-dimensions-for-data-windowing&quot;&gt;https://stackoverflow.com/questions/27345861/extending-1d-function-across-3-dimensions-for-data-windowing&lt;/a&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of image (volume) registration, I'd like to apply a windowing function to input data, such that the non-periodic image boundaries do not cause streaking in the FFT. I'm using the example from here for 2D data:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mail.scipy.org/pipermail/numpy-discussion/2008-July/036112.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mail.scipy.org/pipermail/numpy-discussion/2008-July/036112.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = scipy.signal.hamming(n)&#xA;ham2d = sqrt(outer(h,h))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this extensible to 3D or even N-D?&lt;/p&gt;&#xA;" OwnerUserId="11932" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2020-02-26T00:41:00.813" Title="Extending 1D window functions to 3D (or higher)" Tags="|window-functions|3d|linear-algebra|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19520" PostTypeId="2" ParentId="19518" CreationDate="2014-12-07T20:08:15.980" Score="0" Body="&lt;p&gt;If you down-sample without filtering, you will fold spectrum above half the new sample rate together with spectrum below half the new sample rate.  If both those spectral bands (above and below) are sparse enough (big gaps in the spectral content) in the right places, then it is possible that when folded, there will be no overlap of the folded non-zero high band spectrum with the non-zero low band spectrum, thus no loss of information due to aliasing.  If you know where the spectral gaps were, you could unfold the data (with some effort).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the more typical case where those two spectrum bands (upper and lower) are not sparse enough and thus do overlap, the two spectrums be mixed (like mixing paint) when downsampling, thus incur an informationally lossy process.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-12-07T20:08:15.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19522" PostTypeId="1" AcceptedAnswerId="19530" CreationDate="2014-12-07T23:39:45.483" Score="2" ViewCount="8796" Body="&lt;p&gt;I am trying to find an example of a continuous system that is homogeneous, but not additive.&#xA;So far, the only example I could find was an example from &lt;a href=&quot;http://www.cdeep.iitb.ac.in/nptel/Electrical%20&amp;amp;%20Comm%20Engg/grp%201/final/4g2-2.htm&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt;, which describes system as $y(t) = \overline{x(t)}$, where (as I understand it) $\overline{a}$ is the conjugate of a complex number $a$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This, however, will work for a scaling constant $a$ that is complex, but not real, and I am wondering if it is possible to find a system $S$ which is additive, but not homogeneous, and this holds even when we scale the input signal with a real constant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been thinking a lot about it and I could not come with an example, nor could I prove it does not exist&lt;/p&gt;&#xA;" OwnerUserId="11997" LastActivityDate="2019-11-12T23:42:21.473" Title="Additive but not homogeneous continuous system?" Tags="|signal-analysis|continuous-signals|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19523" PostTypeId="1" AcceptedAnswerId="19587" CreationDate="2014-12-08T01:45:59.693" Score="0" ViewCount="653" Body="&lt;p&gt;I am trying to figure out what seems very trivial thing about down sampling and up sampling. The problem that I am facing is how to find the effects of up sample on a signal followed by a filter and/or a filter followed by down sampling. Here is a problem related to this from the Oppenhiem and Schafer book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YTZQF.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to see what happens to x[n] after it pass the hlp[n], considering that hlp[n] has wc = pi/4. Will there be a gain on this or just the frequency is affected? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help, Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="11753" LastActivityDate="2014-12-12T02:42:38.160" Title="up down sampling and low-pass filters" Tags="|lowpass-filter|downsampling|decimation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19525" PostTypeId="1" AcceptedAnswerId="19531" CreationDate="2014-12-08T07:17:36.290" Score="2" ViewCount="1220" Body="&lt;p&gt;I know that a general purpose microprocessor requires 18 operations to perform each butterfly of the FFT, but I do not understand how does using using a DSP or FFT chip improve FFT processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="11988" LastActivityDate="2014-12-10T09:09:26.547" Title="What is the difference between general microprocessors, DSP and FFT chips?" Tags="|fft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19526" PostTypeId="2" ParentId="19519" CreationDate="2014-12-08T10:23:14.680" Score="1" Body="&lt;p&gt;Yes, a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window function&lt;/a&gt; just applies a weighting function to your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For N-D data you can view the window function as a combination of N 1-D windows which are all orthogonal to each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the weights of the 1-D windows to not depend on the other dimensions you can either apply each separately or combine them to get a single N-D window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. for 3D (in matlab, it should be simple enough to translate to python)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hammx=hamming(L); %1D window&#xA;hammy=hamx';&#xA;hamz=permute(hamx, [3, 2, 1]);&#xA;ham2=ones(L);&#xA;ham3=ones(L, L, L);&#xA;for i=1:100               % there is probably a much better way to compute this&#xA;ham2(i, :)=hamx(i).*hamy;&#xA;for j=1:100&#xA;ham3(i, j, :)=ham2(i, j).*hamz;&#xA;end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8662" LastActivityDate="2014-12-08T10:23:14.680" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19527" PostTypeId="1" CreationDate="2014-12-08T10:48:45.923" Score="3" ViewCount="245" Body="&lt;p&gt;I need to construct Fourier transform of non-equispaced data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, I have signal $s(t)$, $t\in[0,T]$ sampled at non-equispaced points $t_k$, $k=0...N-1$ with sample values $s_k = s(t_k)$. For Fourier transform I use approximation of integral:&#xA;$$&#xA;   \hat S(\omega) = \int\limits_{-\infty}^\infty s(t)e^{-i\omega t}dt \approx \hat S_d(\omega) = \sum_{k=0}^{N-1}s_ke^{-i\omega t_k}\Delta t_k&#xA;\tag{1}&#xA;$$&#xA;where $\Delta t_k = (t_{k+1}-t_{k-1})/2$. As sampling points in frequency domain I choose $\omega_n = \frac{2\pi}{T}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: as I can evaluate (1) for any $\omega$, what is the maximum $\omega$ such $\hat S_d(\omega)$ &quot;adequately&quot; represents $\hat S(\omega)$? What is the maximum of $n$ for $\omega_n$ I can use? For DFT we got Nyquist frequency. Do we have something similar for NDFT? Any references would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I'm aware of such things as NDFT and NFFT. Though formula for NDFT, as presented in most papers, is &#xA;$$&#xA;\hat S_d(\omega_n) = \sum_{k=0}^{N-1}s_ke^{-i\omega_n t_k}&#xA;$$&#xA;I strongly believe that I need to use formula (1) as I'm trying to build a periodogram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I'm not interested in fast ways of computing NDFT yet, so I'm not considering NFFT. &lt;/p&gt;&#xA;" OwnerUserId="12002" LastEditorUserId="128" LastEditDate="2021-02-13T16:23:46.863" LastActivityDate="2021-02-13T16:23:46.863" Title="Non Equispaced / Non Uniform DFT Bandwidth" Tags="|fourier-transform|dft|nonuniform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="19530" PostTypeId="2" ParentId="19522" CreationDate="2014-12-08T14:48:49.353" Score="3" Body="&lt;p&gt;You are misinterpreting the issues entirely. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A system with complex inputs and complex outputs that maps its input&#xA;  $x(t)$ to output $[x(t)]^*$, the complex&#xA;  conjugate of $x(t)$, &lt;strong&gt;is&lt;/strong&gt; &lt;em&gt;additive&lt;/em&gt;, &lt;strong&gt;is not&lt;/strong&gt; &lt;em&gt;homogeneous&lt;/em&gt; for complex scalars and &lt;em&gt;is&lt;/em&gt; homogeneous for real scalars.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Consider the system with complex inputs and complex outputs that maps its&#xA;input to its complex conjugate.  Thus, it maps&#xA;$$x_1(t) \to [x_1(t)]^*, \quad x_2(t)\to [x_2(t)]^*.$$&#xA;So, what happens if the input is the sum $x_1(t)+x_2(t)$? well, the &#xA;rule is that the input gets mapped to its complex conjugate and so&#xA;$$x_1(t) + x_2(t) \to [x_1(t) + x_2(t)]^* = [x_1(t)]^* + [x_2(t)]^*.$$&#xA;Since this holds for arbitrary choice of $x_1(t)$ and $x_2(t)$, we&#xA;conclude that the system is indeed &lt;strong&gt;additive&lt;/strong&gt;: the response to a&#xA;sum of signals is the sum of the responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\alpha$ denote a complex&#xA;number. Then, this &quot;complex conjugator&quot; system maps&#xA;$$\alpha\cdot x(t) \to [\alpha\cdot x(t)]^* = [\alpha]^*\cdot [x(t)]^* &#xA;\neq \alpha\cdot [x(t)]^*$$&#xA;unless $\alpha$ happens to be a real number.  So, the system &lt;strong&gt;is not&lt;/strong&gt;&#xA;&lt;em&gt;homogeneous&lt;/em&gt; since the required condition does not hold for arbitrary&#xA;(complex) $\alpha$.&#xA;However, it &lt;em&gt;is&lt;/em&gt; true that if $\alpha$ is restricted to be a real number,&#xA;then the scaling property (a.k.a. homogeneity) &lt;em&gt;does&lt;/em&gt; hold.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Addendum:&lt;/strong&gt;  The OP wants&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a system that maps strictly real inputs to strictly real outputs, and that cannot be scaled with a complex (only with real) constants, and that is additive, but not homogeneous. That's my initial question,....&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Since the input and output are required to be real, and not complex, the &#xA;notion of &quot;cannot be scaled with a complex constant&quot; does not make sense&#xA;any more because the scaling of the input makes it a complex-valued signal, &#xA;and the system allows only for a real-valued input. So essentially the question&#xA;boils down to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Does there exist a system with real-valued inputs and outputs&#xA;that has the additive property but not the homogeneity property?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to which the answer is &lt;strong&gt;No&lt;/strong&gt;, as pointed out in the &#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Linearity#In_mathematics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article on linear systems&lt;/a&gt;. Most of the ideas there are reproduced&#xA;in the &lt;a href=&quot;https://dsp.stackexchange.com/a/18459/235&quot;&gt;dsp.SE answer&lt;/a&gt;&#xA;mentioned in a comment by MBaz but the dsp.SE answer goes on to make&#xA;the &lt;em&gt;additional&lt;/em&gt; claim (not in Wikipedia) that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&quot;not much else is needed to extend to $a \in \mathbb C$&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is false.  Indeed, as MattL notes carefully in a comment,&#xA;MattL's answers are applicable to scaling by real numbers only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An outline of the proof that for real-valued systems, additivity&#xA;implies homogeneity is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a system with real-valued inputs and outputs that&#xA;maps any given $x$ to $A(x)$. The function $A(\cdot)$ has the&#xA;property that $A(x_1+x_2) = A(x_1)+A(x_2)$ and the system is called&#xA;&lt;em&gt;additive&lt;/em&gt; since the response to the &lt;em&gt;sum&lt;/em&gt; $x_1+x_2$ is the &lt;em&gt;sum&lt;/em&gt; of&#xA;the responses $A(x_1)$ and $A(x_2)$.  Mathematical induction extends this to&#xA;$$A\left(\sum_{i=1}^n x_i \right) = \sum_{i=1}^n A(x_i).\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Choosing all the $x_i$ in $(1)$ to have value $0$, we see that&#xA;$A(0) = nA(0)$ and so $A(0)=0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Choosing all the $x_i$ in $(1)$ to be $x$, we see that $A(nx)=nA(x)$&#xA;and so the scaling property holds for positive integers $n$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Choosing $n=2$ and $x_2 = -x_1$ in $(1)$, we have that&#xA;$A(x_1+(-x_1)) = A(x_1)+A(-x_1)$. But $x_1+(-x_1)=0$ and so we&#xA;see that $A(0) = 0 = A(x_1)+A(-x_1)$, that is, &#xA;$$A(-x_1)=A((-1)x_1) = -A(x_1) =(-1)A(x_1).$$ So the scaling&#xA;property holds for $-1$, and by mathematical induction for&#xA;all negative integers as well.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Scaling holds for rational numbers $\displaystyle \frac 1n$ as well. Choose&#xA;$\displaystyle x_i = \frac 1n x$ in $(1)$ to get &#xA;$$A(x)=nA\left(\frac 1n x\right) \Rightarrow &#xA;A\left(\frac 1n x\right) = \frac 1n A(x).$$&#xA;Mathematical induction allows us to extend this to more general&#xA;rational numbers $\displaystyle \frac mn$ as well.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, to show that scaling applies to arbitrary (not necessarily &#xA;rational) real numbers, Wikipedia says that we need to assume that&#xA;the mapping is continuous and use the fact the rational numbers&#xA;are a dense subset of the reals.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, except for this last part which requires some mathematics&#xA;beyond high school, we can show straightforwardly that&#xA;additivity implies homogeneity.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-12-08T23:26:29.167" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19531" PostTypeId="2" ParentId="19525" CreationDate="2014-12-08T14:52:53.947" Score="4" Body="&lt;p&gt;My information may be a bit dated and the information may vary depending on the exact DSP chip you look at. The memory architecture on DSP chips often have multiple memories which can be accessed simultaneously. As an example look at the &lt;a href=&quot;http://en.wikipedia.org/wiki/Harvard_architecture&quot; rel=&quot;nofollow&quot;&gt;Harvard Memory Architecture&lt;/a&gt;. The instruction set on DSP chips is also highly specialized to make efficient use of this memory architecture. Often manufacturers provide library code for the FFT's because it would take a typical developer awhile to optimize the code by hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The memory on GPUs tends to be a hierarchy of caches, starting with a fast but small cache and then going to slower main memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DSP chip often have memory dedicated to storing the FFT twiddle factors i.e. the sin() and cos() factors. On GPUs these factors can be stored in the cache but it is usually not explicit and can not be guaranteed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the FFT is not usually in order i.e. the frequency bins do not appear as bin 1, bin 2, bin 3 .... Instead they come out in bit reversed order. DSP chips usually have an explicit bit reversed addressing mode, thus allowing efficient access to the FFT output. On GPUs this addressing mode is not used because it used so infrequently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2014-12-08T15:05:29.223" LastActivityDate="2014-12-08T15:05:29.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19532" PostTypeId="2" ParentId="19525" CreationDate="2014-12-08T15:36:41.220" Score="5" Body="&lt;p&gt;In addition to the memory differences that David pointed out, DSP chips have multiple multiply/accumulate (MAC) units.  MAC is a very common signal processing operation that is the basis of filter and FFT/iFFT operations.  Some DSP chips that I used in the past had six MAC units, which allowed them to speed up the FFT operations in two ways: they could do six MAC operations at once, and the MAC operation itself would take one clock cycle while on a general purpose microprocessor each MAC would take at least two clock cycles since it would be a multiply followed by an add.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-12-08T15:36:41.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19533" PostTypeId="2" ParentId="13574" CreationDate="2014-12-08T18:36:30.413" Score="0" Body="&lt;p&gt;Check this article:&lt;br&gt;&#xA;&lt;a href=&quot;http://asp.eurasipjournals.com/content/2014/1/143&quot; rel=&quot;nofollow&quot;&gt;http://asp.eurasipjournals.com/content/2014/1/143&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We used energy detector for fft-based acquisition in GNSS systems but you can use it in similar situation. &lt;/p&gt;&#xA;" OwnerUserId="12006" LastActivityDate="2014-12-08T18:36:30.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19534" PostTypeId="1" AcceptedAnswerId="19537" CreationDate="2014-12-08T22:03:27.903" Score="0" ViewCount="91" Body="&lt;p&gt;Suppose there are two vector signals, $u$ and $v$, which are functions of time. Given, $E[uv^T]=0$, what is the physical significance of this statement. For clarity, assume $u$ and $v$ are noises in a system like in kalman filter, control noise and measurement noise. E is the expected value and assume that the vector dimensions are entirely compatible.&lt;/p&gt;&#xA;" OwnerUserId="12007" LastActivityDate="2014-12-09T04:47:36.090" Title="Expected value of coupled signals is zero" Tags="|signal-analysis|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19537" PostTypeId="2" ParentId="19534" CreationDate="2014-12-09T04:47:36.090" Score="0" Body="&lt;p&gt;It means u and v are orthogonal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If u or v or both have zero mean then they are also uncorrelated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they are uncorrelated and jointly gaussian then they are also independent.&lt;/p&gt;&#xA;" OwnerUserId="11618" LastActivityDate="2014-12-09T04:47:36.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19538" PostTypeId="2" ParentId="17453" CreationDate="2014-12-09T05:22:11.357" Score="1" Body="&lt;p&gt;The way you wrote it, 1/f0 defines the -3dB cutoff frequency. This is easy to see if you let s = 1/f0. The numerator becomes 1 and the denominator becomes 2. A gain of 1/2 is -3dB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it's high-pass, frequencies &gt; 1/f0 will be passed through the filter while frequencies &amp;lt; 1/f0 will be attenuated (the lower the frequency, the greater the attenuation).&lt;/p&gt;&#xA;" OwnerUserId="11618" LastActivityDate="2014-12-09T05:22:11.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19539" PostTypeId="1" CreationDate="2014-12-09T06:27:22.987" Score="2" ViewCount="2107" Body="&lt;p&gt;Being new to ANC, this is my understanding of how ANC works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ambient noise (n) is entering a geographically small zone. To suppress the noise, an interfering (corrective) sound is injected acoustically into the zone by a speaker. The interfering sound from the speaker is adaptively generated so that it - in theory - ends up being a 180 degree phase-shifted version of the noise ....When this phase-shifted signal is acoustically mixed with the ambient noise, the noise is ideally cancelled out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So based on the above, I would need a microphone to record sound as it presents itself in the &quot;zone&quot; and then let that drive an adaptive process which calculates a digital speaker signal to send to the speaker. The energy of the recorded sound would be the indicator of how well the adaptive process is performing (in terms of cancelling out the noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is : what type of algorithm(s) are used for this kind of DSP scheme?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is one microphone enough?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if the speaker has to output more than just the noise cancelling signal? For example: A user is wearing headphones with ANC. The user is listening to music but wants the &quot;outside&quot; noise to be cancelled out. I can't imagine that it would work unless the headphone has an &quot;inside&quot; microphone and an &quot;outside&quot; microphone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does ANC work in dimensionally small setups? For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The speaker is connected to a tube through which the corrective sound travels. The open end of the tube is placed in a small zone where a microphone is also located. An algorithm receives audio from the microphone, calculates the speaker signal and sends the speaker signal to the speaker. Will that work? Or are there some fundamental requirements/assumptions which have to be met for the ANC to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to hear from people who wish to share their experience and knowledge acquired from working with ANC. Any advice is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WUUTr.png&quot; alt=&quot;ANC setup&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4353" LastEditorUserId="4353" LastEditDate="2014-12-09T21:42:48.580" LastActivityDate="2014-12-10T13:37:10.150" Title="Questions about Active Noise Cancellation" Tags="|filters|audio|adaptive-filters|adaptive-algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19540" PostTypeId="2" ParentId="19424" CreationDate="2014-12-09T07:22:02.077" Score="1" Body="&lt;p&gt;I do all my camera calibratins with a SpyderLenscal. You have to take the biggest focal length and the lowest aperture value. This is how you get the smallest depth of field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The distance between camera and your pattern should be the one you usually use with this specific lens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you'll find a video tutorial:&#xA;&lt;a href=&quot;https://www.youtube.com/watch?v=k2zlLIDfVgc&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=k2zlLIDfVgc&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="12015" LastActivityDate="2014-12-09T07:22:02.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19541" PostTypeId="2" ParentId="19424" CreationDate="2014-12-09T09:23:19.387" Score="0" Body="&lt;p&gt;I think the trivial idea on multiple calibrations is to take the one with the minimum reprojection error. Otherwise, if you want to refine your calibrations over several sessions, then I would benefit from Ankur Datta's approach, where multiple calibrations on the same dataset is performed and the accuracy is iteratively refined. &lt;a href=&quot;http://www.ri.cmu.edu/research_project_detail.html?project_id=617&amp;amp;menu_id=261&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a reference implementation.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-09T09:23:19.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19542" PostTypeId="2" ParentId="19539" CreationDate="2014-12-09T13:48:51.727" Score="3" Body="&lt;p&gt;That's a pretty broad question. Let's start with a noise cancelling head set, that's about the easiest device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A ANC headset has an internal microphone, that's placed as close to the ear canal as possible. It than runs a regular control loop (&lt;a href=&quot;http://en.wikipedia.org/wiki/Control_theory&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Control_theory&lt;/a&gt;): It calculates a speaker signal that tries to keep the signal at the microphone at zero. If you want to play music at the same time, you simply make the &quot;desired signal&quot; to be the music and not zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are all sorts of implementation problems&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Designing the control loop is difficult in terms of stability, cancelling performance, spectral fidelity, etc.&lt;/li&gt;&#xA;&lt;li&gt;Manufacturing tolerances&lt;/li&gt;&#xA;&lt;li&gt;Control loops need to be fast, so they work better at low frequencies. Most good headsets use a well tuned combination of active and passive cancellation. Passive works a lot better at high frequencies&lt;/li&gt;&#xA;&lt;li&gt;While the headset cavity is small, it still has a fair amount of acoustic resonance and wave propagation, so you need to correct for the sound at the microphone vs. the sound at the ear drum&lt;/li&gt;&#xA;&lt;li&gt;Many newer headsets use outside microphones as well, so it's a combination of feed-forward and feedback cancellation&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Once the spaces get larger than a headset, things get a lot more complicated. Now you need to take into account the spatially distributed sound field, the environment, all kinds of propagation modes. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2014-12-09T13:48:51.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19543" PostTypeId="1" AcceptedAnswerId="19546" CreationDate="2014-12-09T14:16:20.620" Score="1" ViewCount="543" Body="&lt;p&gt;During MFCC process FFT is done to get the power spectrum but last step is DCT in order to get back to time domain. Cannot DCT be used in the first case to convert the signal to frequency domain?&lt;/p&gt;&#xA;" OwnerUserId="12020" LastEditorUserId="8202" LastEditDate="2014-12-10T11:16:21.400" LastActivityDate="2014-12-10T11:16:21.400" Title="DCT step in MFCC process" Tags="|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19544" PostTypeId="1" CreationDate="2014-12-09T14:38:03.427" Score="0" ViewCount="102" Body="&lt;p&gt;have two User one of them sending over freq (0-B] and the other transmit over (B-2B]. Both of them are using OFDM and each one has Nc subcarriers. I wanted to simulate the received signal using Matlab.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;One way to implement, I beleive is that I say user one have 2*Nc subcarriers and only use the first Nc subcarriers and the second user also has 2Nc subcarrier and only ise subcarriers [Nc+1-2Nc). in this case I should use FFT/IFFT size of 2Nc:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Received signal would be Y = ifft([d_1 0*d2],2Nc)+ifft([0*d_1 d_2],2Nc) where d_1 and d_2 are the data of the first and the second users. and at the receiver I can compute d=fft(Y, 2Nc) and the first half would be for user1 and second half for user2.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;But I want to use FFT size of Nc, i.e., compute ifft(d_1,Nc) and ifft(d_2,Nc). If I add these two iffts directly, I will get incorrect results as the IFFT results does not show that the two data occupying different subcarriers. My question is, in this case, how I should change (probably up-convert) the ifft result of the second UE?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, after constructing the received signal, what operation do I need to get back the transmitted data? Should I again use fft(y,2Nc) ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Your help is highly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&lt;/p&gt;&#xA;" OwnerUserId="12021" LastEditorUserId="12021" LastEditDate="2014-12-10T04:15:52.090" LastActivityDate="2014-12-10T04:15:52.090" Title="How to simulate two OFDM Users with low complexity FFT/IFFT?" Tags="|fft|discrete-signals|digital-communications|modulation|ofdm|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19546" PostTypeId="2" ParentId="19543" CreationDate="2014-12-09T15:09:46.030" Score="1" Body="&lt;p&gt;DCT is not used only for going back to time domain, it is also used due to it's &quot;de-correlating properties&quot;. By saying that I mean compression of most of the information in smaller number of coefficients. Although in theory we could use the DCT to &lt;a href=&quot;http://www.smcnus.org/papers/1.Audio_and_Music_Analysis_and_Retrieval/2000_DFT,_DCT,_MDCT,_DST_and_Signal_Fourier_Spectrum_Analysis.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;calculate the spectrum&lt;/a&gt;, but I never saw anyone doing that. Usually thing is simple:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;want to analyse the spectrum? Use DFT&lt;/li&gt;&#xA;&lt;li&gt;want to compress and de-correlate data? Use some flavour of DCT&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also one very important thing. In case of DCT, the equivalence property of convolution and multiplication in frequency domain doesn't hold:&#xA;$$x[n]\star y[n] \nLeftrightarrow X_{DCT}[k]\cdot Y_{DCT}[k] $$&#xA;which is the fundamental property (homomorphic) used when calculating the MFCC's. It allows to perform the Cepstral Mean Normalization and remove the &quot;convolutional distortions&quot;, such as vocal tract. For more info please refer to my previous &lt;a href=&quot;https://dsp.stackexchange.com/a/15945/8202&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-12-09T15:22:21.830" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19548" PostTypeId="1" CreationDate="2014-12-09T20:02:08.573" Score="1" ViewCount="215" Body="&lt;p&gt;I am working on some experimental data which, at some point, need to be time-integrated and then high-pass filtered (to remove low frequency disturbancies introduced by integration and unwanted DC component).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aim of my work is not related to filtering, but still I would like to analyze more in detail the filters I am using to give some justification (for example to motivate why I chosed to use a 4th order filter instead of a higher/lower one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the filter I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;delta_t = 1.53846e-04;&#xA;Fs = 1/delta_t;&#xA;cut_F = 8; &#xA;Wn = cut_F/(Fs/2);&#xA;ftype = 'high';&#xA;[b,a] = butter(4,Wn,ftype);&#xA;filtered_signal = filtfilt(b,a,signal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I already had a look here: &lt;a href=&quot;https://stackoverflow.com/questions/5591278/high-pass-filtering-in-matlab&quot;&gt;https://stackoverflow.com/questions/5591278/high-pass-filtering-in-matlab&lt;/a&gt; to learn something about filters (I never had a course on signal processing) and I used &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fvtool(b,a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to see the impulse response, step response ecc. of the filter I have used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I do not know how to &quot;read&quot; these plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I have to look for? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I understand if a filter is good or not? (I do not have any specification about filter performances, I just know that the lowest frequency I can admit is 5 Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What features of different filters are useful to be compared to motivate the choice? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, what info can I see plotting the round-off noise power spectrum of 2 different filters?(high pass Butterworth of different orders: 4 and 22)&#xA;&lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/filter_comparison.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried decimating the signal to reduce the sampling frequency as suggested in the comments and this is what I get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/filter_decimation.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The green one is the new filter's round off noise spectrum having reduced the sampling frequency (now = 325 Hz), the blue one is the older with sampling frequency = 6.5 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things look a bit better but still not good enough, am I right?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2014-12-11T06:42:44.177" Title="Filters performance analysis" Tags="|matlab|filters|information-theory|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19550" PostTypeId="1" AcceptedAnswerId="19553" CreationDate="2014-12-09T20:11:20.487" Score="0" ViewCount="220" Body="&lt;p&gt;I tried creating a filter in 2 different ways in Matlab and I obtain different results: one filter is stable, whereas the other one is unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Coded filter&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;delta_t = 1.53846e-04;&#xA;Fs = 1/delta_t;&#xA;&#xA;cut_F = 8; &#xA;Wn = cut_F/(Fs/2);&#xA;ftype = 'high';&#xA;[b,a] = butter(8,Wn,ftype);&#xA;fvtool(b,a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result is an unstable filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/filter_code.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;fdatool&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I obtain with the toolbox using the same parameters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/filter_tool.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using already implemented functions in both cases...Why I get so different results?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:36.230" LastActivityDate="2014-12-09T22:00:29.447" Title="coded filter vs fdatool : inconsistency in the results for same parameters" Tags="|matlab|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19551" PostTypeId="2" ParentId="19527" CreationDate="2014-12-09T20:45:06.173" Score="1" Body="&lt;p&gt;Your formula isn't accurate.  Since you aren't trying for speed and internally  consider the interpolation between data points as a step/pulse then the formula should be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;S(\omega)=\sum_{n=0}^{N-1}s_{k}sinc(\frac{\omega\triangle\left(t_{k}\right)}{2})e^{-wt_{k}}&#xA;$$ &#xA;Having said that, what is &quot;adequate&quot;?  This is, more or less, subjective.  The original Nyquest criterion is based upon the result that any (freq &amp;lt; sam/2) (I think there is some small quibbling on that) can be &lt;em&gt;perfectly&lt;/em&gt; reconstructed; if it and the sampling lasts long enough.  It says nothing about out of band signals; but the actual calculations will show aliasing.&lt;br&gt;&#xA;It behooves you to generate the signals and interference that you envision and run it through your proposed algorithm. An alternative is to treat your system as a filter and try to &quot;deconvolve&quot; it. This is hazardous but can be done.&#xA;For a in depth look (with the hazards) read &quot;Introduction to the Mathematics of Inversion in Remote Sensing and Indirect Measurements&quot;  SIAM.&#xA;Now MRI/CAT scanners use various means of reconstructed signals.  All of the mathematicians seem to think that their technical success is an example of extreme luck; although I am sure that the designers might take exception to that.  You might try borrowing some of their mathematical techniques though.&#xA;Now in general instrumentation what we concentrate on is &quot;noise temperature&quot; and such.  This can be translated as: how far will your system signal/noise (or signal/distortion) be from the optimal number.  If you can get within 1db of the optimal S/N value then you should probably give up.  Of course this implies that you can calculate the optimal S/N.  In most instruments this can be done and this criterion gives you a stopping point; a point to give up and look for something else to do :)&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2014-12-09T20:45:06.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19553" PostTypeId="2" ParentId="19550" CreationDate="2014-12-09T22:00:29.447" Score="2" Body="&lt;p&gt;Note that the fdatool gives you a structure with cascaded second-order sections, whereas the fvtool uses a direct-form II transposed structure. In combination with the filter specs this results in the difference you see, because the very low cut-off frequency combined with the relatively high filter order results in a cluster of poles and zeros very close to the DC point in the complex $z$-plane (i.e., close to $z=1$). Computing the exact locations of the poles and zeros is an ill-conditioned problem, and in the case of the direct-form II transposed structure, you need to find the roots of polynomials of degree $8$. Due to the round-off errors in the computation of the roots, some of the poles appear to lie just outside the unit circle, hence the conclusion that the filter is unstable. For the second order sections, the poles can be computed more accurately and they all turn out to lie inside the unit circle, hence the conclusion that the filter is stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, is the filter now stable or unstable? Well, in theory it is stable. In practice, however, it is probably of no use because its poles are virtually on the unit circle. The tool probably offers you to compute the exact pole locations of the second order sections. You'll see that most of the pole radii are very close to $1$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-09T22:00:29.447" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19554" PostTypeId="1" CreationDate="2014-12-09T22:52:50.327" Score="4" ViewCount="4945" Body="&lt;p&gt;I have a question that might be stupide !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supposing that I try to detect object moving in a video or human action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many works are based on optical flow computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why using OF is the best for motion detection. A tracking of pixels or region of interest will not be as informativa as OF .?&lt;/p&gt;&#xA;" OwnerUserId="4470" LastEditorUserId="7338" LastEditDate="2017-06-15T15:50:47.893" LastActivityDate="2017-06-15T15:50:47.893" Title="Why optical flow ? why not tracking" Tags="|computer-vision|object-recognition|sift|visual-tracking|optical-flow|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19555" PostTypeId="2" ParentId="19485" CreationDate="2014-12-10T02:32:36.787" Score="2" Body="&lt;p&gt;In my opinion, the best approach for this kind of spectrally-overlapping noise is to use blind source separation techniques, like independent component analysis (ICA) or time-frequency masking, or sparse source decomposition.  Look up the work of Emmanuel Vincent, Kostas Kokkinakis, or Philipos Loizou.  These methods work best when some statistics of the noise are time-independent, and the SNR is small or negative, as appears to be the case in your example.  Vincent has some MATLAB code available on the web.&lt;/p&gt;&#xA;" OwnerUserId="10657" LastActivityDate="2014-12-10T02:32:36.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19559" PostTypeId="1" AcceptedAnswerId="24551" CreationDate="2014-12-10T05:10:13.277" Score="0" ViewCount="71" Body="&lt;p&gt;This is a general question on multitaper spectral analysis of signals and stationarity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I work with time series which are non stationary. In this regard I have two questions&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is weak sense stationarity of second order sufficient to apply multitaper spectrum to compute valid estimates from contiguous time series objects or strick sense stationarity is required. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multitaper works with signals that are periodic, quasi periodic, nearly periodic, and semi periodic signals however I find hard to diferenciate between periodic and the rest as to be able to see if the series I am working with belong to any of the mentioned groups.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Your help will be welcomed&lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="1629" LastEditDate="2016-06-01T07:00:32.327" LastActivityDate="2016-07-31T07:55:31.443" Title="Weak sense stationarity sufficient for multitaper spectrum analysis?" Tags="|signal-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19560" PostTypeId="1" CreationDate="2014-12-10T06:44:56.773" Score="3" ViewCount="1634" Body="&lt;p&gt;In frequency domain $\zeta&amp;gt;0.707$ implies no resonant peak in frequency response. But I am unable to correlate what is the exact time domain effect of this? If  $\zeta=0.707$ acts like an 'important damping value' in the frequency domain, shouldn't its importance be reflected in time domain as well. But in time domain $\zeta=1$ is where system behavior changes.&lt;/p&gt;&#xA;" OwnerUserId="11578" LastEditorUserId="8202" LastEditDate="2014-12-10T07:42:23.427" LastActivityDate="2014-12-10T10:44:17.240" Title="For a standard second order transfer function, what is the equivalent time domain significance of $\zeta&gt;0.707$?" Tags="|frequency-spectrum|frequency-response|transfer-function|control-systems|damping|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19561" PostTypeId="1" CreationDate="2014-12-10T07:08:40.763" Score="-1" ViewCount="201" Body="&lt;p&gt;Can someone please help me with this Fourier series question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Determine the Fourier series coefficients of $x(t)$ given as $x(t) =&#xA;&amp;gt; \cos4t +\sin8t+3$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="12028" LastEditorUserId="8202" LastEditDate="2014-12-10T07:40:07.167" LastActivityDate="2014-12-11T14:08:41.930" Title="Fourier series qn determine the fourier series coefficients" Tags="|fourier-transform|fourier-series|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19562" PostTypeId="1" CreationDate="2014-12-10T07:45:37.993" Score="0" ViewCount="165" Body="&lt;p&gt;Evaluating a volume flow incremental sensor does not deliver expected results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pump of which the volume flow is to be measured has a hand-calculated flow rate of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Q = \dfrac{n}{ 60 \;\mathrm{s/min}}   e \pi\left(\frac{d}{2}\right)^2  \approx 2 \;\mathrm{cm^3/s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n$ is the rotational speed of $2000 \;\mathrm{1/min}$, $e$ the excentricity of the pump of $1.1 \;\mathrm{mm}$, and $\pi\left(\frac{d}{2}\right)^2$ is the area of the piston with $d = 8 \;\mathrm{mm}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the sensor (VSE, Type: VS 0,1) delivers 10000 impulses per liter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The calculation counts the &quot;Delta Impulses&quot;, call it dI, and divides by the time delta dt in milliseconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dfrac{dI}{dt} = \text{impulses/ms}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I say that $10$ impulses mean $1 \;\mathrm{cm^3}$ as the spec says ($1 \;\mathrm{liter} = 1000 \;\mathrm{cm^3}$).&#xA;So &#xA;$$1 \;\text{impulse} = 0.1 \;\mathrm{cm^3/ms}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further with $1000 \;\mathrm{ms} = 1\;\mathrm{s}$, it is  $100 \;\mathrm{cm^3/s}$.&#xA;I can multiply the $\frac{dI}{dt}$ with $100$ and get the flow in $\mathrm{cm^3/s}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1 \frac{dI}{dt} = 100 \;\mathrm{cm^3/s}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this calculation is done within the program. The factor $100$ is given as a parameter that I have set to this value to translate the flow into $\mathrm{cm^3/s}$. The program always uses milliseconds (PLC-Control with $1\;\mathrm{ms}$ cycle, increments time ticker each time +1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know the values of the used impuls count, but the result in $\mathrm{cm^3/s}$ is about $10$ times higher than the hand-calculated flow rate. I can't find a logical mistake. Do you?&lt;/p&gt;&#xA;" OwnerUserId="12029" LastEditorUserId="12029" LastEditDate="2014-12-10T11:52:23.970" LastActivityDate="2022-04-04T05:04:10.410" Title="Evaluation of incremental sensor" Tags="|algorithms|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19564" PostTypeId="1" AcceptedAnswerId="19567" CreationDate="2014-12-10T08:51:32.857" Score="20" ViewCount="14416" Body="&lt;p&gt;Can anyone please explain about Cepstral Mean Normalization, how the equivalence property of convolution affect this? Is it must to do CMN in MFCC Based Speaker Recognition? Why the property of convolution is the fundamental need for MFCC?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am very new to this signal processing. Please help&lt;/p&gt;&#xA;" OwnerUserId="12020" LastEditorUserId="8202" LastEditDate="2014-12-10T11:10:42.910" LastActivityDate="2022-09-01T17:33:27.807" Title="Cepstral Mean Normalization" Tags="|mfcc|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19565" PostTypeId="2" ParentId="19525" CreationDate="2014-12-10T09:09:26.547" Score="2" Body="&lt;p&gt;Further more, DSPs have dedicated hardware loop unit that frees the DSP from doing software loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Software loop:&lt;/em&gt; execute the loop content, increment  the cycle variable, check condition, jump back if condition was met&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Hardware loop:&lt;/em&gt; you tell the hardware how many times you want to execute a specific address range, and the hardware will take care of the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no additional looping overhead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;David mentioned that there is a bit reverse addressing mode for reading the FFT results faster without addressing overhead in software, but there is also a modulo N addressing mode, that is capable of constructing circular buffers with no software boundary checking and rewinding.&lt;/p&gt;&#xA;" OwnerUserId="11208" LastActivityDate="2014-12-10T09:09:26.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19566" PostTypeId="2" ParentId="19560" CreationDate="2014-12-10T10:44:17.240" Score="3" Body="&lt;p&gt;You are absolutely right that the damping value $\zeta=1/\sqrt{2}$ is important for the &lt;em&gt;frequency domain&lt;/em&gt; behavior of a second-order system. However, as you've also noted, there is no one-to-one correspondence in the time domain. Generally we distinguish over-damped ($\zeta&amp;gt;1$), under-damped ($\zeta&amp;lt;1$), and critically damped ($\zeta=1$) systems, and these categories have distinct time-domain behaviors. Over-damped and critically damped systems only have real poles, whereas under-damped systems have complex poles, which results in oscillations in the impulse and step responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that only under-damped systems are useful for implementing frequency-selective filters, because the pole angles are related to the cut-off frequency, i.e. you need complex conjugate poles. So for frequency-selective filters you only consider under-damped systems, and then you can find different categories of under-damped systems according to their behavior in the frequency domain. A second-order Butterworth low pass filter has $\zeta=1/\sqrt{2}$, i.e. it is maximally flat at $\omega=0$, a Bessel low pass is even smoother and has larger damping ($\zeta=\sqrt{3}/2$), and a Chebyshev low pass filter is less damped than both of these filters. All of these filters satisfy $\zeta&amp;lt;1$, i.e. they are under-damped.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-10T10:44:17.240" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19567" PostTypeId="2" ParentId="19564" CreationDate="2014-12-10T11:03:57.273" Score="25" Body="&lt;p&gt;Just to make things clear - this property is not &lt;em&gt;fundamental&lt;/em&gt; but &lt;em&gt;important&lt;/em&gt;. It is the fundamental difference when it comes to using DCT instead of DFT for spectrum calculation.&lt;/p&gt;&#xA;&lt;h2&gt;Why do we do Cepstral Mean Normalisation&lt;/h2&gt;&#xA;&lt;p&gt;In speaker recognition, we want to remove any channel effects (impulse response of vocal tract, audio path, room, etc.). Providing that the input signal is &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; and channel impulse response is given by &lt;span class=&quot;math-container&quot;&gt;$h[n]$&lt;/span&gt;, the recorded signal is a linear convolution of both:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = x[n] \star h[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By taking the Fourier Transform we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y[f] = X[f]\cdot H[f] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;due to the convolution-multiplication equivalence property of FT - &lt;strong&gt;that is why it's so important property of FFT at this step&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The next step in the calculation of cepstrum is taking the logarithm of the spectrum:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y[q] = \log Y[f] = \log \left( X[f] \cdot H[f]\right) = X[q] + H[q]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because: &lt;span class=&quot;math-container&quot;&gt;$\log(ab) = \log a +\log b $&lt;/span&gt;. Variable &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is the &lt;em&gt;quefrency&lt;/em&gt;. As one might notice, by taking the cepstrum of convolution in the time domain we end up with the addition in the cepstral (quefrency) domain.&lt;/p&gt;&#xA;&lt;h2&gt;What is the Cepstral Mean Normalisation?&lt;/h2&gt;&#xA;&lt;p&gt;Now we know that in the cepstral domain any convolutional distortions are represented by addition. Let's assume that all of them are stationary (which is a strong assumption as a vocal tract and channel response are not changing) and the stationary part of speech is negligible. We can observe that for every i-th frame true is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y_i[q] = H[q] + X_i[q] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By taking the average over all frames we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{N}\sum_{i} Y_i[q] = H[q] + \dfrac{1}{N}\sum_{i} X_i[q]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Defining the difference:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{array}&#xA;&amp;amp;R_i[q] &amp;amp;= Y_i[q] - \dfrac{1}{N}\sum_{j} Y_j[q]\\&#xA;&amp;amp; = H[q] + X_i[q] - \left(H[q] +  \dfrac{1}{N}\sum_{j} X_j[q]\right) \\&#xA;&amp;amp; = X_i[q] - \dfrac{1}{N}\sum_{j} X_j[q]\\&#xA;\end{array}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We now removed channel effects from our signal. Putting all the above equations into simple English:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Calculate cepstrum&lt;/li&gt;&#xA;&lt;li&gt;Subtract the average from each coefficient&lt;/li&gt;&#xA;&lt;li&gt;Optionally divide by variance to perform Cepstral Mean Normalisation as opposed to Subtraction.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;Is Cepstral Mean Normalisation necessary?&lt;/h2&gt;&#xA;&lt;p&gt;It's not mandatory, especially when you are trying to recognise one speaker in a single environment. In fact, it can even deteriorate your results, as it's prone to errors due to additive noise:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = x[n] \star h[n] + w[n] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y[f] = X[f]\cdot H[f] + W[f] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\log Y[f] = \log \left[X[f]\left(H[f]+\dfrac{W[f]}{X[f]} \right) \right] = \log X[f] +\log \left(H[f]+\color{red}{\dfrac{W[f]}{X[f]}} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In poor SNR conditions marked term can overtake the estimation.&lt;/p&gt;&#xA;&lt;p&gt;Although when CMS is performed, you can usually gain a few extra percent. If you add to that performance gain from derivatives of coefficients then you get a real boost in your recognition rate. The final decision is up to you, especially since there are plenty of other methods used for the improvement of speech recognition systems.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2022-09-01T17:33:27.807" LastActivityDate="2022-09-01T17:33:27.807" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="19569" PostTypeId="2" ParentId="19562" CreationDate="2014-12-10T12:50:01.763" Score="1" Body="&lt;p&gt;The result looks right, though you've put &quot;1 impulse = ...&quot;, when it should be &quot;1 impulse/ms = ...&quot; in the 3rd equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you access to the equipment to check how fast the fluid actually flows and/or how many milliseconds there are between pulses from the sensor?&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2014-12-10T12:50:01.763" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19570" PostTypeId="2" ParentId="19539" CreationDate="2014-12-10T13:37:10.150" Score="1" Body="&lt;p&gt;Typically adaptive algorithms are used for this type of DSP application. There are a lot of algorithms you can try. All of them are in the family of &lt;em&gt;minimising algorithms&lt;/em&gt; / &lt;em&gt;numerical optimalization algorithms&lt;/em&gt; (LMS, RLS ...) You can use an adaptive filter in a specific structure, that you tune continously with the algorithm. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(k) + n_1(k) ──────────────────────────────┐&#xA;                                            │&#xA;                        ┌──────────┐        v&#xA;       n_2(k) ─────────&amp;gt;│ Adaptive ├───────&amp;gt;O───  e(k)&#xA;                        │  Filter  │      -&#xA;                        └──────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this way, you use two microphones. One for measuring the noise you want to cancel, and one for measuring your signal and the noise (this will be the the reference microphone).&#xA;If n_1(k) and n_2(k) correlates to each other, you can end up with e(k) ~ x(k)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The adaptive algorithm is just a plugin to the whole structure, and it will determine the properties of the adaptive behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is very good book about adaptive filtering: &lt;a href=&quot;http://www.springer.com/engineering/signals/book/978-1-4614-4105-2&quot; rel=&quot;nofollow&quot;&gt;http://www.springer.com/engineering/signals/book/978-1-4614-4105-2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find lot of articles about this application as well.&lt;/p&gt;&#xA;" OwnerUserId="11208" LastActivityDate="2014-12-10T13:37:10.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19571" PostTypeId="1" CreationDate="2014-12-10T14:07:58.987" Score="0" ViewCount="309" Body="&lt;p&gt;I have a 1st order lowpass IIR filter of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ H(z) = \frac{b_{0} +b_{1} z^{-1}}{1+a_{1} z^{-1}} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;implemented using the direct method my code looks something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;state2=state1;&#xA;state1=signal x-state2*a1;&#xA;output=b0*state1+b1*state2;    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;that has a cutoff frequency X that has been calculated from the fundamental frequency of signal x. Now given that the fundamental frequency of signal x changes and it takes me time &quot;t&quot; to detect this new frequency, is there any way I can reduce the transient response that I see from resetting the states to zero and changing the a and b coefficiets (by logging the states, old filter output or other data over time &quot;t&quot; and using this to calculate the new states rather than resetting them to 0)   ? Or would someone be able to provide me with a signpost as to what topics i should be googling?&lt;/p&gt;&#xA;" OwnerUserId="11020" LastActivityDate="2014-12-12T23:54:39.963" Title="Changing the cutoff of an IIR lowpass filter with minimal transients?" Tags="|infinite-impulse-response|adaptive-filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19574" PostTypeId="1" CreationDate="2014-12-10T18:20:41.953" Score="5" ViewCount="8820" Body="&lt;p&gt;Is it necessary to use filter bank in MFCC process? Can anyone explain what is the Mel filter? I know that frequency in hertz is converted into Mel scale but is this formula can be directly applied after the Fourier transformation of the speech signal? Why the filter bank is needed?&lt;/p&gt;&#xA;" OwnerUserId="12017" LastEditorUserId="8202" LastEditDate="2014-12-10T18:58:00.880" LastActivityDate="2014-12-10T18:58:00.880" Title="Mel filter in MFCC - is it necessary?" Tags="|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19575" PostTypeId="2" ParentId="19574" CreationDate="2014-12-10T18:41:33.483" Score="7" Body="&lt;p&gt;Mel filter bank is important due to following reasons:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It applies the Mel-frequency scaling, which is perceptual scale that helps to simulate the way human ear works. It corresponds to better resolution at low frequencies and less at high.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using the triangular filter-bank helps to capture the energy at each critical band and gives a rough approximation of the spectrum shape, as well as smooths the harmonic structure. In theory you could manipulate on raw DFT bins, but then you are not reducing the dimensionality of your features - this is the whole point of doing filter-bank analysis, &lt;strong&gt;to capture the spectral envelope&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Obviously warping of frequency scale can be altered. Other mappings are possible, such as Bark, linear, etc. Mel is just one out of many options. To finalize, you can always calculate more filter-banks to have coarser scale (getting closer to actual DFT), but you will notice that at some point it will degrade the performance and your features do not carry essential information.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-12-10T18:55:36.630" LastActivityDate="2014-12-10T18:55:36.630" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19576" PostTypeId="2" ParentId="1288" CreationDate="2014-12-10T19:55:13.560" Score="10" Body="&lt;p&gt;I would rather look into KAZE / AKAZE, which perform equally good with significant speed-up. The deformation cases are also tolerated. OpenCV has recently obtained an implementation through GSoC 2014. You can find it &lt;a href=&quot;http://www.robesafe.com/personal/pablo.alcantarilla/kaze.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Its OpenCV tutorial is also &lt;a href=&quot;http://docs.opencv.org/3.0-beta/doc/tutorials/features2d/akaze_matching/akaze_matching.html&quot; rel=&quot;nofollow&quot;&gt;present here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2016-08-29T09:37:12.130" LastActivityDate="2016-08-29T09:37:12.130" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19577" PostTypeId="1" CreationDate="2014-12-10T20:41:10.890" Score="0" ViewCount="892" Body="&lt;p&gt;I am having troubles applying the IFFT function to some data I have. I already had a look here &lt;a href=&quot;https://dsp.stackexchange.com/questions/282/complex-conjugate-and-ifft&quot;&gt;Complex conjugate and IFFT&lt;/a&gt; and here &lt;a href=&quot;https://dsp.stackexchange.com/questions/13899/what-assumptions-should-be-used-to-invert-spectrum-into-time-domain-data&quot;&gt;What assumptions should be used to invert spectrum into time domain data?&lt;/a&gt; but it still does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% amplitude: data related to the signal amplitude&#xA;% phase: data related to the signal phase&#xA;% freq: frequencies (from 5 to 100 Hz)&#xA;&#xA;response = complex(amplitude,phase);&#xA;&#xA;NFFT = length(response); % odd number&#xA;symmetric = zeros(NFFT,1); &#xA;&#xA;for i = 1:NFFT&#xA;symmetric(i) = conj(response(mod(NFFT-i+1,NFFT)+1));&#xA;end&#xA;&#xA;response_tot = [response; symmetric];&#xA;&#xA;% Plot simmetry&#xA;response_tot = fftshift(response_tot);&#xA;f_plot = 100*(-NFFT:(NFFT-1))/NFFT;&#xA;figure()&#xA;plot(f_plot,response_tot)&#xA;&#xA;% Time signal&#xA;time_sig = ifft(ifftshift(response_tot));&#xA;&#xA;fs = 2*max_f; % twice the max frequency in the signal&#xA;t_plot = 0:1/fs:NFFT/fs; % time vector to plot the time response&#xA;&#xA;figure()&#xA;plot(t_plot,time_sig(1:NFFT+1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the right way to prepare the data for the ifft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the output does not look right to me.&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2014-12-13T18:37:12.263" Title="Get data ready for IFFT" Tags="|matlab|time-frequency|ifft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19578" PostTypeId="1" AcceptedAnswerId="19579" CreationDate="2014-12-10T21:29:17.850" Score="2" ViewCount="135" Body="&lt;p&gt;What are the implications of: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If $x(t)$ is real and $x(-t) = x^*(t)$, then $X(-j\omega) = X^*(j\omega)$ and $X(j\omega)$ is real. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand it and I would like to research it further (what's the theorem that guarantees this?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to understand why it's important aside from the fact that it guarantees a symmetric Fourier transform or frequency response if we're talking about that of the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="11916" LastEditorUserId="4346" LastEditDate="2014-12-10T23:02:12.850" LastActivityDate="2014-12-10T23:06:33.300" Title="Implications of $X( -j\omega ) = X^*(j\omega)$" Tags="|fourier-transform|frequency-response|real-time|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19579" PostTypeId="2" ParentId="19578" CreationDate="2014-12-10T23:06:33.300" Score="3" Body="&lt;p&gt;The fact is that &lt;strong&gt;if&lt;/strong&gt; $x(t)$ is real and then $X(-j\omega) = X^*(j\omega)$ (it's easy to prove) and, because of duality, if $X(j\omega)$ is real, so also then $x(-t) = x^*(t)$.  in your case, you have both $x(t)$ and $X(j\omega)$ being real.  keep in mind that anything that is purely real is also equal to its complex conjugate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so you can say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;if $x(t)$ is real and even (that is $x(-t) = x(t)$) so also is $X(j\omega)$ real and even ($X(-j\omega) = X(j\omega)$).&quot;&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-12-10T23:06:33.300" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19580" PostTypeId="2" ParentId="19548" CreationDate="2014-12-11T02:31:05.537" Score="1" Body="&lt;p&gt;OK, doing a design of a Butterworth high pass filter with a cutoff frequency of 8Hz and a sampling frequency of 325Hz using &lt;code&gt;scilab&lt;/code&gt; by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; bw = iir(4,'hp','butt',[8/325 0.5],[0.1,0.1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then the filter is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                                  2  &#xA;0.8168388 - 3.2673552z + 4.9010328z   &#xA;               3            4         &#xA;   - 3.2673552z + 0.8168388z          &#xA;------------------------------------  &#xA;                                   2  &#xA;0.6672256 - 2.9384352z + 4.8677204z   &#xA;               3   4                  &#xA;   - 3.5960396z + z                   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the frequency response looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DoNPZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm not sure what you're doing for the design, but it doesn't appear to be high pass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing that may help is if you could share what your data looks like (say 256 or so points?).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2014-12-11T02:31:05.537" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19581" PostTypeId="2" ParentId="19561" CreationDate="2014-12-11T02:50:02.600" Score="0" Body="&lt;p&gt;$$x(t) = \cos4t +\sin8t+3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing that &#xA;$$\cos(\theta) = \frac{1}{2}[\exp(j\theta) + \exp(-j\theta)]$$&#xA; and that &#xA;$$\sin(\theta) =  \frac{1}{2j}[\exp(j\theta) - \exp(-j\theta)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can rewrite $x(t)$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \frac{1}{2}\exp(j4t) + \frac{1}{2}\exp(-j4t) + \frac{1}{2j}\exp(j8t) - \frac{1}{2j}\exp(-j8t) + 3$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The fundamental frequency is the greatest common factor between the components' (4 and 8), so 4&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The line spectrum (which plots frequency vs the magnitudes of the c coefficients) defines components for $c(0)$, $c(1)$ and $c(-1)$, $c(2)$ and $c(-2)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$c(0)$ is the magnitude of the DC component, which is 3&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;$c(1), c(-1)$ correspond to the coefficients multiplying the terms that are 1 times the fundamental frequency, so $\dfrac{1}{2}$&lt;/li&gt;&#xA;&lt;li&gt;$c(2), c(-2)$ correspond to the coefficients multiplying the terms that are 2 times the fundamental frequency, so $\dfrac{1}{2j}$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The signal is then equivalent to $c(k) = \dfrac{1}{T}$ (multiplied by the integral over a period of $x(t)\exp(-jkw_ot)dt$, and you'll have five terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="11916" LastEditorUserId="11916" LastEditDate="2014-12-11T14:08:41.930" LastActivityDate="2014-12-11T14:08:41.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19582" PostTypeId="2" ParentId="17453" CreationDate="2014-12-11T18:24:58.420" Score="1" Body="&lt;p&gt;Use the MATLAB &lt;code&gt;detrend()&lt;/code&gt; function to remove the mean or DC offset from the frequency domain point of view. If your signal is &lt;code&gt;X&lt;/code&gt;, then try executing the following in the MATLAB command window,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = detrend(X,'constant');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="7092" LastEditDate="2014-12-11T19:58:07.657" LastActivityDate="2014-12-11T19:58:07.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19584" PostTypeId="1" CreationDate="2014-12-11T20:08:55.840" Score="2" ViewCount="7138" Body="&lt;p&gt;I gotta wrap my head around to design CIC compensation filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm studying by referring these materials:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Altera, &quot;Understanding CIC compensation filters&lt;/li&gt;&#xA;&lt;li&gt;Hardware Efficient FIR Compensation Filter &#xA;For Delta Sigma Modulator Analog to Digital Converters.&#xA;Circuits and Systems, 2005. 48th Midwest Symposium on &#xA;Saiyu Ren ; Dept. of Electr. Eng., Wright State Univ., Dayton, OH ;    Siferd, R. ;    Blumgold, R. ;    Ewing, R. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;first Altera just say &quot;inverse sinc function&quot;&#xA;they wouldn't let me know how to realize the function except for using matlab function fir2 and how to get the coefficients of taps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so I found another reference (2) which I mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;they explain how to decide the coefficients of taps. but I couldn't figure out some equations.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;they say&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H(z)=a0*z^0+a1*z^-1 + ... + an*z^-n  =&amp;gt; H(f)=h(0)+2*sigma(from 1 to (n-1)/2) h(k)*cos(2k*pi*F) where F=f/fs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here is my first question. How is H(z) converted to H(f). If I substitute z to exp(i&lt;em&gt;w&lt;/em&gt;T) it doesn't make sense.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;second question I though a0=an=h(1). Is it correct? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;finally i used matlab to calculate the coefficients of taps and i got the same coefficients in comparision with a result of the paper, but a simulation gave me a totally different and wrong data&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h= [-0.70  2.09 -1.76  0.74 -1.26 0.40  0.34  0.26 0.74&#xA;    -0.53  0.24 -0.74  0.04 -0.39 0.05 -0.02  0.28 0.14&#xA;     0.41 -0.02  0.36 -0.02  0.41 0.14  0.28 -0.02 0.05 -&#xA;     0.38  0.04 -0.74  0.24 -0.53 0.74  0.26  0.34 0.40 -&#xA;     1.26  0.74 -1.76  2.09 -0.70] 41 taps&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;please let me know where I have to modify...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I violate The copyright issue (because of the content of paper) &#xA;please tell me and I will edit or delete this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my matlab code and plot&lt;img src=&quot;https://i.stack.imgur.com/zeSIf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc; clear;&#xA;OSR=8&#xA;fb=125e6/2&#xA;&#xA;fs=2*fb*OSR&#xA;f=[0 14 28 38 45.5 49.5 100 140 170 200 225 250 275  300 325 350 375 400 430 460 490]*10^6;&#xA;&#xA;F=f/fs;&#xA;N=41;&#xA;L=[1: 1 : (N-1)/2];&#xA;S=max(L)&#xA;&#xA;for i=1:S+1&#xA;   A(i,1)=1; &#xA;end&#xA;&#xA;for i=1:S+1&#xA;    for j=2:S+1&#xA;    A(i,j)=2*cos(2*pi*(j-1)*F(i));&#xA;    end&#xA;end&#xA;&#xA;H_sinc=((sin(OSR*pi.*F)./(OSR*sin(pi.*F)))).^2;   &#xA;&#xA;H_FIR=1./H_sinc;&#xA;&#xA;H_IFIR(1:6)=H_FIR(1:6);&#xA;&#xA;H_IFIR(1)=1;&#xA;&#xA;H_IFIR(7)=0.1;&#xA;&#xA;H_IFIR(8:21)=0;&#xA;&#xA;H_IFIR=H_IFIR';&#xA;&#xA;A_inv=inv(A);&#xA;&#xA;H=inv(A)*H_IFIR;&#xA;&#xA;H=H';&#xA;&#xA;for i=1:S+1&#xA;  H_sol(i)=H(S+2-i);&#xA;end&#xA;&#xA;for i=1:20&#xA;    H_sol(N-i+1)=H_sol(i);&#xA;end&#xA;f=[0:100:fs];&#xA;F=f/fs;&#xA;&#xA;H_fir1=H_sol(21)+2*H_sol(1)*cos(2*pi.*F) ...&#xA;           +2*H_sol(2)*cos(2*pi*2.*F) ...     &#xA;           +2*H_sol(3)*cos(2*pi*3.*F) ...     &#xA;           +2*H_sol(4)*cos(2*pi*4.*F) ...     &#xA;           +2*H_sol(5)*cos(2*pi*5.*F) ...     &#xA;           +2*H_sol(6)*cos(2*pi*6.*F) ...     &#xA;           +2*H_sol(7)*cos(2*pi*7.*F) ...     &#xA;           +2*H_sol(8)*cos(2*pi*8.*F) ...     &#xA;           +2*H_sol(9)*cos(2*pi*9.*F) ...     &#xA;           +2*H_sol(10)*cos(2*pi*10.*F) ...     &#xA;           +2*H_sol(11)*cos(2*pi*11.*F) ...     &#xA;           +2*H_sol(12)*cos(2*pi*12.*F) ...     &#xA;           +2*H_sol(13)*cos(2*pi*13.*F) ...     &#xA;           +2*H_sol(14)*cos(2*pi*14.*F) ...     &#xA;           +2*H_sol(15)*cos(2*pi*15.*F) ...     &#xA;           +2*H_sol(16)*cos(2*pi*16.*F) ...     &#xA;           +2*H_sol(17)*cos(2*pi*17.*F) ...     &#xA;           +2*H_sol(18)*cos(2*pi*18.*F) ...     &#xA;           +2*H_sol(19)*cos(2*pi*19.*F) ...     &#xA;           +2*H_sol(20)*cos(2*pi*20.*F);&#xA;&#xA;&#xA;figure(1), semilogx(f,db(H_fir1))&#xA;% hold on&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;please help me to solve this problem...&lt;/p&gt;&#xA;" OwnerUserId="11941" LastEditorUserId="1603" LastEditDate="2014-12-22T17:27:01.703" LastActivityDate="2016-06-18T12:16:15.497" Title="how to make CIC compensation filter" Tags="|filter-design|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19586" PostTypeId="2" ParentId="18150" CreationDate="2014-12-11T23:12:28.897" Score="0" Body="&lt;p&gt;Training neural nets relies on representing your image with appropriate features. If your labeling is binary (which you could enforce), I would recommend using invariant Fourier descriptors or Zernike moments, which could be made invariant to rotation or scale changes. Simply put, train your classifiers with these features and you will inherently recognize rotated text. Note however that, full rotation invariance is a strong assumptions and would cause you to lose discriminative power e.g. '3' vs 'E'.  &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-11T23:12:28.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19587" PostTypeId="2" ParentId="19523" CreationDate="2014-12-11T23:21:50.127" Score="0" Body="&lt;p&gt;I think, this will act like low pass filter with $\pi/2$ instead of $\pi/4$ cutoff frequency&lt;/p&gt;&#xA;" OwnerUserId="11753" LastEditorUserId="7092" LastEditDate="2014-12-12T02:42:38.160" LastActivityDate="2014-12-12T02:42:38.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19588" PostTypeId="2" ParentId="19523" CreationDate="2014-12-12T02:00:12.083" Score="0" Body="&lt;p&gt;do you go to concordia by any chance? this question looks waaaayyy to famaliar. :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I asked a similar question a while back, the answers provided there should help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/18737/up-sample-and-down-sample&quot;&gt;up sample and down sample&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11151" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-12-12T02:00:12.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19589" PostTypeId="1" AcceptedAnswerId="19604" CreationDate="2014-12-12T02:09:50.253" Score="2" ViewCount="3954" Body="&lt;p&gt;I am reading this paper about speech enhancement using a minimum mean square error short time spectral amplitude estimator for our speech enhancement project. Basically in the paper they mix a clean speech with noise and try to recover the clean speech.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper keeps mentioning &lt;em&gt;a priori&lt;/em&gt; SNR and &lt;em&gt;a posteriori&lt;/em&gt; SNR. I am confused by what does it mean. A priori SNR is the SNR from before the mixing? But that can't be right. If we knew the clean speech signal from the beginning this exercise would be pointless.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the paper if you are wondering:&#xA;Y. Ephraim and D. Malah, “Speech Enhancement Using a- Minimum Mean Square Error Short-Time&#xA;Spectral Amplitude Estimator”, IEEE Transactions on Acoustics, Speech, and Signal Processing, Vol. ASSP-32,&#xA;No. 6, Dec. 1984.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="11151" LastEditorUserId="4298" LastEditDate="2014-12-13T18:04:19.390" LastActivityDate="2014-12-15T18:35:12.763" Title="'A priori' and 'a posteriori' SNR" Tags="|noise|stft|speech-processing|voice|snr|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19591" PostTypeId="1" CreationDate="2014-12-12T05:32:01.760" Score="3" ViewCount="2778" Body="&lt;p&gt;In &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;overlap add method for convolution&lt;/a&gt; a filter $x$ of length $M$ will get convolved with a signal $y$ of length $N$ where $M &amp;lt;&amp;lt; N$, i.e., $z = x * y $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the signal $y$ is sliced into subparts each of length $M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I slice $y$ into subparts of size $P &amp;lt; M$ and then do the convolution by overlap add method. What should be the algorithm for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I have tried for overlap add method is given &lt;a href=&quot;http://pastebin.com/kTnb6H8h&quot; rel=&quot;nofollow&quot;&gt;here(in MATLAB)&lt;/a&gt;.&#xA;In the above code, in the for loop, I wish to have filterLength &amp;lt; 16.&#xA;How should I modify this code.&lt;/p&gt;&#xA;" OwnerUserId="4434" LastActivityDate="2014-12-12T11:20:01.077" Title="Implementing overlap add method for convolution with a slice of the filter" Tags="|matlab|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19592" PostTypeId="2" ParentId="19490" CreationDate="2014-12-12T11:05:03.627" Score="0" Body="&lt;p&gt;&lt;em&gt;So, how can I compute the frequency from which the signal is left unchanged (so no attenuation due to the filter)?&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;No - such a frequency does not exist because this would imply that you could realize something like a &quot;brickwall&quot; filter. Even far beyond the so-called end of the passband (this applies to a lowpass) the signal properties (magnitude and phase) are changed (theoretically!) with respect to the input signal. You only can specify an upper limit for the amount of these signal modifications changes (magnitude or phase). &lt;/p&gt;&#xA;" OwnerUserId="10631" LastEditorUserId="10631" LastEditDate="2014-12-12T13:39:53.323" LastActivityDate="2014-12-12T13:39:53.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19593" PostTypeId="2" ParentId="19591" CreationDate="2014-12-12T11:20:01.077" Score="4" Body="&lt;p&gt;What you are describe is typically called &quot;Partitioned Convolution&quot;.  The benefit is reduced latency at some cost to efficiency (unless the larger size FFT is considerably less efficient e.g. due to cache size).  This reduction in efficiency may be outweighed by the increased ability to use multiple cores for the parallel tasks.&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2014-12-12T11:20:01.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19595" PostTypeId="1" AcceptedAnswerId="19599" CreationDate="2014-12-12T17:10:57.963" Score="0" ViewCount="1281" Body="&lt;p&gt;I'm trying to match a picture saying &quot;this is ducks, this is towers&quot; by giving votes  from the hough transform of a picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found this article &lt;a href=&quot;http://ttic.uchicago.edu/~smaji/papers/hough-cvpr09.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ttic.uchicago.edu/~smaji/papers/hough-cvpr09.pdf&lt;/a&gt;, but I didn't find a implemented code (and I'm trying several things).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know anything similar to that, for example included on OpenCV?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10898" LastActivityDate="2014-12-12T22:34:13.833" Title="Shape recognition, hough transform" Tags="|opencv|hough-transform|shape-analysis|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19597" PostTypeId="1" AcceptedAnswerId="19598" CreationDate="2014-12-12T17:40:10.303" Score="0" ViewCount="153" Body="&lt;p&gt;Let's suppose I have an ADC running at 81.824MHz. I am quadrature subsampling a signal that is at 143.5MHz using a sampling rate of 81.824MHz/4 = 20.456MHz = Fs. I expect the signal to appear at baseband with a small offset of 143.5MHz-7*Fs = 308KHz. But it is showing up at 320KHz when I run the code below. Why is that?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Sampling frequency &#xA;fs = 20.456;&#xA;&#xA;% ADC frequency&#xA;fadc = 4*fs;&#xA;&#xA;% ADC period&#xA;T = 1/fadc;&#xA;&#xA;% Some ADC samples&#xA;n = 0:T:100;&#xA;&#xA;% Received frequency&#xA;f_l1 = 143.5;&#xA;s_l1 = cos(2*pi*f_l1*n);&#xA;&#xA;% Replica frequency for mixing.&#xA;f_local = 7*fs;&#xA;s_local = cos(2*pi*f_local*n);&#xA;&#xA;% Mixing&#xA;sif = s_l1 .* s_local;&#xA;&#xA;% Find frequency content&#xA;siffft = (fft(sif));&#xA;&#xA;% Plot results&#xA;nyquist = 1;&#xA;freq_steps = (1:length(siffft))/(length(siffft))*nyquist*fadc;&#xA;figure(3);&#xA;plot(freq_steps, abs(real(siffft))), &#xA;grid;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12047" LastActivityDate="2014-12-12T19:04:01.907" Title="Quadrature subsampling result not as expected" Tags="|downsampling|quadrature|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19598" PostTypeId="2" ParentId="19597" CreationDate="2014-12-12T19:04:01.907" Score="0" Body="&lt;p&gt;Your calculation is correct; &lt;code&gt;sif&lt;/code&gt; has a harmonic at 308 kHz. Given the way you have set up the problem, you can't get that exact value using the FFT because you don't have a frequency bin at that frequency. According to my calculations, the nearest bin is at 305 kHz, and I do see a peak at that frequency. Since there is no bin at the signal's frequency, the energy will leak: bins in the neighborhood of the peak will also get some of the energy of the 308 kHz signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Leakage is very hard to avoid. Assuming a fixed sampling frequency, you can calculate the number of samples you need to have a bin at exactly 308 kHz. However, it's very likely that you will then have a non-integer number of cycles of &lt;code&gt;sif&lt;/code&gt;, so you will have leakage again. This effect can be reduced by using windowing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many related questions in this website (for example, &lt;a href=&quot;https://dsp.stackexchange.com/questions/10120/why-does-spectral-leakage-arise-in-an-fft&quot;&gt;this one&lt;/a&gt;). Search for 'fft bin leakage' to find many more.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-12-12T19:04:01.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19599" PostTypeId="2" ParentId="19595" CreationDate="2014-12-12T22:34:13.833" Score="0" Body="&lt;p&gt;Hough forests for object recognition are initially proposed by Jurgen Gal. The paper was named &quot;Class Specific Hough Forests for Object Recognition&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://files.is.tue.mpg.de/jgall/projects/houghforest/houghforest.html&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is his homepage. &lt;a href=&quot;http://files.is.tue.mpg.de/jgall/projects/houghforest/houghforest.html&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; are the source code and the details. I think you could make use of those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Certainly better methods exist and one could well talk about them. However I am sticking to the Hough framework, as you mentioned that in the first place.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-12T22:34:13.833" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19600" PostTypeId="2" ParentId="19571" CreationDate="2014-12-12T23:36:03.160" Score="1" Body="&lt;p&gt;How about running two filters parallel with each other. Both filters get the same input signal but only one filter will output the filtered signal because there is a crossfader behind them which will pass only one of the filters output.&#xA;You can change the parameters of the currently offline filter, and fade the crossfader to it. Parameter changing without any transient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/euPdr.png&quot; alt=&quot;Transient free iir parameter changing&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11208" LastEditorUserId="11208" LastEditDate="2014-12-12T23:54:39.963" LastActivityDate="2014-12-12T23:54:39.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19601" PostTypeId="2" ParentId="11559" CreationDate="2014-12-13T05:28:16.480" Score="-3" Body="&lt;p&gt;Do not use the downsample function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used simple method in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x= [1 2 3;&#xA;    4 5 6;&#xA;    7 8 9;&#xA;    10 11 12];&#xA;&#xA;x1=x(:,1:2:end)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have a good time. ^^&lt;/p&gt;&#xA;" OwnerUserId="12049" LastEditorUserId="8202" LastEditDate="2014-12-13T10:41:16.230" LastActivityDate="2014-12-13T10:41:16.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19602" PostTypeId="1" CreationDate="2014-12-13T07:48:01.667" Score="1" ViewCount="1216" Body="&lt;p&gt;I get confuse with the basic theory of particle filter for tracking single object..&#xA;What I want to ask is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In some paper, they explained about velocity in state vector.. Are we &#xA;randomly put number to velocity or get it from some formula? &lt;/li&gt;&#xA;&lt;li&gt;In pdf by eiji ota, he desrcibe system model as &lt;code&gt;Xn=f(Xn-1)+Wn&lt;/code&gt; where &lt;code&gt;Wn&lt;/code&gt; is noise.. Why need noise in particle filter?&lt;/li&gt;&#xA;&lt;li&gt;And can you give me simple explanation in prediction step how the particles predict at t=1? I'm still blank in there..&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12035" LastActivityDate="2014-12-14T03:01:34.950" Title="Need help to understanding concept of particle filter" Tags="|particle-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19604" PostTypeId="2" ParentId="19589" CreationDate="2014-12-13T16:02:01.020" Score="3" Body="&lt;p&gt;The &lt;em&gt;a priori&lt;/em&gt; SNR is the ratio of the power of the clean signal and of the noise power. The &lt;em&gt;a posteriori&lt;/em&gt; SNR is the ratio of the squared magnitude of the observed noisy signal and the noise power. Both SNRs are computed for each frequency bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the only signal we have is the observed noisy signal. The noise power as well as the power of the clean signal must be estimated. The noise power can be estimated during absence of the desired signal, but in practice it can be difficult to detect the presence or absence of the desired signal, at least when the SNR is bad. There are so-called noise tracking algorithms that estimate the noise power without relying on detecting the presence or absence of the desired signal. They are based on the assumption that the desired signal is &quot;more non-stationary&quot; than the noise. The power of the desired clean signal can be estimated using a decision-directed approach, as described in Ephraim and Malah's paper. In that approach, the estimated clean amplitude, i.e. the output or 'decision' of the algorithm, and the a posteriori SNR are used to estimate the a priori SNR.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-13T16:02:01.020" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19605" PostTypeId="1" CreationDate="2014-12-13T18:33:07.707" Score="1" ViewCount="1385" Body="&lt;p&gt;I saw a code in Python in the scipy.org (&lt;a href=&quot;http://docs.scipy.org/doc/scipy-dev/reference/tutorial/fftpack.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.scipy.org/doc/scipy-dev/reference/tutorial/fftpack.html&lt;/a&gt;) and found this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/lFxlJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First question: Is it right that T = 1/800 &amp;lt;==&gt; fs = 800 Hz fulfill the condition fs = 2*fmax, because the maximum frequency of the funtion contains 80 Hz?&lt;br&gt;&#xA;Second question is in the row: &lt;code&gt;xf = np.linspace(0.0,1.0/(2.0*T), N/2)&lt;/code&gt;:&lt;br&gt;&#xA;I have often seen that people use the nyquist freqency in the x-axis for the the freqencies spectrum why is that so?&lt;br&gt;&#xA;And if I ignore the &lt;code&gt;(1/2 * 1/T)&lt;/code&gt; and &lt;code&gt;N/2&lt;/code&gt; and write in my code &lt;code&gt;for&#xA;xf = np.linspace(0.0, 1.0/T, N)&lt;/code&gt;   instead of &lt;code&gt;np.linspace(0.0, 1.0/(2.0*T), N/2)&lt;/code&gt; so I get a graph like this&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6pf0T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do I get here a mirroring at the 400 Hz? Does it something to do with the symmetries of the fft?&lt;br&gt;&#xA;I appreiate it if someone can help me to explain my question, thx alot!&lt;/p&gt;&#xA;" OwnerUserId="12053" LastEditorUserId="8140" LastEditDate="2014-12-13T19:47:09.137" LastActivityDate="2014-12-13T21:17:23.650" Title="The Nyquist-Theorm behind the fft" Tags="|fft|python|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19606" PostTypeId="2" ParentId="19577" CreationDate="2014-12-13T18:37:12.263" Score="1" Body="&lt;p&gt;The first component of the FFT is the DC component. The other &lt;code&gt;NFFT-1&lt;/code&gt; should be symmetric.&lt;br&gt;&#xA;If &lt;code&gt;NFFT&lt;/code&gt; is even, that means that &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;response(NFFT/2-k)=conj(response(NFFT/2+k))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for $k=1,\ldots,NFFT/2-1$ and response(NFFT/2) is arbitrary.&lt;br&gt;&#xA;If &lt;code&gt;NFFT&lt;/code&gt; is odd then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;response((NFFT+1)/2-k)=conj(response((NFFT+1)/2+k+1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for $k=0,\ldots,(NFFT-1)/2-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, MATLAB allows you to ignore all that by using the &lt;code&gt;'symmetric'&lt;/code&gt; argument of ifft:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;response_tot = [response; zeros(NFFT-1,1)]; % assuming NFFT is odd&#xA;time_sig = ifft(response_tot,'symmetric');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2014-12-13T18:37:12.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19609" PostTypeId="1" CreationDate="2014-12-13T20:53:56.713" Score="3" ViewCount="3352" Body="&lt;p&gt;Is there any way how to compute convolution matrix for Nearest Neighbor (bicubic, bilinear) image scaling (upscale/downscale)?&lt;/p&gt;&#xA;" OwnerUserId="12056" LastEditorUserId="7092" LastEditDate="2014-12-13T23:41:15.827" LastActivityDate="2014-12-15T07:23:14.657" Title="convolution matrix for image scaling" Tags="|image-processing|convolution|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19610" PostTypeId="2" ParentId="19605" CreationDate="2014-12-13T21:17:23.650" Score="2" Body="&lt;p&gt;&lt;em&gt;&quot;Why do I get here a mirroring at the 400 Hz? Does it something to do with the symmetries of the fft?&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;yes.  the FFT is a &quot;fast&quot; method of computing the DFT.  the latter half of the DFT corresponds to what we normally call &quot;negative frequencies&quot; and, for a real signal, the spectrum in the negative frequencies are a complex-conjugate mirror image of the positive frequencies.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-12-13T21:17:23.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19611" PostTypeId="1" AcceptedAnswerId="19653" CreationDate="2014-12-13T22:22:44.753" Score="3" ViewCount="2409" Body="&lt;p&gt;What are some of the reasons why DC offset is considered undesirable for a timeseries signal other than wastage of power during transmission ? Specifically, How does it cause spectral leakage and out of band emissions ? &lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2014-12-17T03:44:41.393" Title="Effects of DC offset on a signal" Tags="|discrete-signals|signal-analysis|continuous-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19612" PostTypeId="1" CreationDate="2014-12-13T22:34:01.910" Score="0" ViewCount="214" Body="&lt;p&gt;I'm trying to filter out line noise(60Hz and 120Hz) from a EEG signals received over a bluetooth link. I'm proposing to use a IIR notch filter to filter out the line-noise which varies w.r.t to distance between the bluetooth transmitter and receiver. I'm not able to establish a clear relationship between the Notch filter parameters and the magnitude of line noise so as to avoid over-attenuation or under-attenuation to avoid dips and peaks at these frequencies in the spectrum. The problem is Q-factor and stop-band Bandwidth which define the notch filter don't directly relate to the stop band attenuation. If this is not possible is there any other equally efficient adaptive stop-band filtering method to achieve the same ? How can this be implemented w.r.t line noise measurement and corresponding filter parameter adjustments ?     &lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2014-12-13T22:34:01.910" Title="Adaptive Line noise removal using IIR notch filters" Tags="|discrete-signals|infinite-impulse-response|filtering|denoising|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19613" PostTypeId="2" ParentId="15600" CreationDate="2014-12-13T22:53:13.747" Score="1" Body="&lt;p&gt;One way is to synchronize Event related potentials(ERP) generator with your EEG measurement device. Alpha(8-13 Hz) potentials can be generated when the test subject closes the eyes and is in a relaxed state. Another ways is to flash black and white patterns at predetermined intervals. Literature can be easily found where many such techniques and related ERPs are documented. An ICA component which has ERP epochs at predetermined instants of time is relatively easier to distinguished from other ICA components than a EEG component without ERPs. Once this is done, it will be easier to isolate, study, characterize and remove non-EEG artifacts.    &lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2014-12-13T22:53:13.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19614" PostTypeId="2" ParentId="19602" CreationDate="2014-12-14T03:01:34.950" Score="1" Body="&lt;p&gt;The following papers are good resources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Gordon, N. J.; Salmond, D. J. and Smith, A. F. M. (1993). &quot;Novel approach to nonlinear/non-Gaussian Bayesian state estimation&quot;. IEE Proceedings F on Radar and Signal Processing 140 (2): 107–113. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Arulampalam, M.S.; Maskell, S.; Gordon, N.; Clapp, T.; (2002). &quot;A tutorial on particle filters for online nonlinear/non-Gaussian Bayesian tracking&quot;. IEEE Transactions on Signal Processing 50 (2): 174–188. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Doucet, A.; Johansen, A.M.; (December 2008). &quot;A tutorial on particle filtering and smoothing: fifteen years later&quot;. Technical report (Department of Statistics, University of British Columbia). (Available &lt;a href=&quot;http://www.cs.ubc.ca/~arnaud/doucet_johansen_tutorialPF.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'd recommend you read at least the first one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A particle filter works on a model specified by 2 equations (a hidden Markov model):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The state equation&#xA;$x_{k+1} = f_k (x_k,w_k)$ which tells you how the state (minimal set of variables to describe a system) evolves as being driven by noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The measurement equation $y_k = h_k (x_k, v_k)$ which maps the state to what you observe. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the observations $y_0, \ldots, y_n$, estimate the distribution of $x_n$ is the problem the particle filter tries to solve. Once you have the approximated distribution of $x_n$ (which is the distribution of the particles), you can estimate $x_n$ (say, by averaging the particles). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The particle filter essentially starts with a bunch of samples (called particles), evolves the state by running each particle through the state equation and re-samples the particles based on the observation you see in order to make the distribution of particles consistent with the observations. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2014-12-14T03:01:34.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19615" PostTypeId="1" AcceptedAnswerId="19621" CreationDate="2014-12-14T04:25:11.793" Score="12" ViewCount="24027" Body="&lt;p&gt;I am getting I/Q data from a software-defined radio.  I want to do some stuff on signals in the data, but only if it exceeds a certain range.  What is the general procedure to get dB (dBm, or anything) from this kind of data?  Programs such as SDR# do it, but I don't know what exactly they do so that I can imitate them.&lt;/p&gt;&#xA;" OwnerUserId="10591" LastEditorUserId="4655" LastEditDate="2014-12-14T20:05:53.137" LastActivityDate="2019-07-22T14:05:54.790" Title="Converting raw I/Q to dB" Tags="|fourier-transform|amplitude|dbfs|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="19617" PostTypeId="1" AcceptedAnswerId="19620" CreationDate="2014-12-14T17:51:57.073" Score="0" ViewCount="413" Body="&lt;p&gt;I have an application that fills a buffer from my computer's microphone and does an FFT. My objective is to figure out what frequencies are in the sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tested the application by whistling as well as by playing &lt;a href=&quot;https://www.youtube.com/watch?v=3yQcXlvccCI&quot; rel=&quot;nofollow noreferrer&quot;&gt;this video&lt;/a&gt; from my cellphone into my computer's mic (I've tried two different mics to be sure). What I expect (taking the absolute frequency) is a smooth Gaussian-like curve with a mean at the frequency of the incoming tone, but what I'm getting is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P12eO.png&quot; alt=&quot;Jagged Frequency Spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the cause for the jaggedness of the signal's frequency spectrum? And what technique can be used to reliably identify the main frequencies present in the signal while filtering out the unwanted bumps?&lt;/p&gt;&#xA;" OwnerUserId="12063" LastEditorUserId="12063" LastEditDate="2014-12-16T00:26:46.493" LastActivityDate="2014-12-16T00:26:46.493" Title="Why does FFT generate a jaggedy signal" Tags="|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19619" PostTypeId="1" AcceptedAnswerId="19640" CreationDate="2014-12-14T18:33:08.200" Score="1" ViewCount="90" Body="&lt;p&gt;My electricity meter has a front panel LED which pulses in proportional to the current energy rate. The frequency changes but the pulse width is set at 250ms.  Due to environmental conditions there's plenty of noise. Currently I'm sampling this at 10kHz, the pulses may be a few seconds apart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to filter these pulses and ignore anything else that wasn't 250ms long (ie the noise) and find the frequency of the train. Are there any suitable methods to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought was to differentiate the signal but this would be easily confused by large noise spikes.&#xA;I also wondered about testing it's coherence with a simulated pulse train, but as the frequency changes this would be potentially infinitely intensive AFAIK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I was to build an electronic solution I'd use edge comparators to find the pulses.  I'm wanting to use NumPy/matplotlib and deal with the signal in the frequency domain, if possible (purely as an educational exercise).&lt;/p&gt;&#xA;" OwnerUserId="12061" LastActivityDate="2014-12-15T21:21:50.227" Title="Frequency of a noisy signal with fixed width pulses" Tags="|filters|noise|frequency|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19620" PostTypeId="2" ParentId="19617" CreationDate="2014-12-14T18:42:53.770" Score="6" Body="&lt;p&gt;What you are seeing is a peak from sinusoid convolved with a spectrum of rectangular window &lt;a href=&quot;http://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;sinc function&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;. That is due to property:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)\star w(t) = X(f)\cdot W(f) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where your signal $x(t)$ is a sinusoid with a spectrum being a Kronecker (Dirac) Delta function, $w(t)$ is a rectangular window function. In DFT by default we are using rectangular window (taking a time snippet of a signal). Please check out this paper for more info: &lt;a href=&quot;http://www.sandv.com/downloads/0603gabe.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;A Comprehensive Window Tutorial&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-12-15T09:02:54.133" LastActivityDate="2014-12-15T09:02:54.133" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="19621" PostTypeId="2" ParentId="19615" CreationDate="2014-12-14T19:27:05.183" Score="22" Body="&lt;h3&gt;Basics&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;amplitude&lt;/strong&gt; of an IQ signal is just the vector magnitude, $\sqrt{I^2 + Q^2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;power&lt;/strong&gt; of an IQ signal is the squared magnitude, $I^2 + Q^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you see a logarithmic (dB) meter, it is usually measuring the log of the power, i.e. $10 \log_{10}(I^2 + Q^2)$. (This can also be calculated as $20 \log_{10}$ of the amplitude, but unless you already have the amplitude that wastes a square root operation.)&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Units&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Remember, dB is a relative figure. If you just take $10 \log_{10}(I^2 + Q^2)$, then 0 dB corresponds to an amplitude of exactly 1. If your hardware driver takes the usual floating-point convention of the absolute extreme sample values being from &amp;minus;1 to +1, then you can say that your dB power values are &lt;strong&gt;dBFS&lt;/strong&gt; — &lt;em&gt;decibels relative to full scale&lt;/em&gt;. Any signals stronger than that level will be &lt;em&gt;clipped&lt;/em&gt;, distorting the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;dBm&lt;/strong&gt;, decibels relative to one milliwatt of power, just uses a different reference level. You can convert to dBm just by adding or subtracting the proper calibration value from the dBFS value — but you need to know that calibration for your hardware at the frequency of interest, such as by measuring it (using a signal source of known power output); it is impossible to perform that calibration purely in software since the digital samples are just numbers with no inherent units.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(A mistake I've seen is to refer to the sample values, or parameters which scale according to them such as an amplitude threshold, as being in “volts”; this is complete nonsense unless your ADC (and other hardware) is actually calibrated to one volt. This is unreasonably large for a radio receiver.)&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Practical application&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you are just looking to ignore signals that aren't sufficiently strong (this is known as &lt;em&gt;carrier squelch&lt;/em&gt; or &lt;em&gt;power squelch&lt;/em&gt;), it doesn't matter what units you use, or even if they're logarithmic or linear, because you're just doing a greater-than comparison. The only critical component is that you start with $I^2 + Q^2$ (as opposed to, say, $I + Q$, which would be just plain wrong).&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Note on bandwidth you probably don't need to read&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;It may also be relevant to note that if you filter a signal, you are by definition removing some of the signal power, so the measurement will be smaller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, a FFT (such as is the primary visual display in tools like SDR#) can loosely be thought of as a large collection of extremely sharp filters; each output “bin” collects some fraction of the input power. Accordingly, the power in each bin depends on the width of the bin. If you divide by the &lt;em&gt;width of the bin&lt;/em&gt; in hertz (that value being $\text{sample rate}/\text{FFT length}$) before taking the logarithm, then instead of dB power, you measure dB &lt;em&gt;power spectral density&lt;/em&gt;, which has the advantage of being independent of the FFT bin width &lt;em&gt;if&lt;/em&gt; the features you care about are wider than one bin (e.g. a wideband modulated signal); if they are narrower (e.g. pure tones) then the power value is more useful.&lt;/p&gt;&#xA;" OwnerUserId="4655" LastEditorUserId="4655" LastEditDate="2014-12-14T19:32:28.107" LastActivityDate="2014-12-14T19:32:28.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19622" PostTypeId="2" ParentId="10595" CreationDate="2014-12-14T22:31:55.227" Score="1" Body="&lt;p&gt;AFAIK this is so called &quot;naive filtering approach&quot;. You can influence spectral content at certain points in frequency space, but you don't do anything useful for frequency content between those points. If you design proper FIR filter, you actually take into account also points in between those principal points and such filter is much better then the first one..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Bul.&lt;/p&gt;&#xA;" OwnerUserId="12065" LastActivityDate="2014-12-14T22:31:55.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19623" PostTypeId="1" CreationDate="2014-12-15T02:06:43.917" Score="0" ViewCount="327" Body="&lt;p&gt;I have an audio sample. From doing FFT on it it looks as if I need to use a comb filter to remove resonant frequencies. This is what I generate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/91Tms.png&quot; alt=&quot;FFT Image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I honestly have no clue where to start unfortunately.&lt;/p&gt;&#xA;" OwnerUserId="12070" LastActivityDate="2014-12-15T02:06:43.917" Title="Choosing the frequency for a comb filter" Tags="|matlab|fft|filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19624" PostTypeId="1" AcceptedAnswerId="19641" CreationDate="2014-12-15T02:36:33.643" Score="0" ViewCount="176" Body="&lt;p&gt;I am reading a recent paper titled &quot;Phase Estimation of Speech Enhancement - unimportant, important, or impossible?&quot; by Grekmann et al. published in the 2012 the IEEE convention. The paper proposes an algorithm for estimating the phase of the noisy speech. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/RkNP2.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;can anyone help me please on understanding what is meant by &quot;angular frequency of the harmonic component dominant in band k&quot; ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="11753" LastActivityDate="2014-12-16T19:01:21.397" Title="Phase Estimation in speech enhancement" Tags="|phase|estimation|speech-processing|speech|estimators|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19625" PostTypeId="1" AcceptedAnswerId="19630" CreationDate="2014-12-15T02:46:03.217" Score="3" ViewCount="7727" Body="&lt;p&gt;I'd like to implement freuqency sampling method for linear phase FIR filter design using IDFT transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My procedure goes like this :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;determine desired magnitude response value in frequency points&lt;/li&gt;&#xA;&lt;li&gt;I add linear phase response function with group delay (N-1)/2 to get complex frequency response values and equidistant points in frequency&lt;/li&gt;&#xA;&lt;li&gt;use IDFT to calculate system's impulse response.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This approach works for odd-length FIR filter but I have problems with even-length FIR filters - I just don't  get proper result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess I'm doing something wrong maybe with phase function or something else - but what ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&#xA;regards,&#xA;Bul.&lt;/p&gt;&#xA;" OwnerUserId="12065" LastEditorUserId="80" LastEditDate="2014-12-15T22:04:33.373" LastActivityDate="2022-08-01T22:47:59.467" Title="FIR filter design with frequency sampling method - setting proper phase response for IDFT" Tags="|filter-design|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19626" PostTypeId="1" AcceptedAnswerId="19692" CreationDate="2014-12-15T03:19:55.003" Score="1" ViewCount="1195" Body="&lt;p&gt;I am trying to shift an image on a subpixel level, with the method described here: &#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/18401-efficient-subpixel-image-registration-by-cross-correlation/content/html/efficient_subpixel_registration.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/18401-efficient-subpixel-image-registration-by-cross-correlation/content/html/efficient_subpixel_registration.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results are however disappointing. Since I am actually programming this algorithm for the rotation of images, where I resample inbetween pixels, this problem keeps on bugging me: &lt;a href=&quot;http://spin.ecn.purdue.edu/fmri/PDFLibrary/TongR_MRM_1999_41_253_256.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://spin.ecn.purdue.edu/fmri/PDFLibrary/TongR_MRM_1999_41_253_256.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody tell me how these strange artifacts can be resolved? According to multiple scientific articles I found, it should be possible to resample on other grids with satisfactory results. My minimal code example (in python) is below, along with the resulting images, which are not satisfactory at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does someone know what causes this effect, and how it can be resolved to reproduce the results others have?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7EpXi.png&quot; alt=&quot;The original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wrm7v.png&quot; alt=&quot;The result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;import matplotlib.image as mpimg&#xA;&#xA;N = 2048&#xA;&#xA;img=mpimg.imread('koe.png') #http://www.clipartbest.com/cliparts/RiA/yXL/RiAyXLriL.png&#xA;&#xA;f = np.zeros((N,N))&#xA;f[:img.shape[0],:img.shape[1]] = img[:,:,3]&#xA;&#xA;def fft(x):&#xA;    return np.fft.fft2(x)&#xA;&#xA;def ifft(x):&#xA;    return np.fft.ifft2(x)&#xA;&#xA;exp = np.exp&#xA;pi = np.pi&#xA;j = 1j&#xA;&#xA;def s(r):&#xA;    plt.figure()&#xA;    #plt.imshow(np.real(r), vmin=0.0, vmax=1.0, interpolation='none')&#xA;    plt.imshow(np.absolute(r), interpolation='none', vmin=0.0, vmax=1.0)&#xA;    plt.colorbar()&#xA;&#xA;x = np.tile(np.arange(N),(N,1)).T&#xA;y = x.T&#xA;result = ifft( fft(f)* np.exp(1j*2*np.pi*(-0.5*x/N-0.5*y/N)) )&#xA;s(result)&#xA;s(f)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12071" LastActivityDate="2014-12-19T12:24:55.153" Title="Sub pixel shift causes weird results" Tags="|fft|image-processing|python|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19627" PostTypeId="2" ParentId="19609" CreationDate="2014-12-15T05:46:32.103" Score="2" Body="&lt;p&gt;This can't be done as a convolution because some of the operations you mentioned are not linear. Additionally, convolution by definition (multiplication by a toplitz matrix) shouldn't ever change the input and output size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For bicubic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Bicubic_interpolation#Bicubic_convolution_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Bicubic_interpolation#Bicubic_convolution_algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kSluE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the high order terms.&lt;/p&gt;&#xA;" OwnerUserId="941" LastEditorUserId="941" LastEditDate="2014-12-15T05:53:00.037" LastActivityDate="2014-12-15T05:53:00.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19628" PostTypeId="2" ParentId="19609" CreationDate="2014-12-15T07:23:14.657" Score="2" Body="&lt;p&gt;As others have mentioned, convolution operation cannot change the size of the image. &lt;em&gt;However&lt;/em&gt;, interpolation is a convolution operation. You just need to upsample by zero padding the image before performing the convolution (filtering) operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say you want to interpolate a 1D signal times 2. The original signal is given by $a_0, a_1, .. , a_n$. You first zero pad it to get $a_0, 0, a_1, 0, ..$, then you filter the result. If the filter taps are &lt;code&gt;0.5, 1, 0.5&lt;/code&gt;, you will get simple linear interpolation. Similar scheme can be used in 2D images for biliniear interpolation, spline interpolation, etc.&lt;/p&gt;&#xA;" OwnerUserId="1082" LastActivityDate="2014-12-15T07:23:14.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19629" PostTypeId="1" CreationDate="2014-12-15T08:37:22.753" Score="1" ViewCount="2767" Body="&lt;p&gt;Using the matrix equations found on Wikipedia I wrote some Python code to compute the Savitsky-Golay coefficients for $m$ data-points, using a polynomial of degree $k$. Here it is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from numpy import *&#xA;from numpy.linalg import *&#xA;&#xA;k = 4       # Degree of polynomial to use for regression&#xA;m = 25      # Window size, that is, the number of points. Must be an odd number. &#xA;&#xA;z = range(-(m-1)/2, (m-1)/2+1)  # z is the distance from the central point. &#xA;&#xA;jacobian, b = [], []&#xA;for i in z:&#xA;  for j in range(k+1):&#xA;    b.append(i**j)&#xA;  jacobian.append(b)&#xA;  b=[]&#xA;&#xA;J = matrix(jacobian)&#xA;&#xA;C = (J.T*J).I*J.T&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do realize that this code is in no way optimized and it could've been done in a much cleaner way, however I'm not a (professional) programmer nor a mathematician and would be really happy if I could get it to work at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that the coefficients computed become rather small, using the parameters above ($k=4$, $m=25$) on the order of $\pm 10^{-6}$. If I &quot;go one step back&quot; and multiply with the determinant I get really huge numbers ($\pm 10^{22}$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried finding the greatest common divisor of these but got the result 2048 which leaves me with huge numbers (and it can't be right, result of numerical errors due to small/huge numbers or something?). I would like to have the coefficients in the form they're usually found in tables, with a normalization constant for each derivative, and an integer coefficient for each data point. Since I'm interested in the point of maximum curvature in a data series I want to calculate its 3rd derivative, I've been unable to find a table with these coefficients. &lt;/p&gt;&#xA;" OwnerUserId="12072" LastEditorDisplayName="user11906" LastEditDate="2015-11-28T22:26:25.840" LastActivityDate="2015-11-28T22:26:25.840" Title="Calculating Savitsky-Golay filter coefficients - normalization" Tags="|filter-design|lowpass-filter|python|smoothing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19630" PostTypeId="2" ParentId="19625" CreationDate="2014-12-15T09:08:00.903" Score="4" Body="&lt;p&gt;Your procedure is of course correct. It is in the details where things usually go wrong. One important thing is how to extend the desired frequency response beyond Nyquist taking the required symmetry into account. In order for the filter coefficients to be real-valued, the desired frequency response must satisfy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D[k]=D^*[N-k],\quad k=0,1,\ldots,N-1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $*$ denotes complex conjugation, and $N$ is the FFT length (= filter length). From (1) it follows that for even $N$, the elements of the complex desired frequency response are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D_0,D_1,\ldots,D_{N/2},D^*_{N/2-1},\ldots,D^*_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For odd $N$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D_0,D_1,\ldots,D_{(N-1)/2},D^*_{(N-1)/2},\ldots,D^*_1$$&#xA;Note that in order for (1) to be satisfied, $D_0$ and, for even $N$, $D_{N/2}$ must be real-valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This little Matlab/Octave code works for even and odd filter lengths.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;% frequency sampling design of linear phase FIR filter&#xA;&#xA;N = 64;                         % FFT length = filter length&#xA;np = floor(N/2) + 1;            % number of independent frequency points&#xA;n = 0:np-1;&#xA;w = n*2*pi/N;                   % frequency vector&#xA;M = sin(n*pi/(np-1));           % some desired magnitude response&#xA;D = M.*exp(-1i*(N-1)/2*w);      % desired complex frequency response (linear phase)&#xA;D = [D,conj(D(N-np+1:-1:2))];   % append redundant points for IFFT&#xA;h = ifft(D);                    % compute impulse response&#xA;max(abs(imag(h)))               % should be very close to 0&#xA;h = real(h);                    % remove numerical inaccuracies&#xA;&#xA;% check result&#xA;[H,w2] = freqz(h,1,4*N);&#xA;plot(w/2/pi,abs(D(1:np)),'.',w2/2/pi,abs(H))&#xA;&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2014-12-15T22:02:27.513" LastActivityDate="2014-12-15T22:02:27.513" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19631" PostTypeId="1" AcceptedAnswerId="19632" CreationDate="2014-12-15T12:08:42.807" Score="3" ViewCount="149" Body="&lt;p&gt;I have a filter.&#xA;It has two poles and two zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the state space equations and the matrices A, B, C, and D&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now. I have 9 samples that I need to process with my filter.&#xA;How do I use A,B,C,D matrices to process the samples?&lt;/p&gt;&#xA;" OwnerUserId="11988" LastActivityDate="2014-12-15T16:52:31.517" Title="How to find the output signal of a filter using state space matrices?" Tags="|state-space|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19632" PostTypeId="2" ParentId="19631" CreationDate="2014-12-15T13:03:33.790" Score="2" Body="&lt;p&gt;We don't know anything about your system, but general rule is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}&#xA;&amp;amp;y[n] &amp;amp;= \mathbf{C}x[n] + \mathbf{D}u[n]\\&#xA;x[n+1] &amp;amp;=\mathbf{A}x[n] + \mathbf{B}u[n] \\&#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $u[n]$ is the input signal value, $x[n]$ is state vector value at a given point in time, and $y[n]$ is obviously the output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do is to: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Initialize the initial state $x[0]$ to some arbitrary value (usually vector of zeros).&lt;/li&gt;&#xA;&lt;li&gt;Run the calculation by consequently calculating values of $y[n]$ and $x[n+1]$ to be used in the next step. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Speaking Matlab'ish (not tested, cause I am in travel, but given all informations its extremely easy to figure out what is going on):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = [0 2 3];&#xA;a = [1 0.4 1];&#xA;[A,B,C,D] = tf2ss(b,a);&#xA;&#xA;x_0 = zeros(size(A,1), 1); % Initial state&#xA;N = 9;&#xA;u = randn(1, N); % Some input signal&#xA;y = zeros(N, 1); % Output signal&#xA;&#xA;x = u_0;&#xA;for n=1:N-1&#xA;  y(n) = C*x + D*u(n); % System output&#xA;  x = A*x + B*u(n);    % Transition&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2014-12-15T15:26:51.990" LastActivityDate="2014-12-15T15:26:51.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19634" PostTypeId="2" ParentId="19631" CreationDate="2014-12-15T16:52:31.517" Score="0" Body="&lt;p&gt;i dont understand exactly what is your requirment.But you can find Tranfer funtion &#xA;(and hence freq responce by putting 's=jw')of the filter.Here is the method,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;dx/dt=Ax+Bu;     (x is a state variable,y is output, and u is input)&#xA;Y  =Cx+Du&lt;/p&gt;&#xA;&#xA;&lt;p&gt;applying Laplace Tranform on both sides&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sX(s)=AX(s)+BU(s);&#xA;Y(s) =CX(s)+DU(s);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sX(s)-AX(s)=BU(s);&#xA;X(s){SI-A}=BU(s);   (I is unit matrix)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X(s)=([SI-A]^-1)BU(s);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X(s) = V(s)BU(s)      V(s)=[SI-A]^-1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y(s)=CV(s)BU(s)+DU(s) ;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y(s)/X(s) =CV(s)B+D;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is Tranfer Function in 's' domain.&lt;/p&gt;&#xA;" OwnerUserId="11809" LastActivityDate="2014-12-15T16:52:31.517" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19636" PostTypeId="2" ParentId="19589" CreationDate="2014-12-15T18:35:12.763" Score="0" Body="&lt;p&gt;@Matt L. I'm also using this same paper by Y. Ephraim and D. Malah and the decision directed approach mentioned in the paper. But there is this formula eq no 53 which uses recursion to find priori SNR but i am having hard time implementing the code. &lt;img src=&quot;https://i.stack.imgur.com/tso5V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me how to code it? If i initialize the snr using Gain as 1 for n=0, then how will i get value of Priori SNR for n=1? &#xA;I've been told to use value of Priori SNR at n=0 to find Gain at n=1? But isn't it mathematically incorrect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="12083" LastActivityDate="2014-12-15T18:35:12.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19638" PostTypeId="1" CreationDate="2014-12-15T20:35:37.640" Score="7" ViewCount="390" Body="&lt;p&gt;I am trying to do an image analysis problem on some images, and I want to calculate some things in the frequency domain which are giving me problems. Say I have an (discrete) image $I(x,y)$ of size $N_x\times N_y$ (in practice this size is about $150\times40$ pixels). I want to calculate &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$DFT\left[\frac{\partial I}{\partial x}\cdot\frac{\partial I}{\partial y}\cdot\frac{\partial^2 I}{\partial x \partial y}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and express this in terms of the DFT of $I$, which is an $N_x\times N_y$ matrix with entries $\hat{I}_{k,\ell}$. The product is to be interpreted pointwise. I discretize the derivatives with central differences, e.g. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial I}{\partial x} = \frac{I(x+1,y) - I(x-1,y)}{2\Delta x}$$&#xA;and so I can compute the DFT of various derivatives using the shift properties of DFT. I'm doing this in the frequency domain because other parts of my problem involve 4th derivatives which I think will be way too sensitive to compute in real-space, and I hope the frequency-space calculations will be more stable/robust. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've attempted to calculate a slightly simpler case, involving only one derivative. My attempted solution is to use the convolution duality properties of the DFT and express multiplication in real space as convolution in frequency space. My attempted expression is below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$DFT\left[\left(\frac{\partial I}{\partial x}\right)^2\right]_{k,\ell} = DFT\left[\frac{\partial I}{\partial x}\right]*DFT\left[\frac{\partial I}{\partial x}\right] = \frac{-1}{N_x(\Delta x)^2}\times\sum_{m=0}^{N_x-1}\sin\left(\frac{2\pi m}{N_y}\right)\sin\left(\frac{2\pi (k-m)}{N_y}\right)\hat{I}_{m,\ell}\hat{I}_{(k-m),\ell}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not sure if I'm properly generalizing circular convolution to more than one dimension, and even if I am, I don't know how to interpret the convolution property with a mix of derivatives (e.g. $DFT[\frac{\partial I}{\partial x}\frac{\partial I}{\partial y}]$). What am I summing to, $N_x-1$ or $N_y-1$? I suspect I might have something wrong in generalizing circular convolution from 1 to 2 dimensions. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In general, how should I interpret circular convolution in 2D? And how&#xA;  can that shed light on calculating this particular DFT?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="12086" LastEditorUserId="128" LastEditDate="2019-06-24T08:54:15.733" LastActivityDate="2022-03-10T14:03:35.390" Title="Analytical Expression for Convolution of Two 2D DFTs" Tags="|image-processing|dft|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19639" PostTypeId="2" ParentId="12692" CreationDate="2014-12-15T20:40:31.917" Score="0" Body="&lt;p&gt;They are not the same. HSV histogram would involve computing the frequencies in a 3D cube where the volume is (depending on the implementation) &lt;code&gt;360x255x255&lt;/code&gt;. Due to the memory requirements, this is often not preferred (~90MB) (This might seem pretty small nowadays, but traversing this histogram is very inefficient because one cannot benefit from random accesses over CPU cache. In other words, accessing elements of the histogram - even to fill the entire volume causes tons of cache misses). In brief, I don't recommend computing this at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, HS histogram is a simple 2D joint histogram with only &lt;code&gt;255x255&lt;/code&gt; values. It can be cached and used even in real-time applications safely.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-15T20:40:31.917" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19640" PostTypeId="2" ParentId="19619" CreationDate="2014-12-15T21:21:50.227" Score="2" Body="&lt;p&gt;Not an easy problem to solve...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could always cross-correlate the signal with a replica square wave and then apply simple thresholding to find the pulse locations. Then just count the peaks in a given interval to determine frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the square wave nature of the signal could make the signal quite difficult to deal with in the frequency domain because of all the &lt;a href=&quot;http://en.wikipedia.org/wiki/Square_wave#mediaviewer/File:Spectrum_square_oscillation.jpg&quot; rel=&quot;nofollow&quot;&gt;harmonics&lt;/a&gt; that comprise it. &lt;/p&gt;&#xA;" OwnerUserId="12066" LastActivityDate="2014-12-15T21:21:50.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19641" PostTypeId="2" ParentId="19624" CreationDate="2014-12-15T22:46:58.750" Score="0" Body="&lt;p&gt;According to their model given by Eq. (2), voiced speech is assumed to consist of a weighted sum of sinusoids with frequencies that are multiples of the fundamental frequency. They assume that in each frequency band $k$ there is one dominant harmonic with normalized angular frequency $\Omega_h^k$, which is the harmonic that is closest to the frequency corresponding to the $k^{th}$ frequency bin of the FFT. The frequency of this harmonic is used to estimate the current phase in band $k$ from the previous phase value in that band according to Eq. (3).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-15T22:46:58.750" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19642" PostTypeId="1" AcceptedAnswerId="19643" CreationDate="2014-12-15T23:57:53.537" Score="2" ViewCount="3809" Body="&lt;p&gt;In the process of creating a baseband signal, the complex symbols are filtered using a raised cosine filter to perform pulse shaping (I'm following some literature as a guide). The pulse shaping is performed with the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Create the filter&#xA;over=16;&#xA;pulse=rcosine(1,over,'normal',0.35);&#xA;[trash, pos]=max(pulse);&#xA;&#xA;%Oversample the symbols&#xA;sig=kron(sym,[1 zeros(1,over-1)]);&#xA;sig=filter(pulse,1,sig);&#xA;sig=sig(pos:end);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the sampling frequency of the filter is 16, which requires 15 zeros be added between all of the symbols. What is the purpose of this? How does this not introduce &quot;extra data&quot; into the original message?&lt;/p&gt;&#xA;" OwnerUserId="12087" LastActivityDate="2014-12-16T02:05:15.750" Title="Why oversample data before using raised cosine filter?" Tags="|matlab|filters|qpsk|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19643" PostTypeId="2" ParentId="19642" CreationDate="2014-12-16T02:05:15.750" Score="3" Body="&lt;p&gt;In digital communications, you can transmit a sequence of numbers using a train of pulses that don't interfere with each other. A given raised cosine pulse $p(t)$ has zero crossings every $T$ seconds around its peak (for a certain $T$). Let's say you want to transmit the number sequence $\lbrace 3, -5 \rbrace$. You can do this with the 2-pulse train $$s(t)=3p(t)-5p(t-T).$$ If you sample $s(t)$ at $t=0$ and $t=T$, you'll get the values 3 and -5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question is related to implementing this idea in Matlab. To do this, you have to solve two different problems: how to create the pulse $p(t)$, and then how to create the train pulse $s(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start with the pulse $p(t)$. Since you specify &lt;code&gt;Fd=1&lt;/code&gt;, then the number of samples in the pulse between the peak and its zero-crossings is given by &lt;code&gt;over&lt;/code&gt;. In your case, you can see that the peak occurs at sample 49 and the first zero crossing at sample 65, or 16 samples apart, which is the value of variable &lt;code&gt;over&lt;/code&gt;. So, you have defined a pulse $p(t)$ with $T$ equal to 16 sample intervals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to generate the pulse train $s(t)$, you start with the sequence &lt;code&gt;sym&lt;/code&gt;. Then you insert 15 zeros between the elements of &lt;code&gt;sym&lt;/code&gt;, and finally calculate the convolution of the spaced sequence and the pulse. The result of the convolution will be the addition of pulses $p(t-T)$, scaled with the values of &lt;code&gt;sym&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us return to the example of transmitting the sequence $\lbrace 3, -5 \rbrace$. You start with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sym = [3 -5];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from which you generate &lt;code&gt;sig&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sig = [3 0 ... 0 -5 0 ... 0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The convolution of &lt;code&gt;sig&lt;/code&gt; and &lt;code&gt;pulse&lt;/code&gt; is the addition of &lt;code&gt;3*pulse&lt;/code&gt; starting at sample 1, and &lt;code&gt;-5*pulse&lt;/code&gt; starting at sample 16. The first pulse has a peak equal to 3 at sample number 49, and the second pulse has a peak equal to -5 at sample number 65. The pulses interfere with each other at most sample times but, &lt;em&gt;crucially&lt;/em&gt;, the second pulse is zero at sample 50, and the first is zero at sample 66. So, at those precise times, they don't interfere with each other. By sampling the convolution at those times, the receiver can recover the transmitted sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this simple code in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p=rcosine(1,16,'normal',0.35);&#xA;s=[3,-5];&#xA;sig=kron(s,[1 zeros(1,15)]);&#xA;ss=filter(sig,1,x);&#xA;plot(ss);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using the data cursor, you can verify what I said above. You can also print those values with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ss(49) ss(65)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-12-16T02:05:15.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19645" PostTypeId="1" AcceptedAnswerId="19647" CreationDate="2014-12-16T11:01:34.867" Score="2" ViewCount="1003" Body="&lt;p&gt;I have a N point sequence x. Let X be the fft(x). (Assume x is arbitrary)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=[x1 x2 x3 x4 x5 x6 x7 x8] &#xA;&#xA;fft(x)=[X1 X2 X3 X4 X5 X6 X7 X8]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I get the result of a 8 point DFT by doing cascading 4 point DFT and 2 point DFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I reshape the signal 'x' (of dimensions '1 x 8') to 'x1' (of dimensions '2 x 4')&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x1=[x1 x2 x3 x4;&#xA;   x5 x6 x7 x8]&#xA;&#xA;fft(x1 (first row)) i.e. fft(x1 x2 x3 x4) say =  [Y1 Y2 Y3 Y4]&#xA;fft(x1 (second row)) i.e. fft(x4 x5 x6 x7)  say = [Y5 Y6 Y7 Y8]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then again taking fft column wise&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fft(Y1 Y5)  say = [Z1 Z2]&#xA;fft(Y2 Y6)  say = [Z3 Z4]&#xA;fft(Y3 Y7)  say = [Z5 Z6]&#xA;fft(Y4 Y8)  say = [Z7 Z8]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this Z will not be equal to X. How do I proceed to get X by doing these smaller point FFTs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be great! Thanks&lt;/p&gt;&#xA;" OwnerUserId="8672" LastActivityDate="2015-03-07T19:16:02.007" Title="Can I take piecewise FFT of a larger input sample?" Tags="|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19646" PostTypeId="1" AcceptedAnswerId="43975" CreationDate="2014-12-16T12:00:40.927" Score="3" ViewCount="2419" Body="&lt;p&gt;I need to clarify this and rather confused by this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$x = h * g$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$x$ - measured data&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$h$ - raw data&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$g$ - instrument response function (convolution kernel)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So lets say I have $x$ and $h$. Can I say if I were to deconvolve $x$ with $h$ I will be able to obtain $g$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if I have $x$ and $g$, deconvolving $x$ with $g$, I will be able to obtain $h$. So till here, is my understanding correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can I say $g$ is both convolution and deconvolution kernel? Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="11402" LastEditorUserId="128" LastEditDate="2018-05-26T11:50:33.390" LastActivityDate="2022-03-08T09:55:08.167" Title="Are Convolution and Deconvolution Kernels the Same?" Tags="|convolution|deconvolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="19647" PostTypeId="2" ParentId="19645" CreationDate="2014-12-16T13:59:28.247" Score="3" Body="&lt;p&gt;You need the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cooley-Tukey algorithm&lt;/a&gt;, which can be used to express the DFT of size $N=N_1N_2$ by DFTs of sizes $N_1$ and $N_2$. It works a bit like what you sketched in your question, but you forgot the twiddle factors. &lt;a href=&quot;https://dsp.stackexchange.com/questions/18201/recursive-version-of-dft-as-presented-in-cooley-tukey-paper/18798#18798&quot;&gt;This answer&lt;/a&gt; explains the details of the algorithm and it also includes a simple Matlab implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT (see comments): If you really want to compute the FFTs of blocks of consecutive data you need to split the computation of even and odd frequency indices (assuming the DFT length $N$ is even):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[2k]=\sum_{n=0}^{N/2-1}\left(x[n]+x[n+N/2]\right)W_{N/2}^{nk}\\&#xA;X[2k+1]=\sum_{n=0}^{N/2-1}\left(x[n]-x[n+N/2]\right)W_N^nW_{N/2}^{nk}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $W_N=e^{-j2\pi/N}$. Note that you can of course compute the DFTs of the length $N/2$ sub-blocks separately instead of adding (or subtracting) the blocks before the DFT (as in (1)), but this is computationally less efficient.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-03-07T19:16:02.007" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="19649" PostTypeId="1" CreationDate="2014-12-16T18:56:56.573" Score="0" ViewCount="146" Body="&lt;p&gt;I am trying to evaluate my processed speech for my DSP project. My project is an implementation of an MMSE algorithm proposed by Y.Ephraim and D. Malah, &quot;Speech Enhancement Using a Minimum Mean Square Error Short-Time Spectral Amplitude Estimator,&quot; in the IEEE Transactions on Acoustics, Speech, and Signal Processing, Vol. ASSP-32, No. 6, Dec. 1984.&#xA;As per project requirements, I ran PESQ, LLR, and segment SNR. I got numbers, but I am not sure what they mean. Is high number is good or bad? Also, what does it mean if I get a negative number? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help and thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="11753" LastActivityDate="2020-04-25T14:07:30.677" Title="Pesq numbers and clean speech comparison to processed speech" Tags="|speech-processing|stft|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19651" PostTypeId="2" ParentId="13402" CreationDate="2014-12-16T20:54:58.293" Score="1" Body="&lt;p&gt;This is because polynomial root finding algorithms are terrible without any implication that people code it wrongly or else. It is an ill-posed problem whereas eigenvalue computations and hence generalized eigenvalue problem solutions are much more stable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any mistake in any of the pole/zero data permeates to all entries of the polynomial entries and contaminates them which in turn causes big numerical inaccuracies in the polynomial root finding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus, MIMO system representations in both are simply asking for trouble since common terms are very difficult to retain and after a few manipulations you can easily create dummy roots -which could have been considered to be numerical noise- becoming actual modes of the representations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, canonical representations suffer from the same problem in state space. You can test it via creating 2 identical A matrices and perturb the entries of the row/col that holds the entries. Then create a balanced realization of the same system and perturb the A matrix entry of that representation and you'll see that the difference is usually very big.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your comment you mention the nonuniqueness of the SS representation and it is true. But the dynamics are identical, hence they form an equivalence class up to transformations with nonzero transformation matrix $T$. That's actually a feature not a bug. &lt;/p&gt;&#xA;" OwnerUserId="10705" LastActivityDate="2014-12-16T20:54:58.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19652" PostTypeId="2" ParentId="10831" CreationDate="2014-12-16T21:06:45.070" Score="3" Body="&lt;p&gt;Short answer: Yes but no. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a system matrix is rectangular then it means either; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There are more number of states than the number of their derivatives which is not meaningful. If you have a system such as a jump linear system or something that couples to the initial system and extends the state space, you can still work with interconnections of square systems that are switched on/off (say, event-based) without resorting back to this esoteric method&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There are more differential equations than the number of states which imply that some of those states can be considered as exogenous inputs which in turn can be reconciled by taking those terms to your B matrix and leaving A matrix square again. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So in short, with square state matrix you don't have any loss of generality. &lt;/p&gt;&#xA;" OwnerUserId="10705" LastActivityDate="2014-12-16T21:06:45.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19653" PostTypeId="2" ParentId="19611" CreationDate="2014-12-16T22:25:07.047" Score="2" Body="&lt;p&gt;In a mathematical sense it doesn't but (almost) any nonlinear interaction, say modulation or demodulation, will cause additional signals, leakage/out of band, signals.&#xA;The point is that when you do the evaluation you must include the modulator or demodulator; as well as things like transformers which will be biased off center and thus generate &lt;em&gt;extra&lt;/em&gt; distortion.  It's the non-linearities in the overall signall path that induce extra signals.  By definition of the Fourier/Laplace transform superposition and linearity properties a linear system will not generate extra signals.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2014-12-16T22:25:07.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19654" PostTypeId="2" ParentId="19611" CreationDate="2014-12-17T03:44:41.393" Score="1" Body="&lt;p&gt;A signal with a DC-offset does not have a zero-mean. In audio &amp;amp; statistical signal-processing for example, many analysis and effect-processing algorithms make assumptions that the signal is zero-mean. A DC-offset-remover is a common pre-processing step, to ensure the correctness of algorithms further along in an effect chain.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2014-12-17T03:44:41.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19655" PostTypeId="1" CreationDate="2014-12-17T03:48:28.497" Score="0" ViewCount="278" Body="&lt;p&gt;I have two groups of 3 frequencies of tone (music),&#xA;First Group&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Tones: 39 (77.7817 Hz), 40 (82.4069 Hz) and 41 (87.3070 Hz).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Second Group&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Tones: 83 (987.7666 Hz), 84 (1046.5022 Hz) and 85 (1108.7305 Hz).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These groups work independently (the frequencies aren't mixed between them)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ToneB: Tone Back  39 or 83&#xA;ToneH: Tone Half  40 or 84&#xA;ToneF: Tone Fore  41 or 85&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ToneB &amp;lt; ToneM &amp;lt; ToneF&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made two WAV files combining these 3 frequencies (one for the first group, and one for the second group).&#xA;I want to filter them:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Low Pass (Allowing ToneB, Denying ToneB and ToneF)&#xA;High Pass (Allowing ToneF, Denying ToneB and ToneB)&#xA;Band Pass (Allowing ToneB, Denying ToneB and ToneF)&#xA;Band Stop (Denying ToneB, Allowing ToneB and ToneF)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Tones are separates by Math.Pow(2,1/12) // or 2^(1/12)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ToneF = ToneH*Math.Pow(2,1/12)&#xA;ToneB = ToneH*Math.Pow(2,-1/12)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I decided that the Cut Frequencies are established by Math.Pow(2,1/24)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First Group&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Then CutFreq between Tone39 and Tone40 is 80.060925 Hz&#xA;Then CutFreq between Tone40 and Tone41 is 84.821595 Hz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Second Group&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Then CutFreq between Tone83 and Tone84 is 1016.710373 Hz&#xA;Then CutFreq between Tone84 and Tone85 is 1077.167118 Hz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If N is Order (or lenght) of Hdn(): Impulse Response &#xA;But making subtraction, the N Between (ToneB and ToneH) would be different to the N Between (ToneH and ToneF).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                   |------------- dDelta ------------|                &#xA;                   |                                 |                &#xA; Fa                |               Fc                |               Fb&#xA;  |----------------|----------------|----------------|----------------|&#xA;&#xA;  |                |                |                |                |&#xA;  0               1/48             1/24             3/48             1/12&#xA;  |                |                |                |                |&#xA;-1/12            -3/48            -1/24            -1/48              0 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fc = Fa*Math.Pow(2,1/24)    or    Fc = Fb*Math.Pow(2,-1/24)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now to calculate N, I will use Hamming Windows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int SampleRate = 32000;&#xA;double dHammingFact = (double)3.3*SampleRate;&#xA;double dDeltaFore = Math.pow(2.0, 3.0/48.0) - Math.pow(2.0, 1.0/48.0);&#xA;double dDeltaBack = Math.pow(2.0, -1.0/48.0) - Math.pow(2.0,-3.0/48.0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;dDelta can be dDeltaFore or dDeltaBack&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simulating this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = RoundUpEven(dHammingFact/(Fc*dDelta))  //Rounding to Ceil Even number&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First Group&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FcLP = ToneB(39)*Math.Pow(2,1/24)   //Low Pass&#xA;FcHP = ToneB(41)*Math.Pow(2,-1/24)  //High Pass&#xA;FcBPb = ToneB(39)*Math.Pow(2,1/24)   //Band Pass Back&#xA;FcBPf = ToneB(41)*Math.Pow(2,-1/24)  //Band Pass Fore&#xA;FcBSf = ToneB(39)*Math.Pow(2,1/24)   //Band Stop Back&#xA;FcBSf = ToneB(41)*Math.Pow(2,-1/24)  //Band Stop Fore&#xA;&#xA;N(Tone39 and Tone40) = 45669&#xA;N(Tone40 and Tone41) = 43107&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Second Group&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FcLP = ToneB(83)*Math.Pow(2,1/24)   //Low Pass&#xA;FcHP = ToneB(85)*Math.Pow(2,-1/24)  //High Pass&#xA;FcBPb = ToneB(83)*Math.Pow(2,1/24)   //Band Pass Back&#xA;FcBPf = ToneB(85)*Math.Pow(2,-1/24)  //Band Pass Fore&#xA;FcBSf = ToneB(83)*Math.Pow(2,1/24)   //Band Stop Back&#xA;FcBSf = ToneB(85)*Math.Pow(2,-1/24)  //Band Stop Fore&#xA;&#xA;N(Tone83 and Tone84) = 3597&#xA;N(Tone84 and Tone85) = 3395&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, highest N will be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my filters works fine for Low Pass Filter, High Pass Filter (First and Second Groups)&#xA;But, checking with Pass Band and Stop Band (First and Second Groups) fails...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's go to see the result of FIRST Group:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;spectrum wav file with only the three frequencies of the First group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cDw2D.png&quot; alt=&quot;spectrum wav file with only the three frequencies of the First group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LowPass Filter first group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/lwW20.png&quot; alt=&quot;LowPass Filter first group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HighPass Filter first group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YgSZf.png&quot; alt=&quot;HighPass Filter first group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BandPass Filter first group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MXf6e.png&quot; alt=&quot;BandPass Filter first group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BandStop Filter first group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Xa88J.png&quot; alt=&quot;BandStop Filter first group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's go to see the result of SECOND Group:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;spectrum wav file with only the three frequencies of the Second group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ULkCu.png&quot; alt=&quot;spectrum wav file with only the three frequencies of the Second group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LowPass Filter second group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yHj20.png&quot; alt=&quot;LowPass Filter second group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HighPass Filter second group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DnNTJ.png&quot; alt=&quot;HighPass Filter second group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BandPass Filter second group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iY9uE.png&quot; alt=&quot;BandPass Filter second group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BandStop Filter second group&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VC5PN.png&quot; alt=&quot;BandStop Filter second group&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How Can I to solve this?&#xA;Are very &lt;strong&gt;narrow&lt;/strong&gt; my bands in relation with SamplingFrequency?&lt;/p&gt;&#xA;" OwnerUserId="12094" LastEditorUserId="12094" LastEditDate="2014-12-17T17:47:35.940" LastActivityDate="2014-12-17T17:47:35.940" Title="BandPass and StopBand FIR filters (Hamming) is not working" Tags="|filters|window-functions|bandpass|finite-impulse-response|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19656" PostTypeId="2" ParentId="16253" CreationDate="2014-12-17T04:04:44.357" Score="0" Body="&lt;p&gt;I think, if you have a&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Xn[n] = {X0.x0, X1.x1,..,Xn.xn} //X0 Integer part, x0 fractional&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you have a &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Hn[m] = {H0.h0, H1.h1,..,Hm.hm}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Yn[i] = Hi.hi*Xi.xi + Hi+1.hi+1*Xi-1.xi-1 + .. +Hi+m.hi+m*Xi-m.xi-m&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when you begins multiplyng you don't have before to X0.x0, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Yn[0] = H0.h0*X0.x0 + H1.h1*X-1.x-1&#xA;&#xA;X-1.x-1 = 0.0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Yn[0] = H0.h0*X0.x0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If m is very long the first m's values of Yn[i] will be lower too...&lt;/p&gt;&#xA;" OwnerUserId="12094" LastActivityDate="2014-12-17T04:04:44.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19658" PostTypeId="1" CreationDate="2014-12-17T07:07:54.670" Score="3" ViewCount="951" Body="&lt;p&gt;This isn't my field, so please forgive any misnomers on my part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking into buying a amateur radio receiver, and I'm thinking about what sampling rate I need. I'm most interested in satellite signals, which transmit on ~400MHz (for example). So that would imply I have a nyquist frequency of ~800MHz, or 800 million samples per second. This seems much higher than any hardware I can find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current thinking is that the frequency to be used in the nyquist calculation isn't the carrier frequency. Which frequency should I use?&lt;/p&gt;&#xA;" OwnerUserId="12097" LastActivityDate="2014-12-17T18:24:21.023" Title="When calculating the Nyquist frequency should carrier frequency be included" Tags="|nyquist|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19659" PostTypeId="2" ParentId="19658" CreationDate="2014-12-17T08:12:57.937" Score="0" Body="&lt;p&gt;If you want a realizable anti-alias filter (with a finite non-zero transition band), if you want to analyze your data in any finite amount of time, if the signal is modulated in any manner, then the sample rate needs to be some amount higher than twice your signal frequency in order capture information about your signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(or some amount lower for bandpass undersampling...)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-12-17T08:12:57.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19660" PostTypeId="1" CreationDate="2014-12-17T11:03:55.163" Score="4" ViewCount="4461" Body="&lt;p&gt;I'm trying to design a lowpass IIR filter with 5Hz cutoff frequency (sample frequency is 200Hz). i know how to create it with fdatool, or with functions such as 'butter' or 'ellip'. However, i think that all the filters created are causal. Is it possible to create also noncausal filters? Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="12099" LastEditorUserId="4298" LastEditDate="2020-11-08T17:06:39.473" LastActivityDate="2020-11-08T17:06:39.473" Title="Is it possible to design noncausal filters in Matlab?" Tags="|matlab|filters|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19662" PostTypeId="2" ParentId="19660" CreationDate="2014-12-17T12:19:29.283" Score="5" Body="&lt;p&gt;The short answer is: yes, of course it's possible to design non-causal filters. Consider a simple first order IIR filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=ay[n-1]+bx[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If implemented in the way as indicated in Eq. (1), this filter is causal. It is also stable if $|a|&amp;lt;1$. Now rewrite (1) as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n-1]=\frac{1}{a}y[n]-\frac{b}{a}x[n]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implemented in this way, you compute $y[n-1]$ from the future samples $y[n]$ and $x[n]$, so the system is anti-causal. Note that it is stable if $|a|&amp;gt;1$. Similar considerations apply to higher-order filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way of realizing non-causal IIR filters is implemented in Matlab's &lt;code&gt;filtfilt&lt;/code&gt; function. How this works is described in &lt;a href=&quot;https://dsp.stackexchange.com/questions/9467/what-is-the-advantage-of-matlabs-filtfilt/9468#9468&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Non-causal FIR filters can always be implemented by appropriate buffering of the input signal and delaying the output signal.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2014-12-17T12:19:29.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19663" PostTypeId="1" CreationDate="2014-12-17T12:30:00.497" Score="0" ViewCount="2035" Body="&lt;p&gt;I am using OpenCv's built in template matching function to search for an object in  image. I am using Normalized Cross Correlation Method.The function is returning a value which I think indication of similarity so the larger value the more similar template.The problem is NCC value when object is matched is 0.93 whereas NCC value when different regions are found is 0.91 .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the value returned by NCC percentage of similarity ? If so how can different templates produce high score ?&lt;/p&gt;&#xA;" OwnerUserId="12059" LastActivityDate="2014-12-17T12:30:00.497" Title="Why Normalized Cross Correlation Score of different templates is high?" Tags="|image-processing|opencv|cross-correlation|template-matching|" AnswerCount="0" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19664" PostTypeId="1" CreationDate="2014-12-17T13:03:14.513" Score="0" ViewCount="115" Body="&lt;p&gt;I want to speed up convergence of geometric series&#xA;$\ \  lim + c^n \ \ $ where $|c| &amp;lt; 1$ and $lim$ is not known.&lt;br&gt;&#xA;A basic low-pass filter, here Butterworth, is good for $-1 &amp;lt; c &amp;lt; 0$ but not $0 &amp;lt; c &amp;lt; 1$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;butter  N 2  Wn 0.5:  [.293 .586 .293] / [1 0 .172]&#xA;|response|: [100 100  99  97  88  71  47  25  10   3   0]&#xA;(-.8) ^ n  [100 -80  64 -51  41 -33  26 -21  17 -13]  -&amp;gt;  [29 35 -4 -7  1  1  0  0  0  0]&#xA;.8 ^ n     [100  80  64  51  41  33  26  21  17  13]  -&amp;gt;  [29 82 90 62 45 38 31 25 20 16]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there a filter that does both ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why: many iterative processes that generate points $X_n$ in 1d, 3d, 100d&#xA;converge to an $X_{lim}$ slowly,&lt;br&gt;&#xA;but roughly geometrically:&#xA;either one-sided like $.8^n$, or oscillating like $(-.8)^n$ .&lt;br&gt;&#xA;It would be nice to have a simple, robust filter that speeds up both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Shanks_transformation&quot; rel=&quot;nofollow&quot;&gt;Shanks transformation&lt;/a&gt;&#xA;is a nonlinear transform that works really well on geometric series.&lt;br&gt;&#xA;But on linear input 1 2 3 it'll divide by 0.&#xA;(Check for that, push on regardless ? practical, but unsatisfying.)&#xA;(I believe that &#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Aitken%27s_delta-squared_process&quot; rel=&quot;nofollow&quot;&gt;Aitken's delta-squared process&lt;/a&gt;&#xA;is the same as Shanks -- not sure.)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastActivityDate="2015-12-12T22:52:39.373" Title="Filter to speed up convergence of geometric series" Tags="|filter-design|adaptive-filters|non-linear|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19665" PostTypeId="1" AcceptedAnswerId="19669" CreationDate="2014-12-17T13:33:33.037" Score="1" ViewCount="172" Body="&lt;p&gt;This is my first post in this forum! So Point me if anything is not clear!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know how TOF camera works? So I've done Google &amp;amp; read &lt;a href=&quot;http://www.ti.com/ww/en/analog/3dtof/index.shtml?DCMP=analog_signalchain_mr&amp;amp;HQS=3dtof&quot; rel=&quot;nofollow&quot;&gt;some nice explanation&lt;/a&gt; about How Phase difference between Transmitted &amp;amp; Received signals can be used to calculate the Depth of an Object from Camera with good example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What i did understand:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Depth Can be measured by Calculating the Phase change of the Transmitted signal.&lt;/li&gt;&#xA;&lt;li&gt;How a light source(IR) can be modulated &amp;amp; demodulated ? &lt;a href=&quot;https://learn.sparkfun.com/tutorials/ir-communication&quot; rel=&quot;nofollow&quot;&gt;Answer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;How to filter the reflected IR signal having the same modulation frequency? &lt;a href=&quot;https://learn.sparkfun.com/tutorials/ir-communication&quot; rel=&quot;nofollow&quot;&gt;Answer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What i cannot understand:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How phase change of a continuous square wave signal can be used to Measure the depth? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Update: Here is a &lt;a href=&quot;http://www.sengpielaudio.com/calculator-timedelayphase.htm&quot; rel=&quot;nofollow&quot;&gt;Nice Explanation about this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I'm talking about &lt;a href=&quot;http://www.ti.com/ww/en/analog/3dtof/index.shtml?DCMP=analog_signalchain_mr&amp;amp;HQS=3dtof&quot; rel=&quot;nofollow&quot;&gt;TI&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://www.mesa-imaging.ch/home/&quot; rel=&quot;nofollow&quot;&gt;Mesa&lt;/a&gt; Kind of TOF Camera's using IR Led&lt;/p&gt;&#xA;" OwnerUserId="5912" LastEditorUserId="5912" LastEditDate="2014-12-18T14:00:18.250" LastActivityDate="2014-12-18T14:00:18.250" Title="How does 3D Time-of-Flight (TOF) camera work?" Tags="|image-processing|signal-detection|camera|image-registration|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19667" PostTypeId="2" ParentId="19664" CreationDate="2014-12-17T16:00:52.427" Score="1" Body="&lt;p&gt;The problem is that in the case with positive $c$ you have a DC desired signal ($lim$) and a low frequency noise ($c^n$). In the case when $c$ is negative you have a high frequency noise signal, which is of course much easier to separate from the desired DC value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you figure out some way to estimate $c$ (sign and magnitude) you can use a simple FIR filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;b=[1,-c]/(1-c); a=1;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which will exactly eliminate the exponentially decaying noise:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac{1}{1-c}(x[n]-cx[n-1])=\frac{1}{1-c}(lim+c^n-c\cdot lim - c\cdot c^{n-1})=lim$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-17T16:00:52.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19668" PostTypeId="2" ParentId="19658" CreationDate="2014-12-17T18:24:21.023" Score="3" Body="&lt;p&gt;You are correct: a 400 MHz signal needs to be sampled at least at 800 Msamples/s, and that is either impossible or extremely expensive. However, this is not the entire story:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Under some conditions, you can do bandpass sampling, where the sampling frequency is lower than Nyquist. See more at &lt;a href=&quot;https://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Undersampling&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can do analog bandpass filtering and down-conversion to some intermediate frequency (IF), which can then be sampled at reasonable cost/complexity. See &lt;a href=&quot;https://en.wikipedia.org/wiki/Intermediate_frequency&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Intermediate_frequency&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Most amateur digital radio receivers I'm aware of use the IF approach, and some also do bandpass sampling. For example, the RTL2832 can only sample at 2.6 Msamples/s, but it can receive signals at up to 2.2 GHz or so. If you see the &lt;a href=&quot;http://www.realtek.com.tw/products/productsView.aspx?Langid=1&amp;amp;PNid=22&amp;amp;PFid=35&amp;amp;Level=4&amp;amp;Conn=3&amp;amp;ProdID=257&quot; rel=&quot;nofollow&quot;&gt;device's datasheet&lt;/a&gt;, you'll see that it supports several different IFs.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-12-17T18:24:21.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19669" PostTypeId="2" ParentId="19665" CreationDate="2014-12-17T20:34:36.800" Score="1" Body="&lt;p&gt;The (unwrapped) phase between two constant same frequency signals is linearly related to any delay between the two signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measuring phase of a fixed frequency periodic signal over many periods is sometimes more accurate than trying to detect delay locally (by zero crossing, etc.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2014-12-17T20:34:36.800" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19670" PostTypeId="1" CreationDate="2014-12-18T00:24:30.047" Score="7" ViewCount="6188" Body="&lt;p&gt;In the case of continuous-time systems, if the system is causal, its Laplace transfer function is strictly proper (the degree of the numerator is less than the degree of the denominator). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this true also in case of discrete-time systems? That is, if the system is causal, is its Z transfer function strictly proper?&lt;/p&gt;&#xA;" OwnerUserId="12104" LastEditorUserId="11256" LastEditDate="2014-12-18T08:11:37.527" LastActivityDate="2016-03-15T20:04:56.047" Title="Do Causal Discrete-time systems have proper transfer functions?" Tags="|linear-systems|transfer-function|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19671" PostTypeId="2" ParentId="19625" CreationDate="2014-12-18T07:07:39.137" Score="0" Body="&lt;p&gt;For   N  being odd,    h(n)=1/N[H(0)+ 2∑_(k=1)^((N-1)/2)▒〖Re{H(k) e^(j2πnk/N    )}〗]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For N being even and H(N/2)=0   , h(n)=1/N  [H(0)+2∑_1^(N/2-1)▒Re{H(k) e^(j2πnk/N)}]&lt;/p&gt;&#xA;" OwnerUserId="11809" LastActivityDate="2014-12-18T07:07:39.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19672" PostTypeId="1" CreationDate="2014-12-18T08:26:16.907" Score="0" ViewCount="3620" Body="&lt;p&gt;I am new to DSP and my question is a very simple one. It is about determining the right cut-off frequency. I calculate the power spectral density using FFT by Welch's algorithm. However I am confused as to what should be the right cut-off frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6h1qj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me what is the cut-off frequency in this case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e8lUA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12105" LastEditorUserId="12105" LastEditDate="2015-02-15T07:46:15.253" LastActivityDate="2015-02-15T07:46:15.253" Title="How to determine cut-off frequency using power spectral density?" Tags="|fft|filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19673" PostTypeId="2" ParentId="19670" CreationDate="2014-12-18T10:39:03.807" Score="8" Body="&lt;p&gt;Note that a stable and causal continuous-time transfer function does not need to be &lt;em&gt;strictly&lt;/em&gt; proper but only proper, i.e. the degree of the numerator does not exceed the degree of the denominator, but numerator and denominator degree can be equal. E.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s)=\frac{as^2+bs+c}{s^2+ds+e}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can represent a causal and stable system, as long as its poles are in the left half of the complex $s$-plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For discrete-time systems the same is true. A transfer function for which the degree of the numerator is greater than the degree of the denominator has at least one pole at infinity. Since causal and stable discrete-time systems must have all their poles inside the unit circle, such a system can't be causal and stable. However, as is the case with continuous-time systems, equal degrees of numerator and denominator are possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume a causal and stable discrete-time system is described by the following linear difference equation with constant coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]+a_1y[n-1]+\ldots+a_Ny[n-N]=b_0x[n]+b_1x[n-1]+\ldots+b_Mx[n-M]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding transfer function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{\sum_{m=0}^{M}b_mz^{-m}}{1+\sum_{n=1}^Na_nz^{-n}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there are of course no restrictions on the choices of $M$ and $N$. Nevertheless, the transfer function $H(z)$ is always proper. Assuming $M&amp;gt;N$ gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{b_0z^M+b_1z^{M-1}+\ldots+b_M}{z^M+a_1z^{M-1}+\ldots+a_Nz^{M-N}}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the transfer function given by (3) is proper. $M&amp;gt;N$ just means that the last few coefficients of the denominator polynomial are zero. A very similar argument holds for $M&amp;lt;N$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-03-15T20:04:56.047" LastActivityDate="2016-03-15T20:04:56.047" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19674" PostTypeId="2" ParentId="19665" CreationDate="2014-12-18T11:46:40.597" Score="1" Body="&lt;p&gt;The method used by TI in their white paper uses some fancy processing to measure the phase difference, but the underlying principle is reasonably simple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each pulse of infrared travels at the speed of light.  If you place an object right in front of the camera, then the pulses of light reflected back will be in phase with those transmitted - in other words, the leading edge of the received pulse will match the leading edge of the transmitted one, and the same for the trailing edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the object is moved away from the camera, then the light will take a short time to reflect off it and get back to the camera.  If you compare the edges of the reflected signal with those of the original, they will be time-shifted by a few nanoseconds.  Since the speed of light in air is pretty much fixed, the time delay tells you how far away the object is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick that TI are using is not to try to measure the exact timing of the edges of the signal (which is tricky on a weak signal), but to measure the degree of overlap between the reflected signal and a set of known square waves, that are synchronised to the outgoing pulses.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2014-12-18T11:46:40.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19675" PostTypeId="1" CreationDate="2014-12-18T14:37:09.703" Score="1" ViewCount="594" Body="&lt;p&gt;I'm trying to make a &lt;strong&gt;&lt;em&gt;robot dance&lt;/em&gt;&lt;/strong&gt; on several songs using &lt;strong&gt;Arduino&lt;/strong&gt;.&lt;br&gt;&#xA;I need to understand how to get the rhythm from the songs, something like detecting the &lt;strong&gt;&lt;em&gt;beats&lt;/em&gt;&lt;/strong&gt;, calculating the &lt;strong&gt;&lt;em&gt;bpm&lt;/em&gt;&lt;/strong&gt;..&lt;br&gt;&#xA;I'm not expert but I read that probably I'll have to use some filters, is that right? or I can use a simple mic and opamp? do I have to analayze some frequencies?&lt;br&gt;&#xA;I hope someone has some ideas and can explaing me how to do such a thing, thanks!! :)&lt;/p&gt;&#xA;" OwnerUserId="12108" LastActivityDate="2015-01-18T13:32:07.037" Title="Beat Detection with Arduino" Tags="|filters|audio|signal-analysis|frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19677" PostTypeId="1" AcceptedAnswerId="19684" CreationDate="2014-12-18T16:57:11.080" Score="0" ViewCount="1379" Body="&lt;p&gt;I am using rtl-sdr at an adjustable sample rate to get stuff from a WBFM radio station.  I then filter and demodulate it.  When I sample at 2.4Msps, the sound is 'choppy'.  I tied the sample rate to a slider on gnuradio, so I can vary the software radio sample rate by moving around the slider.  It turns out the pitch of the person talking/singing's voice gets lower as I move the sample rate down, and higher as I move the sample rate up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why?  2.4 million samples / second is much greater than 2*20,000Hz.  Why would there be a difference between sampling at 2.4 and 2.8 Msps?  All the frequency content is already covered in both cases...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also: in gnuradio I can adjust the width of the low pass filter that is placed before the FM demodulator.  I thought that making the filter very narrow would remove the high frequency content of the audio.  Well, it doesn't.  It just makes the sound 'staticy'.  Why?&lt;/p&gt;&#xA;" OwnerUserId="10591" LastActivityDate="2014-12-18T22:07:39.847" Title="Sample rate changing audio pitch" Tags="|software-defined-radio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19678" PostTypeId="2" ParentId="14862" CreationDate="2014-12-18T17:08:41.650" Score="1" Body="&lt;p&gt;Here is a better answer (than the one I gave before) based on properly scaled Fourier transformations where basis vectors are normalized to length 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise, a normal distribution of a random variable, has the following variance, based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Variance#Basic_properties&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Variance#Basic_properties&lt;/a&gt;&#xA;for variance of a linear combination with no correlation, applies to both the Fourier transformation and it's inverse&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {Var}\left(\sum _{{i=1}}^{{N}}a_{i}X_{i}\right) = \sum _{{i=1}}^{{N}}a_{i}^{2}\operatorname {Var}(X_{i}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same variance for all Xi means&#xA;$$ {Var}\left(\sum _{{i=1}}^{{N}}a_{i}X_{i}\right) = \sum _{{i=1}}^{{N}}a_{i}^{2}\operatorname {Var}(X) = \left(\sum _{{i=1}}^{{N}}a_{i}^{2}\right)\operatorname {Var}(X) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 1&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first row DC basis vector in a even Fourier transform&lt;br&gt;&#xA;$$  \left(\frac{1}{\sqrt N } , \frac{1}{\sqrt N } , \frac{1}{\sqrt N } , ... \right) $$ &#xA;gives a variance of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Var(Transform) = N \left( \frac{1}{\sqrt N } \right)^2 Var(X) = Var(X) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 2&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A basis vector in an even fast Fourier transform with a wavelength of 4 samples, a repeating series of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$  \left( \sqrt{\frac{2}{N}} , 0 , -\sqrt{\frac{2}{N}} , 0 , ... \right) $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the basis vector with most zero elements, every second. The variance becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Var(Transform) = \frac{N}{2} \left( \sqrt{\frac{2}{N}} \right)^2 Var(X) = Var(X) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So variance, and thus standard deviation, is independent of basis vectors and zero elements. But what happens to the signal, the expected value? Maybe someone else can show that? &lt;/p&gt;&#xA;" OwnerUserId="11657" LastEditorUserId="11657" LastEditDate="2014-12-19T19:52:42.377" LastActivityDate="2014-12-19T19:52:42.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19679" PostTypeId="2" ParentId="2610" CreationDate="2014-12-18T17:24:15.800" Score="0" Body="&lt;p&gt;You can use &lt;a href=&quot;http://essentia.upf.edu/&quot; rel=&quot;nofollow&quot;&gt;Essentia &lt;/a&gt; audio analysis C++ library, that includes python bindings. You'll take all the advantage of python/scipy environment plus lots of audio/music analysis algorithms that come with Essentia.&lt;/p&gt;&#xA;" OwnerUserId="1792" LastActivityDate="2014-12-18T17:24:15.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19680" PostTypeId="2" ParentId="3393" CreationDate="2014-12-18T17:29:55.620" Score="2" Body="&lt;p&gt;You can also try &lt;a href=&quot;http://essentia.upf.edu/&quot; rel=&quot;nofollow&quot;&gt;Essentia&lt;/a&gt;. It provides &lt;a href=&quot;http://essentia.upf.edu/documentation/reference/std_RhythmExtractor2013.html&quot; rel=&quot;nofollow&quot;&gt;several beat tracker methods&lt;/a&gt;, which are more-or-less state of the art. Technically portable to android also, although it has not been done yet.&lt;/p&gt;&#xA;" OwnerUserId="1792" LastActivityDate="2014-12-18T17:29:55.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19681" PostTypeId="2" ParentId="2461" CreationDate="2014-12-18T17:35:03.280" Score="0" Body="&lt;p&gt;&lt;a href=&quot;http://essentia.upf.edu&quot; rel=&quot;nofollow&quot;&gt;Essentia&lt;/a&gt; in conjunction with &lt;a href=&quot;https://github.com/MTG/gaia&quot; rel=&quot;nofollow&quot;&gt;Gaia&lt;/a&gt; library are able to extract audio features, train classifier models and apply them to recognize different types of sounds. In particular they are used for music classification into genres and moods, and it will be surely possible to build a sound scene classifier.&lt;/p&gt;&#xA;" OwnerUserId="1792" LastActivityDate="2014-12-18T17:35:03.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19683" PostTypeId="1" AcceptedAnswerId="19704" CreationDate="2014-12-18T21:35:10.800" Score="0" ViewCount="545" Body="&lt;p&gt;I have simple smooth time signal with different time period. I would like to transfer period over the time to frequency, and to track frequency changing over the time, I would call it Instantaneous frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PF-period frequency (1/T)... any suggestion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EUO53.jpg&quot; alt=&quot;Time period to frequency&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11432" LastEditorUserId="11432" LastEditDate="2014-12-23T09:58:07.410" LastActivityDate="2015-01-23T19:32:25.360" Title="Time period to Instantaneous frequency" Tags="|frequency-domain|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19684" PostTypeId="2" ParentId="19677" CreationDate="2014-12-18T22:07:39.847" Score="1" Body="&lt;p&gt;A couple of things jump out when looking at your diagram:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The first low-pass filter has a decimation of 4, so the sampling rate at its output is 256 kHz. However, you have set the sampling rate of the FM receiver and the second LPF to 224 kHz. These should be 256 kHz.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The cut-off frequency of the first LPF is 150 kHz. This means a total passband of 300 kHz. This is larger than necessary, so you'll end up picking up more noise than the optimum.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You multiply the audio output by a constant factor of 2. This may be too little, or too much. I'd suggest using a slider to control the volume. If you connect a scope sink to the audio sink input, you'll be able to easily get the optimum gain: you want the signal to be withing [1,-1].&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-12-18T22:07:39.847" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19685" PostTypeId="1" CreationDate="2014-12-19T04:52:06.493" Score="1" ViewCount="176" Body="&lt;p&gt;Say I want to design a low pass filter with stop and pass band ripple constrained to $\epsilon$ and transition region $\delta$, what is the smallest FIR Filter length that suffices? Can you please provide a derivation?&lt;/p&gt;&#xA;" OwnerUserId="12113" LastEditorUserId="12113" LastEditDate="2014-12-19T06:42:31.823" LastActivityDate="2014-12-26T16:10:49.560" Title="FIR Filter length Upper Bound" Tags="|filters|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19687" PostTypeId="1" AcceptedAnswerId="19698" CreationDate="2014-12-19T07:27:31.987" Score="0" ViewCount="67" Body="&lt;p&gt;I am working on a project involving analysis of bird sounds and I want to record these sounds in slightly remote locations. It is enough if the device can only record and store them (maybe in an SD card). Are there any devices available that I can readily use or what would be the best way to do this ?&lt;/p&gt;&#xA;" OwnerUserId="12116" LastActivityDate="2014-12-20T08:57:32.133" Title="Acoustic record and store devices" Tags="|audio|sound|acoustics|hardware-implementation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19689" PostTypeId="2" ParentId="18742" CreationDate="2014-12-19T09:29:14.873" Score="4" Body="&lt;p&gt;This may sound trivial but the sampling theorem can only be violated in the process of sampling an analog signal. In your question you would like to sample the signal &#xA;$$&#xA;x(t) = \sum_{k=0}^{N-1}\mathrm{e}^{\displaystyle -j 2\pi k\Delta f t}&#xA;$$&#xA;and you state correclty that, in order to not violate the sampling theorem, $f_\mathrm{s}&amp;gt;2(N-1)\Delta f$ must hold. In contrast, OFDM systems usually work with a sampling frequency $f_\mathrm{s}=N\Delta f$ and you may now ask where this discrepancy originates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at $x(t)$ we notice that it has a one-sided spectrum with discrete frequencies at $0, \Delta f, \ldots, (N-1)\Delta f$. That's an odd choice because the signal bandwidth is $2(N-1)\Delta f$ but only $N$ subcarriers are used. With other words: this system has potentially $2N$ subcarriers but the subcarriers $-N, -N+1, \ldots, -1$ are unused and the corresponding spectrum is wasted. We should rather define $x(t)$ like this:&#xA;$$&#xA;x(t) = \sum_{k=-N/2}^{N/2-1}\mathrm{e}^{\displaystyle -j 2\pi k\Delta f t}&#xA;$$&#xA;The absolute maximum frequency is now $\frac{N}{2}\Delta f$ and accordingly $f_\mathrm{s}&amp;gt;N\Delta f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For creating a discrete-time OFDM signal, however, $x(t)$ is quite irrelevant. You cannot violate the sampling theorem when generating a discrete-time signal, because it can be considered as already sampled. Furthermore, due to the cyclic property of the DFT, the limits of the sum in the definition of $x[n]$ are correct. Whether they are $0 \ldots N-1$, $-N/2\ldots N/2-1$ or $N+3\ldots 2N+2$ doesn't matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I wouldn't say that the textbook is wrong. But if OFDM is motivated by sampling an analog signal, then $x(t)$ as defined in your answer is a poor choice.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2014-12-19T15:37:44.367" LastActivityDate="2014-12-19T15:37:44.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19690" PostTypeId="2" ParentId="19685" CreationDate="2014-12-19T10:10:24.667" Score="4" Body="&lt;p&gt;Many people have asked themselves this question. Unfortunately, there is no exact solution, just approximations. One relevant paper is &lt;a href=&quot;http://onlinelibrary.wiley.com/doi/10.1002/j.1538-7305.1973.tb01990.x/abstract&quot; rel=&quot;nofollow&quot;&gt;Practical Design Rules for Optimum Finite Impulse Response Low-Pass Digital Filters&lt;/a&gt; by Herrmann, Rabiner and Chan, where they basically fit a formula to their data obtained from lots of designs. A simplified formula is [1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M=\frac{-10\log_{10}(\delta_1\delta_2)-13}{2.324\;\Delta\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $M$ is the filter order, and $\Delta\omega=\omega_s-\omega_p$ is the width of the transition band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the Matlab function &lt;code&gt;firpmord.m&lt;/code&gt; uses some formula to estimate the necessary filter order, but they also say that the required order is often underestimated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] &lt;em&gt;Discrete-Time Signal Processing&lt;/em&gt;, Oppenheim, Schafer, Buck (2nd ed.), p. 502&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-19T10:10:24.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19691" PostTypeId="1" CreationDate="2014-12-19T10:41:41.857" Score="0" ViewCount="274" Body="&lt;p&gt;I have coloured images, some may be just clipart, some may be artwork, both could be with or without gradients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before i run a colour counting algorithm on them, i want to detect if the image has only solid block colours, or gradients in it.(Technically all compressed images will have small gradients in the form of anti aliasing, but i want to detect the gradients that were there in the original image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking of an approach in which i could plot a historam(of rgb or hsl values, or even grayscale) and if it has peaks that are smooth and not steep, then that indicates that the image may have an area with a gradual colour shift, with all colours of one hue appearing more or less equally(like the image of a sky would have gradual changes from blue to lighter blue to white).&#xA;Does this sound right?&#xA;Any other approaches for doing this?&#xA;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="12118" LastActivityDate="2014-12-19T10:41:41.857" Title="How do i detect if an image has a gradient or not?" Tags="|image-processing|histogram|gradient|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19692" PostTypeId="2" ParentId="19626" CreationDate="2014-12-19T12:24:55.153" Score="0" Body="&lt;p&gt;The solution lies in the use of the x's. You need to convert the x's you use to lower frequencies, which can be either positive or negative. So only use x's between -N/2 and N/2 and the problem is solved.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def convertfreqs(x):&#xA;    return np.mod((x + N/2),N) - N/2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works because it is the higher frequencies which cause the signal to change heavily inbetween pixels. Higher frequencies means higher x's.&lt;/p&gt;&#xA;" OwnerUserId="12071" LastActivityDate="2014-12-19T12:24:55.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19693" PostTypeId="2" ParentId="19675" CreationDate="2014-12-19T13:26:47.030" Score="1" Body="&lt;p&gt;You could use Sparkfun's spectrum analyzer shield. It will give seven bands measurements of the sound at the input jack. For BPM approximation you could select the band that suits you best for the music style you will be analyzing.&lt;/p&gt;&#xA;" OwnerUserId="12120" LastActivityDate="2014-12-19T13:26:47.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19698" PostTypeId="2" ParentId="19687" CreationDate="2014-12-20T02:45:04.013" Score="0" Body="&lt;p&gt;There are plenty of devices that can do this. Simply Google portable recorders. They generally all have a microphone built in. Some have line level inputs, and some can also take XLR inputs and provide phantom power for condenser microphones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't need the XLR inputs, I can recommend the Zoom H1. It has a stereo microphone, can also take a line level input and is fairly cheap. I have used this to record various foley sounds including bird songs. The sounds save onto an SD card in high quality 24-bit/96 kHz WAV files for analysis on a computer later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's best to get a little tripod for it too to stop any handling noise.&lt;/p&gt;&#xA;" OwnerUserId="12129" LastActivityDate="2014-12-20T02:45:04.013" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19699" PostTypeId="2" ParentId="19687" CreationDate="2014-12-20T08:57:32.133" Score="0" Body="&lt;p&gt;Recording birds is not so easy as the level of birds singing can be low compared to other sounds in the environment. If you plan to record in the open, be careful that built in microphones as the one you ususally find on pocket recorders might be subject to wind noise. To deal with wind noise, you don't have much choice but to have a microphone inside a windjammer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the use case (ie doing some digital signal analysis on the audio or simply listening to it), you can record the audio files as mp3 instead of wav/pcm. That will allow for longer records on the recording medium. The H1 doc mentions 55 hours in pcm/wav and up to 555 hours in mp3 on a 32Gb card.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But to have the recorder run on battery 50 hours will require to find an external power supply able to support this duration that the included AA battery case will not.&lt;/p&gt;&#xA;" OwnerUserId="3485" LastActivityDate="2014-12-20T08:57:32.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19700" PostTypeId="1" AcceptedAnswerId="19701" CreationDate="2014-12-20T11:25:04.647" Score="3" ViewCount="388" Body="&lt;p&gt;For educational purposes I implemented the DFT and inverse DFT for images using OpenCV. Applying the DFT to an image and taking the inverse DFT of the spectrum yields the original image, so this works. I do not rearrange the spectral image from &lt;span class=&quot;math-container&quot;&gt;$ [0,N) $&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$ [-N/2, N/2) $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, using the convolution theorem I want to filter an image. I use a 3x3 averaging kernel and pad it with zeroes to the same size as the input image. I then take the DFT of it, and do a piecewise multiplication of the image spectrum and the kernel spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse DFT of the resulting spectrum yields an interesting result: The image is filtered (smoothed) correctly, however the quadrants are swapped. Interestingly, if I filter it twice (or any even number), the quadrants are properly arranged. This works for both&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{F}^{-1}\{ (\mathcal{F}\{I\}\mathcal{F}\{H\})\mathcal{F}\{H\} \} = $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{F}^{-1}\{ \mathcal{F}\{I\}(\mathcal{F}\{H\}\mathcal{F}\{H\}) \} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the image &lt;span class=&quot;math-container&quot;&gt;$ I $&lt;/span&gt; and kernel &lt;span class=&quot;math-container&quot;&gt;$ H $&lt;/span&gt;. This makes sense to me since convolution is associative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the cause of the swapped quadrants?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sePYs.png&quot; alt=&quot;original image&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/FGtDT.png&quot; alt=&quot;filtered&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10752" LastEditorUserId="128" LastEditDate="2019-03-24T06:00:53.560" LastActivityDate="2019-03-24T06:00:53.560" Title="Applying Convolution (In 2D) Theorem Swaps Quadrants" Tags="|image-processing|filters|dft|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19701" PostTypeId="2" ParentId="19700" CreationDate="2014-12-20T19:04:29.577" Score="2" Body="&lt;p&gt;It's probably due to how you padded the filter before DFT'ing it.  I bet you had it in a corner instead of in the middle.  Since convolution via DFT is circular convolution, it's not so much of a quadrant swap as it is a wrap around.  I believe that if you put the non-zero taps in the middle that it will fix the problem.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2014-12-20T19:04:29.577" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19703" PostTypeId="2" ParentId="19683" CreationDate="2014-12-21T12:33:20.493" Score="-1" Body="&lt;p&gt;I think you want to create some sort of spectrogram. The only difference is that the spectrogram contains a full frequency spectrum for every time period, and you want to get just the dominant frequency, but you can run a dominant frequency search (maximum search), and you will get what you want. You have control both of the time and frequency resolution. &lt;/p&gt;&#xA;" OwnerUserId="11208" LastActivityDate="2014-12-21T12:33:20.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19704" PostTypeId="2" ParentId="19683" CreationDate="2014-12-21T13:57:57.490" Score="2" Body="&lt;p&gt;You can compute the instantaneous frequency of your data in Matlab as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z = hilbert(x);&#xA;N = length(z);&#xA;f = angle(z(2:N).*conj(z(1:N-1)))/2/pi;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get units of Hertz, multiply f by the sample rate.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There are other, similar estimators that do a similar thing. &lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms/wlp&quot; rel=&quot;nofollow&quot;&gt;This matlab code&lt;/a&gt; can help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eric Jacobsen also has a couple of pages &lt;a href=&quot;http://www.ericjacobsen.org/fe.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.ericjacobsen.org/fe2/fe2.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastEditorUserId="80" LastEditDate="2015-01-23T19:32:25.360" LastActivityDate="2015-01-23T19:32:25.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19705" PostTypeId="1" CreationDate="2014-12-21T16:29:17.690" Score="0" ViewCount="9859" Body="&lt;p&gt;I want to implement Hough transform on image without using inbuilt function. Some papers say that the image is first flipped before applying Hough transform. I do not understand how Matlab is doing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have written the code below, but the H matrix by Matlab and houghMatrix generated by me are not same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used default values of rhoResolution as 0.5 and thetaResolution as 0.5 also. I tried to do it without rotating image but then also not getting same matrices.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;RGB = imread('gantrycrane.png');&#xA;     I  = rgb2gray(RGB); % convert to intensity&#xA;     BW = edge(I,'canny'); % extract edges&#xA;     BW = BW(end:-1:1,1:1:end);&#xA;     theta = -90:0.5:(90-0.5);&#xA;     D = sqrt((size(BW,1) - 1)^2 + (size(BW,2) - 1)^2);&#xA;     rho = -ceil(D):0.5:ceil(D);&#xA;     houghMatrix = zeros(size(rho,2),size(theta,2));&#xA;     for i=1:size(BW,1)&#xA;         for j=1:size(BW,2)&#xA;             if(BW(i,j)==1)&#xA;                  for ii=1:size(theta,2)                  &#xA;                      rho1 = i*cosd(theta(1,ii)) + j*sind(theta(1,ii));&#xA;                      rhotemp = rho1 - floor(rho1);&#xA;                      if(rhotemp&amp;gt;(0.5+0.25))&#xA;                          rho1 = ceil(rho1);&#xA;                      elseif(rhotemp&amp;gt;0.25)&#xA;                          rho1 = floor(rho1) + 0.5;&#xA;                      else&#xA;                          rho1 = floor(rho1);&#xA;                      end&#xA;                      position = (rho1 - rho(1,1))/0.5;&#xA;                      houghMatrix(position+1,ii) = houghMatrix(position+1,ii) + 1;&#xA;                  end&#xA;             end&#xA;         end&#xA;     end&#xA;&#xA; [H,T,R] = hough(BW,'RhoResolution',0.5,'Theta',-90:0.5:89.5);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need to implement this in C code after that, and the functionality should be same as Matlab code. So I need to have a similar matrix like Matlab (if error of +-5 then it is acceptable but this is two totally different matrices).&lt;/p&gt;&#xA;" OwnerUserId="12136" LastEditorDisplayName="user11906" LastEditDate="2015-07-13T03:00:47.410" LastActivityDate="2016-03-09T06:43:37.420" Title="Hough Transform in Matlab without the built-in function" Tags="|matlab|hough-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19709" PostTypeId="1" CreationDate="2014-12-21T22:50:19.127" Score="2" ViewCount="350" Body="&lt;p&gt;Currently I am doing an acadmic research about an idea which came into my mind lately.  I have a 3d model and I want to extract embossed text .. anyone knows any papers? or if it is already proposed? . I tried to research different keywords but nothing popped up which is relevent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4NeV1.png&quot; alt=&quot;text&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The text are bulging out (by a few millimeters) &lt;/p&gt;&#xA;" OwnerUserId="12140" LastEditorUserId="12140" LastEditDate="2014-12-22T13:53:01.923" LastActivityDate="2024-03-03T00:07:40.870" Title="What are the keywords to find an algorithm that detects embossed text from a 3d model?" Tags="|image-processing|3d|text-recognition|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19710" PostTypeId="1" AcceptedAnswerId="19721" CreationDate="2014-12-21T23:42:15.020" Score="1" ViewCount="363" Body="&lt;p&gt;I've been given an image from Berkeley dataset to segmentate. I am an undergrad student and so far I threw everything i know to this thing. But the colors are extremely close. I tried;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Clustering&lt;/li&gt;&#xA;&lt;li&gt;Edge Detection&lt;/li&gt;&#xA;&lt;li&gt;Histogram Thresholding&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I need suggestions. Which path should I take? I need to segmentate the animals from this picture but I was only able to remove the green leafs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7fPyN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7201" LastEditorUserId="7092" LastEditDate="2014-12-22T00:53:11.610" LastActivityDate="2014-12-23T13:39:30.567" Title="Image Segmentation - Berkeley Dataset" Tags="|image-processing|image-segmentation|segmentation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19711" PostTypeId="2" ParentId="19649" CreationDate="2014-12-22T00:57:50.240" Score="1" Body="&lt;p&gt;Well, I submitted my project. Thanks to the help of this group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the PESQ number, I think the range is between 1 and 5, where 5 being excellent and 1 is low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyhow, I did another trick to estimate my performance. Instead of feeding the functions (SESQ, LLR, and Segment SNR) the clean speech and the processed speech, I fed them clean speech with the clean speech. I got numbers and these were my reference (or maximum) numbers. Then I compared all my runs against these reference numbers&lt;/p&gt;&#xA;" OwnerUserId="11753" LastActivityDate="2014-12-22T00:57:50.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19713" PostTypeId="1" CreationDate="2014-12-22T13:27:34.337" Score="1" ViewCount="122" Body="&lt;p&gt;I am using acoustic waves to measure the thickness of material. My problem is that the acoustical lens produces static echos in the signal. I try to separate both because there is a short interference between both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency of the material echo and the static echo has nearly the same frequency. So spectral subtraction is not a valid method to separate the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will try the following: &#xA;The first measurement is without any object. So I am able to measure the static echo of the acoustic system. The second measurement I collect the signal with the object to measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea:&#xA;So I got two signals from different signal sources. Maybe I can separate both with Independent Component Analysis (ICA). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you think that this solution will work? Or is there a better method to separate static and echo signals (with noise) out the measured data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="12146" LastEditorUserId="24461" LastEditDate="2019-07-22T23:17:43.793" LastActivityDate="2019-07-22T23:17:43.793" Title="Separate static echos from acoustic signal (ICA?)" Tags="|ica|acoustics|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19715" PostTypeId="1" AcceptedAnswerId="19719" CreationDate="2014-12-23T08:14:06.893" Score="2" ViewCount="1131" Body="&lt;p&gt;I am trying to find out &lt;strong&gt;intrinsic parameters&lt;/strong&gt;(focal length ,principle point,and lens distortion coefficients)as well as the &lt;strong&gt;extrinsic parameters&lt;/strong&gt;(rotation and translation of each camera relative to &lt;strong&gt;the reference frame&lt;/strong&gt;) of three cameras in the flowing picture.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xWkWX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are placed at &lt;strong&gt;nearly orthogonal angles&lt;/strong&gt; around a 12x12x12 inch working space. There are four steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;capture images of chess board by two cameras at the same time&lt;/li&gt;&#xA;&lt;li&gt;use toolbox calib_gui(matlab) to calibrate two cameras separately and get Calib_Results_left.mat and Calib_Results_right.mat.&lt;/li&gt;&#xA;&lt;li&gt;put these two results into stereo_calib(matlab) and run Calibration&lt;/li&gt;&#xA;&lt;li&gt;repeat step 1~3 on another pair of cameras&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, I was stuck at step 3! &lt;strong&gt;None of pair images was found inconsistent&lt;/strong&gt;. The errors were shown in the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disabling view 2 - Reason: the left and right images are found inconsistent (try help calib_stereo for more information)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I checked the order of images but didn't find problems. I doubt that my application is not binocular calibration, because intersection angle between two cameras is too big &#xA;for a stereo-camera!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want to find out rotation and translation of each camera relative to the &lt;strong&gt;reference frame&lt;/strong&gt;. Does anybody have any ideas?&lt;/p&gt;&#xA;" OwnerUserId="8229" LastEditorUserId="53" LastEditDate="2014-12-23T15:17:10.970" LastActivityDate="2014-12-24T13:00:35.130" Title="How to calibrate three orthogonal cameras？" Tags="|image-processing|matlab|camera-calibration|matlab-cvst|orthornormal|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19716" PostTypeId="2" ParentId="19710" CreationDate="2014-12-23T09:21:58.613" Score="0" Body="&lt;p&gt;You can try grabcut algorithm. Check this link:&#xA;&lt;a href=&quot;http://docs.opencv.org/trunk/doc/py_tutorials/py_imgproc/py_grabcut/py_grabcut.html&quot; rel=&quot;nofollow&quot;&gt;Interactive Foreground Extraction using GrabCut Algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12159" LastActivityDate="2014-12-23T09:21:58.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19717" PostTypeId="2" ParentId="19683" CreationDate="2014-12-23T09:57:41.220" Score="0" Body="&lt;p&gt;Thanks to all. John your suggestion I think giving good result, this is what I have been expected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original signal sampling frequeny is 102400 Hz and duration is 0.63999 seconds. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did what Johns suggested in Matlab: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;data = x; &#xA;z = hilbert(x); &#xA;N = length(z); &#xA;fs=102400; f = angle(z(2:N).*conj(z(1:N-1)))/2/pi*102400; % to get units in Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After post processing I get x-axis- like 63999. How to get x axis in seconds like 0.63999? &lt;/p&gt;&#xA;" OwnerUserId="11432" LastEditorUserId="11432" LastEditDate="2014-12-24T18:05:15.800" LastActivityDate="2014-12-24T18:05:15.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19718" PostTypeId="2" ParentId="19709" CreationDate="2014-12-23T09:58:44.983" Score="0" Body="&lt;p&gt;One approach would be to use 3D reconstruction and then use deformable ICP (iterative closest point) to recover the deformation map of the embossed text. The deformation map would transform the CAD model to the deformed scene. The inliers you compute during correspondence estimation would also allow you to segment these characters. (This might be similar to computing optical flow)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reconstructing your scene, I would recommend photometric stereo techniques. They are pretty accurate in reconstructing small details. For large objects, they would not work. Some intro texts are &lt;a href=&quot;http://pages.cs.wisc.edu/~csverma/CS766_09/Stereo/stereo.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www2.ee.ic.ac.uk/publications/p4689.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in such cases, you could use an appropriate lighting to emphasize the text. A low angle ring light would be an example.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-09-19T15:00:37.773" LastActivityDate="2015-09-19T15:00:37.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19719" PostTypeId="2" ParentId="19715" CreationDate="2014-12-23T11:29:06.143" Score="1" Body="&lt;p&gt;Use an asymmetric calibration plate. Such as the new circle grid in OpenCV. &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/calib3d/camera_calibration/camera_calibration.html&quot; rel=&quot;nofollow&quot;&gt;Check here&lt;/a&gt;. You do not need to find the correspondences in the gui, but rather run the calibration directly. Also, do not forget to initialize the optimization problem using the median of the obtained poses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calibrate multiple view setups, I would also recommend &lt;a href=&quot;http://cmp.felk.cvut.cz/~svoboda/SelfCal/&quot; rel=&quot;nofollow&quot;&gt;Multi Camera Self Calibration tool&lt;/a&gt;. It uses a simple laser dot and is much easier to calibrate, especially when the number of cameras increase. Of course, pay attention to the synchronization. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-12-24T13:00:35.130" LastActivityDate="2014-12-24T13:00:35.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19720" PostTypeId="2" ParentId="19705" CreationDate="2014-12-23T11:40:02.447" Score="1" Body="&lt;p&gt;Check &lt;a href=&quot;http://de.mathworks.com/matlabcentral/fileexchange/44166-generalized-hough-transform&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; out. It is an easy to follow implementation. You can compare your implementation against this. &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/47120-general-2d-hough-transform&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a no loop version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another advice is to add comments in the code above so that it could be understood better. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-23T11:40:02.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19721" PostTypeId="2" ParentId="19710" CreationDate="2014-12-23T13:39:30.567" Score="0" Body="&lt;p&gt;Take a look at SLICO : &lt;a href=&quot;http://infoscience.epfl.ch/record/177415&quot; rel=&quot;nofollow&quot;&gt;http://infoscience.epfl.ch/record/177415&lt;/a&gt; . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superpixels along with graphcut/grabcut methods are quite good at similar segmentation problems. I have had really good results with SLICO and MRFs/Simulated Annealing approaches. &lt;/p&gt;&#xA;" OwnerUserId="12162" LastActivityDate="2014-12-23T13:39:30.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19722" PostTypeId="2" ParentId="19715" CreationDate="2014-12-23T15:15:36.350" Score="1" Body="&lt;p&gt;For pairwise stereo calibration try using the &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/stereo-camera-calibrator-app.html&quot; rel=&quot;nofollow&quot;&gt;Stereo Camera Calibrator app&lt;/a&gt; in the Computer Vision System Toolbox. It is much easier to use than Caltech Camera Calibration toolbox. For starters it detects the checkerboard automatically.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2014-12-23T15:15:36.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19724" PostTypeId="1" AcceptedAnswerId="19725" CreationDate="2014-12-23T15:51:42.370" Score="4" ViewCount="1084" Body="&lt;p&gt;I am using the Multilevel Wavelet decomposition. The decomposition results in a filter bank such as the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TSXNk.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I am using one of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Daubechies_wavelet&quot; rel=&quot;nofollow noreferrer&quot;&gt;Daubechies wavelets&lt;/a&gt;, &lt;code&gt;db7&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reality &lt;code&gt;Level 2&lt;/code&gt; coefficients are the result of filtering by $\ g(n)$ then down-sampling and filtering by $\ h(n)$. Suppose that the whole operation I described above is a single filter ie. at each level the coefficients get generated by a single filter.&#xA;I would like to know how to calculate the frequency response of those filters at each level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it correct to feed an impulse, i.e a Kronecker Delta function to the wavelet decomposition and then compute the Fourier Transform of the resulting coefficients ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: The same question has been asked &lt;a href=&quot;http://uk.mathworks.com/matlabcentral/answers/44879-daubechies-filters-frequency-response&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and the response was to get the &lt;code&gt;convolution&lt;/code&gt; of the impulse response of $\ g(n)$ and an up-sampled version of $\ h(n)$. What puzzles me in that response though, is why divide by $\sqrt2$ the result of the convolution. Also, it seems like more code compared to just calling the wavelet decomposition routine with a Kronecker delta function.&lt;/p&gt;&#xA;" OwnerUserId="12160" LastEditorUserId="12160" LastEditDate="2014-12-23T16:30:27.147" LastActivityDate="2014-12-23T20:54:25.040" Title="How can we calculate the frequency response of each filter of a Discrete Wavelet Decomposition filter bank?" Tags="|filters|wavelet|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19725" PostTypeId="2" ParentId="19724" CreationDate="2014-12-23T20:54:25.040" Score="0" Body="&lt;p&gt;The decision under the link you provided seems good enough. The main idea is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;we have impulse response of each filter&lt;/li&gt;&#xA;&lt;li&gt;take the impulse response of the filter with the slowest sample rate as the input signal&lt;/li&gt;&#xA;&lt;li&gt;route it back through the chain&lt;/li&gt;&#xA;&lt;li&gt;perform spectrum estimation of the resulting signal&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Division by $\sqrt2$ is for normalization only. For the given set of db coefficients their sum is $\sqrt2$, look &lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/dbaux.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for explanation. It has no impact on the sense of the result I think. &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-12-23T20:54:25.040" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19726" PostTypeId="2" ParentId="19584" CreationDate="2014-12-23T21:18:38.410" Score="1" Body="&lt;p&gt;If it is actual yet...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used this code for myself (filters have been tested in FPGA):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [DS] = myfir_cor1 (order, Wn, mvv, din, fir_type, CIC, uprate)   &#xA;//type of filter - lowpass fir filter&#xA;//-----------main parameters------------&#xA;A = 14; //14&#xA;L = 1/Wn;&#xA;SH = floor(order/2);&#xA;MVV = mvv;&#xA;&#xA;hcc = zeros(1, uprate * 2^A);&#xA;hcc(1, 100) = 1;&#xA;hcc = cicFilt(hcc, CIC); HCC = abs(fft(hcc, -1)); HCC = HCC/max(HCC);&#xA;HC = HCC(1, 1:2^(A-1));&#xA;HC1 = ones(1, 2^A);&#xA;HC1(1, 1:2^(A-1)) = HC;&#xA;for k=1:2^(A-1)&#xA;    HC1(1, 2^A-k+1) = HC1(1, k);&#xA;end&#xA;&#xA;//FIR&#xA;htt = ones(1, 2^A);&#xA;&#xA;for j=1:2^A&#xA;  htt(1, j) = sinc(%pi*(j - 2^(A-1))/L) * exp(-(9*(j - 2^(A-1))^2)/(MVV*L^2));&#xA;end&#xA;&#xA;H = fft(htt, -1);&#xA;H1 = abs(H);&#xA;Hff = H1/H1(1, 1);&#xA;&#xA;SQT_S = ones(1, 2^A);&#xA;for j=1:2^A&#xA;   if (strcmp(fir_type, 'rrc') == 0) then&#xA;        SQT_S(1, j) = sqrt(abs(Hff(1, j)))*exp(-%i*2*%pi*j*SH/(2^A));&#xA;   end     &#xA;    if (strcmp(fir_type, 'rc') == 0) then&#xA;        SQT_S(1, j) = abs(Hff(1, j))*exp(-%i*2*%pi*j*SH/(2^A));&#xA;   end&#xA;end&#xA;&#xA;//Correction&#xA;for k=1:2^A&#xA;    SQT_S(1, k) = SQT_S(1, k) / (HC1(1, k));&#xA;end&#xA;&#xA;//Filter coefficients calculating&#xA;pulse = fft(SQT_S, 1);&#xA;&#xA;dsc = ones(1, length(pulse));&#xA;scale = (2^(din-1) - 1)/max(abs(pulse));&#xA;for j = 1:length(pulse)&#xA;    dsc(1, j) = round(real(pulse(1, j))*scale);&#xA;end&#xA;&#xA;DS = ones(1, order+1);&#xA;for j = 1:order+1&#xA;    DS(1, j) = real(dsc(1, j));&#xA;end&#xA;&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's Scilab code, but I think it could be easily converted to Matlab one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example of usage:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear;&#xA;getd('E:\work archieve\Scilab\lib');&#xA;&#xA;N = 16;&#xA;cic = [30 29 28 27 26];&#xA;fir = myfir_cor1(128, 0.50, 1400, 18, 'rrc', cic, N);&#xA;t = zeros(1, 4096);&#xA;t(16) = 1;&#xA;t = filter(fir, 1, t);&#xA;T = abs(fft(t, -1));&#xA;T = T/max(T);&#xA;figure(1); clf();&#xA;plot(20*log10(T+1e-12));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result will be&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BGaOK.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The compensation error in the bandpass as I remember will be less than 1 dB. &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2014-12-23T21:18:38.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19727" PostTypeId="2" ParentId="18053" CreationDate="2014-12-23T22:21:51.267" Score="1" Body="&lt;p&gt;In the paper &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6811177&quot; rel=&quot;nofollow&quot;&gt;Haar-Based Stability Analysis of LPV Systems&lt;/a&gt;, the Haar wavelet transform theory have been used to design linear matrix inequalities (LMIs) to analyze the stability of &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_parametric_varying_control&quot; rel=&quot;nofollow&quot;&gt;LPV systems&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the resolution level of the Haar wavelet increases, the number of variables and rows of the designed LMI increases and the feasibility of this LMI becomes a less conservative condition for the stability of the LPV system. Although the stability of LPV systems using LMIs that become less conservatives with the increase of variables and/or rows have already been proposed in the literature, the Haar-based approach can handle a larger class of parametric dependencies as well as non-convex parametric domains. &lt;/p&gt;&#xA;" OwnerUserId="5388" LastActivityDate="2014-12-23T22:21:51.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19729" PostTypeId="1" CreationDate="2014-12-24T16:16:14.290" Score="8" ViewCount="21390" Body="&lt;p&gt;I am implementing getting orientation from smartphone. I want to use Kalman filter and should determine process noise covariance matrix $Q$ and measurement noise covariance matrix $R$. (newbie to Kalman filter)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have any idea how to determine $Q$. What I think about $R$ is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;state vector : quaternion from (accelerometer + gyroscope)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) My phone is stand still. I get covaraince matrix from Matlab&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.0e-04 *&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0000    0.0005    0.0035   -0.0000&#xA;0.0005    0.0063    0.0411   -0.0002&#xA;0.0035    0.0411    0.2881   -0.0014&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;-0.0000   -0.0002   -0.0014    0.0000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) My phone had been moved for 5 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;covariance matrix is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0417   -0.0533   -0.0008   -0.0014&#xA;-0.0533    0.0784    0.0015    0.0018&#xA;-0.0008    0.0015    0.0001    0.0001&#xA;-0.0014    0.0018    0.0001    0.0001&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anyone to help?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(added)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Details are omitted.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;case 1: Kalman Filter&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The row data from my phone is $p, q, r$ (angular velocity). I omit the conversion equation between angular velocity and quaternion.&#xA;\begin{align*}&#xA;x_{k+1} &amp;amp;= Ax_k+w_k \\&#xA;z_k &amp;amp;= Hx_k + \nu_k \\&#xA;Q &amp;amp;: \text{ covariance matrix for }w_k\\&#xA;R &amp;amp;: \text{ covariance matrix for }\nu_k&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{bmatrix}\dot q_1\\\dot q_2\\\dot q_3\\\dot q_4\end{bmatrix}=\frac 12 \begin{bmatrix} 0&amp;amp;-p&amp;amp;-q&amp;amp;-r\\p&amp;amp;0&amp;amp;r&amp;amp;-q\\q&amp;amp;-r&amp;amp;0&amp;amp;p\\r&amp;amp;q&amp;amp;-p&amp;amp;0 \end{bmatrix}     &#xA;\begin{bmatrix} q_1\\ q_2\\ q_3\\ q_4\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \underbrace{\begin{bmatrix} q_1\\ q_2\\ q_3\\ q_4\end{bmatrix}_{k+1}}_{x_{k+1}}=\underbrace{\left( I + \Delta t\cdot \frac 12 \begin{bmatrix} 0&amp;amp;-p&amp;amp;-q&amp;amp;-r\\p&amp;amp;0&amp;amp;r&amp;amp;-q\\q&amp;amp;-r&amp;amp;0&amp;amp;p\\r&amp;amp;q&amp;amp;-p&amp;amp;0 \end{bmatrix}\right)}_{A}&#xA;\underbrace{\begin{bmatrix} q_1\\ q_2\\ q_3\\ q_4\end{bmatrix}_k}_{x_k} $$&#xA;$$ H=I$$&#xA;My guess for covariance matrix is as follows: (but I don' know how to infer..)&#xA;$$ Q = 0.001I, \quad R=10I.$$&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;case 2: Extended Kalman Filter&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}x_{k+1} &amp;amp;= f(x_k) + w_k \\&#xA;z_k &amp;amp;= h(x_k) + \nu_k\\&#xA;Q &amp;amp;: \text{ covariance matrix for }w_k\\&#xA;R &amp;amp;: \text{ covariance matrix for }\nu_k&#xA;\end{align*}&#xA;$$ A = \left.\frac{\partial f}{\partial x}\right|_{x_k} ,\quad H = \left.\frac{\partial h}{\partial x}\right|_{x_k} $$&#xA;\begin{align*} \begin{bmatrix} \dot \phi\\ \dot \theta\\ \dot \varphi \end{bmatrix}&amp;amp;=&#xA;\begin{bmatrix} 1&amp;amp;\sin\phi\tan\theta &amp;amp; \cos\phi\tan\theta \\&#xA;0&amp;amp;\cos\phi &amp;amp; -\sin\phi \\ &#xA;0&amp;amp;\sin\phi\sec\theta &amp;amp; \cos\phi\sec\theta \end{bmatrix} \begin{bmatrix}p\\ q\\  r \end{bmatrix} \\&#xA;&amp;amp;= \begin{bmatrix} p+q\sin\phi\tan\theta+r\cos\phi\tan\theta \\&#xA;q\cos\phi-r\sin\phi \\ &#xA;q\sin\phi\sec\theta + r\cos\phi\sec\theta \end{bmatrix} \\&#xA;&amp;amp;= f(x) + w&#xA;\end{align*}&#xA;$$z = \begin{bmatrix}1&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\end{bmatrix}\begin{bmatrix}\phi\\\theta\\\varphi\end{bmatrix}+\nu = Hx + \nu $$&#xA;$$A = \begin{bmatrix} \frac{\partial f_1}{\partial\phi} &amp;amp; \frac{\partial f_1}{\partial\theta} &amp;amp; \frac{\partial f_1}{\partial\varphi} \\&#xA;\frac{\partial f_2}{\partial\phi} &amp;amp; \frac{\partial f_2}{\partial\theta} &amp;amp; \frac{\partial f_2}{\partial\varphi} \\&#xA;\frac{\partial f_3}{\partial\phi} &amp;amp; \frac{\partial f_3}{\partial\theta} &amp;amp; \frac{\partial f_3}{\partial\varphi}&#xA;\end{bmatrix} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I emphasize that details are omitted.) In this case, also I don't know how to infere $Q, R$.&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="128" LastEditDate="2020-08-14T15:14:03.883" LastActivityDate="2021-05-28T14:42:34.617" Title="How to Determine Covariance Matrix $Q$ and $R$ in Kalman Filter" Tags="|kalman-filters|sensor|bayesian-estimation|" AnswerCount="1" CommentCount="20" ContentLicense="CC BY-SA 4.0" />
  <row Id="19730" PostTypeId="1" CreationDate="2014-12-24T19:57:59.937" Score="1" ViewCount="1697" Body="&lt;p&gt;If I have a wav file with this characteristics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;16bits (2 Bytes per Sample)&lt;/li&gt;&#xA;&lt;li&gt;32000 Sampling Rate&lt;/li&gt;&#xA;&lt;li&gt;60 Seconds&lt;/li&gt;&#xA;&lt;li&gt;2 Channels&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;then I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Samples Per Channel: 32000*60 = 1920000&#xA;Samples Per File: 32000*60*2 = 3840000&#xA;Bytes Per File: 32000*60*2*2 = 7680000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's a huge file!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change my file Characteristics to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;8bits (1 Byte per Sample)&lt;/li&gt;&#xA;&lt;li&gt;8000 Sampling Rate&lt;/li&gt;&#xA;&lt;li&gt;60 Seconds&lt;/li&gt;&#xA;&lt;li&gt;1 Channel&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;then I have:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Samples Per Channel: 8000*60 = 480000&#xA;Samples Per File: 8000*60*1 = 480000&#xA;Bytes Per File: 8000*60*1*1 = 480000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If my FFT 2^12 = 4096 or 2^16 = 65536&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Do I need to calculate the FFT 480000 times?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Does each how many samples I need to calculate the FFT?&lt;/strong&gt;  (480000 - 65536 = &lt;strong&gt;414464?&lt;/strong&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is the suitable calculus?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to do to show the spectrum?&lt;/p&gt;&#xA;" OwnerUserId="12165" LastEditorUserId="12165" LastEditDate="2014-12-24T20:07:48.240" LastActivityDate="2015-01-27T22:23:52.033" Title="FFT calculation suitable, Wav File, Java" Tags="|fft|audio|wave|java|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19732" PostTypeId="2" ParentId="19713" CreationDate="2014-12-24T22:34:53.007" Score="0" Body="&lt;p&gt;I would suggest looking into Adaptive Signal Processing techniques like RLS.&#xA;&lt;a href=&quot;http://researchtrend.net/ijet21/ijetnew/9%20Binod%20K.pdf&quot; rel=&quot;nofollow&quot;&gt;http://researchtrend.net/ijet21/ijetnew/9%20Binod%20K.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Component separation with ICA is possible provided the signal sources have the following characteristics.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;They are non-gaussian.&lt;/li&gt;&#xA;&lt;li&gt;Statistically independent from each other.&lt;/li&gt;&#xA;&lt;li&gt;Time of Arrival are approximately the same.&lt;/li&gt;&#xA;&lt;li&gt;Number of signal sources is at-least as large of number of estimated components.(You  will have to account for the noise in the echo signal)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The drawbacks are the correct ordering of the estimated components, scaling and sign cannot be determined with ICA.&lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2014-12-24T22:34:53.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19734" PostTypeId="2" ParentId="4723" CreationDate="2014-12-25T07:06:19.867" Score="11" Body="&lt;p&gt;Think of this... Imagine a drum which you are beating repeatedly to hear the music right? Your drum stick will land on the membrane for the first time and due to the impact it will vibrate. When you strike for the second time, the first impact's vibration has already decayed, to some extent. So whatever sound you will hear is the current beating and sum of the decayed response of previous impacts. So if &lt;span class=&quot;math-container&quot;&gt;$x(k)$&lt;/span&gt; is the impact force on &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; th moment, then the impact will be&#xA;Force * Impact time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x(k)dk$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$dk$&lt;/span&gt; is infinitesimaly small time of impact&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you are hearing the sound @ &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; , then the elapsed time will be &lt;span class=&quot;math-container&quot;&gt;$t-k$&lt;/span&gt; ,&#xA;suppose if the membrane of the drum has a decay effect , defined by a function &lt;span class=&quot;math-container&quot;&gt;$h(u)$&lt;/span&gt; , where &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; is elapsed time, in our case &lt;span class=&quot;math-container&quot;&gt;$t-k$&lt;/span&gt; , so the response of impact @ &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; will be &lt;span class=&quot;math-container&quot;&gt;$h(t-k)$&lt;/span&gt;. So the effect of &lt;span class=&quot;math-container&quot;&gt;$x(k)dk$&lt;/span&gt; at time t will be multiplication of both, i.e. &lt;span class=&quot;math-container&quot;&gt;$x(k)h(t-k)dk$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the overall effect of the music we hear will be &#xA;the integrated effect of all the impacts.&#xA;That too from negative infinity to plus infinity.&#xA;Which is what is known as convolution.&lt;/p&gt;&#xA;" OwnerUserId="40239" LastEditorUserId="40239" LastEditDate="2019-11-21T15:18:48.997" LastActivityDate="2019-11-21T15:18:48.997" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19735" PostTypeId="2" ParentId="19554" CreationDate="2014-12-25T10:15:07.037" Score="-1" Body="&lt;p&gt;The math behind &lt;a href=&quot;http://en.wikipedia.org/wiki/Optical_flow&quot; rel=&quot;nofollow&quot;&gt;optical flow&lt;/a&gt; is the same, as in &lt;a href=&quot;http://en.wikipedia.org/wiki/Lucas%E2%80%93Kanade_method&quot; rel=&quot;nofollow&quot;&gt;Lucas-Kanade&lt;/a&gt; tracker. The only difference, that tracking is usually applied to window or patch, and OF - for full image. So optical flow is motion tracking for whole image.&lt;/p&gt;&#xA;" OwnerUserId="7030" LastActivityDate="2014-12-25T10:15:07.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19737" PostTypeId="2" ParentId="19554" CreationDate="2014-12-25T11:30:46.387" Score="6" Body="&lt;p&gt;There are two versions of optical flow(OF): Feature based (sparse) or dense. In the dense version OF is applied to all the image pixels, while in the sparse one, only certain characteristic feature points are tracked. However, both approaches depend on the tracking of pixel quantities. This is fundamentally different than tracking the whole patch, because in return one obtains a full set of pixel-level correspondences. This is not just a vague statement, but rather carries the idea that the correspondence estimation is not constrained. Remember in the motion case, one would assume that the motion is &quot;rigid&quot; or &quot;articulated&quot; and imposes this prior into the tracking framework. If optical flow is used to estimate the dense trajectories, than this constraint is not assumed and one could as well track the deformable bodies, regardless of the deformation model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Optical flow provides you more freedom and information about the tracked scene. Yet, my experience is that the motion tracking methods are more robust and reliable. But keep in mind that, by applying human models or temporal models on top of such tracked trajectories (from OF) researchers are capable of developing robust articulated / deformable / model-based tracking algorithms.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2016-11-04T21:38:32.593" LastActivityDate="2016-11-04T21:38:32.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19738" PostTypeId="1" AcceptedAnswerId="19739" CreationDate="2014-12-25T13:12:02.243" Score="0" ViewCount="3592" Body="&lt;p&gt;I have implemented SVM by openCV. However, I have a problem about SVM with openCV. For example, I have six categories, but I just use &quot;five&quot; of them to train my SVM. When testing, I want my system which can find out the sixth category is not belong to any category in the system. I think that I can use a threshold to decide whether the result is belong to this category, namely whether the distance is short enough. But, I have no idea to implement my thought by openCV. Is there anyone who can help me? Thank you very much. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I have implemented the One_Class for SVM by openCV. I implemented this part in Bag of Word.&#xA;The following is my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::Mat dictionary; &#xA;cv::FileStorage fs(&quot;D:\\photo\\dictionary.yml&quot;, cv::FileStorage::READ);&#xA;fs[&quot;vocabulary&quot;] &amp;gt;&amp;gt; dictionary;  //load vocabulary into dictionary&#xA;fs.release();  &#xA;&#xA;cv::Ptr&amp;lt;cv::DescriptorMatcher&amp;gt; matcher = cv::DescriptorMatcher::create(&quot;FlannBased&quot;);&#xA;cv::Ptr&amp;lt;cv::DescriptorExtractor&amp;gt; extractor = new cv::SiftDescriptorExtractor();&#xA;cv::BOWImgDescriptorExtractor bowDE(extractor, matcher); &#xA;//dextractor – Descriptor extractor that is used to compute descriptors for an input image and its keypoints.&#xA;//dmatcher – Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image.&#xA;//int dictionarySize=100;&#xA;&#xA;bowDE.setVocabulary(dictionary); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I extract the feature of each image in my file and find theirs representation about BoW. I only extract one object's image for different view angle. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cout&amp;lt;&amp;lt;&quot;extracting histograms in the form of BOW for each image &quot;&amp;lt;&amp;lt;endl;&#xA;cv::Mat labels(0, 1, CV_32FC1);&#xA;cv::Mat trainingData(0, dictionarySize, CV_32FC1);&#xA;vector&amp;lt;cv::KeyPoint&amp;gt; keypoint1;&#xA;cv::Mat bowDescriptor1;&#xA;std::vector&amp;lt;cv::KeyPoint&amp;gt; keypoints;&#xA;cv::Mat sifts;&#xA;//start training&#xA;cv::Mat trainImage;&#xA;long double angleNum[8]={-7, -14, -21, -28, 7, 14, 21, 28};&#xA;&#xA;long double f=1 //only extract one object's  &#xA;    for(int i=0;i&amp;lt;8;i++)&#xA;    {        &#xA;        //create the file name of an image&#xA;        std::string fileNum=std::to_string(f);&#xA;        std::string fileNum1=std::to_string(angleNum[i]);&#xA;        //open the file&#xA;        trainImage=cv::imread(&quot;D:\\BoW\\&quot;+fileNum+&quot;_&quot;+fileNum1+&quot;.bmp&quot;, CV_LOAD_IMAGE_GRAYSCALE); //Load as grayscale&#xA;&#xA;        //detect feature points&#xA;        cv::SIFT siftDetectorExtractor;&#xA;        siftDetectorExtractor(trainImage,cv::Mat(), keypoints, sifts); &#xA;        bowDE.compute(trainImage , keypoints, bowDescriptor1);&#xA;        trainingData.push_back(bowDescriptor1);&#xA;        labels.push_back((float) f);&#xA;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, I want to use One_class SVM by openCV to identify whether the image is belong to the same training object.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::SVMParams params;&#xA;cv::SVM svm;&#xA;params.kernel_type = cv::SVM::LINEAR ;&#xA;params.svm_type = cv::SVM::ONE_CLASS;&#xA;params.nu=0.0001;&#xA;params.term_crit= cv::TermCriteria(CV_TERMCRIT_ITER, 500, 1e-6);&#xA;&#xA;bool ForSVM=svm.train(trainingData, labels, cv::Mat(),cv::Mat(), params);&#xA;&#xA;cout&amp;lt;&amp;lt;&quot;Processing evaluation data...&quot;&amp;lt;&amp;lt;endl;&#xA;cv::Mat groundTruth(0, 1, CV_32FC1);&#xA;cv::Mat evalData(0, dictionarySize, CV_32FC1);&#xA;k=0;&#xA;std::vector&amp;lt;cv::KeyPoint&amp;gt; keypoints2; //save keypoint extract from input image&#xA;cv::Mat bowDescriptor2; //save BoWdescriptor for inputimage&#xA;cv::Mat results(0, 1, CV_32FC1);;&#xA;cv::Mat testingimg; &#xA;float response;&#xA;long double f=1;&#xA;for(int i=0;i&amp;lt;8;i++)&#xA;{&#xA;    //create the file name of an image&#xA;    std::string fileNum=std::to_string(f);&#xA;    std::string fileNum1=std::to_string(angleNum[i]);&#xA;    //open the file&#xA;    testingimg=cv::imread(&quot;D:\\BoW\\&quot;+fileNum+&quot;_&quot;+fileNum1+&quot;.bmp&quot;, CV_LOAD_IMAGE_GRAYSCALE); //Load as grayscale&#xA;&#xA;    cv::SIFT siftDetectorExtractor;&#xA;    siftDetectorExtractor(testingimg,cv::Mat(), keypoints2, sifts);&#xA;    //detector.detect(img2, keypoint2);&#xA;    bowDE.compute(testingimg, keypoints2, bowDescriptor2);&#xA;    evalData.push_back(bowDescriptor2);&#xA;    //groundTruth.push_back((float) i);&#xA;&#xA;    response = svm.predict(bowDescriptor2); // predict a class of a new input image&#xA;    cout&amp;lt;&amp;lt;&quot;result&quot;&amp;lt;&amp;lt;(int)i&amp;lt;&amp;lt;&quot; = &quot;&amp;lt;&amp;lt;response&amp;lt;&amp;lt;endl;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the final version that identify whether the image is belong to the same training object. And the result is correct.&lt;/p&gt;&#xA;" OwnerUserId="11826" LastEditorUserId="7338" LastEditDate="2015-07-29T21:25:28.390" LastActivityDate="2015-07-29T21:25:28.390" Title="How to detect the exception by SVM with openCV" Tags="|image-processing|opencv|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19739" PostTypeId="2" ParentId="19738" CreationDate="2014-12-25T14:48:29.710" Score="2" Body="&lt;p&gt;This is called novelty detection. One-Class SVM is used, where the test data is classified only with regard to membership to the training data. The separating hyperplane lies around the training data and thereby implicitly divides the training data from the rejection class. The advantage is that the rejection class is not defined explicitly, which is difficult to do in certain applications like texture classification or as in your case. The resulting support vectors are all lying at the border. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;OpenCV has one-class implemented and it is in the documentation &lt;a href=&quot;http://docs.opencv.org/trunk/modules/ml/doc/support_vector_machines.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Use the option &lt;code&gt;SVM::ONE_CLASS&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also other SVM libraries you can use. &lt;a href=&quot;http://www.csie.ntu.edu.tw/~cjlin/libsvm/&quot; rel=&quot;nofollow&quot;&gt;LibSVM&lt;/a&gt; is a very good one and has a far better documentation. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-12-25T16:03:27.730" LastActivityDate="2014-12-25T16:03:27.730" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19740" PostTypeId="1" CreationDate="2014-12-25T17:03:19.637" Score="0" ViewCount="77" Body="&lt;p&gt;I want to make a programm that can detect the differences between two similar images of an automotive fusebox. The fusebox will be placed inside a jig and so will usually will be in the same position in all the photos taken (won't be rotated, scaled or shifted. There might be subtle differences in lighting throughout the day). Here's an example of a fusebox:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lc8Bt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the application: the system will 'learn' a good image and then compare all subsequent fusebox images and check against the good image weather or not this the fusebox was assembled properly. For instance, if a 20A fuse is not placed where it should be, the fusebox is not good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fuses themselves are colour coded, blue is always 15A and red is always 10A etc. The fuses we use don't have clear markings on them as shown in the above picture so I can't rely on that, so this leaves character recognition out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question now becomes, how do I compare? Should I use histogram based image similarity tests? Would a simple subtraction of the image-under-test from the reference image suffice?&lt;/p&gt;&#xA;" OwnerUserId="12173" LastActivityDate="2016-03-02T22:32:49.073" Title="Is this a image similarity problem?" Tags="|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19741" PostTypeId="2" ParentId="19740" CreationDate="2014-12-25T17:23:36.223" Score="2" Body="&lt;p&gt;I have developed a very similar system to do this. My algorithm was propriety, but luckily I am also aware of other well performing methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, there are many publicly available commercial packages, such as &lt;a href=&quot;http://www.vision-experts.hu/VFB-C40%20Fuse%20Box%20Inspection.pdf&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;. Yet, I would rather be informative on the algorithmic parts on how to implement such a system. According to my experimentation, one good algorithm is provided in the documentation of National Instruments Vision library. You can find it &lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/372916P-01/nivisionconcepts/color_pattern_matching/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/370281W-01/nivisionlvbasics/measure_color_statistics/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Their algorithm is also published:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Color characterization for image indexing and machine vision&#xA;Siming H. Lin, Dinesh Nair&#xA;Proc. SPIE 4116, Advanced Signal Processing Algorithms, Architectures, and Implementations X&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could also use other color similarity metrics. For that, I would refer to the surveys, such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Colour difference ∆E - A survey&#xA;Mokrzycki W.S., Tatol M.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Similarity and Dissimilarity Measures][4]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let me know in case you need more information.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-25T17:23:36.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19742" PostTypeId="1" CreationDate="2014-12-25T19:09:36.357" Score="0" ViewCount="30" Body="&lt;p&gt;Recently I learned that the DFT has good numerical stability since it can be represented as an orthogonal matrix, which has a condition number of 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to represent the STFT and DWT as matrices and asses their numerical stability using condition numbers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be specific and capable of comparing stability between STFT and DWT, the wavelet would need to be a sinusoid as shown here (also should have an imaginary portion):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XcTok.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12128" LastEditorUserId="12128" LastEditDate="2014-12-26T09:17:07.100" LastActivityDate="2014-12-26T09:17:07.100" Title="Are there condition numbers associated with the STFT, DWT?" Tags="|wavelet|dft|stft|matrix|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19743" PostTypeId="1" CreationDate="2014-12-25T21:01:01.220" Score="1" ViewCount="346" Body="&lt;p&gt;In the derivation of the minimum shift keying in-phase and quadrature components in Simon-Haykin Communication Systems 4th ed (p.387-390) we start off with the definition of the signal to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ s(t) $= $\sqrt {2E_b/T_b}$ $\cos(2\pi f_c t+\theta(t))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta(t) $ = $\theta(0) $ $\ \pm $ $\ \frac {\pi}{2T_b} t $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\theta(0) $ is the phase of previous bit and $\ 0 &amp;lt;= t &amp;lt;=T_b$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but in the subsequent steps :&#xA;for the in-phase component,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ s_I $=$\ \pm $ $\sqrt {2E_b/T_b}$ $\cos( \frac {\pi}{2T_b} t )$ and $\ -T_b &amp;lt;= t &amp;lt;=T_b$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the quadrature-phase component,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ s_Q $=$\ \pm $ $\sqrt {2Eb/Tb}$ $\sin( \frac {\pi}{2T_b} t )$ and $\ 0 &amp;lt;= t &amp;lt;= 2T_b$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How did this change of the limits of t change from $\ 0 &amp;lt;= t &amp;lt;=T_b$ to $\ -T_b &amp;lt;= t &amp;lt;=T_b$ or $\ 0 &amp;lt;= t &amp;lt;= 2T_b$ ? How are we allowed to extend the definition like that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="12175" LastEditorUserId="12175" LastEditDate="2014-12-26T01:47:06.860" LastActivityDate="2014-12-26T01:47:06.860" Title="Minimum Shift Keying (In-phase, Quadrature Components derivation)" Tags="|modulation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19745" PostTypeId="2" ParentId="19740" CreationDate="2014-12-26T06:56:01.073" Score="0" Body="&lt;p&gt;Histogram is dependent on the luminosity factor. Since as you mentioned there will be changes in lighting conditions, histogram based methods may not yield the best results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try looking at a combination of image segmentation and color characterization.  &lt;/p&gt;&#xA;" OwnerUserId="8132" LastActivityDate="2014-12-26T06:56:01.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19746" PostTypeId="2" ParentId="18354" CreationDate="2014-12-26T07:00:59.477" Score="0" Body="&lt;p&gt;If you have the prior information about the desired signal then using Adaptive filters to remove noise of varying characteristics would be the best approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if you want to use adaptive filters but do not have prior information about the desired signal then see if there are any characteristics in the system which can provide you the prior information about the noise. You can then use a feed forward system to reduce the noise.   &lt;/p&gt;&#xA;" OwnerUserId="8132" LastActivityDate="2014-12-26T07:00:59.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19747" PostTypeId="2" ParentId="4723" CreationDate="2014-12-26T07:05:15.240" Score="1" Body="&lt;p&gt;The way you hear sound in a given environment (room, open space etc) is a convolution of audio signal with the impulse response of that environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case the impulse response represents the characteristics of the environment like audio reflections, delay and speed of audio which varies with temperature.&lt;/p&gt;&#xA;" OwnerUserId="8132" LastActivityDate="2014-12-26T07:05:15.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19748" PostTypeId="2" ParentId="19300" CreationDate="2014-12-26T07:08:46.427" Score="0" Body="&lt;p&gt;The basis functions in Fourier Transform are Sine and Cosine. You shouldn't really be surprised that Sin function appeared in your analysis of a complex signal.&lt;/p&gt;&#xA;" OwnerUserId="8132" LastActivityDate="2014-12-26T07:08:46.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19749" PostTypeId="2" ParentId="19685" CreationDate="2014-12-26T07:11:07.230" Score="-1" Body="&lt;p&gt;Try the &lt;code&gt;FDAtool&lt;/code&gt; in MATLAB to experiment with various possible solutions. &lt;/p&gt;&#xA;" OwnerUserId="8132" LastEditorUserId="7092" LastEditDate="2014-12-26T16:10:49.560" LastActivityDate="2014-12-26T16:10:49.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19751" PostTypeId="2" ParentId="19300" CreationDate="2014-12-26T09:01:27.563" Score="1" Body="&lt;p&gt;A triangular function can be generated by convolving two box functions as shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pLKB8.gif&quot; alt=&quot;Convolution&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where your Step 2 comes from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fourier transform of a convolution $g(t) \ast g(t)$ can be calculated by multiplying the fourier transform of $g(t)$ with itself, i.e. $G(\omega)G(\omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that the Fourier transform of a box function is a Sinc function ($\textrm{sinc}(x) = \frac{\textrm{sin}(x)}{x}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m8GyY.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, $G(w)$ is some scaled version of a sinc function, and the Fourier transform of the triangular function is $G(w)^2$. &lt;/p&gt;&#xA;" OwnerUserId="12128" LastEditorUserId="12128" LastEditDate="2014-12-26T09:07:51.080" LastActivityDate="2014-12-26T09:07:51.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19752" PostTypeId="2" ParentId="19730" CreationDate="2014-12-26T09:44:41.653" Score="1" Body="&lt;p&gt;To show only one spectrum then FFT of the whole sample could be done.But for better result you could take a window and take FFT. For taking windows of 4096 with 50% overlap then it is equivalent to doing FFT&lt;br&gt;&#xA;no of times&#xA;$$&#xA;\frac{480000}{4096*0.5}&#xA;$$&#xA;times that is equivalent to&#xA;$$&#xA;\frac{Total\hspace{1mm} sample\hspace{1mm} length}{(window \hspace{1mm}length)*(amount\hspace{1mm} of\hspace{1mm} overlap)}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2014-12-26T09:44:41.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19753" PostTypeId="1" AcceptedAnswerId="19754" CreationDate="2014-12-26T11:52:05.073" Score="0" ViewCount="78" Body="&lt;p&gt;I have the following difference equation:&#xA;$y[n]=y[n-2]-0.25y[n-4]+x[n]-x[n-2]$&#xA;I need to find the first 6 values of the impulse response of the system characterized by that equation. When I do that, the values I get are:&#xA;$[1,0,0,0,-0.25,0]$, starting from index zero. I have the answer, which states that the right response is $[1,0,0,0,-0.25,1]$. I really cannot find my mistake; any help will be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="12179" LastActivityDate="2014-12-26T12:31:04.723" Title="Impulse response of a system" Tags="|homework|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19754" PostTypeId="2" ParentId="19753" CreationDate="2014-12-26T12:31:04.723" Score="-1" Body="&lt;p&gt;Answers in textbooks are not necessarily right.. I have got the same answer as you ;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not sure that your method is right, you can always test digital systems on your PC (matlab, scilab, python, octave, or almost in any language )&lt;/p&gt;&#xA;" OwnerUserId="11208" LastActivityDate="2014-12-26T12:31:04.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19755" PostTypeId="1" AcceptedAnswerId="27804" CreationDate="2014-12-26T13:51:18.967" Score="2" ViewCount="281" Body="&lt;p&gt;I'm trying to estimate what would be the result of first performing an histogram equalisation on an image, and then compressing it using JPEG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that histogram equalisation increases the contrast in the image.&#xA;I also know the jpeg reduces the size of the image by removing the high frequencies from the frequency domain. Thus, it seems reasonable to me that performing histogram equalisation first would result in loosing more information, as it would increase the higher frequencies in the photo only for them to be later removed by jpeg.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct? If no, what am I missing?&lt;/p&gt;&#xA;" OwnerUserId="11798" LastActivityDate="2017-01-12T16:37:52.597" Title="Performing image equalisation and then Jpeg compression" Tags="|equalization|jpeg|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19756" PostTypeId="1" CreationDate="2014-12-26T15:46:42.043" Score="2" ViewCount="3913" Body="&lt;p&gt;What is the purpose of normalizing the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have two signals on hand, how is it used when comparing these two signals?&lt;/p&gt;&#xA;" OwnerUserId="9014" LastEditorUserId="7338" LastEditDate="2014-12-26T16:54:21.297" LastActivityDate="2015-03-12T06:54:20.037" Title="Normalization purpose in signal processing" Tags="|discrete-signals|fourier-transform|signal-analysis|frequency-spectrum|noise|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19757" PostTypeId="2" ParentId="19756" CreationDate="2014-12-26T16:35:32.213" Score="1" Body="&lt;p&gt;Normalization is basically bringing the two signals to the same range or a predefined range. A typical example of a &lt;code&gt;predefined range&lt;/code&gt; is the statistical perception of the normalization, which is transforming the signal so that its mean is $0$ and standard deviation is $1$. After such transform the &lt;em&gt;canonical form&lt;/em&gt; is obtained. In layman's terms, such the operation consists of subtracting the minimum value and dividing by the range (difference between the maximum and minimum values).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transforming all signals to such canonical form eases and robustifies the process of comparisons as well as serving too different needs such as visualization, and analysis. If we are to speak in terms of image normalization the effect would be the following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Un-normalized:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MvQIN.jpg&quot; alt=&quot;Un-normalized&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalized:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GgDjC.jpg&quot; alt=&quot;Normalized&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, the distinction between the colors is clearer and more apparent.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-12-26T16:52:28.387" LastActivityDate="2014-12-26T16:52:28.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19760" PostTypeId="1" CreationDate="2014-12-27T10:13:16.403" Score="0" ViewCount="106" Body="&lt;p&gt;I am looking for a data structure, that can be used for description of a floor plan of a building. Its not about the format, I am asking about any other way to describe the floor plan of building, rather than in traditional map-based structure, preferably in some sort of tree or graph based structure, which can be derived from a text based description of the house.&lt;/p&gt;&#xA;" OwnerUserId="7914" LastEditorUserId="7914" LastEditDate="2014-12-30T09:58:51.577" LastActivityDate="2014-12-30T13:12:38.010" Title="Is there any research work on the possible data structures that can be used to represent an architectural design of a building?" Tags="|image-processing|3d|" AnswerCount="1" CommentCount="2" ClosedDate="2015-01-05T22:48:43.277" ContentLicense="CC BY-SA 3.0" />
  <row Id="19761" PostTypeId="2" ParentId="19760" CreationDate="2014-12-27T10:19:34.257" Score="1" Body="&lt;p&gt;DXF in computer aided design should already allow this representation. I would suggest you to check the format and adapt your data structures accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the data structures in &lt;a href=&quot;http://libdwg.sourceforge.net/en/&quot; rel=&quot;nofollow&quot;&gt;LibDWG&lt;/a&gt; and &lt;a href=&quot;https://github.com/bert/libdxf&quot; rel=&quot;nofollow&quot;&gt;LibDXF&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2014-12-30T13:12:38.010" LastActivityDate="2014-12-30T13:12:38.010" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19762" PostTypeId="1" CreationDate="2014-12-27T17:58:21.583" Score="0" ViewCount="67" Body="&lt;p&gt;Which algorithms should use to recognize handwriting numbers from an image? &lt;/p&gt;&#xA;" OwnerUserId="12139" LastActivityDate="2014-12-28T02:20:44.760" Title="How can Recognize handwriting number" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ClosedDate="2014-12-30T01:29:04.633" ContentLicense="CC BY-SA 3.0" />
  <row Id="19763" PostTypeId="1" CreationDate="2014-12-27T19:02:55.883" Score="0" ViewCount="66" Body="&lt;p&gt;How can I make predict state/equation for next state if I have state space $[C_x,C_y,H,W]$ where $C_x,C_y$ is position of centroid object and $H,W$ is height and width of object contour?&lt;/p&gt;&#xA;" OwnerUserId="12035" LastActivityDate="2014-12-27T19:02:55.883" Title="I'm confuse how to use pdf to predict next state in particle filter" Tags="|computer-vision|particle-filter|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19765" PostTypeId="1" AcceptedAnswerId="19766" CreationDate="2014-12-28T01:09:12.110" Score="0" ViewCount="2083" Body="&lt;p&gt;Given an LTI system of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{d}{dt}{x}(t) = {A} {x}(t) \ + \ {B} {u}(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where ${x}(t)$ is the state variable, ${u}(t)$ an input and ${A}$ and ${B}$ constants, how does one show, by superposition, that the system is linear? I've searched and searched and tried to do it myself and I am unable to do so. Seems more difficult that it seems. Most books seem to gloss over the fact.&lt;/p&gt;&#xA;" OwnerUserId="3648" LastEditorUserId="4346" LastEditDate="2014-12-28T20:07:17.947" LastActivityDate="2014-12-28T21:49:29.577" Title="Prove using superposition that an LTI system is linear" Tags="|continuous-signals|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19766" PostTypeId="2" ParentId="19765" CreationDate="2014-12-28T01:51:12.093" Score="2" Body="&lt;p&gt;I'm going to assume the system has the initial condition $x(0) = 0$, as otherwise the system isn't linear. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose the input $u_1(t)$ yields the output $x_1(t)$ and the input $u_2(t)$ yields the output $x_2(t)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to prove that the input $u(t) = \alpha u_1(t)+\beta u_2(t)$ yields the output $x(t) = \alpha x_1(t) + \beta x_2(t)$ for any scalars $\alpha$ and $\beta$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The given input and output pairs must satisfy the differential equation and the initial condition. Hence, $x_1'(t) = Ax_1(t)+Bu_1(t)$ and $x_2'(t) = Ax_2(t)+Bu_2(t)$ for all times $t$ and $x_1(0) = x_2(0) = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, add $\alpha$ times the first equation to $\beta$ times the second equation to get: $\alpha x_1'(t) + \beta x_2'(t) = \alpha(Ax_1(t)+Bu_1(t)) + \beta(Ax_2(t)+Bu_2(t))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, rearrange stuff to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dfrac{d}{dt}[\alpha x_1(t) + \beta x_2(t)] = A(\alpha x_1(t)+\beta x_2(t)) + B(\alpha u_1(t)+\beta u_2(t))$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x'(t) = Ax(t)+Bu(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, we have $x(0) = \alpha x_1(0)+\beta x_2(0) = \alpha \cdot 0 + \beta \cdot 0 = 0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the signals $u(t) = \alpha u_1(t)+\beta u_2(t)$ and $x(t) = \alpha x_1(t) + \beta x_2(t)$ satisfy the differential equation and the initial condition. Hence, the input $u(t) = \alpha u_1(t)+\beta u_2(t)$ yields the output $x(t) = \alpha x_1(t) + \beta x_2(t)$ for any inputs $u_1(t)$ and $u_2(t)$ and any scalars $\alpha$ and $\beta$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the system is linear, as desired. &lt;/p&gt;&#xA;" OwnerUserId="12177" LastActivityDate="2014-12-28T01:51:12.093" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19767" PostTypeId="2" ParentId="19762" CreationDate="2014-12-28T02:20:44.760" Score="2" Body="&lt;p&gt;Depends on where you're trying to implement/the resources available to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used &lt;a href=&quot;http://scikit-learn.org/stable/auto_examples/plot_digits_classification.html&quot; rel=&quot;nofollow&quot;&gt;Support Vector Machine learning&lt;/a&gt; for that task; you have to feed in individual characters to train your algo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;take a look at python's scikit-learn and if you ned to implement on FPGA check out: &lt;a href=&quot;http://www.myhdl.org/&quot; rel=&quot;nofollow&quot;&gt;MyHDL&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12189" LastActivityDate="2014-12-28T02:20:44.760" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19768" PostTypeId="1" CreationDate="2014-12-28T03:20:40.423" Score="1" ViewCount="6527" Body="&lt;p&gt;&lt;a href=&quot;http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html&quot; rel=&quot;nofollow&quot;&gt;OpenCV Motion Analysis Documentation&lt;/a&gt; lists multiple techniques for motion tracking:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sparse Optical Flow | &lt;a href=&quot;https://github.com/Itseez/opencv/blob/2.4.9.x-prep/samples/python2/lk_track.py&quot; rel=&quot;nofollow&quot;&gt;calcOpticalFlowPyrLK&lt;/a&gt;, &lt;/li&gt;&#xA;&lt;li&gt;Dense Optical Flow | &lt;a href=&quot;https://github.com/Itseez/opencv/blob/2.4.9.x-prep/samples/python2/opt_flow.py&quot; rel=&quot;nofollow&quot;&gt;calcOpticalFlowFarneback&lt;/a&gt;, and &lt;/li&gt;&#xA;&lt;li&gt;Motion History Image | &lt;a href=&quot;https://github.com/Itseez/opencv/blob/2.4.9.x-prep/samples/python2/motempl.py&quot; rel=&quot;nofollow&quot;&gt;calcMotionGradient, segmentMotion, calcGlobalOrientation&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I need help in understanding their pros and cons. Which ones should be preferred under what circumstances?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;:&#xA;I am trying to track lane departure/lane changes. Any abstract/generic response would be good enough. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12192" LastActivityDate="2016-09-19T23:20:16.783" Title="OpenCV Motion Analysis: Optical Flow vs Motion History" Tags="|computer-vision|opencv|python|motion-detection|optical-flow|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19769" PostTypeId="1" AcceptedAnswerId="19774" CreationDate="2014-12-28T20:39:26.403" Score="0" ViewCount="179" Body="&lt;p&gt;I have a periodic signal on a given grid, say (in matlab format):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = 1:30;&#xA;omega = 2*pi/18.431;&#xA;phi = -pi+2*pi*rand(1);   % a random phase [-pi,pi]&#xA;x = sin(omega*t+phi);     % the signal&#xA;x = x+0.5*rand(1,length(x)); % add some noise&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J5pw0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to retrieve the phase &lt;code&gt;phi&lt;/code&gt;. There are a few approaches to that, one is to use fft. The problem is that my grid is not good enough to pick that frequency, hence the phase. (another way is to fit to a &lt;code&gt;sin&lt;/code&gt;, but that takes way too long if I need to do it 1e6 times)&lt;br&gt;&#xA;I tried to implement the &quot;Autoregressive all-pole model parameters — Burg's method&quot; that is mention in &lt;a href=&quot;https://dsp.stackexchange.com/questions/101/how-do-i-extrapolate-a-1d-signal&quot;&gt;an answer to this question&lt;/a&gt;. I manage to pick up the frequency quite well, but fail to pick up the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was trying to use &lt;code&gt;angle(fft_vec(idx))&lt;/code&gt;, where &lt;code&gt;fft_vec&lt;/code&gt; is the spectrum obtained after extrapolating the original signal (using &lt;code&gt;arburg&lt;/code&gt;), and &lt;code&gt;idx&lt;/code&gt; is the index where the frequency &lt;code&gt;omega&lt;/code&gt; is picked up. What am I doing wrong? and how can I manage to get that phase by other means? &lt;/p&gt;&#xA;" OwnerUserId="12196" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2014-12-29T03:48:47.877" Title="retrieve phase of an extrapolated periodic 1D signal" Tags="|matlab|sampling|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19770" PostTypeId="1" CreationDate="2014-12-28T20:53:45.363" Score="1" ViewCount="99" Body="&lt;p&gt;Is this how the lowpass butterworth analog filter can be implemented?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fDJoh.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11628" LastActivityDate="2014-12-30T19:00:15.163" Title="Is this how the lowpass butterworth analog filter can be implemented?" Tags="|filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19771" PostTypeId="2" ParentId="19765" CreationDate="2014-12-28T21:49:29.577" Score="1" Body="&lt;p&gt;here is why, for a simple single-input, single-output (SISO) system, with no hidden states (i.e. completely controllable and completely observable), if superposition is known to be a valid property (called &lt;a href=&quot;https://en.wikipedia.org/wiki/Additive_function&quot; rel=&quot;nofollow&quot;&gt;&quot;additivity&quot;&lt;/a&gt; by the math guys, you can also show that the scaling property (called &lt;a href=&quot;https://en.wikipedia.org/wiki/Homogeneous_function#Linear_functions&quot; rel=&quot;nofollow&quot;&gt;&quot;homogeneous of degree 1&quot;&lt;/a&gt; by the math guys) of linearity is also the case for real and rational scalers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you need to do a little hand-waving regarding continuity to extend this to the irrational scalers, because you can always get arbitrarily close to any irrational number with a rational one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so let's say that $T\{ \cdot \}$ is something that transforms an input $x(t)$ into an output $y(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = T\{ x(t) \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this is true for all possible $x_1(t)$ and $x_2(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\{ x_1(t) + x_2(t) \} = T\{ x_1(t) \} + T\{ x_2(t) \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now suppose $x_2(t) = x_1(t) = x(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\{ x(t) + x(t) \} = T\{ x(t) \} + T\{ x(t) \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\{ 2 \ x(t) \} = 2 \ T\{ x(t) \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so you've just proved the linear scaling property for the real scaler $2$.  how would you go about proving it for $3$?  and then $4$?  and then for &lt;em&gt;any&lt;/em&gt; positive integer $N$?  (it's called &quot;proof by induction&quot; and it's easy.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we're able to easily prove that superposition implies linear scaling for positive integers (and easily extended to all real integers):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\{ N \ x(t) \} = N \ T\{ x(t) \} \quad \quad N \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now how about this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\left\{ \frac{1}{M} \ x(t) \right\} = ?? \quad \quad M \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;define&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_M(t) \triangleq \frac{1}{M} \ x(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we know that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\left\{ M \ x_M(t) \right\} = M \ T\left\{ x_M(t) \right\} \quad \quad M \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but we also know that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\left\{ x_M(t) \right\} = T\left\{\frac{1}{M} \ x(t) \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\left\{ M \ x_M(t) \right\} = T\left\{M \ \frac{1}{M} \ x(t) \right\} = T\{ x(t) \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then we know that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\left\{ M \ x_M(t) \right\} = T\{ x(t) \} = M \ T\left\{ \frac{1}{M} \ x(t) \right\} \quad \quad M \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\left\{ \frac{1}{M} \ x(t) \right\} = \frac{1}{M} \ T\{ x(t) \} \quad \quad M \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so now we proved linear scaling for any reciprocal of an integer.  sohow do you think we might do this form the general rational scaler $\frac{N}{M}$ where $N,M \in \mathbb{Z}$?  i don't think it takes Einstein to see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\left\{ \frac{N}{M} \ x(t) \right\} = \frac{N}{M} \ T\{ x(t) \} \quad \quad N,M \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, just given superposition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\{ x_1(t) + x_2(t) \} = T\{ x_1(t) \} + T\{ x_2(t) \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we know that scaling is also true&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\{ \alpha x \} = \alpha \ T\{ x(t) \}  \quad \quad \alpha = \frac{N}{M} \quad N,M \in \mathbb{Z}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we know that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T\left\{ \sum\limits_{i} \alpha_i x_i(t) \right\} = \sum\limits_{i} \alpha_i T \{ x_i(t) \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where all $\alpha_i$ are rational.  for the irrational $\alpha$, one must make an additional (and reasonable) assumption about the transform mapping $T\{\cdot\}$, that it is continuous, so that as rational $\alpha$ gets closer and closer to a irrational target (and changes very little), the behavior of $T\{\cdot\}$ will also change very little.  i'm not gonna deal with that now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but, from just a little thinking, it's clear that, at least for real and rational scalers, superposition implies linear scaling and then the whole of linearity in general.  (says nothing about time-invariance, which is a whole 'nother property.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2014-12-28T21:49:29.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19772" PostTypeId="2" ParentId="19730" CreationDate="2014-12-28T21:59:30.860" Score="1" Body="&lt;p&gt;If you want to see how the spectrum is changing over time, which is what it sounds like you want to do, then don't do it for every sample - it's too much information and too much calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A rule of thumb I use is to calculate the Fourier Transform every 0.05 seconds, since this is roughly the human ear's temporal resolution. In your case, at a sampling frequency of 8kHz, that's a FT every 400 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also don't need to use the entire 60 seconds of data for each FT. A common technique here is to do a &lt;a href=&quot;http://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;short-time FT&lt;/a&gt; - i.e. each point in time that you want to calculate the spectrum for you use a data 'window' of a certain sample size (e.g. 4096 samples). Also consider multiplying each 'window' of data by a &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window function&lt;/a&gt; to reduce spectral leakage.&lt;/p&gt;&#xA;" OwnerDisplayName="user8798" LastActivityDate="2014-12-28T21:59:30.860" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19773" PostTypeId="2" ParentId="19768" CreationDate="2014-12-28T23:29:58.500" Score="2" Body="&lt;p&gt;Farneback is a dense optical flow algorithm. This means, it outputs the flow vectors per each pixel (which can be tracked). LK is a sparse variant, tracking only certain feature points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motion segmentation algorithms generally target estimation of foreground or background and doesn't allow establishing correspondences. Please refer to &lt;a href=&quot;https://dsp.stackexchange.com/questions/19554/why-optical-flow-why-not-tracking/19737#19737&quot;&gt;this post&lt;/a&gt;. You will find more details in my response.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2014-12-29T07:39:04.357" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19774" PostTypeId="2" ParentId="19769" CreationDate="2014-12-29T03:32:05.463" Score="1" Body="&lt;p&gt;if you know, in advance, the frequency of the sinusoid, so only the phase (and perhaps the amplitude) is unknown, the simplest noise-immune method i know of to get amplitude and phase is (i'm gonna do this in continuous time and let you translate it to discrete time and eventually to MATLAB):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \sin(\omega t + \phi) + n(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;compute&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;a &amp;amp; = \int\limits_0^{\frac{2 \pi}{\omega}} x(t) \sin(\omega t) dt \\&#xA;&amp;amp; = \int\limits_0^{\frac{2 \pi}{\omega}} \left(\sin(\omega t + \phi) + n(t) \right) \sin(\omega t) dt \\&#xA;&amp;amp; = \int\limits_0^{\frac{2 \pi}{\omega}} \sin(\omega t + \phi) \sin(\omega t) dt + \int\limits_0^{\frac{2 \pi}{\omega}} n(t) \sin(\omega t) dt \\&#xA;&amp;amp; = \frac{1}{2} \int\limits_0^{\frac{2 \pi}{\omega}} \cos(\phi) dt - \frac{1}{2} \int\limits_0^{\frac{2 \pi}{\omega}} \cos(2\omega t + \phi) dt + \int\limits_0^{\frac{2 \pi}{\omega}} n(t) \sin(\omega t) dt \\&#xA;&amp;amp; \approx \frac{1}{2} \int\limits_0^{\frac{2 \pi}{\omega}} \cos(\phi) dt \\&#xA;&amp;amp; = \frac{\pi}{\omega} \cos(\phi)  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;b &amp;amp; = \int\limits_0^{\frac{2 \pi}{\omega}} x(t) \cos(\omega t) dt \\&#xA;&amp;amp; = \int\limits_0^{\frac{2 \pi}{\omega}} \left(\sin(\omega t + \phi) + n(t) \right) \cos(\omega t) dt \\&#xA;&amp;amp; = \int\limits_0^{\frac{2 \pi}{\omega}} \sin(\omega t + \phi) \cos(\omega t) dt + \int\limits_0^{\frac{2 \pi}{\omega}} n(t) \cos(\omega t) dt \\&#xA;&amp;amp; = \frac{1}{2} \int\limits_0^{\frac{2 \pi}{\omega}} \sin(\phi) dt + \frac{1}{2} \int\limits_0^{\frac{2 \pi}{\omega}} \sin(2\omega t + \phi) dt + \int\limits_0^{\frac{2 \pi}{\omega}} n(t) \cos(\omega t) dt \\&#xA;&amp;amp; \approx \frac{1}{2} \int\limits_0^{\frac{2 \pi}{\omega}} \sin(\phi) dt  \\&#xA;&amp;amp; = \frac{\pi}{\omega} \sin(\phi)  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in both expressions (on the bottom line) we know the middle integral is zero and expect the integral on the right to tend toward zero because $n(t)$ is bipolar and ain't correlated with anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i think, then, that you'll find the phase $\phi$ to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \phi = \arg\left\{a + jb \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is, if $a&amp;gt;0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \phi = \arctan\left(\frac{b}{a} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;otherwise, you might have to add or subtract $\pi$ to that expression.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2014-12-29T03:48:47.877" LastActivityDate="2014-12-29T03:48:47.877" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19776" PostTypeId="1" CreationDate="2014-12-29T05:10:11.433" Score="1" ViewCount="1684" Body="&lt;p&gt;I read that the window is needed to apply filter (Low Pass, High Pass, Band Pass or band Stop),  but not for the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. &#xA;What advantage does apply a window or disadvantage does not apply?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. &#xA;What is the criteria to choose the size (My LengthW:Length of Han Window)?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Where I can find literature that specifically?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;My code:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose an array of samples stored in&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;integer SIZE = 16384; //SomeValue&#xA;short[] sSamples = new short[SIZE];&#xA;sSamples = obtainSamples();  //Some method to fill my array&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I need to obtain my FFT.&#xA;I arbitrarily chose 4096 for my FFT, then are 8 times (or 8 fft's)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFTLength = 4096;&#xA;SIZE = 16384;&#xA;double Overlap = 0.5;&#xA;SIZE/(FFTLength*Overlap) = 8;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;DIRECT METHOD:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;complex cSamples = new complex[SIZE];&#xA;cSamples = short2Complex(sSamples);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I need to obtain part of array of sample 8 arrays of length:SIZE/4&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//getPartArray(from, until) maybe like System.ArrayCopy&#xA;complex[] cSamples00 = getPartArray(0,4095);&#xA;complex[] cSamples01 = getPartArray(4096,8191);&#xA;//similarly for all, from 00 until 07&#xA;complex[] cSamples01 = getPartArray(12287,16383);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, Obatin the FFT&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//fft(complex[], length)&#xA;complex[] cFFT00 = fft(cSamples00,4096);&#xA;//similarly for all, from 00 until 07&#xA;complex[] cFFT07 = fft(cSamples00,4096);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;WINDOWED METHOD:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//int LengthW = ??  // (besides positive and odd)&#xA;double[] Wn = new double[LengthW];&#xA;//Suppose Han Window,can be Hamming, Kaiser, Blackman, etc&#xA;Wn = obtainHanWindow(LengthW);&#xA;double[] sWindowedSamples = applyingWindow(Wn,sSamples);&#xA;&#xA;complex cSamples = new complex[SIZE];&#xA;cSamples = short2Complex(sWindowedSamples);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I need to obtain part of array of sample 8 arrays of length:SIZE/4&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//getPartArray(from, until) maybe like System.ArrayCopy&#xA;complex[] cSamples00 = getPartArray(0,4095);&#xA;complex[] cSamples01 = getPartArray(4096,8191);&#xA;//similarly for all, from 00 until 07&#xA;complex[] cSamples01 = getPartArray(12287,16383);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, Obatin the FFT&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//fft(complex[], length)&#xA;complex[] cFFT00 = fft(cSamples00,4096);&#xA;//similarly for all, from 00 until 07&#xA;complex[] cFFT07 = fft(cSamples00,4096);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only difference is calculate a window and apply it to the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Definition's class and methods&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complex class is defined like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class complex {&#xA;  public double real = 0.0;&#xA;  public double imag = 0.0;&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;short2Complex:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;short2Complex(short[] intSSample) {&#xA;  complex intCSample = new complex[intSSample.length];&#xA;  for (int i = 0; i &amp;lt; intSSample.length; i++) {&#xA;    complex tcomplex = new complex();&#xA;    tcomplex.real = intSSample[i];&#xA;    intCSample[i] = tcomplex;&#xA;  }&#xA;  return intCSample;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;obtainHanWindow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double[] obtainHanWindow(int Size) {&#xA;  //Size must be Odd and Positive integer&#xA;  double[] dHan = new double[Size];&#xA;  int HalfSize = (int)Math.floor((double)Size/2);&#xA;  for (int i = 0; i &amp;lt; HalfSize; i++) {&#xA;    int j = 2*HalfSize - i;&#xA;    double Pi2DivSize = 2.0*Math.PI/Size;&#xA;    dHan[i] = 0.5+0.5*Math.cos(Pi2DivSize*(double)(i - HalfSize));&#xA;    dHan[j] = 0.5+0.5*Math.cos(Pi2DivSize*(double)(HalfSize - i));&#xA;  }&#xA;  dHan[HalfSize] = 1.0;&#xA;  return dHan;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;applyingWindow&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;applyingWindow(double[] dWn, double[] dSamples) {&#xA;  double dOutput = new double[dSamples.length]&#xA;  for (int i=0; i &amp;lt; dWn.length; i++) {&#xA;    dOutput[i] = 0;&#xA;    for (int j=0; j &amp;lt; dSamples.length; j++) {&#xA;      if(i-j&amp;gt;=0) {&#xA;        dOutput[i] += dSamples[j]*dWn[i-j];&#xA;      }&#xA;    }&#xA;  }&#xA;  return dOutput;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12165" LastEditorUserId="12165" LastEditDate="2015-01-05T01:03:32.233" LastActivityDate="2015-01-05T01:03:32.233" Title="Is it necessary to apply some window method, to obtain the FFT? Java" Tags="|fft|window-functions|java|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19778" PostTypeId="2" ParentId="19776" CreationDate="2014-12-29T07:08:42.990" Score="0" Body="&lt;p&gt;Windowing is essential before performing FFT to ensure there is no spectral leakage. As FT works well with periodic data, data discontinuity can effect in spectral artifacts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ni.com/white-paper/4844/en/&quot; rel=&quot;nofollow&quot;&gt;http://www.ni.com/white-paper/4844/en/&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="8132" LastActivityDate="2014-12-29T07:08:42.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19779" PostTypeId="1" AcceptedAnswerId="19851" CreationDate="2014-12-29T08:53:34.547" Score="1" ViewCount="326" Body="&lt;p&gt;I am simulating a linear system described by the following equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$m \ddot{x} + c \dot{x} + k x = A \sin(\omega t)$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;      % sampling frequency&#xA;tspan = 0:1/Fs:10;&#xA;m = 25;&#xA;c = 15;&#xA;k = 330000;&#xA;A = 100;           % forcing amplitude&#xA;omega = 114.89;    % forcing frequency&#xA;&#xA;% State space function&#xA;odefun = @(t,u)[u(2); 1/m*(-k*u(1)-c*u(2)+A*sin(omega*t))];&#xA;&#xA;[time,u] = ode45(odefun,tspan,[0 0]);&#xA;&#xA;spost = u(:,1);    % displacement&#xA;vel = u(:,2);      % velocity&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I compute the FFT of the displacement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = length(spost);&#xA;NFFT = 2^nextpow2(L);&#xA;SPOST = fft(spost,NFFT)/L;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is what I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/displacement2.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/fft_displ2.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the maximum value of the displacement is different in the 2 cases, but this does not look right to me. In fact, if I run a structural analysis in the time or in the frequency domain I would expect to obtain the same maximum displacement (since the excitation frequency is equal to the resonance frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be explained?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I forgot to say I tried also increasing the simulation time, but still the 2 values do not match&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:36.247" LastActivityDate="2015-01-06T16:08:58.790" Title="system response: time vs frequency. Why do I get different magnitudes?" Tags="|matlab|fft|time-frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19782" PostTypeId="1" AcceptedAnswerId="19784" CreationDate="2014-12-29T14:26:05.080" Score="9" ViewCount="1885" Body="&lt;p&gt;I was reading a physics book and it said that when digitizing a signal white noise was added to improve the process. I don't understand how this works. Therefore my question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When digitizing an analogue signal, how can adding noise be beneficial&#xA;when combined with oversampling in time?&lt;/p&gt;&#xA;" OwnerUserId="12201" OwnerDisplayName="SiberianSloth" LastEditorUserId="7361" LastEditDate="2014-12-29T22:38:21.987" LastActivityDate="2014-12-30T19:09:53.910" Title="Improving Digitization by Adding White Noise Before Oversampling" Tags="|noise|digitize|dithering|" AnswerCount="5" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19783" PostTypeId="2" ParentId="19782" CreationDate="2014-12-29T15:45:41.160" Score="2" Body="&lt;p&gt;Dithering (intentionally adding noise) the input signal combined with oversampling &lt;strong&gt;can&lt;/strong&gt; (no guarantees!) improve the effective number of bits in the signal and increase the signal to noise ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the underlying process is a white noise process, the digitized signal will still look like white noise if the quantization level is well into the noise. This is in general a good thing. White noise has rather nice mathematical properties. Dealing with the non-linear, signal-dependent quantization noise is difficult. That quantization noise can generally be ignored if the quantization level is well into the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if the quantization level isn't well into the noise? Now you have messy quantization noise to deal with. One way to deal with it is to use a higher resolution ADC and make the quantization be well into noise. An alternative is to intentionally add white noise to the input signal so as to make the quantization noise from your cheap ADC small compared to the (dithered) signal noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to dither the input signal so that the noise in the dithered signal dominates over quantization noise (but obviously not by too much). The dithered signal is intentionally oversampled and then downsampled by averaging two or more successive measurements.  This averaging only buys something if the input signal is noisy compared to the quantization noise. Averaged quantization noise looks like quantization noise. Averaging white noise lets signal rise out of the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more, read Walt Kester's tutorial &lt;a href=&quot;http://www.analog.com/static/imported-files/tutorials/MT-004.pdf&quot; rel=&quot;nofollow&quot;&gt;The Good, the Bad, and the Ugly Aspects of ADC Input Noise—Is No Noise Good Noise?&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12203" OwnerDisplayName="David Hammen" LastActivityDate="2014-12-29T15:45:41.160" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19784" PostTypeId="2" ParentId="19782" CreationDate="2014-12-29T15:58:55.467" Score="5" Body="&lt;p&gt;Adding uncorrelated (i.e. white) noise to an analog signal prior to digitization is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Dither#In_digital_processing_and_waveform_analysis&quot; rel=&quot;noreferrer&quot;&gt;dithering&lt;/a&gt;.&#xA;To understand why we would do this we need to understand the idea of &lt;a href=&quot;http://en.wikipedia.org/wiki/Quantization_%28signal_processing%29#Quantization_noise_model&quot; rel=&quot;noreferrer&quot;&gt;quantization noise&lt;/a&gt;.&#xA;Consider an analog system which has signals ranging in amplitude from 0 to 100.&#xA;Suppose we digitize this signal with a digitizer whose digital levels are spaced by 1.&#xA;In other words, the possible digitized levels are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left\{ -100, -99, -98 \ldots 99, 100 \right\} \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose the analog signal $s(t)$ is a DC signal of value 0.8, in other words&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t) = 0.8 \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we put this into the digitizer, the digitizer will round it to 1 and our digital samples $s_n$ will be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_n = 1\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not good because now the our digital signal accumulates error as we acquire more signal.&#xA;The digitized level is &lt;em&gt;always&lt;/em&gt; too high so the longer we average the signal the more we over-estimate the analog level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding white noise helps fix this problem because it pushes the analog level around such that it crosses neighboring digitization levels.&#xA;Therefore, as  you average over a set of digitized values you actually get something which is close to the true analog level.&#xA;Let's see this via example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose the noise we add is Gaussian distributed with $\sigma=2$.&#xA;Then the distribution of the analog signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p(x)&#xA;\propto \exp \left[ \frac{-(x - s(t))^2}{2\sigma^2} \right]&#xA;= \exp \left[ \frac{-(x-0.8)^2}{8} \right] \, .&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now compute the average &lt;em&gt;digital&lt;/em&gt; value $\langle s_n \rangle$ by averaging $p(x)$ over the integers.&#xA;The normalization constant for the distribution is&#xA;$$N = \sum_{m=-100}^{100} \exp \left[ \frac{-(m-0.8)^2}{8} \right]$$&#xA;and so we have&#xA;$$\langle s_n \rangle =&#xA;\frac{1}{N}&#xA;\sum_{m=-100}^{100} m \exp\left[ \frac{-(m-0.8)^2}{8}\right] = 0.79999\ldots$$&#xA;Thus you can see that adding the white noise caused the average digitized signal to more closely match the true analog value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, adding the noise makes your signal to noise ratio worse.&#xA;That means to to actually have a high probability of measuring the $\langle s_n\rangle$ we just computed, you have to take more samples than you would think in the noiseless case.&#xA;This is why you hear about over-sampling and dithering at the same time.&#xA;Because the dithering noise is truly uncorrelated, taking more samples &lt;em&gt;always&lt;/em&gt; helps improve the signal to noise ratio, even if you're sampling way above the bandwidth of the analog signal coming in.&lt;/p&gt;&#xA;" OwnerUserId="7361" OwnerDisplayName="DanielSank" LastActivityDate="2014-12-29T15:58:55.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19785" PostTypeId="2" ParentId="19782" CreationDate="2014-12-29T16:01:52.193" Score="0" Body="&lt;p&gt;A long time ago (late 80's), we needed the ability to create an energy spectrum of incoming radiation as part of a gamma camera which is used in Nuclear Medicine. This required a fast ADC with excellent differential linearity (basically, every &quot;bin&quot; of the ADC has to be exactly the same width or the analog signal, which is continuously distributed, will give you a &quot;bump&quot; in a bin that is a little bit too wide - and this might look like a spectral peak).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution was an interesting variant on dithering: we had a small DAC and a counter, and used this to add a &lt;em&gt;known&lt;/em&gt; amount of signal to the input. The sum signal was then digitized using a fast ADC with (comparatively) poor differential linearity, and the value of the DAC was subtracted again after the conversion; after this, the counter (input to the DAC) was incremented by 1 (with overflow resetting it back to zero). The result of this was that a voltage of the same value would be converted in one of many bins - in effect reducing the differential nonlinearity of the ADC by the size of the DAC counter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do the same thing with random noise - but if you don't know what noise you are adding, you are of course degrading your signal. When the noise is roughly of the size of a single bin in the ADC, and you can take multiple measurements, this &lt;em&gt;will&lt;/em&gt; help you estimate a signal to better than the resolution of the ADC - assuming that you can trust the differential linearity. But adding a known &quot;random&quot; signal (although we used a counter, it was &quot;random in time&quot; what value would happen to be present for a particular conversion) and taking account of its value allows you even greater precision.&lt;/p&gt;&#xA;" OwnerUserId="30221" OwnerDisplayName="Floris" LastActivityDate="2014-12-29T16:01:52.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19786" PostTypeId="2" ParentId="19782" CreationDate="2014-12-29T16:18:02.867" Score="3" Body="&lt;p&gt;Yes, adding &lt;i&gt;uncorrelated&lt;/i&gt; noise to a signal, then averaging multiple samples, is one way of dealing with quantization noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this obvious, think of the limiting case.  You want to measure the value of a signal between 0 and 1, but all you have is a 1-bit A/D.  The A/D output is 0 when the signal is from 0 to .5, and 1 when the signal is .5 to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a signal that is .3.  With a nice clean .3 in, the A/D will always yield 0.  You can't distinguish between a input signal of .1, .25, .3, etc, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now add random noise of &amp;plusmn;.5.  The signal seen by the A/D will now be somewhere from -.2 to .8.  A 0 output has a probability of .7, and a 1 output of .3.  Any one reading won't tell you much (unlike before when it told you the signal was from 0 to .5), but after a bunch of readings you get a reasonable idea of the signal.  For example, if you take 100 readings, around 30 of them will be 1 and 70 will be 0.  There is no guarantee of this, but the more readings you average, the higher the confidence that the average result represents the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So dithering is a means of trading off certainty and bandwidth to get resolution.  Note that no matter how many readings you take, you don't &lt;i&gt;know&lt;/i&gt; the signal is within some bound, only that the &lt;i&gt;probability&lt;/i&gt; of it being within some bound is high.  Also note that you have lost bandwidth since many samples are required to get one signal value.  Nonetheless, in many cases these are useful tradeoffs.&lt;/p&gt;&#xA;" OwnerDisplayName="Olin Lathrop" LastActivityDate="2014-12-29T16:18:02.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19787" PostTypeId="1" AcceptedAnswerId="19797" CreationDate="2014-12-29T17:49:21.200" Score="0" ViewCount="658" Body="&lt;p&gt;What does the graph of the function $x(t)=-\delta(t)+u(t)$ look like?&#xA;$$\delta(t)\ldots\text{ Dirac delta impulse}\\&#xA;u(t)\ldots\text{unit     step function}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will the impulse at the origin start from 0 downwards or from 1?&#xA;I'm having trouble because the unit step is discontinuous at t=0, so I don't know how it will shift the impulse.&#xA;I am talking about continuous time.&lt;/p&gt;&#xA;" OwnerUserId="11664" LastEditorUserId="4298" LastEditDate="2023-03-16T12:53:32.383" LastActivityDate="2023-03-16T12:53:32.383" Title="Adding Dirac Delta with Unit Step" Tags="|continuous-signals|dirac-delta-impulse|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19788" PostTypeId="1" CreationDate="2014-12-29T18:08:01.567" Score="0" ViewCount="27" Body="&lt;p&gt;Recently, I studied a paper called &quot;What Does Your Chair Know About Your Stress Level?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be download at the link below.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.barnrich.ch/wiki/data/media/pub/2010_what_does_your_chair_know_about_your_stress_level.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.barnrich.ch/wiki/data/media/pub/2010_what_does_your_chair_know_about_your_stress_level.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;at page 209, &#xA;Section IV-A mentioned that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In order&#xA;  to characterize the movement properties of the CoP, we have&#xA;  computed the corresponding spectra over the experiment stages&#xA;  3–7. Fig. 5 shows the spectra of the norm of the CoP&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can understand that the meaning of Fig.4.&#xA;However, I don't understand what does Fig.5 mean.&#xA;How did they compute &quot;the norm of the CoP&quot; to &quot;the spectra of the norm of the CoP&quot;?&#xA;And what does the graph's axis mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="12202" LastActivityDate="2014-12-29T18:08:01.567" Title="What does it mean compute spectra of Center of Press?" Tags="|frequency-spectrum|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19789" PostTypeId="1" AcceptedAnswerId="19790" CreationDate="2014-12-29T18:52:06.247" Score="-2" ViewCount="69" Body="&lt;p&gt;I'm just curious about the copyright issues when publishing a paper on the Internet. Can some simply take the idea I explained in a manuscript and implement it for his own work? (e.g. using some programming language)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously I'm supposing that: I haven't made public my own implementation (personal or for a company), the person acquired a legal copy of the document from a magazine (Springer, IEEE, etc), he fully understood the idea, he wrote his own lines of code, and he is properly citing the original paper. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand this is an affair that students are continuously facing when working in their thesis.  &lt;/p&gt;&#xA;" OwnerUserId="7316" LastEditorUserId="7316" LastEditDate="2014-12-29T19:28:04.803" LastActivityDate="2014-12-29T21:45:02.473" Title="Legal issues when using a paper" Tags="|algorithms|digital-communications|" AnswerCount="1" CommentCount="4" ClosedDate="2014-12-30T09:12:15.567" ContentLicense="CC BY-SA 3.0" />
  <row Id="19790" PostTypeId="2" ParentId="19789" CreationDate="2014-12-29T21:45:02.473" Score="1" Body="&lt;p&gt;Academic publications are in the public knowledge domain. If it is not patented before publication, you could perfectly implement and use the idea. The non-patented academic works are a part of open science.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2014-12-29T21:45:02.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19793" PostTypeId="1" AcceptedAnswerId="19794" CreationDate="2014-12-30T12:54:25.843" Score="8" ViewCount="1393" Body="&lt;p&gt;Hello this is my sample image I am going to do real time character detection on images like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried SURF, SIFT, MSER and template matching on original image without any preprocessing. I can detect characters but when the image changes this feature detection methods does not work because there isn't a lot of interested points in the characters on the image. I am not exactly sure what kind of preprocessing I should do for higher accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so my question is what methods can you guys suggest me to do for character detection with higher accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks in advance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m4dU1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12210" LastEditorUserId="7338" LastEditDate="2017-06-15T15:49:01.897" LastActivityDate="2017-06-15T15:49:01.897" Title="Suggested Preprocessing methods for OCR on Circular Images" Tags="|image-processing|computer-vision|local-features|detection|ocr|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19794" PostTypeId="2" ParentId="19793" CreationDate="2014-12-30T13:10:49.530" Score="8" Body="&lt;p&gt;Here is what I did for a client (What you are asking is the same).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that you have access to certain type of a pattern on the image (or the center of the hole), you could always detect the template to obtain the location of a possible unwarp:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CZosd.png&quot; alt=&quot;Pattern matching&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the transformed image, two region of interests are defined and the region within which we would like to read the characters is the torus lying between two circles. Using this information, we could warp this image using an inverse polar transform to obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/v9eGd.png&quot; alt=&quot;inverse_polar_transform&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also provide the MATLAB code for this transformation &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/48911-inverse-polar-transform-on-images&quot; rel=&quot;nofollow noreferrer&quot;&gt;at this file-exchange post&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the next step, thanks to the template matching, the characters to be read always lie in the local region defined in the image above. Now, if you have appropriate illumination the character segmentation is nothing but a trivial set of image processing operations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h9Wg9.png&quot; alt=&quot;character segmentation&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The connected components obtained eventually are fed into a neural network or an SVM, first to train and then to classify. This part is composed only of a basic machine learning task, which I won't go into the details, here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't forget to take good care of the illumination, as it is almost solving the problem half way.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2016-08-29T09:36:23.180" LastActivityDate="2016-08-29T09:36:23.180" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19796" PostTypeId="2" ParentId="19770" CreationDate="2014-12-30T19:00:15.163" Score="1" Body="&lt;p&gt;Yes but there are a lot of details; like merging R4 with a termination impedance and using pre-distortion to compensate for finite Q in the inductors.  I would suggest reading some wikipedia articles:&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Analogue_filter&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Analogue_filter&lt;/a&gt;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Network_synthesis_filters&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Network_synthesis_filters&lt;/a&gt;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Butterworth_filter&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Butterworth_filter&lt;/a&gt;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Electronic_filter_topology#Ladder_topologies&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Electronic_filter_topology#Ladder_topologies&lt;/a&gt;&#xA;To get a feel for you want.&#xA;Then you can decide how far you want to go along this path.  Whether to learn how to do it yourself or find some prepacked program.  But, unless you  feel lucky today, proceed with caution and some knowledge.  There are a lot of in's and out's; pitfalls. &#xA;I have always found the field fascinating; but that's partially because it is complicated and fundamentally mathematical :)  Your mileage will vary.&#xA;BTW: this is a DSP forum not an analogue design forum.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2014-12-30T19:00:15.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19797" PostTypeId="2" ParentId="19787" CreationDate="2014-12-30T19:01:14.813" Score="0" Body="&lt;p&gt;Note that $\delta(t)$ is no function but a &lt;a href=&quot;http://en.wikipedia.org/wiki/Distribution_(mathematics)&quot; rel=&quot;nofollow&quot;&gt;distribution&lt;/a&gt;. This means that it doesn't have function values but it is only defined by its integral. Consequently, the (generalized) function $x(t)=-\delta(t)+u(t)$ has no value at $t=0$ (the only useful value would be $-\infty$ but that's kind of hard to sketch). For sketching the function graph, you can define function values for $t\neq 0$ in the usual way. At $t=0$ you simply sketch a negative $\delta$-impulse, for $t&amp;lt;0$ the function is zero, and for $t&amp;gt;0$ you assign it the value $1$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-30T19:01:14.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19798" PostTypeId="2" ParentId="19782" CreationDate="2014-12-30T19:09:53.910" Score="2" Body="&lt;p&gt;The above answers, dithering, are right but I would like to explicitly point out that you are explicitly trading resolution for time.  A time vs. accuracy tradeoff.  The most dramatic case is delta-sigma converters.  They have (well there are probably exceptions) 1 bit of accuracy but by overclocking the conversion they are able to extract 24 bits, or so, of resolution. In this case they get around the tradeoff by overclocking (a lot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course many other techniques are used in real converters; but the principle applies.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2014-12-30T19:09:53.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19799" PostTypeId="1" AcceptedAnswerId="19807" CreationDate="2014-12-30T21:29:39.793" Score="6" ViewCount="4846" Body="&lt;p&gt;For time-invariant systems, if the input is periodic, the we can argue that the output is periodic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we shift the input signal one period, we come up with the same signal as before, and since the output must be shifted the same amount as a result of the system being TI, it should be periodic too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For causal systems we know that the output signal at time $t$ depends on the input for times up to $t$. My question is, can we conclude that for causal TI systems if the input is periodic before $t_0$, the output will be periodic up to $t_0$ too?&lt;/p&gt;&#xA;" OwnerUserId="10292" LastEditorUserId="10292" LastEditDate="2014-12-31T06:25:40.673" LastActivityDate="2014-12-31T13:00:20.643" Title="Periodicity of the output of causal time-invariant systems when the input is periodic" Tags="|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19800" PostTypeId="1" CreationDate="2014-12-30T22:53:30.577" Score="1" ViewCount="119" Body="&lt;p&gt;I'd like to know if a technique I have in mind is already used and has a name I can look up, and whether it is likely to work and be useful!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to produce a discrete wavelet transform that is not over complete but shares properties with an invertible Laplacian pyramid. I believe it would be well suited to applications that currently perform processing on Laplacian pyramid layers and then invert the pyramid to acquire a modified signal (but I could well be completely wrong).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, it's a wavelet transform for &gt;1 dimension that has:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A &lt;strong&gt;single detail band&lt;/strong&gt; with an isotropic spectrum at each scale, for any number of dimensions &lt;strong&gt;n&lt;/strong&gt;. In contrast to 2^n - 1 anisotropic detail bands as for the typical Tensor product wavelet transform.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Sub octave scaling&lt;/strong&gt; for n&gt;1. Typical discrete wavelet transforms have scales that are &lt;strong&gt;linearly&lt;/strong&gt; an octave apart. This scheme scales the &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;th dimension in octaves resulting in a linear scaling of 2^(1/n).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h1&gt;Background&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;A single pass of a 1d wavelet transform turns an n point signal in to 2 n/2 signals: &lt;strong&gt;L&lt;/strong&gt; the low pass signal and &lt;strong&gt;H&lt;/strong&gt; the high pass signal. Further passes are then applied to &lt;strong&gt;L&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For higher dimensional signals it is usual to filter the signal in 1d along each axis forming a Tensor product of 1d transforms. In the 2d case this yields 3 detail bands and 1 low pass band for each level of the transform. In 3d, 7 detail bands are generated and 1 low pass band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The multiple detail bands that come from this process have individual anisotropic spectra. This can be useful in some applications (compression, de-noising, feature finding), but not useful in other situations where it would be preferable for the detail band spectrum to be isotropic. In particular, applications that use an invertible Laplacian pyramid to perform analysis &amp;amp; modification at multiple scales, and then reconstruct an updated image by inverting the pyramid.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Alternative&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Start with a signal &lt;strong&gt;S&lt;/strong&gt; in 2 dimensions. The idea extends to more dimensions, but 2 is easier to describe.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Sub Sampling&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Consider for a moment the colouring of a continuous chess or checkers board.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each square on the board is a sample from our signal. We can take just the black or just the white squares. If we do this, we get two new signals, each taking half  the samples of the original. If you rotate either of these sub signals by &lt;strong&gt;45º&lt;/strong&gt;, you end up again with samples that lie on the cartesian grid, so you can perform this sub sampling process recursively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's worth a quick not that if you just do this, you'll get a pyramid of (horribly aliased) images. At each level of the pyramid the sample count will &lt;strong&gt;halve&lt;/strong&gt;. The usual case for the wavelet transform in 2d is that the sample count &lt;strong&gt;quarters&lt;/strong&gt; with each level. In the wavelet transform the sub bands are arranged in octaves, but here they are sqrt(2) apart for 2d. For 3d they would be 2^(1/3) apart, and for nD, 2^(1/n).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Lifting&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;How to turn the horribly aliased signals in to successive detail bands and a low pass residual?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to wave my hands even more furiously now. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Lifting_scheme&quot; rel=&quot;nofollow&quot;&gt;Wavelet Lifting&lt;/a&gt; scheme does a split quite a bit like the black white chess split, but in 1d. It then performs a predict step and an update step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The predict step tries to predict the samples that are going to become the detail, by using the samples that are going to become the low pass. The update step uses the modified detail samples to smooth the low pass signal before the next iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, it seems to me that it would be easy enough to predict all the white squares on a chess board using the black ones. Simply averaging the adjacent neighbours and subtracting would do the trick, but a much better filter could also be derived.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, it seems reasonable that the modified white squares could then be used to update the black squares to remove the high frequency signal that would otherwise be aliased in it – just as the lifting scheme does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you applied this transform recursively, you'd end up with a series of detail bands at half octave intervals. It would be invertible (because the lifting scheme is), and the detail bands would be relatively isotropic.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Summary&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;That's about it! There's obviously a bit of actual work needed requiring mathematical ability way beyond me to turn this in to something that might or might not work :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've no idea if this has is known (very likely, if it works and is useful), or whether it would work or be useful (probably not if it's unknown), but I'd love to hear, either way!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="12213" LastEditorUserId="128" LastEditDate="2019-08-18T14:49:07.043" LastActivityDate="2019-08-18T14:49:07.043" Title="Critically Sampled Laplacian Pyramid from 2nd Generation Wavelet" Tags="|image-processing|discrete-signals|wavelet|transform|multi-scale-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="19801" PostTypeId="2" ParentId="19799" CreationDate="2014-12-30T23:57:40.717" Score="0" Body="&lt;p&gt;I believe the answer is no: a periodic input does not imply a periodic output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example: let the input be a square wave with amplitudes 1 and 0, and let the time-invariant system be an integrator. The system's output is monotonic, and thus not periodic.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2014-12-30T23:57:40.717" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19804" PostTypeId="2" ParentId="19776" CreationDate="2014-12-31T11:25:39.243" Score="4" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jZXHR.gif&quot; alt=&quot;Figure 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dqhNa.gif&quot; alt=&quot;Figure 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see; When a sinusoidal signal of arbitrary frequency is input to the ‘N’ point DFT, the spectral response of the signal will not be a Delta function (impulse) because when we take into account of the missing end point to be the same as the beginning of the next period of the periodic extension of the sequence, the periodic extension of the signal is no more a sinusoid. One way to solve this problem is to ensure &lt;a href=&quot;http://en.wikipedia.org/wiki/Coherent_sampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coherent Sampling&lt;/a&gt; as shown in figure 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But coherent sampling can be done only if the DFT engine receives pure monotone signals. So in a real world application, Coherent sampling is not feasible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SO, just diminish the magnitude of the discontinuities by multiplying the whole signal with some function.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, when you multiply by window function, it eliminates the jump discontinuities and removes the false frequency that is introduced when coherent sampling is not done (see Figure 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hfPdT.gif&quot; alt=&quot;Figure 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The length of the window should be the length of your signal.&#xA;Selection of your window could be depending on how much side-lobe height do you tolerate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bNgIY.gif&quot; alt=&quot;Performance of windows&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image Source: &lt;a href=&quot;http://electronicdesign.com/analog/choose-right-fft-window-function-when-evaluating-precision-adcs&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://electronicdesign.com/analog/choose-right-fft-window-function-when-evaluating-precision-adcs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8672" LastEditorUserId="8672" LastEditDate="2014-12-31T11:56:45.150" LastActivityDate="2014-12-31T11:56:45.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19805" PostTypeId="1" AcceptedAnswerId="19808" CreationDate="2014-12-31T12:58:21.487" Score="0" ViewCount="383" Body="&lt;p&gt;I am doing some tests about local/global contrast algorithms and need a simple equation to define an arbitrary S-shaped contrast curve. It's simple if the turning point is assumed to be (0.5, 0.5), but couldn't find a straight equation if the turning point has to be arbitrarily set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the typical contrast curves I achieved for turning point in the middle (0.5, 0.5):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uip2E.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the simple equations follow this rule:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y = x^2*2 for x&amp;lt;=0.5&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y = 1-(1-x)^2*2 for x&gt;0.5&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to be able to allocate the turning point to any (x,y) position and still have a smooth S-shaped curve where the slope is continuous on both sides of the turning point. I would like to keep the equation as simple and straightforward as possible, avoiding the use of splines or any other more complex math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? I tried to google I found some equation like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y = [ (1-s)&lt;em&gt;x + s&lt;/em&gt;a*(x/a)^E ] ^ ( log(b)/log(a) )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parameters:&#xA;(a,b): turning point &lt;/p&gt;&#xA;&#xA;&lt;p&gt;s: slope at ends &lt;/p&gt;&#xA;&#xA;&lt;p&gt;E: contrast strength &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it does not work like this &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k2wnK.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would you please let me know how do I make the equation like above.&lt;/p&gt;&#xA;" OwnerUserId="10979" LastEditorUserId="10979" LastEditDate="2015-01-02T06:27:48.783" LastActivityDate="2022-01-03T14:59:34.123" Title="contrast curves problems" Tags="|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19806" PostTypeId="1" AcceptedAnswerId="19974" CreationDate="2014-12-31T12:59:33.297" Score="4" ViewCount="7503" Body="&lt;p&gt;What I want is simply to apply low pass and highpass filters to an image in the frequency domain. Does MATLAB image processing toolbox have any commands for this?&lt;/p&gt;&#xA;" OwnerUserId="12219" LastEditorUserId="128" LastEditDate="2019-10-17T12:50:52.010" LastActivityDate="2019-10-17T12:50:52.010" Title="Applying Lowpass (LPF) and Highpass (HPF) Filters to an Image in Frequency Domain in MATLAB" Tags="|image-processing|matlab|filter-design|convolution|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="19807" PostTypeId="2" ParentId="19799" CreationDate="2014-12-31T13:00:20.643" Score="2" Body="&lt;p&gt;Your line of reasoning is correct. For a (not necessarily linear) time-invariant system the following always holds: if $y(t)$ is the response to an input signal $x(t)$, then $y(t+T)$ must be the response to the shifted input signal $x(t+T)$. If the input is periodic with period $T$, this implies that $x(t)=x(t+T)$, and, consequently, $y(t)=y(t+T)$, i.e. the output signal is periodic with the same period as the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, if the system is causal and the input up to time $t_0$ is periodic, the output up to time $t_0$ must be periodic too, because a causal system cannot know the (possibly non-periodic) input beyond time $t_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is (part of the) theory. But then comes @MBaz with his &quot;counter-example&quot; of an ideal integrator. The problem here is indeed, as already noted in a comment, the integrator's instability. Showing the time-invariance of a linear system involves manipulating the convolution integral. However, if for the given input signal that integral is divergent, the proof becomes invalid. And this is the case with systems having poles on the $j\omega$-axis (or, for discrete-time systems, on the unit circle). If an LTI system has a pole on the $j\omega$-axis and if you excite it with the corresponding pole frequency, you get an output signal with increasing amplitude, which is obviously non-periodic. You can also see it in the following way: the response of an LTI system to a complex exponential $e^{j\omega_0 t}$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=H(\omega_0)e^{j\omega_0 t}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. (1) of course requires that $H(\omega_0)$ can be evaluated. For an ideal integrator this is not the case for $\omega_0=0$. Note that if the input signal to the integrator had no DC component, then the response to a periodic input signal would indeed be periodic.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2014-12-31T13:00:20.643" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19808" PostTypeId="2" ParentId="19805" CreationDate="2014-12-31T13:47:01.317" Score="2" Body="&lt;p&gt;One good way is to utilize &lt;a href=&quot;http://www.codeproject.com/Articles/25237/Bezier-Curves-Made-Simple&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bezier curves&lt;/a&gt; (or &lt;a href=&quot;http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline&quot; rel=&quot;nofollow noreferrer&quot;&gt;Catmull Rom splines&lt;/a&gt;). This way, you could define the control points in the way you like. Positioning of the control points would then allow you to adjust the histogram to the desired output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest Catmull Rom splines if you want them to pass through the control points. It gives you better control over the curve behavior. Use 5 such points: 2 for the end points, 1 for the middle, and 1 on each side of the center to give you certain curvature. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you don't want to use splines, the black curve looks like a Sigmoid function, while the yellow is a third order polynomial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can checkout &lt;a href=&quot;https://code.google.com/p/colorhistogram/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this code&lt;/a&gt; to see different implementations. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you are keen on using Logistic family, then I would suggest the generalized logistic growth curve with horizontal asymptotes at $−1$ and $1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t)=-1+\frac{2}{[1+ke^{-\beta t}]^{1/v}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k &amp;gt; 0$, $β &amp;gt; 0$ and $ν &amp;gt; 0$. The parameter $k$ can be adjusted by a time shift, $β$&#xA;corresponds to a scaling of time; $ν$ is the key parameter that determines the shape of the&#xA;growth, the asymmetry depending on whether it is less than or greater than $1$. This formula reduces to the standard logistic growth for $ν = 1$, $k = 1$, $β = 2$. The &lt;em&gt;turning point&lt;/em&gt; you refer to is commonly known as the inflection point, where the derivative changes sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is explained in detail &lt;a href=&quot;http://arxiv.org/pdf/1407.4839.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ayse Humeyra's article&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Generalised_logistic_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Here is a MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [y]= general_logistic(t, k, beta, v)&#xA;y = -1 + 2./((1+k*exp(-beta.*t)).^(1./v));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Finally, in &lt;a href=&quot;https://dinodini.wordpress.com/2010/04/05/normalized-tunable-sigmoid-functions/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dino Dini's blog&lt;/a&gt;, he explains the normalized tunable sigmoid functions. There, the solution to your problem is addressed. Moreover, a similar question is already posted and &lt;a href=&quot;https://math.stackexchange.com/questions/459872/adjustable-sigmoid-curve-s-curve-from-0-0-to-1-1&quot;&gt;answered here&lt;/a&gt;. Last but not least, polynomial shaping functions, which would serve the same necessities are discussed in &lt;a href=&quot;http://www.flong.com/texts/code/shapers_poly/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Golan Levin's page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope all these would help.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-01-03T15:13:02.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19809" PostTypeId="2" ParentId="17593" CreationDate="2014-12-31T20:37:54.867" Score="1" Body="&lt;p&gt;Doppler resolution usually depends on the dwell time $T_{dwell}$, i.e., the time for which the radar is going to stare (look) at the target. If the pulse/sweep repetition interval is given by $T_{PRI}$ then $N = T_{dwell}/T_{PRI}$ is the number of pulses/sweeps in one dwell, which is also the limit of your FFT size. Your maximum Doppler corresponds to $N/2$th bin, therefore the Doppler resolution is $f_d/(N/2)$. Note that more pulses you are able to send to the target, better is the Doppler resolution. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2014-12-31T20:37:54.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19810" PostTypeId="1" CreationDate="2015-01-01T07:30:48.077" Score="1" ViewCount="452" Body="&lt;p&gt;BCJR algorithm needs noise variance for Gamma (branch metrices) calculation. So I am wondering does SOVA (soft output Viterbi algorithm) needs noise variance?&lt;/p&gt;&#xA;" OwnerUserId="10681" LastActivityDate="2019-12-08T04:04:35.453" Title="Important differences between BCJR and SOVA algorithms?" Tags="|digital-communications|channelcoding|forward-error-correction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19811" PostTypeId="1" AcceptedAnswerId="19844" CreationDate="2015-01-01T13:18:10.227" Score="3" ViewCount="734" Body="&lt;p&gt;say we have a binary image like the one in below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i would like to extract each black line, even if it's not almost connected&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have marked here in red, example of lines that correspond to those to be extracted&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**the purpose here is to extract lines a handwritten text ! **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VP8ea.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zOsTI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/zbHTp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any suggestions !! Thanks&lt;/p&gt;&#xA;" OwnerUserId="12220" LastEditorUserId="698" LastEditDate="2015-01-04T12:36:08.780" LastActivityDate="2015-01-04T12:36:08.780" Title="Line tracing folowing a path of an almost connected components" Tags="|image-processing|matlab|periodic|ocr|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19812" PostTypeId="2" ParentId="19800" CreationDate="2015-01-01T13:37:26.097" Score="1" Body="&lt;p&gt;Your description sounds very similar to the &quot;&lt;a href=&quot;http://nalag.cs.kuleuven.be/papers/ade/redblack/preprint.pdf&quot; rel=&quot;nofollow&quot;&gt;Red Black&lt;/a&gt;&quot; Wavelet Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a useful transform, and is used for instance in &quot;&lt;a href=&quot;http://www.cs.huji.ac.il/~raananf/projects/eaw/paper.pdf&quot; rel=&quot;nofollow&quot;&gt;Edge Avoiding Wavelets&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="12213" LastActivityDate="2015-01-01T13:37:26.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19813" PostTypeId="2" ParentId="19810" CreationDate="2015-01-01T14:05:46.853" Score="1" Body="&lt;p&gt;For an AWGN channel, the exact computation of the log-likelihood ratio requires knowledge of the SNR. However, in Hagenauer's original paper on the SOVA there is an approximation which allows the implementation of the algorithm without estimation of the SNR.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-01T14:05:46.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19817" PostTypeId="1" CreationDate="2015-01-01T16:41:46.463" Score="1" ViewCount="4888" Body="&lt;p&gt;I am going to do some kind of transformation and transform a data to another domain, and again back to the first domain. For this, I take a fourier transform of the data and separate the positive part and I use the positive frequencies only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that for example in the frequency domain of a wavelet we have positive and negative frequencies. what will be the effect of using only positive frequencies? &lt;/p&gt;&#xA;" OwnerUserId="12230" LastActivityDate="2021-08-01T15:14:20.510" Title="Using only positive frequencies in fourier domain, How will it affect the ifft?" Tags="|fft|fourier-transform|frequency-spectrum|frequency-domain|ifft|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19820" PostTypeId="2" ParentId="13842" CreationDate="2015-01-01T22:02:26.600" Score="2" Body="&lt;p&gt;[I am part of this research group, so I know this issue in-depth]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is absolutely no approximation in the method. I'll start at the very beginning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start with some finite Hilbert basis, $\mathcal{H}$. In Asaf's paper this is a Fourier grid - the space of band-limited cyclic functions. The Fourier grid prescribes a rectangular area in phase-space, which may be spanned by the spectral basis or the DVR/pseudo-spectal basis (the latter is similar to the periodic-sinc functions, but not identical to it). Once this is done, we can forget about the continuous functions, and switch to a discrete representation, using the coefficients of the pseudo-spectral basis (i.e. the sampling values at the Fourier grid points).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us say we have $N$ such Fourier grid points. Any set of $N$ linearly &lt;em&gt;independent&lt;/em&gt; vectors, i.e. any non-singular matrix $G$ can serve as a (generally non-orthogonal) basis to the Fourier grid. Meaning any function within the Hilbert space of the Fourier grid, $\mathcal{H}$, can be accurately spanned by vectors from $G$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here we proceed as you described, defining a bi-orthogonal partner to $G$, $B:=G^{-\dagger}$. By construction $B$ also spans $\mathcal{H}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given any vector $v\in\mathcal{H}$, we can expand it exactly in the $B$ basis with coefficients $G^\dagger v$. If we choose $G$ to be composed of well-localized functions, then there is a good chance the coefficient vector will be sparse, allowing efficient computation. The von Neumann grid is one such choice of a basis $G$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where does the issue of approximation come in? Only when $v$ is not in $\mathcal{H}$. Then it has to be projected into the space, with loss of information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that once you've described $v$ by the sampling values at the Fourier grid points, you have already &quot;projected&quot; it into the space (this is not a proper projection, which must be performed by integration with the DVR functions).&lt;/p&gt;&#xA;" OwnerUserId="12233" LastActivityDate="2015-01-01T22:02:26.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19822" PostTypeId="2" ParentId="19811" CreationDate="2015-01-01T23:47:11.260" Score="0" Body="&lt;p&gt;First of all, if the lines aren't connected, apply a morphological opening operation to make them so (see morphologyEx in OpenCV).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assuming you have a connected black region, you could apply iterative thining to obtain the skeleton. Or refer to already available ideas such as &lt;a href=&quot;http://felix.abecassis.me/2011/09/opencv-morphological-skeleton/&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt; or &lt;a href=&quot;http://answers.opencv.org/question/3207/what-is-a-good-thinning-algorithm-for-getting-the-skeleton-of-characters-for-ocr/&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-01-01T23:47:11.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19823" PostTypeId="2" ParentId="10549" CreationDate="2015-01-01T23:52:08.613" Score="-1" Body="&lt;p&gt;You could well refer &lt;a href=&quot;http://answers.opencv.org/question/3207/what-is-a-good-thinning-algorithm-for-getting-the-skeleton-of-characters-for-ocr/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for a few different implementations, which provide acceptable results.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-01-01T23:52:08.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19824" PostTypeId="1" CreationDate="2015-01-02T04:30:11.697" Score="2" ViewCount="657" Body="&lt;p&gt;Hi I am attempting to develop a reasonable IQ balance mechanism for a quadrature signal coming from a software defined radio.I can balance out the amplitude and phase differences at one frequency quite well, about - 80dBm.  However, over the typical span of my spectrum scope (192khz), there are differences at different frequencies.  Now I have determined that the differences are quite linear.  I could get away with doing a linear regression on a few points taken over the frequency range. But..&#xA;I am correcting the I and Q signals before the fast fourier transform.  In other words, in the time domain.  How do I bring this to the frequency domain?  I have the real and imaginary amplitude and frequencies of course before I plot them.  Can I use the same equations on the frequency values?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7741" LastActivityDate="2015-01-02T04:30:11.697" Title="IQ imbalance on quadrature signal" Tags="|quadrature|software-defined-radio|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19828" PostTypeId="1" CreationDate="2015-01-02T10:01:19.113" Score="1" ViewCount="358" Body="&lt;p&gt;I have a noisy signal. Then using filtering techniques I got the estimated noiseless signal. I dont have the original noiseless signal. I have calculated SNR the following way: &#xA;$$&#xA;\textrm{SNR}=10\log\left(\frac {\textrm{Estimated Noiseless Signal}^2} {\left(\textrm{Estimated Noiseless Signal-Noisy Signal}\right)^2}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this method right?&lt;/p&gt;&#xA;" OwnerUserId="12236" LastEditorUserId="1629" LastEditDate="2016-08-19T08:14:34.240" LastActivityDate="2016-08-19T08:14:34.240" Title="SNR calculation when noiseless signal is not known" Tags="|discrete-signals|snr|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19829" PostTypeId="1" CreationDate="2015-01-02T10:23:01.290" Score="1" ViewCount="119" Body="&lt;p&gt;Filter sharpening is a technique to sharpen the magnitude response of a digital filter. Finding information online about it is problematic since almost all google hits will be about image sharpening (unsharp mask etc.), which is unrelated to filter sharpening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A naive technique to sharpen a filter would be to cascade it with itself. This kind of works but there are ways to get steeper response for essentially the same amount of computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest sharpening operation is to subtract the double application of a digital filter from twice the identity operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{sharp} = 2 I - H ^ 2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pseudo code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;init_sharp2(params)&#xA;  return [ init_filter(params), init_filter(params) ] &#xA;&#xA;apply_sharp2(h, x)&#xA;  y1 = apply_filter(h[1], x)&#xA;  y2 = apply_filter(h[2], y1)&#xA;return 2 * x - y2; // 2I - H^2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A higher order sharpening operation is to subtract two times the triple application of a digital filter from thrice the identity operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{sharp} = 3 I - 2 H ^ 3$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pseudo code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;init_sharp3(params)&#xA;  return [ init_filter(params), init_filter(params), init_filter(params) ] &#xA;&#xA;apply_sharp3(h, x)&#xA;  y1 = apply_filter(h[1], x)&#xA;  y2 = apply_filter(h[2], y1)&#xA;  y3 = apply_filter(h[3], y2)&#xA;return 3 * x - 2 * y3; // 3I - 2 * H^3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Make sure you use separate instances of the filters when cascading!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References: (to be done once I have waded through all the unrelated google hits)&lt;/p&gt;&#xA;" OwnerUserId="12235" LastEditorUserId="7092" LastEditDate="2015-01-02T14:35:22.350" LastActivityDate="2015-01-02T14:35:22.350" Title="Filter sharpening; a stub" Tags="|filters|impulse-response|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19830" PostTypeId="1" CreationDate="2015-01-02T11:32:40.137" Score="4" ViewCount="3933" Body="&lt;p&gt;I am new to this site and field too.I always thought analog is continuous and digital signal is discrete. I read this today and got confused about analog signal&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Analog can be &#xA;  continuous time(CT) or discrete time(DT). A discrete time signal is not a digital signal; a &#xA;  discrete time signal is one in which the amplitude is a continuum, and not discretized. On &#xA;  the other hand, if the time is discretized, this signal is still analog. Only when a discrete &#xA;  time signal is passed through an A to D converter, it becomes a digital signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Will anybody explain me what actually it means?&lt;/p&gt;&#xA;" OwnerUserId="12238" LastEditorUserId="29" LastEditDate="2017-05-22T20:52:41.193" LastActivityDate="2017-05-22T20:52:41.193" Title="Analog signal can be discrete time?" Tags="|discrete-signals|continuous-signals|analog|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19831" PostTypeId="2" ParentId="19830" CreationDate="2015-01-02T12:00:00.287" Score="7" Body="&lt;p&gt;This sounds like a confusion in terminology. See &lt;a href=&quot;http://en.wikipedia.org/wiki/Digitizing&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Digitizing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Digitization basically involves two steps: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Discretization&lt;/strong&gt;: Sampling the signal at discrete times&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Quantization&lt;/strong&gt;: Turning the samples from (in theory) infinite resolution to finite resolution&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Look at all possible combinations you can have 4 different types of signal:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;continuous time, continous amplitude&lt;/li&gt;&#xA;&lt;li&gt;discrete time, continous amplitude&lt;/li&gt;&#xA;&lt;li&gt;continuous time, discrete amplitude&lt;/li&gt;&#xA;&lt;li&gt;discrete time, discrete amplitude&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Typically we refer to #1 as &quot;analog&quot; and #4 as &quot;digital&quot;. #2 and #3 are of little practical relevance, other than getting the mathematical models right. Quantization and Discretization are really quite different mathematically so it doesn't make a lot of sense to analyze them in combination. In other words: the theory of time discretization applies equally to continuous amplitude and discrete amplitude signals.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-01-02T12:00:00.287" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19832" PostTypeId="2" ParentId="19828" CreationDate="2015-01-02T12:01:43.753" Score="3" Body="&lt;p&gt;Assuming you're calculating the $\textrm{SNR}$ in decibels, it is defined by the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\textrm{SNR}_{db} = 10\log_{10}\left(\frac{P_{signal}}{P_{noise}}\right)^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You currently have (with squares consolidated), where $P$ is the noisy signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\textrm{SNR}_{db} = 10\log_{10}\left(\frac{P_{signal}}{P_{signal}-P}\right)^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't look right because you will end up with a negative denominator since $P&amp;gt;P_{signal}$, where in essence $P=P_{signal}+P_{noise}$. Although it ends up being the same thing because the squaring forces it to be positive, it seems a bit of a &lt;em&gt;fudge&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think what you meant to do was to subtract the estimated signal from the noisy signal to estimate the noise power:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\textrm{SNR}_{db} = 10\log_{10}\left(\frac{P_{signal}}{P-P_{signal}}\right)^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way of obtaining your $P_{signal}$ is to understand what your transmitter is capable of putting into the medium. It would then follow that the further away your receiver was to your transmitter, the lower the $\textrm{SNR}$. Remember, a low SNR can mean two things, either your transmitter isn't &lt;em&gt;loud&lt;/em&gt; enough, or the background noise is too great.&lt;/p&gt;&#xA;" OwnerUserId="12066" LastEditorUserId="12066" LastEditDate="2015-01-02T12:32:05.193" LastActivityDate="2015-01-02T12:32:05.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19833" PostTypeId="1" AcceptedAnswerId="19835" CreationDate="2015-01-02T12:49:16.627" Score="1" ViewCount="311" Body="&lt;p&gt;I was reading  &quot;Discrete and continuous Fourier transforms: analysis, applications and fast algorithms&quot; written by E.Chu and, at some point, I found something that I could not completly understand.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If $x(t)$ is not continuous, then it is possible that 2 different functions share the same transform $X(f)$. Therefore, the function $x(t)$ cannot be uniquely determined by inverse trasforming $X(f)$ unless it is continuous or it satisfies 2 more conditions:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1- $x(t)$ has only a finite number of maxima and minima on any finite interval&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2- $x(t)$ has on any finite interval at most a finite number of discontinuities, each of which is a jump discontinuity.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In the latter case, the inverse Fourier transform of $X(f)$ produces $\hat{x}(t)$, which agrees with $x(t)$ at every $t$ at which $x(t)$ is continuous, and $\hat{x}(t)$ equals the average of the left-hand limit $x(t^-_{\alpha})$ and the right-hand limit $x(t^+_{\alpha})$ at every $t_{\alpha}$ at which a jump discontinuity occurs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, here my doubts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, I am not sure I got the meaning of the statements related to the 2 conditions listed. This is probably due to the fact that I am familiar only with signals coming from structural tests (mainly accelerations), therefore I think it could be really helpful if someone of you can provide me some example I can focus on to understand the concept (for example, how can be possible to have infinite maxima and minima in a signal? And what are the discontinuities it is talking about?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, measured signals (for example, the aformentioned acceleration measurements coming from a test) are not continuous (since they are sampled at a given sampling frequency), so if I want to apply the IFFT algorithm to retrieve the time signal does it mean I have always to check if the 2 other conditions are satisfied? And how can I check them? Visual inspection? Or do I have to look for some specific features the signal must have? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there classes of signals which always satisfy the 2 conditions?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="4298" LastEditDate="2015-01-02T22:59:27.877" LastActivityDate="2015-01-02T22:59:27.877" Title="Conceptual question on FFT/IFFT (IFFT existence)" Tags="|fft|fourier-transform|dft|ifft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19834" PostTypeId="1" CreationDate="2015-01-02T17:59:05.747" Score="2" ViewCount="209" Body="&lt;p&gt;Please can anyone answer this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Discrete Fourier Transform (DFT) is a sequence of $X(k)$ in frequency domain of the  time sequence {$x(n)$} of $N$ terms. The periodic property of the DFT is often used to reduce its computational time. Prove that only $N$ distinct values of {$X(k)$} can be computed.&lt;/p&gt;&#xA;" OwnerUserId="12240" LastEditorUserId="7092" LastEditDate="2015-01-02T19:27:38.350" LastActivityDate="2015-03-05T15:35:09.757" Title="Discrete Fourier Transform: Prove that only N distinct values of {X(k)} can be computed" Tags="|dft|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19835" PostTypeId="2" ParentId="19833" CreationDate="2015-01-02T22:56:34.740" Score="2" Body="&lt;p&gt;The conditions you mention only apply to the &lt;em&gt;continuous-time&lt;/em&gt; Fourier transform, and they only have theoretical relevance. All signals occurring in engineering applications will satisfy these conditions. But if you want an example of a function with an infinite number of maxima and minima on a finite interval, here it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sin(1/t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This function has an infinite number of minima and maxima on the interval $(0,a]$ for any real-valued $a&amp;gt;0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as for your measured signals, they are all discrete-time signals of finite length, and the above conditions do not apply. So you don't need to worry about them when using the DFT/FFT, because the DFT is defined by a finite sum, unlike the continuous-time Fourier transform, which is defined by an improper integral.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-02T22:56:34.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19837" PostTypeId="1" AcceptedAnswerId="19838" CreationDate="2015-01-01T15:36:07.327" Score="4" ViewCount="840" Body="&lt;p&gt;Hello I'm trying to recognize characters on the circular metal surface. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without any preprocessing I could match cropped features with  original image.&#xA;I've actually cropped 2 characters together to increase interested points on a template. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nEsiR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however on different locations of the conveyor belt and with different illumination angle and perspective SURF matching fails. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zAiAN.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7KxSg.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tCXzy.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8uyqB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will definately crop the ROI from conveyor belt but still I am not sure whether I have to create a database of images to increase accuracy or some kind of preprocessing (I've read that for feature detection there is no require preprocessing on images) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am open to new suggestions for this problem. Maybe a different algorithm or method that can help me out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="12210" OwnerDisplayName="Rodrane" LastEditorUserId="7338" LastEditDate="2017-06-15T15:50:22.440" LastActivityDate="2017-06-15T15:50:22.440" Title="Feature Detection on a Circular Metal Surface for Character Recognition" Tags="|image-processing|computer-vision|opencv|ocr|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19838" PostTypeId="2" ParentId="19837" CreationDate="2015-01-02T15:06:07.063" Score="5" Body="&lt;p&gt;Do not struggle forming a database of images to match via descriptors. This would be too computationally cumbersome and would require immerse amount of training. Such a scalable solution doesn't exist out of the box yet. I would rather rely on Neural Networks or SVMs to train the possible appearances of characters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course using a classifier relies on the assumption that the images appear more or less in a controlled fashion and you can segment the characters. To meet these criteria, you need to stabilize your illumination conditions. You can do this with the appropriate choice of LED lighting. After the illumination is more or less uniform and robust, the character segmentation is straightforward. You can simply threshold the image through local techniques (which posses certain illumination treatment) and apply blob analysis. You can also put all the constraints you have in this stage. Don't forget to unwarp your images prior to segmentation as described &lt;a href=&quot;https://dsp.stackexchange.com/questions/19793/suggested-preprocessing-methods-for-ocr-on-circular-images&quot;&gt;in this post&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To train your classifier do not use plain intensity values. This would be very noisy. Instead exploit the gradient information (or normalized gradients). This is proven to be robust in many works such as &lt;a href=&quot;http://www.isprs.org/proceedings/XXXIV/part3/papers/paper006.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;. Also, don't even use the gradients directly. It is better to quantize them (Remember canny?). Robustness of &lt;a href=&quot;http://docs.opencv.org/ref/master/d7/d7a/linemod_8hpp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;LINEMOD&lt;/a&gt; is also a good example of this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest further reading on machine vision as this is a practically involved topic. Many techniques on machine vision differ substantially from the methods in computer vision. You can think of this as a practice-theory duality. Refer to &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/3527407340&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book&lt;/a&gt; for instance.&lt;/p&gt;&#xA;" OwnerUserId="7338" OwnerDisplayName="tbirdal" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-01-02T18:16:53.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19840" PostTypeId="2" ParentId="19817" CreationDate="2015-01-04T02:59:31.913" Score="2" Body="&lt;p&gt;You can do things that way, but unless you're manipulating things properly, you won't get the right answer.  A procedeure for doing a N=32 point example is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) generate 32 point time domain data,&#xA;2) forward transform it,&#xA;3) divide results by 32,&#xA;4) multiply positive frequencies by 2 (frequencies f= 1 to 15),&#xA;5) zero negative frequencies (frequencies f=17 to 31),&#xA;6) inverse transform it,&#xA;7) ignore the imaginary outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real results of the above procedure will match the original input waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the above, you don't multiply the f=0 or f=N/2 outputs of the FFT by 2.  For this case (N=32 - an even number), they are unique - they don't have negative frequency counterparts.  Now if you're using an appropriate FFT routine that allows for odd N, then you have to account for the fact that you'll have an f=0 point, but no f=N/2 point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you are doing very large FFT's, you're probably not going to save much in the way of processing time by using just the positive frequencies.&lt;/p&gt;&#xA;" OwnerUserId="12251" LastActivityDate="2015-01-04T02:59:31.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19841" PostTypeId="1" AcceptedAnswerId="19900" CreationDate="2015-01-04T06:57:26.583" Score="1" ViewCount="1908" Body="&lt;p&gt;I have found in the literature a &quot;time-variant signal&quot; term , but I could not understand what that's mean. I know that there is &quot;time-variant systems&quot;, but this is the first time, which I see a time-variant signal term. Any one has an idea what this term means ? &lt;br&gt; &lt;br&gt; Some suggests that this term is related to non-stationary signal, which it's spectrum changes over time. Is this right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: I have added the  EEG tag because this term, is used widely to describe the EEG signals&lt;/p&gt;&#xA;" OwnerUserId="11164" LastEditorUserId="4298" LastEditDate="2015-01-08T16:42:50.183" LastActivityDate="2015-01-08T18:58:11.737" Title="What is a 'time-variant' signal?" Tags="|signal-analysis|time-frequency|eeg|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19842" PostTypeId="1" CreationDate="2015-01-04T10:33:47.183" Score="1" ViewCount="167" Body="&lt;p&gt;Creating two 10x10 black images.&#xA;1st image, adding a 2x2 white box in the middle (Low pass filter).&#xA;2nd image, adding 1 pixel in each of the corners.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then performing the following steps in that order:&#xA;1. ifft2 (Transformation to the time domain)&#xA;2. ifftshift (Without it the results would be shifted, not sure why, and shift before the ifft2 would not help).&#xA;3. Normalize the results to emphasize the changes.&#xA;4. Show the results as images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why am I getting the same results out of the two images we created above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to explain my question the best I could, but here are images of the two frequency domain and then their result: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HJ6ZT.jpg&quot; alt=&quot;Here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12253" LastActivityDate="2015-01-04T10:33:47.183" Title="Creating synthetic frequency domain box filter vs 4 pixels in corners" Tags="|frequency-domain|fourier|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19843" PostTypeId="2" ParentId="19834" CreationDate="2015-01-04T12:29:46.797" Score="2" Body="&lt;p&gt;It's not quite clear what you are supposed to consider as starting point for your proof. You have to make some assumptions of what is known before you can prove something else. So unless you give a more detailed description of what you want to prove from what, I will give you a proof that uses a sensible set of assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's characterise the discrete Fourier transform as a map between two complex vector spaces $$\mathcal{F}:\mathbb{C}^N\to\mathbb{C}^M$$ of dimension $N$ and $M$ respectively. The map is supposed to preserve the structure of the vector space, so it must be &lt;em&gt;linear&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A linear map between finite dimensional vector spaces can be completely described using a matrix, which in this case is $M\times N$. The rank of this matrix $F_+$ is less or equal to the smaller dimension, i.e. $\mathrm{rank}(F_+)\le\min(N,M)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also require the map to be a &lt;em&gt;transform&lt;/em&gt;, meaning that it can be inverted. So $$\mathcal{F}^{-1}:\mathbb{C}^M\to\mathbb{C}^N$$ must exist and $$\mathcal{F}^{-1}\circ\mathcal{F}=\mathrm{id}_N$$ as well as $$\mathcal{F}\circ\mathcal{F}^{-1}=\mathrm{id}_M$$&#xA;and the matrix $F_-$ of the inverse transform is also less or equal to the smaller dimension, i.e. $\mathrm{rank}(F_-)\le\min(N,M)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can write the inversion conditions as a matrix equation&#xA;$$F^{-1}\cdot F = E_N$$&#xA;$$F\cdot F^{-1} = E_M$$&#xA;where $E$ is the identity matrix of the size specified in the subscript. The matrix multiplication can be translated to a rank inequality:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\min\left(\mathrm{rank}(F_-),\mathrm{rank}(F_+)\right)\geq\mathrm{rank}(E_N)=N$$&#xA;and&#xA;$$\min\left(\mathrm{rank}(F_+),\mathrm{rank}(F_-)\right)\geq\mathrm{rank}(E_M)=M$$&#xA;because the product of two matrices has at most the rank of the matrix with the lesser rank.&#xA;From above we also had &#xA;$$\mathrm{rank}(F_-)\le\min(N,M)$$&#xA;and&#xA;$$\mathrm{rank}(F_+)\le\min(N,M)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These four inequalities only allow for one solution, which is $M=N$. To see this, assume that for example $N&amp;lt;M$, then it follows that $\mathrm{rank}(F_-)=\mathrm{rank}(F_+)\leq N$ but also $\mathrm{rank}(F_+)\geq M$, from which $N\geq M$ would follow, making the assumption inconsistent. The same goes for assuming $N&amp;gt;M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means the discrete Fourier transform must be between complex vector spaces of equal dimensions. Or in other words, the number of frequency bins must be equal to the number of time samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proof above can of course be a single line if you already know that vector space isomorphisms require matching dimensions. Of course, some linear algebra is still necessary, but the rank formulas should be rather intuitive.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-01-04T12:29:46.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19844" PostTypeId="2" ParentId="19811" CreationDate="2015-01-04T12:30:54.467" Score="2" Body="&lt;p&gt;Here is a possible solution:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use FFT2 to find angle of text and approximate spaces between lines&lt;/li&gt;&#xA;&lt;li&gt;Rotate the image to be at 0 angle&lt;/li&gt;&#xA;&lt;li&gt;Sum the image column-wise&lt;/li&gt;&#xA;&lt;li&gt;Find threshold that splits lines of text from non text lines&lt;/li&gt;&#xA;&lt;li&gt;Show lines on rotated image.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It can be improved by finding a more complex curve (rather than line).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9VX5H.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;After rotation&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/m2C3t.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sum of rotated image column-wise&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/q1bft.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Final results&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xVQ9b.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% 1) Read image&#xA;im = imread('https://i.stack.imgur.com/zbHTp.jpg');&#xA;im = im(:,:,2);&#xA;im = double(im &amp;lt; 100);&#xA;im = padarray(im,[40 0]);&#xA;figure();imshow(im);&#xA;&#xA;%% 2) Find approximate line spacing&#xA;F = fftshift(fft2(im));&#xA;% figure;imagesc(log(abs(fftshift(fft2(im)))));&#xA;[~,iMax] = max(F(:));&#xA;[r1,c1] = ind2sub(size(F),iMax);&#xA;F(iMax) = 0;&#xA;[~,iMax2] = max(F(:));&#xA;[r2,c2] = ind2sub(size(F),iMax2);&#xA;lineSpaceY = size(im,1)/ abs(r2-r1);&#xA;lineSpaceX = size(im,2)/ abs(c2-c1);&#xA;angleDeg = abs(90-rad2deg( atan2(lineSpaceX,lineSpaceY)));&#xA;imr = imrotate(im,angleDeg);&#xA;figure;imshow(imr);&#xA;&#xA;%% 3) Take a look at 1D signal&#xA;S = mean(imr,2);&#xA;isText = S &amp;gt; max(S)/2;&#xA;isText = imclose(isText,strel('line',lineSpaceY/10,90));&#xA;% figure(); plot(isText,'o-');&#xA;rp = regionprops(isText,'Centroid');&#xA;centerY = cat(1,rp.Centroid);&#xA;centerY = centerY(:,2);&#xA;&#xA;%% 4) Show final results&#xA;figure();imshow(imr);&#xA;for i=1:numel(centerY);&#xA;    hold on;&#xA;    plot( [0,size(im,2)],[centerY(i) centerY(i)],'g','LineWidth',2);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-01-04T12:30:54.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19846" PostTypeId="1" CreationDate="2015-01-04T13:19:10.827" Score="0" ViewCount="137" Body="&lt;p&gt;I'm trying to generate a modulated Gaussian pulse. First I'm generating the pulse in the time domain perform FFT and displaying both in time and frequency, then I'm multiplying it with cosine term (which is related to distance measurement - Interferometry). &#xA;The modulated pulse seems undersampled, I tried to increase 'L', still doesn't look to what I look for. &#xA;I also trying to rescale all the parameters, but I stuck with some of them. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; close all;&#xA;f=374.7e12;%Hz&#xA;fs=f*10; %sampling frequency&#xA;T=1/fs;&#xA;L=4000;&#xA;sigma=40e-15;&#xA;t=(0:L-1)*T; %time base&#xA;&#xA;&#xA;x=(exp(-(t-400e-15).^2/(2*sigma)^2)).*exp(1i*2*pi*f*t);&#xA;subplot(2,1,1)&#xA;plot(t,real(x),'b');&#xA;title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);&#xA;xlabel('Time(s)');&#xA;ylabel('Amplitude');&#xA;ylim([-1 1]) &#xA;% xlim([1e-15 9e-15])&#xA;&#xA;NFFT = 2^nextpow2(L);&#xA;X = fft(x,NFFT)/L;&#xA;Pxx=X.*conj(X)/(NFFT*NFFT); %computing power with proper scaling&#xA;f = fs/2*linspace(0,1,NFFT/2+1); %Frequency Vector&#xA;subplot(2,1,2)&#xA;&#xA;plot(f,2*abs(X(1:NFFT/2+1)))&#xA;title('Magnitude of FFT');&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('Magnitude |X(f)|');&#xA;&#xA;Cav_len=0.3;%Meter&#xA;delta_L=-40e-6;&#xA;fr=1e9; %Hz&#xA;c=3e8;  %m/s&#xA;n=1:1:NFFT;&#xA;m=500;&#xA;&#xA;S_w=abs(X).^2.*(1+cos((2.*pi.*n.*m.*fr.*Cav_len./c)+(2.*pi.*fr.*n.*delta_L./c)));&#xA;figure()&#xA;plot(f,2*S_w(1:NFFT/2+1))&#xA;xlim([3.6e14 3.9e14])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a7nZN.png&quot; alt=&quot;What I look for (neglect the chirp)&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2rBJg.jpg&quot; alt=&quot;What I get&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The attached images: The first is what I expected , The second is what I get. The terms source is from thesis that I am reading and trying to implement some of the theory.&#xA;I will attach to relevant pages,&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/G1l0j.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cYQrg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5674" LastEditorUserId="5674" LastEditDate="2015-01-04T17:55:04.293" LastActivityDate="2015-01-04T17:55:04.293" Title="Modulating Gaussain Pulse" Tags="|matlab|modulation|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19847" PostTypeId="2" ParentId="2095" CreationDate="2015-01-04T14:39:51.477" Score="0" Body="&lt;p&gt;I didn't have time to fully read the article yet I'll try to answer according to your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take the first equation and convolove it on the left by $ {f}_{i} $ and use the second identity you can see this specific $ g $ holds the equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding how to get this $ g $, I think he uses &quot;Deconvolution&quot; in the Fourier domain.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2016-08-27T11:28:02.283" LastActivityDate="2016-08-27T11:28:02.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19848" PostTypeId="2" ParentId="1032" CreationDate="2015-01-05T06:03:32.857" Score="-2" Body="&lt;p&gt;The fourier transform of ideal lpf is sinc function in time domain which exist from -infinite to +infinite so it is noncausal and area within it is infinite so unbounded. ..&lt;/p&gt;&#xA;" OwnerUserId="12258" LastActivityDate="2015-01-05T06:03:32.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19849" PostTypeId="2" ParentId="6112" CreationDate="2015-01-05T07:45:59.013" Score="3" Body="&lt;p&gt;If the lines are not parallel, you can calculate the point of their intersection and use it as a point of reference. In your painting, you can use the purple points as well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RDgMe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, the intersection of the lines need not to be in the image. As long as the lines are parallel&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the lines are parallel, you can use them to get additional constraints. For instance if you have N&amp;lt;4 points and K lines you might be able to estimate the transformation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that the equation of projective transformation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x' = \frac{\left ( a_{11}x+a_{12}y+a_{13} \right ) }&#xA;     {\left ( a_{31}x+a_{32}y+1 \right )}&#xA;\\&#xA;y' = \frac{\left ( a_{21}x+a_{22}y+a_{23} \right ) }&#xA;     {\left ( a_{31}x+a_{32}y+1 \right )} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your goal is to find the coefficients $a_{11},a_{12},a_{13},a_{21},a_{22},a_{23},a_{31},a_{32} \\$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if there is a line $ax+by+c=0$ that maps to $Ax'+By'+C$, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$  Ax'+By'+C = 0   \implies \\ A(a_{21}x+a_{22}y+a_{23}) + B(a_{21}x+a_{22}y+a_{23}) + C( a_{31}x+a_{32}y+1) = 0  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be re-written as :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;\left( \begin{array}{ccc}&#xA;Ax  &amp;amp; Ay &amp;amp; A &amp;amp; Bx &amp;amp; By &amp;amp; B &amp;amp; Cx &amp;amp; Cy \\&#xA;\end{array} \right) &#xA;\left( \begin{array}{ccc}&#xA;a_{11} \\&#xA;a_{12} \\&#xA;a_{13} \\&#xA;a_{21} \\&#xA;a_{22} \\&#xA;a_{23} \\&#xA;a_{31} \\&#xA;a_{32} \\&#xA;\end{array} \right) =  -C&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A,B,C$ are known values, because you calculated the lines equations. You can input any point $(x,y)$ for which $ ax+by+c = 0 $, and get additional constraint. Combine them together with the constraints that you get from points, and you might get additional information.&#xA;Note that you will not get more information from more than two points, since any third point will add linear dependent lines to the matrix of constraints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional references &quot;&lt;a href=&quot;https://www.cs.ubc.ca/grads/resources/thesis/May09/Dubrofsky_Elan.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Homography estimation by Elan Dubrovsky&lt;/a&gt;&quot; - See part 2.3.1, estimation of homography from lines.&lt;/p&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2015-01-10T18:43:05.607" LastActivityDate="2015-01-10T18:43:05.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19850" PostTypeId="1" AcceptedAnswerId="19904" CreationDate="2015-01-05T11:29:52.813" Score="0" ViewCount="388" Body="&lt;p&gt;I am trying to implement the algorithm described in this paper, I'll quote the relevant portion: &lt;a href=&quot;http://recherche.ircam.fr/equipes/analyse-synthese/roebel/paper/trueenv_dafx2005.pdf&quot; rel=&quot;nofollow&quot;&gt;http://recherche.ircam.fr/equipes/analyse-synthese/roebel/paper/trueenv_dafx2005.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let $V_i(k)$ be the cepstral representation of the spectral envelope at iteration $i$, that is the Fourier transform of the filtered cepstrum, and further initialize the iteration using $A_0(k) = \log(|X(k)|)$ and $V_0(k) = -\infty$. The algorithm then iteratively replaces the current target amplitude spectrum according to&#xA;  $$A_i(k) = \max(A_{i-1}(k), V_{i-1}(k))$$&#xA;  and iteratively applies the cepstral filter to the updated target spectrum $A_i$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Could someone write a simple pseudocode version of this algorithm? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I'm getting confused by exactly what things are named. If I understood correctly, the cepstrum is the inverse fourier transform of the logarithm of the magnitude of the fourier transform of a signal, and, again, &lt;strong&gt;if&lt;/strong&gt; I understood correctly, I was able to implement a smoothed spectrum by zeroing out the samples to the right of the cepstrum, and then taking the fft and exponentiating. However, when I tried to implement this &quot;true envelope&quot; algorithm I was completely lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: as suggested, this is what I think I should do.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = array of -9999999&#xA;a = log(mag(fft(x))&#xA;repeat a couple of times:&#xA;    for k from 0 to a.size():&#xA;        a[k] = max(a[k], v[k])&#xA;&#xA;    //Maybe? Not really sure.&#xA;    v = ifft(log(mag(fft(a)))&#xA;    v[from 50 to v.size()] = 0&#xA;    v = fft(v)&#xA;    //Do I also have to do something to a?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11660" LastEditorUserId="11660" LastEditDate="2015-01-08T11:24:41.700" LastActivityDate="2015-01-08T22:53:16.660" Title="Psudocode implementation of true envelope" Tags="|audio|fourier-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19851" PostTypeId="2" ParentId="19779" CreationDate="2015-01-05T13:14:33.657" Score="2" Body="&lt;p&gt;What you are trying to do is to compare the amplitude of your signal with an amplitude of FFT peak, expecting it is the same. The thing is that amplitude of your signal is varying and FFT is taking the &quot;average&quot; over whole duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In such case you should use time-frequency representation of your signal, such us spectrogram. It will allow you to observe how amplitude of particular frequency is changing over time. Since you work in MATLAB you can try following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;win = hamming(256)&#xA;noverlap = 0&#xA;nfft = 512&#xA;X = abs(spectrogram(spost, win, noverlap, nfft))&#xA;% Scale by window and multiply by 2 to restore energy from negative freqs&#xA;X = 2*X/sum(win)&#xA;surf(X)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It will produce something like:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cRJF7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maximum value of displacement is around $0.053$. Results can be tweaked even further by tweaking even more and using other methods.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-01-05T13:14:33.657" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19852" PostTypeId="2" ParentId="12830" CreationDate="2015-01-05T13:33:55.753" Score="0" Body="&lt;p&gt;Essentia C++/Python library provides several beat tracking algorithms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://essentia.upf.edu/documentation/reference/std_RhythmExtractor2013.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://essentia.upf.edu/documentation/reference/std_RhythmExtractor2013.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the algorithm publish in:&#xA;J.R. Zapata, M. Davies and E. Gómez, &quot;Multi-feature beat tracker,&quot; IEEE/ACM Transactions on Audio, Speech and Language Processing. 22(4), pp. 816-825, 2014. &lt;a href=&quot;http://dx.doi.org/10.1109/TASLP.2014.2305252&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://dx.doi.org/10.1109/TASLP.2014.2305252&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matlab implementation of the multifeature beat tracker is:&#xA;&lt;a href=&quot;https://github.com/JoseRZapata/MultiFeatureBeatTracking&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/JoseRZapata/MultiFeatureBeatTracking&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1792" LastEditorUserId="-1" LastEditDate="2016-11-26T19:07:46.277" LastActivityDate="2016-11-26T19:07:46.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19853" PostTypeId="1" CreationDate="2015-01-05T13:54:19.280" Score="3" ViewCount="9533" Body="&lt;p&gt;It is a well-known artifact that in CMOS cameras with electronic rolling shutter, horizontal banding (flickering), i.e. brightness intensity variations, are observed when the image is recorded under fluorescent lighting. This is due to sequential exposures of the rows of the image, which leads to different intensities in rows of the image due to the 50 Hz (Europe) or 60 Hz (US) AC power line frequency. The light flicker frequency is twice the AC power line frequency, i.e. 100 Hz or 120 Hz, respectively. The figure below (Yoo, 2014) shows the flicker generation process in a CMOS image sensor:&lt;img src=&quot;https://i.stack.imgur.com/zvw18.png&quot; alt=&quot;Flicker generation in rolling shutter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A common solution proposed in the literature for this artifact is to synchronize the exposure time (shutter speed) to an integer multiple of the light modulation period. For example, as seen in the figure, we can set the shutter speed to 1/60 s, and hence avoid flickering (1/120 s would work also since the light modulation frequency is twice the AC power frequency!). However, this solution requires detecting the presence of flicker and estimating the flicker frequency. Various DFT based methods are proposed in the literature but they are usually based on the difference images produced from sequential frames, and are known to not work very well with single images (still frames captured by a digital camera). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if there are any image processing methods which can be applied to a single image, which shows horizontal banding, to remove the horizontal bands through post-processing. In other words, horizontal and periodic intensity variations in the still image needs to be eliminated. A possible scenario is where the shutter speed can take any value (i.e. no sync of exposure time to light modulation frequency), and a still image with horizontal bands has already been recorded. I would like to take this image, apply some kind of filtering (possibly across columns) and get rid of the horizontal bands. In my literature search, I encountered only one such method which suggests using a variation of classical Gaussian filtering (with different Gaussian variances depending on bin intensities), but I could not yet find any other image processing solution. How else can horizontal bands possibly be eliminated through post-processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any references to the literature or suggestions for a possible solution. &lt;/p&gt;&#xA;" OwnerUserId="8751" LastActivityDate="2016-11-17T16:44:09.423" Title="Horizontal banding (flickering) due to electronic rolling shutters" Tags="|image-processing|dft|gaussian|camera|sensor|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19854" PostTypeId="2" ParentId="14085" CreationDate="2015-01-05T17:26:54.273" Score="0" Body="&lt;p&gt;The problem you encountered is related to the presence of a DC component in the velocity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to solve the problem could be to use the &lt;code&gt;detrend()&lt;/code&gt; function (if you are working with MATLAB) in such a way to remove only that component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this does not work well enough than you can thing about applying a filter, high-pass should be enough. Unless you need to remove some noise from the signal, you can set di cut-off frequency to a really low value in order to touch only the DC component you want to remove.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A comment related to the integration method you are using. The trapezium rule only suffers from the introduction of low-frequency components and therefore does not require the use of a low-pass filter (this is why I said an high-pass filter should be enough for your signals).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, some references related to time integration of acceleration measurements:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J.G.T. Ribeiro, J.L.F. Freire, J.T.P. de Castro, &lt;em&gt;Some comments on digital integration to measure displacements using accelerometers&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J.G.T. Ribeiro, J.L.F. Freire, J.T.P. de Castro, &lt;em&gt;New improvements in the digital double integration filtering method to measure displacements using accelerometers&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2015-01-05T17:26:54.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19855" PostTypeId="1" CreationDate="2015-01-05T22:19:07.560" Score="1" ViewCount="159" Body="&lt;p&gt;I've got a sample curve which ends theoretically with decreasing exponential. The curve end falls into noise. The sample points are given in log scale.&#xA;What I want to do, is to find and fit the linear part of the log curve to retrieve the exponential factor. The trick is that I don't know the starting point neither the ending point of the linear part of the log curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The strategy I'm using is to fit a line at each point with at least say 20 points and until the end of the curve is reached. Then from all these regressions, I keep the one with the best determination coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did several tests and found that the RMS error increases with the number of points systematically as the curve becomes more and more noisy, so the extracted factor is always computed on the minimum number of samples (20 in this example case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there a more efficient method to compute this factor ? Does increasing the minimum number of samples improve the accuracy of the fit ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here a sample curve I want to fit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h8ZJB.jpg&quot; alt=&quot;sample curve&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computed slope regarding the position in the curve&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/stXCY.jpg&quot; alt=&quot;slope&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the corresponding RMS error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cx0xQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12267" LastActivityDate="2017-03-28T09:48:11.767" Title="Fit a line pattern on curve with unknown number of points" Tags="|linear-systems|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19856" PostTypeId="2" ParentId="19855" CreationDate="2015-01-06T00:29:46.890" Score="1" Body="&lt;p&gt;A useful approach could be to take the numerical derivative of the function. Then you will get some constant line at some $y=a$, where $a$ is non-zero. This would help to eliminate all the other parts and to determine the starting and eding points of the line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About the fit Matlab has a polyfit command. If the curve of interest is linear than basically this command with parameter $2$ as input will give you the pair $(a,b)$ s.t. the best $ax+b$ fits into the numberical numbers that you provide.&lt;/p&gt;&#xA;" OwnerUserId="1850" LastActivityDate="2015-01-06T00:29:46.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19858" PostTypeId="1" AcceptedAnswerId="19960" CreationDate="2015-01-06T05:35:22.963" Score="1" ViewCount="3988" Body="&lt;p&gt;I am getting incorrect amplitude of my signal post FFT (90% error) and it does not improve after applying any of the window functions prior to FFT. After reading a number of articles, I believe FFT overlapping might improve the accuracy. However, I am not sure how to do it in Matlab. Please could anyone shed some light on that. I tried using spectrogram but I keep getting error on input X to be double precision vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example without performing FFT overlapping:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = 1024; %signal length&#xA;Fs = 1000; %sampling frequency&#xA;t = (0:L-1)'/Fs;&#xA;&#xA;NFFT = 2^nextpow2(L);&#xA;x = 11*sin(2*pi*250*t);&#xA;&#xA;J = flattopwin(L);  &#xA;JX = x(:).*J(:);&#xA;&#xA;P= fft(JX,NFFT)/L;&#xA;M= 2*abs(P(1:NFFT/2+1));&#xA;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;plot(f,M)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The amplitude observed from the plot is approximately 2.4 at 250Hz which is much lesser than the actual amplitude, 11. Is there any reason for the significant reduction of the amplitude on FFT of a windowed signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="11915" LastEditorUserId="8202" LastEditDate="2015-01-11T22:14:04.457" LastActivityDate="2015-01-12T08:20:03.727" Title="FFT Overlap in Matlab" Tags="|fft|amplitude|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19863" PostTypeId="2" ParentId="19858" CreationDate="2015-01-06T11:33:41.027" Score="1" Body="&lt;p&gt;Matlab normalizes in the inverse Fourier transform, so if you want to calculate the fft accurately, you have to normalize by the fft vector by the lenght of the fft itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This matlab script will demonstrate the normalization. There is a 1 seconds long 1000 Hz &#xA;pure sine wave with amplitude 1. We will sample it with fs = 6000 Hz, and calculate the spectrum to it in 60 points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After plotting, we expect two pure spikes at 1000 and -1000 Hz with amplitude 0.5.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 6e3;&#xA;T = 1;&#xA;f = 1000;&#xA;x = sin(2*pi*f*(0:1/fs:T-1/fs));&#xA;Nfft = 60;&#xA;X = fft(x,Nfft)./Nfft;&#xA;stem((0:Nfft-1)*fs/Nfft-fs/2,abs(fftshift(X)))&#xA;title('Normalized spectrum')&#xA;xlabel('frequency')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AhigL.png&quot; alt=&quot;normalized spectrum calculation result&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11208" LastEditorUserId="11208" LastEditDate="2015-01-06T11:38:41.733" LastActivityDate="2015-01-06T11:38:41.733" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19864" PostTypeId="1" AcceptedAnswerId="19865" CreationDate="2015-01-06T14:20:28.830" Score="1" ViewCount="469" Body="&lt;p&gt;Let $a$ and $b$ $\in \mathbb C^N$ and $a[k] = a[k \mod N]$ (same with b). Then the circular convolution of $a$ and $b$ is defined by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ (a * b)[n] = \sum_{p=0}^{N-1} a[p] b[n-p].$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a problem understanding the flip operation on the convolution. Let $(Ja)[n] = a[-n]$, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ J(a*b)[n] = \sum_{p=0}^{N-1} a[p]b[-n-p].$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we first apply the convolution and then we flip the n - is this correct? Or do we flip the whole index of $b$, meaning that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ J(a*b)[n] = \sum_{p=0}^{N-1} a[p]b[-n+p].$$&#xA; On the other hand we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$((Ja)*(Jb))[n] = \sum_{p=0}^{N-1}a[-p]b[n+p].$$&#xA;so we first flip $a$ and $b$ and then apply the convolution. However, my book says $J(a*b)[n] = ((Ja)*(Jb))[n]$, which is not the case with my calculation, so I'm sure did something wrong. Can you help me finding the logical mistake here?&lt;/p&gt;&#xA;" OwnerUserId="9084" LastEditorUserId="9084" LastEditDate="2015-01-06T14:41:21.430" LastActivityDate="2015-01-06T15:58:25.827" Title="Understanding circular convolution" Tags="|discrete-signals|convolution|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19865" PostTypeId="2" ParentId="19864" CreationDate="2015-01-06T15:42:17.370" Score="2" Body="&lt;p&gt;Your first version of $J(a*b)[n]$ is correct:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$J(a*b)[n] = \sum_{p=0}^{N-1} a[p]b[-n-p]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because you simply have to flip $n$, and not the summation index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is in your formulation of the circular convolution of $(Ja)[n]$ and $(Jb)[n]$. It should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$((Ja)*(Jb))[n]=\sum_{p=0}^{N-1} a[-p]b[-n+p]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because you have to negate the arguments of both sequences, so $p$ becomes $-p$, and $n-p$ becomes $-n+p$. Now you can simply change the sign of $p$ because it doesn't matter in which order you compute the sum. This gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$((Ja)*(Jb))[n]=\sum_{p=0}^{N-1} a[p]b[-n-p]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is identical to $J(a*b)[n]$ as given above, as it should be.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-06T15:42:17.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19866" PostTypeId="2" ParentId="19864" CreationDate="2015-01-06T15:58:25.827" Score="2" Body="&lt;p&gt;No, since this is a &lt;em&gt;circular&lt;/em&gt; convolution and thus $a[-n] = a[N-n]$ etc, we have that&#xA;$$\begin{align}&#xA;((Ja)\star(Jb))[n] &amp;amp;= \sum_{p=0}^{N-1} Ja[p]Jb[n-p]\\&#xA;&amp;amp;= \sum_{p=0}^{N-1} a[-p]b[p-n]\\&#xA;&amp;amp;= a[0]b[-n] + \sum_{p=1}^{N-1}a[-p]b[p-n]\\&#xA;&amp;amp;= a[0]b[N-n] + \sum_{p=1}^{N-1}a[N-p]b[p-n]&#xA;\end{align}$$&#xA;Now, as $p$ runs from $1$ to $N-p$, $q = N-p$ runs from $N-1$ to $1$.&#xA;So we substitute $N-q$ for $p$ and write&#xA;$$\begin{align}&#xA;((Ja)\star(Jb))[n] &amp;amp;= a[0]b[N-n] + \sum_{p=1}^{N-1}a[N-p]b[p-n]\\&#xA;&amp;amp;= a[0]b[N-n] + \sum_{q=1}^{N-1}a[q]b[N-q-n]\\&#xA;&amp;amp;= \sum_{q=0}^{N-1}a[q]b[(N-n)-q]\\&#xA;&amp;amp;= (a\star b)[N-n]\\&#xA;&amp;amp;= (a\star b)[-n]\\&#xA;&amp;amp;= J(a\star b)[n]&#xA;\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-01-06T15:58:25.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19867" PostTypeId="2" ParentId="19779" CreationDate="2015-01-06T16:08:58.790" Score="1" Body="&lt;p&gt;Just to supplement what jojek has explained, there are 2 reasons why your amplitude won't match. First is the envelope/amplitude of you signal. It starts at 0 and then ramps up to 0.058. It appears to follow a $1-e^{-\alpha t}$ behaviour. Since this function is essentially multiplied by your sinusoid in the time domain - that implies a convolution in the frequency domain - this convolution will essentially spread out the peak response that you are expecting i.e. some energy will appear in neighbouring frequency bins. You can reduce this effect by taking the FFT of a longer output sequence, and/or start the FFT from time $t=10$ - this essentially helps reduce the effect of the transient start up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second effect may be due to spectral leakage. The FFT only evaluates the response at discrete frequency points. If the frequency of time domain signal does not lie exactly on one of these FFT bins, then you get energy leakage into nearby FFT bins. Again one way to help mitigate this factor is to take the FFT of a longer sequence. A larger FFT means the frequency bins are more closely spaced together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from your frequency plot you do not have a sharp peak - there are sidelobes present - which is why you aren't getting the amplitude you are expecting. Some of that energy is leaking into adjacent frequency bins, due to the discrete nature of the FFT frequency bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One alternative to help improve the amplitude measurement of the FFT is to use a Flattop window on the data, and take a larger FFT - but use more actual data (don't just zero pad). There is a flattop window available directly in Matlab, or you should be able to find some formulas available online.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-01-06T16:08:58.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19868" PostTypeId="1" AcceptedAnswerId="19869" CreationDate="2015-01-06T17:03:13.263" Score="2" ViewCount="234" Body="&lt;p&gt;I am very, very new to signal processing (only started a few days ago) so please bear with me because I may be missing the big picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider an arbitrary signal $x(t)$ with varying frequency to be processed by a computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the right sampling rate w.r.t the frequency, shouldn't the Sampling Theorem essentially imply that no information will be lost at all after the sampled signal is converted back to its continuous form, since there will be a sufficient number of discrete points for which the signal is described?&lt;/p&gt;&#xA;" OwnerUserId="12281" LastEditorUserId="12281" LastEditDate="2015-01-06T22:50:51.357" LastActivityDate="2015-01-07T22:38:59.160" Title="Shouldn't the Sampling Theorem imply that there should be no information loss at all after a signal is processed?" Tags="|discrete-signals|sampling|digital|" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="19869" PostTypeId="2" ParentId="19868" CreationDate="2015-01-06T18:58:46.553" Score="7" Body="&lt;p&gt;For no information to be lost on conversion back to continuous form, the signal would first need to be perfectly band-limited, and you would need an ideal reconstruction filter.  A perfectly band-limited signal is infinite in extent. Since you want this arbitrary signal to be processed by a computer, your computer would need infinite memory.  You would also have to wait an infinite amount of time for your perfect reconstruction filter to settle.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finite sampling time and filter length problems also completely ignores other potential lossy issues, such as quantization and sampling clock jitter, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One might be able to process an infinite signal that can be represented in certain closed symbolic forms within finite time and resources, but there does not seem to be a method to convert any arbitrary signal into such a form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back in the real-world (stuff you can buy or make), one would normally accept an information loss from imperfect band-limiting, finite filter length, jitter (etc.) that is around or below the quantization and numeric noise floors.  This allows the processing to happen using an amount of RAM that one can afford to hopefully finish within one's lifetime.  Thus leading to information loss and imperfect reconstruction.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-01-07T22:38:59.160" LastActivityDate="2015-01-07T22:38:59.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19870" PostTypeId="1" AcceptedAnswerId="19875" CreationDate="2015-01-06T19:08:14.040" Score="5" ViewCount="3518" Body="&lt;p&gt;Does anybody know any open voice/speech annotated database for Voice Activity Detection? Or any other corpus for speech evaluation purposes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ones I know are private: AURORA, TIMIT, SpeechDat-Car, Speecon, Catalan Speecon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option is to create hand-labeled annotations for own recordings, or use a method like the Short-Term Energy Contour. But in the first case the amount of files to process would be insurmountable, and in the second, the energy based methods only work fine for free-noise recordings.&lt;/p&gt;&#xA;" OwnerUserId="7316" LastEditorUserId="7316" LastEditDate="2019-03-24T21:21:23.790" LastActivityDate="2019-03-24T21:21:23.790" Title="VAD speech databases" Tags="|speech-recognition|speech|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19871" PostTypeId="1" CreationDate="2015-01-06T22:27:48.613" Score="0" ViewCount="480" Body="&lt;p&gt;I've started a hobby project which is to detect and count the number of impacts (for example someone clapping, bouncing a ball or hitting a boxing bag).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been reading and playing around (in java) with a few variations of total amplitude, FFT, IIR etc but with so much information and concepts to grasp (I'm normally a web/database developer) I can't figure out which is the right path to follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;practically speaking I know i'll need a high frequency sample rate in order to distinguish between peaks and i think i'll need some form of filtered amplitude to distinguish between the crisp leading edge of the impact and the rumble noise that may follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm hoping someone here can point me in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="12272" LastEditorUserId="12272" LastEditDate="2015-01-06T23:16:29.363" LastActivityDate="2015-01-09T10:11:13.577" Title="detect impact from digital audio" Tags="|fft|audio|infinite-impulse-response|dsp-core|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19873" PostTypeId="1" CreationDate="2015-01-07T06:57:25.080" Score="5" ViewCount="2008" Body="&lt;p&gt;I have an application where I do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DFT-&amp;gt;Filter-&amp;gt;IDFT on a range&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For computational performance I'm zero-padding my FFT to a power of two, but when I take the IDFT I want to get out an interpolated image instead of the zero-padded image. A minor detail, is that the IDFT is performed over only a certain frequency window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do in the Fourier domain to stretch my signal so that the IDFT returns the image without the zeroes I padded it with?&lt;/p&gt;&#xA;" OwnerUserId="941" LastEditorUserId="13320" LastEditDate="2015-01-11T20:14:11.950" LastActivityDate="2016-09-04T14:53:31.217" Title="FFT: Removed padded zeroes?" Tags="|image-processing|fft|dft|zero-padding|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19875" PostTypeId="2" ParentId="19870" CreationDate="2015-01-07T09:16:59.637" Score="4" Body="&lt;p&gt;You can take some big speech corpus like TEDLIUM and add the noise you like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www-lium.univ-lemans.fr/en/content/ted-lium-corpus&quot; rel=&quot;nofollow&quot;&gt;http://www-lium.univ-lemans.fr/en/content/ted-lium-corpus&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The advantage of TEDLIUM is that it's a set of continuous recordings with speech timings, not just a collection of utterances.&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2015-01-07T09:16:59.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19876" PostTypeId="1" AcceptedAnswerId="19884" CreationDate="2015-01-07T10:26:08.777" Score="3" ViewCount="1821" Body="&lt;p&gt;I need to detect a known number of simple markers (chessboard patterns) in a color image efficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I implemented normalized cross correlation (NCC) as a pixel shader via WebGL since I need this to work in a client application in a browser. Detection works fine and is sufficiently robust, but I need better performance. It currently takes a number of seconds to calculate the NCC image, and I'm already using 'obvious' optimizations such as cropping the image (I have a rough indication where the markers should be) and reducing the resolution. I also optimized the code itself (e.g. using loop unrolling, but that is another matter and probably belongs on SO).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image has a resolution of 900x520 pixels and the markers are 22 square pixels. The code runs on tablet computers with Intel Atom processors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is&lt;/strong&gt;: Are there algorithms that are better at utilizing what I know about the image and the marker geometry, ideally ones that are suited for almost branchless pixel shaders? For instance, I was considering a band pass filter (a fourier transformation that only leaves the frequency of the marker, so to speak) or FNCC (JP Lewis's paper), or something that utilizes the fact that the markers are black and white.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, it seems these approaches are comparatively expensive since the FFT of the image isn't cheap and my markers are small compared to the image resolution. Testing a ton of algorithms blindly isn't an option, unless there's a library I'm not aware of that helps me implement this in JavaScript or as glsl pixel shaders. Even then, an indication of a more efficient algorithm would be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Added an image of the marker. The background is normally transparent, of course, i.e. the NCC will ignore those pixels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JeSD0.png&quot; alt=&quot;The marker image I&amp;#39;m looking for in the picture&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13285" LastEditorUserId="7338" LastEditDate="2017-08-21T11:02:14.097" LastActivityDate="2023-04-14T17:42:35.037" Title="Efficient Marker Detection for Images" Tags="|image-processing|computer-vision|cross-correlation|detection|augmented-reality|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="19880" PostTypeId="2" ParentId="4893" CreationDate="2015-01-07T12:35:43.483" Score="2" Body="&lt;p&gt;I would rather look into KAZE / AKAZE, which perform equally good with significant speed-up. The deformation cases are also tolerated. OpenCV has recently obtained an implementation through GSoC 2014. You can find it &lt;a href=&quot;http://docs.opencv.org/trunk/doc/tutorials/features2d/akaze_matching/akaze_matching.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-01-07T12:35:43.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19881" PostTypeId="1" CreationDate="2014-12-30T16:54:06.243" Score="3" ViewCount="575" Body="&lt;p&gt;I want to implement Wiener filter. I have original image and image blurred with linear motion. The one thing I am lack of(to implement it) is Noise power spectrum.&lt;/p&gt;&#xA;&lt;p&gt;I know that it is hard task. I've took a look on different papers:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://kmh-lanl.hansonhub.com/publications/medim98a.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kenneth M. Hanson - A simplified method of estimating noise power spectra&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.researchgate.net/publication/239443817&quot; rel=&quot;nofollow noreferrer&quot;&gt;Felix Krahmer - BLIND IMAGE DECONVOLUTION: MOTION BLUR ESTIMATION&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I don't understand why it is that complicated to just find noise spectrum if I have original signal(image)?&lt;/p&gt;&#xA;&lt;p&gt;If I take noise image minus original image, it will be my error image. And if I estimate variance of it, that will be my Noise variance(Noise Power)?&lt;/p&gt;&#xA;&lt;p&gt;I totally confused and here is my question:&#xA;&amp;quot; How to estimate Power spectrum of the noise of the blurred image if I have original image?&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Btw, I don't want get some matlab function which will do all of it, but rather algorithm or equation that I can implement.&lt;/p&gt;&#xA;" OwnerUserId="47715" OwnerDisplayName="Mykola Servetnyk" LastEditorUserId="7092" LastEditDate="2023-07-01T17:49:53.680" LastActivityDate="2024-04-01T00:00:45.143" Title="Estimate Image power spectrum of the noise" Tags="|matlab|image-processing|noise|estimation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="19883" PostTypeId="2" ParentId="19855" CreationDate="2015-01-07T15:38:47.470" Score="0" Body="&lt;p&gt;Have you tried the &quot;normal probability plot&quot; or as referred to nowadays qqnorm programs?  You plot the data horizontally and vertically you plot the test distribution. If you are unfamiliar read:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Normal_probability_plot&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Normal_probability_plot&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.itl.nist.gov/div898/handbook/apr/section2/apr221.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.itl.nist.gov/div898/handbook/apr/section2/apr221.htm&lt;/a&gt;&#xA;I have used it a lot and it allows one to visually (or numerically if one is wedded to numbers) evaluate the quality of a fit.  I am far more confident in my decisions when I can see the results as a graph.&#xA;Process:&#xA;Make a non-logarithmic model of the process; v=a*ln(f) +w  where &quot;w&quot; is an assumed white additive Gaussian noise and &quot;a&quot; is the parameter of be estimated.&#xA;Solve for &quot;a&quot;: a=(v-w)/ln(f)  and plot using data from a &quot;window&quot; where you think the model is correct.&#xA;See if you have a straight line; or straight enough for your purposes.  If so you can read off the SD and average slope immediately; although I would vary the window size to make sure that estimate is converging as the size gets smaller.&#xA;If the fit/&quot;straightness&quot; isn't good enough try another model or assumed PDF and repeat.&#xA;End process:&#xA;It's really fun.  As they say in war; no model survives it's first encounter with data :)  In other words: you need an approach that's adaptable for the particular data you have in hand.&lt;br&gt;&#xA;Probability/qqnorm plotting provides that.  If you do it in the R language it has an enormous number of PDF's  you can try against one model; together with an impressive online community.  The NIST dataplot program also have a reasonable number of pdf's.&#xA;I can offer help if needed but I think it would be far..far better if you mastered it; presuming you haven't done it already.&#xA;Of course: YMMV&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2015-01-07T15:38:47.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19884" PostTypeId="2" ParentId="19876" CreationDate="2015-01-07T16:07:44.870" Score="2" Body="&lt;p&gt;This is a saddle point. I would suggest using derivative operators to spot such discontinuities. In fact, Haralick presents a broad overview of these methods in his &lt;a href=&quot;http://haralick.org/journals/topographic_primal_sketch.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Topographic Primal Sketch&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The use of approximate Facet model would give you a speed boost. I used them for edge detection &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/35329-simple-edge-detection-using-classical-haralick-method/content/detect_edges_haralick.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;mathworks file exchange - Simple Edge Detection Using Classical Haralick Method&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There is also one implementation available &lt;a href=&quot;https://code.google.com/p/uhiris/source/browse/trunk/matlab/ProcessFrame.m?spec=svn42&amp;amp;r=42&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Even though this question and the topic is rather old, I would like to update that, the method presented in the following work contains no branching and is quite suitable for the shader:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Birdal, Tolga, Ievgeniia Dobryden, and Slobodan Ilic. &lt;a href=&quot;http://campar.in.tum.de/pub/tbirdal20163dv/tbirdal20163dv.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;X-Tag: A&#xA;Fiducial Tag for Flexible and Accurate Bundle Adjustment&lt;/a&gt;. &lt;em&gt;3D Vision (3DV), 2016 Fourth International Conference on. IEEE, 2016.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7092" LastEditDate="2023-04-14T17:42:35.037" LastActivityDate="2023-04-14T17:42:35.037" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="19885" PostTypeId="1" AcceptedAnswerId="19893" CreationDate="2015-01-07T18:31:38.943" Score="2" ViewCount="109" Body="&lt;p&gt;I was wondering if someone could maybe clarify or direct me to the best answer for this question.  I want to estimate velocities from position data.  However, the position data is fuzzy but I have an idea of its uncertainty.  My initial sense is that one is supposed to use some iteration of a Kalman filter, but from my limited understanding of it, you need to know at least one parameter with some certainty, i.e., the position data.  So to summarize, my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible to estimate velocity values given fuzzy position data?&lt;/li&gt;&#xA;&lt;li&gt;If so, what are some available techniques for doing so?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13290" LastEditorUserId="698" LastEditDate="2015-01-08T11:32:43.813" LastActivityDate="2015-09-05T14:41:10.060" Title="Estimating Velocity from Fuzzy Position Data with Known Uncertainty" Tags="|filters|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19886" PostTypeId="2" ParentId="19871" CreationDate="2015-01-07T19:46:56.930" Score="1" Body="&lt;p&gt;If your environment's noise level allows it, you can use a quiet no-brainer solution. Just make sure that the impacts have greater peak amplitude than the noise floor in every case.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Specify a threshold level based on previous experiments. This level has to be great enough for all the impacts you generate and you want to detect. If your signal crosses the level, you can assume, that an impact has happened.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If a detection has occurred, you can start a timer, that prevents unwanted re-detection for the same impact because you can't expect that your impact will be below the threshold for the next sound sample. For this reason, the timer has to run longer than the maximum detectable length of any impacts. Until the timer runs, you disable the threshold detection.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After the timer has fired, you can enable the threshold detection again.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w7UmA.jpg&quot; alt=&quot;sketch for the method&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method requires previous experiment and knowledge about the detectable impacts. You have to determine the minimum sampling rate that allows you to catch at least a few sample of the impact. Standard audio quality sampling rate would be good enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can of course apply signal conditioning by filtering the signal with a digital filter, but this necessity is highly depends on your environment and noise floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that this is possibly the most no-brainer solution. There are many more sophisticated methods for this particular problem.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="11208" LastActivityDate="2015-01-07T19:46:56.930" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19890" PostTypeId="1" AcceptedAnswerId="19891" CreationDate="2015-01-08T10:10:39.343" Score="0" ViewCount="4956" Body="&lt;p&gt;How do we define convolution of: $$x(t)= \mathrm{sinc}(W t)$$ and $$y(t)= -j\mathrm{sinc}(2W t)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt; In the frequency domain, both of them are rectangular functions and multiplication of them is equal to the rectangular signal with smaller bandwidth i.e $x(t)$, which means convoluted signal is $\mathrm{sinc}(W t)$ with some scaling factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I do not understand how this could be done, the two signals are orthogonal (because one is real and the other imaginary). So shouldn't convolution be 0? I would appreciate if someone could explain.&lt;/p&gt;&#xA;" OwnerUserId="13298" LastEditorUserId="4298" LastEditDate="2015-01-08T12:41:57.127" LastActivityDate="2015-01-08T15:37:47.533" Title="convolution of a real and complex signal" Tags="|convolution|dsp-core|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19891" PostTypeId="2" ParentId="19890" CreationDate="2015-01-08T10:59:06.640" Score="3" Body="&lt;p&gt;You are confusing several different notions. First of all, two signals $x(t)$ and $y(t)$ are orthogonal if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}x(t)y^*(t)dt=0\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) it is clear that if two real-valued functions $x(t)$ and $y(t)$ are &lt;em&gt;not&lt;/em&gt; orthogonal, i.e. the integral in (1) is not equal to zero, then also $x(t)$ and $jy(t)$ are not orthogonal. So your argument that the two given signals must be orthogonal because one of them is real-valued and the other one is imaginary is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, even if two signals are orthogonal to each other, their convolution is usually non-zero. Just take two rectangular functions that do not overlap. Obviously, they are orthogonal, but their convolution is a triangular function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, one way to interpret the convolution of the two sinc functions is that a low pass signal with cut-off frequency $W$ is filtered by a low pass filter with cut-off frequency $2W$, and multiplied by the (irrelevant) factor $-j$. Since the low pass filter has no effect on the low pass signal, the only change to the signal is the constant factor $-j$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-08T10:59:06.640" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19892" PostTypeId="1" AcceptedAnswerId="19949" CreationDate="2015-01-08T11:21:58.580" Score="0" ViewCount="1592" Body="&lt;p&gt;I have a cosine function - Hence it is even. Considering only the real parts of the DFT, on performing DFT, I am getting something like this. Could anybody tell me where I am going wrong:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/H599U.png&quot; alt=&quot;Cos wave&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;DFT:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dnLDI.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Please let me where I am going wrong with the implementation&lt;/p&gt;&#xA;" OwnerUserId="11438" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-01-11T02:49:37.267" Title="Discrete Fourier transform of even function" Tags="|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19893" PostTypeId="2" ParentId="19885" CreationDate="2015-01-08T11:27:49.980" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes it is. That what's Kalman filter is all about. Your measurement includes position data, and there is a hidden velocity parameter. You will need some kind of model, like constant-velocity. You can input your idea of uncertainty into Kalman noise matrixes to improve results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can use Kalman filter, which is good to predict the future. If you just want to estimate the velocity in post-processing step (after you have all data), you can use something simpler, like estimating the derivative. This will have the advantage of being smoother and more accurate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-01-08T11:27:49.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19894" PostTypeId="2" ParentId="19892" CreationDate="2015-01-08T11:34:28.367" Score="0" Body="&lt;p&gt;The real question is: what did you expect to see and why? I give you a few ideas and hints to help you understand the problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if you use the time domain data as shown in the top figure, then the first (left-most) point is interpreted as time index $n=0$ (there goes the cosine ...). Just look at the formula for the DFT and you'll see why.&lt;/li&gt;&#xA;&lt;li&gt;Second, the implicit periodic continuation of the time domain data in the DFT means that you don't have a pure sinusoid (just append the first data point after the last data point and so on, and you'll see the problem). What you probably wanted is an integer number of periods in your time window (= DFT length), because then the periodic continuation will not change your nice sinusoid.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-08T11:34:28.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19895" PostTypeId="1" CreationDate="2015-01-08T13:02:04.850" Score="0" ViewCount="371" Body="&lt;p&gt;I'm trying to filter an image vertically to get the edges, in MATLAB, but I get very different results from convultion and correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CODE:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vf = fspecial('prewitt');&#xA;&#xA;iyconv = imfilter(im, vf, 'replicate', 'conv');&#xA;iycorr = imfilter(im, vf, 'replicate', 'corr');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;result in the image below,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IICwq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;why does the convultion only outputs the lower part of the mouth, and on contrary the correlation teh upper?&lt;/p&gt;&#xA;" OwnerUserId="4940" LastActivityDate="2018-07-23T11:46:43.213" Title="Problems filtering image with prewitt" Tags="|matlab|filters|image-processing|convolution|correlation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19896" PostTypeId="1" CreationDate="2015-01-08T13:21:26.383" Score="0" ViewCount="191" Body="&lt;p&gt;I understand that the question I am asking seem the be somewhat related to another question which &lt;a href=&quot;https://dsp.stackexchange.com/questions/966/pattern-recognition-for-temporal-data&quot;&gt;has been asked already.&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I feel that this is an entirely different question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a huge (over 100K data points) time series data of the position (x, y coordinates) of an element in space. This element is vibrating randomly, and both amplitude and the frequency of vibration is random. I want to look at the vibrations which are similar and see if there is any pattern in those vibrations, are they periodic or related somehow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on a biological problem and have very little knowledge about signal processing. I can provide more details Any help would be really appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!!&lt;/p&gt;&#xA;" OwnerUserId="13301" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-01-08T13:21:26.383" Title="pattern recognition in a time series" Tags="|time-frequency|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19897" PostTypeId="1" CreationDate="2015-01-08T13:27:05.833" Score="0" ViewCount="107" Body="&lt;p&gt;In the context of bit timing synchronisation in digital communications, what is meant by the requirement that says the &quot;Time to lock to a sampling point should be no more than X symbols&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seems to be no information about this issue online.&lt;/p&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="13320" LastEditDate="2016-05-13T10:36:45.787" LastActivityDate="2016-05-13T10:36:45.787" Title="&quot;Time To Lock&quot; in Bit Timing Synchronisation" Tags="|digital-communications|timing|synchronization|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19898" PostTypeId="2" ParentId="19890" CreationDate="2015-01-08T15:08:24.397" Score="0" Body="&lt;p&gt;You can treat the $-j$ in $y(t)$ as a simple scaling factor. Let's redefine $y(t)=\mathrm{sinc}(2Wt)$. Now we want&#xA;$$ x(t)\otimes -jy(t)= \int_{-\infty}^\infty -jx(\tau)y(t-\tau)d\tau=-j\int_{-\infty}^\infty x(\tau)y(t-\tau)d\tau= -j\big[x(t)\otimes y(t)\big]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you have already noted the Fourier transform of the sinc() is a rectangular pulse, so the result of multiplication in the frequency domain is just a rectangular pulse with the smaller bandwidth - note you do have to take into account the amplitude scaling since:&#xA;$$ \mathrm{sinc}(2Wt) \rightleftharpoons \frac{1}{2W}\mathrm{rect}\bigg(\frac{f}{2W}\bigg) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this information and what Matt provided in his answer, you should be able to easily find your answer.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2015-01-08T15:37:47.533" LastActivityDate="2015-01-08T15:37:47.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19899" PostTypeId="1" CreationDate="2015-01-08T16:42:05.447" Score="4" ViewCount="4085" Body="&lt;p&gt;I am doing impedance measurements, where I do a frequency sweep of a test current, and I measure the resulting voltage. Offline, I compute the FFTs of the voltage and current, and I want to make sure that the voltage is above the 'local' noise floor. I don't care if the signal at the test frequency isn't the biggest, as long as it is above the 'local' noise floor.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is an example of a signal that's acceptable. The red-dot is the frequency of interest. There are components at least 20dB bigger than the frequency of interest, but the frequency of interest is around 20dB above the 'local' noise floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nZJSg.png&quot; alt=&quot;Example 1 - acceptable&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a second example which I would want to be alerted to. It appears to be around 10dB above the noise floor, but zooming in you can see that there is another component too close.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e0MP2.png&quot; alt=&quot;Example 2 - questionable&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2zKvd.png&quot; alt=&quot;Example 2 (zoomed) - questionable&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 2 (zoomed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My ideas so far are to do peak detection on the FFT (i.e. one point at the peak of each lobe), then peak detection again on the peaks, and see if the frequency of interest is a local peak. If so, the &quot;SNR&quot; that I report is the component of interest (in dB) - closest peak-peak (in dB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have suggestions on a good way to calculate the &quot;local SNR&quot;?&lt;/p&gt;&#xA;" OwnerUserId="13305" LastActivityDate="2015-09-11T18:27:44.273" Title="How to determine SNR from FFT of measured data?" Tags="|fft|noise|signal-detection|snr|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19900" PostTypeId="2" ParentId="19841" CreationDate="2015-01-08T16:42:26.687" Score="0" Body="&lt;p&gt;As I've mentioned in a comment, &lt;em&gt;time variant signal&lt;/em&gt; is a term which is not commonly used in signal processing, and I also couldn't find a clear definition. After browsing a few texts which use the term (usually written by people not specialized in signal processing), I've come to the conclusion that by &lt;em&gt;time variant&lt;/em&gt; signals they actually mean &lt;em&gt;non-stationary&lt;/em&gt; signals. The latter being a clearly defined term (check the &lt;a href=&quot;http://en.wikipedia.org/wiki/Stationary_process&quot; rel=&quot;nofollow&quot;&gt;wikipedia page on stationarity&lt;/a&gt;). In short, it means that the signal's properties, such as its mean and variance, change over time. And this is indeed the case with EEG signals, just as it is the case with speech signals.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-08T16:42:26.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19901" PostTypeId="2" ParentId="19841" CreationDate="2015-01-08T18:58:11.737" Score="0" Body="&lt;p&gt;The term is often used for systems, not signals. However, a natural definition would be any signal $x[n]$ which  is dependent on $n$ is a time-varying signal. For exaple, the singal $x[n] = 2$ is not time-variant.&lt;/p&gt;&#xA;" OwnerDisplayName="user13307" LastActivityDate="2015-01-08T18:58:11.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19902" PostTypeId="1" CreationDate="2015-01-08T21:51:42.813" Score="3" ViewCount="246" Body="&lt;p&gt;A common estimation problem in signal processing assumes the following signal model&#xA;\begin{equation}&#xA; \mathbf{r} = \sum_{i=1}^{Q}\alpha_i\mathbf{s}\left(w_i\right)+\mathbf{n}&#xA;\end{equation}&#xA;where $\mathbf{s}(w)$ is a known vector function, and $\mathbf{n}\sim \mathcal{CN}(0,\sigma^2\mathbf{I})$ is white Gaussian noise with variance $\sigma^2$.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Column vector $\mathbf{r}\in\mathbb{C}^N$ constitutes the noisy data.&lt;/li&gt;&#xA;&lt;li&gt;Parameters $w_1,\ldots,w_Q$ are unknown and need to be estimated.&lt;/li&gt;&#xA;&lt;li&gt;$\alpha_1,\ldots,\alpha_Q$ are zero-mean complex random Gaussian variables with unknown variance.&lt;/li&gt;&#xA;&lt;li&gt;$Q$ is the number of parameters to be estimated and is known.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A very useful family of estimators rely on some properties of the correlation matrix which is&#xA;\begin{equation}&#xA; \operatorname{E}\mathbf{r}\mathbf{r}^H =&#xA; \mathbf{S}\left(\mathbf{w}\right)&#xA; \mathbf{A}&#xA; \mathbf{S}^H\left(\mathbf{w}\right)&#xA; + \sigma^2\mathbf{I}&#xA;\end{equation}&#xA;where $\mathbf{A}=\operatorname{E}\,[\alpha_1,\ldots,\alpha_Q]^T[\alpha_1,\ldots,\alpha_Q]^*$, $\mathbf{S}(\mathbf{w})=[\mathbf{s}(w_1),\ldots,\mathbf{s}(w_Q)]$, $(\cdot)^T$ is the transpose operator, $(\cdot)^*$ is the conjugate operator, and $(\cdot)^H$ is the transpose and conjugate operator. In practice, the correlation matrix is estimated using the sample covariance matrix defined as&#xA;\begin{equation}&#xA; \hat{\mathbf{R}}=\frac{1}{K}\sum_{k=1}^{K}\mathbf{r}_k\mathbf{r}_k^H&#xA;\end{equation}&#xA;where $\mathbf{r}_k$ are independent realizations of $\mathbf{r}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denote $\lambda_1,\ldots,\lambda_N$ and $\mathbf{v}_1,\ldots,\mathbf{v}_N$ the eigenvalues and eigenvectors of $\hat{\mathbf{R}}$, respectively. The eigenvalues are ordered from largest to smallest (all are non-negative because $\hat{\mathbf{R}}$ can be shown to be a Gramian matrix). Then in such case it turns out that&#xA;\begin{equation}&#xA; \begin{bmatrix}&#xA;  \mathbf{v}_1 \cdots \mathbf{v}_Q&#xA; \end{bmatrix}&#xA; \operatorname{diag}\left(\lambda_1-\sigma^2,\ldots,\lambda_Q-\sigma^2\right)&#xA; \begin{bmatrix}&#xA;  \mathbf{v}_1 \cdots \mathbf{v}_Q&#xA; \end{bmatrix}^H&#xA; \rightarrow&#xA; \mathbf{S}\left(\mathbf{w}\right) &#xA; \mathbf{A}&#xA; \mathbf{S}^H\left(\mathbf{w}\right)&#xA;\end{equation}&#xA;in probability when $K\rightarrow +\infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without going into further unnecessary detail my question is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is it known the exact/asymptotic/approximated distribution of $\begin{bmatrix}&#xA;  \mathbf{v}_1 \cdots \mathbf{v}_Q&#xA; \end{bmatrix}&#xA; \operatorname{diag}\left(\lambda_1,\ldots,\lambda_Q\right)&#xA; \begin{bmatrix}&#xA;  \mathbf{v}_1 \cdots \mathbf{v}_Q&#xA; \end{bmatrix}^H$?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know the sample covariance matrix has a Wishart distribution, but I do not know what is the distribution of such &lt;em&gt;signal covariance matrix&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11735" LastEditorUserId="11735" LastEditDate="2015-01-09T00:14:39.527" LastActivityDate="2015-01-09T00:14:39.527" Title="Distribution of a signal covariance matrix" Tags="|estimation|statistics|matrix|covariance|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19903" PostTypeId="2" ParentId="8652" CreationDate="2015-01-08T22:14:15.780" Score="1" Body="&lt;p&gt;Matlab reference code to do a 1536 FFT using 512 point base FFT&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% 1536 FFT based on three FFTs of 512 each&#xA;n = 1536; &#xA;% Create a piece of noise&#xA;x = randn(n,1);&#xA;% calcuate FFT using MATLAB native fft() function. &#xA;% We'll use this as a reference to prove it works&#xA;fx = fft(x);&#xA;% Break down into three signals of 512 points each &#xA;p = x(1:3:end);&#xA;q = x(2:3:end);&#xA;r = x(3:3:end);&#xA;% FFT each of those. This is  a 512 power-of-two standard FFT&#xA;fp = fft(p);&#xA;fq = fft(q);&#xA;fr = fft(r);&#xA;% Do three times periodic extention (just repeat it three times)&#xA;fp3 = [fp; fp; fp];&#xA;fq3 = [fq; fq; fq];&#xA;fr3 = [fr; fr; fr];&#xA;% calucate the 1536 twiddle factors&#xA;k3 = (0:n-1)';&#xA;W3 = exp(-j*2*pi*k3/n);&#xA;% assemble the result&#xA;fy3 = fp3 + W3.*fq3 + W3.^2.*fr3;&#xA;% calcualte the error&#xA;ferror = fy3-fx;&#xA;fprintf('Error = %6.2f dB\n',10*log10(sum(ferror.*conj(ferror))./sum(fx.*conj(fx))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-01-08T22:14:15.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19904" PostTypeId="2" ParentId="19850" CreationDate="2015-01-08T22:53:16.660" Score="0" Body="&lt;p&gt;As far as I can say, your interpretation is valid, but given the pseudo-code you provide, somehow, there seems to be some confusion with the definition of the quantities. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my understanding, the $A_i(k)$ are the (real-valued) $\log$-amplitudes. For this reason, you do not need to compute the $\log$ of these values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the $V(k)$ are actually also $\log$-amplitudes. While I can understand to some extend that you use the same name both for $V$ and its inverse Fourier transform, this may be confusing when trying to understand the algorithm (and debugging it...). In addition, this could be an issue, depending whether the result of the IFT is real or not - this, in turn, depends on whether you &quot;hermitianize&quot; your vector $A$ before the IFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A tentative correction for your pseudo-code would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = array of -9999999&#xA;a = log(mag(fft(x))&#xA;repeat a couple of times:&#xA;    for k from 0 to a.size():&#xA;        a[k] = max(a[k], v[k])&#xA;&#xA;    vc = ifft(a) // let's assume vc is complex Hermitian, so we just keep the first half of the vector &#xA;    vc[from 50 to v.size()] = 0&#xA;    v = fft(vc) // here, be careful that the result is real &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I did not try to implement it. Nevertheless, it seems to make sense that way. Let me know if that solves your problem!&lt;/p&gt;&#xA;" OwnerUserId="1301" LastActivityDate="2015-01-08T22:53:16.660" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19905" PostTypeId="2" ParentId="19294" CreationDate="2015-01-09T01:32:52.757" Score="0" Body="&lt;p&gt;You want to implement a 2D NxN Fast DCT-i (Discrete Cosine Transform)&#xA;where -i refers to the type of DCT with slight modifications and type-II (DCT-II) being the most widely used one in such as old JPEG image codecs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: since both 2D-FTT and 2D-DCT has a separable kernel, a 2D DCT-II is implemented from a 1D DCT-II in practice (as you described)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the literature you may find many fast implementations of DCT.&#xA;Here I will put an example how to use FFTs to implement a DCT-II in 1D (from K.R.Rao). It's not the most efficient one though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;step-1: given the N-point (length of N) signal xN[n] for n=0 to n=N-1&lt;br&gt;&#xA;step-2: padd it with N-point zeros at the end to make it a 2N-point signal x2N[n]&lt;br&gt;&#xA;step-3: compute 2N-point FFT of this 2N-point x2N[n] call it X2N[k]&lt;br&gt;&#xA;step-4: multiply X2N[k] by c(k) * exp(-j&lt;em&gt;k&lt;/em&gt;PI/2*N), &#xA;where c(0)=1/sqrt(2) and c(k)=1 for k=1,...,N-1&lt;br&gt;&#xA;step-5: naming the output of step4 as Y[k] then 1D DCT[k]= Re{Y[k]}, k=0,N-1&lt;br&gt;&#xA;step 6: multiply DCT[k] with sqrt(2/N) if you need to get a Normalized DCT[k]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for 1D DCT-II computation. After getting it you should adopt it into row-column decomposition to get a 2D result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is a sample matlab code to verify the steps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;------------------------------------------------&#xA;N=8;               % Length of DCT-II                   &#xA;x=randn(1,N);      % create a test signal&#xA;&#xA;c = ones(1,N);     % prepare the coefficients c[k]       &#xA;c(1)= 1/sqrt(2);   %      &#xA;&#xA;x2 = [x zeros(1,N)];    % padd xN[n] with zeros  (step-2)   &#xA;X2 = fft(x2 , 2*N);     % get FFT of padded signal x2N[n]  (step-3)     &#xA;&#xA;Y = c.* exp(-j* pi* [0:N-1]/(2*N)).* X2(1:N);   % (step:4)  &#xA;XdctNormalized = sqrt(2/N).* real(Y);    % (steps 5-6)   &#xA;-----------------------------------------------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can actually find these in the following books:&lt;br&gt;&#xA;1- 2D Image and Signal Processing (Jae S. Lim)&lt;br&gt;&#xA;2- Techniques &amp;amp; Standards for Image-Video &amp;amp; Audio Coding (K.R.Rao)&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-01-09T11:54:33.070" LastActivityDate="2015-01-09T11:54:33.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19906" PostTypeId="2" ParentId="19895" CreationDate="2015-01-09T09:05:20.557" Score="1" Body="&lt;p&gt;Prewitt kernel is rotated 180 degree between correlation and convolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check this link: &lt;a href=&quot;http://www.equalis.com/blogpost/731635/129540/Convolution-and-Correlation-in-Image-Processing&quot; rel=&quot;nofollow&quot;&gt;http://www.equalis.com/blogpost/731635/129540/Convolution-and-Correlation-in-Image-Processing&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="12159" LastActivityDate="2015-01-09T09:05:20.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19907" PostTypeId="1" AcceptedAnswerId="20018" CreationDate="2015-01-09T09:11:19.013" Score="9" ViewCount="2973" Body="&lt;p&gt;Many times we have a stream of video to process without access to camera. Having access to camera matrix would be beneficial for various processing techniques. Is it possible to hack camera calibration without having access to the camera?&lt;/p&gt;&#xA;&lt;p&gt;I have a stream of video from a single camera mounted on a moving car recording the road (Hence multiple parallel lines on the ground plane, corners from lane markers but no circles). I want to create a top-down view of this but I do not have access to the camera. Is it possible? If so how?&lt;/p&gt;&#xA;&lt;p&gt;I understand from &lt;a href=&quot;https://books.google.com/books?id=seAgiOfu2EIC&amp;amp;lpg=PA409&amp;amp;dq=Bird%27s%20Eye%20View%20OpenCV%20intrinsics%20distortion%20homography&amp;amp;pg=PA409#v=onepage&amp;amp;q=Bird%27s%20Eye%20View%20OpenCV%20intrinsics%20distortion%20homography&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;Learning OpenCV: Computer Vision with the OpenCV Library&lt;/a&gt; book that I need the following matrices:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Intrinsics, and&lt;/li&gt;&#xA;&lt;li&gt;Distortion&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;.. to &lt;code&gt;cv2.undistort()&lt;/code&gt; the image, compute homography &lt;code&gt;cv2.getPerspectiveTransform()&lt;/code&gt; and &lt;code&gt;cv2.warpPerspective()&lt;/code&gt; to finally get the topview.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can I compute/approximate/guess Intrinsics or Distortion Matrices/parameters? Are all parameters important?&lt;/li&gt;&#xA;&lt;li&gt;Would it be okay to copy parameters from other cameras (like OpenCV source code samples)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;Prior Research:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html#calibration&quot; rel=&quot;noreferrer&quot;&gt;OpenCV Python Camera Calibration Tutorial&lt;/a&gt; - Requires Access to the Camera&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Camera_auto-calibration&quot; rel=&quot;noreferrer&quot;&gt;Camera AutoCalibration&lt;/a&gt; - Gives hope &amp;quot;calibration may be obtained if multiple sets of parallel lines or objects with a known shape (e.g. circular) are identified&amp;quot;&lt;/li&gt;&#xA;&lt;li&gt;Attempting to understand camera calibration related answers[&lt;a href=&quot;https://dsp.stackexchange.com/questions/17378/camera-calibration-using-single-input-image&quot;&gt;1&lt;/a&gt;][&lt;a href=&quot;https://dsp.stackexchange.com/questions/10537/ground-plane-estimation-from-a-single-image-was-confusion-about-homography-and&quot;&gt;2&lt;/a&gt;][&lt;a href=&quot;https://stackoverflow.com/questions/15530168/determine-extrinsic-camera-with-opencv-to-opengl-with-world-space-object&quot;&gt;3&lt;/a&gt;] on SO trying to find answers to my problem.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Any ideas? Appreciate your help in advance!&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update 1: Perspective Transform Experiment&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I had attempted using &lt;code&gt;getPerspectiveTransform(pts1,pts2)&lt;/code&gt; and &lt;code&gt;dst = cv2.warpPerspective(img,M,(x,y), flags=flags)&lt;/code&gt; to match four points of input image to get a sort of top-down view. But I am not sure how to handle the distortions:&lt;/p&gt;&#xA;&lt;p&gt;Selecting Points: First, I zoomed in on the input and tried to precisely select matching exterior points on the lane markers to create the Homography Matrix and previewed the perspective transformed image with &lt;code&gt;warpPerspective&lt;/code&gt;. I saw the lanes were distorted but didn't know how bad. To get an idea I chose points further out by delta (50px) flat on each end. This is what I get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nrKMn.jpg&quot; alt=&quot;Image Experiment&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can I fix the distortions without having access to the camera? Is there any other way to fix this.&lt;/p&gt;&#xA;&lt;p&gt;Few input images to play with:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/B1wff.png&quot; alt=&quot;Imgur&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SCoqo.png&quot; alt=&quot;Imgur&quot; /&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update 2: Non-Parallel (Scattered) Optical Flow in Top-Down View&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is this due to distortion or something else?:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/j0NGQ.jpg&quot; alt=&quot;Imgur&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="12192" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-01-18T02:27:32.867" Title="Is it possible to hack camera calibration without having access to the camera?" Tags="|computer-vision|opencv|python|camera-calibration|projection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19908" PostTypeId="2" ParentId="19871" CreationDate="2015-01-09T09:51:49.427" Score="1" Body="&lt;p&gt;A good advice would be to load the sound file into Audacity, and look at the spectrogram (FFT) representation in there. Impact (impulse) sounds are easily spotted visually in the spectrogram, as they're sharp vertical lines. Echo's may trail, so the right side is usually a bit fuzzy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That also gives you the simple algorithm to detect them: for every FFT bin, look for a sharp and sudden increase in energy. &lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2015-01-09T09:51:49.427" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19909" PostTypeId="2" ParentId="19871" CreationDate="2015-01-09T10:11:13.577" Score="0" Body="&lt;p&gt;If you are only after a certain few types of impact, then you might try this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Make clean recordings of each impact type - trim the recordings to remove extraneous samples before and after the impact.&lt;/li&gt;&#xA;&lt;li&gt;As you are sampling, run a cross correlation with each of the recordings.&lt;/li&gt;&#xA;&lt;li&gt;A peak in a cross correlation indicates an impact of that type.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You will want to use the lowest sampling rate that still delivers recognizable recordings - this is to reduce the processing load.  I would try using 8kHz - most sound cards can deliver this rate, even though it isn't commonly used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the correlation working, you can do a real time plot of the correlation level and determine what levels to use for detection.&lt;br&gt;&#xA;I would take the log of absolute value of the correlation, run that through a high pass filter with a cut off of 10Hz, then look for changes above a certain level.  Doing it that way will let you detect a peak regardless of the input level - it works sort of like an automatic gain control, but it tracks the ambient sound level faster. The cutoff can be raised to anything lower than the frequencies in the onset of the impact, and it will still work.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-01-09T10:11:13.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19910" PostTypeId="1" AcceptedAnswerId="19919" CreationDate="2015-01-09T12:00:56.297" Score="0" ViewCount="121" Body="&lt;p&gt;I'm starting a project where we will have to analyze bird recordings. We will try to measure the birds activity using the audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The recordings are really long (around 24 hours each) and recorded in IMA ADPCM WAV. &#xA;All files are about 1.5GB each. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When trying to import them into MATLAB, it simply locks up because of the size of the files (I think). So we were thinking about heavily compressing the files to 8KBPS mp3's, which would result in files of around 100MB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now I know mp3 compression is based on the psychoacoustics of the human hearing, so I was wondering whether using mp3 compression would throw away data dat would be needed for the analyzation.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it does throw away data that we would need, what would be the best route to take? Are there other compression techniques that might be better suited to our needs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="13318" LastActivityDate="2015-01-09T19:07:24.017" Title="Will lossy compression prevent me from performing audio analysis?" Tags="|compression|mp3|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19911" PostTypeId="1" AcceptedAnswerId="20031" CreationDate="2015-01-09T12:42:03.503" Score="2" ViewCount="778" Body="&lt;p&gt;I want to generate the &quot;projection&quot; image described as bellow. The left picture is the original picture and the right image is what I want. But, I have no idea about how to generate the right image. I know that OpenCV can only generate affine effect, so I know that only OpenGL or Matlab can generate this effect. However, I have no experience about OpenGL combined with Visual C++, so I don't know how to generate the right picture by OpenGL. Besides, according to other webside, I know that function &quot;affine3d&quot; in Matlab can achieve this effect, but my Matlab doesn't provide this function. Is anyone who can help me? Please. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LTnjt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11826" LastActivityDate="2015-02-13T23:37:25.717" Title="Generate projection image by OpenGL or Matlab" Tags="|image-processing|matlab|computer-vision|projection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19912" PostTypeId="2" ParentId="19910" CreationDate="2015-01-09T13:00:08.730" Score="0" Body="&lt;p&gt;I would make a comment (not really sure about it) but I don't have enough rep, sorry (tell me if I need to delete this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just wanted to suggest trying to load the heavily compressed mp3s first, because I'm guessing matlab would decompress them to the same amount of samples and may lock up the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if possible, I would process the files in chunks and not load them all at a time (I'm guessing matlab has a function to seek in the audio file without loading it all in the memory). You say 1.5GB each, so if there are more than a couple, you may actually be maxing your RAM (if matlab converts from 16bit to float or double, one file could probably max the ram).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last thing, I'm not sure if you mean 8 kylobytes or bits per second. I'm pretty sure 8 kilobits per second is not gonna produce anything remotely usable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, I would have made this a comment because I'm not really sure about it, but I can't :(&lt;/p&gt;&#xA;" OwnerUserId="11660" LastActivityDate="2015-01-09T13:00:08.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19913" PostTypeId="2" ParentId="19910" CreationDate="2015-01-09T13:33:00.253" Score="0" Body="&lt;p&gt;Compressing to mp3 will lose data, depending on the compression it could possibly lose enough that you won't be able to do your processing.  At 8kBit per second I would expect problems - speech can start getting hard to understand at that rate, so I would expect bird songs to get pretty mashed up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't matter, though, because compressing the file to mp3 won't actually solve the problem you are having.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @mfran noted, matlab will have to uncompress the file to work on it - this will take as much memory as just reading the .wav in the first place, and will take longer since it has to be uncompressed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your best bet is to chop the files into small pieces and work on those.  &lt;a href=&quot;https://www.ffmpeg.org/&quot; rel=&quot;nofollow&quot;&gt;FFmpg&lt;/a&gt; can be used to do the splitting (&lt;a href=&quot;http://dtbaker.net/random-linux-posts/split-mp3-file-with-ffmpeg/&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt;.)  &lt;a href=&quot;http://sox.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;Sox&lt;/a&gt; can probably be used as well.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-01-09T13:33:00.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19914" PostTypeId="2" ParentId="19911" CreationDate="2015-01-09T13:48:51.753" Score="0" Body="&lt;p&gt;You would not need OpenGL for such perspective transforms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First create a 3D cylinder with Coca-Cola texture on it. (This is found even in &lt;a href=&quot;https://3dwarehouse.sketchup.com/&quot; rel=&quot;nofollow&quot;&gt;3D warehouse&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, start by creating a pseudo-camera matrix $\mathbf{K}$ and then generate arbitrary rotation angles with desired range for each axis. Then compose the final rotation by $\mathbf{R}=\mathbf{R}_x\mathbf{R}_y\mathbf{R}_z$. Also synthesize a translation $\mathbf{t}$. Your projection matrix then reads $\mathbf{P}=\mathbf{K}[\mathbf{R} | \mathbf{t}]$. Project your 3D points with this matrix and you will get the warping effect.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-01-09T13:48:51.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19915" PostTypeId="2" ParentId="17224" CreationDate="2015-01-09T14:20:40.373" Score="5" Body="&lt;p&gt;Zig-zag scanning is not a property of DCT, rather it is employed after the quantization of DCT coefficients, and before the Category / Run length coding (CAT-RLE) of them.&lt;/p&gt;&#xA;&lt;p&gt;N x N blocks of typical images are low-pass in nature. Most of the signal energy is packed in the lower frequency DCT coefficients which are distributed circularly about the origin. Zig-zag scanning of those coefficients begins from the lowest frequency, and moves through a circular pattern from inside to outside.&lt;/p&gt;&#xA;&lt;p&gt;The resulting 1D sequence typically will have a number of initial non-zero coefficients (based on the quality setting), and will be all zeroes afterwards, requiring no bits to encode yielding huge compression of the block.&lt;/p&gt;&#xA;&lt;p&gt;CAT-RLE counts the number of consecutive zeroes in the zigzag scanned sequence, before coding the next non-zero coefficient into a two part symbol: sym1-sym2. Sym1 (category) is based on the magnitude of the coefficient being coded. And sym-2 (run length) is based on the number of zeros before that nonzero coefficient.&lt;/p&gt;&#xA;&lt;p&gt;Zig-zag scanning, therefore, orders the 2D-DCT coefficients into a 1D sequence such that CAT/RLE coding can take advantage of the consecutive zeroes that result.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2023-06-17T13:03:45.863" LastActivityDate="2023-06-17T13:03:45.863" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="19917" PostTypeId="2" ParentId="13452" CreationDate="2015-01-09T15:34:33.400" Score="2" Body="&lt;p&gt;First of all, DFT produces complex valued outputs, therefore, you better compare its magnitude with magnitude of DCT whose input and output are both real.&lt;/p&gt;&#xA;&lt;p&gt;As you may know, DCT can be exactly computed from DFT; therefore you can find DCT[k] value for any k, from the DFT[k] values of the pre-processed x[n] signal.&lt;/p&gt;&#xA;&lt;p&gt;DCT is preferrable for those processes, such as speech or image coding, where low frequency content will be emphasized. For general spectral analysis purposes however, DFT yields a better tool, and mapping its results to physical frequencies is simpler. If you have matlab, check the following code to see if their difference is significant for you:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;N=128; f = 123, Fs = 1024;   % set the signal parameters  &#xA;x = sin(2* pi* f*[0:N-1]/Fs);  % create a real signal x[n]  &#xA;figure,plot(abs(fft(x,N)));  % get the first half of it, since it is symmetric  &#xA;figure,plot(abs(dct(x,N)));  % get DCT for comparison&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2022-11-23T00:43:39.317" LastActivityDate="2022-11-23T00:43:39.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19918" PostTypeId="2" ParentId="19911" CreationDate="2015-01-09T18:07:58.637" Score="0" Body="&lt;p&gt;If you have a recent version of MATLAB with the Image Processing Toolbox, then you can use the &lt;code&gt;imwarp&lt;/code&gt; function with the &lt;code&gt;affine2d&lt;/code&gt; or &lt;code&gt;projective2d&lt;/code&gt; transformation object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an older version, which does not have &lt;code&gt;imwarp&lt;/code&gt;, then you can use &lt;code&gt;imtransform&lt;/code&gt;, and you can create the transformation object using &lt;code&gt;maketform&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-01-09T18:07:58.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19919" PostTypeId="2" ParentId="19910" CreationDate="2015-01-09T19:01:05.143" Score="0" Body="&lt;p&gt;The formal answer is yes. But it also depends on what kind of analysis you will perform. As the name implies a lossy codec will throw away some information (based on human hearing models) that cannot be recovered back. Even when it appears perceptually lossless to human hearing, it will be lossy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My suggestion is this: Instead of reading all the 1.5 GB raw data at once, read the file in pieces such as 10MB each. This size of course depends again on your &quot;analysis&quot; requirements and audio data definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise use some efficent lossy codec (and adjust the compression quality setttings) to retain as much information as possible while still reducing the file size enough for you. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-01-09T19:07:24.017" LastActivityDate="2015-01-09T19:07:24.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19920" PostTypeId="2" ParentId="19756" CreationDate="2015-01-09T19:01:50.443" Score="0" Body="&lt;p&gt;This question is too vague. Normalization can be done in many ways and for many different purposes. For instance, in addition to the example of @tbirdal for image processing, I could think of other examples. A very simple one is one where where we know the signal is&#xA;\begin{align}&#xA; y_1(t) &amp;amp;= x_1(t) + n_1(t) \\&#xA; y_2(t) &amp;amp;= x_2(t) + n_2(t)&#xA;\end{align}&#xA;where $n_1(t)\sim\mathcal{N}(0,\sigma^2)$, $n(t)\sim\mathcal{N}(0,\sigma_2^2)$, and $x_1(t)$ and $x_2(t)$ are deterministic. In such case, in order to compare both signals, a logical normalization would be to compute&#xA;\begin{gather}&#xA; z_1(t) = \frac{y_1(t)}{\sigma_1} \\&#xA; z_2(t) =  \frac{y_2(t)}{\sigma_2}.&#xA;\end{gather}&#xA;Now $z_1(t)$ and $z_2(t)$ have a noise with variance 1.&#xA;The advantage is that now if $z_1(t)$ is larger than $z_2(t)$, you know $z_1(t)$ has a better signal-to-noise ratio (SNR).&lt;/p&gt;&#xA;" OwnerUserId="11735" LastActivityDate="2015-01-09T19:01:50.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19921" PostTypeId="1" CreationDate="2015-01-09T21:30:58.840" Score="-1" ViewCount="3824" Body="&lt;p&gt;I've been asked to recreate the square and sawtooth wave shown below: &lt;img src=&quot;https://i.stack.imgur.com/O4AeC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I've managed to recreate the square wave form but I can't seem to get my sawtooth wave to match.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Input Variables&#xA;L = 31; % Input Length&#xA;A = 1; % Peak Value&#xA;N = 10; %Input Period&#xA;&#xA;% Define omega and time vector t&#xA;omega = 2*pi/N;&#xA;t = 0:omega:(L-1)*omega;&#xA;&#xA;% X-axis lenghth determined by L-1&#xA;X = 0:L-1; &#xA;&#xA;Vsaw = A*sawtooth(t);&#xA;Vsquare = A*square(t,60);&#xA;&#xA;hold on;&#xA;subplot(2,1,1)&#xA;stem(X,Vsaw)&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;&#xA;subplot(2,1,2), stem(X,Vsquare);&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xPdjW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it an error in the code or my values as I can't get the correct number of values or correct amplitude on the saw tooth.&lt;/p&gt;&#xA;" OwnerUserId="4111" LastActivityDate="2021-01-18T16:08:45.947" Title="Trying to recreate sawtooth and square wave in Matlab" Tags="|matlab|discrete-signals|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19923" PostTypeId="2" ParentId="19921" CreationDate="2015-01-09T22:50:15.823" Score="0" Body="&lt;p&gt;You need to think of it as if you were sampling a sawtooth wave. The positive peak of your sawtooth wave actually occurs between your 11th and 12th sample but your sampling rate is just too low to catch it. You need to increase your input period and length to get your positive peak to hit +1.&lt;/p&gt;&#xA;" OwnerUserId="12066" LastActivityDate="2015-01-09T22:50:15.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19924" PostTypeId="1" CreationDate="2015-01-10T02:53:47.007" Score="1" ViewCount="1598" Body="&lt;p&gt;Is there an algorithm which can give the frequency and phase of a three phase signal (three phase voltages) without using zero crossing detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean an algorithm which is done in open loop.&lt;/p&gt;&#xA;" OwnerUserId="11285" LastEditorUserId="13320" LastEditDate="2016-02-06T20:28:03.833" LastActivityDate="2017-06-01T12:30:20.993" Title="PLL and zero crossing detection" Tags="|frequency|pll|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19927" PostTypeId="1" CreationDate="2015-01-10T12:48:21.050" Score="0" ViewCount="231" Body="&lt;p&gt;This question is for people working in multi rate signal processing. Using compressive sensing techniques, we can still recover a signal by sampling below nyquist rate(by decimating the signal). How is that possible, can you explain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some answers available on the web , but I want to hear it from SE group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2015-01-12T13:38:21.663" Title="sampling a signal below nyquist rate" Tags="|digital-communications|decimation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19928" PostTypeId="2" ParentId="18557" CreationDate="2015-01-10T12:55:47.677" Score="1" Body="&lt;p&gt;The answer is no. In order to label a discrete-time system as LTI, we only look for its linearity and time invariance properties and don't need to care whether it is stable or not. That is another independent property of a system that can mutually co-exist with other properties. And indeed many LTI systems are unstable and they are still LTI systems. For abundance of examples please refer to Alan Oppenheim's book: Signals &amp;amp; Systems, 2ed, chapter 2. (or any other college text book on signals &amp;amp; and systems, or digital signal processing)&#xA;Consider for example non stable IIR filters which are still linear and time invariant. (indeed your example is one such)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming to your LCDDE that is supposed define a recursive discrete time system, as you may know, the LCDDE itself is not enough to uniquely specify a solution, as you also need a set of auxiliary conditions (initial conditions). Without those initial conditions explicitly set, you can neither solve the equation, nor determine whether the system it represents will be LTI or causal. Because for some initial conditions, it may be non causal, non linear and time varying, while for some other set (namely the initial rest conditions) it will be linear, time invariant and causal. Therefore in order for a single LCCDE to uniquely represent a LTI system its initial conditions must be properly set to initial rest and not arbitrarily...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-10-11T13:43:02.577" LastActivityDate="2016-10-11T13:43:02.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19934" PostTypeId="1" CreationDate="2015-01-10T18:43:39.933" Score="-1" ViewCount="118" Body="&lt;p&gt;I have the input signal $x(t)$ &lt;img src=&quot;https://i.stack.imgur.com/XxdCL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And impulse response $h(t)=20 e^{-1000t} u(t)$ in which u(t) is the unit step function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try a convolution, I thought the solutions would be something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;\begin{array}{ll}&#xA;		\int\limits_{0}^{t} 2\cdot 20e^{-1000(t-\tau)}d\tau = \frac{1}{25}(1-e^{-1000t}),&amp;amp;  0 \le t &amp;lt;  2 \\&#xA;		\int\limits_{0}^{2} 2\cdot 20e^{-1000(t-\tau)}d\tau - \int\limits_{2}^{t}  20e^{-1000(t-\tau)}d\tau = \frac{3}{50}e^{2000-1000t}-\frac{e^{-1000t}}{25}-\frac{1}{50},&amp;amp; 2\le t &amp;lt;  3 \\&#xA;	\int\limits_{0}^{2} 2\cdot 20e^{-1000(t-\tau)}d\tau - \int\limits_{2}^{3}  20e^{-1000(t-\tau)}d\tau = \frac{3}{50}e^{2000-1000t}-\frac{1}{50}e^{3000-1000t}-\frac{e^{-1000t}}{25},&amp;amp;  t \geq 3 \\&#xA;	\end{array}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this did  not look like the answer in the solution manual, so did I do something wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer in solution manual: &lt;img src=&quot;https://i.stack.imgur.com/22Osi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternative solution in solution manual: &lt;img src=&quot;https://i.stack.imgur.com/vPg5z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13331" LastEditorUserId="4298" LastEditDate="2015-01-11T08:34:47.257" LastActivityDate="2022-05-13T16:08:35.723" Title="Is there a convolution mistake in my method?" Tags="|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19935" PostTypeId="2" ParentId="19927" CreationDate="2015-01-10T18:53:34.710" Score="1" Body="&lt;p&gt;No, recovering an &quot;arbitrary&quot; signal from its samples taken below its Nyquist rate (assuming it is bandlimited) is not possible in general. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compressive sensing is based on the assumption that if you know a-priori that a signal will be sparse in some of its support domains, then those bands will not be carrying information about the signal and can be discarted in principle, therefore, reducing the pre-computed Nyquist sampling rate, which was computed based solely on the bandlimitedness (Shannon-Nyquist sampling theorem) of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick here is on the &quot;a-priori&quot; knowledge which also contains information, and this must be taken into account when computing the total information present in a signal. This a-priori knowledge can be the result of imposed structures on the signal generation mechanism, or well known models of the signal source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can impose no constraints on the signal other than its bandlimit, you have to sample it above its Nyquist rate, so that exact reconstruction (using unimplementable ideal lowpass reconstruction filters) is possible at least in principle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The topic of sampling is bound by information theory. There is no way to walk around it. Why would you ever sample a DC signal, or a single sine wave, or a periodic signal? It is based what is known and what is not.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-01-12T13:38:21.663" LastActivityDate="2015-01-12T13:38:21.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19937" PostTypeId="2" ParentId="16320" CreationDate="2015-01-10T19:14:29.460" Score="2" Body="&lt;p&gt;MATLAB is the best language for learning image processing. (it is my opinion)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is simple to learn, hardware independent, more flexible than any compiled language, possibly more efficient than script languages (due to its inherent dlls optimized for signal processing at the machine level), it has good academic and engineering support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;C/C++ is the best language for creating standalone applications of image processing. Under your suite of IDEs you may generate native code which is the most efficient. And IDEs for C++ provide better machine level debugging features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some script languages are being also used. They are indeed flexible, portable, even considerably efficient, however debugging may not be easy at low levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also new GPU processing capabilities of CUDA, OpenCL etc. make dramatic increases in computational throughputs. (However they are more difficult to learn since you should be aware of the underlying GPU pipeline hardware architecture to make use of any efficiency gains) &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-06-25T12:17:08.473" LastActivityDate="2016-06-25T12:17:08.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19938" PostTypeId="1" AcceptedAnswerId="19944" CreationDate="2015-01-10T19:40:59.480" Score="0" ViewCount="456" Body="&lt;p&gt;I am reading the book &quot;Multiple input describng functions and nonlinear system design&quot; written by A.Gelb and W.E.Vander Velde.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At some point it says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Single-valued characteristics are termed memoryless; multivalued characteristics are said to possess memory. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am a bit confused about the meaning of the 'memoryless' term. I thought that memoryless meant a function that depends only on the value at that time instant and not at previous instants of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="4298" LastEditDate="2018-09-15T11:37:38.510" LastActivityDate="2018-09-15T11:37:38.510" Title="Confusion about 'memoryless' meaning" Tags="|continuous-signals|system-identification|non-linear|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19940" PostTypeId="2" ParentId="19191" CreationDate="2015-01-10T20:51:33.177" Score="3" Body="&lt;p&gt;Your question is deeper than you think. For signals whose spectra is time varying,like your chirp signal, you lose this spectral variation information in simple Fourier transforms. You must consult time-frequency analysis to retain the full information of both time variation and spectral variations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider using &quot;specgram()&quot; function of matlab which computes and plots time-frequency spectograms of signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following code from matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  t=[0 0.5 1.0 1.5 2.0]; % time breakpoints&#xA;  f=[0 200 100 150 300];  % instantaneous frequency breakpoints&#xA;  p=polyfit(t,f,4);      % fit 4th order polynomial over time&#xA;  t=0:0.001:2;           % 2 secs @ 1kHz sample rate&#xA;  y=chirp(t,p);&#xA;  figure,specgram(y,128,1E3,128,120); % 2D time-frequency display&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the contrary a single FFT of the complete signal, which includes all the frequencies, nevertheless, loses their time variation information.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="5843" LastEditDate="2015-02-24T19:14:35.243" LastActivityDate="2015-02-24T19:14:35.243" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19941" PostTypeId="2" ParentId="19921" CreationDate="2015-01-10T20:51:43.660" Score="1" Body="&lt;p&gt;In your book, the period of the sawtooth is 11 samples, not 10.&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2015-01-10T20:51:43.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19943" PostTypeId="2" ParentId="19368" CreationDate="2015-01-10T22:04:11.510" Score="2" Body="&lt;p&gt;The first thing to remember is that the FFT sink does measure actual PSDs, it performs an FFT, which may be scaled however, and displays its mag-square. So when you say &quot;2 Volts p2p&quot;, this is incorrect, as it implies certain things, such as Ohm's law, which don't work that way in DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for your result. First, the window you've chosen (probably Blackman-Harris) will attenuate the main lobe height by a couple of dB. If you had chosen a boxcar window (rectangular), you would have noticed the peak would be at -6 dB. Half the power! And now, things fall into place: In a real-valued FFT (as you are running), the power is distributed between the two peaks that are generated at plus and minus the sinusoid's frequency. And, sure enough, if you run the whole thing in complex mode using a rectangular window, you end up at 0 dB.&#xA;If you had chosen the QT Frequency Sink, that defaults to showing the entire Nyquist zone and you would have seen the 2nd sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, is GNU Radio broken for chosen such normalizations? Not really, since they are always arbitrary. But it is always important to realize that the frequency sinks are not true power spectrum analyzers.&lt;/p&gt;&#xA;" OwnerUserId="13334" LastActivityDate="2015-01-10T22:04:11.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19944" PostTypeId="2" ParentId="19938" CreationDate="2015-01-10T22:16:21.633" Score="0" Body="&lt;p&gt;The definition as you quoted it is only correct for &lt;em&gt;static&lt;/em&gt; nonlinearities. The output of a static nonlinearity only depends on the input function directly, and not on its integral or derivatives. Otherwise, the nonlinearity is called &lt;em&gt;dynamic&lt;/em&gt; (i.e. having memory). A static nonlinearity can also have memory if it is multi-valued, i.e. if there is more than one possible output value for a given input value (e.g. a system with hysteresis). Finally, a &lt;em&gt;static&lt;/em&gt; nonlinearity is indeed memoryless if it is &lt;em&gt;single-valued&lt;/em&gt;, i.e. if its output is uniquely defined by its input value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = F(x(t))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y=F(x)$ is an injective function (i.e. each $x$ is mapped to only one value $y$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in sum you have&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;dynamic nonlinearity&lt;/strong&gt;: has memory&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;static nonlinearity&lt;/strong&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;multi-valued: has memory&lt;/li&gt;&#xA;&lt;li&gt;single-valued: memoryless&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-10T22:16:21.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19945" PostTypeId="2" ParentId="19934" CreationDate="2015-01-10T22:38:47.587" Score="0" Body="&lt;p&gt;You just multiplied the two functions and integrated them but you didn't &lt;em&gt;convolve&lt;/em&gt; them. You must compute&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\int_{-\infty}^{\infty}x(\tau)h(t-\tau)d\tau=2\int_0^2h(t-\tau)d\tau-\int_2^3h(t-\tau)d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can compute the step response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(t)=\int_{-\infty}^th(\tau)d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because $x(t)=2u(t)-3u(t-2)+u(t-3)$ the output can be written in terms of the step response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=2a(t)-3a(t-2)+a(t-3)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-10T22:38:47.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19946" PostTypeId="2" ParentId="11544" CreationDate="2015-01-10T23:57:48.127" Score="0" Body="&lt;p&gt;&lt;strong&gt;Choice-1&lt;/strong&gt; : May be for real signals but wrong for complex signals. It's better to state it as; from $-5$ kHz to $5$ kHz baseband signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Choice-2&lt;/strong&gt; : Is &lt;strong&gt;wrong&lt;/strong&gt; for &lt;strong&gt;real&lt;/strong&gt; signals but may be for &lt;strong&gt;complex&lt;/strong&gt; signals. Since a real signal with  a frequency spectrum extending from $-2.5$ kHz to $2.5$ kHz is a baseband signal with a bandwidth of $2.5$ kHz by definition which is the max positive frequency for baseband (extending from -W to +W) &lt;strong&gt;real&lt;/strong&gt; signals. If that was a complex signal, however, then its total bandwidth could be $5$ kHz in that case (extending from $-2.5$ kHz to $2.5$ kHz.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Choice-3&lt;/strong&gt; : This can be true both for real and complex signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the statement is clearly missing necessary information and can be understood in multiple ways.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2017-08-19T19:55:34.560" LastActivityDate="2017-08-19T19:55:34.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19947" PostTypeId="2" ParentId="18930" CreationDate="2015-01-11T00:13:24.717" Score="2" Body="&lt;p&gt;The difference between 25fps and 23.98fps is about 72% of a semitone.  I can think of two effects this difference might have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is any music in the clip, then the notes will no longer be aligned to any &quot;true&quot; notes in an A=440 scale.  People with a finely honed sense of pitch (like me) will definitely notice this.  It will be annoying to many of us.  Not quite &quot;drive us up the wall&quot; annoying, but certainly enough to capture our attention and be distracting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any speech in the clip, the formant frequencies will be slightly changed, which will modify the vowel sounds slightly.  A native speaker of the language of the speech probably won't notice.  But for someone whose native language is different from the language in the clip, some of the vowels may take a fraction of a second longer to identify correctly, or may be mistaken for different vowels.  This will make it slightly harder for them to understand some of the speech.&lt;/p&gt;&#xA;" OwnerUserId="2014" LastActivityDate="2015-01-11T00:13:24.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19949" PostTypeId="2" ParentId="19892" CreationDate="2015-01-11T02:49:37.267" Score="0" Body="&lt;p&gt;Now assume you have a signal x[n], that is even on the paper. Say it spans from n=-L to n=L (it has a total of N= 2L+1 samples). Now when you introduce this signal to matlab for its N-point DFT computation via FFT, matlab will assume this signal to begin from index n=0 to end at n= N-1 =2L. Therefore we can think of this new signal as x2[n] = x[n-L] a time shifted version of the original signal on the paper. (ok, it is actually a circular shift, but intuitively this is satisfying)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, from DFT time circuar shift property, you know that $X2[k] = e^{-j2\pi Lk/(2L+1)} X[k]$&lt;br&gt;&#xA;This X2[k] is what you are seeing on Matlab, but what you compute on the paper is X[k] and it is readily related to X2[k] from above as $X[k] = e^{j2\pi Lk/(2L+1)} X2[k]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finaly it is this signal X[k] that I guess you were looking for,&#xA;In other words, DFT of a real and even signals being real.&#xA;See the sample matlab code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = 127;&#xA;N= 2*L+1;&#xA;n=[-L:L];&#xA;x = cos(2*pi*12*n/1024); % this signal is even on the paper;)&#xA;X2 = fft(x,N);  % but its DFT is actually DFT of x2[n]&#xA;X = exp(j*2*pi*[0:N-1]*L/(2*L+1)).*X;  % lets recover X[k] from X2[k]&#xA;&#xA;figure, stem(n,x);&#xA;figure,plot(real(X2)); % &#xA;figure,plot(real(X));  % &#xA;figure,plot(imag(X2)); % Here1, X2 has imaginary part?...&#xA;figure,plot(imag(X));  % now it is ok, X[k] is a real.&#xA;figure,stem(real(ifft(X2))) % reconstruct back signal from DFT X2[k]&#xA;figure,stem(real(ifft(exp(-j*2*pi*[0:N-1]*(L)/(2*L+1)).*X))) % do it from X[k]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-01-11T02:49:37.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19950" PostTypeId="1" AcceptedAnswerId="19955" CreationDate="2015-01-11T12:35:19.977" Score="0" ViewCount="91" Body="&lt;p&gt;Internet is very much costly in India , like 3-5 USD  per GB @ 3G networks and even in broadband 100 USD for a unlimited banwith for 2 MBps but here DTH (Direct-To-Home broadcast service ) is very common and cheap , like 4$ for a month with most of the channels . I think to buffer a 480p video we would need 200 KB/s (2MBps ) plan in internet but how DTH providers give that much bandwidth for TV service for such a low price .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main point here is :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can we use DTH service for Internet using (direct from satellite like the DTH works).&lt;/li&gt;&#xA;&lt;li&gt;Can we get same bandwidth for using internet just at same price just in case of DTH .&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13336" LastEditorUserId="4298" LastEditDate="2015-01-11T13:12:04.203" LastActivityDate="2015-01-11T17:45:25.443" Title="Internet from Direct Broadcast Serivce" Tags="|bandwidth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19951" PostTypeId="1" AcceptedAnswerId="19954" CreationDate="2015-01-11T13:12:42.830" Score="0" ViewCount="574" Body="&lt;p&gt;I have a ricker wavelet with a dominant frequency of 15 Hz. The fourier transform shows its frequency band is almost to 50 Hz. How can I narrow the frequency band of this 15 Hz ricker wavelet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kmnul.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have added a picture of the wavelet and its &lt;code&gt;fftshift&lt;/code&gt;ed frequency band (The x axis is not the frequency samples).&lt;/p&gt;&#xA;" OwnerUserId="12230" LastActivityDate="2015-01-11T15:53:16.310" Title="How to narrow the frequency band of a wavelet" Tags="|fft|discrete-signals|fourier-transform|wavelet|ifft|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19952" PostTypeId="2" ParentId="2386" CreationDate="2015-01-11T14:53:42.413" Score="2" Body="&lt;p&gt;How about LibVAD?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like that does exactly what you're describing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclosure: I'm the developer behind LibVAD&lt;/p&gt;&#xA;" OwnerUserId="13338" LastEditorUserId="80" LastEditDate="2019-08-27T16:29:31.990" LastActivityDate="2019-08-27T16:29:31.990" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="19953" PostTypeId="1" AcceptedAnswerId="22156" CreationDate="2015-01-11T15:01:01.507" Score="0" ViewCount="310" Body="&lt;p&gt;I am currently reading chapter 13 of 'Adaptive Signal Processing' by Widrow and Stearns, so if anyone happens to have a copy of the book to hand it could be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am reading the chapter on &quot;Introduction to Adaptive Arrays and Adaptive Beamforming&quot; and am struggling understanding the auto-correlation/cross correlation between the primary and reference signals at a delay of one (as shown in the diagram below) and in the more general case (where the signal is arriving at an angle), where the general cross correlation vector is described by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathbf{P} = \begin{bmatrix}&#xA;\phi_{dx}(0) \\ \phi_{dx}(1)&#xA;\end{bmatrix} = \begin{bmatrix}&#xA;E [C \cos k\omega_0 \cdot C \cos (k + \delta_0)\omega_0] \\ E [C \cos k\omega_0 \cdot C \sin (k + \delta_0)\omega_0]&#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k$ is the sample number, $C$ is a constant amplitude, $\delta_0$ is the time delay of arrival between the primary and reference sensor and $\omega_0$ is the angular frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book assumes that the refence signal to the array is a cosine of the form:&#xA;$$&#xA;\text{reference signal} = C \cos [(k + \delta_0) \omega_0].&#xA;$$&#xA;(The above equation is 13.3 in the book).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, I don't understand why, for $\phi_{dx} (1) $ the 'lag' part of the equation becomes a sine rather than a cosine with a shift 1 (sample)? It's as if there is a shift of $-\pi/2$, hence the sine, but I can't see where this is from? Why for a lag of 1 does this cosine seemingly change to a sine? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of cross (or auto) correlation is that for $\phi_{dx} (1)$ you compare one signal with another with a shift of 1 sample (hence a lag of 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that a sine is the quadrature of a cosine and understand why these equal zero (as the book describes; &quot;$\phi_{dx} (1) $, is zero because it represents the correlation of (13.3) with its quadrature (sine) component&quot;). My question is why is a sine introduced for a lag of 1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Diagram for completeness: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zW006.png&quot; alt=&quot;Adaptive Beamformer from &amp;quot;Adaptive Signal Processing, page 371&amp;quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="8165" LastEditorUserId="8165" LastEditDate="2015-01-12T14:12:38.337" LastActivityDate="2015-03-18T13:23:40.533" Title="Auto/cross correlation of a cosine in the context of an adaptive beamformer" Tags="|autocorrelation|cross-correlation|adaptive-algorithms|beamforming|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19954" PostTypeId="2" ParentId="19951" CreationDate="2015-01-11T15:53:16.310" Score="0" Body="&lt;p&gt;Center frequency and bandwidth are linked in a single &quot;scale&quot; parameter for wavelets. That means if you change the bandwidth you also change the center frequency and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the discrete wavelet transform on a dyadic lattice the relative bandwidth is also fixed at approximately one octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a continuous wavelet transform frame with a smaller relative bandwidth you need to construct a different wavelet. Intuitively, it will come with more oscillatory cycles, i.e. more zero crossings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Ricker wavelet you have coincides with the 2nd so called Hermite function. Higher order Hermite functions also have an increasing number of zero crossings. Unfortunately they're one of the examples of where the intuition of adding more cycles will &lt;em&gt;not&lt;/em&gt; work. The Hermite functions grow in both frequency as well as time support with increasing order. So that's not the way to go. I'm only making this clear because you might find a reference to them in relation to the Ricker Wavelet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead I would try to adapt the construction of the wavelet to your specific needs, which you will have to outline in your question to receive a more detailed answer.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-01-11T15:53:16.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19955" PostTypeId="2" ParentId="19950" CreationDate="2015-01-11T17:45:25.443" Score="0" Body="&lt;p&gt;No you can't, because the internet depends on you having a method of sending data. For example, the question you've asked here came here somehow, so it's obvious you need to be able to &lt;em&gt;send&lt;/em&gt; data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, TV is &lt;em&gt;broadcasting&lt;/em&gt;, it's a one-way transmission, without a back channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are satellite internet access services, but they are far more costly than what you've described, and much much slower. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, some countries had things that used a telephone line as uplink and a sattelite downlink, but they suffered from cost, the asymmetry between the fast satellite downlink and the slow telephone uplink, and the poor latency.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-01-11T17:45:25.443" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19956" PostTypeId="2" ParentId="19924" CreationDate="2015-01-11T17:49:55.733" Score="0" Body="&lt;p&gt;The DFT does that, and is, so to speak, the grandmother of all frequency estimators; the peaks of the absolute spectrum would usually coincide with your signal's frequency, and their complex rotation $e^j\phi$ gives you a relative phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I'm curious why this is not the first method you've thought of, so I guess it's because in many applications, it's easier to detect zero crossings and then to count the time between those than to sample the signal at fixed intervals, but I come from a world where we work with Nyquist all the time, so this might explain my surprise.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-02-06T16:43:51.533" LastActivityDate="2016-02-06T16:43:51.533" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="19957" PostTypeId="2" ParentId="19873" CreationDate="2015-01-11T18:00:33.677" Score="-1" Body="&lt;p&gt;First of all, common FFT libraries (which software are you using?) have FFT implementations for a lot more lengths than powers of two -- the FFTW, which is by far the most widely used in general purpose computing (and is in use by things like Matlab, FFMPEG and so forth) for example supports any length that only has prime factors smaller than 13 or so; so unless you're doing an FFT of millions of points in each direction, you don't have to pad for performance reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you pad before transforming:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;signal -&gt; padding -&gt; DFT -&gt; Filtering -&gt; IDFT -&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can just truncate your result, and will get the right thing -- the IDFT works cyclic, and thus you won't be throwing away information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that if &quot;Filter&quot; in your original description is a FIR filter, you are convolving your signal in frequency domain, just to transform it back --- just multiply it with the fourier transform of your Filter, and you'd have done the same in the original domain of your signal, as basic Fourier theory allows you to do.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2015-01-12T08:26:54.237" LastActivityDate="2015-01-12T08:26:54.237" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="19958" PostTypeId="1" CreationDate="2015-01-11T18:24:26.403" Score="1" ViewCount="699" Body="&lt;p&gt;I am doing several research for a prototype which I will be building. My prototype will consist of single word speech recognition and comparison with a preset recorded words. The prototyped system will then ask the user to say a the word and give a percentage match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am hoping to build this prototype with JAVA, however I am not at that stage yet, I am still researching all the available algorithms that exist in order to implement the above. I am seeking some guidance from you experts out there if I am on the right track in looking at the following algorithms to be able to implement the above:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Acoustic speech recognition &lt;/li&gt;&#xA;&lt;li&gt;Hidden Markov Model algorithm&lt;/li&gt;&#xA;&lt;li&gt;Discrete Fourier Transform&lt;/li&gt;&#xA;&lt;li&gt;Fast Fourier Transform&lt;/li&gt;&#xA;&lt;li&gt;The Cross-correlation Algorithm&lt;/li&gt;&#xA;&lt;li&gt;The Auto-correlation Algorithm&lt;/li&gt;&#xA;&lt;li&gt;The FIR Wiener Filter&lt;/li&gt;&#xA;&lt;li&gt;Dynamic Time Warping algorithms&lt;/li&gt;&#xA;&lt;li&gt;Mel Frequency Cepstral Coefficient&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am not sure if the above is wrong for my project and look into audio fingerprinting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sorry I cannot provide any code for the time being I am still in the theory research part, If this question is not suitable to this forum please let me know so I can delete it and waste no one's time as it is not my intention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Keep in mind that since this is only a prototype, moving forward I will research and eventually use any already existing algorithms (API's/Libraries in JAVA) so that is mostly why I am asking if I am on the right track. Many thanks for your help guys !&lt;/p&gt;&#xA;" OwnerUserId="13341" LastActivityDate="2015-04-20T23:43:57.827" Title="Speech recognition and comparison algorithms" Tags="|speech-recognition|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19960" PostTypeId="2" ParentId="19858" CreationDate="2015-01-11T22:21:56.140" Score="1" Body="&lt;p&gt;You should not normalize by length of FFT, but you should always normalize by sum of window function samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of rectangular window we get $N$ ones, so obviously you will divide by same factor $N$ that is the sum of all values. For other window functions you must use appropriate scaling factor, i.e. sum of all flat-top window samples. Your code should become:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = 1024; %signal length&#xA;Fs = 1000; %sampling frequency&#xA;t = (0:L-1)'/Fs;&#xA;&#xA;NFFT = 2^nextpow2(L);&#xA;x = 11*sin(2*pi*250*t);&#xA;&#xA;J = flattopwin(L);  &#xA;JX = x(:).*J(:);&#xA;&#xA;P= fft(JX,NFFT)/sum(J);&#xA;M= 2*abs(P(1:NFFT/2+1));&#xA;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;plot(f,M)&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yielding a plot:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/r1UbW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info and better understanding I suggest you to read related questions on DSP SE and this great paper: &lt;a href=&quot;http://holometer.fnal.gov/GH_FFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Spectrum and spectral density estimation by the DFT...&lt;/em&gt;&lt;/a&gt;. Just keep in mind that most of the amplitude errors will occur due to leakage - non integer number of signal periods.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-01-12T08:20:03.727" LastActivityDate="2015-01-12T08:20:03.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19961" PostTypeId="1" CreationDate="2015-01-12T02:09:12.230" Score="0" ViewCount="570" Body="&lt;p&gt;I am building an LPC analysis tool, and am at the point of needing to do pitch period analysis.  I was initially interested in using the Gold &amp;amp; Rabiner algorithm for this, and got a hold of a FORTRAN implementation.  Before I start converting that implementation to a modern programming language, I was curious if anyone here had any suggestions for other pitch detection algorithms that are maybe a bit more modern and robust...  And even better, if there are any open source libraries that have apis for pitch period analysis that my tool can hook into?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:  I am building an LPC analysis tool for speech waveforms.&lt;/p&gt;&#xA;" OwnerUserId="11807" LastEditorUserId="11807" LastEditDate="2015-01-12T19:05:51.313" LastActivityDate="2015-04-13T10:31:48.353" Title="pitch extraction for speech" Tags="|pitch|speech|lpc|linear-prediction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19962" PostTypeId="1" AcceptedAnswerId="19966" CreationDate="2015-01-12T03:29:45.640" Score="1" ViewCount="2921" Body="&lt;p&gt;I have a filter to detect when a slow moving signal (oven temperature) reaches steady state. I am using a linear regression of a moving window and looking at the slope. Based on the equations for linear regression including $\sum xy$, $\sum x^2$ and $(\sum x)^2$ I am thinking this is a non linear filter, is this true? Is it still true to say this is a FIR filter though?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if I am trying to get an estimate for reaching steady state is there a better filter, or can similar quality be achieved with a linear filter given Gaussian noise? Basically I am looking for a good theoretical analysis of this type of filter to way its pros and cons?&lt;/p&gt;&#xA;" OwnerUserId="13344" LastEditorUserId="8202" LastEditDate="2015-01-12T08:21:37.813" LastActivityDate="2015-01-12T08:32:13.363" Title="Linear Regression Filter Properties" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19963" PostTypeId="1" AcceptedAnswerId="19964" CreationDate="2015-01-12T05:37:01.083" Score="0" ViewCount="623" Body="&lt;p&gt;So I'm given a pass band filter with specific transfer function &lt;span class=&quot;math-container&quot;&gt;$H_p(f)$&lt;/span&gt;, I want to implement this via baseband processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already know how to take the input signal &lt;span class=&quot;math-container&quot;&gt;$u(t)$&lt;/span&gt; and process it such that I get the I/Q components &lt;span class=&quot;math-container&quot;&gt;$u_I(t), u_Q(t)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have figured out that the following convolution relation holds for the filter output &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;'s I/Q components &lt;span class=&quot;math-container&quot;&gt;$$y_I=(u_I * h_I) - (u_Q*h_Q)$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$y_Q = (u_I*h_Q) + (u_Q*h_I)$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$h_Q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$h_I$&lt;/span&gt; are the filters I/Q components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have run into an issue where I can't figure out a simple way to determine &lt;span class=&quot;math-container&quot;&gt;$h_Q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$h_I$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know for the complex envelope of the filter I have &lt;span class=&quot;math-container&quot;&gt;$$h(t) = h_I(t) + j\cdot h_Q(t)$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can take the fourier transform of this to obtain &lt;span class=&quot;math-container&quot;&gt;$H(f) = H_I(f) + j\cdot H_Q(f)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So essentially my issue is with how to obtain &lt;span class=&quot;math-container&quot;&gt;$H_I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_Q$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My book basically gives the answer but I must be missing something since I can't figure out the reasoning behind it. They state that &lt;span class=&quot;math-container&quot;&gt;$$H_I(f) = (H(f) + H^*(-f))/2$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$j\cdot H_Q(f) = (H(f)-H^*(-f))/2$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing its some property to do with the fourier that I've forgotten but I'm hoping someone can explain the reasoning for it. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4794" LastEditorUserId="47251" LastEditDate="2020-02-05T15:44:12.620" LastActivityDate="2020-02-05T15:44:12.620" Title="Filtering Passband Signals using Complex Baseband Filtering" Tags="|filters|fourier-transform|convolution|filtering|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19964" PostTypeId="2" ParentId="19963" CreationDate="2015-01-12T08:02:56.793" Score="2" Body="&lt;p&gt;Since $h_I(t)$ is the real part of $h(t)$ you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_I(t)=\frac12[h(t)+h^*(t)]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h^*(t)$ is the complex conjugate of $h(t)$. For the imaginary part you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_Q(t)=\frac{1}{2j}[h(t)-h^*(t)]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the Fourier transform of $h^*(t)$ is $H^*(-f)$&lt;sup&gt;1&lt;/sup&gt;, the Fourier transforms of (1) and (2) are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_I(f)=\frac12[H(f)+H^*(-f)]\\&#xA;H_Q(f)=\frac{1}{2j}[H(f)-H^*(-f)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;&lt;sup&gt;1&lt;/sup&gt;The fact that $H^*(-f)$ is the Fourier transform of $h^*(t)$ can be easily seen as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With&#xA;$$H(f)=\int_{-\infty}^{\infty}h(t)e^{-j2\pi ft}dt$$&#xA;the Fourier transform of $h^*(t)$ is&#xA;$$\mathcal{F}\{h^*(t)\}=\int_{-\infty}^{\infty}h^*(t)e^{-j2\pi ft}dt=&#xA;\left[\int_{-\infty}^{\infty}h(t)e^{j2\pi ft}dt\right]^*=H^*(-f)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-12T11:12:53.033" LastActivityDate="2015-01-12T11:12:53.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19965" PostTypeId="1" CreationDate="2015-01-12T08:04:58.647" Score="0" ViewCount="296" Body="&lt;p&gt;I met an great confusion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using below command I have got co-efficents for a 300Hx cut-off high pass filter of order two.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[z p k] = butter(2,(300/44100),'high')&#xA;  [sos,g] = zp2sos(z,p,k)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now this sos co-efficients are differ from what is obtained by fdatool. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As explained here &lt;a href=&quot;https://dsp.stackexchange.com/a/19553/7868&quot;&gt;https://dsp.stackexchange.com/a/19553/7868&lt;/a&gt; , what i am wondering is why even for a 2nd order filter the co-efficients are different obtained by both methods.&lt;/p&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-01-12T08:04:58.647" Title="Why Matlab fdatool designed butterworth filter and butter command's co-efficients are different" Tags="|matlab|filters|filter-design|highpass-filter|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19966" PostTypeId="2" ParentId="19962" CreationDate="2015-01-12T08:32:13.363" Score="2" Body="&lt;p&gt;This is a linear filter because the signal values ($y_i$ in your notation) enter the equation linearly. It can be implemented as an FIR filter, and then it's called &quot;Slope Filtering&quot;. The method was described in the IEEE Magazine on Signal Processing (&quot;DSP Tips &amp;amp; Tricks&quot;), Nov. 2008. You can read the article &lt;a href=&quot;http://www.claysturner.com/dsp/FIR_Regression.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-12T08:32:13.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19967" PostTypeId="1" CreationDate="2015-01-12T08:32:16.587" Score="1" ViewCount="379" Body="&lt;p&gt;I would like to implement a somewhat smarter Laplacian edge enhancement convolution. Right now it is implemented as (generic 3x3 convolution):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sum = 0&#xA;for k = -1 to 1 do&#xA;   for j = -1 to 1 do&#xA;      sum = sum + h(j +1, k + 1)*f(x - j, y - k)&#xA;   end for&#xA;end for&#xA;g(x, y) = sum&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Looking for way to improve to implementation all I could find was separable filter optimizations (as &lt;a href=&quot;https://dsp.stackexchange.com/questions/1868/fast-efficient-way-to-decompose-separable-integer-2d-filter-coefficients&quot;&gt;Fast / Efficient Way to Decompose a Separable integer 2D Filter Coefficients without the SVD&lt;/a&gt;). However Laplacian edge enhancement is not separable:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;octave:1&amp;gt; m = [-1 -1 -1 ; -1 8 -1 ; -1 -1 -1];&#xA;octave:2&amp;gt; rank(m)&#xA;ans =  2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is there any literature I could be missing ? When looking at the coefficients it feels as if somewhat could be done for matrix of type (CENTER=8, EDGE=-1):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;E  E  E&#xA;E  C  E&#xA;E  E  E&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4328" LastEditorUserId="7092" LastEditDate="2021-11-20T13:06:55.440" LastActivityDate="2021-11-20T13:06:55.440" Title="Fast/efficient way to compute Laplacian edge enhancement filter" Tags="|filters|convolution|2d|separability|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="19968" PostTypeId="2" ParentId="14719" CreationDate="2015-01-12T09:09:09.343" Score="0" Body="&lt;p&gt;Have a look at &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/49002&quot; rel=&quot;noreferrer&quot;&gt;File Exchange Submission - RGB/HSV Distribution&lt;/a&gt; on  visualization of RGB/HSV distribution in a given image:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hsv_distribution(inputImage, 5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It should do what you're after as the result is like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J2piU.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J2piU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2020-03-13T08:59:20.443" LastActivityDate="2020-03-13T08:59:20.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19969" PostTypeId="2" ParentId="8461" CreationDate="2015-01-12T09:16:01.323" Score="1" Body="&lt;p&gt;I'm not sure exactly what you're after, but just to try to add data:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using the separability property of the filter is always the right choice.&lt;/li&gt;&#xA;&lt;li&gt;Given it is separable we now have to apply 1D convolutions. Selecting which method to do it (Frequency Domain / Spatial Domain) depends on the length of the filter and the number of pixels in each dimension of the image.&lt;br&gt;&#xA;There are cases where it is better to do FFT on the Rows and Spatial Convolution on the Columns.&lt;/li&gt;&#xA;&lt;li&gt;This is all true when &quot;Counting&quot; FLOPS. Real life timing is more than that. for instance, if you're using highly tuned Convolution implementation and yet &quot;Classic&quot; DFT implementation you might be faster doing the Spatial way even for dimensions the analytic calculation predict it is better to be done in frequency domain.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-01-12T09:16:01.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19970" PostTypeId="2" ParentId="9639" CreationDate="2015-01-12T09:20:41.673" Score="2" Body="&lt;p&gt;The easiest way doing so would be &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplacian_pyramid&quot; rel=&quot;noreferrer&quot;&gt;Laplacian Pyramid&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, it can be done just by using simple Addition operator.&lt;br&gt;&#xA;Just add the High Frequency of one image to the Low Frequency of the other.&lt;br&gt;&#xA;Keep in mind few things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Dimensions must be the same.&lt;br&gt;&#xA;Otherwise, interpolate to the same dimensions.&lt;/li&gt;&#xA;&lt;li&gt;It is better to use HPF which is built from the same LPF used.&lt;br&gt;&#xA;To the least, they must have the same Cut Off Frequency.&lt;/li&gt;&#xA;&lt;li&gt;Use floating point arithmetic for this procedure.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-01-12T09:20:41.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19971" PostTypeId="2" ParentId="15481" CreationDate="2015-01-12T09:39:51.073" Score="1" Body="&lt;p&gt;Since you're working local it is suggested for you to compare things normalized to their relative surroundings.&lt;/p&gt;&#xA;&lt;p&gt;The gradient is a vector (2D vector in single channel image).&lt;br /&gt;&#xA;You can normalize it according to the norm of the gradients surrounding this pixel.&lt;/p&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$ {\mu}_{w} $&lt;/span&gt; is the average magnitude and &lt;span class=&quot;math-container&quot;&gt;$ {\sigma}_{w} $&lt;/span&gt; is the standard deviation in the &lt;code&gt;5x5&lt;/code&gt; window.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-02-02T08:30:24.480" LastActivityDate="2022-02-02T08:30:24.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19972" PostTypeId="2" ParentId="15785" CreationDate="2015-01-12T09:42:37.857" Score="0" Body="&lt;p&gt;The Vibrance in Photoshop is a mask guided saturation.&lt;br&gt;&#xA;What does it mean?&lt;br&gt;&#xA;It means we add saturation only to pixels marked by the mask while leaving others untouched.&lt;br&gt;&#xA;The mask evaluates the original level of the saturation of each pixel.&lt;br&gt;&#xA;If the pixel is highly saturated, then when Vibrance is applied this pixel will be excluded.&lt;br&gt;&#xA;Namely vibrance works only on less saturated pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could we create such a mask?&lt;br&gt;&#xA;We transform each pixel from RGB Color Space to HSL (Hue, Saturation, Lightness) Color Space.&lt;br&gt;&#xA;Then we take only the Saturation values for all pixels and normalize into the [0, 1] range where 0 is not saturated pixel and 1 is fully saturated pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we add saturation only to pixels with low value of saturation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not an expert on OpenCV, but the above should be pretty easy to integrate in OpenCV (Given it has &lt;a href=&quot;https://docs.opencv.org/3.1.0/de/d25/imgproc_color_conversions.html&quot; rel=&quot;noreferrer&quot;&gt;RGB to HSL Conversion&lt;/a&gt;, You can use HSV or HLS)&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-08-26T08:12:47.557" LastActivityDate="2018-08-26T08:12:47.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19973" PostTypeId="2" ParentId="18710" CreationDate="2015-01-12T09:51:47.173" Score="0" Body="&lt;p&gt;All of those are Discrete Approximation of the operator - &lt;a href=&quot;http://en.wikipedia.org/wiki/Laplace_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laplace Operator&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can discretize it in any logical manner.&lt;/p&gt;&#xA;&lt;p&gt;In the cases above, Istotropic means if you rotate it it looks the same.&lt;br /&gt;&#xA;The diagonal elements means the filter would be sensitive to changes which are in 45, 135, 225 and 315 degrees, it it means it will also amplify more noise.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="54457" LastEditDate="2021-01-31T16:20:18.963" LastActivityDate="2021-01-31T16:20:18.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19974" PostTypeId="2" ParentId="19806" CreationDate="2015-01-12T09:54:56.563" Score="3" Body="&lt;p&gt;You can use spatial Methods using Convolution (&lt;code&gt;conv2&lt;/code&gt; and &lt;code&gt;imfilter&lt;/code&gt;).&lt;br&gt;&#xA;You can do it in Frequency Domain using the Convolution Theorem property using &lt;code&gt;fft&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, In Image Processing, all filters are built using Gaussian Kernel.&lt;br&gt;&#xA;High Pass is basically subtracting Low Pass filtered image from the original image.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create the Gaussian Kernel manually or using &lt;code&gt;fspecial&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fast implementation, have a look here - &lt;a href=&quot;https://github.com/RoyiAvital/FastGuassianBlur&quot; rel=&quot;noreferrer&quot;&gt;Fast Gaussian Blur&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.&lt;br&gt;&#xA;For people who use &lt;code&gt;conv&lt;/code&gt;, be aware that &lt;code&gt;conv&lt;/code&gt; is using &lt;code&gt;conv2&lt;/code&gt; and you can reduce the overhead by using it directly.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2015-07-12T12:48:15.950" LastActivityDate="2015-07-12T12:48:15.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19975" PostTypeId="2" ParentId="17472" CreationDate="2015-01-12T09:58:13.260" Score="1" Body="&lt;p&gt;It basically using what Photographers calls &amp;quot;Shadow Mask&amp;quot; / &amp;quot;Highlight Mask&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;If the image is in the range [0, 1] &amp;quot;Highlight Mask&amp;quot; is actually the value of the pixel.&lt;br /&gt;&#xA;&amp;quot;Shadow Mask&amp;quot; is the inverse, namely 1 - Highlight Mask.&lt;/p&gt;&#xA;&lt;p&gt;Use this mask as linear interpolator of the result with the originals.&lt;/p&gt;&#xA;&lt;p&gt;Formalizing it will be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ O \left[ p \right] = M \left[ p \right] A \left( I \left [p \right] \right) + \left( 1 - M \left[ p \right] \right) I \left[ p \right] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$ p $&lt;/span&gt; is the pixel coordinate (This a pixel wise operation), &lt;span class=&quot;math-container&quot;&gt;$ M \left[ \cdot \right] $&lt;/span&gt; is the mask (Low, Mid or High, we'll formalize it soon), &lt;span class=&quot;math-container&quot;&gt;$ I \left[ \cdot \right] $&lt;/span&gt; is the input image, &lt;span class=&quot;math-container&quot;&gt;$ O \left[ \cdot \right] $&lt;/span&gt; is the output image and &lt;span class=&quot;math-container&quot;&gt;$ A \left( \cdot \right) $&lt;/span&gt; is the operation (Doidge or Burn as you got from the source you linked).&lt;/p&gt;&#xA;&lt;p&gt;The whole trick is the mask. Using it we target Low, Med or High luminosity values.&lt;br /&gt;&#xA;Assuming &lt;span class=&quot;math-container&quot;&gt;$ Y \left[ p \right] $&lt;/span&gt; is the luminosity value of the pixel we can build the masks as:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;High - &lt;span class=&quot;math-container&quot;&gt;$ M \left[ p \right] = Y \left[ p \right] $&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Low - &lt;span class=&quot;math-container&quot;&gt;$ M \left[ p \right] = 1 - Y \left[ p \right] $&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Med - &lt;span class=&quot;math-container&quot;&gt;$ M \left[ p \right] = -4 {\left( Y \left[ p \right] \right)}^{2} + 4 Y \left[ p \right] $&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The calculations above assumed data is in the &lt;code&gt;[0, 1]&lt;/code&gt; range.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2021-09-20T05:49:00.910" LastActivityDate="2021-09-20T05:49:00.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19976" PostTypeId="2" ParentId="15481" CreationDate="2015-01-12T10:09:54.070" Score="0" Body="&lt;p&gt;If $\nabla \mathbf{x}=[g_x, g_y]^T$, then the normalized gradient is ${\nabla \mathbf{x}}_n=[\frac{g_x}{\lVert \nabla \mathbf{x} \rVert}, \frac{g_y}{{\lVert \nabla \mathbf{x} \rVert}}]^T$ .&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-01-12T10:09:54.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19977" PostTypeId="2" ParentId="19961" CreationDate="2015-01-12T10:18:55.863" Score="0" Body="&lt;p&gt;If you have university access, Christensen and Jakobsson - Multi-Pitch Estimation (2009, Morgan &amp;amp; Claypool) is a great book [1]. The focus is on statistical methods. There's also a MATLAB toolbox. Since you didn't specify the type of signal that you're working with, it's a bit difficult to recommend a specific method. Auto-correlation methods (some references can be found in Section 1.2) are simple, but the solution may not be unique, see for instance the YIN method [2].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References&lt;br&gt;&#xA;[1] &lt;a href=&quot;http://www.morganclaypool.com/doi/abs/10.2200/S00178ED1V01Y200903SAP005&quot; rel=&quot;nofollow&quot;&gt;http://www.morganclaypool.com/doi/abs/10.2200/S00178ED1V01Y200903SAP005&lt;/a&gt;&lt;br&gt;&#xA;[2] &lt;a href=&quot;http://www.cs.tut.fi/~digaudio/htyo/lahteet/2002_JASA_YIN.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.tut.fi/~digaudio/htyo/lahteet/2002_JASA_YIN.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10740" LastEditorUserId="10740" LastEditDate="2015-01-13T08:40:48.727" LastActivityDate="2015-01-13T08:40:48.727" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19978" PostTypeId="2" ParentId="18710" CreationDate="2015-01-12T11:38:28.407" Score="2" Body="&lt;p&gt;Isotropy is uniformity in all orientations. If something is isotropic, its geometrical information is invariant from direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The former exhibits a clear difference between the grid directions and the directions at a 45-degree angle to the grid. This is why it is not referred as isotropic. The latter on the other hand, applies the same operation, regardless of the direction. The isotropic version is rotation invariant and no matter how the image/the filter is rotated, it generates the same response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This becomes important when for example creating feature point detectors, where the descriptors are to be found regardless of image orientation. There are many applications in the vision literature and this is a very desired property. For more details, refer to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Laplace_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Discrete Laplace Operator&lt;/a&gt; subject.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2019-10-17T17:49:01.677" LastActivityDate="2019-10-17T17:49:01.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19979" PostTypeId="2" ParentId="19967" CreationDate="2015-01-12T12:49:13.183" Score="1" Body="&lt;p&gt;OK here I will put an old trick to reduce number of multiplications dramataically, whether it will render a faster result depends on your overall computational architecture of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now as your filter is highly structured, let us denote two values&#xA;E and C to describe its elements. Lets decompose your filter into two parts:&#xA;$$h[n,m] = h1[n,m] + h2[n,m]$$ such that:&#xA;$$h1[n,m] = E*ones(3,3)$$ and $$h2[n,m]=(C-E)*\delta(n,m)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here I put a pseudo-language version of your convolution core, that takes advantage of this simple decomposition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (n,m)= beginning:end   // it is a double loop&#xA;   sum = 0;&#xA;   for (j,k)=-1:1         // it is the core double loop&#xA;      sum = sum + f(n-j,m,k);   % Here there is no multiplication, saving 9  multiplies&#xA;   end:j,k&#xA;&#xA;   g(n,m) = E*sum + (C-E)*f(n,m); % here is two multiplies&#xA;end:n,m&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note1: please take care of indices especially at the edges, since I didn't.&lt;br&gt;&#xA;Note2: whether your optimizing compiler can already convert your code into this structure, from your previous code, depends on your filter definition. If your filter is defined only by a pointer without its content, the compiler will have no chance to decompose it. But if the filter is statically defined at compile time, then at least in principle the compiler has a chance to analyse its content. Whether they do it or not is another concern...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-01-12T12:49:13.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19980" PostTypeId="1" AcceptedAnswerId="19999" CreationDate="2015-01-12T15:27:13.680" Score="1" ViewCount="6338" Body="&lt;p&gt;I'm trying to implement an algorithm in which I first pad each row of the image with a fixed amount of new pixels in a certain range, apply Gaussian smoothing to the row cumulative histograms in vertical (y) direction, and thus obtain new cumulative histograms for each row in the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After having obtained the new row cumulative histograms, my task is to get back/restore an intensity image from the cumulative histograms. Specifically, I would like to match each row histogram to the new, corresponding row histogram (to those which I obtained after padding and Gaussian filtering). Therefore, if there are, for example, 1000 rows in an image I will match 1000 row histograms and restore the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code in Python is below, where I came until the step where I need to perform histogram matching but I got stuck there:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cv2&#xA;import numpy as np&#xA;import scipy.ndimage as ndi&#xA;from matplotlib import pyplot as plt&#xA;from scipy.interpolate import interp1d&#xA;&#xA;# Threshold of intensity values for padding&#xA;T = 200     &#xA;img = cv2.imread('images/flicker1.jpg',0)&#xA;rows,cols = img.shape&#xA;# Number of pixels to pad each bin of a row histogram&#xA;N = 30&#xA;########################################################################&#xA;cdf_hist_Padded = np.zeros((rows,256))&#xA;cdf_hist_noPad = np.zeros((rows,256))&#xA;for i in range(0,rows):    &#xA;    # Read one row&#xA;    img_row = img[i,]&#xA;    # Calculate the row histogram (without padding)&#xA;    hist_row_noPad = cv2.calcHist([img_row],[0],None,[256],[0,256])&#xA;    # Calculate the cumulative row histogram (without padding)&#xA;    cdf_hist_row_noPad = hist_row_noPad.cumsum()&#xA;    cdf_hist_noPad[i,:] = cdf_hist_row_noPad&#xA;    # Copy the row to prepare for padding&#xA;    hist_row_Padded = np.copy(hist_row_noPad)&#xA;    # Apply uniform padding to all the bins less than T&#xA;    hist_row_Padded[0:T] = hist_row_Padded[0:T] + N&#xA;    # Calculate the cumulative row histogram of the padded row&#xA;    cdf_hist_row_Padded = hist_row_Padded.cumsum()&#xA;    # Accumulate the cumulative histograms of padded rows in a matrix&#xA;    cdf_hist_Padded[i,:] = cdf_hist_row_Padded&#xA;&#xA;# Apply 1D-Gaussian filtering on the padded cumulative histogram along the columns   &#xA;Gauss_cdf = ndi.gaussian_filter1d(cdf_hist_Padded, sigma=2, axis=0, output=np.float64, mode='nearest')&#xA;&#xA;# Normalize all the CDFs to get values between [0,1]&#xA;norm_cdf_hist_noPad = cdf_hist_noPad/cdf_hist_noPad.max()&#xA;norm_cdf_hist_Padded = cdf_hist_Padded/cdf_hist_Padded.max()&#xA;norm_Gauss_cdf = Gauss_cdf/Gauss_cdf.max()&#xA;&#xA;# Take the first original and padded+smoothed row cumulative histogram &#xA;H_zero = norm_cdf_hist_noPad[0,:]&#xA;H_hat_zero = norm_Gauss_cdf[0,:]&#xA;&#xA;# I would like to match now 'H_zero' and 'H_hat_zero'. When I find how to do that, &#xA;# I  will apply this to all rows in a loop. How do I perform the matching?..&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8751" LastActivityDate="2017-10-26T10:07:23.280" Title="Histogram matching (specification) in Python" Tags="|python|histogram|equalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19982" PostTypeId="1" CreationDate="2015-01-12T16:11:47.563" Score="1" ViewCount="3412" Body="&lt;p&gt;Describing my background: I have around 33 items labeled. For example, 3 pictures of the contour of a basil plant, 4 pictures of the contour of earphones, 7 of a mug, etcetera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to calculate N Fourier descriptors of a random picture in order to compare them with the other items, making the average of the distances between classes and saying: &quot;This is a mug!&quot; or &quot;this is a basil plant!&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my experience, I take a random picture of a MUG:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YONeQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it looks to my MUGS that I've classified (because it gives me a distance close to 0):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jwITs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but if I take a picture of the MUG without the &lt;strong&gt;handle&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XSVr1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the closest averages of the norm of distances to this MUG are of &lt;strong&gt;BASIL&lt;/strong&gt; plants or &lt;strong&gt;EARPHONES&lt;/strong&gt; (instead MUG, which is boundary closer):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SIend.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OPIlP.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;indeed I have been realising that for every random picture I use to get a low value for earphones and basil. It seems that I have to &lt;strong&gt;normalize&lt;/strong&gt; somewhere... but... what should I do ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do anybody could give me a clue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance.&#xA;Regards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATED&lt;/strong&gt;&#xA;In response to @tbirdal , I have to say that that's what I do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vector&amp;lt;double&amp;gt; vector;&#xA;if (dft_z.size() &amp;lt; 2)&#xA;    return vector; // handling errors&#xA;dft_z.at(0) = complex&amp;lt;double&amp;gt;(0,0); // First DC to 0 (invariance on translation)&#xA;double si1 = abs(dft_z.at(1)); // Module of the a(1)&#xA;for(int i = 0; i &amp;lt; dft_z.size(); i++) {&#xA;    dft_z.at(i) = complex&amp;lt;double&amp;gt;(dft_z.at(i).real() / si1, dft_z.at(i).imag() / si1); // dividing by the module&#xA;    vector.push_back(abs(dft_z.at(i))); // and putting into my vector the absolute value (to eliminate any phase)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;HOW I'M GOING TO CONTINUE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen that making the absolute value of every FD to remove its phase makes confusion on my shapes.&#xA;In addiction, I realised that only simple forms and contours are well matched. For example basil was too complicated, but the mug is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to @tbirdal who gives me an idea.&lt;/p&gt;&#xA;" OwnerUserId="10898" LastEditorUserId="10898" LastEditDate="2015-01-13T13:31:32.947" LastActivityDate="2015-09-10T20:19:15.497" Title="Fourier descriptors: trying to classify objects" Tags="|fourier-transform|shape-analysis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19984" PostTypeId="2" ParentId="19982" CreationDate="2015-01-12T16:38:18.173" Score="2" Body="&lt;p&gt;The normalization of the Fourier descriptors is performed as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Set the DC component of the descriptors to $a(0)=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Divide all the Fourier descriptors with the magnitude of the second one. i.e. :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a(1)=r_1e^{j\phi_1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a(k)=\frac{a(k)}{\lVert a(1) \rVert}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Now, only the position of the starting point remains to be normalized. This is done by subtracting the phase of the second Fourier descriptor $\phi_1$ frin the phase of all Fourier descriptors and weighting by $k$; that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a(k)=a(k)e^{-j \phi_1 k}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I did not describe rotational invariance here. In simple terms it is achieved by taking the magnitude of each Fourier coefficient.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Also, you have to chain code your contours and represent them in complex space to perform the Fourier transformation (the ordering matters if you don't perform step (2) ). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier descriptors are not necessarily robust. They are good if you have some control of environment (such as lighting and appearance etc. ), but I don't expect them to work on cases such as a missing handle.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-01-12T16:44:21.057" LastActivityDate="2015-01-12T16:44:21.057" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="19986" PostTypeId="2" ParentId="16285" CreationDate="2015-01-12T18:53:09.420" Score="0" Body="&lt;p&gt;Look at &lt;a href=&quot;http://www.mathworks.com/company/newsletters/articles/morphological-reconstruction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MathWorks - Technical Articles and Newsletters - Morphological Reconstruction&lt;/a&gt; and &lt;a href=&quot;http://www.mathworks.com/tagteam/64199_91822v00_eddins_final.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;MATLAB Digest | Academic Edition - Morphological Reconstruction&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Some applications are scanned text document (OCR as mentioned previously), fluorescently stained cell nuclei, or galaxies in a far-infrared telescope image. It can be used for extract marked objects, find bright regions surrounded by dark pixels, detect or remove objects touching the image border, detect or fill in object holes, filter out spurious high or low points, and perform many other operations.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="37293" LastEditDate="2020-10-05T16:21:20.593" LastActivityDate="2020-10-05T16:21:20.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="19987" PostTypeId="2" ParentId="19961" CreationDate="2015-01-12T19:17:03.930" Score="1" Body="&lt;p&gt;it's not &lt;em&gt;&quot;modern&quot;&lt;/em&gt;, but if done right, correlation methods are quite robust.  i personally like &lt;em&gt;Average Squared Difference Function&lt;/em&gt; (ASDF)&#xA;$$ Q_x[n_0,k] = \frac{1}{2L+1} \sum\limits_{n=n_0 - \lfloor k/2 \rfloor - L}^{n_0 - \lfloor k/2 \rfloor + L} \left( x[n]-x[n+k] \right)^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but the more familiar &lt;em&gt;Average Magnitude Difference Function&lt;/em&gt; (AMDF)&#xA;$$ Q_x[n_0,k] = \frac{1}{2L+1} \sum\limits_{n=n_0 - \lfloor k/2 \rfloor - L}^{n_0 - \lfloor k/2 \rfloor + L} \Big| x[n]-x[n+k] \Big| $$&#xA;might be more to your liking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n_0]$ is the middle of the neighborhood of samples where you are determining the pitch.  $2L+1$ is the number of terms being averaged.  you probably do not need to divide by $2L+1$ if you don't want to, since the values of $Q_x[n_0,k]$ are relative to each other. $\lfloor k/2 \rfloor = k/2$ for even $k$ and $\lfloor k/2 \rfloor = (k-1)/2$ for odd $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;look for a value of $k$ that minimizes $Q_x[n_0,k]$.  you will likely want to interpolate around that integer value of $k$ to find a fractional value that is the &quot;true&quot; minimum.  i usually just use simple quadratic interpolation. if $Q_x[n_0,k_m]&amp;lt;Q_x[n_0,k_m-1]$ &lt;strong&gt;and&lt;/strong&gt; $Q_x[n_0,k_m] \le Q_x[n_0,k_m+1]$ then the interpolated minimum (and a candidate for the period) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ P_m = k_m + \frac{1}{2} \frac{Q_x[n_0,k_m+1] - Q_x[n_0,k_m-1]}{2Q_x[n_0,k_m] - Q_x[n_0,k_m+1] - Q_x[n_0,k_m-1]} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the input $x[n]$ is extremely periodic, there might be many values of $k$ that locally minimize $Q_x[n_0,k]$ because&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $x[n+P]=x[n] \quad \forall n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then $x[n+2P]=x[n]$ or $x[n+3P]=x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $Q_x[n_0,P]$ or $Q_x[n_0,2P]$ or $Q_x[n_0,3P]$ are all equally minimum (and close to zero). so then usually you want to pick the minimum that has the smallest $k$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-01-12T19:54:12.643" LastActivityDate="2015-01-12T19:54:12.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19989" PostTypeId="1" AcceptedAnswerId="19990" CreationDate="2015-01-12T19:56:10.153" Score="0" ViewCount="1591" Body="&lt;p&gt;This question follows from an answer to this other question: &lt;a href=&quot;https://dsp.stackexchange.com/questions/19191/conceptual-question-on-fft-and-chirp-signal&quot;&gt;Conceptual question on FFT and chirp signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a code starting from the spectrogram to compare it with the FFT result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Chirp generation&#xA;t = [0 0.5 1.0 1.5 2.0]; % time breakpoints&#xA;f = [0 200 100 150 300];  % instantaneous frequency breakpoints&#xA;p = polyfit(t,f,4);    &#xA;dt = 0.001;&#xA;t = 0:dt:2;           &#xA;y = chirp(t,p);&#xA;L = length(y);&#xA;&#xA;% FFT&#xA;NFFT = 2^nextpow2(L);&#xA;Y = fft(y,NFFT)/L;&#xA;Fs = 1/dt;&#xA;f_plot = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;% Spectrogram&#xA;figure()&#xA;specgram(y,128,Fs,128,120); % 2D time-freqency display&#xA;&#xA;[S,F,T,P]=spectrogram(y,128,120,128,1E3);&#xA;figure()&#xA;surf(T,F,10*log10(P),'edgecolor','none')&#xA;axis tight&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I obtain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/fft_chirp.jpg&quot; width=&quot;350&quot; height=&quot;300&quot;&gt; &lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/spectr_chirp.jpg&quot; width=&quot;350&quot; height=&quot;300&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i64.photobucket.com/albums/h182/Olgola/3d_spectr_chirp.jpg&quot; width=&quot;350&quot; height=&quot;300&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My qyestion is: shouldn't the spectrogram and the FFT have the same amplitude variation? Whereas the spectrogram does not seem to have amplitude variation (the red line is red at the same way everywhere).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question, why in the FFT I have high peaks at $100$ and $200 Hz$ only?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-01-12T20:38:43.143" Title="Spectrogram of a chirp and its FFT" Tags="|fft|spectrogram|linear-chirp|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19990" PostTypeId="2" ParentId="19989" CreationDate="2015-01-12T20:22:20.587" Score="1" Body="&lt;p&gt;FFT calculates spectrum over the whole duration of your signal (integrates energy at each frequency over the time of accumulation) while spectrogram shows frequency variation in time (instantaneous frequency). Divide the whole frequency band of interest in some equal intervals and evaluate how much time signal's frequency falls in each interval. These time periods aren't equal. So by FFT frequencies corresponding to larger time periods gains more power and will be major and vice versa. Now lets look at your spectrogram. We see that it's about 100 and 200 Hz when the most stationarity in frequency exists, there are maximums of the spectrum. Frequencies between 100 and 200 Hz appears 2 times, so we see raising of the spectrum at this span. Low and high frequencies appears only 1 time and frequency at these regions varies faster: the spectrum after FFT decreases.  &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-01-12T20:22:20.587" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19991" PostTypeId="2" ParentId="19989" CreationDate="2015-01-12T20:38:43.143" Score="1" Body="&lt;p&gt;If you look at the first derivative of your frequency sweep, you will note that the derivative goes thru zero just below 100 Hz and just above 200 Hz.  When the slope of the frequency is near zero, the frequency isn't changing very fast, thus staying longer in those frequency regions, thus having more energy in those frequency regions or bins, thus causing higher peaks in the FFT result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectrogram will show the same variations if you squash it sideways (the triple overlap will sum, the non overlapping frequencies won't).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-01-12T20:38:43.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19992" PostTypeId="1" AcceptedAnswerId="20000" CreationDate="2015-01-12T21:12:17.210" Score="1" ViewCount="951" Body="&lt;p&gt;Can someone give my a link to study to solve this problem.&#xA;I can not find any formula for this problem...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we filter singals with the below pre-emphasis filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n)=x(n) - ax(n-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I compute $a$ if I know that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;fs=10.000Hz&lt;/li&gt;&#xA;&lt;li&gt;length 100 in which 98 is zero.&lt;/li&gt;&#xA;&lt;li&gt;Frequency response at 2100Hz is 1.3429 dB&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I don't want the solution only a hint I found this in my notes: 10log10(a^2*w^2+1)=db but with this formula i don't use some information which given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="13355" LastEditorUserId="13355" LastEditDate="2015-01-12T21:28:00.130" LastActivityDate="2015-01-13T18:26:19.253" Title="pre-emphasis filter - parameter a" Tags="|filters|impulse-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="19993" PostTypeId="2" ParentId="19629" CreationDate="2015-01-12T21:26:00.127" Score="0" Body="&lt;p&gt;I do not think that the method you are using is the one you want. The method you chose is good if you have very few measurements, but in your case you have too many and there are much easier methods to calculate curvature if that is the case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Curvature is defined as $k(x) = f''(x)/|1+f'(x)^2|^{3/2}$.&#xA;To calculate f'(x) and f''(x) there some easy formulas:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f'(x) = ( f(x+h)-f(x-h) )/(2h)$    &amp;lt;------- Use this equation first&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f''(x) = ( f'(x+h)-f'(x-h) )/(2h)$, &amp;lt;------ Then use this equation with your calculated $f'$ values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f(x)$ is your measurement on position $x$, $h$ is the distance to another measurement(in your case a small integer value). Use these equations with different h and take a mean value the get a good approximation of $f'(x)$ and $f''(x)$. Read up on taylor series expansion if you want an explanation of these equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be sufficient to calculate the curvature on a given point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way:&#xA;This row &quot;C = (J.T&lt;em&gt;J).I&lt;/em&gt;J.T&quot; is really not a good way to do what you were trying to do. This method is used to explain the theory, but not to be used in code. The C value is nice to have but it is really slow to calculate/ not always possible to calculate. This problem is very common(the method is called &quot;least squares&quot;). Because of this there are a lot of built in solutions to get what &lt;a href=&quot;http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt; calls C * y:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cOZWJ.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know exactly how do this in python but in matlab C * y is calculated as J\y&lt;/p&gt;&#xA;" OwnerUserId="13352" LastEditorUserId="13352" LastEditDate="2015-01-13T11:43:15.127" LastActivityDate="2015-01-13T11:43:15.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="19994" PostTypeId="1" AcceptedAnswerId="19995" CreationDate="2015-01-12T21:53:17.207" Score="2" ViewCount="1459" Body="&lt;p&gt;I apologize if this isn't the correct Stack on which to ask this question, but it seemed like the best fit.  I've tried to Google an answer, but I haven't been able to find anything that applies directly to Es/No, or which is written in a way I can understand (ie, the mathematical formulas on Wikipedia are beyond me at the moment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have worked with legacy satellite communications equipment for years, and I am typically used to seeing receive signal performance measured as a positive &lt;a href=&quot;https://en.wikipedia.org/wiki/Eb/N0&quot; rel=&quot;nofollow&quot;&gt;Eb/No&lt;/a&gt; or Es/No; any carrier visible on a spectrum analyzer would have--in my experience--a positive Es/No value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I was recently shown an SCPC system where the carrier's Es/No was reported as a negative value, but I can't get an explanation as to why.  Is a negative Es/No value even possible?  Specifically, is such a value possible for a carrier which appears to be above the noise floor (as seen on a spectrum analyzer)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's possible, then what would such negative values signify?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate any insight anyone can offer, even if it's just to point me to another Stack.&lt;/p&gt;&#xA;" OwnerUserId="12154" LastEditorUserId="29" LastEditDate="2015-01-12T22:17:33.643" LastActivityDate="2015-01-12T22:27:41.803" Title="Is a negative Es/No for an SCPC RF signal possible, and what would such a value signify?" Tags="|signal-analysis|frequency-spectrum|power-spectral-density|performance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19995" PostTypeId="2" ParentId="19994" CreationDate="2015-01-12T22:27:41.803" Score="2" Body="&lt;p&gt;Assuming the number is reported in dB, a negative value of $E_s/N_0$ means is that the energy per symbol $E_s$ is less than the noise spectral density $N_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even then, a negative $E_s/N_0$ seems hard to obtain if the signal's power is larger than the noise power (as measured on the spectrum analyzer). Assuming that the maximum symbol rate is used ($E_s=2B$, where $B$ is the bandwidth), and that the noise power $\sigma^2=N_0B$, then $$\frac{E_s}{N_0} = \frac{P}{2\sigma^2},$$ where $P$ is the signal power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, under these assumptions, a negative $E_s/N_0$ (in dB) means that the signal's power is less than twice the noise power.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-01-12T22:27:41.803" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="19996" PostTypeId="1" CreationDate="2015-01-12T22:40:49.553" Score="0" ViewCount="515" Body="&lt;p&gt;I am building an LPC analysis tool for speech synthesis and did the following to generate my a0 through a10:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sum = 0&#xA;for (i = 0; i &amp;lt; N - order; i++) {&#xA;  sum += s[i + order] * s[i]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, for an example sequence:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s[0]: -0.00036988587817177176&#xA;s[1]: -0.0005228677182458341&#xA;s[2]: -0.002549876691773534&#xA;s[3]: -0.005284426733851433&#xA;s[4]: 0.03419444337487221&#xA;s[5]: 0.06330401450395584&#xA;s[6]: 0.2461005449295044&#xA;s[7]: 0.36327624320983887&#xA;s[8]: 0.5022943019866943&#xA;s[9]: 0.7432577013969421&#xA;s[10]: 0.7451401948928833&#xA;s[11]: 0.9017787575721741&#xA;s[12]: 0.9144688248634338&#xA;s[13]: 0.8055802583694458&#xA;s[14]: 0.7247466444969177&#xA;s[15]: 0.5342929363250732&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a0: 1.6765472891346052&#xA;a1: 1.5827508756328967&#xA;a2: 1.3697197839567066&#xA;a3: 1.0687599069050433&#xA;a4: 0.741864438363822&#xA;a5: 0.4665998816936655&#xA;a6: 0.2567268139253708&#xA;a7: 0.12122018661739875&#xA;a8: 0.04979388551368519&#xA;a9: 0.016472847413864372&#xA;a10: 0.003187118053062932&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then when I run that through my K conversion, I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k1: -0.9440538217385303&#xA;k2: 0.6826731774147582&#xA;k3: 0.27304617789929586&#xA;k4: -0.18255947440809286&#xA;k5: -0.48868909366775654&#xA;k6: 0.1881875661845312&#xA;k7: 0.3690787060329103&#xA;k8: -0.005584315353450492&#xA;k9: -0.3649987110269231&#xA;k10: -0.03950634100447886&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have another LPC analysis tool which shows totally different K values than what I am getting, so I am suspecting that my code to generate the a's has an error in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been looking online for something that can say, given this A, its K should be: X...  But I have not been able to find any such thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone here verify that my As and Ks are correct, given this example sequence?&lt;/p&gt;&#xA;" OwnerUserId="11807" LastActivityDate="2015-12-15T17:32:59.647" Title="autocorrelation A to K conversion for LPC speech analysis?" Tags="|autocorrelation|speech-processing|lpc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19998" PostTypeId="1" AcceptedAnswerId="20001" CreationDate="2015-01-13T00:23:44.270" Score="1" ViewCount="1484" Body="&lt;p&gt;I want to design/implement a simple feedforward/feedback all-pass filter, and I am having some troubles and questions with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Shroeder design (based on J. Smith article &lt;a href=&quot;https://ccrma.stanford.edu/realsimple/Delay/Allpass_Filters_I.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;):&lt;br&gt;&#xA;&lt;img src=&quot;https://ccrma.stanford.edu/~jos/pasp/img593.png&quot; alt=&quot;Feedback/feedforward all-pass&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came up with the following pseudocode (for first-order all-pass filter, meaning the delay was set to 1 sample, and &lt;code&gt;b0 = aM&lt;/code&gt;):  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float allPassGain = aM, value from [0.0, 1.0);&#xA;&#xA;float allPassFeedback = 0.0;&#xA;float allPassDelayedSample = 0.0;&#xA;&#xA;float processAllPass(float x)&#xA;{&#xA;    float delayInput = x + allPassFeedback;&#xA;    float feedForward = delayInput * allPassGain;&#xA;&#xA;    float delayOutput = allPassDelayedSample;&#xA;    allPassDelayedSample = delayInput;&#xA;&#xA;    allPassFeedback = delayOutput * -allPassGain;&#xA;&#xA;    return delayOutput + feedForward;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here &lt;code&gt;x&lt;/code&gt; is an input sample, to process some signal with this all-pass I am going through the signal feeding it sample-by-sample into &lt;code&gt;processAllPass&lt;/code&gt;, and store the outputs in the parallel output signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But unfortunately it seems like this approach doesn't work. For example, if I create a simple &lt;a href=&quot;http://en.wikipedia.org/wiki/Phaser_(effect)&quot; rel=&quot;nofollow&quot;&gt;Phaser&lt;/a&gt; with a set of successful all-pass filters designed like that, I don't get the desired effect, instead the signal becomes unstable and shoots through the roof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the pseudo-code have issues? I am setting &lt;code&gt;aM&lt;/code&gt; to an arbitrary value and the delay line length is strictly 1.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Matt L.'s answer helped me to fix the code, and here is the fixed pseudo-code if that would be interesting (please also note that for the Phaser effect I find it better to switch coefficients' signs, it is slightly different version of the all-pass filter, presented in e.g. &lt;code&gt;&quot;Reducing Artificial Reverberation Algorithm Requirements using FDN&quot; by Jasmin Frenette&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float allPassGain = aM, value from [0.0, 1.0);&#xA;&#xA;float allPassDelayedSample = 0.0;&#xA;&#xA;float processAllPass(float x)&#xA;{&#xA;    float delayOutput = allPassDelayedSample;&#xA;    float feedBack = delayOutput * allPassGain;&#xA;&#xA;    float delayInput = inSamp + feedBack;&#xA;    float feedForward = delayInput * -allPassGain;&#xA;    allPassDelayedSample = delayInput;&#xA;&#xA;    return delayOutput + feedForward;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13357" LastEditorUserId="13357" LastEditDate="2015-01-13T12:31:57.147" LastActivityDate="2015-01-13T12:31:57.147" Title="Allpass filter feedforward/feedback design and code" Tags="|filters|audio|delay|allpass|feedback|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="19999" PostTypeId="2" ParentId="19980" CreationDate="2015-01-13T00:25:15.173" Score="3" Body="&lt;p&gt;If I understood right, you are stuck in matching a given histogram into a desired one and creating a new image from this matched histogram obtained by your filtering method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would first suggest you to get rid of all the unnecessary stuff (including the python code) above and isolate your problem as &quot;histogram matching&quot; in mathematical terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I will describe how you can approximately match a given histogram to a desired one in two setps: by first converting it into that of a uniform (equalized) one, and in then converting this uniform one to the desired one. Finally we shall combine these two steps to get the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method is based on converting a random variable into another by means of a transform $G(\cdot)$. You will replace the random variable $X$ with image intensity function $I(n,m)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a uniform random variable $X$ whose CDF is $F_X(x) = U(x) = P(X &amp;lt; x) = x$.  We want to generate a new rv $Y$ from $X$, by means of a transform $Y=G(X)$, such that its CDF is the desired one. We shall therefore find this transform $G(x)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under suitable conditions: $$F_Y(y)= P(Y&amp;lt; y) = P(G(X)&amp;lt;y) = P(X&amp;lt; G^{-1}(y)) = F_X(G^{-1}(y))=G^{-1}(y) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which we deduce that the transform that converts uniform $X$ to arbitrary $Y$ with a desired CDF is $G(x) = F_Y^{-1}(x)$ from which we obtain: $$ \boxed{Y = F_Y^{-1}(X)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore the transform that converts a &lt;strong&gt;uniform&lt;/strong&gt; RV $X$ to an arbitrary (desired) RV $Y$ is $$ \boxed{G(x) = F_Y^{-1}(x)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transform that converts an &lt;em&gt;arbitrary&lt;/em&gt; RV $Y$ to a &lt;em&gt;uniform&lt;/em&gt; RV $X$ is $$ \boxed{ G^{-1}(x)=F_Y(x) } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finaly, the transform that converts &lt;strong&gt;arbitrary&lt;/strong&gt; RV $Y$ to another &lt;strong&gt;arbitrary&lt;/strong&gt; RV  $Z=T(Y)$ is $$ \boxed{ T(y)=F_Z^{-1}(F_Y(y)) } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are almost done, we will finish by converting above algorithm to Image manipulation and also clarify how you will overcome the problem of not having those CDF's as formulas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replace RV $Y$ and $Z$ with i/o images $Iy(n,m)$, $Iz(n,m)$, also replace CDFs of $Y$, $Z$ with that of &quot;computed from histograms&quot;. I denote it as $H_y(i)$ and $H_z(i)$ where $H_y(i)$ denotes the cumulative histogram obtained from image at hand, and $H_z(i)$ computed from the desired (to be matched) histogram. Under suitable conditions and correct scalings to ensure intensity levels to remain within valid limits, therefore we can make the definiton as $I_z = T(I_y)$ or more explicitly $I_z(n,m) = H_z^{-1}(H_y(I_y(n,m)))$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your only problem is about the inverse cumulative histogram of $Z$ (or $I_z$) and unfortunately I don't know a method which may guarantee perfect inversion. As it is a CDF from a discrete histogram there might be empty bins and hence some indices of inverse $H_z(i)$ might have no mappings at all. It is up to you how to best overcome this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as I understood from your code, you add pixels to empty/weak bins so that $H_z(i)$ becomes invertable...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below I will put some matlab code &quot;as is&quot; : There are many methods to match histograms and I don't think below is the most accurate or the efficient one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Iy = imread('cameraman.tif');  % Intesity between [0-255]&#xA;hy = imhist(Iy);         % compute image histogram hy(i)&#xA;figure,stem(hy); &#xA;title('original image histogram');&#xA;&#xA;S = size(Iy);&#xA;Imax = 255;             % 8 bit&#xA;K = Imax / (S(1)*S(2)); % Scale factor&#xA;Hy = zeros(1,256);      % compute CDF Hy(i) of input image &#xA;Hy(1)=hy(1);&#xA;for i=2:256&#xA;  Hy(i) = Hy(i-1) + hy(i);&#xA;end&#xA;Hy = K*Hy;&#xA;figure,stem(Hy);&#xA;title('CDF of original input image');&#xA;&#xA;% Get the desired image and histograms:&#xA;I_des = imread('tire.tif');&#xA;figure,imshow(I_des);&#xA;S = size(I_des);&#xA;&#xA;h_des = imhist(I_des);&#xA;figure,stem(h_des);&#xA;title('desired image histogram');&#xA;&#xA;h_des(h_des &amp;lt; (S(1)*S(2)/(Imax*8))) = h_des(h_des &amp;lt; (S(1)*S(2)/(Imax*8))) + 32; % HERE  paddings &#xA;Hz = zeros(1,256);  % This is desired CDF &#xA;Hz(1)= h_des(1);&#xA;for i=2:256&#xA;  Hz(i)=Hz(i-1)+h_des(i);&#xA;end&#xA;K_des = Imax / (Hz(256));&#xA;Hz = K_des*Hz;&#xA;figure,stem(Hz);&#xA;title('Desired CDF Hz');&#xA;&#xA;% MATCH is performed&#xA;Imatch = (Iy);     % Processed image from matching&#xA;for i=0:255       % for each intensity level&#xA; ind = (Iy==i);   % find those index with an intensity value of &quot;i&quot;&#xA;&#xA; j = Hy(i+1);&#xA;&#xA; looping=1;  %  implement you own method&#xA; while looping&#xA;    k = find( (Hz &amp;gt; (j-1)) &amp;amp; (Hz &amp;lt; (j+1)));&#xA;    if length(k)&amp;gt;0   % for practical matters...&#xA;      looping =0;&#xA;    else&#xA;      j = j + 1;    % when there is no match, update a little&#xA;    end &#xA; end&#xA;&#xA; Imatch(ind) = k(1); % Adjust the original intensity now...&#xA;end&#xA;&#xA;figure, imshow(Imatch);&#xA;title('Image Matched to desired histogram');&#xA;&#xA;h_match = imhist(Imatch);&#xA;figure, stem(h_match);&#xA;title(' Matched Histogram, not a good match ???');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2017-10-26T10:07:23.280" LastActivityDate="2017-10-26T10:07:23.280" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20000" PostTypeId="2" ParentId="19992" CreationDate="2015-01-13T02:23:56.387" Score="0" Body="&lt;p&gt;Hope this is right...&#xA;$$h[n]=\delta[n]-a\delta[n-1]$$&#xA;$$H(e^{jw})= 1- ae^{-jw} =(1-a\cos(\omega))+ja\sin(\omega)$$&#xA;$$|H(e^{j\omega})|= \sqrt{1 + a^2 -2a\cos(\omega)}$$&#xA;$$DB_\omega \triangleq 20\log(|H(e^{j\omega})|)$$&#xA;$$20\log((1 + a^2 -2a\cos(\omega))^{1/2})= DB_\omega$$&#xA;$$1 + a^2 -2a\cos(\omega)= 10^{DB_\omega/10}$$&#xA;$$a^2 -2a\cos(\omega) +1-10^{DB_\omega/10}=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\omega = 2 \pi \frac{2100}{10000}, \ DB_\omega=1.343 \ \Rightarrow \ a \in \{0.9, -0.4026\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a = -0.4026$ results in a low-pass pre-emphasis whereas $a = 0.9$ results in a high-pass pre-emphasis.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="4346" LastEditDate="2015-01-13T18:26:19.253" LastActivityDate="2015-01-13T18:26:19.253" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="20001" PostTypeId="2" ParentId="19998" CreationDate="2015-01-13T10:25:11.333" Score="2" Body="&lt;p&gt;First of all make sure that the magnitude of $a_M$ is strictly less than $1$; this is necessary for the filter's stability. Second, you use several unnecessary variables. This is no serious problem, but it makes it harder to see what's going on. For $M=1$ a simple pseudo-code would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;v = x - aM * v_old;&#xA;y = v * b + v_old;&#xA;v_old = v;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The important thing is that the state variable &lt;code&gt;v_old&lt;/code&gt; must be remembered between function calls. Are you sure that your variables &lt;code&gt;allPassFeedback&lt;/code&gt; and &lt;code&gt;allPassDelayedSample&lt;/code&gt; are not reset to $0$ every time you call the function?&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-13T10:25:11.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20002" PostTypeId="1" AcceptedAnswerId="24090" CreationDate="2015-01-13T10:47:50.893" Score="5" ViewCount="15367" Body="&lt;p&gt;I'm wondering what basic characteristics of shadows are. I'm looking from a camera image/video processing point of view. I'm considering the case of an outside scene in direct sunlight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the characteristics I could quickly come up with, but I guess there are more.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There are strong edges on the shadow borders&lt;/li&gt;&#xA;&lt;li&gt;The shadow is ‘darker’ than the surrounding area&lt;/li&gt;&#xA;&lt;li&gt;The shadow usually ‘deforms’ when an object is rotated&lt;/li&gt;&#xA;&lt;li&gt;Due to absence of the primary lighting in the shade, the color tends to be dominated mostly by the main diffuse lighting source (which is in most cases the sky --&gt; blue)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm wondering which other characteristics I might miss.&lt;/p&gt;&#xA;" OwnerUserId="13349" LastActivityDate="2020-11-19T21:38:40.113" Title="What are characteristics of shadows in an image given an outdoor setting from an image processing point of view?" Tags="|image-processing|classification|camera|" AnswerCount="7" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20004" PostTypeId="1" CreationDate="2015-01-13T14:17:43.937" Score="1" ViewCount="142" Body="&lt;p&gt;I am working on an arabic OCR for printed scanned documents ... Some of the scanned documents may written with font size of height 8 which is quite small ... I want to resize the height to 60 pixels but some artifacts may occur due to nature of arabic characters .. some characters may overlap .I had used local thresholding methods after resizing but the results are still not acceptable ... any ideas ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example image: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QemDB.png&quot; alt=&quot;Image 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the same example after resizing and applying local adaptive thresholding using 50 as a window size:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GF7oQ.png&quot; alt=&quot;Image 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see there are some discontinuities in some characters like this one :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vPc8A.png&quot; alt=&quot;Image 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there is any method to resize the image while preserving textual shape ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach to fix characters discontinuities :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Threshold original image before resizing using local adaptive threshold using window size of 16 (this will solve characters discontinuities but the holes in the characters are filled) call it &lt;code&gt;smallbw&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Resize &lt;code&gt;smallbw&lt;/code&gt; using &lt;code&gt;imresize(smallbw, [nh nw], 'nearest')&lt;/code&gt; and fill the holes in characters using &lt;code&gt;imfill&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Resize the original image to height 60 pixels using &lt;code&gt;imresize(originalIm, [nh nw], 'nearest')&lt;/code&gt; call it &lt;code&gt;largebw&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fill holes in &lt;code&gt;largebw&lt;/code&gt; using &lt;code&gt;imfill&lt;/code&gt; and call it &lt;code&gt;bwfill&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Extract holes from &lt;code&gt;largebw&lt;/code&gt; by &lt;code&gt;bwholes = bwfill - largebw&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, subtract &lt;code&gt;bwholes&lt;/code&gt; from &lt;code&gt;smallbw&lt;/code&gt; to get this&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cQlBU.png&quot; alt=&quot;Image 4&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see here that the discontinuity found in the character @Image 3 has been solved ... but there is another problem raised here some characters may overlap as shown here &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rEkH4.png&quot; alt=&quot;Image 5&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the best results I could achieve so far ... are there any other ideas that may solve these issues ?? &#xA;and if you think this issue has no solution how would I resolve it rather than using resizing? what about using 12 font size text instead of 8? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Useful links : &#xA;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/8647-local-adaptive-thresholding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Local adaptive threshold method used&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Operating system : windows 7 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Programming environment : Matlab 2013a - Image Processing toolbox &lt;/p&gt;&#xA;" OwnerUserId="13362" LastActivityDate="2015-05-14T19:22:17.493" Title="Re sizing and thresholding small font scanned Arabic words" Tags="|image-processing|matlab|thresholding|ocr|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20005" PostTypeId="1" AcceptedAnswerId="20007" CreationDate="2015-01-13T15:43:48.337" Score="0" ViewCount="1546" Body="&lt;p&gt;I'm a complete beginner to object recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to identify and count how many of a certain type of Lego, in a picture full of different pieces of Lego, using MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pieces of Lego I need to identify, are of a certain shape, colour and size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need suggestions for algorithms that can perform this task, and links to where I can find more information about them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the research I've done, so many are focused around facial recognition, and provide no help for me!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I followed a tutorial that used SURF points to identify points of interest, in the scene pictures and the picture of the Lego picture to find. But it wasn't able to pick up on all the aspects of the Lego piece, and therefore didn't have a chance of finding it in the scene.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there aren't any algorithms that can perform this, how can I at least separate the pieces based on their colours? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be really handy! Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample picture where I will need to identify certain pieces:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nHGVx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13363" LastEditorUserId="53" LastEditDate="2015-01-13T18:01:08.657" LastActivityDate="2015-03-14T19:21:38.687" Title="Object Detection Algorithms" Tags="|image-processing|matlab|computer-vision|object-recognition|matlab-cvst|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20007" PostTypeId="2" ParentId="20005" CreationDate="2015-01-13T18:09:19.383" Score="0" Body="&lt;p&gt;SURF works well for objects with distinctive textures. Unfortunately, all lego blocks have essentially the same texture, so it is not a good cue for telling them apart.  The other difficulty is that your blocks can have different 3D orientations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good news is that they are brightly colored. The &lt;a href=&quot;http://www.mathworks.com/help/images/image-segmentation-using-the-color-thesholder-app.html&quot; rel=&quot;nofollow&quot;&gt;Color Thresholder app&lt;/a&gt; is a good way to segment out objects by color.  Once you have identified individual blocks, you can try to use other cues, such as size and shape to identify different blocks of the same color.  Try using the &lt;code&gt;regionprops&lt;/code&gt; function.  For example &lt;code&gt;Eccentricity&lt;/code&gt; can help you distinguish between a square block and an elongated block, assuming they are viewed from the top.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I can only give you a starting point, not the complete solution. You are going to have to do some experimenting here.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-01-13T18:09:19.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20008" PostTypeId="2" ParentId="20002" CreationDate="2015-01-13T20:11:27.297" Score="1" Body="&lt;p&gt;More formally:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The saturation component of the shadow should be low. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Under the Lambertian assumption, an input image I arises from a product of two intrinsic images: the reflectance image and the illumination image. Invariance to illuminant&#xA;colour and intensity means that such images are free of shadows, as well, to a good degree. Since shadows are mostly due to removal of some of the lighting, such an image also has shadows removed.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-01-13T20:11:27.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20009" PostTypeId="1" CreationDate="2015-01-13T20:19:35.803" Score="3" ViewCount="1678" Body="&lt;p&gt;Does anybody know a simple way to recognize vowels from MFCCs? (not words, just phonemes: a,e,i,o,u). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I heard this is a vastly known problem in DSP with several solutions like SVM, GMM and cosine distance. I tried this last method using a &lt;a href=&quot;https://github.com/jameslyons/python_speech_features&quot; rel=&quot;nofollow noreferrer&quot;&gt;good audio processing library&lt;/a&gt; and a representative training set, but seems that my classification work is not giving good results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a gisp what I'm doing is this: given a set of recordings belonging to the same phoneme, I'm taking the average of the frames of all the recordings to create a feature vector of 13 entries. Later I'm applying a normalized dot product with the testing vector to find the cosine distance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also read this &lt;a href=&quot;https://dsp.stackexchange.com/questions/9066/using-mfcc-in-spoken-words-recognition&quot;&gt;thread&lt;/a&gt; but they make emphasis in the problem of recognizing a sequence of phonemes via DTW, not in the previous vector's classification problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are LPC a better approach? I mean, the formant position are known a priori...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Ok, I'm gonna change the question. The method in essence works (after implemented it), it recognizes when I say A,E,I,O,U. The problem is that it doesn't identify when the phoneme is NOT a vowel (e.g. consonants, transient noises). Is there a method that allows to distinguish vowels from other sounds?? Perhaps the MFCCs are good, due that they get the timbre properties, but the cosine classifier is not the best solution. Anyone? please&lt;/p&gt;&#xA;" OwnerUserId="7316" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-01-22T23:28:49.117" Title="Vowel detection using MFCC" Tags="|algorithms|speech-recognition|mfcc|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20010" PostTypeId="1" CreationDate="2015-01-13T20:25:55.447" Score="3" ViewCount="1731" Body="&lt;p&gt;I'd like to simulate a certain $E_s/N_0$ in a baseband OFDM MATLAB modem to generate SER curves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I randomize 50 QAM symbols with $N$ subcarriers each in frequency domain, add null frequencies (guard bands) to each symbol, perform IFFT and then add CP. Then I convolve the &quot;time domain&quot; symbols with a certain channel with taps of my choice and then I want to add noise, but I'm not sure about how to normalize it so that I obtain the correct SNR as generally reported in theoretical curves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get funky results with just MATLAB's &lt;code&gt;agwn&lt;/code&gt; function with the &lt;code&gt;measured&lt;/code&gt; flag.&lt;/p&gt;&#xA;" OwnerUserId="7686" LastEditorUserId="11256" LastEditDate="2015-01-13T23:16:28.357" LastActivityDate="2015-01-14T21:30:30.323" Title="Simulating noise in OFDM" Tags="|matlab|noise|digital-communications|ofdm|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20012" PostTypeId="2" ParentId="20010" CreationDate="2015-01-13T22:02:38.253" Score="1" Body="&lt;p&gt;In theory, all you'd need to do is add Gaussian noise of the appropriate variance. Without seeing your code and without knowing what &quot;funky&quot; means, I would check for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;when you do the convolution, scale the result by $\Delta t$, the time differential&lt;/li&gt;&#xA;&lt;li&gt;make sure the FFT scaling that Matlab performs is not throwing you off&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One thing you can do, which is simple but not very elegant, is to add the noise to each symbol after the FFT in the receiver, but before running any decision rule on them. You can simply add one sample of complex noise of variance $N_0$ to each symbol; since you control their average energy, you can get any SNR you want.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-01-13T22:02:38.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20013" PostTypeId="2" ParentId="19899" CreationDate="2015-01-13T22:57:50.400" Score="0" Body="&lt;p&gt;If you know the signal shape then you can generically run it through a Wiener filter.   OTOH: You do realize that if the noise is random and the signal is consistent then some form of averaging will improve the SN?&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2015-01-13T22:57:50.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20014" PostTypeId="1" AcceptedAnswerId="20019" CreationDate="2015-01-13T23:39:33.523" Score="0" ViewCount="113" Body="&lt;p&gt;I'm hoping someone - anyone can answer a question on the Siglib library call to perform an FFT on data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no examples anywhere I can find that provide a real application using data from an ADC, so that's where my wheels are spinning. &#xA;The examples from Numerix have only canned data, generated by the function &lt;code&gt;SDA_SignalGenerate&lt;/code&gt;. Specifically, in the FFT example, SDA_SignalGenerate is passed a value of $0.15625$ for frequency. Can anyone provide some insight as to what this represents? The &lt;code&gt;FFT_LENGTH&lt;/code&gt; of the FFT function is $512$, but I do not see what the &lt;code&gt;SDA_SignalGenerate&lt;/code&gt; frequency of $0.15625$ means, or what it is normalized to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help anyone can provide.&lt;/p&gt;&#xA;" OwnerUserId="10326" LastEditorUserId="8202" LastEditDate="2015-01-14T09:15:50.027" LastActivityDate="2020-10-26T22:18:33.507" Title="Has anyone used Siglib? Answer a question on the FFTr function?" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20016" PostTypeId="1" AcceptedAnswerId="20017" CreationDate="2015-01-14T03:46:43.553" Score="0" ViewCount="893" Body="&lt;p&gt;how do you compute the channel gain from path loss index in wireless communication? &lt;/p&gt;&#xA;" OwnerUserId="13372" LastActivityDate="2015-01-14T07:31:08.227" Title="how do you compute the channel gain from path loss index in wireless communication?" Tags="|signal-analysis|" AnswerCount="1" CommentCount="1" ClosedDate="2015-02-03T19:11:13.340" ContentLicense="CC BY-SA 3.0" />
  <row Id="20017" PostTypeId="2" ParentId="20016" CreationDate="2015-01-14T07:31:08.227" Score="0" Body="&lt;p&gt;You will have to properly define &lt;em&gt;path loss index&lt;/em&gt;. As soon as you have done that, you'll have a formula that links path loss index and attenuation/gain.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-01-14T07:31:08.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20018" PostTypeId="2" ParentId="19907" CreationDate="2015-01-14T07:42:45.863" Score="6" Body="&lt;p&gt;If I understand correctly, you don't need the intrinsics or extrinsics to achieve that, if a top-down view is all you want. You could basically define 4 points on your parallel lines and then warp the entire image into a canonical view (say $\{\{0,0\}, \{480,960\}\}$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that in OpenCV, all you need to do is compute the homography using &lt;code&gt;findHomography&lt;/code&gt; as described &lt;a href=&quot;http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. Then, use &lt;code&gt;warpPerspective&lt;/code&gt; (look &lt;a href=&quot;http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#void%20warpPerspective(InputArray%20src,%20OutputArray%20dst,%20InputArray%20M,%20Size%20dsize,%20int%20flags,%20int%20borderMode,%20const%20Scalar&amp;amp;%20borderValue)&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;) to warp your images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing you need to care about is the selection of the dimensions of the fronto-parallel view that you are after. It should more or less match the aspect ratio of the original image region.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Regarding the second part of your question: Yes. First of all, let me remind you that many works such as &lt;a href=&quot;http://www.fer.unizg.hr/_download/repository/kvalifikacijski_sikiric.pdf&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; choose to ignore the distortion estimation. But, I can think of two ways to accomplish that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the road lanes itself to correct the distortion: In the fronto-parallel view, create another perspective warp so that the lanes themselves would be vertical. In this setting, think about the lane lines as the vanishing lines in the image (as in a perspective view, they always do). From that, you can even calibrate your camera. Look &lt;a href=&quot;http://www.isprs.org/proceedings/XXXVI/part5/paper/1261_Dresden06.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, &lt;a href=&quot;http://www.robots.ox.ac.uk/~dwm/Publications/beardsley_murray_bmvc1992/beardsley_murray_bmvc1992.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://cv.snu.ac.kr/publication/conf/2009/RDC_FCV09.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; for example. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The cars should be following more or less a straight/smooth trajectory. If you compute the motion of all the cars, they should give you similar motions, parallel to the lanes. That information is again useful in constraining and generating a transformation, which would warp your image to a reduced distortion one.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-01-15T08:52:41.230" LastActivityDate="2015-01-15T08:52:41.230" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20019" PostTypeId="2" ParentId="20014" CreationDate="2015-01-14T11:34:34.370" Score="1" Body="&lt;p&gt;This is the frequency normalized by the sampling frequency, i.e. in your case the frequency in Hz is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f=0.15625\cdot f_s$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sampling frequency in Hz. This can also be found in the &lt;a href=&quot;http://www.numerix-dsp.com/docs/ref.pdf&quot; rel=&quot;nofollow&quot;&gt;SigLib reference manual&lt;/a&gt; (p. 251).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-14T11:34:34.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20020" PostTypeId="2" ParentId="19899" CreationDate="2015-01-14T14:11:28.820" Score="1" Body="&lt;p&gt;Thanks for the suggestions. I ended up just picking out the biggest nearby peaks, and if the difference between the frequency of interest and the biggest peak is less than 10dB, save a plot for manual inspection. I found it to be too difficult to distinguish between all the different scenarios that might be &quot;good&quot; or &quot;bad&quot; data.&lt;/p&gt;&#xA;" OwnerUserId="13305" LastActivityDate="2015-01-14T14:11:28.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20021" PostTypeId="2" ParentId="16767" CreationDate="2015-01-14T14:58:28.113" Score="1" Body="&lt;p&gt;If you can calibrate your camera, and if you can detect some reference points on the road surface, then you can get 3D coordinates of the image points that are on the road.  This assumes that the road is on a plane.  In other words, if you can detect a car, then you can calculate the 3D coordinates of the bottom of the car.  See this &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/measuring-planar-objects-with-a-calibrated-camera.html&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; in MATLAB using the Computer Vision System Toolbox.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-01-14T14:58:28.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20022" PostTypeId="2" ParentId="14488" CreationDate="2015-01-14T15:18:22.250" Score="0" Body="&lt;p&gt;There is a lot of information on feature detection, extraction, and matching in the &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/local-feature-detection-and-extraction.html&quot; rel=&quot;nofollow&quot;&gt;Computer Vision System Toolbox documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-01-14T15:18:22.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20023" PostTypeId="2" ParentId="20004" CreationDate="2015-01-14T15:37:02.703" Score="1" Body="&lt;p&gt;I think you could specify a higher DPI for higher 'resolution' (which effectively changes the pixel number of your image) in loading the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resizing the data will usually cause small changes to your data that are usually irreversible (unless you know exactly the correct parameters for resizing). &lt;/p&gt;&#xA;" OwnerUserId="13375" LastActivityDate="2015-01-14T15:37:02.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20024" PostTypeId="1" AcceptedAnswerId="20025" CreationDate="2015-01-14T16:42:39.670" Score="2" ViewCount="1046" Body="&lt;p&gt;As far as I know, bandwidth is measured in herz or 'radian/second' in digital signal processing or in analog communications. But in computer networking it is measured in 'bits/second'. I don't get  how these two are related. Can anybody please help?&lt;/p&gt;&#xA;" OwnerUserId="11809" LastEditorUserId="11256" LastEditDate="2015-01-14T18:02:34.327" LastActivityDate="2015-01-15T20:14:34.800" Title="Difference between the use of 'bandwidth' in DSP and computer networking" Tags="|bandwidth|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20025" PostTypeId="2" ParentId="20024" CreationDate="2015-01-14T16:54:26.717" Score="2" Body="&lt;p&gt;They &lt;em&gt;both&lt;/em&gt; define the amount of data you can get through a channel -- the channel bandwidth, together with the SNR, defines the channel capacity $C$, which has the unit of $\frac{\mathrm{bit}}{\mathrm{s}}$ (which, by the way, is simply $1$ binary decision per second), giving you the maximum amount of information you can get through that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ C_\mathit{Shannon} = f_\mathrm{bandwidth} \log_2 ( 1+\mathrm{SNR} )$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see, bandwidth in the signal sense just says &quot;we can see so and so many changes per second&quot;, and you can directly translate that to bits you get through that bandwidth, if you know how well your signal gets through.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2015-01-14T17:09:29.123" LastActivityDate="2015-01-14T17:09:29.123" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="20026" PostTypeId="2" ParentId="20024" CreationDate="2015-01-14T17:04:48.327" Score="1" Body="&lt;p&gt;As far as I'm aware, the original use of 'bandwidth' comes from communications engineering and is measured in hertz, and its use predates digital communications. The data (or information) rate in a link is meaured in bits per second. Since the data rate in a link is related to the system's bandwidth, the term was also relevant to the computer networking community. Over time, and probably due to marketing, the two terms started to be used interchangably in casual conversation. I would hope that networking engineers are aware of the difference, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: the proper unit of bandwidth is hertz. Using orthogonal signaling, the maximum  achievable symbol rate (or baud rate), measured in symbols per second,  is twice the bandwidth. The maximum bit rate is equal to the symbol rate times the number of bits per symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In networking, the data rate (or link speed, or link rate) is usually measured in bits per second. This is what is commonly, but wrongly, called the network's or the link's &quot;bandwidth&quot;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-01-14T17:04:48.327" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20027" PostTypeId="2" ParentId="20010" CreationDate="2015-01-14T18:03:25.017" Score="1" Body="&lt;p&gt;You shouldn't do a measurement with only one OFDM symbol at first. Instead create some random data, perform QAM modulation, devide QAM symbols array in $N$ OFDM data blocks and make OFDM symbols. Then add CP and paste it together to form a frame. Now you can calculate its power,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{signal} = 1 \div (N \cdot N_{FFT})\sum {s^2} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;estimate PAPR, add some noise to model frame spread over AWGN channel. Choose SNR of interest, you know your signal's power, so you can calculate power of noise to be added to satisfy SNR value you've choosen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{noise} = 10^{-SNR/10} \cdot P_{signal}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create complex-value noise with $randn$ function and scale it with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sigma = \sqrt{P_{noise}}/{\sqrt{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then add noise to your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that if you perform OFDM demodulation and than QAM demodulation you'll achive BER you're expecting to be for SNR you've choosen. If you want to have more precise measurement, do this routine for some times for one value of SNR and make average statistic. If you want to plot really good curves you need $1e+5...1e+6$ bits to measure BER for one SNR value. You can construct frame from about 5000...20000 bits (its common length for LDPC decoder used e.g. in the latest DVB-T, as I remember) and do measurements in $for$ loop. I advice you to generate random data at every iterarion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I don't see any problem in FFT normalization or with anything else. You construct a frame, estimate its power and insert noise according to average signal's power and SNR you want to achive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, I've forgotten. If you use only part of subcarriers during modulation, you should scale noise power as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{noise} = P_{noise} \cdot N_{used} \div N_{FFT}$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;to match the band where signal really exists and noise band.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2015-01-14T21:30:30.323" LastActivityDate="2015-01-14T21:30:30.323" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20028" PostTypeId="2" ParentId="20009" CreationDate="2015-01-14T20:05:21.407" Score="2" Body="&lt;p&gt;You may just implements a VAD (voice activity detector) whose parameters are high enough to filter out voiced consonants. One VAD which always amazed me is the zero crossing rate, because it is so simple to implements yet so difficult to model mathematicaly.&lt;/p&gt;&#xA;" OwnerUserId="9020" LastActivityDate="2015-01-14T20:05:21.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20030" PostTypeId="1" CreationDate="2015-01-14T23:06:01.597" Score="0" ViewCount="961" Body="&lt;p&gt;I made this question &lt;a href=&quot;https://dsp.stackexchange.com/questions/19731/newbieplotting-fft-and-impulse-response-coefficients-using-java&quot;&gt;https://dsp.stackexchange.com/questions/19731/newbieplotting-fft-and-impulse-response-coefficients-using-java&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the &lt;strong&gt;IRC&lt;/strong&gt;: Impulse Response Coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h(k), k = 0, 1,.., N-1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Low Pass:&lt;/strong&gt; $h_D(k)=\sin(k\omega_c)/{k\pi} , k\neq0; h_D(0)=2f_c$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;High Pass:&lt;/strong&gt; $h_D(k)=-\sin(k\omega_c)/{k\pi}, k\neq0; h_D(0)=1-2f_c$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Band Pass:&lt;/strong&gt; $h_D(k)=(\sin(k\omega_{cH})-\sin(k\omega_{cL}))/{k\pi}, k\neq0; h_D(0)=2(f_{cH}-f_{cL}) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Band Stop:&lt;/strong&gt; $h_D(k)=(\sin(k\omega_{cL})-\sin(k\omega_{cH}))/{k\pi}, k\neq0; h_D(0)=1-2(f_{cH}-f_{cL}) $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hamming Window Function:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w(k)=0.54+0.46\cos( \frac{2\pi k}{N} )$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we have:&#xA;$h(k) = w(k)\times h_D(k)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;obviusly my $h(k)$ can be represented as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double[] h = new double[N];  //N:odd integer&#xA;...&#xA;//hD[(N-1)/2] -&amp;gt; center or hD(0)&#xA;...&#xA;for (int  k = 0; k &amp;lt; N; k ++) {&#xA;  h[k] = hD[k]*w[k];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to get the formula to evaluate the h[k]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matlab to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[hFlt,fFlt] = freqz(h,1,256);&#xA;mLP = 20*log10(abs(hFlt)); &#xA;plot(fFlt,mLP);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KYr8l.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to obtain hLP and fLP values to plot filters response (&lt;strong&gt;without using matlab&lt;/strong&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't know the &lt;strong&gt;formulas&lt;/strong&gt;(procedure or algorythm) to plot the frequency response.&lt;/p&gt;&#xA;" OwnerUserId="12165" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-05-15T17:30:23.963" Title="Formulas to plot Frequency Impulse Response Coefficients" Tags="|matlab|fft|frequency-spectrum|frequency-response|java|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20031" PostTypeId="2" ParentId="19911" CreationDate="2015-01-14T23:30:36.470" Score="0" Body="&lt;p&gt;If you want to start learning OpenGL, see Part 1 of the answer. If you just want to get an image like the one you presented (and image editor transformation will work for you) and don't want unnecessary complications, see Part 2.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You indeed can generate such a picture with OpenGL, but it's a bit too big for the answer here. Here's the &lt;a href=&quot;http://nehe.gamedev.net/tutorial/lessons_01__05/22004/&quot; rel=&quot;nofollow&quot;&gt;link to some (quite old) OpenGL tutorials&lt;/a&gt; and &lt;a href=&quot;http://nehe.gamedev.net/tutorial/lessons_06__10/17010/&quot; rel=&quot;nofollow&quot;&gt;the second pack&lt;/a&gt;, all with the source code, and there you can learn and understand how to create such a program, or if needed, just take the sources and modify them slightly for your needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first pack linked above you can learn how to set up a window and render basic primitives, also how to apply transformations etc. The second pack will teach you how to apply textures (lessons 06-07, others are on advanced topics).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind though that those lessons are outdated, and they use the deprecated FFP (fixed functionality pipeline) interface of the OpenGL, but this interface is better suited for the beginners in my opinion. Modern OpenGL applications use the programmable pipeline, where all transformation/projection matrices are filled up manually and transferred to the shaders, immediate primitive mode is unavailable (you can only send primitive data in batches), etc; this may be confusing initially.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But if you just need a picture like that, and do not want to learn how to use OpenGL, then you might want to get some image editor and use something similar to this perspective adjustment. Seems like this freeware editor also has similar adjustments available.&lt;/p&gt;&#xA;" OwnerUserId="13357" LastActivityDate="2015-01-14T23:30:36.470" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20032" PostTypeId="1" AcceptedAnswerId="20034" CreationDate="2015-01-15T06:38:20.413" Score="2" ViewCount="3824" Body="&lt;p&gt;As known, we can get a 'phase spectrum' from the DFT of a input signal. Assume, we do a DFT on a given equal interval sampled 50Hz AC signal, the signal is a complete whole cycle, but the start sample point may at any point. And I get the amplitude and phase from the DFT, but what's the reference point of the phase?&lt;/p&gt;&#xA;" OwnerUserId="11588" LastActivityDate="2015-01-15T09:18:57.533" Title="The Phase Information of the DFT" Tags="|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20033" PostTypeId="2" ParentId="20032" CreationDate="2015-01-15T08:30:15.170" Score="1" Body="&lt;p&gt;If you assume that for a given DFT length $N$ your signal is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=A\cos(2\pi n/N+\phi),\quad n=0,1,\ldots,N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. its period equals $N$, then the first DFT coefficient (starting to count from $0$) is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[1]=A\frac{N}{2}e^{j\phi}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-15T08:30:15.170" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20034" PostTypeId="2" ParentId="20032" CreationDate="2015-01-15T08:49:32.973" Score="1" Body="&lt;p&gt;For signals that are strictly periodic an exact integer multiple in the FFT aperture, the phase (atan2(imag_component, real_component)) of the result from the most common implementations of an FFT are with respect to the edge of the window at point 0 (the phase at the time that the first sample, that was fed to the FFT, was taken).  If you know the exact frequency, and the phase at one point in time, you can calculate the phase at any other point in time (or at nearby points in time if there is noise or other frequency estimator errors), as needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for signals that are not integer periodic in the FFT length, there will be a circular discontinuity between the last point and point 0.  Since the FFT is circular (the only possibility with circular basis vectors), the measurement of phase at a point of discontinuity can be non-intuitive.  For sinusoids that are not strict periodic in the FFT length, the sign of the phase also flips between FFT result bins, causing problems with simple linear (or other low order) phase interpolation (e.g. for estimating the phase of a sinusoid that is of a between-bins frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, an fftshift will move the phase measurement reference to the center of the FFT window (point N/2), where there isn't a discontinuity (assuming the input is continuous).  The sign of the phase will no longer keep flipping, allowing easier estimation of interpolated phase.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An fftshift can be done by either rotating the whole input vector, or by flipping the phase (rotating 180 degrees) of every other FFT result bin, and may produce a phase reference point that makes more sense at the center of the FFT aperture or window.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-01-15T09:18:57.533" LastActivityDate="2015-01-15T09:18:57.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20035" PostTypeId="1" AcceptedAnswerId="20039" CreationDate="2015-01-15T09:58:07.833" Score="1" ViewCount="1957" Body="&lt;p&gt;I would like to measure the time delay between two signals. By applying the cross correlation I get the time delay or number of samples by the location of the cross correlation peak, however I am interested to know what peak value itself identifies ? &#xA;I get a large value for the cross correlation peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="9047" LastActivityDate="2015-01-16T10:58:17.993" Title="Cross correlation peak value" Tags="|cross-correlation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20036" PostTypeId="2" ParentId="19996" CreationDate="2015-01-15T11:03:16.810" Score="1" Body="&lt;p&gt;After applying a Hamming window to your data I get very similar autocorrelation values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;R = &#xA;   1.6765e+00&#xA;   1.5828e+00&#xA;   1.3697e+00&#xA;   1.0688e+00&#xA;   7.4186e-01&#xA;   4.6660e-01&#xA;   2.5672e-01&#xA;   1.2121e-01&#xA;   4.9779e-02&#xA;   1.6453e-02&#xA;   3.1701e-03&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can check your LPC filter coefficients (not the reflection coefficients) by computing the matrix-vector product $\mathbf{R}\mathbf{a}$ where $\mathbf{a}$ is the vector of LPC coefficients and $\mathbf{R}$ is a Toeplitz matrix with the autocorrelation values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{R}=\begin{bmatrix}R(0)&amp;amp;R(1)&amp;amp;\ldots &amp;amp;&amp;amp; R(p)\\&#xA;R(1)&amp;amp;R(0)&amp;amp;R(1)&amp;amp;\ldots&amp;amp;R(p-1)\\&#xA;\vdots&amp;amp; &amp;amp; \ddots &amp;amp; &amp;amp;\vdots\\&#xA;R(p) &amp;amp; R(p-1) &amp;amp; \ldots &amp;amp;&amp;amp; R(0)\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This product must result in a vector with the first element being non-zero, and all the other elements must be zero (up to numerical accuracy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the Octave function &lt;code&gt;[lpc,v,k]=levinson(R(1:11));&lt;/code&gt; with the autocorrelation function given above, I get the following LPC filter coefficients:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;lpc =&#xA;&#xA;   1.000000&#xA;  -1.370890&#xA;  -0.386146&#xA;   0.813691&#xA;   0.992372&#xA;  -0.949576&#xA;  -0.642884&#xA;   0.427407&#xA;   0.515102&#xA;  -0.310107&#xA;  -0.039544&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And these are the corresponding reflection coefficients:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;k =&#xA;&#xA;  -0.9440538&#xA;   0.6826730&#xA;   0.2730461&#xA;  -0.1825513&#xA;  -0.4886926&#xA;   0.1882461&#xA;   0.3690086&#xA;  -0.0056205&#xA;  -0.3648883&#xA;  -0.0395440&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So we get very similar values from which you can conclude that your code for computing the reflection coefficients from the autocorrelation function is correct.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-19T11:38:01.773" LastActivityDate="2015-01-19T11:38:01.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20037" PostTypeId="2" ParentId="20024" CreationDate="2015-01-15T13:09:28.303" Score="1" Body="&lt;p&gt;bits/s is data rate of a signal in digital form. &#xA;Bandwidth of a baseband signal refers to its highest frequency.&#xA;Bandwidth of a lowpass channel refers to the frequency that passes with -3dB attenuation through the channel. (with respect to 0dB reference)&#xA;Capacity of a channel refers to maximum rate of information that can be transmitted reliably over a noisy channel with a given bandwidth and SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given transmission channel and a prescribed modulation technique to send those bits over its channel, then each bits/second will also be equivalent to a physical bandwidth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's put solid examples:&#xA;Consider an analog speech signal x(t) first it is lowpass filtered (by an analog RLC network) to 3khz, and then sampled at 8000 samples/second rate at 8-bits/sample resolution by a practical 8-bit ADC. Now you have x[n] signal. This digital signal has 8 bits/sample x 8k sample/second = 64 kbits/second  = 64 kpbs data rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to transmit these bits over a network, will require different bandwidths depending on channel noise and modulation technique employed. The more efficient your modulating scheme, the less physical channel bandwidth you will require. Assuming that, your transmission hertz utilization is 4 bits/hz, then you will require a 16 kHz channel bandwith to transmit this speech signal at 64 kbps data rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take another example as digital video broadcast:&#xA;Now becoming old and obsolete (nevertheless still in use) digital STDV (Standard Definition TV) PAL system data rate is approximately 625 x 720 x 25 x 16 = 180 Mbps of which 165 Mbps is pure video signal. This huge data rate is reduced to fit into TV broadcast channel bandwidth of 6-Mhz. Greatest part of this reduction comes from video compression which might well reduce the data bitrate down below 30 Mbps, further which is channel encoded to fit into 6 Mhz bandwidth. Hence here, appr. 30 Mbps data rate is transmitted over 6 Mhz channel bandwidth. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-01-15T20:14:34.800" LastActivityDate="2015-01-15T20:14:34.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20038" PostTypeId="2" ParentId="20030" CreationDate="2015-01-15T13:12:53.433" Score="1" Body="&lt;p&gt;Assuming you have a set of (windowed) filter coefficients $h[n]$, $n=0,1,\ldots,N-1$, and you want to evaluate the corresponding frequency response at $ M\ge N$ equidistant normalized frequency points&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_k=\frac{k}{2M},\quad k=0,1,\ldots,M-1\tag{1}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;then you need to evaluate the following formula, which is the discrete Fourier transform (DFT):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H[k]=\sum_{n=0}^{N-1}h[n]e^{-j\pi nk /M},\quad k=0,1,\ldots, M-1\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual frequencies in Hz are given by $f_k\cdot f_s$, where $f_s$ is the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (2) is exactly what you get with the Matlab command&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[H,w] = freqz(h,1,M)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_k=$ &lt;code&gt;w(k+1)/(2*pi)&lt;/code&gt; (because Matlab indices start at $1$, not at $0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to evaluate the frequency response at arbitrary, not necessarily equidistant normalized frequencies $f_k$, you need to evaluate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H[f_k]=\sum_{n=0}^{N-1}h[n]e^{-j2\pi nf_k},\quad 0\le f_k\le 0.5\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which for the choice of $f_k$ according to (1) of course reduces to Eq. (2).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-15T15:26:45.770" LastActivityDate="2015-01-15T15:26:45.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20039" PostTypeId="2" ParentId="20035" CreationDate="2015-01-15T14:58:56.437" Score="1" Body="&lt;p&gt;It's the correlation coefficient that you get for maximum matching, which is the squared Euclidean 2 norm of the signal $s(t)$, ie. $||s||_2^2$; when you note down the crosscorrelation in terms of integrals, you'll quickly notice that, if you use both signals for correlation, the value for $\tau=0$ is the same as the energy in the signal.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-01-15T14:58:56.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20040" PostTypeId="1" CreationDate="2015-01-15T15:03:22.677" Score="1" ViewCount="256" Body="&lt;p&gt;I'm trying to implement the VAD algorithm in this paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ms12.voip.edu.tw/~paul/Papper/Steganography/iLBC/(VAD)Real-Time_VAD_Algorithm.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ms12.voip.edu.tw/~paul/Papper/Steganography/iLBC/(VAD)Real-Time_VAD_Algorithm.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm polling a microphone on an Android phone, and getting short[]'s which I want to perform operations on.  The audio data is 16bit PCM data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've gotten the basics of the algorithm done, but there are two issues I don't really understand yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)  Step 3-1- of the above algorithm says to &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;compute frame energy&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not entirely sure what this means.  Should I take the PCM data and convert it to Db's? Should I generate this off of the magnitude values derived from an FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) In section 2 (1) of the paper, There is an equation for Spectral Flatness given:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SPM = 10log10(Gm/Am)  or Spectral Flatness Measure = 10*Log10(GeometricMean/ArithmeticMean)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is a brief description underneath which reads:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Where Am and Gm are the geometric means of speech spectrum&#xA;  respectively&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I understand what the general terms of this equation are, however I don't understand what I should be summing to generate the &lt;code&gt;Gm&lt;/code&gt; and &lt;code&gt;Am&lt;/code&gt; terms.  At first I thought it was the energy values computed in part 1) of my question, however rereading it seems to instead relate to the energy present only in the speech spectrum portion of a given frame.  If thats the case what range should I use and how do I generate the value to sum/multiply?&lt;/p&gt;&#xA;" OwnerUserId="13390" LastEditorUserId="13390" LastEditDate="2015-01-15T15:08:49.923" LastActivityDate="2015-01-16T10:14:05.860" Title="Energy and SpectralFlatnessMeasure taken for PCM audio VoiceActitivyDetection" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20041" PostTypeId="2" ParentId="20024" CreationDate="2015-01-15T16:37:18.270" Score="0" Body="&lt;p&gt;Bandwidth in the sense of Hz of radio channel or spectral frequency width does not take into account the signal-to-noise ratio.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bits per second that can be reliably sent using a given frequency channel width does take into account the channel noise and signal power, and thus can be quite different (nearly zero BPS in high noise, or much higher bits/second than the Hz frequency width in near zero noise,  relative to signal power, given a fancy enough modulation scheme).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wider channels in Hz at the same S/N can usually carry a greater BPS of information, given suitable modulation schemes.  But different S/N ratios or the use of different modulation schemes can kill that relationship.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-01-15T17:08:00.553" LastActivityDate="2015-01-15T17:08:00.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20042" PostTypeId="1" AcceptedAnswerId="20082" CreationDate="2015-01-15T18:12:51.090" Score="0" ViewCount="815" Body="&lt;p&gt;I'm doing vehicles tracking project. The video is a one-way, no vehicles occlusion.&#xA;After doing background subtraction, erosion and dilation, I get bounding box objects for each frame, and I can find $centroid(c_x,c_y)$ from that.&#xA;So, the next thing I want to do is blobs tracking. Here is what I'm thinking on how to do the blobs tracking:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;At first frame, store all (cx,cy,id)&lt;/li&gt;&#xA;&lt;li&gt;Next frame, calculate distance each new (cx,cy) with each of old (cx,cy)&lt;/li&gt;&#xA;&lt;li&gt;If &lt;code&gt;distance &amp;lt; threshold&lt;/code&gt;, update the old (cx,cy) which qualify the formula&lt;/li&gt;&#xA;&lt;li&gt;If &lt;code&gt;distance &amp;gt; threshold&lt;/code&gt;, check if the cx,cy is &lt;code&gt;near the entry coordinate&lt;/code&gt; (e.g. around x,y=0-640,0-40), if &lt;code&gt;yes&lt;/code&gt; store new (cx,cy).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is it right and possible to apply to tracking?  &lt;/p&gt;&#xA;" OwnerUserId="12035" LastEditorUserId="7338" LastEditDate="2017-01-05T22:48:18.293" LastActivityDate="2017-01-05T22:48:18.293" Title="Is my algorithm about blob tracking for vehicle following correct?" Tags="|image-processing|computer-vision|algorithms|tracking|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20043" PostTypeId="1" CreationDate="2015-01-15T19:11:21.963" Score="1" ViewCount="319" Body="&lt;p&gt;I was reading through the Ambiguity function, and I was wondering if it's possible to calculate analytically (or numerically) the ambiguity function of a sum of sine waves. In case of a single sine wave the envelope is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Rectangular_function&quot; rel=&quot;nofollow&quot;&gt;rect()&lt;/a&gt;, hence the ambiguity function is a $sinc()$ with variables the delay time and the Doppler frequency. &lt;a href=&quot;http://postimg.org/image/gqvdryc6l/&quot; rel=&quot;nofollow&quot;&gt;Here's&lt;/a&gt;  the respective 3D plot. Is it possible to perform a similar reasoning for multiple sines?&lt;/p&gt;&#xA;" OwnerUserId="13391" LastEditorUserId="7092" LastEditDate="2015-01-15T20:18:16.557" LastActivityDate="2017-06-04T22:27:54.173" Title="Ambiguity function of multiple sines" Tags="|autocorrelation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20045" PostTypeId="1" CreationDate="2015-01-15T20:00:58.193" Score="1" ViewCount="80" Body="&lt;p&gt;Hi there I'm trying to measure time delay of one percussive event recorded by two contact mikes on a glass surface. I decided to check the cross correlation (via FFT) and detect the index of the max in the function. The method is really jittery as the medium affects the transfer function of the signal. I wonder if there is a better method than cross correlation or some signal cleaning that can help before the calculation, or in the cross-correlation function. Also there might be a way to reconstruct the distortion transfer through the medium (as in phase cancellation)..any help?&lt;/p&gt;&#xA;" OwnerUserId="13395" LastActivityDate="2015-01-15T20:00:58.193" Title="improve delay detection between two signals" Tags="|correlation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20046" PostTypeId="1" AcceptedAnswerId="20053" CreationDate="2015-01-15T20:03:44.830" Score="0" ViewCount="98" Body="&lt;p&gt;I would like to implement the example code from SigLib's example &quot;fsk.c&quot;.&#xA;The defines are below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;#define SAMPLE_LENGTH                   ((SLArrayIndex_t)512)&#xA;&#xA;#define NUMBER_OF_LOOPS                 4L&#xA;&#xA;#define SAMPLE_RATE                     9600.0&#xA;&#xA;#define BAUD_RATE                       1200.0&#xA;/* Number of samples per symbol */&#xA;&#xA;#define SYMBOL_LENGTH                   ((SLArrayIndex_t)(SAMPLE_RATE / BAUD_RATE)) &#xA;&#xA;#define MAX_RX_STRING_LENGTH            ((SLArrayIndex_t)80)   &#xA;/* Frequency of sine wave in table */&#xA;&#xA;#define CARRIER_TABLE_FREQ              ((SLData_t)100.0)       &#xA;/* Number of samples in each of cos and sine table */&#xA;&#xA;#define CARRIER_SINE_TABLE_SIZE  ((SLArrayIndex_t)(SAMPLE_RATE / CARRIER_TABLE_FREQ))     &#xA;/* Must be an integer number of cycles */&#xA;/* Rx Filter length */&#xA;&#xA;#define RX_FILTER_LENGTH    ((SLArrayIndex_t)((2 * SYMBOL_LENGTH) + 1)) &#xA;/* Low carrier frequency */&#xA;&#xA;#define FREQ_1300_HZ                    1300.0&#xA;/* High carrier frequency */&#xA;&#xA;#define FREQ_2100_HZ                    2100.0&#xA;/* Carrier frequency for '0' */&#xA;&#xA;#define CARRIER_FREQ_ZERO               FREQ_2100_HZ&#xA;/* Carrier frequency for '1' */&#xA;&#xA;#define CARRIER_FREQ_ONE                FREQ_1300_HZ&#xA;/* Bandwidth of detection filter */&#xA;&#xA;#define FILTER_BANDWIDTH                400.0&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The initialization call to the function is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;`SIF_FskModulate (pCarrierTable, (CARRIER_TABLE_FREQ / SAMPLE_RATE), CARRIER_SINE_TABLE_SIZE);`&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the code, the second parameter: &lt;code&gt;(CARRIER_TABLE_FREQ / SAMPLE_RATE)&lt;/code&gt; is commented with:&#xA;&lt;code&gt;/* Carrier frequency */&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This number works out to a fractional amount - 100.0/9600 = small. How is this used? What would the FSK carrier be set to, or is that determined by the rate at which you load the pData array into the DAC? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone clarify what that means in terms of using this code? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="10326" LastEditorUserId="4298" LastEditDate="2015-01-16T08:00:48.800" LastActivityDate="2020-10-26T22:27:27.633" Title="SigLib FSk Function: SDA_FskModulate" Tags="|fsk|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20047" PostTypeId="1" AcceptedAnswerId="20051" CreationDate="2015-01-15T20:15:09.963" Score="3" ViewCount="2081" Body="&lt;p&gt;What would a straight-forward way to convert an audio payload (PCM 16bit) from 6 kHz to 8kHz? I understand that this is an interpolation problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I fear that a linear interpolation would introduce too much noise. If so, what would be a better interpolation? I was looking at &lt;a href=&quot;http://en.wikipedia.org/wiki/Lanczos_resampling&quot; rel=&quot;nofollow&quot;&gt;Lanczos resampling&lt;/a&gt; but I've seen it used in image scaling only and not sure it's worth it for audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Java.  I've found the &lt;a href=&quot;https://github.com/hutm/JSSRC&quot; rel=&quot;nofollow&quot;&gt;JSSRC library&lt;/a&gt; butI would have prefer something more lightweight. Beside, I'm not sure this is really necessary for low-frequency audio (which happens to be decoded from ADPCM).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, I'm not interested in creating a WAV having a 6 kHz frequency header, I really want to resample.&lt;/p&gt;&#xA;" OwnerUserId="13397" LastActivityDate="2015-01-16T02:48:23.070" Title="Upsampling PCM audio: from 6 kHz to 8kHz" Tags="|audio|java|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20048" PostTypeId="2" ParentId="20043" CreationDate="2015-01-15T20:36:54.587" Score="1" Body="&lt;p&gt;Sum of sines isn't a concrete waveform, there is no general form of its ambiguity function. But for any given sum of sines you can calculate this function by evaluating cross correlation for various time and Doppler deviations. Though one rule exists, if the number of sinewaves in composition grows, the ambiguity function will become narrower in both frequency and time dimensions, since such a signal will be more and more noise like. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since autocorrelation isn't linear function of some signal $s$ (its quadratic as you know cause it is sum of multiplications of $s$ and its shifted copy), so you can't express autocorrelation and more generally ambiguity function of sines composition as a sum of their autocorrelations (or amb. func-s.). Actually it is the sum of entering sines' autocorrelation functions and all possible entering sines' cross correlation functions. It could be something huge. So the most general way is to compute of such a function for given sines sum directly with knowing formula of autocorrelation.      &lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2015-01-15T20:55:40.060" LastActivityDate="2015-01-15T20:55:40.060" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20049" PostTypeId="2" ParentId="20047" CreationDate="2015-01-15T20:47:34.153" Score="2" Body="&lt;p&gt;If processing cost is not a problem, you may use the following algorithm for sample rate converting your data from 6 khz to 8 khz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- expand your signal x[n] by 8, producing xe[n] (insert 7 zeros after every sample of x[n])&lt;br&gt;&#xA;2- design a low pass filter hlpf[n] with a gain of 8 and cutoff frequency pi/8&lt;br&gt;&#xA;3- process the expanded signal with this lowpass filter = xef[n]&lt;br&gt;&#xA;4- compress output of the filter by 6 via selecting every 6th sample: y[n]=xef[6n]&lt;br&gt;&#xA;(NOTE: You can also do this with 4:3 upsample and down sample, with a new filter,  which would require less processing cost)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lowpass filter must be sharp enough to ensure proper anti-aliazing. If this is too much overburden for  simple rate conversion then try high order polynomial resampling. That could also be costly however.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-01-15T20:55:22.240" LastActivityDate="2015-01-15T20:55:22.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20050" PostTypeId="1" CreationDate="2015-01-15T22:12:19.613" Score="2" ViewCount="7551" Body="&lt;p&gt;I'm studying DSP, but I have weakness about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was reading this: &lt;a href=&quot;http://www.eetimes.com/document.asp?doc_id=1275556&quot; rel=&quot;nofollow&quot;&gt;http://www.eetimes.com/document.asp?doc_id=1275556&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I don't know how select the Low Pass Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am assuming that this depends on the sampling frequency, But I need explanation &quot;as with clay&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know what is a FIR Low Pass Filter, but I don't know what is the specification for this case (Decimation)..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!!&lt;/p&gt;&#xA;" OwnerUserId="12165" LastActivityDate="2015-03-18T02:36:32.617" Title="Selecting the Low Pass FIR Filter, Decimation, DSP" Tags="|lowpass-filter|decimation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20051" PostTypeId="2" ParentId="20047" CreationDate="2015-01-16T01:31:30.800" Score="2" Body="&lt;p&gt;Using a windowed Sinc interpolation kernel is a very common way to do this kind of sample rate change.  A polyphase table with precalculated coefficients allows this kind of rational interpolation to be done by a simple interleaved set of convolutions.  You can vary the quality of the resampling by choice of the width and shape of the window on the Sinc function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No need to upsample and downsample in two stages of operations.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-01-16T02:48:23.070" LastActivityDate="2015-01-16T02:48:23.070" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20052" PostTypeId="1" CreationDate="2015-01-16T01:48:13.563" Score="3" ViewCount="1525" Body="&lt;p&gt;Can someone find or make a visual illustration of how time domain aliasing cancellation works in lapped transforms such as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Modified_discrete_cosine_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;MDCT&lt;/a&gt;?  I think a graphic would make it a lot easier to understand, and I can't find any.  For instance, &lt;a href=&quot;http://archive.cnmat.berkeley.edu/~alan/MS-html/MSv2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this image&lt;/a&gt; clearly shows how the overlap-add process combines windowed chunks of a signal into the original signal: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oxv3S.gif&quot; alt=&quot;overlap-add combining chunks into a whole&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in MDCT, there is time-aliasing within each chunk?  And somehow overlapping and adding the chunks causes the aliasing to cancel out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MDCT uses the DCT-IV, which inverts polarity outside of one boundary, so I assume it has something to do with that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LX0yU.png&quot; alt=&quot;boundary conditions of different DCT types&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2018-08-21T23:03:29.583" LastActivityDate="2019-04-05T12:54:02.197" Title="Illustration of time domain aliasing cancellation (TDAC, MDCT, lapped transform)" Tags="|stft|aliasing|dct|mdct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20053" PostTypeId="2" ParentId="20046" CreationDate="2015-01-16T05:13:19.480" Score="0" Body="&lt;p&gt;The comment is mistaken.  The carrier frequency is 100 Hz.  The sample rate is 9600 Hz.  The carrier frequency divided by the sample rate is the carrier phase increment (phase change per sample), not the carrier frequency.  The units are radians / $2\pi$ (i.e. the phase increment is normalized from 0 to 1, not 0 to $2\pi$).  That phase increment can be used to index into a sine table to create a sinusoid.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-01-16T05:13:19.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20054" PostTypeId="2" ParentId="20050" CreationDate="2015-01-16T07:16:53.480" Score="1" Body="&lt;p&gt;When you are decimating a signal x(n), to x(an) (a&gt;1),in the frequency domain the spectrum expands. This might lead to aliasing of the adjacent spectral bands.So to avoid it we use a &quot;anti aliasing filter&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now choosing an FIR low pass filter depends on many factors like, order of the filter, attenuation in stop band, range of pass band frequencies, etc..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Till my knowledge, sampling is not at all a point of concern while designing the filter. you only decimate the signal after filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To quote an example, in the base band part of digital communication, at the transmitter side, you upsample the signal and you use a anti imaging filter, to avoid multiple copies of the same spectrum being repeated. where as in the receiver you first filter out the signal and then decimating it for further processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2015-01-16T07:16:53.480" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20055" PostTypeId="2" ParentId="20046" CreationDate="2015-01-16T08:27:12.533" Score="0" Body="&lt;p&gt;Calling this parameter &quot;carrier frequency&quot; is misleading, in the sense that it isn't the carrier frequency of the final FSK signal. The parameter &lt;code&gt;(CARRIER_TABLE_FREQ / SAMPLE_RATE)&lt;/code&gt; is simply the inverse of the number of values in the sine table, and consequently - as correctly pointed out by Jim Clay - it is the phase increment per sample divided by $2\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual carrier frequency of the FSK signal is determined by &lt;code&gt;CARRIER_FREQ_ZERO&lt;/code&gt; and &lt;code&gt;CARRIER_FREQ_ONE&lt;/code&gt;. Usually, the FSK carrier frequency is defined as the average of these two frequencies (i.e. 1700 Hz in this example), with a frequency deviation of $\pm 400$ Hz, dependent on the source bit.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-16T08:27:12.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20056" PostTypeId="2" ParentId="20040" CreationDate="2015-01-16T10:14:05.860" Score="1" Body="&lt;p&gt;The frame energy can be computed in the time domain as well as in the frequency domain. For a frame of $N$ samples, due to &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem#Notation_used_in_engineering_and_physics&quot; rel=&quot;nofollow&quot;&gt;Parseval's theorem&lt;/a&gt;, you get for the frame energy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}|x[n]|^2=\frac{1}{N}\sum_{k=0}^{N-1}|X[k]|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ are the time domain samples, and $X[k]$ are the complex DFT coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectral flatness is commonly computed from the power spectrum, or from the squared magnitudes of the DFT coefficients. I can't open the link to the paper, but unless otherwise stated, I would compute the means using all values $|X[k]|^2$ in the current frame.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-16T10:14:05.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20057" PostTypeId="2" ParentId="20035" CreationDate="2015-01-16T10:58:17.993" Score="0" Body="&lt;p&gt;i dont know if understand well your question,forgive me if I answer something you already knwo...&#xA;The correlation practically between two binary sequences is the number of &quot;agreements&quot;-number of &quot;disagreements&quot;,i a few worlds the number of bits that are matching and those not.&#xA;so when after shifting and shifting and shifting and shifting...you get to the point geting the correlation peak means that there are not any disagreements (mismatching bits) but only agreements (matching bits),hence the two sequences (the one kept steady and the other shifted) are identical (full correlation) .&#xA;That is a qualitative explanation i found on a textbook,(I can try to dig in and find the title if you are interested) that help me understand the basics...&lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2015-01-16T10:58:17.993" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20059" PostTypeId="1" CreationDate="2015-01-16T17:03:50.097" Score="4" ViewCount="2665" Body="&lt;p&gt;Dear Signal Processing readers,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to introduce 'noise' into parts of images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until now, I worked with rectangluar images for a similar purpose and did the following, using (inverse) Fourier transform (2D) with MATLAB: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fft = fft2(image);    % run fourier transform on image&#xA;amplitude = abs(fft); % extract power spectrum&amp;gt;&#xA;newPhase = ( (rand(size(amplitude)) * 2) - 1) * pi;          %generate random phase&#xA;newImage = real(ifft2(amplitude. *  exp(1i * newPhase)));    %use both to generate noised image&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This randomizes the phase all over the image, preserving the power spectrum and should guarantee the same spatial frequency spectra in input and output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do now, is applying this effect to only a part of an image, which is not rectangular (its the &quot;inner&quot; parts of a face and will fit in an ellipse). &#xA;So I want to &quot;cut out&quot; this ellipse from an image, turn it to &quot;phase noise&quot; (with power spectrum/spatial frequencies constant) as above, and but it back into the &quot;hole&quot; I cut out of the source image before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My &quot;prime solution&quot; of course would be that FFT/iFFT could operate on ellipses as well, so I could keep using my method shown above. After some amount of google-ing I am quite pessimistic about that option - is there any hope?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the following traces to possibly promising approaches, but as I am not very familiar with the math behind FFT, I'd appreciate any hint/explanation (why) which of these ideas go into a good direction:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Somehow &quot;stretch&quot; the ellipse to a rectangle shape, apply my method as is, strech the resulting rectangle back to the input ellipse shape. Here I fear that the rectangle/ellipse-transformation might destroy the matched power spectrum. Do you know good way of transforming without loosing this information? (&lt;a href=&quot;http://compgroups.net/comp.lang.idl-pvwave/fft-of-a-non-rectangular-image/1106164&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; led me to this idea)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Two more hints came from &lt;a href=&quot;https://www.physicsforums.com/threads/2d-fourier-transform-on-a-non-rectangular-space.755847/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; post:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Using a 3D-fourier transform, in which (as far as I got it) the 3rd dimension gives information about which part of the image shall be used. Any idea / experience how to implement this?  &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using &quot;Elliptic Discrete Fourier Transform&quot; - but I do not understand what (and how) it does and how it can be implemented.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2130/fft-on-non-rectangular-part-of-image&quot;&gt;In this forum&lt;/a&gt;, someone suggested to a related question some sort of window tapering (which, as far as I got it, is made to &quot;filter&quot; the influence that only comes into the image because the ellipse of interest is on a black background) that I did not understand as well, plus i am not sure if it could help me because it did not sound like that question would require an ellipse as output.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any suggestion!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers. Jan&lt;/p&gt;&#xA;" OwnerUserId="13400" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-05-20T08:29:09.957" Title="Fourier transform possible on non-rectangular part of an image" Tags="|matlab|fourier-transform|noise|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20061" PostTypeId="1" CreationDate="2015-01-16T19:45:43.967" Score="4" ViewCount="12330" Body="&lt;p&gt;I'm trying to get rid of some periodic flicker noise through post-processing of the recorded images. The reason for these artifacts is that the electronic rolling shutter of the camera reads each line sequentially, and this mechanism results in brightness variations in the image, when the picture is taken under fluorescent lighting (due to 50 or 60 Hz AC power frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried calculating the Fourier transform of the image and suppressing the components that might cause flickering. I inspected the magnitude spectrum (as you can see below for an example image) and set the vertical components around the DC component to a very small value (I preserved the DC component). In the end, I managed to eliminate the flicker because I suppressed the flicker frequency, but also the image was sort of deformed since I, probably, also suppressed some other frequencies that contributed to the signal's energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9qmRu.png&quot; alt=&quot;Original image, its magnitude spectrum, and the magnitude spectrum after filtering&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know what would be a better way to detect the flicker frequency and eliminate/suppress only that frequency? In my current implementation, I could be doing something fundamentally wrong, so I would appreciate any guidance and hints. Below, I show the resulting image that I got for the kind of filtering that I explained above. You can also find my Python code below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2iQOc.png&quot; alt=&quot;Input and output images&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cv2&#xA;import numpy as np&#xA;from matplotlib import pyplot as plt&#xA;&#xA;img = cv2.imread('images/flicker2.jpg',0)&#xA;f = np.fft.fft2(img)&#xA;fshift = np.fft.fftshift(f)&#xA;# calculate amplitude spectrum&#xA;mag_spec = 20*np.log(np.abs(fshift))&#xA;&#xA;r = f.shape[0]/2        # number of rows/2&#xA;c = f.shape[1]/2        # number of columns/2   &#xA;p = 3                         &#xA;n = 1                   # to suppress all except for the DC component       &#xA;fshift2 = np.copy(fshift)&#xA;&#xA;# suppress upper part&#xA;fshift2[0:r-n , c-p:c+p] = 0.001&#xA;# suppress lower part&#xA;fshift2[r+n:r+r, c-p:c+p] = 0.001&#xA;# calculate new amplitude spectrum&#xA;mag_spec2 = 20*np.log(np.abs(fshift2))&#xA;inv_fshift = np.fft.ifftshift(fshift2)&#xA;# reconstruct image&#xA;img_recon = np.real(np.fft.ifft2(inv_fshift))&#xA;&#xA;plt.subplot(131),plt.imshow(img, cmap = 'gray')&#xA;plt.title('Input Image'), plt.xticks([]), plt.yticks([])&#xA;plt.subplot(132),plt.imshow(mag_spec, cmap = 'gray')&#xA;plt.title('Magnitude Spectrum'), plt.xticks([]), plt.yticks([])&#xA;plt.subplot(133),plt.imshow(mag_spec2, cmap = 'gray')&#xA;plt.title('Magnitude Spectrum after suppression'), plt.xticks([]), plt.yticks([])&#xA;plt.show()&#xA;&#xA;plt.figure()&#xA;plt.subplot(121),plt.imshow(img, cmap = 'gray')&#xA;plt.title('Input Image'), plt.xticks([]), plt.yticks([])&#xA;plt.subplot(122),plt.imshow(img_recon, cmap = 'gray')&#xA;plt.title('Output Image'), plt.xticks([]), plt.yticks([])&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8751" LastActivityDate="2016-01-12T20:27:08.767" Title="Removing periodic noise from image using Fourier transform" Tags="|image-processing|fourier-transform|frequency-spectrum|python|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20064" PostTypeId="1" AcceptedAnswerId="20068" CreationDate="2015-01-16T23:07:04.917" Score="0" ViewCount="232" Body="&lt;p&gt;A linear phase filter will cause a delay in the output signal of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm not mistaken, a filter with phase equal 0 would cause no delays in the output signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain me why isn't it possibly to generate a 0 phase response filter? I mean, theoretically...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm studying for a test and I can't find the answer in textbooks.&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="4298" LastEditDate="2015-02-18T23:12:10.573" LastActivityDate="2015-02-18T23:12:10.573" Title="In filter design, why isn't it possible to have a frequency response with phase 0?" Tags="|filters|filter-design|phase|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20067" PostTypeId="1" CreationDate="2015-01-17T01:34:46.693" Score="2" ViewCount="1912" Body="&lt;p&gt;Currently, I have two signals, the main components of both signals are 60Hz, but both also have weaker response at 180Hz + small amount of noise. As shown in the photo below, I want to find the phase difference between the 60Hz component of first signal, and the 180Hz component of the second signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the second waveform of the figure, the phase lagg is of the 180Hz signal is 1.39ms, which coresponds to a 90 degree phase shift. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eufSx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering, if I want to implment this phase measurement, could I simply take the fft of two signals, and then find the phase at 60Hz of signal 1, and subtract the phase at 180Hz of signal 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if there is better way to do so?&lt;/p&gt;&#xA;" OwnerUserId="13404" LastEditorUserId="13404" LastEditDate="2015-01-17T01:43:33.360" LastActivityDate="2015-04-17T11:20:39.800" Title="Phase difference between two sinuisoidal signal" Tags="|matlab|fft|phase|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20068" PostTypeId="2" ParentId="20064" CreationDate="2015-01-17T08:25:41.367" Score="3" Body="&lt;p&gt;A zero-phase frequency response is real-valued, and, by a property of the Fourier transform, the corresponding impulse response is symmetric. Since it is symmetric (i.e. it is non-zero for $t&amp;lt;0$) it can't be causal, and consequently, it can't be implemented (without adding delay, which defeats the purpose).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-17T08:25:41.367" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20069" PostTypeId="2" ParentId="20067" CreationDate="2015-01-17T08:44:46.530" Score="1" Body="&lt;p&gt;You can find phase between 2 sines, if you write it as a complex signal where 1st sine is a real part and second one is imaginary. But to do so it's necessary to rescale one component to fit another in its amplitude variation. Or another approach is to normalize both sines in amplitude value. There are some explanations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have signals $s_1(t)$ and $s_2(t)$, which are assumed to be sine waves. Before the measurement of their phase differences, we have to normalize there signals. The normalization process is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s^{norm}_i(t) = \frac {s_i(t)} {1.414 \cdot \mathrm{E}[\mid s_i \mid]}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathrm{E}[\mid s \mid ]$ is mean value of module of $s(t)$. To perform normalization in real time it's necessary to track $\mathrm{E}[\mid s \mid ]$ constantly since the signal $s(t)$ can be non-stationary. Recurrent moving average filter is the case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s^{mean}_i(k) = a \cdot \mid s_i(k) \mid + (1-a) \cdot s^{mean}_i(k-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ is inverse of integration time (or equivalently filter's length $K$) $a = \frac {1} {K}$ and $k$ sample index in discrete time representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we normalize both signals it is possible to estimate phase shift between them as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s(t) = s^{norm}_1(t) + j \cdot s^{norm}_2(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\phi(t) = arg(s(t))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\phi(t) = tan^{-1}(\frac {\Im{s(t)}}{\Re{s(t)}})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's real time implementation good practice is to use CORDIC to calculate the phase instead of $atan$ function.  &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-01-17T08:44:46.530" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20070" PostTypeId="2" ParentId="20064" CreationDate="2015-01-17T09:22:40.443" Score="1" Body="&lt;p&gt;Do you mean a zero phase for one single frequency only?&#xA;Think of the classical bandpass circuit (passive or active), which has zero phase shift at the center frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More than that, there are two typical delay categories: Phase delay and group delay. And the group delay is determined NOT by the actual phase value but by the SLOPE of the phase function (even if the phase is zero).&lt;/p&gt;&#xA;" OwnerUserId="10631" LastActivityDate="2015-01-17T09:22:40.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20072" PostTypeId="1" CreationDate="2015-01-17T10:29:34.390" Score="4" ViewCount="285" Body="&lt;p&gt;I have a theoretical question about optimal similarity metrics for comparing data sets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reading &lt;a href=&quot;http://bmia.bmt.tue.nl/people/BRomeny/Courses/8C080/Image%20registration.pdf&quot; rel=&quot;nofollow&quot;&gt;this linked paper, pp. 488-489&lt;/a&gt; [1], I read the following 2 interesting statements. On page 488:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the ... scenario in which $A$ and $B$ differ only by Gaussian noise, then it can be shown that $\rm SSD$ [Sum of Squares Difference] is the optimum measure&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And on page 489:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the intensities in images $A$ and $B$ are linearly related, then the&#xA;  correlation coefficient $\rm CC$ can be shown to be the ideal similarity&#xA;  measure&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Are there are other conditions under which other similarity metrics [e.g. Mutual Information] can be proven to be optimal, or under which the above 2 metrics ($\rm SSD$ and $\rm CC$) are also optimal? The linked PDF focuses on image registration. I am thinking mostly in terms of image registration/image fusion similarity metrics, but would also be interested in more general similarity between any 2 or more datasets (don't have to be images).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] P. A. Viola, Alignment by maximization of mutual information. Ph.D. thesis, Massachusetts Institute of Technology, 1995. &lt;/p&gt;&#xA;" OwnerUserId="13407" LastEditorUserId="1629" LastEditDate="2016-05-17T13:41:47.453" LastActivityDate="2018-08-06T14:01:32.223" Title="Image registration / fusion optimal similarity metrics" Tags="|image-processing|correlation|information-theory|image-registration|distance-metrics|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20074" PostTypeId="1" CreationDate="2015-01-17T19:03:41.167" Score="3" ViewCount="8073" Body="&lt;p&gt;Can someone help me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal which consist of three frequencies; for example, $f_1=800\,\text{Hz}$, $f_2=1050\,\text{Hz}$, $f_3=1600\,\text{Hz}$. How can i compute the fundamental frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is there a method called &quot;frequency histogram method&quot; which is used to compute fundamental frequency? Can someone explain it to me? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="13355" LastEditorUserId="7338" LastEditDate="2015-01-17T19:38:23.517" LastActivityDate="2017-08-01T06:28:15.317" Title="Fundamental frequency" Tags="|signal-analysis|frequency|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20075" PostTypeId="1" AcceptedAnswerId="20078" CreationDate="2015-01-17T19:04:45.950" Score="0" ViewCount="193" Body="&lt;p&gt;I am reading a book on Laplace transform, and in the section on the convergence of Laplace transform for various signals the following theorem is stated, without any proof :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If a signal's Fourier transform be zero in some frequencies, or have discontinuities, it will not have Laplace transform (like sinc function, or periodic signals)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can not see the proof. For signals with a discontinuous Fourier transform I know that  $\int_{-\infty}^{\infty} |x(t)|dt$ may not converge leading to discontinuities in the Fourier spectra (again, like sinc), but I don't think it will lead to not having a Laplace transform at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the proof for the above statement? (if correct) &lt;/p&gt;&#xA;" OwnerUserId="10292" LastEditorUserId="10292" LastEditDate="2015-01-17T19:08:24.330" LastActivityDate="2015-01-17T23:25:37.753" Title="Do signals with a Fourier transform with discontinuities or zero amplitude (in some frequencies) have Laplace transform?" Tags="|fourier-transform|transform|laplace-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20076" PostTypeId="2" ParentId="20074" CreationDate="2015-01-17T19:27:08.257" Score="2" Body="&lt;p&gt;(Note: answer edited after Matt L.'s comment below; the definition of fundamental frequency given here was wrong).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a sum of sinusoids, the fundamental frequency is the greatest common divisor of all the involved frequencies, assuming it exists. In your example, the fundamental is 50 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're dealing with a signal that is the result of adding several periodic signal together, be careful to verify that the result is periodic too. In theory, if you add two period signals and the ratio of their periods is not rational, then the result is not periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've never heard about the &quot;frequency histogram method&quot;. You can, however, calculate the signal's Fourier series and just pick the harmonic closest to zero as your fundamental.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-01-17T22:20:24.197" LastActivityDate="2015-01-17T22:20:24.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20078" PostTypeId="2" ParentId="20075" CreationDate="2015-01-17T21:29:03.970" Score="2" Body="&lt;p&gt;First of all, it is important to distinguish between the unilateral and the bilateral Laplace transform. For causal signals we can use the unilateral Laplace transform. If for such a signal the Fourier transform exists, then also its Laplace transform exists. This is simply the case because here the Fourier transform is equivalent to the Laplace transform for $s=j\omega$, and if the Fourier integral converges, the Laplace transform must exist with a region of convergence $\Re\{s\}\ge a$, for some real-valued $a\le 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a two-sided signal is considered, we have to use the bilateral Laplace transform. Here the problem is that for $\Re\{s\}&amp;gt;0$ the signal is damped for $t&amp;gt;0$ but amplified for $t&amp;lt;0$ (and vice versa). Consequently, for two-sided signals with a constant envelop (e.g. sinusoids), the Laplace transform does not exist, even if the Fourier transform exists, because the Laplace integral cannot converge for signals with an exponentially increasing envelope. The same is true for all periodic signals (because they are sums of sinusoids). But even for two-sided signals which decay for increasing $|t|$ the bilateral Laplace transform might not exist if they decay too slowly, which is the case for the sinc function (decaying only as $1/t$).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-17T21:29:03.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20079" PostTypeId="2" ParentId="20074" CreationDate="2015-01-17T21:37:56.737" Score="6" Body="&lt;p&gt;A signal which is the sum of sinusoids with different frequencies $f_i$ is only periodic if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i=k_if_0,\quad i=1,2,\ldots$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is satisfied for some $f_0$ and &lt;em&gt;integer&lt;/em&gt; values $k_i$. Or, in other words, the frequencies $f_i$ must be rational multiples of each other. In your example, the signal is periodic but its fundamental frequency is not $f_1=800\,\text{Hz}$ because $f_2\neq k_2f_1$ for integer $k_2$. The fundamental frequency is $f_0=50\,\text{Hz}$, even though this frequency does not explicitly occur in the signal. However, note that its period equals $1/f_0$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-17T21:37:56.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20082" PostTypeId="2" ParentId="20042" CreationDate="2015-01-18T02:06:32.993" Score="0" Body="&lt;p&gt;You might want to consider tracking using MeanShift &amp;amp; Cam Shift:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_video/py_meanshift/py_meanshift.html#meanshift&quot; rel=&quot;nofollow&quot;&gt;http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_video/py_meanshift/py_meanshift.html#meanshift&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12192" LastActivityDate="2015-01-18T02:06:32.993" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20083" PostTypeId="1" CreationDate="2015-01-18T04:05:39.107" Score="1" ViewCount="1195" Body="&lt;p&gt;I tried the following code in MATLAB R2013b&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;clear all;&#xA;VideoFreader=vision.VideoFileReader('video7.mp4','AudioOutputPort',true,'AudioOutputDataType','int16');&#xA;i=1;&#xA;while ~isDone(VideoFreader)&#xA;    [I,Audio]=step(VideoFreader);&#xA;    a(i)=Audio;&#xA;    i=i+1;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are no errors, but warning as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Warning: The AudioOutputPort property is not relevant in this&#xA;configuration of the System object. &#xA;&amp;gt; In C:\Program Files\MATLAB\R2013b\toolbox\matlab\system\+matlab\+system\SystemProp.p&amp;gt;SystemProp.parseInputs at 802&#xA;  In C:\Program Files\MATLAB\R2013b\toolbox\matlab\system\+matlab\+system\SystemProp.p&amp;gt;SystemProp.setProperties at 294&#xA;  In C:\Program Files\MATLAB\R2013b\toolbox\vision\vision\+vision\VideoFileReader.p&amp;gt;VideoFileReader.VideoFileReader at 133 &#xA;Warning: The AudioOutputDataType property is not relevant in this&#xA;configuration of the System object. &#xA;&amp;gt; In C:\Program Files\MATLAB\R2013b\toolbox\matlab\system\+matlab\+system\SystemProp.p&amp;gt;SystemProp.parseInputs at 802&#xA;  In C:\Program Files\MATLAB\R2013b\toolbox\matlab\system\+matlab\+system\SystemProp.p&amp;gt;SystemProp.setProperties at 294&#xA;  In C:\Program Files\MATLAB\R2013b\toolbox\vision\vision\+vision\VideoFileReader.p&amp;gt;VideoFileReader.VideoFileReader at 133  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the Audio samples are of type logical and values are all 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is wrong in this? How do extract audio samples in double or int16 or uint8 type?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me&lt;/p&gt;&#xA;" OwnerUserId="13415" LastEditorUserId="7092" LastEditDate="2015-01-18T05:09:17.457" LastActivityDate="2015-01-18T05:09:17.457" Title="extracting audio and video from video file" Tags="|matlab|computer-vision|matlab-cvst|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20084" PostTypeId="1" CreationDate="2015-01-18T06:05:05.800" Score="4" ViewCount="477" Body="&lt;p&gt;Apologies if the question title is confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got some code below in MATLAB, which identifies squares/rectangles in an image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = imread('image.jpg');&#xA;imgbw = im2bw(image);&#xA;filter = bwareafilt(imagebw, [800 10000]);&#xA;fill = imfill(imgbw,'holes');&#xA;area = bwareaopen(fill,15);&#xA;final = bwlabel(area);&#xA;dets = regionprops(final,'boundingbox');&#xA;figure(1), imagesc(I1); hold on;&#xA;for count = 1 : numel(dets)&#xA;    gg = dets(count).BoundingBox;&#xA;    rectangle('position',gg,'edgecolor','r','linewidth',2);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I keep getting results where I am identifying squares, within another square I have already identified. i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BvIWK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I wanted, was to identify the yellow as one square/rectangle, and leave it at that.  But as you can see, I've identified my rectangle/square, but also identified squares in the middle.  Does anyone know how I can get ignore shapes, that are also inside previously identified squares?&lt;/p&gt;&#xA;" OwnerUserId="13363" LastEditorUserId="53" LastEditDate="2015-01-22T16:35:58.363" LastActivityDate="2017-05-12T11:32:08.003" Title="Avoiding identifying objects within previously identified objects in MATLAB" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20085" PostTypeId="2" ParentId="20084" CreationDate="2015-01-18T12:03:49.053" Score="1" Body="&lt;p&gt;There are two alternatives to this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Adjust your opening parameter so that you end up with a fully connected shape. Say, instead of 15 you can use 25.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can find the areas of all intersecting polygons using e.g. &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/18173-polygon-intersection&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;. If the area of an intersection is higher than a given threshold, discard the polygon. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;After finding overlapping polygons, you could consider averaging the hypothesis so that you end up with a more correct shape pose.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-06-21T19:53:28.363" LastActivityDate="2015-06-21T19:53:28.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20086" PostTypeId="1" AcceptedAnswerId="20268" CreationDate="2015-01-18T13:34:09.060" Score="4" ViewCount="576" Body="&lt;p&gt;I try to understand what &lt;a href=&quot;https://github.com/gimp-plugins-justice/wavelet-denoise/blob/master/src/denoise.c&quot; rel=&quot;nofollow&quot;&gt;following algorithm&lt;/a&gt; from this &lt;a href=&quot;http://registry.gimp.org/node/4235&quot; rel=&quot;nofollow&quot;&gt;gimp plugin&lt;/a&gt; does to denoise an image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; /* Wavelet denoise GIMP plugin&#xA; * &#xA; * wavelet.c&#xA; * Copyright 2008 by Marco Rossini&#xA; * &#xA; * Implements the wavelet denoise code of UFRaw by Udi Fuchs&#xA; * which itself bases on the code by Dave Coffin&#xA; * &#xA; * This program is free software; you can redistribute it and/or modify&#xA; * it under the terms of the GNU General Public License version 2&#xA; * as published by the Free Software Foundation.&#xA; * &#xA; * Instructions:&#xA; * compile with gimptool, eg. 'gimptool-2.0 --install wavelet-denoise.c'&#xA; */&#xA;&#xA;void&#xA;wavelet_denoise (float *fimg[3], unsigned int width,&#xA;         unsigned int height, float threshold, double low, float a,&#xA;         float b)&#xA;{&#xA;  float *temp, thold;&#xA;  unsigned int i, lev, lpass, hpass, size, col, row;&#xA;  double stdev[5];&#xA;  unsigned int samples[5];&#xA;&#xA;  size = width * height;&#xA;&#xA;  /* FIXME: replace by GIMP functions */&#xA;  temp = (float *) malloc (MAX2 (width, height) * sizeof (float));&#xA;&#xA;  hpass = 0;&#xA;  for (lev = 0; lev &amp;lt; 5; lev++)&#xA;    {&#xA;      if (b != 0)&#xA;    gimp_progress_update (a + b * lev / 5.0);&#xA;      lpass = ((lev &amp;amp; 1) + 1);&#xA;      for (row = 0; row &amp;lt; height; row++)&#xA;    {&#xA;      hat_transform (temp, fimg[hpass] + row * width, 1, width, 1 &amp;lt;&amp;lt; lev);&#xA;      for (col = 0; col &amp;lt; width; col++)&#xA;        {&#xA;          fimg[lpass][row * width + col] = temp[col] * 0.25;&#xA;        }&#xA;    }&#xA;      if (b != 0)&#xA;    gimp_progress_update (a + b * (lev + 0.25) / 5.0);&#xA;      for (col = 0; col &amp;lt; width; col++)&#xA;    {&#xA;      hat_transform (temp, fimg[lpass] + col, width, height, 1 &amp;lt;&amp;lt; lev);&#xA;      for (row = 0; row &amp;lt; height; row++)&#xA;        {&#xA;          fimg[lpass][row * width + col] = temp[row] * 0.25;&#xA;        }&#xA;    }&#xA;      if (b != 0)&#xA;    gimp_progress_update (a + b * (lev + 0.5) / 5.0);&#xA;&#xA;      thold =&#xA;    5.0 / (1 &amp;lt;&amp;lt; 6) * exp (-2.6 * sqrt (lev + 1)) * 0.8002 / exp (-2.6);&#xA;&#xA;      /* initialize stdev values for all intensities */&#xA;      stdev[0] = stdev[1] = stdev[2] = stdev[3] = stdev[4] = 0.0;&#xA;      samples[0] = samples[1] = samples[2] = samples[3] = samples[4] = 0;&#xA;&#xA;      /* calculate stdevs for all intensities */&#xA;      for (i = 0; i &amp;lt; size; i++)&#xA;    {&#xA;      fimg[hpass][i] -= fimg[lpass][i];&#xA;      if (fimg[hpass][i] &amp;lt; thold &amp;amp;&amp;amp; fimg[hpass][i] &amp;gt; -thold)&#xA;        {&#xA;          if (fimg[lpass][i] &amp;gt; 0.8) {&#xA;            stdev[4] += fimg[hpass][i] * fimg[hpass][i];&#xA;            samples[4]++;&#xA;          } else if (fimg[lpass][i] &amp;gt; 0.6) {&#xA;            stdev[3] += fimg[hpass][i] * fimg[hpass][i];&#xA;            samples[3]++;&#xA;          } else if (fimg[lpass][i] &amp;gt; 0.4) {&#xA;            stdev[2] += fimg[hpass][i] * fimg[hpass][i];&#xA;            samples[2]++;&#xA;          } else if (fimg[lpass][i] &amp;gt; 0.2) {&#xA;            stdev[1] += fimg[hpass][i] * fimg[hpass][i];&#xA;            samples[1]++;&#xA;          } else {&#xA;            stdev[0] += fimg[hpass][i] * fimg[hpass][i];&#xA;            samples[0]++;&#xA;          }&#xA;        }&#xA;    }&#xA;      stdev[0] = sqrt (stdev[0] / (samples[0] + 1));&#xA;      stdev[1] = sqrt (stdev[1] / (samples[1] + 1));&#xA;      stdev[2] = sqrt (stdev[2] / (samples[2] + 1));&#xA;      stdev[3] = sqrt (stdev[3] / (samples[3] + 1));&#xA;      stdev[4] = sqrt (stdev[4] / (samples[4] + 1));&#xA;&#xA;      if (b != 0)&#xA;    gimp_progress_update (a + b * (lev + 0.75) / 5.0);&#xA;&#xA;      /* do thresholding */&#xA;      for (i = 0; i &amp;lt; size; i++)&#xA;    {&#xA;      if (fimg[lpass][i] &amp;gt; 0.8) {&#xA;        thold = threshold * stdev[4];&#xA;      } else if (fimg[lpass][i] &amp;gt; 0.6) {&#xA;        thold = threshold * stdev[3];&#xA;      } else if (fimg[lpass][i] &amp;gt; 0.4) {&#xA;        thold = threshold * stdev[2];&#xA;      } else if (fimg[lpass][i] &amp;gt; 0.2) {&#xA;        thold = threshold * stdev[1];&#xA;      } else {&#xA;        thold = threshold * stdev[0];&#xA;      }&#xA;&#xA;      if (fimg[hpass][i] &amp;lt; -thold)&#xA;        fimg[hpass][i] += thold - thold * low;&#xA;      else if (fimg[hpass][i] &amp;gt; thold)&#xA;        fimg[hpass][i] -= thold - thold * low;&#xA;      else&#xA;        fimg[hpass][i] *= low;&#xA;&#xA;      if (hpass)&#xA;        fimg[0][i] += fimg[hpass][i];&#xA;    }&#xA;      hpass = lpass;&#xA;    }&#xA;&#xA;  for (i = 0; i &amp;lt; size; i++)&#xA;    fimg[0][i] = fimg[0][i] + fimg[lpass][i];&#xA;&#xA;  /* FIXME: replace by GIMP functions */&#xA;  free (temp);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Code of UFRaw by Udi Fuchs, which itself bases on the code by Dave Coffin&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are wavelets key to do that? How are the pixels calculated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="13323" LastEditorUserId="5662" LastEditDate="2015-01-28T19:58:44.090" LastActivityDate="2015-01-29T08:50:25.423" Title="Denoise images with wavelets" Tags="|wavelet|image-processing|c|denoising|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20087" PostTypeId="2" ParentId="8488" CreationDate="2015-01-18T14:35:28.607" Score="1" Body="&lt;p&gt;If you work with matlab you can do it by working with timeseries.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time  % is your starting vector of time&#xA;&#xA;data % vector of data you want to resample &#xA;&#xA;data_TS = timeseries(data,time); % define the data as a timeseries &#xA;&#xA;new_time = time(0):dt:time(end); % new vector of time with fixed dt=1/fs&#xA;&#xA;data_res = resample(data_TS,new_time); % data resampled at constant fs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2015-01-18T14:35:28.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20088" PostTypeId="1" AcceptedAnswerId="20090" CreationDate="2015-01-18T15:26:29.527" Score="8" ViewCount="5850" Body="&lt;p&gt;I am working on a project. I want to segment a logo from a car and the picture's size is 3648*2432. The logo is selected by the red rectangle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dJEzZ.jpg&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I extracted this area and turn into gray level. The area's size is 249*173. Then, I use histogram equalize to enhance the edge. Finally, I use adaptive canny to find edge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XjJNq.png&quot; alt=&quot;enter image description here&quot;&gt; &#xA;&lt;img src=&quot;https://i.stack.imgur.com/ClNR9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the result is not perfect.&#xA;So, I used median filter to smooth the left picture. The result is as following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jY8DG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I remove the small parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nVSn7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result has been improved, but it is also not good. Besides, I have tried  bilateral filter, mean filter and Gaussian filter, but the result is not good, too. I know that after passing histogram equalize, the noise can be enhance. But, in some case, low contrast, I need to adapt this step to enhance my picture. Is any one who can provide me any different comment? Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="11826" LastEditorUserId="7338" LastEditDate="2017-06-15T15:49:58.187" LastActivityDate="2017-06-15T15:49:58.187" Title="How to remove the noise without destroying the main edge?" Tags="|image-processing|filters|noise|opencv|denoising|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20089" PostTypeId="2" ParentId="20088" CreationDate="2015-01-18T16:36:22.980" Score="3" Body="&lt;p&gt;I would not suggest an equalization as the first step.&#xA;Go with noise reduction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uGqtN.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="8349" LastEditDate="2015-01-18T20:28:04.410" LastActivityDate="2015-01-18T20:28:04.410" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="20090" PostTypeId="2" ParentId="20088" CreationDate="2015-01-18T17:01:12.423" Score="8" Body="&lt;p&gt;Use &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilateral_filter&quot; rel=&quot;noreferrer&quot;&gt;bilateral filter&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Anisotropic_diffusion&quot; rel=&quot;noreferrer&quot;&gt;anisotropic diffusion&lt;/a&gt; first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect of anisotropic diffusion is as the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/23pco.png&quot; alt=&quot;enter image description here&quot;&gt;. The MATLAB code can be found &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/14995-anisotropic-diffusion--perona---malik-&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is its effect on your image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/0eLJj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, &lt;a href=&quot;http://en.wikipedia.org/wiki/Non-local_means&quot; rel=&quot;noreferrer&quot;&gt;non-local means&lt;/a&gt; is a also a good way to get rid of the noise. You might also want to take a look into that. I warn you though, it is slow.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-01-19T10:46:49.160" LastActivityDate="2015-01-19T10:46:49.160" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="20092" PostTypeId="1" AcceptedAnswerId="20097" CreationDate="2015-01-18T21:27:44.580" Score="0" ViewCount="344" Body="&lt;p&gt;I'm trying to understand how FM demodulation works. I read a lot on the internet and as far as I understand, the main process is to extract the phase difference (that is also the output) between a quadrature signal and the input signal, and that use this difference to keep those two signals locked in phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the output signal amplitude depends a lot on the input signal strenght. As I understand, the input of the phase locked loop should be constant in amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides on this article on &lt;a href=&quot;http://en.wikipedia.org/wiki/Radio_receiver_design#Superheterodyne&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt; it's written that FM recivers do not need a AGC, but it's enough to use a &quot;high-gain IF amplifier which is intentionally driven into saturation&quot;. How can this be right? I mean.. If the amplifier is driven into saturation, the input wave will look more like a square wave and all the quadrature equations won't be true anymore! Can anybody explain me this step?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that the input should be constant in amplitute because(I'm thinking about a PLL):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ FM_in(t) = A sin( W_c * t + \phi(t) ) \\&#xA; FM_in(t) * cos(W_c*t) = {A \over 2}(sen(\phi(t)) +  cos(2W_c + \phi(t)) ) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So filtering out the high frequency cosine, I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ DEM_Out(t) = {A \over 2} sen(\phi(t)) \simeq {A \over 2}\phi(t) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so far so good, but to keep in lock the loop I should feed this value to the VCO, and if A doubles(as I understand), the phase shift of the VCO doubles, too so that the loop won't be in lock anymore. I hope I have explained what I mean!&lt;/p&gt;&#xA;" OwnerUserId="12062" LastEditorUserId="12062" LastEditDate="2015-01-19T09:29:33.703" LastActivityDate="2015-01-19T10:31:43.627" Title="FM demodulation amplifier with saturation" Tags="|frequency|demodulation|pll|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20093" PostTypeId="2" ParentId="16146" CreationDate="2015-01-19T00:27:03.813" Score="1" Body="&lt;p&gt;Dictionary learning is usually done on more than one image. So yes, I would normalize and concatenate multiple images together. What I usually do is create 8x8 patches from images and vectorize them so that they represent one column (data-item) from the training set (X in your case).&lt;/p&gt;&#xA;" OwnerUserId="1749" LastActivityDate="2015-01-19T00:27:03.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20094" PostTypeId="2" ParentId="20092" CreationDate="2015-01-19T06:02:15.360" Score="1" Body="&lt;p&gt;The receiver's output does not depend on the input amplitude.  From the point of view of the receiver, the output only depends on the frequency/phase of the input.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An fm signal in an ideal environment has a constant amplitude.  Another way of putting it is that fm modulation has a constant envelope.  Often this is advantageous because it allows the transmit amplifier to run at saturated output and not impact the modulation since amplitude is not varied as opposed to QAM and other non-constant envelope modulation types.  The same should hold true for the receiving side of the equation.  In practice I imagine you'd still need to watch out for overloading the receiver and causing harmonics and other nasties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A write-up on my &lt;a href=&quot;http://davidswiston.blogspot.com/2014/10/pyfmradio-stereo-fm-receiver-for-your-pc.html&quot; rel=&quot;nofollow&quot;&gt;pyFmRadio blog post&lt;/a&gt; illustrates FM's amplitude independence from the modulating audio source.&lt;/p&gt;&#xA;" OwnerUserId="11355" LastEditorUserId="11355" LastEditDate="2015-01-19T06:07:41.480" LastActivityDate="2015-01-19T06:07:41.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20095" PostTypeId="1" AcceptedAnswerId="20096" CreationDate="2015-01-19T07:24:34.647" Score="0" ViewCount="2067" Body="&lt;p&gt;If an All Pass system has poles at $0.8\exp\left(-j \dfrac{\pi}{4}\right)$ and $0.8\exp\left(j \dfrac{\pi}{4}\right)$, There would be $2\pi$ jumps in the phase (principal value) at angular frequency $\omega= \dfrac{\pi}{4}$ and $\omega= \dfrac{7\pi}{4}$, but why would there be $2\pi$ jumps also at $\omega= \dfrac{3\pi}{4}$ and $\omega= \dfrac{5\pi}{4}$ (&lt;em&gt;Figure 5.24 in Oppenheim Schafer and Buck &quot;Discrete Time Signal Processing 2nd Edition&lt;/em&gt;)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that in all pass systems with real coefficient frequency response, a pole at $z= z_1$ would mean a pole at $z=z_1^*$ and zeros at $z=\dfrac{1}{z_1^*}$, $z= \dfrac{1}{z_1}$. With this reasoning a pole at $0.8\exp\left(-j \dfrac{\pi}{4}\right)$ would mean zeros at  $1.25\exp\left(j \dfrac{\pi}{4}\right)$ and $1.25\exp\left(-j \dfrac{\pi}{4}\right)$. But this still does not explain the $2\pi$ jumps in phase at $\dfrac{3\pi}{4}$ and $\dfrac{3\pi}{4}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please Help. Thank you very much in advance.&lt;/p&gt;&#xA;" OwnerUserId="13298" LastEditorUserId="8202" LastEditDate="2015-01-19T08:17:08.357" LastActivityDate="2015-01-19T08:59:52.160" Title="All pass systems- Poles and Zeros" Tags="|filters|discrete-signals|dsp-core|allpass|poles-zeros|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20096" PostTypeId="2" ParentId="20095" CreationDate="2015-01-19T08:20:17.453" Score="1" Body="&lt;p&gt;There are no phase jumps. The discontinuities in the phase plot result from the computation of the principal value of the phase, which requires the phase to be in the range $[-\pi,\pi)$. But this is just a convention and has nothing to do with the physical system. Apart from issues with the principal value, the phase of allpass systems does not jump. Instead, the phase always decreases monotonically, because the group delay of an allpass is non-negative (Eq. (5.98) in Oppenheim's book). Also, if you look closely, the first &quot;jump&quot; is actually not at $\omega=\pi/4$ but a bit before, so it is not at all related to the pole angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'Real' phase jumps occur with systems whose frequency response has zeros. At these frequencies the phase jumps by a value of $\pi$. But obviously this can't happen with allpass systems because their frequency response is constant and doesn't have zeros. (Don't get confused: an allpass &lt;em&gt;transfer function&lt;/em&gt; does have zeros in the complex $z$-plane, but not on the unit circle; this is why its frequency response, i.e. its transfer function evaluated on the unit circle, has no zeros).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-19T08:59:52.160" LastActivityDate="2015-01-19T08:59:52.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20097" PostTypeId="2" ParentId="20092" CreationDate="2015-01-19T09:39:35.123" Score="0" Body="&lt;p&gt;I agree with dswiston's answer but I'd like to add a few more details. It is exactly &lt;em&gt;because&lt;/em&gt; the input signal should have a constant amplitude that the signal is hard-limited. The limiter will remove any random amplitude fluctuations due to the channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now take a look at what happens to the phase detector of the PLL, assuming it is realized by a mixer. Let $x(t)$ be the input signal (non-sinusoidal) and let $y(t)$ be the output of the VCO (assumed to be sinusoidal). Assuming a constant input frequency $f_0$ for the moment, the periodic input signal can be written as a Fourier series (assuming zero DC component):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{n=1}^{\infty}c_n\cos(2\pi nf_0t+\phi_n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the VCO output $y(t)=\cos(2\pi f_0t+\theta)$, the output of the mixer is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)y(t)=\frac12 c_1\cos(\phi_1-\theta)+\frac12c_1\cos(4\pi f_0t+\phi_1+\theta)+\\+&#xA;\frac12\sum_{n=2}^{\infty}c_n\left[\cos(2\pi (n-1)f_0t+\phi_n-\theta)+\cos(2\pi(n+1)f_0t+\phi_n+\theta)\right]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in Eq. (1) all terms apart from the first one (which is used to control the VCO) are passband signals at frequencies that are multiples of $f_0$, so they can be easily filtered out. Remember that even if $x(t)$ were a pure sinusoid you would get the second term in (1) at $2f_0$ (right before the sum), which would also need to be filtered out. I hope from this it is clear that limiting of the input signal is no issue for the PLL, it even improves performance because it removes amplitude fluctuations.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-19T10:31:43.627" LastActivityDate="2015-01-19T10:31:43.627" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="20100" PostTypeId="1" AcceptedAnswerId="20104" CreationDate="2015-01-19T15:22:25.820" Score="1" ViewCount="816" Body="&lt;p&gt;The game Rocksmith and some polyphonic guitar tuners (like the &lt;a href=&quot;http://www.tcelectronic.com/polytune-2/&quot; rel=&quot;nofollow&quot;&gt;PolyTune&lt;/a&gt;) are able to recognize, at least to some extent, multiple fundamental frequencies in single-source audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are some methods for multiple fundamental frequency detection, like MUSIC and ESPRIT, but is it likely that these products implement them or leverage several assumptions (such as: audio is from a guitar, audio is from a single source) about the application domain to make a simpler method work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second case, which simpler methods are likely to be used? Simple peak-picking on a spectrum, with domain-specific heuristics? Or something more complex?&lt;/p&gt;&#xA;" OwnerUserId="13433" LastActivityDate="2015-01-19T18:58:55.840" Title="What DSP method are consumer products like the game Rocksmith and guitar polyphonic tuners likely to use for multiple f0 detection?" Tags="|pitch|peak-detection|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20101" PostTypeId="1" AcceptedAnswerId="37497" CreationDate="2015-01-19T15:46:10.427" Score="1" ViewCount="1748" Body="&lt;p&gt;Does anyone know what algorithm is implemented in the Matlab function &lt;code&gt;resample&lt;/code&gt; for &lt;strong&gt;timeseries&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had a look on the manual but it just gives the instruction to use it: &lt;a href=&quot;http://it.mathworks.com/help/matlab/ref/resampletscollection.html&quot; rel=&quot;nofollow&quot;&gt;http://it.mathworks.com/help/matlab/ref/resampletscollection.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the syntax is different from the one used for the usual &lt;code&gt;resample&lt;/code&gt; (&lt;a href=&quot;http://it.mathworks.com/help/ident/ref/resample.html&quot; rel=&quot;nofollow&quot;&gt;http://it.mathworks.com/help/ident/ref/resample.html&lt;/a&gt;) I assumed is not the same algorithm. Am I right?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2017-02-08T12:02:08.383" Title="Algorithm implemented in the timeseries\resample function of Matlab" Tags="|matlab|resampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20102" PostTypeId="2" ParentId="20101" CreationDate="2015-01-19T16:49:23.153" Score="0" Body="&lt;p&gt;See &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/timeseries.setinterpmethod.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/matlab/ref/timeseries.setinterpmethod.html&lt;/a&gt; &#xA;Seems to a choice between a few fairly simple interpolation schemes. The standard resample() uses a polyphase filter interpolation which is much better for most applications.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-01-19T16:49:23.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20103" PostTypeId="1" CreationDate="2015-01-19T17:31:37.627" Score="1" ViewCount="282" Body="&lt;p&gt;I need to create a sound source locator using three microphones. I plan to start off by connecting three microphones to my windows PC, and then taking input from them using matlab to monitor their individual microphone outputs in real-time. How do I go about this? Can I just take a usb hub and connect three usb-microphones to the hub. Will this work? Does the sound card put in any constraints here? If not usb microphones, how else can I go about this? Can I use regular microphones with a mixer or something of the like?&lt;/p&gt;&#xA;" OwnerUserId="13435" LastActivityDate="2015-01-19T17:31:37.627" Title="Sound source locator using multiple microphones — How to?" Tags="|matlab|" AnswerCount="0" CommentCount="4" ClosedDate="2015-01-19T17:37:24.867" ContentLicense="CC BY-SA 3.0" />
  <row Id="20104" PostTypeId="2" ParentId="20100" CreationDate="2015-01-19T18:58:55.840" Score="4" Body="&lt;p&gt;Check out chapter 1.3 of this &lt;a href=&quot;http://articles.ircam.fr/textes/Yeh08a/index.pdf&quot; rel=&quot;nofollow&quot;&gt;IRCAM paper&lt;/a&gt; on multi-F0 estimation. It discusses the difficulties in extracting multiple F0s from a recording, including the handling of overlapping partials, transients, and reverberation, as well as the modeling of domain-specific sources with varied spectral properties.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-01-19T18:58:55.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20105" PostTypeId="1" CreationDate="2015-01-19T19:53:59.230" Score="2" ViewCount="421" Body="&lt;p&gt;In the context of a microcontroller, I have much less memory and far less processing power.  This means, I can only buffer a reasonable window of samples (e.g. 16 or 32), and may not be able to use more advanced curve-fitting options, such as &lt;a href=&quot;http://terpconnect.umd.edu/~toh/spectrum/PeakFindingandMeasurement.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plot shows the raw data along with filtered output.  The filter in this trial is a leaky-integrator, with alpha = 8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YG263.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I reliably detect that first peak (and trough) to enable the accumulation of the area shown?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A cleaner trial of raw data (sampled every 50ms):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;22279&#xA;22279&#xA;22267&#xA;22277&#xA;22277&#xA;22276&#xA;22279&#xA;22275&#xA;22276&#xA;22280&#xA;22279&#xA;22278&#xA;22277&#xA;22277&#xA;22280&#xA;22279&#xA;22280&#xA;22278&#xA;22279&#xA;22280&#xA;22274&#xA;22280&#xA;22274&#xA;22278&#xA;22275&#xA;22276&#xA;22277&#xA;22279&#xA;22276&#xA;22279&#xA;22280&#xA;22286&#xA;22278&#xA;22276&#xA;22280&#xA;22278&#xA;22284&#xA;22279&#xA;22280&#xA;22277&#xA;22279&#xA;22281&#xA;22274&#xA;22281&#xA;22274&#xA;22280&#xA;22283&#xA;22279&#xA;22277&#xA;22278&#xA;22282&#xA;22286&#xA;22276&#xA;22277&#xA;22276&#xA;22278&#xA;22277&#xA;22274&#xA;22281&#xA;22276&#xA;22279&#xA;22277&#xA;22277&#xA;22285&#xA;22273&#xA;22276&#xA;22281&#xA;22277&#xA;22285&#xA;22275&#xA;22283&#xA;22281&#xA;22281&#xA;22280&#xA;22275&#xA;22276&#xA;22272&#xA;22277&#xA;22284&#xA;22273&#xA;22280&#xA;22273&#xA;22278&#xA;22278&#xA;22274&#xA;22277&#xA;22272&#xA;22276&#xA;22282&#xA;22272&#xA;22273&#xA;22282&#xA;22280&#xA;22278&#xA;22280&#xA;22282&#xA;22283&#xA;22272&#xA;22273&#xA;22275&#xA;22281&#xA;22280&#xA;22278&#xA;22282&#xA;22282&#xA;22281&#xA;22278&#xA;22284&#xA;22280&#xA;22276&#xA;22280&#xA;22280&#xA;22280&#xA;22273&#xA;22274&#xA;22281&#xA;22279&#xA;22273&#xA;22280&#xA;22282&#xA;22279&#xA;22281&#xA;22282&#xA;22276&#xA;22277&#xA;22282&#xA;22280&#xA;22278&#xA;22278&#xA;22280&#xA;22277&#xA;22271&#xA;22279&#xA;22282&#xA;22282&#xA;22276&#xA;22275&#xA;22280&#xA;22272&#xA;22271&#xA;22281&#xA;22279&#xA;22283&#xA;22280&#xA;22280&#xA;22274&#xA;22277&#xA;22278&#xA;22282&#xA;22283&#xA;22274&#xA;22272&#xA;22275&#xA;22278&#xA;22280&#xA;22278&#xA;22278&#xA;22271&#xA;22279&#xA;22283&#xA;22281&#xA;22277&#xA;22282&#xA;22277&#xA;22275&#xA;22277&#xA;22277&#xA;22280&#xA;22281&#xA;22282&#xA;22282&#xA;22280&#xA;22280&#xA;22282&#xA;22279&#xA;22278&#xA;22279&#xA;22277&#xA;22283&#xA;22280&#xA;22279&#xA;22273&#xA;22278&#xA;22282&#xA;22279&#xA;22276&#xA;22279&#xA;22280&#xA;22275&#xA;22281&#xA;22279&#xA;22282&#xA;22283&#xA;22281&#xA;22278&#xA;22277&#xA;22282&#xA;22279&#xA;22281&#xA;22280&#xA;22281&#xA;22273&#xA;22280&#xA;22273&#xA;22277&#xA;22282&#xA;22292&#xA;22297&#xA;22314&#xA;22323&#xA;22334&#xA;22339&#xA;22332&#xA;22328&#xA;22321&#xA;22309&#xA;22305&#xA;22299&#xA;22299&#xA;22292&#xA;22290&#xA;22288&#xA;22278&#xA;22283&#xA;22277&#xA;22276&#xA;22272&#xA;22268&#xA;22264&#xA;22262&#xA;22259&#xA;22256&#xA;22249&#xA;22247&#xA;22246&#xA;22242&#xA;22236&#xA;22240&#xA;22239&#xA;22232&#xA;22230&#xA;22230&#xA;22226&#xA;22217&#xA;22218&#xA;22211&#xA;22216&#xA;22212&#xA;22210&#xA;22211&#xA;22209&#xA;22208&#xA;22201&#xA;22202&#xA;22195&#xA;22199&#xA;22191&#xA;22195&#xA;22195&#xA;22195&#xA;22191&#xA;22184&#xA;22183&#xA;22179&#xA;22172&#xA;22183&#xA;22183&#xA;22172&#xA;22180&#xA;22174&#xA;22176&#xA;22178&#xA;22177&#xA;22176&#xA;22177&#xA;22167&#xA;22172&#xA;22174&#xA;22167&#xA;22164&#xA;22169&#xA;22163&#xA;22164&#xA;22171&#xA;22164&#xA;22161&#xA;22171&#xA;22161&#xA;22161&#xA;22168&#xA;22164&#xA;22163&#xA;22167&#xA;22164&#xA;22155&#xA;22165&#xA;22159&#xA;22156&#xA;22161&#xA;22157&#xA;22156&#xA;22163&#xA;22160&#xA;22157&#xA;22163&#xA;22162&#xA;22163&#xA;22159&#xA;22162&#xA;22156&#xA;22160&#xA;22161&#xA;22156&#xA;22161&#xA;22154&#xA;22158&#xA;22159&#xA;22162&#xA;22162&#xA;22161&#xA;22158&#xA;22152&#xA;22163&#xA;22154&#xA;22160&#xA;22164&#xA;22156&#xA;22160&#xA;22162&#xA;22160&#xA;22155&#xA;22165&#xA;22157&#xA;22156&#xA;22162&#xA;22162&#xA;22167&#xA;22163&#xA;22162&#xA;22159&#xA;22161&#xA;22158&#xA;22162&#xA;22166&#xA;22158&#xA;22155&#xA;22157&#xA;22162&#xA;22162&#xA;22156&#xA;22160&#xA;22166&#xA;22158&#xA;22166&#xA;22167&#xA;22164&#xA;22165&#xA;22157&#xA;22160&#xA;22166&#xA;22166&#xA;22167&#xA;22165&#xA;22169&#xA;22169&#xA;22167&#xA;22169&#xA;22164&#xA;22167&#xA;22172&#xA;22171&#xA;22170&#xA;22169&#xA;22167&#xA;22171&#xA;22165&#xA;22169&#xA;22173&#xA;22169&#xA;22173&#xA;22175&#xA;22175&#xA;22175&#xA;22171&#xA;22168&#xA;22169&#xA;22175&#xA;22169&#xA;22173&#xA;22176&#xA;22176&#xA;22179&#xA;22176&#xA;22177&#xA;22177&#xA;22181&#xA;22177&#xA;22171&#xA;22181&#xA;22176&#xA;22177&#xA;22174&#xA;22180&#xA;22184&#xA;22179&#xA;22177&#xA;22174&#xA;22181&#xA;22183&#xA;22177&#xA;22181&#xA;22178&#xA;22184&#xA;22187&#xA;22182&#xA;22184&#xA;22184&#xA;22182&#xA;22184&#xA;22185&#xA;22185&#xA;22184&#xA;22187&#xA;22185&#xA;22185&#xA;22185&#xA;22190&#xA;22183&#xA;22192&#xA;22187&#xA;22188&#xA;22189&#xA;22188&#xA;22189&#xA;22189&#xA;22190&#xA;22194&#xA;22190&#xA;22194&#xA;22190&#xA;22192&#xA;22195&#xA;22193&#xA;22192&#xA;22195&#xA;22190&#xA;22192&#xA;22194&#xA;22193&#xA;22197&#xA;22198&#xA;22198&#xA;22194&#xA;22193&#xA;22196&#xA;22196&#xA;22199&#xA;22198&#xA;22199&#xA;22196&#xA;22199&#xA;22200&#xA;22202&#xA;22196&#xA;22196&#xA;22202&#xA;22198&#xA;22200&#xA;22203&#xA;22202&#xA;22204&#xA;22204&#xA;22201&#xA;22201&#xA;22200&#xA;22195&#xA;22206&#xA;22203&#xA;22199&#xA;22209&#xA;22207&#xA;22208&#xA;22207&#xA;22207&#xA;22205&#xA;22211&#xA;22208&#xA;22205&#xA;22207&#xA;22203&#xA;22205&#xA;22208&#xA;22209&#xA;22199&#xA;22209&#xA;22211&#xA;22206&#xA;22208&#xA;22210&#xA;22211&#xA;22210&#xA;22212&#xA;22211&#xA;22210&#xA;22213&#xA;22207&#xA;22213&#xA;22213&#xA;22213&#xA;22209&#xA;22211&#xA;22211&#xA;22215&#xA;22216&#xA;22218&#xA;22215&#xA;22218&#xA;22213&#xA;22217&#xA;22213&#xA;22217&#xA;22215&#xA;22219&#xA;22219&#xA;22215&#xA;22221&#xA;22211&#xA;22217&#xA;22220&#xA;22218&#xA;22221&#xA;22215&#xA;22217&#xA;22217&#xA;22217&#xA;22219&#xA;22218&#xA;22218&#xA;22220&#xA;22219&#xA;22221&#xA;22220&#xA;22220&#xA;22221&#xA;22224&#xA;22220&#xA;22224&#xA;22225&#xA;22224&#xA;22222&#xA;22222&#xA;22222&#xA;22221&#xA;22226&#xA;22220&#xA;22226&#xA;22222&#xA;22220&#xA;22225&#xA;22227&#xA;22224&#xA;22226&#xA;22225&#xA;22224&#xA;22223&#xA;22227&#xA;22227&#xA;22224&#xA;22227&#xA;22226&#xA;22226&#xA;22227&#xA;22227&#xA;22230&#xA;22230&#xA;22230&#xA;22228&#xA;22229&#xA;22228&#xA;22230&#xA;22229&#xA;22226&#xA;22231&#xA;22231&#xA;22228&#xA;22227&#xA;22230&#xA;22230&#xA;22231&#xA;22230&#xA;22230&#xA;22231&#xA;22227&#xA;22227&#xA;22233&#xA;22230&#xA;22231&#xA;22231&#xA;22231&#xA;22231&#xA;22238&#xA;22233&#xA;22234&#xA;22235&#xA;22233&#xA;22232&#xA;22233&#xA;22236&#xA;22233&#xA;22234&#xA;22236&#xA;22237&#xA;22234&#xA;22236&#xA;22237&#xA;22230&#xA;22235&#xA;22240&#xA;22234&#xA;22233&#xA;22239&#xA;22236&#xA;22239&#xA;22240&#xA;22233&#xA;22238&#xA;22234&#xA;22234&#xA;22234&#xA;22235&#xA;22238&#xA;22240&#xA;22236&#xA;22240&#xA;22237&#xA;22236&#xA;22236&#xA;22235&#xA;22241&#xA;22239&#xA;22234&#xA;22244&#xA;22237&#xA;22241&#xA;22242&#xA;22242&#xA;22240&#xA;22242&#xA;22242&#xA;22240&#xA;22239&#xA;22240&#xA;22243&#xA;22242&#xA;22240&#xA;22234&#xA;22238&#xA;22242&#xA;22240&#xA;22244&#xA;22241&#xA;22242&#xA;22242&#xA;22242&#xA;22241&#xA;22242&#xA;22241&#xA;22245&#xA;22242&#xA;22247&#xA;22244&#xA;22243&#xA;22242&#xA;22245&#xA;22246&#xA;22245&#xA;22238&#xA;22245&#xA;22244&#xA;22247&#xA;22246&#xA;22242&#xA;22248&#xA;22245&#xA;22244&#xA;22246&#xA;22246&#xA;22247&#xA;22246&#xA;22247&#xA;22247&#xA;22251&#xA;22247&#xA;22239&#xA;22250&#xA;22241&#xA;22246&#xA;22247&#xA;22249&#xA;22245&#xA;22252&#xA;22245&#xA;22247&#xA;22247&#xA;22248&#xA;22250&#xA;22246&#xA;22251&#xA;22248&#xA;22248&#xA;22245&#xA;22247&#xA;22249&#xA;22249&#xA;22249&#xA;22249&#xA;22245&#xA;22250&#xA;22248&#xA;22253&#xA;22241&#xA;22250&#xA;22251&#xA;22251&#xA;22252&#xA;22245&#xA;22250&#xA;22255&#xA;22252&#xA;22252&#xA;22253&#xA;22249&#xA;22253&#xA;22253&#xA;22251&#xA;22252&#xA;22251&#xA;22251&#xA;22252&#xA;22252&#xA;22251&#xA;22253&#xA;22254&#xA;22252&#xA;22258&#xA;22258&#xA;22249&#xA;22254&#xA;22256&#xA;22252&#xA;22249&#xA;22246&#xA;22255&#xA;22254&#xA;22254&#xA;22251&#xA;22255&#xA;22255&#xA;22252&#xA;22253&#xA;22254&#xA;22255&#xA;22257&#xA;22257&#xA;22254&#xA;22255&#xA;22255&#xA;22253&#xA;22257&#xA;22257&#xA;22253&#xA;22257&#xA;22257&#xA;22257&#xA;22250&#xA;22258&#xA;22254&#xA;22255&#xA;22255&#xA;22257&#xA;22256&#xA;22257&#xA;22252&#xA;22254&#xA;22254&#xA;22253&#xA;22257&#xA;22248&#xA;22260&#xA;22259&#xA;22259&#xA;22257&#xA;22259&#xA;22259&#xA;22259&#xA;22261&#xA;22261&#xA;22260&#xA;22260&#xA;22260&#xA;22260&#xA;22259&#xA;22259&#xA;22260&#xA;22261&#xA;22261&#xA;22261&#xA;22260&#xA;22259&#xA;22258&#xA;22262&#xA;22262&#xA;22263&#xA;22256&#xA;22256&#xA;22261&#xA;22259&#xA;22262&#xA;22259&#xA;22256&#xA;22256&#xA;22255&#xA;22263&#xA;22263&#xA;22264&#xA;22254&#xA;22254&#xA;22257&#xA;22261&#xA;22255&#xA;22262&#xA;22263&#xA;22263&#xA;22263&#xA;22258&#xA;22258&#xA;22259&#xA;22264&#xA;22264&#xA;22265&#xA;22262&#xA;22262&#xA;22261&#xA;22263&#xA;22263&#xA;22260&#xA;22258&#xA;22262&#xA;22256&#xA;22264&#xA;22264&#xA;22264&#xA;22260&#xA;22260&#xA;22264&#xA;22262&#xA;22262&#xA;22265&#xA;22260&#xA;22260&#xA;22259&#xA;22267&#xA;22267&#xA;22263&#xA;22264&#xA;22264&#xA;22264&#xA;22260&#xA;22260&#xA;22261&#xA;22258&#xA;22258&#xA;22267&#xA;22260&#xA;22260&#xA;22263&#xA;22267&#xA;22267&#xA;22259&#xA;22260&#xA;22260&#xA;22266&#xA;22264&#xA;22264&#xA;22259&#xA;22271&#xA;22271&#xA;22262&#xA;22261&#xA;22261&#xA;22268&#xA;22269&#xA;22269&#xA;22258&#xA;22263&#xA;22263&#xA;22262&#xA;22268&#xA;22268&#xA;22269&#xA;22263&#xA;22269&#xA;22269&#xA;22272&#xA;22272&#xA;22265&#xA;22264&#xA;22264&#xA;22268&#xA;22270&#xA;22270&#xA;22266&#xA;22261&#xA;22261&#xA;22265&#xA;22266&#xA;22272&#xA;22272&#xA;22270&#xA;22270&#xA;22263&#xA;22274&#xA;22274&#xA;22262&#xA;22266&#xA;22266&#xA;22271&#xA;22265&#xA;22265&#xA;22265&#xA;22267&#xA;22267&#xA;22269&#xA;22272&#xA;22272&#xA;22272&#xA;22272&#xA;22269&#xA;22268&#xA;22261&#xA;22261&#xA;22266&#xA;22266&#xA;22270&#xA;22271&#xA;22271&#xA;22270&#xA;22271&#xA;22265&#xA;22265&#xA;22271&#xA;22271&#xA;22264&#xA;22270&#xA;22270&#xA;22264&#xA;22272&#xA;22267&#xA;22267&#xA;22272&#xA;22272&#xA;22268&#xA;22271&#xA;22267&#xA;22271&#xA;22272&#xA;22264&#xA;22264&#xA;22269&#xA;22269&#xA;22268&#xA;22271&#xA;22267&#xA;22268&#xA;22270&#xA;22270&#xA;22267&#xA;22275&#xA;22274&#xA;22268&#xA;22275&#xA;22275&#xA;22271&#xA;22275&#xA;22265&#xA;22268&#xA;22274&#xA;22274&#xA;22268&#xA;22277&#xA;22267&#xA;22266&#xA;22275&#xA;22275&#xA;22269&#xA;22276&#xA;22276&#xA;22269&#xA;22276&#xA;22267&#xA;22267&#xA;22276&#xA;22269&#xA;22274&#xA;22273&#xA;22273&#xA;22271&#xA;22277&#xA;22277&#xA;22267&#xA;22274&#xA;22271&#xA;22271&#xA;22277&#xA;22271&#xA;22270&#xA;22280&#xA;22270&#xA;22270&#xA;22274&#xA;22274&#xA;22274&#xA;22276&#xA;22267&#xA;22271&#xA;22280&#xA;22272&#xA;22270&#xA;22275&#xA;22272&#xA;22272&#xA;22275&#xA;22271&#xA;22273&#xA;22278&#xA;22273&#xA;22273&#xA;22271&#xA;22279&#xA;22279&#xA;22270&#xA;22271&#xA;22279&#xA;22279&#xA;22271&#xA;22278&#xA;22278&#xA;22274&#xA;22274&#xA;22281&#xA;22275&#xA;22275&#xA;22273&#xA;22276&#xA;22275&#xA;22278&#xA;22275&#xA;22273&#xA;22274&#xA;22274&#xA;22274&#xA;22271&#xA;22274&#xA;22274&#xA;22271&#xA;22271&#xA;22276&#xA;22268&#xA;22274&#xA;22271&#xA;22271&#xA;22269&#xA;22274&#xA;22273&#xA;22275&#xA;22275&#xA;22271&#xA;22273&#xA;22273&#xA;22281&#xA;22273&#xA;22273&#xA;22273&#xA;22277&#xA;22277&#xA;22277&#xA;22272&#xA;22271&#xA;22271&#xA;22271&#xA;22275&#xA;22275&#xA;22277&#xA;22275&#xA;22277&#xA;22273&#xA;22273&#xA;22279&#xA;22273&#xA;22273&#xA;22272&#xA;22275&#xA;22275&#xA;22274&#xA;22276&#xA;22276&#xA;22277&#xA;22275&#xA;22275&#xA;22273&#xA;22275&#xA;22276&#xA;22276&#xA;22276&#xA;22273&#xA;22273&#xA;22276&#xA;22281&#xA;22281&#xA;22275&#xA;22276&#xA;22276&#xA;22278&#xA;22275&#xA;22275&#xA;22277&#xA;22271&#xA;22271&#xA;22280&#xA;22275&#xA;22275&#xA;22276&#xA;22277&#xA;22277&#xA;22271&#xA;22276&#xA;22276&#xA;22279&#xA;22275&#xA;22275&#xA;22278&#xA;22278&#xA;22278&#xA;22277&#xA;22277&#xA;22277&#xA;22277&#xA;22276&#xA;22276&#xA;22279&#xA;22274&#xA;22274&#xA;22278&#xA;22279&#xA;22279&#xA;22278&#xA;22279&#xA;22279&#xA;22277&#xA;22275&#xA;22275&#xA;22282&#xA;22279&#xA;22279&#xA;22276&#xA;22278&#xA;22278&#xA;22277&#xA;22276&#xA;22276&#xA;22276&#xA;22272&#xA;22276&#xA;22280&#xA;22276&#xA;22276&#xA;22279&#xA;22278&#xA;22280&#xA;22277&#xA;22280&#xA;22277&#xA;22282&#xA;22278&#xA;22268&#xA;22277&#xA;22283&#xA;22281&#xA;22278&#xA;22279&#xA;22279&#xA;22279&#xA;22281&#xA;22275&#xA;22275&#xA;22280&#xA;22277&#xA;22277&#xA;22276&#xA;22281&#xA;22280&#xA;22280&#xA;22277&#xA;22281&#xA;22281&#xA;22279&#xA;22280&#xA;22278&#xA;22282&#xA;22282&#xA;22281&#xA;22282&#xA;22282&#xA;22283&#xA;22280&#xA;22278&#xA;22278&#xA;22282&#xA;22275&#xA;22282&#xA;22280&#xA;22281&#xA;22274&#xA;22280&#xA;22280&#xA;22283&#xA;22279&#xA;22281&#xA;22281&#xA;22280&#xA;22282&#xA;22282&#xA;22274&#xA;22284&#xA;22284&#xA;22279&#xA;22279&#xA;22280&#xA;22284&#xA;22274&#xA;22274&#xA;22274&#xA;22281&#xA;22283&#xA;22274&#xA;22274&#xA;22280&#xA;22282&#xA;22284&#xA;22284&#xA;22277&#xA;22279&#xA;22279&#xA;22280&#xA;22276&#xA;22277&#xA;22285&#xA;22278&#xA;22281&#xA;22281&#xA;22276&#xA;22280&#xA;22280&#xA;22277&#xA;22282&#xA;22282&#xA;22283&#xA;22279&#xA;22277&#xA;22277&#xA;22276&#xA;22278&#xA;22276&#xA;22282&#xA;22282&#xA;22277&#xA;22277&#xA;22284&#xA;22283&#xA;22283&#xA;22283&#xA;22283&#xA;22283&#xA;22284&#xA;22278&#xA;22280&#xA;22279&#xA;22279&#xA;22279&#xA;22275&#xA;22279&#xA;22279&#xA;22284&#xA;22284&#xA;22283&#xA;22284&#xA;22279&#xA;22279&#xA;22285&#xA;22283&#xA;22280&#xA;22278&#xA;22278&#xA;22279&#xA;22280&#xA;22278&#xA;22276&#xA;22282&#xA;22281&#xA;22281&#xA;22276&#xA;22278&#xA;22278&#xA;22278&#xA;22278&#xA;22286&#xA;22286&#xA;22282&#xA;22280&#xA;22278&#xA;22278&#xA;22278&#xA;22278&#xA;22280&#xA;22280&#xA;22286&#xA;22286&#xA;22279&#xA;22279&#xA;22281&#xA;22281&#xA;22279&#xA;22278&#xA;22283&#xA;22281&#xA;22282&#xA;22282&#xA;22280&#xA;22280&#xA;22283&#xA;22280&#xA;22282&#xA;22282&#xA;22283&#xA;22283&#xA;22284&#xA;22284&#xA;22280&#xA;22280&#xA;22277&#xA;22277&#xA;22283&#xA;22283&#xA;22280&#xA;22284&#xA;22284&#xA;22284&#xA;22285&#xA;22285&#xA;22282&#xA;22283&#xA;22283&#xA;22278&#xA;22280&#xA;22280&#xA;22283&#xA;22281&#xA;22284&#xA;22283&#xA;22282&#xA;22282&#xA;22284&#xA;22285&#xA;22286&#xA;22282&#xA;22283&#xA;22284&#xA;22284&#xA;22285&#xA;22285&#xA;22281&#xA;22280&#xA;22281&#xA;22281&#xA;22283&#xA;22285&#xA;22285&#xA;22285&#xA;22282&#xA;22286&#xA;22284&#xA;22280&#xA;22282&#xA;22282&#xA;22281&#xA;22285&#xA;22283&#xA;22283&#xA;22286&#xA;22284&#xA;22284&#xA;22281&#xA;22281&#xA;22287&#xA;22284&#xA;22285&#xA;22284&#xA;22283&#xA;22282&#xA;22282&#xA;22282&#xA;22283&#xA;22284&#xA;22284&#xA;22287&#xA;22285&#xA;22285&#xA;22286&#xA;22286&#xA;22283&#xA;22285&#xA;22285&#xA;22285&#xA;22288&#xA;22284&#xA;22282&#xA;22283&#xA;22282&#xA;22286&#xA;22287&#xA;22285&#xA;22285&#xA;22284&#xA;22283&#xA;22286&#xA;22285&#xA;22285&#xA;22281&#xA;22276&#xA;22286&#xA;22286&#xA;22284&#xA;22285&#xA;22283&#xA;22290&#xA;22290&#xA;22288&#xA;22286&#xA;22285&#xA;22284&#xA;22284&#xA;22285&#xA;22285&#xA;22287&#xA;22285&#xA;22285&#xA;22286&#xA;22288&#xA;22287&#xA;22287&#xA;22285&#xA;22285&#xA;22285&#xA;22289&#xA;22289&#xA;22286&#xA;22286&#xA;22286&#xA;22286&#xA;22288&#xA;22288&#xA;22287&#xA;22286&#xA;22289&#xA;22287&#xA;22285&#xA;22285&#xA;22286&#xA;22286&#xA;22287&#xA;22287&#xA;22287&#xA;22288&#xA;22288&#xA;22281&#xA;22281&#xA;22290&#xA;22288&#xA;22288&#xA;22284&#xA;22283&#xA;22282&#xA;22283&#xA;22283&#xA;22282&#xA;22282&#xA;22288&#xA;22281&#xA;22284&#xA;22284&#xA;22284&#xA;22280&#xA;22281&#xA;22280&#xA;22280&#xA;22283&#xA;22290&#xA;22281&#xA;22281&#xA;22289&#xA;22285&#xA;22280&#xA;22286&#xA;22286&#xA;22284&#xA;22284&#xA;22286&#xA;22283&#xA;22280&#xA;22288&#xA;22287&#xA;22288&#xA;22280&#xA;22280&#xA;22282&#xA;22284&#xA;22284&#xA;22292&#xA;22289&#xA;22284&#xA;22284&#xA;22285&#xA;22286&#xA;22286&#xA;22283&#xA;22290&#xA;22284&#xA;22284&#xA;22283&#xA;22284&#xA;22285&#xA;22284&#xA;22284&#xA;22285&#xA;22283&#xA;22284&#xA;22285&#xA;22286&#xA;22286&#xA;22286&#xA;22286&#xA;22284&#xA;22284&#xA;22287&#xA;22285&#xA;22290&#xA;22283&#xA;22291&#xA;22283&#xA;22287&#xA;22284&#xA;22284&#xA;22285&#xA;22285&#xA;22286&#xA;22286&#xA;22285&#xA;22285&#xA;22285&#xA;22289&#xA;22286&#xA;22284&#xA;22284&#xA;22285&#xA;22283&#xA;22283&#xA;22286&#xA;22286&#xA;22288&#xA;22283&#xA;22283&#xA;22293&#xA;22283&#xA;22284&#xA;22286&#xA;22286&#xA;22285&#xA;22282&#xA;22286&#xA;22286&#xA;22283&#xA;22283&#xA;22285&#xA;22288&#xA;22292&#xA;22285&#xA;22285&#xA;22288&#xA;22288&#xA;22288&#xA;22285&#xA;22288&#xA;22287&#xA;22287&#xA;22288&#xA;22288&#xA;22285&#xA;22284&#xA;22284&#xA;22287&#xA;22288&#xA;22288&#xA;22290&#xA;22287&#xA;22285&#xA;22288&#xA;22286&#xA;22286&#xA;22286&#xA;22288&#xA;22288&#xA;22286&#xA;22286&#xA;22286&#xA;22286&#xA;22289&#xA;22289&#xA;22288&#xA;22286&#xA;22287&#xA;22287&#xA;22291&#xA;22291&#xA;22287&#xA;22289&#xA;22288&#xA;22288&#xA;22288&#xA;22291&#xA;22289&#xA;22285&#xA;22288&#xA;22284&#xA;22284&#xA;22290&#xA;22290&#xA;22288&#xA;22290&#xA;22286&#xA;22288&#xA;22291&#xA;22290&#xA;22286&#xA;22291&#xA;22289&#xA;22292&#xA;22290&#xA;22290&#xA;22286&#xA;22292&#xA;22286&#xA;22291&#xA;22289&#xA;22287&#xA;22292&#xA;22288&#xA;22291&#xA;22289&#xA;22288&#xA;22292&#xA;22294&#xA;22284&#xA;22286&#xA;22290&#xA;22289&#xA;22286&#xA;22290&#xA;22291&#xA;22287&#xA;22294&#xA;22297&#xA;22289&#xA;22289&#xA;22295&#xA;22283&#xA;22283&#xA;22291&#xA;22290&#xA;22290&#xA;22294&#xA;22288&#xA;22291&#xA;22300&#xA;22291&#xA;22288&#xA;22290&#xA;22288&#xA;22285&#xA;22289&#xA;22289&#xA;22284&#xA;22289&#xA;22290&#xA;22290&#xA;22290&#xA;22287&#xA;22284&#xA;22289&#xA;22285&#xA;22285&#xA;22293&#xA;22290&#xA;22287&#xA;22291&#xA;22291&#xA;22292&#xA;22293&#xA;22293&#xA;22287&#xA;22295&#xA;22295&#xA;22284&#xA;22293&#xA;22293&#xA;22289&#xA;22289&#xA;22294&#xA;22288&#xA;22288&#xA;22293&#xA;22285&#xA;22284&#xA;22293&#xA;22287&#xA;22294&#xA;22285&#xA;22285&#xA;22289&#xA;22293&#xA;22284&#xA;22292&#xA;22286&#xA;22288&#xA;22288&#xA;22294&#xA;22287&#xA;22295&#xA;22294&#xA;22284&#xA;22285&#xA;22293&#xA;22294&#xA;22285&#xA;22288&#xA;22291&#xA;22288&#xA;22283&#xA;22288&#xA;22288&#xA;22287&#xA;22295&#xA;22286&#xA;22287&#xA;22285&#xA;22286&#xA;22288&#xA;22292&#xA;22287&#xA;22285&#xA;22289&#xA;22286&#xA;22289&#xA;22287&#xA;22288&#xA;22291&#xA;22285&#xA;22286&#xA;22292&#xA;22287&#xA;22288&#xA;22290&#xA;22285&#xA;22288&#xA;22288&#xA;22290&#xA;22291&#xA;22287&#xA;22285&#xA;22286&#xA;22290&#xA;22287&#xA;22289&#xA;22285&#xA;22291&#xA;22287&#xA;22287&#xA;22289&#xA;22286&#xA;22286&#xA;22285&#xA;22286&#xA;22287&#xA;22290&#xA;22289&#xA;22290&#xA;22288&#xA;22292&#xA;22290&#xA;22288&#xA;22286&#xA;22288&#xA;22290&#xA;22288&#xA;22288&#xA;22289&#xA;22289&#xA;22286&#xA;22283&#xA;22288&#xA;22292&#xA;22292&#xA;22287&#xA;22288&#xA;22288&#xA;22288&#xA;22293&#xA;22291&#xA;22291&#xA;22286&#xA;22290&#xA;22290&#xA;22288&#xA;22288&#xA;22291&#xA;22291&#xA;22291&#xA;22292&#xA;22292&#xA;22294&#xA;22291&#xA;22291&#xA;22293&#xA;22289&#xA;22290&#xA;22294&#xA;22289&#xA;22293&#xA;22294&#xA;22290&#xA;22290&#xA;22291&#xA;22290&#xA;22293&#xA;22293&#xA;22281&#xA;22293&#xA;22289&#xA;22289&#xA;22293&#xA;22291&#xA;22285&#xA;22291&#xA;22292&#xA;22289&#xA;22293&#xA;22292&#xA;22292&#xA;22292&#xA;22293&#xA;22290&#xA;22286&#xA;22291&#xA;22291&#xA;22288&#xA;22293&#xA;22295&#xA;22285&#xA;22291&#xA;22289&#xA;22293&#xA;22286&#xA;22293&#xA;22291&#xA;22287&#xA;22290&#xA;22283&#xA;22291&#xA;22293&#xA;22290&#xA;22290&#xA;22293&#xA;22293&#xA;22294&#xA;22290&#xA;22291&#xA;22290&#xA;22294&#xA;22289&#xA;22294&#xA;22294&#xA;22294&#xA;22292&#xA;22295&#xA;22286&#xA;22289&#xA;22283&#xA;22289&#xA;22291&#xA;22284&#xA;22288&#xA;22288&#xA;22292&#xA;22286&#xA;22288&#xA;22288&#xA;22289&#xA;22294&#xA;22289&#xA;22287&#xA;22286&#xA;22296&#xA;22296&#xA;22286&#xA;22295&#xA;22290&#xA;22290&#xA;22288&#xA;22288&#xA;22288&#xA;22289&#xA;22289&#xA;22289&#xA;22288&#xA;22290&#xA;22287&#xA;22290&#xA;22290&#xA;22288&#xA;22293&#xA;22288&#xA;22296&#xA;22287&#xA;22289&#xA;22288&#xA;22289&#xA;22285&#xA;22292&#xA;22292&#xA;22292&#xA;22289&#xA;22290&#xA;22296&#xA;22288&#xA;22288&#xA;22290&#xA;22292&#xA;22292&#xA;22285&#xA;22289&#xA;22288&#xA;22288&#xA;22289&#xA;22290&#xA;22290&#xA;22291&#xA;22287&#xA;22287&#xA;22290&#xA;22290&#xA;22287&#xA;22289&#xA;22291&#xA;22289&#xA;22295&#xA;22290&#xA;22289&#xA;22290&#xA;22292&#xA;22292&#xA;22289&#xA;22290&#xA;22292&#xA;22289&#xA;22291&#xA;22290&#xA;22294&#xA;22294&#xA;22292&#xA;22292&#xA;22292&#xA;22288&#xA;22289&#xA;22291&#xA;22292&#xA;22292&#xA;22292&#xA;22290&#xA;22291&#xA;22291&#xA;22290&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8116" LastActivityDate="2015-01-19T21:27:29.633" Title="How to detect peaks in a microcontroller?" Tags="|peak-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20106" PostTypeId="1" CreationDate="2015-01-19T21:05:18.743" Score="5" ViewCount="2995" Body="&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an input signal and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is an output signal:&lt;/p&gt;&#xA;&lt;p&gt;I know that the frequency response function (FRF) is defined as the Cross Power of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; divided by the Auto Power of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Logic tells me I should be able to get the same results using FFT of both signals by taking &lt;span class=&quot;math-container&quot;&gt;$\cfrac{\texttt{FFT}(B)}{\texttt{FFT}(A)}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When I do this and compare results between using &lt;span class=&quot;math-container&quot;&gt;$\cfrac{\texttt{cross}(A,B)}{\texttt{auto}(A)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cfrac{\texttt{FFT}(B)}{\texttt{FFT}(A)}$&lt;/span&gt;, I get &lt;em&gt;nearly&lt;/em&gt; the same FRF result... magnitude is the same but the phase is inverted (i.e. the real parts of both calculations are identical, but the imaginary parts are opposite.)&lt;/p&gt;&#xA;&lt;p&gt;Any thoughts on why?&lt;/p&gt;&#xA;" OwnerUserId="13436" LastEditorUserId="63763" LastEditDate="2023-02-09T00:18:57.113" LastActivityDate="2023-03-26T09:22:53.083" Title="Relationship between Frequency Response, FFT, AutoPower, and CrossPower" Tags="|fft|" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20107" PostTypeId="2" ParentId="20105" CreationDate="2015-01-19T21:27:29.633" Score="2" Body="&lt;p&gt;It seems to me, more like a spike detection than a peak. For the simplest spike detector, just get the first difference of the input samples and test for a threshold. Use multiple samples and adjust your test to have some memory (as much as you can) so that noisy results be eliminated and you would get a more robust detection.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-01-19T21:27:29.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20108" PostTypeId="1" AcceptedAnswerId="20109" CreationDate="2015-01-19T22:33:25.363" Score="2" ViewCount="814" Body="&lt;p&gt;Can someone help me with this problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we filter signals with the below pre-emphasis filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]-0.8x[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to calculate the impulse response of the filter (ok easy) and then I have to find the magnitude of Frequency Response (dB) at $F = 2000 Hz$ with $Fs = 16000 Hz$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone tell me the formula? I am confused :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="13437" LastEditorUserId="7092" LastEditDate="2015-01-20T01:20:28.127" LastActivityDate="2015-01-20T01:20:28.127" Title="Magnitude value of filter frequency response" Tags="|frequency|impulse-response|frequency-response|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20109" PostTypeId="2" ParentId="20108" CreationDate="2015-01-19T23:30:56.897" Score="2" Body="&lt;p&gt;Your filter transfer function in the Z-transform domain is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=1-0.8z^{-1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting $z=e^{j\omega} $:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\omega)=1-0.8e^{-j\omega} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing you the sampling frequency and frequency of interest you can calculate the angular frequency: $\omega_0= 2\pi\frac{2000}{16000}=\dfrac{\pi}{4}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\omega_0)=1-0.8e^{-j\dfrac{\pi}{4}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the magnitude:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(j\omega_0)| = \left|1-0.8\dfrac{1-i}{\sqrt{2}}\right|\approx 0.7132 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Converting to decibel scale:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H_{dB}(j\omega_0)|=20\log_{10}0.7132=-2.93\mathrm{dB} $$&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-01-19T23:30:56.897" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20111" PostTypeId="1" AcceptedAnswerId="20114" CreationDate="2015-01-20T03:03:38.590" Score="1" ViewCount="931" Body="&lt;p&gt;I am very new to the concept of computer vision (and image processing), and trying to understand the algorithm used for edge detection.&#xA;One thing I'm currently struggling to figure out is the Laplacian of Gaussian &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gktlx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, how to you determine the value of x and y? I thought the centre of the kernel was the origin $((x,y) = (0,0))$, but it doesn't seems like the right number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if there are any resources that you would recommend to go through, I would really appreciate them. &lt;/p&gt;&#xA;" OwnerUserId="13439" LastEditorUserId="80" LastEditDate="2019-09-20T17:55:40.110" LastActivityDate="2019-09-20T17:55:40.110" Title="Introduction to IP : Laplacian of Gaussian?" Tags="|image-processing|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20113" PostTypeId="1" CreationDate="2015-01-20T05:05:03.817" Score="1" ViewCount="604" Body="&lt;p&gt;This is probably as basic a question as it gets, but still the answer eludes me. I have a function from a library that I can use to both modulate, and demodulate an FSK encoded piece of data. For the sake of simplicity, let's just say it's one byte.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the example provided, it exists in the perfect world of PC memory. The modulate function simply updates the pointer, the receive function takes that and demodulates the buffer. This is on an STM32F4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the real world, I need to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Convert the data value to an ADC value (I know how to do this)&#xA;2 - Output the data at the sampling interval/rate (pretty sure I have this figured out with a bit more testing)&#xA;3 - Output to an amplifier &amp;amp; transmit through antenna (I have this done)&#xA;4 - Receive signal into antenna, amplifier and anti-aliasing LPF (OK, I have this)&#xA;5 - Process incoming signal through ADC at sampling rate - ideally, the same as transmit.&#xA;6 - The data is in a buffer. This is where I am stuck!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The receive amplifier and LPF is continuously processing incoming samples. How do I &quot;look&quot; for the FSK data? How do I know what I am looking for? What would an algorithm be to perform this task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In analog, I would send out a preamble tone burst of a number of cycles such that the receive would use this to buffer data after that. In the world of DSP, I have no clue how this would happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone enlighten me? (Make me clue-ful instead of clue-less?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you...&lt;/p&gt;&#xA;" OwnerUserId="10326" LastActivityDate="2015-01-20T05:05:03.817" Title="Detection of an FSK Signal" Tags="|fsk|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20114" PostTypeId="2" ParentId="20111" CreationDate="2015-01-20T08:58:28.610" Score="1" Body="&lt;p&gt;You are right about the $x$ and $y$ values. The center of the matrix is $(0,0)$ and the corner points are $(\pm 4,\pm 4)$. But they obviously wanted integer values in the matrix, so they simply scaled the LoG function by a factor of $482.75$ (just to get a decent range). Evaluating the function with this scale factor gives you (for the lower right quarter of the total matrix):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;LoG =&#xA;&#xA;  -40.000000  -23.086993    0.294243    5.218347    2.080704&#xA;  -23.086993  -11.762411    3.077873    4.839310    1.745668&#xA;    0.294243    3.077873    5.409023    3.361998    0.998325&#xA;    5.218347    4.839310    3.361998    1.456020    0.365518&#xA;    2.080704    1.745668    0.998325    0.365518    0.081641&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Rounding should give you the final result. However, if you look closely, you'll see that it doesn't (at least not for all $(x,y)$ values). If you check the matrix on &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt;, you'll see that for the same $\sigma$ it is also different. So people make mistakes and they just copy from each other.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-20T08:58:28.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20115" PostTypeId="1" AcceptedAnswerId="20118" CreationDate="2015-01-20T09:16:55.587" Score="1" ViewCount="3329" Body="&lt;p&gt;I'm trying to compute FFT of size (N/2) for sequence of real values of length N. I'm using &lt;a href=&quot;http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM#Head521&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; recipe.&#xA;Here is my code in matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear;&#xA;clc;&#xA;x = [1, 2, 3, 4, 5, 6, 7, 8];&#xA;n = length(x);&#xA;z = [1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j];&#xA;Z = fft(z);&#xA;Fe = (Z + (conj(Z)))/2;&#xA;Fo = (-1j*(Z - (conj(Z))))/2;&#xA;for k = 1 : n/2-1&#xA;     F(k) = Fe(k) + exp(-1j * 2 * pi * ((k-1)/n)) * Fo(k);&#xA;end;&#xA;F(n/2) = 0.5*(Z(1) + conj(Z(1)) + 1i*(Z(1) - conj(Z(1))))&#xA;fft(x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, I get wrong result (at least I think it's wrong). As far as I understand, first four terms of F and &lt;code&gt;fft(x)&lt;/code&gt; should be equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part that confuses me is when I compute &lt;code&gt;Fe&lt;/code&gt; and &lt;code&gt;Fo&lt;/code&gt; I'm using &lt;code&gt;fliplr(conj())&lt;/code&gt; to get &lt;code&gt;Z(N/2) - k)*&lt;/code&gt;, I'm not sure, if it's the proper way to do this.&lt;/p&gt;&#xA;" OwnerUserId="13441" LastEditorUserId="7092" LastEditDate="2015-01-20T13:15:01.137" LastActivityDate="2015-01-20T13:15:01.137" Title="Real valued FFT in Matlab" Tags="|matlab|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20118" PostTypeId="2" ParentId="20115" CreationDate="2015-01-20T11:10:54.293" Score="4" Body="&lt;p&gt;You can do it like this. I think the code speaks for itself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;x = [1, 2, 3, 4, 5, 6, 7, 8];   % some real-valued signal&#xA;n = length(x);                  % must be even!&#xA;n2 = n/2;                       % assume n is even&#xA;z = x(1:2:n)+j*x(2:2:n);        % complex signal of length n/2&#xA;Z = fft(z);&#xA;Ze = .5*( Z + conj([Z(1),Z(n2:-1:2)]) );        % even part&#xA;Zo = -.5*j*( Z - conj([Z(1),Z(n2:-1:2)]) );     % odd part&#xA;X = [Ze,Ze(1)] + exp(-j*2*pi/n*(0:n2)).*[Zo,Zo(1)];  % combine&#xA;X2 = fft(x);&#xA;max(abs(X-X2(1:n2+1)))  % 2.4492e-15&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-20T11:10:54.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20120" PostTypeId="1" AcceptedAnswerId="20122" CreationDate="2015-01-20T14:25:11.473" Score="3" ViewCount="3263" Body="&lt;p&gt;Can the inverse system of a stable system be unstable? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the class of LTI systems, the criteria for stability of a system with impulse response $h(t)$ and systems function $H(s)$ are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$h(t)$ be absolutely integrable. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;or in s-domain:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$H(s)$ have the $j\omega$ axis (or $s=0$) in its convergence region, and do not have any derivatives of impulse in it (which means for rational system functions like $P(s)/Q(s)$ the order of the nominator be less than or equal to the denominator).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I thought that if we consider the following system&#xA;$$H(s)=\frac{s-2}{s^2-1}$$&#xA;with $ROC:s&amp;gt;1$, it is stable, but its inverse $H_i(s)=1/H(s)=\frac{s^2-1}{s-2}$ with $ROC:s&amp;gt;2$ has the first derivative of delta in it and thus is not stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my reasoning correct? and is there any way to answer the question for all of the systems (not only LTI)? &lt;/p&gt;&#xA;" OwnerUserId="10292" LastActivityDate="2015-01-20T20:04:02.660" Title="Can the inverse system of a stable system be unstable?" Tags="|laplace-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20122" PostTypeId="2" ParentId="20120" CreationDate="2015-01-20T16:05:40.467" Score="2" Body="&lt;p&gt;The ROC is determined by a condition on the &lt;em&gt;real part&lt;/em&gt; of $s$, so for the given transfer function $H(s)$ you could define the ROC as $\Re\{s\}&amp;gt;1$, but then the system wouldn't be stable because the ROC does not include the $j\omega$ axis. You could as well have the ROC $-1&amp;lt;\Re\{s\}&amp;lt;1$. In this case the system would be stable but not causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now for your main question: yes, the inverse of a stable system can be unstable. If we consider systems described by rational transfer functions (i.e. lumped elements) then the location of the system's poles determine its stability. The poles of the inverse system are the zeros of the current system, so there's no relation between the stability of a system and the stability of its inverse, because the zeros do not at all influence the system's stability, but they do determine the stability of the inverse system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your example, the inverse system has a pole at $s=2$, and there are two possible ROCs: $\Re\{s\}&amp;gt;2$, which corresponds to a causal but unstable system, and $\Re\{s\}&amp;lt;2$, corresponding to a stable but anti-causal system.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-20T20:04:02.660" LastActivityDate="2015-01-20T20:04:02.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20123" PostTypeId="2" ParentId="19958" CreationDate="2015-01-20T21:35:09.960" Score="1" Body="&lt;p&gt;What you want to do sounds like standard speech recognition. I recommend you check out the Open Source JAVA library from CMU, &lt;a href=&quot;https://github.com/cmusphinx/sphinx4&quot; rel=&quot;nofollow&quot;&gt;Sphinx4&lt;/a&gt;. Run the Transcriber or Dialog demos and you can see it in action doing some basic recognition of digits &amp;amp; simple english commands from a small grammar. Note that many of your algorithms listed above, fit into different parts of a speech recognition system (frontend processing, search manager, acoustic scorer, etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;http://www.cs.cmu.edu/~rsingh/homepage/papers/icassp03-sphinx4_2.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; for a good overview (and to see how all your algorithms above relate)&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-01-20T21:35:09.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20124" PostTypeId="1" AcceptedAnswerId="20125" CreationDate="2015-01-21T02:21:54.253" Score="3" ViewCount="1973" Body="&lt;p&gt;In my understanding, unlike shifting and scaling, image rotation actually rotates the coordinates whereby interpolating the pixels at discrete positions. It is like a projection that discrete values are projected to another plane which are along with the pixel value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, I am wondering whether we could do 2-D image rotation in a matrix multiplication way which directly perform rotation on the pixel matrix of the image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated in advance.&lt;/p&gt;&#xA;" OwnerUserId="12191" LastEditorUserId="128" LastEditDate="2021-01-30T19:24:20.050" LastActivityDate="2021-01-30T19:24:20.050" Title="Is There a Way to Perform a 2D Image Rotation by Matrix Multiplication?" Tags="|computer-vision|image-processing|matrix|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20125" PostTypeId="2" ParentId="20124" CreationDate="2015-01-21T06:04:03.567" Score="0" Body="&lt;p&gt;Let's say you have an $ M \times N $ image.&lt;br&gt;&#xA;If you turn it into a vector in $ {R}^{\left( M N \right)} $ and create a matrix which is $ \left(M  N \right) \times \left( M  N \right) $ by multiplication and rearranging the vector from the multiplication result you can reposition any pixels where ever you want.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being practical, by padding the original image you can create rotation by any angle you want even with interpolation (By summing few pixels into one position).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It all starting with &lt;a href=&quot;http://en.wikipedia.org/wiki/Vectorization_%28mathematics%29&quot; rel=&quot;noreferrer&quot;&gt;vectorization&lt;/a&gt; of the image.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-01-21T06:04:03.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20127" PostTypeId="1" CreationDate="2015-01-21T08:49:32.850" Score="1" ViewCount="98" Body="&lt;p&gt;Suppose I have two signals $f,g$ which are orthogonal in the sense of the usual inner product on $\mathbb R^d$. Then if I'm not mistaken these signals have disjoint spectral support, i.e their fourier transforms have disjoint support. Suppose further that I know the spectral supports aswell. How can I make use of this information in order to sample only one of the signals, i.e, sample so I don't &quot;see&quot; the other at all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trivial solution seems involve filtering out the irrelevant frequencies using an ideal filter, but that's not an option; I am restricted to &quot;physical&quot; solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's fine to assume $f,g$ are well-behaved.&lt;/p&gt;&#xA;" OwnerUserId="13452" LastActivityDate="2015-01-22T12:38:18.837" Title="Sampling orthogonal signals" Tags="|signal-analysis|sampling|continuous-signals|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20128" PostTypeId="1" AcceptedAnswerId="20134" CreationDate="2015-01-21T09:11:57.573" Score="0" ViewCount="316" Body="&lt;p&gt;Hello I'm new on image processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there are a lot of threshold and region growing algorithms to use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I would like to know what is the trick for choosing suitable method for an image ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm trying to extract characters from this image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ENE25.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and most of the methods I've tried didn't really satisfy me. So I thought maybe I am doing it wrong. Here are some samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normal Threshold&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I7s16.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sobel &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KsVxa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adaptive Threshold&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uHcoe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12210" LastActivityDate="2015-01-21T10:44:32.163" Title="How to choose suitable segmentation process for image processing" Tags="|image-segmentation|opencv|thresholding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20129" PostTypeId="1" AcceptedAnswerId="20130" CreationDate="2015-01-21T09:25:22.290" Score="3" ViewCount="463" Body="&lt;p&gt;Currently I hope to use scale space representation to filter one image. Features in one image can be filtered using an Gaussian smooth filter with one optimal sigma. It means different features in one image can be expressed best in different scale under scale space representation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have one image with one tree in it. In the scale space representation, three sigma values are used and they are represented as sigma0, sigma1 and sigma2. The ground is best expressed in the smoothed image with sigma0 because it contains textures mainly. The branches are best expressed in the smoother image with sigma1 and the trunk is with the smoother image with sigma2. If I hope to filter the image, I hope that the filtered pixels for the group is from the smoothed image with sigma0.&#xA;The filtered pixels for the branches are from the smoothed image with sigma1. The filtered pixels for the trunk are from the smoothed image with sigma2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It requires that I need to determine in which smoothed image one pixel is expressed best. Is this idea plausible?&#xA;I am trying to use differece-of-Gaussian of two successive smoothed images to perform the above task. Is there any other way to combine the three smoothed image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use MATLAB to implement the idea. The values of the three sigmas is 1.0, 2.0 and 3.0. The corresponding size of Gaussian kernel is 3, 5 and 7. I use the function fspecial to generate the kernel. Are the parameter reasonable? Please share your experience with the scale space representation to help me. You can provide some links to useful papers.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="128" LastEditDate="2019-10-18T22:16:42.853" LastActivityDate="2021-01-30T19:23:14.467" Title="Use Scale Space Representation to Filter Single Image" Tags="|image-processing|convolution|gaussian|filtering|scale-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20130" PostTypeId="2" ParentId="20129" CreationDate="2015-01-21T09:36:39.347" Score="0" Body="&lt;p&gt;I used factor 5-6 going from the Standard Deviation (Std) of the Gaussian to the Kernel:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;radius = ceil(6 * STD);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Though it means more computation power is required.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="7092" LastEditDate="2021-01-30T19:23:14.467" LastActivityDate="2021-01-30T19:23:14.467" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="20131" PostTypeId="2" ParentId="20127" CreationDate="2015-01-21T09:51:25.587" Score="2" Body="&lt;p&gt;I'm afraid that your premise is wrong. The Fourier transforms of two orthogonal signals do not in general have disjoint support. You know that two signals $u(t)$ and $v(t)$ are orthogonal if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}u(t)v^*(t)dt=\int_{-\infty}^{\infty}U(f)V^*(f)df=0\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $U(f)$ and $V(f)$ are the Fourier transforms of $u(t)$ and $v(t)$, respectively, and $*$ denotes complex conjugation. One possibility for (1) to be true is indeed that the product $U(f)V^*(f)=0$, but this is of course a sufficient condition, not a necessary one.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-22T12:38:18.837" LastActivityDate="2015-01-22T12:38:18.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20132" PostTypeId="1" AcceptedAnswerId="20140" CreationDate="2015-01-21T10:11:55.450" Score="4" ViewCount="4692" Body="&lt;p&gt;&lt;strong&gt;Theory&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose an OFDM transmitter with four subcarriers is implemented using the structure shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PQagG.png&quot; alt=&quot;OFDM transmitter with four subcarriers&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the serial data input rate is 40 bps, each parallel stream will run at 10 bps. Theoretically, the spectrum (assuming BPSK modulation for each subcarrier) of the IFFT output $x$ should look like shown below (the subcarrier carrier frequencies were chosen arbitrarily).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AeFWL.png&quot; alt=&quot;Theoretical BPSK OFDM spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each channel occupies a bandwidth from -10 Hz to +10 Hz around the subcarrier, resulting in a total OFDM null-to-null bandwidth of 50 Hz, as shown in the spectrum above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Simulation results&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the simulated spectrum of the IFFT output $x$ is shown below. Each input bit is represented by one sample (there is no reason to use more samples before the DAC). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aZV2J.png&quot; alt=&quot;Simulated BPSK OFDM spectrum&quot;&gt;&#xA;One difference between the theoretical and simulated spectra is the difference in bandwidth. The theoretical spectrum has a bandwidth of 50 Hz, whereas the simulated spectrum has a bandwidth of 40 Hz. This can be explained by setting all IFFT inputs to zero, except one, and calculating the resulting spectrum. This process can then be repeated for each of the parallel inputs numbered 0 to 3 in the transmitter structure above. The four spectra are shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KqRQ4.png&quot; alt=&quot;Spectra of the four parallel BPSK streams&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, each parallel stream contributes a bandwidth of 20 Hz, spaced at 10 Hz. This corresponds to the theoretical BPSK OFDM spectrum, except that stream 2 is located at 20 Hz which mirrors back to -20 Hz, with the result that the total bandwidth is 40 Hz and not 50 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DAC output&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to transmit the OFDM signal on a carrier, more samples are required per IFFT output value. The DAC should therefore employ a sample-and-hold strategy, of which the simplest is probably just repeating every IFFT output value $K$ times. The spectrum of the sample-and-hold signal $x_r$ with $K=8$ is shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kaMs3.png&quot; alt=&quot;DAC output with $K=8$&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bandwidth has now increased to 80 Hz, which can again be explained by looking at the individual contributions of each of the parallel streams, shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/i7Yiz.png&quot; alt=&quot;DAC output for each stream&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectrum between -20 Hz and 20 Hz in each of the subfigures above corresponds to each respective stream shown in the OFDM streams (before resampling) figure. The harmonics caused by resampling however cause the bandwidth to increase from 40 to 80 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should the bandwidth of the BPSK OFDM signal be after resampling? Is it 50 Hz (according to theoretical graph shown), 40 Hz (simulated before resampling) or 80 Hz?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Should a filter be used to achieve the correct bandwidth?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How is OFDM typically implemented to ensure the correct bandwidth; should some subcarriers be set to zero? Should another DAC approach be used?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11978" LastEditorUserId="1606" LastEditDate="2015-01-22T08:37:35.330" LastActivityDate="2015-01-22T08:37:35.330" Title="OFDM transmitter bandwidth" Tags="|fft|signal-analysis|digital-communications|ofdm|resampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20133" PostTypeId="1" CreationDate="2015-01-21T10:38:58.090" Score="5" ViewCount="1267" Body="&lt;p&gt;What type of filters can be used to remove Poisson noise in an image? I tried applying Gaussian filter to few points in the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="13454" LastEditorUserId="128" LastEditDate="2021-12-01T17:39:20.420" LastActivityDate="2021-12-01T17:39:20.420" Title="Poisson Noise Removal from an Image" Tags="|image-processing|fft|filters|noise|denoising|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="20134" PostTypeId="2" ParentId="20128" CreationDate="2015-01-21T10:44:32.163" Score="2" Body="&lt;p&gt;The thresholding techniques that you would find &lt;a href=&quot;http://www.csse.uwa.edu.au/~shafait/papers/Shafait-efficient-binarization-SPIE08.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; should be ideally suited to OCR applications. You could read and easily implement. They are also very efficient.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-01-21T10:44:32.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20135" PostTypeId="1" AcceptedAnswerId="20136" CreationDate="2015-01-21T11:06:52.170" Score="0" ViewCount="6988" Body="&lt;p&gt;I tried to write my own circular convolution function in python using the fact that for two signals $f$ and $g$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \widehat{(f * g)} = f \cdot g $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy import array, zeros, signal&#xA;from scipy.fftpack import fft, ifft, convolve&#xA;def conv(f, g):&#xA;  # transform f and g to frequency domain&#xA;  F = fft(f)&#xA;  G = fft(g)&#xA;  # multiply entry-wise&#xA;  C = F * G&#xA;  # transfer C to time domain&#xA;  c = ifft(C)&#xA;&#xA;  return c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, for &lt;code&gt;f = array([1,2,3,4])&lt;/code&gt; and &lt;code&gt;g = array([5,4,3,2])&lt;/code&gt; I get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;conv(f,g) = [ 34.+0.j  32.+0.j  34.+0.j  40.+0.j]&#xA;convolve.convolve(f,g) = [  1.48219694e-322   2.07507571e-322   3.06320700e-322   3.26083326e-322]&#xA;signal.convolve(f,g,'same') = [14 26 40 29]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first function is mine, the second one comes from the fft pack and the third one is from the scipy signal package. All return different results. How does this happen and what is the &quot;correct&quot; one? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circular convolution I want is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(f*g)[n] = \sum_{p=0}^{N-1} f[p]g[n-p] $$&#xA;where $f[p] = f_{p \mod N}$. Can somebody help me?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit: I added a direct calculation for $(f*g)$ &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def direct(f,g):&#xA;    r = zeros(len(f))&#xA;    for k in range(len(f)):&#xA;        for p in range(len(f)):&#xA;            r[k] = r[k] + (f[p] * g[k-p])&#xA;    return r&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which returns the same result as my own implementation above. So my implementation seems correct. However, why do &lt;code&gt;convolve.convolve&lt;/code&gt; and &lt;code&gt;signal.convolve&lt;/code&gt; return other results? &lt;/p&gt;&#xA;" OwnerUserId="9084" LastEditorUserId="9084" LastEditDate="2015-01-21T11:12:16.113" LastActivityDate="2017-10-14T00:01:52.290" Title="Confused with convolutions in scipy" Tags="|convolution|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20136" PostTypeId="2" ParentId="20135" CreationDate="2015-01-21T11:25:59.073" Score="2" Body="&lt;p&gt;I do not know what &lt;code&gt;convolve.convolve&lt;/code&gt; does but the output of &lt;code&gt;signal.convolve&lt;/code&gt; is the &lt;em&gt;linear&lt;/em&gt; convolution (as opposed to circular convolution) of the two sequences. And since you supplied &lt;code&gt;'same'&lt;/code&gt;, the output has the same size as the first input vector, and the samples are taken from the center of the complete output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circular convolution is indeed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;34   32   34   40&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the linear convolution is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;5   14   26   40   29   18    8&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which you obtained samples 2 to 5 (by using the mode &lt;code&gt;'same'&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-21T11:25:59.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20138" PostTypeId="1" CreationDate="2015-01-21T13:52:59.157" Score="1" ViewCount="847" Body="&lt;p&gt;I'm quite new to this; I'm try to classify textures as defective or non-defective. I've used a Gabor filter bank with Matlab which outputs a column vector of the Gabor features of an image. I have a data set of non-defective images and defective images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what can I now do with this (or these) feature vectors to classify the texture? I've read about many types of classification (SVMs, Neural networts, nearest neighbour etc.), but couldn't find any similar types of implementation to help me get an idea of what I'm doing - perhaps someone could point me towards a practical example to help my understanding. Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="13457" LastActivityDate="2015-01-22T07:02:44.273" Title="Classification from a feature vector" Tags="|image-processing|matlab|computer-vision|classification|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20139" PostTypeId="2" ParentId="20132" CreationDate="2015-01-21T14:04:28.430" Score="0" Body="&lt;p&gt;Remember that OFDM is a time limited system. And because of that you have infinite components in the frequency domain ideally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not using nulls in the frequency domain, then you are not using a rectangular pulse shaping. Yes, then definitely you need to use a filter. If it is baseband communication, use a low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upsampling factor after the IFFT decides the bandwidth. it becomes fc/(M*fs). where M is the upsampling factor, fs is the sample rate, and fc is the cutoff frequency of the low pass filter which you are using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2015-01-21T14:04:28.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20140" PostTypeId="2" ParentId="20132" CreationDate="2015-01-21T16:07:09.760" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What should the bandwidth of the BPSK OFDM signal be after resampling?&#xA;  Is it 50 Hz (according to theoretical graph shown), 40 Hz (simulated&#xA;  before resampling) or 80 Hz?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What you call resampling is actually modelling D/A conversion with a discrete simulation system. Resampling consists of a repetition of every sample &lt;em&gt;plus&lt;/em&gt; low pass filtering. Your D/A converter model makes sense but it should not be confused with resampling. The D/A converter can be described by convoluting the discrete time signal with some impulse response $g(t)$. In frequency domain this corresponds to a multiplication of $X(f)$ with $G(f)$ (where these are the Fourier transforms of $x(t), g(t)$). You chose $g(t)$ to be rectangular, so $G(f)$ is a sinc function. As $x$ is a discrete-time signal its frequency spectrum is infinite and so is $G(f)$. The first spectral nulls of $G(f)$ are at $-f_\mathrm{s}$ and $f_\mathrm{s}$. So from your plot it can be seen that a sampling frequency of 40 Hz has been assumed. The useful OFDM signal is in $[-f_\mathrm{s}/2,f_\mathrm{s}/2]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to answer your question: after D/A conversion the spectrum of the OFDM signal is non-zero for arbitrarily high frequencies. To find the 3-dB bandwidth $B$ you have to find the frequency $f_0$ for which $G(f_0)=0.5$, then $B=2f_0$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Should a filter be used to achieve the correct bandwidth?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, after D/A conversion, a lowpass filter with cut-off frequency $f_\mathrm{s}/2$ should be used to attenuate the spectral aliases that are caused by the D/A conversion. This so-called reconstruction filter is generally required after D/A conversion and is not OFDM specific. In cases where signal bandwidth doesn't play a role it can be omitted.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How is OFDM typically implemented to ensure the correct bandwidth; should some subcarriers be set to zero? Should another DAC approach be used?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Typically a lowpass filter with cut-off frequency $f_\mathrm{c} = f_\mathrm{s}/2$ is used. Additionally, some subcarriers at high frequencies are set to zero to enable filtering at $f_\mathrm{c}$ without distorting the useful signal. This is more important at the receiver side where the bandwidth must not exceed $f_\mathrm{s}/2$ in order to avoid aliasing when sampling the received signal. An anti-aliasing lowpass filter is usually applied at the receiver to achieve that.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-01-21T16:07:09.760" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20141" PostTypeId="1" CreationDate="2015-01-21T17:21:40.283" Score="2" ViewCount="733" Body="&lt;p&gt;I have the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WhGXN.png&quot; alt=&quot;Image with gapped contours&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I would like to fill in its contours (i.e. I would like to gap fill the lines in this image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried a morphological closing, but using a rectangular kernel of size 3x3 with 10 iterations does not fill in the entire border.&lt;/p&gt;&#xA;" OwnerUserId="13445" LastEditorUserId="13445" LastEditDate="2015-01-21T17:48:08.520" LastActivityDate="2023-04-16T14:21:43.370" Title="Gap Filling Contours / Lines" Tags="|image-processing|image-segmentation|opencv|morphological-operations|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20142" PostTypeId="1" CreationDate="2015-01-21T21:47:58.710" Score="0" ViewCount="623" Body="&lt;p&gt;I have time domain history data. Then, I convert it into FFT to get the frequency domain history data. The problem is, how to determine the bandwidth of the FFT data? Is it automatically synchronize with my time domain history data? The bandwidth of time history data is $50 Hz$-$500 Hz$.&lt;/p&gt;&#xA;" OwnerUserId="13462" LastEditorUserId="7092" LastEditDate="2015-01-21T22:07:03.940" LastActivityDate="2015-01-21T22:07:03.940" Title="Matlab coding for bandwidth interval" Tags="|matlab|fft|bandwidth|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20143" PostTypeId="1" AcceptedAnswerId="20146" CreationDate="2015-01-22T01:13:46.370" Score="9" ViewCount="1076" Body="&lt;h1&gt;Problem.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;There is a discrete signal $f[i]$&lt;/strong&gt; (example below). &lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yRMRKm.png&quot; alt=&quot;Example of signal&quot;&gt;&lt;br&gt;&#xA;&lt;strong&gt;It is known, that $f[i]$ have a form of rectangular pulse with additive white Gaussian noise.&lt;/strong&gt;&lt;br&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f[i] = s[i] + n[i]$,&lt;br&gt;&#xA;$s[i] = \alpha(\theta[i - i_{1}] - \theta[i - i_{2}]) + c$,&lt;br&gt;&#xA;$i_{2} &amp;gt; i_{1}$,&lt;br&gt;&#xA;$i_{1} &amp;gt; N$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where&lt;br&gt;&#xA;$\theta[i]$ is a Heaviside step function,&lt;br&gt;&#xA;$n[i]$ is an additive white Gaussian noise,&lt;br&gt;&#xA;$\alpha$ is a height of rectangular pulse,&lt;br&gt;&#xA;$i_{1}$ is an index of the first sample of rectangular pulse,&lt;br&gt; &#xA;$i_{2}$ is an index of the last sample of rectangular pulse,&lt;br&gt; &#xA;$c$ is constant level of signal,&lt;br&gt;&#xA;$N$ is adjustable parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;All parameters may have large range of values.&lt;/strong&gt;&lt;br&gt;&#xA;&lt;strong&gt;It is required to find value of $(i_{2} - i_{1})$&lt;/strong&gt; (duration of rectangular pulse in samples).&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Possible solutions.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;At the moment, I have tried two ways to solve this problem.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Low pass filter with threshold.&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;As first attempt, I have used simple scheme with low pass filter and threshold.&lt;br&gt;&#xA;1. Apply FIR low pass filter with cutoff frequency equal to $0.05f_{sampling}$.&lt;br&gt;&#xA;2. Estimate mean $m$ and dispersion $\sigma^{2}$ of filtered noise from first $N$ samples of the signal.&lt;br&gt;&#xA;3. Set threshold $t = m + 3\sigma$.&lt;br&gt;&#xA;4. Estimate $i_{1} = \min_{i}(f[i] &amp;gt; t)$.&lt;br&gt;&#xA;5. Estimate $i_{2} = \max_{i}(f[i] &amp;gt; t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wSIb2m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pros:&lt;br&gt;&#xA;1. This algorithm is simple.&lt;br&gt; &#xA;2. It is easy to write fast implementation.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cons:&lt;br&gt;&#xA;1. It is hard to estimate efficient value of filter's cutoff frequency. On the one hand low value can corrupt the form of short pulses. On the other hand large value decreases effect from filtration.&lt;br&gt;&#xA;2. Algorithm isn't using all information, we have about the signal.  &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Regression analysis&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;As the second attempt, I have tried to approximate input sequence of samples with the function $s'[i]$.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s'[i] = \alpha(\theta'[i - i_{1}] - \theta'[i - i_{2}]) + c$,&lt;br&gt;&#xA;$\theta'[i] = \frac{1}{1+e^{-\frac{i}{\beta}}}$, where $\beta$ is a small parameter.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For approximation I have used the method of least squares with gradient descent for minimizing cost function.&lt;br&gt;&#xA;1. Set initial values for $\alpha$, $c$, $i_{1}$, $i_{2}$.&lt;br&gt;&#xA;2. Perform gradient descent.&lt;br&gt;&#xA;3. Set threshold $t = c + 0.5\alpha$.&lt;br&gt;&#xA;4. Estimate $i_{1} = \min_{i}(f[i] &amp;gt; t)$.&lt;br&gt;&#xA;5. Estimate $i_{2} = \max_{i}(f[i] &amp;gt; t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3ftaOm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pros:&lt;br&gt;&#xA;1. This algorithm gives results with good precision.&lt;br&gt;&#xA;2. It works for wide range of durations.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cons:&lt;br&gt;&#xA;1. It is very slow.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Question.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;After all, I am not satisfied with the precision of the first algorithm and with the speed of the second one.&#xA;How would you solve this problem?&lt;br&gt;&#xA;Is there any classical solution, that I failed to find?&lt;br&gt;&#xA;Ideas, links, any feedback will be much appreciated.&lt;br&gt;&#xA;Thank you.  &lt;/p&gt;&#xA;" OwnerUserId="6961" LastActivityDate="2019-06-12T22:02:06.473" Title="Duration of unknown rectangular pulse with additive white Gaussian noise" Tags="|filters|signal-analysis|algorithms|estimation|denoising|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20144" PostTypeId="2" ParentId="20138" CreationDate="2015-01-22T07:02:44.273" Score="1" Body="&lt;p&gt;You have pairs of features-target's which is the first step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm no expert in texture classification, there are probably specialized and/or well-known good methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it easy for a beginner, I would take a look at the examples for the Python library scikit-learn: &#xA;&lt;a href=&quot;http://scikit-learn.org/stable/auto_examples/index.html#general-examples&quot; rel=&quot;nofollow&quot;&gt;http://scikit-learn.org/stable/auto_examples/index.html#general-examples&lt;/a&gt;&#xA;and see what looks interesting, for example a few different random forest examples &lt;a href=&quot;http://scikit-learn.org/stable/auto_examples/ensemble/plot_forest_iris.html&quot; rel=&quot;nofollow&quot;&gt;http://scikit-learn.org/stable/auto_examples/ensemble/plot_forest_iris.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to run these is a matrix with the filter responses features (the same shape as iris.data in the example (number of examples on the first axis and number of features on the second)) and a binary vector of targets (the same shape as iris.target (number of examples on the first axis)) &#xA;basically you are replacing the &quot;iris&quot; dataset with your own dataset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to load text data&#xA;&lt;code&gt;&#xA;import numpy as np&#xA;features = np.loadtxt('data.csv')&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(as a side note: &lt;code&gt;numpy&lt;/code&gt; works much like the builtin matrix stuff in matlab)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try out a few different classifiers with a few different parameters and see what happens with the results &lt;a href=&quot;http://scikit-learn.org/stable/modules/generated/sklearn.metrics.classification_report.html&quot; rel=&quot;nofollow&quot;&gt;http://scikit-learn.org/stable/modules/generated/sklearn.metrics.classification_report.html&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure you split the data into train and test data &lt;a href=&quot;http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.train_test_split.html&quot; rel=&quot;nofollow&quot;&gt;http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.train_test_split.html&lt;/a&gt; or use cross-validation &lt;a href=&quot;http://scikit-learn.org/stable/modules/cross_validation.html&quot; rel=&quot;nofollow&quot;&gt;http://scikit-learn.org/stable/modules/cross_validation.html&lt;/a&gt; to avoid overfitting, again there is examples of use under the scikit-learn homepage.&lt;/p&gt;&#xA;" OwnerUserId="905" LastActivityDate="2015-01-22T07:02:44.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20145" PostTypeId="1" AcceptedAnswerId="20154" CreationDate="2015-01-22T09:25:08.147" Score="0" ViewCount="51" Body="&lt;p&gt;I need to extract (estimate) a square-shaped signal from the main signal. This square-shaped signal should be located within a specific range, in fact all we have to do is to estimate its height. A square-shaped signal is not periodical, it's length can vary from 1/12 to 2/3 of overall length. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read some literature about BSS and ICA but I feel like this problem should have a very simple solution.&lt;/p&gt;&#xA;" OwnerUserId="13465" LastEditorUserId="13465" LastEditDate="2015-01-22T09:38:48.870" LastActivityDate="2015-01-22T22:39:49.577" Title="Extract a square-shaped signal which lies in a specific range" Tags="|ica|blind-deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20146" PostTypeId="2" ParentId="20143" CreationDate="2015-01-22T10:04:41.657" Score="6" Body="&lt;p&gt;You want a method that removes noise while preserving edges. This cannot be achieved well by linear filtering, as you noticed yourself. I know of two approaches that might work well for your problem. The first is &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;noreferrer&quot;&gt;median filtering&lt;/a&gt;, where samples inside a window are replaced by their median. The following plot shows the result of median filtering with a window length of 25 samples (in red):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MngG9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other, more complex, approach is &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_variation_denoising&quot; rel=&quot;noreferrer&quot;&gt;Total variation denoising&lt;/a&gt;, which works very well for piecewise constant signals. There is a very good description of total variation denoising including Matlab code available: &lt;a href=&quot;http://eeweb.poly.edu/iselesni/lecture_notes/TVDmm/TVDmm.pdf&quot; rel=&quot;noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-22T10:04:41.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20147" PostTypeId="2" ParentId="17449" CreationDate="2015-01-22T16:26:56.563" Score="1" Body="&lt;p&gt;You're on the right track.  The distinction must be made between the physical size of your array, n (generally $n_0 × n_1 × n_2 × … × n_{d-1}$ except for in-place R2C transforms), and the logical size, N.  For a 10x10 matrix, the physical size is n=10*10=100, so the logical size for this particular transform is N=2n=200,  the scaling factor for the unnormalized transform-then-inverse result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They talk a little more about that &lt;a href=&quot;http://www.fftw.org/doc/1d-Real_002deven-DFTs-_0028DCTs_0029.html#g_t1d-Real_002deven-DFTs-_0028DCTs_0029&quot; rel=&quot;nofollow&quot;&gt;here in the Real even/odd FFTW3 docs&lt;/a&gt;, although they don't give much more info than the link you provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's always a good idea to test with a problem that you already know the answer to, &lt;/p&gt;&#xA;" OwnerUserId="13471" LastActivityDate="2015-01-22T16:26:56.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20148" PostTypeId="1" CreationDate="2015-01-22T16:39:25.597" Score="5" ViewCount="831" Body="&lt;p&gt;I'm working on a computer vision application (using openCV) and the goal is to measure the width of an object before/after it falls on a container. So after the fall its position will be random, something like this to be clear: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h0hu8.jpg&quot; width=&quot;250&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only object I want to measure will be clear filtering the image and will be always on top, but its width won't be parallel to the image plane of the camera in the general case. In the worst scenario the longer face could be very occluded, getting things very hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: what will lead to better accuracy between these 2 strategies?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Getting a pair of stereo images of the container, locate two points on the longer face of the object (vertex or medium point of the borders) and then calculate the distance in 3D space between these points.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Working with a single camera close to the object before it falls into the container, where its motion will be perpendicular to the camera so the entire width will be on a plane parallel to the image plane. Using a known size reference (at the same distance of the object to be measured) and calibrated camera will lead to width measure from a single image simply counting pixels. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Additional info: the distance between camera and object will be 2 to 2.5 m and I need 10mm accuracy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second path sounds cheaper, easier to implement and likely more accurate..but I'm open to suggestions or other ideas.&lt;/p&gt;&#xA;" OwnerUserId="13472" LastEditorDisplayName="user11906" LastEditDate="2015-05-14T01:08:47.343" LastActivityDate="2021-12-10T18:03:40.437" Title="Measuring non-planar objects in image" Tags="|3d|measurement|stereo-vision|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20149" PostTypeId="1" CreationDate="2015-01-22T16:58:28.127" Score="3" ViewCount="737" Body="&lt;p&gt;I'm looking for some advice, I am hoping one of the many forum experts could help me with some advice on the sampling and processing of signals. I am using an STM32F4 processor with 12 bit ADC and DSP core. Presently, I can use either CMSIS DSP or Siglib libraries. Here's a point description of the problem space:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can sample at whatever rate is required: in front of the ADC is a 10th order analog amplifier and LPF, Fc = 55Hz. Amplifier can be set to provide ideal ADC range of 3Vpp&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sinusoidal incoming signals are in the range of 10Hz to 40Hz that can be set for any duration in time. Ideally, in the range of 200ms to 300ms (can be changed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In between these tones, there is dead space of (ideally) 50ms to 100ms (can be changed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There would be a series of these tones with a total time of about 4, or possibly 5 seconds (can be processed after last signal arrives, ideally real-time)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need the best amplitude and frequency accuracy possible, ideally about 2dB and 0.5Hz. The environment is noisy, but incoming signals can be kept 20dB over noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not looking for a code handout. Just a best approach algorithm and ideally some specifics such as sampling rate (is decimation required), buffer size, to use overlap-add/sliding window, signal processing chain - FIR required (how many taps), FFT method/size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may not be complex to many of you, but I haven't finished all the theory I need to try an implementation without spending a long time,(I have all the books but there's a lot of reading yet!) and the problem requires me to try for a solution now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help!&#xA;Roger&lt;/p&gt;&#xA;" OwnerUserId="10326" LastActivityDate="2021-07-15T15:44:48.270" Title="Best Approach on How To Sample and Process" Tags="|sampling|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20150" PostTypeId="1" AcceptedAnswerId="20155" CreationDate="2015-01-22T20:02:40.617" Score="2" ViewCount="215" Body="&lt;p&gt;I'm trying to plot my FFT of File. This i my result.&#xA;I made my FFT application:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;I want to obtain something very similar to plot of WaveSpectra, please tell me my mistakes..&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My FFT&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/g42Zm.png&quot; alt=&quot;My FFT&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The result from WaveSpectra&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/NPXt5.png&quot; alt=&quot;The wave Spectra version&quot;&gt;&#xA;&lt;strong&gt;Other result from WaveSpectra&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/txDIB.png&quot; alt=&quot;Other with WaveSpectra&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double[] Samples = null;&#xA;try {&#xA;&#xA;  RandomAccessFile rafr = new RandomAccessFile(TheFile, &quot;r&quot;);  //TheFile String with path and WAV filename&#xA;  //double[] getSamplesFile(rafr,&quot;left&quot;,0,8192)  //returns the first 8192 samples of left channel&#xA;  Samples = getSamplesFile(rafr,Channel,iPosition,iSizeFFT);&#xA;  rafr.close();&#xA;}&#xA;catch (IOException e) { System.out.println(e.toString()); }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Applying Window Function&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying to apply Window function to Samples, check the code below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//double[] getWindow(8192,&quot;hamming&quot;); //was verified against matlab&#xA;Samples = applyFilter(Samples,getWindow(iSizeFFT,sWindow));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Trying to Normalize&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get the Log10 of of absolute value of each complex item of array of FFT, later multiply by 20&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//fft:  Returns a complex array with FFT (the result was tested and it is equal to Matlab)&#xA;//getArrayComplexMod: Returns a double array with absolute value of each complex number&#xA;//getRealArrayLog10: Returns a double array with Math.log of each double element&#xA;//getRealArrayScalarMult: Returns a double array multiplying each double element with 20.0&#xA;&#xA;Samples = getRealArrayScalarMult(getRealArrayLog10(getArrayComplexMod(fft(Samples))),20.0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Obtain the Frequency in Hertz&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Now the freq or bins&#xA;double[] bins = new double[iSizeFFT];  //Size 8192&#xA;Integer SmplRt = 8000; &#xA;for (int i = 0; i &amp;lt; iSizeFFT; i++) {&#xA;  bins[i] = (double)i*SmplRt/iSizeFFT;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The code to apply filter (or Hamming window) to Samples.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Finite_impulse_response#Definition&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  static double[] applyFilter(double[] dSamples, double[] dFilter) {&#xA;    return applyFilter(dSamples, dFilter, 0);&#xA;  }&#xA;&#xA;  static double[] applyFilter(double[] dSamples, double[] dFilter, int PosSample) {&#xA;    double[] filteredSamples = new double[dSamples.length - PosSample];&#xA;    for (int i = PosSample; i &amp;lt; dSamples.length; i++) {&#xA;      filteredSamples[i - PosSample] = 0;&#xA;      for (int j = 0; j &amp;lt; dFilter.length; j++) {&#xA;        if(!((i - j) &amp;lt; 0)) {&#xA;          filteredSamples[i - PosSample] += dSamples[i-j]*dFilter[j];&#xA;        }&#xA;      }&#xA;    }&#xA;    return filteredSamples;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 1:&lt;/strong&gt;&#xA;Following the answer of @hotpow2, solved!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jkwst.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12094" LastEditorUserId="12094" LastEditDate="2015-01-23T01:54:51.650" LastActivityDate="2015-01-23T01:54:51.650" Title="Fixing my FFT Plot" Tags="|fft|window-functions|java|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20151" PostTypeId="2" ParentId="20150" CreationDate="2015-01-22T20:54:11.413" Score="1" Body="&lt;p&gt;This is generally a programming question that fits to Stack Overflow, but you missing one part. Frequency scale in case of Wave Spectra is logarithmic, on your plot it is linear. Usually functions like &lt;code&gt;semilogx&lt;/code&gt; are doing job. Then it's simply setting the x-axis ticks.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-01-22T20:54:11.413" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20152" PostTypeId="2" ParentId="20149" CreationDate="2015-01-22T21:14:33.317" Score="1" Body="&lt;p&gt;As I understand, you want to sample a noisy tone signal at 20dB SNR and in 10Hz-40Hz range with best possible amplitude and frequency accuracy using 12 bit ADC of STM32F4 ARM+DSP chip. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the most frequency accuracy you need more samples to be buffered and large FFt sizes for a given samplig rate Fs. This is for frequencies on a given range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using high sampling rate (oversampling) may be advantageous for increased SNRQ. See Sigma-Delta converters and Noise shapers for details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Size of FIR filters: As again it is a direct compromise between computing power and processing quality. STM32F4 is quite powerful chip at 168 Mhz operating frequency and 32 bit FPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For FFT, you can write your own code if you have time. I can provide you a butterfly implementation. Or you better use it from some free library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should select long fft sizes for better frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;please have a look at this document: &lt;a href=&quot;http://support.ircam.fr/docs/AudioSculpt/3.0/co/Window%20Size.html&quot; rel=&quot;nofollow&quot;&gt;http://support.ircam.fr/docs/AudioSculpt/3.0/co/Window%20Size.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-01-22T22:44:09.127" LastActivityDate="2015-01-22T22:44:09.127" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20154" PostTypeId="2" ParentId="20145" CreationDate="2015-01-22T22:29:47.497" Score="1" Body="&lt;p&gt;If you just want to estimate the height of the square shaped component you can pass the composite signal thorough a low pass filter with a cut-off frequency close to DC or less than the minimum frequency you can expect to see in the composite signal apart from the square component. The resulting signal would have most of the non-DC components filtered out and hence the energy contained in the filtered signal must be close to the that of the square pulse. After this you can do a Short time Fourier transform of composite signal with a time window less than half the minimum length of the square signal (1/24) and plot the spectrogram. Note the magnitude and variation of DC in the spectrogram. This information when corroborated with low pass filtered result should give you a fair estimate of the height and duration of the square signal.  &lt;/p&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="11242" LastEditDate="2015-01-22T22:39:49.577" LastActivityDate="2015-01-22T22:39:49.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20155" PostTypeId="2" ParentId="20150" CreationDate="2015-01-22T22:56:43.983" Score="1" Body="&lt;p&gt;You appear to be convolving the data with your window instead of just multiplying the data by your window.  e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;windowedSamples[i] = window[i] * data[i]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;without any nested convolution loop.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-01-22T22:56:43.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20156" PostTypeId="2" ParentId="20009" CreationDate="2015-01-22T23:28:49.117" Score="1" Body="&lt;p&gt;I recommend you check out &lt;a href=&quot;https://github.com/cmusphinx/sphinx4&quot; rel=&quot;nofollow&quot;&gt;the Open Source speech recognition library from CMU, Sphinx4&lt;/a&gt;. Run the Transcriber sample and you can see it in action doing some basic speech recognition, writing all detected phonemes to the console. You can either filter out non-vowel phonemes at that point, or implement an &lt;a href=&quot;http://cmusphinx.sourceforge.net/wiki/sphinx4:rejectionhandling&quot; rel=&quot;nofollow&quot;&gt; Out-of-Grammar rejection rule&lt;/a&gt;, where out-of-grammar would refer to non-vowel phonemes.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-01-22T23:28:49.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20157" PostTypeId="1" AcceptedAnswerId="20160" CreationDate="2015-01-23T00:55:49.567" Score="-1" ViewCount="114" Body="&lt;p&gt;I used the Matlab function &lt;code&gt;fft&lt;/code&gt; but I am not sure which function is the correct inverse to go back to the time domain.&lt;/p&gt;&#xA;" OwnerUserId="13475" LastActivityDate="2015-01-23T08:50:01.620" Title="What is the correct inverse function of the Matlab function fft?" Tags="|matlab|fft|" AnswerCount="1" CommentCount="7" FavoriteCount="0" ClosedDate="2015-01-25T03:43:29.187" ContentLicense="CC BY-SA 3.0" />
  <row Id="20158" PostTypeId="1" AcceptedAnswerId="20183" CreationDate="2015-01-23T05:21:15.597" Score="1" ViewCount="1090" Body="&lt;p&gt;I appreciate anyone that takes a moment to help me with this problem. I've been banging my head against the keyboard for a while, searching forums and DSP tutorials and I can't figure this problem out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a couple links I found very helpful from this forum on the subject:&#xA;&lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/&lt;/a&gt;&#xA;&lt;a href=&quot;http://wiki.scipy.org/Cookbook/ApplyFIRFilter&quot; rel=&quot;nofollow&quot;&gt;http://wiki.scipy.org/Cookbook/ApplyFIRFilter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have a WAV file with a 28 sec song/sound that I am trying to convert to frequency range, apply an FIR filter to isolate the 14.5 - 16kHz range. The WAV has a sampling rate of 32 kHz and contains an intermittent buzz that becomes clearer when I drop out all other frequencies besides the 14.5 -16kHz bands. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have written this sample of python code, and believe I am close to isolating the signal. Its hard to tell.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;# read data from file name fn, using low/high for bandpass&#xA;# low and high frequency cutoffs, and a &#xA;def filter_frequencies(fn,low=0,high=0):&#xA;    data = wave.open(fn,'rb'); rate = data.getframerate()&#xA;    ntap = (rate / 4) + 1; nyq = rate / 2&#xA;    low,high = low/nyq,high/nyq&#xA;    chunks = int(data.getnframes()/(rate*4))&#xA;    ns = b''&#xA;    if low and high == 0: # lowpass&#xA;        bp = low; pz = True&#xA;    elif high and low == 0: # highpass&#xA;        bp = high; pz = False&#xA;    else: # bandpass&#xA;        bp = [low,high]; pz = False&#xA;&#xA;    b = firwin(ntap, bp, pass_zero=pz, window='blackman', nyq=nyq)&#xA;    y = b''&#xA;    for num in range(chunks):&#xA;        # read 4 secs of frames from wav file&#xA;        seg = np.fromstring(data.readframes(rate*4),dtype=np.int8)&#xA;        #seg = np.fromstring(data.readframes(data.getnframes()),dtype=np.int8)&#xA;        # convert frame amplitudes to their frequency values&#xA;        freq = np.fft.rfft(seg)&#xA;        # perform lowpass, highpass or bandpass filter&#xA;        cr = fftconvolve(freq,b,mode='valid')&#xA;        # converts frequencies to binary string&#xA;        y += cr.tostring()&#xA;    data.close()&#xA;    return y&#xA;&lt;/pre&gt; &#xA;&#xA;&lt;p&gt;I am a noob to DSP, so again I would really appreciate your help on if I am doing the FFT to inverse FFT correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code I am using to transform the output from the above function back into WAV bytes format.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;def frequency_to_bytes(freq):&#xA;    # invert the Fast Fourier Transform&#xA;    nf = np.fft.irfft(freq)&#xA;    # convert frequencies back to integer values&#xA;    bs = np.ravel(nf).astype(np.int8)&#xA;    return bs.tostring()&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;P.s. if you have seen this problem before, or know what challenge I am trying to solve, please no spoilers. I have been working on this for a week solid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: added some background links I have been using as reference.&lt;/p&gt;&#xA;" OwnerUserId="13476" LastEditorUserId="13476" LastEditDate="2015-01-23T05:27:33.943" LastActivityDate="2022-06-06T19:00:57.627" Title="Apply FIR filters to Extract Stego from WAV data" Tags="|fft|filter-design|python|bandpass|highpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20159" PostTypeId="1" CreationDate="2015-01-23T08:28:14.640" Score="0" ViewCount="366" Body="&lt;p&gt;Hello I'm trying to ocr on a special image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done adaptive threshold , polartocartesian transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is my original image&#xA;&lt;img src=&quot;https://i.stack.imgur.com/S9OZ9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is adaptive threshold&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7EOmH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is polartocartesian transformation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fN37K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what do you think is this image good enough for OCR or do I have to optimize my preprocessing steps ? &lt;/p&gt;&#xA;" OwnerUserId="12210" LastActivityDate="2015-08-10T07:52:21.697" Title="Is this image good enough for OCR?" Tags="|image-processing|image-segmentation|opencv|preprocessing|ocr|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20160" PostTypeId="2" ParentId="20157" CreationDate="2015-01-23T08:50:01.620" Score="-1" Body="&lt;p&gt;Yes it is ifft(). If it is non radix two, the algorithm that is implemented would be DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can write the equation of the IFFT with normalizing factor (1/sqrt(N)) instead of (1/N), then you have to multiply the time domain counterpart with sqrt(N).&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2015-01-23T08:50:01.620" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20161" PostTypeId="1" AcceptedAnswerId="20165" CreationDate="2015-01-23T10:25:19.820" Score="2" ViewCount="2977" Body="&lt;p&gt;I have developed a function which down samples an input signal.Say I have an input signal with a sampling rate of 512 samples/sec and would like to down sample it 128 samples/sec, then the down sampling factor is discrete and it is 4. In this case, I believe that the input signal will successfully be down sampled to 128 samples/sec without any loss of information.But, what if we have to down sample a signal from a sampling rate of 511 samples/sec to 127 samples/sec,then the down sampling factor 4.0236. When I run my code for a down sampling non integer factor, I still get the output down sampled signal,but I am sure that, since I down sampled the signal by an non-integer factor, the output may not be correct and would have lost information.Any methods to overcome this issue or Is there a way to approximate it without damaging the quality of the down sampled signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Understanding - I found a method after a while of researching. In this case we have to initially up sample the input sampling rate followed by down sampling, known as &quot;Multirate conversion&quot;. So here is my understanding, Input Sampling rate = 511 b/s and Desired output sampling rate = 127 b/s. So, 127*5 = 635 and 635 -511 = 124. Therefore, i need to up sample 511 b/s by a factor of L = 5 to get 635 and then down sample this 635 by a factor M = 124 to get the desired down sampled output of 127 b/s. What do you have to say?. Please correct me if its wrong or illogical.&lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="9152" LastEditDate="2015-01-23T13:29:23.613" LastActivityDate="2015-01-25T18:45:37.270" Title="What if the Down sampling factor is not an integer?" Tags="|downsampling|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20163" PostTypeId="1" CreationDate="2015-01-23T11:56:47.903" Score="-1" ViewCount="644" Body="&lt;p&gt;I am new in DSP.I have the flowing code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = linspace(0,1,1000);&#xA;x = cos(2*pi*60*t);&#xA;CWTcoeffs = cwt(x,1:64,'sym8','plot'); &#xA;colormap jet;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and my output is:&lt;img src=&quot;https://i.stack.imgur.com/Mqh4s.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;their have scale in y axis but i represent in frequency &#xA;what is the solution in matlab&lt;/p&gt;&#xA;" OwnerUserId="13478" LastEditorUserId="8202" LastEditDate="2015-01-23T12:38:32.780" LastActivityDate="2015-01-23T12:38:32.780" Title="How convert scal to frequency when use cwt in matlab" Tags="|matlab|signal-analysis|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20164" PostTypeId="2" ParentId="20163" CreationDate="2015-01-23T12:38:22.350" Score="2" Body="&lt;p&gt;I think you should try MATLAB's &lt;a href=&quot;http://uk.mathworks.com/help/wavelet/ref/scal2frq.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;scal2frq&lt;/strong&gt;&lt;/a&gt;. You provide the vector of scales, wavelet name and optionally sampling period. This will return vector of pseudo frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case that should be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = scal2frq(1:64, 'sym8', t(1)-t(0));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-01-23T12:38:22.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20165" PostTypeId="2" ParentId="20161" CreationDate="2015-01-23T18:05:26.103" Score="3" Body="&lt;p&gt;Resampling (by rational or even irrational ratios) can be done by low-pass filtering in conjunction with high quality interpolation of all the samples needed for the new rate, directly.  No two-step up-sampling following by downsampling is required (although that is one possible implementation for simple ratios).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Sinc kernel, being a reconstruction formula, is the ideal interpolator for band-limited sampled waveforms.  In practice, a windowed Sinc interpolator is usually as good or better than the FIR or IIR filters used inside other resampling methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, information may be lost in going to any lower sample rate (even in your original 4:1 resampler) if the original sample data contains higher frequency spectrum that has to be removed by the anti-alias low pass filter (required to prevent aliasing at the lower sample rate).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-01-25T18:45:37.270" LastActivityDate="2015-01-25T18:45:37.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20166" PostTypeId="1" CreationDate="2015-01-23T18:25:24.630" Score="1" ViewCount="798" Body="&lt;p&gt;I have a rectangular image which need to transform so the image fits an arbitrary convex quad. Easy? Except I have an important constraint, the features on the original image must maintain their relative area after the transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a perspective transformation, but of course feature's relative area's change significantly with perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The (hand-drawn) image below illustrates the effect I need. The original is on the left and the transformed is on the right. Notice that all 4 features maintain same relative area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be happy with solution that maintained the areas approximately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l7oRW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13480" LastEditorUserId="13480" LastEditDate="2015-01-24T19:42:56.167" LastActivityDate="2015-01-24T23:28:30.370" Title="How to transform or distort or skew a rectangular image to fit arbitrary quad" Tags="|image-processing|transform|image-registration|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20167" PostTypeId="1" AcceptedAnswerId="20168" CreationDate="2015-01-23T20:12:28.807" Score="2" ViewCount="3118" Body="&lt;p&gt;I have a small team project: use Matlab implement a Gui 5-band digital equalizer using FIR and IIR filters (2 cases) - The sample rate of all audio files is standard audio 44.1kHz. Coding is not my concern, however, I have 2 questions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) What are 5 center frequencies that I should choose ?&#xA;I saw a homework problems select 500Hz, 1.5Hz, 4Kz, 10kHZ, and 16KHz but I am not sure how the author came up with these number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) Should I use 5 bandpass filters? Or should I use 1 lowpass, 3 bandpass, and 1 highpass filter?&lt;/p&gt;&#xA;" OwnerUserId="7226" LastEditorUserId="7226" LastEditDate="2015-01-23T21:25:56.883" LastActivityDate="2022-11-16T14:45:40.063" Title="How to select the center frequency and filter type for 5-band digital audio equalizer?" Tags="|audio|filter-design|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20168" PostTypeId="2" ParentId="20167" CreationDate="2015-01-23T20:46:02.553" Score="1" Body="&lt;p&gt;The answer may depend on your application. I suggest you look at some commercial audio equipments with EQs to decide for those band frequencies. For example the old analog philips casette-type stereo system in my room has 5 band graph equalizers with the frequencies: [100-300-1000-4000-10000] Hz respectively. I use it as an amplifier for my laptop :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you design the first and last bands as Bass/treble shelve types, be careful to limit their cutoffs so that mid bands will have enough spectral intervals.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-01-23T20:46:02.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20169" PostTypeId="2" ParentId="20167" CreationDate="2015-01-23T22:36:12.653" Score="1" Body="&lt;p&gt;5 bands ain't alot for a graphic equalizer.  there are 10 octaves in our hearing range, so they might be spaced apart by two octaves, if their resonant frequencies were fixed.  maybe by one octave with the three middle bands as peak/cut EQ and the top and bottom band as shelf EQ, both covering over 3 octaves.  it would be 5 controls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if all EQs were parametric, that is their resonant frequency (or &quot;significant frequency&quot;) were adjustable, then 5 bands is plenty sufficient.  the top and bottom bands would, again, be shelving EQ, and the middle 3 are peak/cut EQ.  if you include adjustable Q, that would be 15 knobs.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-01-23T22:36:12.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20170" PostTypeId="2" ParentId="7666" CreationDate="2015-01-23T22:46:55.937" Score="2" Body="&lt;p&gt;Yes it is true. A simple histogram equalization may fail for certain image intensity distributions. In your case there are some bins with excessive number of pixels. For other methods, try for example gamma and contrast corrections.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-01-23T22:46:55.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20171" PostTypeId="1" AcceptedAnswerId="20177" CreationDate="2015-01-23T23:26:22.510" Score="4" ViewCount="16680" Body="&lt;p&gt;I already have a low-pass filter and want to remove the DC offset of a signal with a high-pass one.  I guess you can subtract a low-pass filtered signal from the original signal and the result is a high-pass filtered signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My low-pass filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = input, raw signal&#xA;y = output, low-pass filtered signal&#xA;n = current sample&#xA;n - 1 = previous sample&#xA;&#xA;y(n) = y(n - 1) + (x(n) - y(n - 1)) / alpha&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;High-pass filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = input, raw signal&#xA;y = input, low-pass filtered signal&#xA;z = output, high-pass filtered signal&#xA;n = current sample&#xA;&#xA;z(n) = x(n) - y(n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this last equation correct?&lt;/p&gt;&#xA;" OwnerUserId="8116" LastEditorUserId="4298" LastEditDate="2020-11-01T18:16:47.187" LastActivityDate="2020-11-01T18:16:47.187" Title="How to produce a high-pass filter from a low-pass one?" Tags="|filters|filter-design|lowpass-filter|infinite-impulse-response|highpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20172" PostTypeId="1" AcceptedAnswerId="20173" CreationDate="2015-01-24T00:22:23.250" Score="2" ViewCount="1126" Body="&lt;p&gt;This is probably a simple question, but I have a hard time understanding how c. converts to d. in the following picture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further reading as an answer is acceptable. After all, I am only asking this because the PDF I’m reading doesn't really explain why c. results in d. The more I look at it, the more I am confused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2BCTP.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13482" LastEditorUserId="4655" LastEditDate="2015-01-24T12:09:43.797" LastActivityDate="2015-01-24T12:09:43.797" Title="How does sampling a frequency result in a duplicated spectrum?" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20173" PostTypeId="2" ParentId="20172" CreationDate="2015-01-24T03:05:10.073" Score="2" Body="&lt;p&gt;if you consider the spectrum of analog signal as the figure in your picture.Sampling in time domain is same as multiplying a pulse train to  the analog signal.This means that the frequency response of pulse train is convoluted in frequency domain. The frequency response of pulse train is again a pulse train,hence the spectrum gets duplicated in frequency domain due to its convolution with the pulse train.&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-01-24T03:05:10.073" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20175" PostTypeId="1" AcceptedAnswerId="20179" CreationDate="2015-01-24T07:19:04.463" Score="1" ViewCount="979" Body="&lt;p&gt;I would like to design a very simple MATLAB Gui program to adjust the magnitude of an audio while it is being played via a slider (&lt;code&gt;slider1&lt;/code&gt;). However, the program any adjustment will not response until the audio is finished playing. How could I fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The audio is played after a push button is pressed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nyDTl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function PlayFile_Callback(hObject, eventdata, handles)&#xA;%Reading the audio file&#xA;FrameSize = 2048;&#xA;AR = dsp.AudioFileReader('Filename','test.wav','SamplesPerFrame',FrameSize);&#xA;Fs = AR.SampleRate;&#xA;%initializing audio player&#xA;AP = dsp.AudioPlayer('SampleRate',Fs);&#xA;tic&#xA;Tstop = 30;    %playing time&#xA;&#xA;&#xA; while toc &amp;lt; Tstop&#xA;    gain = get(handles.slider1,'value');  %Get the gain factor&#xA;    audioIn = step(AR);&#xA;    audioOut = audioIn*gain;&#xA;    step(AP,audioOut);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7226" LastActivityDate="2015-01-24T11:18:02.357" Title="Adjust Matlab Gui parameter while playing an audio" Tags="|matlab|audio|" AnswerCount="1" CommentCount="0" ClosedDate="2015-01-25T03:41:20.273" ContentLicense="CC BY-SA 3.0" />
  <row Id="20176" PostTypeId="1" CreationDate="2015-01-24T07:43:49.370" Score="0" ViewCount="319" Body="&lt;p&gt;What is the difference between single channel separation and single microphone separation? Are they equal? &lt;/p&gt;&#xA;" OwnerUserId="13485" LastEditorUserId="4298" LastEditDate="2015-01-24T09:53:46.227" LastActivityDate="2017-04-19T10:25:00.223" Title="Difference between single channel and single microphone separation" Tags="|source-separation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20177" PostTypeId="2" ParentId="20171" CreationDate="2015-01-24T09:51:44.157" Score="10" Body="&lt;p&gt;The result will indeed be a high pass filter. From your difference equation, the transfer function of the low pass filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_l(z)=\frac{\beta}{1-(1-\beta)z^{-1}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\beta=1/\alpha$.&#xA;Note that this is actually a leaky integrator, not a classic low pass filter, because its frequency response does not have a zero at Nyquist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The high pass filter has the transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_h(z)=1-H_l(z)=(1-\beta)\frac{1-z^{-1}}{1-(1-\beta)z^{-1}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has a zero at DC (i.e. at $z=1$), as it should. However, it is scaled, i.e. its value at Nyquist ($z=-1$) is not $1$, but $2(1-\beta)/(2-\beta)$. So in order to have a 0 dB gain at Nyquist, you need to scale your high pass filter with the inverse of that factor:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H'_h(z)=\frac{2-\beta}{2(1-\beta)}H_h(z)=\left(1-\frac{\beta}{2}\right)\frac{1-z^{-1}}{1-(1-\beta)z^{-1}}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can compute the 3dB cut-off frequencies of the low pass filter (1) and of the high pass filter (2) by solving&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H_l(e^{j\omega_c})|^2=\frac12\quad\text{and}\quad |H'_h(e^{j\omega_c})|^2=\frac12$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some algebra this gives for the low pass filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos\omega_c=1-\frac{\beta^2}{2(1-\beta)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and for the high pass filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos\omega_c=\frac{1}{1+\frac{\beta^2}{2(1-\beta)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega$ is the normalized frequency in radians:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega=2\pi\frac{f}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the sampling frequency $f_s$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-25T09:39:35.537" LastActivityDate="2015-01-25T09:39:35.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20179" PostTypeId="2" ParentId="20175" CreationDate="2015-01-24T11:18:02.357" Score="0" Body="&lt;p&gt;As far as I know, the simplest, very old, matlab function to play wave PCM audio is &quot;sound(x,Fs,Nbits)&quot; and it is a high level function that will buffer the entire piece before it is played. And it will not allow adjustment on &quot;x&quot; before it is fully played. If your play function is also similar in mechanism, then you shall consider either using a low level audio playback function or divide your audio into small pieces and send each piece in sequence. However this last method may create problems due to multimedia timing issues. And as a result played audio may have pops &amp;amp; cracks in it.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-01-24T11:18:02.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20180" PostTypeId="1" CreationDate="2015-01-24T16:28:25.767" Score="2" ViewCount="784" Body="&lt;p&gt;I will train my own  cascade, using python and opencv. I want it to be as precise as possible, so as I read it is common that training takes one or two weeks to compile. I want to use cloud computing to not wait that long. I research but cannot find a single guide that explains what to do. I have pozitive and negative images, and a python code. How I can compile my code on cloud with least additional efford? (till now I just use my desktop, just wrote and compile scripts. I have no experience on cloud computing.) I found zero answers when searching opencv,python,cloud computing together. &lt;a href=&quot;https://stackoverflow.com/questions/10452834/opencv-in-the-cloud&quot;&gt;topics like this&lt;/a&gt; are for permanent web applications, I guess. I just want to run the code and get results, basically.&lt;/p&gt;&#xA;" OwnerUserId="13489" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2021-12-04T12:01:30.133" Title="(python+opencv) haar cascade training using cloud computing" Tags="|python|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20181" PostTypeId="1" CreationDate="2015-01-24T18:20:47.970" Score="0" ViewCount="66" Body="&lt;p&gt;In BCI competition 3 dataset 5, It has been stated that we have to take 8-30 Hz frequency and break it with resolution of 2 Hz then it will result in 12 components but I am finding out only 11 components.Why??&#xA;The description can be found out here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.bbci.de/competition/iii/desc_V.html&quot; rel=&quot;nofollow&quot;&gt;http://www.bbci.de/competition/iii/desc_V.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13492" LastActivityDate="2015-09-22T01:16:23.377" Title="Splitting of signal into different components for calculation of PSD" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20183" PostTypeId="2" ParentId="20158" CreationDate="2015-01-24T19:00:57.027" Score="1" Body="&lt;p&gt;I never worked with Python or SciPy, but I don't see the sense in the actions you apparently perform in your code.&#xA;firwin provides you with the time-domain filter coefficients, which are to be convolved with the time-domain signal you wish to filter.&#xA;What you do in your code, is convolve the time-domain filter coefficients with the frequency-domain signal - which makes absolutely no sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the point of converting the signal to freq-domain (doing FFT)? Is the stego analysis/decoding performed in time- or frequency-domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your processing chain requires conversion of the signal to freq-domain, for some purpose, then you don't really need the FIR filter, since you can get rid of the undesired frequency elements once you have the signal in the frequency domain, by simply zeroing-out the undesired frequency bins of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the only reason for calculating FFT of the signal is to filter it - then there is no need to do it, as you can simply convolve the time-domain filter coefficients with the time-domain signal, as I explained.&lt;/p&gt;&#xA;" OwnerUserId="7827" LastActivityDate="2015-01-24T19:00:57.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20184" PostTypeId="2" ParentId="20181" CreationDate="2015-01-24T19:02:51.670" Score="1" Body="&lt;p&gt;&lt;strong&gt;Hint:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i=8+i\cdot 2\;\text{Hz},\quad i=0,1,\ldots,11$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $f_0=8\,\text{Hz}$ and $f_{11}=30\,\text{Hz}$. So you have 12 frequencies in the range $[8,30]\,\text{Hz}$, including both edge frequencies.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-24T19:02:51.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20185" PostTypeId="2" ParentId="20159" CreationDate="2015-01-24T19:12:49.003" Score="0" Body="&lt;p&gt;Rodrane, this is very tough. &#xA;You should either adjust your lighting or adapt your threhsolding algorithm. Also apply some smoothing (possibly edge preserving) before doing the binarization and polar transformation - first do the polar transform, then binarize. For a solution of a similar problem, please see &lt;a href=&quot;https://dsp.stackexchange.com/questions/19793/suggested-preprocessing-methods-for-ocr-on-circular-images/19794#19794&quot;&gt;this SE answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-08-10T07:52:21.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20186" PostTypeId="2" ParentId="20171" CreationDate="2015-01-24T19:20:58.697" Score="6" Body="&lt;p&gt;For an LTI system another method to generate a highpass filter impulse response $h_{hp}[n]$, from an existing lowpass filter impulse reponse $h_{lp}[n]$ is the following: &#xA;$$h_{high}[n]=(-1)^n h_{low}[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the DTFT properties we can see that:&#xA;$$h_{high}[n]=e^{j\pi n} h_{low}[n]$$&#xA;$$H_{high}(e^{j\omega})=H_{low}(e^{j(\omega - \pi)})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which would produce a highpass filter from a lowpass filter, as a result of the right shift by $\pi$ in its spectrum. Note that this highpass filter will have the exact spectral shape of the prototype lowpass filter, however it won't be a complementary highpass counterpart of the given lowpass filter. Which means their spectral sum $H_{lp}(e^{j\omega}) + H_{hp}(e^{j\omega})$ is not unity. In your example, you would get the complementary filter if you use the definition as: $H_{hp}(e^{j\omega})= 1 - H_{lp}(e^{j\omega})$ assuming both DTFTs to be real (zero phase), if they are not, you may define the highpass filter as $$H_{high}(e^{j\omega})= e^{j\omega d} - H_{low}(e^{j\omega})$$&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2017-08-16T13:50:42.817" LastActivityDate="2017-08-16T13:50:42.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20187" PostTypeId="1" CreationDate="2015-01-24T21:30:09.590" Score="0" ViewCount="4551" Body="&lt;p&gt;I want to create a program in matlab that could act like karaoke software. At this moment i have following lines of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;&#xA;[y1, fs1] = audioread('miszmasz.wav');&#xA;[y2, fs2] = audioread('voice.wav');&#xA;&#xA;%checking if there is an audio file&#xA;if y1 == 0&#xA;    return&#xA;elseif y2 == 0&#xA;    return&#xA;end&#xA;&#xA;%spliting into left and righ &#xA;leftSignal = y1(:,1);&#xA;rightSignal = y1(:,2);&#xA;voiceSignal = y2(:,1);&#xA;&#xA;leftSignalLength = length(leftSignal);&#xA;rightSignalLength = length(rightSignal);&#xA;voiceSignalLength = length(voiceSignal);&#xA;&#xA;%furier transform of left, right canal and voice sample&#xA;NFFT = 2^nextpow2(voiceSignalLength);&#xA;leftSignalFFT = fft(leftSignal, NFFT)/voiceSignalLength;&#xA;rightSignalFFT = fft(rightSignal, NFFT)/voiceSignalLength;&#xA;voiceSignalFFT = fft(voiceSignal, NFFT)/voiceSignalLength;&#xA;&#xA;for i1 = 1:leftSignalLength&#xA;    leftSignalFFT(i1) = leftSignalFFT(i1) - voiceSignalFFT(i1);&#xA;end&#xA;&#xA;for i2 = 1:rightSignalLength&#xA;    rightSignalFFT(i2) = rightSignalFFT(i2) - voiceSignalFFT(i2);&#xA;end&#xA;&#xA;leftOutput = ifft(leftSignalFFT);&#xA;rightOutput = ifft(rightSignalFFT);&#xA;finalOutput(:,1) = leftOutput;&#xA;finalOutput(:,2) = rightOutput;&#xA;&#xA;%wavwrite(y_Out, fs1, 'output.wav');&#xA;audiowrite('miszmasz_output.wav', finalOutput, fs1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;unfortunately, it does not work. Any tips?&lt;/p&gt;&#xA;" OwnerUserId="13494" LastActivityDate="2019-03-01T20:05:37.060" Title="removing vocal from audio file" Tags="|matlab|speech-processing|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20188" PostTypeId="2" ParentId="20166" CreationDate="2015-01-24T21:41:40.620" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Assume that the center of the square maps to the center of the vertexes.&lt;/li&gt;&#xA;&lt;li&gt;The vertices in the output are known. Assume they are $(x_1,y_1),...,(x_4,y_4) $&lt;/li&gt;&#xA;&lt;li&gt;Their center is $ ( \frac{x_1+x_2+x_3+x_4}{4},\frac{y_1+y_2+y_3+y_4}{4}) $&lt;/li&gt;&#xA;&lt;li&gt;Now you have 4 degrees of freedom of where to put the points where the color change. &#xA;$ ( w_1 x_1 +(1-w_1) x_2 ,w_1 y_1 +(1-w_1 ) y_2 )  $, and so on&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7XcTB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Areas of each of the 4 parts equal to the areas of two triangles (Can be calculated &lt;a href=&quot;http://www.mathopenref.com/coordtrianglearea.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;analytically&lt;/a&gt;)  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;All of these together should give you enough constraints to find $w_1,w_2,w_3,w_4$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Once you found the weights, you can create a grid based mapping that transforms squares into the required forms.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="698" LastEditorUserId="698" LastEditDate="2015-01-24T22:48:03.793" LastActivityDate="2015-01-24T22:48:03.793" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20189" PostTypeId="2" ParentId="20166" CreationDate="2015-01-24T23:28:30.370" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Except I have an important constraint, the features on the original image must maintain their relative area after the transformation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm assuming you're looking for a smooth transformation, where all areas (not just the 4 squares in your image) maintain their relative sizes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IIRC, this constraint is called &quot;fluid registration&quot;. (I'm pretty sure I've read about it in &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0198528418&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book&lt;/a&gt;, but I can't find my copy right now.) The analogy is of course that if your image was &quot;painted&quot; on an incompressible fluid, and you &quot;moved the fluid around&quot;, areas would stay constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the incompressible fluid analogy it seems clear that such a mapping should be possible for any convex quad, since you can &quot;squish&quot; an incompressible fluid to any convex quad as long as the area stays the same. You even have degrees of freedom left that you can use to make the transformation as smooth as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, the &quot;constant area&quot; constraint means that you're looking for a mapping, where the determinant of the Jacobian of the map is constant. To get the smoothest possible solution, you could e.g. minimize the squared Laplacian. Unfortunately, I don't think there's a closed form solution for this kind of problem, so you'd have to numerical optimize an array of control point to approximate an optimal mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, in Mathematica, you could write something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;targetPts = {{0.36, 0.62}, {0.34, 0.75}, {0.57, 0.58}, {0.76, 0.92}};&#xA;&#xA;(* simple bilinear mapping *)&#xA;grid = Array[&#xA;   Function[{x, &#xA;     y}, {(1 - x)*(1 - y), x*(1 - y), (1 - x)*y, x*y}.targetPts], {10,&#xA;     10}, {{0., 1.}, {0., 1.}}];&#xA;&#xA;offsetVars = Array[var, Dimensions[grid]];&#xA;&#xA;(* correct the bilinear mapping by variable offsets, optimize offsets \&#xA;to get constant area *)&#xA;mappingPts = grid + offsetVars;&#xA;&#xA;areaQ[pts_] := &#xA; 1/2 Det[{pts[[2]] - pts[[1]], pts[[3]] - pts[[1]]}] - &#xA;  Det[{pts[[2]] - pts[[4]], pts[[3]] - pts[[4]]}]&#xA;&#xA;(* area of each 4x4 control point quad *)&#xA;areas = Map[areaQ[Flatten[#, 1]] &amp;amp;, &#xA;   Partition[mappingPts, {2, 2}, {1, 1}], {2}];&#xA;&#xA;(* area difference between adjacent 4x4 control point quad *)&#xA;sameArea = &#xA;  Total[Flatten[{Differences[areas, {0, 1}], &#xA;      Differences[areas, {1, 0}]}]^2];&#xA;&#xA;smoothness = &#xA;  Total[Flatten[{Differences[mappingPts, {2, 0}], &#xA;      Differences[mappingPts, {0, 2}]}]^2];&#xA;&#xA;optimizationProblem = Flatten@{&#xA;    smoothness,&#xA;    Flatten[{Differences[areas, {0, 1}], &#xA;       Differences[areas, {1, 0}]}] == 0,&#xA;    offsetVars[[1, 1]] == 0,&#xA;    offsetVars[[1, -1]] == 0,&#xA;    offsetVars[[-1, 1]] == 0,&#xA;    offsetVars[[-1, -1]] == 0,&#xA;    Table[&#xA;     offsetVars[[1, i]] == &#xA;      borderPos[1, i]*(grid[[1, -1]] - grid[[1, 1]]), {i, 2, 9}],&#xA;    Table[&#xA;     offsetVars[[-1, i]] == &#xA;      borderPos[2, i]*(grid[[-1, -1]] - grid[[-1, 1]]), {i, 2, 9}],&#xA;    Table[&#xA;     offsetVars[[i, 1]] == &#xA;      borderPos[3, i]*(grid[[-1, 1]] - grid[[1, 1]]), {i, 2, 9}],&#xA;    Table[&#xA;     offsetVars[[i, -1]] == &#xA;      borderPos[4, i]*(grid[[-1, -1]] - grid[[1, -1]]), {i, 2, 9}]&#xA;    };&#xA;&#xA;usedVars = &#xA;  DeleteDuplicates[&#xA;   Cases[optimizationProblem, &#xA;    s : (var | borderPos)[i__] :&amp;gt; s, \[Infinity]]];&#xA;&#xA;sol = FindMinimum[&#xA;   optimizationProblem,&#xA;   {#, 0} &amp;amp; /@ usedVars];&#xA;&#xA;solGrid = mappingPts /. sol[[2]];&#xA;g = Graphics[{Line /@ solGrid, Line /@ Transpose[solGrid], Red, &#xA;   PointSize[Large], Point[targetPts]}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives nice, smooth mappings for any quad, like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FOEy0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2015-01-24T23:28:30.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20190" PostTypeId="1" CreationDate="2015-01-24T23:43:00.743" Score="12" ViewCount="66749" Body="&lt;p&gt;I have just started studying Digital Signal Processing. Can someone explain what is the difference between a Discrete Signal and a Digital Signal in simple words?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance !&lt;/p&gt;&#xA;" OwnerUserId="13292" LastActivityDate="2015-01-29T05:39:36.863" Title="Difference between Digital signal and Discrete signal" Tags="|discrete-signals|digital|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20191" PostTypeId="2" ParentId="4821" CreationDate="2015-01-24T23:51:40.853" Score="0" Body="&lt;p&gt;Have you been able to solve this? Im interested in the solution too. There are a couple of articles &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/17278510&quot; rel=&quot;nofollow&quot;&gt;about&lt;/a&gt; this topic. But it is a very difficult problem to solve because there are so many local minima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/312687&quot; rel=&quot;nofollow&quot;&gt;thread&lt;/a&gt; on mathworks has some matlab code that the OP said worked after she edited it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://elastix.isi.uu.nl/&quot; rel=&quot;nofollow&quot;&gt;Elastix&lt;/a&gt; has some nice registration functions that you could call. If you have a good initial guess and strong constraints it might work.&lt;/p&gt;&#xA;" OwnerUserId="5273" LastActivityDate="2015-01-24T23:51:40.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20193" PostTypeId="2" ParentId="20190" CreationDate="2015-01-25T00:48:19.030" Score="19" Body="&lt;p&gt;Suppose you have a continuous time analog signal. It is continuous in both time and amplitude. Now when you sample it ,you get discrete samples every Ts seconds. Now you have discrete samples(discrete in time) each of which can take continuous value( in amplitude). This is normally referred to as discrete signal(discrete in time but continuous in amplitude).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now further when you take this discrete signal and quantise it i.e. say assign each sample which takes continuous amplitude to one of the N discrete quantisation levels of a quantiser, Then your total signal now is a digital signal. So a digital signal is discrete in time and discrete in amplitude.&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="-1" LastEditDate="2015-01-26T15:51:08.143" LastActivityDate="2015-01-26T15:51:08.143" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20194" PostTypeId="1" AcceptedAnswerId="20195" CreationDate="2015-01-25T04:57:22.737" Score="1" ViewCount="3759" Body="&lt;p&gt;I try to combine my 7 band FIR filters into 1 FIR in order to process an audio signal.  I  use convolution to combine their coefficients but the effective is not the same as I apply 7 different FIR filter.  I also have the gain problem &lt;/p&gt;&#xA;&#xA;&lt;p&gt;H = conv(conv(conv(conv(conv(conv(h1,h2),h3),h4),h5),h6),h7)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are&#xA;Is convolution a correct way to do combine multiple FIR filters into one filter&#xA;If not, then what technique should I look into?&#xA;If yes, then what did I do wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="7226" LastActivityDate="2015-01-25T06:44:26.780" Title="Concept of combining multiple FIR Filters into 1 FIR filter" Tags="|filters|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20195" PostTypeId="2" ParentId="20194" CreationDate="2015-01-25T06:44:26.780" Score="4" Body="&lt;p&gt;What you tried to do in your example is combine the filters in series rather than parallel.&lt;br&gt;&#xA;That is, if your signal is $$y = ((x*h_1)*h_2)\ldots*h_7$$ then, according to the associativity property of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;Convolution&lt;/a&gt;, $$y=x*\underset{H}{\underbrace{(h_1*h_2\ldots*h_7)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you wish to perform a parallel filtering then your signal is $$y=\sum_{i=1}^7 x*h_i$$&#xA;and acording to the distributivity property of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow&quot;&gt;Convolution&lt;/a&gt;, $$y=x*\underset{H}{\underbrace{\sum_{i=1}^7 h_i}}$$&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-01-25T06:44:26.780" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20196" PostTypeId="1" CreationDate="2015-01-25T11:12:55.500" Score="4" ViewCount="1445" Body="&lt;p&gt;I am trying to understand why auto and cross correlation helps find the best fit line in least squares. I have an equation as stated here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Ax=b$ -- I have not exact solution, so I use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Least_squares#Linear_least_squares&quot; rel=&quot;noreferrer&quot;&gt;least squares equation&lt;/a&gt;.&#xA;$$A^TAx=A^Tb$$&#xA;I can solve and use the equation but I am trying to figure out why cross and auto correlation helps. Can anyone shed some light on that? For example, what do cross and auto correlation represent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am learning about signal processing and linerisation of a signal. $A$ is the input unpredistoted signal and $b$ is feedback distorted signal. $x$ is the coefficients that will be used to weight the Look Up Table. $Ax=B$ is solved in the adaptive algorithm box, in the link below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.altera.com/end-markets/wireless/advanced-dsp/predistortion/wir-digital-predistortion.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.altera.com/end-markets/wireless/advanced-dsp/predistortion/wir-digital-predistortion.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7145" LastEditorUserId="128" LastEditDate="2019-06-26T08:54:32.643" LastActivityDate="2022-04-19T05:42:05.783" Title="Least Squares and Auto and Cross Correlation" Tags="|autocorrelation|cross-correlation|least-squares|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="20197" PostTypeId="2" ParentId="20190" CreationDate="2015-01-25T11:58:15.797" Score="1" Body="&lt;p&gt;In electrical engineering, the terms &quot;discrete signal&quot; and &quot;discrete-time signal&quot; are used intermittently to denote the same thing, the latter term is more common and more precise. The wording &quot;discrete-time signal&quot; is self-explained to a degree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many engineers and theorists have equated and are equating digital signal processing to signal processing of quantized discrete time signals. There are subtleties, however. The information-theory concept of signal being too hard to squeeze into &quot;simple-word&quot; explanation, I suggest that you learn first what is a &quot;digital waveform&quot;. A waveform is not a signal but may represent a signal in your designs of processing units. For a beginner in DSP studies, knowing what is a digital waveform is a practically useful knowledge with a promise to help you advance through the subtleties of the information-theoretical concept in due time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Digital waveform is a voltage or a current that varies with time between values called &quot;logic levels&quot;, these levels are defined by &quot;digital abstraction&quot; discipline ( &#xA;&lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/video-lectures/6002_l4.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-002-circuits-and-electronics-spring-2007/video-lectures/6002_l4.pdf&lt;/a&gt; ). The varying voltage or current values not always fall into limits prescribed by digital abstraction rules for signals values at logic levels: when switching between levels, a voltage or current, being a continuous function, passes &quot;forbidden&quot; ranges. The same digital abstraction discipline prescribes to consider restrictions not only for values of logic levels, but also for timing parameters, of which the very important are the setup and hold times -- guard time intervals of signal stability surrounding the assertion edge of the clock. See a good tutorial on digital waveforms in &lt;a href=&quot;http://www.ni.com/white-paper/3299/en/&quot; rel=&quot;nofollow&quot;&gt;http://www.ni.com/white-paper/3299/en/&lt;/a&gt; . Quite remarkably, digital waveforms are called digital signals in this tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In (relatively simple) words, digital waveform is a waveform with logical signal levels and timing parameters conforming to digital abstraction rules for a given design. What is a legitimate digital waveform for one design may happen to be inappropriate for another.&lt;/p&gt;&#xA;" OwnerUserId="13498" LastEditorUserId="13498" LastEditDate="2015-01-29T02:30:02.723" LastActivityDate="2015-01-29T02:30:02.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20199" PostTypeId="1" CreationDate="2015-01-25T13:01:16.737" Score="-2" ViewCount="248" Body="&lt;p&gt;I compute the output of a LTI system, can someone tell me if my answer is right..? and help me with my others questions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impulse response is: $h(n) = \left(\frac{1}{2}\right)^nu(n)$ , entry is $x(n)=u(n)-u(n-1)$ in which $u(n)$ is unit sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) We know that the outpout of this LTI system is $y(n)=x(n)*h(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) If replace we take $y(n)=(u(n)-u(n-1))*h(n)=u(n)h(n)-u(n-1)h(n)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) $u(n)*h(n)=h(n)$ and $u(n-1)*h(n)=h(n-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result: $y(n)=h(n)-h(n-1) = \left(\frac{1}{2}\right)^nu(n) - \left(\frac{1}{2}\right)^{n-1}u(n-1)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First of all is this solution right?&lt;/li&gt;&#xA;&lt;li&gt;How we know that the equations (3) stand?&lt;/li&gt;&#xA;&lt;li&gt;Always in these systems in the entry is the unit sequence?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13437" LastEditorUserId="13437" LastEditDate="2015-01-25T16:26:56.457" LastActivityDate="2015-06-16T13:26:57.423" Title="LTI system output" Tags="|impulse-response|linear-systems|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20200" PostTypeId="1" AcceptedAnswerId="20202" CreationDate="2015-01-25T13:28:20.640" Score="0" ViewCount="864" Body="&lt;p&gt;I failed to do this question on the exam and finding it very difficult, I would be glad if you can help me solve it. How shall I start?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0cvUc.png&quot; alt=&quot;DTFT&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8888" LastActivityDate="2015-01-25T14:09:58.570" Title="Discrete Time Fourier Transform to Frequency Domain" Tags="|discrete-signals|fourier-transform|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20201" PostTypeId="1" AcceptedAnswerId="20204" CreationDate="2015-01-25T13:49:07.403" Score="1" ViewCount="3848" Body="&lt;p&gt;I am reading about audio processing for my university project and I found out that DCT basicly filters out some frequencies. I wanted to use for example high-pass filter and then DCT for compression, but isn't dct a filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the difference?&lt;/p&gt;&#xA;" OwnerUserId="13500" LastActivityDate="2015-01-25T18:00:17.780" Title="Is DCT basicly a filter?" Tags="|filters|discrete-signals|dct|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20202" PostTypeId="2" ParentId="20200" CreationDate="2015-01-25T14:09:58.570" Score="1" Body="&lt;p&gt;Most introductory texts on DSP have solved examples of this kind, so you should probably get some good text and work with it. But I'll give you a few hints anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You know that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\Omega})=\sum_{n=-\infty}^{\infty}x[n]e^{-jn\Omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for (a) you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\Omega})=\sum_{n=-\infty}^{\infty}\left(\frac34\right)^n u[n-4] e^{-jn\Omega}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $u[n-4]$ equals zero for $n&amp;lt;4$, (2) simplifies to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\Omega})=\sum_{n=4}^{\infty}\left(\frac34\right)^n e^{-jn\Omega}=&#xA;\sum_{n=0}^{\infty}\left(\frac34\right)^{n+4}e^{-j(n+4)\Omega}=\\=&#xA;\left(\frac34\right)^4e^{-j4\Omega}\sum_{n=0}^{\infty}\left(\frac34\right)^{n}e^{-jn\Omega}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where you can evaluate the final sum using the formula for a geometric series with $r=\frac34e^{-j\Omega}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For (b) you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\Omega})=\sum_{n=-\infty}^{\infty}a^{|n|}e^{-jn\Omega}=\sum_{n=0}^{\infty}a^ne^{-jn\Omega}+\sum_{n=-\infty}^{-1}a^{-n}e^{-jn\Omega}=\\=&#xA;\sum_{n=0}^{\infty}a^ne^{-jn\Omega}+\sum_{n=1}^{\infty}a^{n}e^{jn\Omega}=&#xA;\sum_{n=0}^{\infty}a^ne^{-jn\Omega}+ae^{j\Omega}\sum_{n=0}^{\infty}a^{n}e^{jn\Omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have both sums in the desired form to apply the formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\Omega})=\frac{1}{1-ae^{-j\Omega}}+\frac{ae^{j\Omega}}{1-ae^{j\Omega}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can combine the two terms, which should finally result in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\Omega})=\frac{1-a^2}{1-2a\cos\Omega+a^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please remember that this is basic stuff that you must learn to do yourself. The only way to learn it is by solving the problems which you find at the end of each chapter of any introductory DSP text.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-25T14:09:58.570" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20203" PostTypeId="1" AcceptedAnswerId="20209" CreationDate="2015-01-25T14:57:45.943" Score="0" ViewCount="17639" Body="&lt;p&gt;I know the answers of the below question but I dont know why, except linear, could you explain the rest? Small tick: correct, small tick with dash incorrect answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oa7cS.png&quot; alt=&quot;System Properties&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8888" LastEditorUserId="4298" LastEditDate="2015-01-25T19:58:05.483" LastActivityDate="2015-10-19T06:12:20.883" Title="System Properties; Linear, Causal, Time-Invariant, Stable?" Tags="|discrete-signals|signal-analysis|linear-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20204" PostTypeId="2" ParentId="20201" CreationDate="2015-01-25T15:01:03.443" Score="1" Body="&lt;p&gt;DCT and DFT can be thought of as a bank of bandpass filters.  So it's sort of a filter, but it doesn't remove any part of the signal.  The whole signal is still there, just in a different format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, you could do the DCT on the signal and then high-pass filter by multiplying by the DCT of a high-pass filter's impulse response.  I'd suggest using DFT/FFT first though; it's a little more intuitive, though for a final application DCT has better energy-compaction, and so can compress signals better.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2015-01-25T15:01:03.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20207" PostTypeId="2" ParentId="20201" CreationDate="2015-01-25T18:00:17.780" Score="1" Body="&lt;p&gt;The DFT and DCT are banks of filters that each do circular filter convolution rather than linear filter convolution.  For long enough DFT/DCT windows where you don't care about the data near either end, you might be able to use a single DFT/DCT for filtering by ignoring the wrap-around noise.  But if you want linear convolution filtering using more than one DFT (e.g. the end data of each block is important), then you need to use the DFTs in conjunction with an overlap add/save method/modification.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since sequences of DCT are usually not done using the overlap add/save method, separate filtering is usually done ahead of it.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-01-25T18:00:17.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20208" PostTypeId="2" ParentId="20199" CreationDate="2015-01-25T18:17:54.690" Score="1" Body="&lt;p&gt;There are many misconceptions in your question and in your proposed solution. I won't solve the problem for you, but I'll explain the problems in your solution and I'll give you a hint how to find the correct answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, I suppose that $u[n]$ is the unit step function, and consequently&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(h*u)[n]\neq h[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The confusion about multiplication and convolution has already been pointed out by Dilip Sarwate in his comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the correct way to solve this problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $a[n]$ is the system's step response, i.e. $a[n]=(h*u)[n]$, then, due to linearity and time-invariance, we can write the response $y[n]$ to the given input $x[n]=u[n]-u[n-1]$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=a[n]-a[n-1]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the only thing you need to know is the system's step response $a[n]$, which is obtained by convolving $h[n]$ with $u[n]$. If you write down the convolution sum then you should find that in this case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[n]=u[n]\cdot \sum_{k=0}^{n}h[k]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the given impulse response $h[n]$, evaluating (2) is simple because it is a geometric series. As soon as you have $a[n]$, the output is directly obtained from (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A much simpler route is to realize that the input $x[n]=u[n]-u[n-1]$ is equal to a unit impulse $x[n]=\delta[n]$. This means that the output $y[n]$ is simply given by the impulse response: $y[n]=h[n]$. Note that if you do things right, then this solution and the general solution given by (1) are identical.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-16T13:26:57.423" LastActivityDate="2015-06-16T13:26:57.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20209" PostTypeId="2" ParentId="20203" CreationDate="2015-01-25T19:02:07.030" Score="3" Body="&lt;p&gt;Such questions have been asked here before, and the concepts are simple and important. Dilip Sarwate is right to ask you to add details as to where you get stuck, so we can give better answers (instead of just solving the problem for you).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try to explain the basics in a clear way so that this answer may also be useful for other users, and to help you understand and solve the problem yourself. Assuming you understand linearity, let's move on to the other properties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;time-invariance&lt;/strong&gt;: if $y[n]$ is the response to input $x[n]$, $y[n-m]$ must be the response to $x[n-m]$ for any (integer) $m$. By inspection, this is obviously the case for systems A, B, and D. System C can get slightly confusing for beginners, but just use the criterion to see that for $x[n-m]$ the output is $x[-n-m]$ which does not equal $y[n-m]=x[-(n-m)]=x[-n+m]$. So system C is NOT time-invariant. For system E a simple substitution of the summation index shows you that the system is indeed time-invariant.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;causality&lt;/strong&gt;: this is actually very simple. Just answer the question &quot;does the output signal at any time depend on future values of the input signal?&quot; If the answer is no, then the system is causal, otherwise it isn't. Systems A, B, and D only use the current input value to compute the output, so consequently they are all causal. System E uses the current and past input values, so it's also causal. Only system C is not causal because for negative values of $n$ the output depends on future values of the input.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;stability&lt;/strong&gt;: usually the concept of bounded-input-bounded-output (BIBO) stability is used, which means that if the input signal is bounded, i.e. $|x[n]|\le M$, then also the output signal is bounded, i.e. $|y[n]|\le N$, for some arbitrary positive constants $M$ and $N$. For systems A, B, C, and D this is obviously the case, because the output can never be unbounded for bounded $x[n]$ (assuming that the constants $A$ and $B$ are finite, of course). For system E that's different, because you have an infinite sum which needs to converge for the output to be finite. But for a bounded input signal you can always construct a case where the output is unbounded. Just choose a constant input signal with any finite value, and the sum will grow without bounds. Hence, system E is not BIBO stable.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-25T19:02:07.030" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20211" PostTypeId="2" ParentId="20149" CreationDate="2015-01-26T03:18:15.070" Score="1" Body="&lt;p&gt;I don't know all the details of your problem, such as signal stability, timing accuracy and so on, so I'll presume a few things and suggest using an FFT based Gaussian ratio technique.&lt;/p&gt;&#xA;&lt;p&gt;The technique has been known, although not widely so, since 1991.  Basically, it depends on using a Gaussian window on the input data, followed by an FFT, then it computes frequency and amplitude based on the natural log values of the FFT.  A related technique is used at CERN, and they've done extensive analysis on it.&lt;/p&gt;&#xA;&lt;p&gt;Based on your signals going up to 40 Hz, your minimum sample rate would be 80 Hz.  But since your Fc is 55 Hz, if you have anything from 40 to 55 Hz, it will alias, so your minimum sample rate has to be at least 110 Hz.  And your other requirements may force you to accept a higher rate.&lt;/p&gt;&#xA;&lt;p&gt;But there are other issues independent of sample rate.  First, you have sinusoidal signals from 10 to 40 Hz that exist for 200-300 msec (.2-.3 sec.).  For a 10 Hz input, that works out to be only 2 to 3 cycles (and 8-12 cycles for a 40 Hz input).  And keep in mind that a higher sample rate will not increase either the length of the signal or the number of cycles.&lt;/p&gt;&#xA;&lt;p&gt;Second, since you have a 50-100 msec dead time between signals, you'll have to synchronize your processing with the input.  You may want to have some kind of 'signal present' or 'not present' detector Given that your 10 Hz input would have a different rise/fall time than a 40 Hz input, such a detector may be overly complicated for you.  So in the interest of keeping things simple, let's just presume your signal and dead time are stable with regards to their timing, and you can somehow determine when things start and stop.&lt;/p&gt;&#xA;&lt;p&gt;So let's presume 300 msec signals, and 100 msec dead times for a total of 400 msec (.4 sec).  Since you'll be windowing the inputs, it would be best if you had 50 msec of dead time, followed by 300 msec of signal, followed by 50 msec of dead time.  Windows tend to deemphasize the beginnings and ends of signals, so the above would be desirable.  Maybe you'd need to have a 50 msec dead time detector.  As soon as you determine that exactly 50 msec of dead time have been received, you'd begin to receive the other 50 msec of dead time, then the 300 msec signal, and then another 50 msec dead time (total 400 msec).  You might think that this is very simple - I can assure you that it isn't.  Synchronizing things can present some pretty tricky coding problems, especially if you're using interrupts to get your A/D samples, (or you have asynchronous inputs).&lt;/p&gt;&#xA;&lt;p&gt;Once you've collected one block of data, you'd apply the Gaussian window and compute frequency and amplitude. Then you'd wait for the next block.  You may have to adjust your frequency and amplitude estimates somewhat if you're including the dead time in your FFT (no adjustment needed if you can synchronize exactly and pick out just signal only).&lt;/p&gt;&#xA;&lt;p&gt;As for sample rate, you should probably plan on using 2 to 4 (or more) times the minimum of 110 Hz.  So perhaps 200 to 400 samples/sec. would be appropriate.  More samples/sec will help you better average out the noise.  But it costs more in processing power.&lt;/p&gt;&#xA;&lt;p&gt;Your FFT and buffer size will follow directly from your choice of sample rate.  So if you choose 400 samples/sec, your 300 msec signal plus 100 msec dead time would require: 400 samples/sec x .4 sec = 160 samples.  If your code libraries don't accommodate non-power of 2 FFT sizes, you'll have to crunch the numbers with that restriction in mind.&lt;/p&gt;&#xA;" OwnerUserId="13506" LastEditorUserId="7092" LastEditDate="2021-07-15T15:44:48.270" LastActivityDate="2021-07-15T15:44:48.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20212" PostTypeId="1" CreationDate="2015-01-26T04:17:55.557" Score="0" ViewCount="2408" Body="&lt;p&gt;I do like to generate the FFT from time domain history data (experimental lab) using MATLAB. I am not so sure if my coding is right? Can someone verify the coding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code is as follow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; clc;    &#xA; signalx = Ch1;   &#xA; N=6678;   &#xA; t=Time;&#xA;&#xA; %Plot FFT Vehicle signal  &#xA; zx = fft(signalx);  &#xA; plot(abs(zx));  &#xA; title('FFT Vehicle');  &#xA; xlabel('Frequency [Hertz]')  &#xA; ylabel('Magnitude');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13462" LastEditorUserId="8202" LastEditDate="2015-01-26T08:55:08.560" LastActivityDate="2015-01-28T06:50:36.203" Title="time domain data into FFT using Matlab" Tags="|matlab|fft|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20213" PostTypeId="2" ParentId="20196" CreationDate="2015-01-26T04:51:56.187" Score="1" Body="&lt;p&gt;Cross-correlation and auto-correlation are not directly linked to least squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Least squares can create a line of best fit for a set of points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross correlation is a measure of the similarity of one signal to another (as a function of time lag to one signal). The discrete (digital) cross-correlation is an array where each element tells you how much the signals correlate with a certain amount of time lag. This operation is performed naively with a sliding window, or faster using Fourier, or other transforms. &lt;code&gt;xcorr(a,b) = IFFT(FFT(a)* conj(FFT(b)))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Auto correlation is a measure of the similarity of a waveform to itself as a function of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are normalised variants of cross-correlation and auto-correlation. These are created by measuring the standard deviation of each signal and dividing the output by the multiple of both. This enables you to classify the level of correlation much more easily. 0 implies no correlation and 1 implies identical signals. &lt;/p&gt;&#xA;" OwnerUserId="13486" LastEditorUserId="7092" LastEditDate="2015-01-26T05:05:10.757" LastActivityDate="2015-01-26T05:05:10.757" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20214" PostTypeId="2" ParentId="20212" CreationDate="2015-01-26T05:53:42.147" Score="0" Body="&lt;p&gt;In matlab,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT_OUTPUT = fft(&lt;em&gt;time-domain data&lt;/em&gt;);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's all you need if you just want the output. (not mention the speed of your code)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As in your code,&#xA;It will work! , but has many unnecessary points.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-01-26T05:53:42.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20215" PostTypeId="2" ParentId="20190" CreationDate="2015-01-26T06:02:57.677" Score="0" Body="&lt;p&gt;@Talasila was right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short,    &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Analog(continuous) &gt;&gt; &lt;strong&gt;sampling&lt;/strong&gt; &gt;&gt; discrete &gt;&gt; &lt;strong&gt;quantization&lt;/strong&gt; &gt;&gt; digital&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-01-26T06:02:57.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20216" PostTypeId="2" ParentId="18009" CreationDate="2015-01-26T06:17:43.630" Score="-1" Body="&lt;p&gt;I think your description make it harder to understand the question.&lt;br&gt;&#xA;It would be easier if you show the range of float image you have.&lt;br&gt;&#xA;Is it between 0 and 1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if it is, so you want to cast it into 0-255 integer. right?&#xA;just multiply your image by 255 and round it to integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, this casting will make your image worse (errors from rounding)&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-01-26T06:17:43.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20219" PostTypeId="2" ParentId="18009" CreationDate="2015-01-26T09:53:08.923" Score="2" Body="&lt;p&gt;As pointed out by &lt;a href=&quot;https://dsp.stackexchange.com/users/4112/scott&quot; title=&quot;Scott&quot;&gt;Scott&lt;/a&gt; in comment, the quick'n dirty way of doing it is to just multiply by 255 and taking the integer part of the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual answer is (unfortunately, it's a very common answer to many Image Processing tasks...) &lt;em&gt;&quot;it depends&quot;&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;float images are usually assumed to have values between 0 and 1, but maybe it's not the case of your sensor, in which case you need to pre-multiply the values in th equi'n dirty solution by the inverse of the dynamic range of the data;&lt;/li&gt;&#xA;&lt;li&gt;if you need to perform some contrast enhancement, you can apply this pre-multiplication channel-wise (by first computing the max value for each channel), for all the data at once (by looking for the max among all the channels), or you can allocate the dynamic range in a more astute way (for example by computing histograms as you suggest, or clustering on the data values...);&lt;/li&gt;&#xA;&lt;li&gt;multispectral images contain usually several spectral channels ;-). If you want to visualize your data, then maybe you're also looking for a way to find a mapping between your data and Red-Green-Blue channels. Sensors that deliver Near Infrared-Red-Green data are usually remapped &quot;as is&quot; (following the ordering of the wavelengths), ie NIR -&gt; Red, Red -&gt; Green, Green -&gt; Red, but composite values such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Normalized_Difference_Vegetation_Index&quot; rel=&quot;nofollow noreferrer&quot;&gt;NDVI&lt;/a&gt; can be useful in some contexts;&lt;/li&gt;&#xA;&lt;li&gt;if you have lots of input spectral wavelengths, then you need to choose between visualizing each channel independently, or in a cube...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-01-27T07:54:15.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20221" PostTypeId="1" AcceptedAnswerId="20222" CreationDate="2015-01-26T16:12:03.287" Score="1" ViewCount="215" Body="&lt;p&gt;Some of you may know the infamous Audio EQ Cookbook. &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;You can take a look here.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;We tried to implement the functions there to achieve a  implementation for a Lowpassfilter.&#xA;However, when we try to lower our variable cutoff-frequency, we have some issues. With decreasing cutoff-frequency the signal is increasing in volume. Reaching a distinct treshold at around 4000- 6000Hz the filter stops working, because it computes samplevalues that are ever increasing, reaching around 2000000 shortly after lowering the cutoff frequency.&lt;/p&gt;&#xA;&lt;p&gt;We checked our code multiple times,and the functions from the Cookbook should be right. If someone wants to see the code i can hand it to you later.&lt;/p&gt;&#xA;&lt;p&gt;For any hints or solution we are more than thankful.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; The important part of the code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;float Filter::processFilter(float sample)&#xA;{&#xA;   float unprocessed = sample;&#xA;&#xA;    float processed = (unprocessed) + (computeB1() * x_n_1) + &#xA;        (computeB2() * x_n_2) - (computeA1() * y_n_1)&#xA;        -(computeA2() * y_n_2);&#xA;&#xA;    x_n_2 = x_n_1;&#xA;    x_n_1 = unprocessed;&#xA;&#xA;    y_n_2 = y_n_1;&#xA;    y_n_1 = processed;&#xA;&#xA;&#xA;    return processed;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11466" LastEditorUserId="4346" LastEditDate="2021-11-27T22:46:06.760" LastActivityDate="2021-11-27T22:46:06.760" Title="Question regarding filter implementation - Audio EQ Cookbook" Tags="|filters|filter-design|lowpass-filter|c++|" AnswerCount="1" CommentCount="16" ContentLicense="CC BY-SA 4.0" />
  <row Id="20222" PostTypeId="2" ParentId="20221" CreationDate="2015-01-26T16:43:13.250" Score="1" Body="&lt;p&gt;With the values you provided ($Q=1$, $f_0=5355\,\text{Hz}$, and $F_s=48\,\text{kHz}$) I get the following filter coefficients from the Cookbook formulas:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;b =&#xA;&#xA;   0.11789&#xA;   0.23578&#xA;   0.11789&#xA;&#xA;a =&#xA;&#xA;   1.32248&#xA;  -1.52844&#xA;   0.67752&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the formulas give you denominator coefficients that are not normalized. Many implementations use $a_0=1$, which can be easily achieved by dividing numerator and denominator coefficients by $a_0=1.32248$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maximum pole radius of this filter is $0.72$, which means that we're not at all close to the unit circle, so stability shouldn't be an issue, no matter which implementation you use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can add more information if you like, but from what I know up to now, the most likely problem is a bug in your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just test your filtering routine by using as input sequence &lt;code&gt;x=1,0,0,...,&lt;/code&gt;, which should give the following output (the impulse response):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;ans =&#xA;&#xA;   8.9144e-02&#xA;   2.8131e-01&#xA;   3.6860e-01&#xA;   2.8188e-01&#xA;   1.3694e-01&#xA;   1.3860e-02&#xA;  -5.4140e-02&#xA;  -6.9672e-02&#xA;  -5.2786e-02&#xA;  -2.5313e-02&#xA;  -2.2122e-03&#xA;   1.0411e-02&#xA;   1.3166e-02&#xA;   9.8827e-03&#xA;   4.6767e-03&#xA;   3.4194e-04&#xA;  -2.0007e-03&#xA;  -2.4875e-03&#xA;  -1.8499e-03&#xA;  -8.6361e-04&#xA;  -5.0389e-05&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-26T17:40:55.617" LastActivityDate="2015-01-26T17:40:55.617" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20223" PostTypeId="2" ParentId="20212" CreationDate="2015-01-26T20:39:01.810" Score="1" Body="&lt;p&gt;Just to expand what I wrote in the comment. This is how you should work with the FFT in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compute the FFT of your time signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NFFT = 2^nextpow2(N);&#xA;Y = fft(y,NFFT)/N; % the division by N is to scale the amplitude&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then compute the sampling frequency: (&lt;strong&gt;EDIT&lt;/strong&gt; skip this 2 lines of code if you already know the value of $Fs$)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dt = t(2)-t(1);&#xA;Fs = 1/dt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works if your data are sampled at constant sampling frequency. If it is not the case you need to resample them (it is very easy to do if you convert your data into timeseries and then use the &lt;code&gt;resample&lt;/code&gt; function for timeseries. Look here for more details: &lt;a href=&quot;https://dsp.stackexchange.com/questions/8488/what-is-an-algorithm-to-re-sample-from-a-variable-rate-to-a-fixed-rate/20087#20087&quot;&gt;What is an algorithm to re-sample from a variable rate to a fixed rate?&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, plot the result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f_plot = Fs/2*linspace(0,1,NFFT/2+1); % vector of frequencies for the plot&#xA;figure()&#xA;plot(f_plot,2*abs(Y(1:NFFT/2+1))) % multiplicated by 2 to recover the energy related&#xA;% to the negative frequencies since in this way only half spectrum is plotted&#xA;xlabel(’Frequency’)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-01-28T06:50:36.203" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20224" PostTypeId="1" CreationDate="2015-01-26T21:51:32.413" Score="2" ViewCount="654" Body="&lt;p&gt;I've been following the &lt;a href=&quot;https://www.coursera.org/course/images&quot; rel=&quot;nofollow&quot;&gt;recent lectures&lt;/a&gt; on Coursera for image processing. In the lecture on the use of the discrete cosine transform  (DCT) for image compression, he says that for images that are &quot;Markovian&quot;, the DCT has the same properties as the Karhunen-Loeve Transform. He uses this argument to support the use of the DCT in general image compression, since small subsets of natural images usually have this property. What does &quot;Markovian&quot; mean in this context? Is he referring to &lt;a href=&quot;http://en.wikipedia.org/wiki/Markov_random_field&quot; rel=&quot;nofollow&quot;&gt;Markov Random Fields&lt;/a&gt; where the graph is constructed by pixels as nodes and edges between neighboring pixels? What are some examples of images that violate this property?&lt;/p&gt;&#xA;" OwnerUserId="13516" LastActivityDate="2015-02-26T00:10:42.073" Title="What does it mean for an image to be &quot;Markovian&quot;?" Tags="|image-processing|image-compression|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20225" PostTypeId="1" CreationDate="2015-01-26T21:58:07.227" Score="3" ViewCount="1230" Body="&lt;p&gt;I am recently acquiring data through ADC on signals ranging from $0.1\textrm{ Hz}$ to $50\textrm{ kHz}$ ($F_s = 128\textrm{ kHz}$). I noticed that apart from the white noise, I have something similar to $1/f$ noise with a cutoff frequency near $1\textrm{ Hz}$. There isn't much that I found on equalizing this $1/f$ noise on google. I am wondering what type of filters or algorithms that I can use to equalize the noise and have a flat noise bed in my frequency range as post-processing, so that I can see my input signals without the decay of magnitude caused by $1/f$ noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I am wondering if I am able to equalize this noise, will it cause distortion in my signal in the time domain, or phase response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice, links to references or help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8481" LastEditorUserId="1629" LastEditDate="2016-07-29T11:17:34.787" LastActivityDate="2018-07-22T01:45:31.210" Title="Equalizing $1/f$ noise" Tags="|noise|filtering|equalizer|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20226" PostTypeId="2" ParentId="20224" CreationDate="2015-01-26T22:14:20.953" Score="2" Body="&lt;p&gt;It's a probabilistic model that is assumed to generate the image. To make theoretical computations on the performance of certain image processing tasks such as DCT transforming the image for data compression, the image is modelled with a simple mathematical equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Markov image generation model, is used to produce images where there will be high enough correlation between neighbouring samples. This high correlation is therefore efficiently utilized by a transform such as DCT to achieve compression ratios that is close to the maximum available with a nonpractical KLT (Karhunen Loeve Transform) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, it is not much related with markovian fields. &#xA;The simplest 1-D example of such a markov source model, assuming linear dependence between samples, is like: $$x[n] = \rho x[n-1] + {\omega}[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This simple dependency clearly shows the fact that current sample x[n] is produced from past sample x[n-1] plus a white noise sample w[n], where $\rho$ is the correlating factor and as it is close to 1, samples are highly correlated, when it is close to zero, samples become more noisy and uncorrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a real image, such a model can only predict samples in a very short duration, because of the non-stationarity of the image. This is one of the reasons why DCT based transforms are applied for short lengths of blocks such as 8x8 pixels.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-01-27T00:01:47.487" LastActivityDate="2015-01-27T00:01:47.487" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20227" PostTypeId="2" ParentId="16222" CreationDate="2015-01-27T03:28:32.867" Score="1" Body="&lt;p&gt;A real (non-complex) time-domain input will always give a FFT that is duplicated (mirrored)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some implementations will perform a shift to put the DC (frequency=0Hz) term at index 0. Otherwise you will find the DC term halfway through the array.&lt;/p&gt;&#xA;" OwnerUserId="13486" LastActivityDate="2015-01-27T03:28:32.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20229" PostTypeId="1" CreationDate="2015-01-27T05:49:33.530" Score="0" ViewCount="50" Body="&lt;p&gt;I met with a problem: if I sample audio data at 11kHz (yes, that is slow!) for 10 seconds and apply a Fourier Transform to the data, at what frequency will a 15 kHz tone appear?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the original signal is 15kHz? which is greater than half of sampling rate 5.5kHz, right? and thus alias appears. And then, in this case, how should I find the appears one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="13523" LastActivityDate="2015-01-27T13:50:03.320" Title="When sampling theory condition fails, what should I do?" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20231" PostTypeId="1" CreationDate="2015-01-27T07:22:39.013" Score="5" ViewCount="7432" Body="&lt;p&gt;I'm dealing with a light sensor tracking a bursting LED. Unfortunately signal is weak and there are other light sources in environment. I've used optical filters on sensor but there is still some noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The LED burst with a fixed duration but the distance and time vary. So I'm interested in finding those 5 pixels wide pulses (the height of pulse may be different). The noise is often a square wave with a much lower frequency.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What algorithm can be used to detect those pulse?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MOJKu.png&quot; alt=&quot;sensor signal&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13524" LastActivityDate="2015-03-02T22:12:26.300" Title="Good way to detect pulse with known width with background noise?" Tags="|signal-detection|peak-detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20233" PostTypeId="2" ParentId="20231" CreationDate="2015-01-27T09:33:17.350" Score="1" Body="&lt;p&gt;a very simple, and therefore dangerous, algorithm to apply,  based on your example image, is the following: (it's from the family of Change Detectors)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on the time axis, keep track of the current values for a number of samples, and look for their behaviour. If their change is below a certain small threshold, then deduce that that level corresponds to square-noise wave pulse. Then subtract that value from the overall signal. What will remain is your simple pulses on the local time domain. Do this with a sliding window on the data. You will need some memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a highly nonlinear and simple algorithm, you must select thresholds and local widths very carefully to fit into your prior noise charactherisics otherwise you will distort your own signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may be more sophisticated detectors. But what is your processing environment ?&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-01-27T09:41:48.217" LastActivityDate="2015-01-27T09:41:48.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20234" PostTypeId="1" AcceptedAnswerId="20235" CreationDate="2015-01-27T09:54:21.310" Score="1" ViewCount="4287" Body="&lt;p&gt;I have a 2D image which contains R G and B values. I think this should be purely based on averaging of pixels and selecting the threshold to decided whether this is day picture or night one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you provide any kind of different ideas to solve this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am shifting this question from the &lt;a href=&quot;https://stackoverflow.com/questions/28157035/given-an-image-how-should-i-detect-this-is-a-day-picture-or-night-picture?noredirect=1#comment44685520_28157035&quot;&gt;https://stackoverflow.com/questions/28157035/given-an-image-how-should-i-detect-this-is-a-day-picture-or-night-picture?noredirect=1#comment44685520_28157035&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7251" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2021-05-23T05:31:33.810" Title="Given an image how should I detect this is a day picture or night picture?" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20235" PostTypeId="2" ParentId="20234" CreationDate="2015-01-27T10:15:00.647" Score="4" Body="&lt;p&gt;This will work only if you're dealing with natural scenes (no artificial light sources). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think there are two other possible ways: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) looking for the percentage of dark pixels (define a threshold) that will tell you how many black areas are present in the image. Again, this will work only if we're not considering photos close to artificial light sources. Doing an average of the pixel value will lower the result if you have many lights in the scene, considering only dark areas could lead to better result (if there are enough in the scene).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Natural light have some difference in frequencies than artificial light, you could search which one is more present in the photo. I'm thinking at night pictures of cities for example, where lights are often in the yellow range. But i think this seems easier to say than implement, and looks more conditioned to the type of photo (natural panorama, city images, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: i'm assuming the picture has been taken with the correct exposure time&lt;/p&gt;&#xA;" OwnerUserId="13472" LastEditorUserId="13472" LastEditDate="2015-01-27T10:24:21.740" LastActivityDate="2015-01-27T10:24:21.740" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20236" PostTypeId="1" AcceptedAnswerId="29107" CreationDate="2015-01-27T10:36:55.570" Score="2" ViewCount="373" Body="&lt;p&gt;To obtain the gradient from an image, one can use a linear filter that for example is derrived from the derrivative of a gaussian. Then convolving the image with this linear filter gives you the gradient image.&#xA;The gradient magnitude can also be approximated by use of (grayscale) morphological gradients, such as: (dilation-erosion), (opening-closing), or ((dilation-erosion)-(opening-closing)).&#xA;Why would you resort to using a (grayscale) morphological approximation of the gradient magnitude? Is it any faster or is it different in some cases?&#xA;Thanks,&#xA;Tom&lt;/p&gt;&#xA;" OwnerUserId="13527" LastEditorUserId="128" LastEditDate="2019-06-24T08:49:09.280" LastActivityDate="2019-06-24T08:49:09.280" Title="Morphological Gradient Versus Linear Gradient in Image Processing" Tags="|image-processing|filtering|gradient|morphological-operations|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20238" PostTypeId="2" ParentId="20187" CreationDate="2015-01-27T12:53:36.920" Score="1" Body="&lt;p&gt;If my guess is right, your code show you trying remove the vocal from  second audio, the first audio must be the original vocal and the second is some mix (vocal + music)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if my guess is true start trying a simple approach to test, here my simple test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get just 4096 points of some audio voice and mix with a sine 4096 points in 200hz sampled in 1600hz, all mono.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot 4096 voice points:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p9cls.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now plot a sine in 200 Hz:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1E2tp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the Mix (sine + voice):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YZr4B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to get the original sine without the voice you need do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;real((ifft(fft(mix) - fft(voice_Signal))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The final plot after the step above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2xgJ9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;course is a very simple test, and in this case we're telling you to have the original clean audio voice before being mixed ...&lt;/p&gt;&#xA;" OwnerUserId="1081" LastActivityDate="2015-01-27T12:53:36.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20239" PostTypeId="2" ParentId="20229" CreationDate="2015-01-27T13:50:03.320" Score="3" Body="&lt;p&gt;Because you've sampled at 11kHz the Frequency spectrum becomes periodic with a period of 11 KHz. So you're 15kHz will not only appear at 15 kHz but also at every frequency that is a multiple of 11 kHz away from 15 kHz. So the frequencies at which the 15 KHz tone are given by $ f= 15\times10^3 +N \cdot 11 \times10^3 $, where $N$ is an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By convention you are looking at the frequency bins from -5.5 kHz to 5.5 kHz. Therefore you're 15 kHz tone will appear at 4 KHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if your original signal was real then there is also a freqency component at -15kHz. This also gets extended periodically every 11 kHz - so this will produce a corresponding peak at -4 kHz.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-01-27T13:50:03.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20241" PostTypeId="1" CreationDate="2015-01-27T13:55:17.920" Score="1" ViewCount="94" Body="&lt;p&gt;What would be the key features of an audio track or set of tracks (like 5.1) for identifying film audio tracks that have a clear unbalance between speech levels and sound effects levels (apart from the obvious rms diference between tracks)? And how could they be extracted or calculated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's for a machine learning project about automatic identification of such files and ulterior processing/fixing. The imbalance could be on the same track, or in a combination of several ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="11874" LastActivityDate="2015-05-28T03:15:05.450" Title="Features for audio levels imbalance in films between speeh/music/effects" Tags="|audio|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20244" PostTypeId="1" AcceptedAnswerId="20249" CreationDate="2015-01-27T16:12:16.573" Score="3" ViewCount="335" Body="&lt;p&gt;I can't seem to understand how to derive the &lt;em&gt;&quot;twiddle sum&quot;&lt;/em&gt; property:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}W_{N}^{kn}=N \ \delta[k\bmod N] $$ &#xA;where $$ W_{N} \triangleq e^{\frac{j 2 \pi }{N}} $$&#xA;and $$ \delta[n] \triangleq  \begin{cases}&#xA;     1 &amp;amp; \text{if } n=0 \\&#xA;     0 &amp;amp; \text{otherwise}&#xA;     \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried doing the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;\sum_{n=0}^{N-1}W_{N}^{kn} &amp;amp; = \sum_{n=0}^{N-1}e^{\frac{j 2 \pi k n}{N}} \\&#xA; &amp;amp; = \sum_{n=0}^{N-1} \left( e^{\frac{j 2 \pi k}{N}} \right)^n \\&#xA; &amp;amp; = \frac{1 - \left( e^{\frac{j 2 \pi k}{N}} \right)^N}{1 - e^{\frac{j 2 \pi k}{N}}} \\&#xA; &amp;amp; \\&#xA; &amp;amp; = \frac{1 - e^{j 2 \pi k}}{1-e^{\frac{j 2 \pi k}{N}}} \\&#xA; &amp;amp; \\&#xA; &amp;amp; = \begin{cases}&#xA;    ?? &amp;amp; \text{if } k=mN \quad\quad m\in \mathbb{Z} \\&#xA;     0 &amp;amp; \text{otherwise} \quad k \in \mathbb{Z}&#xA;     \end{cases} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems I'm missing an $N$ before the delta, have I done a mistake ?&lt;/p&gt;&#xA;" OwnerUserId="11323" LastEditorUserId="724" LastEditDate="2015-01-28T10:38:54.693" LastActivityDate="2015-01-28T10:38:54.693" Title="Deriviation of the &quot;Twiddle Sum&quot; property" Tags="|dft|math|derivation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20246" PostTypeId="1" AcceptedAnswerId="20250" CreationDate="2015-01-27T17:49:17.317" Score="6" ViewCount="34848" Body="&lt;p&gt;I was just wondering... The formula I learned to calculate the energy of the signal is expressed in the time domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E_x^{\text{time}} = \sum_{n=-\infty}^{\infty} |x[n]|^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, what does the amount of energy gotten from the magnitude spectrum mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E_x^{\text{frequency}} = \sum_{f=0}^{fs/2} |X[f]|^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supposing that both amplitudes are expressed in decibels, &lt;span class=&quot;math-container&quot;&gt;$fs/2$&lt;/span&gt; is the maximum representable frequency (by Nyquist theorem), and &lt;span class=&quot;math-container&quot;&gt;$E_x^{\text{frequency}}$&lt;/span&gt; is taken over the same time frame as &lt;span class=&quot;math-container&quot;&gt;$E_x^{\text{time}}$&lt;/span&gt;. Should the quantities be the same?&lt;/p&gt;&#xA;" OwnerUserId="7316" LastEditorUserId="47251" LastEditDate="2020-02-04T20:14:33.473" LastActivityDate="2020-02-04T20:14:33.473" Title="Energy calculation in frequency domain" Tags="|fourier-transform|magnitude|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="20247" PostTypeId="2" ParentId="20244" CreationDate="2015-01-27T18:24:44.690" Score="4" Body="&lt;p&gt;The key is in the last step of your work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{1 -e^{j2\pi k}}{1-e{\frac{j2\pi k}{N}}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $k$ is some integer multiple of $N$, then the exponents in the numerator and denominator are both some integer multiple of $j2\pi$. In this case, both exponential functions are equal to 1, meaning that the expression above is equal to $\frac{0}{0}$ for $k$ an integer multiple of $N$. That's an indeterminate form, and is &lt;em&gt;not&lt;/em&gt; equal to one in the general case as you assumed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, we evaluate the limit of the above expression as $k \to mN$, where $m$ is an integer. We can do so using &lt;a href=&quot;https://en.wikipedia.org/wiki/L%27H%C3%B4pital%27s_rule&quot; rel=&quot;nofollow&quot;&gt;L'Hopital's rule&lt;/a&gt;, as RBJ pointed out in the comment above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\lim_{k \to mN} \frac{1 -e^{j2\pi k}}{1-e{\frac{j2\pi k}{N}}} = \lim_{k \to mN}  \frac{\frac{d}{dk} \left(1 -e^{j2\pi k}\right)}{\frac{d}{dk} \left(1-e{\frac{j2\pi k}{N}}\right)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; = \frac{j2\pi e^{j2\pi k}}{\frac{j2\pi}{N} e^{j2\pi k}} = N&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's your missing factor of $N$.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-01-27T18:24:44.690" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20248" PostTypeId="1" CreationDate="2015-01-27T19:09:31.907" Score="1" ViewCount="92" Body="&lt;p&gt;Can someone tell me if the way I solved this problem is right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a signal $X_a(t)= 0.5cos(700πt)+0.6cos(720πt)+0.1cos(780πt)$ where $F_s=8000Hz$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to determine the minimum samples which must be available in order the frequency resolution of DFT be ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Firstly calculate each frequency of the signal:&#xA;$F_1=350Hz$, $F_2=360Hz$, $F_3=390Hz$&lt;/li&gt;&#xA;&lt;li&gt;Calculate the differences: $F_2$-$F_1$=$10Hz$ ,$F_3$-$F_2$= $30Hz$ , $F_3$-$F_1$= $40Hz$&lt;/li&gt;&#xA;&lt;li&gt;$ΔF_{min}$=$10Hz$&lt;/li&gt;&#xA;&lt;li&gt;$ΔF$ = $ \frac{f_s}{N} $, so $N\geq\frac{8000Hz}{10}$=800 samples&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can someone tell me if my solution is right and explain why we choose the minimum difference&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10343" LastActivityDate="2015-01-28T01:36:34.067" Title="Determine Frequency Resolution samples" Tags="|frequency|continuous-signals|" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20249" PostTypeId="2" ParentId="20244" CreationDate="2015-01-27T19:24:42.803" Score="6" Body="&lt;p&gt;The most straightforward way to see this is to note that for $k=mN$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W_N^{kn}=e^{j2\pi mnN/N}=e^{j2\pi mn}=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the sum for the case $k=mN$ is simply&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}1=1+1+\ldots+1=N$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the solution using L'Hopital's rule is a bit dubious because for $k=mN$ the &lt;a href=&quot;http://en.wikipedia.org/wiki/Geometric_series#Formula&quot; rel=&quot;nofollow&quot;&gt;formula for the geometric series&lt;/a&gt; is not valid because the terms are all equal to one (note the $r\neq 1$ condition in the link above). So you arrive at an expression that is only valid for $k\neq mN$, and then you somehow massage it into a solution that also works for $k=mN$, but this is bad math, even for engineers.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-01-27T19:55:22.460" LastActivityDate="2015-01-27T19:55:22.460" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20250" PostTypeId="2" ParentId="20246" CreationDate="2015-01-27T19:35:44.653" Score="13" Body="&lt;p&gt;You need &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;noreferrer&quot;&gt;Parseval's theorem&lt;/a&gt;. For the discrete-time Fourier transform (DTFT) you have the following relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}|x[n]|^2=\int_{-1/2}^{1/2}|X(f)|^2df\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f$ is normalized by the sampling frequency. For the DFT you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}|x[n]|^2=\frac{1}{N}\sum_{k=0}^{N-1}|X[k]|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So due to Parseval's theorem it is always possible to compute a signal's energy in the time domain as well as in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-27T19:35:44.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20251" PostTypeId="1" AcceptedAnswerId="20257" CreationDate="2015-01-27T19:44:30.133" Score="0" ViewCount="4498" Body="&lt;p&gt;I have position and acceleration measurements and I would like to apply a Kalman filter to estimate the velocity of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure yet about how to procede, but I will check the already answered questions on this website (like &lt;a href=&quot;https://dsp.stackexchange.com/questions/3292/estimating-velocity-from-known-position-and-acceleration?lq=1&quot;&gt;Estimating velocity from known position and acceleration&lt;/a&gt; , &lt;a href=&quot;https://dsp.stackexchange.com/questions/11506/kalman-filter-with-accelerometer-with-dc-offset&quot;&gt;Kalman filter with accelerometer with DC offset&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/11374/applying-kalman-filter-to-a-data-set&quot;&gt;Applying Kalman filter to a data set&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I have understood how to procede, I will implement it using Matlab. There I saw there are 2 different types of Kalman filter: discrete and continuous. What is the difference? I mean, what is the difference of working with one or the other?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; to be more clear, I am referring to function &lt;code&gt;kalman&lt;/code&gt; and &lt;code&gt;kalmd&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I work with a set of data, should I use the discrete one?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2021-01-17T10:29:17.247" Title="Discrete or continuous Kalman filter?" Tags="|matlab|kalman-filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20252" PostTypeId="1" AcceptedAnswerId="20258" CreationDate="2015-01-27T20:23:44.690" Score="2" ViewCount="764" Body="&lt;p&gt;I can use the following type of barcodes in my project:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Code 39&lt;/li&gt;&#xA;&lt;li&gt;Code 128&lt;/li&gt;&#xA;&lt;li&gt;QR Code&lt;/li&gt;&#xA;&lt;li&gt;Data Matrix&lt;/li&gt;&#xA;&lt;li&gt;PDF-417&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;They will be printed with standard office printers and with boca printers. It should also be possible to show them on smartphone screens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They will be read with webcams or Windows tablets. It would also be helpful I could buy an USB barcode reader or something similar to use with this codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data in the code will be text and numbers, at least 10 characters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which barcode type is most suitable for this situation? The most critical factor is the fault toleration, this has to be as low as possible on the mentioned media.&lt;/p&gt;&#xA;" OwnerUserId="13536" LastActivityDate="2018-07-06T00:39:17.543" Title="What is the ideal type of barcode for paper tickets?" Tags="|image-processing|object-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20253" PostTypeId="2" ParentId="20241" CreationDate="2015-01-27T21:31:35.237" Score="1" Body="&lt;p&gt;I would try a sum and difference calculation between the L and R channels to start. Usually when film audio is mixed, the speech is in both channels in phase while the special effects is out of phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = L+R;&#xA;Y = L-R;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;X&lt;/code&gt; should give you the signal with more speech and &lt;code&gt;Y&lt;/code&gt; should give you the other effects. Then if you do an RMS calculation on X and Y, you can find how much are they off by. &lt;/p&gt;&#xA;" OwnerUserId="13537" LastEditorUserId="7092" LastEditDate="2015-01-27T22:38:45.153" LastActivityDate="2015-01-27T22:38:45.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20254" PostTypeId="2" ParentId="20241" CreationDate="2015-01-27T23:20:46.000" Score="1" Body="&lt;p&gt;To find level mismatches between speech &amp;amp; SFX, you may first need to identify where there is speech and look at loudness &amp;amp; spectral power. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the &lt;a href=&quot;https://stackoverflow.com/questions/19765486/matlab-code-for-harmonic-product-spectrum&quot;&gt;Harmonic Product Spectrum (HPS)&lt;/a&gt; as an inexpensive algorithm to estimate the pitch, that is also immune to various kinds of noise. The pitch of speech has well understood, band-limited, harmonic structure, that make it a good feature to discriminate when you have speech vs non-speech/SFX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking this idea further, you might characterize speech by using formant-like features or traditional speech recognition features like MFCC or PLP.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-01-27T23:20:46.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20255" PostTypeId="1" CreationDate="2015-01-27T23:57:00.290" Score="0" ViewCount="133" Body="&lt;p&gt;$$r_x(t)=\begin{cases}&#xA;2-2t    ,&amp;amp;   0 \le t \le 1\\&#xA;2+2t ,&amp;amp; -1 \le t \le 0&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I get original $x(t)$ from this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried integrating the equations, and the value I got was $1$.&lt;/p&gt;&#xA;" OwnerUserId="13538" LastEditorUserId="7092" LastEditDate="2015-03-03T04:06:31.800" LastActivityDate="2015-03-03T04:06:31.800" Title="regarding autocorrelation and derivation of original signal" Tags="|autocorrelation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20256" PostTypeId="2" ParentId="20248" CreationDate="2015-01-28T01:30:42.527" Score="1" Body="&lt;p&gt;It's usually considered difficult to resolve a pair of adjacent frequencies unless there is dip between the two FFT peaks.  Depending on the window (rectangular or otherwise) and how much of a dip you require between the two peaks to consider them resolved (above some floor), and whether or what kind of result interpolation you use, you will need from a bit less than double to triple or more of your suggested 800 FFT result bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course in a-priori zero noise, your signal of 3 pure sinusoids has 9 free parameters, so you might be able to determine your 3 input frequencies with perhaps as few as 9 or a bit more non-aliased samples.  In any case, much less than 800.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resolution of a single isolated frequency peak above a low enough noise floor to the nearest 10Hz can likely be done using far fewer than 800 samples by using interpolation methods on the FFT result, depending on the SNR.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-01-28T01:36:34.067" LastActivityDate="2015-01-28T01:36:34.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20257" PostTypeId="2" ParentId="20251" CreationDate="2015-01-28T05:09:47.603" Score="3" Body="&lt;p&gt;I don't have experience with continuous time kalman filters.  However from your description it sounds like you are making measurements of position and acceleration over time.  If these measurements are sampled, meaning you have individual measurements associated with time, you should be using the discrete time kalman filter.  I feel comfortable broadly stating if you are trying to implement the filter on a pc (matlab), microcontroller, fpga, or dsp based on a set of measurements you are implementing the discrete time filter.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your edits, I more clearly understand your question.  I don't have experience with Matlab's built-in kalman filter functions but a quick read of the comments in kalmd seem to indicate to me you want to use kalman and not kalmd.  Below is a snippet pasted from kalmd that should make it clear.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%   The LTI system SYS specifies the plant data (A,[B G],C,[D 0]).&#xA;%   The continuous plant and covariance matrices (Q,R) are first &#xA;%   discretized using the sample time Ts and zero-order hold &#xA;%   approximation, and the discrete Kalman estimator for the &#xA;%   resulting discrete plant is then calculated with KALMAN.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This text tells me the function is expecting a continuous function which it then evaluates/discretizes, and then calls the kalman function to create a discrete filter.  From the sounds of it you already have discrete data (measurements over time).  Hence kalman is what you want to use.&lt;/p&gt;&#xA;" OwnerUserId="11355" LastEditorUserId="11355" LastEditDate="2015-01-29T01:14:18.530" LastActivityDate="2015-01-29T01:14:18.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20258" PostTypeId="2" ParentId="20252" CreationDate="2015-01-28T09:19:18.747" Score="5" Body="&lt;p&gt;First, about the USB barcode reader: at my previous job (QA at a label printer company), we had one from Scanology. It worked as a keyboard device, the scanned data is sent to the pc as if it were typed. So you don't need any special software.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Code 39 has no error correction, but even a single misread line won't result in wrong data, because it simply won't produce a valid character. So you either get valid data, or you get nothing.&#xA;A major advantage of code 39 is that you don't need barcode software, you can simply use a barcode font.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Code 128 is slightly better than code 39 in terms of error detection, but still no fault tolerance. And you can't use a barcode font. In your case, you would use 128A (0-9, A-Z and a few special chars).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If your most critical factor is fault tolerance, then I would suggest QR, with high error correction setting, which gives up to 30% redundancy. This means that up to 30% of your QR code can be unreadable before the scanner gives up. The Wikipedia page on QR shows an example of a torn QR code that is still readable: &lt;a href=&quot;http://en.wikipedia.org/wiki/QR_code#Error_correction&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/QR_code#Error_correction&lt;/a&gt;&#xA;Another advantage is that it can be scanned in any direction, and it's a quite popular format.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Data Matrix and PDF-417 are similar to QR in terms of fault tolerance, but they are not widely supported for smartphones. I scanned thousands of QR and PDF-417 codes during my time as QA engineer at that label printer company, and I found a lot of high quality QR scanning software for Android and iPhone, but hardly any for PDF-417 and Data Matrix. I assume the situation will be the same (or worse) for Windows Phone.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My advice:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Easy implementation: Code 39. Use a Code 39 barcode font. Works with cheaper barcode scanners.&lt;/li&gt;&#xA;&lt;li&gt;Very high fault tolerance: QR at level H (High). Use the ZXing library. Handheld USB barcode scanners may cost a tiny bit more.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13540" LastEditorUserId="13540" LastEditDate="2015-01-28T12:45:38.553" LastActivityDate="2015-01-28T12:45:38.553" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20259" PostTypeId="1" CreationDate="2015-01-28T11:44:37.173" Score="2" ViewCount="1009" Body="&lt;p&gt;I am having a hard time in trying to use a Kalman filter to obtain velocity&#xA;from acceleration and position measurements. I think the main reason is that&#xA;I am not familiar with Kalman filters (I had only a couple of lectures about it&#xA;and I implemented it only once).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start I had a look to some questions here and also on a paper I found...&#xA;and now I am confused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what the paper says: the noisy acceleration measurement is the driving input&#xA;and the measurements are the measured noisy states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equations for the measurement dynamics can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{bmatrix}\dot{x} \\ \ddot{x}\end{bmatrix} = \begin{bmatrix}&#xA;0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{bmatrix}\begin{bmatrix} x \\ \dot{x}\end{bmatrix}+&#xA;\begin{bmatrix}0 \\ 1\end{bmatrix} \ddot{x_a} + &#xA;\begin{bmatrix}0 \\1\end{bmatrix}\eta_a$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y = x_a = [1 \ 0] \begin{bmatrix} x \\ \dot{x} \end{bmatrix} + \eta_d$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\eta$ terms take into account the bias and noise errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dot{x} = Ax+Bu+v$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y = Cx+w$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v$ and $w$ describe the noise in the accelerometer and displacement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The feedback estimation formulation for the state estimates \hat{x} is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dot{\hat{x}} = A \hat{x} + B u - L (y-C \hat{x})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $L = [l_1 \ l_2]^T$ represents the desired feedbagk gains&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it keeps going talking about the dynamics of the error signal $\epsilon = x-\hat{x}$&#xA;and analysing the steady-state error $\epsilon_{SS} = - [A-LC]^{-1}(v+Lw)$ it&#xA;comes to the conclusion that the state vector needs to be augmented:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{bmatrix}\dot{x} \\ \ddot{x} \\ \dot{\eta}_a \end{bmatrix} =&#xA;\begin{bmatrix}0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}  \begin{bmatrix} x \\ \dot{x} \\ \eta_a \end{bmatrix} +&#xA;\begin{bmatrix}0 \\ 1 \\ 0 \end{bmatrix} \ddot{x}_a + \begin{bmatrix}0 \\ 0 \\ 1 \end{bmatrix} \dot{\eta}_a $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y = [1 \ 0 \ 0] \begin{bmatrix} x \\ \dot{x} \\ \eta_a \end{bmatrix} + \eta_d$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do not understand is where the velocity (which I need to estimate) comes into play in this formulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I had a look at this question &lt;a href=&quot;https://dsp.stackexchange.com/questions/3292/estimating-velocity-from-known-position-and-acceleration?lq=1&quot;&gt;Estimating velocity from known position and acceleration&lt;/a&gt;, but I do not get how to write the state matrix $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, if the state vector is $[x \ \dot{x} \ \ddot{x}]^T$ (as said in the answer) then I should write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{bmatrix} \dot{x} \\ \ddot{x} \\ \dddot{x} \end{bmatrix}= \begin{bmatrix} &amp;amp; &amp;amp; \\ &amp;amp; &amp;amp;  \\ &amp;amp; &amp;amp;  \end{bmatrix} \begin{bmatrix} x \\ \dot{x} \\ \ddot{x} \end{bmatrix} + B u$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First question, what are the equations I have to use to fill matrix $A$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are $B$ and $u$ in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why 2 such different approaches to model this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, once I have found the correct formulation of the problem I have to compute the matrix $L$ and this can be done using the Matlab function &lt;code&gt;kalman&lt;/code&gt; (knowing the covariance matrices of $v$ and $w$). After that do I have to integrate the equation of the observer &#xA;$\dot{\hat{x}} = A \hat{x} + B u - L (y-C \hat{x})$ to get my estimated state?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-01-29T10:01:40.630" Title="Velocity estimation knowing acceleration and displacement from measurements using Kalman filter" Tags="|matlab|kalman-filters|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20261" PostTypeId="1" CreationDate="2015-01-28T15:09:34.167" Score="0" ViewCount="811" Body="&lt;p&gt;I have been acquiring data through ADC and into memory, the input signal are square waves that step down in frequency as time goes by. Due to memory, I have a fixed maximum number of samples per FFT. But I would like to compare their magnitudes, and phase along side each other. The max length of FFT is good enough for frequency resolution, I am just wondering if I have a bunch of data that's been processed through FFT, can I sort of just add them to combine their total magnitude and phase? or will the addition cause bias and distortion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I was wondering since I noticed that at low frequencies, the flicker noise seems to increase the noise floor, is it possible to have a magnitude correction filter or equalizer to push the rest of the signals up such that I can have a common noise floor when I go through all my input signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8481" LastActivityDate="2015-01-28T15:09:34.167" Title="Combine multiple FFT" Tags="|fft|filters|signal-synthesis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20262" PostTypeId="1" CreationDate="2015-01-28T16:25:13.230" Score="0" ViewCount="86" Body="&lt;p&gt;I am new in this field (junior year) and I have a question may a little lazy for the majority of the forum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a speech signal $ x(t)=0.4\cos(100πt)+0.3\cos(1800πt)+0.2\cos(980πt)$ and I know that the sampling frequency is $F_s=1000$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to find the signal form after sampling the only thing I have to do is replace $t$ with $κT$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x(κT)=0.4\cos(100πκT)+0.3\cos(1800πκT)+0.2\cos(980πκT)$ but $T=1/1000$&#xA;so $x(k)= 0.4\cos(0.1πκ )+0.3\cos(0.18πκ )+0.2\cos(0.98πκ )$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the solution and the notation OK?&lt;/p&gt;&#xA;" OwnerUserId="13355" LastEditorUserId="8202" LastEditDate="2015-01-28T16:51:22.623" LastActivityDate="2015-01-29T15:51:13.597" Title="Signal Sampling" Tags="|frequency|sampling|time-frequency|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20264" PostTypeId="1" CreationDate="2015-01-28T21:57:36.803" Score="3" ViewCount="72" Body="&lt;p&gt;I am trying to wrap my head around the original wavelet shrinkage papers of Donoho and others from the mid-90s. There are a couple of curious things that confuse me, and I'd appreciate some input:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The universal threshold is often (and also in secondary literature) given as $\sigma\sqrt{2\ln n}$, but sometimes I see $\frac{\sigma}{\sqrt{n}}\sqrt{2\ln n}$, e.g. in &quot;Wavelet Shrinkage: Asymptopia?&quot;. The latter seems utterly wrong...&lt;/li&gt;&#xA;&lt;li&gt;The minimax threshold $\lambda^\star_n$ as defined in &quot;Ideal spatial adaptation by wavelet shrinkage&quot; has the property that $(\lambda^\star_n)^2 = 2\ln(n+1) - 4\ln(\ln(n	+1)) - \ln 2\pi + o(1)$. I've tried to use the square root of this to derive values for $\lambda^\star_n$  (ignoring the $o(1)$, guess that's what's causing my problem?), however, they are very different from the ones in table 2. Is there an explicit formula or algorithm for $\lambda^\star_n$?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13550" LastActivityDate="2015-01-28T21:57:36.803" Title="Clarification about wavelet thresholds" Tags="|wavelet|thresholding|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20265" PostTypeId="1" CreationDate="2015-01-28T22:42:41.573" Score="0" ViewCount="60" Body="&lt;p&gt;I cannot find anything truly helpful in my book, and I find mostly theoretical answers and not practical. &#xA;So I am posting the exact exercise I want to solve, and through it I hope I'll work some things out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our data is that we filter voice/speech signals with this filter:&#xA;$y(n) = x(n) - 0.8 x(n-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. What's the impulse response of the filter&#xA;&lt;br&gt;b. What's the measure of the frequency response of the filter, in dB, on the frequency $2000 Hz$. The sampling frequency is $Fs = 16000 Hz$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started doing this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(n) = x(n) - 0.8x(n-1)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(z) = X(z) - 0.8X(z^{−1})$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(z) = X(z) [1 -0.8z^{-1}]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = Y(z) / X(z) = 1 - 0.8z^{-1} / 1 = 1 - 0.8z^{-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I think I'm not there at all. And I actually don't get the first step where $y(n)$ becomes $Y(z)$ etc. Why do this? &#xA;&lt;br&gt;And how do I now if I have a FIR or an IIR? [and what does this affect?]&lt;/p&gt;&#xA;" OwnerUserId="13549" LastEditorUserId="7092" LastEditDate="2015-01-28T22:48:25.970" LastActivityDate="2015-01-28T22:48:25.970" Title="Find impulse response and frequency response through given filter" Tags="|filters|impulse-response|frequency-response|" AnswerCount="0" CommentCount="4" ClosedDate="2015-02-03T19:08:50.590" ContentLicense="CC BY-SA 3.0" />
  <row Id="20266" PostTypeId="2" ParentId="20190" CreationDate="2015-01-29T05:39:36.863" Score="-3" Body="&lt;p&gt;Digital signal is a continuous signal.Discrete signal is a non continuous signal.&#xA;i.e the digital signal is present at all time(continuous signal). the discrete signal is present some time values only(non continuous signal)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vPLoT.png&quot; alt=&quot;example for digital signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rXHyD.jpg&quot; alt=&quot;example for discrete signal&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13552" LastActivityDate="2015-01-29T05:39:36.863" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20267" PostTypeId="1" AcceptedAnswerId="20298" CreationDate="2015-01-29T06:17:50.413" Score="1" ViewCount="451" Body="&lt;p&gt;Can someone verify this statement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hold operator is assumed to be a zero order hold&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the laplace transform of this hold operator has a well known form $(1-e^{-sT})/s$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let w approach 0, we see that our resulting function is $(1-e^{\alpha T})/\alpha$ where $s = \alpha + j\omega$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does it mean for the time hold operator to be approximated by time delay of T/2? How can delaying a signal be equivalent to holding that signal&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-01-31T10:53:50.437" Title="Claim: Given sampling time T, the hold operator is approximated at low frequency by a time delay of T/2" Tags="|sampling|z-transform|laplace-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20268" PostTypeId="2" ParentId="20086" CreationDate="2015-01-29T08:50:25.423" Score="4" Body="&lt;p&gt;Wavelets are not key to denoising. There are different ways to denoise an image, for example in the original signal domain or in the transform domain (i.e. Fourier or wavelet). Wavelets work best for additive noise, where the noise is random &amp;amp; not correlated in time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wavelet_denoise (float *fimg[3], unsigned int width,&#xA;     unsigned int height, float threshold, double low, float a, float b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above function, the image is passed in as &lt;strong&gt;fimg[3]&lt;/strong&gt;, representing the &lt;a href=&quot;http://en.wikipedia.org/wiki/RGB_color_model&quot; rel=&quot;nofollow&quot;&gt;RGB&lt;/a&gt; channels of the image. The image is decomposed, thresholded &amp;amp; re-written back into &lt;strong&gt;fimg&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, the wavelet transform is a fast hierarchical scheme for processing an image using a set of consecutive lowpass and highpass filters, followed by a decimation. This results in a decomposition into different scales which can be regarded as different “frequency bands”, determined by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Mexican_hat_wavelet&quot; rel=&quot;nofollow&quot;&gt;mother wavelet&lt;/a&gt;, see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hat_transform (temp, fimg[lpass] + col, width, height, 1 &amp;lt;&amp;lt; lev);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lowpass filter outputs are called approximation coefficients &amp;amp; highpass filters are referred to as detail coefficients. The detail coefficients have high values in the noisy parts of the signal. To threshold, each coefficient is compared to a threshold value and attenuated/shrunk by some factor. Finally, the image (&lt;strong&gt;fimg&lt;/strong&gt;) is reconstructed from the thresholded wavelet coefficients.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-01-29T08:50:25.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20270" PostTypeId="2" ParentId="19289" CreationDate="2015-01-29T15:00:11.537" Score="0" Body="&lt;p&gt;Take the amplitude spectrograms and then cross-correlate them along the time dimension and find the peak of the cross-correlation.  Same as Shazam, but simpler and more robust because a lot of the complexity of Shazam is just data reduction for transmitting over the internet.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2015-01-29T15:00:11.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20271" PostTypeId="2" ParentId="20262" CreationDate="2015-01-29T15:51:13.597" Score="2" Body="&lt;p&gt;First there was a mistake in the simplification - when you divided by $T$. It should be $x(k)= 0.4\cos(0.1πk )+0.3\cos(1.8πk )+0.2\cos(0.98πk )$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that you sampling frequency is 1000 Hz, but your signal contains frequencies: of 50, 900 and 490 Hz. Therefore the 900 Hz will be aliased. To see what frequency it gets aliased to consider&#xA;$$\cos (2\pi900nT) =  \cos (2\pi900nT+mnT2\pi)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $mnT$ is an integer, but $n$ is always an integer and $T$ is fixed by your problem. Therefore we require $m=\frac{p}{T}$, where $p$ is and integer. In other words $m$ must be a multiple of your sampling frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case let $m=-1000$ then we have&#xA;$$\cos (2\pi900nT-1000nT2\pi)= \cos (2\pi(900-1000)nT)$$&#xA;Performing the final simplification we get:&#xA;$$ \cos (2\pi900nT)= \cos (-2\pi100nT) =\cos (2\pi100nT)$$&#xA;Note - the last equality just uses the properties of cosine - even function. Therefore your 900Hz frequency looks exactly like a 100 Hz tone when sampled at 1000 Hz.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-01-29T15:51:13.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20272" PostTypeId="1" CreationDate="2015-01-29T17:08:27.490" Score="1" ViewCount="363" Body="&lt;p&gt;I have been trying to use the Fourier transform in recognizing images of the same size 200x400.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried many different ways to do that such as:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Performing the Fourier on the full image&lt;/strong&gt; and then try to match it with the ones in the database. the accuracy rate was very bad.&lt;/li&gt;&#xA;&lt;li&gt;Performing the Fourier on the full image and then &lt;strong&gt;take only the&#xA;sub-matrix contained in centre of the image&lt;/strong&gt; and then match it with&#xA;the ones in the database. the accuracy rate was also very bad.&lt;/li&gt;&#xA;&lt;li&gt;Performing the Fourier on the full image and then &lt;strong&gt;take only the&#xA;horizontal and vertical vector that intersect in the centre of the&#xA;image&lt;/strong&gt;, and then match it with the ones in the database. also, the&#xA;accuracy rate was very bad.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there any better algorithm that might help me solve this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="13559" LastEditorUserId="8202" LastEditDate="2015-01-30T11:01:41.640" LastActivityDate="2015-01-30T11:01:41.640" Title="Is there a better Fourier Transform-based algorithm to use in Image recognition" Tags="|image-processing|matlab|fourier-transform|algorithms|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20274" PostTypeId="1" CreationDate="2015-01-29T20:49:44.183" Score="1" ViewCount="505" Body="&lt;p&gt;I've seen in practice taking an FFT of a signal, then transforming it by the 2nd, 4th, etc. power (depending on signal type) to determine the baud rate. I'm trying to implement this in my code, but am lost as to what a transform of the 2nd power is. It appears to be some sort of non linear transform and not simply squaring of the FFT values.&lt;/p&gt;&#xA;" OwnerUserId="12087" LastActivityDate="2015-07-31T07:52:42.780" Title="Transforming FFT to Detect Baud Rate" Tags="|fft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20275" PostTypeId="2" ParentId="20272" CreationDate="2015-01-29T21:40:22.080" Score="1" Body="&lt;p&gt;The Fourier Transform is good for picking up some similarities between images: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Shifts in $x$ and $y$ are just phase changes in the Fourier domain.&lt;/li&gt;&#xA;&lt;li&gt;Rotations in the $x-y$ plane cause rotations in the Fourier domain.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cse.iitd.ac.in/~parag/projects/DIP/asign1/transrotfft.shtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;So, if this is what you are trying to achieve, then it makes sense.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www-rohan.sdsu.edu/~shui/Recent_papers/gbsb_fft_v6.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;See this paper for a performance analysis of doing this using the following algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/faWz9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-01-29T21:40:22.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20276" PostTypeId="2" ParentId="20176" CreationDate="2015-01-29T21:40:31.227" Score="0" Body="&lt;p&gt;Single channel separation is not the same as single microphone separation in the case where the &lt;a href=&quot;http://en.wikipedia.org/wiki/Microphone_array&quot; rel=&quot;nofollow&quot;&gt;microphone captures more than one channel&lt;/a&gt; simultaneously. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the literature that I've seen on &lt;a href=&quot;https://www.cs.nyu.edu/~roweis/papers/onemic.pdf&quot; rel=&quot;nofollow&quot;&gt;single microphone source separation&lt;/a&gt;, assumes that the microphone captures only one single channel (i.e. a mono recording).&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-01-29T21:40:31.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20277" PostTypeId="2" ParentId="20272" CreationDate="2015-01-29T21:44:16.750" Score="1" Body="&lt;p&gt;Matching images is very common function in image processing, and there is a great deal of literature available on the subject.  Cross-correlation via template (or pattern) matching is one of many ways of accomplishing it.  Download the following tutorial to see an explanation and C++ example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://fftguru.com/fftguru.com.tutorial3.pdf&quot; rel=&quot;nofollow&quot;&gt;http://fftguru.com/fftguru.com.tutorial3.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, in the code, the 2D inverse FFT is accomplished by reversing the FFT arguments (ie: if fft_8(r1,i1) is the forward 2D transform, then fft_8(i1,r1) is the inverse 2D transform - the fft routine must, of course, be for complex inputs/outputs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many other image processing tutorials available, some of which use different methods.&lt;/p&gt;&#xA;" OwnerUserId="13506" LastActivityDate="2015-01-29T21:44:16.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20278" PostTypeId="1" AcceptedAnswerId="20299" CreationDate="2015-01-30T02:46:40.200" Score="3" ViewCount="792" Body="&lt;p&gt;The SS formulation of DT system is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[(k+1)T] = Ax(kT) + Bu(kT)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(kT) = Cx(kT) + Du(kT)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: T is the sampling period and often omited&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain to me why the state equation $x[(k+1)T] = Ax(kT) + Bu(kT)$ is only between the currently sampling period $kT$ and the next sampling period $(k+1)T$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this model be used to describe the state occurring at all times?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-02-04T13:30:35.783" Title="How to intuitively understand the state space formulation of discrete time system?" Tags="|z-transform|control-systems|state-space|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20279" PostTypeId="1" AcceptedAnswerId="20285" CreationDate="2015-01-30T04:36:10.620" Score="4" ViewCount="634" Body="&lt;p&gt;Newbie question here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a system that is running a 32khz sampling rate, audio, 16 bit DAC. &#xA;Previously, our system had a very hard latency requirement of 1 sample. So no problem, we just read 1 sample in, did some processing within the sampling rate, and then read 1 sample out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that this requirement has been relaxed, I think that we can use block processing to do things such as spectrum computation and processing and use more than 1 sample to do the adding and multiplication, etc. &#xA;Does this buy us &lt;code&gt;blockSize * (1/fs)&lt;/code&gt; compute time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is, being a noob, I don't know how to formulate this new requirement in our chip's &lt;code&gt;main()&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's pretend we have some function &lt;code&gt;SPI_Read(&amp;amp;mic)&lt;/code&gt; which is reading a sample, and &lt;code&gt;SPI_Write(&amp;amp;output)&lt;/code&gt; which sends to a speaker. How would I transform this into a block based system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current system is setup like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;main() {&#xA;    while() { // check for interrupt&#xA;        // while loop executing on system timer set to 1 / fs&#xA;        SPI_Read(&amp;amp;in); // read from adc&#xA;        // filters&#xA;        SPI_Write(&amp;amp;out); // output to dac&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is running on a cortex-M4, no codec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help! (:&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="1355" LastEditDate="2015-04-08T07:13:32.903" LastActivityDate="2015-04-08T07:13:32.903" Title="Real-time block processing setup on ARM" Tags="|fft|dsp-core|analog-to-digital|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20280" PostTypeId="1" CreationDate="2015-01-30T05:32:26.573" Score="0" ViewCount="150" Body="&lt;p&gt;How can I make sure to map, for example, 7% of the pixels to pure black (0) and pure white (255) in a grayscale image?&lt;/p&gt;&#xA;" OwnerUserId="13525" LastActivityDate="2015-10-01T16:21:21.913" Title="Histogram Equalization - mapping a certain portion of pixels to pure black and white" Tags="|computer-vision|image-processing|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20282" PostTypeId="2" ParentId="20280" CreationDate="2015-01-30T05:52:10.863" Score="0" Body="&lt;p&gt;why 7%? surely its not random. if it were totally random which pixels were black you would just pick 7 out of every 100 pixels and make them black and the rest white. do you mean to set a black white threshold of 93%?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-01-30T05:52:10.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20285" PostTypeId="2" ParentId="20279" CreationDate="2015-01-30T09:35:54.007" Score="5" Body="&lt;p&gt;First, use a timer and an ISR to get accurate timing (don't forget to configure the &lt;a href=&quot;http://www.keil.com/support/man/docs/gsac/gsac_nvic.htm&quot; rel=&quot;nofollow&quot;&gt;NVIC&lt;/a&gt; so that this timer interrupt takes over any other ISR that would be running). Only this will ensure a consistant sample rate. Little variations in timing would create noticeable degradations of audio quality. In particular, in your current example, unless the &quot;filters&quot; code has no branches, the time at which the SPI_Write occurs will be jittery depending on the path taken in the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For block processing, you need a &lt;a href=&quot;https://en.wikipedia.org/wiki/Multiple_buffering#Page_flipping&quot; rel=&quot;nofollow&quot;&gt;&quot;ping-pong&quot; buffering scheme&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your per-sample ISR:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SPI_Write(output[active_buffer][sample_index]);&#xA;SPI_Read(input[active_buffer][sample_index]);&#xA;++sample_index;&#xA;if (sample_index &amp;gt;= BUFFER_SIZE) {&#xA;  active_buffer = (active_buffer + 1) % NUM_BUFFERS;&#xA;  sample_index = 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your main code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;while (render_buffer != active_buffer) {&#xA;  // Process samples from input[render_buffer][0] to input[render_buffer][BUFFER_SIZE - 1]&#xA;  // And write them to output[render_buffer][0] to output[render_buffer][BUFFER_SIZE - 1]&#xA;  render_buffer = (render_buffer + 1) % NUM_BUFFERS;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;render_buffer&lt;/code&gt; and &lt;code&gt;active_buffer&lt;/code&gt; are declared as volatile. Start with &lt;code&gt;NUM_BUFFERS&lt;/code&gt; equal to 2. Higher values will introduce more latency, but might be necessary if the processing code has exceptionally long code paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The benefit of processing samples block by block is that some variables required by your DSP algorithm (such as filter state variables) can be kept in registers within the processing loop, saving load/stores. There are also situations in which you can benefit from batch load/stores. Finally, it makes it easier to schedule computations at &quot;audio rate&quot; (once per audio sample) and &quot;control rate&quot; (once per block).&lt;/p&gt;&#xA;" OwnerUserId="943" LastEditorUserId="943" LastEditDate="2015-01-30T15:20:35.433" LastActivityDate="2015-01-30T15:20:35.433" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20286" PostTypeId="1" CreationDate="2015-01-30T10:15:07.663" Score="0" ViewCount="86" Body="&lt;p&gt;I was hoping that you can help me understand how to find poles and zeros in this transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s)=\frac{1}{(s-s_{\alpha1})(s-s_{\alpha2})}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that this function does not have any zeros, because of the 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the solutions I can see that the poles are $s_{\alpha1}=-1+j$ and $s_{\alpha2}=-1-j$ and to tell you the truth, I have no idea how to get solution for the poles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to solve it using quadratic equation, but the only thing I get is a big mess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!! &lt;/p&gt;&#xA;" OwnerUserId="10201" LastActivityDate="2015-01-30T20:08:54.763" Title="Solving simple transfer function" Tags="|transfer-function|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20288" PostTypeId="2" ParentId="20274" CreationDate="2015-01-30T13:29:19.297" Score="-1" Body="&lt;p&gt;I'll bet that the idea was roughly as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Baud rate detection is done via the autocorrelation function of the input&lt;/li&gt;&#xA;&lt;li&gt;A correlation is expensive to perform, much more than multiplication.&lt;/li&gt;&#xA;&lt;li&gt;A correlation in the time domain is equal to a multiplication in the Fourier domain&lt;/li&gt;&#xA;&lt;li&gt;An auto-correlation in the time domain is equal to squaring in the Fourier domain&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But remember that the FT is complex-valued. Ignoring the phase from the FFT will cause unpredictable results after the IFFT. That the phase into account, and the result of your IFFT should be real again (minus rounding errors)&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2015-01-30T13:29:19.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20289" PostTypeId="1" AcceptedAnswerId="20292" CreationDate="2015-01-30T14:32:48.130" Score="1" ViewCount="403" Body="&lt;p&gt;I learned in school that any real-valued, even-symmetric sequence can be expressed as the convolution of a minimum-phase sequence and its time-reverse, which is maximum-phase.  In my case, the real-valued, even-symmetric sequence is $sinc(x)$.  What causal, real-valued, minimum-phase sequence convolved with its time-reverse produces $sinc(x)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am familiar with the traditional approach of computing the frequency-domain zeros and constructing the minimum-phase sequence from those inside the unit circle and half of the pairs on the unit circle.  However, in this case, the sequence has infinite length.  I would prefer a closed-form expression for the minimum-phase sequence function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, I will be using a windowed version of the sequence -- an FIR filter.  I would also like to learn how to deconvolve any real-valued, even-symmetric, finite sequence (FIR filter) into its minimum-phase component, whose frequency response magnitude is the square-root of the symmetric FIR.  I would like a time-domain method for doing this because there are precision problems with computing frequency domain zeros in very long sequences, such as a million taps.&lt;/p&gt;&#xA;" OwnerUserId="13567" LastEditorUserId="7092" LastEditDate="2015-01-30T15:14:31.213" LastActivityDate="2015-01-31T08:04:51.387" Title="Deconvolve a symmetric sequence into minimum-phase and maximum-phase sequences" Tags="|phase|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20291" PostTypeId="2" ParentId="20286" CreationDate="2015-01-30T20:08:54.763" Score="1" Body="&lt;p&gt;Because $s-s_{\alpha1} = 0 $ and $s-s_{\alpha2} = 0 $ so poles: $s_1,s_2 = s_{\alpha1},s_{\alpha2} $ &#xA;What numerical values you have for $s_{\alpha1},s_{\alpha2} $ are the What numerical values you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="7226" LastActivityDate="2015-01-30T20:08:54.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20292" PostTypeId="2" ParentId="20289" CreationDate="2015-01-30T20:14:29.670" Score="0" Body="&lt;p&gt;For approximating a minimum phase sequence from a finite length linear phase sequence (such as a windowed Sinc), here are some existing stackoverflow and dsp.stackexchange answers regarding a matlab minimum phase approximation script which uses cepstrum deconvolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/16753508/cepstrum-deconvolution-matlab-code&quot;&gt;https://stackoverflow.com/questions/16753508/cepstrum-deconvolution-matlab-code&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/7872/derive-minimum-phase-from-magnitude&quot;&gt;Derive minimum phase from magnitude&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's an earlier post on the same matlab script, with more comments, from the music-dsp mailing list:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.music.columbia.edu/pipermail/music-dsp/2004-february/059372.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.music.columbia.edu/pipermail/music-dsp/2004-february/059372.html&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = [x; zeros(size(x))];&#xA;m = size(x,2);&#xA;n = size(x,1);&#xA;wn = [ones(1,m); 2*ones(n/2-1,m); ones(1,m);  zeros(n/2-1,m)];&#xA;y = real(ifft(exp(fft(wn.*real(ifft(log(abs(fft(x)))))))));&#xA;y = y(1:n/2;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've found that a greater amount of zero=padding of the original linear phase sequence may help improve the approximation.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-01-30T20:35:10.557" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20294" PostTypeId="1" AcceptedAnswerId="20308" CreationDate="2015-01-31T05:31:12.613" Score="0" ViewCount="860" Body="&lt;p&gt;I am working on a project that uses EEG signals of the brain to identify emotional states. While surveying the literature, I came across several references where &quot;derived features of bispectrum&quot; are used as features for the purpose of classifying motor and emotional signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although I have a list of some these &quot;derived features&quot; at my disposal, I would like to have some intuition as to which of these features I should use and why consider a bispectrum in the first place. I would highly appreciate it if the physical significance of the bispectrum could be explained.&lt;/p&gt;&#xA;" OwnerUserId="13574" LastActivityDate="2015-02-01T04:13:06.403" Title="What is bispectrum?" Tags="|discrete-signals|statistics|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20295" PostTypeId="2" ParentId="20289" CreationDate="2015-01-31T08:04:51.387" Score="0" Body="&lt;p&gt;It is not true that &quot;any real-valued, even-symmetric sequence can be expressed as the convolution of a minimum-phase sequence and its time-reverse, which is maximum-phase&quot;. You can see this as follows: if the symmetric sequence is $r[n]$, and the minimum-phase and maximum-phase components are $s[n]$ and $s[-n]$, respectively, then you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$r[n]=s[n]*s[-n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $*$ denotes convolution. Assuming that $s[n]$ is real-valued, the spectrum of $r[n]$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R(\omega)=S(\omega)S^*(\omega)=|S(\omega)|^2\ge 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. $R(\omega)$ must be non-negative, but this is generally not the case for all even symmetric sequences. Their spectrum is just real-valued and symmetric, but not necessarily non-negative. So you have to require the additional condition of $r[n]$ having a non-negative spectrum, otherwise it can't be factored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the algorithms: apart from methods based on the Fourier transform and the Cepstrum, there are iterative methods such as the Wilson-Burg algorithm, and related methods, which are all based on Newton's method for computing a square root. &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.302.89&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;This paper&lt;/a&gt; gives a nice overview and has further references.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-31T08:04:51.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20298" PostTypeId="2" ParentId="20267" CreationDate="2015-01-31T10:53:50.437" Score="2" Body="&lt;p&gt;A &lt;a href=&quot;http://en.wikipedia.org/wiki/Zero-order_hold&quot; rel=&quot;nofollow noreferrer&quot;&gt;zero-order hold&lt;/a&gt; can be modeled by a rectangular impulse response of length $T$ (where $T$ is the sampling period) and height $1/T$, starting at $t=0$. The corresponding frequency response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(f)=\text{sinc}(fT)e^{-j2\pi f T/2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\text{sinc(x)}=\sin(\pi x)/(\pi x)$. From (1) it can be seen that $H(f)$ has a linear phase response with a corresponding group delay of $T/2$. Now if the sampling frequency is very high compared to the bandwidth of the sampled signal, then the $\text{sinc}$ function can be approximated by a constant around $f=0$, or, equivalently, the rectangular impulse response can be approximated by an impulse at its center (which is $t=T/2$). So for low-frequency signals (compared to the sampling frequency), the zero-order hold operation can be approximated by a delay of $T/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following figure illustrates this. The blue line is a signal with a small bandwidth compared to the sampling frequency. The green curve is the result of a zero-order hold operation, where the signal is constant over 1 sampling period $T$. Finally, the red curve is the original signal delayed by $T/2$. If $T$ is very small, the delayed signal is closely approximated by the piecewise constant output of the zero-order hold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZleNu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-01-31T10:53:50.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20299" PostTypeId="2" ParentId="20278" CreationDate="2015-01-31T11:46:34.107" Score="1" Body="&lt;p&gt;Let me start by answering your last question&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can this model be used to describe the state occurring at all times?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you know the state at one single time instant $k$ (e.g. by a given initial condition when the system starts operating), then, given an input signal for times $\ge k$, you can use the state-space equations to compute the output signal for $k+1$, $k+2$, etc. to infinity. The state at a time $k$ contains all information about the past history of the system necessary to compute its current and future output given the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the other question why the state equations only relate time $k+1$ to time $k$ and not also to times $k-1$, $k-2$, etc., the answer is again that the state summarizes all past history of the system. Note that in general the state $x$ is a vector. E.g. if you have a discrete-time linear time-invariant system specified by a linear difference equation with constant coefficients, the output is given by a linear combination of past output values, and current and past input values. Such a system can be implemented by a tapped delay line as shown in the figure below for a second-order system. Now if you define the state vector $x$ to be the content of all delay elements at a given time, you kind of exchange the explicit formulation of time dependency spanning several past time indices with a vector-valued equation spanning only one time interval. The more memory a system has, the higher will be the dimension of the state vector. So by using a vector difference equation (i.e. a system of equations) instead of a scalar equation, you can always obtain a first order equation relating time $k+1$ to $k$ and to no other past time indices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VFhkY.png&quot; alt=&quot;biquad filter&quot;&gt;&#xA;&lt;a href=&quot;http://commons.wikimedia.org/wiki/File:Biquad_filter_DF-II.svg#mediaviewer/File:Biquad_filter_DF-II.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Biquad filter DF-II&quot; by Akilaa - Own work. Licensed under GFDL via Wikimedia Commons&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="29" LastEditDate="2015-02-03T15:15:08.153" LastActivityDate="2015-02-03T15:15:08.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20301" PostTypeId="1" AcceptedAnswerId="20302" CreationDate="2015-01-31T16:21:28.030" Score="2" ViewCount="166" Body="&lt;p&gt;I am using Emgu C#.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I acquire images from my cameras.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know when there is no saturation (ie a grey-tone image) by looking at the average hue channel of the image. If zero then pretty sure picture taken at night time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can also detect how bright an image is by checking the average Luminescence channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would now like to do is a value for the gamma an contrast of an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I know it is the interpretation of this hypothetical gamma and contrast that determines its value within the context of how I use it. But what factors can i use to attempt to put a scale on these values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I be looking at a different Color Space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="698" LastEditDate="2015-02-01T09:21:48.503" LastActivityDate="2015-02-01T09:21:48.503" Title="How to tell whether an image has a low gamma (Finding out imaging system tone map)" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20302" PostTypeId="2" ParentId="20301" CreationDate="2015-01-31T16:24:20.657" Score="2" Body="&lt;p&gt;You should take a photograph of an object with known color values, such as &lt;a href=&quot;http://en.wikipedia.org/wiki/ColorChecker&quot; rel=&quot;nofollow noreferrer&quot;&gt;Macbeth chart&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/29qkM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using the lowest row of grayscale colors, you will be able to find out the tone-mapping (sometimes incorrectly called gamma) of your imaging system.&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-01-31T16:24:20.657" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20303" PostTypeId="1" CreationDate="2015-01-31T19:07:12.757" Score="2" ViewCount="3664" Body="&lt;p&gt;I am trying to downsample from &lt;span class=&quot;math-container&quot;&gt;$44100Hz$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$8000Hz$&lt;/span&gt;, and I am not sure what I am doing wrong here.  &lt;span class=&quot;math-container&quot;&gt;$44100 / 8000$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$5.5125$&lt;/span&gt;, so I am getting hung up a little on the fractional remainder which is causing my implementation to play back slightly slower than it is supposed to.  It seems that I need to somehow use the fractional remainder to compensate for this, but I am not sure how...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def downsample&#xA;  s = low_pass_filtered_signal_by_half_target_sample_rate&#xA;  samples_to_discard = (sample_rate.to_f / target_sample_rate).floor //   (44100.0 / 8000.0).floor&#xA;&#xA;  s1_n = 0&#xA;  for (n = 0; n &amp;lt; N; n++) {&#xA;     if (n % samples_to_discard == 0) {&#xA;       s1[s1_n] = averaged(n, samples_to_discard)&#xA;       s1_n += 1&#xA;    }&#xA;  }&#xA;end&#xA;&#xA;def averaged(start_index, samples_to_discard)&#xA;  sum = 0&#xA;    for (n = start_index, n &amp;lt; start_index + samples_to_discard; n++) {&#xA;      sum += s[n] || 0&#xA;    }&#xA;  sum / samples_to_discard&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11807" LastEditorUserId="25557" LastEditDate="2020-04-02T16:03:35.543" LastActivityDate="2020-04-02T16:03:35.543" Title="Trying to down-sample audio" Tags="|downsampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20304" PostTypeId="2" ParentId="20303" CreationDate="2015-01-31T20:20:54.660" Score="1" Body="&lt;p&gt;First of all, ensure that your signal will be bandlimited to 4kHz range, by a suitable lowpass filter, so that aliasing won't be a problem. Second, if you are not looking for &quot;exactly&quot; accurate samples, then use a fairly simple re-sample function such as a truncated sinc interpolator...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation for analog reconstruction is: $$ x_r(t) = \sum_{n} { x[n]sinc ((t-nT_1)/T_1)}$$  this mathematical derivation represents the output of an analog lowpass reconstruction filter driven by an impulse train weighted by samples of x[n] obtained from sampling x(t) at the original sample rate (44100 Hz) and $T_1$ is that sampling period. sinc(x) is the abbreviation of sin(x)/x&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and your equation for re-sampling this re-constructed signal is:  $$ x[m] = \sum_{n} { x[n]sinc ((mT_2-nT_1)/T_1)}$$ for m=0,1,...,length of downsampled signal at the new rate (8000 hz) and $T_2$ is its period. The inner summation on n must be computed for each output m value, necessary to generate the resampled signal x[m]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though above formulation is mathematically describing the sample rate conversion, sometimes it is better to use simple techniques, rather than polyphase implementation of multirate filter banks, such as a linear interpolation as demonstrated below: provided that original signal will be bandlimited enough, you will get quite satisfactory results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE: You mention about inproportional playing times, I am not sure the exact reason but due to a fractional rate conversion, you may have 1 excess or 1 missing sample at the output. Consider original signal of length 10.000 at 44100 hz and converting this to a rate 8000 will produce 1814.058 samples which may be rounded to 1814. There are many tricks to overcome this practical issue, depending on your overall architecture. But Im not sure if this will casue noticable delay for short periods of playing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a matlab code for the simple linear interpolator and you can see from the plotted spectra, there is just little error which is due to the fact that you are actually downsampling an already lowpass signal (you have in the first place more information than necessary)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T1 = 1/44100;&#xA;T2 = 1/8000;&#xA;t1 = [0:T1:2];&#xA;t2 = [0:T2:2];&#xA;&#xA;x = sin(2*pi*1451*t1)+0.21*cos(2*pi*853*t1);  % generate a test signal&#xA;figure,stem(x); axis([ 1 length(x) -1.3 1.3]);    % sufficiently low pass&#xA;&#xA;L = 80;&#xA;M = 441;&#xA;K = M/L;&#xA;xd = zeros(1,floor(length(x)/K));&#xA;%x = filter(fir1(64,1/(2*K)),1,x);      % optionally band limit x to avoid aliasing otherwise linear interpolator will be insufficient.&#xA;&#xA;for n=1:length(xd)   % you can vectorize this code for buffered processing&#xA;        m = K*n;&#xA;       mi = floor(m);&#xA;        d = m - mi;&#xA;    xd(n) = x(mi+1)*(d) + (1-d)*x(mi);  % simplest linear interpolator&#xA;end&#xA;&#xA;figure,stem(xd); axis([ 1 length(xd) -1.43 1.43]);&#xA;figure,plot(abs(fft(x,1024)));&#xA;figure,plot(abs(fft(xd,1024)));&#xA;&#xA;% FINALY PLAY THEM to hear resulting signal&#xA;sound(x,44100,16);&#xA;sound(xd,8000,16); % seems OK &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-02-01T15:50:45.747" LastActivityDate="2015-02-01T15:50:45.747" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20305" PostTypeId="2" ParentId="20303" CreationDate="2015-01-31T20:34:02.703" Score="3" Body="&lt;p&gt;First you need to interpolate between samples rather than just retaining and discarding samples (which introduces horrible jitter noise during non-integer downsampling).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, if the original audio data contained spectrum around or above 4000 Hz (half the sample rate), you will need to low-pass filter before or in conjunction with the interpolation to the lower sample rate, or else you will get aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good combined method of low-pass filtering plus interpolation is to use a windowed Sinc function as the interpolation kernel, where the Sinc is scaled to be the transform of an ideal &quot;brick-wall&quot; or rectangular filter with the appropriate low-pass cut-off frequency.  The width of the window on the scaled Sinc function will control the transition width of the frequency cut-off.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-02-01T05:30:41.397" LastActivityDate="2015-02-01T05:30:41.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20306" PostTypeId="1" CreationDate="2015-02-01T01:21:40.590" Score="0" ViewCount="194" Body="&lt;p&gt;I am acquiring time-varying data with unequal sampling (nature of the source). When building a spectrogram, I have the algorithm choose sample blocks that are are -nearly- the same length -but, they are never equal. Since the peak widths are a function of the sample block length, this means that although two sample blocks, just separated by one sample (sliding window), can have the same underlying frequency content, the total power (if one is to sum the PSD) is different. This is a problem because sometimes, again due to the nature of the data source, adjacent sample blocks can have vastly different lengths, and therefore there is a large variation in the total power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible solution I have thought of is to take an interactive approach to &quot;normalizing&quot; the spectrum. For each spectral component, I can calculate the goodness of fit. Then, choose the best fit sinusoid and subtract it from the data. Doing this iteratively I will eventually reach a noise floor, where no sinusoid fits the data. (one benefit is that it will remove spurious peaks such as aliases). Then, using the list of amplitudes and frequencies, &quot;rebuild&quot; the spectrum assuming that each peak is the sinc shape and width based on the desired sample block length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any feedback on this approach, or others to try. I am well versed in signal analysis, but with uniform sampling -where these problems don't show up. And after extensive literature search, I have been unable to find a solution.&lt;/p&gt;&#xA;" OwnerUserId="13583" LastActivityDate="2015-02-01T01:21:40.590" Title="&quot;Normalizing&quot; PSD of unequal window lengths" Tags="|fourier-transform|power-spectral-density|peak-detection|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20308" PostTypeId="2" ParentId="20294" CreationDate="2015-02-01T04:13:06.403" Score="1" Body="&lt;p&gt;The bispectrum is technique to detect phase relationships (or phase coupling) between different components of a signal. With EEGs, I can imagine it would be useful to understand how &amp;amp; which signal components (or latent sources captured by a single EEG) are covariates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevance of phase coupling depends on what is being studied by the EEG analysis, for example in &lt;a href=&quot;http://www.robots.ox.ac.uk/~davidc/pubs/pgbiomed09.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;, the context is medical. Bispectrum features are used to detect decreases in the stability of the phase relationships of fast rhythms in EEG signals, this is considered an abnormality that corresponds to the existence of &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/15203050&quot; rel=&quot;nofollow&quot;&gt;Alzheimer's disease&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-02-01T04:13:06.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20309" PostTypeId="2" ParentId="20274" CreationDate="2015-02-01T05:25:42.330" Score="1" Body="&lt;p&gt;As noted in the following link, baud rate is estimated from &quot;the spectrum of the signal after nonlinear processing.&quot;  In their case, as noted in the first three sentences of the section entitled &quot;Proposed Spectral Approach for Bit Time Estimation&quot; - p. 916), the nonlinear processing is the first derivative followed by an absolute value operation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.iasj.net/iasj?func=fulltext&amp;amp;aId=51991&quot; rel=&quot;nofollow&quot;&gt;http://www.iasj.net/iasj?func=fulltext&amp;amp;aId=51991&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Others have proposed/analyzed estimation using different nonlinear operations, such as squaring of the signal or using higher derivatives.  Obtaining the references for the above paper and doing a thorough search would be a good place to start to learn more.&lt;/p&gt;&#xA;" OwnerUserId="13506" LastEditorUserId="13506" LastEditDate="2015-02-01T05:31:21.603" LastActivityDate="2015-02-01T05:31:21.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20310" PostTypeId="1" CreationDate="2015-02-01T06:16:50.713" Score="0" ViewCount="1097" Body="&lt;p&gt;how to apply wavelet transform method to extract alpha waveform( higher and lower band frequency known) from a given known signal ?&lt;/p&gt;&#xA;" OwnerUserId="13589" LastActivityDate="2015-02-04T22:38:27.033" Title="Use wavelet transform to extract a waveform of certain frequency" Tags="|matlab|signal-analysis|" AnswerCount="2" CommentCount="2" ClosedDate="2015-02-03T17:48:52.517" ContentLicense="CC BY-SA 3.0" />
  <row Id="20311" PostTypeId="1" AcceptedAnswerId="20328" CreationDate="2015-02-01T07:37:23.543" Score="1" ViewCount="644" Body="&lt;p&gt;Hi guys I have a really tough signal processing question here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you detect and distinguish two very very similar looking waves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to distinguish between these two signals for an online application and the techniques so far have all failed. These two signals have very similar and often unpredictable amplitudes. Almost identical frequency. So the only way I can attempt to distinguish between the two is using time domain features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal 1:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yMwxk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal 2:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vM85p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data is streamed live in every single second (at 128 samples per second). My approach is to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;use a window of size 128 samples to obtain the data&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the time domain features of the data &#xA;features such as: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;derivative between the mean of the current 128 samples and previous&#xA;128 samples, &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;derivative between the max point of the current 128 samples and&#xA;previous 128 samples&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;skewness of the data&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;kurtosis of the data&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;deviation from the mean&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;If derivative goes down, then we say it is signal 1 and if derivative does down we say it is signal 2&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But the problem is that the two signals look very very similar. So if the window is incorrectly placed (i.e. on the rising or falling phase after the initial signal), then it can give me the complete opposite result!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone give me some suggestions as to what features I should use or what technique I should use to distinguish between this two very similar looking signals!&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-02-04T18:27:50.490" Title="Need critical help: How to detect and distinguish two very similar looking signals?" Tags="|signal-analysis|signal-detection|local-features|classification|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20312" PostTypeId="1" AcceptedAnswerId="20315" CreationDate="2015-02-01T07:49:43.447" Score="2" ViewCount="274" Body="&lt;p&gt;I am currently reviewing the Nyquist criterion which says I need to sample the signal at 2 times the maximum frequency in order to avoid aliasing in the reconstructed signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is that in all the applications I've done, I rarely ever remember having to reconstruct the signal after sampling it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in controlling a digital controller, all I have to do is to sample the signal and send the sampled signal to the controller. End of story, no reconstruction required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other applications, I sample the signal to analyze its frequency content. After looking at the frequency distribution, the signal is completely discarded. No reconstruction required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone make it clear why do we need to respect the Nyquist criterion if no reconstruction is needed (so no worry about aliasing effect)?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-02-03T14:21:13.353" Title="Soft question: Why do we need to reconstruct a signal?" Tags="|nyquist|aliasing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20313" PostTypeId="1" AcceptedAnswerId="20319" CreationDate="2015-02-01T07:56:24.960" Score="0" ViewCount="2061" Body="&lt;p&gt;Claim:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If $\lim_{k\rightarrow\infty} x[k]$ exists and is finite then $X(z)$, the Z-transform&#xA;  of $x[k]$, has no poles in the region $|z|&amp;gt;1$ and at most  1 pole at $z = 1$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Attempt:&#xA;\begin{align*}&#xA;   X(z) &amp;amp;= \sum_{k\ge 0} x[k]z^{-k}\\\&#xA;   H(z)/G(z) &amp;amp;= \sum_{k\ge 0} x[k]z^{-k}\\\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First prove that no pole can be in $|z|&amp;gt;1$&#xA;\begin{align*}&#xA;   H(z)/G(z) &amp;amp;= \sum_{k\ge 0} x[k]z^{-k}\\\&#xA;   H(z)/[(z-a)G'(z)] &amp;amp;=  \sum_{k\ge 0} x[k]z^{-k},  a&amp;gt;1\\\&#xA;   H(z)/[(z-a)G'(z)] &amp;amp;= x[0] + x[1]z^{-1} +x[2]z^{-2}+x[3]z^{-3}...\\\&#xA;   H(z)/G'(z)     &amp;amp;= (z-a)(x[0] + x[1]z^{-1} +x[2]z^{-2}+x[3]z^{-3}...)\\\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help carry this further?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastEditorUserId="4298" LastEditDate="2015-02-01T12:03:02.983" LastActivityDate="2016-04-16T14:12:54.173" Title="How to prove this theorem about the Z transform and final value theorem?" Tags="|z-transform|poles-zeros|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20314" PostTypeId="1" AcceptedAnswerId="20316" CreationDate="2015-02-01T08:51:53.580" Score="0" ViewCount="1452" Body="&lt;p&gt;I've tried to implement STFT in functional way in Python. I've got code such as below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def genSpectrums_dft(x, w, N, dft_func = fp.fft):&#xA;    hN = N / 2&#xA;    M = len(x)&#xA;    hM1 = int(math.floor((M + 1) / 2))&#xA;    hM2 = int(math.floor(M / 2))&#xA;    wM = w(M)&#xA;    w_sum = sum(wM)&#xA;    xw = x * wM / w_sum&#xA;    dft_buffer = np.concatenate(&#xA;        (xw[hM2:], np.zeros(N - hM1 - hM2), xw[:hM2])&#xA;    )&#xA;    X = dft_func(dft_buffer)&#xA;    mX = 20 * np.log10(abs(X[:hN]))&#xA;    pX = np.unwrap(np.angle(X[:hN]))&#xA;    return mX, pX&#xA;&#xA;def genSpectrums_stft(x, w, M, N, H, dft_func = fp.fft):&#xA;    hM1 = int(math.floor((M + 1) / 2))&#xA;    hM2 = int(math.floor(M / 2))&#xA;    x_ext = np.concatenate((np.zeros(hM2), x, np.zeros(hM2)))&#xA;    lv = np.arange(len(x) / H + 1)&#xA;    wM = w(M)&#xA;    w_sum = sum(wM)&#xA;    xlv = np.array([x_ext[l * H:l * H + M] / w_sum for l in lv])&#xA;    return tuple(&#xA;        np.transpose(np.array(X))&#xA;        for X in zip(&#xA;            *[genSpectrums_dft(xl, w, N, dft_func) for xl in xlv]&#xA;        )&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Full working code is available &lt;a href=&quot;https://github.com/pt12lol/audio-001/blob/master/audio-001/Notes.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (Python, numpy, scipy and matplotlib required to run it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run my code for any wave, STFT magnitude spectrum seems to be quite good, but STFT phase spectrum always looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ANCwD.jpg&quot; alt=&quot;phase spectrum from genSpectrums_stft function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as far as I know it should rather look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JF6zO.png&quot; alt=&quot;certainly right solution&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both these spectrums have been generated from the same wave and the second parameters. The second one has less frequencies. Why my phase spectrum has these strange vertical lines?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a few remarks rewarding my code:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I am almost positive that finding dft spectrums works correctly&lt;/li&gt;&#xA;&lt;li&gt;Though the spectrums distinct, when I inverse the process, I get something really similar to the input&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you are not familiar with functional programming, I don't mind if you correct my mistakes in structural way, but the most important thing for me is to understand the problem with my code.&lt;/p&gt;&#xA;" OwnerUserId="13464" LastEditorUserId="13464" LastEditDate="2015-02-01T09:05:04.283" LastActivityDate="2015-02-01T10:35:12.010" Title="Strange phase spectrum from stft" Tags="|frequency-spectrum|python|stft|spectrogram|" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20315" PostTypeId="2" ParentId="20312" CreationDate="2015-02-01T09:04:09.980" Score="5" Body="&lt;p&gt;The concept of reconstruction has nothing to do with the application, rather it has to do with the question: did I get the same signal that is really there. If you cannot recreate the signal back, that means the conversion process is loosing/modifying underlying information, which in most cases you do not want to happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the confidence on the Fourier Transform, or to use the digitized data in the controller, comes from the fact that the loss of information is within the tolerance limits of your application. You can measure the quality of your digitized signal, by actually re-synthesizing the signal and comparing it to the original signal. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2015-02-01T09:04:09.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20316" PostTypeId="2" ParentId="20314" CreationDate="2015-02-01T10:35:12.010" Score="1" Body="&lt;p&gt;You are unwrapping the phase along the wrong axis. You are obviously interested in the phase change of the frequency bins along the time axis in order to say something about the local phase coherence.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-02-01T10:35:12.010" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20317" PostTypeId="2" ParentId="20310" CreationDate="2015-02-01T10:40:54.500" Score="1" Body="&lt;p&gt;The mother wavelet is a bandpass filter. This means we have to apply the CWT(in this case), calculate the correspondence between scales and frequencies, zero out everything outside the known frequency band for the alpha wave and invert the transform. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data = Import[&quot;your_sample_eeg_data&quot;];&#xA;&#xA;ListLinePlot[data]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nCVVO.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cwd = ContinuousWaveletTransform[data, MorletWavelet[], SampleRate -&amp;gt; 200, Padding -&amp;gt; 0]&#xA;&#xA;freq = (cwd[&quot;SampleRate&quot;]/(#1 cwd[&quot;Wavelet&quot;][&quot;FourierFactor&quot;])) &amp;amp; /@ &#xA;   (Thread[{Range[cwd[&quot;Octaves&quot;]], 1}] /. cwd[&quot;Scales&quot;]);&#xA;&#xA;ticks = Transpose[{Range[Length[freq]], freq}];&#xA;&#xA;WaveletScalogram[cwd, Frame -&amp;gt; True, FrameTicks -&amp;gt; {{ticks, Automatic}, Automatic}, &#xA; FrameLabel -&amp;gt; {&quot;Time&quot;, &quot;Frequency(Hz)&quot;}, ColorFunction -&amp;gt; &quot;SunsetColors&quot;, ImageSize -&amp;gt; 500]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xl1Ik.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, we are interested in the 5th octave(the region between &lt;code&gt;10.51&lt;/code&gt; and &lt;code&gt;5.25&lt;/code&gt;, of course, roughly speaking)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mwd = WaveletMapIndexed[#1 0 &amp;amp;, cwd, Except[{5, _}]]&#xA;&#xA;WaveletScalogram[mwd, ColorFunction -&amp;gt; &quot;SunsetColors&quot;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pBlkO.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's like performing a brain surgery with a chainsaw ;__;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ListLinePlot[InverseContinuousWaveletTransform[mwd]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uuaFr.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those are the basic steps I would perform if I have to extract a signal within a certain frequency band.&lt;/p&gt;&#xA;" OwnerUserId="7477" LastActivityDate="2015-02-01T10:40:54.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20319" PostTypeId="2" ParentId="20313" CreationDate="2015-02-01T12:00:31.000" Score="5" Body="&lt;p&gt;Let me show you a simple way to see this property. Assume $x[k]$ is a causal sequence and let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[\infty]=\lim_{k\rightarrow\infty}x[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;be finite. Then the sequence $x[k]$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[k]=x[\infty]u[k]+y[k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u[k]$ is the unit step sequence, and $y[k]$ is a causal sequence that decays to zero as $k\rightarrow\infty$. Taking the $\mathcal{Z}$-transform of (1) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=x[\infty]\cdot\frac{z}{z-1}+Y(z)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The poles of $X(z)$ are determined by the two terms on the right-hand side of (2). Since $y[k]$ is a causal decaying sequence, its $\mathcal{Z}$-transform $Y(z)$ must have all its poles inside the unit circle. Since the first term on the right-hand side of (2) can only contribute a single pole at $z=1$, $X(z)$ cannot have any poles outside the unit circle. If $x[\infty]\neq 0$, $X(z)$ has exactly one pole at $z=1$ from the first term on the right-hand side of (2). If $x[\infty]=0$, i.e. $x[k]$ decays to zero as $k\rightarrow\infty$, then that first term disappears and $X(z)$ has no pole at $z=1$. This verifies the claim: if $x[k]$ has a finite limit as $k\rightarrow\infty$, $X(z)$ cannot have any poles outside the unit circle, and, if $x[\infty]\neq 0$, it has a single pole at $z=1$ in addition to its poles inside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that the final value theorem directly follows from (2). Multiplying both sides of (2) by $z-1$ gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(z-1)X(z)=x[\infty]z+(z-1)Y(z)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the limit $z\rightarrow 1$ yields the final value theorem of the $\mathcal{Z}$-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lim_{z\rightarrow 1}(z-1)X(z)=x[\infty]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the limit $\lim_{k\rightarrow\infty}x[k]$ must be guaranteed to exist in order for (4) to make any sense.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-02-01T15:29:39.320" LastActivityDate="2015-02-01T15:29:39.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20320" PostTypeId="2" ParentId="16481" CreationDate="2015-02-01T12:31:46.843" Score="1" Body="&lt;p&gt;sinusoids are the Eigenfunctions of linear time invariant systems. Thus we will need a infinite sinusoid to have a Eigenfunction of the transmitter. To replicate this we just add the end of the symbol at the beginning to emulate the infinite sinusoid and hence use cyclic convolution.&lt;/p&gt;&#xA;" OwnerUserId="13591" LastActivityDate="2015-02-01T12:31:46.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20321" PostTypeId="1" CreationDate="2015-02-01T14:23:23.497" Score="0" ViewCount="197" Body="&lt;p&gt;I have some unusual question. I have searched online and couldn't find something similar to what I want to achieve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an image, and I want to create a new image from it (in the same size), so the value of each pixel in the new image will be an indication for the texture of the pixel's close environment. By that I mean that, for example, parts with diffrenet textures from nearby parts will get diffrent values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that segmentation exists but I don't want to partition the image into segments; I just want a way to tell how much each pixel is in an area that its texture is &quot;diffrent&quot; and by how much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using Matlab's &lt;em&gt;stdfilt&lt;/em&gt; and &lt;em&gt;rangefilt&lt;/em&gt; (I have rewritten them in OpenCV, C++), but they are no good: I tried using them with a lot of diffrenet parameters, but diffrenet textures get too close values, so my seperation is not good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this question is a bit ambiguous but I just want to know which methods can I use (in openCV) to give me the result I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="13592" LastActivityDate="2015-02-01T14:23:23.497" Title="Creating a texture image from existing image" Tags="|image-processing|opencv|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20322" PostTypeId="2" ParentId="20280" CreationDate="2015-02-01T16:25:33.847" Score="1" Body="&lt;p&gt;Compute the image histogram, then its running integral (i.e. an array T with as many entries as there are gray levels, such as T(k) = sum_{i=0, 1..k} (histogram(i)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last element of the integral is, of course, the area of the image. &#xA;For the lower threshold, start from the left and find the level at which T exceeds your desired fraction. Analogously, for the high threshold, start from the right and find the level at which T goes below your high fraction. &lt;/p&gt;&#xA;" OwnerUserId="9110" LastEditorUserId="9110" LastEditDate="2015-10-01T15:28:34.753" LastActivityDate="2015-10-01T15:28:34.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20324" PostTypeId="2" ParentId="20312" CreationDate="2015-02-01T17:29:41.707" Score="5" Body="&lt;p&gt;You may not need to explicitly reconstruct.  But if you did reconstruct a waveform using the samples that you have, and end up with something different from the actual input, your controller is controlling as if that new different reconstructed waveform was really the input.  Depending on what your controller is doing, you may have wanted it to do something different given those two different (before sampling) input waveforms.  If so, you need to sample in a such way as to retain enough information in the samples so that the reconstructed waveform is close enough to the real input to meet your controller processes needs or requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if aliasing occurs, any high frequency (around or above half the sample rate) spectrum present in the waveform before sampling will distort your low frequency distribution measurements and thus reduce their accuracy (due to added noise), which may or may not meet your requirements.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-02-01T18:22:06.093" LastActivityDate="2015-02-01T18:22:06.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20325" PostTypeId="2" ParentId="294" CreationDate="2015-02-02T06:57:44.167" Score="1" Body="&lt;p&gt;That depends on your system model, if you can model the system with only positions and angles, that is $x=[x_i, y_i, \alpha_1, \alpha_2, \alpha_3]^T$, it's okay you did not compute the velocity, if it's not possible, you may consider the other way.&lt;/p&gt;&#xA;" OwnerUserId="13585" LastActivityDate="2015-02-02T06:57:44.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20328" PostTypeId="2" ParentId="20311" CreationDate="2015-02-02T14:36:03.790" Score="4" Body="&lt;p&gt;As Conrad pointed out, a correlator is probably your best bet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correlation of a signal with itself (also known as its self-similarity) is larger than its correlation with any other signal (except for a constant factor related to the signals' energy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you would implement two correlators, one for Signal 1 and one for Signal 2. Then, you'd look for one of the correlators' output to be larger than a certain threshold. You may have to run a few tests to determine the threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One nice benefit of using correlation is that you don't need to synchronize your time window to the signals. Just be sure to accumulate the correlation calculations from one time window to the next.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-02-02T14:36:03.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20329" PostTypeId="2" ParentId="20311" CreationDate="2015-02-02T15:31:37.830" Score="0" Body="&lt;p&gt;Very non-scientific answer that has sometimes worked well for me. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Stare at the data and check whether you (as a human) can reliably distinguish the two&lt;/li&gt;&#xA;&lt;li&gt;Write down on a piece of paper how you actually do this (e.g. first bump is up on A but down on B).&lt;/li&gt;&#xA;&lt;li&gt;Code this up as a heuristic algorithm.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Off course, it makes sense to dig in the bag of standard algorithms to help with this (correlation, smoothing, peak detectors, etc.). A nice side benefit of the method is that it's typically easy to debug and tune since you are just trying to copy an algorithm that's already in your head. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-02-02T15:31:37.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20331" PostTypeId="2" ParentId="20225" CreationDate="2015-02-02T18:24:52.480" Score="1" Body="&lt;p&gt;I guess that your problem may not really be 1/f noise, but rather the effects from using the FFT directly on your time signal (without any windowing). If that is true, then try applying the Hann window to the time signal before the FFT and check the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is plenty of information available about the &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window functions&lt;/a&gt; and how to use them.&lt;/p&gt;&#xA;" OwnerUserId="325" LastActivityDate="2015-02-02T18:24:52.480" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20332" PostTypeId="1" AcceptedAnswerId="20436" CreationDate="2015-02-03T02:37:10.040" Score="1" ViewCount="135" Body="&lt;p&gt;I've recently been studying wavelet analysis with a view to differentiating certain areas of texture images where the texture differs from the background pattern (which is quite random); for example a small ink smudge on a photo of sand or similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen a lot of applications of Gabor wavelets used to pick out textural differences in things like fabrics, and other regular type patterns but I've not been able to find any applications of things like Daubechie/Harr wavelets for anything other than image compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can different wavelet families be used to pick out textural differences such as my example or am I wasting my time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iWW4z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13457" LastEditorUserId="13457" LastEditDate="2015-02-03T14:23:29.990" LastActivityDate="2015-02-09T18:16:36.107" Title="Can wavelets be used for complex texture discrimination?" Tags="|image-processing|wavelet|machine-learning|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20333" PostTypeId="1" CreationDate="2015-02-03T03:49:19.440" Score="8" ViewCount="80057" Body="&lt;p&gt;Is it possible to implement a moving average in C without the need for a window of samples?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found that I can optimize a bit, by choosing a window size that's a power of two to allow for bit-shifting instead of dividing, but not needing a buffer would be nice.  Is there a way to express a new moving average result only as a function of the old result and the new sample?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define an example moving average, across a window of 4 samples to be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ma &amp;lt;= (a + b + c + d) / 4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Add new sample e:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ma_new &amp;lt;= (a + b + c + d) / 4 - (a / 4) + (e / 4)&#xA;ma_new(ma, oldest_sample, new_sample) &amp;lt;= ma - (a / 4) + (e / 4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8116" LastEditorUserId="4298" LastEditDate="2020-10-28T10:53:31.487" LastActivityDate="2022-11-15T06:45:14.183" Title="How to implement a moving average in C without a buffer?" Tags="|filters|c|moving-average|" AnswerCount="7" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20335" PostTypeId="1" AcceptedAnswerId="20348" CreationDate="2015-02-03T07:35:00.683" Score="-1" ViewCount="2817" Body="&lt;p&gt;I was able to recorded an audio signal through the MIC and i applied FFT and Hanning window function to it. Now I want to know how do I identify CUTOFF frequency from it to apply the High Pass Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my sample rate = $8000 Hz$, FFT block size = $256$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me to identify this ? I would really appreciate it ! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="13597" LastEditorUserId="7092" LastEditDate="2015-02-03T16:19:10.383" LastActivityDate="2015-02-03T17:17:43.823" Title="How do I identify CUTOFF frequency from my audio signal?" Tags="|signal-analysis|frequency|highpass-filter|" AnswerCount="2" CommentCount="6" ClosedDate="2015-03-04T09:02:03.370" ContentLicense="CC BY-SA 3.0" />
  <row Id="20336" PostTypeId="2" ParentId="20333" CreationDate="2015-02-03T08:27:59.530" Score="11" Body="&lt;p&gt;What is wrong with a fading memory (&lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average&quot; rel=&quot;noreferrer&quot;&gt;exponential&lt;/a&gt;) moving average:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ma_new = alpha * new_sample + (1-alpha) * ma_old&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12119" LastActivityDate="2015-02-03T08:27:59.530" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="20337" PostTypeId="1" CreationDate="2015-02-03T09:08:32.847" Score="1" ViewCount="560" Body="&lt;p&gt;I am working in image segmentation and I would like to ask you something about my problem. I have a image such as bellow. I want to segment leopard from background. However, intensity information is not useful for my case because the bough (background) whose intensity distribution is similar with leopard's. Could you suggest to me some method to segment leopard? I attacted one example using active contour.Thank you in advance&#xA;&lt;img src=&quot;https://i.stack.imgur.com/AvOZR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2016-07-28T09:23:22.100" Title="How to segment object when it has similar histogram with background" Tags="|image-processing|image-segmentation|segmentation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20338" PostTypeId="2" ParentId="20280" CreationDate="2015-02-03T09:50:53.810" Score="0" Body="&lt;p&gt;Although your claim does not make much sense to me, you may do following steps to ensure get what you described in your question.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Construct some discriminative feature space based on the original image.&lt;/li&gt;&#xA;&lt;li&gt;Find two pixels that are separated most in this feature space.&lt;/li&gt;&#xA;&lt;li&gt;Pick one pixel as your landmark, and sort all pixels with respect to their distance away from this landmark.&lt;/li&gt;&#xA;&lt;li&gt;Set the first PERC% of these pixels to black, and the reset to white.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The &quot;discriminative feature&quot; can be any feature. The whole point here is to make different pixels different values. You may directly use raw pixel intensity if you want, but keep in mind of possible cases that there are 10% of 0 pixels, but you only want to set 7% of all pixels to black. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general idea here is to convert all pixels in an image into a new &quot;ranked&quot; feature space. In this way, selecting PERC% of pixels is equivalent to set a threshold of value PERC to this feature map.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-02-03T09:50:53.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20339" PostTypeId="2" ParentId="20332" CreationDate="2015-02-03T09:54:08.773" Score="1" Body="&lt;p&gt;I think you should just dig deeper and get your hands dirty. I have used &lt;em&gt;Mathematica&lt;/em&gt; as it is the fastest way I can model something like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5JIFM.png&quot; alt=&quot;Mathematica graphics&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(* img *)&#xA;&#xA;dwd = DiscreteWaveletTransform[img, BiorthogonalSplineWavelet[1, 3], 4]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's how the decomposition tree looks like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p5xZt.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then extract every coefficient&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;coeffs = dwd[{___, 0 | 1 | 2 | 3}, {&quot;Image&quot;, &quot;ImageFunction&quot; -&amp;gt; Identity, ImageSize -&amp;gt; 120}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From left to right &lt;code&gt;{0}&lt;/code&gt;, &lt;code&gt;{1}&lt;/code&gt;, &lt;code&gt;{2}&lt;/code&gt; and &lt;code&gt;{3}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lSWfL.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you can compare those to the coefficients after applying the &lt;code&gt;1 + Log[coeff^2]&lt;/code&gt; function to them&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pvEzS.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7477" LastActivityDate="2015-02-03T09:54:08.773" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="20340" PostTypeId="1" CreationDate="2015-02-03T10:53:50.267" Score="2" ViewCount="8232" Body="&lt;p&gt;I'm working on integral transforms for a science initiation project and i got to do a work on the Hilbert-Huang transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen on the internet that, after one found the IMFs with the EMD method, you can do a Hilbert Spectrum plot of the absolute value of the componentes $H(\omega,t)$ where $t$ is for time, and $\omega(t)$ is the instantaneous frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose i got 5 IMFs stored in 5 vectors in GNU/Octave (or Matlab, wharever). How can i do such plot?&lt;/p&gt;&#xA;" OwnerUserId="13456" LastActivityDate="2015-05-09T07:10:19.460" Title="How to plot the Hilbert Spectrum in Hilbert-Huang transform?" Tags="|matlab|hilbert-transform|octave|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20341" PostTypeId="2" ParentId="20340" CreationDate="2015-02-03T11:28:47.667" Score="2" Body="&lt;p&gt;Final step is pretty straightforward. All you need to do is to apply the Hilbert Transform to each IMF and extract the instantaneous frequency from analytical signal. Instantaneous frequency is given by:&#xA;$$\omega(t)=\dfrac{d\phi(t)}{dt} $$&#xA;where $\phi(t)=\mathrm{arg}[x_a(t)]$ (unwrapped phase of the analytical signal). Keep in mind that MATLAB (Octave) &lt;code&gt;hilbert&lt;/code&gt; function already returns analytical signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact you might want to re-use this code from Mathworks File Exchange: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/19681-hilbert-huang-transform/content//plot_hht.m&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;plot_hht&lt;/strong&gt;&lt;/a&gt; it is a good starting point.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-02-03T11:28:47.667" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20342" PostTypeId="2" ParentId="20333" CreationDate="2015-02-03T11:59:31.460" Score="13" Body="&lt;p&gt;A moving average can be implemented recursively, but for an exact computation of the moving average you have to remember the oldest input sample in the sum (i.e. the &lt;code&gt;a&lt;/code&gt; in your example). For a length $N$ moving average you compute:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac{1}{N}\sum_{k=n-N+1}^nx[k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y[n]$ is the output signal and $x[n]$ is the input signal. Eq. (1) can be written recursively as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=y[n-1]+\frac{1}{N}(x[n]-x[n-N])\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you always need to remember the sample $x[n-N]$ in order to compute (2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As pointed out by Conrad Turner, you can use an (infinitely long) exponential window instead, which allows you to compute the output only from the past output and the current input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\alpha x[n]+(1-\alpha)y[n-1]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but this is not a standard (unweighted) moving average but an exponentially weighted moving average, where samples further in the past get a smaller weight, but (at least in theory) you never forget anything (the weights just get smaller and smaller for samples far in the past).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-03T11:59:31.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20344" PostTypeId="2" ParentId="20312" CreationDate="2015-02-03T14:21:13.353" Score="0" Body="&lt;p&gt;You may find a function that reconstrucs the signal from the break down of diferent frequencies. If you inverse the function, you may need to reconstruct the signal if you denoise the signal or if you want to extract specific frequencies and remain with the signal post frequency extraction (like you want to extract the noise only) &lt;/p&gt;&#xA;" OwnerUserId="7478" LastActivityDate="2015-02-03T14:21:13.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20345" PostTypeId="2" ParentId="20310" CreationDate="2015-02-03T14:45:34.327" Score="1" Body="&lt;p&gt;Beyond the good response of -sector- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use applying the prior results of a succession wavelet decompositions of a discrete Wavelet applying only one level decomposition for a haar wavelet as to segment frequencies for both Detail and Scaling coefficients. You keep on applying this until the desired range. You would need to calculate the equivalent frequency range in herts for each segmented part. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond wavelets you can use mutitaper for a weak sense stationary time series (you make the series stationary of second order by any methods suitable depending on the signal - Loess regresión to remove MA, removal of existing AR terms or diferenciation which ever or combination of them provides second order stationarity to the series and then test for stationarity with time frequency stationarity tests). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you use multitaper to extract the spectrum of frequencies then using a white noise F test determine the relevant frequencies position in the frequency spectrum and then using this construct a band pass filter for the frequencies you want removed, effectively reconstructingt the signal desired frequency range. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the multitaper package in R  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One caveat is that it is posible that important information on the signal is eliminated by the process of making the series second order stationary. One way to minimize this is to partition the data by segmenting the data in similar variance segments. So in obtaining the second order stationarity of a similar variance segment less of the signal is eliminated in making the series second order stationarity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alpha waves are similar to an AR process or low MA process so the requirement of weak sense stationarity may eliminate them from the signal. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-02-04T22:38:27.033" LastActivityDate="2015-02-04T22:38:27.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20346" PostTypeId="2" ParentId="15176" CreationDate="2015-02-03T16:26:23.407" Score="3" Body="&lt;p&gt;I know this answer is very late but I think this question worth an answer &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm you used goes as follows: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Blur the original image using the Gaussian filter with given Mask Size &amp;amp; Sigma&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Subtract the blurred image from the original (result is called Mask) to eliminate background and get the edges regions&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add a weighted portion from the mask to the original image by multiplying the Mask (the edges only) by K to enhance edges regions  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;K: User input (If K = 1 Unsharp, If K &gt; 1 Highboost) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mask(x,y) = Orig(x,y) – Blurred(x,y)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Result(x,y) = Orig(x,y) + K × Mask(x,y)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static Image&amp;lt;Gray, byte&amp;gt; Sharpen(Image&amp;lt;Gray, byte&amp;gt; image, int w, int h, double sigma1, double sigma2, int k)&#xA;    {&#xA;        w = (w % 2 == 0) ? w - 1 : w;&#xA;        h = (h % 2 == 0) ? h - 1 : h;&#xA;        //apply gaussian smoothing using w, h and sigma &#xA;        var gaussianSmooth = image.SmoothGaussian(w, h, sigma1, sigma2);&#xA;        //obtain the mask by subtracting the gaussian smoothed image from the original one &#xA;        var mask = image - gaussianSmooth;&#xA;        //add a weighted value k to the obtained mask &#xA;        mask *= k;&#xA;        //sum with the original image &#xA;        image += mask;&#xA;        return image;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think your problem is that you didn't subtract the smoothed image from the original image, anyway I hope this help&lt;/p&gt;&#xA;" OwnerUserId="13362" LastEditorUserId="13362" LastEditDate="2015-02-03T16:48:13.597" LastActivityDate="2015-02-03T16:48:13.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20347" PostTypeId="2" ParentId="20335" CreationDate="2015-02-03T17:05:08.433" Score="0" Body="&lt;p&gt;You need to decide what frequencies you want to keep.  If you are recording your (human) voice, it may be helpful to think about frequencies in terms of notes on the piano.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the A above middle-C is &lt;a href=&quot;http://en.wikipedia.org/wiki/A440_%28pitch_standard%29&quot; rel=&quot;nofollow&quot;&gt;440 Hz&lt;/a&gt;. Go up an octave more, and you get &lt;code&gt;880 Hz&lt;/code&gt;.  Four octaves above would be &lt;code&gt;2*2*2*2*440 Hz = 7040 Hz = 7.04 KHz&lt;/code&gt;.  Which notes do you want to filter out, and which ones do you want to keep?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are making a high pass filter.  What low notes do you want to remove?  It will probably work for you to just pick an octave, and then compute the frequencies using the examples I gave above.&lt;/p&gt;&#xA;" OwnerUserId="13601" LastEditorUserId="7092" LastEditDate="2015-02-03T17:17:43.823" LastActivityDate="2015-02-03T17:17:43.823" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20348" PostTypeId="2" ParentId="20335" CreationDate="2015-02-03T17:08:27.597" Score="0" Body="&lt;p&gt;You have to know about Bin fft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have : FFT Size : 256 and Sample rate is 8000hz (the max frequency would contain on your data is 4000hz). then you have 8000/ 256 bin -&gt; about 31.25 hz/ bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the High Pass Filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means you want to get all data above f0 (= 2000 hz. Example) and remove all data below f0 (2000hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bin at 2000hz =  2000/ 31.25 = 64 bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you data put through FFT Block , you have frequency spectrum from -4000hz to +4000hz. and from 0 -&gt; 128 -&gt; 256 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in frequency domain. you have to remove from 64 bins -&gt; 128 -&gt; 192 bins .&#xA;and you get bins from 0 -&gt; 63 and 193 -&gt; 256 , &lt;/p&gt;&#xA;&#xA;&lt;p&gt;pass it into Ifft , So the output only contains from 2000hz to 4000hz .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it helps you.&lt;/p&gt;&#xA;" OwnerUserId="13602" LastActivityDate="2015-02-03T17:08:27.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20349" PostTypeId="1" CreationDate="2015-02-03T18:05:01.340" Score="1" ViewCount="268" Body="&lt;p&gt;I have a map (in image format) describing the power grid of a continent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Power plants have flags next to them, indicating their type (hydro, gas, oil, etc.). The power lines have a color indicating their tensions (different voltages). The cities are marked as black dots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a piece of the map, courtesy of the ENTSO-E consortium&#xA;&lt;img src=&quot;https://i.stack.imgur.com/HYtbo.jpg&quot; alt=&quot;Iceland power grid&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.entsoe.eu/publications/order-maps-and-publications/electronic-grid-maps/Pages/default.aspx&quot; rel=&quot;nofollow noreferrer&quot;&gt;Full maps here&lt;/a&gt;. Things get much more complex in populated area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the power lines are often overlapping each other. Moreover they are not simple straight lines. Two cities (points) can be connected by a &lt;strong&gt;broken&lt;/strong&gt; line, with no middle point in between.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to turn that map image into a graph (dataset). The broken lines may be straightened and have their full length marked as the weight of the arc. Or they may be handled by inserting middle points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to automatize as much work as I can, but, since the map is so complex, I understand I'll probably need some manual tool to do the final pass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would you suggest?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think finding the power-plants should be possible using an automatic tool, then corrections and addition of arcs could be done using an assisted manual tool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: perhaps this is something that can be done with a plugin for GIS software? If programming is involved, my favorite languages are Java and Python. I know C++ too.&lt;/p&gt;&#xA;" OwnerUserId="13603" LastEditorUserId="13603" LastEditDate="2016-01-23T11:46:15.820" LastActivityDate="2016-01-23T11:46:15.820" Title="Extract graph data from map image" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20350" PostTypeId="1" CreationDate="2015-02-03T18:16:54.030" Score="1" ViewCount="718" Body="&lt;p&gt;I'm trying to convert musicg Spectrogram output to dBFS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With 16-bit signed integer PCM audio, and an FFT length of 2048, I'm trying to analyze the spectrogram for an audio file to determine things like &quot;Was a particular frequency notched out by equalization&quot; or &quot;Was the audio high-passed or low-passed&quot; by looking for peaks in the spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm taking a normalized musicg spectrogram, and converting the magnitude values to dBFS (max value: 0 dBFS) by doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dBFS = (20 * Math.log10( 2 * Math.abs(magnitude) / 2048)) - 100&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think this is giving me what I'm looking for, and it correlates closely to what I'm seeing in other tools.  And if I decrease the gain on a file by 20db, and then analyze the decreased file, the dBFS data I get back is 20db less than the original.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I noticed that when I &lt;a href=&quot;http://manual.audacityteam.org/o/man/plot_spectrum.html&quot; rel=&quot;nofollow&quot;&gt;view the spectrogram in Audacity&lt;/a&gt; (using plot spectrum), the dB values in Audacity seem to range between 4db and 9db higher than what I'm getting from musicg and the above equation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there something I'm doing particularly wrong in the way I'm trying to calculate dBFS from the musicg absolute spectrogram data?&lt;/strong&gt;  (or perhaps I'm mistaken and what I'm calculating, and what Audacity is displaying, are not quite the same thing)&lt;/p&gt;&#xA;" OwnerUserId="13598" LastActivityDate="2015-02-03T18:16:54.030" Title="Converting musicg spectrogram output to dBFS" Tags="|spectrogram|dbfs|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20351" PostTypeId="1" CreationDate="2015-02-03T23:12:15.330" Score="1" ViewCount="70" Body="&lt;p&gt;It should be obvious that if there is no interference but only zero-mean random noise, as it is discussed in many textbooks. When there is known deterministic interference, what is the capacity now? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In details, the discrete channel model is as follows:&#xA;$$\mathbf{y}(n) = \mathbf{H}\mathbf{x}(n) + \mathbf{i}(n) +\mathbf{n}(n),$$ &#xA;where $\mathbf{y}(n)$ is the received signal vector at time index $n$, $\mathbf{x}(n)$ $\mathbf{i}(n)$ $\mathbf{n}(n)$ are the transmitted waveform, interference signal vector and  the noise for time $n$, $\mathbf{H}$ is the channel which is known and does not change. I believe the answer should be $\log|\mathbf{I}+\mathbf{R}_n^{-1}\mathbf{H}\mathbf{R}_{x}\mathbf{H}^H|$, where $\mathbf{R}_n$ is the covariance of the noise. The effect of interference is directly removed from the receiver. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem is what if the values of the interference are unknown to the receiver and transmitter but they only know the value for any time index is deterministic? What can we say about the capacity? What will the receiver and transmitter do in practice? will the receiver try to estimate the interference?&lt;/p&gt;&#xA;" OwnerUserId="4860" LastActivityDate="2015-02-03T23:12:15.330" Title="What is the capacity of MIMO channels with deterministic interference plus random noise" Tags="|discrete-signals|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20352" PostTypeId="1" CreationDate="2015-02-04T10:03:05.180" Score="0" ViewCount="239" Body="&lt;p&gt;I am using SIFT features for detecting logos in clothes. SIFT is quite powerful, as it is scale invariant, but how do I deal with the problem of occlusion and warping?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, the logos in clothes might be partially occluded, and can also be warped when the clothes are stretched or squeezed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion and directions? Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some example are showed here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Logo on leg:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DcV1e.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AzoLD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ctMJH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11631" LastActivityDate="2015-02-04T10:03:05.180" Title="How do I deal with occlusion, warping, or perspective distortion for object detection" Tags="|image-processing|computer-vision|opencv|object-recognition|machine-learning|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20353" PostTypeId="1" CreationDate="2015-02-04T10:13:04.270" Score="5" ViewCount="3654" Body="&lt;p&gt;Given a document image (i.e. newspaper), how to extract photos in it or remove text region?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think traditional OCR methods may not be suitable here, as I don't need to recognize the text, and OCR is not accurate and slow. I believe text region (i.e. text blocks) and image region should be distinguishable by some threshold based methods in image processing. Any suggestions or example codes in OpenCV will be appreciated. Thanks！&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, what if the background color is not white, or the background color of certain blocks are not white?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7qrQP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11631" LastEditorUserId="11631" LastEditDate="2015-02-05T02:56:19.010" LastActivityDate="2015-09-03T12:31:25.727" Title="How to remove text region in a document image? or extract image from a document image" Tags="|image-processing|signal-analysis|computer-vision|opencv|machine-learning|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20354" PostTypeId="2" ParentId="20278" CreationDate="2015-02-04T13:30:35.783" Score="0" Body="&lt;p&gt;&quot;How can this model be used to describe the state occurring at all times?&quot;&#xA;If you mean interpolation there are various techniques for going from discrete to continuous. If you want to peek or evaluate between the discrete time intervals there is a technique called delayed Z transforms.  My recommendation would be: &#xA;Sampled-data control systems&#xA;by Ragazzini, John Ralph, 1912-&#xA;It's quite old but in practice provides good guidance.  It's available at &#xA;&lt;a href=&quot;https://archive.org/details/sampleddatacontr00raga&quot; rel=&quot;nofollow&quot;&gt;https://archive.org/details/sampleddatacontr00raga&lt;/a&gt;&#xA;Be aware the technique seems to have fallen out of favor; so some newer engineers might never of heard of it and might disapprove. It can be used to examine responses in-between control settings or, if you know the system, estimate how much the system &lt;em&gt;might&lt;/em&gt; be varying between samples.  i.e. how ignorant you are at a certain sampling rate.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2015-02-04T13:30:35.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20355" PostTypeId="2" ParentId="20353" CreationDate="2015-02-04T13:32:37.790" Score="0" Body="&lt;p&gt;in this &lt;a href=&quot;http://www.quora.com/How-do-I-detect-text-images-in-a-document-image&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; , last comment from Sastry Aditya.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There is a technique called windowing. This is done using neural&#xA;  networks or support vector machines.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;You basically train your classifier(Neural net or SVM) with 1000000's&#xA;  of images of single characters of pixel size 10 x 10 or so. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If your target image is say 1280 x 720 you start off by dividing into&#xA;  a grid of 10x10 squares. You feed each of this square to a classifier&#xA;  to see if it is a text character. If it turns out to be true you make&#xA;  it blank.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;After this anything that is not blank in your image region is the text&#xA;  region.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In this approach, you don't need to recognize the texts like OCR, just detect them!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will be faster and straight to the point you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit : took a further study on this topic &gt;&gt; a lot of newspaper segmentation algorithms have been proposed recently (IEEE database). Just for if you want something in academic way.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastEditorUserId="13507" LastEditDate="2015-02-04T14:22:54.750" LastActivityDate="2015-02-04T14:22:54.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20356" PostTypeId="1" CreationDate="2015-02-04T13:54:38.300" Score="2" ViewCount="153" Body="&lt;p&gt;I would like to know how the output sequence from a fractionally spaced equalizer, with a non-integer oversampled input signal, is generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, for $T=T_{sym}/2$, my actual code is something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for ktime=1:2:L&#xA;    nindex                               = ktime+(Ntaps:-1:1);&#xA;    inputequalizer_block                 = inputsignal(nindex);&#xA;    outputequalizer(floor((ktime+1)/2))  = W*inputequalizer_block;   &#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, let's say I have an input signal with $T=2T_{sym}/3$. I understand I should have 2 different filters, but I dont know how the baudrate-output is generated:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; for ktime=1:3:L&#xA;    nindex                               = ktime+(Ntaps:-1:1);&#xA;    inputequalizer_block                 = inputsignal(nindex);&#xA;    for i=1:2&#xA;       output_aux(i)  = W{i}*inputequalizer_block;   &#xA;    end&#xA;    % Some processing on output_aux(1) and output_aux(2)?&#xA;    outputequalizer    =....&#xA; end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not sure I am close to the solution, or miles and miles far away. &#xA;Any suggestion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="13615" LastEditorUserId="13615" LastEditDate="2015-02-06T16:24:38.183" LastActivityDate="2015-02-06T16:24:38.183" Title="Fractional equalizer with non-integer oversampled signal as input" Tags="|matlab|filtering|equalization|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20357" PostTypeId="2" ParentId="20311" CreationDate="2015-02-04T14:39:02.347" Score="0" Body="&lt;p&gt;To compare two signals you can use wavelet cross correlation and also wavelet coherence and wavelet phase analyses.  In the first case you compare the cross correlation of the signal at different frequencies. In wavelet phase analysis you see which and if a signal anticipates another across time. (Is the cause of the other signal behaviour). You can also use wavelet coherence analysis. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastActivityDate="2015-02-04T14:39:02.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20358" PostTypeId="1" AcceptedAnswerId="20359" CreationDate="2015-02-04T14:50:39.607" Score="1" ViewCount="2105" Body="&lt;p&gt;I want to train a cascade classifier to face detect. I read this &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/train-a-cascade-object-detector.html&quot; rel=&quot;nofollow&quot;&gt;page&lt;/a&gt;. But I wont use trainingImageLabeler app, because I already have face and nonface database sized 24x24. How I use trainCascadeObjectDetector function with my own database?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any example except this you know?&lt;/p&gt;&#xA;" OwnerUserId="13616" LastEditorUserId="53" LastEditDate="2015-02-16T18:30:45.557" LastActivityDate="2015-06-04T18:11:00.517" Title="Training own classifiers using trainCascadeObjectDetector for face detection" Tags="|matlab|computer-vision|machine-learning|face-detection|matlab-cvst|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20359" PostTypeId="2" ParentId="20358" CreationDate="2015-02-04T15:25:20.053" Score="1" Body="&lt;p&gt;If you want to train the classifiers with your own database, you will only need 'trainCascadeObjectDetector' function and feed your images into the proper arguments (Positive, negative images). The output classifier will be in your 'outputXMLFilename' as in  &lt;a href=&quot;http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html&quot; rel=&quot;nofollow&quot;&gt;traincascadeobjectdetector&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;trainingImageLabeler is helpful function for classifying positive/negative image. Try this function later when you work with larger database.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-02-04T15:25:20.053" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20360" PostTypeId="1" CreationDate="2015-02-04T15:45:20.090" Score="0" ViewCount="90" Body="&lt;p&gt;I am a math major and have knowledge of Calculus, Real and Complex Analysis,PDEs and probability theory. I would like to get started with DSP and need a book suitable for math majors. Please give your suggestions. Thank you! :)&lt;/p&gt;&#xA;" OwnerUserId="13618" LastActivityDate="2015-02-04T15:45:20.090" Title="What is the best book on Digital Signal processing for math majors?" Tags="|image-processing|discrete-signals|source-separation|" AnswerCount="0" CommentCount="3" ClosedDate="2015-02-04T22:25:39.297" ContentLicense="CC BY-SA 3.0" />
  <row Id="20361" PostTypeId="1" AcceptedAnswerId="20370" CreationDate="2015-02-04T20:41:50.270" Score="3" ViewCount="379" Body="&lt;p&gt;The OFDM MMSE channel estimator seems to require a-priori knowledge of the channel to calculate the MMSE estimate.  See equation 8 here: &lt;a href=&quot;http://cache.freescale.com/files/dsp/doc/app_note/AN3059.pdf&quot; rel=&quot;nofollow&quot;&gt;http://cache.freescale.com/files/dsp/doc/app_note/AN3059.pdf&lt;/a&gt;.  The autocovariance matrix explicitly includes the actual channel &lt;strong&gt;H&lt;/strong&gt; or &lt;strong&gt;g&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you presumably don't have this information, otherwise why would you be estimating it?&#xA;If you are able to deal with the complexity of the MMSE estimator, how do you implement it in practice without prior knowledge of what the channel is?&lt;/p&gt;&#xA;" OwnerUserId="13620" LastEditorUserId="13620" LastEditDate="2015-02-04T21:45:37.173" LastActivityDate="2015-02-05T08:52:27.363" Title="Does the OFDM MMSE Channel Estimator Require Prior Channel Knowledge?" Tags="|estimation|ofdm|equalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20363" PostTypeId="1" CreationDate="2015-02-04T21:13:12.883" Score="0" ViewCount="331" Body="&lt;p&gt;Signal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(t) = | cos(2πft)|, f != 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is the input of an ideal band-pass filter  with bandwidth &lt;code&gt;B = 3f/2.&lt;/code&gt;&#xA;How can i Find the Output of the &lt;code&gt;y(t)&lt;/code&gt; of the signal.&lt;/p&gt;&#xA;" OwnerUserId="13623" LastActivityDate="2015-02-05T07:00:03.483" Title="Output of a band pass filter" Tags="|filters|sampling|lowpass-filter|dsp-core|bandpass|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20364" PostTypeId="1" CreationDate="2015-02-04T23:16:22.180" Score="1" ViewCount="757" Body="&lt;p&gt;I have a signal given as an expression $x(t)$.  In frequency domain most of the information is around 0 and higher frequencies progressively get smaller and smaller compared to DC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering how to determine the sampling rate I should use if I wanted to compute discrete samples and pass them through some filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was considering that if I pick some $F_s$ sampling rate, aliasing will cause frequencies above $|F_s/2|$ to be folded back into the region $F_s/2$.  Using Parseval's theorem the sum of square errors because of this appears to be $\int_{|\Omega &amp;gt; F_s/2|}|X(j\Omega)|^2d\Omega$ .  So I could try to figure out the acceptable error and pick $F_s$ based on that.  But that integral goes to infinity and what if the integral doesn't converge, or it's not something I can compute?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also seen discussions on anti-aliasing filters that mention the stop band attenuation should be higher than the SNR (eg &lt;a href=&quot;http://ww1.microchip.com/downloads/en/AppNotes/00699b.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;anti-aliasing filter&lt;/a&gt;).  In my case I don't really have an anti-aliasing filter because I'm just computing x(t).  But it seems if I want 16 bits resolution, SNR=98dB so if I compute the frequency at which $20log(\frac{|X(j\Omega)|}{|X(0)|})&amp;lt;-98$ it will be as if I used anti-aliasing filter.  However, I don't understand why the stop-band attenuation is chosen to be equal to SNR, and what that means in terms of signal error.  Because while -98dB is really small compared to the rest of the signal, there are infinitely many aliased frequencies being folded and added up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any clarification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have frequency vs relative magnitude (relative to magnitude at 0 frequency) plot calculated by sampling at 100kHz and 1MHz and taking DFT of the samples.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ghiPZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What reasonable conclusion about required sampling rate can I make based on something like this?  How can I justify it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example at sampling rate 100kHz, the smallest frequency component appears to be 158 dB smaller than the largest (or 10^(7.9) times smaller).  Is that small enough to be unimportant to overall signal?  How should I go about determining what's small enough?&lt;/p&gt;&#xA;" OwnerUserId="10160" LastEditorUserId="10160" LastEditDate="2015-02-05T20:35:53.693" LastActivityDate="2015-02-05T20:35:53.693" Title="How to choose sampling rate for non-band limited signal given as an expression?" Tags="|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20365" PostTypeId="2" ParentId="20364" CreationDate="2015-02-05T01:18:58.413" Score="1" Body="&lt;p&gt;It depends on the spectral distribution of the signal under concern. If, for example, as you said the signal has most of its energy around zero frequency and gets progressively smaller as frequency increases then it may be possible to sample it with an acceptable error, provided that the progress is rapid enough. So it depends on the progress: Provided that it decays fast enough, you may find an acceptable sample rate which would provide a bounded error. After all many practical signals will have nonzero (but very small) energy above their half the sampling rate even after aa filtering, but nevertheless they are sampled with sufficient accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And your bit resolution vs stop band attenuation concern. That is the noise floor of the N-bit representation. Any error less than noise floor, and being uncorrelated with the signal, may be considered ok.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finaly please note that, when the aliased frequencies fold up (say at 0 hz) for every next shifted spectra to be added, the folded tail will be progressiveley smaller, as it comes from progressiveley farther away from its center. Hence the sum of such infinitely many decaying terms may converge. Provided the folded terms are getting smaller and smaller.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-02-05T01:26:09.017" LastActivityDate="2015-02-05T01:26:09.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20366" PostTypeId="2" ParentId="20364" CreationDate="2015-02-05T01:42:37.713" Score="1" Body="&lt;p&gt;A few notes to add to Bulent's answer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The convential way to proceed is to low-pass filter your signal before sampling, to prevent or minimize aliasing. Choose your sampling frequency and low-pass filter at the Nyquist frequency (equal to half the sampling frequency).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In theory, with ideal sampling, aliases don't become attenuated after each fold. In practice, they do. There are two main reasons. One is that actual sampling is not ideal, so the replicas of the spectrum in the sampled signal are attenuated following a sinc-type envelope. The other is that all actual circuits are band-limited, so the spectrum reflections get attenuated as their frequency goes out the circuit's bandwidth.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I believe that the SNR you refer to is the quantization SNR. It is not directly related to the sampling rate, but to the quantization of the samples. The application note you linked to simply indicates that the anti-aliasing filter's rejection at the Nyquist frequency (and beyond) should be such that any remaining out-of-band signal energy is undetectable by the sampler (i.e., of amplitude similar to the noise that the sampler itself introduces to the signal). Consider this a rule of thumb, since a sampler's SNR is calculated under ideal conditions, where the sampled signal is a pure sine wave.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-02-05T01:42:37.713" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20367" PostTypeId="2" ParentId="20363" CreationDate="2015-02-05T06:50:57.100" Score="1" Body="&lt;p&gt;Your signal is periodic with period $\frac{1}{2f}$ hence has a Fourier series expansion with spacing between the frequency components of $2f$. The output of your ideal filter then is the sum of the Fourier components that fall within the bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because your bandwidth is less than the spacing between the frequency components your output will contain at most one frequency component.&lt;/p&gt;&#xA;" OwnerUserId="12119" LastEditorUserId="12119" LastEditDate="2015-02-05T07:00:03.483" LastActivityDate="2015-02-05T07:00:03.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20368" PostTypeId="1" AcceptedAnswerId="20372" CreationDate="2015-02-05T07:32:40.633" Score="5" ViewCount="22606" Body="&lt;p&gt;After considering a couple of advices and suggestions for upsampling techniques here, I finally converged to use the cubic interpolation technique to estimate the voltage values corresponding to intermediate samples present between the original or previous samples. I know that spline interpolation is basically used for getting smoother curves, but what makes it different from the normal cubic interpolation technique as both of them use a 3rd degree polynomial to estimate intermediate values?.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another implementation issue is that, for example, If I have some voltages corresponding to some samples say&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    V = 3.674, 6.791, 8.888, 9.667.....&#xA;    Sample = 2, 3, 4, 5.....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, If we have to find the voltage information corresponding to the intermediate sample 3.5, then using cubic polynomial method, we arrive at 4 equations and 4 unknowns obtained by using the information provided by the neighboring samples closest to sample 3.5.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    V(2) = a + 2b + 4c + 8d&#xA;    V(3) = a + 3b + 9c + 16d&#xA;    V(4) = a + 4b + 16c + 64d&#xA;    V(5) = a + 5b + 125c + 125d&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, solving these equations I arrived at&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   a = -4.428&#xA;   b = 4.3756&#xA;   c = -0.06299&#xA;   d = -0.04966&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using these values , we can calculate the voltage value at the sample 3.5 as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  V(3.5) = a + 3.5b + 12.25c + 42.875d&#xA;  V(3.5) = 7.186 Volts&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now my question - Is this method of interpolation suitable for large sampling rates?. How can I use this technique for upsampling a signal say from 10 sps to 100 sps for N = 1024 sample points?. I know that I have to develop a function that performs this cubic interpolation task between original samples (in C++), but I am just wondering how to implement it for upsampling for a continuous series of samples . Any suggestions, ideas or advices regarding the topic and its implementation would be appreciated. Thanks! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that cubic interpolation can operate on 4 data points and the&#xA;more sophisticated technique I can think of is cubic spline. In case I am&#xA;using the normal cubic interpolation, how about I loop through the &quot;N&quot;&#xA;sample points i.e. 1024, for a condition below the &quot;input sampling rate&quot;&#xA;i.e. 10 sps considering 4 data points each and then performing the&#xA;interpolation function  based on the up sampling factor between each of&#xA;those 4 consecutive data points (Meaning - Interpolating/Estimating 10&#xA;values between each of those 4 data points) and then the function considers&#xA;the next 4 data points to perform the same operation and it goes on until a&#xA;100 samples has bee acquired i.e. the output sampling rate!  &lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="9152" LastEditDate="2015-02-06T06:13:53.973" LastActivityDate="2022-02-14T14:35:35.807" Title="What is the difference between cubic interpolation and cubic &quot;Spline&quot; interpolation?. How to use it for upsampling purpose?" Tags="|sampling|interpolation|resampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20369" PostTypeId="2" ParentId="3126" CreationDate="2015-02-05T08:09:45.990" Score="6" Body="&lt;p&gt;My answer is that if it's linear system you should use KF; if it's nonlinear system with weak nonlinearity you should use EKF, if  the nonlinear system with  high nonlinearity you may consider the well-known UKF. I draw a graph for this, hopefully, it's useful. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/rgeEB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13585" LastEditorUserId="13585" LastEditDate="2015-02-05T08:53:13.197" LastActivityDate="2015-02-05T08:53:13.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20370" PostTypeId="2" ParentId="20361" CreationDate="2015-02-05T08:52:27.363" Score="1" Body="&lt;p&gt;It's true that the MMSE channel estimator requires some a-priori channel knowledge, namely the autocovariance (or autocorrelation) matrix of the channel and the signal-to-noise ratio (SNR). Note that these are statistical quantities while the aim of channel estimation is to estimate the actual channel transfer function at a certain point in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The autocovariance matrix $\underline R_{HH}$ is based on some statistical channel model, e.g. the Rayleigh fading channel or AWGN channel. As you have observed correctly, the channel matrix $H$ is unknown and thus $\underline R_{HH}$ cannot be calculated from $H$. It's rather an assumption based on theroetical models or earlier measurements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The SNR can usually be estimated from the received signal by measuring the noise power on zero subcarriers or analyzing the received constellation diagram.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-02-05T08:52:27.363" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20371" PostTypeId="1" CreationDate="2015-02-05T09:39:45.587" Score="3" ViewCount="2154" Body="&lt;p&gt;According to &lt;a href=&quot;http://hyperphysics.phy-astr.gsu.edu/hbase/waves/clocol.html&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;, the waveforms of clarinets do not have even-numbered components in their harmonic series:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A closed cylindrical air column will produce resonant standing waves at a fundamental frequency and at odd harmonics... As can be seen from a sample waveform, the even harmonics missing from the tone&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there an example of a system that would produce no odd harmonics? &lt;/p&gt;&#xA;" OwnerUserId="13629" LastEditorUserId="80" LastEditDate="2015-02-05T13:04:27.997" LastActivityDate="2023-06-22T18:27:45.057" Title="A clarinet has no even harmonics. What would produce no odd harmonics?" Tags="|fourier-transform|fourier|fourier-series|amplitude|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20372" PostTypeId="2" ParentId="20368" CreationDate="2015-02-05T11:02:00.843" Score="13" Body="&lt;p&gt;The difference between cubic interpolation as described in your question and cubic spline interpolation is that in cubic interpolation you use 4 data points to compute the polynomial. There are no constraints on the derivatives. Cubic spline interpolation computes a third order polynomial only from two data points with the additional constraint that the first and second derivative at the interpolation points are continuous. So if you have 4 points, then you compute 3 different polynomials (between points 1-2, 2-3, and 3-4), and these polynomials are smoothly connected in the sense that their first and second derivatives are equal at the given data points. This is not the case with standard polynomial interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you want an efficient implementation I wouldn't necessarily use polynomial or spline interpolation but I would go for a standard polyphase implementation of a low-pass interpolation filter. If &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is the upsampling factor you get &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; parallel polyphase filters operating at the lower sampling rate, followed by &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; upsamplers, the results of which are added. The low-pass filter can be designed using the window method (e.g. a Kaiser window). There is a lot of material available on the polyphase implementation of interpolators. &lt;a href=&quot;http://www.rle.mit.edu/dspg/documents/main.pdf&quot; rel=&quot;noreferrer&quot;&gt;This Master's thesis&lt;/a&gt; is very accessible. Just have a look at single-stage polyphase implementations using linear-phase FIR filters and ignore the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want or need to use cubic interpolation, here's what you need to do. First of all, some coefficients in your equations are wrong, that's why also the result is not correct. These would be the correct equations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;    V(2) = a + 2b + 4c + 8d&#xA;    V(3) = a + 3b + 9c + 27d&#xA;    V(4) = a + 4b + 16c + 64d&#xA;    V(5) = a + 5b + 25c + 125d&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, you don't want to do it this way because if you always use the sample index as the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-coordinate you'll end up with a very large range for the coefficients of the system of linear equations (because you need to take the third power), and your coefficient matrix will sooner or later become ill-conditioned (asking for numerical problems). Second, and even more importantly, you would get a different system of equations for every new segment of the input signal, which would be very inefficient. You can do the interpolation by solving a &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; system of linear equations with &lt;em&gt;the same&lt;/em&gt; coefficient matrix each time. Just the left-hand side vector (containing the values of the given data points, &lt;code&gt;V&lt;/code&gt; in your example) will be different for each segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You compute a cubic polynomial for each segment (i.e. for each range between two given data points) by considering the data points defining the segment and the two adjacent data points, just as in your example. If you define the cubic polynomial as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(x)=a_0+a_1x+a_2x^2+a_3x^3$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and if you define the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-axis values of the 4 current input data points as &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, you get the following system of equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}y_0&amp;amp;=a_0-a_1+a_2-a_3\\&#xA;y_1&amp;amp;=a_0\\&#xA;y_2&amp;amp;=a_0+a_1+a_2+a_3\\&#xA;y_3&amp;amp;=a_0+2a_1+4a_2+8a_3\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$y_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k=0,1,\ldots, 3$&lt;/span&gt; are the current data points, and the current segment is between the points &lt;span class=&quot;math-container&quot;&gt;$y_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_2$&lt;/span&gt;. The system above is readily solved as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;a_0&amp;amp;=y_1\\&#xA;a_1&amp;amp;=-\frac13 y_0 - \frac12 y_1 + y_2 - \frac16 y_3\\&#xA;a_2&amp;amp;=\frac12  (y_0 + y_2) - y_1\\&#xA;a_3&amp;amp;=\frac12  \left[(y_1 - y_2) + \frac13 (y_3 - y_0) \right]\\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you just need to evaluate the above 4 expressions for the polynomial coefficients for each set of 4 data values. As soon as you have the coefficients, you can compute the interpolated output values in the current segment by evaluating the polynomial at &lt;span class=&quot;math-container&quot;&gt;$x_i=i/L$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i=1,2,\ldots,L-1$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is the upsampling factor (&lt;span class=&quot;math-container&quot;&gt;$L=10$&lt;/span&gt; in your case). Then you forget the oldest input value, read the new input value, and you have a new set of 4 values from which you compute a new polynomial for the current segment, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a little Matlab/Octave script implementing this method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;x = randn(20,1);        % some input data&#xA;L = 10;                 % upsampling factor&#xA;&#xA;% append points at both ends for first and last segment&#xA;N = length(x);&#xA;x2 = [x(1);x(:);x(N)];&#xA;Nseg = N-1;         % # segments&#xA;&#xA;% matrix to compute polynomial coefficients from the current 4 data points: a = A*y&#xA;A = [0 1 0 0;-1/3 -.5 1 -1/6;.5 -1 .5 0;-1/6 .5 -.5 1/6];&#xA;&#xA;% x-axis values of interpolated values in the current segment&#xA;mu = (0:L-1)/L;&#xA;&#xA;% allocate output vector&#xA;Ny = Nseg*L + 1;&#xA;y = zeros(Ny,1);&#xA;&#xA;% loop over all segments&#xA;for i = 1:Nseg,&#xA;    xt = x2(i:i+3);&#xA;    a = A*xt;&#xA;    yt = a(1) + a(2)*mu + a(3)*mu.^2 + a(4)*mu.^3;&#xA;    Iy = (i-1)*L + (1:L);&#xA;    y(Iy) = yt;&#xA;end&#xA;&#xA;y(Ny) = x(N);&#xA;&#xA;% plot result&#xA;tx = 0:N-1;&#xA;ty = (0:Ny-1)*(N-1)/(Ny-1);&#xA;plot(ty,y,'r-'), hold on&#xA;stem(ty,y,'r'), hold on&#xA;stem(tx,x), hold off&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2020-01-26T11:05:32.760" LastActivityDate="2020-01-26T11:05:32.760" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="20373" PostTypeId="2" ParentId="20371" CreationDate="2015-02-05T11:11:30.080" Score="0" Body="&lt;p&gt;I do not know of a physical system which produces only even harmonics, but you could think of devising a system which doubles the frequency of the incoming periodic signal (containing even and odd harmonics), and adds it to a low-pass filtered version containing only the fundamental frequency. From the low-pass filtered signal you get $f_0$ (the fundamental frequency), and from the frequency doubled signal you get $2f_0$, $4f_0$, etc.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-05T11:11:30.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20376" PostTypeId="2" ParentId="20371" CreationDate="2015-02-05T14:49:00.147" Score="2" Body="&lt;p&gt;Producing &quot;&lt;em&gt;only&lt;/em&gt;&quot; even harmonics is equivalent to producing &lt;em&gt;all&lt;/em&gt; harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say your original signal contains all harmonics:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1f, 2f, 3f, 4f, 5f, ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now remove all the odd harmonics:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2f, 4f, 6f, 8f, 10f, ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original 1f has been removed, so now you will hear 2f as the fundamental, and 4f will sound like the 2nd harmonic, 6f will sound like the 3rd harmonic, etc.  You're back to 1f, 2f, 3f, 4f, 5f, ... except an octave higher.  I think this might be something that happens in instruments, like &quot;overblowing&quot;?  But I'm not sure.  Anyway it will just produce a harmonic sound an octave higher, but with a different timbre.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somewhat related: &lt;a href=&quot;https://dsp.stackexchange.com/a/6178/29&quot;&gt;https://dsp.stackexchange.com/a/6178/29&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-02-05T14:49:00.147" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20377" PostTypeId="1" AcceptedAnswerId="20378" CreationDate="2015-02-05T14:59:10.527" Score="3" ViewCount="1547" Body="&lt;p&gt;I am currently reading the 'Coding' chapter on Rabiner &amp;amp; Schafer's Book on speech processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In one of its exercises, the reader is given a simple A/D converter using 16-bit uniform quantization. The converter uses a sampling rate of $Fs = 8000 Hz$. Then it asks what is the effect on $SNR_Q$ (quantization signal-to-noise ration) if we double the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand, doubling the sampling rate has obviously no effect on the quantizer's range $X_{max}$ as well as the quantization step $\Delta$. Furthermore, the theoretical model for $SNR_Q$ on uniform quantizers is built on top of the hypothesis that the quantization error $e(n)$ follows a uniform probability density, so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;SNR_Q = \frac{\mathcal{E}(\sum_n x^2(n))}{\mathcal{E}(\sum_n e^2(n))}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;should remain constant, since both its numerator and denominator are calculated off expected values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my thinking correct or does the change of the sampling rate break any of my assumptions?&lt;/p&gt;&#xA;" OwnerUserId="13607" LastEditorUserId="128" LastEditDate="2020-03-13T08:34:06.030" LastActivityDate="2020-03-13T08:34:06.030" Title="Sampling Rate Effect on Quantizer SNR" Tags="|sampling|snr|quantization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20378" PostTypeId="2" ParentId="20377" CreationDate="2015-02-05T15:19:52.560" Score="4" Body="&lt;p&gt;You are correct. When using uniform sampling, the sampling rate is unrelated to the quantization noise. Only the quantization step and the signal's dynamic range are relevant for calculating the quantization SNR.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-02-05T15:19:52.560" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20380" PostTypeId="1" AcceptedAnswerId="20381" CreationDate="2015-02-05T16:28:13.000" Score="-3" ViewCount="110" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/x5pet.png&quot; alt=&quot;picture of a lena&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = rgb2gray(imread('lena.bmp'));&#xA;&#xA;imgFirstHalf = img(:,1:2:end);&#xA;&#xA;imgSecondHalf= img(:,2:2:end);&#xA;&#xA;implay(cat(3,imgFirstHalf,imgSecondHalf))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the question I have is, relative to the first frame, how should the second frame look like as in moving left or to its right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the second frame should move to the right because the pixels in the second image are actually to the right relative to the first image(it can be seen from the way the images are created), but I am visually experiencing it the other way. Can somebody explain me what is going wrong with my thought process?&lt;/p&gt;&#xA;" OwnerUserId="13628" LastEditorUserId="128" LastEditDate="2020-03-22T01:18:25.580" LastActivityDate="2020-03-22T01:18:25.580" Title="Shifting Image with MATLAB Code" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="2" ClosedDate="2015-02-06T17:31:11.987" ContentLicense="CC BY-SA 4.0" />
  <row Id="20381" PostTypeId="2" ParentId="20380" CreationDate="2015-02-05T17:26:12.783" Score="0" Body="&lt;p&gt;It appears to move to the left to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first frame takes the pixels from columns 1, 3, 5, 7... and displays them on the screen in columns 1, 2, 3, 4....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second frame takes the pixels from columns 2, 4, 6, 8... and displays them on the screen in columns 1, 2, 3, 4... again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all the pixels in second image are displayed slightly to the left of where they originated.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-02-05T17:26:12.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20382" PostTypeId="2" ParentId="17968" CreationDate="2015-02-05T18:49:24.610" Score="1" Body="&lt;p&gt;The guard interval (or more precisely the cyclic prefix) does not change the bandwidth of the signal in the frequency domain because the guard interval is removed before taking the FFT of the signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way in which the signal is oversampled in the time domain is by zero-padding subcarriers in the frequency domain.  e.g. 802.11n 20 MHz uses 64 subcarriers - 48 subcarriers are data, 4 are pilots, 11 are zero-padded on either side of the spectrum, and 1 is the null DC subcarrier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The zero-padding also reduces interference between adjacent frequency channels.&lt;/p&gt;&#xA;" OwnerUserId="13620" LastEditorUserId="7092" LastEditDate="2015-02-05T19:35:22.697" LastActivityDate="2015-02-05T19:35:22.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20383" PostTypeId="2" ParentId="17470" CreationDate="2015-02-05T19:08:38.127" Score="2" Body="&lt;p&gt;A good starting point for synchronization in generalized OFDM is: &quot;On Synchronization in OFDM Systems using the Cyclic Prefix&quot;, Van De Beek et. al.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AWGN noise will corrupt your symbols, resulting in an error for your synchronization estimates.  You could leverage the fact that you are streaming data, and average the symbol timing offset (STO) and carrier frequency offset (CFO) over multiple symbols in the stream using the cyclic prefix.  Or instead of averaging, you could use a proportional-integral (PI) feedback controller to constantly update your estimates for each new symbol in the stream.  In steady-state, you should have a pretty good estimate of the actual STO and CFO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Here is a great review paper on the subject.  The paper can be found on Google Scholar.&#xA;Furthermore, it describes synchronization using PI control on pages 1407-1409.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Morelli, Michelle, C-CJ Kuo, and Man-On Pun. &quot;Synchronization techniques for orthogonal frequency division multiple access (OFDMA): A tutorial review.&quot; Proceedings of the IEEE 95.7 (2007): 1394-1427.&lt;/p&gt;&#xA;" OwnerUserId="13620" LastEditorUserId="13620" LastEditDate="2015-02-06T18:06:32.270" LastActivityDate="2015-02-06T18:06:32.270" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20384" PostTypeId="1" AcceptedAnswerId="20386" CreationDate="2015-02-05T20:15:39.983" Score="1" ViewCount="281" Body="&lt;p&gt;I was given a WSS ergodic process $x(t)$ with power spectrum :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{array}{rcl}&#xA;       G_x(f) &amp;amp;=&amp;amp;1−\left|\frac{f}{B}\right| &amp;amp;\mbox{for } |f|&amp;lt;B\\&#xA;       G_x(f) &amp;amp;=&amp;amp; 0 &amp;amp; \mbox{ elsewhere}&#xA;\end{array}&#xA;$$&#xA;and first order probability density function is uniform in the range $[−A, A]$. &#xA;How do I evaluate $A$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not a home work but it was a question asked in my exam which I failed.&#xA;Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13561" LastEditorUserId="7092" LastEditDate="2015-03-07T04:11:06.000" LastActivityDate="2015-03-07T04:11:06.000" Title="WSS Ergodic Process with Power Spectrum" Tags="|signal-analysis|power-spectral-density|random|ergodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20385" PostTypeId="2" ParentId="16114" CreationDate="2015-02-05T21:06:35.050" Score="1" Body="&lt;p&gt;For multi carrier OFDM systems, each subcarrier frequency is modulated with different data.  As an example with 48 subcarriers, wherein each subcarrier is modulated using BPSK, results in 48 data bits.  QPSK (2 bits per symbol) corresponds to 96 data bits and again 48 subcarriers.  Conversely, for single carrier OFDM systems only one frequency subcarrier is used and only that subcarrier is modulated with data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those modulated bits are sent or received over one OFDM symbol time (different definition of the word symbol as compared with BPSK/QPSK symbol).&lt;/p&gt;&#xA;" OwnerUserId="13620" LastActivityDate="2015-02-05T21:06:35.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20386" PostTypeId="2" ParentId="20384" CreationDate="2015-02-05T21:09:17.747" Score="5" Body="&lt;p&gt;You can compute the power of the process from its power spectrum as well as from its PDF. Equating the two gives you a relation between the constants $A$ and $B$. More specifically you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-B}^BG_x(f)df=\frac{1}{2A}\int_{-A}^Ax^2dx$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm not mistaken this should give $A=\sqrt{3B}$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-02-05T21:18:03.837" LastActivityDate="2015-02-05T21:18:03.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20387" PostTypeId="1" AcceptedAnswerId="20394" CreationDate="2015-02-05T21:31:23.250" Score="3" ViewCount="2546" Body="&lt;p&gt;R (sampling rate) &#xA;fs (signal being sampled &#xA;fN (the Nyquist frequency) &#xA;fa (aliased frequency)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping someone could explain to me why this is true with a more mathematical proof. it seems reasonable for the aliased frequency to be related to these parameters, but I would like a more solid rationale.&lt;/p&gt;&#xA;" OwnerUserId="13482" LastActivityDate="2015-02-06T15:09:00.867" Title="What is the proof of the equation for the aliased frequency fa = |R*n - fs|?" Tags="|nyquist|aliasing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20388" PostTypeId="2" ParentId="20387" CreationDate="2015-02-05T22:20:45.740" Score="1" Body="&lt;p&gt;This is incomplete but should point you in the right direction. Assume $k$ is an integer and $f_s=1/T_s$ is the sampling frequency. The signal being sampled is $$\cos(2\pi f_0t).$$ The sampled signal is $\cos(2\pi f_0kT_s)$. This signal has an alias at frequency $f_1=(f_s/2-f_0)+f_s/2=f_s-f_0$. To prove it:&#xA;\begin{align*}&#xA;\cos(2\pi(f_s-f_0)kT_s) &amp;amp;= \cos(2\pi f_skT_s-2\pi f_0kT_s) \\&#xA;&amp;amp;= \cos(2\pi k - 2\pi f_0kTs)\\&#xA;&amp;amp;= \cos(2\pi f_0kT_s).&#xA;\end{align*}&#xA;A similar argument can be made for all other aliases.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-02-05T22:20:45.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20389" PostTypeId="1" CreationDate="2015-02-06T00:27:03.863" Score="1" ViewCount="455" Body="&lt;p&gt;I am studying HOG. I have find the code &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/28689-hog-descriptor-for-matlab&quot; rel=&quot;nofollow noreferrer&quot;&gt;code1&lt;/a&gt; and &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/46408-histogram-of-oriented-gradients--hog--code-using-matlab&quot; rel=&quot;nofollow noreferrer&quot;&gt;code2&lt;/a&gt; about HOG. However, both of them don't implement trilinear interpolation. I have also read some websites, including &lt;a href=&quot;https://stackoverflow.com/questions/17738534/hog-trilinear-interpolation-of-histogram-bins-clarification&quot;&gt;web1&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/6565412/hog-trilinear-interpolation-of-histogram-bins&quot;&gt;web2&lt;/a&gt;. I still don't know how to write the HOG code with trilinear interpolation. Is anyone who can help me and provide me Matlab sample code about HOG? Thank you very much for your reply. &lt;/p&gt;&#xA;" OwnerUserId="11826" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2015-02-06T00:27:03.863" Title="How to implement HOG with trilinear interpolation by Matlab?" Tags="|image-processing|matlab|computer-vision|object-recognition|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20390" PostTypeId="1" AcceptedAnswerId="20391" CreationDate="2015-02-06T03:48:29.407" Score="17" ViewCount="15127" Body="&lt;p&gt;This doesn't make sense to me, because the &lt;a href=&quot;https://en.wikipedia.org/wiki/Uncertainty_principle&quot;&gt;Heisenberg inequality&lt;/a&gt; states that $\Delta t\Delta \omega$ ~ 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore when you have something perfectly localized in time, you get something completely distributed in frequency. Hence the basic relationship $\mathfrak{F}\{\delta(t)\} = 1$ where $\mathfrak{F}$ is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform&quot;&gt;Fourier transform&lt;/a&gt; operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_comb&quot;&gt;Dirac comb&lt;/a&gt;, applying the Fourier transform, you receive another Dirac comb. Intuitively, you should also get another line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does this intuition fail?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastEditorUserId="4298" LastEditDate="2023-03-16T12:51:42.870" LastActivityDate="2024-01-18T18:49:51.593" Title="Why is the Fourier transform of a Dirac comb a Dirac comb?" Tags="|fourier-transform|dirac-delta-impulse|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20391" PostTypeId="2" ParentId="20390" CreationDate="2015-02-06T07:58:49.627" Score="14" Body="&lt;p&gt;I believe that the fallacy is to believe that a Dirac &lt;em&gt;comb&lt;/em&gt; is localized in time. It isn't because it is a periodic function and as such it can only have frequency components at multiples of its fundamental frequency, i.e. at discrete frequency points. It can't have a continuous spectrum, otherwise it wouldn't be periodic in time. Just like any other periodic function, a Dirac comb can be represented by a Fourier series, i.e. as an infinite sum of complex exponentials. Each complex exponential corresponds to a Dirac impulse in the frequency domain at a different frequency. Summing these Dirac impulses gives a Dirac comb in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-02-06T13:26:51.990" LastActivityDate="2015-02-06T13:26:51.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20392" PostTypeId="2" ParentId="17470" CreationDate="2015-02-06T09:21:28.503" Score="2" Body="&lt;p&gt;Standards will generally not help you here, because they just define the training sequences but leave it to the implementation how to use those. In the 802.11 standard, for example, I'm quite sure they had Moose's method [1] in mind when designing the training sequence but there are no details on how to actually perform frequency offset and timing offset estimation. (Actually, there's no reason to limit sync algorithms by the standard. It would be annoying for someone who comes up with a better idea)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even continous stream systems most probably have a frame structure which includes periodic training sequences to update the channel estimation. The first step in your sync algorithm must be to find this frame start. You have to sync onto the known training sequence and thus this is a data-aided method. There's a lot of literature on this topic and I would start with [2]. Of course, you could just correlate the incoming signal with the known training sequence but this is quite computationally complex and has poor performance in dispersive channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fine synchronization during the stream, the guard interval or the periodically transmitted training sequences can be used. From my experience the guard interval method has poor performance in dispersive channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] P. H. Moose, “A technique for orthogonal frequency division multiplexing frequency offset correction,” IEEE Trans. Commun., vol. 42, no. 10, pp. 2908–2914, 1994.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] T. M. Schmidl and D. C. Cox, “Robust frequency and timing synchronization for OFDM,” Commun. IEEE Trans., vol. 45, no. 12, pp. 1613–1621, 1997.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-02-06T09:21:28.503" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20393" PostTypeId="2" ParentId="20390" CreationDate="2015-02-06T12:55:13.820" Score="12" Body="&lt;p&gt;Your intuition fails because you're starting with wrong assumptions. Heisenberg's uncertainty doesn't say what you think it says. As you already say in your question, it's an &lt;em&gt;inequality&lt;/em&gt;. To be precise, it's&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta t \cdot \Delta f \geq\frac{1}{4\pi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no reason why the uncertainty product has to be close to its lower bound for all signals. In fact, the only signals that achieve this lowest bound are Gabor atoms. For all other signals, expect it to be larger and possibly even infinite.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-02-06T12:55:13.820" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20394" PostTypeId="2" ParentId="20387" CreationDate="2015-02-06T15:09:00.867" Score="1" Body="&lt;p&gt;Lets say you have a continuous sinusoidal signal $x(t) = \cos(2\pi f_o t)$, now we sample that signal by letting $t=nT=\frac{n}{f_s}$, where $f_s$ is the sampling frequency. This gives $x[n]= \cos(2\pi f_o nT) $. Because sinusoids are periodic every $2\pi$ we can write:&#xA;$$\cos(2\pi f_o nT) = \cos(2\pi f_o nT + mn2\pi T ),$$&#xA;where we require $mnT$ to be an integer. $n$ is always an integer, and $T$ is determined by our sampling frequency. Therefore this is equivalent to requiring $m=\frac{p}{T}$ where $p$ is an integer - in other words $m$ must be an integer multiple of the sampling frequency. Given these conditions we can write:&#xA;$$  \cos(2\pi f_o NT + mn2\pi T ) =  \cos(2\pi (f_o +m)nT ) =  \cos(2\pi (f_1)nT ),$$&#xA;where $f_1= f_o+m$, but remember that $m$ is a multiple of the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore any sampled sinusoid is equivalent to another sampled sinusoid with a frequency that is an integer multiple of sampling frequency away from the original frequency. Note the above formulation could be done equivalently with $\exp(j2\pi f_o t)$ instead of $\cos()$ to be a bit more general.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-02-06T15:09:00.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20395" PostTypeId="1" AcceptedAnswerId="20397" CreationDate="2015-02-06T15:26:47.213" Score="4" ViewCount="358" Body="&lt;p&gt;My intuition about  the scaling &lt;code&gt;(x,y)&lt;/code&gt; of the 2d representation of the 3d object generated by our native visual processing system tells me it accelerates as it approaches the visual sensor (our eye).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this true?  What is the rate of expansion of objects within our visual field?&lt;/p&gt;&#xA;" OwnerUserId="13638" LastEditorUserId="7092" LastEditDate="2015-02-06T16:25:36.280" LastActivityDate="2015-02-11T15:08:14.940" Title="What is the rate of expansion of an image as it aproaches the human eye?" Tags="|computer-vision|visualization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20397" PostTypeId="2" ParentId="20395" CreationDate="2015-02-06T16:48:52.683" Score="4" Body="&lt;p&gt;The magnification of an object at distance $g$ from a thin lens with focal length $f$ is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\beta=\frac{f}{g-f}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is generally negative for objects at distances greater than the focal length. This means the image is upside down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The derivative of the magnification with respect to the object distance is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial \beta}{\partial g}=-\frac{f}{(g-f)^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for constant $f$ the magnification diverges like $x^{-2}$ where $x=(g-f)$ is the difference between focal length and object distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So yes, the magnification grows in an accelerated way and even approaches infinity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the relationship is only strictly true if the image at the image plane is sharp and the aperture is unlimited. So for your eye, at some point the image will become blurry and the magnification will grow in an asymptotic way that is much harder to describe.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-02-06T16:48:52.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20398" PostTypeId="2" ParentId="20390" CreationDate="2015-02-06T18:23:58.073" Score="8" Body="&lt;p&gt;Electrical engineers play a little fast and loose with the Dirac delta function, which the mathematicians insist is not a function (or, at least, not a &amp;quot;regular&amp;quot; function, but is a &amp;quot;distribution&amp;quot;).  The mathematical fact is that if &lt;span class=&quot;math-container&quot;&gt;$f(t)=g(t)$&lt;/span&gt; &amp;quot;almost everywhere&amp;quot; (which means at every value of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; except for a countable number of discrete values), then &lt;span class=&quot;math-container&quot;&gt;$$ \int f(t) \ \mathrm{d}t = \int g(t) \ \mathrm{d}t $$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Well the functions &lt;span class=&quot;math-container&quot;&gt;$f(t)=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g(t)=\delta(t)$&lt;/span&gt; are equal everywhere except at &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt;, yet we electrical engineers insist that their integrals are different.  But if you set aside this little (and, in my opinion, non-practical) difference, the answer to your question is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The Dirac comb function &lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{III}_T(t) \triangleq \sum\limits_{k=-\infty}^{+\infty} \delta(t - kT) $$&lt;/span&gt; is a periodic function of period &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; and therefore has a Fourier series: &lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{III}_T(t) = \sum\limits_{n=-\infty}^{+\infty} c_n \ e^{j 2 \pi n t/T} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you blast out the coefficients, &lt;span class=&quot;math-container&quot;&gt;$c_n$&lt;/span&gt;, of the Fourier series you get:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  \begin{align}&#xA;c_n &amp;amp; = \frac{1}{T}\int\limits_{t_0}^{t_0+T} \mathrm{III}_T(t) e^{-j 2 \pi n t/T} \ \mathrm{d}t \\&#xA;&amp;amp; = \frac{1}{T}\int\limits_{-T/2}^{T/2} \delta(t) e^{-j 2 \pi n t/T}  \ \mathrm{d}t \quad \quad (k=0)\\&#xA;&amp;amp; = \frac{1}{T}\int\limits_{-T/2}^{T/2} \delta(t) e^{-j 2 \pi n 0/T}  \ \mathrm{d}t \\&#xA;&amp;amp; = \frac{1}{T} \quad \quad \forall n \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;So the Fourier series for the Dirac comb is&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{III}_T(t) = \sum\limits_{n=-\infty}^{+\infty} \frac{1}{T} \ e^{j 2 \pi n t/T} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which means you're just summing up a bunch of sinusoids of equal amplitude.&lt;/p&gt;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;The Fourier Transform of a single complex sinusoid is:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathscr{F} \left\{ e^{j 2 \pi f_0 t} \right\} = \delta(f-f_0) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and there is this property of linearity regarding the Fourier Transform.  the rest of the proof is an exercise left to the reader.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2024-01-18T18:49:51.593" LastActivityDate="2024-01-18T18:49:51.593" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="20401" PostTypeId="1" CreationDate="2015-02-07T00:25:18.850" Score="-3" ViewCount="656" Body="&lt;p&gt;Let suppose &lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(t)=$\sum\limits_{k=-∞}^∞ R(t-kT)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R(t) = \begin{cases}1 &amp;amp;[0,2T] \\ 0 &amp;amp; \text{otherwise} \end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(t) is the input to an ideal bandpass filter with  $\text{BandWidth} = \dfrac{1}{(2T)}$&lt;br&gt;&#xA;  and $\text{Center Frequency} = \dfrac{L}{(T)}$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i find the output y(t).&#xA;any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13561" LastActivityDate="2015-02-07T16:31:00.883" Title="Ideal BandPass Filter" Tags="|filters|convolution|continuous-signals|linear-systems|bandpass|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20402" PostTypeId="1" CreationDate="2015-02-07T02:37:37.477" Score="1" ViewCount="480" Body="&lt;p&gt;I am learning wavelet theory for image processing. To understand the theory, I write one Matlab program to decompose one black-white image. The program is as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Image = zeros(256, 256, 'uint8');&#xA; Image(101:200, 101:200) = 255;&#xA; figure; imshow(Image);&#xA; [cA1, cH1, cV1, cD1] = dwt2(Image, 'db1');&#xA; Image1 = [cA1, cH1; cV1, cD1];&#xA; figure; imshow(Image1, []);&#xA; [cA1, cH1, cV1, cD1] = dwt2(Image, 'db2');&#xA; Image1 = [cA1, cH1; cV1, cD1];&#xA; figure; imshow(Image1, []);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first decomposition using the argument db1 produces zeros for all wavelet coefficients. The black-white image has the transition from 0 to 255 along horizontal and vertical directions and should have high-frequency component. Why are zero wavelet coefficients generated? &#xA;If I change the argument from db1 to db2, the result will show horizontal and vertical lines in the subbands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;I decompose the image further and at level 3 edge-like structure can be seen on the subband. Wavelet is one kind of filter bank I read from one book. It means the frequency in the image can only be seen in the higher frequency band. From the below link, it told how to get frequency response of Daubechies filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/answers/44879-daubechies-filters-frequency-response&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/answers/44879-daubechies-filters-frequency-response&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how is the frequency for images defined. From one book, it says that &quot;Spatial frequencies are measures of the number of oscillations (cycles) from dark to light per unit of length of the image&quot;. How can I know the frequencies in the input image.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2015-02-09T02:27:51.783" LastActivityDate="2015-04-10T02:58:00.417" Title="why wavelet coefficients are zeros after decomposition" Tags="|image-processing|wavelet|frequency-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20405" PostTypeId="1" CreationDate="2015-02-07T07:23:15.570" Score="1" ViewCount="103" Body="&lt;p&gt;I need to extract information about the typical distance between the black patches in an image like the one I attached here. Typical distance would be the the most frequent separation between two patches. For example, if the photo was parallel black stripes, the algorithm would give me the typical width of the white stripes between the black stripes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to perform 2D FFT on it (using OpenCF fdt function in Python), but I am not sure if this is the best way to do this job. Anyone has an idea what is the method that I need to use to perform this job? I have read about two-point correlation function in astronomy, but I wonder if it can be used also in this case..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example of the image on which I need to do this analysis - &lt;img src=&quot;https://i.stack.imgur.com/ZQkdt.jpg&quot; alt=&quot;black patches&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13646" LastEditorUserId="13646" LastEditDate="2015-02-09T09:04:56.320" LastActivityDate="2015-02-09T09:04:56.320" Title="Measuring typical seperation between patches using 2D Fourier Transform" Tags="|fft|correlation|distance-metrics|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20406" PostTypeId="1" CreationDate="2015-02-07T14:33:36.633" Score="3" ViewCount="906" Body="&lt;p&gt;I'm implementing a variable fractional delay element for use in online audio processing. Applications include ie. Karplus-Strong synthesis, flanger, chorus, echo, vibrato. I'm not oversampling, so drop-sample and linear interpolation are not really acceptable for interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could a low order sinc FIR work as an alternative to 2:nd+ order polynomial interpolation? By low order I mean on the order of just a few zero crossings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really like sinc interpolation because it offers two advantages over polynomial interpolation.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Coefficients (table of windowed sinc values) are independent of the delay amount, whereas in polynomial interpolation the filter coefficients are an N:th order polynomial of the delay amount. This complicates the code when the amount of delay is variable.&lt;/li&gt;&#xA;&lt;li&gt;Coefficients are independent of interpolation order. For polynomial interpolation you need precomputed polynomials in the delay amount for all the orders you might need.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The main drawback I see with higher order sinc interpolation is the amount of latency it imposes. N+1 point polynomial interpolation of order N gives just N/2 samples of latency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also considered 1 pole allpass interpolation, but I suspect it will have bandwidth problems similar to linear interpolation. (Is multi pole allpass interpolation a thing?)&lt;/p&gt;&#xA;" OwnerUserId="12235" LastEditorUserId="12235" LastEditDate="2015-02-07T14:46:10.490" LastActivityDate="2015-02-08T04:33:28.953" Title="Low order sinc interpolation vs. polynomial interpolation for variable fractional delay" Tags="|interpolation|finite-impulse-response|delay|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20407" PostTypeId="2" ParentId="20401" CreationDate="2015-02-07T16:24:48.713" Score="0" Body="&lt;p&gt;Because the off sets between translated copies of the top hat and the translation is half the top had width your function is a constant taking the value 2 except possibly at integer values of time when it takes the value 3, but this may be because you have defined the function incorrectly, but that does not matter since these points constitute a set of measure 0. So $x(t)=1\ a.e.$, hence the only non-zero frequency component in its spectrum that at $\omega=0$ (or $f=0$ depending how you chose to define the FT). If the DC component is not in the pass band you get nothing out. If it is in the passband the output is $2$ (you will have removed the glitches at integer times).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... I can't help but suspect you have errors in the question as posted, mainly because of the mysterious appearance of $L$, and the answer changes its nature if the width of the top hat ceases to be twice the translation between copies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I assume you have posted the question with errors the basic idea if you do not have a constant is that the output of the band-pass filter is the sum of the frequency components of the Fourier series (since the signal is periodic) corresponding to the signal that fall in the pass band.&lt;/p&gt;&#xA;" OwnerUserId="12119" LastEditorUserId="12119" LastEditDate="2015-02-07T16:31:00.883" LastActivityDate="2015-02-07T16:31:00.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20409" PostTypeId="1" AcceptedAnswerId="20430" CreationDate="2015-02-07T16:58:09.847" Score="0" ViewCount="300" Body="&lt;p&gt;I am extremely new to this and I'm learning by building stuff myself so please let me know if this is too vague and Ill elaborate if I can. Im sure this is something very simple, but cant figure out how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have built radios before and know how to modulate a signal as ASK but now I'm trying to send a simple bitstream from a USB port to a radios input.&#xA;My idea was to use a serial program to dump bytes into the radio input signal but all the research I have done indicates using rs232 or UART or something. I have no experience with this and I dont want some protocol sticking parity bits in all over the place.&#xA;I simply want to be able to send, for example, 0x1234 as&#xA;00000001000000100000001100000100 at a baudrate of 2048.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My intention is to monitor the frequency with an sdr and then learn how to demodulate the bits from the IQ data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a simple method for doing this or something I dont know about which will prevent me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or direction would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13649" LastActivityDate="2015-02-08T23:22:27.587" Title="Transmit bitstream from USB over radio" Tags="|digital-communications|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20413" PostTypeId="1" AcceptedAnswerId="20423" CreationDate="2015-02-07T21:42:32.330" Score="0" ViewCount="580" Body="&lt;p&gt;i'm writing a batch script in MATLAB to flange. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i'm getting some periodic noise, and i'm having trouble tracking down the source. it's definitely in the algorithm, because soundsc() will scale values larger than 1. and theres no memory or computing time issue, because it's running as a batch process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any mp3 or wave file should do the trick&lt;/p&gt;&#xA;&#xA;&lt;p&gt;current script, with interpolation (sounds worse so far than non-interpolating, because i am probably using the wrong X for the interpolation.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;&#xA;function result = dLinTerp(x1,x2,y1,y2,x)&#xA;&#xA;% calculate decimal position of x&#xA;dx = (x - x1)/(x2 - x1);&#xA;&#xA;% use weighted sum method of interpolating&#xA;result = dx*y2 + (1-dx)*y1;&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;    cur_frac=cur_sin*max_samp_delay;&#xA;&#xA;    if (readIdx + cur_frac &gt;= (max_samp_delay)) &#xA;        fetchIdx = cur_frac - (max_samp_delay - readIdx) + 1;&#xA;    else&#xA;        fetchIdx = readIdx + cur_frac;       &#xA;    end&#xA;&#xA;    if (floor(fetchIdx) = max_samp_delay)&#xA;        fetchNext = 1;&#xA;    else&#xA;        fetchNext = ceil(fetchIdx);&#xA;    end&#xA;     integ = fix(cur_frac); &#xA;     frac = abs(cur_frac - integ);&#xA;    interp = dLinTerp(0.0, 1.0, delayBuff(fetchPrev), delayBuff(fetchNext),frac);&#xA;    out(i) = (amp*input(i)) + (amp*interp);&#xA;&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;here is the original script, no interpolation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;%flanger&#xA;&#xA;[input,fs] = audioread('pianoriff_s.mp3');&#xA;input = input(:,1);&#xA;len = length(input);&#xA;out = zeros(len,1);&#xA;&#xA;max_time_delay=0.007; % 7ms max delay in seconds&#xA;rate=0.2; %rate of flange in Hz&#xA;max_samp_delay= floor(max_time_delay*fs);&#xA;delayBuff = zeros(max_samp_delay,1);&#xA;amp=0.7;&#xA;readIdx = 1;&#xA;&#xA;for i = 1:len,&#xA;    delayBuff(readIdx) = input(i);&#xA;&#xA;    sin_ref = sin(2*pi*i*(rate/fs));&#xA;    cur_sin=abs(sin_ref); %abs of current sin val 0-1&#xA;    cur_delay=ceil(cur_sin*max_samp_delay);&#xA;&#xA;    if (readIdx + cur_delay &gt;= max_samp_delay)&#xA;        fetchIdx = cur_delay - (max_samp_delay - readIdx) + 1;&#xA;    else&#xA;        fetchIdx = readIdx + cur_delay;&#xA;    end&#xA;&#xA;    out(i) = (amp*input(i)) + (amp*(delayBuff(fetchIdx)));&#xA;&#xA;&#xA;    if (readIdx+1 &gt;= max_samp_delay)&#xA;        readIdx = 1;&#xA;    else&#xA;        readIdx = readIdx + 1;&#xA;    end&#xA;end&#xA;&#xA;soundsc(out,fs);&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-02-08T06:15:30.503" LastActivityDate="2015-02-08T16:09:19.343" Title="MATLAB flanger...zipper noise, crackling, help with interpolation values?" Tags="|audio|music|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20414" PostTypeId="2" ParentId="20402" CreationDate="2015-02-08T01:15:14.893" Score="0" Body="&lt;p&gt;For me, this does not make any sense. One possible reason why you did not see such edge-like high-frequency components in db1 is that they are very thin (1 pixel wide), unless you zoom in you might miss them due to the interpolations happen in displaying an image. I suggest you to inspect matrix elements directly, namely counting the number of nonzero elements.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-02-08T01:15:14.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20415" PostTypeId="1" AcceptedAnswerId="20416" CreationDate="2015-02-08T01:15:40.057" Score="0" ViewCount="129" Body="&lt;p&gt;Input: A video with a digital timer, possibly several hours long, such as &lt;a href=&quot;https://www.youtube.com/watch?v=G3PQyhOAMU0]&quot; rel=&quot;nofollow noreferrer&quot;&gt;this video.&lt;/a&gt; The timer might use any font or color, and might be located anywhere on the video, but it probably won't fill the entire screen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output: A list of time indices when the timer starts and stops, it might start and stop multiple times. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Timer 1: Starts off paused, starts at 0h20m32s, stops at 2h30m04s, ends up being paused.&#xA;Timer 2: Starts off ticking, stops at 0h04m00s, starts at 0h06m38s, stops at 0h32m01s, end up being paused.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Possible frames from different input video files:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tncHh.jpg&quot; alt=&quot;Frames from possible input videos&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How might this be achieved? In particular, what algorithms could be used to categorize the data? How would could you detect a timer that might be everywhere, of any color or font size?&lt;/p&gt;&#xA;" OwnerUserId="13653" LastEditorUserId="53" LastEditDate="2015-02-08T17:37:46.417" LastActivityDate="2015-02-08T17:37:46.417" Title="Video: Detecting a digital timer and when it ticks" Tags="|computer-vision|autocorrelation|video-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20416" PostTypeId="2" ParentId="20415" CreationDate="2015-02-08T01:15:40.057" Score="3" Body="&lt;h1&gt;To OCR or not?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;If the timer is about $h$ pixels height, you could segment each frame into lines of height $h/2$, run an OCR on each line, and scan the result with a &lt;em&gt;regexp&lt;/em&gt; for anything that looks like a timer, eg. &lt;code&gt;\d+[\.:,;-]\d+[\.:,;-]&lt;/code&gt;. This gives you $x=time_{real}$ vs. $y=time_{video}$ data pairs. Sure, most of them are wrong, but imposing the restriction $y=1*x+n$ (unless the video speed was changed) eliminates most of them. Just group all data points according to whether they lie on a line of slope m=1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this works only if there are at least some good data points. If we cannot make any assumptions about the color, font, or size (or even script!), OCR doesn't perform well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, making use of some intrinsic properties of all timers works much better and is agnostic to the exact font or script used. Let us make the following basic assumptions about a &lt;em&gt;timer&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;overlayed on a static background, ie. there's at least one bounding box that contains only the timer and no other changing objects&lt;/li&gt;&#xA;&lt;li&gt;it remains on a fixed position for the entire duration of the video&lt;/li&gt;&#xA;&lt;li&gt;a ticking timer is changing periodically&lt;/li&gt;&#xA;&lt;li&gt;it contains a &lt;em&gt;seconds&lt;/em&gt; digit with a frequency of 0.1 Hz&lt;/li&gt;&#xA;&lt;li&gt;it is not animated, ie. the &lt;em&gt;seconds&lt;/em&gt; digit remains static and changes only every second&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We can use these assumptions to recognize the timer automatically.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Downsampling&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Scanning every frame, pixel, and every color channel is a lot of work, takes time, and also completely unnecessary. Let's say we've got a 2 hour video, 720p60, yuv420p. That's 2*3600 seconds * 60fps * 1280*720 pixels/frame * 3 channels/pixel =~ 1200 billion data values to examine.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Grayscale. The color channels are down-sampled already anyway.&lt;/li&gt;&#xA;&lt;li&gt;1-0.1 fps is usually enough, the timer's frequency is only 0.1Hz. &lt;/li&gt;&#xA;&lt;li&gt;A resolution of 320x180 pixels is more than enough, unless the timer had been really small to begin with, that still leaves us with ~20-60 pixels to analyze.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This reduces the number of data points by about 3*600*4*4~=30000, for a total of about 40 million data points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KVQA9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Locating the timer(s)&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;This is the hard part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We employ several methods to check each pixel whether it might belong to the timer, then we combine them to larger areas. The video is split into intervals of length &lt;em&gt;dt&lt;/em&gt;, and for each interval,&lt;em&gt;n&lt;/em&gt; frames get analyzed. 60 frames per interval works pretty nicely.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Check for changes. At the very least, the timer must be changing constantly. We could use the standard deviation of each pixel, but I found that randomizing the sample order and taking the average difference between adjacent pixels gives better results sometimes. The standard deviation tends to be lower.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Simple check for 10-seconds periodicity. Group pixels into those that are pixels 10 seconds apart of each other, take the average difference for each group, then average all groups. Basically the auto-correlation for $\tau=10s$ This is simple, fast, and tends to work well.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the full auto-correlation (via FFT for speed). Sounds better, but you need to find a way to analyze it. What I found works is checking at 10 seconds, 20 seconds etc. whether there is a peak (higher value than at nearby samples), and checking that there is no higher value between two adjacent peaks.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Check step-behavior. Take samples every 0.2 or 0.1 seconds and check when the pixel changes. As each digit remains on screen 1 second, it should do so every 5 or 10 frames. Some digits may look alike, but the difference between two changes should be an integer multiple of 5 or 10.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I found that for the most part, combing the first two methods yields quick, fast, and accurate results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we've got a mask of pixels that possibly belong to the timer. Apply a close operation on them (with a threshold of ~0.5), label connected areas, compute the bounding boxes, eliminate very small or very large ones, and areas that haven't got many pixels that were classified as belonging to the timer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After doing this for all intervals, group bounding boxes together that are close to each other, eliminate groups with only a few members, and take only those groups with the most members. These are most likely the bounding boxes for the &lt;em&gt;seconds&lt;/em&gt; digit of the timer. Average each group and return the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7kHVj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;(Left: Mask, Right: Image with Mask)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Top: Raw image, 2nd: checked for changes, 3rd: simple check for 10s periodicity, 4th: auto correlation diagram analyzed, 5th: all masks combinded, Bottom: Bounding box computed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the &lt;code&gt;close&lt;/code&gt; step is not shown above.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Scanning for activity (start/stop)&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Now that we found a timer, or rather the &lt;em&gt;seconds&lt;/em&gt; digit, we scan the video to analyze when it is ticking and when not. If it is ticking, the digit will keep changing.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;extract &lt;em&gt;n&lt;/em&gt; frames at an interval of &lt;em&gt;dt&lt;/em&gt; , crop to the timer rectangular area&lt;/li&gt;&#xA;&lt;li&gt;for each pixel, take the squared difference between adjacent frames, and average over all pixels &lt;/li&gt;&#xA;&lt;li&gt;threshold to 0 (&lt;code&gt;stopped&lt;/code&gt;) or 1 (&lt;code&gt;ticking&lt;/code&gt;), a good value is about 1.0-1.5&lt;/li&gt;&#xA;&lt;li&gt;apply a gaussian smooth of about 2-4 samples against rapid changes, and threshold again to 0.5&lt;/li&gt;&#xA;&lt;li&gt;take difference between adjacent frames again to get the changes between &lt;code&gt;ticking&lt;/code&gt; and &lt;code&gt;paused&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vJbww.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the timer may not be visible at some parts of the video, add the following step(s) before applying the gaussian smooth&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;for each timer region found during the scanning process, crop all scanned frames to the timer region&lt;/li&gt;&#xA;&lt;li&gt;group these images by similarity (squared difference), and select only the ~10-15 groups with the highest frequency, these are most likely the actual digits&lt;/li&gt;&#xA;&lt;li&gt;average all images of each group to get an &lt;em&gt;idealized&lt;/em&gt; sample for each digit&lt;/li&gt;&#xA;&lt;li&gt;if the timer does is not rectangular (eg. &lt;em&gt;italic&lt;/em&gt; text), save the original mask for the timer region and compare only these pixels&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, after taking the difference between adjacent frames, set all values to 0 (&lt;code&gt;stopped&lt;/code&gt;) where the image does not match any of these digits (again, squared difference).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qN23G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(left: all images from intervals classified as containing the timer extracted from the timer area; right: images grouped by sum of squared difference)&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Considerations&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;There are a few things to consider when applying these methods.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Acquiring frames. Sounds simple, but you don't want to dump them all uncompressed to your HDD. I'm using ffmpeg with fast seeking &lt;code&gt;-ss time -i input.mp4&lt;/code&gt;, which seeks to the nearest key frame and decodes frames until it reaches the requested time. Except it won't work some times, especially for bad video files that are common when you are saving a network stream. After transcoding the video file (with ffmpeg), most files that didn't work before were recognized perfectly. If you scale with ffmpeg, encode to 320x180, set a low key frame interval and set &lt;code&gt;-movflags faststart&lt;/code&gt;, reading frames from the resulting file is accurate and fast. And at 320x180, it doesn't use much space either. Avoid downsampling the frame rate, as that might destroy your time stamps.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Choosing the right threshold values, time intervals and other parameters. This is what took by far most of my time, especially since testing takes some time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In particular, it helps to choose a time step such that each digit appears. Choosing 5 seconds for example is a bad choice, as it will give you only 0's and 5's. Choosing a time step lower than 1 second won't work well when trying to analyze how much each pixel changes, as the consecutive digits will be the same.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Related to this, each interval needs to contain enough frames. If the period is 10s and you choose 60 frames for the interval length and a time step of 1.2 seconds, the length after which the digit repeats is $lcm(1.2s,10s)=60s$, ie. 50 frames out of 60. And that is not enough. I found that, in order to eliminate unwanted noise, the number of frames should be least 3-6 times as high as the period length in frames. So a time step of, say 3s, works quite well, as lcm(3,10)=30, which is 10 frames, so you get 6 periods.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h1&gt;Does it work, though?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://pastebin.com/v6003pPQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;I made a simple ruby script that implements the method described above.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's probably full of bugs and the code is a mess, but it seems to work. I tested it on 200 videos of different length (5 minutes to 6 hours, most around 30 minutes). They all contained the same kind of timer (color, font), but at possibly different sizes and positions. After transcoding those video files where ffmpeg didn't manage to seek accurately, the script got the correct result for pretty much all of them, it got only 4 wrong (detected &lt;code&gt;stopped&lt;/code&gt; when it had been &lt;code&gt;ticking&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible I might have fine-tuned the parameters for that specific testing set, but at least we can say it does work rather well if you can make some general assumptions about the timer. Also, I tested a few other videos with different font sizes/colors, and they worked as well. I also tested it on a video with two timers (one that kept ticking the entire video), and the script recognized them as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far is accuracy is concerned, it usually determines the starting/ending point at $\pm 1...3$ seconds, (because of some smoothing and averaging to eliminate noise), which is more than enough for me. I guess you could get an even better estimate if, after determining there is a starting/ending point at a certain frame interval, you check exactly when the digit starts/stops changing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Transcoding video (110.89 min) file before analysis...&#xA;&#xA;ffmpeg -y -loglevel quiet -i &quot;dump_000000038.mp4&quot; -c:v libx264 -an -vf scale=320:180 -preset ultrafast -sws_flags bilinear -g 20 -movflags faststart -crf 12 -f mp4 ./transcode.mp4 &amp;lt; /dev/null&#xA;Transcoding took 423.545512367s, 16x real-time.&#xA;&#xA;Analyzing &amp;lt;transcode.mp4&amp;gt;, duration 1:50:53.684...&#xA;&#xA;Scanning for timers...&#xA;&#xA;Trying timestep 11.0, method simple...&#xA;Analyzing 0:00:00.000-0:11:00.000...&#xA; - got 0 connected area(s)&#xA;Found 0 candidates.&#xA;&#xA;Analyzing 0:11:00.000-0:22:00.000...&#xA; - got 1 connected area(s)&#xA;Found 1 candidates.&#xA;&#xA;Analyzing 0:22:00.000-0:33:00.000...&#xA; - got 1 connected area(s)&#xA;Found 1 candidates.&#xA;&#xA;Analyzing 0:33:00.000-0:44:00.000...&#xA; - got 0 connected area(s)&#xA;Found 0 candidates.&#xA;&#xA;Analyzing 0:44:00.000-0:55:00.000...&#xA; - got 1 connected area(s)&#xA;Found 1 candidates.&#xA;&#xA;Analyzing 0:55:00.000-1:06:00.000...&#xA; - got 1 connected area(s)&#xA;Found 1 candidates.&#xA;&#xA;Analyzing 1:06:00.000-1:17:00.000...&#xA; - got 1 connected area(s)&#xA;Found 1 candidates.&#xA;&#xA;Analyzing 1:17:00.000-1:28:00.000...&#xA; - got 1 connected area(s)&#xA;Found 1 candidates.&#xA;&#xA;Analyzing 1:28:00.000-1:39:00.000...&#xA; - got 1 connected area(s)&#xA;Found 1 candidates.&#xA;&#xA;Analyzing 1:39:00.000-1:50:00.000...&#xA; - got 0 connected area(s)&#xA;Found 0 candidates.&#xA;&#xA;Extracting timer digit images...&#xA;Grouping timer digit images...&#xA;&#xA;&#xA;Timer(s) found:&#xA;Timer 1: (176,150), size 5x10&#xA;&#xA;&#xA;Analyzing timer(s) for event(s)...&#xA;&#xA;Trying coarse timestep 11.0, fine 1.75...&#xA;Scanning timers for activity...&#xA;Timer 0: Found 4 event(s).&#xA;Checking at the beginning of the video at a higher resolution for the timer 0...&#xA;Checking at the end of the video at higher a resolution for the timer 0...&#xA;Refining estimate for timer 0, event 0...&#xA;Refining estimate for timer 0, event 1...&#xA;Refining estimate for timer 0, event 2...&#xA;Refining estimate for timer 0, event 3...&#xA;Reading frame 50/50...&#xA;&#xA;This is what they're doing:&#xA;Timer 1:&#xA;  - starts off paused.&#xA;  - starts at 0:04:53.000&#xA;  - stops at 0:37:32.000&#xA;  - starts at 0:38:57.000&#xA;  - stops at 1:45:26.000&#xA;  - ends up paused.&#xA;&#xA;Scanning took 25s, 16265 fps.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13653" LastEditorUserId="13653" LastEditDate="2015-02-08T17:28:41.707" LastActivityDate="2015-02-08T17:28:41.707" CommentCount="0" CommunityOwnedDate="2015-02-08T03:59:12.590" ContentLicense="CC BY-SA 3.0" />
  <row Id="20417" PostTypeId="2" ParentId="20406" CreationDate="2015-02-08T04:33:28.953" Score="1" Body="&lt;p&gt;If you don't need matching points to come thru the resample interpolation unchanged, then you can use a different low-pass filter kernel.  A minimum phase equivalent to a linear phase windowed Sinc will have an identical frequency response, but less delay, especially when using a longer window.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-02-08T04:33:28.953" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20418" PostTypeId="1" CreationDate="2015-02-08T04:56:12.123" Score="0" ViewCount="1011" Body="&lt;p&gt;Seems both will produce another step. there is no difference? Thanks&lt;/p&gt;&#xA;" OwnerUserId="13497" LastActivityDate="2015-02-08T13:03:18.390" Title="What is the difference between multiplying a delta and a step versus convolving a delta and a step?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20420" PostTypeId="2" ParentId="20418" CreationDate="2015-02-08T06:12:55.870" Score="1" Body="&lt;p&gt;First of all you need to see whether you are performing these operations for a continous time signal or discrete time signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling theorem says that multiplication of a signal $x(t).\delta(t)$=$x(0).\delta(t)$ provided $x(t)$ is continous at $t=0$. But here in your question $x(t)$ is a unit step function which is not continous at $t=0$. Hence the multiplication of $\delta(t).u(t)$ is not defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the discrete case the same property is $\delta[n].x[n]$=$x[0].\delta[n]$ and there is no question of continuity as signal is discrete. In this case your question can be written as $u[n].\delta[n]$=$u[0].\delta[n]$=$\delta[n]$ as $u[0]$ is equal to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the convolution property says that $x(t)*\delta(t-t_0)$=$x(t-t_0)$ where $*$ is denoted here as the convolution operator. In your question this would be $u(t)*\delta(t)$=$u(t)$ which is nothing but unit step function for continous time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same is true for discrete signals i.e.$x[n]*\delta[n-n_0]$=$x[n-n_0]$. So for discrete case your question would be $u[n]*\delta[n]=u[n]$ which is a unit step function for the discrete case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look at comments of Matt below my answer for better clarity. &lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="4375" LastEditDate="2015-02-08T13:03:18.390" LastActivityDate="2015-02-08T13:03:18.390" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20422" PostTypeId="2" ParentId="16711" CreationDate="2015-02-08T12:52:29.363" Score="1" Body="&lt;p&gt;You could check how &quot;circular&quot; a blob is, by computing the ratio between area and the square of perimeter.&lt;br&gt;&#xA;For a circle that would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A = \pi r^2 , P = 2 \pi r$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which implies that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \frac{A}{P^2} = \frac {1}{4 \pi}  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably those who have tail will have different ratio.&#xA;Both the area and the perimeter of the blob can be calculated in Matlab by using &lt;code&gt;regionprops&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another option &lt;em&gt;[which could be interesting if you have a lot of data]&lt;/em&gt; would be computing many blob properties and training an SVM/Boosting/Other machine learning algorithm.&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-02-08T12:52:29.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20423" PostTypeId="2" ParentId="20413" CreationDate="2015-02-08T16:09:19.343" Score="1" Body="&lt;p&gt;ok so it turns out setting indices is tricky in MATLAB (who knew :p)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;first, a less needlessly complicated interpolator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;function result = dLinTerp(y1,y2,x)&#xA;&#xA;% use weighted sum method of interpolating&#xA;result = x*y2 + (1-x)*y1;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the flanger&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;% flanger&#xA;clear all;&#xA;% Creates a single FIR delay with the delay time oscillating from&#xA;% Either 0-3 ms or 0-15 ms at 0.1 - 5 Hz&#xA;[input,fs] = audioread('pianoriff_s.mp3');&#xA;input = input(:,1);&#xA;len = length(input);&#xA;out = zeros(len,1);&#xA;&#xA;% parameters to vary the effect %&#xA;max_time_delay=0.005; % 7ms max delay in seconds&#xA;rate=0.3; %rate of flange in Hz&#xA;&#xA;% convert delay in ms to max delay in samples&#xA;max_samp_delay= floor(max_time_delay*fs);&#xA;delayBuff = zeros(max_samp_delay,1);&#xA;amp=0.7;&#xA;readIdx = 1;&#xA;&#xA;fetchPrev = 1;&#xA;&#xA;% delaybase = .010;&#xA;% new_d_base = delaybase*fs;&#xA;% d_base = LIN_INTERP(0,1,0, new_d_base,frac);&#xA;%&#xA;% dp = (float)(delay_pos - d_base) - (delay_depth * law);&#xA;% %     // Get the integer part&#xA;% dp_idx = f_round(dp - 0.5f);&#xA;% %     // Get the fractional part&#xA;% dp_frac = dp - dp_idx;&#xA;&#xA;% for each sample&#xA;for i = 1:len,&#xA;    delayBuff(readIdx) = input(i);&#xA;    sin_ref = 0.97*sin(2*pi*i*(rate/fs));&#xA;    sin_next = 0.97*sin(2*pi*(i+1)*(rate/fs));&#xA;    cur_sin=abs(sin_ref); %abs of current sin val 0-1&#xA;    cur_delay=ceil(cur_sin*max_samp_delay);&#xA;&#xA;    cur_frac=cur_sin*max_samp_delay;&#xA;&#xA;    if (readIdx + cur_frac &gt;= (max_samp_delay))&#xA;        fetchIdx = cur_frac - (max_samp_delay - readIdx) + 1;&#xA;    else&#xA;        fetchIdx = readIdx + cur_frac;&#xA;    end&#xA;&#xA;    if (floor(fetchIdx) = max_samp_delay)&#xA;        fetchNext = 1;&#xA;    else&#xA;        fetchNext = ceil(fetchIdx);&#xA;    end&#xA;&#xA;    integ = fix(cur_frac);&#xA;    frac = abs(cur_frac - integ);&#xA;    interp = dLinTerp(delayBuff(fetchPrev), delayBuff(fetchNext),frac);&#xA;    out(i) = (amp*input(i)) + (amp*interp);&#xA;&#xA;    if (readIdx+1 &gt;= max_samp_delay)&#xA;        readIdx = 1;&#xA;    else&#xA;        readIdx = readIdx + 1;&#xA;    end&#xA;&#xA;&#xA;end&#xA;% write output&#xA;&#xA;soundsc(out,fs);&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-02-08T16:09:19.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20424" PostTypeId="1" AcceptedAnswerId="20425" CreationDate="2015-02-08T18:10:29.157" Score="2" ViewCount="1202" Body="&lt;p&gt;DCT, what is the benefit of using it for image processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I noticed that it is used in JPEG compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can i use it for something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it useful for motion detection?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it useful for compressing further? If I convert an image to its DCT I could remove the higher frequencies to zero, then convert back to image.  Would that make the image size smaller in bytes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have ordered books on Amazon about DCT but I cannot wait to start working with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a brief synopsis/paragragh what could I consider DCT of an image for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="8202" LastEditDate="2015-02-08T18:38:23.800" LastActivityDate="2015-05-04T17:52:08.130" Title="What is the DCT used for in Computer Vision?" Tags="|dct|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20425" PostTypeId="2" ParentId="20424" CreationDate="2015-02-08T18:54:57.617" Score="1" Body="&lt;p&gt;DCT stands for Discrete Cosine Transform. It is a member of the family of Fourier transforms. Hence it computes/displays the amount and distribution of spectral components of the signal being transformed. Its distinguishing features are that it produces real transform coefficients, it is computed using only real arithmetic and it packs signal energy into low frequency components (thats why it is used in transform based data compression algorithms). For data compression purposes DCT is only an example of other available methods and it serves only the beginnig part of such codecs. You must also consider entropy based coding, perceptual metric evaluation and Quantizer design issues to realize any practical benefits from such transforms. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-02-08T19:00:27.133" LastActivityDate="2015-02-08T19:00:27.133" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20426" PostTypeId="2" ParentId="20402" CreationDate="2015-02-08T18:56:23.940" Score="2" Body="&lt;p&gt;If you recall, &lt;code&gt;db1&lt;/code&gt; is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Haar_wavelet&quot; rel=&quot;nofollow noreferrer&quot;&gt;Haar Wavelet&lt;/a&gt;.  The Haar Wavelet takes either an average of pixels within local windows for the approximation coefficients (or the LL band), or a &lt;strong&gt;difference&lt;/strong&gt; of pixels within local windows for the detail coefficients (or the LH, HL and HH bands).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be advised that the input image that you specified only consists of two intensities: 0 and 255.  Also, you set a square grid within this image to be 255 and &lt;strong&gt;it is uniformly shaped&lt;/strong&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For self-containment, this is what your test image looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fxP0p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This uniformly shaped object within a square image is &lt;strong&gt;important&lt;/strong&gt; as part of the reasoning why you are not getting any output for the detail images (HL, LH, and HH).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to describe why you're seeing an output for &lt;code&gt;db2&lt;/code&gt; and not &lt;code&gt;db1&lt;/code&gt; can be shown visually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This slide is from the &lt;a href=&quot;http://www.cs.toronto.edu/~kyros/courses/320/&quot; rel=&quot;nofollow noreferrer&quot;&gt;University of Toronto's CS 320: Introduction to Visual Computing course&lt;/a&gt;, specifically, the &lt;a href=&quot;http://www.cs.toronto.edu/~kyros/courses/320/Lectures.2013s/lecture.2013s.10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Discrete Wavelet Transform lecture&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MuZeR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are well aware that when you take the 2D DWT, you produce 4 sub-images that are half the resolution of the original image.  The first output of &lt;code&gt;dwt2&lt;/code&gt; are the approximation coefficients where each output pixel is an average of a 2 x 2 window.  The other outputs (second, third and fourth) are detail windows that take two pixels within the window and subtracts these with two other pixels in the window.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, the reason why you are &lt;strong&gt;not&lt;/strong&gt; getting an output with &lt;code&gt;db1&lt;/code&gt; is because all of your calculations for the detail images will &lt;strong&gt;cancel&lt;/strong&gt; out.  Specifically, you will get 2 x 2 windows of either completely 0, or completely 255, and when you calculate the detail images, you will get 0s for the output regardless.  You would take add two 0 values, or two 255 values and you would subtract these with two other 0 values, or two other 255 values respectively, thus causing the output to be &lt;strong&gt;0 regardless&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;db2&lt;/code&gt; wavelet is a more complicated transform which is a weighted sum of non-uniform coefficients and so you will certainly get outputs for the detail images rather than just a simple differencing of the 2 x 2 windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to stress that if you have a more complicated shape that is non-uniform, &lt;code&gt;db1&lt;/code&gt; will certainly &lt;strong&gt;not&lt;/strong&gt; give you a zero output.  Try it on any test image that comes with MATLAB, like with &lt;code&gt;cameraman.tif&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="8480" LastActivityDate="2015-02-08T18:56:23.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20428" PostTypeId="1" AcceptedAnswerId="21981" CreationDate="2015-02-08T21:06:19.877" Score="1" ViewCount="1158" Body="&lt;p&gt;$w(n)= 0.54 + 0.46\cos(2n \pi/(M-1))$ is Hamming window and we have say $f_{s_1}$,$f_{p_1}$,$f_{p_2}$,$f_{s_2}$ with pass and stopband tolerance specifications of the desired filter. From this specification can we get mathematical corresponding frequency response?&lt;/p&gt;&#xA;" OwnerUserId="13656" LastEditorUserId="80" LastEditDate="2015-12-07T15:54:58.487" LastActivityDate="2016-01-06T16:51:55.937" Title="Confused about Hamming window and its relation with frequency response specification" Tags="|filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20430" PostTypeId="2" ParentId="20409" CreationDate="2015-02-08T23:22:27.587" Score="0" Body="&lt;p&gt;Check out &lt;a href=&quot;http://pyserial.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;PySerial&lt;/a&gt; - a python library for serial communications.&lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-02-08T23:22:27.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20432" PostTypeId="1" CreationDate="2015-02-09T09:54:31.327" Score="0" ViewCount="57" Body="&lt;p&gt;I am stuck with a case where I need to get rid of a portion of sinusoidal signal that suddenly appears in my main signal (sine wave).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my total signal will look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;s(n) =&#xA;\begin{cases}&#xA;A\sin(\frac{2\pi}{8000}*n + \theta) + b\sin(\omega*n) &amp;amp; \text{if } 4500 \leq n \leq 5500 \\&#xA;A\sin(\frac{2\pi}{8000}*n + \theta) &amp;amp; \text{elsewhere}&#xA;\end{cases}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the given example, I have $8000$ samples which represents one period of the main sine signal, but at a certain range I have the interference of another(weaker) sine signal, that occurs and disappears abruptly (for almost 1000 samples out of total 8000).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My previous approach:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The strange signal used to appear for a very short range (around 50 samples out of 8000), and also a less amplitude (experimentally), so I used to pass all my signal through a Least-squares estimator to come out with the closest $A\sin(\alpha)+B\sin(\beta)$. It used to give a satisfying results. But for the current conditions, least squares is really helpless in front of the big impact of this [noise].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How I am trying to solve&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am thinking of correlation, I am trying to gather as more information as possible about the (noise) signal through experiments, once I can expect the exact shape (freq, length, ...). I am thinking of applying a correlation between $s(n)$ and the designed $noise$. [still in process, but I would love to hear guidance and advise].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I attach an illustrative image of the case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XThET.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;" OwnerUserId="11931" LastEditorUserId="11931" LastEditDate="2015-02-09T23:54:23.407" LastActivityDate="2015-02-09T23:54:23.407" Title="filter out an expected but not regular signal" Tags="|filters|noise|sampling|cross-correlation|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20433" PostTypeId="1" CreationDate="2015-02-09T13:15:56.550" Score="1" ViewCount="544" Body="&lt;p&gt;Couldn't decide whether the question belongs on Mathematics or here, but I guess I'll ask it here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a discrete - valued function defined on a finite segment of a line that looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/dPiGZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the task is, given a set of other functions, find a function in this set that is the closest - in some way that I'm about to describe - to the original one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the candidate functions may be, actually, circularily shifted with respect to one another. If the functions were not shifted, any reasonable norm of difference (l1, l2, any lp, I guess) would've been okay. I also want to notice that I do not necessarily want a function that satisfies the mathematical definition of a norm (or even a distance) - I just want the problem solved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious thing to do is to look at the maximum of circular cross - correlation. However, this is actually a bad idea because even if I normalize both compared function by their max values, the function f(x) = 1 will give the maximal value with any other function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know whether there is some standard approach for such a situation or should I just compute an l1 - norm for every possible circular shift and then take the minimum value.&lt;/p&gt;&#xA;" OwnerUserId="13660" LastActivityDate="2015-02-09T13:15:56.550" Title="&quot;Circular shift - invariant&quot; distance" Tags="|cross-correlation|distance-metrics|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20436" PostTypeId="2" ParentId="20332" CreationDate="2015-02-09T18:16:36.107" Score="1" Body="&lt;p&gt;These are the two approaches I have taken&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NwnVf.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img (* sample image *)&#xA;&#xA;f[arg_Image] := Log[1 + #^2] &amp;amp; /@ ImageData[arg]&#xA;&#xA;lwd = LiftingWaveletTransform[img, BiorthogonalSplineWavelet[1, 3], 3, Padding -&amp;gt; 0,&#xA;        Method -&amp;gt; &quot;IntegerLifting&quot;]&#xA;&#xA;lwdcoeffs = lwd[All, {&quot;Image&quot;, &quot;ImageFunction&quot; -&amp;gt; ImageAdjust, ImageSize -&amp;gt; 120}];&#xA;&#xA;(* We scale the coefficients; Log[1 + coefficient^2] *)&#xA;lwdlogcoeffs = First@# -&amp;gt; Image@f[Last@#] &amp;amp; /@ lwdcoeffs;&#xA;&#xA;(* And now invert the transform but with a higher order wavelet *)&#xA;(* While retaining the 50 largest coefficients                  *)&#xA;InverseWaveletTransform[WaveletThreshold[DiscreteWaveletData[lwdlogcoeffs,&#xA;        BiorthogonalSplineWavelet[2, 2], LiftingWaveletTransform], &#xA;        {&quot;LargestCoefficients&quot;, 50}]] // ImageAdjust&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xpHXS.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;transformedlwdcoeffs = MapThread[#1[[1]] -&amp;gt; Binarize[GaussianFilter[DistanceTransform[#1[[2]]], 1,&#xA;        {2, 2}]] &amp;amp;, {lwdcoeffs}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DXQyw.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eh, not too shabby - we will use this as a mask&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(* Extract the coefficients we are interested in *)&#xA;mask = First /@ lwd[{___, 0}]&#xA;&#xA;(* True if it is a coefficient we are going to use; False - otherwise *)&#xA;flags = Thread[Map[MemberQ[mask, #1] &amp;amp;, First /@ lwdcoeffs]];&#xA;&#xA;(* Multiply the mask and the original coefficients while using flags as an indicator *)&#xA;lwdobject = MapThread[If[#1[[1]] == #2[[1]] &amp;amp;&amp;amp; #3,&#xA;        #1[[1]] -&amp;gt; ImageMultiply[#1[[2]], #2[[2]]],&#xA;        #1[[1]] -&amp;gt; #1[[2]]] &amp;amp;, {lwdcoeffs, transformedlwdcoeffs, flags}];&#xA;&#xA;(* Now invert the transform *)&#xA;&#xA;InverseWaveletTransform[DiscreteWaveletData[lwdobject,&#xA;        BiorthogonalSplineWavelet[3, 1], LiftingWaveletTransform]] // ImageAdjust&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oC7ho.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's far from perfect, but I think it is a proof of concept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also filter based on the histograms of the image and the &lt;code&gt;LiftingWaveletTransform&lt;/code&gt; coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sPEBL.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7477" LastActivityDate="2015-02-09T18:16:36.107" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20437" PostTypeId="2" ParentId="18319" CreationDate="2015-02-09T19:30:03.747" Score="1" Body="&lt;p&gt;Unfortunately the only way I know of to convert their .ptw format to an standard video format is by using FLIR's ResearchIR software:  &lt;a href=&quot;http://www.flir.com/thermography/americas/us/view/?id=51371&quot; rel=&quot;nofollow&quot;&gt;http://www.flir.com/thermography/americas/us/view/?id=51371&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ResearchIR also supports exporting to &lt;code&gt;.mat&lt;/code&gt; files too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps,&#xA;Andy&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="7092" LastEditDate="2015-02-09T20:17:01.517" LastActivityDate="2015-02-09T20:17:01.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20438" PostTypeId="1" AcceptedAnswerId="20445" CreationDate="2015-02-09T19:45:29.487" Score="1" ViewCount="662" Body="&lt;p&gt;In DSP textbooks a system is stable in the BIBO (Bounded-Input, Bounded Output) sense if and only if every bounded input sequence produces a bounded output sequence. After stating this definition stable always means BIBO-stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to know if there exists other form of stability for a system?&lt;/p&gt;&#xA;" OwnerUserId="4311" LastActivityDate="2015-02-18T15:18:25.970" Title="Alternative to BIBO stability of a system" Tags="|linear-systems|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20444" PostTypeId="1" AcceptedAnswerId="20482" CreationDate="2015-02-10T10:06:32.910" Score="10" ViewCount="3209" Body="&lt;p&gt;I'm looking for books or resources that cover the following in detail:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;implementing mathematical functions (e.g., logarithm, exponential, sine, cosine, inverse) in fixed point arithmetic for DSP purposes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;techniques like using lookup tables, Taylor series, etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am fairly familiar with C programming and am more interested in the algorithms on how to go about implementing various mathematical functions in an efficient manner.&lt;/p&gt;&#xA;" OwnerUserId="13673" LastEditorUserId="21075" LastEditDate="2017-10-14T19:33:34.797" LastActivityDate="2023-10-11T16:52:05.067" Title="Books/resources for implementing various mathematical functions in fixed point arithmetic for DSP purposes" Tags="|algorithms|reference-request|math|fixed-point|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20445" PostTypeId="2" ParentId="20438" CreationDate="2015-02-10T11:20:02.460" Score="5" Body="&lt;p&gt;For &lt;em&gt;linear&lt;/em&gt; systems, BIBO stability is the most useful and practical criterion. For systems described by rational transfer functions it coincides with the condition that all transfer function poles must be located in the left half of the $s$-plane (for continuous-time systems), or inside the unit circle of the $z$-plane (for discrete-time systems). For linear systems, I do not know of any other stability criterion that makes any sense and does &lt;em&gt;not&lt;/em&gt; coincide with the BIBO-stability criterion. Since most basic DSP texts focus on linear (and especially time-invariant) systems, you will only find the notion of BIBO-stability there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things look a bit different for non-linear systems. There you have several reasonable stability criteria that do not all lead to the same basic criterion as is the case for linear systems. One important notion for non-linear systems is &lt;a href=&quot;http://en.wikipedia.org/wiki/Control_theory#Stability&quot;&gt;input-to-state stability&lt;/a&gt;, which basically means that for zero input, the system is stable about its zero state, and that well-behaved and bounded input signals produce a bounded state trajectory. &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.78.6035&amp;amp;rep=rep1&amp;amp;type=pdf&quot;&gt;This article&lt;/a&gt; reviews some of these concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you're mainly interested in linear systems, BIBO-stability is all you need.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-10T11:20:02.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20446" PostTypeId="1" CreationDate="2015-02-10T13:09:48.850" Score="0" ViewCount="801" Body="&lt;p&gt;I'm trying to distinguish by code between a real 3D object and its picture - a 2D object, based on depth information.&#xA;However the picture (= the 2D image) might be captured from noisy background, so I need something more sophisticated than just having diversified depth information; also, the depth camera's output itself might be noisy and there isn't a straight-forward correlation between the model shape and the depth information.&lt;br&gt;&#xA;For example: I have two pairs of color-depth images. One: color/depth pictures of a doll, second: color/depth pictures of a pictured doll. I want to create a flow that for pair no. 1 generates a &quot;yes&quot; output, and for pair no. 2 a &quot;no&quot; output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice - academical sources as implementation ideas - are very welcome.&lt;/p&gt;&#xA;" OwnerUserId="13675" LastEditorUserId="698" LastEditDate="2015-02-11T15:56:25.640" LastActivityDate="2015-02-11T15:56:25.640" Title="Distinguish between 2D and 3D objects according to depth" Tags="|image-processing|computer-vision|3d|2d|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20449" PostTypeId="2" ParentId="20444" CreationDate="2015-02-10T15:39:50.820" Score="3" Body="&lt;p&gt;Although not specific to fixed point, I would highly recommend the &quot;Math Toolkit for Real-Time Programming&quot; book by Jack Crenshaw. It comes with a CD with the source code.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-02-10T15:39:50.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20450" PostTypeId="1" CreationDate="2015-02-10T17:54:14.697" Score="2" ViewCount="2709" Body="&lt;p&gt;I'm using MATLAB, and have experience with it but not with this kind of problem. I'm trying to identify white lines in noisy 2D images such as the one below. I can separate the brighter ones just by thresholding, but the dimmer ones (like in the bottom left) are tricky. Any suggestions? I guess I need some kind of ridge detection. It's worth noting that the background isn't entirely uniform... the brightness of the dim filaments might even be lower than the background noise in other parts of the image. So maybe some kind of local filtering instead of uniform background subtraction. As you can see I don't know where to begin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I would will want to produce a skeleton describing all the lines for further analysis (measuring lengths). Of course this involves dealing with cross-overs and stuff too, but for now if I can just detect all the lines that would be a good start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1rVuR.png&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13682" LastEditorUserId="7092" LastEditDate="2015-02-10T18:20:23.120" LastActivityDate="2019-04-22T07:41:16.713" Title="Ridge finding in noisy 2D image" Tags="|image-processing|matlab|edge-detection|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20452" PostTypeId="2" ParentId="20395" CreationDate="2015-02-10T19:37:16.403" Score="3" Body="&lt;p&gt;Note that passed the optical system, images are transformed to a form of natural log-polar mapping* such that scaling in the Cartesian domain becomes analogous to a translation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This mitigates greatly the effect of scaling in human perception. The fact that the radial dimension is logarithmically mapped means a 10-fold scaling corresponds to a single-unit translation on the logarithmic scale. My understanding is that this allows human vision to be very good at scale-invariant pattern recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt; *See: &#xA;G. Sandini, and V. Tagliasco, ”A anthropomorphic retina-like structure for scene analysis”, Computer, Graphics and Image Process- ing, Vol. 14, 1980, pp. 365-372. or &#xA;E. Schwartz, ”Anatomical and Physi- ological Correlates of Visual Computation from Striate to Infero-Temporal Cortex” , IEEE Trans. on Systems, Man, and Cybernetics, Vol. SMC-14, No. 2, March/April 1984, pp. 257-271.&#xA;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="7560" LastEditorUserId="7560" LastEditDate="2015-02-11T15:08:14.940" LastActivityDate="2015-02-11T15:08:14.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20454" PostTypeId="1" AcceptedAnswerId="20535" CreationDate="2015-02-11T01:23:57.660" Score="8" ViewCount="1965" Body="&lt;p&gt;Many windowing functions are listed &lt;a href=&quot;https://reference.wolfram.com/language/guide/WindowFunctions.html&quot;&gt;here&lt;/a&gt; in the Mathematica documentation. I tried using a few to reduce leakage when computing a Discrete Fourier Transform. From what I could tell it made little difference which windowing function is used. Two of them that are very dissimilar are the BartlettHannWindow and BlackmanHarrisWindow. Could someone provide an example where the BarttletHannWindow is a very good choice, and another where the BlackmanHarrisWindow is a very good choice. That might help me understand why there are so many to choose from.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2015-02-15T11:27:50.023" Title="Why are there so many windowing functions?" Tags="|fourier-transform|window-functions|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20455" PostTypeId="1" CreationDate="2015-02-11T01:44:25.173" Score="3" ViewCount="639" Body="&lt;p&gt;I forgot a very simple fact and I am now struggling to find reference that proves this basic property?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you prove that for a single in single out system, the system output is the impulse response convoluted with the input?&lt;/p&gt;&#xA;" OwnerUserId="13497" LastActivityDate="2015-02-11T06:21:08.577" Title="Basic question: Why is the output of a system the convolution between the impulse response and the input?" Tags="|convolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20456" PostTypeId="2" ParentId="20454" CreationDate="2015-02-11T03:18:30.987" Score="1" Body="&lt;p&gt;The principal differences are between frequency and amplitude resolution, and computational complexity. Wiki has a fairly thorough coverage &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Window_function&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10620" LastActivityDate="2015-02-11T03:18:30.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20457" PostTypeId="1" CreationDate="2015-02-11T04:41:24.407" Score="0" ViewCount="181" Body="&lt;p&gt;I am working on some algorithm implementation, however being new to image processing, I have some questions about some of the definitions used.&#xA;UPDATE: for those asking for more information, this is the RELEVANT information stated in the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Step 4: Centerline Computation&#xA;Our implementation of the centerline extraction is based on the Distance Transform with thinning as post-processing step as proposed by niblack. The result is a binary mask image g with a centerline thickness of 1, which corresponds to the undirected edge image graph.&quot; Then :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;They(in the paper) keep on mentioning a node without prior definition, this means a &lt;code&gt;true&lt;/code&gt;point with 2 other &lt;code&gt;true&lt;/code&gt;neighbors(out of 8). Am I right ? (this is the general definition of a node pixel)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;They define an Edge being the distance between two adjacent nodes where the distance between them is $\leq \sqrt2 $. What do they mean by that exactly ? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Last they define saddle points being &lt;code&gt;node pixels&lt;/code&gt; with the connected edge length has to be $\geq 3$. I don't know what they mean by that&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Update: &#xA;Paper: ROCHADE: Robust Checkerboard Advanced Detection for Camera Calibration&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like someone having more experience than I do to guide me through these definitions. I can not post the algorithm paper online due to copyright. &lt;/p&gt;&#xA;" OwnerUserId="13687" LastEditorUserId="13687" LastEditDate="2015-02-15T19:02:05.893" LastActivityDate="2015-02-15T19:02:05.893" Title="Saddle points, Nodes and Edges definitions" Tags="|image-processing|software-implementation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20458" PostTypeId="1" AcceptedAnswerId="20479" CreationDate="2015-02-11T05:21:39.487" Score="0" ViewCount="114" Body="&lt;p&gt;If I have a signal x(t) as follow&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(t)=$\sum\limits_{k=-∞}^∞ R_{T}(t-2kT)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R_{T}(t) = \begin{cases}1 ;&amp;amp;[\dfrac{-T}{2},\dfrac{T}{2}] \\ 0; &amp;amp; \text{otherwise} \end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathfrak{F}\{R_{T}(t)\}=Tsinc(\pi fT)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(f)= \begin{cases}1 ;&amp;amp;|f| \le \dfrac{3}{4T} \\ 0; &amp;amp; |f| \ge \dfrac{3}{4T} \end{cases} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(f)=\dfrac{1}{2}\delta(t) + \dfrac{1}{\pi}\delta(f-\dfrac{1}{2T}) +\dfrac{1}{\pi}\delta(f-\dfrac{1}{2T})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can Some one Please Help me in how X(f) will Look Like graphically . I am just Poor in the graphical representation of how X(f) multiplied With H(f) to obtain Y(f).&lt;br&gt;&#xA;Please this is not a home work question but i really need to know to move forward.i tried a lot but i just don't get graphical representation in frequency domain.&#xA;thank You.&lt;/p&gt;&#xA;" OwnerUserId="13561" LastEditorUserId="4298" LastEditDate="2023-03-16T12:56:58.673" LastActivityDate="2023-03-16T12:56:58.673" Title="Periodic Signal Fourier Transform" Tags="|signal-analysis|lowpass-filter|dirac-delta-impulse|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20459" PostTypeId="2" ParentId="20455" CreationDate="2015-02-11T05:56:51.310" Score="2" Body="&lt;p&gt;Because it is the response of the system when an unit impulse (delta function) is applied to the input of the system. So basically, If you  multiply this output impulse response of the system to each of the input samples and then add them all, you get the overall output of the system. And this is only true, If the system agrees with the linearity properties such as homogeneity, additivity and shift invariance. For more details and to understand the mathematics behind this, you can go through this link: &lt;a href=&quot;http://www.dspguide.com/ch6.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch6.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to put this as comment instead of answer, since its not detailed enough, however, due to my lack of reputation, I could not comment. Anyways, the link I have provided is very useful. Hope it helps!&lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="9152" LastEditDate="2015-02-11T06:21:08.577" LastActivityDate="2015-02-11T06:21:08.577" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20460" PostTypeId="1" CreationDate="2015-02-11T07:23:05.827" Score="0" ViewCount="315" Body="&lt;p&gt;Is this possible to direct trans modulate DVB-S/S2 -&gt; QI into -&gt; DVB-C/C2 signals without doing it the way DVB-S/S2-&gt;Demodulator.ic-Transport Stream -&gt; Modulator.ic-Transport Stream -&gt; DVB-C/C2 ? Qpsk and Qam are similar, rf tuners the same, trouble within IQ. Direct conversion should be multichannel and cheaper within CATV systems.&lt;/p&gt;&#xA;" OwnerUserId="13690" LastActivityDate="2021-04-09T02:26:01.387" Title="dvb-s to dvb-c direct transmodulation" Tags="|modulation|demodulation|qpsk|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20461" PostTypeId="2" ParentId="20460" CreationDate="2015-02-11T08:16:45.627" Score="1" Body="&lt;p&gt;This should be impossible in most cases due to different modulation and coding schemes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, DVB-S2 uses single carrier phase modulation wheras DVB-C2 uses OFDM modulation. There is no way to convert single carrier to OFDM without going to the digital domain.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-02-11T08:16:45.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20462" PostTypeId="2" ParentId="19921" CreationDate="2015-02-11T09:08:39.943" Score="0" Body="&lt;p&gt;A simple way to obtain the first figure of the book is use this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Vsaw = A*[(-1:.2:1) (-1:.2:1) (-1:.2:.6)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13410" LastEditorUserId="13410" LastEditDate="2015-02-11T10:26:03.507" LastActivityDate="2015-02-11T10:26:03.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20463" PostTypeId="1" CreationDate="2015-02-11T09:23:38.290" Score="0" ViewCount="1155" Body="&lt;p&gt;I have been trying to find a solution to my FFT convolution problem but everything that I have found while searching hasn't been helping me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a working forward and backward FFT function, that I have tested with perfect results. A wav file that I ran through the forward FFT came out with a result of a frequency domain data, ran this domain data backwards again and back came a nice sounding waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the problem; I have now tried to put forward FFT to a pre-recorded piano sound (wav) a file with only one note and no dead silence. Then I've done the same to an IR-file (wav) of a room reverb, took the results from these two forward FFTs and tried to convolve them with the following code (the res_ir buffer has been scaled to have values between -1 to +1 before this):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;long bufSize = 1024*62;&#xA;mFFT-&amp;gt;runFFT(res, bufSize);&#xA;mFFT-&amp;gt;runFFT(res_ir, bufSize);&#xA;&#xA;double a=0;&#xA;double b=0;&#xA;double c=0;&#xA;double d=0;&#xA;for (int i=0;i&amp;lt;bufSize;i++)&#xA;{&#xA;     a=res[i].re();&#xA;     b=res[i].im();&#xA;     c=res_ir[i].re();&#xA;     d=res_ir[i].im();&#xA;&#xA;    res[i].mRe = (a*c - b*d) * (gain);&#xA;    res[i].mIm = (a*d + b*c) * (gain);&#xA;}&#xA;mFFT-&amp;gt;runIFFT(res, bufSize,true);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not looping through the complete wave file but just the size of one really big FFT buffer (1024*62), this to make it easier for me to follow and to eliminate extra possible bugs or errors keeping the problem down in size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the result I'm getting is just the IR wav sound shaped somewhat like the piano file, but it sounds like the &quot;starter gun&quot; from the IR file (no piano sound at all).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an image if the results (starting from above, first is the IR wav with the starter gun, second is the piano wav and last is the result from this):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fvD2a.png&quot; alt=&quot;wave files for this question&quot; title=&quot;tooltip&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone who can help me find what or where to dig for answer to this problem?&lt;/p&gt;&#xA;" OwnerUserId="13691" LastActivityDate="2015-02-15T19:35:48.913" Title="Simple FFT convolution with impulse response wav file doesn't give the right results" Tags="|fft|convolution|ifft|c++|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20466" PostTypeId="2" ParentId="20450" CreationDate="2015-02-11T14:23:45.393" Score="1" Body="&lt;p&gt;My proposal would be: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Filter noise&lt;/li&gt;&#xA;&lt;li&gt;Create image without the lines&lt;/li&gt;&#xA;&lt;li&gt;Subtract the image without the lines from the image with the lines&lt;/li&gt;&#xA;&lt;li&gt;Apply threshold&lt;/li&gt;&#xA;&lt;li&gt;Postprocess the image&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all;&#xA;% acquire input image&#xA;img = imread('ridges.bmp');&#xA;img = rgb2gray(img);&#xA;% remove some noise&#xA;img_gauss = imfilter(img,fspecial('gaussian',10,2));&#xA;figure();&#xA;imshow(img_gauss);&#xA;% remove all the lines from the image&#xA;img_filtered = medfilt2(img_gauss,[31,31],'symmetric');&#xA;figure();&#xA;imshow(img_filtered);&#xA;% subtract image without lines from image with lines&#xA;img_subtracted = uint8(double(img_gauss)-double(img_filtered)+127);&#xA;figure();&#xA;imshow(img_subtracted);&#xA;% threshold&#xA;img_thresh = img_subtracted&amp;gt;130;&#xA;figure();&#xA;imshow(img_thresh);&#xA;% use open to remove some noise&#xA;figure();&#xA;img_opened = imopen(img_thresh,ones(3));&#xA;imshow(img_opened);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/G0cTI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11477" LastActivityDate="2015-02-11T14:23:45.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20467" PostTypeId="2" ParentId="19921" CreationDate="2015-02-11T14:35:37.093" Score="-1" Body="&lt;p&gt;You can use the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Vsaw=linspace(-A,A,11);&#xA; Vsaw=[Vsaw Vsaw Vsaw];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-02-11T14:35:37.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20468" PostTypeId="2" ParentId="19873" CreationDate="2015-02-11T14:43:52.810" Score="1" Body="&lt;p&gt;To make it clear, you padded your image in what domain ?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Time domain &gt;&gt; No problem, IFFT and then truncate will bring you the original image. It's still intact.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Freq domain &gt;&gt; Padding in the Freq domain means image resizing. You cant get your original image with 100% anymore. If you really want the original size one, the only thing you can do is to resize it back with some resampling methods.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-02-11T14:43:52.810" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="20470" PostTypeId="1" AcceptedAnswerId="20474" CreationDate="2015-02-11T22:00:17.700" Score="0" ViewCount="91" Body="&lt;p&gt;I'm studying some variances ($\sigma^2$), that in my case, they must depend by velocity squared $v^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in my experimental proofs, I have plotted a graph of $\sigma^2/v^2$, and I was hoping to find a horizontal line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, my data seem to be constants in $\sigma^2/v$, and now I find myself in times of trouble: I have to choose which one is the best fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In each cases ($\sigma^2/v^2$ or $\sigma^2/v$), I obtain a nearly straight line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I look the equation of best fit lines as $y = mx +q$, where $m$ is his angular coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The angular coefficient $m$ is less, in the case of $\sigma^2/v^2$ (by about an order of magnitude), but in the case of $\sigma^2/v$, the range of the best fit line (from its maximum and minimum in the graph) is relatively more lower.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, to choose the best fit, the best solution is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Choose the case where $m$ is lower.&lt;/li&gt;&#xA;&lt;li&gt;Or I have to choose the dynamic case (maximum value minus minimum value), where the best fit line is more flat in the graph (not by absolute value)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here are an example: in the first graph $m$ is greater (see the equation in the plot), but the line varies of 0.01.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second case $m$ is lower, but the line varies of 0.15.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the best fit? The first or the second?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/czEEv.png&quot; alt=&quot;case of $\sigma^2/v$&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vnlyG.png&quot; alt=&quot;case of $\sigma^2/v^2$&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;a href=&quot;https://dsp.stackexchange.com/users/4298/matt-l&quot;&gt;Matt L.&lt;/a&gt; - Your approximation error $e$ is very similar to the $R^2$ parameter, that I define so (now I use your notation):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R^2 = 1 - \frac{\sum_i \left[d_i-f(v_i)\right]^2}{\sum_i \left[d_i-\overline{d_i}\right]^2}$$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\overline{d_i}$ is the average value of $d_i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you would like say that I must simply see where I have the minimum error $e$ or the best fit parameter, e.g. $R^2$.&lt;/p&gt;&#xA;" OwnerUserId="13410" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-02-12T11:55:46.113" Title="How to determine best fit from two?" Tags="|interpolation|approximation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20471" PostTypeId="1" CreationDate="2015-02-12T07:19:42.727" Score="2" ViewCount="143" Body="&lt;p&gt;Telecom companies offer different data rates for home/office purposes depending on the money they pay. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How are the telecom people able to control the flow of data of different cables?&lt;/li&gt;&#xA;&lt;li&gt;Say supposing a cable can be used till $20\textrm{ MBps}$. But he paid only for $5\textrm{ MBps}$ scheme, why is the user not able to steal the remaining bandwidth? &lt;/li&gt;&#xA;&lt;li&gt;Is there a multi rate theory behind this? &lt;/li&gt;&#xA;&lt;li&gt;Or it is a simple filtering?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7926" LastEditorUserId="1629" LastEditDate="2016-08-25T13:55:28.597" LastActivityDate="2016-08-25T13:55:28.597" Title="Is multirate signal processing involved in ADSL?" Tags="|discrete-signals|digital-communications|bandwidth|digital-filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20472" PostTypeId="2" ParentId="20471" CreationDate="2015-02-12T08:04:43.297" Score="3" Body="&lt;p&gt;&quot;The telecom people&quot; are the ones providing the internet data to you. Hence, they can easily throttle data at their end, making sure that you do not get faster access than you pay for. If the actual signal processing is adapted based on this I would say depends on the solution.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-02-12T08:04:43.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20473" PostTypeId="1" AcceptedAnswerId="20488" CreationDate="2015-02-12T08:25:00.347" Score="1" ViewCount="232" Body="&lt;p&gt;At present, I am learning the theory of operation of resampling for bandlimited periodic discrete signals using $\mathrm{sinc}$ interpolation. I am developing a design flow and having difficulty in understanding a particular expression/equation, hence I am stuck! Here I go:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have a samples $x(nT_s)$ of a continuous time signal $x(t)$, where $t$ is time in seconds and $n$ is sample points that ranges over integers and ofcourse $T_s$ is the sampling period. $x(t)$ is bandlimited to $\pm F_s/2$, where $F_s = 1/T_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we know that the original signal $x(t)$ can be reconstructed or synthesized by the samples of $x(nT_s)$ using the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x'(t) = x(nT_s)+H_s(t-nT_s) = x(t), \quad \text{for}\quad n =\ldots,-3,-2,-1,0,1,2,3,\ldots\tag1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H_s(t) = \mathrm{sinc}(\pi F_s t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To resample $x(t)$ for the new rate i.e. $F'_s = 1/T'_s$, we have to evaluate equation $(1)$ at integer multiples of $T'_s$ i.e. $nT'_s$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that, when the new sampling rate $F'_s$ is less than the original    sampling rate or frequency $F_s$, the lowpass cutoff must be placed below half the new lower sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doubt - Based on the highlighted statement made above, the ideal low pass is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H_s(t) = \min\left\{1,F'_s/F_s\right\}\mathrm{sinc}\left(\pi\min\left\{F'_s,F_s\right\}t\right) \tag2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the scale factor maintains unity gain in the passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does the equation $(2)$ represent? I understand that, if $F'_s$ is lower than $F_s$, then the filters cut off frequency should be half the $F'_s$, however, I am having trouble understanding this equation $(2)$ and how to benefit from it in the design process. Any explanation regarding this would be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Source/Reference:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\scriptstyle{\textrm{Julius O.Smith &amp;amp; Phil Gosett &quot;A Flexible Sampling Rate Conversion Method&quot; IEEE, 1984}}$.&lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="1629" LastEditDate="2016-06-24T18:22:02.063" LastActivityDate="2016-06-24T18:24:17.827" Title="Explanation relevant to the filter response ($\mathrm{sinc}$ interpolation) - Equation $(2)$ in my question" Tags="|filters|lowpass-filter|interpolation|resampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20474" PostTypeId="2" ParentId="20470" CreationDate="2015-02-12T10:53:13.990" Score="0" Body="&lt;p&gt;It looks like a straight line is not a great approximation in either case. One thing which is unclear to me is that the y-axis in the top plot is $\sigma^2/v$ whereas in the second plot it is just $\sigma^2$ (as far as I can see), and not $\sigma^2/v^2$ as I expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to figure out is what you should actually expect. When you say that $\sigma^2$ should depend on $v^2$ then this doesn't say much. From what you do it looks like that you expect those two quantities to be proportional:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma^2=\alpha v^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because then you would ideally have a constant ratio $\sigma^2/v^2$. Is this the case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you model $\sigma^2/v$ as a linear function of $v$, then you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma^2/v=mv+q$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma^2=mv^2+qv$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you actually model $\sigma^2$ by a &lt;em&gt;quadratic&lt;/em&gt; function of the variable $v$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine the best fit, it seems natural to compare the normalized approximation errors of the different fits. Given that $d_i$ are your measured data points, and $v_i$ are the discrete velocities corresponding to the data $d_i$, the approximation error can be defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\epsilon=\frac{\sum_i \left[d_i-f(v_i)\right]^2}{\sum_id_i^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f(v)$ is the approximation function, which could be linear as you've suggested in your question, i.e. $f(v)=mv+q$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-12T10:53:13.990" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20475" PostTypeId="2" ParentId="20473" CreationDate="2015-02-12T12:05:32.467" Score="2" Body="&lt;p&gt;Eq$(1)$ doesn't look right. It should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x'(t) = \sum_{n=-\infty}^{+\infty} x(nT_s) \mathrm{sinc}(t-nT_s)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your doubt, consider subsampling (lowering $F_s$) as equivalent to reconstructing $x(t)$ and then sampling it at a lower frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq$(2)$ comes from the combination of $2$ lowpass filters:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The ideal reconstruction filter (from eq.$1$)&lt;/li&gt;&#xA;&lt;li&gt;a new anti-alias filter previos to sampling at the lower $F_s$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These $2$ filters combined should result in eq$(2)$ (several lowpass filters in cascade is equivalent to one filter with the minimum bandwidth, and the product of the gains).&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="1629" LastEditDate="2016-06-24T18:24:17.827" LastActivityDate="2016-06-24T18:24:17.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20476" PostTypeId="1" AcceptedAnswerId="21659" CreationDate="2015-02-12T12:10:12.900" Score="2" ViewCount="377" Body="&lt;p&gt;I'm trying to test my ear frequency range by using MATLAB. The thing I could not understand is that I can hear the frequencies above 20 kHz. My sampling frequency is enough to satisfy the Nyquist criteria (80 kHz which is limit for MATLAB). So there is no possibility to have an aliasing. What can be the problem? Thank you for any help.&#xA;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;K               = 1000; % kilo&#xA;sampling_freq   = 80*K; % 80KHz sampling for sin wave &#xA;sampling_period = sampling_freq^(-1);&#xA;f               = 20*K; %kilohertz&#xA;t               = 0:sampling_period:5; % 5 second sin signal&#xA;testing_sound   = sin(2*pi*f*t);&#xA;plot(t,testing_sound)&#xA;sound(testing_sound,sampling_freq);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13705" LastEditorUserId="8202" LastEditDate="2015-02-21T18:30:43.937" LastActivityDate="2015-02-21T18:30:43.937" Title="Ear Test using MATLAB" Tags="|matlab|audio|hardware|" AnswerCount="1" CommentCount="7" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20479" PostTypeId="2" ParentId="20458" CreationDate="2015-02-12T14:15:10.730" Score="0" Body="&lt;p&gt;The Fourier transform of $x(t)$ can be easily obtained if you realize that $x(t)$ can be written as the convolution of the pulse $R_T(t)$ and a Dirac comb:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=R_T(t)*\sum_{k=-\infty}^{\infty}\delta(t-2kT)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since convolution corresponds to multiplication in the frequency domain, you get for the Fourier transform of $x(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f)=\mathcal{F}\{R_T(t)\}\cdot\frac{1}{2T}\sum_{k=-\infty}^{\infty}\delta(f-k/2T)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because the Fourier transform of a Dirac comb is a Dirac comb (see e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Distributions&quot; rel=&quot;nofollow&quot;&gt;this table&lt;/a&gt;). And since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)\delta(t)=f(0)\delta(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. (2) can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f)=\frac{1}{2T}\sum_{k=-\infty}^{\infty}\hat{R_T}\left(\frac{k}{2T}\right)&#xA;\delta(f-k/2T)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\hat{R_T}(f)$ is the Fourier transform of $R_T(t)$. Eq. (3) shows that the Fourier transform of $x(t)$ is a weighted sum of Dirac impulses, where the weights are equidistant samples of the Fourier transform of the pulse $R_T(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the low pass filter $H(f)$ only passes frequencies lower than $3/4T$, only the contributions for $k\in\{-1,0,1\}$ of the sum in (3) are passed. This gives the final result for $Y(f)$. Note that there are two typos in your formulation of $Y(f)$. It should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(f)=\frac12\delta(f)+\frac{1}{\pi}\delta(f-1/2T)+\frac{1}{\pi}\delta(f+1/2T)\tag{4}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-12T14:15:10.730" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20482" PostTypeId="2" ParentId="20444" CreationDate="2015-02-12T15:43:33.007" Score="13" Body="&lt;p&gt;The general polynomial form is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;f(u) &amp;amp;= \sum\limits_{n=0}^{N} \ a_n \ u^n \\&#xA;\\&#xA;  &amp;amp;= a_{\small{0}} + \Bigg(a_{\small{1}} + \bigg(a_{\small{2}} + \Big(a_{\small{3}} + \,... \big(a_{\small{N-2}} + (a_{\small{N-1}} + a_{\small{N}} \,u \,)u \, \big)u \ ...\Big)u \, \bigg)u \, \Bigg)u\\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The latter form is using &lt;a href=&quot;https://en.wikipedia.org/wiki/Horner%27s_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horner's method&lt;/a&gt;, which is highly recommended, especially if you're doing this in single-precision floating point.&lt;/p&gt;&#xA;&lt;p&gt;Then for a few specific functions:&lt;/p&gt;&#xA;&lt;p&gt;square root:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;f(x-1) &amp;amp; \approx \sqrt{x} \quad \quad 1 \le x \le 2 \quad \quad N=4\\&#xA;a_0  &amp;amp;  =  1.0 \\&#xA;a_1  &amp;amp;  =  0.49959804148061 \\&#xA;a_2  &amp;amp;  =  -0.12047308243453 \\&#xA;a_3  &amp;amp;  =  0.04585425015501 \\&#xA;a_4  &amp;amp;  =   -0.01076564682800 \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$2 \le x \le 4$&lt;/span&gt;, use the above to evaluate &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\tfrac{x}{2}}$&lt;/span&gt; and multiply that result with &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt; to get &lt;span class=&quot;math-container&quot;&gt;$\sqrt{x}$&lt;/span&gt;.  As with &lt;span class=&quot;math-container&quot;&gt;$\log_2(x)$&lt;/span&gt;, apply power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; scaling to scale the argument to the necessary range.&lt;/p&gt;&#xA;&lt;p&gt;base 2 logarithm:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;x\cdot f(x-1) &amp;amp; \approx \log_2(x) \quad \quad 1 \le x \le 2 \quad \quad N=5\\&#xA;a_0  &amp;amp;  =  1.44254494359510 \\&#xA;a_1  &amp;amp;  =  -0.7181452567504 \\&#xA;a_2  &amp;amp;  =  0.45754919692582 \\&#xA;a_3  &amp;amp;  =  -0.27790534462866 \\&#xA;a_4  &amp;amp;  =  0.121797910687826 \\&#xA;a_5  &amp;amp;  =  -0.02584144982967 \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;base 2 exponential:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;f(x) &amp;amp; \approx 2^x \quad \quad 0 \le x \le 1 \quad \quad N=4\\&#xA;a_0  &amp;amp;  =  1.0 \\&#xA;a_1  &amp;amp;  =  0.69303212081966 \\&#xA;a_2  &amp;amp;  =  0.24137976293709 \\&#xA;a_3  &amp;amp;  =  0.05203236900844 \\&#xA;a_4  &amp;amp;  =  0.01355574723481 \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;sine:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;x\cdot f(x^2) &amp;amp; \approx \sin\left(\tfrac{\pi}{2} x \right) \quad \quad -1 \le x \le 1 \quad \quad N=4 \\&#xA;a_0  &amp;amp;  =  1.57079632679490 \\&#xA;a_1  &amp;amp;  =  -0.64596406188166 \\&#xA;a_2  &amp;amp;  =  0.07969158490912 \\&#xA;a_3  &amp;amp;  =  -0.00467687997706 \\&#xA;a_4  &amp;amp;  =  0.00015303015470 \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;cosine (use sine):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \cos(\pi x) = 1 \, - \, 2 \, \sin^2 \left(\tfrac{\pi}{2} x \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;tangent:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \tan(x) = \frac{\sin(x)}{\cos(x)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;inverse tangent:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;\frac{x}{f(x^2)} &amp;amp; \approx \arctan(x) \quad \quad -1 \le x \le 1 \quad \quad N=4 \\&#xA;a_0  &amp;amp;  =  1.0 \\&#xA;a_1  &amp;amp;  =  0.33288950512027 \\&#xA;a_2  &amp;amp;  =  -0.08467922817644 \\&#xA;a_3  &amp;amp;  =  0.03252232640125 \\&#xA;a_4  &amp;amp;  =  -0.00749305860992 \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \arctan(x) = \tfrac{\pi}{2} - \arctan\left( \tfrac{1}{x} \right) \quad \quad 1 \le x $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \arctan(x) = -\tfrac{\pi}{2} - \arctan\left( \tfrac{1}{x} \right) \quad \quad x \le -1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;inverse sine:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \arcsin(x) = \arctan\left( \frac{x}{\sqrt{1-x^2}} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;inverse cosine:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\arccos(x) &amp;amp;= \frac{\pi}{2} - \arcsin(x) \\&#xA;           &amp;amp;= \frac{\pi}{2} - \arctan\left( \frac{x}{\sqrt{1-x^2}} \right)\\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-10-11T16:52:05.067" LastActivityDate="2023-10-11T16:52:05.067" CommentCount="15" ContentLicense="CC BY-SA 4.0" />
  <row Id="20484" PostTypeId="1" AcceptedAnswerId="20485" CreationDate="2015-02-12T18:12:27.090" Score="1" ViewCount="154" Body="&lt;p&gt;This is a conceptual question I am having difficulty to understand due to my limited knowledge of computer vision: If a pinhole calibration or any calibration is a mapping from world coordinates to image coordinate, is it possible to invert this mapping? I understand most of the times camera matrix is 3x4 so non invertible, but is it possible to have  a square camera matrix. &#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="13701" LastActivityDate="2015-02-13T07:48:20.403" Title="Pinhole calibration" Tags="|computer-vision|camera-calibration|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20485" PostTypeId="2" ParentId="20484" CreationDate="2015-02-12T18:28:11.207" Score="0" Body="&lt;p&gt;If you have a single calibrated camera, and you have its 3x4 camera matrix, then you can map image points to the world points on the z=0 plane. This assumes that you know that your image point does indeed correspond to a world point on that plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you cannot map any image point to its corresponding world point using a single image from calibrated camera. To do that, you would need two views from different viewpoints, and you would need to know the 3D rotation and translation between the views. &lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-02-12T18:28:11.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20486" PostTypeId="2" ParentId="20444" CreationDate="2015-02-12T20:22:48.957" Score="3" Body="&lt;p&gt;TI has IQMath libraries for all of their fixed point microcontrollers. I have found them to be a goldmine of fixed-point math and DSP functions not necessarily limited to TI chips.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ti.com/tool/msp430-iqmathlib?keyMatch=msp430%20iqmath%20library&amp;amp;tisearch=Search-EN-Everything&quot; rel=&quot;nofollow&quot;&gt;MSP430&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.ti.com/tool/sprc087&quot; rel=&quot;nofollow&quot;&gt;C28X&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13712" LastActivityDate="2015-02-12T20:22:48.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20487" PostTypeId="1" AcceptedAnswerId="20492" CreationDate="2015-02-12T21:06:26.930" Score="2" ViewCount="1005" Body="&lt;p&gt;Papers use wireless device-dependent radio-metrics as fingerprints. A radio-metric is a component of radio signal, amplitude, frequency and bandwidth. Each device creates a unique set of radio-metrics in its emitted signal due to hardware variability during the production of the antennas, power amplifiers, ADC and DAC circuits.As a result, radio-metrics cannot be altered post-production, and thus provide a reliable means for distinguishing wireless devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, the transmitted RF signal from a wireless device experiences hardware impairments, channel characteristics, and noise at the receiver. Distortions caused by channel-specific and noise-related effects are likely to have a more random structure. Distortions in a feature that are caused by transmitter hardware impairments should manifest themselves consistently across multiple frames from the same transmitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;device-dependent fingerprints are Modulation based features like carrier Frequency offset, phase shift offset, I/Q origin offset in the constellation plane.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I simulate carrier frequency offset in MATLAB?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the following reference &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=6096448&amp;amp;matchBoolean%3Dtrue%26queryText%3DOn%20Identifying%20Primary%20User%20Emulation%20Attacks%20in%20Cognitive%20Radio%20Systems%20Using%20Nonparametric%20Bayesian%20Classification/&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, the carrier frequency difference (CFD) is used as a feature for distinguishing wireless devices and it is assumed as Gaussian distribution. Why can we assume that this feature is Gaussian distributed?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why do noise and the channel not affect this feature? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=6096448&amp;amp;matchBoolean%3Dtrue%26queryText%3DOn%20Identifying%20Primary%20User%20Emulation%20Attacks%20in%20Cognitive%20Radio%20Systems%20Using%20Nonparametric%20Bayesian%20Classification/&quot; rel=&quot;nofollow noreferrer&quot;&gt;On Identifying Primary User Emulation Attacks in Cognitive Radio Systems Using Nonparametric Bayesian Classification&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;//Edit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CFO of different devices in the feature space&lt;/p&gt;&#xA;&#xA;&lt;p&gt;//reference&#xA;&lt;img src=&quot;https://i.stack.imgur.com/H5STy.jpg&quot; alt=&quot;CFO of different devices in the feature space&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?tp=&amp;amp;arnumber=5934926&amp;amp;queryText%3DDevice%20Fingerprinting%20to%20Enhance%20Wireless%20Security%20using%20Nonparametric%20Bayesian%20Method/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Device fingerprinting to enhance wireless security using nonparametric Bayesian method&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13713" LastEditorUserId="13713" LastEditDate="2015-02-13T19:38:00.367" LastActivityDate="2015-02-13T19:38:00.367" Title="carrier frequency difference" Tags="|matlab|noise|digital-communications|gaussian|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20488" PostTypeId="2" ParentId="20473" CreationDate="2015-02-12T21:44:45.490" Score="1" Body="&lt;p&gt;A Sinc function is both a reconstruction formula for a band-limited waveform and the time domain representation (impulse response) of an ideal &quot;brick-wall&quot; low-pass filter.  Since it does both, if you &quot;fatten&quot; the Sinc and then use it as an interpolation kernel, you get the reconstruction of the result of low-pass filtering the original waveform.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-02-12T21:44:45.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20489" PostTypeId="2" ParentId="20487" CreationDate="2015-02-12T23:39:33.063" Score="2" Body="&lt;p&gt;1 As defined, the device-dependent fingerprint offset should be constant for a given device so if you have &lt;code&gt;nominal_carrier_freq = 1000;&lt;/code&gt; then  you could say &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;unique_dev_offset = 1;&#xA;unique_dev_carrier_freq = nominal_carrier freq + unique_dev_offset&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2 Using the Gaussian distribution is common for modeling any deviation from nominal. Think of the context. Our goal is to have devices that are identical, but in real life they have some slight differences. Take a resistor for example, with a nominal value R. If we have a set of resistors we will see some are a little different than R but the majority of them are centered around R. So our model single modal distribution around R. With decreasing probability of being far away from R. This could be a lot of functions (triangle for instance meets those requirements) but the Gaussian is used because it has nice mathematical properties and usually fits real world data very well&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 I think you have to say the channel is constant for this to work. now imagine we have two signals. both are supposed to be the same but they have some unique characteristics. in the images below, I have two signals, one at nominal frequency (0 carrier freq offset), and one with a nonzero carrier frequency offset. We can see that even after adding noise the signals are still distinguishable from each other. Noise won't affect the characteristic frequency offset of the signals. It may modify the appearance of the signals, but not the underlying characteristics&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hope that helps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6tGGD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2015-02-12T23:39:33.063" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20491" PostTypeId="2" ParentId="20484" CreationDate="2015-02-13T07:48:20.403" Score="1" Body="&lt;p&gt;It is possible to invert the mapping, but projecting a 2D image point into 3D world won't give you a single point but a ray, which is the locus of all 3D world points that map to the same point in the image plane. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why the info of depth is being lost during the process of image formation. As Dima said you can get back this info using 2 or more views and doing triangulation which consists in getting the intersection of the 2 rays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calibration can be done with different types of targets for every camera, the most important thing is to ensure a right recognition: the more precise is your calibration (so the knowledge of your camera parameters) the more precise will be 3D reconstruction. &lt;/p&gt;&#xA;" OwnerUserId="13472" LastActivityDate="2015-02-13T07:48:20.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20492" PostTypeId="2" ParentId="20487" CreationDate="2015-02-13T08:38:16.153" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Communication systems are usually simulated in the equivalent baseband. As a consequence, all signals are generally complex-valued and the carrier frequency is zero. To model a carrier frequency offset multiply the transmit signal with a complex exponential:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f_off = 1e6; % in Hz&#xA;x_off = x .* exp(1i * 2*pi * f_off/f_s * 1:numel(x));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here I've assumed that the real-world analog signals are modeled by oversampling the discrete-time signals. The oversampling rate is &lt;code&gt;f_s&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This is probably a pragmatic assumption as Gaussian distributions are understood well and are mathematically relatively convenient. Presumably, it also includes the assumption that higher frequency offsets are less probable (which is quite plausible, I think). In contrast, a uniform distribution would certainly be a bad model. The authors do not motivate their choice of a Gaussian distribution, so they probably haven't done measurements to validate their assumption. But I think as a first approach it's sufficient.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Noise is the addition of a random signal. As such it will never shift frequencies but &quot;only&quot; cause a time-variant change of amplitude and phase of the frequencies in the considered bandwidth. Of course, noise will affect the carrier frequency estimation which will get more difficult with increasing noise power, but again it will not shift frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, the channel can indeed introduce a frequency shift when the user device moves. This causes the Doppler effect which manifests itself in a frequeny shift of the signal. However, the authors neglect this effect saying that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For OFDM application with low mobility, the Doppler effect is not severe. Moreover, due to reflection, the Doppler effect will cause the carrier to smear on both sides of the frequency. Consequently, the transmitter oscillator is the major factor for this feature.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-02-13T08:38:16.153" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20493" PostTypeId="1" AcceptedAnswerId="20497" CreationDate="2015-02-13T10:26:27.037" Score="1" ViewCount="1254" Body="&lt;p&gt;I have a pretty complex signal flow graph with all the blocks and the branches completely describing an analog filter, in the Laplace complex variable s. The signal $X(s)$ is the input and $Y(s)$ is the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any (free) tool which can analyze such a graph and provide the overall transfer function $H(s) = Y(s)/X(s)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Googling I found &lt;a href=&quot;http://www.ni.com/labview/mathscript/&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; Matlab tool, but the tool it is not free; anyway is there anything similar, in Matlab or in other environments?&lt;/p&gt;&#xA;" OwnerUserId="11837" LastActivityDate="2015-02-13T12:13:30.973" Title="Obtain transfer function from signal flow graph" Tags="|matlab|filters|filter-design|continuous-signals|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20494" PostTypeId="1" AcceptedAnswerId="20496" CreationDate="2015-02-13T10:26:37.750" Score="0" ViewCount="99" Body="&lt;p&gt;I'm going over an exercise of designing an simple FIR filter, I have the solution in front of me, but I struggle to understand some parts of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm asked to have an FIR filter with only 3 coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have reached this form:&#xA;$$ H(\theta ) = (2\alpha_0 \cos(\theta)+\alpha_1)e^{-j\theta} $$&#xA;where $\theta$ is the frequency variable (DTFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitude is easy:&#xA;$$ \left | H(\theta ) \right |=\left | 2\alpha_0 \cos(\theta)+\alpha_1 \right | $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I struggle with the phase, it seems easy: $\phi(H(\theta))=-\theta$ , but I guess this is wrong ? why ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution that is given is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi(H(\theta)) = -\theta +\beta$$&#xA;$$\beta = 0 \text{ for } 2\alpha_0 \cos(\theta) + \alpha_1 &amp;gt; 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\beta = \pi \text{ for } 2\alpha_0 \cos(\theta) + \alpha_1 &amp;lt; 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I just answers figured it out, if that expression is negative we can write it as positive with a phase of π. What happens if $\alpha_1$ is larger than $4\alpha_0$ thus the expression is always positive ? does $\beta =0$ ?&lt;/p&gt;&#xA;" OwnerUserId="11323" LastEditorUserId="11323" LastEditDate="2015-02-13T10:35:00.873" LastActivityDate="2015-02-13T13:30:22.050" Title="Help me understand the phase of an FIR filter" Tags="|filters|linear-phase|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20495" PostTypeId="2" ParentId="20494" CreationDate="2015-02-13T10:39:58.367" Score="1" Body="&lt;p&gt;Your answer does not take into account the possible sign of the magnitude term in the polar description of the frequency response $H(\theta) = A(\theta)e^{j\phi(\theta)}$. I guess you mix this definition with the more usual definiton of  $H(\theta) = |A(\theta)|e^{j\phi(\theta)}$ where the magnitude will always be positive and therefore phase will be what you predicted, however for your example $A(\theta)$ may assume a negative value and you shall reflect this as an addition of $\pi$ into the phase where $e^{j(\theta + \pi)} = -e^{j\theta} $&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-02-13T10:39:58.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20496" PostTypeId="2" ParentId="20494" CreationDate="2015-02-13T10:40:30.427" Score="1" Body="&lt;p&gt;Your frequency response is of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\theta)=Ae^{-j\theta}=Me^{j\phi(\theta)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A$ is a real-valued number that can take either a positive or a negative sign. $M\ge 0$ is the magnitude, and $\phi(\theta)$ is the phase. For positive $A$ you have $A=M$, and consequently $\phi(\theta)=-\theta$. However, when $A$ is negative you have $A=-M$ and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\theta)=-Me^{-j\theta}=Me^{-j(\theta-\pi)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $e^{\pm j\pi}=-1$. So the additional value of $\pi$ in the phase occurs because of the sign changes in $A$. If $A$ satisfied $A\ge 0$, your solution would be correct. The latter is the case if $\alpha_1&amp;gt;2|\alpha_0|$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-02-13T13:30:22.050" LastActivityDate="2015-02-13T13:30:22.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20497" PostTypeId="2" ParentId="20493" CreationDate="2015-02-13T12:06:07.377" Score="2" Body="&lt;p&gt;I am afraid that for complex systems finding such free standalone tool would be hard. Obviously since you mentioned MATLAB, you should use Simulink then or this tool:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/7224-a-fully-automated-flowgraph-analysis-tool-for-matlab&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Fully Automated Flowgraph Analysis Tool&lt;/strong&gt;&lt;/a&gt;. Manual to be found &lt;a href=&quot;http://read.pudn.com/downloads141/sourcecode/others/607984/flowg_tool/manual.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you might look into this &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22-mason-m&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Mason.m&lt;/strong&gt;&lt;/a&gt; tool. Or this &lt;a href=&quot;https://github.com/saschpe/masonry&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;masonry&lt;/strong&gt;&lt;/a&gt; tool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that &lt;a href=&quot;http://arxiv.org/ftp/arxiv/papers/0906/0906.5561.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;these guys&lt;/strong&gt;&lt;/a&gt; also did similar work once.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-02-13T12:13:30.973" LastActivityDate="2015-02-13T12:13:30.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20498" PostTypeId="1" CreationDate="2015-02-13T12:18:18.883" Score="3" ViewCount="316" Body="&lt;p&gt;Let $f:\left(-\frac T2,\frac T2\right)\to\mathbb{R}$ for some $T&amp;gt;0$. The Fourier coefficients of $f$ are $$\left\{\begin{matrix}a_0&amp;amp;=&amp;amp;\displaystyle\frac 1T\int_{-T/2}^{T/2}g(t)\;dt\\a_k&amp;amp;=&amp;amp;\displaystyle\frac 2T\int_{-T/2}^{T/2}g(t)\cos\left(k\frac{2\pi}Tt\right)\;dt\\b_k&amp;amp;=&amp;amp;\displaystyle\frac 2T\int_{-T/2}^{T/2}g(t)\sin\left(k\frac{2\pi}Tt\right)\;dt\end{matrix}\right.\;\;\;\;\;(k\in\mathbb{N})$$&#xA;and the Fourier polynom of degree $n\in\mathbb{N}$ itself is $$\mathcal{F}_n[f](x):=a_0+\sum_{k=1}^n\left(a_k\cos\left(k\frac{2\pi}Tx\right)+b_k\sin\left(k\frac{2\pi}Tx\right)\right)\tag{1}$$ Now, for any $g\in L^2$, where $$L^2:=\left\{g:(-\pi,\pi)\to\mathbb{C}:g\text{ is continuous almost everywhere}\right\},$$ the complex Fourier coefficients $c_k$ of $g$ satisfy &lt;em&gt;Parseval's identity&lt;/em&gt;, i.e. $$\sum_{k\in\mathbb{Z}}\left|c_k\right|^2=\frac{1}{2\pi}\left\|g\right\|_{L^2}^2\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we can interpret $f$ as a $T$-periodic signal that we want to transmit over a channel. I'm asking myself the following questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the &lt;em&gt;signal bandwidth&lt;/em&gt;?$^1$&lt;/li&gt;&#xA;&lt;li&gt;What is the &lt;em&gt;frequency spectrum&lt;/em&gt;?&lt;/li&gt;&#xA;&lt;li&gt;What is the &lt;em&gt;channel bandwidth&lt;/em&gt;?&lt;/li&gt;&#xA;&lt;li&gt;What does the &lt;em&gt;sampling theorem&lt;/em&gt; state?&lt;/li&gt;&#xA;&lt;li&gt;I've read that the square of the $k$-th coefficient, i.e. $a_k^2+b_k^2$, is proportional to the &quot;energy contained in this harmonic&quot;. I think this is somehow related to $(2)$. But I have no idea what is meant by &lt;em&gt;energy&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I've read all the definitions, but (as I'm a computer science and mathematics student with almost no relation to physics) I wasn't able to answer the questions above by myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that $(4.)$ has something to do with the fact, that we need to use some kind of &lt;em&gt;discrete Fourier transformation&lt;/em&gt;, i.e. we consider an equidistant grid $$x_j=-\pi+j\frac \pi N\;\;\;\text{for }j=0,\ldots,2N$$ and (maybe) use the &lt;em&gt;composite trapezoidal rule&lt;/em&gt; to approximate $$c_k=\frac{1}{2\pi}\int_{-\pi}^\pi f(x)e^{-ikx}\;dx\approx\frac{1}{2N}\sum_{j=0}^{2N-1}f\left(x_j\right)\exp\left(-ik\frac{2\pi}Tx_j\right)$$ So, I think the &lt;em&gt;sampling theorem&lt;/em&gt; targets the question how huge do I need to choose $N$ in order to reconstruct (what exactly does that mean? If the Fourier polynom has infinitely many summands we &lt;em&gt;cannot&lt;/em&gt; reconstruct the original function) the signal and at which size of $N$ it would be pointless to choose an even bigger $N$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;$^1\;\;$My lecture notes distinguish whether or not $\displaystyle\mathcal{F}[f]:=\lim_{n\to\infty}\mathcal{F}_n[f]$ is actually finite (i.e. $\exists k_0\in\mathbb{N}:\forall k\ge k_0:a_k=b_k=0$). They state, that &quot;the signal bandwith is the difference between the lowest and the highest frequency&quot;?  What does that mean? In the first place, I wasn't even sure if &lt;em&gt;signal bandwidth&lt;/em&gt; is a property of $f$ or $\mathcal{F}[f]$. Considering $f$, I would not understand why $f$ should have multiple frequencies and how I would calculate them. So, I think we need to consider $\mathcal{F}[f]$. More precisely, I think we need to look at the &quot;frequencies&quot; of the sine and cosine functions in the $k$-th summand in $(1)$. Obviously, these frequencies are both equal to $$\mathcal{f}_k:=\frac kT$$ and independent of $f$. But, I still don't understand how I can determine the &quot;highest&quot; frequency.&lt;/p&gt;&#xA;" OwnerUserId="13721" LastEditorUserId="128" LastEditDate="2020-03-16T06:14:54.027" LastActivityDate="2020-03-16T06:14:54.027" Title="Sampling Theorem and Signals Explained to a Mathematician" Tags="|discrete-signals|frequency-spectrum|sampling|continuous-signals|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="20499" PostTypeId="2" ParentId="20498" CreationDate="2015-02-13T13:58:34.717" Score="2" Body="&lt;p&gt;It seems like you have a lot of fundamental questions. The following blog might be useful for you:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://python-for-signal-processing.blogspot.com/2012/09/investigating-sampling-theorem-in-this.html&quot; rel=&quot;nofollow&quot;&gt;http://python-for-signal-processing.blogspot.com/2012/09/investigating-sampling-theorem-in-this.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The material there is also downloadable as an IPython Notebook, which means you can do the computations yourself in Python to play with the concepts that are discussed. There is also a corresponding text by Springer by the same author which collects most of the material. on the blog.&lt;/p&gt;&#xA;" OwnerUserId="8653" LastActivityDate="2015-02-13T13:58:34.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20500" PostTypeId="1" AcceptedAnswerId="20506" CreationDate="2015-02-13T14:29:28.813" Score="6" ViewCount="20330" Body="&lt;p&gt;I try to describe a simple signal in the frequency domain with the use of FFT function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy.fftpack import fftfreq, rfft&#xA;&#xA;def spectrum(sig, t):&#xA;    &quot;&quot;&quot;&#xA;    :param sig: signal.&#xA;    :param t: time scale.&#xA;    :return:&#xA;    &quot;&quot;&quot;&#xA;    f = fftfreq(sig.size, d=t[1]-t[0])&#xA;    y = rfft(sig)&#xA;    return f, y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/StOy6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and it's FFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z3nyj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why I'm getting negative values of the FFT? Do I even use the FFT function well? I want to check &quot;how many&quot; frequencies are in the shown above signal. Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="13723" LastActivityDate="2015-02-13T17:11:21.563" Title="Negative values of the FFT" Tags="|fft|discrete-signals|signal-analysis|python|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20501" PostTypeId="1" AcceptedAnswerId="21650" CreationDate="2015-02-13T16:00:34.083" Score="6" ViewCount="1119" Body="&lt;h1&gt;Edited.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Previously this question was named &lt;em&gt;&quot;Segmentation of overlapping pulses in a binary spectrogram&quot;&lt;/em&gt; and it was stated in slightly different way. I'm apologise to those users, who were affected by reformulation of the question.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Problem.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;There are a set of binary images, that contain arbitrary set of noisy parallelograms. The height and width of objects can vary in a wide range. Some parallelograms can overlap. Set of typical images is listed bellow.&#xA;&lt;br&gt;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/StbMB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Xp5W3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xMnxG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/shybC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need an algorithm to segment objects on those images in order to prepare them to extraction of connected components. There is one restriction on the segmentation algorithm - shape of the objects should be preserved during segmentation.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Attempted solutions.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Morphological erosion&lt;/em&gt;.&lt;br&gt;&#xA;Morphological erosion don't work well in this case. In order to separate three overlapping rectangles in the last image from typical set, I needed structuring element so big, that it erases some small objects from other images.&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Boundary extraction and Hit-or-miss transform with corner-like structuring elements.&lt;/em&gt;&lt;br&gt;&#xA;I have tried detect corners of parallelograms, in order to find regions of intersection. But pattern matching of boundary with corner-like structuring elements turned out to be a bad idea (boundary doesn't have the shape of a corner in regions of intersection).&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Some other morphological transformations.&lt;/em&gt;&lt;br&gt;&#xA;I have tried playing with combinations of original and shifted images.&#xA;$A - [A - [(A)_{(-x, 0)}\cap(A)_{(+x, 0)}]]$, where $A$ is an original image and $x$ is a shift along $x$-axis. This transformation can be applied for separation of objects on the last image.&#xA;But it messes up second image.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Question.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Is there good general approach to such problem?&lt;br&gt;&#xA;Any ideas, hints, links, articles will be much appreciated.&lt;br&gt;&#xA;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6961" LastEditorUserId="6961" LastEditDate="2015-02-19T23:23:35.470" LastActivityDate="2016-07-23T13:00:05.123" Title="Segmentation of overlapping noisy parallelograms in a binary image" Tags="|image-processing|computer-vision|image-segmentation|morphological-operations|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20502" PostTypeId="2" ParentId="20500" CreationDate="2015-02-13T16:37:27.410" Score="3" Body="&lt;p&gt;Negative values in the real component of the result of a complex FFT correspond to a negative correlation with a cosine waveform (same as a 180 degree phase shift).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to check the energy at each frequency, graph the magnitude (sqrt(re&lt;em&gt;re+im&lt;/em&gt;im)) of each complex FFT result bin.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-02-13T16:37:27.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20504" PostTypeId="2" ParentId="20498" CreationDate="2015-02-13T16:48:23.690" Score="3" Body="&lt;p&gt;&quot;Highest frequency&quot; is shorthand for the highest k/T for which a and b sub k are non-zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering f, one reason it might consist of the sum of multiple sinusoidal components is that this is a solution to many ordinary linear low-order differential equations.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-03-14T18:02:12.117" LastActivityDate="2016-03-14T18:02:12.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20505" PostTypeId="2" ParentId="20498" CreationDate="2015-02-13T16:55:18.803" Score="2" Body="&lt;p&gt;Note that I'll use 'function of time' and 'signal' interchangeably below. I'm an engineer, so please excuse my informal notation and definitions. I won't try to provide exhaustive answers, only pointers. At the end I give a link to a book that should prove very useful to you.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;There are many definitions of bandwidth. One example is: the smallest positive frequency beyond which all Fourier coefficients are zero. Another example is: the smallest positive frequency &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt; such that 99% of the signal's power is contained between &lt;span class=&quot;math-container&quot;&gt;$f=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f=f_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Generally, you choose the definition of bandwidth that is more appropriate to the application you're studying.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A signal's spectrum is its Fourier transform or series. In the case of the Fourier series, it is a one-to-one mapping from frequency to &lt;span class=&quot;math-container&quot;&gt;$(a_k,b_k)$&lt;/span&gt; tuples. It is common to use 'spectrum' to refer to a plot of the Fourier transform or series.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can think of a channel as a filter; that is, a system that outputs &lt;span class=&quot;math-container&quot;&gt;$H(f_0)\cos(2\pi f_0t)$&lt;/span&gt; when the input is &lt;span class=&quot;math-container&quot;&gt;$\cos(2\pi f_0t)$&lt;/span&gt;, for a given complex function &lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt;. The channel's bandwidth is the range of frequencies &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt; is non-zero (or sufficiently large for your application). It may also mean the range of frequencies for which &lt;span class=&quot;math-container&quot;&gt;$H(f)$&lt;/span&gt; is a non-zero constant.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hard to answer in detail here, but the theorem gives sufficient conditions under which it is possible to take an analog signal, sample it, and rebuild the signal from its samples. The theorem assumes an infinite-duration signal of limited bandwidth and an ideal interpolator.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In practice we use analog voltages instead of mathematical functions. A voltage only exists across a resistance, which implies current flow through the resistor. In turn, this implies energy expenditure. So, a signal's energy is the amount of joules it takes to generate it as a voltage across a given resistor. This concept can be extended to frequency, that is: how much of the total energy is contributed by each individual harmonic.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;It seems to me that you'll enjoy this book: &lt;a href=&quot;http://www.afidc.ethz.ch/A_Foundation_in_Digital_Communication/Home.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;A foundation in digital communication&lt;/a&gt; by A. Lapidoth. It's free, and it will answer your question in much more detail than is possible here.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-02-13T16:55:18.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20506" PostTypeId="2" ParentId="20500" CreationDate="2015-02-13T17:11:21.563" Score="6" Body="&lt;p&gt;The &lt;code&gt;rfft&lt;/code&gt; function returns complex values ordered in specific way. In order to retrieve the amplitude of your DFT you must take the absolute value of it. Easiest way to do that is to call &lt;code&gt;y_a = np.abs(y)&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also noticed in your case that you are using &lt;code&gt;fftfreq&lt;/code&gt; function to obtain corresponding frequency vector. In case of &lt;code&gt;rfft&lt;/code&gt; you must use the &lt;code&gt;rfftfreq&lt;/code&gt;. This will eliminate this nasty wrap-around on your plot. Also you should not forget about amplitude normalization by half of your window energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the complete example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy.fftpack import rfftfreq, rfft&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;&#xA;def spectrum(sig, t):&#xA;    f = rfftfreq(sig.size, d=t[1]-t[0])&#xA;    y = rfft(sig)&#xA;&#xA;    return f, y&#xA;&#xA;&#xA;if __name__ == &quot;__main__&quot;:&#xA;    N = 1000&#xA;    t = np.linspace(0, 4*np.pi, N)&#xA;    x = np.sin(10*np.pi*t)+np.random.randn(N)&#xA;&#xA;&#xA;    f, y = spectrum(x, t)&#xA;&#xA;    plt.subplot(211)&#xA;    plt.plot(t,x)&#xA;    plt.grid(True)&#xA;    plt.subplot(212)&#xA;    y_a = np.abs(y)/N*2 # Scale accordingly&#xA;    plt.plot(f, y_a)&#xA;    plt.grid(True)&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-02-13T17:11:21.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20507" PostTypeId="1" AcceptedAnswerId="20521" CreationDate="2015-02-13T17:19:12.207" Score="1" ViewCount="114" Body="&lt;p&gt;I'm trying to calculate the power of a signal and my tutor has given me this formula to do it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h1RN6.jpg&quot; alt=&quot;photo of the handwritten formula&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've spent the past while building a program and now the foundations are there it's time to implement the maths side of it. The problem is I can't actually read it. Would someone be able to transcribe it and explain it to me?&lt;/p&gt;&#xA;" OwnerUserId="13726" LastEditorUserId="80" LastEditDate="2015-02-15T17:41:10.440" LastActivityDate="2015-02-15T17:41:10.440" Title="Calculating the power of a signal" Tags="|signal-analysis|sound|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20508" PostTypeId="1" AcceptedAnswerId="20512" CreationDate="2015-02-13T17:23:57.593" Score="1" ViewCount="170" Body="&lt;p&gt;I am fairly new to the topic of DSP and FFT and I have hit a mental block. For a project, I am trying to pick out frequency's with amplitude peaks in a 47-53 MHz signal. This signal is being put through a 24 bit ADC with a sample rate of 96000 Hz. In order to successfully measure a sample, don't you have to have a sample rate &gt;= to twice the desired frequency (Nyquist rate)? How can you get an accurate representation of a 47-53 MHz signal with such a low sample rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second block I have hit involves the FFT of this signal. From my limited knowledge of FFT, the first &quot;bin&quot; (in the real part) represents 0 Hz and the last &quot;bin&quot; (in the real part) represents:&#xA;$$&#xA;F=i\times \frac{Fs}{N}&#xA;$$&#xA;&lt;i&gt;Where &lt;b&gt;$i$&lt;/b&gt;=Bin Index, &lt;b&gt;$Fs$&lt;/b&gt;=Sample Rate, &lt;b&gt;$N$&lt;/b&gt;=FFT Size&lt;/i&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case with size 1024 and above sample rate, $511 \times 96000/1024 = 47906.25$ Hz, right? How can this range ($0$ Hz-$47906.25$ Hz) possibly represent my $47-53$ MHz signal? I get the feeling that I am missing something really crucial but I just can't figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if this is a really basic question and thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="13724" LastEditorUserId="7092" LastEditDate="2015-02-13T18:48:30.633" LastActivityDate="2015-02-13T22:57:41.150" Title="Processing 47-53 MHz signal sampled at 96000 Hz" Tags="|fft|sampling|nyquist|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20510" PostTypeId="1" CreationDate="2015-02-13T20:01:46.577" Score="3" ViewCount="263" Body="&lt;p&gt;Let $y:\left(-\frac T2,\frac T2\right)\to\mathbb{C}$ be a square integrable function. The &lt;em&gt;Fourier coefficients&lt;/em&gt; of $y$ are $$\underline{Y}(k):=\frac 1T\int_{-T/2}^{T/2}y(t)e^{-i\omega_kt}\;dt\;\;\;\text{with }\omega_k:=k\frac{2\pi}T$$&#xA;for $k\in\mathbb{Z}$. The &lt;em&gt;Fourier polynom&lt;/em&gt; of degree $n\in\mathbb{N}$ of $y$ is $$\mathcal{F}^{-1}_n[y](t):=\sum_{k=-n}^n\underline{Y}(k)e^{i\omega_kt}$$ and $$\mathcal{F}^{-1}[y]:=\lim_{n\to\infty}\mathcal{F}_n^{-1}[x]$$ is called &lt;em&gt;inverse Fourier transformation&lt;/em&gt; of $y$. Now, I've got two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is meant by &lt;em&gt;sampling&lt;/em&gt; (in terms of the &lt;em&gt;sampling theorem&lt;/em&gt;)? From my understanding, if we know the period $T$ all we need to &quot;store&quot; are the values $\underline{Y}(k)$. We cannot store all values, so we need to choose a &quot;huge enough&quot; $n$ and store only the values $\underline{Y}(-n),\cdots,\underline{Y}(n)$. So, where does &quot;sampling&quot; come into play? The only thing I could imagine is &lt;em&gt;numerical integration&lt;/em&gt;: We consider an equidistant grid $$x_j=\left(\frac jN-1\right)\frac T2\;\;\;\text{for }j=0,\ldots,2N$$ and apprximate $\underline{Y}(k)$ using the &lt;em&gt;composite trapezoidal rule&lt;/em&gt;, i.e. $$\underline{Y}(k)\approx\frac{1}{2N}\sum_{j=0}^{2N-1}y\left(x_j\right)e^{-i\omega_kx_j}$$ By doing so, we didn't take the whole &quot;signal&quot; $y$, but only the &quot;sample points&quot;$\left(x_j,y\left(x_j\right)\right)$ into account. Is this meant by &quot;sampling&quot;?&lt;/li&gt;&#xA;&lt;li&gt;Does the &lt;em&gt;sampling theorem&lt;/em&gt; make a statement about $n$ or $N$ or something else?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13721" LastEditorUserId="13721" LastEditDate="2015-02-13T20:13:35.077" LastActivityDate="2015-02-16T22:41:46.677" Title="What is meant by *sampling* in terms of the *sampling theorem*?" Tags="|discrete-signals|signal-analysis|frequency-spectrum|sampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20511" PostTypeId="2" ParentId="20510" CreationDate="2015-02-13T20:23:33.713" Score="2" Body="&lt;p&gt;Sampling and the Fourier series are only indirectly related. Both are orthonormal expansions of a function, but they use different basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Fourier series, the orthonormal basis are exponential functions. The Fourier coefficents are the magnitude and phase of the exponentials. As you say, having the coefficients is equivalent, in a certain sense, to having the actual function. However:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;As you have noticed, the Fourier series in general requires an infinite number of coefficients, so it may not be practical. However, the coefficients tend to zero (there is a proof of this), so you can keep a finite number of them and neglect the rest. The difference between the original function and the one re-created from the stored coefficients can be so small as to be ignored.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Note that the Fourier transformation is not unique. It is unique if you limit the functions to voltages that can be created in practice.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When sampling, the orthonormal basis are sinc (cardinal sine) functions. The coefficients of the sinc functions are the signal samples (that is, its amplitude at specific instants). The sampling theorem gives sufficient conditions for a function to be expressed in terms of this basis. A nice thing about the proof is that it is constructive; that is, it recreates the function from its samples. Notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Again, you need an infinite number of coefficients (samples) . If you only keep a finite number, there will be a difference between the original function and its reconstruction.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The sampling theorem assumes that the function is band-limited, which implies that it is infinite in duration. So, the theorem requires $n$ to be infinite. It makes no statement on $N$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In engineering and signal processing, we just design our systems so that the difference between the original signal and that reconstructed from its samples is too small to notice. I don't know of any results that quantify the error in terms of $N$ for general functions.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-02-13T20:23:33.713" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="20512" PostTypeId="2" ParentId="20508" CreationDate="2015-02-13T22:57:41.150" Score="1" Body="&lt;p&gt;In short, what you're trying to do is impossible. The technique is known as band-pass sampling, or undersampling, but for it to work, you need that the signal's bandwidth be less than half your sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you sample a signal with spectrum $S(f)$ and bandwidth $B$ at sampling frequency $f_s$, the sampled signal has spectrum $$S_s(f)=k\sum_i S(f-if_s)$$ where $k$ is a constant. If $B&amp;gt;f_s/2$ then the replicas $S(f-if_s)$ overlap and you end up with a distorted spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are correct that the highest frequency bin in your FFT is 47906.25 Hz.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-02-13T22:57:41.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20513" PostTypeId="2" ParentId="20510" CreationDate="2015-02-14T00:44:08.537" Score="5" Body="&lt;p&gt;I think, with respect to sampled function, that i disagree a bit with MBaz.  perhaps i misunderstand what he/she says regarding needing an infinite number of coefficients &lt;strong&gt;or&lt;/strong&gt; samples for this special case of sampled periodic functions.  we had a little discussion about this at &lt;em&gt;comp.dsp&lt;/em&gt;, and i'm gonna make use of $\LaTeX$ to spell out the same points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;of course, whether $x(t)$ is periodic or not, if $x(t)$ is &lt;strong&gt;real&lt;/strong&gt; and is sufficiently bandlimited (there are no frequency components as high or higher than $\frac{f_\text{s}}{2} = \frac{1}{2T_\text{s}}$), then the samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] \triangleq x(n T_\text{s}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;are sufficient to completely represent the continuous-time $x(t)$.  if $x(t)$ never repeats, than an infinite number of discrete $x[n]$ are necessary to represent $x(t)$ for all $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but if $x(t)$ is periodic,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n+N]=x[n] \quad\quad \forall n,N \in \mathbb{Z} $$&#xA;and&#xA;$$ x(t+T)=x(t) \quad\quad \forall t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then samples existing over the span of one period are sufficient to represent $x[n]$ and $x(t)$.  in order for the $x[n]$ to be periodic in the sampled domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x[n+N] &amp;amp; = x\left((n+N)T_\text{s} \right) \\&#xA;&amp;amp; = x\left(nT_\text{s}+NT_\text{s} \right) \\&#xA;&amp;amp; = x\left(nT_\text{s}+T \right) \\&#xA;\end{align} $$&#xA;because $ x(t+T) = x(t) $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means the obvious, your function period $T$ has to be the same as $N$ times your sampling period $T_\text{s}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ T = N T_\text{s} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, what we know about this sampled periodic function is that $N$ samples of $x[n]$ are sufficient to tell us all about $x[n]$, and since $x(t)$ is bandlimited, $x[n]$ and the $N$ samples that fully define it, are sufficient to fully describe $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $x(t)$ is sufficiently bandlimited (as above), then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x(t) &amp;amp; = \sum\limits_{n=\infty}^{+\infty} x[n] \operatorname{sinc}\left(\frac{t-nT_\text{s}}{T_\text{s}}\right) \\&#xA;&amp;amp; = \sum\limits_{n=\infty}^{+\infty} x[n] \frac{\sin\left(\pi\frac{t-nT_\text{s}}{T_\text{s}}\right)}{\pi\frac{t-nT_\text{s}}{T_\text{s}}} \\&#xA;&amp;amp; = \sum\limits_{m=\infty}^{+\infty} \sum\limits_{n=0}^{N-1} x[n+mN] \frac{\sin\left(\pi\frac{t-(n+mN)T_\text{s}}{T_\text{s}}\right)}{\pi\frac{t-(n+mN)T_\text{s}}{T_\text{s}}} \\&#xA;&amp;amp; = \sum\limits_{n=0}^{N-1} \sum\limits_{m=\infty}^{+\infty} x[n] \frac{(-1)^{mN}\sin\left(\pi\frac{t-nT_\text{s}}{T_\text{s}}\right)}{\pi\frac{t-(n+mN)T_\text{s}}{T_\text{s}}} \\&#xA;&amp;amp; = \sum\limits_{n=0}^{N-1} x[n] \sin\left(\pi\frac{t-nT_\text{s}}{T_\text{s}}\right) \sum\limits_{m=\infty}^{+\infty} \frac{\frac{T_\text{s}}{\pi}(-1)^{mN}}{t-(n+mN)T_\text{s}} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) =&#xA;\begin{cases}&#xA;\sum\limits_{n=0}^{N-1} x[n] \frac{\sin\left(\pi\frac{t-nT_\text{s}}{T_\text{s}}\right)}{N\tan\left(\frac{\pi}{N}\frac{t-nT_\text{s}}{T_\text{s}}\right)}, &amp;amp; \text{if }N\text{ is even} \\&#xA;\sum\limits_{n=0}^{N-1} x[n] \frac{\sin\left(\pi\frac{t-nT_\text{s}}{T_\text{s}}\right)}{N\sin\left(\frac{\pi}{N}\frac{t-nT_\text{s}}{T_\text{s}}\right)}, &amp;amp; \text{if }N\text{ is odd}&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;proving the latter takes a little bit.  you might recognize the $N$ odd case as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirichlet_kernel&quot; rel=&quot;nofollow&quot;&gt;Dirichlet_kernel&lt;/a&gt;.  the $N$ even case looks a teeny bit different.  but both show exactly how the $N$ samples that fully define the sampled and periodic $x(t)$ are combined to get $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, since $x(t)$ is also periodic with period $T$, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x(t) &amp;amp; = x\left(t+T \right) \\&#xA;&amp;amp; = x\left(t+N T_\text{s} \right) \\&#xA;&amp;amp; = \sum\limits_{k=-\infty}^{+\infty} X[k] e^{i 2 \pi \frac{k}{T} t} \\&#xA;&amp;amp; = \sum\limits_{k=-\infty}^{+\infty} X[k] e^{i 2 \pi \frac{k}{N T_\text{s}} t} \\&#xA;&amp;amp; = \sum\limits_{k=-\lfloor \frac{N}{2} \rfloor}^{+\lfloor \frac{N}{2} \rfloor} X[k] e^{i 2 \pi \frac{k}{N} \frac{t}{T_\text{s}}}&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\lfloor\cdot\rfloor$ is the $\operatorname{floor}(\cdot)$ operator and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;X[k] &amp;amp; = \frac{1}{N} \sum\limits_{n=0}^{N-1} x[n] e^{-i 2 \pi \frac{nk}{N}} \\&#xA;&amp;amp; = \mathcal{DFT}\{x[n]\}&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there's actually something to fudge (a factor of $\frac{1}{2}$) about $X\left[\frac{N}{2}\right]$ for the $N$ even case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;X\left[-\frac{N}{2}\right] = X\left[\frac{N}{2}\right] &amp;amp; = \frac{1}{2} \ \frac{1}{N} \sum\limits_{n=0}^{N-1} x[n] e^{-i 2 \pi n\frac{n(N/2)}{N}} \\&#xA;&amp;amp; = \frac{1}{2N} \sum\limits_{n=0}^{N-1} x[n] (-1)^n \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x[n] = x(n T_\text{s}) &amp;amp; = \sum\limits_{k=-\lfloor \frac{N}{2} \rfloor}^{+\lfloor \frac{N}{2} \rfloor} X[k] e^{i 2 \pi \frac{k}{N} \frac{t}{T_\text{s}}}\bigg|_{t=n T_\text{s}} \\&#xA;&amp;amp; = \sum\limits_{k=-\lfloor \frac{N}{2} \rfloor}^{+\lfloor \frac{N}{2} \rfloor} X[k] e^{i 2 \pi \frac{k}{N}n} \\&#xA;&amp;amp; = \sum\limits_{k=0}^{N-1} X[k] e^{i 2 \pi \frac{nk}{N}} \\&#xA;&amp;amp; = \mathcal{iDFT}\{X[k]\}&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you deal with that $\frac{1}{2}$ fudging for $X\left[\frac{N}{2}\right]$ for the $N$ even case.  this is because $X[k+N]=X[k]$ for all $k$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;a periodic continuous-time function can be described with a countable set of Fourier coefficients.  a bandlimited periodic continuous function can be described with a finite set of $N$ Fourier coefficients, just as well as it can be described with a finite set of $N$ samples.  &lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-02-16T22:41:46.677" LastActivityDate="2015-02-16T22:41:46.677" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="20514" PostTypeId="1" AcceptedAnswerId="20515" CreationDate="2015-02-14T08:30:05.190" Score="6" ViewCount="3869" Body="&lt;p&gt;When designing an FIR filter using the windowing method, how can one estimate the filter order ? It's obvious that the type of window and the transitions band's width has some effect on the order.&lt;/p&gt;&#xA;" OwnerUserId="11323" LastActivityDate="2015-03-16T14:39:08.577" Title="What is the relation of the transition band's width and the filter order for the FIR windowing method" Tags="|filter-design|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20515" PostTypeId="2" ParentId="20514" CreationDate="2015-02-14T09:20:09.193" Score="6" Body="&lt;p&gt;There are only heuristic formulas for estimating the filter order. For a Kaiser window (which is probably the most frequently used window for filter design) the required filter order can be estimated from [1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M=\frac{A-8}{2.285\,\Delta\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A=-20\log\delta$ ($\delta$ is the maximum deviation from the desired response), and $\Delta\omega$ is the (smallest) transition bandwidth. This formula is of course only valid for the approximation of ideal frequency selective filters (low pass, high pass, etc.). This formula is implemented in Matlab's &lt;code&gt;kaiserord.m&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Oppenheim, Schafer, Buck, &lt;em&gt;Discrete-Time Signal Processing&lt;/em&gt;, 2nd ed., p. 476&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-02-14T14:21:52.450" LastActivityDate="2015-02-14T14:21:52.450" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20516" PostTypeId="1" AcceptedAnswerId="20518" CreationDate="2015-02-14T10:20:43.040" Score="0" ViewCount="1611" Body="&lt;p&gt;I want to implement Fourier Descriptor of an object. I have read &lt;a href=&quot;https://dsp.stackexchange.com/questions/19982/fourier-descriptors-trying-to-classify-objects&quot;&gt;link&lt;/a&gt;. However, I have some questions about normalizing Fourier Descriptor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, if I want to normalize the position of the starting point, according to the above link, This is done by subtracting the phase of the second Fourier descriptor $\phi_1$ from the phase of all Fourier descriptors and weighting by $k$; that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a(k)=a(k)e^{-j \phi_1 k}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the weight $k$ equal to the $k$ in $a(k)$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, how could I do in order to achieve rotational invariance when I implement Fourier descriptor ? Thank you very much for your reply.&lt;/p&gt;&#xA;" OwnerUserId="11826" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-02-14T10:47:38.027" Title="How to implement Fourier Descriptor of an image?" Tags="|image-processing|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20517" PostTypeId="1" AcceptedAnswerId="20519" CreationDate="2015-02-14T10:30:31.303" Score="1" ViewCount="806" Body="&lt;p&gt;I have a function of $j\Omega$ and $v$ (velocity), i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(j\Omega,v)=\frac{(j\Omega)^2}{p + \frac{j\Omega}{v}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $p$ is the pole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want know how $A(j\Omega,v)$ modify its behavior, when I insert another cascade filter $F(j\Omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case I would like study the power of this system via Parseval's theorem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P(v) = \frac{1}{2 \pi} \int_{-\infty}^{+\infty} \big|A(j \Omega,v) F(j\Omega)\big|^2 \text{d} \Omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until yesterday, I have used always the same $F(j\Omega)$, so the Matlab code was long, but simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;acc = @(w,v) ...&#xA;    abs( ...&#xA;    ((1i.*w).^2).* ...&#xA;    (1./(.1+1i.*w./v)) .*...&#xA;          ((0.0612.*(1i.*w)+1)./ ...&#xA;          (3.375e-06.*(1i.*w).^4+0.0001057.*(1i.*w).^3+0.0167.* ...&#xA;          (1i.*w).^2+0.0612.*(1i.*w)+1)) ...&#xA;    ).^2;&#xA;&#xA;&#xA;q = zeros(v_min, v_max);&#xA;&#xA;for v = v_min:v_max;&#xA;    q(v) = integral(@(w)acc(w,v), 0, Inf)./pi;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the second part of &lt;code&gt;acc&lt;/code&gt; is the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code works and everything is OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I do not want put that filter, but several kind of IIR Butterworth low-pass filters.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A series, with $F_c = constant$, but with order &lt;code&gt;N = 1:10&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A second series, with $N = constant$, and &lt;code&gt;Fc = [1 2 4 8 16 32 64 128]&lt;/code&gt;Hz.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know that the code for generate these filters is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h  = fdesign.lowpass('N,F3dB', N, Fc, Fs);&#xA;Hd = design(h, 'butter');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but &lt;strong&gt;my questions is&lt;/strong&gt;: how concatenate this filter with a Matlab function, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = @(w,v)(((1i.*w).^2).*(1./(.1+1i.*w./v)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for evaluate the integral?&lt;/p&gt;&#xA;" OwnerUserId="13410" LastEditorUserId="13410" LastEditDate="2015-02-14T14:40:50.530" LastActivityDate="2015-02-14T15:06:49.563" Title="How to concatenate IIR filter (Butterworth) with a Matlab function and evaluate the integral" Tags="|matlab|filters|signal-analysis|lowpass-filter|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20518" PostTypeId="2" ParentId="20516" CreationDate="2015-02-14T10:47:38.027" Score="0" Body="&lt;p&gt;Yes, these k are the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the basic sense, the rotational invariance is obtained by only taking the magnitude of the descriptors. However, in practice this might lead to information loss and decreases discrimination power. For this reason it is typically prefered to augment the phase information with additional terms. There are many ways to do this but for a simple approach follow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Invariant Fourier Descriptors Representation of Medieval Byzantine Neume Notation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dimo Dimov, Lasko Laskov&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-02-14T10:47:38.027" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20519" PostTypeId="2" ParentId="20517" CreationDate="2015-02-14T13:20:59.013" Score="1" Body="&lt;p&gt;The functions &lt;code&gt;fdesign&lt;/code&gt; and &lt;code&gt;design&lt;/code&gt; are for digital filters. Use &lt;code&gt;butter&lt;/code&gt; instead to obtain the filter coefficients of an analog butterworth filter. Then use the function &lt;code&gt;freqs&lt;/code&gt; to evaluate the (Laplacian) transfer function of that filter at given frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use &lt;code&gt;integral&lt;/code&gt; I would first create a function that calculates the transfer function of the concatenation of filters A and B. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function H = filter_cascade(w, v)&#xA;    % transfer function of A&#xA;    H_A = ((1i.*w).^2)./(.1+1i.*w./v);&#xA;&#xA;    % the other transfer function&#xA;    [b,a] = butter(3, 0.3);&#xA;    H_B = freqs(b, a, w);&#xA;&#xA;    % The transfer function of the cascade of A and B&#xA;    H = H_A .* H_B;&#xA;&#xA;    % Return the magnitude square of the transfer function&#xA;    H = H.*conj(H);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then pass a handle to this function to &lt;code&gt;integral&lt;/code&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = 0.1;&#xA;q = integral(@(w)filter_cascade(w,v), 0, 1)./pi;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that I have changed the upper limit of the integral to one.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2015-02-14T15:06:49.563" LastActivityDate="2015-02-14T15:06:49.563" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20520" PostTypeId="1" CreationDate="2015-02-14T13:55:48.810" Score="1" ViewCount="94" Body="&lt;p&gt;I am new to signal processing, and I am a bit confused by the use of coherence in academic literature. In several articles in neuroscience, coherence between signals (eg. EEG signals) is determined at a very high temporal resolution. See for an example this figure, from Bosman et al, 2012:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IkhYP.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That article refers to the 'Communcation through coherence' theory from Fries, who describes coherence as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;the pattern of phase-locking among oscillations in the&#xA;communicating neuronal groups.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bosman further states, it its experimental procedures:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot; Spectral power, coherence, and GC influences were estimated by applying&#xA;a fast Fourier transform (FFT) after multitapering (Mitra and Pesaran, 1999)&#xA;with seven tapers. Given epoch lengths of 0.5 s, this resulted in a spectral&#xA;smoothing of ±7 Hz. The resulting spectra are shown from 8 Hz to 140 Hz.&#xA;We performed a separate analysis of the lower frequencies (4 Hz to 28 Hz),&#xA;in which the same 0.5 s data epochs were Hanning tapered.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I understand it correctly, coherence is determined by looking at the stability of the phase difference between two signals over several tapers. But how can one then obtain values for the coherence at such high temporal resolutions? For each value, you would require several tapers; if I understand the description by Bosman correctly, this would result in a single value for coherence for each epoch of 0.5 seconds?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bosman, C. A., Schoffelen, J. M., Brunet, N., Oostenveld, R., Bastos, A. M., Womelsdorf, T., ... &amp;amp; Fries, P. (2012). Attentional stimulus selection through selective synchronization between monkey visual areas. Neuron, 75(5), 875-888.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fries, P. (2005). A mechanism for cognitive dynamics: neuronal communication through neuronal coherence. Trends in cognitive sciences, 9(10), 474-480.&lt;/p&gt;&#xA;" OwnerUserId="13431" LastActivityDate="2015-02-14T13:55:48.810" Title="High temporal precision in coherence?" Tags="|coherence|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20521" PostTypeId="2" ParentId="20507" CreationDate="2015-02-14T14:03:32.973" Score="2" Body="&lt;p&gt;As @jojek has already said in the comments, the formula reads&#xA;$$&#xA;P_\mathrm{x} = \dfrac{1}{T}\sum_{t=1}^{T}x^2(t)&#xA;$$&#xA;As $t$ usually denotes continous time I find this formulation a little bit odd. What your tutor probably actually meant is&#xA;$$&#xA;P_\mathrm{x} = \dfrac{1}{T}\int_{t=0}^{T}x^2(t) \mathrm{d}t&#xA;$$&#xA;It calculates the average power of the (continous-time) signal $x(t)$ of length $T$. In computer programs we're dealing with discrete-time (and discrete valued) signals, of course and the average power of the digital signal $x_n$ is given by&#xA;$$&#xA;\tilde P_\mathrm{x} = \dfrac{1}{N}\sum_{n=1}^{N}x_n^2,&#xA;$$&#xA;where $N$ is the length of $x_n$ in samples.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-02-14T14:03:32.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20522" PostTypeId="1" CreationDate="2015-02-14T14:48:33.570" Score="3" ViewCount="266" Body="&lt;p&gt;I am measuring acoustic emission signals. The &lt;code&gt;a.e.&lt;/code&gt; frequency range is 20kHz to 1 MHz. The sampling frequency that I,set was 100kHz&#xA;Samples per second. I must be able to detect a maximum of 50 kHz signal using it. But when I do fft I get a maximum of only 300Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me where I would have gone wrong?&lt;/p&gt;&#xA;" OwnerUserId="13531" LastEditorUserId="80" LastEditDate="2015-09-13T15:11:02.087" LastActivityDate="2023-10-10T08:44:00.557" Title="adequate sampling frequency in measuring acoustic emission" Tags="|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20524" PostTypeId="1" AcceptedAnswerId="20526" CreationDate="2015-02-14T15:24:52.193" Score="1" ViewCount="515" Body="&lt;p&gt;I want to implement one of the following mappings in MATLAB and verify its performance on an image, but I couldn't. Please help me with the implementation&lt;img src=&quot;https://i.stack.imgur.com/BYoeY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13731" LastEditorUserId="7092" LastEditDate="2015-02-14T19:40:11.293" LastActivityDate="2019-02-20T02:25:04.897" Title="How to apply the provided wave transforms on an image" Tags="|image-processing|matlab|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20526" PostTypeId="2" ParentId="20524" CreationDate="2015-02-14T20:26:06.810" Score="0" Body="&lt;p&gt;You want to apply to your original image &lt;span class=&quot;math-container&quot;&gt;$I_1[n,m]$&lt;/span&gt; a transform (x,y)=T(n,m) such as a warping effect, to obtain a new image &lt;span class=&quot;math-container&quot;&gt;$I_2[n,m]$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, you want to shift original pixel positions (n,m) to new coordinates based on the calculated position (x,y) from the transform equation (x,y) = T(n,m). As usually the case, this direct transform of indices will possibly result in noninteger positions (x,y) and therefore be quantized to slightly distorted locations, or even worse some pixels of the final image may not be filled, leaving them empty. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach to solve these two problems is to apply the algorithm from the reverse, by using the inverse transform of T(,)  provided it exists. As in the pseudo matlab code here: Result is as shown below&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ga4mf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ga4mf.jpg&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&#xA;&#xA;As a specific case of your examples: &#xA;WAVE1: T(n,m) = (n + 20*sin(2*pi*m/128) , m ) then the inverse transform is&#xA;       invT(x,y) =( x - 20*sin(2*pi*y/128) , y) which yields m = y and n =  x - 20*sin(2*pi*y/128) &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% NOTE1: This code is not efficient. You shall Vectorize it easily&#xA;% and get rid of the for-loops, yielding a substantial boost in efficiency.&#xA;% NOTE2: boundary rows/columns may be left untouched which needs a simple fix&#xA;% The transform that you want to appply is (x,y)=T(n,m)&#xA;% The transform that we will use is its inverse (n,m)=invT(x,y) (you shall invert your transform)&#xA;% Original image I1 is of size S1xS2, transformed image I2 is of size N1xN2&#xA;for x=1:N1    % let N1 = S1 and N2= S2 for this example WAVE1&#xA;  for y=1:N2  &#xA;&#xA;     % s1- compute back coordinates in the original image domain&#xA;     % [n m] = invT(x,y);&#xA;     m = y;&#xA;     n = x - 20*sin(2*pi*y/128);&#xA;&#xA;     % s2-s3 Apply (bilinear) interpolation to find the image intensity, if &#xA;     % n,m does not fall into integer indices&#xA;     d1 = n - floor(n);&#xA;     d2 = m - floor(m);&#xA;&#xA;     % s3- define the image pixel &#xA;    if ( ((n&amp;gt;=1)&amp;amp;(n&amp;lt;S(1))) &amp;amp; ((m&amp;gt;=1)&amp;amp;(m&amp;lt;S(2))) ) &#xA;     I2(x,y) = (1-d1)*(1-d2) * I1(floor(n),floor(m)) + ...&#xA;               (1-d1)*d2 * I1(floor(n),floor(m)+1) + ...&#xA;               d1*(1-d2) * I1(floor(n)+1,floor(m)) + ...&#xA;               d1*d2 * I1(floor(n)+1,floor(m)+1) ;&#xA;    end%if&#xA;&#xA;  end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="26573" LastEditDate="2019-02-20T02:25:04.897" LastActivityDate="2019-02-20T02:25:04.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="20528" PostTypeId="1" CreationDate="2015-02-14T23:13:32.107" Score="0" ViewCount="310" Body="&lt;p&gt;A hold operation can be modeled using a step function over one sampling period i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R(t) = 1/T * (h(t) - h(t-T))$, $h(t)$ the step function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In frequency domain this is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R(jw) = e^{-jwT/2}*sinc(wT/2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We see there exists a phase distortion of $T/2$ and a magnitude distortion from the $ sinc(wT/2)$ term. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that all the reconstructed signal will be distorted unless operated at very low frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain what induces this distortion and what is done to minimize both the phase and magnitude distortion &lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-02-15T09:31:00.573" Title="What is done to minimize distortion due to the hold operation?" Tags="|reconstruction|distortion|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20529" PostTypeId="2" ParentId="20528" CreationDate="2015-02-15T00:18:23.417" Score="2" Body="&lt;p&gt;What you are describing is the distortion introduced by an ideal digital-to-analog converter (DAC) in the analog domain.  Two things are typically done to reduce this distortion:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Analog filtering&lt;/li&gt;&#xA;&lt;li&gt;Oversampling&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As you note in your question, the distortion is modeled, in the frequency domain, by a sinc rolloff.  Increasing the sample rate before converting the digital signal to analog reduces $T$/2, which make the rolloff slower, or &quot;flatter&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Analog filtering can range from simple low-pass filters to compensation filters that counteract the sinc rolloff.  These filters do not, I believe, fix the phase issues, but they can greatly improve the frequency amplitude response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CD players are a good example of these techniques.  Audio CD's are sampled at 44.1 kHz, but before the DAC the CD players will typically increase the sample rate to a few hundred kHz.  I'm not sure how sophisticated their analog filtering is.  My guess would be that the cheap stuff does simple low-pass filtering and the expensive ones do sinc rolloff compensation.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-02-15T00:18:23.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20530" PostTypeId="1" AcceptedAnswerId="20533" CreationDate="2015-02-15T05:01:39.527" Score="0" ViewCount="555" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LU0BH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Refer to diagram above, in Ogata's text on discrete time control, he showed that you can map a curve in the S plane, namely curve 1,2,3,4,5 onto a circle in the Z plane through the complex mapping $e^{Ts}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do not understand is why are we missing the negative branch? This is curious because we must have poles in the z-plane located on the negative branch. So if that branch is missing, how are we suppose to map those poles back to the S plane?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain why the negative axis is missing in this mapping?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-02-15T09:46:11.800" Title="Can someone explain complex mapping as appears in Ogata's textbook" Tags="|z-transform|laplace-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20531" PostTypeId="2" ParentId="20522" CreationDate="2015-02-15T09:24:59.507" Score="2" Body="&lt;p&gt;How are you determining your maximum frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sample at $f_s$ the frequency resolution (the frequency difference between frequency components) of your FFT is $f_s/N$, where $N$ is the number of samples collected. And the maximum resolvable frequency is the Nyquist frequency corresponding to the sample rate. For more information &lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/372416B-01/svtconcepts/fft_funda/&quot; rel=&quot;nofollow&quot;&gt;see here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12119" LastActivityDate="2015-02-15T09:24:59.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20532" PostTypeId="2" ParentId="20528" CreationDate="2015-02-15T09:31:00.573" Score="2" Body="&lt;p&gt;I agree with Jim Clay's answer, but I think it is important to point out two things. First of all, there are no phase distortions due to the hold operation, just a simple delay of half a sampling interval. So nothing needs (and can) be done about the phase. Second, it is important to realize that the gain roll-off due to the sinc shape is relatively mild. Note that the gain at Nyquist ($\omega=\pi/T$) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\sin(\pi/2)}{\pi/2}=2/\pi=0.6366$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which corresponds to $-3.9224\,\text{dB}$ (without oversampling). This slight gain distortion can be easily compensated by the low pass filter following the hold operation.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-15T09:31:00.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20533" PostTypeId="2" ParentId="20530" CreationDate="2015-02-15T09:46:11.800" Score="0" Body="&lt;p&gt;If we denote $s=\sigma+j\omega$, then for the mapping $z=e^{sT}$, the negative real axis in the $z$-plane in the range $z\in[0,-1]$ corresponds to $\omega=\pm\omega_s/2$ (i.e. Nyquist) and $\sigma\in [-\infty,0]$, where $\omega_s$ is the sampling frequency in radians. So if the curve in the $s$-plane moved along the lines $s=\pm j\omega_s/2$ then the curve in the $z$-plane would move on the negative real axis of the $z$-plane. If it doesn't (as suggested in the figure) then this range of the $z$-plane will be excluded. So if with this mapping you want poles on the negative real axis of the $z$-plane, you need corresponding poles with imaginary parts $\pm \omega_s/2$ in the $s$-plane.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-15T09:46:11.800" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20534" PostTypeId="1" AcceptedAnswerId="20536" CreationDate="2015-02-15T11:15:37.497" Score="0" ViewCount="2841" Body="&lt;p&gt;Lets assume we have a simple audio processing flow with preprocessing, feature-extraction and classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where and why do we normalize the data? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the purpose of normalizing the data in the preprocession-step. But as I implemented some feature-extracrion methods like spectral flux, I have read about normalization of the extracted features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do we need to normalize the extracted features, when we normalized the data in the preprocessing step and vice versa?&lt;/p&gt;&#xA;" OwnerUserId="13739" LastEditorUserId="13320" LastEditDate="2016-11-21T13:15:55.977" LastActivityDate="2016-11-21T13:15:55.977" Title="When do we normalize data in audio processing?" Tags="|audio|normalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20535" PostTypeId="2" ParentId="20454" CreationDate="2015-02-15T11:27:50.023" Score="9" Body="&lt;p&gt;Aside from reduction of spectral leakage, there is a one major trade-off to be made when choosing a window function. Below you can see a figure with various parameters. Two of them are most important:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Main Lobe Width&lt;/li&gt;&#xA;&lt;li&gt;Peak Side Lobe Level&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NRciN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Width of the main lobe affects resolution of your analysis. I am sure you know that multiplication in time domain is convolution in frequency domain. By default you always use rectangular window, which has frequency response in a form of $\mathrm{sinc}$ function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example it might be the case that two pure sinusoids (Fourier Transform being Dirac deltas) with frequencies being very close to each other, peaks can be very hard to distinguish and thus become one. On figure below I compared 4 window functions for two sinusoids separated exactly by 3 frequency bins. You can see how wide is the main lobe of Nuttall window and how it affects the separation, whereas Rectangular window is the window with narrowest possible width of main lobe (i.e. lowest Normalized Equivalent Noise Bandwidth - NENBW)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PZyCT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand level of first side lobe affects the ability to recognize adjacent frequencies when spectral leakage is present and side lobes of frequency with high amplitude are almost &quot;covering&quot; other frequency next to it with much lower amplitude:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TcMbB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the trade-off... You can't get very low level of side lobes and very narrow main lobe, i.e. it's not possible to have window function with main peak like in rectangular window, and very low level of side lobes as in Nuttal window. Here is the comparison of some windows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p21vS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;img src=&quot;https://i.stack.imgur.com/Th4H4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Apart from parameters mentioned above, there is more features such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Side Lobe Roll-off rate (how fast side lobes decrease - for example see Bartlett and Nuttal above)&lt;/li&gt;&#xA;&lt;li&gt;Existence of analytical frequency response equation (useful when performing theoretical calculations)&lt;/li&gt;&#xA;&lt;li&gt;Summing of window samples to constant value in time domain when doing overlap (for example Hann window with $33\%$ of overlap)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FR8v1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is extremely useful when you want to perform STFT and then reconstruct time domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now to answer your question. Why do we have so many window functions? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on task whether it is simple FFT analysis of: closely spaced sinusoids, white noise, impulsive sounds, or even FIR filter design, different type of window is recommended. Obviously in 90% of cases people are using Hamming/Hanning window or no window at all. Nevertheless for some specific signals you might find that extracted features depending on window choice tend to be more discriminative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info about Window Functions please refer to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;noreferrer&quot;&gt;F. J. Harris - &lt;strong&gt;On the Use of windows for Harmonic Analysis with the&#xA;  Discrete Fourier&#xA;  Transform&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://holometer.fnal.gov/GH_FFT.pdf&quot; rel=&quot;noreferrer&quot;&gt;G. Heinzel, et al - &lt;strong&gt;Spectrum and spectral density estimation by the&#xA;  DFT, including a comprehensive list of window functions and some new&#xA;  flat-top windows&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://alpha.science.unitn.it/~bassi/Signal/NInotes/an041.pdf&quot; rel=&quot;noreferrer&quot;&gt;M. Cerna, A. F. Harvey - &lt;strong&gt;The Fundamentals of FFT-Based Signal&#xA;  Analysis and&#xA;  Measurement&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://www.sandv.com/downloads/0603gabe.pdf&quot; rel=&quot;noreferrer&quot;&gt;H. A. Gaberson - &lt;strong&gt;A Comprehensive Windows&#xA;  Tutorial&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-02-15T11:27:50.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20536" PostTypeId="2" ParentId="20534" CreationDate="2015-02-15T11:37:46.710" Score="2" Body="&lt;p&gt;There is no definite answer to that question since different workflows are applied to different tasks. For example in some applications you might want to normalize your input data samples or perform some kind of Automatic Gain Control (i.e. you work in fixed point and even for some low signal values you want your FFT to have good resolution). On the contrary you might be using some energy features, such as very simple energy based Activity Detection, thus normalisation of your input samples will mess your results. Therefore you must use your common sense and think (or test) whether your features are dependent on input amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other thing that you probably had in mind, is to normalize the features itself. This is called a whitening and is used for example in speech recognition for removal of channel effects. It is done by removing mean of your features and (if you wish) normalizing by the variance. This make your features to be in the same space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To wrap up, it's up to you. Train/test both systems with and without any type of normalization and observe the performance.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-02-15T17:59:37.430" LastActivityDate="2015-02-15T17:59:37.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20538" PostTypeId="1" CreationDate="2015-02-15T13:19:13.397" Score="2" ViewCount="350" Body="&lt;p&gt;A signal $x=\sin(\pi t/4)$&#xA;sampled at every $t=1$ sec.&#xA;so $T=1$ sec&#xA;Sampled signal is then $x=\sin(\pi n/4)$, &#xA;What is the sampling rate in this case?, &#xA;And according to Nyquist sampling rate what should be the minimum sampling rate to sample this signal?&lt;/p&gt;&#xA;" OwnerDisplayName="user11878" LastEditorUserId="8202" LastEditDate="2015-02-15T17:32:08.913" LastActivityDate="2015-02-18T18:25:15.050" Title="What is the sampling rate in this case?" Tags="|discrete-signals|sampling|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20539" PostTypeId="1" CreationDate="2015-02-15T13:41:45.777" Score="-1" ViewCount="1696" Body="&lt;p&gt;I'm trying to do frequency analysis on signal of a rotating shaft. The signal is generated in two measurement planes i,e X-position and Y-Position. I was able to use fft and transform into frequency domain for individual planes. The plot I get for each place is only Half spectra. What I'm looking for is a full spectra which could combine both the planes. I did some research and found the following description online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full spectrum: The full spectrum is an additional diagnostic tool and is also called the spectrum of an orbit. It shows the same information as an orbit but in a different format. It helps to determine the degree of ellipticity (or flattening) associated with the various machinery conditions along with the precessional direction for all the frequency components present. To obtain the full spectrum, the orthogonal X and Y transducer signals are fed into the direct and quadrature parts of the FFT input. The positive and negative vibration components for each frequency are obtained. Positive is defined to be the forward precession and the negative component as the reverse precession. These components yield the following ellipticity and precessional information for a given orbit of any particular frequency (1× or 2× or …):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• The sum of two components, forward and reverse, is the length of the orbit major axis. • The difference between the two components is the length of the orbit minor axis. • The larger of the two components, positive or negative, determines the direction of precession that is forward or reverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the possible applications of full spectrum is analysis of the rotor runout caused by mechanical, electrical or magnetic irregularities. Depending on the periodicity of such irregularities observed by the X–Y proximity probes, different combinations of forward and reverse components are observed. The method forms the basis for many useful machinery diagnostics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full spectrum (just like the normal FFT) can be obtained in a steady-state analysis (a single FFT or waterfall) and even in transient analysis, which would then be called the full spectrum cascade (Figure attached).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mIB4p.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2u5gt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone help how the 2 half spectra is converted into full spectra plot. Does anyone have any idea about this? Any hints or suggestions please!!&lt;/p&gt;&#xA;" OwnerUserId="13557" LastEditorUserId="8202" LastEditDate="2015-02-15T14:36:12.197" LastActivityDate="2022-05-08T22:00:30.070" Title="How to plot Full spectrum with negative frequencies" Tags="|fft|frequency-spectrum|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20541" PostTypeId="2" ParentId="20538" CreationDate="2015-02-15T13:58:54.813" Score="3" Body="&lt;p&gt;For the sine wave $\sin ((\pi/4)t)$ , the minimum sampling frequency is greater than 1/4 Hz. That amounts to a sampling period less than 4 seconds. In your case, sampling period of 1 second is therefore a valid choice. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-02-15T15:07:28.060" LastActivityDate="2015-02-15T15:07:28.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20545" PostTypeId="1" AcceptedAnswerId="20548" CreationDate="2015-02-15T17:53:36.407" Score="4" ViewCount="2049" Body="&lt;p&gt;I want to measure a reverberation time in the room. What is a best way to do that? What kind of signal should be used? I know about balloon and pink noise, but are there any better methods?&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="8202" LastEditDate="2015-02-15T17:55:57.163" LastActivityDate="2015-02-15T18:31:00.370" Title="What is the best method for measuring of room reverberation time?" Tags="|acoustics|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20546" PostTypeId="2" ParentId="20358" CreationDate="2015-02-15T18:24:31.607" Score="1" Body="&lt;p&gt;I know it is not matlab, but &lt;a href=&quot;http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html&quot; rel=&quot;nofollow&quot;&gt;this post about training a 'banana' detector&lt;/a&gt; is really great and can give you some tips.&lt;/p&gt;&#xA;" OwnerUserId="156" LastEditorUserId="156" LastEditDate="2015-02-17T08:54:39.423" LastActivityDate="2015-02-17T08:54:39.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20548" PostTypeId="2" ParentId="20545" CreationDate="2015-02-15T18:31:00.370" Score="6" Body="&lt;p&gt;Well, there is plenty of ways for approaching this problem. Which one is best depends on room itself, your resources and pursued accuracy. I think that best way to start is to look into &lt;strong&gt;ISO 3382-2:2008&lt;/strong&gt; standard, you will find lot of information. You should remember that post processing of your signals is very important here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless you should consider following methods:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hand clap, balloon, starter gun&lt;/strong&gt;. Cheap and most intuitive. You are recording the &quot;impulse&quot; itself from which you are then retrieving the reverberation time and other parameters. Basically almost every other method is relaying on getting the impulse response of your room. After that you filter it in frequency bands of interest and find the slope. Order is not random here. Hand clap doesn't have wide frequency response in low frequencies, balloon is slightly better, and starter gun will give best results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Intermittent noise&lt;/strong&gt;. You play the band-pass filtered pink noise (usually in octaves) and register it's level in dB scale. You turn off playback and record the decay. From the slope in dB scale you find the time at which energy curve will cross -60 dB from steady state. This is your reverberation time for this given octave band. It is important to use omnidirectional source and microphone. It is also good if you repeat results for different source-microphone arrangement, i.e. for 2 positions of your source and 6 positions of microphone. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sweep sine&lt;/strong&gt;. For that you presumably need a piece of software. You can either write your own (&lt;a href=&quot;https://dsp.stackexchange.com/a/17123/8202&quot;&gt;&lt;strong&gt;&lt;em&gt;here is how to do it&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;), use a free one (such us &lt;a href=&quot;http://www.roomeqwizard.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;REW&lt;/strong&gt;&lt;/a&gt;) or even buy some professional tool (i.e. Dirac, EASERA, etc.). Similarly to above you play signal from speaker, record for few positions and then analyse using favourite application - as simple as that. This is my method of choice.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Maximum Length Sequence&lt;/strong&gt;. This is white-noise-like signal that correlates nicely with itself and can be used for extraction of impulse response. Personally I do not recommend it as sweep sine seems to work better for me in every case. Although some people like to use it for measurement of speaker cabinets. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-02-15T18:31:00.370" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="20549" PostTypeId="2" ParentId="20463" CreationDate="2015-02-15T19:06:02.907" Score="1" Body="&lt;p&gt;Your code performs the circular convolution.&#xA;Circ Convolution gives an array equal to max( len(a) , len(b) )&#xA;Convolution will return an array of length = len(a) + len(b) - 1 // a, b &gt; 0&#xA;If you think about it, adding a reverb makes a sound longer. That's the equation ^^ that describes by how much. What you're hearing is the end of the reverb played over the start.&#xA;Keep in mind in a musical setting, often the original sound is mixed in with the reverb sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I zero padding your data before FFTing it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;long bufSize = 1024*62;&#xA;for(int i=bufSize; i&amp;lt;2*bufSize; ++i) res[i].mRe = res[i].mIm = res_ir[i].mRe = res_ir[i].mIm = 0;&#xA;mFFT-&amp;gt;runFFT(res, bufSize);&#xA;mFFT-&amp;gt;runFFT(res_ir, bufSize);&#xA;&#xA;double a=0;&#xA;double b=0;&#xA;double c=0;&#xA;double d=0;&#xA;for (int i=0;i&amp;lt;bufSize*2;i++)&#xA;{&#xA;    a=res[i].re();&#xA;    b=res[i].im();&#xA;    c=res_ir[i].re();&#xA;    d=res_ir[i].im();&#xA;&#xA;    res[i].mRe = (a*c - b*d) * (gain);&#xA;    res[i].mIm = 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That gets rid of the 'wrapping' effect of circular convolution at least.&#xA;Also, the imaginary part is zero because the convolution of two real signals is real.&lt;/p&gt;&#xA;" OwnerUserId="13486" LastEditorUserId="13486" LastEditDate="2015-02-15T19:35:48.913" LastActivityDate="2015-02-15T19:35:48.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20550" PostTypeId="1" AcceptedAnswerId="21614" CreationDate="2015-02-15T19:33:18.607" Score="1" ViewCount="449" Body="&lt;p&gt;I have to do a project for college. The project consists in writing a paper about some application of digital signal processing and then implement the solution in MATLAB. It doesn't have to be the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're supposed to check papers to come with ideas but I thought that perhaps someone here could give some ideas.&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="4298" LastEditDate="2015-02-18T23:12:58.427" LastActivityDate="2015-02-18T23:12:58.427" Title="Ideas for a college assignment" Tags="|matlab|project-ideas|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20553" PostTypeId="1" AcceptedAnswerId="20557" CreationDate="2015-02-15T20:45:49.140" Score="-5" ViewCount="133" Body="&lt;p&gt;Given a signal with a list of discrete values&#xA;1,2,3 (t=0),0,1,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether the signal is causal when the arrow is in 3 and why? I know the definition of causal is that the output will not depend on future input, but how to apply the definition in this question?&lt;/p&gt;&#xA;" OwnerUserId="13745" LastActivityDate="2015-02-15T22:16:40.407" Title="Causal question on a discrete signal" Tags="|signal-analysis|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20554" PostTypeId="1" AcceptedAnswerId="20556" CreationDate="2015-02-15T20:50:57.007" Score="0" ViewCount="449" Body="&lt;p&gt;I got this explenation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;It is well-known that an image’s histogram is essentially&#xA;the probability mass function (pmf) of the image (only&#xA;differing by a scalar). Multiplying each component of the&#xA;pmf by a correspondingly shifted unit impulse results in the probability density function (pdf). Obviously, in the context&#xA;of discrete Fourier transform (DFT), the unit impulses can be&#xA;ignored, implying that we can treat pmf and pdf&#xA;exchangeable. Thus, the pdf can be thought as the&#xA;normalized version of a histogram.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I am trying to fully understand it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is clear to me that histogram of an image are probability mass functions. How can we treat is as probability density function since it is discrete signal, not continuous?&#xA;Is the only reason that DFT of both PMF and PDF would give us same result so it doesn't really matter in this scenario?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And how can we even get PDF from PMF?&#xA;I don't get this part: &quot;multiplying each component of the&#xA;pmf by a correspondingly shifted unit impulse results in the probability density function&quot;&#xA;and I cannot find any good example or explenation.&lt;/p&gt;&#xA;" OwnerUserId="13744" LastActivityDate="2015-02-15T22:15:34.610" Title="Discrete Fourier Transform of PMF and PDF" Tags="|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20555" PostTypeId="2" ParentId="20550" CreationDate="2015-02-15T21:06:16.830" Score="3" Body="&lt;p&gt;I am not sure how complicated it should be, but you can consider &lt;a href=&quot;http://en.wikipedia.org/wiki/Audio_time-scale/pitch_modification&quot; rel=&quot;nofollow&quot;&gt;time stretching&lt;/a&gt;, which means changing the duration of an audio signal without changing the pitch. There are few algorithms that attempt to solve the problem (such as OLA, SOLA, etc...).&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-02-15T21:06:16.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20556" PostTypeId="2" ParentId="20554" CreationDate="2015-02-15T22:15:34.610" Score="0" Body="&lt;p&gt;A random variable (RV) doesn't need to be continuous in order to have a PDF. The PDF of a discrete RV, i.e. a RV that takes on only discrete values, is of course not a continuous function but is only different from zero at the possible discrete values of the RV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example would be the outcome of a fair die. It takes on the values 1 to 6 with equal probability $1/6$. It's PDF is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p(x)=\frac16\sum_{i=1}^6\delta(x-i)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta(x)$ is the Dirac delta impulse. The Dirac delta impulses are necessary in the PDF (as opposed to the PMF) because probabilities are computed from the PDF by integration. Since for any interval $[a,b]$ containing the value $0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{a}^b\delta(x)dx=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the PDF given by (1) integrates to $1$, as desired. And the probability of the RV $X$ being inside an arbitrary interval $[a,b]$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P[a\le X\le b]=\int_a^b p(x)dx$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-15T22:15:34.610" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20557" PostTypeId="2" ParentId="20553" CreationDate="2015-02-15T22:16:40.407" Score="-1" Body="&lt;p&gt;A signal x[n] is said to be causal if it could be the impulse response of a causal LTI system. That is, a signal is causal if x[n] = 0 when n &amp;lt; 0.&lt;/p&gt;&#xA;" OwnerUserId="13403" LastActivityDate="2015-02-15T22:16:40.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20559" PostTypeId="1" AcceptedAnswerId="20560" CreationDate="2015-02-16T00:40:41.800" Score="7" ViewCount="7918" Body="&lt;p&gt;I see two notions that describe the relationship between poles and system stability. But they are not the same from my understanding&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The system is BIBO stable if and only if all the poles are in the&#xA;left half of the complex plane&lt;/li&gt;&#xA;&lt;li&gt;A LTI system with a rational system function H(z) is stable if and only if all of the poles of H(z) lie inside the unit circle.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Why these two notions are different? Is that in different conditions?  &lt;/p&gt;&#xA;" OwnerUserId="13745" LastEditorUserId="4298" LastEditDate="2020-11-08T16:08:51.183" LastActivityDate="2020-11-08T16:08:51.183" Title="What is the relationship between poles and system stability?" Tags="|filters|linear-systems|transfer-function|poles-zeros|stability|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20560" PostTypeId="2" ParentId="20559" CreationDate="2015-02-16T00:54:09.720" Score="7" Body="&lt;p&gt;The two are both true, but they are for different cases.  Case 1 is true for continuous-time systems, and the transform is the Laplace transform and the variable is the derivative operator, $s$.  Case 2 is true for discrete-time systems, and the transform is the $z$-transform and the variable is the delay operator, $z$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-02-16T01:28:49.970" LastActivityDate="2015-02-16T01:28:49.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20561" PostTypeId="1" CreationDate="2015-02-16T01:21:46.223" Score="0" ViewCount="86" Body="&lt;p&gt;I got the time domain signal from experimental work as per below. The blue is x-direction,green is z-direction and red is y-direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o1uxW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i convert the signal into FFT using MATLAB, I got as per below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/asxfS.png&quot; alt=&quot;enter image description here&quot;&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, the peak should happen in z-direction(Ch3) but happen in x-direction(ch1). The coding as per below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;y1 = Ch1;&#xA;y2= Ch2;&#xA;y3 = Ch3;&#xA;N=6678;&#xA;Fs=512;&#xA;&#xA;%Plot FFT Moving Vehicle signal Ch1&#xA;NFFT1 = 2^nextpow2(N);&#xA;Y1 = fft(y1,NFFT1)/N; % the division by N is to scale the amplitude&#xA;f_plot = Fs/2*linspace(0,1,NFFT1/2+1); % vector of frequencies for the plot&#xA;subplot(311), plot(f_plot,2*abs(Y1(1:NFFT1/2+1))) % multiplicated by 2 to recover the energy related&#xA;% to the negative frequencies since in this way only half spectrum is plotted&#xA;title('FFT Moving Vehicle Ch1');&#xA;xlabel('Frequency [Hertz]');&#xA;&#xA;%Plot FFT Moving Vehicle signal Ch2&#xA;NFFT2 = 2^nextpow2(N);&#xA;Y2 = fft(y2,NFFT2)/N; % the division by N is to scale the amplitude&#xA;f_plot2 = Fs/2*linspace(0,1,NFFT1/2+1); % vector of frequencies for the plot&#xA;subplot(312), plot(f_plot2,2*abs(Y2(1:NFFT2/2+1))) % multiplicated by 2 to recover the energy related&#xA;% to the negative frequencies since in this way only half spectrum is plotted&#xA;title('FFT Moving Vehicle Ch2');&#xA;xlabel('Frequency [Hertz]');&#xA;&#xA;%Plot FFT Moving Vehicle signal Ch3&#xA;NFFT3 = 2^nextpow2(N);&#xA;Y3 = fft(y2,NFFT3)/N; % the division by N is to scale the amplitude&#xA;f_plot3 = Fs/2*linspace(0,1,NFFT3/2+1); % vector of frequencies for the plot&#xA;subplot(313), plot(f_plot3,2*abs(Y3(1:NFFT3/2+1))) % multiplicated by 2 to recover the energy related&#xA;% to the negative frequencies since in this way only half spectrum is plotted&#xA;title('FFT Moving Vehicle Ch3');&#xA;xlabel('Frequency [Hertz]');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For information,when the sensor do the measurement,the reading for y-direction will fall at-1 to 1 G due to the gravity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I need to do before convert it into FFT? Shift maybe?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="13462" LastEditorUserId="8202" LastEditDate="2015-02-16T08:25:29.167" LastActivityDate="2015-02-16T08:25:29.167" Title="Signal FFT conversion problem" Tags="|matlab|fft|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20563" PostTypeId="1" CreationDate="2015-02-16T02:34:17.847" Score="5" ViewCount="6869" Body="&lt;p&gt;I need to know if a certain audio file is real lossless and not a transcode (i.e. lossy converted in lossless, but lossy at the end). I was told there was a way to do this by creating a spectrogram of the file and then checking something else. The problem is that, since I am not well versed in audio processing, I don't know what else to check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to learn how to identify this fake and true lossless files using a spectrogram (since, as a Linux user, I found a program which creates them easily). If you want to give me a hand with the file in question, here it is: &lt;img src=&quot;https://i.stack.imgur.com/pXIap.png&quot; alt=&quot;spectrogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.D.: I'm not completely sure if this question belongs to this site. I put it here since is a site about audio, but if not just tell me and I will migrate it were it belongs.&lt;/p&gt;&#xA;" OwnerUserId="13748" LastActivityDate="2022-01-23T11:38:11.660" Title="How to know if a audio file is real lossless using its spectrogram?" Tags="|audio|frequency-spectrum|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20564" PostTypeId="2" ParentId="20538" CreationDate="2015-02-16T03:36:23.887" Score="0" Body="&lt;p&gt;Sampling frequency is 1 Hz, since the sampling period T = 1sec. i.e greater than 1/4 Hz. Sorry for the wrong expression.&lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="9152" LastEditDate="2015-02-16T08:32:38.400" LastActivityDate="2015-02-16T08:32:38.400" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20565" PostTypeId="2" ParentId="20538" CreationDate="2015-02-16T04:43:07.057" Score="2" Body="&lt;p&gt;Some things to think about:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Nyquist Theorem requires the sampling rate be a minimum of twice the bandwidth of the signal, which, in general, is not twice the fundamental frequency of the carrier.&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For a lowpass signal, twice the bandwidth equates to twice the highest frequency component.&lt;/li&gt;&#xA;&lt;li&gt;For a bandpass signal, twice the bandwidth is &lt;strong&gt;NOT&lt;/strong&gt; twice the highest frequency component.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;The spectrum of a sampled sinusoid approaches $\delta(f-f_0) + \delta(f+f_0)$&lt;/li&gt;&#xA;&lt;li&gt;The bandwidth of a $\delta$ $&amp;lt;&amp;lt;$ $2f_0$&lt;/li&gt;&#xA;&lt;li&gt;The sampling rate, $F_s$, is the inverse of the sampling period, $T_s$, which is 1 Hz in your case.&lt;/li&gt;&#xA;&lt;li&gt;Assuming $x(t) = \sin(\pi/4t) = \sin(w_0t) = \sin(2\pi f_0)$, then $w_0 = \pi/4$ rad/s and $f_0 = 1/8$ Hz&lt;/li&gt;&#xA;&lt;li&gt;So, $2f_0$ = 1/4 Hz&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2750/what-is-the-bandwidth-of-a-real-sinusoidal-tone-and-pulse/2751#2751&quot;&gt;Take a look at this similar question&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-02-17T01:08:41.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20567" PostTypeId="1" CreationDate="2015-02-16T07:22:13.073" Score="1" ViewCount="466" Body="&lt;p&gt;I was reading this thread: &lt;a href=&quot;https://dsp.stackexchange.com/questions/13147/how-to-get-instantaneous-magnitude-for-a-instantaneous-frequency-from-fft&quot;&gt;How to get Instantaneous Magnitude for a Instantaneous Frequency From FFT?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have basically the same question, but I'm curious about more detail about the Hann window kernel. ederwander said that once you know the frequency offset from the nearest bin then the instantaneous magnitude is a the Hann kernel of your offset times FFT length, times magnitude of the bin you're offset for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the Hann window kernel $W(k) = 0.5 (\operatorname{sinc}(k(M/N)) / (1 - (k(M/N))^2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just not sure why that kernel evaluated at offset*N gives the proper scaling factor for adjusting the magnitude. I couldn't even find any other information on the Hann kernel or how it is derived.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="13751" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2017-06-08T15:09:55.973" Title="Instantaneous magnitude" Tags="|frequency|fourier|window|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20568" PostTypeId="2" ParentId="2585" CreationDate="2015-02-16T09:09:05.203" Score="1" Body="&lt;p&gt;There is a section in &lt;a href=&quot;http://eprints.sztaki.hu/7986/&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;¹ that deals with eyelid contour approximation. It should help you out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;¹ Pernek, Ákos and Hajder, Levente (2014) Precise 3D Pose Estimation of Human Faces. In: VISAPP 2014. Proceedings of the 9th International Conference on Computer Vision Theory and Applications. Vol. 3. SciTePress, Lisszabon, pp. 618-625. ISBN 978-989-758-005-5 &lt;/p&gt;&#xA;" OwnerUserId="156" LastEditorUserId="13320" LastEditDate="2015-10-14T16:29:24.267" LastActivityDate="2015-10-14T16:29:24.267" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20569" PostTypeId="2" ParentId="20559" CreationDate="2015-02-16T11:22:15.287" Score="9" Body="&lt;p&gt;I agree with Peter K.'s answer, but I would like to add one important point: the two statements in the question are only true for &lt;em&gt;causal&lt;/em&gt; systems. The most general statement about stability for LTI systems described by rational transfer function is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An LTI system with a rational transfer function is stable if the region of convergence (ROC) of its transfer function includes the $j\omega$-axis (for continuous-time systems), or the unit circle $|z|=1$ (for discrete-time systems).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Since for causal systems the ROC is to the right of the pole with the largest magnitude (or outside the circle with radius equal to the largest pole radius in the $z$-plane), the above statement coincides with the statements in the question. However, non-causal systems can have poles in the right half-plane (or outside the unit circle of the $z$-plane) and still be stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take as an example the discrete-time transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{z^2}{(z-a)(z-b)},\quad a&amp;lt;1&amp;lt;b\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has one pole inside the unit circle and one pole outside the unit circle. You can't say that the corresponding system is unstable, because it depends on which system you mean. The transfer function (1) has 3 possible ROCs, corresponding to 3 different systems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$|z|&amp;gt;b$&lt;/li&gt;&#xA;&lt;li&gt;$|z|&amp;lt;a$&lt;/li&gt;&#xA;&lt;li&gt;$a&amp;lt;|z|&amp;lt;b$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The first one corresponds to a causal system which is unstable, because one of its poles is outside the unit circle (the ROC does not include the unit circle). The second one corresponds to an anti-causal system which is also unstable, because it has one pole inside the unit circle (again, the ROC does not include the unit circle). Finally, the third ROC includes the unit circle, i.e. it corresponds to a stable system. It is a non-causal system with a two-sided impulse response which decays exponentially as the time index $n$ goes to $\pm \infty$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2017-05-29T08:08:31.293" LastActivityDate="2017-05-29T08:08:31.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="20570" PostTypeId="1" CreationDate="2015-02-16T13:43:03.957" Score="7" ViewCount="5242" Body="&lt;p&gt;I have some microscopy data that is contaminated by a heartbeat artifact that I'd like to remove. The data consists of a large time series of images captured at ~60Hz.&lt;/p&gt;&#xA;&lt;p&gt;Here's a small example clip in GIF form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/tjl8Pjq.gif&quot; alt=&quot;gif&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have taken the average pixel intensity over time, and computed the periodogram using Welch's method:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B8bGz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see there is a sharp peak at ~1.8Hz which is likely to correspond to the heart rate (~108 beats/min). There are also a bunch of harmonic peaks at integer multiples of 1.8Hz. The exact heart rate is likely to vary from dataset to dataset, but I can specify a biologically plausible range as shown by the shaded area on the periodogram.&lt;/p&gt;&#xA;&lt;p&gt;What I'd like to be able to do is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Automatically detect the fundamental frequency corresponding to the heartbeat, and all of its harmonics&lt;/li&gt;&#xA;&lt;li&gt;Filter the data so as to remove the fundamental and all harmonics.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;At the moment I can solve point 1 very crudely by finding the largest peak in the periodogram, then multiplying it by &lt;span class=&quot;math-container&quot;&gt;$1, 2, ..., N$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the estimated number of harmonic peaks, but I'm sure that there must be a better method than this hack.&lt;/p&gt;&#xA;&lt;p&gt;Regarding point 2, I came across &lt;a href=&quot;https://dsp.stackexchange.com/q/11073/4606&quot;&gt;this question&lt;/a&gt; which mentions using a comb filter to remove a fundamental and all of its harmonics. Is this the best method to use? One important consideration is that I will have to apply the filter to each pixel timeseries in a large array, so a computationally efficient method would be highly desirable.&lt;/p&gt;&#xA;&lt;h2&gt;Example data&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've uploaded a 1D timeseries of example mean&#xA;pixel values in &lt;code&gt;.csv&lt;/code&gt; format &lt;a href=&quot;http://www.filedropper.com/meanf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I've also added a sample of 1000 frames (spatially decimated 2:1) in a compressed &lt;code&gt;.mat&lt;/code&gt; file &lt;a href=&quot;http://www.filedropper.com/first1000_1&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4606" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-06-18T19:53:33.443" Title="How can I automatically identify and remove a fundamental frequency and all of its harmonics?" Tags="|filters|frequency-spectrum|" AnswerCount="4" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="20571" PostTypeId="1" CreationDate="2015-02-16T14:34:58.030" Score="0" ViewCount="36" Body="&lt;p&gt;I have a pulse signal from which I sample N times of level changes (e.g. high-&gt;low).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At undefined times the pulses in the original signal are completely missing. This leads to wrong number of measured original samples (N+m, m: count of lost samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have implemented a naive detection algorithm:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;prev_time = x[n-1] - x[n-2]&#xA;act_time = x[n] - x[n-1]&#xA;&#xA;if (act_time / prev_time &amp;gt; 1.7)&#xA;   missing_sample_detected()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this the way to go?&lt;/li&gt;&#xA;&lt;li&gt;What alternative algorithms exists for detecting the position of missing samples?&lt;/li&gt;&#xA;&lt;li&gt;Can you suggest some literature on this topic? Atm i'm looking at &quot;nonuniform sampling&quot; but not sure if it's the right place to look for this problem&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13753" LastActivityDate="2015-02-16T14:34:58.030" Title="detecting position of lost samples" Tags="|sampling|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20573" PostTypeId="1" AcceptedAnswerId="20579" CreationDate="2015-02-16T16:26:30.697" Score="0" ViewCount="1675" Body="&lt;p&gt;I have some Bode plot (only in amplitude) as these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NWRbC.png&quot; alt=&quot;Example of two Bode plots&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I must to find their transfer functions, in particular the exact value of their zeros and poles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is clear that their are a low pass filter and a high pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a method for extract the numerical value of their transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you and bye,&lt;br&gt;&#xA;&lt;em&gt;Giacomo&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="13410" LastActivityDate="2015-02-17T13:16:06.953" Title="How to find transfer function looking bode plot" Tags="|signal-analysis|frequency-spectrum|transfer-function|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="20574" PostTypeId="2" ParentId="20501" CreationDate="2015-02-16T16:30:40.973" Score="2" Body="&lt;p&gt;You can use a line structure with 90 degree and a pre-defined thickness to erode the image. Then scan along the x-axis. In each y-axis line, it can be viewed as connection parts if there are more than 4 pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NWZcK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7092" LastActivityDate="2015-02-16T16:30:40.973" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="20575" PostTypeId="2" ParentId="20563" CreationDate="2015-02-16T21:02:30.507" Score="4" Body="&lt;p&gt;Eventhough there could be opposing theoretical answers to your question, practically speaking it may have a solution which depends on the lossy codec you are using. In that case what you eventually need is a practical knowledge of codec under concern that is used for the audio clip. However, considering the number of different audio codecs and the fact that there could be any number of nonstandard implementations to exist, your problem may not have a guarantied solution. It is because for every different lossy auido codec a different procedure (provided in theory it does exist) might be necessary to test whether a given piece of audio belongs to its output or not. And since for a nonstandard/proprietary/unknown audio codec, you will not have such a procedure at hand you may not even be able to test to see it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, mp3 (MPEG-I layer 3) standard defines an optional low-pass filter about 16khz, before encoding the raw pcm audio, hence if you find some signal acitivity above 16 khz inside an audio clip, then it is either not an mp3 file or the mp3 profile used to encode that clip, did not activate the lowpass prefilter (as it can be one of the many optional features of the codec) Note that in either case you cannot say that it is a raw file just because it's not an mp3 as it might come from another lossy codec... That is the problem...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if a lossy codec will include a distinctive feature as a mandatory (nonoptional) requirement of the standard, then you can check for that property to at least decide whether the given piece may belong to its output or not. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-02-18T09:31:44.460" LastActivityDate="2015-02-18T09:31:44.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20577" PostTypeId="1" AcceptedAnswerId="21612" CreationDate="2015-02-17T04:56:01.107" Score="-2" ViewCount="1536" Body="&lt;p&gt;let us consider following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;    clc;&#xA;    f1=10;&#xA;    f2=40;&#xA;    fs=100;&#xA;    ts=1/fs;&#xA;    t=0:ts:2.93;&#xA;    x=19*sin(2*pi*f1*t).*((t&amp;lt;0.25)+(t&amp;gt;1))+20*cos(2*pi*f2*t).*((t&amp;gt;=0.25)+(t&amp;lt;1))+1.5*randn(size(t));&#xA;    plot(t,x);&#xA;    axis tight&#xA;    title('Signal');&#xA;    xlabel('Time or Space');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;output of plot is given&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WzQzZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i would like to apply denosing method using wavelet method,generally i can compute continuous wavelet transform using cwt command,but how exactly procedures can be done for denosing signal and for reconstruction?please help me ,just i need few matlab codes for this.thanks you very much&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDITED :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have added to my code following command&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;scales=1:32;&#xA; wname = 'gaus4';&#xA; coefficients=cwt(x,scales,wname,'plot');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and got result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8PEFc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;know methods like soft and hard thresholding,there ar esteps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply wavelet transform to the noisy signal to produce the noisy wavelet coefficients to the level which we can properly distinguish the PD occurrence.&#xA; •Select appropriate threshold limit at each level and threshold method (hard or soft thresholding) to best remove the noises. •&#xA; Inverse wavelet transform of the thresholded wavelet coefficients to obtain a denoised signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in my case coefficients are two dimensional matrix,so how can i continue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have tried following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[XD,CXD,LXD] = wden(x,'sqtwolog','s', 'mln',4,'gaus4');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but there is error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;************************************************&#xA;ERROR ...&#xA;------------------------------------------------&#xA; wfilters ---&amp;gt; The wavelet gaus4 is not valid!&#xA;************************************************&#xA;&#xA;Error using wfilters (line 92)&#xA;Invalid argument value.&#xA;&#xA;Error in wavedec (line 32)&#xA;    [Lo_D,Hi_D] = wfilters(IN3,'d');&#xA;&#xA;Error in wden (line 72)&#xA;    [c,l] = wavedec(x,n,w);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;please help me to  finalize my work&lt;/p&gt;&#xA;" OwnerDisplayName="user350" LastEditorDisplayName="user350" LastEditDate="2015-02-17T05:10:10.830" LastActivityDate="2015-02-18T15:03:11.287" Title="denosing using soft thresholding or hard thresholding in matlab" Tags="|matlab|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20578" PostTypeId="2" ParentId="20570" CreationDate="2015-02-17T12:27:52.480" Score="-1" Body="&lt;pre&gt;&lt;code&gt;1. Automatically detect the fundamental frequency corresponding to the heartbeat, and all of its harmonics&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can take a local average across the DFT to find the heartbeats. If a certain point in this group is greater than &lt;code&gt;threshold&lt;/code&gt; and the greatest value in some range around it then it is a heartbeat or harmonic.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2. Filter the data so as to remove the fundamental and all harmonics.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could just use the previously located indices of heartbeats and stitch across them linearly. If that's not too crude for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the purpose of this part of the operation? Is this a medical analysis that requires the absence of the heartbeat to look for other (perhaps) hidden data? Or is this par just for aesthetics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine a comb filter will be somewhat uncontrollable. It will require careful adjustment of the feedback parameter. It could be viable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: You require a pitch detection algorithm? I wrote one of these a few years ago by ignoring the (close to) DC terms and finding the first local maximum. Then using the bins on either side I could use a quadratic interpolation and find the location of the maximum frequency more accurately than the resolution allowed by the frequencies of the bins themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be more accurate to utilise harmonics? It would probably just add an opportunity for errors. Though you can try getting a value for the fundamental with this method and finding the maximum at double, triple etc and then using a similar method as before:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;find local maximum 2. quadratic interpolate to find inter-bin value for frequency.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you veto the quadratic step and just take the local max you will not get an accurate frequency and moving up the harmonics would help.&lt;/p&gt;&#xA;" OwnerUserId="13486" LastEditorUserId="13486" LastEditDate="2015-02-18T13:38:22.913" LastActivityDate="2015-02-18T13:38:22.913" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20579" PostTypeId="2" ParentId="20573" CreationDate="2015-02-17T13:16:06.953" Score="2" Body="&lt;p&gt;locate the 3db point. (The point where the line before and after the curve would meet.) Take note of the magnitude and frequency &lt;code&gt;f&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the angular frequency at this point. &lt;code&gt;w = 2 * pi * f&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the graph is going up then it's a zero. &lt;code&gt;H(s) = w + s&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's going down then it's a pole. &lt;code&gt;H(s) = 1 / ( w + s )&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've got that. check the slope. If it's 20dB/decade then you're set. If it is 40, you'll need to square it, 60 and you'll cube it etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally you'll need to find the gain constant to make it correct at low frequency (or DC)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you're answers will look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H(s) = Gain * ( w + s )&#xA;H(s) = Gain / ( w + s )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13486" LastActivityDate="2015-02-17T13:16:06.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="20580" PostTypeId="2" ParentId="20567" CreationDate="2015-02-17T13:19:13.727" Score="1" Body="&lt;p&gt;The Hann Window Kernel is the FFT of the Hann Window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Offset is defined strangely, and unnecessarily. calculating InstFreqs and then dividing it by Sampling Frequency &lt;code&gt;Fs&lt;/code&gt; is just throwing away the work of attaining it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Bin Resolution = Fs / N&#xA;//InstFreqs will start at 0Hz and peak at Fs Hz (or half that??)&#xA;InstFreqs(i) = i * Fs / N&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in the referenced answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Offset = abs(InstFreqs(i) / (Fs/N) - i)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but if I'm correct that: &lt;code&gt;InstFreqs(i) = i * Fs / N&lt;/code&gt; then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Offset = abs(InstFreqs(i) / (Fs/N) - i) = abs( i - i ) = 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that line didn't make sense. Too bad there was no comment hinting at what it was supposed to mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;index is put into &lt;code&gt;Wk&lt;/code&gt; it must span the length of the Window, and not the length of the FFT. So let's start by changing that. &lt;code&gt;N * Offset&lt;/code&gt; will (likely) exceed the length of &lt;code&gt;M&lt;/code&gt; (window size)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;index = floor(abs(Offset) * N) + 1&#xA;InstMag = Mag(i) * Wk(index)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unless of course I misinterpreted what InstFreqs(i) is, which it seems I have.&lt;/p&gt;&#xA;" OwnerUserId="13486" LastEditorUserId="13486" LastEditDate="2015-02-18T13:50:57.997" LastActivityDate="2015-02-18T13:50:57.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21580" PostTypeId="1" CreationDate="2015-02-17T14:34:46.887" Score="3" ViewCount="1151" Body="&lt;p&gt;I use FFT to do filtering in frequency domain, but when I use big kernel I got shift on border, I think it's due to nature of cyclical convolution and I need to do more zero padding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how to calculate required padding size? should it be power of 2 in matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my matlab code:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tic&#xA;I= rgb2gray(imread('im.jpg'));&#xA;h = fspecial('gaussian',555);&#xA;F = fft2(double(I));&#xA;H = fft2(double(h), size(I,1), size(I,2));&#xA;F_fH = H.*F;&#xA;ffi = ifft2(F_fH);&#xA;toc&#xA;&#xA;figure, imshow(ffi,[])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is solution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%The zero-padding is just a way to make cyclical convolutions&#xA;%(which is what FFT-based convolutions are) act like linear convolutions.&#xA;%the convolution theorem yields the desired linear convolution result only &#xA;%if x(n) and h(n) are padded with zeros prior to the DFT such that their &#xA;%respective lengths are Nx+Nh-1, essentially zeroing out all circular artifacts.&#xA;&#xA;tic&#xA;%Frequency Domain Filtering &#xA;I= rgb2gray(imread('im.jpg'));&#xA;&#xA;ker_sz= 55;&#xA;h = fspecial('gaussian',ker_sz);&#xA;F = fft2(double(I), size(I,1)+ker_sz-1, size(I,2)+ker_sz-1);&#xA;H = fft2(double(h), size(I,1)+ker_sz-1, size(I,2)+ker_sz-1);&#xA;F_fH = F.*H;&#xA;ffi = ifft2(F_fH);&#xA;ffi= ffi((ker_sz-1)/2+1:(ker_sz-1)/2+size(I,1), (ker_sz-1)/2+1:(ker_sz-1)/2+size(I,2));&#xA;toc&#xA;%Display results&#xA;figure, imshow(ffi,[])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1781" LastEditorUserId="4346" LastEditDate="2017-01-05T04:28:34.927" LastActivityDate="2017-11-01T18:47:22.377" Title="Frequency Domain Filtering with big kernel size" Tags="|matlab|fft|convolution|ifft|fast-convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21583" PostTypeId="1" AcceptedAnswerId="21588" CreationDate="2015-02-17T14:55:33.557" Score="8" ViewCount="33073" Body="&lt;p&gt;We know that Fourier Transform of a signal exists if it is absolutely integrable &#xA;and it exists for periodic signals if impulse functions are allowed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we consider the fourier transform of $\text{rect}(t)$ , we get $\text{sinc}(f)$ in frequency domain. Which has got zero frequency component as $1$. But we all know, DC value of $\text{rect}(t)$ is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If a signal has got a zero frequency component  in frequency domain ,There must be DC value in time domain. But why there is no DC value in case of $\text{rect}(t)$ in time domain?&lt;/li&gt;&#xA;&lt;li&gt;What is the difference between DC component and zero frequency component?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11809" LastEditorUserId="1629" LastEditDate="2015-02-26T12:59:19.343" LastActivityDate="2023-11-07T20:35:29.287" Title="Difference between DC component and zero frequency component of signal" Tags="|fourier-transform|frequency-spectrum|" AnswerCount="5" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="21584" PostTypeId="2" ParentId="21583" CreationDate="2015-02-17T14:59:06.960" Score="9" Body="&lt;p&gt;There is no difference between DC component and zero frequency component.  They are two different names for the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your mistake is in thinking that sinc(t) does not have a non-zero mean.  sinc(t) does have a non-zero mean.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-02-17T14:59:06.960" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21587" PostTypeId="2" ParentId="21583" CreationDate="2015-02-17T15:54:00.343" Score="2" Body="&lt;p&gt;For periodic signals (or integrating a finite window, with the outsides unspecified), the DC value of a 50% duty cycle rect function depends on the sum of the top level and the base level.  It's only zero if the base is at a level inverse to the top.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-02-17T15:54:00.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21588" PostTypeId="2" ParentId="21583" CreationDate="2015-02-17T16:00:52.990" Score="11" Body="&lt;p&gt;Let's first have a look at the rectangular signal given as an example in your question. If you have a rectangle $s(t)$ in the time domain which is $1$ in the interval $[-T/2,T/2]$ and zero elsewhere, its Fourier transform is $S(f)=T\text{sinc}(Tf)$, where I use $\text{sinc}(x)=\sin(\pi x)/(\pi x)$. The value of its Fourier transform at $f=0$ equals $S(0)=T$, which corresponds to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}s(t)dt=T\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its &lt;em&gt;time average&lt;/em&gt; (or mean, or DC value) is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\bar{s}=\lim_{T_0\rightarrow\infty}\frac{1}{T_0}\int_{-T_0/2}^{T_0/2}s(t)dt=0\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is clear that any function for which the integral in (1) is finite, must have a DC-value of zero. The integral in (1) is the value of the Fourier transform of the signal at DC, and this is probably what confuses you. The DC value of a signal, and the value of its Fourier transform at DC are not the same. Any signal with a finite Fourier transform at DC has a DC value of zero, i.e. $\bar{s}=0$. Any signal with a non-zero DC value $\bar{s}\neq 0$ has a Dirac delta impulse component in its Fourier transform at DC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you write a signal as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=\bar{s}+\tilde{s}(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\bar{s}$ is the DC component as computed from (2), and, consequently, $\tilde{s}(t)$ has a DC component of zero, then its Fourier transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(f)=\bar{s}\delta(f)+\tilde{S}(f)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\tilde{S}(0)$ is finite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Also note that when the Fourier transform of a signal $s(t)$ has a certain non-zero value at a frequency $f_0$, then this does not entail that the signal has a pure sinusoidal component at that frequency. The same is true for DC. If the Fourier transform has a finite value at DC, the time-domain signal has no DC component, otherwise there would be a Dirac impulse at $f=0$, just as there would be a Dirac impulse at $f_0$ if the signal contained a sinusoid at the frequency.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-02-17T18:38:42.300" LastActivityDate="2015-02-17T18:38:42.300" CommentCount="21" ContentLicense="CC BY-SA 3.0" />
  <row Id="21589" PostTypeId="2" ParentId="21580" CreationDate="2015-02-17T16:21:05.853" Score="0" Body="&lt;p&gt;Depending on how the filter kernel is generated, you might want to try an fftshift on the filter kernel before the fft2() to center the peak around 0,0.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-02-17T16:21:05.853" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21590" PostTypeId="1" AcceptedAnswerId="21594" CreationDate="2015-02-17T16:46:59.400" Score="1" ViewCount="171" Body="&lt;p&gt;Should I apply some window before FFT if I want to find 5 frequencies in signal? Signal is pure 5 sinusoids + some noise generated during recording on analog cable.&lt;/p&gt;&#xA;" OwnerUserId="1708" LastEditorUserId="1708" LastEditDate="2019-06-18T14:14:23.877" LastActivityDate="2019-06-18T14:14:23.877" Title="Window function for signal with 3-5 sine waves inside" Tags="|fft|window-functions|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="21591" PostTypeId="1" CreationDate="2015-02-17T17:30:00.627" Score="1" ViewCount="162" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Shepp%E2%80%93Logan_phantom&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shepp-Logan phantom&lt;/a&gt; is a standard test image used in reconstruction algorithms as well as image denoising.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QfLJI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does an equivalent image sequence exist for testing video denoising algorithms? I know that there are plenty of &quot;natural&quot; videos out there (one of two table tennis players springs to mind), but I'm looking for a more artificial test sequence.&lt;/p&gt;&#xA;" OwnerUserId="8761" LastActivityDate="2015-02-17T17:30:00.627" Title="Equivalent of the Shepp-Logan phantom for video denoising" Tags="|image-processing|video-processing|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21592" PostTypeId="2" ParentId="20567" CreationDate="2015-02-17T19:54:07.450" Score="1" Body="&lt;p&gt;@Andy to extract the instantaneous Frequency I'm computing the phase difference ∆φ[i] of successive phase spectra using Flanagan and Golden[1]:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;q[i]&lt;/code&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ q[i] = \frac{N}{2πH} princarg  \left[φ_l[i] − φ_{l−1}[i] − \frac {2πH}{N}i \right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Princarg&lt;/code&gt; maps the phase in a range of &lt;code&gt;±pi&lt;/code&gt; and the bin offset &lt;code&gt;q&lt;/code&gt; denotes the deviation of the partial’s Instantaneous Frequency from the bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Instantaneous Frequency can be determined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ InstFreqs[i] = (i + q[i]) \left(\frac{Fs}{N}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you observe:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;abs(InstFreqs(i) / (Fs/N) - i) == abs(q[i])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the hann window kernel definition you can read the paper from &lt;em&gt;A. Kivinukk and G. Tamberg&lt;/em&gt; &lt;a href=&quot;http://www.stsip.org/vol02/no3/vol02no3pp235-258.html&quot; rel=&quot;nofollow&quot;&gt;[2]&lt;/a&gt; and the page 76 from book &lt;em&gt;New Perspectives on Approximation and Sampling Theory.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$cos^2\frac{ πu}{2} == \frac12(1 + cosπu) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hann Kernel defined by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2}\frac{sinc (t)}{1-t^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For no zero padd the correction does not arrive 3dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] J. L. Flanagan and R. M. Golden, “Phase vocoder,” Bell Systems Technical Journal, vol. 45, pp. 1493–1509, 1966.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.stsip.org/vol02/no3/vol02no3pp235-258.html&quot; rel=&quot;nofollow&quot;&gt;2&lt;/a&gt; A. Kivinukk and G. Tamberg, On sampling operators defined by the Hann window and&#xA;some of their extensions Sampling Theory in Signal and Image Processing, 2, 235–258, 2003&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2015-02-17T20:01:37.937" LastActivityDate="2015-02-17T20:01:37.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21593" PostTypeId="2" ParentId="20570" CreationDate="2015-02-17T20:51:01.220" Score="0" Body="&lt;p&gt;You're looking for &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=6&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0CEkQFjAF&amp;amp;url=http%3A%2F%2Fwww.researchgate.net%2Fprofile%2FTetsuya_Shimamura%2Fpublication%2F229896949_Improved_spectral_subtraction_utilizing_iterative_processing%2Flinks%2F00b7d5199c93ea71ce000000.pdf&amp;amp;ei=GafjVO-DIc3voATJqIGwDg&amp;amp;usg=AFQjCNFzv9juQ6Pv4MZjVq3JgKeM-8HnnQ&amp;amp;sig2=n6Sjbbd1vxlJmo1bn9R6Ow&quot; rel=&quot;nofollow&quot;&gt;Iterative Spectral Subtraction&lt;/a&gt;. Here is some general &lt;a href=&quot;https://books.google.com/books?id=YSPT1LJqTbIC&amp;amp;pg=PA104&amp;amp;lpg=PA104&amp;amp;dq=remove%20fundamental%20frequency%20harmonics%20audio&amp;amp;source=bl&amp;amp;ots=oBc7xqwoXG&amp;amp;sig=gfwLuPNm71X5yKD0Ryq_fxxqn70&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=RKbjVICQLda4ogSr2oHgBg&amp;amp;ved=0CEkQ6AEwBzgK#v=onepage&amp;amp;q=remove%20fundamental%20frequency%20harmonics%20audio&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;info from a Content Analysis&lt;/a&gt; book by Alexander Lerch.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-02-17T20:51:01.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21594" PostTypeId="2" ParentId="21590" CreationDate="2015-02-17T21:36:47.940" Score="1" Body="&lt;p&gt;Windowing, in the context of DFT, is used to reduce the side-lobes or &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_leakage&quot; rel=&quot;nofollow&quot;&gt;spectral leakage&lt;/a&gt; which happens because you work with finite length discrete signals.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if is sum of sinusoids that are periodic in the observation time (that means that each sinusoid completes an integer amount of periods), then the DFT will be a series of delta function with no side-lobes.&lt;br&gt;&#xA;However, in a more realistic scenario, the DFT of your signal should be effected by the spectral leakage. In that case, it is possible that some of the side-lobes will have greater magnitude than some of the sinusoids and if you try to select the 5 frequencies with the greatest magnitude, you will get the wrong results.&lt;br&gt;&#xA;To sum it up simply: Yes, you should use some kind of &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;windowing&lt;/a&gt;. It doesn't actually meter which window function you use. As suggested, Hamming window is a good choice.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-02-17T21:36:47.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21595" PostTypeId="2" ParentId="7857" CreationDate="2015-02-17T22:33:53.147" Score="1" Body="&lt;p&gt;If SINAD can be determined from only expected value and variance then it is possible to determine how SINAD transforms. Variance $\sigma^2$ is preserved whereas expected value $\mu$ grows as $ \sqrt{N} $ where N is the sampling set size. Noise + distorsion is assumed to have variance $\sigma^2$.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus the SINAD value would then be determined to become&#xA;$$&#xA;{\mathrm {SINAD}}={\frac {P_{{\mathrm {signal}}}+P_{{\mathrm {noise}}}+P_{{\mathrm {distortion}}}}{P_{{\mathrm {noise}}}+P_{{\mathrm {distortion}}}}} = &#xA;{\frac {N |\mu|^2+\sigma^2}{\sigma^2}} = N \cdot SNR + 1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can explain this in more detail if needed.&lt;/p&gt;&#xA;" OwnerUserId="11657" LastActivityDate="2015-02-17T22:33:53.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21596" PostTypeId="1" AcceptedAnswerId="21603" CreationDate="2015-02-17T23:47:06.493" Score="1" ViewCount="392" Body="&lt;p&gt;I'm trying to plot 2D gaussian function using &quot;imshow&quot; in MATLAB. However I could not see any white points in image. I tried to change sampling values and limits of x and y values. In addition to this, I tried z.^2 and higher orders but nothing changed.Thank you for any help.What can be the problem? My code is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sigma = 10;&#xA;[X,Y] = meshgrid(-40:0.5:40,-40:0.5:40);&#xA;z     = (1/(2*pi*(sigma^2)))*exp(-((X.^2)+(Y.^2))/(2*(sigma^2)));&#xA;figure&#xA;surf(X,Y,z);%shading interp&#xA;figure&#xA;imshow(z);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jQ6Ql.jpg&quot; alt=&quot;Using &amp;quot;surf&amp;quot; command&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IZBEl.jpg&quot; alt=&quot;using &amp;quot;imshow&amp;quot; command&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13705" LastActivityDate="2015-02-21T19:00:42.830" Title="imshow command for Gaussian function" Tags="|matlab|image-processing|gaussian|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21597" PostTypeId="1" CreationDate="2015-02-17T23:47:14.847" Score="1" ViewCount="2436" Body="&lt;p&gt;in regular discrete-time (1 dimensional) kalman filter, it is assumed that we have white gaussian noise affecting the transitions and the observations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t+1) = Ax + w$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = Cx(t) + v$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;assuming $w$ follows Gaussian(0, $\sigma_1$) and $v$ follows Gaussian(0, $\sigma_2$) distributions. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;will the standard kalman filter not work or not be optimal if the gaussian noise variables are time varying, meaning $w$ and $v$ become $w(t)$ and $v(t)$ and somehow change with time, becoming systematically bigger or smaller?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;related: the kalman filter generally has the behavior that its variance is decreasing with time. will that be true even if $w(t)$ and $v(t)$ are are time-varying even if they are assumed not to be? will the kalman filter's variance still get smaller even if the data are sampled from time-varying noise process?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11021" LastEditorUserId="11021" LastEditDate="2015-02-18T00:19:59.643" LastActivityDate="2015-04-19T03:30:20.280" Title="kalman filter with time-varying noise?" Tags="|filters|discrete-signals|kalman-filters|linear-systems|state-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21598" PostTypeId="1" CreationDate="2015-02-17T23:52:19.547" Score="12" ViewCount="15474" Body="&lt;p&gt;this thread asks when a discrete time Kalman filter is better/different from a simple moving average of the observations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://math.stackexchange.com/questions/173901/why-use-a-kalman-filter-instead-of-keeping-a-running-average&quot;&gt;Why use a Kalman filter instead of keeping a running average&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there's no definitive answer. can someone give a definitive example where the kalman filter, ideally in simple 1D case, does something different (and better) than keeping a moving average, and state the conditions when the kalman filter would reduce to a simple moving average?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one thought is that the kalman filter would not weigh all the data points equally because its variance is initially smaller and gets better with time. but it sounds like that would only matter close to initial observations and that once the variance converged, the kalman filter would weigh each observation equally just like a moving average, so don't see when the two are different and why/when the filter would do better.&lt;/p&gt;&#xA;" OwnerUserId="11021" LastEditorUserId="128" LastEditDate="2019-10-19T08:24:59.543" LastActivityDate="2019-10-19T08:24:59.543" Title="When Is a Kalman Filter Different from a Moving Average?" Tags="|filters|signal-analysis|kalman-filters|state-space|bayesian-estimation|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="21599" PostTypeId="2" ParentId="16903" CreationDate="2015-02-18T01:39:33.873" Score="1" Body="&lt;p&gt;The easiest way to do this is to keep track of the parameters a and h from detection. How did you pick out a car from the scene? a simplified method would be: background subtraction, followed by clustering, data association, find centroid of clusters =&amp;gt; x,y. Also store the bounding box of the cluster, easiest way to keep an accurate a,h.&lt;/p&gt;&#xA;&lt;p&gt;But I'm guessing you want to start with initial conditions a0,h0 and based on x,y,u,v update a,h. The problem is that a,h cannot be completely known using only x,y,u,v,T. You also need information about the imaging system or the environment.&lt;/p&gt;&#xA;&lt;p&gt;Assuming we use a Cartesian coordinate system x=horizontal, and y=vertical&lt;/p&gt;&#xA;&lt;p&gt;there are a few different ways to view this problem. If you are tracking cars from a bird's eye view (think google maps for instance)&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zTht1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;then for all cases&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a = a'&lt;/p&gt;&#xA;&lt;p&gt;h = h'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;realistically there can be slight variations. for instance if the car is facing this way __ vs this way | the bounding box would change, but given a set of x,y,u,v we have no way of knowing the cars orientation. Concretely, if the car is headed in the same direction (red and green) the bounding box shouldn't change. If the car changes heading (blue car) the bounding box changes drastically,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;h = width' and width = h'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;recall&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a = w /h&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;so&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;h = a'*h'&lt;/p&gt;&#xA;&lt;p&gt;a = width / h = h' / (a'*h')&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;unfortunately, we have no way of knowing with absolute certainty that the car changed directions. We can make up some kind though. Since cars are &lt;a href=&quot;http://www.robotplatform.com/knowledge/Classification_of_Robots/Holonomic_and_Non-Holonomic_drive.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;non holonomic vehicles&lt;/a&gt; ( a car can move forwards and backwards instantaneously but not left and right instantaneously) we can come up with some criteria to figure out a cars direction. For the red car we see |v| &amp;gt; |u| and |v'| &amp;gt; |u'|, or for the green car |u| &amp;gt; |v|  and |u'| &amp;gt; |v'| but for the blue car |v| &lt;strong&gt;&amp;gt;&lt;/strong&gt; |u| and  |v| &lt;strong&gt;&amp;lt;&lt;/strong&gt; |u| in this case we could guess that the car changed directions and the bounding box needs to be rotated using our second set of equations. However, if u~=v all bet's are off and we can't safely say which direction the car is pointing.&lt;/p&gt;&#xA;&lt;p&gt;More complicated still is an image with perspective. For the following examples please note the origins in my picture are wrong, we should use the standard image convention where (0,0) is the upper left corner and (m,n) is the lower right corner where m=number of rows and n = number of columns. For this example I will use a image with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Vanishing_point&quot; rel=&quot;nofollow noreferrer&quot;&gt;single vanishing point&lt;/a&gt; outside of the image.  We can split this into a few cases&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;CASE 1: car is moves horizontally along x&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QL7fO.png&quot; alt=&quot;PIC1&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;assuming the field of view is small we get&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a = a'&lt;/p&gt;&#xA;&lt;p&gt;h = h'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;why? the height will only change as an object gets closer or further from us, since it is moving only along x, v=0 so our height shouldn't change. our width also shouldn't change (again the viewing angle must be small) because if we have a car traveling at velocity u, all points on the car move the x direction with the same u. More concretely, if delta_x = (x(T) - x(T-1)), delta_x should be the same for all points on the car. If the front tire moves delta_x (orange in pic), so should the back tire(light blue in pic), otherwise the car isn't moving as one solid body. IF both points moved the same delta_x, they should still be in the same position relative to one another (purple line in pic) so that means width doesn't change. we already said h doesn't change if the car moves only along x, and not y, so a shouldn't change either&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;CASE 2: car moves vertically, along y&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9aMlQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;this is a bit more difficult. As far as I know there is no way to determine this without performing some kind of offline calibration. There are a few issues, first is that size alone can't determine distance in an image. Think of an image with a person, and mountains in the background. The person looks much larger than the mountains, but we know this isn't true, however, a computer would have more difficulty figuring this out.&#xA;still using the single vanishing point outside of the image. We need to know something about the image, lets say we know the street is 6 meters  wide (call this Xstreet). Now we measure the street at various y locations. at the top of the image Xstreet0 = 100 pixels. At the bottom Xstreet1 = 180 pixels. Lets also say that Xstreet0 and Xstreet1 are 100 pixels apart vertically. Even though the width of the street appears to be changing we know in reality the street is really 6m at both places. So we come up with some kind of equation to mirror our perspective. Remember this equation&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;y = Mx + b&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;lets use that, so to find our slope (we aren't really interested in b), which models our perspective&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;M = rise / run = (y1,y0) / (x1 - x0) = 100 / 80 = 1.25&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;that means for every 1 pixel we move downwards in the y direction our x pixel gets 1.25 times bigger! With this knowledge we can now do some modeling&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;h ~= h' (this is really difficult to determine, it gets into perspective and turns very messy, since we said there is only 1 vanishing point outside of the image we can  say this doens't change much)&lt;/p&gt;&#xA;&lt;p&gt;width = ((v*T)/M) + width'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;looking closer we see that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;v*T = delta_y&lt;/p&gt;&#xA;&lt;p&gt;delta_y = M * delta_x ==&amp;gt; delta_x = delta_y / M ==&amp;gt; delta_x = (v*T)/M&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;so the term&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(v*T)/M&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;gives us the change in X (delta_x), we simply add this to the old X to get our new X. but we aren't done yet &lt;strong&gt;a = width/height&lt;/strong&gt; not simply width! so lets keep going&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;h = h' + delta_h&lt;/p&gt;&#xA;&lt;p&gt;width = width' + delta_width&lt;/p&gt;&#xA;&lt;p&gt;a = width / height = (width' + delta_width) / (h' + delta_h')&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;recall h ~= h' so delta_h = 0&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a = (width' + delta_width) / h' = width'/ h' + delta_width / h' = a' + delta_width / h'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;well we just calculated delta_width == delta_x, we know h' so we have our final equation&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a = a' + (v*T)/(M *h')&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;where M was our slope (perspective compensation) we calculated offline.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;CASE 3: a movement in x,y&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;is really just a movement in y, we have already said any change in x doesn't change the parameters at all. only a change in y&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;h = h'&lt;/p&gt;&#xA;&lt;p&gt;a = a' + (v*T)/(M *h')&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This problem gets a little more complicated when the vanishing line is actually in the scene. In this case, we have to keep track of if we are below or above the vanishing point and signs become very important.&lt;/p&gt;&#xA;&lt;p&gt;This method also assumes that the objects we are tracking are in a constant z-plane. If our scene has a 3d axis, in our example, the street would be at one z value and cars travel in the x,y plane. We assume the cars don't levitate up and down, or our assumptions about y movements become invalid.&lt;/p&gt;&#xA;&lt;p&gt;I mentioned it briefly, but this also won't work with wide FOV (field of view)cameras because our assumption that moving along x doesn't change width or height becomes invalid. If this doesn't make sense, just watch some fisheye video clips, like &lt;a href=&quot;http://www.youtube.com/watch?v=h_Nns3odCcI&amp;amp;t=0m50s&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; video around 0 minutes 50 seconds&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;conclusion&lt;/strong&gt;&#xA;Overall, my methods are highly approximate, and only work under certain conditions (assuming a camera doesn't move often, they are fairly reasonable restrictions). The absolute best way to keep an accurate a,h would be to save the bounding box from the original car classification steps. Hope this helps someone in the future&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-02-18T01:39:33.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21600" PostTypeId="2" ParentId="21597" CreationDate="2015-02-18T02:21:02.627" Score="2" Body="&lt;p&gt;1) It depends on what you call the standard Kalman filter -- I will call the equations in the picture below to be the &quot;standard Kalman filter&quot;. You can easily derive an expression for the Kalman filter where the covariance matrices of the noise processes are time varying in terms of the covariances of the noise processes (and cross-covariance of the noise processes). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moon and Stirling's Mathematical Methods and Algorithms for Signal Processing derives the Kalman filter under $w(t)$ has mean $0$, covariance $E[w(t) w(s)^T] = Q_t \delta_{ts}$, $v(t)$ is also mean zero with covariance $E[v(t) v(s)^T] = R_t \delta_{ts}$ and $E[w(t) v(s)^T] = M_t \delta_{ts}$ (if you assume $M(t) = 0$, the equations simplify considerably). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the system model &#xA;$ x_{t+1} = A_t x_t + w_t , y_t = C_t x_t + v_t$  [$w_t = w(t), v_t=v(t)$] with $M_t = 0$, the following are the resultant Kalman equations (from Moon &amp;amp; Stirling) to get the predicted state estimate (13.45) and filtered state estimate (13.47):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cb5VN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These equations can be shown to be optimal using either a Bayesian approach (MAP with Gaussianity assumptions) or Linear MMSE approach for the given system model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Convergence of the Kalman filter is a bit of an annoying subject. You can read &lt;a href=&quot;http://robotics.eecs.berkeley.edu/~wlr/226F06/226a-ch11.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;these notes&lt;/a&gt; for more details or check the book Stochastic Systems: Estimation, Identification and Adaptive Control by Pravin Variya and P.R. Kumar or one of the other texts on stochastic systems. Essentially, if the systems are controllable and reachable and yada yada, you can get some statements on convergence properties. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2015-02-18T02:27:33.250" LastActivityDate="2015-02-18T02:27:33.250" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21601" PostTypeId="2" ParentId="21598" CreationDate="2015-02-18T03:34:20.327" Score="5" Body="&lt;p&gt;as the first answer (with the most votes) says, the kalman filter is better in &lt;em&gt;Any case when signal is changing.&lt;/em&gt;&#xA;Notice the problem statement &lt;em&gt;These use the algorithm to estimate some constant voltage. How could using a Kalman filter for this be better than just keeping a running average? Are these examples just oversimplified use cases of the filter?&lt;/em&gt; using a kalman filter to estimate a constant voltage is definitely, overkill. In that particular problem it is better to use the running average, which we know is the best estimator for Gaussian distributions. In this example the measured voltage is the actual voltage V but with some noise typically modeled as 0 mean Gaussian (white noise). so that our measurements are Gaussian with mean=V, and sigma=sigma noise.&lt;/p&gt;&#xA;&lt;p&gt;The kalman filter is better suited for estimating things that change over time. The most tangible example is tracking moving objects. Let's imagine throwing a ball, we know it will make a parabolic arc, but what will our estimators show?&lt;/p&gt;&#xA;&lt;p&gt;A Kalman filter will be very close to the actual trajectory because it says the most recent measurement is more important than the older ones (when the covariance is low that is). The running average takes all measurements equally&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Au1SJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;blue-ball trajectory, red-running average&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;(sorry no kalman if i have time i'll throw it in there if i have time, but it would me much closer to the blue line assuming you modeled the system well)&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FHYDS.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;strong&gt;equations courtesy of wikipedia&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The kalman filter on the other hand says, if our convariance and residual were small (meaning we had a good estimate), then we are going to stick with out previous estimate and tweak it a tiny bit based on the residual(or our estimation error). Now since our xhat k|k is very close to the actual state, when we make out next update, we will use a system state that closely matches the actual state.&lt;/p&gt;&#xA;&lt;p&gt;At x=30, the running average says, the initial condition y(0) is just as important as y(29), thats that, and you get a huge error. The kalman filter accounted for this. It said since our error last time was huge, lets make a drastic change to our estimate (our xhat) so when we use it for the next update, it will be closer to what is actually happening&lt;/p&gt;&#xA;&lt;p&gt;I hope that makes some sense&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;-------------------------EDIT--------------------------------&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I just noticed your question asks about a moving average vs kalman. I answered running avg vs kalman (that is the topic of the link you provided)&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Afq7A.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Just to add a little more info specifically to the moving(windowed) average. The moving average is a better estimator of changing values. Since it only takes into account more recent samples. Unfortunately, it has a lag associated with it, especially around changing derivatives (Just look near t=30, where the derivative is going from positive to negative). This is because the average is slow to see fluctuation. Which is typically why we use it, to remove fluctuation (noise). The window size also plays a role. A smaller window is usually closer to the measured values, which makes sense and sounds good, right? The downside of this is if you have noisy measurements, a small window means more noise shows up more in the output. Let's look at the other question again&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;measurements with mean = .5, sigma = .1;&lt;/p&gt;&#xA;&lt;p&gt;z = [0.3708435, 0.4985331, 0.4652121,...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;the average of the first 3 samples is 0.4448629 not exactly close to the .5 expected value. This again shows, that with the smaller window, noise has a more profound effect on the output.&lt;/p&gt;&#xA;&lt;p&gt;So then logically our next step is to take larger windows, to improve our noise immunity. Well, turns out larger windows are even slower to reflect actual changes (again look at t=30 in my graph) and the most extreme case of windowing is basically the running average (which we already know is bad for changing data)&lt;/p&gt;&#xA;&lt;p&gt;Now back to the magical kalman filter. If you think about it it similar to a 2 sample windowed average (similar not the same). Look at X k|k in the update step, it takes the previous value, and adds to it a weighted version of the current sample. You might think, well what about noise? Why isn't it susceptible to the same problem as windowed average with a small sampling size? Because the kalman filter takes into account the uncertainty of each measurement. The weighting value K (kalman gain) can be though of as a ratio between the covariance(uncertainty) of your estimate and the covariance (uncertainty) of the current estimate (actually its the residual, but it's easier to think of it this way). So if the latest measurement has lots of uncertainty K decreases, and thus the most recent sample plays a smaller roll. If the latest measurement has less uncertainty than the prediction, k increases, and now the new information plays a bigger roll in the next estimate. So even with a small sample size, the kalman filter is still blocking out a lot of the noise.&lt;/p&gt;&#xA;&lt;p&gt;anyway, I hope that answers the &amp;quot;windowed avg vs kalman&amp;quot; question now&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-02-18T17:53:29.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21602" PostTypeId="2" ParentId="21596" CreationDate="2015-02-18T08:24:57.607" Score="1" Body="&lt;p&gt;Look at the scale on your 3d plot. The z axis (or intensity value when plotted as an image) has an order of magnitude 10^-3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imshow on any double (decimal) number in matlab automatically scales the image as 0=black 1= white. With that in mind you plot is essentially a matrix of zeros, or blacks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can solve this in two ways&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.Using imagesc, scales an image to take up the full dynamic range&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imshow(imagesc(z)); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2.Emulate imagesc&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Max_val= max(max(z));&#xA;Min_val=min(min(z));&#xA;scaledz = 1/(Max_val - Min_val) * (z - Min_val); %this gets our numbers between 0-1&#xA;Imshow(scaledz)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;code isn't tested&lt;/strong&gt; I just wrote it from memory on my cell phone. It may not work exactly but it should be pretty close&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-02-18T17:56:25.160" LastActivityDate="2015-02-18T17:56:25.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21603" PostTypeId="2" ParentId="21596" CreationDate="2015-02-18T08:46:01.000" Score="3" Body="&lt;p&gt;Why not to simply use either:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imagesc(z);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h=pcolor(z)&#xA;set(h, 'LineStyle','None')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although if you really want to use &lt;code&gt;imshow&lt;/code&gt; then provide a set of extra parameters to scale the plotting range. It's more computational and memory efficient. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imshow(z, [min(min(z)) max(max(z))])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-02-21T19:00:42.830" LastActivityDate="2015-02-21T19:00:42.830" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21605" PostTypeId="1" AcceptedAnswerId="21616" CreationDate="2015-02-18T11:50:42.800" Score="-1" ViewCount="4643" Body="&lt;p&gt;I have to make a project college. I have to come with some application of signals that I can implement in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to separate two voices from an audio signal, say a .waw file ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, using techniques from a first course in digital signal processing (DFT, Spectogram, Cepstrum).&lt;/p&gt;&#xA;" OwnerUserId="13403" LastActivityDate="2015-02-18T21:07:32.513" Title="Separate two voices from a speech signal" Tags="|speech|project-ideas|" AnswerCount="1" CommentCount="4" ClosedDate="2015-02-20T08:31:43.720" ContentLicense="CC BY-SA 3.0" />
  <row Id="21606" PostTypeId="1" AcceptedAnswerId="21611" CreationDate="2015-02-18T12:36:58.213" Score="-3" ViewCount="230" Body="&lt;p&gt;Is there a simple technique to watermark .wav audio files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that a third person that receives them could check the authencity of the file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to come with ideas for a school project. So I should mainly use techniques from a first course in digital signal processing (DFT, Spectogram, Cepstrum).&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="13403" LastEditDate="2015-02-18T12:42:22.617" LastActivityDate="2015-02-18T14:48:24.823" Title="Watermark audio files" Tags="|speech|project-ideas|" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21607" PostTypeId="2" ParentId="21598" CreationDate="2015-02-18T12:39:47.503" Score="3" Body="&lt;p&gt;I won't add any equations, I will just add some intuition.&lt;br&gt;&#xA;I will also limit my self for Additive Gaussian White Noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in that case the Kalman filter can written as a Least Squares problem to solve.&lt;br&gt;&#xA;I'd say even more, the Kalman Filter is linear, if you have the samples up to certain time $ T $, you can write the Kalman filter as weighted sum of all previous and the current samples.&#xA;Moreover, if we assume there is no process noise, it collides with the Least Squares regression filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's make it so special?&#xA;3 things are making it special:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Its Form - as Recursive filter it is easy to implement in limited computing resources.&lt;/li&gt;&#xA;&lt;li&gt;The Process Noise Concept - Namely, it doesn't assume the model is known perfectly, this makes it adaptive filter which corrects its weighting each iteration (For all samples!!!).&lt;/li&gt;&#xA;&lt;li&gt;Non Stationary Noise - The ability to deal with non stationary process, namely process which its noise (Both the process and measurement) changes over time.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2015-02-18T15:14:25.890" LastActivityDate="2015-02-18T15:14:25.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21608" PostTypeId="2" ParentId="21598" CreationDate="2015-02-18T13:11:06.870" Score="6" Body="&lt;p&gt;Another take:  The Kalman Filter lets you add more information about how the system you're filtering works. In other words, you can use a signal model to improve the output of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure, a moving average filter can give very good results when you're expecting a close-to-constant output.  But as soon as the signal you're modelling is dynamic (think speech or position measurements), then the simple moving average filter will not change quickly enough (or at all) compared with what the Kalman Filter will do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Kalman filter uses the signal model, which captures your knowledge of how the signal changes, to improve its output in terms of the variance from &quot;truth&quot;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-02-18T13:11:06.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21610" PostTypeId="2" ParentId="20570" CreationDate="2015-02-18T14:42:40.610" Score="1" Body="&lt;p&gt;Your method isn't that bad for a first attempt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the following method tends to work better:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Search for local maxima&lt;/li&gt;&#xA;&lt;li&gt;Check for maxima that are close (2 or 3 bin spacing) and merge them&lt;/li&gt;&#xA;&lt;li&gt;Create a few hypotheses about the fundamental frequency. You currently assume the highest peak is the fundamental frequency, which is one hypothesis. You should also check for the possibility that the highest peak is the first harmonic, i.e. that there's a smaller peak at half the frequency of the main peak. You may also have other cases to consider, using your knowledge of the problem at hand (Interference? Irregular heartbeat?).&lt;/li&gt;&#xA;&lt;li&gt;Assuming each of those hypothesis, find the ground frequency by fitting parabola to &lt;em&gt;each&lt;/em&gt; harmonic peak. Each peak will produce a slightly different estimate due to noise, but these errors are uncorrelated and average out. One of the hypotheses will lead to much better fits, pick the ground frequency predicted by this hypothesis.&lt;/li&gt;&#xA;&lt;li&gt;Using the ground frequency you found in step 4 as a given, refit the parabola around each peak to estimate the height of the peak. Note that the peaks probably fall between two bins.&lt;/li&gt;&#xA;&lt;li&gt;You now have the location and strength of the fundamental and its harmonics, but not the phase. It's probably easiest to find the phase of the fundamental, subtract that, find the phase of the first harmonic, etc.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The core reason that this works better is step 4. Any wrong hypothesis for a ground frequency will fail horribly as you're trying to fit peaks around the location of predicted harmonics. Say you've got a peak at 2 Hz. This could be the ground frequency or a first harmonic. When you test the &quot;first harmonic hypothesis&quot;, i.e. whether the ground frequency is actually 1 Hz, you fit parabola's to the data around 1,2,3,4,5 ... Hz. If that hypothesis is wrong, you get garbage around 1,3,5 Hz. If it's right, you might find peaks near 1.1 Hz, 2.2, 3.3, 4.4 and 5.6 - which suggests that the actual ground frequency is 1.12 Hz.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2015-02-18T14:42:40.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21611" PostTypeId="2" ParentId="21606" CreationDate="2015-02-18T14:48:24.823" Score="3" Body="&lt;p&gt;Audio watermarking is a technique that relies on inaudible cues. Humans can't really hear phase differences in low tones, if only because it's often delivered via a single bass speaker (i.e. because the HiFi setup physically eliminates the difference). This allows you to stuff information in the phases of the low-frequency parts of the left and right channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exact details I'll leave to you - it's a school project after all - but you will be able to use the (I)DFT to access this phase information.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2015-02-18T14:48:24.823" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21612" PostTypeId="2" ParentId="20577" CreationDate="2015-02-18T15:03:11.287" Score="1" Body="&lt;p&gt;The &lt;code&gt;wden&lt;/code&gt; function should do exactly what you need: 1-D de-noising. The &lt;a href=&quot;http://mathworks.com/help/wavelet/ref/wden.html&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; states that the wavelet family must be &lt;em&gt;orthogonal&lt;/em&gt;. The family you specified - Gaussian wavelets - are not orthogonal, thus it is not possible to use it for wavelet denoising. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use any of the following wavelets:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Haar&lt;/li&gt;&#xA;&lt;li&gt;Daubechies&lt;/li&gt;&#xA;&lt;li&gt;Symlets&lt;/li&gt;&#xA;&lt;li&gt;Discrete Meyer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You'll find some information on the different wavelet families in the MATLAB help page on &lt;a href=&quot;http://mathworks.com/help/wavelet/ref/waveletfamilies.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;waveletfamilies&lt;/code&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="12102" LastActivityDate="2015-02-18T15:03:11.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21613" PostTypeId="2" ParentId="20438" CreationDate="2015-02-18T15:18:25.970" Score="1" Body="&lt;p&gt;It has been some time since I've looked at Chaos theory. Since Chaos theory is mainly examining non-linear equations, the idea of BIBO isn't sufficient. One of the ways to characterize a non-linaer system is via &lt;a href=&quot;http://en.wikipedia.org/wiki/Lyapunov_exponent&quot; rel=&quot;nofollow&quot;&gt;Lyapunov exponents&lt;/a&gt;. It is a way of characterizing the predictability of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is definitely not the usual thing that's covered in DSP, since DSP is mostly concerned with Linear Systems or systems that have been linearized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another version of stability comes from Compressive Sensing (CS) or Sparse Reconstruction. In CS you are looking at solving $\mathbf{Ax}=\mathbf{b}$ where there are more equations than unknowns but we want an vector $\mathbf{x}$ to be sparse i.e. only have a few non-zero elements (the other elements should be zero or small in comparison to the few large elements). Note that because the system is under-determined there are multiple solutions for $\mathbf{Ax}=\mathbf{b}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A concern in CS is the stability of the answer i.e. if we recover a sparse vector we want other sparse solutions to be nearby, so if we don't have an exact answer we are at least within a known error bound of the correct answer. If we can find the largest real number $\alpha$ and the smallest real number $\beta$ such that&#xA;$$\alpha||\mathbf{x}_1-\mathbf{x}_2|| \leq A(\mathbf{x}_1-\mathbf{x}_2) \leq \beta||\mathbf{x}_1-\mathbf{x}_2|| $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for all vectors $\mathbf{x}_1$ and $\mathbf{x}_2$. Then we can bound the error on the recovered vector in cases of: noise-free, noisy, and modelling error i.e. error in the $\mathbf{A}$ matrix. The above equation is referred to as the bi-Lipchitz condition and leads directly to idea of the Restricted Isometry Constraint (RIC) - which is calculating the values of $\alpha$ and $\beta$ when the vectors $\mathbf{x}$ are constrained to be s-sparse i.e. have s elements or fewer that are non-zero. Note that RIC is a sufficient condition but not a necessary one. Other characterizations include: the Null Space Property, the Spark, and Mutual Coherence etc. Good overviews of the theory are:&#xA;&lt;a href=&quot;http://users.fmrib.ox.ac.uk/~tblumens/papers/B_Nonlinear.pdf&quot; rel=&quot;nofollow&quot;&gt;Blumensath&lt;/a&gt;, and &#xA;&lt;a href=&quot;http://users.ece.gatech.edu/~mdavenport/publications/ddek-chapter1-2011.pdf&quot; rel=&quot;nofollow&quot;&gt;Davenport&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again this is a highly specialized area and beyond the usual scope of DSP, but you asked the question :)&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-02-18T15:18:25.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21614" PostTypeId="2" ParentId="20550" CreationDate="2015-02-18T17:16:18.797" Score="4" Body="&lt;p&gt;Let me suggest a project for you that I think will fit with what you've learned and with the scope of the project, as far as I can judge it: &lt;em&gt;Denoising of audio signals&lt;/em&gt; by &lt;a href=&quot;http://dsp-book.narod.ru/304.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral subtraction techniques&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic method is relatively simple. You need to cut your signal into overlappling blocks, you window each block, compute an FFT, and modify the magnitude of the FFT coefficients according to the estimated SNR in that frequency bin. High SNR means no modification, low SNR means attenuation by some gain factor $g$ satisfying $0&amp;lt;g&amp;lt;1$. For reconstructing the signal you combine the overlapping blocks (after IFFT) and you use the phase of the noisy signal, so only the magnitude is modified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nice thing about it is the simplicity of the basic method, but also that you can tweak a lot of things (gain computation, SNR estimation, etc.) to improve the perceptive quality of the denoised signal. If you do it in a very simplistic way you'll hear many artefacts, such as &lt;a href=&quot;https://dsp.stackexchange.com/questions/10873/what-does-musical-noise-sound-like-and-is-there-a-sample-clip-for-it&quot;&gt;musical noise&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also have a look at &lt;a href=&quot;https://dsp.stackexchange.com/questions/17317/what-is-best-practice-to-remove-static-noise/17318#17318&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/9054/removing-noise-from-audio-using-fourier-transform-in-matlab/9060#9060&quot;&gt;this answer&lt;/a&gt; for some more information on spectral subtraction.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-02-18T17:16:18.797" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21615" PostTypeId="2" ParentId="20358" CreationDate="2015-02-18T17:49:00.327" Score="0" Body="&lt;p&gt;There is a &lt;a href=&quot;http://www.mathworks.com/help/vision/ug/train-a-cascade-object-detector.html&quot; rel=&quot;nofollow&quot;&gt;tutorial&lt;/a&gt; on how to use &lt;code&gt;trainCascadeObjectDetector&lt;/code&gt; in the documentation.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2015-06-04T18:11:00.517" LastActivityDate="2015-06-04T18:11:00.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21616" PostTypeId="2" ParentId="21605" CreationDate="2015-02-18T18:21:17.823" Score="0" Body="&lt;p&gt;(i dont have enough points to post comments like everyone else)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem you are referring to is commonly called  &quot;the cocktail problem algorithm&quot; here is a little link I found &lt;a href=&quot;https://stackoverflow.com/questions/20414667/cocktail-party-algorithm-svd-implementation-in-one-line-of-code&quot;&gt;https://stackoverflow.com/questions/20414667/cocktail-party-algorithm-svd-implementation-in-one-line-of-code&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I actually discovered this algorithm, in that same online course on coursera a few weeks ago. This article also has some links to research. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see it (I recommend you do) just sign up at coursera for the stanford machine learning class. The video is the &lt;strong&gt;4th&lt;/strong&gt; entry from week 1 introduction at approximately 5mins 30 seconds in, it's titled &quot;unsupervised learning&quot;. I don't think I can legally post a link to the video, but since it's free, why not take a look. At this point it's important to say other than those few minutes at the end of the video clip, I don't think he discusses the cocktail party algorithm again. So there is no need to scour through hours of videos and lectures, you won't find anything (at least in the currently posted content, I haven't finished the course yet)&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2015-02-18T19:23:52.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21617" PostTypeId="2" ParentId="20538" CreationDate="2015-02-18T18:25:15.050" Score="2" Body="&lt;p&gt;The sampling frequency is the inverse of the period T so $F_s = 1/T = 1/1s = 1 Hz$. The Nyquist rate is the double of the maximum frequency of the signal. In your case the signal has only one frequency component $f = 1/8$. So, $F_N = 2 f = 1/4$. Since in your case is a $sin$ signal, the the sampling frequency should be greater (not greater or equal) than the Nyquist rate, in order to avoid aliasing.&lt;/p&gt;&#xA;" OwnerUserId="13403" LastActivityDate="2015-02-18T18:25:15.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21618" PostTypeId="1" CreationDate="2015-02-18T20:16:11.460" Score="1" ViewCount="191" Body="&lt;p&gt;I am writing an open source microphone array simulation program:&lt;a href=&quot;https://sourceforge.net/projects/sharpear/&quot; rel=&quot;nofollow noreferrer&quot;&gt;SharpEar&lt;/a&gt;.&#xA;When I give uniform weight to microphone array elements, the result in the angle is a sinc function as expected. There are 41 elements in array, all equally weighted. Room is  20*20 meters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gPPT0.png&quot; alt=&quot;Room and microphone array &quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Red point in the picture below is a 1000Hz sin wave.  The black areas are filtered by the result of beamforming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/H6VxG.png&quot; alt=&quot;Sound source in the middle of the room and result of beamforming&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am trying to achive null steering. What I understand from null steering with my computer science brain is: Microphone array will work as a spatial filter.  Fft of the weights of the array will be reflected in angle. That is why result of the uniform weighted microphone array is like the picture above. Now lets say I know there is a noice in -30 degree and the sound that I want to focus is at 0 degree(Angle considered to middle of microphone array red point was at around 0 degree ). And array interests in 90 degrees from -45 to 45. Because I don't want to get anything I am adding a null at -30 degree. And I am having a data like: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.5, 0.5 , ... , 0 , 0 , 0 , 0.5 ....1, 1, 1, 0.5, 0.5 , 0.5 ... &#xA;|                    |                  |&#xA;-45              -30 degrees         0 degrees&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe if I take the inverse fft of the data above and use as weights in my microphone array. I should achive a better focussing in angle domain. But my results are terrible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to ask if my understanding of null steering is correct or am I missing anything? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ps: Please forgive my lacking descriptions since DSP is not my profession, I am network programmer and trying to run this project in my free time. &lt;/p&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="8140" LastEditDate="2015-02-18T22:50:02.433" LastActivityDate="2015-02-18T22:50:02.433" Title="Microphone Array null steering unexpected results after IFFT" Tags="|fft|filter-design|ifft|beamforming|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21620" PostTypeId="2" ParentId="21618" CreationDate="2015-02-18T21:22:38.890" Score="2" Body="&lt;p&gt;I don't understand what you did but I think you didn't understand the idea correctly.&lt;br&gt;&#xA;Lets say the weighting vector at a certain frequency is given by $\mathbf{w}^H$ where ${}^H$ is the complex conjugate. That is the elements of $\mathbf{w}^H$ are the weights you apply to each sensor without null steering. And lets say that the array response to the interference is $\mathbf{v}_I$ (which is basically the conjugate of the array weights if you were to point the beamformer to the interference). The simple null steering solves the following optimisation problem:&#xA;$$   \underset{\mathbf{w}_{d}}{min}\:\left\Vert \mathbf{w}_{d}-\mathbf{w}\right\Vert ^{2}\\&#xA;  subject\; to\\&#xA;  \qquad\mathbf{w}_{d}^{H}\mathbf{v}_{I}=0 &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Lagrange multipliers it can be shown that&#xA;$$ \mathbf{w}_{d}^{H}=\mathbf{w}^{H}\cdot\left(\mathbf{I}_{N}-\frac{1}{N}\mathbf{v}_{I}\mathbf{v}_{I}^{H}\right)$$&#xA;where $\mathbf{I}_{N}$ is the identity matrix and $N$ is the number of sensors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This solution is not very robust to errors in the interference direction.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-02-18T21:22:38.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21621" PostTypeId="1" AcceptedAnswerId="21624" CreationDate="2015-02-18T22:13:14.530" Score="12" ViewCount="2238" Body="&lt;p&gt;I am trying to answer the following question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the system described by equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=0.5y[n-1]+x[n]-0.5x[n-1]$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;an &lt;strong&gt;IIR&lt;/strong&gt; filter? My answer is yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="4298" LastEditDate="2020-10-28T10:52:31.933" LastActivityDate="2023-06-30T18:17:52.950" Title="What kind of filter is that? Is it IIR?" Tags="|filters|discrete-signals|infinite-impulse-response|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21624" PostTypeId="2" ParentId="21621" CreationDate="2015-02-18T22:27:20.010" Score="19" Body="&lt;p&gt;This is the &lt;strong&gt;FIR&lt;/strong&gt; filter, although it looks like an IIR. If you calculate the coefficients you get finite impulse response:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$h[n]=\delta[n]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This happens due to zero-pole cancellation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y(z)-0.5Y(z)z^{-1}=X(z)-0.5X(z)z^{-1}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H(z)=\dfrac{Y(z)}{X(z)}=\dfrac{1-0.5z^{-1}}{1-0.5z^{-1}}=1 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Yes, it can be tricky. Seeing &lt;span class=&quot;math-container&quot;&gt;$y[n-k]$&lt;/span&gt; coefficients in LCCDE (Linear Constant Coefficients Difference Equation) doesn't necessarily mean it's an IIR filter. It might be just a recursive FIR filter.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="7092" LastEditDate="2023-06-30T18:17:52.950" LastActivityDate="2023-06-30T18:17:52.950" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="21625" PostTypeId="1" CreationDate="2015-02-18T22:42:40.280" Score="3" ViewCount="1703" Body="&lt;p&gt;I assume this is a relatively simple DSP task, but I'm having trouble finding any information on how to approach my problem.  Hopefully someone with more experience and brain power can help me out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have many (thousands) audio records of bird calls.  I am looking for a technique that will identify the timestamps within each audio file during which the bird is chirping.  Here's an example of a high quality audio file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PX92z.jpg&quot; alt=&quot;This is an example of a clean audio file, with little background noise&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, I wish to export a table of the frequencies created by the bird in each file, for further analysis.  I've already created a Python program that will allow me to manually select data points of interest, but I'd like to automate the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest process I can think of would be to set a minimum power threshold for data points of interest, but the audio files have varying degrees of background noise.  Some of the audio files may be unusable due to background noise, which is fine, but they need to be flagged as such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the two questions are:&lt;br&gt;&#xA;1) How to identify low-quality audio files&lt;br&gt;&#xA;2) How to identify the useful sections of high-quality audio files  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="14773" LastActivityDate="2015-02-26T20:20:24.017" Title="How to identify useful elements of audio recording and ignore lulls?" Tags="|audio|signal-analysis|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21626" PostTypeId="2" ParentId="21621" CreationDate="2015-02-18T22:46:46.760" Score="18" Body="&lt;p&gt;Jojek's answer is of course correct. I would just like to add some more information because much too often have I seen the terms &quot;IIR&quot; and &quot;recursive&quot; confused. The following implications always hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\text{IIR}&amp;amp; \Longrightarrow\text{recursive}\\&#xA;\text{non-recursive}&amp;amp;\Longrightarrow\text{FIR}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. every IIR filter (i.e. a discrete-time filter having an infinitely long impulse response) must be implemented recursively (unless you have infinite memory available), and every non-recursive LTI system has a finite impulse response (again, unless you have infinite memory).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the reverse is generally not true. A recursive filter can have a finite impulse response, as is the case for the example in the question. Another famous example is a moving average filter. This a non-recursive implementation of a moving average (necessarily FIR):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac{1}{N}\sum_{k=n-N+1}^nx[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is a recursive implementation of the same filter (also FIR):&#xA;$$y[n]=y[n-1]+\frac{1}{N}(x[n]-x[n-N])$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-02-18T22:52:47.843" LastActivityDate="2015-02-18T22:52:47.843" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="21627" PostTypeId="2" ParentId="21625" CreationDate="2015-02-18T23:29:56.120" Score="1" Body="&lt;p&gt;Looks like good files contain a range of frequency power whereas low quality could be flagged if they lack such a range as you suggest&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To identify interesting time points just create a time window starting a few moments prior to each frequency power spike lasting somewhat after such a peak &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Animals know to repeat their chirps so you could boost confidence in seeing a high quality file if it contains repeat frequency power spikes with similar signatures&lt;/p&gt;&#xA;" OwnerUserId="368" LastEditorUserId="368" LastEditDate="2015-02-19T00:11:28.593" LastActivityDate="2015-02-19T00:11:28.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21628" PostTypeId="2" ParentId="21625" CreationDate="2015-02-19T01:14:31.103" Score="2" Body="&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I don't know why i thought this question was matlab based, but my solution is written with matlab in mind. a quick search showed my the python &lt;a href=&quot;http://scikit-learn.org/stable/&quot; rel=&quot;nofollow noreferrer&quot;&gt;scikit&lt;/a&gt; has otsu's method for automatic thresholding (this is what matlab uses). Other than that I think most of the code is relatively python safe and can easily be translated. My apologies for my error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from skimage import filter&#xA;val = filter.threshold_otsu(camera)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;END EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you threshold the amplitude of the recording? say this is our recording&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zVSey.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we are just plotting&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(abs(sound))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;can we say the chirping is probably above 2? and assume everything below magnitude=2 is just noise? If so, and assuming you have the imageprocessing toolbox, you could&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;normalize the audiofile amplitude (between 0-1) needed for next step&lt;/li&gt;&#xA;&lt;li&gt;get automatic thresholding of file &lt;strong&gt;imageprocessing toolbox function&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;find indicies that exceed threshold and say these are bird chirps&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;the only problem is with sound even with a strong signal, it will usually cross 0 so you would have discontinuities even in the actual bird chirping. Maybe you can add some sort of hysteresis to the masking operation. Like &#xA;&lt;em&gt;if the current sample is below the threshold &lt;strong&gt;BUT&lt;/strong&gt; a large percentage of the previous few samples were above the threshold, we will assume this sample is also an interest point&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;roughly your code would be something like this (im not near a comp with matlab, so this may have slight syntax errors). This is also not very optimized, but maybe it's a springboard for you or others&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% step 1&#xA;%we are using magnitude only&#xA;my_min = min(abs(soundfile));&#xA;my_max = max(abs(soundfile));&#xA;&#xA;%gets sound file magnitude between 0-1 only&#xA;normalized_sound_mag = 1/(my_max-my_min) * (abs(soundfile) - my_min);&#xA;&#xA;%% step 2&#xA;%get a threshold, we needed the magnitude between 0-1 for this function to work&#xA;sound_thresh = graythresh(normalized_sound_mag);&#xA;&#xA;%% step 3&#xA;%this vector will store all sample indexes that are interesting&#xA;idx_sound = 0;&#xA;&#xA;num_for_hysteresis = 10;        %the number of samples to use for hysteresis&#xA;hysteresis_percentage = 0.8;    %percentage of samples that must be above threshold&#xA;                                %so say in our set of 10, 2 samples are below threshold&#xA;                                %since .8 are above it, we say they are all of interest&#xA;&#xA;%because the way we implement hysteresis we have to skip the first few samples&#xA;for (i=num_for_hysteresis:1:length(normalized_sound_mag))&#xA;    %if we are above thresh, without a doubt save the index&#xA;    if (normalized_sound_mag(i) &amp;gt; sound_thresh)&#xA;        idx_sound = [idx_sound, i];&#xA;    else&#xA;        %hysteresis check prev samples, creates a boolean vector. 1 means value above thresh, 0 means it was below&#xA;        samples_above_thresh = normalized_sound_mag(i-num_for_hysteresis:i) &amp;gt; sound_thresh;&#xA;&#xA;        %nnz, gets the number of nonzero elements in a matrix&#xA;        num_prev_samples_above_thresh = nnz(samples_above_thresh);&#xA;&#xA;        %if the number of samples in the prev window met our criteria, this current sample &#xA;        %is probably of interest as well&#xA;        if (num_prev_samples_above_thresh &amp;gt; hysteresis_percentage * num_for_hysteresis)&#xA;            idx_sound = [idx_sound, i];&#xA;        end&#xA;    end&#xA;end&#xA;&#xA;%idx_sound should now have all the indicies f interest, these can now be used &#xA;%directly on the original soundclip&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we could also use the frequency power and threshold, rather than the sound amplitude, the basic outline would still be the same.&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-02-26T20:20:24.017" LastActivityDate="2015-02-26T20:20:24.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21629" PostTypeId="1" CreationDate="2015-02-19T06:46:29.143" Score="1" ViewCount="276" Body="&lt;p&gt;I have to do FFT in MATLAB on the digital sinusoidal data that is stored in excel. please find the amplitude values of the sine wave discrete signal stored in the Lookup table.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Number of points : 256&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Maximum amplitude : 1024&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Numbers per row: 1&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Numbers are in decimal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;512, 525, 537, 550, 562, 575, 587, 600, 612, 624, 636, 649, 661, 673, 684, 696, 708, 719, 731, 742, 753, 764, 775, 786, 796, 807, 817, 827, 837, 846, 856, 865, 874, 883, 891, 900, 908, 916, 923, 931, 938, 945, 951, 957, 964, 969, 975, 980, 985, 990, 994, 998, 1002, 1005, 1009, 1012, 1014, 1016, 1018, 1020, 1022, 1023, 1023, 1024, 1024, 1024, 1023, 1023, 1022, 1020, 1018, 1016, 1014, 1012, 1009, 1005, 1002, 998, 994, 990, 985, 980, 975, 969, 964, 957, 951, 945, 938, 931, 923, 916, 908, 900, 891, 883, 874, 865, 856, 846, 837, 827, 817, 807, 796, 786, 775, 764, 753, 742, 731, 719, 708, 696, 684, 673, 661, 649, 636, 624, 612, 600, 587, 575, 562, 550, 537, 525, 512, 499, 487, 474, 462, 449, 437, 424, 412, 400, 388, 375, 363, 351, 340, 328, 316, 305, 293, 282, 271, 260, 249, 238, 228, 217, 207, 197, 187, 178, 168, 159, 150, 141, 133, 124, 116, 108, 101, 93, 86, 79, 73, 67, 60, 55, 49, 44, 39, 34, 30, 26, 22, 19, 15, 12, 10, 8, 6, 4, 2, 1, 1, 0, 0, 0, 1, 1, 2, 4, 6, 8, 10, 12, 15, 19, 22, 26, 30, 34, 39, 44, 49, 55, 60, 67, 73, 79, 86, 93, 101, 108, 116, 124, 133, 141, 150, 159, 168, 178, 187, 197, 207, 217, 228, 238, 249, 260, 271, 282, 293, 305, 316, 328, 340, 351, 363, 375, 388, 400, 412, 424, 437, 449, 462, 474, 487, 499&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried writing code in MATLAB but I am not getting the exact output. lease tell me the coding procedure to obtain FFT.&lt;/p&gt;&#xA;" OwnerUserId="14778" LastEditorUserId="13320" LastEditDate="2016-11-21T13:07:44.697" LastActivityDate="2016-11-21T13:07:44.697" Title="How to perform FFT on stored digital data" Tags="|matlab|fft|" AnswerCount="0" CommentCount="3" ClosedDate="2015-02-20T08:30:41.100" ContentLicense="CC BY-SA 3.0" />
  <row Id="21630" PostTypeId="1" CreationDate="2015-02-19T11:34:27.670" Score="5" ViewCount="120" Body="&lt;p&gt;Hi all Is there a generally accepted rule as to which order to perform filtering in? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example if I have three iir filters, a low pass filter a notch and a high pass filter, which sequence would it be best to perform these in? or does it not make any difference at all? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;cheers, Graham. &lt;/p&gt;&#xA;" OwnerUserId="14782" LastActivityDate="2015-05-20T23:41:48.323" Title="sequence to perform filtering? which filter first?" Tags="|filters|infinite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21631" PostTypeId="2" ParentId="21630" CreationDate="2015-02-19T12:17:17.923" Score="1" Body="&lt;p&gt;Theoretically (with infinite precision arithmetic) order of LTI filters does not matter. If any of the filters is not LTI then order will be important. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus, for finite precision arithmetic one should also take care of numerical error build up and potential instability issues especially with IIR filters where pole locations may become critical&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-02-19T20:41:18.890" LastActivityDate="2015-02-19T20:41:18.890" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21632" PostTypeId="2" ParentId="2896" CreationDate="2015-02-19T17:00:10.807" Score="2" Body="&lt;p&gt;Some artifacts are always going to be present whenever you deviate from strict LTI (linear time invariant) systems. With time varying systems you will see FM sideband energy dispersions, which present as non removable aliasing noise. This is sadly the case even assuming bug free code, band limited interpolation and a maximally smooth modulator signal (stationary sinusoid).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course it helps if you keep the modulator as smooth, as low frequency and as narrow band as possible. For a standard flanger modulated by a sinusoid LFO, the FM noise might not actually be a problem, but if you want to explore a wider range of modulating options you might consider oversampling to combat aliasing. Or just accept it as part of the sound.&lt;/p&gt;&#xA;" OwnerUserId="12235" LastActivityDate="2015-02-19T17:00:10.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21633" PostTypeId="1" AcceptedAnswerId="21635" CreationDate="2015-02-20T03:31:30.780" Score="1" ViewCount="2331" Body="&lt;p&gt;I know that frequency mixer $y(t)=x(t)cos(\omega_ct)$ is a nonlinear system since its output has frequency components that are not present in the input. To prove its nonlinearity, it shuldd be shown that the system either violates scaling or additivity. However, I could not do that. Can someone please help me?&lt;/p&gt;&#xA;" OwnerUserId="14792" LastActivityDate="2015-02-20T08:45:15.907" Title="How to prove that frequency mixer is a nonlinear system?" Tags="|linear-systems|non-linear|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21634" PostTypeId="1" CreationDate="2015-02-20T05:04:20.740" Score="0" ViewCount="170" Body="&lt;p&gt;Hi I am using zedgraph to plot an FFT of a signal using c#.The FFT spectrum gives coefficients vs the frequency bins.I am confused whether the plot should consist of spectral lines(ie verticle lines) corresponding to each frequency bins or data point values?&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="14793" LastActivityDate="2015-02-20T05:04:20.740" Title="Does FFT magnitude spectrum graph consist of spectral lines or points" Tags="|fft|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21635" PostTypeId="2" ParentId="21633" CreationDate="2015-02-20T08:41:22.667" Score="5" Body="&lt;p&gt;If the system is nonlinear then if $y_1(t)$ is the response to the signal $x_1(t)$, and  $y_2(t)$ is the output given input signal $x_2(t)$ then the response to the signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=a_1x_1(t)+a_2x_2(t)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with arbitrary constants $a_1$ and $a_2$ will generally &lt;em&gt;not&lt;/em&gt; be equal to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=a_1y_1(t)+a_2y_2(t)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for the given system an input signal (1) always results in an output signal (2). The conclusion is that the system is linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The confusion arises because you think that linear systems cannot add new frequencies to the input signal. This is generally not true. Only linear &lt;em&gt;and time-invariant&lt;/em&gt; (LTI) systems have that property. Linear but time-varying systems can produce new frequencies in the output signal, and a modulator is a classic example of a linear time-varying system.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-20T08:41:22.667" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21636" PostTypeId="2" ParentId="21633" CreationDate="2015-02-20T08:45:15.907" Score="0" Body="&lt;p&gt;The system is linear but time-variant, because&#xA;$$&#xA;x(t-t_0)\cos(\omega_\mathrm{c}t) \neq y(t-t_0)\quad\text{for }\omega_\mathrm{c} \neq k2\pi&#xA;$$&#xA;which can be seen by comparing the above equation with&#xA;$$&#xA;y(t-t_0) = x(t-t_0)\cos(\omega_\mathrm{c}t - \omega_\mathrm{c}t_0)&#xA;$$&#xA;Therefore, a frequency mixer is &lt;em&gt;no&lt;/em&gt; linear time-invariant (LTI) system. One consequence of this property is, that the system can not be represented by a transfer function $H(\omega)$. More precisely, only an LTI system can be expressed in frequency domain by&#xA;$$&#xA;Y(\omega)=X(\omega)H(\omega).&#xA;$$&#xA;Interestingly, amplitude &lt;em&gt;de&lt;/em&gt;modulation can also be implemented by a time-invariant, non-linear system (namely a diode).&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-02-20T08:45:15.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21637" PostTypeId="1" CreationDate="2015-02-20T09:47:21.593" Score="0" ViewCount="111" Body="&lt;p&gt;Recently in Image Processing I've been studying image clustering (or segmentation) methods and one of them is &lt;a href=&quot;https://ieeexplore.ieee.org/abstract/document/387488&quot; rel=&quot;nofollow noreferrer&quot;&gt;Color Image Segmentation Using Competitive Learning&lt;/a&gt;. I understand the main idea behind it from which you start with one cluster with its cluster representative then pixel values get assigned to this cluster (also involving a learning rate, what is it?) until you reach a certain amount and the cluster gets cloned, the algorithm stops when you reach the desired amount of clusters.&lt;/p&gt;&#xA;&lt;p&gt;I searched for quite a while on the internet but i didn't find anything about this method, can you please explain to me precisely how the algorithm works, how pixel values get assigned, what is the learning rate (it might be called in the different way because i'm translating from my language), what are the input and output and all the steps of the algorithm?&lt;/p&gt;&#xA;" OwnerUserId="14794" LastEditorUserId="7092" LastEditDate="2023-07-14T19:03:11.870" LastActivityDate="2023-07-14T19:03:11.870" Title="How does Arbib's clustering method work?" Tags="|image-processing|matlab|image-segmentation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="21639" PostTypeId="2" ParentId="18512" CreationDate="2015-02-20T12:56:48.027" Score="1" Body="&lt;p&gt;I don't know how you wanted to mount these, but definitely you should take a look at &lt;a href=&quot;http://webstore.iec.ch/webstore/webstore.nsf/artnum/049787&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;IEC 60268-4&lt;/strong&gt;&lt;/a&gt; standard (if you search net carefully you will find copy). Nevertheless parameters of your interest might be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Frequency response &lt;/li&gt;&#xA;&lt;li&gt;Sensitivity&lt;/li&gt;&#xA;&lt;li&gt;Directional pattern&lt;/li&gt;&#xA;&lt;li&gt;Front-to-rear sensitivity index&lt;/li&gt;&#xA;&lt;li&gt;Total harmonic distortion&lt;/li&gt;&#xA;&lt;li&gt;Equivalent SPL (EIN)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-02-20T12:56:48.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21640" PostTypeId="1" AcceptedAnswerId="21644" CreationDate="2015-02-20T13:20:54.583" Score="0" ViewCount="4612" Body="&lt;p&gt;I came across this confusion in Chapter 16,&quot;Book - The Scientist and Engineers guide to DSP&quot; and Topic is &quot;Windowed Sinc-Filters&quot;. I am doing some calculations for designing the sinc filter and came across these doubts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                               M = 4/BW&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &quot;M&quot; is the filter kernel length and &quot;BW&quot; is the transition bandwidth. The author says that &lt;em&gt;&quot;The BW must be expressed as a fraction of sampling rate with a value between 0 to 0.5 and same goes with the cut off frequency&quot;&lt;/em&gt;. For the values of M = 20, 40, 200, the BW is 0.2, 0.1, 0.02 and like we can see, it satisfies the condition of 0 to 0.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After I searched online, I understood that the value of cut off frequency and BW to exist between 0 to 0.5 has to do something with the power (dB) and presumed that 0 is 0db and 0.5 is -3 dB, since 10log(0.5) = -3dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what is the relationship between the cutoff of frequency and BW being a fraction of the &lt;em&gt;sampling rate&lt;/em&gt; and between the values 0 to 0.5? What does it mean?. Is it something to do with the frequency components present beyond the cut off freq or BW being attenuated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: If my sampling rate is 100sps, so the cut off frequency and BW must be a fraction of 100 sps with a value between 0 to 0.5? &lt;/p&gt;&#xA;" OwnerUserId="9152" LastActivityDate="2015-02-20T15:25:57.310" Title="Why should the cut off frequency and the transition bandwidth (BW) be expressed as a fraction of sampling rate?" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21642" PostTypeId="1" AcceptedAnswerId="21643" CreationDate="2015-02-13T23:52:16.527" Score="3" ViewCount="336" Body="&lt;p&gt;I'm looking for a fast way to do a 2D discrete Fourier transform of an image at many arbitrary frequencies. I know the Goertzel algorithm works for 1D, but is it possible to generalize it in 2D? Or any other useful algorithms? Two solutions that I know, but which I'm afraid might be too slow, are directly using the DFT equation, and zero padding and doing an FFT. Alternately, the frequencies might not need to be completely arbitrary but could be sub-arrays of the array of frequencies given by an FFT with high frequency resolution.&lt;/p&gt;&#xA;" OwnerUserId="13732" OwnerDisplayName="firescape" LastActivityDate="2015-02-20T14:19:50.240" Title="evaluating individual terms of 2D DFT (Goertzel?)" Tags="|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21643" PostTypeId="2" ParentId="21642" CreationDate="2015-02-20T14:12:53.933" Score="0" Body="&lt;p&gt;The 2D DFT is separable, so you can conceptually compute it by applying 1D DFTs in both directions. For the Goertzel algorithm you can first apply it for a specific column for each row, and then use that column and apply it again to obtain the individual term. Most likely, you can rewrite the Goertzel algorithm to do this in one go, but the computational savings are quite small (for an $N \times N$ image, you would need $N^2 + N$ multiplications using the separable approach, while a 2D version would give $N^2$ multiplications).&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2015-02-20T14:19:50.240" LastActivityDate="2015-02-20T14:19:50.240" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21644" PostTypeId="2" ParentId="21640" CreationDate="2015-02-20T15:25:57.310" Score="0" Body="&lt;p&gt;It is just a normalization so that the apparent sampling frequency is 1 Hz. Say for example you have a 101 tap lowpass filter with with a cutoff of 10 Hz at a sampling frequency of 50 Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't change the filter coefficients but apply the exact same filter at a sampling rate of 500 Hz then the cutoff will be 100 Hz (not 10 Hz) because the frequencies scale according to the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An important point to note - consider the original filter has a transition width of 10 Hz i.e. from 10 Hz to 20H at the 50 Hz sampling rate. If the filter coefficients remain unchanged when applied in a system with a sampling rate is 500 Hz, the resulting transition width is now from 100Hz - 200 Hz, so the transition width has also increased. This is the reason that if you are trying to design a filter with a narrow transition width at high sampling rates it  requires more filter taps i.e. the impulse response of the filter gets longer in terms of the number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most of the filter design software they accept normalized frequency values for the specification - but be careful some use slightly different normalizations e.g. I believe Matlab expects the frequencies to be between 0 and 1 rather than 0 and 0.5, their filter design interface has changed over the years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you look at the formulas in the literature for estimation of the FIR filter length for routines like the Parks- McClellan algorithm, you'll see that the frequencies are normalized with respects to the sampling frequency.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-02-20T15:25:57.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21645" PostTypeId="1" CreationDate="2015-02-20T15:30:58.120" Score="1" ViewCount="170" Body="&lt;p&gt;How can I generate non-stationary Gaussian noise (noise uncertainty) using Matlab? where the noise power fluctuate between $(1+p)^{-1}$ to $(1+p)$ where $p$ is the uncertainty factor in dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best&lt;/p&gt;&#xA;" OwnerUserId="14796" LastEditorUserId="7092" LastEditDate="2015-02-20T15:58:59.363" LastActivityDate="2015-02-20T15:58:59.363" Title="Generating Gaussian noise uncertainty?" Tags="|matlab|noise|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21646" PostTypeId="1" AcceptedAnswerId="21656" CreationDate="2015-02-20T16:59:43.170" Score="2" ViewCount="2804" Body="&lt;p&gt;How can I add noise to a recording to obtain a SNR value provided by the user? I am tryin to test the effects of noise on my algorithm. Is there any function or app for doing that kind of task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="11256" LastEditDate="2015-02-20T17:13:21.423" LastActivityDate="2015-02-21T10:57:26.477" Title="How can noise be added to a signal to obtain a specific SNR?" Tags="|snr|signal-synthesis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21648" PostTypeId="1" AcceptedAnswerId="21649" CreationDate="2015-02-20T17:16:47.400" Score="0" ViewCount="111" Body="&lt;p&gt;I am trying to get transfer function $H_{xy}$ from this graph. I managed to get the other one but I am struggling with this one. Any help or guidance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LYTx6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="8202" LastEditDate="2015-02-20T18:04:18.380" LastActivityDate="2015-02-20T18:15:22.460" Title="What is the transfer function $H_{xy}$ of this flow graph?" Tags="|transfer-function|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21649" PostTypeId="2" ParentId="21648" CreationDate="2015-02-20T18:03:08.613" Score="2" Body="&lt;p&gt;If you mark with $v[n]$ the signal between summing nodes for input $x[n]$ and output $y[n]$, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v[n] = x[n] -8v[n-2] -4v[n-3]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Re-arranging sides:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v[n]+8v[n-2]+4v[n-3]=x[n] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the Z-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$V(z)[1+8z^{-2}+4z^{-3}]=X(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's calculate the transfer function between $v[n]$ and $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$H_{x\to v}(z)=\dfrac{V(z)}{X(z)}=\dfrac{1}{1+8z^{-2}+4z^{-3}}$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now moving to the relation between output $y[n]$ and $v[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n]=v[n]+2v[n-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again calculating the Z-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(z)=V(z)[1+1+2z^{-1}]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now converting the transfer function $H_{vy}(z)$:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$H_{v\to y}(z)=1+2z^{-1}$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Final step is to merge these two together. We know that in time domain it is a convolution: $h_{x\to y}[n]=h_{x\to v}[n]\star h_{v\to y}[n]$, thus in Z-transform domain it will be the multiplication, yielding the final result:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$H_{x\to y}(z)=H_{x\to v}(z)H_{v\to y}(z)=\dfrac{1+2z^{-1}}{1+8z^{-2}+4z^{-3}}$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-02-20T18:15:22.460" LastActivityDate="2015-02-20T18:15:22.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21650" PostTypeId="2" ParentId="20501" CreationDate="2015-02-20T19:14:43.053" Score="3" Body="&lt;p&gt;After couple days of research, I have found another interesting solution. The Similar algorithm for segmentation of overlapping objects is described in &lt;a href=&quot;https://scholar.google.ru/scholar?hl=ru&amp;amp;q=IMAGE%20SEGMENTATION%20FOR%20OBJECT%20DETECTION&amp;amp;btnG=&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; (the algorithm below is an adaptation for objects of parallelogram shape). It uses properties of the boundary to perform separation. Perhaps someone may find it interesting.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Overlapping rectangles.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;To get the intuition behind the algorithm, consider easy case of two overlapping rectangles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1dvfkm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can extract the boundary ( by applying morphological transformation $A - A\ominus B$) and choose an arbitrary point on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uGhO2m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can traverse boundary starting with chosen point and plot the dependence $\lvert \frac{dy}{dl}(l)\rvert$ along the boundary. (Here $y$ is $y$-coordinate of a pixel and $l$ is a length of the path along boundary). Each peak on the plot is a vertical edge of the rectangle. We can select begin and end points of edges by finding intersection of the graph with threshold $t = 0.5 \underset{l}{\max}\lvert\frac{dy}{dl}(l)\rvert$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XfKUom.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After all, we can connect each pair of points with the amount of points on the path between them greater than 3, and distance between them $d &amp;lt; d_{0}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SsN6Wm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sbDyom.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;More complex parallelograms.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;This algorithm is also suited for handling more complex overlapping parallelograms. In this case dependence $\lvert\frac{dy}{dl}(l)\rvert$ will have the same form as for case with rectangels, but reversed around $x$-axis and shifted. So, the same technique can be applied to extract corner points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yUldqm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dKZ8Tm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/iD7Aim.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HeQ1Am.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Noisy rectangles.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;For noisy objects (as in my case) the dependence $\lvert\frac{dy}{dl}(l)\rvert$ doesn't have such straight shape, as in previous cases. So, additional effort can be required. In order to increase performance of an algorithm, I have applied closing to the original image and moving average filter to the sequence $y[l]$, before calculating derivative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/INXsFm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/euHbQm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YAnxcm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BKUQIm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="6961" LastEditorUserId="6961" LastEditDate="2015-02-20T19:20:18.540" LastActivityDate="2015-02-20T19:20:18.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21651" PostTypeId="1" CreationDate="2015-02-20T22:06:15.270" Score="1" ViewCount="97" Body="&lt;p&gt;I have samples of a signal that contains an AM signal added to an FM signal with the same carrier frequency $f_c$. The AM signal is a sinusoid with frequency $f_{AM}$ and the FM signal is a sinusoid with frequency $f_{FM}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to recover $f_{AM}$ and $f_{FM}$ when I have only an AM signal or only an FM signal, but my techniques are not working when I try to recover $f_{AM}$ and $f_{FM}$ from the sum. For the AM signal, I'm taking the FFT and finding peaks at $f_c$ and $f_c + f_{AM}$. For the FM signal, I'm finding the time-derivative of the signal and taking the FFT, which gives me a peak at $f_{FM}$. When I take the FFT of the sum, I can see peaks at $f_c$ and $f_c + f_{AM}$, but when I take the FFT of the time-derivative of the sum, I don't get a single neat peak anywhere near $f_{FM}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should I do to recover both $f_{AM}$ and $f_{FM}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;A partial solution I've found is to proceed in two stages. First I find the AM component by taking the FFT (this gives $f_c$ and $f_c + f_{AM}$). Then I eliminate the AM component by dividing each sample by its magnitude. Taking the fft of the time-derivative of this normalized signal gives me a spike at $f_{FM}$, but it also gives me a lot of other spikes. Any suggestions on how to make this give a cleaner answer?&lt;/p&gt;&#xA;" OwnerUserId="13643" LastEditorUserId="13643" LastEditDate="2015-02-21T20:48:22.030" LastActivityDate="2015-02-21T20:48:22.030" Title="Recover signal from sum of AM and FM" Tags="|demodulation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21653" PostTypeId="2" ParentId="20563" CreationDate="2015-02-21T03:34:23.413" Score="2" Body="&lt;p&gt;I cannot give you a definitive answer, because I have only seen the results of some of the more popular (mp3, gsm, wma) codecs.  However, one thing that all seem to utilize is additional antialias filtering beyond what a standard PCM encoding would use.  This means that a power spectrum (recommended) or spectrogram (not as good) should show a severe loss of high frequencies above a certain frequency, usually in the 11kHz to 20 kHz range.  In addition, before the steep rolloff you will usually see a peak in the amplitude of the spectrum as a result of noise shaping.  Sometimes you see a gap between where things roll off and some imperfectly filtered stuff above 20 kHz--this, too is an indication that things are not real music.  Real music has a red power spectrum, meaning that is decreases roughly 20 dB per decade of frequency increase, with few spikes or changes in that trend.&lt;/p&gt;&#xA;" OwnerUserId="11014" LastActivityDate="2015-02-21T03:34:23.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21654" PostTypeId="1" AcceptedAnswerId="21655" CreationDate="2015-02-21T10:22:49.273" Score="3" ViewCount="3823" Body="&lt;p&gt;I've plotted the response of a high-pass filter &lt;code&gt;x=[1 -1]&lt;/code&gt;; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;freqz(x)&lt;/code&gt; gave me&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EGvwy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where as the magnitude plot for the &lt;code&gt;fft&lt;/code&gt; gave me &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RafoH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are the two plots different? Both are frequency responses, then why are my plots are diffferent. What does &lt;code&gt;freqz()&lt;/code&gt; do?&lt;/p&gt;&#xA;" OwnerUserId="7926" LastEditorUserId="1629" LastEditDate="2016-05-17T21:12:13.470" LastActivityDate="2016-05-17T21:12:13.470" Title="Difference between $\tt freqz()$ and $\tt plot(abs(fft()))$ in MATLAB" Tags="|frequency-response|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21655" PostTypeId="2" ParentId="21654" CreationDate="2015-02-21T10:37:24.740" Score="4" Body="&lt;p&gt;You calculating FFT only from two samples. You need to pad your impulse response with zeros to get a valid result. So in MATLAB that would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 1024; % Number of points to evaluate at&#xA;% Create the vector of angular frequencies at one more point.&#xA;% Filter itself&#xA;b=[1,-1];&#xA;[h_f, w_f] = freqz(b, 1);&#xA;figure&#xA;grid on&#xA;hold on&#xA;plot(w_f, abs(h_f), 'or') % MATLAB&#xA;h = [b, zeros(1,N-2)];&#xA;HH = abs(fft(h));&#xA;HH = HH(1:length(w_f));&#xA;plot(w_f, HH); % Manual calculation&#xA;legend({'MATLAB freqz', 'Manual'})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see it matches first and last value from fft you calculated. Please keep in mind that it is shown in linear - not dB scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pyI0W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info you can see my &lt;a href=&quot;https://dsp.stackexchange.com/a/16888/8202&quot;&gt;&lt;strong&gt;previous answer&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-02-21T11:22:11.423" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21656" PostTypeId="2" ParentId="21646" CreationDate="2015-02-21T10:57:26.477" Score="2" Body="&lt;p&gt;Easiest way is to scale energy of noise. Nevertheless you must understand that for some files it is not that simple. Let's say that you have the recording of crying baby in silence. What is then your point of reference? Are you going to add white noise based on ratio between it's energy and average energy across the whole recording (silence+baby)? Or maybe you should calculate the energy in sliding window and then use only sound of interest as point of reference? That is why you should not add noise based on energy of your whole file. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to some particular examples, then I suggest you to take a look &lt;a href=&quot;https://dsp.stackexchange.com/a/17962/8202&quot;&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt; for mathematical derivation. If you are looking for functions, then please check out the MATLAB &lt;a href=&quot;http://uk.mathworks.com/help/comm/ref/awgn.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;awgn&lt;/strong&gt;&lt;/a&gt; function. Nevertheless if you want something even more sophisticated, then you might want to check the &lt;a href=&quot;https://code.soundsoftware.ac.uk/projects/audio-degradation-toolbox&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Audio Degradation Toolbox&lt;/strong&gt;&lt;/a&gt;. You can find a dedicated routine for adding various types of noise with a given SNR.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-02-21T10:57:26.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21657" PostTypeId="1" AcceptedAnswerId="21658" CreationDate="2015-02-21T13:06:11.693" Score="4" ViewCount="1277" Body="&lt;p&gt;How can I measure the frequency response range of a piezoelectric disc below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4OETN.jpg&quot; alt=&quot;piezoelectric disc&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have an oscilloscope but I do know how to program in matlab / octave I was thinking of creating a swept signal in matlab and playing it through my laptop or tablet and playing it through the disc.  But how do I measure the frequency response?&lt;/p&gt;&#xA;" OwnerUserId="1894" LastActivityDate="2022-08-22T02:35:25.283" Title="Measuring frequency response range of piezoelectric disc" Tags="|matlab|frequency-spectrum|frequency-response|octave|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21658" PostTypeId="2" ParentId="21657" CreationDate="2015-02-21T13:48:29.213" Score="4" Body="&lt;p&gt;I am afraid that it is rather impossible without a proper hardware. Sweep sine is ok as a general method, but you would either need:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Reference transducer with known (preferably) linear frequency response. Then you can find the difference between those two.&lt;/li&gt;&#xA;&lt;li&gt;Signal actuator with known frequency response, and then you can also find the difference between recorded signal and what it should be.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In any other case you will only measure the convolution of actuator response and response of piezoelectric element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also understand that this disc is meant to be used as a contact device, not for recording of sound waves. There is a huge difference between those two signals recorded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly you can try to search for frequency characteristic of known model (presumably measured by someone). I did similar work back in time, but we used different type.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-02-21T18:02:34.487" LastActivityDate="2015-02-21T18:02:34.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21659" PostTypeId="2" ParentId="20476" CreationDate="2015-02-21T18:21:52.557" Score="2" Body="&lt;p&gt;First of all - don't use 80kHz (I don't know why you came up with this number as a limit for MATLAB, whereas it is 1e6 in fact) but something that is more reasonable and standardized, i.e. 96kHz (or 88.2kHz if you wish...). Another thing is that your sound card might not be able to serve such high sampling frequency. You should check that in playback options --&gt; Advanced tab and set it correctly. Last thing - you should drop using obsolete &lt;code&gt;sound&lt;/code&gt; and use &lt;code&gt;audioplayer&lt;/code&gt; - unless you use some ooold MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-02-21T18:21:52.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21661" PostTypeId="1" AcceptedAnswerId="21694" CreationDate="2015-02-21T19:39:35.783" Score="1" ViewCount="3723" Body="&lt;p&gt;I'm trying to decimate given picture&#xA;&lt;img src=&quot;https://i.stack.imgur.com/lSNen.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Vertically.&lt;/li&gt;&#xA;&lt;li&gt;Horizontally.&lt;/li&gt;&#xA;&lt;li&gt;Horizontally + Vertically.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know that I should use low-pass filter* and then downsample** it not to see any aliasing in image.&#xA;To this my code is below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Horizontally filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter_hor    = [0.25,0.5,0.25];&#xA;filtered_hor  = imfilter(big_shirt,filter_hor);%% big_shirt is shirt image given above&#xA;decimated_hor = filtered_hor(1:2:end,:);%%decimated_hor = downsample(filtered_hor,2);&#xA;imshow(decimated_hor)&#xA;title('Horizontally filtered')&#xA;axis on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Vertically filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter_ver    = [0.25;0.5;0.25];&#xA;filtered_ver  = imfilter(big_shirt,filter_ver);&#xA;decimated_ver = filtered_ver(:,1:2:end);&#xA;imshow(decimated_ver)&#xA;title('Vertically filtered')&#xA;axis on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Horizontally + Vertically filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filtered_2D  = imfilter(decimated_hor,filter_ver);&#xA;decimated_2D = filtered_2D(:,1:2:end);&#xA;imshow(decimated_2D)&#xA;title('2D filtered')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I get is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CPEJf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fVYuR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/scSBc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*My low pass filter is: [0.25,0.5,0.25]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**By a factor of 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My expectation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use horizontal filter, I just get rid of aliasing on lines of shirt collar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use vertical filter, I just get rid of aliasing in vertically lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Vertical+horizontal will be nice picture like what I get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However in first two cases are not satisfied. What can be the problem. My resolution on computer is 1366X768 and image size is 800X600. When I use imshow, I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Warning: Image is too big to fit on screen; displaying at 67% &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can be problem related to this or am I doing something wrong? &lt;/p&gt;&#xA;" OwnerUserId="13705" LastEditorUserId="13705" LastEditDate="2015-02-23T19:01:54.080" LastActivityDate="2016-01-20T06:57:23.300" Title="MATLAB: Decimation image" Tags="|image-processing|matlab|decimation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21662" PostTypeId="1" AcceptedAnswerId="21664" CreationDate="2015-02-21T19:42:04.527" Score="2" ViewCount="2155" Body="&lt;p&gt;Since a couple of months I started working on the extraction (estimation) of signal frequency and amplitude components by means of two different time-frequency approaches, namely the Hilbert transform and the Teager-Kaiser energy operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested both methods on standard signals, such as chirps, sine, cosine, etc. This preliminary analysis seemed to highlight Teager-Kaiser has better resolution in both frequency and amplitude estimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Afterwards I applied the two methods on some acceleration signal derived from a tool simulating the dynamic behavior of a given system. Surprisingly enough, Hilbert transform provided more reliable results in terms of frequency estimation. Teager-Kaiser operator shows some high-frequency content estimation, which is hardly expectable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I developed the two techniques in Simulink, as visible here:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2x60A.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results on a synthetic acceleration signal are here:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qULgn.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What did I miss in the design of the Teager-Kaiser operator? Is it any possible to avoid those &quot;false&quot; frequency estimates (those with the arrows)?&lt;/p&gt;&#xA;" OwnerUserId="3666" LastActivityDate="2018-03-29T20:19:25.513" Title="Teager-Kaiser Operator vs. Hilbert Transform" Tags="|signal-analysis|time-frequency|analytic-signal|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21663" PostTypeId="1" CreationDate="2015-02-21T23:16:06.390" Score="0" ViewCount="45" Body="&lt;p&gt;I have recorded an image of a large macromolecule and after several types of image analysis, have obtained a rotationally averaged image, that is not quite perfect, but appears to show 6-fold symmetry. With the origin on the axis of rotation, I compute a transform and unlike most of my colleagues, if I actually look at the amplitudes and phases of the transform. I have only one image of this molecule and no more specimen left. So my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What feature(s) I should see in the transform’s amplitudes and phases?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the amplitudes and phases do not conform exactly to my expectations, what would that mean?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What are the factors that degrade my image?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What should I do to make the transform conform to my expectations?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any ideas are welcome. Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="11175" LastActivityDate="2015-02-21T23:16:06.390" Title="Amplitudes and phases of transform of an image" Tags="|image-processing|phase|amplitude|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21664" PostTypeId="2" ParentId="21662" CreationDate="2015-02-22T00:26:56.513" Score="2" Body="&lt;p&gt;This paper may be of interest:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;David Vakman, &quot;On the Analytic Signal, the Teager-Kaiser Energy Algorithm, and Other Methods for Defining Amplitude and Frequency.&quot; IEEE Trans. Signal Processing. (1996)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summarising from the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Psi(u) = a^2w^2 = [u'(t)]^2 - u(t)u''(t)$$&#xA;$$\Psi'(u') = a^2w^4 = [u''(t)]^2 - u'(t)u'''(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u(t)$ is the signal, and $a$ and $w$ iare the amplitude and frequency estimates to solve for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(t) = \frac{\Psi(u)}{\sqrt{\Psi(u')}}$$&#xA;$$w(t) = \sqrt{\frac{\Psi(u')}{\Psi(u)}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this means if at some point in the signal $u'(t)=1$ and $u''(t)=u''''(t)=0$, for example, then $\Psi(u) = 1$ and $\Psi'(u) = 0$ and thus $a(t) = \infty$ and $w(t) = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper thus explains this causes spikes in amplitude and zero frequencies with the Teager-Kaiser algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your signal, the reverse must be true. If $\Psi(u) = 0$ and $\Psi'(u) = 1$ then you would get spikes in frequency when amplitude is zero. This would occur when $[u'(t)]^2 = u(t)u''(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform uses the entire signal to compute. It is implemented by doubling the positive frequencies and setting the negative frequencies to zero. Therefore the &lt;em&gt;energy of the signal&lt;/em&gt; does not change (Parseval's theorem). Thus, intuitively, there can be no infinite spikes, as this would require infinite energy.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2015-02-22T00:35:47.510" LastActivityDate="2015-02-22T00:35:47.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21665" PostTypeId="1" CreationDate="2015-02-22T04:25:18.843" Score="0" ViewCount="165" Body="&lt;p&gt;I am currently doing an electronics design for a basic 2.5W speaker amplifier for an embedded system based on COTS parts (e.g. &lt;a href=&quot;http://www.ti.com/product/tlv320aic3104&quot; rel=&quot;nofollow&quot;&gt;codec&lt;/a&gt; and &lt;a href=&quot;http://www.analog.com/en/products/audio-video/audio-amplifiers/ssm2375.html&quot; rel=&quot;nofollow&quot;&gt;amp&lt;/a&gt;), similar to what one would find in a tablet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from a wide range of parts to choose from, there are other engineering trade-offs, such as the filter on the CLass D amp for EMI/EMC and the noise on the power supply rails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This, of course, is even before deciding on a speaker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a standard method for an &lt;em&gt;objective&lt;/em&gt; and &lt;em&gt;repeatable&lt;/em&gt; evaluation process? If so, what sort of equipment and methods do I need, and what metrics do I need to calculate, and how to these metrics relate to the perception of audio quality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Yes, of course, there is &lt;a href=&quot;http://en.wikipedia.org/wiki/Signal-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;SNR&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_harmonic_distortion&quot; rel=&quot;nofollow&quot;&gt;THD&lt;/a&gt; and frequency response, but I am yet to relate these to how a human perceives the quality of the audio).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Second note: This isn't an evaluation of codecs, compression, sampling or other DSP artefacts.  I have control of the bitstream I send to the audio codec chip. Advice of choosing the signal I &lt;em&gt;should&lt;/em&gt; send is most welcome).&lt;/p&gt;&#xA;" OwnerUserId="1904" LastActivityDate="2015-02-23T21:51:27.353" Title="Objective, repeatable sound quality measurements and metrics" Tags="|audio|psychoacoustics|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21670" PostTypeId="1" CreationDate="2015-02-22T11:42:14.040" Score="1" ViewCount="1073" Body="&lt;p&gt;I have implemented an IIR low pass filter in direct form 2, the input to the filter is a unit impulse $\delta[n]$. I have calculated the output of the filter for the mentioned input using the difference equation of direct form 2, the equations are given below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}w[n] &amp;amp;= x[n] - a_1 w[n-1] - a_2 w[n-2] \\&#xA;y[n] &amp;amp;= b_0 w[n] + b_1 w[n-1] + b_2 w[n-2] \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How to plot the frequency response of the output with out using inbuilt commands in MATLAB? Also I want to implement the same in fixed point using 32 bit and plot the frequency reponse of it. &lt;/li&gt;&#xA;&lt;li&gt;For plotting should I use &lt;code&gt;freqz&lt;/code&gt; command or &lt;code&gt;plot(abs(fft(my ouput))&lt;/code&gt;?. Both should give me same frequency response, but I am getting different responses, &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WKi8B.jpg&quot; alt=&quot;command used is plot(abs(fft(my output)))&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Au3ih.jpg&quot; alt=&quot;using freqz command&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="14809" LastEditorUserId="1629" LastEditDate="2016-03-19T16:08:49.570" LastActivityDate="2017-11-11T02:11:48.243" Title="IIR low pass filter: floating point and fixed point" Tags="|matlab|filters|lowpass-filter|infinite-impulse-response|" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="21674" PostTypeId="1" AcceptedAnswerId="21676" CreationDate="2015-02-22T16:23:02.227" Score="1" ViewCount="524" Body="&lt;p&gt;I have a 4096-point FFT of a continuous pipe organ sound (no windowing).  I wish to extract the relative amplitudes of the various harmonically-related sinusoidal components for voicing analysis.  I can easily find the bins with the local maximum power for each component, but since the frequencies are not exactly in the middle of a bin, some of these peaks are spread between two adjacent bins, and the amplitude in each bin is less than it would be if the frequency were shifted to exactly hit that bin.  For frequency analysis I have used various interpolation formulas with great success.  But now I am doing amplitude analysis, and I want to know if there is a similar interpolation formula to estimate the amplitude of a component in a way that is independent of whether that component is exactly in the center of a frequency bin or is between two bins.  My current best guess is the take the sum of the powers (magnitude squared) of the bin with the peak power together with the bins immediately adjacent to it.  The sum of those three bin powers would then represent the power of that one component of the sound.  Is there a better way?&lt;/p&gt;&#xA;" OwnerUserId="14812" LastActivityDate="2015-02-22T17:40:15.450" Title="Extracting amplitudes of components from FFT" Tags="|fft|amplitude|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21675" PostTypeId="1" CreationDate="2015-02-22T16:23:30.207" Score="3" ViewCount="1213" Body="&lt;p&gt;I stumbled upon the following algorithm for Gaussian noise generation and I just can't figure out how this is supposed to work at all. &#xA;The algorithm is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hEqdw.jpg&quot; alt=&quot;Gaussian noise algorithm&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all: $j = \arg\min_i (q_1 - p[i])$ does not depend on $q_1$ and therefore yields the same result every time - I assume $\arg\min_i (|q_1 - p[i]|)$ is what's really meant here. &#xA;But then there's more: I can safely assume that $q_1$ is distributed linearly within $[0,1]$, otherwise I could just scale that, round afterwards and wouldn't have so much hassle. &#xA;In this case I got another problem: As $q_1$ is linearly distributed, choosing $j$ near to zero (which is what $\mu=0$ would implicate) is not particularly likely, so I suspect the resulting distribution is not a normal distribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This algorithm reminds me of inverse transform sampling ( &lt;a href=&quot;http://en.wikipedia.org/wiki/Inverse_transform_sampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Inverse_transform_sampling&lt;/a&gt;); however it does not appear to be a variant of it. I'm a bit confused here because that's somewhat easy to compute and if p was a cumulative distribution here, I'd understand this one right away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically I'm stuck with understanding this one and looking forward to any hints as to where I'm wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you folks in advance! &lt;/p&gt;&#xA;" OwnerUserId="14813" LastEditorUserId="80" LastEditDate="2015-10-21T11:53:54.953" LastActivityDate="2015-10-21T13:47:32.610" Title="Gaussian noise generator algorithm trouble" Tags="|noise|gaussian|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21676" PostTypeId="2" ParentId="21674" CreationDate="2015-02-22T17:40:15.450" Score="0" Body="&lt;p&gt;Once you use parabolic or other interpolation for a frequency peak location estimate, you can use an offset Sinc kernel, centered at that estimated frequency, to interpolate the magnitude of that peak location.  Sum each of the complex components of all the adjacent component values of the FFT result that are above the local noise floor (weighted by the offset Sinc kernel).  Then take the magnitude of that complex result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use any window function (other than rectangular of FFT width) use the transform of that window function instead of a Sinc kernel.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-02-22T17:40:15.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21677" PostTypeId="1" CreationDate="2015-02-22T17:59:50.137" Score="1" ViewCount="67" Body="&lt;p&gt;I want to create an adaptive filter. Its coefficients have this general shape:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZeXvs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the input signal for the filter is a sine wave, the filter behaves the desired way if the look-back window is set to a length equal to 1/4th the period of the sine wave. I can somehow understand why this is so because a sinusoid is essentially 4 times the same piece of data, flipped and mirrored: this becomes obvious if you split it at multiples of pi/2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/m0Uxk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I say &quot;the filter behaves the desired way&quot; I mean that it turns together with the sinusoid:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tRqdL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.. now the question is: when the adaptive filter is placed on a sinusoid of unknown frequency, what error criterion should it use so it automatically will select a window length of 1/4th the period of the sinusoid, and behave in the same nice way as the image above? No matter where the starting point of the calculation is (so also if it does not start calculating at those &quot;pretty&quot; pi/2 multiples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal would be to find the right length of the window. To do this, you need to go through lengths of i.e. 2-&gt;100, and always calculate the same error function, but on a longer and longer input window (going back from the current period to the left: further and further &quot;back in time&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we take the filter coefficients, multiply them with a piece of sinusoid, and then on this we calculate the error function: for 2 periods, for 3, for 4 etc. all the way to i.e. 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the ideal error function to use for this?&#xA;Some sort of sinusoidal mean squared error type of thing..&#xA;All help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="735" LastActivityDate="2015-02-22T17:59:50.137" Title="non-standard error function for adaptive filter" Tags="|filters|finite-impulse-response|adaptive-algorithms|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21679" PostTypeId="2" ParentId="21670" CreationDate="2015-02-22T19:27:52.477" Score="1" Body="&lt;p&gt;setting aside the DF1 vs. DF2 issue (and we know there are several other forms besides those two, all with advantages and disadvantages), &lt;a href=&quot;https://dsp.stackexchange.com/questions/16885/how-do-i-manually-plot-the-frequency-response-of-a-bandpass-butterworth-filter-i/16911?s=9|0.0747#16911&quot;&gt;there is an answer, sans phase response, to the OP's original question here.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-02-22T19:27:52.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21680" PostTypeId="1" CreationDate="2015-02-22T20:48:58.687" Score="0" ViewCount="101" Body="&lt;p&gt;I would really appreciate if I can get answers to following Fixed point queries(part-1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Converting a real number x to fixed point fraction X(m,n)&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;[1] says:&lt;br&gt;&#xA;m = ceil(log2(max[abs(xmin,xmax)+1])) { assuming signed x&gt;1) or&lt;br&gt;&#xA;m = floor(log2(max[abs(xmin,xmax)+2])) { assuming signed x&amp;lt;1}            (1.1)&lt;br&gt;&#xA;and xmin,xmax define the known range of x. if WL desired is known = m+ n , then, n= WL - m.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Q1) Can this be used blindly? What if we don't know the expected range of x?&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;[2] defines:  if floating x had &quot;d&quot; fractional digits,&lt;br&gt;&#xA;compute ceil(3.3 * d).                   (1.2)&lt;br&gt;&#xA;Q2)  Is Fraction Length n = ceil(3.3 * d)  or n+1  = ceil(3.3 * d)&lt;br&gt;&#xA;Q3) What about floor(3.3*f) or any other scheme?&lt;br&gt;&#xA;Q4) Where would I use equation 1.1 over 1.2 and vice versa?&lt;br&gt;&#xA;Suppose we have computed Fraction  length n by any of the above methods.&#xA;Now, The integer representation and the quantized value is computed as:&lt;br&gt;&#xA;X= round/floor/fix(x*(2^n)); xq(Quantized value) =  X/(2^n);&lt;br&gt;&#xA;(Q5) Does choosing round/floor/fix here determine the type of quantizer? If yes,&#xA;   which option gives a rounding quantizer and which one does a truncation quantizer?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.&lt;a href=&quot;http://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&amp;amp;%20Fractional%20Math.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.superkits.net/whitepapers/Fixed%20Point%20Representation%20&amp;amp;%20Fractional%20Math.pdf&lt;/a&gt;( equation 9 and Equation 12)&lt;br&gt;&#xA; 2.  DSP, a practical approach:Efeachor (page 809-810,second edition)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You so much&lt;br&gt;&#xA;sedy&lt;/p&gt;&#xA;" OwnerUserId="11096" LastActivityDate="2015-02-22T20:48:58.687" Title="Fixed Point queries-1" Tags="|fixed-point|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21684" PostTypeId="2" ParentId="19713" CreationDate="2015-02-23T03:23:21.343" Score="1" Body="&lt;p&gt;This probably should be a comment, but I didn't earn that option yet. You can try measuring instrument impulse response. If I understand correctly, your system is essentially one-dimensional. Then if you use thin plate or plate of known thickness instead of thick object/material, your output signal will be an approximation of impulse response. Using it as deconvolution kernel will allow you to measure response specific to material, or object.&lt;/p&gt;&#xA;" OwnerUserId="14802" LastEditorUserId="14802" LastEditDate="2015-02-23T06:14:24.347" LastActivityDate="2015-02-23T06:14:24.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21685" PostTypeId="1" CreationDate="2015-02-23T06:14:42.913" Score="7" ViewCount="640" Body="&lt;p&gt;I would like to calculate a long correlation function of length say, 1e6 points.&#xA;I have a prior knowledge that the correlation peak will be in point k*1000.&#xA;Is there an efficient way to apply this prior knowledge and perform a shorter calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to calculate correlation by definition and implement a 1000 correlators. This solution is not sufficient.&#xA;Batch algorithm (FFT) is always possible but it does not make use of the mentioned structure.&lt;/p&gt;&#xA;" OwnerUserId="14820" LastEditorUserId="80" LastEditDate="2015-09-21T15:55:27.267" LastActivityDate="2022-03-22T11:53:39.273" Title="Efficient calculation of correlation function every $N^{\rm th}$ point" Tags="|fft|autocorrelation|cross-correlation|ifft|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21686" PostTypeId="1" AcceptedAnswerId="21687" CreationDate="2015-02-23T08:03:50.897" Score="3" ViewCount="2657" Body="&lt;p&gt;I am almost done with design and implementation of my first FIR filter using C++. Its a Sinc-Windowed FIR filter designed for a cut off frequency of 100 Hz with sampling rate of 500, with a filter order M = 100. All the operations have been carried out in discrete time domain. &lt;strong&gt;So basically my question is regarding testing to see if my filter is generating the desired response&lt;/strong&gt; . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presume one way to test the output would be to apply DFT to it and check the response spectrum of the filter in the frequency domain, but for this I have to develop a function that performs the DFT on the output .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question :To avoid this, I am looking,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;----&gt;Are there any methods that make it possible to test the filter response in the (without the need for applying DFT) time domain itself?.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;----&gt; If the above is not possible, are there are any alternative methods like some C++ DSP library with FT function's you can suggest? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or Any suggestions and advice regarding this with your experience would be appreciated. Thanks in advance!  &lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="4298" LastEditDate="2020-11-01T15:33:19.053" LastActivityDate="2020-11-01T15:33:19.053" Title="How to test the FIR filter in C++?" Tags="|filters|filter-design|lowpass-filter|finite-impulse-response|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21687" PostTypeId="2" ParentId="21686" CreationDate="2015-02-23T08:23:23.497" Score="6" Body="&lt;p&gt;The first basic test could be to use a unit impulse as an input signal and see if the output signal equals the impulse response (i.e. the filter coefficients). Another simple test signal is a unit step. The corresponding output should be the cumulative sum of the filter's impulse response, i.e. for $x[n]=u[n]$, the output must be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=0}^nh[k],\quad n\ge 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you obtain the desired response for these two simple test signals, that's a good start, but I wouldn't stop there.&#xA;In general it is very helpful to use a tool like Matlab or Octave (free), or anything similar, which has built-in filtering routines against which you can check your routine for arbitrary input signals.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-23T08:23:23.497" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21688" PostTypeId="1" AcceptedAnswerId="21690" CreationDate="2015-02-23T09:17:21.087" Score="2" ViewCount="1317" Body="&lt;p&gt;Can anyone provide an insight to select a filter structure out of multi-stage and single stage FIR filter?(it will be great help if references are also provided) Let's say I have to make 50 tap filter. So, is it better to design it using two cascaded filters each with 25 tap then 50 tap single filter only or both are same ? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="11696" LastActivityDate="2015-02-23T10:15:41.987" Title="Multi-Stage digital FIR filter vs Single stage FIR filter. Which is better?" Tags="|filter-design|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21689" PostTypeId="2" ParentId="21685" CreationDate="2015-02-23T09:23:54.873" Score="1" Body="&lt;p&gt;If you have a signal of length $N$ you can calculate auto correlation function of length $K=2N-1$.You'll need perform $N$ multiplications for each value of correlation function $r_{xx}$ or in other words you need one correlator. So you need as many correlators as your $r_{xx}$ function length is. If you want to find correlation in the lag $0$ use one correlator. You can can calculate correlation of any lag $i \in (-N+1...N-1)$ via one correlator with signal properly shifted by $i$ times. From the other side $FFT$ method allows you to find $N$ taps of cyclic auto correlation function via only one $FFT$ operation. So it is not optimal if you need only a few correlation values.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-02-23T09:23:54.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21690" PostTypeId="2" ParentId="21688" CreationDate="2015-02-23T10:15:41.987" Score="4" Body="&lt;p&gt;First, two cascaded 24th-order (25-tap) filter will yield a 48th-order filter which is not identical to a 49th-order (50 tap). However, as I assume that this isn't really the answer you are looking for, but rather the difference between multi-stage and single stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming infinite precision arithmetic they are the same. In practice, multi-stage filters have lower coefficient sensitivity, so using two (or more) filters would (statistically) allow shorter coefficients word lengths. However, multi-stage filters also require intermediate quantization, so for a complete comparison one should also consider that. And, as obvious from the first paragraph, multi-stage require more multiplications for a given filter order. I would say that unless you run into problems with coefficient quantization you should go with a single stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another use case where multi-stage is relevant is when implementing interpolation and decimation. By using more than one stage some of the filtering can be performed at a lower sample rate and the total arithmetic complexity is reduced.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-02-23T10:15:41.987" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21691" PostTypeId="1" AcceptedAnswerId="21736" CreationDate="2015-02-23T15:50:29.577" Score="9" ViewCount="7902" Body="&lt;p&gt;I'm looking for a way to pan the PCM audio I have.&#xA;At the moment the audio is in a stereo format and I would like to pan it to the desired side (or more/less to a side).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've recently figured out how to do mixing &lt;a href=&quot;https://dsp.stackexchange.com/questions/3581/algorithms-to-mix-audio-signals-without-clipping&quot;&gt;here&lt;/a&gt; so I guess it would be something similar (adding stuff to each other and such). What I was thinking is to add the audio data from one side to the other side.&lt;br&gt;&#xA;For example if I were to pan hard left, I'd get the data from the right channel and add it to the left channel. I would then set the right channel to a constant value so that it would be silent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I thinking in the right way or am I missing something obvious?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="14824" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2019-01-11T02:39:58.153" Title="Algorithm to pan audio" Tags="|audio|algorithms|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21693" PostTypeId="1" CreationDate="2015-02-23T19:00:39.107" Score="2" ViewCount="1825" Body="&lt;p&gt;I am working on speech recognition for Hindi language. My approach is to map speech to text based on phones. For this, first split the speech into the words and then map each word to text by detecting phones. Till now I am able to split the speech audio file into separated words audio files (I used energy levels for this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Number of different phones is 1023. For each phone, I have extracted MFCC coefficients for every 10ms frame. (So different phones have different number of frames and for each frame I store 38 coefficients. This serves as templates for each phone.) Also for each word in speech, I extract MFCC coefficients for every 10ms frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am unable to find efficient algorithm to map word into sequence of phones. I have been thinking of two approaches for this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Naive bruteforce approach in which I simply try to match every possible group of frames in word to every available template (using DTW) and then select the closest match. But this is very inefficient method.&lt;/li&gt;&#xA;&lt;li&gt;Split word into phones. Then for each phone select most appropriate template from 1023 available templates (using DTW). But in this approach, I am not getting how to split word into separate phones.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there any another approach to solving this problem? Or can it be done efficiently using second approach?&lt;/p&gt;&#xA;" OwnerUserId="14827" LastEditorUserId="7092" LastEditDate="2015-02-23T19:53:22.073" LastActivityDate="2016-04-19T05:22:12.743" Title="Detecting phones in a word audio" Tags="|python|speech-recognition|speech-processing|mfcc|machine-learning|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21694" PostTypeId="2" ParentId="21661" CreationDate="2015-02-23T19:08:54.823" Score="2" Body="&lt;p&gt;After my trials, I realize that problem is directly about &lt;code&gt;Warning: Image is too big to fit on screen; displaying at 67%&lt;/code&gt; warning. I use imwrite to my matrix and convert it to jpg file. After looking the image using jpg file , there is no problem. &lt;/p&gt;&#xA;" OwnerUserId="13705" LastActivityDate="2015-02-23T19:08:54.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21695" PostTypeId="2" ParentId="21693" CreationDate="2015-02-23T20:08:52.320" Score="1" Body="&lt;p&gt;Though acoustic speech features (MFCCs, etc) &amp;amp; lexical words are correlated in daily language, traditionally in speech recognition software, acoustic and linguistic information are assumed independent. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see this in popular open-source speech recognition packages like Sphinx3/4 (Java/C using HMMs vs DTW) or Kaldi (C++/neural nets), one must train both an acoustic model &amp;amp; a language model. For the English language, there are a &lt;a href=&quot;https://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/&quot; rel=&quot;nofollow&quot;&gt;few off-the-shelf model&lt;/a&gt;s available, but in most domain-specific cases, it is best to train a new one or adapt an existing model. I'm not sure about the state of acoustic/language models for the Hindi language, but here is &lt;a href=&quot;http://arxiv.org/pdf/1305.2847.pdf&quot; rel=&quot;nofollow&quot;&gt;a paper&lt;/a&gt; you may have seen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend looking for existing Hindi models to use within Sphinx or Kaldi.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-02-23T20:08:52.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21696" PostTypeId="1" AcceptedAnswerId="21712" CreationDate="2015-02-23T14:53:31.773" Score="2" ViewCount="3564" Body="&lt;p&gt;I have a project that requires detecting and processing letters in a given input image. I am also new to subject of image processing. There are lots of subsubjects in image processing. I believe I don't have to learn all the concepts of image processing to achive my purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question above; how can I detect letters in a given input image?&#xA;Note: I already know matlab. I need to do this by implementing algorithm, not by a built-in function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am gonna tell my thoughts. I want to write an application which takes an input image as an argument. If there is are English letters on that image (photo), it will detect them by circling each of the letters. I don't know which subject in digital image processing I must look at. &lt;/p&gt;&#xA;" OwnerUserId="14842" OwnerDisplayName="Bora Semiz" LastEditorUserId="53" LastEditDate="2015-02-24T14:33:17.137" LastActivityDate="2018-01-19T06:43:20.137" Title="How to detect letters in an image?" Tags="|image-processing|matlab|matlab-cvst|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21697" PostTypeId="2" ParentId="467" CreationDate="2015-02-23T21:38:32.420" Score="0" Body="&lt;p&gt;I tried something that worked out well- for the specified amplifier. the matlab code is here: &lt;a href=&quot;https://sites.google.com/site/marialstavrinou/home/dc-offset-removal-filter-in-matlab&quot; rel=&quot;nofollow&quot;&gt;https://sites.google.com/site/marialstavrinou/home/dc-offset-removal-filter-in-matlab&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="14830" LastActivityDate="2015-02-23T21:38:32.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21698" PostTypeId="2" ParentId="10369" CreationDate="2015-02-23T21:47:22.037" Score="7" Body="&lt;p&gt;To add to the above well stated explanation, in the case of wavelets, which are finite in time, it is more correct not to use the term 'power' but 'energy'. For Fourier who has as basis functions the sinusoid that extends infinite in time, power spectral density is the correct term. For wavelets, who has basis functions as finite in time deflections, we should use 'energy'. &lt;/p&gt;&#xA;" OwnerUserId="14830" LastActivityDate="2015-02-23T21:47:22.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21699" PostTypeId="2" ParentId="21665" CreationDate="2015-02-23T21:51:27.353" Score="1" Body="&lt;p&gt;i dunno anything about EAQUAL or PEAQ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;judging which sounds &lt;em&gt;better&lt;/em&gt; is quite subjective, so much so that i consider it nearly a useless question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but if you have a reference (that you define as &quot;good&quot;), and you have several options to compare to the reference, and your goal is find which option most sounds like the reference, then i would recommend AB testing (a little bit different from ABX testing).  at least blind, and better yet, double blind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the subject listens to A and to B.  as many times as they would like.  pressing A always gets them sound A and pressing B always gets them sound B.  then the only question to ask the subject is &lt;em&gt;&quot;Do these sound the same or are they different?&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;put in an equal number of pairs that are truly identical as those that are the difference you're trying to test.  so for two different sounds, the subject hears AA, AB, BA, and BB.  if the subject scores more true positives than false positives and more true negatives than false negatives, he or she might very well be hearing the difference.  get lotsa subjects and have them hear lotsa different sound pairs and you can get some meaningful results.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-02-23T21:51:27.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21700" PostTypeId="1" AcceptedAnswerId="21721" CreationDate="2015-02-23T22:07:44.097" Score="1" ViewCount="160" Body="&lt;p&gt;Can anyone mention me techniques to hide an image in an audio file ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="13403" LastActivityDate="2015-02-24T21:07:41.620" Title="Steganography - What techniques exist to hide an image in an audio file?" Tags="|audio|" AnswerCount="1" CommentCount="4" ClosedDate="2015-02-26T04:40:08.760" ContentLicense="CC BY-SA 3.0" />
  <row Id="21701" PostTypeId="1" AcceptedAnswerId="21704" CreationDate="2015-02-23T22:35:52.817" Score="2" ViewCount="1910" Body="&lt;p&gt;In digital communications textbooks (e.g., Digital Communications by Bernard Sklar), the relationship between the &quot;received&quot; signal power $P_r$ and the &quot;transmitted&quot; energy per bit $E_b$ is given as follows: $P_r=E_b R_b$ where $R_b$ is the bit rate. What confuses me in this equation is that the channel attenuation is not considered in the equation. Shouldn't the equation be as  $P_r=\alpha^2E_b R_b$ instead where $\alpha$ is the channel attenuation?&lt;/p&gt;&#xA;" OwnerUserId="14792" LastActivityDate="2015-02-24T00:11:51.970" Title="Relationship between &quot;received&quot; signal power and &quot;transmitted&quot; energy per bit?" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21702" PostTypeId="1" AcceptedAnswerId="21717" CreationDate="2015-02-23T23:49:17.577" Score="2" ViewCount="3289" Body="&lt;p&gt;Suppose I generate chirp signal with the following python code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; t = np.linspace(0, 10, 512)&#xA; f0 = 2&#xA; f1 = 5&#xA; fs = 2*f1&#xA; w = chirp(t, f0=f0, f1=f1, t1=10, method='linear')&#xA; result  = rfft(w)&#xA; phase = np.zeros(257)&#xA; mag = np.zeros(257)&#xA; for binnum in range(len(result)):&#xA;   mag[binnum] = abs(result[binnum])&#xA;   phase[binnum] = np.arctan2(result[binnum].imag, result[binnum].real)&#xA; plt.plot(fs * np.linspace(0, 0.5, 257),np.unwrap(phase))&#xA; plt.show()&#xA; plt.plot(fs * np.linspace(0, 0.5, 257),mag)&#xA; plt.show()  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the phase plot is:&lt;img src=&quot;https://i.stack.imgur.com/vaT1l.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Magnitude plot is:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/62gnp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it is very different from what is described &lt;a href=&quot;http://www.dspguide.com/ch11/6.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, looking at the phase graph I can see parabola from 0 to 0.8. The magnitude is definitly  not a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm doing wrong or misunderstood?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7052" LastActivityDate="2015-02-24T17:06:42.267" Title="Basic question about chirp signal" Tags="|fft|python|linear-chirp|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21703" PostTypeId="1" CreationDate="2015-02-23T23:59:30.037" Score="0" ViewCount="26879" Body="&lt;p&gt;I have a mini project to do about homography, but I am really a beginner in Matlab. I have calculated the homography matrix easily by taking a set pixels from both images but the problem is how to apply this matrix to all pixels of the original image (I think it's difficult to treat each pixel individually).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the original image :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rjan4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to apply the homography to this image (I have already extracted the homography matrix) to get a frontal view of the cover.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So with my weak knowledge of Matlab, I applied the following operations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I get 4 points from the corners of the original image and the corresponding points in the output image&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have estimated the homography :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0.9638   -0.0960   52.5754&#xA; 0.2449    1.3808  -17.0081&#xA;-0.0001    0.0013    1.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;then I have applied it on the image using this poor Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [Ired] = affect(I,P)&#xA;I1=im2double(I);&#xA;for i=1:308&#xA;i&#xA;for j=1:288&#xA;v1 = [j;i;1];&#xA;v2 = P*v1;&#xA;v3 =v2/v2(3,1);&#xA;if (v3(1,1) &amp;lt;0 || v3(2,1)&amp;lt;0 || v3(3,1)&amp;lt;0)&#xA;   continue;&#xA;else     &#xA;Ired(round(1+v3(2,1)),round(1+v3(1,1)))=I1(i,j);&#xA;end&#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;end &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and the result is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5nx28.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;but the problem with this code is it takes a lot of time (sometimes 10 minutes) to perform the operation on the image, especially if the size of the image is high. Is there a way to implement this code without loops to make it faster? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I get these black dots all over the image, I can do a dilation but the image will be distorted, do you have an idea how to eliminate this dots without distorting the image?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I cannot use predefined Matlab functions in this project.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="14831" LastEditorDisplayName="user11906" LastEditDate="2015-07-14T07:43:06.083" LastActivityDate="2020-03-14T07:46:00.230" Title="How to apply a 2D -2D homography matrix to an image?" Tags="|matlab|image-processing|homography|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21704" PostTypeId="2" ParentId="21701" CreationDate="2015-02-24T00:11:51.970" Score="2" Body="&lt;p&gt;You are correct that it could be argued that every physical channel will introduce attenuation. In digital communications, however, it is common to define &quot;channel models&quot; that simplify the equations and make the problem easier to understand and to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most popular model is the &quot;additve white Gaussian noise&quot; (AWGN) model, where the only effect of the channel is to introduce noise. In other words, there is no attenuation. In that model, Sklar's relationship between power and bit energy is correct. This model is very popular because, in many cases, you can ignore the attenuation by assuming an appropriate gain mechanism in the receiver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, in many other cases the AWGN model is not appropriate. In the wireless channel, for instance, the channel gain is so fundamental that it gets incorporated into the model. If the channel is narrow-band, then the relationship between power and bit energy is similar to what you propose, with $\alpha$ random and possible time-varying.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-02-24T00:11:51.970" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21707" PostTypeId="2" ParentId="21703" CreationDate="2015-02-24T07:40:02.723" Score="1" Body="&lt;p&gt;What do you mean by &quot;apply this matrix to all pixels of the image without treating them one by one&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image is made of pixels, each one with its x-y location. The homography maps a coordinate on a plane into another one so you actually HAVE to apply it to every single pixel&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(x' ; y' ; 1) = H (x ; y ; 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where H is your 3x3 homography matrix. Doing this you'll get the new image (plus some black areas), simply iterate the equation for every pixel in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(sorry for the bad formatting of the formula, wrote it down fast)&lt;/p&gt;&#xA;" OwnerUserId="13472" LastEditorUserId="13472" LastEditDate="2015-02-24T07:51:54.627" LastActivityDate="2015-02-24T07:51:54.627" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21708" PostTypeId="2" ParentId="21703" CreationDate="2015-02-24T08:39:58.483" Score="1" Body="&lt;p&gt;You should use the function &lt;code&gt;maketform&lt;/code&gt; to create your homography, and apply it on image by using &lt;code&gt;imtransform&lt;/code&gt;. Don't forget to apply transpose on your matrix, because Matlab works on pixels as rows, not as columns.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   A = transpose([....])  %Your matrix in here&#xA;   t = maketform( A, 'perspective');&#xA;   imOut = imtransform(im,t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-02-24T08:39:58.483" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21709" PostTypeId="2" ParentId="20159" CreationDate="2015-02-24T09:10:14.643" Score="1" Body="&lt;p&gt;It looks like using the &lt;code&gt;polartocartesian&lt;/code&gt; transformation is destroying the characters (look at the &quot;M&quot;, &quot;E&quot; before and after...). I think it will be a better idea to think about some rotations mechanism using &lt;code&gt;imrotate&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any way, I'd try the following additional pre-proc:&#xA;1. you might want to perform some morphological operations on the image after the adaptive threshold. &#xA;2. I would also try labeling the image (&lt;code&gt;bwlabel&lt;/code&gt;) and removing too large objects (most of the background noise in your image is connected so it will be a huge object - in terms of pixel counting)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have fun!&lt;/p&gt;&#xA;" OwnerUserId="3487" LastActivityDate="2015-02-24T09:10:14.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21710" PostTypeId="2" ParentId="20159" CreationDate="2015-02-24T09:11:57.427" Score="0" Body="&lt;p&gt;Signs on your images look quite well. I think you should optimize your preprocessing step and use more complex filters. There is very interesting answer of &lt;strong&gt;tbirdal&lt;/strong&gt; - &lt;a href=&quot;https://dsp.stackexchange.com/questions/20088/how-to-remove-the-noise-without-destroying-the-main-edge&quot;&gt;How to remove the noise without destroying the main edge?&lt;/a&gt; See on Mazda logo before and after filtration in above-mentioned answer. &lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-02-24T09:24:29.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21712" PostTypeId="2" ParentId="21696" CreationDate="2015-02-24T11:13:13.087" Score="0" Body="&lt;p&gt;The field is knows as Optical Character Recognition (OCR) and it's a broad field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it's clearly an academic exercise, you can keep it simple. Start by image segmentation : find shapes where a shape is just a set of connected pixels. [1] Then compare the shapes to known shapes. Don't expect an exact match, do an approximate match. What overall properties can you reliably determine for the shape? Aspect ratio? Holes in the middle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] At this point, you can already draw circles around each shape that's not too big nor too small.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2015-02-24T11:13:13.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21715" PostTypeId="1" AcceptedAnswerId="21726" CreationDate="2015-02-24T14:32:26.330" Score="0" ViewCount="269" Body="&lt;p&gt;Consider a simple first-order RC filter with AWGN input noise with single-sided density of No. We know the output noise power is No/(4RC). What is rarely noted is that this is true after steady-state has been reached. I simulated the noise from such a filter starting from rest at t=0 and found that the ensemble average of the instantaneous noise power seems to increase from 0 to No/(4RC) exponentially with a time constant of RC/2, not the circuit time constant of RC.&#xA;Can anyone derive the equation for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to clarify this is input noise that is switched on by a unit-step at t=0 at the input to the filter.&#xA;So I am guessing the usual analysis based on the assumption of stationarity probably does not apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;John&lt;/p&gt;&#xA;" OwnerUserId="14838" LastEditorUserId="14838" LastEditDate="2015-02-25T12:03:05.893" LastActivityDate="2015-02-25T12:03:05.893" Title="Noise power transient at output of RC filter" Tags="|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21716" PostTypeId="2" ParentId="21696" CreationDate="2015-02-24T14:34:25.110" Score="0" Body="&lt;p&gt;There is a &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/automatically-detect-and-recognize-text-in-natural-images.html&quot; rel=&quot;nofollow&quot;&gt;text detection example&lt;/a&gt; in the Computer Vision System Toolbox in MATLAB. It is not a built-in function, but it uses many built-in functions.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-02-24T14:34:25.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21717" PostTypeId="2" ParentId="21702" CreationDate="2015-02-24T15:46:25.077" Score="2" Body="&lt;p&gt;I dont understand the definition of the chirp in the link you provided (perhaps chirp in frequency domain?), but maybe the following explanation could help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, a linear chirp with a varying frequency given by $$f(t) = \alpha + \beta t$$ is defined by $$ x_1(t) = e^{2\pi j (\alpha t + 0.5\beta t^2)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, the phase of $x_1(t)$, &lt;strong&gt;the signal in time-domain&lt;/strong&gt;, is indeed parabolic and the magnitude is constant and equals to 1.&lt;br&gt;&#xA;Now, I am not familiar with python, but the &lt;code&gt;chirp&lt;/code&gt; function in matlab produces a real signal rather than complex one. That is $$ x_2(t) = \sin(2\pi  (\alpha t + 0.5\beta t^2)) $$ In that case, you will get different results. However, you can use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow&quot;&gt;Hilbert transform&lt;/a&gt; (I guess &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.hilbert.html&quot; rel=&quot;nofollow&quot;&gt;this is in python)&lt;/a&gt; which, given $x_1(t)$ will produce $x_2(t)$ using &lt;code&gt;fft&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="80" LastEditDate="2015-02-24T17:06:42.267" LastActivityDate="2015-02-24T17:06:42.267" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21719" PostTypeId="2" ParentId="15927" CreationDate="2015-02-24T18:08:00.827" Score="1" Body="&lt;p&gt;My transform, EST, finds exactly what you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps of EST are as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let N be the number of exponentials.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the LPC (Linear Prediction Coefficients) for the signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For the sake of simplicity I will assume that all the exponential bases (the z values) are complex. The size of the LPC has to be 2N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You must have at least 4N samples.&#xA;Case 1 is when you have exactly 4N samples. Create a system of linear equations with the Hankel matrix and the last 2N samples as the results vector. The LPC vector is the solution to this system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Case 2 is when you have more than 4N samples. In this case you find the LPC using the covariance method. &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert the LPC vector to a prediction polynomial, exactly as LSP (Line Spectral Pairs) is doing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the roots of the polynomial.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The roots of the polynomial are the exponential bases you are looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal is noise-free, then the exponential bases are precise. If not, it is an estimate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the exponential bases are known, finding the coefficients (the c values), is simply a matter of linear equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also asked if you can find the number of exponentials.&#xA;In the case of a noise-free signal: yes.&#xA;Otherwise, you should find a large enough number of exponentials and filter out some of them.&#xA;Please note that each exponential base holds a frequency and the growth/decay rate of the signal at that frequency and each coefficient holds an amplitude and a phase. These parameters can be used for filtering criteria.&lt;/p&gt;&#xA;" OwnerUserId="14840" LastActivityDate="2015-02-24T18:08:00.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21720" PostTypeId="2" ParentId="14093" CreationDate="2015-02-24T18:56:12.513" Score="1" Body="&lt;p&gt;Suppose your beam has ten vertical degree of freedom. You can only apply CS to compress measurement vector of each DOF. You can not reconstruct all of the responses using limited number of them.&#xA;The ten-dof structure would have ten pick- related to ten natural frequency- in frequency domain, so its sparsity has been already guaranteed. Hope this help.  &lt;/p&gt;&#xA;" OwnerUserId="14806" LastActivityDate="2015-02-24T18:56:12.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21721" PostTypeId="2" ParentId="21700" CreationDate="2015-02-24T21:07:41.620" Score="1" Body="&lt;p&gt;i dunno if this is a technique oft discussed in the field of steganography, but &lt;a href=&quot;http://en.wikipedia.org/wiki/Steganography#Digital_messages&quot; rel=&quot;nofollow&quot;&gt;this is the first technique mentioned for digital data&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you embed your hidden message in the least-significant bit (LSB) of every sample word in the audio.  i have used this to hide (from audibility) metadata about the audio.  i have, in the past, embedded pitch detection data in the LSB of a stream of 16-bit audio words.  the result is that the true audio was really 15-bit and the hidden embeded data (from the POV of audio was random or noisy bits in the LSB) would just sound like a form of added noise, similar to quantization noise (as if the LSB was always zero).  to best mask this metadata from the sound, &lt;a href=&quot;http://en.wikipedia.org/wiki/Noise_shaping&quot; rel=&quot;nofollow&quot;&gt;noise-shaping or error-shaping&lt;/a&gt; is employed at the 15 bit quantization level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the result is that your meta-data is a stream of bits, one bit per sample of audio.  you'll need to worry about framing and synchronization of that data so you know where the beginning of every meta-data frame is.  the way i did it was similar to the old &lt;a href=&quot;http://en.wikipedia.org/wiki/Synchronous_Data_Link_Control&quot; rel=&quot;nofollow&quot;&gt;SDLC&lt;/a&gt; in that i chose some &lt;a href=&quot;http://en.wikipedia.org/wiki/Magic_number_%28programming%29#Magic_numbers_in_protocols&quot; rel=&quot;nofollow&quot;&gt;&quot;magic number&quot;&lt;/a&gt; as a prefix (this is in the serial data from the LSBs of the audio words) to mark the beginning of a frame of metadata.  say that prefix is 0b11111111, eight 1 bits in a row.  if the meta data &lt;strong&gt;ever&lt;/strong&gt; needed to have seven 1 bits in a row, whether or not the next bit was a 1, i would insert an extra 0 into the stream that the receiver knew to take out.  each time this would occur in the serial data, this would make the serial stream 1 bit longer for the frame than would otherwise be required.  that way eight 1 bits in a row could &lt;strong&gt;only&lt;/strong&gt; mean a frame start marker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;actually i would not use 0b11111111 because it &lt;em&gt;would&lt;/em&gt; occur in data often, so i analyzed a stream of actual metadata with a C program to see what 8-bit sequences occurred least often.  and of the least common 8-bit sequences i would pick the one with the first 7 bits occurring least often.  that would be my choice for a frame marker.  whatever was the last bit of that 8-bit marker, i would insert the opposite of that bit if i ever saw the uncommon 7-bit sequence in the stream of data and when the receiver would see the same 7 bits (and it wasn't the 8-bit marker), it would remove that bit from the stream.  so there was no possibility of an accidental combination of data falsely screwing up my metadata framing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so whether this metadata is an image or something else doesn't matter.  it's just data.  of course, if the audio is compressed or processed in any normal manner, it will kill this metadata unless you strip it out and put it back in after processing.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-02-24T21:07:41.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21723" PostTypeId="1" AcceptedAnswerId="21725" CreationDate="2015-02-24T21:45:06.117" Score="1" ViewCount="1844" Body="&lt;p&gt;At first, I want to say that I'm totally beginner in DSP and I don't have enough math education to understand Fast-Fourier transformation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a programmer and I want to archieve something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1j1Cy.jpg&quot; alt=&quot;Spectrum in VLC&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My example file is in 8kHz, 16-bit samples, but currently, I'm trying to do with my own raw data - one sin(x) function. I know that I need to pass &lt;em&gt;N&lt;/em&gt; samples to FFT function, but how interpret result? As I see, FFT need some input data (&lt;em&gt;N&lt;/em&gt; samples) and gives &lt;em&gt;N&lt;/em&gt; output data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How I can know where is frequency and scale it - for example - to 5 scopes like 0 - 200Hz, 200 - 400Hz etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or maybe I don't understand FFT correctly? I think that I can pass some samples and get information  &quot;how much&quot; is each frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Technically, I'm using &lt;code&gt;FFTW3&lt;/code&gt; library.&lt;/p&gt;&#xA;" OwnerUserId="14845" LastEditorUserId="7092" LastEditDate="2015-02-24T21:47:42.287" LastActivityDate="2015-02-25T01:45:13.837" Title="Beginner - use FFT to display spectrum/equalizer" Tags="|fft|c|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21724" PostTypeId="1" AcceptedAnswerId="21737" CreationDate="2015-02-24T22:53:18.400" Score="-1" ViewCount="764" Body="&lt;p&gt;Have following questions about Fixed point conversion format.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose I want to change Fixed Point format as  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;X1(m1,n1) (→) X2(m2,n2),m1+n1=m2+n2[Word length same],  n2&gt;n1[ Higher Fractionlength] &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose  X1=00001100 and suppose I do X1&amp;lt;&amp;lt;(2^3)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1)  If I interpret X1 as pure Signed integer, then X1= 12 and above operation means&#xA; Multiply by 2^(n2-n1)=8 so that X2= 01100000 = 96. (Decimal point is irrelevant here?). Is the interpretation correct?&lt;br&gt;&#xA;  or&#xA; Assuming Fixed point  notation, above means&lt;br&gt;&#xA; X1(m1,n1) (→) X2(m1-K,n1+k),m1+n1=m2+n2[Word length same],  n2&gt;n1[ Higher Fractionlength]  and k=n2-n1&#xA;  For given example, this means X1(3,5)=000.011 00(0.375)(→) X2(0,8)=  .01100000=0.375&lt;br&gt;&#xA;  So, the value remained same.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2) Can we always interpret this as decimal point being fixed and bits moved left?Is this a logical shift or arithmatic shift? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q3) Ideally, we would like to preserve resolution and range covered. Under what condition would this be guaranteed for the above shift? for example, consider following conversions:  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Consider  X1(3,5)=101.011 00(5.375)(→) X2(0,8) is 101.01100&amp;lt;&amp;lt;3 = .01100000 =0.375.So, we have error.&lt;br&gt;&#xA;   Q4) Is this rounding or truncation and why?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider  X1(m1n1) = 000...0 . abc......z  , [m1 = all zeroes],  X1 &amp;lt;&amp;lt; k = X1(m1-k,m1+k) where k&amp;lt;=m1&lt;br&gt;&#xA;            would  not change the value, as bits to the left and right  of decimal point remain same   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q5) So, if fixed point fractional notation is assumed( Positive fraction, with magnitude &amp;lt;1), Left shifts smaller than integer word length would preserve the fractional value?&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose I have fixed point number X1(m1,n1) with Word length m1+n1. Suppose  I want to express&lt;br&gt;&#xA;it in X2(m2,n2) format so that Word length is reduced ,Fraction length is increased, Integer Word length reduced    but the value remains the same.For example:&lt;br&gt;&#xA;X1(3,5) = 000.01100(0.375) -&gt; X2(1,6)&lt;br&gt;&#xA;Steps for above could be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Left shift by n2-n1 bits so that 000 011 00 &amp;lt;&amp;lt;1 = 000 110 00&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep Least Significant m2+n2 bits so that X2 = 0.011000(0.375) or Keep Most Significant m2+n2 bits so that X2 = 0.001100(0.1875)   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q6) If I was writing a routine that would automatically do conversion, )(say this was Sum result that needed to be converted to output (m2.n2) format automatically), how are what decides whether I keep LS or MS bits or doing a left or right shift?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose I have fixed point number X1(m1,n1) with Word length m1+n1. Suppose  I want to express  it in X2(m2,n2) format so that Word length is increased ,Fraction length is increased but the value remains the same.For example:&lt;br&gt;&#xA; X1(3,5) = 100.01100(-3.625) -&gt; X2(3,13)&lt;br&gt;&#xA;and  X1(3.5) = 100.01100(-3.635) -&gt; X2(1,11)   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q7) How can I go about that?  What would be steps if result required increase in Word length and Integer Word Length?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose I need to convert Fixed Point number as per&lt;br&gt;&#xA;X1(m+1,n) (→) X2(m,n)[ Word length reduced, Fraction length same, integer Word length reduced] &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the references I found says do following :&lt;br&gt;&#xA;  (x1)&amp;amp;(0xff..e) and keep MS m2+n2 bits&lt;br&gt;&#xA;  With X1(1,4) = 0.1011(0.875) this becomes 0.101 = 0.75  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other says: Do left shift by 1 and Keep Ms m2+n2 bits&#xA;With X1(1,4) = 1.011(0.875) this becomes 1.011(0.625)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, i don't perverse the value.&lt;br&gt;&#xA;Q8) Is there a correct way to do it and the logic behind it?   &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know these are lot of questions but it will help me clear lot of confusing stuff.&lt;br&gt;&#xA;Thanks&lt;br&gt;&#xA;sedy&lt;/p&gt;&#xA;" OwnerUserId="11096" LastActivityDate="2015-02-25T13:58:33.850" Title="Fixed point conversions" Tags="|fixed-point|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21725" PostTypeId="2" ParentId="21723" CreationDate="2015-02-25T01:28:19.530" Score="2" Body="&lt;p&gt;I think we need a little more information to fully answer your question.  Most FFT routing (like FFTW) provide many different ways to call the transform, and the return result will depend on exactly what routine you call, and how you call it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said the standard disclaimer, if you perform an FFT on $N$ real data points, you will get back $N/2$ unique complex points.  The basic algorithm though will assume your $N$ real points are $N$ complex points with zero imaginary parts.  Many routines will thus return $N$ complex points, but the second half will be (in the case of real input) hermitian symmetric (that is, point $N/2+i$ will be the complex conjugate of point $N/2-j$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, start by recognizing that your result is complex numbers, not real, and you will need to at least plot the &quot;square&quot; ($xx^*$) or each point.  If you have the real and imaginary points returned as $X_r$ and $X_i$, then you want to plot $X_r^2+X_i^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you are probably pretty close.  You will want to consider a few other things: windowing your input data, and averaging your output data.  To do the first, you need to perform the transform on weighted data, rather than your direct data.  See &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Window_function&lt;/a&gt; for more info.  You will simply hand the FFT function data of the form $W_k   {x_k}$ instead of just the $x_k$ (where $k$ is the index number).  This will be particularly important if you use a fractional frequency in your sin function (try it, you'll see).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The averaging step involves averaging the squared output. You will simply want to average a few outputs, point by point, together.  You will also often want to plot the output as a logarithm though, instead of simply plotting the squared output.&lt;/p&gt;&#xA;" OwnerUserId="14765" LastEditorUserId="7092" LastEditDate="2015-02-25T01:45:13.837" LastActivityDate="2015-02-25T01:45:13.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21726" PostTypeId="2" ParentId="21715" CreationDate="2015-02-25T04:17:49.560" Score="0" Body="&lt;p&gt;Consider a simple RC filter whose &lt;em&gt;step&lt;/em&gt; response is $1-e^{-t/RC}$ for $t &amp;gt; 0$,&#xA;and impulse response is&#xA;$$h(t) = \begin{cases} \frac{1}{RC}e^{-t/RC}, &amp;amp; t \ge 0,\\ 0, &amp;amp;t &amp;lt; 0.\end{cases}$$&#xA;Then, when the input is white noise, the steady-state output variance is&#xA;$$\sigma^2 = \frac{N_0}{2} \int_{-\infty}^\infty h^2(t)\,\mathrm dt&#xA;= \frac{N_0}{2}\int_0^\infty \frac{1}{(RC)^2}e^{-2t/RC}\,\mathrm dt = \frac{N_0}{4RC}.$$&#xA;However, if the input noise is also $0$ for $t &amp;lt; 0$, then at time $T$, the&#xA;noise variance at the output is&#xA;$$\begin{align}&#xA;\sigma_T^2 &amp;amp;= E\left[\int_0^T N(t)\frac{1}{RC}e^{-(T-t)/RC}\,\mathrm dt&#xA;\int_0^T N(s)\frac{1}{RC}e^{-(T-s)/RC}\,\mathrm ds\right]\\&#xA;&amp;amp;= \int_0^T\int_0^T E[N(t)N(s)]\frac{1}{(RC)^2}e^{-(2T-t-s)/RC}&#xA;\,\mathrm dt\,\mathrm ds\\&#xA;&amp;amp;= \int_0^T\int_0^T \frac{N_0}{2}\delta(t-s)\frac{1}{(RC)^2}e^{-(2T-t-s)/RC}&#xA;\,\mathrm dt\,\mathrm ds\\&#xA;&amp;amp;= \int_0^T \frac{N_0}{2}\frac{1}{(RC)^2}e^{-(2T-2s)/RC}&#xA;\,\mathrm ds\\&#xA;&amp;amp;= \frac{N_0}{4RC}e^{-2T/RC}\int_0^T \frac{2}{RC}e^{2s/RC}\,\mathrm ds\\&#xA;&amp;amp;= \frac{N_0}{4RC}e^{-2T/RC}[e^{2T/RC}-1]\\&#xA;&amp;amp;= \left.\left.\frac{N_0}{4RC}\right[1 - e^{-2T/RC}\right]&#xA;\end{align}$$&#xA;showing that $\sigma_T^2$ increases to its asymptotic value &#xA;$\displaystyle \sigma^2 = \frac{N_0}{4RC}$ more rapidly than the unit step&#xA;response increases to its asymptotic value $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;time constant&lt;/strong&gt; of the RC circuit is $RC$, &lt;em&gt;not&lt;/em&gt; $1/RC$ as the OP&#xA;claims, and the time constant of the increase in the noise variance is&#xA;$RC/2$, &lt;em&gt;half&lt;/em&gt; that of the RC circuit. The smaller the time constant,&#xA;the more rapid the decay to $0$  (or rise to the asymptotic value).&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="4298" LastEditDate="2015-02-25T08:15:38.320" LastActivityDate="2015-02-25T08:15:38.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21727" PostTypeId="1" AcceptedAnswerId="21731" CreationDate="2015-02-25T06:50:37.737" Score="2" ViewCount="1263" Body="&lt;p&gt;I am working on an image processing project in java where we use anisotropic diffusion for scale space generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the below equation, after finding the diffusion value.using the second equation, I do not know how to find the divergence of diffusivity and gradient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qZpZp.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5WCci.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I am getting the diffusivity as a float value. I do not know how to find the divergence of that.can anyone please help me.&lt;/p&gt;&#xA;" OwnerUserId="14849" LastEditorUserId="7092" LastEditDate="2015-02-25T12:41:39.107" LastActivityDate="2015-03-06T17:38:51.610" Title="How to implement anisotropic diffusion using java?" Tags="|java|anisotropic-diffusion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21728" PostTypeId="1" AcceptedAnswerId="21735" CreationDate="2015-02-25T09:31:21.840" Score="0" ViewCount="294" Body="&lt;p&gt;As I know if the impulse response is symmetric around sample zero phase response should be entirely zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below just set a rectangular window for vector &quot;in&quot; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;const int N = 10;&#xA;&#xA;// in = 0 , 0 , 0 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 0&#xA;std::vector&amp;lt; std::complex&amp;lt;double&amp;gt; &amp;gt; in (N);&#xA;std::vector&amp;lt; std::complex&amp;lt;double&amp;gt; &amp;gt; out (N);&#xA;std::vector&amp;lt; std::complex&amp;lt;double&amp;gt; &amp;gt; polarOut (N);&#xA;&#xA;auto middleElem = in.begin() + in.size()/2;&#xA;std::fill( middleElem - 1, middleElem + 2, 1);&#xA;&#xA;fftw_plan my_plan  = fftw_plan_dft_1d(N, reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(&amp;amp;in[0]),&#xA;                                         reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(&amp;amp;out[0]), FFTW_FORWARD, FFTW_ESTIMATE);&#xA;fftw_execute(my_plan);&#xA;&#xA;std::transform( out.begin(), out.end(), polarOut.begin(),&#xA;                []( auto&amp;amp; in ){&#xA;                                return  std::complex&amp;lt;double&amp;gt;( std::abs(in), std::arg(in) );&#xA;                              } );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I getting back a sinc like result in magnitude, &#xA;But I am so curious why I have values different than zero in phase : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    polarOut    &amp;lt;11 items&amp;gt;  std::vector&amp;lt;std::complex&amp;lt;double&amp;gt;&amp;gt;&#xA;        [0] (3.000000, 0.000000)    std::complex&amp;lt;double&amp;gt;&#xA;        [1] (2.682507, -2.855993)   std::complex&amp;lt;double&amp;gt;&#xA;        [2] (1.830830, 0.571199)    std::complex&amp;lt;double&amp;gt;&#xA;        [3] (0.715370, -2.284795)   std::complex&amp;lt;double&amp;gt;&#xA;        [4] (0.309721, -1.999195)   std::complex&amp;lt;double&amp;gt;&#xA;        [5] (0.918986, 1.427997)    std::complex&amp;lt;double&amp;gt;&#xA;        [6] (0.918986, -1.427997)   std::complex&amp;lt;double&amp;gt;&#xA;        [7] (0.309721, 1.999195)    std::complex&amp;lt;double&amp;gt;&#xA;        [8] (0.715370, 2.284795)    std::complex&amp;lt;double&amp;gt;&#xA;        [9] (1.830830, -0.571199)   std::complex&amp;lt;double&amp;gt;&#xA;        [10]    (2.682507, 2.855993)    std::complex&amp;lt;double&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any explanation about the phase response of behaviour of this fft will be great. &lt;/p&gt;&#xA;" OwnerUserId="5392" LastActivityDate="2015-02-25T11:58:19.517" Title="Phase response of FFT in practice" Tags="|fft|phase|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21730" PostTypeId="1" AcceptedAnswerId="48283" CreationDate="2015-02-25T10:16:56.440" Score="3" ViewCount="1125" Body="&lt;p&gt;In basis Pursuit, L1 minimization is done to perform compressed sensing. In the literature there is a $ \lambda $ parameter used as a regularizer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is its significance?&lt;/p&gt;&#xA;" OwnerUserId="14851" LastEditorUserId="128" LastEditDate="2018-07-07T22:14:19.980" LastActivityDate="2018-07-07T22:14:19.980" Title="Significance of $ \lambda $ in Basis Pursuit" Tags="|signal-analysis|compressive-sensing|optimization|convex-optimization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21731" PostTypeId="2" ParentId="21727" CreationDate="2015-02-25T10:32:09.597" Score="2" Body="&lt;p&gt;I coded a modest Java implementation of the Perona &amp;amp; Malik anisotropic diffusion, based on the ImgLib2 library. You can find it &lt;a href=&quot;https://github.com/imglib/imglib2-algorithm-gpl/blob/master/src/main/java/net/imglib2/algorithm/pde/PeronaMalikAnisotropicDiffusion.java&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will have to import and learn how to use the &lt;a href=&quot;http://fiji.sc/ImgLib2&quot; rel=&quot;nofollow&quot;&gt;ImgLib2&lt;/a&gt; library though. Here is &lt;a href=&quot;https://github.com/imglib/imglib2-tests/blob/master/src/test/java/net/imglib2/algorithm/pde/PeronaMalikAnisotropicDiffusionExample.java&quot; rel=&quot;nofollow&quot;&gt;an example&lt;/a&gt; using the anisotropic diffusion algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, &lt;a href=&quot;http://rsb.info.nih.gov/ij/plugins/download/Anisotropic_Diffusion_2D.java&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; is a 2D only implementation, by Vladimir Pilny and Jiri Janacek, made for the &lt;a href=&quot;http://rsb.info.nih.gov/ij/index.html&quot; rel=&quot;nofollow&quot;&gt;ImageJ&lt;/a&gt; software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And &lt;a href=&quot;http://rsb.info.nih.gov/ij/plugins/anisotropic-diffusion.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; is another one for ImageJ as well, by Christopher Mei.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards.&lt;/p&gt;&#xA;" OwnerUserId="756" LastEditorUserId="756" LastEditDate="2015-02-25T10:38:30.110" LastActivityDate="2015-02-25T10:38:30.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21732" PostTypeId="2" ParentId="21728" CreationDate="2015-02-25T11:19:52.667" Score="1" Body="&lt;p&gt;Those are complex conjugates, which when you add give only , the real part. Intuitively exp(jwo)+exp(-jwo). so  the resulting phase has the form invtan(imaginary_part/real_part) (invtan is tan inverse function), where b is o. so the phase spectrum will only have zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is the angles obtained, from a+jb is theta, and from that of a-jb is -theta. Both will sum up to give zero.&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2015-02-25T11:19:52.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21733" PostTypeId="2" ParentId="21730" CreationDate="2015-02-25T11:35:50.007" Score="3" Body="&lt;p&gt;This parameter control sparsity of the basis. Look for articles on L1 norm &quot;oracle property&quot;. In essence, by minimizing the L1 norm you're driving your representation to have few non-zero components. The lambda tunes how much of your squared error vs. L1 norm you pay most attention to. Large lambda means you care a lot about sparsity, but not exact matching. Small lambda gives you the opposite. This can also be looked at as a bias-variance tradeoff of your learner.&lt;/p&gt;&#xA;" OwnerUserId="6" LastActivityDate="2015-02-25T11:35:50.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21734" PostTypeId="1" CreationDate="2015-02-25T11:52:22.220" Score="4" ViewCount="222" Body="&lt;p&gt;Consider the cost function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(X,\lambda) = \|AX-b\|_2^2 + \alpha \|LX\|_2^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A:$Measurement matrix($R_{m\times n}$,$m \ll n$), $b:$observation vector($R_m$), $L:$Laplacian operator($R_{n \times n}$), $X:$vector form of an image($R_n$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The above cost function can be read, non-mathematically as minimize &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$AX=b+error$ subject to $LX=0$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial f}{dX} = 0 \implies 2X^T(A^TA) - 2X^T(A^Tb)+\lambda(L^TL) = 0.........(1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial f}{d\lambda} = 0 \implies \|LX\|_2^2=0.........(2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(1)$ $X_s = (A^TA+\lambda L^TL)^{-1}A^Tb.........(3)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(3)$ in $(2) \implies \|LX_s\|^2_2 = 0..........(4)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is very clear from $(3),$ $\lambda$ plays a very crucial role in solving for $X$ because changing the value of $\lambda$ gives a different estimate for $X$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using $(4),$ is it not possible to auto compute the optimal value of $\lambda$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is possible to auto compute optimal $\lambda,$ why is it in many image de-noising problems we specify the optimal lambda $\lambda$ as an input to the algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It it is not possible to auto compute $\lambda,$ why is it so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading my question with patience..&lt;/p&gt;&#xA;" OwnerUserId="13628" LastEditorUserId="37293" LastEditDate="2018-08-19T21:11:31.050" LastActivityDate="2024-04-01T22:03:40.440" Title="Regularized Least Squares by Laplacian Operator - Optimal Value of the Regularization Factor (Lagrangian Multiplier)" Tags="|image-processing|optimization|least-squares|convex-optimization|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="21735" PostTypeId="2" ParentId="21728" CreationDate="2015-02-25T11:58:19.517" Score="4" Body="&lt;p&gt;The problem is that your input vector is &lt;em&gt;not&lt;/em&gt; symmetric when considering the definition of the DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that from (1) the time indices start at $n=0$. If you periodically continue the signal $x[n]$ in your example you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;n:    ... -5 -4 -3 -2 -1 | 0 |  1  2  3  4  5  6  7  8  9  10&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x[n]: ...  1  0  0  0  0 | 0 |  0  0  0  1  1  1  0  0  0  0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $x[n]$ were symmetric, the values for negative $n$ would need to be the same as the values for positive $n$. For $n=\pm 4$ this is not the case. If you defined your signal instead as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x[n] = 0 0 0 0 1 1 1 0 0 0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. a signal of length $N=10$, then it would be symmetric and, consequently, its DFT (FFT) would be real-valued, apart from numerical errors.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-25T11:58:19.517" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21736" PostTypeId="2" ParentId="21691" CreationDate="2015-02-25T12:22:42.903" Score="13" Body="&lt;p&gt;The basic technique to place a mono source in stereo is called &lt;em&gt;constant power panning&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to place a mono source at angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; you can just use &lt;span class=&quot;math-container&quot;&gt;$A_\mathrm{amp}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_\mathrm{amp}$&lt;/span&gt; as amplitudes for your channels:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A_\mathrm{amp} = \frac{\sqrt{2}}{2} (\cos{\theta} + \sin{\theta})$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$B_\mathrm{amp} = \frac{\sqrt{2}}{2} (\cos{\theta} - \sin{\theta})$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; ranges from &lt;span class=&quot;math-container&quot;&gt;$-45^{\circ}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$45^{\circ}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$0^{\circ}$&lt;/span&gt; being the center.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope, that helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: Roads, Curtis (1996). &lt;em&gt;The Computer Music Tutorial&lt;/em&gt;. Cambridge: The MIT Press, pp. 457–461.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can put it in code directly. E.g. if you use Python and you have mono audio in a numpy array, you can convert it into stereo by a given angle like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def panner(x, angle):&#xA;    &quot;&quot;&quot;&#xA;    pan a mono audio source into stereo&#xA;    x is a numpy array, angle is the angle in radiants&#xA;    &quot;&quot;&quot;&#xA;    left = np.sqrt(2)/2.0 * (np.cos(angle) - np.sin(angle)) * x&#xA;    right = np.sqrt(2)/2.0 * (np.cos(angle) + np.sin(angle)) * x&#xA;    return np.dstack((left,right))[0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use it like &lt;code&gt;panner(np.array([1,2,3]), np.radians(20))&lt;/code&gt;. (Of course &lt;code&gt;[1,2,3]&lt;/code&gt; is a quite pointless audiobuffer.)&lt;/p&gt;&#xA;" OwnerUserId="8462" LastEditorUserId="8462" LastEditDate="2018-12-17T16:10:15.577" LastActivityDate="2018-12-17T16:10:15.577" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="21737" PostTypeId="2" ParentId="21724" CreationDate="2015-02-25T13:35:06.120" Score="4" Body="&lt;p&gt;As mentioned in the comments, your question is pretty confusing and confused, so I might not be able to answer all your smaller questions, but I'll try to shed some light on the topic. This should help you understand what's going on, and hopefully this understanding will help you answer all further questions by yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following I assume &lt;a href=&quot;http://en.wikipedia.org/wiki/Two%27s_complement&quot; rel=&quot;nofollow&quot;&gt;two's complement&lt;/a&gt; representation. Note that if $M$ is the word length, and $n$ is the number of fractional bits, a number $x$ is represented as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x=K\cdot 2^{-n}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $K$ is an integer is the range $[-2^{M-1},2^{M-1}-1]$. Now if you want to change the number of fractional bits to $m$, you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x=L\cdot 2^{-m}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining (1) and (2) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$L=K\cdot 2^{m-n}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $m&amp;gt;n$, $K$ needs to be left-shifted by $m-n$ bits to obtain $L$. This means that you lose range (i.e. the maximum number that can be represented becomes smaller), so there is a possibility of overflow. If $m&amp;lt;n$, $L$ is obtained from $K$ by right-shifting $n-m$ bits, but for two's complement you need to replicate the sign bit, i.e. if the original sign bit was set, the new right-shifted number must also have the sign bit set. For $m&amp;lt;n$ you can lose precision because the resolution is reduced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example makes things easier to see. Let $M=6$, i.e. the integer $K$ is in the range $[-32,31]$. Let the number of fractional bits be $n=3$. E.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x=\texttt{101.011}=(-2^{5}+2^{3}+2^{1}+2^{0})\cdot 2^{-3}=-21\cdot 2^{-3}=-2.625$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to change the number of fractional bits to $m=2$, you need to do an arithmetic right-shift, resulting in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y=\texttt{1101.01}=-11\cdot 2^{-2}=-2.75\neq x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. precision is lost. If instead we want $m=4$ fractional bits we need to do a left-shift resulting in overflow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y=\texttt{01.0110}=22\cdot 2^{-4}=1.375\neq x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is clear because by increasing resolution we have decreased the range of possible numbers to $[-32,31]\cdot 2^{-4}=[-2,1.9375]$, which makes it impossible to represent the original value $x=-2.625$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are of course examples where you would neither lose precision nor would you get overflow. E.g. (again with $M=6$ and $n=3$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x=\texttt{001.010}=10\cdot 2^{-3}=1.25$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $m=2$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y=\texttt{0001.01}=5\cdot 2^{-2}=1.25 = x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. no loss in precision, and for $m=4$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y=\texttt{01.0100}=20\cdot 2^{-4}=1.25=x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. no overflow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that this addressed at least some of your questions and that things have become a bit clearer. If you haven't done it yet, you should check out the basics &lt;a href=&quot;http://en.wikipedia.org/wiki/Fixed-point_arithmetic&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Two%27s_complement&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, and &lt;a href=&quot;http://en.wikipedia.org/wiki/Arithmetic_shift&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-25T13:35:06.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21738" PostTypeId="2" ParentId="21724" CreationDate="2015-02-25T13:58:33.850" Score="1" Body="&lt;p&gt;I am not able properly catch up with your Q, as you could have projected it in a much better way. However, I noticed that your facing problems understanding concepts relevant to fixed point arithmetic operations. At present, I am working on developing a fixed point resampling algorithm and came across this amazing write up by &quot;Randy Yates&quot; and it explains it all!. Check out this-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.digitalsignallabs.com/fp.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.digitalsignallabs.com/fp.pdf&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure it will be of great help in understanding fixed point operations. As it did for me :)&lt;/p&gt;&#xA;" OwnerUserId="9152" LastActivityDate="2015-02-25T13:58:33.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21739" PostTypeId="1" CreationDate="2015-02-25T14:21:27.800" Score="0" ViewCount="6927" Body="&lt;p&gt;How to check if a continuous signal is Periodic or not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My notes says&#xA;$\cos(\frac{3}{2}\pi t)$ is periodic because $T=4/3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And $\cos(\frac{3}{2}t)$ is not periodic as $T=4\pi/3$.&lt;/p&gt;&#xA;" OwnerUserId="14855" LastEditorUserId="1606" LastEditDate="2015-02-25T14:37:08.933" LastActivityDate="2015-02-25T14:37:08.933" Title="How to check whether a continuous signal is periodic or not?" Tags="|signal-analysis|continuous-signals|periodic|" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="21741" PostTypeId="1" CreationDate="2015-02-25T15:52:38.383" Score="0" ViewCount="88" Body="&lt;p&gt;I would like to make a mathematical comparison between two methods in my field. One smooths with a Gaussian filter, and one smooths using a second-order Savitsky-Golay filter. Let's say the window size is the same in each case. Is there any way to formally compare these two approaches in terms of their impact on a function f? Can one be expressed in terms of the other, or in some common framework?&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2015-02-25T15:52:38.383" Title="Relation between Gaussian and Savitsky-Golay kernels" Tags="|filters|window-functions|gaussian|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21742" PostTypeId="1" AcceptedAnswerId="21743" CreationDate="2015-02-25T16:50:26.977" Score="0" ViewCount="409" Body="&lt;p&gt;When impulse response is symmetric around sample zero phase entirely zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in = 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 , 0 -&gt; This gives zero phase result &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I know if I apply a delay in time domain this should result a linear phase in frequency domain. So if I delay my previous vector by one;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in = 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 -&gt; This should give linear phase responce&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;const int N = 11;&#xA;&#xA;// in = 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 &#xA;std::vector&amp;lt; std::complex&amp;lt;double&amp;gt; &amp;gt; in (N);&#xA;std::vector&amp;lt; std::complex&amp;lt;double&amp;gt; &amp;gt; out (N);&#xA;std::vector&amp;lt; std::complex&amp;lt;double&amp;gt; &amp;gt; polarOut (N);&#xA;&#xA;auto middleElem = in.begin() + in.size()/2;&#xA;//std::fill( middleElem - 1, middleElem + 3, 1); //zero phase&#xA;std::fill( middleElem, middleElem + 4, 1);&#xA;&#xA;fftw_plan my_plan  = fftw_plan_dft_1d(N, reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(&amp;amp;in[0]),&#xA;                                         reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(&amp;amp;out[0]), FFTW_FORWARD, FFTW_ESTIMATE);&#xA;fftw_execute(my_plan);&#xA;&#xA;std::transform( out.begin(), out.end(), polarOut.begin(),&#xA;                []( auto&amp;amp; in ){&#xA;                                return  std::complex&amp;lt;double&amp;gt;( std::abs(in), std::arg(in) );&#xA;                              } );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result of the fourier transform in polar notation is : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    polarOut    &amp;lt;11 items&amp;gt;  std::vector&amp;lt;std::complex&amp;lt;double&amp;gt;&amp;gt;&#xA;        [0] (4.000000, 0.000000)    std::complex&amp;lt;double&amp;gt;&#xA;        [1] (3.228707, 2.570394)    std::complex&amp;lt;double&amp;gt;&#xA;        [2] (1.397877, -1.142397)   std::complex&amp;lt;double&amp;gt;&#xA;        [3] (0.372786, -1.713596)   std::complex&amp;lt;double&amp;gt;&#xA;        [4] (1.088156, 0.856798)    std::complex&amp;lt;double&amp;gt;&#xA;        [5] (0.546200, -2.855993)   std::complex&amp;lt;double&amp;gt;&#xA;        [6] (0.546200, 2.855993)    std::complex&amp;lt;double&amp;gt;&#xA;        [7] (1.088156, -0.856798)   std::complex&amp;lt;double&amp;gt;&#xA;        [8] (0.372786, 1.713596)    std::complex&amp;lt;double&amp;gt;&#xA;        [9] (1.397877, 1.142397)    std::complex&amp;lt;double&amp;gt;&#xA;        [10]    (3.228707, -2.570394)   std::complex&amp;lt;double&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What am I missing here? Why phase responce is not linearly increasing? &lt;/p&gt;&#xA;" OwnerUserId="5392" LastActivityDate="2015-02-25T18:44:00.663" Title="Phase is not linear in frequency domain after delay in time domain" Tags="|fft|phase|linear-phase|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21743" PostTypeId="2" ParentId="21742" CreationDate="2015-02-25T18:44:00.663" Score="4" Body="&lt;p&gt;The phase is in fact linear, apart from jumps of $\pi$ at the zeros of the magnitude. There are two reasons why you don't see it:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;the phase you compute is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Argument_%28complex_analysis%29#Principal_value&quot; rel=&quot;nofollow noreferrer&quot;&gt;principal value&lt;/a&gt;, which is in $(-\pi,\pi]$. Note that you can always add or subtract a multiple of $2\pi$ to the phase without changing anything. Removing these artificial jumps due to the principal value is called &lt;em&gt;phase unwrapping&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;you only compute very few points, and due to point 1 above you just see an erratic behavior.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Solution:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;compute a more detailed DFT (by zero-padding the original signal)&lt;/li&gt;&#xA;&lt;li&gt;unwrap the phase (if you have Matlab/Octave, there's a command to do that)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here an example in Matlab/Octave:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;x = [0 0 0 0 0 1 1 1 1 0 0];&#xA;X = fft(x,512);         % length 512 FFT&#xA;ph = arg(X);            % wrapped phase&#xA;phu = unwrap(ph);       % unwrapped phase&#xA;plot((0:256),phu(1:257)/pi), grid on&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OyUCc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-02-25T18:44:00.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21744" PostTypeId="1" AcceptedAnswerId="21750" CreationDate="2015-02-25T19:37:41.473" Score="1" ViewCount="1588" Body="&lt;p&gt;Could anyone suggest the best algorithm for a real-time Car recognition (say in a parking space)?&#xA;I am planning to implement the same on FPGA as well. Kindly suggest.&#xA;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="14862" LastEditorUserId="7092" LastEditDate="2015-02-25T20:42:14.133" LastActivityDate="2015-02-26T04:22:54.410" Title="Best Car Recognition Algorithm" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21745" PostTypeId="1" AcceptedAnswerId="22486" CreationDate="2015-02-25T19:38:06.437" Score="0" ViewCount="127" Body="&lt;p&gt;I want to design a 2D IIR filter (that is, created line-by-line progressively, in this case from left-to-right).  What is the best way to go about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the response to look something vaguely like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z72dO.png&quot; alt=&quot;diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual shape in the x-axis (time) isn't important - what's important is that the response's width for the x-axis is proportional to the y-axis position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="14861" LastEditorUserId="14861" LastEditDate="2015-03-31T16:14:34.727" LastActivityDate="2015-04-02T08:36:49.690" Title="2D IIR filter design (x-axis width proportional to y-axis)" Tags="|filter-design|2d|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21746" PostTypeId="2" ParentId="21744" CreationDate="2015-02-25T20:45:52.093" Score="0" Body="&lt;p&gt;Try ISM : &lt;a href=&quot;http://www.cs.utexas.edu/~grauman/courses/spring2007/395T/395T/papers/leibe_2004.pdf&quot; rel=&quot;nofollow&quot;&gt;Implicit shape models&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-02-25T20:45:52.093" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21748" PostTypeId="2" ParentId="12691" CreationDate="2015-02-25T23:02:14.347" Score="0" Body="&lt;p&gt;This could be used to tell time of day.  Sunlight at high noon is more or less white.  Just after sunrise or just before sunset, there's a lot of orange.   At night, maybe there are sodium vapor parking lot lights putting out that lovely harsh yellow light which makes our cars look funky.  The image may have colored objects, green grass and trees, blue sky, so who knows what the average will turn out to be, but for a fixed camera looking at the same scene, changes in the average color could be used to tell time of day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another use: sometimes I assemble a few hundred photos of a slowly changing object, taken by  a fixed camera, into an animation.  There might not be any consistency in exposure or lighting.  Comparing average colors, I can tell (or rather, the algorithm I write in Python, can tell)  which images need correction.  Dividing each image by its average color, and multiplying by some standardized color, typically the average of all average colors, makes the individual frames consistent.&lt;/p&gt;&#xA;" OwnerUserId="133" LastActivityDate="2015-02-25T23:02:14.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21749" PostTypeId="1" CreationDate="2015-02-25T23:34:20.290" Score="2" ViewCount="50" Body="&lt;p&gt;I'm a newcomer to digital signal processing, so I'm looking for some general advice and direction on this problem I have. I have a signal like that shown below. Starting around x=40000, you can see a signal which has a periodicity of about 1 day (you can't tell it's 1 day from the figure), although there is various noise and other behavior along with it. Before this point, this behavior does not really occur (the process giving rise to the prior behavior has not yet started). What I'd like to do is determine this starting point, not visually, but from a computational approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ENYXq.png&quot; alt=&quot;Signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To look into this further, I computed the FFT of the above signal, and then computed its power spectrum as $FT(signal)*FT^{*}(signal)$. As you can see in the power spectrum below, the dominant contribution occurs at a frequency corresponding to 1 day. From this point I thought perhaps I could compute some measure of &quot;purity&quot; of this signal having this dominant mode, and by varying the starting point of the initial signal to process (by simply dropping the points at the beginning one by one and computing this &quot;purity&quot;) that I might be able to detect when this periodic signal starts (the assumption being that once I trim off the part of the signal before this process begins that I will achieve maximal &quot;purity&quot;).&#xA;&lt;img src=&quot;https://i.stack.imgur.com/oJYC7.png&quot; alt=&quot;Power&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there must be a better way of accomplishing this feat, and I also have not yet determined the best way to compute the power &quot;purity&quot; either. For those who know more on this topic, how would you approach it? Thanks in advance for any directions that you could point me. &lt;/p&gt;&#xA;" OwnerUserId="11368" LastActivityDate="2015-02-25T23:34:20.290" Title="Determining the point in a temporal signal when a periodic behavior begins to occur" Tags="|signal-analysis|frequency-spectrum|power-spectral-density|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21750" PostTypeId="2" ParentId="21744" CreationDate="2015-02-26T04:22:54.410" Score="0" Body="&lt;p&gt;Do you mean car &lt;em&gt;detection&lt;/em&gt; or &lt;em&gt;recognition&lt;/em&gt;?  Detection: where are all the cars?  Recognition: which car is this?  See: &lt;a href=&quot;https://dsp.stackexchange.com/questions/12940/object-detection-versus-object-recognition&quot;&gt;Object detection versus object recognition&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, the short form of the answer is to prototype the heck out of this, likely using OpenCV or libccv, your favorite neural network package, and as much horsepower as possible (several Nvidia GTX 980).  Don't worry about realtime-ness or implementation details, just get it working first.  The state of the art for object recognition and detection both is probably convolutional neural networks, check out stuff like AlexNet; there are simpler algorithms (eg Histogram of Oriented Gradient or HoG) which could do okay at detection, but not at recognition (there is a decent person detector using HoG, I think you can probably make a decent car detector in the same way).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running this on a FPGA is... unlikely: high-end desktop GPUs are very well suited to the problem, and orders of magnitude faster at it.  People are working on neural network ASICs now, should be ready in a couple of years.&lt;/p&gt;&#xA;" OwnerUserId="3650" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-02-26T04:22:54.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21751" PostTypeId="1" CreationDate="2015-02-26T04:40:12.933" Score="0" ViewCount="90" Body="&lt;p&gt;I have two signals Sa and Sb, both affected by the same noise.  I don't know how much noise is mixed into each one, and the signal+noise is transformed using some (unknown) nonlinear function before I get it.  If the original signals are Sa and Sb and the noise is N, what I actually have Ta = f1(Sa + k1*N) and Ta = f2(Sb + k2*N).  f1 and f2 are different.  I would like to get Sa and Sb, or possibly f1(Sa) and f2(Sb): ie the transforms are not especially of interest, but removing the shared noise is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transform functions f1 and f2 are monotonic and reasonably well behaved.  I think they are closely approximated by f(x) = c1*(x^c2 + c3) where c2 is typically 0.9-1.1.  In some cases f1 is approximately the same as f2, so I'm interested in a solution for f1 same as f2 also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signals are actually images; so there is quite a lot of data to work with, typically 1-4 million data points each in a pair of signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like a source separation or possibly deconvolution/guided filtering problem, but I can't really think of a good approach.  I can't even come up in with a good solution in the limited case when there are no transform functions... it is an under-determined problem, because given Ta = Sa+k1*N and Tb = Sb+k2*N, any arbitrary choice of N and k1 and k2 works for Sa = Ta-k1*N and Sb = Tb-k2*N.  I think there have to be some regularizing assumptions, like minimizing total variation of Sa, Sb and N, or minimizing cross-correlation, or some kind of other entropy based metric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; As requested, here is an image pair.  The highlighted black dot is not really in the images, it is due to debris in the optics, and present in both images in the exact same position (although: it has somewhat lower intensity in the second image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XqhwE.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/c82tQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/cmRsM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="3650" LastEditorUserId="128" LastEditDate="2018-05-12T09:30:11.390" LastActivityDate="2018-05-12T09:30:11.390" Title="Multi Image (Same Noise Realization) Denoising" Tags="|image-processing|deconvolution|source-separation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="21752" PostTypeId="1" CreationDate="2015-02-26T06:37:45.537" Score="0" ViewCount="856" Body="&lt;p&gt;I saw this question on one of the sites related to DFT:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The analog signal $x(t)$ is band-limited to $40\textrm{ Hz}$. Suppose the signal is sampled at the rate of $100\textrm{ samples/second}$ and that at this rate $200\textrm{ samples}$ are collected. Then $200$ zeros are appended to the $200\textrm{ samples}$ to form a $400$-point vector. Then the $400$-point DFT of this vector is computed to get&#xA;  $X[k]$ for $0 \leq k \leq 399$.&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Which DFT coefficients are free of aliasing?&lt;/li&gt;&#xA;  &lt;li&gt;The DFT coefficient $X[50]$ represents the spectrum of the analog signal at what frequency $f$?&#xA;  (Give your answer in $\textrm{Hz}$).&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer's provided were:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;All of the DFT coefficients are free of aliasing. The sampling rate is more that twice the maximum signal frequency.&lt;/li&gt;&#xA;  &lt;li&gt;The DFT bin width is $100/400$ or $0.25\textrm{ Hz}$. The $50^{\rm th}$ DFT coefficient corresponds to the frequency $50$ times&#xA;  $0.25\textrm{ Hz}$ or $12.5\textrm{ Hz}$&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not really sure if this is right because when you append zeros you are upsampling and the sampling rate becomes $400\textrm{ Hz}$. So when you take a $400$-point DFT the bins are seperated by $1\textrm{ Hz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if I am right or not. If I am wrong please explain the answer to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jose.&lt;/p&gt;&#xA;" OwnerUserId="11938" LastEditorUserId="1629" LastEditDate="2016-05-16T11:22:12.807" LastActivityDate="2016-05-16T11:22:12.807" Title="Sampling of a band-limited analog signal: DFT and aliasing" Tags="|discrete-signals|dft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21753" PostTypeId="1" CreationDate="2015-02-26T07:51:34.643" Score="1" ViewCount="6883" Body="&lt;p&gt;I have implemented DFT from &lt;a href=&quot;https://vgg.fiit.stuba.sk/2012-05/frequency-domain-filtration-source/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vision &amp;amp; Graphics Group at the Faculty of Informatics and Information Technologies STU - Frequency domain filtration&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Tried taking dft for the three Channels(R, G and B) and reconstructed the original image by taking inverse dft for all three channels and merged them together, but the image reconstructed doesnot have the same contrast as the original image.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;But while altering the flags used in the link as such&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  dft(input, Complex, DFT_SCALE);&#xA;  dft(Complex, InverseDFTImage, DFT_INVERSE + DFT_REALOUTPUT);&#xA;  InverseDFTImage.converTo(InverseDFTImage, CV_8U);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output is same as the input, but while applying Gaussian filter, there are few colour differences near the edges.&#xA;&lt;br&gt;&#xA;&lt;br&gt; 1. Original Input Image &#xA;&lt;br&gt; &lt;img src=&quot;https://i.stack.imgur.com/EQ8h8.png&quot; alt=&quot;Original Input image&quot; /&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt; 2. Output without any filters(followed the Procedure in the link) &#xA;&lt;br&gt; &lt;img src=&quot;https://i.stack.imgur.com/PZ3yT.png&quot; alt=&quot;Output without any filters(followed the Procedure in the link)&quot; /&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt; 3. After applying Gaussian Low Pass Filter &#xA;&lt;br&gt; &lt;img src=&quot;https://i.stack.imgur.com/7f2Rj.png&quot; alt=&quot;After applying Gaussian Low Pass Filter&quot; /&gt; &#xA;&lt;br&gt;&#xA;&lt;br&gt; Can someone clarify this doubt.? &#xA;&lt;br&gt; P.S Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="13454" LastEditorUserId="60971" LastEditDate="2023-01-26T19:09:56.620" LastActivityDate="2023-01-26T19:09:56.620" Title="DFT and Inverse DFT in Image Processing" Tags="|image-processing|dft|opencv|frequency-domain|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="21754" PostTypeId="2" ParentId="21752" CreationDate="2015-02-26T09:24:03.693" Score="1" Body="&lt;p&gt;The provided answers are correct. Appending zeros is not upsampling and therefore the sampling rate is still $R_\mathrm{s}=100\, \text{Samples/s}$. Accordingly, the frequency spacing after taking the N-DFT is $f_\mathrm{d}=(R_\mathrm{s}/N)=0.25\, \text{Hz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upsampling can be achieved by inserting $N_\mathrm{U}$ zeros after every sample followd by lowpass filtering.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-02-26T09:24:03.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21755" PostTypeId="1" AcceptedAnswerId="21756" CreationDate="2015-02-26T10:53:35.583" Score="0" ViewCount="185" Body="&lt;p&gt;I have one question about digital correction of signal after RC filter which is high-pass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me explain detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have one simple signal conditioner. It has RC filter on the signal input with cut-off frequency equals 1.3 Hz. It means that after this RC filter my signal has lower amplitude from 1.3 Hz to approximately 15 Hz. After ADC I get this signal on my computer in digital form. After that I use Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I need correct amplitude information in range 2-20Hz. So I need correct amplitude of signal in that range by digital transformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I do this? Is it normal practice?&lt;/p&gt;&#xA;" OwnerUserId="14873" LastActivityDate="2015-02-26T11:36:21.057" Title="Correction of signal after High-pass RC-filter" Tags="|fourier-transform|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21756" PostTypeId="2" ParentId="21755" CreationDate="2015-02-26T11:36:21.057" Score="0" Body="&lt;p&gt;Yes, this seems like a normal thing to do. However, note that the signal-to-noise ratio will be degraded in the 1.3 Hz to 15 Hz band. Your signal will be smaller but the quantization noise of the ADC will stay the same.&lt;/p&gt;&#xA;" OwnerUserId="14868" LastActivityDate="2015-02-26T11:36:21.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21758" PostTypeId="1" AcceptedAnswerId="21763" CreationDate="2015-02-26T12:53:52.123" Score="3" ViewCount="849" Body="&lt;p&gt;Let us take any image like Lena or cameraman. I know that when Fourier transform is applied on image,spatially global features like amplitude and phase are obtained locally. My question is whether it is possible to reconstruct an image from its magnitude only keeping phase value zero or different than actual value? Can anybody explain?&lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-03-11T14:07:28.043" LastActivityDate="2015-03-11T14:07:28.043" Title="Is it possible to reconstruct an image using its magnitude only?" Tags="|image-processing|fft|ifft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21759" PostTypeId="1" AcceptedAnswerId="21785" CreationDate="2015-02-26T13:20:25.117" Score="1" ViewCount="68" Body="&lt;p&gt;I would like to analyse a gaussian smoothing kernel with a set standard deviation and support (let's say, in MATLAB, fspecial('gaussian', [5 1], 1.3) so sigma is 1.3 and support is 5) in the DTFT domain to determine the stopband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that the stopband is when the magnitude of the impulse response is below -3 dB. However, I don't have a clue how to determine this given a sigma and support value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm particularly interested to see if the DTFT quantifies the artifact due to the compact support as I would like to understand this a little better.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2015-02-27T09:49:42.900" Title="How to determine stopband of discrete Gaussian, stdev sigma, support N" Tags="|fourier-transform|gaussian|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21760" PostTypeId="1" CreationDate="2015-02-26T14:25:53.393" Score="1" ViewCount="1114" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/imCLG.png&quot; alt=&quot;A&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me to improve the degradation of the following image....i am working on OCR system in Amharic language and what is the best image filtering technique that can help me to separate text data from background noise?&lt;/p&gt;&#xA;" OwnerUserId="14875" LastEditorUserId="7092" LastEditDate="2015-02-26T14:48:14.277" LastActivityDate="2015-02-27T00:40:12.427" Title="What preprocessing technique can help me to filter the background text noises using matlab...the image is shown below?" Tags="|matlab|image-processing|image-segmentation|ocr|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21761" PostTypeId="1" AcceptedAnswerId="21766" CreationDate="2015-02-26T15:49:39.323" Score="1" ViewCount="281" Body="&lt;p&gt;If I sample a signal with a harmonic higher than half my sample frequency I can predict the aliased frequency easily as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|F_h-kF_s|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if after sampling the signal, I re-sample at a lower rate (decimate)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the lower sampling frequency simply trump the original higher frequency or will there be mixing or modulation effects due to the two sampling frequencies that change or create new aliased harmonics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, is there a way to predict what the aliased harmonics will be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a simple example assume I sample a signal containing a $7$ kHz harmonic at $3$ kHz, then decimate by taking every third sample, so effectively re-sampling at $1$ kHz.&lt;/p&gt;&#xA;" OwnerUserId="8809" LastEditorUserId="7092" LastEditDate="2015-02-26T16:15:35.817" LastActivityDate="2015-02-26T18:20:01.387" Title="How does sampling and subsequent resampling affect aliased harmonics?" Tags="|sampling|modulation|downsampling|aliasing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21762" PostTypeId="1" CreationDate="2015-02-26T15:53:41.383" Score="0" ViewCount="6007" Body="&lt;p&gt;I Would like an explanation of the parameters for opencv's &lt;code&gt;HoughCircles&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new to image processing in general and I have recently started using opencv. I'm struggling to find circles. I obtained the image below by converting a source image to greyscale then performing a binary threshold. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To my eye, the leftmost images are almost perfect circles. I have seen demonstrations where, what I assume are very noisy and distorted circles have been identified by opencv's hough transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U8grK.png&quot; alt=&quot;Fake Circles according to opencv&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the image displayed above is saved as &quot;binaryresult.png&quot;. If I run the following code I get circles that are poorly placed. I'd like to understand the &lt;code&gt;HoughCircles&lt;/code&gt; function's parameters so that I can better detect circles.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cv2&#xA;import numpy as np&#xA;&#xA;image = cv2.imread(&quot;binaryresult.png&quot;)&#xA;image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)&#xA;circles = cv2.HoughCircles(image, cv2.cv.CV_HOUGH_GRADIENT,  2, 32, param1=200, param2=100)&#xA;&#xA;# ensure at least some circles were found&#xA;if circles is not None:&#xA;    # convert the (x, y) coordinates and radius of the circles to integers&#xA;    circles = np.round(circles[0, :]).astype(&quot;int&quot;)&#xA;&#xA;    # loop over the (x, y) coordinates and radius of the circles&#xA;    for (x, y, r) in circles:&#xA;        # draw the circle in the output image, then draw a rectangle&#xA;        # corresponding to the centre of the circle&#xA;        cv2.circle(output, (x, y), r, (0, 255, 0), 4)&#xA;        cv2.rectangle(output, (x - 5, y - 5), (x + 5, y + 5), (0, 128, 255), -1)&#xA;&#xA;    # show the output image&#xA;    cv2.imshow(&quot;output&quot;, np.hstack([image]))&#xA;cv2.waitKey(0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14874" LastActivityDate="2015-03-01T06:59:14.043" Title="Circle detection opencv" Tags="|image-processing|computer-vision|opencv|hough-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21763" PostTypeId="2" ParentId="21758" CreationDate="2015-02-26T16:19:32.930" Score="5" Body="&lt;p&gt;Re-construction using just the magnitude (and an assumed phase of zero) will only work for exactly symmetric images.  The phase is needed to make the top look different from the bottom and left look different from the right side of the image, etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's because all the cosine waveform DFT basis vectors are exactly symmetric around the center of an FFT or DFT window.  Thus, unshifted, they can only reconstruct a symmetric result.  You could shift the phase of each basis vector randomly (or 90 degrees to make them all sinewaves) but, without knowing the phase shifts of the original image's DFT (or guessing right), you would just get another garbage result.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-02-26T16:19:32.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21765" PostTypeId="1" AcceptedAnswerId="21767" CreationDate="2015-02-26T16:50:51.320" Score="1" ViewCount="825" Body="&lt;p&gt;I'm currently at a loss for why my code seems to not be working.  I'm doing a sine sweep on a filter to calculate its freq and phase response.  The frequency response checks out, however the phase response doesn't look right when compared to MATLABs &lt;code&gt;freqz&lt;/code&gt; function.  Plus since I know the filter is a comb, I can tell its wrong as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've got so far.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%   Filter Coefficients&#xA;b = [1];&#xA;a = [1, 0, 0, 0, 0, 0, 0, 0, 0, -0.96];&#xA;&#xA;%  sweep is my sine wave that goes from 0-&amp;gt;fs/2&#xA;filtered_sweep = filter(b, a, sweep);&#xA;&#xA;% This section correctly Grabs and plots the Freq Response&#xA;fft_sweep = fft(filtered_sweep);&#xA;freq_response = abs(fft_sweep);&#xA;freq_response = 20*log10(freq_response/1);      % Convert to dB scale&#xA;freq_response = freq_response(1:end/2);         % Cut to pi fs/2    &#xA;figure;&#xA;plot(freq_response);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And Now here is where I try and get the Phase two different ways with the same wrong result.  From what I understand to get the phase you just need the angle of the complex values.  In MATLAB I thought angle() should work, but just to be safe I tried to manually compute the angle myself using atan with the imag and real components.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Pre Allocate Vector&#xA;% Manual Angle Extraction without using Angle()&#xA;phase = zeros(1, length(fft_sweep));&#xA;for i=1:length(fft_sweep)&#xA;    phase(i) = atan2(imag(fft_sweep(i)), real(fft_sweep(i)));&#xA;end&#xA;&#xA;% Using angle()&#xA;phase_response = angle(fft_sweep);&#xA;phase_response = phase_response(1:end/2);&#xA;figure;&#xA;plot(unwrap(phase_response));&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both methods give the same incorrect phase response.  Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14863" LastEditorUserId="8202" LastEditDate="2015-02-26T17:42:40.190" LastActivityDate="2015-02-26T17:42:40.190" Title="Manual Extraction of Filter Phase Response with MATLAB using sweep sine" Tags="|matlab|filters|phase|frequency-response|sweep|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21766" PostTypeId="2" ParentId="21761" CreationDate="2015-02-26T17:19:12.163" Score="1" Body="&lt;p&gt;The alias behaves exactly the same, in every sense, as if it were an actual sinusoidal component at the alias frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, the 7 kHz harmonic sampled at 3 kHz is actually a 1 kHz sinusoid, and decimating it is exactly the same as decimating a 1 kHz signal. In this case, you end up with a DC value.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="4346" LastEditDate="2015-02-26T18:20:01.387" LastActivityDate="2015-02-26T18:20:01.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21767" PostTypeId="2" ParentId="21765" CreationDate="2015-02-26T17:39:22.583" Score="2" Body="&lt;p&gt;You missing one, very important step. In order to get the impulse response of your filter while using the sweep sine, you must get the output of your system $h[n]$ to excitation with sweep-sine signal $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n]=h[n]\star x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case that's the filtering with &lt;code&gt;filter&lt;/code&gt; function. Now in order to get the impulse response you must convolve your signal with the &lt;em&gt;inverse filter&lt;/em&gt; $f[n]$. Generally that's the time-inverted sweep signal (although special kind of pre-conditioning, amplitude scaling, etc. might be done as well):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h[n]=y[n]\star f[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you have your impulse response that you can use for further analysis. Please take a look at this &lt;a href=&quot;https://dsp.stackexchange.com/a/15496/8202&quot;&gt;&lt;strong&gt;answer&lt;/strong&gt;&lt;/a&gt; tackling very similar problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more theory please see:  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://pcfarina.eng.unipr.it/Public/Papers/226-AES122.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;A. Farina - Advancements in Impulse Response Measurements by Sine&#xA;  Sweeps&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;http://web.arch.usyd.edu.au/~wmar0109/DESC9090/old/Farina_00.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;A. Farina - Simultaneous Measurement of Impulse Response and Distortion with a&#xA;  Swept-Sine&#xA;  Technique&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-02-26T17:39:22.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21768" PostTypeId="1" CreationDate="2015-02-26T20:20:41.940" Score="5" ViewCount="8976" Body="&lt;p&gt;I am always confused between FFT and DFT. In both algorithm, it has been assumed that the signal is periodic (so my understanding is that, if you have a 20 sample point signal, and you do DFT or FFT, the algorithm assumes 20 sample points repeat). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is the question, someone told me that DFT can take odd number of samples, and spectral leakage could be avoid if use DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I disagree with the person because spectral leakage occurs in both FFT and DFT. And I also disagree because DFT and FFT can both take odd number of samples point, except that it would be slower in FFT case. Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="14877" LastEditorUserId="7092" LastEditDate="2015-02-26T20:26:13.827" LastActivityDate="2015-04-28T23:11:42.220" Title="DFT vs FFT: does odd number works for DFT only?" Tags="|fft|discrete-signals|signal-analysis|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21770" PostTypeId="2" ParentId="21768" CreationDate="2015-02-26T21:56:28.577" Score="1" Body="&lt;p&gt;DFT stands for Discrete Fourier Transform and FFT stands for Fast Fourier Transform.&#xA;FFT is just a name to refer to a very fast implementation of the DFT. So, basically they are the same thing. When using the FFT it is better that the length of the signal be a multiple of 2, for implementation reasons, so the it's usual to pad the signal with 0s until the length is a multiple of 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, answering your question both &quot;work&quot; with signals of even or odd length.&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="13403" LastEditDate="2015-02-27T00:20:21.297" LastActivityDate="2015-02-27T00:20:21.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21771" PostTypeId="2" ParentId="21768" CreationDate="2015-02-26T21:57:01.553" Score="6" Body="&lt;p&gt;An FFT is an optimization for computing the DFT that works well for any number of samples that is the product of mostly small prime number factors.  They produce the exact same results, except for numerical noise. The factor 2 is common, but 3 and 5 are also small primes that can be used in a very efficient odd number length FFT implementation.  Many newer FFT libraries (Accelerate/vDSP, FFTW, etc.) thus support odd length FFTs, not just powers of 2.  On newer processors, the speed of an FFT is more limited by data cache size and policy and CPU instruction pipeline depth and hazards, not by the input being only a power-or-2 or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm makes no assumption about the signal being periodic (although some people do), as it is just a finite matrix basis transform.  If the signal input isn't exactly integer periodic in the FFT width, with that width being cut out of a longer signal, then there will be some windowing artifacts, often called spectral leakage (but they have the exact shape as the transform of the window used, so they are far more related to the window than to the spectrum.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you change the size of a DFT or FFT window so that it is an exact integer multiple of the period of a purely periodic input waveform, then the windowing artifacts (or leakage) just happens to be all zeros.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-28T23:11:42.220" LastActivityDate="2015-04-28T23:11:42.220" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="21772" PostTypeId="2" ParentId="21760" CreationDate="2015-02-27T00:40:12.427" Score="1" Body="&lt;p&gt;This problem is called &lt;em&gt;(ink) bleeding&lt;/em&gt;. A popular approach is to separate or segment the document image using &lt;a href=&quot;http://en.wikipedia.org/wiki/Graphical_model&quot; rel=&quot;nofollow&quot;&gt;graphical models&lt;/a&gt;. Relevant papers include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Document Ink Bleed-Through Removal with Two Hidden Markov Random Fields and a Single Observation Field&lt;/li&gt;&#xA;&lt;li&gt;User-Assisted Ink-Bleed Reduction&lt;/li&gt;&#xA;&lt;li&gt;Bleed-through removal in degraded documents&lt;/li&gt;&#xA;&lt;li&gt;Directed Assistance for Ink-Bleed Reduction in Old Documents&lt;/li&gt;&#xA;&lt;li&gt;Ink-Bleed Reduction Using Functional Minimization&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2015-02-27T00:40:12.427" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21773" PostTypeId="2" ParentId="20241" CreationDate="2015-02-27T01:41:05.933" Score="0" Body="&lt;p&gt;This really depends largely on what your definition of &quot;mismatch&quot; is.  You can certainly determine what the average speech and the average &quot;sound effect&quot; level is. But how would you know what the &quot;right&quot; balance is? The T-Rex stomping down through the jungle clearly needs to be louder than the whisper of the poor humans hiding in the bushes. But by how much? How could you tell that's too loud or too soft?&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-02-27T01:41:05.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21774" PostTypeId="1" CreationDate="2015-02-27T04:04:38.983" Score="0" ViewCount="57" Body="&lt;p&gt;Is it possible to design an LPF that has an output identical to the input at specific points in time domain (the rest of the input waveform can get filtered/distorted)?&#xA;Is there a general name/technique for this kind of thing (assuming it is possible), so that I can search for more information on this topic?&lt;/p&gt;&#xA;" OwnerUserId="14881" LastActivityDate="2015-09-25T14:04:43.120" Title="LPF - signal values unaffected at specific times" Tags="|filtering|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21775" PostTypeId="2" ParentId="17814" CreationDate="2015-02-27T04:42:43.413" Score="5" Body="&lt;p&gt;Ok, my answer will be somewhat different than the other answers.  My answer accepts the premise of the question rather than denies the premise of the question.&lt;/p&gt;&#xA;&lt;p&gt;The reason that the DFT &amp;quot;assumes&amp;quot; the input signal (the signal to be transformed, what I assume the OP means by &amp;quot;transformed signal&amp;quot;) is periodic is because the DFT fits a collection of basis functions to that input signal, all of which are periodic.&lt;/p&gt;&#xA;&lt;p&gt;Consider a different set of basis functions:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ g_k(u) \triangleq u^k \quad \quad 0 \le k &amp;lt; N $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and given &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; input samples:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x[n] \quad \quad 0 \le n &amp;lt; N $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can fit a linear sum of these basis functions &lt;span class=&quot;math-container&quot;&gt;$g_k(n)$&lt;/span&gt; to the input sequence&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;x[n] &amp;amp; = \sum\limits_{k=0}^{N-1} X[k] g_k(n) \\&#xA;     &amp;amp; = \sum\limits_{k=0}^{N-1} X[k] n^k \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with judicious selection of the coefficients &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;.  Calculating all &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; requires solving &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; linear equations with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; unknowns.  You can use &lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_elimination&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian elimination&lt;/a&gt; to do it.&lt;/p&gt;&#xA;&lt;p&gt;With the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; correct values for &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$0 \le k \le N-1$&lt;/span&gt;, we can make sure that the sum of these power functions (which is an &lt;span class=&quot;math-container&quot;&gt;$(N-1)$&lt;/span&gt;th-order polynomial) will evaluate exactly to &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; for each &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$0 \le n \le N-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now what if you use that summation to go beyond the interval of &lt;span class=&quot;math-container&quot;&gt;$0 \le n \le N-1$&lt;/span&gt;?  you can evaluate it for &lt;strong&gt;any&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.  You will notice that the behavior of that function will be that of an &lt;span class=&quot;math-container&quot;&gt;$(N-1)$&lt;/span&gt;th-order polynomial because that is what it is.  For &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; large enough, only the highest power with a non-zero coefficient will set the trend for the extrapolated &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So now, with the DFT we are fitting a different set of basis functions to our input sequence:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ g_k(u) \triangleq \frac{1}{N} e^{+j 2 \pi k u/N} \quad \quad 0 \le k &amp;lt; N $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;x[n] &amp;amp; = \sum\limits_{k=0}^{N-1} X[k] g_k(n) \\&#xA;     &amp;amp; = \frac{1}{N} \sum\limits_{k=0}^{N-1} X[k] e^{+j2\pi n k/N} \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the coefficients, &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;, can be solved for and are:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ X[k] = \sum\limits^{N-1}_{n=0} x[n] \ e^{-j2\pi n k/N} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The placement of that &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{N}$&lt;/span&gt; is a matter of convention.  I am putting it where most of the literature puts the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{N}$&lt;/span&gt; factor.  It could be removed from the &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; equation and put in the &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; equation, instead.  or &amp;quot;half&amp;quot; of it (&lt;span class=&quot;math-container&quot;&gt;$\sqrt{\frac{1}{N}}$&lt;/span&gt;) could be placed with both equations.  It's just a matter of convention.&lt;/p&gt;&#xA;&lt;p&gt;But here we are fitting a set of basis functions that are all periodic with period &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to the original &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;.  So even if &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; came from a longer sequence was not periodic, the DFT is considering that &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is the sum of a bunch of basis functions &lt;strong&gt;each&lt;/strong&gt; that are periodic with period &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.  If you add up a bunch of periodic functions, all with the same period, the sum must also be periodic with the same period.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-05-24T15:05:51.127" LastActivityDate="2023-05-24T15:05:51.127" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="21776" PostTypeId="1" CreationDate="2015-02-27T06:11:34.743" Score="4" ViewCount="214" Body="&lt;p&gt;How can I derive the fourier transform of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                                   g1(t) = {A cos(2πfc t),−T/2 &amp;lt; t &amp;lt;T/2&#xA;                                            0,               elsewhere &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                                  g2(t) = cos(t), −∞ &amp;lt; t &amp;lt; ∞&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my answer for &lt;code&gt;g1&lt;/code&gt; is;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;∫ g(t)exp(-j*2*pi*f*t)dt = ∫ Acos(2*pi*fc*t)exp(-j*2*pi*f*t)dt&#xA;&#xA;   =∫ 1/2A (exp(j*2*pi*fc*t)+exp(-j*2*pi*fc*t))exp(-j*2*pi*f*t)dt&#xA;&#xA;   =∫1/2A(exp(j*2*pi*fc*t)exp(-j*2*pi*fc*t)+∫1/2A(exp        (-j*2*pi*fc*t)exp(-j*2*pi*fc*t))&#xA;&#xA;   =1/2A∫exp(-j*2*pi(f-fc)t) + 1/2A ∫exp(-j*2*pi(f+fc)t)dt&#xA;&#xA;   =1/2A(f-fc)+1/2A(f+fc) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14882" LastEditorUserId="7092" LastEditDate="2015-02-27T13:06:08.243" LastActivityDate="2015-02-27T13:06:08.243" Title="Signal Processing using Fourier Transform" Tags="|signal-analysis|fourier-transform|homework|fourier|fourier-series|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21777" PostTypeId="1" CreationDate="2015-02-27T07:08:08.390" Score="0" ViewCount="24" Body="&lt;p&gt;How can I derive the fourier transform of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                                   g1(t) = {A cos(2πfc t),−T/2 &amp;lt; t &amp;lt;T/2&#xA;                                            0,               elsewhere &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                                  g2(t) = cos(t), −∞ &amp;lt; t &amp;lt; ∞&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my answer for &lt;code&gt;g1&lt;/code&gt; is;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    ∫ g(t)exp(-j*2*pi*f*t)dt = ∫ Acos(2*pi*fc*t)exp(-j*2*pi*f*t)dt&#xA;&#xA;       =∫ 1/2A (exp(j*2*pi*fc*t)+exp(-j*2*pi*fc*t))exp(-j*2*pi*f*t)dt&#xA;&#xA;       =∫1/2A(exp(j*2*pi*fc*t)exp(-j*2*pi*fc*t)+∫1/2A(exp        (-j*2*pi*fc*t)exp(-j*2*pi*fc*t))&#xA;&#xA;       =1/2A∫exp(-j*2*pi(f-fc)t) + 1/2A ∫exp(-j*2*pi(f+fc)t)dt&#xA;&#xA;       =1/2A(f-fc)+1/2A(f+fc) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14882" LastEditorUserId="7092" LastEditDate="2015-02-27T13:05:15.470" LastActivityDate="2015-02-27T13:05:15.470" Title="Signal Processing using Fourier Transform1" Tags="|signal-analysis|" AnswerCount="0" CommentCount="2" ClosedDate="2015-03-01T18:10:08.570" ContentLicense="CC BY-SA 3.0" />
  <row Id="21778" PostTypeId="2" ParentId="21751" CreationDate="2015-02-27T07:12:08.697" Score="2" Body="&lt;p&gt;For me, if all you want to deal with is the possible 'debris in the optics,' why not get a reference background image? This will help you to easily identify which are 'noise' caused by your optics. Assume you can get a perfect background, namely everything remains the same except for your cells ( maybe you can get this by taking another image after removing all cells ), then simply subtract the background image from the original one will work.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-02-27T07:12:08.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21779" PostTypeId="2" ParentId="21774" CreationDate="2015-02-27T07:18:17.870" Score="-1" Body="&lt;p&gt;What you probably are looking for are Nyquist/$M$th-band filters. The impulse response of these have the following property (assuming a non-causal impulse response centered around tap 0 for ease of exposition)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h_n = \left\{ \begin{matrix} \frac{1}{M} &amp;amp; n=0\\ 0 &amp;amp; n = kM, k=\pm 1, \pm 2, \dots\end{matrix} \right.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that every $M$th sample is untouched (the $1/M$ term is for scaling purposes). Often it is said that these filters have zero inter symbol interference, assuming that a symbol arrived every $M$th sample.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-02-27T07:18:17.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21781" PostTypeId="2" ParentId="20231" CreationDate="2015-02-27T08:54:05.867" Score="0" Body="&lt;p&gt;One of standard way is using &quot;matching filter&quot; - &#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Matched_filter&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2015-02-27T08:54:05.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21782" PostTypeId="2" ParentId="21776" CreationDate="2015-02-27T09:01:45.120" Score="2" Body="&lt;p&gt;Hey it takes a lot of time in writing equations also I don't know to type in LATEX.so I am sending you image file for second one &lt;img src=&quot;https://i.stack.imgur.com/D1PuM.png&quot; alt=&quot;answer for your second question&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="9035" LastActivityDate="2015-02-27T09:01:45.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21785" PostTypeId="2" ParentId="21759" CreationDate="2015-02-27T09:39:43.407" Score="1" Body="&lt;p&gt;I found answer at &lt;a href=&quot;https://courseware.ee.calpoly.edu/~fdepiero/curr/dsp/dsp11.htm&quot; rel=&quot;nofollow&quot;&gt;https://courseware.ee.calpoly.edu/~fdepiero/curr/dsp/dsp11.htm&lt;/a&gt; . Converted to the present problem, in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;kernel2 = fspecial('gaussian', [1 5], 1.3)&#xA;spike = [1 0 0 0 0];   &#xA;[h, w] = freqz(kernel2, spike, 1024);&#xA;m = abs(h)&#xA;m_db = 10*log10(m/max(m));&#xA;plot(w,m_db)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because the compact support Gaussian had zero crossings, I used the first zero to define the stop band.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="5623" LastEditDate="2015-02-27T09:49:42.900" LastActivityDate="2015-02-27T09:49:42.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21787" PostTypeId="1" AcceptedAnswerId="21791" CreationDate="2015-02-27T12:29:39.800" Score="0" ViewCount="216" Body="&lt;p&gt;The input space has artefacts that are already in a grid-like layout:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DfhTN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to be able to fit/draw a grid over the artefacts so as to separate them, preferably with lines on average mid-way between neighbouring artefacts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o3Nzr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bonus would be to tweak the threshold to cluster artefacts that are in closer proximity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7l71Q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does one call this method of grid fitting? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I know what I'm looking for, a next avenue would be which tools to use to implement this.&lt;/p&gt;&#xA;" OwnerUserId="14883" LastActivityDate="2015-02-27T15:05:23.537" Title="What does one call this method of grid fitting?" Tags="|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21788" PostTypeId="1" CreationDate="2015-02-27T12:53:43.610" Score="-1" ViewCount="399" Body="&lt;p&gt;Aim of my project is to differentiate between cases of silence, single active speaker and multiple ( simultaneous ) active speakers using as basic ( but effective ) logic as possible. Is it possible to achieve this without use of extensive machine learning algorithms ??&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Actually, i don't need to do speaker &quot;identification&quot;. An audio stream will be taken as an input and I have to just say whether that audio consists of a single speaker, multiple speakers or silence... I have to implement this in C (real time), hence machine learning (unsupervised) would increase the computational complexity. &lt;/p&gt;&#xA;" OwnerUserId="14884" LastEditorUserId="80" LastEditDate="2018-06-04T13:22:06.710" LastActivityDate="2022-05-16T04:09:16.090" Title="can MFCC coefficients alone be used to do voice detection?" Tags="|audio|mfcc|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21789" PostTypeId="2" ParentId="17881" CreationDate="2015-02-27T14:11:39.927" Score="2" Body="&lt;p&gt;The Otsu algorithm most responders are referring to, is the 1D algorithm indeed, exactly for the reason mentioned above. The main drawback is that it does not work very well in images with low s/N ratio or low contrast. Also, when you only have a small object with a big background, Otsu will incorrectly select background pixels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 2D Otsu provides a solution to this. I don't know the maths involved, but it performs '2D histogram projection', I found it was well documented in: &#xA;J. Zhang, J. Hu, 2008 International Conference on Computer Science and Software Engineering&#xA;From what I understand it projects the histograms in such way and then applies some filters to it so that the peaks relating to the 'object' will appear more profound in the resulting histogram, enabling better segmentation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both algorithms can be applied in 2D and 3D ( to add some more confusion). &lt;/p&gt;&#xA;" OwnerUserId="14885" LastActivityDate="2015-02-27T14:11:39.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21790" PostTypeId="2" ParentId="21788" CreationDate="2015-02-27T14:47:51.467" Score="0" Body="&lt;p&gt;In essence, yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would have to use something like &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_time_warping&quot; rel=&quot;nofollow&quot;&gt;Dynamic time warping&lt;/a&gt; to measure the similarities between two given signals, as long as they vary in time or speed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I can remember, you can use DTW for speaking identification. BUT it is important to note that for single word recognition and single speaker identification this method would work but would not be suitable for commercial or large scale applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DTW algorithm calculates the distances from the two signals, based on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Euclidean_distance&quot; rel=&quot;nofollow&quot;&gt;Euclidean distances.&lt;/a&gt;. Whilst studying for my undergraduate degree, I did a simple word recognition system (In C++) and the machine learning algorithms (for instance, Hidden Markov Models) provided a much higher success rate than DTW. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to take a look at some of the code that I wrote for this project. &lt;a href=&quot;http://ideone.com/oaUe2F&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double Euclidean_distance(const vector&amp;lt;double&amp;gt; &amp;amp;actual, const vector&amp;lt;double&amp;gt; &amp;amp;training) {&#xA;&#xA;    double distance = 0.0;&#xA;&#xA;    for(unsigned i=0; (i &amp;lt; actual.size()); i++)&#xA;    {&#xA;        distance = pow((actual[i] - training[i]), 2);&#xA;    }&#xA;&#xA;    return sqrt(distance);&#xA;}&#xA;&#xA;double Distance(const std::vector&amp;lt; std::vector&amp;lt;double&amp;gt; &amp;gt; &amp;amp;actual, const std::vector&amp;lt; std::vector&amp;lt;double&amp;gt; &amp;gt; &amp;amp;training)&#xA;{&#xA;    int m = actual.size();&#xA;    int n = training.size();&#xA;&#xA;    double cost[m][n];&#xA;&#xA;    cost[0][0] = Euclidean_distance(actual[0], training[0]);&#xA;&#xA;    for(int i = 1; i &amp;lt; m; i++)&#xA;            cost[i][0] = cost[i-1][0] + Euclidean_distance(actual[i], training[0]);&#xA;    for(int j = 1; j &amp;lt; n; j++)&#xA;            cost[0][j] = cost[0][j-1] + Euclidean::Euclidean_distance(actual[0], training[j]);&#xA;&#xA;    for(int i = 1; i &amp;lt; m; i++)&#xA;            for(int j = 1; j &amp;lt; n; j++)&#xA;                cost[i][j] = std::min(cost[i-1][j], std::min(cost[i][j-1], cost[i-1][j-1])) &#xA;                    + Euclidean_distance(actual[i],training[j]);&#xA;&#xA;    return cost[m-1][n-1];&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Note this is Academic code, not tested and just illustrate the algorithm)&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="5182" LastEditDate="2015-02-27T14:55:30.547" LastActivityDate="2015-02-27T14:55:30.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21791" PostTypeId="2" ParentId="21787" CreationDate="2015-02-27T15:05:23.537" Score="1" Body="&lt;p&gt;I don't think this has a name, but you could just apply a clustering algorithm to the X-coordinates of the red dots and separately to the Y-coordinates. For example, in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = Import[&quot;https://i.stack.imgur.com/DfhTN.png&quot;];    &#xA;blobs = ComponentMeasurements[ColorNegate@Binarize[img], &quot;Centroid&quot;][[&#xA;   All, 2]];    &#xA;{meanX, meanY} = Mean /@ FindClusters[#] &amp;amp; /@ Transpose[blobs];    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will find &quot;clusters&quot; in the X- and Y-coordinates of the red dots:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Show[img, &#xA; Graphics[{Line[{{#, 0}, {#, 480}}] &amp;amp; /@ meanX, &#xA;   Line[{{0, #}, {640, #}}] &amp;amp; /@ meanY}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oqs10.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If you want to implement the clustering yourself, &lt;a href=&quot;http://en.wikipedia.org/wiki/K-means_clustering&quot; rel=&quot;nofollow noreferrer&quot;&gt;k-means&lt;/a&gt; is a good starting point: In a nutshell, you start with random cluster centers; then assign each point to the nearest cluster center; then update the cluster centers to the mean of the values assigned to them. Repeat until convergence, split clusters if the assigned points spread too far.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The grid you're looking for is just the lines in between these clusters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;inBetween = Mean /@ Partition[Sort[#], 2, 1] &amp;amp;;&#xA;Show[img, &#xA; Graphics[{Line[{{#, 0}, {#, 480}}] &amp;amp; /@ inBetween[meanX], &#xA;   Line[{{0, #}, {640, #}}] &amp;amp; /@ inBetween[meanY]}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rw4It.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="291" LastActivityDate="2015-02-27T15:05:23.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21792" PostTypeId="1" CreationDate="2015-02-27T15:06:04.907" Score="9" ViewCount="7288" Body="&lt;p&gt;I have implemented IIR filter in direct form, parallel form, and cascade form. The input in all the cases is a kronecker delta function. How to judge which implementation is better is in real time and why? What are the factors to be considered while selecting the best implementation? Please help.&lt;/p&gt;&#xA;" OwnerUserId="14809" LastEditorUserId="4346" LastEditDate="2015-03-01T06:23:16.977" LastActivityDate="2023-12-14T19:44:43.297" Title="best implementation of a real-time, fixed-point iir filter with constant coefficients" Tags="|infinite-impulse-response|fixed-point|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21793" PostTypeId="1" AcceptedAnswerId="21797" CreationDate="2015-02-27T15:49:39.250" Score="0" ViewCount="1204" Body="&lt;p&gt;I'm a newbeginner when it comes to signal processing. I'm reading up about anti-aliasing, Nyquist and band-pass filters. There's something I don't get: Anti-aliasing in analog filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lemme try to explain. I use a &lt;strong&gt;8th order analog butterworth band-pass filter (centered at 17.5 Hz with a 25 Hz 3dB bandwidth)&lt;/strong&gt; on the &lt;strong&gt;analog signal&lt;/strong&gt;. So it cuts at 5 and 30 Hertz and ofcourse there's the transition-band before the stop-band. It is supposed to be an anti-aliasing filter. Where is this anti-aliasing happening?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I asked my teacher before he left why the butterworth was called anti-aliasing filter when it didn't really do it. He answered that since I was working on the analog signal, it was just a band-pass with no anti-aliasing because this was before ADC. The aliasing only occur after the ADC when the analog signal is made to digital and digital filters are used. WUT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, the anti-aliasing still happens when the signal goes through ADC, right? (well, I sample at 512Hz so I oversample the signal but stil...) So why is the filter called anti-aliasing filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone explain this to me? I totally don't get it. Why is it called anti-aliasing filter and where does this anti-aliasing happen?&lt;/p&gt;&#xA;" OwnerUserId="14886" LastEditorUserId="5843" LastEditDate="2015-02-27T19:56:12.587" LastActivityDate="2015-02-27T19:56:12.587" Title="Confused about anti-aliasing in analog filters" Tags="|analog|anti-aliasing-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21794" PostTypeId="1" AcceptedAnswerId="21863" CreationDate="2015-02-27T15:50:28.573" Score="1" ViewCount="4866" Body="&lt;p&gt;How to determine $a$ and $b$ in this equation. I know how to determine $c$ and $d$ by looking at the  intensity histogram. But what about $a$ and $b$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_{out}=(P_m -c)\left( \dfrac{b-a}{d-c} \right)+a $$&lt;/p&gt;&#xA;" OwnerUserId="13737" LastEditorUserId="8202" LastEditDate="2015-03-03T22:39:17.623" LastActivityDate="2017-02-13T08:38:54.387" Title="Contrast stretching Equation problem" Tags="|image-processing|computer-vision|normalization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21796" PostTypeId="1" AcceptedAnswerId="21804" CreationDate="2015-02-27T16:37:49.033" Score="6" ViewCount="32888" Body="&lt;p&gt;I am implementing my own discrete Kalman filter to estimate velocity from acceleration and position measurements (using Matlab ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I managed to deal with the $R$ matrix (measurements noise covariance matrix) in this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = [x;x2dot];&#xA;R = cov(M);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I am not sure about is the matrix $Q$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all the examples I found on the web and on this website also, the values inside that matrix are really really small. Moreover, I found &lt;a href=&quot;https://stackoverflow.com/questions/19537884/explain-process-noise-terminology-in-kalman-filter&quot;&gt;here&lt;/a&gt; this statement:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;if you select an overly large Q, then it doesn’t seem like the Kalman&#xA;  filter would be well-behaved.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The fact is that, in my model, to obtain acceptable results I used values in the order of $1e6$ on the diagonal of the $Q$ matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way I got the estimated displacement equal to the measured one and the estimated acceleration equal to the measured one. The velocity is in the right range of values but it still looks noisy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is: is there a limit for the values to be used in $Q$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also, are there guidelines to choose those values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last question, does the $Q$ matrix have to be diagonal or it can be full also?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="128" LastEditDate="2018-07-07T15:53:02.840" LastActivityDate="2018-07-07T15:53:02.840" Title="Question About $ Q $ Matrix (Model Process Covariance) in Kalman Filter" Tags="|matlab|kalman-filters|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="21797" PostTypeId="2" ParentId="21793" CreationDate="2015-02-27T16:44:41.497" Score="2" Body="&lt;p&gt;Aliasing does not happen in the analog world. It only happens when you sample a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an ADC with sampling frequency $f_s$, then you'll have aliasing if the input signal has frequency components larger than $f_N=f_s/2$. To avoid aliasing, it's common to low-pass filter the signal before it is input into the ADC. That way, you make sure that the digital signal out of the ADC has no aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such an analog filter is called an &quot;anti-alias filter&quot;, not because it will experience anything related to aliasing itself, but because its purpose is to avoid aliasing in the ADC.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-02-27T16:44:41.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21799" PostTypeId="2" ParentId="21793" CreationDate="2015-02-27T19:19:02.543" Score="1" Body="&lt;p&gt;Another way to think about it is that aliasing always occurs during sampling.  The entire spectrum always gets folded down and aliased with the signal of interest.  Even if that spectrum content is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closer you can get the unwanted spectrum to zero, the less aliasing noise you will have contaminating your signal band of interest.  The best case would be to alias zero noise.  (In the real world, that isn't possible, but if you can reduce any alias noise below your sampling quantization noise and numerical processing rounding &quot;errors&quot;, it likely becomes insignificant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So (part of) your bandpass filter's purpose, before the sampler, is to reduce the unwanted (out-of-band) spectrum content so that when it does alias (it will), the alias noise is below your desired noise floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, calling it an anti-alias filter as at least part of its purpose.  Other purposes might include to keep it from overloading a high-bandwidth input amplifier, or from coupling parasitic noise from or to the power supply, etc.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-02-27T19:19:02.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21800" PostTypeId="2" ParentId="21792" CreationDate="2015-02-27T19:59:17.467" Score="6" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;i want in fixed point,the q formats are 8,16,24,the computation time should be very less,and the coeffficents are constant they are not time varying.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;i guess i would recommend, &lt;a href=&quot;https://en.wikipedia.org/wiki/Digital_filter#Direct_Form_I&quot; rel=&quot;nofollow noreferrer&quot;&gt;Direct Form I&lt;/a&gt;.  use an accumulator that with word width equal to the sum of word widths of signal and coefficient.  so there's no accumulation of quantization error until the last step of computing the output signal word.  in that last step where you round or quantize from the accumulator to the output signal, i would suggest what is commonly called &amp;quot;fraction saving&amp;quot;, but could be called &amp;quot;first-order noise shaping with round-down quantizer&amp;quot;: whatever bits you lose (by truncation) in rounding down, add those zero-extended bits into the accumulator in the following sample.  this way your rounding error at DC is zero.  infinite S/N at DC, lowered S/N for low frequencies and slightly higher S/N for frequencies above Nyquist/3 .  and it kills a certain limit cycle that can be an annoyance for recursive fixed-point filters.&lt;/p&gt;&#xA;&lt;p&gt;and it's as cheap, computationally, as any other form (and cheaper than most other forms).  it &lt;em&gt;does&lt;/em&gt; require 2N+2 states for an order 2N string of cascaded biquad sections.  that's 2 more than the canonical &lt;a href=&quot;https://en.wikipedia.org/wiki/Digital_filter#Direct_Form_II&quot; rel=&quot;nofollow noreferrer&quot;&gt;Direct Form II&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-03-27T21:14:30.140" LastActivityDate="2023-03-27T21:14:30.140" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="21801" PostTypeId="2" ParentId="21794" CreationDate="2015-02-28T01:44:07.320" Score="0" Body="&lt;p&gt;Assume we want the output image still in the range of an image, i.e. an integer in [0, 255]. If you know $c$ and $d$, then $a$ and $b$ can be determined by solving equations below.&#xA;$$&#xA;( \min\{P_{in}\} - c ){( b - a )\over(d-c)}+a = 0\\&#xA;( \max\{P_{in}\} - c ){( b - a )\over(d-c)}+a = 255&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-02-28T01:44:07.320" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21802" PostTypeId="2" ParentId="21796" CreationDate="2015-02-28T09:25:42.123" Score="2" Body="&lt;p&gt;Ask your self what the plant noise is being used to model/represent. The usual suspects are the effects of unmodelled states and/or random drift in the model parameters (which could be the same thing but just treated differently). If you can answer that question you can make an attempt at deriving an appropriate plant nose co-variance yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other approach is trial and error.&lt;/p&gt;&#xA;" OwnerUserId="12119" LastActivityDate="2015-02-28T09:25:42.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21804" PostTypeId="2" ParentId="21796" CreationDate="2015-02-28T14:32:44.440" Score="8" Body="&lt;p&gt;First and foremost I really recommend &lt;a href=&quot;https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python&quot; rel=&quot;nofollow noreferrer&quot;&gt;this great textbook project&lt;/a&gt; about Kalman filtering. You can find some words about setting the process noise &lt;a href=&quot;http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/08_Designing_Kalman_Filters.ipynb#Tracking-a-Robot&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. There is also a &lt;a href=&quot;https://drive.google.com/file/d/0By_SW19c1BfhSVFzNHc0SjduNzg/view&quot; rel=&quot;nofollow noreferrer&quot;&gt;pdf version&lt;/a&gt; of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In every step the filter estimates a multivariate normal distribution with parameters $\mu = x$ (state vector) and $\sigma = P$ (covariance matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By looking the &lt;a href=&quot;http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/07_Kalman_Filter_Math.ipynb#Walking-Through-the-Kalman-Filter-Equations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kalman filter equations&lt;/a&gt; you can see that $Q$ is added to the predicted $FPF^T$. By doing this we 'artificially' smear the new normal distribution, increasing the uncertainty of our prediction. It also means that we raise the probabilities of the state vectors near $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you choose $Q$ with huge values compared to those of $P$ you essentially say that the model does a bad job predicting the process and we really have to extend the range we think the true state vector lies in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are free to choose a full matrix to be $Q$ as long as it is a valid covariance matrix. A diagonal $Q$ means that your state parameters are independent from each other. The &lt;a href=&quot;http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/06_Multivariate_Kalman_Filters.ipynb#Multivariate-Normal-Distributions&quot; rel=&quot;nofollow noreferrer&quot;&gt;section about the multivariate normal distribution&lt;/a&gt; can give you more insight as well as examples.&lt;/p&gt;&#xA;" OwnerUserId="156" LastEditorUserId="8202" LastEditDate="2017-04-20T09:13:11.723" LastActivityDate="2017-04-20T09:13:11.723" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21805" PostTypeId="1" CreationDate="2015-02-28T17:41:43.377" Score="0" ViewCount="84" Body="&lt;p&gt;$&#xA;f(x, y) = &#xA;\begin{cases}&#xA;1,\hspace{30px} x &amp;gt; 0 \\&#xA;0,\hspace{30px} else\\&#xA;\end{cases}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. $f(x,y)$ is a bi-variate function which is zero everywhere to the left of the y-axis and one everywhere to the right of the y-axis.&lt;/p&gt;&#xA;" OwnerUserId="14895" LastEditorUserId="4283" LastEditDate="2015-03-01T11:32:52.080" LastActivityDate="2015-03-01T11:32:52.080" Title="What is the 2D Fourier Transform of this function?" Tags="|fourier-transform|2d|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21806" PostTypeId="1" AcceptedAnswerId="21818" CreationDate="2015-02-28T20:14:18.027" Score="3" ViewCount="2342" Body="&lt;p&gt;&lt;strong&gt;Short question&lt;/strong&gt;&lt;br&gt;&#xA; What are main stages (steps) of calculation &lt;a href=&quot;http://en.wikipedia.org/wiki/Frequency_response&quot; rel=&quot;nofollow noreferrer&quot;&gt;frequency response&lt;/a&gt; of digital filter by their structure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Detailed question&lt;/strong&gt;&lt;br&gt;&#xA;Let suppose that there is discrete FIR filter with known structure which is implemented in programming language  (for instance with structure which shown in picture):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;              +-----+   +-----+&#xA;              |     |   |     |&#xA;x (k) &amp;gt;---+---|  T  |---|  T  |&#xA;          |   |     |   |     |&#xA;          |   +-----+   +-----+&#xA;          |      |         |&#xA;          |   +-----+      |&#xA;          |   |     |      |&#xA;          |   | x 2 |      |&#xA;          |   |     |      |&#xA;          |   +-----+      |&#xA;          |      |         |&#xA;          |   +----------------+   +-----+&#xA;          |   |       ___      |   |   1 |&#xA;          \---|       \        |---| x - |---&amp;gt; y (k)&#xA;              |       /__      |   |   4 |&#xA;              +----------------+   +-----+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is possible to pass into the filter input signal (as vector of integers which describe magnitude), like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;in [0, 0, 0, 0, 4, 0, 0, 0, 0, 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which describe signal with following magnitude:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             |&#xA;x (k)        |&#xA;             |&#xA;   . . . . . | . . . .&#xA;&#xA;k  9 8 7 6 5 4 3 2 1 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And get corresponding output signal, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;out [0, 0, 0, 0, 1, 2, 1, 0, 0, 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which describe signal with following magnitude:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y (k)&#xA;           |&#xA;   . . . | | | . . . .&#xA;k  9 8 7 6 5 4 3 2 1 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Question is how to calculate frequency response of the filter (by stages)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;&lt;br&gt;&#xA;With known input and output signals &lt;a href=&quot;https://dsp.stackexchange.com/questions/16671/output-of-a-system-given-its-transfer-function-and-input-beginner&quot;&gt;we can calculate&lt;/a&gt; transfer function of the filter by their images of Laplace transform (z-transform for discrete signals):&lt;br&gt;&#xA;1. $$X(z) = \mathcal{L} \{x(k)\}$$&lt;br&gt;&#xA;2. $$Y(z) = \mathcal{L} \{y(k)\}$$&lt;br&gt;&#xA;3. $$H(z) = Y(z) / X(z)$$&lt;br&gt;&#xA;And after if we get Fourier transform from transfer function we will get AFC:&lt;br&gt;&#xA;4. $$FR = \mathcal{F} \{H(z)\}$$&lt;br&gt;&#xA;Is it correct?&lt;/p&gt;&#xA;" OwnerUserId="10169" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-03-02T17:43:19.800" Title="Calculation frequency response of digital filter with known structure" Tags="|discrete-signals|frequency-response|transfer-function|digital-filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21808" PostTypeId="1" CreationDate="2015-02-28T21:42:04.500" Score="4" ViewCount="1022" Body="&lt;p&gt;I'm trying to implement a solution that would, to some extent, evaluate a picture telling what are the chances that it was upscaled from the smaller image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take a picture of unknown origin (scaled or not)&lt;/li&gt;&#xA;&lt;li&gt;Perform sharpening using some technique which sharpens only evident edges (1)  &lt;/li&gt;&#xA;&lt;li&gt;Extract edges using Difference of Gaussians&lt;/li&gt;&#xA;&lt;li&gt;Measure entropy of resulting image &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then downscale the image and upscale it back to the same size and compare entropies.&#xA;OR&#xA;Then upscale the image and downscale it back to the same size and compare entropies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it sound reasonable? What technique should I use as (1)? Also, maybe I should do it in small steps so I don't introduce too many artificial points? I mean if the image was upscaled (preferably instantly, to target size) it won't matter a lot - but it the image weren't upscaled this incremental improvement will be better for the picture than taking it and upscaling instantly?&lt;/p&gt;&#xA;" OwnerUserId="14896" LastActivityDate="2017-06-17T13:33:50.297" Title="Upscaling detection approach" Tags="|image-processing|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21809" PostTypeId="1" CreationDate="2015-03-01T04:27:05.153" Score="0" ViewCount="54" Body="&lt;p&gt;By just looking at the 2D Fourier Transform of a signal, can it every be known precisely which values in the space domain are zero?&lt;/p&gt;&#xA;" OwnerUserId="14895" LastActivityDate="2015-03-01T04:27:05.153" Title="Inferring space domain signal from 2D DFT" Tags="|fourier-transform|2d|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21810" PostTypeId="2" ParentId="21808" CreationDate="2015-03-01T05:33:43.947" Score="-1" Body="&lt;p&gt;A simple method for comparing images is &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html&quot; rel=&quot;nofollow&quot;&gt;template matching&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its usually used for finding a smaller image in a larger image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also use it as a way of comparing how similar two images of the same size are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The opencv article I linked to lists a number of different correlation functions such as sum of squared differences and correlation coefficient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether or not this will be accurate enough for what you are doing will only become clear after you have tried it.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2015-03-01T05:33:43.947" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21811" PostTypeId="2" ParentId="21792" CreationDate="2015-03-01T05:58:41.433" Score="17" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;what is fraction saving? can you write a code. so that i can understand more clearly?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Let's call the quantizer operator &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Quant}\{\cdot\}$&lt;/span&gt; .  So the output of the quantizer, with &lt;span class=&quot;math-container&quot;&gt;$v[n]$&lt;/span&gt; going in, is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n]  = \operatorname{Quant}\{ v[n] \}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which we shall model as an additive error source:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n]  =  v[n] + q[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;No matter how the quantizer works, we can always derive &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; in the run-time system with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$q[n]  \triangleq  y[n] - v[n]  =  \operatorname{Quant}\{ v[n] \}  -  v[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Even though &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; is, strictly speaking, a deterministic function of &lt;span class=&quot;math-container&quot;&gt;$v[n]$&lt;/span&gt;, often, if the signal swings are much larger than the step size, &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt;, of the quantizer, we model &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; as some kinda random number and a &amp;quot;noise source&amp;quot;.  It's when the signal gets very small, on par with &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt;, that this assumption is no good, and that's when you need to consider adding dither before the quantization operation.  I doubt you will need dither for your situation, but &amp;quot;ya never know&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;The simplest quantizer to implement in a fixed-point 2's complement system is simply dropping the less significant bits that are to the right of the rounding point or &amp;quot;binary point&amp;quot;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{Quant}\{ v[n] \}  \triangleq  \Delta \left\lfloor \frac{v[n]}{\Delta} \right\rfloor $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lfloor \cdot \rfloor$&lt;/span&gt; is the floor function, the same as the what the C function &lt;code&gt;floor()&lt;/code&gt;: returning the most-positive integer that does not exceed the argument to the function.  &lt;span class=&quot;math-container&quot;&gt;$\lfloor u \rfloor$&lt;/span&gt; is the sole integer that satisfies:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  u - 1 &amp;lt; \lfloor u \rfloor  \le  u  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \lfloor u \rfloor  \le  u  &amp;lt;  \lfloor u \rfloor + 1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$u \ge 0$&lt;/span&gt;, often we say that &lt;span class=&quot;math-container&quot;&gt;$\lfloor u \rfloor$&lt;/span&gt; is the &amp;quot;integer part&amp;quot; of the real value &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;.  The &amp;quot;fractional part&amp;quot; of &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$u - \lfloor u \rfloor$&lt;/span&gt;.  It is clear that the fractional part of &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 0  \le  u - \lfloor u \rfloor  &amp;lt;  1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the quantization error is the fractional part remaining after quantization is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ q[n]  =  \Delta \left\lfloor \frac{v[n]}{\Delta} \right\rfloor -  v[n] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That is the additive noise signal in terms of the input to the quantizer.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ -1  &amp;lt;  \frac{q[n]}{\Delta}  =  \left\lfloor \frac{v[n]}{\Delta} \right\rfloor - \frac{v[n]}{\Delta}  \le  0 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So we know that the additive quantization error, &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt;, has a range of&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ -\Delta &amp;lt; q[n] \le 0 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, we &lt;strong&gt;assume&lt;/strong&gt; (that's the only &amp;quot;rule-of-thumb&amp;quot;) that essentially the value of &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; is equally likely in that range so then &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; is viewed as a random number with uniform p.d.f.:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ p_q(\alpha) = \frac{1}{\Delta} \operatorname{rect}\left(\frac{\alpha}{\Delta} + \frac{1}{2}\right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\operatorname{rect}(\cdot)$&lt;/span&gt; is the standard unit rectangular function:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{rect}(u) \triangleq \begin{cases}&#xA;1, &amp;amp; \text{if } \ -\frac{1}{2} &amp;lt; u \le \frac{1}{2} \\&#xA;0, &amp;amp; \text{otherwise}&#xA;\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The expectation value or mean of &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$-\frac{\Delta}{2}$&lt;/span&gt; (a half-step bias toward the negative direction) and the variance is &lt;span class=&quot;math-container&quot;&gt;$\frac{\Delta^2}{12}$&lt;/span&gt;.  This is well known about uniform quantization.&lt;/p&gt;&#xA;&lt;p&gt;In the frequency domain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y(z)  =  V(z)  +  Q(z)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(for frequency response, we substitute &lt;span class=&quot;math-container&quot;&gt;$z = e^{j 2 \pi f T}$&lt;/span&gt;  where &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the sampling period and in reciprocal units as &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. Normalized frequency (using the DTFT or &amp;quot;discrete-time Fourier transform&amp;quot;) is &lt;span class=&quot;math-container&quot;&gt;$\omega \triangleq 2 \pi f T$&lt;/span&gt; and ranges &lt;span class=&quot;math-container&quot;&gt;$-\pi &amp;lt; \omega &amp;lt; \pi$&lt;/span&gt;.  In the DTFT, if the quantization error really &lt;strong&gt;is&lt;/strong&gt; random, &lt;span class=&quot;math-container&quot;&gt;$Q(e^{j \omega})$&lt;/span&gt; would have a Dirac impulse at &lt;span class=&quot;math-container&quot;&gt;$\omega=0$&lt;/span&gt; of magnitude &lt;span class=&quot;math-container&quot;&gt;$-\frac{\Delta}{2}$&lt;/span&gt; (to represent the DC bias of &lt;span class=&quot;math-container&quot;&gt;$-\frac{1}{2}$&lt;/span&gt; LSB because we're always rounding down) and otherwise a flat spectrum from &lt;span class=&quot;math-container&quot;&gt;$-\pi$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, that would, because of Parseval's theorem, have area of &lt;span class=&quot;math-container&quot;&gt;$\frac{\Delta^2}{12}$&lt;/span&gt;.  Maybe there's a &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; factor in that (which is why i don't usually like angular frequency over &amp;quot;ordinary frequency&amp;quot;).&lt;/p&gt;&#xA;&lt;p&gt;We know that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \int\limits_{-\infty}^{+\infty} p_q(\alpha) \ d\alpha \ = \ 1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The mean of quantization error (DC component):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\mu_q &amp;amp; \triangleq \overline{q[n]} \\&#xA;&amp;amp; \triangleq \lim_{N \to +\infty}\frac{1}{2N+1} \sum\limits_{n=-N}^{N} q[n] \\&#xA;&amp;amp; = \int\limits_{-\infty}^{+\infty}  p_q(\alpha) \ \alpha \ d\alpha \\&#xA;&amp;amp; = Q(e^{j 0}) \\&#xA;&amp;amp; = -\frac{\Delta}{2}&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The mean square of quantization error:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\overline{\left| q[n] \right|^2} &amp;amp; \triangleq \lim_{N \to +\infty}\frac{1}{2N+1} \sum\limits_{n=-N}^{N} |q[n]|^2 \\&#xA;&amp;amp; = \int\limits_{-\infty}^{+\infty}  p_q(\alpha) \ \alpha^2 \ d\alpha \\&#xA;&amp;amp; = \frac{1}{2\pi}\int\limits_{-\pi}^{+\pi} \left| Q(e^{j \omega}) \right|^2 d\omega \\&#xA;&amp;amp; = \frac{\Delta^2}{3}&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The variance of quantization error (AC power):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\sigma_q^2 &amp;amp; \triangleq \overline{\left| q[n] - \overline{q[n]} \right|^2} \\&#xA;&amp;amp; \triangleq \lim_{N \to +\infty}\frac{1}{2N+1} \sum\limits_{n=-N}^{N} |q[n] - \overline{q[n]}|^2 \\&#xA;&amp;amp; = \int\limits_{-\infty}^{+\infty}  p_q(\alpha) \ (\alpha-\mu_q)^2 \ d\alpha \\&#xA;&amp;amp; = \overline{\left| q[n] \right|^2} - \left|\overline{q[n]}\right|^2 \\&#xA;&amp;amp; = \frac{\Delta^2}{12}&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now (to get back to &amp;quot;fraction saving&amp;quot;) suppose &lt;span class=&quot;math-container&quot;&gt;$v[n]$&lt;/span&gt; is derived from your input, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, as so:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$v[n] = x[n] - q[n-1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So whatever error we added to &lt;span class=&quot;math-container&quot;&gt;$v[n]$&lt;/span&gt; by quantizing it, we will subtract, before quantization, from the quantized sample immediately following.&lt;/p&gt;&#xA;&lt;p&gt;(n.b.: Remember that &lt;span class=&quot;math-container&quot;&gt;$q[n] \le 0$&lt;/span&gt; and when we &amp;quot;add&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; in the quantization process, we are effectively subtracting whatever bits are to the right of the binary point by zeroing those bits, which is always rounding down.  So when we &amp;quot;subtract&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$q[n-1]$&lt;/span&gt; from the quantizer input, &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, before quantization, we are &lt;strong&gt;adding&lt;/strong&gt; those bits we dropped, extended on the left with zeroed bits, &lt;strong&gt;not&lt;/strong&gt; sign extended.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;y[n] &amp;amp; = \operatorname{Quant}\{ v[n] \} \\&#xA;     &amp;amp; = \operatorname{Quant}\{ x[n] - q[n-1] \} \\&#xA;     &amp;amp; = \quad x[n] - q[n-1] + q[n] \\&#xA;     &amp;amp; = \quad x[n] + (q[n] - q[n-1])  \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or, in the frequency domain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;Y(z) &amp;amp; = X(z) \quad + \quad Q(z) - Q(z) z^{-1} \\&#xA;     &amp;amp; = X(z) \quad + \quad (1 - z^{-1}) Q(z) \\&#xA;     &amp;amp; =  H_x(z) X(z) \quad + \quad H_q(z) Q(z) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the transfer function from input &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; to output &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; is still just a wire:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_x(z)  =  1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But the transfer function from the additive quantization noise &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; to the output &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_q(z) =  1 - z^{-1}  =  \frac{z-1}{z} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, like FIR filters, there is a pole at the origin &lt;span class=&quot;math-container&quot;&gt;$z=0$&lt;/span&gt; (big hairy deel), but there is a zero right at the DC point, &lt;span class=&quot;math-container&quot;&gt;$z=1$&lt;/span&gt;.  This &lt;strong&gt;kills&lt;/strong&gt; any contribution of quantization error to the output at the frequency of 0.  Even that &lt;span class=&quot;math-container&quot;&gt;$-\frac{\Delta}{2}$&lt;/span&gt; bias, from always rounding down, is killed.&lt;/p&gt;&#xA;&lt;p&gt;The magnitude of the noise to output frequency response is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;|H_q(e^{j \omega})| &amp;amp; = \frac{|e^{j \omega} - 1|}{|e^{j \omega}|} \\&#xA;     &amp;amp; = |e^{j \omega/2}| \frac{|e^{j \omega/2} - e^{-j \omega/2}|}{|e^{j \omega}|} \\&#xA;     &amp;amp; = 2 \left| \sin\left(\frac{\omega}{2} \right) \right| \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The transfer function, &lt;span class=&quot;math-container&quot;&gt;$H_q(\cdot)$&lt;/span&gt;, is 0 (or &lt;span class=&quot;math-container&quot;&gt;$-\infty$&lt;/span&gt; dB) at DC (&lt;span class=&quot;math-container&quot;&gt;$\omega=0$&lt;/span&gt;) and when you're up at Nyquist (or &lt;span class=&quot;math-container&quot;&gt;$\omega=\pi$&lt;/span&gt;) the gain is 2 (or 6 dB).  overall, there is no decrease in quantization noise energy, in fact, because energy is magnitude-squared, there is an &lt;strong&gt;increase&lt;/strong&gt; in total quantization energy, but at frequencies below &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{3}$&lt;/span&gt;, the quantization noise is reduced.  For us audio guys, we like that because none of us hears super well above 8 kHz anyway.&lt;/p&gt;&#xA;&lt;p&gt;But one thing it helps is that it destroys that limit cycle of IIR filters that gets them stuck on a non-zero DC value, even when the input truly goes to a dead zero.&lt;/p&gt;&#xA;&lt;p&gt;Code for a biquad (Direct Form I, &lt;strong&gt;not&lt;/strong&gt; Direct Form II which you don't wanna use, especially for fixed-point) that might look like that might be as below. To be clear in sign convention, the transfer function from input to output is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2}} {1 - a_1 z^{-1} - a_2 z^{-2}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This corresponds to a DF1 difference equation as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ y[n] = b_0 x[n] + b_1 x[n-1] + b_2 x[n-2] + a_1 y[n-1] + a_2 y[n-2] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With quantization it's:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ y[n] = \operatorname{Quant}\{ b_0 x[n] + b_1 x[n-1] + b_2 x[n-2] + a_1 y[n-1] + a_2 y[n-2] \} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because, in terms of actual mathematical values, any stable IIR will have  &lt;span class=&quot;math-container&quot;&gt;$-2 &amp;lt; a_1 &amp;lt; +2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1 &amp;lt; a_2 &amp;lt; +1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$b_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b_1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$b_2$&lt;/span&gt; are relative to each other so we worry less about their fixed range), so let's say that all our coefficients are all scaled up by a factor of &lt;span class=&quot;math-container&quot;&gt;$2^{14} = 16384$&lt;/span&gt; (so that the equivalent integer value of the fixed-point number ranges from &lt;span class=&quot;math-container&quot;&gt;$-2\cdot2^{14} = -32768 \ &amp;lt;$&lt;/span&gt; &lt;code&gt;a1&lt;/code&gt; &lt;span class=&quot;math-container&quot;&gt;$= 2^{14} a_1 &amp;lt; \ +2\cdot2^{14} = +32768$&lt;/span&gt;).  So the quantization or rounding point is at bit 14 of the 32 bit number.  The coefficients are also stored as 16-bit &lt;code&gt;int16_t&lt;/code&gt;, &lt;em&gt;but&lt;/em&gt; we are casting them to &lt;code&gt;int32_t&lt;/code&gt; upon loading so that the cast is not continuously necessary in the inner loop.  We want coefficient times state to be an &lt;code&gt;int32_t&lt;/code&gt;, even if both multiplier and multiplicand going in are &lt;code&gt;int16_t&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Version 1:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;int32_t accumulator;&#xA;&#xA;int32_t a1, a2, b0, b1, b2;   /* 2nd-order IIR coefficients */&#xA;&#xA;int16_t state_x1, state_x2, state_y1, state_y2, state_fraction;&#xA;&#xA;int16_t x, y;&#xA;&#xA;int16_t get_input(void);&#xA;&#xA;void put_output(int16_t y);&#xA;&#xA;int i, num_samples;&#xA;         /* num_samples is the number of samples per block */&#xA;&#xA;/*  load up your coefficients, cast all to int32_t */&#xA;&#xA;/*  load up your states from wherever */&#xA;&#xA;accumulator = (int32_t)state_fraction;&#xA;&#xA;for (i=0; i&amp;lt;num_samples; i++)&#xA;    {&#xA;    x = get_input();&#xA;&#xA;    accumulator += b0*x;&#xA;    accumulator += b1*state_x1;&#xA;    accumulator += b2*state_x2;&#xA;    accumulator += a1*state_y1;&#xA;    accumulator += a2*state_y2;&#xA;&#xA;    if (accumulator &amp;gt; 0x1FFFFFFF)&#xA;       {&#xA;       accumulator = 0x1FFFFFFF;     /* clip value */&#xA;       }&#xA;    if (accumulator &amp;lt; -0x20000000)&#xA;       {&#xA;       accumulator = -0x20000000;    /* clip value */&#xA;       }&#xA;&#xA;    y =  (int16_t)(accumulator&amp;gt;&amp;gt;14);   /* always rounding down */&#xA;&#xA;    state_x2 = state_x1;             /* bump the states over */&#xA;    state_x1 = x;&#xA;    state_y2 = state_y1;&#xA;    state_y1 = y;&#xA;&#xA;    accumulator = accumulator &amp;amp; 0x00003FFF;&#xA;    /* keep the fractional bits that you dropped for the next sample&#xA;       otherwise clear the accumulator */&#xA;&#xA;    put_output(y);&#xA;    }&#xA;&#xA;state_fraction = (int16_t)accumulator;&#xA;&#xA;/*  save your states back to wherever  */&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now another trick, to speed things up, is to adjust the &lt;code&gt;a1&lt;/code&gt; coefficient by subtracting the scaled fixed-point version of 1 (which, in this case, is &lt;span class=&quot;math-container&quot;&gt;$2^{14}$&lt;/span&gt;).  Then the code might look like:&lt;/p&gt;&#xA;&lt;p&gt;Version 2:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;int32_t accumulator;&#xA;&#xA;int32_t a1, a2, b0, b1, b2;   /* 2nd-order IIR coefficients */&#xA;&#xA;int16_t state_x1, state_x2, state_y1, state_y2, state_fraction;&#xA;&#xA;int16_t x, y;&#xA;&#xA;int16_t get_input(void);&#xA;&#xA;void put_output(int16_t y);&#xA;&#xA;int i, num_samples;&#xA;         /* num_samples is the number of samples per block */&#xA;&#xA;/*  load up your coefficients, cast all to int32_t*/&#xA;&#xA;/*  load up your states from wherever */&#xA;&#xA;a1 = a1 - 0x00004000;    /* adjust a1 coefficient */&#xA;/* 0x00004000 is &amp;quot;1&amp;quot; in our scaled-up fixed-point coefficients */&#xA;&#xA;accumulator = (int32_t)state_fraction + (((long)state_y1)&amp;lt;&amp;lt;14);&#xA;&#xA;for (i=0; i&amp;lt;num_samples; i++)&#xA;    {&#xA;    x = get_input();&#xA;&#xA;    accumulator += b0*x;&#xA;    accumulator += b1*state_x1;&#xA;    accumulator += b2*state_x2;&#xA;    accumulator += a1*state_y1;&#xA;    accumulator += a2*state_y2;&#xA;&#xA;    if (accumulator &amp;gt; 0x1FFFFFFF)&#xA;       {&#xA;       accumulator = 0x1FFFFFFF;     /* clip value */&#xA;       }&#xA;    if (accumulator &amp;lt; -0x20000000)&#xA;       {&#xA;       accumulator = -0x20000000;    /* clip value */&#xA;       }&#xA;&#xA;    y = (int16_t)(accumulator&amp;gt;&amp;gt;14);    /* always rounding down */&#xA;&#xA;    state_x2 = state_x1;             /* bump the states over */&#xA;    state_x1 = x;&#xA;    state_y2 = state_y1;&#xA;    state_y1 = y;&#xA;&#xA;    put_output(y);&#xA;    }&#xA;&#xA;state_fraction = (int16_t)(accumulator &amp;amp; 0x00003FFF);&#xA;&#xA;/*  save your states back to wherever  */&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note the missing bit-masking instruction at the bottom of the loop.  So you have the left bits having an extra value of &lt;span class=&quot;math-container&quot;&gt;$y[n-1]$&lt;/span&gt; in there.  That's why we have to fix &lt;code&gt;a1&lt;/code&gt; by subtracting 1 (again scaled by &lt;span class=&quot;math-container&quot;&gt;$2^{14}$&lt;/span&gt;) from it.  That &lt;em&gt;does&lt;/em&gt; affect the range of &lt;code&gt;a1&lt;/code&gt; by bumping it over.  Now it's &lt;span class=&quot;math-container&quot;&gt;$-2 &amp;lt; a_1 - 1 &amp;lt; +2$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1 &amp;lt; a_1 &amp;lt; +3$&lt;/span&gt; but the range of all of the other coefficients are unchanged.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-12-14T19:44:43.297" LastActivityDate="2023-12-14T19:44:43.297" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="21812" PostTypeId="2" ParentId="21762" CreationDate="2015-03-01T06:59:14.043" Score="1" Body="&lt;p&gt;I'll start with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hough line transform&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hough transform works by creating a buffer (2 dimensional in our case) which represents all the possible lines in the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any possible line can be represented with those 2 numbers $(\rho, \theta)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From wikipedia&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FX7ca.gif&quot; alt=&quot;rho theta&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note this uses polar coordinates to avoid division by zero issues rather than your typical $y = mx + c$ for a line&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hough transform scans an image and casts votes into the 2 dimensional buffer corresponding to $(\rho, \theta)$ values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The buffer slots that accumulate the most votes are likely to be attributed to the presence of a line for that $(\rho, \theta)$ value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the basic idea of the Hough transform but it can get more complicated from here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For selecting $(\rho, \theta)$ values from the buffer, methods can get more sophisticated, such as using &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_density_estimation&quot; rel=&quot;nofollow noreferrer&quot;&gt;kernel density estimation&lt;/a&gt;. Although I don't think opencv does that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hough circle transform&lt;/a&gt;, we now have a 3 dimensional buffer. &#xA;$(x, y, r)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x, y $:  coordinates of center of circle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r $: radius&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in practice there's more to making the Hough transform work than this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at the source code for the &lt;code&gt;icvHoughCirclesGradient&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its &lt;a href=&quot;https://github.com/Itseez/opencv/blob/7d4d28605087ec2d3878f9467aea313a2acdfd49/modules/imgproc/src/hough.cpp&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also &lt;code&gt;cvHoughCircles&lt;/code&gt; and &lt;code&gt;cv::HoughCircles&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see that the function is also doing &lt;a href=&quot;http://en.wikipedia.org/wiki/Canny_edge_detector&quot; rel=&quot;nofollow noreferrer&quot;&gt;canny&lt;/a&gt; edge detection and &lt;a href=&quot;http://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;sobel&lt;/a&gt; filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These operations have their own input parameters which you can also see as inputs to the hough function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examining the function signature&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void cv::HoughCircles( InputArray _image, OutputArray _circles,&#xA;int method, double dp, double min_dist,&#xA;double param1, double param2,&#xA;int minRadius, int maxRadius )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Method: There seems to be only on method now, probably left this for future development&lt;/p&gt;&#xA;&#xA;&lt;p&gt;dp: this is the resolution of the votes buffer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;min_dist : is the minimum distance between circles (ie: circles that are too close must be part of the same circle)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;minRadius and maxRadius are just that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;param1 and param2 are a bit more cryptic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but if you spot the lines &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int canny_threshold = cvRound(param1);&#xA;int acc_threshold = cvRound(param2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll see these are related to the canny edge detection and the accumulator threshold for selecting a circle from votes.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastActivityDate="2015-03-01T06:59:14.043" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21814" PostTypeId="1" CreationDate="2015-03-01T12:28:41.097" Score="1" ViewCount="1075" Body="&lt;p&gt;i have mini project to do about homography , but i am really a beginner in matlab . i have calculated the homography matrix easily by taking a set pixels from both images but the problem is how to apply this matrix to all pixels of the original image (i think it's difficult to treat each pixel individually ) . here is the original image :&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Rjan4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i want to apply the homography to this image ( i have already extracted the homography matrix ) to get a frontal view of the cover.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so with my weak knowledge of matlab , i applied the folowing operations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i get 4 points from the corners of the original image and the corresponding points in the output image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have estimated the homography :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.9638 -0.0960 52.5754; &#xA;0.2449 1.3808 -17.0081; &#xA;-0.0001 0.0013 1.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then i have applied it on the image using this poor matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [Ired] = affect(I,P)&#xA;I1=im2double(I);&#xA;for i=1:308&#xA;i&#xA;for j=1:288&#xA;v1 = [j;i;1];&#xA;v2 = P*v1;&#xA;v3 =v2/v2(3,1);&#xA;if (v3(1,1) &amp;lt;0 || v3(2,1)&amp;lt;0 || v3(3,1)&amp;lt;0)&#xA;   continue;&#xA;else     &#xA;Ired(round(1+v3(2,1)),round(1+v3(1,1)))=I1(i,j);&#xA;end&#xA;end &#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the result is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5nx28.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;- but the problem with this code is it takes a lot of time (sometimes 10 minutes) to perform the operation on the image especially if the size of the image is high so is there a way to implement this code without loops to make it faster? .&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;- i get these black dots all over the image , i can do a dilation but the image will be distorted , do you have an idea how to eliminate this dots without distorting the image ?.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="14831" LastEditorUserId="7092" LastEditDate="2015-03-03T19:27:21.270" LastActivityDate="2015-03-03T19:27:21.270" Title="homography matrix problem" Tags="|matlab|image-processing|homography|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21816" PostTypeId="1" CreationDate="2015-03-01T15:53:56.493" Score="0" ViewCount="374" Body="&lt;p&gt;In my solution to a certain problem I use subsampling in the frequency domain. Amazingly, it produces good results. Is it really that awkward to see subsampling in frequency domain? What the consequences really are?&lt;/p&gt;&#xA;" OwnerUserId="14896" LastActivityDate="2015-03-01T15:53:56.493" Title="What's the use case and explanation of frequency-domain subsampling?" Tags="|fft|sampling|downsampling|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21818" PostTypeId="2" ParentId="21806" CreationDate="2015-03-01T19:18:27.570" Score="5" Body="&lt;p&gt;For the given system you can write down the input-output relation as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[k]=\frac14\left(x[k]+2x[k-1]+x[k-2]\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $T$ (or $z^{-1}$) denotes a delay element, which delays its input by one sample interval.&#xA;The $\mathcal{Z}$-transform of (1) is (assuming zero initial conditions)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=\frac14\left(X(z)+2X(z)z^{-1}+X(z)z^{-2}\right)=\frac{X(z)}{4}\left(1+2z^{-1}+z^{-2}\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (2) you get the system's transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y(z)}{X(z)}=\frac14\left(1+2z^{-1}+z^{-2}\right)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the system is stable (any FIR filter is), the frequency response can be obtained by evaluating the transfer function on the unit circle $z=e^{j\omega}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\frac14\left(1+2e^{-j\omega}+e^{-2j\omega}\right)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also could have arrived at (4) by writing down the impulse response from (1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[k]=\frac14\left(\delta[k]+2\delta[k-1]+\delta[k-2]\right)\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and taking the (discrete-time) Fourier transform, which also results in (4).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, a few notes concerning misconceptions in your question:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$\mathcal{L}$ usually denotes the Laplace transform, which is defined for continuous functions. $X(z)$ is the $\mathcal{Z}$-transform of the sequence $x[k]$, which can be written as $X(z)=\mathcal{Z}\{x[k]\}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The frequency response of a linear time-invariant (LTI) system is the Fourier transform of the system's impulse response: $H(e^{j\omega})=\mathcal{F}\{h[k]\}$, not the Fourier transform of $H(z)$ (which you seem to think, judging from the last equation in your question).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-02T17:43:19.800" LastActivityDate="2015-03-02T17:43:19.800" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21820" PostTypeId="2" ParentId="11008" CreationDate="2015-03-01T22:48:12.263" Score="9" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is the fourier transform a special case of the laplace transform?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Laplace transform produces a 2D surface of complex values, while the Fourier transform produces a 1D line of complex values.  The Fourier transform is what you get when you slice the Laplace transform along the jω axis.  For instance, a simple lowpass filter $H(s)=\frac{1}{s+1}$ has a single pole in the S plane to the left of the origin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pDGJh.png&quot; alt=&quot;S plane and other plots&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Viewed from the side, the magnitude of this Laplace transform forms a surface, with the pole acting like a tent pole that raises the amplitude to infinity at that point (and an implied zero at infinity that drops the amplitude to zero the farther away from the origin you get in any direction):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1cuMb.gif&quot; alt=&quot;tent pole&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you now take the value of the surface along the jω axis only, that's the Fourier transform.  It's the red curve in the image above, which you can see forms a lowpass filter.  If you moved the pole farther away from the origin, the tent would move in the same direction, and the slice along the jω axis would drop, both reducing the gain (which we compensate for by adding overall gain) and increasing the cutoff frequency.  I've been meaning to make some animations of stuff like this...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.maximintegrated.com/en/app-notes/index.mvp/id/733&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.maximintegrated.com/en/app-notes/index.mvp/id/733&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/9579/29&quot;&gt;https://dsp.stackexchange.com/a/9579/29&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-03-01T22:48:12.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21821" PostTypeId="1" AcceptedAnswerId="21822" CreationDate="2015-03-01T23:53:16.353" Score="1" ViewCount="1459" Body="&lt;p&gt;I read a wav file in MATLAB and it has a sampling rate of 16kHz. I want to pass it through a filter I designed which has a sampling rate of 44.1 kHz. So, I thought I would use &lt;code&gt;resx=resample(x,44100,16000)&lt;/code&gt; first in order to make them have the same sampling rate. I can see that I will have more samples in time now, but what is the expected change of the fft of my signal? I thought that the fft of the resampled signal would be the fft of the initial signal (0-8kHz) stretched to (0-22.05kHz) but according to the MATLAB plots it is not. Is it logical?&lt;/p&gt;&#xA;" OwnerUserId="14901" LastActivityDate="2015-03-02T00:07:55.170" Title="Resampling signal in MATLAB" Tags="|matlab|discrete-signals|resampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21822" PostTypeId="2" ParentId="21821" CreationDate="2015-03-02T00:07:55.170" Score="3" Body="&lt;p&gt;To add to Famous Blue Raincoat's comment: the process of upsampling a signal aims to increase its sampling rate without affecting the signal otherwise. In your example, outputting &lt;code&gt;x&lt;/code&gt; or &lt;code&gt;resx&lt;/code&gt; through your sound card should produce exactly the same sound. Upsampling is useful when you need to match sampling frequencies between different systems without affecting the signals otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, downsampling aims to modify the signal as little as possible. All frequencies below the new Nyquist frequency will be left untouched.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-02T00:07:55.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21827" PostTypeId="1" CreationDate="2015-03-02T13:16:27.510" Score="1" ViewCount="139" Body="&lt;p&gt;I am trying to read a paper and I found it difficult to understand. This is a quote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Standard Mel frequency cepstrum coefficient (MFCC) computation technique utilizes discrete cosine transform (DCT) for decorrelating log energies of filter bank output. The use of DCT is reasonable here as the covariance matrix of Mel filter bank log energy (MFLE) can be compared with that of highly correlated Markov-I process.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I understand how MFCCs are computed. I know DCT coefficients are computed from the filtered energy banks. I am struggling to understand how exactly is &lt;strong&gt;covariance matrix&lt;/strong&gt; calculated. Another problem is that I don't fully understood what Markov-I property is. I have not found much about this specific property in internet appart from &lt;a href=&quot;http://en.wikipedia.org/wiki/Markov_property&quot; rel=&quot;nofollow&quot;&gt;Markov property&lt;/a&gt; which is AFAIK a process that does not rely on preceding states. They also say, the coefficients after DCT are not really decoupled. I would be grateful for some help in explanation of what markov-I process is and how DCT is related to a covariance matrix, and what covariance matrix is. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4721" LastEditorUserId="4721" LastEditDate="2015-03-03T00:43:59.427" LastActivityDate="2015-09-29T05:56:37.623" Title="Markov processes" Tags="|speech-recognition|speech-processing|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21829" PostTypeId="1" CreationDate="2015-03-02T15:07:30.853" Score="0" ViewCount="231" Body="&lt;p&gt;How to estimate if noise of sampled sound signal can be heard? I mean the noise that appear when an analog wave is sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly if I use 16bits, 24 bits, and 32 bits resolution, how to calculate noise in dB. I found this eq. SNR = 6.02*NoBits but I am not certain is it correct.&lt;/p&gt;&#xA;" OwnerUserId="4721" LastEditorUserId="4721" LastEditDate="2015-03-03T00:50:05.230" LastActivityDate="2015-03-03T00:50:05.230" Title="Noise from quantization and sampling frequency" Tags="|sampling|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21830" PostTypeId="2" ParentId="9126" CreationDate="2015-03-02T15:07:37.587" Score="2" Body="&lt;p&gt;Try using &lt;code&gt;im2double&lt;/code&gt; instead of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fft2(double(I));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, will be like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ima_double = im2double(I);&#xA;&#xA;imafft = fft2(ima_double);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when you will show the output image use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ima_out_u8 = im2uint8(ima_out);&#xA;&#xA;imshow(ima_out_u8);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And a better explanation can be found &lt;a href=&quot;http://www.mathworks.com/matlabcentral/answers/93573-why-do-i-receive-unexpected-results-when-using-fft2-ifft2-with-a-sequence-of-image-arithmetic-functi&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14909" LastEditorUserId="7092" LastEditDate="2015-03-02T15:50:25.563" LastActivityDate="2015-03-02T15:50:25.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21832" PostTypeId="1" CreationDate="2015-03-02T16:08:53.350" Score="4" ViewCount="3705" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tj04s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal, s, given at the end of this message. I need to remove the square wave shape from it. The desired signal is actually very small and it has been contaminated by a strong square-shape noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The desired signal is just couple peaks similar to an ECG or EEG but we have a very large square-shape noise that randomly affects some of the scan results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Central Freq = 10MHz,   Sampling Freq = 125MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please note that these are the frequencies related to the red signal and robot's transducer that transmits the ultrasonic pulse. These are not the frequencies of the blue signal nor that of the square-wise wave.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = [0.00463923811912537,0.00524966418743134,-0.000122085213661194,-0.00683677196502686,-0.00671468675136566,0.00183127820491791,0.00610426068305969,0.00256378948688507,-0.00500549376010895,-0.00647051632404327,-0.000610426068305969,0.00549383461475372,0.00476132333278656,-0.00329630076885223,-0.00805762410163879,-0.00256378948688507,0.00622634589672089,0.00915639102458954,0.00354047119617462,-0.00366255640983582,-0.00305213034152985,0.00488340854644775,0.00866805016994476,0.00476132333278656,-0.00439506769180298,-0.00720302760601044,-0.000732511281967163,0.00598217546939850,0.00402881205081940,-0.00390672683715820,-0.00915639102458954,-0.00317421555519104,0.00402881205081940,0.00598217546939850,0.000976681709289551,-0.00598217546939850,-0.00366255640983582,0.00561591982841492,0.0101330727338791,0.00720302760601044,-0.000732511281967163,-0.00183127820491791,0.00378464162349701,0.0102551579475403,0.00598217546939850,-0.00366255640983582,-0.00891222059726715,-0.00341838598251343,0.00134293735027313,0.00207544863224030,-0.00476132333278656,-0.0123306065797806,-0.00830179452896118,0.00427298247814179,0.0134293735027313,0.0155048221349716,0.0133072882890701,0.0153827369213104,0.0225857645273209,0.0220974236726761,0.00866805016994476,-0.0102551579475403,-0.0233182758092880,-0.0201440602540970,-0.0126968622207642,-0.00512757897377014,-0.00537174940109253,-0.00866805016994476,-0.00415089726448059,0.00366255640983582,0.00341838598251343,-0.00427298247814179,-0.0119643509387970,-0.0106214135885239,0.00109876692295074,0.0111097544431686,0.0129410326480865,0.00683677196502686,0.00280795991420746,0.00964473187923431,0.0168477594852448,0.0153827369213104,0.00586009025573731,-0.00427298247814179,-0.00586009025573731,-0.00341838598251343,-0.00573800504207611,-0.0152606517076492,-0.0238066166639328,-0.0242949575185776,-0.0181906968355179,-0.0152606517076492,-0.0229520201683044,-0.0310096442699432,-0.0290562808513641,-0.0115980952978134,0.00586009025573731,0.0212428271770477,0.0324746668338776,0.0376022458076477,0.0427298247814179,0.0583567321300507,0.0894884616136551,0.113783419132233,0.121230617165565,0.114271759986877,0.126236110925674,0.157612010836601,0.171529725193977,0.160542055964470,0.126968622207642,0.0648272484540939,0.00512757897377014,-0.0288121104240417,-0.0553046017885208,-0.0919301658868790,-0.142473444342613,-0.180197775363922,-0.187767058610916,-0.192040041089058,-0.219509214162827,-0.240019530057907,-0.246612131595612,-0.231717735528946,-0.172506406903267,-0.0767915993928909,0.0205103158950806,0.108289584517479,0.209742397069931,0.248199239373207,0.242339149117470,0.246490046381950,0.257843971252441,0.264314502477646,0.266267865896225,0.256012707948685,0.210719078779221,-0.00427298247814179,-0.169332191348076,-0.236234888434410,-0.236845314502716,-0.247100472450256,-0.255280196666718,-0.257111459970474,-0.253326833248138,-0.252228051424027,-0.256012707948685,-0.258820652961731,-0.259186923503876,-0.256989389657974,-0.231107309460640,0.0240507870912552,0.172506406903267,0.246245875954628,0.253326833248138,0.258088141679764,0.253937244415283,0.243071660399437,0.241240382194519,0.260285675525665,0.278110116720200,0.272372126579285,0.240141615271568,-0.0282016843557358,-0.180441945791245,-0.240996211767197,-0.235746547579765,-0.243315830826759,-0.257721900939941,-0.269197911024094,-0.268831640481949,-0.267732888460159,-0.269442081451416,-0.269808322191238,-0.262849479913712,-0.109632521867752,0.136491268873215,0.231595650315285,0.253326833248138,0.252472221851349,0.259919434785843,0.264802843332291,0.264192402362824,0.261018186807632,0.257966071367264,0.260041505098343,0.264802843332291,0.262727379798889,0.160908311605454,-0.106458306312561,-0.217189595103264,-0.247466728091240,-0.237821996212006,-0.250396788120270,-0.271151274442673,-0.278598457574844,-0.276034682989121,-0.266756206750870,-0.261750698089600,-0.255280196666718,-0.244414597749710,0.0291783660650253,0.194481745362282,0.263459891080856,0.253448903560638,0.246490046381950,0.247100472450256,0.258820652961731,0.270785003900528,0.278354287147522,0.271883785724640,0.259675264358521,0.220241725444794,-0.0590892434120178,-0.198022216558456,-0.266756206750870,-0.273470878601074,-0.274081319570541,-0.268343299627304,-0.269075810909271,-0.275058001279831,-0.275912582874298,-0.265413254499435,-0.250640958547592,-0.241484552621841,-0.000122085213661194,0.173849344253540,0.258332312107086,0.271151274442673,0.273470878601074,0.270907104015350,0.262116968631744,0.254181414842606,0.253082662820816,0.255036026239395,0.255036026239395,0.250640958547592,0.234281525015831,-0.0394335240125656,-0.193260893225670,-0.267854958772659,-0.273715049028397,-0.276767194271088,-0.271639615297318,-0.259431093931198,-0.246123790740967,-0.240874126553535,-0.243682086467743,-0.244292512536049,-0.234525695443153,-0.0302771329879761,0.171529725193977,0.256012707948685,0.267488718032837,0.267854958772659,0.271761685609818,0.272738367319107,0.264314502477646,0.251251369714737,0.244170427322388,0.244414597749710,0.239653274416924,-0.0218532532453537,-0.188255399465561,-0.269075810909271,-0.266512036323547,-0.262849479913712,-0.263948231935501,-0.264192402362824,-0.258576482534409,-0.246612131595612,-0.236723229289055,-0.231717735528946,-0.231473565101624,-0.106824561953545,0.137223780155182,0.243560001254082,0.272738367319107,0.263826161623001,0.251373469829559,0.241606637835503,0.238310337066650,0.241118296980858,0.241484552621841,0.241728723049164,0.242094978690147,0.214747890830040,-0.0557929426431656,-0.196190938353539,-0.266023695468903,-0.271151274442673,-0.269197911024094,-0.263337820768356,-0.255402266979218,-0.249420091509819,-0.245513364672661,-0.244048342108727,-0.239897444844246,-0.234647780656815,0.0107434988021851,0.176535218954086,0.252350151538849,0.252960562705994,0.254425585269928,0.254791855812073,0.249542176723480,0.244170427322388,0.244170427322388,0.245025023818016,0.244902938604355,0.242094978690147,0.204370647668839,-0.0599438399076462,-0.192406296730042,-0.246245875954628,-0.245391279459000,-0.248077154159546,-0.248565495014191,-0.241118296980858,-0.231717735528946];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/A87CM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8178" LastEditorUserId="8178" LastEditDate="2015-03-04T15:09:39.333" LastActivityDate="2015-10-02T07:39:15.487" Title="Removing unwanted square-wave noise from a signal" Tags="|signal-analysis|noise|wave|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21833" PostTypeId="2" ParentId="21827" CreationDate="2015-03-02T16:12:36.280" Score="1" Body="&lt;p&gt;From your question, I got:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;I am struggling to understand how exactly is computed the covariance matrix.&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Covariance matrix is written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    COV = \frac{\sum_{i=1}^n (X_{i} - \overline{x}) (Y_{i} - \overline{y})}{n - 1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then compute this (In English) as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1. Calculate the mean of the matrix &#xA;2. Calculate the product of the matrix (Multiply by the mean)&#xA;3. Subtract the product matrix (Calculated in step 2) by the mean&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is therefore your Covariance matrix. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;what covariance matrix is&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Covariance matrix is very similar to Correlation and unlike Correlation, the Covariance matrix is not constrained to being between -1 and 1. In simple terms, the Covariance is a measurement of how changes in one variable are linked with changes in a second variable, showing how two variables are associated with each other. (&lt;a href=&quot;https://stats.stackexchange.com/questions/29713/what-is-covariance-in-plain-language&quot;&gt;More Here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't really explain HOW the DCT is related to the covariance matrix, other than the example given above. The covariance matrix can be used to show if the values are dependant on each other. It could also be used to calculate the Eigen values/vectors of a particular matrix. Maybe if you provided a more specific example to the problem domain you would use this, it might be more helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps anyway.&lt;/p&gt;&#xA;" OwnerUserId="5182" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2015-03-02T16:12:36.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21834" PostTypeId="1" CreationDate="2015-03-02T17:53:43.253" Score="0" ViewCount="264" Body="&lt;p&gt;I'm working on a program in which I need to do the following about 20 times for each block of audio:&#xA;- Upsample from 192 to 768 kHz (x4)&#xA;- Clip&#xA;- Downsample back to 192 kHz (/4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm using now:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;FFT block size 4096&lt;/li&gt;&#xA;&lt;li&gt;Add 0's at the end of the FFT block&lt;/li&gt;&#xA;&lt;li&gt;IFFT block size 16384&lt;/li&gt;&#xA;&lt;li&gt;Clip audio&lt;/li&gt;&#xA;&lt;li&gt;FFT block size 16384&lt;/li&gt;&#xA;&lt;li&gt;IFFT block size 4096 (this ignores the higher freqs so it automatically lowpass filters)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For the FFT's I'm using Intel's IPP library, and all the other code (adding 0's, clipping) is written using AVX intrinsics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, doing this 20 times is heavy, and I know that it is possible to do it more efficiently, because in the 1st FFT step I'm adding 0's which are then used in the calculations (while they could be discarded) and at the other end, 75% of the FFT values that are calculated are discarded as well. So, even with FFT's, this should be possible more efficiently, which leads me to think that there must be more efficient resampling algorithms out there. But I haven't been able to find one yet.&lt;/p&gt;&#xA;" OwnerUserId="14910" LastEditorUserId="14910" LastEditDate="2015-03-03T00:31:44.870" LastActivityDate="2015-03-03T00:31:44.870" Title="Most efficient phase linear x4 resampling algorithm" Tags="|fft|fourier|resampling|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21835" PostTypeId="1" AcceptedAnswerId="21837" CreationDate="2015-03-02T21:24:21.237" Score="1" ViewCount="9694" Body="&lt;p&gt;I'm trying to quantize an image 8 bits to 4 or 2-bits uniformly. I searched internet, interestingly I could not find what I want exactly. Then I wrote an simple code for it myself. I'm curious about whether there is a build-in function in MATLAB which convert 8-bit image to 4-bits uniformly . My results using the methods from internet is not good. Am I doing something wrong when I use these methods? Thank you in advance.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Method from internet &lt;a href=&quot;http://www.mathworks.com/matlabcentral/answers/24669-down-quantization-8-bit-grey-to-n-bit-grey-n-8&quot; rel=&quot;nofollow noreferrer&quot;&gt;giving strange results&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;reducedImage = uint8((single(monalisa)/256)*2^4);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;  &#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KIbdi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Method writen by me. I'm putting code to clarify what I want to do.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;monalisa_2= monalisa;&#xA;figure&#xA;monalisa_2(monalisa&amp;lt;=63)               = 32  ; %% 00 &#xA;monalisa_2(monalisa&amp;lt;=127&amp;amp;monalisa&amp;gt;63)  = 85  ; %% 01&#xA;monalisa_2(monalisa&amp;lt;=191&amp;amp;monalisa&amp;gt;127) = 159 ; %% 10&#xA;monalisa_2(monalisa&amp;lt;=255&amp;amp;monalisa&amp;gt;191) = 223 ; %% 11&#xA;imshow(monalisa_2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/j1duM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13705" LastActivityDate="2015-03-26T12:09:59.707" Title="Quantization Image using MATLAB" Tags="|matlab|quantization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21836" PostTypeId="1" CreationDate="2015-03-02T21:42:24.010" Score="2" ViewCount="131" Body="&lt;p&gt;I am trying to get equivalent of this system using the Noble Identities:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] \rightarrow \boxed{H(z^L)} \rightarrow \boxed{\uparrow L} \rightarrow y[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my answer is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] \rightarrow \boxed{\uparrow L}  \rightarrow \boxed{H(z^{L\cdot L})} \rightarrow y[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this answer correct?&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="8202" LastEditDate="2015-03-02T22:06:26.020" LastActivityDate="2015-03-02T22:06:26.020" Title="How to make equivalent system using the Noble Identity?" Tags="|linear-systems|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21837" PostTypeId="2" ParentId="21835" CreationDate="2015-03-02T21:54:54.507" Score="2" Body="&lt;p&gt;I point you to this &lt;a href=&quot;https://stackoverflow.com/questions/12723699/changing-image-bit-depth-using-matlab&quot;&gt;https://stackoverflow.com/questions/12723699/changing-image-bit-depth-using-matlab&lt;/a&gt; it can be done. This particular post is only for png, but if I'm not mistaken all image types have the &lt;strong&gt;depth&lt;/strong&gt; parameter so they can likely all be changed in a similar manner&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your particular problem, since your images are already grayscale you would do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%change this as needed&#xA;desired_bit_depth = 2;&#xA;&#xA;my_pixel_depth = 2 ^ desired_bit_depth;&#xA;%converts grayscale to an indexed image at the appropriate depth&#xA;[ind_im, reduced_colormap ] = gray2ind(my_gray_image, my_pixel_depth)&#xA;&#xA;%displays your new image&#xA;figure()&#xA;subplot(1,2,1);imshow(my_gray_image); title('original')&#xA;subplot(1,2,2);imshow(ind_im,reduced_colormap); title(sprintf('reduced to %d bits',desired_bit_depth))&#xA;&#xA;% save indexed png&#xA;imwrite(ind_im, reduced_colormap, 'test.png', 'bitdepth', desired_bit_depth);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT #2: While reducing the &quot;bits&quot; to display the image, the &quot;colormap&quot; is made by taking the average of each range&lt;/strong&gt;&#xA;I kept the original answer because it still works and may suit someone elses needs in the future.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this solution, rather than using evenly spaced values for our &quot;colormap' we actually use the gray value that is the average over the specified range&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ex&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to convert to 1 bit image we have two ranges 0,128 and 128,256&lt;/p&gt;&#xA;&#xA;&lt;p&gt;replace all values between 0,128 with the average value between 0,128&lt;/p&gt;&#xA;&#xA;&lt;p&gt;replace all values between 128,256 with the average value between 128,256&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function result_im = ChangeBitDepthGrayImage(gray_im, desired_bit_depth)&#xA;    if (desired_bit_depth &amp;lt; 1)&#xA;        disp('converting to binary(1 bit) image');&#xA;        desired_bit_depth = 1;&#xA;    end&#xA;&#xA;    if (desired_bit_depth &amp;gt; 8)&#xA;        disp('converting to 8 bit image');&#xA;        desired_bit_depth = 8;&#xA;    end&#xA;&#xA;    %assuming we start with 8 bit image 256 levels&#xA;    num_levels = 2 ^ desired_bit_depth;&#xA;&#xA;    %figures out how big each range should be, we use +1 because if we&#xA;    %divide the data into N levels, there should be N+1 boundaries&#xA;    limits = linspace(0,256,num_levels + 1);&#xA;&#xA;    result_im = uint8(zeros(size(gray_im)));&#xA;&#xA;    for i = 1:num_levels&#xA;        lower_lim = limits(i);&#xA;        upper_lim = limits(i+1);&#xA;&#xA;        %creates a binary mask of values between the limits, the output is&#xA;        %0 or 1, but we need to make it uint8 for the next step&#xA;        temp_mask = uint8((gray_im &amp;gt;= lower_lim) &amp;amp; (gray_im &amp;lt; upper_lim)); &#xA;&#xA;        %multiplies image by mask, this isolates only pixels in the given&#xA;        %range&#xA;        image_only_in_range = temp_mask .* gray_im;&#xA;&#xA;        %finds the mean of that small part of the image. this weird notation is&#xA;        %taking the average of nonzero elements&#xA;        avg_val_for_range = round(mean(image_only_in_range(image_only_in_range~=0)));&#xA;&#xA;        %replaces all pixels in that range with the average val&#xA;        result_im = result_im +(avg_val_for_range * temp_mask);&#xA;    end&#xA;&#xA;&#xA;    %i just picked some random figure&#xA;    figure(32)&#xA;    subplot(1,2,1);imshow(gray_im);title('original image');&#xA;    subplot(1,2,2);imshow(result_im);title(sprintf('modified to %dbit image',desired_bit_depth));&#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2015-03-03T01:05:12.883" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21839" PostTypeId="2" ParentId="20231" CreationDate="2015-03-02T22:12:26.300" Score="6" Body="&lt;p&gt;For peak detection a nice method is the following: apply a maximal filter to the data and find the places where the filtered data equals to the original one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A maximal filter is simply sliding through the data and selecting the maximal element from the sliding window. Formally:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g_w[x] = \max\left(f[x-w], f[x-w+1], \dots , f[x+w-1], f[x+w]\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f[x]$ is the original data, $w$ is the half of the window size and $g_w[x]$ is the filtered data. Selecting places where $g_w[x] = f[x]$ are either the local maxima of $f$ or plateaus of local maxima. Obviously we don't want to have plateaus, a single point per peak would be desirable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first trick we can do is to apply a minimal filter to the data, select the local minima, then choose places where we detected local maximum (based on the maximal filter) but not a local minimum. This will eliminate long plateaus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other thing we can do is to select 'up edges' so places where a non local maximum is followed by a maximum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it clear I generated numeric data from the image you presented and wrote a short code. It uses two constants, one is the window size, the other is the minimum jump we require from a peak. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kwTty.png&quot; alt=&quot;the result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from matplotlib import pyplot as plt&#xA;from skimage import feature&#xA;from scipy.ndimage.filters import maximum_filter&#xA;&#xA;# put your data here&#xA;#data = np.array([0, 79, 75, 69, 69, 7, ...])&#xA;&#xA;filter_win_size = 12&#xA;peak_intensity_threshold = 10&#xA;&#xA;max_data = maximum_filter(data, filter_win_size)&#xA;min_data = -maximum_filter(-data, filter_win_size)&#xA;&#xA;# select places where we detect maximum but not minimum -&amp;gt; we dont want long plateaus&#xA;peak_mask = np.logical_and(max_data == data, min_data != data)&#xA;# select peaks where we have enough elevation&#xA;peak_mask = np.logical_and(peak_mask, max_data - min_data &amp;gt; peak_intensity_threshold)&#xA;# a trick to convert True to 1, False to -1&#xA;peak_mask = peak_mask * 2 - 1&#xA;# select only the up edges to eliminate multiple maximas in a single peak&#xA;peak_mask = np.correlate(peak_mask, [-1, 1], mode='same') == 2&#xA;&#xA;max_places = np.where(peak_mask)[0]&#xA;&#xA;fig, ax = plt.subplots()&#xA;r = range(data.shape[0])&#xA;ax.plot(r, data, 'k')&#xA;ax.plot(max_places, data[max_places], 'xr')&#xA;ax.grid()&#xA;ax.axis((0, 409, 0, 130))&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="156" LastActivityDate="2015-03-02T22:12:26.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21843" PostTypeId="2" ParentId="21796" CreationDate="2015-03-03T04:17:17.967" Score="10" Body="&lt;p&gt;I'm the author of the textbook linked to above. This is a new account and thus I am not allowed to reply to that answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, the Gaussian chapter covers the definition of a covariance matrix. In general though your Q matrix will be full, not a diagonal, because there is correlation between the state variables. For example, suppose you are tracking position and velocity in x-axis for a car. Process noise (which Q is modelling) might be things like wind, bumps in the road, and so on. If there is a change in velocity due to this noise, there will also be a change in position. They are correlated, and so the off-diagonal elements will be non-zero for those terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Kalman math chapter tells you how to compute the Q matrix for various scenarios. Admittedly there is more work to be done on that section. It's one of the more opaque subjects as most sources either gloss over it or just throw an integral at you and expect you to figure out the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the companion &lt;a href=&quot;https://github.com/rlabbe/filterpy&quot;&gt;FilterPy project&lt;/a&gt; contains code to compute the full Q matrix for you given common scenarios. The code is in common/discretization. For analytically difficult situations there is a routine to find the result numerically following an idea from Golub and Van Loan; the textbook is lacking on this topic, however.&lt;/p&gt;&#xA;" OwnerUserId="14915" LastActivityDate="2015-03-03T04:17:17.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21846" PostTypeId="1" AcceptedAnswerId="21849" CreationDate="2015-03-03T09:30:44.857" Score="3" ViewCount="3226" Body="&lt;p&gt;Which bins of FFT result are useful? For example I made FFT on 1024 real samples, and it produced result with 1024 complex samples.&lt;br&gt;&#xA;I read somewhere, the only half of that result is useful if input samples are of type real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is bin number 513 (nyquist frequency) useful? Should I cut this bin or it should stay?&lt;/p&gt;&#xA;" OwnerUserId="1708" LastEditorUserId="8202" LastEditDate="2015-03-03T11:11:12.097" LastActivityDate="2015-03-03T16:13:18.933" Title="FFT Result - which bins are useful" Tags="|fft|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21849" PostTypeId="2" ParentId="21846" CreationDate="2015-03-03T10:57:06.890" Score="4" Body="&lt;p&gt;I believe you should use the Nyquist bin every time. By having it, you can always recreate the full DFT of your real-valued signal from the first half of spectrum. Whereas if you discard this value there is no way back and you can recreate your time domain signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As in &lt;a href=&quot;https://stackoverflow.com/questions/4364823/how-do-i-obtain-the-frequencies-of-each-value-in-a-fft/4371627#4371627&quot;&gt;&lt;strong&gt;&lt;em&gt;answer&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; you pointed to, usually the Nyquist bin shouldn't contain any data when &lt;em&gt;while using anti-aliasing filter&lt;/em&gt;. Nevertheless sometimes you might want to estimate the energy of your signal from it's DFT. You might therefore get inaccurate value. Question is, do you really care about such accuracy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to wrap up. I always use Nyquist bin and I don't need to ask myself these questions.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2015-03-03T10:57:06.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21850" PostTypeId="1" AcceptedAnswerId="21859" CreationDate="2015-03-03T11:26:45.603" Score="0" ViewCount="1382" Body="&lt;p&gt;I have come across sampling rate conversion factor, which is given by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                             S_factor = F_new/F_old&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If F_new &gt; F_old, then s_factor &gt; 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If F_new &amp;lt; F_old, then s_factor &amp;lt; 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, what is this &quot;linear interpolation factor&quot;?. Is it the same as sampling rate conversion factor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the linear interpolation factors value should be in the range 0 to 1?, If so, why is that?&lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="9152" LastEditDate="2015-03-03T12:23:48.877" LastActivityDate="2015-03-03T17:11:55.070" Title="What is the difference between Linear Interpolation factor and Sampling rate conversion factor?" Tags="|interpolation|resampling|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="21853" PostTypeId="1" AcceptedAnswerId="22009" CreationDate="2015-03-03T13:48:05.467" Score="2" ViewCount="923" Body="&lt;p&gt;I am trying to stream audio from device. I can't use the PCM audio because it is not compact enough, and I don't have so much bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the option to substitute wave PCM with some codec? I am interested in good quality for speech and sampling frequency up to 16 kHz. Is ADPCM a good choice? Where can I find info about that?&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="8202" LastEditDate="2015-03-03T15:05:46.410" LastActivityDate="2015-03-12T12:31:59.080" Title="What is the best codec for streaming of audio in this case?" Tags="|discrete-signals|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21854" PostTypeId="2" ParentId="8565" CreationDate="2015-03-03T14:18:54.717" Score="0" Body="&lt;p&gt;I would like to expand Hilmar's answer for the benefit of those reading it as reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = ellip(8,1.5,60,[.2 .3]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will actually produce a 16th order bandpass IIR filter according to the MATLAB &lt;a href=&quot;http://uk.mathworks.com/help/signal/ref/ellip.html&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first argument n will only be equal to the filter order if you are designing a low pass IIR filter, otherwise the filter order will be 2n.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, if you want to get an 8th order IIR filter, you should use these arguments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = ellip(4,1.5,60,[.2 .3]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14920" LastEditorUserId="14920" LastEditDate="2015-03-03T16:04:37.403" LastActivityDate="2015-03-03T16:04:37.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21856" PostTypeId="2" ParentId="21846" CreationDate="2015-03-03T16:07:32.303" Score="2" Body="&lt;p&gt;Even with an anti-alias filter, which needs to cut-off below Fs/2 for any finite length window and finite width transition band, filter roll-off noise and artifacts (&quot;leakage&quot;) produced by convolution with the window function can end up in the middle (N/2) bin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So reconstruction by IFFT (overlap add/save fast convolution, et.al.) and total power analysis (Parseval's) requires using the middle bin.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But any FFT result analysis that tries to ignore windowing leakage or filter stop band or left-over aliasing noise could ignore that bin (and maybe even some number of bins near it) as stuff in the noise floor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-03-03T16:13:18.933" LastActivityDate="2015-03-03T16:13:18.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21857" PostTypeId="2" ParentId="21846" CreationDate="2015-03-03T16:09:32.967" Score="4" Body="&lt;p&gt;Half of the FFT transform from real data is redundant.  However, the imaginary parts of bin 1 and bin 513 are zero, so that's where the redundancy in those bins is.  As a result, you need bins 1 to 513 to represent the original data (you could stuff the real part of bin 513 into the imaginary part of bin 1 if you really wanted to get along with 1024 words of storage).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question is whether bin 513 is useful.  That depends on what you are doing.  It is quite unlikely that it is significantly less useful than bin 512, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using FFT as a mechanism for implementing convolution, you won't want to lose information, so you'll need bin 513.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using it as an analysis tool, it is likely that you will be working with analog prefiltering and windowing and other tools that make higher frequencies taper off.  But then the tapering off will not just hit bin 513 but will affect quite a number of bins before that as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On its own, the FFT/DFT is a representation of the frequencies of a &lt;em&gt;periodic&lt;/em&gt; signal with a period of 1024 (in your case).  But it's rarely data from an actual circle that you are applying it on: FFT is almost always applied as a component in some more complex algorithm, using padding, windowing, overlap-add and other stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the bins mean and how important retaining every one of them is depends on just what you use the FFT for.&lt;/p&gt;&#xA;" OwnerUserId="14924" LastActivityDate="2015-03-03T16:09:32.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21858" PostTypeId="1" CreationDate="2015-03-03T16:29:30.830" Score="0" ViewCount="46" Body="&lt;p&gt;I have a signal $s(t)$ which consists of 3 damped sines it can be written as:&#xA;$$&#xA;s(t) = A_1\sin(\omega_1t + \phi_1)\exp(-t/t_1) + A_2\sin(\omega_2 t + \phi_2)\exp(-t/t_2) + \\A_3\sin(\omega_3 t + \phi_3)\exp(-t/t_3) + n(t),&#xA;$$&#xA;where $n(t)$ is noise.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to make the $\phi_1 = \phi_2 = \phi_3 = 0$; Any filter can fulfill the task?&lt;/li&gt;&#xA;&lt;li&gt;It is also desirable to extract $A_1$, $A_2$ and $A_3$. But some times $A$s can be negative.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="14925" LastEditorUserId="1606" LastEditDate="2015-03-03T16:48:56.023" LastActivityDate="2015-03-03T16:48:56.023" Title="Correct the phase of several damped sines" Tags="|filters|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21859" PostTypeId="2" ParentId="21850" CreationDate="2015-03-03T17:11:55.070" Score="1" Body="&lt;p&gt;I'll move my comments to an answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With sample rate conversion factor $S$, you want to compute samples at &quot;time&quot; $\frac{i}{S}$ for $i=0,1,2,\dots$. &quot;Time&quot; relating to the index of the previous series. The linear interpolation factor is simply then the fractional part of $\frac{i}{S}$ for each $i$ with the integer part telling which sample index to use (together the next) for the linear interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple example to clarify: upsample a sequence a factor $\frac{10}{9}$. You would like to determine the samples at &quot;time&quot; $0, 0.9, 1.8, 2.7, 3.6, \dots$.  First, start with sample $0$, then, compute the linear interpolation between sample $0$ and $1$ with $\eta = 0.9$. Next sample should be at &quot;time&quot; $1.8$, so $\eta = 0.8$ for samples $1$ and $2$. &quot;Time&quot; $2.7$ gives $\eta = 0.7$ for samples $2$ and $3$ and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you conceptually can compute the &quot;time&quot; $1.8$ sample from sample $0$ and $1$ with $\eta = 1.8$, but using sample $1$ and $2$ with $\eta = 0.8$ is better. So while $\eta$ does not &lt;em&gt;really&lt;/em&gt; have to be $0$ and $1$ the results will be better and there is no advantage to not have it in that range.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-03-03T17:11:55.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21860" PostTypeId="2" ParentId="21814" CreationDate="2015-03-03T17:14:40.343" Score="2" Body="&lt;p&gt;Matrix/vector operations are really strongly optimized in Matlab/Octave. Use them whenever you can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, instead of multiplying the 3x3 homography matrix with a 3x1 vector for NxM times you can easily modify your calculation to do a multiplication with a 3x3 matrix and a 3xM matrix for N times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out this Octave code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;warning (&quot;off&quot;, &quot;Octave:broadcast&quot;);&#xA;w = 1280;&#xA;h = 720;&#xA;H = rand(3);&#xA;&#xA;tic();&#xA;for i=1:h &#xA;    for j=1:w &#xA;        H*[i;j;1]/(H(3,:)*[i;j;1]); &#xA;    end&#xA;end; &#xA;toc();&#xA;&#xA;tic();&#xA;for i=1:h &#xA;    v=[ones(1,w)*i;1:w;ones(1,w)];&#xA;    (H*v)./(H(3,:)*v); &#xA;end; &#xA;toc();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It gives me the following result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Elapsed time is 25.5651 seconds.&#xA;Elapsed time is 0.273893 seconds.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe you can go further by generating a 3x(N*M) matrix with all the image coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a simple solution to the 'black dots' problem. Right now you have the homography $H$ between the original image and the cover image and you generate the points by looping through the pixels of the original image $(x,y)$ to color the points $(x',y')$ in the destination image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's have the homography $H^{-1}$, loop through all the pixels in the destination image and calculate the pixel address of the original image you want to sample the color from.&lt;/p&gt;&#xA;" OwnerUserId="156" LastActivityDate="2015-03-03T17:14:40.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21862" PostTypeId="2" ParentId="8565" CreationDate="2015-03-03T19:32:15.270" Score="1" Body="&lt;p&gt;With the new answer (indirectly) pointing out that Hilmar's filter is of order ten and not eight, one may have to reinterpret the edges of the original question. It is easy to assume that they are normalized to the sampling frequency and not the Nyquist frequency (not only based on the eight-order assumption, but also that the filter in that case gives a symmetric filter which makes sense from a home work point of view).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the corresponding line would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = ellip(4,1.5,60,[.4 .6]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this filter can also be designed as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = ellip(4,1.5,60, 0.8, 'high');&#xA;b=upsample(b,2);&#xA;a=upsample(a,2);&#xA;&#xA;%% Where one may want to shave the trailing zero off by:&#xA;b(10)=[];&#xA;a(10)=[];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the final design, the transfer is made (visibly) periodic by replacing each delay element by two. There are of course low-pass to band-pass transformations to do the same thing.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2015-03-06T09:09:00.130" LastActivityDate="2015-03-06T09:09:00.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21863" PostTypeId="2" ParentId="21794" CreationDate="2015-03-03T19:54:16.040" Score="1" Body="&lt;p&gt;I think this is the equation you are using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zVuTy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Normalization_%28image_processing%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Normalization_%28image_processing%29&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;b=newMin&lt;/code&gt; and &lt;code&gt;a=newMax&lt;/code&gt; These values can also be found from your histogram. Usually you expand the new image to take up the full intensity range. The intensity range of your image is the X-axis of your histogram. If it goes from 0 to 1, then &lt;code&gt;a=1, b=0&lt;/code&gt; if your hsitogram is from 0 to 255 &lt;code&gt;a=255,b=0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a=newMax= most likely the last value of the x-axis on your histogram&#xA;b=newMin= most likely the very first value of the x-axis on your histogram&#xA;c=Min=last  nonzero element in histogram&#xA;d=Max=first nonzero element in histogram&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2015-03-03T19:54:16.040" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21864" PostTypeId="1" AcceptedAnswerId="21865" CreationDate="2015-03-03T21:54:23.803" Score="2" ViewCount="534" Body="&lt;p&gt;I try to plot the frequency response of the delay line canceller (FIR filter which used for &lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_target_indication&quot; rel=&quot;nofollow noreferrer&quot;&gt;MTI&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The delay line canceller has the following structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;              +-----+&#xA;              |     |&#xA;x [k] &amp;gt;---+---|  T  |&#xA;          |   |     |&#xA;          |   +-----+&#xA;          |      |&#xA;          |   +-----+&#xA;          |   |     |&#xA;          |   |x -1 |&#xA;          |   |     |&#xA;          |   +-----+&#xA;          |      |&#xA;          |   +-----+&#xA;          |   | ___ |&#xA;          \---| \   |---&amp;gt; y [k]&#xA;              | /__ |&#xA;              +-----+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Its frequency response is well known (&lt;a href=&quot;http://esl.eng.ohio-state.edu/~cbaker/cb_files/classes/ece5013/PDFs/14.%20Doppler%20Radar%20and%20MTI_2014.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pg 20&lt;/a&gt;) and equal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega) = 2 \cdot \left|\sin (\frac{\omega \cdot T} {2})\right|&#xA;\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also try obtain frequency response of the canceller using algorithm which described on &lt;a href=&quot;https://dsp.stackexchange.com/questions/21806/calculation-frequency-response-of-digital-filter-with-known-structure&quot;&gt;this question&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y [k] = x [k] - x [k - 1] \tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y (z) = X (z) - X (z) z ^{-1} \tag {3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = 1 - z^{-1} \tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I try to plot (using &lt;a href=&quot;http://en.wikipedia.org/wiki/GNU_Octave&quot; rel=&quot;nofollow noreferrer&quot;&gt;GNU Octave&lt;/a&gt;) both of responses (1) and (4).  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w = linspace (0, 2 * pi, 100);&#xA;z = exp (-j .* w);&#xA;&#xA;H_z = 1 - z .^ -1;&#xA;H_w = 2.0 * abs (sin (w / 2) );&#xA;&#xA;hold (&quot;on&quot;);&#xA;plot (w, H_z, &quot;1&quot;, &quot;linewidth&quot;, 2);&#xA;plot (w, H_w, &quot;2&quot;, &quot;linewidth&quot;, 2);&#xA;title (&quot;Frequency response of the delay line canceler.&quot;);&#xA;set (gca, 'XTick',     0: pi / 2: 2 * pi)&#xA;set (gca, 'XTickLabel',{'0', 'pi / 2', 'pi', '3 pi / 2','2 pi'})&#xA;xlabel (&quot;Angular frequency.&quot;);&#xA;ylabel (&quot;Magnitude.&quot;);&#xA;legend (&quot;H (z)&quot;, 'H (\omega)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I expect that they will be the same, but they are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wnw9t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is my mistake?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. If I add modulus for (4) (like: &lt;code&gt;H_z = abs (1 - z .^ -1);&lt;/code&gt;) they will became the same.&lt;/p&gt;&#xA;" OwnerUserId="10169" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-12-25T22:48:57.287" Title="Plot the frequency response of MTI delay line canceller using Octave" Tags="|filters|frequency-response|radar|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21865" PostTypeId="2" ParentId="21864" CreationDate="2015-03-03T22:19:09.583" Score="2" Body="&lt;p&gt;Magnitude &lt;code&gt;|H(z)|&lt;/code&gt; is always defined as an absolute value of your transfer function &lt;code&gt;H(z)&lt;/code&gt; values which are complex. What you are plotting is the vector that contains complex numbers. You need to take their absolute value and that will give you magnitude. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you call the &lt;code&gt;angle&lt;/code&gt; function then you are going to get phase. Transfer function &lt;code&gt;H(z)&lt;/code&gt; is always complex. Try to print values of &lt;code&gt;real(H_z)&lt;/code&gt; and &lt;code&gt;imag(H_z)&lt;/code&gt;, then you will see real and imaginary values of $H(z)$. Now magnitude &lt;code&gt;|H(z)|&lt;/code&gt; is &lt;code&gt;sqrt(real * real + imag * imag)&lt;/code&gt; for every sample...&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="13742" LastEditDate="2015-03-12T09:23:10.127" LastActivityDate="2015-03-12T09:23:10.127" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21866" PostTypeId="1" CreationDate="2015-03-03T23:32:22.623" Score="0" ViewCount="1315" Body="&lt;p&gt;I'm trying to create and process an OBPSK signal, which, as I understand it, transmits even bits on one axis and the odd bits on the opposite axis, resulting in a constellation with 4 unique points. OBPSK seems to be somewhat rare, and a lot of software doesn't have functions to handle it. I created it (if I understand it correctly) by modulating the even and odd bits as BPSK separately, and rotating one of them by 90 degrees. However, with 4 constellation points, it seems similar to QPSK, or more specifically OQPSK, which is common with software having built in functions for modulation, etc. Is there some way to process OPSK, perhaps with some sort of transformation and/or change in data rate, as OQPSK?&lt;/p&gt;&#xA;" OwnerUserId="12087" LastActivityDate="2019-04-14T07:57:06.480" Title="Processing OBPSK as OQPSK" Tags="|digital-communications|modulation|qpsk|bpsk|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21868" PostTypeId="2" ParentId="21866" CreationDate="2015-03-04T01:15:37.280" Score="1" Body="&lt;p&gt;This is the first time I hear about OBPSK. From your description, it sounds exactly like QPSK, which is actually two BPSK signals, modulated with carriers of the same frequency, but which are $\pi/2$ radians out of phase with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OQPSK is slightly different. In it, one of the data streams is delayed half a symbol period. The purpose is preventing both streams from changing at the same time and causing a change of phase of $\pi$ in the carrier, which is hard for amplifiers and other components to handle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your position, I would look deeper into this OBPSK modulation to see if it's really different from QPSK. Feel free to ask again/modify your question if you come up with more information.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-04T01:15:37.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21869" PostTypeId="1" AcceptedAnswerId="21872" CreationDate="2015-03-04T02:20:21.620" Score="2" ViewCount="1669" Body="&lt;p&gt;A bit stream is mapped to symbols during baseband modulation, each symbol (say for QPSK) represents two bits. Each symbol has a corresponding I &amp;amp; Q value, which in QPSK, are used as the amplitude for a cosine and sine carrier wave, which are then summed for the QPSK passband signal. Where does the baud rate come into play? If it is the rate at which the bit stream is processed and modulating the carrier, how do I account for baud rate if I just have a bit vector converted into a complex vector of symbols, in say, Matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I have a receiver digitizing the passband signal I receive into I/Q samples, do these values correspond to the original I/Q values representing the symbol? If the sample rate 4x the baud rate, I should receive 4:1 received samples:transmitted symbols? I would then down sample into 1:1 Rx:Tx symbols, then map the symbols back to bits using the Tx constellation (assuming no rotation)?&lt;/p&gt;&#xA;" OwnerUserId="12087" LastEditorUserId="1606" LastEditDate="2015-03-04T09:00:10.817" LastActivityDate="2015-03-04T16:15:55.467" Title="I/Q Sampling and Demodulation" Tags="|digital-communications|demodulation|qpsk|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21870" PostTypeId="2" ParentId="21853" CreationDate="2015-03-04T05:40:00.243" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://www.speex.org/&quot; rel=&quot;nofollow&quot;&gt;Speex&lt;/a&gt; has been in use for some time for real-time chat. It was specifically designed for voice. Some more advanced codecs for voice are based on it. The advantage of Speex is that it is free, source code readily available and fast in terms of encoding and decoding. The compression ratio is variable but your are most likely to use a setting of about 10:1 for quality reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't used Speex in some time and have no idea where the code currently stands. I recall having to use an older revision because a newer version used C++ &lt;em&gt;new&lt;/em&gt; extensively and was unsuitable for use by the system's coprocessor environment it was running in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You didn't mention whether the source you are streaming is live or pre-recorded. Whether you need to both encode and decode is important. It typically takes longer to encode than to decode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also important is whether you will always play from the beginning or can jump to any point ahead or behind. Many compression schemes rely on &quot;state&quot; from the previously decoded block which can make seeking a problem.&#xA;(This would be a comment but I'm a lowly newb.)&lt;/p&gt;&#xA;" OwnerUserId="14914" LastEditorUserId="14914" LastEditDate="2015-03-04T22:15:18.723" LastActivityDate="2015-03-04T22:15:18.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21871" PostTypeId="1" CreationDate="2015-03-04T08:49:50.883" Score="0" ViewCount="2984" Body="&lt;p&gt;I have implemented Direct Form 2 IIR filter. The input is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_delta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker delta function&lt;/a&gt;. I have written code for the response of the filter for Kronecker delta input. The code is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;clc;   &#xA;clear all;&#xA;close all;&#xA;x=[1,zeros(1,150)];%input sequence&#xA;&#xA;y=[];%output sequence&#xA;&#xA;b=[1,-1.5511722144889886,1];%numerator coefficients&#xA;&#xA;a=[1,-1.7473520798913149,0.79762351115754226];%denominator coefficients&#xA;&#xA;bs=0.099825504845559299*b; &#xA;%...floating point.....%&#xA;w=[];&#xA;&#xA;w(1)=x(1);&#xA; &#xA;w(2)=-a(2)*w(1)+x(2);&#xA;&#xA;y(1)=bs(1)*w(1);&#xA; &#xA;y(2)=bs(1)*w(2)+bs(2)*w(1);&#xA; for n=3:1:150&#xA;     &#xA;w(n)=x(n)-a(2)*w(n-1)-a(3)*w(n-2);&#xA;    &#xA;y(n)=bs(1)*w(n)+bs(2)*w(n-1)+bs(3)*w(n-2);&#xA; &#xA;end&#xA;&#xA;%freqz(y);&#xA;&#xA;% &#xA;&#xA;% &#xA;&#xA;%.....fixed point conversion....%&#xA;&#xA;%.....considering precision of 16 i.e q16 format....%&#xA;&#xA;for n=1:3&#xA;&#xA;    a_f(n)=int64(a(n)*pow2(16));%.....................converted into fixed......%&#xA;&#xA;end&#xA;&#xA; for n=1:3&#xA;&#xA;     b_f(n)=int64(bs(n)*pow2(16));&#xA;&#xA; end&#xA;&#xA;for n=1:3&#xA;&#xA;    a_fix2float(n)=double(a_f(n))*pow2(-16);&#xA;&#xA;end&#xA;&#xA;for n=1:3&#xA;&#xA;    b_fix2float(n)=double(b_f(n))*pow2(-16);&#xA;&#xA;end&#xA;&#xA;w_f(1)=(x(1)*pow2(16));&#xA;&#xA;w_f(2)=((-a_f(2)*w_f(1))*pow2(-16));&#xA;&#xA;for n=3:150&#xA;&#xA;    w_f(n)=((-a_f(2)*w_f(n-1))-(a_f(3)*w_f(n-2)))*pow2(-16)+x(n);&#xA;&#xA;end&#xA;&#xA;y_f(1)=(b_f(1)*w_f(1))*pow2(-16);&#xA;&#xA;y_f(2)=((b_f(1)*w_f(2))+(b_f(2)*w_f(1)))*pow2(-16);&#xA;&#xA;for n=3:150&#xA;&#xA; y_f(n)=((b_f(1)*w_f(n))+(b_f(2)*w_f(n-1))+(b_f(3)*w_f(n-2)))*pow2(-16);&#xA;&#xA; end&#xA;&#xA;...converting fixed to float...%&#xA;&#xA;% format long&#xA;&#xA;y_fix2float(1)=double(y_f(1))*pow2(-16);&#xA;&#xA;y_fix2float(2)=double(y_f(2))*pow2(-16);&#xA;&#xA;for n=3:150&#xA;&#xA;    y_fix2float(n)=double(y_f(n))*pow2(-16);%...convert to float..%&#xA;&#xA;end&#xA;&#xA; for n=1:150&#xA;&#xA;     w_fix2float(n)=double(w_f(n))*pow2(-16);&#xA;&#xA; end&#xA;&#xA;   %to manually plot frequency response..%&#xA;&#xA;  HH = abs(fft(y));&#xA;&#xA; yy=abs(fft(y_fix2float));&#xA;&#xA; plot(HH(1:50),'.r');&#xA;&#xA; hold on&#xA;&#xA; plot(yy(1:50),'g');&#xA;&#xA; xlabel('time');&#xA;&#xA;ylabel('response');&#xA;&#xA;legend('floating','fixed');&#xA;&#xA;title('directform2 q16');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I have written MATLAB code in both floating and fixed point. In fixed point I considered&#xA;precision of q16.16. My response is:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/XPIUv.jpg&quot; alt=&quot;output response&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is:  Is the response I got correct?&lt;/p&gt;&#xA;" OwnerUserId="14809" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-10-02T00:36:36.373" Title="IIR filter implementation in Direct Form 2" Tags="|matlab|filters|infinite-impulse-response|hardware-implementation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21872" PostTypeId="2" ParentId="21869" CreationDate="2015-03-04T08:58:41.910" Score="0" Body="&lt;p&gt;The baud rate/symbol rate is the inverse of the time distance $T_\mathrm{s}$ of two consecutive symbols. It determines the bandwidth of the modulated signal and thus comes into play when simulating frequency dependent components like filters, a wireless channel, a digital-to-analog converter, and so on. If in a simulation system the carrier modulation is simulated in the passband the ratio of baud rate and carrier frequency has to be taken into account. Imagine your carrier is modelled by $\sin(2\pi (f_\mathrm{c}/f_\mathrm{s}) n)$ with a period of $N=f_\mathrm{s}/f_\mathrm{c}$, where $f_\mathrm{c}$ is the carrier frequency and $f_\mathrm{s}$ is the sample rate of the simulation system. In the simulation system, one symbol then has to have the length $N_\mathrm{s}=T_\mathrm{s}f_\mathrm{s}$ or $N_\mathrm{s}=R_\mathrm{s}f_\mathrm{s}$, where $R_\mathrm{s}$ is the baud rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If however, you &quot;just have a bit vector converted into a complex vector of symbols&quot; without further upsampling, then the baud rate does not have to be taken into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, communication systems are simulated in the equivalent baseband, i.e. the generally relatively fast oscillating carrier is not modelled by a sine wave. Instead, the signal is thought of being shifted to the carrier frequency and only the frequency band of interest that contains the modulated signal is taken into account. Here, the baud rate again determines the width of this band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the receiver applies oversampling, i.e. if the sampling rate $f_\mathrm{A}&amp;gt;R_\mathrm{s}$, then the received signal has to be downsampled to reconstruct the transmitted symbols. Oversampling is usually applied for clock recovery or a fractionally spaced equalizer. In a simulation system you could assume perfect sample time and $f_\mathrm{A}=R_\mathrm{s}$. But this depends on what should be simulated, of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, in a receiver applying oversampling, the received samples corresponding to a symbol are not identical due to various impairments: noise, inter-symbol-interference, impulse shape, etc. To reconstruct the transmitted symbols, several steps are necessary including clock recovery, synchronization, channel estimation and equalization, and resampling.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2015-03-04T16:15:55.467" LastActivityDate="2015-03-04T16:15:55.467" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21873" PostTypeId="2" ParentId="21871" CreationDate="2015-03-04T14:02:55.307" Score="2" Body="&lt;p&gt;It seems to be wrong. The first sample of the impulse response is always equal the b0 coefficient (b(1) in Matlab, so in this case  that should be 0.099825504845559299 which doesn't seem to be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct answer can be checked with yref = filter(bs,a,x); and it's substantially different from your answer. You have shown that the fixed point version matches the floating point version, however the floating point version is wrong to start with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, Direct Form II is a horrible choice for fixed point filters. The transfer function between input and state variables is given by the pole-only transfer function. Even in this harmless example this is about 27 dB of gain. It's almost impossible to prevent clipping in Direct Form II. Use Direct Form I or Transposed Form II instead&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-03-04T14:02:55.307" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21874" PostTypeId="5" CreationDate="2015-03-04T19:02:00.807" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2015-03-04T19:02:00.807" LastActivityDate="2015-03-04T19:02:00.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21875" PostTypeId="4" CreationDate="2015-03-04T19:02:00.807" Score="0" Body="Power spectral density. PSD shows the signal power distribution over the frequency." OwnerUserId="10169" LastEditorUserId="10169" LastEditDate="2015-03-05T09:05:23.793" LastActivityDate="2015-03-05T09:05:23.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21876" PostTypeId="1" CreationDate="2015-03-04T22:34:52.673" Score="2" ViewCount="507" Body="&lt;p&gt;As it is mentioned in a paper for &lt;a href=&quot;ftp://ftp.vision.ee.ethz.ch/publications/articles/eth_biwi_00517.pdf&quot; rel=&quot;nofollow&quot;&gt;SURF&lt;/a&gt;, it is possible to approximate hessian determinant using integral images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to implement Hessian-Laplace detector, is it feasible to also approximate Laplacian of Gaussian with the same approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I want to use the fast determinant of Hessian from SURF and while computing it, also get the laplacian by taking the trace of Hessian.&lt;/p&gt;&#xA;" OwnerUserId="14935" LastEditorUserId="14935" LastEditDate="2015-03-08T09:11:07.627" LastActivityDate="2023-08-15T14:01:50.220" Title="Efficient Hessian-Laplace blob detector implementation" Tags="|image-processing|computer-vision|opencv|local-features|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21877" PostTypeId="1" AcceptedAnswerId="21886" CreationDate="2015-03-04T22:48:31.870" Score="3" ViewCount="3070" Body="&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;&#xA;I am analyzing accelerometer recordings that are contaminated by 'spikes' caused by issues in the digital circuitry. The spikes are problematic, because I wish to determine the peak-amplitude from these signals using an automated procedure from a large number (hundreds, perhaps thousands) of these recordings. Hence, manually determining the amplitudes is possible, but not preferred. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;br&gt;&#xA;The acceleration recordings are oscillatory in nature and reach frequencies of ~200 Hz. I am planning on using a &lt;strong&gt;low-pass filter&lt;/strong&gt; in &lt;strong&gt;Matlab&lt;/strong&gt; to remove the contaminating spikes in the signal. Sample rate is around 730 Hz. An &lt;em&gt;FFT-based filter may be complicated&lt;/em&gt; by the fact that the signal gradually increases and decreases in frequency over time.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a picture of an &lt;strong&gt;example recording&lt;/strong&gt; including the pesky spikes (the noise) in the first 100 ms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/huGcW.png&quot; alt=&quot;recording&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;br&gt;&#xA;I am using Matlab for signal processing and I am looking for advice on &lt;strong&gt;which digital filter&lt;/strong&gt; for use as a high-pass filter? For example, &lt;em&gt;Butterworth&lt;/em&gt; and &lt;em&gt;Chebyshev&lt;/em&gt; filters are quite commonly applied if I am not mistaken, but why? Will &lt;em&gt;wavelets&lt;/em&gt; do me any good? &lt;/p&gt;&#xA;" OwnerUserId="12261" LastEditorUserId="12261" LastEditDate="2015-03-05T02:05:16.407" LastActivityDate="2015-03-05T13:37:07.200" Title="Removal of noise from vibration recordings" Tags="|matlab|filters|denoising|highpass-filter|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21878" PostTypeId="5" CreationDate="2015-03-05T00:26:20.767" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2015-03-05T00:26:20.767" LastActivityDate="2015-03-05T00:26:20.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21879" PostTypeId="4" CreationDate="2015-03-05T00:26:20.767" Score="0" Body="Denoising is a collection of techniques to remove unwanted noise from a signal. Typically this is done by filtering, but a variety of other techniques is available. Often combinations are used in sequence to optimize the denoising. " OwnerUserId="12261" LastEditorUserId="12261" LastEditDate="2015-03-05T08:49:39.213" LastActivityDate="2015-03-05T08:49:39.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21880" PostTypeId="2" ParentId="21877" CreationDate="2015-03-05T01:04:52.137" Score="1" Body="&lt;p&gt;As I said in the comment, a high pass filter is not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is some &lt;code&gt;scilab&lt;/code&gt; code that generates the plot.  The plot shows four signals:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The original signal.&lt;/li&gt;&#xA;&lt;li&gt;The signal high-pass filtered.&lt;/li&gt;&#xA;&lt;li&gt;The signal median filter.&lt;/li&gt;&#xA;&lt;li&gt;The signal low-pass filtered.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The median filter is a non-linear filter sometimes used in image processing to remove spikes. However, because it is non-linear it may have undesirable effects on your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The low-pass filter still gets impacted by the spike a bit, but it may be preferable to the median filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uIbRQ.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;CODE:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    x = rand(1,1000,&quot;norm&quot;);&#xA;    omega = 2*%pi*0.0789234;&#xA;    y = filter(1,[1 -2*cos(omega) 1],x);&#xA;&#xA;    mx = max(y);&#xA;&#xA;    z = y;&#xA;    z(100) = 3*mx;&#xA;    clf&#xA;    subplot(411)&#xA;    plot(z)&#xA;    title(&quot;ORIGINAL SIGNAL&quot;)&#xA;&#xA;    hp=eqfir(33,[0 .2;.25 .35;.4 .5],[0 1 1],[1 1 1]);&#xA;&#xA;    zhp = filter(hp,1,z);&#xA;    subplot(412);&#xA;    plot(zhp);&#xA;    title(&quot;HIGH PASS FILTERED&quot;)&#xA;&#xA;    M = 3;&#xA;    for k=1:1000,&#xA;        lw = max(1,k-M);&#xA;        hgh = min(1000,k+M);&#xA;        zmdn(k) = median(z(lw:hgh))&#xA;    end&#xA;    subplot(413);&#xA;    plot(zmdn);&#xA;    title(&quot;MEDIAN FILTERED&quot;)&#xA;&#xA;    zlp = filter(0.01,[1 -0.99],z);&#xA;    subplot(414);&#xA;    plot(zlp);&#xA;    title(&quot;LOW PASS FILTERED&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-03-05T01:04:52.137" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="21882" PostTypeId="1" CreationDate="2015-03-05T08:06:26.833" Score="0" ViewCount="589" Body="&lt;p&gt;I have a JPEG that originally came from a IP Camera. I have converted the JPEG to a bytes and have uploaded it to my server. Upon receiving it on my server I save it to disk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I view the image it looks 'grainy' and 'reddish'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uupC3.png&quot; alt=&quot;grainy&amp;#39; and &amp;#39;reddish&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I perform a contrast stretch I get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QO5RH.png&quot; alt=&quot;contrast stretch&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I perform a Hist-Equalization I get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0FiZP.png&quot; alt=&quot;Hist-Equalization&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N.B.&#xA;I have also tried a filter just on the Red Channel:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Image&amp;lt;Bgr, byte&amp;gt; CurrentFrame = new Image&amp;lt;Bgr, byte&amp;gt;((Bitmap)picOriginal.Image.Clone());&#xA;CvInvoke.cvSmooth(CurrentFrame[2], CurrentFrame[2], SMOOTH_TYPE.CV_GAUSSIAN, 3, 3, 1.5, 0);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there another approach so I could make the image look better, 'balanced', if that makes sense?&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="8202" LastEditDate="2015-03-06T17:42:24.910" LastActivityDate="2018-07-20T07:41:44.673" Title="Removing the 'red' artifact from my JPEG" Tags="|image-processing|opencv|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21883" PostTypeId="2" ParentId="21871" CreationDate="2015-03-05T08:52:18.237" Score="0" Body="&lt;p&gt;Your frequency response plot is correct. Note that you labeled the x-axis as 'time', which created some confusion, because it should be 'frequency'. This is why Hilmar thought it's wrong (because he thought you plotted the impulse response).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But let me explain what I think you did, because this might be different from what you intended to do. First of all, this is &lt;em&gt;no&lt;/em&gt; fixed-point implementation of the filter because all computations are done in floating point, and no computation results ever get quantized. The only thing you quantized are the filter coefficients. And here you didn't use 16 bits to quantize the coefficients (as you may think) but actually 18 bits, because you use 16 &lt;em&gt;fractional&lt;/em&gt; bits, and - implicitly - as many bits before the binary point as necessary to represent the filter coefficients. And you need two non-fractional bits to represent the coefficient with the largest magnitude $a_1=-1.7474$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after all it is not surprising that there is no visible difference between the FFTs of the two responses. A well-behaved second order filter (i.e. with poles not close to the unit circle and not close to the real axis) with 18-bit quantized coefficients has almost the same frequency response as the corresponding system with floating point coefficients. Note that this may change drastically as soon as you implement &lt;em&gt;signal&lt;/em&gt; quantization.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-05T17:08:32.833" LastActivityDate="2015-03-05T17:08:32.833" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21884" PostTypeId="1" CreationDate="2015-03-05T08:57:02.960" Score="1" ViewCount="2623" Body="&lt;p&gt;What are the difference between speech and music signal? Can anyone help? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing project in audio processing. In that project I want make decision, that is which type of signal is given as input whether it is speech signal or music signal. I searched a lot in internet. But i could not find the required details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone knows about this please share the difference between the speech and music signal.&lt;/p&gt;&#xA;" OwnerUserId="14938" LastEditorUserId="80" LastEditDate="2015-03-06T03:34:05.180" LastActivityDate="2023-07-04T10:03:22.133" Title="Difference between speech and music signal" Tags="|matlab|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21886" PostTypeId="2" ParentId="21877" CreationDate="2015-03-05T10:22:05.500" Score="4" Body="&lt;p&gt;If you want to detect the peak value of the time-domain signal, it is important not to change phase of each frequency signals. Otherwise, the peak value will be affected by it and will slightly change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you already have recorded signal and you can process it &lt;strong&gt;after&lt;/strong&gt; the recording.&#xA;If so, it is better to use zero-phased filters, like &lt;a href=&quot;http://uk.mathworks.com/help/signal/ref/filtfilt.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this function&lt;/a&gt; in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://uk.mathworks.com/help/signal/ref/filtfilt.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://uk.mathworks.com/help/signal/ref/filtfilt.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the needed function is to reduce the spike, which contains so much frequencies.&#xA;In the help page I have shown before, there is an example of filtering this kind of spikes from the relatively low-frequency signal.&#xA;I think it's what you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend Butterworth low pass filter for its flat gain characteristics. The gain ripple of the Chebtshev would affect badly. The phase change will be corrected by using the filter backward, which the filtfit does. As you imagine, the effect of the phase change would be very little in this case, but it cannot be guaranteed.&#xA;Just for your information, Bessel would be a candidate when you do the filtering online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you still doubt about the effect of the phase shift (not the time-shift) by the filter, you can imagine the time-streched pulse and impulse signal in the image and code below. &#xA;These signals are almost the same but only the phase are different. &#xA;Besides the amount of the effect, the phase shift does affect to the amplitude of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recomend you to use zero-phase filter if you want to measure the actual amplitude precisely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Np3sR.png&quot; alt=&quot;the effect of phase. of source it&amp;#39;s a kind of special case...&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;close all;&#xA;&#xA;% generate signal with the same phase&#xA;N = 2^15; % number of samples for this signal&#xA;for k = 1:N/2;&#xA;    S(k+1) = exp(0);&#xA;end&#xA;S(N/2+2: N) = conj(S(N/2: -1 :2));&#xA;&#xA;signal1 = real(ifft(S));&#xA;&#xA;% generate signal with different phase from above&#xA;% this signal is called time-streched pulse.&#xA;N = 2^15;&#xA;for k = 1:N/2;&#xA;    S(k+1) = exp(-1j*2*pi*N/2*(k/N)^2);&#xA;end&#xA;S(N/2+2: N) = conj(S(N/2: -1 :2));&#xA;&#xA;signal2 = real(ifft(S));&#xA;&#xA;% and let's see them.&#xA;subplot(211)&#xA;plot(signal1)&#xA;xlim([-1e4, length(signal1)])&#xA;xlabel('time')&#xA;ylabel('all the same phase')&#xA;subplot(212)&#xA;plot(signal2)&#xA;xlim([-1e4, length(signal1)])&#xA;xlabel('time')&#xA;ylabel('only the phases are different form above')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14917" LastEditorUserId="14917" LastEditDate="2015-03-05T13:37:07.200" LastActivityDate="2015-03-05T13:37:07.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21887" PostTypeId="1" CreationDate="2015-03-05T11:13:31.207" Score="1" ViewCount="4659" Body="&lt;p&gt;I am new to matlab and computer vision. I used the code given in the link to detect cars. But the problem is the shadow is also being detected and tracked. Can anyone tell me how to modify the code so that only car are detected. Link:&lt;a href=&quot;http://in.mathworks.com/help/vision/examples/detecting-cars-using-gaussian-mixture-models.html&quot; rel=&quot;nofollow&quot;&gt;http://in.mathworks.com/help/vision/examples/detecting-cars-using-gaussian-mixture-models.html&lt;/a&gt; &#xA;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="14940" LastEditorUserId="7092" LastEditDate="2015-03-05T16:04:08.893" LastActivityDate="2015-03-05T16:04:08.893" Title="Vehicle detection in matlab" Tags="|image-processing|matlab|computer-vision|matlab-cvst|" AnswerCount="2" CommentCount="1" ClosedDate="2015-03-05T22:45:44.040" ContentLicense="CC BY-SA 3.0" />
  <row Id="21888" PostTypeId="1" CreationDate="2015-03-05T11:32:44.980" Score="1" ViewCount="7832" Body="&lt;p&gt;I'm trying to express the following set of signals on orthonormal basis functions. These signals are to be transmitted using a 4-ary modulation scheme.How do i write ψ1(t)and ψ2(t) for the same. Also how to find orthonormal function set for given set of signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bTLSc.png&quot; alt=&quot;These are the given four signals&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12083" LastActivityDate="2017-02-26T22:04:43.230" Title="How to find orthonormal basis function in the following digital communication problem?" Tags="|digital-communications|orthornormal|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21889" PostTypeId="2" ParentId="21887" CreationDate="2015-03-05T12:46:16.007" Score="2" Body="&lt;p&gt;What I would try is to :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get the &lt;a href=&quot;http://en.wikipedia.org/wiki/HSL_and_HSV&quot; rel=&quot;nofollow&quot;&gt;HSL&lt;/a&gt; (Hue Saturation Lightness) decomposition of the original picture&lt;/li&gt;&#xA;&lt;li&gt;Only keep the L component&lt;/li&gt;&#xA;&lt;li&gt;Multiply the image you have from the last steps with the image you get after the morphological operation (the black and white one, after deleting the noise)&lt;/li&gt;&#xA;&lt;li&gt;Do some thresholding on that&lt;/li&gt;&#xA;&lt;li&gt;Use what you obtained from that instead of the image after the morphological operation for the following part of the algorithm.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I don't know well Matlab so I can't provide function names, but I guess you can find it easily with a bit of googling. And please keep me updated if you try this, I would like to know if it works well or not.&lt;/p&gt;&#xA;" OwnerUserId="12161" LastActivityDate="2015-03-05T12:46:16.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21890" PostTypeId="2" ParentId="21888" CreationDate="2015-03-05T13:18:35.920" Score="4" Body="&lt;p&gt;Let's call your $4$ signals $f_0$, $f_1$, $f_2$ &amp;amp; $f_3$. &#xA;Just by eyeballing you could have a basis of two function where &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b0 = f0, for 0 &amp;lt; t &amp;lt; Ts/2, 0 otherwise and&#xA;b1 = f0, for Ts/2 &amp;lt; t &amp;lt; Ts, 0 otherwise and&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you basically have a one first half ramp up in the first half and one second half ramo down. The signals can be expressed simply as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f0 =  b0 + b1&#xA;f1 = -b0 - b1&#xA;f2 =  b0 - b1&#xA;f3 = -b0 + b1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it's clearly a base. It's also orthogonal since $b_0  b_1$ is zero for all $t$. It's probably not normal but could be easily made so by proper scaling. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="7092" LastEditDate="2015-03-05T20:42:11.780" LastActivityDate="2015-03-05T20:42:11.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21891" PostTypeId="2" ParentId="21888" CreationDate="2015-03-05T15:40:19.013" Score="2" Body="&lt;p&gt;Even more simpler than @Hilmar's answer, the signals $f_0$ and $f_2$ are &#xA;&lt;em&gt;orthogonal&lt;/em&gt; just by eyeballing the pictures and recalling basic ideas about&#xA;integration giving the area under the curve. Thus, the signals are&#xA;$f_0, -f_0, f_2, -f_2$ with respect to the orthogonal basis $\{f_0, f_2\}$. &#xA;The basis could be made a orthonormal basis (unit-energy basis signals) if&#xA;absolutely needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, the above description shows that the four signals are a&#xA;&lt;em&gt;bi-orthogonal&lt;/em&gt; signal set -- a $4$-QAM signal set rotated by $\pi/4$ in signal&#xA;space --  for which the symbol error probabilities and bit error probabilities&#xA;have been studied and documented throroughly. The bi-orthogonality is not&#xA;as easily noticed with the basis used in Hilmar's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a minor note, if we use the Gram-Schmidt orthogonalization procedure&#xA;(as suggested by @MattL in a comment) starting with $f_0$ and continuing with $f_1, f_2, f_3$, we end up&#xA;with $\{f_0, f_2\}$ as the orthogonal basis for this set of $4$ signals.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-03-05T16:36:18.687" LastActivityDate="2015-03-05T16:36:18.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21892" PostTypeId="2" ParentId="21887" CreationDate="2015-03-05T15:46:00.213" Score="0" Body="&lt;p&gt;In the example you've cited you feed RGB frames into &lt;code&gt;vision.ForegroundDetector&lt;/code&gt;. To get rid of shadows you can try converting the frame into a color space that separates luma from chroma, using &lt;code&gt;rgb2ycbcr&lt;/code&gt; or &lt;code&gt;rgb2hsv&lt;/code&gt;. Then you can feed only the chroma components, cb and cr, or H and S respectively into &lt;code&gt;vision.ForegroundDetector&lt;/code&gt;. The downside of this approach is that you will not be able to detect gray objects.  So you will probably not detect wheels and windows of the cars, and you may lose the entire car if it is not colorful.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-03-05T15:46:00.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21893" PostTypeId="1" AcceptedAnswerId="50857" CreationDate="2015-03-05T17:59:46.810" Score="9" ViewCount="451" Body="&lt;p&gt;Recently, I saw new published papers like&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Shuhang Gu, Lei Zhang, Wangmeng Zuo, Xiangchu Feng, &lt;a href=&quot;http://www4.comp.polyu.edu.hk/~cslzhang/paper/WNNM.pdf&quot; rel=&quot;noreferrer&quot;&gt;Weighted Nuclear Norm Minimization with Application to Image Demonising&lt;/a&gt; [pdf].&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;about denoising images using &lt;strong&gt;Weighted Nuclear Norm Minimization&lt;/strong&gt; (WNNM) approach and I am wondering what the physical intuition behind it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main idea is to subdivide the image into patches $Y_j$ then estimate the free-noise patch as the solution of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\min\limits_{X_j}{\frac{1}{\sigma_n^2}\|X_j-Y_j\|_F + \sum_i|w_i\sigma_i(X_j)|}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\sigma_n^2$ is the variance of the noise, $X_j$ is the $j^{th}$ denoised patch to estimate, $\sigma_i(X_j)$ is $i^{th}$ singular value of the matrix $X_j$ and the weights $w_i$'s are non-negative values and chosen in a non-ascending order to satisfy the convexity property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, I would like to understand what that means if an image has the singular values of its patches (or regions) constrained to be sparse (according to the expression of the objective function) and I am wondering also if this optimization problem would yield characteristic patterns that are the same in all the images.&lt;/p&gt;&#xA;" OwnerUserId="4224" LastEditorUserId="21075" LastEditDate="2016-10-21T18:03:46.357" LastActivityDate="2018-07-28T16:01:34.623" Title="Weighted Nuclear Norm Minimization for Image Denoising" Tags="|image-processing|denoising|linear-algebra|optimization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21894" PostTypeId="1" CreationDate="2015-03-05T20:31:42.410" Score="1" ViewCount="29" Body="&lt;p&gt;I am new to image processing and had the following question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have take some 512-px grayscale images. The images were take in such a way that all images were of the same spot, but there was some variation in each image. For example, the sharpness in each image is not the same, in some images, I see extra information which I would like to neglect if they are not present in the other frames. I was trying to understand if &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;there is a better way of aligning frames&lt;/li&gt;&#xA;&lt;li&gt;removing artifacts which are not common in all the frames&lt;/li&gt;&#xA;&lt;li&gt;improve the sharpness (is there a best know method to do this?)&lt;/li&gt;&#xA;&lt;li&gt;do noise reduction (when I try and sharpen an image, my shot noise shoots up)&lt;/li&gt;&#xA;&lt;li&gt;do some sort of balanced contrast brightness tweaking such that the signal from the brighter regions do not mess up the signal from the darker regions. Gamma Correction is just a wee bit primitive to help with that. Creates lots of artifacts. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I know this is a very long question, but I am just some help to kick start my work. In return for any help, I can post results of what I observe&lt;/p&gt;&#xA;" OwnerUserId="14946" LastEditorUserId="7092" LastEditDate="2015-03-05T20:38:59.497" LastActivityDate="2015-03-05T20:38:59.497" Title="Aligning frames with common elements" Tags="|image-processing|signal-analysis|image-segmentation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21895" PostTypeId="2" ParentId="21832" CreationDate="2015-03-05T20:55:26.227" Score="0" Body="&lt;p&gt;If you know the source of the square wave signal, or can separately lock onto it, sum the inverted, amplitude-tweaked, version of that square wave with your noisy input prior to any other filtering. You might also use the principle of synchronous detection on the remaining signal to detect the square wave contribution, then subtract it DC-wise after the desired signal detection. I have a GoogleDocs collection on synchronous detection &lt;a href=&quot;https://docs.google.com/document/d/1yjtYHZfxjZYotDk0VjhqjAQQwojzbO7LL0LVx1fJGmA/edit?usp=sharing&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you have trouble accessing it.&lt;/p&gt;&#xA;" OwnerUserId="13712" LastActivityDate="2015-03-05T20:55:26.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21896" PostTypeId="2" ParentId="21882" CreationDate="2015-03-05T22:34:56.610" Score="0" Body="&lt;p&gt;Try running a Gaussian kernel over it? Maybe even just over the red channel, if that is the one that bugs you the most. Applying it to only one channel will also reduce the blurring effect&lt;/p&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2015-03-05T22:34:56.610" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21897" PostTypeId="2" ParentId="21884" CreationDate="2015-03-05T22:43:13.563" Score="7" Body="&lt;p&gt;Not really an answer, but usually when people speak there are pauses between words, sentences, thoughts, etc. Music (with multiple instruments) is fairly continuous. Even if one instruments stops another is probably still playing. So there would be less lulls in the audio stream. Just a guess though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing you could do is look at frequencies, voices are typically in the 300Hz-4kHz range (this is what telephones originally used as bandwidth) whereas musical instruments are usually much broader. A frequency outside the human range could indicate instruments &lt;img src=&quot;https://i.stack.imgur.com/G99lu.jpg&quot; alt=&quot;enter image description here&quot;&gt; I randomly found that image &lt;a href=&quot;http://www.proav.de/index.html?http&amp;amp;&amp;amp;&amp;amp;www.proav.de/audio/speech-level.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-03-05T23:58:40.563" LastActivityDate="2015-03-05T23:58:40.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21898" PostTypeId="2" ParentId="21832" CreationDate="2015-03-05T22:55:16.330" Score="0" Body="&lt;p&gt;I'm reminded of an image-processing technique called &quot;unsharp-masking&quot; Your goal is to increase the sharpness (high frequencies) in an image. It is accomplished by blurring the image (increasing low frequencies). Then you subtract the blurred version from the original since original freq - low freq = high freq. Maybe that could be applied here since your noise is of much lower frequency than your signal and since your signal appears to be 0 mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You make a small sliding window average of the waveform(this is equivalent to blurring). Then you subtract the sliding window average reconstruction from the original. Leaving only the information you want. &lt;/p&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2015-03-05T22:55:16.330" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21900" PostTypeId="1" AcceptedAnswerId="60182" CreationDate="2015-03-06T03:27:54.177" Score="6" ViewCount="5216" Body="&lt;p&gt;I know that there are many ways to upscale (interpolate) an image using bilinear, bicubic, sinc... Somehow, these same algorithms can also be used to downscale an image. But when it comes to subsampling, I've come across only two methods: Gaussian-blur then discard some rows and columns, or block-averaging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there such thing as bilinear, bicubic,... subsampling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of Gaussian-blurring then discarding or block-averaging, can/should I do Gaussian-blurring then block-averaging? or bilinear, bicubic,...subsampling if there is such thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm doing is trying to make image Gaussian and Laplacian pyramids; but I'm not sure how to decimate and interpolate the image. (Some Python code with Scipy/Numpy would really help.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="13525" LastEditorUserId="128" LastEditDate="2019-08-18T14:52:36.193" LastActivityDate="2019-08-18T15:35:06.140" Title="Difference between Sub Sampling and Down Scaling of Images" Tags="|image-processing|interpolation|downsampling|decimation|multi-scale-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21901" PostTypeId="2" ParentId="21884" CreationDate="2015-03-06T03:31:53.580" Score="5" Body="&lt;p&gt;There's probably some overlap (some people seem to talk in a drone or sing-song), but the time and pitch distribution of music is likely to contain more pitch or voiced frequencies that are spaced apart by chromatic intervals (at least for Westerners), and more abrupt changes of pitch spaced apart by close to close to some multiples of some fixed tempo interval, compared to the speech of the typical radio news announcer.  e.g. a compressed spectrograph will show a bit more vertical and horizontal checkerboard patterning for most music than for most speech.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-06T03:31:53.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21902" PostTypeId="2" ParentId="21832" CreationDate="2015-03-06T04:46:10.370" Score="1" Body="&lt;p&gt;Your question is very interesting now after adding full information. (I upvoted question now)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty skeptical about attempts to use digital signal processing techniques for such signals. Focus on reducing the &quot;square wave noise&quot; in the recorded signal before any digital signal processing. Firstly examined the nature of this kind of noise - it may be sound (ie the sound of the robots, which is registered by the receiver of the scanner) or it may be electrical (eg noise from power supply of robots propagate to the scanner power supply or directly to the receiver circuits, etc.). Depending on the outcome of this study try to reduce this noise on scanner signals. For example, if it's the sound from robots - try adding sound absorbers in front of the receiver. You can try to record the sound from outside the scanner and subtract it from the signal of the scanner. If this pickup from power circuits of robots - improve the protection of electrical circuits of scanner. In experimental physics there are many methods and techniques to solve these problems, but often it's more like Art.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2015-03-06T04:46:10.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21903" PostTypeId="1" AcceptedAnswerId="21905" CreationDate="2015-03-06T09:12:55.207" Score="14" ViewCount="4160" Body="&lt;p&gt;My question is, if I want to high-pass a signal, is it the same as low-passing a signal and subtracting it from the signal? Is it theoretically the same? Is it practically the same?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have searched (both on google and dsp.stackexchange) and I find conflicting answers. I have been playing with a signal and here are the results. I can't make much sense of it. &lt;a href=&quot;http://m.uploadedit.com/ba3a/1425632039466.txt&quot; rel=&quot;noreferrer&quot;&gt;Here&lt;/a&gt; is the signal with the sampling frequency once every four seconds. I designed a digital low-pass filter with the transition band from 0.8 mHz to 1 mHz and filtered the signal. I then also designed a high-pass filter with the same transition band and filtered the signal. Here are the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6eeZc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This first picture shows the original signal in black and the low-passed signal in blue. They are almost on top of each other but not quite. The red curve is signal minus the high-passed signal which is right on top of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mO7f2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This second image is just the first one zoomed in to show what's happening. Here we see that clearly the two are not the same. My question is why? Is it something about how I have implemented the two filters or is it something theoretical independent of my implementation? I don't know a lot about filter designing but I do know that it is notoriously counter-intuitive. Here is the full MATLAB code to reproduce all of this. I am using the filtfilt command to eliminate phase delays. But another thing to point out here is that the filters are not normalized. When I do sum(Hd.Numerator), I get 0.9930 for the low-pass and 0.007 for the high-pass. I don't see how to account for this. Should the output be scaled somehow because the coefficients don't add up to one? Could this scaling have something to do with this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all&#xA;clear all&#xA;clc&#xA;&#xA;data = dlmread('data.txt');&#xA;&#xA;Fs    = 0.25;    % Sampling Frequency&#xA;N     = 2674;    % Order&#xA;Fpass = 0.8/1000;  % Passband Frequency&#xA;Fstop = 1/1000;   % Stopband Frequency&#xA;Wpass = 1;       % Passband Weight&#xA;Wstop = 1;       % Stopband Weight&#xA;dens  = 20;      % Density Factor&#xA;&#xA;% Calculate the coefficients using the FIRPM function.&#xA;b  = firpm(N, [0 Fpass Fstop Fs/2]/(Fs/2), [1 1 0 0], [Wpass Wstop], {dens});&#xA;Hd = dsp.FIRFilter('Numerator', b);&#xA;sum(Hd.Numerator)&#xA;datalowpassed = filtfilt(Hd.Numerator,1,data);&#xA;&#xA;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#xA;&#xA;Fs    = 0.25;    % Sampling Frequency&#xA;N     = 2674;    % Order&#xA;Fstop = 0.8/1000;  % Stopband Frequency&#xA;Fpass = 1/1000;   % Passband Frequency&#xA;Wstop = 1;       % Stopband Weight&#xA;Wpass = 1;       % Passband Weight&#xA;dens  = 20;      % Density Factor&#xA;&#xA;% Calculate the coefficients using the FIRPM function.&#xA;b  = firpm(N, [0 Fstop Fpass Fs/2]/(Fs/2), [0 0 1 1], [Wstop Wpass], {dens});&#xA;Hd = dsp.FIRFilter('Numerator', b);&#xA;sum(Hd.Numerator)&#xA;datahighpassed = filtfilt(Hd.Numerator,1,data);&#xA;&#xA;figure&#xA;subplot(2,1,1)&#xA;plot(data,'-ko')&#xA;hold on&#xA;plot(datalowpassed,'-bo')&#xA;plot(data-datahighpassed,'-ro')&#xA;legend('Original Signal','Low-Passed','Signal - High-Passed')&#xA;subplot(2,1,2)&#xA;plot(data-datalowpassed,'-bo')&#xA;hold on&#xA;plot(datahighpassed,'-ro')&#xA;legend('Signal - Low-Passed','High-Passed')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3364" LastEditorUserId="4298" LastEditDate="2015-03-06T15:31:01.983" LastActivityDate="2015-03-06T15:31:01.983" Title="Is a high-passed signal the same as a signal minus a low-passed signal?" Tags="|matlab|filter-design|lowpass-filter|highpass-filter|digital-filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21904" PostTypeId="1" CreationDate="2015-03-06T09:17:50.323" Score="0" ViewCount="279" Body="&lt;p&gt;I have a signal that contains the speaking of three vowels. The signal is contaminated with dc offset and an interference at 60 Hz. I want to perform LPC for the synthesis of the spoken vowels. Do I have to remove the dc offset and the interference before performing LPC?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial signal looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L28Xp.jpg&quot; alt=&quot;the whole single sided fft&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mAATa.jpg&quot; alt=&quot;zoomed single sided fft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also another question of mine about LPC here &lt;a href=&quot;https://stackoverflow.com/questions/28909899/weird-output-of-lpc-algorithm&quot;&gt;https://stackoverflow.com/questions/28909899/weird-output-of-lpc-algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14901" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-07-31T09:55:32.043" Title="Preprocessing signal before LPC" Tags="|discrete-signals|algorithms|speech|lpc|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21905" PostTypeId="2" ParentId="21903" CreationDate="2015-03-06T09:58:00.880" Score="9" Body="&lt;p&gt;In general you can't simply subtract a low-pass filtered version of a signal from the original one to obtain a high-pass filtered signal. The reason is as follows. What you're actually doing is implement a system with frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=1-H_{LP}(\omega)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H_{LP}(\omega)$ is the frequency response of the low-pass filter. Note that $H_{LP}(\omega)$ is a complex function. What you probably want is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(\omega)|=\big|1-|H_{LP}(\omega)|\big|\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but this is generally not the case when (1) is satisfied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now write $H_{LP}(\omega)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{LP}(\omega)=|H_{LP}(\omega)|e^{j\phi(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi(\omega)$ is the phase response of the low pass filter. If you defined a filter as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{HP}(\omega)=e^{j\phi(\omega)}-H_{LP}(\omega)=e^{j\phi(\omega)}\left(1-|H_{LP}(\omega)|\right)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then this new filter would indeed satisfy the magnitude relation (2). So if you do the subtraction as in (3), you can realize a high-pass filter with a magnitude response that is complementary to the response of the low pass filter. This means that you need to filter the signal by an all-pass filter with frequency response $e^{j\phi(\omega)}$ before subtracting from it the low-pass filtered version of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice this is very simple &lt;em&gt;if&lt;/em&gt; the low-pass filter has a &lt;em&gt;linear&lt;/em&gt; phase response, because then the phase term is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{j\phi(\omega)}=e^{-j\omega\tau}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and corresponds to a simple delay. FIR filters can have an exactly linear phase response, and the ones designed by the Parks-McClellan algorithm do have a linear phase. It is advantageous to make the delay $\tau$ in (4) an integer, which is achieved by choosing an &lt;em&gt;even&lt;/em&gt; filter order $n$: $\tau=n/2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you have to do is the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;design a linear phase FIR low-pass filter with an even order&lt;/li&gt;&#xA;&lt;li&gt;filter the signal using &lt;code&gt;filter()&lt;/code&gt;; let's call the result $x_{LP}[n]$&lt;/li&gt;&#xA;&lt;li&gt;delay the original signal by $\tau=n/2$ samples; let's call the delayed signal $x_d[n]$&lt;/li&gt;&#xA;&lt;li&gt;generate the high-pass filtered signal by subtraction: $x_{HP}[n]=x_d[n]-x_{LP}[n]$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is a very simple illustration in Matlab/Octave&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;h_lp = fir1(100,.3);                        % low-pass design&#xA;h_hp = [zeros(50,1);1;zeros(50,1)] - h_lp;  % high-pass design by subtraction&#xA;[H_lp,w] = freqz(h_lp,1,1024);&#xA;[H_hp,w] = freqz(h_hp,1,1024);&#xA;plot(w/2/pi,20*log10(abs(H_lp)),w/2/pi,20*log10(abs(H_hp)))&#xA;grid, axis([0,.5,-100,5])&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3HEt6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you used the &lt;code&gt;filtfilt&lt;/code&gt; command, the phase is artificially eliminated, and Equations (1) and (2) above become equivalent, because all frequency responses are in fact squared magnitudes of the designed responses. So, apart from small differences due to the filter design process, numerical errors, and small differences caused by the &lt;code&gt;filtfilt&lt;/code&gt; function (automatically chosen initial conditions minimizing start and end transients), the result of subtracting filtered data from the original data should closely resemble direct filtering with a complementary filter. Since this is not the case in your example, I suspect that the filter design routine gives you trouble due the extremely high filter order. If you do the same with simpler filters (I chose $n=100$), you get what you would expect. In the figure below you see a section of the data in blue, the output of the low pass filter in green, and the result of the subtraction of the output of the high pass filter from the original data in red. The green and red curves are virtually identical.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;x = load('data.txt');           % data to be filtered&#xA;h_lp = fir1(100,.3);            % LP impulse response&#xA;h_hp = fir1(100,.3,'high');     % HP impulse response&#xA;y = filtfilt(h_lp,1,x);         % apply low pass filter&#xA;yh = filtfilt(h_hp,1,x);        % apply high pass filter&#xA;yd = x - yh;                    % low pass by difference with high pass filter&#xA;n = 1:length(x);&#xA;plot(n,x,n,y,'g.',n,yd,'r')&#xA;axis([3500,4000,140,150])&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4u0mn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-06T15:17:31.633" LastActivityDate="2015-03-06T15:17:31.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21907" PostTypeId="2" ParentId="21882" CreationDate="2015-03-06T10:22:10.453" Score="1" Body="&lt;p&gt;Did you try to change the white balance of your image ? Apparently there's a function (&lt;a href=&quot;http://docs.opencv.org/trunk/modules/xphoto/doc/whitebalance.html&quot; rel=&quot;nofollow&quot;&gt;balanceWhite&lt;/a&gt;) in OpenCV that tries to correct the white balance, you might want to give it a go.&lt;/p&gt;&#xA;" OwnerUserId="12161" LastActivityDate="2015-03-06T10:22:10.453" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="21908" PostTypeId="2" ParentId="21903" CreationDate="2015-03-06T12:02:14.940" Score="3" Body="&lt;p&gt;Regarding scaling:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sum up the coefficients, you get the magnitude for DC. Hence, it makes sense that you get those numbers ($\approx 1$ for LP, $\approx 0$ for HP).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to Matt L.'s excellent answer one can just point out that what he is using is referred to as &lt;em&gt;magnitude complementary&lt;/em&gt; filters, which is the common case for linear-phase FIR filters, i.e.,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|H_{LP}|+|H_{HP}| = 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When creating filters from two parallel allpass sections and adding/subtracting the outputs, the lowpass/highpass filters will instead be &lt;em&gt;power complementary&lt;/em&gt;, i.e.,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|H_{LP}|^2+|H_{HP}|^2 = 1$&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-03-06T12:02:14.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21909" PostTypeId="1" AcceptedAnswerId="21910" CreationDate="2015-03-06T12:18:12.883" Score="2" ViewCount="1869" Body="&lt;p&gt;Due to the Nyquist rate, you need to sample twice as fast as the highest frequency you want to measure. Then when you do a FFT the number of samples determines the number of bins and thus the frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about the lowest frequency you want to measure?&#xA;I would think your sampling duration needs to be at least as long as one cycle of your lowest frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this true, or can you register $20$ $Hz$ from a dozen samples at $44$  $kHz$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is true, how long do you need to sample, and how do you limit the number of bins?&lt;/p&gt;&#xA;" OwnerUserId="14953" LastEditorUserId="7092" LastEditDate="2015-03-06T15:27:15.803" LastActivityDate="2015-03-06T15:27:15.803" Title="What is the minimum sampling duration to capture a given frequency?" Tags="|fft|frequency|nyquist|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21910" PostTypeId="2" ParentId="21909" CreationDate="2015-03-06T12:33:23.377" Score="2" Body="&lt;p&gt;Using the DFT, the lowest bin is indeed corresponding to one period (i.e., the frequency which have exactly one period within the length of the DFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conceptually, the DFT is correlating the input signal with different sinusoids. Now, to capture the phase information, these are &quot;complex sinusoids&quot;, but if you knew the phase beforehand, you could just correlate with a real-valued sinusoid with the same phase to obtain the amplitude of the sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, it would conceptually be possible to register the existence of 20 Hz using a dozen sample at 44 kHz if you knew the phase of the signal (or by making multiple computations with different phase shifts). The drawback is that there are (probably/most likely) other signals which will be falsely detected as 20 Hz, because they correlate as well as the 20 Hz signal (and/or cancel the 20 Hz signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in no way a comprehensive answer, but more an insight that what the DFT and most other transforms do is to correlate the input signal to a set of basis functions, to see how they compare. With enough knowledge of your input signal you can find simpler basis functions for your particular case, but there is a trade-off between flexibility (ability to handle different cases) and simplicity (how little information/computation is needed).&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-03-06T12:33:23.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21912" PostTypeId="2" ParentId="19028" CreationDate="2015-03-06T17:11:06.440" Score="1" Body="&lt;p&gt;You will need more than 2 received pulses to get the Doppler between your sources. What is your ADC sampling rate and PRF?&lt;/p&gt;&#xA;" OwnerUserId="5843" LastActivityDate="2015-03-06T17:11:06.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21914" PostTypeId="1" CreationDate="2015-03-06T18:06:39.973" Score="0" ViewCount="276" Body="&lt;p&gt;my  project is monophonic music transcription I am using complex Morlet wavelet but over the 1000 Hz complex Morlet does not give all results right, my code is like that ;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fc=centfrq('cmor5-5'); % center frequency&#xA;fa=1047; % 5 Octave c note&#xA;scale=(fc*fs)./(fa);&#xA;coef=cwt(data,scale,'cmor5-5');&#xA;p=abs((coef).^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone give me information about complex Morlet wavelet ?&lt;/p&gt;&#xA;" OwnerUserId="14958" LastEditorUserId="8202" LastEditDate="2015-03-06T19:13:20.067" LastActivityDate="2017-10-26T14:02:55.237" Title="Complex Morlet Wavelet piano sound analysis" Tags="|signal-analysis|wavelet|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21915" PostTypeId="2" ParentId="21900" CreationDate="2015-03-06T18:37:06.613" Score="1" Body="&lt;p&gt;Have you looked to the pyUp and pyDown functions in opencv? They upscale and downscale images using a gaussian pyramids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=pyrdown#pyrdown&quot; rel=&quot;nofollow&quot;&gt;opencv image filtering page&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14930" LastActivityDate="2015-03-06T18:37:06.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21916" PostTypeId="1" CreationDate="2015-03-06T19:36:54.260" Score="1" ViewCount="235" Body="&lt;p&gt;I have 2 low frequency signals on the same line that look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T42XO.png&quot; alt=&quot;2 signals on the same line&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to separate them so that I obtain the two signals that can be seen here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M6Dtz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling is not perfectly intercalated, so it's not as simple as taking one point each in alternation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked at &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;ICA&lt;/a&gt; but my understanding is that I would need 2 recordings of the 2 mixed signals in order to separate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5428" LastActivityDate="2015-03-07T08:05:06.140" Title="Is there a way to separate 2 signals recorded on the same channel?" Tags="|filters|source-separation|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21917" PostTypeId="2" ParentId="21916" CreationDate="2015-03-06T21:43:15.637" Score="1" Body="&lt;p&gt;You should look into a generalization of ICA called Independent Subspace Analysis (ISA). Practically it is Principal Component Analysis (PCA) followed by ICA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;a href=&quot;https://dsp.stackexchange.com/questions/159/can-ica-be-applied-when-the-number-of-mixture-signal-is-less-than-number-of-sou&quot;&gt;threads&lt;/a&gt; on dsp.stackexchange that discuss this as well as github &lt;a href=&quot;https://github.com/search?utf8=%E2%9C%93&amp;amp;q=independent%20subspace%20analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;repos&lt;/a&gt; (and &lt;a href=&quot;https://github.com/lucastheis/isa&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) that provide various implementations.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-03-07T04:20:15.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21918" PostTypeId="1" CreationDate="2015-03-06T23:57:26.243" Score="2" ViewCount="3403" Body="&lt;p&gt;After somme researchs on the web, I don't find the answer of my problem (or I don't understand it) and I hope this post will succeed.&#xA;I'm working on a real-time FFT convolution algorithm (C++) which split the impulse response in several increasing size blocks (64/128/256/...).&#xA;To realise the convolution, I have to split the incoming signal in blocks of the same sizes (64/128/...) to compute its FFts (when there is enough input signal to do this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is to use the FFts already computed to save some CPU time : with 2 FFts of 64 samples, I want to simulate the result of a FFT of 128 samples, ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the 1st step, we usually compute the FFT (128 samples (64 input samples and 64 zeropadding samples)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the 2nd step, we usually compute the FFT (128 samples), and we join the 2 128-FFTs to create the 256-FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the 3rd step, we usually compute the FFT (128 samples)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the 4th step, we usually compute the FFT (128 samples), and we join the 2 128-FFTs to create the 256-FFT, and we join the 2 256-FFTs to create the 512-FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Little example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;code&gt;x1 = {a, b, c, d, 0, 0, 0, 0}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X1 = fft(x1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) &lt;code&gt;x2 = {e, f, g, h, 0, 0, 0, 0}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X2 = fft(x2)&#xA;&#xA;   X  = X1+X2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;X might be equal to : &lt;code&gt;fft({a, b, c, d, e, f, g, h, 0, 0, 0, 0, 0, 0, 0, 0}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it even possible???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my algorithm I use the AudioFFT library (&lt;a href=&quot;https://github.com/HiFi-LoFi/AudioFFT&quot; rel=&quot;nofollow&quot;&gt;https://github.com/HiFi-LoFi/AudioFFT&lt;/a&gt;) (Accelerate for Mac, FFTW for Windows and OouraFFT for Linux).&#xA;Its class return an array for the real part and an array for the imaginary part (the size of each array is N/2+1, where N is the FFT lenght).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, I succeeded to join the result of the two smalls FFT (FFT1, FFT2) to obtain the even bins of the large FFT (FFT0) :  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                    FFT0[0] = FFT1[0] + FFT2[0]&#xA;&#xA;                    FFT0[2] = FFT1[1] - FFT2[1]&#xA;&#xA;                    FFT0[4] = FFT1[2] + FFT2[2]&#xA;&#xA;                    FFT0[6] = FFT1[3] - FFT2[3]&#xA;&#xA;                    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, how can I get the odd bins??????&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance and I hope I was clear enough (despite my bad English).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, ask me for more details if necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Thanks for your explanations. I thought I have the answer with that but finally no :'(&#xA;The problem is the original signal is zeropaded.&#xA;So, in your explanation user14819, the equation will look like : &#xA;fft[a,b,c,d,e,f,g,h,0,0,0,0,0,0,0,0] = fft[a,b,c,d,0,0,0,0] + fft[0,0,0,0,e,f,g,h]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt; x1 (a,b,c,d,0,0,0,0) is actually the concatenation of the first and the third quarter of x(a,b,c,d,e,f,g,h,0,0,0,0,0,0,0,0) (or the zeropaded first half of the original signal)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&gt;x2 (0,0,0,0,e,f,g,h) is the concatenation of the fourth and the second quarter of x&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show that, I used your Matlab code, Matt L., and I change it a little (with difficulties I admit):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;N  = 16;&lt;br&gt;&#xA;  N2 = N/2;&lt;br&gt;&#xA;  N4 = N/4;&lt;br&gt;&#xA;  n  = (0:N2-1)';&lt;br&gt;&#xA;  g  = e.^(-j*2*pi/N*n);&lt;br&gt;&#xA;  G  = fft(g);&lt;br&gt;&#xA;  x  = rand(N2,1); %. . . . . . . . . . . . original  signal&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;x0 = x; %. . . . . . . . . . . . . . . . . . .zeropaded signal&lt;br&gt;&#xA;  x0(end+(N2)) = 0;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;%your algorithm&lt;br&gt;&#xA;  x1 = x0(1:N2);%. . . . . . . . . . . . . first  part of the zeropaded signal&lt;br&gt;&#xA;  x2 = x0(N2+1:N); %. . . . . . . . . . second part of the zeropaded signal    &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;X1 = fft(x1);&lt;br&gt;&#xA;  X2 = fft(x2);&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;F1 = fft(ifft(X1).*g); %. . . . . . . . . or ifft(fft(X1).*fft(G))/N2&lt;br&gt;&#xA;  F2 = fft(ifft(X2).*g); %. . . . . . . . . or ifft(fft(X2).*fft(G))/N2&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Xe = X1 + X2;&lt;br&gt;&#xA;  Xo = F1 - F2; %. . . . . . . . . . . . . .or F1 (because x2 is a zero array)&lt;br&gt;&#xA;  X = [Xe.'; Xo.'];&lt;br&gt;&#xA;  X = X(:);&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;max(abs(fft(x0)-X)) % near of epsilon&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;%my problem is x1 and x2 are the two zeropaded halfs of x (and not the two halfs of x0)&lt;br&gt;&#xA;  x1 = x(1:N4); %. . . . . . . .. . . . . . zeropaded first  part of the original signal&lt;br&gt;&#xA;  x1(end+N4) = 0;   &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;x2 = x(N4+1:N2); %. . . . . . . . . . zeropaded second part of the original signal&lt;br&gt;&#xA;  x2(end+N4) = 0;   &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;X1 = fft(x1);&lt;br&gt;&#xA;  X2 = fft(x2);   &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;F1 = fft(ifft(X1).*g);&lt;br&gt;&#xA;  F2 = fft(ifft(X2).*g);    &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Xe = X1 + X2;&lt;br&gt;&#xA;  Xo = F1 - F2;&lt;br&gt;&#xA;  X = [Xe.'; Xo.'];&lt;br&gt;&#xA;  X = X(:);&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;max(abs(fft(x0)-X)) %. . . . . . . . random because of the signal but too high&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Do I make myself clear? &lt;/p&gt;&#xA;" OwnerUserId="14961" LastEditorUserId="35" LastEditDate="2016-10-17T02:35:58.337" LastActivityDate="2017-03-21T02:01:54.193" Title="Get a N-FFT with two N/2-FFT already computed" Tags="|fft|convolution|algorithms|dsp-core|c|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21919" PostTypeId="1" AcceptedAnswerId="21922" CreationDate="2015-03-07T03:47:12.643" Score="0" ViewCount="2136" Body="&lt;p&gt;I'm looking to compare the Fourier Transforms generated by accelerators and gyroscopes that collected data of people walking. I've looked to see if there is a standard form of comparison, but I have yet to find one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my specific use case: I'm looking to compare similarity between the dominant signals of two Fourier Transforms (i.e. how close are they to being the same frequency/magnitude). Is there a specific metric that would help identify that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not (or perhaps irrespective of my goal), what are some common ways of comparing two Fourier transforms? I've found surprisingly little on the subject. &lt;/p&gt;&#xA;" OwnerUserId="14962" LastActivityDate="2015-03-07T07:30:53.693" Title="Compute Similarity between Fourier Transforms" Tags="|signal-analysis|fourier-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21920" PostTypeId="2" ParentId="21916" CreationDate="2015-03-07T07:16:25.697" Score="-1" Body="&lt;p&gt;It would appear that the two signals are multiplexed (naive time-division multiplexing), that is to say, even-numbered samples belong to signal 1 and odd-numbered samples to signal 2 - in which case the separation is trivial. Is that the case?&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2015-03-07T07:16:25.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21922" PostTypeId="2" ParentId="21919" CreationDate="2015-03-07T07:30:53.693" Score="1" Body="&lt;p&gt;Most simply, you can compute simple statistical measures on each FFT frame and compare those directly. The signal energy, its distribution, variance, etc across the frequency spectrum are interesting measures. You can also directly compute the correlation coefficient between accelerometer signal pairs (normalized to their length).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be useful to look into research on “gait recognition”, the &lt;a href=&quot;http://robotics.usc.edu/~gaurav/CS546/readings/bao_pc2004.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;literature&lt;/a&gt; points to “low frequency-domain entropy” as feature that is useful in discriminating accel/gyro data that differ in “complexity”&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you seen this thread on comparing &lt;a href=&quot;https://stackoverflow.com/questions/18553910/algorithms-to-compare-3d-signal-data-from-accelerometers&quot;&gt;3d data from accelerometers&lt;/a&gt;. It is worth considering if using the raw 3d data, doing a dimensionality reduction (PCA, etc) and then using a simple distance metric may get you further than analyzing raw FFT output. Doing an FFT as you've proposed doing is only one way to simplify the data, but I think the Fourier transform is too coarse &amp;amp; noisy to give you directly comparable results, every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative, it might be easier/faster to use &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3244008/&quot; rel=&quot;nofollow noreferrer&quot;&gt;machine learning&lt;/a&gt;, i.e. training a &quot;people walking&quot; classifier using any &lt;a href=&quot;http://www.hindawi.com/journals/cin/2011/647858/&quot; rel=&quot;nofollow noreferrer&quot;&gt;modern supervised learning technique&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2015-03-07T07:30:53.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21923" PostTypeId="2" ParentId="21916" CreationDate="2015-03-07T08:05:06.140" Score="-1" Body="&lt;p&gt;No, You need at least two mixtures (channels).&#xA;Look at the reference books of the Blind Source Separation technique.&lt;/p&gt;&#xA;" OwnerUserId="14806" LastActivityDate="2015-03-07T08:05:06.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21925" PostTypeId="1" CreationDate="2015-03-07T23:35:49.160" Score="0" ViewCount="539" Body="&lt;p&gt;I am trying to take data from an accelerometer and apply Kiss FFT to the samples. I'm using a Freescale Kinetis FRDM-K22F board. I want to use 64 samples, but when I run the program I get an error saying &quot;kiss fft usage error: improper alloc&quot; I started turning down the sample size and saw that the FFT does work with 32 samples, but giving it 33 samples the program just stops and returns no errors. Giving it any more samples gives similar results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I played around with how I set up the FFT and followed a few websites and forum posts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;KissFFT output of kiss_fftr&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://digiphd.com/programming-reconstruction-fast-fourier-transform-real-signal-kiss-fft-libraries/&quot; rel=&quot;nofollow&quot;&gt;http://digiphd.com/programming-reconstruction-fast-fourier-transform-real-signal-kiss-fft-libraries/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kiss FFT on a dsPIC33&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I can see, I haven't done anything different from what the above websites and forums have done. I've included my code below. Any help or advice is greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void Sample_RUN()&#xA;{&#xA;    int size = 33;&#xA;    kiss_fft_scalar zero;&#xA;    memset(&amp;amp;zero,0,sizeof(zero));&#xA;    kiss_fft_cpx fft_in[size];&#xA;    kiss_fft_cpx fft_out[size];&#xA;&#xA;    kiss_fftr_cfg fft = kiss_fftr_alloc(size*2 ,0 ,NULL,NULL);&#xA;&#xA;    signed short samples[size];&#xA;&#xA;    for (int i = 0; i &amp;lt; size; i++) {&#xA;        fft_in[i].r = zero;&#xA;        fft_in[i].i = zero;&#xA;        fft_out[i].r = zero;&#xA;        fft_out[i].i = zero;&#xA;    }&#xA;&#xA;    printf(&quot;Data Collection Begins \r\n&quot;);&#xA;&#xA;for(int j = 0; j &amp;lt; size; j++)&#xA;{&#xA;    for(;;)&#xA;    {&#xA;        dr_status = My_I2C_ReadByte(STATUS_REG);&#xA;        dr_status = (dr_status &amp;amp; 0x04);&#xA;        if (dr_status == 0x04)&#xA;        {&#xA;            //READING FROM ACCEL OUTPUT DATA REGISTERS&#xA;            AccelData[0] = My_I2C_ReadByte(OUT_X_MSB_REG);&#xA;            AccelData[1] = My_I2C_ReadByte(OUT_X_LSB_REG);&#xA;            AccelData[2] = My_I2C_ReadByte(OUT_Y_MSB_REG);&#xA;            AccelData[3] = My_I2C_ReadByte(OUT_Y_LSB_REG);&#xA;            AccelData[4] = My_I2C_ReadByte(OUT_Z_MSB_REG);&#xA;            AccelData[5] = My_I2C_ReadByte(OUT_Z_LSB_REG);&#xA;&#xA;            // 14-bit accelerometer data&#xA;            Xout_Accel_14_bit = ((signed short) (AccelData[0]&amp;lt;&amp;lt;8 | AccelData[1])) &amp;gt;&amp;gt; 2;     // Compute 16-bit X-axis acceleration output value&#xA;            Yout_Accel_14_bit = ((signed short) (AccelData[2]&amp;lt;&amp;lt;8 | AccelData[3])) &amp;gt;&amp;gt; 2;     // Compute 16-bit Y-axis acceleration output value&#xA;            Zout_Accel_14_bit = ((signed short) (AccelData[4]&amp;lt;&amp;lt;8 | AccelData[5])) &amp;gt;&amp;gt; 2;     // Compute 16-bit Z-axis acceleration output value&#xA;&#xA;            mag_accel = sqrt(pow(Xout_Accel_14_bit, 2) + pow(Yout_Accel_14_bit, 2) + pow(Zout_Accel_14_bit, 2) );&#xA;&#xA;            printf(&quot;%d \r\n&quot;, mag_accel);&#xA;&#xA;            samples[j] = mag_accel;&#xA;&#xA;            break;&#xA;&#xA;        } // end if&#xA;    } // end infinite for&#xA;} // end for&#xA;&#xA;&#xA;for (int j = 0; j &amp;lt; size; j++)&#xA;{&#xA;     fft_in[j].r = samples[j];&#xA;     fft_in[j].i = zero;&#xA;     fft_out[j].r = zero;&#xA;     fft_out[j].i = zero;&#xA;}&#xA;&#xA;printf(&quot;Executing FFT\r\n&quot;);&#xA;kiss_fftr(fft, (kiss_fft_scalar*) fft_in,  fft_out);&#xA;&#xA;printf(&quot;Printing FFT Outputs\r\n&quot;);&#xA;for(int j = 0; j &amp;lt; size; j++)&#xA;{&#xA;    printf(&quot;%d \r\n&quot;, fft_out[j].r);&#xA;}&#xA;&#xA;kiss_fft_cleanup();&#xA;free(fft);&#xA;} // end Sample_RUN&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14970" LastEditorUserId="7092" LastEditDate="2015-03-08T02:11:02.970" LastActivityDate="2015-03-09T17:46:11.523" Title="Kiss fft does not work after giving it more than 32 samples" Tags="|fft|signal-analysis|continuous-signals|c|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21926" PostTypeId="1" CreationDate="2015-03-08T03:29:17.577" Score="2" ViewCount="180" Body="&lt;p&gt;How to objectively assess the quality of a medical image(CT,PET,MRI)? What factors should be considered?&lt;/p&gt;&#xA;" OwnerUserId="12270" LastEditorUserId="7092" LastEditDate="2015-03-08T03:54:14.943" LastActivityDate="2015-11-06T01:37:46.073" Title="Medical Image quality assessment" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21927" PostTypeId="2" ParentId="21918" CreationDate="2015-03-08T10:15:11.423" Score="4" Body="&lt;p&gt;You can compute a length $N$ FFT from two length $N/2$ FFTs of consecutive parts of the data, but it can't be done efficiently, i.e. it is more efficient to go back to the time domain, combine the data, and compute the total FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But anyway, the way it can be done is as follows. For convenience, I repeat the two formulas below from &lt;a href=&quot;https://dsp.stackexchange.com/questions/19645/can-i-take-piecewise-fft-of-a-larger-input-sample/19647#19647&quot;&gt;this answer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[2k]=\sum_{n=0}^{N/2-1}\left(x[n]+x[n+N/2]\right)W_{N/2}^{nk}\\&#xA;X[2k+1]=\sum_{n=0}^{N/2-1}\left(x[n]-x[n+N/2]\right)W_N^nW_{N/2}^{nk}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $X[k]$ is the DFT of the complete data block, and where I assume that the length of the data block $N$ is even. If we denote the two halves of $x[n]$ by $x_1[n]$ and by $x_2[n]$ i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}x_1[n]&amp;amp;=x[n],&amp;amp;n=0,1,\ldots,N/2-1\\&#xA;x_2[n]&amp;amp;=x[n+N/2],&amp;amp;n=0,1,\ldots,N/2-1\end{align}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and if $X_1[k]$ and $X_2[k]$ are the length $N/2$ DFTs of $x_1[n]$ and $x_2[n]$, respectively, then we can rewrite (1) as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X[2k]&amp;amp;=X_1[k]+X_2[k]\\&#xA;X[2k+1]&amp;amp;=\text{DFT}_{N/2}\{W_N^nx_1[n]\}[k]-\text{DFT}_{N/2}\{W_N^nx_2[n]\}[k]\end{align}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G[k]=\text{DFT}_{N/2}\{W_N^n\}[k]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and remembering the DFT property&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{DFT}_{N/2}\{u[n]v[n]\}=\frac{2}{N}(U\star V)[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes circular convolution, we can write the equation for the odd indices in (2) as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[2k+1]=\frac{2}{N}\left((G\star X_1)[k]-(G\star X_2)[k]\right)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, according to Eq. (2), the even indices of the DFT of the complete data block are simply given by the sum of the two shorter DFTs. The odd indices can be computed from (4), where circular convolution with the function $G[k]$ is necessary. This circular convolution performs interpolation in the frequency domain. From its definition (3), the function $G[k]$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G[k]=\frac{e^{j\pi (2k+1)/N}}{j\sin(\pi (2k+1)/N)},\quad k=0,1,\ldots,N/2-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This short Matlab/Octave script shows how (and that) it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;N = 128;            % (total) FFT length (even)&#xA;N2 = N/2;           % length of shorter FFTs&#xA;x = rand(N,1);      % some signal ...&#xA;x1 = x(1:N2);       % ... and its two parts&#xA;x2 = x(N2+1:N);&#xA;X1 = fft(x1);&#xA;X2 = fft(x2);&#xA;n = (0:N2-1)';&#xA;g = e.^(-j*2*pi/N*n);&#xA;G = fft(g);&#xA;F1 = ifft(fft(X1).*fft(G))/N2;   % circular convolution of X1 and G&#xA;F2 = ifft(fft(X2).*fft(G))/N2;   % circular convolution of X2 and G&#xA;&#xA;% final result&#xA;Xe = X1 + X2;       % even indices of X&#xA;Xo = F1 - F2;       % odd indices of X&#xA;X = [Xe.'; Xo.'];&#xA;X = X(:);&#xA;&#xA;% compare with direct computation of FFT&#xA;max(abs(fft(x)-X))  % 4.6204e-15&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2017-01-02T20:53:11.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21930" PostTypeId="2" ParentId="21904" CreationDate="2015-03-08T18:53:26.433" Score="0" Body="&lt;p&gt;Are you sure that the 60Hz is interference?&#xA;When looking at the signal, I am not so sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your question about weird output, it looks to me that your LPC may be too small. The LPC size should be at least twice the number of formants.&lt;/p&gt;&#xA;" OwnerUserId="14840" LastActivityDate="2015-03-08T18:53:26.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21932" PostTypeId="2" ParentId="69" CreationDate="2015-03-08T21:11:47.097" Score="10" Body="&lt;p&gt;Some of the other answers in this thread have excellent mathematical discussions of the definition and properties of the Fourier transform; as an audio programmer, I merely want to provide my own personal intuition as to &lt;em&gt;why&lt;/em&gt; it's important to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform permits me to answer questions about a sound that are difficult or impossible to answer with other methods.  It makes hard problems easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A recording contains a set of three musical notes.  What are the notes?  If you leave the recording as a set of amplitudes over time, this is not an easy problem.  If you convert the recording to a set of frequencies over time, it's really easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to change the pitch of a recording without changing its duration.  How do I do this?  It's possible, but not easy to do, by just manipulating the amplitude of an input signal.  But it's easy if you know the frequencies that comprise the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this recording contain speech or does it contain music?  Super hard to do using only amplitude-based methods.  But there are good solutions that guess the right answer nearly all of the time based on the Fourier transform and its family.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Almost every question you'd like to ask about a digital audio recording is made easier by transforming the recording using a discrete version of the Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, &lt;em&gt;every&lt;/em&gt; modern digital audio device relies heavily on functions very similar to the Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, forgive the highly informal description; this is merely my personal intuition as to &lt;em&gt;why&lt;/em&gt; the Fourier transform is important.&lt;/p&gt;&#xA;" OwnerUserId="13700" LastEditorUserId="13700" LastEditDate="2015-03-09T05:21:58.587" LastActivityDate="2015-03-09T05:21:58.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21933" PostTypeId="1" CreationDate="2015-03-08T22:19:22.240" Score="0" ViewCount="64" Body="&lt;p&gt;I'm now working in parallel precessing -and i want a full code for fast Fourier transform(FFT)&#xA;written  parallel processing Code for any image processing application  &lt;/p&gt;&#xA;" OwnerUserId="14978" LastEditorUserId="14978" LastEditDate="2015-03-09T19:50:21.347" LastActivityDate="2015-03-09T19:50:21.347" Title="Fast Fourier Transformation using parallel processing coding for image processing" Tags="|fft|image-processing|c|" AnswerCount="1" CommentCount="1" ClosedDate="2015-03-09T11:43:00.167" ContentLicense="CC BY-SA 3.0" />
  <row Id="21934" PostTypeId="2" ParentId="21933" CreationDate="2015-03-08T23:39:04.697" Score="2" Body="&lt;p&gt;Well, you should have a look at &lt;a href=&quot;http://www.fftw.org/&quot; rel=&quot;nofollow&quot;&gt;FFTW&lt;/a&gt; as their implementation allows you to use more than one thread to perform the FFT. One thing that should note with this library is that multi-threading is not necessarly beneficial for all problems sizes as stated &lt;a href=&quot;http://www.fftw.org/doc/How-Many-Threads-to-Use_003f.html#How-Many-Threads-to-Use_003f&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. For a software application that I'm working on, for example, using multiple threads slows down things (the biggest FFT being on 4096 points).&lt;/p&gt;&#xA;" OwnerUserId="12161" LastActivityDate="2015-03-08T23:39:04.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21935" PostTypeId="1" AcceptedAnswerId="21989" CreationDate="2015-03-09T09:11:58.687" Score="3" ViewCount="179" Body="&lt;p&gt;I have a problem in which i have a video that was taken from the side of the subject, something like this &#xA;&lt;img src=&quot;https://i.stack.imgur.com/35q4w.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA; and i need to transform the coordinates of the subject to be as if the photo was taken from above like this &#xA;&lt;img src=&quot;https://i.stack.imgur.com/MVywQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the real set of coordinates that i can relate to from picture 2 to picture 1 , i only need to transform the coordinates of the moving subject, not the whole picture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using polynomial regression in order to approximate the right transformation, but it failed to work (i can see that it's not the true movement). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;also i have a problem that the video is taken with a fish eye lens. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is the right way to approach it? or if you can direct me to the appropriate papers? (i never done image processing before). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;many thanks, &lt;/p&gt;&#xA;" OwnerUserId="14982" LastActivityDate="2015-03-13T06:06:53.513" Title="Transformation of coordinate set" Tags="|image-processing|transfer-function|image-registration|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21938" PostTypeId="1" AcceptedAnswerId="21939" CreationDate="2015-03-09T12:06:12.393" Score="2" ViewCount="1684" Body="&lt;p&gt;I don't unstand the nature of the output in Matlab's &quot;butter&quot; command. Calling &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = butter(4, 0.5, 'low');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives me two vectors, which the documentation says are &lt;code&gt;b&lt;/code&gt; for numerator, and &lt;code&gt;a&lt;/code&gt; for denominator, of the transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However plotting the frequency response of this transfer function with &lt;code&gt;freqz()&lt;/code&gt; does not give me what I expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I plot &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz(b./a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I see:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/IadQi.jpg&quot; alt=&quot;freqz of b over a&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not a low pass filter, this is some sort of band stop filter suppressing the middle frequencies. However if I plot &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz(b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I see what looks like the low pass filter I was hoping for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4WYMb.jpg&quot; alt=&quot;freqz of b only&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I want to use a Butterworth filter to low pass my data, do I only use &lt;code&gt;b&lt;/code&gt;? And if so what is the point of &lt;code&gt;a&lt;/code&gt;? &lt;/p&gt;&#xA;" OwnerUserId="5623" LastEditorUserId="7092" LastEditDate="2015-03-09T14:44:16.623" LastActivityDate="2015-03-09T14:44:16.623" Title="Don't understand coefficients in MATLAB &quot;butter&quot; low pass result" Tags="|matlab|filters|lowpass-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21939" PostTypeId="2" ParentId="21938" CreationDate="2015-03-09T12:20:19.367" Score="4" Body="&lt;p&gt;You are using wrong syntax. You should call &lt;code&gt;freqz&lt;/code&gt; function as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz(b,a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You do not divide any coefficients. In case of non-recursive filters (FIR) you use only coefficients stored in &lt;code&gt;b&lt;/code&gt; vector. When you are using the recursive LCCDE (&lt;em&gt;Linear Constant Coefficients Difference Equation&lt;/em&gt;) (mostly IIR filters) then you need also the &lt;code&gt;a&lt;/code&gt; vector. I suggest you to set &lt;code&gt;a&lt;/code&gt; to 1 if you use non-recursive FIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also watch out for numerical problems with transfer function representation as mentioned in final paragraph of this &lt;a href=&quot;http://uk.mathworks.com/help/signal/ref/butter.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;manual entry&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/a/17986/8202&quot;&gt;&lt;em&gt;this answer&lt;/em&gt;&lt;/a&gt;. It's always safer to use z-p-k representation.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-03-09T12:26:00.130" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21940" PostTypeId="1" AcceptedAnswerId="21941" CreationDate="2015-03-09T12:25:06.670" Score="1" ViewCount="622" Body="&lt;p&gt;I'm learning about Gaussian Mixture Model (GMM) for background subtraction.. And have some questions about it..&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ai.mit.edu/projects/vsam/Publications/stauffer_cvpr98_track.pdf&quot; rel=&quot;nofollow&quot;&gt;In Chris Stauffer paper &quot;Adaptive background mixture models for real-time tracking&quot;&lt;/a&gt; Gaussian probability density function is&#xA;$$\mathcal{N}(X_t,\mu,\Sigma)=\dfrac{1}{(2\pi)^\frac{n}{2} \left|{\Sigma}\right|^\frac{1}{2}}\exp\left(-\dfrac{1}{2}(X_t-\mu_t)^T\Sigma^{-1}(X_t-\mu_t)\right)$$&lt;br&gt;&#xA;where $n$ in multi dimension, is $n$ in 3-D which is pixel position in x,y, and intensity of pixel?&lt;/li&gt;&#xA;&lt;li&gt;In the same paper, they said:&#xA;$$\Sigma_{k,t}=\sigma_k^2.I$$&#xA;Is $I$ is Indentity matrix?&lt;/li&gt;&#xA;&lt;li&gt;They also said &lt;strong&gt;&lt;em&gt;red,green, and blue pixel values are independent and have the same variances&lt;/em&gt;&lt;/strong&gt;, if it independent why R,G, and B have same variances? shouldn't it have different variances because the value of each channel is different..&lt;/li&gt;&#xA;&lt;li&gt;If I set the algorithm with number of distribution is 3, so it's only 1 distribution that chosen as background model and the rest is foreground model? Because they said &lt;strong&gt;&lt;em&gt;the first B distribution are chosen as the background model, where&lt;/em&gt;&lt;/strong&gt;&#xA;$$B=\arg \min_b(\sum\limits_{k=1}^b w_k&amp;gt;T)$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12035" LastEditorUserId="53" LastEditDate="2015-03-09T18:25:50.630" LastActivityDate="2015-03-09T20:58:30.637" Title="I have some questions about background subtraction with Gaussian Mixture Model (GMM)" Tags="|image-processing|computer-vision|algorithms|background-subtraction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21941" PostTypeId="2" ParentId="21940" CreationDate="2015-03-09T13:12:51.513" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, the dimension of $X$ should be 3, one for each of the red, green, and blue channels. You can see this from their Figure 2, where they show plots of the distributions of red and green channels only (to motivate why they want to use a Gaussian Mixture Model in the first place --- the distribute of pixel values is multi-modal).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, $I$ is the identity matrix.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Random variables can have the same variances and still be independent. The variance is part of the model. In this case what the model is saying is: the red, green, and blue pixel values vary without regard to each other (they are independent) but the amount that they vary is about the same as each other (they have the same variances).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Whether only 1 distribution is chosen when $K=3$ will depend on the threshold $T$, surely?  Yes, it is possible that only one distribution will be chosen.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-03-09T20:58:30.637" LastActivityDate="2015-03-09T20:58:30.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21942" PostTypeId="1" CreationDate="2015-03-09T14:21:11.420" Score="0" ViewCount="2529" Body="&lt;p&gt;I'm trying to develop a sudoku solver, using image processing, ocr with neural networks and such. I've got the bare solver working, I can successfully interpret numbers and letters from a picture. All of this is done in GNU Octave. Now I am trying to make it more robust, and I've found this question on &lt;a href=&quot;https://stackoverflow.com/questions/10196198/how-to-remove-convexity-defects-in-a-sudoku-square&quot;&gt;stack overflow&lt;/a&gt; which greatly helped with most of the image processing. But now I am left with the last part - transforming the single &quot;squares&quot; so that they are uniform and (mostly) square.&#xA;What I would like to have: A method that from one set of $(X,Y)$ corner coordinates, e.g.:$(73,86), (117,88), (70,127), (115,128)$ would transform the image with interpolation to the set of coordinates, e.g.: $(0,0), (50,0), (0,50), (50,50)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at the functions supplied with octave and there are these possibilities:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://octave.sourceforge.net/image/function/imperspectivewarp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;imperspectivewarp&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://octave.sourceforge.net/image/function/imremap.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;imremap&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;but both of them require, for me to know the affine matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a thing I've overlapped with these functions, or could someone here point me in a direction to develop such a function?&lt;/p&gt;&#xA;" OwnerUserId="14985" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-11-06T15:55:55.427" Title="Calculating Affine Transformation matrix from 4 corner points" Tags="|image-processing|matlab|octave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21944" PostTypeId="2" ParentId="21925" CreationDate="2015-03-09T17:46:11.523" Score="-1" Body="&lt;p&gt;It is possible that the program expects a power of 2 samples. Does it work with 64 samples? The FFT by definition usually refers to power of two series.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-09T17:46:11.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21947" PostTypeId="1" AcceptedAnswerId="21955" CreationDate="2015-03-10T03:47:12.073" Score="5" ViewCount="8288" Body="&lt;p&gt;For a project I am attempting to use an accelerometer to measure vibration in an RC aircraft and determine frequency from the result. To do this I am using an MPU-6000 accelerometer sampling @ 1000Hz. Before I actually deploy this system on an aircraft, I have taped the sensor to a speaker and used a frequency generator to generate a 100Hz tone for 30 seconds. This should be well within the accelerometer's range:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1000Hz / 2 = 500Hz maximum by Nyquist rule, much higher than 100Hz&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My amplitude data in the time domain is bellow (generated w/ GNU Octave):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/paB98.png&quot; alt=&quot;Accelerometer data in time domain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Zoomed in:&lt;/em&gt;&lt;img src=&quot;https://i.stack.imgur.com/3TinL.png&quot; alt=&quot;Accelerometer data in the time domain zoomed in&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That looks like a ton of data to me but nothing seems to be obviously in error. Bellow is the data after performing a simple periodogram in GNU Octave with the command &lt;strong&gt;&lt;em&gt;periodogram(DATA,[],[],1000)&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oa5DQ.png&quot; alt=&quot;Accelerometer data in the frequency domain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A peak can be seen at 100Hz but there are all of those other spikes that I can't explain. I have tried to detrend my data using the GNU Octave command &lt;strong&gt;&lt;em&gt;detrend(DATA,'linear')&lt;/em&gt;&lt;/strong&gt; but that had no effect on removing the stray peaks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the feeling that I should be doing some filtering but I am new to this and really don't know what I am doing. How can I remove all of the stray peaks in the periodogram? Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Data file on Google Drive: &lt;a href=&quot;http://goo.gl/w3Brol&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://goo.gl/w3Brol&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the periodogram for the unit sitting on the speaker with nothing playing for 30 seconds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9JEd2.png&quot; alt=&quot;Silence in the frequency domain&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There doesn't appear to be any interference. The speaker was on, just not playing anything. This is making me think that my speaker is generating harmonics when I supply a sine wave. Could that be? As always, thanks for the help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Silence data file on Google Drive: &lt;a href=&quot;http://goo.gl/bNbnDA&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://goo.gl/bNbnDA&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT #2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Success! After isolating my speaker from the table, taping the device to the back of the speaker (I bet glue would help further), and lowering the volume I was able to get the result below! You guys were spot on, thanks for all your help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wWhcl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13724" LastEditorUserId="13724" LastEditDate="2015-03-12T19:26:39.473" LastActivityDate="2015-03-12T19:26:39.473" Title="Processing Accelerometer Vibration Data With FFT" Tags="|matlab|fft|filters|signal-analysis|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21950" PostTypeId="1" CreationDate="2015-03-10T11:02:34.117" Score="1" ViewCount="457" Body="&lt;p&gt;I am implementing some feature extractors in Swift for an application. One of these features is Spectral Centroid. For some reason I keep getting values ranging between 0.45 and 0.5, and these don't really reflect what I'm playing through the microphone. I can see why it's close to 0.5 when there is nothing playing as the centre of mass is around the middle of the spectrum. I have implemented the FFT like so using the &lt;em&gt;Accelerate&lt;/em&gt; library:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;func FFT(buffer: [Float]) -&amp;gt; [Float] {&#xA;&#xA;    var real = [Float](buffer)&#xA;    var imaginary = [Float](count: buffer.count, repeatedValue: 0.0)&#xA;    var splitComplex = DSPSplitComplex(realp: &amp;amp;real, imagp: &amp;amp;imaginary)&#xA;&#xA;    let length = vDSP_Length(floor(log2(Float(buffer.count))))&#xA;    let radix = FFTRadix(kFFTRadix2)&#xA;    let setup: FFTSetup = vDSP_create_fftsetup(length, radix)&#xA;&#xA;    vDSP_fft_zrip(setup, &amp;amp;splitComplex, 1, length, FFTDirection(FFT_FORWARD))&#xA;&#xA;    //Extracting the magnitudes: real^2 + imag^2&#xA;    var magnitudes = [Float](count: buffer.count, repeatedValue: 0.0)&#xA;    vDSP_zvmags(&amp;amp;splitComplex, 1, &amp;amp;magnitudes, 1, vDSP_Length(buffer.count))&#xA;&#xA;    var normalizedMagnitudes = [Float](count: buffer.count, repeatedValue: 0.0)&#xA;    vDSP_vsmul(sqrt(magnitudes), 1, [2.0 / Float(buffer.count)], &amp;amp;normalizedMagnitudes, 1, vDSP_Length(buffer.count))&#xA;&#xA;    return normalizedMagnitudes&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Spectral centroid algorithm that I've implemented looks like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;func spectralCentroid(fft: [Float]) -&amp;gt; Float {&#xA;&#xA;    var numerator: Float = 0;&#xA;    var denominator: Float = 0;&#xA;&#xA;    var nyquist: Int = fft.count/2;&#xA;&#xA;    for (index, bin) in enumerate(Array(fft[0..&amp;lt;nyquist])){&#xA;        numerator += (abs(bin)*Float(index))&#xA;    }&#xA;    denominator = sum(Array(fft[0..&amp;lt;nyquist]));&#xA;&#xA;    return isnan(numerator/denominator) ? 0 : (numerator/denominator)/Float(nyquist);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am also using this utility function that I've made to convert from AVAudioPCMBuffer to a regular float buffer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;func convertBufferToFloat(buffer: AVAudioPCMBuffer) -&amp;gt; [Float]{&#xA;&#xA;    for var i: Int = 0; i &amp;lt; Int(buffer.frameLength); i++ {&#xA;        bufferInFloat[i] = buffer.floatChannelData.memory[i]&#xA;    }&#xA;&#xA;    return bufferInFloat&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="14992" LastActivityDate="2015-03-10T11:02:34.117" Title="Spectral centroid range between 0.45 to 0.5, almost doesn't react to mic input" Tags="|frequency-spectrum|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21952" PostTypeId="1" AcceptedAnswerId="21953" CreationDate="2015-03-10T14:00:05.090" Score="1" ViewCount="581" Body="&lt;p&gt;I'm busy trying to implement a filter from &lt;a href=&quot;http://www.ese.wustl.edu/~nehorai/paper/ieeetassp86-2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper. I'm a bit confused with one particular step (30e in the paper). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically I need to find the zero frequency gain (K) of the following whitening/comb filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QiCCS.png&quot; alt=&quot;Comb Filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant steps in the algorithm are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zGD0G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ib8uw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $q^{-1}$ is the unit delay operator, $\omega_0$ is the fundamental freq of the comb and $\rho$ is a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to calculate K. Since the function isn't acting on anything, what should be delayed? The signal (at time t)? Or does passing a constant in place of the delay mean it should be replaced?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some clarification on $q^{-1}$: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The right-shift operator $q^{-1}$ acts on a discrete-time signal f(k, T) as $q^{-1}$ f(k, T) = (k − 1, T). The operation $q^{-1}$ therefore shifts the discrete-time signal to the right by one sampling interval.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7911" LastEditorUserId="7911" LastEditDate="2015-03-10T15:15:15.963" LastActivityDate="2015-03-10T18:00:59.193" Title="Unit delay operator as parameter in function" Tags="|adaptive-filters|comb|unit-delay|unit-shift|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21953" PostTypeId="2" ParentId="21952" CreationDate="2015-03-10T15:13:49.133" Score="2" Body="&lt;p&gt;With $A(q^{-1},t)$ as given in the formula you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(1,t)=\prod_{k=1}^n(1-2\cos(k\hat\omega_0(t))+1)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(\rho,t)=\prod_{k=1}^n(1-2\cos(k\hat\omega_0(t))\rho+\rho^2)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $K(t)$ is simply the quotient of (1) and (2).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-10T18:00:59.193" LastActivityDate="2015-03-10T18:00:59.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21954" PostTypeId="2" ParentId="21947" CreationDate="2015-03-10T16:40:10.323" Score="5" Body="&lt;p&gt;After taking a closer look at your results, here is what I think. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eITX2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you are playing back sinusoid through your speaker you are also observing it's properties. It has some significant harmonic distortions appearing as the harmonics of fundamental frequency: $200$, $300$, $400 \mathrm{Hz}$ in your case. That is either because:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You are driving your speaker at high volume&lt;/li&gt;&#xA;&lt;li&gt;It is simply crap for accurate measurements (sorry...)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Obviously you could also get harmonic distortions coming from your sound card, but this is unlikely. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand what you see at $50 \mathrm{Hz}$ is the mains hum of AC voltage (you are definitely not in USA). This distortion also has it's harmonics at $100$, $150$, $200 \mathrm{Hz}$, etc. So you can see that they do overlap with your test signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless if you look at higher frequencies, i.e. around $400 \mathrm{Hz}$, you will see two peaks next to each other. Those are two harmonics, one of your test signal and other one of your mains hum. Because there was a slight offset at low frequencies it diverges even more at higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to confirm the &lt;em&gt;mains hum&lt;/em&gt; you should simply record silence. If it is present, then well - you have a slight problem. If you are using laptop, try to unplug the AC adaptor - it should help. Otherwise you are simply picking up everything with your power supply. You can also try external audio interface. On the contrary, if you are already using some kind of interface with XLR microphone or whatever - try to break the ground loop. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to speaker distortions try to use other one or maybe use it a slightly lower volume.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-03-10T16:40:10.323" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="21955" PostTypeId="2" ParentId="21947" CreationDate="2015-03-10T17:57:29.990" Score="4" Body="&lt;p&gt;Back when I used to design accelerometers, our biggest test issues were mechanical mounting stiffness, and the aforementioned ground loops.  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Eliminate ground issues&lt;/strong&gt; - The 50Hz/60Hz ground loops can be eliminated by taking the data with no power line attached.  Unplug the laptops, so it runs off batteries. If you must have line-powered instrument(sig gen, DAQ, amplifier), power it from a UPS(unplugged).  You can rule out ground loops if ALL the harmonics move when you sweep the frequency down. If there is a ground loop, it will stay put at 50/60Hz and the harmonics of that.&lt;br&gt;&#xA;1a.Try inputting odd signals of 53Hz or 59Hz, something whose harmonics don't coincide with 50Hz 60Hz, or your sampling freq.  If you might be aliasing, change your sample freq, and see if the harmonics move.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Mounting.&lt;/strong&gt;  I didn't download the data, but the amplitude dropped during the time domain plot. If the accel loosened up, and is rocking, even microscopically, it can create harmonics as it impacts on the left/right side, every up/down cycle. These can mix back down to subharmonics, like 50Hz. I'm guessing the accel did not stay solidly attached to the speaker cone. As a mount, tape usually won't cut it at any frequency.  Here's a link illustrating how even metal studs aren't enough to accurately reproduce high frequencies.  &lt;a href=&quot;http://www.mmf.de/accelerometer_mounting.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.mmf.de/accelerometer_mounting.htm&lt;/a&gt;.&lt;br&gt;&#xA;2a. There is also mass loading to consider, if you are adding the accel to the edge of a flimsy paper speaker cone, which can barely drive its own weight.  At 100Hz and above, you may get a more solid mount on the back of the speaker magnet.  Adhering with thin layer of beeswax, or superglue, might get you to 1KHz, without requiring a machined mount. While back-mounting will be admittedly less signal in g, it will be a cleaner one, from a distortion perspective(assuming a distortion free source). &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If its not convenient to retake the data, try a rolling STFT, or spectrogram.  If the harmonics jump up part way through duration of the measurement, I'd look hard at the mount.  &lt;/p&gt;&#xA;" OwnerUserId="14998" LastActivityDate="2015-03-10T17:57:29.990" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21956" PostTypeId="2" ParentId="21947" CreationDate="2015-03-10T18:06:23.160" Score="2" Body="&lt;p&gt;This is just a guess, but it could be that you are getting these harmonics because you have inadequate acoustic coupling between the accelerometer and its mount point (i.e. tape isn't secure enough). If you have a way to sense data from a microphone you could rule out the possibility of the speaker being defective. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as filtering out the harmonics, I thought this would be a good opportunity to try out a technique I learned recently called &lt;a href=&quot;http://en.wikipedia.org/wiki/Singular_spectrum_analysis#SSA_as_a_model-free_tool&quot; rel=&quot;nofollow noreferrer&quot;&gt;Singular Spectrum Analysis&lt;/a&gt;. The idea is that you use the singular value decomposition to break apart your signal into a weighted combination of orthogonal basis functions (similar to the fourier basis, though the functions aren't limited to complex exponentials). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectral line at 100Hz in your periodogram is clearly the dominant mode. We should be able to extract it with a rank-2 approximation of your signal (rank-2 because a complex exponential at 100Hz has both real and imaginary parts -- so we need 2 real-valued basis functions to represent it). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a matlab script that uses the singular spectrum analysis technique I mentioned above. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;close all&#xA;&#xA;path = '100.csv';&#xA;raw = csvread(path);&#xA;&#xA;%% spectral decomposition with svd&#xA;J = 100; % number of spectral components&#xA;K = length(raw) - J + 1; % length of basis vectors&#xA;col = raw(1:J);&#xA;row = raw(J:end);&#xA;H = hankel(col,row)'; % tall, thin hankel matrix. &#xA;[U,S,V] = svd(H, 'econ');&#xA;s = diag(S); % squared singular values of H&#xA;stem(s);&#xA;grid on&#xA;title('singular spectrum');&#xA;xlabel('component index');&#xA;ylabel('squared singular values');&#xA;&#xA;%% reconstruct signal from the 2 dominant spectral components&#xA;Hfilt = U(:,1:2)*S(1:2,1:2)*V(:,1:2)'; % a rank-2 approximation of H &#xA;y = zeros(size(raw)); % this will be the filtered signal&#xA;for j=1:J&#xA;    sprintf('Processing column %d of %d ...', [j, J])&#xA;    for k=1:K&#xA;        y(k+j-1) =  y(k+j-1) + 1/J*Hfilt(k,j); % anti-diagonal averaging&#xA;    end&#xA;end&#xA;&#xA;%% power spectra of original and filtered signals&#xA;% I'm using Welch's method, which averages a bunch of lower resolution&#xA;% periodograms instead of computing a single high-resolution periodogram.&#xA;% This reduces the variance of the power spectrum estimate in exchange&#xA;% for lower frequency resolution.&#xA;Fs = 1000;&#xA;nfft = 1024;&#xA;win = blackmanharris(nfft); % this window has really high sidelobe attenuation&#xA;noverlap = ceil(.661*nfft); % near-optimal overlap for blackman-harris window&#xA;[R, f] = pwelch(raw, win, noverlap, nfft, Fs, 'onesided');&#xA;[Ry, f] = pwelch(y, win, noverlap, nfft, Fs, 'onesided');&#xA;figure&#xA;plot(f, 10*log10(Ry), 'linewidth', 2);&#xA;hold on&#xA;plot(f, 10*log10(R), 'r');&#xA;grid on&#xA;legend('filtered', 'original');&#xA;xlabel('freq. (Hz)');&#xA;ylabel('power (dB)');&#xA;title('power spectra');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This plot shows that most of the energy of your signal is concentrated in only 2 modes. These capture your 100Hz complex exponential.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/q0gX9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the result of the rank-2 approximation compared to the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zGgbw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11618" LastEditorUserId="11618" LastEditDate="2015-03-10T18:20:08.817" LastActivityDate="2015-03-10T18:20:08.817" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21957" PostTypeId="1" AcceptedAnswerId="21960" CreationDate="2015-03-10T19:48:38.683" Score="2" ViewCount="1654" Body="&lt;p&gt;Directivity pattern of a microphone array is fourier transfrom of  microphone weight values. By modifying the amplitude weights, we can modify the shape of the directivity pattern. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can really see this when all microphone weights are equally valued.&lt;br&gt;&#xA;Fourier transform of a rectangle is a sinc func like picture below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U8f8D.png&quot; alt=&quot;Equally valued microphone array elements and directivity pattern&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I believe if I apply a sinc function for my microphone array's element values I should get a rectangular shape in my directivity pattern. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a simulation program of my own. Which works when microphone values are equally valued . But I am not getting what I expect(a rectangular pattern) when I give sinc values to microphone array elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something teorically or it is just my program bugged?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: As requested in comments, weights that I apply can be seen in the graph below. 40 is the microphone count of my array. Sorry for disgusting looking graph it is the output of my C++ program. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uQIqV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="5392" LastEditDate="2015-03-10T20:54:05.950" LastActivityDate="2015-03-10T21:41:44.523" Title="Directivity Pattern of microphone array" Tags="|beamforming|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21958" PostTypeId="2" ParentId="21926" CreationDate="2015-03-10T21:00:59.707" Score="2" Body="&lt;p&gt;It is a million-dollar question.&#xA;It depends on the modality and the task the radiologist has to accomplish. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gold standard is to give radiologists your images, assign them a task and measure how effective they are. However, this requires time, money and clinical images. Typically, this is used as a last resort to convince the regulatory agencies (the FDA for instance) that your medical imaging system is effective. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other ways of doing this without radiologists, with &quot;model observers&quot;. Basically, you define an algorithm (often a variation on linear template-matching) with is supposed to mimick the performance of a human observer, and you measure the performance of the algorithm. However, not all tasks and modalities are suitable to such an approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use metrics measured on the image such as the Signal Difference to Noise Ratio, or metrics measure on the whole imaging system, such as the Detective Quantum Efficiency for X-ray systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a good overview, read this: &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/9419600&quot; rel=&quot;nofollow&quot;&gt;http://www.ncbi.nlm.nih.gov/pubmed/9419600&lt;/a&gt;&#xA;Image quality, the ideal observer, and human performance of radiologic decision tasks. Burgess A.&lt;/p&gt;&#xA;" OwnerUserId="15001" LastActivityDate="2015-03-10T21:00:59.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21959" PostTypeId="1" AcceptedAnswerId="21966" CreationDate="2015-03-10T21:08:51.950" Score="3" ViewCount="1491" Body="&lt;p&gt;I am reading over and over the Section 1.2 of &lt;a href=&quot;http://www.aplu.ch/home/download/microphone_array.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;most  understandable mic array tutorial for me &lt;/a&gt; . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sound wave is dependent on time and space which can be observed in the great &lt;a href=&quot;http://www.acs.psu.edu/drussell/Demos/wave-x-t/wave-x-t.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't understand why the Fourier transform of the spatially sampled data gives the directivity pattern of the microphone array (which can be seen in the section 1.3.2 of the first document)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any one who can describe this in more computer sciencist way? &lt;/p&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="5392" LastEditDate="2017-04-28T20:15:07.267" LastActivityDate="2017-04-28T20:15:07.267" Title="Relationship of Fourier Transform and Spatial Directivity Pattern" Tags="|fft|beamforming|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21960" PostTypeId="2" ParentId="21957" CreationDate="2015-03-10T21:15:50.607" Score="3" Body="&lt;p&gt;As I said in the comment, you sound like you are doing things correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are two plots generated by the &lt;code&gt;scilab&lt;/code&gt;code at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first plot shows two different weightings applied to the sensors.  The second plot shows the associated beam patterns.  While the $\tt sinc$ one is not &quot;uniform&quot; it is a fair approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kuSqA.gif&quot; alt=&quot;Sensor weightings&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/goeyz.gif&quot; alt=&quot;Associated beam patterns&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the code below to cater for an even number of sensors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NOn2 = 20;&#xA;N = 2*NOn2;&#xA;w_uniform = ones(1,N);&#xA;omega = 2*%pi*([0:N-1] - N/2)/N + 0.0001;&#xA;w_sinc = [sin(N/15*omega)./(omega) ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I get the plots below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jCpHL.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HYf7l.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relationship between the weights and the beam pattern is like a Fourier transform:  the broader the &lt;code&gt;sinc&lt;/code&gt;, the narrower the beam pattern. The narrower the &lt;code&gt;sinc&lt;/code&gt;, the wider the beam pattern.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;CODE ONLY BELOW&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// http://www.astron.nl/other/workshop/MCCT/MondayPatel.pdf&#xA;lambda = 1;&#xA;d = lambda/3;&#xA;theta = [-%pi/2:0.01:%pi/2];&#xA;&#xA;phase_adjacent = 2*%pi*d/lambda*sin(theta);&#xA;&#xA;NOn2 = 7;&#xA;N = 2*NOn2 + 1;&#xA;w_uniform = ones(1,N);&#xA;omega = 2*%pi*[-NOn2:NOn2]/N + 0.0001;&#xA;w_sinc = [sin(N/4*omega)./(omega) ]&#xA;&#xA;e_to_phi = exp(-%i*phase_adjacent.'*[0:N-1]);&#xA;&#xA;r_uniform = e_to_phi*w_uniform';&#xA;r_sinc = e_to_phi*w_sinc';&#xA;&#xA;figure(0);&#xA;clf;&#xA;plot(theta/%pi*180,abs(r_uniform));&#xA;plot(theta/%pi*180,abs(r_sinc),'r.');&#xA;title('Uniform weighted (blue solid) and sinc weighted (red dotted) array resposnes');&#xA;&#xA;figure(1);&#xA;clf;&#xA;plot(w_uniform);&#xA;plot(w_sinc,'r.');&#xA;title('Uniform weighted (blue solid) and sinc weighted (red dotted) sensor weightings');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-03-10T21:41:44.523" LastActivityDate="2015-03-10T21:41:44.523" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21961" PostTypeId="1" CreationDate="2015-03-10T21:16:07.690" Score="1" ViewCount="6324" Body="&lt;p&gt;I am building an application that would &quot;listen&quot; to the microphone input, analyse it, and compare the analysis to a pre-analysed and pre-classified sound bank (small - maximum 20 sounds). It will then show the user what sound it was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I have a vague idea on how to implement this. I would like to choose a set of features that would best represent the sounds. The issue is that the sounds in the sound bank could be whatever the user recorded. From strong onsets and short sounds, to long onsets and long sounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current features I'm thinking of are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Spectral Centroid&lt;/li&gt;&#xA;&lt;li&gt;Spectral Flux&lt;/li&gt;&#xA;&lt;li&gt;Spectral Rolloff&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What do you think? Would these be sufficient to properly classify the sound? Also, as these features output a single value for specific sound buffer, how would you go about handling the feature vector that represents the whole sound? I am using kNN for classification, and was wondering what's the best way to compare two feature vectors? would cross-correlation be a feasible technique?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S&#xA;I have seen that a similar question was asked &lt;a href=&quot;https://dsp.stackexchange.com/questions/16994/feature-extraction-for-sound-classification&quot;&gt;here&lt;/a&gt;, but it doesn't fully answer my issues.&lt;/p&gt;&#xA;" OwnerUserId="14992" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2020-11-26T03:57:47.983" Title="Feature extraction for sound recognition and classification" Tags="|audio|signal-analysis|sound|signal-detection|" AnswerCount="2" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="21962" PostTypeId="2" ParentId="21918" CreationDate="2015-03-10T21:16:15.547" Score="1" Body="&lt;p&gt;The FFT and DFT are linear operations ( fft[x+y] = fft[x] + fft[y] ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using an 8 point example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fft[a,b,c,d,e,f,g,h] = fft[a,b,c,d,0,0,0,0] + fft[0,0,0,0,e,f,g,h]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, you'll be replacing one 8 point fft with two zero padded eight point ffts, but since half of the 8 point inputs to the ffts are zero, you can prune the graphs to reduce the computations required.  And if the input is real, you can save more.  But you will still do slightly more computation than a single fft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 16 basic types of fft: 8 DIT and 8 DIF, characterized by input order (bit reversed or sequential), output order, and geometry (in-place, isogeometric, constant input, constant output).   There are a great many more non-basic FFT algorithms (mixed radix, sliding fft, special algorithms for hardware processors, etc., etc.).  ALL of them require inputs to be staggered (ie: in all sixteen 8 point examples, input point 0 is ALWAYS added/subtracted to input 4, as are inputs 1 and 5, etc., no matter what the decimation, geometry, or input/output order).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might indeed save some time if you can process the first half your data in less time than it takes for the second half to come in, but in some very high speed systems, that is simply not possible.  And you will still be doing more operations than a single fft (and in inefficient algorithms/designs, much more).&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2015-03-10T21:16:15.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21963" PostTypeId="1" CreationDate="2015-03-10T21:24:10.420" Score="0" ViewCount="187" Body="&lt;p&gt;I know adding zeros will not increase the frequency resolution. I have couple of waveforms in time domain measured over months. I take the fft of the waveforms to find frequency components. The problem is I get several points around each peak, but only based on visual check i found that the real peak is not the one hit by discrete frequency points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To shovel this, 1. I can add zeros to get finer structure so that the frequency points are more close to the real peak points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: I can perform the same procedure for all waveforms. But can I really compare the peaks identified with such zero padding so that I can get the conclusion about whether there is peak shift over time or not in terms of frequency. &lt;/p&gt;&#xA;" OwnerUserId="14925" LastActivityDate="2015-03-11T16:26:59.910" Title="Use Zero Padding to find hidden peaks" Tags="|zero-padding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21964" PostTypeId="1" CreationDate="2015-03-10T22:00:57.197" Score="1" ViewCount="3991" Body="&lt;p&gt;I am really confused about oversampling and upsampling. I know that upsampling means stretching our signal in time domain by a factor of K, then interpolating some values or using just zeros. As I found out stretching in time domain is shrinking in frequency domain by the same rate. For example, stretch by factor of 2 in time domain mean shrinking by factor of 2 in frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let talk about oversampling, we just increase the sampling frequency more than Nyquist rate. Then we have too much information. Is there any chance to have aliasing? I mean in time domain, lets say I am sampling my signal (frequency is 70 Hz) by sampling frequency equals to 280 Hz (Nyquist*2) so, is there aliasing in frequency domain? Sorry if my explanation is not clear. It is because I am bewildered with these concepts; oversampling, upsampling, downsampling, undersampling, critical sampling and aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;theoretically, I know them but when it comes to practical view, I have serious problem.&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="8202" LastEditDate="2015-03-10T22:09:32.983" LastActivityDate="2023-01-08T15:29:37.930" Title="Oversampling and Aliasing" Tags="|sampling|frequency-domain|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21965" PostTypeId="1" CreationDate="2015-03-10T22:22:35.397" Score="2" ViewCount="279" Body="&lt;p&gt;Problem: I'm getting totally different MFCC coefficients for identical and near identical sounds like several finger snaps or several desk taps. What am I missing? I thought since the timbre doesn't really change, the coefficients wouldn't be that much different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the aubio library to extract the MFCCs from microphone input, with a 44.1KHz sample rate, 1028 buffer length, and 512 hop size. When an onset is detected in a 512 sample buffer called &lt;code&gt;in&lt;/code&gt;, for example, I send &lt;code&gt;in&lt;/code&gt; to the MFCC extraction function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the callback that is called when there's a buffer full of audio ready to be processed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int record( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,&#xA;         double streamTime, RtAudioStreamStatus status, void *userData )&#xA;{&#xA;   if (status)&#xA;      std::cout &amp;lt;&amp;lt; &quot;Stream overflow detected!&quot; &amp;lt;&amp;lt; std::endl;&#xA;&#xA;   // Do something with the data in the &quot;inputBuffer&quot; buffer.&#xA;   smpl_t * input = (smpl_t *) inputBuffer;&#xA;&#xA;   InputData * data = (InputData *) userData;&#xA;&#xA;   //only hop_size length samples allowed in in-&amp;gt;data; must loop to fill bit by bit.&#xA;   while (data-&amp;gt;offset &amp;lt; 1024) &#xA;   {&#xA;      std::copy(input + data-&amp;gt;offset, input + data-&amp;gt;offset + 511, in-&amp;gt;data);&#xA;&#xA;      aubio_onset_do(o,in,out);       &#xA;&#xA;      //do something with the onsets  &#xA;&#xA;      if (out-&amp;gt;data[0] != 0) &#xA;      { &#xA;         fprintf(stderr, &quot;ONSET DETECTED! \n&quot;);&#xA;&#xA;         //compute mag spectrum (pv- phase vocoder obj; in- takes hop_size input; fftgrain- spectrum output.&#xA;         aubio_pvoc_do (pv, in, fftgrain); &#xA;&#xA;         //compute mfccs (mfcc-mfcc object, mfcc_out- 13 MFCC coefficients)&#xA;         aubio_mfcc_do(mfcc, fftgrain, mfcc_out);&#xA;&#xA;         fvec_print(mfcc_out);&#xA;&#xA;&#xA;    } &#xA;    data-&amp;gt;offset += 512;            &#xA;    }&#xA;&#xA;    data-&amp;gt;offset = 0;&#xA;    if (streamTime &amp;gt; 4) &#xA;       return 1; //abort the stream at 4 seconds&#xA;&#xA;    return 0; //continue normal stream operation&#xA;}   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14997" LastEditorUserId="14997" LastEditDate="2015-03-12T02:34:45.493" LastActivityDate="2015-03-12T02:34:45.493" Title="MFCC help: Same sound, different coefficients?" Tags="|fft|audio|mfcc|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21966" PostTypeId="2" ParentId="21959" CreationDate="2015-03-11T00:08:40.217" Score="2" Body="&lt;p&gt;Have a look at the &lt;code&gt;scilab&lt;/code&gt; code &lt;a href=&quot;https://dsp.stackexchange.com/questions/21957/directivity-pattern-of-microphone-array&quot;&gt;where I answered your other question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That question is about a discrete aperture, but it is analogous to the question you are asking here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For that question, the beam pattern is just given by:&#xA;$$&#xA;D(\theta) = \sum_{n=0}^{N-1} w_n \exp\left(j\frac{2\pi n d}{\lambda} \sin(\theta) \right).&#xA;$$&#xA;With judicious choice of parameters, you can see how this looks somewhat like the discrete Fourier transform of the weights $w_n$ which are analogous to $A_R$ in the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To obtain the formulae from the paper, you need to think of the continuous aperture rather than discrete sensors. &lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-03-11T00:08:40.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21967" PostTypeId="2" ParentId="21964" CreationDate="2015-03-11T00:19:58.877" Score="5" Body="&lt;p&gt;When upsampling, you don't really stretch the signal in time. You insert new samples between the existing ones, without modifying the times at which those samples were taken. One property of upsampling is that the waveform remains exactly the same before and after the process; you just increase the number of samples. Note that the main difference between oversampling and upsampling is that the former occurs at the time of sampling, and the latter occurs after sampling has already been done. If there is no aliasing, in theory both produce the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aliasing is only present when there is a signal at the input of your sampler whose frequency is higher than the Nyquist frequency. In your example, if you sample a 70 Hz signal at 280 samples per second, you will not have aliasing. However, in practice you will not always have precise knowledge or control over the signal you're sampling. For example, you may want to sample a signal coming from an antenna. You don't know in advance what signals are going to be picked up by the antenna. In a case like this, one approach is to low-pass filter the signal before sampling, to ensure no aliasing will happen.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-11T00:19:58.877" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21969" PostTypeId="2" ParentId="21959" CreationDate="2015-03-11T02:20:10.330" Score="3" Body="&lt;p&gt;In your second link, the time and space dependence of a simple plane wave is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ψ ( x , t ) = A sin ( ω t ± k x ) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as a Fourier transform of the equation above can be taken from the time domain $t$ to the frequency domain $\omega$, so also can a Fourier transform be taken from the spatial $x$ domain to the wave vector $k$ domain. For the very simple one dimensional plane wave the wave vector reduces to the wavenumber  $k= \frac{2\pi}{\lambda}$ in that first equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general both the position and wave vector are vector quantities and the dependence of a wave on both is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e^{j\vec k\cdot\vec r}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aperture of a microphone array depends on the position of the microphones (a positional quantity), and so the Fourier transform depends on wave vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Section 1.3.2 of your first link, they are doing exactly that - taking the Fourier transform of the aperture from position to wave vector space, which yields the pattern of the beam in terms of the wave vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example given in the other answer by @Peter K, think of a plane wave propagating away from the microphone array at an angle $\theta$ .The term inside the exponential, is the dot product of the wave vector and the spacing of the microphone array.&lt;/p&gt;&#xA;" OwnerUserId="10282" LastEditorUserId="10282" LastEditDate="2015-03-11T02:25:22.960" LastActivityDate="2015-03-11T02:25:22.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21970" PostTypeId="2" ParentId="21963" CreationDate="2015-03-11T06:08:33.660" Score="1" Body="&lt;p&gt;Zero-padding can be used to more accurately estimate the frequency of a single sinusoid in zero noise.  Since a zero-padded FFT produces a smoother looking plot, and thus shallower peaks, if there are any subtle changes in the inflections and thus peak location caused by noise, those shifts will be magnified by the zero-padded FFT, perhaps from a fraction of a FFT result bin to several bins of random shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, one needs to have a good estimate of the S/N ratio to know whether and how much zero-padded will produce a usefully more accurate frequency peak estimate of a sinusoidal (or narrow band) signal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-03-11T16:26:59.910" LastActivityDate="2015-03-11T16:26:59.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21972" PostTypeId="1" CreationDate="2015-03-11T07:25:02.507" Score="1" ViewCount="62" Body="&lt;p&gt;Some poeple claim their background subtraction algorithms use Gaussian Mixture Model, &#xA;but when I read the code, I find they actually use only one component, &#xA;and as a result EM algorithm (or its approximated version) is not taken to fit the model. &#xA;An example can be found &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/276355&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. &#xA;This configuration is commonly adopted when the background is strictly static, &#xA;e.g. the scenes without swaying tree branches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, their methods use some simple criterion: &#xA;a pixel is classified as foreground if it satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{c \in C} w_c\frac{|I_c(x,y)-\mu_c(x,y)|}{\sigma_c(x,y)} &amp;gt; \text{Threshold}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $C$ is the set of channels (RGB, HSV, etc.) and $w_c$ is the weight of channel $c$. &#xA;Technically there is no &lt;strong&gt;mixture&lt;/strong&gt; distribution any more. &#xA;Do you think it's still appropriate to call this model GMM? &lt;/p&gt;&#xA;" OwnerUserId="15009" LastActivityDate="2015-03-11T07:25:02.507" Title="Is it correct to call this Gaussian Mixture Model?" Tags="|video-processing|background-subtraction|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21974" PostTypeId="1" CreationDate="2015-03-11T10:05:41.220" Score="4" ViewCount="333" Body="&lt;p&gt;I'm using a good fast FFT implementation (vDSP) that will only work on power of 2 blocks of audio data.  Now I have a problem where I would like to be able to apply the calculations to non powers of 2 audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some degree of reading around suggests that I can do this by breaking the DFT into smaller power of 2 blocks.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain how to do this, if indeed it is possible at all? I have been unable to find any explanations of how to do it ...&lt;/p&gt;&#xA;" OwnerUserId="333" LastActivityDate="2023-03-27T12:05:10.970" Title="Decomposing a DFT into multiple FFT calls" Tags="|fft|dft|optimization|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="21975" PostTypeId="1" CreationDate="2015-03-11T10:08:08.057" Score="0" ViewCount="96" Body="&lt;p&gt;[Sorry for the noobish question...]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal which is known to be generated by a process operating at some known rate $f$ Hz and the sampling rate is also know to be $K$ Hz. Now I do a periodogram of the signal and its first peak (aka fundamental frequency, right?) closely corresponds to $f$  - so I'm quite happy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now I want to estimate the amplitude and phase using a standard algorithm which I am taking from &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/013280803X&quot; rel=&quot;nofollow&quot;&gt;this good book&lt;/a&gt; (Algorithm 9.2). The snag is that there the frequency $f_{0}$ is supposed to satisfy $0 &amp;lt; f_{0} &amp;lt;\frac{1}{2}$ and I am at a loss as to how to convert my $f$ to Kay's $f_{0}$. I tried to take $f_{0}=\frac{f}{K}$ but got gibberish results.&lt;/p&gt;&#xA;" OwnerUserId="13444" LastActivityDate="2015-03-11T10:08:08.057" Title="How to scale fundamental frequency to [0,1]?" Tags="|frequency|amplitude|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21976" PostTypeId="1" CreationDate="2015-03-11T10:14:18.743" Score="4" ViewCount="70815" Body="&lt;p&gt;I have a transfer function $$H(z)=\frac{1+1.2z^{-1}+0.8z^{z^-2}}{1-0.9z^{-1}}$$ from which I'm supposed to sketch the magnitude and phase response. I know that you can transform $z=e^{j\omega}$ to get the frequency response, but I don't really understand what it means. The magnitude response is then $$\left|H(e^{j\omega})\right|=\left|\frac{1+1.2e^{-j\omega}+0.8e^{-j2\omega}}{1-0.9e^{-j\omega}}\right|,$$ but how do I calculate the values from here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if we set $\omega=0$, then the result is $30$. But if we set $\omega=\pi/4$, then the result is $$\left|\frac{1+1.2e^{-j\pi/4}+0.8e^{-j\pi/2}}{1-0.9e^{-j\pi/4}}\right|.$$ How does one solve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also know that the formula for phase response is $$\arg(H(e^{j\omega}))=\frac{\Im(H(e^{j\omega}))}{\Re(H(e^{j\omega}))}$$ but I'm having a hard time to understand how to use it and what phase response actually is. Can you give me an example of how to calculate the phase response of a certain angle?&lt;/p&gt;&#xA;" OwnerUserId="15013" LastEditorUserId="4346" LastEditDate="2015-04-10T20:56:23.233" LastActivityDate="2017-12-07T16:28:08.760" Title="How to compute magnitude and phase response from transfer function in Z-domain?" Tags="|phase|infinite-impulse-response|transfer-function|z-transform|magnitude|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21978" PostTypeId="1" AcceptedAnswerId="22004" CreationDate="2015-03-11T10:51:06.173" Score="1" ViewCount="4393" Body="&lt;p&gt;I'm working on a sampler software (that plays .WAV files, when notes are played on a MIDI keyboard).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to implement &lt;strong&gt;pitch-bend&lt;/strong&gt; feature (i.e. you have a &quot;pitch bend wheel&quot; on the synth and you can turn this wheel to retune the sound in realtime, classical effect used in funk music),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2BIOB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we have to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Retune&lt;/strong&gt;: this is possible by resampling the array of the .WAV.&#xA;With Python, there is &lt;code&gt;scipy.signal.resample&lt;/code&gt; or probably the same in &lt;code&gt;numpy&lt;/code&gt;. &#xA;But I heard there are algorithms optimized for audio repitching. &lt;strong&gt;What are the audio-optimized resampling algorithms&lt;/strong&gt;?&#xA;[Secret Rabbit Code : &lt;a href=&quot;http://www.mega-nerd.com/SRC/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mega-nerd.com/SRC/&lt;/a&gt;. Why is this important? How to implement it in Python, with &lt;code&gt;numpy&lt;/code&gt; for example?]&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Retune in &lt;em&gt;realtime&lt;/em&gt;&lt;/strong&gt;: indeed, we can play with the pitchbend-wheel very fast, thus, hundreds of resampling factor could be needed per second! How to do that?&#xA;&lt;strong&gt;How to resample an array with different resampling factors, in realtime?&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2015-03-12T10:34:43.880" Title="Resample an array in real-time (application: pitch-bend)" Tags="|discrete-signals|audio|pitch|real-time|resampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21979" PostTypeId="2" ParentId="21976" CreationDate="2015-03-11T11:10:09.347" Score="1" Body="&lt;p&gt;I think the idea here is to get a global picture of how the magnitude and the phase of $H(e^{j\omega})$ behave. This is most easily seen by computing the poles and zeros of $H(z)$. The zeros of $H(z)$ are the zeros of the numerator. In your case you'll find two complex conjugate zeros. And there is one real-valued pole corresponding to the zero of the denominator of $H(z)$. Then you could (as you already did) find $H(1)$, i.e. the DC value. Also compute the frequency corresponding to the zero (because there, $H(e^{j\omega})$ will have a dip, the depth of which depends on how close the zeros are to the unit circle, and you might want to evaluate $H(-1)$, i.e. the value at Nyquist. From these few value you can get a reasonable estimate as to how the magnitude of $H(e^{j\omega})$ behaves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the phase, note that your formula (ratio of imaginary and real parts) is actually the &lt;em&gt;tangent&lt;/em&gt; of the phase, not the phase itself. First of all, it is clear that the phase must be zero at DC (i.e. $z=1$), and at Nyquist (i.e. $z=-1$). Furthermore, the total phase response equals the phase of the numerator minus the phase of the denominator. So if you figure out the phase response of a single zero (for a single pole you get the same with a negative sign), you can compose the total phase simply the summing these partial phases for each pole and zero. Qualitatively, for each pole you get a decreasing contribution to the phase (with maximum decrease at the pole frequency), and for each zero you get an increasing contribution to the phase (with the maximum increase at the frequency of the zero).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-11T11:27:09.897" LastActivityDate="2015-03-11T11:27:09.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21980" PostTypeId="2" ParentId="21942" CreationDate="2015-03-11T11:12:53.747" Score="1" Body="&lt;p&gt;If you already have the pairs of corresponding two points from each coordinate,&#xA;you can use the function &lt;a href=&quot;http://uk.mathworks.com/help/images/ref/fitgeotrans.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;fitgeotrans&lt;/strong&gt;&lt;/a&gt;&#xA; to calculate the transformation matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have got the transformation matrix, the transformation can be done with &lt;a href=&quot;http://uk.mathworks.com/help/images/ref/imwarp.html?searchHighlight=imwarp&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;imwarp&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you are going to use &lt;strong&gt;Homography transformation&lt;/strong&gt; rather than affine transformation in this case (because you have specified corresponding 4 points, which may cause trapezoidal distortion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code would be like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% assume that the input image is in the variable inputImage.&#xA;nPixelsX = 50; % assume that there is square image with 50 pixels for each axes after transformation.&#xA;nPixelsY = 50;&#xA;&#xA;movingPoints = [73,86; ...&#xA;                117,88; ...&#xA;                70,127; ...&#xA;                115,128]; % set image's corresponding points&#xA;fixedPoint = [0,0; ...&#xA;              nPixelsY,0; ...&#xA;              0,nPixelsX; ...&#xA;              nPixelsY,nPixelsX]; % set ideal coordinate's corresponding points&#xA;transformationType = 'Projective';  % this should be homology transformation&#xA;tform = fitgeotrans(movingPoints,fixedPoints,transformationType); % make transformation matrix&#xA;&#xA;resultReference = imref2d([nPixelsY, nPixelsX]);&#xA;desiredImage = imwarp(inputImage, tform, 'OutputView', resultReference); % transform&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14917" LastActivityDate="2015-03-11T11:12:53.747" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21981" PostTypeId="2" ParentId="20428" CreationDate="2015-03-11T12:09:15.507" Score="1" Body="&lt;p&gt;Windowing has nothing much to do with your filter design/response spec's, however, it has impact on your transition bandwidth that also depends on the window length.Your filters frequency response is mainly dependent on design parameters such as sampling rate, maximum frequency, transition bandwidth, cut-off frequency and impulse response length or kernel length.Now coming to windowing, these are some techniques basically used for obtaining smoother and ripple free impulse response h[n], so before your multiply your impulse response to the input/incoming samples, you must window your impulse response. For e.g. If you have a sinc impulse response, Ideally we know that its amplitudes run infinite on both negative and positive ends, hence in practice we just taper or cut off the ends of the sinc impulse in order to make it a finite length, therefore, this causes ripples in the impulse response due to the &lt;em&gt;Gibbs Phenomenon&lt;/em&gt; (for more info on Gibbs Phenomenon, check online), So to eliminate these ripples and get a smoother impulse response, we use these windowing techniques.And each windows vary, for e.g. Blackman windows have better stopband attenuation than hamming window. Between why have you specified two stopband and passband frequencies?. Anyways,hope this gives you some insight to windowing!    &lt;/p&gt;&#xA;" OwnerUserId="9152" LastActivityDate="2015-03-11T12:09:15.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21983" PostTypeId="2" ParentId="21978" CreationDate="2015-03-11T18:07:22.273" Score="1" Body="&lt;p&gt;Audio-optimized resampling is done by using anti-alias filtering and interpolation kernels with good stop-band attenuation and low pass-band ripple/distortion.  On current PC and mobile processors (the kind that can easily compute hundreds of transcendental functions per sample time), these filter and interpolation kernels can not only be precomputed and cached in poly-phase lookup tables, but for certain window types, (re)computed in real-time per sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, resampling can be done in real-time by computing the needed interpolation kernels and interpolating each sample as needed at the required sample delay from the last for the current sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that changing the sample rate too quickly may result in FM modulation skirts that may need additional filtering to reduce aliasing artifacts.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-11T18:07:22.273" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="21984" PostTypeId="1" AcceptedAnswerId="21988" CreationDate="2015-03-11T18:20:46.063" Score="2" ViewCount="700" Body="&lt;p&gt;I have an audio file, of which I calculate 16 (actually 15 because I omit the first one) MFCCs in R. When I stream this file via VLC-Player and Icecast2-Server, receive it in Java (with the Player of Javazoom-Lib) and then pass it on to R again for MFCC calculation I get completely different values? Has anyone an idea why this could be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional info:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When I write the received data to a file again and view it next to the original file they look almost the same (Waveform + Spectrogram).&lt;/li&gt;&#xA;&lt;li&gt;The file has a length of 3 seconds and contains the sound of a passing vehicle (car).&lt;/li&gt;&#xA;&lt;li&gt;MFCCs are calculated for centered 44100 samples.&lt;/li&gt;&#xA;&lt;li&gt;I need valid data in order to automatically classify cars and trucks with a SVM.&#xA;This classifier is trained with features calculated from 150 audio files (each &#xA;containing one vehicle).&lt;/li&gt;&#xA;&lt;li&gt;Since R had problems with reading and processing mp3-files directly I first converted wav to mp3 and back again (in order to &quot;simulate&quot; the loss of information due to compression).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n0vuK.png&quot; alt=&quot;MFCC values&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, I automatically detect the vehicles in a continuous audio stream and therefore (for the particular example data above) the waveforms for calculating the MFCCs have an offset of about 4400 Samples. Does this matter with an analysis window of 44100 samples?&lt;/p&gt;&#xA;" OwnerUserId="15020" LastEditorUserId="7092" LastEditDate="2015-03-11T18:48:19.247" LastActivityDate="2015-03-11T22:41:59.690" Title="Why are MFCCs of two equivalent signals completely different?" Tags="|discrete-signals|audio|signal-analysis|mfcc|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="21985" PostTypeId="1" CreationDate="2015-03-11T18:38:21.497" Score="1" ViewCount="268" Body="&lt;p&gt;I am trying to test the sub-pixel accuracy of an optical flow method and need to generate some synthetic data to do so. I start with an image $I_0$, which is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Perlin_noise&quot; rel=&quot;nofollow&quot;&gt;Perlin noise image&lt;/a&gt; and a set of sub-pixel ground truth flow fields to apply, e.g. rotation around the image centre. I want to produce the most faithful image, ${I_1}$, that agrees with this sub-pixel flow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Method 1.&lt;/strong&gt;&#xA;The dumb approach is to just apply the flow directly to the image, and interpolate a new image from the old using one of the many interpolation techniques. But the interpolation is almost certain to introduce noise, the nature of which I guess depends on the statistics of the image and the interpolation function chosen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Method 2.&lt;/strong&gt;&#xA;A better approach (I think), is to start with a much larger image $J_0$, which is the parent of $I_0$ in that downsampling $J_0$ results in $I_0$. Then apply the flow to the large image and downsample that to get to $I_1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the downsampling process itself requires an assumption about which kernel to use. Also, this gets tricky if $I_1$ needs to be large (say $1000 \times 1000$), since $J_0$ will need to be even larger (e.g. $20000 \times 20000$) and becomes difficult to store in memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Method 3.&lt;/strong&gt; Another possibility is to model the image as some known continuous function, apply a flow function analytically to the image function, then produce the warped image by sampling from that new function with an assumed point spread function to produce the warped image. But I've no idea if that's possible or what kind of functions would work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would anyone be able to provide any suggestions? Would Method 3 work? Is there another, better alternative?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance!&lt;/p&gt;&#xA;" OwnerUserId="15019" LastEditorUserId="7092" LastEditDate="2015-03-11T18:46:50.293" LastActivityDate="2015-03-11T18:46:50.293" Title="Image warping with subpixel accuracy" Tags="|image-processing|sampling|downsampling|optical-flow|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21986" PostTypeId="2" ParentId="19081" CreationDate="2015-03-11T20:35:14.873" Score="1" Body="&lt;p&gt;Have you seen this &lt;a href=&quot;http://musicdsp.org/archive.php?classid=4#78&quot; rel=&quot;nofollow&quot;&gt;MusicDSP Phaser code&lt;/a&gt; and discussion by Ross Bencina? It is commented, and says that its implemented to be &quot;clear, not efficient&quot;. Cheers.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-03-11T20:35:14.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21987" PostTypeId="2" ParentId="21961" CreationDate="2015-03-11T21:12:00.853" Score="2" Body="&lt;p&gt;Have a look @ &lt;a href=&quot;https://github.com/bmcfee/librosa/&quot; rel=&quot;nofollow noreferrer&quot;&gt;librosa&lt;/a&gt;, a simple python library for audio analysis, implementing common features.  Here is a &lt;a href=&quot;https://github.com/librosa/librosa/blob/main/examples/LibROSA%20demo.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;great introduction and example notebook&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="11372" LastEditDate="2020-11-26T03:57:47.983" LastActivityDate="2020-11-26T03:57:47.983" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="21988" PostTypeId="2" ParentId="21984" CreationDate="2015-03-11T21:22:58.547" Score="3" Body="&lt;p&gt;You say: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I stream this file via VLC-Player and Icecast2-Server, receive it in Java (with the Player of Javazoom-Lib) &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When you receive the stream in Java, what is the &lt;strong&gt;&lt;em&gt;stream format&lt;/em&gt;&lt;/strong&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say that it is the &quot;&lt;em&gt;same&lt;/em&gt;&quot; because the waveform and/or spectrogram look similar, but the MFCCs will come out different if the stream format (sample rate, bit depth, etc) are different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you confirm by printing out the stream formats &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Before sending to Java&lt;/li&gt;&#xA;&lt;li&gt;Upon receiving from Java?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I recommend using &lt;a href=&quot;http://sox.sourceforge.net/soxi.html&quot; rel=&quot;nofollow&quot;&gt;Soxi&lt;/a&gt; to print out the stream format (if you cannot otherwise dump it from R, or Java) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can eliminate stream format issues, mp3&amp;lt;-&gt;wav issues (deal only in wav), if you analysis windows are identical (as jojek says), then your MFCCs should come out identical. &lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="11372" LastEditDate="2015-03-11T22:41:59.690" LastActivityDate="2015-03-11T22:41:59.690" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="21989" PostTypeId="2" ParentId="21935" CreationDate="2015-03-11T22:40:38.973" Score="1" Body="&lt;p&gt;I can't help with the fisheye lens issue, but assuming that effect isn't too large, the mapping between the above images is a &lt;em&gt;perspective transformation&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can transform a point on the plane $z=1$ into 3D space using a $3\times 3$ matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left( \begin{array}{c} X\\ Y\\  Z\\ \end{array} \right) =&#xA;\left( \begin{array}{c} s_x\ \ h_x\ \ t_x \\ &#xA;                         h_y\ \ s_y\ \ t_y \\&#xA;                         p_x\ \ p_y\ \   1 \\ \end{array} \right)&#xA;\left( \begin{array}{c} x\\ y\\  1\\ \end{array} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$s$ is scaling&lt;/li&gt;&#xA;&lt;li&gt;$h$ is shearing&lt;/li&gt;&#xA;&lt;li&gt;$t$ is translation&lt;/li&gt;&#xA;&lt;li&gt;$p$ is perspective tilting (positive number means positive side tilts away)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We can project this object in 3D space back onto the plane $z=1$ simply by dividing the coordinates by $Z$. This maps every point in space to the intersection of the plane $z=1$ and the line connecting the point and the origin. This is basically the process of taking a photograph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_{proj} = X/Z$$&#xA;$$Y_{proj} = Y/Z$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we want to do is find the reverse transformation that takes us from the projected coordinates back to the original coordinates where the points only existed in the plane $z=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that we can solve for all of the transformation parameters using 4 points (the four corners of a rectangle, for example) and solving the following system of equations (see &lt;a href=&quot;http://xenia.media.mit.edu/~cwren/interpolator/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for the derivation and some example MATLAB code).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8RVNI.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Making certain assumptions like the object not changing size or shape ($s_x=s_y=1$, $h_x=h_y=0$) can simplify these equations.&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="13517" LastEditDate="2015-03-12T15:15:07.513" LastActivityDate="2015-03-12T15:15:07.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="21991" PostTypeId="1" CreationDate="2015-03-11T23:26:32.147" Score="0" ViewCount="1294" Body="&lt;p&gt;Suppose we have a signal like that and we want to know when a burst have happened. Rigth now our approach is pretty straightforward. We measure std of signal at some time window and then with each new signal bin we measure it's difference with respect to previous and if it's much more than std, then we have found our burst. But maybe this is known problem and there is a library for that, or the way to do it more efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O7id1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dLCZM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;signal time plot&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7936" LastEditorUserId="1849" LastEditDate="2015-03-12T08:25:06.740" LastActivityDate="2015-03-12T13:48:09.673" Title="Is there a algorithm for detecting bursts in signal?" Tags="|discrete-signals|algorithms|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="21992" PostTypeId="2" ParentId="21991" CreationDate="2015-03-11T23:57:35.450" Score="0" Body="&lt;p&gt;based on your &quot;signal time plot&quot; Isn't it easier (and more efficient) to just say&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (A(t) &amp;gt; threshold)&#xA;    burst_detected=true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;threshold&lt;/code&gt; is the horizontal line in your plot&lt;/p&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2015-03-11T23:57:35.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21993" PostTypeId="2" ParentId="21991" CreationDate="2015-03-12T00:19:57.610" Score="0" Body="&lt;p&gt;a burst of &lt;em&gt;what&lt;/em&gt;??  a burst of power/energy?  a burst of data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because, if it was the former, it's like &lt;a href=&quot;https://en.wikipedia.org/wiki/Continuous_wave&quot; rel=&quot;nofollow&quot;&gt;ham-radio CW&lt;/a&gt;.  if the latter, might be a template or pattern matching thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;perhaps, if you have a good replica of a &lt;em&gt;&quot;burst&quot;&lt;/em&gt;, whatever the heck it is, you can use it as template to cross-correlate against, which is the same as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;matched filter&lt;/a&gt;.  maybe that's the ticket.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-12T00:19:57.610" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="21997" PostTypeId="2" ParentId="21974" CreationDate="2015-03-12T02:23:46.260" Score="0" Body="&lt;p&gt;By padding, you are losing some of the information in certain bins. You may also get some measurement errors. Why not optimizing your calculation to support a power of 2 FFT? Play with the sampling rate or the length of data acquisition. &lt;/p&gt;&#xA;" OwnerUserId="14988" LastEditorUserId="4298" LastEditDate="2015-03-12T08:02:09.217" LastActivityDate="2015-03-12T08:02:09.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21998" PostTypeId="1" CreationDate="2015-03-12T03:18:47.767" Score="2" ViewCount="153" Body="&lt;p&gt;The OFDM baseband signal can be demodulated since  each subcarrier is orthogonal to another. But In SFN system, i.e., Single Frequency Network, all OFDM signals from several transmitters are in the same frequency domain, which breaks the orthogonality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So without some technology like CDMA, the OFDM sigals from each transmitter must be time-divided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that right?&lt;/p&gt;&#xA;" OwnerUserId="15025" LastEditorUserId="15025" LastEditDate="2015-03-16T00:58:42.900" LastActivityDate="2016-12-30T22:27:37.797" Title="Must OFDM signal be time-division in a multiple-transmitter and SFN system when the signal is free of spread-spectrum?" Tags="|signal-analysis|digital-communications|modulation|demodulation|ofdm|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="21999" PostTypeId="2" ParentId="21974" CreationDate="2015-03-12T06:01:47.053" Score="4" Body="&lt;p&gt;The simplest thing to do if you have access to only a power-of-two FFT is to zero-pad your data going into the $N=2^p$ FFT and interpolate what comes out.  i think that's what MATLAB does for &lt;code&gt;fft()&lt;/code&gt; for non-power-of-two DFT.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-12T06:01:47.053" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22000" PostTypeId="2" ParentId="19756" CreationDate="2015-03-12T06:54:20.037" Score="1" Body="&lt;p&gt;user Fat32 had an answer that he/she deleted that was fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when comparing two different signals that mean two different things (but equally important or with an equal significance regarding the information the signals carry), would you expect to be comparing two signals, one with values in the ballpark of $\pm$1 and the other with no samples with magnitude at least $2^{-8}$ or so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalization means that you're not comparing an elephant to a bug.  at least not with regard to mass. unless you make the bug look as big as the elephant, and then you start comparing what makes the bug different than the elephant.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-12T06:54:20.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22002" PostTypeId="1" AcceptedAnswerId="22100" CreationDate="2015-03-12T09:15:49.683" Score="2" ViewCount="232" Body="&lt;p&gt;I am about to do a lot of a recordings when performing tests. The thing is that there are some parts I would like to extract easily from my recording. Is there a way to play some special sequence of sounds, for example few beeps, and then search the whole recording for those markers? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end I want to obtain file with labeled segments similarly to what Audacity is doing. Until now I was using hand claps and searching for energy spikes in the long recorded signal. Since I am performing measurements of room with starter pistol this is not a good idea. Later this will allow me for very quick and easy analysis to search for groups of similar sounds. For example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;start  time, end time, location&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;100, 399, loc1&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;500, 600, loc2&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tried calculating correlation with some pattern, but when room is reverberant it is not performing very good. I get some false markers from threshold correlation. It is because marker is smeared and not exact. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best method and type of a signal for that task? Any good and fast techniques such as matched filtering?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Addendum:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;saying simple what i want:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;play the marker sound/pattern at random times&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;record this signal and other signals&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;search for these recorded patterns in very long recording &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;being able to say at which point in time those patterns are&#xA;for example cross correlation (isn't working well) could give spikes i can search for&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;it should be idiot-proof against noise, tonal/impulsive sounds, reverberation and low playback level&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;it should not be very slow. for example at 10 minutes file 40 seconds is my upper limit&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="13742" LastEditDate="2016-03-16T08:47:22.570" LastActivityDate="2016-03-16T08:47:22.570" Title="Recognition of markes in long audio recording" Tags="|discrete-signals|audio|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22003" PostTypeId="1" CreationDate="2015-03-12T10:03:08.850" Score="2" ViewCount="2356" Body="&lt;p&gt;I have a noisy signal in I/Q format with a peak frequency that constantly changes between 0.5Hz and 4Hz. The sample rate is 64Hz. I want an output showing the current peak frequency with a maximum lag of about 1 second. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my first attempt to solve this problem with FFT, and the question is: What is required to make the frequency estimate accuracy around 0.01 Hz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to use the FFT to both do the filtering of unwanted higher frequency noise &lt;em&gt;and&lt;/em&gt; do the estimation of the 0.5-4Hz signal peak frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With one second, we have 64 complex samples go into the FFT and 64 complex magnitudes coming out. They will then represent frequencies from -32Hz to +31Hz. We look at the 6 bins representing 0Hz to 6Hz and want to interpolate here to find the peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm must run on a low power CPU, so computational power is quite limited and power consumption is an important parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm looks like this in Scilab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sample_rate = 64;&#xA;secs = 1;&#xA;nr = sample_rate * secs;&#xA;&#xA;f_signal = 0.45; // Hz - The signals peak frequency&#xA;&#xA;// Construct the ideal complex signal vector &#xA;BT = complex( cos(f_signal*2*%pi*((1:nr)-1)/nr) , sin(f_signal*2*%pi*((1:nr)-1)/nr) );&#xA;&#xA;// Remove any DC offset (or not?)   &#xA;// BTavg = sum(BT) / nr;&#xA;// BT = BT - BTavg;&#xA;&#xA;// Make a time domain plot&#xA;figure(1);&#xA;clf();&#xA;plot(real(BT), 'red');     &#xA;plot(imag(BT), 'blue'); &#xA;&#xA;// Perform FFT (and shift bins around to have -32Hz to +31Hz)&#xA;BF = fftshift(fft(BT));&#xA;&#xA;// Create the associated frequency vector f(1) = frequency of bin 1    &#xA;f = sample_rate * (-(nr)/2:(nr-2)/2)/nr;&#xA;&#xA;// Make a frequency domain plot&#xA;figure(2);&#xA;clf();&#xA;plot(f(1:nr), abs(BF(1:nr)), 'blue')&#xA;&#xA;// Find max peak in the first 6 bins        &#xA;pmax = 0;&#xA;imax = 0;&#xA;for i=(33:38)&#xA;    p = abs(BF(i));&#xA;    printf(&quot;i = %d f = %f p = %f \n&quot;, i, f(i), p);&#xA;    if p &amp;gt; pmax then&#xA;        pmax = p;&#xA;        imax = i;&#xA;    end&#xA;end&#xA;&#xA;// Interpolate to find better estimate of peak frequency&#xA;y1 = abs(BF(imax-1));&#xA;y2 = abs(BF(imax));&#xA;y3 = abs(BF(imax+1));&#xA;// d = (y3 - y1) / (2 * (2 * y2 - y1 - y3)); // Quadradic method&#xA;d = (y3 - y1) / (y1 + y2 + y3); // Barycentric method&#xA;fmax = f(imax) + d * (f(imax+1) - f(imax));&#xA;&#xA;printf(&quot;Estimated = %.2f Hz Actual = %.2f Hz Error = %.2f Hz\n&quot;, fmax, f_signal, abs(fmax-f_signal));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The input plot looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t3Xom.png&quot; alt=&quot;Input to the FFT&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output from the FFT (shifted) looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/en67W.png&quot; alt=&quot;Output from FFT&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The console output showing the power from the 6 bins as well as the final estimated frequency and error is here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  i = 33 f = 0.000000 p = 44.717018 &#xA;  i = 34 f = 1.000000 p = 36.588120 &#xA;  i = 35 f = 2.000000 p = 12.993838 &#xA;  i = 36 f = 3.000000 p = 7.911240 &#xA;  i = 37 f = 4.000000 p = 5.696681 &#xA;  i = 38 f = 5.000000 p = 4.459184 &#xA;  Estimated = 0.24 Hz Actual = 0.45 Hz Error = 0.21 Hz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As can be seen the error is way bigger than desired for this specific test frequency of 0.45 Hz. By changing the frequency it's clear that the error near zero only for near integer frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A caveat is that the input signal also has a varying DC offset, so ideally the DC offset should be &quot;filtered&quot; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure there are ways of saving power by only calculating the 6 bins we are interested in, but that optimization only makes sense if we can get the required accuracy from the algorithm in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So again: What is required to make the error on the estimates more like 0.01 Hz?&lt;/p&gt;&#xA;" OwnerUserId="6926" LastEditorUserId="6926" LastEditDate="2015-03-12T10:32:04.910" LastActivityDate="2015-03-17T01:22:18.110" Title="FFT bin interpolation for low frequency with DC offset" Tags="|fft|frequency|estimation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22004" PostTypeId="2" ParentId="21978" CreationDate="2015-03-12T10:34:43.880" Score="1" Body="&lt;p&gt;There's a lot of theory around about how to resample properly and efficiently while preserving the signal content. However, these methods are mostly not practical for things like pitch bending. Also, the fact that pitch bends (and other realtime rate changing requirements, like note transposition) are limited to -12 to +12 semitones, i.e. a resampling factor of 1/2 or 2, makes it easier to design an efficient algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Historically, audio samplers have been using linear interpolation for on-the-fly resampling and pitch bending. From today's perspective this almost the worst thing you can do (nearest neighbour tops it), but it got the job done. Sound quality was ok, but in times of 12 bits and 16kHz sampling rate, who would complain. (There have also been samplers that had the ability to change the DAC conversion rate by giving each voice an individual output, but that only as a historical side note)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Later models would use higher order polynomial or windowed sinc interpolation together with a mip-map, and the results became good enough for even modern requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would suggest you try in this order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Linear interpolation. Just calculate the sample value at the desired time index from its two nearest neighbours by linear interpolation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Use offline processing to oversample your sample table with a factor of 2, doubling the memory requirements obviously. Use the same linear interpolation on those oversampled samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Also double the audio sampling rate of the resampler process, using a halfband lowpass filter and a decimation stage at the very end to go back to the audio playback rate &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Like before, but instead of linear interpolation use a short windowed sinc interpolator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each step improves the sound quality but also requires more resources. My guess is that you will find it hard to hear a difference between 3) and 4) if you implement them correctly. Go with 3) if it's good enough, and I think it should be.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-03-12T10:34:43.880" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22005" PostTypeId="2" ParentId="22003" CreationDate="2015-03-12T11:10:37.027" Score="3" Body="&lt;p&gt;FFTs don't work well for sinusoidal frequency estimation if there is a nearby strong interfering signal.  Normally one needs at least 2 FFT result bins of separation to just start to resolve 2 frequency peaks.  For frequencies around or lower than FFT result bin +-2, any significant  DC offset will constitute that strong nearby interference (in bin 0) preventing resolving either frequency as an independent peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that, if the S/N ratio is low enough, a parametric estimator will produce a more accurate estimation, given that you have more samples than unknowns (3 sinusoidal parameters + 1 DC offset parameter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possibility is to try to remove the DC offset by averaging or low pass filtering over a much longer window of samples, perhaps several hundred to thousands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added:&#xA;Strictly real valued sinusoids very near DC (or Fs/2) will also see interference from their own conjugate images in the spectrum.  Any input gain imbalance in the 2 quadrature components for a complex sinusoidal signal will contain some of that same conjugate interference as well.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-03-12T13:45:28.153" LastActivityDate="2015-03-12T13:45:28.153" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22006" PostTypeId="2" ParentId="22003" CreationDate="2015-03-12T11:27:53.987" Score="0" Body="&lt;p&gt;If your signal is quite similar to sinus with noise, then I think you can estimate frequency by using fitting or regression methods. Search Internet with keywords: &quot;fit&quot;, &quot;regression&quot;, &quot;least square&quot; and &quot;sine&quot;. You can find a lot of program code, tools and so on. For example (I do not try it) - &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/41246-sine-function-fit&quot; rel=&quot;nofollow noreferrer&quot;&gt;sine-function-fit&lt;/a&gt; See also good discussion in StackExchange &lt;a href=&quot;https://math.stackexchange.com/questions/301194/given-a-data-set-how-do-you-do-a-sinusoidal-regression-on-paper-what-are-the-e&quot;&gt;&quot;Given a data set, how do you do a sinusoidal regression on paper? What are the equations, algorithms?&quot;&lt;/a&gt; There are a lot of good books and manuals for fitting/regression. I can recommend classical book  &lt;a href=&quot;http://www.nr.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Numerical Recipes&lt;/a&gt;. See chapter &quot;Modeling of Data&quot;. Especially  &quot;Fitting Data to a Straight Line&quot; for base understanding and  &quot;Nonlinear Models&quot; for understanding method of solution your problem. It is possible that there are specific methods for sine function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementation of regression in your case can be effective. You must solve minimization problem for system by size of 3 (for amplitude, frequency and phase). Calculation of coefficients of this system is sums of some functions from all your points - O(N). &lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-03-13T03:29:22.670" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22007" PostTypeId="1" CreationDate="2015-03-12T11:33:35.070" Score="0" ViewCount="70" Body="&lt;p&gt;I am reading Cycle Analytics for Traders by John Ehlers and need help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the first section &quot;Transfer Response&quot; he refers to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fGFvK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if I had $4$ prices say $8+8+8+8$ then average would be $8$ and output/input $= 8/32 = 1/4$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but not equal to $1/4 + 8/4 + 8/4 + 8/4$ so I think I've misunderstood?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to infringe copyright so all I can do is guide you to amazon where you can view this section.&lt;/p&gt;&#xA;" OwnerUserId="15027" LastEditorUserId="7092" LastEditDate="2015-03-12T18:32:53.347" LastActivityDate="2015-03-12T18:32:53.347" Title="just getting started in Signal Processing - easy question" Tags="|filters|sampling|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22008" PostTypeId="2" ParentId="22007" CreationDate="2015-03-12T12:08:42.817" Score="1" Body="&lt;p&gt;The symbol $z^{-1}$ refers to a delay of one sample interval, no matter how long this interval actually is. It comes from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform&quot; rel=&quot;nofollow&quot;&gt;$\mathcal{Z}$-transform&lt;/a&gt;: if $X(z)$ is the $\mathcal{Z}$-transform of a data sequence $x[n]$, then $X(z)z^{-1}$ is the transform of the delayed sequence $x[n-1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function (i.e. the quotient of the $\mathcal{Z}$-transforms of output and input sequences) is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac14\left(1+z^{-1}+z^{-2}+z^{-3}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which in the time (sample) domain means that the output sequence $y[n]$ and the input sequence $x[n]$ are related by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac14\left(x[n]+x[n-1]+x[n-2]+x[n-3]\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is of course the average of the current and the past three data samples. If, as in your example, all data samples have the value $8$, then the output is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac14\left(8+8+8+8\right)=8$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-12T12:08:42.817" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22009" PostTypeId="2" ParentId="21853" CreationDate="2015-03-12T12:31:59.080" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Opus_%28audio_format%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;Opus&lt;/a&gt; would be a good choice. It claims to be the superior solution for Internet (i.e. lossy transmission with inconsistent latency) music and speech streaming applications. Specifically, it provides tight control over encoding latency when that's important. It's based on technology from two previous codecs: &lt;a href=&quot;http://en.wikipedia.org/wiki/SILK&quot; rel=&quot;nofollow noreferrer&quot;&gt;SILK&lt;/a&gt;, developed by Skype for speech transmission, and &lt;a href=&quot;http://en.wikipedia.org/wiki/CELT&quot; rel=&quot;nofollow noreferrer&quot;&gt;CELT&lt;/a&gt;, a codec developed for low-latency streaming audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One nice aspect of Opus is that it is an open standard, so a &lt;a href=&quot;http://opus-codec.org/downloads/&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference implementation&lt;/a&gt; is available that has source code for both floating-point and fixed-point computations. It also claims to have support for multiple architectures, including x86, ARM, and MIPS, which might be useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as quality goes, &lt;a href=&quot;http://opus-codec.org/comparison/&quot; rel=&quot;nofollow noreferrer&quot;&gt;there are a number of detailed comparisons available&lt;/a&gt; between Opus and other audio codecs like AAC or MP3. Here is a plot that seems to summarize it well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vu3DL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the makers of Opus claim superior audio quality to its competitors over a wide range of bitrates. Especially in the pretty-low-bitrate range of 16-32 kbps, it seems to have no peer at the present time. &lt;a href=&quot;http://opus-codec.org/examples/&quot; rel=&quot;nofollow noreferrer&quot;&gt;This page&lt;/a&gt; has a number of live tests that you can run in your browser, showing its performance with both speech and audio, its robustness to packet loss, and its ability to change bitrates (and therefore audio quality) on the fly.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-03-12T12:31:59.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22012" PostTypeId="1" AcceptedAnswerId="25634" CreationDate="2015-03-12T13:32:46.793" Score="1" ViewCount="3615" Body="&lt;p&gt;I am trying to code a Variable Delay (chorus/flanger) effect in MATLAB using a paradigm that would be friendly for porting to a lower level language like C.  What I currently have is a working echo/delay that uses read/write indices to write into a buffer.  I'm now trying to use an LFO (low freq sine wave) to modulate the delay time but can't seem to figure it out.  Sometimes my errors sound &quot;cool&quot; but they aren't correct or what I was trying to do.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Create LFO&#xA;lfo = abs(sin(2*pi*lfo_rate*[0:length(output)]/fs));&#xA;&#xA;    % Perform the Echo Loop&#xA;    for i=1:length(x_t)&#xA;&#xA;    % Write Sample Into Delay Buffer&#xA;    buffer(writer) = x_t(i);&#xA;&#xA;    % Get All Delay Into Output&#xA;    if i &amp;lt;= length(x_t)&#xA;        output(i) = x_t(i) + (b_n * buffer(reader));&#xA;    elseif i &amp;gt; length(x_t)&#xA;        output(i) = b_n * buffer(reader);&#xA;    end&#xA;&#xA;    % Circular Buffer&#xA;    writer = writer + 1;&#xA;        if writer &amp;gt; length(buffer)&#xA;            writer = 1;&#xA;        end&#xA;    reader = reader + 1;&#xA;        if reader &amp;gt; length(buffer)&#xA;            reader = 1;&#xA;        end&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been trying to use the LFO Vector to modulate the readers position, but I'm pretty much stuck and the stuff I can find online about this sort of thing isn't too helpful either.&lt;/p&gt;&#xA;" OwnerUserId="14863" LastEditorUserId="7092" LastEditDate="2015-03-12T18:32:00.067" LastActivityDate="2015-09-08T15:40:10.783" Title="Coding a Variable Delay with LFO (MATLAB/C)" Tags="|matlab|audio|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22013" PostTypeId="2" ParentId="21991" CreationDate="2015-03-12T13:48:09.673" Score="3" Body="&lt;p&gt;You want to build a burst detector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all please notice that you can't do magic so you will &lt;strong&gt;always&lt;/strong&gt; have false alarms and miss detections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll suppose that you have a 1-D signal and that what you call a burst is a short peak in signal intensity, we'll also suppose that your burst is very close to 1 point in duration.&#xA;If your &quot;burst&quot; is in fact a short deterministic signal whose shape is known, you'll want to first use a &lt;em&gt;matched filter&lt;/em&gt;, if your burst is a short random signal whose second order moment is known, you'll want to first use a &lt;em&gt;stochastic matched filter&lt;/em&gt;. If you are neither in these cases, you'll need to use more advanced and/or more had-hoc algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we have the 1 point long burst, or signal, we want to detect, it is burried in some random noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usualy people go for ad hoc approach, he main one being the one you stated.&#xA;A more rigorous one is to use the &lt;strong&gt;neyman pearson lemma&lt;/strong&gt;, that will allow you to calculate a thresold, but you need to know both the signal and noise probability densities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main problem is to estimate the signal and noise pdf, or equivalently under gaussian hypothesis, their mean and covariance. The main difficulties arrising from the fact that both aren't stationary and from the presence of signal biasing your estimation of noise's pdf, mean, variance etc ..., you'll want to go for robust estimator like median and median absolute deviation.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-03-12T13:48:09.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22015" PostTypeId="2" ParentId="8549" CreationDate="2015-03-12T14:23:37.523" Score="0" Body="&lt;p&gt;Let's say that at time $t_k$ you know the state vector $X_k=[p_k,v_k]$ of your obect and the associated covariance matric $P_k$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At time $t_{k+1}$ you have three sensor giving you the object's position $p_{k+1}^1,p_{k+1}^2,p_{k+1}^3$ and their associates covariances matrixes $R_{k+1}^1,R_{k+1}^2,R_{k+1}^3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll fuse these informations using a kalman filter with the following observation process :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y_{k+1}=H_{k+1}X_{k+1}+R_{k+1}&#xA;$$&#xA;with&#xA;$$&#xA;H_{k+1}X_{k+1}= \left( \begin{array}{ccc}&#xA;p_{k+1}^1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; p_{k+1}^2 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; p_{k+1}^3 \end{array} \right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R_{k+1}= \left( \begin{array}{ccc}&#xA;R_{k+1}^1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; R_{k+1}^2 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; R_{k+1}^3 \end{array} \right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I let you do all the combersome formulations for the kalman filter's implementation, but you got the idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will run a different Kalman filter for each time step because you won't have the same number of sensor detecting the object, but it is a non issue as you have the object's state covariance independantly from the number of sensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a time step where you don't have any observation at all, you just run the prediction step without the update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have more than one object and/or false alarm, this become much more complicated and you'll want to google multi-target tracking, data association, multiple hypothesis tracker, probability hypothesis density filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have one object and false alarm this may be a bit more simpler and try googling joint probabilistic data association filter.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-03-12T14:23:37.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22016" PostTypeId="1" AcceptedAnswerId="22020" CreationDate="2015-03-12T14:42:13.567" Score="7" ViewCount="13265" Body="&lt;p&gt;I'm using a lowpass to bandpass filter transformation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s \leftarrow Q \left( \frac{s}{\omega_0} + \frac{\omega_0}{s} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the wiki article: &lt;a href=&quot;http://en.wikipedia.org/wiki/Prototype_filter&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Prototype_filter&lt;/a&gt; which basically is a change of variable. But I was wondering how this transformation is derived?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason being I need to create my own transformation so I can combine a low pass with a shelf using a single transformation from a low pass (to use in the Nth order butterworth equation). Knowing how the lowpass to bandpass transformation is derived would take me a step further to experimenting combining other filters.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="5843" LastEditDate="2015-03-12T17:58:33.317" LastActivityDate="2016-05-10T17:08:54.087" Title="How is the lowpass to bandpass transformation derived?" Tags="|filters|lowpass-filter|bandpass|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22017" PostTypeId="1" AcceptedAnswerId="22018" CreationDate="2015-03-12T14:57:29.133" Score="0" ViewCount="208" Body="&lt;p&gt;I am using GNU Radio C++ source code in my app (&lt;code&gt;pm_remez()&lt;/code&gt;) for generating FIR filters coefficients.&#xA;Input parameters here are: &lt;code&gt;bands[]&lt;/code&gt;, &lt;code&gt;des[]&lt;/code&gt; and &lt;code&gt;weight[]&lt;/code&gt;.&#xA;How I can manipulate stop band attenuation in &lt;code&gt;pm_remez()&lt;/code&gt; function?&lt;/p&gt;&#xA;" OwnerUserId="11038" LastEditorUserId="13320" LastEditDate="2016-04-08T14:58:19.367" LastActivityDate="2016-04-08T14:58:19.367" Title="How to manipulate attenuation in Parks MClellan algorithm?" Tags="|filters|filter-design|lowpass-filter|parks-mclellan|gnuradio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22018" PostTypeId="2" ParentId="22017" CreationDate="2015-03-12T15:03:06.920" Score="1" Body="&lt;p&gt;The stopband attenuation is controlled indirectly by the relation between passband and stopband weights. A large weight means a small error in the corresponding frequency band. E.g., if the passband weight is $1$ and the stopband weight is $10$, then the approximation error in the stopband will be $10$ times smaller than the approximation error in the passband. The actual value of the error (i.e. passband ripple and stopband attenuation) cannot be prescribed in the original version of the algorithm. The approximation error is an outcome of the algorithm, just like the filter coefficients. The only thing that can be prescribed is the &lt;em&gt;ratio&lt;/em&gt; between the errors in the different frequency bands.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-12T15:03:06.920" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22020" PostTypeId="2" ParentId="22016" CreationDate="2015-03-12T15:42:54.693" Score="8" Body="&lt;p&gt;In the $s$-domain, the LPF-to-BPF transformation doubles the order of the filter.  that is because the LPF has one transition from passband to stopband, but the BPF has two such transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that when we do frequency response, we substitute $s=j\omega$.  That is, we evaluate the $s$-plane transfer function $H(s)$ as $H(j\omega)$.  The magnitude of $H(j\omega)$ or $|H(j\omega)|$ is the gain of the filter when the input frequencey is $\omega$.  Also keep in mind that the reciprocal of $j$ is its negative: $ \frac{1}{j} = - j $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the LPF, the middle of the passband is at DC, $\omega=0$.  The transformation to BPF is such that maps, using a nice continuous function, the middle of the BPF passband at $\omega=\omega_0$ to $\omega=0$.  A simple, mathematically continuous mapping as such is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega \leftarrow A ( \omega^2 - \omega_0^2 )  \quad A \ne 0 $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So whenever the $\omega$ on the right (which is the BPF $\omega$) is equal to either $+\omega_0$ or $-\omega_0$, the $\omega$ on the left (which is the LPF $\omega$) is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now suppose we set $A \triangleq \frac{Q}{\omega_0 \omega} $ which is still non-zero (and non-infinite for $\omega \approx \omega_0$).  now you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega \leftarrow Q \left( \frac{\omega}{\omega_0} - \frac{\omega_0}{\omega} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;j\omega &amp;amp; \leftarrow Q \left( j\frac{\omega}{\omega_0} - j\frac{\omega_0}{\omega} \right) \\&#xA;&amp;amp; = Q \left( \frac{j\omega}{\omega_0} + \frac{\omega_0}{j\omega} \right)  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s \leftarrow Q \left( \frac{s}{\omega_0} + \frac{\omega_0}{s} \right)  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so this means, regarding frequency response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;H_\text{BPF}(j\omega) &amp;amp; = H_\text{LPF}\left(j Q \left( \frac{\omega}{\omega_0} - \frac{\omega_0}{\omega} \right) \right) \\&#xA;&amp;amp; = H_\text{LPF}\left(Q \left( \frac{j\omega}{\omega_0} + \frac{\omega_0}{j\omega} \right) \right) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or, regarding transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_\text{BPF}(s) = H_\text{LPF}\left(Q \left( \frac{s}{\omega_0} + \frac{\omega_0}{s} \right) \right) $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-05-10T17:08:54.087" LastActivityDate="2016-05-10T17:08:54.087" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22022" PostTypeId="1" CreationDate="2015-03-12T16:44:15.380" Score="0" ViewCount="126" Body="&lt;p&gt;I just want to know what kind of information does Curvature suggest to us? I've seen an article that used from the curvature of an Image. I can't understand what's the purpose of the author or it's better to say that what kind of information Curvature has.&lt;/p&gt;&#xA;&lt;p&gt;Can anyone help me to handle this problem?&lt;/p&gt;&#xA;&lt;p&gt;The link of the article:&#xA;&lt;a href=&quot;https://ieeexplore.ieee.org/document/6511302&quot; rel=&quot;nofollow noreferrer&quot;&gt;Article link&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The article defines &lt;strong&gt;isophote curvature&lt;/strong&gt; as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K(p) = \bigtriangledown \left[ \frac{ \bigtriangledown I_p}{ \left|  \bigtriangledown I_p \right|} \right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15031" LastEditorUserId="7092" LastEditDate="2022-05-09T11:06:49.893" LastActivityDate="2022-05-09T11:06:49.893" Title="What kind of information can we obtain from curvature for exemplar-based inpainting?" Tags="|image-processing|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="22023" PostTypeId="2" ParentId="22022" CreationDate="2015-03-12T19:17:23.617" Score="1" Body="&lt;p&gt;I haven't read the paper before, but the rationale is state in III.A:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The filling order is very crucial which directly affects the quality of image inpainting. However, during filling procedure we find the data terms may be zeros for many pixels, which make the priorities being close to zeros, although the confidence terms may be very big. This would result in incorrect filling order.[...] by introducing the curvature term,&#xA;  we effectively avoid the priority being close to zero while the&#xA;  data term is zero.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The foundation for the method used in this paper is in &lt;em&gt;&lt;a href=&quot;http://research.microsoft.com/pubs/67276/criminisi_tip2004.pdf&quot; rel=&quot;nofollow&quot;&gt;Object removal by exemplar-based&#xA;inpainting&lt;/a&gt;&lt;/em&gt;, so be sure to read that first.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2015-03-12T19:17:23.617" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22024" PostTypeId="1" CreationDate="2015-03-12T19:52:15.283" Score="0" ViewCount="66" Body="&lt;p&gt;In the below picture, the measurements are inside the $\pm 3 \sigma$ bounds. In my experiment, the measurements sometimes go out of the uncertainty bounds.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bNTy5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a snapshot of my plot where the red is $\pm 3 \sigma$ bounds (i.e. $true \pm 3\sigma$ ), the black is the measurements, the blue is the true value and the green is the EKF. Is there something wrong with my results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Fx1DC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5788" LastActivityDate="2015-04-13T06:31:40.517" Title="can measurements go out of the uncertainty bounds?" Tags="|kalman-filters|estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22026" PostTypeId="1" AcceptedAnswerId="22049" CreationDate="2015-03-12T21:53:30.610" Score="3" ViewCount="3509" Body="&lt;p&gt;I have a signal of bandwidth DC to ,say, 100 Hz. I am interested in the range DC-10 Hz. I oversample by a factor of, say, 30. Thus the sampling rate is 600 samples/sec. Then I bandpass filter and decimate it over a number of stages, say 3 stages (e.g. by a factors of 5, 3 and 2). Thus I get the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives me the advantage of having simpler anti-aliasing filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is another advanage of oversampling, which is reducing the noise by taking an average of adjacent (extra) samples. For example, if we oversample by 4, then we take average of every 4 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions: Do I need to do filtering before the averaging, as is the case with the downsampling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDITED TO CLARIFY.&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="8825" LastEditDate="2015-03-12T22:35:06.877" LastActivityDate="2015-03-13T16:56:10.420" Title="Downsampling, Filtering and Averaging" Tags="|downsampling|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22027" PostTypeId="1" AcceptedAnswerId="22031" CreationDate="2015-03-12T22:02:57.447" Score="0" ViewCount="9659" Body="&lt;p&gt;According to Oppenheim's signal and systems solution book and other solutions like &lt;a href=&quot;http://cmrr-star.ucsd.edu/psiegel/Courses/Ece101_F14/ProblemSolutions/ps1/solution1.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Ev(\cos(4\pi t)u(t)) = 1/2 \times ( \cos(4\pi t)u(t) + \cos(4\pi t)u(-t)) = 1/2(\cos(4\pi t)) &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\textrm{for }-\infty &amp;lt; t &amp;lt;  \infty&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is periodic and its period $1/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I think it is not equal $ 1/2(\cos 4\pi t)  $ at $ t = 0 $ so it is not periodic because at $ t = 0 $ it is equal to $ 1 $ different from other multiples of period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also curious about the value of $ u(t)+u(-t) $. Is it $0$, $1$, or $2$ ?&lt;/p&gt;&#xA;" OwnerUserId="15032" LastEditorUserId="7092" LastEditDate="2015-03-12T22:35:22.700" LastActivityDate="2017-06-20T02:58:12.823" Title="Does $ Ev(\cos(4\pi t)u(t)) $ signal has period?" Tags="|signal-analysis|periodic|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22028" PostTypeId="1" AcceptedAnswerId="22119" CreationDate="2015-03-12T22:12:35.113" Score="1" ViewCount="222" Body="&lt;p&gt;$y$ is scalar observations and so C will be a 1x2 matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to represent the following model as a state space representation so as to estimate the hidden states from the noisy observations $y$ using Kalman filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The  state space model :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(t+1) = Ax(t) + w(t)&#xA;&#xA;y(t) = Cx(t) + v(t)&#xA;&#xA;w(t) = N(0,Q)&#xA;&#xA;v(t) = N(0,R)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$w(t)$ is a pseudo-random binary signal that excites/ drives ; and $v(t) = N(0,\sigma^2_v)$ is the measurement noise.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The model is an FIR (MA) filter &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = h_1 \epsilon(t-1) + h_2 \epsilon(t-2) + \epsilon(t)$$&#xA;$$y(t) = x(t) + v(t)$$&#xA;$$ y(t) = h^T \epsilon(t) + v(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In vector form)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\epsilon(t) = w(t)$.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;The other model is an IIR (AR) filter &#xA;$$x(t) = ax(t-1) + bx(t-2)+ w(t)$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The state space representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t+1) = a^Tx(t) + w(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = h^Tx(t) + v(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I represent these as state space so as to apply Kalman Filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several ways to represent time series models. This is how I proceeded, but unsure because the output of the log-likelihood is a matrix of 2 by 2 with off diagonal elements being infinity and the diagonal elements are same positive values. So, the dimension and the value of log-likelihood is incorrect, I should get negative instead of positive values.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;FIR :&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Re-writing the above model as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t+1) = h_1 \epsilon(t) + h_2 \epsilon(t-1) + \epsilon(t+1)$$&#xA;$$y(t) = Cx(t)+v(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;State Space :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \left[ \begin{array}{c}&#xA;x(t+1)  \\&#xA;x(t)\\&#xA; x(t-1) \end{array} \right] $ = $ \left[ \begin{array}{ccc}&#xA;1 &amp;amp; h_1 &amp;amp; h_2 \\&#xA;0 &amp;amp; 1 &amp;amp;  h_1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1\end{array} \right] $  $\times$ $ \left[ \begin{array}{c}&#xA;e(t+1)\\&#xA;e(t) \\&#xA;e(t-1)\end{array} \right] $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$  y(t)$ = $\left[ \begin{array}{c}&#xA;1 \hskip 5 pt 0 \hskip 5 pt 0\end{array} \right] $ &#xA; $\times$ $ \left[ \begin{array}{c}&#xA;e(t+1)\\&#xA;e(t) \\&#xA;e(t-1)\end{array} \right] $ + $v(t)$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;IIR (AR model)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \left[ \begin{array}{c}&#xA;x(t+1)  \\&#xA;x(t)  \end{array} \right] $ = $ \left[ \begin{array}{cc}&#xA;a &amp;amp; b  \\&#xA;1 &amp;amp; 0&#xA;\end{array} \right] $  $\times$ $ \left[ \begin{array}{c}&#xA;x(t)\\&#xA;x(t-1)\end{array} \right] $ + $\left[ \begin{array}{c}&#xA;1\\&#xA;0\end{array} \right] $ $\times$ $\left[ \begin{array}{c}&#xA;w(t+1)\\&#xA;w(t)\end{array} \right] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$  y(t)$ = $\left[ \begin{array}{cc}&#xA;1 \hskip 5 pt 0\end{array} \right]$ $\times$ $ \left[ \begin{array}{c}&#xA;x(t)\\&#xA;x(t-1)\end{array} \right] $ + $v(t)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="750" LastEditorUserId="750" LastEditDate="2015-03-19T19:39:28.600" LastActivityDate="2015-03-19T19:39:28.600" Title="Doubt in state space representation" Tags="|discrete-signals|state-space|self-study|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22029" PostTypeId="2" ParentId="22027" CreationDate="2015-03-12T22:27:26.050" Score="0" Body="&lt;p&gt;So, let's check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a signal to be periodic with period $P$, we need:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = x(t+P)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for all $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here&#xA;$$ x(t) = 1/2(\cos(4\pi t))$$&#xA;and&#xA;$$ x(t+P) = 1/2(\cos(4\pi [t+P]))$$&#xA;so for such a $P$ to exist we need&#xA;$$ \cos(4\pi t) = \cos(4\pi [t+P]) = \cos(4\pi t) \cos(4\pi P) - \sin(4\pi t) \sin(4\pi P)  $$&#xA;by &lt;a href=&quot;http://mathworld.wolfram.com/TrigonometricAdditionFormulas.html&quot; rel=&quot;nofollow&quot;&gt;applying the $\cos(A+B)$ identity.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that $\cos(2\pi) = 1$ and $\sin(2\pi) = 0$, so $P=\frac{1}{2}$ satisfies the equation for all $t$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-03-12T22:27:26.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22030" PostTypeId="1" AcceptedAnswerId="22042" CreationDate="2015-03-12T22:32:53.673" Score="0" ViewCount="744" Body="&lt;p&gt;I was doing an exercise trying to compute the &lt;strong&gt;PSD&lt;/strong&gt; of the following discrete autocorrelation function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;r_x(m) =(1/2)^{|m|} &#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this simple  matlab code that I came up with to compute the PSD, I'm getting something that I don't quite understand, why is my frequency response oscillating?.If I plot the abs(Sx) i get a smooth plot but , the dft of a real and even sequence should be real and even as well in my understanding . Why I'm not getting a real frequency response and instead this oscillating response appears? Also, matlab is ignoring the imaginary part of the PSD computed as it says in the command window. What is going on  here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=100;  &#xA;m=-N:1:N;  &#xA;x=(0.5).^abs(m);  &#xA;subplot(2,1,1)  &#xA;stem(m,x)  &#xA;Nfft=512;  &#xA;Sx=fft(x,Nfft);   &#xA;subplot(2,1,2)  &#xA;plot((0:1:Nfft-1)/Nfft,Sx);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are  the figures:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Y4t9f.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="14989" LastEditorUserId="4298" LastEditDate="2015-03-13T11:06:34.620" LastActivityDate="2015-03-13T11:06:34.620" Title="why is the plot of the PSD of this autocorrelation function oscillating?" Tags="|matlab|fft|autocorrelation|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22031" PostTypeId="2" ParentId="22027" CreationDate="2015-03-12T22:33:22.410" Score="3" Body="&lt;p&gt;It is a matter of convention. The answer depends on the definition of the step function $u(t)$. In signal processing, it is common to define $u(0)=1/2$. Under this definition, we have that $Ev(\cos(4\pi t)u(t)) = 1/2(0.5+0.5)=1/2$, so the signal is indeed periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $u(0)$ is defined as either 0 or 1, then you'd be correct and the signal wouldn't be periodic.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-12T22:33:22.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22032" PostTypeId="1" AcceptedAnswerId="22045" CreationDate="2015-03-13T01:12:24.600" Score="1" ViewCount="4005" Body="&lt;p&gt;I am working on my project and I need to have a Sinc Interpolation function for a real world image. But, it seems that I have not caught the concept of Sinc interpolation. Could some one help me with this issue? this function is for adding some value among samples or it is used for reconstructing? How can I use this function for reconstructing signal.&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="15003" LastEditDate="2015-03-13T02:08:06.103" LastActivityDate="2015-04-12T14:24:10.193" Title="Sinc Interpolation implementation in Matlab for reconstructing or interpolating?" Tags="|matlab|signal-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22034" PostTypeId="1" CreationDate="2015-03-13T03:24:36.673" Score="7" ViewCount="12453" Body="&lt;p&gt;I would like to know what are the advantages/disadvantage of zero padding with respect to frequency measurement and amplitude measurement&lt;/p&gt;&#xA;" OwnerUserId="15026" LastEditorUserId="7092" LastEditDate="2015-03-13T04:25:35.523" LastActivityDate="2015-03-13T12:44:54.453" Title="Advantages/disadvantage of zero padding" Tags="|zero-padding|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22035" PostTypeId="1" CreationDate="2015-03-13T04:49:07.700" Score="1" ViewCount="208" Body="&lt;p&gt;I have written a vocal pitch shifting algorithm which uses LPC to separate the signal into its spectral envelope (predicted by the coefficients) and the pitch information (the residual error).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding (and intuition) was that the residual signal would be unintelligble, but if I listen to the residual created by algorithm it is easily identifiable as a very low volume, slightly distorted version of the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct, or should I be getting what I originally expected?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Ben&lt;/p&gt;&#xA;" OwnerUserId="15033" LastActivityDate="2015-06-15T23:11:28.520" Title="LPC produces unexpected residual" Tags="|pitch|lpc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22036" PostTypeId="1" CreationDate="2015-03-13T05:43:11.397" Score="2" ViewCount="1056" Body="&lt;p&gt;I am working on OCR. I have extracted features of 26 alphabets, and I want to compare them with an experimental character feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using Euclidean distance and correlation functions, but I am not getting good efficiency. What are some alternate methods for the same?&lt;/p&gt;&#xA;" OwnerUserId="15034" LastEditorUserId="207" LastEditDate="2017-09-30T09:51:45.787" LastActivityDate="2021-08-11T10:58:05.900" Title="Compare feature vectors of an image in MATLAB" Tags="|matlab|matlab-cvst|ocr|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22037" PostTypeId="2" ParentId="21935" CreationDate="2015-03-13T06:06:53.513" Score="0" Body="&lt;p&gt;The following link from math.stackexchange may be of further help to you, if only to prove you're not alone...&lt;br&gt;&#xA;&lt;a href=&quot;https://math.stackexchange.com/questions/13404/mapping-irregular-quadrilateral-to-a-rectangle&quot;&gt;https://math.stackexchange.com/questions/13404/mapping-irregular-quadrilateral-to-a-rectangle&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8777" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-03-13T06:06:53.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22039" PostTypeId="2" ParentId="16226" CreationDate="2015-03-13T07:51:08.180" Score="-2" Body="&lt;p&gt;A Open-Source software called MakeHuman might be what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="15035" LastActivityDate="2015-03-13T07:51:08.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22040" PostTypeId="2" ParentId="22034" CreationDate="2015-03-13T08:51:59.263" Score="1" Body="&lt;p&gt;Zero padding can help you resolve the finer structure of the spectrum, but it won't improve the resolution.&#xA;Zero padding to 2^n number of points so that FFT can be faster. the computation scales like n*logn instead of n^2.&#xA;As for amplitude measurement, the resolution is dominated by SNR no matter how fine spectrum you get in the end with zero padding.&lt;/p&gt;&#xA;" OwnerUserId="14925" LastActivityDate="2015-03-13T08:51:59.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22041" PostTypeId="2" ParentId="22034" CreationDate="2015-03-13T09:42:44.090" Score="6" Body="&lt;h2&gt;Advantages of zero padding:&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If length of your sequence doesn't correspond to the size that can be handled efficiently with FFT routine (usually powers of prime numbers) then you might want to add some extra zeros to the nearest power in order to get the maximum speed-up. In worst case you double the memory you need for your signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Adding zeros is equal to interpolating samples of your spectrum with $\mathrm{sinc}$ function. Therefore you will find it looking more smoothly. It is not affecting frequency resolution in any way. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If some peaks were split between two bins, these can be interpolated to some extend and you might be able to retrieve some amplitude information thanks to that.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are trying to plot frequency response of some FIR filter from it's impulse response then you need to add zeros to it. Otherwise you will get as many samples as the length of filter is. Please see &lt;a href=&quot;https://dsp.stackexchange.com/a/21655/8202&quot;&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are trying to convolve your signal with some pattern using FFT, then you need to pad your signals with zeros to the appropriate length. Otherwise result of convolution will be incorrect (replicas in frequency domain will overlap). Please see &lt;a href=&quot;https://dsp.stackexchange.com/a/17739/8202&quot;&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Disadvantages of zero padding:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Can't think of any. Oh maybe except of people believing that it will improve their frequency resolution in some magical way - I knew PhD's saying that...&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-03-13T10:19:32.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22042" PostTypeId="2" ParentId="22030" CreationDate="2015-03-13T10:06:05.610" Score="0" Body="&lt;p&gt;You are right that the DFT of a real and even sequence is real and even. The problem is that your sequence is not even, at least not the way you programmed it. The &lt;code&gt;fft&lt;/code&gt; command doesn't know how you defined the index &lt;code&gt;m&lt;/code&gt;. By definition, the first data element in the vector &lt;code&gt;x&lt;/code&gt; is associated with the index $n=0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(where $N$ is the DFT length).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your definition of the sequence &lt;code&gt;x&lt;/code&gt; results in a complex spectrum, and the &lt;code&gt;plot&lt;/code&gt; command plots the real part of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two solutions, one of which you already found: either you take the absolute value of the spectrum, or you define the data in such a way that they are indeed even. Due to the implicit periodicity of the DFT, this means that you append the left half of your data (for negative time indicies) at the end of your data vector. Note that the zero padding must now be done in the middle of your data vector:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;x = [x(101:201),zeros(1,Nfft-2*N-1),x(1:100)];&#xA;Sx = fft(x,Nfft);&#xA;max(abs(imag(Sx))            % 2.4980e-16&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting spectrum has a small imaginary part due to numerical inaccuracies, so you always need to use &lt;code&gt;real(fft(x,Nfft))&lt;/code&gt;, but it's always good to check if the imaginary part is really as small as it should be (around $10^{-16}$ for double precision floating point format, as used in Matlab).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-13T10:23:15.167" LastActivityDate="2015-03-13T10:23:15.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22043" PostTypeId="2" ParentId="22034" CreationDate="2015-03-13T12:44:54.453" Score="2" Body="&lt;p&gt;The disadvantage is you end up doing a longer FFT with higher computational cost: more MACs, energy spent toggling ALU/FPU transistors, memory paging and cache miss penalties, resulting in greater latency till the result is ready or requiring faster, hotter hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only need a few interpolated points (one, or a small fraction of log N), it may be faster to do that locally using windowed Sinc interpolation rather than computing an entire longer FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However that increased cost can be significantly less that other means of getting similar results, such as the interpolation of an entire window of plot points using polyphase filtering, or straight convolution vs. overlap add/save fast convolution, etc., etc.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-13T12:44:54.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22044" PostTypeId="2" ParentId="22026" CreationDate="2015-03-13T13:16:21.137" Score="4" Body="&lt;p&gt;Averaging is filtering with a rectangular filter kernel, which has a poor frequency response, both in pass band ripple and stop band attenuation, Because of the poor stop band response it won't anti-alias very well.  The non-flat passband will distort the final result even if there is no high-frequency spectral content to alias.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-13T13:16:21.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22045" PostTypeId="2" ParentId="22032" CreationDate="2015-03-13T13:50:50.657" Score="1" Body="&lt;p&gt;I haven't done this in MatLab, but have done it using C++. So I am not in a position to provide you any matlab code example or snippet, however I will direct you to some links that will help you clear your doubts and concepts regarding the sinc function, filtering and reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sinc function is basically used for low pass filtering signals and for reconstruction of the signal using the previous or old samples. Check out these links, It will clear your concepts about sinc function such as how its used for low pass filtering and reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;concept of sinc function&lt;/em&gt; :- &lt;a href=&quot;http://www.dspguide.com/ch11/2.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dspguide.com/ch11/2.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Low pass filtering&lt;/em&gt; :- &lt;a href=&quot;http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch16.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch16.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Reconstruction is done through interpolation&lt;/em&gt;, check :- &lt;a href=&quot;https://dsp.stackexchange.com/questions/8488/what-is-an-algorithm-to-re-sample-from-a-variable-rate-to-a-fixed-rate/8502#8502&quot;&gt;What is an algorithm to re-sample from a variable rate to a fixed rate?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are already loads of discussion here about sinc functions, sinc windowing filters, interpolation techniques, reconstruction etc. Reading them will certainly help you clear your doubts and concepts regarding these. Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-03-13T13:50:50.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22046" PostTypeId="1" CreationDate="2015-03-13T13:52:55.607" Score="4" ViewCount="1855" Body="&lt;p&gt;For a school project I'm working on instrument classification on multi-instrumental tracks. To do so, I'm following Arie Livshin's modus operandi, and I would like to get a good software to perform source separation: given a multi-instrumental short extract, getting n (with n being equal to the number of instruments) tracks with more or less one instrument per track. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best I've found so far is the FASST toolbox for Matlab, but the result on a saxophone/guitar song was quite disappointing. Have anyone encountered something better I could use?&lt;/p&gt;&#xA;" OwnerUserId="13289" LastActivityDate="2020-04-29T14:59:45.667" Title="good free software (or code) to separate multiples sources in a single wav?" Tags="|matlab|source-separation|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22047" PostTypeId="2" ParentId="21998" CreationDate="2015-03-13T14:13:34.593" Score="2" Body="&lt;p&gt;In a multi-user scenario where every transmitter uses the same center frequency and bandwidth, but transmits &lt;em&gt;different&lt;/em&gt; data, time-division multiplex has to be applied. Otherwise, interference between the multiple transmit signals will make successful reconstruction of a specific transmit signal at the receiver virtually impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in typical SFNs, all transmitters are part of a broadcast network and transmit &lt;em&gt;identical&lt;/em&gt; data. Examples are Digital Audio Broadcast (DAB) and terrestrial Digital Video Broadcast (DVB-T). In such networks, the guard interval of OFDM symbols can compensate for the propagation delay between different transmitters and there is no need for time-division multiplex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I don't think CDMA and OFDM can be combined. As a multiple-access scheme, OFDM(A) allows sharing of the same frequency band by frequency multiplex while CDMA applies code multiplex.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-03-13T14:13:34.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22049" PostTypeId="2" ParentId="22026" CreationDate="2015-03-13T16:56:10.420" Score="3" Body="&lt;p&gt;Oversampling can be used to reduce noise only when you're oversampling the same quantity and the noise samples are uncorrelated and have zero mean. This is seldom the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you're sampling signal $s(t)=r(t)+n(t)$, where $r(t)$ is the signal you're interested in, and $n(t)$ is zero-mean noise, which comes primarily from internal noise in your circuitry. You oversample by a factor of 2 and then average every two samples. Your samples are, say, $s[1]$ and $s[2]$, taken at times $T_s$ and $2T_s$. The average is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;s_a&amp;amp;=\frac{s[1]+s[2]}{2} \\&#xA;&amp;amp;=\frac{r[1]+r[2]}{2}+n_a \\&#xA;&amp;amp;=r_a+n_a&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n_a$ is, you hope, closer to zero than a regular noise sample (if the noise samples are correlated, their average is not necessarily close to 0). However, what can you say about $r_a$? It is neither $r[1]$ nor $r[2]$. You may hope it is close to $r(1.5T_s)$ (or something) but there is no guarantee of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider this scenario: you feed $r(t)$ into two circuits, each with its own ADC, in parallel, with synchronized sampling clocks. At time $t=T_s$ you have two samples, $s_1[1]$ and $s_2[1]$, one from each converter, and (this is key) each with independent, uncorrelated noise. Now your average is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;s_a&amp;amp;=\frac{s_1[1]+s_2[1]}{2} \\&#xA;&amp;amp;=\frac{r[1]+r[1]}{2}+n_a \\&#xA;&amp;amp;=r[1]+n_a&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Now&lt;/em&gt; you have achieved an actual reduction in noise. You achieved that by sampling the same quantity ($r[1]$) twice, and by making sure the noise samples are uncorrelated (since the noise is produced by two different circuits).&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-13T16:56:10.420" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22050" PostTypeId="1" CreationDate="2015-03-13T17:59:15.020" Score="1" ViewCount="451" Body="&lt;p&gt;Aliasing of tones higher than the Nyquist frequency, and where the tone may have some degree of nonlinear distortion can appear as low frequency 'drift' or even near static bias in the sampled signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also it's known that integration of a signal with a large component of white noise results in random walk - a 'drift' like behavior in the integrated signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So are there any possible situations combined with aliased sampling of signals with a significant white noise, or pink noise that can appear as low frequency drift in the sampled signal?&lt;/p&gt;&#xA;" OwnerUserId="8809" LastEditorUserId="8809" LastEditDate="2015-03-14T20:24:14.283" LastActivityDate="2015-03-14T20:24:14.283" Title="Can sample aliasing of strictly white noise lead to random walk (drift) in the sampled signal?" Tags="|noise|sampling|aliasing|distortion|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22051" PostTypeId="2" ParentId="22036" CreationDate="2015-03-13T18:40:28.947" Score="0" Body="&lt;p&gt;If you just need OCR to work, then please try the &lt;code&gt;ocr&lt;/code&gt; function in the Computer Vision System Toolbox.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to write your own, take a look at this &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/digit-classification-using-hog-features.html&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt;, showing how to train an SVM classifier using HOG features for recognizing hand-written digits.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-03-13T18:40:28.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22059" PostTypeId="2" ParentId="22024" CreationDate="2015-03-14T06:23:15.740" Score="1" Body="&lt;p&gt;The meaning of $±3σ$ is that for a given distribution of the measurements, most of the measurements (which have values of up to three time the standard deviation around the average) will be in that boundary. By definition there will be values out side the boundary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to make some specific computations to find out if in your implementation there is a deviation from your expected performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder what is the distribution of the values you assumed? How you determine for each measurement the average and the boundaries - you have a kind of dynamic behavior which places a challenge on defining the various values.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-14T06:23:15.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22060" PostTypeId="1" CreationDate="2015-03-14T08:20:03.170" Score="0" ViewCount="32" Body="&lt;p&gt;Say there is a system with open-loop transfer function&#xA;G(s)=1/(s−1)&#xA;. The system is definitely unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I put any nonlinear system in cascade with G(s) and from the output, a negative unity feedback. Is it possible to make the system close-loop transfer function is stable? It is assumed that the higher order harmonics are filtered in the close loop path.&#xA;electrical-engineering&lt;/p&gt;&#xA;" OwnerUserId="15050" LastActivityDate="2015-03-14T08:20:03.170" Title="Stability of an unstable system using nonlinear element. Is it possible or not?" Tags="|control-systems|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22062" PostTypeId="2" ParentId="22046" CreationDate="2015-03-14T14:00:27.230" Score="0" Body="&lt;p&gt;You could try analysing your audio sample with &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow&quot;&gt;Independent Component Analysis&lt;/a&gt;. It is a blind source separation technique which assumes that the multivariate signal sample is a linear mixture of mutually independent (non-Gaussian) source signals. The de-facto implementation for Matlab is a fast fixed-point iteration algorithm called &lt;a href=&quot;http://research.ics.aalto.fi/ica/fastica/&quot; rel=&quot;nofollow&quot;&gt;FastICA&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8780" LastActivityDate="2015-03-14T14:00:27.230" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22065" PostTypeId="1" CreationDate="2015-03-14T16:26:59.850" Score="0" ViewCount="521" Body="&lt;p&gt;I'm an electrical engineering major and I have a question regarding a project I'm working on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm supposed to design 3 band-stop filters on MATLAB for echo cancellation/suppression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is not filter designing, but with taking acoustic measurements of a classroom since I have little or no information in that area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The supervisor suggested taking coefficients using impulse response invariant! I could not find something solid or a method while searching online.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So my question is, what is the simplest way of taking acoustic&#xA;  measurements of a normal size room/classroom? How to find the&#xA;  coefficients through impulse response invariant method?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;All suggestions are appreciated, current tools I have (dynamic mic, speakers, audio interface (Focusrite Scarlet 2i2), RoomEQ wizard, MATLAB/Simulink, FPGA DE2 board with cyclone)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using RoomEQ wizard and followed their tutorial but did not work properly or maybe I`m not getting the whole picture.&lt;/p&gt;&#xA;" OwnerUserId="15052" LastEditorUserId="8202" LastEditDate="2015-03-14T16:59:00.557" LastActivityDate="2015-06-14T04:05:42.283" Title="How to take acoustic measurements of a clasroom" Tags="|matlab|filter-design|speech-processing|acoustics|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22066" PostTypeId="1" CreationDate="2015-03-14T17:05:09.057" Score="0" ViewCount="49" Body="&lt;p&gt;Suppose there is a bounded continuous signal $f(t)$ that can be fourier-transformed into $F(\omega)$ of frequency contents. $|F(\omega)|$ is non-zero for only finite number of frequencies: $f_1,f_2,..f_n$. Using a filter, we want to retain zeroes of $|F(\omega)|$ at frequencies other than $f_1,..f_n$, but we want to make $|F(\omega)| = \alpha$ for some constant $\alpha$ at all frequencies $f_1,..f_n$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there such a filter? It is fine to assume that phase of $F(\omega)$ is zero or constant for all frequencies.&lt;/p&gt;&#xA;" OwnerUserId="15053" LastEditorUserId="15053" LastEditDate="2015-03-14T17:24:12.587" LastActivityDate="2015-03-14T19:30:24.217" Title="How to equalize frequency contents using filter?" Tags="|filters|fourier-transform|filter-design|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22067" PostTypeId="1" AcceptedAnswerId="22070" CreationDate="2015-03-14T18:31:09.853" Score="13" ViewCount="5213" Body="&lt;p&gt;The wikipedia page for Average Magnitude Difference Function/Formula (AMDF) appears to be empty.  What is an AMDF?  What are AMDF's properties?  What are AMDF's strengths and weaknesses, as compared to other pitch estimation methods such as autocorrelation?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-03-14T20:30:39.893" LastActivityDate="2021-09-29T04:14:55.660" Title="What is an AMDF?" Tags="|autocorrelation|estimation|pitch|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22069" PostTypeId="2" ParentId="22066" CreationDate="2015-03-14T19:14:47.030" Score="1" Body="&lt;p&gt;What you want is not possible, but the problem could be the problem formulation itself. If you have a signal which is non-zero only at a finite number of frequencies, then your signal is a sum of sinusoids (or complex exponentials). What you &lt;em&gt;can&lt;/em&gt; do is make their amplitudes equal, but this does &lt;em&gt;not&lt;/em&gt; mean that $F(\omega_i)=\alpha$ (where $\omega_i$ are the frequencies of the sinusoids/complex exponentials), because the values $F(\omega_i)$ are not defined. This is because $F(\omega)$ is a sum of Dirac delta impulses, which are only defined by their integrals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=\sum_iw_i\delta(\omega-\omega_i)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with some non-zero weights $w_i$. If your goal is to transform (1) into&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega)=\sum_i\alpha\delta(\omega-\omega_i)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\alpha$ being independent of the index $i$, then this is possible by filtering the signal $f(t)$ with a linear time-invariant filter whose frequency response satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega_i)=\alpha/w_i\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But note that this does not mean that $G(\omega_i)=\alpha$ because the values $G(\omega_i)$ are not defined.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-14T19:30:24.217" LastActivityDate="2015-03-14T19:30:24.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22070" PostTypeId="2" ParentId="22067" CreationDate="2015-03-14T20:08:47.850" Score="14" Body="&lt;p&gt;I've never seen the word &lt;em&gt;&amp;quot;Formula&amp;quot;&lt;/em&gt; with &amp;quot;AMDF&amp;quot;.  My understanding of the definition of AMDF is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Q_x[k,n_0] \triangleq \frac{1}{N} \sum\limits_{n=0}^{N-1} \Big| x[n+n_0] - x[n+n_0+k] \Big| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$n_0$&lt;/span&gt; is the neighborhood of interest in &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;.  Note that you are summing up only non-negative terms.  So &lt;span class=&quot;math-container&quot;&gt;$Q_x[k,n_0] \ge 0$&lt;/span&gt;.  We call &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;&amp;quot; the &lt;em&gt;&amp;quot;lag&amp;quot;&lt;/em&gt;.  clearly if &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$Q_x[0,n_0]=0$&lt;/span&gt;.  Also, if &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is periodic with period &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; (and let's pretend for the moment that &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is an integer) then &lt;span class=&quot;math-container&quot;&gt;$Q_x[P,n_0]=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q_x[mP,n_0]=0$&lt;/span&gt; for any integer &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now even if &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is not precisely periodic, or if the period is not precisely an integer number of samples (at the particular sampling rate you are using), we would expect &lt;span class=&quot;math-container&quot;&gt;$Q_x[k,n_0] \approx 0$&lt;/span&gt; for any lag &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; that is close to the period or any integer multiple of the period.  In fact, if &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is nearly periodic, but the period is not at an integer number of samples, we expect to be able to interpolate &lt;span class=&quot;math-container&quot;&gt;$Q_x[k,n_0]$&lt;/span&gt; between integer values of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; to get an even lower minimum.&lt;/p&gt;&#xA;&lt;p&gt;My favorite is not the AMDF but the &amp;quot;ASDF&amp;quot; (guess what the &amp;quot;S&amp;quot; stands for?)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Q_x[k,n_0] \triangleq \frac{1}{N} \sum\limits_{n=0}^{N-1} \big( x[n+n_0] - x[n+n_0+k] \big)^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Turns out you can do calculus with that because the square function has continuous derivatives, but the absolute value function does not.&lt;/p&gt;&#xA;&lt;p&gt;Here's another reason i like ASDF better than AMDF.  If &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is very large and we play a little fast-and-loose with the limits of summation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;Q_x[k] &amp;amp; = \frac{1}{N} \left( \sum_n \big( x[n] - x[n+k] \big)^2 \right) \\&#xA; &amp;amp; = \frac{1}{N} \left( \sum_n (x[n])^2 + (x[n+k])^2 - 2 x[n] x[n+k] \right) \\&#xA; &amp;amp; = \frac{1}{N} \left( \sum_n (x[n])^2 + \sum_n (x[n+k])^2 - 2 \sum_n x[n] x[n+k] \right) \\&#xA;&amp;amp; = \frac{1}{N} \sum_n (x[n])^2 + \frac{1}{N}\sum_n (x[n+k])^2 - \frac{2}{N} \,\sum_n x[n] x[n+k] \\&#xA;&amp;amp; = \overline{x^2[n]} + \overline{x^2[n]} - 2\, R_x[k] \\&#xA;&amp;amp; = 2 \left( \overline{x^2[n]} - R_x[k] \right) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;R_x[k] &amp;amp; \triangleq \frac{1}{N} \sum_n x[n] x[n+k] \\&#xA;&amp;amp; =  \overline{x^2[n]} - \tfrac{1}{2} Q_x[k] \\&#xA;&amp;amp; =  R_x[0] - \tfrac{1}{2} Q_x[k] \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is normally identified as the &amp;quot;autocorrelation&amp;quot; of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So we expect the autocorrelation function to be an upside-down (and offset) replica of the ASDF. Wherever the autocorrelation peaks is where the ASDF (and usually also the AMDF) has a minimum.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2021-09-29T04:14:55.660" LastActivityDate="2021-09-29T04:14:55.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22071" PostTypeId="1" AcceptedAnswerId="22084" CreationDate="2015-03-14T21:17:07.343" Score="0" ViewCount="254" Body="&lt;p&gt;I have a second order analogue high pass transfer function (unity gain at infinity). It's magnitude response hits the -20 decibel line at a frequency of 5706 Hz (the corner frequency is 18000 and sample rate is 44100). When I convert this analogue filter to a digital IIR via the BLT method, the digital filter's magnitude response hits the -20 line at 11149 Hz. This will happen with the standard &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;RBJ audio EQ cookbook&lt;/a&gt; formula i.e. it's not a problem with my maths. I know that digital filters suffer from cramping and that's what I'm interested in. Is there a formula to predict what an analogue frequency will be cramped to when the digital filter is realized given the analogue filter's frequency? i.e. something that will tell me 11149 given 5706. Just to be super clear I'm not asking how to do pre-warping using: &lt;span class=&quot;math-container&quot;&gt;$ tan(\frac{w_c}{2}) $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="4346" LastEditDate="2021-11-27T22:55:24.313" LastActivityDate="2021-11-27T22:55:24.313" Title="How to predict the cramped frequency of a digital filter based on an analogue frequency?" Tags="|highpass-filter|math|digital-filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="22072" PostTypeId="2" ParentId="22003" CreationDate="2015-03-14T21:25:52.503" Score="2" Body="&lt;p&gt;You could use the Gaussian ratio technique for frequency estimation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://fftguru.com/fftguru.com.tutorial4.pdf&quot; rel=&quot;nofollow&quot;&gt;http://fftguru.com/fftguru.com.tutorial4.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and associated C++ code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But your low frequency creates a problem. As noted in the classic 1978 windows paper by Harris (&lt;a href=&quot;http://web.mit.edu/xiphmont/Public/windows.pdf&quot; rel=&quot;nofollow&quot;&gt;http://web.mit.edu/xiphmont/Public/windows.pdf&lt;/a&gt;), nearby negative frequencies can add constructively/destructively with positive frequencies.  Thus, it's important not to operate too closely to either the 0 or N/2 frequency bins - and with inputs from .45 to 4 Hz, you are definitely doing that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the first thing to do is to modulate your input up to say, 20 Hz or so. Since I don't usually work on comms stuff on a day to day basis, I dusted off one of my old comms books and read up about ssb.  As you only have a single input sinusoid (with an additional 90 degree shifted version), this made things a bit easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following C++ code demonstrates the process: 1) generate cos/sin sinusoids of a specific frequency (note that I include pi in the time parameter below - when generating signals containing multiple sinusoids, it's easier to type pi in only once) - phi is an arbitrary phase variable that can be changed; 2) ssb modulate the signals up to 20 Hz using the phasing method - the addition operation chooses the upper sideband, and you get a real signal as a result - ssb gets things away from the 0 frequency bin; 3) compute the Gaussian window; 4) multiply the data record by the window; 5) compute FFT and print out results; 6) compute frequency and amplitude estimates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // *****************************************************************************************&#xA;// ssb_freq_est - 1) generate a sinusoidal signal between .45 Hz and 4 Hz, 2) bandshift up&#xA;// by 20 Hz and obtain upper sideband by ssb, 3) multiply data record by a Gaussian window,&#xA;// 3) take fft, 4) locate the highest amplitude squared output(s), 5) compute the frequency&#xA;// of the tone,           written by Kevin J. McGee at fftguru.com&#xA;#include &amp;lt;cstdio&amp;gt;           //&#xA;#include &amp;lt;cstdlib&amp;gt;          //&#xA;#include &amp;lt;iostream&amp;gt;         //&#xA;#include &amp;lt;cmath&amp;gt;            //&#xA;using namespace std;        //&#xA;void fft_recur(long, double* r, double* i);&#xA;int main (int nNumberofArgs, char* pszArgs[ ] ) {&#xA;const long N = 64;&#xA;double sample_rate = 64., r[N] = {0.}, i[N] = {0.}, s[N] = {0.}, w[N] = {0.} ;&#xA;&#xA;long n ;    double  phi = 0., alpha = 6., t, twopi = 6.2831853071795865;&#xA;double fbin = 0., amp = 0., c;&#xA;&#xA;for (n = 0; n &amp;lt; N; n++)  {  // generate input data&#xA;    t = twopi*n/sample_rate;&#xA;    r[n] = 10.*cos(1.5*t + phi) ;&#xA;    i[n] = 10.*sin(1.5*t + phi) ;&#xA;} // end for&#xA;&#xA;// create ssb - upper sideband&#xA;for (n = 0; n &amp;lt; N; n++)  {  // modulate up to 20 Hz&#xA;    t = twopi*n/sample_rate;&#xA;    r[n] = r[n]*sin(20.*t) ;&#xA;    i[n] = i[n]*cos(20.*t) ;&#xA;    r[n] = r[n] + i[n];    // + chooses upper sideband&#xA;} // end for&#xA;&#xA;//Gaussian window computed using HARRIS 78 windows paper&#xA;for (n = -N/2; n &amp;lt; N/2; n++) {&#xA;    w[n + N/2] = exp(-2.*(n*alpha/N)*(n*alpha/N)) ;&#xA;} // end for&#xA;&#xA;// multiply data record by Gaussian window&#xA;for (n = 0; n &amp;lt; N; n++) {&#xA;    r[n] = w[n]*r[n] ;&#xA;    i[n] = 0. ;&#xA;}&#xA;&#xA;fft_recur(N, r, i);&#xA;&#xA;for (n = 0; n &amp;lt; N/2 + 1; n++) {&#xA;    r[n] = r[n]*r[n] + i[n]*i[n] ;   // compute magnitude squared&#xA;    printf(&quot;%2d\t%9.7f\n&quot;,n,r[n]);&#xA;}&#xA;cout &amp;lt;&amp;lt; &quot;\n\n\n&quot;;&#xA;&#xA;// compute frequency and amplitude&#xA;// in code below, c is a parameter related to the Gaussian window beamwidth&#xA;// - fbin is a fractional bin number (ie: if input sinusoid is at 23.5 Hz, then fbin should&#xA;// compute to be 23.5 - actual frequency is then fbin*sample_rate/N )&#xA;for (n = 16; n &amp;lt; 26; n++) {             // compute for bins 16 to 25&#xA;    c = 8.*(alpha/twopi)*(alpha/twopi);&#xA;    fbin = n +.5 +.5*c*(.5*log(r[n + 1]) - .5*log(r[n]));&#xA;    amp = sqrt(c)*exp(.5*log(r[n]) + ((fbin-n)*(fbin-n))/c)*(2.0*sqrt(twopi/2.)/N) ;&#xA;    printf(&quot;%2d\t%9.7f\t%9.7f\n&quot;,n,fbin*sample_rate/N,amp);&#xA;}&#xA;system (&quot;PAUSE&quot;);&#xA;return 0;&#xA;} // end main&#xA;&#xA;//******************** fft_recur ***********************&#xA;void fft_recur(long N, double *r, double *i)  {&#xA;long h, i1, j = 0, k, i2 = N/2, l1, l2 = 1;&#xA;double c = -1.0, s = 0.0, t1, t2, u1, u2;&#xA;&#xA;for (h = 0; h &amp;lt; N-2; h++) {    // ***** bit reverse starts here ***&#xA;    if (h &amp;lt; j) {&#xA;       t1 = r[h]; r[h] = r[j]; r[j] = t1; &#xA;       t2 = i[h]; i[h] = i[j]; i[j] = t2;&#xA;    }&#xA;    k = i2;&#xA;    while (k &amp;lt;= j) {&#xA;          j = j - k;      k = k/2;&#xA;    }&#xA;    j = j + k;&#xA;}   //****** bit reverse done ******&#xA;&#xA;for (k = 1; k &amp;lt; N; k = k*2) {&#xA;    l1 = l2;     l2 = l2*2;&#xA;    u1 = 1.0;    u2 = 0.0;&#xA;    for (j = 0; j &amp;lt; l1; j++) {&#xA;        for (h = j; h &amp;lt; N; h = h + l2) {&#xA;            i1 = h + l1;&#xA;            t2 = (r[i1] - i[i1])*u2 ;&#xA;            t1 = t2 + r[i1]*(u1 - u2) ;&#xA;            t2 = t2 + i[i1]*(u1 + u2) ;&#xA;            r[i1] = r[h] - t1;&#xA;            i[i1] = i[h] - t2;&#xA;            r[h]  = r[h] + t1;&#xA;            i[h]  = i[h] + t2;              &#xA;        } // end for over h&#xA;        t1 = u1 * c - u2 * s;&#xA;        u2 = u1 * s + u2 * c;&#xA;        u1 = t1;  //x = u1 - u2;    y = u1 + u2;&#xA;    } // end for over j&#xA;    s = - sqrt((1.0 - c) / 2.0);&#xA;    c =   sqrt((1.0 + c) / 2.0);&#xA;} // end for over k&#xA;&#xA;} // end fft  *******************************************************&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With an input of 1.5 Hz, and ssb'd by 20 Hz, the program computes the following fft output (bins 10 to 30):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;10      0.0000000&#xA;11      0.0000000&#xA;12      0.0000001&#xA;13      0.0000112&#xA;14      0.0008969&#xA;15      0.0416534&#xA;16      1.1179498&#xA;17      17.3406472&#xA;18      155.4460465&#xA;19      805.3144096&#xA;20      2411.1413024&#xA;21      4172.0668447&#xA;22      4172.0668527&#xA;23      2411.1412963&#xA;24      805.3144131&#xA;25      155.4460450&#xA;26      17.3406477&#xA;27      1.1179496&#xA;28      0.0416535&#xA;29      0.0008969&#xA;30      0.0000112&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see that the output shows something equidistant between bins 21 and 22, which is where it should be for a 1.5 Hz/20 Hz ssb signal.  The frequency/amplitude calculation results in (bins 16 to 25):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;16      21.5000001      10.0000015&#xA;17      21.5000000      9.9999998&#xA;18      21.5000000      10.0000000&#xA;19      21.5000000      10.0000000&#xA;20      21.5000000      10.0000000&#xA;21      21.5000000      10.0000000&#xA;22      21.5000000      10.0000000&#xA;23      21.5000000      9.9999999&#xA;24      21.5000000      10.0000002&#xA;25      21.5000001      9.9999991&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since the peak(s) in the previously shown FFT output were at bins 21 and 22, the frequency/amplitude calculation of bin 21 above is the one to use (the bin 21 output used bins 21 and 22 in the calculation).  As you can see, it's quite accurate, as you would expect from a good algorithm and zero input noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above code was not at all optimized - there are a lot of efficiencies that could be done (eg: use LUTs instead of sin/cos functions, pre-compute some variables, etc).  And depending on the amount of noise you have, things may not be optimal for your problem (ie: you may need to use more points in the data record to meet your accuracy requirements, or ssb bandshift differently, or shift to a different part of the spectrum, or choose a different Gaussian beamwidth, or replace the FFT with a faster, more accurate one, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I've already spent too much time on the above code, and I don't know what kind of problems you may encounter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Corrected the stated bin numbers (22 changed to 21).  Also, run the code with very low frequencies (eg: .0000001), and you'll see just how good this technique can be.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastEditorUserId="14819" LastEditDate="2015-03-17T01:22:18.110" LastActivityDate="2015-03-17T01:22:18.110" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22073" PostTypeId="1" CreationDate="2015-03-14T21:56:15.357" Score="0" ViewCount="844" Body="&lt;p&gt;Background: My overall goal is to create an audio file player which can playback an audio file at an arbitrary rate. The rate can change continuously as the file plays. This means upsampling to slowdown the playback when the &lt;code&gt;rate &amp;lt; 1&lt;/code&gt;, and downsampling to speedup the playback when the &lt;code&gt;rate &amp;gt; 1&lt;/code&gt;. (I'm not concerned with maintaining pitch.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's focus on the slowdown (upsample) part to make the question simpler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read that to upsample by a rational fraction &lt;code&gt;L/M&lt;/code&gt;, I should first&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Upsample by &lt;code&gt;L&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply an interpolation (lowpass) filter&lt;/li&gt;&#xA;&lt;li&gt;Downsample by &lt;code&gt;M&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, this doesn't work well for an online, live context, because &lt;code&gt;L&lt;/code&gt; or &lt;code&gt;M&lt;/code&gt; can be very large depending on the desired playback rate, requiring large buffers for upsampling/downsampling. I want to process the audio file in small chunks as it plays, so my buffers must be kept to a reasonable size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I decided to try the following algorithm instead, for upsampling by an arbitrary floating point rate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// pseudo-code upsample algorithm&#xA;sloppy_upsample(int source[], int destination[], float rate, int frames):&#xA;  for each frame i:&#xA;    destination[i] = source[round(i * rate)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is a sloppy &quot;zero order hold&quot; algorithm that probably doesn't get the sample rate exactly correct, but it actually sounds surprisingly good for my purposes. I also like this algorithm for its simplicity. But, of course, there's audible aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I can apply a lowpass filter before upsampling to prevent aliasing, but I'm not sure what frequency to set the cutoff at. In similar situations such as &lt;a href=&quot;https://stackoverflow.com/questions/4393545/resampling-a-sound-sample-what-filter-do-i-use&quot;&gt;this one&lt;/a&gt;, the cutoff could be set to less than &lt;code&gt;L * 0.5&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible to select a good cutoff for my &lt;code&gt;sloppy_upsample&lt;/code&gt; function above that prevents aliasing?&lt;/li&gt;&#xA;&lt;li&gt;Is there another approach for upsampling/downsampling that works well for live playback?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15055" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-03-15T03:45:40.580" Title="Playing back an audio file at an arbitrary rate with upsampling and downsampling" Tags="|filters|audio|sampling|lowpass-filter|c|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22074" PostTypeId="2" ParentId="22073" CreationDate="2015-03-14T22:26:36.363" Score="2" Body="&lt;p&gt;Some solutions that are ordered by complexity, simplest first.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The simplest solution is the one you have already implemented- pick the nearest value.&lt;/li&gt;&#xA;&lt;li&gt;The next simplest is linear interpolation.  You use the two nearest values and use a weighted average based on how far the point is from each.  For instance, if the point you want is .3 samples past $x_1$ and .7 samples before $x_2$, the value would be $y = x_1*.7 + x_2*.3$.  This is still pretty simple and should have much better sound performance than your current solution.&lt;/li&gt;&#xA;&lt;li&gt;The next simplest is &lt;a href=&quot;http://isezen.com/2012/01/15/quadratic-interpolation-three-point/&quot; rel=&quot;nofollow&quot;&gt;quadratic interpolation&lt;/a&gt;, or, more generally, &lt;a href=&quot;http://en.wikipedia.org/wiki/Polynomial_interpolation&quot; rel=&quot;nofollow&quot;&gt;polynomial interpolation&lt;/a&gt;.  Polynomial interpolation is also sometimes referred to as spline interpolation.&lt;/li&gt;&#xA;&lt;li&gt;The most complicated solution is &lt;a href=&quot;http://en.wikipedia.org/wiki/Lanczos_resampling&quot; rel=&quot;nofollow&quot;&gt;Lanczos resampling&lt;/a&gt;.  This is where you use a windowed sinc filter to low-pass filter the data.  You pick the particular set of taps to use from the filter based on the particular delay (i.e. at what point you are between the samples).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-03-14T22:26:36.363" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22075" PostTypeId="1" AcceptedAnswerId="22083" CreationDate="2015-03-14T23:44:00.057" Score="0" ViewCount="1183" Body="&lt;p&gt;I'm trying to implement an IIR form to approximate the Gaussian Blur Filter.&lt;br&gt;&#xA;I'm working with the article &quot;&lt;a href=&quot;http://homepage.tudelft.nl/e3q6n/publications/1995/SP95TYLV/SP95TYLV.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Recursive Implementation of the Gaussian Filter&lt;/a&gt;&quot; by Ian T. Young and Lucas J. van Vliet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They suggest a form and way to calculate the coefficients as given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sikzm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to reproduce their example for $ q = 5.0 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is the MATLAB code I wrote:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qFactor = 5;&#xA;&#xA;b0Coeff = 1.57825 + (2.44413 * qFactor) + (1.4281 * qFactor * qFactor) + (0.422205 * qFactor * qFactor * qFactor);&#xA;b1Coeff = (2.44413 * qFactor) + (2.85619 * qFactor * qFactor) + (1.26661 * qFactor * qFactor * qFactor);&#xA;b2Coeff = (-1.4281 * qFactor * qFactor) + (-1.26661 * qFactor * qFactor * qFactor);&#xA;b3Coeff = 0.422205 * qFactor * qFactor * qFactor;&#xA;&#xA;normalizationCoeff = 1 - ((b1Coeff + b2Coeff + b3Coeff) / b0Coeff);&#xA;&#xA;vDenCoeff = [b0Coeff, b1Coeff, b2Coeff, b3Coeff] / b0Coeff;&#xA;&#xA;&#xA;vXSignal = zeros(61, 1);&#xA;vXSignal(31) = 10;&#xA;&#xA;vYSignal = filter(normalizationCoeff, vDenCoeff, vXSignal);&#xA;vYSignal = filter(normalizationCoeff, vDenCoeff, vYSignal(end:-1:1));&#xA;&#xA;figure();&#xA;plot(vYSignal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, the result I get is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tDRc2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely, I get a filter which isn't stable.&lt;br&gt;&#xA;Yet it seems I get the same coefficients as they get in their example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;br&gt;&#xA;Has anyone ever implemented this method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-01-12T07:21:24.383" LastActivityDate="2022-01-12T07:21:24.383" Title="Recursive Implementation of the Gaussian Filter (1D &amp; 2D)" Tags="|image-processing|matlab|filters|filter-design|software-implementation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="22076" PostTypeId="1" AcceptedAnswerId="22078" CreationDate="2015-03-15T00:08:57.383" Score="1" ViewCount="1115" Body="&lt;p&gt;I have a signal $x(t)$. I want to find the Fourier Transform of it, $X(f)$, and then extract a narrow frequency range from $X(f)$ by use of a Band Pass Filter (BPF) in frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I instead filter $x(t)$ by using a BPF in time domain and then find the Fourier Transform of the filtered signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe these two are equivalent.&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="4346" LastEditDate="2015-03-15T01:01:23.917" LastActivityDate="2015-03-15T03:39:58.657" Title="Filtering and Fourier Transforming, does the order matter?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22077" PostTypeId="1" CreationDate="2015-03-15T00:54:21.870" Score="1" ViewCount="49" Body="&lt;p&gt;&lt;strong&gt;Definitions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an ARMA model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_n=-\sum_{p=1}^P a_px_{n-p}+\sum_{q=0}^Qb_qw_{n-q}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w_n$ is zero mean stationary white noise with unit variance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is straightforward to show that the autocorrelation of $x_n$, $R_{XX}[r]$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{XX}[r]=-\sum_{p=1}^P a_pR_{XX}[r-p]+c_r$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_r = \begin{cases}\sum_{q=r}^Qb_qh_{q-r} &amp;amp; r\leq Q \\ 0 &amp;amp; r&amp;gt;Q \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h_n$ is the impulse response of the system, i.e. $x_n=\sum_{m=-\infty}^{\infty}h_mw_{n-m}=h_n*w_n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen in textbooks that the equation for $R_{XX}[r]$ expands to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{XX}[0]+\sum_{p=1}^Pa_pR_{XX}[-p]=c_0$$&#xA;$$R_{XX}[1]+\sum_{p=1}^Pa_pR_{XX}[1-p]=c_1$$&#xA;$$\vdots$$&#xA;$$R_{XX}[Q]+\sum_{p=1}^Pa_pR_{XX}[Q-p]=c_Q$$&#xA;$$R_{XX}[Q+1]+\sum_{p=1}^Pa_pR_{XX}[Q+1-p]=c_{Q+1}=0$$&#xA;$$\vdots$$&#xA;$$R_{XX}[Q+P]+\sum_{p=1}^Pa_pR_{XX}[Q+P-p]=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These can then easily be put into the classic matrix form $\mathbf{R}_X'\mathbf{a}'=\mathbf{c}'$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes perfect sense except for one detail - &lt;strong&gt;why do the textbooks stop the equations at $R_{XX}[Q+P]$? Why do they not continue to $R_{XX}[Q+P+1]$ etc.?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried fruitlessly to show that $\sum_{p=1}^Pa_pR_{XX}[Q+P+1-p]=0$ meaning $R_{XX}[Q+P+1]=0$ so that there isn't any point in considering these equations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to show from $x_n=-\sum_{p=1}^P a_px_{n-p}+\sum_{q=0}^Qb_qw_{n-q}$ that $R_{XX}[Q+P+1]=0$. I would really appreciate it if someone helped me out here, I'm sure the answer is simple and obvious but I just can't see it.&lt;/p&gt;&#xA;" OwnerUserId="15056" LastActivityDate="2015-03-15T00:54:21.870" Title="Yule walker equation limited matrix size" Tags="|discrete-signals|moving-average|autoregressive-model|" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22078" PostTypeId="2" ParentId="22076" CreationDate="2015-03-15T03:39:58.657" Score="1" Body="&lt;p&gt;There may be some slight differences due to the band-pass filtering of FFT results in the frequency domain being a circular convolution (with some wrap-around artifacts) rather than a pure linear convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you filter first, starting in time before your FFT window, any windowing artifacts from any out-of-band spectrum will be reduced before leaking into the FFT filter's pass-band.  Or alternatively, you could zero-pad the FFT window by the length of your filter's impulse response.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-15T03:39:58.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22079" PostTypeId="2" ParentId="22073" CreationDate="2015-03-15T03:45:40.580" Score="0" Body="&lt;p&gt;The best solution is to use a window-ed Sinc interpolation kernel, which will both low-pass and reconstruct with much less aliasing than other methods of interpolation.  The size of the Sinc kernel's main lobe sets the low-pass frequency cut-off as needed, and can be dynamically changed, as long as the rate-of-change isn't a significant FM modulation.  The low-pass cutoff should be &lt;strong&gt;below&lt;/strong&gt; half the lowest of the two sample rates to account for finite transitions bands.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-15T03:45:40.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22080" PostTypeId="1" AcceptedAnswerId="22295" CreationDate="2015-03-15T03:49:26.663" Score="0" ViewCount="907" Body="&lt;p&gt;I am currently working on an image classification project ,where i need to use bag of features model with libsvm(HIK kernel) for classification.I have extracted sift feature and created a visual vocabulary,my fetaures are double values.But LIBSVM works with only integer values.Can anyone please help me with this?&lt;/p&gt;&#xA;" OwnerUserId="14849" LastEditorUserId="14849" LastEditDate="2015-03-24T03:55:34.953" LastActivityDate="2015-03-24T17:29:10.287" Title="How do I implement LIBSVM for multiclass classification using java?" Tags="|image-processing|computer-vision|java|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22081" PostTypeId="1" AcceptedAnswerId="22094" CreationDate="2015-03-15T04:18:03.343" Score="3" ViewCount="5130" Body="&lt;p&gt;I am simulating an 8-QAM communication system over an AWGN channel for various signal to noise ratios, in order to plot the average bit error. However I have not been able to derive an equation for the QAM system in terms of the Q-function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 8-QAM system is rectangular with 2 possible values for the x basis vector and 4 possible values for the y basis vector such that the constellation consists of 8 symbols:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(-d/2,3d/2), (d/2,3d/2)&#xA;(-d/2,d/2), (d/2,d/2)&#xA;(-d/2,-d/2), (d/2,-d/2)&#xA;(-d/2,-3d/2), (d/2,-3d/2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where d is the distance between symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbols are coded using grey coding for the x and y component as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(0,10), (1,10)&#xA;(0,11), (1,11)&#xA;(0,01), (1,01)&#xA;(0,00), (1,00)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My attempt to derive an expression for bit error rate was based on the symmetry of the constellation as it consists of only two unique error scenarios, since the received vectors are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r1 = s1 + n1, r2 = s2 + n2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The probability of error in each scenario is&#xA;$$&#xA;P(bit error scenario 1) = P(r1&amp;lt;0|s1) + P(r2&amp;gt;d|s1) + P(r2&amp;lt;0|s1)&#xA;= 3Q(d/2\sigma)&#xA;$$&#xA;$$&#xA;P(bit error scenario 2) = P(r1&amp;lt;0|s1) + P(r2&amp;lt;d|s1)&#xA;= 2Q(d/2\sigma)&#xA;$$&#xA;Average probability of bit error is then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P(bit error) = (5/2)Q(d/2\sigma)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the transmit signals are equi-probable. and:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$d = \sqrt(2E_s/3), $&#xA;$\sigma =\sqrt(N_0/2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however there is significant disparity between this theoretical error rate and the simulated error rate. I would appreciate it if someone could point me in the right direction, thanks.&lt;/p&gt;&#xA;" OwnerUserId="15057" LastEditorUserId="15057" LastEditDate="2015-03-15T22:14:05.727" LastActivityDate="2015-03-16T08:23:34.370" Title="Rectangular 8 QAM bit error rate calculation" Tags="|matlab|digital-communications|modulation|qpsk|bpsk|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22083" PostTypeId="2" ParentId="22075" CreationDate="2015-03-15T06:39:47.193" Score="1" Body="&lt;p&gt;The answer was simple, the article uses the coefficients value on one hand where the MATLAB implementation on the other.&lt;br&gt;&#xA;Namely, a minus sign should be added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the correct code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qFactor = 5;&#xA;&#xA;b0Coeff = 1.57825 + (2.44413 * qFactor) + (1.4281 * qFactor * qFactor) + (0.422205 * qFactor * qFactor * qFactor);&#xA;b1Coeff = (2.44413 * qFactor) + (2.85619 * qFactor * qFactor) + (1.26661 * qFactor * qFactor * qFactor);&#xA;b2Coeff = (-1.4281 * qFactor * qFactor) + (-1.26661 * qFactor * qFactor * qFactor);&#xA;b3Coeff = 0.422205 * qFactor * qFactor * qFactor;&#xA;&#xA;normalizationCoeff = 1 - ((b1Coeff + b2Coeff + b3Coeff) / b0Coeff);&#xA;&#xA;vDenCoeff = [b0Coeff, -b1Coeff, -b2Coeff, -b3Coeff] / b0Coeff;&#xA;&#xA;&#xA;vXSignal = zeros(61, 1);&#xA;vXSignal(31) = 10;&#xA;&#xA;vYSignal = filter(normalizationCoeff, vDenCoeff, vXSignal);&#xA;vYSignal = filter(normalizationCoeff, vDenCoeff, vYSignal(end:-1:1));&#xA;&#xA;figure();&#xA;plot(vYSignal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-03-15T06:39:47.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22084" PostTypeId="2" ParentId="22071" CreationDate="2015-03-15T07:44:57.120" Score="0" Body="&lt;p&gt;I've come up with a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $ f_a = $ analogue frequency, $ f_d $ = digital frequency, $ f_s = $ sampling rate and $ f_c = $ corner frequency with $ \omega_c = \frac{\pi f_c}{f_s} $ and $ \omega_a = \frac{\pi f_a}{f_s} $ then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ c = \frac{\omega_c}{\tan(\omega_c)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega_d = \arctan\left(\frac{\omega_a}{c}\right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Giving:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f_d = \frac{\omega_d f_s}{\pi} $$ &lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="8202" LastEditDate="2015-03-15T11:54:49.800" LastActivityDate="2015-03-15T11:54:49.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22085" PostTypeId="1" CreationDate="2015-03-15T12:01:37.770" Score="0" ViewCount="7707" Body="&lt;p&gt;I need to compute frequency of a signal from zero crossing.It's possible to compute to frequency from zero crossing of a signal.&#xA;Plz anybody help me about this with matlab . &lt;/p&gt;&#xA;" OwnerUserId="13478" LastActivityDate="2015-03-15T21:51:07.547" Title="How compute frequency of signal from zero crossing?" Tags="|matlab|discrete-signals|frequency|" AnswerCount="2" CommentCount="0" ClosedDate="2015-03-15T21:53:51.570" ContentLicense="CC BY-SA 3.0" />
  <row Id="22086" PostTypeId="2" ParentId="22085" CreationDate="2015-03-15T12:52:54.370" Score="1" Body="&lt;p&gt;From your signal crossing threshold it is fairly straightforward to calculate its period. When you know the period then calculating of corresponding frequency is very simple (its inverse). This answer: &lt;a href=&quot;https://dsp.stackexchange.com/questions/4886/zero-crossing-of-a-noisy-sine-wave&quot;&gt;enter here&lt;/a&gt; answers to similar question.&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-03-15T14:54:40.703" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22087" PostTypeId="1" CreationDate="2015-03-15T13:25:52.880" Score="0" ViewCount="58" Body="&lt;p&gt;I read &lt;a href=&quot;http://www.ai.mit.edu/projects/vsam/Publications/stauffer_cvpr98_track.pdf&quot; rel=&quot;nofollow&quot;&gt;Chris Stauffer paper &quot;Adaptive background mixture models for real-time tracking&quot;&lt;/a&gt; about Gaussian Mixture Model for background subtraction, but they're not explained very detail about $ω_{i,t}$ value, what I want to ask is how the value initialized and what the range of it?&lt;/p&gt;&#xA;" OwnerUserId="12035" LastEditorUserId="12035" LastEditDate="2015-03-15T15:01:25.383" LastActivityDate="2015-03-15T15:01:25.383" Title="How the weight $ω_{i,t}$ is initialized in Background subtraction GMM (Gaussian Mixture Model)?" Tags="|image-segmentation|background-subtraction|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22088" PostTypeId="1" CreationDate="2015-03-15T13:50:25.893" Score="1" ViewCount="755" Body="&lt;p&gt;In order to clip an image's histogram to a maximum value, according to the CLAHE algorithm, the excess pixels (above the clip limit) will be distributed equally among all the histogram bins (While keeping track none of the bins exceed the max limit of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when working with (8,8) region size and distributing 13 pixels on 256 bins, the uniform added value (13/256) will be rounded to zero and so the total number of pixels in histogram will be reduced from (8,8) -&gt; 64px to 64 - 13 = 51px.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That doesn't make sense since I'll be neglecting 13 pixels of the region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips on how to tackle this part of the algorithm?&lt;/p&gt;&#xA;" OwnerUserId="12253" LastActivityDate="2021-06-11T17:07:30.670" Title="CLAHE - Redistributing excess pixels among histogram bins" Tags="|image-processing|histogram|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22089" PostTypeId="2" ParentId="22085" CreationDate="2015-03-15T14:46:19.593" Score="1" Body="&lt;p&gt;I assume you know that this will only work if you need to estimate frequencies in signals next to pure sinusoids, so for this a simple code can be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I create  a simple sin sampled at 8000hz and frequency at 350hz, lets try get  the frenquency using zero crossing method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 8000;&#xA;f  = 350; %Frequency test&#xA;signal= 0.9*sin(2*pi*f/Fs*(0:2048));&#xA;&#xA;%cross = sign(signal(:)); % you can test results using sign function too.&#xA;cross(signal==0) = 1;&#xA;index= find(diff(cross));&#xA;ZC = length(index);&#xA;F0_ZC=(ZC * Fs / (2 * (length(signal))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F0_ZC =&#xA;&#xA;  349.4388&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Edit&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The quick try using @jojek sugestion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 8000;&#xA;f  = 350; %Frequency test&#xA;signal= 0.9*sin(2*pi*f/Fs*(0:2048));&#xA;ZCR = sum(abs(diff(sign(signal(:)))))/(2*length(signal));&#xA;F0_ZC=(ZCR * length(signal) * Fs) / (2 * (length(signal)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F0_ZC =&#xA;&#xA;  350.4148&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Course if you compute the Zero Crossing Rate(ZCR) you can find the frequency using &lt;code&gt;(ZCR  * Fs) /2&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2015-03-15T21:51:07.547" LastActivityDate="2015-03-15T21:51:07.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22091" PostTypeId="2" ParentId="22065" CreationDate="2015-03-15T18:33:22.357" Score="-1" Body="&lt;p&gt;It doesn't matter where your microphone is in the room when you take the measurement. What you need to do is find where the peaks are in the cross correlation (each peak corresponds to an echo at a certain lag/delay), figure out what the corresponding inverse filter needs to be to cancel out the sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're trying to do echo cancellation in MATLAB and have the signal processing toolbox, take a look at the example in xcorr by typing:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;doc xcorr &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;for a simple example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 1:To find the inverse filter required, you need to calculate the transfer function between the source and the mic. (edit: sentence in here was misleading) Once your filters are set up, as long as nothing is changing you should be able to cancel the echoes produced by the room.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2: To get the room impulse response you typically use a long LFM chirp (some people pop a balloon) and a microphone, then calculate the transfer function between the input signal and the recorded signal. Here's an example paper of what you can do: &lt;a href=&quot;http://www.artalabs.hr/papers/im-aaaa2003.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.artalabs.hr/papers/im-aaaa2003.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 3: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You do realise that reverberation (or echoes as you described) are dependent on location and even time? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;you said you are making an &quot;impulse response invariant&quot; filter. So as long as neither your source or microphone are moving, the IIR filter created from your Room Impulse Response measurement will cancel out your echoes...just make sure the mic and speaker stay in the same spot.&lt;/p&gt;&#xA;" OwnerUserId="15061" LastEditorUserId="15061" LastEditDate="2015-03-15T18:55:26.867" LastActivityDate="2015-03-15T18:55:26.867" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22092" PostTypeId="1" CreationDate="2015-03-15T18:39:53.970" Score="1" ViewCount="1003" Body="&lt;p&gt;Let's say I have a signal, containing frequencies up to $30$ kHZ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sampling this signal at $40$ kHz with infinite bit depth (just for theory).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will I be able to recover &lt;strong&gt;exactly&lt;/strong&gt; all the frequencies up to $20$ kHZ , or is that the signal &lt;strong&gt;must&lt;/strong&gt;  only contain frequencies below $20$ kHZ to get the exact magnitudes of the frequencies up to $20$ kHZ ? In other words, will frequencies above $20$ kHZ introduce uncertainty about those below $20$ kHZ ?&lt;/p&gt;&#xA;" OwnerUserId="15062" LastEditorUserId="7092" LastEditDate="2015-03-15T19:50:15.150" LastActivityDate="2016-04-03T18:51:11.307" Title="A question about the sampling theorem" Tags="|discrete-signals|sampling|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22094" PostTypeId="2" ParentId="22081" CreationDate="2015-03-15T18:56:42.533" Score="3" Body="&lt;p&gt;Neglecting square terms of the Q function, your expression is correct, but it is the &lt;em&gt;symbol&lt;/em&gt; error probability, not the &lt;em&gt;bit&lt;/em&gt; error probability:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s=2.5\,Q\left(\frac{d}{2\sigma}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Gray encoding, the bit error probability is closely approximated by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_b\approx\frac13Ps\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because there are $3$ bits per symbol, and the most likely symbol errors (i.e. between neighboring symbols) cause only one bit error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, if $N_0$ is the &lt;em&gt;one-sided&lt;/em&gt; noise density, then $\sigma=\sqrt{N_0/2}$, and the energy per bit is $E_b=E_s/3$, where $E_s$ is the symbol energy. It remains to express the distance $d$ between the symbols in terms of $E_s$. The energy of the four inner symbols is $d^2/2$. The energy of the corner symbols is $5d^2/2$. So for equally probable symbols, the average symbol energy is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_s=\frac12\cdot\frac{d^2}{2}+\frac12\cdot\frac{5d^2}{2}=\frac{3d^2}{2}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d=\sqrt{\frac{2E_s}{3}}=\sqrt{2E_b}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging (4) into (1) gives for the symbol error probablity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s=2.5\,Q\left(\sqrt{\frac{E_b}{N_0}}\right)\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, combined with (2), gives for the average bit error probability&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_b\approx\frac{5}{6}\,Q\left(\sqrt{\frac{E_b}{N_0}}\right)\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;Note that Eq. (6) for the bit error probability was derived under the assumption that the SNR is relatively high. This assumption is implicit in Eq. (1), where quadratic terms of the Q function were neglected. The exact expression for the symbol error probability is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s=2.5\,Q\left(\frac{d}{2\sigma}\right)-1.5\,Q^2\left(\frac{d}{2\sigma}\right)\tag{a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $d/2\sigma\rightarrow 0$ the expression (a) approaches $7/8$. This is a consequence of all symbols being detected with equal probability, and since only one of them is the correct symbol, the symbol error probability must be $7/8$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expression (2) for the bit error probability assumes that each symbol error causes only one bit error, which is true if Gray encoding is used and if it is assumed that symbol errors only occur between neighboring symbols, the latter being a reasonable assumption at relatively high SNRs. However, for $d/2\sigma\rightarrow 0$ any symbol will be confused with any other with equal probability. There is only one symbol (the correct one) where there are zero bit errors. There are $3$ symbols causing one bit error, $3$ symbols causing $2$ bit errors, and one symbol causing $3$ bit errors. Since for very bad SNRs all symbols are detected with equal probability, the average number of wrong bits per detected symbol is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac18\cdot 0+\frac{3}{8}\cdot 1+\frac{3}{8}\cdot 2+\frac18\cdot 3=\frac{3}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since there are $3$ bits per symbol, the average bit error rate for $d/2\sigma\rightarrow 0$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_b=\frac{3}{2}\cdot\frac13=\frac12$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as expected.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-16T08:23:34.370" LastActivityDate="2015-03-16T08:23:34.370" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22095" PostTypeId="2" ParentId="22092" CreationDate="2015-03-15T19:18:59.350" Score="2" Body="&lt;p&gt;To recover a signal from its samples it is sufficient that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the signal contains no energy at frequencies at or above half the sampling rate&lt;/li&gt;&#xA;&lt;li&gt;that the signal is sampled from $t=-\infty$ to $t=\infty$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If the first condition is not met, you could have aliasing. If the second is not met, the reconstruction of the original signal could be imperfect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also discussions at &lt;a href=&quot;https://dsp.stackexchange.com/questions/20498/sampling-theorem-and-signals-explained-to-a-mathematician&quot;&gt;Sampling theorem and signals explained to a mathematician&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/22092/a-question-about-the-sampling-theorem&quot;&gt;A question about the sampling theorem&lt;/a&gt;, and &lt;a href=&quot;https://dsp.stackexchange.com/questions/20510/what-is-meant-by-sampling-in-terms-of-the-sampling-theorem&quot;&gt;What is meant by &lt;em&gt;sampling&lt;/em&gt; in terms of the &lt;em&gt;sampling theorem&lt;/em&gt;?&lt;/a&gt; among many other related questions on this website.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-03-15T19:18:59.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22096" PostTypeId="2" ParentId="22092" CreationDate="2015-03-15T19:19:16.087" Score="-1" Body="&lt;p&gt;If you don't use an anti-aliasing filter, there will be artifacts of the higher frequency present in your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will theoretically be able to recover frequencies up to 20 kHz (practically a little less than that though). If there is signal above 20 kHz when sampled at 40 kHz, you should apply an anti-ailiasing (low pass 0-20kHz, practically 0-18kHz) filter to the data at the input. Data acquisition units should have this built in.&lt;/p&gt;&#xA;" OwnerUserId="15061" LastEditorUserId="15061" LastEditDate="2015-03-15T19:37:13.553" LastActivityDate="2015-03-15T19:37:13.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22097" PostTypeId="2" ParentId="22092" CreationDate="2015-03-15T19:27:19.960" Score="6" Body="&lt;p&gt;If you sample your signal with $f_s=40\,\text{kHz}$ then the band between 20kHz and 30kHz will be folded back to the band between 10kHz and 20kHz. So aliasing will affect the upper half of your spectrum after sampling, i.e. the band between 10 and 20kHz. The lower band from DC to 10kHz will not be corrupted by aliasing.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-04-03T18:51:11.307" LastActivityDate="2016-04-03T18:51:11.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22098" PostTypeId="1" AcceptedAnswerId="22120" CreationDate="2015-03-15T19:28:50.490" Score="0" ViewCount="493" Body="&lt;p&gt;I am wondering if one can assume that a digital image has a tensor structure. I mean for example when we talk about isotropy in image processing, we are talking about the intensity arranged in a tensor like structure; having coordinates and values as opposed  to a matrix which carries only information about values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this important ? because I would like to explain some processes in comparison with tensor functions. For example be able to explain isotropic operations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&lt;/p&gt;&#xA;" OwnerUserId="13687" LastEditorUserId="7092" LastEditDate="2015-03-16T13:57:26.450" LastActivityDate="2015-03-16T20:39:00.290" Title="Can a digital image be considered as a tensor ? or have a tensor like structure?" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22099" PostTypeId="1" CreationDate="2015-03-15T20:30:53.570" Score="1" ViewCount="6223" Body="&lt;p&gt;I was trying to implement skew correction method for scanned documents using the method described in &lt;a href=&quot;http://www.ijstr.org/final-print/dec2013/An-Integrated-Skew-Detection-And-Correction-Using-Fast-Fourier-Transform-And-Dct.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Threshold the image .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Find the fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- Divide the frequency space into 4 quadrants .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4- Calculate the angle of each quadrant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5- if detected angle &gt;= 45 then final angle = 90 - 45&#xA;   else final angle = - detected angle &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's easy to implement the first 3 steps, now I can't figure out how to detect the angle from each quadrant as this step is the most important step I also tried to read another similar resource but I can't figure it out yet .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using C# with Emgu on windows 7&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sample code done so far: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private static Bitmap Matrix2Bitmap(Matrix&amp;lt;float&amp;gt; matrix)&#xA;    {&#xA;        CvInvoke.cvNormalize(matrix, matrix, 0.0, 255.0, Emgu.CV.CvEnum.NORM_TYPE.CV_MINMAX, IntPtr.Zero);&#xA;&#xA;        Image&amp;lt;Gray, float&amp;gt; image = new Image&amp;lt;Gray, float&amp;gt;(matrix.Size);&#xA;        matrix.CopyTo(image);&#xA;&#xA;        return image.ToBitmap();&#xA;    }&#xA;&#xA;    // Real part is magnitude, imaginary is phase. &#xA;    // Here we compute log(sqrt(Re^2 + Im^2) + 1) to get the magnitude and &#xA;    // rescale it so everything is visible&#xA;    private static Matrix&amp;lt;float&amp;gt; GetDftMagnitude(Matrix&amp;lt;float&amp;gt; fftData)&#xA;    {&#xA;        //The Real part of the Fourier Transform&#xA;        Matrix&amp;lt;float&amp;gt; outReal = new Matrix&amp;lt;float&amp;gt;(fftData.Size);&#xA;        //The imaginary part of the Fourier Transform&#xA;        Matrix&amp;lt;float&amp;gt; outIm = new Matrix&amp;lt;float&amp;gt;(fftData.Size);&#xA;        CvInvoke.cvSplit(fftData, outReal, outIm, IntPtr.Zero, IntPtr.Zero);&#xA;&#xA;        CvInvoke.cvPow(outReal, outReal, 2.0);&#xA;        CvInvoke.cvPow(outIm, outIm, 2.0);&#xA;&#xA;        CvInvoke.cvAdd(outReal, outIm, outReal, IntPtr.Zero);&#xA;        CvInvoke.cvPow(outReal, outReal, 0.5);&#xA;&#xA;        CvInvoke.cvAddS(outReal, new MCvScalar(1.0), outReal, IntPtr.Zero); // 1 + Mag&#xA;        CvInvoke.cvLog(outReal, outReal); // log(1 + Mag)            &#xA;&#xA;        return outReal;&#xA;    }&#xA;&#xA;    public static Bitmap DFT(Bitmap bmp)&#xA;    {&#xA;        Image&amp;lt;Gray, float&amp;gt; image = new Image&amp;lt;Gray, float&amp;gt;(bmp);&#xA;&#xA;        // Transform 1 channel grayscale image into 2 channel image&#xA;        IntPtr complexImage = CvInvoke.cvCreateImage(image.Size, Emgu.CV.CvEnum.IPL_DEPTH.IPL_DEPTH_32F, 2);&#xA;        CvInvoke.cvSetImageCOI(complexImage, 1); // Select the channel to copy into&#xA;        CvInvoke.cvCopy(image, complexImage, IntPtr.Zero);&#xA;        CvInvoke.cvSetImageCOI(complexImage, 0); // Select all channels&#xA;&#xA;        // This will hold the DFT data&#xA;        Matrix&amp;lt;float&amp;gt; forwardDft = new Matrix&amp;lt;float&amp;gt;(image.Rows, image.Cols, 2); &#xA;        CvInvoke.cvDFT(complexImage, forwardDft, Emgu.CV.CvEnum.CV_DXT.CV_DXT_FORWARD, 0);&#xA;&#xA;        CvInvoke.cvReleaseImage(ref complexImage);&#xA;&#xA;        // We'll display the magnitude&#xA;        Matrix&amp;lt;float&amp;gt; forwardDftMagnitude = GetDftMagnitude(forwardDft); &#xA;        SwitchQuadrants(ref forwardDftMagnitude); &#xA;&#xA;        // Now compute the inverse to see if we can get back the original&#xA;&#xA;&#xA;        return Matrix2Bitmap(forwardDftMagnitude);&#xA;&#xA;    }&#xA;    public static Bitmap IDFT(Matrix&amp;lt;float&amp;gt; forwardDft)&#xA;    {&#xA;        Matrix&amp;lt;float&amp;gt; reverseDft = new Matrix&amp;lt;float&amp;gt;(forwardDft.Rows, forwardDft.Cols, 2);&#xA;        CvInvoke.cvDFT(forwardDft, reverseDft, Emgu.CV.CvEnum.CV_DXT.CV_DXT_INV_SCALE, 0);&#xA;        Matrix&amp;lt;float&amp;gt; reverseDftMagnitude = GetDftMagnitude(reverseDft);&#xA;        return Matrix2Bitmap(reverseDftMagnitude);&#xA;    }&#xA;    // We have to switch quadrants so that the origin is at the image center&#xA;    private static void SwitchQuadrants(ref Matrix&amp;lt;float&amp;gt; matrix)&#xA;    {&#xA;        int cx = matrix.Cols / 2;&#xA;        int cy = matrix.Rows / 2;&#xA;&#xA;        Matrix&amp;lt;float&amp;gt; q0 = matrix.GetSubRect(new Rectangle(0, 0, cx, cy));&#xA;        Matrix&amp;lt;float&amp;gt; q1 = matrix.GetSubRect(new Rectangle(cx, 0, cx, cy));&#xA;        Matrix&amp;lt;float&amp;gt; q2 = matrix.GetSubRect(new Rectangle(0, cy, cx, cy));&#xA;        Matrix&amp;lt;float&amp;gt; q3 = matrix.GetSubRect(new Rectangle(cx, cy, cx, cy));&#xA;        Matrix&amp;lt;float&amp;gt; tmp = new Matrix&amp;lt;float&amp;gt;(q0.Size);&#xA;&#xA;        q0.CopyTo(tmp);&#xA;        q3.CopyTo(q0);&#xA;        tmp.CopyTo(q3);&#xA;        q1.CopyTo(tmp);&#xA;        q2.CopyTo(q1);&#xA;        tmp.CopyTo(q2);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sample Image: &lt;img src=&quot;https://i.stack.imgur.com/F1Efq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier transform output: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jjWXw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13362" LastActivityDate="2015-07-16T06:01:53.327" Title="Skew detection and correction using Fourier transform" Tags="|image-processing|fourier-transform|opencv|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22100" PostTypeId="2" ParentId="22002" CreationDate="2015-03-16T01:08:34.863" Score="3" Body="&lt;p&gt;You can use DTMF tones which are very easily decodable with resonator banks. Brief explanation at &lt;a href=&quot;http://en.m.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling&quot; rel=&quot;nofollow&quot;&gt;http://en.m.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are in a reverberant room then something like a mobile phone will not put too much energy in it and consequently the recording will not be affected too much by the reverberation. Also, DTMFs are relatively high pitch and would stand out from the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 16 combinations in a typical keypad but then you can alter symbols (e.g. 1213), possibly in a recording, to build more complex phrases or markers. Altering the symbols quicker than the time constant of the room will reduce the effect of reverberation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using the starter gun to obtain impulse responses from the room, you can play a sequence in the beginning and just after the end of the recording to roughly identify a particular response but I wouldn't recommend relying on the markers for absolute syncing. You can add a mic close to the gun to obtain the pulse start and end and use the room mics to estimate the dynamics of the room (attack, decay and others)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated part of this answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general idea remains the same, tag a point in time by playing a sound and detect its presence later. The question now is, which sounds and how to detect them. Here is an example using DTMF codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Get a DTMF generator (for example, a DTMF android app such as this one, &lt;a href=&quot;https://play.google.com/store/apps/details?id=hu.soska.dtmf&amp;amp;hl=en&quot; rel=&quot;nofollow&quot;&gt;https://play.google.com/store/apps/details?id=hu.soska.dtmf&amp;amp;hl=en&lt;/a&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) In a &quot;clean&quot; (non-reverberant) room, record a sequence of sounds, for example &quot;1928&quot;. This is the &quot;tag&quot;. Please make sure that each number is keyed in for at least 1 second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) In the room under measurement, start your recording. When you want to tag a point, have the &quot;1928&quot; sound reproduced and recorded along with the main recording.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Build a filter bank of 8 filters at the DTMF frequencies. The resonators are dead simple filters, here is some example code to get your coefficients: &lt;a href=&quot;http://lifeorange.com/MATLAB/MATLAB_FD.htm&quot; rel=&quot;nofollow&quot;&gt;http://lifeorange.com/MATLAB/MATLAB_FD.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Open the file, run the recording through the filters. Their output will vary depending on the power of the tone in the signal. During the reproduction of DTMF tones, the output of the filters will be increasing. Apply a very simple rule: To maintain a &quot;correct match&quot; you would have to see pairs of filters (representing numbers) going &quot;high&quot; and staying high for at least 1 second. Look for this rule in the outputs of your filters. You now have the matches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why single tones and resonators? Because they are very easy and fast to decode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatives? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Record a Pseudorandom generator signal at step 4 and use cross correlation for step 5. Cross correlation though will be much slower because it would have to run repeatedly in a &quot;sliding window&quot; fashion (please see &lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative for step 5 could be multimon (please see &lt;a href=&quot;http://manpages.ubuntu.com/manpages/gutsy/man1/multimon.1.html&quot; rel=&quot;nofollow&quot;&gt;http://manpages.ubuntu.com/manpages/gutsy/man1/multimon.1.html&lt;/a&gt; ), but that would not give you the offset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are all approximate solutions though, they will not give you a dead accurate point in time that your &quot;event&quot; occurs, only a rough approximation (which also depends from the length of your recording).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2015-03-23T12:33:51.140" LastActivityDate="2015-03-23T12:33:51.140" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22104" PostTypeId="1" CreationDate="2015-03-16T06:47:05.933" Score="0" ViewCount="178" Body="&lt;p&gt;I did the auto-correlation for an image by Mathematica.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The auto-correlation function shows rings as follow..I am sorry that I can not attach the original image here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the following auto-correlation one, what kind of information can we get or guess for the original image??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vh4ZS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15070" LastActivityDate="2015-03-16T06:47:05.933" Title="what kind of information we can get if the auto-correlation for an image is a ring or two rings?" Tags="|image-processing|autocorrelation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22106" PostTypeId="1" CreationDate="2015-03-16T07:38:41.397" Score="2" ViewCount="530" Body="&lt;p&gt;I suppose that OFDM can't modulate analog signal. The basic mathematical description for OFDM is &#xA;      $$ v(t)=\sum_{k=0}^{N-1}X_{k}\exp(j2\pi k t /T),\quad 0&amp;lt;t&amp;lt;T$$&#xA;In this equation, $X_k$ is a discrete value. &#xA;So OFDM can not modulate an analog signal.&lt;/p&gt;&#xA;" OwnerUserId="15025" LastEditorUserId="1606" LastEditDate="2015-03-17T09:57:15.980" LastActivityDate="2015-03-18T12:40:35.950" Title="Can OFDM modulate analog signal?" Tags="|digital-communications|modulation|demodulation|ofdm|digital|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22107" PostTypeId="1" AcceptedAnswerId="50823" CreationDate="2015-03-16T09:11:22.400" Score="15" ViewCount="40328" Body="&lt;p&gt;When did we decide to sample telephone at $8$ kHz? Has this always been the case? Why did we do that? Is it because higher bit rates can't be transferred as quick? And do these reasons still count? And if not, why isn't there a new standard yet? Is it true that $8$ kHz is the lowest possible sampling rate to transfer understandable speech? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to find sources for this, but there doesn't seem to be much information about it.&lt;/p&gt;&#xA;" OwnerUserId="10174" LastEditorUserId="7092" LastEditDate="2015-03-16T13:55:12.093" LastActivityDate="2019-03-06T20:43:58.927" Title="Why is telephone audio sampled at 8 kHz?" Tags="|audio|sampling|" AnswerCount="6" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22109" PostTypeId="2" ParentId="22107" CreationDate="2015-03-16T09:52:32.407" Score="6" Body="&lt;p&gt;It was thought to provide a good trade-off between quality and bandwidth. Actually a single voice signal occupies 8 kHz, not 8 kbps, of bandwidth. Each sample is quantized into 8 bits, yielding a rate of 64 kbps which is used universally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further reading:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_Signal_0&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Digital_Signal_0&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/G.711&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/G.711&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2015-03-16T09:52:32.407" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22110" PostTypeId="1" AcceptedAnswerId="22127" CreationDate="2015-03-16T10:23:51.177" Score="3" ViewCount="3614" Body="&lt;p&gt;I've two signals X and Y. These are proximity sensors reading measuring vibrations of a rotating shaft. Now I want to plot orbit plots for these signals. I can plot unfiltered orbits with just X and Y. But since there is lot of noise in the signal I filtered it. Now there are dominant 1X frequency component and may be other sub frequency components. I want to plot the filtered orbit of 1X say 656 Hz. The sampling frequency I used is 1000000 Hz. I know band pass filter could give me only the 1X component. But I don't have DSP toolbox. Could someone help me how to design and implement narrow band pass filter without toolbox.&#xA;Any suggestion or hints or idea would be helpful.&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="13557" LastActivityDate="2015-03-19T20:35:05.583" Title="How to design a narrow band pass filter without DSP toolbox" Tags="|matlab|signal-analysis|bandpass|" AnswerCount="5" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22111" PostTypeId="1" AcceptedAnswerId="22112" CreationDate="2015-03-16T11:28:35.793" Score="2" ViewCount="8347" Body="&lt;p&gt;I am learning DPS and I came across the problem of deconvolution and removing the impulse response from a signal? This still does little sense to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of the impulse response is to find out the response, usually in frequency, of a device, a filter, a room etc. If I don't mess things here, to me, the impulse response in signal processing is equivalent to numeric 1. Finding the impulse response is convolving a signal with something that is equivalent to 1 that is the impulse response. So if I need to find what the value of x is, I simply multiply x by 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = x\times1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore if $y = 0.8$, I know $x = 0.8$ as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In DSP, we have the equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y = XH$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to know the impulse response of $X$, I multiply $X$ by $H$ and obtain $Y$ which is equal to $X$. I've gone that far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand what deconvolution means. I though by applying the impulse response we have already an answer about the frequency of anything we need. What does deconvolution mean here and why would we look for it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4721" LastEditorUserId="4721" LastEditDate="2015-03-16T12:26:24.563" LastActivityDate="2015-03-16T12:26:24.563" Title="What does it mean to deconvolve the impulse response" Tags="|convolution|impulse-response|deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22112" PostTypeId="2" ParentId="22111" CreationDate="2015-03-16T11:47:33.750" Score="4" Body="&lt;p&gt;A linear time-invariant (LTI) system is completely characterized by its impulse response $h(t)$. The output signal $y(t)$ given an arbitrary input signal $x(t)$ is given by the convolution of this input signal with the system's impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=(x\star h)(t)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes convolution. In the frequency domain, Eq. (1) becomes a simple multiplication:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(f)=X(f)H(f)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Y(f)$, $X(f)$, and $H(f)$ are the Fourier transforms of the signals $y(t)$, $x(t)$, and $h(t)$, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Deconvolution&lt;/em&gt; now refers to the process of &quot;undoing&quot; the effect of an LTI system. I.e. you're given the signal $y(t)$ and you want to recover the original signal $x(t)$. E.g., you might want to remove the reverberation added to a signal by a given room. In this case you need to undo the effect of the convolution of the room's impulse response with the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naive deconvolution can in principle be done by applying an inverse filter to the signal $y(t)$. The inverse filter ideally has a frequency response $G(f)=1/H(f)$. Note that such a filter does not necessarily exist, e.g. if $H(f)$ has zeros at certain frequencies. Another disadvantage of this naive deconvolution is the effect it has on measurement noise. In frequency regions where $H(f)$ has a small magnitude, the magnitude of $G(f)$ becomes large, and the noise is highly amplified. This is why applying an inverse filter is usually not a good solution. If the system's impulse response is known and if the noise can be modeled as (wide-sense) stationary, &lt;a href=&quot;http://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;nofollow&quot;&gt;Wiener deconvolution&lt;/a&gt; can be used. In that case, the original signal is estimated using a mean square error criterion, which takes into account the impulse response as well as the noise. If the impulse response is unknown (or can't be estimated), there are methods available referred to as &lt;a href=&quot;http://en.wikipedia.org/wiki/Blind_deconvolution&quot; rel=&quot;nofollow&quot;&gt;blind deconvolution&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-16T12:01:00.607" LastActivityDate="2015-03-16T12:01:00.607" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22114" PostTypeId="2" ParentId="22106" CreationDate="2015-03-16T13:32:13.900" Score="2" Body="&lt;p&gt;You are correct. However, the coefficients $X_k$ could be samples taken from an analog signal. These could be used in the receiver to recover the analog signal using interpolation.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-16T13:32:13.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22116" PostTypeId="1" AcceptedAnswerId="22117" CreationDate="2015-03-16T15:09:51.580" Score="0" ViewCount="546" Body="&lt;p&gt;I'm sorry if my question is too simple, but I am self-studying FIR because we have to report it in our class. I am using the book of Proakis and Manolakis as reference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under &lt;strong&gt;7.2 Structures for FIR systems&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In general, an FIR system is described by the &lt;strong&gt;difference equation&lt;/strong&gt;&#xA;  &lt;img src=&quot;https://i.stack.imgur.com/6nZrS.png&quot; alt=&quot;enter image description here&quot;&gt;  (7.2.1)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;or evidently, by the system function &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ky9Qz.png&quot; alt=&quot;enter image description here&quot;&gt; (7.2.2)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Under &lt;strong&gt;7.2.1 Direct-Form Structure&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The direct-form realization follows immediately from the nonrecursive difference&#xA;  equation given by (7.2.1) or, equivalently, by the &lt;strong&gt;convolution summation&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CMuFn.png&quot; alt=&quot;enter image description here&quot;&gt; (7.2.4)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can see that they almost look the same apart from the b&lt;sub&gt;k&lt;/sub&gt; in 7.2.1 and h(k) in 7.2.4. Question is, how are they different or related to each other? Sorry if you find my question too basic. Thank you in advance for the help! &lt;/p&gt;&#xA;" OwnerUserId="14786" LastActivityDate="2015-04-15T16:00:58.627" Title="FIR difference equation vs convolution summation" Tags="|convolution|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22117" PostTypeId="2" ParentId="22116" CreationDate="2015-03-16T15:26:05.940" Score="1" Body="&lt;p&gt;I should have read further before asking this question! Anyway, I've found out that there are different ways to implement the FIR system as mathematically described in Equation 7.2.1 in the post above. Among these realizations/structures is the direct-form, which is the simplest to begin with. Equation 7.2.4 shows the transformation of the general equation in 7.2.1 in accordance with the direct-form.&lt;/p&gt;&#xA;" OwnerUserId="14786" LastActivityDate="2015-03-16T15:26:05.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22118" PostTypeId="2" ParentId="22107" CreationDate="2015-03-16T16:02:50.697" Score="2" Body="&lt;p&gt;Another reason is that, before digital signal transmission, telephone audio used to be analog modulated into a narrow-band channel so that multiple phone calls could be sent down a single analog link (RF and microwave tower relays, etc.)  The audio thus had to be first be low-pass filtered to narrow the bandwidth required for each channel so as to pack the largest number of channels down one analog pipe (but even then, on a bad day, one could hear some of any adjacent phone call as background noise).  Since people got used to long distance calls lacking frequencies higher than 3.5 kHz or so, this bandwidth became commercially acceptable even for local calls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, even narrower bandwidths were used for early space exploration communications, so 3.5 kHz may not be the minimum for understandable speech.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-16T16:02:50.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22119" PostTypeId="2" ParentId="22028" CreationDate="2015-03-16T19:56:58.830" Score="1" Body="&lt;p&gt;Your FIR state space representation seems to be doing too much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I would write it is to have the process noise is $\epsilon(t)$ as your input, and your state as two time-delayed copies of it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t+1) = \left[ \begin{array}{c}&#xA;\epsilon(t+1)\\&#xA;\epsilon(t) \\&#xA;\epsilon(t-1) &#xA;\end{array} \right] = \left[ \begin{array}{ccc}&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &#xA;\end{array} \right] x(t) + \left[\begin{array}{c}&#xA;1\\&#xA;0\\&#xA;0&#xA;\end{array} \right] \epsilon(t + 1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then your output equation is just:&#xA;$$&#xA;y(t) = \left[ \begin{array}{ccc}&#xA;1 &amp;amp; h_1 &amp;amp; h_2 \end{array} \right] x(t) + v(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your IIR representation is too confused for me to make head or tail out of. Can you clarify that you have the right information there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is $w(t)$? It does not appear to take part in any of your equations?&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Pseudorandom_binary_sequence&quot; rel=&quot;nofollow&quot;&gt;What are the parameters for $u(t)$?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-03-16T19:56:58.830" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22120" PostTypeId="2" ParentId="22098" CreationDate="2015-03-16T20:39:00.290" Score="1" Body="&lt;p&gt;An isotropic tensor is one invariant under rotations. An isotropic kernel is also invariant under rotations, but the way the rotation acts on the object is very different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tensors transform as linear forms, whereas images are just rotated like a scalar function of coordinates and the coordinates are rotated. So if you come from continuum mechanics, the image/kernel transforms like the pressure field.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-03-16T20:39:00.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22121" PostTypeId="1" AcceptedAnswerId="22139" CreationDate="2015-03-16T20:47:47.173" Score="2" ViewCount="156" Body="&lt;p&gt;I have the problem of masking tinnitus. I have the following questions: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Can broadband noise mask tone tinnitus, or any kind of tinnitus (such as narrowband, or chirp)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assume an audiogram test has identified tinnitus as tonal with loudness level of $x$ dB and  frequency/pitch of $y$ Hz. How can I create broadband noise  using this information (note that we don't know the variance of the noise)? How could this be implemented in Matlab?    &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sedy&lt;/p&gt;&#xA;" OwnerUserId="11096" LastEditorUserId="11096" LastEditDate="2015-03-17T16:28:13.273" LastActivityDate="2015-03-19T03:00:37.880" Title="Tinnitus Masking with broadband Noise" Tags="|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22122" PostTypeId="2" ParentId="22107" CreationDate="2015-03-16T21:18:18.893" Score="1" Body="&lt;p&gt;As others have said 4kHz is standard, because it naturally where human voice is &lt;a href=&quot;http://www.uoverip.com/voice-fundamentals-human-speech-frequency/&quot; rel=&quot;nofollow&quot;&gt;source1&lt;/a&gt; &lt;a href=&quot;http://www.uoverip.com/voice-fundamentals-human-speech-frequency/&quot; rel=&quot;nofollow&quot;&gt;source2&lt;/a&gt;. I did find this one article that mentions fundamental frequencies are much lower 85Hz-300Hz &lt;a href=&quot;http://www.axiomaudio.com/blog/audio-oddities-frequency-ranges-of-male-female-and-children%E2%80%99s-voices/&quot; rel=&quot;nofollow&quot;&gt;article&lt;/a&gt;. Whether or not this works in practice, I can't say for sure. but worth a try &lt;/p&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2015-03-16T21:18:18.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22123" PostTypeId="2" ParentId="22110" CreationDate="2015-03-16T23:39:30.803" Score="1" Body="&lt;p&gt;Assuming 2 MHz sampling rate, by just simple addition of every 20 samples you get a low pass filter that will keep the noise down and will still allow you to recover every problem related to the 38K RPM source signal which you could cope with successfully since 100K is maintaining the Nyquist requirements.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-16T23:39:30.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22124" PostTypeId="1" CreationDate="2015-03-17T00:23:44.740" Score="2" ViewCount="342" Body="&lt;p&gt;I am implementing a voice morphing system, but I am having difficulties getting a good quality output signal. The method I am using is LPC analysis and synthesis. In theory, the LPC process should split the signal into a source/filter representation by calculating a residual and a set of filter coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in practice, I am finding that the residual contains data which I believe should be contained in the filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What techniques are available for better separating an input signal into source and filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Ben&lt;/p&gt;&#xA;" OwnerUserId="15033" LastActivityDate="2022-04-12T00:03:10.320" Title="Improving the separation of a signal into source and filter" Tags="|source-separation|lpc|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22127" PostTypeId="2" ParentId="22110" CreationDate="2015-03-17T01:19:45.017" Score="2" Body="&lt;p&gt;The steps that I would follow to handcraft a bandpass filter are these:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Figure out how wide (in Hz) you want the filter to be.&lt;/li&gt;&#xA;&lt;li&gt;Create a low-pass filter with half the one-sided bandwidth as your desired filter bandwidth.  You can calculate the sinc function with basic functions, since $sinc(x) = \frac{sin(\pi x)}{\pi x}$.  You can adjust the bandwidth by adjusting the time scale in your sinc function.  If n is the set of all integers between -N and N, inclusive, and you make your filter taps equal to $sinc(bn)$, then the filter's normalized bandwidth will be equal to $b$.&lt;/li&gt;&#xA;&lt;li&gt;Modulate the lowpass filter to the center frequency you want for your bandpass filter.  You do that by multiplying it, element by element, with a sine wave of that frequency.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-03-17T01:19:45.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22130" PostTypeId="1" CreationDate="2015-03-17T11:24:20.380" Score="6" ViewCount="2324" Body="&lt;p&gt;Everywhere I read about the FFT, I read about frequency bins. I can't find anything about what is precisely meant with 'bin'. What I wonder about is if this is actually meant to imply that the FFT returns binned data in the sense of the word as used in statistics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this question can be rephrased into this example: if I have bins centered at 1Hz, 2Hz, 3Hz, etcetera, what would happen to a frequency component at 2.4Hz? If the frequency bins are actually bins, I think this would mean that the amplitude is simply added to the 2Hz bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the bins are indeed bins as I interpret the word, I would really like to know why the FFT results are binned.&#xA;If not, then I am curious why they are called bins.&lt;/p&gt;&#xA;" OwnerUserId="13398" LastActivityDate="2015-03-17T13:35:16.493" Title="What does the word 'bin' mean in the context of FFT's?" Tags="|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22132" PostTypeId="2" ParentId="22130" CreationDate="2015-03-17T13:05:17.293" Score="2" Body="&lt;p&gt;A finite length DFT transform has a finite number of basis vectors, which are all single frequency complex sinusoids.  If the results weren't binned then you would need an infinitely long DFT or FFT result to represent any continuous spectrum.  However, Parseval's theorem says that all the energy in a finite input vector ends up in the finite FFT result vector.  So any single between-bin-center-in-frequency pure sinusoid (or between DFT basis vector frequency, windowed by any finite length FFT) ends up binned, spread mostly into FFT result bins very near in frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;very near&quot; because:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each FFT result bin is not rectangular, but a filter in the shape of Sinc function (more precisely, a periodic Sinc function or Dirichlet kernel), since that is how a pure sinusoid correlates with any one DFT complex basis vector when swept across the frequency range from 0 to Fs/2.  The result is also conjugate mirrored in the full length FFT result for strictly real input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another interpretation is that there exist no in-between bin frequencies, that any cut-off sinusoid is really a repetitively discontinuous periodic waveform.  But that mythical input is not representative of how FFTs are actually used in many forms of DSP signal analysis (windowing, peak estimation, low offset overlapping windows, phase vocoders, etc.). Although knowing about this circularity is important when using an FFT for fast convolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-03-17T13:35:16.493" LastActivityDate="2015-03-17T13:35:16.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22134" PostTypeId="1" AcceptedAnswerId="22138" CreationDate="2015-03-17T14:05:10.040" Score="0" ViewCount="733" Body="&lt;p&gt;I am new to phase analysis, recently I have been trying compare the phase between the input signal and output signal of a system. From the code below, I simulated a square wave and plotted the phase, from basic theory, I thought that since this is a simulated signal, I should get near zero values other than the values at each input frequency. So my questions are (based on the following code): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Why does Matlab give me pi/2 as phase response of actual input signals, I don't understand the calculation behind it (does it have to do with my signal being sine and not cosine?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If I don't filter out low (near zero) values, the phase response is a sloping line that goes toward very large numbers, and seems to be proportional to the number of samples of FFT I have, is this due to how unwrap works?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) If I am trying to compare an input signal vs output signal, both of which for the sake of argument looks similar to the square wave I simulated, how do I determine if the system is linear phased? (from theory, the phase delay should be the same therefore, after finding the phase response, should I check if the difference of phase for each input signal between output and input is constant? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Also, group delay is considered as the derivative of phase response, and phase delay is the normalization of phase with respect to its corresponding frequency, a perfect square wave should have constant values at each harmonic for group delay and phase delay shouldn't it?, if so can I somehow see this result in my simulation?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all;&#xA;&#xA;clear all;&#xA;&#xA;fs = 16000;&#xA;&#xA;end_time = 6-1/fs;&#xA;&#xA;x = 0:1/fs:end_time;&#xA;&#xA;x = x';&#xA;&#xA;n=2000;&#xA;&#xA;freq = 32;&#xA;&#xA;wave = sin(2*pi* freq*x)/(4*pi);&#xA;&#xA;for i = 3:2:n&#xA;&#xA;    wave = wave + sin(i*2*pi*freq*x)/(4*i*pi);&#xA;&#xA;end&#xA;&#xA;wave = awgn(wave,55,'measured');&#xA;&#xA;wave (1:10000) = 0;&#xA;&#xA;NFFT = length(wave);&#xA;&#xA;fft_result = fft(wave, NFFT);&#xA;&#xA;&#xA;for i = 1:NFFT&#xA;&#xA;    if abs(fft_result(i)) &amp;lt; 10^-4&#xA;&#xA;        fft_result(i) = 0;&#xA;&#xA;    end&#xA;&#xA;end&#xA;&#xA;fft_mag = db(abs(fft_result));&#xA;&#xA;fft_phase = unwrap(angle(fft_result));&#xA;&#xA;fstep = fs/NFFT;&#xA;&#xA;f_range = 0:fs/NFFT:fs-1/NFFT;&#xA;&#xA;&#xA;figure&#xA;&#xA;plot(f_range, fft_phase);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for being patient enough to read all of this and giving me answers.&#xA;=)&lt;/p&gt;&#xA;" OwnerUserId="8481" LastEditorUserId="12161" LastEditDate="2015-03-17T15:09:25.640" LastActivityDate="2015-04-16T10:11:02.323" Title="matlab fft phase response square wave" Tags="|matlab|fft|phase|linear-phase|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22136" PostTypeId="1" AcceptedAnswerId="22143" CreationDate="2015-03-17T15:49:58.210" Score="2" ViewCount="69" Body="&lt;p&gt;My question is, do the smoothed values affect the estimates obtained from the Maximization Step? If not then we could eliminate the smoothing. Once the estimates are obtained, they do not change apart from substituting the smoothed values $x_n^s, P_n^s$. So, why do smoothing?&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="780" LastEditDate="2015-03-19T03:28:48.920" LastActivityDate="2015-03-19T03:28:48.920" Title="System Identification: smoothing in E-step of EM algorithm" Tags="|discrete-signals|kalman-filters|system-identification|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22137" PostTypeId="2" ParentId="20072" CreationDate="2015-03-17T16:01:03.377" Score="1" Body="&lt;p&gt;I'm not sure what is meant here by the &quot;optimal&quot; similarity metric for a given situation. The textbook you linked to references the following thesis:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[87] P. A. Viola, &lt;em&gt;Alignment by maximization of mutual information&lt;/em&gt;. Ph.D. thesis, Massachusetts Institute of Technology, 1995.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;...but I can't find it anywhere online after a quick search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my point of view:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sum of square differences measures the difference in pixel intensities, so it is useful when pixel intensities are very similar in both images&lt;/li&gt;&#xA;&lt;li&gt;Normalized cross-correlation measures linear correlation between pixel intensities, so it is useful when image intensities are linearly correlated&lt;/li&gt;&#xA;&lt;li&gt;Mutual information is a measure of general statistical dependence between pixel intensities, so it is useful when image intensities have a non-linear statistical dependence&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If SSD works for a given pair of images, I don't see why NCC or MI wouldn't do the job just as well, since they are more general. They may be slower since the metric takes longer to compute, but I don't understand why one would be more &quot;optimal&quot; than the other.&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="13517" LastEditDate="2015-03-23T16:12:21.760" LastActivityDate="2015-03-23T16:12:21.760" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22138" PostTypeId="2" ParentId="22134" CreationDate="2015-03-17T16:10:29.297" Score="0" Body="&lt;p&gt;Re question (1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most FFTs, or the way atan2() is commonly used with complex FFT results to compute a phase, produce a zero phase (strictly real) output for strictly symmetric input.  This means you want cosine waves, periodic in aperture, not sine waves starting at zero at the window edge, for FFT results with zero phase.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-17T16:10:29.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22139" PostTypeId="2" ParentId="22121" CreationDate="2015-03-17T17:59:11.217" Score="0" Body="&lt;p&gt;Read about &lt;a href=&quot;http://en.wikipedia.org/wiki/Tinnitus_masker&quot; rel=&quot;nofollow noreferrer&quot;&gt;tinnitus masking&lt;/a&gt; on Wiki. Yes, you can mask it with various kinds of noise and/or natural sounds that are &quot;noisy&quot; (ocean, rainfall, etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the synthesis of masking noise, there is plenty of information via google &amp;amp; StackOverflow. Keep in mind that broadband noise (versus bandlimited noise) is present &lt;em&gt;across&lt;/em&gt; the spectrum and thus, you only need to be approximately in the same &lt;a href=&quot;http://en.wikipedia.org/wiki/Bark_scale&quot; rel=&quot;nofollow noreferrer&quot;&gt;bark frequency band&lt;/a&gt; of the tone you want to mask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot showing one measurement of Tinnitus spectrum (from &lt;a href=&quot;http://www.thelancet.com/cms/attachment/2021743353/2041580240/gr1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.thelancet.com/cms/attachment/2021743353/2041580240/gr1.jpg&lt;/a&gt;). I wasn't able to access the &lt;a href=&quot;http://www.thelancet.com/journals/laneur/article/PIIS1474-4422(13)70160-1/fulltext?version=printerFriendly&quot; rel=&quot;nofollow noreferrer&quot;&gt;full thelancet article&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5UEZm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="11372" LastEditDate="2015-03-19T03:00:37.880" LastActivityDate="2015-03-19T03:00:37.880" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22140" PostTypeId="2" ParentId="20050" CreationDate="2015-03-17T18:03:42.167" Score="1" Body="&lt;p&gt;Firstly your FIR LPF design depends on factors such as sampling rate, maximum frequency, cut off frequency, bandwidth and impulse response. For generating your impulse response, you can use sinc function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Read about sinc function&lt;/em&gt; :- &lt;a href=&quot;http://www.dspguide.com/ch11/2.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch11/2.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Read about Low Pass Filter&lt;/em&gt; :- &lt;a href=&quot;http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch16.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch16.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your question, I understand that your asking how to select the cut off frequency with respect to the sampling rate. If that's the case, I will give a brief about it with an example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, consider an input signal with a sampling rate of 1000sps. Lets assume that we want to pass frequencies only up to 100Hz and block the higher frequencies those are above 100 Hz. So, now your cut off frequency is 100 Hz. Note that your selected cut off frequency must be below the maximum frequency present in the signal. Mathematically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that, Sampling Rate , &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                              F_s = 1000 sps  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the maximum frequency is given by, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                        F_max = F_s/2 = 1000/2 = 500 Hz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, from above, we know that the maximum frequency present in the signal is 500 Hz, therefore , your selected cut off frequency must be below 500 Hz to avoid aliasing. So, In general, the value of your cut off frequency must be of the value between 0 to 0.5. Since the normalized sampling frequency value is 1 and 0.5 represents half of the sampling rate i.e. 500 in this case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our example, we have selected a cut off frequency of 100 Hz, so Mathematically:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  cut off frequency, F_c = 100/1000 = 0.1 ---&amp;gt; Less than 0.5 i.e. 500 Hz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And, just for the understanding purpose, what If we had selected the cut of frequency as 600 Hz instead of 100 Hz?. Lets calculate and see.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             F_c = 600/1000 = 0.6 -----&amp;gt; Greater than 0.5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above, we can see that the cut off frequency selected is greater than 500 Hz and this will create aliasing. So to avoid this, we always select F_c to be less than 0.5. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, additional factors such as transition bandwidth and impulse response length must also be considered when designing your FIR LPF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now coming to down sampling, It basically means your dropping some samples from the existing one's to reduce the number of samples present in your output signal. I will just present a simple down sampling code for you to get some idea:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int M;                   // sampling factor - integer value&#xA;int N = 1024;            &#xA;double *inputsignal[N];  // generate input signal/data using sin function&#xA;double *outputsignal[N]; // To accumulate the downsampled signal&#xA;int input_samplerate;    // input signal sampling rate&#xA;int output_samplerate;   // desired output signal sampling rate&#xA;int set_input_output_samplerate(); //function to set rate &amp;amp; calc factor&#xA;int downconvert();&#xA;&#xA;int set_input_output_samplerate()&#xA;{&#xA;  M = input_samplerate/output_samplerate; // for 100/50 = M = 2&#xA; return M;&#xA;}&#xA;int downconvert()&#xA; {&#xA;&#xA;int index = 0;&#xA;   for(int i =0 ; i&amp;lt;input_samplerate/M ; i++)&#xA;       {&#xA; outputsignal[index++] = inputsignal[i*M]; //drop 2 samples from input for each iteration and copy the data to output array and increment it&#xA;       }                               &#xA; }&#xA;int main()&#xA; {&#xA;call set_input_output_samplerate(); //call function to set rate &amp;amp; calc M&#xA;call  downconvert(); // call function to downsample&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note : The above code is only for downsampling by integer factors and it does not include for filtering. So, you have to low pass filter your signal before downsampling it using the above. I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="9152" LastEditDate="2015-03-18T02:36:32.617" LastActivityDate="2015-03-18T02:36:32.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22141" PostTypeId="2" ParentId="22124" CreationDate="2015-03-17T18:12:17.500" Score="1" Body="&lt;p&gt;Have you considered using a higher order filter for your LPC analysis?  LPC analysis is known to be sensitive to the presence of noise, say additive, so it may be useful to preprocess/denoise the signal to have the best/cleanest signal going in. Are you using a microphone on a mobile device?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If those don't work, you should look into research on &lt;a href=&quot;https://ccrma.stanford.edu/~jos/SpecEnv/Spectral_Envelope_Extraction.html&quot; rel=&quot;nofollow&quot;&gt;spectral envelope extraction&lt;/a&gt;, or alternative algorithms for voice-morphing.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-03-17T18:12:17.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22142" PostTypeId="2" ParentId="19448" CreationDate="2015-03-17T18:33:08.877" Score="0" Body="&lt;p&gt;to answer the &quot;why&quot; question, i would say that although quantization error, without dither, is solely deterministic (and that determinism shows up when the signal amplitude is nearly as small as the quantization step-size), when the signal amplitude is &lt;strong&gt;much&lt;/strong&gt; larger than the quantization step-size and the signal is arbitrary, then the quantization error (sometimes called &quot;rounding error&quot;) is quite unpredictable within the limits of the step size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pick an arbitrary (but reasonably large) real-number and round it to the nearest integer.  the quantization error is the difference of the rounded value from the original unrounded value.  that number can be &lt;strong&gt;anything&lt;/strong&gt; between -1/2 and +1/2 with nearly equal probability.  so we &lt;strong&gt;model&lt;/strong&gt; that error as a uniform p.d.f. random number in that range that is independent from the rounding error of all previous and future samples.  (when the signal is very small in amplitude, the assumption that the random value of the rounding error is independent of the other rounding errors is not valid, but if the signal is very large, it's not a bad assumption.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-17T18:33:08.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22143" PostTypeId="2" ParentId="22136" CreationDate="2015-03-17T19:24:23.113" Score="2" Body="&lt;p&gt;The result of the $M$-step is expressed in terms of the matrices $\mathbf{P}_n^2$ and the vectors $\mathbf{x}_n^s$. These quantities are defined as expectations. Smoothing is used to compute these expectations, because in practice expectations are usually approximated by time averages (hence 'smoothing'). If you have another method for computing these expectations, the results of the $M$-step will of course be different, but the expressions for the results of the $M$-step remain valid, you just plug in different values for the respective matrices and vectors.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-17T19:24:23.113" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22144" PostTypeId="1" AcceptedAnswerId="22163" CreationDate="2015-03-17T20:02:27.903" Score="2" ViewCount="375" Body="&lt;p&gt;I am doing some simulations on the performance of OFDM systems in multi-path channels and I am confused about something. It is explained below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that we have a multi-path channel with a number of taps equal to $L$. Each tap has a power of $\sigma$, hence, the total power in the multi-path channel in time domain is $\sigma\:L$. If the generated channel in time domain of length $L$ is denoted as $h$, then the channel in frequency domain of length $N$ is $H = \rm{FFT}(h,N)$, where $N$ is the number of OFDM subcarriers.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If we have $X \sim N(0,\frac{\sigma^2}{2})$ and $Y \sim N(0,\frac{\sigma^2}{2})$, then $h = \sqrt{X^2 + Y^2} \sim \rm{Rayleigh}(\frac{\sigma}{\sqrt(2)})$. &lt;/li&gt;&#xA;&lt;li&gt;Additionally, if channel in frequency domain $H\sim \rm{Rayleigh}(\frac{1}{\sqrt{2\lambda}})$, then $|H|^2 \sim e^{\lambda}$? In this line correct? Is $\lambda = \frac{1}{\sigma^2}$?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am confused about the transition from $h$ to $|H|^2$ and the relation between their means and variances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate your help in advance.&lt;/p&gt;&#xA;" OwnerUserId="15078" LastEditorUserId="7092" LastEditDate="2015-03-17T20:21:16.357" LastActivityDate="2015-03-18T21:08:18.200" Title="Gaussian, Rayleigh, and Exponential RVs" Tags="|digital-communications|random|multipath|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22145" PostTypeId="1" AcceptedAnswerId="22147" CreationDate="2015-03-17T22:22:50.437" Score="3" ViewCount="5451" Body="&lt;p&gt;I'm trying to &lt;strong&gt;convolve two signals&lt;/strong&gt; $x(n)$ and $h(n)$ in C by &lt;strong&gt;using&lt;/strong&gt; the &lt;strong&gt;FFTW&lt;/strong&gt; library's functions to perform a Fourier transform on each, multiply the appropriate complex components together, and take the IFFT of the resultant product. Unfortunately, &lt;strong&gt;my IFFT'd result isn't correct&lt;/strong&gt;, and I'm not sure what I'm doing incorrectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm testing using a modified version of code I found online (.c and Makefile &lt;a href=&quot;http://www.krkumar.com/wp-content/misc/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;), which populates two arrays with random numbers between 0 and 1. My process is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create &lt;code&gt;double&lt;/code&gt; buffers for &lt;code&gt;x&lt;/code&gt; (audio signal) and &lt;code&gt;h&lt;/code&gt; (impulse response) of lengths &lt;code&gt;n&lt;/code&gt; and &lt;code&gt;nIR&lt;/code&gt; respectively.&lt;/li&gt;&#xA;&lt;li&gt;Populate each buffer with random numbers between 0 and 1.&lt;/li&gt;&#xA;&lt;li&gt;Create two &lt;code&gt;complex&lt;/code&gt; buffers &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;H&lt;/code&gt;, each of length &lt;code&gt;nOut = n + nIR - 1&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create and then execute two real-to-complex FFT plans, one for each of the signals, both using &lt;code&gt;nOut&lt;/code&gt; elements (i.e. &lt;code&gt;plan_forward = fftw_plan_dft_r2c_1d ( nOut, x, X, FFTW_ESTIMATE );&lt;/code&gt; and &lt;code&gt;plan_forwardIR = fftw_plan_dft_r2c_1d (nOut, h, H, FFTW_ESTIMATE);&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create complex array &lt;code&gt;fftMulti&lt;/code&gt; to hold the frequency products of the two arrays. Its size is &lt;code&gt;nc = nOut / 2 + 1&lt;/code&gt; because FFTW doesn't store the redundant half of the FFT&lt;/li&gt;&#xA;&lt;li&gt;Loop &lt;code&gt;for ( i = 0; i &amp;lt; nc; i++ )&lt;/code&gt; and perform complex multiplication, i.e. &lt;code&gt;fftMulti[i][0] = X[i][0] * H[i][0] - X[i][1] * H[i][1];&lt;/code&gt; for the real component and &lt;code&gt;fftMulti[i][1] = X[i][0] * H[i][1] + X[i][1] * H[i][0];&lt;/code&gt; for the imaginary component&lt;/li&gt;&#xA;&lt;li&gt;Create &lt;code&gt;double&lt;/code&gt; array &lt;code&gt;convolvedSig&lt;/code&gt; of size &lt;code&gt;nOut&lt;/code&gt;. This array will hold the IFFT of &lt;code&gt;fftMulti&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Create and execute a complex-to-real FFT plan of size &lt;code&gt;nOut&lt;/code&gt;, i.e. &lt;code&gt;plan_backwardConv = fftw_plan_dft_c2r_1d(nOut, fftMulti, convolvedSig, FFTW_ESTIMATE);&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Normalize &lt;code&gt;convolvedSig&lt;/code&gt; by dividing each element by &lt;code&gt;nOut&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The values in &lt;code&gt;convolvedSig&lt;/code&gt;&lt;/strong&gt; are not correct (they &lt;strong&gt;are way too high&lt;/strong&gt;), but I'm not sure what I'm doing wrong. I also created arrays and complex-to-real plans for my unmodified signals &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;H&lt;/code&gt; (also of size &lt;code&gt;nOut&lt;/code&gt;), and those IFFTs worked just fine (i.e. values were exactly the same as before I performed FFTs on them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using my process and/or my &lt;a href=&quot;http://www.krkumar.com/wp-content/misc/&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt;, can someone please help me identify what I'm doing incorrectly?&lt;/p&gt;&#xA;" OwnerUserId="15079" LastEditorUserId="7092" LastEditDate="2015-03-18T02:34:46.270" LastActivityDate="2018-08-26T11:37:35.960" Title="Perform Convolution in Frequency Domain Using FFTW?" Tags="|fft|convolution|frequency-domain|c|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22146" PostTypeId="2" ParentId="9599" CreationDate="2015-03-17T23:26:11.953" Score="4" Body="&lt;p&gt;This answer comes a little late, but I think that it's necessary to clear up some of the confusion about what the eigenstructure of a Laplacian is and how it is calculated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, it's important to stress that this is not about properties of the local kernel used for calculating discrete derivatives. Instead you have to understand the Laplacian as &lt;em&gt;linear operator&lt;/em&gt; on a &lt;em&gt;vector space&lt;/em&gt; whose elements are in your case the volumetric data sets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means applying the Laplace operator is a linear map that maps one vector (data set) to another vector (data set). In this context, the eigenvectors of the Laplacian are again vectors (data sets) in that very same vector space. So the answer to your question would be a set of volumetric data sets, in fact as many as the &lt;em&gt;dimension&lt;/em&gt; of your vector space (i.e the number of &lt;em&gt;independent&lt;/em&gt; voxels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider a very simple example. Take a 1-dimensional image, i.e. a single row of pixels, and let's also only use very few pixels, namely 4. Then the two center pixels have to direct neighbours, while the first and last pixel only have one neighbour each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1 - 2 - 3 - 4$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this pixel geometry, we can give the discrete Laplace operator's result for the two center pixels 2 and 3 as linear functions of the pixels' values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$l[2] = p[1] - 2*p[2] + p[3]$$&#xA;$$l[3] = p[2] - 2*p[3] + p[4]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other two pixels 1 and 4 don't have enough direct neighbours to calculate the discrete second derivative. We could fix that by assuming that pixels 1 and 4 are direct neighbours, closing the topology to a circle and imposing what is called a circular boundary condition. Or we just take the second derivatives at the boundaries to vanish. Let's do both, but start with the cyclic boundary condition. So we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$l[1] = p[4] - 2*p[1] + p[2]$$&#xA;$$l[4] = p[3] - 2*p[4] + p[1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This map is linear and we can write it as a matrix equation, mapping the column vector $p := (p[1],p[2],p[3],p[4])$ to $l = (L[1],L[2],L[3],L[4])$ by multiplication with the matrix $M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ L = M \cdot p $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We call this matrix the discrete representation of the Laplace operator, and for our case it is&#xA;$$M=&#xA;\left(&#xA;\begin{array}{cccc}&#xA; -2 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA; 1 &amp;amp; -2 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; -2 &amp;amp; 1 \\&#xA; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; -2 \\&#xA;\end{array}&#xA;\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The eigenvectors of this matrix are &#xA;$$ v_1 = (-1,1,-1,1) $$&#xA;$$ v_2 = (0,-1,0,1) $$&#xA;$$ v_3 = (-1,0,1,0) $$&#xA;$$ v_4 = (1,1,1,1) $$&#xA;with the associated eigenvalues&#xA;$$ \lambda_1 = 4&#xA;, \lambda_1 = 2&#xA;, \lambda_1 = 2 &#xA;, \lambda_1 = 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may recognise these vectors as the basis vector of the discrete Fourier transform on this vector, and the eigenvalues as their discrete frequencies. This is true in general, and in fact the decomposition of a vector (or more generally, a function) into the eigenspectrum of a Laplace operator generalises the idea of the Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's investigate what happens if we use the alternative boundary conditions where $l[1] = 0$ and $l[4]=0$. The Matrix $M$ is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M=\left(&#xA;\begin{array}{cccc}&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 1 &amp;amp; -2 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; -2 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{array}&#xA;\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cearly, this matrix has a different set of eigenvectors and eigenvalues. They're not as intuitive and insteresting, so I won't list them explicitly. It's worth noting however that we now get the eigenvalue $0$ twice, that means the eigensubspace where the laplacian vanishes is two dimensional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do things change if we have a proper image instead of a single row of pixels? Not much. We only need to write down the Laplacian for each single pixel while considering the direct neighbour relationship, or topology, of the image. To make things a little trickier, let's go with an irregularly shaped two dimensional image.&#xA;$$&#xA;\begin{array}{ccccccccc}&#xA;    &amp;amp;&amp;amp; 1 &amp;amp;-&amp;amp; 2 &amp;amp;-&amp;amp; 3 &amp;amp;&amp;amp;  \\&#xA;    &amp;amp;&amp;amp; | &amp;amp; &amp;amp; | &amp;amp; &amp;amp; | \\&#xA; 4 &amp;amp;-&amp;amp; 5 &amp;amp;-&amp;amp; 6 &amp;amp;-&amp;amp; 7 &amp;amp;-&amp;amp; 8 \\&#xA; | &amp;amp; &amp;amp; | &amp;amp; &amp;amp; | &amp;amp; &amp;amp; | &amp;amp; &amp;amp; | \\&#xA; 9 &amp;amp;-&amp;amp; 10 &amp;amp;-&amp;amp; 11 &amp;amp;-&amp;amp; 12 &amp;amp;-&amp;amp; 13 \\&#xA;    &amp;amp;&amp;amp; |  &amp;amp; &amp;amp; |  &amp;amp;&amp;amp;  | &amp;amp; &amp;amp;  \\&#xA;    &amp;amp;&amp;amp; 14 &amp;amp;-&amp;amp; 15 &amp;amp;-&amp;amp; 16 &amp;amp;&amp;amp; \\&#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously now we have to take a 2-dimensional Laplacian by summing the second partial derivatives in horizontal and vertical direction. For that we require the two direct neighbours in each direction. The inner points $5,6,7,10,11,12$ therefore have a full 2-d laplace expansion. For point $5$ it looks like this for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$l[5] = p[4] - 2 p[5] + p[6] + p[1] - 2 p[5] + p[10] \\= p[4] + p[6] + p[1] + p[10] - 4 p[5]$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the corner points $1,3,4,8,9,13,14,16$ we cannot construct a discrete second derivative so we use a boundary condition, e.g. $l[1]=0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two points left, $2$ and $15$. Both have two direct neighbours in horizontal direction, but not in vertical direction. We can therefore apply a boundary condition that only affects the vertical direction, by setting the vertical second derivative to zero, while we evaluate the discrete second derivative horizontally and get $l[2]=p[1]-2p[2]+p[3]$ and likewise for $l[15]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following this construction we get a linear equation for every point that relates it to the pixel values. Again, we write it as a matrix equation $L=Mp$, where the matrix in this case has $16\times 16$ entries. To be specific, it's &#xA;$$M=\left(&#xA;\begin{array}{cccccccccccccccc}&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 1 &amp;amp; -2 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -2 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{array}&#xA;\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And again we can solve for the eigensystem of this matrix. A nice physical interpretation of the images that you get as eigenvectors is that they represent the &lt;em&gt;vibrational modes&lt;/em&gt; of a &lt;em&gt;membrane&lt;/em&gt; shaped like your image, with frequencies given by the eigenvalues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can easily step this game up to any number of dimensions, as long as you know the neighbourhood relations between your voxels. Simply formulate the individual linear equation like above, construct a matrix, find the eigensystem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the information gained from the eigenvectors of the Laplacian solving difference equations involving the discrete Laplacian can be greatly simplified. Once the eigenstructure is found, depending only on the geometry of the region, all data sets can be easily decomposed into the eigenbasis and the difference equations become trivial.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-03-17T23:26:11.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22147" PostTypeId="2" ParentId="22145" CreationDate="2015-03-17T23:29:34.057" Score="4" Body="&lt;p&gt;You need to zero pad x and h. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;nZeros = length(x) + length(h) -1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; close all; home&#xA;&#xA;xSamples = 10;&#xA;hSamples = 7;&#xA;&#xA;x = randn(1,xSamples);&#xA;&#xA;h = randn(1,hSamples);&#xA;&#xA;nZeros = xSamples + hSamples - 1;&#xA;&#xA;X = fft(x,nZeros);&#xA;H = fft(h,nZeros);&#xA;&#xA;x_conv_h = ifft(X.*H);&#xA;&#xA;&#xA;figure(1)&#xA;plot(real(x_conv_h))&#xA;hold on; grid on&#xA;plot(conv(x,h),'.r')&#xA;legend('fft based convolution','convolution')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2015-03-17T23:40:24.610" LastActivityDate="2015-03-17T23:40:24.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22148" PostTypeId="2" ParentId="22106" CreationDate="2015-03-18T02:16:14.000" Score="0" Body="&lt;p&gt;Well, the equation you show is an inverse DFT with a positive exponent.  Analog DFT or FFT processors have long been known to exist.  A search for &quot;analog FFT processor&quot; plus OFDM plus transceiver yields about 119 hits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although many of the targeted applications are for receivers, an analog FFT processor can also be used in transmission, as, for example, Fig. 1 in the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ece.ubc.ca/~nimas/edu/TCAS-I_small.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ece.ubc.ca/~nimas/edu/TCAS-I_small.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2015-03-18T02:16:14.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22149" PostTypeId="1" AcceptedAnswerId="22150" CreationDate="2015-03-18T03:37:22.603" Score="0" ViewCount="1505" Body="&lt;p&gt;I'm trying to remove what looks like a checkered noise pattern that has been added to an image. Comparing the 2D FFTs &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hH7bm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one on the left is the original, while the middle one is the corrupted one.&#xA;I've been trying to remove the added bright spots on the diagonals. The far right FFT is my attempt at isolating the diagonals, which I did with an X shaped filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[f1,f2] = freqspace(300,'meshgrid');&#xA;Hd = zeros(300);&#xA;d = f1 + f2 == 2 * f1;&#xA;f = f1 + f2 == 0;&#xA;d = f | d;&#xA;d = logical(d);&#xA;Hd(d) = 0.75;&#xA;&#xA;h = fsamp2(Hd);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However I seem to be unable to isolate the features. Are there any known algorithms for such a process? Isolating directions or points on an FFT.&#xA;The MSE of the middle image is 0.0084 and the lowest I have gotten it to is 0.0031. With a combination of a low pass filter and a median filter. However the image was quite blurry and I don't think it would be possible to get it very close to the original after that much information loss.&#xA;This is a HW question, so please only give hints.&#xA;Here are the two images, noisy and original in that order&#xA;&lt;img src=&quot;https://i.stack.imgur.com/IAX8x.png&quot; alt=&quot;noisy&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qIzvF.png&quot; alt=&quot;original&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5151" LastEditorUserId="128" LastEditDate="2019-06-24T18:03:14.093" LastActivityDate="2019-06-24T18:03:14.093" Title="Remove Checkered Noise (Pattern) from an Image" Tags="|image-processing|matlab|fft|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22150" PostTypeId="2" ParentId="22149" CreationDate="2015-03-18T07:07:59.747" Score="0" Body="&lt;p&gt;You could model the FFT probabilistically and use your prior knowledge about the FFTs of natural images, such as the one of the left, to model a prior distribution with which to form a MAP estimate.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2015-03-18T07:07:59.747" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22151" PostTypeId="1" CreationDate="2015-03-18T08:01:23.013" Score="2" ViewCount="316" Body="&lt;p&gt;Looking at DVB-T2 technical specifications I see that sub-carriers spacing has, in the worst case, a value of few hundred hertz, (something like 279 Hz). 32K sub-carriers are used to reach such a low value. I suppose that complex PAPR reduction algorithms plus strong constraints for carrier frequency stability are needed to deal with this number of sub-carriers and frequency spacing. On the other hand, I don't expect that the channel's frequency response would change significantly over few hundreds hertz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the reasons why such a high value of sub-carriers is used?&lt;/p&gt;&#xA;" OwnerUserId="10617" LastEditorUserId="10617" LastEditDate="2015-03-20T07:50:06.353" LastActivityDate="2022-03-12T15:00:25.100" Title="Sub-carriers spacing in DVB-T2" Tags="|digital-communications|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22152" PostTypeId="1" CreationDate="2015-03-18T08:50:40.080" Score="0" ViewCount="213" Body="&lt;p&gt;Why we take different MFCC components in different programs? Suppose, in a program we take No. of &lt;code&gt;mfcc components = 14&lt;/code&gt;.What does it signify?&lt;/p&gt;&#xA;" OwnerUserId="15084" LastEditorUserId="7092" LastEditDate="2015-03-18T13:28:29.747" LastActivityDate="2016-10-09T03:51:17.923" Title="Why we take different mfcc components in different programs?" Tags="|mfcc|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22153" PostTypeId="2" ParentId="22152" CreationDate="2015-03-18T09:07:29.313" Score="1" Body="&lt;p&gt;The number of coefficients is just one of the many parameters to tweak when designing a classifier. For speech analysis it turned out that usually 8-14 coefficients are sufficient, and increasing the number of coefficients beyond 14 does not improve the performance for most applications. The exact number you choose will depend on your task at hand. Most systems I've worked with used 12 coefficients, and that was for speech recognition. If you're not sure, you can simply run some experiments and change the number of MFCCs in a reasonable range to see the effect it has for your application. But I have no doubt that you'll end up in the range that I've mentioned above.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-18T09:07:29.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22154" PostTypeId="1" AcceptedAnswerId="23244" CreationDate="2015-03-18T11:19:36.503" Score="0" ViewCount="985" Body="&lt;p&gt;I have question regarding Rician fading simulation. I am trying to develop Rician fading channel simulator in LabVIEW, but I ran into some problems. I have complex sinusoid as my line-of-signs signal. Then I generated white gaussian noise samples for I and Q components which represent one scatered wave. I added this scattered wave to my LoS sinusoid. According to &lt;a href=&quot;http://en.wikipedia.org/wiki/Rice_distribution&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Rician distribution wiki page&quot;&gt;this&lt;/a&gt; I should get a faded signal with folowing amplitude distribution at different signal amplitudes:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Rice_distributiona_PDF.png/1280px-Rice_distributiona_PDF.png&quot; alt=&quot;Rcician distribution&quot;&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;When I calculate amplitude and its distribution with histogram I get following result:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;img src=&quot;https://i.stack.imgur.com/j3mLI.png&quot; alt=&quot;Calculated amplitude distribution&quot;&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I am using the same amplitude values and sigma value. There is significant difference in these results and my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What could be the problem here?&lt;/li&gt;&#xA;&lt;li&gt;If I make multiple scatered waves, will it make difference?&lt;/li&gt;&#xA;&lt;li&gt;Do I need to take into account Rician factor and somehow scale power of generated scatered waves?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15077" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:36.297" LastActivityDate="2015-05-07T12:46:32.253" Title="Amplitude distribution of Rician faded complex signal" Tags="|fading-channel|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22156" PostTypeId="2" ParentId="19953" CreationDate="2015-03-18T11:59:48.293" Score="0" Body="&lt;p&gt;The $90$ degree shift introduces the sine component to the cross-correlation vector $P$ at lag 1 ($\phi_{dx}(1)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The block should be considered to be a 'high-level' description, and does not mean that a shift of one sample is equivalent to  a $90$ degree phase shift, or anything like that. Rather it should be thought of as &quot;shift by as many samples as necessary for a phase shift of $90$ degrees&quot;. &lt;/p&gt;&#xA;" OwnerUserId="8165" LastEditorUserId="7092" LastEditDate="2015-03-18T13:23:40.533" LastActivityDate="2015-03-18T13:23:40.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22157" PostTypeId="1" AcceptedAnswerId="22406" CreationDate="2015-03-18T12:06:01.770" Score="0" ViewCount="1528" Body="&lt;p&gt;After reading the paper &lt;a href=&quot;http://digitus.itk.ppke.hu/~matyi/optika/Phase_Diversity/AO82_PRComparison.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Phase retrieval algorithms: a comparison&lt;/em&gt;&lt;/a&gt; by J.R.Fienup. I implemented the &lt;em&gt;Error-Reduction Algorithm&lt;/em&gt; in MATLAB. The initial phase input was randomly generated, so the final recovered image in each execution is different. The only information given is the Fourier Modulus of the original image.&lt;br/&gt;&#xA;Sometimes I can get a pretty well result, but most of the time the result is a fragmented version of the original image as the figures below shown:&lt;br/&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/R9lxg.png&quot; alt=&quot;The Recovered Image&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/3AG8Q.png&quot; alt=&quot;The Original Image:$\pi$&quot;&gt; &lt;br/&gt;&#xA;As you can see, the image of $\pi$ is &quot;almost&quot; recovered except that the head and the body of $\pi$ had been cut and swapped. &lt;br/&gt;&#xA;&lt;strong&gt;My questions&lt;/strong&gt; are:&lt;br/&gt;&#xA;1. Is this a common problem using phase retrieval algorithm? What causes this?&lt;br/&gt;&#xA;2. Is there any method to avoid this?&lt;br/&gt;&#xA;3. Is there any other great methods in phase retrieval?&lt;/p&gt;&#xA;" OwnerUserId="15086" LastEditorUserId="7092" LastEditDate="2015-03-18T13:24:32.293" LastActivityDate="2015-03-28T20:41:48.950" Title="Fragmented recovered image using a Phase Retrieval Algorithm named Error-Reduction" Tags="|image-processing|matlab|algorithms|phase|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22158" PostTypeId="2" ParentId="22106" CreationDate="2015-03-18T12:40:35.950" Score="1" Body="&lt;p&gt;Let's assume for a moment that the $X_k$ are time-continous, i.e. analog, signals $X_k(t)$. Let $x_k(t)$ be the summand signals of $v(t)$:&#xA;$$&#xA;x_k(t) = X_k(t)\exp(j2\pi k t/T) \tag{1}&#xA;$$&#xA;To form an orthogonal frequency division multiplex (OFDM) signal, the functions $x_k(t)$ must be pairwise orthogonal, i.e.&#xA;$$&#xA;\int x_n(t)x^*_m(t) \mathrm d t = C \delta(n-m) \tag{2}&#xA;$$&#xA;must hold, where $\delta(0) = 1$ and zero otherwise, and $C$ is an arbitrary constant. Plugging (1) into the l.h.s. of (2) we get&#xA;$$&#xA;\int X_n(t)X^*_m(t)\exp(j2\pi(n-m)t/T) \mathrm dt = C \delta(n-m) \tag{3}&#xA;$$&#xA;It's clear, that generally the condition in (3) is not fulfilled. For example for $n=m$, (3) becomes&#xA;$$&#xA;\int X_n(t)X^*_m(t) \mathrm dt = C\tag{4}&#xA;$$&#xA;which is generally &lt;em&gt;not&lt;/em&gt; true. One possible set of functions $X_k(t)$ that fulfills (4) is: $X_k(t) = \text{const. }$ in the interval $[0,T]$ and zero otherwise - which is a time-discret signal. Assuming such a set of signals will also fulfill (3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion, arbitrary analog signals cannot be used for OFDM modulation because they violate the orthogonality condition. In contrast, discrete-time signals do fulfill this condition.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-03-18T12:40:35.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22160" PostTypeId="1" CreationDate="2015-03-18T16:03:09.300" Score="9" ViewCount="292" Body="&lt;p&gt;what reason could make the noise/effect in this image?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/b2Tbb.jpg&quot; alt=&quot;noisy image&quot;&gt;&#xA;Below is the original&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JLjAB.jpg&quot; alt=&quot;original&quot;&gt;&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15092" LastEditorUserId="7092" LastEditDate="2015-03-18T16:51:41.353" LastActivityDate="2016-11-05T15:45:21.320" Title="What is the type of noise in this image?" Tags="|noise|image-processing|frequency-domain|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22161" PostTypeId="1" AcceptedAnswerId="22162" CreationDate="2015-03-18T17:03:28.833" Score="0" ViewCount="184" Body="&lt;p&gt;I am trying to apply FFT on a time domain signal in C++, however I am having trouble with the imaginary part i.e square root of -1. In the FFT equation we have, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X =\frac{1}{2\pi}\int_a^b x(t) \ e^{-j\omega t} \ dt$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;we know that:&#xA;$$&#xA;e^{-j\omega t} = \cos(\omega t) - j\sin(\omega t) \tag{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we also know that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \ j = \sqrt{-1}\ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem :  I am trying to apply the fft equation on a signal and the problem of implementation arises when coding the equation(2) in C++. As, we know the value of $ \ j = \sqrt{-1}\ $ is infinite or if tried to solve using a calculator, we get a Math Error*. And so is my program giving an error and I'd like to get suggestions and advises on how to solve this issue and apply the FFT equation in C++.&lt;/p&gt;&#xA;" OwnerUserId="9152" LastEditorUserId="7092" LastEditDate="2015-03-18T18:25:30.453" LastActivityDate="2015-03-18T18:25:30.453" Title="How to implement the imaginary part of FFT equation applied to a signal in computer/C++?" Tags="|fft|c++|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22162" PostTypeId="2" ParentId="22161" CreationDate="2015-03-18T17:11:44.927" Score="3" Body="&lt;p&gt;In computer programs, complex numbers are usually represented by an array, field or vector containing two values: one value represents the real part, the other represents the imaginary part of the complex number. The imaginary unit itself is usually not represented at all, because this information would be redundant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative representation is to store the magnitude and phase angle of a complex number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically in C++, there is the class &lt;code&gt;complex&amp;lt;T&amp;gt;&lt;/code&gt; from the STL library that takes care of storing two values of type &lt;code&gt;T&lt;/code&gt; for every complex value. You should use that, it's part of the standard libraries.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-03-18T17:11:44.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22163" PostTypeId="2" ParentId="22144" CreationDate="2015-03-18T18:00:09.057" Score="2" Body="&lt;p&gt;So you have a complex impulse response, and the real and imaginary parts of each tap are modeled as i.i.d. zero mean Gaussian variables with variance $\sigma^2/2$ (correct me if I'm wrong). The DFT of the impulse response is a weighted sum of the filter taps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H[k]=\sum_{n=0}^{N-1}h[n]e^{-j2\pi nk/N}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I assume $N\ge L$ (where $L$ is the number of taps), and in Eq. (1) $h[n]=0$ for $n\ge L$. From (1) it follows that $H[k]$ is also a complex Gaussian RV with zero mean and with variance $L\sigma^2$ (the variance of the real and imaginary part is $L\sigma^2/2$, respectively). From this it follows that the magnitude $|H[k]|$ has a &lt;a href=&quot;http://en.wikipedia.org/wiki/Rayleigh_distribution&quot; rel=&quot;nofollow&quot;&gt;Rayleigh distribution&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_{|H|}(x)=\frac{2x}{L\sigma^2}e^{-x^2/(L\sigma^2)}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, accordingly, the squared magnitude $|H[k]|^2$ has an &lt;a href=&quot;http://en.wikipedia.org/wiki/Exponential_distribution&quot; rel=&quot;nofollow&quot;&gt;exponential distribution&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_{|H|^2}(x)=\lambda e^{-\lambda x},\quad x\ge 0\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $\lambda=1/(L\sigma^2)$, i.e. with mean $1/\lambda=L\sigma^2$, and variance $1/\lambda^2=L^2\sigma^4$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-18T21:08:18.200" LastActivityDate="2015-03-18T21:08:18.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22164" PostTypeId="1" CreationDate="2015-03-18T18:03:10.743" Score="1" ViewCount="39" Body="&lt;p&gt;So I have an image.&#xA;I take it into HSV format and &lt;code&gt;v&lt;/code&gt; has its intensity values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now the intensity values of &lt;code&gt;v&lt;/code&gt; vary from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt; (Black to White)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to divide &lt;code&gt;v&lt;/code&gt; into 3 parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1] &lt;code&gt;v1=&lt;/code&gt; with intensity values &lt;code&gt;0&amp;lt;v&amp;lt;0.3&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2] &lt;code&gt;v2=&lt;/code&gt; with intensity values &lt;code&gt;0.3&amp;lt;v&amp;lt;0.75&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3] &lt;code&gt;v3=&lt;/code&gt; with intensity values &lt;code&gt;0.75&amp;lt;v&amp;lt;0.1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do this?&lt;/p&gt;&#xA;" OwnerUserId="15095" LastEditorUserId="7092" LastEditDate="2015-03-18T18:23:51.393" LastActivityDate="2015-04-18T00:25:02.233" Title="Dark image separation" Tags="|matlab|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22166" PostTypeId="2" ParentId="22145" CreationDate="2015-03-18T18:47:41.893" Score="1" Body="&lt;p&gt;FFT convolution of real signals is very easy. Multiplication in the frequency domain is equivalent to convolution in the time domain. The important thing to remember however, is that you are multiplying complex numbers, and therefore, you must to a &quot;complex multiplication&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will provide some C source for this below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the steps are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Do an FFT of your filter kernel,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do an FFT of your &quot;dry&quot; signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;do a complex multiply of the two spectra&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform the inverse FFT of this new spectrum.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course if you want to do continuous processing of lenghty signals, then you will need to use the overlap-add or overlap-save method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using real signals only, on an Intel format (little endian) machine, you can use Surreall FFT plus the multiply function I give below that is in the correct format for the data order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define F_TYPE float;&#xA;&#xA;void CompMulR(F_TYPE a[],F_TYPE b[],F_TYPE res[],long n)&#xA;  {&#xA;  long i;&#xA;  for(i=0;i&amp;lt;n;i++)&#xA;    {&#xA;    if(i&amp;lt;2)&#xA;      res[i]=a[i]*b[i]; // DC &amp;amp; NQ are not complex&#xA;    else&#xA;      {&#xA;      if((i&amp;amp;1)==0)&#xA;        {//real&#xA;        res[i]= a[i]*b[i] - a[i+1]*b[i+1];&#xA;        }&#xA;      else&#xA;        {//img.&#xA;        res[i]= a[i]*b[i-1] + a[i-1]*b[i];&#xA;        }&#xA;      }&#xA;    }&#xA;  }&#xA;&#xA;&#xA;&#xA;#define N 1024&#xA;F_TYPE TimeDom [N];&#xA;F_TYPE FrqDom [N];&#xA;F_TYPE FrqDom2 [N];&#xA;F_TYPE Twidds[N/4];&#xA;&#xA;InitFFT(N, Twidds); //Initialse the twiddle factors&#xA;FFT(TimeDom,FrqDom,N,Twidds); // do a forward transform&#xA;CompMulR(TimeDom,FrqDom,FrqDom2[],N);//do a complex multiply &#xA;IFFT(TimeDom,FrqDom2,N,Twidds); // do an inverse transform &#xA;//TimeDom now holds the convolution of the 2 signals&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code for the FFT is here:&#xA;&lt;a href=&quot;http://ravellescientific.co.uk/sureal-fft/&quot; rel=&quot;nofollow&quot;&gt;http://ravellescientific.co.uk/sureal-fft/&lt;/a&gt;&#xA;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="15096" LastEditorUserId="15096" LastEditDate="2015-03-18T21:54:18.873" LastActivityDate="2015-03-18T21:54:18.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22167" PostTypeId="1" AcceptedAnswerId="22571" CreationDate="2015-03-18T18:55:02.723" Score="4" ViewCount="261" Body="&lt;p&gt;Question:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formulating a Maximum likelihood estimator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the likelihood will be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p(y;\mathbf{h}) = \frac{1}{{(2 \pi \sigma_\eta^2)}^{T/2}} \exp{(-(y - y_0(t))^2)/ 2\sigma_\eta^2}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I need to differentiate w.r.t the unknowns and equate to zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a nonlinear equation in $x$ and cannot be solved directly. Newton-Raphson is a method but it works only for very close initial guess to $x$ and $d$. So, Was thinking how to apply Expectation - Maximization. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if my approach is correct or not.&lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="5119" LastEditDate="2015-05-04T17:37:38.480" LastActivityDate="2015-05-04T17:37:38.480" Title="How to estimate for an exponential in WGN" Tags="|discrete-signals|estimation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22168" PostTypeId="2" ParentId="8539" CreationDate="2015-03-18T19:06:48.353" Score="2" Body="&lt;p&gt;It might not be so straight forward to simply take the derivative of the output from a lock-in amplifier. If you think about how a lock-in works, the final stage of a lock-in amplifier is the low-pass filter. So if you then simply take the sample-to-sample derivative, you will simply be undoing the work of the low-pass filter and getting noise. Instead, you need to decimate your time domain signal, and then take the derivative. &lt;/p&gt;&#xA;" OwnerUserId="15096" LastEditorUserId="7092" LastEditDate="2015-03-18T19:36:58.260" LastActivityDate="2015-03-18T19:36:58.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22170" PostTypeId="1" CreationDate="2015-03-18T21:01:58.647" Score="1" ViewCount="246" Body="&lt;p&gt;I want to write an algorithm to implement a pitch-shifter, like in this article: &lt;a href=&quot;http://www.guitarpitchshifter.com/matlab.html&quot; rel=&quot;nofollow&quot;&gt;http://www.guitarpitchshifter.com/matlab.html&lt;/a&gt;. And I need to do it in realtime, not with a signal already defined earlier. I don't understand if I need overlapping in STFT to play the sound back. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why can't I just record, say, 1024 samples, then process them and then output it and so on (without overlapping)? This seems to be easier to implement but I guess there is a reason they added an overlapping which I can't understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help me understand, is overlapping needed in there? And if yes, why?&lt;/p&gt;&#xA;" OwnerUserId="15098" LastActivityDate="2015-03-18T22:37:53.723" Title="Do I need an overlapping in STFT if I want to play the signal back?" Tags="|fft|audio|frequency-spectrum|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22171" PostTypeId="2" ParentId="22164" CreationDate="2015-03-18T22:03:47.957" Score="2" Body="&lt;p&gt;All you need to do is masking on your &lt;code&gt;v&lt;/code&gt; we remember and image is a [rows,cols,layers] matrix, where the layers are Hue=1,saturation=2,intensity value=3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then create a mask (array of 0s and 1s). For example your first range would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v1 = (hsv_im(:,:,v_idx) &amp;lt;0.3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we are taking the all rows, all columns, of layer v, and if the value is &amp;lt;0.3 make it 1, otherwise make it 0. Now to see only those pixels we can multiply the original value array by our mask.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hsv_im(:,:,v_idx) = v0.*v1_mask;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you recall any value &gt;0.3 was 0 in our mask, so all the other areas will be blacked out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here is a full example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = imread('flower.jpg');&#xA;hsv_im = rgb2hsv(im);&#xA;v_idx =3; &#xA;&#xA;v0 = (hsv_im(:,:,v_idx));    %the original&#xA;v1_mask = (hsv_im(:,:,v_idx) &amp;lt;0.3);&#xA;v2_mask = (hsv_im(:,:,v_idx) &amp;lt;=0.3 &amp;amp; hsv_im(:,:,v_idx) &amp;lt;0.75);&#xA;v3_mask = (hsv_im(:,:,v_idx) &amp;gt;= .75);&#xA;&#xA;%plots the images&#xA;figure(1);&#xA;subplot(2,2,1);imshow(hsv2rgb(hsv_im));title('original')&#xA;&#xA;hsv_im(:,:,v_idx) = v0.*v1_mask;&#xA;subplot(2,2,2);imshow(hsv2rgb(hsv_im));title('0.00&amp;lt; v&amp;lt;0.30')&#xA;&#xA;hsv_im(:,:,v_idx) = v0.*v2_mask;&#xA;subplot(2,2,3);imshow(hsv2rgb(hsv_im));title('0.30&amp;lt;=v&amp;lt;0.75')&#xA;&#xA;hsv_im(:,:,v_idx) = v0.*v3_mask;&#xA;subplot(2,2,4);imshow(hsv2rgb(hsv_im));title('0.75&amp;lt;=v&amp;lt;1.00')&#xA;&#xA;%plots the masks&#xA;figure(2)&#xA;subplot(2,2,1);imshow(v0);title('original v')&#xA;subplot(2,2,2);imshow(v1);title('0.00&amp;lt; v&amp;lt;0.30 mask')&#xA;subplot(2,2,3);imshow(v2);title('0.30&amp;lt;=v&amp;lt;0.75 mask')&#xA;subplot(2,2,4);imshow(v3);title('0.75&amp;lt;=v&amp;lt;= 1  mask')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zAVRq.jpg&quot; alt=&quot;the original image showing only the regions that match the search criteria&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/h0hek.jpg&quot; alt=&quot;the masks for each of the 3 v ranges&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="7092" LastEditDate="2015-03-18T23:53:09.107" LastActivityDate="2015-03-18T23:53:09.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22172" PostTypeId="1" CreationDate="2015-03-18T22:16:16.433" Score="1" ViewCount="744" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5xbQX.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;The plot of the data from the wav file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link to the sound file - &lt;a href=&quot;https://drive.google.com/open?id=0BxAPlY66uX7qWWtDZUw3WkpjSGs&amp;amp;authuser=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://drive.google.com/open?id=0BxAPlY66uX7qWWtDZUw3WkpjSGs&amp;amp;authuser=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the FFT plot is like this&lt;img src=&quot;https://i.stack.imgur.com/3lQG0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to the field of digital signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a &lt;code&gt;.wav&lt;/code&gt; file in which I have recorded the breathing sound in a closed environment. I am trying to figure out what kind of technique I can apply to process the &lt;code&gt;.wav&lt;/code&gt; file to get meaningful information like the number of inhales/exhales. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read the file in python using &lt;code&gt;Scipy&lt;/code&gt; library and plotted the data. Also I have applied Fast Fourier Transformation to plot the frequency amplitudes. At this point I am feeling lost, how could I get meaningful information like the number of exhales/inhales?&lt;/p&gt;&#xA;" OwnerUserId="15099" LastEditorUserId="15099" LastEditDate="2015-03-22T02:11:04.987" LastActivityDate="2015-03-22T02:11:04.987" Title="How to process the .wav file to get meaningful information like the number of inhales/exhales" Tags="|fft|filters|signal-analysis|python|sound|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22173" PostTypeId="2" ParentId="22170" CreationDate="2015-03-18T22:37:53.723" Score="2" Body="&lt;p&gt;Note that the algorithm in the article uses a windowed FFT for analysis.  Window functions help avoid certain FFT artifacts, but they strongly attenuate any signal at the ends of the window.  So if you don't overlap, almost all the audio (any pitch changes, etc.) at both edges of each window would be lost, and you would end up with a choppy re-synthesized result.  Also, the window function usually peaks in the middle of the window, and is thus produces more accurate analysis there.  So the closer together the window centers, the more accurate the analysis involved in the pitch shift algorithm.  But the window needs to be longer than this distance for accuracy in frequency estimation.  Thus the overlap of 75% instead of just 50% in the article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Synthesis for playback often involves the phase vocoder algorithm plus cross-fading of overlapped windows to avoid discontinuity ticks and other glitches at the synthesis window boundaries.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-18T22:37:53.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22175" PostTypeId="1" CreationDate="2015-03-19T00:38:32.130" Score="4" ViewCount="20574" Body="&lt;p&gt;I'm new to DSP and I have a wav file with a number of different frequencies playing at different volumes. I'd like to plot the power of the 350Hz frequency signal at each point in time. The source is rotating so should see the power rising and falling periodically. To start with I broke the signal up into windows and then implemented Geortzel's algorithm (from Wikipedia). This seems to work: &lt;a href=&quot;https://www.dropbox.com/s/aq1aigdx8dq306q/Screenshot%202015-03-18%2017.38.20.png?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/aq1aigdx8dq306q/Screenshot%202015-03-18%2017.38.20.png?dl=0&lt;/a&gt; but for different window length and window overlaps I get different plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love some guidance on what the correct way to choose the window length and the amount by which each window overlap is? &lt;code&gt;window_length&lt;/code&gt; and &lt;code&gt;window_skip&lt;/code&gt; in the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also should the windows be processed (i.e. convolved with a window function like Hanning) I've read about this but I'm not clear on what this would do to the output, nor how to choose the length of the window function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the audio file: &lt;a href=&quot;https://www.dropbox.com/s/knvwqwg7s3mcz56/example.wav?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/knvwqwg7s3mcz56/example.wav?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code, comments welcome:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pylab&#xA;import scipy.io.wavfile&#xA;import numpy as np&#xA;import math&#xA;&#xA;def goetrzel(data, target_frequency):&#xA;        s_prev = 0&#xA;        s_prev2 = 0&#xA;        normalized_frequency = 2.0 * np.pi * target_frequency / len(data)&#xA;        coeff = 2.0 * np.cos(normalized_frequency)&#xA;        for sample in data:&#xA;                s = sample + coeff * s_prev - s_prev2&#xA;                s_prev2 = s_prev&#xA;                s_prev = s&#xA;                power = s_prev2 * s_prev2 + s_prev * s_prev - coeff * s_prev * s_prev2&#xA;        return power&#xA;&#xA;def sliding_window(data, length, skip=None):&#xA;        if skip is None:&#xA;                skip = length&#xA;        n = len(data)&#xA;        for i in range(0, n - int(length), int(skip)):&#xA;                yield data[i:i+length]&#xA;&#xA;detect_frequency = 350.0&#xA;#detect_frequency = 485.0&#xA;#detect_frequency = 633.0&#xA;#detect_frequency = 796.0&#xA;&#xA;rate, data = scipy.io.wavfile.read('example.wav')&#xA;&#xA;window_length = 2 * detect_frequency # How should I pick this?&#xA;window_skip = window_length # How should I pick this?&#xA;&#xA;power = [goetrzel(window, detect_frequency) for window in sliding_window(data, window_length, window_skip)]&#xA;pylab.figure()&#xA;pylab.plot(power)&#xA;pylab.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4021" LastActivityDate="2015-07-27T00:00:52.863" Title="How should I select window size and overlap?" Tags="|fft|python|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22178" PostTypeId="2" ParentId="22099" CreationDate="2015-03-19T03:45:49.783" Score="2" Body="&lt;p&gt;You can use &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow&quot;&gt;Hough transform&lt;/a&gt; in the frequency domain to detect straight lines and measure their angles. &lt;/p&gt;&#xA;" OwnerUserId="15103" LastEditorUserId="7092" LastEditDate="2015-03-19T03:59:31.170" LastActivityDate="2015-03-19T03:59:31.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22179" PostTypeId="2" ParentId="22110" CreationDate="2015-03-19T04:19:00.967" Score="1" Body="&lt;p&gt;If you'd like to design IIR, use pole-zero placement method. That's what people used before dsp toolboxes emerged.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-03-19T04:19:00.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22180" PostTypeId="2" ParentId="11008" CreationDate="2015-03-19T05:58:12.110" Score="5" Body="&lt;p&gt;&lt;a href=&quot;http://www.dspguide.com/CH32.PDF&quot; rel=&quot;noreferrer&quot;&gt;The best intuitive description&lt;/a&gt; of Laplace transform I've ever seen:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;At first glance, it would appear that the strategy of the Laplace transform is the same as the Fourier transform: correlate the time domain signal with a set of basis functions to decompose the waveform. Not true! Even though the mathematics is much the same, the rationale behind the two techniques is very different.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The Laplace transform can be viewed as probing the system's impulse response with various exponentially decaying sinusoids. Probing waveforms that produce a cancellation are called poles and zeros.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows us instead of describing frequency response for every $\omega$ use a small set of feature points that determine the behavior of a system in all other points (including the part of $s$-plane $s=j\omega$ which is a frequency response).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a nice analogy for this in a book:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Now, think about how you understand the relationship between elevation and&#xA;distance along the train route, compared to that of the conductor. Since you&#xA;have directly measured the elevation along the way, you can rightly claim that you know everything about the relationship. In comparison, the conductor&#xA;knows this same complete information, but in a simpler and more intuitive&#xA;form: the location of the hills and valleys that cause the dips and humps along the path. While your description of the signal might consist of thousands of individual measurements, the conductor's description of the signal will contain only a few parameters.&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="15103" LastEditorUserId="-1" LastEditDate="2015-03-20T16:49:12.960" LastActivityDate="2015-03-20T16:49:12.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22181" PostTypeId="1" AcceptedAnswerId="22182" CreationDate="2015-03-19T09:21:08.343" Score="2" ViewCount="87" Body="&lt;p&gt;I could infer from books and wiki that a matching pursuit finds signal approximations from a redundant dictionary. Let f be the signal, ai be the basis and Ri be the residue.. here we choose the inner product of f and ai to be max such that Ri is less. What do we do next. what do we iterate?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6IieU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15105" LastActivityDate="2015-03-19T11:07:58.663" Title="How matching pusuit algorithm works" Tags="|wavelet|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22182" PostTypeId="2" ParentId="22181" CreationDate="2015-03-19T11:07:58.663" Score="1" Body="&lt;p&gt;The point is that the dictionary is redundant or overcomplete, i.e. there is no unique expansion of a given signal, unlike the expansion in an orthonormal basis. This means that one tries to find &quot;the best&quot; expansion of a given signal, e.g. such that the error between the signal and its expansion is small while most expansion coefficients are close to zero, which is advantageous for signal compression. The matching pursuit algorithm is an iterative algorithm trying to find an approximation of the best expansion of a signal given a dictionary. &lt;a href=&quot;http://www.scholarpedia.org/article/Matching_pursuit&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; you can find another useful overview of the matching pursuit algorithm.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-19T11:07:58.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22183" PostTypeId="1" CreationDate="2015-03-19T11:27:15.240" Score="2" ViewCount="100" Body="&lt;p&gt;I am trying to check whether this black circle is exist or not on my images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TC2ZF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current approach is like that;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Hough Circle detection&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Crop the outer roi   &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Adaptive threshold &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8ETdf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;count zero pixels &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if ( zero pixels &gt;500 ) &#xA;black hole exist &#xA;else &#xA;black hole does not. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I just want to know is this method useful if this algorithm go for real time check ? if not what kind of methods you could suggest me ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a image with blackhole &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xvr6E.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a image without a blackhole. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XVwSZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12210" LastEditorUserId="128" LastEditDate="2023-07-15T18:48:08.473" LastActivityDate="2023-12-12T21:03:50.397" Title="Primitive Feature Detection to Detect a Black Circle within an Image" Tags="|image-processing|matlab|opencv|detection|image-analysis|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22184" PostTypeId="2" ParentId="17868" CreationDate="2015-03-19T13:46:26.927" Score="1" Body="&lt;p&gt;You should consider doing an STFT on the accelerometer signal. This will allow you to visualize the frequency of the signal. If you can determine the frequency of the brakes, you should be able to set a threshold for that specific braking frequency and count each time it is exceeded. You would also be able to measure how long the braking occurs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are you processing your signal? Matlab and python have the specgram function, which will allow you to see the actual frequency braking. From there you will be able to determine the brake frequency as well as a threshold.&lt;/p&gt;&#xA;" OwnerUserId="11852" LastActivityDate="2015-03-19T13:46:26.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22185" PostTypeId="1" CreationDate="2015-03-19T16:16:01.917" Score="0" ViewCount="558" Body="&lt;p&gt;I have a biquad filter, configuread as a low-pass filter (using Zolzer's formulas, similar to &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow&quot;&gt;these&lt;/a&gt;). It does not overshoot and decays nicely in what I assume is -40dB/dec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I device a calculation, that takes not only &lt;code&gt;desired_cutoff_frequency&lt;/code&gt; as a parameter, but also &lt;code&gt;desired_decay_slope&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1575" LastEditorUserId="4298" LastEditDate="2015-03-20T07:55:05.463" LastActivityDate="2015-03-20T07:55:05.463" Title="How can slope of low-pass biquad be configured?" Tags="|filter-design|lowpass-filter|infinite-impulse-response|biquad|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22186" PostTypeId="1" AcceptedAnswerId="22190" CreationDate="2015-03-19T16:58:17.333" Score="2" ViewCount="240" Body="&lt;p&gt;I am given $|H(\omega)|$, I wonder if minimum phase stable causal filter is unique and how to calculate it. &lt;/p&gt;&#xA;" OwnerUserId="15111" LastEditorUserId="4298" LastEditDate="2018-08-15T17:00:19.513" LastActivityDate="2018-08-15T17:00:19.513" Title="Given Gain function, how to design a causal, stable and minimum phase IIR filter?" Tags="|filter-design|lowpass-filter|infinite-impulse-response|hilbert-transform|minimum-phase|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="22187" PostTypeId="1" AcceptedAnswerId="22195" CreationDate="2015-03-19T17:10:44.820" Score="0" ViewCount="1584" Body="&lt;p&gt;Please forgive my bad English.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hello, I'm trying to understand Shibatch's super equalizer Winamp plugin source,&#xA;but I'm not good at DSP and mathematics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that super equalizer plugin uses overlap-add method to evaluate FIR filter.&#xA;The code that calculates the FIR filter coefficients in super equalizer is like this:&#xA;(Just the simplified pseudocode... not the exact code.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int i = 0; i != FILTER_LENGTH; ++i)&#xA;{&#xA;    int t = i - FILTER_LENGTH / 2;&#xA;&#xA;    result[i] =&#xA;        band_gain[0] * LPF(t, band_freq[0]) +&#xA;        band_gain[1] * (LPF(t, band_freq[1]) - LPF(a, band_freq[0])) +&#xA;        band_gain[2] * (LPF(t, band_freq[2]) - LPF(a, band_freq[1])) +&#xA;        band_gain[3] * (LPF(t, band_freq[3]) - LPF(a, band_freq[2])) +&#xA;        band_gain[4] * (IMPULSE(t) - LPF(t, band_freq[3]));&#xA;&#xA;    result[i] *= WINDOW(t);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;LPF is lowpass filter function. &lt;code&gt;LPF(t, CutoffFrequency)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;IMPULSE(t)&lt;/code&gt; is 1 when &lt;code&gt;t&lt;/code&gt; is 0. Otherwise &lt;code&gt;IMPULSE(t)&lt;/code&gt; is 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;WINDOW(t)&lt;/code&gt; is Kaiser window function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;band_freq&lt;/code&gt; array contains equalizer frequency bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;band_gain&lt;/code&gt; array contains the weight of each frequency bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assumed there are just four frequency bands.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;band_gain[0] = weight of 0Hz ~ band_freq[0]Hz&#xA;band_gain[1] = weight of band_freq[0]Hz ~ band_freq[1]Hz&#xA;band_gain[2] = weight of band_freq[1]Hz ~ band_freq[2]Hz&#xA;band_gain[3] = weight of band_freq[2]Hz ~ band_freq[3]Hz&#xA;band_gain[4] = weight of band_freq[3]Hz ~ SAMPLING_RATE / 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to know this part:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result[i] =&#xA;    band_gain[0] * LPF(t, band_freq[0]) +&#xA;    band_gain[1] * (LPF(t, band_freq[1]) - LPF(a, band_freq[0])) +&#xA;    band_gain[2] * (LPF(t, band_freq[2]) - LPF(a, band_freq[1])) +&#xA;    band_gain[3] * (LPF(t, band_freq[3]) - LPF(a, band_freq[2])) +&#xA;    band_gain[4] * (IMPULSE(t) - LPF(t, band_freq[3]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What formula does the code using?&#xA;Or... what should I study to understand the code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any answer is welcome.&#xA;Keyword suggestion is welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15112" LastEditorUserId="7092" LastEditDate="2015-03-19T17:14:46.717" LastActivityDate="2015-03-19T21:23:15.183" Title="Help me understanding the super equalizer source code" Tags="|c|equalizer|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22188" PostTypeId="2" ParentId="22185" CreationDate="2015-03-19T17:26:14.120" Score="1" Body="&lt;p&gt;The decay is determined by the filter order. With a biquad (i.e., second order) filter you can't get more than approximately 40dB/decade (unless you're close to the Nyquist frequency where the frequency response has its zero). You can have less if you like, but not more. If you want less, then the only way to do that is to approximate a given slope by using some optimization method.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-19T20:45:22.577" LastActivityDate="2015-03-19T20:45:22.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22189" PostTypeId="1" CreationDate="2015-03-19T17:34:59.030" Score="1" ViewCount="2820" Body="&lt;p&gt;I am trying to develop an application which records the voice of someone through a microphone. I will have a preset recorded voices for the same words. I then need to compare the real time recorded voice with the list of recorded voices and output a similarity in percentage format. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did a lot of literature research about this and I found that it can be done using several algorithms such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;FFT&lt;/li&gt;&#xA;&lt;li&gt;MFCC&lt;/li&gt;&#xA;&lt;li&gt;Cross-Correlation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My question is can this be done using JavaScript, PHP, MySQL ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do I need to program this using Java or any other language? I really need some guidance in what to start looking for in order to start developing something and make it work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not want to use any system that provides Text-To-Speech or vice versa. I purely want to analyse and compare audio files. This system will be used to aid people with speech disability so they wouldn't exactly know how to pronounce the exact words&lt;/p&gt;&#xA;" OwnerUserId="15113" LastEditorUserId="7092" LastEditDate="2015-03-19T17:45:24.303" LastActivityDate="2015-03-19T17:45:24.303" Title="Compare two voices and outline their similarity" Tags="|fft|cross-correlation|mfcc|java|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22190" PostTypeId="2" ParentId="22186" CreationDate="2015-03-19T17:36:26.343" Score="2" Body="&lt;p&gt;If $H(\omega)=e^{\alpha(\omega)+j\phi(\omega)}$ is a minimum phase frequency response, then the attenuation $\alpha(\omega)$ and the phase $\phi(\omega)$ are related by the following &lt;a href=&quot;http://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow&quot;&gt;Hilbert transform&lt;/a&gt; relationship:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi(\omega)=-\frac{1}{\pi}\int_{-\infty}^{\infty}\frac{\alpha(\Omega)}{\omega-\Omega}d\Omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $\phi(\omega)$ is uniquely determined by $\alpha(\omega)$. &lt;a href=&quot;http://en.wikipedia.org/wiki/Minimum_phase#Relationship_of_magnitude_response_to_phase_response&quot; rel=&quot;nofollow&quot;&gt;This&lt;/a&gt; is the corresponding wikipedia entry.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-19T17:54:50.323" LastActivityDate="2015-03-19T17:54:50.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22191" PostTypeId="2" ParentId="22110" CreationDate="2015-03-19T19:28:36.080" Score="1" Body="&lt;p&gt;A crude approach do design an IIR filter for a single frequency $\omega, 0 \le \omega \le 1$ would be as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Placing poles at $ \exp(\pm j \pi \omega)$ would give infinite gain for that frequency, so move them &quot;a bit&quot; inside to a radius $&amp;lt; 1$, say, $r$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Place zeros at $\pm 1$ to &quot;guarantee&quot; a bandpass filter&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Place zeros at other positions on the unit circle to increase the attenuation&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Figure out the gain at $\omega$, where it would/should be the highest, and compensate for that&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For your example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;omega = 656/(1000000)/2;&#xA;r = 0.99;&#xA;b = conv([1 -1], [1 1]);&#xA;a = conv([1 -r*exp(j*pi*omega)],[1 -r*exp(-j*pi*omega)]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will form a start. Considering that the 1X frequency is rather low, you could add a number of zeros at some higher frequencies:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;zerof = 0.1; % Corresponding to 50000 Hz&#xA;b = conv(b, conv([1 -exp(j*pi*zerof)],[1 -exp(-j*pi*zerof)]));&#xA;zerof = 0.5; % Corresponding to 250000 Hz&#xA;b = conv(b, conv([1 -exp(j*pi*zerof)],[1 -exp(-j*pi*zerof)]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and multiple poles at the wanted frequency;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = conv(a,a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you are happy, you just need to figure out the gain and compensate for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This filter has about 80 dB attenuation for frequencies of 50000 Hz and higher (as someone pointed out, the sampling frequency is really high if correct).&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-03-19T19:28:36.080" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22192" PostTypeId="2" ParentId="22110" CreationDate="2015-03-19T20:35:05.583" Score="0" Body="&lt;p&gt;If you know how to design and apply Kaiser window, i would aim for a brickwall bandpass that might have (symmetrical and non-causal) impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h[n] = \cos(\omega_0 n) \cdot \frac{\sin(\omega_1 n/2)}{\omega_1 n/2} \quad \forall n \in \mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assuming $0 &amp;lt; \omega_1 &amp;lt; \omega_0$, the bandedges should be at $\omega_0 \pm \omega_1$.  the number of samples of $h[n]$ to keep and the &quot;$\beta$ factor&quot; for the Kaiser window would be things you have to fiddle with.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-19T20:35:05.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22194" PostTypeId="1" CreationDate="2015-03-19T21:06:41.423" Score="2" ViewCount="596" Body="&lt;p&gt;I have an image with few pixels in length and height. For this image I calculated the two dimensional Fourier transformation. What I got for the frequency spectrum in one direction was a very frequency spectrum with very few points (no continuous first derivation). &#xA;To increase the number of points of the frequency spectrum, I used a window function, in my case a Hanning-filter/rectangular filter with zeros outside of the picture so that the filtered picture has much more pixels in length (horizontal) and height (vertical). This resulted in a frequency spectrum with more points so that the frequnecy spectrum in e. g. the horizontal direction looked more continuous but there were in contrast to the unfiltered image higher peaks for low frequencies. What I want to do now is to find a possibility to reduce that.&#xA;My approach was the convolution theorem (but I have no idea how to use it in two dimensions) which says, that $F(f) * F(g)$ = const $F(gf)$. I have $f$ (original image) and $g$ (multiplication by rectangular window: some $1$ in the centre, $0$ outside it) and in that way the fourier spectrum that I get is $F(gf)$. To get $F(f)$ I have to deconvolve $F(f)$ and $F(g)$. &#xA;But the problems are at first:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Holds the convolution theorem for this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Will the matrix $F(f)$ that I will finally get, the same that I got by Fourier transformation without the window function of the rectangular but with more points in the frequency spectrum? In other words, will it reduce effectively the influence of the filter in the frequency spectrum?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there an effective way to calculate the deconvolution with e.g. matlab?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If there are problems, is there an alternative way to increase the number of points in the frequency spectrum without changing it at all? If not, how can I fit the points in the frequency spectrum in the best way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be very grateful for any helpful hints.&lt;/p&gt;&#xA;" OwnerUserId="15116" LastEditorUserId="7092" LastEditDate="2015-03-19T21:23:08.483" LastActivityDate="2021-08-17T21:07:00.930" Title="Increasing the number of points in the frequency spectrum" Tags="|frequency-spectrum|convolution|window-functions|fourier|deconvolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22195" PostTypeId="2" ParentId="22187" CreationDate="2015-03-19T21:23:15.183" Score="2" Body="&lt;pre&gt;&lt;code&gt;result[i] =&#xA;band_gain[0] * LPF(t, band_freq[0]) +&#xA;band_gain[1] * (LPF(t, band_freq[1]) - LPF(a, band_freq[0])) +&#xA;band_gain[2] * (LPF(t, band_freq[2]) - LPF(a, band_freq[1])) +&#xA;band_gain[3] * (LPF(t, band_freq[3]) - LPF(a, band_freq[2])) +&#xA;band_gain[4] * (IMPULSE(t) - LPF(t, band_freq[3]));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is actually very simple to explain with pictures. First we assume f0 &amp;lt; f1 &amp;lt; f2 &amp;lt; f3.... lets look at one section&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;band_gain[0] * LPF(t, band_freq[0])&lt;/code&gt; means create a low pass filter with cutoff frequency &lt;code&gt;band_freq[0]&lt;/code&gt; it then says to multiply the amplitude of the filter by &lt;code&gt;band_gain[0]&lt;/code&gt; something like this&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7cw9r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now lets move onto the more complicated lines&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;band_gain[1] * (LPF(t, band_freq[1]) - LPF(a, band_freq[0]))&lt;/code&gt; means make a LPF with Cutoff &lt;code&gt;band_freq[1]&lt;/code&gt; then subtract from it a LPF with cutoff &lt;code&gt;band_freq[0]&lt;/code&gt; if you look at the image below thats the pink section. Then you multiply the result by `band_gain&lt;a href=&quot;https://i.stack.imgur.com/7cw9r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;'&#xA; &lt;img src=&quot;https://i.stack.imgur.com/VLaiK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can find the other bands in a similar fashion . Now lets add them together, something like this, just 'superposition'&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nEAmK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which makes our final filter look roughly like this&#xA;&lt;img src=&quot;https://i.stack.imgur.com/JzGhq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope those pictures make sense&lt;/p&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2015-03-19T21:23:15.183" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22196" PostTypeId="2" ParentId="22194" CreationDate="2015-03-19T22:25:30.743" Score="1" Body="&lt;p&gt;You can also interpolate as many points as you need using a Sinc or windowed Sinc interpolation kernel.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-19T22:25:30.743" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22199" PostTypeId="1" AcceptedAnswerId="22205" CreationDate="2015-03-20T06:19:19.017" Score="1" ViewCount="240" Body="&lt;p&gt;I am doing digital signal processing for a software defined radio. I have a signal coming in packets of data (several samples) at an average sample rate of approximately some known value FSin. I am given a request for packets to be sent out periodically, with an average rate out of approximately FSout. If I knew these rates exactly I could resample my data by a ratio R=FSout/FSin and use a FIFO to make sure data always has somewhere to go when I get a packet and there's always data to send when I'm asked to send a packet. However, the clocks of the radio and my computer are not perfectly synchronized, so there is no exact known ratio for R. What would your solution be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I am thinking: I will have to adjust the ratio by which I resample over time to keep the size of the FIFO some target, on average. If my ratio goes too high, my buffer begins to grow and the latency gets large or it overflows, if I am using a circular buffer. If my ratio goes too high, my buffer begins to shrink and eventually underflows. I will periodically find the error between the number of elements in my buffer and the target size. The integral of this error over time, I, will be used to determine R by R=e^-I. The integrator will be set with its initial value I=-ln(R). If the buffer size drifts too high, I goes towards zero and R drops, shrinking the buffer. If it drifts too low, the opposite occurs. What do you think? Should I expect anything weird (oscillation through my feedback path, etc.)?&lt;/p&gt;&#xA;" OwnerUserId="1737" LastActivityDate="2015-04-19T16:35:47.997" Title="Resample with unknown rate change" Tags="|resampling|feedback|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22200" PostTypeId="1" CreationDate="2015-03-20T08:43:31.050" Score="3" ViewCount="803" Body="&lt;p&gt;Is there any algorithm for identifying the noise in an image&#xA;I have to identify whether the noise present in a mammogram image is guassian or salt&amp;amp; pepper.&lt;/p&gt;&#xA;" OwnerUserId="15119" LastEditorUserId="7092" LastEditDate="2015-03-20T19:35:44.523" LastActivityDate="2015-03-21T05:31:30.503" Title="How to find out whether guassian or salt&amp; pepper noise present in an image, Is there any algorithm" Tags="|noise|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22201" PostTypeId="1" CreationDate="2015-03-20T08:56:33.620" Score="1" ViewCount="153" Body="&lt;p&gt;I am implementing Perona-Malik Diffusion in using  the formulas:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/j5Nxa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating image at time k+1 using equation &#xA;&lt;img src=&quot;https://i.stack.imgur.com/Ld148.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my implementation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function gij=g(duij,lambda)&#xA;duij=-(duij.^2/lambda^2);&#xA;gij=exp(duij);&#xA;end&#xA;&#xA;function deltauij=gradMag(u)&#xA;xx=[u(:,2:end),u(:,end)]-[u(:,1),u(:,1:end-1)];      &#xA;yy=[u(2:end,:);u(end,:)]-[u(1,:);u(1:end-1,:)];&#xA;xx=(xx.^2)/4;&#xA;yy=(yy.^2)/4;&#xA;deltauij = xx+yy;&#xA;deltauij = sqrt(deltauij);&#xA;&#xA;function u=nld(u,delt,lambda,sigma)&#xA;&#xA;filt= fspecial('gaussian',[3*ceil(sigma),3*ceil(sigma)],sigma);&#xA;utemp=imfilter(u,filt);&#xA;deltauij=gradMag(utemp);&#xA;gm=g(deltauij,lambda);&#xA;uxyplus=[u(:,2:end),u(:,end)];&#xA;uxyminus=[u(:,1),u(:,1:end-1)];&#xA;uxplusy=[u(2:end,:);u(end,:)];&#xA;uxminusy=[u(1,:);u(1:end-1,:)];&#xA;&#xA;gxyplus=[gm(:,2:end),gm(:,end)];&#xA;gxyminus=[gm(:,1),gm(:,1:end-1)];&#xA;gxplusy=[gm(2:end,:);gm(end,:)];&#xA;gxminusy=[gm(1,:);gm(1:end-1,:)];&#xA;&#xA;xx=0.5*(gxplusy+gm).*(uxplusy-u)-0.5*(gxminusy+gm).*(u-uxminusy);&#xA;yy=0.5*(gxyplus+gm).*(uxyplus-u)-0.5*(gxyminus+gm).*(u-uxyminus);&#xA;ddu=xx+yy;&#xA;del = delt*ddu;&#xA;u=min(255,max(0,del+u));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I am calling iteratively  &lt;code&gt;I=nld_2(I,delta_t,lambda,sigma)&lt;/code&gt;&lt;br&gt;&#xA;I am calculating mean intensity value of image in every iteration.The result is quite weird .Mean vs iteration plot is lik this &lt;img src=&quot;https://i.stack.imgur.com/yWl2C.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is a smoothing operation I am expecting it to decrease mean intensity somehow but what I get is an increasing mean intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this normal or I am missing anything?&lt;/p&gt;&#xA;" OwnerUserId="12059" LastEditorUserId="7092" LastEditDate="2015-03-20T19:35:14.237" LastActivityDate="2015-03-20T19:35:14.237" Title="Effect of Gaussian Smoothing to mean image intensity" Tags="|matlab|gaussian|smoothing|anisotropic-diffusion|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22203" PostTypeId="2" ParentId="1932" CreationDate="2015-03-20T10:12:15.580" Score="1" Body="&lt;p&gt;I Will try this coding.But i don't have a correct answer...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;clear;&#xA;x=imread('base2.jpg');&#xA;size(x);&#xA;x=imresize(x,[500 800]);&#xA;figure;&#xA;imshow(x);&#xA;title('original image');&#xA;z=rgb2hsv(x);       %extract the value part of hsv plane&#xA;v=z(:,:,3);&#xA;v=imadjust(v);&#xA;m = mean(v(:))&#xA;s=std(v(:))&#xA;k=-2;&#xA;value=m+ k*s;&#xA;temp=v;&#xA;for p=1:1:500&#xA;    for q=1:1:800&#xA;        pixel=temp(p,q);&#xA;        if(pixel&amp;gt;value)&#xA;            temp(p,q)=1;&#xA;        else&#xA;            temp(p,q)=0;&#xA;        end&#xA;    end&#xA;end&#xA;figure;&#xA;imshow(temp);&#xA;title('result by niblack');&#xA;% k=kittlerMet(g);&#xA;% figure;&#xA;% imshow(k);&#xA;% title('result by kittlerMet');&#xA;&#xA;val2=m*(1+.1*((s/128)-1));&#xA;t2=v;&#xA;for p=1:1:500&#xA;for q=1:1:800&#xA;    pixel=t2(p,q);&#xA;    if(pixel&amp;gt;value)&#xA;        t2(p,q)=1;&#xA;    else&#xA;        t2(p,q)=0;&#xA;    end&#xA;end&#xA;&#xA;end&#xA;figure;&#xA;imshow(t2);&#xA;title('result by sauvola');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/w6UwZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bSRys.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15120" LastEditorUserId="1849" LastEditDate="2015-03-20T13:23:00.030" LastActivityDate="2015-03-20T13:23:00.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22204" PostTypeId="1" CreationDate="2015-03-20T15:14:35.003" Score="2" ViewCount="34" Body="&lt;p&gt;Assume you have 77777 pictures that are mostly noise. &#xA;They are about magnetic anisotropy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is one picture among these pictures which has high contrast difference between two large areas (some sort of magnetic gap because of magnetic anisotropy). &#xA;One area is gray and the other area is dark. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pictures are mostly like this (grey or dark)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UUFvd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kzk8f.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some dirty things in some pictures which are just rubbish on the lens. &#xA;So only big differences are essential. &#xA;Example what the contrast difference should look like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/au9qF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These pictures are about magnetic anisotrophy with Fe and Boron.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can you find the distinction among these 77777 pictures?&lt;/strong&gt;&lt;br&gt;&#xA;I have went through all of these pictures but my method is errorprone, since I just browse them through. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can you assist browsing the find the big and large contrast difference in pictures?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tool is ok for me: Matlab, Python, ..., pseudo-code too.&lt;/p&gt;&#xA;" OwnerUserId="5633" LastEditorUserId="5633" LastEditDate="2015-03-21T17:26:49.143" LastActivityDate="2015-03-21T17:26:49.143" Title="Find large distinctions in Video" Tags="|matlab|video-processing|video|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22205" PostTypeId="2" ParentId="22199" CreationDate="2015-03-20T15:58:21.387" Score="2" Body="&lt;p&gt;I have done this before and it works as long as you tune your parameters correctly. There should be a gain factor on the integrator which is &amp;lt; 1.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your application is audio, one thing to watch for is audible pitch changes during periods when the ratio is changing. You can add a proportional term to your loop filter to tune the transient response if this is an issue. &lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2015-03-20T15:58:21.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22206" PostTypeId="1" AcceptedAnswerId="22208" CreationDate="2015-03-20T18:39:56.783" Score="0" ViewCount="1147" Body="&lt;p&gt;I am making an low-frequency oscillator (LFO) that should be able to output different kinds of waveforms. &#xA;If I, say, want to be able to create a smooth transition from a sine wave to a square wave, what would the best approach be? &#xA;I have thought about creating several hardcoded lookup-tables and &quot;scroll&quot; between these, but I am worried about the transition not being smooth enough, unless there are many of these tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone knows about the best way/usual way to solve this problem, I would be happy to hear about it.&lt;/p&gt;&#xA;" OwnerUserId="15127" LastEditorUserId="15127" LastEditDate="2016-02-13T17:34:42.967" LastActivityDate="2016-02-13T17:34:42.967" Title="Best way to morph between waveforms" Tags="|oscillator|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22207" PostTypeId="1" CreationDate="2015-03-20T19:51:03.790" Score="2" ViewCount="364" Body="&lt;p&gt;Say I learned the theoretical result of continuous time Fourier transform. And I want to extends some results(say &quot;convolution rule&quot;) to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lapace transform, &#xA;Z transform,&#xA;DTFT,&#xA;DFT,&#xA;Fourier sequence etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then really, I just need to remember how one works and derive the rest. How to do this as a general principle? Is there any textbook that teaches this way? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15111" LastActivityDate="2017-03-12T22:01:37.920" Title="Can I study continuous time Fourier Transform and treat the rest as special cases" Tags="|fourier-transform|z-transform|fourier-series|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22208" PostTypeId="2" ParentId="22206" CreationDate="2015-03-20T20:13:42.433" Score="1" Body="&lt;p&gt;this is what we sometimes call &quot;Vector Synthesis&quot; and other times call &quot;Wavetable Synthesis&quot;.  linear crossfading between equal-sized circular lookup tables usually suffices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but make sure the waveforms are aligned.  you can circularly delay (or &quot;rotate&quot;) one lookup table relative to the other.  choose a relative rotation so that the cross-correlation between the two waveforms is maximum.  if you somehow crossfade between a sine wave and a square wave where the fundamental of the square wave is outa phase with the sine, you'll get a glitch in the crossfade.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-20T20:13:42.433" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22209" PostTypeId="1" CreationDate="2015-03-20T20:18:13.273" Score="1" ViewCount="1466" Body="&lt;p&gt;I want to write an algorithm to add pitch-shifted version of audio signal to itself (like Electro-Harmonix POG does). And I need to do it in realtime. How to implement it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is: break signal into pieces, get FFT of each piece, copy each of the frequencies in the original signal (for example, for 1 octave up shift copy 20hz to 40hz, 40hz to 80hz and so on), get the iFFT, play it back. But I don't know if I got the right idea. Will it work?&lt;/p&gt;&#xA;" OwnerUserId="15098" LastActivityDate="2015-04-17T11:07:22.387" Title="How to add pitch-shifted version of signal to itself?" Tags="|fft|audio|frequency-spectrum|pitch|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22211" PostTypeId="1" AcceptedAnswerId="28872" CreationDate="2015-03-20T22:50:28.513" Score="2" ViewCount="2274" Body="&lt;p&gt;As part of a research project, I have been tasked with determining gait speed (walking speed) for a subject using a handheld iPhone. The main constraint is that walking distances are very short (10-30 meters), and accuracy is critical (data is used for research.) Using a pedometer and measuring step distance is not an option (too time consuming.) The only plausible way I foresee this could be work is using accelerometer data. However, I'm not sure whether this will succeed. I was wondering if anyone has experience with these sensors and could answer the following two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Will an iPhone accelerometer plausibly be able to accurately measure walking distance for such short distances? Are there any figures on accelerometer accuracy for this kind of sensor? (I couldn't find any.)&lt;/li&gt;&#xA;&lt;li&gt;Are there any established protocols for converting accelerometer data into distance measurements (calibration, noise correction, sampling rates, etc.) that have been shown to have good accuracy for such short distances? I have been able to find this, &lt;a href=&quot;http://www.freescale.com/files/sensors/doc/app_note/AN3397.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.freescale.com/files/sensors/doc/app_note/AN3397.pdf&lt;/a&gt; but I'm not sure if this will apply well to the iPhone sensors.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10475" LastActivityDate="2016-02-14T20:53:09.867" Title="Measuring walking speed with iPhone accelerometer" Tags="|sensor|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22212" PostTypeId="2" ParentId="22209" CreationDate="2015-03-20T22:51:38.587" Score="2" Body="&lt;p&gt;okay, try googling &quot;pitch shifting AMDF&quot; or &quot;pitch shifting TDHS&quot; and see what you hit there.  also check out &lt;a href=&quot;http://blogs.zynaptiq.com/bernsee/time-pitch-overview/&quot; rel=&quot;nofollow&quot;&gt;DSP Dimension&lt;/a&gt; and maybe &lt;a href=&quot;http://musicdsp.org/&quot; rel=&quot;nofollow&quot;&gt;music-dsp&lt;/a&gt; and the &lt;a href=&quot;http://music.columbia.edu/cmc/music-dsp/&quot; rel=&quot;nofollow&quot;&gt;mailing list&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you need three concurrent processes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;a good pitch detector that gives you a good estimate of the period (to a precision of a fraction of a sample).  this period estimate should be updated as least as often as every 15 or 20 ms.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a real-time resampling and interpolation alg with a pointer that has precision at the fractional sample.  this pointer will have both integer and fractional parts, the integer part tells you where in your delay buffer you are interpolating, the fractional part tells you &lt;strong&gt;how&lt;/strong&gt; you're interpolating (like the interpolation coefficients).  try linear interpolation at first, it's easier and you can improve it later.  now this pointer will advance &lt;em&gt;faster&lt;/em&gt; than the write pointer for upshifting and &lt;em&gt;slower&lt;/em&gt; for downshifting.  either way, that pointer will run into the edge of the delay buffer (and glitch or click or pop when it wraps around) unless you do something about it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a splicing and crossfading alg that allows you to splice or seamlessly &quot;jump&quot; from one instantaneous pointer position in the delay buffer to another pointer position.  the difference between those two pointer positions should be one period as determined by your pitch detector.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;if i hint more than that, i might be spilling beans (internal trade secrets) from one manufacturer or another.  but this is the main idea.  think of splicing as necessary to time-scale the input (say time-expand if you're upshifting), and then step 2 is playing that time-expanded audio back &lt;em&gt;faster&lt;/em&gt; which both returns it to the original tempo, but bumps it up in pitch.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-20T22:51:38.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22213" PostTypeId="2" ParentId="22211" CreationDate="2015-03-20T23:38:45.480" Score="0" Body="&lt;p&gt;Using an accelerometer means you are doing integration and you will need as a tarter an accurate starting point (are you always starting from 0?) and than velocity. So I really think that you ask if you could use the distance measurement capability of iPhone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing you could easily do, is testing the &quot;system&quot; - get several known points with the distance and use them for testing/calibration. Than you could repeat it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you control the distances, you may be able to have a good measure by combining camera (calibrated) video analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you use the Kinect?&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-20T23:38:45.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22214" PostTypeId="2" ParentId="11151" CreationDate="2015-03-20T23:40:56.490" Score="2" Body="&lt;p&gt;Yes, real time convolution reverbs do windows of convolution, but interestingly, they don't actually do explicit convolution.  It turns out that convolution in &quot;time space&quot; is the same as multiplication in &quot;frequency space&quot;.  What this means is that if you do an FFT of your window of guitar music, and multiply it by a previously generated FFT of your reverb, then do an IFFT to put it back into time space instead of frequency space, you'll have your convolution reverb.  Turns out to be a lot less processing to do it that way, so machines can do this stuff in real time (:&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-03-20T23:40:56.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22215" PostTypeId="2" ParentId="22204" CreationDate="2015-03-20T23:43:56.863" Score="2" Body="&lt;p&gt;Implement a low pass 2D filter that will reduce greatly the noise. &#xA;Following an example that you could complete yourself. &#xA;You could subtract the filter bias to keep an average of 0 &quot;addition&quot; by the filter, controlling the dynamic range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example of filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;         1/16  1/8   1/4  1/8   1/16&#xA;&#xA;    1/16  1/8   1/4   1/2  1/4   1/8     1/16&#xA;&#xA;1/16  1/8   1/4   1/2   1    1/2   1/4     1/8     1/16&#xA;&#xA;1/8   1/4   1/2   1     2    1     1/2     1/4     1/8&#xA;&#xA;1/16  1/8   1/4   1/2   1    1/2   1/4     1/8     1/16&#xA;&#xA;   1/16  1/8   1/4   1/2  1/4   1/8     1/16&#xA;&#xA;        1/16  1/8   1/4  1/8   1/16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might be able to clearly see the desired image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Than run an Edge a 2D edge detector which will enhance the location of the step.&#xA;You could try running two 1D filters: -1 1 in horizontal and vertical direction. If you know the relative &quot;black&quot;/&quot;white&quot; areas you could select which to use of the optional -1 1 or 1 -1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be able to use frequency domain filtering for the low pass 2D filter. &#xA;If you are not familiar with this type of challenges and this is not exercise you need to get a consultant to help you or study the subject in more depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending of the contrast of the &quot;step&quot; you might be able to detect automatically the &quot;line&quot; created by the edge detector.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastEditorUserId="5633" LastEditDate="2015-03-21T17:15:46.497" LastActivityDate="2015-03-21T17:15:46.497" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22216" PostTypeId="1" CreationDate="2015-03-21T04:15:56.320" Score="2" ViewCount="1753" Body="&lt;p&gt;I am working on noise cancellation in ecg signal and I want to calculate the Signal to noise ratio(SNR) before applying filter to the signal and after applying filter i.e., snr_before and snr_after. I used the following commands:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;snr_before = mean(input_or_desired_signal.^2)/mean(noise_signal.^2);&#xA;residual_noise = desired_signal - filtered_output_signal; &#xA;snr_after = mean( desired_signal .^ 2 ) / mean( residual_noise .^ 2 ); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code works as no error is generated.&#xA;But only the box is displayed when I plot d same in each case and no graph is generated..&#xA;Pls help&#xA;Thanks in advance..&lt;/p&gt;&#xA;" OwnerUserId="15131" LastEditorUserId="12119" LastEditDate="2015-03-21T17:54:31.037" LastActivityDate="2015-03-21T17:54:31.037" Title="How to calculate SNR before and after filtering for noise cancellation in an ecg signal in matlab?" Tags="|snr|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22217" PostTypeId="2" ParentId="22209" CreationDate="2015-03-21T05:11:27.820" Score="-1" Body="&lt;p&gt;There are many ways to do pitch shift.&#xA;here is sample way. You can do it by re sampling (up and down).&#xA;As you know down sampling and up sampling , they make your data frequency change too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use lib Sox.&lt;/p&gt;&#xA;" OwnerUserId="13602" LastActivityDate="2015-03-21T05:11:27.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22218" PostTypeId="2" ParentId="22200" CreationDate="2015-03-21T05:31:30.503" Score="3" Body="&lt;p&gt;Exploit the fact that salt&amp;amp;pepper noise has only 2 values and median filter does excellent job in getting rid of it.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Filter your image with median filter&lt;/li&gt;&#xA;&lt;li&gt;Find pixels where median filter did most of its job&lt;/li&gt;&#xA;&lt;li&gt;Plot histogram of those pixels&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute fraction of 0s and 1s&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;threshold = 0.2; % adjust to perform best on your images&#xA;im = imread('../lena.bmp');&#xA;imd = double(im);&#xA;imd = imd./max(max(imd));&#xA;imdg = imnoise(imd,'gaussian');&#xA;imdsp = imnoise(imd,'salt &amp;amp; pepper');&#xA;subplot(2,2,1), imshow(imdg)&#xA;subplot(2,2,2), imshow(imdsp)&#xA;imdgf = medfilt2(imdg);&#xA;imdspf = medfilt2(imdsp);&#xA;g = imdg.-imdgf;&#xA;sp = imdsp.-imdspf;&#xA;gm = abs(g)&amp;gt;threshold;&#xA;spm = abs(sp)&amp;gt;threshold;&#xA;subplot(2,2,3), hist(imdg(gm))&#xA;subplot(2,2,4), hist(imdsp(spm))&#xA;waitforbuttonpress&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wn3mn.png&quot; alt=&quot;Result&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-03-21T05:31:30.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22219" PostTypeId="2" ParentId="22002" CreationDate="2015-03-21T06:52:33.930" Score="0" Body="&lt;p&gt;Engineers found a number of signals which have spiky autocorrelation function and use them in a technique called &quot;pulse compression&quot;. Chirp signal is one of them, and it's easy to generate. You can make it long enough to be reliably detected by correlation (it doesn't have to be loud if it's long enough). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, reverberation will add some smearing. You may do a matched filter for reverberated signal by generating a &quot;pilot&quot; marker in the beginning of the record and then correlating it with the rest.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-03-21T06:52:33.930" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22222" PostTypeId="1" AcceptedAnswerId="22226" CreationDate="2015-03-21T10:58:01.600" Score="2" ViewCount="249" Body="&lt;p&gt;I need to implement a locally adaptive threshold algorithm on a grayscale image in matlab. I use a sliding window over the image and calculate the threshold for the block using Otsu's method, which works well for blocks with non-uniform intensities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I apply this method to blocks with uniform intensities, I get very busy (junk) blocks. I want to set these blocks to either black or white in the result. I can decide whether to use black and white by comparing the global threshold value to the mean of the block (is this a good approach?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main question is: how to decide whether a block is uniform or not, or rather, how do I know which blocks to threshold and which to completely set to black or white?&lt;/p&gt;&#xA;" OwnerUserId="15132" LastActivityDate="2015-03-21T16:04:21.763" Title="Locally Adaptive Thresholding - How to Detect if Image Block is Uniform" Tags="|image-processing|thresholding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22223" PostTypeId="1" CreationDate="2015-03-21T14:21:25.853" Score="0" ViewCount="65" Body="&lt;p&gt;My dissertation supervisor ask me to code this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r1=.3;&#xA;r2=.5;&#xA;xh=[0.00001:.01:.21];&#xA;yh=3.2*xh-0.8;&#xA;A=2*r2*xh;&#xA;B=2*r2*yh;&#xA;R=sqrt(A.^2+B.^2);&#xA;C=xh.^2+yh.^2+r2^2-r1^2;&#xA;z=C./R;&#xA;zz=sqrt(1-z.^2);&#xA;theta2=atan2(B,A)+atan2(zz,z);&#xA;theta1=atan2((yh-r2*sin(theta2)),(xh-r2*cos(theta2)));&#xA;plot(xh,180*theta2/pi)&#xA;hold on&#xA;plot(xh,180*theta1/pi,'r')&#xA;axis([0 .2 -170 0])&#xA;xlabel('xh [m]')&#xA;ylabel('\theta [degree]')&#xA;legend('\theta_2','\theta_1')&#xA;title 'The change in angles between the elbow and shoulder while lifting a heavy Load' grid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I understand it but now he has ask me to..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot; Please do the links velocities and send me the results, please plot velocity of the links against &lt;code&gt;yh&lt;/code&gt;, limit the axis of &lt;code&gt;yh&lt;/code&gt; to be  ‘&lt;code&gt;axis([-.76 -.16  -15 5])&lt;/code&gt;’&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that length of &lt;code&gt;r1&lt;/code&gt; or &lt;code&gt;r2&lt;/code&gt; multiplied by &lt;code&gt;theta1&lt;/code&gt; or &lt;code&gt;theta2&lt;/code&gt; should give arc length. Then arc length divided by a time interval will give rad/sec&#xA;which i can plot against yh...........I dont know what this &lt;code&gt;axis([-.76 -.16  -15 5])&lt;/code&gt;’ means...... BUT I AM VERY NEW TO MATLAB HELP PLEASE.&lt;/p&gt;&#xA;" OwnerUserId="15134" LastEditorUserId="7092" LastEditDate="2015-03-21T19:06:57.577" LastActivityDate="2015-11-16T23:18:33.350" Title="This question is about modelling mechanical response of behavior in terms of signals" Tags="|image-processing|matlab|gradient|" AnswerCount="1" CommentCount="0" ClosedDate="2016-12-27T17:31:15.930" ContentLicense="CC BY-SA 3.0" />
  <row Id="22224" PostTypeId="1" AcceptedAnswerId="22229" CreationDate="2015-03-21T14:57:07.290" Score="0" ViewCount="875" Body="&lt;p&gt;&lt;strong&gt;Short question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to plot the magnitude of frequency response of the delay line canceller with non constant period using &lt;a href=&quot;https://www.gnu.org/software/octave/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GNU Octave&lt;/a&gt;? Or more directly: how to plot magnitude of frequency response of staggered &lt;a href=&quot;http://en.wikipedia.org/wiki/Pulse_repetition_frequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;PRF&lt;/a&gt; (pulse repetition frequency) &lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_target_indication&quot; rel=&quot;nofollow noreferrer&quot;&gt;MTI&lt;/a&gt; (moving target indicator) processors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Full question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to plot magnitude of frequency response of the MTI delay line canceller (some kind of FIR) which has the following structure using &lt;a href=&quot;https://www.gnu.org/software/octave/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GNU Octave&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZW7qQ.png&quot; alt=&quot;structure of the delay line canceller&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With tips in &lt;a href=&quot;https://dsp.stackexchange.com/questions/21864/plot-the-frequency-response-of-mti-delay-line-canceller-using-octave&quot;&gt;my related post&lt;/a&gt; I can plot frequency response for constant period:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all;&#xA;clear all;&#xA;&#xA;T   = 1e-3;&#xA;f   = linspace (0, 2 / T, 1000);&#xA;w   = 2 .* pi .* f;&#xA;z   = exp (-j .* w .* T);&#xA;H_z = 1 - z .^ -1;&#xA;&#xA;plot (f, abs (H_z), 'r', &quot;linewidth&quot;, 2);&#xA;hold on;&#xA;grid on;&#xA;title (&quot;Magnitude of the frequency response of the delay line canceler.&quot;);&#xA;xlabel (&quot;Frequency.&quot;);&#xA;ylabel (&quot;Magnitude.&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cD8ry.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now I am interesting in frequency response for non constant period:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;determinate values of period;  &lt;/li&gt;&#xA;&lt;li&gt;random values of period. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I try to do in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all;&#xA;clear all;&#xA;&#xA;T_1   = 0.001;&#xA;T_2   = 0.0012;&#xA;f     = linspace (0, 2 / min (T_1, T_2), 1000);&#xA;w     = 2 .* pi .* f;&#xA;z_1   = exp (-j .* w .* T_1);&#xA;z_2   = exp (-j .* w .* T_2);&#xA;H_z_1 = 1 - z_1 .^ -1;&#xA;H_z_2 = 1 - z_2 .^ -1;&#xA;k     = 1 / 2;&#xA;H_z   = k .* (H_z_1 + H_z_2);&#xA;&#xA;plot (f, abs (H_z), 'r', &quot;linewidth&quot;, 2);&#xA;hold on;&#xA;grid on;&#xA;title (&quot;Magnitude of the frequency response of the delay line canceler for alternate values of period T1 and T2.&quot;);&#xA;xlabel (&quot;Frequency.&quot;);&#xA;ylabel (&quot;Magnitude.&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R2eWa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another words, I mean that: &lt;strong&gt;common frequency response is the normalized sum of the frequency response for each value of the period&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right? If yes, is this approach will be correct for random values of period?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some related papers, when mentioned frequency response of staggered PRF MTI processors:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://smartech.gatech.edu/bitstream/handle/1853/15633/ewell_george_w_197405_phd_257465.pdf?sequence=3&quot; rel=&quot;nofollow noreferrer&quot;&gt;first&lt;/a&gt; (Pg 66 in books numeration or 81 in pdf-document numeration);&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://esl.eng.ohio-state.edu/~cbaker/cb_files/classes/ece5013/PDFs/14.%20Doppler%20Radar%20and%20MTI_2014.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;second&lt;/a&gt; (Pg 32).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10169" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-12-25T22:50:05.580" Title="Frequency response of FIR (MTI delay line canceller) with non constant period" Tags="|filters|frequency-response|radar|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22225" PostTypeId="2" ParentId="22223" CreationDate="2015-03-21T15:12:43.777" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I dont know what this axis([-.76 -.16 -15 5])’ means&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As far as I am concerned &lt;code&gt;axis([-.76 -.16 -15 5])&lt;/code&gt; set minimal and maximum values for x axis (first and second values) and y axis (third and forth values) in plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = linspace (-10, 10, 100);&#xA;y = x .^ 2;&#xA;plot (x, y, 'r', &quot;linewidth&quot;, 2);&#xA;title (&quot;S&quot;);&#xA;xlabel (&quot;x&quot;);&#xA;ylabel (&quot;y&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RWNAQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = linspace (-10, 10, 100);&#xA;y = x .^ 2;&#xA;plot (x, y, 'r', &quot;linewidth&quot;, 2);&#xA;title (&quot;S&quot;);&#xA;xlabel (&quot;x&quot;);&#xA;ylabel (&quot;y&quot;);&#xA;axis ([-5, 5, -5, 20]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PQWjp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10169" LastEditorUserId="10169" LastEditDate="2015-03-21T15:20:18.847" LastActivityDate="2015-03-21T15:20:18.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22226" PostTypeId="2" ParentId="22222" CreationDate="2015-03-21T16:04:21.763" Score="1" Body="&lt;p&gt;If you calculate the standard deviation of the blocks (from the average) it could serve as a good measure to the smoothness of a block (assuming there is no an extraordinary value and the specific use of the &quot;system&quot;)&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-21T16:04:21.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22227" PostTypeId="1" AcceptedAnswerId="22240" CreationDate="2015-03-21T17:35:26.747" Score="0" ViewCount="40" Body="&lt;p&gt;&lt;strong&gt;Input :&lt;/strong&gt; Square wave which sweeps over time domain. (about 1 MHz)&lt;br&gt;&#xA;&lt;strong&gt;Output:&lt;/strong&gt; The time period of high/low value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like the timer does, I would like to know the actual time (in sec) when the input goes high or low as well as the proper way to implement it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, use FPGA or Microcontroller to read it via analog input.&lt;br&gt;&#xA;OR there is the tool that straight to the point! Please let me know.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-03-22T01:26:26.303" Title="How to accurately count the time period (hardware)?" Tags="|real-time|hardware-implementation|hardware|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22229" PostTypeId="2" ParentId="22224" CreationDate="2015-03-21T18:54:20.997" Score="2" Body="&lt;p&gt;If you mean that you want a &lt;em&gt;time-varying&lt;/em&gt; delay then the whole system becomes time-varying, which means that there is no such thing as a frequency response in the conventional sense. Only linear &lt;em&gt;time-invariant&lt;/em&gt; systems can be described by a frequency response. There are of course ways to describe time-varying systems, but the question is what it exactly is that you expect from such a description of the system. What you've done in your example is subtract two delayed signals from the original signal, which is in fact a time-invariant system. In sum, what you're looking for (a frequency response description of a system with a time-varying delay) does not exist.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-21T18:54:20.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22230" PostTypeId="1" AcceptedAnswerId="22231" CreationDate="2015-03-21T19:06:20.897" Score="11" ViewCount="11476" Body="&lt;p&gt;The concept of poles and zeros in filters was introduced to me during our lab (our lab isn't sync with our lecture) through the pole-zero plot generation of filters in MATLAB. I didn't get its importance until it was mentioned in our lecture that poles make the equation infinity (or its denominator zero) while the zeros make the roots in the numerator zero. I still can't quite grasp what poles and zeros are. Can someone give an an intuitive and simple explanation on what poles and zeroes are? Much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14786" LastActivityDate="2018-09-26T04:51:31.033" Title="What are poles and zeros?" Tags="|poles-zeros|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22231" PostTypeId="2" ParentId="22230" CreationDate="2015-03-21T19:32:31.540" Score="9" Body="&lt;p&gt;Take the equation b/(x-c) with b non-zero.  The ratio goes to infinity as x approaches c.  So c is the location of a pole (something tall and pointy in a graph).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the equation (x-b)/c with c non-zero.  The ratio goes to zero as x gets closer to b.  So b is the location of something commonly called &quot;a zero&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can not only do this with scalar x, but with complex x, thus the domain of the poles and zeros will be on a (complex) plane instead of on a line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the ratio represents something about the response of a filter, it might say the filters output is at or near zero when the input is at or near a response &quot;zero&quot;.  And bad things might start to happen when x gets close to a pole (power supply starts smoking when asked to supply infinite amps, math operations produce NaNs or fixed-point overflows, etc.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-03-21T20:28:06.460" LastActivityDate="2015-03-21T20:28:06.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22232" PostTypeId="1" CreationDate="2015-03-21T20:33:18.903" Score="0" ViewCount="536" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WfS7y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found something very interersting when I was trying to simulate a discrete time system. So first I discretized the continuous system $G(s)$ using &quot;c2d&quot; function and &quot;dbode&quot;. The resulting bode plot for the discretized system is displaying some sort of periodic behaviour after reaching about 3 hz. So is the phase plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain why this maybe happening?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-04-06T18:29:49.700" Title="Why is my bode plot showing periodic behavior?" Tags="|discrete-signals|control-systems|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22233" PostTypeId="2" ParentId="22232" CreationDate="2015-03-21T20:35:45.473" Score="0" Body="&lt;p&gt;My guess is that you're looking at $\pi$ radians/second rather than 3 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the $x$ axis. It is labeled as &lt;code&gt;rad/s&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And $\pi$ radians/second corresponds to $\frac{f_s}{2}$, the maximum (baseband) frequency the system can deal with.  Above that frequency, the spectrum / frequency response will start to repeat.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-03-21T20:35:45.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22234" PostTypeId="1" CreationDate="2015-03-21T20:35:56.867" Score="1" ViewCount="877" Body="&lt;p&gt;I am trying to evaluate whether I should control a system in simulink using sampled data system or discrete time system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete model is as follows: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/T9gbA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampled time system is as follows&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Ho4AR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the functional difference between these two and which approach is preferred in realistic modelling and control?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-10-03T21:00:15.013" Title="What is the difference between a sampled time system and a discrete time system?" Tags="|discrete-signals|continuous-signals|control-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22235" PostTypeId="1" AcceptedAnswerId="22555" CreationDate="2015-03-21T20:55:20.733" Score="0" ViewCount="397" Body="&lt;p&gt;Nowadays read any paper or reference on signal classification scheme you would invariably come across the term &quot;feature&quot;. What does feature mean exactly? What is considered a time domain feature, what is considered a frequency domain feature and what is considered a phase domain feature?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be glad if someone can clarify this concept for me once and for all.&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-04-06T03:33:00.750" Title="What is the official definition of a feature in signal classification?" Tags="|classification|machine-learning|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22236" PostTypeId="1" CreationDate="2015-03-21T21:14:36.117" Score="0" ViewCount="93" Body="&lt;p&gt;Can one determine if an MFCC vector represents a combination of two sounds whose MFCCs were previously given?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any guidance is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="14997" LastEditorUserId="14997" LastEditDate="2015-03-23T17:56:44.813" LastActivityDate="2015-03-23T17:56:44.813" Title="Is an MFCC a linear transform?" Tags="|mfcc|source-separation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22237" PostTypeId="2" ParentId="8926" CreationDate="2015-03-21T21:30:28.360" Score="1" Body="&lt;p&gt;First of all, read &lt;a href=&quot;https://www.robots.ox.ac.uk/~vgg/publications/2012/Arandjelovic12/presentation.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;. Then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the nature of this question, I will &lt;strong&gt;only&lt;/strong&gt; give you some hints on pre-processing to improve your retrieval task.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Don't use Sift. Use RootSift. This is a performance gain at no cost. It is taking the square root of Sift vectors and applying L1 normalization.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can use &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/research/affine/det_eval_files/mikolajczyk_ijcv2004.pdf&quot; rel=&quot;nofollow&quot;&gt;Harris Affine regions&lt;/a&gt; to even be more robust.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.axes-project.eu/wp-content/uploads/2013/08/arandjelovic13.pdf&quot; rel=&quot;nofollow&quot;&gt;VLAD&lt;/a&gt; generally improves BoW model with a very simple procedure. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can apply your PCA not on BoW but on this VLAD vectors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, you can always use a more clever quantization scheme such as product quantization.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-03-21T21:30:28.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22238" PostTypeId="1" AcceptedAnswerId="22241" CreationDate="2015-03-21T23:15:32.190" Score="3" ViewCount="1104" Body="&lt;p&gt;I'm beginning to write a basic &quot;virtual analog&quot; synthesizer and want to implement a lowpass with variable cutoff frequency and resonance. Does anyone have insight into filter types commonly used to mimic the sound of traditional analog gear?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, what are common filters types found in audio applications such as synthesizers, equalizers, etc. I took a basic DSP class many years ago but never gained an appreciation for design choices to consider for audio. I would appreciate any references along these lines.&lt;/p&gt;&#xA;" OwnerUserId="15136" LastEditorUserId="7092" LastEditDate="2015-03-22T01:18:59.607" LastActivityDate="2021-11-27T23:10:00.230" Title="Common Filter Types for Audio Applications" Tags="|filters|audio|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22239" PostTypeId="2" ParentId="22230" CreationDate="2015-03-22T00:17:14.817" Score="0" Body="&lt;p&gt;First, you should see a z-plane as a set of complex exponential signals. If $z = z_0$, then corresponding discrete signal $Re(z^n) = Re(z_0^0),\ Re(z_0^1),\ Re(z_0^2),\ ...$. If $|z_0|&amp;lt;1$, it's a decaying signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, poles and zeros are used to describe an IIR system, i.e. a system with a feedback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zeros are easy: if system has a zero at $z_0$, that means a signal defined by $z_0$ on a z-plane will pass through a feedback loop and sum with itself strictly out-of-phase resulting in zero output. Poles are a bit trickier: if system has a pole at $z_0$, that means a system will generate this signal than it's disturbed and moving freely. Obviously if system has a pole for increasing signal ($|z_0|&amp;gt;1$), it's unstable. When designing a filter, zeros should be placed to suppress undesired frequencies. Poles are placed such that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;they cancel out the the influence of zeros for the frequencies to be passed &lt;/li&gt;&#xA;&lt;li&gt;filter remains stable&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15103" LastEditorUserId="15103" LastEditDate="2015-03-22T07:16:26.990" LastActivityDate="2015-03-22T07:16:26.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22240" PostTypeId="2" ParentId="22227" CreationDate="2015-03-22T01:26:26.303" Score="0" Body="&lt;p&gt;If it is not a noisy signal you could use a technique called &quot;zero crossing&quot; to gate a counter. You may use an FPGA to create accumulators to add up times and down times.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-22T01:26:26.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22241" PostTypeId="2" ParentId="22238" CreationDate="2015-03-22T13:10:15.557" Score="4" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;a lowpass with variable cutoff frequency and resonance.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;RBJ has a cookbook on how to do this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.w3.org/TR/audio-eq-cookbook/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here the cutoff frequency is called &lt;code&gt;w0&lt;/code&gt;, and the resonance is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Q_factor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;LPF:        H(s) = 1 / (s^2 + s/Q + 1)&#xA;&#xA;            b0 =  (1 - cos(w0))/2&#xA;            b1 =   1 - cos(w0)&#xA;            b2 =  (1 - cos(w0))/2&#xA;            a0 =   1 + alpha&#xA;            a1 =  -2*cos(w0)&#xA;            a2 =   1 - alpha&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to vary these parameters continuously while passing signal, you are not supposed to use biquads (because updating the coefficients causes glitches?) and you should use state-variable filters instead:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.earlevel.com/main/2003/03/02/the-digital-state-variable-filter/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.earlevel.com/main/2003/03/02/the-digital-state-variable-filter/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is also a 2nd-order lowpass with variable Q.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Does anyone have insight into filter types commonly used to mimic the sound of traditional analog gear?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Generally any filter transformed to a digital IIR using the bilinear transform is an &amp;quot;analog-like&amp;quot; filter.  Bessel is an exception because the important property of a Bessel filter is its group delay, which is not preserved by the bilinear transform.  Bilinear transform attempts to preserve the frequency response primarily.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="4346" LastEditDate="2021-11-27T23:10:00.230" LastActivityDate="2021-11-27T23:10:00.230" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="22242" PostTypeId="2" ParentId="8926" CreationDate="2015-03-22T13:17:27.013" Score="0" Body="&lt;p&gt;There is quite a bit of research showing that neither the features nor the method to build a dictionary matter that much in comparison to later encoding and pooling layers in the architecture. Have a look at these two articles.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cs.stanford.edu/~acoates/papers/coatesng_icml_2011.pdf&quot; rel=&quot;nofollow&quot;&gt;The Importance of Encoding Versus Training with Sparse Coding and Vector Quantization&lt;/a&gt; and &lt;a href=&quot;http://www.cs.stanford.edu/~acoates/papers/sc_vq_demo.tgz&quot; rel=&quot;nofollow&quot;&gt;Code&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cs.stanford.edu/~acoates/papers/coatesleeng_aistats_2011.pdf&quot; rel=&quot;nofollow&quot;&gt;An Analysis of Single-Layer Networks in Unsupervised Feature Learning&lt;/a&gt; and &lt;a href=&quot;http://www.cs.stanford.edu/~acoates/papers/kmeans_demo.tgz&quot; rel=&quot;nofollow&quot;&gt;Code&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="420" LastActivityDate="2015-03-22T13:17:27.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22243" PostTypeId="2" ParentId="19379" CreationDate="2015-03-22T13:25:34.050" Score="3" Body="&lt;p&gt;I realized I had forgotten to make an update to this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ended up following @robert bristow-johnson's recommendations in the comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used time-domain McLeod Pitch Method in a live application (records audio in a loop) which works very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the source code here:&#xA;&lt;a href=&quot;https://github.com/sevagh/Pitcha&quot; rel=&quot;nofollow&quot;&gt;https://github.com/sevagh/Pitcha&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11885" LastActivityDate="2015-03-22T13:25:34.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22244" PostTypeId="1" AcceptedAnswerId="22252" CreationDate="2015-03-22T14:10:34.097" Score="0" ViewCount="109" Body="&lt;p&gt;What type of sensors have complex Gaussian noise? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do strain gauges also exhibit such noise?&lt;/p&gt;&#xA;" OwnerUserId="10493" LastEditorUserId="7092" LastEditDate="2015-03-22T19:23:23.873" LastActivityDate="2015-03-22T19:27:49.393" Title="What type of sensors have complex Gaussian noise?" Tags="|signal-analysis|noise|gaussian|sensor|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22245" PostTypeId="1" AcceptedAnswerId="22248" CreationDate="2015-03-22T14:23:15.057" Score="3" ViewCount="1999" Body="&lt;p&gt;is it possible to know the order of the filter, just looking on the pole zero plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to get the order of the filter using calculations(highest order), but I want to know is it possible to see that in pole zero plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far my idea is that the higher number of zeros/poles (pairs) is the order, for example if I have 3 poles and 1 zero in a zero ploe plot, than is the filter 3 order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My knowledge over this is still small, so I am sorry if it is a stupid question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="10201" LastActivityDate="2015-03-22T16:33:04.813" Title="Is it possible to know the order of the filter, just looking on the pole zero plot?" Tags="|filters|poles-zeros|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22246" PostTypeId="1" CreationDate="2015-03-22T14:27:12.670" Score="0" ViewCount="1361" Body="&lt;p&gt;I've got images of blood drops in grayscale and I want to generate 3D data where the first two dimensions represent the area of interest and the 3rd dimension represents the pixel intensity of that area. Here's an example image:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TqYiv.jpg&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My requirement is as shown in D,E,F while the raw images are A,B,C. Also, what algorithms can be used for detection of the plateau areas as detected in G,H,I?&lt;/p&gt;&#xA;" OwnerUserId="15144" LastEditorUserId="7092" LastEditDate="2015-03-22T19:23:51.810" LastActivityDate="2015-03-23T11:59:02.187" Title="3D intensity map for grayscale image" Tags="|image-processing|matlab|image-segmentation|java|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22247" PostTypeId="1" AcceptedAnswerId="22263" CreationDate="2015-03-22T15:29:33.017" Score="0" ViewCount="520" Body="&lt;p&gt;I'm using the code in this book: &lt;a href=&quot;http://www.nt.tuwien.ac.at/fileadmin/users/gerhard/diss_Lang.pdf&quot; rel=&quot;nofollow&quot;&gt;Algorithms for the constrained design of digital filters with arbitrary phase and magnitude responses&lt;/a&gt; to compute nearly-linear-phase IIR EQs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;fvtool()&lt;/code&gt; shows the correct Eq mag and phase, but when I try to apply the coefficients to some real sound, the output is very very high (silence due to overlimit), it seems very unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone could tell me why &lt;code&gt;fvtool()&lt;/code&gt; is ok but &lt;code&gt;filter()&lt;/code&gt; is wrong, maybe try the software?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;http: vadkudr.org/Algorithms/LangIIR/LangIIR_examples.html&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try these coefficients:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a =  &#xA;                  1.00 &#xA;  -7057018074799500.00 &#xA;   7419034985051048.00 &#xA;  -2710509977123811.00 &#xA;   3321548070644472.50 &#xA;  19380841977826980.00 &#xA; -10366336133286466.00 &#xA; -17395746351478384.00 &#xA;   -241875435346629.44 &#xA;   1537628108108181.70 &#xA;  -7101604243654517.00 &#xA;   7251792090687912.00 &#xA;  23447717670347684.00 &#xA; -11610491157524712.00 &#xA; -10852963123569024.00 &#xA;   5000000000000001.00&#xA;&#xA;b =   &#xA;        -65252253992.00 &#xA;      29593281937568.00 &#xA;      31626970863960.00 &#xA;      -7964372882016.00 &#xA;     -32245859702352.00 &#xA;     -25890947971080.00 &#xA;     -10668161380760.00 &#xA;      -4361278103120.00 &#xA;      11507726488128.00 &#xA;      24495364570416.00 &#xA;       6689249360480.00&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the code to write the ouput file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;input= wavread('sine+noiz.wav');&#xA;output2=filter(b,a,input);&#xA;output2=output2/norm(output2);&#xA;wavwrite(output2, 44100,  'e:\sine+noiz2_out.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://khaelis.com/downloads/matlab.zip&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is full working code and audio files&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay I figured out where the problem was coming from: to make a lowpass at a very low frequency, you have to add more Zeros : the lower the cutoff frequency, the higher the number of zeros necessary...so then it works&#xA;But I still don't know why &lt;code&gt;fvtool()&lt;/code&gt; shows an ok filter but then the actual computation of an audio file fails...&lt;/p&gt;&#xA;" OwnerUserId="8366" LastEditorUserId="1629" LastEditDate="2016-06-01T07:19:05.253" LastActivityDate="2016-06-01T07:19:05.253" Title="Custom nearly-linear-phase IIR filter computation gone wrong" Tags="|matlab|filter-design|infinite-impulse-response|frequency-response|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="22248" PostTypeId="2" ParentId="22245" CreationDate="2015-03-22T15:29:41.033" Score="4" Body="&lt;p&gt;Count the number of poles and zeros; if the numbers aren't the same then the larger number is the filter order. Don't forget to count multiple poles or zeros with their multiplicity. Actually, you always get the same number of poles and zeros but on a pole-zero plot you might not see them all because some could be at infinity or at the origin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g., in the following pole-zero plot you see 12 zeros, 6 poles away from the origin, and a pole at the origin with multiplicity 6. So the total filter order is 12. (This is an IIR low-pass filter with approximately linear phase in the passband):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TmR0h.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-22T16:33:04.813" LastActivityDate="2015-03-22T16:33:04.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22249" PostTypeId="1" AcceptedAnswerId="22251" CreationDate="2015-03-22T18:33:45.900" Score="0" ViewCount="150" Body="&lt;p&gt;I have a simple frequency modulation scheme where in I am sending simple textual data by encoding it into specific frequencies(for example 'a' is converted to ASCII value of 97 and I use 10 frequencies to map decimal values from 0-9. 17 khz for 0,17.2 for 1,17.4 for 2 and so on.) A sound file is created by encoding such data,  and when I playback the tone,  I have a decoder on my phone which decodes that data. Currently each tone has a duration of 500 ms and the phone can get the data even from 10 m from the speaker with 100% accuracy. When I try to reduce the duration to 250 ms in order to increase the speed,  I find that the accuracy decreases drastically for distances &gt;2 m. &#xA;Does this imply that if I increase the duration, there will be increase in operating distance? &lt;/p&gt;&#xA;" OwnerUserId="15146" LastEditorUserId="7092" LastEditDate="2015-03-22T19:24:22.947" LastActivityDate="2015-03-22T19:49:55.887" Title="Frequency modulation of audio signals. Does increasing the pulse width of frequency tone result in larger operating distance?" Tags="|frequency|modulation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22250" PostTypeId="1" AcceptedAnswerId="22255" CreationDate="2015-03-22T19:00:06.010" Score="0" ViewCount="629" Body="&lt;p&gt;I have experience using design tools such as Xilinx's CoreGen and MatLab's DSP tool kit, but I have not really had much experience designing filters from the ground up. Reinventing the filter as it were.  I prefer to use FIR filters because they are easier to implement and take less fabric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the filter command from MatLab implements a difference equation and give the filtered results based from the inputs given, but how does it calculate this difference equation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about designing say, a high pass filter when I know the frequency I want to cutoff at, and the frequency I am sampling at?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get a good majority of it, but I am still learning, so my question is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I design a high pass filter with a difference equation so that I could implement it in something like C, and could I do this in the time domain, or would it have to be frequency domain only?&lt;/p&gt;&#xA;" OwnerUserId="15147" LastActivityDate="2015-03-22T20:17:18.627" Title="How would I go about designing a difference equation for a given type of filter?" Tags="|discrete-signals|filter-design|time-frequency|c|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22251" PostTypeId="2" ParentId="22249" CreationDate="2015-03-22T19:18:19.110" Score="0" Body="&lt;p&gt;It is very hard to give a single, correct answer because there are so many variables involved. Some things to keep in mind:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The main variable that determines the number of errors in the receiver is the ratio of energy per digit and the noise (this is the signal to noise ratio, or SNR). When you decrease the pulse duration, you reduce its energy and in consequence reduce the SNR. Increasing the pulse duration will increase the SNR and will allow you to increase the distance, all else equal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Received power decreases with the square of the distance; for relatively large distances, this will dominate the SNR.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The technique you are using is called frequency shift keying (FSK). It is easy to implement but requires large bandwidth. Your audio setup has limited bandwidth (20 kHz in the most optimistic case). Reducing the pulse duration increases the bandwidth; at some point, your speaker/microphone combination will not have the bandwidth to properly reproduce and detect your signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bandwidth considerations also suggest that you should shift your frequencies to around 10 kHz: at 17 kHz, you will soon hit the system's limit of 20 kHz. Operating at 10 kHz, you have 10 kHz of bandwidth to either side of your carrier.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-22T19:18:19.110" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22252" PostTypeId="2" ParentId="22244" CreationDate="2015-03-22T19:27:49.393" Score="2" Body="&lt;p&gt;No physical system suffers from, or produces, complex Gaussian noise. Quadrature systems can be modelled as being complex, with the in-phase branch corresponding to a real value, and the quadrature branch corresponding to an imaginary value. If each branch presents Gaussian (thermal) noise, then the noise can be modelled as complex Gaussian, too. However, this is just a modelling technique: the actual physical noise is never complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your first question: sensors that operate in quadrature, and are modelled using the complex envelope, can be modelled as having complex noise.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-22T19:27:49.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22253" PostTypeId="1" CreationDate="2015-03-22T19:45:28.667" Score="1" ViewCount="2114" Body="&lt;p&gt;Most fft tutorials use sinusoidal signals for demonstration, which makes the user already know what the fft is supposed to give as an output, but what about real time signals where we don't have any previous knowledge except the &lt;a href=&quot;http://www.filehosting.org/file/details/478653/ExperimentData.mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;sampled data&lt;/a&gt; with the following problems:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;No previous knowledge&lt;/li&gt;&#xA;&lt;li&gt;Variable sampling time&lt;/li&gt;&#xA;&lt;li&gt;Unknown Noise&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have a signal which has the previous characteristics, so I used the following Matlab code to interpolate and select a proper period (visually):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;load('ExperimentData.mat')&#xA;close all&#xA;% Because the sampling period is not constant, I have first to interpolate the data&#xA;Ts=min(diff(t));Fs=1/Ts;&#xA;t_new=t(1):Ts:t(end);&#xA;x_new=interp1(t,x,t_new);&#xA;%% Extracting one period and Applying ZERO PADDING&#xA;tStart=0.7086;[~,idxStart]=min(abs(t_new-tStart));&#xA;tEnd=0.7686;[~,idxEnd]=min(abs(t_new-tEnd));&#xA;x1p=x_new(idxStart:idxEnd);&#xA;t1p=t_new(idxStart:idxEnd);&#xA;F=figure;plot(t,x,'b');hold on&#xA;plot(t_new,x_new,'r:')&#xA;plot(t1p,x1p,'.-g');&#xA;ylabel('x');xlabel('time[sec]');legend('Original signal','Interpolated Signal','One Period')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The outcome is the following:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PbPvB.png&quot; alt=&quot;Time signals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then applied the &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/fft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;FFT&lt;/a&gt; once on the complet signal an once on one period with ZERO padding using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = fft(x_new-mean(x_new));&#xA;N = size(x_new,2);&#xA;f=Fs/2 * linspace(0,1,N/2+1);&#xA;figure;&#xA;AX(1)=subplot(211);semilogx(f,abs(X(1:N/2+1)));ylabel('Magnitude');xlabel('Frequency(Hz)');title('Entire signal Without Zero Padding')&#xA;AX(2)=subplot(212);semilogx(f,angle(X(1:N/2+1)));ylabel('Phase');xlabel('Frequency(Hz)')&#xA;linkaxes(AX,'x');axis  tight;&#xA;%Zero Padding&#xA;x_1PZP=[x1p-mean(x1p) zeros(1,100000)];&#xA;X_1PZP = fft(x_1PZP);&#xA;figure;&#xA;AX(1)=subplot(211);semilogx(f,abs(X_1PZP(1:N/2+1)));ylabel('Magnitude');xlabel('Frequency(Hz)');title('One Period with Zero Padding')&#xA;AX(2)=subplot(212);semilogx(f,angle(X_1PZP(1:N/2+1)));ylabel('Phase');xlabel('Frequency(Hz)')&#xA;linkaxes(AX,'x');axis  tight&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results are:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/QJxka.png&quot; alt=&quot;FFT Results&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My wonderings are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does the interpolation of a signal alter the FFT ?&lt;/li&gt;&#xA;&lt;li&gt;From the Time Signal, the FFT on the complet signal is closer to reality. but it still doesn't show all frequencies. Why?&lt;/li&gt;&#xA;&lt;li&gt;I almost can't extract any information fro the phase plot. What am I missing?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.filehosting.org/file/details/478653/ExperimentData.mat&quot; rel=&quot;nofollow noreferrer&quot;&gt;The data can be obtained from this link.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7806" LastEditorUserId="7806" LastEditDate="2015-03-24T05:23:15.627" LastActivityDate="2015-03-27T21:32:20.733" Title="FFT on non-uniformally sampled signals" Tags="|fft|dft|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22254" PostTypeId="2" ParentId="22249" CreationDate="2015-03-22T19:49:55.887" Score="0" Body="&lt;p&gt;In a typical indoor office or room, one big problem with this technique might be from multi-path interference.  e.g. reflections off nearby walls and other hard surfaces will nearly cancel out the direct high-frequency audio.  Thus the very long tone times required to detect a nearly cancelled-out audio signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better solution might be to use multiple tone frequencies (either simultaneous or sequential) for each symbol for some redundancy.  With an appropriate frequency set selection, you can reduce the odds that any given reflection will arrive 180 degrees out of phase with the direct path at all frequencies.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-22T19:49:55.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22255" PostTypeId="2" ParentId="22250" CreationDate="2015-03-22T20:17:18.627" Score="0" Body="&lt;p&gt;Matlab's &lt;code&gt;filter()&lt;/code&gt; function implements a difference equation by calculating&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}a_0y[n]=&amp;amp;b_0x[n]+b_1x[n-1]+\ldots +b_Mx[n-M]\\&amp;amp;-a_1y[n-1]-a_2y[n-2]-\ldots-a_Ny[n-N]\end{align}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for every sample index $n$, where $y[n]$ is the output sequence, and $x[n]$ is the input sequence.&#xA;The coefficients $a_i$ and $b_i$ are stored in the vectors &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;. Note that normally the first element of the vector &lt;code&gt;a&lt;/code&gt; is chosen as $a_0=1$. From (1) you see that in order to implement the difference equation you need to store past input and output values. This is usually done with a circular buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally you don't talk about &quot;designing a difference equation&quot;, but you design a &lt;em&gt;filter&lt;/em&gt;, i.e. you compute the coefficients $a_i$ and $b_i$ in such a way that the filter performs some chosen task. There is a large variety of filter design algorithms available. Take a look at &lt;a href=&quot;https://dsp.stackexchange.com/questions/9541/digital-filter-design-basic-principles-iir-fir/9552#9552&quot;&gt;this answer&lt;/a&gt; for some basic background information on filter design (this is a huge topic in itself!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most cases you would use some filter design package (e.g. available in Matlab or Octave), design the filter (i.e. compute the filter coefficients), and then you can implement the filter according to Eq. (1). Writing your own filter design routine can be a nice exercise, but since filter design is a very mature topic, you'll basically be re-inventing the wheel. &lt;em&gt;Implementing&lt;/em&gt; the filter is a different thing, and it can be useful to write your own implementation if you want to perform some real-time filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a direct implementation of Eq. (1) is only one of &lt;em&gt;many&lt;/em&gt; ways to implement a filter. There are many possible implementations, all with their advantages and disadvantages. They all implement Eq. (1), but they perform computations in different orders, and they use different intermediate variables, which results in very different numerical behaviors. Of course, they would all be equivalent if it were possible to perform exact computations without any numerical errors. Especially for fixed-point implementations it is very important to choose an appropriate structure, because a direct implementation of Eq. (1) will be disastrous for larger filter orders (i.e. larger values of $M$ and $N$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that Eq. (1) is a time-domain implementation. If you're interested in frequency domain implementations, search for &quot;overlap-add&quot; and &quot;overlap-save&quot; methods. However, I would start with implementing a time-domain filtering routine if you're working on your first implementation. Also note that for frequency domain filtering you need an FFT routine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can use floating point arithmetic, I would as a first step try to implement Eq. (1) directly, and compare your results with Matlab's &lt;code&gt;filter()&lt;/code&gt; function. For computing the coefficients you should use Matlab's filter design functions. If you then have any more specific questions you could come back and formulate a new question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-03-22T20:17:18.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22256" PostTypeId="1" CreationDate="2015-03-22T22:56:58.317" Score="3" ViewCount="905" Body="&lt;p&gt;How to design a $(8,4)$ linear block code with highest possible error correction and error detection capability?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have studied linear block codes topic but if I do the conventional way, in case of $(n,k)$ block code, I need a generator matrix which is given as $\mathbf G=[\mathbf P|\mathbf I_k]$, where $\mathbf P$ is the &lt;strong&gt;parity matrix&lt;/strong&gt; and $\mathbf I_k$ the &lt;strong&gt;identity matrix&lt;/strong&gt;. But to find parity matrix I need to find the code words. But how to do that? Since third codeword should be the addition of first two code words.&#xA;Any kind of help will be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="12083" LastEditorUserId="1629" LastEditDate="2016-03-19T17:46:17.493" LastActivityDate="2016-03-19T17:46:17.493" Title="Linear Block Codes Digital Communication Problem" Tags="|digital-communications|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22257" PostTypeId="2" ParentId="22256" CreationDate="2015-03-22T23:29:05.843" Score="3" Body="&lt;p&gt;In this answer, I will focus on error correction. I will use as little coding theory as possible, and I'll try to approach the problem from the point of view of a novice taking their first steps in code design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our objective is to find the best (8,4) linear block code possible, that is, one that corrects as many bit errors as possible. Is it possible to know in advance how good an (8,4) code can be? To answer this question, we have an invaluable tool: the Hamming bound. It says that a $(n,k)$ code that can correct $t$ errors must satisfy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sum_{i=0}^t \binom{n}{i} \leq 2^{n-k}. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy to write a program that takes $n$ and $k$ as arguments, and outputs the largest $t$ that satisfies the bound. For $n=8$ and $k=4$, we find that the largest possible $t$ is 1. Note that, since the minimum distance is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ d_{min} = \lfloor (t-1)/2 \rfloor, $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we still don't know whether the best code has $d_{min}=3$ or $d_{min}=4$. Both will have the same error correcting capabilites, but the code with minimum distance 4 has additional error detecting capabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that, even if there exist numbers $(n,k,t)$ that satisfy the Hamming bound, it is not guaranteed that a $(n,k,t)$ code actually exists. However, if the bound is not satisfied, we know for sure that no such code exists.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we have a goalpost ($d_{min}=4$), we can focus on finding a code that achieves it. We know that the generator matrix $G$ has $k$ rows and $n$ columns. In its systematic form, $G=[I_k|P]$, where $P$ has $k$ rows and $n-k$ columns. For our (8,4) code, we have to find a matrix $P$ with 4 rows and 4 columns. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we don't have any other tools at this point, we can try a brute-force approach, since there are &quot;only&quot; $2^{16}$ possible matrices $P$ (actually a bit less, since we don't want to repeat any columns). Let's try this matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ P=\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{bmatrix}. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not hard to write a program that generates all 16 possible code words using $P$. The final step is to verify if our code has $d_{min}=4$. This is easy, since the code is linear; all we have to do is find the non-zero code word with smallest weigth (with smallest number of ones). For the matrix $P$ given above, it turns out that $d_{min}=2$, so the code is not the best possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy to find generator matrices with $d_{min}=3$; extending the distance to 4 takes a bit more work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The Hamming bound can be used to determine what values of $t$ and (approximate) $d_{min}$ we can expect from a code with small $n$ and $k$. For large $n$ and $k$, the achievable value of $t$ may be much less than that given by the bound. Surprisingly, determinining $t$ for given $n$ and $k$ is (for the general case) an unsolved problem.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Design by brute force (by trying many $P$ matrices) is feasible only for small codes. Even for an (8,4) code you may have to try more than 60,000 possibilities. The number grows exponentially with the code size. The amount of work required to generate the entire code, and to determine $d_{min}$ by inspection, soon grows so large that it becomes entirely unfeasible.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is for this reason that so much research has been done into techniques that allow for less complex design of large codes. When you study other codes, such as cyclic and convolutional codes, keep in mind this motivation. You probably shouldn't try to solve your problem using the brute-force technique outlined here except to get a feel for the sheer magnitude of the computational complexity involved in the design of good codes, and also in their encoding and decoding procedures.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-03-24T00:49:26.303" LastActivityDate="2015-03-24T00:49:26.303" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22258" PostTypeId="2" ParentId="22253" CreationDate="2015-03-23T03:01:30.593" Score="0" Body="&lt;p&gt;The interpolation introduces &quot;noise&quot; and alters the measurement. The FFT computation is attempting to fit sinusoids to the &quot;signal&quot; and as result the in accuracies in the time domain are propagating into ALL the sinusoids of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interpolation process might &quot;zero&quot; some of the frequencies. Particularly, interpolation could be made for the lower frequencies and in some cases emphasize lower frequencies. I assume that your interpolation reduced higher frequencies, though you did not mention it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase is impacted more and as result the calculated phase is farther removed from the actual one. &lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-23T03:01:30.593" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22259" PostTypeId="1" AcceptedAnswerId="22280" CreationDate="2015-03-23T06:49:29.557" Score="3" ViewCount="794" Body="&lt;p&gt;I am building a speech recognition system using Hidden Markov Model in python. I referred to &lt;a href=&quot;https://dsp.stackexchange.com/questions/17897/using-hmm-for-speech-recognition&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/17926/continuous-speech-recognition-with-hmm&quot;&gt;this&lt;/a&gt; question and its answers, which were very helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my approach, I split the continuous speech into separate words. I am thinking of using HMM to detect each word. So my states of HMM will be phones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I understood so far is that HMM estimates next state based on current state(phone). But I don't get how to estimate first state of HMM(i.e. the first phone of the word). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you suggest the best approach to use HMM to achieve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also states of HMM will be phones, but I am not getting what can be observation in problem? There are multiple frame in a single phone and there is a feature vector corresponding to each frame. What should I use as observation?&lt;/p&gt;&#xA;" OwnerUserId="14827" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-04-02T16:49:07.440" Title="Initial state recognition in HMM" Tags="|python|speech-recognition|hmm|" AnswerCount="2" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22260" PostTypeId="1" CreationDate="2015-03-23T07:15:41.340" Score="1" ViewCount="1432" Body="&lt;p&gt;When I was learning about LTI systems,&#xA;I noticed that&#xA;LTI system is said to be BIBO stable&#xA;if and only if its square sum of impulse response is finite.&#xA;This expression is found on many textbook of signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I continued study and found this expression&#xA;LTI system is stable if and only if&#xA;its impulse response is exponentially bounded.&#xA;I could not understand this at first,&#xA;but by further research,&#xA;I elaborately acquire this interpretation.&#xA;However, I could not find explicit description about this.&#xA;So my question is &quot;is these things true ?&quot;,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There are two types of stability (of the system), internal stability and external stability.&lt;/li&gt;&#xA;&lt;li&gt;BIBO stability is equivalent to external stability.&lt;/li&gt;&#xA;&lt;li&gt;If the system is controllable and observable, internal and external stability is equivalent.&lt;/li&gt;&#xA;&lt;li&gt;If the system is linear, &quot;exponentially bounded&quot; is equivalent to internal stability.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;and if 4. is true,&#xA;why the function must be &quot;exponential decaying&quot; ?&#xA;How is this restricted to be &quot;exponential&quot; ?&lt;/p&gt;&#xA;" OwnerDisplayName="user15151" LastActivityDate="2015-03-23T08:47:29.317" Title="The two types of stability and &quot;Why exponential&quot;" Tags="|filters|discrete-signals|signal-analysis|linear-systems|state-space|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22261" PostTypeId="1" CreationDate="2015-03-23T08:23:48.837" Score="2" ViewCount="425" Body="&lt;p&gt;I wonder if there are algorithms used to segment images efficiently. The ones I tested by now can not segment hair correctly as on this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kvnWY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want to know if someone can give me some efficient algorithms to segment the hair on this image for example without cutting it and so on (correct segmentation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I tested famous algorithms such as watershed, grabcut, mean shift ... but no one of them segments this hair correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance.&lt;/p&gt;&#xA;" OwnerUserId="15153" LastActivityDate="2018-01-23T21:44:47.007" Title="Image segmentation algorithm" Tags="|algorithms|image-segmentation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22262" PostTypeId="2" ParentId="22260" CreationDate="2015-03-23T08:47:29.317" Score="1" Body="&lt;p&gt;Let's consider discrete-time systems. The generalization to continuous-time systems is straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First note that BIBO stability does not require that the impulse response be square summable. It is necessary and sufficient that the impulse response be &lt;em&gt;absolutely summable&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}\left|h[n]\right|&amp;lt;\infty\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of stability of a causal LTI system, an exponentially bounded impulse response must satisfy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|h[n]|\le a\rho^{n},\quad n\ge 0\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for some positive constants $a$ and $\rho$, with $0&amp;lt;\rho&amp;lt;1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a causal LTI system is described by a &lt;em&gt;rational&lt;/em&gt; transfer function, it can be shown that condition (1) for BIBO stability is equivalent to the condition that all poles of the transfer function lie inside the unit circle of the $z$-plane. This is equivalent with the system's impulse response being a weighted sum of decaying exponentials, and, consequently, condition (2) is always met by choosing $\rho$ equal to the largest pole radius, and by selecting an appropriate value for $a$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, condition (2) is a special case of general BIBO stability for LTI systems with &lt;em&gt;rational&lt;/em&gt; transfer functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also take a look at &lt;a href=&quot;https://dsp.stackexchange.com/questions/20438/alternative-to-bibo-stability-of-a-system/20445#20445&quot;&gt;this answer&lt;/a&gt;, which also mentions non-linear systems.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-03-23T08:47:29.317" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22263" PostTypeId="2" ParentId="22247" CreationDate="2015-03-23T08:58:34.817" Score="1" Body="&lt;p&gt;I believe that there's something going wrong with the implementation of the filter. The design algorithm lets you prescribe the maximum pole radius, so if you prescribe e.g. $r_{max}=0.98$ the filter is guaranteed to be stable with some reasonable stability margin. So using floating point arithmetic it seems to me that nothing can go wrong. If you use Matlab's &lt;code&gt;filter()&lt;/code&gt; function, be careful to call it &lt;code&gt;filter(b,a,x)&lt;/code&gt; with &lt;code&gt;b&lt;/code&gt; being the numerator coefficients. I've seen people use this function as &lt;code&gt;filter(a,b,x)&lt;/code&gt; (which seems more logical to some folks). The latter function call will give you trouble, because &lt;code&gt;filter()&lt;/code&gt; will interpret the numerator coefficients &lt;code&gt;b&lt;/code&gt; as denominator coefficients, so any zero outside the unit circle will become an unstable pole. And due to the phase approximation of the design algorithm there will almost always be some zeros outside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is example #7 from &lt;a href=&quot;http://vadkudr.org/Algorithms/LangIIR/LangIIR_examples.html#60&quot; rel=&quot;nofollow noreferrer&quot;&gt;this site&lt;/a&gt;, with the desired group delay value set to 40 samples (instead of 37). This is what I understood from your comments you're trying to do. This is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;tau=40;M=40;N=6;r=0.98;&#xA;om=pi*[linspace(0,0.2,20),linspace(0.23,1,77)];&#xA;D=[exp(-1i*om(1:20)*tau),zeros(1,77)];&#xA;W=[ones(1,20),1000*ones(1,77)];&#xA;[b,a]=mpiir_l2(M,N,om,D,W,r);&#xA;&#xA;[H,w] = freqz(b,a,1024);&#xA;gd = grpdelay(b',a',1024);&#xA;subplot(2,1,1), plot(w/2/pi,20*log10(abs(H)));&#xA;grid, title('|H(f)|')&#xA;subplot(2,1,2), plot(w/2/pi,gd);&#xA;grid, title('passband group delay'), axis([0,.1,35,45])&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I ran the design program in Octave. I believe that you have a problem with running the software in the current Matlab version. Note that the software was written about 17 years ago, and I'm not sure if and how you (or someone else) adapted it to the current version. You can find the filter coefficients below and I'm convinced that a filter implemented with these coefficients will work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/51qeD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the coefficients:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;b =&#xA;&#xA;  -5.3754e-04&#xA;   1.4765e-03&#xA;  -1.7103e-03&#xA;   1.1605e-03&#xA;  -3.7906e-04&#xA;   6.8635e-05&#xA;  -2.9013e-05&#xA;  -2.0759e-05&#xA;  -4.4175e-05&#xA;  -1.0035e-05&#xA;  -8.8312e-06&#xA;   3.8369e-05&#xA;   3.4096e-05&#xA;   5.6969e-05&#xA;   1.6945e-05&#xA;   5.8498e-06&#xA;  -5.1954e-05&#xA;  -5.4722e-05&#xA;  -7.7327e-05&#xA;  -2.8043e-05&#xA;  -1.5210e-07&#xA;   7.7270e-05&#xA;   9.5478e-05&#xA;   1.2200e-04&#xA;   5.9885e-05&#xA;   1.6209e-06&#xA;  -1.1856e-04&#xA;  -1.8065e-04&#xA;  -2.3618e-04&#xA;  -1.7031e-04&#xA;  -5.9434e-05&#xA;   1.7262e-04&#xA;   4.0741e-04&#xA;   6.8756e-04&#xA;   8.7908e-04&#xA;   9.9248e-04&#xA;   1.3572e-03&#xA;  -1.4580e-04&#xA;   3.0311e-03&#xA;  -1.8688e-03&#xA;   1.9026e-03&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&#xA;a =&#xA;&#xA;    1.00000&#xA;   -4.65499&#xA;    9.58904&#xA;  -11.07801&#xA;    7.53566&#xA;   -2.85503&#xA;    0.47033&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-23T14:05:19.650" LastActivityDate="2015-03-23T14:05:19.650" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22264" PostTypeId="1" CreationDate="2015-03-23T10:43:17.830" Score="5" ViewCount="2089" Body="&lt;p&gt;I am looking for a good reference on DSP. I am a little bit more than beginner and have some experience in DPS. I think I would have to start with rather easier books where a concept of DSP is explained based on practical examples, intuitively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually I'd take more advanced books to have solid understanding of DSP, including statistical signal analysis such as power spectra, cross-spectra, coherence, autocorrelation, and cross-correlation and ultimately I'd be interested in signal, sound, noise, or speech detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For beginners, people recommend&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rick Lyons' &lt;em&gt;Understanding DSP&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;Sanjit K. Mitra, &lt;em&gt;Digital Signal Processing: A Computer-Based Approach&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;The Scientist and Engineer's Guide to Digital Signal Processing&lt;/a&gt; - free online book&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All recommendations of advanced books are by Alan V. Oppenheim's e.g.:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Alan V. Oppenheim, Ronald W. Schafer, John R. Buck, &lt;em&gt;Discrete-Time Signal Processing&lt;/em&gt;, Prentice-Hall Signal Processing Series.&lt;/li&gt;&#xA;&lt;li&gt;Alan V. Oppenheim, Alan S. Willsky, with S. Hamid, &lt;em&gt;Signals and Systems&lt;/em&gt;, Prentice Hall &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There was one more recommendation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;John G. Proakis, Dimitris K Manolakis, &lt;em&gt;Digital Signal Processing: Principles, Algorithms and Applications&lt;/em&gt;, Prentice Hall&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These books are usually quite expensive which is fine but I would not like to buy something I'd be disappointed with. If you could recommend or say whether the books I listed are worth the price, I'd be grateful :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr /&gt;&#xA;EDIT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have decided to buy and go through &quot;&lt;em&gt;Understanding Digital Signal Processing&lt;/em&gt;&quot; by Rick Lyons. I am still waiting for it but have had a chance to read through first two chapters via Kindle App. I must say I am already happy and don't regret this purchase. I'd recommend this book for all starters.&lt;/p&gt;&#xA;" OwnerUserId="4721" LastEditorUserId="13320" LastEditDate="2017-03-09T08:46:24.363" LastActivityDate="2021-04-07T16:58:16.977" Title="Book recommendations on DSP, statistical SP and signal detection" Tags="|reference-request|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22266" PostTypeId="2" ParentId="22246" CreationDate="2015-03-23T11:59:02.187" Score="1" Body="&lt;p&gt;If all you are looking to do is to take the 2D grayscale image and turn it into a 3D representation for visualisation purposes, then perhaps you could consider a function that accepts the image and produces a VRML (or X3D) string describing your 3D model. That model would then be passed to a standard java graphics toolkit (for example Java 3D) which would handle the rendering for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a simplistic example:&#xA;For the 2x2 grayscale image of X = [0,1;1,0], your VRML indexedFace node would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IndexedFaceSet {&#xA;       coord Coordinate {&#xA;         point [-1 1 x(0,0), 1 1 x(0,1), 1 -1 x(1,1), -1 -1 x(1,0)]&#xA;       }&#xA;       coordIndex [ 0 1 2 3 ]   # That is, just one face&#xA;     }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above snippet, &quot;x(i,j)&quot; is a placeholder for the corresponding value from the image (which will be formated to the actual number) and as you can see it represents the Z dimension of your indexedFaceSet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, the structure of &quot;point&quot; is just a list (in row major order) of all of you image points, which is very easy to generate by iterating through all pixels of the image. Similarly, the structure of coordIndex is also set to quads (faces defined by 4 points in space) which map to the image's grid. The indexedFaceSet provides capabilities to define the colour of each vertex (each defining point of the face) as well in a way similar to the way &quot;point&quot; is defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More information about IndexedFaceSet can be found at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;VRML: &lt;a href=&quot;http://www.cs.vu.nl/~eliens/documents/vrml/reference/CH3.HTM#IndexedFaceSet&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cs.vu.nl/~eliens/documents/vrml/reference/CH3.HTM#IndexedFaceSet&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X3D: &lt;a href=&quot;http://www.web3d.org/documents/specifications/19775-1/V3.2/Part01/components/geometry3D.html#IndexedFaceSet&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.web3d.org/documents/specifications/19775-1/V3.2/Part01/components/geometry3D.html#IndexedFaceSet&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To render the model in Java, please see &lt;a href=&quot;https://stackoverflow.com/questions/16625858/plug-in-display-3d-objects-from-vrml-or-x3d&quot;&gt;https://stackoverflow.com/questions/16625858/plug-in-display-3d-objects-from-vrml-or-x3d&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the detection of spots, if these are images from electrophoresis, please see chapter 3 in this thesis for a comprehensive set of ways of detecting the blobs and extracting their main features: &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.86.4325&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.86.4325&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2015-03-23T11:59:02.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22267" PostTypeId="2" ParentId="22264" CreationDate="2015-03-23T12:07:27.687" Score="7" Body="&lt;p&gt;The Proakis and Manolakis book is good if you're looking for one book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking for depth about statistical signal processing, I recommend the series of three by Steven M. Kay:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Fundamentals of Statistical Signal Processing Volume I: Estimation Theory&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Fundamentals of Statistical Signal Processing Volume II: Detection Theory&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Fundamentals of Statistical Signal Processing Volume III: Practical Algorithm Development&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you want some more advanced statistical signal processing books, then the ones by Harry L. van Trees might be more your style:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Detection, Estimation, and Modulation Theory (Part I)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Nonlinear Modulation Theory (Detection, Estimation, and Modulation Theory, Part II)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Detection, Estimation, and Modulation Theory, Radar-Sonar Signal Processing and Gaussian Signals in Noise (Part III)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Detection, Estimation, and Modulation Theory, Optimum Array Processing (Part IV)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-03-23T12:07:27.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22269" PostTypeId="1" AcceptedAnswerId="22277" CreationDate="2015-03-23T15:07:30.160" Score="1" ViewCount="1034" Body="&lt;p&gt;suppose I generate the following filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 32000;  % Sampling Frequency&#xA;N     = 4;    % Order&#xA;Fpass = 400;  % Passband Frequency&#xA;Apass = 1;    % Passband Ripple (dB)&#xA;h  = fdesign.lowpass('N,Fp,Ap', N, Fpass, Apass, Fs);&#xA;Hd = design(h, 'cheby1', 'FilterStructure', 'df2sos');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&quot;Hd&quot; at the interactive prompt gives me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; sosMatrix: [1 2 1 1 -1.97232454484577 0.978340933957857;1 2 1 1 -1.94676435093801 0.948444394718458]&#xA; ScaleValues: [0.00150409727802169;0.000420010945111697;0.891250938133746]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I notice that freqz(Hd.sosMatrix) gives me a wildly off magnitude estimation (but with the correct frequency cutoff). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how do I use this Hd.ScaleValues factor? There are 3 values for two sections.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-03-23T17:57:18.050" Title="MATLAB IIRs -- extracting and scaling the coefficients of second order sections" Tags="|matlab|filters|biquad|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22272" PostTypeId="1" AcceptedAnswerId="22276" CreationDate="2015-03-23T16:07:28.817" Score="7" ViewCount="153" Body="&lt;p&gt;It seems like (controlled) noise can sometimes be good: dithering in an image, or a softer sound in audio, or white noise alone. &lt;a href=&quot;http://www.ele.uri.edu/faculty/kay/New%20web/downloadable%20files/00809511.pdf&quot;&gt;Here's a paper&lt;/a&gt; on noise improving detectability. My intuition also says that noise in a financial trading algorithm could act as a sort of hedge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have few examples — only a vague philosophical instinct. Is there any general-purpose literature or theory on why and how noise can be good? Or other/better examples?&lt;/p&gt;&#xA;" OwnerUserId="15156" LastActivityDate="2015-03-23T21:36:12.330" Title="How can noise be good?" Tags="|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22273" PostTypeId="1" AcceptedAnswerId="22275" CreationDate="2015-03-23T16:39:37.187" Score="0" ViewCount="149" Body="&lt;p&gt;I'm pretty new in dsp and I'm having tough times trying to get the output for a simple digital oscillator. I'm starting from the recursive formula $y[n]=x[n]+a \times y[n-1]-b \times y[n-2]$, and need to figure out the values of $a$ and $b$ for the output to be completely sinusoidal at a determined frequency $\omega _0$ when an unit impulse is applied as input. I can't get the theory too much and the code I wrote just doesn't work at all. I would appreciate a lot with your help with this, cheers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code I've tried so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=0:2*pi/200:2*pi;&#xA;&#xA;w0=pi/16;&#xA;&#xA;f=w0/(2*pi);&#xA;&#xA;beta=1;&#xA;&#xA;alpha=2*cos(w0);&#xA;&#xA;num=1;&#xA;&#xA;den=[1 -alpha beta];&#xA;&#xA;x=[0 0 1 zeros(size(n))];&#xA;&#xA;y=zeros(size(n));&#xA;&#xA;y(1)=0;&#xA;&#xA;y(2)=0;&#xA;&#xA;y(3)=sin(w0);&#xA;&#xA;for i=3:size(n)&#xA;&#xA;    y(i)=x(i)+alpha*y(i-1)-beta*y(i-2);&#xA;&#xA;end&#xA;&#xA;y;&#xA;&#xA;stem(n,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks very much&lt;/p&gt;&#xA;" OwnerUserId="14974" LastEditorUserId="7092" LastEditDate="2015-03-23T21:35:24.953" LastActivityDate="2015-03-23T21:35:24.953" Title="Problem to implement a sinusoid oscillator in matlab" Tags="|filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22275" PostTypeId="2" ParentId="22273" CreationDate="2015-03-23T17:26:08.847" Score="0" Body="&lt;p&gt;OK, since the original code was changed a bit, here is the complete solution (with some useful modifications):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=1000;&#xA;w0=pi/16;&#xA;beta=1;&#xA;alpha=2*cos(w0);&#xA;y=zeros(1,n);&#xA;y(1)=0;&#xA;y(2)=sin(w0);&#xA;&#xA;for i=3:n&#xA;    y(i)=alpha*y(i-1)-beta*y(i-2);&#xA;end&#xA;&#xA;stem(y)&#xA;% End of code&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-03-23T17:26:08.847" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22276" PostTypeId="2" ParentId="22272" CreationDate="2015-03-23T17:37:31.897" Score="4" Body="&lt;p&gt;Another example is setting up A/D converters - usually the input is set so that the noise just trips the least significant bit (LSB) of the converter. The noise can also be added manually - this process is also referred to as Dithering. The white papers at various A/D manufacturers can be quite useful e.g. Linear Technologies, Analog Devices and Texas Instruments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another term you may wish to look under is Stochastic Resonance.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7092" LastEditDate="2015-03-23T21:36:12.330" LastActivityDate="2015-03-23T21:36:12.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22277" PostTypeId="2" ParentId="22269" CreationDate="2015-03-23T17:57:18.050" Score="2" Body="&lt;p&gt;These scale values are applied before and after each section, so for $N$ sections you have $N+1$ scale values. Check the Matlab documentation, there must be some related property that you can set to 'scalar', and this will give you a single total scaling value. In any case, the total scaling is just the product of the three values in your case. So you have to multiply the &lt;code&gt;b&lt;/code&gt; coefficients of one filter section by the product of all scale values, then the total scaling will be OK, i.e. the maximum frequency response magnitude will be 0 dB.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-23T17:57:18.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22278" PostTypeId="1" CreationDate="2015-03-23T18:06:27.800" Score="0" ViewCount="2902" Body="&lt;p&gt;I am using electromyography to detect activity on pectoralis major, however I found an interference from heart beats that is affecting my posterior analysis. The sampling rate is 2000 Hz, and the time of sampling is 150 s. The main signal is the muscle activity as the arm moves (four major big masses in the figure, between $-2*10^{-4}$ and $1*10^{-4}$), and the interfercence can be seen in the figure below as pulses at constant rate on values between $-5*10^{-5}$ and $1*10^{-5}$:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/esWeS.png&quot; alt=&quot;Pectoralis major sample&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For comparison, I provide a figure of another muscle's (Deltoid) signal , without the heart interference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8o8Yl.png&quot; alt=&quot;Deltoid sample&quot;&gt;&#xA;As I don't know much about filters, I would like to ask for advice on how to remove the heart interference from this signal. Specifically, some directions on how to do it on matlab or R.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can not use methods to record simultaneously heart and pectoralis major signals, since all individuals have already been sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some papers addressing this issue, but I'm not able to implement the suggested solutions. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0304394009008593&quot; rel=&quot;nofollow noreferrer&quot;&gt;Removing ECG noise from surface EMG signals using adaptive filtering&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sample file with this data is available &lt;a href=&quot;https://drive.google.com/file/d/0ByuxmbxlwaQ4aDhnelBTMHdWSFk/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13560" LastEditorUserId="13560" LastEditDate="2015-03-23T19:01:40.350" LastActivityDate="2021-10-15T18:13:35.553" Title="How to remove heart beats interference from pectoralis major electromyogram?" Tags="|matlab|filters|noise|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22279" PostTypeId="2" ParentId="22278" CreationDate="2015-03-23T19:01:28.437" Score="1" Body="&lt;p&gt;One possible solution is to use a notch filter to remove frequencies commonly associated with heartbeats somewhere between &lt;a href=&quot;http://www.mayoclinic.org/healthy-living/fitness/expert-answers/heart-rate/faq-20057979&quot; rel=&quot;nofollow noreferrer&quot;&gt;40 to 100 bpm&lt;/a&gt; or .66-1.66Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if you dont need any low frequencies just use a &quot;highpass&quot; filter where the cutoff is around 2Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These solutions assume that anything near the frequency of a heartbeat is unimportant&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using the sample data you provided I applied a simple HPF with a cutoff at 2Hz (technically it should be a little past 2, but you will see even as it is it reduced the low frequencies by several orders of magnitude). This may have removed a significant amount of the signal power but it didn't perfectly replicate the cardiac noise. I suppose you have to think the electrical pulse associated with contracting the separate chambers of the heart are much more complex than the resultant heartbeat. In any even here is the data and code, just so you can see the process&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = importdata('pectoralis Major sample.txt');&#xA;samples_per_second = 2000;&#xA;Ts = 1 / samples_per_second;&#xA;&#xA;%filter design&#xA;cuttoff_hz = 2;&#xA;cutoff_freq = 2*pi*cuttoff_hz;&#xA;tau = 1 / (2*pi*cutoff_freq);&#xA;a = Ts / tau;&#xA;&#xA;length_x = length(x);&#xA;nfft = 2^nextpow2(length_x);&#xA;X=fft(x,nfft)/length_x;&#xA;&#xA;%single pole hpf&#xA;x_hpf = filter([1-a a-1],[1 a-1], x);&#xA;X_HPF = fft(x_hpf,nfft)/length_x;&#xA;&#xA;figure(1);&#xA;subplot(2,2,1);plot(2*abs(X(1:nfft/2+1)));title('original fft')&#xA;subplot(2,2,2);plot(2*abs(X(1:nfft/2+1)));title('original fft')&#xA;xlim([0 5])&#xA;subplot(2,2,3);plot(2*abs(X_HPF(1:nfft/2+1)));title('filtered fft 0-5Hz')&#xA;subplot(2,2,4);plot(2*abs(X_HPF(1:nfft/2+1)));title('filtered fft 0-5Hz')&#xA;xlim([0 5])&#xA;&#xA;figure(2);&#xA;subplot(2,1,1);plot(x);title('original samples')&#xA;subplot(2,1,2);plot(x_hpf);title('filtered samples')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/W0mve.jpg&quot; alt=&quot;signal fft&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/S0UoH.jpg&quot; alt=&quot;samples&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-03-24T21:06:04.450" LastActivityDate="2015-03-24T21:06:04.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22280" PostTypeId="2" ParentId="22259" CreationDate="2015-03-23T20:47:49.820" Score="3" Body="&lt;p&gt;The Baum-Welch algorithm uses the &lt;a href=&quot;http://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm&quot; rel=&quot;nofollow&quot;&gt;EM (Expectation Maximization) algorithm&lt;/a&gt; to estimate the model parameters $(T, E, \pi)$, where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T$: the transition probabilities &lt;br&gt;&#xA;$E$: the emition probabilities &lt;br&gt;&#xA;$\pi$: probability distribution on the states &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some years ago, I made the following &lt;a href=&quot;https://github.com/dohmatob/HMM&quot; rel=&quot;nofollow&quot;&gt;quick-and-dirty implementation&lt;/a&gt; (may be fairly broken now), for the discrete case. &lt;br&gt;&lt;br&gt;&#xA;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="15159" LastActivityDate="2015-03-23T20:47:49.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22282" PostTypeId="1" CreationDate="2015-03-23T23:47:40.087" Score="0" ViewCount="151" Body="&lt;p&gt;I took acoustic measurements of a room using sine swept method, and I also used Pioneer sc-37 to obtain more accurate data. &#xA;I used RoomEQ wizard software and measured the impulse response of the room, and got a long list of coefficients. and the Pioneer helped me to get the Q factor, center frequency, and attenuation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I`m in need of some help on how to start the filter design using the data obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;those are the results I got&lt;/p&gt;&#xA;&#xA;&lt;p&gt;frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AedJH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4m7lD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pioneer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pJTWi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QgdWh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kS1p2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate all comments and suggestions.&lt;/p&gt;&#xA;" OwnerUserId="15052" LastActivityDate="2015-03-23T23:47:40.087" Title="MATLAB band-stop filter design for room reverberation?" Tags="|matlab|filter-design|dsp-core|speech-processing|acoustics|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22283" PostTypeId="1" AcceptedAnswerId="22284" CreationDate="2015-03-24T04:39:15.883" Score="1" ViewCount="63" Body="&lt;p&gt;I'm working on a project to transcribe lecture videos. We are currently just using humans to do the transcriptions as we believe it is easier to transcribe than editing ASR, especially for technical subjects (not the point of my question, though I'd love any input on this). From our experiences we've found that after about 10 minutes of transcribing we get anxious or lose focus. Thus we have been splitting videos into ~5-7 minute chunks based on logical breaks in the lecture content. However, we've found that the start of a lecture (at least for the class we are piloting) often has more talking than later on, which often has time where the students are talking among themselves about a question. I was thinking that we could do signal processing to determine the rough amount of speaking throughout the video. The idea is to break the video into segments based on the amount of typing they require, as opposed to splitting based on time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done a little research into this, but everything seems to be a bit overkill for what I'm trying to do. The videos for this course, though we'd like to generalize, contain basically just the lecturer with some occasional feedback and distant student voices. So can I just simply look at the waveform and roughly use the spots containing audio over some threshold to determine when the lecturer is speaking? Or is an ML approach really necessary to quantify the lecturer's speaking?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that made sense, I can clarify anything if necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate the help as I have no experience with signal processing.&lt;/p&gt;&#xA;" OwnerUserId="15161" LastActivityDate="2015-03-24T18:27:10.097" Title="Determining the 'amount' of speaking in a video" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22284" PostTypeId="2" ParentId="22283" CreationDate="2015-03-24T09:25:57.057" Score="0" Body="&lt;p&gt;The most straightforward and easy thing you could do is rectify the signal (i.e. take the absolute value of its samples) and then run a moving average filter to get an approximate estimate of the &quot;envelope&quot; of your signal. Imagine the moving average filter like estimating the mean of the signal values between samples 0-100, then 1-101 then 2-102 and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of this will be an inaudible slow varying waveform. You can then do a histogram on its values and use that to estimate a threshold which could then be used to &quot;tag&quot; the interesting parts of your video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I feel that this is a lot of hard work for this kind of problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I would also like to suggest that you use a video editor that presents the video &quot;signal&quot; as two separate ribbons, one for the actual video and another representing the amplitude of the sound. You can then quickly inspect the audio ribbon and estimate quickly the parts that could be seen as &quot;interesting&quot; and use the video editor to either directly transcribe those areas or cut the video down into smaller segments. Unfortunately, at the moment, I can`t recall a freely available video editor with this feature but if I do I will amend this response.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-24T09:25:57.057" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22285" PostTypeId="2" ParentId="22278" CreationDate="2015-03-24T11:23:33.523" Score="1" Body="&lt;p&gt;If you have multiple recordings of the signal (captured from different electrodes) then you can apply Independent Component Analysis (ICA, &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Independent_component_analysis&lt;/a&gt;) to separate the cardiac component from your signal. (MATLAB toolboxes linked from the Wikipedia article).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a comprehensive description and real world application of this technique (albeit on MEG data), please see: &lt;a href=&quot;http://dx.doi.org/10.1109/TBME.2007.894968&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1109/TBME.2007.894968&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-24T11:23:33.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22286" PostTypeId="1" CreationDate="2015-03-24T11:50:15.233" Score="0" ViewCount="344" Body="&lt;p&gt;I have to calculate SNR of an image. I have camera through which continuous images are getting generated, my requirement is to calculate the SNR in db for each image.&#xA;I have seen lot of the examples where they have added a noise to image then computed the SNR value.&#xA;I have to calculate SNR of each image independently without adding any noise.&#xA;please help.&lt;/p&gt;&#xA;" OwnerUserId="15166" LastEditorUserId="15166" LastEditDate="2015-03-25T14:46:42.043" LastActivityDate="2015-03-25T14:46:42.043" Title="snr calculation of frame" Tags="|matlab|opencv|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22287" PostTypeId="1" AcceptedAnswerId="22288" CreationDate="2015-03-24T11:57:26.687" Score="1" ViewCount="9672" Body="&lt;p&gt;Is there any method for calculating luminance of an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As from wiki got to know Luminance is an amount of energy perceived by the observer and LUX is different from brightness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But still is there any way to calculate LUX value of an image using any of image processing technique.&lt;/p&gt;&#xA;" OwnerUserId="15166" LastEditorUserId="7092" LastEditDate="2015-03-24T14:54:33.263" LastActivityDate="2015-03-24T14:54:33.263" Title="How to calculate the luminance of an image?" Tags="|matlab|image-processing|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22288" PostTypeId="2" ParentId="22287" CreationDate="2015-03-24T12:04:43.583" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/a/4876528/4523099&quot;&gt;https://stackoverflow.com/a/4876528/4523099&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Just convert your image to &lt;a href=&quot;http://en.wikipedia.org/wiki/YUV&quot; rel=&quot;nofollow noreferrer&quot;&gt;YUV format&lt;/a&gt; and calculate the average of luma channel. Color conversion is a typical operation and any decent image processing framework supports it. For example, OpenCV has CvtColor.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, to get an actual Lux value, you will need to calibrate your camera and tell whether it has an auto-setting aperture (see the link above for more details).&lt;/p&gt;&#xA;" OwnerUserId="15118" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-03-24T13:07:33.793" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22289" PostTypeId="2" ParentId="22261" CreationDate="2015-03-24T13:24:50.970" Score="0" Body="&lt;p&gt;What exactly did you expect from segmentation? The problem here is that there aren't real segments to start with. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, this looks like a case for texture-based segmenting. most of the hair has a grooved texture with one predominant direction.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2015-03-24T13:24:50.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22291" PostTypeId="2" ParentId="22256" CreationDate="2015-03-24T14:20:11.913" Score="2" Body="&lt;p&gt;MBaz's revised answer gives all the information necessary to solve the problem, but here is a slightly different take on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A binary code of length $n$ cannot have a minimum distance that exceeds $\frac n2$.  Essentially, the idea is that one cannot go more than half-way into a forest; after one has passed the midpoint, one is coming out of the forest!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be that as it may, for a linear code, the minimum distance is the same&#xA;as the minimum weight (least weight of all the &lt;em&gt;nonzero&lt;/em&gt; codewords)&#xA;of the code. So, for a $[8,4]$ binary code with generator matrix&#xA;$G = [I \mid P]$ where $I$ is the $4\times 4$ identity matrix and&#xA;$P$ a $4\times 4$ matrix that we can choose, let's choose the rows&#xA;of $P$ as the $\binom{4}{3}= 4$ binary vectors of Hamming weight $3$,&#xA;thus making each row of $G$ a vector of weight $4$. Note that the&#xA;&lt;em&gt;columns&lt;/em&gt; of $P$ are also vectors of weight $3$; indeed, one option&#xA;is to complement all the bits of $I$ and take the result to be $P$ !!&#xA;This choice also has the advantage that the right half of each row&#xA;of $G$ is just the complement of the left half.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How about the sum of two rows of $G$? Well, the&#xA;left $4$ positions contribute a weight of $2$ as do the right $4$&#xA;positions, and so these codewords also have weight $4$. There are&#xA;$\binom{4}{2} = 6$ such codewords.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How about the&#xA;sum of $3$ rows of $G$? Well, the left four positions contribute&#xA;a weight of $3$ while in the right four positions, in three positions,&#xA;we are summing $2$ ones and a zero, and in the fourth we are summing&#xA;three ones for a total contribution of $1$ to the weight.  So these&#xA;$\binom{4}{3}= 4$ codewords also have weight $4$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the sum of all $4$ rows of $G$ is just the all-ones vector,&#xA;and we are done. We have shown that all $4+6+4+1 = 15$ nozero codewords&#xA;of this linear code have weight $4$ or $8$, and so the minimum weight&#xA;(and hence the minimum distance) of the code is $4$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-03-24T14:20:11.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22292" PostTypeId="1" CreationDate="2015-03-24T16:05:28.670" Score="0" ViewCount="713" Body="&lt;p&gt;Gentlemen! I have to reproduce MATLAB random normal generator (randn) with some fixed seed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I have to reproduce it in an external script, without MATLAB itself. Has anyone done this? What random normal generator implementation is better to use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Preferred languages are Python and C/C++, but other languages may be useful too.&lt;/p&gt;&#xA;" OwnerUserId="5343" LastEditorUserId="11256" LastEditDate="2015-03-24T16:15:12.920" LastActivityDate="2015-05-24T03:19:49.477" Title="Reproducing MATLAB's randn" Tags="|matlab|random|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22294" PostTypeId="2" ParentId="22292" CreationDate="2015-03-24T17:18:19.303" Score="1" Body="&lt;p&gt;Its hard to say without knowing exactly how Matlab's randn is processed from the RNG you're using and how Matlab uses the seed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most reasonable way is  to save pre-calculated noise data or just deal with a different random number generator (Boost among others has a normal random number generator, and you can pull it into Matlab to use via MEX if necessary). &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-03-24T17:18:19.303" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22295" PostTypeId="2" ParentId="22080" CreationDate="2015-03-24T17:29:10.287" Score="1" Body="&lt;p&gt;libsvm doesn't work with only integer values -- in fact, you're supposed to scale your features to lie within [-1,1] or [0,1] before applying SVM's typically. Read their &lt;a href=&quot;http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf&quot; rel=&quot;nofollow&quot;&gt;guide&lt;/a&gt;. They also have some tricks for dealing with categorical features as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get finitely many values which the feature can take, use &lt;a href=&quot;http://en.wikipedia.org/wiki/Quantization&quot; rel=&quot;nofollow&quot;&gt;quantization&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-03-24T17:29:10.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22296" PostTypeId="2" ParentId="22292" CreationDate="2015-03-24T17:57:44.197" Score="0" Body="&lt;p&gt;python: using the numpy plugin (numpy, scipy, matplotlib will make python incredibly matlab like) has the function already defined &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html&quot; rel=&quot;nofollow&quot;&gt;numpy.random.normal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if this is 'cheating' but unless this is a school project where you must explicitly write out an algorithm I would assume it's ok. I say why reinvent the wheel if you don't need to? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;as endolith pointed out numpy provides another predefined that is even better suited for your situation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randn.html&quot; rel=&quot;nofollow&quot;&gt;numpy.random.randn&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-03-25T02:37:21.087" LastActivityDate="2015-03-25T02:37:21.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22297" PostTypeId="2" ParentId="22283" CreationDate="2015-03-24T18:27:10.097" Score="0" Body="&lt;p&gt;This question is somewhat similar to this &lt;a href=&quot;https://dsp.stackexchange.com/questions/21625/how-to-identify-useful-elements-of-audio-recording-and-ignore-lulls/21628#21628&quot;&gt;How to identify useful elements of audio recording and ignore lulls?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I offered a similar solution to A_A Using a small moving average would remove the need for hysteresis as I used in my code, but the end result should be the same.&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-03-24T18:27:10.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22298" PostTypeId="2" ParentId="22160" CreationDate="2015-03-24T18:59:59.510" Score="0" Body="&lt;p&gt;Perlin? Though to me it looks like a poor nearest-neighbor interpolation, after up-down resampling. I'm just replying with a guess, I admit.&lt;/p&gt;&#xA;" OwnerUserId="8777" LastActivityDate="2015-03-24T18:59:59.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22300" PostTypeId="1" CreationDate="2015-03-24T19:12:47.883" Score="4" ViewCount="368" Body="&lt;p&gt;I am investigating the overlap-add and overlap-save methods for processing an audio signal with a FIR. The FIR is a measured impulse response of a reverberant space and may be of order greater than 100,000. It appears that in order for O-A to work, the signal block length must be at least this length to keep the amount of overlap less than one block length. For example, if the signal block length is 100 ms of audio (L = 4410) and the IR is 3 s of reverb (M = 132300) then each block convolution produces 127890 outputs that must be added to subsequent block convolutions. Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="15173" LastEditorUserId="4346" LastEditDate="2017-01-05T03:56:29.417" LastActivityDate="2017-01-05T03:56:29.417" Title="Fast convolution with very high order FIR" Tags="|fft|convolution|fast-convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22301" PostTypeId="2" ParentId="22300" CreationDate="2015-03-24T19:31:22.647" Score="4" Body="&lt;p&gt;you &lt;strong&gt;can&lt;/strong&gt; split up your long impulse response into smaller segments and use multiple concurrent fast-convolutions that convolve each segment against your audio, align the delays correctly, and add up the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what &lt;strong&gt;must&lt;/strong&gt; be the case for each segment (or one big segment if you don't split it up) is that if the FFT length is $N$ and the impulse response (or segment) length is $L$, the number of output samples you get for each frame is $N-L+1$.  that's the case whether it's overlap-add or overlap-save.  in either case, you pad your impulse response (or segment) with $N-L$ zeros (to bring it to length $N$) and FFT that.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-24T19:31:22.647" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22302" PostTypeId="1" CreationDate="2015-03-24T20:01:03.230" Score="1" ViewCount="322" Body="&lt;p&gt;From my knowledge about &lt;a href=&quot;http://en.wikipedia.org/wiki/Independent_component_analysis&quot; rel=&quot;nofollow&quot;&gt;independent component analysis&lt;/a&gt; the number of channel or variables will not be affected by this algorithm and the number of independent components will be equal to number of variables. But when I tried to run FASTICA algorithm on EEG signal matrix which has 14 channels (or 14 variabls), the number of independent components was 9 not 14,  which is confused me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a clarification about this?&lt;/p&gt;&#xA;" OwnerUserId="15174" LastEditorUserId="15174" LastEditDate="2015-03-25T16:28:03.437" LastActivityDate="2015-03-28T07:12:00.480" Title="FASTICA algoritm produce independent components does not equal to the dimensionality of EEG signals" Tags="|matlab|eeg|ica|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22303" PostTypeId="1" AcceptedAnswerId="22305" CreationDate="2015-03-24T20:14:52.360" Score="1" ViewCount="123" Body="&lt;p&gt;I have a class exercise of an inverse Z transform and I have some trouble. I will render an example to make my point. Let's asume the Z transform pairs:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$a^n \cdot u[n] \Leftrightarrow \frac{1}{1-az^{-1}}  \qquad\qquad x[n-k] \Leftrightarrow z^{-k}X(z) \qquad\qquad \delta[n] \Leftrightarrow 1 $$&lt;/span&gt;&#xA;Given the following function, we want its inverse Z transform:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H(z) = \frac{p_0p_1z^{-2}}{(1-p_0z^{-1})(1-p_1z^{-1})  } $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;First Method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Simple fraction expansion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(z) = z^{-2}\left( \frac{\dfrac{p_0^2p_1}{p_0-p_1}}{1-p_0z^{-1}} + \frac{\dfrac{p_0p_1^2}{p_1-p_0}}{1-p_1z^{-1}} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the properties:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\begin{aligned}&#xA;h[n] &amp;amp;=   \frac{p_0^2p_1}{p_0-p_1} p_0^{n-2} \cdot u[n-2] + \frac{p_0p_1^2}{p_1-p_0} p_1^{n-2} \cdot u[n-2] \\&#xA;\\&#xA;h[n] &amp;amp;=   \frac{p_1}{p_0-p_1} p_0^{n} \cdot u[n-2] + \frac{p_0}{p_1-p_0} p_1^{n} \cdot u[n-2] &#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Second Method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Adding and subctracting 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;H(z) &amp;amp;= 1 + \frac{p_0p_1z^{-2}}{(1-p_0z^{-1})(1-p_1z^{-1})} -1 \\&#xA;&amp;amp;= 1 + \frac{(p_0+p_1)z^{-1}-1}{(1-p_0z^{-1})(1-p_1z^{-1})} &#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple fraction expansion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;H(z) &amp;amp;=  1 + \frac{\dfrac{p_1}{p_0-p_1}}{1-p_0z^{-1}} + \frac{\dfrac{p_0}{p_1-p_0}}{1-p_1z^{-1}} \\&#xA;\\&#xA;h[n] &amp;amp;=   \delta[n] + \frac{p_1}{p_0-p_1} p_0^{n} \cdot u[n] + \frac{p_0}{p_1-p_0} p_1^{n} \cdot u[n] &#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Conclusion&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Both solutions are quite similar, they are the same in the interval [2,&lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;) but different in the interval [0,2]. So, where is the error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15175" LastEditorUserId="47251" LastEditDate="2020-02-17T21:15:35.687" LastActivityDate="2020-02-17T21:15:35.687" Title="Z Transform problem" Tags="|discrete-signals|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22304" PostTypeId="1" CreationDate="2015-03-24T20:24:24.560" Score="0" ViewCount="68" Body="&lt;p&gt;I have a motion signal that you can think of as a sequence of pairs (x,y); what would be the best approach to decimate this sequence at real time?&#xA;I haven't found anything similar on the web and I'm still learning about dsp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="15176" LastActivityDate="2015-03-25T07:06:32.293" Title="Decimation of motion" Tags="|filters|decimation|motion|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22305" PostTypeId="2" ParentId="22303" CreationDate="2015-03-24T20:35:28.477" Score="2" Body="&lt;p&gt;Both solutions are correct, and, consequently, identical. Your second solution evaluated at $n=0$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1+\frac{p_1}{p_0-p_1}+\frac{p_0}{p_1-p_0}=1+\frac{p_1-p_0}{p_0-p_1}=1-1=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And at $n=1$ you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$0+\frac{p_0p_1}{p_0-p_1}+\frac{p_0p_1}{p_1-p_0}=\frac{p_0p_1-p_0p_1}{p_0-p_1}=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the inverse $\mathcal{Z}$-transform can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=\frac{p_0^np_1-p_0p_1^n}{p_0-p_1}u[n-2]$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-24T20:43:32.603" LastActivityDate="2015-03-24T20:43:32.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22306" PostTypeId="1" CreationDate="2015-03-24T21:43:11.763" Score="3" ViewCount="406" Body="&lt;p&gt;I have several signals that consist of repetitive units. In the figure you'll clearly see the variability of the signals, that increases top down. The first signal is super repetitive and units are indicated with green lines.&#xA;In the third, you'll see peaks and in the middle a little insertion that I know consists of rather diverging units, which still are units however (red lines). &#xA;The remaining three signals display the variation more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which signal processing / machine learning tool should I use in order to detect these units? With thresholding it works to find the significant peaks, but once signals get funky it's really difficult to accurately detect unit positions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4Zdqe.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Edit: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made some progress with spectral analysis and plotted a filtered signal over the initial signals. Indicated by the blue arrow is a region variable repeats. Here, the amplitude of the original and filtered signal do not match. Same for the red arrow. Similar effects for signal further down.&lt;img src=&quot;https://i.stack.imgur.com/xpqPM.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="15177" LastEditorUserId="15177" LastEditDate="2015-03-26T21:36:28.660" LastActivityDate="2016-01-21T09:43:32.413" Title="Detect repetitive units within signals" Tags="|signal-analysis|frequency-spectrum|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22307" PostTypeId="2" ParentId="22306" CreationDate="2015-03-25T01:32:46.633" Score="1" Body="&lt;p&gt;Your repetitive signal seem to be in a lower rate than the noise. I would run an FFT (why short) on all 6 sequences and filter out (zero) the frequencies that are clearly attributed to noise and then run an inverse FFT. &#xA;If you know the repetition rate you might select the one frequency that has the correct information and use the phase information to locate the desired pick. I will try to include exactly 20 cycles if possible (or 16 or 32).&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-25T01:32:46.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22308" PostTypeId="2" ParentId="22304" CreationDate="2015-03-25T01:38:49.700" Score="0" Body="&lt;p&gt;If the (x,y) are in depended you could decimate each separately. may be the best way for you will be to run a rough low pass filter (-.5, 1, -.5) or more aggressive one and than select every other value. &#xA;If you do not know enough about characteristics of the 2D signal, you might benefit from attempting several tests with various filters before decimation.&#xA;Just remember that a basic assumption is that your signal is in the lower end of the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-03-25T01:38:49.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22309" PostTypeId="1" AcceptedAnswerId="22311" CreationDate="2015-03-25T05:36:41.530" Score="0" ViewCount="1913" Body="&lt;p&gt;I sampled a 50Hz sine wave (its not perfectly a sine wave, it's a data coming from current sensor using Arduino).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using real time graphing technique by sending the data from Arduino to the PC I managed to reconstruct the signal as attached here &lt;img src=&quot;https://i.stack.imgur.com/5Hug9.png&quot; alt=&quot;enter image description here&quot;&gt;     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second experiment I logged my data into an SD card, my sampling rate was 5000 and when I tried to reconstruct the signal in MATLAB, I got this graph which doesn't construct the original signal back, but rather its strange as bellow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kVr48.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the maximum values for the both graphs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the signal is not correctly reconstructed? I sampled it at 5000 Hz which is almost 10 times the original signal frequency and it meets Nyquist criteria ... And as a result of wrongly constructed signal the FFT is indicating the frequency of &lt;strong&gt;zero&lt;/strong&gt; not 50 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MATLAB code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filename = 'C:\Users\Sabir\Desktop\internship Sri Wawasan\testFFT.csv';&#xA;&#xA;% thee file&#xA;&#xA;fid = fopen(filename,'rt');&#xA;[data]=textscan(fid, ' %f',...%the values of the sensors as cell array &#xA;       'delimiter',',')  ;                        &#xA;fclose(fid);&#xA;&#xA;sensorMatrix=cell2mat(data);&#xA;&#xA;% the values of the sensors as matrix&#xA;&#xA;%taking some point from the sensors matrix&#xA;&#xA;y=sensorMatrix(1:3000,1);% array of one chanel &#xA;&#xA; plot (y)&#xA;&#xA;L=length(y)&#xA;&#xA;Fs = 5000;                    % Sampling frequency&#xA;&#xA;T = 1/Fs;                     % Sample time              % Length of signal&#xA;&#xA;t = (0:L-1)*T;                % Time vector&#xA;&#xA;plot(Fs*t,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and finally here is the FFT, it has 100 Hz and 150 Hz components&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/suD0Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15181" LastEditorUserId="15181" LastEditDate="2015-03-27T01:43:03.747" LastActivityDate="2018-11-25T09:47:59.860" Title="aliasing to a 50 Hz sine wave sampled at 5000 Hz sampling rate?" Tags="|matlab|fft|signal-analysis|aliasing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22310" PostTypeId="2" ParentId="22304" CreationDate="2015-03-25T05:46:54.590" Score="1" Body="&lt;p&gt;Use predictive coding. If your predictor manages to guess current position based on previous recorded positions with reasonable accuracy — you can omit the recording of current position. Same predictor will also help you to reconstruct the original path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What predictor you should use is based on the tracked object's nature. You may use a Kalman filter for example. Or you may use something really simple such as 'assume object always stays at the same place. If we are moving — record it'. Or 'assume object always travels along the straight line', etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your predictor will do a good job, you can additionally use Huffman coding — small corrections of prediction errors will have shorter bit sequences, significant corrections — longer bit sequences. It will save you a huge amount of space with near-to-perfect reconstruction.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastEditorUserId="15103" LastEditDate="2015-03-25T07:06:32.293" LastActivityDate="2015-03-25T07:06:32.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22311" PostTypeId="2" ParentId="22309" CreationDate="2015-03-25T06:05:45.347" Score="2" Body="&lt;p&gt;You do have zeroth frequency in your signal indeed. If you don't, your signal would be centered around zero volts. Zeroth frequency is a DC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to measure the frequency of an AC component, center the signal around zero volts (subtract the mean). By the way, FFT is not a good instrument to measure frequency of an arbitrary signal because it uses a fixed set of harmonics, which may or may not coincide with your signal (and FFT will give you a maximum on a nearest one).&lt;/p&gt;&#xA;" OwnerUserId="15103" LastEditorUserId="15103" LastEditDate="2015-03-25T06:14:29.620" LastActivityDate="2015-03-25T06:14:29.620" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22312" PostTypeId="2" ParentId="18349" CreationDate="2015-03-25T06:21:10.250" Score="0" Body="&lt;p&gt;Multiplying by purely complex exponential is basically a phase shift. If you shift original image, the amplitude of its frequency components remains the same, the only thing that changes is the phase of those components. That's the shifting property of an FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shifting is done by moving the origin point of an image. If $f(x,y)$ is your original image, then $f(x+x_0,y+y_0)$ is your spatially shifted image where point of image originally located at $(0,0)$ is now located at $(x_0,y_0)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first formula is describing something else — the multiplication of an image by sinusoid (complex exponential). It will translate image's components in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastEditorUserId="15103" LastEditDate="2015-03-25T06:35:43.980" LastActivityDate="2015-03-25T06:35:43.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22313" PostTypeId="2" ParentId="7666" CreationDate="2015-03-25T06:52:41.220" Score="0" Body="&lt;p&gt;It's not a bimodality, it's a dominance of a background that turns out to be &quot;enhanced&quot; by algorithm. Find out how to select only the region of interest for processing. Heavy median filtering + thresholding should do the trick in your case.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-03-25T06:52:41.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22314" PostTypeId="1" AcceptedAnswerId="50434" CreationDate="2015-03-25T08:19:53.563" Score="3" ViewCount="5356" Body="&lt;p&gt;I am using a DSP processor to sample signals at 108kHz and I only want to get the DC part out of it. Such a high sampling rate is used because I want to use oversampling to reduce quantization noises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two filters are to be designed: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One has 10Hz stop-band frequency; new data are read every 0.1 second;&lt;/li&gt;&#xA;&lt;li&gt;One has 0.1Hz stop-band frequency; new data are read every 10 second;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;What I did&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I used several stages of decimation and downsample the signals to 300Hz. Then I use FIRs to filter the signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For the 10Hz bandwidth: 128 stage filters are used&lt;/li&gt;&#xA;&lt;li&gt;For the 0.1Hz bandwidth: 768 stage filters are used.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h1&gt;My question&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Performance is the most important to me: The sharper low-pass filters are, the better. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Could I ask for suggestions in implementing such a filter?&lt;/li&gt;&#xA;&lt;li&gt;Is it possible to design a 0.01Hz low pass filter? If so, the new data can be read every 100 seconds?&lt;/li&gt;&#xA;&lt;li&gt;I heard that using IIRs could be a solution, is it?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Is averaging the best DC filter?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I tried to compare with matlab:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting 1:&#xA;%Use Matlab fir1 function&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;size = 1080000;&#xA;    h = fir1(size, 0.00000000001);&#xA;    fvtool(h)&#xA;    &lt;img src=&quot;https://i.stack.imgur.com/l3EVr.jpg&quot; alt=&quot;FIR1&quot;&gt;&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Setting 2:&#xA;%Build an averaging FIR &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;size = 1080000;&#xA;    h = ones(1,size);&#xA;    h = h *1/size;&#xA;    fvtool(h)&#xA;    &lt;img src=&quot;https://i.stack.imgur.com/wPwam.jpg&quot; alt=&quot;average&quot;&gt;&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The theory should be both two settings have similar performance. However, it seems that fir1 has narrower stopband than the simple average filter. It seems that the average DC filter will include more noises.&lt;/p&gt;&#xA;" OwnerUserId="10200" LastEditorUserId="10200" LastEditDate="2015-03-26T09:10:23.497" LastActivityDate="2022-05-15T06:39:44.550" Title="How to design very narrow band, very sharp low pass filters - Only DC needed?" Tags="|lowpass-filter|decimation|finite-impulse-response|" AnswerCount="5" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22315" PostTypeId="2" ParentId="7666" CreationDate="2015-03-25T09:07:06.737" Score="1" Body="&lt;p&gt;In this case, you can decompose your image into a set of (overlapping) image patches, apply equalization for each patch and merge the results.&#xA;You can find more information about this approach by searching for &lt;a href=&quot;http://en.wikipedia.org/wiki/Adaptive_histogram_equalization&quot; rel=&quot;nofollow&quot;&gt;adaptive histogram equalization&lt;/a&gt; algorithms (&lt;a href=&quot;http://radonc.ucsf.edu/research_group/jpouliot/tutorial/HU/Lesson7.htm&quot; rel=&quot;nofollow&quot;&gt;CLAHE&lt;/a&gt; for example).&lt;/p&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2015-03-25T09:07:06.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22316" PostTypeId="1" AcceptedAnswerId="22339" CreationDate="2015-03-25T09:14:31.007" Score="7" ViewCount="9128" Body="&lt;p&gt;I am trying to implement BPSK demodulator in FPGA. First, I am modeling the system in MATLAB. Now, I am trying to design Costas Loop for carrier synchronization. This is the block diagram I'm trying to achieve:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/l2dmx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using RRC as a low pass filter. This is the MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;load RRC.mat&#xA;&#xA;fc = 0.05; % 0.11  %0.09&#xA;N = length(rf_signal);&#xA;bb = zeros(1, N);&#xA;bb_f = zeros(1, N);&#xA;I_f = zeros(1, N);&#xA;Q_f = zeros(1, N);&#xA;I_r = zeros(1, N);&#xA;Q_r = zeros(1, N);&#xA;error = zeros(1, N);&#xA;PhErr = zeros(1, N);&#xA;error_integral = zeros(1, N);&#xA;Theta = zeros(1, N);&#xA;&#xA;% Loop Filter Coefficients&#xA;BW = 100;  % Hz&#xA;loop_theta = 2*pi*BW;&#xA;C1 = 4*(loop_theta)^2/(1+sqrt(2)*loop_theta+loop_theta^2);&#xA;C2 = 2*sqrt(2)*loop_theta/(1+sqrt(2)*loop_theta+loop_theta^2);&#xA;&#xA;for i = 2:N&#xA;    % Downconverting to Baseband&#xA;    bb(i) = rf_signal(i).*exp(j*2*pi*fc*i).*exp(j*Theta(i-1));&#xA;&#xA;    % Filtering&#xA;    bb_f = filter(RRC, bb(1:i));&#xA;    I_f(i) = real(bb_f(i));&#xA;    Q_f(i) = imag(bb_f(i));&#xA;&#xA;    % Error&#xA;    error(i) = I_f(i).*Q_f(i);&#xA;&#xA;    % Loop Filter&#xA;    error_integral(i) = error(i).*C1 + error_integral(i-1);&#xA;    PhErr(i) = error(i).*C2 + error_integral(i);&#xA;&#xA;    % Phase Accumulator&#xA;    Theta(i) = Theta(i-1) + PhErr(i);&#xA;&#xA;end&#xA;&#xA;figure; subplot 221; plot(real(bb)); title('I Channel')&#xA;subplot 222; plot(imag(bb)); title('Q Channel')&#xA;subplot 223; plot(I_f); title('I Channel Filter')&#xA;subplot 224; plot(Q_f); title('Q Channel Filter')&#xA;&#xA;figure; subplot 311; plot(error); title('Phase Error');&#xA;subplot 312; plot(PhErr); title('Loop Filter');&#xA;subplot 313; plot(Theta); title('Control Signal \theta');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;rf_signal&lt;/code&gt; comes from another script that generates BPSK signal.&#xA;However, when I close the loop and set frequency exactly as the transmitter's I get these waveforms:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/EXWb8.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fmQNh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the signal demodulates very well when I open the loop. I have tested the loop with a cosine wave and it works just fine by producing a DC signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15183" LastEditorUserId="1606" LastEditDate="2015-03-26T08:50:30.317" LastActivityDate="2015-06-05T06:17:38.253" Title="Simulating BPSK Costas Loop in Matlab" Tags="|matlab|digital-communications|bpsk|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22318" PostTypeId="2" ParentId="19337" CreationDate="2015-03-25T11:06:26.617" Score="1" Body="&lt;p&gt;In response to your followup question on Simon's answer, it turns out that the RMS of a signal in the time domain is directly proportional to the RMS of the signal in the frequency domain. As noted on &lt;a href=&quot;http://en.wikipedia.org/wiki/Root_mean_square#RMS_in_frequency_domain&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;, for a TD signal $x$ with $N$ samples, and its transform $X$ with $N$ FFT coefficients, $\mathrm{RMS}\left[x\right]=\frac{1}{N}\mathrm{RMS}\left[X\right]$.&lt;/p&gt;&#xA;" OwnerUserId="15185" LastActivityDate="2015-03-25T11:06:26.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22319" PostTypeId="2" ParentId="22300" CreationDate="2015-03-25T12:42:54.153" Score="1" Body="&lt;p&gt;Thanks for the responses. I have since found that my concerns were needless - you just need a long enough buffer. I wrote the following MATLAB function to process one block of input and tested it with a separate script on a large input stream. It worked just fine.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [y,outBuffer]=overlapAdd(x,h,inBuffer)&#xA;L=length(x);&#xA;% M=length(h); add for error check&#xA;N=length(inBuffer); %N &amp;gt;= L+M-1&#xA;inBuffer=inBuffer+ifft(fft(h,N).*fft(x,N));&#xA;y=inBuffer(1:L);&#xA;outBuffer=[inBuffer(L+1:N); zeros(L,1)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In my test case the block size L was 4800, the impulse response length M was 240000 and the total signal length was 352257. The buffer size was L + M + 1 = 244799.&lt;/p&gt;&#xA;" OwnerUserId="15173" LastEditorUserId="80" LastEditDate="2015-03-25T12:44:06.627" LastActivityDate="2015-03-25T12:44:06.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22320" PostTypeId="1" AcceptedAnswerId="22329" CreationDate="2015-03-25T13:42:10.400" Score="1" ViewCount="728" Body="&lt;p&gt;I'm trying to implement a simple FHT on .NET platform myself. I follow this document: &lt;a href=&quot;http://imagej.nih.gov/nih-image/download/nih-image_spin-offs/imageFFT/docs/thesis.pdf&quot; rel=&quot;nofollow&quot;&gt;Optimized fast Hartley transform for the MC68000 with applications in image processing.&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&#xA;In the page 20th, equation (20):&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;H(k) = H&lt;sub&gt;e&lt;/sub&gt;(k) + [H&lt;sub&gt;o&lt;/sub&gt;(k)cos(2πk/N) + H&lt;sub&gt;o&lt;/sub&gt;(N/2-k)sin(2πk/N)]&lt;br/&gt; H(k+N/2) = H&lt;sub&gt;e&lt;/sub&gt;(k) -&#xA;  [H&lt;sub&gt;o&lt;/sub&gt;(k)cos(2πk/N) + H&lt;sub&gt;o&lt;/sub&gt;(N/2-k)sin(2πk/N)]&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;H&lt;sub&gt;e&lt;/sub&gt;(k) is the N/2 point DHT of the even indexed elements of&#xA;  H(k) and&lt;br/&gt;&#xA;  H&lt;sub&gt;o&lt;/sub&gt;(k) is the N/2 point DHT of the odd indexed&#xA;  elements of H(k)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$k$ is zero index, so where is the item $N/2$ if $N/2$ is the length? I know I must have misunderstood something, but I realy don't know what exactly the H&lt;sub&gt;o&lt;/sub&gt; and H&lt;sub&gt;e&lt;/sub&gt; are. I have succeeded implement the FFT equation (in the page 17th). But the FHT, I can not.&lt;br/&gt;&lt;br/&gt;&#xA;Can somebody please help me explain the above equation details?&lt;/p&gt;&#xA;" OwnerUserId="15039" LastEditorUserId="7092" LastEditDate="2015-03-25T17:09:16.267" LastActivityDate="2015-03-25T18:08:41.350" Title="Implement Fast Hartley Transform" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22321" PostTypeId="1" AcceptedAnswerId="22335" CreationDate="2015-03-25T13:58:12.340" Score="3" ViewCount="2343" Body="&lt;p&gt;I wanted to verify the fact that main lobe width of a Hann/Hamming window is twice that of a rectangular window, using Matlab. I computed the analytical expressions for the respective frequency responses, and plotted them. I do not get the expected result. Can someone explain this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;omega = -pi:0.01:pi;&#xA;N = 20;&#xA;fn = exp(-j*omega*(N/2 - 0.5)).*((sin(omega*N/2))./(sin(omega/2)));&#xA;shift = (length(omega)-1)/(N-1); % 2pi/(N-1); length(omega) = 2*pi&#xA;fn2 = 0.54*fn' + 0.23*circshift(fn',ceil(shift)) + 0.23*circshift(fn',-ceil(shift));&#xA;plot(abs(fn)/max(abs(fn)))&#xA;hold on&#xA;plot(abs(fn2)/max(abs(fn2)),'r')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the plot : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sG3d7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, neither is the main lobe wider, nor are the side lobes smaller.&lt;/p&gt;&#xA;" OwnerUserId="5641" LastEditorUserId="4298" LastEditDate="2020-11-08T17:10:21.967" LastActivityDate="2020-11-08T17:10:21.967" Title="Computing main lobe width of Hamming window in Matlab by plotting" Tags="|matlab|discrete-signals|window-functions|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22322" PostTypeId="2" ParentId="22314" CreationDate="2015-03-25T15:00:20.050" Score="2" Body="&lt;p&gt;If all you want to do is get an estimate of the DC component of your data then you can simply obtain the average value of your signal over a unit of time. This can be easily shown by looking at the expression for calculating the Fourier coefficients for 'f=0' (DC component).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to do this is via a moving average filter (&lt;a href=&quot;http://en.wikipedia.org/wiki/Moving_average&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Moving_average&lt;/a&gt;) which would work over a buffer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of an FIR filter, this looks like 'h = ones(1,Nbuff)./Nbuff' (so, 'h=[0.5,0.5]' for a 2 sample buffer). 'Nbuff' stands for the order of the filter. This can be applied directly on the buffer you obtain from your CODEC through a convolution function as provided by your processor's command set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also use an 'online algorithm' (an IIR filter essentially) which maintains an updated estimate of the mean of the signal on a per-sample basis. For this purpose please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm&lt;/a&gt; You could also design a &quot;typical&quot; IIR filter that can be as strict as you like, provided that your processor and sampling period can accommodate the computations required. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Of course you can adapt between working in terms of frames and working in terms of individual samples)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a note, I have a feeling that you are struggling with the concept of Group Delay. The cut off frequency of your filter does not exactly mean that &quot;new data can be read every 100 seconds&quot;. New data will be fed to your filter constantly, at the sampling rate of the system, but the phase delay caused on each harmonic component of your signal between the input and the output of the system might vary. How this varies, depends on the type of the system (whether it is FIR / IIR) and its form. Here is a starting point: &lt;a href=&quot;http://en.wikipedia.org/wiki/Group_delay_and_phase_delay&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Group_delay_and_phase_delay&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-25T15:00:20.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22323" PostTypeId="2" ParentId="22314" CreationDate="2015-03-25T15:22:30.957" Score="1" Body="&lt;p&gt;The easiest way (and actually make sense) is to find the average of your input signal.&lt;br&gt;&#xA;If you &lt;strong&gt;only need the DC component&lt;/strong&gt;, there is nothing to do with Passband or Stopband, sharp enough or not, FIR or IIR, ...    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just remind yourself again, what do you actually want?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Extended Ans&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Time Domain&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DC component = constant (0 Hz) = not vary in amplitude.&lt;br&gt;&#xA;Other components (freq &gt; 0 Hz) = go positive and negative over times.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you calculate the mean value of the waveform, the positive and negative part will cancel each other and leave you the DC component.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start with sinusoidal signal, Have you got this point?  &lt;/li&gt;&#xA;&lt;li&gt;Any signal can be realized as the sum of sinusoidal signals which vary in frequency and amplitude.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, you can get DC component from averaging the signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Frequency Domain&lt;/em&gt;&lt;/strong&gt;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use FFT to find spectrum of signal, the first point of output is the DC component (0 Hz). This is theoretically supported by Fourier. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Evaluation&lt;/strong&gt;&lt;br&gt;&#xA;To test your approach, you need experiments.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate your known signal with DC offset.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Get DC part using each approach (1. filtering with LPF and 2. averaging)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the accuracy of DC output with a &lt;em&gt;priori&lt;/em&gt; offset.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Try more waveform as well as the random signals.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastEditorUserId="13507" LastEditDate="2015-03-26T19:38:25.710" LastActivityDate="2015-03-26T19:38:25.710" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22325" PostTypeId="1" AcceptedAnswerId="22326" CreationDate="2015-03-25T16:21:02.790" Score="0" ViewCount="222" Body="&lt;p&gt;I'm currently attempting to study up on adaptive digital filters. My book presents the diagram I've included below and I'm having trouble understanding conceptually what it's indicating. The problem deals with noise cancelation. The idea is that someone is driving and makes a phone call. The &lt;em&gt;x(k)&lt;/em&gt; is their voice input. There's a reference mic at &lt;em&gt;v(k)&lt;/em&gt; which picks up road noise. I know that the ultimate goal is to filter road noise from our transmitted voice signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The desired output is obviously:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;d(k)=x(k)+v(k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error in this case is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e(k)=x(k)+v(k)-y(k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking a quote from my book, it states&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the speech &lt;em&gt;x(k)&lt;/em&gt; and the additive road noise &lt;em&gt;v(k)&lt;/em&gt; are uncorrelated with one another, then the&#xA;  minimum possible value for $e^2(k)$ occurs when &lt;em&gt;y(k) = v(k)&lt;/em&gt;, which corresponds to the road&#xA;  noise being removed completely from the transmitted speech signal e(k).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand how &lt;em&gt;e(k)&lt;/em&gt; is our output of the system though. It seems to me that if we minimize our error, then it approaches zero. This means that $d(k)-y(k) = e(k)=0$ Consequently if our output is the error and we've minimized it, it seems like we're outputting 0 not a transmitted signal &lt;em&gt;e(k)&lt;/em&gt; with the road noise removed!? I guess I'm asking why our desired output &lt;em&gt;d(k)&lt;/em&gt; isn't our output....why is the error the output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody help me understand this conceptually? Thank you for your help! Please let me know if I need to clarify anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jggp9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="14943" LastActivityDate="2015-03-25T18:00:10.443" Title="Adaptive Digital Filter Block Diagram Question" Tags="|noise|adaptive-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22326" PostTypeId="2" ParentId="22325" CreationDate="2015-03-25T16:59:30.327" Score="0" Body="&lt;p&gt;Judging from the figure, the situation is slightly different from your explanation in the question. The noise $v(k)$ is the actual noise in the signal, not the noise picked up by the reference microphone. So the noisy signal is $d(k)=x(k)+v(k)$. If you knew $v(k)$ you could simply subtract it from $x(k)$ without the need to use an adaptive filter. What you have is another noise signal $r(k)$, which is a filtered version of the noise $v(k)$. This unknown filter is depicted by the &quot;black box&quot; in the figure. It is filtered because the transfer function from the noise source (road, tires, etc.) to the reference microphone is different from the transfer function to the microphone recording the speech. What the adaptive filter is trying to do is estimate the noise in the speech signal from the reference noise, i.e. it tries to invert the unknown filter in the black box. This can be achieved by minimizing the power of the error signal $e(k)$. The reason is that if you assume that speech and noise are uncorrelated, the output of the adaptive filter can only reduce the noise component in $d(k)$, not the speech component. So the power of $e(k)$ becomes a minimum if the output of the adaptive filter $y(k)$ equals $v(k)$. You don't need to worry that the speech signal is removed because $y(k)$ cannot model the speech signal at all, because noise and speech are assumed to be uncorrelated. So ideally the error signal $e(k)$ contains only clean speech. Note that due to noise and speech being uncorrelated, the power of $e(k)$ can never become zero. Neither can the error signal itself become zero (for all $k$).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-25T18:00:10.443" LastActivityDate="2015-03-25T18:00:10.443" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22328" PostTypeId="1" AcceptedAnswerId="22340" CreationDate="2015-03-25T17:57:25.743" Score="0" ViewCount="399" Body="&lt;p&gt;I see in a paper mentioning ycbcr as well as ycbycr. I am wondering what is the difference between the two? In the figure, the first two lines show ycbycr but the two bottom lines show ycbycr?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FIMjh.jpg&quot; alt=&quot;Difference ycbycr vs ycbcr&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15187" LastActivityDate="2015-03-26T07:14:08.313" Title="Difference between ycbcr and ycbycr" Tags="|image-processing|color|video|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22329" PostTypeId="2" ParentId="22320" CreationDate="2015-03-25T18:08:41.350" Score="0" Body="&lt;p&gt;First of all, I'm pretty sure that $H_e(k)$ is the $N/2$ point DHT of the even elements of the &lt;em&gt;original sequence&lt;/em&gt; to be transformed, not of $H(k)$. The same is true for $H_o(k)$. As for the index $k$, when used with $H_e(k)$ and $H_o(k)$, it is evaluated modulo $N/2$, so it ranges from $0$ to $N/2-1$. So the index $k=N/2$ is mapped to the index $0$ when evaluating $H_e(k)$ and $H_o(k)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-25T18:08:41.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22334" PostTypeId="2" ParentId="22321" CreationDate="2015-03-25T21:17:10.580" Score="3" Body="&lt;p&gt;I think your analytical expressions for the frequency response of the windows have an error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to do the comparison is to create the windows in the time domain and take an FFT.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x1 = ones(20,1);  % rectangular window&#xA;x2 = hamming(20); % hamming window&#xA;&#xA;% normalize&#xA;x1 = x1 / sum(x1);&#xA;x2 = x2 / sum(x2);&#xA;&#xA;X1 = mag2db(abs(fftshift(fft(x1,1024))));&#xA;X2 = mag2db(abs(fftshift(fft(x2,1024))));&#xA;&#xA;plot(X1)&#xA;hold on; grid on&#xA;plot(X2,'r')&#xA;legend('Rectangular','Hamming')&#xA;ylim([-50 0])&#xA;xlim([1 1024])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qcydK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5843" LastActivityDate="2015-03-25T21:17:10.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22335" PostTypeId="2" ParentId="22321" CreationDate="2015-03-25T22:41:42.063" Score="4" Body="&lt;p&gt;The problem is the way you shift the transform of the rectangular window to compute the transform of the Hamming window. You can't just shift on the discrete frequency grid, but you have to evaluate the (continuously) shifted functions on the grid. If $W_r(\omega)$ is the transform of the rectangular window&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W_r(\omega)=\frac{1}{N}e^{-j\omega (N-1)/2}\frac{\sin(N\omega /2)}{\sin(\omega/2)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the transform of the Hamming window can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W_h(\omega)=\alpha W(\omega)-\frac{\beta}{2}\left[W_r(\omega-\omega_0)+W_r(\omega+\omega_0)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\alpha=0.54$, $\beta=0.46$, and $\omega_0=2\pi/(N-1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab/Octave you get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;w = -pi:0.01:pi;&#xA;N = 20;&#xA;w0 = 2*pi/(N-1);&#xA;Wr = 1/N*exp(-j*w*(N-1)/2).*sin(N*w/2)./sin(w/2);&#xA;W1 = 1/N*exp(-j*(w-w0)*(N-1)/2).*sin(N*(w-w0)/2)./sin((w-w0)/2);&#xA;W2 = 1/N*exp(-j*(w+w0)*(N-1)/2).*sin(N*(w+w0)/2)./sin((w+w0)/2);&#xA;Wh = .54*Wr -.23*(W1+W2);&#xA;&#xA;plot(w/pi,20*log10(abs(Wr)),w/pi,20*log10(abs(Wh)/max(abs(Wh))))&#xA;axis([-1,1,-60,0]), grid&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MvksH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another error I've mentioned in the comments is the sign of the shifted windows in your formula. The positive sign that you use is valid for a zero-phase Hamming window, i.e. a window that is centered at $n=0$. However, your rectangular window starts at $n=0$, so it's not a zero-phase window. Consequently, combining the two windows as if they were both zero-phase doesn't work. That's where the negative sign in my formula comes from (both windows start at $n=0$). If you change the sign in your code the result is much closer to a Hamming window than before, but it's still off due to the shift on the grid I've mentioned above. In the figure below you can see the difference (blue: exact Hamming; red: your solution with corrected sign):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mO3nx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-26T08:20:34.107" LastActivityDate="2015-03-26T08:20:34.107" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22336" PostTypeId="1" AcceptedAnswerId="22342" CreationDate="2015-03-25T23:08:26.883" Score="5" ViewCount="1588" Body="&lt;p&gt;I need to run comparisons on the output of hundreds of frames of simple 3D-rendered characters. Perceptually, many of the frames are exact duplicates. Based on this, I assumed something like a perceptual hash and comparison using &lt;a href=&quot;http://www.phash.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;pHash&lt;/a&gt; would work great. And in some cases it does...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm noticing that it doesn't tolerate minor (read: practically impossible for the human eye to see) color or contrast variations. Because of the nature of the rendered frames I received, there are some frames that are apparently different enough for pHash to conclusively decide that they are &lt;strong&gt;not&lt;/strong&gt; the exact same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two example images along with a difference image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cqAlm.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/gUGUG.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/6IQLE.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pHash gives me a 0.473464% deviation between these images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All those variations are enough to throw off pHash. Actually, pHash is able to tell that they are very similar, but I need a consistent low threshold to use for programmatic comparison. Other frames which actually deviate a tiny bit are sometimes considered &lt;strong&gt;more&lt;/strong&gt; similar than the example above, even though they have perceptual differences. Which means I can't rely on pHash alone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two frames that are actually different (notice that his hands have moved a tiny bit):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dIAni.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/VuZAB.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet pHash gives me a difference percentage of 0.0188496%, which is less than 0.473464% from above, meaning that the frames that are perceptually different are actually considered more similar according to pHash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried scaling and blurring the images a good bit to reduce any color variations, but I ended up having to do a ton of blurring to get closer. I don't want to do this too much, because I &lt;strong&gt;do&lt;/strong&gt; want significant color changes to be considered as a unique frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if there is a flash of light that illuminates the character, even if his character model is rendered in the exact same position, those frames should be considered unique:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hR6Kh.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/I4dDg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I tried Canny edge detection. This worked okay. Two problematic frames that are, for all intents and purposes, precise duplicates exhibited less differences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XL4GD.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/xlgAe.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/wQfwF.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only issue I have with this method is that it only considers edges, which normally would be sufficient. If the character model changes at all, different edges should be detected. But this pretty much ignores significant color changes as mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is what is the best way for me to compare images like this and effectively counter insignificant color/contrast/noise variations? Seemingly pHash is ideal because of its perceptual nature, but I'm uncertain what I need to do as far as preprocessing to guarantee consistency from pHash (or some other algorithm, if it's better).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&lt;/p&gt;&#xA;" OwnerDisplayName="user15190" LastEditorDisplayName="user15190" LastEditDate="2015-03-26T06:59:51.347" LastActivityDate="2018-07-13T10:45:15.417" Title="What's the best technique to determine if the contents of two images are the same?" Tags="|image-processing|edge-detection|color|canny-edge-detector|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22337" PostTypeId="1" AcceptedAnswerId="22338" CreationDate="2015-03-26T01:23:30.840" Score="4" ViewCount="436" Body="&lt;p&gt;Suppose I would like to stream data from a device in a single second. What would be the theoretical upperbound of the amount of information (in bits, bytes, pixels...) that could be sent during this period?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What determines this upper bound?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastEditorUserId="1606" LastEditDate="2015-03-26T08:53:28.070" LastActivityDate="2015-03-26T08:53:28.070" Title="What is the theoretical upperbound of information that could be transmitted by a device per second?" Tags="|discrete-signals|digital-communications|signal-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22338" PostTypeId="2" ParentId="22337" CreationDate="2015-03-26T01:55:25.997" Score="6" Body="&lt;p&gt;There are many factors involved in understanding the theoretical limits to communication. What follows is just a brief introduction that only scratches the surface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, let's consider a simple scenario: there is no noise and no distortion of the signal being transmitted. We do allow for attenuation. Under these circumstances, you can transmit up to $R_p=2B$ &lt;em&gt;pulses&lt;/em&gt; per second. $B$ is the bandwidth you have available. For example: if you have 10 kHz of bandwidth, you may transmit up to 20,000 pulses in one second. $R_p$ is called the Nyquist rate, after Harry Nyquist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, your question is about bits, not pulses. It turns out that you can transmit bits using pulses. Let's say you want to transmit the bit sequence $1001$. You could do this by transmitting pulses with amplitudes $+1, -1, -1, +1$. (The pulse shape does not matter, but they do need to &quot;fit&quot; in the bandwidth you have available.) If you do this, your bit rate $R_b$ is equal to your pulse rate, $R_b=R_p$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can transmit more than one bit per pulse, though. Consider allowing the pulses to have four amplitudes $+3,+1,-1,-3$. Then you could transmit the sequence $1001$ with only two pulses, of amplitudes, say, $+1,-3$. You're free to map bits to pulse amplitudes in any way you want. In this scenario, you have $R_b=2R_p$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in theory, if there is no noise, then the pulse rate is limited to twice your bandwith, but the bit rate can be as large as you want, by allowing the pulses to take more and more different amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a more realistic scenario, where noise is present. Now, the received signal is not just what you transmitted, but it includes noise too. Assume that you're transmitting with power equal to $S$ watts, and that the noise over your bandwidth $B$ has power $N$ watts. Now your bit rate is no longer as large as you want; it cannot be larger than&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C=B\log_2(1+S/N).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C$ is known as Shannon's channel capacity, after Claude Shannon. However, keep in mind that transmitting at, or near, capacity may involve a very complex coding system. In practice, a simple system will operate well below the channel capacity. Even very complex systems may not achieve the capacity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens if you only have a simple system, and you attempt to communicate at a significant fraction of the capacity? In that case, you're likely to have errors in your communication. An error happens when the receiver mistakes a bit 1 for a bit 0 or vice versa. Depending on your application, a certain amount of errors can be tolerated. For example, in voice communications one error out of 1000 bits (a bit error rate (BER) of 0.001) is acceptable. Other systems are intolerant to errors: for example, you don't want your hard drive to corrupt your files, not even once a year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more complex situations the capacity may be much smaller and the systems that achieve high bit rates become much more complex. For example, in wireless communications the transmitted signal suffers not only from noise, but also from echos and Doppler shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, as you see, there is no simple answer. Let me know if you need clarification, or more details.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-26T01:55:25.997" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22339" PostTypeId="2" ParentId="22316" CreationDate="2015-03-26T07:10:10.757" Score="3" Body="&lt;p&gt;I figured it out. It turned out that I don't really need that 'Phase Accumulator', and I should reverse the control signal in the NCO. So, I use &lt;code&gt;-PhErr(i-1)&lt;/code&gt; as a control signal to NCO. Here is the modified code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Siraj Muhammad&#xA;% 25/3/2015&#xA;% BPSK Demodulator&#xA;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&#xA;&#xA;load RRC.mat&#xA;&#xA;fc = 0.05000001;&#xA;phase_offset = pi/7;&#xA;&#xA;N = length(rf_signal);&#xA;bb = zeros(1, N);&#xA;bb_f = zeros(1, N);&#xA;I_f = zeros(1, N);&#xA;Q_f = zeros(1, N);&#xA;I_r = zeros(1, N);&#xA;Q_r = zeros(1, N);&#xA;error = zeros(1, N);&#xA;PhErr = zeros(1, N);&#xA;error_integral = zeros(1, N);&#xA;&#xA;% Loop Filter Coefficients&#xA;BW = 100;  % Hz&#xA;loop_theta = 2*pi*BW;&#xA;C1 = 4*(loop_theta)^2/(1+sqrt(2)*loop_theta+loop_theta^2);&#xA;C2 = 2*sqrt(2)*loop_theta/(1+sqrt(2)*loop_theta+loop_theta^2);&#xA;&#xA;for i = 2:N&#xA;    % Downconverting to Baseband&#xA;    bb(i) = rf_signal(i).*exp(j*2*pi*fc*i+j*phase_offset).*exp(-j*PhErr(i-1));&#xA;&#xA;    % Filtering&#xA;    bb_f = filter(RRC, bb(1:i));&#xA;    I_f(i) = real(bb_f(i));&#xA;    Q_f(i) = imag(bb_f(i));&#xA;&#xA;    % Error&#xA;    error(i) = I_f(i).*Q_f(i);&#xA;&#xA;    % Loop Filter&#xA;    error_integral(i) = error(i).*C1 + error_integral(i-1);&#xA;    PhErr(i) = error(i).*C2 + error_integral(i);&#xA;end&#xA;&#xA;figure; subplot 321; plot(real(bb)); title('I Channel')&#xA;subplot 322; plot(imag(bb)); title('Q Channel')&#xA;subplot 323; plot(I_f); title('I Channel Filter')&#xA;subplot 324; plot(Q_f); title('Q Channel Filter')&#xA;&#xA;subplot 325; plot(error); title('Phase Error');&#xA;subplot 326; plot(PhErr); title('Loop Filter');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I added a variable &lt;code&gt;phase_offset&lt;/code&gt; to test the loop with different offsets, and I can drift the frequency a little bit and the loop will lock very nicely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps somebody as I couldn't find any MATLAB code for Costas Loop online.&lt;/p&gt;&#xA;" OwnerUserId="15183" LastActivityDate="2015-03-26T07:10:10.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22340" PostTypeId="2" ParentId="22328" CreationDate="2015-03-26T07:14:08.313" Score="0" Body="&lt;p&gt;Brightness (Y) component is sampled at a twice rate compared to the color components in YCbYCr coding. Such coding makes use of a fact that human eye is more sensitive to brightness than to color and thus helps to limit bitrate while maintaining acceptable visual quality. Decimated color component samples are reconstructed by interpolation. Alternatively, YCbCr honestly transmits color components for each pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That can be compared to a well-known Bayer mask that samples G component twice as fast compared to R and B because human eye is more sensitive to it.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-03-26T07:14:08.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22342" PostTypeId="2" ParentId="22336" CreationDate="2015-03-26T08:58:54.190" Score="0" Body="&lt;p&gt;A simpler approach (at least to start with) would be to evaluate the absolute difference between the two images and specifically, its mean value or maybe even just the sum of it (across all pixels), and then take its histogram across your sample of pairs of images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The histogram will follow a bimodal (or multimodal) distribution with two main modes: The lower mode corresponding to the pairs of images with slight differences and the higher mode (higher values of difference, therefore more error) to pairs of images with drastic differences. You can then use this information obtained from the histogram to work out a threshold. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Multimodal_distribution&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Multimodal_distribution&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few details:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You don't have to work on the colour images for this, you can simply&#xA;convert them to greyscale. The way you do this will depend on the&#xA;tools you are using.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The difference image that you depict in your post seems to be a&#xA;bitmap, the absolute difference between two grayscale images would&#xA;also &quot;look like&quot; a grayscale image, please see:&#xA;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/pixsub.htm&quot; rel=&quot;nofollow&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/pixsub.htm&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope this helps, happy to amend the response if its not exactly you are looking for, I was a bit surprised to see you going for edge detection straight from the beginning so maybe I have not understood exactly the definition of &quot;frame difference&quot; you might be thinking about.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-26T08:58:54.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22345" PostTypeId="1" AcceptedAnswerId="22347" CreationDate="2015-03-26T12:27:06.423" Score="0" ViewCount="94" Body="&lt;p&gt;Say I am using matlab's random number generator to get an array of random numbers, which I will then, for testing purposes, find the spectral density etc. For that purpose I need to know the sampling freq., but these have been generated synthetically so I am not sure how the sampling theorem applies here.&lt;/p&gt;&#xA;" OwnerUserId="8825" LastActivityDate="2015-03-26T14:05:19.677" Title="What's the sampling frequency when synthetically generating data?" Tags="|matlab|sampling|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22346" PostTypeId="2" ParentId="22345" CreationDate="2015-03-26T12:33:47.197" Score="1" Body="&lt;p&gt;The sampling rate is arbitrary- you choose it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually people are simulating a real situation, like, for example, audio from a CD.  Then you would choose the sample rate to be 44.1 kHz.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-03-26T12:33:47.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22347" PostTypeId="2" ParentId="22345" CreationDate="2015-03-26T12:35:31.800" Score="0" Body="&lt;p&gt;You do not need to know the sampling frequency in order to determine the power spectral density (PSD). The frequency variable of the PSD of a sequence is normalized by the sampling frequency. You only need the sampling frequency if you want to denormalize that relative frequency and talk about absolute frequencies in Hertz. In this case, since no sampling was involved, you're free to choose any sampling rate that you like.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-26T12:35:31.800" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22348" PostTypeId="1" AcceptedAnswerId="22354" CreationDate="2015-03-26T12:37:28.283" Score="0" ViewCount="924" Body="&lt;p&gt;My input is &lt;code&gt;x&lt;/code&gt; and my filtered output is &lt;code&gt;y&lt;/code&gt;. The sampling rate of &lt;code&gt;x&lt;/code&gt; is &lt;code&gt;Fs&lt;/code&gt;. I create a low-pass Butterworth filter in MATLAB as follows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a]=butter(order,cutoff*(2/Fs));&#xA;y = filter(b,a,x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Letting &lt;code&gt;order&lt;/code&gt; vary (&lt;code&gt;cutoff&lt;/code&gt; fixed at 20Hz) yields these outputs &lt;code&gt;y&lt;/code&gt;.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9G7zq.jpg&quot; alt=&quot;varying order&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Letting &lt;code&gt;cutoff&lt;/code&gt; vary (&lt;code&gt;order&lt;/code&gt; fixed at 6) yields these outputs &lt;code&gt;y&lt;/code&gt;.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kNMrO.jpg&quot; alt=&quot;varying cutoff frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few very rookie questions about this sort of filter.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why does the filter constrain &lt;code&gt;y&lt;/code&gt; to equal zero at the first sample?&lt;/li&gt;&#xA;&lt;li&gt;Why is there an initial ripple in &lt;code&gt;y&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;li&gt;Why does the time-delay of &lt;code&gt;y&lt;/code&gt; increase with &lt;code&gt;order&lt;/code&gt; and &lt;code&gt;cutoff&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;li&gt;The time step between successive samples of &lt;code&gt;x&lt;/code&gt; is &lt;code&gt;1/Fs&lt;/code&gt;. Is the time-step between successive samples of &lt;code&gt;y&lt;/code&gt; also &lt;code&gt;1/Fs&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;FYI, my goal in filtering &lt;code&gt;x&lt;/code&gt; is to remove high frequency noise above 20 Hz or so.&lt;/p&gt;&#xA;" OwnerUserId="7198" LastEditorUserId="7198" LastEditDate="2015-03-26T14:24:19.660" LastActivityDate="2015-03-26T14:34:14.493" Title="Understanding my Butterworth filter" Tags="|filters|lowpass-filter|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22349" PostTypeId="1" CreationDate="2015-03-26T12:49:41.937" Score="4" ViewCount="4455" Body="&lt;p&gt;I am a total newbe to signal processing and i have a problem which may be  quite trivial to most of you guys.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to align two short sensor signals (speaking of max. 1000 samples recorded with 20Hz). The signals are sampled with the exact same sample rate and are not necessarily periodic. I use octave to make first experiments and i recognized some confusing behaviour of the xcorr() function in the 'signal' package.&#xA;If i correlate two short signals the resulting lag value is not really correct. The longer one of the signals is, the better the lag value calculated by the xcorr() function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what i tested:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pkg load signal&#xA;&#xA;clear all&#xA;&#xA;%generate two short signals&#xA;x = -pi:0.05:pi;&#xA;&#xA;sigA = sin(x);&#xA;sigB = cos(x);&#xA;&#xA;%plot the original signals&#xA;figure 1&#xA;subplot(2,1,1);&#xA;plot((0:length(sigA)-1), sigA, 'r');&#xA;title(&quot;sin(x)&quot;);&#xA;xlabel(&quot;Sample index&quot;);&#xA;grid on;&#xA;subplot(2,1,2);&#xA;plot((0:length(sigB)-1), sigB, 'b');&#xA;title(&quot;cos(x)&quot;);&#xA;xlabel(&quot;Sample index&quot;);&#xA;grid on;&#xA;&#xA;%calculate the cross correlation between signal B and signal A&#xA;[c, lag] = xcorr(sigB, sigA);&#xA;[~,i] = max(abs(c));&#xA;shift = lag(i) %the shifting offset between the two signals&#xA;&#xA;%align the signals&#xA;sigA = sigA(abs(shift)+1:end);&#xA;&#xA;maxLength = max(length(sigA), length(sigB)); %for sample index axis range&#xA;&#xA;%plot the aligned signals&#xA;figure 2&#xA;subplot(2,1,1);&#xA;plot((0:length(sigA)-1), sigA, 'r');&#xA;title(&quot;sin(x) aligned&quot;);&#xA;xlabel(&quot;Sample index&quot;);&#xA;axis([0, maxLength, -1, 1]);&#xA;grid on;&#xA;subplot(2,1,2);&#xA;plot((0:length(sigB)-1), sigB, 'b');&#xA;title(&quot;cos(x) aligned&quot;);&#xA;xlabel(&quot;Sample index&quot;);&#xA;axis([0, maxLength, -1, 1]);&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code produces the following figures and calculates a shift of -27 samples:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/pzP9u.png&quot; alt=&quot;figure 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kfg12.png&quot; alt=&quot;cross correlation between sigA and sigB&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/kiB85.png&quot; alt=&quot;figure 2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can clearly see, the signal A (sin(x)) is not perfectly aligned!&#xA;I would have to change the alignment call to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%align the signals&#xA;sigA = sigA(abs(shift)+6:end); %where does this offset (1+5) come from?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to align them perfectly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/krEWT.png&quot; alt=&quot;figure 2 - With fake offset 5&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if i generate a longer signal for sigA, this offset disappears completely:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = -100:0.1:100;&#xA;y = -pi:0.05:pi;&#xA;&#xA;sigA = sin(x);&#xA;sigB = cos(y);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the situation looks like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/w2Hju.png&quot; alt=&quot;figure 1 - sigA long&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8wTyO.png&quot; alt=&quot;cross correlation between sigA long and sigB&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bCwl6.png&quot; alt=&quot;figure 2 - sigA long aligned&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in the image above, the two signals are perfectly aligned without shifting signal A manually as i had to with the shorter version of signal A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is an actual signal from my sensor (where signal A is a stored signal and signal B is a subset of signal A, the x axis shows the time in ms):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/F4Ou7.png&quot; alt=&quot;Signal A is a real signal from my sensor, signal B is a subset of signal A&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VaKc4.png&quot; alt=&quot;Wrongly aligned signals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same Problem appears here. I would have to shift signal A by 29 samples to the right to align them perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is that? Is cross correlation not the right thing to do for short or non periodic finite signals? Or is there a way to calculate the additional offset to the signal  shift?&lt;/p&gt;&#xA;" OwnerUserId="15194" LastEditorUserId="15194" LastEditDate="2015-04-20T07:46:26.277" LastActivityDate="2015-04-22T07:16:39.717" Title="Cross correlation with short or non periodic signals?" Tags="|cross-correlation|delay|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22350" PostTypeId="2" ParentId="22345" CreationDate="2015-03-26T14:05:19.677" Score="0" Body="&lt;p&gt;@student1, it seems to me that there is an option of MATLAB's &lt;code&gt;pwelch&lt;/code&gt; function that uses normalized frequency: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[pxx,w] = pwelch(x,window,noverlap,w)&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i think that &lt;code&gt;w&lt;/code&gt; means &quot;$\omega$&quot; and is normalized angular frequency (i.e. $\omega = \pi$ is Nyquist).  if you use &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[pxx,f] = pwelch(x,window,noverlap,f, fs)&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the specified frequencies are not angular frequencies and are relative the the sampling frequency &lt;code&gt;fs&lt;/code&gt;.  i have never used &lt;code&gt;pwelch&lt;/code&gt;, but that is what it appears to be at &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/pwelch.html&quot; rel=&quot;nofollow&quot;&gt;the mathworks website&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-26T14:05:19.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22351" PostTypeId="1" CreationDate="2015-03-26T14:25:12.467" Score="-4" ViewCount="95" Body="&lt;p&gt;Is this possible to work with PYTHON or C in MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="15198" LastEditorUserId="15198" LastEditDate="2015-03-28T17:45:37.097" LastActivityDate="2015-03-28T17:45:37.097" Title="What programming language is going to use MATLAB programming?" Tags="|matlab|python|" AnswerCount="1" CommentCount="1" ClosedDate="2015-03-26T16:13:30.973" ContentLicense="CC BY-SA 3.0" />
  <row Id="22352" PostTypeId="2" ParentId="20159" CreationDate="2015-03-26T14:26:41.107" Score="1" Body="&lt;p&gt;The main issue here is the directional lighting which illuminates mainly one side of the characters, so that a part of them disappears in the background. If you rotate the part, the appearance of the letters will change; this is bad for recognition. You may also face fragmentation of the characters (K for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't like this adaptive thresholding at all, as it reveals a lot of the texture and could very well cause the characters to touch surrounding blobs and be impossible to segment out. You should increase the adaptiveness scale or use global thresholding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If possible, improve illumination using a diffuse source and let the background disappear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No preprocessing step will restore what adverse illumination has lost.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-03-26T14:26:41.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22353" PostTypeId="2" ParentId="22351" CreationDate="2015-03-26T14:31:50.560" Score="2" Body="&lt;p&gt;Matlab is its own programming language/environment. It has the ability to use other languages through &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/mex.html&quot; rel=&quot;nofollow&quot;&gt;MEX&lt;/a&gt; or can be called through other languages through the &lt;a href=&quot;http://www.mathworks.com/help/matlab/programming-interfaces-for-c-c-fortran-com.html&quot; rel=&quot;nofollow&quot;&gt;Matlab API&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of people are moving to using scipy/numpy in Python from Matlab, since Python is free whereas Matlab costs lots of money. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-03-26T14:31:50.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22354" PostTypeId="2" ParentId="22348" CreationDate="2015-03-26T14:34:14.493" Score="0" Body="&lt;p&gt;The filter doesn't constrain the first sample to be zero. The first sample just has a relatively small value, because it takes the filter some time to react to the input signal. This is because initially the delay elements of the filter contain zeros (i.e. the initial state is zero). This means that for the filter it looks like there has been a long input signal consisting only of zeros, and suddenly the input jumps to a value of around $-20$. This is also why you see the ripples in the output signal. What you see is basically the (negative) step response of the filter. And any frequency selective filter with a decent (frequency domain) performance will have some overshoot in its step response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the function &lt;code&gt;filter()&lt;/code&gt; accepts an initial state as an input argument. So you could compute the filter state for a constant input signal (say about 100 samples or more) equal to the first value of the actual input signal. The &lt;code&gt;filter&lt;/code&gt; function will give you the final state after having processed that constant input signal, which you can use as initial state for filtering the actual data. This will greatly reduce any transients in the filter output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;[dum,s] = filter(b,a,x(1)*ones(100,1));    % get initial state&#xA;y = filter(b,a,x,s);                       % filter with initial state s&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The group delay of the filter is frequency dependent, so it's hard to make general statements about the delay of a specific input signal. What is true is that the average group delay increases with increasing filter order.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-26T14:34:14.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22355" PostTypeId="1" AcceptedAnswerId="22357" CreationDate="2015-03-26T14:38:09.093" Score="10" ViewCount="4994" Body="&lt;p&gt;I have an image taken by a mobile phone camera with focus on a part of it let say a face or whatever.&#xA;I want to know -approximately-  where is the focused area. For example, a bounding box around the focused area.&#xA;example :&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kLq9w.jpg&quot; alt=&quot;Original&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ezLld.png&quot; alt=&quot;After Detection&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15118" LastActivityDate="2016-03-07T19:57:46.823" Title="Isolate the non blurred part of foucsed image" Tags="|image-processing|opencv|blur|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22356" PostTypeId="2" ParentId="22349" CreationDate="2015-03-26T15:40:13.170" Score="2" Body="&lt;p&gt;Given two signals with the same finite duration and number of samples $N$, we can calculate the &lt;em&gt;periodic&lt;/em&gt;  or cyclic crosscorrelation function which has $N$ values, or the &lt;em&gt;aperiodic&lt;/em&gt; crosscorrelation function which has $2N-1$ values. For signals with $N$ and $M$ samples respectively ($N &amp;gt; M$), the aperiodic crosscorrelation function has $N+M-1$ values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the two signals are the same except that one is a cyclic shift of the other, the periodic crosscorrelation function has a maximum at perfect alignment. However, the maximum of the &lt;em&gt;aperiodic&lt;/em&gt; crosscorrelation function is not necessarily at perfect alignment because the part that is &quot;sticking out&quot; and not overlapping with the other signal is missing, which lowers the peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When one signal is a &lt;em&gt;truncated&lt;/em&gt; version of the other, and the longer signal is periodic, then the aperiodic crosscorrelation function will have &lt;em&gt;multiple&lt;/em&gt; maxima all of the same height. Look at the array that&#xA;&lt;code&gt;xcorr&lt;/code&gt; gives you as th eoutput, and check how the &lt;code&gt;max&lt;/code&gt; function works in MATLAB when there are multiple maxima. Does &lt;code&gt;max&lt;/code&gt; report the leftmost&#xA;maximum if there are multiple maxima of the same height?  (I am not a&#xA;MATLABi and cannot help you on this last point).&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-03-26T15:55:59.670" LastActivityDate="2015-03-26T15:55:59.670" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22357" PostTypeId="2" ParentId="22355" CreationDate="2015-03-26T15:56:28.960" Score="7" Body="&lt;p&gt;In general, this is an image segmentation problem (&lt;a href=&quot;http://en.wikipedia.org/wiki/Image_segmentation&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Image_segmentation&lt;/a&gt;) into which you would be trying to isolate the focused to the non-focused regions of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Optical lenses are equivalent to low pass filters anyway and the effect of a low pass filter on a signal is to smooth it out by limiting the higher frequency content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In digital image processing, low frequencies correspond to big objects (general form) and higher frequencies correspond to small objects (details).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, to isolate the focused region, you could be looking for areas that are at a higher standard deviation relative to the blurred areas which would be at a lower standard deviation because of the smoothing operation of the out-of-focus lens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To distinguish 'blurred' vs 'non-blurred' regions  you can setup a &quot;window&quot; of dimensions $M \times N$ and slide it over your image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At each position of the window compute the variance of the &quot;patch&quot; values as if they were a one-dimensional vector of $M \times N$ values. This will result in another &quot;image&quot; (or more generally a two-dimensional array) depicting the variation of the standard deviation at each location on your image. You can then collect all of these values and obtain their histogram. The histogram will exhibit a multimodal distribution (For more information please see &lt;a href=&quot;http://en.wikipedia.org/wiki/Multimodal_distribution&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Multimodal_distribution&lt;/a&gt; ). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the image in your post, the histogram is likely to exhibit two modes. One corresponding to relatively high values of standard deviation (focused area) and one corresponding to relatively low values of standard deviation (blurred areas).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then position a threshold, for example just between the two modes to establish a criterion between your focused and unfocused regions and then select all &quot;patches&quot; (or MxN window areas) whose standard deviation is higher than your threshold. (For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Thresholding_%28image_processing%29&quot; rel=&quot;noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Thresholding_%28image_processing%29&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will isolate the focused parts of the image for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2016-03-07T10:56:45.680" LastActivityDate="2016-03-07T10:56:45.680" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22359" PostTypeId="2" ParentId="2347" CreationDate="2015-03-26T16:43:58.500" Score="4" Body="&lt;p&gt;Jav_Rock got the point. Actually if you write $\bf{K_k}$ like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\ \bf{K_k} = \bf{P_k^-\, H_k^{\rm T} (H_k P_k^-\, H_k^{\rm T} + R_k)^{-1}}&#xA;  = \bf{H_k^-\frac {H_kP_k^-\, H_k^{\rm T}}{H_k P_k^-\, H_k^{\rm T} + R_k}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the numerator of the fraction stands for the uncertainty propagated from the model while $\bf{R_k}$ stands for the uncertainty from the measurement. So the value of the fraction stands for how much we should trust the measurement, as explained by Jav_Rock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the $\bf{H_k^-}$, it just transform the observation back to the state, because it is the state that we want to update, not the observation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To wrap up, the gain $\bf{K_k}$ computes how much correction we should take from observation and transform the correction of observation back to the correction of state, which leads to the update of state estimate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \quad\&#xA;  \bf{\hat x_k} = \bf{x_k^-} + \bf{K_k}(\bf{\tilde y_k}-\bf{H_k}\bf{x_k^-})$&lt;/p&gt;&#xA;" OwnerUserId="15186" LastActivityDate="2015-03-26T16:43:58.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22361" PostTypeId="2" ParentId="22314" CreationDate="2015-03-26T19:56:52.870" Score="2" Body="&lt;p&gt;any low-pass filter with DC gain of 1 ( $H(1)=1$ ) is a candidate for DC extraction filter.   this kind of &lt;em&gt;&quot;get DC&quot;&lt;/em&gt; filter problem is pretty much equivalent and complementary to the &lt;em&gt;&quot;DC blocking filter&quot;&lt;/em&gt; problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i don't see why you wouldn't use a far lower order IIR filter for your LPF.  you can get sharp without 768 taps (and, presumably 768 multiply-accumulate instructions) using an IIR filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;excluding (for the moment) the cost of the filter, the tradeoff is between a solid DC output and responsiveness when the DC value has actually changed.  how quickly do you need your DC filter to adapt when the actual DC in the input has changed?&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-26T19:56:52.870" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22362" PostTypeId="2" ParentId="22336" CreationDate="2015-03-26T20:57:58.633" Score="0" Body="&lt;p&gt;Maybe you can try to calculate Minkowski distance between two images. &#xA;I found that metrics useful when automatically calculate noise removal filter effectiveness.&lt;/p&gt;&#xA;" OwnerUserId="11038" LastActivityDate="2015-03-26T20:57:58.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22363" PostTypeId="1" CreationDate="2015-03-26T21:30:05.777" Score="1" ViewCount="749" Body="&lt;p&gt;I'm getting some odd results with some code I'm working on. Help me with the implementation of this delay effect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code takes an input, adds delayed input to it and then passes it to the output whilst also copying it back to the delay line. Control of the delay level and feedback are provided to control respectively the amount of delayed signal added to the output and returning to the delay line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the process of my delay effect. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void delay::processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames)&#xA;{&#xA;        float *in = inputs[0];&#xA;        float *out = outputs[0];&#xA;        float delayed_sample;&#xA;        int delayed_sample_index;&#xA;        for (int frame_idx=0;frame_idx&amp;lt; sampleFrames;frame_idx++)&#xA;        {&#xA;                delayed_sample_index = (((int)(cBuf.index-delay_samples) + CIRCULAR_BUFFER_LENGTH) % (int)CIRCULAR_BUFFER_LENGTH);&#xA;                delayed_sample = (cBuf.buffer)[delayed_sample_index];&#xA;                //write current sample to buffer&#xA;                (cBuf.buffer)[cBuf.index] = in[frame_idx] + (delayed_sample*feedback);&#xA;                //Calculate + write output sample&#xA;                out[frame_idx] = in[frame_idx] + (delay_level*delayed_sample);&#xA;                //Increment buffer index&#xA;                cBuf.index = ((cBuf.index+1)) % CIRCULAR_BUFFER_LENGTH;&#xA;        }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On the whole it works pretty well and functions as a delay effect should. However, the output I'm getting is slightly distorted. I'm not sure if this is an error in the arithmetic of sample times and values or something else. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rmGiL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5105" LastEditorUserId="5105" LastEditDate="2015-03-27T10:07:03.547" LastActivityDate="2015-03-29T18:49:10.963" Title="Distorted output of delay VST effect in C" Tags="|audio|delay|c++|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22364" PostTypeId="1" AcceptedAnswerId="22377" CreationDate="2015-03-26T22:53:48.610" Score="0" ViewCount="743" Body="&lt;p&gt;I'm working on experiments with 2D - wrinkled surfaces.&#xA;Basically I am getting a bunch of images like this.&#xA;This example is hand-made. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: The test image was made by sampling a cosine function something like&#xA;$4*\cos{2\pi(3x+4y)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nXLA2.png&quot; alt=&quot;bi_axial&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a method to find the amplitudes of the first few dominant sinusoids in the image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen for simple 1-D examples how to get to the amplitudes. It seems to require that the coefficients of the expansion cancel out just right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a sample image from experiment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ge4HU.jpg&quot; alt=&quot;sample&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15201" LastEditorUserId="15201" LastEditDate="2015-04-09T22:05:17.937" LastActivityDate="2015-04-09T22:05:17.937" Title="Finding amplitudes from FFT data of a 2D image" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22365" PostTypeId="1" AcceptedAnswerId="22375" CreationDate="2015-03-26T23:40:22.343" Score="0" ViewCount="191" Body="&lt;p&gt;What is the sound of a solution $y(x,t)$ to the Wave Equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{\partial^2y}{\partial t^2}=c^2\,\frac{\partial^2y}{\partial x^2}\enspace$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To be clear, I don't look for a solution of the Wave Equation, I have a concrete solution $y(x,t)$. I only want to describe the sound of this concrete solution.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case I want to describe the sound of a vibrating string, so the ends of the string are fixed, i.e. $y(0,0)=y(L,0)=0$ where $L$ is the length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a solution $y(x,t)$, I get perfectly the shape of the string between $x=0$ and $x=L$ for every time $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can show that $y(x,t)$ must be also $2L$-periodic according to $x$, i.e. $y(\lambda+2L,t)=y(\lambda,t)$, and $(2L/c)$-periodic according to $t$, i.e. $y(x,\lambda+2L/c)=y(x,\lambda)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To describe the sound, I would like to&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;find a frequency spectrum (or magnitude/amplitude spectrum) or&lt;/li&gt;&#xA;&lt;li&gt;produce a sound file with a series of samples $x(i)$ to hear the vibrating string.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For 1. I don't know how to do that. Should I develop the Fourier-Series according to $x$ or to $t$ (a Fourier-Series exists, because I've showed the periodicity) or do complety other things? For a Fourier-Series according to $x$, the Fourier-Coefficients $a_k,b_k$ depends on $t$ and for a Fourier-Series according to $t$, the Fourier-Coefficients depends on $x$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example for a string that get plucked at $x_p$ with a displacement of $h$. Its shape is a triangle as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_0(x)=&#xA;\begin{cases}&#xA;x(h/x_p)&amp;amp;\text{if}\enspace 0\leq x &amp;lt; x_p\\[1ex]&#xA;h\left(1-\frac{x-x_p}{L-x_p}\right)&amp;amp;\text{if}\enspace x_p \leq x \leq L&#xA;\end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The initial velocity is 0 so finally the string is described as:&#xA;$y(x,t)=y(x,t)=\frac{1}{2}\left(y_0(x+ct)+y_0(x-ct)\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following picture, you can see the process of the string starting at $t=0$&#xA;&lt;img src=&quot;https://i.stack.imgur.com/b2ynJ.png&quot; alt=&quot;Process of a Plucked String&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="7953" LastEditorUserId="7953" LastEditDate="2015-03-27T11:12:51.563" LastActivityDate="2015-03-27T11:43:02.423" Title="What is the Sound of a Solution to the Wave Equation?" Tags="|frequency-spectrum|sound|wave|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22366" PostTypeId="2" ParentId="22363" CreationDate="2015-03-27T00:05:47.497" Score="0" Body="&lt;p&gt;so i dunno how the &lt;code&gt;%&lt;/code&gt; operator will do with negative values and i am not sure that &lt;code&gt;cBuf.index-delay_samples + CIRCULAR_BUFFER_LENGTH&lt;/code&gt; is always positive.  why are you adding &lt;code&gt;CIRCULAR_BUFFER_LENGTH&lt;/code&gt; to &lt;code&gt;delayed_sample_index&lt;/code&gt; anyway?  to insure that the &lt;code&gt;%&lt;/code&gt; applies to a non-negative value?  i &lt;strong&gt;guess&lt;/strong&gt; that might work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;check to see if the following works, but make absolutely sure that &lt;code&gt;CIRCULAR_BUFFER_LENGTH&lt;/code&gt; is a power of 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;also make sure that $-1&amp;lt;$ &lt;code&gt;feedback&lt;/code&gt; $&amp;lt;+1$ .&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int n=0; n&amp;lt;sampleFrames; n++)&#xA;    {&#xA;    delayed_sample_index = cBuf.index - delay_samples;&#xA;    delayed_sample = (cBuf.buffer)[delayed_sample_index &amp;amp; (CIRCULAR_BUFFER_LENGTH-1)];&#xA;    //write current sample to buffer&#xA;    (cBuf.buffer)[cBuf.index] = in[n] + (delayed_sample*feedback);&#xA;    //Calculate + write output sample&#xA;    out[n] = in[n] + (delay_level*delayed_sample);&#xA;    //Increment buffer index&#xA;    cBuf.index = (cBuf.index + 1) &amp;amp; (CIRCULAR_BUFFER_LENGTH-1);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-27T00:05:47.497" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22367" PostTypeId="1" CreationDate="2015-03-27T02:00:18.823" Score="0" ViewCount="443" Body="&lt;p&gt;I am going through a technique for audio denoising by block thresholding. Here is the paper: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.di.ens.fr/~mallat/papiers/AudioBlock.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.di.ens.fr/~mallat/papiers/AudioBlock.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the definition in the paper for diagonal estimators,&#xA;Simple time-frequency denoising algorithms compute each attenuation factor only from the corresponding noisy coefficient and are thus called diagonal estimators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and for non diagonal estimators:&#xA;To reduce musical noise as well as the estimation risk, several authors have proposed to estimate the a priori SNR with a time-frequency regularization of the a posteriori SNR . The resulting attenuation factors thus depend upon the data values for in a whole neighborhood of (l,k).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not quite able to comprehend these definitions, and the difference.&#xA;The paper also claims that non-diagonal processing is better than diagonal processing techniques.  Could someone explain the difference in a layman's terms?&lt;/p&gt;&#xA;" OwnerUserId="11459" LastActivityDate="2016-04-20T17:11:17.667" Title="Diagonal vs non diagonal processing for audio denoising" Tags="|audio|noise|thresholding|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22368" PostTypeId="2" ParentId="22367" CreationDate="2015-03-27T04:20:49.380" Score="0" Body="&lt;p&gt;just a cursory look at the paper seems to confirm it's a wavelet transform thingie: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A time-frequency transform decomposes the audio signal over a family of time-frequency atoms $\{ g_{l,k} \}_{l,k}$  where $l$ and $k$ are the time and frequency (or scale) localization indices.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;so i think your threshold is about throwing out (or attenuating) particular atoms that have energy below some noise-level threshold.  anyway that thresholding thing can be sorta gradual, you're not multiplying by a step function of the energy of each of the atoms.  it can be smoother than that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the time-frequency array (or map) of the atoms, i dunno what significance any diagonal is, with respect to denoising.  each diagonal will sorta correspond to a linearly-swept frequency &quot;chirp&quot; signal.  i dunno why one would be discriminating w.r.t. them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can make your threshold for gating somewhat proportional to the level, localized both in time and frequency (to different degrees, if you want), in that time-frequency map.  i.e. blur or average the levels close to whatever point in both time and frequency.  use that low-pass-filtered level to determine the threshold, and (smoothly) gate the atoms off that fall below that locally determined threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i dunno.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="80" LastEditDate="2016-04-20T13:29:24.980" LastActivityDate="2016-04-20T13:29:24.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22369" PostTypeId="2" ParentId="22314" CreationDate="2015-03-27T04:48:41.220" Score="3" Body="&lt;p&gt;so, what's wrong with a simple 1st-order, 1-pole, IIR filter, where you're a little careful with the coefficient that soooo close to 1?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = (1-p) x[n] + p y[n-1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ p = \cos(\omega_0) = \cos\left(\pi \frac{0.1}{54000} \right) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but express the whole thing in terms of $1-p$ instead of $p$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;y[n] &amp;amp; = (1-p) x[n] + p y[n-1] \\&#xA;     &amp;amp; = y[n-1] + (1-p) \left( x[n] - y[n-1] \right) \\&#xA;     &amp;amp; = y[n-1] + 2\sin^2\left( \frac{\omega_0}{2} \right) (x[n] - y[n-1]) \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ \omega_0 \ll 1 $ or $\pi$ or whatever in the same neighborhood.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-27T04:48:41.220" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22370" PostTypeId="1" AcceptedAnswerId="22371" CreationDate="2015-03-27T08:11:08.767" Score="0" ViewCount="5109" Body="&lt;p&gt;So I think I've confused myself a bit here. I know that taking the FFT of time-series data (wind velocities, for example) yields a power spectral density. However, I just read that taking the Fourier Transform of an autocorrelation function also yields the power spectral density. So, if one were to take the inverse Fourier Transform of power spectral density, would you get the original time series data (with the mean subtracted out) or would you get the autocorrelation function?&lt;/p&gt;&#xA;" OwnerUserId="15204" LastActivityDate="2015-04-27T14:51:42.023" Title="Determining Power Spectral Density from Autocorrelation Function and Time-Series Data" Tags="|fft|autocorrelation|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22371" PostTypeId="2" ParentId="22370" CreationDate="2015-03-27T10:19:45.253" Score="2" Body="&lt;p&gt;Taking the FFT of a time-series does &lt;em&gt;not&lt;/em&gt; give you the power spectral density (PSD). What you can do is take the squared magnitude of the FFT to get an estimate of the PSD. And the latter is equivalent to taking the Fourier transform of the (deterministic) autocorrelation function of the data. See also &lt;a href=&quot;https://electronics.stackexchange.com/questions/135380/when-to-use-auto-correlation-and-when-to-use-fourier-transform/135383#135383&quot;&gt;this answer&lt;/a&gt; to a related question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the inverse Fourier transform of the PSD is the autocorrelation function.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2015-04-27T14:51:42.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22372" PostTypeId="1" AcceptedAnswerId="22407" CreationDate="2015-03-27T10:20:30.817" Score="3" ViewCount="484" Body="&lt;p&gt;Using OCR, I want to extract text from product packages using Google Glass. However, because of the fixed focus of the camera the package pictures are blurred. Is there a way to sharpen the image? Currently I use unsharp masking to enlarge the gradients of the edges, which gives me OK results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to do this? I thought about taking a picture of a point-spread-function and using this to deconvolve, but I doubt this gives me a good approximation of the distortion kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FvJ8T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10752" LastEditorUserId="128" LastEditDate="2019-04-02T15:29:15.673" LastActivityDate="2019-04-02T15:29:15.673" Title="Sharpen Defocused Image (Deconvolution / Image Restoration)" Tags="|image-processing|convolution|deconvolution|ocr|inverse-problem|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22374" PostTypeId="2" ParentId="22253" CreationDate="2015-03-27T11:21:51.503" Score="1" Body="&lt;p&gt;&lt;strong&gt;&quot;Does the interpolation of a signal alter the FFT?&quot;&lt;/strong&gt;&#xA;Yes, it does.&#xA;The key point is that in a system that uses sampling, you simply do not know what does the signal &quot;do&quot; between two sampling instances. For a high enough sampling frequency Fs, it is just assumed that the corresponding sampling period is high enough to be approximated by a series of sinc pulses. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using interpolation, you only &lt;strong&gt;assume&lt;/strong&gt; that the signal behaves in a certain way during the time that it is not observed. Therefore, the result of the FFT will be different, even for different interpolation methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, interpolation has a &quot;natural&quot; smoothing action because all it can do is &quot;degrade&quot; the existing data, it cannot &lt;strong&gt;add&lt;/strong&gt; anything more to it. For more information about this notion, please see the Data Processing Theorem (&lt;a href=&quot;https://books.google.co.uk/books?id=F4j8EHBKS1IC&amp;amp;lpg=PA313&amp;amp;ots=tHO2C1ZJs1&amp;amp;dq=the%20data%20processing%20theorem&amp;amp;pg=PA313#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;https://books.google.co.uk/books?id=F4j8EHBKS1IC&amp;amp;lpg=PA313&amp;amp;ots=tHO2C1ZJs1&amp;amp;dq=the%20data%20processing%20theorem&amp;amp;pg=PA313#v=onepage&amp;amp;q&amp;amp;f=false&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why, interpolation will tend to represent lower frequencies (for which you have more data anyway, due to the sampling frequency) better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, 'interp1' by default uses linear interpolation, that is, intermediate values between sampling instances are assumed to lie on a straight line that is defined by the two known points. An alternative to this would be spline interpolation which takes into account the slope by which the interpolated curve should enter and depart from the interpolating area. For more information about this, please see &lt;a href=&quot;http://en.wikipedia.org/wiki/Cubic_Hermite_spline&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Cubic_Hermite_spline&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please also note Trigonometric Interpolation, a technique very closely associated with the Fourier Transform. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Trigonometric_interpolation&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Trigonometric_interpolation&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;From the Time Signal, the FFT on the complet signal is closer to reality. but it still doesn't show all frequencies. Why?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because it is not exactly the same signal, as far as the FT is concerned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A key property of the Discrete Fourier Transform is &quot;Periodicity&quot;. According to this, the signal at the input of the Fourier Transform is assumed...&lt;strong&gt;periodic&lt;/strong&gt;. That is, you may be passing a voice recording of &quot;One Two Three&quot; to the FT to recover its harmonic component but the FT assumes that the signal, in reality sounds like &quot;...One Two Three One Two Three One Two Three One Two Three...&quot; extending to infinity both forwards and backwards. For more information about this please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&lt;/a&gt; (Periodicity property).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal that you call &quot;Time Signal&quot;, contains a brief period of silence in the beginning and ends abruptly, that is, it would be discontinuous if it were to be a periodic signal. By the way, you may also be interested in the technique of windowing, for more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function#Symmetry_and_asymmetry&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Window_function#Symmetry_and_asymmetry&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I almost can't extract any information fro the phase plot. What am I missing?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase spectrum is simply the angle between the imaginary and real components of the signal spectrum. However, having seen how the imaginary and real components of the FT look like, their phase content is not expected to be a smooth and well behaved function, except perhaps for very simplistic cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, you may want to look up the concept of phase unwrapping, to improve your phase plots. For more information, please see &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Phase_Unwrapping.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/fp/Phase_Unwrapping.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-27T11:21:51.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22375" PostTypeId="2" ParentId="22365" CreationDate="2015-03-27T11:43:02.423" Score="0" Body="&lt;p&gt;Since you already have the solution to the wave equation, what you need to do now is define a &quot;pick-up&quot; point somewhere along the length of the string (some $x$) and obtain its trace in time, i.e. look at what that specific $x$ value is &quot;doing&quot; across all the $t$ instances that you have. In other words, draw a straight line down your vibrating string diagram and take the vertical displacement of your string at each time point as the amplitude of your sound signal at that time point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reality, when you hear an electric instrument you hear exactly that, you hear what the vibrating string is doing exactly above the pick-up coil. Furthermore, electric guitars (and other instruments) have more than one pick-up points along the length of a string and a switch that is used to change the way these pick-up points are combined to offer different qualities of sound. For example, the coil closest to the neck (closest to the middle of the distance between the neck and bridge) produces sound with more low frequencies, while the coil closest to the bridge (the fixed point at the lower end of the instrument) produces sound with more high frequencies. The placement of the coils is a very important issue. Imagine for example what would happen if you placed the coil at a nodal point on the string (when it is excited to produce a standing wave).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, in acoustic instruments, the sound that reaches the ear is the projection of the vibrating instrument (notice now we are talking about the whole instrument) towards the direction of the ear or microphone. So, in effect, you are still applying this 'slice of vibrating element in time' concept. By the way, this is why mic placement is important when you record acoustic instruments (see for example: &lt;a href=&quot;http://www.soundonsound.com/sos/1995_articles/sep95/mikinginstruments.html&quot; rel=&quot;nofollow&quot;&gt;http://www.soundonsound.com/sos/1995_articles/sep95/mikinginstruments.html&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-27T11:43:02.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22376" PostTypeId="1" CreationDate="2015-03-27T13:39:10.437" Score="3" ViewCount="602" Body="&lt;p&gt;Does anybody know of a way to shift data by a fraction of a sample by using sinc interpolation? For example, shift an image to the right by 0.1 pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm struggling to find a formula or reference that explains how to generate such a kernel, and I already know how to do it in the frequency domain....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function kernel=subpixelshifter(shift)&#xA;trange=[-1,0,1]-shift;&#xA;kernel=lanczos3(trange);&#xA;end&#xA;function x=lanczos3(x)&#xA;bad= x&amp;gt;3;&#xA;x=sinc(x).*sinc(x/3);&#xA;x(bad)=0;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="941" LastEditorUserId="941" LastEditDate="2015-03-28T07:12:29.830" LastActivityDate="2015-03-28T07:12:29.830" Title="How to subsample shift with sinc interpolation?" Tags="|interpolation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22377" PostTypeId="2" ParentId="22364" CreationDate="2015-03-27T14:01:47.417" Score="0" Body="&lt;p&gt;If you can adjust the orientation of your image so that the sinusoid pattern runs vertically to the image, then you can obtain a vertical slice, perhaps at the middle of the image and use that as a 1D waveform for further analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the waves can come out of your experiment in any orientation you basically have two options:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Estimate the angle of rotation ($a$), apply a rotation by $-a$ and then select a slice of the image (just as in the introduction). To estimate the angle of rotation you can look at the output of the Hough Transform which will give you strong &quot;spots&quot; at a given angle for each line (or line-looking) form within your image. That would be the elongated folds of the wrinkles in your image. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Hough_transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Do a straightforward 2D Fourier Transform to recover both orientation and amplitude spectra (at least for the example you provide). The sinusoidal-like form will appear as a linear feature of some orientation in your FFT spectrum which you could pick up with a simple thresholding operation. For more information please see &lt;a href=&quot;http://www.robots.ox.ac.uk/~az/lectures/ia/lect2.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.robots.ox.ac.uk/~az/lectures/ia/lect2.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-27T14:01:47.417" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22378" PostTypeId="2" ParentId="22364" CreationDate="2015-03-27T14:10:46.287" Score="0" Body="&lt;p&gt;This can be thought of a pitch detection problem, consider taking an auto-correlation of the image and finding the 1st zero crossing. This will tell you the frequency of the most prominent signal.&lt;/p&gt;&#xA;" OwnerUserId="941" LastEditorUserId="941" LastEditDate="2015-03-27T14:39:21.973" LastActivityDate="2015-03-27T14:39:21.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22380" PostTypeId="1" CreationDate="2015-03-27T15:37:10.473" Score="1" ViewCount="4559" Body="&lt;p&gt;I'm reading through the literature for finding the best way to calculate SNR for a ECG signal. While there are many algorithms for improving SNR, I couldn't find any that details any standard procedure for evaluating the SNR itself. The following are my questions.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the SNR of a typical ECG signal from the MIT/BIH database? What is considered a good SNR for a typical ECG signal?&#xA;&lt;a href=&quot;http://www.physionet.org/physiobank/database/mitdb/&quot; rel=&quot;nofollow&quot;&gt;http://www.physionet.org/physiobank/database/mitdb/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What would qualify as Signal and Noise for ECG? The assumption that I worked with is to apply a bandpass filter with cut-offs fc=[0.5Hz,45Hz] on the recorded ECG signal to get the Clean ECG signal, then subtract the clean ECG signal from recorded signal to obtain noise and then use the matlab snr function to evaluate  SNR with the clean signal and noise as arguments. But, in some papers it is recommended to reject everything except the QRS complex to get the clean signal. Is there any standard/recommended procedure for calculating SNR for ECG?&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/QRS_complex&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/QRS_complex&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What would be the best way to calculate ECG SNR in real-time in an embedded platform?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="11242" LastEditDate="2015-03-27T16:56:18.433" LastActivityDate="2019-01-12T09:02:13.143" Title="Calculating SNR for ECG signals" Tags="|matlab|filters|signal-analysis|snr|denoising|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22381" PostTypeId="1" CreationDate="2015-03-27T18:54:45.363" Score="0" ViewCount="1726" Body="&lt;p&gt;Please advice how to calculate FIR filter coefficients with the windowing method using the Rectangular Window function and convolution method? What utility or FIR design application can perform this task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bWefg.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15208" LastEditorUserId="15208" LastEditDate="2015-03-28T20:49:39.847" LastActivityDate="2015-03-28T20:49:39.847" Title="Calculating FIR filter coefficients with the windowing method and Convolution algorithm" Tags="|filters|signal-analysis|convolution|bandpass|digital-filters|" AnswerCount="1" CommentCount="2" ClosedDate="2015-04-13T17:37:38.280" ContentLicense="CC BY-SA 3.0" />
  <row Id="22382" PostTypeId="1" AcceptedAnswerId="22390" CreationDate="2015-03-26T03:34:26.250" Score="2" ViewCount="502" Body="&lt;p&gt;I have search a bit to try to find a similar questions, but I have not been able to find any leads.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are techniques to programmatically detect steady tones in audio, such as the Goertzel algorithm. I have been trying to find a way to detect a frequency sweep of some kind. My specific application is to monitor the audio from a security camera, and detect, say, when a door prop or car alarm is triggered. If it matters, one can assume that the sound will repeat many times, and that the frequency is a smooth sweep, and not discreet tones. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want to base it strictly off of amplitude, since the frequency response is sometimes very non-linear on these cheap cameras, and other noises can be a source of false alarms. Also, the alarm source may be distant.&lt;/p&gt;&#xA;" OwnerUserId="15253" OwnerDisplayName="hashbang" LastActivityDate="2015-03-27T21:37:40.617" Title="method to detect frequency sweep in audio" Tags="|audio|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22383" PostTypeId="1" AcceptedAnswerId="22386" CreationDate="2015-03-27T19:12:37.193" Score="1" ViewCount="181" Body="&lt;p&gt;What does the spatial correlation of a signal say about it?How is it different from autocorrelation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;`&lt;/p&gt;&#xA;" OwnerUserId="9130" LastEditorUserId="7092" LastEditDate="2015-03-27T19:49:32.687" LastActivityDate="2015-03-27T20:25:38.273" Title="What is spatial correlation?" Tags="|signal-analysis|correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22385" PostTypeId="1" CreationDate="2015-03-27T19:44:44.700" Score="0" ViewCount="458" Body="&lt;p&gt;So I'm trying to get some sample time-series data from pink noise (PSD: $S(f) = 1/f$). However, when I try to evaluate the Inverse Fourier Transform integral&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\int \frac{1}{\omega} e^{j \omega t} dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from negative infinity to positive infinity, I get a non-converging integral. I tried a Taylor Expansion, but I'm running into the same issue. Is there some other way around this?&lt;/p&gt;&#xA;" OwnerUserId="15209" LastEditorUserId="15209" LastEditDate="2015-03-27T19:53:31.000" LastActivityDate="2016-01-23T19:18:25.983" Title="Deriving Time-Series Data from PSD when the Inverse Fourier Transform doesn't converge" Tags="|fft|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22386" PostTypeId="2" ParentId="22383" CreationDate="2015-03-27T20:25:38.273" Score="1" Body="&lt;p&gt;Spatial correlation is relevant in sensor arrays and MIMO wireless communications. In the case of MIMO communications where multiple spatially separate antennas receive different observations of a multipath signal, spatial correlation can be used to evaluate the 'antennae diversity'. Higher the diversity, better the mitigation of signal fading effects introduced by the wireless medium. As a result the link quality is improved.&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Antenna_diversity&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Antenna_diversity&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-03-27T20:25:38.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22387" PostTypeId="1" CreationDate="2015-03-27T20:47:30.233" Score="3" ViewCount="275" Body="&lt;p&gt;As we all know the capacity for a AWGN channel with constant noise variance is just given by $$\frac{1}{2}\log(1+SNR)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if the variance of the noise changes with the type (assuming the variance is known for any time index)? Consider the following discrete channel:&#xA;$$&#xA;y[n] = x[n] + w[n], \quad n=1,\dots,N&#xA;$$&#xA;where $w[n]$ is the noise during the $n$-th symbol distributed as $\mathcal{N}(0,\sigma^2_n)$, with known $\{\sigma_n^2\}_{n=1}^N$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the capacity defined in such case? &lt;/li&gt;&#xA;&lt;li&gt;It should be related to some dynamic rate control, right? &lt;/li&gt;&#xA;&lt;li&gt;Could anyone give me some reference on related topic?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4860" LastEditorUserId="1629" LastEditDate="2016-05-06T16:44:43.703" LastActivityDate="2018-02-26T09:51:49.417" Title="Channel capacity with additive Gaussian noise with changing variance" Tags="|discrete-signals|digital-communications|fading-channel|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22388" PostTypeId="1" CreationDate="2015-03-27T21:26:13.537" Score="0" ViewCount="525" Body="&lt;p&gt;For white noise, where the PSD is constant, we can model that as a simple Gaussian. Is there any way to model the probability density function of other types of noise (pink noise, red noise, blue noise, etc.), and if so, is there any way to derive such a thing?&lt;/p&gt;&#xA;" OwnerUserId="15209" LastActivityDate="2015-03-27T21:52:33.727" Title="Is there a closed form expression for noise other than white noise?" Tags="|power-spectral-density|gaussian|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22389" PostTypeId="2" ParentId="22253" CreationDate="2015-03-27T21:32:20.733" Score="1" Body="&lt;p&gt;Using linear interpolation means that you will naturally get very sharp changes in gradient around your original data points. These sharp changes require a greater range of frequency components for their Fourier representation than a smoother version because sinusoids are themselves smooth functions. This leads to more noise in the Fourier transform in terms of both magnitude and phase, hence the 'unexpected' plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The single-period analysis is not only less representative of the original data set (it's just a subset), but is also affected more by the non-periodic nature of the data. Performing a Fourier transform on non-periodic data results in spectral leakage, degrading the quality of the output, and the shorter the sample the more spectral leakage you'll see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps the reason you're not seeing the 'expected' results even when using the entire data set is that plotting the Fourier coefficients on a linear scale is  not the best way to visualize them relative to one another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few things I'd suggest trying:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use an interpolation method that gives you smoother data&lt;/li&gt;&#xA;&lt;li&gt;Plot the Fourier coefficients on a logarithmic scale and see if the results match more closely with what you're expecting&lt;/li&gt;&#xA;&lt;li&gt;If after changing the interpolation method you're still seeing a lot of noise (i.e. wide peaks and  noise floor), try windowing the entire data set before performing the transform&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="user8798" LastActivityDate="2015-03-27T21:32:20.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22390" PostTypeId="2" ParentId="22382" CreationDate="2015-03-27T21:37:40.617" Score="0" Body="&lt;p&gt;If you know the signal of interest in advance, you can pre-record it and constantly calculate correlation between recorded sample and incoming signal.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Record a sample sound from a channel to be analyzed (you can record a number of periods)&lt;/li&gt;&#xA;&lt;li&gt;Reverse it&lt;/li&gt;&#xA;&lt;li&gt;Use reversed signal as an impulse response for FIR filter (this also is known as &quot;matched filter&quot;) -  filter will output a peak when signal of interest passes through it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you are interested in general varying tone detection (much more difficult problem), look at the chirplet transform - the sort of wavelet transform which uses varying frequency wavelets (chirplets) as its basis. People used it to &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0165168408000236&quot; rel=&quot;nofollow&quot;&gt;count wolf howls&lt;/a&gt;, for example.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-03-27T21:37:40.617" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22391" PostTypeId="2" ParentId="22388" CreationDate="2015-03-27T21:52:33.727" Score="1" Body="&lt;p&gt;This is usually done with filtering of white noise.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;White noise generator + LP filter give you a red noise generator.&lt;/li&gt;&#xA;&lt;li&gt;White noise generator + HP filter give you a blue noise generator&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Design a filter with required frequency response and apply it to a white noise generator.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-03-27T21:52:33.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22392" PostTypeId="1" CreationDate="2015-03-28T01:24:58.897" Score="1" ViewCount="1214" Body="&lt;p&gt;I'm working on finding the center of rotation of a set of test tomographic projections in order to perform 2D reconstruction. I'm trying to implement the  algorithm to find center of rotation as described in &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/25320994&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vo et al. 2014&lt;/a&gt;, which involves Fourier transforming the sinogram and searching frequency space outside the &quot;bow tie&quot; double-wedge region for minimum artifacts that result from wrong center of rotation. However, when I Fourier transformed a sample sinogram generated from Shepp-Logan model, the resulting frequency space has lots of artifacts outside the double-wedge region even when center of rotation is correct. Through visual inspection I've also noticed that the amount of artifacts are sensitive to number of projections in the sinogram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/57KnS.png&quot; alt=&quot;Phantom&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hYvPm.png&quot; alt=&quot;Sinogram&quot;&gt;&#xA;Below: FT of sinogram with 200 projections, from 0 degree to 180 degree&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JgXao.png&quot; alt=&quot;Fourier transform of the sinogram&quot;&gt;&#xA;Below: FT of sinogram with 180 projections, from 0 degree to 180 degree&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sFnTY.png&quot; alt=&quot;FT of sinogram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT'ed sinogram in the paper shows distinct zero regions outside the double wedge area, which is mathematically true as it is proven &lt;a href=&quot;http://proceedings.spiedigitallibrary.org/mobile/proceeding.aspx?articleid=1243674&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. However, I'm not sure why my FFT'ed sinograms do not show similar zero regions as in the paper. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my first time posting here, so please let me know what other information is needed for others to help me. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my code&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;P=phantom(256);&#xA;&#xA;angs=linspace(0,179,200);&#xA;&#xA;pjs=radon(P,angs);&#xA;&#xA;pjs=rot90(pjs,3);&#xA;&#xA;pjs_inv=fliplr(pjs);&#xA;&#xA;pjshift_inv=circshift(pjs_inv,[0 0]);&#xA;&#xA;sinogram=[pjs; pjshift_inv];&#xA;&#xA;figure(1),imagesc(sinogram);axis image,colormap gray&#xA;&#xA;ft=real(fftshift(fft2(sinogram)));&#xA;&#xA;figure(2), imshow(ft),colormap gray,axis image,axis on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="15211" LastEditorUserId="10650" LastEditDate="2015-05-22T20:08:15.160" LastActivityDate="2017-03-04T15:47:32.400" Title="Sinogram Fourier Analysis Doesn't Show Clear Bow Tie Shape" Tags="|matlab|fft|dft|interpolation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22394" PostTypeId="2" ParentId="22302" CreationDate="2015-03-28T07:12:00.480" Score="1" Body="&lt;p&gt;ICA can be seen as a dimension reduction technique similar to PCA.  Although PCA consists of the eigenvectors of the covariance matrix i.e. second order statistics, ICA is not restricted and can contain higher order stat. The goal of ICA is to span the signal space in the most statistical independent vectors. So you might get a considerable dimension reduction.&lt;/p&gt;&#xA;" OwnerUserId="15215" LastActivityDate="2015-03-28T07:12:00.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22395" PostTypeId="2" ParentId="22385" CreationDate="2015-03-28T08:07:10.993" Score="1" Body="&lt;p&gt;Even if you had succeeded in deriving the inverse Fourier transform of $1/|f|$ (note that you need the absolute value) then you still wouldn't have a time-series with a $1/f$ behavior. What you would get is the auto-correlation sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good way to generate pink ($1/f$) noise is to generate (approximately) white noise with a random number generator, and filter that noise with a filter whose frequency response approximates $1/\sqrt{f}$ over a large frequency range. Of course the frequency response needs to have a finite value at $f=0$, but it is possible to design a filter approximating $1/\sqrt{f}$ for $f&amp;gt;f_{min}$ with a relatively small value for $f_{min}$. If you have a question as to how to design such a filter you should probably formulate this as a new question. You can also have a look at &lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/&quot; rel=&quot;nofollow&quot;&gt;this site&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And by the way, the inverse Fourier transform of $1/|f|$ does exist in terms of distributions: check &lt;a href=&quot;https://www.wolframalpha.com/input/?i=inverse+fourier+transform+1%2Fabs%28x%29&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-29T13:32:38.907" LastActivityDate="2015-03-29T13:32:38.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22397" PostTypeId="2" ParentId="22381" CreationDate="2015-03-28T11:09:22.213" Score="1" Body="&lt;p&gt;draw your desired frequency response.  uniformly sample that frequency response $\frac{N}{2}$ times from DC up to just below Nyquist.  reflect those $\frac{N}{2}-1$ samples (not the DC values) as complex conjugate in the upper half of the frequency response above Nyquist.  do the inverse FFT.  if it's rectangular window, you're done. &lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-03-28T11:09:22.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22398" PostTypeId="1" AcceptedAnswerId="22417" CreationDate="2015-03-28T12:12:13.290" Score="0" ViewCount="74" Body="&lt;p&gt;Generally, everyone knows that &quot;the part of signal with high-slope is the high frequency part.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the definition or theory behind it?&lt;br&gt;&#xA;How to prove this well-known thing?&lt;br&gt;&#xA;perhaps, I miss something apparent.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-03-29T13:30:39.373" Title="How to prove: high-slope/more change is high freq part of signal" Tags="|signal-analysis|continuous-signals|signal-synthesis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22401" PostTypeId="2" ParentId="22264" CreationDate="2015-03-28T13:46:51.133" Score="4" Body="&lt;p&gt;To the excellent recommendations so far, I would like to add two books I have found useful in understanding digital signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Introductory Digital Signal Processing with Computer Applications by Lynn and Fuerst&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book is very well written and makes extensive use of block diagrams that help immensely in visualising signal operations. A bit old but still useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Digital Signal Processing: A Practical Approach by Ifeachor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very good introductory book but also contains code examples in various architectures and from a wide variety of applications including the  communications, audio and biomedical domains.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-28T13:46:51.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22402" PostTypeId="1" CreationDate="2015-03-28T15:08:38.930" Score="0" ViewCount="107" Body="&lt;p&gt;If you have 2 points (x1y1,x2y2) in a Cartesian grid, there are an infinite amount of sinusoids that pass through them. But if you are also given the &lt;a href=&quot;http://en.wikipedia.org/wiki/Instantaneous_phase&quot; rel=&quot;nofollow&quot;&gt;instantaneous phase&lt;/a&gt; (Th0) in radians or degrees at that point, is that sufficient to estimate the amplitude and frequency of the sinusoid that passes through these 2 points? And is there a way to find a formula f(x1y1,x2y2,Th0) where you can simply plug in these 3 variables which returns the amplitude and phase of the sinusoid, so you don't have to look it up in a table? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="735" LastEditorUserId="735" LastEditDate="2015-03-28T15:38:12.083" LastActivityDate="2015-03-29T00:05:36.640" Title="2 points and instantaneous phase sufficient to estimate amplitude and frequency of sinusoid?" Tags="|phase|time-frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22404" PostTypeId="1" AcceptedAnswerId="22408" CreationDate="2015-03-28T20:21:53.413" Score="0" ViewCount="568" Body="&lt;p&gt;I'm doing some fourier synthesis by making bins of complex numbers, filling them out with the amplitude and phase information and using IFFT to turn that into time domain samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm able to make sine, saw, triangle and square waves, and other more exotic periodic wave forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how do you do fourier synth for sounds that have frequency amplitudes that change over time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you do it in small windows and append them together? If so, how do you make sure the phase's line up for each frequency from window to window?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks so much for any info!&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-03-28T22:45:18.063" Title="Fourier Synthesis With Varying Frequencies Over Time" Tags="|fft|ifft|signal-synthesis|window|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22405" PostTypeId="2" ParentId="22175" CreationDate="2015-03-28T20:40:53.060" Score="9" Body="&lt;p&gt;Using overlapping rectangular windows has the potential to give an extra 'weighting' to certain sections of the audio unless you choose the overlap carefully. For example, with an overlap of 25% you're accounting for half of the data twice and the other half just once. This is not necessarily an issue depending on the application, but is something to bear in mind. Choosing overlaps of 1/2, 2/3, 3/4... solves this problem (assuming a signal of reasonable length).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given overlap, the choice of window length affects two things really - temporal resolution and coefficient quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is slightly easier to explain and visualise. If the window increases in length then you have fewer windows spread across your audio and therefore a greater time interval between each - i.e. lower temporal resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficient quality, however, increases with window length. If you perform a Fourier transform over a longer sample you get a higher frequency resolution and each coefficient is therefore more 'representative' of its frequency. Think of a coefficient as a frequency bin rather than a single frequency value. Shorter windows leads to wider frequency bins and smoothing/smearing of the coefficients, whereas longer windows leads to narrower, more 'distinct' bins. A quick way of working out the bin size is to do 1 / (length of window in seconds). If this comes out to be 20 Hz and you want to be able to compare the coefficients at 330 Hz with those at 340 Hz then you might consider upping the window length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can probably see the tradeoff in window length here - longer windows give less temporal resolution and better coefficient quality; shorter windows give higher temporal resolution and lower coefficient quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently you're using not using a window function, i.e. your windows are rectangular. Window functions are useful in that they can make your window of data appear more periodic than it actually is. Remember that the Fourier transform assumes periodicity. Any significant differences in the start and end of your window of data become a sharp step change under that assumption, producing a lot of extra coefficients/noise. Multiplying the data by a window function can help mitigate that problem to some extent by reducing the magnitude down to zero or near-zero at the edges of your window. Common window functions used for audio are the Hann and Hamming windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this all means for you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I'd recommend using a window function to reduce noise if your windows of data are non-periodic, which is likely. Start out with a Hann window.&lt;/li&gt;&#xA;&lt;li&gt;Id also recommend an overlap of 50%. When used with a Hann window this value has the advantage that 50% overlapping Hann windows sum together to a constant magnitude of unity. An overlap of more than this results in better coefficient quality at the expense of extra processing, but 50% is a good starting point.&lt;/li&gt;&#xA;&lt;li&gt;With the overlap chosen your decision about window length should be based on the tradeoff mentioned earlier and depends on your application. If you want a high temporal resolution then you're going to have to sacrifice quality. If you want to be able to compare tightly spaced frequencies over time then you'll have to sacrifice temporal resolution.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="user8798" LastActivityDate="2015-03-28T20:40:53.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22406" PostTypeId="2" ParentId="22157" CreationDate="2015-03-28T20:41:48.950" Score="0" Body="&lt;p&gt;I think the effect you're seeing can be explained in terms of the shift theorem of Fourier transforms and the periodicity of the discrete Fourier transform.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like the recovered object has been shifted upwards, and because the DFT is periodic, the top part of the object that's left the field of view has wrapped around to re-appear at the bottom of the field.&#xA;The reason the object is shifted is hard to see without knowing more about how your implementation of phase retrieval.  I can say that, due to the shift theorem, we know a shift in the object domain causes a linear phase in the Fourier domain, but does not affect the Fourier modulus.  So, the Fourier modulus alone can't help you find the correct shift.&lt;br&gt;&#xA;I suspect you're leaving out some key information when you say &quot;The only information given is the Fourier Modulus&quot;, because if that were strictly true you wouldn't be able to do phase retrieval at all.  As discussed in the paper, you need to have some other piece of information, typically the modulus of the object or the object support (the object support is a closed boundary that you know contains the object).  If you know the modulus of the object or at least its support, then reinforcing that constraint on every iteration of the error-reduction algorithm would prevent the object estimate from shifting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to your third question, I would point out that error-reduction is only the simplest algorithm discussed in the paper.  Gradient searches or the input-output methods described in the later sections are usually faster and/or more reliable.  In more recent years, successful methods that leverage nonlinear optimization algorithms such as BFGS have also become common. If you're interested, you might check out Prof. Fienup's &lt;a href=&quot;http://www.optics.rochester.edu/workgroups/fienup/Publications.htm&quot; rel=&quot;nofollow&quot;&gt;list of publications&lt;/a&gt;.    &lt;/p&gt;&#xA;" OwnerUserId="15224" LastActivityDate="2015-03-28T20:41:48.950" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22407" PostTypeId="2" ParentId="22372" CreationDate="2015-03-28T21:40:55.027" Score="0" Body="&lt;p&gt;You're after an algorithm in the family of &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Deconvolution&quot; rel=&quot;noreferrer&quot;&gt;DeConvolution&lt;/a&gt;&quot;.&lt;br&gt;&#xA;Specifically in your case, is called Blind Deconvolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet if you have some assumption the Blur you can use &lt;a href=&quot;http://Wiener%20Filter&quot; rel=&quot;noreferrer&quot;&gt;Wiener Filter&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Richardson%E2%80%93Lucy_deconvolution&quot; rel=&quot;noreferrer&quot;&gt;Lucy Richardson&lt;/a&gt;.&lt;br&gt;&#xA;Both of them are actually the MMSE Estimator just with different assumption of the noise.&lt;br&gt;&#xA;Both of the methods are actually &quot;Inverse Filter&quot; on an Low Pass Filter, which means they are High Pass Filter, just like the Unsharp Filter you applied.&lt;br&gt;&#xA;The difference is those methods are optimal per given &quot;Blur Model&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, if you go after the Blind Deconvolution, today the best estimators are based on some prior of the image.&lt;br&gt;&#xA;Something like the distribution of the Gradient of the image and stuff like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet if you are only after the text in the image.&lt;br&gt;&#xA;Something simple like Wiener Filter + Edge Detection should do the work to give you most data.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-03-28T21:40:55.027" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22408" PostTypeId="2" ParentId="22404" CreationDate="2015-03-28T22:42:06.230" Score="1" Body="&lt;p&gt;You might want to have a look at the overlap-add (&lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&lt;/a&gt;) and overlap-save (&lt;a href=&quot;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&lt;/a&gt;) methods. But, if all you are trying to do is additive synthesis, you don't absolutely have to use the IFFT to generate your signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can set up a bank of $M \in {[1 \ldots N_{Osc}]}$ elementary oscilators of the form $x_m(n)=\alpha_m \times sin(\frac{2 \times \pi \times f_m \times n}{Fs}+\phi_m) $ where $m \in M, N_{Osc} \in \mathbb{N}$, $\alpha_m, \phi_m, F_s, f_m \in \mathbb{R}$ and final output $y(n) = \sum_{m \in M}{x_m(n)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, $\alpha_m, \phi_m$ are amplitude and phase coefficients for each oscillator at frequency $f_m$ and to make them variable in time, all you have to do is turn them to $\alpha_m(n), \phi_m(n)$, i.e. to make them dependent on time sample $n$. This can be an absolute definition, by actually defining a varying waveform or by using some form of interpolation to provide initial and final values for these quantities and let the intermediate values be calculated automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would work both for generating one sample at a time or a frame of samples at a time (by iteration) and would not have any problems with continuity. &lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-03-28T22:42:06.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22409" PostTypeId="2" ParentId="22404" CreationDate="2015-03-28T22:45:18.063" Score="0" Body="&lt;p&gt;When you search for Fourier transform pairs you can find quite a few functions in the time and frequency domain which are each others (inverse)Fourier transform. Some of these pairs also contain time domain functions, which are sinusoidal with changing amplitude over time. For example exponential decay can be written as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{L}\{e^{-at}x(t)\}=X(s+a),&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathcal{L}\{x(t)\}=X(s)=\int_0^\infty x(t)e^{-st}dt$ and $x(t)=0$ for $t&amp;lt;0$. Another example would be multiplying by time,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{L}\{tx(t)\}=-\frac{d}{ds}X(s),&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by using the fact that $\mathcal{L}\{\alpha x_1(t)+\beta x_2(t)\}=\alpha X_1(s)+\beta X_2(s)$, then this can be used to construct a variable amplitude over time using a polynomial.&lt;/p&gt;&#xA;" OwnerUserId="7579" LastActivityDate="2015-03-28T22:45:18.063" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22410" PostTypeId="2" ParentId="22402" CreationDate="2015-03-29T00:05:36.640" Score="1" Body="&lt;p&gt;An additional requirement is that the two points not be aliased in terms of their equivalent sampling rate relative to the frequency of the sinusoid.  The distance between the two points can't be a equal or greater than half the period of the sinusoid, or the solution could be ambiguous.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-03-29T00:05:36.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22411" PostTypeId="1" CreationDate="2015-03-29T00:21:11.560" Score="0" ViewCount="950" Body="&lt;p&gt;I am supposed to design a delay and sum beam former for a short audio. But the sampling frequency is only 8kHz and after times the delay, the fractional delay is less then one sample, and after the &quot;floor&quot; function in Matlab, all the fractional delay integer will be 0 and the results are neither fractional delayed nor time aligned. Exponential weights cannot be used in this case for the reason no imaginary part should be in the filtered signal. &lt;/p&gt;&#xA;" OwnerUserId="15226" LastActivityDate="2015-09-25T08:02:17.670" Title="How to design a delay and sum beam former with fractional delay less than one sample?" Tags="|matlab|delay|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22412" PostTypeId="1" AcceptedAnswerId="25850" CreationDate="2015-03-29T01:07:27.440" Score="2" ViewCount="8375" Body="&lt;p&gt;I could not find any proof or comparison of weighted median and median filters. Yes the more occurring pixel contributes much but what should be the criteria of choosing weight function. And any explanation of cases where weighted median is strongly recommended to be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Median Filter replaces pixel value &lt;code&gt;c&lt;/code&gt; with &lt;code&gt;p&lt;/code&gt; where p is the median of pixel values in neighborhood of &lt;code&gt;c&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of weighted median there are N $\left[ I_1,I_2,..,I_N \right]$ neighbor pixels,for each pixel there is also weight. Weighted median of that neighborhood is $k^{th}$ pixel  where $k$ is the minimum integer with $\sum\limits_{i=1}^k w_{i}\geq\frac{1}{2}\sum\limits_{i=1}^N w_{i}$ &lt;/p&gt;&#xA;" OwnerUserId="12059" LastEditorUserId="15892" LastEditDate="2015-09-15T20:12:08.957" LastActivityDate="2020-07-29T07:25:28.973" Title="What is the advantage of weighted median filter over median filter?" Tags="|image-processing|filters|non-linear|" AnswerCount="3" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="22414" PostTypeId="2" ParentId="22411" CreationDate="2015-03-29T04:29:50.210" Score="1" Body="&lt;p&gt;There is no reason you cannot use exponential weights. Those are used in the frequency domain, not in time domain, and won't produce imaginary part.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Properties_of_the_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Translation/ Time-Shifting Property of the Fourier transform&lt;/a&gt;, you can define the weights (per frequency bin), even for fractional delay. By the way, the problem of fractional delay is not only when it is less then 1 sample. Flooring all delays to be integers will produce sub-optimal results.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A different approach is to use interpolation in time-domain to obtain values between samples, e.g. using &lt;code&gt;interp1&lt;/code&gt;. This approach will be much slower, if it matters.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-03-29T04:29:50.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22417" PostTypeId="2" ParentId="22398" CreationDate="2015-03-29T13:30:39.373" Score="1" Body="&lt;p&gt;The Fourier transform of the derivative of a signal $x(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dot{x}(t)\Longleftrightarrow j\omega X(\omega)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\dot{x}(t)$ denotes the derivative of $x(t)$, and $X(\omega)$ is the Fourier transform of $x(t)$. From (1) we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dot{x}(t)=\frac{j}{2\pi}\int_{-\infty}^{\infty}\omega X(\omega)e^{j\omega t}\,d\omega\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we now assume that $x(t)$ is band-limited with cut-off frequency $\omega_c$ (in radians), then (2) becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dot{x}(t)=\frac{j}{2\pi}\int_{-\omega_c}^{\omega_c}\omega X(\omega)e^{j\omega t}\,d\omega\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (3) we can determine an upper bound for $|\dot{x}(t)|$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\dot{x}(t)|\le \frac{1}{2\pi}\int_{-\omega_c}^{\omega_c}|\omega| |X(\omega)|\,d\omega&#xA;\le\frac{\omega_c}{2\pi}\int_{-\omega_c}^{\omega_c}|X(\omega)|\,d\omega\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upper bound (4) on the magnitude of the derivative of $x(t)$ increases with increasing $\omega_c$, so you can expect faster changes of $x(t)$ with increasing values of the cut-off frequency $\omega_c$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-29T13:30:39.373" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22420" PostTypeId="1" CreationDate="2015-03-29T18:20:39.620" Score="0" ViewCount="59" Body="&lt;p&gt;I am trying to find EBW of rect function but i am unable to solve the integral&#xA;after finding the fourier transform and then apply parseval's theorem?&lt;/p&gt;&#xA;" OwnerUserId="15234" LastEditorUserId="15234" LastEditDate="2015-03-30T10:06:16.520" LastActivityDate="2015-03-30T10:06:16.520" Title="Find the essential bandwidth of rect function? i want the ans by using Energy spectral density and then essential bandwidth..." Tags="|digital-communications|" AnswerCount="0" CommentCount="2" ClosedDate="2015-03-30T13:36:39.443" ContentLicense="CC BY-SA 3.0" />
  <row Id="22421" PostTypeId="1" CreationDate="2015-03-29T18:26:45.113" Score="4" ViewCount="4004" Body="&lt;p&gt;I need to find the periodicity of the following signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x\left [ n \right ] = \cos \left(\frac{\pi n^{2}}{8}\right) $$&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I understand that the basic procedure to determine the periodicity is to find a &lt;span class=&quot;math-container&quot;&gt;$ N $&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$ x\left [ n \right ] = x\left [ n + N\right ] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I applied the procedure to the aforementioned signal and got the following results:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;x\left[ n\right] &amp;amp;= \cos \left(\frac{\pi n^{2}}{8}\right) \\ &#xA;x\left[ n + N\right] &amp;amp;= \cos \left(\frac{\pi (n + N)^{2}}{8}\right)\\&#xA;&amp;amp;= \cos \left(\frac{\pi (n^{2} + 2nN + N^{2})}{8}\right)\\&#xA;&amp;amp;= \Re \left \{\exp \left(i \frac{\pi (n^{2} + 2nN + N^{2})}{8}\right)  \right \}\\&#xA;&amp;amp;= \Re \left \{\exp \left(i \frac{\pi n^{2}}{8}\right)\exp \left(i \frac{\pi 2nN}{8}\right)\exp \left(i \frac{\pi N^{2}}{8}\right)  \right \}&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Now for the signal to conform to &lt;span class=&quot;math-container&quot;&gt;$ x\left [ n \right ] = x\left [ n + N\right ]$&lt;/span&gt;: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Re \left \{\exp \left(i \frac{\pi 2nN}{8}\right)\exp \left(i \frac{\pi N^{2}}{8}\right)  \right \} = 1&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \exp(i\omega) = 1 $&lt;/span&gt; only when &lt;span class=&quot;math-container&quot;&gt;$ \omega = 2\pi k $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is an integer. Hence:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{\pi 2nN}{8} = \frac{\pi N^{2}}{8} = 2\pi k&#xA;$$&lt;/span&gt;&#xA;Now logically I can see that if &lt;span class=&quot;math-container&quot;&gt;$ N = 8 $&lt;/span&gt; the first term would be reduced to a multiple of &lt;span class=&quot;math-container&quot;&gt;$ 2\pi $&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$ n $&lt;/span&gt; and hence the fundamental period would be &lt;span class=&quot;math-container&quot;&gt;$ N = 8 $&lt;/span&gt; but how would I go about proving this mathematically, that the minimum period is indeed 8? like what set of operations would I perform on:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{\pi 2nN}{8} = \frac{\pi N^{2}}{8} = 2\pi k&#xA;$$&lt;/span&gt;&lt;br&gt;&#xA;to obtain &lt;span class=&quot;math-container&quot;&gt;$ N = 8 $&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15233" LastEditorUserId="47251" LastEditDate="2020-02-17T21:34:06.900" LastActivityDate="2023-05-23T21:19:00.333" Title="Periodicity of discrete time signal: $ x\left [ n \right ] = \cos (\frac{\pi n^{2}}{8}) $" Tags="|discrete-signals|periodic|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22422" PostTypeId="2" ParentId="22363" CreationDate="2015-03-29T18:49:10.963" Score="2" Body="&lt;p&gt;I am not familiar with signal processing for audio, but I would like give answer which contain common programming suggestions. Sorry, I really do not know your programming level and may be this suggestions will be look obvious and ridiculous, but I hope it will be useful.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm getting some odd results with some code I'm working on.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When you get odd results usual this caused by one of three reasons: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;incorrect implementation of correct logic;&lt;/li&gt;&#xA;&lt;li&gt;correct implementation of incorrect logic;&lt;/li&gt;&#xA;&lt;li&gt;incorrect implementation of incorrect logic.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Some implementation errors such as: using of uninitialized variables, using of wrong pointers, accessing to memory out of bounds can be easy found when using some special tools. One kind of tools is &lt;a href=&quot;http://en.wikipedia.org/wiki/Program_analysis_%28computer_science%29&quot; rel=&quot;nofollow&quot;&gt;static code analyser&lt;/a&gt;, there are a &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#C.2FC.2B.2B&quot; rel=&quot;nofollow&quot;&gt;large number&lt;/a&gt; of varied of static code analysers, but I would suggest you use &lt;a href=&quot;http://en.wikipedia.org/wiki/Cppcheck&quot; rel=&quot;nofollow&quot;&gt;cppcheck&lt;/a&gt;. Other kind of tools is (memory) &lt;a href=&quot;http://en.wikipedia.org/wiki/Profiling_%28computer_programming%29&quot; rel=&quot;nofollow&quot;&gt;profilers&lt;/a&gt;. I would suggest you use &lt;a href=&quot;http://valgrind.org/docs/manual/mc-manual.html&quot; rel=&quot;nofollow&quot;&gt;memcheck&lt;/a&gt; tool from &lt;a href=&quot;http://en.wikipedia.org/wiki/Valgrind&quot; rel=&quot;nofollow&quot;&gt;valgrind&lt;/a&gt; suite. Very often this tools helps find very tricky errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find logical error you need test code with different input data and conditionals. It is possible to do it manually time to time, but more easy to do it automatically by calling small code snippets. This code snippets can be designed as simple console application or as test case using some testing framework. Testing framework is not necessary for writing test, but it need for manage tests. I suggest to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Google_Test&quot; rel=&quot;nofollow&quot;&gt;the C++ Google testing framework&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I will try to implement my own suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all to allow a piece of existed code will be compiled without errors I added header file and put into it all required types and variables:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;cstdint&amp;gt;&#xA;&#xA;using VstInt32 = int32_t;&#xA;constexpr int delay_samples             {1};&#xA;constexpr int CIRCULAR_BUFFER_LENGTH    {4};&#xA;constexpr float feedback             {0.0f};&#xA;constexpr float delay_level          {0.0f};&#xA;&#xA;struct CircularBuffer&#xA;{&#xA;    CircularBuffer ()&#xA;    {&#xA;        for (int i = 0; i &amp;lt; CIRCULAR_BUFFER_LENGTH; ++i) {&#xA;            buffer [i] = 0.0f;&#xA;        }&#xA;        index = 0;&#xA;    };&#xA;&#xA;    int index;&#xA;    float buffer [CIRCULAR_BUFFER_LENGTH];&#xA;};&#xA;&#xA;&#xA;class delay&#xA;{&#xA;    public:&#xA;        void processReplacing (float **, float **, VstInt32);&#xA;&#xA;    private:&#xA;        CircularBuffer cBuf;&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Shared code I placed into source (*.cpp) file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;delay.h&quot;&#xA;&#xA;void delay::processReplacing (float ** inputs, float ** outputs, VstInt32 sampleFrames)&#xA;{&#xA;    float * in  = inputs  [0];&#xA;    float * out = outputs [0];&#xA;    float delayed_sample = 0.0f;&#xA;    int delayed_sample_index;&#xA;    for (int frame_idx = 0; frame_idx &amp;lt; sampleFrames; frame_idx++) {&#xA;        delayed_sample_index = (((int)(cBuf.index - delay_samples) + CIRCULAR_BUFFER_LENGTH) % (int)CIRCULAR_BUFFER_LENGTH);&#xA;        delayed_sample = cBuf.buffer [delayed_sample_index];&#xA;        // Write current sample to buffer&#xA;        cBuf.buffer [cBuf.index] = in [frame_idx] + (delayed_sample * feedback);&#xA;        // Calculate + write output sample&#xA;        out [frame_idx]          = in [frame_idx] + (delayed_sample * delay_level);&#xA;        // Increment buffer index&#xA;        cBuf.index = (cBuf.index + 1) % CIRCULAR_BUFFER_LENGTH;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now time to write tests. I am not familiar with logic of function which you try to implement, so I write one simple test just for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;gtest/gtest.h&amp;gt;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;#include &quot;delay.h&quot;&#xA;&#xA;class delay_test : public ::testing::Test&#xA;{&#xA;    public:&#xA;        void SetUp    () override;&#xA;        void TearDown () override;&#xA;&#xA;        static constexpr int sampleFrames {8};&#xA;        float ** inputs;&#xA;        float ** outputs;&#xA;};&#xA;&#xA;// This code will be automatically called before every test.&#xA;// This is feature of Google Tests Framework.&#xA;void delay_test::SetUp ()&#xA;{&#xA;    inputs      = new float * [1];&#xA;    outputs     = new float * [1];&#xA;    inputs  [0] = new float   [sampleFrames];&#xA;    outputs [0] = new float   [sampleFrames];&#xA;    for (int i = 0; i &amp;lt; sampleFrames; ++i) {&#xA;        inputs  [0][i] = 0.0f;&#xA;        outputs [0][i] = 0.0f;&#xA;    }&#xA;}&#xA;&#xA;// This code will be automatically called before every test.&#xA;// This is feature of Google Tests Framework.&#xA;void delay_test::TearDown ()&#xA;{&#xA;    delete [] inputs  [0];&#xA;    delete [] outputs [0];&#xA;    delete [] inputs;&#xA;    delete [] outputs;&#xA;}&#xA;&#xA;&#xA;TEST_F (delay_test, response_on_1_Success)&#xA;{&#xA;    // Arrange.&#xA;    delay d;&#xA;    inputs [0][0] = 1.0f;&#xA;&#xA;    // Act.&#xA;    d.processReplacing (inputs, outputs, sampleFrames);&#xA;&#xA;    // Assert.&#xA;    for (int i = 0; i &amp;lt; sampleFrames; ++i) {&#xA;        if (1 == i) {&#xA;            EXPECT_FLOAT_EQ (1.0f, outputs [0][i]);&#xA;        }&#xA;        else {&#xA;            EXPECT_FLOAT_EQ (0.0f, outputs [0][i]);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Last step is writing build script. I use &lt;a href=&quot;https://en.wikipedia.org/wiki/CMake&quot; rel=&quot;nofollow&quot;&gt;cmake&lt;/a&gt;, so simple build script has the following content:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cmake_minimum_required (VERSION 2.8)&#xA;&#xA;project (delay)&#xA;&#xA;set (CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} -march=native -mtune=native -std=c++11 -Wall -Wextra&quot;)&#xA;&#xA;set (&#xA;    delay_test_SOURCES&#xA;    ${PROJECT_SOURCE_DIR}/delay.cpp&#xA;        ${PROJECT_SOURCE_DIR}/delay_test.cpp&#xA;)&#xA;&#xA;include_directories (&#xA;    ${PROJECT_SOURCE_DIR}&#xA;)&#xA;&#xA;add_executable (&#xA;    delay_test&#xA;    ${delay_test_SOURCES}&#xA;)&#xA;&#xA;target_link_libraries (&#xA;    delay_test&#xA;    gtest&#xA;    gtest_main&#xA;    pthread&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now it is possible to test code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's check code with cppcheck:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ cppcheck -I. --enable=all *.cpp&#xA;Checking delay.cpp...&#xA;[delay.cpp:7]: (style) The scope of the variable 'delayed_sample' can be     reduced.&#xA;[delay.cpp:8]: (style) The scope of the variable 'delayed_sample_index' can be reduced.&#xA;1/2 files checked 33% done&#xA;Checking delay_test.cpp...&#xA;2/2 files checked 100% done&#xA;Checking usage of global functions..&#xA;[delay_test.cpp:19]: (style) The function 'SetUp' is never used.&#xA;[delay_test.cpp:33]: (style) The function 'TearDown' is never used.&#xA;(information) Cppcheck cannot find all the include files (use --check-config for details)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results are good, &lt;strong&gt;nothing suspicious is found&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's launch tests and simultaneously memory profiler:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ valgrind ./delay_test&#xA;==11407== Memcheck, a memory error detector&#xA;==11407== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.&#xA;==11407== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info&#xA;==11407== Command: ./delay_test&#xA;==11407== &#xA;Running main() from gtest_main.cc&#xA;[==========] Running 1 test from 1 test case.&#xA;[----------] Global test environment set-up.&#xA;[----------] 1 test from delay_test&#xA;[ RUN      ] delay_test.response_on_1_Success&#xA;/home/gluttton/circ_buf/delay_test.cpp:57: Failure&#xA;Value of: outputs [0][i]&#xA;  Actual: 1&#xA;Expected: 0.0f&#xA;Which is: 0&#xA;/home/gluttton/circ_buf/delay_test.cpp:54: Failure&#xA;Value of: outputs [0][i]&#xA;Actual: 0&#xA;Expected: 1.0f&#xA;Which is: 1&#xA;[  FAILED  ] delay_test.response_on_1_Success (81 ms)&#xA;[----------] 1 test from delay_test (95 ms total)&#xA;&#xA;[----------] Global test environment tear-down&#xA;[==========] 1 test from 1 test case ran. (144 ms total)&#xA;[  PASSED  ] 0 tests.&#xA;[  FAILED  ] 1 test, listed below:&#xA;[  FAILED  ] delay_test.response_on_1_Success&#xA;&#xA; 1 FAILED TEST&#xA;==11407== &#xA;==11407== HEAP SUMMARY:&#xA;==11407==     in use at exit: 0 bytes in 0 blocks&#xA;==11407==   total heap usage: 306 allocs, 306 frees, 61,494 bytes allocated&#xA;==11407== &#xA;==11407== All heap blocks were freed -- no leaks are possible&#xA;==11407== &#xA;==11407== For counts of detected and suppressed errors, rerun with: -v&#xA;==11407== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Good news is that &lt;strong&gt;no errors was found by valgrind&lt;/strong&gt; (we can realize it by valgrind output messages). But bad news is that test is fell, it means that &lt;strong&gt;code works not as I expect&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusions: in my opinion your code implemented without visible implementation errors, but you need check logic of your code with various input data.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="10169" LastActivityDate="2015-03-29T18:49:10.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22423" PostTypeId="2" ParentId="22421" CreationDate="2015-03-29T18:49:41.187" Score="2" Body="&lt;p&gt;You have to prove that the period $N$ is the smallest number satisfying&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\pi}{8}(n+N)^2=\frac{\pi n^2}{8}+2\pi k,\quad k\in\mathbb{N}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (1) you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\pi}{8}n^2+\frac{\pi}{8}2nN+\frac{\pi}{8}N^2=\frac{\pi n^2}{8}+2\pi k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\pi}{8}2nN+\frac{\pi}{8}N^2=2\pi k\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2nN+N^2=16k\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for any value of $n$. Clearly, the smallest number $N$ for which the left-hand side of (3) is a multiple of $16$, regardless of the value of $n$, is $N=8$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$16n+16\cdot 4=16k$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-29T18:49:41.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22424" PostTypeId="2" ParentId="22421" CreationDate="2015-03-29T18:51:15.463" Score="2" Body="&lt;p&gt;You want to prove that $\frac{nN}{8}$ is an integer for any integer $n$. Consider $n=1$. Clearly, $N$ cannot be less than 8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need to prove that $\frac{N^2}{16}$ is an integer. This means that $N$ is a multiple of 4. So, the smallest $N$ that meets both conditions is 8.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-29T18:51:15.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22428" PostTypeId="1" AcceptedAnswerId="22430" CreationDate="2015-03-30T06:38:24.877" Score="0" ViewCount="1163" Body="&lt;p&gt;I am trying to implement iir Band Pass filter design in STM32F429i discovery kit.&#xA;I konw that it needs coefficients to be generated from matlab and feed them into cmsis api to achivi filtered data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My SOS Matrix look like shown below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1,  0,  -1,  1, -1.9974,   0.99743,        &#xA;1,  0,  -1,  1, -1.9995,  0.99947,        &#xA;1,  0,  -1,  1,  -1.9937,  0.99371,        &#xA;1,  0,  -1,  1, -1.9982,  0.99817,       &#xA;1,  0,  -1,  1, -1.995,  0.99499,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;above matrix i put into my coeff array removing column 4th which contains all 1's since its A0 in coeff.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;static float32_t filter_coeffs[] = {&#xA;1,  0,  -1,  -1.9974,   0.99743,        &#xA;1,  0,  -1,  -1.9995,  0.99947,        &#xA;1,  0,  -1,  -1.9937,  0.99371,        &#xA;1,  0,  -1,  -1.9982,  0.99817,       &#xA;1,  0,  -1,  -1.995,  0.99499,&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;here is the code snippet am using :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define NUMSTAGES 5&#xA;static float32_t firStateF32[2*NUMSTAGES];&#xA;arm_biquad_cascade_df1_init_f32(&amp;amp;S, NUMSTAGES, filter_coeffs, firStateF32);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when I am using matlab my signal are filtered perfect, but in microcontroller output is initially oscillating and than &quot;1.#QNAN&quot;&#xA;am i missing any step??&#xA;please correct me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Lokesh Bhatt&lt;/p&gt;&#xA;" OwnerUserId="15242" LastEditorUserId="7092" LastEditDate="2015-03-30T12:31:39.703" LastActivityDate="2017-02-22T00:00:47.020" Title="Matlab FIlter coefficients to CMSIS api" Tags="|matlab|filter-design|dsp-core|bandpass|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22429" PostTypeId="1" CreationDate="2015-03-30T06:46:22.637" Score="2" ViewCount="918" Body="&lt;p&gt;I am implementing image resizing algorithms (Bilinear, Bicubic, Lanczos and a few others).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I quantitatively compare them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking of considering a large sample of images and running these algorithms on all of them and compare pair wise wrt a standard interpolation implementation. What metric shall I use here? Any other ways of doing the same?&lt;/p&gt;&#xA;" OwnerUserId="15236" LastActivityDate="2017-08-03T09:34:54.250" Title="How to compare the qualities of two interpolation (image resizing) algorithms?" Tags="|image-processing|interpolation|resampling|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22430" PostTypeId="2" ParentId="22428" CreationDate="2015-03-30T07:13:23.483" Score="1" Body="&lt;p&gt;I'm not sure how you achieve a useful result in Matlab, because your filter is actually unstable. If you compute the pole radii of the second order sections you get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;max(abs(roots(sos(1,4:6))))    % 0.99871&#xA;max(abs(roots(sos(2,4:6))))    % 1.0052&#xA;max(abs(roots(sos(3,4:6))))    % 0.99685&#xA;max(abs(roots(sos(4,4:6))))    % 1.0047&#xA;max(abs(roots(sos(5,4:6))))    % 1.0015&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So all poles are virtually on the unit circle, which will give you trouble when trying to implement such a filter. Something went wrong in the design process. If you have doubts concerning the filter design process you should probably formulate a new question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-03-30T07:13:23.483" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22431" PostTypeId="2" ParentId="22429" CreationDate="2015-03-30T07:22:00.620" Score="1" Body="&lt;p&gt;There are many approaches to assess your resizing algorithms. Researchers typically use PSNR to compare quality of image. See &lt;a href=&quot;http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio&lt;/a&gt;  .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, they use the same set of images as the standard. Please see &lt;a href=&quot;http://www.hlevkin.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.hlevkin.com/&lt;/a&gt; in the &quot;test still images&quot;.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, If you want to calculate the PSNR, you need two images (Original one, and your test image). So, when you resize image with resolution a1 to a2, you have to resize it backward to original (a1). you can then evaluate it by calculating PSNR. (We generally use the same algorithm as the downsizing step to upsize (a2--&gt;a1).)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is, if you want to &lt;strong&gt;test the downsizing algorithm alone&lt;/strong&gt;, what is the proper method? Let's see what others have done.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Downsizing with test algorithm and Upsizing with &lt;em&gt;FIXED&lt;/em&gt; algorithm. (Normally be conventional e.g. Bilinear, Bicubic.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Likewise, to work with upsizing algorihm,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Downsizing in traditional way and then upsizing with test algorithm.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-03-30T07:22:00.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22432" PostTypeId="1" CreationDate="2015-03-30T09:12:07.883" Score="0" ViewCount="138" Body="&lt;p&gt;I have two mixed signals like $A_1f(t) + A_2g(t)$, where $f(t)$ and $g(t)$ are sinusoidal. I want to extract the amplitude infos. Directly I can not get the amplitudes (or I don't know how to). What I am doing is simply sample the signal and correlate the samples to a set of known amplitudes, then use the correlation to predict unknown sampled signals. But it seems it can not work very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any comments about the methods used.&lt;/p&gt;&#xA;" OwnerUserId="14925" LastEditorUserId="4298" LastEditDate="2015-03-30T09:32:58.233" LastActivityDate="2022-07-09T12:36:38.607" Title="Extract amplitudes" Tags="|correlation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22433" PostTypeId="1" AcceptedAnswerId="22439" CreationDate="2015-03-30T09:34:31.997" Score="1" ViewCount="2312" Body="&lt;p&gt;Can any one help with the $y[n]$ and $x[n]$ relationship in this block diagram, I just keep have a $t[n]$ in my answer that I can't get rid off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On my best try I got to $y[n] = 2t[n]-x[n-1]-y[n-2]+x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you could also tell me how you got there it would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks anyone for help.&lt;img src=&quot;https://i.stack.imgur.com/siKEK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15243" LastEditorUserId="7092" LastEditDate="2015-03-30T12:31:23.583" LastActivityDate="2015-03-31T22:33:39.833" Title="Transfer function block diagram" Tags="|discrete-signals|homework|transfer-function|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22436" PostTypeId="2" ParentId="22433" CreationDate="2015-03-30T13:50:33.593" Score="0" Body="&lt;p&gt;Two general suggestions:&#xA;1-Systematically write the equations at each node.&#xA;2-Time index can be changed to get new equations. For example in the top left node we have:&#xA;$$r[n]=y[n]-x[n]$$,&#xA;and thus:&#xA;$$r[n-1]=y[n-1]-x[n-1]$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer:&#xA;Write the equations at the two other nodes:&#xA;$$t[n]-t[n-1]=y[n-1]+y[n-2](*)$$&#xA;$$t[n]+t[n-1]=r[n]-r[n-1]=y[n]-x[n]-y[n-1]+x[n-1] $$ &#xA;Add two equations together:&#xA;$$t[n]=\frac{y[n]+y[n-2]-x[n]+x[n-1]}{2}$$&#xA;change n to n-1&#xA;$$t[n-1]=\frac{y[n-1]+y[n-3]-x[n-1]+x[n-2]}{2}$$&#xA;replace $t[n]$ and $t[n-1]$ in (*)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n-1]+y[n-2]=-\frac{y[n-1]+y[n-3]-x[n-1]+x[n-2]}{2}+\frac{y[n]+y[n-2]-x[n]+x[n-1]}{2}$$&#xA;simplify....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can use Z transform as above which gives a more compact solution.&lt;/p&gt;&#xA;" OwnerUserId="14993" LastEditorUserId="14993" LastEditDate="2015-03-31T22:33:39.833" LastActivityDate="2015-03-31T22:33:39.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22437" PostTypeId="2" ParentId="17142" CreationDate="2015-03-30T14:18:59.860" Score="1" Body="&lt;p&gt;If your the unknown signal $x(n)$ is modeled as:&#xA;$$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$&#xA;and you want to estimate $A$,$f$,and $\phi$ accurately, you can use least square estimation. Unfortunately the cost function is nonlinear. You can use nonlinear least square in MATLAB to find the parameters as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make a cost function: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f=@(A,f,phi) x[n]-A sin(2*pi*  f *n+ phi)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p0=[A0,f0,phi0];&#xA;&#xA;p = lsqnonlin(f,p0);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to find the unknown parameters.&#xA;Note that the optimizer will have a hard time finding $f$ as the problem is not convex. So it is best if you can give an initial estimate of frequency by using a method like fft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency is known then the problem can be converted to a linear estimation as:&#xA;$$x(n)=A \sin(2 \pi f n+ \phi)+w(n)$$&#xA;$$=A \sin(2 \pi f n) \cos (\phi) +A \cos(2 \pi f n) \sin (\phi)+w(n)$$&#xA;$$=p_1 S[n] +p_2 C[n]+w(n),$$&#xA;where $p_1=A \cos(\phi)$ and $p_2=A \sin(\phi)$ are unknown parameters, and $S[n]$ and $C[n]$ are known.&lt;/p&gt;&#xA;" OwnerUserId="14993" LastEditorUserId="8202" LastEditDate="2015-03-30T15:38:14.493" LastActivityDate="2015-03-30T15:38:14.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22438" PostTypeId="2" ParentId="22261" CreationDate="2015-03-30T14:39:30.557" Score="2" Body="&lt;p&gt;You can find what you need &lt;a href=&quot;http://www.alphamatting.com/eval_25.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; where a comparaison of lot of matting algorithms is done. You can see the rank of those algorithms' performances as well as online demonstration on a natural and complicated image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that study, you can guess that &lt;strong&gt;&lt;em&gt;&lt;a href=&quot;http://msr-waypoint.com/pubs/147302/HeEtAl.pdf&quot; rel=&quot;nofollow&quot;&gt;A Global Sampling Method for Alpha&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt; Matting is the best algorithm to resolve your problem. The algorithm is conceived by A Global Sampling Method for Alpha Matting&#xA;Kaiming He, Christoph Rhemann, Carsten Rother, Xiaoou Tang and Jian Su.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Begueradj.&lt;/p&gt;&#xA;" OwnerDisplayName="user15248" LastActivityDate="2015-03-30T14:39:30.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22439" PostTypeId="2" ParentId="22433" CreationDate="2015-03-30T16:38:05.057" Score="3" Body="&lt;p&gt;I prefer to solve such problems using the $\mathcal{Z}$-transform. First, write down the time domain equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\tag{1}&#xA;y[n]&amp;amp;=r[n]+x[n]\\&#xA;r[n]&amp;amp;=r[n-1]+t[n]+t[n-1]\\&#xA;t[n]&amp;amp;=t[n-1]+y[n-1]+y[n-2]&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the $\mathcal{Z}$-transform of these equations gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\tag{2}&#xA;Y(z)&amp;amp;=R(z)+X(z)\\&#xA;R(z)&amp;amp;=z^{-1}R(z)+T(z)+z^{-1}T(z)\\&#xA;T(z)&amp;amp;=z^{-1}T(z)+z^{-1}Y(z)+z^{-2}Y(z)&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After simplification you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;R(z)&amp;amp;=T(z)\frac{1+z^{-1}}{1-z^{-1}}\\&#xA;T(z)&amp;amp;=Y(z)z^{-1}\frac{1+z^{-1}}{1-z^{-1}}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R(z)=Y(z)z^{-1}\frac{(1+z^{-1})^2}{(1-z^{-1})^2}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;follows.&#xA;Plugging (3) into the first equation of (2) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=Y(z)z^{-1}\frac{(1+z^{-1})^2}{(1-z^{-1})^2}+X(z)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which you finally obtain afters some algebra&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y(z)}{X(z)}=\frac{(1-z^{-1})^2}{1-3z^{-1}-z^{-2}-z^{-3}}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the time domain, Eq. (5) is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]-3y[n-1]-y[n-2]-y[n-3]=x[n]-2x[n-1]+x[n-2]\tag{6}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-03-31T19:11:02.697" LastActivityDate="2015-03-31T19:11:02.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22440" PostTypeId="1" CreationDate="2015-03-30T18:17:45.503" Score="0" ViewCount="819" Body="&lt;p&gt;I have a problem with Support Vector Machine classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two classes of children (boys and girls). I use a MFCC function for training (for each class I have 24 coefficients, number of frames ). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to create a test text file for testing my Libsvm classification, but I don't know how to reduce the MFCC matrices to a single vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is my source code with my attempt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; class(1).list=['M01';'M02';'M03';'M04';'M05';'M06';'M07';'M08';'M09';'M10';'M11';'M12'];&#xA;      class(2).list=['W01';'W02';'W03';'W04';'W05';'W06';'W07';'W08';'W09';'W10';'W11';'W12'];&#xA;     repertoire='./data/Pure/';&#xA;          frame = 1024;&#xA;        hamwin=hamming(frame); &#xA;             X1 =[];&#xA;            X2 =[];&#xA;&#xA;                 disp('Phase d apprentissage')&#xA;&#xA;            X2=[];&#xA;           %calclul des coefficients mfcc &#xA;           k=1;&#xA;          for l=1:2&#xA;        numer=class(k).list(l,: );&#xA;            nomfichier=[repertoire numer]&#xA;          [y,fs] = wavread(nomfichier);&#xA;         for i=1:frame:length(y)-frame % 50%&#xA;&#xA;           s=y(i:i+frame-1).*hamwin;&#xA;          rand('state',1);&#xA;           X1= mfcc(y,fs,24);&#xA;         X2=[X2 X1];&#xA;            fid = fopen('APPRE.txt','w');&#xA;             fprintf (fid,'1 %i\t %i\t %i\t %i\t %i\t %i\t %i\t %i\t %i\t %i\t %i\t %i\n',X2');&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15252" LastEditorUserId="15252" LastEditDate="2015-03-30T19:00:58.190" LastActivityDate="2015-03-30T19:00:58.190" Title="Classification SVM" Tags="|matlab|signal-analysis|mfcc|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22442" PostTypeId="1" CreationDate="2015-03-31T03:51:08.440" Score="8" ViewCount="16155" Body="&lt;p&gt;Using &lt;code&gt;ffmpeg&lt;/code&gt;, I'm recording a talk, its audio with a semi-distant microphone. It makes sense to somewhat enhance the speech clarity, reduce background static and environmental noise, etc., in the most generic terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What combination of &lt;a href=&quot;https://ffmpeg.org/ffmpeg-filters.html#Audio-Filters&quot; rel=&quot;noreferrer&quot;&gt;ffmpeg audio filters&lt;/a&gt; am I best advised to use to enhance recorded speech?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;highpass-frequency=300,&#xA;lowpass-frequency=4000,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as &lt;a href=&quot;http://en.wikipedia.org/wiki/Voice_frequency&quot; rel=&quot;noreferrer&quot;&gt;that is the range speaking voice is most prominent in&lt;/a&gt;,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bass=frequency=100:gain=-50,&#xA;bandreject=frequency=200:width_type=h:width=200,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to additionally attenuate the bass frequencies, and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;compand=attacks=.05:decays=.05:points=-90/-90 -70/-90 -15/-15 0/-10:soft-knee=6:volume=-70:gain=10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to apply &lt;a href=&quot;https://ffmpeg.org/ffmpeg-filters.html#compand&quot; rel=&quot;noreferrer&quot;&gt;dynamic range compression&lt;/a&gt; and supposedly make the softer passages (above -70dB) louder and the louder ones more even.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand digital filters are not magic, but I'm looking for something more from &lt;a href=&quot;https://ffmpeg.org/ffmpeg-filters.html&quot; rel=&quot;noreferrer&quot;&gt;ffmpeg's&lt;/a&gt; (or &lt;a href=&quot;http://www.ladspa.org/&quot; rel=&quot;noreferrer&quot;&gt;LADSPA&lt;/a&gt;'s) repertoire to enhance the sound more, make it more resilient to noise, sporadic coughs, &lt;strong&gt;perhaps lose the acquired metallic aftersound&lt;/strong&gt; ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Linux command line I'm using to test:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filters='&#xA;...above filter lines, in sequence...&#xA;'&#xA;&#xA;arecord -q -r 11025 -f s32_le -c 1 -t wav - |&#xA;    ffmpeg -f wav -i - -af &quot;$filters&quot; -f wav - |&#xA;    aplay&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1754" LastEditorUserId="1754" LastEditDate="2015-04-08T20:27:44.837" LastActivityDate="2020-12-27T17:37:05.950" Title="FFmpeg audio filter pipeline for speech enhancement" Tags="|filters|speech|voice|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22443" PostTypeId="1" CreationDate="2015-03-31T04:49:26.940" Score="1" ViewCount="181" Body="&lt;p&gt;I am completely stuck on solving some problems for my digital communications class. Junior level undergrad class, so fairly basic. I have been searching around all day for related articles etc but can't seem to find any that are helpful. Any help would be much appreciated. &lt;a href=&quot;http://prntscr.com/6njdcj&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here are the three questions&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8cfut.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/icqNd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the coefficients my initial hunch is just to make c2 and c3 = 0, which would leave $\hat{y}[1] = y[1]$. My other attempt is to create a system of equations so the $x[2]$ terms are cancelled and the $x[1]$ terms are the only ones left over, but this system proves difficult to me and I am left with a mess of noise. For some reason I can only get two equations with three unknowns. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_3= -3 c_2 \\&#xA;c_1 + \frac13  c_2 + \frac14 c_3 = 1$$&#xA;  where $c_1,c_2,c_3$ are constants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for my terrible formatting. I believe I completed the first question correctly, here was my process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qk7rx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving on to question 2, for part A I'm fairly sure it is what I was attempting to do before so I got c3=-3 * c2 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;for part b, I am stuck again because my brain keeps going back to the idea that I should just make c2 and c3 both 0, because it appears to me our goal is to make x&lt;a href=&quot;https://i.stack.imgur.com/8cfut.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; recoverable.&lt;/p&gt;&#xA;" OwnerUserId="15257" LastEditorUserId="15257" LastEditDate="2015-03-31T07:43:58.310" LastActivityDate="2015-03-31T07:43:58.310" Title="Basic “filtering” in digital communications" Tags="|filters|filter-design|digital-communications|linear-systems|digital-filters|" AnswerCount="0" CommentCount="9" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22444" PostTypeId="1" AcceptedAnswerId="22448" CreationDate="2015-03-31T07:07:23.620" Score="0" ViewCount="614" Body="&lt;p&gt;I'm trying to optimize an image reconstruction algorithm using genetic algorithm.I took initial population size as 10.I have an input image an 10 reconstructed image.fitness function is the difference between these two.That is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fitness_1 = inputimage - reconstructedimage_1;&#xA;fitness_2 = inputimage - reconstructedimage_2;&#xA;              :&#xA;              :&#xA;fitness_10 = inputimage - reconstructedimage_10;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to chose the best fitness population among them.But my fitness result is an image(matrix with intensity values).So how can I get a single fitness value for each population for doing crossover in the next stage.&#xA;Please help.Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="10965" LastActivityDate="2015-03-31T11:58:42.117" Title="optimization of Image Reconstruction Algorithm using Genetic Algorithm in Matlab" Tags="|image-processing|matlab|reconstruction|superresolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22446" PostTypeId="1" CreationDate="2015-03-31T09:55:13.143" Score="-1" ViewCount="470" Body="&lt;p&gt;Why the frequency of carrier wave is always kept at least $10$ times higher than the highest frequency of base band signal? Can you explain me this with a practical example?&lt;/p&gt;&#xA;" OwnerUserId="15259" LastEditorUserId="7092" LastEditDate="2015-03-31T21:00:26.437" LastActivityDate="2015-03-31T21:00:26.437" Title="Question related to Principle of Communication" Tags="|digital-communications|modulation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22448" PostTypeId="2" ParentId="22444" CreationDate="2015-03-31T11:53:03.263" Score="2" Body="&lt;p&gt;One simple approach would be taking the mean square error (MSE) by using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fitness_1 = mean((inputimage(:) - reconstructedimage_1(:)).^2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;though, as your image size won't change, you can ommit the mean and use &lt;code&gt;sum&lt;/code&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fitness_1 = sum((inputimage(:) - reconstructedimage_1(:)).^2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In general you want to have some kind of distance measure. Look at &lt;a href=&quot;http://en.wikipedia.org/wiki/Distance&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; (especially at &lt;a href=&quot;http://en.wikipedia.org/wiki/Distance#Other_.22distances.22&quot; rel=&quot;nofollow&quot;&gt;Other distances&lt;/a&gt;) for more sophisticated approaches.&lt;/p&gt;&#xA;" OwnerUserId="4932" LastEditorUserId="4932" LastEditDate="2015-03-31T11:58:42.117" LastActivityDate="2015-03-31T11:58:42.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22450" PostTypeId="2" ParentId="22446" CreationDate="2015-03-31T14:52:25.643" Score="0" Body="&lt;p&gt;There is no hard &quot;10 times&quot; rule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, depending on the communication medium, there may be problems when a carrier is modulated with a signal of too high a frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little animation of amplitude modulation on &lt;a href=&quot;http://en.wikipedia.org/wiki/Amplitude_modulation#/media/File:Am2_spec.gif&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; illustrates this.  The red line is the original carrier.  The blue wave is the signal, and the green lines are the side-bands produced by modulating the carrier with the signal.  Notice how the side bands move outwards in frequency as the signal frequency increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In radio communications, modulating with too high a frequency could cause two problems:-&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Interference with other people's signals on nearby frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Difficulty in producing a tuned circuit that can accept the whole of the resulting frequency range.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-03-31T14:52:25.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22451" PostTypeId="1" AcceptedAnswerId="22457" CreationDate="2015-03-31T15:28:47.660" Score="1" ViewCount="234" Body="&lt;p&gt;Practically speaking, if one is interested in a frequency band well-separated from the line noise (say, for example, the 10-20 Hz band, with 60 Hz line noise), would it be advisable to notch out this line noise before bandpass filtering to the desired frequency range? It seems that, given of course an acceptable filter rolloff, it would be better not to perform an additional filtering step if it were not necessary; however, I'm wondering whether this may lead to some unforeseen problem.&lt;/p&gt;&#xA;" OwnerUserId="15264" LastActivityDate="2015-03-31T16:49:53.277" Title="Notch filtering line noise outside of frequency band of interest" Tags="|noise|filtering|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22452" PostTypeId="1" AcceptedAnswerId="22500" CreationDate="2015-03-31T15:33:15.950" Score="0" ViewCount="383" Body="&lt;p&gt;I was tasked with designing a filter to smooth out a translating table. The system, we command a speed and a desired position, and measure it with two noisy position sensors. The commanded speed is also not always perfect, but it's usually within 10%. The slide can only move left and right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial thought was to simply use a moving average (via circular buffer), and grow / shrink the array based on the speed. For high speeds, I would have a smaller array (10 or so measurements), and for lower speeds, I would have a large array (maybe 40 measurements). When stopped, I would have it grow to 100 or so. The reason for this is to decrease the phase offset at high speeds where resolution is not as important, and decrease the noise at lower speeds, when accuracy is more important. However, this doesn't &lt;em&gt;really&lt;/em&gt; take into account the speed, so I feel like I'm throwing away useful information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I'm figuring there has to be a better way. Any thoughts on how I would approach this problem more elegantly?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just so we're on the same page, &quot;high speed&quot; is only about 3 inches per second, and I am sampling at 20Hz (but each time, I get two measurements). There is a ramp up/ ramp down portion of the translation such that whenever the table approaches the desired position, it slows to a crawl of 0.5 inches per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="11719" LastEditorUserId="11719" LastEditDate="2015-03-31T15:41:18.250" LastActivityDate="2015-04-02T21:47:59.860" Title="1D filter for speed input and noisy position sensor" Tags="|filters|filter-design|noise|denoising|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22453" PostTypeId="2" ParentId="22446" CreationDate="2015-03-31T15:48:20.423" Score="1" Body="&lt;p&gt;Assuming your baseband signal $b(t)$ has bandwidth $B$ and the carrier frequency is $f_c$, the upconverted signal $$s(t)=b(t)\cos(2\pi f_ct)$$ has bandwidth $2B$, extending from $f_c-B$ to $f_c+B$. You need $f_c-B&amp;gt;0$, which implies $f_c&amp;gt;B$. Theoretically, this is the only rule you need to make sure to follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some specific receivers may need a higher $f_c$; for example, a simple envelope detector for amplitude demodulation will work better (and be easier to design) if you use a higher $f_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, some textbooks assume $f_c&amp;gt;&amp;gt;B$ because that allows for some mathematical simplifications, such as assuming two up-converted pulses are orthogonal when they are not quite so.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-31T15:48:20.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22457" PostTypeId="2" ParentId="22451" CreationDate="2015-03-31T16:49:53.277" Score="1" Body="&lt;p&gt;A general rule of thumb is to filter as little as necessary, because every filter distorts your desired signal, even if just a little bit. Also: a notch filter is advised in a situation where narrow-band interference is present within your signal's band. The notch filter will reject the interference while having minimal effect (ideally) in your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the problem you describe, my preferred approach would be to go with a low-pass filter only, and increase its order to achieve sufficient rejection of the 60 Hz noise.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-03-31T16:49:53.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22458" PostTypeId="2" ParentId="22432" CreationDate="2015-03-31T19:01:06.127" Score="0" Body="&lt;p&gt;FFT hands on this job. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate FFT&lt;/li&gt;&#xA;&lt;li&gt;Find Magnitude response (abs)&lt;/li&gt;&#xA;&lt;li&gt;Find peaks (local maximum)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The peaks will be $A_1$ and $A_2$.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-03-31T19:01:06.127" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22459" PostTypeId="1" CreationDate="2015-03-31T19:17:00.270" Score="0" ViewCount="94" Body="&lt;p&gt;In the figure below, from the book &quot;Principles of Linear Systems and Signals - Lathi&quot;, the author uses the notation D to replace the Leibniz's notation $d/dt$, and after that he rewrites the equation, disconnecting the symbol of the derivative, $D$, of its function, considering each as a factor. I don't understand how he did that. Is that mathematically possible? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fiC4x.png&quot; alt=&quot;derivative&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user15266" LastEditorDisplayName="user15266" LastEditDate="2015-03-31T21:13:13.743" LastActivityDate="2015-05-31T13:03:02.113" Title="Derivative Notation as a factor" Tags="|signal-analysis|linear-systems|derivative|notation|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22460" PostTypeId="1" AcceptedAnswerId="22461" CreationDate="2015-03-31T19:28:43.210" Score="0" ViewCount="2073" Body="&lt;p&gt;I am trying to extract amplitude of specific frequency in Matlab FFT. Is it possible to use the &lt;code&gt;abs(mag)&lt;/code&gt;... But I do not know in which sample to look for &lt;code&gt;mag(245)&lt;/code&gt; should give me amplitude for the frequency of that sample...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to extract that amplitude-magnitude for $120$ Hz using &lt;code&gt;mag&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will add simple code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;                    % Sampling frequency&#xA;T = 1/Fs;                     % Sample time&#xA;L = 1000;                     % Length of signal&#xA;t = (0:L-1)*T;                % Time vector&#xA;% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid&#xA;x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); &#xA;y = x + 2*randn(size(t));     % Sinusoids plus noise&#xA;f=(0:L-1)*Fs/L;&#xA;x=fft(y);&#xA;mag=abs(x);&#xA;mag(1)=0;&#xA;plot(f(1:L/2),(2/L*mag(1:L/2)));&#xA;title('Single-Sided Amplitude Spectrum of y(t)')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|Y(f)|')  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Mxmkj.jpg&quot; alt=&quot;FFT OF THE CODE&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11432" LastEditorUserId="7092" LastEditDate="2015-03-31T21:03:27.060" LastActivityDate="2015-04-01T06:52:43.540" Title="Amplitude of frequency in MATLAB FFT" Tags="|matlab|fft|amplitude|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22461" PostTypeId="2" ParentId="22460" CreationDate="2015-03-31T21:37:56.817" Score="1" Body="&lt;p&gt;The formula you are looking for is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(desired freq / Sampling Frequency) * Length of samples = sample number&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;you can see this works out even by verifying the units&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(Hz / Hz )* sample = sample&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;depending on your exact frequencies, the result may or may not be an integer number. If it is not an integer, that means the exact frequency wasn't captured (due to Fs). For example if your result was 23.8 you would have to look at either sample 23 or sample 24 to get the data you required, or do some sort of interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;as your comment specified, this doesn't work exactly, the reason is becasue matlab does 1 indexing, not 0 indexing. So our DC component 0Hz is at element 1, not element 0 but the above formulas are correct. However implementing in matlab is a little different&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;desired_freq = 120; %Hz&#xA;desired_index = (desired_freq / Fs) * L + 1; %+1 is because matlab uses 1 indexing not 0 indexing&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;again desired index may not be an integer number so you can't simply say &lt;code&gt;mag(desired_index)&lt;/code&gt; one workaround would be &lt;code&gt;mag(round(desired_index))&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-03-31T22:55:42.470" LastActivityDate="2015-03-31T22:55:42.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22462" PostTypeId="1" AcceptedAnswerId="22470" CreationDate="2015-03-31T22:25:38.303" Score="1" ViewCount="806" Body="&lt;p&gt;Let's say you had two 1 second sound samples at 44.1khz, and you wanted to convolve them in frequency space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You FFT each one to get two arrays of complex numbers that each have 44100 items in them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then multiply each bin...&#xA;for i = 0 to 44099&#xA;c[i] = A[i] * B[i]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it's time to turn it back into time domain samples.  If you do an ifft you'll get 44100 time samples out, but when you convolve these two audio samples in time space, it'll give you 88199 samples out (44100+44100-1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously getting 44100 samples out is incorrect.  At what part in the process did I go wrong? (:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!!&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-01T07:29:30.683" Title="Convolution in frequency space with fft and ifft -&gt; num output samples?" Tags="|fft|convolution|ifft|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22463" PostTypeId="1" AcceptedAnswerId="22484" CreationDate="2015-04-01T00:23:32.827" Score="0" ViewCount="2939" Body="&lt;p&gt;I wonder if anyone has any experience with auto-convolution. In particular i'm interested in understanding the physical interpretation of it. &#xA;I understand what convolution, correlation and auto-correlation are, also i'm aware that the definition of auto-convolution will be something like&#xA;$$f\ast f = \int_{-\infty}^{\infty} f(\tau)f(t-\tau)d\tau $$&#xA;but i still don't get what are the implications o the meaning of it.  I've been looking for a while and so far i haven't found any good or detailed explanation (on constrast with auto-correlation).&#xA;So, if anyone has any experience dealing with this topic or has any intuitive interpretation that could share, i'll appreciate it. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15267" LastActivityDate="2015-04-02T04:16:51.957" Title="Applications or physical interpretation of auto-convolution?" Tags="|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22465" PostTypeId="1" CreationDate="2015-04-01T03:21:09.910" Score="0" ViewCount="237" Body="&lt;p&gt;I'm a software developer and a Amateur Radio operator. Everything I know about audio (which isn't saying much) is self taught.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've learned how to generate audio samples and build wav files, send those samples to hardware output, etc. I even figured out how to generate BPSK31.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I'm stuck now is demodulation. I've read around enough to realize that this is a much harder side of the problem than modulation, and I understand intuitively why this is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Where do I even start to learn how to do this? I'm not even sure what the right terms to search for in Google are. So many of the results are hardware solutions or new theoretical approaches to the problem that I've gotten lost in the noise. What should I be looking for to figure this out?&lt;/p&gt;&#xA;" OwnerUserId="15269" LastActivityDate="2016-02-25T19:26:37.857" Title="Where do I start in learning how to demodulate a BPSK31 signal in software?" Tags="|demodulation|bpsk|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22466" PostTypeId="2" ParentId="22460" CreationDate="2015-04-01T04:51:49.753" Score="0" Body="&lt;p&gt;The answer of andrew assumes a certain structure of the array containing the frequencies. For MATLAB in general you can also use logical filters quite easily to return specific elements of a certain array. I your case it would be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mag(f == 120)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Like stated in the answer of andrew, this will return an empty array if in this case 120 would not be part of &lt;code&gt;f&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7579" LastActivityDate="2015-04-01T04:51:49.753" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22467" PostTypeId="2" ParentId="18557" CreationDate="2015-04-01T06:18:26.000" Score="0" Body="&lt;p&gt;I find this discussion intriguing and I wanted to add another viewpoint to the mix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system under consideration ( $y[n]=p⋅y[n−1] + x[n]$ ) can be thought of as a mapping from one (infinite dimensional) vector space to another. Let's call this this mapping $M$, and we can (initially) define it as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ M : \mathbb{R}^\mathbb{Z} \rightarrow \mathbb{R}^\mathbb{Z} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This terminology says that $M$ is a mapping from $\mathbb{R}^\mathbb{Z}$ (the space of all real-valued functions of an integer variable) to $\mathbb{R}^\mathbb{Z}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If system has any zeros (and the system under consideration here has a zero at $z=1$), this means that our mapping $M$ is not one-to-one, because two different input signals will lead to the same output signal. For example, for any input signal, $x[n]$, we can say that $M(x)=M(x+\lambda)$ for any real $\lambda$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The set of functions that are &quot;zeros&quot; of our system can be defined as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$K_{zeros}=\{f[n]=\lambda:\forall \lambda \in \mathbb{R}\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, we note that if our system has any poles (and the system under consideration here has a zero at $z=-1$), then this means that the inverse mapping, $M^{-1}$ is not one-to-one. Specifically, $M^{-1}(x)=M^{-1}(x+\lambda(-1)^n)$ for any real $\lambda$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The set of functions that are &quot;poles&quot; of our system can be defined as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$K_{poles}=\{f[n]=\lambda(-1)^n:\forall \lambda \in \mathbb{R}\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, $\mathbb{R}^\mathbb{Z}$ is a vector space, $K_{zeros}$ is a vector space, and $K_{poles}$ is a vector space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can now define two &lt;em&gt;quotient spaces&lt;/em&gt; (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Vector_space#Subspaces_and_quotient_spaces&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; for more information about quotient spaces):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Q_{input} = \mathbb{R}^\mathbb{Z} / K_{zeros} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Q_{output} = \mathbb{R}^\mathbb{Z} / K_{poles} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of $Q_{output}$ as being the subset of $\mathbb{R}^\mathbb{Z}$ that does not contain any signal components of the form $\lambda(-1)^n$, or alternatively, you can think of $Q_{output}$ as being identical to $\mathbb{R}^\mathbb{Z}$ with &lt;em&gt;equivalence classes&lt;/em&gt; that tell us &quot;for our current application, we will consider any function $y[n]$ to be &lt;em&gt;eqivalent&lt;/em&gt; to $y[n]+\lambda(-1)^n$ for any real $\lambda$&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By doing this, we can now redefine a new mapping $M'$ as a mapping from $Q_{input}$ to $Q_{output}$. This new mapping is really just the same as our old mapping, $M$, except we've reduced the vector-spaces on which it operates. Furthermore, this new mapping is now a bijection (it's &quot;one-to-one&quot; and &quot;onto&quot;), so it is guaranteed to also be invertible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, this mapping, $M'$ is &lt;strong&gt;linear&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the point of this whole rambling explanation is that, by defining the appropriate equivalence classes (or alternatively, by restricting our space of allowable functions to a sub-space of $\mathbb{R}^\mathbb{Z}$), we can maintain the property that our mapping should be linear (and time-invariant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the rules of &lt;strong&gt;linearity&lt;/strong&gt; tell us that, if $x[n]$ is an input signal and $\alpha$ is any real scalar, then $M(\alpha x) = \alpha M(x)$. Hence, this implies that, by setting $\alpha=0$, we should therefore expect that $M(0\times x)=y[n]=0$ (i.e. if we input the zero-signal to our filter, the output should be $y[n]=0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we know that it's possible for have a situation where the input to the filter is zero, but the output is of the form $y'[n]=(-1)^n$, so we might be tempted to say &quot;that proves our system is not linear, because $y'[n]$ is not zero&quot;. However, you will recall that the &lt;em&gt;equivalence class&lt;/em&gt; we have enforced on the output vector space says that &quot;for our current application, we will consider any function $y[n]$ to be &lt;em&gt;eqivalent&lt;/em&gt; to $y[n]+\lambda(-1)^n$ for any real $\lambda$&quot;, which means that $y'[n]=(-1)^n$ is &lt;em&gt;equivalent&lt;/em&gt; to zero!&lt;/p&gt;&#xA;" OwnerUserId="11204" LastActivityDate="2015-04-01T06:18:26.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22468" PostTypeId="2" ParentId="22460" CreationDate="2015-04-01T06:22:05.423" Score="-1" Body="&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just noticed that you have already scaled your fft output.&lt;br&gt;&#xA;Mag(121) will give you what you want.&lt;br&gt;&#xA;If you still want the amplitude to be scaled like your figure do, scale Mag(121) too.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a problem with indexing.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastEditorUserId="13507" LastEditDate="2015-04-01T06:52:43.540" LastActivityDate="2015-04-01T06:52:43.540" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22470" PostTypeId="2" ParentId="22462" CreationDate="2015-04-01T07:29:30.683" Score="1" Body="&lt;p&gt;What you do is called circular convolution but you want &quot;linear&quot; convolution: Say you have two signals of length $N$ and $M$. Append zeros to both time-domain signals, so that their length is $L=N+M-1$, then calculate the $L$-DFT of both signals, multiply them in frequency-domain and convert the result back to time-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you should append 44099 zeros to each signal before transforming it to the frequency domain. The result will then be 88199 samples long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the available FFT is shorter than 88199 you have to divide the signal into shorter blocks and apply the overlap add method.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-04-01T07:29:30.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22472" PostTypeId="1" CreationDate="2015-04-01T09:21:13.960" Score="1" ViewCount="4602" Body="&lt;p&gt;I am working on a color transformation project using video.Can any one please tell me how to read video in octave.I have see aviread can be used to video frame by frame but i want to read the entire video file.&lt;/p&gt;&#xA;" OwnerUserId="14849" LastActivityDate="2015-08-20T13:52:23.823" Title="How to read video in octave?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22473" PostTypeId="1" CreationDate="2015-04-01T10:57:57.297" Score="11" ViewCount="6918" Body="&lt;p&gt;I am trying to understand the difference(s) between OFDM (Orthogonal Frequency Division Multiplexing) and GFDM (Generalized Frequency Division Multiplexing) which are used as a multicarrier modulation techniques in wireless communication. As far as I know the OFDM uses the orthogonal subcarriers and the GFDM is with the non-orthogonal subcarriers when designing a transmitter. The GFDM is possibly going to be the modulation technique for 5G systems as it has been discussed in a research area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please explain further about GFDM design and its differences from OFDM?&#xA;What is the purpose of using GFDM when designing a transmitter? The subcarriers are created just after the IFFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In GFDM, how does the IFFT block work when creating the subcarriers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about the subcarrier pulse shaping in GFDM?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in Advance!&lt;/p&gt;&#xA;" OwnerUserId="9014" LastEditorUserId="1606" LastEditDate="2015-04-01T15:26:17.680" LastActivityDate="2021-11-04T12:21:17.020" Title="What is difference between OFDM and GFDM?" Tags="|digital-communications|ofdm|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22475" PostTypeId="2" ParentId="22459" CreationDate="2015-04-01T11:14:43.500" Score="1" Body="&lt;p&gt;As stated in the text, it's called &lt;em&gt;operational notation&lt;/em&gt;, i.e. $D$ is an operator being applied to a continuous-time signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D^mx(t)=\frac{d^mx(t)}{dt^m}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In discrete time you have the operator $T$, defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T^mx[n]=x[n+m]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(see e.g. &lt;a href=&quot;https://books.google.nl/books?id=uHs7gpNKqTEC&amp;amp;pg=PA499&amp;amp;lpg=PA499&amp;amp;dq=%22operational+notation%22+laplace&amp;amp;source=bl&amp;amp;ots=UJKodSOPLW&amp;amp;sig=l2jKC7n0r2iU9csc6TfYAAHU6Bs&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=ps4bVdeHMYO1OoykgYgM&amp;amp;ved=0CCIQ6AEwAA#v=onepage&amp;amp;q=operational&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is often done by people is that they use the complex Laplace transform variable $s$ instead of $D$, or the $\mathcal{Z}$-transform variable $z$ instead of $T$. This is what Robert Bristow-Johnson referred to in his comment as 'sloppy abuse of notation'. I would even go further and would call it simply wrong. The use of different letters for $D$ and $T$ may seem an unimportant triviality, but the real problem here is that you mix different domains (Laplace/$\mathcal{Z}$ transform domain and time domain), which can be a great source of misunderstandings and errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I personally do not see a great advantage in the use of this type of operational notation for engineering applications. It rather makes things more confusing for beginners because they have a tendency to mix domains anyway, and operational notation seems to suggest that this is legitimate.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-01T11:14:43.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22476" PostTypeId="2" ParentId="22412" CreationDate="2015-04-01T11:15:58.940" Score="0" Body="&lt;p&gt;If you have some knowledge of how the noise behaves (e.g. you have vertical streaks in your image typically, rather than salt and pepper noise), you can adjust the pixel weights so that you prefer to use pixels to the sides of the pixel being filtered more than those above and below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the image as well, you can also reduce the influence of pixels farther from the center of the window. This can be useful in things like imagers where if you have pixels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 2 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 5 6&lt;/p&gt;&#xA;&#xA;&lt;p&gt;7 8 9&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and each pixel represents say a 10 x 10 meter square, you may want to weight pixels 1,3,7,9 lower than 2,4,6,8 since they are farther from the area imaged in pixel 5. In this case, if there are vertical streaks, you'd weight down pixels 2 and 8.&lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-04-01T11:15:58.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22477" PostTypeId="1" CreationDate="2015-04-01T11:58:36.173" Score="-1" ViewCount="1465" Body="&lt;p&gt;I have an EEG labeled data, which is the data that used for training, And I want to segment those data based on the time of EEG signal (&lt;strong&gt;Time-based Epoching&lt;/strong&gt;) as a preprocessing step,  based on the nature of EEG signals which is best:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;To segment the data based on time domain, for example to take each 64 samples together.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using the windowing functions like gaussian and hamming window. also if the best was this one,is it better to make the windows overlapped or not?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15174" LastEditorUserId="15174" LastEditDate="2015-04-03T09:22:41.647" LastActivityDate="2022-02-19T18:06:15.613" Title="segmenting an EEG data" Tags="|window-functions|eeg|segmentation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22479" PostTypeId="2" ParentId="22465" CreationDate="2015-04-01T13:57:07.303" Score="1" Body="&lt;p&gt;This system uses phase shifts to encode characters (it is a differential encoding scheme). You need to design a system that can detect the phase changes, and that is able to synchronize, that is, find the start of a character. Your receiver must also be able to recover from ocassional errors in the phase change detection. Your question is where to start to learn how to do this; my answer is, read the book linked at the end of this page: &lt;a href=&quot;http://sethares.engr.wisc.edu/telebreak.html&quot; rel=&quot;nofollow&quot;&gt;http://sethares.engr.wisc.edu/telebreak.html&lt;/a&gt;. This book doesn't cover this specific modulation but you can learn everything you need from it.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-04-01T13:57:07.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22480" PostTypeId="1" CreationDate="2015-04-01T15:42:09.153" Score="1" ViewCount="70" Body="&lt;p&gt;Can you advise me on good inhomogenity measurements in an image?&#xA;I am trying to find the borders where homogenous zones touch inhomogenous ones in a image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going to work with sick lung ct images like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6x7eU.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for different ways to measure inhomogenity in the texture in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="5418" LastEditorUserId="5418" LastEditDate="2015-04-03T12:48:17.980" LastActivityDate="2015-04-03T15:29:02.727" Title="Good inhomogenity measures in images?" Tags="|image-processing|image-segmentation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22481" PostTypeId="1" CreationDate="2015-04-01T19:39:00.520" Score="1" ViewCount="333" Body="&lt;p&gt;I was just wondering if there were any &quot;obvious&quot; resources, papers, or textbooks I should look into regarding the nyquist-criterion in higher dimensions. For example, this would be relevant if there is some curve that is i.e. not 1-to-1 w.r.t. time: $f: t \in \mathbb{R}^1 \rightarrow f(t) \in \mathbb{R}^1 $, but instead for some other parameterization, we have a line $l: u \in \mathbb{R}^1 \rightarrow l(u) = \big(\tilde t(u),\tilde f(u)\big) \in \mathbb{R}^2$, it is 1-to-1, but &lt;em&gt;not onto&lt;/em&gt;, as $(\tilde t,\tilde f)$ is on a 1-dimensional manifold (a line) in a 2-D plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I'd like to know what sampling scheme I need to be able to recreate the curve through reconstruction. Using this approach, you could use nyquist's theorem for general spatial surfaces and manifolds as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be a math question, so I can migrate this. But I figured some experts on this sub-stack might know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: several small edits for clarity/correctness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: Fixed parameterization!!! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 3: I want to emphasize that although I am parameterizing by $t$, it may be more useful to think of $t$ as a spatial dimension, since time can only move forward.&lt;/p&gt;&#xA;" OwnerUserId="8982" LastEditorUserId="8982" LastEditDate="2015-04-01T23:31:30.967" LastActivityDate="2015-04-01T23:31:30.967" Title="Nyquist Criterion in higher dimensions" Tags="|sampling|nyquist|spatial|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22482" PostTypeId="2" ParentId="22481" CreationDate="2015-04-01T20:38:16.663" Score="1" Body="&lt;p&gt;i do not have a reference for you, but you are sampling among every one of the dimensions and the Nyquist Criterion must be satisfied for each one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so fix $v$ to an arbitrary value $v_0$, then check if $\tilde{f}(u,v_0)$ is bandlimited some bandlimit, we'll call $B_u$.  find the max value of $B_u$ for all possible $v_0$, double that and that is the minimum sample rate along the $u$-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then swap the roles of $u$ and $v$, fix $u$ to $u_0$, find the bandlimit of $\tilde{f}(u_0,v)$ for every possible value of $u_0$.  find the maximum (over all $u_0$) bandlimit $B_v$, double that and that is the minimum-sample rate along the $v$-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if your curve can move at an arbitrary angle w.r.t. the $u$-axis and $v$-axis, then pick the maximum of $B_u$ and $B_v$ and sample both axes at double of that rate (or slightly higher).  then, along the path length, you must sample at a minimum of that rate, per unit of arc length, to satisfy Nyquist in two dimensions.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-01T20:38:16.663" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22484" PostTypeId="2" ParentId="22463" CreationDate="2015-04-01T22:08:44.713" Score="1" Body="&lt;p&gt;Autoconvolution is used in signal detection, but the way you've written it is not correct. Suppose you're trying to detect a signal $f(t)$ by filtering with h(t).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = f(t) \ast h(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to maximize your response to the signal $f(t)$. We can do this by maximizing the correlation coefficient between $f$ and $h$. Here the correlation is time-varying , so we'll maximize the &lt;em&gt;average&lt;/em&gt; autocorrelation coefficient. We'll assume the $f$ and $h$ signals have DC values of zero for simplicity.I'll use $\mu_y$ to denote average value of a the auto-correlation of response, $y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ h = argmax_{h} \ \   \mu_y\big(E_f E_h \big)^{-\frac{1}{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take a differential of our performance $ J \propto \mu_y\big(E_f E_h \big)^{-\frac{1}{2}}$ with respect to h&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\partial_{h(\tau)} J \propto \partial_{h(\tau)} \bigg((\mu_y\big(E_f E_h \big)^{-\frac{1}{2}}\bigg)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \ \ \ \ \ \ \ \  =  \frac{1}{|dom(f)|}\bigg(\partial_{h(\tau)}\mu_y\bigg)\big(E_fE_h)^{-\frac{1}{2}} +\frac{1}{2}\mu_yE_f^{-\frac{1}{2}}E_h^{-\frac{3}{2}}\bigg(\partial_{h(\tau)}E_h\bigg)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \ \ \ \ \ \ \ \  \propto  \bigg(\partial_{h(\tau)}\frac{1}{|dom(f)|}\int_{\infty}^{\infty}f(t-\tau)h(\tau)d\tau \bigg)\big(E_fE_h\big)^{-\frac{1}{2}} +\frac{1}{2}\mu_yE_f^{-\frac{1}{2}}E_h^{-\frac{3}{2}}\bigg(\partial_{h(\tau)}E_h\bigg)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \ \ \ \ \ \ \ \  =  \bigg(\frac{1}{|dom(f)|}\int_{\infty}^{\infty} f(t-\tau)d\tau \bigg)\big(E_fE_h\big)^{-\frac{1}{2}} -\frac{1}{2}\mu_yE_f^{-\frac{1}{2}}E_h^{-\frac{3}{2}}\bigg(\partial_{h(\tau)}E_h\bigg)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \ \ \ \ \ \ \ \  =  \big(E_fE_h\big)^{-\frac{1}{2}} \frac{1}{|dom(f)|}\int_{\infty}^{\infty} f(t-\tau)d\tau-\frac{1}{2}\mu_yE_f^{-\frac{1}{2}}E_h^{-\frac{3}{2}}\bigg(\partial_{h(\tau)}\int_{\infty}^{\infty} h^2(\tau)d\tau \bigg)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \ \ \ \ \ \ \ \  =  \frac{1}{|dom(f)|}\big(E_fE_h\big)^{-\frac{1}{2}} \int_{\infty}^{\infty} f(t-\tau)d\tau-\mu_yE_f^{-\frac{1}{2}}E_h^{-\frac{3}{2}}\int_{\infty}^{\infty} h(\tau)d\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \ \ \ \ \ \ \ \  \propto  \frac{1}{|dom(f)|}\int_{\infty}^{\infty} f(t-\tau)d\tau-\mu_yE_h^{-1}\int_{\infty}^{\infty} h(\tau)d\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\ \ \ \ \ \ \ \ \  = \int_{\infty}^{\infty} \bigg(\frac{1}{|dom(f)|}f(t-\tau)-h(\tau)\mu_yE_h^{-1}\bigg)d\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At minimum $J$ we shouldn't assume $h(\tau) = 0$, we'll enforce $$\frac{1}{|dom(f)|}f(t-\tau)-h(\tau)\mu_yE_h^{-1} = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and pretty readily you get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(\tau) = \frac{E_h}{\mu_y|dom(f)|}f(t-\tau)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or most importantly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(\tau) \propto f(t-\tau) \text{where} \ \ \tau \ \ \text{is time and} \ \ t \ \ \text{is the delay}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or, using perhaps better &quot;variable names&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t) \propto f(t_d-t) \text{where} \ \ t \ \ \text{is time and} \ \ t_d \ \ \text{is the delay}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, if we want to maximize the correlation between our signal detector with impulse h(t), we better pick h(t) to be a time-reversed and time-shifted version of our signal of interest. In practice $t_d$ would probably be set to zero, as it just represents whenever the $f$ part that you're looking for finally arrives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under this chosen $h(t) \propto f(t_d - t)$, your original question makes more sense. The autocorrelation signal becomes proportional to the accumulated energy of $f(t)$ that is seen by your filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = f(t) \ast h(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) \propto \int f(\tau) h(t-\tau)d\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \int f(\tau) f(t_d-(t+\tau))d\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \int f(\tau) f(\tau + t_d - t)d\tau$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \int P_f(\tau + t_d - t)d\tau$&lt;/p&gt;&#xA;" OwnerUserId="8982" LastEditorUserId="8982" LastEditDate="2015-04-02T04:16:51.957" LastActivityDate="2015-04-02T04:16:51.957" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22486" PostTypeId="2" ParentId="21745" CreationDate="2015-04-02T08:36:49.690" Score="0" Body="&lt;p&gt;First, you might be looking for a FIR filter (2d convolution)? If that's the case, you gave the answer yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're actually looking for an IIR filter, then I'd like to ask for the desired order.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2015-04-02T08:36:49.690" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22487" PostTypeId="1" CreationDate="2015-04-02T08:43:34.747" Score="0" ViewCount="961" Body="&lt;p&gt;I have a problem ragarding transferring a point cloud to a 2.5D metric grayscale image (gray value gives depth information). I start with a three channel image of 32bit floats with each pixel representing the three coordinates in mm (metric).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Halcon is the preferred library, but not necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that someone can help me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Greetings from Stuttgart, Germany&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Max &lt;/p&gt;&#xA;" OwnerUserId="15287" LastEditorUserId="7338" LastEditDate="2017-09-11T21:30:44.537" LastActivityDate="2022-05-19T12:02:45.280" Title="3D point cloud to 2.5D graycale image (metric) [Halcon?]" Tags="|image-processing|computer-vision|3d|point-cloud|geometry|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22488" PostTypeId="1" AcceptedAnswerId="29139" CreationDate="2015-04-02T09:58:56.797" Score="0" ViewCount="597" Body="&lt;p&gt;I was reading a &lt;a href=&quot;http://cvcl.mit.edu/Papers/IJCV01-Oliva-Torralba.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper about Gist features&lt;/a&gt;. I was interested about its code implementation &lt;a href=&quot;http://people.csail.mit.edu/torralba/code/spatialenvelope/&quot; rel=&quot;nofollow noreferrer&quot;&gt;which i found it here&lt;/a&gt;). Into LMgist.m there is a function called createGabor, this is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function G = createGabor(or, n)&#xA;%&#xA;% G = createGabor(numberOfOrientationsPerScale, n);&#xA;%&#xA;% Precomputes filter transfer functions. All computations are done on the&#xA;% Fourier domain. &#xA;%&#xA;% If you call this function without output arguments it will show the&#xA;% tiling of the Fourier domain.&#xA;%&#xA;% Input&#xA;%     numberOfOrientationsPerScale = vector that contains the number of&#xA;%                                orientations at each scale (from HF to BF)&#xA;%     n = imagesize = [nrows ncols] &#xA;%&#xA;% output&#xA;%     G = transfer functions for a jet of gabor filters&#xA;&#xA;&#xA;Nscales = length(or);&#xA;Nfilters = sum(or);&#xA;&#xA;if length(n) == 1&#xA;    n = [n(1) n(1)];&#xA;end&#xA;&#xA;l=0;&#xA;for i=1:Nscales&#xA;    for j=1:or(i)&#xA;        l=l+1;&#xA;        param(l,:)=[.35 .3/(1.85^(i-1)) 16*or(i)^2/32^2 pi/(or(i))*(j-1)];&#xA;    end&#xA;end&#xA;&#xA;% Frequencies:&#xA;%[fx, fy] = meshgrid(-n/2:n/2-1);&#xA;[fx, fy] = meshgrid(-n(2)/2:n(2)/2-1, -n(1)/2:n(1)/2-1);&#xA;fr = fftshift(sqrt(fx.^2+fy.^2));&#xA;t = fftshift(angle(fx+sqrt(-1)*fy));&#xA;&#xA;% Transfer functions:&#xA;G=zeros([n(1) n(2) Nfilters]);&#xA;for i=1:Nfilters&#xA;    tr=t+param(i,4); &#xA;    tr=tr+2*pi*(tr&amp;lt;-pi)-2*pi*(tr&amp;gt;pi);&#xA;&#xA;    G(:,:,i)=exp(-10*param(i,1)*(fr/n(2)/param(i,2)-1).^2-2*param(i,3)*pi*tr.^2);&#xA;end&#xA;&#xA;&#xA;if nargout == 0&#xA;    figure&#xA;    for i=1:Nfilters&#xA;        contour(fx, fy, fftshift(G(:,:,i)),[1 .7 .6],'r');&#xA;        hold on&#xA;    end&#xA;    axis('on')&#xA;    axis('equal')&#xA;    axis([-n(2)/2 n(2)/2 -n(1)/2 n(1)/2])&#xA;    axis('ij')&#xA;    xlabel('f_x (cycles per image)')&#xA;    ylabel('f_y (cycles per image)')&#xA;    grid on&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you run this function with the input parameters or = [8 8 8 8] and n = 192 (as in the original implementation) it should create this image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UvtIq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image shows the contours of the gabor filters in the frequency domain for z = 0.6, z= 0.7.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately this gabor filter implementation is different from what i've seen so far. My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Look at the matrix &lt;em&gt;param&lt;/em&gt;, the second column definitely seems to be&#xA;the frequency scale, where fmax = 0.3 and c = 1.85 is the constant.&#xA;The fourth column definitely seems to be the orientation scale. The first column is a constant of value 0.35; the only reference i've found in that paper about 0.35 is this sentence (page 8, right column): &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The model of Eq. (7) provides correct fitting for all the eight&#xA;  categories for frequencies below 0.35 cycles/pixel (as noise and&#xA;  aliasing corrupt higher spatial frequencies, see Fig. 4)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So what the first and third column represent? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Which brings me to this line of code:&#xA;G(:,:,i)=exp(-10*param(i,1)*(fr/n(2)/param(i,2)-1).^2-2*param(i,3)* pi *tr.^2);&#xA;this implementation is very different from what i've seen so far, i&#xA;don't think i recognize the formulation. In particular the second&#xA;term of the exponential: 2*param(i,3)* pi *tr.^2 controls the&#xA;orientation scale and also the particular &quot;stretch&quot; of the gaussian&#xA;in the frequency domain as shown in the picture, which I think is&#xA;used to get a better filter overlap in the frequency domain. Can&#xA;somebody clear up this implementation?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15282" LastActivityDate="2016-03-01T14:58:57.843" Title="Gabor filter bank for gist features" Tags="|filters|gabor|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22489" PostTypeId="1" CreationDate="2015-04-02T10:37:35.140" Score="0" ViewCount="1152" Body="&lt;p&gt;I would like to know the theory behind matlab butter function. Is there any book which gives clear idea on how it works. In future I would like to calculate the coefficients manually. &lt;/p&gt;&#xA;" OwnerUserId="15290" LastEditorUserId="7092" LastEditDate="2015-04-02T12:56:51.837" LastActivityDate="2015-04-02T12:56:51.837" Title="what is the theory behind matlab butter function?" Tags="|matlab|filters|" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22490" PostTypeId="2" ParentId="22489" CreationDate="2015-04-02T11:42:09.463" Score="2" Body="&lt;p&gt;The MATLAB function that you refer to uses this knowledge to calculate the coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Briefly, the function you refer to goes something like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Butterworth_filter#Normalized_Butterworth_polynomials&quot; rel=&quot;nofollow&quot;&gt;transfer functions&lt;/a&gt; for analog Butterworth filters of any order are already known analytically. It selects the normalized transfer function polynomial for the order you select.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The normalized polynomial is scaled appropriately according to the desired cutoff frequency, giving an $s$-domain transfer function that has the response that you want.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The $s$-domain prototype filter is then mapped to a discrete-time approximation using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;nofollow&quot;&gt;bilinear transform&lt;/a&gt;. This is the most commonly-used method of mapping a continuous-time filter to a discrete-time filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The result of the bilinear transform is a transfer function in the $z$-domain, from which the filter coefficients are easily found by inspection.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-04-02T11:42:09.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22491" PostTypeId="2" ParentId="22489" CreationDate="2015-04-02T12:15:38.493" Score="0" Body="&lt;p&gt;For a manually calculation of the coefficients of the IIR-Filter, the Jave speech toolkit has a open source implementation of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://github.com/sikoried/jstk/blob/master/jstk/src/de/fau/cs/jstk/sampled/filters/Butterworth.java&quot; rel=&quot;nofollow&quot; title=&quot;Butterworth.java&quot;&gt;Butterworth.java&lt;/a&gt; for calculating the coefficients and &lt;a href=&quot;https://github.com/sikoried/jstk/blob/master/jstk/src/de/fau/cs/jstk/sampled/filters/IIRFilter.java&quot; rel=&quot;nofollow&quot; title=&quot;IIRFilter.java&quot;&gt;IIRFilter.java&lt;/a&gt; how they are applied on a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are additional functions to calculate frequency response, amplitude response and phase response of an arbitary IIR-Filter:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public double amplitudeResponse(final double omega) {&#xA;    return ComplexNumber.magnitude(frequencyResponse(omega));&#xA;}&#xA;&#xA;public double phaseResponse(final double omega) {&#xA;    return ComplexNumber.toEulerPhi(frequencyResponse(omega));&#xA;}&#xA;&#xA;private double[] frequencyResponse(final double omega) {&#xA;    // z = exp(-j*omega);&#xA;    final double[] z = new double[2];&#xA;    z[0] = Math.cos(omega);&#xA;    z[1] = Math.sin(omega);&#xA;&#xA;    final double[] h = transferFunction(z);&#xA;    return h;&#xA;}&#xA;&#xA;private @NonNull double[] transferFunction(final double @NonNull [] z) {&#xA;    final double[] tmp = new double[2];&#xA;    final double[] zp = new double[2];&#xA;&#xA;    final double[] numerator = new double[2];&#xA;    numerator[0] = 0;&#xA;    numerator[1] = 0;&#xA;    for (int k = 0; k &amp;lt; b.length; k++) {&#xA;        ComplexNumber.power(z, -k, zp);&#xA;        ComplexNumber.multiply(b[k], zp, tmp);&#xA;        ComplexNumber.add(numerator, tmp, numerator);&#xA;    }&#xA;&#xA;    final double[] denominator = new double[2];&#xA;    denominator[0] = 0;&#xA;    denominator[1] = 0;&#xA;    for (int k = 0; k &amp;lt; a.length; k++) {&#xA;        ComplexNumber.power(z, -k, zp);&#xA;        ComplexNumber.multiply(a[k], zp, tmp);&#xA;        ComplexNumber.add(denominator, tmp, denominator);&#xA;    }&#xA;&#xA;    final double[] resesult = new double[2];&#xA;    ComplexNumber.divide(numerator, denominator, resesult);&#xA;    return resesult;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here are additional unit tests to make it clear how the coefficients $a$ and $b$ are used.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@Test&#xA;public void testFilterWithOrderTwoFilter() {&#xA;    final float[] x = new float[] { 2f, -3f, 0f, 2f, 0f, 0f, 0f, 0f };&#xA;    final double[] b = new double[] { 0.6, 0.4 };&#xA;    final double[] a = new double[] { 1.0, 0.5, 0.8 };&#xA;    final float[] expectedY = new float[] { 1.2f, -1.6f, -1.36f, 3.16f,&#xA;            0.308f, -2.682f, 1.0946f, 1.5983f };&#xA;&#xA;    final float[] actualY = new float[8];&#xA;    final IIRFilter filter = new IIRFilter(b, a);&#xA;    filter.filter(x, actualY);&#xA;    assertArrayEquals(expectedY, actualY, COMPARISON_DELTA);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And these unit tests I've used to test against the octave signal package:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@Test&#xA;public void testCalcNormalizedFrequency() {&#xA;    assertEquals(0.0, calcNormalizedFrequency(0, 44100), COMPARISON_DELTA);&#xA;    assertEquals(0.5, calcNormalizedFrequency(44100 / 4, 44100),&#xA;            COMPARISON_DELTA);&#xA;    // Nyquist&#xA;    assertEquals(1.0, calcNormalizedFrequency(44100 / 2, 44100),&#xA;            COMPARISON_DELTA);&#xA;}&#xA;&#xA;@Test&#xA;public void testCreateLowPass() {&#xA;    // order 3, cutoff 0.2&#xA;    //@formatter:off&#xA;    final double[] bExpected = new double[] {&#xA;            0.018099, 0.054297, 0.054297, 0.018099 };&#xA;    final double[] aExpected = new double[] {&#xA;            1.00000, -1.76004, 1.18289, -0.27806 };&#xA;    //@formatter:off&#xA;    final IIRFilter filter = createLowPass(3, 0.2);&#xA;    final double[] bActual = filter.getFeedforwardCoefficients(false);&#xA;    final double[] aActual = filter.getFeedbackCoefficients(false);&#xA;    assertArrayEquals(bExpected, bActual, COMPARISON_DELTA);&#xA;    assertArrayEquals(aExpected, aActual, COMPARISON_DELTA);&#xA;}&#xA;&#xA;@Test&#xA;public void testCreateHighPass() {&#xA;    // order 3, cutoff 0.2&#xA;    //@formatter:off&#xA;    final double[] bExpected = new double[] {&#xA;            0.52762, -1.58287, 1.58287, -0.52762 };&#xA;    final double[] aExpected = new double[] {&#xA;            1.00000, -1.76004, 1.18289, -0.27806 };&#xA;    //@formatter:off&#xA;    final IIRFilter filter = createHighPass(3, 0.2);&#xA;    final double[] bActual = filter.getFeedforwardCoefficients(false);&#xA;    final double[] aActual = filter.getFeedbackCoefficients(false);&#xA;    assertArrayEquals(bExpected, bActual, COMPARISON_DELTA);&#xA;    assertArrayEquals(aExpected, aActual, COMPARISON_DELTA);&#xA;}&#xA;&#xA;@Test&#xA;public void testCreateBandPass() {&#xA;    // order 3, cutoffLow 0.2, cutoffHigh 0.7&#xA;    //@formatter:off&#xA;    final double[] bExpected = new double[] {&#xA;            0.16667, 0.00000, -0.50000, 0.00000, 0.50000, 0.00000, -0.16667};&#xA;    final double[] aExpected = new double[] {&#xA;            1.0000e+000, -6.6370e-001, 1.6314e-001, -1.6192e-001,&#xA;            3.6596e-001, -7.3744e-002, 1.6374e-017 };&#xA;    //@formatter:off&#xA;    final IIRFilter filter = createBandPass(3, 0.2, 0.7);&#xA;    final double[] bActual = filter.getFeedforwardCoefficients(false);&#xA;    final double[] aActual = filter.getFeedbackCoefficients(false);&#xA;    assertArrayEquals(bExpected, bActual, COMPARISON_DELTA);&#xA;    assertArrayEquals(aExpected, aActual, COMPARISON_DELTA);&#xA;}&#xA;&#xA;@Test&#xA;public void testCreateBandReject() {&#xA;    // order 3, cutoffLow 0.2, cutoffHigh 0.7&#xA;    //@formatter:off&#xA;    final double[] bExpected = new double[] {&#xA;            0.16667, -0.22123, 0.59789, -0.45690, 0.59789, -0.22123, 0.16667 };&#xA;    final double[] aExpected = new double[] {&#xA;            1.0000e+000, -6.6370e-001, 1.6314e-001, -1.6192e-001,&#xA;            3.6596e-001, -7.3744e-002, 1.6374e-017 };&#xA;    //@formatter:off&#xA;    final IIRFilter filter = createBandReject(3, 0.2, 0.7);&#xA;    final double[] bActual = filter.getFeedforwardCoefficients(false);&#xA;    final double[] aActual = filter.getFeedbackCoefficients(false);&#xA;    assertArrayEquals(bExpected, bActual, COMPARISON_DELTA);&#xA;    assertArrayEquals(aExpected, aActual, COMPARISON_DELTA);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7953" LastEditorUserId="7953" LastEditDate="2015-04-02T12:23:44.127" LastActivityDate="2015-04-02T12:23:44.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22493" PostTypeId="1" AcceptedAnswerId="22498" CreationDate="2015-04-02T15:18:52.947" Score="1" ViewCount="1431" Body="&lt;p&gt;when manipulating a live stream of audio data in the frequency domain, I've heard you need to do fft / ifft in small chunks, say 256 samples at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also heard you need to somehow employ a window function but I'm not sure the details on that. Is that to prevent artifacts from popping up due to the circular nature of fft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else I should know that I haven't mentioned above if planning to do this? I also eventually want to figure out how to make windows work with convolution reverb, but assume the answer to that is big enough for its own question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any info!!&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-02T18:06:55.160" Title="Real time fft/ifft processing" Tags="|fft|ifft|real-time|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22494" PostTypeId="1" AcceptedAnswerId="22499" CreationDate="2015-04-02T16:46:19.940" Score="0" ViewCount="224" Body="&lt;p&gt;For designing any analog filter and various other outputs of filter we use  &lt;strong&gt;laplace transform&lt;/strong&gt;,I can visualise a laplace transform like for ex.&lt;br&gt;&#xA;&lt;code&gt;s[X(s)]&lt;/code&gt; can be implemented as differentiator fetched with signal &lt;code&gt;x(t)&lt;/code&gt;while implementing  differentiators we generally use &#xA;capacitors or by using OPAMP similarly,&#xA;&lt;code&gt;[X(s)]/s&lt;/code&gt; can be implemented as integrators using OPAMP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I cannot visualize the z transform in designing of digital filters,&#xA;while the implementing the digital filters we often map the s plane to z plane i cannot understand the significance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are various method of implementing but in end we compare the s plane with z-plane ,&#xA;and deduce a equation where the value of z in found in place of s,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why do we need to map the S plane to z plane?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15093" LastEditorUserId="15093" LastEditDate="2015-04-02T17:16:25.313" LastActivityDate="2015-04-02T18:15:50.607" Title="Visualising a Z-transformed Transfer Function?" Tags="|digital-communications|z-transform|digital-filters|laplace-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22495" PostTypeId="2" ParentId="22259" CreationDate="2015-04-02T16:49:07.440" Score="0" Body="&lt;p&gt;This is my understanding, which is probably incomplete: phones are usually modeled using multiple (~3) states. Observations are feature vectors and are often some variant of mel-frequency cepstral coefficients (MFCCs). Word models can then be constructed by concatenating several phone models together.&#xA;More detailed information can be found &lt;a href=&quot;http://mi.eng.cam.ac.uk/~mjfg/mjfg_NOW.pdf&quot; rel=&quot;nofollow&quot;&gt;in this PDF describing the applications of HMMs to speech recognition&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12038" LastActivityDate="2015-04-02T16:49:07.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22496" PostTypeId="2" ParentId="22432" CreationDate="2015-04-02T17:44:01.087" Score="1" Body="&lt;p&gt;Assuming you know the frequencies (which is not exactly the case), you can solve the problem as follows:&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; be the sampled vector for &lt;span class=&quot;math-container&quot;&gt;$n=0,\ldots,N-1$&lt;/span&gt;. The signal can be represented in vector form, i.e. &lt;span class=&quot;math-container&quot;&gt;$\mathbf{x} = [x[0],\ldots,x[N-1]]^T$&lt;/span&gt;. The signal model is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ x[n] = A_1\sin(2\pi f_1n) + A_2\sin(2\pi f_2n)$$&lt;/span&gt;&#xA;or in vector form,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{x} = \mathbf{S}\mathbf{a}$$&lt;/span&gt;&lt;br /&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathbf{a} = [A_1,A_2]^T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbf{S} = [\mathbf{s}(f_1),\mathbf{s}(f_2)]$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{s}(f) = [\sin(2\pi f\cdot0),\ldots,\sin(2\pi f\cdot(N-1))]^T$&lt;/span&gt;.&lt;br /&gt;&#xA;Then, the amplitudes can be found be solving the following optimisation:&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\underset{\mathbf{a}}{\arg\min}\left\|\mathbf{x}-\mathbf{S}\mathbf{a}\right\|^2$$&lt;/span&gt;&lt;br /&gt;&#xA;which yields&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{\mathbf{a}} = (\mathbf{S}^T\mathbf{S})^{-1}\mathbf{S}^T\mathbf{x}$$&lt;/span&gt;&#xA;Note that &lt;span class=&quot;math-container&quot;&gt;$(\mathbf{S}^T\mathbf{S})$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix of the cross product of two sine wave which is easy to invert without any matrix operations and the other term is simply multiplying the signal (element wise) with two sine wave. Therefore no matrix operations is actually needed.&lt;/p&gt;&#xA;&lt;p&gt;Now, the problem is that the frequencies are not exactly known. The resolution of the FFT is &lt;span class=&quot;math-container&quot;&gt;$1/N$&lt;/span&gt;, and I am not sure this is good enough. You can try to use &lt;a href=&quot;https://ieeexplore.ieee.org/document/295186&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quinn's Fourier coefficients interpolation method&lt;/a&gt; or any other method to obtain better frequency estimation.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="7092" LastEditDate="2022-07-09T12:36:38.607" LastActivityDate="2022-07-09T12:36:38.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22497" PostTypeId="1" AcceptedAnswerId="22501" CreationDate="2015-04-02T17:47:01.637" Score="0" ViewCount="1116" Body="&lt;p&gt;I have designed a bandpass IIR butterworth filter with desired response using the MATLAB FDAtool with the configuration shown in the figure below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/laoG7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is multistage implementation, when I export the filter object to workspace I don't get numerator and denominator of transfer function as filter parameters and instead I get sos matrix and scale values as shown below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FilterStructure: 'Direct-Form II, Second-Order Sections'&#xA;              Arithmetic: 'double'&lt;br&gt;&#xA;               sosMatrix: [12x6 double]&lt;br&gt;&#xA;             ScaleValues: [13x1 double]&lt;br&gt;&#xA;     OptimizeScaleValues: true&lt;br&gt;&#xA;        PersistentMemory: false          &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is I have to port this design to C code for implementation in firmware and the multi-order specification looks complicated to define an input-output expression. So I tried converting this design into a single stage filter(using convert to single section option under edit), but the following is magnitude response that what I get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/em4hx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not only is the response way-off, but the system is unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are the following,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Why is FDAtool not able to produce a good single stage equivalent filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) How to calculate groupdelay of the multi-stage filter? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Is the groupdelay of the multistage filter simply FilterOrder*Sample time as in a direct form FIR or is it more complicated for IIR and multistage filters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Will the groupdelay of multi-stage filter be the same as a possible acceptable(in terms of magnitude response) single stage equivalent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) How important is stability of the filter? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) Does FDAtool have an option to visualize the filter structure?(Edit&gt;Show Filter Structure doesn't seem to work)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;7) What is the tradeoff between Filter Order and Number of sections in the filter other than structural complexity?&lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-04-02T18:57:51.577" Title="Tradeoff between Filter Order and Sections" Tags="|matlab|filters|filter-design|infinite-impulse-response|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22498" PostTypeId="2" ParentId="22493" CreationDate="2015-04-02T18:01:48.520" Score="2" Body="&lt;p&gt;Analysis is separate from processing.  Windowing helps remove certain artifacts during spectrum analysis, but since it is numerically lossy, isn't as useful when actually processing the audio for output.  Instead, sufficient zero-padding (without any non-rectangular windowing) and the use of overlap-add or overlap-save is used for any fast convolution or frequency domain filtering.  This prevents (actually just zeros) circular convolution artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution reverb is already answered elsewhere, but in general can be done by breaking up the reverb impulse response into a whole series of overlap-save processing steps and summations (e.g. a 256k long reverb might be done using a series of 1,000 256+padding length FFT convolutions, or a mix of shorter and longer ones, with a future use buffer to hold most of those results till needed.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-02T18:06:55.160" LastActivityDate="2015-04-02T18:06:55.160" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22499" PostTypeId="2" ParentId="22494" CreationDate="2015-04-02T18:15:50.607" Score="0" Body="&lt;p&gt;in continuous-time functions, like $x(t)$, the operation of the derivative makes sense, it is well defined.  the three components to a continuous-time LTI filter are adders (two or more signals being added), scalers (a signal is simply multiplied by a constant), and integrators (the $s^{-1}$ operators).  the first two components do not discriminate with regard to frequency, so with just those two components, you cannot make a &lt;em&gt;&quot;filter&quot;&lt;/em&gt; that filters out some frequencies more so than others.  but the integrator &lt;strong&gt;does&lt;/strong&gt; act differently on sinusoids of different frequencies.  higher frequencies come out of the integrator reduced in amplitude more than lower frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in discrete-time functions (or &quot;sequences&quot;), like $x[n]$, the derivative operator does &lt;strong&gt;not&lt;/strong&gt; makes sense, it is not defined.  the three components to a discrete-time LTI filter are adders (two or more signals being added), scalers (a signal is simply multiplied by a constant), and delay elements (the $z^{-1}$ operators).  the first two components do not discriminate with regard to frequency, so with just those two components, you cannot make a &lt;em&gt;&quot;filter&quot;&lt;/em&gt; that filters out some frequencies more so than others.  but the delay element &lt;strong&gt;does&lt;/strong&gt; act differently on sinusoids of different frequencies.  higher frequencies come out of the delay element shifted more in phase than lower frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;analog filters act on physical quantities in time.  digital filters act on numbers.  these numbers are samples of a continuous-time function ($x[n]=x(nT)$) and make up a sequence.  there is no way to do derivatives or integrals directly.  but we &lt;strong&gt;can&lt;/strong&gt; delay any of these sequences by use of computer memory.  that's why we talk of $H(z)$ more so than $H(s)$ when designing and implementing digital filters.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-02T18:15:50.607" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22500" PostTypeId="2" ParentId="22452" CreationDate="2015-04-02T18:49:23.017" Score="0" Body="&lt;p&gt;Sounds like an Extended Kalman Filter is the ideal candidate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://bayesclasses.sourceforge.net/Bayes++.html&quot; rel=&quot;nofollow&quot;&gt;Bayes++&lt;/a&gt; is a really simple drop-in library for implementing one, and the example here (&lt;a href=&quot;https://github.com/Exadios/Bayes-/blob/master/PV/PV.cpp&quot; rel=&quot;nofollow&quot;&gt;https://github.com/Exadios/Bayes-/blob/master/PV/PV.cpp&lt;/a&gt; implements the question exactly (except it only takes in 1 observation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code, in case it gets moved:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* &#xA; * Bayes++ the Bayesian Filtering Library &#xA; * Copyright (c) 2002 Michael Stevens &#xA; * See accompanying Bayes++.htm for terms and conditions of use. &#xA; * &#xA; * $Header: /cvsroot/bayesclasses/Bayes++/PV/PV.cpp,v 1.17.2.3 2005/04/07 06:39:22 mistevens Exp $ &#xA; */  &#xA;&#xA;/* &#xA; * Example of using Bayesian Filter Class to solve a simple problem. &#xA; *  The example implements a Position and Velocity Filter with a Position observation. &#xA; *  The motion model is the so called IOU Integrated Ornstein-Uhlenbeck Process Ref[1] &#xA; *    Velocity is Brownian with a trend towards zero proportional to the velocity &#xA; *    Position is just Velocity integrated. &#xA; *  This model has a well defined velocity and the mean squared speed is parameterised. Also &#xA; *  the velocity correlation is parameterised. &#xA; *   &#xA; * Two implementations are demonstrated &#xA; *  1) A direct filter &#xA; *  2) An indirect filter where the filter is preformed on error and state is estimated indirectly &#xA; * Reference &#xA; * [1] &quot;Bayesian Multiple Target Tracking&quot; Lawrence D Stone, Carl A Barlow, Thomas L Corwin &#xA; */  &#xA;&#xA;#include &quot;BayesFilter/UDFlt.hpp&quot;  &#xA;#include &quot;BayesFilter/filters/indirect.hpp&quot;  &#xA;#include &quot;Test/random.hpp&quot;  &#xA;#include &amp;lt;cmath&amp;gt;  &#xA;#include &amp;lt;iostream&amp;gt;  &#xA;#include &amp;lt;boost/numeric/ublas/io.hpp&amp;gt;  &#xA;&#xA;namespace  &#xA;{  &#xA;    using namespace Bayesian_filter;  &#xA;    using namespace Bayesian_filter_matrix;  &#xA;&#xA;    // Choose Filtering Scheme to use  &#xA;    typedef UD_scheme FilterScheme;  &#xA;&#xA;    // Square   &#xA;    template &amp;lt;class scalar&amp;gt;  &#xA;    inline scalar sqr(scalar x)  &#xA;    {  &#xA;        return x*x;  &#xA;    }  &#xA;&#xA;    // Random numbers from Boost  &#xA;    Bayesian_filter_test::Boost_random localRng;  &#xA;&#xA;    // Constant Dimensions  &#xA;    const unsigned NX = 2;          // Filter State dimension   (Position, Velocity)  &#xA;&#xA;    // Filter Parameters  &#xA;    // Prediction parameters for Integrated Ornstein-Uhlembeck Process  &#xA;    const Float dt = 0.01;  &#xA;    const Float V_NOISE = 0.1;  // Velocity noise, giving mean squared error bound  &#xA;    const Float V_GAMMA = 1.;   // Velocity correlation, giving velocity change time constant  &#xA;    // Filter's Initial state uncertainty: System state is unknown  &#xA;    const Float i_P_NOISE = 1000.;  &#xA;    const Float i_V_NOISE = 10.;  &#xA;    // Noise on observing system state  &#xA;    const Float OBS_INTERVAL = 0.10;  &#xA;    const Float OBS_NOISE = 0.001;  &#xA;&#xA;}//namespace  &#xA;&#xA;/* &#xA; * Prediction model &#xA; * Linear state predict model &#xA; */  &#xA;class PVpredict : public Linear_predict_model  &#xA;{  &#xA;public:  &#xA;    PVpredict();  &#xA;};  &#xA;&#xA;PVpredict::PVpredict() : Linear_predict_model(NX, 1)  &#xA;{  &#xA;    // Position Velocity dependance  &#xA;    const Float Fvv = exp(-dt*V_GAMMA);  &#xA;    Fx(0,0) = 1.;  &#xA;    Fx(0,1) = dt;  &#xA;    Fx(1,0) = 0.;  &#xA;    Fx(1,1) = Fvv;  &#xA;    // Setup constant noise model: G is identity  &#xA;    q[0] = dt*sqr((1-Fvv)*V_NOISE);  &#xA;    G(0,0) = 0.;  &#xA;    G(1,0) = 1.;  &#xA;}  &#xA;&#xA;&#xA;/* &#xA; * Position Observation model &#xA; * Linear observation is addative uncorrelated model &#xA; */  &#xA;class PVobserve : public Linrz_uncorrelated_observe_model  &#xA;{  &#xA;    mutable Vec z_pred;  &#xA;public:  &#xA;    PVobserve ();  &#xA;    const Vec&amp;amp; h(const Vec&amp;amp; x) const  &#xA;    {  &#xA;        z_pred[0] = x[0];  &#xA;        return z_pred;  &#xA;    };  &#xA;};  &#xA;&#xA;PVobserve::PVobserve () :  &#xA;    Linrz_uncorrelated_observe_model(NX,1), z_pred(1)  &#xA;{  &#xA;    // Linear model  &#xA;    Hx(0,0) = 1;  &#xA;    Hx(0,1) = 0.;  &#xA;    // Observation Noise variance  &#xA;    Zv[0] = sqr(OBS_NOISE);  &#xA;}  &#xA;&#xA;&#xA;void initialise (Kalman_state_filter&amp;amp; kf, const Vec&amp;amp; initState)  &#xA;/* &#xA; * Initialise Kalman filter with an initial guess for the system state and fixed covariance &#xA; */  &#xA;{  &#xA;    // Initialise state guess and covarince  &#xA;    kf.X.clear();  &#xA;    kf.X(0,0) = sqr(i_P_NOISE);  &#xA;    kf.X(1,1) = sqr(i_V_NOISE);  &#xA;&#xA;    kf.init_kalman (initState, kf.X);  &#xA;}  &#xA;&#xA;&#xA;int main()  &#xA;{  &#xA;    // global setup  &#xA;    std::cout.flags(std::ios::scientific); std::cout.precision(6);  &#xA;&#xA;    // Setup the test filters  &#xA;    Vec x_true (NX);  &#xA;&#xA;    // True State to be observed  &#xA;    x_true[0] = 1000.;  // Position  &#xA;    x_true[1] = 1.0;    // Velocity  &#xA;&#xA;    std::cout &amp;lt;&amp;lt; &quot;Position Velocity&quot; &amp;lt;&amp;lt; std::endl;  &#xA;    std::cout &amp;lt;&amp;lt; &quot;True Initial  &quot; &amp;lt;&amp;lt; x_true &amp;lt;&amp;lt; std::endl;  &#xA;&#xA;    // Construct Prediction and Observation model and filter  &#xA;    // Give the filter an initial guess of the system state  &#xA;    PVpredict linearPredict;  &#xA;    PVobserve linearObserve;  &#xA;    Vec x_guess(NX);  &#xA;    x_guess[0] = 900.;  &#xA;    x_guess[1] = 1.5;  &#xA;    std::cout &amp;lt;&amp;lt; &quot;Guess Initial &quot; &amp;lt;&amp;lt; x_guess &amp;lt;&amp;lt; std::endl;  &#xA;&#xA;    // f1 Direct filter construct and initialize with initial state guess  &#xA;    FilterScheme f1(NX,NX);  &#xA;    initialise (f1, x_guess);  &#xA;&#xA;    // f2 Indirect filter construct and Initialize with initial state guess  &#xA;    FilterScheme error_filter(NX,NX);  &#xA;    Indirect_kalman_filter&amp;lt;FilterScheme&amp;gt; f2(error_filter);  &#xA;    initialise (f2, x_guess);  &#xA;&#xA;&#xA;    // Iterate the filter with test observations  &#xA;    Vec u(1), z_true(1), z(1);  &#xA;    Float time = 0.; Float obs_time = 0.;  &#xA;    for (unsigned i = 0; i &amp;lt; 100; ++i)  &#xA;    {  &#xA;        // Predict true state using Normally distributed acceleration  &#xA;        // This is a Guassian  &#xA;        x_true = linearPredict.f(x_true);  &#xA;        localRng.normal (u);        // normally distributed mean 0., stdDev for stationary IOU  &#xA;        x_true[1] += u[0]* sqr(V_NOISE) / (2*V_GAMMA);  &#xA;&#xA;        // Predict filter with known pertubation  &#xA;        f1.predict (linearPredict);  &#xA;        f2.predict (linearPredict);  &#xA;        time += dt;  &#xA;&#xA;        // Observation time  &#xA;        if (obs_time &amp;lt;= time)  &#xA;        {  &#xA;            // True Observation  &#xA;            z_true[0] = x_true[0];  &#xA;&#xA;            // Observation with addative noise  &#xA;            localRng.normal (z, z_true[0], OBS_NOISE);  // normally distributed mean z_true[0], stdDev OBS_NOISE.  &#xA;&#xA;            // Filter observation  &#xA;            f1.observe (linearObserve, z);  &#xA;            f2.observe (linearObserve, z);  &#xA;&#xA;            obs_time += OBS_INTERVAL;  &#xA;        }  &#xA;    }  &#xA;&#xA;    // Update the filter to state and covariance are available  &#xA;    f1.update ();  &#xA;    f2.update ();  &#xA;&#xA;    // Print everything: filter state and covariance  &#xA;    std::cout &amp;lt;&amp;lt;&quot;True     &quot; &amp;lt;&amp;lt; x_true &amp;lt;&amp;lt; std::endl;  &#xA;    std::cout &amp;lt;&amp;lt;&quot;Direct   &quot; &amp;lt;&amp;lt; f1.x &amp;lt;&amp;lt; ',' &amp;lt;&amp;lt; f1.X &amp;lt;&amp;lt;std::endl;  &#xA;    std::cout &amp;lt;&amp;lt;&quot;Indirect &quot; &amp;lt;&amp;lt; f2.x &amp;lt;&amp;lt; ',' &amp;lt;&amp;lt; f2.X &amp;lt;&amp;lt; std::endl;;  &#xA;    return 0;  &#xA;}  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11719" LastEditorUserId="11719" LastEditDate="2015-04-02T21:47:59.860" LastActivityDate="2015-04-02T21:47:59.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22501" PostTypeId="2" ParentId="22497" CreationDate="2015-04-02T18:57:51.577" Score="3" Body="&lt;p&gt;Large order single stage filters are inherently problematic. Calculating the numerators and denominator from the poles and zeros is an ill defined problem and numerically unstable. &#xA;Furthermore Direct Form II is the worst possible filter topology. I strongly recommend Direct Form I or transposed Form II.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To the questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Numerically ill defined problem&lt;/li&gt;&#xA;&lt;li&gt;Just add the group delay of the indivdiual stages&lt;/li&gt;&#xA;&lt;li&gt;Group delay is always defined as the negative first derivative of the phase of the transfer function vs. frequency. That's the same for FIR and IIR. It's frequency dependent.&lt;/li&gt;&#xA;&lt;li&gt;Yes. If you had infinite precision math, the results would be the same.&lt;/li&gt;&#xA;&lt;li&gt;Very important. You can't implement and unstable filter, you'd only get noise NaN or infinity as output&lt;/li&gt;&#xA;&lt;li&gt;No idea&lt;/li&gt;&#xA;&lt;li&gt;Pretty much everyone implements filter ins biquad sections. So the number of stages and the filter order is directly proportional&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-04-02T18:57:51.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22502" PostTypeId="1" CreationDate="2015-04-02T19:12:34.700" Score="0" ViewCount="235" Body="&lt;p&gt;How to solve the initial value problem with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x(n + 1) + x(n) = n^2;&#xA;x(0) = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do know how to solve for initial value theorem in differential equation, but not in difference equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help.Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15295" LastActivityDate="2015-04-03T07:07:26.200" Title="Initial value Problem with difference equation" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22505" PostTypeId="1" CreationDate="2015-04-02T20:38:55.237" Score="0" ViewCount="698" Body="&lt;p&gt;I am looking into algorithms/techniques for feature extraction for accelerometer data - to then be used in classification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT is incredibly popular, however would this work on accelerometer data?  I've also seen PCA, but that isn't quite so popular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will PCA work as a possible feature extraction algorithm?   &lt;/p&gt;&#xA;" OwnerUserId="13363" LastEditorUserId="13363" LastEditDate="2015-04-02T22:21:56.817" LastActivityDate="2015-04-02T22:21:56.817" Title="Feature Extraction from Accelerometers for classification" Tags="|fft|classification|machine-learning|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22507" PostTypeId="1" CreationDate="2015-04-03T03:44:28.833" Score="0" ViewCount="180" Body="&lt;p&gt;I was curious to know which algorithm(stepwise) is used by the mironsets function of the MIRToolbox library to find the onsets in the audio signal. I am talking about the default functionality when we use mironsets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&#xA;o = mironsets('audio.wav')&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here o is the output onset strength envelope and looks like this&lt;img src=&quot;https://i.stack.imgur.com/3dfFV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some questions like - Where is the negative part of the signal gone? Why not all local maximas are considered as onsets?&lt;/p&gt;&#xA;" OwnerUserId="11459" LastActivityDate="2015-04-03T03:44:28.833" Title="Algorithm used by mironsets" Tags="|matlab|audio|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22508" PostTypeId="2" ParentId="22502" CreationDate="2015-04-03T07:07:26.200" Score="1" Body="&lt;p&gt;Like a linear constant coefficient ODE the general solution can be written as the sum of a particular solution and the general solution of the homogeneous equation $x(n+1)+x(n)=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the right hand side is a polynomial we look for a polynomial particular solution, and a bit of experimenting will show this to be a quadratic:$$x_p(n)=n^2/2-n/2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the general solution to the homogeneous equation is obviously: $x_h(n)=k(-1)^n$, and the solution to your problem is the sum $x_p(n)+x_h(n)$ with $k$ chosen to satisfy the initial condition.&lt;/p&gt;&#xA;" OwnerUserId="12119" LastActivityDate="2015-04-03T07:07:26.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22510" PostTypeId="2" ParentId="22480" CreationDate="2015-04-03T12:50:12.930" Score="1" Body="&lt;p&gt;The variance is a good inhomogenity measure. &#xA;For example, take 20*20 patches and calculate the empirical variance of the patch using these 400 samples.&#xA;For very simple purpose, this could work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit : After viewing your example images, try to just play around with simple tools like manual thresolding and edge detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2: Added Example with different patch sizes (40, 10, 2)&lt;img src=&quot;https://i.stack.imgur.com/JFnZg.png&quot; alt=&quot;Original image and variance at patch size 40, 20, 4&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13315" LastEditorUserId="13315" LastEditDate="2015-04-03T15:24:31.850" LastActivityDate="2015-04-03T15:24:31.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22511" PostTypeId="1" AcceptedAnswerId="22566" CreationDate="2015-04-03T13:01:11.127" Score="1" ViewCount="596" Body="&lt;p&gt;I'm currently working on applying Machine Vision methods to sign language interpretation and I'm really overwhelmed with the body of knowledge out there. I've been reading up on object recognition from various resources (Peter Corke's Robotics, Vision and Control, Richard Szeliski's Computer Vision, Algorithms and Application), but finding it hard to decide on what methods to go with, hence my question:&#xA;For simplicity's sake, let's assume I just want to process an image of a hand holding up 1 finger, get my program to process the image and out &quot;one&quot;. Do same for 2...up till five. (I know this is really simple, but will give me the direction I need before going on to more complex things).&#xA;(1)What method do I need to store the original image of the hand holding up 1 finger to put in my database, which other images will be compared to?&#xA;(2)What method do I to compare an inptu to what's stored in my database (Please, give me the most simple methods you know of).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="15303" LastActivityDate="2015-04-06T13:50:55.160" Title="Machine Vision Techniques for Sign Language Recognition and Interpretation(using Matlab)" Tags="|image-processing|computer-vision|object-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22513" PostTypeId="2" ParentId="22480" CreationDate="2015-04-03T15:29:02.727" Score="0" Body="&lt;p&gt;Another good texture measure would be &lt;a href=&quot;http://en.wikipedia.org/wiki/Co-occurrence_matrix&quot; rel=&quot;nofollow&quot;&gt;gray-level co-occurence matrix&lt;/a&gt;, which is &lt;a href=&quot;http://www.mathworks.com/help/images/ref/graycomatrix.html;jsessionid=fe496d7e4ad9d5c9108497afb5bf&quot; rel=&quot;nofollow&quot;&gt;implemented in Matlab as&lt;/a&gt; &lt;code&gt;graycomatrix&lt;/code&gt;. By the way, in your case a simple Otsu threshold might do the trick as well.&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-04-03T15:29:02.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22514" PostTypeId="1" CreationDate="2015-04-03T15:52:01.547" Score="0" ViewCount="184" Body="&lt;p&gt;I have an impulse response ir that I need to approximate with an iir because of realtime requirements. For stability I want to break down the 10th order IIR generated with Steiglitz-Mcbride to biquads / second-order sections. However, I can't use tf2sos with the complex transfer function that stmcb() generates like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = stmcb(ir,10,10);&#xA;[sos,g] = tf2sos(real(b),real(a));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I compare bode plots of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz(b,a) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz(sos)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I find that the contour is preserved but there is a large difference in magnitude and phase. Am I missing some scaling factor or limitation? Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-04-03T15:52:01.547" Title="Second-order sections from complex coefficients" Tags="|infinite-impulse-response|approximation|biquad|" AnswerCount="0" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="22515" PostTypeId="1" CreationDate="2015-04-03T18:38:47.897" Score="0" ViewCount="150" Body="&lt;p&gt;I have a series of time hacks for various events that have occurred.  Some of these events occur at regular intervals (+/- some small variance) but I do not know what those intervals are and would like to find out.  As a overly simplistic example, let's say I have a series of events that have a relative times of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1, 2, 5, 7, 8, 10, 11, 15, 16, 18, 20, 24, 25, 30, 32, 35, 39, 40, 41, 42, 45, 48, 50&#xA;&#xA;There are two series that occur; one every 5 seconds and one every 8 seconds.  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I find these interval periods if I have a subset of data, am starting at an arbitrary start point and can take into account the minor variances that occur when recording time?  Is FFT the right way to go or is there something simpler such as just calculating differences and find all the multiples with a given tolerance?&lt;/p&gt;&#xA;" OwnerUserId="15304" LastActivityDate="2015-04-03T18:38:47.897" Title="Finding periodicity within sequence of time hacks" Tags="|fft|signal-detection|c#|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22516" PostTypeId="1" CreationDate="2015-04-03T18:52:55.660" Score="1" ViewCount="99" Body="&lt;p&gt;I am trying to use &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.firwin2.html&quot; rel=&quot;nofollow&quot;&gt;SciPy's &lt;code&gt;firwin2&lt;/code&gt;&lt;/a&gt; command to get the coefficients that correspond to a filter of my creating.  I took white noise in Audacity, applied an Equalization curve, exported said curve out of Audacity, and I am using &lt;code&gt;firwin2&lt;/code&gt; to get the coefficients for said filter.  I manage to get coefficients out that give me a correct curve shape but the magnitude of the signal is WAAAAAAY off.  It's almost $50$ dB higher than what it should be.  Does anyone know when I could be leaving out a scaling factor?&lt;/p&gt;&#xA;" OwnerUserId="15305" LastEditorUserId="29" LastEditDate="2015-04-03T23:17:54.053" LastActivityDate="2015-04-03T23:17:54.053" Title="scaling issue when using scypy's firwin2 to get coefficients for a filter" Tags="|filters|filter-design|python|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22517" PostTypeId="1" CreationDate="2015-04-03T22:48:06.150" Score="0" ViewCount="209" Body="&lt;p&gt;Say I'd like to bandpass filter a signal with corner frequencies 1 kHz and 2 kHz (i.e., passes signals between 1 kHz and 2 kHz and suppresses other frequencies) using software like MATLAB. Intuition tells me there's two ways to do this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use filter design tools to create, say, a 10th order Butterworth filter. Use the &lt;em&gt;filter&lt;/em&gt; command with the filter coefficients and input signal. This works, but the filter is nonideal (specifically, there will be some passband ripple, and the frequency cutoffs won't be immediate -- a signal at say, 2.1 kHz, will still be partially passed).&lt;/li&gt;&#xA;&lt;li&gt;Perform an FFT on the input signal. Set any FFT element corresponding to a frequency outside the 1 kHz-2 kHz range to zero. Inverse FFT the input signal. This will essentially be an ideal filter -- anything between 1kHz-2 kHz is passed with unity gain (no passband ripple), and anything outside 1  kHz-2 KHz is exactly zero (immediate cutoff).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Intuition tells me that #2 is better, because it's an ideal filter. I've learned that an ideal filter can't be built using analog components, but if a certain application is purely digital, why not use the ideal filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, I've seen lots of code that uses tools like a nonideal 10th order Butterworth filter -- so what am I overlooking? What's the advantage of using a nonideal filter?&lt;/p&gt;&#xA;" OwnerUserId="15306" LastEditorUserId="7092" LastEditDate="2015-04-04T02:54:33.637" LastActivityDate="2015-04-04T21:48:30.450" Title="Advantage of using nonideal filter in purely digital application" Tags="|matlab|digital-filters|" AnswerCount="1" CommentCount="3" ClosedDate="2015-04-06T15:01:23.657" ContentLicense="CC BY-SA 3.0" />
  <row Id="22518" PostTypeId="1" CreationDate="2015-03-31T03:41:55.480" Score="1" ViewCount="33" Body="&lt;p&gt;I am completely stuck on solving some problems for my digital communications class. Junior level undergrad class, so fairly basic. I have been searching around all day for related articles etc but can't seem to find any that are helpful. Any help would be much appreciated.&#xA;&lt;a href=&quot;http://prntscr.com/6njdcj&quot; rel=&quot;nofollow&quot;&gt;Here are the three questions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the coefficients my initial hunch is just to make &lt;code&gt;c2&lt;/code&gt; and &lt;code&gt;c3 = 0&lt;/code&gt;, which would leave &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yhat[1] = y[1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My other attempt is to create a system of equations so the x[2] terms are cancelled and the x[1] terms are the only ones left over, but this system proves difficult to me and I am left with a mess of noise. For some reason I can only get two equations with three unknowns.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c3= -3 * c2&#xA;c1 + 1/3 * c2 + 1/4* c3 = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;c1,c2,c3&lt;/code&gt; are constants&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--OK so I think I solved question 1, I ended up getting c1=1,  c2= 1/3, c3 = 1/4 for part a&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and  &lt;code&gt;((169/144)* SNR)/((4/13)*SNR + 1) = SINR&lt;/code&gt; for part b.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving on to question 2, part a I got what I was attempting to do above, &lt;code&gt;c3 = -3 * c2&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I am stuck again on part B because I fail to see how the coefficients would affect the &lt;code&gt;SINR&lt;/code&gt; if we just want to solve for &lt;code&gt;X[1]&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="15257" OwnerDisplayName="Kevin Dahm" LastEditorUserId="7092" LastEditDate="2015-04-04T02:53:53.790" LastActivityDate="2015-04-04T02:53:53.790" Title="Basic &quot;filtering&quot; in digital communications" Tags="|digital-communications|" AnswerCount="0" CommentCount="0" FavoriteCount="0" ClosedDate="2015-04-20T15:00:36.383" ContentLicense="CC BY-SA 3.0" />
  <row Id="22522" PostTypeId="1" CreationDate="2015-04-04T12:45:09.137" Score="1" ViewCount="7290" Body="&lt;p&gt;I should be able to input a pixel position and get all the same coloured(in my case it should be black) pixels which are connected to it. How to do this in opencv with c++. Simply the output pixels should be connected to each other with color black. FindContours() method does not work as it cannot be feeded with a pixel.&lt;/p&gt;&#xA;" OwnerUserId="13737" LastActivityDate="2016-04-29T17:07:17.750" Title="How to detect all the connected neighboring pixels which have same color value in opencv" Tags="|image-processing|opencv|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22523" PostTypeId="2" ParentId="22522" CreationDate="2015-04-04T13:30:44.180" Score="1" Body="&lt;p&gt;I think you're looking for &lt;a href=&quot;http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html#floodfill&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;floodFill&lt;/code&gt;&lt;/a&gt;. From the documentation:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The functions &lt;code&gt;floodFill&lt;/code&gt; fill a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at (x,y) is considered to belong to the repainted domain if: [...]&lt;/p&gt;&#xA;&lt;p&gt;Use these functions to either mark a connected component with the specified color in-place, &lt;strong&gt;or build a mask&lt;/strong&gt; and then extract the contour, or copy the region to another image, and so on.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You're probably interested in this flag parameter:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;FLOODFILL_MASK_ONLY&lt;/code&gt; If set, the function does not change the image ( newVal is ignored), and only fills the mask with the value specified in bits 8-16 of flags as described above. This option only make sense in function variants that have the mask parameter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="291" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-04-05T07:14:00.990" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22524" PostTypeId="2" ParentId="22517" CreationDate="2015-04-04T16:07:20.847" Score="0" Body="&lt;p&gt;Your assumption #2 is false.  Zeroing bins does not produce an ideal filter with unity gain in the passband.  Far from it if you look closely (between FFT bins).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-04T21:48:30.450" LastActivityDate="2015-04-04T21:48:30.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22525" PostTypeId="1" AcceptedAnswerId="22526" CreationDate="2015-04-04T17:23:57.470" Score="0" ViewCount="763" Body="&lt;p&gt;I have to Model a chirp signal that was return from a Distance D from target and then multiply with the reference transmitted signal. Which will give me beat frequency signal and then fft to get the range.&#xA;For this I was searching around and find a pulse LFM SAR implementation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Nf=2^10; %number of points for freq. range&#xA;fc=242.4*1E6; %stopfreq&#xA;B=133.5*1E6; %bandwidth&#xA;freq=linspace(fc-B,fc,Nf);&#xA;&#xA;function [resp] = my_sinthSISO_planresp( pos,freq,tar,tar_amp )&#xA;%MY_SINTHSISO_PLANRESP calculates synthetic SISO at position pos response &#xA;%in frequency range freq on target tar(target postion), tar_amp: RCS like.&#xA;%Targets and Array must be in the same (image) plane, which XY-coordinate&#xA;%are represented as complex values.&#xA;&#xA;if nargin &amp;lt; 4, tar_amp=ones(size(tar)); end % tar_amp = 1 if not given&#xA;&#xA;%speed of light&#xA;co=299792458;&#xA;%redistribution of input data&#xA;tar_dim=numel(tar);&#xA;tar=reshape(tar,[1,1,tar_dim]);&#xA;tar_amp=reshape(tar_amp,[1,1,tar_dim]);&#xA;&#xA;freq_dim=numel(freq);&#xA;freq=reshape(freq,[1,freq_dim,1]);&#xA;&#xA;pos_dim=numel(pos);&#xA;pos=reshape(pos,[pos_dim,1,1]);&#xA;&#xA;%% algo&#xA;%targets-elements radial-distances matrix&#xA;D=abs(repmat(tar,[pos_dim,1,1])-repmat(pos,[1,1,tar_dim]));&#xA;D=repmat(D,[1,freq_dim,1]);&#xA;%wavenumber&#xA;k=2*pi*repmat(freq,[pos_dim,1,tar_dim])/co;&#xA;%target amplitude&#xA;tar_amp=repmat(tar_amp,[pos_dim,freq_dim,1]);&#xA;%SISO response&#xA;resp=tar_amp.*exp(-1j*k*2.*D);&#xA;resp=sum(resp,3);&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Question 1: Is resp in a frequency domain? since its dependent on k and k is frequency related.&#xA;Question 2: if its freq domain then why the inverse fft does not give the desired chirp signal. while its showing:&lt;img src=&quot;https://i.stack.imgur.com/FlR5o.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Question 3: If it doesnot represent chirp in frequency domain. Then what it represents?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 4: How can I use this data set to model FMCW. Which means multiplication of the chirp at reference and after shift?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know its quite alot and very basics but I got confused. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15313" LastActivityDate="2015-04-04T19:44:27.683" Title="FMCW SAR chirp return from target modelling" Tags="|matlab|fft|ifft|delay|linear-chirp|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22526" PostTypeId="2" ParentId="22525" CreationDate="2015-04-04T19:44:27.683" Score="0" Body="&lt;p&gt;I am not sure you really understand the processing you do so I will try to explain what you measure.&#xA;When you use the returned chirp mixed against the reference chirp you get an instantaneous phase measurement. When you do the FFT the frequency domain represents distance - since the phase differences are changing faster as the distance is greater.&#xA;The inverse FFT of the Distance will give you (assuming high signal to noise ratio) a periodic signal that is the function of the distance you measured.&#xA;In the graph you show, it is not clear what you show since the phase is not presented.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-04-04T19:44:27.683" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22530" PostTypeId="1" CreationDate="2015-04-05T00:34:33.727" Score="0" ViewCount="744" Body="&lt;p&gt;As a learning exercise I am trying to simulate a simple notch filter with Matlab. For test purposes  I use Matlab to simulate sinewaves of various frequencies and plot frequency vs. gain so I can see the effect of the “notch”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m using the difference equation $$y(n) = x(n) - 2  \cos\theta\cdot  x(n-1) + x(n-2)$$ for this simple notch filter where theta is the notch (say $\pi/3$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought x(n) would be the sample input from the sinewave I generate as test input. I'm just not sure how to account for the sample rate when determining the value of y(n).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I expect, and with comparison to using &lt;code&gt;freqz([1 -2*cos(theta) 1],1)&lt;/code&gt;,  I get a good match with a sample rate of 10 and a difference equation as shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n)=  f_s [x(n) -2\cos(\theta/f_s)\cdot x(n-1) + x(n-2)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but, as I change the sample rate there is a huge effect on the gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?  My guess is I just don't understand how to account for a change to the sample rate in the difference equation but I haven't seen a good write up on this anywhere&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simple code is shown below.  As I change sample rate (from 10 to 100 and 1000) the frequency response appears to be correct but the gain appears to be decreasing by 20dB for each power of 10 I increase the sample frequency. Maybe that’s the clue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;..... CODE ..  (You can tell I'm quite new to Matlab also... apologies for style!)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=10;  %Specify Sampling Frequency&#xA;&#xA;Ts=1/fs; %Sampling period.&#xA;&#xA;fb=100;    % Number of frequencies to try&#xA;&#xA;&#xA;mb=zeros(fb,2);   %Results   (Max / Freq)&#xA;&#xA;w=0.001;           %Frequency of input wave to be samples  (Don't use DC!)&#xA;fb_indx=1;         %Index into the results array&#xA;&#xA;&#xA;THETA=pi/3;          %For a simple test&#xA;while fb_indx &amp;lt; (fb+1)&#xA;&#xA;    Ns=round(2*pi*fs/w);  %Nr of time samples to be plotted.&#xA;&#xA;    t=[0:Ts:Ts*(Ns-1)];  %Make time array that contains Ns elements&#xA;                     %t = [0, Ts, 2Ts, 3Ts,..., (Ns-1)Ts]&#xA;&#xA;&#xA;&#xA;     mb(fb_indx,1)=w;  %Store current test frequency&#xA;&#xA;     y=zeros(1,Ns);     %Result (y(n))&#xA;&#xA;     x=sin(w*t); %create sampled sinusoids at different frequencies&#xA;&#xA;% Here for the notch&#xA;&#xA;  for n = 3:Ns  % loop for number of samples&#xA;&#xA;     y(n) = fs*(x(n)-(2*cos(THETA/fs)*x(n-1))+x(n-2));  % calculate y&#xA;&#xA;  end&#xA;&#xA;% Obtain max. response&#xA;  M=max(y);                %Look for highest peak in result&#xA;&#xA;  mb(fb_indx,2)=20*log10(M);  %and store in 20log10 value&#xA;&#xA;    fb_indx=fb_indx+1;&#xA;&#xA;      w=w+(pi/fb);  %Get next frequency  &#xA;&#xA;  end;&#xA;&#xA;% Plot result&#xA;&#xA;&#xA;figure % create new figure&#xA;&#xA;subplot(2,2,1)           % first subplot&#xA;&#xA;plot(mb(:,1),mb(:,2));&#xA;xlabel('Freq - rad/s');&#xA;ylabel('20log10 Magnitude');&#xA;axis([0 pi -100 20]);&#xA;&#xA;grid on;&#xA;&#xA;subplot(2,2,2);&#xA;plot(x);&#xA;title('Input');&#xA;&#xA;subplot(2,2,3); &#xA;plot(y);&#xA;title('Output');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15311" LastEditorUserId="4298" LastEditDate="2015-04-05T11:04:48.900" LastActivityDate="2015-04-07T20:55:09.887" Title="How to account for sample rate in a FIR Digital Filter?" Tags="|matlab|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22531" PostTypeId="1" CreationDate="2015-04-05T00:41:55.370" Score="0" ViewCount="344" Body="&lt;p&gt;A friend of mine implemented a DFT algorithm for a project we're working on, and we're not quite sure how to test whether or not its correct. We're only in the eleventh grade, so we have very little experience in Fourier Analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I remembered reading somewhere that the Fourier transform of the square wave function was the sinc function, so we thought that if the output of the program was the sinc function then the implementation was correct, but we quickly realized it wouldn't be that simple. Below is a picture of what the program outputs (blue is DFT scaled logarithmically to be in decibels):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M9i2p.jpg&quot; alt=&quot;enter image description here&quot;&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is essentially the same as above only with lines instead of a solid fill:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wp7oR.jpg&quot; alt=&quot;enter image description here&quot;&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hmm, well that doesn't look anything like the sinc function. After looking at the code, I realized it was actually a plot of $\sqrt{r^2 + i^2}$ where $r$ and $i$ are the real and imaginary parts of the DFT respectively. So now I'm out of ideas as to how to test the validity of this program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the output look correct? What other tests can we perform to verify the implementation?&lt;/p&gt;&#xA;" OwnerUserId="15316" LastActivityDate="2015-04-05T09:49:03.430" Title="How can I test an implementation of DFT for correctness?" Tags="|dft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22533" PostTypeId="1" CreationDate="2015-04-05T02:44:28.877" Score="1" ViewCount="256" Body="&lt;p&gt;I have an 8khz mono buffer of samples, and I am trying to manipulate the playback speed of it by modifying the number of samples in it.  When slowing down (a speedScale value of 0.5 for example) then the values are repeated-- a buffer of samples: [0.1, 0.2, 0.3..] becomes [0.1, 0.1, 0.2, 0.2, 0.3, 0.3 ..].  When I do this, although the speed has slowed down correctly, I am noticing aliasing happening.  I was under the impression that repeating samples like this would not require low pass filtering to avoid aliasing.  Am I doing something wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code for slowing-down/speeding-up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function process(buffer, speedScale) {&#xA;    size = ceil(buffer.size / speedScale);&#xA;&#xA;    counter = 0.0;&#xA;    ratio = 1 * speedScale;&#xA;    processed = [];&#xA;&#xA;    for (i = 0; i &amp;lt; size; i++) {&#xA;        index = floor(counter);&#xA;        processed[i] = buffer.samples[index];&#xA;        counter += ratio;&#xA;    }&#xA;    return processed;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11807" LastActivityDate="2015-04-06T07:18:54.147" Title="Why does slowing down audio introduce aliasing?" Tags="|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22534" PostTypeId="2" ParentId="22531" CreationDate="2015-04-05T02:52:44.263" Score="1" Body="&lt;p&gt;The simplest way to test your DFT algorithm is to get hold of a free FFT program and give it (and also your DFT program) identical inputs.  There are many free versions of FFTs on the Internet (eg: &lt;a href=&quot;http://sourceforge.net/projects/kissfft/&quot; rel=&quot;nofollow&quot;&gt;http://sourceforge.net/projects/kissfft/&lt;/a&gt;).   And an FFT is just a faster, more efficient, more accurate DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also see that your pictures seem to show a label of 'signed integer,' so you should make sure that the FFT code you use to compare to your DFT can handle that type of input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your pictures look suspect - it seems to be a square wave with a lot of ringing to it.  Are you sure you're not using a sinc function as your input?  And if those pictures are supposed to be outputs, why are they slightly asymmetrical?(note the differences of the left side/right side square wave edges).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT (or DFT) testing can actually get far more complicated, since you have to be familiar with testing strategies and inputs that exercise your code to the fullest.  There is no one input test pattern that will detect all code bugs.  And although an FFT will often give you a slightly different output than a DFT, those differences are not usually significant for many users.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2015-04-05T02:52:44.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22535" PostTypeId="1" AcceptedAnswerId="22544" CreationDate="2015-04-05T03:26:55.250" Score="1" ViewCount="512" Body="&lt;p&gt;I'm working on a presentation on audio synthesis for some fellow software engineers. I want to include some &quot;fourier synthesis&quot; creating time domain samples from frequency domain samples using ifft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of interesting sounds that can be easily synthesized with ifft?  I can do (bandlimited) square, saw, and triangle waves already, but i'm thinking more along the lines of voice or stringed instruments or something.  Does anyone know of anything that would be a simple to understand but interesting demo for fourier synthesis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-05T15:13:53.450" Title="What interesting audio can be synthesized with ifft" Tags="|audio|ifft|signal-synthesis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22536" PostTypeId="1" AcceptedAnswerId="22590" CreationDate="2015-04-05T05:31:56.087" Score="2" ViewCount="5145" Body="&lt;p&gt;I don't completely understand the term &quot; frequency&quot; with respect to digital image processing.&#xA;for 1D electrical signals , its pretty easy to understand , visually too.&#xA;higher the frequency - more packed( or closer) the signal looks in a given time interval than its lower frequency counterpart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when it comes to images , with parameters like intensity, 8-bit gray scale, pixel value,etc. - what does frequency mean ?  &lt;/p&gt;&#xA;" OwnerUserId="15319" LastActivityDate="2015-04-07T12:25:33.213" Title="what are frequencies in a digital image?" Tags="|frequency|image-processing|digital|" AnswerCount="3" CommentCount="1" ClosedDate="2015-04-08T08:05:31.117" ContentLicense="CC BY-SA 3.0" />
  <row Id="22537" PostTypeId="2" ParentId="22531" CreationDate="2015-04-05T06:09:33.780" Score="1" Body="&lt;p&gt;see what the output of your DFT is with all zeros for the input, $x[n]=0$ (output should be all zeros, $X[k]=0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then see what the output is for all zero input except $x[0]=1$ (should be all $X[k]=1$, depending on scaling).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then see what the output is for all zero input except for $x[1]=1$ (should be $X[k]=e^{-j2\pi k/N}$, with the same scaling).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then see what the output is for all zero input except for $x[2]=1$ (should be $X[k]=e^{-j4\pi k/N}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then see what the output is for all zero input except for $x[3]=1$ (should be $X[k]=e^{-j6\pi k/N}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you do that for enough of these samples, it should be okay for general input unless there are numerical problems.  is this a floating or fixed-point DFT?&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-05T06:09:33.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22538" PostTypeId="2" ParentId="22536" CreationDate="2015-04-05T07:43:59.050" Score="0" Body="&lt;p&gt;In images, intensity means amplitude and you can see it as in 1D case.&lt;br&gt;&#xA;More packed (or change of intensity) in 2D area is higher frequency.&lt;br&gt;&#xA;Note that, this way is just visual approximation by human's eyes.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2015-04-05T07:43:59.050" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22539" PostTypeId="2" ParentId="22531" CreationDate="2015-04-05T09:49:03.430" Score="2" Body="&lt;p&gt;A very quick and easy test that catches all relevant structural mistakes follows from a fundamental property of the Fourier transform (and also its inverse): It is a square root of the sequence order reversal operator. That means applying your implementation twice on a data vector will reverse the sequence order and applying it four times will give your original data back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this requires the so called unitary scaling convention, where the Fourier transform and its inverse share the same scaling factor. Otherwise you will get back a scaled version of the original signal.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-04-05T09:49:03.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22541" PostTypeId="2" ParentId="22530" CreationDate="2015-04-05T11:02:39.250" Score="1" Body="&lt;p&gt;The sampling frequency is hidden in your variable $\theta$. The angle $\theta$ determines the frequency of the notch &lt;em&gt;relative to the sampling frequency&lt;/em&gt;, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\theta=2\pi\frac{f}{f_s}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f$ is the notch frequency in Hertz, and $f_s$ is the sampling frequency (in Hertz). So if you want to change the sampling frequency while leaving the notch frequency unchanged, you need to change the angle $\theta$ according to Eq. (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gain of your filter depends on the normalized frequency variable $\theta$. At DC the gain is $2(1-\cos\theta)$, and at Nyquist you get a gain of $2(1+\cos\theta)$. By normalization you can keep one of those two gain factors normalized to $1$, but never both. If you want a gain of $1$ at DC &lt;em&gt;and&lt;/em&gt; at Nyquist you need an IIR filter or a higher order FIR filter.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-04-07T20:55:09.887" LastActivityDate="2015-04-07T20:55:09.887" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22542" PostTypeId="1" AcceptedAnswerId="22545" CreationDate="2015-04-05T13:26:17.370" Score="0" ViewCount="1601" Body="&lt;p&gt;so Im given a discrete sum $$x[n] = \sum\limits_{r=\infty}^{+\infty}\delta[n-rN]$$&#xA;how do I calculate its discrete Fourier series coefficients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: this is what i've come to up to now:&lt;img src=&quot;https://i.stack.imgur.com/4cEDD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15323" LastEditorUserId="15323" LastEditDate="2015-04-05T14:58:13.043" LastActivityDate="2015-04-05T16:57:36.450" Title="Discrete Fourier series for a sum of deltas" Tags="|discrete-signals|periodic|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22544" PostTypeId="2" ParentId="22535" CreationDate="2015-04-05T15:13:53.450" Score="3" Body="&lt;p&gt;You can take a look at &lt;a href=&quot;http://photosounder.com/&quot; rel=&quot;nofollow&quot;&gt;Photosounder&lt;/a&gt;. The idea behind is simple: Take an image as if it were an spectrogram and compute its IFFT, the result is  always interesting at least! It tends to work better with abstract images and geometric shapes, a great example is the video on the upper-right corner, &quot;The sound of fractals&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would never try to replicate a real instrument using this method, but you can encourage your fellows to try it as a challenge...&lt;/p&gt;&#xA;" OwnerUserId="15324" LastActivityDate="2015-04-05T15:13:53.450" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22545" PostTypeId="2" ParentId="22542" CreationDate="2015-04-05T15:57:29.200" Score="1" Body="&lt;p&gt;$\sum\limits_{r=-\infty}^{\infty}\delta[n-rN]$ is a periodic Kronecker delta with period $N$, but the sum to get the fourier coefficients only &quot;uses&quot; one period $\sum\limits_{n = 0}^{N-1}$ so you don't have to worry about the periodic extension of $\delta$ and take just $x[n] = \delta[n]$ as your function. This is going to cancel out every exponential in the sum except when $n=0$, so the result will be independent of the particular coefficient and be just $a_k = 1/N$.&lt;/p&gt;&#xA;" OwnerUserId="15324" LastEditorUserId="15324" LastEditDate="2015-04-05T16:57:36.450" LastActivityDate="2015-04-05T16:57:36.450" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22547" PostTypeId="2" ParentId="22542" CreationDate="2015-04-05T16:52:22.353" Score="0" Body="&lt;p&gt;If you draw the sequence $x[n]$ you'll see right away how it works. You have an impulse at $n=0$, at $n=-N$, at $n=N$, etc. But if you sum over only &lt;em&gt;one&lt;/em&gt; period, no matter which period you choose, there's always only &lt;em&gt;one&lt;/em&gt; impulse in that period. So you're left with only one sum index contributing to the final result. I'm sure you can take it from here.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-05T16:52:22.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22549" PostTypeId="2" ParentId="22536" CreationDate="2015-04-05T17:07:08.437" Score="0" Body="&lt;p&gt;Consider a photo of a long picket fence (white pickets against a dark background).  The closer together the pickets are in the image, the higher the frequency in &quot;horizontal-pickets-per-1024-pixels&quot;, or whatever.  That would be a large component of the frequency in the Y direction for a 2D photo.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-05T17:07:08.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22552" PostTypeId="1" CreationDate="2015-04-05T21:19:05.700" Score="1" ViewCount="141" Body="&lt;p&gt;We know optical flow equation cannot be calculated without additional constraints. But what I cannot figure out is why it does not hold exactly for real images? This equation has gradient and so, it can be used to estimate the motion vectors by focusing on edges. Is it correct? How we add other constraints like smoothness into account?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15003" LastActivityDate="2015-10-08T08:43:03.107" Title="Optical flow equation and real images" Tags="|image-processing|motion-detection|optical-flow|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22553" PostTypeId="1" AcceptedAnswerId="22959" CreationDate="2015-04-06T01:12:59.723" Score="1" ViewCount="88" Body="&lt;p&gt;We would like to send a video (sequence of images), we have limit bandwidth. If there is a lot of noise, the required bandwidth (bitrate) is needed to send the video+noise becomes high that is not suitable. We have just a noisy file (i.e. we do not have noise separately). The solution is to model the noise. we do not have any other information rather than a noisy video. How we can reduce the noise? How we can model the noise?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="15003" LastEditDate="2015-04-06T01:22:01.310" LastActivityDate="2015-05-24T10:30:51.680" Title="Noise modeling and reduction in Video when we have just noisy video" Tags="|image-processing|discrete-signals|noise|video-processing|video-compression|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22555" PostTypeId="2" ParentId="22235" CreationDate="2015-04-06T03:33:00.750" Score="1" Body="&lt;p&gt;Features are properties of the signal used to describe it in some way. Sometimes the term &quot;descriptors&quot; is used, for example &lt;a href=&quot;http://en.wikipedia.org/wiki/MPEG-7&quot; rel=&quot;nofollow noreferrer&quot;&gt;MPEG-7&lt;/a&gt; audio-visual description standard: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OL0Hu.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time domain features are computed from the audio waveform, while frequency-domain or spectral features are derived after performing an FFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should look through a feature-extraction software package like &lt;a href=&quot;http://yaafe.sourceforge.net/features.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yaafe&lt;/a&gt;, to get some practical intuition. There are also many &lt;a href=&quot;http://luthuli.cs.uiuc.edu/~daf/courses/CS-498-DAF-PS/Lecture%208%20-%20Audio%20Features2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorials&lt;/a&gt; and &lt;a href=&quot;http://recherche.ircam.fr/anasyn/peeters/ARTICLES/Peeters_2003_cuidadoaudiofeatures.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;papers&lt;/a&gt; online for further learning. &lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-04-06T03:33:00.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22556" PostTypeId="1" AcceptedAnswerId="22563" CreationDate="2015-04-06T03:42:38.313" Score="3" ViewCount="12795" Body="&lt;p&gt;As we have in Laplace transform that the roots decide the stability of the system i.e. if the roots are complex and lie in the left side of the plane you get a sinusoidal response with decreasing amplitude &lt;/p&gt;&#xA;&#xA;&lt;p&gt;similarly is there any significance of the roots , zeros and  ROC of the z-transform and the stability criteria . All i read in books is how to find the ROC and the properties of z transform like linearity ,time reversal,time shifting . It has nowhere mentioned why we are even using z-transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my  apologies if this question is too basic or if it shouldn't belong here.&lt;/p&gt;&#xA;" OwnerUserId="15334" LastActivityDate="2015-04-06T15:11:58.443" Title="What is the significance of Z-transform?" Tags="|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22557" PostTypeId="2" ParentId="22533" CreationDate="2015-04-06T04:01:50.320" Score="1" Body="&lt;p&gt;square, triangle and saw waves have aliasing because they have sharp corners.  Those sharp corners take frequencies beyond Nyquist to make perfectly sharp.  When you repeat samples to slow it down, you are introducing sharp corners and thus are introducing aliasing.  Hopefully that is a decent intuitive explanation.  There is surely a more formal math heavy explanation as well (:&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-06T04:01:50.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22558" PostTypeId="1" AcceptedAnswerId="22559" CreationDate="2015-04-06T05:07:38.637" Score="1" ViewCount="364" Body="&lt;p&gt;I am working on analysis of baby cry signal. fundamental frequency(Fo) of signal is already estimated using auto correlation and cepstrum analysis. cry signal is inputted in .wav format. now i want to do short time fourier transform analysis of same signal inorder to find variations in fundamental frequency over the time and plot its &quot;pitch contour&quot;. i.e. Fo v/s t. its like finding Fo value for each small interval and plotting over time to see the variability. pls, can anybody help me with the matlab code? &lt;/p&gt;&#xA;" OwnerUserId="15336" LastActivityDate="2015-04-06T05:45:32.950" Title="Short Time Fourier Transform analysis of newborn baby cry signal" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22559" PostTypeId="2" ParentId="22558" CreationDate="2015-04-06T05:45:32.950" Score="1" Body="&lt;p&gt;Have a look at &lt;a href=&quot;http://labrosa.ee.columbia.edu/projects/SAcC/&quot; rel=&quot;nofollow&quot;&gt;SAaC&lt;/a&gt; from &lt;a href=&quot;http://labrosa.ee.columbia.edu/&quot; rel=&quot;nofollow&quot;&gt;LabROSA&lt;/a&gt;. You also might be interested in &lt;a href=&quot;https://github.com/dpwe/pitchflow&quot; rel=&quot;nofollow&quot;&gt;delta pitch without explicit pitch tracking&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-04-06T05:45:32.950" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22561" PostTypeId="2" ParentId="22533" CreationDate="2015-04-06T07:18:54.147" Score="2" Body="&lt;p&gt;That's because you are interpolating the signal. Take a look at this figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xphXD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is zero interpolation, i.e. inserting zeros between samples, but applies to your case too. The replicas at 2*pi are distorting your signal. You can see them in the third graph, at -2pi/L, +2pi/L. So, you need a low pass filter with a cut off frequency pi/L, after expander. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the expander's output dtft will be X(w*2) + exp(-jw)*X(w*2), assuming input signal's dtft X(w). So, your extrapolator output will look a bit different, but the idea is the same.&lt;/p&gt;&#xA;" OwnerUserId="14939" LastActivityDate="2015-04-06T07:18:54.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22562" PostTypeId="1" CreationDate="2015-04-06T08:29:20.033" Score="0" ViewCount="119" Body="&lt;p&gt;I have two &quot;sources&quot; of audio:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;record WAV audio files (44.1kHz, 16bit, stereo) with Linux arecord and convert them with LameMP3Encoder to MP3 files (44.1kHz, 320kbps, 32bit**, CBR)***&lt;/li&gt;&#xA;&lt;li&gt;record MP3 audio files (44.1kHz, 320kbps, 16bit, CBR) directly* using Darkice and LameMP3Encoder&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;No I need to calculate MFCCs of the same section in both sources. As I was told &lt;a href=&quot;https://dsp.stackexchange.com/questions/21984/why-are-mfccs-of-two-equivalent-signals-completely-different&quot;&gt;here&lt;/a&gt;, it is important for MFCCs to keep the same format throughout my workflow. &lt;strong&gt;Will the coefficients come out different for the two cases?&lt;/strong&gt;&#xA;And if so, how could I solve my issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*whatever Darkice is doing in the background&lt;br&gt;&#xA;**I think this could be changed to 16bit if needed&lt;br&gt;&#xA;***Does it change the WAV files when I open them with Adobe Audition don't modify anything but click 'Save As' and keep the format the same?&lt;/p&gt;&#xA;" OwnerUserId="15020" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-04-06T15:51:59.643" Title="Formatting issue WAV - MP3?" Tags="|audio|wave|mp3|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22563" PostTypeId="2" ParentId="22556" CreationDate="2015-04-06T09:15:35.557" Score="7" Body="&lt;p&gt;First of all, I think you're reading the wrong books. Almost any basic text on DSP has a chapter on the $\mathcal{Z}$-transform and its significance to describe linear time-invariant (LTI) discrete-time systems. If you're looking for good (and free) books, take a look at &lt;a href=&quot;https://dsp.stackexchange.com/questions/18564/a-dsp-simple-book-reference/18568#18568&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will not repeat all the details you can find in those books (and in many other places), but let me just point out a few very basic things to get you started. Each (single) pole $p$ of the transfer function $H(z)$ of a causal LTI discrete-time system contributes a term&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c\cdot p^nu[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to the system's impulse response, where $c$ is some constant, $p$ is the (possibly complex) pole, and $u[n]$ is the discrete-time unit step function. From (1) it is clear that this contribution only decays with time if $|p|&amp;lt;1$. So for a causal system to be stable we require that all the poles of the transfer function are &lt;em&gt;inside&lt;/em&gt; the unit circle of the complex plane, i.e. they have magnitudes smaller than $1$. So if you're looking for analogies with the Laplace transform, the inside of the unit circle corresponds to the left half plane of the complex variable $s$. Furthermore, the unit circle of the $z$-plane corresponds to the $j\omega$-axis. Knowing these two things, it becomes very easy to carry over everything you know about transfer functions of continuous-time systems (Laplace transform) to the discrete-time domain ($\mathcal{Z}$-transform).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-04-06T15:11:58.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22564" PostTypeId="1" CreationDate="2015-04-06T10:57:22.273" Score="6" ViewCount="3256" Body="&lt;p&gt;I am trying to find the period of a pulse train like signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have reviewed the following questions but I did not find a clear-cut answer to the problem, &lt;a href=&quot;https://dsp.stackexchange.com/questions/12892/train-pulse-recognition-in-medium-voltage-networks&quot;&gt;12892&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/16502/comb-like-peaks-in-frequency-spectrum&quot;&gt;16502&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/6260/determining-the-period-of-a-discontinuous-function&quot;&gt;6260&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know the period nor the pulse width. I work with windows that will contain between 2 and 16 pulses. Pulses may vary in length but will usually be shorter than half the period. The signal may be noisy, although I would be happy with a solution for the case of the (relatively) clean signal. I can work out a minimal pulse width if it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are plots of the type of signal I am working with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/P5Vq3.png&quot; alt=&quot;clean pulse train&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7kVTT.png&quot; alt=&quot;noisy pulse train&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am primarily interested in the period of the signal. The analysis needs not to be online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first example, I'm looking to find a result of about 136.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first attempt was to look at the signal in the frequency domain. But a pulse train in time domain is also a pulse train in frequency domain. I got this plot for the clean signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ncYQC.png&quot; alt=&quot;FFT clean signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next I tried autocorrelation. I got the following:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yprfL.png&quot; alt=&quot;Autocorrelation clean&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is much better. I need to get the value automatically though, and I'm not too sure how to find that second local maxima without introducing too much ad-hoc thresholds that may fail when there are more or less peaks in the window. Additionally, I'm looking for a floating point result.&#xA;Also, the autocorrelation for the noisy signal was much less clear cut, even after smoothing the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is probably another approach by detecting the rising edges in time domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a standard way to estimate the period of a pulse train?&lt;/li&gt;&#xA;&lt;li&gt;If autocorrelation is the right approach, how to automatically find the floating point coordinate of the peak from the autocorrelation result without too many assumptions?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="500" LastActivityDate="2015-04-08T08:30:50.163" Title="How to estimate the period of a pulse train?" Tags="|frequency-spectrum|estimation|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22566" PostTypeId="2" ParentId="22511" CreationDate="2015-04-06T13:50:55.160" Score="0" Body="&lt;p&gt;I am afraid that the question is trying to probe a very wide range of issues to receive a truly meaningful answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, this would be a classification problem. As such, you would need to decide on a number of features which would reflect the key changing characteristics of your images and a classifier which, after being trained, would be able to discriminate between your different gestures. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Statistical_classification&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Statistical_classification&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issues of how many training images you need per gesture and which features and classifier, all depend on your environment and specifics of your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest thing you can do is template matching, where you would simply compare an acquired image of a gesture with stored images of gestures. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Template_matching&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Template_matching&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But of course, this approach is a tiny step forward. What about changing backgrounds, different pairs of hands, scaling of the objects because of different distances to the camera, slight rotations, occlusions... ? And then, once the static recognition is done, you will have to consider the version that works on uninterrupted video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are things you can do to deal with these issues but for robust recognition, it is likely that you will need to move to 3D data representing the movement of hands in space. (For example: &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S1077314210001748&quot; rel=&quot;nofollow&quot;&gt;http://www.sciencedirect.com/science/article/pii/S1077314210001748&lt;/a&gt; ). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can acquire 3D data in a number of ways, e.g. virtual reality gloves (please see: &lt;a href=&quot;http://dx.doi.org/10.1109/IJCNN.1999.832699&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1109/IJCNN.1999.832699&lt;/a&gt;), devices such as kinect (please see: &lt;a href=&quot;http://dx.doi.org/10.1109/ICSESS.2012.6269439&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1109/ICSESS.2012.6269439&lt;/a&gt;) and plain simple accelerometers (please see: &lt;a href=&quot;http://dx.doi.org/10.1109/JSEN.2011.2166953&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1109/JSEN.2011.2166953&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest method to start with 3D data is the one based on accelerometers. In this case you would be working with time-series data (e.g. timestamp, acceleration vector). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy to amend the response if you provide more specific data about your application.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-04-06T13:50:55.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22567" PostTypeId="1" AcceptedAnswerId="22568" CreationDate="2015-04-06T14:54:17.870" Score="0" ViewCount="31" Body="&lt;p&gt;To send a $10 \, KHz$ bandwidth of speech (Non Filtered speech), Nyquist criteria says that sampling duration should be $50 \, \mu s$. While for a $4 \, KHz$ bandwidth of filtered speech, sampling duration should be $125 \, \mu s$ (Much larger than $50 \, \mu s$.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now an excerpt taken from my textbook:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;In general, the wider the $BW$ of a signal, the more &quot;expense&quot; it will be to transmit the signal. So it is much &quot;cheaper&quot; to send a filtered speech over a communication link.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the factors related to the words &quot;expense&quot; and &quot;cheaper&quot; mentioned here? What does author mean by using these two words?&lt;/p&gt;&#xA;" OwnerUserId="15340" LastActivityDate="2015-04-06T15:08:05.547" Title="Sending a Filtered vs Non-Filtered speech over a Communication Link" Tags="|sampling|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22568" PostTypeId="2" ParentId="22567" CreationDate="2015-04-06T15:08:05.547" Score="1" Body="&lt;p&gt;It can mean a number of things; some examples are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Converters (analog to digital as well as digital to analog) go up in price and in power consumption as the sampling rate increases.&lt;/li&gt;&#xA;&lt;li&gt;In very general terms, analog circuits capable of handling signals of larger bandwidth are more expensive than narrower-band circuits. Compare the cost of a 741 op-amp to a 2082's.&lt;/li&gt;&#xA;&lt;li&gt;In the digital domain, a higher sampling rate implies more calculations per second, which in turn implies higher-performance digital circuits and more power consumption.&lt;/li&gt;&#xA;&lt;li&gt;Channel bandwidth has a cost. In wireless communications, you either have to license a band or use an unlicensed band (such as ISM). ISM bands are subject to interference and put limits on the power you can radiate. In wireline communications, wire cost goes up with bandwidth -- compare the cost of twisted pair to coax to thunderbolt wires.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-04-06T15:08:05.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22569" PostTypeId="1" CreationDate="2015-04-06T16:43:25.800" Score="1" ViewCount="53" Body="&lt;p&gt;I want to define a function $y(t)$ that has 2 cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=&#xA;\begin{cases}&#xA;-1 &amp;amp; \text{for} &amp;amp; -T \lt t \leq 0 \\&#xA;1 &amp;amp; \text{for} &amp;amp; 0 \lt t\leq T&#xA;\end{cases}&#xA;$$&#xA;where $T$ is an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already defined $t$ using linspace between $-T$ to $T$ in a resolution of 1000 points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was advised to use the command &lt;code&gt;ones&lt;/code&gt;, but I dont know how to apply it by the function terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15323" LastEditorUserId="8202" LastEditDate="2015-06-06T13:32:29.750" LastActivityDate="2015-06-06T13:32:29.750" Title="Using MATLAB to define a function in signal processing 101" Tags="|matlab|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22570" PostTypeId="1" AcceptedAnswerId="22589" CreationDate="2015-04-06T17:38:26.970" Score="0" ViewCount="361" Body="&lt;p&gt;I'm writing software and the data reporting frequency is slower than the acquisition cycle, so effectively sub-sampling is being done.  Different data types require different methods of sub-sampling which I'm tempted to call a &lt;code&gt;Gating method&lt;/code&gt; where oversampled data in one time domain goes through a &lt;code&gt;Gate&lt;/code&gt; to another time domain. &lt;code&gt;Windowing&lt;/code&gt; also comes to mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hesitate though as although these terms imply an interval of focus/ interest, they might not necessarily imply continuity between intervals; back to back intervals where no input is ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such methods might be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Average/Median since last report (or low pass filter)&lt;/li&gt;&#xA;&lt;li&gt;Min/Max since last report&lt;/li&gt;&#xA;&lt;li&gt;Sticky flags (a bit field who's bits are cleared when read)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a better term than &lt;code&gt;Gate&lt;/code&gt; or &lt;code&gt;Window&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;Note 1: This is borderline a programming question or code review, but I think still more for signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note 2: Although sub-sampling causes signal artifacts such as aliasing.  This is not part of the question.&#xA;&lt;/p&gt;&#xA;" OwnerUserId="8459" LastActivityDate="2015-04-08T07:44:37.590" Title="Subsampling data: terminology" Tags="|window-functions|terminology|window|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22571" PostTypeId="2" ParentId="22167" CreationDate="2015-04-06T17:56:41.537" Score="1" Body="&lt;p&gt;Maximum $d$ you may get is a total number $N$ of $y_n$'s you have - 1. Larger $d$'s yield curvatures that can't be represented by N points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solve a matrix equation $A\vec{t}=\vec{y}$ where $\vec{y}$ is a measurements vector (size $N \times 1$) and $A$ is a normalized version of matrix $X$ (size $N \times N$), where each column $A_j$ is calculated as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A_{ij} = \frac {X_{ij}} {\sum \limits_j (X_{ij})^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X = \left [ \begin{matrix}&#xA;x_0^0 &amp;amp; \cdots &amp;amp;x_0^{N-1} \\&#xA;\vdots &amp;amp; \ddots &amp;amp; \vdots \\&#xA;x_{N-1}^0 &amp;amp; \cdots &amp;amp; x_{N-1}^{N-1}&#xA;\end{matrix} \right ]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;d you are interested in is a position of largest coefficient in a vector $\vec{t}$ (size $N \times 1$ starting from zero). Your approximation would be $y = t_d \cdot x^d$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can achieve better results if your solver finds solution optimal in $L^1$ sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a sort of exhaustive search, yes.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastEditorUserId="15103" LastEditDate="2015-04-06T18:04:56.523" LastActivityDate="2015-04-06T18:04:56.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22572" PostTypeId="2" ParentId="22234" CreationDate="2015-04-06T18:07:06.437" Score="1" Body="&lt;p&gt;The first one is a purely discrete model. You need to select a discrete solver in the simulation options to accurately simulate this system. The second system however is actually continuous because of the holders, so you need a continuous time solver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The preferred approach depends on what your system is. If you have a discrete model to work on, you should prefer the first one. If you have an actual physical system that you want to control with a microcontroller, you should prefer the second one.&lt;/p&gt;&#xA;" OwnerUserId="15342" LastActivityDate="2015-04-06T18:07:06.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22574" PostTypeId="2" ParentId="22232" CreationDate="2015-04-06T18:29:49.700" Score="2" Body="&lt;p&gt;When you are discretizing you make transformation $s \to e^{s T}$. This transforms the left half plane into unit disc. But actually it only transforms the $(-j\omega_s/2, j\omega_s/2)$ band and repeats itself by circling for outside of the band, where $\omega_s = 2 \pi / T$. This is because of the periodicity of exponential function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you plot the frequency response, you plot $|G(j\omega)|=|\hat{G}(e^{j\omega T})|$ for all $\omega \in [0, \infty)$ where $\hat{G}$ is the discrete transfer function. Therefore the frequency response of any sampled system is periodic.&lt;/p&gt;&#xA;" OwnerUserId="15342" LastActivityDate="2015-04-06T18:29:49.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22575" PostTypeId="2" ParentId="19199" CreationDate="2015-04-06T18:48:42.573" Score="0" Body="&lt;p&gt;If the system is continuous, the system will have an infinitely many fixed points, which is the null space of $A$. If the geometric multiplicity of 0 eigenvalue is less than its algebraic multiplicity, i.e. the dimension of the null space is less than the dimension of the eigenspace of 0, the system is unstable. If they are equal the system is marginally stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the system is discrete, some of the modes will be finite. This means some states of the homogenous system will be 0 within a finite amount of time for any initial condition.&lt;/p&gt;&#xA;" OwnerUserId="15342" LastActivityDate="2015-04-06T18:48:42.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22578" PostTypeId="2" ParentId="22564" CreationDate="2015-04-06T21:29:28.787" Score="2" Body="&lt;p&gt;If all you need to estimate is the period of your pulse train then you can threshold the original waveform and work on the clean one by detecting the rising and falling edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FFT based approach would return an average estimate of its &quot;frame of observation&quot; anyway whose accuracy would depend on the length of the frame. (that is, an average estimate of the buffer that is passed at its input)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are concerned about the noise, use a short moving average filter (for instance a length 3 or length 5) to smooth the curve prior to estimating and applying the threshold. If absolute timings are essential for your application don't forget to take into account the group delay of the filter.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-04-06T21:29:28.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22579" PostTypeId="1" CreationDate="2015-04-06T21:53:25.400" Score="0" ViewCount="984" Body="&lt;p&gt;I'm new in this forum! ... and I'm not an expert in signal processing! ... So I hope to find help here:-)&lt;br&gt;&#xA;I was wondering if someone could point me to an algorithm/technique that is used to compare time dependent signals. Ideally, this hypothetical algorithm would take in 2 signals as inputs and return a number that would be the percentage similarity between the signals.&#xA;In other terms I’m looking for a technique that allows to establish a degree of “similarity” between the two signals even if there is a delay or a shift between them. Obviously, if this technique could be implemented in a recursive way or with a small number of point ...it would be great! :-) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15345" LastEditorUserId="13320" LastEditDate="2016-11-21T13:15:49.753" LastActivityDate="2016-11-21T13:15:49.753" Title="Looking for an algorithm that computes &quot;Similarity&quot; between two signals" Tags="|discrete-signals|correlation|waveform-similarity|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22580" PostTypeId="2" ParentId="2321" CreationDate="2015-04-06T22:15:58.150" Score="4" Body="&lt;p&gt;There is an intuitive proof that upsampling before cross-correlation is equivalent to doing it afterwards:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross-correlation is convolution with the other signal time-reversed. Time reversal does not affect the bandwidth. Convolution is multiplication in the frequency domain, which also does not increase the bandwidth. If the original signals are properly band-limited, to half the sampling frequency, then so will the cross-correlation result be. No aliasing is introduced to ruin the result. Interpolation afterwards saves work.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-07T05:06:59.560" LastActivityDate="2015-04-07T05:06:59.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22581" PostTypeId="2" ParentId="22579" CreationDate="2015-04-07T01:13:45.380" Score="1" Body="&lt;p&gt;Coherence? As in: &lt;a href=&quot;http://en.wikipedia.org/wiki/Coherence_(signal_processing)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Coherence_(signal_processing)&lt;/a&gt;. By comparing the signal spectrums, you get real number numbers between 0 and 1, which each number is a measure of the similarity of the two signals at each frequency.  But it might be difficult for a beginner to understand and program.  You might look for simpler explanations and/or examples by doing a Google search for 'signal coherence', which results in about 17 million hits.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2015-04-07T01:13:45.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22582" PostTypeId="1" CreationDate="2015-04-07T01:16:46.907" Score="1" ViewCount="823" Body="&lt;p&gt;I'm working on a realtime FFT processing algorithm in C using PortAudio.  Currently I'm just trying to test if I can do OLA / OLS in (semi) real time using FFTW.  I'm getting some distortion in the output when applying 2x sin and cos windows on the real signal before and after FFTW using the trig identity sin^2+cos^2=1.  This should be an identity system but there is some added distortion on the output.  I'm only using powers of 2 for the transform currently.  Any ideas on why this distortion is occurring?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Eric&lt;/p&gt;&#xA;" OwnerUserId="15279" LastEditorUserId="4346" LastEditDate="2017-01-05T04:11:29.060" LastActivityDate="2017-01-05T04:11:29.060" Title="Overlap add / overlap save using FFTW" Tags="|fft|fast-convolution|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22583" PostTypeId="2" ParentId="22564" CreationDate="2015-04-07T04:07:17.963" Score="0" Body="&lt;p&gt;I can offer the following algorithm:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the autocorrelation of signal. &lt;/li&gt;&#xA;&lt;li&gt;Find the positions of the maximums in the autocorrelation - $t_i$. Rejecting false peaks by some algorithms (by threshold?)&lt;/li&gt;&#xA;&lt;li&gt;Ideally it must be $t_i=i*T$, where $T$ is period of pulse train. Your data has some errors, so use linear regression to calculate $T$ and to estimate errors.     &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I think you can use standart method of fitting data to Straight Line. See for example explanation in 15.2 of &quot;Numerical Recipes in C&quot; &lt;a href=&quot;http://apps.nrbook.com/c/index.html&quot; rel=&quot;nofollow&quot;&gt;http://apps.nrbook.com/c/index.html&lt;/a&gt; (page 661-662)&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2015-04-07T04:07:17.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22584" PostTypeId="2" ParentId="22579" CreationDate="2015-04-07T04:21:38.293" Score="0" Body="&lt;p&gt;As a fellow person who might have difficulty implementing that, shooting from the hip I might try taking the fft of the two signals, treating that as a complex value vector of N dimensions where N is the number off fft bins, normalizing the vectors (or maybe not) and then doing a dot product to get a similarity value.  1 would mean they were exactly alike and -1 would mean they were negatively correlated so maybe take the absolute value of the dot product, if you want to count negative correlation as a strong similarity.  Might work, might be problematic, not sure, but intuitively it feels like there's something there.&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-07T04:21:38.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22585" PostTypeId="2" ParentId="22569" CreationDate="2015-04-07T04:38:46.587" Score="1" Body="&lt;p&gt;Well, this is Octave but should work in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function y=Y(t)&#xA;  y=ones(size(t));&#xA;  y=y+(t&amp;lt;=0)*(-2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.. and it is vectorised. Calling will look like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;t=linspace(-T,T,1000);&#xA;&amp;gt;y=Y(t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To make this more general we could also make the time at which the function switches a parameter also:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function y=Y(t,S)&#xA;  y=ones(size(t));&#xA;  y=y+(t&amp;lt;=S)*(-2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12119" LastEditorUserId="12119" LastEditDate="2015-04-07T10:50:43.780" LastActivityDate="2015-04-07T10:50:43.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22586" PostTypeId="1" AcceptedAnswerId="26018" CreationDate="2015-04-07T05:27:37.763" Score="0" ViewCount="1350" Body="&lt;p&gt;I want to write an speaker recognition application (based on some password recorded few times for the authorized person).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've decided to do it with C++ and BASS library (&lt;a href=&quot;http://www.un4seen.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.un4seen.com/&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to get the FFT data (calculated for each &lt;code&gt;update()&lt;/code&gt; with the active microphone stream):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float fft[1024];&#xA;BASS_ChannelGetData(chan, fft, BASS_DATA_FFT2048); // get the FFT data&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I send the data to the buffer so I can draw it in real-time:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// &quot;normal&quot; FFT&#xA;memset(specbuf, 0, SPECWIDTH*SPECHEIGHT);&#xA;for (x = 0; x&amp;lt;SPECWIDTH / 2; x++) {&#xA;y = sqrt(fft[x + 1]) * 3 * SPECHEIGHT - 4; // sqrt makes low values more visible&#xA;//y = fft[x + 1] * 10 * SPECHEIGHT; // linear scale (alternative)&#xA;if (y&amp;gt;SPECHEIGHT) y = SPECHEIGHT; // cap it&#xA;if (x &amp;amp;&amp;amp; (y1 = (y + y1) / 2)) // interpolate from previous to make the display smoother&#xA;    while (--y1 &amp;gt;= 0) specbuf[y1*SPECWIDTH + x * 2 - 1] = y1 + 1;&#xA;y1 = y;&#xA;while (--y &amp;gt;= 0) specbuf[y*SPECWIDTH + x * 2] = y + 1; // draw level&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is, how to calculate the MFCC from it?&#xA;I'm a very begging in the field of signal processing, please take it into account.&lt;/p&gt;&#xA;" OwnerUserId="15349" LastActivityDate="2015-09-24T00:08:48.320" Title="MFCC from DFT (FFT)" Tags="|fft|audio|fourier-transform|mfcc|voice|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22587" PostTypeId="1" CreationDate="2015-04-07T06:05:21.800" Score="0" ViewCount="4002" Body="&lt;p&gt;Given an analytical description of the PSD, for example (MATLAB &quot;pseudocode&quot;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 20400;&#xA;bw = 2 * 2040 / N; % double-sided spectrum, 20% occupied&#xA;PSD = zeros(N,1);&#xA;P0 = sigma * sqrt(N/bw); % sigma^2 = (P0^2/N) * bw&#xA;PSD(1:2040) = P0;&#xA;PSD(18362:end) = P0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;what is the &quot;correct&quot; way to generate a time-domain signal $x[n]$ which is a realization of this PSD, i.e. which has variance of $\sigma^2$ and a DFT where all bins $2041, \dots, 18361$ are zero?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/264846&lt;/a&gt;. However, I am confused since there only the phase is taken randomly but not the magnitude which would result in a perfect &quot;brick-wall&quot; spectrum when taking the DFT of each realization (because the magnitude and magnitude-squared is not random). However, this is only the case if the number of samples approaches infinity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Important: I do &lt;strong&gt;not&lt;/strong&gt; want to generate iid. white Gaussian samples and filter them - I would like to generate the random signal in DFT domain and then use the inverse DFT to generate the time domain signal.&lt;/p&gt;&#xA;" OwnerUserId="10514" LastActivityDate="2015-04-07T06:05:21.800" Title="Generate time-domain random signal from PSD" Tags="|discrete-signals|power-spectral-density|random|stochastic|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22588" PostTypeId="2" ParentId="22579" CreationDate="2015-04-07T08:10:18.187" Score="0" Body="&lt;p&gt;Your are looking for a method called matched filter.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-07T08:10:18.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22589" PostTypeId="2" ParentId="22570" CreationDate="2015-04-07T11:39:28.573" Score="1" Body="&lt;p&gt;This is more likely a question of what the data reporting application is trying to achieve, rather than a DSP question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, there is a different term for Gate or Window. In fact, if you &quot;subsample&quot; and low pass filter, as per your first intuition, then you are effectively doing decimation. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Decimation_%28signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Decimation_%28signal_processing%29&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest of your suggestions would be equivalent to subsampling followed by non-linear filtering such as median, min, max which would have the corresponding effect on the reported data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a sliding window median filter would &quot;absorb&quot; any spikes in the reported data and the min and max filters would tend to report the highest or lowest values. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Nonlinear_filter&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Nonlinear_filter&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Median_filter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it is really a matter of what does that GUI element try to convey to its user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Supplementary Information:&lt;/strong&gt;&#xA;Yes decimation does imply a stable sampling frequency but most DSP operations can be defined over irregular domains as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Irrespectively of that however, I think that we are indirectly looking at the real problem here which is one of visualisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real problem, or at least my understanding of it so far, is that you are trying to convey a comprehensive view of a window of the history of a signal at a rate lower than its actual rate of change. Furthermore, this signal is not used in any further computation. If that is mostly accurate and assuming that your signal is coming from a stochastic process then no single value will be able to represent this history reliably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I would suggest two alternatives:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;To use a single boxplot that would represent your last signal's frame&#xA;history in a comprehensive way including its min, max, median and&#xA;quartile information. For more information please see:&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Box_plot&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Box_plot&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To convey the signal's history to your user via a Sparkline which&#xA;could furthermore be annotated with min,max,median lines. Please note that Sparklines can also be created via the use of special fonts, which makes them really easy to quickly insert to a GUI. For more&#xA;information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Sparkline&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Sparkline&lt;/a&gt; and &lt;a href=&quot;https://www.fontfont.com/how-to-use-ff-chartwell&quot; rel=&quot;nofollow&quot;&gt;https://www.fontfont.com/how-to-use-ff-chartwell&lt;/a&gt; or &lt;a href=&quot;http://nsfmc.github.io/chartjunk/&quot; rel=&quot;nofollow&quot;&gt;http://nsfmc.github.io/chartjunk/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2015-04-08T07:44:37.590" LastActivityDate="2015-04-08T07:44:37.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22590" PostTypeId="2" ParentId="22536" CreationDate="2015-04-07T12:25:33.213" Score="1" Body="&lt;p&gt;Digital images are composed of Spatial Frequencies which describe &quot;change&quot; with respect to position in space. For more information please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Spatial_frequency&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Spatial_frequency&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, the two-dimensional Fourier Transform can decompose a given image to its spatial frequencies which means that it can decompose an image to a set of &quot;sinusoidal plates&quot;. Think of these plates like egg-cartons (&lt;a href=&quot;http://www.asia.ru/images/img/alibaba/img/product/11/24/61/11246140.jpg&quot; rel=&quot;nofollow&quot;&gt;http://www.asia.ru/images/img/alibaba/img/product/11/24/61/11246140.jpg&lt;/a&gt;) of different density (egg positions per unit of space). That is, sinusoids in 2D. For more information, please see: &lt;a href=&quot;http://cns-alumni.bu.edu/~slehar/fourier/fourier.html&quot; rel=&quot;nofollow&quot;&gt;http://cns-alumni.bu.edu/~slehar/fourier/fourier.html&lt;/a&gt; and &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm&quot; rel=&quot;nofollow&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a rule of thumb, keep in mind that small features (i.e. object details) occupy high spatial frequencies while large features (i.e. object form) occupy low spatial frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A comprehensive example of this would be high-pass filtering of an image which would preserve the edges of represented objects (an edge being a very sudden change in light reflectance across a direction) but completely lose all information about the rough form of the image. The opposite of this would be low-pass filtering which would completely wipe out the details (sharp transitions of reflectance across a direction) but preserve the very slow transitions of reflectance within an image. For more information on shaping the spatial content of an image please see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Kernel_%28image_processing%29&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Kernel_%28image_processing%29&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-04-07T12:25:33.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22591" PostTypeId="2" ParentId="22552" CreationDate="2015-04-07T12:33:09.777" Score="2" Body="&lt;p&gt;Writing the optical flow vector as $(u,v)$, then the optical flow equation only states that light is preserved.&#xA;Basically, it states that &lt;strong&gt;variations in the observed light&lt;/strong&gt; patterns (measured by the image derivative with respect to time) are explained by the &lt;strong&gt;motion of objects&lt;/strong&gt; (smaller light patterns inside the image). &#xA;Object motion is measured through &lt;strong&gt;spatial variations&lt;/strong&gt; of the said light patterns:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial I}{\partial t} + u\cdot\frac{\partial I}{\partial x} + v\cdot\frac{\partial I}{\partial y} = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem is ill-posed for any image, be it synthetic or real.&#xA;This is easy to see since 1 pixel provides 1 measurement $\frac{\partial I}{\partial t}$ only, while at the same time there are two unknowns $\left(u(x,y), v(x,y)\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you said, since this equation involves image spatial gradients $\nabla I = (\frac{\partial I}{\partial x}, \frac{\partial I}{\partial y})$ it can be solved for edges (by tracking them).&#xA;Other ways to overcome this issue:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;assuming that the optical flow is &lt;a href=&quot;http://en.wikipedia.org/wiki/Lucas%E2%80%93Kanade_method&quot; rel=&quot;nofollow&quot;&gt;constant over a square&lt;/a&gt; of several pixels and then solving the resulting system. Typically, using 3x3 squares yields 9 equations and a least squares solution to the optical flow can be computed;&lt;/li&gt;&#xA;&lt;li&gt;more involved approaches rely on &lt;a href=&quot;http://en.wikipedia.org/wiki/Horn%E2%80%93Schunck_method&quot; rel=&quot;nofollow&quot;&gt;regularized problems&lt;/a&gt;. Regularized approaches look for a flow that will fit the observed data while having &lt;em&gt;good properties&lt;/em&gt; such as smoothness, exhibiting thin discontinuities...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2015-04-07T12:33:09.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22592" PostTypeId="1" CreationDate="2015-04-07T13:34:55.860" Score="2" ViewCount="1604" Body="&lt;p&gt;I am trying to understand the function of a Wiener filter. I get that the Wiener filter minimizes the mean square error between the estimated random process and the desired process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean that when you have a signal with low and high frequencies and the noise is only in in the high frequencies that the resulting signal only contains low frequencies? What would the transfer function look like in this case?&lt;/p&gt;&#xA;" OwnerUserId="11415" LastActivityDate="2015-04-07T18:33:45.290" Title="transfer function of wiener filter" Tags="|filters|filter-design|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22594" PostTypeId="2" ParentId="22579" CreationDate="2015-04-07T14:46:20.107" Score="-1" Body="&lt;p&gt;something like  &lt;code&gt;sum(x(n)*y(n))/sqrt(sum(x(n)^2)*sum(y(n)^2))&lt;/code&gt;.&#xA;this would give a 1 when &lt;code&gt;x(n)=y(n)&lt;/code&gt;...&lt;/p&gt;&#xA;" OwnerUserId="14921" LastEditorUserId="7092" LastEditDate="2015-04-07T17:00:40.357" LastActivityDate="2015-04-07T17:00:40.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22595" PostTypeId="2" ParentId="22579" CreationDate="2015-04-07T14:49:34.793" Score="1" Body="&lt;p&gt;I would recommend something like &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;cross-correlation&lt;/a&gt;. This technique has a strong theoretical foundation and works well at compensating for things like time delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be easier to answer your questions if you provide a more thorough explanation as to what kinds of signal properties you are looking to compare between the two signals.&lt;/p&gt;&#xA;" OwnerUserId="12038" LastActivityDate="2015-04-07T14:49:34.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22596" PostTypeId="1" AcceptedAnswerId="22603" CreationDate="2015-04-07T16:45:22.943" Score="1" ViewCount="891" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Exponential_smoothing#Double_exponential_smoothing&quot; rel=&quot;nofollow&quot;&gt;Double exponential smoothing&lt;/a&gt;&#xA;a.k.a.&#xA;&lt;a href=&quot;http://people.duke.edu/~rnau/411avg.htm#HoltLES&quot; rel=&quot;nofollow&quot;&gt;Holt-Winters smoothing&lt;/a&gt;&#xA;tracks level and trend of a time series in coupled IIRs:&lt;br&gt;&#xA;$\qquad$ In:  $Y_t$, t = 0 1 2 ...&lt;br&gt;&#xA;$\qquad$ State: $L_t, T_t \quad$ -- level and trend&lt;br&gt;&#xA;$\qquad$ Out: estimate $\hat{Y}_{t+1}$&lt;br&gt;&#xA;$\qquad$ Parameters: a, b  (a.k.a. $\alpha, \beta$)&lt;br&gt;&#xA;$\qquad$ Step equations:&lt;br&gt;&#xA;$\qquad$ $\qquad L_t = a Y_t + (1 - a) (L_{t-1} + T_{t-1})  \quad$ -- level&lt;br&gt;&#xA;$\qquad$ $\qquad T_t = b (L_t - L_{t-1}) + (1 - b) T_{t-1}  \quad$ -- trend&lt;br&gt;&#xA;$\qquad$ $\qquad \hat{Y}_{t+1} = L_t + T_t$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I calculate the transfer function of this smoother, for given $a$ and $b$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Two possible approaches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;manipulate the step equations into ratio-of-polynomials form&lt;/li&gt;&#xA;&lt;li&gt;brute force iterate with input $e^{2 \pi i f t}$: converges slowly for small $a, b$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The first of these is beyond me, the second unsatisfactory.)&lt;/p&gt;&#xA;" OwnerUserId="4389" LastActivityDate="2019-10-09T20:22:03.787" Title="Transfer function of double exponential smoothing?" Tags="|transfer-function|smoothing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22597" PostTypeId="1" CreationDate="2015-04-07T17:20:55.610" Score="0" ViewCount="177" Body="&lt;p&gt;Suppose the input to an FIR system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n]=e^{j(2\pi n/7 -\pi/2)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define a new signal $y[n] = x[n]-x[n-1]$ . The signal $y[n]$ can be expressed in the form &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = Ae^{j( 2 \pi f n + \phi)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find $A$, $\phi$, and $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really would just like confirmation that I am correct.&lt;br&gt;&#xA;I calculated $A = 0.8678$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\phi = -1.7952$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f = 0.2244$&lt;/p&gt;&#xA;" OwnerUserId="15354" LastEditorUserId="7092" LastEditDate="2015-04-07T19:04:34.363" LastActivityDate="2015-04-08T07:35:19.193" Title="Finding the output of frequency response" Tags="|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22599" PostTypeId="1" CreationDate="2015-04-07T17:40:16.650" Score="0" ViewCount="227" Body="&lt;p&gt;I try to have a signal (speech) represented in time and frequency domain  (waveform, spectrum and spectrogram). I use Sonic Visualiser and for spectrum representation it shows an analysis at a given point in time.&#xA;I wonder what representation should I use to represent a selected area of the waveform e.g. a word, in frequency domain (spectrums). Sonic Visualiser doesn't give averaging options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Vasiliki     &lt;/p&gt;&#xA;" OwnerUserId="15357" LastActivityDate="2015-10-05T13:22:19.487" Title="Average spectrum representation - SonicVisualiser" Tags="|audio|frequency-spectrum|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22600" PostTypeId="1" CreationDate="2015-04-07T18:06:06.990" Score="5" ViewCount="2105" Body="&lt;p&gt;I've seen many discussions suggesting that SOS's are often/usually the preferred structure for fixed point hardware filter implementations, since they preserve conjugate pairs, etc., but I've never seen any specific arguments explaining why they are better for FIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do these advantages still apply for direct form, linear phase FIR filters which allow the number of multipliers to be reduced by a factor of 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, are there any good resources discussing these trade-offs?  I'm trying to implement fairly long FIR filters with small multipliers, i.e. 40+ taps with 8-10b coefficients, and am looking for resources that might shorten this effort.&lt;/p&gt;&#xA;" OwnerUserId="15359" LastActivityDate="2015-04-10T10:11:41.370" Title="Are SOS structures better for linear phase FIR filters?" Tags="|filters|fixed-point|hardware-implementation|finite-impulse-response|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22602" PostTypeId="2" ParentId="22592" CreationDate="2015-04-07T18:33:45.290" Score="5" Body="&lt;p&gt;In general, an ideal Wiener filter (i.e. a non-causal filter with an infinitely long impulse response) has the following frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W(\omega)=\frac{S_{dx}(\omega)}{S_x(\omega)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $S_{dx}(\omega)$ is the cross-power spectral density of the desired signal $d[n]$ and the input of the Wiener filter $x[n]$, and $S_x(\omega)$ is the power spectral density (PSD) of the input process $x[n]$. If the input is just a noisy version of the desired signal, and if the desired signal and the noise are uncorrelated, then we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_x(\omega)=S_d(\omega)+S_n(\omega)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $S_n(\omega)$ is the PSD of the additive noise, and $S_d(\omega)$ is the PSD of the desired signal. Furthermore, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_{dx}(\omega)=S_d(\omega)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because the noise and the desired signal are uncorrelated. Plugging (2) and (3) into (1) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W(\omega)=\frac{S_d(\omega)}{S_d(\omega)+S_n(\omega)}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This expression is very easily interpreted: for frequencies where the noise is much stronger than the signal (i.e. $S_n(\omega)\gg S_d(\omega)$ the Wiener filter strongly attenuates the input signal, whereas for frequencies with a very good signal-to-noise ratio (SNR) (i.e. $S_d(\omega)\gg S_n(\omega)$) the filter passes the input with a gain of approximately $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your guess is correct: if there's a lot of noise in the high frequencies (relative to the desired signal), then these frequencies are attenuated, and the low frequencies, where the SNR is high, will pass the filter with a gain of approximately $1$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-07T18:33:45.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22603" PostTypeId="2" ParentId="22596" CreationDate="2015-04-07T19:23:20.557" Score="1" Body="&lt;p&gt;I would use the $\mathcal{Z}$-transform. Let me change the notation slightly by using $n$ as the discrete time index, lower case letters for time domain quantities, $x[n]$ as the observed input data sequence, and $y[n]$ as the output sequence, which is an estimate of $x[n+1]$. With this notation, the time domain equations are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tag{1}\begin{align}&#xA;l[n]&amp;amp;=ax[n]+(1-a)(l[n-1]+t[n-1])\\&#xA;t[n]&amp;amp;=b(l[n]-l[n-1])+(1-b)t[n-1]\\&#xA;y[n]&amp;amp;=l[n]+t[n]&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the $\mathcal{Z}$-transform of these 3 equations gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\tag{2}&#xA;L(z)&amp;amp;=aX(z)+(1-a)z^{-1}(L(z)+T(z))\\&#xA;T(z)&amp;amp;=b(1-z^{-1})L(z)+(1-b)z^{-1}T(z)\\&#xA;Y(z)&amp;amp;=L(z)+T(z)&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the second equation in (2) we can express $T(z)$ in terms of $L(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T(z)=\frac{b(1-z^{-1})}{1-(1-b)z^{-1}}L(z)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging (3) into the first equation of (2), we can express $L(z)$ in terms of $X(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$L(z)\left[1-(1-a)z^{-1}\left(1+\frac{b(1-z^{-1})}{1-(1-b)z^{-1}}\right)\right]=aX(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which, after some algebra, you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$L(z)=\frac{a\left[1-(1-b)z^{-1}\right]}{1+[a(1+b)-2]z^{-1}+(1-a)z^{-2}}X(z)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, plugging (3) into the last equation of (2) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=\left[1+\frac{b(1-z^{-1})}{1-(1-b)z^{-1}}\right]L(z)=\frac{1+b-z^{-1}}{1-(1-b)z^{-1}}L(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and combining with (4) results in a relation between the output $Y(z)$ and the input $X(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=\frac{a(1+b-z^{-1})}{1+[a(1+b)-2]z^{-1}+(1-a)z^{-2}}X(z)=H(z)X(z)\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(z)$ is the desired transfer function, which is of course a second order IIR filter.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-04-07T19:40:38.543" LastActivityDate="2015-04-07T19:40:38.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22604" PostTypeId="1" AcceptedAnswerId="22628" CreationDate="2015-04-07T19:27:36.353" Score="4" ViewCount="1787" Body="&lt;p&gt;I have been working on image processing. But there is one thing that has made me confused. What is difference between structured image and textured image. In my idea, both are the same. But recently, I read a paper that claimed that they are different. Somebody let me know what diffrerences they have?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="15003" LastEditDate="2015-04-08T12:47:29.943" LastActivityDate="2015-04-14T19:39:32.427" Title="What is differences between structured image and textured image" Tags="|image-processing|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22605" PostTypeId="2" ParentId="22586" CreationDate="2015-04-07T19:30:06.223" Score="0" Body="&lt;p&gt;First link from the google on &quot;MFCC Tutorial&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/&quot; rel=&quot;nofollow&quot;&gt;http://www.practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2015-04-07T19:30:06.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22606" PostTypeId="2" ParentId="22564" CreationDate="2015-04-07T19:56:55.127" Score="2" Body="&lt;h1&gt;Is there a standard way to estimate the period of a pulse train?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I have no answer to this part of the question. But I hope the algorithm, described below can be useful.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;If autocorrelation is the right approach, how to automatically&#xA;find the floating point coordinate of the peak from the&#xA;autocorrelation result without too many assumptions?&lt;/h1&gt; &#xA;&#xA;&lt;p&gt;Consider next input signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6LPdhm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its autocorrelation function $f[n]$:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tr6dRm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be described as $f[n] = s[n] + b[n]$, where $s[n]$ is the&#xA;sequence of noisy peaks and $b[n]$ is base line:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WoRFTm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this model we can do the following:&lt;br&gt;&#xA;1. Extract $b[n]$ from $f[n]$ using morphological opening (see appendix) with flat structuring element. (The width of the structuring element should be greater, than maximum possible width of the autocorrelation function's peak).&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O06Zym.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;2. Estimate $s[n] = f[n] - b[n]$.&lt;br&gt;&#xA;3. Calculate mean $m$ and standard deviation $\sigma$ of $s[n]$.&lt;br&gt;&#xA;4. Define threshold $t = m + 2\sigma$ (or something just above noisy zero level).&lt;br&gt;&#xA;5. Apply threshold $t$ to $s[n]$.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qRpLpm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;6. Find second ($p_{2}$) and third ($p_{3}$) points of intersection $s[n]$&#xA;with $t$.&lt;br&gt;&#xA;7. Find perdiod $T$ (in samples) as index of the max element between $p_{2}$&#xA;and $p_{3}$.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt; Appendix. Morphological opening.&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Opening ($\circ$) of a function $f: D\subset{\rm I\!R}\to{\rm I\!R}$&#xA;is defined as:&lt;br&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f \circ g_{s} = (f \ominus g_{s}) \oplus g_{s}$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $g_{s}: G_{s}\subset {\rm I\!R}\to{\rm I\!R}$ is a structuring&#xA;element of length $s$ and the $\oplus$ (dilation) and $\ominus$&#xA;(erosion) operations are defined as:&lt;br&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dilation: $(f \oplus g_{s})(x) = \max_{ t\in(G_{s}\cap D_{x})} (f(x-t) +&#xA;g_{s}(t))$&lt;br&gt;&#xA;Erosion:  $(f \ominus g_{s})(x) = \min_{ t\in(G_{s}\cap D_{x})} (f(x+t)&#xA;- g_{s}(t))$&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $D_{x}$ is $D$ translated by $x$.&lt;/p&gt;&#xA;" OwnerUserId="6961" LastEditorUserId="6961" LastEditDate="2015-04-08T08:30:50.163" LastActivityDate="2015-04-08T08:30:50.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22607" PostTypeId="1" CreationDate="2015-04-07T20:09:14.467" Score="0" ViewCount="2594" Body="&lt;p&gt;Here is the code I use to plot a function in frequency domain in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    dt = 1/10000; % sampling rate&#xA;    et = 0.1; % end of the interval&#xA;    t = 0:dt:et; % sampling range&#xA;    y = 2+sin(2.*pi.*50.*t)+18.*sin(2.*pi.*90.*t)+6.*sin(2.*pi.*180.*t); %     sample the signal&#xA;    subplot(2,1,1); % first of two plots&#xA;    plot(t,y); grid on % plot with grid&#xA;    xlabel('Time (s)'); % time expressed in seconds&#xA;    ylabel('Amplitude'); % amplitude as function of time&#xA;    Y = fft(y); % compute Fourier transform&#xA;    n = size(y,2)/2; % 2nd half are complex conjugates&#xA;    amp_spec = abs(Y)/n; % absolute value and normalize&#xA;    subplot(2,1,2); % second of two plots&#xA;    freq = (0:100)/(2*n*dt); % abscissa viewing window&#xA;    stem(freq,amp_spec(1:101)); grid on % plot amplitude spectrum&#xA;    xlabel('Frequency (Hz)'); % 1 Herz = number of cycles/second&#xA;    ylabel('Amplitude'); % amplitude as function of frequency&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is, when I zoom in my graph I don't see peaks exactly on 50Hz, 90Hz and 180Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What did I do wrong in my code?&lt;/p&gt;&#xA;" OwnerUserId="15344" LastEditorUserId="15344" LastEditDate="2015-04-07T21:18:18.637" LastActivityDate="2022-08-13T12:42:34.437" Title="Frequency spectrum of signal - Matlab" Tags="|matlab|frequency-spectrum|frequency|fourier|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22608" PostTypeId="2" ParentId="22597" CreationDate="2015-04-07T20:41:40.580" Score="1" Body="&lt;p&gt;Unfortunately, apart from the amplitude $A$, I can't confirm that you're correct. The first thing that you can see without doing any calculations is that $f$ must be the same for input and output, because the system is linear and time-invariant, so the frequency of the complex exponential remains unchanged. Consequently, $f=1/7$. The output signal can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}y[n]&amp;amp;=e^{j(2\pi n/7-\pi/2)}\cdot\left(1-e^{-j2\pi/7}\right)\\&amp;amp;=e^{j(2\pi n/7-\pi/2)}\cdot e^{-j\pi /7}\left(e^{j\pi /7}-e^{-j\pi /7}\right)\\&amp;amp;=e^{j(2\pi n/7-\pi/2)}\cdot e^{-j\pi /7}\cdot 2j\sin(\pi/7)\\&#xA;&amp;amp;=2\sin(\pi/7)\cdot e^{j(2\pi n/7-\pi/7)}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}A&amp;amp;=2\sin(\pi/7)=0.8678\\&#xA;f&amp;amp;=1/7=0.1429\\&#xA;\phi&amp;amp;=-\pi/7=-0.4488&#xA;\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-04-08T07:35:19.193" LastActivityDate="2015-04-08T07:35:19.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22609" PostTypeId="2" ParentId="22607" CreationDate="2015-04-07T21:43:42.603" Score="1" Body="&lt;p&gt;The Discrete Fourier transform doesn't actually decompose a signal into a sum of sinusoids it was composed from. The DFT projects the signal onto a &lt;em&gt;specific&lt;/em&gt; set of discrete sinusoids known as Fourier basis. Sinusoids used to compose the signal may or may not coincide with the DFT basis.&lt;/p&gt;&#xA;&lt;p&gt;Here's another way of looking at it. The DFT deals with periodic functions. If you plot 3-4 periods of your signal interval, you'll see it doesn't look like a sum of pure sinusoids, and has discontinuities - if sinusoids it was composed from don't coincide with a Fourier basis.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastEditorUserId="7092" LastEditDate="2022-08-13T12:42:34.437" LastActivityDate="2022-08-13T12:42:34.437" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="22613" PostTypeId="1" CreationDate="2015-04-08T04:19:13.807" Score="1" ViewCount="64" Body="&lt;p&gt;I have a microscopy system which periodically captures an image to be used for shading correction.  Because these images are captured on tissue slides containing, well, tissue, as well as possibly debris, I would like to define a known, good image as the reference with which to compare subsequent images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These images are captured over clear glass using a line scan camera, so, optimally, there will be little variation across the Y axis, and a quadratic like curve across the X which models the light drop-off at the edges of the field of view of the camera.  An intensity profile, averaged along each column, looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HZLS5.png&quot; alt=&quot;intensity profile&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, I'm currently using a quadratic fit to model the data.  What I'm now grappling with is what measures to use to compare this image to a future sample.  My initial approach was/is statistical in nature; mainly, comparing residuals.  The difference in residuals between the reference and an arbitrary sample is currently my strongest measure, but I'm not a statistical whiz, and I'm not convinced it is the correct approach yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, here are a few samples which should be rejected.  I can add raw data if needed, but I'm really just looking for ideas from the DSP side of things.  The green line is the plot of the reference image, the red line the fit for the image in question.  That last one was captured over faint tissue, and it's a bugger if I continue to use a quadratic fit model.  I may end up using a different approach for that situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XEAug.png&quot; alt=&quot;half debris&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/WAAw6.png&quot; alt=&quot;quarter debris&quot;&gt; &lt;img src=&quot;https://i.stack.imgur.com/8BZ67.png&quot; alt=&quot;over tissue&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15364" LastActivityDate="2015-05-08T14:35:00.767" Title="Comparing Images by Defining a Reference Model" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22614" PostTypeId="2" ParentId="22607" CreationDate="2015-04-08T04:32:45.587" Score="0" Body="&lt;p&gt;Well it does in Octave, (obtained by pasting your code, unmodified into a script file):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EzAme.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12119" LastActivityDate="2015-04-08T04:32:45.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22615" PostTypeId="1" CreationDate="2015-04-08T07:11:12.750" Score="0" ViewCount="434" Body="&lt;p&gt;I have an interferometric image which shows fringes at a certain frequency, basically a dominantly periodic signal overlaying the information that I want to extract&lt;a href=&quot;https://i.stack.imgur.com/lB9ph.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;here are the fringes that I want to remove&lt;/a&gt;. The size of the image is 1024x4067 pixels. So using matlab I performed fft2(im,n) with n = size of image, giving me this fft-image&lt;img src=&quot;https://i.stack.imgur.com/7irTC.png&quot; alt=&quot;enter image description here&quot;&gt;, with maximum values given at (9,24) and it's symetric (1017,4045). I am totally confused now as of how to interprete this result. Does that mean I have a frequency of 9 in y and 24 in x direction making it some sort of A&lt;em&gt;cos(2pi/9y+2pi/24x)+B&lt;/em&gt;isin(2pi/9y+2pi/24x) wave!? I'm guessing this it totally wrong and stupid, but I'm really confused.. :-/ &#xA;thanks for your help!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/D8YNC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;here is the shifted FFT image!&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15365" LastEditorUserId="15365" LastEditDate="2015-04-08T08:32:43.023" LastActivityDate="2015-04-08T12:27:05.333" Title="fft2 of interferometric image - how to interpret the result in term of dominant frequency" Tags="|image-processing|matlab|fft|frequency-domain|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22616" PostTypeId="2" ParentId="22599" CreationDate="2015-04-08T08:14:00.277" Score="1" Body="&lt;p&gt;It would not be useful to average in time because vocalisations are represented directly by their spectrogram. (For example: &lt;a href=&quot;http://www.u.arizona.edu/~ohalad/Phonetics/notes/Formants%20Spectrograms%20and%20Vowels.PDF&quot; rel=&quot;nofollow&quot;&gt;http://www.u.arizona.edu/~ohalad/Phonetics/notes/Formants%20Spectrograms%20and%20Vowels.PDF&lt;/a&gt; or even &lt;a href=&quot;http://www2.coloradocollege.edu/dept/ev/Research/Faculty/OVALItems/FordOsborneVocabulary/_SouthernVocabularyTable.html&quot; rel=&quot;nofollow&quot;&gt;http://www2.coloradocollege.edu/dept/ev/Research/Faculty/OVALItems/FordOsborneVocabulary/_SouthernVocabularyTable.html&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest that you export your spectrogram as an image and then isolate and layout the areas you are interested in, in some other software like GIMP. For more information, please see: &lt;a href=&quot;http://www.sonicvisualiser.org/doc/reference/1.9/en/#imageexport&quot; rel=&quot;nofollow&quot;&gt;http://www.sonicvisualiser.org/doc/reference/1.9/en/#imageexport&lt;/a&gt; and &lt;a href=&quot;http://www.gimp.org/&quot; rel=&quot;nofollow&quot;&gt;http://www.gimp.org/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2015-04-08T08:29:38.950" LastActivityDate="2015-04-08T08:29:38.950" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22617" PostTypeId="2" ParentId="22600" CreationDate="2015-04-08T08:20:15.480" Score="4" Body="&lt;p&gt;well, i see little value in factoring an FIR into quadratics and implementing them in cascade.  it won't be computationally cheaper and it's not better from a quantization noise POV if your FIR has access to an accumulator that is double width.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;perhaps it will help with limiting coefficient range so that it's less likely that you have non-zero coefficients (at the tails of the FIR) with values of, say, $10^{-8}$ the size of other coefficients (in the middle).  there are other, more efficient ways of dealing with that problem (like computing the FIR from the outside in, doing the tails first and the middle last).&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-08T08:20:15.480" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22618" PostTypeId="1" AcceptedAnswerId="22681" CreationDate="2015-04-08T08:52:42.300" Score="2" ViewCount="266" Body="&lt;p&gt;I have a very long data up to 8 millions of samples and want to decimate it to order of 1000s. I'm using following Matlab code to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = numberOfSamples/N; %N is number of points after decimation&#xA;p = factor(f); % &#xA;temp = rawData; %with length of numberOfSamples&#xA;for i = 1:length(p)&#xA;    temp= decimate(temp,p(i),10); %decimate with 10th order iir filter&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Number of samples before and after decimation is not known, but the ratio, i.e. decimation number, is an integer for sure(that's given.) In other words, those are input to my program.&#xA;How can I decimate(including the decimation filter) the data in chunks and have the same result? One chunk computes some part of the decimated signal and the other chunk computes another part, etc.&#xA;I hope question is clear, any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14939" LastActivityDate="2015-04-10T09:59:33.417" Title="Decimating Long Data in Chunks" Tags="|decimation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22619" PostTypeId="2" ParentId="22600" CreationDate="2015-04-08T09:13:53.910" Score="3" Body="&lt;p&gt;I agree with Robert's answer, but I would like to add why SOS are used for IIR filters, from which it becomes easier to understand why they are not commonly used for implementing FIR filters. One of the reasons why SOS are a very common way of implementing IIR filters is the fact that poles close to each other and/or close to the unit circle make a direct implementation of the transfer function &lt;em&gt;extremely&lt;/em&gt; sensitive to coefficient quantization. Since FIR filters don't have any poles away from the origin you don't have that problem when implementing FIR filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not to say that coefficient quantization is no issue for FIR filters. It becomes a problem for large filter lengths and if a high stopband attenuation is desired. In [1] a conservative bound was derived for the error due to coefficient quantization:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\epsilon\le 20\log_{10}N-6B\;\text{(dB)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the filter length, and $B$ is the number of bits used for representing the filter coefficients. So for a filter with $N=50$ and $B=10$ you get $\epsilon\le -26\,\text{dB}$, which means that in the worst case the filter's stopband attenuation is only $26\,\text{dB}$. However, the authors mention that this bound is very conservative and that in practice the error is usually much smaller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the naive approach of filter design assuming infinite precision and subsequent coefficient quantization does not result in a useful filter, one must take coefficient quantization into account already during the design process. This can be done using integer programming techniques. The classic reference on this topic is &lt;a href=&quot;http://laps.fri.uni-lj.si/~duke/HPpapers/assp80.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Design of Optimal Finite Wordlength FIR Digital Filters Using Integer Programming Techniques&lt;/a&gt; by D.M. Kodek.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following example illustrates the difference between the coefficient sensitivity of direct form implementations of FIR and IIR filters. I designed two lowpass filters: one 7th order elliptic IIR filter and one Parks-McClellan equiripple linear-phase FIR filter with $101$ taps, both filters satisfying approximately the same magnitude specifications. The plot below shows the magnitudes of the frequency responses (IIR in blue, FIR in green). The top two plots are the responses with unquantized coefficients, and the bottom plots are the responses with 14 bit fixed-point coefficients. Note the huge difference in coefficient sensitivity in the passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5Bphf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;[1] T.W. Parks, C.S. Burrus, &lt;em&gt;Digital Filter Design&lt;/em&gt;, p. 143&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-04-10T10:11:41.370" LastActivityDate="2015-04-10T10:11:41.370" CommentCount="21" ContentLicense="CC BY-SA 3.0" />
  <row Id="22620" PostTypeId="1" AcceptedAnswerId="22622" CreationDate="2015-04-08T10:00:33.453" Score="0" ViewCount="29" Body="&lt;p&gt;If I had a vector containing the spectral centroid, spread, skewness and kurtosis (all normalised) of an audio clip and found the distance between it to the same kind of vector of another audio clip. Would this give me a very crude estimation of how likely each audio clip would mask each other? Bear in mind I'm aware of how loud each audio clip has to be. I'm just trying to see if their spectrums would interfere with each other. Or could I possibly just find the average over time the amount of energy in each FFT bin to build a spectral profile of audio clip, so it would be essentially be like finding the distance between two 1024 value vectors (normalised obviously)&lt;/p&gt;&#xA;" OwnerUserId="7804" LastActivityDate="2015-04-08T12:15:04.890" Title="Predict auditory masking with a crude estimation?" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22622" PostTypeId="2" ParentId="22620" CreationDate="2015-04-08T12:15:04.890" Score="0" Body="&lt;p&gt;By looking at the spectrum's probability law you are completly missing the temporal information in the two signal you wish to compare thus it would be a bad predictor.&#xA;Imagine you analyse two 2048 pts signal, one is null during the last 1024 points whereas the other one is null during the first 1024 pts, they could have the exact same spectrum but they won't interfere each other at all.&#xA;This is the whole purpose of time-frequency analysis, unless you have some a priori knowledge, you can't avoid using a short time fft.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-08T12:15:04.890" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22624" PostTypeId="2" ParentId="4745" CreationDate="2015-04-08T12:23:55.983" Score="0" Body="&lt;p&gt;Negative frequencies just represent the clockwise rotating phasors. Whereas , positive frequencies represent the counter-clockwise rotating phasors . In complex mathematics , $cos \omega t= (e^{j\omega t} + e^{-j\omega t}) /2$ . Now if you draw the phasor diagram of the RHS equation , there will be two phasors in it , $e^{j\omega t}$ rotating in counter clockwise direction . and $e^{-j\omega t}$ rotating in clockwise manner . The value of $cos \omega t$ , at any instant $t$ , is nothing but , the sum of projection of each of these phasors on x-axis , whole divided by $2$.&#xA;I hope this clears up what exactly Negative frequencies represent!&lt;/p&gt;&#xA;" OwnerUserId="15368" LastEditorUserId="5843" LastEditDate="2015-04-09T08:01:09.773" LastActivityDate="2015-04-09T08:01:09.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22625" PostTypeId="2" ParentId="22615" CreationDate="2015-04-08T12:27:05.333" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;Remove the mean from the image you linked before analysing it with&#xA;fft2.&lt;/li&gt;&#xA;&lt;li&gt;Use fftshift to get a more readable image.&lt;/li&gt;&#xA;&lt;li&gt;Use a logarithmic scale on the 2d spectrum if you don't see anything.&lt;/li&gt;&#xA;&lt;li&gt;Please label the x and y axis with normalized frequency.&lt;/li&gt;&#xA;&lt;li&gt;Using the insight on the noise spectrum you got from the fft2, design the filters you need to remove the periodic noise.&lt;/li&gt;&#xA;&lt;li&gt;You noise isn't stationary withing the image, so your filters won't work awesome.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You could also try the following :&#xA;Consider your columns as realization of a random vector of size approx 1000 (number of rows). Take your first 100 columns, apply PCA with covariance matric proportional to V*V' with V of size [100*1000], the vertical periodic pattern will be your most powerfull eigen vector. Project your data on the 99 remaining vector. Repeat this process on others 100 columns batches, be carefull with energy normalization.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-08T12:27:05.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22626" PostTypeId="2" ParentId="22613" CreationDate="2015-04-08T12:39:32.750" Score="1" Body="&lt;p&gt;When looking at your data I want to say that when you have a good image the intensity along the x axis will be somewhat symetric and be much more random when you have a bad image. &#xA;The third order statistical moment, the skewness (1rst and second being mean and variance), is a good measure of assymetry. You may want to compare your image based on the skewness of the intensity along the x axis. Set some thresold either manualy or with basic machine learning.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-08T12:39:32.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22627" PostTypeId="2" ParentId="22604" CreationDate="2015-04-08T12:45:40.530" Score="1" Body="&lt;p&gt;Texture is an oscillatory component capturing details and noise.&#xA;The structured part could be a geometric and smoothly varying component.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-08T12:45:40.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22628" PostTypeId="2" ParentId="22604" CreationDate="2015-04-08T13:51:47.237" Score="4" Body="&lt;p&gt;Imho there is no &quot;mathematical&quot; description of either terms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both (texture and stucture) can be viewed as a repeating pattern. In the case of texture, the pattern might get a more random perturbation (think at an image of sand or grass).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rhfep.jpg&quot; alt=&quot;Grass field&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a structured image you might get less random and more systematical perturbation (Think of a roof picture with tiles) Sometimes more info can be extracted from structured images. Imagine that you can actually get some 3D info by examining the way the pattern varies along one direction or another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZylL1.jpg&quot; alt=&quot;Roof&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course I could be completely wrong and the &quot;structure image&quot; has a concrete definition for the author that you quote. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found two examples where 3D info is extracted from textural information. Chapter 9.5 &quot;Shape from Texture&quot; from &quot;Introductory Techniques for 3-D Computer Vision&quot; by Emanuele Trucco, Alessandro Verri (1998 ed) and Chapter 12.4 3D Cues Available in 2D Images from &quot;Computer Vision&quot; by L. Shapiro and G. Stockman (2000 ed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There, you have the idea of deterministic texture vs stochastic texture. Also read Jedi Commymullah answer for some other insights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Images are free:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://pixabay.com/en/roof-roofing-house-roof-186391/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pixabay.com/en/roof-roofing-house-roof-186391/&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://pixabay.com/en/grass-grassy-stalks-green-275986/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pixabay.com/en/grass-grassy-stalks-green-275986/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="5737" LastEditDate="2015-04-14T19:39:32.427" LastActivityDate="2015-04-14T19:39:32.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22629" PostTypeId="1" CreationDate="2015-04-08T14:08:38.877" Score="1" ViewCount="132" Body="&lt;p&gt;Suppose that $f(t): \mathbb{R} \to \mathbb{C}$ is a $T$-periodic signal, with highest frequency $f_h$. Now suppose that our sampling rate frequency is lower than $f_h$, and is not any multiples of $1/T$. Furthermore, we use discrete Fourier transform, meaning that we will only be taking $N$ samples, which are of finite quantity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What will be the formula for alias of DFT in such a case?&lt;/p&gt;&#xA;" OwnerUserId="15369" LastActivityDate="2023-03-27T12:05:01.180" Title="Exact formula for alias of Discrete Fourier transform for periodic sigals" Tags="|signal-analysis|fourier-transform|fourier-series|aliasing|periodic|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22630" PostTypeId="1" AcceptedAnswerId="22635" CreationDate="2015-04-08T16:13:00.827" Score="0" ViewCount="367" Body="&lt;p&gt;I'm new to the whole DSP area, but I've built a program which plays music and does FFT to produce some cool visuals for the music in realtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT algorithm I chose was from a C# library called NAudio. I applied a hamming window before shipping it off to the FFT, from which I get an array of complex. Nothing special. Works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now I want to display this data to the user, so I converted the bins to magintudes following this formula: &lt;code&gt;magnitudes[i] = sqr(real[i]² + imaginary[i]²)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This with some amplification yields a pretty good result to display for the user, but I feel that most of the levels being displayed are just random noise, I want to show the user what he/she &lt;code&gt;&quot;hears&quot;&lt;/code&gt;, where the melody or vocal are being amplified OVER the other background music.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing I'm unsure of is how to approach this problem. What can I do to filter out everything else and only have the melody/vocals left. I can understand there's not 100% clean way you can do this, but what method could give me a decent result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="15372" LastActivityDate="2015-04-09T12:44:34.157" Title="Melody/Vocal extraction" Tags="|fft|filters|audio|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22631" PostTypeId="1" CreationDate="2015-04-08T17:23:13.403" Score="1" ViewCount="3252" Body="&lt;p&gt;So I have the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aFgLN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using GIMP, I was able to get to here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/d5VVp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select all white color (with a touch of fuzz)&lt;/li&gt;&#xA;&lt;li&gt;Invert selection&lt;/li&gt;&#xA;&lt;li&gt;Cut selection&lt;/li&gt;&#xA;&lt;li&gt;Invert all color (goes black)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But now I'm stuck...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use something like &lt;code&gt;ocrad&lt;/code&gt; to extract the numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ocrad&lt;/code&gt; goes crazy when I input the black&amp;amp;white image above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to see (the grammar is the numbers 1 to 45 inclusive):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var a = [30,31,32,35,37,40,44];&#xA;var b = [6,7,11,15,18,21,22];&#xA;var c = [5,11,15,18,23,37,28];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's worth pointing out that the image&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;is always the same dimensions&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;is always the same orientation&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;therefore, I think I can split the image into three rows relatively robustly&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/95Pab.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(in the above case, I also did an extra step - remove black contiguous regions that have large area. Though I don't know how to do this programatically - I did this by eye in GIMP using the &quot;magic wand&quot; tool). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above image does OK in &lt;code&gt;ocrad&lt;/code&gt;, but it gets into trouble with the ring surrounding the &quot;44&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to avoid pattern matching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any tips? I'm thinking of doing all this in Python/OpenCV/similar.&lt;/p&gt;&#xA;" OwnerUserId="15376" LastEditorUserId="7092" LastEditDate="2015-04-08T18:59:52.530" LastActivityDate="2023-06-20T13:00:45.683" Title="Image processing (number recognition) woes" Tags="|image-processing|opencv|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22632" PostTypeId="2" ParentId="10268" CreationDate="2015-04-08T17:28:32.387" Score="0" Body="&lt;p&gt;You may want to look at this one:&#xA;&lt;a href=&quot;http://code.google.com/p/wavelet1d/&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/p/wavelet1d/&lt;/a&gt;&#xA;I just googled this library out, so use it in your own caution.&lt;/p&gt;&#xA;" OwnerUserId="15378" LastActivityDate="2015-04-08T17:28:32.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22633" PostTypeId="1" CreationDate="2015-04-08T18:14:10.093" Score="-1" ViewCount="342" Body="&lt;p&gt;I am designing a frequency lowpass filter using FFT&amp;amp;IFFT. My test data is a time series with a large DC component (the pink curve). Before the FFT, the time series was detrended (curve fitting) to remove the trend (the green curve). &#xA;&lt;img src=&quot;https://i.stack.imgur.com/LF3Bn.jpg&quot; alt=&quot;Test time series&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/NQABf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is: the detrended time series has discontinuity at the two ends which will cause severe spectral leakage. To improve the result, I tried several approaches:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) applying windows (e.g., Hann window), it helps to force the ends to zeros. However, the windowing causes the amplitude reduced in the time domain, the frequency amplitude changes as well, as result, the restored signal using IFFT will have lower amplitude, and it cannot be recovered by multiplying certain coefficients (because the windowing procedure is not reversible). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dividing the whole time series into small segments with 50% overlap, applying like Hann window to each sub-segment helps to solve the above amplitude change issue, but my actual project scenario requests me to do FFT using the longest data length, so this is not a way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Instead of windowing, another approach I tried is simply align the beginning and end point to remove the discontinuity, this reduce the spectral leakage caused by discontinuity, but because of the alignment, the DC component is not zero any more, which also introduce leakage to the low frequency band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on my limited knowledge, I cannot figure out a better idea, looking for experts' suggestions, thanks&lt;/p&gt;&#xA;" OwnerUserId="15377" LastEditorUserId="15377" LastEditDate="2015-04-09T19:13:25.640" LastActivityDate="2015-04-10T05:22:42.257" Title="Spectral leakage issue cannot solved using windowing" Tags="|fft|filters|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22634" PostTypeId="1" CreationDate="2015-04-08T18:39:59.970" Score="0" ViewCount="267" Body="&lt;p&gt;I am writing an app to work with synthetic time series data from a physics experiment. In our experiments we always have $1/f$ noise in our time series, but I haven't been able to find code/packages to generate $1/f$ noise in synthetic time series data. Can anyone tell me how to do this? I have a feeling it should be pretty simple and that I'm missing something obvious, but I don't know what it is. Any advice?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I looked through the list of questions and don't see anything too on point apart from this: &lt;a href=&quot;https://dsp.stackexchange.com/questions/10014/making-pink-noise-1-f-using-list-of-frequencies&quot;&gt;making pink noise (1/f) using list of frequencies&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15363" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-04-08T22:26:13.713" Title="how to create synthetic $1/f$ noise?" Tags="|noise|fourier-series|" AnswerCount="1" CommentCount="0" ClosedDate="2015-04-27T15:21:30.357" ContentLicense="CC BY-SA 3.0" />
  <row Id="22635" PostTypeId="2" ParentId="22630" CreationDate="2015-04-08T20:39:53.537" Score="2" Body="&lt;p&gt;I remember reading a similar question (either here or on stack overflow) abouylt melody extraction. In any event someone did create such a project as a PhD thesis (luckily I bookmarked the site). He even offers his work (for research/personal/non-commercial use) for windows mac and linux &lt;a href=&quot;http://www.justinsalamon.com/melody-extraction.html#demo&quot; rel=&quot;nofollow&quot;&gt;http://www.justinsalamon.com/melody-extraction.html#demo&lt;/a&gt; if you could somehow integrate this to your application you can use the extracted melody to display the visuals, but still just play the original song from speakers/headphone&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-04-08T20:45:36.657" LastActivityDate="2015-04-08T20:45:36.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22636" PostTypeId="2" ParentId="22634" CreationDate="2015-04-08T22:26:13.713" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/&quot; rel=&quot;nofollow&quot;&gt;this is an old resource, but good.&lt;/a&gt;   in fact, i have a &lt;em&gt;very&lt;/em&gt; old contribution (another 3 decade old design) that i will repeat here at SE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A method that Orfanidis (&lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/&quot; rel=&quot;nofollow&quot;&gt;Introduction to Signal Processing&lt;/a&gt; mentions came from an old comp.dsp post of mine. (&lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/orfanidis-i2sp.pdf&quot; rel=&quot;nofollow&quot;&gt;here's a pdf, check Problem B.9&lt;/a&gt;)  It's just a simple &quot;pinking&quot; filter to be applied to white noise.  since the rolloff is -3 dB/octave, -6 dB/octave (1st order pole) is too steep and 0 dB/octave is too shallow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An equiripple approximation to the ideal pinking filter can be realized by&#xA;alternating real poles with real zeros.  A simple 3rd order solution that i&#xA;obtained is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = \frac{(z-q_1)(z-q_2)(z-q_3)}{(z-p_1)(z-p_2)(z-p_3)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_1$ =  0.99572754&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_2$ =  0.94790649&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_3$ =  0.53567505&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$q_1$ =  0.98443604&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$q_2$ =  0.83392334&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$q_3$ =  0.07568359&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response follows the ideal -3 dB/octave curve to within $\pm$0.3 dB error over a 10 octave range from 0.0009$\times \pi$ to 0.9$\times \pi$.  (&quot;Nyquist&quot; = $\pi$.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-08T22:26:13.713" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22637" PostTypeId="1" CreationDate="2015-04-08T00:25:25.403" Score="0" ViewCount="863" Body="&lt;p&gt;I am reading this &quot;how to&quot; in R: &lt;a href=&quot;http://www.inside-r.org/howto/time-series-analysis-and-order-prediction-r&quot; rel=&quot;nofollow&quot;&gt;http://www.inside-r.org/howto/time-series-analysis-and-order-prediction-r&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused about the tutorial's implemented band pass filter. In particular, here's the code I'm wondering about. The goal is to extrapolate a time series based only on certain ranges of frequencies determined by &lt;code&gt;peakind&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subsignals &amp;lt;- lapply(c(peakind$freqindex, midindex+1), function(x){&#xA;    upperind &amp;lt;- x&#xA;    fsub &amp;lt;- f&#xA;    notnullind &amp;lt;- ((fsub$freqindex &amp;gt;= lowerind&#xA;                    &amp;amp; fsub$freqindex &amp;lt; upperind)&#xA;                   |&#xA;                    (fsub$freqindex &amp;gt;  (lindex - upperind + 2)&#xA;                     &amp;amp; fsub$freqindex &amp;lt;= (lindex - lowerind + 2)))&#xA;    fsub[!notnullind,&quot;coef&quot;] &amp;lt;- 0&#xA;    lowerind &amp;lt;&amp;lt;- upperind&#xA;    Re(fft(fsub$coef, inverse=TRUE)/length(fsub$coef))&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is, why this condition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; (fsub$freqindex &amp;gt;  (lindex - upperind + 2)&#xA;                         &amp;amp; fsub$freqindex &amp;lt;= (lindex - lowerind + 2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is basically saying to include (for computation of inverse FFT) those frequencies that are within the narrow range of the top frequency minus upper band frequency +2 and top frequency minus lower band frequency + 2. &#xA;So basically just some tale at the top of the frequency. This doesn't make any sense to me. Can someone tell me where I should read up on this or what an intuitive hand-wavey sort of justification is?&lt;/p&gt;&#xA;" OwnerDisplayName="sunny" LastEditorUserId="26573" LastEditDate="2018-05-03T12:24:02.950" LastActivityDate="2018-05-03T12:24:02.950" Title="Implementing a bandpass filter in R - this code's logic confuses me" Tags="|bandpass|r|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22638" PostTypeId="2" ParentId="22637" CreationDate="2015-04-09T01:51:54.813" Score="1" Body="&lt;p&gt;Without knowing what values are being passed in, I will assume the +2 is an adjustment for R using 1 based indices.&#xA;The band in the upper half of the frequency data represent complex frequencies symmetric about the fft length/2. The motivation is using a property of the DFT that will result in a real value output from the ifft: &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_real-input_DFT&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_real-input_DFT&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15380" LastActivityDate="2015-04-09T01:51:54.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22640" PostTypeId="2" ParentId="22633" CreationDate="2015-04-09T04:18:15.823" Score="1" Body="&lt;p&gt;You don't remove DC by de-trending. The DC component is removed by de-meaning or subtracting the average. The detrending/curve fitting process alters your time series and will only distort your results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do not need to remove the DC component prior to the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just by visual inspection of your pink curve, I'd say that you have less than a single cycle of a sinusoid. You need multiple cycles...&lt;/p&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2015-04-10T05:22:42.257" LastActivityDate="2015-04-10T05:22:42.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22642" PostTypeId="1" AcceptedAnswerId="22657" CreationDate="2015-04-09T05:14:25.717" Score="1" ViewCount="241" Body="&lt;p&gt;I'm able to make a standard band limited saw wave, but at some point in the past, I remember reading that if you phase offset the sinusoids, you get a different looking wave form that sounds the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to implement this by offsetting the phase 270 degrees, I'm seeing a different looking wave form but it doesn't quite sound the same.  It has less volume and sounds a little less bright.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I remembering correctly / implementing correctly?  Here's the saw and &quot;other&quot; wave below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gGKG2.png&quot; alt=&quot;saw wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-09T21:37:49.680" Title="Phase Offtset Bandlimited Saw Wave" Tags="|signal-synthesis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22645" PostTypeId="2" ParentId="22167" CreationDate="2015-04-09T09:25:40.633" Score="1" Body="&lt;p&gt;In your observation model it is not clear what does $x$ represant, how is it related to time ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could look at your observation model on a logarithmic scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\log(y(t))=d\log(x)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you havn't any a priori on $x$ you cannot estimate $d$ and $x$ because there for any $d$ there is always a $x$ time series that would suit your observation. Thus the system is inobservable and estimation isn't possible.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-09T09:25:40.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22646" PostTypeId="2" ParentId="17395" CreationDate="2015-04-09T09:37:17.590" Score="0" Body="&lt;p&gt;As you stated, bayesian filtering won't yield good results because of the noise's double integration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is perfectly possible to include an a priori within you bayesian filter, e.g. says that it is very unlikely that acceleration goes beyond a given thresold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementation would be a bit more tedious because if you want to stick with a kalman filter, which is much more simple than a more general bayesian filter (particles fitlers etc...) you'll have to state your a priori with guassian pdf's. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create your sensors covariance matrix you'll have to know their precision. This is trivial for the practioner but I don't go any further into details becuase this isn't the point I want to make :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pedometer use a different framework, it doesn't estimate your position using bayesian filtering, but try to detect each step you make using accelerometer data, and just say &quot;x steps has been made&quot; and doesn't know your position.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-09T09:37:17.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22647" PostTypeId="2" ParentId="22631" CreationDate="2015-04-09T09:56:02.890" Score="2" Body="&lt;p&gt;You may want to check &lt;a href=&quot;https://github.com/RobinDavid/Pytesser&quot; rel=&quot;nofollow noreferrer&quot;&gt;PyTesser&lt;/a&gt;. &lt;br&gt;Also, this post &lt;a href=&quot;http://www.pyimagesearch.com/2014/01/12/my-top-9-favorite-python-libraries-for-building-image-search-engines/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adrian Rosebrock - My Top 9 Favorite Python Libraries for Building Image Search Engines&lt;/a&gt; is worth reading.&lt;/p&gt;&#xA;" OwnerUserId="15387" LastEditorUserId="7092" LastEditDate="2023-06-20T13:00:45.683" LastActivityDate="2023-06-20T13:00:45.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22648" PostTypeId="1" AcceptedAnswerId="22649" CreationDate="2015-04-09T10:36:14.007" Score="3" ViewCount="21777" Body="&lt;p&gt;I'm using opencv houghcircle function to detect circles.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is if I set minimum radius to null it detects wrong center and draws smaller radius circle or sometimes larger radius circle.  I'm looking for increasing accuracy of detection by adjusting threshold parameter 1 and 2.&lt;/p&gt;&#xA;" OwnerUserId="15386" LastEditorUserId="31084" LastEditDate="2017-09-30T09:51:50.807" LastActivityDate="2017-10-01T14:52:16.747" Title="In opecv function Hough circles how does parameter 1 and 2 affect circle detection and how can I adjust them to increase accuracy?" Tags="|image-processing|opencv|edge-detection|hough-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22649" PostTypeId="2" ParentId="22648" CreationDate="2015-04-09T11:04:54.110" Score="6" Body="&lt;p&gt;If you have an idea what size circles you are looking for, then it would be best to set min_radius and max_radius accordingly.  Otherwise, it will return anything circular of any size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parameters 1 and 2 don't affect accuracy as such, more reliability.  Param 1 will set the sensitivity; how strong the edges of the circles need to be.  Too high and it won't detect anything, too low and it will find too much clutter.  Param 2 will set how many edge points it needs to find to declare that it's found a circle.  Again, too high will detect nothing, too low will declare anything to be a circle.  The ideal value of param 2 will be related to the circumference of the circles.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-04-09T11:04:54.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22650" PostTypeId="2" ParentId="22629" CreationDate="2015-04-09T12:23:34.780" Score="2" Body="&lt;p&gt;perhaps the material at the following web page will be helpful:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/showarticle/523.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rick Lyons - Computing Translated Frequencies in Digitizing and Downsampling Analog Bandpass Signals&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="7092" LastEditDate="2023-03-27T12:05:01.180" LastActivityDate="2023-03-27T12:05:01.180" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22651" PostTypeId="2" ParentId="22630" CreationDate="2015-04-09T12:44:34.157" Score="1" Body="&lt;p&gt;As you are going at it, you won't be able to see much detail.  There won't be (much) visible difference between loud sounds and quieter sounds, not even if you multiply the magnitudes to make them larger.&lt;br&gt;&#xA;I don't think you really need to separate the sounds into &quot;melody+voice&quot; and &quot;background.&quot;  That would be a (seriously) non-trivial problem.  I think you just need to make the difference more obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the difference more obvious, change the magnitudes to decibels.  The &lt;a href=&quot;http://en.wikipedia.org/wiki/Decibel&quot; rel=&quot;nofollow&quot;&gt;Decibel&lt;/a&gt; is a logarithmic representation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do is this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;magnitudes[i] = 20* log((sqr(real[i]² + imaginary[i]²))&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This will give you a logarithmic view of the music. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula won't give you dBs that relate to any real volume level - the levels are relative to one another, so that while you can say that a particular frequency is 20dB louder than another one, you can't say what the absolute loudness is for any of them.  This is fine, though, since you are just looking at it and not using it for measurements.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-04-09T12:44:34.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22652" PostTypeId="1" AcceptedAnswerId="22682" CreationDate="2015-04-09T13:04:12.397" Score="1" ViewCount="5681" Body="&lt;p&gt;A Band-limited signal is defined as a signal whose Fourier Transform is zero above a specified frequency. Shannon Sampling Theorem is also stated for a strictly band-limited functions,i.e,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;For a band-limited case, 2W numbers per second are sufficient.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where, &quot;W&quot; is the max. frequency content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My confusion is that why band-limit a signal? What would be the situation if a signal is not perfectly band-limited?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding says that unless we have a band-limited signal, we can't get a usable &quot;W&quot; and aliasing would also occur. Does it make sense as an answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I know answers intuitively, but struggling to frame it in words. Please guide me.&lt;/p&gt;&#xA;" OwnerUserId="15340" LastEditorUserId="15340" LastEditDate="2015-04-09T13:11:07.703" LastActivityDate="2015-04-10T11:24:17.827" Title="Why band-limit a signal?" Tags="|sampling|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22653" PostTypeId="2" ParentId="22631" CreationDate="2015-04-09T13:32:48.103" Score="1" Body="&lt;p&gt;You stated you didn't wanted to use pattern recognition. But considering the fact that your image has always the same dimensions and therefore the number's pattern are always the same, your best bet is realy to use a matched filter. Juste run 10 matched filter with patterns (0,1,2,...,9), you will have the information of which character is present and where it is, and it will be fast. Then an easy-to-design high level heuristic will give you your wanted variable a, b et c.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-09T13:32:48.103" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22655" PostTypeId="2" ParentId="22652" CreationDate="2015-04-09T13:38:39.693" Score="0" Body="&lt;p&gt;All the frequency component above W will be aliased, but if they are small, it would be nothing more than noise, everything below will be properly sampled. &lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-09T13:38:39.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22657" PostTypeId="2" ParentId="22642" CreationDate="2015-04-09T14:26:41.803" Score="3" Body="&lt;p&gt;Have you normalized the waveforms differently? The lowest point of the phase-shifted saw should be at amplitude -2 ln(2) / pi = -0.44 if the amplitude of the saw is normalized to -1 .. 1. The positive peak of the phase-shifted saw approaches infinity as you increase the bandwidth. So you could also have a clipping problem. Nonlinearities of the physical world affect the phase-shifted saw more strongly. The two waveforms have the same power spectrum and &quot;complex envelope&quot;, but human hearing is more complex and may be able to detect some difference.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-04-09T14:26:41.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22658" PostTypeId="1" AcceptedAnswerId="22659" CreationDate="2015-04-09T14:27:30.120" Score="3" ViewCount="6160" Body="&lt;p&gt;We know that Fourier transform $F(\omega)$ of function $f(t)$ is summation from $-\infty$ to $+\infty$ product of $f(t)$ and $e^{-j \omega t}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ F(\omega) = \int\limits_{-\infty}^{+\infty} f(t) \ e^{-j \omega t} \ dt  $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, what does the exponential term mean?&lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="1629" LastEditDate="2016-04-08T09:31:53.810" LastActivityDate="2020-08-31T04:12:59.397" Title="What does the exponential term in the Fourier transform mean?" Tags="|fft|signal-analysis|fourier-transform|dft|dtft|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22659" PostTypeId="2" ParentId="22658" CreationDate="2015-04-09T14:43:19.183" Score="9" Body="&lt;p&gt;It's a complex exponential that rotates forever on the complex plane unit circle:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-j\omega t} = \cos(\omega t) - j \sin(\omega t).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can think of Fourier transform as calculating correlation between &lt;span class=&quot;math-container&quot;&gt;$f(t)$&lt;/span&gt; and a complex exponential of each frequency, comparing how similar they are. Complex exponentials like that have the nice quality that they can be time-shifted by multiplying them with a complex number of unit magnitude (a constant complex exponential). If the Fourier transform result at a particular frequency is a non-real complex number, then the complex exponential of that frequency can be multiplied by that complex number to get it shifted in time so that the correlation to &lt;span class=&quot;math-container&quot;&gt;$f(t)$&lt;/span&gt; is maximized.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2020-08-27T09:35:24.283" LastActivityDate="2020-08-27T09:35:24.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22660" PostTypeId="2" ParentId="22658" CreationDate="2015-04-09T14:59:25.120" Score="4" Body="&lt;p&gt;The Fourier Transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = \frac{1}{2\pi}\int_{-\infty}^{\infty} F(t)e^{i\omega t} dt\\&#xA;F(\omega) = \int_{-\infty}^{\infty} f(t)e^{-i\omega t} dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;converts a function to an integral of harmonic functions. You can think of these as sins and cosines because $e^{i\theta} = cos(\theta) + i \sin(\theta)$. The Fourier Transform as a continuous form of the Fourier Series that transforms any periodic signal into a sum of other real periodic (harmonic) signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = a_0 + \sum_{n=1}^{\infty} a_n \cos(n\omega t) + b_n \sin(n\omega t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Fourier Transform, you can think of the coefficients $a_n$ and $b_n$ going over the the values of a continuous function. To take the comparison further, there is a complex version of the series:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f(t) = \sum_{n=-\infty}^{\infty} a_n e^{in\omega t} = \sum_{n=-\infty}^{\infty} a_n \cos(n \omega t) + b_n i \sin(n\omega t)$$&lt;/p&gt;&#xA;" OwnerUserId="15395" LastEditorUserId="15395" LastEditDate="2015-04-13T16:07:30.730" LastActivityDate="2015-04-13T16:07:30.730" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22661" PostTypeId="1" AcceptedAnswerId="22669" CreationDate="2015-04-09T13:33:27.613" Score="1" ViewCount="977" Body="&lt;p&gt;My goal is to analyze the frequencies in an image representing water simulation data before and after, for example, a Gaussian filter. The direction of these frequencies is not important to me. Ideally, I think I want to plot these frequencies in a 2D graph, where x represents the frequency, ranging from 0 to 0.5, and y represents the amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand how to obtain the 1D frequencies, as is explained here:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/4364823/how-do-i-obtain-the-frequencies-of-each-value-in-a-fft&quot;&gt;https://stackoverflow.com/questions/4364823/how-do-i-obtain-the-frequencies-of-each-value-in-a-fft&lt;/a&gt;. From this, I also understand how to obtain the frequencies in x- and y- direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do not fully understand is what the direction-independent frequencies of my output values are. Intuitively, I would expect to calculate them like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// from output to frequencies to periods&#xA;fx = kx / N; fy = ky / M&#xA;px = 1/fx; py = 1/fy&#xA;&#xA;// direction independent frequency of output value&#xA;period = sqrt(px*px + py*py)&#xA;frequency = 1/p&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I read about this particular subject, &lt;a href=&quot;http://fourier.eng.hmc.edu/e101/lectures/image_processing/node6&quot; rel=&quot;nofollow noreferrer&quot;&gt;I find something different&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xfOG0.png&quot; alt=&quot;frequency&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand, &lt;code&gt;u&lt;/code&gt; and &lt;code&gt;v&lt;/code&gt; are the x- and y- frequencies respectively, in cycles per unit distance. This would mean that, if I have a signal with x- and y- frequencies of both &lt;code&gt;0.5&lt;/code&gt;, the resulting frequency is &lt;code&gt;0.707...&lt;/code&gt; ? This is over the Nyquist limit, even more so diagonally! I have a feeling I am missing something, but I can't find what.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, what do the frequencies with an x- or y- frequency of 0 or 0.5 mean? In 1D, they would be the DC and Nyquist component. How does this translate to 2D, where the other may have a perfectly fine value? More practically, which frequencies can I use for my graph?&lt;/p&gt;&#xA;" OwnerUserId="15394" OwnerDisplayName="Selmar" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-05-09T23:51:08.993" Title="How do I obtain the frequencies of each value in a 2D FFT and what do they mean?" Tags="|image-processing|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22663" PostTypeId="1" CreationDate="2015-04-09T18:17:10.093" Score="0" ViewCount="652" Body="&lt;p&gt;I am trying to understand frequency diversity in OFDM. An extra block 'MAPPER' is introduced in conventional OFDM transmitter to apply frequency diversity. Can anyone explain the principle of this MAPPER with its working and mathematical formulation. The transmitter and Reciever block diagrams are as shown below:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hIRd5.png&quot; alt=&quot;OFDM with Frequency Diversity Transmitter &amp;amp; Reciever&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15401" LastActivityDate="2015-04-09T23:49:30.150" Title="Principle of Mapper in frequency diversity in OFDM" Tags="|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22664" PostTypeId="2" ParentId="22658" CreationDate="2015-04-09T18:20:37.957" Score="4" Body="&lt;p&gt;Whether it's the Fourier Transform or the Laplace Transform or the Z Transform, etc. the exponential is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Eigenfunction&quot; rel=&quot;nofollow&quot;&gt;eigenfunction&lt;/a&gt; of &lt;a href=&quot;https://en.wikipedia.org/wiki/LTI_system_theory&quot; rel=&quot;nofollow&quot;&gt;Linear and Time-invariant (LTI) operators&lt;/a&gt;.  if an exponential function of &quot;time&quot; goes into an LTI, an exponential just like it (but scaled by the eigenvalue) comes out.   what the F.T. does is break down a general function into a sum of these exponentials.  that can be seen by looking at the &lt;strong&gt;inverse&lt;/strong&gt; Fourier Transform.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-09T18:20:37.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22665" PostTypeId="2" ParentId="22658" CreationDate="2015-04-09T19:08:31.087" Score="6" Body="&lt;p&gt;If you don't like thinking about imaginary numbers, complex numbers and functions, you can alternatively think of the complex exponential in the FT as just shorthand for mashing together both a sinewave and a cosine wave (of the same frequency) into a single function that requires less chalk on the chalkboard to write.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-09T19:08:31.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22667" PostTypeId="1" CreationDate="2015-04-09T20:53:14.070" Score="-1" ViewCount="281" Body="&lt;p&gt;How to find an optimum linear interpolator replacement for the ideal sinc function? The reason is for the hardware implementation ease. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example when I use sinc interpolation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Temp = sinc( (-7:7)+0.1697 ) * ADC( (0:14)+2 )';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get 0.9509; however with linear interpolation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yi = interp1((0:14)+2 , ADC((0:14)+2) , (0:14)+2-0.1697 , 'linear');&#xA;Temp = yi(8);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get Temp = 0.8410. Is there any better interpolation possible with linear?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15404" LastEditorUserId="15404" LastEditDate="2015-04-10T00:26:29.910" LastActivityDate="2015-04-10T00:26:29.910" Title="linear interpolator replacement for the sinc function" Tags="|matlab|interpolation|reconstruction|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22668" PostTypeId="2" ParentId="22642" CreationDate="2015-04-09T21:37:49.680" Score="3" Body="&lt;p&gt;if you have MATLAB, check this out and see if you can hear a difference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%&#xA;%   sawtooth_phase.m&#xA;%&#xA;%   a test to see if we can really hear phase changes&#xA;%   in the harmonics of a Nyquist limited sawtooth wave.&#xA;%&#xA;%   (c) 2004 rbj@audioimagination.com&#xA;%&#xA;&#xA;if ~exist('Fs')&#xA;    Fs = 44100                      % sample rate, Hz&#xA;end&#xA;&#xA;if ~exist('f0')&#xA;    f0 = 110.25                     % fundamental freq, Hz&#xA;end&#xA;&#xA;if ~exist('tone_duration')&#xA;    tone_duration = 2.0             % seconds&#xA;end&#xA;&#xA;if ~exist('change_rate')&#xA;    change_rate = 1.0               % Hz&#xA;end&#xA;&#xA;if ~exist('max_harmonic')&#xA;    max_harmonic = floor((Fs/2)/f0) - 1&#xA;end  &#xA;&#xA;if ~exist('amplitude_factor')&#xA;    amplitude_factor = 0.25         % this just keeps things from clipping&#xA;end&#xA;&#xA;if ~exist('outFile')&#xA;    outFile = 'sawtooth_phase.wav'&#xA;end&#xA;&#xA;&#xA;                              % make sure we don't uber-Nyquist anything&#xA;max_harmonic = min(max_harmonic, floor((Fs/2)/f0)-1);&#xA;&#xA;t = linspace(0.0, tone_duration, Fs*tone_duration+1);&#xA;&#xA;detune = change_rate;&#xA;&#xA;x = sin(2*pi*f0*t);                  % start with 1st harmonic&#xA;&#xA;n = 2;                               % continue with 2nd harmonic&#xA;while (n &amp;lt;= max_harmonic)&#xA;    if ((n-1) == 2*floor((n-1)/2))  % lessee if it's an &quot;even&quot; or &quot;odd&quot; term&#xA;        x = x + (1/n)*sin(2*pi*n*f0*t);&#xA;     else&#xA;        x = x - (1/n)*sin(2*pi*(n*f0+detune)*t);&#xA;        detune = -detune;       % comment this line in an see some&#xA;    end                         % funky intermediate waveforms&#xA;    n = n + 1;                      % continue with next harmonic&#xA;end&#xA;&#xA;x = amplitude_factor*x;&#xA;&#xA;% x = sin((pi/2)*x);               % toss in a little soft clipping&#xA;&#xA;plot(t, x);                      % see&#xA;sound(x, Fs);                    % hear&#xA;wavwrite(x, Fs, outFile);        % remember&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and try reducing the &lt;code&gt;max_harmonic&lt;/code&gt; to something like 10 or 20.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-09T21:37:49.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22669" PostTypeId="2" ParentId="22661" CreationDate="2015-04-09T23:07:06.750" Score="0" Body="&lt;p&gt;It's not over your Nyquist limit, because you're doing sampling at your nyquist rate in two independent dimensions and look at the combined result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your square-root formula is easily explained: It's pythagoras, matching your combined frequencies in x and y to a single frequency.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-04-09T23:07:06.750" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22670" PostTypeId="2" ParentId="22652" CreationDate="2015-04-09T23:09:29.637" Score="0" Body="&lt;p&gt;&quot;why band-limit a signal?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There will be components of a system that have bandwidth limitations. For example, ADCs have a limit as to how fast they can sample. Therefore the frequency content would need to be limited otherwise you would get aliased frequencies. This is why it is common to find low pass filters before ADCs which prevents erroneous frequency content being mixed into the discrete time (sampled) representation of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its interesting to note that in communications, intentionally aliasing signals are sometimes used to 'foldback' a signal of interest into range of an ADC. &lt;/p&gt;&#xA;" OwnerUserId="15408" LastActivityDate="2015-04-09T23:09:29.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22671" PostTypeId="2" ParentId="22667" CreationDate="2015-04-09T23:36:03.443" Score="0" Body="&lt;p&gt;If you use a high enough resolution table for your Sinc function, filter kernel or reconstruction formula, you might be able linearly interpolate between the table elements and still meet your quality requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trade-off is memory lookups versus function computation cycles.  But caches misses or lookup memories can be more expensive than FPU or MAC latencies on many contemporary systems.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-09T23:36:03.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22672" PostTypeId="2" ParentId="22663" CreationDate="2015-04-09T23:49:30.150" Score="1" Body="&lt;p&gt;In transmitter the N symbols from the series to parallel convertor are repeated M times at the mapper giving you M sets of N symbols. &lt;strong&gt;This is a guess&lt;/strong&gt;, but I  assume the mapper is spreading the contents of each of these M sets out across the whole transmit frequency band so the repeated symbols are not concentrated in any one region. This way if any there is a null in any particular region of the band only a few of the repeated symbols would be affected. This would give you frequency diversity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;AT the receiver the contents of each of the M sets are weighted and combined in a kind of majority rule detection scheme to determine the estimated N symbols. &lt;/p&gt;&#xA;" OwnerUserId="14921" LastActivityDate="2015-04-09T23:49:30.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22675" PostTypeId="1" AcceptedAnswerId="22679" CreationDate="2015-04-10T04:08:07.603" Score="1" ViewCount="692" Body="&lt;p&gt;I've been using a Butterworth high pass filter to correct the low frequency distortion of an acceleration waveform integrated to a velocity waveform.  I throw out a small number of the first data points of the velocity waveform due to the filter settling time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it acceptable or even possible to wrap the filter back around to the beginning and process those 'settling' points as well so I don't have to throw out any data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you can reverse the direction of the filter when you hit your known settling point and process back to the beginning then reverse again and go all the way to the end?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if this is an obvious or appropriate question, I have no background in DSP.&lt;/p&gt;&#xA;" OwnerUserId="15410" LastActivityDate="2015-10-07T13:00:24.773" Title="Filter wrap-around to avoid dealing with settling time? Using a Butterworth" Tags="|filters|highpass-filter|integration|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22676" PostTypeId="1" CreationDate="2015-04-10T05:24:43.757" Score="0" ViewCount="639" Body="&lt;p&gt;I have a Matlab implementation for s-transform in this site &lt;a href=&quot;http://pastebin.com/ErN81TPQ&quot; rel=&quot;nofollow&quot;&gt;http://pastebin.com/ErN81TPQ&lt;/a&gt; which depends on &lt;a href=&quot;http://djj.ee.ntu.edu.tw/S_Transform.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; . My problem is, at line 260, the implementer adds strange line by taking negative values,the original algorithm at 2.14 say it only positive values,but why he did added the negative values of the Gaussian to that ,shortly look at line 260 in the code and equation 2.14. the positive values should be only taken into consideration not those negative values&lt;/p&gt;&#xA;" OwnerUserId="15397" LastEditorUserId="7092" LastEditDate="2015-04-10T14:11:16.660" LastActivityDate="2015-04-10T14:11:16.660" Title="stockwell transform" Tags="|matlab|s-transform|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22677" PostTypeId="1" CreationDate="2015-04-10T05:37:39.213" Score="0" ViewCount="496" Body="&lt;p&gt;I randomly generated initial 10 population(let each of size n) of genetic algorithm as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i = 1:10&#xA;    for j=1:n&#xA;        population(i,j)=randi([MinIntensity,MaxIntensity]);&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assume that I have the individuals of one population.For example let the first population of size 10 is [100 110 120 130 140 150 160 170 180 190].Is it possible to generate the remaining 9 population such that the individuals are near to the first population?(It is for the quick convergence of genetic algorithm).Also each population is a grayscale image with intensity values represented in row major order.Hence the individuals should be in the range of 0 - 255.&#xA;Please help.Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="10965" LastEditorUserId="10965" LastEditDate="2015-04-10T13:44:46.297" LastActivityDate="2015-04-10T13:44:46.297" Title="Initialization of population for genetic algorithm in matlab" Tags="|matlab|image-processing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22679" PostTypeId="2" ParentId="22675" CreationDate="2015-04-10T08:41:39.143" Score="0" Body="&lt;p&gt;If your input waveform is periodic, then wrap-around is appropriate. The most straightforward way to do this is: Initialize the filter state to correspond to an all-zeros input history. Start filtering from the beginning of the input data, writing the output to an output buffer (or in-place to the same buffer, but then the filter has to store its state internally). When the time index runs out of the data buffer, wrap it back to the beginning and keep inputting the filter with zeros for some time while adding the filter's output to successive samples of the output buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can continue this until the absolute values of the filter's state variables all go under some small threshold value decided by you. This gives an upper limit to residual error in the output. The state of a typical infinite impulse response (IIR) filter is equivalent to (or is directly) its n most recent output values, with n depending on the filter's order. You can keep count of how many of the most recent absolute output values were below the threshold, and when the count reaches n you are done. Or simply decide beforehand how long you will continue, as, for a particular filter, that will determine an upper limit to the residual error proportional to the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: the period of the input waveform should be an integer multiple of the sampling period.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-10T10:04:46.820" LastActivityDate="2015-04-10T10:04:46.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22680" PostTypeId="2" ParentId="22278" CreationDate="2015-04-10T08:45:01.910" Score="0" Body="&lt;p&gt;If you don't have a reference ECG signal or multi-channel signals to use some methods such as adaptive filter, artificial neural network or ICA, it is possible to use wavelet transform or wavelet-ICA to remove the ECG artefact. In these methods you do not need multi-channel signal.&#xA;HPF is a simple method that you can use, but it depends on your application. If you need EMG information in low frequencies then HPF is not recommended. The best cutoff frequency for HPF to remove ECG artifacts is 30 Hz which removes useful information from your original signal.&lt;/p&gt;&#xA;&lt;p&gt;Here is an example:&#xA;&lt;a href=&quot;https://books.google.com/books?hl=en&amp;amp;lr=&amp;amp;id=IzgxCgAAQBAJ&amp;amp;oi=fnd&amp;amp;pg=PA91&amp;amp;ots=ocvj368Gm3&amp;amp;sig=hCEMFXZMwo9mFRoGPAmH77k8b-4#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://books.google.com/books?hl=en&amp;amp;lr=&amp;amp;id=IzgxCgAAQBAJ&amp;amp;oi=fnd&amp;amp;pg=PA91&amp;amp;ots=ocvj368Gm3&amp;amp;sig=hCEMFXZMwo9mFRoGPAmH77k8b-4#v=onepage&amp;amp;q&amp;amp;f=false&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15411" LastEditorUserId="15411" LastEditDate="2021-10-15T18:13:35.553" LastActivityDate="2021-10-15T18:13:35.553" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22681" PostTypeId="2" ParentId="22618" CreationDate="2015-04-10T09:59:33.417" Score="2" Body="&lt;p&gt;The &lt;code&gt;decimate&lt;/code&gt; function in matlab does 2 things. First, the signal is filtered. From your code, and the function &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/decimate.html?refresh=true&quot; rel=&quot;nofollow&quot;&gt;doc&lt;/a&gt; page, I see that it uses Chebyshev Type I IIR filter of order 10 with normalized cutoff frequency &lt;code&gt;0.8/p(i)&lt;/code&gt; and passband ripple 0.05 dB. Next, the signal is downsampled.&lt;br&gt;&#xA;The filter can be created using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[a_lp,b_lp] = cheby1(10,0.05,0.8/p(i));  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should use the initial condition argument in the &lt;code&gt;filter&lt;/code&gt; function in order to work in blocks.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the downsampling is a little bit tricky because you have to make sure that the decimation distance is kept between blocks. IMO, the easiest way to do so is to use block size that is multiple of the decimation factor.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is something to start with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = K*p(i); % K integer&#xA;li = 1;&#xA;lid = 1;&#xA;ri = N;&#xA;rid = K;&#xA;z = [];&#xA;while ri&amp;lt;=numberOfSamples&#xA;  [filteredData,z] = filter(a_lp,b_lp,rawData(li:ri,z);&#xA;  decimatedData(lid:rid) = filteredData(1:p(i):end);&#xA;  li = li + N;&#xA;  ri = ri + N;&#xA;  lid = lid + K;&#xA;  rid = rid + K;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Not sure about the indexes in &lt;code&gt;decimatedData&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-04-10T09:59:33.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22682" PostTypeId="2" ParentId="22652" CreationDate="2015-04-10T11:24:17.827" Score="1" Body="&lt;p&gt;A discrete-time signal represents a continuous-time signal that is band-limited to at most half the sampling frequency. Sampling a continuous-time signal that contains higher frequencies than half the sampling frequency will result in aliasing: Samples of those high frequencies are identical to and cannot be discerned from samples of other frequencies below half the sampling frequency. To avoid contamination of the signal by the aliased frequencies, you would first band-limit (lowpass filter) the continuous-time signal and only then sample it.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-04-10T11:24:17.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22684" PostTypeId="2" ParentId="18126" CreationDate="2015-04-10T15:18:23.267" Score="-3" Body="&lt;p&gt;Refer this link for calculation of Energy and Power of signal: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/11202-automatic-gain-control&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/11202-automatic-gain-control&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15415" LastEditorUserId="15415" LastEditDate="2015-04-10T15:29:27.993" LastActivityDate="2015-04-10T15:29:27.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22685" PostTypeId="1" AcceptedAnswerId="22715" CreationDate="2015-04-10T16:44:42.483" Score="1" ViewCount="1960" Body="&lt;p&gt;&lt;strong&gt;Please see second update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to implement gaussian blur in frequency domain using c#.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those are steps that I'm doing:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Load bitmap.&lt;/li&gt;&#xA;&lt;li&gt;Split bitmap into separate color channels.&lt;/li&gt;&#xA;&lt;li&gt;Convert every channel into complex numbers.&lt;/li&gt;&#xA;&lt;li&gt;Create gaussian kernel:&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create kernel using Gauss Function &lt;img src=&quot;https://i.stack.imgur.com/hbSgI.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/li&gt;&#xA;&lt;li&gt;Transform kernel into complex numbers (Here's my first concern, When I create kernel that contains only values equal to 1 (that's number 1 in every cell), to do so i dont use above function. After transforming that (the kernel with values of 1 only) into complex numbers via external library, i recieve something like this: re=0.0039 im=0.0 for every cell in array, is it valid?).&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;li&gt;FFT on every color channel.&lt;/li&gt;&#xA;&lt;li&gt;FFT on kernel (Second concern - for transformed kernel of all 1, Like i mentioned ealier, i recieve array of re=0.0 im=0.0 complex numbers with 1 and only 1 entery like re=0.0039 im=0.0, is it valid?)&lt;/li&gt;&#xA;&lt;li&gt;Multiply all channel's complex numbers by filter complex number. (For tests kernel is size of input image).&lt;/li&gt;&#xA;&lt;li&gt;IFFT on every color channel.&lt;/li&gt;&#xA;&lt;li&gt;Merge channels into single image.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;As a result, for all 1 kernel tests, I recieve totaly black image, so I made some mistakes on the way, but I dont know what's wrong.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm fairly new to image processing, since it's school project. Can anyone point the mistakes i made?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE #1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Uploading my code as @Olli Niemitalo asked. Several values are hardcoded so if something's unclear feel free to ask. The image i'm testing with is &lt;strong&gt;lena&lt;/strong&gt; 512x512 with 3 color channels (RGB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;s&gt;That's the best &lt;strong&gt;result&lt;/strong&gt; i've received and i'm stuck on that. Below is the most of the code I use.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need something more, just ask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create gaussian kernel.     &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private ComplexImage makeGaussKernel(int side, double min, double max, double step, double std)&#xA;{   &#xA;    Bitmap bitmap = new Bitmap(512, 512, PixelFormat.Format8bppIndexed);&#xA;&#xA;    LockBitmap lbitmap = new LockBitmap(bitmap);&#xA;&#xA;    lbitmap.LockBits();&#xA;&#xA;    for (int i = 0; i &amp;lt; 512; ++i)&#xA;    {&#xA;        for (int j = 0; j &amp;lt; 512; ++j)&#xA;        {&#xA;            lbitmap.SetPixel(i, j, Color.FromArgb(255,0,0,0));&#xA;        }&#xA;    }&#xA;&#xA;    // I'm generating 16x16 white square below.&#xA;    for (int i = 0; i &amp;lt; 16; ++i)&#xA;    {&#xA;        for (int j = 0; j &amp;lt; 16; ++j)&#xA;        {&#xA;            lbitmap.SetPixel(i, j, Color.FromArgb(255));&#xA;        }&#xA;    }&#xA;&#xA;    lbitmap.UnlockBits();&#xA;&#xA;    var result = AForge.Imaging.ComplexImage.FromBitmap(bitmap);&#xA;&#xA;    for (int i = 0; i &amp;lt; 512; ++i)&#xA;    {&#xA;        for (int j = 0; j &amp;lt; 512; ++j)&#xA;        {&#xA;            // Data after conversion to complex is too low, all i get without below multiplication is black image. With multiplication colors are fine.&#xA;            result.Data[i, j].Re *= 1000;&#xA;        }&#xA;    }&#xA;&#xA;    return result;&#xA;}&#xA;&#xA;// The gauss function&#xA;private double gauss2d(double x, double y, double std)&#xA;{&#xA;    return ((1.0 / (2 * Math.PI * std * std)) * Math.Exp(-((x * x + y * y) / (2 * std * std))));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The multiplication:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private void applyGauss(ComplexImage complexImage, ComplexImage filter, int side)&#xA;{&#xA;    int width = complexImage.Data.GetLength(1);&#xA;    int height = complexImage.Data.GetLength(0);&#xA;&#xA;    for(int i = 0; i &amp;lt; height; ++i)&#xA;    {&#xA;        for(int j = 0; j &amp;lt; width; ++j)&#xA;        {&#xA;            complexImage.Data[i, j] = AForge.Math.Complex.Multiply(complexImage.Data[i, j], filter.Data[i, j]);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE #2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made a breakthrough. The weird shift was result of applying the filter in the middle of the image. When I moved the filter to the corner, only few artifacts remains (that's not big deal for now) - see image below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The updated code from &lt;strong&gt;UPDATE #1&lt;/strong&gt; is the only problem now prolly (gaussian generation). I need few tips how to generate the kernel properly. As you can see in code above I generate white square in the corner. I belive it's far from real gaussian blur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also after conversion from normal bytes to complex numbers I receive very dark (in fact black) image. So I tried to multiply real part of complex numbers (you can see that in the code) and after that I received &quot;good&quot; image. I dont really know what's wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Important thing that was discovered by @Olli Niemitalo is that colors are divied by 255 after conversion to complex (by AForge.NET) so If kernel's bitmap is made of 255s, after conversion I receive kernel made of re=1.0 im=0.0 etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I dont have to use AForge.NET to generate complex numbers, so if you've got tips how to generate those without AFN, i will take all of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current result:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/3s0Lu.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;The artifacts / &quot;good&quot; image&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15416" LastEditorUserId="128" LastEditDate="2018-07-16T19:32:22.487" LastActivityDate="2018-07-16T19:32:22.487" Title="Applying Gaussian Blur in Frequency Domain" Tags="|image-processing|fft|filters|gaussian|frequency-domain|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="22688" PostTypeId="1" AcceptedAnswerId="22691" CreationDate="2015-04-10T23:12:32.273" Score="1" ViewCount="401" Body="&lt;p&gt;Related to this question:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/22462/convolution-in-frequency-space-with-fft-and-ifft-num-output-samples&quot;&gt;Convolution in frequency space with fft and ifft -&amp;gt; num output samples?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When doing convolution in time domain by doing multiplication in frequency domain, you apparently can zero pad the time domain samples if you want the time domain convolution result (ifft of the fft multiplication result), to make the resulting time domain convolution be the &quot;correct&quot; length (len(a)+len(b)-1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm wondering is what do you do if you don't have the time domain samples yet?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm generating two sets of IFFT bin data, doing convolution by multiplying in the frequency domain, and then using IFFT to turn the convolution result into time domain data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i do this, the result is the same length as my IFFT bins though, instead of the length i would expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I lengthen the result in the frequency domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15130" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-04-11T12:06:48.723" Title="How do I zero pad time samples if I only have frequency samples?" Tags="|ifft|signal-synthesis|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22689" PostTypeId="1" AcceptedAnswerId="22690" CreationDate="2015-04-10T23:15:48.157" Score="0" ViewCount="271" Body="&lt;p&gt;I wrote some come to backproject depth maps. Testing it with the Middlebury cone set, I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ISEZ3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all it has noise, which I shouldn't get from the ground truth, but more importantly it seems like the points are going further from each other with the depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody explain this phenomenon?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  float baseline = 0.3;&#xA;  float focalLength = 303.0;&#xA;  float numerator = baseline * focalLength;    &#xA;&#xA;  for (int i=10; i&amp;lt;groundTruthDisparity.rows-10; ++i) {&#xA;    for (int j=10; j&amp;lt;groundTruthDisparity.cols-10; ++j) {&#xA;      float distance = groundTruthDisparity.at&amp;lt;uchar&amp;gt;(i,j) / 4.0;&#xA;&#xA;      if (distance != 0 &amp;amp;&amp;amp; !isnan(distance)) {&#xA;        depthMap.at&amp;lt;float&amp;gt;(i,j) = numerator / distance;&#xA;      }&#xA;    }&#xA;  }&#xA;&#xA;  for(int y=1; y&amp;lt;height-1; y++) {&#xA;    for(int x=1; x&amp;lt;width-1; x++) {&#xA;      float depth = depthMap.at&amp;lt;float&amp;gt;(y,x);&#xA;&#xA;      // backproject to world&#xA;      cv::Matx21d homogeneous = cv::normalize((cv::Matx21d(x,y) - principalPoint) * (1.0 / focalDistance));&#xA;      cv::Matx31d transformedPoint = cv::Matx21d(homogeneous(0), homogeneous(1), 1) * depth;&#xA;&#xA;      cloudPoints.push_back(transformedPoint);&#xA;    }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The depth map looks like this (colored in HSV):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MXNgF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="9120" LastEditorUserId="9120" LastEditDate="2015-04-10T23:41:01.300" LastActivityDate="2015-04-10T23:41:01.300" Title="Why is the backprojection of the Middlesbury depth map &quot;cone shaped&quot;?" Tags="|computer-vision|point-cloud|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22690" PostTypeId="2" ParentId="22689" CreationDate="2015-04-10T23:32:28.290" Score="1" Body="&lt;p&gt;The reason that pixels get wider with depth is that the depth map works in projection space, so each pixel is basically shaped like a frustum, not like a box.  Not sure where the noise is coming from but the depth map doesn't look perfectly clean either.&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-10T23:32:28.290" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22691" PostTypeId="2" ParentId="22688" CreationDate="2015-04-11T02:04:24.677" Score="1" Body="&lt;p&gt;Per RBJ I can't do what I want to do, but maybe it isn't even what I want to do in the first place.  Adding this to be able to close the question as answered.&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-11T02:04:24.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22693" PostTypeId="1" AcceptedAnswerId="22704" CreationDate="2015-04-11T12:00:58.660" Score="2" ViewCount="2633" Body="&lt;p&gt;I computed spectrum analysis of sine wave (without windowing and zero-padding) and I got plots as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dEpSr.png&quot; alt=&quot;dft analysis of sine wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know they are correct. When I learnt about DSP, I got the huge problem with understanding what is the phase spectrum. Recently I realised that &quot;phases&quot; are translations along time axis of each sinusoidal component. So I don't see any point to get them out of range $\langle -\pi, \pi \rangle$. I computed my spectrums with python and to get the phase spectrum I used &lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.unwrap.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;unwrap&lt;/a&gt; function from numpy. As I understand this documentation correctly, it is impossible to get the result larger than $\pi$ or less than $-\pi$ unless I set the &lt;code&gt;discount&lt;/code&gt; parameter. It does make sense for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you explain me:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;whether I understand the phase spectrum correctly?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;why the values of phase spectrum are out of range $\langle -\pi, \pi \rangle$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;how does the function &lt;code&gt;unwrap&lt;/code&gt; work?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13464" LastEditorUserId="13464" LastEditDate="2015-04-11T12:15:55.543" LastActivityDate="2016-05-06T03:40:16.313" Title="Phase spectrum range" Tags="|frequency-spectrum|python|phase|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22694" PostTypeId="2" ParentId="22688" CreationDate="2015-04-11T12:06:48.723" Score="2" Body="&lt;p&gt;assuming I understand it, your question is interesting.  I'm &quot;shooting from the hip&quot; here.  I wonder if it would be useful to you to interpolate your two freq-domain sequences by a factor of two before the multiplication in the freq domain, and then performing your IFFT of the product?&#xA;[-Rick-]&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-04-11T12:06:48.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22695" PostTypeId="1" CreationDate="2015-04-11T12:38:09.077" Score="1" ViewCount="1106" Body="&lt;p&gt;How to calculate the time domain amplitude of noise added Sine Gaussian signal from corresponding frequency domain. Here time domain amplitude is 2. How to get this from frequency domain.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 4096;&#xA;Samplingfrequency= 1024;&#xA;timelength=N/Samplingfrequency;&#xA;&#xA;% Generate random&#xA;Noise=rand(1,N)*.1;&#xA;&#xA;t    = linspace(-timelength/2,timelength/2,N);&#xA;Freq=(1/timelength)*[0:N/2-1 -N/2:-1];&#xA;&#xA;signalFrequency = 64 ;&#xA;amplitude=2;&#xA;Q=10;&#xA;tau  = Q /(2 * pi * signalFrequency);&#xA;&#xA;%Sine Gaussian&#xA;Gaussian=((amplitude*exp(-1 .* ((t)/tau).^2) .* cos(2 * pi * signalFrequency .* t))+Noise);&#xA;&#xA;%Time Domain&#xA;subplot(2,1 ,1)&#xA;plot(t,Gaussian);    &#xA;&#xA;%Frequency Domain &#xA;FFTGaussian=abs(fft(Gaussian));&#xA;&#xA;subplot(2,1 ,2)&#xA;% One sided frequency domain plot&#xA;plot(Freq(2:N/2),FFTGaussian(2:N/2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11993" LastActivityDate="2015-12-07T17:17:39.850" Title="Calculate amplitude of noise added Sine Gaussian signal from frequency domain" Tags="|fft|frequency-domain|amplitude|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22697" PostTypeId="2" ParentId="21974" CreationDate="2015-04-11T12:56:01.183" Score="1" Body="&lt;p&gt;perhaps the material at the following web page would be of interest to you: &lt;a href=&quot;http://www.dsprelated.com/showarticle/63.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rick Lyons - Computing Large DFTs Using Small FFTs&lt;/a&gt;.   [-Rick-]&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="7092" LastEditDate="2023-03-27T12:05:10.970" LastActivityDate="2023-03-27T12:05:10.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22698" PostTypeId="2" ParentId="22695" CreationDate="2015-04-11T13:30:58.847" Score="2" Body="&lt;p&gt;Random noise doesn't have an amplitude, it has statistical properties such as standard deviation and variance.  Variance (standard dev. squared) is interpreted as the AC power of the noise.  In the freq domain you can estimate the total power of a signal and the total 'power' (variance) of the noise.  The ratio of the signal power over the noise power is your signal-to-noise ratio.  Multiplying the log-base-ten of that ratio by ten gives you the signal-to-noise ratio measured in dB.  [-Rick-]&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-04-11T13:30:58.847" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22699" PostTypeId="1" CreationDate="2015-04-11T14:16:07.453" Score="4" ViewCount="886" Body="&lt;p&gt;I am trying to understand granulometry. I understand that it deals with determining the size distribution of particles in an image and uses the principles of opening and closing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a smoothed image with marbles in different sizes and call it A and a structuring element B, which is a disk with variable radii. I get that when opening the image with the structuring element B, smaller marbles disappear and by increasing the radius of B, bigger marbles start to disappear. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do not understand is what will happen if I use closing instead of opening. Do the bigger marbles disappear with a smaller radius B? So, does the exact opposite happen with closing?&lt;/p&gt;&#xA;" OwnerUserId="11415" LastActivityDate="2018-05-20T13:11:22.563" Title="Granulometry by morphological opening and closing" Tags="|image-processing|morphological-operations|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22700" PostTypeId="1" AcceptedAnswerId="22858" CreationDate="2015-04-11T17:28:58.610" Score="4" ViewCount="4095" Body="&lt;p&gt;I am beginner in Image processing.I am studying the importance of phase in signal.&lt;strong&gt;Can anybody explain what is phase congruency ?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-06-19T09:41:08.450" LastActivityDate="2015-06-19T09:41:08.450" Title="What is phase congruency?" Tags="|image-processing|fft|signal-analysis|computer-vision|fourier-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22701" PostTypeId="2" ParentId="22700" CreationDate="2015-04-11T18:41:15.350" Score="8" Body="&lt;p&gt;The more that sinewaves that have a zero crossing in the same direction at the same point add up in magnitude, the greater the contrast at that point.  e.g. a possible edge.  Phase congruency is another name (actually a superset) for the amount of sinewaves that line up with zero crossings at (nearly) the same point or points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas a random distribution of phases is more likely to result in something that a human would see as uniform noise rather than an edge.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-13T03:24:19.250" LastActivityDate="2015-04-13T03:24:19.250" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22702" PostTypeId="2" ParentId="22693" CreationDate="2015-04-11T19:51:16.393" Score="0" Body="&lt;p&gt;The diagram is somewhat misleading. What you're actually displaying is the phase of the fourier components, not only the phase of your signal. You could regard every component that is not part of the amplitude peak as an artifact. The picture might become clearer when you add a little noise that swamps low amplitude signals, and/or if you add a second component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Unwrap&quot; just adds even multiples of $\pi$ so that any border discontinuities (at $-\pi$ and $\pi$) in a phase signal are removed, which may be a sensible thing to do or not, depending on the situation. &lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2015-04-11T19:51:16.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22703" PostTypeId="2" ParentId="21976" CreationDate="2015-04-11T19:59:20.823" Score="0" Body="&lt;p&gt;You have to calculate complex exponentials. Every calculator or numerics package can do this. In the case of $\omega={\pi\over 4}$ the results are: $e^{-j{\pi\over 4}}=\sqrt 2- i\sqrt 2$ and $e^{-j{\pi\over 2}}=-i$. The expression for the magnitude evaluates to $3.3793$ at this angle.&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2015-04-11T19:59:20.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22704" PostTypeId="2" ParentId="22693" CreationDate="2015-04-11T20:29:12.383" Score="3" Body="&lt;p&gt;Yes you can think of phases as describing translations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you (kind of passively) wrap the phase to ⟨−π,π⟩ you may be introducing discontinuities that are not truly there considering that −π and π are equivalent. Such artificial discontinuities will hinder calculation of things like group delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unwrapping the phase properly is not trivial. One way to do it properly is to factor the system into such small component systems (connected in series) that you can track the phase frequency response of each without any wrapping ambiguities. The phase frequency response of the composite system will be the sum of those of the component systems. Calculated this way, the phase naturally get values outside of ⟨−π,π⟩. Computationally, the factorization can be done by finding the z-plane zeros of the system. My guess is that numpy.unwrap does nothing of the sort but simply looks for big jumps of the wrapped phase as function of frequency and tries to make those jumps shorter by adding or subtracting 2π. That will easily fail do do a proper job if the frequency response has two zeros at the same frequency, as that gives a jump of 2π that phase unwrapping ought to preserve.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-04-11T20:29:12.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22705" PostTypeId="2" ParentId="22604" CreationDate="2015-04-11T21:00:53.993" Score="1" Body="&lt;p&gt;I agree with visoft's answer, but my understanding of the term &quot;structured image' varies. If visoft's pictures describe the answer to your question, then it is the importance of shadow (its angle, length, darkness) in the interpretation of an image that distinguishes the two. In a 3D world, structured images change with the camera position. With texture images this is not the criterion.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though first to my mind, structured image, means an image that is composed of arranged objects, representing the polarity of textured image, indeed.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, &quot;structured image&quot; can be the term for an image that is composed of individual graphic elements. From &lt;a href=&quot;http://www.google.com/patents/US5485568&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;: A structured image is a hierarchical description of a single output image raster; objects contributing to the output raster may originate from text, graphics, other rasters or a combination thereof, and all maintain their heritage for selectability and modification. In this sort of structured image, each input may be considered an object.&lt;br&gt;&#xA;Traditionally, elements of a &quot;textured image&quot; may be drawn simultaneously, automatically, or artistically, but a record of how a textured image is generated is unnecessary other than the configurations of any automatic process involved. The artists relies solely upon Undo/Redo to salvage their efforts.&lt;br&gt;&#xA;Software can make the difference between the two a matter of taste, in my opinion.&lt;/p&gt;&#xA;" OwnerUserId="8777" LastActivityDate="2015-04-11T21:00:53.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22706" PostTypeId="2" ParentId="19019" CreationDate="2015-04-11T22:14:33.517" Score="0" Body="&lt;p&gt;There is a reference at the &lt;a href=&quot;http://www.linkwitzlab.com/crossovers.htm&quot; rel=&quot;nofollow&quot;&gt;Linkwitz website&lt;/a&gt; regarding the &lt;em&gt;&quot;The Duelund 3-way crossover filter function D3&quot;&lt;/em&gt; that appears to be the 3-band that is &lt;strong&gt;not&lt;/strong&gt; derived from splitting one band of a 2-band L-R crossover.  I may have seen this before, but I am not familiar.  I'll look at it now and see if I can grok it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's &lt;a href=&quot;http://www.musicanddesign.com/Duelund_and_Beyond.html&quot; rel=&quot;nofollow&quot;&gt;another reference&lt;/a&gt; to the Duelund thingie.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay, it appears that this is the essential Duelund 3-way crossover:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_\text{LP}(s) = \frac{1}{s^4 + 2as^3 + (a^2+2)s^2 + 2as + 1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_\text{BP}(s) = \frac{-(a^2+2)s^2}{s^4 + 2as^3 + (a^2+2)s^2 + 2as + 1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_\text{HP}(s) = \frac{s^4}{s^4 + 2as^3 + (a^2+2)s^2 + 2as + 1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this all adds up to an All-pass filter.  Looks like $a=2\sqrt2$ is recommended.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-04-11T22:35:41.070" LastActivityDate="2015-04-11T22:35:41.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22707" PostTypeId="1" AcceptedAnswerId="22709" CreationDate="2015-04-12T03:03:25.260" Score="1" ViewCount="831" Body="&lt;p&gt;I have no physical interpretation of the Bode plot. What does it mean for a bode plot to have negative dB over its entire duration on the log-scale frequency?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-04-12T04:06:27.497" Title="What is the physical interpretation of the dB scale on a bode plot and what is a negative dB?" Tags="|signal-analysis|continuous-signals|linear-systems|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22708" PostTypeId="1" CreationDate="2015-04-12T03:06:34.137" Score="2" ViewCount="7748" Body="&lt;p&gt;Suppose that a system induces a phase of -90 degree, how do I practically measure the delay in the signal coming out of the system? I think time lag would be a more useful measure than phase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly these have different units, what is the conversion factor that tells me how much time lag is induced due to the system? &lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-04-12T18:14:19.847" Title="How to translate &quot;phase&quot; into &quot;delay&quot;" Tags="|phase|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22709" PostTypeId="2" ParentId="22707" CreationDate="2015-04-12T04:06:27.497" Score="5" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Decibel&quot;&gt;Decibels (dB)&lt;/a&gt; are used to represent a power ratio with a logarithmic scale. Specifically, a power ratio can be expressed in dB as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R|_{dB} = 10 \log_{10}R = 10 \ \log_{10}\frac{P_1}{P_2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does a negative number of dB mean? Manipulate the above equation a bit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R|_{dB} = 10 \log_{10}R&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{R|_{dB}}{10} = \log_{10}R&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;10^{\frac{R|_{dB}}{10}} = R&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the ratio measured in dB is less than zero, then the exponent on the left hand side will be negative. 10 raised to a negative power results in a number that is in the range $(0, 1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Therefore,&lt;/strong&gt; if a power ratio measured in dB is less than zero, this implies that, when measured on a linear scale, the ratio is less than one. For a Bode plot, that would mean that the frequency response in question has an amplitude response that is less than unity (for all frequencies, if the Bode plot measured in dB is less than zero everywhere).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-04-12T04:06:27.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22711" PostTypeId="1" CreationDate="2015-04-12T09:07:19.390" Score="10" ViewCount="3232" Body="&lt;p&gt;I know about &lt;a href=&quot;http://whatis.techtarget.com/definition/phase&quot; rel=&quot;nofollow&quot;&gt;phase of a 1D signal&lt;/a&gt;. But when I go into higher dimensions like 2D,3D etc, it becomes headache to grasp the concept. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What are the terms phase shift and phase spectrum mean in case of multidimensional(2D,3D etc.) signal like an Image or video signal? &lt;/li&gt;&#xA;&lt;li&gt;How is the phase term represented mathematically? &lt;/li&gt;&#xA;&lt;li&gt;How do we analyze phase spectrum? &lt;/li&gt;&#xA;&lt;li&gt;Which information do we get from phase spectrum about the signal? &lt;/li&gt;&#xA;&lt;li&gt;Can anybody explain with a plot or figure ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15429" LastEditorUserId="1629" LastEditDate="2016-09-11T08:25:03.817" LastActivityDate="2016-09-11T08:25:03.817" Title="Phase shift and phase spectrum terms in multidimensional signal" Tags="|image-processing|fft|fourier-transform|frequency-spectrum|phase|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22712" PostTypeId="1" AcceptedAnswerId="24207" CreationDate="2015-04-12T11:44:20.007" Score="0" ViewCount="236" Body="&lt;p&gt;I have two images for the same object from the almost same perspective (no more than 1-2 degrees or 1-2 mm is acceptable).&#xA;I want to change the perspective of one of them to match exactly the other so I can make subtraction between them successfully to get a complete black result if there is no change of the content of the object.&#xA;many thanks&lt;/p&gt;&#xA;" OwnerUserId="15118" LastEditorUserId="7338" LastEditDate="2015-06-18T09:03:51.710" LastActivityDate="2015-06-18T09:03:51.710" Title="Matching two very similar images" Tags="|image-processing|computer-vision|opencv|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22714" PostTypeId="1" AcceptedAnswerId="22717" CreationDate="2015-04-12T14:31:27.100" Score="-1" ViewCount="207" Body="&lt;p&gt;The Exponential Fourier Series for a signal is written as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum_{n=-\infty}^{\infty} X_n e^{jnw_0t}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, Fourier Coefficient, $X_n$, is written as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_n = \frac{1}{T} \int_{t_0}^{t_0+T} x(t) \, e^{-jnw_0t} dt\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to understand that how a discrete summation in Eq. (1) changes to a definite integral in Eq. (2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I just lacking the basics of Calculus or it is justifiable to ask it here?&lt;/p&gt;&#xA;" OwnerUserId="15340" LastEditorUserId="4298" LastEditDate="2015-04-12T14:33:31.383" LastActivityDate="2015-11-06T10:34:25.700" Title="Change of discrete summation to definite integral" Tags="|fourier-series|integration|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22715" PostTypeId="2" ParentId="22685" CreationDate="2015-04-12T16:44:31.570" Score="2" Body="&lt;p&gt;I figured it out.. with some cheating but it works. The main problem was kernel generation and applying FFT to it. Also important thing is that AForge.NET divides image pixels by 255 during conversion to ComplexImage and multiplies by 255 during conversion from ComplexImage to Bitmap (thanks Olli Niemitalo).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How I solved this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I've found how kernel should look like after FFT (see below).&lt;/li&gt;&#xA;&lt;li&gt;Looked up colors of that image.&lt;/li&gt;&#xA;&lt;li&gt;Calculated gauss2d for x = -2; y = -2; std = 1.&lt;/li&gt;&#xA;&lt;li&gt;Calculated the prescaler to receive color value from value calculated in pt. 3 (see &lt;a href=&quot;http://www.wolframalpha.com/input/?i=6%3DA%20*%20%281%2F%282*PI*d*d%29%29*EXP%28-%28%28x*x%2By*y%29%2F%282*d*d%29%29%29%2C%20x%20%3D%20-2%2C%20y%20%3D%20-2%2C%20d%20%3D%201%2C%20solve%20for%20A&quot; rel=&quot;nofollow noreferrer&quot;&gt;wolfram&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Generated kernel with scaled values with perscaler from pt. 4.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However I cant use FFT on generated filter, because generated filter looks like filter after FFT already. It works - the output image is blurred without artifacts so I think that's not too bad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The images (I cant post more than 2 links, and images are farily big):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Input image: i.imgur.com/MNN2nOf.jpg&lt;/li&gt;&#xA;&lt;li&gt;Generated filter (without FFT!): i.imgur.com/JV9WNis.png&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parameters for below function:&lt;/li&gt;&#xA;&lt;li&gt;std = 1.0&lt;/li&gt;&#xA;&lt;li&gt;size = 8.0&lt;/li&gt;&#xA;&lt;li&gt;width = height = 512&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Result image: i.imgur.com/fZOLdOE.jpg&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The final code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private ComplexImage makeGaussKernel(double size, double std, int imgWidth, int imgHeight)&#xA;{&#xA;    double scale = 2000.0;&#xA;    double hsize = size / 2.0;&#xA;&#xA;    Bitmap bmp = new Bitmap(imgWidth, imgHeight, PixelFormat.Format8bppIndexed);&#xA;    LockBitmap lbmp = new LockBitmap(bmp);&#xA;&#xA;    lbmp.LockBits();&#xA;&#xA;    double y = -hsize;&#xA;    double yStep = hsize / (lbmp.Height / 2.0);&#xA;    double xStep = hsize / (lbmp.Width / 2.0);&#xA;&#xA;    for (int i = 0; i &amp;lt; lbmp.Height; ++i)&#xA;    {&#xA;        double x = -hsize;&#xA;&#xA;        for (int j = 0; j &amp;lt; lbmp.Width; ++j)&#xA;        {&#xA;            double g = gauss2d(x, y, std) * scale;&#xA;&#xA;            g = g &amp;lt; 0.0 ? 0.0 : g;&#xA;            g = g &amp;gt; 255.0 ? 255.0 : g;&#xA;&#xA;            lbmp.SetPixel(j, i, Color.FromArgb((int)g));&#xA;&#xA;            x += xStep;&#xA;        }&#xA;&#xA;        y += yStep;&#xA;    }&#xA;&#xA;    lbmp.UnlockBits();&#xA;&#xA;    return ComplexImage.FromBitmap(bmp);&#xA;}&#xA;&#xA;private double gauss2d(double x, double y, double std)&#xA;{&#xA;    return (1.0 / (2 * Math.PI * std * std)) * Math.Exp(-(((x * x) + (y * y)) / (2 * std * std)));&#xA;}&#xA;&#xA;private void applyGaussToImage(ComplexImage complexImage, ComplexImage filter)&#xA;{&#xA;    for (int i = 0; i &amp;lt; complexImage.Height; ++i)&#xA;    {&#xA;        for (int j = 0; j &amp;lt; complexImage.Width; ++j)&#xA;        {&#xA;            complexImage.Data[i, j] = AForge.Math.Complex.Multiply(complexImage.Data[i, j], filter.Data[i, j]);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15416" LastActivityDate="2015-04-12T16:44:31.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22716" PostTypeId="1" AcceptedAnswerId="22719" CreationDate="2015-04-12T17:16:03.063" Score="0" ViewCount="62" Body="&lt;p&gt;I frequently see the term &quot;image&quot; thrown around in various DSP discussions.  What exactly does image mean in this context?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-12T19:21:11.903" Title="What is an image in DSP context?" Tags="|signal-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22717" PostTypeId="2" ParentId="22714" CreationDate="2015-04-12T17:44:21.423" Score="1" Body="&lt;p&gt;A $T$-periodic function $x(t)$ can (under some rather mild conditions) be written as a series of weighted complex exponentials with frequencies that are integer multiples of $\omega_0=2\pi/T$. This is the Fourier series of $x(t)$ as given in Eq. $(1)$ of your question. The weights in the sum of $(1)$ are the Fourier coefficients $X_n$, and they need to be computed from $x(t)$ via integration. That's Eq. $(2)$ in your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can make this more plausible for yourself by plugging $(1)$ into $(2)$ and see what you get (I set $t_0=0$ without loss of generality):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_n=\frac{1}{T}\int_0^T\left[\sum_{k=-\infty}^{\infty}X_ke^{jk\omega_0 t}\right]e^{-jn\omega_0 t}\;dt\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming uniform convergence of the Fourier series, we can exchange integration and summation in $(1)$ resulting in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_n=\frac{1}{T}\sum_{k=-\infty}^{\infty}X_k\int_0^Te^{j\omega_0(k-n)t}\;dt\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The integral in $(2)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_0^Te^{j\omega_0(k-n)t}dt=&#xA;\begin{cases}\frac{1}{j\omega_0(k-n)}\left(e^{j2\pi (k-n)}-1\right)=0,&amp;amp;k\neq n\\\displaystyle&#xA;\int_0^Tdt=T,&amp;amp; k=n\end{cases}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I used $\omega_0=2\pi/T$. Eq. $(3)$ can also be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_0^Te^{j\omega_0(k-n)t}dt=T\delta[n-k]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta[n]$ is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_delta#Digital_signal_processing&quot; rel=&quot;nofollow&quot;&gt;unit impulse&lt;/a&gt;. With $(4)$, the expression in $(2)$ becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_n=\frac{1}{T}\sum_{k=-\infty}^{\infty}X_kT\delta[n-k]=X_n\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because the unit impulse eliminates all terms of the sum except for the term $k=n$. Eq. $(5)$ is what we wanted to show to make the two equations in your question more plausible, i.e. assuming that $x(t)$ can be written as a Fourier series, the coefficients $X_n$ must be computed as given by the second equation in your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-06T10:34:25.700" LastActivityDate="2015-11-06T10:34:25.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22718" PostTypeId="2" ParentId="22708" CreationDate="2015-04-12T18:14:19.847" Score="2" Body="&lt;p&gt;The phase delay to time delay conversion depends on the frequency of the signal for which that phase delay is associated.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that unless the phase delay is given as correctly &quot;un-wrapped&quot;, the absolute time delay could be ambiguous by integer multiples of the period of the frequency at which the phase delay was specified or measured.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-12T18:14:19.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22719" PostTypeId="2" ParentId="22716" CreationDate="2015-04-12T19:21:11.903" Score="1" Body="&lt;p&gt;In the context of &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;sampling&lt;/a&gt;, an &lt;em&gt;image&lt;/em&gt; is a copy of the spectrum of the original signal occurring at multiples of the sampling frequency. If the images overlap, then &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;aliasing&lt;/a&gt; occurs, i.e. frequency components above $f_s/2$ cannot be distinguished from components below $f_s/2$ (where $f_s$ is the sampling frequency), and the original signal cannot be completely recovered from its samples.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-12T19:21:11.903" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22721" PostTypeId="1" CreationDate="2015-04-13T00:54:39.350" Score="0" ViewCount="273" Body="&lt;p&gt;I earnestly request apology if this question is inappropriate for the forum. The question has two parts one technical and the other is not technical. I would appreciate any response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me consider a specific use of MDL: model order estimation. For radar/sonar it is equivalent to the estimation of the number of targets (location of target is not considered here). MDL has two parts: maximum likelihood (ML) estimate of the parameter and a penalty function. Many variations exist in the literature related to the penalty function but ML estimate is hardly touched as ML is considered optimal. The model, the ML estimate and the MDL estimate all fine with large sample size; but for small sample size or high noise it is not the case as the 'model' is not accurate. The model is valid only as an expected value which is an asymptotic value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an algorithm which improves the estimate of the number of targets considerably at low number of sample size or higher noise. The algorithm uses concepts of quasi-maximum likelihood.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are: 1) Can we prove that a asymptotically good model, whose parameter we want estimate, for small sample size can have better estimator than ML?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The non-technical question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Anyone interested in this problem or use MDL for number of targets?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="15437" LastActivityDate="2017-02-24T09:29:53.090" Title="Improvement of Minimum description length (MDL) estimate" Tags="|linear-algebra|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22723" PostTypeId="1" CreationDate="2015-04-13T03:46:43.630" Score="-1" ViewCount="96" Body="&lt;p&gt;I need to design a  multi instance DSP algorithm implementation. Any reference Open C source code available ?  Any links on multi instance implementations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;-ben&lt;/p&gt;&#xA;" OwnerUserId="15438" LastActivityDate="2015-04-13T04:07:52.593" Title="Multi instance DSP C Source code" Tags="|dsp-core|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22724" PostTypeId="2" ParentId="22723" CreationDate="2015-04-13T04:07:52.593" Score="0" Body="&lt;p&gt;I've found this book super helpful as a c++ audio programmer.  &quot;Designing Audio Effect Plug Ins in C++&quot;  &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0240825152&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Designing-Audio-Effect-Plug-Ins-Processing/dp/0240825152&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-13T04:07:52.593" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22725" PostTypeId="2" ParentId="10354" CreationDate="2015-04-13T05:06:39.063" Score="1" Body="&lt;p&gt;It's been some years since I've ended the project, so I'd figure I'd revisit my own question in case someone is running into the same problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main contributor in cancelling the crosstalk on an iOS device was deceptively simple; invert your audio samples into the other audio channel (play your normal audio into the left channel, play the same audio but inverted into the right channel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both channels will sound exactly the same, but cancel out a lot of the crosstalk in the audio hardware before being output to the speakers/headphones/etc. This will make the application essentially mono, but it's a decent price to pay seeing how well it worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will not cancel it out all the crosstalk, however. A software solution would probably still be needed.&lt;/p&gt;&#xA;" OwnerUserId="5245" LastActivityDate="2015-04-13T05:06:39.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22726" PostTypeId="1" AcceptedAnswerId="22770" CreationDate="2015-04-13T05:18:19.083" Score="0" ViewCount="655" Body="&lt;p&gt;I want to implement Butterworth low-pass filter. Thanks to &lt;a href=&quot;https://stackoverflow.com/questions/8079526/lowpass-and-high-pass-filter-in-c-sharp&quot;&gt;this question&lt;/a&gt;, I have found out that the filter coefficients can be generated using &lt;a href=&quot;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tony Fisher web-site&lt;/a&gt; or using his code. But the problem arose when I had tried to verify his formulas myself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia says that the derivation of low-pass formulas is simple: we start with the Butterworth polynomial of order &lt;code&gt;n&lt;/code&gt;. I took &lt;code&gt;n=1&lt;/code&gt;&#xA;$$B_1\left(\frac{s}{\omega_{cutoff}}\right)=1+\frac{s}{\omega_{cutoff}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(note that $\omega_{cutoff}$ is angular frequency, not usual one) then do bilinear transform&#xA;$$s = 2f_{sampling}\cdot\frac{z-1}{z+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;($f_{sampling}$ is usual frequency, not angular) and rewrite the resulting fraction in the form with non-positive powers of $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the story short, my final formula for transfer function is&#xA;$$H(z) = \frac{Y(z)}{X(z)}$$&#xA;where&#xA;$$Y(z) = \frac{a}{1+a}+\frac{a}{1+a}z^{-1}$$&#xA;$$X(z) = 1-\frac{1-a}{1+a}z^{-1}$$&#xA;and&#xA;$$a = \frac{\omega_{cutoff}}{2f_{sampling}}$$&#xA;and the resulting formula is&#xA;$$y[n] = \frac{a}{1+a}x[n]+\frac{a}{1+a}x[n-1]+\frac{1-a}{1+a}y[n-1]$$&#xA;For testing I use $f_{cutoff}=1$ (which is $\omega_{cutoff}=2\pi$) and $f_{sampling}=30$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We should not worry about coefficients in front of $x[]$ since Fisher multiplies them by gain factor anyway, but the coefficient in front of $y[n-1]$ equals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1-a}{1+a} = 0.8104139027$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while Fisher's web-page for $f_{cutoff}=1$ and $f_{sampling}=30$ gives $0.8097840332$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you had a patience to finish this reading, may be you can explain, where I (or Fisher?) am wrong.&lt;/p&gt;&#xA;" OwnerUserId="15439" LastEditorUserId="4298" LastEditDate="2018-08-07T22:26:48.780" LastActivityDate="2018-08-07T22:26:48.780" Title="my Butterworth lowpass formulas do not agree with Fisher webpage" Tags="|discrete-signals|filter-design|lowpass-filter|bilinear-transform|derivation|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22727" PostTypeId="2" ParentId="22721" CreationDate="2015-04-13T07:17:44.197" Score="0" Body="&lt;p&gt;1) For instance, A biased estimator may have better performance (such as variance) than ML. Don't know for your specific problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I suppose you are studying state estimation, and more speciaficaly, multi-target tracking problems as they arise in sonar and radar.&#xA;In that case, finding the number of target is an essential problem and lots of people are working on it. Try to read some paper on PHD filters, whose main goal is to find an estimate on the mean number of target withing a given area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;www.ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4086095 is a gread practical introduction to PHD filter (in their most simple implementation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Vo brothers are doing great work on this subject. As well as herriot-watt unviersity (Daniel Clark if my memory is good)&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-13T07:17:44.197" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22728" PostTypeId="1" AcceptedAnswerId="22729" CreationDate="2015-04-13T10:57:19.100" Score="0" ViewCount="176" Body="&lt;p&gt;Why a filter of the form &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;1+a_0 z^{-1} +a_1 z^{-2}+ a_2 z^{-3}&#xA;$$&#xA;has the same amplitude response when in the reversed form&#xA;$$&#xA;a_2+a_1 z^{-1} +a_0 z^{-2}+z^{-3}&#xA;$$&#xA;but the phase response is different. I don't get it, and can't understand what the differences in terms of the relative group delays mean.&lt;/p&gt;&#xA;" OwnerUserId="15442" LastEditorUserId="4298" LastEditDate="2015-04-13T11:25:05.823" LastActivityDate="2015-04-13T11:25:05.823" Title="Why this two FIR filters have the same amplitude but different phase response" Tags="|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22729" PostTypeId="2" ParentId="22728" CreationDate="2015-04-13T11:24:43.977" Score="3" Body="&lt;p&gt;If you have a causal length $N$ FIR filter with impulse response $h[n]$, and with frequency response $H(e^{j\omega})$, and you invert it on the time axis, you get a new filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[n]=h[-n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This filter is non-causal, but since it is an FIR filter, it can be made causal by shifting it to the left by $N-1$ samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f[n]=g[n-(N-1)]=h[N-1-n]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what you're doing. Now since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\sum_{n=-\infty}^{\infty}h[n]e^{-jn\omega}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(e^{j\omega})=\sum_{n=-\infty}^{\infty}h[-n]e^{-jn\omega}=\sum_{n=-\infty}^{\infty}h[n]e^{jn\omega}=H(e^{-j\omega})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(e^{j\omega})=G(e^{j\omega})e^{-j(N-1)\omega}=H(e^{-j\omega})e^{-j(N-1)\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (3) you can see that for real-valued $h[n]$ you have $H(e^{-j\omega})=H^*(e^{j\omega})$ (where $*$ denotes complex conjugation). So you finally get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(e^{j\omega})=H^*(e^{j\omega})e^{-j(N-1)\omega}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and since $|e^{-j(N-1)\omega}|=1$, and $|H^*(e^{j\omega})|=|H(e^{j\omega})|$ you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|F(e^{j\omega})|=|H(e^{j\omega})|\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the magnitude responses of the original filter and the time-reversed filter are identical. The phase responses are different: from (4) you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|F(e^{j\omega})|e^{j\phi_F(\omega)}=|H(e^{j\omega})|e^{-j\phi_H(\omega)}e^{-j(N-1)\omega}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi_F(\omega)=-\phi_H(\omega)-(N-1)\omega\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;follows. Since the group delay is the negative derivative of the phase, the group delays are related by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_F(\omega)=-\tau_H(\omega)+N-1\tag{8}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-13T11:24:43.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22731" PostTypeId="1" AcceptedAnswerId="22756" CreationDate="2015-04-13T13:26:11.853" Score="0" ViewCount="453" Body="&lt;p&gt;I'm coding a synthesis external for MaxMSP in C. &#xA;It's based on Peter Blasser's bounds and bounce concept ( &lt;a href=&quot;http://petermopar.blogspot.co.uk/2014_04_01_archive.html&quot; rel=&quot;nofollow&quot;&gt;http://petermopar.blogspot.co.uk/2014_04_01_archive.html&lt;/a&gt; )- basically triangle waves with constant cursor rate (rather than frequency) and modulated bounds - eg instead of moving between -1 and 1, the wave moves between lo and hi, with lo and hi modulated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This morning I've been thinking of adding waveshape morphing between triangle and sine (or at least sinusoidal since the moving bounds will deform the sine). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can think of a fairly simple way to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Assuming classic triangle moving between bounds -1 to 1 &#xA;// and defining position of triangle cursor @ n = pos&#xA;// shape_amt between circa 0.1 (Tri) and 1.0 (sine)&#xA;out = sin(pos * shape_amt * 0.5* pi ) / sin(shape_amt *0.5 * pi())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ie - basic waveshaping technique - scale the portion of the lookup table that's being scanned (in this case some segment of half a sine wave) to vary the shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my specific case all I'll need to do from there is build in scaling from relative position between to bounds to relative position between -1 and 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question really is- is this a horribly inefficient way of achieving what I'm after? I'm new to DSP coding and to coding in C so I'm sure the way that's most obvious to me isn't the best. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious performance improvement that occurs to me is to create a wavetable of the sin function and look up rather than calculate those values. Obviously that way I lose resolution on the &quot;straighter&quot; portions of the wave, but either a high res lookup or decent interpolation feels like it ought to deal with that fairly well. Mainly I'm considering this for LFO applications so quality needn't be utterly stellar (though it'll be nice nice if it's useable into the audio range without too much fuzzy aliasing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But beyond that, is there just a completely different approach that would be more efficient? &#xA;And if this is the best approach, are there any things I should think of when pursuing it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit - Thanks for great answers below. I've ended up doing something fairly simple (and possibly crude) for the moment, which suits my purposes pretty well. I'll definitely be investigating both suggestions as improvements to this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define sign(a) ( ( (a) &amp;lt; 0 )  ?  -1   : ( (a) &amp;gt; 0 ) )&#xA;#define LKTBL_LNGTH 2048&#xA;&#xA;void setup_lktables (t_object* x)&#xA;{   // create lookup for 1/4 sine&#xA;    int i;&#xA;    for(i=0, i&amp;lt; LKTBL_LNGTH, i++){&#xA;        x-&amp;gt;sin[i] = sin(pi * i * 0.5 / LKTBL_LNGTH) ;&#xA;    }&#xA;}&#xA;&#xA;double lookup_shape (t_double pos, t_double shape, t_double lo, t_double hi) &#xA;// acting on triangle wave (phase + (2*gradient*f/sr) per sample, wraps &amp;amp; changes dir  at &amp;lt;lo and &amp;gt;hi)&#xA;// shape comes in as restricted to (-1...-0.05, 0.05 ...1), defines the portion of lookup to use&#xA;&#xA;{&#xA;    t_double midpoint, halfwidth, ph, fracph, shaped;&#xA;    t_int maxph, intph, sign;&#xA;    // get relative position between bounds for waveshaping lookup&#xA;    midpoint = lo + 0.5f * (hi - lo);&#xA;    halfwidth = midpoint - lo;&#xA;    // prepare phase values for lookups&#xA;    maxph = shape * LKTBL_LNGTH - 1;&#xA;    ph = (pos - midpoint) * maxph /  halfwidth;&#xA;    sign = sign(ph);&#xA;    ph = ph * sign;&#xA;    intph = (int)ph;&#xA;    fracph = ph - intph;&#xA;    // lookup, scale &amp;amp; lerp&#xA;    shaped = sign * (x-&amp;gt;sin[intph] * (1.f - fracph) + x-&amp;gt;sin[intph+1] * fracph) / x-&amp;gt;sin[maxph];&#xA;&#xA;    //now return  waveshaping output scaled to actual bounds&#xA;    return midpoint + shaped * halfwidth&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15278" LastEditorUserId="15278" LastEditDate="2015-04-15T11:02:47.243" LastActivityDate="2019-01-15T19:59:43.100" Title="efficient triangle to sine morphing?" Tags="|audio|music|oscillator|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22732" PostTypeId="1" AcceptedAnswerId="22737" CreationDate="2015-04-13T15:14:03.010" Score="1" ViewCount="81" Body="&lt;p&gt;I have a raw signal which, if interpreted correctly with various 'tuning' parameters set to their optimum values, can be seen to consist of a relatively small (but &lt;em&gt;a priori&lt;/em&gt; unknown) set of discrete frequency components. With the tuning parameters set at sub-optimum values, the power spectrum is spread out - each frequency component is broader or, in the very poorly-tuned case, there can be many 'false' frequency peaks. Some example plots would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good tuning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8gfiA.png&quot; alt=&quot;Example with good tuning parameters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Poor tuning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mDEIF.png&quot; alt=&quot;Example with poor tuning parameters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Awful tuning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AiIjv.png&quot; alt=&quot;Example with awful tuning parameters&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd like is to be to able to auto-tune by identifying a figure-of-merit which is highest for the 'good tuning' case, lowest for the 'awful tuning' case, and somewhere in the middle for the 'poor tuning' case. If I knew &lt;em&gt;a priori&lt;/em&gt; that there was a single frequency component, this would be fairly straightforwrad but I haven't been able to think of a good appraoch when the number of components is unknown. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a standard approach to this problem that I'm unaware of?&lt;/p&gt;&#xA;" OwnerUserId="527" LastActivityDate="2015-04-13T20:27:41.170" Title="Figure of merit for 'locality of power'" Tags="|power-spectral-density|source-separation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22733" PostTypeId="2" ParentId="3179" CreationDate="2015-04-13T15:43:05.397" Score="5" Body="&lt;p&gt;The frequency response is the same, yes, but the application is different:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;With a low-pass filter, your signal is in the passband.  The cutoff frequency of the filter is set &lt;em&gt;above&lt;/em&gt; the highest frequency you want to keep in your signal.&lt;/li&gt;&#xA;&lt;li&gt;With a leaky integrator, your signal is in the stopband.  The cutoff frequency of the filter is set &lt;em&gt;below&lt;/em&gt; the lowest frequency in your signal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FDhq0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, integrators are always first-order, while low-pass filters can be any order.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2016-09-15T14:21:33.157" LastActivityDate="2016-09-15T14:21:33.157" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22734" PostTypeId="2" ParentId="18651" CreationDate="2015-04-13T16:21:52.577" Score="0" Body="&lt;p&gt;Wavelet cross correlation, wavelet cross coherence, and cross wavelet phase analysis may help.&lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7092" LastEditDate="2015-04-13T18:32:39.707" LastActivityDate="2015-04-13T18:32:39.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22736" PostTypeId="2" ParentId="22732" CreationDate="2015-04-13T17:53:50.973" Score="0" Body="&lt;p&gt;I don't know if there is a standard approach, but if your graphs are representative you could simply use peak amplitude (you would need to perform peak detection) or [ peak amplitude / power ] where power would be the area under your graph.&lt;/p&gt;&#xA;" OwnerUserId="3546" LastActivityDate="2015-04-13T17:53:50.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22737" PostTypeId="2" ParentId="22732" CreationDate="2015-04-13T18:18:33.470" Score="3" Body="&lt;p&gt;You could try calculating Shannon entropy of the spectrum. Normalize the Fourier transform $f(x)$ of your signal so that $\int_{-\infty}^\infty |f(x)|^2\, dx = 1$ and calculate Shannon entropy as $- \int_{-\infty}^\infty |f(x)|^2 \log |f(x)|^2\, dx$. You can clamp $|f(x)|^2 \log |f(x)|^2$ to zero for very small values of $f(x)$ if its logarithm blows up and ruins the calculations. Zero-padding before windowing &amp;amp; FFT will give you more frequency resolution and a better approximation, especially if you have narrow peaks in the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want something more standard, have a look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;nofollow&quot;&gt;spectral flatness&lt;/a&gt;. But it seems even less stable numerically.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-13T20:27:41.170" LastActivityDate="2015-04-13T20:27:41.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22739" PostTypeId="1" AcceptedAnswerId="22743" CreationDate="2015-04-13T20:07:24.720" Score="0" ViewCount="1009" Body="&lt;p&gt;can anyone tell me the position of null subcarrier in $N=256$ subcarrier OFDM. since edges re assigned null to prevent interference from an adjacent symbol, i assuming that the subcarrier $-127$ to $-100$ then $0$ and then $100$-$128$ are null, is that correct assumption, please respond!&lt;/p&gt;&#xA;" OwnerUserId="15447" LastEditorUserId="7092" LastEditDate="2015-04-13T20:30:20.490" LastActivityDate="2015-04-14T01:40:02.300" Title="position of null carriers in N=256 subcarier OFDM" Tags="|matlab|signal-analysis|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22740" PostTypeId="2" ParentId="18928" CreationDate="2015-04-13T20:35:26.873" Score="1" Body="&lt;p&gt;I wrote code in Java based on that article but it isn't working for me. Alpha (I-data scalar) calculates to be around $100$ and $cos(\omega)$ often calculates to an imaginary number. Did anyone have any luck with this or could point me to a better IQ Correction algorithm? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(To be clear: &lt;code&gt;calculateMatrix&lt;/code&gt;, &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;c&lt;/code&gt;, and &lt;code&gt;d&lt;/code&gt; are all instance variables)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public void correctIQ(int[] data) {&#xA;&#xA;    int length = data.length / 2;&#xA;&#xA;    // ( I'(t) &amp;amp; Q'(t) )&#xA;    int[] iData = new int[length];&#xA;    int[] qData = new int[length];&#xA;&#xA;    // Deinterleave IQ data &#xA;    for (int i = 0; i &amp;lt; length; i++) {&#xA;        iData[i] = data[i * 2];&#xA;        qData[i] = data[i * 2 + 1];&#xA;    }&#xA;&#xA;    // ( I''(t) &amp;amp; Q''(t) )&#xA;    double[] qDataOffset = new double[length];&#xA;    double[] iDataOffset = new double[length];&#xA;&#xA;    // Calculate DC offset&#xA;    double qOffset = mean(qData);&#xA;    double iOffset = mean(iData);&#xA;&#xA;    // Apply DC offset&#xA;    for (int i = 0; i &amp;lt; length; i++) {&#xA;        iDataOffset[i] = iData[i] - iOffset;&#xA;        qDataOffset[i] = qData[i] - qOffset;&#xA;    }&#xA;&#xA;    // Provided equations calculated on frequency change&#xA;    if(calculateMatrix) {&#xA;        double alpha = Math.sqrt(2.0 * multiplyMean(iDataOffset, iDataOffset));&#xA;        double sinw = (2.0 / alpha) * multiplyMean(iDataOffset, qDataOffset);&#xA;        double cosw = Math.sqrt(1.0 - (sinw * sinw));&#xA;&#xA;        a = 1.0f / alpha;&#xA;        c = -sinw / (alpha * cosw);&#xA;        d = 1.0f / cosw;&#xA;    }        &#xA;&#xA;    // Replace into interleaved array&#xA;    for(int i=0;i&amp;lt;length;i++) {&#xA;        data[i*2]=(int)((iData[i]-iOffset)*a);&#xA;        data[i*2+1]=(int)((iData[i]-iOffset)*c+(qData[i]-qOffset)*d);&#xA;    }&#xA;}&#xA;&#xA;double mean(int[] values) {&#xA;    long sum = 0L;&#xA;    for(int i=0;i&amp;lt;values.length;i++) {&#xA;        sum+=values[i];&#xA;    }&#xA;    return ((double)sum)/values.length;&#xA;}&#xA;&#xA;double multiplyMean(double[] values1, double[] values2) {&#xA;    long sum = 0L;&#xA;    for(int i=0;i&amp;lt;values1.length;i++) {&#xA;        sum+=values1[i]*values2[i];&#xA;    }&#xA;    return ((double)sum)/values1.length;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15448" LastEditorUserId="7092" LastEditDate="2015-04-13T21:25:31.197" LastActivityDate="2015-04-13T21:25:31.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22741" PostTypeId="1" AcceptedAnswerId="88730" CreationDate="2015-04-13T22:27:23.003" Score="3" ViewCount="4022" Body="&lt;p&gt;I have been working on image processing. I have an image and then add it a Gaussian noise with standard deviation=0.005. then using averaging filter to denoise it (I know it is not a good idea). then I got negative PSNR. what this means? I think PSNR is a positive measurement.&#xA;the code for calculating PSNR is as follow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function psnr1=PSNR(I,J)&#xA;&#xA;mse1=(double(I)-double(J)).^2;&#xA;MSE1m=(mse1(:,:,1,:)+mse1(:,:,2,:)+mse1(:,:,3,:))/3;&#xA;psnr1=10*log10(255^2/mean(mean(MSE1m)));&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;what is wrong?&#xA;the final results for my code is these curves:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xeAFZ.jpg&quot; alt=&quot;avg means averaging filter is applied and W is window size&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15003" LastActivityDate="2023-07-16T14:05:55.120" Title="Is it possible to have negative PSNR?" Tags="|image-processing|video-processing|" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="22742" PostTypeId="2" ParentId="20002" CreationDate="2015-04-14T01:19:05.840" Score="2" Body="&lt;p&gt;The edges of the shadows are crisper where they are nearer to the shadow caster.  Also, since the sun is so far away, beams of light are essentially parallel when they reach us, which means that shadows from sunlight are basically orthographic projections of the shadow casters.  Also, if you knew an objects dimensions and saw its shadow on something that you knew the slope of, you could probably calculate the angle of the sun, and so maybe could calculate what time it was, and maybe something about the season or latitude??&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-14T01:19:05.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22743" PostTypeId="2" ParentId="22739" CreationDate="2015-04-14T01:40:02.300" Score="0" Body="&lt;p&gt;Positioning of null carriers in an OFDM signal is a protocol-dependent piece of information. Specifications will often call for some null carriers around the edge of the band (to allow for rolloff in the antialiasing filters in the front end). Another common place you'll find a null carrier is at the band center. This may be found in specifications that are targeted at low-cost (i.e. zero-IF) receiver technology. Zero-IF receivers' baseband DC offsets can cause large spurious responses in the tuned band center, hence the use of a null carrier there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the short answer to your question is that it's unanswerable: it's dependent on the specifics of the system you're working with.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-04-14T01:40:02.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22744" PostTypeId="1" AcceptedAnswerId="22745" CreationDate="2015-04-10T16:39:00.130" Score="1" ViewCount="636" Body="&lt;p&gt;I am in the process of developing a video game where I would like to sync a character's mouth with an audio clip of their speech that is playing.  I found this great website that shows the profiles of different vowel sounds in a frequency spectrum: &lt;a href=&quot;http://hyperphysics.phy-astr.gsu.edu/hbase/music/vowel.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://hyperphysics.phy-astr.gsu.edu/hbase/music/vowel.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a little (&lt;em&gt;actually, a lot of&lt;/em&gt;) effort, I am able to show in real time the spectrum of the audio that is playing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zhBSz.png&quot; alt=&quot;Spectrum of Audio&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step I am planning to do is find the 4 largest peaks and try to match it to one of the vowel profiles from the website above.  However, I have noticed that the relative power of the frequency domain coefficients is always strong lower than higher.  The picture I showed is in silence. During an SSSSSS sound, the spectrum does show peaks at higher frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pUogB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I ignore the first few points in the silence FT and then relatively graph the rest, the spectrum has the same shape.  If I ignore a few more, again the lower frequencies are much stronger than the higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that this is the result of the math which I can barely get through to code the basic FFT.  Should I be normalizing the result somehow to be able to see peaks in the higher frequencies?  What process should I use for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help you can provide!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To add info requested in the comments, by &quot;in real time&quot;, I mean that every frame (at about 60 frames per seconds), I get a set of 1024 samples (sampled at 44100 Hz) that is centered at the point of audio that is currently playing).  I then compute the FT of these samples and draw the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="15455" OwnerDisplayName="PatrickSharbaugh" LastActivityDate="2015-04-14T07:24:06.803" Title="Normalize Fourier Transform For Video Game" Tags="|acoustics|fourier-transform|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22745" PostTypeId="2" ParentId="22744" CreationDate="2015-04-14T05:57:51.317" Score="2" Body="&lt;p&gt;Not sure if your approach is the right path. Anyhow, hearing aid research has produced many &quot;long term average speech spectrum&quot; (LTASS) curves that you can use to whiten the spectrum by dividing it with the LTASS. Have a look at &lt;a href=&quot;http://www.dydaktyka.cba.pl/AvSpeech.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dydaktyka.cba.pl/AvSpeech.pdf&lt;/a&gt; (Byrne et al. 1994 &quot;An international comparison of long‐term average speech spectra&quot; J. Acoust. Soc. Am. 96, 2108) Just don't divide by the LTASS dB values but linearize them first to $10^{LTASS\_in\_dB/20}$ if you are dealing with magnitude frequency spectrum or to $10^{LTASS\_in\_dB/10}$ if you are dealing with power spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the worldwide average LTASS from Byrne et al. 1994:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jtqfx.png&quot; alt=&quot;Worldwide LTASS&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Freq.   Male    Female  Combined&#xA;(Hz)    (dB)    (dB)    (dB)&#xA;63      38.6    37.0    38.6&#xA;80      43.5    36.0    43.5&#xA;100     54.4    37.5    54.4&#xA;125     57.7    40.1    57.7&#xA;160     56.8    53.4    56.8&#xA;200     58.2    62.2    60.2&#xA;250     59.7    60.9    60.3&#xA;315     60.0    58.1    59.0&#xA;400     62.4    61.7    62.1&#xA;500     62.6    61.7    62.1&#xA;630     60.6    60.4    60.5&#xA;800     55.7    58.0    56.8&#xA;1000    53.1    54.3    53.7&#xA;1250    53.7    52.3    53.0&#xA;1600    52.3    51.7    52.0&#xA;2000    48.7    48.8    48.7&#xA;2500    48.9    47.3    48.1&#xA;3150    47.0    46.7    46.8&#xA;4000    46.0    45.3    45.6&#xA;5000    44.4    44.6    44.5&#xA;6300    43.3    45.2    44.3&#xA;8000    42.4    44.9    43.7&#xA;10000   41.9    45.0    43.4&#xA;12500   39.8    42.8    41.3&#xA;16000   40.4    41.1    40.7&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-14T07:24:06.803" LastActivityDate="2015-04-14T07:24:06.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22746" PostTypeId="1" CreationDate="2015-04-14T07:07:14.230" Score="0" ViewCount="1002" Body="&lt;p&gt;I am performing decorrelation of two channels of audio using all pass filtering. The two all pass filters for two channels are of very high order (&gt;1000 but with not all coefficients non zero). I have to perform this filtering in frequency domain. I get input samples in 2048 frame size (48 K sampling) with 50 % overlap Hann windowed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to apply this filter (a small intermediate matlab snippet for one of the channels)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freq_resp_filter=freqz(filter_APF,4096,'whole');&#xA;&#xA;fft_input_sig=fft(input_sig_frame,4096);&#xA;&#xA;filtered_sig_fft=freq_resp_filter.*fft_input_sig;&#xA;&#xA;filtered_sig_ifft=ifft(filtered_sig_fft); % done for testing only&#xA;&#xA;final_2048_samples=filtered_sig_ifft(1:2048); % throw away last 2048 samples to                 &#xA;remove aliasing by fft convolution&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then i recombine this &lt;code&gt;final_2048_samples&lt;/code&gt; with previous frames with overlapping. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I listen to the output audio, I hear intermittent noise with signal, &#xA;the noise is absent when I apply the same filter in time domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;my question is: &#xA;1. Is this implementation correct (I have to perform this in frequency domain! and I can not do overlap add/save as this block is a part of a system, and I have no control over frame size, so every operation, 2048 samples should be given as output for further processing. )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Kd&lt;/p&gt;&#xA;" OwnerUserId="1959" LastEditorUserId="8202" LastEditDate="2015-04-14T14:11:05.913" LastActivityDate="2015-05-14T23:22:59.793" Title="filtering in frequency domain" Tags="|fft|frequency-domain|filtering|ifft|allpass|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22752" PostTypeId="2" ParentId="22746" CreationDate="2015-04-14T15:51:25.013" Score="2" Body="&lt;p&gt;Here is a visual answer why it is not working. The overlap is not even symmetrical in the last step so the scheme can't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qnNqC.png&quot; alt=&quot;sheme 1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you make it symmetrical by making the filter zero-delay, the amount of stuff that gets summed together varies by time, so it can't be right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/R32wt.png&quot; alt=&quot;scheme 2&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-14T16:31:07.350" LastActivityDate="2015-04-14T16:31:07.350" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22754" PostTypeId="2" ParentId="22746" CreationDate="2015-04-14T17:28:26.957" Score="0" Body="&lt;p&gt;You can't just throw away the last 2048 time-domain samples of the circular convolution as they contain part of the convolution results (as least for the length of the impulse response of the filter - 1).  For fast convolution filtering, you must save those samples for subsequent overlap save processing, or else the process will be lossy, perhaps severely so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use overlapping Von Hann windows, the windows have to overlap by an exact integer sub-multiple of the window width in order for the amplitude envelope of the resulting window sum to be unmodulated (except for the very beginning and end of the overlap sequence).   This works because the process ends up being a linear decomposition and re-composition with a linear operation in the middle (assuming correct overlap add/save fast convolution, and, again, except at the very beginning and very end).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-14T17:40:11.603" LastActivityDate="2015-04-14T17:40:11.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22756" PostTypeId="2" ParentId="22731" CreationDate="2015-04-14T18:30:16.580" Score="0" Body="&lt;p&gt;This answer is about using sines instead of triangles in the bounds and bounce concept. There is no way to do it so that these defining conditions of the original concept are all satisfied:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;While the boundaries stay constant the output is a pure sine wave (triangle for the original algorithm) that goes from the upper boundary to the lower boundary.&lt;/li&gt;&#xA;&lt;li&gt;Moving the boundaries suddenly does not create a discontinuity in the output.&lt;/li&gt;&#xA;&lt;li&gt;Moving the boundaries suddenly does not create a discontinuity in the derivative (slope) of the output.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Say the sine wave has reached the upper boundary and the boundaries are updated. Sine waves of other amplitudes cannot have zero derivative at that amplitude value, so the scheme fails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can make it work if you constrain the boundary changes to times of zero crossings of the sine wave:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ehhzB.png&quot; alt=&quot;sines&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You just have to decide on the slope at zero crossing and your sine turns out as:  &lt;span class=&quot;math-container&quot;&gt;$$\text{boundary}\times\sin\left(\frac{\text{slope}\times\text{time}}{\text{boundary}}\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2019-01-15T19:59:43.100" LastActivityDate="2019-01-15T19:59:43.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22761" PostTypeId="1" CreationDate="2015-04-14T22:15:48.927" Score="0" ViewCount="257" Body="&lt;p&gt;I am coding a program which uses a FFT to process audio data. I need to aggregate the FFT output into three bins (&quot;bass&quot;, &quot;mid&quot;, and &quot;treb&quot;) determined by two arbitrary frequency values. The end-goal is, more or less, a spectrum analyzer with 3 variable-size frequency bands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the magnitude of the complex numbers obtained from the FFT is bounded above by a known number B, it seems to me that the most intuitive method to aggregate the data would be to calculate average magnitude within a band and then convert the average to decibels referencing B. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method leaves me with a serious concern, however... Since there are fewer measurements at lower frequencies, it serves to reason that there will exist a higher degree of spectral leakage in a low-frequency octaves than in high-frequency octaves. I fear that this will cause the average for the &quot;bass&quot; bin to trend higher than that of the &quot;mid&quot; and &quot;treb&quot; bins, thus causing a disconnect between the presented data and what is actually perceived. I am already applying a window function to incoming audio samples, but tests of my program suggest that this might still be an issue. As illustration (graph of several window functions, vertical gridlines at each octave, input is simple sinusoid):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/elTIA.png&quot; alt=&quot;Low freq spectral leakage&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Low freq spectral leakage&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ds4yU.png&quot; alt=&quot;High freq spectral leakage&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;High freq spectral leakage&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is averaging as stated above the de facto standard for aggregating audio data in an application like the one I've described? Are there alternatives that may be better suited to my use-case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the concern I mentioned well-founded? If so, are there any standard tactics to mitigate the problem?&lt;/p&gt;&#xA;" OwnerDisplayName="user15465" LastEditorDisplayName="user15465" LastEditDate="2015-04-14T22:55:24.340" LastActivityDate="2015-04-14T22:55:24.340" Title="What is the preferred method of aggregating audio FFT data given variable-size frequency bins?" Tags="|fft|discrete-signals|audio|" AnswerCount="0" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22762" PostTypeId="1" AcceptedAnswerId="22764" CreationDate="2015-04-14T22:22:13.207" Score="1" ViewCount="1250" Body="&lt;p&gt;Below is an example of a digital modulation system using 16-QAM. I have copied this example from MATLAB communications toolbox, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   M = 16;                     % Size of signal constellation&#xA;   k = log2(M);                % Number of bits per symbol&#xA;   n = 30000;                  % Number of bits to process&#xA;   numSamplesPerSymbol = 1;    % Oversampling factor&#xA;   dataIn = randi([0 1],n,1);&#xA;   dataInMatrix = reshape(dataIn, length(dataIn)/4, 4); % Reshape data into binary 4-tuples&#xA;   dataSymbolsIn = bi2de(dataInMatrix);&#xA;   dataMod = qammod(dataSymbolsIn, M);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am wondering if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) there is a need to reshape the bits into tuples of 4 bits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) there is a need to do the mapping from binary to decimal and then do the QAM modulation, couldn't I just have done    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;dataMod = qammod(dataIn, M)&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-04-14T22:40:10.087" LastActivityDate="2015-04-14T22:43:42.187" Title="Question regarding 16 QAM digital modulation" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22764" PostTypeId="2" ParentId="22762" CreationDate="2015-04-14T22:43:42.187" Score="1" Body="&lt;p&gt;First of all, I recommend getting familiar with Matlab's &lt;code&gt;doc&lt;/code&gt; command. &lt;code&gt;doc qammod&lt;/code&gt; has the answers to your second question: &lt;code&gt;qammod&lt;/code&gt; requires a vector of integers between 0 and &lt;code&gt;M-1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your first question: the reason to reshape your bits into groups of four is that 16-QAM transmits $\log_2(16)=4$ bits per symbol. So, your &lt;code&gt;bi2de&lt;/code&gt; command requires binary numbers of four bits to get decimal integers betwen 0 and 15.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to save lines of code, what you could do is generate integers between 0 and 15 directly, with &lt;code&gt;dataSymbolsIn = randi([0 15], n/4, 1)&lt;/code&gt;. However, doing this has one disadvantage: calculating the bit error rate at the receiver is more complicated if all you have are the integers. Let's say that you transmit a 15 and receive a 13 (obtained with &lt;code&gt;qamdemod&lt;/code&gt;), how many bit errors there were? This is why it's common practice to start with actual bits in the transmitter and compare them one-to-one with the received bits.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-04-14T22:43:42.187" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="22765" PostTypeId="1" AcceptedAnswerId="22767" CreationDate="2015-04-14T23:22:25.777" Score="1" ViewCount="181" Body="&lt;p&gt;In digital communication systems, we use forward error correction codes such as LDPC, turbo, convolutional codes (to decrease the bit error), then we have to use an appropriate decoder at the receiver side. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if using convolutional codes, one should use Viterbi decoder. My questions are next:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the optimal decoders for LDPC, and turbo codes?&lt;/li&gt;&#xA;&lt;li&gt;What is the role of a detector then? Is a detector a demodulator or something else (I have read that they could be MMSE, ZF, etc) ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I think I am confused with what is the function of each of the detector, demodulator, decoder?&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="1629" LastEditDate="2016-03-24T17:47:50.883" LastActivityDate="2016-03-24T17:47:50.883" Title="Decoders, Detectors and Demodulators" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22766" PostTypeId="1" AcceptedAnswerId="22816" CreationDate="2015-04-14T23:44:52.200" Score="1" ViewCount="688" Body="&lt;p&gt;I am working on FFT analysis AFM like the one shown below. I am currently at a point where I understand fairly well what an FFT does, and how to think about the information it gives. I currently have an $M\times N$ matrix of Fourier coefficients (FC) for a 2D-image like the one below. Choosing to look at the real and imaginary part of the FC's gives the amplitudes for sine and cosine terms in the Fourier expansion. I use the notation $X[k,l]$ to index the FC's. For some of my images the real and imaginary parts of the FFT look something like what is shown below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sample Image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ge4HU.jpg&quot; alt=&quot;&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real part of FC's:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TMIE5.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imaginary part of FC's:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bUKhU.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the above FC plots are not for the image shown above. I am looking now to pull out the dominant functional forms. In general with these experiments it is expected that there will be 2 two-directions along which there are dominant sinusoids. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there standard ways of computing an average amplitude for 2D-FFT's? I was thinking that there is probably a way to perform a weighted average using the magnitudes of the Fourier coefficients. References and suggestions appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking something like this in order to compute the average amplitude:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\langle X \rangle=\sum_{k=0}^{M-1}\sum_{l=0}^{M-1}\frac{X_R^2}{X_R^2+X_I^2}X_R(k,l)-\frac{X_I^2}{X_R^2+X_I^2}X_I(k,l)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The terms in front of $X_R$ and $X_I$ are my crude way to weight the importance of each sinusoid to the total signal. I have no justification for my choice, which is something I would like clarified. Perhaps there is an accepted way to weight the amplitudes. Clearly, my average is bad because of when $X_R=X_I=0$ I get a 0/0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers. &lt;/p&gt;&#xA;" OwnerUserId="15201" LastEditorUserId="15490" LastEditDate="2015-04-17T10:30:09.287" LastActivityDate="2015-04-17T10:30:09.287" Title="Is there a method to compute an average amplitude for 2D sinusoids using the F.C.'s?" Tags="|image-processing|dft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22767" PostTypeId="2" ParentId="22765" CreationDate="2015-04-15T02:48:31.640" Score="1" Body="&lt;p&gt;Your question 1) is too broad to answer. In general, the optimum decoder finds the code word that is closest to the received word. In most cases, the computational complexity of such a decoder is too large, and suboptimum decoders are needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for question 2), a &quot;detector&quot;, in the original sense, is an analog circuit that &quot;detects&quot; the message from the received signal. For example, in AM, an envelope detector recovers the modulating signal. In digital communications, it is commonly used to denote a system that recovers the symbols from the received signal. A &quot;demodulator&quot; would recover bits from the symbols. Finally, a (hard decision) decoder performs error control on the received bits.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-04-15T02:48:31.640" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22770" PostTypeId="2" ParentId="22726" CreationDate="2015-04-15T08:09:35.357" Score="3" Body="&lt;p&gt;The problem is in the way you apply the bilinear transform. You have to use the appropriate (pre-)warping of the frequencies. Since the bilinear transform warps the frequency axis, you have to make sure that the corner frequency of the discrete-time filter is correct. One way to do that is as follows. The bilinear transform is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s=k\frac{z-1}{z+1}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with some constant $k$ yet to be defined. If we denote the analog frequency by $\Omega$, and the normalized discrete-time frequency by $\omega$, Eq. (1) becomes for $s=j\Omega$ and $z=e^{j\omega}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$j\Omega=k\frac{e^{j\omega}-1}{e^{j\omega}+1}=k\frac{e^{j\omega/2}-e^{-j\omega/2}}{e^{j\omega/2}+e^{-j\omega/2}}=jk\tan(\omega/2)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. (2) describes the frequency warping caused by the bilinear transform. If we use an analog lowpass filter with a normalized corner frequency $\Omega_0=1$, we must choose the constant $k$ such that for the desired discrete-time corner frequency $\omega_0$ the term on the right-hand side of Eq. (2) becomes $1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$k=\frac{1}{\tan(\omega_0/2)}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_0$ is the desired corner frequency of the digital filter. Eq. (3) and Eq. (1) define the appropriately normalized bilinear transform that you must use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for your example, the normalized first-order analog Butterworth lowpass transfer function is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s)=\frac{1}{1+s}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the bilinear transform gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{1+k\frac{z-1}{z+1}}=\frac{z+1}{z(1+k)+1-k}=\frac{1}{1+k}\cdot\frac{1+z^{-1}}{1+\frac{1-k}{1+k}z^{-1}}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ignoring the gain term $1/(1+k)$, the corresponding difference equation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]+x[n-1]-\frac{1-k}{1+k}y[n-1]\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a desired corner frequency $\omega_0=2\pi/30$ you get from (3) $k=9.5144$ and $(1-k)/(1+k)=-0.80978$, just like on Fisher's website.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-15T08:09:35.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22772" PostTypeId="1" CreationDate="2015-04-15T08:40:54.997" Score="1" ViewCount="271" Body="&lt;p&gt;I have this question:&#xA;&quot;Show that for the optimal filter coefficients the error $e[n]$ is orthogonal to the input signal $w[n]$.&quot;&#xA;anybody have an idea?&lt;/p&gt;&#xA;" OwnerUserId="15468" LastEditorUserId="80" LastEditDate="2015-04-15T13:37:18.537" LastActivityDate="2015-04-15T18:58:40.643" Title="Wiener filter optimal coefficients and the input signal" Tags="|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22773" PostTypeId="1" CreationDate="2015-04-15T09:39:09.960" Score="0" ViewCount="41" Body="&lt;p&gt;Consider these two signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BzO5O.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They both describe a biological process going on in the same subject. The blue one is obtained at rest and the red one after the subject is perturbed. Is there a principled way to model change such as evinced here? &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;A possible approach&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Just comparing the standard deviations of the blue and red actually works well in many such cases, since the red signal is somewhat &quot;dampened&quot; but I am not entirely satisfied with this approach.&lt;/p&gt;&#xA;" OwnerUserId="13444" LastEditorUserId="13444" LastEditDate="2015-04-15T09:44:49.210" LastActivityDate="2015-04-15T09:44:49.210" Title="Is there a principled way to distinguish between these signals?" Tags="|signal-analysis|estimation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22775" PostTypeId="2" ParentId="22772" CreationDate="2015-04-15T11:21:47.653" Score="0" Body="&lt;p&gt;In other words,you should show that the expected value of the error term multiplied by input signal is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you ask about the reason, the linear estimator of the signal that minimizes the error(between the estimator and the signal) is given by the projection theorem and the projection is computed by directly minimizing the mean square error or by applying the orthogonality between error and the input signal.&lt;/p&gt;&#xA;" OwnerUserId="11654" LastEditorUserId="11654" LastEditDate="2015-04-15T11:33:59.867" LastActivityDate="2015-04-15T11:33:59.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22777" PostTypeId="1" CreationDate="2015-04-15T11:53:05.970" Score="2" ViewCount="389" Body="&lt;p&gt;I'm trying to personalise a custom CBIR by adding more features not only based on colour, but based on textures' features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't know is if I'm approaching this well with Haralick's features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm doing this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used 10 images, 8 for different &quot;textures&quot; and 2 for tests:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FH4x5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All p&lt;strong&gt;x&lt;/strong&gt;.jpg are sand images, and all r&lt;strong&gt;x&lt;/strong&gt;.jpg are squares. The &lt;strong&gt;test&lt;/strong&gt; image is squares and &lt;strong&gt;test2&lt;/strong&gt; image is sand. (NOTE, I don't want to &lt;em&gt;classify&lt;/em&gt;, I want a value for each image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, when I query the image &lt;strong&gt;test (squares)&lt;/strong&gt; on the rest of the images (r1, r2, r3, r4, p1, p2, p3, p4) I got the Haralick's features such as &lt;code&gt;Angular 2nd moment, Contrast, Correlation...&lt;/code&gt; but I can't find a relationship with the &lt;em&gt;squares&lt;/em&gt;, or a not-relationship with &lt;em&gt;sand&lt;/em&gt;. I'm making a euclidean distance in this case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    double features[15]; // I'm introducing other things as well&#xA;    Haralick h;&#xA;    h.CalculateCoocurrenceMatrix(features);&#xA;    correlation();&#xA;&#xA;    for (int j = 1; j&amp;lt;=11; j++) {&#xA;        float result = sqrt(pow(featurestest[j]-features[j],2));&#xA;        if (result &amp;gt; f_max[j]) {&#xA;            f_max[j] = result; // to normalize later&#xA;        }&#xA;&#xA;        jsonFeatures[&quot;F&quot;+to_string(j)] = result;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is: am I doing this approach well? if not, how should I do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;If it wasn't clear, I don't want to classify such like I'm doing in the example. I'm using &quot;sand&quot; and &quot;squares&quot; only to make the results more visually when sorting (for example seeing p1 p2 r1 p3 p4 r2 p5 r3 r4 r5 on the final match feature).&lt;/p&gt;&#xA;" OwnerUserId="10898" LastEditorUserId="80" LastEditDate="2017-05-05T13:14:14.787" LastActivityDate="2022-04-11T12:02:40.240" Title="Haralick features, am I approaching this correctly?" Tags="|image-processing|local-features|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22779" PostTypeId="1" CreationDate="2015-04-15T12:36:21.077" Score="1" ViewCount="2637" Body="&lt;p&gt;I have a simple sine function as $sin(2\pi ft + \phi)$. I want to obtain the phase signal $\phi$. &#xA;I tried to use FFT to calculate $\phi$. In matlab I do the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f=200; %frequency of sine wave&#xA;overSampRate=30; %oversampling rate&#xA;fs=overSampRate*f; %sampling frequency&#xA;phase = 3/5*pi; %desired phase shift in radians&#xA;nCyl = 5; %to generate five cycles of sine wave&#xA;&#xA;t=0:1/fs:nCyl*1/f; %time base&#xA;&#xA;x=sin(2*pi*f*t+phase); %replace with cos if a cosine wave is desired&#xA;&#xA;NFFT=1024; %NFFT-point DFT&#xA;X=fft(x,NFFT); %compute DFT using FFT&#xA;XX=2*abs(X(1:NFFT/2+1));&#xA;[tt ind]=max(XX);&#xA;phase_Estimate=angle(X(ind);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This result makes almost no sense to me. For example, when $\phi=0.523$, phase_Estimate is obtained $-0.98$.&lt;/p&gt;&#xA;" OwnerUserId="15471" LastEditorUserId="7092" LastEditDate="2015-04-15T13:16:01.820" LastActivityDate="2015-04-15T15:53:01.553" Title="recovering phase of sine signal from FFT" Tags="|fft|dft|phase|cosine|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22780" PostTypeId="2" ParentId="22777" CreationDate="2015-04-15T12:37:13.373" Score="1" Body="&lt;p&gt;Using the Euclidean distance on a feature space will eventually result in a Minimum Distance Classifier which would provide information on the existence or not of a relationship that you seem to be after (for more information please see: &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/classify.htm&quot; rel=&quot;nofollow&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/classify.htm&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, if you are using all Haralick features, you are looking at a 13-14 dimensional feature space and a decision boundary that is not a line any more but a plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual way to do this is to first calculate the &quot;class centroids&quot;, that is, the mean values of each feature for each set of sand and checker board images and then, given the features of the test image, calculate its distance from the centroids of each class and select the minimum (i.e. the class centroid that the test-image features are more closely to).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-04-15T12:37:13.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22781" PostTypeId="2" ParentId="22779" CreationDate="2015-04-15T13:09:07.677" Score="4" Body="&lt;p&gt;It makes sense after all: your phase estimate is an estimate of the unknown phase angle $\phi$ &lt;em&gt;minus&lt;/em&gt; $\pi/2$, because you're using a sine function. So the phase of the FFT at the appropriate frequency index corresponds to $\phi-\pi/2$. So in your example, $\phi\approx -0.98+\pi/2=0.59$, which is a lot closer to the actual phase. If you used a cosine function, your way of estimating the phase would be correct.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-04-15T15:39:37.360" LastActivityDate="2015-04-15T15:39:37.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22782" PostTypeId="2" ParentId="22779" CreationDate="2015-04-15T15:35:24.140" Score="0" Body="&lt;p&gt;Using an non-interpolated FFT result phase only works if the period of sinusoid is exactly an integer submultiple of the FFT length.  In your example, the sine wave isn't integer periodic in aperture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, you will need to interpolate the phase to get a better estimate.  Here's one method to get an better interpolated phase:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First fftshift (rotate by N/2) the data to move the zero phase reference point to the center of the window before doing the FFT.  (This is needed to keep the phase from flipping/alternating between adjacent FFT result bins. * )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then do the FFT and estimate the frequency of the sinusoid by parabolic or, better yet, Sinc interpolation.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use the estimated frequency to linearly interpolate the phase between the nearest two FFT result bin phases.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use the estimated frequency and phase at the center of the window to calculate the phase at some other point, such as the beginning of the FFT window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that the phase of a sine is different from the phase of a cosine wave by pi/2.  atan(im,re) returns the cosine phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(* as an alternative to pre-fftshit-ing the data, one could also post-flip the phase of the odd FFT result bins.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-15T15:53:01.553" LastActivityDate="2015-04-15T15:53:01.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22783" PostTypeId="1" CreationDate="2015-04-15T16:35:09.640" Score="2" ViewCount="318" Body="&lt;p&gt;I have a ECG signal measured as a test subject is performing 3 different activities - sitting, walking(2mph) and jogging(5mph) and also the corresponding 3-axis accelerometer(X,Y and Z) signals. I can visually observe correlation between the amplitude of accelerometer signal and noise in the ECG signal for the 3 activities. The following are my questions,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to decide on which axis of accelerometer data to use as noise feed to an adaptive LMS filter? Or should a combination of all 3 axes data be considered and if so, how?&lt;/li&gt;&#xA;&lt;li&gt;Does the accelerometer data have to be normalized to the amplitude range of the ECG signal for effective performance of LMS filter?&lt;/li&gt;&#xA;&lt;li&gt;What are the suggested parameters for the LMS filter for this case(The available literature is not clear on this problem).&lt;/li&gt;&#xA;&lt;li&gt;For implementation in a embedded platform, is RL, LMS or NLMS suggested?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="128" LastEditDate="2019-06-26T08:55:05.660" LastActivityDate="2019-06-26T08:55:05.660" Title="Motion Artifact Cancellation from ECG Signal Using 3 Axis Accelerometer Data" Tags="|denoising|adaptive-filters|least-squares|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22785" PostTypeId="1" AcceptedAnswerId="22795" CreationDate="2015-04-15T17:50:05.127" Score="1" ViewCount="2215" Body="&lt;p&gt;I have couple of questions?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is there a relationship between a FIR filter being minimum phase/mixed phase and being causal?&lt;/li&gt;&#xA;&lt;li&gt;Is there a relationship between a FIR filter being minimum phase/mixed phase and its group delay. I understand that a symmetric/non symmetric filter has a constant phase and fixed group delay. But, what if filter is FIR and non-symmetric?Doe symmetry affect the min/max/mixed phase ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11096" LastEditorUserId="11096" LastEditDate="2015-04-16T01:01:25.543" LastActivityDate="2015-04-16T07:42:15.013" Title="Causal and minimum phase" Tags="|linear-phase|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22786" PostTypeId="2" ParentId="22785" CreationDate="2015-04-15T18:19:39.503" Score="1" Body="&lt;p&gt;There's lots to your question, so this will only be a partial answer until we clear up some things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Minimum Phase&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Definition_Minimum_Phase_Filters.html&quot; rel=&quot;nofollow&quot;&gt;A &lt;em&gt;minimum phase&lt;/em&gt; filter is one that has all its poles and zeros inside the unit circle.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Minimum_phase&quot; rel=&quot;nofollow&quot;&gt;Alternatively, a &lt;em&gt;minimum phase&lt;/em&gt; filter is one that is causal and stable and the inverse of which is also causal and stable.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now let's partially address your first question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a relationship between a FIR filter being &lt;strong&gt;minimum phase&lt;/strong&gt;/mixed phase and being causal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;By definition, a minimum phase system is causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer the second part (about mixed phase filters), we need to understand what causality is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Causal&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Causal_filter&quot; rel=&quot;nofollow&quot;&gt;A filter is causal if the output does not depend on future inputs.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now let's address the second part of your first question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a relationship between a FIR filter being minimum phase/&lt;strong&gt;mixed phase&lt;/strong&gt; and being causal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If your FIR filter can be written as:&#xA;$$&#xA;H(z) = \sum_{p=-M}^{+N} h_p z^{p}&#xA;$$&#xA;then $H(z)$ is causal if $N \le 0$ (i.e. there are only zero or negative powers of $z$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Constant Phase&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You make the statement:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I understand that a symmetric/non symmetric filter has a constant phase &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which is completely incorrect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only FIR filters with constant phase are the ones where $N=0$ and $M=0$ so that $H(z) = h_0$ (i.e. a constant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Symmetric FIR filters and anti-symmetric FIR filters can have constant &lt;em&gt;group delay&lt;/em&gt; (and generalized linear phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Group Delay&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The group delay of a minimum phase FIR filter will be a function of frequency, because minimum phase FIR filters cannot have constant group delay (except in the trivial case of $H(z) = h_0$ noted above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Placement of zeros&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I get filter which has zeros outside the unit circle, and impulse response which is non symmetric. I am told that this is typical of non-causal filter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is perfectly possible for a causal FIR filter to have zeroes outside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Break&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think your real question at the bottom is about system identification, but I needed to clarify the misconceptions in your build up first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if this makes sense, and I'll try to address the rest of your question later.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-04-15T20:47:38.017" LastActivityDate="2015-04-15T20:47:38.017" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22787" PostTypeId="2" ParentId="22772" CreationDate="2015-04-15T18:45:02.907" Score="2" Body="&lt;p&gt;For conveniece I'm going to drop the time indexes. Let $e=d-\mathbf{a}^T\mathbf{x}$, where $d$ is the desired signal and $\mathbf{a}$ weights the elements of the observations/input vector $\mathbf{x}$. The goal is to minimize expected squared error with respect to the vector $\mathbf{a}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\min J=\min E[e^2],$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $E$ is the expectation operator.&#xA;To find the minimum we take the derivative of the objective function w.r.t. $\mathbf{a}$ and set it equal to zero. Therefore&#xA;$$&#xA;\mathbf{g}=\frac{\partial E[e^2]}{\partial \mathbf{a}}=E[2e\frac{\partial e}{\partial \mathbf{a}}]=0,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but from the defintion of $e$ earlier, we have&#xA;$$ \frac{\partial e}{\partial \mathbf{a}}= -\mathbf{x}$$&#xA;Therefore &#xA;$$ E[2e\frac{\partial e}{\partial \mathbf{a}}]= -E[2e\mathbf{x}]=0. $$ The factor 2 can be removed and thus $E[e\mathbf{x}]=0$, which means the error $e$ is orthogonal to the input signal $\mathbf{x}$.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2015-04-15T18:58:40.643" LastActivityDate="2015-04-15T18:58:40.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22790" PostTypeId="1" CreationDate="2015-04-15T23:39:41.403" Score="1" ViewCount="85" Body="&lt;p&gt;Conventional methods of filtering allow one to block parts of a frequency band while passing others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But thinking outside of conventional means, and perhaps not based on any frequency methods at all, are there filtering methods for blocking wide band noise, however passing rapid moving signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example. Say I have a square wave with 'hair' on it (white-like noise). I just want to get the square wave with corners as sharply as possible - and minimum hair on the output. Outside of conventional FIR, IIR, Kalman filtering are there any nonlinear tricks?&lt;/p&gt;&#xA;" OwnerUserId="8809" LastActivityDate="2015-04-16T09:42:15.123" Title="Nonlinear tricks for blocking wide band noise" Tags="|filtering|denoising|non-linear|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22791" PostTypeId="1" CreationDate="2015-04-16T01:00:37.253" Score="0" ViewCount="67" Body="&lt;p&gt;I have a white noise data for 10 sec ( with 2 min silence or zero data at start and end)that is captured by sensor after delay t1( which I dont know). same data is captured after delay t1 and t2 by sensor 2. I want to compute transfer function(system identification) between sensor 1 and sensor 2.&#xA;when I use LMS( I know unknown is IIR) to adapt, I get filter which has zeros outside the unit circle, and impulse response which is non symmetric. I am told that this is typical of non-causal filter.  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If I use sensor 1 data, capture portion of say 5 sec of white noise data from the first non zero sample, treat it as my input , and then do the same for sensor 2 data , treating it as desired signal for LMS, would this be a right approach?&lt;/li&gt;&#xA;&lt;li&gt;Alternatively, assuming a group delay of &lt;em&gt;filter_len/2&lt;/em&gt;, where &lt;em&gt;filter_len&lt;/em&gt; is the length of LMS filter, sensor 2 data would be delayed by this amount , with respect to sensor 1. So, capturing white noise data starting from first non zero sample would amount to adapting the filter too soon( disregarding the group delay) and hence will give anticausal filter?&lt;br&gt;&#xA;I tried capturing sensor 2 starting from group delay samples before the non zero sample, and repeat the LMS adaption, but the filler still looks all over the place.( see Figure attached , with LMS of filter length 256, step size 0.08)&#xA;Any suggestions on how can I solve this problem?&lt;br&gt;&#xA;Thank You&lt;img src=&quot;https://i.stack.imgur.com/LMo3M.png&quot; alt=&quot;plot 1 and 2 show sensor 1 and 2 data in freq domain&quot;&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LMo3M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11096" LastActivityDate="2015-04-16T01:00:37.253" Title="system identification with delayed desired signal" Tags="|filters|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22793" PostTypeId="1" AcceptedAnswerId="22828" CreationDate="2015-04-16T01:44:54.693" Score="0" ViewCount="124" Body="&lt;p&gt;In graphics, MSAA is a technique where  you take multiple samples of something per pixel and then average the values to get the final pixel value. The image quality improves as a result, and its considered a form of anti aliasing.  Does this technique have an equivalent in audio samples or other 1d data streams?&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-17T14:59:54.303" Title="Does MSAA make sense in audio / 1d data streams?" Tags="|aliasing|anti-aliasing-filter|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22794" PostTypeId="2" ParentId="22793" CreationDate="2015-04-16T07:38:48.923" Score="1" Body="&lt;p&gt;No. The reason is that MSAA works in the visual domain. Optically, we have hardwired edge detectors. MSAA eliminates unintended edges in generated images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Acoustically, we do not have such edge detectors, and therefore there's no reason to remove them. Also, loudspeakers already filter out such edges mechanically. &lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2015-04-16T07:38:48.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22795" PostTypeId="2" ParentId="22785" CreationDate="2015-04-16T07:42:15.013" Score="2" Body="&lt;p&gt;A minimum-phase system is always causal and stable by definition, so in the case of discrete-time systems with rational transfer functions, all poles and zeros are inside the unit circle of the complex $z$-plane. This is why a minimum-phase system can be inverted by a causal and stable system. Because of this definition, it does not make sense to compare non-causal systems and their phase lag or group delay to the corresponding properties of minimum-phase systems. Minimum-phase systems have the smallest possible phase lag of all &lt;em&gt;causal&lt;/em&gt; systems with the same magnitude response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The group delay is a function of frequency. For symmetric/anti-symmetric impulse responses, the group delay is constant. This is probably what you meant in your question. Such linear-phase (constant group delay) systems can never be minimum-phase (unless their impulse response is just a unit impulse at $n=0$). Minimum-phase systems have a frequency dependent group delay, but at any frequency, their group delay is smaller than the group delay of any other causal system with the same magnitude response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-16T07:42:15.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22800" PostTypeId="2" ParentId="22790" CreationDate="2015-04-16T09:42:15.123" Score="1" Body="&lt;p&gt;A very common non-linear filtering technique for removing noise while preserving edges is &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;median filtering&lt;/a&gt;. It basically replaces the samples inside a window by their median. &lt;a href=&quot;http://en.wikipedia.org/wiki/Total_variation_denoising&quot; rel=&quot;nofollow&quot;&gt;Total variation denoising&lt;/a&gt; is another non-linear technique that works especially well for denoising piece-wise constant signals. You can find some more information about this method and Matlab software &lt;a href=&quot;http://eeweb.poly.edu/iselesni/lecture_notes/TVDmm/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-16T09:42:15.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22801" PostTypeId="1" AcceptedAnswerId="22803" CreationDate="2015-04-16T09:49:10.370" Score="1" ViewCount="231" Body="&lt;p&gt;When reading about autoregressive models (AR), people often &quot;downsample to increase the phase angle of the poles of the corresponding transfer function&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly does downsampling affect the phase angle of the poles?&lt;/p&gt;&#xA;" OwnerUserId="11556" LastActivityDate="2015-04-16T10:18:39.747" Title="Why does downsampling increase the phase angle of poles in autoregressive models?" Tags="|downsampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22803" PostTypeId="2" ParentId="22801" CreationDate="2015-04-16T10:18:39.747" Score="3" Body="&lt;p&gt;Decimating a signal $x[n]$ by an integer factor $M$ results in the following $\mathcal{Z}$-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=\frac{1}{M}\sum_{k=0}^{M-1}X\left(e^{-j2\pi k/M}z^{1/M}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you assume that $x[n]$ was filtered by an anti-aliasing filter before decimation, the transfer function of the decimated filter can be approximated by the term for $k=0$ in (1):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)\approx\frac{1}{M}X(z^{1/M})\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if $z_{\infty}$ is a pole of $X(z)$ then $z_{\infty}^{M}$ is a pole of $Y(z)$. Writing the pole in polar coordinates $z_{\infty}=re^{j\phi}$ gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z_{\infty}^M=r^Me^{jM\phi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the angle of the pole is increased by a factor $M$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-16T10:18:39.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22805" PostTypeId="1" CreationDate="2015-04-16T12:37:25.907" Score="0" ViewCount="145" Body="&lt;p&gt;For an experiment i have a simple application that takes a quadrature signal from a radio and then does the following:&#xA;Complex FFT -&gt; Inverse FFT -&gt; Cartesian to Polar -&gt; audio out&#xA;If I tune the radio to an AM signal I can demodulate it perfectly well by this but it depends on how the FFT is processed.&#xA;In the FFT routine, I apply a window and if it is anything other than a rectangular window the sound is distorted even to the point where it's only noise.  The sample thing if there is any FFT sample overlap.  Why is this the case?&#xA;As I mentioned this is an experiment.  I already have a fully functional spectrum scope which provides very good resolution using a Blackman window and sample overlap.  I wish to add demodulation of the signals in the frequency domain starting from the spectrum but this is problematic.&#xA;Thanks for any insight (I'm a beginner in DSP).&lt;/p&gt;&#xA;" OwnerUserId="7741" LastActivityDate="2015-04-16T12:37:25.907" Title="Audio output distorted with any FFT Windowing other than rectangular" Tags="|fft|audio|window-functions|ifft|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22806" PostTypeId="1" CreationDate="2015-04-16T12:39:41.290" Score="0" ViewCount="174" Body="&lt;p&gt;I am trying to include the ability to have sub-clock delays on an FPGA system's data bus without the need of fractional delay filters.  I am using a Xilinx V6 part, and could utilize its IODELAYE1 instance, but the max delay it can create is less than half a period, and the parts cannot be cascaded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there theory for how to to do sub clock delays of data buses within a system?&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2015-04-16T12:39:41.290" Title="Sub-clock FPGA delays on output line" Tags="|discrete-signals|algorithms|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22807" PostTypeId="1" AcceptedAnswerId="22809" CreationDate="2015-04-16T13:40:27.940" Score="0" ViewCount="8003" Body="&lt;p&gt;I have an array of complex values. Actually this array contains fast Fourier transformation fft values. now I want to fetch maximum complex value from the array. Thanks &lt;/p&gt;&#xA;" OwnerUserId="15072" LastActivityDate="2015-04-16T14:07:44.803" Title="How can I get maximum complex value from an array of complex values(524289) in python?" Tags="|fft|python|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22808" PostTypeId="2" ParentId="22807" CreationDate="2015-04-16T13:53:30.387" Score="0" Body="&lt;p&gt;Complex numbers don't have an ordering. But you can calculate the squared magnitude $\text{re}(x)^2 + \text{im}(x)^2$ where $re(x)$ is the real part of the complex number $x$ and $im(x)$ is its imaginary part (with the imaginary unit removed). Scan your array and find the largest squared magnitude. You might be able to use the built in function &lt;code&gt;max&lt;/code&gt;, possibly with a custom ordering function.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-04-16T13:53:30.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22809" PostTypeId="2" ParentId="22807" CreationDate="2015-04-16T13:55:30.310" Score="4" Body="&lt;p&gt;&quot;Maximum&quot; is ambiguous when it comes to complex values.  The complex value itself doesn't have a min or max.  Which is greater, &lt;code&gt;1+0j&lt;/code&gt; or &lt;code&gt;0+1j&lt;/code&gt;?  What about &lt;code&gt;1+0j&lt;/code&gt; and &lt;code&gt;0+.5j&lt;/code&gt;?  The answer to these questions determines what exactly what you want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the maximum real part (&lt;code&gt;max(1+0j, 0+10j) == 1&lt;/code&gt;), maximum imaginary part (&lt;code&gt;max(10+0j, 0+1j) == 1&lt;/code&gt;), maximum absolute value (&lt;code&gt;max(10+0j, 0+1j) == 10&lt;/code&gt;, &lt;code&gt;max(1+0j, 0+10j) == 10&lt;/code&gt;), complex value with the maximum real part (&lt;code&gt;max(1+0j, 0+10j) == 1+0j&lt;/code&gt;), complex value with the maximum imaginary part (&lt;code&gt;max(10+0j, 0+1j) == 0+1j&lt;/code&gt;), or complex value with the maximum absolute value (&lt;code&gt;max(10+0j, 0+1j) == 10+0j&lt;/code&gt;, &lt;code&gt;max(1+0j, 0+10j) == 0+10j&lt;/code&gt;).  All are possible with numpy arrays.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default in numpy (&lt;code&gt;arr.max()&lt;/code&gt; or &lt;code&gt;np.max(arr)&lt;/code&gt; when &lt;code&gt;arr&lt;/code&gt; is complex) is the complex value with the maximum real part.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;arr = np.random.random(1000)+np.random.random(1000)*1j  # generate example data&#xA;&#xA;maxreal = arr.real.max()  # maximum real part&#xA;maximag = arr.imag.max()  # maximum imaginary part&#xA;maxabs = np.abs(arr).max()  # maximum absolute value&#xA;&#xA;maxcompreal = arr[arr.real.argmax()]  # complex value with maximum real part&#xA;maxcomp = arr.max()  # complex value with maximum real part, same as above&#xA;maxcompimag = arr[arr.imag.argmax()]  # complex value with maximum imaginary part&#xA;maxcompabs = arr[np.abs(arr).argmax()]  # complex value with maximum absolute value&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13631" LastEditorUserId="13631" LastEditDate="2015-04-16T14:07:44.803" LastActivityDate="2015-04-16T14:07:44.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22810" PostTypeId="1" CreationDate="2015-04-16T14:16:13.987" Score="0" ViewCount="228" Body="&lt;p&gt;I'm doing color correction on Raw images taken from Camera directly. I want to make my Camera reproduce same colors as my Target camera. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the steps I'm following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take Target Color values by Capturing a Macbeth Color chart by using Target Camera &amp;amp; Take set of 24 Color Palette's.&lt;/li&gt;&#xA;&lt;li&gt;Take the Input Color Values by Capturing the same Macbeth Color chart by using Reference Camera &amp;amp; Take set of 24 Color Palette's.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now if i Compute Color correction directly at this stage, all the White colors are appearing Rose or Not correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So I'm applying Gamma correction as follows:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Split the Three channels. For each Color find the Gamma for that color palette by using this formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;float Gamma_R = log10(Target_R/255.0))/(log10(Input_R/255.0);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Error Cases:1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the Input_Channel Value == 255 make it as 254&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the Input_Channel Value == 0 make it as 1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If gamma_Channel &gt; 3 or gamma_Channel &amp;lt; 0.2 make gamma_Channel as 1.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Average the Values of Gamma_R for all 24 colors &amp;amp; make this as a&#xA;gamma of that channel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply Gamma for Each channel using the Gamma computed for Each channel using the formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Corrected_R = 255 * (Input_R/255)^(1/Gamma_R)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How to make sure the Gamma Values that I've computed are correct at this stage? Also correct me if I'm doing it wrong.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What to do when the Following Error case: 1 happens?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After applying Gamma correction &amp;amp; Color Correction using 3x3 Matrix (Assume I'm doing that correctly) still the colors are not reproduced correctly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If i encode the gamma by using same Gamma Values from Previous stage using this formula, again the Colors are not reproduced correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Corrected_R = 255 * (Input_R/255)^(Gamma_R)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;So do i need to compute the Gamma again from the Color corrected output?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any suggestion or References is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="5912" LastActivityDate="2015-04-17T05:39:13.397" Title="How to Linearise an Input Image before applying Color Correction?" Tags="|computer-vision|image-processing|color|camera|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22811" PostTypeId="1" CreationDate="2015-04-16T14:22:54.927" Score="3" ViewCount="2202" Body="&lt;p&gt;I would like to ask for some guidance regarding 2 issues mainly QPSK and Gardner algorithm for timing recovery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having as input a set of IQ samples (10 samples per symbol) to which I need to provide timing recovery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having red Gardner’s landmark paper on that concept (A BPSK/QPSK Timing-Error Detector for Sampled Receivers) I understand that in a simple BPSK case where transition exists (in a pulse always) the two first terms (x[nT]-x[(n-1)T]) of the formula e={x[nT]-x[(n-1)T] }&lt;em&gt;x[n&lt;/em&gt;T+T/2] cancel out and the error approaches zero. In cases where no transition exists then we don’t get the desirable cancelation but statistically that is going to be resolved later due to negative symbols inserted.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Rxmba.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;All that above is quite straightforward the complications start with the obscurity behind the input samples I am having and the relation they have with the constellation diagram and the initial pulses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Above you can see the constellation diagram (of my samples) plotted. The axes are scaled this way because the numbers are represented in 8 bit integers.&#xA;Now if I choose a smaller chunk of my sample set let say 300 and scale them properly (divide by 256) I get that :(only for clarification purposes to show the samples)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6zSBK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is apparent by the concept of timing recovery itself that needs to be kept only,a number of samples that fall very close to the 4 constellation points and discard all the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I am having two main doubts the first is fundamental related to QPSK.&#xA;How do I connect the constellation diagram with the actual waveform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gardner was explaining his concept utilizing 2 samples only.In my case that 10 samples per symbol are utilised means that for each pulse am sampling 10 times (sorry for the oversimplification) and the I  part is the magnitude and Q the angle of each sample?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it like splitting the initial wave or pulse in 10 samples (sorry again for that simplifications I know they sound trivial to many but are necessary to clear my doubts) instead of 2 that Gardner was explaining?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes then how do I employ the formula,I  mean, how do I set the middle  (x[n*T+T/2])  term and how the other two x[nT]-x[(n-1)T]?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, In QPSK things are more complicated due to the fact that both I and Q samples exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That introduces a new term in the Gardner’s equation e={x[nT]-x[(n-1)T] }&lt;em&gt;x[n&lt;/em&gt;T+T/2]+{y[nT]-y[(n-1)T] }&lt;em&gt;y[n&lt;/em&gt;T+T/2]  .Where, the second term refers to the Q samples,and introduces a greater difficulty on realizing where and how to used the formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on how to employ that for QPSK as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;George&lt;/p&gt;&#xA;" OwnerUserId="959" LastActivityDate="2015-04-16T16:17:36.807" Title="Gardner timing recovery and constellation diagram" Tags="|qpsk|timing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22812" PostTypeId="2" ParentId="22766" CreationDate="2015-04-16T15:09:08.090" Score="1" Body="&lt;p&gt;Easy thing first: You might want to look into spatial statistics &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A fast library to compute &lt;a href=&quot;https://github.com/tonyfast/SpatialStatisticsFFT&quot; rel=&quot;nofollow&quot;&gt;Spatial Statistics in Matlab using FFTs&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;A good description of &lt;a href=&quot;http://imperssonator.github.io/MIC-OFET-Processing/2014/09/29/Spatial-Statistics.html&quot; rel=&quot;nofollow&quot;&gt;Spatial Statistics from a past student&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Long Stuff:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trouble with comparing materials science information (eg AFM) is that the piece of material was measured at a position in space and time.  It is difficult to quantitatively compare images in one place and an image in another place.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you take the Fourier transform, you are measuring the frequency of that material at a position in space and time.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can remove the spatial dependency by taking a convolution of the Fourier transform with itself.  This process is akin to Point Distribution Functions, N-Point Statistics, or Joint Probability Density Functions.  The Spatial Statistics Matlab library can be applied to most image data.&lt;/p&gt;&#xA;" OwnerUserId="15486" LastActivityDate="2015-04-16T15:09:08.090" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22813" PostTypeId="2" ParentId="22811" CreationDate="2015-04-16T16:17:36.807" Score="6" Body="&lt;p&gt;Your timing error detector should be run once for each input symbol. As you noted, your signal is far more oversampled than you need to be, so you won't end up using most of them for the purposes of timing error detection. As the paper suggests, the detector uses three samples, each separated by half the symbol period $T$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for the first timing error calculation, you would use $x[0], x[5], x[10]$, for the next you would use $x[10], x[15], x[20]$, and so on. Over time you will develop an estimate of the timing error, which you can use to select the correct sampling phase for the soft symbol decision. This will reduce your signal down to one sample per symbol, giving you a (hopefully) QPSK-looking constellation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you aren't using most of the samples in your signal for timing error detection, they could still be useful to you during the selection of the appropriate sampling phase. This will in general require sub-sample precision, so the increased sample rate can help you in interpolating to find the signal's value at the exact position that you want.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-04-16T16:17:36.807" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22814" PostTypeId="1" CreationDate="2015-04-16T16:44:32.043" Score="2" ViewCount="51" Body="&lt;p&gt;I collected spread spectrum signals at 400 MHz at low elevation angles using Software Defined Radio complex sampling over the seasons. I noticed that over watery, icy surfaces, the RF samples are conjugated compared with regular open space RF samples, resulting in failed de-spreading. De-spreading works if the signal samples are conjugated. I like to think that this phenomenon can be because the 180 deg. reversal of H vector of the wave front in reflection causing |E x H|atan(-H/E) resulting in a 90 deg. change of phase. This answer just doesn't appear to be convincing. Search the Net, could not find any related report on reflected RF signal has signal sample conjugated. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="15487" LastActivityDate="2015-04-16T16:44:32.043" Title="Signal conjugation detected on RF recording samples, why?" Tags="|signal-analysis|phase|signal-detection|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22815" PostTypeId="2" ParentId="22766" CreationDate="2015-04-16T17:09:17.553" Score="1" Body="&lt;p&gt;Take the average of the amplitudes for each frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \langle X_{amplitude} \rangle = \frac{1}{NM} \sum_{k=0}^{M-1} \sum_{l=0}^{N-1} X[k,l]  X^{*}[k, l]$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X^{*}$ is the complex conjugate of $X$.&lt;/p&gt;&#xA;" OwnerUserId="15488" LastActivityDate="2015-04-16T17:09:17.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22816" PostTypeId="2" ParentId="22766" CreationDate="2015-04-16T17:48:56.310" Score="1" Body="&lt;p&gt;The definition posted by @user3661852 is a good one : it arises from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's_theorem&lt;/a&gt;.  This theorem states the L2 norm of any square integrable signal $x$ is equal to the L2 norm of its fft $X$. See this &lt;a href=&quot;http://www.ee.ic.ac.uk/hp/staff/dmb/courses/E1Fourier/00400_SeriesParseval.pdf&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; for a similar version for periodic signals, which writes :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac1T\displaystyle\int_{0}^T(x(t))^2dt=\frac1T\displaystyle\sum_{i=-\infty}^{\infty}X(i)X^*(i)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $X^*(i)$ is the complex conjugate of $X(i)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a 2D NxM signal :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$||x||_2^2=\frac1{NM}\displaystyle\int_{0}^N\int_{0}^M(x(t))^2dt=\frac1{NM}\displaystyle\sum_{i=-\infty}^{\infty}\sum_{j=-\infty}^{\infty}X(i,j)X^*(i,j)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $x$ is not null, a weight $w(k,l)$ can be defined as :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w(k,l)=\frac1{NM}\frac{X(k,l)X^*(k,l)}{||x||_2^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sum of weights is 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT :&#xA;In this question, the formula may be applied on the dft if the dft is defined as :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(k,l)=\displaystyle\sum_{i=0}^{N-1}\sum_{j=0}^{M-1}x(i,j)e^{-2\pi\sqrt{-1}\frac iN}e^{-2\pi\sqrt{-1}\frac jM}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This formula for &lt;code&gt;dft&lt;/code&gt; is the one used by &lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/routines.fft.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;numpy.fft&lt;/code&gt;&lt;/a&gt; , &lt;a href=&quot;http://docs.nvidia.com/cuda/cufft/#axzz3XY0Hf0gK&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;cufft&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://www.fftw.org/fftw3_doc/The-1d-Discrete-Fourier-Transform-_0028DFT_0029.html#The-1d-Discrete-Fourier-Transform-_0028DFT_0029&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fftw&lt;/code&gt;&lt;/a&gt;. If a scale factor is added to your definition, to adjust it correctly, compute the zero frequency $X(0,0)$ : it is related to the average of the signal.&lt;/p&gt;&#xA;" OwnerUserId="15490" LastEditorUserId="15490" LastEditDate="2015-04-17T07:13:37.650" LastActivityDate="2015-04-17T07:13:37.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22817" PostTypeId="2" ParentId="22209" CreationDate="2015-04-16T18:31:37.090" Score="1" Body="&lt;p&gt;@robertbristow-johnson give you nice tips, i can suggest you, PSOLA algorithm (aka Keith Lent&lt;a href=&quot;https://i.stack.imgur.com/ofHcK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;) to pitch shift in time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PSOLA assumes that, if you know the pitch of a given segment, then you'll be able to remove or add periods moving synchronously and preserving envelope information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main step of PSOLA algorithm are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Extract Pitch/Periodos and find pitch marks (this can be hard), this marks are tipically positioned in the Glottal Closure Instants (GCI), and this positions are explicitly linked to quality of your Pitch Shifted signal, this step give you analysis marks.&lt;/li&gt;&#xA;&lt;li&gt;split your signal using a hann window, every window need be centred in the analyis mark position!&lt;/li&gt;&#xA;&lt;li&gt;Now from Analysis marks do you need rearrange this marks based in your pitch shift factor, it is called syntesysed marks.&lt;/li&gt;&#xA;&lt;li&gt;Overlap and add every windowed splited piece&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The representation of these steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ofHcK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mybe can be ease to see how some steps are build using a sinusoid example, so, here an real example, the picture bellow show an 150hz sampled at 22050hz (blue signal), on top of that sign you can see the pitch mark positions marked directly on the sign, the green dots on top are the pitch marks again and the green marks below are the synthesised marks using a pitch factor of 1.5, the red line between up/down dots tell you what centred hann whindow get to overlap and add.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/80l9G.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this steps pitch shift 150Hz signal to 1.5*150 = 225Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ofHcK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; - An efficient Method for Pitch Shifting Digitally Sampled Sounds&quot;, published in the Computer Music Journal, Vol 13, No. 4, Winter 1989&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2015-04-17T11:07:22.387" LastActivityDate="2015-04-17T11:07:22.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22820" PostTypeId="2" ParentId="22810" CreationDate="2015-04-16T20:21:36.117" Score="1" Body="&lt;p&gt;Your linearization gamma calculation does not take into account the correction matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do a combined numerical optimization of the pre-correction-matrix gamma adjustment, the correction matrix, and the post-correction-matrix gamma adjustment, preferably using a colorimetric error metric. There are 11 variables to optimize (or up to 14 if you wand to add constant terms). That's doable without too much work if you don't need to repeat this very often. I have a C++ Differential Evolution optimization library here that should be able to handle it: &lt;a href=&quot;http://yehar.com/blog/?p=643&quot; rel=&quot;nofollow&quot;&gt;http://yehar.com/blog/?p=643&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-17T05:39:13.397" LastActivityDate="2015-04-17T05:39:13.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22821" PostTypeId="1" CreationDate="2015-04-17T01:08:24.067" Score="0" ViewCount="133" Body="&lt;p&gt;I'm attempting to apply the following PDE as an image filter to smooth a discrete heightmap with a helmholtz-type equation as described in this &lt;a href=&quot;http://www.researchgate.net/profile/Manuel_Gamito/publication/222551401_An_accurate_model_of_wave_refraction_over_shallow_water/links/00b4951a8b09d51acf000000.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;. It seemed like an interesting alternative to a gaussian filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation is:&#xA;$$ddx(h') + ddy(h') + y(h'-h) = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I solved for h and got:&#xA;$$\dfrac{ddx(h')}{y} + \dfrac{ddy(h')}{y} + h' = h$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then discretized it with a central finite difference and turned it into a linear system of the form $Ax=b$ where $b$ is the source image and A is a matrix with elements around the diagonal corresponding to the coefficients of a central finite difference approximation of the second derivative. I also added an additional $1$ to the diagonal to account for the standalone $h'$ on the left hand side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the results don't look anything like a smoothed version of the original image. For very high y, the resulting image is mostly similar to h, but for lower y it quickly degrades into noise and eventually just a black image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect part of the issue is the way I'm dealing with the boundary conditions. I recognize that the derivative is undefined at the border of the image, so I've tried a number of different approaches to address this from excluding the borders from the system, to special casing the kernel of border pixels by adding the missing border weights to the diagonal of A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gist.github.com/krisr/034b5558fe4817f53d82&quot; rel=&quot;nofollow&quot;&gt;Here is some code&lt;/a&gt; I've been playing around with to solve this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would greatly appreciate help understanding how to handle the boundary conditions and learning how to properly apply this PDE as an image filter!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Kris&lt;/p&gt;&#xA;" OwnerUserId="15492" LastActivityDate="2015-04-17T01:08:24.067" Title="Filtering an image with a helmholtz-type equation" Tags="|image-processing|filter-design|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22822" PostTypeId="1" CreationDate="2015-04-17T03:15:41.210" Score="0" ViewCount="246" Body="&lt;p&gt;I have a adaptive FIR filter of length 84 with magnitude response , which is close to low pass. (Please see the attached figure). I need to design filter that has a magnitude response opposite of the FIR filter(to undo its effect),as set of upto 5 buquads. If i directly design the FIR using second order sections, there will be more than 5 biquad sections. I have following approach in mind:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Smooth the magnitude response of FIR filter( Don't need the exact ripple behavior)&lt;br&gt;&#xA; Inverse FFT the magnitude response and try to form cascaded &lt;strong&gt;sos&lt;/strong&gt; from it ( e.g using &lt;em&gt;tf2sos&lt;/em&gt; in Matlab)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have following questions  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is my approach outlined correct? any other suggestions?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I smooth the magnitude response? Probably a attack release kind of  filter just to track its envelope? or if i just use Welch kind of power spectral  density estimate and then take its square root, would that be correct?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;How about decimating the spectrum after smoothing, and then converting back to time domain and splitting to cascaded sos?  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Basically, what i need is a technique that allows creating variable number of cascaded sos from given Filter magnitude response.  Thanks&lt;/p&gt;&#xA;" OwnerUserId="11096" LastActivityDate="2015-04-17T03:15:41.210" Title="biquad decomposition from given magnitude response" Tags="|biquad|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22823" PostTypeId="2" ParentId="22099" CreationDate="2015-04-17T03:29:38.840" Score="0" Body="&lt;p&gt;The angle is determined by &#xA;1) summing and averaging the fourier spectrum over a line with angle theta crossing the center of the fourier rectangle, &#xA;2) repeat 1) for every possible angle theta.&#xA;3) find the maximum of 1) and 2), and the corresponding angle theta(max) is the result.&#xA;4) skew = 90-theta(max)&lt;/p&gt;&#xA;" OwnerUserId="15493" LastActivityDate="2015-04-17T03:29:38.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22825" PostTypeId="1" CreationDate="2015-04-17T06:03:02.077" Score="2" ViewCount="2930" Body="&lt;p&gt;I am working on diffusion of medical images, and I have come across the term &lt;em&gt;isotropic diffusion&lt;/em&gt;. Can anyone explain it for me?  &lt;/p&gt;&#xA;" OwnerUserId="15495" LastEditorUserId="80" LastEditDate="2015-04-18T21:49:53.590" LastActivityDate="2015-04-19T00:46:28.223" Title="What is meant by isotropic diffusion?" Tags="|image-processing|" AnswerCount="2" CommentCount="1" ClosedDate="2015-04-24T22:04:19.023" ContentLicense="CC BY-SA 3.0" />
  <row Id="22826" PostTypeId="2" ParentId="22825" CreationDate="2015-04-17T06:30:04.793" Score="2" Body="&lt;p&gt;It means the diffusion is at the same rate to all directions, not anisotropic diffusion say more along the direction of some fibers.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-04-17T06:30:04.793" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22827" PostTypeId="2" ParentId="22711" CreationDate="2015-04-17T07:45:39.437" Score="5" Body="&lt;p&gt;For a real signal, the &lt;strong&gt;magnitudes&lt;/strong&gt; of the Fourier transform bins tell what are the amplitudes of the sinusoidal components that an infinite tiling of the signal frame can be decomposed into. The &lt;strong&gt;phases&lt;/strong&gt; of the bins encode &lt;strong&gt;translation&lt;/strong&gt; of the sinusoids along their direction, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UXDW8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The translation can be decomposed into a series of component translations one along each of the axes. The axes of an image are spatial axes, and in video the third axis is temporal. The component translations have magnitudes inversely proportional to the frequencies indicated by the multidimensional index of the bin. For example, you can easily spatially translate an image in the frequency domain by adding to all phases (in a polar form representation of the bins) a function of form $af_x + bf_y$ where $a$ and $b$ are constants that give the amount of translation and $f_x$ and $f_y$ are the vertical and horizontal frequencies (bin indexes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Translation of a sinusoid of zero frequency is a bit of an oxymoron. With real FFT its phase is fixed to zero.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-17T10:32:06.880" LastActivityDate="2015-04-17T10:32:06.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22828" PostTypeId="2" ParentId="22793" CreationDate="2015-04-17T09:46:59.737" Score="1" Body="&lt;p&gt;Oversampling of audio can be used to reduce aliasing artifacts that result from non-linear processing. Harmonics generated by the nonlinear process can be filtered from the oversampled signal by a lowpass filter. A graphics analog of this is &lt;a href=&quot;http://en.wikipedia.org/wiki/Supersampling&quot; rel=&quot;nofollow&quot;&gt;supersampling&lt;/a&gt;. If Wikipedia is to trust, &lt;a href=&quot;http://en.wikipedia.org/wiki/Multisample_anti-aliasing&quot; rel=&quot;nofollow&quot;&gt;multi-sample antialiasing&lt;/a&gt; is a further optimization in which only the mixing proportion of background and foreground is calculated at each edge pixel of the foreground object, using supersampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An analogous audio problem would be implementation of amplitude modulation by a square wave. Hearing is more sensitive to frequency domain errors than vision, which operates more in the spatial domain. Linear cross-fading at the sample point nearest to each square wave edge would create a beating artifact that for each overtone would have an amplitude proportional to its amplitude and squared frequency. For a high-enough fundamental frequency of the square wave, the artifact would be audible, demanding the use of another method with better frequency domain behavior.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-17T14:59:54.303" LastActivityDate="2015-04-17T14:59:54.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22829" PostTypeId="1" CreationDate="2015-04-17T10:38:14.747" Score="3" ViewCount="4743" Body="&lt;p&gt;I want to make some calculs of power spectral densité of signal. For example a real voltage signal (physical unit : $V$) in time $g(t)$, its fourier transform $G(f)$ and $S_g(f)$. &#xA;   As far as I know, the power spectral density units for g(t) is $V^2/Hz$. However, I find in various sources the following equation to calculate the power spectral density :&#xA;  $S_g(f)=|G(f)|^2=G(f)G(-f)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand this &quot;definition&quot; (of course the most fundamental definition of PSD is given by the Wienner-Kintchine theorem) , as it leads to a spectral density in $V^2/Hz^2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;      Mike&lt;/p&gt;&#xA;" OwnerUserId="15500" LastActivityDate="2016-05-12T09:33:13.583" Title="Power Spectral Density computation and units" Tags="|transform|fourier|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22830" PostTypeId="2" ParentId="22711" CreationDate="2015-04-17T11:36:54.427" Score="4" Body="&lt;p&gt;The phase means the shift in the sine gratings components which were used to make the image. Physically the phase of the image tells about the features of the image,suppose you are doing a phase only reconstruction of an image then you can see that the most of the image's texture is obtained except for the contrast of the image.So if you try changing the phase of an image or rotate it by some orientation the feature such as texture of the image can change&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example see this link&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/16995/image-reconstructionphase-vs-magnitude&quot;&gt;Image Reconstruction:Phase vs. Magnitude&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="14980" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-04-17T11:36:54.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22832" PostTypeId="1" CreationDate="2015-04-17T16:38:26.443" Score="0" ViewCount="352" Body="&lt;p&gt;I am working on an image classification project I use multilayerperceptron,how do I plot ROC curve.I use weka's perceptron.&lt;/p&gt;&#xA;" OwnerUserId="14849" LastActivityDate="2015-06-17T06:35:46.363" Title="How to plot ROC curve for weka multilayerperceptron?" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22833" PostTypeId="2" ParentId="22829" CreationDate="2015-04-17T16:59:44.087" Score="0" Body="&lt;p&gt;Thanks for your answers. I perhas was not clear enough, the problem is not converting $Hz$ to $T^{-1}$ ...&#xA;The physical dimension of the expression $|G(f)^2|$ is $V^2T^2$ (notice the square after $T$) because $G(f)$ is a fourier transform of a voltage time signal.&#xA;However the power spectral density unit shoud be $V^2T$. For that reason, $|G(f)^2|$ cannot be a good formula for the computaion of $S_g(f)$ . However, I found various references in which $S_g(f)$ is defined by $|G(f)^2|$. So what's wrong with PSD estimation ?&lt;/p&gt;&#xA;" OwnerUserId="15500" LastActivityDate="2015-04-17T16:59:44.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22834" PostTypeId="2" ParentId="15830" CreationDate="2015-04-17T19:20:38.427" Score="2" Body="&lt;p&gt;You could try &quot;Non-maxima suppression&quot; This is usually used on edge detectors to thin the edge to only one pixel. When there are lots of edges close together you basically pick the one with the largest gradient, and assume that is the true edge&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another technique that might be applicable is double thresholding. Some edge detectors (canny for instance) actually perform multiple detection's with different parameters.  &quot;Strong edges&quot; are found in the the higher threshold (and probably the lower one as well) weaker edges may only be found using the lower threshold, and are only &quot;true&quot; edges if they connect to one of the stronger edges. Maybe you could use your current edge detector as the weaker classifier, and then make one that is harder to satisfy. This might eliminate the false positives that are only detected by the weak detector (i hope that makes sense)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;good luck&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-05-18T23:50:14.793" LastActivityDate="2015-05-18T23:50:14.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22835" PostTypeId="2" ParentId="7893" CreationDate="2015-04-17T21:01:20.223" Score="1" Body="&lt;p&gt;I couldn't open your pdf (antivirus said it was suspicious) so i downloaded an image myself, I don't know if its the right one, but its also from a 1920 census&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could perform &lt;strong&gt;image dilation&lt;/strong&gt; on the document until the text is gone. You can do multiple passes if needed. I just did one. We know dilation will make shrink the black sections (or the text) this essentially gives us just the background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then remove the background from the image. This can be tricky depending on the language (I used matlab, and had to make sure to keep the right range and units for the image to display properly) then you have a cleaner image. You should be able to run a ocr engine on the result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HzOzR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and here is a zoomed in section just so you can see the text quality doesn't degrade much with this operation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SbMnG.png&quot; alt=&quot;zoomed pic&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and of course the code. As I said it is done in matlab but openCv(in many languages), python, or just about any other image library will be able to perform a similar operation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im = rgb2gray(color_im);&#xA;bg = imdilate(im,strel('disk',3));&#xA;%we do a complement becasue the bg subtraction makes the text white and &#xA;%the background black. so we invert it&#xA;clean = imcomplement(abs(bg-im));&#xA;&#xA;subplot(1,3,1); imshow(im); title('original')&#xA;subplot(1,3,2); imshow(bg); title('after imdilate with 3 pixel circle')&#xA;subplot(1,3,3); imshow(clean); title('original minus background')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and here is the image I used. Its the first page of the 1920 census &lt;a href=&quot;https://archive.org/details/fourteenthcensus02unit&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://archive.org/details/fourteenthcensus02unit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lKvSY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I forgot you said it was handwritten images. so I got another sample, same exact code, new image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/p0MsU.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/kZQLd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;notice the detail even in very dark obscured places, as the zoomed in view shows. You would need to run some other filters, but removing the main background noise is accomplished using dilation&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-04-17T21:25:07.020" LastActivityDate="2015-04-17T21:25:07.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22836" PostTypeId="2" ParentId="22825" CreationDate="2015-04-18T05:02:02.837" Score="4" Body="&lt;p&gt;As Olli has said, Isotropic means the same in all directions. So the diffusion behaves the same regardless of which direction it is diffusing in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Heat for example diffuses in an isotropic manner. (Well ... unless you have a strange environment with varying conductivity constants or something ...  but that's another story)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The heat equation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{\partial u} {\partial t} = k \nabla ^2 u $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $U(x,y)$ is heat at point $(x,y)$ and $t$ is time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$k$ is the thermal diffusion constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it helps to see visually what this looks like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/utGAd.gif&quot; alt=&quot;Diffusion&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(From wikipedia)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is actually just like doing &lt;a href=&quot;http://en.wikipedia.org/wiki/Gaussian_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian Blur&lt;/a&gt; on an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Gaussian convolution is a solution to the heat equation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gaussian blur before and after&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9SGOV.jpg&quot; alt=&quot;Gaussian Blur before and after&quot;&gt;&#xA;Note that the whole image gets the same blur &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Anisotropic_diffusion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Anisotropic diffusion&lt;/a&gt; on the other hand may diffuse differently in different directions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, perona and malik suggested doing diffusion based on the Laplacian (that's the 'edginess' $\nabla^2$) of that part of the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be used for performing blur only in certain parts of an image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://reference.wolfram.com/language/ref/CurvatureFlowFilter.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for an image which has had anisotropic diffusion. This has had the effect of removing noise, while preserving the main features of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation proposed by Perona and Mailk is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{\partial U}{\partial t} = c(x,y,t) \nabla ^2 U + \nabla c . \nabla U$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $c $ is a function such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C(||\nabla U||) = e^{-(||\nabla U||/K)^2}$ for example&lt;/p&gt;&#xA;" OwnerUserId="4283" LastEditorUserId="4283" LastEditDate="2015-04-19T00:46:28.223" LastActivityDate="2015-04-19T00:46:28.223" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22837" PostTypeId="2" ParentId="22832" CreationDate="2015-04-18T06:00:15.880" Score="1" Body="&lt;p&gt;From &lt;a href=&quot;https://weka.wikispaces.com/ROC+curves&quot; rel=&quot;nofollow&quot;&gt;University of Waikato WEKA wiki&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The class used for calculating the ROC and also the AUC (= area under the curve) is &lt;a href=&quot;http://weka.sourceforge.net/doc.dev/weka/classifiers/evaluation/ThresholdCurve.html&quot; rel=&quot;nofollow&quot;&gt;weka.classifiers.evaluation.ThresholdCurve&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-04-18T06:00:15.880" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22839" PostTypeId="1" CreationDate="2015-04-18T10:15:24.357" Score="5" ViewCount="550" Body="&lt;p&gt;Ok for first information I would like to let you know that I originally do not have any formal exposure in signal processing so I would appreciate if you consider me as a beginner. In particular in this project I have to deal with the method of compressed sensing (CS). As some of you might know that CS relies on the sparsity of the signal in some basis. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;My first question is, when a reference mentions &quot;wavelet&quot; with no specification of which type of wavelet being referred to, what would be the type of wavelet which is common enough so that this reference doesn't mention it, if there is any?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Second, the main matrix equation in CS is &#xA;$$&#xA;\begin{align}&#xA;y &amp;amp;= \Phi \Psi s\\&#xA;\Updownarrow\\&#xA;y &amp;amp;= \Phi x,\quad x = \Psi s&#xA;\end{align}&#xA;$$&#xA;where $y$ the measured samples, $\Phi$ measurement matrix, $\Psi$ the representing basis matrix, and $s$ the expansion coefficients in $\{\Psi_i\}$ basis which we want to solve for. Ok up to this point I hope I haven't made any mistake in interpreting that equation. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;My question is how do people normally chose the basis? I think this choice of basis is critical because the expansion coefficients $s$ depends on the chosen basis. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As we would want $s$ to be as sparse as possible, doesn't it also mean that we need to carefully choose the most favorable basis? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If so, how would I decide the right choice? I read in some references they mostly use wavelets representation as the basis.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and by the way, the mathematical expression of the expansion in wavelets domain contains all possible indices of the bases (wavelets), that is the signal is the sum over both indices (dilation and translation indices) of the bases. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How should I choose which pairs of indices I better put in the matrix $\Psi$, if for example the signal is $n$ elements long? In that case I obviously only need $n$ bases and the corresponding coefficients out of the infinite possibility. &lt;/li&gt;&#xA;&lt;li&gt;Can I randomly take any $n$ bases provided any two different bases are always orthogonal?  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15509" LastEditorUserId="128" LastEditDate="2019-06-03T04:28:30.387" LastActivityDate="2019-06-03T04:28:30.387" Title="Compressed Sensing and Sparsity" Tags="|compressive-sensing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22840" PostTypeId="1" CreationDate="2015-04-18T13:09:51.253" Score="0" ViewCount="3986" Body="&lt;p&gt;I am to classify few recorded phone calls as either containing speech or not by sampling lets say first 10 seconds. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The files contain either silence, dialtone or ringtones, or real human voice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried implementing butter-worth filter 100hz-400hz, then calculating Short time energy, Zero crossing rate, then calculating variance of the resultant array. But the results aren't good, calls with ringtones are confused with human voice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am implementing this in matlab or python (scipy &amp;amp; numpy)&lt;/p&gt;&#xA;" OwnerUserId="15512" LastActivityDate="2016-07-12T12:32:39.220" Title="Simple VAD (Voice activity Detector) implementation" Tags="|matlab|speech-processing|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22842" PostTypeId="1" AcceptedAnswerId="22851" CreationDate="2015-04-18T16:25:44.730" Score="1" ViewCount="869" Body="&lt;p&gt;I've heard that you should remove the energy at Nyquist before performing the ifft.  Why is it that you can't leave the Nyquist energy there, is there danger of aliasing somehow?&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-18T22:37:34.147" Title="Why remove energy at Nyquist before ifft?" Tags="|ifft|nyquist|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22843" PostTypeId="1" CreationDate="2015-04-18T16:54:18.140" Score="1" ViewCount="7928" Body="&lt;p&gt;Is there code in matlab for short time energy feature extraction in matlab??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to extract audio feature (Short time energy) using matlab code&lt;/p&gt;&#xA;" OwnerUserId="15162" LastActivityDate="2015-09-19T16:45:27.710" Title="short time energy matlab code for audio feature extraction" Tags="|matlab|audio|signal-analysis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22844" PostTypeId="2" ParentId="22840" CreationDate="2015-04-18T17:34:33.110" Score="1" Body="&lt;p&gt;Based on the highest frequency you expect in your signal define the sampling rate. Accumulate samples for 10 seconds and carry on an FFT, in groups to allow for enough energy in bins based on expected frequencies.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;silence will have a typical low power with noise structure.&lt;/li&gt;&#xA;&lt;li&gt;Dial tones and ringtones will have distinctive, pre specified bins.&lt;/li&gt;&#xA;&lt;li&gt;Voice will have higher power than noise with some similarities to noise. You might fine tune your analysis but I do not think you will need it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-04-18T17:34:33.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22845" PostTypeId="1" CreationDate="2015-04-18T19:59:29.930" Score="0" ViewCount="570" Body="&lt;p&gt;This is kind of a comp sci question, but I figured I could use some input from FFT experts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already got a radix-4 cooley-tukey implementation of the NTT briefly described on page 9-10 of &lt;a href=&quot;https://who.rocq.inria.fr/Gaetan.Leurent/files/SIMD.pdf&quot; rel=&quot;nofollow&quot;&gt;https://who.rocq.inria.fr/Gaetan.Leurent/files/SIMD.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which was pretty convenient when it came to putting together an Sse2 implementation (parallel computations of 4 32-bit unsigned integers instead of 1 at a time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the interest of squeezing out every last bit of efficiency for repeated runs, however, should I consider an alternate FFT implementation (Bruun's algorithm, for instance)?  If you need more context to answer this, I'll be happy to provide more, this is the first time I've ever had to implement an FFT and I'm not sure what information is important.  I'd also appreciate any further explanation you can provide; my understanding is still pretty shallow.&lt;/p&gt;&#xA;" OwnerUserId="15514" LastActivityDate="2015-04-18T19:59:29.930" Title="Implementing a Number Theoretic Transform (Fermat number transform--257). Should I consider alternatives to a radix-4 cooley-tukey?" Tags="|fft|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22846" PostTypeId="2" ParentId="22712" CreationDate="2015-04-18T21:18:57.513" Score="0" Body="&lt;p&gt;What @creator means that it is not possible. You have two images say matrix A and B. You want to calculate say C=B-A so that A-B+C=0. If you do not have a model to go from A to C how can you find C? In other words you need B to get A-B if you do not know or do not have model to go from A to B, you cannot.  &lt;/p&gt;&#xA;" OwnerUserId="15440" LastActivityDate="2015-04-18T21:18:57.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22847" PostTypeId="1" CreationDate="2015-04-18T21:23:41.680" Score="0" ViewCount="4183" Body="&lt;p&gt;I'm learning about ICA, but dont know whats the purpose of centering the data (making each component have zero mean)and whitening the data (not sure what is this for, is it the same as PCA?), I'm following FastICA algorithm for wikipedia&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/FastICA&quot; rel=&quot;nofollow&quot;&gt;FastICA&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="10555" LastActivityDate="2016-08-08T19:02:27.117" Title="FastICA - Purpose of centering and whitening the Data" Tags="|ica|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22848" PostTypeId="1" CreationDate="2015-04-18T21:58:27.737" Score="0" ViewCount="306" Body="&lt;p&gt;Got a couple of questions here guys&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have a unit circle with just 1 pole and a lot of zeros. What condition could result to this and does it have any effect on the dsp system&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why do poles appear as real/complex conjugate pairs.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15026" LastActivityDate="2015-04-18T22:16:35.833" Title="Poles and Zeros" Tags="|poles-zeros|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22849" PostTypeId="2" ParentId="22848" CreationDate="2015-04-18T22:16:35.833" Score="1" Body="&lt;p&gt;to have more zeros than poles require that the system is not causal.  something that can exist in theory (and we do that with non-realtime DSP processing which can look ahead to &quot;future&quot; samples when it computes and outputs the &quot;present&quot; sample) but not in practice (those &quot;future&quot; samples referred to were really recorded long ago and saved in a file or buffer).  perhaps you might &lt;strong&gt;think&lt;/strong&gt; there are more zeros than poles but that might be because there are poles located at $z=0$ that you're not counting.  FIR filters have all of their poles at the origin.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-18T22:16:35.833" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22850" PostTypeId="2" ParentId="20059" CreationDate="2015-04-18T22:33:39.687" Score="3" Body="&lt;p&gt;Even when the image part is rectangular, the FFT result will be contaminated by boundary effects. The FFT of the part is the Fourier transform of an infinite tiling of the rectangular part. (An elliptical or circular part cannot be tiled. A hexagonal tiling would get pretty close though.) If there is a discontinuity going from one tile to another, this will create high-frequency components that are not descriptive of the insides of the part. Randomizing the phases will spatially translate these components so that they appear also inside the part, which is probably not what you want. Mirroring at the boundaries does not eliminate discontinuities of the derivative, and requires doubling of the FFT dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where a smoothly tapering 2-d window function can help. For a circular part you might like the &lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function#Tukey_window&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tukey window&lt;/a&gt; with the distance from the part center as its argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZvMR7.png&quot; alt=&quot;Tukey window in one dimension&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an ellipse, stretch the window function accordingly. Multiply the data by the window function to select the area you want to analyze, and FFT the result. Then do the phase randomization. Mask the noise by multiplying it with an ellipitical disc-like mask that has value 0 outside the disc and value 1 inside the disc. You can also use the window function as the mask to get a fuzzy boundary. I did not find yet a perfect way to normalize the noise, but matching the mean and the standard deviation both weighted by the mask works quite OK:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/FkFPl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiply the input image by the complementary mask: 1 - mask, and sum the two together. Octave source:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pkg load signal;&#xA;r = 120; # Circle radius&#xA;n = 512; # Image width and height&#xA;tukeyr = 0.5; # Window transition relative size&#xA;lena = double(imread(&quot;lena.gif&quot;))/255;&#xA;tukeyn = round(r/(1-tukeyr));&#xA;x = repmat([1:n], n, 1);&#xA;y = repmat([1:n]', 1, n);&#xA;dist = sqrt((x-n/2).^2 + (y-n/2).^2);&#xA;tukey = tukeywin(tukeyn*2, tukeyr)(tukeyn+1:tukeyn*2);&#xA;win = reshape(interp1(1:tukeyn, tukey, reshape(dist, n*n, 1), 0), n, n);&#xA;randphase = 2*pi*rand(n, n);&#xA;noisefft = abs(fft2(lena.*win)).*exp(j*randphase);&#xA;noise = real(ifft2(noisefft));&#xA;&#xA;#Circular mask&#xA;weight = r-dist;&#xA;weight = (weight &amp;gt;= 1)*1 + (weight &amp;gt; 0 &amp;amp; weight &amp;lt; 1).*weight;&#xA;#Or use window as mask&#xA;#weight = win;&#xA;&#xA;weightsum = sum(sum(weight));&#xA;noiseweightedmean = sum(sum(noise.*weight))/weightsum;&#xA;noiseweightedstdev = sqrt(sum(sum((noise-noiseweightedmean).^2.*weight))/weightsum);&#xA;lenaweightedmean = sum(sum(lena.*weight))/weightsum;&#xA;lenaweightedstdev = sqrt(sum(sum((lena-lenaweightedmean).^2.*weight))/weightsum);&#xA;normalizednoise = ((noise - noiseweightedmean) / noiseweightedstdev * lenaweightedstdev) + lenaweightedmean;&#xA;imshow(lena.*(1-weight).+normalizednoise.*weight);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;P.S. I found that highpass filtering the copy of the Lena image used for noise generation, by setting some of its lowest-frequency bins to zero, will reduce the error in the magnitudes of the fft of the final image compared to fft of the source image. I think the reason is that low-frequency amplitude fluctuations will be reduced. Within the circle (ellipse) those appear in practice as zero frequency, and in their absence less normalization is needed. So that's one thing to investigate.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-20T08:20:30.927" LastActivityDate="2015-04-20T08:20:30.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22851" PostTypeId="2" ParentId="22842" CreationDate="2015-04-18T22:37:34.147" Score="6" Body="&lt;p&gt;you don't &lt;strong&gt;have to&lt;/strong&gt; set $X\left(\frac{N}{2} \right)=0$ if you don't want to.  it will correspond to this component:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(k)\frac{1}{N}e^{j 2 \pi \frac{nk}{N}}\bigg|_{k=\frac{N}{2}} = X\left(\frac{N}{2} \right)\frac{1}{N}(-1)^n $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when you &lt;em&gt;sample&lt;/em&gt; some $x[n]$, FFT it and find that $X\left(\frac{N}{2} \right) \ne 0$, you do not know the phase of that Nyquist component before it was sampled.  the Nyquist component actually aliases with itself in such a way that the quadrature part of the negative frequency cancels the quadrature part of the positive Nyquist frequency component.  such would look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = \frac{X\left(\frac{N}{2} \right)}{N}(-1)^n = \frac{X\left(\frac{N}{2} \right)}{N}\left( \cos(\pi n) + A \sin(\pi n) \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A$ could be anything and you wouldn't know it because $\sin(\pi n)$ is always zero for any integer $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if you're doing audio, i would likely set both the Nyquist and the DC components to zero and also insure the complex-conjugate symmetry with the other bins before iFFT.  just to make sure that, within rounding error, the imaginary part of your result is zero (the result is purely real) and that you have an unambiguous magnitude and phase for every non-zero component.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-18T22:37:34.147" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22852" PostTypeId="1" AcceptedAnswerId="22854" CreationDate="2015-04-19T02:50:26.673" Score="1" ViewCount="1203" Body="&lt;p&gt;Why does cel-shading sometimes look similar to rotoscoping?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rotoscoping: A Scanner Darkly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T25Ql.jpg&quot; alt=&quot;http://static.tvtropes.org/pmwiki/pub/images/Waking_Life_rotoscoping_372.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cel-shading: Wikipedia: Cel-shading, Teapot Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4Btvz.png&quot; alt=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/8/8a/Celshading_teapot_large.png/700px-Celshading_teapot_large.png&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15517" LastActivityDate="2015-04-19T05:15:26.183" Title="Why does cel-shading sometimes look similar to rotoscoping?" Tags="|image-processing|video-processing|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22853" PostTypeId="2" ParentId="13327" CreationDate="2015-04-19T03:08:17.693" Score="-3" Body="&lt;p&gt;You design a filter with the desired frequency in mind that you whish to extract. So by designing such a filter you will elimnate undesired frequencies. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastActivityDate="2015-04-19T03:08:17.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22854" PostTypeId="2" ParentId="22852" CreationDate="2015-04-19T05:15:26.183" Score="1" Body="&lt;p&gt;I checked out the Wikipedia page for rotoscoping and it says one way it was done is that a live action image was shown behind frosted glass and an animator would draw it.  The frosted glass detail obfuscation coupled with the fact that it was a cartoonist means to me that you are going to get solid colored areas as shading, like you'd see in a cartoon.  Cell shading is basically trying to make the same effect but using 3d rendered graphics as a source instead of an actual photographed image.  Seems like they are the same effect, just with different names!&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-19T05:15:26.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22855" PostTypeId="2" ParentId="22847" CreationDate="2015-04-19T08:27:18.963" Score="-1" Body="&lt;p&gt;ICA finds the independent components and PCA find the uncorrelated components. ICA cannot distinguish the strength of the components i.e. ambiguity so whitening does not loose any information but fast to converge. &lt;/p&gt;&#xA;" OwnerUserId="15440" LastActivityDate="2015-04-19T08:27:18.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22858" PostTypeId="2" ParentId="22700" CreationDate="2015-04-19T10:32:08.060" Score="5" Body="&lt;p&gt;Phase congruency is where the phases of a quadrature filter responses at different scales are similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quadrature filter consists of two parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An even (symmetrical) part and an odd (anti-symmetrical) part, which are the Hilbert (or Riesz) transforms of each other. See below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $u(x)$ be an even function with finite energy, and $v(x) = \mathcal{H}(u)(x)$ be its Hilbert transform. The functions are in quadrature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can combine them as one filter by multiplying the odd part by $i$ and adding them together: $g(x) = u(x) + i v(x)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolving the filter with a signal, $f(x)$, we thus get a complex response where the even part is the response to the even filter and the odd part is the response to the odd filter:  $f_A(x) = (f \ast g)(x)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase is the argument of this complex response $\phi = \arg f_A(x)$ and is separate from the amplitude of the response $A = |f_A(x)|$. Phase describes the &lt;em&gt;shape&lt;/em&gt; of the signal at a point - odd or even or somewhere in-between - while amplitude describes the strength. This independence is important as it means signals with different strengths can be compared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the phase is the same at multiple scales, then there is likely to be a signal feature there. This is &lt;em&gt;phase congruency&lt;/em&gt;. Proof and examples of this are in the papers below. The big result is that phase congruency can find signal features independent of their strength.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1LAQ7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An extremely useful collection of phase related MATLAB routines:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/index.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some links:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT7/node2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/OWENS/LECT7/node2.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/pkpapers/phasecorners.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.csse.uwa.edu.au/~pk/research/pkpapers/phasecorners.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Papers:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Oppenheim, A. V., &amp;amp; Lim, J. S. (1981). The importance of phase in signals.&lt;/li&gt;&#xA;&lt;li&gt;Kovesi, P. (1995). Image Features From Phase Congruency.&lt;/li&gt;&#xA;&lt;li&gt;Kovesi, P. (1996). Invariant measures of image features from phase information.&lt;/li&gt;&#xA;&lt;li&gt;Kovesi, P. (1997). Symmetry and asymmetry from local phase.&lt;/li&gt;&#xA;&lt;li&gt;Kovesi, P. (1999). Image features from phase congruency.&lt;/li&gt;&#xA;&lt;li&gt;Kovesi, P. (2002). Edges are not just steps.&lt;/li&gt;&#xA;&lt;li&gt;Kovesi, P. (2003). Phase congruency detects corners and edges.&lt;/li&gt;&#xA;&lt;li&gt;Morrone, M. C., &amp;amp; Burr, D. C. (1988). Feature detection in human vision: a phase-dependent energy model. &lt;/li&gt;&#xA;&lt;li&gt;Morrone, M. C., &amp;amp; Owens, R. a. (1987). Feature detection from local energy.&lt;/li&gt;&#xA;&lt;li&gt;Perona, P., &amp;amp; Malik, J. (1990). Detecting and Localizing Edges Composed of Steps, Peaks and Roofs.&lt;/li&gt;&#xA;&lt;li&gt;Reisfeld, D. (1996). Constrained phase congruency: simultaneous detection of interest points and of their orientational scales.&lt;/li&gt;&#xA;&lt;li&gt;Robbins, B., &amp;amp; Owens, R. (1997). 2D feature detection via local energy.&lt;/li&gt;&#xA;&lt;li&gt;Venkatesh, S., &amp;amp; Owens, R. (1990). On the classification of image features.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2015-04-19T12:28:43.147" LastActivityDate="2015-04-19T12:28:43.147" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22860" PostTypeId="1" AcceptedAnswerId="26244" CreationDate="2015-04-19T17:12:39.880" Score="0" ViewCount="650" Body="&lt;p&gt;I am writing a sound library for my c++ hobby game engine. The sound library mixes music and sound effects into a single buffer that is sent to the audio hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While mixing, any number of source sounds may appear or disappear between two output buffers causing a discontinuity at the border between the buffers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discontinuity can be heard as a disturbing high frequency click when the mix is played by the audio hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have solved this by doing internal bookkeeping of what sound sources are playing and neatly fading sound sources in and out. However this is more involved than it would first seem. The mixing code becomes difficult to read and maintain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would prefer to instead simply handle any discontinuities in the final mix buffer before sending it to the sound card.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have experimented with a wavelet transform solution which takes an area around the border between two buffers and adjusts any excessively large coefficients until they fit in with the overall distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However that technique seems tricky and introduces a latency to the output because potentially quite old samples have to be updated if the discontinuity carries all the way down to low frequencies...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be preferable if the solution would only alter the new buffer and potentially carry over any residual errors at the end of the new buffer to be resolved in the next buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any known techniques for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="15520" LastActivityDate="2015-10-15T13:32:10.193" Title="Stitching together audio buffers with potential discontinuity at the boundary" Tags="|audio|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22861" PostTypeId="2" ParentId="22860" CreationDate="2015-04-19T17:33:02.573" Score="3" Body="&lt;p&gt;In 1998 I made a &quot;zero level adjustment click removal&quot; system that shifted the zero level to fix the discontinuity, and this &quot;zero level&quot; was gradually moved back to 0, by decreasing it by 1/2048 of its value every sample. It worked well for low-frequency sounds, but when a high-frequency sound ended abruptly at a large sample value, that created a low-frequency click. I ended up removing the system and simply adding more channels in order to fade out sounds. For this I used a one-pole lowpass filter on all volume envelopes, and when a sound was killed the volume envelope was set to zero and some time was allowed for the fadeout before making the channel available to other sounds. If too many channels were reserved for fading out, the one with the smallest amplitude value was freed to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the thought kept bugging me that if the zero level adjustment would be done only to a lowpass filtered portion of the output, then it might sound better. Purely high-frequency sounds don't really need click removal.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-04-19T18:52:24.027" LastActivityDate="2015-04-19T18:52:24.027" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22862" PostTypeId="2" ParentId="22860" CreationDate="2015-04-19T18:16:45.327" Score="2" Body="&lt;p&gt;Using envelopes to fade in and fade out sounds when they start and end (or end early) is the common solution in game development both for audio as well as skeletal animation tracks believe it or not.  From the sounds of it, the issue may be one of code architecture, and less of proper technique.  Ollie's info is also good. I've seen things like some of what he's talking about in skeletal animation systems, but also in sound systems when you need to &quot;hard evict&quot; some sound instead of fading out because the number of sounds has hit a hard ceiling and you absolutely need to play a new sound.&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-04-19T18:16:45.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22863" PostTypeId="1" CreationDate="2015-04-19T20:41:03.307" Score="0" ViewCount="261" Body="&lt;p&gt;I am trying to understand how the receiver decides the length of OFDM symbol in time domain before it goes into DFT process at the receiver.&#xA;The complete OFDM symbol (with Cyclic Prefix added) is propagated by the transceiver through the channel and it is received at the receiver with a time delay. This delay is caused by the propagation channel due to the objects or channel characteristics. And now lets say we have received the signal and first need to know what the symbol start time so that receiver can start the OFDM symbol and cut it at the end of the symbol. Then start for the consecutive symbol...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please explain how to visualize this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="9014" LastActivityDate="2015-04-20T09:35:22.533" Title="How does the OFDM system receiver decide the OFDM symbol length?" Tags="|fourier-transform|dft|estimation|ofdm|ifft|" AnswerCount="1" CommentCount="0" ClosedDate="2015-04-24T22:04:36.420" ContentLicense="CC BY-SA 3.0" />
  <row Id="22864" PostTypeId="1" CreationDate="2015-04-19T21:23:05.730" Score="1" ViewCount="355" Body="&lt;p&gt;I am trying to improve my DSP knowledge and this problem is too much for me. I am trying to solve following task: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/wOgr8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;this is not a homework. any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13742" LastEditorUserId="13507" LastEditDate="2015-04-20T09:26:05.133" LastActivityDate="2015-04-20T09:26:05.133" Title="how to solve the sampling rate conversion problem" Tags="|sampling|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22865" PostTypeId="1" AcceptedAnswerId="22880" CreationDate="2015-04-19T23:36:09.577" Score="0" ViewCount="203" Body="&lt;p&gt;&lt;strong&gt;Greetings!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;What I am doing:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, I want to write a program that is fed a song as a wav file, and spits out an animated contour plot indicating the relative pressure/loudness/quantity indicating amplitude at various points in a plane. Each speaker is modeled as a point source a set distance from each other hanging in an infinite void. My weapon of choice is Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;How I am doing it:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Poorly. Song is read and split into channels, then cut into little slices. Each slice is FFT'd and the amplitudes and phases are split. For each point in the simulation space every frequency is taken, wavelength calculated and used in combination with the phase to determine the contribution of that frequency to the dimensionless loudness/pressure/sound intensity indicating quantity in that cell (the exact unit isn't that important - explained in next section). Do this for each slice of song, draw contour plots for each slice, and animate! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;What my problem is:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above seems kinda clumsy, and my preliminary results tell me I'm likely neglecting something huge or making some kind of fundamental error. Please note the idea here isn't to make a simulation for speaker setup or any kind of real physical use, I want to draw pretty pictures of what songs do with some basis in reality (specific application: psytrance). This is why the units are not that important, whether I use the normalised voltages in the wav file or convert it to dB or pressure... apart from looking a bit different in lin or log space the relative difference should be the same, at least for my pretty-picture-drawing-purposes. Once the program works as planned some number-fudging will occur to make it look better. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Can someone suggest a better way of doing this? I feel like I'm doing this in a too complex manner, but I don't even know where to begin looking for a different method to accomplish my goals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Am I right in doing phase corrections with the values given in the FFT? Gut says the error is here - Fourier coefficients are returned as complex numbers a+bi - for the use I have described here, how would I use this to yield &quot;amplitude&quot; and phase angle? It's a simple question... but humour me, self-kicking might follow your answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: On second thought this may not be the most appropriate place to post this (at least for part 1 of the question), if someone can suggest a better place, please do.&lt;/p&gt;&#xA;" OwnerUserId="15524" LastEditorUserId="15524" LastEditDate="2015-04-20T00:10:09.380" LastActivityDate="2015-04-20T15:11:15.197" Title="Simulation of a pressure field developed by a song" Tags="|matlab|fft|signal-analysis|fourier-transform|" AnswerCount="2" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22866" PostTypeId="1" AcceptedAnswerId="22874" CreationDate="2015-04-20T03:17:11.247" Score="0" ViewCount="257" Body="&lt;p&gt;In communication theory, a modulator takes the input sequence and and maps it to some complex numbers. In MATLAB the following commands can do that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data = randi([0 1],96,1);&#xA;hModulator = comm.PSKModulator(16,'BitInput',true);&#xA;modData = step(hModulator, data); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question, is regarding the last step. Why is a step function able to do this mapping. In particular this step function represents the step response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any advice.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-04-20T03:58:20.263" LastActivityDate="2015-05-20T16:31:08.303" Title="Modulation of data bits into complex symbols in MATLAB" Tags="|matlab|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22867" PostTypeId="1" AcceptedAnswerId="22873" CreationDate="2015-04-20T05:38:41.963" Score="4" ViewCount="4169" Body="&lt;p&gt;What is the difference between monocular video and stereo video ,as i am studying about motion tracking i need to know the meaning of these two things.&lt;/p&gt;&#xA;" OwnerUserId="15525" LastActivityDate="2015-04-20T09:08:23.960" Title="Difference Between monocular video and stereo video?" Tags="|image-processing|video-processing|video|video-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22868" PostTypeId="1" AcceptedAnswerId="22871" CreationDate="2015-04-20T05:46:47.553" Score="1" ViewCount="3351" Body="&lt;p&gt;What is the purpose of using a scrambler in communication systems? &#xA;The link &lt;a href=&quot;http://en.wikipedia.org/wiki/Scrambler#Purposes_of_scrambling&quot; rel=&quot;nofollow&quot;&gt;wiki_for_scrambling&lt;/a&gt; says that it is used to randomize data. But the data is already random (like speech,audio,video,etc..), what is the purpose of randomizing again?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if we ex-or the sequence for randomizing? does it guarantee a non-repeating pattern?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And regarding the statement &quot;Scrambler removes dependency of a signal's power spectrum on the actual transmitted data.&quot; in the article, what is the use of that?.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;regards,&#xA;phani tej&lt;/p&gt;&#xA;" OwnerUserId="7926" LastEditorUserId="7926" LastEditDate="2015-04-20T07:59:01.913" LastActivityDate="2015-04-20T07:59:01.913" Title="what are the advanatages of using a scrambler" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22870" PostTypeId="1" AcceptedAnswerId="22898" CreationDate="2015-04-20T07:12:18.690" Score="1" ViewCount="3191" Body="&lt;p&gt;To my understanding, multiplying a signal in the frequency-domain is equal to a convolution in the time-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote a small python program, but i always end up with a shift in the time domain. where does this come from? An hints how to get the correct convolution, where the convolved output signal is in place corresponding to the input signals?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from matplotlib import pyplot as plt&#xA;&#xA;&#xA;# make simple rectangular signals&#xA;r1 = np.zeros(100, dtype=float)&#xA;r2 = np.zeros(100, dtype=float)&#xA;r1[1:20] = 1.&#xA;r2[20:40] = 1.&#xA;&#xA;# fftransform the signals&#xA;fft_r1 = np.fft.rfft(r1)&#xA;fft_r2 = np.fft.rfft(r2)&#xA;&#xA;# multiply the frequence-spectra of the signals&#xA;fft_p = np.multiply(fft_r1, fft_r2)&#xA;# ifftransform back to time-domain&#xA;conv = np.fft.irfft(fft_p)&#xA;&#xA;f, axarr = plt.subplots(3, 3)&#xA;f.tight_layout()&#xA;axarr[0, 0].plot(r1)&#xA;axarr[0, 0].set_title(&quot;r1&quot;)&#xA;axarr[0, 1].plot(np.abs(fft_r1), '.')&#xA;axarr[0, 1].set_title(&quot;fft_r1&quot;)&#xA;&#xA;axarr[1, 0].plot(r2)&#xA;axarr[1, 0].set_title(&quot;r2&quot;)&#xA;axarr[1, 1].plot(np.abs(fft_r2), '.')&#xA;axarr[1, 1].set_title(&quot;fft_r2&quot;)&#xA;&#xA;axarr[2, 0].plot(np.abs(fft_p), '.')&#xA;axarr[2, 0].set_title(&quot;fft product&quot;)&#xA;&#xA;axarr[2, 1].plot(conv)&#xA;axarr[2, 1].set_title(&quot;conv (ifft of fft_product)&quot;)&#xA;axarr[2, 2].plot(np.convolve(r1, r2, 'same'))&#xA;axarr[2, 2].set_title(&quot;conv, np&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is an image of the plots that the above code generates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oDeM3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15528" LastEditorUserId="128" LastEditDate="2020-01-11T14:55:18.653" LastActivityDate="2020-01-11T14:55:18.653" Title="Shift in Time Domain After DFT Based Convolution" Tags="|fft|fourier-transform|python|dft|convolution|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="22871" PostTypeId="2" ParentId="22868" CreationDate="2015-04-20T07:47:12.983" Score="2" Body="&lt;p&gt;Scramblers are indeed used to &quot;randomize&quot; the data, i.e. to &quot;whiten&quot; the input sequence. The reason why this is necessary is that a transmission system has no control over the data the user is going to transmit. This causes problems because it violates the assumptions that are usually made when designing transmission systems, such as having independent data symbols. Note that usually the data are not random, as you seem to believe. A frequently occurring problem are long strings of zeros in the data, which can cause difficulties in timing recovery and adaptive equalization. These problematic sequences are removed (or, actually, made much less likely) by the scrambler.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-20T07:47:12.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22872" PostTypeId="1" CreationDate="2015-04-20T09:02:02.370" Score="0" ViewCount="356" Body="&lt;p&gt;I have series of images extracted from a eye tracker video for both eyes.&#xA;is there any image processing algorithm/method/technique available to find the following from those images:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Horizontal eye movement for both eyes.&lt;/li&gt;&#xA;&lt;li&gt;Vertical eye movement for both eyes.&lt;/li&gt;&#xA;&lt;li&gt;Eye blinking for both eyes.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help.&lt;/p&gt;&#xA;" OwnerUserId="15451" LastActivityDate="2020-08-24T07:03:35.467" Title="Image processing for eye movements" Tags="|image-processing|video-processing|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22873" PostTypeId="2" ParentId="22867" CreationDate="2015-04-20T09:08:23.960" Score="6" Body="&lt;p&gt;Monocular video is taken using a single camera.  Stereo video is taken using two cameras side-by-side, producing two video streams.  That's pretty much it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A stereo video pair allows depth measurement, so you can find out how far away things are.  However, this is not an easy task for complex scenes.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-04-20T09:08:23.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22874" PostTypeId="2" ParentId="22866" CreationDate="2015-04-20T09:09:19.790" Score="0" Body="&lt;p&gt;The method &lt;code&gt;step(H,X)&lt;/code&gt; used here has nothing to do with the step function. It modulates the input data &lt;code&gt;X&lt;/code&gt; with the modulator object &lt;code&gt;H&lt;/code&gt;, as described &lt;a href=&quot;http://nl.mathworks.com/help/comm/ref/comm.qpskmodulator.step.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. See also &lt;a href=&quot;http://nl.mathworks.com/help/comm/gs/system-objects-methods.html#btsx3d1-3&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-04-20T16:10:52.023" LastActivityDate="2015-04-20T16:10:52.023" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22875" PostTypeId="2" ParentId="22863" CreationDate="2015-04-20T09:35:22.533" Score="0" Body="&lt;p&gt;First of all, the timing, phase and frequency offsets of the channel are removed. After synchronization, the cyclic prefix is removed, to avoid ISI between OFDM symbols. Now because the transmitter and receiver agree upon a common standard before the communication begins, the receiver knows how many samples to consider as a symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, the the number of samples in an OFDM symbol depend upon the bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="7926" LastActivityDate="2015-04-20T09:35:22.533" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22876" PostTypeId="2" ParentId="22872" CreationDate="2015-04-20T09:41:42.797" Score="1" Body="&lt;p&gt;You can see for algorithms in ieee sites there are tons of algorithm which might suit your requirement and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An Algorithm for Real-Time Eye-Movement Tracking with Free Head Movement&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Robust algorithm for video based eye tracing.&#xA;Are some examples.&lt;/p&gt;&#xA;" OwnerUserId="15525" LastActivityDate="2015-04-20T09:41:42.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22877" PostTypeId="1" AcceptedAnswerId="22881" CreationDate="2015-04-20T11:30:31.783" Score="26" ViewCount="47746" Body="&lt;p&gt;According to the cross-correlation theorem : the cross-correlation between two signals is equal to the product of fourier transform of one signal multiplied by complex conjugate of fourier transform of another signal. After doing this, when we take the ifft of the product signal, we get a peak which indicates the shift between two signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not able to understand how this works? Why would i get a peak which indicates the shift between two signals. I got the math from : &lt;a href=&quot;http://mathworld.wolfram.com/Cross-CorrelationTheorem.html&quot;&gt;http://mathworld.wolfram.com/Cross-CorrelationTheorem.html&lt;/a&gt;&#xA;but i am not able to understand as to what this means intuitatively. Can somebody please provide some explanation or point me to the right documents?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8435" LastActivityDate="2023-05-12T19:51:56.997" Title="Intuitive explanation of cross-correlation in frequency domain" Tags="|fft|fourier-transform|dsp-core|ifft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22878" PostTypeId="1" AcceptedAnswerId="22882" CreationDate="2015-04-20T11:56:13.127" Score="0" ViewCount="4366" Body="&lt;p&gt;Let's say that we want to digitally sample an analog signal and have a sampling frequency of 8000 samples/second. Usually the maximum frequency that can be captured is the half of the sampling frequency; that is the maximum frequency that can be captured is approximately 4KHz for the example above. But what is the mathematical relationship between the two? &#xA;Thank you.  &lt;/p&gt;&#xA;" OwnerUserId="15536" LastActivityDate="2015-04-20T22:50:50.447" Title="What is the maximum frequency that can be captured by a given sampling rate?" Tags="|audio|frequency|sampling|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22879" PostTypeId="2" ParentId="22865" CreationDate="2015-04-20T12:06:39.480" Score="1" Body="&lt;p&gt;For a perfect isotropic point source the pressure or air displacement at a point is just the pressure/displacement stimulating signal delayed by the time it took the disturbance to travel to that point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means you get spherical shells of constant displacement, and the displacement is the signal at the time $t-d/c$ where $d$ is the distance from the source and $c$ is the propagation speed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addendum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do not require the full resolution of the pressure field that would allow you to actually reconstruct the sound from the field then you may want to average the pressure over spatial volumes of constant size. That is not equivalent to a time average of the power, because the influence of spatial coarse graining on the pressure history depends on where you are. Only in the far field where the radius of the constant pressure sphere is much larger than the typical coarse graining scale, time averaging ans spatial averaging become equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it depends on what you want exactly and what you need it for. The physics involved is very simple for a perfect point source, but gets very complicated as soon as you have participating objects. Maybe you can give a more detailed description of what you are trying to achieve with this.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2015-04-20T15:11:15.197" LastActivityDate="2015-04-20T15:11:15.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22880" PostTypeId="2" ParentId="22865" CreationDate="2015-04-20T12:23:32.797" Score="-2" Body="&lt;p&gt;I think your method is kind of over kill.  All you really need is the instantaneous power for each point (or each block) in your music.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the hilbert function to get the instantaneous amplitude of your signal, which will do as a representation of the instaneous power.&#xA;Split your signal into blocks (cells, as you called them) then do abs(hilbert(x)) where x is a cell.  Average if the length of a cell is all the time resolution you need, or use each value in the sequence as the amplitude at a single sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for your display.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A flat surface, with a center point that show the amplitude for the current sample (or cell,) with rings around it representing the amplitudes for the last samples (cells) - each ring is one sample (cell) into the past.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, use the distance from your point source to the surface to determine how far into the past each point displayed should be.  Straight ahead (angle 0 degrees) is shortest, and represents now.  At ten degrees off center, you would have 1/(cos(10)) = distance of 1.015 times the straight ahead distance.  Use the speed of sound and your simulated distance from speaker to the surface to figure out how much time (in samples or cells) that relates to.  That will produce a ring on your surface representing the amplitude for a certain time in the past.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 1 meter, the ten degrees would be 3 milliseconds or 135 samples at 44100 samples per second (typical CD sampling rate.)  70 Degrees at one meter would be about 8.8 milliseconds or 389 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simulating the distance from the speaker to the surface will tend to produce relatively smooth gradients in the center that get sharper the further out you go.&#xA;Simply plotting rings based on cells would give you an image with more jumps in the gradient.&#xA;Either method gives you room to play around and make things more interesting.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-04-20T12:23:32.797" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="22881" PostTypeId="2" ParentId="22877" CreationDate="2015-04-20T12:38:10.380" Score="24" Body="&lt;p&gt;The concept is based on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution_theorem&quot; rel=&quot;noreferrer&quot;&gt;convolution theorem&lt;/a&gt;, which states that for two signals &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt;, the product of their Fourier transforms &lt;span class=&quot;math-container&quot;&gt;$X(f)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y(f)$&lt;/span&gt; is equal to the Fourier transform of the convolution of the two signals. That is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{F}\{x(t) * y(t)\} = \mathcal{F}\{x(t)\}\mathcal{F}\{y(t)\}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can read more on the derivation of this theorem at the above Wikipedia link. Now, convolution is a very important operation for linear systems in itself, so the theory on its properties is well-developed.&lt;/p&gt;&#xA;&lt;p&gt;However, what you're looking for is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;noreferrer&quot;&gt;cross-correlation&lt;/a&gt; between &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt;.&#xA;Here's the key: the cross-correlation integral is equivalent to the convolution integral &lt;em&gt;if one of the input signals is conjugated and time-reversed&lt;/em&gt;. This allows you to utilize theory developed for evaluating convolutions (like frequency-domain techniques for calculating them quickly) and apply them to correlations.&lt;/p&gt;&#xA;&lt;p&gt;In your example, you're calculating the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{F}\{x(t)\}\left(\mathcal{F}\{y(t)\}\right)^*&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Recall that in the Fourier domain, complex conjugation is equivalent to time reversal in the time domain (this follows directly from the definition of the Fourier transform). Therefore, using the first equation given above, we can state that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{F}\{x(t) * y^*(-t)\} = \mathcal{F}\{x(t)\}\left(\mathcal{F}\{y(t)\}\right)^*&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you then take the inverse Fourier transform of this equation, the signal you're left with is the cross-correlation between &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you are working with real signals then we drop the complex conjugate in &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{F}\{x(t) * y(-t)\} = \mathcal{F}\{x(t)\}\left(\mathcal{F}\{y(t)\}\right)^*&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And it is very easy to see that for real signals, cross correlation and convolution are equivalent if we flip one of the signals in time. In this case the convolution operation flip in time domain is compensated with another flip in &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt; to yield the cross correlation on the left hand side of the last equation.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="7092" LastEditDate="2023-02-21T20:26:33.073" LastActivityDate="2023-02-21T20:26:33.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22882" PostTypeId="2" ParentId="22878" CreationDate="2015-04-20T15:28:56.143" Score="1" Body="&lt;p&gt;The maximum frequency is also limited by how long you sample at a given sample rate.  If you only sample for a finite length of time at 8000 sps, the bandwidth will be &lt;strong&gt;less than&lt;/strong&gt; 4kHz.  A 4000 Hz signal (or any integer multiple thereof) will be ambiguous, or simply disappear.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal somewhat below the Nyquist frequency (depending on how long you sample at a given S/N or accuracy) can be &quot;captured&quot;, as well as any signals between two successive integer multiples of Fs/2 given a-priori knowledge of no aliasing from any other spectra inside any other folds.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-20T22:50:50.447" LastActivityDate="2015-04-20T22:50:50.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22883" PostTypeId="1" AcceptedAnswerId="22884" CreationDate="2015-04-20T15:50:20.847" Score="0" ViewCount="560" Body="&lt;p&gt;The following are questions regarding MIMO communication theory. I have come across a MATLAB implementation of MIMO channel. My questions are not regarding the implementation, but rather regarding the theory itself.&#xA;In MATLAB there is &lt;code&gt;comm.MIMOChannel&lt;/code&gt; that creates a MIMO channel. The following are the properties which one can play with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; MIMOChannel properties:&#xA;%&#xA;%   SampleRate                  - Input signal sample rate (Hz)&#xA;%   PathDelays                  - Discrete path delay vector (s)&#xA;%   AveragePathGains            - Average path gain vector (dB)&#xA;%   NormalizePathGains          - Normalize path gains (logical)&#xA;%   FadingDistribution          - Rayleigh or Rician fading&#xA;%   KFactor                     - Rician K-factor scalar or vector (linear scale)&#xA;%   DirectPathDopplerShift      - Doppler shift(s) of line-of-sight component(s) (Hz)&#xA;%   DirectPathInitialPhase      - Initial phase(s) of line-of-sight component(s) (rad)&#xA;%   MaximumDopplerShift         - Maximum Doppler shift (Hz)&#xA;%   DopplerSpectrum             - Doppler spectrum &#xA;%   SpatialCorrelation          - Spatially correlated&#xA;%   NumTransmitAntennas         - Number of transmit antennas&#xA;%   NumReceiveAntennas          - Number of receive antennas    &#xA;%   TransmitCorrelationMatrix   - Transmit correlation matrix (or 3-D array)&#xA;%   ReceiveCorrelationMatrix    - Receive correlation matrix (or 3-D array)&#xA;%   AntennaSelection            - Optional transmit and/or receive antenna selection&#xA;%   NormalizeChannelOutputs     - Normalize channel outputs (logical)&#xA;%   RandomStream                - Source of random number stream&#xA;%   Seed                        - Initial seed of mt19937ar random number stream&#xA;%   PathGainsOutputPort         - Enable path gain output (logical)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have the following questions: ( I really hope I can get some help)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Does the sample rate mean the actual symbol rate of the input? Is it related to the modulation we use?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do path delays dictate whether we have a frequency selective or frequency flat fading channel? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The channel above gives the option of having either Rayleigh or Ricean fading channel gains, I know that Rayleigh is good approximation because of the central limit theorem (i.e large number of random paths), if one specifies that the distribution is Rayleigh, does that mean that the Path Delays should be infinite? Or does this distribution mean a distribution of the path itself.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why would a Direct PATH (LOS) have a doppler shift different that the maximum doppler shift? Then which one dictates the coherence time? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you for any advice or answers on any of the above questions&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="1629" LastEditDate="2016-06-02T08:33:31.487" LastActivityDate="2016-06-02T08:34:13.673" Title="General Questions MIMO Communication theory" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22884" PostTypeId="2" ParentId="22883" CreationDate="2015-04-20T16:29:43.087" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;As it says in the documentation, &lt;code&gt;SampleRate&lt;/code&gt; is the signal's sampling rate, not the symbol rate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The path delays together with your symbol rate determine whether the channel is flat or frequency-selective.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You should choose Rayleigh if there is no line-of-sight component in the received signal, and Rice otherwise. Regarding the path delays: the model is that the gain you observe at each sampling instant is the result of many paths, whose arrival times are so close that you can't resolve them. So, in your model, you always have a finite number of paths, each of which has random Gaussian gain.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Each path has a different length and arrival angle, so it can have a different Doppler.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As a side note, and expressing only my opinion, it is more educational to try to create your own models of the fading channel than using a Matlab toolbox. Toolboxes are created to increase an expert's productivity, not for learning.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="1629" LastEditDate="2016-06-02T08:34:13.673" LastActivityDate="2016-06-02T08:34:13.673" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="22885" PostTypeId="1" CreationDate="2015-04-20T16:42:45.177" Score="0" ViewCount="162" Body="&lt;p&gt;I have tried the following methods to test the orthogonality on Fixed point FFT implementation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y = A*x, where A = FFT basis and x = input, Y= FFT output&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input (x) is set to A-1(A inverse), then the o/p will be an identity matrix.  To get A-1(A inverse), first set the input (x) an identity matrix. The output is nothing but the basis vector. Take the transpose and set this as next input, which should give an identity matrix as output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;16bit fixed point implementation, an input value of 1 is set as 0x7FFF, but I was not able to get the orthogonality test by setting this value. Please help me in doing orthogonality test on fixed point FFT implementations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-ben   &lt;/p&gt;&#xA;" OwnerUserId="15438" LastActivityDate="2015-04-20T16:42:45.177" Title="Orthogonality test on fixed point FFT" Tags="|fft|fixed-point|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22887" PostTypeId="1" CreationDate="2015-04-20T18:55:40.727" Score="1" ViewCount="342" Body="&lt;p&gt;I have very little experience with image processing or signal processing in general, but I'm willing to learn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been experimenting with a way to, uh... &quot;flatten&quot; the colors of certain kinds of images. For example, I have a photograph of an object that has been painted with few colors, and I want an image with only these colors, removing shadows, textures and other noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've obtained mixed results using the following brute-force technique:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a matrix of pixels, starting as &quot;unmapped&quot;.&lt;/li&gt;&#xA;&lt;li&gt;Apply a &quot;fuzzy floodfill&quot; algorithm on the image, starting at a random position, with the modification that, instead of comparing pixels to a single starting color, I compare the colors of neighboring pixels. Also, instead of immediately modifying the image, I mark the filled pixels on a temporary matrix (so as to simulate the floodfill process correctly), and mark these pixels in the main matrix as belonging to this map.&lt;/li&gt;&#xA;&lt;li&gt;Repeat until there are no &quot;unmapped&quot; pixels in the image.&lt;/li&gt;&#xA;&lt;li&gt;The matrix will then be filled with many maps, each one representing a single set of similar colors.&lt;/li&gt;&#xA;&lt;li&gt;Compute the average of the colors of each map, and paint the pixels corresponding to each map to each color.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Results: &lt;a href=&quot;http://www.lgm.cl/whatisthis/&quot; rel=&quot;nofollow&quot;&gt;http://www.lgm.cl/whatisthis/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, by seeing the images I've created, you'll be able to understand what I'm trying to achieve. The downside of my algorithm is that it's SLOW and inefficient, so I'm looking for a more efficient way to achieve at least the same results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I just stumbled upon the knowledge of Gradient Domain Image Processing and the wonderful things it can do. I haven't experimented with it yet, but at first it looks promising. However, I'm asking for further advice before going through another trial-and-error session. :)&lt;/p&gt;&#xA;" OwnerUserId="15538" LastActivityDate="2015-04-20T18:55:40.727" Title="Looking for a better way to posterize or normalize the colors of an image" Tags="|image-processing|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22888" PostTypeId="1" CreationDate="2015-04-20T19:36:41.730" Score="0" ViewCount="497" Body="&lt;p&gt;I am simulating a FMCW radar (Ramp signal is used for transmission)and I have created the transmit signal from matlab FMCW model&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hwav = phased.FMCWWaveform('SweepTime',sweep_time,'SweepBandwidth',radar_bandwidth,'SampleRate',Fs);&#xA;hchannel = phased.FreeSpace('PropagationSpeed',co,'OperatingFrequency',radar_startfreq,'SampleRate',Fs,'TwoWayPropagation',true);&#xA;htx = phased.Transmitter('PeakPower',1,'Gain',tx_gain);&#xA;hrx = phased.ReceiverPreamp('Gain',rx_gain,'NoiseFigure',1,'SampleRate',Fs);&#xA;hcar = phased.RadarTarget('MeanRCS',1,'PropagationSpeed',co,'OperatingFrequency',radar_startfreq);&#xA;&#xA;x = step(hwav);    % Generate the FMCW signal&#xA;xt = step(htx,x);  % Transmitted FMCW signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After the reflection from the target the reflected wave is :&#xA;Some of the code delibrately missed.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xt = step(hrx,xt);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it comes after some delay and then its multiplied with the transmitted signal to get the beat signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the multiplication is done between the received signal and the transmitted signal to get the beat signal. The matlab uses dechirp method to perform this operation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;radar_return = dechirp((xt),x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the output look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lD6h7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I want to ask some questions related to it:&#xA;I came across the equation of mixed signal (Linear Frequency Modulated tx mixed with LFM Rx ) as &#xA;&lt;code&gt;(1/2)*cos(2*pi*(fctd+(4B*R/Tp)*t))&lt;/code&gt;&#xA;fc= center frequency&#xA;td = delay time of pulse (From target reflection)&#xA;B = Bandwidth&#xA;R = Range&#xA;Tp = pulse duration&#xA;t = fast time (actual time)&#xA;Is this equation of the same signal which I have plotted, I am confused due to leading zeros I am getting in my mixed signal but in equation if I put the values of t then no zeros I am getting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also If yes the plot and the equation after mixing (matlab dechirp) are same. Then how can I remove leading zeros and make it signal with continous time and phase shift in the equation. In the equation there is a phase shift &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2*pi*(fctd)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and In plotted signal received from mixing two Linear chirp signal I am getting zeros and the mix signal. How can I get the signal starting from t=0 with the same phase as in equation, since they both are same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://de.mathworks.com/help/phased/examples/automotive-adaptive-cruise-control-using-fmcw-technology.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://de.mathworks.com/help/phased/examples/automotive-adaptive-cruise-control-using-fmcw-technology.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15313" LastEditorUserId="15313" LastEditDate="2015-04-28T14:05:38.000" LastActivityDate="2015-04-28T14:05:38.000" Title="DTFT of beat signal with shift due to multiplication" Tags="|matlab|fft|dft|modulation|phase|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22889" PostTypeId="1" AcceptedAnswerId="22890" CreationDate="2015-04-20T20:21:48.447" Score="2" ViewCount="2606" Body="&lt;p&gt;In LTE standards, for a transmission bandwith of 2.5 MHz, the sampling frequency is 3.84 MHz. I was wondering with this choice, are we violating Nyquist theorem? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the details in the following link (page 15)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.freescale.com/files/wireless_comm/doc/white_paper/3GPPEVOLUTIONWP.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.freescale.com/files/wireless_comm/doc/white_paper/3GPPEVOLUTIONWP.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would have assumed that with a bandwith of 2.5 MHz, then the channel sampling frequency (signal input sampling frequency) should be at least 5 MHz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastActivityDate="2017-08-22T05:51:18.793" Title="Transmission Bandwidth and Sampling frequency" Tags="|digital-communications|digital|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22890" PostTypeId="2" ParentId="22889" CreationDate="2015-04-20T20:51:02.583" Score="3" Body="&lt;p&gt;Complex (I/Q) signal processing is used in this case. With a complex-valued signal sampled at a rate $B \text{ Hz}$, you can unambiguously represent a total bandwidth of $B \text{ Hz}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're thinking of is the real-valued signal case, where a signal sampled at $B \text{ Hz}$ can unambiguously represent a total bandwidth of $\frac{B}{2} \text{ Hz}$. This is the most common statement of the Nyquist theorem, but it only holds for real-valued signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the total number of &quot;values&quot; per second is the same, as each complex sample consists of a real and imaginary part. So, there's no &quot;information gain&quot; to be made by using complex sampling, it's just more convenient for many applications (including digital communications signal processing).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-04-20T20:51:02.583" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22891" PostTypeId="1" CreationDate="2015-04-20T23:24:14.017" Score="0" ViewCount="98" Body="&lt;p&gt;If sampling at a rate of 48 kHz, with no anti-aliasing filter on the input, and the input signal is contaminated by a 100 kHz sine, at what frequency would the sinewave signal appear in the output spectrum?&lt;/p&gt;&#xA;" OwnerUserId="15533" LastEditorUserId="15533" LastEditDate="2015-04-21T01:32:22.717" LastActivityDate="2015-04-21T07:04:15.047" Title="100 kHz sinewave contaminating a signal sampled at 48 kHz" Tags="|nyquist|aliasing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22892" PostTypeId="1" AcceptedAnswerId="22937" CreationDate="2015-04-20T23:58:19.243" Score="1" ViewCount="2488" Body="&lt;p&gt;Assume we have transmission bandwidth of 10 MHz, in this case the total number of subcarriers (FFT size) present is 1024. According to LTE standards, 600 out of 1024 subcarriers are data subcarriers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;data subcarriers= total number of subcarriers- pilot/null subcarriers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, 0.07 % of 1024 are used as Cyclic Prefix extension&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is it correct that we have 1024-600 are therefore unused subcarriers?&lt;br&gt;&#xA;(where 600 = total number of Resource Blocks (RB) * number of subcarriers/RB = 50*12)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) An OFDM symbol is made up of data part and CP part. Is it correct to say that the number of QAM symbols for each OFDM symbol is then 600 (equal to number of data subcarriers) and the number of CP symbols are 72? How is the actual transmission over the subcarriers taking place. For example in downlink, does the transmitter allocate a certain number of subcarriers over which it transmits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I can get some feedback! Thanks &lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-04-21T20:18:38.217" LastActivityDate="2015-04-23T11:14:49.393" Title="LTE questions (subcarriers and cyclic prefix)" Tags="|digital-communications|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="22893" PostTypeId="1" CreationDate="2015-04-21T04:42:35.460" Score="5" ViewCount="29391" Body="&lt;p&gt;I tried removing noise from the image shown below using Median Blur in OpenCV. But i'm not able to remove the colour noise completely as it is done in Neat Image. Any suggestions.?&lt;br&gt;&#xA;&lt;br&gt; 1. Original Input Image &lt;br&gt;&#xA;&lt;br&gt; &lt;img src=&quot;https://i.stack.imgur.com/Plj2y.png&quot; alt=&quot;Original Input image&quot;&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt; Median Blur Output    &lt;img src=&quot;https://i.stack.imgur.com/1LPi5.png&quot; alt=&quot;Output after applying medain blur&quot;&gt;&lt;br&gt;&#xA;&lt;br&gt; Neat Image Output    &lt;img src=&quot;https://i.stack.imgur.com/n2U0i.jpg&quot; alt=&quot;Neat Image Output&quot;&gt;    &lt;/p&gt;&#xA;" OwnerUserId="13454" LastEditorUserId="128" LastEditDate="2019-06-24T18:03:55.233" LastActivityDate="2021-08-18T12:12:58.753" Title="Noise Removal from an Image Using OpenCV (Comparison to Neat Image)" Tags="|filters|image-processing|opencv|smoothing|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="22894" PostTypeId="2" ParentId="22349" CreationDate="2015-04-21T04:51:04.330" Score="1" Body="&lt;p&gt;I want to add some illustration to good answer of Dilip Sarwate. Below is citation from help of function &lt;strong&gt;xcorr&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The cross-correlation estimate between vectors &quot;x&quot; and &quot;y&quot; (of&#xA; length N) for lag &quot;k&quot; is given by&#xA;&#xA;                 N&#xA;      R_xy(k) = sum x_{i+k} conj(y_i),&#xA;                i=1&#xA; where data not provided (for example x(-1), y(N+1)) is ZERO.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So when &lt;strong&gt;xcoor&lt;/strong&gt; calculate correlation for some lag $k$ (see formula above), some values from $x$ are not participating in the calculations. This is equivalent, this values of $x$ are multiplied by zero values in extended signal $y$.  Actually you calculate correlation not for $sin(t)$ and $cos(t)$, but for this signals (I add some additional lag to both signal):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9SpqV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Result of your search is quite valid mathematically, but it is not result for $sin(x)$ and $cos(x)$! See shifted (aligned) signals:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/jzry8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About an actual signals from your sensor. I can advice to do high pass filter to this data before using cross correlation. Usually you do not need to use low frequency part of signals to find good correlation.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2015-04-21T10:43:02.173" LastActivityDate="2015-04-21T10:43:02.173" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22896" PostTypeId="1" CreationDate="2015-04-21T06:05:10.837" Score="0" ViewCount="416" Body="&lt;p&gt;On a stationary signal a sine-weighted moving average is calculated (SWMA: the coefficient vector looks like the first (&gt;0) part of a sinusoid). The SWMA looks like this: very smooth:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/U4hXj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The future is unknown, but what would be the best way to anticipate the next turning point if you are at the first blue arrow? How would you anticipate the next turning point at the next blue arrow in real time/online analysis? Polynomial extrapolation? A cubic Bézier curve? A simple cubic function? &#xA;Similar to this image: it is pretty intuitive to continue/extrapolate the red curve into the dotted green curve (in off-line analysis), but how do you do that in real time?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9eXqJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The SWMA is calculated like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/8FcvP.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="735" LastEditorUserId="735" LastEditDate="2015-04-22T21:15:23.333" LastActivityDate="2015-04-22T21:15:23.333" Title="extrapolate turning points for a sine weighted moving average?" Tags="|signal-analysis|lowpass-filter|moving-average|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22897" PostTypeId="2" ParentId="22891" CreationDate="2015-04-21T07:04:15.047" Score="1" Body="&lt;p&gt;In your case, since 100kHz is more than twice 48 kHz, it will be folded twice in the sampled version, then there are two pairs of positions: +/-4 KHz and +/- 44Khz. &lt;/p&gt;&#xA;" OwnerUserId="15507" LastActivityDate="2015-04-21T07:04:15.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22898" PostTypeId="2" ParentId="22870" CreationDate="2015-04-21T07:47:37.853" Score="2" Body="&lt;p&gt;Note that multiplying the FFTs and taking an IFFT is equivalent to &lt;a href=&quot;http://en.wikipedia.org/wiki/Circular_convolution&quot; rel=&quot;nofollow&quot;&gt;cyclic/circular convolution&lt;/a&gt;. This is not the same as &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution#Discrete_convolution&quot; rel=&quot;nofollow&quot;&gt;linear convolution&lt;/a&gt;. However, your signals have sufficient zero-padding for the two types of convolution to be equivalent. The correct result of the linear (and cyclic) convolution is what you obtained via FFT and IFFT, a triangle between indices $20$ and $60$, as shown in the figure. This result is easy to predict using graphical convolution, as explained in &lt;a href=&quot;http://en.wikipedia.org/wiki/Convolution#/media/File:Convolution_of_box_signal_with_itself2.gif&quot; rel=&quot;nofollow&quot;&gt;this animation&lt;/a&gt; (from Wikipedia).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The strange result of &lt;code&gt;np.convolve&lt;/code&gt; with the option &lt;em&gt;same&lt;/em&gt; can be explained as follows: the result is the center part of length $100$ of the linear convolution of the two signals. Since the linear convolution is a signal of length $199$ ($=N_1+N_2-1$) with $99$ trailing zeros, the &lt;em&gt;same&lt;/em&gt; option cuts out the center part between indices $50$ and $149$. So the result is the right half of the cyclic convolution with $49$ zeros added at the end, as shown in the bottom right figure.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-04-22T07:44:54.890" LastActivityDate="2015-04-22T07:44:54.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22899" PostTypeId="1" AcceptedAnswerId="22944" CreationDate="2015-04-21T08:01:29.220" Score="1" ViewCount="1375" Body="&lt;p&gt;I would like to implement a Kalman filter to estimate the velocity and position of an object. I have an accelerometer, therefore the acceleration is known. The approach is same as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8860/more-on-kalman-filter-for-position-and-velocity&quot;&gt;Kalman filter for position and velocity: introducing speed estimates&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however, I don't understand well, how I should define the measurement model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{X}(k+1) = \hat{X}(k) + K * ( y(k) - H*\hat{X}(k) );$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;K is the kalman gain and is calculated in every step, but What is my &quot;y&quot; here, i know it is called the observations, but how i have my observations ? should i calculate the:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v(k+1) = a(k)*t + v(k);$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(k+1) = 0.5*a(k)*t^2 + v(k)*t +x(k);$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="9047" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-04-23T15:12:32.873" Title="Kalman filter, defining the measurement model" Tags="|kalman-filters|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="22900" PostTypeId="1" CreationDate="2015-04-21T08:52:23.893" Score="1" ViewCount="2931" Body="&lt;p&gt;I have frequency responses of FIR filter of order 13 from obtained 50 frequency samples. How can I get FIR filter coefficients of order 13? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in MATLAB a lot of possible ways I tried ;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a frequency samples : &lt;code&gt;w=[0 1]&lt;/code&gt; (1x50) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have frequency responses of FIR filter of order 13: &lt;code&gt;hd&lt;/code&gt; (1x50)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b1=fir1(12,wc) % b1:FIR filter ideal coefficients of order 13&#xA;&#xA;hd=freqz(b1,1,w) %hd :FIR filter frequency responses with respect to b1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When I apply inverse fourier transform to FIR filter frequency responses ( &lt;code&gt;ifft(hd,13)&lt;/code&gt; ), I don't reach b1. I am supposed to reach b1 coefficients in theory. Am I right?&lt;/li&gt;&#xA;&lt;li&gt;I apply inverse fft shift for moving to true domain before apply Fourier Transform( &lt;code&gt;ifft( ifftshift(hdg),13)&lt;/code&gt; ) but also I don't reach b1. So what else can I do?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There is incompatible things(may be between frequencies and transforms ) I don't understand.&lt;/p&gt;&#xA;" OwnerUserId="15541" LastEditorUserId="7092" LastEditDate="2015-04-21T14:38:55.207" LastActivityDate="2015-12-17T19:38:52.130" Title="FIR filter coefficients from frequency responses" Tags="|matlab|filters|filter-design|lowpass-filter|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22901" PostTypeId="1" AcceptedAnswerId="22903" CreationDate="2015-04-21T10:01:11.830" Score="0" ViewCount="223" Body="&lt;p&gt;I have a recording of a single note played several times on a violin. I'm working with Matlab to estimate the amplitude of the first N harmonics. I already know which note is played but there can be fluctuations in frequency and noise (very little, actually). Can you suggest me the more robust method in this kind of situation? At the moment I am windowing the signal and using a peak detection algorithm on the FFT of each frame in order to find the amplitude of the harmonics. Is there anything better?&lt;/p&gt;&#xA;" OwnerUserId="15543" LastActivityDate="2016-04-16T02:45:48.130" Title="Harmonic estimation from a single note" Tags="|fft|frequency-spectrum|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22903" PostTypeId="2" ParentId="22901" CreationDate="2015-04-21T12:12:30.223" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;pitch detection and tracking.  use autocorrelation or perhaps AMDF (average-magnitude difference function) or ASDF (average-squared difference function).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;either the &quot;heterodyne oscillator&quot; or, i would recommend, wavetable synthesis techniques to get the amplitude and phase of each harmonic.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-21T12:12:30.223" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22905" PostTypeId="2" ParentId="22900" CreationDate="2015-04-21T12:39:01.700" Score="1" Body="&lt;p&gt;The frequency argument for &lt;code&gt;freqz()&lt;/code&gt; should be in radians/second, not normalized frequency in &lt;code&gt;[0,1)&lt;/code&gt;. It has a form that makes it easy for you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% length of frequency response vector&#xA;N = 50;&#xA;% cutoff frequency&#xA;wc = 0.25;&#xA;% design 12th-order lowpass filter&#xA;b1 = fir1(12, wc);&#xA;% calculate its frequency response at `N` points around unit circle&#xA;hd = freqz(b1, 1, N, 'whole');&#xA;% inverse transform the frequency response&#xA;b2 = ifft(hd);&#xA;% `b1` and `b2` should be the same.&#xA;plot(1:length(b1), b1, 1:length(b2), b2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This yields the plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rCk4h.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only see one trace because they are right on top of one another, as they should be. &lt;code&gt;b2&lt;/code&gt; is longer in duration because it has the same length as the frequency response vector, which was arbitrarily chosen to have length 50.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-04-21T12:39:01.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22907" PostTypeId="1" CreationDate="2015-04-21T13:11:20.350" Score="1" ViewCount="39" Body="&lt;p&gt;How effective is Nash-equilibrium for big data cases in scenarios like crowd and traffic monitoring? &#xA;Crowd and traffic scenarios are competitive environments which suit well to Nash-Equilibrium. Are there algorithms using Nash-Equilibrium which are successfully deployed?&lt;/p&gt;&#xA;" OwnerUserId="15545" LastActivityDate="2015-04-21T13:11:20.350" Title="Nash equilibrium for big data" Tags="|computer-vision|" AnswerCount="0" CommentCount="0" ClosedDate="2015-04-23T09:31:40.323" ContentLicense="CC BY-SA 3.0" />
  <row Id="22908" PostTypeId="1" CreationDate="2015-04-21T16:11:58.057" Score="0" ViewCount="62" Body="&lt;p&gt;I want to see whats the relation between being an FIR system and a minimum phase system and when an FIR system can be minimum phase too with respect to have linear phase&lt;/p&gt;&#xA;" OwnerUserId="15547" LastActivityDate="2015-04-21T17:12:40.523" Title="what is the relation between a minimum phase system and a FIR system?" Tags="|linear-phase|finite-impulse-response|" AnswerCount="1" CommentCount="1" ClosedDate="2015-04-27T15:21:49.343" ContentLicense="CC BY-SA 3.0" />
  <row Id="22909" PostTypeId="1" AcceptedAnswerId="22941" CreationDate="2015-04-21T16:17:46.460" Score="2" ViewCount="378" Body="&lt;p&gt;I am looking for a clear and precise explanation of how an OFDMA modulator in downlink LTE operates. I have many books that explain it but each has its own way and do not answer my questions completely. If you believe this questions better fits in another forum please let me know (maybe some PHY layer forum).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that an OFDMA modulator consists of the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;a block of bits for each user are first coded using a error correction code.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the stream of bits for each user are then mapped to symbols for example QAM symbols.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is Serial to Parallel converter, now the QAM symbols for each user are parallel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Subcarrier mapping ? ( I don't understand this step)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The QAM symbols are input to the L IFFT (L being number of subcarriers) &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;According to LTE specifications, resources are allocated to users in units of resource blocks over a subframe (12 subcarriers over 14 OFDM symbols) i.e, 168 resource elements.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this mean, is there where step 4 comes into place? So is each user's QAM symbols being transmitted over 12 subcarriers and not over all available subcarriers? &#xA;What happens in the next subframe? Then why do we perform L point IFFT? how does then one compute the rate for each user over a subframe or frame basis?&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="1606" LastEditDate="2015-04-23T11:11:49.747" LastActivityDate="2015-04-23T11:12:44.237" Title="Questions Downlink OFDMA in LTE" Tags="|digital-communications|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22910" PostTypeId="2" ParentId="2610" CreationDate="2015-04-21T16:24:43.880" Score="2" Body="&lt;p&gt;You could also check &lt;a href=&quot;https://github.com/tyiannak/pyAudioAnalysis&quot; rel=&quot;nofollow&quot;&gt;pyAudioAnalysis&lt;/a&gt;: it combines open libraries for pattern recognition and several audio feature implementations. Some example applications implemented in &lt;a href=&quot;https://github.com/tyiannak/pyAudioAnalysis&quot; rel=&quot;nofollow&quot;&gt;pyAudioAnalysis&lt;/a&gt;, that you may find interesting:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;silence removal&lt;/li&gt;&#xA;&lt;li&gt;speaker diariation&lt;/li&gt;&#xA;&lt;li&gt;segment classification (and training) using SVMs, kNN, etc&lt;/li&gt;&#xA;&lt;li&gt;joint segmentation-classification (using HMM)&lt;/li&gt;&#xA;&lt;li&gt;audio thumbnailing&lt;/li&gt;&#xA;&lt;li&gt;audio content visualization&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15548" LastActivityDate="2015-04-21T16:24:43.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22911" PostTypeId="2" ParentId="22901" CreationDate="2015-04-21T17:07:22.827" Score="0" Body="&lt;p&gt;If you know the precise pitch at which the note is being played, then an FFT is overkill.  You can use a Goertzel filter tuned for each harmonic, with a filter length that the integer closest to an exact integer multiple of the period of the pitch.  Use the same filter length for all the harmonics in order to compare their amplitudes.  Most Goertzel filter formulations will give you the same result (minus numerical artifacts) as 1 bin of an FFT of the same length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A non-rectangular window will destroy some of the amplitude information.  An FFT that is of a length that is not an exact integer multiple of the period will give you scalloping errors for some or all of the harmonics, due to frequencies not being at the FFT result bin centers.  A so-called &quot;flat top&quot; window may help, but why create errors and then try to correct them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't know the precise pitch, then you can first use a pitch estimation algorithm to estimate the frequency, and then created customized Goertzel filters to estimate the relative amplitudes of the harmonic series.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-21T17:07:22.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22912" PostTypeId="2" ParentId="22908" CreationDate="2015-04-21T17:12:40.523" Score="1" Body="&lt;p&gt;The only FIR system that is both minimum phase and linear phase is where the output is the same as the input: y[i] = x[i]&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-21T17:12:40.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22913" PostTypeId="1" AcceptedAnswerId="22914" CreationDate="2015-04-21T17:16:14.320" Score="3" ViewCount="1837" Body="&lt;p&gt;I kind of expected this to of been asked before, so if this is duplicate please point me in the right direction, however I couldn't find anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently experimenting with low pass filtering. I take an image and apply a 2-dimensional fast Fourier transform to the image, next I apply a shift such that the zero frequency component is moved to the center (Using Matlab this is &lt;code&gt;fftshift&lt;/code&gt;). Then I zero Fourier co-efficients which are not within some distance $r$ of the center pixel. I apply the inverse of the shift and then an inverse 2-dimensional fast Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I end up with a matrix of complex values, but to display an image I want a matrix of real values. With the matrix obtained after applying the IDFT I mapped the pixel values to their real part, imaginary part, magnitude and phase so that I could view the matrix as an image. I found that the real part and the magnitude looked like the original image and taking the imaginary part and phase rendered the image unrecognizeable compared to the original image. I also found that their wasn't a recognizable difference in quality between taking the real value of the transformed image or the absolute value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there advantages or disadvantages between taking the real part of absolute value after filtering (low pass, or in general)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my first question on DSP.SE, so please leave comments on how to improve my question if it's not up to standard&lt;/p&gt;&#xA;" OwnerUserId="7931" LastEditorUserId="7092" LastEditDate="2015-04-21T17:58:01.913" LastActivityDate="2022-06-21T15:38:52.053" Title="How to choose between taking the real part or the absolute value of an inverse discrete Fourier transform?" Tags="|image-processing|fourier-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22914" PostTypeId="2" ParentId="22913" CreationDate="2015-04-21T17:24:31.157" Score="3" Body="&lt;p&gt;If your processed 2D FFT is conjugate symmetric, then any imaginary components in the complex IFFT result are just numerical noise or rounding errors.  Thus using them to compute an absolute value is mostly a waste of CPU cycles. &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-21T18:01:24.420" LastActivityDate="2015-04-21T18:01:24.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22915" PostTypeId="1" CreationDate="2015-04-21T17:59:34.657" Score="2" ViewCount="177" Body="&lt;p&gt;I am image processing student. Nowdays there are different brands of smartphones available. But the common thing is two different big brand smartphones with same Megapixel camera have different quality of image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover,the Digital cameras with same megapixel resolution have altogether best quality. Why is it so?&lt;/p&gt;&#xA;" OwnerUserId="15429" LastActivityDate="2021-11-03T22:17:52.443" Title="Why different smartphones with same Megapixel camera have different quality of image?" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22917" PostTypeId="2" ParentId="22839" CreationDate="2015-04-21T22:29:17.607" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;You don't know; but there are some basic properties: finite support, self similarity and completeness as you go to finer and finer partitions.  These allow you to draw general conclusions.  The particular type of kernel used depends upon your signal analysis goals and the signal.&lt;/li&gt;&#xA;&lt;li&gt;Can't give you a quantitative answer but you might consider it as optimization problem; you want the partitions you use to validate the &quot;signal&quot; as well as possible while rejecting &quot;noise&quot;/interference as well as possible.  Try to find out the statistics on these things and try running them through a wavelet processing simulator to see how the type1/type2 errors pan.  In reality all you ever get likelyhood.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;BTW: when doing the above selections make sure you include processing power/time in your evaluation.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastEditorUserId="1629" LastEditDate="2016-05-20T06:16:39.193" LastActivityDate="2016-05-20T06:16:39.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22918" PostTypeId="1" AcceptedAnswerId="22922" CreationDate="2015-04-22T02:55:17.587" Score="0" ViewCount="438" Body="&lt;p&gt;Im trying to do a problem of ICA from a Image Processing book, but when I finish I got the Matrix C different from the one in the exercise.&#xA;This is the Exercise:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6rbBX.png&quot; alt=&quot;Exercise&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Al9tL.png&quot; alt=&quot;Exercise2&quot;&gt;&#xA;This is my Matlab Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=1:1000;&#xA;f=sin(t*pi/19);&#xA;g=sin(pi*t/5)+sin(pi*t/31);&#xA;h=mod(.3*t,1.5);&#xA;m1=.3*f+.4*g+.3*h;&#xA;m2=.5*f+.2*g+.3*h;&#xA;m3=.1*f+.1*g+.8*h;&#xA;mn=[m1;m2;m3];&#xA;m1p=m1-mean2(mn);&#xA;m2p=m2-mean2(mn);&#xA;m3p=m3-mean2(mn);&#xA;mnp=[m1p;m2p;m3p;];&#xA;C=(mnp*mnp')/3;&#xA;[V,D]=eig(C);&#xA;eigenvalues=diag(D);&#xA;eigenvector=V;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My result in the Matrix C is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;C =&#xA;&#xA;   77.2656   60.7483   26.2664&#xA;   60.7483   64.0480   23.0485&#xA;   26.2664   23.0485   56.4664&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This are the steps of the algorithm:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/aeIBo.png&quot; alt=&quot;Step0-1&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Z1Fft.png&quot; alt=&quot;Step2-3&quot;&gt;&#xA;Then there is some info about applying to Signal Processing:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/w28f7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is I don't get the same Matrix C from the exercise.&lt;/p&gt;&#xA;" OwnerUserId="10555" LastEditorUserId="8202" LastEditDate="2015-04-22T07:57:20.580" LastActivityDate="2015-04-22T08:01:35.530" Title="ICA - Exercise Problem from book - Matlab Code" Tags="|matlab|ica|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22919" PostTypeId="2" ParentId="22915" CreationDate="2015-04-22T04:49:28.537" Score="5" Body="&lt;p&gt;I am not sure this is the right place to ask (Perhaps photo.stackexchange.com?) but this is my view on the subject. The term 'Megapixel' has little if any to do with image quality nowadays, since all the popular devices have sufficient amount of pixels. Way more important is the image processing algorithms, optics and sensor size. All digital cameras have huge advantage on the last two while smartphones usually 'make up' for this with image processing algorithms, but not enough to achieve similar quality.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-04-22T04:49:28.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22920" PostTypeId="2" ParentId="22893" CreationDate="2015-04-22T06:45:55.540" Score="0" Body="&lt;p&gt;Well of course the canned filters are rudimentary, and there is a vast literature of more more advanced solutions out there. The only problem is that most of them exist only on paper; you have to implement them yourself. And since you're prepared to do that, then I suggest studying the literature to see what the latest methods are. In my archive I found this survey from 2005:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.108.6427&quot; rel=&quot;nofollow&quot;&gt;A review of image denoising algorithms, with a new one&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I frequently hear about &lt;a href=&quot;http://en.wikipedia.org/wiki/Non-local_means&quot; rel=&quot;nofollow&quot;&gt;non-local means&lt;/a&gt; methods mentioned in a favorable light, and &lt;a href=&quot;http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_photo/py_non_local_means/py_non_local_means.html&quot; rel=&quot;nofollow&quot;&gt;it is supported by OpenCV, so I would suggest starting there&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2015-04-22T06:45:55.540" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22921" PostTypeId="2" ParentId="22349" CreationDate="2015-04-22T06:53:05.000" Score="1" Body="&lt;p&gt;Seraph ask me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ok i understood so far, i guess at least. The question is, what is the&#xA;right thing to do to get the correct shift between two non periodic     &#xA;signals? Especially if they look like my sensor data (don't know &#xA;anything about high pass filters, yet, but i will try to apply one). Is &#xA;that kind of perfect alignment even possible within an acceptable amount &#xA;of run time? &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I decide add new answer (due to big length of answer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have 2 signals with equal length it is not possible to find correct shift (see my first answer). There is an important &lt;strong&gt;exception&lt;/strong&gt; to this statement. You can find the correct shift if the signals have regions with zero values at the beginning and the end. More frequent task - to find the correct shift of a small fragment to the other more long signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have prepared a step-by-step explanation of decision this task. I used your code as a starting point. Your task - find position $sigB$ on $sigA$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ts=0.05;&#xA;x = 0:Ts:7*pi;&#xA;y = 0:Ts:2*pi;&#xA;sigA = sin(x);&#xA;sigB = cos(y);&#xA;figure 1 &#xA;plot(x,sigA,'r',y,sigB,'b');&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ROuCK.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to calculate the correlation values for $sigB$ with fragment of $sigA$ for shift with range $0..(length(sigA)-length(sigB))$. You can use any suitable function (eg &lt;strong&gt;xcorr&lt;/strong&gt; from Matlab) but correctly use the results of its work.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[corr,lag] = xcorr(sigA,sigB);&#xA;[peaks,l]=findpeaks(corr'+100);   %add 100, as &quot;DoubleSided&quot; options does not work in my version&#xA;peaks=peaks-100;     %subtract 100 to get valid values of peaks&#xA;figure 2&#xA;subplot(2,1,1);&#xA;plot(lag,corr,'b',lag(l),peaks,'*r');&#xA;grid on&#xA;title &quot;maximum of correlation for all lag&quot;&#xA;%find indexes of peaks with valid lag&#xA;valpeaks=(lag(l) &amp;gt; 0) &amp;amp; (lag(l) &amp;lt; (length(sigA) - length(sigB)));&#xA;peaks=peaks(valpeaks);&#xA;l=l(valpeaks);&#xA;subplot(2,1,2);&#xA;plot(lag,corr,'b',lag(l),peaks,'*r');&#xA;grid on&#xA;title &quot;maximum of correlation with valid lag&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/zGOhb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now find maximum peak. It will be your decision.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure 3&#xA;[~,i] = max(peaks);&#xA;shift=lag(l(i));&#xA;plot(x,sigA,'r',y+shift*Ts,sigB,'.b');&#xA;grid on&#xA;title &quot;find good position sigB in sigA&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QDruK.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About real signals. Sometimes you need to use not the usual correlation coefficient, but the normalized correlation coefficient. This is particularly useful when the signals have a different scale. Sometimes you can improve results by using high-pass filtering of signals before calculation of correlation.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2015-04-22T07:16:39.717" LastActivityDate="2015-04-22T07:16:39.717" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22922" PostTypeId="2" ParentId="22918" CreationDate="2015-04-22T08:01:35.530" Score="2" Body="&lt;p&gt;In the line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;C=(mnp*mnp')/3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you're dividing by 3 when you should really be dividing by the number of observations, which is 1000 in your case.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-04-22T08:01:35.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22923" PostTypeId="1" AcceptedAnswerId="22924" CreationDate="2015-04-22T08:47:17.947" Score="1" ViewCount="5211" Body="&lt;p&gt;I am trying to find out the dominating frequency of a signal with a frequency of 50 Hz (sampled at 200 Hz - every 5 milliseconds).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The python code I am using to do this is the following (based on &lt;a href=&quot;http://gribblelab.org/scicomp/09_Signals_sampling_filtering.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;from numpy import sin&#xA;from math import pi&#xA;&#xA;t = numpy.linspace(0, 1, 201)  # 200 Hz sampling rate&#xA;y = sin(2*pi*t*50)&#xA;&#xA;fourier = numpy.fft.fft(y)&#xA;frequencies = numpy.fft.fftfreq(len(t), 0.005)  # where 0.005 is the inter-sample time difference&#xA;positive_frequencies = frequencies[numpy.where(frequencies &amp;gt; 0)]&#xA;magnitudes = abs(fourier[numpy.where(frequencies &amp;gt; 0)])  # magnitude spectrum&#xA;&#xA;peak_frequency = numpy.argmax(magnitudes)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The peak frequency I get is 49 Hz, not 50 Hz (what I think I should obtain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the correct way to calculate the peak frequency? If yes, then can you please explain why this happens? Where is my mistake?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;Code modified according to SergV's answer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;from numpy import sin&#xA;from math import pi&#xA;&#xA;Fs=200.&#xA;F=50.&#xA;t = [i*1./Fs for i in range(200)]&#xA;y = sin(2*pi*numpy.array(t)*F)&#xA;&#xA;fourier = numpy.fft.fft(y)&#xA;frequencies = numpy.fft.fftfreq(len(t), 0.005)  # where 0.005 is the inter-sample time difference&#xA;positive_frequencies = frequencies[numpy.where(frequencies &amp;gt; 0)]  &#xA;magnitudes = abs(fourier[numpy.where(frequencies &amp;gt; 0)])  # magnitude spectrum&#xA;&#xA;peak_frequency = numpy.argmax(magnitudes)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The calculated peak frequency is still 49 Hz...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2&lt;/strong&gt;:&#xA;It seems that the problem was that the positive frequencies were not including 0. After changing the code to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;positive_frequencies = frequencies[numpy.where(frequencies &amp;gt;= 0)]  &#xA;magnitudes = abs(fourier[numpy.where(frequencies &amp;gt;= 0)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the calculated dominating frequency was 50 Hz (as expected).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the magnitude spectrum I get: &lt;a href=&quot;https://i.stack.imgur.com/SbxDt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/SbxDt.jpg&lt;/a&gt; It shows that the dominating frequency is 50 Hz. Interestingly, even when, because of the bug, the calculated peak frequency was 49 Hz, the magnitude spectrum was showing the correct dominating frequency (50 Hz)&lt;/p&gt;&#xA;" OwnerUserId="15556" LastEditorUserId="15556" LastEditDate="2015-04-22T13:10:49.510" LastActivityDate="2015-04-22T13:10:49.510" Title="Dominating frequency in a &quot;clear&quot; 50 Hz signal" Tags="|fft|fourier-transform|frequency-spectrum|frequency|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22924" PostTypeId="2" ParentId="22923" CreationDate="2015-04-22T10:06:02.260" Score="2" Body="&lt;p&gt;The size of $y$ is 201. So frequency bin of fft is not 1 Hz. Change code for calculating $t$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs=200.&#xA;F=50.&#xA;t = [i*1./Fs for i in range(200)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you have only 1 peak on 50 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Plot magnitude spectrum&lt;/li&gt;&#xA;&lt;li&gt;Try to modify F (49, 49.5, 49.67). Enjoy!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Welcome to DSP and new questions!&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2015-04-22T12:23:28.700" LastActivityDate="2015-04-22T12:23:28.700" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22927" PostTypeId="2" ParentId="22923" CreationDate="2015-04-22T12:34:11.943" Score="2" Body="&lt;p&gt;To get the frequency of an FFT result bin, you need to multiply the bin number by the sample rate divided by the length of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a sinusoid of a frequency between FFT result bins will get its energy distributed among several FFT result bins, not just the one with the peak magnitude or the one closest.  So some interpolation may be required.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-22T12:34:11.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22928" PostTypeId="1" CreationDate="2015-04-22T13:12:50.730" Score="2" ViewCount="880" Body="&lt;p&gt;I have four frequency peaks, which I have after applying FFT. Now I want to know precise values of these frequency peaks. there are different interpolation methods. How can I use this method of interpolation for four frequency peaks by using python&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k=index of the max (possibly local) magnitude of an DFT&#xA;X[i]=bin &quot;i&quot; of an DFT &#xA;|X[i]|=magnitude of DFT at bin &quot;i“&#xA;k'=the interpolated bin location&#xA;&#xA;Quadradic Method&#xA;y1=|X[k - 1]|&#xA;y2=|X[k]|&#xA;y3=|X[k + 1]|&#xA;d=(y3 - y1) / (2 * (2 * y2 - y1 - y3))&#xA;k'=k + d&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="15072" LastActivityDate="2015-04-23T01:42:30.570" Title="How do I interpolate between bins on an FFT in python?" Tags="|fft|python|interpolation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22929" PostTypeId="2" ParentId="22893" CreationDate="2015-04-22T13:17:08.497" Score="0" Body="&lt;p&gt;NeatImage probably uses Wavelets based Noise Reduction.&lt;br /&gt;&#xA;You can look for methods based on that.&lt;/p&gt;&#xA;&lt;p&gt;Today you need methods which are &amp;quot;Edge Aware&amp;quot;, namely they smooth yet keep edges in tact.&lt;/p&gt;&#xA;&lt;p&gt;Have a look at &lt;a href=&quot;https://github.com/RoyiAvital/Fast-Anisotropic-Curvature-Preserving-Smoothing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Anisotropic Curvature Preserving Smoothing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="54457" LastEditDate="2021-08-18T06:55:25.203" LastActivityDate="2021-08-18T06:55:25.203" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="22930" PostTypeId="1" AcceptedAnswerId="72632" CreationDate="2015-04-22T15:10:47.053" Score="5" ViewCount="3119" Body="&lt;p&gt;I use a PC to record time series of some physical property. The problem is that, for some reason, I did not record the time series as a whole, rather I record first segment, then second, third, etc. Each segment is 500,000 points, representing ~30 min. However, they are not strictly consecutive: between each segment and the other there will be a 'lag', or missing points, equal to a few seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the number of missed points is too small compared to the total number of samples for each segment, can I simply concatenate the segments and treat them as a single time series? At the end I will be interested in doing FFTs, histograms, etc.&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="128" LastEditDate="2021-01-16T12:50:10.737" LastActivityDate="2022-03-24T13:34:12.000" Title="Spectral Analysis of a Time Series with Missing Data Points" Tags="|discrete-signals|frequency-spectrum|sampling|dft|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22931" PostTypeId="2" ParentId="22893" CreationDate="2015-04-22T15:14:47.183" Score="0" Body="&lt;p&gt;Have you tried bilateral filtering? &lt;a href=&quot;http://opencvexamples.blogspot.com/2013/10/applying-bilateral-filter.html&quot; rel=&quot;nofollow&quot;&gt;It is also in OpenCV&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-04-22T15:14:47.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22932" PostTypeId="1" CreationDate="2015-04-22T17:40:57.843" Score="1" ViewCount="1526" Body="&lt;p&gt;I am beginer in image processing. Any signal whether it is 1D,2D or any multidimensional signal can be represented using combination of number of sine and cosine wavesforms (harmonics). Similerly any image can be termed as a function of sinusoidal signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to see &lt;strong&gt;individual pattern&lt;/strong&gt; for the number of waveforms/harmonics present in an image.for example the following  link contains few of them &lt;a href=&quot;http://www.cs.toronto.edu/~rfm/factored/filters_out.png&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.toronto.edu/~rfm/factored/filters_out.png&lt;/a&gt; . So is there any code in &lt;strong&gt;Matlab/ OpenCV  or results&lt;/strong&gt; to understand easily these components(sine and cosine functions(harmonics)) present in any image? &lt;/p&gt;&#xA;" OwnerUserId="15429" LastEditorUserId="15429" LastEditDate="2015-04-25T11:43:59.053" LastActivityDate="2015-04-25T11:43:59.053" Title="Finding the Harmonics contained in an Image?" Tags="|image-processing|matlab|fft|fourier-transform|opencv|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22933" PostTypeId="2" ParentId="4801" CreationDate="2015-04-22T17:54:14.440" Score="-1" Body="&lt;p&gt;okay, lets say we have a sound file of two people talking.. if they were not talking in unison, it would be possible to separate the tonal element of their speech. it might be trickier to separate the noise elements of their speech (ssss or fffff sounds), but again if they were not speaking in unison it might be possible. this would be much easier to do if we could perform spectral analysis on sound without losing the phase information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;basically, spectral analysis takes a waveform (sound as single wave or line) and separates all the individual tones so you can see them from low to high and left to right in time. when doing this, most of the information showing the rise and fall of the single waveform is lost. if we could preserve the phase information, this would be much easier because all individual component frequencies of one voice would be harmonically related to each other, thus their phase would line up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;at present, i don't know of any algorithm that achieves this, but i believe it to be theoretically possible. i remember reading some article about melodyne's creater peter neubäcker working on a way to do this, so that two singers singing together could be separated, but i don't know how i would find this article again&lt;/p&gt;&#xA;" OwnerUserId="15560" LastActivityDate="2015-04-22T17:54:14.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22934" PostTypeId="2" ParentId="22932" CreationDate="2015-04-22T19:20:36.977" Score="4" Body="&lt;p&gt;this questions is asked fairly often. If you don't have a grasp of fft in 1d, higher dimensions may be difficult to grasph. But logically it makes a lot of sense once you see it &lt;a href=&quot;https://dsp.stackexchange.com/questions/1637/what-does-frequency-domain-denote-in-case-of-images&quot;&gt;What does frequency domain denote in case of images?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;basically sharp changes (high contast noise) usually has high frequencies. and smoother gradients have low frequencies. just as a quick crash course&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;sorry i thought the other post had code, its just code agnostic conceptual stuff. anyway ill tell you matlab (since your tag says matlab in it) and it is more familiar to me than openCV&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function fft_im = createFFTIm(grayscale_im)&#xA;    fft_im = fft2(grayscale_im);&#xA;&#xA;    figure()&#xA;    subplot(2,2,1:2);imshow(grayscale_im); title('original');&#xA;    %fftshift puts the 0 frequency in the middle of the plotting area, normally&#xA;    %it would be split, part of it in the 4 corners of the image&#xA;    %we add 1 because log(0) is -inf, which we dont want&#xA;    %we scale it jsut to show the colors better&#xA;    subplot(2,2,3);imagesc(log(1+abs(fftshift(fft_im)))); colormap(gray); &#xA;    title('magnitude spectrum');&#xA;&#xA;    subplot(2,2,4);imagesc(angle(fft_im));  colormap(gray);&#xA;    title('phase spectrum');&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit #2&lt;/strong&gt; i slightly modified the code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and here are two examples&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MEABR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cuj6h.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;notice with the chess example, there are visible peaks in the magnitude spectrum. Just like the regular fft, these peaks correspond to a sing wave of a specific frequency. Since out image is periodic there is are strong sines at the corresponding frequencies. You also notice since the image is near symmetric, the phase is also periodic. &#xA;The phase is responsible for modeling the fact that an image is not symmetric&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit #3&lt;/strong&gt;&#xA;this decomposes the figure into individual elements. In the code I limited it to a 4x4 subblock of pixels (the upper left portion of the figure) but you can change this all the way up to the size of the image (though for any large image this would be incredibly slow)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As in my comment, I processed the image one pixel at a time, and did an FFT2 on each of those 1 pixel images. The images themselves are still the same size as the original, it just has only one pixel value populated&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function fft_im = decomposedcreateFFTIm(grayscale_im)&#xA;    %i only did a small 16 pixel sub block of the image, 4x4 pixels from &#xA;    %the upper left corner of the image&#xA;    max_rows_to_process = 4;&#xA;    max_cols_to_process = 4;&#xA;&#xA;    [m,n] = size(grayscale_im);&#xA;&#xA;    %this is used to isolate pixels, for individual analysis&#xA;    zer_array = zeros(m,n);&#xA;&#xA;    figure(1);title('magnitude')&#xA;    figure(2);title('phase')&#xA;&#xA;    %i only did a small 16 pixel sub block of the image, 4x4 pixels from &#xA;    %the upper right corner of the image&#xA;    m=4;n=4;&#xA;&#xA;    %for all rows&#xA;    for ii=1:1:max_rows_to_process&#xA;        %for all columns&#xA;        for jj=1:1:max_cols_to_process&#xA;            curr_idx = (ii-1)*max_cols_to_process + jj;&#xA;&#xA;            %creates an image with only one pixel&#xA;            indiv_pix_pic = zer_array;&#xA;            indiv_pix_pic(ii,jj) = grayscale_im(ii,jj);&#xA;&#xA;            %does fft&#xA;            fft_im = fft2(indiv_pix_pic);&#xA;&#xA;            %fftshift puts the 0 frequency in the middle of the plotting area, normally&#xA;            %it would be split, part of it in the 4 corners of the image&#xA;            %we add 1 because log(0) is -inf, which we dont want&#xA;            %we scale it jsut to show the colors better&#xA;            figure(2)&#xA;            subplot(max_rows_to_process,max_cols_to_process,curr_idx);&#xA;            imagesc(angle(fft_im));  colormap(gray);&#xA;&#xA;            figure(1)&#xA;            subplot(max_rows_to_process,max_cols_to_process,curr_idx);&#xA;            imagesc(log(1+abs(fftshift(fft_im)))); colormap(gray); &#xA;        end&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;magnitude&#xA;&lt;img src=&quot;https://i.stack.imgur.com/47fDs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;phase&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Edw1k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-04-24T17:34:16.520" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="22937" PostTypeId="2" ParentId="22892" CreationDate="2015-04-22T23:05:13.210" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The FFT size in LTE is defined as 2^(nextpow2(Nsubcarriers/2)+1) or the nearest power of two that is also higher than the number of subcarriers for a given bandwidth. For the 10 Mhz case, for example, this means that 424 FFT bins(1024-600) are zero padded apart including the DC bin. The usual practice is to zero pad the central 423+DC bins and use the rest for filling the data so that you get a continous spectrum of 10 MHz around DC. You can also fill the central 600 FFT bins with data and do a fftshift. See table 1 in &lt;a href=&quot;http://www.tsiwireless.com/docs/whitepapers/LTE%20in%20a%20Nutshell%20-%20Physical%20Layer.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; document.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes. Each Resource Element(i.e.1 subcarrier and 1 OFDM system in the Time- Frequency Grid) has one QAM Symbol in shared channel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Check out &lt;a href=&quot;http://niviuk.free.fr/lte_resource_grid.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; visualization to get a better clarity about the LTE resource grid. The resource is allocated both in time and frequency domain and in the case of Multi User MIMO(MU-MIMO) transmission mode, spatial resource allocation of resource elements to different user equipment in the downlink also take place. To keep things simple, let's just focus on a single-antennae transmission. The following diagram will give you a better idea of the whole transmission process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XlpH8.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="11242" LastEditDate="2015-04-23T11:14:49.393" LastActivityDate="2015-04-23T11:14:49.393" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="22939" PostTypeId="2" ParentId="22930" CreationDate="2015-04-23T01:56:35.657" Score="1" Body="&lt;p&gt;Spectral analysis, FFT, wavelets requires that sequences are of equal duration and that the series is consecutive thus that no missing data points are present. I would suggest to fill the voids with extrapolated values based on the last few instances from last sequence or another solution would be to mirror the last few instances missing values based on inverted pass values or another solution would be to use the last data points and repeat it to fill the void.&lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-04-24T00:19:26.280" LastActivityDate="2015-04-24T00:19:26.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22941" PostTypeId="2" ParentId="22909" CreationDate="2015-04-23T11:06:59.613" Score="3" Body="&lt;p&gt;In LTE downlink, users are multiplexed in both time and frequency domain. The concept of ressource blocks (RB) describes a certain frequency band in a certain time slot. Your understanding of the steps in the transmitter are correct. Step 4 describes the procedure that assigns a certain frequency band $B_m$ to some user $m$. One OFDM symbol in LTE downlink carries the data of several users. Subcarrier mapping means that the data of user $m$ is allocated to certain subcarriers that represent the frequency band $B_m$ as shown in the following figure (where $M$ is the total number of frequency bands)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rnmKr.png&quot; alt=&quot;Subcarrier mapping LTE downlink&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This technique corresponds to frequency multiplexing. Time multiplexing means that the the band $B_m$ is reserved for user $m$ only for a certain time duration, i.e. for a certain number of consecutive OFDM symbols (you mention 14 in your question, I haven't checked it). In the next subframe this band might be allocated to a different user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bit rate of user $m$ can be calculated as follows. Let $N$ be the number of subcarriers per user, $b$ the number of bits per subcarrier and $T$ the OFDM symbol time &lt;em&gt;including&lt;/em&gt; the cyclic prefix. Then the bit rate $R_\mathrm{b}$ of user $m$ is&#xA;$$&#xA;R_\mathrm{b} = \frac{bN}{T}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2015-04-23T11:12:44.237" LastActivityDate="2015-04-23T11:12:44.237" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="22943" PostTypeId="2" ParentId="22932" CreationDate="2015-04-23T14:41:52.553" Score="-1" Body="&lt;p&gt;If you want to see the results of a Fourier transform, then it's not that difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT of an MxN image is an MxN array of complex numbers.  Each complex value represents the magnitude and phase of a sine wave at one particular frequency - or more precisely one pair of frequencies (horizontal and vertical), since it's a 2D FFT. (&lt;em&gt;Aside: a cosine wave is just a sine wave with a different phase, so we can treat the result as just being a sum of sine waves&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see the magnitudes, take the absolute value of those complex numbers.  Then re-scale the results to either 0 .. 255 or 0.0 ... 1.0 (the latter is probably better under Matlab).  You now have an MxN array of numbers, which is just the same as an image.  So display it as if it were an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the results are pretty much black with a few white spots, you may need to apply some form of contrast enhancement (such as histogram equalisation) to see anything else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting &quot;image&quot; will be symmetrical top-to-bottom, and left-to-right.  The value in the centre is the &quot;DC&quot; or zero frequency component.  As you move away from the centre, you're looking at higher frequency sine waves.  The ones at the edges are the highest possible frequencies - corresponding to alternating black and white pixels in the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For most real-world images, the FFT result viewed as an image will be a largely featureless grey mush.  That just tells you that the image contained a mixture of many different frequencies, or in other words that the objects in the image were of a wide range of different sizes and orientations.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-04-23T14:41:52.553" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="22944" PostTypeId="2" ParentId="22899" CreationDate="2015-04-23T15:12:32.873" Score="3" Body="&lt;p&gt;Your observation are the $y_k$ your observation model is defined by $Y_k=HX_k+\eta_k$, where $\eta_k$ if a sample from a normal distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want your kalman filter to estimate position, velocity and acceleration your state vector is : $X_k=[x_k,\dot{x}_k,\ddot{x}_k]^T$ and therefore your observation matrix is : $H=[0,0,1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As stated by Rhei, your observations are what you get from the system at each time step, i.e. the measured acceleration.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-23T15:12:32.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22945" PostTypeId="1" AcceptedAnswerId="22948" CreationDate="2015-04-23T15:44:58.220" Score="1" ViewCount="356" Body="&lt;p&gt;I know this subject tends more to control theory but I am certain its part of the global knowledge basis for engineers, thus I believe I can find the answer here.&#xA;I'm trying to draw Root Locus for $K&amp;lt;0$, but can't understand how the system behaves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this open loop system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{20(1+s)^2}{(1+\frac{s}{10})(1+\frac{s}{2})}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it has no asymptotes, but yet by one of the drawing rules for $k&amp;lt;0$, it tends to $\pm \infty$ in the real axis. How is it possible?&lt;/p&gt;&#xA;" OwnerUserId="15323" LastEditorUserId="15323" LastEditDate="2015-04-23T16:23:59.287" LastActivityDate="2015-04-24T11:50:36.430" Title="Root Locus for a system" Tags="|control-systems|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22946" PostTypeId="1" CreationDate="2015-04-23T20:02:18.840" Score="2" ViewCount="969" Body="&lt;p&gt;I'm working on a project in which a rod is attached at one end to a rotating shaft. So, as the shaft rotates from 0 to ~100 degrees back-and-forth (in the xy plane), so does the rod. I mounted a 3-axis accelerometer at the end of the moving rod, and I measured the distance of the accelerometer from the center of rotation (i.e., the length of the rod) to be about 38 cm.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the plot of both relevant dimensions collected from the accelerometer (after filtering). I am neglecting to include the third up and down dimension as the accelerometer shows a near constant ~1 G, so I think its safe to say its not capturing much rotational motion. Red is what I believe is the centripetal component, and blue is tangential.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NB1kM.png&quot; alt=&quot;accelerometer data&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I'm also colleccting position and time data, though I don't know if that helps any.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions pertain to the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) How do I &quot;combine&quot; these data to fully capture the rational motion taking place? I know it's not as easy as summing the squares and taking the sqrt, but I've been having a really hard time on finding a way to do this throughout all the research I've done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) How do I correct for the offset in the data? After some research and asking others, it may have to do with the orientation of my accelerometer (its not perfect). Apparently I should use rotation matrices to transform the measurements to a different coordinate system - one where one axis feels an acceleration of g and the rotation of the rod influences another axis only, but I'm unsure of how to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help me use rotation matrices on the data? Will using rotation matrices fix the problem listed in number 1 as well? I'd appreciate any kind of assistance I can get. Here are links to both dimensions captured from the accel (the full data):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cl.ly/3n3Y2y3j1P19?_ga=1.76624790.2093327149.1426657579&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://cl.ly/3n3Y2y3j1P19?_ga=1.76624790.2093327149.1426657579&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cl.ly/3R1d3E1Y2C2x?_ga=1.76624790.2093327149.1426657579&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://cl.ly/3R1d3E1Y2C2x?_ga=1.76624790.2093327149.1426657579&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15573" LastActivityDate="2015-04-23T20:02:18.840" Title="Analyzing accelerometer data: appropriate use of rotation matrices?" Tags="|matlab|signal-analysis|algorithms|motion|sensor|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22948" PostTypeId="2" ParentId="22945" CreationDate="2015-04-24T00:12:26.450" Score="2" Body="&lt;p&gt;I will denote the given system as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G(s) = \frac{20(1+s)^2}{(1+\frac{s}{2})(1+\frac{s}{10})}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input or reference signal to the closed loop will be denoted by $R(s)$ and the output by $Y(s)$. The controller will initially be denoted by $H(s)$, while in this case it is equal to $K$. The  block diagram of the closed loop system can then be drawn as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img src=&quot;https://i.stack.imgur.com/wYXPH.png&quot; alt=&quot;Closed loop block diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With its transfer function from input to output equal to,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{Y(s)}{R(s)} = \frac{G(s)}{1 + H(s) G(s)}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For root locus analysis you want to find the poles of this transfer function as function of $H(s)$. The poles can be found by solving when the denominator is equal to zero. However the denominator (and numerator) are polynomials of $s$, so can't be fractions themselves. In order to ensure this I will slit $G(s)$ up in to two parts, its numerator, $G_n(s)$, and denominator, $G_d(s)$. The same can be done for $H(s)$. The resulting transfer function can then be written as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{Y(s)}{R(s)} = \frac{\frac{G_n(s)}{G_d(s)}}{1 + \frac{H_n(s)}{H_d(s)} \frac{G_n(s)}{G_d(s)}} = \frac{H_d(s) G_n(s)}{H_d(s) G_d(s) + H_n(s) G_n(s)}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As stated before, in this case $H(s)$ is equal to $K$, thus $H_d(s)$ is equal to one. By substituting in $K$ for $H_n(s)$ and the two polynomials, from this first equation, for $G_n(s)$ and $G_d(s)$, then the following expression can be obtained,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{Y(s)}{R(s)} = \frac{20(1+s)^2}{(1+\frac{s}{2})(1+\frac{s}{10}) + 20K(1+s)^2}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting denominator is a second order polynomial, so solving for the poles yields two solutions, which can be simplified to,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;p=-\frac{400 K \pm 4 \sqrt{1 - 225 K} + 6}{400 K + 1}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $K=-\frac{1}{400}$ the limits of both $p$ are $\pm\infty$ depending if you approach that value from the left or the right. Thus near $K=-\frac{1}{400}$ there will be values for the poles of the closed loop transfer function which will have a positive real values.&lt;/p&gt;&#xA;" OwnerUserId="7579" LastEditorUserId="7579" LastEditDate="2015-04-24T11:50:36.430" LastActivityDate="2015-04-24T11:50:36.430" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="22949" PostTypeId="1" AcceptedAnswerId="22990" CreationDate="2015-04-24T00:18:06.540" Score="0" ViewCount="195" Body="&lt;p&gt;How can I find inverse z transform of $$X(z)=\frac{5}{(z-2)^{2}}$$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is known that x[n] is causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Here is what I have done. Since signal x(n) is causal, convergence of z transform of that signal will be outside of circle with radius r:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rsimg.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have in bracket sum which represents z transform of signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/o1eRf.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't know what to do next.&lt;/p&gt;&#xA;" OwnerUserId="15574" LastEditorUserId="15574" LastEditDate="2015-04-24T16:26:11.393" LastActivityDate="2015-04-25T13:33:48.347" Title="Inverse z transform - help" Tags="|transform|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="22950" PostTypeId="2" ParentId="22949" CreationDate="2015-04-24T00:48:20.643" Score="0" Body="&lt;p&gt;note, from &lt;a href=&quot;https://en.wikipedia.org/wiki/Z_transform&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathcal{Z}\left\{ n a^n u[n] \right\} = \frac{az^{-1} }{ (1-a z^{-1})^2 } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;see if you can make your problem fit that form.  (gonna get a funky result because $a=2$.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-24T00:48:20.643" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22951" PostTypeId="1" CreationDate="2015-04-24T01:27:07.693" Score="0" ViewCount="211" Body="&lt;p&gt;I was wondering if any of you guys could help me with the next 3 problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're about estimating the &lt;strong&gt;&lt;em&gt;lamda&lt;/em&gt;&lt;/strong&gt; on the &lt;strong&gt;Optical Flow&lt;/strong&gt; equation $E =&#xA;E_s + λE_c$, for different situations that try to estimate pixel motion in videos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Suppose we're trying to estimate motions in a video gotten from a drone. &#xA;Do we have to use&#xA;a small, medium, or large value for $λ$? You need to&#xA;justify what you answer by using the integral for $E$, $E_s$, and $E_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Now we try to estimate some smooth motions. Do we have to use&#xA;a small, medium, or large value for $λ$? You need to&#xA;justify what you answer by using the integral for $E$, $E_s$, and $E_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) After applying the optical-flow method, we see that estimated motions&#xA;are parallel to the (local) image gradient. To fix this, do we have to use&#xA;a small, medium, or large value for $λ$? You need to&#xA;justify what you answer by using the integral for $E$, $E_s$, and $E_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15576" LastEditorUserId="7092" LastEditDate="2015-04-24T02:01:14.413" LastActivityDate="2016-03-06T13:03:15.867" Title="Optical Flow Problems" Tags="|image-processing|video-processing|" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22952" PostTypeId="1" CreationDate="2015-04-24T03:54:01.457" Score="1" ViewCount="4559" Body="&lt;p&gt;I am truly sorry if my question sounds little bit stupid, but I am getting stuck at this part for a long time. I am currently working for my final year project of lane detection for curved road using B-snake. I am using Matlab software, and I have done the image pre processing part by converting the RGB value to grayscale. After the converting I simply use the Canny edge detection but it seems that there is too many noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Px1Ol.jpg&quot; alt=&quot;The original image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the first part that I obtained :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mJzjT.png&quot; alt=&quot;Image of Canny edge detection &quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I tried the region props function for which the Matlab code I obtained from this website. The noise has reduced a little bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cWoS1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only region that I want is the road region. But I don't manage to get the ROI that I need. So I just proceed to Hough Transform to obtain the straight line. I try to run the coding of Hough Transform that I found on the internet, but the result is so confusing. I don't know how to change the code so that my result will turn out better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image after Hough Transform is applied :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7f2EP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my full code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I=imread('C:\Users\LENOVO\Documents\MATLAB\PSM2\road\draw\test1.jpg'); %         Input image file here&#xA;dim = size(I); % Get size of the image and store in an array called 'dim'.%size array matrix; 1 is height, 2 is width&#xA;&#xA;I2 = rgb2gray(I); % Convert to grayscale&#xA;BW = edge(I2,'canny',[]); % Edge detection using Canny&#xA;cc = bwconncomp(BW);&#xA;I4 = labelmatrix(cc);&#xA;&#xA;a_rp = regionprops(cc,'Area','MajorAxisLength','MinorAxislength','Orientation','PixelList','Eccentricity');&#xA;idx = ([a_rp.Eccentricity] &amp;gt; 0.99 &amp;amp; [a_rp.Area] &amp;gt; 100 &amp;amp; [a_rp.Orientation] &amp;lt; 60 &amp;amp; [a_rp.Orientation] &amp;gt; -90);&#xA;&#xA;BW2 = ismember(I4,find(idx));&#xA;[H,T,R] = hough(BW2);&#xA;&#xA;%  figure, imshow(H,[], 'XData', T, 'YData', R, 'InitialMagnification', 'fit');&#xA;%  xlabel('\theta'), ylabel('\rho');&#xA;axis on, axis normal, hold on;&#xA;P  = houghpeaks(H,50,'threshold',ceil(0.1*max(H(:))));&#xA;&#xA;% Set houghpeaks parameters, threshold unsure&#xA;x = T(P(:,2));&#xA;y = R(P(:,1));&#xA;plot(x,y,'s','color','white');&#xA;&#xA;% Apply median filtering&#xA;I3 = medfilt2(I2);&#xA;&#xA;% Find lines and plot them&#xA;lines = houghlines(BW,T,R,P,'FillGap',20,'MinLength',10);&#xA;figure, imshow(I3),imagesc(I3), hold on&#xA;max_len = 0;&#xA;&#xA;for k = 1:length(lines)&#xA;    xy = [lines(k).point1; lines(k).point2];&#xA;    plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');&#xA;&#xA;    % plot beginnings and ends of lines&#xA;    plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');&#xA;    plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');&#xA;end&#xA;&#xA;showlines = struct(lines);&#xA;cellData = struct2cell(showlines);&#xA;&#xA;% X-coordinates are for width&#xA;% Y-coordinates are for height&#xA;%point1(x y) etc&#xA;&#xA;for i = 1:280&#xA;    % 'A' stores all 'x' coordinates of point 1&#xA;    A([i,i+1])= [cellData{1,i}];&#xA;    % 'B' stores all 'x' coordinates of point 2&#xA;    B([i,i+1])= [cellData{2,i}];&#xA;    % 'C' stores all 'y' coordinates of point 1&#xA;    C([i,i])= [cellData{1,i}];&#xA;    % 'D' stores all 'y' coordinates of point 2&#xA;    D([i,i])= [cellData{2,i}];&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I do really hope someone can help me. At least general idea for me to proceed to the next step is enough. Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="15577" LastEditorUserId="7092" LastEditDate="2015-04-24T16:31:07.223" LastActivityDate="2016-12-13T10:44:36.713" Title="Lane detection and tracking using B-snake?" Tags="|image-processing|matlab|computer-vision|canny-edge-detector|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22955" PostTypeId="2" ParentId="22952" CreationDate="2015-04-24T07:46:00.057" Score="2" Body="&lt;p&gt;Following my comment I suggest you a &quot;dumb&quot; heuristic you could try : Consider your images row-wise. Extract a few features from each row, these could be average RGB value, RGB covariance matrix, entropy etc ... Use a simple clustering algorithm to separate your image into 2 parts : the upper one and the lower one. Let's assume the heuristic has been successful and the lower part is mostly composed of road. We'll just consider this part and run a clustering algorithm on the RGB values. We keep the number of cluster low and we want to take the cluster which is the closest from grey as the road cluster. Once you have a not too bad road segmentation, play around a bit with edge detection to extract only the white marking.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-24T07:46:00.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22956" PostTypeId="1" AcceptedAnswerId="23004" CreationDate="2015-04-24T08:16:00.687" Score="2" ViewCount="887" Body="&lt;p&gt;Hello everyone have a look at this video of &lt;a href=&quot;https://www.youtube.com/watch?v=dUAqSlSAQKA&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fourier Decomposition of an image&lt;/a&gt;(otherwise you can also refer the &lt;a href=&quot;https://i.stack.imgur.com/h90Vx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;image&lt;/a&gt; which shows few plots of different extracted waves from an image) . We also know that a Fourier series is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac {a_0} 2 + \sum \limits _{m=1} ^\infty (a_m \cos \frac {2 \pi m t} T + b_m \sin \frac {2 \pi m t} T)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.In the given video at bottom middle there is plot of extracted waves.My doubt is whether these waves &lt;strong&gt;means&lt;/strong&gt; cosine (or sine) functions from the Fourier series formula?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.What is mean by bases functions(or images)? Whether the plot of Extracted waves are called as bases functions here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:Although above Fourier Formula is for 1D signal and video is of 2D image,please keep in mind Fourier series formula for 2D signal.&lt;/p&gt;&#xA;" OwnerUserId="15429" LastEditorUserId="15429" LastEditDate="2015-04-26T17:37:38.370" LastActivityDate="2015-04-27T08:07:45.083" Title="Fourier Decomposition" Tags="|image-processing|matlab|fft|fourier-transform|dft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22957" PostTypeId="2" ParentId="22553" CreationDate="2015-04-24T08:54:55.140" Score="1" Body="&lt;p&gt;Reduction of Noise in a video depends on what type of noise is present in the video.&#xA;The noise can be reduced by filters which are all present [There are software for this] and many type of filters such as median ,mean,wiener filter.&#xA;And The noise model can be build to add noise to the video there are many matlab code as well as software also there.&#xA;Gaussian ,salt and pepper,poisson and speckle noise model can be build and by adding the image sequence with the video you will get a noisy video.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imnoise(video,noisename);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;this will give noisy video as output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any doubt ask me.&lt;/p&gt;&#xA;" OwnerUserId="15525" LastActivityDate="2015-04-24T08:54:55.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22958" PostTypeId="1" AcceptedAnswerId="22961" CreationDate="2015-04-24T08:58:00.420" Score="0" ViewCount="2198" Body="&lt;p&gt;I was wondering about the implementation of the  Median Filter in opencv because I am suffering form its slowness. So, I intend to implement another one on my own but first I want to make sure about the used algorithm in opencv.&#xA;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="15118" LastActivityDate="2015-04-24T10:09:34.437" Title="Median filter algorithm in opencv" Tags="|filters|opencv|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22959" PostTypeId="2" ParentId="22553" CreationDate="2015-04-24T09:37:20.967" Score="0" Body="&lt;p&gt;Usualy, when you send a video over a network, the video is compressed. For instance, let's say your video is compressed using a wavelet transform. The most simple way to compress your video is to truncate the wavelet transform 's coefficients. Apply a wavelet transform on your noisy video, if your noise isn't a simple white noise, it will have a specific template. Then you can use this template to tune your initial wavelet transform 's truncation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strictly speaking about noise modeling, without going for any transform, you could also take all your noisy video, and build the noise's pdf in the grey level scale (one dimension histogram). If your space is RGB (3 dimension histogram), you'll prefer to use a kernel density estimator.&#xA;You could also take some spatio-temporal patches say 5 temporal frame, and 50*50 spatial patches, you'll have a lot of patch with your video, treat them as realization of a random vector, so consider them as a vector of length 5*50*50, you can now calculate you noise covariance matrix, which is another modelisation. It will allow you to go for denoising/compressing with PCA.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-24T09:37:20.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22960" PostTypeId="2" ParentId="22958" CreationDate="2015-04-24T09:46:48.510" Score="1" Body="&lt;p&gt;I don't know about opencv's implementation, but a median filter can indeed be very slow because for every windows you have to sort your data in order to find the median. However there is a recursive implementation of the median filter, which is much more quick. It is very simple to build.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to recursively build the data's histogram that will allow you to very quickly get the median without sorting :&#xA;For the first window, fully build the histogram, then, shift your windows by one step (or more, it depends on you), remove the last value from the previous window and add the new one, you updated your histogram with only 2 operations.&#xA;Then you have to find the median within the histogram, this is recursively feasible but I don't remember the exact implementation (it is a bit more tricky), however simply checking the histogram's cumulative sum, while brutal, will give you the median quickly (worst case scenario is N summation, with N your window's size).&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-24T09:46:48.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22961" PostTypeId="2" ParentId="22958" CreationDate="2015-04-24T10:09:34.437" Score="1" Body="&lt;p&gt;OpenCV is &quot;Open source computer vision&quot;. So all source code is open. See - &lt;a href=&quot;http://code.opencv.org/projects/opencv/wiki#Development&quot; rel=&quot;nofollow&quot;&gt;http://code.opencv.org/projects/opencv/wiki#Development&lt;/a&gt;.  Download sources from git, find code for median filter. Modify it. If you code will be better - contribute to OpenCV.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2015-04-24T10:09:34.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22962" PostTypeId="1" AcceptedAnswerId="22965" CreationDate="2015-04-24T13:22:31.453" Score="1" ViewCount="5559" Body="&lt;p&gt;I want to convert &lt;strong&gt;db&lt;/strong&gt; into &lt;strong&gt;amplitude ratio&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some research but I only found &lt;a href=&quot;http://www.silisoftware.com/tools/db.php&quot; rel=&quot;nofollow&quot;&gt;online convertor&lt;/a&gt;, and I don't understand what's on &lt;a href=&quot;http://en.wikipedia.org/wiki/Decibel&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt; very well...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a little of backstory :&lt;br&gt;&#xA;I am a programmer and I have to code an Equalizer; the problem is, I'm new to this DSP world.&lt;br&gt;&#xA;I'm using a small documentation that an audio engineer in my company made a while ago and there are stuffs that I don't understand in it. (He's obviously not in the company anymore...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In his documentation, he writes that the equalization is made step by step with an incrementation of ±0.1 dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here are my questions :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What's the formula to convert dB into a percentage ?&lt;br&gt;&#xA;On Wikipedia, there is 10 log10(&lt;strong&gt;x&lt;/strong&gt;), but &lt;strong&gt;x&lt;/strong&gt; is the power ratio, and I don't know how to get that either...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does processing step by step is the best/only solution ?&lt;br&gt;&#xA;Or can I calculate the ratio that I need each time (to limit the number of measures needed) ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks for you time.&lt;/p&gt;&#xA;" OwnerUserId="15579" LastEditorUserId="15579" LastEditDate="2015-05-05T13:10:12.490" LastActivityDate="2019-09-16T17:24:39.037" Title="Decibels conversion into amplitude ratio" Tags="|audio|equalization|c++|equalizer|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22963" PostTypeId="1" AcceptedAnswerId="22964" CreationDate="2015-04-24T13:24:19.383" Score="1" ViewCount="1673" Body="&lt;p&gt;The DWT is motivated by the ability to see signal in time and frequency at the same time, if I understood that correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the following Matlab commands for some signal x:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[A,D] = dwt(x,'db4');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I plot A vs some vector t, representing 'time'. I do know the algorithm behind A and D: low (high) pass filter, then downsample by 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions: Where is the time axis and where is the frequency axis if I all what I have are the coefficients A (approximation) and D (detail)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question: If all of this is a simple filtering and downsampling, I don't see what is new in DWT...&lt;/p&gt;&#xA;" OwnerUserId="8825" LastActivityDate="2015-05-01T09:37:21.370" Title="Where is the &quot;time and frequency&quot; in a Discrete Wavelet Transform?" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22964" PostTypeId="2" ParentId="22963" CreationDate="2015-04-24T13:59:36.500" Score="1" Body="&lt;p&gt;DWT is motivated by the ability to analyse the signal in time and frequency &lt;strong&gt;with an adaptative time and frequency resolution&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some clever algorithm allows you to perform a wavelet analysis with a recursive implementation. Matlab's DWT does that, matlab's dwt perform only one level of DWT, therefore, A is only the output of the low-pass filter while D is the output of the high-pass filter. There is no time and frequency here.&#xA;It only gives you a very coarse information about the time-frequency content of the signal.&#xA;Please check how to implement a DWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question : To see the novelty, you have to compare that to short-time frequency transform. With the DWT the time-frequency resolution depend on the frequency while with the STFT it's always the same. This is a &lt;strong&gt;VERY DESIRABLE&lt;/strong&gt; property : You want a short time windows for quicly mooving high frequency signals and a long window for slower low frequency signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, please consider that the filtering/downsampling implementation is a very refined and efficient one. DWT is an incredible tool for analysis, denoising, feature extraction etc ...&lt;/p&gt;&#xA;" OwnerUserId="13315" LastEditorUserId="13315" LastEditDate="2015-05-01T09:37:21.370" LastActivityDate="2015-05-01T09:37:21.370" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22965" PostTypeId="2" ParentId="22962" CreationDate="2015-04-24T14:55:39.147" Score="1" Body="&lt;p&gt;You will want to work with what Wikipedia calls &quot;field quantities.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your engineer is telling you to work in steps of .1dB, which would be an amplitude ratio of .1=20log10(x).  To get x you do 10^(.1/20) = 1.01158&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From x dB to ratio (amplitude):  10^(x/20)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From x ratio (amplitude) to dB:  20Log10(x)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can calculate the ratio, then you should be able to calculate the correction needed, round to the next .1dB step, and apply it in one step.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="36124" LastEditDate="2019-09-16T17:24:39.037" LastActivityDate="2019-09-16T17:24:39.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22966" PostTypeId="2" ParentId="22962" CreationDate="2015-04-24T15:02:59.923" Score="0" Body="&lt;p&gt;Normally deci Bell is a ratio (Power or energy). &lt;br&gt;&#xA;Power have a ratio of $10 \log \tfrac{p_1}{P_0}$ here is $P_0$ the reverence value and $P_1$ the measured value.&lt;br&gt;&#xA;Voltage and digital systems have normally $20 \log \tfrac{v_1}{v_0}$. where $V_0$ is the reference value of the voltage and $V_1$ is also measured value.&lt;br&gt;&#xA;In a digital system the reference value is the maximum value. Let say this value is 1. a 16 bit system is the smallest value $\tfrac{1}{2^16 -1} = \tfrac{1}{65535}$ (A lot of software like Logic works with 24 Bit signal so they have more space before clipping).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $20 \log \tfrac{v_1}{v_0} = 20 \log \tfrac{{}^1/_{65535}}{1} = -96.3295$ dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) prefer no percentage but just values or deciBells &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) When you everything calculated in deciBells you can just add or subtract values  from each other. In that case only on the input or output calculate to the original values&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2015-04-24T15:02:59.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22968" PostTypeId="1" AcceptedAnswerId="22980" CreationDate="2015-04-24T16:39:32.037" Score="0" ViewCount="1215" Body="&lt;p&gt;I hope this is not off-topic. I'm wondering is there anyway to change the default angle unit label in MATLAB polar plot. The default angle label is from 0 to 360, at 30 increment. It goes like 0,30,60,... But I want to change it, say, from 0 to -360, at -30 increment. So the labels will be like 0,-30,-60,... Is there anyway to do it?&lt;/p&gt;&#xA;" OwnerUserId="8907" LastActivityDate="2015-04-25T07:03:04.253" Title="How to change the angle unit labels on polar plot in MATLAB?" Tags="|matlab|polar|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22969" PostTypeId="1" AcceptedAnswerId="22992" CreationDate="2015-04-24T17:54:14.100" Score="2" ViewCount="1080" Body="&lt;p&gt;My understanding of what an OFDM modulator does, is that it takes a parallel sequence of QAM symbols of size M, pads it with zeroes corresponding to the zero subcarriers, then passes them through an IFFT block of same size M. IFFT is used because it can digitally create subcarriers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Is the result output of the IFFT operation, an OFDM symbol of length M too?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Is EACH OFDM symbol going to be weighted sum of the ALL the QAM symbol?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- How do things change if we have two antennas instead of one, do we have an OFDM modulator to each antenna? For example when using the Alamouti scheme? I have no clear vision how things change in this case, i.e what is the input at the IFFT now? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking forward for answers thank you.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-04-24T21:42:04.713" LastActivityDate="2015-04-25T16:27:13.113" Title="OFDM modulator in LTE" Tags="|digital-communications|ofdm|ifft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22970" PostTypeId="1" CreationDate="2015-04-24T18:44:27.013" Score="0" ViewCount="168" Body="&lt;p&gt;I am using matlab &lt;code&gt;xcorr&lt;/code&gt; to correlate simulated photon count data that has some Gaussian random noise set on top of it and it is working fine when the average value in the arrays is greater than one but when I split the arrays into enough bins such that most elements are zero (conserving the total photon count) and the average is much less than one photon per bin, suddenly the lags from &lt;code&gt;xcorr&lt;/code&gt; get much larger (relative to the total length even). For example, at one resolution the lag may be 10 while if I increase resolution ten times, the lags become ~500, much more than ten times the previous value. When I do this without any noise added it works very well, and I am thinking maybe because when the values are mostly zeros and ones and the rare two, any differences such as the xth bin being a one rather than a zero is a large percentage difference in the value and this leads to a large difference in the sums (~integrals) that xcorr calculates. Does anyone have any more knowledge or thoughts on whether this is correct or not?&lt;/p&gt;&#xA;" OwnerUserId="15588" LastEditorUserId="7092" LastEditDate="2015-04-24T19:52:15.150" LastActivityDate="2016-01-19T23:18:34.673" Title="Is there any reason that cross correlation would perform well or poorly on sparse binary arrays?" Tags="|matlab|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22971" PostTypeId="1" CreationDate="2015-04-24T19:45:24.433" Score="2" ViewCount="1151" Body="&lt;p&gt;I know about IIR filter as discrete pendent to transfer functions in the Laplace domain. So it is actually quite simple to convert the function of the control system and finally receive the discrete output vector. (Bilinear Transform...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, how about FIR filter? Can we use them  to approximate functions of control systems.&lt;/p&gt;&#xA;" OwnerUserId="11606" LastActivityDate="2016-08-22T20:44:18.443" Title="Do FIR filter have any application in control theory?" Tags="|discrete-signals|control-systems|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22972" PostTypeId="2" ParentId="22970" CreationDate="2015-04-24T19:47:23.313" Score="1" Body="&lt;p&gt;If you upsample your array to a resolution more than the time uncertainty, or measurement time quantization plus jitter noise, by just zero-filling between events in your event count data, you are adding high-frequency jitter noise that can interfere with correlation results.  You could try upsampling your arrays by using a Gaussian distribution of the appropriate width for each event, instead of just zero-padding between events.  Or, if you have a better statistical distribution for the measurement time offsets/errors, use that.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-24T19:47:23.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22974" PostTypeId="1" AcceptedAnswerId="22982" CreationDate="2015-04-24T20:13:42.497" Score="1" ViewCount="2627" Body="&lt;p&gt;I am new here. I hope I can get help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to ask a question regarding digital communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what are pulse shaping used for? Are they used for ISI mitigation or for something else? Also what is the receiver side of this operation is it matched filter?&lt;/p&gt;&#xA;" OwnerUserId="15590" LastActivityDate="2016-12-02T00:31:40.327" Title="Pulse Shaping in Digital communication" Tags="|digital-communications|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22975" PostTypeId="2" ParentId="22974" CreationDate="2015-04-24T20:53:08.893" Score="0" Body="&lt;p&gt;The main reason for using pulse shaping is that the bandwidth of the transmitted signal is the same as that of your pulse shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid ISI, you want your pulse shape to be orthogonal to time-shifted versions of itself. What this means is that, if your pulse shape is $p(t)$ and you're transmitting at rate $T_s$ pulses per second, you want $$\int_{-\infty}^{\infty} p(t-kT_s)p(t-lT_s)\,dt$$ to be 0 for all integers $k$ and $l$, $k\neq l$. It is convenient to choose $p(t)$ such that the integral is 1 when $k=l$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you transmit $Ap(t)$, then the received signal is $$r(t)=Ap(t)+n(t),$$ where $n(t)$ is random Gaussian noise. If you assume $p(t)$ is symmetrical (as is almost always the case in practice), then the matched filter has impulse response $p(t)$, and its output is $A+n,$ where $n$ is a Gaussian random variable of variance $\sigma_n^2$. The importance of the matched filter is that, among all possible filters, it maximizes the signal-to-noise ratio (SNR) $A^2/\sigma_n^2$. Since the bit error rate (BER) depends on the SNR, the matched filter minimizes the BER too.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-04-24T20:53:08.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22976" PostTypeId="2" ParentId="22893" CreationDate="2015-04-24T21:22:25.633" Score="2" Body="&lt;p&gt;I've had pretty good luck with using &lt;code&gt;OpenCV&lt;/code&gt;'s built-in &lt;a href=&quot;http://docs.opencv.org/modules/photo/doc/denoising.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fastNlMeansDenoisingColored&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14865" LastEditorUserId="14865" LastEditDate="2015-04-24T21:47:11.553" LastActivityDate="2015-04-24T21:47:11.553" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22979" PostTypeId="2" ParentId="22971" CreationDate="2015-04-25T05:54:58.870" Score="-1" Body="&lt;p&gt;FIR filters may be used to &quot;clean&quot; signals before they are processed by IIR. You would try to avoid noise from input the IIR, since it could lead to unstable states.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-04-25T05:54:58.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22980" PostTypeId="2" ParentId="22968" CreationDate="2015-04-25T07:03:04.253" Score="1" Body="&lt;p&gt;When you opens the polar plot in the figure editor you can find out that the coordinates around the plot are not from the axis.&#xA;It are hidden text objects (Press on one you see it). So this means you have to edit them by yourself. a work around for this is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure&#xA;t = 0:.01:2*pi;&#xA;polar(t,sin(2*t).*cos(2*t),'--r')&#xA;&#xA;hHiddenText = findall(gca,'type','text');&#xA;Angles = 0 : 30 : 330;&#xA;hObjToDelete = zeros( length(Angles)-4, 1 );&#xA;k = 0;&#xA;for ang = Angles&#xA;   hObj = findall(hHiddenText,'string',num2str(ang));&#xA;   switch ang&#xA;   case 0&#xA;      set(hObj,'string','0');&#xA;   case 30&#xA;      set(hObj,'string','-30');&#xA;   case 60&#xA;      set(hObj,'string','-60');&#xA;   case 90&#xA;      set(hObj,'string','-90');&#xA;   case 120&#xA;      set(hObj,'string','-120');&#xA;   case 150&#xA;      set(hObj,'string','-150');&#xA;   case 180&#xA;      set(hObj,'string','-180');&#xA;   case 210&#xA;      set(hObj,'string','-210');&#xA;   case 240&#xA;      set(hObj,'string','-240');&#xA;   case 270&#xA;      set(hObj,'string','-270');&#xA;   case 300&#xA;      set(hObj,'string','-300');&#xA;   case 330&#xA;      set(hObj,'string','-330');&#xA;   otherwise&#xA;      k = k + 1;&#xA;      hObjToDelete(k) = hObj;&#xA;   end&#xA;end&#xA;delete( hObjToDelete(hObjToDelete~=0) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want other directions etc i think you do that manually otherwise the plot start tot mess up.&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2015-04-25T07:03:04.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22981" PostTypeId="2" ParentId="22969" CreationDate="2015-04-25T07:19:53.923" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;Definitely yes. But after IFFT operation data block is CP extended before transmission.&lt;/li&gt;&#xA;&lt;li&gt;Each sample of OFDM symbol from the output of IFFT is weighted sum of all QAM/PSK modulated subcarriers from the input of IFFT.&lt;/li&gt;&#xA;&lt;li&gt;In the MIMO case all spatial-time algorithms are applied in the frequency domain. So in transmitter you should do encoding with QAM subcarriers &lt;em&gt;before&lt;/em&gt; IFFT and do the distinct IFFT for each spatial channel created. While in receiver you should do decoding &lt;em&gt;after&lt;/em&gt; FFT applied separately to each spatial channel again. By doing this you exploit the fact OFDM is multiplexing of the large number (actually &lt;em&gt;M&lt;/em&gt;) of narrow band channels and by appropriate processing (actually &lt;em&gt;FFT/IFFT pair and CP insertion technique&lt;/em&gt;) we can treat each subcarrier as narrow band. It is very useful in the case of MIMO because MIMO decoding algorithms are much too simpler when dealing with narrow band (so &lt;em&gt;flat fading&lt;/em&gt; channel is the case) and for each subcarrier we can define simple MIMO matrix of weights $[W_{ij}]$. That's why OFDM + MIMO is so popular combination today.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-04-25T07:19:53.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22982" PostTypeId="2" ParentId="22974" CreationDate="2015-04-25T07:51:14.260" Score="1" Body="&lt;p&gt;As you've told the main goal of pulse shaping filter is to restrict signal bandwidth in the transmitter while in receiver you should place the matched filter to maximize SNR. In the practical modems pulse shaping filter in the transmitter and matched filter in the receiver are usually the same in terms of frequency response. The task is to choose filters to minimize ISI (not all TX-RX filters pairs satisfy this condition while if even maximizing SNR value). From the theory is known raised cosine filter satisfy ISI condition. You can read about this filter &lt;a href=&quot;http://en.wikipedia.org/wiki/Raised-cosine_filter&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Let's place such a filter in TX and RX side:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{system} = H_{Tx} * H_{Rx}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see the total response of the system is no longer raised cosine. So the &lt;em&gt;root&lt;/em&gt; raised cosine filter was &lt;a href=&quot;http://en.wikipedia.org/wiki/Root-raised-cosine_filter&quot; rel=&quot;nofollow&quot;&gt;proposed&lt;/a&gt;. The main idea is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{rrc} = \sqrt{H_{rc}}$, so for our system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{system} = H_{Tx} * H_{Rx} = H_{rrc} * H_{rrc} = (\sqrt{H_{rc}})^2 = H_{rc}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By doing this we can minimize ISI and maximize SNR if the filter bandwidth is closely matched to signal's one. So it is very practical and widely used in digital modems (especially single carriers (SC) modems).&lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-04-25T07:51:14.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22985" PostTypeId="1" AcceptedAnswerId="23178" CreationDate="2015-04-25T11:40:55.133" Score="2" ViewCount="190" Body="&lt;p&gt;I'm trying to change this filter transfer function to state space representation  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$  y_t=\frac{1+b_1 z^{-1}}{1+a_1 z^{-1} +a_2 z^{-2}}u_t  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried writing it as time series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$  y_t+a_1 y_{t-1}+a_2 y_{t-2}=u_t+b_1 u_{t-1}  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is where I am not sure how to continue, I wrote an expression &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x_t=\frac{1}{1+a_1 z^{-1}+a_2 z^{-2}}u_{t-1} $    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ y_t=(1+b_1z^{-1})x_{t+1}=x_{t+1}+b_1x_t  $  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ (1+a_1 z^{-1} +a_2 z^{-2})x_t=u_{t-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea was to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x_t=u_{t-1}-a_1x_{t-1}-a_2x_{t-2} $               $ (1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x_{t+1}=u_{t}-a_1x_{t}-a_2x_{t-1}  $              $(2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;renaming&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x_{t+1}=x_{a,t+1} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x_{t}=x_{b,t+1}  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and write my state equations as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \begin{bmatrix} x_{a,t+1}\\ x_{b,t+1}\end{bmatrix}=\begin{bmatrix} -a_1 &amp;amp;&amp;amp; -a_2\\ 1&amp;amp;&amp;amp;0\end{bmatrix} \begin{bmatrix} x_{a,t}\\ x_{b,t}\end{bmatrix} +\begin{bmatrix} 1\\ 0\end{bmatrix}u_t$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from (2) my states are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x_{a,t}=x_t $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x_{b,t}=x_{t-1}  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my problem comes when I want to state my output equation, which is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ y_t=x_{t+1}+b_1x_t  $  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but   $ x_{t+1} $    is not one of my states so I'm not being able to express my output equation in terms of $x_{a,t}$ and $x_{b,t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any hint on where I am making the mistake, thanks for your help.&lt;/p&gt;&#xA;" OwnerUserId="15598" LastActivityDate="2015-05-04T19:38:14.340" Title="State Space representation" Tags="|state-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22987" PostTypeId="1" AcceptedAnswerId="22989" CreationDate="2015-04-25T12:34:46.847" Score="1" ViewCount="1658" Body="&lt;p&gt;I know that a matched filter at time t0 is just the input signal reversed in time about that time. But how does the filter know about input signal. Received signal is transmitted signal plus the noise and if filter already has knowledge about input signal then why is there any need of filtering? You already know the input signal!&lt;/p&gt;&#xA;" OwnerUserId="15600" LastActivityDate="2015-04-25T16:04:14.183" Title="How does a matched filter know about input signal beforehand?" Tags="|matched-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="22989" PostTypeId="2" ParentId="22987" CreationDate="2015-04-25T13:22:08.187" Score="2" Body="&lt;p&gt;A matched filter is used when the shape of the &quot;desired&quot; part of the received signal is known. Under the &lt;a href=&quot;http://en.wikipedia.org/wiki/Additive_white_Gaussian_noise&quot; rel=&quot;nofollow noreferrer&quot;&gt;additive white Gaussian noise (AWGN) channel&lt;/a&gt;, a matched filter is the optimal detection scheme in the maximum-likelihood sense. This is a commonly-modeled case, so matched filtering is a typical signal-processing operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your question, I think you're misunderstanding what a matched filter is: it doesn't require full knowledge of the exact transmitted signal. Instead, it helps to sift out the transmitted signal from the noise that is received with it, allowing the receiver to make more accurate decisions on what was actually transmitted.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Consider a baseband communication system that transmits a rectangular pulse with amplitude $1$ to communicate a zero and $-1$ to communicate a one. The appropriate matched filter in this case would be a rectangular pulse that matches the shape that is used by the receiver. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When the train of transmitted rectangular pulses is passed through the receiver's rectangular matched filter, the result is a train of triangular pulses (the autocorrelation of a rectangular pulse is a triangle pulse). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The receiver then makes symbol decisions based on the amplitudes of the triangular peaks that it observes. At this point, the SNR is maximized, as the matched filter tends to pass the signal of interest while averaging out any additive noise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is a simple, but representative example. The matched filter doesn't carry any of the transmitted information in itself (as you noted, that would be nonsensical); instead, it is used as an optimal means of extracting the transmitted information from the observed waveform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also call your attention to &lt;a href=&quot;https://dsp.stackexchange.com/questions/9094/understanding-matched-filter/9389#9389&quot;&gt;this very good answer&lt;/a&gt; to a previous question about matched filters. It contains many of the diagrams that would make the above discussion easier to understand but I didn't have time to produce. It's a great resource for additional details.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-04-25T16:04:14.183" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="22990" PostTypeId="2" ParentId="22949" CreationDate="2015-04-25T13:33:48.347" Score="1" Body="&lt;p&gt;You know the geometric series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{\infty}r^n=\frac{1}{1-r},\quad |r|&amp;lt;1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to convergence of (1) (for $|r|&amp;lt;1$) you can take the derivative with respect to $r$ by taking the element-wise derivatives of the left-hand side. Equating the derivatives of both sides of (1) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{\infty}nr^{n-1}=\sum_{n=1}^{\infty}nr^{n-1}=\sum_{n=0}^{\infty}(n+1)r^n=\frac{1}{(1-r)^2},\quad |r|&amp;lt;1\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $r=az^{-1}$ you get the following $\mathcal{Z}$-transform relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(n+1)a^nu[n]\Longleftrightarrow \frac{1}{(1-az^{-1})^2}=\frac{z^2}{(z-a)^2}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u[n]$ is the unit step sequence.&#xA;With the time-shifting property of the $\mathcal{Z}$-transform (see &lt;a href=&quot;http://en.wikipedia.org/wiki/Z-transform#Properties&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;) you get the following pair:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(n-1)a^{n-2}u[n-2]\Longleftrightarrow \frac{1}{(z-a)^2}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With (4) you immediately get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{5}{(z-2)^2}\Longleftrightarrow 5(n-1)2^{n-2}u[n-2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, all of this is only valid inside the region of convergence, i.e. for $|z|&amp;gt;a=2$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-25T13:33:48.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="22992" PostTypeId="2" ParentId="22969" CreationDate="2015-04-25T16:27:13.113" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes. &lt;a href=&quot;http://www.lte-bullets.com/LTE%20in%20Bullets%20-%20Cyclic%20Prefix.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cyclic Prefix&lt;/a&gt; and windows(prefix and postfix for pulse shaping) are added to the OFDM symbol, but windows are only for overlap-and-add for &lt;a href=&quot;http://www.ieee802.org/3/bn/public/jan13/montreuil_01a_0113.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;pulse shaping&lt;/a&gt;, so the effective length is M+CP_length only. I've mentioned Windowing since it is an important thing to take into consideration if you want to design and test an OFDM transmitter. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Each OFDM sample is the IFFT of the corresponding column of Resource Elements or in other words weighted sum of modulated subcarriers as @Serj put it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A clear understanding of the sequence of codeword generation-&gt;Layer Mapping-&gt;Precoding is required to get big picture of LTE MIMO. &lt;a href=&quot;http://lteuniversity.com/get_trained/expert_opinion1/b/donhanley/archive/2011/09/20/codewords-and-layers-and-ports-oh-my.aspx&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; documents explains this sequence well. It's a little complicated as this trio-sequence is different for different channels(for example Layer Mapping and Precoding schemes for Broadcast channel and Shared or Data channel can be completely different within a single frame). If you want to know the finer details of this sequence you will have a take a look at &lt;a href=&quot;http://www.etsi.org/deliver/etsi_ts/136200_136299/136211/10.00.00_60/ts_136211v100000p.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;3GPP 36.211 spec&lt;/a&gt; from section 6.3.3 onwards. The following is the block diagram which depicts this sequence in a LTE transmitter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ltMUT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Antennae Mapping depends on the &lt;a href=&quot;http://www.sharetechnote.com/html/Handbook_LTE_TransmissionMode.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transmission Mode&lt;/a&gt; being used. The following table should give some clarity on this process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qlZ7L.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-04-25T16:27:13.113" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="22993" PostTypeId="1" AcceptedAnswerId="22994" CreationDate="2015-04-25T17:12:14.020" Score="1" ViewCount="307" Body="&lt;p&gt;Exactly why using the of windowing function, such as Hamming or Blackman, causes a slower transition to stop band? Everywhere it is mentioned just as an obvious fact that this happens but I haven't found a text that mentions what is the cause.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example for what I mean:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An FIR low-pass filter designed with cut off frequency 1 Hz without a window function reaches stop band at little over this frequency (1.04 Hz or so).&lt;/li&gt;&#xA;&lt;li&gt;When window function is applied, the filter reaches the stop band at over 1.2 Hz&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, is there a way to compensate for this? For example, if I really want the cut off frequency to be 1 Hz and use window function, should I design the filter to have cut off say 0.9 Hz?&lt;/p&gt;&#xA;" OwnerUserId="15602" LastActivityDate="2015-04-25T17:27:58.623" Title="What is the cause of slow roll off of windowed filters" Tags="|filters|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22994" PostTypeId="2" ParentId="22993" CreationDate="2015-04-25T17:27:58.623" Score="2" Body="&lt;p&gt;A (non-full-width-rectangular) window attenuates data at its edges, thus narrowing the width (decreasing the 1st moment) of the bulk hump of the input.  Decreasing width in the time domain increases uncertainty in the frequency domain, which is represented by a filter response which has a shallower transition band stretching farther from the center frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to roughly compensate is to start with a wider data window (longer FIR), which when &quot;narrowed&quot; by a non-rectangular window function will constitute roughly the same bulk &quot;width&quot; as before the widening.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-04-25T17:27:58.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="22995" PostTypeId="1" AcceptedAnswerId="33921" CreationDate="2015-04-25T19:57:58.050" Score="6" ViewCount="2591" Body="&lt;p&gt;I try to run text cleaning process based on the camera captured image.&lt;/p&gt;&#xA;&lt;p&gt;By using OpenCV adaptive threshold method with parameter &lt;code&gt;(255.0D, AdaptiveThresholdType.MeanC, ThresholdType.Binary, 15, 10.0D)&lt;/code&gt;, almost all gives satisfactory output but below example gives poor cleaning result (background is not removed well).&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3J1CU.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;(Image from &lt;a href=&quot;http://www.fmwconcepts.com/imagemagick/textcleaner/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fred's ImageMagick Scripts - Text Cleaner&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question 1.&lt;/strong&gt; I'd like to know which factor cause poor result in this example.&lt;/p&gt;&#xA;&lt;p&gt;My &lt;strong&gt;Question 2&lt;/strong&gt; is, which approach can discriminate my attempt(OpenCV) is &lt;em&gt;failed&lt;/em&gt; based on the above result? Or, which approach can help to decide whether AdaptiveThreshold will fail or not before running it?&lt;/p&gt;&#xA;&lt;p&gt;IMO, the pass/fail factor can be a number of background particles but I don't know how to measure it.&lt;/p&gt;&#xA;&lt;p&gt;I tried Erode method in OpenCV to remove particles, but it gave over whitened result and made too skinny text.&lt;/p&gt;&#xA;" OwnerUserId="15603" LastEditorUserId="7092" LastEditDate="2021-09-09T11:23:26.897" LastActivityDate="2021-09-09T11:23:26.897" Title="What Is the Cause for Poor Results with Adaptive Thresholding?" Tags="|image-processing|computer-vision|opencv|thresholding|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="22996" PostTypeId="2" ParentId="22306" CreationDate="2015-04-26T05:11:43.883" Score="-1" Body="&lt;p&gt;ok, what I would do is, first take an autocorrelation of the give signal. you get the peaks(due to similar signal element overlap), find the time period by seeing the time scale difference of similar peaks.use the corresponding frequency to filter out the different signals.&#xA;does that help?&lt;/p&gt;&#xA;" OwnerUserId="15319" LastActivityDate="2015-04-26T05:11:43.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23000" PostTypeId="2" ParentId="22956" CreationDate="2015-04-26T12:30:31.310" Score="3" Body="&lt;p&gt;1) A Fourier serie is written as $$\frac {a_0} 2 + \sum \limits _{m=1} ^\infty (a_m \cos \frac {2 \pi m t} T + \mathbf{i} \, b_m \sin \frac {2 \pi m t} T)$$&#xA;Unless your signal is even, i.e. $f(-t)=f(t)$ the fourier decomposition will have a real (cosine) part and an imaginary (sine) part. The middle bottom plot is more likely to be the power spectral density i.e. the fourrier transform's squared modulus. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Indeed, the Fourrier basis is a orthonormal basis, in a mathematical sense. &#xA;$$&#xA;\zeta _m(t)=\cos \frac {2 \pi m t} T + i \, \sin \frac {2 \pi m t} T&#xA;$$&#xA;$$&#xA;\int_{0}^{T}{\zeta _k(t)\zeta _l(t) \, dt}=\delta _{kl} %\quad \forall k,l\in[0,T-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two conclusions above still holds in the 2D case simply use as basis functions:&#xA;$$&#xA;\zeta _{u,v}(x,y)=e^{-i2\pi(ux+vy)}&#xA;$$&#xA;Define an image $f(x,y)$ and it's Fourier transform :&#xA;$$&#xA;F(u,v)=\int \int f(x,y) \zeta _{u,v} \, d x d y&#xA;$$&#xA;$F(u,v)$ isn't real unless $f(x,y)$ is even respect to $x$ and even respect to $y$, and so when building the Fourier transform's representatio, it is more likely that the represented value is the Fourier transform's squared modulus.&#xA;In the 2D case, Fourier's basis function still form a basis, it is complicated to define a base in a functional space. The two main things to note are :&#xA;First, the scalar product between basis functions $\zeta _{u_1,v_1}$ and $\zeta _{u_2,v_2}$ is always equal to 0 unless $u_1=u_2$ and $v1=v_2$ then it is equal to 1 (orthonormality). One must then prove that every function $f(x,y)$ is uniquely writtable as a linear combinaison of $\zeta _{u,v}$'s. It is true for periodic function, but I can't provide you the demonstration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I let you check the definition of a &lt;a href=&quot;http://mathworld.wolfram.com/VectorSpaceBasis.html&quot; rel=&quot;nofollow&quot;&gt;basis for a vector space&lt;/a&gt;, if you understand it it will give you a good grasp of what is a basis in general.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastEditorUserId="13315" LastEditDate="2015-04-26T18:36:27.463" LastActivityDate="2015-04-26T18:36:27.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23001" PostTypeId="2" ParentId="22160" CreationDate="2015-04-26T12:42:31.080" Score="0" Body="&lt;p&gt;First, there is for sure a poor up-down sampling / interpolation that cause some aliasing. &#xA;I don't know for the wild superimposed texture. My guess would be a bad inverse radon transform, but it is very unlikely in a photography context ... Maybe it is  compression artifact from a ridgelet transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/b0KqY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Area 2 is clearer than it should be while right and left side are darker, as if mean along columns had corrupted every rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In area 1 we can see line shaped artifacts, it makes me think about radon &#xA;transform stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a clear loss of contrast&lt;/p&gt;&#xA;" OwnerUserId="13315" LastEditorUserId="13315" LastEditDate="2015-04-26T18:52:56.073" LastActivityDate="2015-04-26T18:52:56.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23004" PostTypeId="2" ParentId="22956" CreationDate="2015-04-26T17:03:54.607" Score="3" Body="&lt;h1&gt;My doubt is whether these waves means cosine (or sine) functions from the Fourier series formula?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Here the part of source code from the description of the video on youtube. (I have cut a small part of it and have written some comments for sake of clarity):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Read initial image.&#xA;I = imread('cameraman.tif');&#xA;...&#xA;% Calculate amplitudes of frequency components.&#xA;FT_I = fftn(I);&#xA;ABS_FT_I = abs(FT_I);&#xA;&#xA;% Initialize some global variables.&#xA;FT_new = zeros(size(FT_I));&#xA;FT_cur = zeros(size(FT_new));&#xA;newIm  = zeros(size(FT_new));&#xA;...&#xA;% Demo loop.&#xA;n = 1; &#xA;nWaves = 1;&#xA;while n &amp;lt; % termination condition here.&#xA;&#xA;    % Choosing values of demo's parameters.&#xA;    if n &amp;gt; 20;   nWaves = 10;   end&#xA;    if n &amp;gt; 200;  nWaves = 100;  end&#xA;    if n &amp;gt; 2000; nWaves = 1000; end&#xA;&#xA;    % Nullify global temporary variable.&#xA;    FT_cur = 0*FT_cur&#xA;&#xA;    % Accumulate 'extracted waves' in frequency domain.&#xA;    for p = 1:nWaves*2&#xA;&#xA;        % Find indices of frequency components with max amplitude.&#xA;        [a,b] = find(ABS_FT_I == max(ABS_FT_I(:)), 1, 'first');&#xA;        ABS_FT_I(a,b) = 0;&#xA;&#xA;        % Append them to the temporary buffer.&#xA;        FT_cur(a,b) = FT_I(a,b);&#xA;    end&#xA;&#xA;    % Create 'extracted waves' in spatial domain.&#xA;    I_cur = ifftn(FT_cur);&#xA;&#xA;    % Concatenate all parts of an video frame.&#xA;    canvas = cat(2, real(I - newIm - I_cur), zeros(size(I)), newIm);&#xA;    canvasShow = canvas;&#xA;    canvasShow(:,1:N(2)) = canvasShow(:,1:N(2)) + I_cur;&#xA;    subplot(2,1,2); &#xA;&#xA;    % Plot the real part of the video frame.&#xA;    % And as result the real part of 'extracted waves'.&#xA;    imagesc(real(canvasShow), viewRange); &#xA;    ...&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to source code, the &lt;code&gt;plot of extracted waves&lt;/code&gt; is the real part of the Inverse Fourier Transform of the sum of &lt;code&gt;nWaves&lt;/code&gt; spectral components $F(s,t)$ with maximum amplitude:&#xA;\begin{equation}&#xA;f(x,y) = \frac{1}{NM}\sum\limits_{s,t\in U}Re\big(F(s,t)e^{2\pi i(sx/N + ty/M)}\big)&#xA;\end{equation}&#xA;where $f(x,y)$ is the value of the $(x,y)$ pixel of the &lt;code&gt;extracted waves&lt;/code&gt; image in the spatial domain, $F(s,t)$ is the value of the $(s,t)$ component in the frequency domain, $U$ is first &lt;code&gt;nWaves&lt;/code&gt; frequency components with $\max|F(s,t)|$.&#xA;So these waves aren't cosine nor sine. &lt;em&gt;They are non trivial linear combination of sine and cosine waves&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;What are basis functions (images) and Whether the plot of Extracted waves are called as basis functions in mathematics?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;It's hard to tell without knowing the procedure, that have been used to create those images. &lt;em&gt;But if the procedure is the same as in the video presentation, then it isn't technically correct to call those images Basis Functions.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="6961" LastEditorUserId="6961" LastEditDate="2015-04-27T08:07:45.083" LastActivityDate="2015-04-27T08:07:45.083" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23005" PostTypeId="1" AcceptedAnswerId="23007" CreationDate="2015-04-26T17:10:51.757" Score="2" ViewCount="725" Body="&lt;p&gt;While reading Bernard Sklar's Digital Communications book I've got confused with &lt;em&gt;ISI Nyquist criterion&lt;/em&gt; (not Nyquist rate criterion). There is stated (Sklar, 3.3 section) for symbol rate $R_s$ minimum bandwidth $W = R_s/2$ and for practical cases we have equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$W = 1/2 \cdot (R_s + r \cdot R_s)$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $r = 0...1$. So theoretically we have 2 symbols per Hz. For BPSK it is 2 bits/s per Hz. For QAM-64 it is 12 bits/s per Hz. So this statement I can't understand, because through my practice I used to think if we use BPSK and we want to achive e.g. 6 Mbps we need to allocate about 6 MHz of bandwidth (actually more because of rounding and synchronization/code redundancy). Where is my mistake in understanding of Nyquist theory?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upd. Here is the picture from the book, where Nyquist channel is pictured&#xA;&lt;img src=&quot;https://i.stack.imgur.com/7pcr9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems the bandwidth of such a channel is calculated from $0$ to $1/2T$ and negative frequencies are neglected. Why in the baseband case we need to determine bandwidth in such a way? This can be an answer for the question above.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="4298" LastEditDate="2017-12-11T09:22:03.120" LastActivityDate="2017-12-11T09:22:03.120" Title="ISI Nyquist criterion and spectral efficiency" Tags="|digital-communications|nyquist|spectral-efficiency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23007" PostTypeId="2" ParentId="23005" CreationDate="2015-04-26T18:03:12.503" Score="3" Body="&lt;p&gt;I don't have Sklar's text but I guess he is referring to the &lt;em&gt;baseband&lt;/em&gt; case. For bandpass signals the required bandwidth is doubled. So in the bandpass case you get a maximum spectral efficiency of 1 bit/s/Hz for BPSK, and $\log M$ bits/s/Hz for $M$-ary QAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as a side note, spectral efficiency is measured in bits/s/Hz (and not in bits/Hz as you seem to suggest). &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-26T18:03:12.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23008" PostTypeId="1" AcceptedAnswerId="23010" CreationDate="2015-04-26T19:22:23.263" Score="0" ViewCount="2318" Body="&lt;p&gt;Can you please help me with some ideas on how to implement an FIR filter in Matlab using Parks-Mclellan algorithm? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My specifications are the passband cut-off frequency, the transition bandwidth. The I also have the passband ripple, which is an alternating value $ \delta_p=\pm0.2$ and the stopband ripple $\delta_s$. This because the weigth in the stopband frequency range comes from: $ \rho(\omega)=\delta_p/\delta_s$. The design using firpm should meet these specifications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two troubles: The first one is that I have to find the optimal minimum order of the filter N to get the desired  design without using any Matlab builtin function (I saw there is one called firpmord, but again I can't use it), so I imagine I need some kind of iteration but don't know how to put this in code. Also can't find a way to account for the alternating ripple to use it in my calculations. I'm just looking for some advice on how to achieve this.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just starting, trying to catch it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;&#xA;wp=0.1;&#xA;w_tr=0.3;&#xA;w_stop=1;&#xA;Gp=1;&#xA;dp=0.2; % this should be plus minus&#xA;ds=0.05; &#xA;N=100&#xA;h=firpm(N,[0 wp w_tr w_stop],[Gp Gp 0 0],[1,dp/ds])&#xA;[h_m,w]=freqz(h,1);&#xA;semilogy(w,abs(h_m));&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="15598" LastEditorUserId="15598" LastEditDate="2015-04-26T19:58:17.547" LastActivityDate="2015-04-26T20:35:10.530" Title="FIR design using firpm (Parks-Mclellan)" Tags="|filter-design|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23010" PostTypeId="2" ParentId="23008" CreationDate="2015-04-26T20:35:10.530" Score="1" Body="&lt;p&gt;First of all make sure that your $\delta_p$ value is linear (and not in dB). The function &lt;code&gt;firpm&lt;/code&gt; needs a linear value. Don't worry about the passband error ripple having both signs; the value of $\delta_p$ used to compute the weighting function is just the maximum error magnitude, which is $0.2$ in your case. So you correctly defined the stopband weight by $0.2/0.05=4$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is if you need to write an algorithm that automatically finds the necessary filter order, or if you can just try to find the order manually. If you need an automatic procedure you could use the second output argument of &lt;code&gt;[h,err]=firpm(...)&lt;/code&gt;, which is the maximum approximation error. You could design filters with increasing orders in a loop until the error returned as a second argument from &lt;code&gt;firpm&lt;/code&gt; is smaller than the desired value for $\delta_p$ (because the approximation error equals weight times deviation, and since you chose the passband weight to be $1$, the error equals $\delta_p$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, note that the stopband edge equals the passband edge &lt;em&gt;plus&lt;/em&gt; the transition bandwidth. So if the transition bandwidth is really $0.3$, as in your example, then the stopband edge would be the cut-off frequency (passband edge) plus $0.3$ (which equals $0.4$ in your example). These specifications are extremely mild and can be satisfied by a filter of very low order.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-26T20:35:10.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23011" PostTypeId="1" CreationDate="2015-04-27T06:44:07.193" Score="0" ViewCount="155" Body="&lt;p&gt;Assume a random sequence &#xA;$&#xA;Y_k  = X_k  \cdot H_k  + W_k &#xA;$&#xA; where $X_k$ is a deterministic quantity, $H_k$ is a correlated random sequence, $W_k$ is Additive White Gaussian random sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we decompose/rewrite the above sequence into a form like below?&#xA;$&#xA;Y_k  = X_k  \cdot \hat H_k  + X_k  \cdot \tilde H_k  + W_k &#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\hat H_k $ is deterministic/white and $\tilde H_k$ is correlated random - something like that? &lt;/p&gt;&#xA;" OwnerUserId="10681" LastActivityDate="2015-04-27T10:52:03.230" Title="Can we decompose a correlated random variable into correlated plus uncorrelated?" Tags="|noise|correlation|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23013" PostTypeId="2" ParentId="23011" CreationDate="2015-04-27T10:52:03.230" Score="1" Body="&lt;p&gt;Using Karhunen-loève expansion (principal component analysis) on a centered stochastic process $X_k$ you will get :&#xA;$$&#xA;X_k=\sum_{i=1}^{N}Z_ie_i(k) \quad k\in[1,N]&#xA;$$&#xA;Where $N$ is the process's length and $e_i$ are the $N$ eigenvectors of length $N$ from ACP. The $Z_i$ will be uncorrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure it is answering your question, I advise you to ask this on cross validated.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-27T10:52:03.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23014" PostTypeId="2" ParentId="22160" CreationDate="2015-04-27T11:07:24.147" Score="2" Body="&lt;p&gt;Looking at it, my thought is that the top image has been printed out (onto poor quality paper), then later scanned.  The artefacts would then be a mixture of paper texture and poor printing.  It could also include ink transfer from the facing page (if part of a book or newspaper, and/or bleed-through from something printed on the back of the paper.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-04-27T11:07:24.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23015" PostTypeId="1" AcceptedAnswerId="23016" CreationDate="2015-04-27T12:32:58.113" Score="5" ViewCount="8464" Body="&lt;p&gt;I am really confused with matlab's periodogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, it says in the documentation that its unit is &quot;dB per unit frequency&quot;. What does that really mean? I just don't quite get it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second of all, I'm trying to evaluate an ADC. I tried to measure its linearity but that won't work because when I reduce the level of the input signal by ,let's say, -3dB I excpect to see -3dB reduction in the highest peak of the spectrum, but that's not the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last but not least, with this &quot;dB per unit frequency&quot; when is the highest peak actually 0 dB? It should reach that at a point, right? Because as far as I know dB is always a ratio of some kind. How can I modify it as to give me the values in dBFs for example? so I could get a sense of what my data look like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long post, Mathworks' Periodogram just doesn't say it clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you all. &lt;/p&gt;&#xA;" OwnerUserId="15618" LastActivityDate="2015-04-30T11:13:33.683" Title="Is it only me or matlab's periodogram's function is confusing?" Tags="|matlab|fft|frequency-spectrum|power-spectral-density|dbfs|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23016" PostTypeId="2" ParentId="23015" CreationDate="2015-04-27T12:58:15.583" Score="7" Body="&lt;p&gt;As the &lt;a href=&quot;https://www.mathworks.com/help/signal/ref/periodogram.html&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; states, &lt;code&gt;periodogram&lt;/code&gt; provides a &lt;em&gt;power spectral density&lt;/em&gt; estimate &lt;code&gt;pxx&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[pxx, w] = periodogram(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;meaning that it shows how the total variance of the signal, &lt;code&gt;var(x)&lt;/code&gt;, is &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_density#Properties_of_the_power_spectral_density&quot; rel=&quot;nofollow&quot;&gt;distributed&lt;/a&gt; over the frequency &lt;code&gt;w&lt;/code&gt;. This implies that the integral of the estimated spectral density over the frequency axis&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;trapz(w, pxx)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should correspond to that total variance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also means that the psd is not normalized, neither to a total variance of 1, nor to a maximum peak of 1 (= 0 dB). That the result is plotted (not computed!) in dB merely means that the vertical axis shows $10 \, \log_{10}($ &lt;code&gt;pxx&lt;/code&gt; $)$, not that it shows a ratio. There is therefore no reason to expect a peak to align with 0 dB; depending on the range of values of the signal it can be both much higher and much lower.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To produce a plot from &lt;code&gt;pxx&lt;/code&gt; and &lt;code&gt;w&lt;/code&gt;, use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(w, 10 * log10(pxx))&#xA;xlabel('normalized frequency   [rad / sample]')&#xA;ylabel('power spectral density   [(rad/sample)^{-1}] in dB')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reducing the level of the total signal by 3 dB means to divide the signal &lt;code&gt;x&lt;/code&gt; by a factor of 2. If you do this numerically&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;periodogram(x)&#xA;hold all&#xA;periodogram(x / 2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you will see that the second psd estimate has exactly the same shape as the first, it's just 3 dB lower. If this is not what you find with your measurement data, then this means that either your volume regulation or your ADC do not work correctly.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you are really sure you want a normalized spectrum, do the following: First, compute the psd estimate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[pxx, w] = periodogram(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, normalize the psd, e.g. with respect to the highest peak:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;npxx = pxx / max(pxx);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then plot the &lt;em&gt;normalized psd&lt;/em&gt; on a logarithmic scale like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(w, 10 * log10(npxx))&#xA;xlabel('normalized frequency   [rad / sample]')&#xA;ylabel('normalized power spectral density')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;code&gt;npxx&lt;/code&gt; does not have a unit.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A note about units: The unit of numbers returned as &lt;code&gt;pxx&lt;/code&gt; by &lt;code&gt;periodogram&lt;/code&gt; &amp;amp; friends depends on the units of the input signal  &lt;code&gt;x&lt;/code&gt;. Let's say these are dimensionless numbers; then the unit of the numbers in the &lt;code&gt;pxx&lt;/code&gt; output is $\rm \frac{1}{rad / sample}$, because it is a density over &lt;code&gt;w&lt;/code&gt; which is in units of $\rm rad / sample$. Or let's say these are voltage measurements coming from a calibrated ADC, so that the numbers in &lt;code&gt;x&lt;/code&gt; are in volts. Then the unit of the numbers in the &lt;code&gt;pxx&lt;/code&gt; output is $\rm \frac{V^2}{rad / sample}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you additionally specify the sampling frequency in the call to periodogram:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[pxx, f] = periodogram(x, [], [], fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and &lt;code&gt;fs&lt;/code&gt; is in Hz, the &lt;code&gt;pxx&lt;/code&gt; is a density over frequency &lt;code&gt;f&lt;/code&gt;, and its unit is $\rm \frac{V^2}{Hz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if &lt;code&gt;pxx&lt;/code&gt; is plotted, it is often plotted logarithmically, like stated above. If the function $10 \log_{10}$ is used, then it is said that the result is in decibel, dB. Then sometimes the unit of &lt;code&gt;10 * log10(pxx)&lt;/code&gt; is written as $\rm \frac{dB}{rad / sample}$. Strictly speaking, this expression doesn't make sense because dB is not just a unit (a different measurement stick) but denotes the use of a different quantity: the logarithm. That's why above I wrote the unit as &lt;code&gt;[(rad/sample)^{-1}] in dB&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5834" LastEditorUserId="5834" LastEditDate="2015-04-30T11:13:33.683" LastActivityDate="2015-04-30T11:13:33.683" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23017" PostTypeId="1" CreationDate="2015-04-27T18:09:03.833" Score="0" ViewCount="610" Body="&lt;p&gt;I have two questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the difference between 2D and 3D medical images?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assume I have a 2D image and for example it contains 1000 ROIs. Each ROI is a matrix and we can convert it to a vector.&lt;/p&gt;&#xA;&lt;p&gt;When we have a 3D image how can I divide it to ROIs (what will be ROIs) and how can I convert every ROI to a vector?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15620" LastEditorUserId="-1" LastEditorDisplayName="user11906" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2018-11-24T14:02:05.403" Title="Differences between 2D and 3D medical Images" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23018" PostTypeId="1" AcceptedAnswerId="23020" CreationDate="2015-04-27T18:10:54.997" Score="3" ViewCount="1046" Body="&lt;p&gt;My question is easy one actually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I generate a random signal using &lt;code&gt;randn()&lt;/code&gt; function of MATLAB like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HLs9U.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I design a FIR filter of order 200 of pass-band characteristics with the pass-band $[0.2\pi, 0.4\pi]$ using the MATLAB function &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/fir2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;fir2()&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/waQff.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What am I supposed to see when I filter a random signal using BPF?  &lt;/li&gt;&#xA;&lt;li&gt;What change in the characteristics will be occur considering the theory? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12045" LastEditorUserId="1629" LastEditDate="2016-05-21T08:37:22.330" LastActivityDate="2016-05-21T08:37:22.330" Title="Filtering random Signal" Tags="|matlab|filters|statistics|random|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23020" PostTypeId="2" ParentId="23018" CreationDate="2015-04-27T18:38:31.807" Score="4" Body="&lt;p&gt;The output signal will still be normally distributed, but its power spectrum, i.e. its frequency content, will obviously be different from the input signal. If $S_X(\omega)$ is the power spectrum of the input signal, which is approximately flat, then the power spectrum of the output signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_Y(\omega)=|H(\omega)|^2S_X(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(\omega)$ is the frequency response of the filter.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-27T18:38:31.807" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23021" PostTypeId="2" ParentId="23018" CreationDate="2015-04-27T18:56:05.673" Score="2" Body="&lt;p&gt;You will be creating a random band-pass signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are &lt;em&gt;supposed to see&lt;/em&gt; for such a signal if you plot the time sequence, is a varying sinusoid of frequency $0.3 \pi$ (midpoint of the pass band). Amplitude and phase will vary randomly, depending on the signal bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, $0.2 \pi$ bandwidth is quite large compared to the &lt;em&gt;carrier frequency&lt;/em&gt; of $0.3 \pi$, so the result should look quite erratic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a smaller bandwidth, amplitude and phase will vary more smoothly.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-04-27T18:56:05.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23022" PostTypeId="1" CreationDate="2015-04-27T21:12:40.810" Score="0" ViewCount="789" Body="&lt;p&gt;I'm implementing a 80-72-64-48 multi pass moving average filter for a embedded system in C and in fixed point. The implementation is a circular buffer where i'm keeping a running sum and calculating &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = y[n-1] + x[n] - x[n-M] $$ where $M$ is the length of a filter. This is done for each subfilter with the output from one serving as the input for another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm scaling my coefficients by $2^{15}$ which gives me coefficients of length $2^{9}$ or $2^{10}$ depending on the filter length. Then the result is scaled down again by $2^{-15}$ to get the correct output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, everything looks good on short time scales but over long times i get a drift. The reason for the recursive implementation is to save calculations on a embedded processor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have included image of some of the internals of my filter, this is when a step response is applied and we can see the transfer functions of the filters taking shape, square, triangle, then approximating a gaussian so the filter is working as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WSsXV.jpg&quot; alt=&quot;Internals&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is my problem, the  drift &#xA;&lt;img src=&quot;https://i.stack.imgur.com/mHFZR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to fix this, and where is the most likely source of this?, is this drift due to a bit getting lost in the shifting or something else. The drift is not present for DC inputs, but for AC signals it slowly drifts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SOLUTION: The problem was in the accumulator as robert suggested in the comments. The issue was that one element of the calculation had gone through an extra up and down shift compared to the rest, which created a round offset that accumulated.&lt;/p&gt;&#xA;" OwnerUserId="15624" LastEditorUserId="15624" LastEditDate="2015-04-28T14:03:47.997" LastActivityDate="2015-04-28T14:03:47.997" Title="Fixing drift in a recursive fixed point filter" Tags="|moving-average|fixed-point|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23023" PostTypeId="1" AcceptedAnswerId="23079" CreationDate="2015-04-27T23:10:00.237" Score="2" ViewCount="1267" Body="&lt;p&gt;A sentence I copied from book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;That a 2$\times$1 Alamouti SFBC is referred to as a rate 1 code, two symbols are sent over two adjacent subcarriers.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question is regarding this SFBC encoder (Alamouti scheme). I understand how the encoder works for the two transmit antenna case. Below I briefly given an example for convenience. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming a BPSK modulator applied to data input $I$. Then we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$I$ = 0 0 1 1 0 1 1 1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;BPSK symbols=  1 1 -1 -1 1 -1 -1 -1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the output of the STBC encoder could be found according to the &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}{lcr}&#xA;\mbox{$$} &amp;amp; Antenna1 &amp;amp; Antenna 2 \\&#xA;\mbox{$f_1$} &amp;amp; s_1 &amp;amp; s_2 \\&#xA;\mbox{$f_2$} &amp;amp; -s_2^* &amp;amp; -s_1^* \\&#xA; \end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so applying this to the BPSK symbols I get the following symbols&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Antenna1 symbols: 1 -1 -1 1 1 1 -1 1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Antenna2 symbols: 1 1 -1 -1 -1 1 -1 -1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is next, what do we do with these symbols for LTE system ie OFDM modulation, do we send the symbols 1 and 2 over antenna 1 and antenna 2 respectively &lt;strong&gt;over the same subcarrier&lt;/strong&gt; ? i.e I don't understand how transmission over subcarriers takes place? More precisely I don't undersatnd the &lt;strong&gt;assignement of the symbols&lt;/strong&gt; to the different subcarriers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-06-04T18:39:02.047" LastActivityDate="2015-06-04T18:39:02.047" Title="SFBC Alamouti Scheme LTE" Tags="|digital-communications|ofdm|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23024" PostTypeId="2" ParentId="23023" CreationDate="2015-04-27T23:27:23.660" Score="3" Body="&lt;p&gt;The Alamouti scheme guards against Rayleigh fading channels.  If you were to send two symbols within the same channel within the same coherence time interval, they will experience the same fading.  In order to get diversity gain, you need to send them in different channels (different antennas or different frequencies or distant time slots)&lt;/p&gt;&#xA;" OwnerUserId="25" LastActivityDate="2015-04-27T23:27:23.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23025" PostTypeId="1" CreationDate="2015-04-28T04:56:42.997" Score="0" ViewCount="171" Body="&lt;p&gt;I am not a good in writing algorithm but please follow below steps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.There are 4 1D &lt;strong&gt;sinusoidal periodic&lt;/strong&gt; signals.3 of them are given by&#xA;\begin{cases}&#xA;  x(t)=4\sin(10\pi t) \\&#xA;  y(t)=8\cos(20\pi t) \\&#xA;  z(t)=16\sin(30\pi t) \\ &#xA; \end{cases}&#xA;2. 4th  signal &lt;strong&gt;m(t)&lt;/strong&gt;  is calculated as&#xA;\begin{cases}&#xA;  m(t)=x(t) +y(t)-z(t)&#xA;\end{cases}&#xA;3.Now,draw the &lt;strong&gt;waveform&lt;/strong&gt; of the signal &lt;strong&gt;m(t)&lt;/strong&gt;,keep it only with you and forget all &lt;strong&gt;other&lt;/strong&gt; signals data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4.Forget that &lt;strong&gt;m(t)&lt;/strong&gt; is composed of 3 above signals . Now you have  &lt;strong&gt;waveform of only one signal i.e. m(t) (not even the equation of the signal  m(t))&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5.Now ,I want to bring back the same above 3 signals(i.e.. &lt;strong&gt;x(t),y(t),z(t)&lt;/strong&gt;) from &lt;strong&gt;waveform&lt;/strong&gt; of &lt;strong&gt;m(t)&lt;/strong&gt; &lt;strong&gt;only&lt;/strong&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is that what is the efficient way to do it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Give solution&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, Is there any possibility that we could get totally different signals than above 3 signals ? &lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-04-29T18:37:41.333" LastActivityDate="2015-05-29T18:43:53.390" Title="Signal decompositon" Tags="|matlab|fft|signal-analysis|estimation|fourier-series|" AnswerCount="2" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="23026" PostTypeId="1" CreationDate="2015-04-28T07:01:31.657" Score="0" ViewCount="223" Body="&lt;p&gt;The axes are wrong in the spectrogram. I have an audio wav file, and I know the sampling rate. this is read into the audioData variable. The audio is 1 channel. selected window length I believe (can't remember) is 512. I believe overlap is 50% ( the default?), 1024 fourier points. sampling rate is 250,000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Matlab 2014a.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;spectrogram made using this:&#xA;    s = spectrogram(audioData, 512, [], 1024, 250e3); &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the spectrogram, the bottom bit is near the 20kHz range and I want to get rid of this and concentrate on the thing at the centre (which is around 25khz). To my knowledge, I need a high pass filter to allow all of the frequencies above 20kHz.&#xA;It seems like there are many ways to design filters which involve a lot of parameters and I'm a bit overwhelmed with how to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I essentially just want to cut out the bottom bit, so that I can image process the upper bit (ideally kept as close to intact, if not exactly, as possible)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3bDkE.jpg&quot; alt=&quot;Spectrogram&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15628" LastEditorUserId="1606" LastEditDate="2015-04-28T07:35:38.513" LastActivityDate="2018-04-07T16:36:38.247" Title="Matlab: is a highpass filter what I want, to obtain my required spectrogram? How do I design/apply this? (pic included)" Tags="|matlab|filter-design|filtering|spectrogram|highpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23027" PostTypeId="2" ParentId="23017" CreationDate="2015-04-28T07:29:27.590" Score="1" Body="&lt;p&gt;I assuming that by ROI you mean an axis-aligned Region of Interest, with some 2D origin and width+height.&lt;br&gt;&#xA;In this case, in a 3D volume, a ROI would by an axis aligned box with some 3D origin and a width, height and depth.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the box you can write out the voxel values inside it as a vector.&lt;/p&gt;&#xA;" OwnerUserId="163" LastActivityDate="2015-04-28T07:29:27.590" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23028" PostTypeId="2" ParentId="23026" CreationDate="2015-04-28T08:22:45.887" Score="2" Body="&lt;p&gt;If you don't have any specification for the filter besides the cut-off frequency, I believe the simplest way is to use the &lt;code&gt;fir1&lt;/code&gt; function. Note that the frequencies are normalised to half the sampling rate. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = fir1(n,20e3/(250e3/2),'high'); %Wn = Cutoff_req/(Fs/2)&#xA;figure; freqz(b,1,[],250e3); %visualize the filter if you wish&#xA;FilteredData = filter(b,1,audioData);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you wish to have more control over the specifications (attenuation, ripple, etc.), I suggest using &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/fdatool.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fdatool&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="8140" LastEditDate="2015-04-28T08:35:40.780" LastActivityDate="2015-04-28T08:35:40.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23029" PostTypeId="1" CreationDate="2015-04-28T08:23:06.713" Score="4" ViewCount="2038" Body="&lt;p&gt;I am trying to apply a Butterworth bandpass filter to accelerometer data of my smartphone. However, the accelerometer samples I receive do not come at regular intervals. Sample frequency varies between 1 Hz and 128 Hz in as little as a second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read the source code of a few Java implementations of Butterworth, but all of them appeared to assume a constant sample rate. Is there a way to implement Butterworth that allows for a variable sample rate? Or should I interpolate the accelerometer data to obtain a constant sample rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you answer with math, please include a layman's explanation. I'm a bit weak on the theoretical side of signal processing.&lt;/p&gt;&#xA;" OwnerUserId="15632" LastActivityDate="2016-01-28T13:31:44.327" Title="How to apply a Butterworth filter to data of varying sample rate?" Tags="|filters|sampling|interpolation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23031" PostTypeId="1" CreationDate="2015-04-28T11:04:37.323" Score="0" ViewCount="1923" Body="&lt;p&gt;I'm trying to get the spectrum of my signal in dBFS units. I'm not sure what is the refernce that I should devide by. I computed the power spectrum as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) FFT normalized to the number of samples&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p = abs(fft(signal))/(No_of_samps/2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) and then I calculated the power spectrum for half of the samples (one-sided)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p = p(1:Nsamps/2).^2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;3) I  tried to represent it in dBFS as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p_dBFs = 10*log(abs(p)/(vref/2)^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where vref is my reference p-p voltage in the ADC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm just not sure whether I should devide by the reference voltage to get values in dBFS, like when I apply a FS signal I would like to see the highest peak in the spectrum at exactly 0 dBFs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The time-domain signal is also multiplied by a hamming window before computing the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long post. Thank you guys very much.&lt;/p&gt;&#xA;" OwnerUserId="15618" LastActivityDate="2015-04-30T08:54:14.087" Title="Power Spectrum in dBFs" Tags="|fft|frequency-spectrum|window-functions|dbfs|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23033" PostTypeId="1" CreationDate="2015-04-28T16:16:20.670" Score="2" ViewCount="412" Body="&lt;p&gt;Woud anyone have a viterbi decoding tool or c-code or .m file for (R=1/2, K=4)? &#xA;I am trying to decode a bitstream received in RFSTUDIO from a non-TI transceiver and it says that it uses this kind of coding.&#xA;Regards &#xA;Vangelis&lt;/p&gt;&#xA;" OwnerUserId="15634" LastActivityDate="2015-04-28T16:16:20.670" Title="Viterbi Decoder=1/2 k=4" Tags="|matlab|dsp-core|viterbi-algorithm|" AnswerCount="0" CommentCount="1" ClosedDate="2015-04-29T06:59:50.303" ContentLicense="CC BY-SA 3.0" />
  <row Id="23035" PostTypeId="1" AcceptedAnswerId="23037" CreationDate="2015-04-28T17:45:43.493" Score="1" ViewCount="3003" Body="&lt;p&gt;I am trying to filter out some square wave signal to within a limited band (1/4 or 1/8 of the original), I realized that there's a lot of ringing in the wave when I use my filter (elliptical), I also tried Butterworth, and others (given in Matlab fir1, and classic iir filters) but the only filter that seems to give no ringing is Gaussian. So my question is, how should I go about designing a LPF with minimal ringing? (preferred characteristics: minimal pass band ripple, stop band of more than -50dB, relatively fast roll off). Also as I am trying to implement this in a DSP, low order filters such as IIR types are preferred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help.&lt;/p&gt;&#xA;" OwnerUserId="8481" LastEditorUserId="8481" LastEditDate="2015-04-28T18:04:42.920" LastActivityDate="2015-04-28T19:10:54.463" Title="low pass filter with minimal ringing" Tags="|lowpass-filter|filtering|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23037" PostTypeId="2" ParentId="23035" CreationDate="2015-04-28T19:10:54.463" Score="2" Body="&lt;p&gt;Generally the amount of ringing that you get is a function of the steepness of the filter in the frequency domain, regardless of filter type. &#xA;At the same steepness an Elliptic will require a lower order but will have pretty much the same ringing as a Butterworth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Choosing between a linear phase or minimum phase will change the character but not the extent of the ringing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;No matter how you slice it, a square wave contains a lot of high frequencies and once you filter those out, it's not a square wave any more.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-04-28T19:10:54.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23039" PostTypeId="1" AcceptedAnswerId="23041" CreationDate="2015-04-28T20:18:12.457" Score="2" ViewCount="253" Body="&lt;p&gt;I have some data which looks roughly periodic - is there a nice way to measure this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AOsKc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example I'm working on and I'd like a metric that I will be able to just threshold to give a decision of yes or no. I was thinking maybe looking into the Fourier domain or looking at correlation. Many thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[NB - I've cross-posted - I've also asked on the stats stack exchange but I think it may be more appropriate here]&lt;/p&gt;&#xA;" OwnerUserId="13457" LastActivityDate="2015-04-28T21:58:01.500" Title="Testing discrete data for periodicity" Tags="|discrete-signals|fourier-transform|periodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23040" PostTypeId="1" AcceptedAnswerId="23042" CreationDate="2015-04-28T20:30:53.930" Score="0" ViewCount="255" Body="&lt;p&gt;I came across this &lt;a href=&quot;http://www.halcon.com/download/reference/dots_image.html&quot; rel=&quot;nofollow&quot;&gt;2D filter for enhancing circular dots in images&lt;/a&gt;, for example to enhance a dot with a diameter of 5 pixel, the filter is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1}{336}\left( \begin{array}{ccccccc}&#xA;0 &amp;amp; 0 &amp;amp; −21 &amp;amp; −21 &amp;amp; −21 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; −21 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; −21 &amp;amp; 0\\&#xA;−21 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; −21\\&#xA;−21 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; −21\\&#xA;−21 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; −21\\&#xA;0 &amp;amp; −21 &amp;amp; 16 &amp;amp; 16 &amp;amp; 16 &amp;amp; −21 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; −21 &amp;amp; −21 &amp;amp; −21 &amp;amp; 0 &amp;amp; 0 \end{array} \right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has this filter a name? Like Sobel or Scharr.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the rationale behind its coefficients?&lt;/p&gt;&#xA;" OwnerUserId="3573" LastEditorUserId="3573" LastEditDate="2015-04-29T06:46:55.057" LastActivityDate="2015-04-29T06:46:55.057" Title="Has this 2D filter for enhancing circular dots in images a name?" Tags="|image-processing|filters|convolution|2d|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23041" PostTypeId="2" ParentId="23039" CreationDate="2015-04-28T21:58:01.500" Score="6" Body="&lt;p&gt;well, there is always autocorrelation $$ R_x(\tau)=\sum x[n] x[n+\tau] $$ or AMDF $$ Q_x(\tau) = \sum |x[n] - x[n+\tau]| $$ or ASDF $$Q_x(\tau) = \sum (x[n] - x[n+\tau])^2 $$  with the latter there is the relationship between autocorrelation and ASDF $$ R_x(\tau)=R_x(0) - \frac12 Q_x(\tau) $$.  a measure of periodicity might be $\frac{R_x(P)}{R_x(0)} $ where $R_x(P)&amp;gt;R_x(\tau)$ for all $\tau\ne 0$.  sometimes we call &quot;$P$&quot; the &quot;period&quot;.  if $\frac{R_x(P)}{R_x(0)} \approx 1 $ we say it's pretty periodic.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-04-28T21:58:01.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23042" PostTypeId="2" ParentId="23040" CreationDate="2015-04-29T02:08:07.250" Score="1" Body="&lt;p&gt;This is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;matched filter&lt;/a&gt;, where the shape of the filter coincides with the shape of the signal to be detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, whenever the filter convolution overlaps a circular dot in the image, a maximum will be present in the output image. Thus, searching for the single maximum pixels in the output image will give the center position of dots in the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that your linked source mentions that it is a &lt;em&gt;matched filter&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-04-29T02:08:07.250" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23043" PostTypeId="2" ParentId="22995" CreationDate="2015-04-29T05:53:31.440" Score="-1" Body="&lt;p&gt;Try using normal Thresholding function in OpenCV with type &lt;code&gt;THRESH_BINARY&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13454" LastEditorUserId="7092" LastEditDate="2015-04-29T06:59:30.763" LastActivityDate="2015-04-29T06:59:30.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23044" PostTypeId="1" CreationDate="2015-04-29T06:22:27.713" Score="2" ViewCount="137" Body="&lt;p&gt;I am facing a problem on how to separate amplitude of sine signal and compare with other sine signal having same frequency but different amplitude. How can one write a code for this?&lt;/p&gt;&#xA;" OwnerUserId="15642" LastEditorUserId="1629" LastEditDate="2016-07-23T02:42:23.980" LastActivityDate="2017-07-18T07:42:19.687" Title="Program to display amplitude of sine signal at each interval and display separately in MATLAB" Tags="|matlab|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23045" PostTypeId="2" ParentId="23040" CreationDate="2015-04-29T06:27:36.920" Score="1" Body="&lt;p&gt;The -21s make sure there's a transition to low values there (an edge) and the 0s dont contribute. Its like an edge detecting match-filter and should output between +-1 with 0 being the best score.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know of a name for it though - many (complex) filters do not have names when using the framework of convolution/correlation, especially when they are combo operations like this.&lt;/p&gt;&#xA;" OwnerUserId="15643" LastActivityDate="2015-04-29T06:27:36.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23046" PostTypeId="1" AcceptedAnswerId="23047" CreationDate="2015-04-29T07:06:26.873" Score="2" ViewCount="957" Body="&lt;p&gt;In &quot;duo-binary signalling&quot; how exactly is the transmission capacity increased?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because , when we encode the binary bits, the bit duration remains the same, but the amplitude will change. Then how can the transmission capacity be better?&lt;/p&gt;&#xA;" OwnerUserId="11809" LastEditorUserId="1606" LastEditDate="2015-04-29T07:55:30.127" LastActivityDate="2015-04-29T14:55:44.783" Title="Transmission capacity in &quot;duobinary coding&quot;" Tags="|digital-communications|channelcoding|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23047" PostTypeId="2" ParentId="23046" CreationDate="2015-04-29T09:38:23.617" Score="2" Body="&lt;p&gt;If you want to transmit a symbol sequence $A_k$ using baseband pulse amplitude modulation (PAM), the transmitted signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=\sum_kA_kp(t-kT)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $p(t)$ is the transmit pulse, and $T$ is the symbol interval. If you want to avoid intersymbol interference (ISI), the pulse function $p(t)$ must satisfy the Nyquist criterion, which says that its value must be zero at multiples of the symbol interval:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p(0)=1,\quad p(kT)=0,\quad k\neq 0\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The minimum bandwidth required to satisfy (1) is $1/2T$, but the corresponding pulse $p(t)$ is an ideal low-pass filter, i.e. a sinc function, which is of course impractical. So in practice, Nyquist pulses with a higher bandwidth (excess bandwidth) are used. This means that for a given bandwidth, the possible symbol rate is reduced as compared to the theoretically maximum possible value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With duobinary signalling practical systems can be built with &lt;em&gt;zero excess bandwidth&lt;/em&gt;, because the data symbols are filtered such that a spectral zero is introduced at half the baud rate. Note that this is a very simple filter unlike the ideal low-pass filter required for the minimum bandwidth Nyquist pulse. The price paid is the deliberate introduction of ISI and the introduction of a ternary (instead of binary) signal, which requires a higher SNR to achieve a given error probability.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-04-29T14:55:44.783" LastActivityDate="2015-04-29T14:55:44.783" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="23048" PostTypeId="1" AcceptedAnswerId="23052" CreationDate="2015-04-29T10:17:33.987" Score="3" ViewCount="2076" Body="&lt;p&gt;Everyone uses Fast Fourier Transform, which is fast at the detriment of precision. The input audio has sample accuracy and the FFT has 1/64 sample accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What algorithms can output high resolution frequency analysis of audio that varies over single samples, and that can divide input audio into i.e. 1024 bands of different frequency sines, each of the 1024 tracks is 22k sample rate?&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2019-04-12T12:16:00.020" Title="What is the most precise frequency analysis spectrography algorythm?" Tags="|fft|frequency-spectrum|dft|spectrogram|downsampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23050" PostTypeId="2" ParentId="7857" CreationDate="2015-04-29T10:54:54.117" Score="0" Body="&lt;p&gt;Look in your ADC datasheet, most of the time they provide a formula and even explain how to calulate it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mine says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;SINAD is the ratio of the power of the fundamental (PS) to the power of all the other spectral components including noise (PN) and distortion (PD), but excluding dc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;hence the formula is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$10 \log_{10} \left( \frac{P_S} {P_N + P_D} \right)$$&lt;/p&gt;&#xA;" OwnerUserId="15618" LastEditorUserId="3775" LastEditDate="2015-04-30T05:56:22.020" LastActivityDate="2015-04-30T05:56:22.020" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23051" PostTypeId="2" ParentId="23044" CreationDate="2015-04-29T11:03:43.837" Score="1" Body="&lt;p&gt;it's actually easy, you only need to find the maximum value of your sine, which is in turn happens to be your amplitude, then you can compare them with if an if statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this gives you the amplitude&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max(signal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;use if statement to compare the two values&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if max(signal1) == max(signal2)&#xA;%% your condition comes here&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cheers.&lt;/p&gt;&#xA;" OwnerUserId="15618" LastActivityDate="2015-04-29T11:03:43.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23052" PostTypeId="2" ParentId="23048" CreationDate="2015-04-29T11:55:36.790" Score="7" Body="&lt;p&gt;You don't have a loss in time precision when using FFTs because the FFT is fast. The FFT is just a fast algorithm for implementing the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete Fourier transform (DFT)&lt;/a&gt;, nothing more. Instead, there is an inherent tradeoff in time and frequency resolution due to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Uncertainty_principle&quot; rel=&quot;nofollow&quot;&gt;Heisenberg uncertainty principle&lt;/a&gt;. While its statement is explicitly focused at quantum mechanics, the same underlying principle remains true: the more precisely you know the frequency of a signal, the less able you are to localize it in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, there are another class of techniques known as &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_time%E2%80%93frequency_distribution&quot; rel=&quot;nofollow&quot;&gt;bilinear time-frequency distributions&lt;/a&gt; that are appropriate for some applications. One example is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_time%E2%80%93frequency_distribution#Wigner-Ville_Distribution&quot; rel=&quot;nofollow&quot;&gt;Wigner-Ville distribution&lt;/a&gt;. In short, these techniques can provide simultaneously high resolution in time and frequency. The cost, however, is the presence of spurious features in their resulting outputs. There do exist modified versions of these distributions that can reduce the magnitude of the artifacts, however.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2015-04-29T18:01:47.037" LastActivityDate="2015-04-29T18:01:47.037" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23053" PostTypeId="1" AcceptedAnswerId="23060" CreationDate="2015-04-29T12:39:10.280" Score="0" ViewCount="83" Body="&lt;p&gt;I have read that in speech signal processing analysis when voice is segmented in brief temporary segments the series segments transitions from being non stationary to stationary. My question is if this is also the case for financial data when this data can be segmented in smaller and smaller time spand windows (stock market). &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="128" LastEditDate="2023-07-03T13:43:06.883" LastActivityDate="2023-07-03T13:43:06.883" Title="comparison of speech signal processing and financial data" Tags="|signal-analysis|fractal-dimension|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23054" PostTypeId="2" ParentId="23025" CreationDate="2015-04-29T13:32:11.187" Score="1" Body="&lt;p&gt;The inner product between $\sin(m \pi t)$ and $\sin(n \pi t)$ is zero if $m \ne n$. The same holds true for inner product between $\sin(m \pi t)$ and $\cos(n \pi t)$ for any integer $m$ and $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get back $x(t)$ with the inner product between $m(t)$ and $\sin(10 \pi t)$. &lt;em&gt;Remember the scaling.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=10000;&#xA;t=linspace(-1,1,N);&#xA;x=4*sin(10*pi*t);&#xA;y=8*sin(20*pi*t);&#xA;z=16*sin(30*pi*t);&#xA;xc=1;yc=1;zc=-1;&#xA;m=xc*x+yc*y+zc*z;&#xA;xs=(1/xc)*dot(x,m)/dot(x,x);&#xA;ys=(1/yc)*dot(y,m)/dot(y,y);&#xA;zs=(1/zc)*dot(z,m)/dot(z,z);&#xA;xo=xs*x;&#xA;yo=ys*y;&#xA;zo=zs*z;&#xA;assert(norm(xo-x,'inf')&amp;lt;1e-14)&#xA;assert(norm(yo-y,'inf')&amp;lt;1e-14)&#xA;assert(norm(zo-z,'inf')&amp;lt;1e-14)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code above uses a numerical discretization. The dot product are almost exact approximation of the integral. Cf. &lt;a href=&quot;http://eprints.maths.ox.ac.uk/1734/1/NA-13-15.pdf&quot; rel=&quot;nofollow&quot;&gt;http://eprints.maths.ox.ac.uk/1734/1/NA-13-15.pdf&lt;/a&gt; for details.&lt;/p&gt;&#xA;" OwnerUserId="15648" LastEditorUserId="15648" LastEditDate="2015-04-29T14:31:56.607" LastActivityDate="2015-04-29T14:31:56.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23055" PostTypeId="1" CreationDate="2015-04-29T14:06:51.960" Score="4" ViewCount="838" Body="&lt;p&gt;I have a signal that I measured by optical means using a focused laser. The laser scans over a microscopic feature (in step size of 0.33 micron) and I have plotted the result of the measurement as a function of distance (x scale is microns):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WasqE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in the width of the feature I am measuring, however in this case the width seems on the same order (or even much smaller) than the laser spot size. This results in the signal being a Gaussian shape which could potentially just be the shape of the laser spot. But I cannot know that for sure, because I'm trying to measure the width of this feature. It is entirely plausible that the feature itself gives a Gaussian response, I expect it is not an extremely sharp edge. But I'm trying to determine how sharp the edge is exactly, and the laser spot size is now limiting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the feature is extremely thin and sharp, then the measurement would indeed yield this Gaussian shape. However the feature is definitely not infinitely sharp and I believe I can measure more accurately what its shape is by using deconvolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to measure the laser spot size (this would be the system response function, I guess?) by scanning over a feature that IS definitely 100% sharp. If everything was perfect the signal from that would be a step function, but of course due to the large laser spot size I actually get a sort of error function shape from which I believe I can determine the laser spot size:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sharp edge signal image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y3fh5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless I'm mistaken the parameter C in my fit gives me the 1/e^2 beam width (0.785 micron). I think I can use this to form the system response function, assuming that my laser beam is Gaussian (which is probably not true but that's the best I can do).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original signal I measured should be a convolution of the actual feature and this Gaussian system response, so I should also be able to deconvolve the signal with this same Gaussian system response and therefore obtain a better measurement of the feature, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about doing this? I have the original signal data (image 1, distance vs signal) and I can assume a Gaussian spot for my laser as the system response function with the known size obtained from the measurement of the perfectly sharp edge (image 2), as far as I understand (not much more than this...) this should be enough to do a deconvolution? &lt;/p&gt;&#xA;" OwnerUserId="15646" LastEditorUserId="8202" LastEditDate="2015-04-29T14:15:11.130" LastActivityDate="2015-04-30T08:46:02.170" Title="Deconvolution of signal which is broadened by laser spot size" Tags="|deconvolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23056" PostTypeId="1" AcceptedAnswerId="23059" CreationDate="2015-04-29T14:19:32.600" Score="5" ViewCount="1169" Body="&lt;p&gt;Hi I don't know where to start from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to implement a plot of noise with MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found a plot of noise standard deviation sigma vs. brightness from a  images in the blog post - &lt;a href=&quot;http://www.darktable.org/2012/12/profiling-sensor-and-photon-noise&quot; rel=&quot;noreferrer&quot;&gt;Profiling Sensor and Photon Noise&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I think I need to some reference to implement profiling as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also encountered the following reference - &lt;a href=&quot;http://people.csail.mit.edu/celiu/denoise/estnoise/&quot; rel=&quot;noreferrer&quot;&gt;Noise Estimation from a Single Image&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to make a plot of noise standard deviation sigma vs. brightness from a images?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="128" LastEditDate="2019-10-25T07:23:53.907" LastActivityDate="2019-10-25T07:23:53.907" Title="How to Estimated the Noise Standard Deviation (STD - $ \sigma $) as a Function of Brightness from an Image?" Tags="|image-processing|matlab|denoising|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23058" PostTypeId="2" ParentId="23055" CreationDate="2015-04-29T14:23:57.863" Score="2" Body="&lt;p&gt;There was a similar question here a while back with a conceptually similar problem.&lt;br&gt;&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/18654/2d-deconvolution-of-recorded-electron-beam-data/18660#18660&quot;&gt;Link to the earlier question.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That one was about scanning a target with an electron beam.&#xA;The question there was how to determine the true shape of the beam if you use a known target.  You would seem to have a beam with a known shape.&#xA;You've got it a bit easier, since you are dealing with a single dimension rather than a 2D shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to start would be to look at examples for the Matlab deconv method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you need two vectors - one that represents the beam, and one that represents the object as scanned with the beam.  Feed them into the deconv method, and you get a vector that represents just the object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to go at it would be to create a vector for an object of known size - say you have a sample of exactly 5 microns width.  You make a vector representing say 10 microns, and you put a 5 micron wide step in the middle of it.  Now you scan for real a 5 micron wide object, and deconvolve that vector with your generated 5 micron vector.  Now, you have the beam vector to use when measuring unknown objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't have Matlab, you could use &lt;a href=&quot;http://www.gnu.org/software/octave/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gnu Octave&lt;/a&gt; which works almost just like Matlab - many Matlab examples Just Work in Octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example Octave code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;calibration_target=[1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1];&#xA;simulated_beam=[1,1,2,2,2,1,1];&#xA;calibration_scan=conv(simulated_beam,calibration_target,&quot;full&quot;);&#xA;[recovered_beam_shape,beam_remainder]=deconv(calibration_scan,calibration_target);&#xA;&#xA;test_item=[0,0,0,1,1,0,0,0];&#xA;simulated_testscan=conv(simulated_beam,test_item,&quot;full&quot;);&#xA;corrected_test_item_scan=deconv(simulated_testscan,recovered_beam_shape);&#xA;&#xA;subplot(4,2,1);&#xA;plot(calibration_target);&#xA;title(&quot;calibration target&quot;);&#xA;&#xA;subplot(4,2,2);&#xA;plot(calibration_scan);&#xA;title(&quot;simulated scan of target with simulated beam&quot;);&#xA;&#xA;subplot(4,2,3);&#xA;plot(simulated_beam);&#xA;title(&quot;simulated beam&quot;);&#xA;&#xA;subplot(4,2,4);&#xA;plot(recovered_beam_shape);&#xA;title(&quot;recovered beam shape&quot;);&#xA;&#xA;subplot(4,2,5);&#xA;plot(simulated_testscan);&#xA;title(&quot;simulated testscan&quot;);&#xA;&#xA;subplot(4,2,6);&#xA;plot(corrected_test_item_scan);&#xA;title(&quot;corrected test item scan&quot;);&#xA;&#xA;subplot(4,2,7);&#xA;plot(test_item);&#xA;title(&quot; test item true shape&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qE4d2.png&quot; alt=&quot;Result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Added to answer questions from the comments.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Convolution and deconvolution work on uniformly spaced vectors.  All you need are the intensity values - drop your x coordinates.  If your data points aren't uniformly spaced, then you've got a problem.  If you interpolate your points to get uniform spacing, then you will probably introduce some fuzziness.  I don't know how much of a bad effect that would have on the deconvolution.  As for determining the vector to correct for the beam, I would scan a target with a known shape and sharp edges.  Then I would deconvolve the scanned data with an ideal image of the target - basically a vector as wide as the scanned object, with values of zero for the areas outside of the target, and values of 1 inside the target.  For example, a target 5 microns wide scanned with 1 micron stept would be [0,0,0,0,0,1,1,1,1,1,0,0,0,0,0]  Since you did a scan with a known object in order to generate your gaussian, I assume this is possible.&lt;/li&gt;&#xA;&lt;li&gt;The &quot;size&quot; shouldn't matter - assuming you mean the amplitude or intensity.  I would scale the generated data to make 1 represent the scanned area at maximum intensity.  If you meant the number of elements, then that would matter.  You need to overscan by enough to be sure that your beam actually leaves the target to each side.  If you don't overscan enough, then you won't be able to get a true image of your target.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-04-30T08:46:02.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23059" PostTypeId="2" ParentId="23056" CreationDate="2015-04-29T14:31:23.783" Score="1" Body="&lt;p&gt;I didn't read the article you referred to but I can try giving you some idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Run along the image for each pixel consider its 9 x 9 neighborhood.&lt;br&gt;&#xA;For each pixel's neighbor hood calculate the STD and the Mean.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the Mean as the brightness value.&lt;br&gt;&#xA;Plot the STD as a function of the mean value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some ideas for improvement:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set the neighborhood size in an adaptive manner to only include data from the same brightness level.  &lt;/li&gt;&#xA;&lt;li&gt;For patches with the same value, aggregate the STD and average it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-04-29T14:31:23.783" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23060" PostTypeId="2" ParentId="23053" CreationDate="2015-04-29T16:19:51.273" Score="1" Body="&lt;p&gt;Financial market trading data is thought to be fractal in dimension and thus not sufficiently band-limited before sampling.  So smaller windows might not have any effect on improving pseudo-stationarity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas the physical processes behind speech production are better understood and more physically limited (the rate of human muscle contractions controlling lung, larynx, and head cavity resonances, etc.), as well as the sound capture being low-pass filtered below typical human hearing thresholds before sampling above the Nyquist rate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-04-30T01:37:09.487" LastActivityDate="2015-04-30T01:37:09.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23061" PostTypeId="2" ParentId="23025" CreationDate="2015-04-29T17:14:30.660" Score="1" Body="&lt;p&gt;Your question is relatively broad in the sense that the difficulty could vary greatly depending on the sampling rate, the avaible signal length and the noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume a high sampling rate of 1 kHz, 10s of available signal and no noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first solution is to use a fft's magnitude, it works only if all the frequencies are different (if you have a cos and a sine with the same frequency, you'll have to check the phases too) :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs=1e3; %sampling frequency&#xA;T=1/Fs; %sampling period&#xA;N=10/T; %Number of points to have 10s of signal&#xA;f=Fs*linspace(0,1,N);&#xA;Fm=(1/N)*fft(m); %Normalization&#xA;Fm=2*Fm(1:length(t)/2); %Get rid of the negatives frequencies&#xA;&#xA;figure, plot(f,Fm)&#xA;xlabel('frequency (hz)')&#xA;ylabel('Magnitude') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bvWWg.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a zoom on the fft's plot. Then you have to extract the peaks which is very easy if the noise is low and if you know how many peaks there is. I stress it again, it is much more difficult if you have high noise / low sampling frequency / short signal available only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An another solution is to directly estimate your system's parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{cases}&#xA;x(t)=A \sin(2 \pi f_x t) \\&#xA;y(t)=B \sin(2 \pi f_y t)  \\&#xA;z(t)=C \sin(2 \pi f_z t) &#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can estimate the parameter $\Theta=[A,B,C,f_x,f_y,f_z]^t$ by optimizing a least square criterion with Gauss-Newton method, let's write $C(\Theta)$ such a criterion, $m(t_k)$ your discretised measurments and $m_{\theta}(t_k)$ the model with given parameter $\Theta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C(\Theta)=\sum_{k=1}^{N} (m(t_k)-m_{\theta}(t_k))^2&#xA;$$&#xA;The parameter's value $\hat{\Theta}$ we're looking for is given by :&#xA;$$&#xA;\hat{\Theta}=\arg_{\Theta}\min C(\Theta)&#xA;$$&#xA;We find the minimum by searching $\hat{\Theta}$ such that $\nabla_{\Theta}C(\hat{\Theta})=0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There you go with Gauss-Newton, the most difficult part being to calculate the model's gradient $\nabla_{\Theta}m_{\Theta}(t_k)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you know how to proceed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a practical point of view, you may have to run the optimization routine multiple time with random initializations as it is possible that it gets stuck in local minimas.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastEditorUserId="13315" LastEditDate="2015-04-29T17:54:07.390" LastActivityDate="2015-04-29T17:54:07.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23062" PostTypeId="1" AcceptedAnswerId="23075" CreationDate="2015-04-29T20:50:39.200" Score="1" ViewCount="167" Body="&lt;p&gt;I would like to implement path loss propagation model in a cellular network scenario. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the path loss can be modeled as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathrm{PL}(d)\propto\left(\dfrac{d_{ij}}{d_0}\right)^\alpha,$$ &#xA;where $d_0$ is a reference distance and $d_{ij}$ is the distance between transmitter $i$ and receiver $j$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how to scientifically choose the value of $d_0$? I read a lot of papers that say typical values of $d_0$ are $10, 100$. I do not really get what does $d_0$ mean in real scenario? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let say I generate randomly the position of my transmitter $i$ and receiver $j$, is there a constraint on $d_0$ that has to be met? What happens if $i$ and $j$ are very close to each others, i.e., $d_{ij} &amp;lt; d_0$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest to me a paper or a chapter in a book that I can read to understand the theory and the implementation of path loss models?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15653" LastActivityDate="2015-04-30T11:42:21.340" Title="How to implement path loss in wireless communications?" Tags="|digital-communications|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23064" PostTypeId="1" CreationDate="2015-04-30T04:36:02.200" Score="3" ViewCount="2687" Body="&lt;p&gt;In an OFDM transmitter, after IFFT &amp;amp; CP block, a DAC block is used.Since the output of IFFT is complex, and the input to DAC should be an integer, how can we integrate the two blocks? I implemented OFDM (upto CP block) in MATLAB but I could not integrate DAC with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&#xA;Ehsan&lt;/p&gt;&#xA;" OwnerUserId="15657" LastEditorUserId="21075" LastEditDate="2020-04-29T06:04:31.900" LastActivityDate="2020-04-29T06:04:31.900" Title="DAC implementation in OFDM" Tags="|matlab|ofdm|digital-to-analog|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23065" PostTypeId="1" AcceptedAnswerId="23072" CreationDate="2015-04-30T04:48:48.390" Score="1" ViewCount="2786" Body="&lt;p&gt;Here is my task:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find inverse z transform of $X(z)=\frac{1}{2-3z}$, if $|z|&amp;gt;\frac{2}{3}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to find it using definition formula, $x(n)=\frac{1}{2\pi j}\oint_{C}^{ } X(z)z^{n-1}dz$. How can I find it? &#xA;Result is $-\frac{1}{3}(\frac{2}{3})^{n-1}u(n-1)$&lt;/p&gt;&#xA;" OwnerUserId="15574" LastEditorUserId="15574" LastEditDate="2015-04-30T07:23:37.867" LastActivityDate="2015-04-30T10:06:17.507" Title="Inverse z transform - contour integration" Tags="|transform|z-transform|integration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23066" PostTypeId="1" AcceptedAnswerId="23067" CreationDate="2015-04-30T05:25:17.183" Score="0" ViewCount="227" Body="&lt;p&gt;My input signal is given by $$ x[n] = A\sin(2\pi f n/F_s + \varphi)$$&#xA;The signal is uniformly sampled at a sampling rate of $F_s $[Hz]. However some of the samples are missing. Assume that there are not many missing samples and that their location is known (i.e. I know the timestamp for each sample),  I am interested in estimating $A$ and $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial approach is to interpolate the vector and use standard methods (e.g. FFT). Another thought is to perform some kind non-linear regression (which I am unfamiliar with).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-04-30T05:36:54.890" Title="Frequency and amplitude estimation with missing samples" Tags="|frequency|estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23067" PostTypeId="2" ParentId="23066" CreationDate="2015-04-30T05:36:54.890" Score="1" Body="&lt;p&gt;I think best method for your is to use non-linear regression. These methods do not need to use equidistant data. I answered on similar questions (&lt;a href=&quot;https://dsp.stackexchange.com/questions/22003/fft-bin-interpolation-for-low-frequency-with-dc-offset/22006#22006&quot;&gt;fft-bin-interpolation&lt;/a&gt;). Below is citation from this answer:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If your signal is quite similar to sinus with noise, then I think you can estimate frequency by using fitting or regression methods. Search Internet with keywords: &amp;quot;fit&amp;quot;, &amp;quot;regression&amp;quot;, &amp;quot;least square&amp;quot; and &amp;quot;sine&amp;quot;. You can find a lot of program code, tools and so on. For example (I do not try it) - &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/41246-sine-function-fit&quot; rel=&quot;nofollow noreferrer&quot;&gt;sine-function-fit&lt;/a&gt; See also good discussion in StackExchange &lt;a href=&quot;https://math.stackexchange.com/questions/301194/given-a-data-set-how-do-you-do-a-sinusoidal-regression-on-paper-what-are-the-e&quot;&gt;&amp;quot;Given a data set, how do you do a sinusoidal regression on paper? What are the equations, algorithms?&amp;quot;&lt;/a&gt; There are a lot of good books and manuals for fitting/regression. I can recommend classical book  &lt;a href=&quot;http://www.nr.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Numerical Recipes&lt;/a&gt;. See chapter &amp;quot;Modeling of Data&amp;quot;. Especially  &amp;quot;Fitting Data to a Straight Line&amp;quot; for base understanding and  &amp;quot;Nonlinear Models&amp;quot; for understanding method of solution your problem. It is possible that there are specific methods for sine function.&lt;/p&gt;&#xA;&lt;p&gt;Implementation of regression in your case can be effective. You must solve minimization problem for system by size of 3 (for amplitude, frequency and phase). Calculation of coefficients of this system is sums of some functions from all your points - O(N).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-04-30T05:36:54.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23068" PostTypeId="2" ParentId="23064" CreationDate="2015-04-30T07:29:48.333" Score="1" Body="&lt;p&gt;In a real system you actually need two DACs: one for the real part and one for the imaginary part. The implementation of the DAC model depends on what should be included in your simulation. There are two main aspects: quantization and pulse shaping.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Quantization - if quantization effects of the DAC should be modelled, the floating point output of IFFT/CP insertion has to be mapped to a discrete number of values. Quantization can, for example, be implemented by scaling and rounding. Say your DAC has a vertical resolution of 8 bit. Then the IFFT output signal should be scaled such, that its maximum value is 127. Afterwards the signal is rounded to integer numbers. Note that OFDM signals are often clipped before quantization to reduce quantization noise, especially for lower resolutions (1).&lt;/li&gt;&#xA;&lt;li&gt;Pulse shaping - if a physical channel should be modeled (for example a wireless channel), the analog output of the DAC must be simulated. This is implemented by converting every input sample into an impulse that is weighted with the sample's value. In the simulation the impulse itself consists of $L$ samples, of course, that mimic the analog signal. $L$ is the oversampling factor (not to be confused with the OFDM oversampling that is achieved by zero padded subcarriers). The simplest impulse shape is a rectangle, i.e. every sample in the simulation is just repeated $L$ times.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If the channel model is very simple, for example an AWGN channel, DAC and ADC can be omitted. It really depends on how realistic the simulation model should be.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(1) &lt;a href=&quot;https://www.researchgate.net/publication/259829414_Analytical_and_numerical_studies_of_quantization_effects_in_coherent_optical_OFDM_transmission_with_100_Gbits_and_beyond&quot; rel=&quot;nofollow&quot;&gt;Michael Bernhard et al.: Analytical and numerical studies of quantization effects in coherent optical OFDM transmission with 100 Gbit/s and beyond&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-04-30T07:29:48.333" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23069" PostTypeId="1" CreationDate="2015-04-29T17:36:07.467" Score="0" ViewCount="105" Body="&lt;p&gt;I have calculated, with FFT and A-FFT, the autocorrelation of a discrete signal (coming from an integration) with spacing $\Delta T$ composed by $N$ samples padded to $2N$ with zeroes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the resolution of the autocorrelation? Is it $\frac{\Delta T}{2}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the time interval of validity of the calculated autocorrelation? $[0, N]$ or $[0, \frac{N}{2}]$?&lt;/p&gt;&#xA;" OwnerUserId="15658" OwnerDisplayName="Andrea Oliveri" LastEditorUserId="15658" LastEditDate="2015-04-30T08:19:38.123" LastActivityDate="2015-04-30T08:19:38.123" Title="Length and spacing autocorrelation with FFT" Tags="|fft|fourier-transform|autocorrelation|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23070" PostTypeId="2" ParentId="23031" CreationDate="2015-04-30T08:54:14.087" Score="-1" Body="&lt;p&gt;Hello again guys after a lot of thought, I finally broke this down and I would like to share it with you hoping it'll help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what I did was: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- I used matlab's pwelch to get the power spectrum like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[AutoPowerSpectrum ,F] = pwelch(signal, Nsamps, 0, Nsamps, fs, 'power');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you can read about the different parameters for pwelch in matlab's documentation right &lt;a href=&quot;http://de.mathworks.com/help/signal/ref/pwelch.html&quot; rel=&quot;nofollow&quot;&gt;HERE&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- I calculated Vpeak squared, because as far as I know pwelch produces Vrms values.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AutoPowerSpectrum = 2.*AutoPowerSpectrum;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;3- got the Vpeak by squaring the above equation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AutoPowerSpectrum = sqrt(AutoPowerSpectrum);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;4- converted it to dBFs&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p_dBFs = 20*(log10(AutoPowerSpectrum./(vPerLevel*2^(N-1))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where: vPerLevel is the voltage corresponding to each level in my ADC. It is calculated like this Vref/2^N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and N is the resolution of the ADC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally used plot() to display it. This solution worked with me and gave me the signal in dBFS, i'm opened to edits and suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helped. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="15618" LastActivityDate="2015-04-30T08:54:14.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23072" PostTypeId="2" ParentId="23065" CreationDate="2015-04-30T10:06:17.507" Score="2" Body="&lt;p&gt;In order to be able to do this, you need to know &lt;a href=&quot;http://en.wikipedia.org/wiki/Residue_theorem&quot; rel=&quot;nofollow&quot;&gt;Cauchy's residue theorem&lt;/a&gt;, from which you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi j}\oint_Cf(z)dz=\sum_kR_k\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $R_k$ are the residues of the analytic function $f(z)$ at its poles $p_k$, which must lie inside the closed contour $C$. The residue at pole $p_k$ is given by&#xA;$$R_k=\lim_{z\rightarrow p_k}(z-p_k)f(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the inverse $\mathcal{Z}$-transform, we have $f(z)=X(z)z^{n-1}$. Since in your example the region of convergence is given as $|z|&amp;gt;2/3$, we know that we need to find a causal sequence $x[n]$, so we only need to consider values $n\ge 0$. For $n&amp;gt;0$, there is only one single pole at $z=2/3$, and the corresponding residue is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_0=\lim_{z\rightarrow 2/3}(z-2/3)X(z)z^{n-1}=-\frac{1}{3}\left(\frac{2}{3}\right)^{n-1}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $n=0$ we get another pole at $z=0$ from the term $z^{n-1}$, and the corresponding residue is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_1=\lim_{z\rightarrow 0}zX(z)z^{-1}=\lim_{z\rightarrow 0}X(z)=\frac12\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to (1), the value of $x[0]$ is given by the sum of the residues (2) and (3):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[0]=-\frac13\left(\frac23\right)^{-1}+\frac12=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $n&amp;gt;0$ we only need to consider the residue $R_0$, so the inverse $\mathcal{Z}$-transform is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=-\frac13\left(\frac23\right)^{n-1}u[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is just meant as an exercise. In practice this example is a basic transformation, which you either know or look up in a table.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-04-30T10:06:17.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23073" PostTypeId="1" AcceptedAnswerId="23096" CreationDate="2015-04-30T11:12:45.677" Score="0" ViewCount="484" Body="&lt;p&gt;I need recommendation about complex analysis book. As I'm electrical engineering student, it should cover everything one engineer need to know about that mathematical field, but without strict mathematical formalism.&lt;/p&gt;&#xA;" OwnerUserId="15574" LastEditorUserId="13320" LastEditDate="2017-03-09T08:43:03.153" LastActivityDate="2017-03-09T08:46:10.817" Title="Complex analysis book recommendation for electrical. eng" Tags="|reference-request|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23074" PostTypeId="1" CreationDate="2015-04-30T11:36:13.340" Score="2" ViewCount="1739" Body="&lt;p&gt;I have computed magnitude and phase spectrum of cameraman Gray scale image  using fft function. Here, we get magnitude and phase spectrum of the &lt;strong&gt;whole&lt;/strong&gt; image. .Please see &lt;strong&gt;the reconstruction of image from phase only part&lt;/strong&gt; from the accepted answer of &lt;a href=&quot;https://dsp.stackexchange.com/questions/16995/image-reconstructionphase-vs-magnitude&quot;&gt;Image Reconstruction:Phase vs Magnitude&lt;/a&gt;  &lt;strong&gt;which says  that in an image neighboring pixels of the edge,lines and corner are in phase&lt;/strong&gt; . So  I want to find phase values on precise pixels &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Given an image of dimensions 256*256, how can I find phase values of pixels at locations(100,121),(100,122) and (100,123) ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether it is possible using Fourier Transform or not? If not ,what is the other way to do it? Can anybody explain it with (or without )  code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9oOo1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yKh89.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;clear all;&#xA;close all;&#xA;&#xA;i=imread('C:\Users\RK\Desktop\cameraman.gif');&#xA;%i=rgb2gray(i);&#xA;i=uint8(i);&#xA;&#xA;figure,&#xA;subplot(1,3,1);imshow(i);&#xA;title('Cameraman Gray scale Image');&#xA;&#xA;f1=fft2(i);&#xA;f2=log(1+fftshift(f1));&#xA;&#xA;&#xA;m=abs(f2);&#xA;subplot(1,3,2);&#xA;imshow(m,[]);&#xA;title('Magnitude Spectrum');  &#xA;&#xA;phase=angle(f2);&#xA;subplot(1,3,3);a&#xA;imshow(phase,[]);&#xA;title('Phase Spectrum');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15429" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-05-02T01:27:20.157" Title="How to find phase values on precise pixel locations of a given Image?" Tags="|matlab|signal-analysis|fourier-transform|wavelet|phase|" AnswerCount="1" CommentCount="18" ClosedDate="2015-05-05T01:44:31.913" ContentLicense="CC BY-SA 3.0" />
  <row Id="23075" PostTypeId="2" ParentId="23062" CreationDate="2015-04-30T11:42:21.340" Score="2" Body="&lt;p&gt;A good text is by WIlliam Y. C. Lee. He did alot of the original work on &#xA;propagation models. There are many others, just google &quot;path loss model&quot;.&#xA;This  equation you selected is a very basic one for a cellular network. It doesn't take into account many of the fActors like environment(urban, suburban, rural), clutter or morphology, line of sight propagation or non line of sight, statistical factors and others. There are empirical models for various environments that have been used and modified (Hata, Okumura cost 231 etc) and can be iteritively adjusted with real field data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regard to your question about the reference distance. I'm sure you can find the answer in the references I mentioned above and the Goldsmith reference mentioned by ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There might be a relationship to that distance and the far field or it may be justa standard reference, I'm not sure. In any case you could use a different model if the user is too close if necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The path loss exponent is also a very important parameter(alpha in your equation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="14921" LastActivityDate="2015-04-30T11:42:21.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23076" PostTypeId="2" ParentId="23074" CreationDate="2015-04-30T13:07:40.070" Score="-1" Body="&lt;p&gt;You can't find the precise phase value of a given pixel because of the uncertainty principle. You can only find the phase value for the pixel's neighborhood using short-time Fourier tranform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know the phase for pixel (100,100), ou have to take a neighborhood, for instance (50:150,50:150) and calculate the 2D Fourier transform on this window.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-04-30T13:07:40.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23077" PostTypeId="1" CreationDate="2015-04-30T13:17:22.293" Score="0" ViewCount="372" Body="&lt;p&gt;I have two sequences x and y of lengths, say 5 and 10.  I multiply them in time domain element by element.  I get another sequence.  Now this as per the convolution theorem should be equal to the inverse z tranform of the convolution of the two z transforms of the original sequences.  Now, I know how to get the ZTs of the original sequences.  How do I get the convolution of  these ZTs?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="15664" LastEditDate="2015-04-30T13:20:46.583" LastActivityDate="2015-05-03T13:44:54.260" Title="Checking convolution property II of z transform" Tags="|z-transform|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23078" PostTypeId="2" ParentId="22995" CreationDate="2015-04-30T13:41:04.550" Score="2" Body="&lt;p&gt;This binarization fails because the size of the filter is too small, so that some of the regions it processes are uniform. Increase the filter size and you'll see great improvement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JowoM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JowoM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2020-01-04T15:16:21.200" LastActivityDate="2020-01-04T15:16:21.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23079" PostTypeId="2" ParentId="23023" CreationDate="2015-04-30T14:08:27.053" Score="0" Body="&lt;p&gt;What I see from your post is SFBC Space Frequency Block Coding. This is different than STBC &quot;Space Time Block Coding.&quot; In STBC, which was the original way &#xA;the Alomouti Code was used, the table you have above would have f1 and f2, the subcarriers replaced by time slots T1 and T2. You show SFBC where symbol 1(s1) is sent over ant1 and subcarrier f1, s2 over subcarrier f1 antenna 2, -s2conj over subcarrier 2 ant 1, etc. If this were STBC then s1 would be sent in timeslot 1 over ant1 s2 in timeslot 1 over ant 2, etc. I pretty sure this is correct..Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="14921" LastActivityDate="2015-04-30T14:08:27.053" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23080" PostTypeId="1" CreationDate="2015-04-30T15:35:45.630" Score="2" ViewCount="430" Body="&lt;p&gt;Consider the 2D signal below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nfusI.png&quot; alt=&quot;2D Signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to find the changepoints in the signal (using a hierarchical approach). Based on our visual observation, we can see there are 2 main changepoints where the signal 'starts' and 'stops' and we could argue there is potentially another one where the red starts to come in. We could continue to look in more and more granularity if we so wished.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how could we get a computer to detect these automatically. My intuition from the way I did it was to do as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the first point as our starting point.&lt;/li&gt;&#xA;&lt;li&gt;Move along the time axis with another point, finding the Fourier transform of the data between the first point and this point.&lt;/li&gt;&#xA;&lt;li&gt;As long as the transformed signal is not become too much more complex (in the information sense), we know that we have not hit any big change.&lt;/li&gt;&#xA;&lt;li&gt;Once the signal starts to become more complex (above some threshold level), we select this as our new starting point and repeat.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;After this process is finished we now have selected an array of points where our signal changes drastically w.r.t. its spectral make up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question then is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does this make sense?&lt;/li&gt;&#xA;&lt;li&gt;What metric should I use for the complexity of the Fourier transform?&lt;/li&gt;&#xA;&lt;li&gt;Has this already been tackled successfully and if so any references?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4534" LastEditorUserId="1629" LastEditDate="2016-01-26T17:09:38.820" LastActivityDate="2016-03-26T20:05:01.690" Title="Changepoint Detection of a 2D signal" Tags="|fourier-transform|multi-channel|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23081" PostTypeId="1" CreationDate="2015-04-30T18:51:10.317" Score="0" ViewCount="84" Body="&lt;p&gt;Suppose I have a discrete time signal $x_t$ sampled with a frequency $f_s$.  I know that if I take the discrete fourier transform of the signal and compute the power, I can easily (by visual inspection) determine which frequencies are the most important ones in the signal.  I know that the signal is the superposition of several sine and cosine funtions, but I want to determine the amplitudes of each of these functions; i.e. the coefficients $a_n$ and $b_n$ in front of the sine and cosine functions, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to estimate these fourier coefficients of a discrete time signal?  How can I approximate them?  Is there a way to estimate them using only the information from the power spectrum from discrete fourier transform?&lt;/p&gt;&#xA;" OwnerUserId="1330" LastActivityDate="2015-04-30T18:51:10.317" Title="Approximating the fourier coefficients from a discrete time signal" Tags="|discrete-signals|fourier-series|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23085" PostTypeId="1" AcceptedAnswerId="23089" CreationDate="2015-04-30T23:19:34.547" Score="0" ViewCount="153" Body="&lt;p&gt;Let us consider $x_1(t)$, $x_2(t)$, $x_3(t)$, all the same within some some duration 0 to $T$ but all different outside this interval.  Now let us multiply each of these signals with $w(t)$, a window function - nonzero from 0 to $T$ but 0 outside this interval.  So the multiplication of this $w(t)$ with each of $x_i(t)$ will give the same signal.  This should be same as Inverse Fourier Transform of $W(\omega)$ convolved with $X_i(\omega)$.  Does this mean convolution of the same signal with different signals can give the same result?  Any comments?  Is there a pitfall in my interpretation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I see mathematically equations neatly entered in questions and answers on this site?  Where should I start to learn on how to write the equations?  &lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="11256" LastEditDate="2015-04-30T23:52:04.980" LastActivityDate="2015-05-01T06:51:08.267" Title="Can convolution of one signal with different signals give the same answer?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23088" PostTypeId="2" ParentId="23077" CreationDate="2015-05-01T02:39:52.710" Score="2" Body="&lt;p&gt;The term-by-term product of the sequences $(a_0, a_1, a_2)$ and&#xA;$(b_0, b_1, b_2)$ is $(c_0, c_1, c_2) = (a_0b_0, a_1b_1, a_2b_2)$. The corresponding $z$-transforms are&#xA;\begin{align}&#xA;A(z) &amp;amp;= a_0 + a_1z^{-1} + a_2z^{-2}\\&#xA;B(z) &amp;amp;= b_0 + b_1z^{-1} + b_2z^{-2}\\&#xA;C(z) &amp;amp;= a_0b_0 + a_1b_1z^{-1} + a_2b_2z^{-2}&#xA;\end{align}&#xA;According to the formula in Wikipedia pointed out to you by MattL, $C(z)$ can be obtained from $A(z)$ and $B(z)$ via a &lt;em&gt;contour integral&lt;/em&gt; in&#xA;the complex plane.  The &lt;em&gt;integrand&lt;/em&gt; of the contour integral (which&#xA;is with respect to the complex variable $v$) is&#xA;\begin{align}&#xA;v^{-1}A(v)B\left(\frac zv\right) &#xA;&amp;amp;= v^{-1}\left(a_0 + a_1v^{-1} + a_2v^{-2}\right)&#xA;\left(b_0 + b_1\left(\frac zv\right)^{-1} &#xA;+ b_2\left(\frac zv\right)^{-2}\right)\\&#xA;&amp;amp;= \frac {a_0b_0 + a_1b_1z^{-1} + a_2b_2z^{-2}}{v}&#xA;+ \sum_{m=0}^2\sum_{n=0, n\neq m}^2 &#xA;\left(a_mb_nz^{-n}\right) v^{-m + n -1}\tag{1}&#xA;\end{align}&#xA;where in that last sum in $(1)$, the exponent of $v$ in each term is either $\geq 0$ or $\leq -2$. In other words, if we regard each of the $8$ terms in that sum as a separate function of $v$, then the function&#xA;either has no poles inside the unit circle ($-m+n-1 \geq 0$) or &#xA;has a pole of multiplicity&#xA;greater than $1$ at the origin ($-m+n-1 \leq -2$). &#xA;Now, write the contour integral of the right side of&#xA;$(1)$ as the sum of $9$ different contour integrals and&#xA;apply Cauchy's integral theorem to evaluate each of these $9$ contour integrals. The conclusion is that the integrals of all the terms &#xA;in that sum in $(1)$ integrate to $0$ while the contour integral&#xA;of $\displaystyle \frac {a_0b_0 + a_1b_1z^{-1} + a_2b_2z^{-2}}{v}$ &#xA;(which has a single pole at the origin) gives the desired&#xA;$C(z) = a_0b_0 + a_1b_1z^{-1} + a_2b_2z^{-2}$. &#xA;Generalization of all this to sequences of arbitrary lengths is&#xA;straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't know&#xA;enough complex-variable theory to figure out why it is that the contour&#xA;integral of the first term in $(1)$ is just the numerator and why the integral of the other terms is $0$, then you&#xA;will not be able to carry out the verification that you desire.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-05-03T13:44:54.260" LastActivityDate="2015-05-03T13:44:54.260" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23089" PostTypeId="2" ParentId="23085" CreationDate="2015-05-01T03:22:25.350" Score="0" Body="&lt;p&gt;Convolution is filtering.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider creating a filter with a rectangular response in the frequency domain.  Then any signal with the same content within the filter's passband, no matter what the signal content outside the passband of the filter, should result in only the content within the passband after convolution with the impulse response of the filter.  Thus, multiple inputs (signals with different stuff outside of the passband) to a convolution with this filter should result in the same output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Your opening statement merely swaps the frequency and time domains for the rectangular function, making this relationship harder to recognize.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work even for a non-rectangular and finite length FIR filter with at least one zero in it's transform (maybe at a nice integer submultiple of the sample rate).  Add any magnitude of sinusoidal input at the frequency of the zero, and the convolution result or filter output remains unchanged (except perhaps for numerical issues/clipping/quantization/etc.).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-05-01T06:51:08.267" LastActivityDate="2015-05-01T06:51:08.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23090" PostTypeId="2" ParentId="13601" CreationDate="2015-05-01T03:42:44.120" Score="0" Body="&lt;p&gt;Please define what you mean by probe phasor? i haven't encountered that term in audio. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that your theory is good, because i wrote a similar program in 2004 which gives sample accurate results, without bins and windows. the uncertainty principle does prevent bit accurate detection of sine wave peaks and troughs, if you had two sines mixed inside an audio file and you wanted to analyse them in a spectrogram from a submarine radar which is pretty precise, you wouldnt be able to see very precise frequency and time signatures, you couldn't have a sine wave of 440 that makes a single detected signature line at 440, but you could average the values of the spectrogram that would form a bell curve around the 440 mark and say with high precision that the signal was at 440.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probe phasor would necessarily be based on delays of audio and comparing values across the time domain, and that means that the highest frequency time signatures that you can have are delayed as a factor of the frequency, so low frequencies have lower time domain resolution... and as you increase the precision of the phasor probe, i found that the resulting graph values are written with more time delay or less time precision, i don't know which.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw that, as you can compute a 1gb high precision analysis of a 1 second sound, you have so much data in the end that you can visually and mathematically average and process the result to have much more precision that the initial uncertainty precision implies, that if you do further processing, you can have frequency accurate data, and very accurate time data too, but it does seem to be by statistically averaging the results. same as all statistics, with alot of data you have high certainty of the underlying values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can also run the audio forwards and backwards, and determine from both graphs where in time the detected signals are actually occuring, they are in the middle of the forwards and backwards analysed spectrogram.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2015-05-01T03:42:44.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23091" PostTypeId="1" AcceptedAnswerId="23092" CreationDate="2015-05-01T04:27:16.453" Score="1" ViewCount="394" Body="&lt;p&gt;I wanted to write &lt;code&gt;e^(-1000|t|)&lt;/code&gt; in matlab title of a plot. When I entered this and ran it actually, it showed ( as a superscript and every thing else in the line in regular font.  Now I wanted the whole thing &lt;code&gt;-1000|t|&lt;/code&gt; to appear as a superscript.  I tried bracketing etc and finally I achieved what I wanted by inserting ^ before every letter. Is there a better way?  &lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="7092" LastEditDate="2015-05-01T13:20:53.917" LastActivityDate="2015-05-01T13:20:53.917" Title="How to write e^(-1000|t|) in matlab title?" Tags="|matlab|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="23092" PostTypeId="2" ParentId="23091" CreationDate="2015-05-01T06:09:32.640" Score="3" Body="&lt;p&gt;You can write e^(-1000*|t|) in Matlab in colored form if you want as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;title('\ite^{-1000 |t|}','Color','b') &#xA;Here,&quot;b&quot; is for blue color ,&quot;r&quot; for red,&quot;g&quot; for greeen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For subscript use _ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For superscript use ^&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For exponential symbol use \ite ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For lambda symbol use \lambda &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For alpha use \alpha.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2015-05-01T06:14:43.207" LastActivityDate="2015-05-01T06:14:43.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23093" PostTypeId="2" ParentId="8604" CreationDate="2015-05-01T06:19:44.980" Score="-1" Body="&lt;p&gt;This occurs due to Spectral Leakage and Windowing. The ideal response i.e. impulse function is for continuous time sine wave. When you take DFT of a discrete sine wave in a digital computer, you are basically taking Fourier Transform of windowed and sampled sine and then sampling it in frequency domain. This causes the spectral leakage. Refer: &lt;a href=&quot;http://w.astro.berkeley.edu/~jrg/ngst/fft/leakage.html&quot; rel=&quot;nofollow&quot;&gt;http://w.astro.berkeley.edu/~jrg/ngst/fft/leakage.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15670" LastActivityDate="2015-05-01T06:19:44.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23094" PostTypeId="1" AcceptedAnswerId="23098" CreationDate="2015-05-01T09:37:45.497" Score="0" ViewCount="126" Body="&lt;p&gt;I programmed a sample accurate spectrogram some time ago and i still have never seen a picture of another one. It's interesting maths, i was told it's trivial, so why has no one else posted research on sample accurate sgrams on the internet? Can you find one. Here is a pic of my version: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/oF6As.jpg&quot; alt=&quot; Zoom in of 1ms of sound in mid frequencies &quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is the same program without the zoom and in 2d Mode:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/V5Y4Q.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2015-05-01T10:53:11.770" Title="Are there any pictures of a sample accurate spectrogram on the web or in books?" Tags="|frequency-spectrum|spectrogram|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23096" PostTypeId="2" ParentId="23073" CreationDate="2015-05-01T10:34:49.727" Score="1" Body="&lt;p&gt;I would start with looking on &lt;a href=&quot;http://ocw.mit.edu/index.htm&quot; rel=&quot;nofollow&quot;&gt;MIT Open Course Ware&lt;/a&gt;. E.g., &lt;a href=&quot;http://ocw.mit.edu/courses/mathematics/18-04-complex-variables-with-applications-fall-2003/&quot; rel=&quot;nofollow&quot;&gt;Complex Variables with Applications&lt;/a&gt; could be interesting for you. They use the book &lt;em&gt;Fundamentals of Complex Analysis with Applications to Engineering, Science, and Mathematics&lt;/em&gt; by Saff and Snider, but you might find it sufficient to browse the lecture notes. &lt;a href=&quot;http://ocw.mit.edu/courses/mathematics/18-112-functions-of-a-complex-variable-fall-2008/index.htm&quot; rel=&quot;nofollow&quot;&gt;This course&lt;/a&gt; might also be interesting for you.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-01T10:34:49.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23097" PostTypeId="2" ParentId="23080" CreationDate="2015-05-01T10:48:14.760" Score="0" Body="&lt;p&gt;I don't have the time to write a fully detailled answer but here's my 2 cents :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think that looking for the &quot;complexity&quot; of the Fourier transform is a good solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are looking for a magnitude change, xum your signal along the time axis. The 1D signal is simpler and it has one dominent frequency. Estimate the dominent frequency, put it in phase with you signal using correlation, demodulate your signal using a product detector and a low-pass filter. You should have a nice envelop to work on where a thresolding/clustering heuristic could land good result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, I think you will be able to devise more simple strategy starting from the 1d signal + dominent frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen such problem in non-intrusive load monitoring. &lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-05-01T10:48:14.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23098" PostTypeId="2" ParentId="23094" CreationDate="2015-05-01T10:53:11.770" Score="1" Body="&lt;p&gt;Producing accurate time-frequency analysis is an area of research. Some pointers are : Wigner-Ville transformation, re-allocation methods, wavelets.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-05-01T10:53:11.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23099" PostTypeId="1" CreationDate="2015-05-01T14:20:32.823" Score="0" ViewCount="4287" Body="&lt;p&gt;We know that integration gives area under the curve.  And that FT is also an integration.  How do we interpret FT in terms of the area under the curve especially because e^(jwt) is a complex term?  In general, while dealing with complex terms in integration can we relate to some area?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2015-05-02T08:02:31.460" Title="What is Fourier transform in terms of area under the curve?" Tags="|fourier-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23100" PostTypeId="2" ParentId="23073" CreationDate="2015-05-01T14:22:00.583" Score="1" Body="&lt;p&gt;Saff and Snider's Fundamentals of complex analysis is a nice enough book. It's just excessively pricey. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brown &amp;amp; Churchill's Complex Variables and Applications is a good option as well (you can get an old edition for pretty cheap, and its content-wise the same as the new ones). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Marsden &amp;amp; Hoffman's Basic Complex Analysis is also a good option, but its a tiny bit more advanced than the other options (but still suitable for Eng/Math/Physics students). A nice feature of this is that he has a lot of hints and worked out problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The OCW courses linked in Matt L.'s answer are alright -- the second one is based around Ahlfors' book which is more advanced than what most EE's will need (and just has some extra stuff to supplement Ahlfors). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were to pick one, I'd go with Brown &amp;amp; Churchill as its the one I used as an undergraduate, with Marsden &amp;amp; Hoffman as a close second. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-05-01T14:22:00.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23101" PostTypeId="1" CreationDate="2015-05-01T15:46:52.390" Score="1" ViewCount="821" Body="&lt;p&gt;I'm currently trying to implement some of the methods found in this paper on intelligent equalization - &lt;a href=&quot;http://www.aes.org/e-lib/browse.cfm?elib=16792&quot; rel=&quot;nofollow&quot;&gt;http://www.aes.org/e-lib/browse.cfm?elib=16792&lt;/a&gt; - &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first part of the process is to build a &quot;target equalization curve&quot; via the means of &quot;averaging the spectra of all songs in the dataset&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, if I do the following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mag_1 = abs(fft(file));&#xA;mag_2 = abs(fft(file_2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The two magnitude spectra have different resolution and number of frequency bins right?  Does it make sense to just mean(mag_1, mag_2)?  I can't seem to find anything that goes over averaging multiple magnitude spectra and it isn't defined in the paper how they achieved the averaged magnitude spectra for the ideal target curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14863" LastActivityDate="2015-09-03T13:05:03.673" Title="Averaging Multiple Magnitude Spectra" Tags="|matlab|fft|magnitude|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23102" PostTypeId="2" ParentId="23099" CreationDate="2015-05-01T16:18:41.810" Score="2" Body="&lt;p&gt;Since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\int_{-\infty}^{\infty}x(t)e^{-j\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you get for the real part of $X(\omega)$ (assuming that $x(t)$ is real)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_R(\omega)=\int_{-\infty}^{\infty}x(t)\cos(\omega t)dt\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and for the imaginary part&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_I(\omega)=-\int_{-\infty}^{\infty}x(t)\sin(\omega t)dt\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you like, from (1) and (2) you can interpret the real part of the Fourier transform as the area under the curve $x(t)\cos(\omega t)$, and the imaginary part would then be the area under the curve $-x(t)\sin(\omega t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that interpreting an integral as the area under a curve does not always help intuition. In the case of the Fourier transform it is more natural to interpret the integrals (1) and (2) as &lt;a href=&quot;http://en.wikipedia.org/wiki/Dot_product#Functions&quot; rel=&quot;nofollow&quot;&gt;inner products&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-01T16:18:41.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23103" PostTypeId="1" CreationDate="2015-05-01T16:58:11.137" Score="0" ViewCount="994" Body="&lt;p&gt;Hello I just started learning Signals and Systems and I have a question regarding periodic signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance:&#xA;$x(t) = \cos(3.2t) + \sin(1.6t) + e ^{j2.8t}$ is periodic because of the HCF of the frequencies.($0.4$ rad/s)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $x(t) = \cos(4t) + \sin(\pi t)$ isn't because of there is no common factors between $4$ and $\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about this:&#xA;$x(t) = 6 \sin (12 \pi t) + 4 e ^{ j (8 \pi  t + \pi /4)} + 2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I determine whether it is period and its fundamental frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated! &lt;/p&gt;&#xA;" OwnerUserId="15672" LastEditorUserId="4346" LastEditDate="2015-05-01T18:46:55.847" LastActivityDate="2015-05-01T18:46:55.847" Title="Finding if a signal is periodic" Tags="|discrete-signals|periodic|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23104" PostTypeId="1" CreationDate="2015-05-01T20:35:01.770" Score="0" ViewCount="228" Body="&lt;p&gt;I have a set of ultrasonic frequency that I am playing and I want to detect these particular set of known frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already used fft but it is quite processing intensive and I am facing problem when I implemented it in real-time. Then I used Goertzel algorithm with threshold values which worked fine in real-time when the fundamental frequencies where the known frequencies but once these frequencies were played alongside other frequencies (noise), which were sometimes more prominent than the ultrasonic ones, the ultrasonic ones expectedly did not cross the threshold and did not get detected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other algorithm which I can try for my requirement given that I just want to detect known set of frequencies and is not that computation intensive like fft?&lt;/p&gt;&#xA;" OwnerUserId="15673" LastActivityDate="2015-05-02T08:57:12.247" Title="How can I detect known frequencies using most efficient algorithm" Tags="|fft|dft|algorithms|pitch|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23105" PostTypeId="1" CreationDate="2015-05-01T22:24:09.467" Score="2" ViewCount="173" Body="&lt;p&gt;Many papers using blind source separation algorithms solve the inherent scale and permutation indeterminacies of the estimated mixing matrix using an &quot;optimal method&quot;, however this method is never explained. How does this work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8735" LastActivityDate="2016-01-27T12:26:08.557" Title="Solving Scale and Permutation indeterminacies in Blind Source Separation" Tags="|source-separation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23106" PostTypeId="1" AcceptedAnswerId="23109" CreationDate="2015-05-02T05:23:18.980" Score="3" ViewCount="5580" Body="&lt;p&gt;I want to know how to estimate the noise of an image?&lt;/p&gt;&#xA;&lt;p&gt;Also is this represent the camera's noise?&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know how to estimate the noise of an image or camera?&lt;/p&gt;&#xA;&lt;h1&gt;Update:&lt;/h1&gt;&#xA;&lt;p&gt;Especially, I want to know about the A, B, C from as following.&#xA;How Can I plot these A, B,C curve?&#xA;Also I want to know what is C. What does C mean?&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ffQkw.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-11-23T12:29:27.733" Title="How to Estimate the Noise of an Image / Estimation of the Noise in an Image?" Tags="|noise|image-processing|estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23108" PostTypeId="2" ParentId="23105" CreationDate="2015-05-02T07:34:38.170" Score="1" Body="&lt;p&gt;What i know in implementations of BSS (e.g jade) is that they first normalise the input data (to variance = 1) and then order the data according to scale. So this is unique and will produce consistent output ordering for the same input data (will add references shortly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have in mind however that this is &lt;strong&gt;just a consistent heuristic&lt;/strong&gt; (any consistent heuristic will do) as BSS methods by definition are clue-less about scaling and permutation of the inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References of permutation problem for &lt;a href=&quot;http://www.tsi.enst.fr/~cardoso/Algo/Jade/jadeR.m&quot; rel=&quot;nofollow&quot;&gt;jade&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following heuristic is described in the comments section of the matlab version of jade:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Usage: &#xA;%   * If X is an nxT data matrix (n sensors, T samples) then&#xA;%     B=jadeR(X) is a nxn separating matrix such that S=B*X is an nxT&#xA;%     matrix of estimated source signals.&#xA;%   * If B=jadeR(X,m), then B has size mxn so that only m sources are&#xA;%     extracted.  This is done by restricting the operation of jadeR&#xA;%     to the m first principal components. &#xA;%   * Also, the rows of B are ordered such that the columns of pinv(B)&#xA;%     are in order of decreasing norm; this has the effect that the&#xA;%     `most energetically significant' components appear first in the&#xA;%     rows of S=B*X.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8867" LastEditorUserId="8867" LastEditDate="2015-05-02T07:41:48.187" LastActivityDate="2015-05-02T07:41:48.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23109" PostTypeId="2" ParentId="23106" CreationDate="2015-05-02T07:50:06.060" Score="1" Body="&lt;p&gt;There are various methods to estimate the noise of a signal (or adapt a threshold to be used later in PCA for example). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are adaptive methods and statistical methods. Statistical methods employ a statistical model of the noise and estimate from the data, while adaptive methods iteratively filter the data until a certain threshold of (reduced signal) accuracy is reached. These are just generalities of the most used approaches. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following references deal (mostly) with images from cameras:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://msr-waypoint.com/pubs/75593/Liu-CVPR06.pdf&quot; rel=&quot;nofollow&quot;&gt;Noise Estimation from a Single Image&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://research.microsoft.com/en-us/um/people/larryz/04359321.pdf&quot; rel=&quot;nofollow&quot;&gt;Automatic Estimation and Removal of Noise from a Single Image&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://ecs.utdallas.edu/loizou/speech/noise_estim_article_feb2006.pdf&quot; rel=&quot;nofollow&quot;&gt;A noise-estimation algorithm for highly non-stationary environments&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8867" LastActivityDate="2015-05-02T07:50:06.060" CommentCount="20" ContentLicense="CC BY-SA 3.0" />
  <row Id="23110" PostTypeId="2" ParentId="23099" CreationDate="2015-05-02T08:02:31.460" Score="1" Body="&lt;p&gt;Actually the Fourier transform (and similar transforms like Laplace, and so on ) is not an area calculation, but a &lt;strong&gt;change of basis&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is more intuitive if you see a (continous or discrete) signal $x$ as a vector expressed in some basis (the time-domain basis). i.e&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x = \sum a^i x_i$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then by linear algebra a change of basis is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = \sum b^i y_i$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ and $b$ basis coefficients are related through a linear transformation. Now go to the continous limit (so sums become integrals) and use the roots of unity (i.e $e^{2\pi\omega t}$) as basis components and you have the Fourier transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see it is not related to an area under the signal curve, but it is a linear change a of basis to another (the frequency) domain. This domain encodes the signal in such a way that further information can be extracted more easily (change of signal representation)&lt;/p&gt;&#xA;" OwnerUserId="8867" LastActivityDate="2015-05-02T08:02:31.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23111" PostTypeId="2" ParentId="23104" CreationDate="2015-05-02T08:57:12.247" Score="1" Body="&lt;p&gt;A better way to use a Goertzel filter, than with a fixed threshold, is to compare a narrow-band Goertzel filter output with the energy of the total signal or a wider bandwidth Goertzel filter.  Look for a peak statistically above a level corresponding to the wider noise energy level.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-05-02T08:57:12.247" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23113" PostTypeId="1" AcceptedAnswerId="23434" CreationDate="2015-05-02T13:02:50.590" Score="0" ViewCount="1709" Body="&lt;p&gt;I'm developing an Android app which uses USB soundcard for input and output. The audio processes are in the native (C++) side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The device's bit resolution is 16. I get the audio stream from the device as &lt;code&gt;unsigned char*&lt;/code&gt; and have to convert them to &lt;code&gt;float&lt;/code&gt; between -1.0f and +1.0f to process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do the conversion but it sounds like bit crushing effect if I increase the volume of input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I do when converting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Input Conversion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/*** buffer is an array of float ***/&#xA;/*** temp_buffer_in is the buffer coming from the device ***/&#xA;&#xA;float divider = (float) std::pow(2, (BIT_RESOLUTION_IN - 1));&#xA;int BYTE_RESOLUTION_IN = BIT_RESOLUTION_IN / (sizeof(char) * 8);&#xA;int bytes = buffer_size * BYTE_RESOLUTION_IN; //Buffer size in bytes&#xA;&#xA;for (i = 0, j = 0; i &amp;lt; bytes; i += BYTE_RESOLUTION_IN, j++) {&#xA;&#xA;    UnionInteger16 union_int; // Union structure below&#xA;    union_int.i = 0;&#xA;&#xA;    for (int k = 0; k &amp;lt; BYTE_RESOLUTION_IN; k++) {&#xA;            union_int.c[k] = temp_buffer_in[i + k];&#xA;    }&#xA;&#xA;    buffer[j] = (float) union_int.i;&#xA;&#xA;    buffer[j] = buffer[j] / divider;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For Output Conversion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/*** temp_buffer_out is the buffer sent to the device ***/&#xA;&#xA;float multiplier = (float) std::pow(2, (BIT_RESOLUTION_OUT - 1));&#xA;int BYTE_RESOLUTION_OUT = BIT_RESOLUTION_OUT / (sizeof(char) * 8);&#xA;int bytes = buffer_size * BYTE_RESOLUTION_OUT;&#xA;&#xA;for (i = 0, j = 0; i &amp;lt; bytes; i += BYTE_RESOLUTION_OUT, j++) {&#xA;&#xA;    if (buffer[j] &amp;gt;= 0) {&#xA;        buffer[j] = buffer[j] * (multiplier - 1.0f);&#xA;    } else {&#xA;        buffer[j] = buffer[j] * multiplier;&#xA;    }&#xA;&#xA;&#xA;    UnionInteger16 union_int; // Union structure below&#xA;    union_int.i = (int16_t) buffer[j];&#xA;&#xA;    for (int k = 0; k &amp;lt; BYTE_RESOLUTION_OUT; k++) {&#xA;        temp_buffer_out[i + k] = union_int.c[k];&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use Union for converting &lt;code&gt;unsigned char&lt;/code&gt;s to &lt;code&gt;int16_t&lt;/code&gt; and then to &lt;code&gt;float&lt;/code&gt;. Here is the union structure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;union UnionInteger16 {&#xA;    int16_t i;&#xA;    uint8_t c[2];&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Everything looks fine in the code but as I mentioned, the audio sounds like bit crushing when the input volume is increased and when the volume is decreased, the audio starts to disappear. I think I lost the dynamic range of the audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long question. I would be grateful if you help me. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="15678" LastEditorUserId="15678" LastEditDate="2015-05-02T13:08:45.823" LastActivityDate="2015-05-16T11:41:36.163" Title="16 bit PCM Audio Sounds Like Bit Crushing" Tags="|c++|bitdepth|" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23115" PostTypeId="1" CreationDate="2015-05-02T14:57:25.890" Score="2" ViewCount="133" Body="&lt;p&gt;I'm trying to implement an iterated filter bank as described in the &lt;a href=&quot;http://polyvalens.pagesperso-orange.fr/clemens/wavelets/wavelets.html#section8&quot; rel=&quot;nofollow noreferrer&quot;&gt;Subband coding chapter of the Really Friendly Guide to Wavelets&lt;/a&gt;. However, the text seems to suggest that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The advantage of this scheme is that we have to design &lt;strong&gt;only two filters&lt;/strong&gt;, the disadvantage is that the signal spectrum coverage is fixed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My understanding of filter design is that their frequency response is relative to the Nyquist frequency (so the sampling frequency too), so if I design a lowpass filter that halves the spectrum, simply applying it again will just increase the effective order of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So did the text perhaps leave out a decimation step? I could imagine that this would work if I decimated the lowpassed signal with a factor of 2 and then applied it again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't want to perform decimation in my application (something like wavelet analysis, but just with IIR filters), so my present understanding is that I'll have to design $n$ filters to get such $2^n$ subbands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preferably, I'd like to implement it in Python using the &lt;code&gt;scipy.signal&lt;/code&gt; module. It will be applied to discrete signals with a constant sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: As discussed in this &lt;a href=&quot;https://dsp.stackexchange.com/a/3183/15679&quot;&gt;answer to a related question&lt;/a&gt;, it seems I can create the highpass signal by subtracting the lowpass signal from the original, because I'm using forward-backwards application (Python function &lt;code&gt;scipy.signal.filtfilt&lt;/code&gt;) that results in zero phase delay.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-05-05T06:07:01.250" Title="How many different filters are needed for in an iterated filter bank?" Tags="|filter-design|lowpass-filter|python|highpass-filter|filter-bank|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23117" PostTypeId="1" AcceptedAnswerId="23119" CreationDate="2015-05-02T16:26:59.423" Score="0" ViewCount="124" Body="&lt;p&gt;In the image below there is the waveform of a clean, strummed guitar note, where the absolute value of the amplitude values has been taken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the point marked there is a momentary spike in amplitude before the continuation of the downward trend (there are a few other points like this in the waveform). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if anyone knew how I can describe the reason for this? I assume it's just to do with the random nature of playing an analogue instrument - sometimes the string is going to vibrate in such a way that amplitude isn't going to strictly decrease in amplitude through time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2hoLv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15681" LastActivityDate="2015-05-02T18:50:29.210" Title="What is the reason for &quot;random&quot; spikes in amplitude of a guitar waveform?" Tags="|music|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23118" PostTypeId="1" CreationDate="2015-05-02T17:26:32.697" Score="1" ViewCount="54" Body="&lt;p&gt;I have an image (that is a matrix), let's say of dimensions NxN. I then want to expand this matrix into M basis matrices (for the moment I'm still unsure how many M of these basis matrices I should assume) of the same dimensions NxN, that is analog to basis expansion of a vector into basis vectors. But as for the base matrices, I want them to be either only the translation (fixed scaling) or only the scaling (fixed translation) of a given mother basis matrix. Is such an expansion justifiable, or probably even feasible in the first place? I'm interested in searching for a set of basis matrices whose corresponding expansion coefficients form a sparse vector.&lt;/p&gt;&#xA;" OwnerUserId="15509" LastEditorUserId="15509" LastEditDate="2015-05-02T17:50:25.737" LastActivityDate="2015-05-02T17:50:25.737" Title="Matrix expansion into bases" Tags="|wavelet|matrix|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23119" PostTypeId="2" ParentId="23117" CreationDate="2015-05-02T18:50:29.210" Score="2" Body="&lt;p&gt;The strummed string is exchanging energy, not only with the atmosphere and internal heating, but with the guitar's bridge, nut, body and other strings.  Those sources can then resonate and exchange energy back to the strummed string, modulating the vibration's amplitude. This is part of what makes an actual stringed instrument sound more interesting that a simple ADSR waveform synth.  The effect can be even stronger on a 12-string guitar or a grand piano.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-05-02T18:50:29.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23120" PostTypeId="1" CreationDate="2015-05-02T20:20:16.443" Score="2" ViewCount="287" Body="&lt;p&gt;I have a question for you that maybe you could give me a clue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to make a CBIR (Content-Based Image Retrieval), so I query an image and I get the most similar, not classified within a database of around 2000 images. I'm trying to extract features and matching them by euclidean distance but I was going to try to train them with the framework called &lt;a href=&quot;http://caffe.berkeleyvision.org/&quot; rel=&quot;nofollow&quot;&gt;Caffe&lt;/a&gt;, for deep learning (neural networks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what I've done is taking 10 samples per every image by 3d projection (so I take the image 635.jpg and I make 635_1.jpg and so on to 635_10.jpg) and I use the original image 635.jpg as validation data.&#xA;So if there are 2000 images, I use 20.000 images for training and 2.000 images for validation into 2.000 clases... do you think it's a good idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Although I've been trying, I wasn't still able to train on Caffe due to the high quantity of errors in the dependencies on Mac OSx. I will switch to Ubuntu and see what's wrong.&lt;/p&gt;&#xA;" OwnerUserId="10898" LastEditorUserId="7338" LastEditDate="2015-09-11T10:34:23.417" LastActivityDate="2017-05-04T03:10:49.890" Title="Opinion about this aproach on Machine Learning" Tags="|image-processing|computer-vision|machine-learning|cbir|deep-learning|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23121" PostTypeId="1" CreationDate="2015-05-02T21:47:48.747" Score="2" ViewCount="5137" Body="&lt;p&gt;I have segmented CT images, something like the following one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/umMzt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to get a convex hull that contains all the white regions.&#xA;Something like this circle, but more fitting, and of course not necessarily a cicle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y19Hq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already tried this example &lt;a href=&quot;https://stackoverflow.com/questions/11813352/finding-the-convex-hull-of-an-object-in-opencv&quot;&gt;https://stackoverflow.com/questions/11813352/finding-the-convex-hull-of-an-object-in-opencv&lt;/a&gt; but I've only got this output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jZSjN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15684" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-11-27T08:42:09.847" Title="get convex hull of isolated shapes with openCV/C++" Tags="|image-processing|opencv|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23122" PostTypeId="1" AcceptedAnswerId="23131" CreationDate="2015-05-02T22:55:01.800" Score="1" ViewCount="223" Body="&lt;p&gt;I want to approximate below signal using Fourier series on Matlab.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/lYbhF.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;My code is below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;close all&#xA;clear all&#xA;clc&#xA;a_0 = 0&#xA;t=-10:0.001:10&#xA;x_t = 2/5&#xA;T = 10;&#xA;w0 = 2*pi/T&#xA;numOfTerms = 100&#xA;plot(t, x_t);&#xA;&#xA;for k=1:numOfTerms-1&#xA;   a_k = (1/(w0*i*k*T))*(  exp(-1*i*k*w0)-exp(-3*i*k*w0)+ exp(-7*i*k*w0)- exp(-9*i*k*w0))&#xA;   x_t = x_t + a_k * exp(i*k*w0*t)&#xA;   plot(t, x_t);&#xA;   title(['Number Of Terms = ',num2str(k+1)]);&#xA;   pause(0.1);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/g67YW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;You see that min point of this signal above zero and max point below 1. How can I solve this problem? Why it gives such result?&lt;/p&gt;&#xA;" OwnerUserId="15032" LastEditorUserId="7092" LastEditDate="2021-03-07T01:24:27.763" LastActivityDate="2021-03-07T01:24:27.763" Title="Why does this Fourier series give lower amplitude for max value of signal?" Tags="|matlab|continuous-signals|fourier-series|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23123" PostTypeId="1" AcceptedAnswerId="23125" CreationDate="2015-05-02T23:01:55.190" Score="1" ViewCount="1439" Body="&lt;p&gt;I applied the kernel below to the picture for unsharp masking&lt;img src=&quot;https://i.stack.imgur.com/FuhWb.jpg&quot; alt=&quot;Original picture&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;k = [-1 -1 -1; -1 8 -1; -1 -1 -1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I got !&lt;img src=&quot;https://i.stack.imgur.com/iD2IF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I changed 8 to 14. And I got &lt;img src=&quot;https://i.stack.imgur.com/1Gwqs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;How does kernel work for unsharp masking the original picture and what does exactly do the number in the middle ?&lt;/p&gt;&#xA;" OwnerUserId="15685" LastActivityDate="2015-05-03T02:13:50.397" Title="How does kernel work in unsharp masking?" Tags="|image-processing|matlab|filtering|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23125" PostTypeId="2" ParentId="23123" CreationDate="2015-05-03T02:13:50.397" Score="0" Body="&lt;p&gt;The first kernel that you gave,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left[ \begin{array}{ccc} -1 &amp;amp;&amp;amp;-1 &amp;amp;&amp;amp;-1 \\&#xA;-1 &amp;amp;&amp;amp; 8 &amp;amp;&amp;amp; -1 \\&#xA;-1 &amp;amp;&amp;amp;-1 &amp;amp;&amp;amp;-1 \end{array} \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is interpreted as follows: for each pixel in the image, take 8 times its value (hence the 8 in the center of the kernel) and then subtract the values of all the 8 neighboring pixels (hence all of the surrounding -1 values). This is a form of a highpass filter, which tends to accentuate edges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about what you get if you were to run this kernel over a patch of a constant color. If the region has a uniform color, then it doesn't contain any edges. The kernel above would yield a value of zero when applied to a 3-by-3 pixel block that has the same color, which is desirable. Not only is the filter highpass, it also completely attenuates zero frequency, which is also good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you change the center value to 14 instead of 8, it no longer has the property where it will output zero when applied to a region of constant color. Essentially, the kernel will have a different spatial frequency response, which leads to the differences in the second output image.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-05-03T02:13:50.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23126" PostTypeId="1" AcceptedAnswerId="23127" CreationDate="2015-05-03T04:51:14.493" Score="-1" ViewCount="3242" Body="&lt;p&gt;I am a beginer. I have read that any given signal whether it is simple or complex one,can be represented as summation of orthogonal basis functions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, what the terms &lt;strong&gt;Orthogonal&lt;/strong&gt; and &lt;strong&gt;Basis function&lt;/strong&gt;s denote in case of signals?&lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-05-12T08:31:06.513" LastActivityDate="2015-05-12T08:31:06.513" Title="What the terms Basis functions and Orthogonal denote in case of signals?" Tags="|signal-analysis|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23127" PostTypeId="2" ParentId="23126" CreationDate="2015-05-03T05:20:03.613" Score="4" Body="&lt;p&gt;If you think of a signal as a function of time $s(t)$ ($t$ could be a continuous variable or a discrete one $t_n$) that satisfies certain criteria, it can be thought of as a vector in some vector space of functions. It depends which vector space you want to use (e.g. $L^2$ or tempered distributions), but as most signals are finite and limited in space and/or time, it's usually safe to assume that they satisfy the criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that most rules from linear algebra can be used. Most importantly, a vector can be decomposed into a linear combination of basis vectors. An analog of standard basis vectors are shifted $\delta$ functions. If the basis vectors are orthonormal, the coefficients in the linear combination will be scalar products of the basis vector and the vector being decomposed. These coefficients are then known as Fourier coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I suggest you revise your knowledge of linear algebra (mainly basis vectors, scalar product) and then try to look at functions as vectors and it will all fall into place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: to answer the &quot;physical significance&quot; part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can attribute some meaning or behavior to basis functions in your system, then knowing how the signal is composed of them tells you how &quot;similar&quot; (but only in the linear sense of cross-correlation) it is to certain behaviors or patterns.&#xA;A common example are the $\sin(mt)$ and $\cos(mt)$ basis functions used in Fourier analysis. In most physical systems they represent oscillation modes and if you can decompose a signal into these modes, you can understand it in terms of oscillation modes. That's pretty much what spectrograms do.&#xA;In case of wavelets you can think of them as waveform packets that tell you not only what oscillation mode was present, but also where and/or when.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: an intuitive way to look at functions as vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think of a function as a mapping from one set to another (usually $\mathbb{R} \rightarrow \mathbb{R}$), simple array vectors are actually functions that map $\hat n = \{1, \dots, n\}$ onto $\mathbb C$ or $\mathbb R$. So you can imagine continuous functions as vectors that have so many elements that their length becomes infinite and the spacing between the element indices goes to zero, forming a &quot;continuous&quot; vector. This also means that in most formulas in linear algebra summations turn into integrals (they were always integrals, but the integration set was changed from $\hat n$ to $\mathbb R$). Of course, all this is much more complicated if done rigorously, because integrals as infinite sums can introduce infinite results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a little simpler with finite discrete signals of length $N$ because then it's simple to look at them as array vectors of length $N$. However, any formulas derived for continuous signals might introduce edge defects.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastEditorUserId="15679" LastEditDate="2015-05-03T06:25:24.133" LastActivityDate="2015-05-03T06:25:24.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23130" PostTypeId="2" ParentId="23122" CreationDate="2015-05-03T09:33:14.987" Score="2" Body="&lt;p&gt;I have simulated on my computer, and I found that when I added the negative frequency terms, the result was correct. &lt;/p&gt;&#xA;" OwnerUserId="15686" LastEditorUserId="7092" LastEditDate="2015-05-03T16:16:30.787" LastActivityDate="2015-05-03T16:16:30.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23131" PostTypeId="2" ParentId="23122" CreationDate="2015-05-03T09:54:36.310" Score="3" Body="&lt;p&gt;The formula for the Fourier series is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{k=-\infty}^{\infty}c_ke^{jk\omega_0 t}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only use the non-negative indices $k$, but you must also use the negative ones. Since your signal $x(t)$ is real-valued, you can in fact compute everything using only the positive indices, but then you must take two times the real part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=c_0+2\Re\left\{\sum_{k=1}^{\infty}c_ke^{jk\omega_0 t}\right\}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you must add the DC term $c_0$ separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the corresponding Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;t=-10:0.001:10;&#xA;x_t = 0;&#xA;T = 10;&#xA;w0 = 2*pi/T;&#xA;numOfTerms = 100;&#xA;&#xA;&#xA;for k=1:numOfTerms-1&#xA;   a_k = (1/(w0*i*k*T))*(  exp(-1*i*k*w0)-exp(-3*i*k*w0)+ exp(-7*i*k*w0)- exp(-9*i*k*w0));&#xA;   x_t = x_t + a_k * exp(i*k*w0*t);&#xA;end&#xA;&#xA;x_t = 2*real(x_t) + 2/5;&#xA;&#xA;plot(t,x_t);&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cJR9d.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-03T10:43:35.070" LastActivityDate="2015-05-03T10:43:35.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23132" PostTypeId="1" CreationDate="2015-05-03T10:34:08.917" Score="0" ViewCount="168" Body="&lt;p&gt;I have a basic question about stochastic processes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;When some informations such as wss, uncorraleted sampled, white about random signal (say x[n]) are given, what do we exactly have?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;For example white information:&lt;/em&gt;&lt;/strong&gt;&#xA;I know if x[n] is white, its power density function $ P_{x}(e^{j\omega}) $ is constant value independent of $ \omega $. I suppose it means autocorrelation function of x[n] consists of dirac? (I am not sure here, If I am wrong, please correct me). &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;Uncorraleted samples:&lt;/em&gt;&lt;/strong&gt; I know if the random signal is uncorrelated, its covariance equals to zero which means its autocorrelation equals to square of its mean. But uncorraleted samples means this, or something else?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;What about wss?:&lt;/em&gt;&lt;/strong&gt; I know if the signal is wss, mean (average) of x[n] is constant which is useful information when $ x_{c}(t) $ (constinuous time form of x[n]) and its means are given and we can say directly mean of x[n] is the same as mean of $ x_{c}(t) $. Moreover, we have $ \phi_{x}[m]  =  \phi_{x_{c}}[mT] $ where T is the sampling period and $ \mu_{x_{c}}^{2} = \mu_{x}^{2} $ where $ \mu $ is the power of the signals (second moment).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any correction, addition, comment would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Pass through an example may be more convenient:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have a system like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YXUVo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where, x[n]: wss, $ \eta_{x} = 0 $ (mean value), uncorrelated samples, $ \sigma_{x}^{2} $ and h[n] are given.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to calculate $ \eta_{y}[m] $ the mean, $ \phi_{y}[m] $ the autocorrelation and $ \mu_{y}[m] $ the average power of y[n]?&lt;/li&gt;&#xA;&lt;li&gt;How to calculate $ \eta_{v}[m] $ the mean, $ \phi_{v}[m] $ the autocorrelation and $ \mu_{v}[m] $ the average power of v[n]?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12045" LastEditorUserId="12045" LastEditDate="2015-05-03T15:47:44.730" LastActivityDate="2015-05-03T15:47:44.730" Title="Properties of Stochastic Processes" Tags="|discrete-signals|signal-analysis|continuous-signals|stochastic|" AnswerCount="1" CommentCount="2" ClosedDate="2015-05-05T01:43:33.177" ContentLicense="CC BY-SA 3.0" />
  <row Id="23133" PostTypeId="2" ParentId="23126" CreationDate="2015-05-03T11:48:02.113" Score="1" Body="&lt;p&gt;The X and Y axis can be used to describe any point in an XY plane.  Thus any non-zero vector in the X direction and one in the Y direction can be used in a linear combination to describe any point in that space.  That linear combination is separable if the two basis vectors are orthogonal.  Or you can turn or translate that XY pair to create other orthogonal basis vector pairs for that plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In frequency space, consider a 2 point DFT.  the average and difference (DC + Nyquist) in the frequency domain can be used in a separable linear combination to describe any 2 samples in the time domain, thus can be used to form an orthogonal basis pair.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-05-03T11:59:16.250" LastActivityDate="2015-05-03T11:59:16.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23135" PostTypeId="2" ParentId="18365" CreationDate="2015-05-03T12:44:31.433" Score="2" Body="&lt;p&gt;I have been working on a similar problem of detection of rectangular contours that may also be fragmented or incomplete. In my case the application is detection of so called livestock enclosures in remotely sensed image, see &#xA;Web: &lt;a href=&quot;https://www.mmsp.uni-konstanz.de/research/projects/completed-research-projects/detection-of-archaeological-sites-in-high-resolution-remotely-sensed-imagery/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mmsp.uni-konstanz.de/research/projects/completed-research-projects/detection-of-archaeological-sites-in-high-resolution-remotely-sensed-imagery/&lt;/a&gt;&#xA;On this website you can find a sequence of papers on that topic, but you might be mostly interested in the latest one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is even harder because these contours are faint, may be incomplete or fragmented and appear on complex cluttered background. As you have mentioned there is no on-the-shelf algorithm for detection of “real” distorted rectangles of various sizes. You are also very right saying that rectangles are too simple – not enough distinctive for algorithms that detect more complex unique shapes. This is especially true if you have complex background. Another problem with many already developed algorithms is the necessity for the large number of training examples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approach I have developed (see the web site for details) is tailored to my task of detection of individual rectangular contours in large images. It may be too sensitive for other applications with many close to each other rectangles. In that case it may detect false rectangles in between real ones if they are sufficiently aligned.&lt;/p&gt;&#xA;" OwnerUserId="15690" LastEditorUserId="26407" LastEditDate="2019-11-20T17:08:19.170" LastActivityDate="2019-11-20T17:08:19.170" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23136" PostTypeId="2" ParentId="23132" CreationDate="2015-05-03T13:41:32.613" Score="1" Body="&lt;p&gt;As pointed out in the comments, this question is rather broad, so here I will just answer your last question about the autocorrelation of the output signal $y[n]$. You might know the following relation concerning the power spectra of input and output sequences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_y(\omega)=S_x(\omega)|H(\omega)|^2\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(\omega)$ is the frequency response of the LTI system. From the inverse Fourier transform of (1) you get a corresponding relation between the autocorrelation functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi_y[m]=\phi_x[m]\star h[m]\star h^*[-m]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h[m]$ is the system's impulse response, and $\star$ denotes convolution.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-03T13:41:32.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23137" PostTypeId="1" AcceptedAnswerId="23146" CreationDate="2015-05-03T14:41:54.790" Score="0" ViewCount="863" Body="&lt;p&gt;A digital low pass Butterworth filter that has been designed using Bi-linear transformation has been a pole at $z=0.6$. It is also known that the filter's attenuate (at digital frequency) $\omega = 1.2$ is about $44$ dB. Find the filter order. Give at least one other pole of the digital filter (in Z domain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BMDxd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/O9PKe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15570" LastEditorUserId="4298" LastEditDate="2018-08-07T22:19:35.360" LastActivityDate="2018-08-07T22:22:40.347" Title="digital low pass Butterworth filter" Tags="|filters|filter-design|frequency-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23138" PostTypeId="1" CreationDate="2015-05-03T14:49:03.523" Score="1" ViewCount="341" Body="&lt;p&gt;Can anyone give me some hints to solve this problem&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HD6Qt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15570" LastEditorUserId="8140" LastEditDate="2015-05-04T02:17:54.450" LastActivityDate="2015-06-04T10:52:01.407" Title="DFT and FFT application in signal processing" Tags="|fft|homework|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23143" PostTypeId="1" CreationDate="2015-05-03T19:32:36.797" Score="2" ViewCount="160" Body="&lt;p&gt;The quadratic performance surface of an adaptive filter is a paraboloid. Its minimum can be found wherever the gradient is zero. However, since there are two types of paraboloids (elliptical and hyperbolic), is there a way to tell if the minimum detected is a global minimum or just a saddle point?&lt;/p&gt;&#xA;" OwnerUserId="14895" LastEditorUserId="128" LastEditDate="2018-07-07T22:03:11.170" LastActivityDate="2018-07-07T22:03:11.170" Title="Adaptive Filter Gradient Descent" Tags="|adaptive-filters|optimization|gradient|convex-optimization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23144" PostTypeId="1" CreationDate="2015-05-03T19:39:59.917" Score="1" ViewCount="643" Body="&lt;p&gt;Does anyone know of some simple algorithms to linearize the phase response of a filter. I have a notch filter with a non-linear phase response. I basically need an all pass filter (so that the magnitude response is unaffected) whose phase response is such that it neutralizes the non-linearity of the original filter.&lt;/p&gt;&#xA;" OwnerUserId="14895" LastActivityDate="2015-05-03T19:39:59.917" Title="Phase Linearization" Tags="|filter-design|linear-phase|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23145" PostTypeId="2" ParentId="23143" CreationDate="2015-05-03T19:43:10.660" Score="3" Body="&lt;p&gt;The quadratic surface is determined by the autocorrelation matrix of the data, which is always positive definite or positive semi-definite. This means that any stationary point is always a minimum. In the worst case, this minimum is not unique if the matrix is singular, but it can never be a saddle point.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-03T19:43:10.660" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23146" PostTypeId="2" ParentId="23137" CreationDate="2015-05-03T20:27:08.703" Score="0" Body="&lt;p&gt;I'll try to give you some hints to get you started. First of all, you should know that the bilinear transform is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s=k\frac{z-1}{z+1}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the analog prototype filter is normalized such that its cut-off frequency is $\Omega_c=1$, then the constant $k$ in (1) is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$k=\frac{1}{\tan\left(\frac{\omega_0}{2}\right)}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_0$ is the desired cut-off frequency of the discrete-time filter. Some more background on this is given in &lt;a href=&quot;https://dsp.stackexchange.com/questions/22726/my-butterworth-lowpass-formulas-do-not-agree-with-fisher-webpage/22770#22770&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also know that the poles of the normalized analog filter lie on a circle with radius $1$ centered at $s=0$ (of course the poles only lie on the left half of the circle). If the filter order is odd as in your example (why?), there must be a pole at $s=-1$. Now you can try to figure out how that pole is transformed to the $z$-plane, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{1+s}{\huge|}_{s=k\frac{z-1}{z+1}}=\ldots\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (3), knowing that that pole is transformed to a pole at $z=0.6$, you can determine the constant $k$, and from that, via Eq. (2), you can compute $\omega_0$. Now you know that the filter's attenuation is $3\text{ dB}$ at $\omega_0$, and it is $44\text{ dB}$ at $\omega=1.2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last thing you should know is that with a Butterworth lowpass filter of order $N$, you get approximately $6N\text{ dB}$ attenuation per octave, at least in the frequency range considered here. Now figure out how many octaves there are between $\omega_0$ and $\omega=1.2$, figure out how many dB's difference in attenuation there must be between those two frequencies, and from this compute an estimate of the filter order $N$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2018-08-07T22:22:40.347" LastActivityDate="2018-08-07T22:22:40.347" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="23147" PostTypeId="1" CreationDate="2015-05-03T21:06:39.700" Score="2" ViewCount="2797" Body="&lt;p&gt;Does anyone know of a way to design a filter with arbitrary magnitude and phase response in Matlab?&lt;/p&gt;&#xA;" OwnerUserId="14895" LastEditorUserId="4298" LastEditDate="2020-11-08T16:59:30.547" LastActivityDate="2020-11-08T16:59:30.547" Title="Design Filter with Arbitrary Magnitude and Phase Response in Matlab" Tags="|matlab|filters|filter-design|finite-impulse-response|infinite-impulse-response|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23148" PostTypeId="2" ParentId="23147" CreationDate="2015-05-03T21:18:41.783" Score="2" Body="&lt;p&gt;There's a PhD thesis with exactly this phrase in its title (including Matlab programs):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mattsdsp.blogspot.nl/p/phd-thesis.html&quot; rel=&quot;nofollow&quot;&gt;Algorithms for the Constrained Design of Digital Filters with Arbitrary Magnitude and Phase Responses&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-03T22:06:02.610" LastActivityDate="2015-05-03T22:06:02.610" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23149" PostTypeId="2" ParentId="23147" CreationDate="2015-05-04T01:13:52.237" Score="3" Body="&lt;p&gt;for FIR, the simplest way is to inverse FFT you two-sided complex frequency response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h[n] = \operatorname{iFFT} \left\{ H[k] \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(use a &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/kaiser.html&quot; rel=&quot;nofollow&quot;&gt;Kaiser window&lt;/a&gt; to window the FIR to a length that is acceptable to implement.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i presume you have access to &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/firpm.html&quot; rel=&quot;nofollow&quot;&gt;firpm( )&lt;/a&gt; and/or &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/firls.html&quot; rel=&quot;nofollow&quot;&gt;firls( )&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so first divide your complex frequency response into real and imaginary parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H_r[k] = |H[k]| \cos\left(\arg\{H[k]\} \right) $$&#xA;$$ H_i[k] = |H[k]| \sin\left(\arg\{H[k]\} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;send both $H_r[k]$ and $H_i[k]$ to the Parks-McClellan or Least Squares optimal FIR designer, but set &lt;code&gt;ftype&lt;/code&gt; to &lt;code&gt;'hilbert'&lt;/code&gt; for $H_i[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;sum the two resulting real-valued FIRs to get your result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;lastly, if you want to design an IIR to an arbitrary magnitude and phase spec, then that's a much bigger problem and consideration.  maybe use Prony to design to your impulse response $h[n]$ or use Matt's dissertation that i first learned of now, or use &lt;a href=&quot;http://apollo.ee.columbia.edu/spm/external/tipsandtricks/files/TandT_Jan2007.zip&quot; rel=&quot;nofollow&quot;&gt;Greg Berchin's FDLS&lt;/a&gt;.  i dunno.  no quick solution for you there.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-05-04T01:13:52.237" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23152" PostTypeId="1" CreationDate="2015-05-04T08:00:55.000" Score="3" ViewCount="9229" Body="&lt;p&gt;please can someone help me to define a method that allows me to estimate the power of noise in any signal?&#xA;the signal is received by usrp and the problem that it is variable all the time in the FM band so the noise is variable also with frequency and time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks in advance for any help&lt;/p&gt;&#xA;" OwnerUserId="15244" LastActivityDate="2015-07-03T17:55:13.723" Title="how to estimate the noise of a signal?" Tags="|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23154" PostTypeId="1" AcceptedAnswerId="23156" CreationDate="2015-05-04T09:47:28.727" Score="0" ViewCount="71" Body="&lt;p&gt;I'm attempting to construct a difference equation in matlab for the function u(n) and find the auto-correlation matrix R.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm following the technique as is defined by my text below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jOUUh.png&quot; alt=&quot;Correlation Matrix Technique&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system I'm trying to model is also defined by the text below. My a1 and a2 are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8tz2J.png&quot; alt=&quot;System Block Diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have it defined in Matlab as is shown below and included results for my auto-correlation matrix. Let me clarify that I know that technically R is wrong because I'm not computing the expected value. I hadn't figured out how to do that yet and am attempting to tackle what I perceive to be the larger problem first.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a1 = 0.1;&#xA;a2 = -0.72;&#xA;&#xA;m_max = 101; % Sample Length&#xA;&#xA;v = randn(1,m_max); % Create m samples of Gaussian white noise                &#xA;                % with 0 mean and unit variance&#xA;&#xA;u = zeros(1,m_max); % Temp matrix for input vector&#xA;&#xA;for n=3:m_max&#xA;    u(n) = v(n) - a1*u(n-1) - a2*u(n-2);&#xA;end&#xA;&#xA;n = [1:1:m_max]; % Reconstruct n matrix to plot&#xA;&#xA;u = transpose(u);&#xA;u_H = u';&#xA;&#xA;R = u*u_H; % Corrleation Matrix&#xA;&#xA;figure(1);&#xA;plot(v);&#xA;axis([1 m_max -5 5]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wVUQJ.png&quot; alt=&quot;Auto-Corr Matrix&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This runs without any problem, but the issue is that my first two values are always zero. This makes sense in context of the code because I made the zero, but I know conceptually my correlation matrix R, as is shown by image 1 above,should not be 0 for r(0). Because my for loop thought must start from 3 (because u(n-2) is not defined for n&amp;lt;3) I'll always have 0's in my R matrix. I suspect that I would need to know initial values but those aren't provided to me by the problem. Am I thinking about this incorrectly? Any help would be much appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="14943" LastEditorUserId="14943" LastEditDate="2015-05-04T09:53:17.937" LastActivityDate="2015-05-04T10:27:55.680" Title="Concepts Surrounding First Two Samples in Difference Equation" Tags="|filter-design|noise|autocorrelation|digital|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23156" PostTypeId="2" ParentId="23154" CreationDate="2015-05-04T10:27:55.680" Score="0" Body="&lt;p&gt;This is just the transient effect of the filter due to zero initial conditions. The &quot;solution&quot; is to throw away the first two zero samples of $u[n]$ because they are not related to the input noise signal $v[n]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-04T10:27:55.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23158" PostTypeId="1" AcceptedAnswerId="23219" CreationDate="2015-05-04T10:41:58.630" Score="0" ViewCount="1092" Body="&lt;p&gt;I have a signal, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 100;                                % Sample frequency (Hz)&#xA;t = 0:1/fs:10-1/fs;                      % 10 sec sample&#xA;x = (1.3)*sin(2*pi*15*t)                 % 15 Hz component&#xA;+ (1.7)*sin(2*pi*40*(t-2)) ;             % 40 Hz component&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when I take fft of x then its amplitude and phase spectrum are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YvZMC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QFruC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now if deliberately I will put the leading 10 values to zeros &lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(1:10) = 0;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then as per my understanding the frequency of the complete data set is not changed so the fft would not be changed. Which is supported by the amplitude fft response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XqIM4.png&quot; alt=&quot;FFT amplitude response after making leading values zero&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the phase plot is showing some strange result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/h2j30.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can some help me why the response is changed. Although they both are following the same equation. Also If I have a equation cos(2*pi&lt;em&gt;f&lt;/em&gt;t) and my t is from 3:Tp and before time =3sec the response is zero, then will it not have the same response as t:0:Tp.&lt;/p&gt;&#xA;" OwnerUserId="15313" LastActivityDate="2015-05-07T10:23:15.133" Title="FFT of signal with starting value zeros" Tags="|matlab|fft|dft|phase|zero-padding|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23159" PostTypeId="2" ParentId="23152" CreationDate="2015-05-04T10:44:57.600" Score="2" Body="&lt;p&gt;Noise floor estimation is usually done after applying an FFT to windowed data segments. By tracking the noise floor in each frequency band, the frequency dependence of the noise is taken into account. If the noise is non-stationary, its time dependence can be tracked by regularly updating the noise floor estimate in each frequency band. This usually requires the noise to vary more slowly than the desired signal. Have a look at &lt;a href=&quot;http://www.researchgate.net/publication/220656273_Noise_Tracking_Using_DFT_Domain_Subspace_Decompositions&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; to get an idea of how it can work, and also look at the references therein. Search the web for &quot;noise floor estimation&quot; and &quot;noise floor tracking&quot; to find many more papers on the subject.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-04T10:44:57.600" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23160" PostTypeId="1" CreationDate="2015-05-04T13:06:01.100" Score="0" ViewCount="197" Body="&lt;p&gt;In &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilinear_transform#Example&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Bilinear_transform#Example&lt;/a&gt;, digital version of simple RC low-pass filter is presented:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1 + z^{-1}}{(1 + 2RC / T) + (1 - 2RC / T) z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is sampling interval. Let me reorganize by $A = 2RC/T$, and get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) = \frac{x(n) + x(n-1)+(A-1)y(n-1)}{A+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I cannot see how I would get transient and steady response back from this difference equation. Can anyone help here?&lt;/p&gt;&#xA;" OwnerUserId="15702" LastActivityDate="2015-06-04T09:56:48.067" Title="transient response of simple digitalized RC low-pass filter" Tags="|filters|sampling|lowpass-filter|z-transform|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23161" PostTypeId="1" AcceptedAnswerId="23183" CreationDate="2015-05-04T14:34:44.427" Score="1" ViewCount="925" Body="&lt;p&gt;I don't even know how to start. We're supposed to find the differential equations that links $V_{in}$, $V_{out}$, and $V_{io}$, as well as the values of $C_1$, $C_2$ and $R$ so the filter works in the audible spectrum. We're allowed to use Fourier transform, if that simplifies anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.gyazo.com/5e7b1a1a6dfde8e13295a61be738c482.png&quot; alt=&quot;This is the circuit&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of splitting the band pass filter as a high pass at first, and a low pass after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way I can relate $V_{io}$ with $V_{in}$, and $V_{out}$, with $V_{io}$, in two different equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing that... the results were:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$RC \frac{\mathrm{d} Vin(t)}{\mathrm{d} t} = Vio(t) + RC \frac{\mathrm{d} Vio(t)}{\mathrm{d} t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the &lt;strong&gt;high pass filter&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Vio(t) = Vout(t) + RC \frac{\mathrm{d} Vout(t)}{\mathrm{d} t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the &lt;strong&gt;low pass filter&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, using..&#xA;$fc = \frac{1}{2 \pi R C}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the audible frequency, it'd be between $20$ hz- $20$ KHZ. So using that, I should be able to express both $C_1$ and $C_2$ as a function of $R$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;strong&gt;how do I actually determinate the value of $R$ required?&lt;/strong&gt; or do I assume a set value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's anything wrong, please let me know why. Thank you, have a nice day.&lt;/p&gt;&#xA;" OwnerUserId="15703" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:36.313" LastActivityDate="2015-05-04T21:21:50.690" Title="Find the Differential Equation of an Analog Band Pass Filter" Tags="|filters|frequency|fourier|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23163" PostTypeId="1" CreationDate="2015-05-04T14:51:02.757" Score="1" ViewCount="194" Body="&lt;p&gt;I measured that a 2-pole band pass filter, given imput audio of different frequencies, outputs an audio signal with different time delay. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At 440Hz, the time delay between of the input audio and the output audio is something in the order of (1/440)*200000 = 454 samples and at 1Khz it's about (1/1000)*200000 = 200 samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the theoretical correlation between filter peak frequency and the delay time of the output signal?&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2015-12-01T20:39:35.873" Title="What is sound output delay of a band pass filter at different freqencies?" Tags="|filters|frequency-spectrum|filter-design|bandpass|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23165" PostTypeId="1" AcceptedAnswerId="23186" CreationDate="2015-05-04T15:37:30.543" Score="1" ViewCount="889" Body="&lt;p&gt;I am a beginner in design of digital filters... I have just completed Coursera's Linear Circuits course!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal which is sampled at 50 Hz where the DC component has a value of 800000 and there is some noise with a standard deviation of around 200. The DC component should remain constant but it may change very slowly over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to design a simple FIR filter to obtain the DC component: would a simple weighted average algorithm be most appropriate? How do I go about choosing suitable coefficients?&lt;/p&gt;&#xA;" OwnerUserId="15705" LastEditorUserId="7092" LastEditDate="2015-05-04T15:50:33.753" LastActivityDate="2015-05-04T21:59:50.373" Title="Help choosing coefficients for a simple FIR filter to extract DC component" Tags="|filters|filter-design|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23166" PostTypeId="1" CreationDate="2015-05-04T16:15:51.443" Score="-1" ViewCount="835" Body="&lt;p&gt;Does anyone know what is the inverse function of &lt;code&gt;soundsc&lt;/code&gt; in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm playing a sound with a my PC microphone using &lt;code&gt;soundsc&lt;/code&gt;, and I want to capture it in another PC using the inverse function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for help.&lt;/p&gt;&#xA;" OwnerUserId="15706" LastEditorUserId="7092" LastEditDate="2015-05-04T17:19:36.170" LastActivityDate="2016-04-14T10:06:27.167" Title="Invert soundsc function in Matlab" Tags="|matlab|audio|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23167" PostTypeId="1" CreationDate="2015-05-04T16:20:15.303" Score="2" ViewCount="84" Body="&lt;p&gt;I want to generate the following periodic sequence:&#xA;h[n]={1,2,3,4,0,0,0,0,1,2,3,4,0,0,0,0,1,2...}.&#xA;I am planning to generate this as an impulse response of a filter with an order no more than 8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I start by finding the z transform of h[n] but this is infinite sequence and can't achieve an order less than 8. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hint will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15570" LastEditorUserId="4298" LastEditDate="2021-03-07T09:49:40.390" LastActivityDate="2021-03-07T09:49:40.390" Title="Filter impulse response order calculation" Tags="|filters|discrete-signals|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23168" PostTypeId="1" CreationDate="2015-05-04T16:20:31.470" Score="3" ViewCount="114" Body="&lt;p&gt;Suppose I have a sinusoidal signal of the form $x(t) = a\sin\left(2\pi b(t-c)\right) + d$.  I understand $a$ is the amplitude, $b$ is the wave number, and $c$ is the phase shift.  I know that the term $d$ shifts the entire signal vertically, but does it have a specific name in signal processing?  &lt;/p&gt;&#xA;" OwnerUserId="1330" LastEditorUserId="4298" LastEditDate="2015-05-04T18:05:47.940" LastActivityDate="2015-05-04T18:05:47.940" Title="Sinusoidal Wave Terminology" Tags="|terminology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23169" PostTypeId="2" ParentId="23167" CreationDate="2015-05-04T16:36:08.560" Score="2" Body="&lt;p&gt;You need a system with order $8$, because the period of the desired sequence is $8$. Obviously, you'll need a recursive system to generate such an infinite sequence. Since this looks like another homework problem, I won't write out the complete solution but I'll give you a few hints:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $g[n]=\{1,2,3,4,0,0,0,0\}$ be the first period of $h[n]$. Now note that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[n]=h[n]-h[n-8]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\mathcal{Z}$-transform of (1) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(z)=H(z)(1-z^{-8})\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{G(z)}{1-z^{-8}}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;follows. Now it only remains to find the $\mathcal{Z}$-transform $G(z)$ of $g[n]$. Then you can use Eq. (3) to compute $H(z)$ from $G(z)$. If you realize a filter with transfer function $H(z)$ (which is a recursive filter of order $8$), then its response to a unit impulse will equal the desired sequence $h[n]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-04T16:36:08.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23170" PostTypeId="2" ParentId="23168" CreationDate="2015-05-04T16:41:41.393" Score="1" Body="&lt;p&gt;It is usually called &lt;em&gt;DC offset&lt;/em&gt; or &lt;em&gt;DC component&lt;/em&gt;. Since you use $t$ as a variable, which suggests &quot;time&quot;, the quantity $b$ would normally be called &lt;em&gt;frequency&lt;/em&gt;. Also note that $c$ is not the phase but a time offset. The phase $\phi$ is usually defined as in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=A\sin(2\pi ft+\phi)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing (1) to your formula gives $\phi=-2\pi bc$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-04T16:41:41.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23171" PostTypeId="2" ParentId="23152" CreationDate="2015-05-04T16:51:54.970" Score="0" Body="&lt;p&gt;I'm not sure what you mean by &quot;noise&quot; and &quot;power&quot; in your specific case. A very general way of determining how noisy a signal is can be calculating the variance (square of the standard deviation, power is usually proportional to a square) within a window moving along the signal. This method works for signals where the noise has a distribution close to a Gaussian one. The length of the window depends on what time resolution you need, but a very short one may fail to approximate the variance well enough.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastActivityDate="2015-05-04T16:51:54.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23172" PostTypeId="2" ParentId="23138" CreationDate="2015-05-04T17:02:34.557" Score="1" Body="&lt;p&gt;I prefer to give tips by comments but i don't have the right jet…&#xA;on the questions a, c and e you have look to the delta between 2 frequencies.&#xA;what is the space between each frequency and how much is the delta frequency of you're sampled time.&#xA;Probably questions B,D and f also but i'm not for shure because that a bit more complicated and had never done it myself...&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2015-05-04T17:02:34.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23173" PostTypeId="1" CreationDate="2015-05-04T17:24:05.177" Score="3" ViewCount="851" Body="&lt;p&gt;It's a common problem that while talking with the another person on Smart phones with the help of regular headphones,we get very annoying sounds at background . The opposite person's voice gets mixed with full of such noise signals to such an extent that sometimes it becomes literally impossible to continue the conversation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which kind of noises could be possible in such situation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also,how do can we &lt;strong&gt;convert a regular (ordinary) headphone into a headphone which has ability cancel out or isolate these noise signals&lt;/strong&gt; to a maximum extent while listening voice on headphones and make conversation noise free?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:please consider any practical situation of your choice like opposite person(person on other) side is in silence zone area and you are walking on the road or travelling by the car or you are also in the silence zone.&lt;/p&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="9035" LastEditDate="2015-06-05T09:42:48.067" LastActivityDate="2016-04-30T18:26:17.747" Title="How do can we cancel out noises while listening voice on headphones?" Tags="|filters|filter-design|noise|estimation|voice|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23174" PostTypeId="2" ParentId="20424" CreationDate="2015-05-04T17:52:08.130" Score="1" Body="&lt;p&gt;DCT is not actually the step of compression in JPEG, as it was mentioned in other answers, it &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;computes/displays the amount and distribution of spectral components of the signal being transformed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;so, If you have an Image that is 64*64 bits, the result of DCT is also 64*64 matrix. BUT, since the right bottom part of the DCT outcome matrix contains only the highest frequencies, which for us-humans- can't not actually differ from a little higher or lower frequencies, so JPEG removes these frequencies and you will not observe that difference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;JPEG compression philosophy have applied what actually do the eyes of humans observe, if a baby Weight have gone from 3KG to 6KG you can observe that change and feel it, BUT, if your friends weight have changed from 78KG to 80KG you can't observe that change, that's because humans can observe change only on the low frequencies not the high ones.&#xA;after you remove these high frequencies , only then you have started to compress the photo(in JPEG there is still3 more steps to finish the compression and encoding process)&lt;/p&gt;&#xA;" OwnerUserId="15707" LastActivityDate="2015-05-04T17:52:08.130" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23175" PostTypeId="1" AcceptedAnswerId="23179" CreationDate="2015-05-04T18:43:03.927" Score="2" ViewCount="193" Body="&lt;p&gt;What is the difference between neural network and deep neural network in speaker recognition .Can i have  an example of code sur Matlab thank you&lt;/p&gt;&#xA;" OwnerUserId="15472" LastActivityDate="2015-05-04T21:14:08.567" Title="What is the difference between neural network and deep neural network. an example thank you" Tags="|speech-processing|" AnswerCount="1" CommentCount="0" ClosedDate="2015-05-05T01:42:59.460" ContentLicense="CC BY-SA 3.0" />
  <row Id="23176" PostTypeId="2" ParentId="23163" CreationDate="2015-05-04T18:53:07.343" Score="1" Body="&lt;p&gt;The lower the frequency, the longer the period of oscillation.  In any filter using memory (IIR or causal FIR), the filter will have to evaluate a signal for a longer period of time in order to gather information about the same number of periods of a lower frequency signal component than for a higher frequency signal component.  And a filter can't filter a particular spectral component unless it has gathered enough information about that spectral component to &quot;know&quot; whether that particular component is in the stop-band or pass-band, which takes longer (other factors being roughly equivalent) for a lower frequency signal component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you could design a linear phase FIR with the same delay for a lower frequency bandpass, but since it has gathered less periods of information about that lower frequency, it's quality of filtering (width of the transition band, etc.) will be less.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-01T20:39:35.873" LastActivityDate="2015-12-01T20:39:35.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23178" PostTypeId="2" ParentId="22985" CreationDate="2015-05-04T19:38:14.340" Score="1" Body="&lt;p&gt;You can just write $(2)$ in $y_t$, so it becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_t = \begin{bmatrix} b_1-a_1 &amp;amp;&amp;amp; -a_2\end{bmatrix} \begin{bmatrix} x_{a,t}\\ x_{b,t}\end{bmatrix} +\begin{bmatrix} 1 \end{bmatrix}u_t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, this representation is called controllable canonical form. However, your system is not strictly proper, so you need to split it as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(z)=\frac{z^2 + b_1 z}{z^2 + a_1 z + a_2} = 1 + \frac{(b_1 - a_1) z - a_2}{z^2 + a_1 z + a_2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See how the coefficients appear?&lt;/p&gt;&#xA;" OwnerUserId="15342" LastActivityDate="2015-05-04T19:38:14.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23179" PostTypeId="2" ParentId="23175" CreationDate="2015-05-04T20:44:34.177" Score="2" Body="&lt;p&gt;The difference resides in the number of perceptron neuron layers a nettwork is build on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neural Networks have as its base a perceptron. This is like a human neuron. The perceptron can weigh up different kinds of evidence in order to make decisions. And it should seem plausible that a complex network of perceptrons could make quite subtle decisions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neural networks have different layers of perceptrons. First layer of perceptrons make very simple decisions, by weighing the input evidence. What about the perceptrons in a second layer? Each of those perceptrons is making a decision by weighing up the results from the first layer of decision-making. In this way a perceptron in the second layer can make a decision at a more complex and more abstract level than perceptrons in the first layer. And even more complex decisions can be made by the perceptron in the third layer. In this way, a many-layer network of perceptrons can engage in sophisticated decision making.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, a small change in the weights or bias of any single perceptron in the network can sometimes cause the output of that perceptron to completely flip, say from 0 to 1. That flip may then cause the behaviour of the rest of the network to completely change in some very complicated way. So while your &quot;9&quot; might now be classified correctly, the behaviour of the network on all the other images is likely to have completely changed in some hard-to-control way. That makes it difficult to see how to gradually modify the weights and biases so that the network gets closer to the desired behaviour. Perhaps there's some clever way of getting around this problem. But it's not immediately obvious how we can get a network of perceptrons to learn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can overcome this problem by introducing a new type of artificial neuron called a sigmoid neuron. Sigmoid neurons are similar to perceptrons, but modified so that small changes in their weights and bias cause only a small change in their output. That's the crucial fact which will allow a network of sigmoid neurons to learn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The networks described are called feedforward neural networks. This means there are no loops in the network - information is always fed forward, never fed back. There are also other models of artificial neural networks in which feedback loops are possible. These models are called recurrent neural networks. The idea in these models is to have neurons which fire for some limited duration of time, before becoming quiescent. That firing can stimulate other neurons, which may fire a little while later, also for a limited duration. That causes still more neurons to fire, and so over time we get a cascade of neurons firing. Loops don't cause problems in such a model, since a neuron's output only affects its input at some later time, not instantaneously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Deep Neural networks involve a network of layers which breaks down a very complicated question - does this image show a face or not - into very simple questions answerable at the level of single pixels. It does this through a series of many layers, with early layers answering very simple and specific questions about the input image, and later layers building up a hierarchy of ever more complex and abstract concepts. Networks with this kind of many-layer structure - two or more hidden layers - are called deep neural networks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since 2006, a set of techniques has been developed that enable learning in deep neural nets. These deep learning techniques are based on stochastic gradient descent and backpropagation, but also introduce new ideas. These techniques have enabled much deeper (and larger) networks to be trained - people now routinely train networks with 5 to 10 hidden layers. And, it turns out that these perform far better on many problems than shallow neural networks, i.e., networks with just a single hidden layer. The reason, of course, is the ability of deep nets to build up a complex hierarchy of concepts. It's a bit like the way conventional programming languages use modular design and ideas about abstraction to enable the creation of complex computer programs.&lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-05-04T21:14:08.567" LastActivityDate="2015-05-04T21:14:08.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23180" PostTypeId="2" ParentId="23173" CreationDate="2015-05-04T20:48:56.583" Score="1" Body="&lt;p&gt;here is a great website on building &lt;strong&gt;noise cancelling headphones&lt;/strong&gt; &lt;a href=&quot;http://headwize.com/?page_id=684&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://headwize.com/?page_id=684&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The concept behind noise cancelling headphones is simple. You listen to the environment and then play it back 180 degrees out of phase. When the original wave and the shifted wave meet, they cancel eachother out&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bxAAg.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit is pretty simple. You have microphone go into an inverting amplifier, then you play it through the speaker (simplified version) This achieves noise cancellation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one major benefit of this solution is it is purely implemented in (analog) circuits. It doesn't require adaptive filtering, a decision engine, or any computing power. This type of circuit is what most commercial products use: Active filtering&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes the solution to the problem isn't what we expected. We can get into signal estimation, adaptive filtering, DSP boards or MCUs, or any number of complex mathematically rigorous constructs but really, all that's needed is an inverting amplifier. If you want a software solution please state so (and in that even we can go back to signal estimation and adaptive filters) but since you asked for practical solutions to actually convert regular headphones I have presented a hardware implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;unfortunately the original website seems to have vanished, but here is the same exact &lt;a href=&quot;http://www.transkommunikation.ch/dateien/schaltungen/diverse_schaltungen/audio_circuits/Headwize%20noise-canceling%20headphones.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;content in a PDF&lt;/a&gt; I include the full article because it has parts lists, some helpful troubleshooting tips, and far more detail than I've included. And in case the new link breaks here is the main circuit with a brief explanation from pdf. The circuit itself looks complex but its really a 3 stage amplifier but one for each audio channel (left and right) so 6 amps total. As you can see the second stage is the inverting amp (makes signal 180 degrees out of phase) achieve our noise cancellation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following material is an excerpt from the noise cancellation headphone guide written by Jules Ryckebusch  and all credit goes to Jules for design and explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MYgXC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-06-04T22:29:29.983" LastActivityDate="2015-06-04T22:29:29.983" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23183" PostTypeId="2" ParentId="23161" CreationDate="2015-05-04T21:12:07.917" Score="1" Body="&lt;p&gt;I'm afraid your first equation is wrong because it assumes a highpass filter without any load. However, there is a lowpass filter connected at its output and for this reason the current through the resistor leading to ground does not equal the current through $C_1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do is apply the complex voltage divider rule in the frequency domain, which will give you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{V_{io}(\omega)}{V_{in}(\omega)}=\frac{Z(\omega)}{1/j\omega C_1+Z(\omega)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Z(\omega)$ is the impedance of $R$ in parallel with the series connection of $R$ and $C_2$. I'm sure you can figure this out. The relation between $V_{out}$ and $V_{io}$ is simply&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{V_{out}(\omega)}{V_{io}(\omega)}=\frac{1/j\omega C_2}{1/j\omega C_2+R}=\frac{1}{1+j\omega RC_2}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The total response $V_{out}/V_{in}$ is simply obtained by multiplying Eq. (1) with Eq. (2). The time domain differential equations are obtained by multiplying Eqs (1) and (2) by the denominators of both sides and noting that a multiplication by $j\omega$ corresponds to differentiation.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-04T21:12:07.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23184" PostTypeId="2" ParentId="23161" CreationDate="2015-05-04T21:21:50.690" Score="0" Body="&lt;p&gt;There's a problem in your solution — it doesn't take into consideration the influence of a LPF on HPF. (Matt L. already mentioned that)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exact value of R (which you will base on while calculating $C_1$ and $C_2$) is usually chosen to produce the output resistance of a filter at least 10 times lower than a load resistance (connected to $V_{out}$) AND an input resistance at least 10 times higher than internal resistance of a signal source.&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-05-04T21:21:50.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23186" PostTypeId="2" ParentId="23165" CreationDate="2015-05-04T21:59:50.373" Score="1" Body="&lt;p&gt;MA is almost never a &quot;most appropriate&quot; algorithm (it's only advantage is simplicity). My advice is to choose Gaussian filter which has least possible group delay. Calculate its coefficients keeping in mind that cut-off frequency of a Gaussian filter is $$f_0 = \frac{1}{2 \pi \sigma}$$&#xA;Estimate which variances of low frequency component you'd like to preserve in your application, which are acceptable to be attenuated to 50%, this will give you desirable cut-off frequency. &lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-05-04T21:59:50.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23187" PostTypeId="2" ParentId="23173" CreationDate="2015-05-04T23:13:42.497" Score="0" Body="&lt;p&gt;&quot;Which kind of noises could be possible in such situation?&quot; Noise cancelling seems to me to be an exercize in signal estimation. You need to estimate the external signal and send that estimated signal(180 degress out of phase) to the headphones I would think the noises that would best be cancelled are ones with good correlation in time. Totaly random noise sources would be very hard(or maybe impossible) to cancel since you couldn't accurately estimate them. A speaking voice may be hard to cancel but a constant sound like the roar of an airplane engine should be easier. Just my two cents, hope it helps&lt;/p&gt;&#xA;" OwnerUserId="14921" LastActivityDate="2015-05-04T23:13:42.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23189" PostTypeId="1" AcceptedAnswerId="23192" CreationDate="2015-05-05T08:38:03.147" Score="0" ViewCount="49" Body="&lt;p&gt;I do not specialize in signal processing so I wonder if there is any references to the following procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $[n]=\{0,1,\ldots,n\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the function $f:[n] \to \mathbb{R}$ and $g:[kr] \to \mathbb{R}$, such that $\operatorname{supp} g = \{0,r,2r,3r,\ldots,kr\}$. Assume for simplicity, $n/r$ is a integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are interested in computing the linear convolution $f*g$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $r$ is large, one way to do the computation is partition $f$ into $r$ functions $f_0,\ldots,f_{r-1}$, such that $f_i(t) = f(tr+i)$, and $f_i:[n/r]\to \mathbb{R}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also define $\bar{g}:[k]\to \mathbb{R}$ as $\bar{g}(t) = g(rt)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find $f_i*\bar{g}$ to each $i$, then we can read off $(f*g)(tr+i) = (f_i*\bar{g})(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This make sure we apply $r$ convolutions on sequence of length $n/r$ and $k$. Instead of $1$ convolution on sequence of length $n$ and $kr$. &lt;/p&gt;&#xA;" OwnerUserId="15713" LastActivityDate="2015-05-05T09:37:59.193" Title="Convolution of one signal with an evenly spaced signal" Tags="|convolution|reference-request|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23191" PostTypeId="2" ParentId="23160" CreationDate="2015-05-05T09:03:46.623" Score="1" Body="&lt;p&gt;If you assume a zero initial condition (i.e., if the system is switched on at $n=0$, then $y[-1]=0$), then the system is fully described by its impulse response, i.e. its response to the unit impulse $x[n]=\delta[n]$ (which is zero everywhere, except at $n=0$, where it is $1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Write the system equation as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=b_0x[n]+b_1x[n-1]-a_1y[n-1]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example $b_0=b_1$. If you apply $x[n]=\delta[n]$, you get the following response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}y[0]&amp;amp;=b_0\\y[1]&amp;amp;=b_1-a_1b_0\\&#xA;y[2]&amp;amp;=-a_1(b_1-a_1b_0)\\&#xA;y[3]&amp;amp;=a_1^2(b_1-a_1b_0)\\\vdots\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we get for the impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=\begin{cases}0,&amp;amp;n&amp;lt;0\\b_0,&amp;amp;n=0\\&#xA;(-a_1)^{n-1}(b_1-a_1b_0),&amp;amp;n&amp;gt;0\end{cases}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general input-output relation is described by the convolution of the input signal and the impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=0}^{\infty}h[k]x[n-k]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g., the step response can be easily computed from the impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[n]=\sum_{k=0}^{n}h[k]\tag{4}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-05T09:03:46.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23192" PostTypeId="2" ParentId="23189" CreationDate="2015-05-05T09:37:59.193" Score="2" Body="&lt;p&gt;This is known as &lt;a href=&quot;http://www.ece.unm.edu/faculty/bsanthan/ece539/note3.pdf&quot; rel=&quot;nofollow&quot;&gt;polyphase decomposition&lt;/a&gt;. It is often used as en efficient implementation of filtering combined with decimation or interpolation.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-05T09:37:59.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23193" PostTypeId="1" AcceptedAnswerId="46622" CreationDate="2015-05-05T10:10:36.937" Score="6" ViewCount="3163" Body="&lt;p&gt;&lt;strong&gt;Signals acquisition:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two proximity sensors are positioned Orthogonal to each other. These would be measuring the vibrations of a rotating shaft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of these 2 signals has two dominant frequency components (2441 Hz &amp;amp; 762.9 Hz ) in it. I don't know the phase and amplitude information. I'm interested in finding the phase of the signal at 2441 Hz and 762.9 Hz. I did the following process to achieve amplitudes and phases in MATLAB&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Applying FFT to the raw signal and calculating Amplitude and Phase.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%fft for X signal&#xA;fftx=fft(X,NFFT);&#xA;% absolute value of the signal &#xA;Xn = abs(fftx);&#xA;A = mean(Xn);  % I took the mean to get single value.&#xA;phase = unwrap(angle(fftx));&#xA;phase_mean = mean(alpha);&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Filtering raw signal to specific frequency prior to applying FFT using Butterworth filter. ( In this example I filtered to 2441 Hz)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = butter(2, [ 2440/(fs/2),2441/(fs/2)],'bandpass');&#xA;X_filtered = filter(b,a,X);&#xA;% Applying FFT to filtered signal&#xA;fft_filtered = fft( X_filtered,NFFT);&#xA;Xn_filtered = abs(fft_filtered);&#xA;A_filtered = mean(Xn_filtered);&#xA;phase_filtered = unwrap(angle(fft_filtered));&#xA;phase_filtered_mean = mean(phase_filtered); &#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I did the same process as &lt;strong&gt;point 2&lt;/strong&gt; to filter to another frequency say 762.9 Hz.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My sampling frequency and other things are defined as follows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = length(X); % 50050 is length of signal&#xA;NFFT = 2^nextpow2(length(X)); % Zero padding to nearest N power 2&#xA;%Define frequency axis&#xA;fs = 1e7; % Sampling frequency&#xA;df = fs/NFFT; % frequency resolution&#xA;dt = 1/df; % time resolution&#xA;X_detrend = detrend(X,0); % Removing DC Offset&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've been reading a lot of other posts on the FFT phase and Amplitude.But I'm confused with most of them. In my case, I need to extract frequency particular information (amplitude and phase) to do further  calculation. I'm still unsure if using the filters is right way? Will FFT and filters alter the signal information in any way? Could someone enlighten in understanding the efficient way to extract amplitude and phase information from a signal of particular frequency component.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13557" LastEditorUserId="13557" LastEditDate="2015-05-07T06:29:21.557" LastActivityDate="2019-12-14T11:02:25.470" Title="What is the right way to extract particular frequency phase information from FFT?" Tags="|matlab|fft|phase|bandpass|amplitude|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="23194" PostTypeId="1" AcceptedAnswerId="23195" CreationDate="2015-05-05T11:23:40.240" Score="3" ViewCount="18348" Body="&lt;p&gt;I have a system with the following input/output relation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ y(t)=x(-t) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and I want to prove (not graphically/draw) that its not time invariant (TI).&lt;/p&gt;&#xA;&lt;p&gt;I tried to write down &lt;span class=&quot;math-container&quot;&gt;$y(t-T)$&lt;/span&gt; and compare it to the response to &lt;span class=&quot;math-container&quot;&gt;$x(t-T)$&lt;/span&gt; but I get both terms equal which shouldn't be the case.&lt;/p&gt;&#xA;" OwnerUserId="15323" LastEditorUserId="7092" LastEditDate="2021-03-05T12:12:54.973" LastActivityDate="2021-03-05T12:12:54.973" Title="Proof of time-invariance of continuous-time system" Tags="|continuous-signals|linear-systems|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23195" PostTypeId="2" ParentId="23194" CreationDate="2015-05-05T11:46:29.160" Score="10" Body="&lt;p&gt;Let $y_1(t)$ be the response to the signal $x_1(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_1(t)=x_1(-t)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let $x_2(t)$ be a shifted version of $x_1(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_2(t)=x_1(t-T)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response to $x_2(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_2(t)=x_2(-t)=x_1(-t-T)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the system were time-invariant, its response to $x_2(t)$ should be a shifted version of its response to $x_1(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_2(t)=y_1(t-T)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, from (1) we have $y_1(t-T)=x_1(-(t-T))=x_1(-t+T)$. Comparing this to (3) we see that (4) is not satisfied, and, consequently, the system is not time-invariant. Now that you've seen the proof, try drawing all the signals in order to gain a better understanding.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-05T11:46:29.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23197" PostTypeId="1" AcceptedAnswerId="23208" CreationDate="2015-05-05T13:24:33.820" Score="7" ViewCount="13259" Body="&lt;p&gt;I'm trying to looking the meaning and functionality about scaling function and wavelet function at wavelet analysis. I have googling already. But I can't find and understand the meaning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does those affect to analysis?&#xA;Does anyone help me to understand roughly?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="15650" LastEditDate="2015-05-06T00:03:43.700" LastActivityDate="2017-06-20T12:52:41.047" Title="What is the scaling function and wavelet function at wavelet analysis?" Tags="|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23199" PostTypeId="1" AcceptedAnswerId="23200" CreationDate="2015-05-05T14:19:58.013" Score="0" ViewCount="664" Body="&lt;p&gt;I am trying to compile C++ code for FIR filter design using Parks-McClellan algorithm from &lt;a href=&quot;http://www.iowahills.com/Example%20Code/NewParksMcClellan.txt&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/Example%20Code/NewParksMcClellan.txt&lt;/a&gt; . However, I cannot find the following header files: &quot;FIRFilterCode.h&quot; and &quot;Main.h&quot; referenced in &quot;NewParksMcClellan.cpp&quot;. Does anyone have experience compiling this code? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="15718" LastEditDate="2015-05-05T14:46:13.773" LastActivityDate="2015-05-05T14:46:13.773" Title="Parks-McClellan - compiling C++ code from Iowa Hills page" Tags="|filter-design|finite-impulse-response|parks-mclellan|" AnswerCount="1" CommentCount="1" ClosedDate="2015-05-06T17:07:13.217" ContentLicense="CC BY-SA 3.0" />
  <row Id="23200" PostTypeId="2" ParentId="23199" CreationDate="2015-05-05T14:27:43.450" Score="1" Body="&lt;p&gt;You need to back track on that site.&lt;br&gt;&#xA;There is a complete set of source code and header files available that you will need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.iowahills.com/5FIRFiltersPage.html&quot; rel=&quot;nofollow&quot;&gt;This is all about the FIR-Filters.&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It links to &lt;a href=&quot;http://www.iowahills.com/A7ExampleCodePage.html&quot; rel=&quot;nofollow&quot;&gt;this page with examples.&lt;/a&gt; &#xA;You need the &quot;Code Kit Download.&quot;&lt;br&gt;&#xA;This will get you the FIRFilterCode.h.&lt;br&gt;&#xA;Main.h will be missing because that belongs to the GUI  - which they don't seem to provide code for.&lt;br&gt;&#xA;However, it should be fairly simple to fix.&lt;br&gt;&#xA;Remove the include Main.h, then remove all references to TopForm.&lt;br&gt;&#xA;You'll probably want to replace them with some kind of logging since all they do is provide feedback to the user.&lt;br&gt;&#xA;The involved lines are 273+274 and 278+279.&lt;br&gt;&#xA;Notes to that effect are included in the comments in NewParksMcClellan.cpp&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2015-05-05T14:43:32.210" LastActivityDate="2015-05-05T14:43:32.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23201" PostTypeId="1" AcceptedAnswerId="23202" CreationDate="2015-05-05T15:01:35.563" Score="0" ViewCount="3971" Body="&lt;p&gt;I have two different images for the same object. Each one was taken from different device (scanner, mobile camera, professional camera ..etc).&#xA;the process of  registeration one of them to the other was done correctly. Now I need to do a subtraction between to them for comparison purpose. The problem that is the contrast and brightness are pretty different. I tried these two methods (I tried them on the whole image(globally) and on pairs of the two images (locally)):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Gray-Scale method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ImageB= ImageA * (Mean_Of(ImageA)/Mean_Of(ImageB));&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Color method:&#xA;Convert it to HSV then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ImageB[S]= ImageA[S] * (Mean_Of(ImageA[S])/Mean_Of(ImageB[S]));&#xA;ImageB[V]= ImageA[V] * (Mean_Of(ImageA[V])/Mean_Of(ImageB[V]));&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;return to RGB again&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the two methods did not give me the results I want. They are good and work well on many images but not in all cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions?&#xA;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="15118" LastActivityDate="2015-05-05T15:48:09.697" Title="Balance brightness and contrast between two images" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23202" PostTypeId="2" ParentId="23201" CreationDate="2015-05-05T15:48:09.697" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;The images you are working with are probably with gamma compensation, you should remove it first by applying inverse gamma.&lt;/li&gt;&#xA;&lt;li&gt;More accurately, each camera has its own tone curve mapping. You can build a lookup table that converts one from another.&lt;/li&gt;&#xA;&lt;li&gt;After you removed the non-linearity source, (whether you used method 1 or method 2), as a first order approximation, you can map colors from different cameras by using a 3x3 matrix applied on RGB. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now you can compare your images.&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-05-05T15:48:09.697" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23203" PostTypeId="2" ParentId="23101" CreationDate="2015-05-05T16:59:39.270" Score="1" Body="&lt;p&gt;To point anyone who needs an answer to this question in the right direction.  I have a found a paper that goes over the calculation here - &lt;a href=&quot;http://www.aes.org/e-lib/online/browse.cfm?elib=17010&quot; rel=&quot;nofollow&quot;&gt;http://www.aes.org/e-lib/online/browse.cfm?elib=17010&lt;/a&gt; - &lt;/p&gt;&#xA;" OwnerUserId="14863" LastActivityDate="2015-05-05T16:59:39.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23204" PostTypeId="1" CreationDate="2015-05-05T18:28:36.447" Score="3" ViewCount="310" Body="&lt;p&gt;I have been working on a project with a vide variety of functions for DJ'ing. I am nearing the end, however, the accuracy rate on the key detection part of it is not pleasant when fed tracks of Dance music. With classical music, the algorithm returns a very better accuracy rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all I must explain how I never studied Signal Processing at University and I had to learn the concepts on my own, so excuse my lack of extended knowledge in the subject (hence why I am asking here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I spent most of my time researching and at the end I came up with an algorithm that is a mixture of techniques suggested in literature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summary of Implementation: The audio is split into 5.5 second sections and translated to mono, downsampled to 11025hz and translated into the frequency domain using STFT technique. The STFT result in hz is translated into real music notes by a Chromagram. The chromagram is a 12 dimensional chroma vector in which each bin represents a real pitch class i.e. the first bin represents A, the second represents A#, third represents B etc. Each chroma vector is then correlated against 24 key templates. A coefficient is obtained for every key and a weighting system rewards the highest correlating keys when the difference between the other correlating keys is significant, and penalises when the difference is minute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I perform the STFT and Chromagram steps with the help of a package by Dan Ellis, that I found online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in the original code the parameters are: w (4086) is the basic STFT DFT length (window is half, hop is 1/4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the paper written by the same person there is this section: &lt;a href=&quot;https://i.stack.imgur.com/nZrxF.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/nZrxF.jpg&lt;/a&gt;, where he explains how the STFT is performed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First question: I am not understanding why he divides the window by half before passing it to the STFT function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am using an FFT length of 8192 samples unlike the 4086 of Ellis, after performing parameter testing which gave me best results at that length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before the hanning window is calculated these are the values of the parameters..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sr =&#xA;&#xA;11025&#xA;&#xA;&#xA;N =&#xA;&#xA;8192&#xA;&#xA;&#xA;W =&#xA;&#xA;4096&#xA;&#xA;&#xA; H =&#xA;&#xA;2048&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second question: what could be the reason for such inconsistent and inaccurate results with dance music? Is it perhaps some characteristic of dance music that makes it difficult for the chromagram to match the notes in hz from the STFT to real music notes? Perhaps because of the Kicks, or something to do with the lower frequency ranges? What do you suggest can be done to the audio prior to performing STFT? may be some kind of filter? Can you suggest trying any different parameter in the STFT? or in general any other suggestion / extra step to make the final detection better? Suggestions that would alter the main steps of the key detection completely would be a bit out of reach, however, as I dont have much time left to submit the project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="15721" LastEditorUserId="15721" LastEditDate="2015-05-05T18:40:12.370" LastActivityDate="2015-05-06T14:09:56.557" Title="Key detection Dance Music inaccuracies - matlab" Tags="|matlab|fft|music|detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23205" PostTypeId="2" ParentId="23204" CreationDate="2015-05-05T18:41:25.127" Score="1" Body="&lt;p&gt;There are two things I know of which will cause a problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Some dance music just isn't in any key.  It's just sounds lumped together until it sounds great.&lt;/li&gt;&#xA;&lt;li&gt;The kick drum is the loudest thing but isn't always in a particular key.  Often it just decays in frequency. There's been a trend recently for kick drums to be tuned to the track, but it's not always done.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Try applying a high pass filter above 100Hz and see if that improves things.  I expect someone with more FFT skills than I will fill in more of the answer!&lt;/p&gt;&#xA;" OwnerUserId="10794" LastActivityDate="2015-05-05T18:41:25.127" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23207" PostTypeId="2" ParentId="23204" CreationDate="2015-05-06T00:00:11.480" Score="2" Body="&lt;p&gt;A 12-dimensional chromagram may not estimate pitch very well, given synthesized semi-tonal sounds that include lots of energy at multiple odd harmonics, as those harmonics will often end up in the wrong pitch class slots.  If there's lots of tonal bass, low-pass filtering just above the primary range of the bass instrument/synth's fundamental might help getting rid of some of the harmonics and overtones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the drums are not tuned to the key (probably not), then they will interfere with any key centered pitch class information.  Perhaps time-domain filtering out of all percussive events, and only analyzing the tones between the drum beat attacks might help in this case.  Even a simple low-envelope amplitude gate function might be suitable (assuming the sound isn't so compressed that there is no lower amplitude in any extent portion of the envelope!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, as per the previous answer, are you sure the sounds of your &quot;dance music&quot; actually contains a musical key? (as opposed to producing some cognitive or auditory illusion of tonality).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-05-06T14:09:56.557" LastActivityDate="2015-05-06T14:09:56.557" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23208" PostTypeId="2" ParentId="23197" CreationDate="2015-05-06T00:44:10.203" Score="3" Body="&lt;p&gt;Wavelets are functions which are form by two resulting coefficients. The detail coefficient and the scale coefficient. From wikipedia Wavelets are defined by the wavelet function ψ(t) (i.e. the mother wavelet) and scaling function φ(t) (also called father wavelet) in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wavelet function is in effect a band-pass filter and scaling it for each level halves its bandwidth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scaling and detail basically divide the signal into two applying a high-pass filter resulting into the detail coefficients - (which is the highest level of the transform) and a low-pass filter which results in the scaling coefficients - (which is the lowest level of the transform). This coefficients are calculated for each frequency of the discrete wavelet.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;used to for example to extract the deterministic part of a signal and the stockastic part of the signal. They are also used through different procedures to denoise via thresholding the coefficients. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="-1" LastEditDate="2017-06-20T12:52:41.047" LastActivityDate="2017-06-20T12:52:41.047" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23209" PostTypeId="1" AcceptedAnswerId="23226" CreationDate="2015-05-06T05:05:29.430" Score="0" ViewCount="157" Body="&lt;p&gt;Typically, We do wavelet decomposition with the last one level.&#xA;But I wonder, why do decomposition withh the last one level?&#xA;In the other word, why not stop with the first decomposition level?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="15650" LastEditDate="2015-05-06T09:32:37.793" LastActivityDate="2015-07-05T18:58:57.150" Title="Why not stop with the first level decomposition in wavelet?" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23210" PostTypeId="1" CreationDate="2015-05-06T05:44:13.433" Score="1" ViewCount="74" Body="&lt;p&gt;I am a beginner. I do coding in Matlab only for image processing purpose. But my friends say it is very slow and in OpenCv I could get multiple times faster output results compared to Matlab.In basic reference book like DIP by Gonzalez and Woods ,they have used Matlab for programming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is Matlab the best coding tool for Digital Image Processing? &#xA;What are the advantages and disadvantages of coding in  Matlab? Also,What are other good options by which we can do coding for image processing ?&lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-05-06T05:55:06.293" LastActivityDate="2015-05-06T05:55:06.293" Title="Is MATLAB the best coding tool for Digital Image Processing?" Tags="|image-processing|matlab|opencv|" AnswerCount="0" CommentCount="4" ClosedDate="2015-05-06T16:05:44.623" ContentLicense="CC BY-SA 3.0" />
  <row Id="23211" PostTypeId="1" CreationDate="2015-05-06T06:06:29.343" Score="-1" ViewCount="106" Body="&lt;p&gt;I believe that answer to &quot;Can poles of z-transform transfer function be zero to eliminate transient response?&quot; is no, but I am not sure why it's no. &lt;/p&gt;&#xA;" OwnerUserId="15727" LastActivityDate="2015-05-06T08:41:43.770" Title="Can poles of z-transform transfer function be zero to eliminate transient response?" Tags="|z-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23212" PostTypeId="2" ParentId="23211" CreationDate="2015-05-06T07:04:56.577" Score="0" Body="&lt;p&gt;What do you mean by transient response?&lt;br&gt;&#xA;If pole is zero then it acts as low pass filter.&lt;br&gt;&#xA;Still you get transient response for transient analysis.&lt;br&gt;&#xA;Transient responses is a type of analysis to see the time varying curve &lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-05-06T07:04:56.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23213" PostTypeId="1" CreationDate="2015-05-06T07:18:48.523" Score="0" ViewCount="18" Body="&lt;p&gt;In the book by Sayood on compression, he says &quot;if the set is complete, it is called affine wavelets&quot;.  I want to know what is meant by completeness of wavelets.  &lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2015-05-06T07:18:48.523" Title="What is meant by &quot;complete set&quot; in the context of affine wavelets?" Tags="|wavelet|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23216" PostTypeId="2" ParentId="23211" CreationDate="2015-05-06T08:41:43.770" Score="1" Body="&lt;p&gt;If all the poles of a system's transfer function are zero (i.e. they lie in the origin of the $z$-plane), then you have a finite impulse response (FIR) system. This implies that the transient response is also of finite length, but it does exist. It depends on the initial condition of the filter, i.e. on what is stored in the delay elements at the time of the transient in the input signal. But also if the initial condition is zero there will be a transient response until the system's memory is filled with the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take as an example the step response of a causal FIR system assuming zero initial condition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[n]=\sum_{k=0}^nh[k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the finite length $N$ of the impulse response $h[k]$, the step response $a[n]$ reaches its final value at $n=N-1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[N-1]=a[N]=\ldots =a[\infty]=\sum_{n=0}^{N-1}h[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $n&amp;lt;N-1$ we observe the transient response to the unit step at the system's input.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-06T08:41:43.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23219" PostTypeId="2" ParentId="23158" CreationDate="2015-05-06T10:41:06.357" Score="0" Body="&lt;p&gt;I expand and modify your code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 100;  %number of sample&#xA;fs = 100; % Sample frequency (Hz)&#xA;t = 0:1/fs:(N-1)/fs;                    &#xA;x = sin(2*pi*10*t);  % 10 Hz component&#xA;%x(:)=1;    &#xA;f = 0:fs/N:(N-1)*fs/N;    &#xA;&#xA;subplot(2,2,1);&#xA;plot(t,x);&#xA;title('full signal'); grid on;&#xA;subplot(2,2,3);&#xA;plot(f(1:N/2),abs(fft(x)(1:N/2)));&#xA;title('spectrum'); grid on;&#xA;&#xA;x1=x;     %x1 - zero pad signal&#xA;x1(1:ceil(N/3))=0;&#xA;x1(ceil(2*N/3):N)=0;&#xA;&#xA;subplot(2,2,2);&#xA;plot(t,x1,'b',t,x1,'*');&#xA;title('zero pad signal'); grid on;&#xA;subplot(2,2,4);&#xA;plot(f(1:ceil(N/2)),abs(fft(x1)(1:ceil(N/2))));&#xA;title('spectrum'); grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eKjhp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see signals before and after zero padding are quite different. And the spectrums are quite different too. There is strong part of signal &lt;strong&gt;x1&lt;/strong&gt; with frequency 10 Hz, and you can see strong peak on spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can uncomment line with &lt;strong&gt;x(:)=1;&lt;/strong&gt; First &lt;em&gt;full&lt;/em&gt; signal will be DC (constant), second (zero padding) - rectangle. Quite different signals and quite different spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;br&gt;&#xA;About phase spectrum. Update to code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F=fft(x);&#xA;angle(F(11))  % phase = -1.5708&#xA;F1=fft(x1);&#xA;angle(F1(11)) % phase =  -1.6018&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Phase for &lt;strong&gt;x&lt;/strong&gt; makes sense only for bin with non zero amplitude. Non zero amplitude numbers are &lt;strong&gt;11&lt;/strong&gt; and &lt;strong&gt;91&lt;/strong&gt;. Phase for any other index are results of calculations errors of FFT function.&lt;br&gt;&#xA;As &lt;strong&gt;x1&lt;/strong&gt; has  big part of &lt;strong&gt;x&lt;/strong&gt; the phase spectrum for this bins has approximately the same value (as you can see).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hint. You can present &lt;strong&gt;x1&lt;/strong&gt; as product of $sin$ function and rectangle function. So spectrum of &lt;strong&gt;x1&lt;/strong&gt; is a convolution of spectrum $sin$ and rectangle.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2015-05-07T10:23:15.133" LastActivityDate="2015-05-07T10:23:15.133" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23220" PostTypeId="1" CreationDate="2015-05-06T10:49:24.270" Score="0" ViewCount="76" Body="&lt;p&gt;I have a homogeneity image that includes two regions $\Omega_1$ and $\Omega_2$. How to represent the image by decomposition of two regions? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the famous way is representing by the mean feature. Image $I$ can be  represented as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I=u_1c_1+u_2c_2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c_1$ is mean of region $\Omega_1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c_2$ is mean of region $\Omega_2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ u_1 =&#xA;  \begin{cases}&#xA;   1 &amp;amp; \text{if is $\Omega_1$ }\\&#xA;   0       &amp;amp; \text{otherwise}&#xA;  \end{cases}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ u_2 =&#xA;  \begin{cases}&#xA;   1 &amp;amp; \text{if is $\Omega_2$ }\\&#xA;   0       &amp;amp; \text{otherwise}&#xA;  \end{cases}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know another way to represent image $I$ without using mean feature. Thank you so much&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the question, I will show a simple example as following&#xA;&lt;img src=&quot;https://i.stack.imgur.com/GwCBg.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="8264" LastEditDate="2015-05-06T12:30:29.897" LastActivityDate="2015-08-04T14:42:56.020" Title="Image region-based representation" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23221" PostTypeId="2" ParentId="23220" CreationDate="2015-05-06T12:43:13.103" Score="1" Body="&lt;p&gt;Your example seems to imply you are talking about mutually exclusive, non-overlapping regions.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, given N such regions, use an image where each pixel has enough values (depth), to represent N regions. Just set the pixel value to the &lt;em&gt;index&lt;/em&gt; of the region in that position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could think of the result image as a sum of N binary images, each multiplied by the $i$ subscript of the corresponding $\Omega_i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you are asking about how to segment such an image into 2 (or more) regions, the you should use a connected component algorithm, which is common is most image processing libraries.&lt;/p&gt;&#xA;" OwnerUserId="163" LastEditorUserId="163" LastEditDate="2015-05-06T12:56:18.643" LastActivityDate="2015-05-06T12:56:18.643" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23222" PostTypeId="2" ParentId="23193" CreationDate="2015-05-06T14:50:38.287" Score="0" Body="&lt;p&gt;To estimate spectral component phase angle relative to shaft angle using an FFT of length N, first gather a sequence of N samples such that the shaft angle is known with accuracy at sample number N/2, then window with a Nuttal window and do an FFT shift before the FFT.  The  atan2() of the FFT bin result closest to the desired spectral component will produce an estimate of the phase relative to the center of the original sample window.  Adjust that phase by the known shaft angle at that N/2 sample point to get a spectral phase relative to shaft angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know the spectral frequency or use a frequency peak estimator, then the phase can also be interpolated between bins for increases phase estimation accuracy.  Interpolate phase by using a Sinc interpolation seperately on the real (even) and imaginary (odd) FFT result components before taking the arctangent.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-05-06T14:50:38.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23223" PostTypeId="1" CreationDate="2015-05-06T16:41:24.533" Score="1" ViewCount="635" Body="&lt;p&gt;How does SDR resolution translate to audio resolution when using FM demodulation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: using a 8-bit/2.048 Mhz IQ stream, what is the maximum audio sample rate and bit depth that can be generated from a +/-75kHz mono WFM signal with 20kHz audio?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that the SDR bit depth is irrelevant but for link quality purposes. But how does the SDR sample rate translate to sample rate and bit depth of the resulting audio signal?&lt;/p&gt;&#xA;" OwnerUserId="15448" LastEditorUserId="15448" LastEditDate="2015-05-07T13:57:06.640" LastActivityDate="2015-05-07T13:57:06.640" Title="WFM SDR and Audio resolution" Tags="|modulation|resolution|software-defined-radio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23224" PostTypeId="1" AcceptedAnswerId="23225" CreationDate="2015-05-06T17:56:56.057" Score="0" ViewCount="180" Body="&lt;p&gt;I have only magnitude spectra and group delay information and I need to sketch phase spectra from this information. For example, group delay is given like this: $\tau_{g}(\omega) = c$ where c is a constant value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the group delay is the derivative of minus phase function of the system. In this case, phase function can be written likse this: $\beta(\omega) = - c \omega + constant$, but how to determine the $constant$ here? Is it possible to find phase from these information?&lt;/p&gt;&#xA;" OwnerUserId="12045" LastActivityDate="2015-05-06T20:32:40.383" Title="Sketching Phase Spectra Using Group Delay and Magnitude Spectra Informations" Tags="|discrete-signals|signal-analysis|magnitude|linear-phase|group-delay|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23225" PostTypeId="2" ParentId="23224" CreationDate="2015-05-06T18:07:59.727" Score="2" Body="&lt;p&gt;If the magnitude spectrum is symmetric&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M(\omega)=M(-\omega)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(as I assume), then your system is real-valued. The phase response of a real-valued system is asymmetric:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi(\omega)=-\phi(-\omega)\quad(\mod 2\pi)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that there can be two cases:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The phase goes through zero at $\omega=0$, i.e. the phase is given by $\phi(\omega)=-c\cdot\omega$, where $c$ is the constant group delay.&lt;/li&gt;&#xA;&lt;li&gt;The phase is $\pm \pi$ at $\omega=0$, which means $\phi(\omega)=-c\cdot\omega\pm\pi$.&lt;/li&gt;&#xA;&lt;li&gt;The phase jumps at $\omega=0$. This is only possible if the magnitude has a zero at $\omega=0$, i.e. $M(0)=0$. The phase jumps by $\pi$, which is simply a sign change of the (bipolar) amplitude function. In this case the phase is given by $$\phi(\omega)=\begin{cases}-\pi/2-c\cdot\omega,&amp;amp;\quad\omega&amp;gt;0\\\pi/2-c\cdot\omega,&amp;amp;\quad\omega&amp;lt;0\end{cases}$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-06T20:32:40.383" LastActivityDate="2015-05-06T20:32:40.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23226" PostTypeId="2" ParentId="23209" CreationDate="2015-05-06T21:54:27.543" Score="0" Body="&lt;p&gt;The number of levels (frequency range represented) is discretionary to the user usually automatically set as to include a limited number of frequencies which is dependant on the lenght of the series and which is representative of most of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying a wavelet function splits the signal in two coefficients (scaling and detail coefficients) for a number of levels which represent a range of frequencies of this split defined by selecting the number of decomposition levels. Selecting the number of decomposition levels is subjective as per the frequencies you may like to extract. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-07-05T18:58:57.150" LastActivityDate="2015-07-05T18:58:57.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23227" PostTypeId="1" AcceptedAnswerId="23234" CreationDate="2015-05-07T00:21:42.710" Score="0" ViewCount="34" Body="&lt;p&gt;As I know , wavelet decomposition behave with halve.&#xA;I mean that a way like this HH HL LH LL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I wonder, how to corver the all spectrum when it was halved?&#xA;I think if it want to all cover spectrum then it might be needed infinity halve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can cover all the spectrum?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastActivityDate="2015-05-07T06:53:31.177" Title="How to cover all spectrum in wavelet when it which is behalved?" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23228" PostTypeId="1" AcceptedAnswerId="23237" CreationDate="2015-05-07T01:40:35.050" Score="11" ViewCount="2630" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the difference between  &lt;span class=&quot;math-container&quot;&gt;$X(j\omega)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X(\omega)$&lt;/span&gt; notation?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the meaning of &lt;span class=&quot;math-container&quot;&gt;$j\omega$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Does it represent frequency, and if yes, what is the meaning of an imaginary frequency?&lt;/p&gt;&#xA;" OwnerUserId="15032" LastEditorUserId="7092" LastEditDate="2021-12-12T21:47:37.740" LastActivityDate="2021-12-12T21:47:37.740" Title="What is the difference between $X(j\omega)$ and $X(\omega)$ notation?" Tags="|fourier-transform|laplace-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23229" PostTypeId="1" AcceptedAnswerId="23257" CreationDate="2015-05-07T02:36:28.430" Score="1" ViewCount="1279" Body="&lt;p&gt;I got a problem when I was trying to denoise a signal. Actually, it is a simple simulation. The signal is the addition of a step signal (The info I wish to get) and a sinusoidal one (the noise I wish to remove). See below&lt;img src=&quot;https://i.stack.imgur.com/NcyNr.jpg&quot; alt=&quot;(a) The noise (b) The signal and (c) Signal + the noise&quot;&gt;&#xA;However, I tried different parameters of using the adaptive filter, it simply cannot filter out the sinusoidal noise from the step signal. See figure like this.&lt;img src=&quot;https://i.stack.imgur.com/REaIX.jpg&quot; alt=&quot;Using adaptive filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions will be greatly appreciated! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the matlab code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;close all&#xA;&#xA;%% walking induced noise&#xA;t = [1:5000]*1e-2;&#xA;f = 0.1;&#xA;WalkNoise = 1*sin(2*pi*f.*t);%+1.5*cos(3*pi*f.*t);&#xA;WN = WalkNoise + 0.05*randn(size(WalkNoise));&#xA;&#xA;figure&#xA;subplot(3,1,1)&#xA;plot(t,WN);&#xA;title('Noise');&#xA;&#xA;%% signal&#xA;h1 = 14; % height of the signal 1&#xA;h2 = 18; % height of the signal 2&#xA;L = 5000;  % total length of the signal&#xA;bp =2500;  % location of break point&#xA;x1 = h1*ones(1,bp);&#xA;x2 = h2*ones(1,L-bp);&#xA;Sig = [x1,x2];&#xA;Sig = Sig + 0.1*randn(size(Sig));&#xA;&#xA;subplot(3,1,2)&#xA;plot(t,Sig);&#xA;title('Signal');&#xA;&#xA;%% walking-induced-noise + signal&#xA;NoisySig = Sig + WN;&#xA;subplot(3,1,3)&#xA;plot(t,NoisySig); hold on&#xA;title('Signal + noise');&#xA;&#xA;%% adaptive filtering&#xA;figure&#xA;plot(t,NoisySig); hold on&#xA;title('Signal + noise');&#xA;&#xA;mu = 0.001;            % LMS step size.&#xA;ha = adaptfilt.lms(20,mu);&#xA;[y,e] = filter(ha,WN,NoisySig);&#xA;plot(t,e,'r');&#xA;legend('Signal+noise','Filtered using Adaptive filter');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15734" LastEditorUserId="1849" LastEditDate="2015-05-07T08:32:45.513" LastActivityDate="2018-07-13T16:35:49.023" Title="Why adaptive filter does not work in my application" Tags="|matlab|discrete-signals|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23230" PostTypeId="2" ParentId="23223" CreationDate="2015-05-07T03:52:37.160" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;how does the SDR sample rate translate to sample rate and bit depth of the resulting audio signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Extremely indirectly. I haven't got precise mathematical formulas for you, but here's an overview of the topic which should let you figure out where you want to dig deeper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, FM is an &lt;em&gt;analog&lt;/em&gt; modulation. This means that there is no inherent sample rate or bit depth of the signal recovered by demodulating, but only an audio bandwidth and noise floor. So let's look at what influences that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;strong&gt;bits per sample (bit depth) of the digitized RF&lt;/strong&gt; determines the amount of error introduced by the quantization (conversion to discrete samples), which can be described as &lt;strong&gt;quantization noise&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that quantization noise is at a constant level in the digital signal coming from the ADC. This means that — unlike radio interference — the signal-to-quantization-noise ratio improves the more you turn up your receiver's gain. But you can only do that so far before you get clipping (signal level exceeding the representable sample values).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the best results are obtained when you have a narrow &lt;em&gt;analog&lt;/em&gt; filter in your receiver to remove all but the desired signal before digitization — the wider bandwidth you receive, the more total power is arriving, and so the less gain you can use before clipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, using a narrow bandwidth prevents you from having those pretty waterfall displays of ten stations at once. It's a tradeoff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more words on the subject, see my previous answer over on Amateur Radio Stack Exchange, to the question &lt;a href=&quot;https://ham.stackexchange.com/questions/2475/why-is-dynamic-range-relevant-for-an-sdr/2479#2479&quot;&gt;Why is dynamic range relevant for an SDR?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A simple analysis would suggest that the &lt;strong&gt;sample rate of the digitized RF&lt;/strong&gt; has no effect, because it's just bringing in a wider bandwidth, full of unrelated signals and noise, than we actually need. However, this is not true, &lt;em&gt;if&lt;/em&gt; the ADC has fewer bits per sample than the actual DSP processing (for example, 8-bit integer samples from the ADC going into 32-bit floating-point DSP operations). The extra samples contain some of the information that was lost in quantization; resampling the unnecessarily-high-rate signal to a lower rate will automatically use that information, so those 32 bits aren't actually wasted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to combine this with the previous point, the best case given fixed hardware is to configure it (if possible) for the narrowest analog filter bandwidth and the highest sample rate (creating a signal whose spectrum has an obvious filter hump in the middle) and then resampling it before demodulation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To sum up, the sample rate and bit depth of the incoming RF determines how much noise is added to the signal by the process of digitization. The next question is how that noise, the RF noise entering the software demodulator, affects the noise level of the resulting audio, and I'm afraid I don't know that and haven't found an obvious reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we know that our input can be considered as a signal with more or less noise depending on its parameters, let's look at what to do with the output.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;As &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nyquist tells us&lt;/a&gt;, the &lt;strong&gt;sample rate of the output audio signal&lt;/strong&gt; does not need to be greater than twice the highest frequency present in the signal. That's the &lt;em&gt;audio&lt;/em&gt; bandwidth, which for broadcast FM is, let's say, &lt;a href=&quot;https://commons.wikimedia.org/wiki/File:RDS_vs_DirectBand_FM-spectrum2.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;15 kHz&lt;/a&gt;. Therefore, the required sample rate is 30 kHz, ideally. However, the signal must be filtered to remove noise that is outside the expected bandwidth, and using exactly 30 kHz sample rate means that the noise which passes the necessarily-imperfect filter will be aliased down into lower frequencies. Thus, it is better to use a higher sample rate to allow some room for the filter transition band — perhaps 44.1 or 48 kHz, because those are common audio sample rates.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantization introduces quantization noise — but we already have noise in our signal. Therefore, the &lt;strong&gt;bit depth of the audio&lt;/strong&gt; should be chosen so that it introduces an insignificant amount of quantization noise compared to the noise already present. (Note: You can't avoid introducing any noise at all. Your finite-precision arithmetic is doing that at every step.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4655" LastEditorUserId="-1" LastEditDate="2017-04-13T12:59:21.280" LastActivityDate="2015-05-07T03:52:37.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23232" PostTypeId="2" ParentId="23228" CreationDate="2015-05-07T04:56:45.613" Score="5" Body="&lt;p&gt;$X(j \omega)$ (frequency response) is a Fourier transform of system's impulse response. It's actually a function of frequency ($\omega$) but usually is written as $X(j \omega)$ because replacing $j \omega$ in the formula with $s$ will give you system's Laplace transform $X(s)$ without any additional conversions. (This works in the opposite direction as well: if you have a Laplace ransform, you can get frequency response by replacing $s$ with $j \omega$.)&lt;/p&gt;&#xA;" OwnerUserId="15103" LastActivityDate="2015-05-07T04:56:45.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23234" PostTypeId="2" ParentId="23227" CreationDate="2015-05-07T06:53:31.177" Score="1" Body="&lt;p&gt;It is covered - its just the signal that is the residual part of what you didn't filter yet.&lt;/p&gt;&#xA;" OwnerUserId="6944" LastActivityDate="2015-05-07T06:53:31.177" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23235" PostTypeId="1" AcceptedAnswerId="23236" CreationDate="2015-05-07T07:04:44.717" Score="3" ViewCount="849" Body="&lt;p&gt;I am studying DT-FT. But I cannot figure out why we use $X(e^{j\omega})$ instead of $ X(j\omega) $ in DT FT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance..&lt;/p&gt;&#xA;" OwnerUserId="15032" LastActivityDate="2015-05-07T07:47:19.897" Title="why do we use $X(e^{j\omega})$ instead of $X(j\omega) $ in Discrete Time FT" Tags="|discrete-signals|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23236" PostTypeId="2" ParentId="23235" CreationDate="2015-05-07T07:47:19.897" Score="5" Body="&lt;p&gt;The argument $e^{j\omega}$ emphasizes the $2\pi$-periodicity of the discrete-time Fourier transform (DTFT) of a sequence. Furthermore, if the $\mathcal{Z}$-transform $X(z)$ of the sequence $x[n]$ exists and if the unit circle $|z|=1$ is inside the region of convergence, then the DTFT of the sequence is simply obtained by evaluating $X(z)$ on the unit circle $z=e^{j\omega}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the same thing as with the continuous Fourier transform and the Laplace transform, referred to in your previous question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-07T07:47:19.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23237" PostTypeId="2" ParentId="23228" CreationDate="2015-05-07T07:56:57.210" Score="10" Body="&lt;p&gt;Both notations are common and correct. As pointed out by Yuri Nenakhov, the advantage of the argument $j\omega$ is that it coincides with the complex (Laplace transform) variable $s$ when its real-part is zero. Note that in the complex $s$-plane the frequency axis is the imaginary axis. So $j\omega$ has nothing to do with complex frequency (which makes no sense).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the Laplace transform $X(s)$ of a signal $x(t)$ exists, and if the imaginary axis is inside its region of convergence, then the Fourier transform is obtained by setting $s=j\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this does not work in general! In general you can't get the Fourier transform by replacing $s$ with $j\omega$ and vice versa. Two conditions must be satisfied in order for this to lead to a correct result:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Both transforms must exist (in the sense that the corresponding signal $x(t)$ has a Laplace transform &lt;em&gt;and&lt;/em&gt; a Fourier transform).&lt;/li&gt;&#xA;&lt;li&gt;The imaginary axis $s=j\omega$ must be inside the region of convergence of the Laplace transform.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;An example where replacing $s$ by $j\omega$ doesn't work, even though both transforms exist, is the step function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&amp;amp;x(t)=u(t)\\\text{Laplace transform: }&amp;amp;X(s)=\frac{1}{s}\\&#xA;\text{Fourier transform: }&amp;amp;\hat{X}(j\omega)=\pi\delta(\omega)+\frac{1}{j\omega}\neq X(s)|_{s=j\omega}\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-07T16:45:12.137" LastActivityDate="2015-05-07T16:45:12.137" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23238" PostTypeId="1" CreationDate="2015-05-07T08:24:02.077" Score="0" ViewCount="56" Body="&lt;p&gt;I am trying to implement FSK Modulation. For bit 0 and 1, I defined a frequency wave (for instance, for bit 1, c = cos(2pi&lt;em&gt;f&lt;/em&gt;t), with t = 0 : 1/fs : (1/fs)*N - 1/fs, where fs is the data rate). When I'm simulating, c is remaining constant (only value 1 for cosinus).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why ? Because If a use a sinus, it is not remaining constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for avance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 1000; % number of bits&#xA;R = 1000; % bit rate&#xA;fs = 1/R;  % sampling rate&#xA;&#xA;t = 0 : fs : N*fs - fs;&#xA;bits = round(rand(1,N));&#xA;&#xA;f1 = R * 6; &#xA;f2 = R * 4;&#xA;&#xA;c1 = A*cos(2*pi*f1*t); % bit 1&#xA;c2 = A*cos(2*pi*f2*t); % bit 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15738" LastEditorUserId="13320" LastEditDate="2016-11-21T13:15:23.557" LastActivityDate="2016-11-21T13:15:23.557" Title="Signal remains constant when implementing FSK" Tags="|matlab|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23239" PostTypeId="2" ParentId="22012" CreationDate="2015-05-07T10:07:47.473" Score="0" Body="&lt;p&gt;I answer this way because i don't have permission for comments.&#xA;I don't have a complete solution. What happens with an chorus flanger is this.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6JaQY.png&quot; alt=&quot;Chorus Flanger black box&quot;&gt;&lt;br&gt;&#xA;Signal xt goes in split in two(or maybe more) signal paths and mixed together at the end.&#xA;The difference is the length of the delay (Flanger &amp;lt;10ms and chorus 20 - 60ms).&lt;br&gt;&#xA;First your Lfo discription isn't right.&#xA;It should me something like :&lt;code&gt;lfo = A *sin(2*pi*lfo_rate*[0:length(output)]/fs) + Offset;&lt;/code&gt; Where &lt;code&gt;A&lt;/code&gt; is half the time (Positive and negative) and &lt;code&gt;offset&lt;/code&gt; the center time where the LFO is turning around.&#xA;And `A =&amp;lt; offset' otherwise the time gets negative&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difficulty is i think a variable buffersize. let say a chorus center time is 50 ms with ±10 ms delay. no Lfo you have 44100 * 20/1000 = 2205 samples. the max buffer = 2646 samples and the min buffer = 1764 Samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope you can do something with the info&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2015-05-07T10:07:47.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23241" PostTypeId="1" CreationDate="2015-05-07T11:28:44.010" Score="0" ViewCount="194" Body="&lt;p&gt;I am trying to use fixed point to implement the function 1/x for the integer from 1 to 2048. My plan is that I use fixed point representation for some picked integers as entries in one lookup table and use linear interpolation obtain missing integers. About picking integers, more integers will be selected at high curvature regions. I am using Matlab to achieve the goal. I have few experience of converting one function from floating point to fixed point. Currently I am working on the first step. It seems it is not an easy task. Can anyone give some ideas or links to useful information?&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2015-05-07T11:28:44.010" Title="fixed point implementation of 1/x" Tags="|matlab|fixed-point|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23243" PostTypeId="2" ParentId="23238" CreationDate="2015-05-07T11:35:13.907" Score="1" Body="&lt;p&gt;The sampling rate you're using is too low. The cosine signals have frequencies 4,000 and 6,000 Hz, but your sampling frequency is 1000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An FSK signal has a very large bandwidth -- in theory, it is infinite. This is because of the sharp transistions between pulses of different frequencies. My suggestion is to use a sampling frequency that is around 5 to 10 times larger than your carrier, or around 25,000 to 50,000 samples per second in your case.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-07T11:35:13.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23244" PostTypeId="2" ParentId="22154" CreationDate="2015-05-07T12:46:32.253" Score="0" Body="&lt;p&gt;This was a scaling problem. I did not have the same vectors for X-axis, thus creating uneven areas below PDF curves.&lt;/p&gt;&#xA;" OwnerUserId="15077" LastActivityDate="2015-05-07T12:46:32.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23245" PostTypeId="1" CreationDate="2015-05-07T14:02:01.937" Score="0" ViewCount="74" Body="&lt;p&gt;In my audio processing lecture, the term &lt;code&gt;s-space&lt;/code&gt; came up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My instructor basically told us that it's a space where we perform calculations that couldn't be performed otherwise in the time space. Although he also mentioned that the s-space doesn't have a physical meaning or at least none that he is aware of, I'm curious if it has one. How exactly one can describe the s-space physically?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also do you have a broader explanation for the s-space with some easy to grasp examples?&lt;/p&gt;&#xA;" OwnerUserId="15329" LastActivityDate="2015-05-07T14:02:01.937" Title="What is the physical meaning of the s-space?" Tags="|signal-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23247" PostTypeId="1" CreationDate="2015-05-07T15:25:29.543" Score="0" ViewCount="571" Body="&lt;p&gt;I am trying to make a system that detects footsteps. First I filter and decimate the original signal, then I make a convolution between the filtered signal and a single footstep, then I extract the envelope (here I have a threshold of 1 and if the peaks exceed this threshold then it means that those are footsteps). The problem is that the plots (envelope and footsteps) need to be correlated, but the footsteps are right shifted and I really don't know which might be the cause. I hope you can help me. I'll show you an example of two different signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example 1:&lt;br/&gt;&#xA;&lt;img src=&quot;https://s21.postimg.org/xdegs4i5j/example2.jpg&quot;&gt;&lt;br/&gt;&#xA;Example 2:&lt;br/&gt;&#xA;&lt;img src=&quot;https://s10.postimg.org/58wu9pd6h/example1.jpg&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;convolutie=conv(filtrare2,sample);&#xA;t=(0:length(convolutie)-1)/Fs;&#xA;axes(handles.semnalConv);&#xA;plot(t,convolutie);xlabel('Time(s)');&#xA;&#xA;y = hilbert(convolutie);&#xA;env = abs(y);&#xA;t=(0:length(env)-1)/Fs;&#xA;axes(handles.semnalAnvelopa);&#xA;plot(t,env);xlabel('Time(s)');&#xA;&#xA;&#xA;[pks,locs]=findpeaks(env,'MinPeakHeight',1,'MinPeakDistance',100);&#xA;axes(handles.semnalPasi);&#xA;stem(locs.*10,pks.^(1/2)/4,'r');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The problem was that there was a different number of samples at each plot.&lt;/p&gt;&#xA;" OwnerUserId="12111" LastEditorUserId="-1" LastEditDate="2017-03-10T09:42:36.347" LastActivityDate="2015-05-08T18:25:08.457" Title="Correlation between two graphs in Matlab" Tags="|matlab|signal-analysis|correlation|detection|" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="23251" PostTypeId="1" AcceptedAnswerId="23272" CreationDate="2015-05-07T17:14:57.313" Score="0" ViewCount="57" Body="&lt;p&gt;I'm projecting a series of points onto a surface and then recording their locations in the corresponding image.  However, if one goes pixel by pixel a single point may, at times, take up multiple pixels and would thus be recorded multiple times.  What is the best (least error prone) way to determine the location of a point?  I've thought of simply scanning the image line by line checking to see if a pixel corresponds to that of a point, grouping the pixel clusters together based upon distance, and taking the center of this cluster to be the coordinate of the point.  Perhaps something like an R-tree where I can order things by distance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions? Or tried and true techniques?&lt;/p&gt;&#xA;" OwnerUserId="13638" LastActivityDate="2015-05-08T22:49:58.023" Title="scanning an image for projected points" Tags="|image-processing|fixed-point|projection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23257" PostTypeId="2" ParentId="23229" CreationDate="2015-05-07T19:50:16.897" Score="1" Body="&lt;p&gt;I tried your code change adaptfilt.lms to adaptfilt.nlms&lt;br&gt;&#xA;also decrease the step size to 0.0001&lt;br&gt;&#xA;These conditions gave me better results.&lt;br&gt;&#xA;nlms is better than lms as there is stability in learning filter coefficeints.The lms algorithm could change the filter coefficients drastically.&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-05-07T19:50:16.897" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23258" PostTypeId="1" AcceptedAnswerId="23278" CreationDate="2015-05-07T20:43:33.940" Score="0" ViewCount="639" Body="&lt;p&gt;The signal $x_a(t) = \cos(2\pi450t)$ is sampled.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F = 450&#xA;Fs = 1000 Hz&#xA;f = F/Fs = 450/1000   // Sampling theorem is fulfilled&#xA;x(n) = cos(2*pi*(450/1000))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The signal is then down sampled with a factor 3.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fNew = f*3 = 450*3/1000 = 1.35&#xA;xNew(n) = cos(2*pi*1.35)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the signal is prepared. How to make an ideal reconstruction using 1000Hz?&lt;/p&gt;&#xA;" OwnerUserId="15741" LastEditorUserId="11256" LastEditDate="2015-05-08T15:26:24.363" LastActivityDate="2015-05-09T10:50:45.643" Title="Ideal reconstruction after down sampling" Tags="|reconstruction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23259" PostTypeId="1" AcceptedAnswerId="23265" CreationDate="2015-05-07T21:44:23.010" Score="1" ViewCount="220" Body="&lt;p&gt;I use imageJ software, imageJ has a EXP command (process &gt;math &gt;exp ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;original image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rETqe.png&quot; alt=&quot;http://s6.uplod.ir/i/00594/x1tlq1q839bc.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;output image processed by EXP command in imageJ software:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GstNw.png&quot; alt=&quot;http://s6.uplod.ir/i/00594/7znj3tzvefui.png&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this link explain how do that ImageJ: &lt;a href=&quot;http://imagej.1557.x6.nabble.com/Process-gt-Math-gt-Exp-td5009733.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imagej.1557.x6.nabble.com/Process-gt-Math-gt-Exp-td5009733.html&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do that in matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is the matlab code which I wrote,Please correct my mistakes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;close all;&#xA;clc;&#xA;img=imread('http://s6.uplod.ir/i/00594/fdg3933aznwz.jpg');&#xA;im=rgb2gray(img);&#xA;im=im2double(im);&#xA;&#xA;figure,imshow(im)&#xA;&#xA;    for i=1:size(im,1)&#xA;        for j=1:size(im,2)&#xA;&#xA;          in = (im(i,j)+1);&#xA;          result(i,j) = 255*exp(in/46.01);&#xA;&#xA;        end&#xA;    end&#xA;figure,imshow(mat2gray(result))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14844" LastEditorUserId="14844" LastEditDate="2015-05-08T11:28:45.543" LastActivityDate="2015-05-08T11:57:40.243" Title="Enhance image in matlab - exp operation - imageJ software-LPR" Tags="|image-processing|matlab|enhancement|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23260" PostTypeId="1" AcceptedAnswerId="23262" CreationDate="2015-05-07T22:07:06.700" Score="0" ViewCount="495" Body="&lt;p&gt;I have been trying to achieve a Hamming window length of 23 using the equation.&lt;/p&gt;&#xA;&lt;p&gt;I tried several coding, one of the is the one below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;M=23&#xA;w = .54 + .46*cos(pi*(-M:M-1)'/M)&#xA;plot(w)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15744" LastEditorUserId="4298" LastEditDate="2020-11-08T17:02:52.637" LastActivityDate="2020-11-08T17:02:52.637" Title="MATLAB Hamming window" Tags="|matlab|filters|window-functions|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23261" PostTypeId="2" ParentId="23260" CreationDate="2015-05-07T22:46:21.057" Score="-1" Body="&lt;p&gt;There is a default function in MatLab which can generate this for you, called &lt;a href=&quot;http://nl.mathworks.com/help/signal/ref/hamming.html&quot; rel=&quot;nofollow&quot;&gt;hamming&lt;/a&gt;. In case you do not have access to this function, because you do not have the signal processing toolbox, you could try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = 23;&#xA;w = 0.54 - 0.46 * cos(2 * pi * linspace(0, 1, M));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7579" LastActivityDate="2015-05-07T22:46:21.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23262" PostTypeId="2" ParentId="23260" CreationDate="2015-05-07T23:58:49.670" Score="1" Body="&lt;p&gt;If the length of the window should be $23$, $M$ must equal $(23-1)/2=11$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;M = 11;&#xA;m = -M:M;&#xA;w = .54 + .46*cos(pi*m/M);&#xA;plot(m,w)&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-07T23:58:49.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23263" PostTypeId="2" ParentId="23260" CreationDate="2015-05-08T00:14:36.897" Score="1" Body="&lt;p&gt;You need to do two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Evaluate the cosine only at 23 points, not at 46 like you're doing in your code above.&lt;/li&gt;&#xA;&lt;li&gt;Generate a time vector to go with your window signal. This means you'll also need to specify your sampling frequency.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can do it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M = 23;    % samples in the window&#xA;Ts = 1;    % sampling interval&#xA;w = 0.54+0.46*cos((2*pi/(M-1))*(-(M-1)/2:(M-1)/2));  % window&#xA;t = Ts*(-(M-1)/2:(M-1)/2);  % time vector&#xA;plot(t,w);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that I've used a slightly different definition of the window formula. This code produces the same window as Matlab's &lt;code&gt;hamming&lt;/code&gt; command.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-08T00:14:36.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23265" PostTypeId="2" ParentId="23259" CreationDate="2015-05-08T11:57:40.243" Score="1" Body="&lt;p&gt;You have to learn to debug your programs. Try formula for some data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; 255*exp(255/46.01)&#xA;  ans =   6.5091e+004&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So formula has bug (explanation in link to forum is valid. Read it carefully). Valid formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; exp(255/46.01)&#xA; ans =  255.26&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But try calculation with real data from your image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; in = (im(10,10)+1)&#xA;in = 254&#xA;&amp;gt;&amp;gt; exp(in/46.01)&#xA;ans =  403.43    % very strange result!!!!&#xA;&amp;gt;&amp;gt; in/46.01&#xA;ans = 6          %what is it????&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reason is quite simple - type of &lt;strong&gt;in&lt;/strong&gt; is &lt;em&gt;uint8&lt;/em&gt;!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Valid formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result(i,j) = exp(double(in)/46.01);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imshow(uint8(result));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vngRY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2015-05-08T11:57:40.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23268" PostTypeId="2" ParentId="23258" CreationDate="2015-05-08T18:04:26.353" Score="0" Body="&lt;p&gt;The signal can not be reconstructed because in the new sampled signal the sampling theorem is violated.  Aliasing would occur and the signal reconstructed would  be a lower frequency than the original signal.&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2015-05-08T18:04:26.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23271" PostTypeId="2" ParentId="22893" CreationDate="2015-05-08T22:15:56.953" Score="1" Body="&lt;p&gt;Since you're interested in implementing algorithms yourself, I would suggest it as a very flexible algorithm which can be adapted to a very wide variety of situations - &lt;a href=&quot;http://inf.ufrgs.br/%7Eeslgastal/AdaptiveManifolds/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adaptive Manifolds for Real Time High Dimensional Filtering&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The adaptability and flexibility of it is very appealing.&lt;/p&gt;&#xA;" OwnerDisplayName="user15757" LastEditorUserId="7092" LastEditDate="2021-08-18T12:12:58.753" LastActivityDate="2021-08-18T12:12:58.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23272" PostTypeId="2" ParentId="23251" CreationDate="2015-05-08T22:49:58.023" Score="1" Body="&lt;p&gt;Assuming that they are adjacent and have a &quot;red&quot; energy/pixel value distinct from not projected areas, you may use a simple 2D filter, that fits the size of expected dispersion, and that way get the local maximum that represents the center of the collection of points that represents a single projection.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-05-08T22:49:58.023" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23278" PostTypeId="2" ParentId="23258" CreationDate="2015-05-09T10:50:45.643" Score="0" Body="&lt;p&gt;If you take your input signal and downsample it by a factor of 3 your original frequency of 450 Hz will be aliased. But since you single contains a single frequency it can be reconstructed.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example (in MATLAB), let's generate 1024 samples of your signal: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;&#xA;t = (0:1023)/Fs;&#xA;xa = cos(2*pi*450*t);&#xA;figure; pwelch(xa,[],[],[],Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/srM46.png&quot; alt=&quot;Spectrum of $x_a$&quot;&gt;&lt;br&gt;&#xA;Now if you down sample your signal you notice that the frequency has changed.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xad = xa(1:3:end);&#xA;figure; pwelch(xad,[],[],[],Fs/3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6n0QI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you try to interpolate the signal back to the original sampling frequency, you can see that there is some kind of &quot;ambiguity&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xadu = upsample(xad,3);&#xA;figure; pwelch(xadu,[],[],[],Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TGXvV.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that the amplitude is lower (by a factor of 3 actually).&lt;br&gt;&#xA;All there is left is to filter the signal using a high-pass filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = fir1(32,350/500,'high');&#xA;xaduf = filter(3*h,1,xadu);&#xA;xar = xaduf(37:end);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-05-09T10:50:45.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23280" PostTypeId="2" ParentId="14733" CreationDate="2015-05-09T12:57:01.027" Score="-1" Body="&lt;p&gt;These terms are validation metrics used for verifying quality of a segmented image. In a scenario where you want to compare a segmented image with ground truth, then taking the ground truth image as base of comparison you can make assumption of taking foreground as &quot;white&quot; pixels and background as &quot;black&quot; pixels in ground-truth. The terms that you referred then would mean:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;True positive (TP)&lt;/strong&gt;  : pixels correctly segmented as foreground&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;False positive (FP)&lt;/strong&gt; : pixels falsely segmented as foreground&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;True negative (TN)&lt;/strong&gt;  : pixels correctly detected as background&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;False negative (FN)&lt;/strong&gt; : pixels falsely detected as background&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These metrics are then used to calculate sensitivity, specificity and accuracy as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;sensitivity&lt;/em&gt;&lt;/strong&gt; : &#xA;The sensitivity tells us how likely the test is come back positive in someone who has the characteristic. This is calculated as &lt;code&gt;TP/(TP+FN)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;specificity&lt;/em&gt;&lt;/strong&gt; : &#xA;The specificity tells us how likely the test is to come back negative in someone who does not have the characteristic. This is calculated as &lt;code&gt;TN/(TN+FP)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;accuracy&lt;/em&gt;&lt;/strong&gt; : &lt;code&gt;(TP+TN)/(TP+FP+TN+FN)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps !!&lt;/p&gt;&#xA;" OwnerUserId="15762" LastEditorUserId="7092" LastEditDate="2015-05-09T17:51:58.383" LastActivityDate="2015-05-09T17:51:58.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23281" PostTypeId="1" CreationDate="2015-05-09T13:51:44.220" Score="0" ViewCount="1507" Body="&lt;p&gt;I need to extend lines over the image space. I used Hough transform to finde vanishing lines, but i need to get lines longer and see where is vanishing points.&#xA;How can i do it? Please help. &lt;img src=&quot;https://i.stack.imgur.com/QzHww.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear; clc;&#xA;&#xA;I = imread('22pp.jpg');&#xA;&#xA;%rotI = imrotate(I,33,'crop');&#xA;bw_I = rgb2gray(I);&#xA;BW = edge(bw_I,'canny');&#xA;&#xA;figure, imshow(BW); %pause;&#xA;&#xA;BW=edge(BW,'canny',(graythresh(I)*(0.3)),'horizontal'); &#xA;&#xA;figure, imshow(BW); %pause;&#xA;&#xA;[H,T,R] = hough(BW);&#xA;imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit');&#xA;xlabel('\theta'), ylabel('\rho');&#xA;axis on, axis normal, hold on;&#xA;P  = houghpeaks(H,15,'threshold',ceil(0.3*max(H(:))));&#xA;x = T(P(:,2)); y = R(P(:,1));&#xA;plot(x,y,'s','color','white');&#xA;% Find lines and plot them&#xA;lines = houghlines(BW,T,R,P,'FillGap',200,'MinLength',200);&#xA;figure, imshow(I), hold on&#xA;&#xA;for k = 1:length(lines)&#xA;   xy = [lines(k).point1; lines(k).point2];&#xA;   plot( xy(:,1) ,  xy(:,2),  'LineWidth',2,'Color','green');&#xA;&#xA;   % Plot beginnings and ends of lines&#xA;   plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');&#xA;   plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15764" LastEditorUserId="1849" LastEditDate="2015-05-09T14:34:16.307" LastActivityDate="2016-06-03T11:35:12.097" Title="How to extend hough lines over the image space" Tags="|matlab|hough-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23282" PostTypeId="1" AcceptedAnswerId="23284" CreationDate="2015-05-09T14:46:18.180" Score="0" ViewCount="887" Body="&lt;p&gt;I just finished learning about Fourier Transforms and don't understand this signal: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \cos(\omega t)u(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a cosine wave but only where $\omega$ is positive. My question is what can I do to figure out the output when the impulse response $h(t) = e^{-2\pi t}u(t)$ ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I first try to break $x(t)$ up using Euler to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \frac{1}{2} \left[e^{j2\pi t} + e^{-j2\pi t}\right]$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;then get FT of each component and use convolution property to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(j\omega) = H(j\omega)X(j\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but kept getting an incorrect answer.&lt;/p&gt;&#xA;" OwnerUserId="15766" LastEditorUserId="7092" LastEditDate="2015-05-10T21:40:13.790" LastActivityDate="2015-05-10T21:40:13.790" Title="LTI system, Fourier transform, unit step function, sine wave" Tags="|fourier-transform|linear-systems|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23283" PostTypeId="2" ParentId="23282" CreationDate="2015-05-09T15:07:53.550" Score="2" Body="&lt;p&gt;I can see three problems here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) $x(t)$ is a cosine wave but only where $t$ is positive, not $\omega$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You must keep the step function when applying Euler's identity, and I can't see the cosine frequency in your second expression for $x(t)$ either. Always make sure your identity is right, with &lt;a href=&quot;https://www.wolframalpha.com/&quot; rel=&quot;nofollow&quot;&gt;WolframAlpha&lt;/a&gt; for example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Do not mix up your $\omega$ that is a parameter to $\cos(\omega t)$ and the $\omega$ variable of the frequency domain in $X(j\omega)$. Use different notations, like $\cos(\omega_0t)$&lt;/p&gt;&#xA;" OwnerUserId="15743" LastEditorUserId="8202" LastEditDate="2015-05-10T10:02:07.390" LastActivityDate="2015-05-10T10:02:07.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23284" PostTypeId="2" ParentId="23282" CreationDate="2015-05-09T15:24:38.067" Score="1" Body="&lt;p&gt;Some errors in your question were already pointed out in gsmafra's answer. Here I'll give you some more hints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input signal is a cosine that is switched on at $t=0$. There's no real shortcut here, you just have to compute the convolution integral:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\int_{-\infty}^{\infty}x(\tau)h(t-\tau)d\tau\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the input signal starts at $t=0$, and since the system is causal (i.e., $h(t)=0$ for $t&amp;lt;0$), the integral (1) can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=u(t)\int_{0}^{t}\cos(\omega_0\tau)e^{-2\pi(t-\tau)}d\tau=&#xA;e^{-2\pi t}u(t)\int_{0}^{t}\cos(\omega_0\tau)e^{2\pi\tau}d\tau\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This integral can be easily computed using $\cos(\omega_0t)=\frac12(e^{j\omega_0 t}+e^{-j\omega_0 t})$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-09T15:31:31.390" LastActivityDate="2015-05-09T15:31:31.390" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23285" PostTypeId="2" ParentId="23281" CreationDate="2015-05-09T17:02:10.033" Score="1" Body="&lt;p&gt;Fit a line through the end points using standard line model $ax+by+c=0$. Then draw them on the image from -10000, 10000. The points remaining on the image will give you what you are asking for.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-05-09T17:02:10.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23286" PostTypeId="1" AcceptedAnswerId="23287" CreationDate="2015-05-09T17:22:37.430" Score="0" ViewCount="159" Body="&lt;p&gt;I am using the following code to plot a window:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m = ((33-1)/2)&#xA;n = -m:m&#xA;w = 0.54 + 0.46 *cos(pi*n/m)&#xA;stem(0: numel(w)-1, w)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is giving the following plot: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SmsAP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I tried zero-padding the window with 200. I used the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m = ((33-1)/2)&#xA;n = -m:m&#xA;w = 0.54 + 0.46 *cos(pi*n/m)&#xA;w_zp = padarray(w, 200, 'pre')&#xA;stem(0: numel(w_zp)-1, w_zp)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why is this not working please?&lt;/p&gt;&#xA;" OwnerUserId="15744" LastActivityDate="2015-05-09T19:24:01.583" Title="Zero-padding a plot" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23287" PostTypeId="2" ParentId="23286" CreationDate="2015-05-09T19:24:01.583" Score="0" Body="&lt;p&gt;I've never used &lt;code&gt;padarray&lt;/code&gt;, but for such a simple example you might as well use (assuming &lt;code&gt;w&lt;/code&gt; is a row vector as in your code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;Npre = 100;    % # zeros before w&#xA;Npost = 100;   % # zeros after w&#xA;w_zp = [zeros(1,Npre), w, zeros(1,Npost)];&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-09T19:24:01.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23288" PostTypeId="1" AcceptedAnswerId="23295" CreationDate="2015-05-09T20:24:05.097" Score="0" ViewCount="1190" Body="&lt;p&gt;I am trying to convert the continuous time transfer function of a second order lowpass Butterworth filter is given by:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gUDR2.png&quot; alt=&quot;LP Transfer function&quot;&gt;&#xA;&lt;br&gt;&#xA;To a bandpass fourth order bandpass digital filter, I first apply the mapping to bandpass:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Pw1L1.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;We therefore obtain the bandpass continuous time transfer function&#xA;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tSbiy.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;In order to convert this to a digital filter with with band edge frequencies of 2000Hz and 2819.3 Hz, and a sampling rate of 8 kHz. We first normalise and apply bilinear prewarping&#xA;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/o5H28.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/H1LGa.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;approximating slightly we get&#xA;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/qYicE.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;Then applying the bilinear transform&#xA;&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/wisJq.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&#xA;We get the fourth order discrete time filter&#xA;&lt;img src=&quot;https://i.stack.imgur.com/K2il3.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;br&gt;&lt;br&gt;&#xA;&lt;strong&gt;However&lt;/strong&gt;&lt;br&gt;&#xA;Checking the results at the normalised angular frequencies 0 and at the bandpass center frequency 3, I find that the frequency response is not as desired. is this an arithmetic mistake or have I missed something, your help would be very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15057" LastEditorUserId="15057" LastEditDate="2015-05-11T16:28:55.167" LastActivityDate="2015-05-11T16:28:55.167" Title="Convert low pass continuous time filter design to bandpass, discrete time" Tags="|filter-design|lowpass-filter|dsp-core|transfer-function|bilinear-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23289" PostTypeId="1" AcceptedAnswerId="23291" CreationDate="2015-05-09T22:18:19.610" Score="4" ViewCount="360" Body="&lt;p&gt;This was a question from an exam of digital image processing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Working with low contrast images, an elective method to enhance details and improve contrast is to apply in cascade an equalization of the histogram and a sharpening filter technique.&#xA;a) Does the order of application of the methods matter? Justify&#xA;b) Which method would you use first? Justify&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone help me? I can't find a clear answer in the textbooks.&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="128" LastEditDate="2019-10-25T07:20:29.497" LastActivityDate="2019-10-25T07:20:29.497" Title="Equalization and then Sharpening vs Sharpening and then Equalization" Tags="|image-processing|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23291" PostTypeId="2" ParentId="23289" CreationDate="2015-05-10T07:48:20.027" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;Since the Histogram Equalization isn't Linear Operator the order does matter and the result of the doing one before the other changes the final result.&lt;/li&gt;&#xA;&lt;li&gt;Sharpening would work best when all the Dynamic Range is used.&lt;br&gt;&#xA;Hence I'd first maximize the Dynamic Range by Histogram Equalization and then would apply the sharpening.&lt;br&gt;&#xA;You might also think of the noise when making this choice.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2015-05-11T06:09:48.973" LastActivityDate="2015-05-11T06:09:48.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23293" PostTypeId="1" AcceptedAnswerId="23300" CreationDate="2015-05-10T08:46:25.850" Score="0" ViewCount="151" Body="&lt;p&gt;I'm driving a white noise signal $e(n)$ through an AR random process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(n)=e(n)+\sum\limits_{k=1}^N \alpha_k x(n-k) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got five values of $\alpha_k$ and plotted its power spectrum in Matlab for $\omega$ from $0$ to $\pi$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I generated the realizations of $x(n)$ with 10000 samples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm trying to get the estimate of the spectrum from the expectation data using the periodogram formula &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S_{per}(\omega)= \frac{1}{K} \left|\sum\limits_{k=0}^{K-1}x[k]e^{-j\omega k} \right|^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $K=256$ the number of first values of $x(n)$. When I run my code what I get is a vector with the same value in every position, so I'm plotting a straight line. I think that just applying the formula I should get the estimate, so what am I doing wrong? :-S&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the section of the code I'm using to find the estimates&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var_e=0.01;                                  % noise variance&#xA;b_1=1.4261;                                  % coefficients&#xA;b_2=-.7634;&#xA;b_3=-.9002;&#xA;b_4=1.2548;&#xA;b_5=-.5707;    &#xA;K=256;&#xA;wn=rand(1,10000)-0.5;                        % white noise&#xA;samp=1:1:1e4;&#xA;T=10000;&#xA;x=zeros(1,length(samp));&#xA;% here I generate the expectations&#xA;for n=6:T+5&#xA;    x(n)=b_1*x(n-1)+b_2*x(n-2)+b_3*x(n-3)+b_4*x(n-4)+b_5*x(n-5)+wn(n-5);&#xA;end&#xA;x=x(6:end);&#xA;figure&#xA;plot(samp,x)&#xA;    for i=1:length(w)                         % w is the frequency, has 1000 &#xA;        for k=1:K&#xA;        per2(i)=sum(x(k)*exp(-j*k*i));        % sum of exponentials&#xA;        pe2(i)=per2(i)*conj(per2(i));         % squared&#xA;        end&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help&lt;/p&gt;&#xA;" OwnerUserId="15598" LastEditorUserId="15598" LastEditDate="2015-05-11T00:23:26.873" LastActivityDate="2015-05-11T00:23:26.873" Title="Getting wrong periodogram" Tags="|frequency-spectrum|power-spectral-density|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23294" PostTypeId="1" AcceptedAnswerId="23297" CreationDate="2015-05-10T15:02:58.603" Score="0" ViewCount="1330" Body="&lt;p&gt;All physical channels are band-limited, such that,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;X(f) = 0 for |f| &gt; W&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A Gaussian Channel is limited in both power and bandwidth. For this reason we encounter phrases, such as, &quot;A band-limited Gaussian Channel&quot; (for e.g., in the opening statement of Channel Capacity theorem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why/How a Gaussian Channel is band-limited and Power limited? &lt;/li&gt;&#xA;&lt;li&gt;What are physical implications of using such a channel?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Please help/guide me to understand this.&lt;/p&gt;&#xA;" OwnerUserId="15340" LastActivityDate="2015-05-10T18:24:07.357" Title="Why/How a Gaussian Channel is both band-limited and Power limited?" Tags="|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23295" PostTypeId="2" ParentId="23288" CreationDate="2015-05-10T15:38:58.263" Score="0" Body="&lt;p&gt;There is an error in the analog bandpass filter transfer function. If you apply the LP-BP transformation as you stated it you should get the following transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s)=\frac{s^2(\Omega_2-\Omega_1)^2}{s^4+\sqrt{2}(\Omega_2-\Omega_1)s^3+(\Omega_1^2+\Omega_2^2)s^2+\sqrt{2}\Omega_1\Omega_2(\Omega_2-\Omega_1)s+\Omega_1^2\Omega_2^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the given band edge frequencies (note that the lower band edge of the discrete-time filter must be $2000\,\text{Hz}$, not $4000\,\text{Hz}$) you correctly got $\Omega_1=2$ and $\Omega_2=4$. Applying the bilinear transform to the analog bandpass transfer function with these band edges finally gives the following discrete-time transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{z^4-2z^2+1}{(10+3\sqrt{2})z^4+(12+2\sqrt{2})z^3+20z^2+(12-2\sqrt{2})z+10-3\sqrt{2}}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-10T15:38:58.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23296" PostTypeId="1" CreationDate="2015-05-10T15:39:57.733" Score="4" ViewCount="550" Body="&lt;p&gt;I understand how the discrete cosine transform is used in image compression in standards like JPEG. However, the concept of wavelets is a mystery to me. I do know that wavelets are functions that have a wave like functions with value &gt;0 only for short intervals of time, then they vanish. That is why they are called wavelets. I do not know anymore&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is not clear to me is precisely how such functions help in image compression and achieve a higher compression rate than our other transforms like the cosine transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best place to learn this?&lt;/p&gt;&#xA;" OwnerUserId="4464" LastActivityDate="2022-02-13T18:47:11.827" Title="How does a wavelet help in image compression?" Tags="|wavelet|image-compression|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23297" PostTypeId="2" ParentId="23294" CreationDate="2015-05-10T15:48:16.753" Score="0" Body="&lt;p&gt;What is usually meant by a Gaussian channel is a channel with additive (white) Gaussian noise (AWGN), which simply means that the received signal will equal the transmitted signal plus some unknown noise with a certain power and a Gaussian probability density function. A pure AWGN channel is neither band-limited nor power-limited. However, these restrictions are present in real-world systems, so it is usually assumed that the channel is a &lt;em&gt;band-limited&lt;/em&gt; AWGN channel. Furthermore, it is normally assumed that the transmitter can transmit with some given maximum power. This latter fact will result in a bound on the achievable signal-to-noise ratio (SNR).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to answer your question, the finite band-width and the power limitation are realistic constraints, but they have nothing to do with the AWGN channel, which only specifies the type of noise (Gaussian) and how it influences the signal (by addition).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-10T15:48:16.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23298" PostTypeId="2" ParentId="23296" CreationDate="2015-05-10T17:45:38.680" Score="6" Body="&lt;p&gt;A common wavelet based standard is JPEG 2000 and a common DCT based standard is JPEG. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;JPEG 2000 uses wavelets, but a good portion of the better compression it achieves than JPEG is due to the fact that JPEG uses a much much simpler entropy coder (JPEG does context-dependent Huffman codes and run length coding, JPEG 2000 does arithmetic coding with some extra tricks). You can gain a &lt;em&gt;lot&lt;/em&gt; by tweaking the entropy coding stage. The particular wavelet transform you choose will make a difference as well. And how you decide to compress the coefficients makes a huge difference as well (JPEG reads its dct block coefficients in a zig-zag pattern and uses run length coding to compress long runs of zeros in the higher freq components due to the nature of the quantizers it uses).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The primary advantage of wavelets as used in JPEG 2000 versus rounding the DCT coefficients in the manner of JPEG is that it reduces blocking artifacts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not familiar with wavelets, you can look at an introductory text on wavelets, like Mallat's Wavelet tour of Signal Processing or &lt;a href=&quot;http://www.fourierandwavelets.org/&quot; rel=&quot;noreferrer&quot;&gt;Vetterli's new book&lt;/a&gt; (freely available online). Then, you can read the JPEG 2000 standard. These &lt;a href=&quot;http://www.intopix.com/pdf/JPEG%202000%20Handbook.pdf&quot; rel=&quot;noreferrer&quot;&gt;notes&lt;/a&gt; are kinda nice at a high level as well (and it has good pointers to the references).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a quick review of JPEG, you can look at Gonzalez &amp;amp; Woods' Digital Image Processing (second or third edition should be fine).&lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-05-10T17:45:38.680" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23300" PostTypeId="2" ParentId="23293" CreationDate="2015-05-10T18:59:29.427" Score="0" Body="&lt;p&gt;I think that is because your exponentials are wrong.&lt;br&gt;&#xA;There is no variable named &lt;code&gt;w&lt;/code&gt; in your code, although you refer to it, so I believe it should be something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;per2(i)=sum(x(k)*exp(-2j*pi*k*w(i))));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But consider using &lt;code&gt;fft&lt;/code&gt; instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pe2 = abs(fft(x)).^2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pe2 = abs(fft(x(1:K))).^2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if you insist on using only $K$ samples for some reason (why generate 10000 sample then??).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps you should consider the Welch method, with length 256&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pe2 = pwelch(x,256,128,256);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;BTW - you can generate AR process using filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = filter(1,a,wn);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;a&lt;/code&gt; is the vector of AR coefficients.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-05-10T18:59:29.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23301" PostTypeId="2" ParentId="23293" CreationDate="2015-05-10T19:13:25.383" Score="0" Body="&lt;p&gt;I think the mistake is in the for loop&lt;br&gt;&#xA;instead put it as &#xA;&lt;code&gt;&#xA;pe2=zeros(K,1);&#xA;for i=1:K &#xA;    for l=1:K&#xA;       per2(k)=(x(k)*exp(-1i*double(k*l*2)*pi/K));&#xA;    end&#xA;     pe2(i)=(abs(sum(per2))^2;&#xA;end&#xA;plot(pe2);&#xA;&lt;/code&gt;&#xA;this gives the PSD plot for x(1:256)&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-05-10T19:13:25.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23302" PostTypeId="1" AcceptedAnswerId="23303" CreationDate="2015-05-10T19:45:02.880" Score="0" ViewCount="620" Body="&lt;p&gt;I am just branching out to taking the power spectrum of short-term audio frames ($20$ ms) in order to extract useful audio features.  I have been reading about Welsh's method which states that after computing the squared magnitude of the result, the individual periodograms are time-averaged which reduced the variance of the individual power measurements.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping somebody could explain what and how time-averaging is achieved?  Is it done by looking at the individual squared bins within a given frame, or does it compare a previous frame to a present frame like a Spectral Flux?  Also, I take it that a periodogram refers to the periodicity of a given audio frame?  Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15770" LastEditorUserId="7092" LastEditDate="2015-05-10T21:40:34.637" LastActivityDate="2015-05-10T21:40:34.637" Title="Welch's Power Spectral Density - Time-Averaging Explanation" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23303" PostTypeId="2" ParentId="23302" CreationDate="2015-05-10T21:07:06.657" Score="0" Body="&lt;p&gt;Periodogram averaging means that the squared DFTs of consecutive frames are averaged (per frequency bin). If $k$ denotes the frequency index and $l$ denotes the frame index, the averaged periodogram is computed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\overline{P}[k]=\frac{1}{L}\sum_{l=0}^{L-1}P[k,l]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $P[k,l]$ is the $k^{th}$ element of the squared magnitude of the DFT of the frame with index $l$. In (1) the averaging is done over $L$ frames. This is only useful if the signal can be assumed to be stationary during these $L$ time frames.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-10T21:07:06.657" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23305" PostTypeId="1" CreationDate="2015-05-11T01:18:23.567" Score="1" ViewCount="598" Body="&lt;p&gt;I found this equality in the middle of my DFT calculation. Can anyone help me to proof this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \frac{1}{N} \sum\limits_{k=0}^{N-1} \left(-W_N^n \right)^k \ = \ \delta[n-0.5 N] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ W_N = e^{j 2 \pi/N} $&lt;/p&gt;&#xA;" OwnerUserId="15570" LastEditorUserId="4346" LastEditDate="2015-05-11T02:00:56.010" LastActivityDate="2015-05-11T02:20:23.710" Title="DFT dirac simplification" Tags="|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23306" PostTypeId="2" ParentId="23305" CreationDate="2015-05-11T02:20:23.710" Score="2" Body="&lt;p&gt;it's not a Dirac delta, it's a Kroenecker (discrete-time) delta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} \frac{1}{N} \sum\limits_{k=0}^{N-1} \left(-W_N^n \right)^k \ &amp;amp; = \ \frac{1}{N} \sum\limits_{k=0}^{N-1} \left(-e^{j 2 \pi n/N} \right)^k \\&#xA;&amp;amp; = \ \frac{1}{N} \sum\limits_{k=0}^{N-1} \left(e^{-j\pi}e^{j 2 \pi n/N} \right)^k \\&#xA;&amp;amp; = \ \frac{1}{N} \sum\limits_{k=0}^{N-1} \left(e^{j 2 \pi (n-N/2)/N}\right)^k  \\&#xA;&amp;amp; = \ \frac{1}{N} \frac{1 - e^{j 2 \pi (n-N/2)}}{1 - e^{j 2 \pi (n-N/2)/N}} \\&#xA;&amp;amp; = \ \begin{cases} \frac{1}{N} N \text{  for } n = N/2 + mM \text{  where } m \in \text{integers} \\ \frac{1}{N} 0 \text{  otherwise} \\ \end{cases}&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so it's not exactly $ \delta[n-N/2] $ but more like discrete kronecker comb.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1}{N} \sum\limits_{k=0}^{N-1} \left(-e^{j 2 \pi n/N} \right)^k  =  \sum\limits_{m=-\infty}^{+\infty} \delta[n-N/2+mN]$$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-05-11T02:20:23.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23308" PostTypeId="1" CreationDate="2015-05-11T07:48:04.923" Score="0" ViewCount="28" Body="&lt;p&gt;I would like to implement a Rayleigh fading channel for an ASK Modulation. My question is concerning the receiver. How to properly add every tap at the receiver to keep the same length from the emitter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance :&#xA;Emitter : binary frame : 1*N&#xA;Channel : six taps : M*N (where M is the number of taps)&#xA;Receiver : 1*N&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards.&lt;/p&gt;&#xA;" OwnerUserId="15738" LastActivityDate="2015-05-11T07:48:04.923" Title="Receiver multiple taps" Tags="|fading-channel|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23310" PostTypeId="1" CreationDate="2015-05-11T11:25:17.627" Score="0" ViewCount="759" Body="&lt;p&gt;I have two splited images from diference matlab files. Now i need to merge them, near to each other. I tried supblot, imadd,cat methods, but nothing works. Please help me. &lt;img src=&quot;https://i.stack.imgur.com/5Bnkm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;rezult after sublot experiment.&lt;img src=&quot;https://i.stack.imgur.com/a4AJ5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15764" LastActivityDate="2015-09-08T16:38:22.630" Title="how to add two images in one, next to each other" Tags="|matlab|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23311" PostTypeId="2" ParentId="20428" CreationDate="2015-05-11T11:30:46.447" Score="0" Body="&lt;p&gt;Yes, you can calculate the frequency response. Amplitude modulation is convolution in the frequency domain.The window is amplitude modification/smoothing and as such this works. So, all you need to do is convolve the frequency response with the frequency response of the Hamming window's function. &lt;/p&gt;&#xA;" OwnerUserId="10925" LastActivityDate="2015-05-11T11:30:46.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23312" PostTypeId="2" ParentId="23310" CreationDate="2015-05-11T11:52:43.267" Score="0" Body="&lt;p&gt;Not exactly sure what you want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to put both images into one matrix, then you could do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% just some sample data&#xA;img1 = repmat(0:0.01:1,100,1);&#xA;img2 = repmat(1:-0.015:0,120,1);&#xA;&#xA;% create new image with enough space next to each other&#xA;newImage = zeros(max(size(img1,1),size(img2,1)),size(img1,2)+size(img2,2));&#xA;newImage(1:size(img1,1),1:size(img1,2)) = img1;&#xA;newImage(1:size(img2,1),size(img1,2) + (1:size(img2,2))) = img2;&#xA;% visualize&#xA;imshow(newImage)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11477" LastActivityDate="2015-05-11T11:52:43.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23313" PostTypeId="1" CreationDate="2015-05-11T12:23:43.303" Score="0" ViewCount="133" Body="&lt;p&gt;Suppose I have a signal which varies between two frequencies (which represent a stream of binary data). I think this is called BFSK. I have the entire signal already sampled. Let's say each 'bit' lasts 10ms. My plan was to have bins of 10ms, and do FFT to find the dominant frequency, and deduce the bit from that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is finding the start position of the sequency. The signal is garbled with noise, and has a significant RMS white noise. I have attached a picture of what I'm trying to convey. Note that the actual signal's amplitude won't be as differentiable between the unwanted noise and the wanted frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I find where the 'wanted' signal starts? Should I be trying a binary search tree (halving each window or something), or is there a more direct approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wtJqi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15779" LastActivityDate="2015-05-11T12:23:43.303" Title="How do you find the position of when a signal changes frequency?" Tags="|fft|demodulation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23315" PostTypeId="1" CreationDate="2015-05-11T13:22:24.607" Score="1" ViewCount="1643" Body="&lt;p&gt;While decomposing the impulse train using the Fourier series the number of the samples are infinite hence representing a infinite length of train.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But while studying the Nyquist Criteria in the frequency domain it is shown &#xA;the expression to have $m$ samples where  $-\infty&amp;lt;m&amp;lt;\infty$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While studying the concept of the Nyquist Criteria in the ISI model where for the system to be interference free the value of the sampling instant must be given as following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h\left(nT_s\right)=\begin{cases}1;&amp;amp;n=0\\0;&amp;amp;n\neq0\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more reference &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist_ISI_criterion&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. I cannot understand that the signal is having infinite duration and infnite bandwidth accordingly is it even possible.&lt;/p&gt;&#xA;" OwnerUserId="15093" LastEditorUserId="1629" LastEditDate="2016-03-26T16:52:19.973" LastActivityDate="2016-03-26T16:52:19.973" Title="Can an infinite bandwidth signal be an infinite-time signal?" Tags="|discrete-signals|fourier-transform|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23317" PostTypeId="1" CreationDate="2015-05-11T14:22:45.310" Score="0" ViewCount="225" Body="&lt;p&gt;I designed the filter below on paper: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FIR&#xA;low pass&#xA;type 1&#xA;length 3&#xA;alpha = 6&#xA;beta = -12&#xA;allow freq. &amp;lt;= 0.1rad/sample&#xA;blocked freq. &amp;gt;= 0.4rad/sample&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To confirm that my calculations are correct I was planning to design the filter on MATLAB. Is there a function to design this filter, apply an input frequency and check the output result?&lt;/p&gt;&#xA;" OwnerUserId="15744" LastActivityDate="2016-03-06T22:06:34.623" Title="DSP finite impulse response (MATLAB)" Tags="|matlab|finite-impulse-response|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23318" PostTypeId="2" ParentId="23315" CreationDate="2015-05-11T14:26:55.757" Score="4" Body="&lt;p&gt;Let's consider the continuous time case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a Gaussian $f(t) = \frac{1}{\sqrt{2 \pi}} e^{-t^2/2}$, which is positive for all time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of a Gaussian is another Gaussian: $F(\omega)= c e^{- d \omega^2 }$ for some constants $c,d$  that you can work out on your own, so a Gaussian occupies all time and all frequency. That is, you can be both infinite in time and infinite in frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your trade-off between resolution in time and frequency is given by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Fourier_transform#Uncertainty_principle&quot; rel=&quot;nofollow&quot;&gt;uncertainty principle&lt;/a&gt;. The Gaussian attains equality in the uncertainty principle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like you're somewhat confused as to what Nyquist's sampling theorem says -- see &lt;a href=&quot;http://cnx.org/contents/f65cf38c-c974-4a34-87b0-d4dc8863c79c@8/Sampling_Theorem&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; for details (or your favorite signal processing text). You're assuming the signal is band-limited (i.e. is non-zero in some finite interval of frequencies) in order to be able to sample the signal at some prescribed rate in order to be able to perfectly reconstruct the signal. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-05-11T14:26:55.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23319" PostTypeId="2" ParentId="23315" CreationDate="2015-05-11T14:35:24.900" Score="3" Body="&lt;p&gt;To complement Batman's answer: what you can't have is a signal that is  both band-limited and time-limited. The sampling theorem requires the sampled signal to be band-limited, and this implies that the signal has infinite duration. This is why the theorem requires an infinite number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding ISI, again the pulses being transmitted are assumed to be band-limited, which implies that they are of infinite duration (for example, sinc or raised cosine pulses).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, we assume that signals tend to zero as $|t|\rightarrow\infty$ and that their spectrum also tends to zero as $|f|\rightarrow\infty$. This allows us to truncate the signals both in time and in frequency with negligible negative consequences.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-11T14:35:24.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23320" PostTypeId="1" CreationDate="2015-05-11T14:45:34.060" Score="1" ViewCount="1380" Body="&lt;p&gt;I am new to DSP and filter design. I have developed a code in C++ to calculate FIR coefficients using Parks-McClellan algorithm. The inputs to calculations are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Filter type (Low-Pass, High-Pass)&lt;/li&gt;&#xA;&lt;li&gt;Passband Freq [Hz]&lt;/li&gt;&#xA;&lt;li&gt;Stopband Freq [Hz]&lt;/li&gt;&#xA;&lt;li&gt;Passband Ripple [dB]&lt;/li&gt;&#xA;&lt;li&gt;Stopband Attenuation [dB].&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I got a new requirement for inputs, namely to use:&#xA;1. Cutoff freq (6dB@1.6kHz)&#xA;2. Slope [24dB/octave].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to convert these inputs into the inputs I used in my C++ code, as listed above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, more general question, how to design FIR filter with custom slope?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="4298" LastEditDate="2018-08-07T22:32:51.763" LastActivityDate="2018-08-07T22:32:51.763" Title="FIR Filter Design - input parameters conversion" Tags="|filters|filter-design|digital-filters|parks-mclellan|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="23322" PostTypeId="1" CreationDate="2015-05-11T16:16:04.973" Score="0" ViewCount="55" Body="&lt;p&gt;I am trying to identify a system based on input/output response and thereby estimate a transfer function. &#xA;I generated a frequency sweep function in Mathematica which gives me the discrete values of a frequency sweep.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;g[t_] := 0.799760*Sin[2 Pi (3 t/333.3 + 1) t];&#xA;Plot[g[t], {t, 0, 1000000000000000000000000000000}]&#xA;g[#] &amp;amp; /@ Range[0, 5, 0.001]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now I have a bunch of data but at what rate should I input it into the system, and at what rate should I read it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I apply Nyquist frequency rule here?&lt;/p&gt;&#xA;" OwnerUserId="15783" LastEditorUserId="7092" LastEditDate="2015-05-11T17:06:06.870" LastActivityDate="2015-05-12T00:43:20.410" Title="input output read/write frequency" Tags="|frequency|transfer-function|nyquist|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23323" PostTypeId="1" AcceptedAnswerId="24636" CreationDate="2015-05-11T16:36:49.690" Score="0" ViewCount="220" Body="&lt;p&gt;I remember reading that in (discrete) Fourier transform for signals with even numbered N for length, the sine and cosine count is equal. Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit of analysis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N=1, there is only DC offset, which is a cosine wave of unlimited length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N=2, Now, in addition to the DC offset term there is a other wave. But it's also a cosine wave, since trying to represent a sine with 2 points becomes impossible as only the 0 values of it can be sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N=3, Sine can be represented as well as cos so there are 1 cos, 1 sine of same frequency and the DC offset cosine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N=4, 3 cos, 1 sine, 3rd bin added with only cos wave possible.&#xA;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to me it seems that there are always going to be more cosine waves than sines. Did I make a mistake?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interpretation that DC offset is a cosine could perhaps be debated though, has there ever been debate over this term? The fact that it surpasses the boundaries of N is a bit mind boggling.&lt;/p&gt;&#xA;" OwnerUserId="10925" LastEditorUserId="10925" LastEditDate="2015-05-11T16:59:25.247" LastActivityDate="2015-07-13T16:49:41.667" Title="Fourier transform's sine and cosine count as N grows" Tags="|fourier-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23324" PostTypeId="2" ParentId="23317" CreationDate="2015-05-11T16:39:25.947" Score="1" Body="&lt;p&gt;Like Matt L. pointed out, alpha and beta is unclear as is 'type 1'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the command fdatool to interactively design filters in MATLAB, although you may need the DSP system toolbox installed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, you can apply the filter using the filter() function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, if you design the filter using FDAtool, and the filter is an FIR, you can use filter(Hd.numerator,1,X,Fs) if Hd is your filter object, X is the input sequence, and Fs is your sampling rate. This is not the only way to do this, but just the way I would go about it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;X could be generated as a sin(2*pi&lt;em&gt;n&lt;/em&gt;f*t) where t = 1/fs and n is an index in a for loop or shortened to 1:ns for the number ns you wish to have your input sequence have as a length.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-11T16:39:25.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23325" PostTypeId="1" CreationDate="2015-05-11T17:26:09.840" Score="0" ViewCount="5564" Body="&lt;p&gt;I have read that from Fourier transform we obtain magnitude and phase spectrum. The magnitude spectrum tells you how strong are the harmonics in a image and the phase spectrum tells where this harmonic lies in space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used Matlab to compute the magnitude and phase spectrum of the 2 grayscale images of babies using &lt;code&gt;fftn&lt;/code&gt; function, but the all spectrum are difficult to understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sVR0W.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mBFAj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please explain the features given in 1st paragraph by comparing the spectrums of both babies ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.phase spectrum&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.magnitude spectrum&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(If you have results other than in Matlab, explaining with your method is also okay)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image1=imread('D:\baby1.jpg');%Read colour image&#xA;image1=rgb2gray(image1);%covert colour image into Gray scale&#xA;&#xA;image2=imread('D:\baby2.jpg');%Read colour image&#xA;image2=rgb2gray(image2);%covert colour image into Gray scale&#xA;&#xA;figure,&#xA;subplot(1,3,1);&#xA;imshow(image1);&#xA;title('Gray scale Image of Baby1');&#xA;&#xA;%Apply Fourier transform on Gray scale image&#xA;fft1=fftn(image1);&#xA;fft1=log(1+fftshift(fft1));%Use log function for scaling&#xA;&#xA;%Find the magnitude spectrum&#xA;magnitude1=abs(fft1);&#xA;subplot(1,3,2);&#xA;imshow(magnitude1,[]);&#xA;title('Amplitude Spectrum 1');&#xA;&#xA;%Find the phase spectrum&#xA;phase1=angle(fft1);&#xA;subplot(1,3,3);&#xA;imshow(phase1,[]);&#xA;title('Phase Spectrum 1');&#xA;&#xA;&#xA;&#xA;figure,&#xA;subplot(1,3,1);&#xA;imshow(image2);&#xA;title('Gray scale Image of Baby2');&#xA;&#xA;%Apply Fourier transform on Gray scale image&#xA;fft2=fftn(image2);&#xA;fft2=log(1+fftshift(fft2));%Use log function for scaling&#xA;&#xA;%Find the magnitude spectrum&#xA;magnitude2=abs(fft2);&#xA;subplot(1,3,2);&#xA;imshow(magnitude2,[]);&#xA;title('Amplitude Spectrum 2');&#xA;&#xA;%Find the phase spectrum&#xA;phase2=angle(fft2);&#xA;subplot(1,3,3);&#xA;imshow(phase2,[]);&#xA;title('Phase Spectrum 2');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-05-12T15:49:30.587" LastActivityDate="2015-05-12T15:49:30.587" Title="Compare phase and magnitude spectrum results of 2 Images" Tags="|image-processing|matlab|fft|frequency-spectrum|phase|" AnswerCount="1" CommentCount="5" ClosedDate="2015-05-12T07:55:00.250" ContentLicense="CC BY-SA 3.0" />
  <row Id="23327" PostTypeId="1" AcceptedAnswerId="23328" CreationDate="2015-05-11T19:20:24.813" Score="5" ViewCount="1888" Body="&lt;p&gt;I am working on a problem which raised what should be a simple question, but I'm stuck on it. The objective is to detect a shifted &lt;strong&gt;and scaled&lt;/strong&gt; version of a known signal in the presence of Additive White Gaussian Noise (AWGN).   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of a radar system. In a radar system, you know the transmitted signal. The returned system is delayed in time and scaled. I understand that a time-delay, only shifts the location of the matched filter's peak output. No problems there. But if the scaling is unknown, then how does one construct the reference signal?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a reference signal with the an amplitude that doesn't match the amplitude of the signal in the noisy data will mean that a threshold tests based on that reference signal will be incorrect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing that in a radar system, the noise power is approximately known, and so the power of the received signal is estimated by taking the power of the received signal and subtracting the noise power. That value could then be used to scale the reference signal. Still, that would only be and approximation, and it would still effect the probability of detection and false alarm in some way. Any help is appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15784" LastEditorUserId="15784" LastEditDate="2015-05-11T19:30:05.397" LastActivityDate="2015-05-12T00:45:59.740" Title="Create Matched Filter Reference Signal when Scaling Unknown" Tags="|filters|signal-detection|matched-filter|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23328" PostTypeId="2" ParentId="23327" CreationDate="2015-05-11T19:55:45.530" Score="4" Body="&lt;p&gt;I think the problem is not as bad as you suspect it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wasn't around at the time, but from what I've read, early radar systems essentially connected the matched filter's output to an oscilloscope, and a trained operator would look at the phosphor and decide, from experience and intuition, when the signal raised above the noise (&quot;the grass&quot;) indicating a reflection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, you never know in advance the amplitude of the pulse you're looking for. There is attenuation in the channel that can change over time, even on very short time scales. Sometimes you don't know how much power the transmitter is using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are at least two solutions to this problem. One is to use automatic gain control in the receiver, so that you know in advance the power or the peak amplitude of the pulse going into the matched filter. The second is to use a training sequence or a pilot signal, so that the receiver can calibrate the thresholds appropriately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To add a bit of detail: to simplify the math, assume the signal $p(t)$ is time-symmetric and has energy 1. The transmitter emits signal $kp(t)$, with $k$ unkown at the receiver. The receiver correlates the received signal with a matched filter with impuse response $lp(t)$. When the transmitted signal is present at the receiver, the matched filter's output is $$r=kl+n,$$ which is a Gaussian random variable with mean $kl$ and variance $N_0/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When nothing but noise is present at the receiver, the matched filter's output is just $$r=n,$$ which is a Gaussian random variable with mean 0 and variance $N_0/2$. If the receiver can estimate $l$, then the problem reduces to standard hypothesis testing (see for example &lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-011-introduction-to-communication-control-and-signal-processing-spring-2010/readings/MIT6_011S10_chap14.pdf&quot; rel=&quot;nofollow&quot; title=&quot;MIT OCW notes on signal detection&quot;&gt;these notes&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-05-12T00:45:59.740" LastActivityDate="2015-05-12T00:45:59.740" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23330" PostTypeId="2" ParentId="23327" CreationDate="2015-05-12T00:27:35.857" Score="-1" Body="&lt;p&gt;I would suggest first estimation of the gain/loss by running a window with the size of your matched filter that will be compared to the value of the &quot;filter&quot; with the same window - this will average the noise impact as well (square root of the window size). Use the scale as the window moves to scale your signal and then run the matched filter.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-05-12T00:27:35.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23331" PostTypeId="2" ParentId="23325" CreationDate="2015-05-12T00:35:38.047" Score="0" Body="&lt;p&gt;When you create the transform, an embedded assumption is that you extend your image to infinity by duplicating it vertical and horizontal direction.&#xA;Each point in the transform provides information about a 1D wave (frequency that has certain direction based on the point location and phase (how it is moved along the image).&#xA;Try to draw a 1D sine wave over a 2D array and then run the 2D FFT to see how the point is created - the higher the frequency the point further from the origin. Starting at a peak will result a $90^0$ phase...&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-05-12T00:35:38.047" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23332" PostTypeId="2" ParentId="23323" CreationDate="2015-05-12T00:40:00.390" Score="0" Body="&lt;p&gt;There is no Cos and Sine. There are frequencies that represent the original signal starting with 0 rate (DC), one cycle per the N points, 2 cycles per the N points... and so on. Depends of the actual best frequency estimator of the signal the pahse of the signal is determined.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-05-12T00:40:00.390" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23333" PostTypeId="2" ParentId="23322" CreationDate="2015-05-12T00:43:20.410" Score="-1" Body="&lt;p&gt;Best to base it on the highest frequency response you anticipate for the system and implement twice that frequency with the samples you input and the data you read. &lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-05-12T00:43:20.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23334" PostTypeId="1" CreationDate="2015-05-12T01:07:10.047" Score="0" ViewCount="169" Body="&lt;p&gt;I am an auto didactic Electrical Engineer currently pursuing a goal to design a custom application targeted at deeply embedded linux(think BBB or even Raspberrypi-2) type device. My DSP background is mostly theoretical and dates back to my college days. I am currently referring to Understanding Digital Signal Processing- Richard Lyons. A tome it definitely is, but is a very basic reference at the best. I want more concrete book/reference material that helps me understand the various algorithms, their trade-offs and implementation details(pseudo code or Matlab code would definitely help me save time). For a beginner such as me who has no industry bearings, terms such as YIN,YAPPT,HPS,Cepstrum,ASDF,AMDF and many more TLAs are mere jargons. I want to do a deep dive with whatever DSP basics i have and complement that with the said reference book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plan is to investigate several algorithms, simulate them in Matlab to verify results and after selecting one based on the results of my experiments move on to actual implementation. My end requirement is that the Algorithm&#xA; has to be real-time. I basically want to hook up a Beaglebone black to my son's piano and be able to detect Pitch and onset in real-time. I have been reading some interesting questions posted here and elsewhere.But I need a strong footing on Psychoacoustics  before any of it starts making sense to me. &lt;/p&gt;&#xA;" OwnerUserId="7199" LastActivityDate="2015-05-12T19:10:01.840" Title="Authoritative DSP book/reference material on Psychoacoustics" Tags="|audio|algorithms|pitch|real-time|psychoacoustics|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23336" PostTypeId="1" CreationDate="2015-05-12T06:02:51.640" Score="1" ViewCount="169" Body="&lt;p&gt;I would like to create an &lt;strong&gt;embedded system&lt;/strong&gt; that takes a &lt;strong&gt;Full HD&lt;/strong&gt; photo by pressing a button,&lt;strong&gt;processes&lt;/strong&gt; and &lt;strong&gt;compresses&lt;/strong&gt; it(for ex. to jpg) and then sends it via Bluetooth to the smartphone - where it's saved in the photo gallery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already started to read &quot;Digital Image processing&quot; by Gonzalez, Woods, and I was thinking if, for my specific purpose, there isn't a better book with which to start. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested to gain understanding about the &lt;strong&gt;overall process&lt;/strong&gt; and the &lt;strong&gt;number of components needed&lt;/strong&gt; for my task and &lt;strong&gt;how would they connect with each other.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know any &lt;strong&gt;reference material&lt;/strong&gt;(books/articles/experiments etc.) with which I could start?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't believe that I will find everything in one single book, so you can suggest different sources of information for each step needed in the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15788" LastEditorUserId="15788" LastEditDate="2015-05-12T08:37:42.920" LastActivityDate="2015-09-11T11:26:19.593" Title="Embedded Image Processing System that sends photos to Smartphone via Bluetooth" Tags="|image-processing|hardware-implementation|photo|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23337" PostTypeId="2" ParentId="20251" CreationDate="2015-05-12T06:46:20.073" Score="4" Body="&lt;p&gt;The difference is simple. In a discrete Kalman Filter you have &lt;strong&gt;discrete System dynamics&lt;/strong&gt; and in a continuous Kalman Filter, also called Hybrid Kalman Filter, the system's dynamics are &lt;strong&gt;continuous&lt;/strong&gt;. For your case the latter is what you are going to need.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Difference in implementation:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The discrete Kalman filter is the &quot;classic&quot; version of the filter. The prediction (or prior) update step simply propagates the system state from &lt;code&gt;[k]&lt;/code&gt; to &lt;code&gt;[k+1]&lt;/code&gt; using the discrete system dynamics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a continuous time system you can't do that since the system is given as a set of differential equations. With a continuous system the prediction step of the Kalman Filter changes as you now need to &lt;strong&gt;solve the ODE&lt;/strong&gt; for the times corresponding to &lt;code&gt;k&lt;/code&gt;. The way you solve the ODE is up to you. The easiest is probably the &lt;strong&gt;Euler Method&lt;/strong&gt; and some more advanced ways are the &lt;strong&gt;Runge Kutta&lt;/strong&gt; schemes for example. The equations you are solving are&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x_dot(t) = f(t, x(t))&#xA;P_dot(t) = F(t)*P(t) + P(t)*F(t)' + Q(t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using Euler Method the prior update would look as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x[k+1] = x[k] + dT * f(k, x[k])&#xA;P[k+1] = P[k] + dT * ( F[k]*P[k] + P[k]*F[k]' + Q[k])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for the sake of simplicity I just set &lt;code&gt;t=k&lt;/code&gt; which in reality is of course not the case and depends on your sampling Time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The measurement update is the same for discrete and continuous time Kalman since the measurements are assumed to always be discrete (sensors will always send at some rate &amp;lt; infinity) and the internal states of the filter are also discrete.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Doing Continuous Time Kalman Filter is NOT the same as discretizing your continuous system and then apply discrete time Kalman Filter.&lt;/p&gt;&#xA;" OwnerUserId="15782" LastEditorUserId="15782" LastEditDate="2015-05-12T15:54:42.293" LastActivityDate="2015-05-12T15:54:42.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23338" PostTypeId="1" CreationDate="2015-05-12T07:26:02.840" Score="1" ViewCount="1841" Body="&lt;p&gt;Up sampling is when you increase the sample rate of a continuous signal. Modulation is when you, by multiplying with a carrier, shift the base frequency of a signal. But what is up conversion? How is it related with the above mentioned terms?&lt;/p&gt;&#xA;" OwnerUserId="15789" LastActivityDate="2015-05-12T10:59:10.220" Title="What is the difference between upsampling and up conversion (done during signal transmission)? Also is upconversion different from modulation?" Tags="|frequency|modulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23339" PostTypeId="1" AcceptedAnswerId="23340" CreationDate="2015-05-12T08:51:31.457" Score="0" ViewCount="69" Body="&lt;p&gt;I'm working on an algorithmus that sould  need the inverse of the SI function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;since this last once isn't oviouse to calculate, I'm trying to get only the parobla part from the SI function, to be clair , say I have this figure : &#xA;&lt;img src=&quot;https://i.stack.imgur.com/2eybF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm only interessted in the part from the max of each curve tell the point of intersection with the following one. So my question what is the fomula for the &quot;parabola part &quot; in &lt;code&gt;si&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the ploted function are all : &lt;code&gt;si(3pi X /4)&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks for any help. &lt;/p&gt;&#xA;" OwnerUserId="1785" LastActivityDate="2015-05-12T08:59:13.113" Title="Getting a part of the invert of Si function" Tags="|math|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23340" PostTypeId="2" ParentId="23339" CreationDate="2015-05-12T08:59:13.113" Score="0" Body="&lt;p&gt;There are two problems, I think: fitting a parabola to the higher part, and moving the parabola to the next part of the sequence. This will address fitting the parabola.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd just use a &lt;a href=&quot;http://www.ms.uky.edu/~ma138/Spring13/Curve_fitting.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;least squares technique&lt;/a&gt; to find the $a$, $b$, and $c$ parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows the part of the paper of interest:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qgxKh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-05-12T08:59:13.113" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23342" PostTypeId="2" ParentId="23338" CreationDate="2015-05-12T10:59:10.220" Score="2" Body="&lt;p&gt;Your first sentence is not correct.  The terminology of 'sample rate conversion' operations is often misused.  I suggest you replace your first sentence with, &quot;Interpolation is when you increase the sample rate of a DISCRETE signal sequence.&quot;  I'd also replace your second sentence with, &quot;Modulation is when you, by multiplying with a carrier frequency, shift a signal's spectral components up in frequency by a fixed amount.&quot; (The term &quot;modulation&quot; is typically used when talking about continuous signals.)  As far as I understand the terminology, &quot;up-conversion&quot; is when you shift the spectral components of a discrete sequence up in frequency by a fixed amount. [-Rick Lyons-]  &lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-05-12T10:59:10.220" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23343" PostTypeId="1" CreationDate="2015-05-12T11:44:19.047" Score="1" ViewCount="254" Body="&lt;p&gt;I have an image which has a vertical line which is 2 pixels wide and 4 pixels long and the remaining image is black. &lt;img src=&quot;https://i.stack.imgur.com/pOWhY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to find the edges in the vertical direction and for that I use the sobel operator &lt;/p&gt;&#xA;&#xA;&lt;p&gt;sobel = { {-1, 0, 1 }, { -2, 0, 2 }, { -1, 0, 1 } }&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and get the following thresholded image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KE4Rk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when I use 180 degree rotated version of the above operator such as &#xA;sobel = { {1, 0, -1 }, { 2, 0, -2 }, { 1, 0, -1 } }&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4ZksO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Using a 3 * 3 operator, do we get 2 pixels wide edge as in the previous two images? Shouldn't we get 1 pixel wide edge? and what about the edge width in case of 5 * 5 or 7 * 7 operators ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the difference between the above said operators i.e normal sobel operator and its 180 degree rotated version. Where is each one used? In this case which of the above should be used?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11189" LastActivityDate="2015-05-12T11:44:19.047" Title="Sobel Filter Operatios" Tags="|image-processing|image-segmentation|edge-detection|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23344" PostTypeId="2" ParentId="23320" CreationDate="2015-05-12T12:59:26.130" Score="4" Body="&lt;p&gt;As I've mentioned in a comment, the Parks McClellan algorithm is usually used to design frequency selective filters with a fixed maximum stopband error, which results in an equiripple behaviour in the stopband. Note that the algorithm can in principle approximate any desired frequency response shape. However, many implementations just allow for piecewise constant desired responses (which includes all standard frequency selective filters, such as low pass, high pass, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a frequency response that decays monotonically from the cut-off frequency, you probably want something like a Butterworth filter. This is an IIR filter which is usually designed via the bilinear transform from an analog prototype filter. If you want an FIR filter, then one option would be to truncate (or window) the infinite impulse response of the Butterworth filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab/Octave this can be easily done as follows. First design a digital Butterworth filter with the given specifications, compute its impulse response, and truncate it. Where to truncate depends on the error that you allow. For your example a third order Butterworth filter is sufficient. In the following example I assume a sampling frequency of $8\,\text{kHz}$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;[b,a] = butter(3,1.6/4);    % Butterworth IIR filter&#xA;h = impz(b,a,30);           % impulse response (30 coeffs)&#xA;f = logspace(0,3.6,400);    % log. frequency grid [1,4000]Hz&#xA;H = freqz(b,a,f*pi/4000);   % Butterworth frequency response&#xA;Hf = freqz(h,1,f*pi/4000);  % FIR frequency response&#xA;semilogx(f,20*log10(abs(H)),f,20*log10(abs(Hf)))&#xA;axis([1,4000,-80,5]), grid on&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/em1S5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see just a single curve because both filters (IIR and FIR) have virtually the same magnitude response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="11256" LastEditDate="2015-05-12T23:18:55.730" LastActivityDate="2015-05-12T23:18:55.730" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="23345" PostTypeId="1" AcceptedAnswerId="23378" CreationDate="2015-05-12T13:21:37.313" Score="0" ViewCount="138" Body="&lt;p&gt;I have an audio file with a high sampling rate of 250khz. It contains animal noises. I've built a program which counts all the animal noises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I want to find out how robust the program is and find what the minimum signal to noise is for the program to still work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the plan was to modify my audio file to produce different (incrementally lower) signal to noise ratios.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would run the program for all of them and since I know how many the program should count, when I start getting lower counts, I will what the minimum signal to noise ratio is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however I have no idea how to go about doing this. I still don't even know how to find the signal to noise of my audio as it is. my guess was to assume the background noise is similar throughout and hence, copy a section of the audio which has no animal calls, just noise, then use matlabs snr command:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;r=snr(audio,backgroundnoise);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can anyone help with how to program this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not enough to just randomly add noise, I need to know the actual signal to noise values in order to be able to quantify the minimum SNR needed for the program to still work&lt;/p&gt;&#xA;" OwnerUserId="15627" LastActivityDate="2015-05-14T21:20:03.397" Title="Matlab: if given nothing but an audio file, how do I modify it to produce incrementally lower signal to noise ratios?" Tags="|matlab|discrete-signals|signal-analysis|noise|signal-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23346" PostTypeId="1" CreationDate="2015-05-12T13:22:12.130" Score="5" ViewCount="183" Body="&lt;p&gt;Compressive sensing methods are used in channel estimation when the channel is thread as sparse where there are zero points in the signal representation. &#xA;I am in the beginning of the sparse signal processing and trying to understand how to model the sparse channel in the equation below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y(k)=H(k)X(k)   === &gt; Y(k) received signal in frequency domain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1-What is the presentation of sparse channel h in this equation?&#xA;2-How to define the dictionary matrix for sparse channel?&#xA;3-For sparse estimation do we need to insert pilot symbols into the transmitted data x(n)?&#xA;4-Do you have a reference which explains the sparse channel properties in OFDM systems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate if someone please help on this topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="9014" LastActivityDate="2018-08-29T11:25:11.277" Title="Sparse Channel Estimation in OFDM System" Tags="|estimation|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23348" PostTypeId="1" CreationDate="2015-05-12T13:48:17.257" Score="2" ViewCount="2684" Body="&lt;p&gt;I have an audio file. I took an extract of the file called variable &quot;CALL&quot;, and I took another extract from the file which is just filled with background noise, called &quot;BACKGROUND&quot;.&#xA;Using matlab, I found the signal to noise ratio of CALL using:&#xA;snr(CALL,BACKGROUND); % both variables are of the same length&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the signal to noise outputted was     5.3949&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add noise to CALL, and lower this signal to noise to 3 for example. How would I go about programming this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've only seen examples where people add noise to a perfect signal (i.e. they just create some kind of sinewave, then add noise to that), I have a signal which already has noise, and I want to add more noise, and know its signal to noise value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is the above method for how I found my first signal to noise value correct? (I'm assuming the background noise is somewhat constant throughout the audio file)&lt;/p&gt;&#xA;" OwnerUserId="15627" LastActivityDate="2023-03-27T12:05:29.377" Title="adding noise to a signal" Tags="|matlab|discrete-signals|signal-analysis|noise|signal-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23350" PostTypeId="1" AcceptedAnswerId="43973" CreationDate="2015-05-12T14:47:52.547" Score="7" ViewCount="5096" Body="&lt;p&gt;Suppose that I know the output and the transfer functions of a system and I would like to calculate the input function using deconvolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a grasp of the idea I have created a simple demonstration using Gaussians. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a sanity check I first calculated the output function y using conv and then used deconv to replicate the original function. This works as expected. The input function calculated by deconvolution (green) is the same as the original input function (blue).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = -2:0.1:2; &#xA;% the input function&#xA;a = 1; b=0; c=.5;&#xA;u = a*exp(-((x-b).^2)/(2*c^2));&#xA;figure(1)&#xA;plot(x, u), hold on,&#xA;&#xA;% the transfer function&#xA;a = 0.1; b=0; c=.5;&#xA;h = a*exp(-(x-b).^2/(2*c^2));&#xA;&#xA;% calculate the output function using conv&#xA;y = conv(h, u);&#xA;y2plot = conv(h, u,'same');&#xA;figure(1)&#xA;plot(x, y2plot, 'r')&#xA;legend('input func', 'output func')&#xA;&#xA;u1 = deconv(y ,h);&#xA;figure&#xA;plot(x, u1,'g')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fig 1.Input and Output functions&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ObPsy.jpg&quot; alt=&quot;Input and Output functions&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fig 2.Transfer function&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/K9HDJ.jpg&quot; alt=&quot;Transfer function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fig 3.Input function calculated by deconv&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sR7nu.jpg&quot; alt=&quot;Input function calculated by deconv&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going back to the original problem, suppose that I know the output and transfer functions (the red and black curves in figures 1 and 2) and  I want to estimate the input function u. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = -2:0.1:2; &#xA;% the transfer function&#xA;a = 0.1; b=0; c=.5;&#xA;h = a*exp(-(x-b).^2/(2*c^2));&#xA;&#xA;% the output function&#xA;a = 0.9; b=0; c=.7;&#xA;y = a*exp(-(x-b).^2/(2*c^2));&#xA;figure;&#xA;plot(x, y, 'r')&#xA;&#xA;u = deconv([zeros(1,20) y zeros(1,20)], h);&#xA;figure&#xA;plot(x, u,'g')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fig 4.Input function calculated by deconv&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/A6K6k.jpg&quot; alt=&quot;Input function calculated by deconv&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result I am getting is not what I would expect. Although I would expect a Gaussian similar to the green curve in Fig. 3 I am getting something different. Is this a matter of padding? Any ideas would be really appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15795" LastEditorUserId="128" LastEditDate="2017-09-27T09:41:23.603" LastActivityDate="2022-03-16T16:03:36.917" Title="1D Deconvolution with Gaussian Kernel (MATLAB)" Tags="|matlab|discrete-signals|convolution|deconvolution|inverse-problem|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23351" PostTypeId="2" ParentId="18629" CreationDate="2015-05-12T14:58:13.473" Score="1" Body="&lt;p&gt;If I understand you correctly you want to smooth the data (Namely reduce &quot;Noise&quot;) yet regular filters would ruin the data on discontinuities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need is an Edge Preserving Filter.&lt;br&gt;&#xA;You can try the &lt;a href=&quot;http://en.wikipedia.org/wiki/Bilateral_filter&quot; rel=&quot;noreferrer&quot;&gt;Bilateral Filter&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Anisotropic_diffusion&quot; rel=&quot;noreferrer&quot;&gt;Anisotropic Filter&lt;/a&gt;.&lt;br&gt;&#xA;I have an advanced implementation of the Anisotropic Filter - &lt;a href=&quot;https://github.com/RoyiAvital/Fast-Anisotropic-Curvature-Preserving-Smoothing&quot; rel=&quot;noreferrer&quot;&gt;Fast Anisotropic Smoothing of Multi Valued Images Using Curvature Preserving PDE&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it works.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-05-12T14:58:13.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23352" PostTypeId="2" ParentId="23348" CreationDate="2015-05-12T15:24:09.757" Score="3" Body="&lt;p&gt;It looks like you have calculated $$\frac{S+N}{N}=3.47$$ (The output of &lt;code&gt;snr&lt;/code&gt; is in dB). This means that $\frac{S}{N}=2.47$. I have assumed that the power of the signal plus noise is equal to the power of the signal plus the power of the noise, which is not unreasonable since the two are probably uncorrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To have SNR=3, the noise power needs to be $N_1=2.47N/3=0.82N$. This can't be done because you can't reduce the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To have SNR=2 (3 dB), the noise power needs to be $N_1=2.47N/2=1.235N$. The power of your signal &lt;code&gt;BACKGROUND&lt;/code&gt; is $N$. Then, generate a new noise signal of power $0.235N$ and add it to &lt;code&gt;CALL&lt;/code&gt;. That should make your SNR=2.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-12T15:24:09.757" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23353" PostTypeId="1" CreationDate="2015-05-12T16:15:09.533" Score="0" ViewCount="108" Body="&lt;p&gt;Assume that the speed limit at a place is captured and is provided as an input to a system which checks if the speed of vehicle is above the accepted level or not. For checking, the number in the speed limit image has to be extracted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest a simple method to perform number segmentation and identification in the above case?&#xA;Also if K-means algorithm can be used?&lt;/p&gt;&#xA;" OwnerUserId="15799" LastActivityDate="2015-05-12T19:11:30.273" Title="Number segmentation techniques" Tags="|segmentation|text-recognition|optical-char-recognition|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23354" PostTypeId="2" ParentId="23334" CreationDate="2015-05-12T18:04:11.337" Score="1" Body="&lt;p&gt;The Fastl-Zwicker book is usually the introduction to this topic.  The more I learn about it the more fascinating it becomes.  If you pick it up used be sure to get one with the CD examples in it, as they are completely fascinating.&lt;/p&gt;&#xA;" OwnerUserId="13700" LastActivityDate="2015-05-12T18:04:11.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23355" PostTypeId="2" ParentId="18759" CreationDate="2015-05-12T18:07:15.130" Score="2" Body="&lt;p&gt;The Lyons book is gold for someone in your situation.  Have patience with the topic of audio DSP -- the more time you spend trying to learn it, the less you will know that you know.  :)&lt;/p&gt;&#xA;" OwnerUserId="13700" LastActivityDate="2015-05-12T18:07:15.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23356" PostTypeId="1" AcceptedAnswerId="23358" CreationDate="2015-05-12T18:09:33.270" Score="1" ViewCount="566" Body="&lt;p&gt;I'm working with a new DSLR camera for a Computer Vision application and I noticed most of them default to saving in the lossy JPEG format. Initially, this caused some problems in my application and I started working with the RAW format, and saved them as png. I wondered what was the reason behind defaulting to JPEG as the compression encoding. Wouldn't it be better to support png as a default format due to its lossless quality and compression factors? (I assume DSLR users like to have quality and compression both). I'm curious as to whether this has a scientific reason I have not thought of.&lt;/p&gt;&#xA;" OwnerUserId="15801" LastEditorUserId="15801" LastEditDate="2015-05-12T18:17:35.963" LastActivityDate="2015-05-12T18:52:31.380" Title="Why don't DSLR cameras default to png instead of jpeg?" Tags="|image-compression|" AnswerCount="1" CommentCount="3" ClosedDate="2015-05-13T09:32:34.727" ContentLicense="CC BY-SA 3.0" />
  <row Id="23357" PostTypeId="1" CreationDate="2015-05-12T18:29:29.453" Score="1" ViewCount="1178" Body="&lt;p&gt;I am trying to implement a crosstalk cancellation in Matlab, more precisely part of : Optimal Crosstalk Cancellation for Binaural Audio with Two Loudspeakers (&lt;a href=&quot;http://www.princeton.edu/3D3A/Publications/BACCHPaperV4d.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.princeton.edu/3D3A/Publications/BACCHPaperV4d.pdf&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the matrix H from equation (24) in the paper as my filter and use it as in equation (11). The output does not sound good and has lost all previous &quot;binaural features&quot;. Here is a plot of the original binaural signal and the X talk cancelled one :&#xA;www.hostingpics.net/viewer.php?id=196157img.png&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The binaural sound is a 1000Hz sound wav at the left ear (created with the CIPIC HRTF library). I would have expected the X talk signal to be kind of like the binaural one (where the right channel should be attenuated) but its not the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the actual code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Create binaural sound&#xA;aSound = wavread( '1000hz.wav' );&#xA;binauralSound = CreateBinauralSound( aSound, pathToHRTF, 1, 9 ); % -90 degree, 0 elevation&#xA;&#xA;%NFFT = 2^nextpow2( length( binauralSound ) );&#xA;NFFT = length( binauralSound );&#xA;&#xA;binauralSoundF = fft( binauralSound, NFFT );&#xA;&#xA;theta = 15; %Angle from nose to right speaker in degree&#xA;deltaR = 0.15; %Distance between the ears&#xA;deltaS = 2; %distance from  ear plane to speaker plane (going through nose);&#xA;&#xA;%Compute ear and speaker position&#xA;[speaker1x, speaker1y, speaker1z] = sph2cart( deg2rad(90 + theta), 0, deltaS );&#xA;[speaker2x, speaker2y, speaker2z] = sph2cart( deg2rad(90 - theta), 0, deltaS );&#xA;lEarx = -1 * deltaR / 2;&#xA;rEarx = deltaR / 2;&#xA;&#xA;%Compute distances&#xA;l1 =  sqrt( ( speaker1x - lEarx )^2 + ( speaker1y - 0 )^2 );&#xA;l2 = sqrt( ( speaker1x - rEarx )^2 + ( speaker1y - 0 )^2 );&#xA;deltaL = l2 - l1;&#xA;TC = deltaL / 340;&#xA;g = l1/l2;&#xA;&#xA;%Filters and parameters&#xA;beta = 0.5;&#xA;H = zeros( 2, 2, NFFT );&#xA;alpha = zeros( NFFT, 1 );&#xA;final = zeros( NFFT, 2 );&#xA;&#xA;%Compute value for each freq bins&#xA;for k = 1 : NFFT &#xA;    omega = exp( -2 * pi / k );&#xA;    %omega = k;&#xA;    H( 1, 1, k ) = ( g^2 * exp( i * 4 * omega * TC ) - ( beta + 1 ) * exp( i * 2 * omega * TC ) ) / ( g^2 * exp( i * 4 * omega * TC ) + g^2 - ( (g^2 + beta)^2 + 2 * beta + 1 ) );&#xA;    H( 2, 2, k ) = H( 1, 1, k );&#xA;&#xA;    H( 1, 2, k ) = ( g * exp( i * omega * TC ) - g * ( g^2 + beta ) * exp( i * 3 * omega * TC ) ) / ( g^2 * exp( i * 4 * omega * TC ) + g^2 - ( (g^2 + beta)^2 + 2 * beta + 1 ) );&#xA;    H( 2, 1, k ) = H( 1, 2, k );&#xA;&#xA;    alpha( k ) = exp( -1i * omega * l1 / 340 )/ l1;&#xA;&#xA;    final( k, : ) = alpha( k ) * binauralSoundF( k, : ) * H( :, :, k );  &#xA;end&#xA;&#xA;resultSound = ifft( final, NFFT, 'symmetric');&#xA;resultSound( :, 1 ) = resultSound( :, 1 ) / max( abs( resultSound( :, 1 ) ) );&#xA;resultSound( :, 2 ) = resultSound( :, 2 ) / max( abs( resultSound( :, 2 ) ) );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am really not sure I am computing H the right way nor I am sure I am applying it correctly. There is not a lot of implementation of crosstalk cancellation on the web so I find it quite hard to find my mistake. I am guessing its something really obvious for all the dsp gurus out there. Your help would be greatly appreciated !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="15802" LastActivityDate="2018-03-14T14:07:06.567" Title="Implementing Optimal Crosstalk Cancellation with matlab" Tags="|matlab|" AnswerCount="0" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="23358" PostTypeId="2" ParentId="23356" CreationDate="2015-05-12T18:52:31.380" Score="1" Body="&lt;p&gt;Its force of habit and good enough. People were using JPEG's in their digital cameras before, so they stuck with it, and its &lt;a href=&quot;https://photo.stackexchange.com/questions/61483/why-do-modern-dslrs-support-jpeg-but-not-lossless-formats-other-than-raw&quot;&gt;plenty fine for viewing&lt;/a&gt; (and it produces pretty small file sizes as well). You're free to turn to some other compression method your camera supports.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the RAW files often contain a lot more information than what a PNG would have anyway (like a bunch of stuff about the sensor), which can be exploited in programs like photoshop for editing, so from that perspective, you may as well have the RAW rather than the PNG (especially since the RAW is rather space efficient to begin with). You can also put in things specific to your camera there if you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that many cameras have the option to shoot RAW+JPEG so you simultaneously get both, which is good for viewing (use the JPEG) and editing (use the RAW).&lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="-1" LastEditDate="2017-04-13T12:43:53.770" LastActivityDate="2015-05-12T18:52:31.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23359" PostTypeId="2" ParentId="23334" CreationDate="2015-05-12T19:10:01.840" Score="0" Body="&lt;p&gt;Psychoacoustics is an incredibly broad topic. Are you interested in localization, pitch models, loudness? Hearing disorders? There are a number of good references I consulted during my PhD focused on psychoacoustics, namely median plane localization and head tracking. My advisor was Jens Blauert's advisee so I am a bit biased when I recommend his works (although by any standard they are authoritative).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Spatial Hearing - Jens Blauert&lt;/strong&gt;&#xA;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0262024136&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Spatial-Hearing-Revised-Psychophysics-Localization/dp/0262024136/ref=sr_1_1?ie=UTF8&amp;amp;qid=1431457038&amp;amp;sr=8-1&amp;amp;keywords=spatial+hearing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Brian Moore - The Psychology of Hearing&lt;/strong&gt;&#xA;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/9004252428&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/An-Introduction-Psychology-Hearing-Edition/dp/9004252428/ref=pd_bxgy_14_text_y&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Zwicker and Fastl -- Psychoacoustics: Facts and Models&lt;/strong&gt;&#xA;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/3540231595&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Psychoacoustics-Models-Springer-Information-Sciences/dp/3540231595/ref=sr_1_2?s=books&amp;amp;ie=UTF8&amp;amp;qid=1431457567&amp;amp;sr=1-2&amp;amp;keywords=psychoacoustics&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-12T19:10:01.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23360" PostTypeId="2" ParentId="23353" CreationDate="2015-05-12T19:11:30.273" Score="2" Body="&lt;p&gt;As with all ocr, you need to segment each individual character. Assuming this step is already done (and maybe some post processing to One easy way is to take the number and reduce the resolution. Similar to a lcd character display. &lt;img src=&quot;https://i.stack.imgur.com/HBNBJ.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then do a simple correlation between the reduced resolution number from the image, and a template. Since the numbers on street signs are printed and very consistent a simple template match could work well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;your template should contain the numbers 0-9 in a font that closely matches those used on your road signs. &lt;/p&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2015-05-12T19:11:30.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23362" PostTypeId="1" CreationDate="2015-05-12T19:54:45.570" Score="1" ViewCount="86" Body="&lt;p&gt;I'm trying to find a list of Fourier Coefficients (frequencies/amplitudes, ie, spectral data) to simulate different musical instruments using additive synthesis. Are these data published somewhere? This is for a Math class: I just would like to add more frequencies and listen how the sound generated compares with the real sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15804" LastActivityDate="2015-05-12T20:19:42.050" Title="List of Fourier coefficientes to simulate musical instruments" Tags="|fourier|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23363" PostTypeId="2" ParentId="23362" CreationDate="2015-05-12T20:19:42.050" Score="3" Body="&lt;p&gt;look up &lt;a href=&quot;https://en.wikipedia.org/wiki/Additive_synthesis&quot; rel=&quot;nofollow&quot;&gt;Additive Synthesis&lt;/a&gt; somewhere.  those Fourier coefficients are &lt;strong&gt;not&lt;/strong&gt; constants.  the musical note is not normally a perfectly periodic function in time.  it is what i like to call &lt;em&gt;&quot;quasi-periodic&quot;&lt;/em&gt;.  so this is not exactly true (given some period $P$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = x(t+P) \quad \text{for all } t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but in the neighborhood of some given time $t_0$ this is approximately true&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) \approx x(t+P(t_0)) \quad \text{for } t \approx t_0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the exact Fourier series for $x(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \sum\limits_{n=-\infty}^{+\infty} c_n \ e^{j 2 \pi n f_0 t} \quad f_0 \triangleq \frac{1}{P} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is not precisely true, but more like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \sum\limits_{n=-\infty}^{+\infty} c_n(t) \ e^{j \theta_n(t)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \theta_n(t) = \int\limits_{0}^{t} 2 \pi f_n(u) du + \theta_n(0) \quad f_n(t) \triangleq \frac{n}{P(t)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so what you're looking for is a collection of envelopes, rather than a collection of constant coefficients, for some musical instrument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in a previous life, living on an older computer (that might not power up now) and maybe even on some 3.5 inch floppy disks, i have some of that additive synth data.  actually, i am not sure where to get it all digested.  within the context of &lt;a href=&quot;https://en.wikipedia.org/wiki/Wavetable_synthesis&quot; rel=&quot;nofollow&quot;&gt;Wavetable Synthesis&lt;/a&gt;, i know how i would go about extracting it from &quot;samples&quot; of notes (like what you would get from a sample library like from &lt;a href=&quot;http://www.synthogy.com/&quot; rel=&quot;nofollow&quot;&gt;Synthogy&lt;/a&gt; ).&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-05-12T20:19:42.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23364" PostTypeId="1" CreationDate="2015-05-12T20:55:42.367" Score="0" ViewCount="263" Body="&lt;p&gt;I am stuck with the following design requirements for FIR filter:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Low-pass&lt;/li&gt;&#xA;&lt;li&gt;-6dB @ 1.6kHz&lt;/li&gt;&#xA;&lt;li&gt;Slope: 24 dB/octave.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Ideally I would like to get also FIR coefficients, but any help how to design this filter using MATLAB, ScopeFIR, ScopeIIR, or any other software/method that you may find useful will be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15718" LastActivityDate="2015-05-12T20:55:42.367" Title="FIR Filter Design - from slope and cutoff frequency" Tags="|filters|dsp-core|digital-filters|" AnswerCount="0" CommentCount="4" ClosedDate="2015-05-13T13:52:36.643" ContentLicense="CC BY-SA 3.0" />
  <row Id="23365" PostTypeId="2" ParentId="23320" CreationDate="2015-05-13T01:16:11.747" Score="0" Body="&lt;p&gt;To do any algorithmic FIR filter design you must specify or assume (or just take some default for) a minimum stop-band attenuation.  Once you provide a realistic stopband attenuation, control the transition slope from your generator algorithm by adjusting the FIR filter length and the delta between the pass band and stop band frequencies until you reach the desired result.  Perhaps iteratively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There exist some rule-of-thumb approximations for the minimum FIR filter length that will allow a given transition slope. Perhaps that's what you are looking for?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-05-13T01:21:28.770" LastActivityDate="2015-05-13T01:21:28.770" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23368" PostTypeId="2" ParentId="23336" CreationDate="2015-05-13T13:47:10.507" Score="1" Body="&lt;p&gt;I think in your pursuit will be sorely disappointed by a DSP reference book. You'll want to explore the world of microcontrollers, bluetooth radios, and off the shelf image compression. Since you are likely not ordering 10,000 units, you'll want to check out Arduino and particular the various shields offered by Adafruit (or any one of the various Arduino or Raspberry Pi microcontroller distributors).&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-13T13:47:10.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23369" PostTypeId="1" CreationDate="2015-05-13T15:24:20.120" Score="0" ViewCount="3487" Body="&lt;p&gt;I designed an FIR highpass filter which is causing a phase shift to the output. The output signal is also not stable (?) on start. &#xA;Are these normal or am I doing something wrong?&#xA;If these are normal, what causes these?&#xA;(Attached is a diagram showing the input in blue and the output in red).&lt;img src=&quot;https://i.stack.imgur.com/wZaw4.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="15744" LastActivityDate="2015-06-12T17:41:38.370" Title="FIR Filter phase shift and stability" Tags="|matlab|filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23370" PostTypeId="2" ParentId="23369" CreationDate="2015-05-13T15:38:51.497" Score="0" Body="&lt;p&gt;A digital filter always has a delayed output. Think of the FIR filter as a shift register. At each time instant, all samples are shifted; one new sample enters the filter and the last sample is discarded. This introduces a delay as the the samples propagate through the filter. The important property of a (linear phase) FIR filter is that all frequencies are delayed by the same amount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're seeing at the beginning of the output is normal and is also related to the structure of the FIR filter. At the start, the shift register is loaded with zeros. This produces a &quot;transient&quot; response. As more and more samples enter the filter, the output becomes more meaningful. Usually, you should wait until the filter is at least half full before evaluating its output.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-13T15:38:51.497" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23371" PostTypeId="2" ParentId="23369" CreationDate="2015-05-13T15:39:40.203" Score="1" Body="&lt;p&gt;This is perfectly normal. At the beginning you see the transient effect because the signal suddenly starts and the filter was at rest before (zero initial condition). A causal filter will always add some phase shift to your signal. This phase shift is usually frequency dependent, but for a &lt;em&gt;linear phase&lt;/em&gt; FIR filter the resulting delay is independent of frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $H(e^{j\omega})$ is the frequency response of the filter and $\phi(\omega)=\arg\{H(e^{j\omega})\}$ is its phase response, then the phase shift experienced by a sinusoid with frequency $\omega_0$ is simply $\phi(\omega_0)$, i.e. the corresponding time delay equals $-\phi(\omega_0)/\omega_0$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-13T17:32:17.660" LastActivityDate="2015-05-13T17:32:17.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23372" PostTypeId="1" AcceptedAnswerId="23373" CreationDate="2015-05-13T16:21:36.670" Score="0" ViewCount="34" Body="&lt;p&gt;A medium access control MAC mechanism in wireless local area network and Ethernet is called Carrier Sense Multiple Access. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two different types of this CSMA&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- CSMA/Collision Detection&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- CSMA/ Collision Avoidance &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what the advantages and disadvantges of each are?&lt;/p&gt;&#xA;" OwnerUserId="15315" LastActivityDate="2015-05-13T16:46:21.857" Title="Carrier sense multiple access, MAC layer" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23373" PostTypeId="2" ParentId="23372" CreationDate="2015-05-13T16:46:21.857" Score="0" Body="&lt;p&gt;In collistion detection, a node may start transmitting at any time, and backs off if it detects that it caused a collision. This forces the node that was already transmitting to back off, too. Its advantage is simplicity; its disadvantage is that it introduces big inefficiences: a packet makes it through the network only if no other node decides to transmit at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In collision avoidance, a node first looks at the medium. If it detects a signal, then it backs off and waits before attempting to transmit again. This increases the transmitter's complexity a bit, but the network efficiency is increased. A collision only happens when two nodes decide to transmit at (almost) the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the details and how to calculate the specifics in any textbook on networking.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-13T16:46:21.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23374" PostTypeId="1" AcceptedAnswerId="23376" CreationDate="2015-05-13T17:38:37.790" Score="3" ViewCount="957" Body="&lt;p&gt;I would like to obtain FIR filter (low-pass) coefficients from a given frequency response by using C++ to develop algorithms. I have read at &lt;a href=&quot;http://iowahills.com/B2PolynomialFIRFilters.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://iowahills.com/B2PolynomialFIRFilters.html&lt;/a&gt;, that, if done properly, almost any filter response can be implemented as an FIR. In principle, one simply does an Inverse Fourier Transform on the filter's frequency response. Is there a C or C++ code that will do this? Any links or detailed guidelines how to solve this would be appreciated! I want to thank member &lt;a href=&quot;https://dsp.stackexchange.com/users/154/hotpaw2&quot;&gt;hotpow2&lt;/a&gt; for suggesting gradient descent routine, but I need more details on that as well.&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-05-13T18:42:40.840" Title="FIR Filter Design - obtaining FIR coefficients from frequency response" Tags="|fft|filters|audio|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23376" PostTypeId="2" ParentId="23374" CreationDate="2015-05-13T18:42:40.840" Score="2" Body="&lt;p&gt;here's some very old source in C to do an FFT.  it's nowhere near as good as FFTW, but it's free and self-contained.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you're doing this inverse DFT and windowing (i would recommend the Kaiser window) to design an FIR, probably it doesn't need to be an FFT.  you can write a very simple DFT (no Cooley-Tukey radix-2 optimizations) and run it.  i don't think you'll care too much if it takes a couple of seconds longer to run.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/*  &#xA;A set of utility programs to compute the Fast Fourier Transform (FFT):&#xA;&#xA;                       N-1&#xA;                X[k] = SUM { x[n]exp(-j2(pi)nk/N) }&#xA;                       n=0&#xA;&#xA;and inverse Fast Fourier Transform (iFFT):&#xA;&#xA;                           N-1&#xA;                x[n] = 1/N SUM { X[k]exp(+j2(pi)nk/N) }&#xA;                           k=0&#xA;&#xA;To speed things up, multiplication by 1 and j are avoided.  The input, x[],&#xA;is an array of complex numbers (pairs of doubles) of length N = 2^p.  The&#xA;calling program supplies p = log2(N) not the array length, N.  The output&#xA;is placed in BIT REVERSED order in x[].  Call bitreverse(x, p) to swap back&#xA;to normal order, if needed.  However, iFFT(X, p, trigtbl) requires its input,&#xA;X[], to be in bit reversed order making bit reversing unnecessary in some&#xA;cases, such as fast convolution.  trigtbl is an array of doubles of length&#xA;N/4 containing the sin function from 0 to pi/2 used to compute the FFT.&#xA;Call sintable(trigtbl, p) ONLY ONCE before either FFT(x, p, trigtbl) or&#xA;iFFT(X, p, trigtbl) to set up a sin table for FFT computation.&#xA;&#xA;Written in Megamax C (for the Mac) by Robert Bristow-Johnson (1985).&#xA;*/&#xA;&#xA;/*&#xA;#include &amp;lt;complex.h&amp;gt;&#xA;*/&#xA;&#xA;typedef struct {&#xA;double real;&#xA;double imag;&#xA;} complex;&#xA;&#xA;#define Re(z) (z).real&#xA;#define Im(z) (z).imag&#xA;&#xA;#define PI (3.14159265359)&#xA;&#xA;double sin();&#xA;&#xA;FFT (x, p, trigtbl)&#xA;complex x[];&#xA;int p;&#xA;register double *trigtbl;&#xA;{&#xA;register long length, step, stepsize, size;&#xA;register complex *top, *bottom, *end;               /* top &amp;amp; bottom of FFT butterfly */&#xA;complex temp;&#xA;&#xA;size = 1L&amp;lt;&amp;lt;p;&#xA;end = x + size;&#xA;&#xA;length = size&amp;gt;&amp;gt;1;   &#xA;size &amp;gt;&amp;gt;= 2;&#xA;stepsize = 1L;&#xA;while ( length &amp;gt; 1L) {&#xA;    top = x;&#xA;    while (top &amp;lt; end) {&#xA;        bottom = top + length;&#xA;&#xA;        Re(temp) = Re(*top) - Re(*bottom);          /* butterfly: twiddle = 1 */&#xA;        Im(temp) = Im(*top) - Im(*bottom);&#xA;        Re(*top) += Re(*bottom);&#xA;        Im(*top) += Im(*bottom);&#xA;        *bottom = temp;&#xA;        top++;&#xA;        bottom++;&#xA;&#xA;        for (step = stepsize; step &amp;lt; size; step += stepsize) {&#xA;            Re(temp) = Re(*top) - Re(*bottom);      /* butterfly: twiddle = exp(-jÌ) */&#xA;            Im(temp) = Im(*top) - Im(*bottom);&#xA;            Re(*top) += Re(*bottom);&#xA;            Im(*top) += Im(*bottom);&#xA;            Re(*bottom) = Re(temp)*trigtbl[size - step] + Im(temp)*trigtbl[step];&#xA;            Im(*bottom) = Im(temp)*trigtbl[size - step] - Re(temp)*trigtbl[step];&#xA;            top++;&#xA;            bottom++;&#xA;        }&#xA;&#xA;        Re(temp) = Im(*top) - Im(*bottom);          /* butterfly: twiddle = -j */&#xA;        Im(temp) = Re(*bottom) - Re(*top);&#xA;        Re(*top) += Re(*bottom);&#xA;        Im(*top) += Im(*bottom);&#xA;        *bottom = temp;&#xA;        top++;&#xA;        bottom++;&#xA;&#xA;        for (step = stepsize; step &amp;lt; size; step += stepsize) {&#xA;            Re(temp) = Im(*top) - Im(*bottom);      /* butterfly: twiddle = -j*exp(-jÌ) */&#xA;            Im(temp) = Re(*bottom) - Re(*top);&#xA;            Re(*top) += Re(*bottom);&#xA;            Im(*top) += Im(*bottom);&#xA;            Re(*bottom) = Re(temp)*trigtbl[size - step] + Im(temp)*trigtbl[step];&#xA;            Im(*bottom) = Im(temp)*trigtbl[size - step] - Re(temp)*trigtbl[step];&#xA;            top++;&#xA;            bottom++;&#xA;        }&#xA;        top = bottom;&#xA;    }&#xA;    stepsize &amp;lt;&amp;lt;= 1;&#xA;    length &amp;gt;&amp;gt;= 1;&#xA;}&#xA;&#xA;top = x;&#xA;bottom = x + 1;&#xA;while (top &amp;lt;  end) {&#xA;    Re(temp) = Re(*top) - Re(*bottom);              /* butterfly: twiddle = 1 */&#xA;    Im(temp) = Im(*top) - Im(*bottom);&#xA;    Re(*top) += Re(*bottom);&#xA;    Im(*top) += Im(*bottom);&#xA;    *bottom = temp;&#xA;    top += 2;&#xA;    bottom += 2;&#xA;}&#xA;}&#xA;&#xA;&#xA;iFFT (X, p, trigtbl)&#xA;complex X[];&#xA;int p;&#xA;register double *trigtbl;&#xA;{&#xA;register long length, step, stepsize, size;&#xA;double scale;&#xA;register complex *top, *bottom, *end;               /* top &amp;amp; bottom of FFT butterfly */&#xA;complex temp;&#xA;&#xA;size = 1L&amp;lt;&amp;lt;p;&#xA;end = X + size;&#xA;&#xA;scale = 1.0/(double)size;&#xA;top = X;&#xA;bottom = X + 1;&#xA;while (top &amp;lt;  end) {&#xA;    Re(temp) = (Re(*top) - Re(*bottom))*scale;      /* butterfly: twiddle = 1/N */&#xA;    Im(temp) = (Im(*top) - Im(*bottom))*scale;&#xA;    Re(*top) = (Re(*top) + Re(*bottom))*scale;&#xA;    Im(*top) = (Im(*top) + Im(*bottom))*scale;&#xA;    *bottom = temp;&#xA;    top += 2;&#xA;    bottom += 2;&#xA;}&#xA;&#xA;length = 1L;&#xA;size &amp;gt;&amp;gt;= 2;&#xA;stepsize = size;&#xA;while ( stepsize &amp;gt;= 1L) {&#xA;    length &amp;lt;&amp;lt;= 1;&#xA;    top = X;&#xA;    while (top &amp;lt; end) {&#xA;        bottom = top + length;&#xA;&#xA;        temp = *bottom;                             /* butterfly: twiddle = 1 */&#xA;        Re(*bottom) = Re(*top) - Re(temp);&#xA;        Im(*bottom) = Im(*top) - Im(temp);&#xA;        Re(*top) += Re(temp);&#xA;        Im(*top) += Im(temp);&#xA;        top++;&#xA;        bottom++;&#xA;&#xA;        for (step = stepsize; step &amp;lt; size; step += stepsize) {&#xA;                                                    /* butterfly: twiddle = exp(+jÌ) */&#xA;            Re(temp) = Re(*bottom)*trigtbl[size - step] - Im(*bottom)*trigtbl[step];&#xA;            Im(temp) = Im(*bottom)*trigtbl[size - step] + Re(*bottom)*trigtbl[step];&#xA;            Re(*bottom) = Re(*top) - Re(temp);&#xA;            Im(*bottom) = Im(*top) - Im(temp);&#xA;            Re(*top) += Re(temp);&#xA;            Im(*top) += Im(temp);&#xA;            top++;&#xA;            bottom++;&#xA;        }&#xA;&#xA;        Re(temp) = -Im(*bottom);                    /* butterfly: twiddle = +j */&#xA;        Im(temp) = Re(*bottom);&#xA;        Re(*bottom) = Re(*top) - Re(temp);&#xA;        Im(*bottom) = Im(*top) - Im(temp);&#xA;        Re(*top) += Re(temp);&#xA;        Im(*top) += Im(temp);&#xA;        top++;&#xA;        bottom++;&#xA;&#xA;        for (step = stepsize; step &amp;lt; size; step += stepsize) {&#xA;                                                    /* butterfly: twiddle = +j*exp(+jÌ) */&#xA;            Re(temp) = -Im(*bottom)*trigtbl[size - step] - Re(*bottom)*trigtbl[step];&#xA;            Im(temp) = Re(*bottom)*trigtbl[size - step] - Im(*bottom)*trigtbl[step];&#xA;            Re(*bottom) = Re(*top) - Re(temp);&#xA;            Im(*bottom) = Im(*top) - Im(temp);&#xA;            Re(*top) += Re(temp);&#xA;            Im(*top) += Im(temp);&#xA;            top++;&#xA;            bottom++;&#xA;        }&#xA;        top = bottom;&#xA;    }&#xA;    stepsize &amp;gt;&amp;gt;= 1;&#xA;}&#xA;}&#xA;&#xA;&#xA;sintable(trigtbl, p)&#xA;register double *trigtbl;&#xA;int p;&#xA;{&#xA;register long size, i;&#xA;double theta;&#xA;&#xA;size = 1L&amp;lt;&amp;lt;(p-2);&#xA;theta = (PI/2.0)/(double)size;&#xA;&#xA;for (i = 0; i &amp;lt; size; i++) &#xA;    trigtbl[i] = sin(theta*(double)i);&#xA;}&#xA;&#xA;&#xA;bitreverse (x, p)&#xA;register complex *x;&#xA;int p;&#xA;{&#xA;complex temp;&#xA;register long k, i, r, size, count;&#xA;&#xA;size = (1L&amp;lt;&amp;lt;p) - 1L;&#xA;for (k = 1L; k &amp;lt; size; k++) {&#xA;    i = k;&#xA;    r = 0;&#xA;    for (count = size; count &amp;gt; 0; count &amp;gt;&amp;gt;= 1) {&#xA;        r &amp;lt;&amp;lt;= 1;&#xA;        r += (i &amp;amp; 0x00000001L);&#xA;        i &amp;gt;&amp;gt;= 1;&#xA;    }&#xA;    if (r &amp;gt; k) {&#xA;        temp = x[r];&#xA;        x[r] = x[k];&#xA;        x[k] = temp;&#xA;    }&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-05-13T18:42:40.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23377" PostTypeId="1" CreationDate="2015-05-13T18:54:02.967" Score="0" ViewCount="221" Body="&lt;p&gt;I'm not familiar with the topic of sound. I have ultrasonic audio recordings sampled at 250kHz (16bit) in WAV format. The equipment used to record them is linked here:&#xA;&lt;a href=&quot;http://www.avisoft.com/usg/usg116Hn.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.avisoft.com/usg/usg116Hn.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've use the matlab programming language to plot the audio signal. While the X axis is just going to be the sample number (divide this by the sampling rate to get time), I don't quite know what the units for the amplitude are. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typical values (which can be positive or negative) have very high precision and are of the order of 10^-4 or 10^-5. An example amplitude value is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-3.051757812500000e-05 (at least according to Matlab)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have any idea of what units I am dealing with? I did not use the equipment myself, my supervisor did. When I asked him what units the amplitude were, he advised I look at the link, but I am not too certain I understand.&lt;/p&gt;&#xA;" OwnerUserId="15628" LastActivityDate="2015-05-13T23:59:25.057" Title="What are the units of amplitude of my ultrasonic recording equipment" Tags="|matlab|discrete-signals|audio|digital|ultrasound|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23378" PostTypeId="2" ParentId="23345" CreationDate="2015-05-13T20:44:34.717" Score="0" Body="&lt;p&gt;I like your noise model, I think that is really the best way to find SNR if you only have access to recordings. Using this same model couldn't you take your &lt;code&gt;backgroundnoise&lt;/code&gt; scale it (duplicate it or trim it as necessary) and then add it to the signal? In this sense the noise wouldn't be entirely random but somewhat system specific&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in order to calculate your new noise value you would simply rearrange the SNR calculation solving for noise. Then scale the original noise accordingly. you can use some code like this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;desired_snr_db = 10;    %change this value&#xA;&#xA;est_signal = audio - backgroundnoise;&#xA;&#xA;%the original matlab equation for SNR is: &#xA;%signalPow = rssq(x(:)).^2; &#xA;%noisePow = rssq(y(:)).^2; &#xA;%r = 10 * log10(signalPow / noisePow);&#xA;%solving for noisePow we get&#xA;noisePow = rssq(est_signal(:)).^2 / (10^(desired_snr_db / 10));&#xA;&#xA;%assuming rssq(new_noise).^2 = (scale_factor * rssq(old)).^2&#xA;scale_factor = sqrt(noisePow / rssq(backgroundnoise).^2);&#xA;&#xA;new_noise = scale_factor * backgroundnoise;&#xA;&#xA;%add noise to our estimated signal&#xA;new_signal = est_signal + new_noise; %you may need to do stretching &#xA;                                     %trimming to get the right sizes&#xA;&#xA;&#xA;new_snr = snr(new_signal - new_noise, new_noise)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;if you want you can double check the snr by finding a lull in the new signal and comparing it to the known sounds just as before&lt;/p&gt;&#xA;" OwnerUserId="13714" LastEditorUserId="13714" LastEditDate="2015-05-14T21:20:03.397" LastActivityDate="2015-05-14T21:20:03.397" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23379" PostTypeId="2" ParentId="8911" CreationDate="2015-05-13T21:28:02.723" Score="10" Body="&lt;p&gt;Windowing reduces spectral leakage.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you start out with a $\sin(y) = \cos(\omega_0 t)$.   The period is obviously $2 \pi/ \omega_0$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if nobody told you that the period is $2 \pi/ \omega$ and you blindly choose the range $[0, 1.8 \pi/\omega_0]$ and take FFT of this truncated waveform, you will observe frequency components in other frequencies which are all fake because the jumps created by copy-pasting the truncated waveform for periodicity are not really present in the original signal - it is an artifact of an unlucky truncation that does not capture the transition between periods smoothly.  Ideally there is only one spectral component at $\omega = \omega_0$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of windowing in time domain is to reduce all these fictitious spectral components.&lt;/p&gt;&#xA;" OwnerUserId="15814" LastEditorUserId="17640" LastEditDate="2015-10-26T11:35:56.110" LastActivityDate="2015-10-26T11:35:56.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23380" PostTypeId="2" ParentId="23348" CreationDate="2015-05-13T22:40:55.923" Score="3" Body="&lt;p&gt;maybe the info at the following web page will be of some use to you.  &lt;a href=&quot;http://www.dsprelated.com/showcode/263.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rick Lyons - Adding a Controlled Amount of Noise to a Noise-Free Signal&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="7092" LastEditDate="2023-03-27T12:05:29.377" LastActivityDate="2023-03-27T12:05:29.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23381" PostTypeId="2" ParentId="23377" CreationDate="2015-05-13T23:59:25.057" Score="1" Body="&lt;p&gt;Given that the gain of the system and/or ADC seems to be unknown, the scale of the sample values can only be determined from samples of a calibrated source of known value at a known distance from the transducer.  With a variable enough gain knob (or AGC) the scale of the samples could be anything.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-05-13T23:59:25.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23383" PostTypeId="1" AcceptedAnswerId="23384" CreationDate="2015-05-14T01:39:32.467" Score="2" ViewCount="371" Body="&lt;p&gt;I have been reading a paper that mentions Doppler model that may be included in the fading characteristics of impulse response. One example of bell shaped Doppler Spectrum is the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(f) = \frac{1}{1+A\frac{f}{f_d}}\,\,\,\,\,\,\,\, |f|\leq f_{\max}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_d$ is the Doppler Spread, $A$ is a constant, $f_{max}$ is maximum frequency component of the Doppler power spectrum. Does anyone know how the following function affects the channel model?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15315" LastActivityDate="2020-04-07T07:43:53.333" Title="Doppler Model, how does it affect the fading impulse response?" Tags="|digital-communications|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23384" PostTypeId="2" ParentId="23383" CreationDate="2015-05-14T01:55:09.090" Score="3" Body="&lt;p&gt;This is not a full answer, but I'll try to provide some intuition. First, imagine a static channel -- neither the antennas nor the reflectors around them move. In such a channel, the impulse response is always the same -- it's time invariant. The channel characteristics are fixed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, introduce movement of the antennas and/or the reflectors. The channel impulse response now varies with time. The channel coherence time indicates how fast the channel impulse response changes, and for how long can we consider the channel to remain relatively static.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is movement of the antennas and/or the reflectors, we also get a Doppler shift in the transmitted signal. The more movement there is, the higher the shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The channel coherence time and the Doppler shift are, then, two manifestations of the same phenomenon -- movement. If one increases, the other decreases. The easiest way to introduce this into the channel model is to assume that the channel is fixed for a certain amount of time, after which it changes to a completely different, independent channel.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-14T01:55:09.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23385" PostTypeId="1" CreationDate="2015-05-14T01:58:42.163" Score="4" ViewCount="840" Body="&lt;p&gt;I'm wondering what the actual application of this tidbit of knowledge is. I am currently a student in a Computer Engineering undergraduate program and I was wondering what the applicability of this is. Has there ever been a situation where a signal did come in bounded and leave unbounded, causing massive destruction?&lt;/p&gt;&#xA;" OwnerUserId="15818" LastEditorUserId="13320" LastEditDate="2017-04-17T17:45:47.327" LastActivityDate="2017-04-17T17:45:47.327" Title="Why do we care if a system is BIBO stable?" Tags="|stability|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23388" PostTypeId="2" ParentId="23385" CreationDate="2015-05-14T15:21:41.700" Score="2" Body="&lt;p&gt;In audio processing at least this is always important. If your output goes out of bounds from an unstable IIR or mechano-acoustically the output feeds back to input, you're hosed. Feedback will squeal in the ear, or the filter will stop doing its job.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-14T15:21:41.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23389" PostTypeId="1" CreationDate="2015-05-14T17:03:47.443" Score="-1" ViewCount="2099" Body="&lt;p&gt;I am using the following code to generate four sine waves using  a sampling rate of 8000. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   Fs = 8000;                       % samples per second&#xA;   Ts = 1/Fs;                       % seconds per sample&#xA;   t = 0: Ts: 3;                    % Start signals at 0sec and stop after 3sec&#xA;&#xA;   % Sine wave x1[n]:&#xA;   Fc = 320;                       &#xA;   x1 = sin(2*pi*Fc*t);&#xA;&#xA;   % Sine wave x2[n]:&#xA;   Fc = 760;                     &#xA;   x2 = sin(2*pi*Fc*t);&#xA;&#xA;   % Sine wave x3[n]:&#xA;   Fc = 1280;                       &#xA;   x3 = sin(2*pi*Fc*t);&#xA;&#xA;   % Sine wave x4[n]:&#xA;   Fc = 2000;                     &#xA;   x4 = sin(2*pi*Fc*t);&#xA;&#xA;   x_comp = x1 + x2 + x3 + x4;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I need to plot the frequency magnitude spectrum of the composite signal (x_comp) in dB. How can I achieve this please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the code below but the plot is not making sense. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   x_comp = x1 + x2 + x3 + x4;&#xA;&#xA;   x_comp_mag = abs(fft(x_comp)); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15744" LastEditorUserId="15744" LastEditDate="2015-05-15T15:55:02.233" LastActivityDate="2015-07-18T03:23:39.740" Title="MATLAB frequency magnitude spectrum" Tags="|matlab|magnitude|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23397" PostTypeId="1" CreationDate="2015-05-14T22:37:37.933" Score="3" ViewCount="2652" Body="&lt;p&gt;A length-$127$ frame scramble uses the following generator polynomial&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(D)= D^7+D^4+1$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If the all-ones initial state is used, how can one obtain the $127$ bit sequence? I am not interested in the sequence itself or computer algorithm but an understanding of how to obtain in.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My understanding is that $G(D)$ is the $\mathcal Z$-transform of the impulse response $\textrm{1001001}$. Is this convolved with the initial state $\textrm{1111111}$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="1629" LastEditDate="2016-05-19T08:09:41.673" LastActivityDate="2017-11-10T19:09:09.747" Title="Scrambler generator polynomial with initial state" Tags="|digital-communications|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23398" PostTypeId="2" ParentId="23397" CreationDate="2015-05-14T22:54:23.970" Score="0" Body="&lt;pre&gt;&lt;code&gt;boolean mls[127];&#xA;unsigned D = 0x7F;&#xA;for (i=0; i&amp;lt;127; i++)&#xA;    {&#xA;    mls[i] = D&amp;amp;1;&#xA;    D = D&amp;gt;&amp;gt;1;&#xA;    if (mls[i])&#xA;        {&#xA;        D = D^0x48;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-05-14T22:54:23.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23399" PostTypeId="2" ParentId="23397" CreationDate="2015-05-14T23:02:27.917" Score="0" Body="&lt;p&gt;or it might be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;boolean mls[127];&#xA;unsigned D = 0x7F;&#xA;for (i=0; i&amp;lt;127; i++)&#xA;    {&#xA;    mls[i] = (D &amp;amp; 0x40)&amp;gt;&amp;gt;6;&#xA;    D = D&amp;lt;&amp;lt;1;&#xA;    if (mls[i])&#xA;        {&#xA;        D = D^0x11;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;all depends on if we're shifting left or right.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-05-14T23:02:27.917" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23400" PostTypeId="1" AcceptedAnswerId="23403" CreationDate="2015-05-14T23:11:18.830" Score="1" ViewCount="622" Body="&lt;p&gt;Assume we have a sequence of symbols &#xA;$$S= \{0, 0, 1+j, -1-j, 0 ,0 , 1+j,-1+j\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and that this sequence is a frequency domain sequence and will be input to an IFFT operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the output a &lt;em&gt;continous time&lt;/em&gt; or &lt;em&gt;discrete time&lt;/em&gt; signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-05-14T23:19:21.570" LastActivityDate="2015-05-16T16:36:29.587" Title="What is the output of IFFT operations, continuous or discrete time?" Tags="|digital-communications|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23403" PostTypeId="2" ParentId="23400" CreationDate="2015-05-15T00:31:43.623" Score="1" Body="&lt;p&gt;The FFT is just a fast algorithm for evaluating the &lt;a href=&quot;http://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete Fourier transform (DFT)&lt;/a&gt;. The domains for the DFT are discrete in both time and frequency. So, the result of an inverse DFT using the inputs you showed above will be a discrete-time signal.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-05-15T00:31:43.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23404" PostTypeId="2" ParentId="23385" CreationDate="2015-05-15T00:57:20.403" Score="10" Body="&lt;p&gt;The acronym BIBO, when used by university DSP professors, is merely a fancy (academic) term that means stable. So when when you encounter the term BIBO in the literature of DSP you can replace that term with the word &quot;stable&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your final question, the answer is yes. Think of this: You have an audio signal that you'd like to apply to the input of a lowpass filter. And it's possible to design an IIR lowpass filter (a recursive filter, with feedback) using commercial software using filter coefficients that are represented by super-high precision floating point binary numbers. Then when you quantize your coefficients to 8-bit values in order to implement your lowpass filter using an 8-bit microcontroller, it's possible for the &quot;imprecise&quot; 8-bit filter coefficients to cause the IIR filter to become unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That scenario, described in every DSP textbook, means each input sample applied to your filter will cause the filter's successive output samples to uncontrollably grow in value. And when fixed-bit-width binary numbers grow in value they will eventually experience overflow error.  The bottom line here is: When an information-carrying discrete signal is applied to an unstable digital filter the output quickly becomes random noise. To quote my young granddaughter, &quot;This is a bad thing.&quot;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-05-15T00:57:20.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23405" PostTypeId="2" ParentId="23400" CreationDate="2015-05-15T01:49:31.477" Score="1" Body="&lt;p&gt;Your 'S' sequence, comprising frequency-domain samples, is a &quot;discrete-frequency signal&quot;. When you perform an IFFT on the 'S' sequence you'll generate a sequence of time-domain samples. Any time-domain sequence made up of a sequence of samples (a list of numbers) is a &quot;discrete-time signal&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you graphically draw a discrete-time signal (versus time) on a piece of paper, you must draw a sequence of dots.  In doing so your pencil tip will periodically leave the surface of the paper.  On the other hand, if you ever had to draw a &quot;continuous signal&quot; on paper, you'll draw a curved line where the tip of your pencil never leaves the surface of the paper.   &lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15391" LastEditDate="2015-05-16T16:36:29.587" LastActivityDate="2015-05-16T16:36:29.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23406" PostTypeId="2" ParentId="22065" CreationDate="2015-05-15T03:16:27.420" Score="-1" Body="&lt;p&gt;There is a lot of information on the acoustic measurement of symphony halls, sound stages, classrooms, etc.  Much of it can be found in JASA (Journal of the Acoustical Society of America).  For example. you would get about 187,00 hits when googling for: JASA + acoustic measurements of a classroom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, there are other sources, such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.davidgriesinger.com/dgaes92b.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.davidgriesinger.com/dgaes92b.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the impulse response invariant method, you can get similar results by googling for: impulse response invariant method + room acoustics.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2015-05-15T03:16:27.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23407" PostTypeId="1" CreationDate="2015-05-15T05:33:24.863" Score="0" ViewCount="14097" Body="&lt;p&gt;From &lt;a href=&quot;https://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=7&amp;amp;ved=0CEMQFjAG&amp;amp;url=https%3A%2F%2Fay14-15.moodle.wisc.edu%2Fprod%2Fmod%2Fresource%2Fview.php%3Fid%3D12255&amp;amp;ei=XHdVVfbgKM6iugT_s4O4Cw&amp;amp;usg=AFQjCNGlx96z2fJOCwWNVV57mJiZTTZBDQ&amp;amp;sig2=sJmhKSquh-KSr_AY1JA8Ug&amp;amp;bvm=bv.93564037,d.c2E&amp;amp;cad=rja&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; document I am quoting P2,L7&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So what is the incremental distance if we are using a 64 element look-up table instead of a sine function based on 2π? incremental distance = 2k*64/48k = 8/3. In this case increment represents a virtual phase increment or more directly a table index increment.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The radian increment statement I am clear with. Now I am having a basic doubt of how can it be incremented to table index of 8/3 on each sample to be calculated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following, some new doubts arise.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is lookup table method applicable for limited number of Fs, which can be indexed from the lookup table ?&lt;/li&gt;&#xA;&lt;li&gt;Consider a lookup table of size 256, generated with resolution of π/24. Is it popssible to generate sine value for, say sin(π/3) from lookup table ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7868" LastActivityDate="2015-05-16T16:31:17.767" Title="How sine wave is generated using lookup tables" Tags="|discrete-signals|signal-synthesis|tone-generation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23409" PostTypeId="1" AcceptedAnswerId="30084" CreationDate="2015-05-15T06:21:14.547" Score="0" ViewCount="1671" Body="&lt;p&gt;I'm confuse with their explanation about definition 1 notation of 4- (8-) and 8- (4-) in &lt;a href=&quot;http://tpf-robotica.googlecode.com/svn-history/r397/trunk/Vision/papers/SA-CVGIP.PDF&quot; rel=&quot;nofollow&quot;&gt;Suzuki Abe paper &quot;Topological Structural Analysis of Digitized Binary Images by Border Following&quot;&lt;/a&gt; pg 34, and what they mean about NBD and LNBD in pg 35? Is NBD=neighborhood? &lt;/p&gt;&#xA;" OwnerUserId="12035" LastEditorUserId="12035" LastEditDate="2015-05-23T14:17:29.883" LastActivityDate="2016-05-13T10:57:06.830" Title="Get problem to understand &quot;Topological Structural Analysis of Digitized Binary Images by Border Following&quot; Suzuki Abe" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23411" PostTypeId="1" AcceptedAnswerId="23504" CreationDate="2015-05-15T10:39:11.553" Score="0" ViewCount="136" Body="&lt;p&gt;I have series of amplitudes of a signal recieved at center frequency of 433.9MHz, sampling at 250000 Hz. I can see the information received is the packet I am after, just sampled too high. I believe the transmitter transmits at 3918bps. What is the best method to downsample from 250000 Hz to 3918 bps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using a butterworth filter, which doesn't seem to work and I don't understand why. I've tried picking every 63 samples (because 250000/3918 = ~63), but didn't seem to work either. Please bare in mind I am a bit of a newbie regarding DSP.&lt;/p&gt;&#xA;" OwnerUserId="15834" LastEditorUserId="15834" LastEditDate="2015-05-15T15:54:15.093" LastActivityDate="2015-05-19T14:59:42.790" Title="Downsampling an Oversampled packet" Tags="|downsampling|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="23413" PostTypeId="1" CreationDate="2015-05-15T13:00:04.950" Score="0" ViewCount="806" Body="&lt;p&gt;I am trying to use FFTW function for IFFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fftw_plan_dft_c2r_1d(size, out_cpx, out, FFTW_ESTIMATE).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My goal is to input desired frequency response data and obtain related coefficients using Inverse Fourier Transform. Since out_cpx is complex, I calculated magnitude (0,1) and phase, taking into account it is linear phase filter. Since I know the phase I calculated real and imaginary parts as A&lt;em&gt;cos(w) and A&lt;/em&gt;sin(w) and with these pairs I populated out_cpx[i][0] and out_cpx[i][1]. When I perform Inverse Fourier Transform using fftw_plan_dft_c2r_1d() I assume I am right away getting FIR coefficients h[n] as the result. With these coefficients i go to MATLAB and get response using freqz(C,1) where C holds my coefficients. But I am getting a lot of ripples in my graph for response and for phase. Am I doing something wrong here? It is not clear to me how to specify phase of the desired frequency response.&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="15718" LastEditDate="2015-05-22T13:07:17.190" LastActivityDate="2015-08-14T21:45:52.443" Title="FFTW - Inverse FFT input data" Tags="|fft|filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23415" PostTypeId="1" AcceptedAnswerId="23418" CreationDate="2015-05-15T16:00:01.173" Score="0" ViewCount="57" Body="&lt;p&gt;simple question, but I cant seem to understand how they got the answer.&#xA;I have  $x(t)$ as a signal, and I'm told that its Nyquist frequency is $\omega_0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm asked - what is the Nyquist frequency of this next signal: $$ x(t)\cos^2(\omega_0t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;after playing with it I got the Fourier transform of it $$0.5(j\omega)+0.25X(j(\omega+2\omega_0))+0.25X((j(\omega-2\omega_0))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I got the same signal (different amplitude) and two more of it shifted in frequency. I draw it and concluded that the Nyquist frequency is $3\omega_0$&#xA;Buy I'm wrong and don't know how to get to the correct answer.&#xA;The formal answer is $$2(\omega_0/2 +2\omega_0)=5\omega_0$$&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15323" LastEditorUserId="8202" LastEditDate="2015-05-15T16:56:44.797" LastActivityDate="2015-05-15T16:56:44.797" Title="nyquist fequency" Tags="|frequency|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23416" PostTypeId="1" CreationDate="2015-05-15T16:00:25.977" Score="0" ViewCount="2176" Body="&lt;p&gt;I'm building a real-time audio resampler (think pitch bend) that needs to have a several different performance vs quality configuration options. I understand that I'll need to apply a low-pass filter before resampling in order to avoid aliasing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The requirements for the first filter are this:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;very efficient&lt;/li&gt;&#xA;&lt;li&gt;better than nothing&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For this filter, I don't mind if I have a very slow roll-off, or if there's significant phase distortion. I just want it to be as fast as possible, and to attenuate frequencies above nyquist to some degree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The requirements for the second filter are:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;reasonably efficient&lt;/li&gt;&#xA;&lt;li&gt;significant reduction in frequencies above nyquist&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm guessing that I'll want to go with one of the classic algorithms I hear about for the second filter (chebyshev, butterworth), and potentially something like a recursive moving average filter for the first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize my question may so vague as to be useless (&quot;very efficient&quot; and &quot;reasonably efficient&quot; are obviously relative terms!) I realize that filter selection and design is an art that one can spend a lifetime on. I'm quite inexperienced with DSP and am just looking for a couple algorithms I can get my hands dirty with. I'm hoping someone with audio experience can pip up and say &quot;here are my general purpose, go-to algorithms for efficient lowpass filtering&quot;. &lt;/p&gt;&#xA;" OwnerUserId="15837" LastActivityDate="2015-05-17T03:47:33.713" Title="Which anti aliasing filter algorithm for efficient audio resampling?" Tags="|lowpass-filter|resampling|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23417" PostTypeId="2" ParentId="23389" CreationDate="2015-05-15T16:18:28.060" Score="0" Body="&lt;p&gt;You might be seeing the FFT coefficients shifted towards the extremes with your code. Try using fftshift() as shown below,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=2^(nextpow2(length(x_comp)));&#xA;&#xA;x_comp_mag = abs(fftshift(fft(x_comp,N)));&#xA;&#xA;f = linspace(-Fs/2,Fs/2,N); % for double sided spectrum&#xA;&#xA;plot(f,x_comp_mag);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-05-15T16:18:28.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23418" PostTypeId="2" ParentId="23415" CreationDate="2015-05-15T16:22:01.280" Score="3" Body="&lt;p&gt;Normally the &lt;a href=&quot;http://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow&quot;&gt;Nyquist frequency&lt;/a&gt; is a property of a discrete-time signal, and not of a continuous-time signal, but I guess that what is meant is the minimum rate at which the signal $x(t)$ must be sampled in order to satisfy the sampling theorem. That would be twice its bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the signal $x(t)$ has bandwidth $\omega_0/2$ and it is multiplied by $\cos^2(\omega_0t)=\frac12 (1+\cos(2\omega_0t))$. This creates a shifted spectrum centered at $2\omega_0$. So the maximum frequency of the modulated signal is $2\omega_0+\omega_0/2$, i.e. the new center frequency plus the original signal's bandwidth. The corresponding Nyquist rate is twice this maximum frequency, which gives the result that you stated in your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-15T16:22:01.280" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23419" PostTypeId="1" CreationDate="2015-05-15T17:14:33.573" Score="1" ViewCount="200" Body="&lt;p&gt;I am working on a mixer which lets me mix dry and wet signal in a user defined ratio. Wet signal is basically just the all pass filtered signal. The mixing takes place in frequency domain and so does the filtering. So the requirement here is, after mixing I have to compensate for amplitude loss, i.e. the output signal should have same peak value over a frame as input signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output= x*wet +(1-x)*dry;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where dry is the input signal and wet is the output of filter, and all the signals are in frequency domain. x is a scalar ratio(0 to 1). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to apply this compensation. I tried to multiply by ratio of RMS values of input and output&#xA;i.e. &lt;code&gt;output = RMS(input)/RMS(output) *output&lt;/code&gt; (again everything in frequency domain)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but even this doesn't produce the desired result. (I am seeing meters in audacity after processing in aforementioned manner). &lt;/p&gt;&#xA;" OwnerUserId="15450" LastEditorUserId="15450" LastEditDate="2015-05-15T19:43:25.950" LastActivityDate="2015-05-15T19:43:25.950" Title="amplitude compensation after filtering and mixing audio" Tags="|frequency-spectrum|sound|filtering|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23420" PostTypeId="2" ParentId="23416" CreationDate="2015-05-15T18:18:42.787" Score="1" Body="&lt;p&gt;For a first cut, I would consider a windowed Sinc interpolation kernel for both resamplers.  Very narrow window with a small polyphase table for the fast one.  Much wider window with more phases in a larger, possibly interpolated lookup table for the slower higher quality filtered interpolator/resampler.  Lots of parameters (including choice of window) that can be adjusted for both quality and performance to meet widely varying requirements.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-05-15T19:38:02.047" LastActivityDate="2015-05-15T19:38:02.047" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23421" PostTypeId="1" AcceptedAnswerId="23430" CreationDate="2015-05-15T19:02:05.910" Score="-1" ViewCount="133" Body="&lt;p&gt;I am really confused about this exam question regarding Aliasing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal of 2Hz, which I needed to draw a square wave of, over a period of 8 seconds. It Then asks, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Starting from the square wave you plotted above, plot the resulting wave if it is sampled at a rate of 0.5Hz. What is the phenomenon occurring here.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Question is, what is the Aliased frequency? &lt;/p&gt;&#xA;" OwnerUserId="15839" LastActivityDate="2015-05-16T08:29:26.253" Title="Aliasing of a Signal" Tags="|aliasing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23422" PostTypeId="1" AcceptedAnswerId="34326" CreationDate="2015-05-15T19:05:48.163" Score="4" ViewCount="3959" Body="&lt;p&gt;My book with answers to proakis and manolakis book says that $F(x,n)=x(-n + 2)$ is time invariant while my calculation shows that it is time variant. I have repeated them many times and I am mostly convinced that book is wrong. Can somebody please check my calculations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First we shift output signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(x, n - k) = x(-(n-k) + 2) = x(-n+k+2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now lets put $x'(n) = x(n-k)$ and check what happen when we input shifted signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(x', n) = x'(-n+2)=x(-n+2-k)=x(-n-k+2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since $F(x, n - k) \neq F(x', n)$ this system is time variant. Is my method correct?&lt;/p&gt;&#xA;" OwnerUserId="863" LastEditorUserId="11256" LastEditDate="2015-05-16T00:37:44.157" LastActivityDate="2016-09-21T08:16:37.313" Title="is $F(x,n)=x(-n + 2)$ time invariant?" Tags="|discrete-signals|system-identification|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23423" PostTypeId="1" CreationDate="2015-05-15T19:17:49.220" Score="3" ViewCount="4908" Body="&lt;p&gt;My book with answers to proakis and manolakis book says that $F(x,n)=x(n)u(n)$ is time invariant while my calculation shows that it is time variant. I have repeated them many times and I am mostly convinced that book is wrong. Can somebody please check my calculations?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;let $u(n)$ be a Heavside step function. First we shift output signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(x, n-k)=x(n-k)u(n-k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x'(n)=x(n-k)$ be a shifted input signal. Lets calculate response to shifted input signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(x', n)=x'(n)u(n)=x(n-k)u(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since $F(x, n - k) \neq F(x', n)$ this system is time variant. Is my method correct?&lt;/p&gt;&#xA;" OwnerUserId="863" LastActivityDate="2022-05-30T17:18:48.797" Title="is $F(x, n)=x(n)u(n)$ time invariant?" Tags="|discrete-signals|system-identification|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23425" PostTypeId="2" ParentId="23423" CreationDate="2015-05-15T20:36:57.343" Score="2" Body="&lt;p&gt;The answer to this (and your other similar question) is most likely found in the somewhat unusual notation used for the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In ordinary terms, if you just take your system as a map between input and output signal, then you're absolutely right, it would not be time invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Proakis defines the system as a map from an input signal and a time coordinate to the output signal. If you want, the time coordinate itself can be understood as a second signal that just happens to contain the time index at each time index. Consequently, the time shift operator would act on this system definition by both shifting the proper signal and the time coordinate, so that the the system turns out to be time &lt;em&gt;invariant&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let me summarise: The system map $F(x,n)=x(n)u(n)$ is time invariant whereas the map $F(x)=x(n)u(n)$ is not time invariant.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-05-15T20:36:57.343" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23426" PostTypeId="2" ParentId="23416" CreationDate="2015-05-16T01:17:47.727" Score="0" Body="&lt;p&gt;As stated previously, there is a tradeoff with rolloff and computation time. You can really get away with a 1st-order lowpass IIR filter (sure you can use Butterworth as mentioned) designed in MATLAB with a cutoff frequency a bit below sampling frequency Fs/2. &lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-16T01:17:47.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23428" PostTypeId="1" AcceptedAnswerId="24206" CreationDate="2015-05-16T02:53:00.530" Score="0" ViewCount="2742" Body="&lt;p&gt;I am trying to draw a spectrogram from FFT data I get from audio files.&#xA;The problem is that I can't figure out is what the yielded power (decibels) are relative to. I'm getting some arbitrary -100db-ish numbers, but I don't understand how I can have them represent a finite intensity-scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hjxEh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a gradient which will represent the intensity of these numbers, where silence is black and the maximum is yellow I need to know what the maximum is. I'm really not good in the DSP-area so help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15372" LastActivityDate="2015-06-17T21:45:22.037" Title="Drawing a Spectrogram off of FFT - what are the decibels relative to?" Tags="|fft|spectrogram|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23430" PostTypeId="2" ParentId="23421" CreationDate="2015-05-16T08:29:26.253" Score="2" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you draw the signal and you take samples at a rate of $0.5\,\text{Hz}$, what are the sampled values that you get? Are they all different? If not, what is the frequency of a constant signal?&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-16T08:29:26.253" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23431" PostTypeId="1" AcceptedAnswerId="23433" CreationDate="2015-05-16T08:59:02.607" Score="1" ViewCount="61" Body="&lt;p&gt;Given a system, that behaves as a 1st order filter with network function $H(s)$. We input:&#xA;$$v_1 (t)=1+3\cos(10^4 t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And we obtain as output:&#xA;$$v_2(t)=1+1.5\cos \left(10^4 t -\dfrac{\pi}{3}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say what kind of filter it is and find its network function $H(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to solve this problem and I have solved the first part by saying that the filter is a &lt;strong&gt;low-pass filter&lt;/strong&gt; because the continuous term is conserved in the input as well as in the output. And I have supposed that the network function will be of the form:&#xA;$$H(s) = \dfrac{\kappa}{s+a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what do I have to do in order to compute the constants $\kappa, a$ according to the filter characteristics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to compute the amplification for the following frequencies:&#xA;$$\text{Amplification}(\omega=0) =\dfrac{1}{1} = 1$$&#xA;$$\text{Amplification}(\omega=10^4) = \dfrac{1.5}{3} = 0.5$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't know if this is correct since the phase of cosine in the output is different.&lt;/p&gt;&#xA;" OwnerUserId="15843" LastActivityDate="2015-05-16T09:31:09.110" Title="Calculating the network function of a filter" Tags="|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23433" PostTypeId="2" ParentId="23431" CreationDate="2015-05-16T09:31:09.110" Score="3" Body="&lt;p&gt;You need to consider the system's frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\omega)=\frac{\kappa}{j\omega+a}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you know that $$H(0)=1\tag{2}$$ and $$|H(j\omega_0)|=\frac12\tag{3}$$ (with $\omega_0=10^4$). Note that $H(0)$ is real-valued, whereas $H(j\omega_0)$ will generally be complex-valued. From (1) and (2) you immediately get $\kappa=a$. Furthermore, since the filter is stable we know that $a&amp;gt;0$ (i.e. the pole must lie in the left half-plane of the complex $s$-plane). Combining (3) with (1) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{a}{\sqrt{\omega_0^2+a^2}}=\frac12\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which it should be easy for you to compute $a$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you don't need the phase value to specify the system. What should be checked is if the phase value is the actual phase value of the system that you just computed. In order to do this you need to verify that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\arg\{H(j\omega_0)\}=-\frac{\pi}{3}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily that's the case, otherwise the assumption (1) would be wrong. I leave the proof of (5) up to you.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-16T09:31:09.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23434" PostTypeId="2" ParentId="23113" CreationDate="2015-05-16T11:41:36.163" Score="0" Body="&lt;p&gt;In case anyone has the same problem, I want to tell that the above code works really well. My problem about the distortion of audio caused by wrong buffer size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But while searching for a solution, I figured out that everyone says that using &lt;code&gt;union&lt;/code&gt; may cause undefined behaviour in different CPU structures. It is said to use bitshift operations instead. So I decided to change the code for conversion as below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input Conversion&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int16_t sample = 0;&#xA;    for (int k = 0; k &amp;lt; BYTE_RESOLUTION_IN; k++) {&#xA;    sample |= input_buffer[i + k] &amp;lt;&amp;lt; (k * 8);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output Conversion&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int16_t sample_int16 = (int16_t) temp;&#xA;    for (int k = 0; k &amp;lt; BYTE_RESOLUTION_OUT; k++) {&#xA;    output_buffer[i + k] = (sample_int16 &amp;gt;&amp;gt; (k * 8)) &amp;amp; 0xFF;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this conversion is made for Little-Endian system. If you have Big-Endian system, you have to change the &lt;code&gt;k&lt;/code&gt; value properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a nice day&lt;/p&gt;&#xA;" OwnerUserId="15678" LastActivityDate="2015-05-16T11:41:36.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23435" PostTypeId="2" ParentId="23407" CreationDate="2015-05-16T12:20:14.567" Score="1" Body="&lt;p&gt;So in general look up tables works as follows: Let's say you have a sample rate of 48 kHz and a table of size 64 (covering all the range from 0 to 2*pi). If you step through the table with a step size of 1, you get one cycle in 64 samples so the frequency would be 48kHz/64 = 750 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a step size of 2 you would get 1500 Hz, 3 would be 2250 Hz etc. You can only create exact sine waves that are an integral multiple of the fundamental frequency (sampleRat/tableSize). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can certainly try other frequencies as well, but you end up with a non-integer step size so you either have to round the step index or do some interpolation between table values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general table look up is a terrible way of creating sine waves. There are other oscillator algorithms that are much cheaper, more flexible and require almost no memory. See for example &lt;a href=&quot;https://dsp.stackexchange.com/questions/124/how-to-implement-a-digital-oscillator&quot;&gt;How to implement a digital oscillator?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-05-16T12:20:14.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23438" PostTypeId="1" CreationDate="2015-05-16T15:01:57.690" Score="1" ViewCount="267" Body="&lt;p&gt;I am running complex morlet (&lt;code&gt;cmor1-1.5&lt;/code&gt;) wavelet transform. I want to have the transformation for the range of $[1,150]\textrm{ Hz}$ with a step of $1\textrm{ Hz}$.&#xA;I want to use &lt;code&gt;scal2freq&lt;/code&gt; Matlab function to convert scales to pseudo frequencies but I don`'t know how to define the delta.&lt;/p&gt;&#xA;" OwnerUserId="15850" LastEditorUserId="1629" LastEditDate="2016-09-11T08:56:58.237" LastActivityDate="2016-09-11T08:56:58.237" Title="What is the delta parameter in $\tt scal2freq$?" Tags="|matlab|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23440" PostTypeId="2" ParentId="23407" CreationDate="2015-05-16T16:31:17.767" Score="2" Body="&lt;p&gt;Lookup tables are incredibly useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In audio, when you're doing a chorus or flange effect, or a synthesizer with a modulating envelope, you want to be able to cycle through a sine wave in a lookup table and not just keep track of some infinitely growing index n.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll want to use some mathematical program like MATLAB, Octave, or Mathematica to generate as many points as is practical (I wouldn't go with less than 512 or 1024 points) and store that in an array. This is your lookup table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a fractional index, what you'll end up doing is linearly interpolating around the nearest two indices at that fractional value. Let's say your index is 8/3. You've called up your index in a 1024 point table four times. What do you do? Now you're at index 32/3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to find the lower index floor(32/3) and the higher one ceil(32/3). You'll need some conditionals in case you're at the end. I'll leave that exercise to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now you've got your neighbor indices, you'll evaluate the interpolated value at that fractional index using the linear interpolation formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y = x*y2 + (1-x)*y1;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where x is the difference between your fractional index and the nearest index rounded down, y1 is the nearest value of the lookup table rounded down (you found the index earlier, now just use it to index into the lookup array) and y2 is the same thing for the nearest value rounded up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would track the index in a variable and increment it each loop of your program by 8/3 and do a wraparound when necessary (when you go beyond the length of the lookup table).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trickiest thing is keeping track of the indices. The nearest value rounded up may be the 0th index.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-16T16:31:17.767" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23441" PostTypeId="1" AcceptedAnswerId="23444" CreationDate="2015-05-16T17:13:22.113" Score="1" ViewCount="91" Body="&lt;p&gt;Is this filter a BPF?&#xA;$$\dfrac{z}{z-a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ is some complex number?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we put a pole somewhere on the unit circle it will emphasise a certain frequency, is that right?&lt;/p&gt;&#xA;" OwnerUserId="15851" LastEditorUserId="8202" LastEditDate="2015-05-22T08:28:02.437" LastActivityDate="2015-05-22T08:28:02.437" Title="What kind of filter is this?" Tags="|control-systems|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23442" PostTypeId="1" AcceptedAnswerId="23445" CreationDate="2015-05-16T18:09:38.190" Score="0" ViewCount="774" Body="&lt;p&gt;I have the discrete impulse response of a filter and i want to determine which kind of filter it is by using the DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impulse response is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h0 = [0,1,2,1,0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which I zero-pad for a better result&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N0 = 10;&#xA;h1 = [zeros(1,N0),h0, zeros(1, N0)];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then i created the N-Point DFT of it using FFT&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H1 = fft(h1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The picture shows the plot of &lt;code&gt;abs(H1)&lt;/code&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SIGLB.png&quot; alt=&quot;FFT of the given zero-padded impulse response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now i know that k1 = 0 represents the steady component and at first I thought that this is the spectrum of a band-stop filter but now that I read a little bit more about the DFT I'm not quite sure because the DFT is always mirrored for real signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: Do I have to use only one half of the DFT spectrum to determine the filter characteristics? (Which would mean that this is a low-pass filter?) &lt;/p&gt;&#xA;" OwnerUserId="15853" LastEditorUserId="7092" LastEditDate="2015-05-16T21:18:29.153" LastActivityDate="2015-05-16T21:18:29.153" Title="How to determine the filter type of a discrete frequency spectrum" Tags="|matlab|filters|discrete-signals|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23443" PostTypeId="2" ParentId="23442" CreationDate="2015-05-16T18:31:01.930" Score="-1" Body="&lt;p&gt;You are getting a band pass filter. The coefficients of the filter are the ones that you are getting from the impulse response. The frequencies are folding around the f/2 or &quot;the 0&quot;, where the imaginary values of the transform are anti symmetric (negative for half of the values). &lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-05-16T18:31:01.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23444" PostTypeId="2" ParentId="23441" CreationDate="2015-05-16T18:51:21.997" Score="2" Body="&lt;p&gt;Yes, if you put a pole &lt;em&gt;approaching&lt;/em&gt; the unit circle (but not on the unit circle, as this will create an unstable filter) , you will have a bandpass. The center frequency of this bandpass filter depends on how many radians along the unit circle where you have placed the pole (the pole's 'degree'). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving counter-clockwise from zero will give you an increasing center frequency of the bandpass filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you start moving towards zero on the Z-plane and away from the unit circle, you will decrease the sharpness Q and consequently increase the bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-05-16T19:27:45.977" LastActivityDate="2015-05-16T19:27:45.977" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23445" PostTypeId="2" ParentId="23442" CreationDate="2015-05-16T19:11:22.137" Score="0" Body="&lt;p&gt;The $k_1$ indexes you get from the FFT correspond to frequencies 0 to $2\pi$ (actually, 1 sample short of $2\pi$). Note that frequencies in the range $\pi$ to $2\pi$ also correspond to the negative half of the specturm ($-\pi$ to 0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get a nice visualisation with frequency 0 in the middle by applying &lt;code&gt;fftshift&lt;/code&gt; to the result (Octave or Matlab assumed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also check &lt;code&gt;freqz&lt;/code&gt;, which plots a nice frequency and phase repsonse (try &lt;code&gt;freqz([1 2 1], [1])&lt;/code&gt;). Or try &lt;code&gt;plot(abs(freqz([1 2 1],[1])))&lt;/code&gt; to get a linear plot rather than log.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are getting is a low-pass filter (gain 4 at low frequency, 0 at high frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;In VERY general terms:&lt;/em&gt; You can know beforehand it is a LPF because the impulse response is a single bump. A high-pass filter will have some sort of antisymetric shape (like &lt;code&gt;[1 2 -2 -1]&lt;/code&gt;), and a band-pass or band-reject will have some oscillations in the impulse response.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-05-16T19:11:22.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23447" PostTypeId="2" ParentId="23428" CreationDate="2015-05-16T22:36:10.903" Score="-1" Body="&lt;p&gt;dB are in fact meaningless units on their own. They are a ratio unit, so for dB to be meaningful, it needs to be computed within a context. For example, dB SPL (sound pressure level) is computed with respect to the pressure of 20 micropascals, which is the threshold of audibility in terms of sound pressure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://artsites.ucsc.edu/ems/music/tech_background/te-06/teces_06.html&quot; rel=&quot;nofollow&quot;&gt;http://artsites.ucsc.edu/ems/music/tech_background/te-06/teces_06.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-16T22:36:10.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23448" PostTypeId="2" ParentId="23428" CreationDate="2015-05-16T23:18:42.280" Score="0" Body="&lt;p&gt;An accurate FFT should give you an estimate of the volume of the component sines contained in one area of the sound graph. If you have 3 sines playing of energy level 0.33 of max SPL, and the FFT shows 3 peaks, there should be 3 peaks who's value is 0.33. the values will be averaged in F and T, however the ideal theoretical value is the real value of the individual sines that make up the sound, or the sum of the sines that cohabit that area of the graph.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2015-05-16T23:18:42.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23449" PostTypeId="1" AcceptedAnswerId="23451" CreationDate="2015-05-16T23:52:12.567" Score="1" ViewCount="663" Body="&lt;p&gt;This question is regarding digital modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If 64 QAM always provides rates greater than BPSK or 16 QAM, then why do systems always use higher order modulation of QAM?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15315" LastActivityDate="2015-05-17T00:54:03.827" Title="64 QAM versus lower order modulation" Tags="|digital-communications|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23451" PostTypeId="2" ParentId="23449" CreationDate="2015-05-17T00:54:03.827" Score="2" Body="&lt;p&gt;There is a trade-off between modulation order, required energy and bit-error rate (BER). As you increase the modulation order, you need to increase the average energy per bit to keep the same BER.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an easy example, consider BPSK vs 4-PAM. Say you have BPSK with distance between constellation points $d_{min}=1$; this works out to an average bit energy of 0.25 joules per bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you want to double the bit rate by going to 4-PAM, but you want to keep roughly the same BER, which means having the same minimum distance $d_{min}$ between constellation neighbors. Now, your average symbol energy is $$\overline{E_s}=\frac{2\cdot1.5^2+2\cdot0.5^2}{4}=1.25$$ joules, or an average bit energy $\overline{E_b}=0.625$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you increase the modulation order, you'll see the energy required increase exponentially. Exactly the same thing happens when using QAM.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-17T00:54:03.827" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23452" PostTypeId="2" ParentId="23416" CreationDate="2015-05-17T03:47:33.713" Score="1" Body="&lt;p&gt;Given that:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;you are new to DSP&lt;/li&gt;&#xA;&lt;li&gt;you are designing code to be used in a library for a variety of devices (and data types perhaps?)&lt;/li&gt;&#xA;&lt;li&gt;your filter applies to an upsampled signal*&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I recommend you start creating an implementation for an FIR that can take an arbitrary coefficient table for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing an FIR is simple, easy to debug, and you don't have any feedback loop as with IIRs that may induce error propagation and instability issues (especially with fixed-point data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have written your FIR, you can readily experiment with any filter coefficient tables you put your hands on until you find the compromise you think is right for your low- and high-end filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, if the code finds its way into a library that later needs to be optimized for a given device, people &lt;em&gt;will&lt;/em&gt; have an optimized FIR routine that can readily be leveraged.  Same isn't necessarily true with IIRs as there are different flavors of IIR implementations.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Upsampled signal ==&gt; lots of zeros ==&gt; lots of multiplications you can easily ignore when computing a given sample output from an FIR&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15857" LastActivityDate="2015-05-17T03:47:33.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23456" PostTypeId="1" AcceptedAnswerId="23457" CreationDate="2015-05-17T11:56:58.537" Score="3" ViewCount="1932" Body="&lt;p&gt;With reference to the diagram below, is it correct to say that at the pass band the phase response is linear. It also remains linear in the stop band but it get chunks of π. These jumps happen when the magnitude response goes down to minus infinity dB (theoretically) ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NGzxp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15744" LastEditorUserId="4298" LastEditDate="2015-05-17T13:10:52.697" LastActivityDate="2015-05-17T14:40:40.500" Title="FIR filter phase response" Tags="|filters|linear-phase|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23457" PostTypeId="2" ParentId="23456" CreationDate="2015-05-17T13:10:14.183" Score="2" Body="&lt;p&gt;You are right. Even though the phase jumps at the zeros of the frequency response, such a phase response is usually still called &quot;linear&quot;. For a frequency selective filter with frequency response zeros in the stopband, the phase always has discontinuities at the zeros. A purely linear phase response (without jumps) is only possible for filters with no zeros in their frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response of your filter can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=|H(e^{j\omega})|e^{j\phi(\omega)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi(\omega)$ is the phase response with jumps at the zeros, as shown in your figure. For such a linear phase system, the frequency response (1) can equivalently be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=A(e^{j\omega})e^{j\hat{\phi}(\omega)}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A(e^{j\omega})$ is a real-valued but bipolar (i.e. positive and possibly negative) function satisfying $|A(e^{j\omega})|=|H(e^{j\omega})|$. The phase $\hat{\phi}(\omega)$ in (2) is now a purely linear function without any jumps.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-17T14:40:40.500" LastActivityDate="2015-05-17T14:40:40.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23458" PostTypeId="1" CreationDate="2015-05-17T14:42:01.150" Score="3" ViewCount="629" Body="&lt;p&gt;This is soft question.I am not expert in music. We know that English language has 26 letters (which are again grouped into vowels and consonants) , while language of music is same all over the world and it has only 7 letters (all are vowels). There are number of &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_musical_instruments&quot; rel=&quot;nofollow&quot;&gt;musical instruments&lt;/a&gt;. one can blindly recognize which instrument is being played just by listening to it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each musical instrument &lt;strong&gt;sounds&lt;/strong&gt; (i am not finding proper word here in case of &quot;sounds&quot; ) different than any other musical instrument.Every instrument seems to be unique while listening.My basic question is why is it so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also,is it possible to replace one musical instrument by combining two or more other instruments playing together or like that ? (For example is it possible to obtain  &lt;strong&gt;same&lt;/strong&gt; Guitar sound (i.e.sound/tones our ear listen while Guitar is being played) by  combination of other musical instruments say violin and harmonium etc played together ?)&lt;/p&gt;&#xA;" OwnerUserId="15429" LastEditorUserId="15429" LastEditDate="2015-05-18T04:27:49.057" LastActivityDate="2015-05-18T14:20:56.850" Title="Why every musical instrument sounds different than any other while listening?" Tags="|audio|signal-analysis|frequency|sound|wave|" AnswerCount="4" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23459" PostTypeId="2" ParentId="23458" CreationDate="2015-05-17T14:44:27.017" Score="1" Body="&lt;p&gt;With digital signal processing and digital audio effects you can get a similar tone. (:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But acoustically, no, because of the transfer function of the mechanical-acoustic system of the instrument (among other unique aspects of the instrument), the harmonics will never be just the same.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-17T14:44:27.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23460" PostTypeId="1" CreationDate="2015-05-17T15:30:37.770" Score="4" ViewCount="17938" Body="&lt;p&gt;How to calculate the values of Gaussian kernel? I think I understand the principle of it weighting the center pixel as the means, and those around it according to the $\sigma$ but what would each value be if we  should manually calculate a $3\times 3$ kernel?&lt;/p&gt;&#xA;" OwnerUserId="15861" LastEditorUserId="128" LastEditDate="2018-08-22T20:54:30.890" LastActivityDate="2022-03-24T13:50:58.413" Title="How to Calculate Gaussian Kernel for a Small Support Size?" Tags="|image-processing|gaussian|filtering|math|blur|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23461" PostTypeId="2" ParentId="23460" CreationDate="2015-05-17T15:57:48.987" Score="3" Body="&lt;p&gt;Gaussian Kernel is made by using the Normal Distribution for weighing the surrounding pixel in the process of Convolution.&lt;/p&gt;&#xA;&lt;p&gt;Since we're dealing with discrete signals and we are limited to finite length of the Gaussian Kernel usually it is created by discretization of the Normal Distribution and truncation.&lt;/p&gt;&#xA;&lt;p&gt;I created a project in GitHub - &lt;a href=&quot;https://github.com/RoyiAvital/FastGuassianBlur&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Gaussian Blur&lt;/a&gt;.&lt;br /&gt;&#xA;It uses many methods to approximate the Gaussian Blur Filter and evaluate their speed and quality.&lt;/p&gt;&#xA;&lt;p&gt;The most classic method as I described above is the FIR Truncated Filter. I implemented it in &lt;code&gt;ApplyGaussianBlur.m&lt;/code&gt; in my &lt;a href=&quot;https://github.com/RoyiAvital/FastGuassianBlur&quot; rel=&quot;nofollow noreferrer&quot;&gt;FastGaussianBlur GitHub Repository&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Regarding small sizes, well a thumb rule is that the radius of the kernel will be at least 3 times the STD of Kernel.&lt;br /&gt;&#xA;If you chose &lt;span class=&quot;math-container&quot;&gt;$ 3 \times 3 $&lt;/span&gt; kernel it means the radius is &lt;span class=&quot;math-container&quot;&gt;$ 1 $&lt;/span&gt; which means it makes sense for STD of &lt;span class=&quot;math-container&quot;&gt;$ \frac{1}{3} $&lt;/span&gt; and below.&lt;/p&gt;&#xA;&lt;p&gt;Then just fill your Kernel By:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;gaussianBlurRadius  = ceil(stdToRadiusFactor * gaussianKernelStd);     &#xA;vGaussianKernel = exp(-([-gaussianBlurRadius:gaussianBlurRadius] .^ 2) / (2 * gaussianKernelStd * gaussianKernelStd));&#xA;vGaussianKernel = vGaussianKernel / sum(vGaussianKernel);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-03-24T13:50:58.413" LastActivityDate="2022-03-24T13:50:58.413" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="23463" PostTypeId="1" CreationDate="2015-05-17T18:24:52.010" Score="0" ViewCount="195" Body="&lt;p&gt;I was drawing a high pass filter response ,in a polar coordinates, the function is &lt;code&gt;(z+1)/z&lt;/code&gt; and then it is &lt;code&gt;2+2*cos(w)&lt;/code&gt;&#xA;the plot is &lt;img src=&quot;https://i.stack.imgur.com/wpLYl.png&quot; alt=&quot;here&quot;&gt;&#xA;What is the name of this plot, is it a frequency response or impulse response or some thing else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and how to distinguish it from other curves names.&lt;/p&gt;&#xA;" OwnerUserId="15851" LastActivityDate="2015-05-18T14:06:44.003" Title="what is the name of this curve" Tags="|frequency-response|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23464" PostTypeId="2" ParentId="23458" CreationDate="2015-05-17T18:25:09.400" Score="2" Body="&lt;p&gt;Actually there are classes of musical instruments whose members will have similar sounds such as the string-class of violin, viola, cello or the class of woodwind instruments with flute,picolo,pan flute etc. or sets of drums or the class of percussions including a grand piano, stage piano, console piano etc... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So its clear that each class has a very distinctive sound as an average person can easily classify them while within a given class it is more difficult for an average person to identify every member (but a person with a musical ear will be able to distinguish almost every type of instrument from each other, thats one of the primary differences between a musically able person from a not so one)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming to what makes all those instruments (both the classes and members)  sound different from each other is their physical structure and vibration mechanisms. These are specific to almost every class and to each member based on their material, geometry and driving mechanisms so that the resulting acoustical waves will have specific harmonic characteristics for each instrument (indeed this is true for any object of the nature) which will lead to distinguishable timbre / tone differences by humans.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming to the ability of simulating the acoustical charactheristics of an instrument by another one. There are already electronic analog/digital synthesizers which can mimic many of the instruments to some degree. There are also more sophisticated acoustical modeling programs which offer the complete re-creation of the acoustical properties of any imaginable or existing object/instrument. I'm not experienced in their results so you can look further.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-05-17T18:42:31.123" LastActivityDate="2015-05-17T18:42:31.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23465" PostTypeId="1" AcceptedAnswerId="23467" CreationDate="2015-05-17T19:24:12.900" Score="-2" ViewCount="228" Body="&lt;p&gt;I have 1 monitor with VGA input only, 1 computer with only an HDMI output, and 1 computer with a VGA and HDMI socket.&#xA;I also have a VGA cable and HDMI cable. &#xA;So my main question is:&#xA;&lt;strong&gt;Could I use some sort of software to convert HDMI input from another computer into VGA output?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any feedback is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="15865" LastActivityDate="2015-05-17T19:47:11.727" Title="How to convert HDMI to VGA through a computer using software?" Tags="|video|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23466" PostTypeId="1" AcceptedAnswerId="23474" CreationDate="2015-05-17T19:29:27.817" Score="8" ViewCount="11312" Body="&lt;p&gt;I’d like to use my Raspberry Pi to record when and how often my dog barks. But for privacy reasons, I don’t simply want to record the loudness in the room, so I have to automatically detect barks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I do that?&lt;/p&gt;&#xA;" OwnerUserId="15866" LastEditorUserId="8202" LastEditDate="2017-11-14T15:10:11.440" LastActivityDate="2020-03-12T22:41:02.250" Title="Detect dog barks" Tags="|sound-recognition|" AnswerCount="5" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23467" PostTypeId="2" ParentId="23465" CreationDate="2015-05-17T19:47:11.727" Score="0" Body="&lt;p&gt;Eventhough this question does not seem to fit into this site, a possible answer is this: Computers with basic configurations (ones with only a standard graphics card or an on board gpu chip) by default do not have HDMI or VGA inputs but only outputs. So you need to use a capture card for the purpose of inputting any streaming HDMI video into your computer. Now if you have the mentioned input card installed in your computer system then you will probably be able to output (via its graphic card) the input as VGA into your VGA able monitor, at least in principle. You should look for practical realities for any successful application of this principle however.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-05-17T19:47:11.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23468" PostTypeId="1" CreationDate="2015-05-17T20:46:55.833" Score="0" ViewCount="658" Body="&lt;p&gt;i'm trying to understand the fir1 filter but i still don't get it. For example here i got an audio signal that i consider noise, i'm passing it through a low pass filter. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 100000&#xA;fs = 11025&#xA;handles.noise = wavrecord(n, fs, 'double');&#xA;nfilt = fir1(11,0.4); &#xA;fnoise = filter(nfilt,1,handles.noise); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why did i need to pass the noise signal to a low pass filter in the first place? and why is the number of coefficients 11? also the 0.4 shouldn't it be a range of values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know these are a lot of questions but when i get to understand them, ill be grateful to everyones help.&lt;/p&gt;&#xA;" OwnerUserId="15868" LastActivityDate="2015-05-17T21:17:19.970" Title="FIR Filter matlab command" Tags="|matlab|noise|lowpass-filter|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23469" PostTypeId="2" ParentId="23468" CreationDate="2015-05-17T21:16:51.233" Score="0" Body="&lt;p&gt;The signal is lowpassed before LMS to make the adaptation portion easier, as it will be less likely to converge on a minima with high frequencies. The order 11 achieves particular rolloff. Increasing the order will create a steeper rolloff following the cutoff frequency. There is no issue with instability as FIRs do not have poles.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-17T21:16:51.233" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23470" PostTypeId="2" ParentId="23468" CreationDate="2015-05-17T21:17:19.970" Score="1" Body="&lt;p&gt;Matlab FIR-1 command designs FIR filters with at least two given parameters. P1: The order of the filter, P2: cutoff frequency, assuming a default lowpass filter. Order of the filter N determines a number of properties of the resulting filter such as its comptational complexity, transition bandwidth, passband and stop band ripples. In general large N gives better (closer to ideal) frequency response but worse computational load. Also order of filter being even or odd will have effect on zero-locations being at Nyquist frequency which might be important for some applications with high/low pass filters...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second parameter, cutoff frequency, is basicaly determined by the application. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-05-17T21:17:19.970" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23471" PostTypeId="2" ParentId="23458" CreationDate="2015-05-17T23:36:51.473" Score="2" Body="&lt;p&gt;Instruments sound different because they produce completely different sounds (waveforms, acoustic fields) even when playing what some human brains (not all) interprets as the same (in Western 12-semitone equal-temperament) &quot;note&quot; or pitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether anything sounds the same or different is probably dependent on psycho-acoustics and other stuff going on inside the human ear and brain, possibly dependent on anatomy, culture, upbringing, training, situation, and even mood (how hard is the human concentrating on the sound).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. people raised in certain parts of China and Africa (even Hungary) will hear huge differences between vowels and consonants that I can't notice at all (without a lot more linguistics or foreign language training). Same with music.  A symphony conductor will hear mistakes that 99% of the audience won't.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-05-17T23:44:37.713" LastActivityDate="2015-05-17T23:44:37.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23472" PostTypeId="2" ParentId="23463" CreationDate="2015-05-18T01:35:23.233" Score="1" Body="&lt;p&gt;It is called a cardioid pattern. (cardioid because it looks vaguely heart-shaped)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You've shown us a polar frequency magnitude plot with the frequency given in radians. You'll notice by going counter-clockwise around the unit circle that low frequencies are attenuated while the higher frequencies are passed through.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-05-18T14:06:44.003" LastActivityDate="2015-05-18T14:06:44.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23474" PostTypeId="2" ParentId="23466" CreationDate="2015-05-18T02:59:39.273" Score="3" Body="&lt;p&gt;Interesting question.  Take a look at: &lt;a href=&quot;http://www.dsprelated.com/showthread/comp.dsp/129392-1.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showthread/comp.dsp/129392-1.php&lt;/a&gt;  And keep in mind that there are commercial products out there to identify barking and emit ultrasound when a dog barks, such as: &lt;a href=&quot;http://www.ultimatebarkcontrol.com/dog-silencer.htm#tabContent&quot; rel=&quot;nofollow&quot;&gt;http://www.ultimatebarkcontrol.com/dog-silencer.htm#tabContent&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how complicated you'd want to make things (ie: detect just your dog barking, other dogs barking, detect a single bark, mutiple barks, etc.).  Or, as mentioned by Moti, what kind of probability of detection (PD) or false alarm rate (PFAR) you'd like to achieve.  I suppose the simplest approach would be to record several single barks from your dog, then set your phone to listening, and process the incoming signal.  If the loudness level exceeds a certain threshold, and the time length seems appropriate, you'd suspect that it's a bark, and either cross correlate the suspected bark with your previous recordings, or compute the coherence function to determine the similarity of the incoming signal with the previous recordings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maximizing correct detections and minimizing false alarms may be difficult with a simple system, though.  I don't know how sophisticated the commercial systems get, but you may want to look into them and see if you can garner any hints/suggestions.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2015-05-18T02:59:39.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23476" PostTypeId="1" CreationDate="2015-05-18T05:23:47.910" Score="3" ViewCount="435" Body="&lt;p&gt;In &lt;a href=&quot;https://dsp.stackexchange.com/questions/23416/which-anti-aliasing-filter-algorithm-for-efficient-audio-resampling/23420?noredirect=1#comment43059_23420&quot;&gt;another question on dsp.stackexchange&lt;/a&gt;, a statement was made that the output of MATLAB firpm() or firls() for an anti-alias low-pass filter was &quot;close&quot; to the coefficients of a windowed-Sinc low-pass filter.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What window (applied to a Sinc &quot;perfect&quot; reconstruction waveform) would provide low-filter kernel coefficients closest (In least squared error or other commonly used metric) to those of a same-length FIR filter designed by the Parks–McClellan or Remez-exchange methods?  Is it one of the well-known named window functions (Nuttall et.al.)?  Or is there a good numerical or tractable equation approximation to this window?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-05-19T19:03:37.387" Title="What windowed Sinc might be closest to a Parks–McClellan low-pass filter?" Tags="|matlab|filter-design|window-functions|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23477" PostTypeId="1" CreationDate="2015-05-18T07:58:37.533" Score="1" ViewCount="1049" Body="&lt;p&gt;All em radiation propagates spherically and at a far off place a small enough distance, when observed appears like a plane like our experience on the earth.  So I tend to think that whether a wave on an aperture can be considered plane or not depends on how far the aperture is from the origin and how much is the aperture.  So it should be only dependent on the angle made at the centre by the aperture i.e. apertures making more than a certain angle at the centre can be considered spherical, and otherwise can be considered plane.  This is my wrong understanding.    But in radar theory, this is not the criterion for considering plane and far field.  A 2D^2/lambda formula is used.  How is this formula relevant?  How lambda is entering into the formula?    &lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2015-10-15T16:58:06.983" Title="Far field spherical waves plane waves" Tags="|signal-detection|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23478" PostTypeId="1" CreationDate="2015-05-18T11:21:23.857" Score="-2" ViewCount="1695" Body="&lt;p&gt;I had two sound files and did the following to it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[s1, fs1, nbits1] = wavread('s1.wav');&#xA;[s2, fs2, nbits2] = wavread('s2.wav');&#xA;r1 = resample(s1, 22050, fs1);&#xA;r2 = resample(s2, 22050, fs2);&#xA;f1 = fft(r1);&#xA;f2 = fft(r2);&#xA;shift1 = fftshift(f1);&#xA;added = shift1 + f2;&#xA;out = ifft(added);&#xA;wavwrite(out, 22050, 'result.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can only hear the 's2.wav' when I play 'result.wav'.&#xA;Then, I did this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[s1, fs1, nbits1] = wavread('s1.wav');&#xA;[s2, fs2, nbits2] = wavread('s2.wav');&#xA;r1 = resample(s1, 22050, fs1);&#xA;r2 = resample(s2, 22050, fs2);&#xA;f1 = fft(r1);&#xA;f2 = fft(r2);&#xA;shift1 = fftshift(f1);&#xA;added = shift1 + f2;&#xA;shift2 = fftshift(added);&#xA;out = ifft(shift2);&#xA;wavwrite(out, 22050, 'result.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This time, I could only hear the 's1.wav'. It seems strange to me. What is happening? The only thing I understood is that after I apply frequency shift, I get an imaginary part which did not exist before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain me what is happening?&lt;/p&gt;&#xA;" OwnerUserId="15872" LastActivityDate="2015-05-18T20:40:02.823" Title="Effect of frequency shift on a sound signal" Tags="|matlab|sound|frequency-domain|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23479" PostTypeId="2" ParentId="14367" CreationDate="2015-05-18T11:43:03.203" Score="2" Body="&lt;p&gt;Yes. The time delay of real-coefficient linear-phase N-point FIR filter is (N-1)/2 samples. The time delay of complex-coefficient generalized-linear-phase N-point FIR filter is also (N-1)/2 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can prove this to yourself.  Design a narrowband linear-phase lowpass FIR filter, and plot its group delay. Then multiply that filter's coefficients by a complex exponential whose frequency is one fourth the sample rate, creating a complex-coefficient filter. Now plot the group delay of the complex filter. Compare the two group delay plots.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-05-18T11:43:03.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23480" PostTypeId="2" ParentId="14652" CreationDate="2015-05-18T12:28:24.497" Score="-1" Body="&lt;p&gt;Image is a matrix.You can see the Jacobian matrix  in linear algebra to understand how the shifting of the Axes occurs&lt;/p&gt;&#xA;" OwnerUserId="15874" LastActivityDate="2015-05-18T12:28:24.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23481" PostTypeId="1" CreationDate="2015-05-18T13:42:59.850" Score="1" ViewCount="1250" Body="&lt;p&gt;I am unable to find out a formula for the BER for the OQPSK Modulation. Currently, I am using the berawgn function from Matlab to calculate the BER for OQPSK but I am looking for an expression for this BER. Pointers to any references would be appreciated&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-05-18T13:42:59.850" Title="BER of OQPSK Modulation" Tags="|matlab|modulation|dsp-core|" AnswerCount="0" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23482" PostTypeId="2" ParentId="23477" CreationDate="2015-05-18T13:46:01.297" Score="1" Body="&lt;p&gt;Rajeev Bansal in the appendix to &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.186.2571&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; explains the &lt;span class=&quot;math-container&quot;&gt;$2D/\lambda$&lt;/span&gt; rule:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How does one arrive at the various criteria for the far-field zone?&#xA;Basically, the criteria are guidelines to the boundaries where the&#xA;fields start to approximate the “ideal” assumed characteristics. First&#xA;of all, only the radiation (&lt;span class=&quot;math-container&quot;&gt;$1/r$&lt;/span&gt;) terms remain significant; higher&#xA;order terms fade away. Second, in the far-field zone, the angular&#xA;field distribution becomes independent of the distance [5]. Third,&#xA;only transverse field components remain, and the ratio of the electric&#xA;and magnetic field components approaches the free-space impedance, 377&#xA;ohms [6 ,7]. Finally, for a receiving antenna, the incoming wave-front&#xA;is nearly planar across the aperture. In fact, the &lt;span class=&quot;math-container&quot;&gt;$r = 2 D^2/\lambda$&lt;/span&gt;&#xA;formula corresponds to a phase error (due to the curvature of the&#xA;actual spherical wave-front) of no more than &lt;span class=&quot;math-container&quot;&gt;$\pm 22.5$&lt;/span&gt; degrees across the&#xA;aperture, as compared with the ideal plane wave-front [6, 8].&lt;/p&gt;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;IEEE Standard Dictionary of Electrical and Electronics Terms, IEEE standard 100-1984, 1984.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;C. Paul, K. Whites, and S. Nasar, Introduction to Electromagnetic Fields, 3rd ed., McGraw-Hill, 1998.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Reference Data for Radio Engineers, 6th ed., SAMS, 1981.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;G. Smith, An Introduction to Classical Electromagnetic Radiation, Cambridge, 1997.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="12119" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-05-18T13:46:01.297" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23483" PostTypeId="2" ParentId="23458" CreationDate="2015-05-18T14:20:56.850" Score="2" Body="&lt;p&gt;The quality you are looking for is called &quot;Timbre&quot;. When each instrument plays a note it generates not only the fundamental frequency but a series of harmonics or overtones. The relationship in amplitude of all the overtones creates the instrument's tonal colour. So if a trumpet plays a C note it will generate the fundamental C, as well as a specific set of harmonics at specific amplitudes. Other trumpets will generate a similar set of harmonics, but at slightly different amplitudes - but close enough that it will sound like a trumpet. A guitar playing a C note generates the fundamental - the harmonics are the same - but the amplitudes of the harmonics will be quite different from the trumpet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See  &lt;a href=&quot;http://en.wikipedia.org/wiki/Timbre&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Timbre&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-05-18T14:20:56.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23485" PostTypeId="2" ParentId="17868" CreationDate="2015-05-18T17:26:33.750" Score="1" Body="&lt;p&gt;When brakes are applied, the acceleration along the direction of motion will reverse sign. For example, if you position your phone such that the z-axis of the accelerator is in the direction of gravity axis(i.e. facing earth), then the acceleration along z-axis is -g. One the other hand if the negative z-axis is aligned with g, then z-axis of accelerometer measures +g. This is analogous to the scenario of a car accelerating and braking, although magnitude of deceleration is a little lower than acceleration. You can start by defining the reference axis as the g-axis and defining the other 2 axes based on direction of least and maximum acceleration, using a rotation matrix. You basically change the reference axis from x,y,z co-ordinates which is based on orientation of the phone to an stationary g,a,s reference system (where g is gravity axis, a is direction of maximum acceleration and s stationary axis). You can also use a gyroscope to achieve this axis rotation as discussed in &lt;a href=&quot;http://www.chrobotics.com/library/accel-position-velocity&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; page. One you are able to view to the accelerometer daya in the transformed axes, you can easily classify regions of acceleration and deceleration based on signal from just one axis regardless of the orientation of the phone by looking for zero crossings.  &lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-05-18T17:26:33.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23487" PostTypeId="2" ParentId="23478" CreationDate="2015-05-18T17:46:09.597" Score="0" Body="&lt;p&gt;The &lt;code&gt;fft&lt;/code&gt; function in matlab returns spectrum in the frequency range &lt;code&gt;0:Fs&lt;/code&gt;, most DSP engineers (and a lot of DSP tools) look at the FFT from &lt;code&gt;-Fs/2&lt;/code&gt; up to &lt;code&gt;Fs/2&lt;/code&gt;.&#xA;The &lt;code&gt;fftshift&lt;/code&gt; function shifts the output from the fft into a symmetric form to put it into the latter form. It is often used for plotting the spectrum of a signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some sample code is shown below&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[s1 ,fs, xx] = wavread('./sound_files/cindy.wav');&#xA;lenfft = 1024;&#xA;&#xA;fft1 = fft(s1,lenfft);&#xA;freq1 = [0:lenfft-1].*(fs/lenfft);&#xA;fft2 = fftshift(fft1);&#xA;freq2 = ceil(-(lenfft-1)/2:1:(lenfft-1)/2).*(fs/lenfft);&#xA;&#xA;&#xA;figure, &#xA;subplot(2,1,1)&#xA;plot(freq1,abs(fft1))&#xA;title(['&quot;stock&quot; |FFT| F_s=' num2str(fs)])&#xA;&#xA;subplot(2,1,2)&#xA;plot(freq2,abs(fft2))&#xA;title('&quot;shifted&quot; by fftshift |FFT|')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This produces the following output:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/jmYGR.png&quot; alt=&quot;example of shifting fft by fftshift.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top plot show the spectrum with the low-frequency components at the bottom  and the top of the spectrum.  The lower plot has been &lt;code&gt;fftshift&lt;/code&gt;ed to put the low-frequency portions together in the middle of the plot.&#xA;Explication on this phenomena can be found &lt;a href=&quot;http://en.wikipedia.org/wiki/Aliasing#Folding&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what you are experiencing is that when you &lt;code&gt;fftshift&lt;/code&gt; one of the signals (say &lt;code&gt;s1&lt;/code&gt;) and then combine it with the other, you have then taken the low frequency portions and moved them to the high frequency part of the spectrum.  So you resultant frequency spectrum will have the untouched signal of &lt;code&gt;s2&lt;/code&gt; and then &lt;code&gt;s1&lt;/code&gt; signal superimposed in the highest frequencies.  &lt;/p&gt;&#xA;" OwnerUserId="15841" LastEditorUserId="7092" LastEditDate="2015-05-18T20:40:02.823" LastActivityDate="2015-05-18T20:40:02.823" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23489" PostTypeId="1" AcceptedAnswerId="23490" CreationDate="2015-05-18T18:21:34.813" Score="1" ViewCount="682" Body="&lt;p&gt;I have 5 'negative peaking' biquads that will change center frequency while maintaining a constant Q and A (amplitude reduction) on a realtime microcontroller (ARM cortex-m4) with a codec over i2s controlled by i2c system operating at 96kHz. I am concerned (with concerns raised by my oscilloscope) that I am going to be hosed by divisions and sine/cosine. What can I do to speed things up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using RBJ's EQ cookbook, a peak filter takes the following coefficients:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w0 = 2*pi*f0/Fs;&#xA;A  = sqrt(10^(dBgain/40));&#xA;alpha = (sin(w0)/(2*Q));&#xA;&#xA;b0 =   1 + alpha*A;&#xA;b1 =  -2*cos(w0);&#xA;b2 =   1 - alpha*A;&#xA;a0 =   1 + alpha/A;&#xA;a1 =  -2*cos(w0);&#xA;a2 =   1 - alpha/A;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the feedback coefficients will take the form &#xA;    c0 = b0/a0&#xA;    c1 = b1/a0&#xA;    c2 = b2/a0&#xA;and the feedforward coefficients:&#xA;    c3 = a1 / a0;&#xA;    c4 = a2 / a0;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expanding these divisions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c0 = (1 + (sin(w0)/(2*Q))*A)/(1 + (sin(w0)/(2*Q))/A);&#xA;c1 = -2*cos(w0) /  (1 + sin(w0)/(2*Q)/A);&#xA;c2 =  (1 - (sin(w0)/(2*Q))*A)/(1 + (sin(w0)/(2*Q))/A);&#xA;c3 = c1;&#xA;c4 = (1 - (sin(w0)/(2*Q))/A) / (1 + (sin(w0)/(2*Q))/A);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using simplify() in MATLAB with symbolic variables w0, Q, and A, we obtain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c0 = (2AQ + A^2*sin(w0))/(2AQ+sin(w0))&#xA;c1 = -(4AQ*cos(w0))/(sin(w0) + 2AQ)&#xA;c2 = -(A^2*sin(w0) - 2AQ)/(2AQ + sin(w0));&#xA;c3 = c1;&#xA;c4 =  -(sin(w0)- 2AQ)/(2AQ + sin(w0)); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If Q and A are constant, no problem, these can be computed ahead of time. What will kill me are the divisions and the sine/cosine computations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What tricks or processes can be used to speed up the calculation or if at all, further simplify or approximate the filter coefficients? &lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-18T20:01:35.117" Title="Tricks for computing rapidly changing biquad coefficients" Tags="|infinite-impulse-response|biquad|arm|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23490" PostTypeId="2" ParentId="23489" CreationDate="2015-05-18T20:01:35.117" Score="3" Body="&lt;p&gt;there is an &lt;a href=&quot;https://dsp.stackexchange.com/questions/20444/books-resources-for-implementing-various-mathematical-functions-in-fixed-point-a/20482#20482&quot;&gt;earlier answer&lt;/a&gt; regarding how to more cheaply evaluate functions like &lt;code&gt;sin()&lt;/code&gt; and &lt;code&gt;log()&lt;/code&gt; and such.  they're approximations, but very good ones.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-05-18T20:01:35.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23491" PostTypeId="2" ParentId="23389" CreationDate="2015-05-18T21:39:12.087" Score="0" Body="&lt;p&gt;try changing the number of samples from t = 0: Ts: 3;&#xA;to &#xA;t = 0: Ts: 3-Ts;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you then have a frequency resolution of 1/3 (8000/24000), which is divisible by all the chosen frequencies in your sinusoidal signal. Also does it need to be in dB ? (is abs(fft(x)) enough). some values after fft will be very small (virtually zero), but will ruin your plot if plotting log. you can round to remove the very small values, then log plot.       &lt;/p&gt;&#xA;" OwnerUserId="8489" LastEditorUserId="8489" LastEditDate="2015-05-18T22:25:31.067" LastActivityDate="2015-05-18T22:25:31.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23492" PostTypeId="1" CreationDate="2015-05-18T21:41:22.107" Score="0" ViewCount="906" Body="&lt;p&gt;How to show the time history of a signal down-sampled under the rates of 25Hz &amp;amp; 40Hz and find its DFT analysis using Matlab ? The sample signal is in a data file (&lt;a href=&quot;http://www.filedropper.com/sensordata&quot; rel=&quot;nofollow&quot;&gt;sensor_data.mat&lt;/a&gt;) its sampling rate is 1000Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get the time history and the DFT analysis of the signal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000; % sampling rate&#xA;T=1/Fs; % sample time&#xA;L= 20000; % lenght of signal&#xA;t=(0:L-1)*T; % time vector&#xA;figure(1)&#xA;plot(t,u)&#xA;grid;&#xA;title('Time History of the Signal')&#xA;% dft analysis&#xA;yf=fft(u);&#xA;w=[0:2*pi/L:(L-1)*2*pi/L];&#xA;figure(2)&#xA;plot(w/(2*pi*T),abs(yf))&#xA;grid&#xA;title('DFT analysis of the signal sampled at 1000Hz')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how do I down-sample it ? I know Matlab has a function for it (downsample), but I'm not getting any correct answers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also how do I find the signals frequency range and amplitude over its frequency range from the DFT analysis ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, Please help !! &lt;/p&gt;&#xA;" OwnerUserId="15881" LastActivityDate="2015-05-18T21:41:22.107" Title="How to show the time history of a signal down-sampled ? under the rate of 25Hz &amp; 40Hz and find its DFT analysis?" Tags="|matlab|frequency|dft|downsampling|amplitude|" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="23495" PostTypeId="2" ParentId="18765" CreationDate="2015-05-19T11:18:52.000" Score="1" Body="&lt;p&gt;The build environment for PAMGuard is described on the pamguard.org website at &lt;a href=&quot;http://www.pamguard.org/15_SourceCode.html&quot; rel=&quot;nofollow&quot;&gt;http://www.pamguard.org/15_SourceCode.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11574" LastActivityDate="2015-05-19T11:18:52.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23497" PostTypeId="1" CreationDate="2015-05-19T12:18:58.807" Score="1" ViewCount="729" Body="&lt;p&gt;I have a doubt about something. GMSK Modulated signal is equal to I+Q (with I = cos and Q = sin) or I+i.*Q ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards.&lt;/p&gt;&#xA;" OwnerUserId="15738" LastActivityDate="2019-02-21T16:59:13.990" Title="Modulation GMSK with I/Q" Tags="|digital-communications|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23498" PostTypeId="2" ParentId="23497" CreationDate="2015-05-19T13:27:04.613" Score="1" Body="&lt;p&gt;I'm not sure exactly what you're asking, but IQ modulation is typically modeled using a complex signal model. In that model, the I (in-phase) component is taken to be the real part of the signal and the Q (quadrature) component is the imaginary part. So, the signal would be written something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = x_I(t) + jx_Q(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_I(t)$ and $x_Q(t)$ are the I and Q components, respectively.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-05-19T13:27:04.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23499" PostTypeId="1" AcceptedAnswerId="23503" CreationDate="2015-05-19T13:40:26.290" Score="1" ViewCount="799" Body="&lt;p&gt;In my understanding, I let make a example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example,  you can see in the following picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, We want to find  ^sigma. and We have already known the observation data(which is random data such as C) and bin(0.3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To know &quot;the estimated standard deviation ^sigma&quot;, First of all, &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find Likelihood for each bins with observed data( for example, data of C).&lt;/li&gt;&#xA;&lt;li&gt;Find Maximum Likelihood among previous Likelihood values(from 1).&lt;/li&gt;&#xA;&lt;li&gt;the Maximum Likelihood is &quot;the estimated standard deviation ^sigma&quot;.  Am I wrong?&#xA;In other words, the Maximum Likelihood (^sigma) represent all bins's Likelihood values.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0DraX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="128" LastEditDate="2020-03-14T09:07:51.767" LastActivityDate="2020-03-14T09:07:51.767" Title="What Do We Expect Likelihood Function to Be Used For?" Tags="|image-processing|noise|estimation|statistics|maximum-likelihood-estimation|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23500" PostTypeId="2" ParentId="23497" CreationDate="2015-05-19T13:43:08.910" Score="2" Body="&lt;p&gt;As far as I know, FSK-type modulations do not use quadrature. My answer below is about quadrature, not about a specific modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways to look at quadrature (I and Q) modulation: baseband, and bandpass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In baseband, the signal is complex. You have two independent signals, each modulated using PAM, $s_I(t)$ and $s_Q(t)$. The quadrature signal is $$s_{BB}(t)=s_I(t)+js_Q(t).$$ Naturally, this signal can't physically exist. To transmit it, you need to upconvert $s_{BB}(t)$ to some carrier frequency $f_c(t)$. It becomes a bandpass signal: $$\begin{align} s(t)&amp;amp;=\Re(s_{BB}(t)e^{j2\pi f_ct})\\ &amp;amp;=s_I(t)\cos(2\pi f_ct)-s_Q(t)\sin(2\pi f_ct). \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both signals carry the same information and are equivalent in many ways. $s_{BB}(t)$ is useful to simulate and analyze the system, because it does not have a carrier frequency. $s(t)$ is the signal that is actually, physically transmitted.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-19T13:43:08.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23501" PostTypeId="2" ParentId="23497" CreationDate="2015-05-19T13:43:58.360" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hIFWZ.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hIFWZ.gif&quot; alt=&quot;hello&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&#xA;&lt;sub&gt;(source: &lt;a href=&quot;http://www.radio-electronics.com/info/rf-technology-design/pm-phase-modulation/GMSK-modulator-02.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;radio-electronics.com&lt;/a&gt;)&lt;/sub&gt;&lt;/p&gt;&#xA;&lt;p&gt;The two signals just before the summation forms the quadrature(Q) and inphase(I) components. Hence it should be added.&lt;/p&gt;&#xA;" OwnerUserId="11819" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-02-21T16:59:13.990" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23502" PostTypeId="1" CreationDate="2015-05-19T13:50:30.413" Score="2" ViewCount="632" Body="&lt;p&gt;I'm working on a object tracker based on KLT algorithm using matlab.&#xA;Can anybody guide me how I can find the features and calculate the distance in the sequence of the frames?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="11235" LastEditorUserId="53" LastEditDate="2015-05-19T18:49:33.643" LastActivityDate="2015-05-19T18:49:33.643" Title="KLT tracker implementation" Tags="|image-processing|matlab|object-recognition|matlab-cvst|visual-tracking|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23503" PostTypeId="2" ParentId="23499" CreationDate="2015-05-19T14:10:40.517" Score="2" Body="&lt;p&gt;Normally you start with a probabilistic model of your data (observations). That model includes a noise term which has some variance or standard deviation which can vary over time or can be fixed. Then you write up the joint pdf of the data, normally written something like this $p(\boldsymbol{x}|\theta)$, where $\theta$ is a vector that includes all the parameters in the model including the noise variance. Then in likelihood estimation the pdf is viewed as a function of $\theta$ (data is fixed). The parameter vector that maximizes this function is the most likely parameter vector in the sense that it maximizes the probability that the model has generated the data. What your plots seem to indicate is that the underlying estimator is biased which means that the expected estimate is not the true value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ML estimator is a function. It takes as input your data $\boldsymbol{x}$ and provides a value (the estimate) $\hat{\theta}$. Your data is random, it is governed by a pdf. Because you plug random data into your estimator your estimate will also be a random variable governed by some pdf. I think this is what is illustrated in those images. Those plots illustrate the pdf of the estimate. It is then of course interesting to know if the expected value (the mean) of the estimate then is equal to the true value.&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2015-05-20T09:09:26.307" LastActivityDate="2015-05-20T09:09:26.307" CommentCount="19" ContentLicense="CC BY-SA 3.0" />
  <row Id="23504" PostTypeId="2" ParentId="23411" CreationDate="2015-05-19T14:59:42.790" Score="0" Body="&lt;p&gt;Based on your information a packet length is about 77.2 millisecond. With 3918 bps, each packet contains about 302 bits. Frequency is shifting about every 0.255 millisecond. you get about 256 samples per bit, so 128 point FFT seems to be correct. I assume you have a real signal, so you need to evaluate only 64 bins. If you are synchronized properly, each two consecutive FFTs will provide you with one frequency, switching at the other. If you are not synchronized with the start of the first bit, only every other bin will provide you with a nice single frequency (assuming that you do not have noise and spurious signals)&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-05-19T14:59:42.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23505" PostTypeId="1" AcceptedAnswerId="23507" CreationDate="2015-05-19T15:04:16.083" Score="0" ViewCount="21" Body="&lt;p&gt;If we plot for example the relation between the probability of False Alarm (pfa) and the threshold. The threshold is in x-axix, while the $log _{10}(pfa)$ in y-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I get for example the following plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gV0Bc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is better? the green one or the yellow one? &#xA;Thank you if you can give me some explanations.&lt;/p&gt;&#xA;" OwnerUserId="6925" LastActivityDate="2015-05-19T15:18:52.150" Title="Result of a specfic plot" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23507" PostTypeId="2" ParentId="23505" CreationDate="2015-05-19T15:18:52.150" Score="1" Body="&lt;p&gt;Just read the graph carefully. With a low value threshold, you have a very high log probability of false detection. You want to minimize this detection rate. If your goal is to minimize the false alarm rate with a lower threshold, then the yellow curve is preferable. The false alarm rate drops off at a lower threshold in that case, and more rapidly too. Stated another way, you will get fewer false detections over a wider range of thresholds with yellow.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-19T15:18:52.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23508" PostTypeId="2" ParentId="22847" CreationDate="2015-05-19T16:59:11.693" Score="0" Body="&lt;p&gt;Given a set of signals(observation in the ICA/BSS context) with a covariance matrix M, whitening transform is basically a de-correlation transform that converts M into an identity matrix. Whitening ensures all the source signals(or dimensions) are treated equally before the algorithm is run. Centering is nothing but removing the DC offset from the observations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sccn.ucsd.edu/~arno/indexica.html&quot; rel=&quot;nofollow&quot;&gt;This page&lt;/a&gt; gives a good graphical explanation about how the Whitening process and ICA transform the joint distribution of the observations.&lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-05-19T16:59:11.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23509" PostTypeId="1" AcceptedAnswerId="23519" CreationDate="2015-05-19T17:48:32.897" Score="4" ViewCount="2973" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eHtWh.png&quot; alt=&quot;CMA&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CMA is a blind channel equalization algorithm with the details presented above. I am facing 3 difficulties and shall appreciate help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: Does $H$ and the bar over $\bar{y_k}$ represent the Transpose symbol?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: When calculating the gradient, $\Delta J(w) = 2E{({|y_k|}^2 - 1). \Delta(w^Hx_kx_k^Hw)}$, how does the gradient $\Delta(w^Hx_kx_k^Hw)$ becomes $x_kx_k^Hw$ ? Is there a formula ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q3: Equations : The final Equations are given by $w_{k+1}= w_k - \mu x_k({|y_k|}^2-1)y_k^T $ (T = transpose). While doing steepest ascent, we usually take a step in the opposite direction of the gradient. So, the minus should have become positive as according to the logic given in Least Mean Square. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was looking at the Matlab implementation given here &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/39482-blind-channel-equalization/content/lms.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/39482-blind-channel-equalization/content/lms.m&lt;/a&gt;&#xA;The Equations given in this impelemtation from lines 109 -- 113 are different from the ones in theory (excerpt above). The Equations in the implementation are :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i=1:K&#xA;   e(i)=abs(c'*X(:,i))^2-R2;                  % initial error&#xA;   c=c-mu*2*e(i)*X(:,i)*X(:,i)'*c;     % update equalizer co-efficients&#xA;   c(EqD)=1;&#xA;end &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is correct? Can somebody please show the correct version?&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="128" LastEditDate="2019-06-26T08:55:21.737" LastActivityDate="2019-06-26T08:55:21.737" Title="Constant Modulus Algorithm and the Gradient Operation" Tags="|least-squares|adaptive-algorithms|blind-deconvolution|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="23511" PostTypeId="2" ParentId="16394" CreationDate="2015-05-19T18:11:09.523" Score="5" Body="&lt;p&gt;Recently, we have released a baseline filtering and noise removal method that takes into account the sparsity (and the potential asymmetry) of one-dimensional signals. It was initially applied to analytical chemistry data (chromatograms), but could possibly be used of ECG. It relies on a recursive low-pass filter, an asymmetry parameter, and a penalization related to the noise level and the strength of the signal and its derivatives.&lt;/p&gt;&#xA;&lt;p&gt;One illustration for BEADS background removal is:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/2cTYG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2cTYG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The code for &lt;a href=&quot;http://www.laurent-duval.eu/siva-beads-baseline-background-removal-filtering-sparsity.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;BEADS (Baseline Estimation And Denoising with Sparsity)&lt;/a&gt; is available in &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/49974-beads--baseline-estimation-and-denoising-w--sparsity--chromatogram-signals-&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab&lt;/a&gt;, R, C++. It has been used for instance in the following papers:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://doi.org/10.1016/j.bspc.2022.103947&quot; rel=&quot;nofollow noreferrer&quot;&gt;The unsupervised pattern recognition for the ECG signal features detection&lt;/a&gt;, 2022, Biomedical Signal Processing and Control&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://doi.org/10.1016/j.yebeh.2016.02.039&quot; rel=&quot;nofollow noreferrer&quot;&gt;Epileptic seizure onset detection based on EEG and ECG data fusion&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://doi.org/10.1155/2017/8081361&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shannon’s Energy Based Algorithm in ECG Signal Processing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://prucka.com/2017CinC/pdf/069-336.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Detection of Atrial Fibrillation in ECG Hand-held Devices Using a Random Forest Classifier&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://doi.org/10.1109/EUSIPCO.2016.7760608&quot; rel=&quot;nofollow noreferrer&quot;&gt;Combined matching pursuit and Wigner-Ville Distribution analysis for the discrimination of ictal heart rate variability&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://search.proquest.com/openview/cc0e39ff4c2a3c546357073c7bc8ce4f/1?pq-origsite=gscholar&amp;amp;cbl=18750&amp;amp;diss=y&quot; rel=&quot;nofollow noreferrer&quot;&gt;Signal processing using sparse derivatives with applications to chromatograms and ECG&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://doi.org/10.1007/978-981-10-7419-6_43&quot; rel=&quot;nofollow noreferrer&quot;&gt;Training System Methodology Using ECG Signal&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2022-10-03T21:04:05.663" LastActivityDate="2022-10-03T21:04:05.663" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="23512" PostTypeId="2" ParentId="23476" CreationDate="2015-05-19T18:11:29.783" Score="1" Body="&lt;p&gt;none.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what you're asking for is what window, which multiplies a &lt;em&gt;sinc&lt;/em&gt;() function, will get you an optimal impulse response kernel, like you might get from Parks-McClellan.  well, to get that window, you must undo the multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the problem is that you cannot divide by zero.  any of these &lt;em&gt;&quot;sinc-like&quot;&lt;/em&gt; functions that come out of P-McC will pass through 0.  but not necessarily at the same place that the &lt;em&gt;sinc&lt;/em&gt;() function goes through zero.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-05-19T18:11:29.783" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23513" PostTypeId="2" ParentId="23502" CreationDate="2015-05-19T18:49:23.963" Score="-1" Body="&lt;p&gt;Try this &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/face-detection-and-tracking-using-the-klt-algorithm.html&quot; rel=&quot;nofollow&quot;&gt;example of tracking a single face using KLT&lt;/a&gt;.  Try &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/47105-detect-and-track-multiple-faces&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; for tracking multiple faces.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-05-19T18:49:23.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23515" PostTypeId="2" ParentId="20570" CreationDate="2015-05-19T19:11:11.517" Score="0" Body="&lt;p&gt;I would recommend an auto-correlation on your periodogram. You can construct notch or negative peaking filters based on multiples of the fundamental frequency that the correlation yields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code helped me create a good auto-correlation plot (cepstrum is another good method when the harmonics have more power than the fundamental) &#xA;&lt;a href=&quot;http://note.sonots.com/SciSoftware/Pitch.html&quot; rel=&quot;nofollow&quot;&gt;http://note.sonots.com/SciSoftware/Pitch.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-19T19:11:11.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23516" PostTypeId="1" AcceptedAnswerId="23687" CreationDate="2015-05-19T20:27:44.290" Score="1" ViewCount="142" Body="&lt;p&gt;I'm looking for a way to send MIDI from a cheap or free MIDI sequencer to Pure Data or Max MSP so I can do realtime MIDI processing in PD/MAX. So I guess I have a couple questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is a good cheap/free midi sequencer (that runs in Windows 7) that supports MIDI out to another program&lt;/li&gt;&#xA;&lt;li&gt;How do I configure MIDI out?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this something normal midi sequencers can do? It seems like it should be pretty basic, but I was having trouble finding information on it.&lt;/p&gt;&#xA;" OwnerUserId="15893" LastEditorUserId="15893" LastEditDate="2015-05-19T21:54:19.510" LastActivityDate="2015-05-27T00:10:22.153" Title="MIDI out from freeware sequencer to PD or Max/MSP" Tags="|audio|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23517" PostTypeId="2" ParentId="23516" CreationDate="2015-05-19T22:15:40.867" Score="1" Body="&lt;p&gt;Max/MSP has the midiparse object which is incredibly useful for handling midi data. Midi Ox is a program that will help you with routing occasionally. As far as freeware, you get what you pay for. Hydrogen is an open source a drum machine that will send midi out. You'll just to configure Max or Pd to receive the channel you're sending out of your sequencer.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-19T22:15:40.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23518" PostTypeId="2" ParentId="23438" CreationDate="2015-05-20T00:17:17.383" Score="1" Body="&lt;p&gt;The delta argument in the scal2freq MATLAB function is the sampling period that relates to the data sampling frequency (i.e. delta = 1/Fs).  A good description of this function can be found here: &lt;a href=&quot;http://au.mathworks.com/help/wavelet/ref/scal2frq.html&quot; rel=&quot;nofollow&quot;&gt;http://au.mathworks.com/help/wavelet/ref/scal2frq.html&lt;/a&gt; it also includes an example including how to calculate and define the delta argument.  I hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="11857" LastActivityDate="2015-05-20T00:17:17.383" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23519" PostTypeId="2" ParentId="23509" CreationDate="2015-05-20T06:54:50.530" Score="2" Body="&lt;p&gt;As mentioned in the comments, the symbol $^H$ denotes the &lt;a href=&quot;http://en.wikipedia.org/wiki/Conjugate_transpose&quot; rel=&quot;nofollow noreferrer&quot;&gt;conjugate transpose&lt;/a&gt; of a matrix or vector, which means that the vector/matrix is transposed and that all of its elements are conjugated. The bar over $y_k$ means complex conjugate (note that $y_k$ is a scalar, not a vector or matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When computing the gradient with respect to a complex variable in order to maximize or minimize a function, there's a trick which is explained in more detail in &lt;a href=&quot;https://math.stackexchange.com/questions/393921/derivative-of-conjugate-transpose-of-matrix/393946#393946&quot;&gt;this answer&lt;/a&gt;. You basically take the derivative with respect to the conjugated variable and regard the non-conjugated variable as a constant. So when computing the gradient of the expression $\mathbf{w}^H\mathbf{x}\mathbf{x}^H\mathbf{w}$, you formally take the derivative w.r.t. $\mathbf{w}^H$, regarding $\mathbf{x}\mathbf{x}^H\mathbf{w}$ as constant, which yields the given result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your third question, you should realize what you actually want to do. You want to &lt;em&gt;minimize&lt;/em&gt; the error function, so you do not want to use a steepest &lt;em&gt;ascent&lt;/em&gt; but a steepest &lt;em&gt;descent&lt;/em&gt; algorithm, moving in the direction of the &lt;em&gt;negative&lt;/em&gt; gradient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the Matlab code does in fact implement the equations you stated (replacing the modulus by the variable &lt;code&gt;R2&lt;/code&gt;, which is equal to $1$ in your equations). Just use the error $e_k=|y_k|^2-1$ and the expression $y_k=\mathbf{w}^{(k)H}\mathbf{x}_k$ in your update equation, and you'll see it.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-05-20T07:45:49.670" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23520" PostTypeId="1" AcceptedAnswerId="23523" CreationDate="2015-05-20T07:24:58.210" Score="0" ViewCount="77" Body="&lt;p&gt;I'm trying to review MLE (maximum likelihood estimation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does it mean when one model fit the data better than does a comptitor model?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastActivityDate="2015-05-20T10:10:27.383" Title="What does it mean when one model fit the data better than does a comptitor model?" Tags="|estimation|statistics|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23522" PostTypeId="1" AcceptedAnswerId="23530" CreationDate="2015-05-20T08:21:13.703" Score="0" ViewCount="71" Body="&lt;p&gt;The OQPSK modulator in Matlab produces an output sequence as follows: &#xA;[0.707&#xA;0.707+0.707i&#xA;-0.707-0.707i&#xA;...and so on&#xA;] &#xA;This is the sequence and I am trying to view the frequency spectrum of this sequence. With the sampling rate being 2 MHz, I expect to see a peak centered at 0 with a bandwidth of 2 MHz. When I upsample the above sequence and multiply this sequence with a carrier of say 2.4 GHz, I should have 2 peaks centered at -2.4 GHz and 2.4 GHz and zeros at other frequencies. But somehow, the spectrum is distributed between -2.4 and 2.4 GHz. Am I making a mistake in plotting the frequency spectrum or is there something wrong in what I understood?&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-05-20T14:44:33.447" Title="Frequency Spectrum of a sequence" Tags="|discrete-signals|signal-analysis|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23523" PostTypeId="2" ParentId="23520" CreationDate="2015-05-20T10:10:27.383" Score="1" Body="&lt;p&gt;You need a criteria for saying whats better (i.e. a risk function). You say estimator A is better than estimator B with respect to a given risk function if the risk of estimator A is better than estimator B. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of estimation, the risk is often the mean square error, i.e. if $\hat{X}$ is your estimator and $X$ is the thing you're trying to estimate, $R(\hat{X}) = E[\lVert X - \hat{X} \rVert_2^2]$ where $\lVert \cdot \rVert_2$ is the 2-norm. Then, you say estimator A is better than estimator B if it has lower mean square error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When working in the mean square error framework for deterministic parameters, you have the notion of efficient estimators, i.e. ones which meet the &lt;a href=&quot;http://en.wikipedia.org/wiki/Cram%C3%A9r%E2%80%93Rao_bound&quot; rel=&quot;nofollow&quot;&gt;Cramer-Rao lower bound&lt;/a&gt;, which are the best you can do in some sense (as described on the wiki article). &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-05-20T10:10:27.383" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23524" PostTypeId="1" CreationDate="2015-05-20T10:24:25.543" Score="2" ViewCount="136" Body="&lt;p&gt;Zhang et al. proposed the LDPs for face recognition . They considered the LBP as the nondirectional first-order local pattern operator and extended it to higher orders ( th-order) called the LDP.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;is there an intuitive explanation of this definition? i need your help.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11740" LastEditorUserId="128" LastEditDate="2023-07-08T12:25:20.760" LastActivityDate="2023-07-08T12:25:20.760" Title="Intuitive explanation of local derivative pattern (LDP)?" Tags="|image-processing|computer-vision|feature-extraction|local-features|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23525" PostTypeId="1" CreationDate="2015-05-20T10:58:51.917" Score="0" ViewCount="116" Body="&lt;p&gt;I have a signal that contains three distinct images, this means that I have three frequencies or peaks, and each one corresponds to a picture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a function that converts a signal into an image. &#xA;I'm using the low pass, high pass, and band pass filters in Matlab to filter out the frequencies I want. When I use the LP filter, the image I get is clear. &#xA;But when I use both the HP and BP filter, the images I get are not clear/(contain noise?). &#xA;I'm using the &quot;butter&quot; and &quot;filter&quot; functions. I'm not really sure how to clear up the images or if I'm doing the wrong steps. &#xA;What I'm doing is using the filter, then using a tdft function, then I plot that and use the signal-to-image function I have to get the image. I'd appreciate any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal with all three images:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ghCeT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TDFT of image:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ksQoC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First image after lowpass:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/DYXOS.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second image after bandpass:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/tgdXG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15898" LastEditorUserId="10650" LastEditDate="2015-05-20T22:24:20.680" LastActivityDate="2015-05-20T22:24:20.680" Title="I am trying to transform a signal into multiple images but the images are not clear" Tags="|matlab|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23526" PostTypeId="1" AcceptedAnswerId="23527" CreationDate="2015-05-20T13:37:59.567" Score="1" ViewCount="3883" Body="&lt;p&gt;I need to upsample a 2 MHz signal by a factor of 3000 to convert the OQPSK modulated baseband signal to passband. When I upsample by duplicating the elements in the sequence, I seem to get less error compared to padding the sequence with zeros. The frequency spectrum is also better when I duplicate elements whereas with zero padding, the spectrum shows nothing. I am now confused on which way is the right method to upsample a sequence and why.&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-05-20T19:05:36.093" Title="Upsampling by zero padding or duplicating sequence" Tags="|matlab|discrete-signals|signal-analysis|dsp-core|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23527" PostTypeId="2" ParentId="23526" CreationDate="2015-05-20T13:47:30.227" Score="3" Body="&lt;p&gt;:Boggle:&lt;br&gt;&#xA;Neither is correct.  You should interpolate between samples if you need to convert to a higher sampling rate.&lt;br&gt;&#xA;Linear interpolation is easiest, but will cause harmonics to appear in the output.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linear interpolation with a lowpass filter is better.  Use the nyquist frequency for your original signal (before upsampling) as the cutoff for the lowpass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other methods that you can find fairly easily now that you know what you need to look for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know enough about what you are doing to be certain, but I'm pretty sure that upsampling to that extent shouldn't be neccessary unless you are doing something special - like working backwards from a result to compare to some original signal.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-05-20T13:47:30.227" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23528" PostTypeId="2" ParentId="12666" CreationDate="2015-05-20T14:24:56.633" Score="1" Body="&lt;p&gt;For image watermarking, I suggest you not to use wavelet Transform.&#xA;Instead, you can use an efficient technique in terms of robustness and transparency, based on the Quantization Index Modulation (QIM). You can also use a variant of it which is called &quot;Spread Transform Dither Modulation&quot;.&#xA;Good luck&lt;/p&gt;&#xA;" OwnerUserId="6925" LastEditorUserId="17089" LastEditDate="2017-04-10T17:17:22.603" LastActivityDate="2017-04-10T17:17:22.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23529" PostTypeId="1" CreationDate="2015-05-20T14:42:15.717" Score="0" ViewCount="5956" Body="&lt;p&gt;I have a noisy recording with some letters spoken out loud. I've noticed that the noise is easily recognizable when looking at a spectrogram of the audio. Is there anyway to set a power/frequency threshold for the spectrogram, and muting the parts which do not reach that threshold? (The noise doesn't have enough power in higher frequencies, as you can see in the spectrogram)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/PPyrp.png&quot; alt=&quot;Audio spectrogram, plotted using Octave specgram&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15894" LastActivityDate="2015-07-14T02:18:47.603" Title="Noise removal from audio using FFT/Spectral editing" Tags="|matlab|fft|audio|noise|octave|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23530" PostTypeId="2" ParentId="23522" CreationDate="2015-05-20T14:44:33.447" Score="2" Body="&lt;p&gt;You're missing a step: pulse shaping. The sequence [.7+.7i, ...] is a sequence of &lt;em&gt;pulse amplitudes&lt;/em&gt;. As such, it should not be considered to be signal; in consequence, it does not have a spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say your sequence of amplitudes is $A=a_0, a_1, a_2,\ldots$. Now, you need to specify your &lt;em&gt;symbol rate&lt;/em&gt; (how many pulses per second you'll transmit). Call this rate $R_p$ and let $T_p=1/R_p$ be the &lt;em&gt;pulse interval&lt;/em&gt;. Finally, you need to specify a pulse $p(t)$ that has this property: $$\int_{-\infty}^\infty p(t-kT_p)p(t-lT_p)dt=\begin{cases}1,\textrm{ if $k=l$}\\0,\textrm{ if $k\neq l$}\end{cases}$$for $k$ and $l$ integers. Now you're ready to create your actual signal: $$s(t)=\sum_i a_ip(t-iT_p).$$ This signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Has a spectrum; specifically, its bandwidth is the same as the bandwidth of the pulse $p(t)$.&lt;/li&gt;&#xA;&lt;li&gt;Can be up-converted to a carrier frequency.&lt;/li&gt;&#xA;&lt;li&gt;Can be converted to an analog signal and physically transmitted over a medium.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For completeness, I'll explain how to recover the amplitudes $a_i$ from $s(t)$ (ignoring noise for simplicity). The receiver can estimate $a_k$ by doing this operation: $$\hat{a_k}=\int_{-\infty}^\infty s(t)p(t-kTp).$$ You can easily verifty that this is the case, using the properties of $p(t)$. Such an operation can be implemented with a &lt;em&gt;matched filter&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-20T14:44:33.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23534" PostTypeId="1" AcceptedAnswerId="23580" CreationDate="2015-05-20T17:46:18.223" Score="1" ViewCount="251" Body="&lt;p&gt;Say the channel model is an univariate FIR filter with true coefficients $h=[1,a_1, a_2 ]$. I am learning algorithms for system identification and channel equalization. For this, I am implementing programs provided in Matlab. One such Algorithm is Constant Modulus Algorithm for blind channel equalization. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/39482-blind-channel-equalization/content/lms.m&quot; rel=&quot;nofollow&quot;&gt;Code&lt;/a&gt; is the link for the code : lines 80-82 present the variables $L,ChL,EqD$  which denotes the smoothing length, length of the channel &amp;amp; channel equalization delay respectively. I have confusion regarding the terms. Shall appreciate explanation with an example pertaining to my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Smoothing length :&lt;/strong&gt; In text books, $L$ stands for the channel order, which for my model, Moving Average, MA(3), the order then = 3 ( I guess including the 1). FOr Autoregressive model AR(p) $p$ is the model order. I am confused if smoothing length has got anything to do with Kalman Smoother ? What is the difference, if any, between smoothing length and channel order? What will $L$ be for the FIR model that I have?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Length of the Channel, ChL&lt;/strong&gt; = Is this related to number of data samples ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Equalization delay, EqD&lt;/strong&gt; = In general, I was under the impression that the model order is determined by the number of delays. So for MA(q) : $q$ is the number of delays, similarly for AR(p) : $p$ is the number of delays. Then what is Equalization delay? &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;When considering &lt;strong&gt;blind algorithm&lt;/strong&gt;, we assume no knowledge of the process noise that drives the model. But, When we assume that the model order is known, then does it still become blind or non-blind estimation / equalization technique?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Please correct me where wrong.&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="750" LastEditDate="2015-05-20T18:02:48.980" LastActivityDate="2015-05-22T12:13:47.993" Title="Beginner level : Help with terminologies : smooting length, length of channel, channel equalization delay, blind system identification, equalization" Tags="|linear-systems|terminology|adaptive-algorithms|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23535" PostTypeId="1" AcceptedAnswerId="24179" CreationDate="2015-05-20T18:28:57.070" Score="0" ViewCount="122" Body="&lt;p&gt;Suppose I have a real-valued random signal $f(t)$ written as&#xA;$$f(t) = I(t)\cos(\Omega t) - Q(t)\sin(\Omega t)\, .$$&#xA;What is the relationship between the spectral densities of $I$ and $Q$ and the spectral density of $f$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach is to use the fact that&#xA;$$\int_0^\infty \frac{d\Omega}{2\pi} S_f(\Omega) \cos(\Omega \tau)=&#xA;\langle f(t)f(t+\tau)\rangle_t \, .$$&#xA;But so far I haven't understood how to make progress.&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="4298" LastEditDate="2015-06-16T21:36:53.890" LastActivityDate="2015-06-18T08:19:57.107" Title="Spectral density of signal written as quadratures" Tags="|power-spectral-density|quadrature|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23536" PostTypeId="2" ParentId="23526" CreationDate="2015-05-20T19:05:36.093" Score="6" Body="&lt;p&gt;Matlab’s ‘upsample()’ command does not “pad” a sequence with zero-valued samples.  The ‘upsample()’ command “stuffs” a sequence with zero-valued samples.  “Zero padding” and “zero stuffing” are two different operations.  “Zero padding” means appending a sequential string (a sequence) of zero-valued samples to the beginning or end of a sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe what you want to do is: ‘Upsample()” your time-domain sequence to the desired final sample rate that's compatible with your 2.4 GHz carrier sequence.  Next, lowpass filter the upsampled sequence.  Then multiply the filtered sequence by your high-frequency carrier sequence.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-05-20T19:05:36.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23537" PostTypeId="1" AcceptedAnswerId="23538" CreationDate="2015-05-20T19:09:44.773" Score="1" ViewCount="577" Body="&lt;p&gt;I am working on obtaining the vortex shedding frequencies behind a 2D square using CFD. Time-varying data is being extracted from a specific cell behind the square. I've written a little python script which performs FFT analysis on the signal and spits out the dominant peak frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the shedding frequencies are so low (0.1 - 0.2 Hz) I added a zero-padding routine as well as a quadratic interpolator in order to have accuracy to several digits. My background is in fluid mechanics, not signal analysis. So my question is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Would it be more beneficial to simply take my input signal (of say, 200 seconds of data) and repeat it several times (therefore increasing the length of time and subsequently the frequency resolution) or to keep the zero-padding technique?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the former method be much more computationally intensive? FYI, the signal is nearly sinusoidal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15905" LastActivityDate="2016-10-06T08:02:34.777" Title="FFT peak estimation: Zero-padding vs signal repetitioon" Tags="|fft|frequency|zero-padding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23538" PostTypeId="2" ParentId="23537" CreationDate="2015-05-20T19:18:13.870" Score="2" Body="&lt;p&gt;If you repeat your data, you will have discontinuities where the sequence ends meet.  These will cause spurious peaks in your spectrum.  You could apply a window to the data to taper it at the edges, but that would be a fair amount of work, and you'd need to work out a window that doesn't color your spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would just go with zero padding.  It will mess with the amplitude, but that should be fairly easy to deal with (scale by constant factor after FFT.)&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-05-20T19:18:13.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23539" PostTypeId="2" ParentId="51" CreationDate="2015-05-20T19:42:22.667" Score="0" Body="&lt;p&gt;In addition to the comments above about memory, MIPS, noise, and stability; there is another factor that is commonly overlooked.  This factor is reset capability; which happens to be very important in most of my situations.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a Direct Form II implementation, there are no states for the delayed outputs, therefor if you &quot;reset&quot; a Direct Form II filter to say &quot;5&quot;, it's initial output is not going to be 5.  I find this to be quite counter-intuitive which has caused some serious frustration when using Simulink.  For this reason I almost always use a Direct Form I implementation.  Unfortunately Simulink only supports Direct Form I if you have the DSP toolbox, and even then it still doesn't let you set the initial conditions from an input signal.    &lt;/p&gt;&#xA;" OwnerUserId="15906" LastActivityDate="2015-05-20T19:42:22.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23540" PostTypeId="1" AcceptedAnswerId="23600" CreationDate="2015-05-20T20:34:24.027" Score="4" ViewCount="2591" Body="&lt;p&gt;I had asked conceptual Question about &lt;a href=&quot;https://dsp.stackexchange.com/questions/23509/constant-modulus-algorithm-and-the-gradient-operation&quot;&gt;Constant Modulus Algorithm&lt;/a&gt;. I am implementing the simple steps of the algorithm, as I do not have the &lt;code&gt;cma()&lt;/code&gt; built in module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am considering a Finite Impulse Response (FIR) system  whose true coefficients are $h = \begin{bmatrix}1 &amp;amp;0.45 &amp;amp;-0.2\end{bmatrix}$. The algorithm is presented briefly :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u_n$ : Output of the FIR filter that is driven by Input signal, $s$ is a white Gaussian signal that drives an FIR process by the command &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s=round(rand(1,N))*2-1; &#xA;u = filter(h,1,s);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We receive a noisy signal which is the output of the system corrupted by AWGN. Let the noise corrupted signal be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_n = h^T s_n + \eta_n$$&#xA;Constructing an equalizer  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_n = w^T x_n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cost function to be minimized by gradient descent is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$J(w) = E\left[\left(\big\lvert y_n\big\rvert^2 -1\right)^2\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weight update equation is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w_{n+1} = w_n - 2\mu e_n  y_n^T x_n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where error, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e_n = \left(\big\lvert y_n\big\rvert^2 -1\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Operator $T$ is the transpose and assuming real signals without any imaginary and complex parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the code. The algorithm does not give proper result in terms of estimates of the weights. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem 1:&lt;/strong&gt; The Graph for the Mean Square Error (in DB) for the estimated weights returned by the algorithm vs. Signal to Noise Ratio is giving an opposite trend i.e. instead of MSE decreasing with increasing SNR, I am getting the opposite when I re-run the program!! Below is the image of what I mean. The first figure is correct, but with the same code, I ran it again and got the second figure. Why is this &amp;amp; how can I prevent it?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/mTAvm.jpg&quot; alt=&quot;Fig1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6tkzW.jpg&quot; alt=&quot;Fig2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if this is due to the initialization of the variable $L$, filter order = number of delays = 2. Somethings are not straight for me which are for the FIR filter of the form : $u(t) = e(t) + 0.45e(t-1) - 0.2e(t-2)$, what is the filter order, smoothing length and the number of weights unknown to be estimated?&#xA; Can somebody please help so that it works?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   clear all&#xA;clc&#xA;&#xA;N = 256;&#xA;h = [1    0.45   -0.2];&#xA;&#xA;R2 = 2;&#xA;&#xA;mu =  1.0000e-009;&#xA;noisedB  =0;&#xA;&#xA;L=2; % smoothing length L+1&#xA;ChL=1;  % length of the channel= ChL+1&#xA;EqD=round((L+ChL)/2);  %  channel equalization delay&#xA;&#xA;i=sqrt(-1);&#xA;&#xA;Ch=[1 0.45 -0.2]; %Channel&#xA;%Ch=[0.8+i*0.1 .9-i*0.2]; %complex channel&#xA;Ch=Ch/norm(Ch);% normalize&#xA;&#xA;&#xA;skip =1&#xA;for l=1:6&#xA;i          = 1; &#xA;&#xA; TxS=round(rand(1,N))*2-1;  % QPSK symbols are transmitted symbols&#xA;%TxS=TxS+sqrt(-1)*(round(rand(1,N))*2-1);&#xA;x=filter(Ch,1,TxS); %channel distortion&#xA;&#xA;n=randn(1,N);   % additive white gaussian noise&#xA;&#xA;n=n/norm(n)*10^(-noisedB/20)*norm(x);  % scale noise power&#xA;x1=x+n;  % received noisy signal&#xA;&#xA;&#xA;%estimation using CMA&#xA;K=N-L;   %% Discard initial samples for avoiding 0's and negative&#xA;X=zeros(L+1,K);  %each vector&#xA;for j=1:K&#xA;    X(:,j)=x1(j+L:-1:j).';  %y_n = w^T x_n &#xA;end&#xA;&#xA;e=zeros(1,K); &#xA;w=zeros(L+1,1); &#xA;w(EqD)=1;    % initial condition&#xA;while i&amp;lt;=K&#xA;&#xA;&#xA;e(i)=abs(w.'*X(:,i))^2-R2;                  % initial error&#xA;   w=w-mu*2*e(i)*X(:,i)*X(:,i)'*w;  % update equalizer co-efficients&#xA;    cma_mse_h(l,i)    = sum((w'-h).^2)/3; &#xA;    est_w(i,:) = w;&#xA;   w(EqD)= 1;&#xA;&#xA;&#xA;            i = i+1;&#xA;&#xA;&#xA;end&#xA;noisedB = noisedB + 5;&#xA;end &#xA;&#xA;for ii = 1:6&#xA;&#xA; Error(ii) = 10*log10(mean(cma_mse_h(ii,:)));&#xA;end &#xA;&#xA; plot([0:5:25], Error(1:6));&#xA; grid on;&#xA; xlabel ('SNR(dB)')&#xA; ylabel('MSE_h')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second Problem :&lt;/strong&gt; The true FIR channel coefficients are not imaginary and have only real parts. But the estimated weights will have both real &amp;amp; imaginary if I work with real and complex representation. How can I properly calculate the weights &amp;amp; its MSE for this case?&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2017-12-12T23:05:32.953" Title="MATLAB : Proper estimation of weights and how to calculate MSE for QPSK signal for Constant Modulus Algorithm" Tags="|matlab|digital-communications|adaptive-filters|equalization|adaptive-algorithms|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23542" PostTypeId="1" CreationDate="2015-05-20T22:39:39.413" Score="1" ViewCount="861" Body="&lt;p&gt;What effects does have a different input such as impulse, step, sine sweep etc. on performing a system identification?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean what is up/down side, and which one is best, and why chose one rather than the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now I see the sine sweep as the most reliable for determining a system since the other ones doesn't seem to hit nearly all modes of a system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what do you say? I am not an expert at all and I am a bit confused here. &lt;/p&gt;&#xA;" OwnerUserId="15908" LastEditorUserId="8202" LastEditDate="2015-05-21T10:49:41.940" LastActivityDate="2015-12-17T18:27:02.213" Title="Inputs for system identification" Tags="|impulse-response|control-systems|system-identification|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23543" PostTypeId="1" CreationDate="2015-05-21T00:05:00.683" Score="1" ViewCount="2032" Body="&lt;p&gt;As title says, what is the low-pass filter that gives minimal transient response? By minimal transient response, I mean minimal settling time with reference to very tiny amount of divergence of steady-state values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am asking for analog case, but digital case would also be fine.&lt;/p&gt;&#xA;" OwnerUserId="15909" LastActivityDate="2015-05-21T08:41:38.410" Title="What is the low-pass filter that gives minimal transient response?" Tags="|filters|lowpass-filter|control-systems|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23545" PostTypeId="1" CreationDate="2015-05-21T05:29:23.200" Score="0" ViewCount="295" Body="&lt;p&gt;I have implemented beamformer(MVDR/LCMV) for speech enhancement in matlab, now I am trying to convert it to fixed point implementation. during the weight calculation step correlation matrix inversion is required, but in fixed point implementation  correlation matrix inversion is not giving correct results.&#xA;I tried the the standard method math.stackexchange.com/questions/623780/… I am using Q16 format for this(I think this will not work at all as precision will be lost in devision). I have also tried DCD algorithm explained in etheses.whiterose.ac.uk/1629/1/PhD_thesis_Jie_Liu.pdf but not getting the correct result.&lt;/p&gt;&#xA;" OwnerUserId="15911" LastEditorUserId="15911" LastEditDate="2015-05-22T05:41:02.410" LastActivityDate="2015-05-24T18:02:00.790" Title="Which algorithms one can use for matrix inversion (for beamforming application MVDR/LCMV) in Fixed Point?" Tags="|speech-processing|fixed-point|beamforming|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23546" PostTypeId="1" CreationDate="2015-05-21T06:32:14.247" Score="0" ViewCount="55" Body="&lt;p&gt;I have been studying about CRAN and the CPRI links (fronhaul links) and have observed that CPRI links are always either fiber cable or some electrical interface. Why is this needed? Is it related to the latency, bandwidth and cost requirement of the CPRI standard?&#xA;Thanks &lt;/p&gt;&#xA;" OwnerUserId="15789" LastActivityDate="2015-05-21T06:32:14.247" Title="Why can CPRI links not be wireless?" Tags="|digital-communications|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23547" PostTypeId="1" AcceptedAnswerId="23708" CreationDate="2015-05-21T07:56:53.533" Score="3" ViewCount="166" Body="&lt;p&gt;I am programming some sound effects in Java and exporting them into .wav files. Currently, I am trying to program a rocket engine sound effect. I want to do it in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The sound of a rocket engine may be synthesized with a red noise generator controlled by a second red noise generator. The parameter of the first generator modified by the second one is the number of interpolated samples, influencing the spectral content of the generated noise. In order to simulate changes of sound intensity (e.g. during launch) the envelope generator should be used.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering how can it be done, e.g. what does it mean that one signal controls another one. Probably this part is explaining it, but I am not sure what to do now:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The parameter of the first generator modified by the second one is the&#xA;  number of interpolated samples, influencing the spectral content of&#xA;  the generated noise.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is it about this parameter describing how many values from white noise are taken and linearly interpolated while creating the red noise? (see my simple drawing explaining this process below)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4QvrK.png&quot; alt=&quot;Generating red noise from white noise&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a red noise generator, which returns an array of doubles with values between -1 and 1 (it is generated from the white noise as described). What am I supposed to do now? How can I control the second red noise? I guess that it does not mean that I should control the amplitude of the second signal. Does it?  Schema of steps required to obtain the rocket engine sound effect is attached below.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5rBoD.png&quot; alt=&quot;Rocket engine sound effect schema&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15912" LastEditorUserId="13320" LastEditDate="2016-11-21T13:00:52.607" LastActivityDate="2016-11-21T13:00:52.607" Title="Controlling one signal with another one (Rocket engine effect - Subtractive synthesis of sound)" Tags="|audio|sound|signal-synthesis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23548" PostTypeId="1" AcceptedAnswerId="23550" CreationDate="2015-05-21T08:17:01.533" Score="0" ViewCount="1067" Body="&lt;p&gt;I have 2 frequencies in my application: $12000\mathrm{Hz}$, $13000\mathrm{Hz}$.&#xA;I want to set a parallel Goertzel filters and every 100ms I want to take the bigger magnitude for detecting the tone received. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to implement this?  That is, how can I evaluate two functions in parallel in C#?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I work on WPF, C#&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15637" LastEditorUserId="8202" LastEditDate="2015-05-21T10:46:31.110" LastActivityDate="2015-05-21T10:46:31.110" Title="Parallel Goertzel filters in C#" Tags="|fft|frequency|c#|" AnswerCount="1" CommentCount="3" ClosedDate="2015-05-21T16:44:56.067" ContentLicense="CC BY-SA 3.0" />
  <row Id="23549" PostTypeId="2" ParentId="23543" CreationDate="2015-05-21T08:41:38.410" Score="1" Body="&lt;p&gt;As mentioned in the comments there is no unique answer to your question, because you're asking for a contradiction. A good low pass filter (i.e. one with a fast transition between pass band and stop band, and with high stopband attenuation) will exhibit a considerable transient response. On the other hand, a filter with a very smooth step response is worse as a frequency selective filter than other filters of the same order. However, a &lt;a href=&quot;http://en.wikipedia.org/wiki/Bessel_filter&quot; rel=&quot;nofollow&quot;&gt;Bessel filter&lt;/a&gt; might be a good compromise between these two conflicting goals. It performs reasonably well as a low pass filter, and it has very little overshoot in its step response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-21T08:41:38.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23550" PostTypeId="2" ParentId="23548" CreationDate="2015-05-21T08:50:25.450" Score="1" Body="&lt;p&gt;First of all, a &lt;a href=&quot;https://netwerkt.wordpress.com/2011/08/25/goertzel-filter/&quot; rel=&quot;nofollow&quot;&gt;link to an example of the Goertzel algorithm.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the goertzel algorithm is so fast that you don't need to get into multithreading.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just create a class that does the goertzel algorithm for a frequency and sampling rate that you define when you create an instance.&lt;br&gt;&#xA;Make a list or array of instances of that class, then for every sample, run through that array and have it calculate the goertzel for that sample.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you just need two instances so you don't really need an array of instances.&#xA;Fast and simple.&lt;br&gt;&#xA;I've done this very thing with several hundred instances on a fairly old PC, and updating the GUI causes more of a load than the processing.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2015-05-21T08:56:34.240" LastActivityDate="2015-05-21T08:56:34.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23552" PostTypeId="1" CreationDate="2015-05-21T10:57:51.913" Score="0" ViewCount="349" Body="&lt;p&gt;I'm trying to make an FFT audio filter using overlap-add but there's some slight rhythmic distortion/crackle in the output. I have an irSize (impulse response size) of 512 samples and a blockSize of 512. The overlap is 512 samples. Since fftSize &gt;= blockSize + irSize - 1, fftSize is 1024 samples. I'm using FFTS for the FFT so the output size of forward_real (fftBlockSize) is 1026.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my steps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// copy input&#xA;for(i = 0; i &amp;lt; blockSize; i++)&#xA;    fftBuffer[i] = inBuffer[i];&#xA;&#xA;// set rest to zero&#xA;for(i = blockSize; i &amp;lt; fftBlockSize; i++)&#xA;    fftBuffer[i] = 0;&#xA;&#xA;FFT::forward_real(fftSize, fftBuffer, fftBuffer);&#xA;&#xA;// complex multiplication&#xA;for(i = 0; i &amp;lt; irSize + 1; i++)&#xA;{&#xA;    convBuffer[i * 2] = fftBuffer[i * 2] * irBuffer[i * 2] - fftBuffer[i * 2 + 1] * irBuffer[i * 2 + 1];&#xA;    convBuffer[i * 2 + 1] = fftBuffer[i * 2] * irBuffer[i * 2 + 1] + fftBuffer[i * 2 + 1] * irBuffer[i * 2];&#xA;}&#xA;&#xA;FFT::inverse_real(fftSize, convBuffer, fftBuffer);&#xA;&#xA;// overlap-add&#xA;for(i = 0; i &amp;lt; blockSize; ++i){&#xA;    outBuffer[i] = fftBuffer[i] + parts[i];&#xA;    parts[i] = fftBuffer[i + blockSize];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here you can see the little jump in the output every 512 samples. This is the source of the distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nd88H.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas? I've been struggling with this for days. It seems like either I'm doing the complex multiply or the overlap add slightly wrong. But I can't for the life of me figure it out. It seems like I'm doing the theory right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15913" LastEditorUserId="4346" LastEditDate="2017-01-05T03:59:31.673" LastActivityDate="2017-01-05T03:59:31.673" Title="Slight crackle with overlap-add frequency-domain convolution" Tags="|fft|filters|convolution|distortion|fast-convolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23553" PostTypeId="2" ParentId="23542" CreationDate="2015-05-21T12:00:14.800" Score="1" Body="&lt;p&gt;Both Impulse and Step Response can help identify a system, however it might be hard to actually perform the identification. You'd have to fourier transform the response. Basically, this is only possible using digital signal processing. Using a sine sweep, the result is easily read, but the sweep will take a relatively long time. &lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2015-05-21T12:00:14.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23555" PostTypeId="2" ParentId="23529" CreationDate="2015-05-21T12:42:39.037" Score="1" Body="&lt;p&gt;There exist solutions that are coarsely based on the idea that you propose: Threshold the spectrogram amplitudes to reduce/remove the noise part of the signal. Usually, this will bring about artifacts as e.g. the so-called &lt;em&gt;musical noise&lt;/em&gt; and the application determines whether this is acceptable or not. In general, the more the noise is reduced the more negative effects the process has on the quality of the desired signal (i.e. the speech in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a first attempt I would suggest you to try the &lt;em&gt;Noise Removal&lt;/em&gt; algorithm in Audacity (&lt;a href=&quot;http://web.audacityteam.org/&quot; rel=&quot;nofollow&quot;&gt;http://web.audacityteam.org/&lt;/a&gt;). Probably this will give satisfactory results and is sure worth a try as the software is free. If you're okay with spending money to most probably achieve better results, have a look at RX by iZotope (&lt;a href=&quot;https://www.izotope.com/en/products/audio-repair/rx/&quot; rel=&quot;nofollow&quot;&gt;https://www.izotope.com/en/products/audio-repair/rx/&lt;/a&gt;). However, if you know the basics of digital signal processing and want to experiment yourself, a first thresholding algorithm will not be very complex in programming environments like e.g. MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested in the background / signal processing methods that these algorithms are based on I would recommend the books by Vaseghi (&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0470754060&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Advanced-Digital-Signal-Processing-Reduction/dp/0470754060/ref=sr_1_1?ie=UTF8&amp;amp;qid=1432211838&amp;amp;sr=8-1&amp;amp;keywords=vaseghi&lt;/a&gt;) or Godsill and Rayner (&lt;a href=&quot;https://www-sigproc.eng.cam.ac.uk/Main/SJGSpringer&quot; rel=&quot;nofollow&quot;&gt;https://www-sigproc.eng.cam.ac.uk/Main/SJGSpringer&lt;/a&gt;), the second of which can be downloaded for free from the internet.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2015-05-21T12:42:39.037" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23556" PostTypeId="1" CreationDate="2015-05-21T15:23:57.227" Score="1" ViewCount="1914" Body="&lt;p&gt;I have been reading a paper that specifies the spectral mask for certain communication devices attempting transmit over a channel&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aWFiv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) importance if this spectral mask, is it a filter ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) what do we mean by roll off at the pass band from -28 dBr to -20 dBr. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Also why is the unit of measurement dBr and not db &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-05-24T16:25:22.260" LastActivityDate="2015-05-24T16:25:22.260" Title="spectral mask and power spectral density" Tags="|digital-communications|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23557" PostTypeId="1" AcceptedAnswerId="23592" CreationDate="2015-05-21T15:25:26.917" Score="4" ViewCount="2750" Body="&lt;p&gt;I'm working on color-balancing images with as little input from the user of my app as possible, specifically to remove color casts caused by scanning aged paper. Photoshop's &lt;strong&gt;Auto Color&lt;/strong&gt; action works great, with no input at all, but I don't even know where to begin in implementing something like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where can I find an example of how to do that? I've done extensive searching and haven't found a good example. To see the correction I'm talking about, take a look at &lt;a href=&quot;https://stackoverflow.com/questions/30362906/how-do-you-effectively-color-balance-an-image-using-core-image-filters&quot;&gt;this question on Stack Overflow&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15917" LastEditorUserId="128" LastEditDate="2019-03-18T16:15:12.033" LastActivityDate="2019-10-25T07:19:15.617" Title="Algorithm for Color Balancing an Image" Tags="|image-processing|algorithms|color|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23558" PostTypeId="2" ParentId="23552" CreationDate="2015-05-21T17:21:44.650" Score="1" Body="&lt;p&gt;For FFT fast convolution, the complex multiplication in the frequency domain needs to be done over the full length of the FFT (fftSize), not just the length of the impulse response in the time domain.  Otherwise (for strictly real data and a strictly real impulse response) the IFFT input will likely no longer be conjugate symmetric.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-05-21T17:21:44.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23559" PostTypeId="1" AcceptedAnswerId="23573" CreationDate="2015-05-21T17:28:11.367" Score="0" ViewCount="684" Body="&lt;p&gt;I have 4 systems which are represented in z domain like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tiScu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I know the poles and zeros. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I compute Partial Energy Sequence of impulse response of all these system using this formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GVTKI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I get this result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WroOT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I want to observe minimum energy delay property of the minimum phase systems can be specified as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6KRge.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am right, the formula above tells us that minimum phase system has a bigger or equal at least partial energy but, unfortunately, you can see in partial energy sequence plot, the minimum phase system has the smallest partial energy!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I interpreting the minimum energy delay formula wrong or what am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="12045" LastEditorUserId="12045" LastEditDate="2015-05-21T17:38:51.037" LastActivityDate="2015-05-22T01:13:01.400" Title="Minimum Energy Delay Property" Tags="|filters|discrete-signals|signal-analysis|lowpass-filter|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23560" PostTypeId="2" ParentId="16586" CreationDate="2015-05-21T17:39:53.107" Score="1" Body="&lt;p&gt;Since DTFT output is continuous, it can not be processed with computers. So we have to convert this continuous signal into discrete form. It is nothing but DFT as a further advancement on FFT to reduce calculations.&lt;/p&gt;&#xA;" OwnerUserId="15918" LastEditorUserId="7092" LastEditDate="2015-05-21T21:32:44.170" LastActivityDate="2015-05-21T21:32:44.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23562" PostTypeId="1" AcceptedAnswerId="23588" CreationDate="2015-05-21T18:24:51.073" Score="1" ViewCount="1234" Body="&lt;p&gt;I am just starting to learn discrete filters and I could use some help. I understand continuous signals and filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand the math behind discrete filtering. For example in the s domain, a simple low pass filter can be recognized as $$\dfrac{1}{\tau s+1}$$&#xA; How does sampling rate affect a discrete low pass filter?&lt;/p&gt;&#xA;" OwnerUserId="15920" LastEditorUserId="8202" LastEditDate="2015-05-21T18:51:30.160" LastActivityDate="2015-05-22T15:54:04.807" Title="How does sampling rate affect discrete filters?" Tags="|discrete-signals|lowpass-filter|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23564" PostTypeId="1" AcceptedAnswerId="23569" CreationDate="2015-05-21T19:59:14.057" Score="1" ViewCount="97" Body="&lt;p&gt;In the case with a 1-D input like audio, how can a system with one input do many different kinds of processing at different sampling rates and still, at the end of the processing, produce one waveform? For example an ADC/DAC reading and writing at 48kHz, but has an FFT running at 8kHz or another set of processes running at 16 kHz? Is it a matter of decimating and interpolating? How would all of these processes line up?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-22T01:12:38.230" Title="How does multi-rate processing work?" Tags="|multirate|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23565" PostTypeId="1" AcceptedAnswerId="23567" CreationDate="2015-05-21T20:09:58.103" Score="2" ViewCount="1683" Body="&lt;p&gt;I am bit unsure whether i am doing i sine sweep correctly. &#xA;I am feeding my system a sine wave with f hertz within a given time interval and log its output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then i do the same for another frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this technique but seem to do it incorrect or so i think.&#xA;I tested for 2 frequencies, and fed them into  Ident in matlab and got a fit rate of 98 % which makes no sense that it could build a such a good bode plot based on 2 values.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing something wrong.. should it not have more than one 2 input or is it enough?&lt;/p&gt;&#xA;" OwnerUserId="15908" LastActivityDate="2022-04-25T09:25:00.550" Title="Am i performing Sinesweep correctly?" Tags="|matlab|frequency|system-identification|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23566" PostTypeId="2" ParentId="23565" CreationDate="2015-05-21T20:13:32.787" Score="-1" Body="&lt;p&gt;A sine sweep usually goes over the entire frequency range of interest. For example with audio you may have a sweep of 20 Hz to 20 kHz (or 16 kHz). All of the frequencies will be swept through in one continuous output. You can do this by generating the samples with &lt;code&gt;sin(2*pi*n*f/fs)&lt;/code&gt; with &lt;code&gt;f&lt;/code&gt; incremented every arbitrary number of samples &lt;code&gt;n&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="11256" LastEditDate="2015-05-21T22:53:35.430" LastActivityDate="2015-05-21T22:53:35.430" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23567" PostTypeId="2" ParentId="23565" CreationDate="2015-05-21T20:37:26.180" Score="6" Body="&lt;p&gt;The theory behind sweep-sine measurements of LTI systems requires a signal with constantly changing the frequency. You cannot simply playback few tones - the whole frequency range is necessary.&lt;/p&gt;&#xA;&lt;p&gt;So that if you want to identify your system with the impulse response &lt;span class=&quot;math-container&quot;&gt;$h[n]$&lt;/span&gt;, you feed the sweep sine signal &lt;span class=&quot;math-container&quot;&gt;$s[n]$&lt;/span&gt; into it and record the output. Obviously output will be given by the convolution:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n]=h[n]\star s[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In order to obtain the impulse response of the system, it is required to convolve the output &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; with the inverse filter &lt;span class=&quot;math-container&quot;&gt;$f[n]$&lt;/span&gt;. Generally, the inverse filter is a sweep signal, inverted in time and with scaled amplitude. So in the end:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h[n]=y[n]\star f[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;There are two major types of sweep signals: linear and logarithmic (exponential) frequency change. The latter one is more commonly used, since its spectrum is similar to a pink noise. Personally I always use the logarithmic sweep sine:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$s(t) = \sin\left[ \dfrac{2\pi f_1 T}{\ln\left( \dfrac{2\pi f_2}{2\pi f_1} \right)}\left(e^{\dfrac{t}{T}\ln\left(\dfrac{2 \pi f_2}{2\pi f_1} \right)} -1\right) \right]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f_1$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$f_2$&lt;/span&gt; - initial and final frequency of a sweep&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; - sweep duration in seconds&lt;/p&gt;&#xA;&lt;p&gt;There is no strict rule on what should be the length of a sweep. For example in acoustics, the rule of thumb is that it should be at least as long as predicted reverberation time.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For more literature on the topic, please refer to the following sources:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Meng Q., et al. - &lt;a href=&quot;http://guillaume.perrin74.free.fr/ChalmersMT2012/Papers/Impulse%20Response/IEEE_2008_LSP_IR_SineSweep.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Impulse Response Measurement With Sine Sweeps and&#xA;Amplitude Modulation&#xA;Schemes&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Farina A. - &lt;a href=&quot;http://pcfarina.eng.unipr.it/Public/Papers/226-AES122.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Advancements in impulse response measurements by sine&#xA;sweeps&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Farina A. - &lt;a href=&quot;https://www.melaudia.net/zdoc/sweepSine.PDF&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Simultaneous Measurement of Impulse Response and Distortion with a Swept-Sine Technique&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2022-04-25T09:25:00.550" LastActivityDate="2022-04-25T09:25:00.550" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="23569" PostTypeId="2" ParentId="23564" CreationDate="2015-05-21T20:46:37.693" Score="2" Body="&lt;p&gt;You are on the right track.  You can use decimation and interpolation (or resampling, which is a combination of both decimation and interpolation) to change the sample rate.  For instance, if you start with 48 kHz samples you can decimate by 6 to get down to 8 kHz, do some processing, then interpolate by 2 to get to 16 kHz, do some processing, then interpolate by 3 to get back to 48 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Lining up the processes&quot; is not in and of itself difficult.  You can decimate and interpolate whenever you want.  Doing it in a way that makes sense and is useful, on the other hand, requires knowing more about what you start out with and what you want to accomplish.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-05-21T20:46:37.693" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23572" PostTypeId="2" ParentId="23564" CreationDate="2015-05-22T01:12:38.230" Score="2" Body="&lt;p&gt;If you are running a causal/real-time process, note that any upsampling/downsampling sub-process involves anti-alias filtering that will add a delay (a linear delay in the case of a symmetric FIR filter).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you want to re-combine resampled and non-resampled processing chains, you might want to add delays to the non-resampled processing paths to match the anti-alias filter (and other) delays in the resampled processing paths to &quot;line things up&quot;, depending on what you are doing, of course.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-05-22T01:12:38.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23573" PostTypeId="2" ParentId="23559" CreationDate="2015-05-22T01:13:01.400" Score="2" Body="&lt;p&gt;Given only the zeros and poles, the impulse response is determined except for a constant $K_i$, which you don't show.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your calculations, it is clear that the energy of the impulse response for all filters is different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you normalize all filters so that all impulse responses have the same energy (i.e. $\sum_n |h_i[n]|^2$ is the same for the 4 filters), then the 4 curves for partial energies will end up at the same value, and it will be clear that $H_1$ has its energy distributed earlier in time than the others.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-05-22T01:13:01.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23574" PostTypeId="1" CreationDate="2015-05-22T07:16:27.297" Score="0" ViewCount="523" Body="&lt;p&gt;I am trying to implement a Chebyshev waveshaper according to the description on the bottom post here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/5959/add-odd-even-harmonics-to-signal&quot;&gt;Add odd/even harmonics to signal?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks similar to the algorithm here:&#xA;&lt;a href=&quot;http://www.juce.com/forum/topic/voice-changer-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.juce.com/forum/topic/voice-changer-plugin&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results for any odd order setting sound good. But all even order results just end up in massive distortion. I also tried x * abs(x) instead of x², but the result is similar. How should I handle the even order terms? Or do I have to use a completely different method for producing even harmonics?&lt;/p&gt;&#xA;" OwnerUserId="15926" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-05-22T07:16:27.297" Title="Chebyshev waveshaping" Tags="|algorithms|" AnswerCount="0" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="23575" PostTypeId="2" ParentId="22843" CreationDate="2015-05-22T08:32:07.000" Score="0" Body="&lt;p&gt;There is code on the matlab file exchange which can do exactly what you are asking for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/23571-short-time-energy-and-zero-crossing-rate&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/23571-short-time-energy-and-zero-crossing-rate&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2015-05-22T08:32:07.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23576" PostTypeId="1" AcceptedAnswerId="23579" CreationDate="2015-05-22T09:56:53.507" Score="2" ViewCount="4568" Body="&lt;p&gt;Is this code for doing a moving average correct?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=conv(x, ones(1,100)/100);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to filter my speech signal with moving average filter in code.  I think that I can use convolution for this.&lt;/p&gt;&#xA;" OwnerUserId="12232" LastEditorUserId="10650" LastEditDate="2015-05-22T12:26:55.457" LastActivityDate="2015-05-22T12:26:55.457" Title="Is this code for doing a moving average correct?" Tags="|matlab|moving-average|octave|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23577" PostTypeId="1" CreationDate="2015-05-22T10:12:42.523" Score="0" ViewCount="78" Body="&lt;p&gt;I am using MATLAB to identify a system. The problem with my method is that my result is perfect. I get a nearly 100% fit, which make me wonder if what I  am doing is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feed a sine sweep with an amplitude being the max velocity the system is capable of moving. &#xA;I am sweeping from $0.1 \mathrm{Hz}$ to $2 \mathrm{Hz}$ (and another set from $0.1 \mathrm{Hz}$ to $5 \mathrm{Hz}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I log how much the position has changed for each time I change the velocity. &#xA;Which seems a bit incorrect to do, since a change in position is just a velocity. Aren't I just sending and measuring the same thing hence perfect fit or what?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The System is a Pan/tilt unit FLIR D48E&#xA;The input to the Plant is a velocity, and the output of the plant is a position. &#xA;the input for the controller should be summation of how much it has to angular displacement given from input source, and its present location. &lt;/p&gt;&#xA;" OwnerUserId="15908" LastEditorUserId="15908" LastEditDate="2015-05-22T16:24:31.943" LastActivityDate="2015-05-22T16:24:31.943" Title="Perfect system identification or am i doing something wrong?" Tags="|matlab|linear-systems|control-systems|system-identification|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23578" PostTypeId="2" ParentId="23576" CreationDate="2015-05-22T10:16:11.117" Score="2" Body="&lt;p&gt;Yes, this code is correct for implementing a moving average filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless I do recommend to use the in-built &lt;a href=&quot;http://uk.mathworks.com/help/curvefit/smooth.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;smooth&lt;/strong&gt;&lt;/a&gt; function in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = smooth(x, 100, 'moving')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-05-22T10:16:11.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23579" PostTypeId="2" ParentId="23576" CreationDate="2015-05-22T10:16:47.423" Score="1" Body="&lt;p&gt;Presuming you are using Matlab or GNU Octave, then yes, that should be OK.&#xA;&lt;a href=&quot;http://matlabtricks.com/post-11/moving-average-by-convolution&quot; rel=&quot;nofollow&quot;&gt;Compare with this tutorial&lt;/a&gt; on doing a moving average with convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You've done the division on your kernel, but it makes no mathematical difference whether you do it there or after the convolution.  Practically, it takes less time if you do it your way (scaling the kernel.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may find that a moving average is not adequate for audio processing.  You will then need to look into creating filters with the appropriate methods in Matlab.  Some keywords to search for together with Matlab:  filter, butter.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Good suggestion from @jojek.  The smooth does a moving average by convolution, but has other options as well.  It can also make use of a GPU to speed things up if you have a truly massive amount of data to be filtered.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2015-05-22T10:24:15.943" LastActivityDate="2015-05-22T10:24:15.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23580" PostTypeId="2" ParentId="23534" CreationDate="2015-05-22T12:13:47.993" Score="3" Body="&lt;p&gt;The term &lt;em&gt;smoothing length&lt;/em&gt; (also called &lt;em&gt;observation interval&lt;/em&gt;) is simply the length of the equalizer, i.e. its number of filter taps. In the code the filter length is &lt;code&gt;L+1&lt;/code&gt;, so &lt;code&gt;L&lt;/code&gt; is the filter order. Similarly, the length of the channel refers to the length of the FIR filter simulating the dispersive channel. Again, the channel filter length is actually &lt;code&gt;ChL+1&lt;/code&gt;. What is called &lt;em&gt;equalization delay&lt;/em&gt; in the code is the total delay introduced by the channel and by the equalizer. It is needed for aligning transmitted and received (and equalized) symbols.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-22T12:13:47.993" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23582" PostTypeId="1" CreationDate="2015-05-22T14:18:45.043" Score="-1" ViewCount="168" Body="&lt;p&gt;I have two waveforms, and I'm not sure which of them is for the word &quot;cease&quot; and which one for &quot;shoot&quot;.&#xA;Now I guess based on voiced and unvoiced waveforms(voiced should be periodic), the first one is &quot;cease&quot; and the other is &quot;shoot&quot;. My question is, how to determine which waveform below refers to the word &quot;cease&quot;/&quot;shoot&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Jwqvx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UI1SZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="14941" LastEditorUserId="7092" LastEditDate="2015-05-22T15:34:45.373" LastActivityDate="2015-05-29T21:03:24.403" Title="Problem in reading speech waveforms" Tags="|speech-recognition|speech-processing|waveform-similarity|" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23583" PostTypeId="1" AcceptedAnswerId="23584" CreationDate="2015-05-22T14:28:35.393" Score="2" ViewCount="831" Body="&lt;p&gt;I recently implemented a Butterworth high-pass filter (2nd order). Everything seems to work fine, except that I have a question when applying such a filter to a constant signal. As there are no high-frequency components in a constant signal, I would expect the filter to yield a constant 0 signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the plots below are my results. There seems to be ``ripple'' in the first couple of frames before the high-pass filtered signal (correctly) converges to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a logical result from applying a Butterworth high-pass filter on a constant signal, or might there be a bug in my code? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I've created the same filter in Octave, resulting in the same output. This indicates that we're indeed looking at the step response, as Paul R. indicates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LWLvj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Octave output&lt;img src=&quot;https://i.stack.imgur.com/5jNx6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15934" LastEditorUserId="15934" LastEditDate="2015-05-25T19:16:25.040" LastActivityDate="2015-05-25T19:16:25.040" Title="Applying a high-pass filter on constant signal" Tags="|filters|highpass-filter|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23584" PostTypeId="2" ParentId="23583" CreationDate="2015-05-22T14:36:52.273" Score="6" Body="&lt;p&gt;The input to your filter is essentially a step function (since it has value 0 prior to t = 0, and a positive value for t &gt; 0), so you see the &lt;a href=&quot;https://en.wikipedia.org/wiki/Step_response&quot;&gt;step response&lt;/a&gt; of the filter, hence the initial ringing. This is expected behaviour, and after a suitable amount of time the step response will have settled to zero.&lt;/p&gt;&#xA;" OwnerUserId="39" LastActivityDate="2015-05-22T14:36:52.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23585" PostTypeId="1" CreationDate="2015-05-22T15:17:20.260" Score="0" ViewCount="199" Body="&lt;p&gt;I have a signal which has been AM modulated but the channel also added a cosinusoidal interference &lt;code&gt;A cos(2 * Pi * f0 * n * Tc + Phase)&lt;/code&gt;, at the same &lt;code&gt;f0&lt;/code&gt; frequency of modulation. &lt;code&gt;Tc&lt;/code&gt; is the sampling period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CPPsb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am given the distorted signal &lt;code&gt;x(nTc)&lt;/code&gt; and I need to recover the original signal &lt;code&gt;v(nTc)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have the filter coefficients of two filters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A) a notch filter centered at &lt;code&gt;16KHz&lt;/code&gt;;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B) a low pass filter;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started by calculating the fft of &lt;code&gt;x(nTc)&lt;/code&gt; and it has a big peak at &lt;code&gt;7500 Hz&lt;/code&gt;, which is my &lt;code&gt;f0&lt;/code&gt;&#xA;Now I need to eliminate the cosinusoidal interference and the notch filter seems to be the right way to do it but it is centered at &lt;code&gt;16KHz&lt;/code&gt;, so I have to center it at &lt;code&gt;7500Hz&lt;/code&gt;. To do so I used this Fourier transform property: &lt;code&gt;exp(j * w0 * n)x(n) -&amp;gt; X(j(w-w0))&lt;/code&gt;. In my case I need to multiply the filter coefficients of the notch filter by &lt;code&gt;exp(j * 2 * Pi * 8500 * n * Tc)&lt;/code&gt;&#xA;Everything should be good, so now I can filter the &lt;code&gt;x(nTc)&lt;/code&gt; signal using &lt;code&gt;input_without_interference = filtfilt(notch_coeff,1,x(nTc))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point I have to AM demodulate the signal. Demodulation is accomplished by multiplying the signal by the same carrier that modulated it, in this case &lt;code&gt;cos(2 * Pi * f0 * n * Tc)&lt;/code&gt;&#xA;To do so I used this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for k=0:length(input_without_interference))-1&#xA;    dem_signal(k+1) = cos(2 * Pi * 7500 * k * Tc) * input_without_interference(k+1);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now If I plot the signal &lt;code&gt;dem_signal&lt;/code&gt; it still shows some traces of modulation so something is certainly wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming everything went good, I now have many replicas of the original signal &lt;code&gt;v(nTc)&lt;/code&gt; and one of them is centered in the origin, so to take it I just need to use the low pass filter. &lt;code&gt;v(nTc) = filtfilt(lowpass,1,dem_signal)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Result: the output is still distorted and it has an imaginary component! Where is my&#xA; mistake?&lt;/p&gt;&#xA;" OwnerUserId="15897" LastActivityDate="2015-05-22T15:17:20.260" Title="MATLAB, recover a signal that has a cosinusoidal interference and that has been AM modulated" Tags="|matlab|filters|discrete-signals|signal-analysis|filtering|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23586" PostTypeId="2" ParentId="22843" CreationDate="2015-05-22T15:25:19.507" Score="4" Body="&lt;p&gt;Short time energy (STE) is simple feature and so is the code to compute it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ste = sum(buffer(signal.^2, winLen));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where  and winLen is duration of rectangular time window (in samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use diffrent shape of window, then you have to multiply each column returned by buffer by this window, before you sum the columns.&lt;/p&gt;&#xA;" OwnerUserId="15935" LastActivityDate="2015-05-22T15:25:19.507" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23588" PostTypeId="2" ParentId="23562" CreationDate="2015-05-22T15:54:04.807" Score="0" Body="&lt;p&gt;IF we take the sampling period as T.First I will convert the filter to time domain impulse response as &#xA;$$&#xA;h(s)=\frac{1}{\tau s+1}\\h(s)=\frac{1/\tau}{s+\frac{1}{\tau}}&#xA;$$&#xA;this in time domain is&#xA;$$&#xA;h(t)=\frac{e^{-t/\tau}}{\tau}&#xA;$$&#xA;IF the above signal is sampled at time T the it can be written as&#xA;$$&#xA;h(Tn)=\frac{e^{\frac{-Tn}{\tau}}}{\tau}\\h(n)=\frac{e^{\frac{-Tn}{\tau}}}{\tau}&#xA;$$&#xA;if Z transform taken for the impulse response.Then the equation is&#xA;$$&#xA;H(z)=\frac{1/\tau}{1-e^{\frac{T}{\tau}}z^{-1}}&#xA;$$&#xA;Here we can see the sampling time coming in denominator which could put the pole inside or outside the unit circle&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-05-22T15:54:04.807" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23589" PostTypeId="2" ParentId="22392" CreationDate="2015-05-22T16:41:31.283" Score="1" Body="&lt;p&gt;Try &lt;code&gt;imtool()&lt;/code&gt; and adjust the contrast to show &lt;code&gt;ft&lt;/code&gt; similar as in the paper. I set eliminate outliers to 5%, then (contrast) window minimum to 0.0. May I suggest to ask the author about the settings for the display range in his paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WkVj8.png&quot; alt=&quot;display range adapted ft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to the signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mentioned &lt;a href=&quot;http://www.researchgate.net/profile/Nghia_T_Vo?origin=publication_list&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper by Vo is public&lt;/a&gt; available. Moreover Vo published the algorithm in &lt;a href=&quot;https://zenodo.org/record/10946#.VV9YHblm-9J&quot; rel=&quot;nofollow noreferrer&quot;&gt;mathematica code&lt;/a&gt;. &lt;strong&gt;Note that the code by Vo does a gaussian filtering, i.e. a lowpass of the sinogram&lt;/strong&gt;. IMHO to achieve similar results as in a real scan.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally a real scan shows lowpass behaviour, i.e. the high frequencies in the projections in the sinogram are lost due to the size of the focal point inside the x-ray tube, the detector system and radiation scatter inside the object. In contrast the forward projection algoritm: Those may keep high frequencies in the projections, depending on their base algorithm.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sinogram1 = GaussianFilter[ sinogram1, {{3,2}}];&#xA;(* Apply smooth filter: recommend blur more in the vertical direction *)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Mathematica help tells, that those 3 and 2 steer the xy-sigma of the GaussianFilter(). One can go theroretically through that to find the values of the matrix, but I prefer to run the above filter over a dirac impulse to see the resulting filtermatrix and establish it similar in matlab for use in &lt;code&gt;imfilter()&lt;/code&gt;. But I have no access to mathematica. May be s.o can translate the Mathematica GaussianFilter() into a matlab &lt;code&gt;fspecial()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's filter the sinogram with a lowpass to ged rid of the high frequencies introduced by radon() :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imtool(ft); %% eliminate 5% outliers and set min to 0.0&#xA;h=fspecial('gaussian',[2 3]); %% wider in projection direction&#xA;sino_lp = imfilter(sinogram,h,'replicate');&#xA;ft_lp=real(fftshift(fft2(sino_lp)));&#xA;imtool(ft_lp);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Such a fourier transformed sinogram has lower values in the high frequencies.&lt;/p&gt;&#xA;" OwnerUserId="15936" LastEditorUserId="15936" LastEditDate="2015-06-09T06:03:12.263" LastActivityDate="2015-06-09T06:03:12.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23591" PostTypeId="2" ParentId="22392" CreationDate="2015-05-22T19:14:47.500" Score="1" Body="&lt;p&gt;The chapter &lt;a href=&quot;https://engineering.purdue.edu/~malcolm/pct/CTI_Ch05.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;Alaising Artifacts And Noise In CT Images&quot;&lt;/a&gt; gives in formula #10 for an equal radial and channel resolution that the number of parallel projections is pi/2 times the number of projection channels for 360°, or pi/4 for 180°. In order to reconstruct an image, a fan beam system needs data from 180° + the fan angle, e.g. 50°. Now (230°/180°) * pi/4 is about 1.0, i.e. a fan beam system needs about the same amount of fan projections as it has channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;P&lt;/code&gt; has dimension 256x256 and &lt;code&gt;radon()&lt;/code&gt; forward projects this into 367 ~ 256xsqrt(2) projection channels, i.e. the number of channels becomes the diameter of the square given by &lt;code&gt;P&lt;/code&gt;. Please checkout the &lt;code&gt;radon()&lt;/code&gt; help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formula #10 derives from those 367 then 550 projections onwards for 360°. I round this down to the next power of 2 to achieve better &lt;code&gt;fft2()&lt;/code&gt; performance to 256 angles on 180°, but &lt;code&gt;radon()&lt;/code&gt; will take longer for those 256 than your given 200 angels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extending the sinogram to 512 channels and 512 'repeating' projections over pi reduces alaising in the fourier space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that your &lt;code&gt;angs&lt;/code&gt; are not evenly distributed in 360°, but have a gap close to 180°.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;angs=linspace(0,180,257);&#xA;angs(end)=[]; %% now 256 even distributed angles in range [0..180[&#xA;...&#xA;ft=real(fftshift(fft2(sinogram,512,512)));&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15936" LastEditorUserId="-1" LastEditDate="2015-07-13T03:00:37.477" LastActivityDate="2015-07-13T03:00:37.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23592" PostTypeId="2" ParentId="23557" CreationDate="2015-05-22T19:31:03.620" Score="0" Body="&lt;p&gt;Photoshop's Auto Color is nothing more than &lt;a href=&quot;http://en.wikipedia.org/wiki/Histogram_equalization&quot; rel=&quot;nofollow noreferrer&quot;&gt;Histogram Equalization&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has some improvements over the classic Histogram Equalization by adding a threshold of not touching the % at the extreme values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try it and see for yourself:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://fourier.eng.hmc.edu/e161/lectures/contrast_transform/node2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Histogram Equalization&lt;/a&gt;.  &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://what-when-how.com/embedded-image-processing-on-the-tms320c6000-dsp/histogram-equalization-image-processing-part-1/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Histogram Equalization (Image Processing) Part 1&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.songho.ca/dsp/histogram/histogram.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Histogram&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Good Luck.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-10-25T07:19:15.617" LastActivityDate="2019-10-25T07:19:15.617" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="23593" PostTypeId="1" CreationDate="2015-05-22T22:00:05.160" Score="0" ViewCount="124" Body="&lt;p&gt;I read a noisy signal from an accelerometer which is attached to the pedal of a stationary bike and need to find the frequency of the signal/ speed of the person cycling. &#xA;I taught of the following solutions and would like to know if I overlooked any or made some incorrect assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently the working solution is a low pass (10-30 point moving average) and then a peak detection with a minimum amplitude requirement and minimum time requirement. However this solution doesn't work very well when nearing 0.33Hz (20 RPM)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried using an fft but the result was never accurate enough for the small differences in frequency I am looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I taught about using autocorrelation but how I understand it, I would have to wait atleast a period and then some before I could detect the frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other ideas are welcome, or if anybody knows what is used in the commercial version it would be great to know.&lt;/p&gt;&#xA;" OwnerUserId="15940" LastActivityDate="2015-05-22T22:00:05.160" Title="Getting the frequency of a 0.33Hz to 3Hz signal" Tags="|signal-analysis|frequency|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23594" PostTypeId="1" CreationDate="2015-05-23T00:44:27.510" Score="3" ViewCount="1329" Body="&lt;p&gt;I have a set of accelerometer readings in $X, Y, Z$ axes obtained from an android based smart-phone. The data in $(X, Y, Z)$ was recorded at different time stamps and there is no uniform time period for recording the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My data set looks as  timestamp $X, Y, Z$. First, I did a filtering (using a low-pass) on this data and now want to perform $\textrm{FFT}$ on a timewindow of 1 min or may be a window containing 250 samples (not very sure about the window length). I am using &lt;a href=&quot;https://commons.apache.org/proper/commons-math/javadocs/api-2.2/org/apache/commons/math/transform/FastFourierTransformer.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; &lt;code&gt;FastFourierTransform&lt;/code&gt; class of apache commons in Java.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting $\textrm{FFT}$ magnitude but I was wondering how do I know the corresponding frequency of each $\textrm{FFT}$ mag. I know corresponding frequency would be $(n\cdot F_s)/N$ where $n$ is the bin number or data point index, $F_s$ is sampling frequency and $N$ is number of input data points over the window. Now my question is how do I know $F_s$ for a given set of data say for example input data in an array as $\begin{bmatrix}1&amp;amp;2&amp;amp;3&amp;amp;4&amp;amp;5&amp;amp;6&amp;amp; 7\end{bmatrix}$ over a window of size $N_t$ millisec where $N_t=(\textrm{lastTimeStamp}-\textrm{firstTimeStamp})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it $\displaystyle \frac{7}{(N_t\cdot 10^{-2})} \textrm{Hz}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also immediately follows by doing so if this agrees with nyquist sampling frequency? and this says $F_s\ge2F_{max}$ in the signal and I don't know the maximum frequency over the time window $N_t$.&lt;/p&gt;&#xA;" OwnerUserId="15942" LastEditorUserId="1629" LastEditDate="2015-07-22T08:25:31.680" LastActivityDate="2017-11-24T09:36:04.707" Title="How to set sampling frequency of an acceleration data set" Tags="|fft|fourier-transform|sampling|java|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23595" PostTypeId="2" ParentId="23594" CreationDate="2015-05-23T05:53:15.610" Score="1" Body="&lt;p&gt;If you don't have a uniform time period (or nearly so) between samples, then you don't have a sample rate, and the FFT result may well be garbage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't know ahead of the sampling the  Nyquist frequency for the signal, then the sampling might be already contaminated by aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the samples are close enough together relative to the highest frequency in the signal's spectrum, then you may be able to interpolate a new set of evenly spaced samples, which will then have a known sample rate (based on the distance of the new even spacing).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-05-23T05:53:15.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23596" PostTypeId="1" AcceptedAnswerId="23609" CreationDate="2015-05-21T21:39:02.303" Score="1" ViewCount="274" Body="&lt;p&gt;When I speed up 150% an audio file with VLC Player, why doesn't it match the higher-pitched version I get when I speed the same file 150% with RPG Maker VX Ace's Sound Test?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I speed up with VLC Player, I don't get a pitch increase&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I speed up with RPG Maker or Audacity, I do...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would their methods of speed increase differ, such that that happens?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I'm on a Windows, if that matters at all...&lt;/p&gt;&#xA;" OwnerUserId="15517" OwnerDisplayName="Malandy" LastEditorUserId="15517" LastEditDate="2015-05-23T23:52:11.207" LastActivityDate="2015-05-24T01:57:16.113" Title="Why does speeding up audio files with VLC Player not match with doing the same thing with RPG Maker or Audacity?" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23597" PostTypeId="2" ParentId="23582" CreationDate="2015-05-23T06:59:07.827" Score="0" Body="&lt;p&gt;it is almost impossible to see the different by 1000-5000 samples data point. If you have 5 seconds of signal with 8000 Hz sampling freq, it will give 40000 sample points and it will clear enough to differ cease/shoot. However, the acoustic signal processing community prefer to use spectrogram to check the spell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the waveform of cease (left) and shoot (right), it is similar but easy to differ.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/k48S7.png&quot; alt=&quot;Waveform of cease and shoot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the spectrogram of cease and shoot, it is easier to differ.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Jdpof.png&quot; alt=&quot;Spectrogram of cease and shoot&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11684" LastActivityDate="2015-05-23T06:59:07.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23599" PostTypeId="1" CreationDate="2015-05-23T10:53:23.193" Score="0" ViewCount="796" Body="&lt;p&gt;I need gaussian pulse fft. I set the sigma of gaussian pulse 1e-10 and define the gaussian function in time and use the fft. as you know the amplitude of should be unit in frequency domain. but my result shows that the amplitude of the pulse in frequency domain equal to 1/end_time. for example, if i define the time as t=0:1/fs:1e-07 then the amplitude of X(f) is 1e7 and I changed the end_time then the amplitude respectively change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is my code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;clc;&#xA;fs=1e10; %sampling frequency&#xA;sigma=1e-10;&#xA;&#xA;end_time=1e-7;&#xA;&#xA;t=0:1/fs:1e-7; %time base&#xA;&#xA;t_s=1e-8;&#xA;variance=sigma^2;&#xA;x=1/(sqrt(2*pi*variance))*(exp(-(t-t_s).^2/(2*variance)));&#xA;subplot(2,1,1)&#xA;plot(t,x,'b');&#xA;title(['Gaussian Pulse \sigma=', num2str(sigma),'s']);&#xA;xlabel('Time(s)');&#xA;ylabel('Amplitude');&#xA;&#xA;L=length(x);&#xA;&#xA;X =fftshift(fft(x,L));&#xA;Pxx=X.*conj(X)/(L*L); %computing power with proper scaling&#xA;f = fs*(0:L-1)/L; %Frequency Vector&#xA;&#xA;subplot(2,1,2)&#xA;plot(f,abs(X)/(L),'r');&#xA;title('Magnitude of FFT');&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('Magnitude |X(f)|');&#xA;xlim([0 1e10])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15947" LastEditorUserId="8202" LastEditDate="2015-05-23T13:03:54.623" LastActivityDate="2015-05-23T14:41:13.590" Title="FFT function of Gaussian pulse" Tags="|fft|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23600" PostTypeId="2" ParentId="23540" CreationDate="2015-05-23T11:51:10.487" Score="7" Body="&lt;p&gt;Your code reveals many misconception about what the CMA is supposed to achieve:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;your step size &lt;code&gt;mu&lt;/code&gt; is much too small; note, however, that the optimal step size can only be found through experiment.&lt;/li&gt;&#xA;&lt;li&gt;the variabe &lt;code&gt;noisedB&lt;/code&gt; appears to be the desired SNR of the received signal. An SNR of $0\,\text{dB}$ as specified by you is very poor (the noise is as strong as the signal), and in such noisy conditions the CMA cannot perform properly.&lt;/li&gt;&#xA;&lt;li&gt;you have a channel with $3$ taps, and your equalizer length is also only $3$ taps; this is much too short to achieve any reasonable equalization.&lt;/li&gt;&#xA;&lt;li&gt;you define the MSE as the error between the channel impulse response and the equalizer response. This is wrong, because the equalizer is not supposed to converge to the channel impulse response! The equalizer must &lt;em&gt;equalize&lt;/em&gt; the channel, i.e. the concatenation of the channel and the equalizer should give a pure delay.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are a few other small errors in your code, but instead of correcting them all I show you a very simple and short code example. The figure below the code shows the error curve vs symbol index, and the total impulse response of the channel &lt;em&gt;and&lt;/em&gt; the equalizer. As you can see, it approximates a delta impulse (i.e. no distortion). The SNR is $30\,\text{dB}$ for this example. The error becomes much smaller if there is no noise. For worse SNRs, the algorithm becomes unstable.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;&#xA;N = 20000;          % # symbols&#xA;h = [1,.45,-.2];    % channel impulse response&#xA;h = h/norm(h);&#xA;Le = 20;            % equalizer length&#xA;mu = .001;          % step size&#xA;snr = 30;           % snr in dB&#xA;&#xA;s0 = round( rand(N,1) )*2 - 1;     % BPSK signal&#xA;s = filter(h,1,s0);                % filtered signal&#xA;&#xA;% add Gaussian noise at desired snr&#xA;n = randn(N,1);&#xA;vs = var(s);&#xA;vn = vs*10^(-snr/10);&#xA;n = sqrt(vn)*n;&#xA;r = s + n;          % received signal&#xA;&#xA;e = zeros(N,1);     % error&#xA;w = zeros(Le,1);    % equalizer coefficients&#xA;w(Le)=1;            % actual filter taps are flipud(w)!&#xA;&#xA;yd = zeros(N,1);&#xA;&#xA;for i = 1:N-Le,&#xA;    x = r(i:Le+i-1);&#xA;    y = w'*x;&#xA;    yd(i)=y;&#xA;    e(i) = y^2 - 1;&#xA;    w = w - mu * e(i) * y * x;&#xA;end&#xA;&#xA;np = 100;           % # sybmols to plot (last np will be plotted); np &amp;#60; N!&#xA;&#xA;subplot(3,1,1), plot(e.*e), title('error')&#xA;subplot(3,1,2), stem(conv(flipud(w),h)), title('equalized channel impulse response')&#xA;subplot(3,1,3), plot(1:np,s0(N-np+1:N),1:np,yd(N-np+1-Le+1:N-Le+1))&#xA;    title('transmitted and equalized signal'), legend('transmitted','equalized'), axis([0,np,-1.5,2])&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2MSH7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-25T17:46:38.403" LastActivityDate="2015-05-25T17:46:38.403" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="23601" PostTypeId="1" AcceptedAnswerId="23605" CreationDate="2015-05-23T14:32:46.530" Score="7" ViewCount="13295" Body="&lt;p&gt;I have come across modulation techniques that have $\pi/2$ phase shifts from the regular constellations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example $\pi/2 $ BPSK vs constellation the regular BPSK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other examples include $\pi/2 $ QPSK vs. QPSK&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering what are the benefits of phase shifts like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks looking forward for your answers&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-05-24T03:09:49.833" LastActivityDate="2015-05-24T03:09:49.833" Title="BPSK vs $\pi/2$ BPSK, what the benefits?" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23603" PostTypeId="2" ParentId="23599" CreationDate="2015-05-23T14:41:13.590" Score="1" Body="&lt;p&gt;The FFT algorithm is not usually normalized while giving the output. Hence it is not unity.It gives as&#xA;The Fourier transform is taken as &#xA;$$&#xA; F(e^{jw})=\sum x[n] e^{-jwn}&#xA;$$&#xA;Thus you could see the sum of x's when w=0 case instead of normalized one&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-05-23T14:41:13.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23604" PostTypeId="1" CreationDate="2015-05-23T15:38:48.640" Score="0" ViewCount="31" Body="&lt;p&gt;I have peformed different form for input/output relation to determine a system, but seem to be missing some theory which input will be the most will excite enough modes such that the models which i end up with will be accurate.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried Impulse response, step response and sine sweep. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could somebody provide me with some litterature which explains discusses these method, and which one will create an accurate result. &#xA;I feel like the sinesweep is more accurate, most because it has excited all the modes/configuration of the system, and the impulse and step haven't seem to be doing so.. but still litterature would be appriaciated. &lt;/p&gt;&#xA;" OwnerUserId="15907" LastEditorUserId="15907" LastEditDate="2015-05-23T15:44:50.417" LastActivityDate="2015-05-23T15:44:50.417" Title="System indentification different inputs" Tags="|linear-systems|control-systems|system-identification|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23605" PostTypeId="2" ParentId="23601" CreationDate="2015-05-23T16:34:31.507" Score="11" Body="&lt;p&gt;The signal &lt;em&gt;always&lt;/em&gt; changes phase at bit transition times. This makes it easier to achieve bit synchronism at the receiver. In plain BPSK, long runs of 0 or 1, with no phase transitions occurring at the boundary&#xA;between two identical bits, the phase-lock loop that is generating the&#xA;signal telling the receiver where the bit transitions are, can lose lock; or the initial acquisition is more difficult. Also, in satellite channels with nonlinear amplifiers such as traveling-wave-tube (TWT)&#xA;amplifiers, smaller phase transitions are better. In particular, if the RF carrier phase makes&#xA;a transition of $\pi$ radians (meaning the carrier envelope makes a&#xA;transition through the origin), the TWT amplifier output contains&#xA;all the sidebands that were carefully suppressed in the uplink. So,&#xA;filtering in the satellite is required to suppress these sidebands.&#xA;Hence, $\pi/2$-BPSK and $\pi/4$-QPSK are preferred over their plain cousins. Note 4, not 2, with QPSK: $\pi/2$-QPSK does not avoid the&#xA;transitions through $0$, and adds complexity without necessarily&#xA;adding benefits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: in plain BPSK, the signals are $\pm\cos(\omega_0 t)&#xA;= \{\cos(\omega_0 t), \cos(\omega_0t + \pi)\}$, and so,&#xA;at bit transitions, the phase either stays the same, or changes by&#xA;$\pi$. in $\pi/2$-BPSK, the signal set is $\pm\cos(\omega_0 t)$&#xA;for one bit and $\pm\sin(\omega_0 t)$ for the next. Thus,&#xA;&lt;em&gt;regardless of whether we have two successive identical bits&#xA;or two different successive bit,&lt;/em&gt; the signal phase changes by $\pm \pi/2$&#xA;since the signal changes from a cosine to a sine.  Figure out for&#xA;yourself why $\pi/2$-QPSK has transitions through $0$ while&#xA;$\pi/4$-QPSK does not; then think of offset QPSK a little.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-05-23T19:38:44.510" LastActivityDate="2015-05-23T19:38:44.510" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23606" PostTypeId="1" CreationDate="2015-05-23T16:44:50.980" Score="2" ViewCount="371" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Autoregressive_integrated_moving_average&quot; rel=&quot;nofollow&quot;&gt;ARMA&lt;/a&gt;&#xA; models are afaik just filters with transfer function&#xA;$ {MA(z) \over AR(z)}  \equiv {FIR(z) \over IIR(z)} $ .&lt;br&gt;&#xA;However forecasters of stock prices, market trends ...&lt;br&gt;&#xA;seem to be mainly statisticians, with their own vocabulary and culture.&lt;br&gt;&#xA;For example, &quot;signal-to-noise ratio&quot; is rarely mentioned;&#xA;for another, differencing must increase noise.&#xA;Can anyone suggest either&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;textbooks or introductory courses on ARMA forecasting&#xA;from a filter or signal processing point of view&lt;/li&gt;&#xA;&lt;li&gt;websites with real time series and running code to ARMA-model them ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(I'm interested in ARMA models for prediction, not in spectral analysis as such.&#xA;ARMA models may well be wrong for prediction from short, noisy data --&#xA;what will the economy do next year ? --&#xA;hence the need for real examples.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;Added: Some 40 years ago, R.W. Hamming wrote&#xA;in &lt;a href=&quot;https://books.google.com/books?isbn=0486319245&quot; rel=&quot;nofollow&quot;&gt;Digital Filters&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... We have a predicting filter without finding, or even talking about, the transfer function.&#xA;  Statisticians often do this,&#xA;  and neglect to examine the corresponding transfer function of the formula,&#xA;  which can often shed some light on the whole system.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4389" LastActivityDate="2015-06-23T13:39:14.070" Title="Forecasting with ARMA models, from a filter point of view" Tags="|transfer-function|reference-request|autoregressive-model|data-request|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23608" PostTypeId="2" ParentId="23606" CreationDate="2015-05-23T19:54:51.473" Score="3" Body="&lt;p&gt;ARMA divides the signal into two parts and that models the two parts.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Financial time series are corrupted by different types of correlated and uncorrelated noises with definite functions that allow modeling and others more difficult as per having to use aproximations. In addition financial or economic times series may exhibit long memory processes (Black noise) or may have other long range dependencies or other non stationary issues. It is for this reason that besides the MA part it is hard to tell if a series is stochastic or deterministically chaotic or a mix between these.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two terms of ARMA include an autoregresive term and a moving average term. The deterministic part of time series is modeled with ARIMA, ARFIMA etc family of models and the stockastic part using ARCH and GARCH family of models (usually volatility is modeled this way as a large portion of the stockastic part is white noise which can not be forecasted but its variance can).    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Diferenciation as you mention may eliminate some of the signal, however is necesary for regression in many cases as to make a time series weak sense stationary which is a requirement to have a meaningfull and valid regression. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal to noise ratio is hard to guess for any unknonw noise+signal composition. However there are some ways to aproximate this by determining what noises affect your signal and what weights of noise correspond to each signal as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would sugest from a signal procesing point to google / take a look at &quot;financial / non stationary time series signal procesing&quot; papers. There are many methods and ways as to extract information from a signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would sugest from a modeling point of view that you look at ARIMA or GARCH presentations from academia or papers from leading economic schools (LSE etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will also sugest taking a look / google data preprocesing for regression (including the terms of unbalanced data set, stationarity, normality, linearity, aditivity and serial correlation, homocedasticity, spurious regression, cointegration, transformation of variables for financial time series).   &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-05-24T13:38:47.057" LastActivityDate="2015-05-24T13:38:47.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23609" PostTypeId="2" ParentId="23596" CreationDate="2015-05-24T01:57:16.113" Score="3" Body="&lt;p&gt;i don't have any of those products, but evidently the VLC Player does what we call &lt;em&gt;&quot;time-compression&quot;&lt;/em&gt; when you speed up.  and likely &lt;em&gt;&quot;time-expansion&quot;&lt;/em&gt; when you slow down.  together we call those operations &lt;em&gt;&quot;time-scaling&quot;&lt;/em&gt;.  time-scaling and &lt;em&gt;sample-rate-conversion&lt;/em&gt;, together, make a &lt;em&gt;pitch-shifter&lt;/em&gt;.  so a &lt;em&gt;time-scaler&lt;/em&gt; can change tempo without changing pitch, a &lt;em&gt;sample-rate converter&lt;/em&gt; can change tempe and pitch together, and a &lt;em&gt;pitch shifter&lt;/em&gt; can can pitch without changing tempo. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the other products, RPG and Audacity, likely just use the same interpolation we use for sample rate conversion to do the speeding up.   essentially the same as speeding up playback of analog tape.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-05-24T01:57:16.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23611" PostTypeId="1" CreationDate="2015-05-24T11:25:10.003" Score="3" ViewCount="537" Body="&lt;p&gt;I am searching for a matrix definition for converting a audio signal (5.1 with rear) to a audio signal (5.1 with side). &#xA;Currently I am using the definitions from: &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/windows/desktop/ff819070(v=vs.85).aspx&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://msdn.microsoft.com/en-us/library/windows/desktop/ff819070(v=vs.85).aspx&lt;/a&gt;.&#xA;But I am missing the yellow marked matrices:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1gADP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody has got an idea where to get it from?&#xA;EDIT: Would be perfect if someone would have some other matrices else like quadrophonic,...&lt;/p&gt;&#xA;" OwnerUserId="8645" LastEditorUserId="8645" LastEditDate="2015-05-27T18:01:41.403" LastActivityDate="2015-06-02T06:45:05.887" Title="5.1 Rear To 5.1 Side mixing matrix" Tags="|audio|matrix|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23612" PostTypeId="1" CreationDate="2015-05-24T11:33:31.780" Score="0" ViewCount="37" Body="&lt;p&gt;I'm interesting in knowing more about different kinds of data representations that are used for speech data. I know of FFT, but not any others. More precisely, I have the 3 following questions.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What data representations for speech data?&lt;/li&gt;&#xA;&lt;li&gt;What is considered the most 'raw' representation?&lt;/li&gt;&#xA;&lt;li&gt;How has the use of different representations evolved over time?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Simply answering 1 or 2 of the questions would also be great. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15952" LastActivityDate="2015-05-24T13:41:45.677" Title="Data representations for speech data" Tags="|speech-recognition|speech-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23613" PostTypeId="2" ParentId="23612" CreationDate="2015-05-24T13:41:45.677" Score="1" Body="&lt;p&gt;I have seen people use MFCC coefficients for speech related analysis.It is a  done using filter banks and logarithmic scales for representing speech. &lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-05-24T13:41:45.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23614" PostTypeId="1" CreationDate="2015-05-24T13:51:33.070" Score="0" ViewCount="821" Body="&lt;p&gt;I'll try to be as brief as possible. I have very limited signal processing experience. I have a data set that consists of essentially a big old sine function (with deviations from ideality), and lots of high-frequency noise (what I don't want). I desiced on a low pass filter because it doesn't change amplitude much or significantly shift peak/band locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I played around with QTIplot (scientific plotting soft-ware) and found I can smooth the dataset quite well by simply doing a FFT Low pass filter with a  1Hz cut-off (seem image below).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8VBWV.png&quot; alt=&quot;Raw signal vs processed signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I looked at the source code in QTI plot to get an idea of how they implemented it. It turns out it's a brick wall algorithm. Their code goes like this - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//(C) 2007 - 2008 by Ion Vasilief, Knut Franke&#xA;&#xA;double df = 1.0/(double)(d_n*(x[1]-x[0]));//Sampling frequency&#xA;gsl_fft_real_workspace *work = gsl_fft_real_workspace_alloc(d_n);&#xA;gsl_fft_real_wavetable *real = gsl_fft_real_wavetable_alloc(d_n);&#xA;gsl_fft_real_transform (y, 1, d_n, real, work);//FFT forward&#xA;gsl_fft_real_wavetable_free (real);&#xA;...&#xA;//Brick wall&#xA;for (int i = 0; i &amp;lt; d_n &amp;amp;&amp;amp; ((i+1)/2)*df &amp;lt; d_low_freq; i++)&#xA;    y[i] = 0;&#xA;break;&#xA;gsl_fft_halfcomplex_wavetable *hc = gsl_fft_halfcomplex_wavetable_alloc(d_n);&#xA;gsl_fft_halfcomplex_inverse (y, 1, d_n, hc, work);&#xA;gsl_fft_halfcomplex_wavetable_free (hc);&#xA;gsl_fft_real_workspace_free (work);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I borrowed from their code but translated it into JAVA and decided on using the JTransforms FFT library. The JTransforms FFT library leaves the first two index positions for storage of the transform and the rest of the indices are alternating Re, Im components (&quot;Bins&quot;). &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    int size = recievedData.size();&#xA;    DoubleFFT_1D fftDo = new DoubleFFT_1D(recievedData.size());&#xA;    double fft[] = new double[size*2];&#xA;    fftDo.realForwardFull(fft);&#xA;    double df = 1.0/(((double)size)*(0.027413951));&#xA;    for(int i = 2; i &amp;lt; 2*size &amp;amp;&amp;amp; (((double)i+1.00)/2.00)*df &amp;lt; cutOffFreq; i++){&#xA;        fft[i] = 0.0;&#xA;    }&#xA;    fftDo.complexInverse(fft, false);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now when I run my code I see no real noise reduction. Sometimes I see the minima of my signals increase to some weird baseline, if I allow the FFTinverse to scale my code sometimes I see all blocks. Ultimately it seems the code does little to nothing to my signal, while the QTIPlot code is exactly what I want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a couple questions:&#xA;- What am I doing wrong in my code? Or is it the library differences (GSL vs JTransforms)? &#xA;- Is there a better way to do this kind of filtering? If so can you take me to a resource to learn how it's implemented. I read about using masks everywhere but could not find a single example of them that wasn't &quot;hard-coded&quot;, IE: my data may be dynamic. Seems most people who did masks like to show pictures but not detail how to implement them even in lecture powerpoints from universities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also this is not for homework or anything I'm just playing around with an electronics project.&lt;/p&gt;&#xA;" OwnerUserId="15953" LastEditorUserId="1849" LastEditDate="2015-05-24T15:46:45.983" LastActivityDate="2015-05-24T15:46:45.983" Title="FFT &quot;Brick Wall&quot; Low Pass Filter Not Smoothing Output" Tags="|fft|lowpass-filter|java|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23615" PostTypeId="2" ParentId="23614" CreationDate="2015-05-24T14:09:49.727" Score="1" Body="&lt;p&gt;Sorry for the post I just solved it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem was I was using a full transform. The half-transform utilizes a symmetry condition and for some reason works infinitely better! &lt;/p&gt;&#xA;" OwnerUserId="15953" LastActivityDate="2015-05-24T14:09:49.727" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23616" PostTypeId="1" CreationDate="2015-05-24T14:50:22.060" Score="3" ViewCount="479" Body="&lt;p&gt;I'm currently working on a project that requires me to classify sleep stages (Awake W, N1, N2, N3 and REM) based on only an EEG. Various algorithms and classifying standards (such as Rechtschaffen &amp;amp; Kales or AASM) actually require EMG and EOG in order to distinguish from REM sleep and wakefulness, which I don't have. Additionally, most algorithms use techniques such as Wavelet analysis, ICA, Neural Networks and such, but I have only learned up to Fourier Transform. Which means that I have to detect and classify these stages and their components (detect sleep spindles in order to classify N2, for example) based on only frequency analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Power spectra analysis is poor since low frequency components tend to have high powers so the program ends up over-classifying 30s epochs as deep sleep stages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a .txt file telling me exactly what's going on in every 30s epoch, so I have &lt;em&gt;a priori&lt;/em&gt; knowledge regarding when is the subject awake or asleep (and which sleep stages the subject is in). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate any insight into this problem.&lt;/p&gt;&#xA;" OwnerUserId="15954" LastActivityDate="2015-11-04T20:04:53.100" Title="Classifying sleep stages from only EEG" Tags="|fourier-transform|frequency-spectrum|power-spectral-density|eeg|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23617" PostTypeId="1" CreationDate="2015-05-24T15:31:49.013" Score="1" ViewCount="4701" Body="&lt;p&gt;I tried to find the stopband edge frequency.I know that the signal amplitude falls to -3 dB below the passband edge frequency.I examine a lot of DSP books so i don't any information about how to calculate stopband edge frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mhCdA.jpg&quot; alt=&quot;Low Pass Filter&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15541" LastActivityDate="2015-05-26T15:28:24.103" Title="Find Stopband Edge Frequency" Tags="|filters|filter-design|frequency|lowpass-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23618" PostTypeId="2" ParentId="23617" CreationDate="2015-05-24T15:46:09.977" Score="-1" Body="&lt;p&gt;&lt;strong&gt;edit:&lt;/strong&gt; This is for passband edge frequency.&lt;br&gt;&#xA;One Way the cutoff frequency can be calculated as:&#xA;consider H(jw) normalized filter transfer function&#xA;$$&#xA; H(jw)=\frac{V_0(jw)}{V_i(jw)}&#xA;$$&#xA;Here the 3dB frequency is when H(jw) is 1/sqrt(2) time the max value.Then it is finiding the values omega which satisfies the below equation&#xA;$$&#xA;H(jw)=\frac{1}{\sqrt2}&#xA;$$&#xA;This we can see when we take logarithm of 1/sqrt(2) we get approximately -3dB&lt;/p&gt;&#xA;" OwnerUserId="11819" LastEditorUserId="11819" LastEditDate="2015-05-26T15:28:24.103" LastActivityDate="2015-05-26T15:28:24.103" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23619" PostTypeId="2" ParentId="23583" CreationDate="2015-05-24T15:57:15.913" Score="-3" Body="&lt;p&gt;You used to low-order filter(2nd order). This can be reason that composing high ripples at starting frequency points.I think you can increase the order of filter and try it on your design.&lt;/p&gt;&#xA;" OwnerUserId="15541" LastActivityDate="2015-05-24T15:57:15.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23620" PostTypeId="2" ParentId="23617" CreationDate="2015-05-24T16:44:07.050" Score="2" Body="&lt;p&gt;In general there is no standard way to calculate the stop band edge, other than specifying a desired stop band attenuation and checking at which frequency this attenuation is first attained (for a low pass filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For filters with an equiripple behavior in the stop band (e.g. FIR filters designed by the Remez exchange algorithm, or Chebyshev II and elliptic IIR filters), there is a clear stop band edge, which is the lowest frequency (for low pass filters) at which the attenuation equals the minimum stop band attenuation (attained at the local maxima of the filter's magnitude response in the stop band).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, your filter looks like it has a monotonic magnitude response, so the definition of the stop band edge is arbitrary.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-24T21:32:35.493" LastActivityDate="2015-05-24T21:32:35.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23621" PostTypeId="1" CreationDate="2015-05-24T22:34:59.850" Score="5" ViewCount="708" Body="&lt;p&gt;I am new to signal processing and would really appreciate your help. happy to provide more context/details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my research, I have a system that has many sensors $X_1, \ldots, X_N$ and using this information, the system makes a prediction on a value, $A$. For simplicity, let's assume that $A$ is binary, and please keep in mind that this is a real system I am trying to improve so that means that I can tell whether $A$ was right or wrong (the system can be checked against &quot;ground truth&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now each sensor makes measurement sporadically (not necessarily randomly, but definitely not some obvious pattern) for reasons that are too complicated to go into right now. This means that $X_1$ for example can resemble this: $[\textrm{2, 5, 1, na, na, 1, na, na, 89, $\dots$}]$ where each index of this vector is a time step, and $\textrm{'na'}$ represents times when the sensor did not take a measurement. This means that the vector actually contains two sets of information: the value of each individual measurement, and when the measurements were done. There is a third value (but maybe that's not important for now) which is about how much effor each sensor put into collecting this information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my problem is that I want to measure the dependence between $X$'s. i.e. given a specific vector of measurement from, say, $X_4$, what is the probability that $X_{10}$ was influenced by $X_4$. Specifically, I am looking for a number (could be a probability, or a correlation coefficient) that would say that $X_{10}$ was influenced by $X_4$, and I want this number for all pairs of $X$'s. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am trying to do is to factor in these influences into the system that is trying to make a decision. Since I know the ground truth, I can tell how good my &quot;dependence measure&quot; is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have zero background in signal analysis and I thought that you all might know something here. I think this is an interesting general problem and I would really appreciate some help.&lt;/p&gt;&#xA;" OwnerUserId="15957" LastEditorUserId="1629" LastEditDate="2016-06-14T23:30:51.737" LastActivityDate="2022-04-17T06:08:05.737" Title="Finding dependence between two sparse signals" Tags="|cross-correlation|correlation|sensor|independence|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23622" PostTypeId="1" AcceptedAnswerId="23629" CreationDate="2015-05-25T04:14:11.547" Score="1" ViewCount="3203" Body="&lt;p&gt;This question is regarding applying minimum mean square operation at the receiver side of communication system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read in paper that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given an output signal from communication system $$R(k)= H(k)S(k) + N(k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;an MMSE filter $$G(k)= \frac{H^*(k)}{|H(k)|^2+\frac{\sigma_n^2}{\sigma_s^2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My incomplete solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think we need to find G(K) such that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbb{E}[G(k)H(k)S(k)+G(k)N(k)- S(k)]^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how should I continue, thanks alot.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastActivityDate="2015-05-25T14:12:33.870" Title="MMSE Equalizer in communication system" Tags="|digital-communications|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23624" PostTypeId="1" CreationDate="2015-05-25T06:21:03.517" Score="1" ViewCount="188" Body="&lt;p&gt;I am trying to make tracking for soccer player, I need to detect features from this player and then estimate the distance difference of these pixels over number of frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;first I have to detect the main features of the player and then match them to those in the next frames, then calculate the distance difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem, there is no good feature detector at MATLAB to my case, these sample from the existing detectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FAST&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/itwyn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Harris&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QkAxU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SURF&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vePlE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q: I see that I can improve feature detector by doing preprocessing such like:&#xA;adaptive thresholding, opening &amp;amp; closing and sharping to highlight the player edges.&#xA;I have do the first one to make adaptive threshloding, and then make the feature detector for the output logical image, such like the following&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;After adaptive thresholding Harris, for logical image&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YY4s5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to make the feature detector on gray image after thresholding but I couldn't change logical image to gray image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also any suggestion or alternative approach to do? &lt;/p&gt;&#xA;" OwnerUserId="15950" LastActivityDate="2015-05-25T06:21:03.517" Title="pre-processing to improve feature detector before tracking" Tags="|image-processing|computer-vision|local-features|preprocessing|tracking|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23626" PostTypeId="1" CreationDate="2015-05-25T07:49:31.883" Score="4" ViewCount="19201" Body="&lt;p&gt;What is the difference between wide sense and strict sense stationary processes (SP) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the definition (by Heinrich Meyr, Marc Moeneclaey, Stefan A. Fechtel in ￼&quot;Synchronization, Channel Estimation, and Signal Processing&quot;) : &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;strict-sense SP = not time dependent&lt;/li&gt;&#xA;&lt;li&gt;wide-sense SP = not dependent on variable t (time)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Could someone please illuminate what this really means ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps pointing out a good book in which the difference is explained ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an SP is not dependent on variable t (time) then &lt;strong&gt;how can it depend on time&lt;/strong&gt; ( a process which is not strict sense stationary but wide sense stationary)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Could you give an example of such a process ?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why and when is making this difference useful/neccessary?&lt;/p&gt;&#xA;" OwnerUserId="15960" LastEditorUserId="15960" LastEditDate="2015-05-25T07:58:24.963" LastActivityDate="2021-03-07T11:23:04.840" Title="What is the difference between wide sense and strict sense stationary processes?" Tags="|theory|stationary|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23628" PostTypeId="1" CreationDate="2015-05-25T09:02:52.757" Score="0" ViewCount="1019" Body="&lt;p&gt;I'm designing a camera system to use a 5MP CMOS image sensor with a micro controller board. In order to select proper components I'm looking for some numbers. It would be very appreciated if you give me advices. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is this. If I take a picture with resolution of 2592 x 1944, frame rate of 1 fps and the format of image data is 32 bit RGB, then how fast cpu and how large memory would you need? When I calculated the bitrate, it's like the followings &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;data size of one frame&lt;br&gt;&#xA;number of pixel = 2592 x 1944 = 5,038,848 &#xA;data size of one frame = 32 bit x 5,038,848 = 161,243,136 bit = 157,464 byte&#xA;(And I confirmed this size with raspberry pi camera)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;data transfer &#xA;Now I need to transfer the frame data to my flash memory. But I would take just one cut with long exposure time. In other words, I don't need to take 2 or 3 pictures for short time. It would be enough to take just 1 image for 1 hour. Let's say I take 1 picture for 1 seconds and don't take any pictures anymore. Then, &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;bitrate = 161,243,136 bit/s = 157,464 byte/s = 15.4MB/s &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't go ahead with this number. Does it mean that I need a RAM larger than 15.4MB to save the frame for a moment? Or is it possible to use 2MB to transfer the data to hard disk or some storage, even it's slow? I couldn't find any information by googling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, I wonder how fast processor I need. For example, do I need 200MHz processor? or is it enough to have 15MHz processor like arduino? I have no idea. Please help me. &lt;/p&gt;&#xA;" OwnerUserId="15961" LastActivityDate="2015-05-25T09:02:52.757" Title="Requirement on processor and memory for image processing" Tags="|camera|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23629" PostTypeId="2" ParentId="23622" CreationDate="2015-05-25T10:32:40.733" Score="3" Body="&lt;p&gt;For simplicity of notation I'll leave out the index $k$. You've already noted that the error is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E=R\cdot G-S=S(HG-1)+NG\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The MSE can be computed by integrating the power spectrum of the error. Since the power spectrum is real-valued and non-negative, its integral (i.e., the MSE) can be minimized by making the power spectrum as small as possible. Assuming white data and white noise with powers $\sigma_s^2$ and $\sigma_n^2$, respectively, which are independent of each other, we can compute the error power spectrum from (1) as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_E=\sigma_s^2|HG-1|^2+\sigma_n^2|G|^2\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expression for the equalizer response $G$ that minimizes (2) can be found in an elegant way by completing the square in (2):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_E=(\sigma_s^2|H|^2+\sigma_n^2)\left|G-\frac{H^*}{|H|^2+\frac{\sigma_n^2}{\sigma_s^2}}\right|^2+\frac{\sigma_n^2}{|H|^2+\frac{\sigma_n^2}{\sigma_s^2}}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expression (3) can be minimized by choosing $G$ such that the left-hand term vanishes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_{opt}=\frac{H^*}{|H|^2+\frac{\sigma_n^2}{\sigma_s^2}}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the optimal MMSE solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not immediately obvious that (2) and (3) are identical, but proving their equivalence is simple (yet tedious) by multiplying both expressions out and comparing them.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-25T14:12:33.870" LastActivityDate="2015-05-25T14:12:33.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23630" PostTypeId="2" ParentId="23622" CreationDate="2015-05-25T10:56:31.023" Score="3" Body="&lt;p&gt;Assume that your $G(k)=W(k)R(k)$, that is, a constant multiple of $R(k)$. Then, according to the MMSE theory, the error $S(k)-G(k)$ is orthogonal to $R(k)$. In analytical terms, this means that&#xA;\begin{equation}&#xA;\mathbb{E}[(S(k)-G(k))R^*(k)]=0&#xA;\end{equation}&#xA;On expanding the terms in the above equation we get &#xA;\begin{equation}&#xA;\mathbb{E}[S(k)R^*(k)]=\mathbb{E}[G(k)R^*(k)]\\&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now,&#xA;\begin{equation}&#xA;\mathbb{E}[S(k)R^*(k)]=H^*(k)\sigma^2_s\\&#xA;\end{equation}  and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\begin{split}&#xA;\mathbb{E}[G(k)R^*(k)]&amp;amp;=\mathbb{E}[W(k)R(k) (H^*(k)S^*(k)+N^*(k))]\\&#xA;&amp;amp;=W(k)\mathbb{E}[(H(k)S(k)+N(k)) (H^*(k)S^*(k)+N^*(k))]\\&#xA;&amp;amp;=W(k)(|H(k)|^{2}\sigma^2_s+ \sigma_n^2)\\&#xA;\end{split}&#xA;\end{equation} &#xA;And therefore from second equation, &#xA;\begin{equation}&#xA;H^*(k)\sigma^2_s = W(k)(|H(k)|^{2}\sigma^2_s+ \sigma_n^2)&#xA;\end{equation}&#xA;from which the filter $W(k)$ can be readily derived.&lt;/p&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2015-05-25T10:56:31.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23632" PostTypeId="1" CreationDate="2015-05-25T12:37:23.443" Score="0" ViewCount="644" Body="&lt;p&gt;As a design input for an low-pass FIR filter I have 6dB@1.6kHz, 24 dB/oct, sample frequency 48kHz. I need to specify phase response, and for that I need a phase slope. I have found, &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Linear_Phase_Filters_Symmetric_Impulse.html&quot; rel=&quot;nofollow&quot;&gt;from Julius O. Smith web page&lt;/a&gt;, that the phase slope = (N-1)/2 where N is number of taps. What is the way to determine the optimal number of taps? I am aware of Kaiser formula, but I don't have ripple, passband and stopband frequencies that figure in the formula. I need the number of taps to calculate phase slope. Is there any other way to calculate, specify phase from my input requirements?&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="15718" LastEditDate="2015-05-26T12:39:44.257" LastActivityDate="2015-05-26T12:39:44.257" Title="FIR Filters: determining optimal number of taps and phase slope" Tags="|filters|dsp-core|finite-impulse-response|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23633" PostTypeId="1" AcceptedAnswerId="23775" CreationDate="2015-05-25T14:12:30.440" Score="0" ViewCount="312" Body="&lt;p&gt;This is a soft question. The frequency domain has made revolution in the field of Mathematics,  Digital Signal and Image Processing etc. Some of concepts which are very difficult to analyse in spatial or time domain can be very easily understood in the frequency domain using theorems like Fourier transform &amp;amp; series, wavelets, Laplace transform, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, I am doing under graduation in 4 years Electronics and Telecommunication Engineering. We have semester pattern system (2 semesters in 1 year). In the 3rd semester, we have subject named &quot;Signals and Systems&quot; under which the above topic is covered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my experience is that when it is being taught in the academic curriculum or course, it is not given as much importance as it has to be. Most of the teachers or professors don't know how teach this topic. They teach with the help of ready-made PowerPoint presentations (e.g. for Laplace transform, single PPT which is mostly downloaded from internet) and sometimes they take chalk in their hand. So the students like us get hardly any knowledge about the frequency domain in academic course compared to discussions in the forum like the very useful &lt;a href=&quot;http://www.DSP.stackexchange.com&quot; rel=&quot;nofollow&quot;&gt;http://www.DSP.stackexchange.com&lt;/a&gt; and &lt;a href=&quot;http://www.math.stackexchange.com&quot; rel=&quot;nofollow&quot;&gt;http://www.math.stackexchange.com&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can anybody give explanation about how to effectively teach topic of frequency domain? You can also explain with the help of any subtopic like Fourier domain , Laplace or wavelets etc.&#xA;So that all of us would study this difficult topic with interest.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2015-06-03T03:14:45.417" LastActivityDate="2015-06-03T03:14:45.417" Title="How to effectively teach topic of frequency domain?" Tags="|frequency-domain|teaching|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23634" PostTypeId="1" AcceptedAnswerId="23645" CreationDate="2015-05-25T14:35:37.547" Score="5" ViewCount="115" Body="&lt;p&gt;I am looking for the concept about how to estimate standard deviation.&lt;/p&gt;&#xA;&lt;p&gt;Actually I'm not sure how can I get a concept the estimate standard deviation ?&lt;/p&gt;&#xA;&lt;p&gt;If you know the concept, then would you let me know it here?&lt;/p&gt;&#xA;&lt;p&gt;Also if you have any reference or examples, it will be help to me.&lt;/p&gt;&#xA;&lt;p&gt;p.s. Is this different between &amp;quot;estimate standard deviation&amp;quot; and &amp;quot;estimated standard deviation&amp;quot; ? I think it seems to the same.&lt;/p&gt;&#xA;&lt;h1&gt;Updated&lt;/h1&gt;&#xA;&lt;p&gt;What does different between &amp;quot;Method of Least Squares&amp;quot; and &amp;quot;estimate standard deviation&amp;quot;?&lt;/p&gt;&#xA;&lt;p&gt;Are those the same concept? I don't know estimate standard deviation.&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="7092" LastEditDate="2021-03-15T11:25:31.980" LastActivityDate="2022-02-06T12:25:24.460" Title="Concept About Estimated Standard Deviation" Tags="|image-processing|filters|estimation|statistics|parameter-estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23635" PostTypeId="5" CreationDate="2015-05-25T14:36:16.370" Score="0" Body="&lt;p&gt;Digital Signal Processing education consists in the practice of teaching and learning Digital Signal Processing, along with the associated research. Research in Digital Signal Processing concerns the tools, methods and approaches that facilitate the practice of Digital Signal Processing or the study of this practice.&lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-05-25T20:12:27.290" LastActivityDate="2015-05-25T20:12:27.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23636" PostTypeId="4" CreationDate="2015-05-25T14:36:16.370" Score="0" Body="Digital Signal Processing education consists in the practice of teaching and learning Digital Signal Processing, along with the associated research. Research in Digital Signal Processing concerns the tools, methods and approaches that facilitate the practice of Digital Signal Processing or the study of this practice." OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-05-25T21:28:00.387" LastActivityDate="2015-05-25T21:28:00.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23640" PostTypeId="1" CreationDate="2015-05-25T15:42:35.430" Score="-3" ViewCount="578" Body="&lt;p&gt;The Fourier decomposition explains a time series entirely as a weighted sum of sinusoidal functions and with the Fourier series,it is possible to do it.&lt;/p&gt;&#xA;&lt;p&gt;But I have some doubts&lt;/p&gt;&#xA;&lt;p&gt;Suppose ,for any  signal we want to perform its Fourier decomposition&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;As we have to create any signal with finite number (&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;)of elementary signals .So how ( in  Fourier decomposition ) to decide value of (&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;)?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, How  to take into consideration the  3 important changing factors of the elementary  signals i.e. phase, frequency and amplitude while performing Fourier decompositon ?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-05-25T16:31:46.493" Title="How Fourier decomposition is performed?" Tags="|signal-analysis|fourier-transform|frequency-domain|fourier-series|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23642" PostTypeId="1" AcceptedAnswerId="23644" CreationDate="2015-05-25T16:22:04.840" Score="2" ViewCount="8345" Body="&lt;p&gt;In communication systems with high data rates, Intersymbol Interference (ISI) is a major problem (ISI). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read in books that one way to combat this problem is to use &lt;em&gt;time domain equalizers (ZF, MMSE, DFE) at the receivers or frequency domain equalizers (ZF, MMSE).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am just here to ask whether my understanding is correct. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are we using the equalizers to &lt;strong&gt;compensate for the channel&lt;/strong&gt; impulse response (in case time domain) or channel transfer function (frequency domain equalizers) and therefore we are combating ISI? &lt;/li&gt;&#xA;&lt;li&gt;If yes, why is it that by compensating for the channel we are getting rid of ISI?&lt;/li&gt;&#xA;&lt;li&gt;In order to obtain this time domain filter or transfer function we should have estimated the channel before hand? &lt;/li&gt;&#xA;&lt;li&gt;Is the &lt;strong&gt;output  of the equalizers&lt;/strong&gt; are estimated symbols of what has been transmitted?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would appreciate helping me out in this confusion of ideas maybe with an example. &lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="4298" LastEditDate="2018-08-08T18:36:07.643" LastActivityDate="2018-08-08T18:36:07.643" Title="Use of equalizers in communication systems for Intersymbol Interference" Tags="|digital-communications|equalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23643" PostTypeId="2" ParentId="23640" CreationDate="2015-05-25T16:25:18.173" Score="2" Body="&lt;p&gt;To understand the Fourier pedagogy, first you have to deal with periodic functions.  Only periodic functions, at first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t+P) = x(t) \quad \text{for all } t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That has period of $P$ (and also a period of $2P$ and $3P$, but we won't worry about that for the time being).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier (and Euler) postulate that this other periodic function of the same period can, within a certain limit, approach the periodic $x(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \sum\limits_{n=-\infty}^{+\infty} c_n e^{j 2 \pi \frac{n}{P} t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, &lt;strong&gt;given that postulate&lt;/strong&gt;, the Fourier coefficients, $c_n$, come out to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ c_n = \frac{1}{P}\int\limits_{t_0}^{t_0+P} x(t) e^{-j 2 \pi \frac{n}{P} t} \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this only decomposes periodic $x(t)$.  To decompose a non-periodic $x(t)$, you have to approximate that with a periodic $x(t)$ with an extremely long period (i think in electronics, a period of a year would more than suffice) and then, in a limit, let that period go to infinity.  I guess with an infinitely long period, a periodic function would no longer be periodic.  This is what leads to the Fourier integral and is another big mathematical effort.  But the OP should get this down first.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-05-25T16:31:46.493" LastActivityDate="2015-05-25T16:31:46.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23644" PostTypeId="2" ParentId="23642" CreationDate="2015-05-25T16:37:53.550" Score="5" Body="&lt;p&gt;A (linear) equalizer tries to compensate for the (linear) filtering effect of the channel. This filtering introduced by the channel creates intersymbol interference (ISI), so the goal of the equalizer is to reduce (or, ideally, eliminate) ISI, such that the symbol error rate is reduced to an acceptable level. Linear filtering creates ISI by smearing out the symbols over more than one symbol period, making neighboring symbols interfere with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time-domain and frequency-domain equalizers are just specific implementations of equalizers, their basic function is the same. Furthermore, compensating for the impulse response of the channel is the same as compensating for its transfer function because impulse response and transfer function are just two different descriptions of the same phenomenon: linear distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unknown channels can be estimated, but usually &lt;em&gt;adaptive&lt;/em&gt; equalizers are used, which can adapt to unknown and/or time-varying channel characteristics. Usually, a training sequence of known symbols is used for an initial adaptation of the equalizer. There are also methods that do not require a training sequence; these methods are referred to as &lt;em&gt;blind&lt;/em&gt; equalization (e.g. constant modulus algorithm).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the equalizer is indeed an estimate of the transmitted signal; the final decision is done by the slicer following the equalizer.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-25T16:37:53.550" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23645" PostTypeId="2" ParentId="23634" CreationDate="2015-05-25T17:20:26.707" Score="3" Body="&lt;p&gt;Given data &lt;span class=&quot;math-container&quot;&gt;$ { \left\{ {x}_{i} \right\} }_{i = 1}^{N} $&lt;/span&gt; the Empirical STD of the data is well defined:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ STD = \sqrt{ \frac{1}{N - 1} \sum_{i = 1}^{N} { \left( {x}_{i} - \bar{x} \right) }^{2} } $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$ \bar{x} $&lt;/span&gt; is the empirical mean of the data given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \bar{x} = \frac{1}{N} \sum_{i = 1}^{N} {x}_{i} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, if there's a model on the data (Such as signal and noise with certain CDF) the empirical calculation should be altered accordingly.&lt;/p&gt;&#xA;&lt;p&gt;For instance, given a signal which is linear with AWGN the STD of the noise can be estimated by removing the linear estimated signal first.&lt;/p&gt;&#xA;&lt;h3&gt;Update&lt;/h3&gt;&#xA;&lt;p&gt;There are 2 classic estimator of the Standard Deviation (Also for Variance):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Unbiased Estimator: &lt;span class=&quot;math-container&quot;&gt;$ \sqrt{ \frac{1}{N - 1} \sum_{i = 1}^{N} { \left( {x}_{i} - \bar{x} \right) }^{2} } $&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The Biased (Maximum Likelihood) Estimator: &lt;span class=&quot;math-container&quot;&gt;$ \sqrt{ \frac{1}{N} \sum_{i = 1}^{N} { \left( {x}_{i} - \bar{x} \right) }^{2} } $&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-02-06T12:25:24.460" LastActivityDate="2022-02-06T12:25:24.460" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23646" PostTypeId="1" CreationDate="2015-05-25T18:23:14.470" Score="6" ViewCount="3468" Body="&lt;p&gt;What kind of pros and cons does these method for identifying a system have?&#xA;I seem to have a hard time finding literature discussion in this issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I am operating on a linear system, or the linear area of the system. So non linearity isn't an issue here.&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="15908" LastEditorUserId="11684" LastEditDate="2015-05-27T10:11:10.200" LastActivityDate="2015-05-28T06:53:19.477" Title="Sine sweep vs impulse response" Tags="|frequency-response|impulse-response|system-identification|" AnswerCount="3" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="23647" PostTypeId="1" AcceptedAnswerId="23764" CreationDate="2015-05-25T19:30:17.183" Score="2" ViewCount="199" Body="&lt;p&gt;Considering an FIR system excited by an input $s_n$. If the input is derived from a mapping, and a +1/-1 BPSK signal is derived. Considering the Constant Modulus Algorithm (CMA). The channel is modeled as an FIR. If the received signal is fed to the equalizer, the output is : $y_n = w^T(n) x_n$ where $w^T$ is the equalizer tap vector. The update equation for weights $w_{n+1} = w  - \mu \Delta J(w)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will there be a modification in the derivation of the CMA and the update rule? &lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="750" LastEditDate="2015-05-29T15:44:05.447" LastActivityDate="2015-05-29T15:44:05.447" Title="Help in deriving the update rule for equalizer" Tags="|adaptive-filters|equalization|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="23648" PostTypeId="1" CreationDate="2015-05-25T19:33:20.980" Score="2" ViewCount="666" Body="&lt;p&gt;In Orthogonal frequency division multiplexing (OFDM), data symbols are modulated using an N pt-IFFT operation to produce ONE output OFDM &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume we have total of $N$ QAM symbols which are input to the IDFT operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is the output time domain samples $X_k$ also of length $N$ in length? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If ONE data QAM symbol has symbol duration $T$, is ONE OFDM symbol of symbol duration $T$ or is one SAMPLE of the OFDM symbol of duration $T$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks looking forward for your answers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example of OFDM modulator is the one used in LTE, in particular the subcarrier bandwidth is 15 KHz, and the OFDM symbol (and not one sample of the OFDM symbol) is 1/15k = 66.67 $\mu $ sec which is equal to the transmission time of one symbol (for example 1 QAM) over one subarrier. If my understanding is correct than the answer provided below is wrong. Can somoeone please double check?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-05-26T02:52:36.833" LastActivityDate="2015-05-27T08:30:48.413" Title="General questions regarding OFDM modulation" Tags="|digital-communications|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23649" PostTypeId="1" CreationDate="2015-05-25T21:37:36.403" Score="1" ViewCount="565" Body="&lt;p&gt;HeartMath Institute calculates a coherence score for heart rate variability by giving a score to how sinusoidal wave-like the instantaneous heart rate signal is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://store.heartmath.org/s.nl/ctype.KB/it.I/id.585/KB.623/.f&quot; rel=&quot;nofollow&quot;&gt;http://store.heartmath.org/s.nl/ctype.KB/it.I/id.585/KB.623/.f&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What DSP techniques can be used to calculate how sinusoidal a signal is, in a manner similar to score used above?&lt;/p&gt;&#xA;" OwnerUserId="3631" LastActivityDate="2015-05-26T09:23:41.773" Title="Determining how similar a signal is to a sine wave" Tags="|algorithms|coherence|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23650" PostTypeId="1" AcceptedAnswerId="23672" CreationDate="2015-05-25T22:29:49.607" Score="0" ViewCount="393" Body="&lt;p&gt;Assuming we have time domain signal $$x(t)\,\,\,\,\,\,\, 0\leq t&amp;lt; T$$ and we decide to upsample the signal by factor $L\geq1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the samples of this oversampled time domain signal are represent as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(kT/L)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read in paper that setting $L=1$ corresponding to the case of Nyquist rate sampling, does anyone know why this is case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $L=4$ how many zeros are padded to obtained the upsampled signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I provided the text that made me ask the question in first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sAIZv.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1Rhyv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-05-26T02:48:49.080" LastActivityDate="2015-05-27T08:26:57.590" Title="Nyquist rate and oversampling" Tags="|digital-communications|digital|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23651" PostTypeId="1" AcceptedAnswerId="23654" CreationDate="2015-05-26T01:08:42.967" Score="0" ViewCount="1141" Body="&lt;p&gt;I am using scipy.io.wavfile to read a WAV file and playing it with pyaudio. Before the numpy array is written to a string and output through pyaudio, I would like to be able to apply some sort of function (sin, cos, etc.) to the 16-bit numpy array. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any experience doing something like this? Should I convert to float, apply the function to the float data, then convert back? I am also aware of fixed point arithmetic, but not sure if I can apply it here.&lt;/p&gt;&#xA;" OwnerUserId="11102" LastActivityDate="2015-07-25T04:29:19.377" Title="Applying a mathematical function to a 16-bit Python array" Tags="|audio|signal-analysis|python|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23652" PostTypeId="2" ParentId="23648" CreationDate="2015-05-26T01:16:43.523" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The output time domain samples are also of same length $N$. Your figure shows a part of a OFDM receiver. At the OFDM transmitter, IFFT is used. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One OFDM symbol duration is $NT$ and obviously one sample of the OFDM symbol has a duration $T$.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2015-05-26T01:16:43.523" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23653" PostTypeId="2" ParentId="23649" CreationDate="2015-05-26T03:30:22.673" Score="0" Body="&lt;p&gt;Look into cross-correlation. The heartbeat signal can be one side of the correlation, and a sinusoid of interest can be another. Also auto-correlation (cross-correlation of the heartbeat signal with itself) can give you some about the periodicity of the wave form and in particular what the fundamental frequency of beating may be.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-05-26T03:30:22.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23654" PostTypeId="2" ParentId="23651" CreationDate="2015-05-26T03:45:52.233" Score="1" Body="&lt;p&gt;If you're doing ANY audio signal processing in python, I heartily recommend &lt;a href=&quot;https://github.com/bmcfee/librosa&quot; rel=&quot;nofollow&quot;&gt;librosa&lt;/a&gt;. Your scipy route will work (read as float, process, playback), but it is less direct. Also, I recommend sticking with float, as fixed-point work is more relevant if your code is running on an embedded/mobile system sans-FPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can &lt;strong&gt;&lt;em&gt;pip install librosa&lt;/em&gt;&lt;/strong&gt; and get applying math functions quickly. Check out the &lt;a href=&quot;http://nbviewer.ipython.org/github/bmcfee/librosa/blob/master/examples/LibROSA%20demo.ipynb&quot; rel=&quot;nofollow&quot;&gt;introduction ipython notebook&lt;/a&gt;. Additionally, if you're doing more serious work, there is great integration with &lt;a href=&quot;http://nbviewer.ipython.org/github/bmcfee/librosa/blob/master/examples/LibROSA%20sklearn%20feature%20pipeline.ipynb&quot; rel=&quot;nofollow&quot;&gt;scikit-learn&lt;/a&gt; machine learning pipelines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get you started your code might look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import librosa&#xA;import numpy as np&#xA;&#xA;# Load the example track&#xA;y, sr = librosa.load(&quot;myfile.wav&quot;)&#xA;&#xA;# apply mathematical functions or processes to 'y' here:&#xA;&#xA;# If you do this in an ipython notebook (highly recommended as a interactive python env), &#xA;# you can play back in one line!&#xA;IPython.display.Audio(data=y, rate=sr)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-05-26T03:45:52.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23655" PostTypeId="1" CreationDate="2015-05-26T04:08:18.983" Score="0" ViewCount="1011" Body="&lt;p&gt;This is probably a really basic question but I'm a little stumped and would appreciate some practical input on how to go about doing this rather than reading dockets of equations semi-related to what I am doing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So say I have data which is largely reminiscent of a sine wave. I do an forward Fourier transform and low pass filter it to remove some noise. Is it possible to then find the phase or shift of the remaining sine wave with the transformed data in the frequency domain before performing the inverse transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some reading and it looks like the phase shift information is stored in the imaginary part of the transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've written two algorithms for finding the phase shift in the time domain, but they are clunky and unfortunately unreliable. Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I'm not specifically asking for the answer but keywords to research, or places to find information would be highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15953" LastActivityDate="2015-05-26T04:08:18.983" Title="Sine wave phase shift from Fourier Transform" Tags="|fourier-transform|phase|cosine|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23656" PostTypeId="2" ParentId="23649" CreationDate="2015-05-26T04:22:01.213" Score="0" Body="&lt;p&gt;I like Anthony Parks approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I was facing this question what I did was I built a harmonic regression function. I found the amplitude &amp;amp; off-set of the function first, then found the best phase shift I could(coarse -&gt; fine) and did a mean square error analysis on the model vs the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wouldn't say this is the best solution (computation heavy), and it would not work on data too far from a sine function, but it's something.&lt;/p&gt;&#xA;" OwnerUserId="15953" LastActivityDate="2015-05-26T04:22:01.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23657" PostTypeId="1" AcceptedAnswerId="23671" CreationDate="2015-05-26T04:22:04.113" Score="1" ViewCount="4553" Body="&lt;p&gt;Recently I have come across different variation of the sane modulation techniques. I am quite confused about the advantages of different constellations. In particular, what are the advantages of using &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Differential BPSK over BPSK?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-05-26T04:44:39.280" LastActivityDate="2021-02-03T04:40:03.060" Title="Differential BPSK vs BPSK what are the advantages and disadvantages?" Tags="|digital-communications|digital|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23658" PostTypeId="2" ParentId="23648" CreationDate="2015-05-26T04:56:09.437" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Assume we have total of N QAM symbols which are input to the IDFT operation.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1) Is the output time domain samples Xk also of length N in length?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. Remember IFFT is a radix-2 operation. The output of the IFFT is next nearest power of two to the number of QAM symbols. For example for 6 Resource block configuration (1.4 MHz) there are 72 subcarriers. The number of IFFT bins and hence the no. of IFFT output samples for this configuration is 128 with 128-72 is zero padded samples. 66.6 μ sec is useful symbol duration corresponding to the IFFT output. We also have to add the cyclic prefix to this useful symbol to produce the final OFDM symbol as shown in the following figure [&lt;a href=&quot;https://home.zhaw.ch/~kunr/NTM1/literatur/LTE%20in%20a%20Nutshell%20-%20Physical%20Layer.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QlI56.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) If ONE data QAM symbol has symbol duration T, is ONE OFDM symbol of symbol duration T or is one SAMPLE of the OFDM symbol of duration T?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;One QAM symbol duration is 1/BW where BW is the transmission bandwidth. &lt;/p&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="11242" LastEditDate="2015-05-26T05:04:22.160" LastActivityDate="2015-05-26T05:04:22.160" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23659" PostTypeId="1" CreationDate="2015-05-26T05:32:20.840" Score="0" ViewCount="158" Body="&lt;p&gt;The human voice is singular because it has a specific frequency spectrum and fast transitions between vowels and consonants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are good and computationally fast ways to detect if there is probably a voice contained in a noisy music, the amount of the song where there is vocals, and the type of vocals in different kinds of music, that perhaps have beats and guitars and other sounds mixed into the vocal?&lt;/p&gt;&#xA;" OwnerUserId="12103" LastEditorUserId="12103" LastEditDate="2015-05-27T08:22:24.403" LastActivityDate="2015-05-27T08:22:24.403" Title="Ways to identify if music has vocal timbres in it?" Tags="|fft|frequency-spectrum|signal-detection|sound|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23660" PostTypeId="1" AcceptedAnswerId="23665" CreationDate="2015-05-26T07:57:28.900" Score="0" ViewCount="812" Body="&lt;p&gt;I'm trying to send some text over sound. For example, I try to send the words &quot;Hello John&quot;. I do it this way: Every char is converted into its binary ascii code. Then I construct a wav file with no gaps by NAudio library in this manner: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    StartDelimiter = 12KHz, &#xA;    1's = 13kHz,&#xA;    0's = 14kHz(for the message),&#xA;    End Delimiter = 10kHz. &#xA;    The durations of whole beeps are similar: 100ms.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm only at the beginning of my work and I Record the series of beeps and after recording I analyze the record(in the future I want it to be near Real Time) by: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the start delimiter's index with Goertzel filter(max power along the recorded buffer). &lt;/li&gt;&#xA;&lt;li&gt;Skipping a known duration(100ms) in a buffer to decode the 1 OR 0 by using another 2 Goertzel filters. If the End delimiter is found I break the search and show the decoded message to a box. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My problem that I've encountered so are: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;After sending more than 5 chars I get for example: &quot;Hello Pohny&quot;. The first chars are fine but then it start to rubbish.&lt;/li&gt;&#xA;&lt;li&gt;Some noise defects the series.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Are there some strategies which I can use to improve the skills of my the above algorithm? &#xA;Thanks&#xA;I work with C# on WPF &lt;/p&gt;&#xA;" OwnerUserId="15637" LastEditorUserId="154" LastEditDate="2015-05-26T09:37:11.040" LastActivityDate="2015-05-26T09:48:14.800" Title="Synchronizing data sent over sound beeps with Goertzel Detection, C#" Tags="|dft|signal-detection|c#|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23661" PostTypeId="1" CreationDate="2015-05-26T08:42:55.667" Score="1" ViewCount="356" Body="&lt;p&gt;I am new to the field of image processing / computer vision and I find it very hard to get my hands on the subject.&#xA;I read a lot about the basics/theory but I feel in no way able to use this knowledge in a practical way.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do you have any tips on how to translate my theoretical knowledge into practical knowledge?&lt;/li&gt;&#xA;&lt;li&gt;Are there any &quot;cookbooks&quot; for image processing that are not bound to a software/library? (I plan to use Halcon but only find resources for Photoshop or OpenCV.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="15972" LastEditorUserId="15972" LastEditDate="2015-05-26T11:10:35.713" LastActivityDate="2018-01-15T12:34:58.817" Title="How to learn image processing / computer vision in a practical way?" Tags="|computer-vision|image-processing|image-segmentation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23662" PostTypeId="1" AcceptedAnswerId="23663" CreationDate="2015-05-26T09:10:21.497" Score="5" ViewCount="16662" Body="&lt;p&gt;I have a set of points(2D) whose pixels are set and want to perform k-means on these pixels. Is clustering the 2D coordinates the right way ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, can that be done using any libraries in python ?&lt;/p&gt;&#xA;" OwnerUserId="15799" LastEditorUserId="8202" LastEditDate="2015-05-26T16:00:36.613" LastActivityDate="2015-05-26T16:00:36.613" Title="K-means for 2D point clustering in python" Tags="|image-processing|opencv|image-segmentation|python|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23663" PostTypeId="2" ParentId="23662" CreationDate="2015-05-26T09:17:24.573" Score="7" Body="&lt;p&gt;It can be done very easily with the &lt;a href=&quot;http://scikit-learn.org/stable/&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;scikit-learn&lt;/strong&gt;&lt;/a&gt;.  Examples are easy to find on their website, i.e. &lt;a href=&quot;http://scikit-learn.org/stable/auto_examples/cluster/plot_mini_batch_kmeans.html#example-cluster-plot-mini-batch-kmeans-py&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;. In my opinion it is the best way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Modified code example from the above link:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;from sklearn.cluster import KMeans&#xA;from sklearn.datasets.samples_generator import make_blobs&#xA;&#xA;##############################################################################&#xA;# Generate sample data&#xA;np.random.seed(0)&#xA;&#xA;batch_size = 45&#xA;centers = [[1, 1], [-1, -1], [1, -1]]&#xA;n_clusters = len(centers)&#xA;X, labels_true = make_blobs(n_samples=3000, centers=centers, cluster_std=0.7)&#xA;&#xA;##############################################################################&#xA;# Compute clustering with Means&#xA;&#xA;k_means = KMeans(init='k-means++', n_clusters=3, n_init=10)&#xA;k_means.fit(X)&#xA;k_means_labels = k_means.labels_&#xA;k_means_cluster_centers = k_means.cluster_centers_&#xA;k_means_labels_unique = np.unique(k_means_labels)&#xA;&#xA;##############################################################################&#xA;# Plot result&#xA;&#xA;colors = ['#4EACC5', '#FF9C34', '#4E9A06']&#xA;plt.figure()&#xA;plt.hold(True)&#xA;for k, col in zip(range(n_clusters), colors):&#xA;    my_members = k_means_labels == k&#xA;    cluster_center = k_means_cluster_centers[k]&#xA;    plt.plot(X[my_members, 0], X[my_members, 1], 'w',&#xA;            markerfacecolor=col, marker='.')&#xA;    plt.plot(cluster_center[0], cluster_center[1], 'o', markerfacecolor=col,&#xA;            markeredgecolor='k', markersize=6)&#xA;plt.title('KMeans')    &#xA;plt.grid(True)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yielding:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/s5FTx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-05-26T09:22:39.480" LastActivityDate="2015-05-26T09:22:39.480" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23664" PostTypeId="2" ParentId="23649" CreationDate="2015-05-26T09:23:41.773" Score="1" Body="&lt;p&gt;Assuming that the description I made of the FreezeFramer process is correct, then I would try determining the SINAD rating of the peak frequency in the interpolated data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have a sampling rate of 2Hz, giving a Nyquist of 1Hz.  You will be looking for a sinusoid with a frequency well below 1Hz.  The SINAD value is (basically) the amplitude of the peak frequency divided by the sum of all the other frequency amplitudes.  There are better descriptions available, as well as implementations for many of the more common DSP frameworks.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-05-26T09:23:41.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23665" PostTypeId="2" ParentId="23660" CreationDate="2015-05-26T09:43:05.130" Score="1" Body="&lt;p&gt;You can't simply skip ahead some amount of time, and won't be able to skip ahead when decoding in real time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to simply decode as the values come in, and switch your output depending on what comes in.  Change states only on input changes.&#xA;So, like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Feed input signal into the bank of goertzel filters,  the detected tone is the filter output that goes over a defined limit.&lt;/li&gt;&#xA;&lt;li&gt;When detected tone changes to 12kHz, set message start flag&lt;/li&gt;&#xA;&lt;li&gt;When detected tone changes to 13khz, send output bit 1&lt;/li&gt;&#xA;&lt;li&gt;When detected tone changes to 14kHz, send output bit 0&lt;/li&gt;&#xA;&lt;li&gt;When detected tone changes to 10kHz, end of message.&lt;/li&gt;&#xA;&lt;li&gt;Repeat from step 1 until end of message.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Working that way, you should stay synchronized and have fewer errors.  You should also be able to shorten the beep lengths, though you may need to work with the length of the Goertzel filters to make it work with shorter beeps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will find that you will have to make a compromise between the length of the beeps, the length of the goertzel filter, and the separation between the individual tones in order to get fast, reliable communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get faster communication, you will need shorter filters which in turn require larger separation between the tones to get reliable detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are doing is called frequency shift keying (FSK,) and has been used to transmit data over audio paths for a long time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise will always be a problem.  There are two ways to fight it, and you might have to use them both.&#xA;First, you make your goertzel filters as long as possible, but still short enough to react within your desired bit rate.&#xA;Second, most systems encode the data with checksums.  Checksum codes can be used that allow you to recover from bit errors - they don't just say &quot;bad data,&quot; they can also say &quot;bad data, bit X should be value Z.&quot;  There are of course limits.  The better the checksum and error correction, the more extra information you have to send, so the slower your effective data rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third thing you could do is to lower the data rate and extend the length of the goertzel filters, but you are already running a very low rate.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2015-05-26T09:48:14.800" LastActivityDate="2015-05-26T09:48:14.800" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23666" PostTypeId="2" ParentId="23661" CreationDate="2015-05-26T10:40:05.587" Score="2" Body="&lt;p&gt;&lt;em&gt;Digital Image Processing&lt;/em&gt;. Rafael C. Gonzalez, Richard E. Woods. - it is the classical book on Image Processing, that is not bound to any library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To translate theoretical knowledge into practical knowledge you can start with the book &lt;em&gt;&lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/1849517827&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mastering OpenCV with Practical Computer Vision Projects&lt;/a&gt;&lt;/em&gt;, which can be downloaded &lt;a href=&quot;https://homepages.thm.de/~hg11237/Start/OpenCV/Mastering%20OpenCV%20with%20Practical%20Computer%20Vision%20Projects%20%5beBook%5d.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15965" LastEditorUserId="28517" LastEditDate="2018-01-15T12:34:58.817" LastActivityDate="2018-01-15T12:34:58.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23667" PostTypeId="2" ParentId="18004" CreationDate="2015-05-26T10:57:14.540" Score="-1" Body="&lt;pre&gt;&lt;code&gt;% created by MUSTAFA SAMI AHMED&#xA;% Email mustafa_sami87@yahoo.com&#xA;clc;&#xA;clear all;&#xA;M =100;&#xA;L=sqrt(M);&#xA;bv = 0:L-1;&#xA;Matrix = bv'*bv ;&#xA;anglout = radtodeg(pi);&#xA;% alfa= (4*pi)/(L);&#xA;&#xA;% Matrix_new = alfa*Matrix; &#xA;incPhi = (2*pi)/L; %incremental phase change&#xA;Matrix = mod(Matrix*incPhi,2*pi);&#xA;&#xA;b=reshape(Matrix,1,[]); % matrix 1D size 1xM&#xA;for p = 1:M&#xA;  d(p) = exp(1j*b(p)) ;&#xA;end    &#xA;&#xA;AutoCorrelation = xcorr(d);&#xA;&#xA;AutoCorrelationdB =10*log10(abs(AutoCorrelation)/max(abs(AutoCorrelation)));&#xA; figure(1);&#xA; stem(b);&#xA;%   x=wden(AutoCorrelationdB,'heursure','h','mln',10,'sym10');&#xA;  %x=wiener2(AutoCorrelationdB, [3 80 ]);&#xA;  figure(2);&#xA;plot((AutoCorrelationdB));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15974" LastEditorUserId="7092" LastEditDate="2015-05-26T12:31:33.060" LastActivityDate="2015-05-26T12:31:33.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23668" PostTypeId="2" ParentId="23648" CreationDate="2015-05-26T11:11:22.980" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;The number of ouput samples $M$ of the IDFT is solely determined by the IDFT order $N$, where $M=N$. Whether some of the IDFT inputs (= subcarriers) remain unmodulated (i.e. are set to zero) is irrelevant for $M$.&lt;/li&gt;&#xA;&lt;li&gt;In communications, the symbol duration is defined as the time interval, in which the modulation of the information carrier is constant. This concept is applied to subcarriers in OFDM. Let $T_\mathrm s=1/f_\mathrm s$ be the &lt;em&gt;sampling&lt;/em&gt; period, then the OFDM symbol duration &lt;em&gt;without&lt;/em&gt; guard interval is $T_1=NT_\mathrm s$. If a cyclic prefix of $G$ samples is inserted, the OFDM symbol duration &lt;em&gt;including&lt;/em&gt; the guard interval is $T_2=(N+G)T_\mathrm s$. Some literature defines the OFDM symbol duration as $T_1$, some as $T_2$. The subcarrier bandwidth in OFDM is $f_\mathrm{sc}=f_\mathrm s / N$. With the definition of $T_1$ it follows that $1/f_\mathrm{sc}=N/f_\mathrm s=NT_\mathrm s=T_1$. Before cyclic prefix insertion, a subcarrier has a constant QAM modulation during $T_1$. After cyclic prefix insertion this duration is increased to $T_2$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2015-05-27T08:30:48.413" LastActivityDate="2015-05-27T08:30:48.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23669" PostTypeId="1" CreationDate="2015-05-26T11:12:03.900" Score="0" ViewCount="404" Body="&lt;p&gt;I am trying to move a signal to 0 in the frequency domain but I am not sure how to do it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7FEWB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15898" LastEditorUserId="8202" LastEditDate="2015-05-26T11:13:28.557" LastActivityDate="2015-05-26T15:51:18.377" Title="How can I move a signal in frequency so that it ends at the frequency zero?" Tags="|matlab|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23670" PostTypeId="2" ParentId="23659" CreationDate="2015-05-26T11:14:24.583" Score="1" Body="&lt;p&gt;Scalable audio separation with light Kernel Additive Modelling&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.loria.fr/~aliutkus/kaml/&quot; rel=&quot;nofollow&quot;&gt;http://www.loria.fr/~aliutkus/kaml/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2015-05-26T11:14:24.583" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="23671" PostTypeId="2" ParentId="23657" CreationDate="2015-05-26T11:26:11.270" Score="3" Body="&lt;p&gt;&lt;strong&gt;Differential BPSK&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the information is encoded in the phase difference of two consecutive symbols, phase estimation can be omitted in systems where the carrier phase can be assumed to be constant during two symbols. Specifically, it can be used in a self-coherent receiver which mixes one symbol with its predecessor in order to reconstruct the phase difference between the two symbols. In such a scheme, no local oscillator is required which simplifies the system (e.g. frequency synchronization is not needed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Non-differential (coherent) BPSK&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In differential BSPK, two symbols are &quot;added&quot; and as a consequence the noise of the two symbols adds up. This results in a 3 dB sensitivity gain of coherent BPSK. In other words, coherent BPSK is more robust against noise.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-05-26T11:26:11.270" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23672" PostTypeId="2" ParentId="23650" CreationDate="2015-05-26T11:34:27.340" Score="0" Body="&lt;p&gt;As stated in the paper citation, $(L-1)N$ zeros are padded &lt;em&gt;in frequency domain&lt;/em&gt; to achieve an $L$ times oversampling, where $N$ is the number of subcarriers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: Let $N=256$ and $L=4$. For the PAPR simulations use a 1024-IFFT. The 256 &quot;center&quot; inputs of the IFFT are the original OFDM frequency domain signal, the rest is zero. Thus $(L-1)N = 768\,$ zeros have been inserted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Nyquist-rate sampling&quot; here means that all IDFT input bins are used and are in general unequal to zero, as for $L=1$ the number of zero padded subcarriers is 0. Since the IDFT input can be interpreted as a frequency domain signal, this means that the complete available bandwidth from $-f_\mathrm s/2$ up to $f_\mathrm s/2$ carries signal energy. In contrast, some of the available bandwidth is unused if zero padding in the frequency domain is applied. This is referred to as oversampling in analogy to sampling an analog signal at a higher rate than twice its maximum frequency. In the context of this question it is worth noting that the oversampling described in the article is only used for simulation purposes and that the signal will usually be analyzed at the IDFT output. A transmission of the oversampled signal is usually not done as the purpose of oversampling here is only PAPR analysis.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2015-05-27T08:26:57.590" LastActivityDate="2015-05-27T08:26:57.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23673" PostTypeId="1" AcceptedAnswerId="23674" CreationDate="2015-05-26T11:51:38.433" Score="1" ViewCount="2809" Body="&lt;p&gt;A quite naïve question. I need some clarification regarding choosing the sampling frequency and oversampling factor. The scenario is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an OQPSK modulated sequence with symbol rate 2 M Symbols/sec. In order to transmit this through an AWGN channel, I am trying to half sine pulse shape this modulated sequence. I have read from a couple of online resources that before pulse shaping the sequence should be oversampled. I am currently confused by the factor that I need to oversample the sequence. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the sampling frequency, at Baseband I am confused as to what I should take as the sampling frequency. I assume that at passband of 2.4 GHz, I am considering the sampling frequency of 6 GHz but I am not sure if this is right and how should I decide on the sampling frequency if I do not consider the passband and just the baseband frequency. &lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-05-26T13:25:34.153" Title="Sampling frequency and oversampling factor" Tags="|matlab|filters|filter-design|qpsk|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23674" PostTypeId="2" ParentId="23673" CreationDate="2015-05-26T13:25:34.153" Score="1" Body="&lt;p&gt;The rule you must remember when deciding on your sampling frequency is: it must be at least double the highest frequency signal that will ever appear in your simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider your baseband signal. The highest frequency signal is the half-sine pulse (its bandwidth is infinite in theory). We know, from the Fourier series of a full-wave rectified sine, that its spectrum decays with frequency as $$\frac{1}{\pi(4n^2-1)}.$$ I would go with $n=3$, which corresponds to a frequency of $3f_0$. If your pulse rate is 2 Mpulses per second, then $f_0=2$ MHz, the pulse bandwidth is 6 MHz, and your sampling rate must be 12 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding passband: If you must simulate this system at a high carrier frequency, you know that the bandwidth now will be 2.4 GHz plus 6 MHz, or 2.406 GHz, so your sampling frequency needs to be double that. However, before doing this, please learn about the complex envelope. There is nothing to be gained by simulating the passband system, and you can lose a lot of time.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-26T13:25:34.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23676" PostTypeId="1" AcceptedAnswerId="30944" CreationDate="2015-05-26T14:34:49.307" Score="2" ViewCount="2825" Body="&lt;p&gt;I need first $25 \times 25$ coefficients of DCT to encrypt an image in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I obtain them ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used this code to compute DCT of an image : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = imread('cameraman.tif');&#xA;I = im2double(I);&#xA;T = dctmtx(8);&#xA;dct = @(block_struct) T * block_struct.data * T';&#xA;B = blockproc(I,[8 8],dct);&#xA;mask = [1   1   1   1   0   0   0   0&#xA;    1   1   1   0   0   0   0   0&#xA;    1   1   0   0   0   0   0   0&#xA;    1   0   0   0   0   0   0   0&#xA;    0   0   0   0   0   0   0   0&#xA;    0   0   0   0   0   0   0   0&#xA;    0   0   0   0   0   0   0   0&#xA;    0   0   0   0   0   0   0   0];&#xA;B2 = blockproc(B,[8 8],@(block_struct) mask .* block_struct.data);&#xA;invdct = @(block_struct) T' * block_struct.data * T;&#xA;I2 = blockproc(B2,[8 8],invdct);&#xA;imshow(I), figure, imshow(I2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The statement in the paper I read is : &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Basic constructions: Let $V$ be a feature space of dimension $d$ (for&#xA;  instance, the space $R^d$ corresponding to the entries in the top left&#xA;  corner of the DCT of a digital image excluding the DC component) and&#xA;  consider an original feature $φ = (φ_1, . . . , φ_d)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The paper gives also some practical details like this :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We choose as a feature space the upper left $25 \times 25$ coefficients of&#xA;  the DCT (excluding the DC component).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15981" LastEditorUserId="1629" LastEditDate="2016-01-21T19:19:49.093" LastActivityDate="2016-05-21T12:22:26.990" Title="How to find first 25 coefficients of DCT in Matlab?" Tags="|image-processing|matlab|dct|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23679" PostTypeId="2" ParentId="23669" CreationDate="2015-05-26T15:51:18.377" Score="1" Body="&lt;p&gt;One way of moving a frequency response of signal is multiplying it with a sinusoid. Assume x(t) is your signal.Let the sinusoid be $$cos(w_0t)$$&#xA;If I multiply this to x(t) as $$y(t)=x(t)cos(w_0t)$$&#xA;Then Fourier transform of y(t) is $$Y(w)=0.5(X(w-w_0)+X(w+w_0))$$&#xA;This is because multiplying in time domain of two signals is equivalent to its convolution in frequency domain.Since fourier transform of the above sinusoid is$$C(w)=\frac{\delta(w-w_0)+\delta(w+w_0)}{2}$$Due to the sifting property of delta function we get the above Y(w) after multiplying.&lt;br&gt;&#xA;Although here we get two signal the required one can be obtained by passing it through band pass filter&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-05-26T15:51:18.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23680" PostTypeId="1" AcceptedAnswerId="23711" CreationDate="2015-05-26T15:53:45.893" Score="2" ViewCount="955" Body="&lt;p&gt;JPEG image compression is Fourier based  DCT while modern image compression technique like JPEG2000 is based on more multi-scale technique like Wavelets.I want to know how Fourier  and Wavelets are useful in Image compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can anybody  explain advantages and disadvantages of JPEG and JPEG2000 with the help of (characteristics of)  transforms they use?&lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-05-27T06:14:48.457" LastActivityDate="2015-05-27T13:15:18.850" Title="Compare between JPEG and JPEG2000" Tags="|wavelet|fourier|compression|image-compression|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23681" PostTypeId="1" CreationDate="2015-05-26T17:41:46.610" Score="2" ViewCount="2106" Body="&lt;p&gt;The signal shown in the following figure is collected from a ECG sensor. The spike noise that is observed with a periodicity of 30 seconds was traced to the periodic blip of the LED as it draws current.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qsV5D.png&quot; alt=&quot;enter image description here&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is one instance of the spike noise after zooming in,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pt8uc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency domain filters are not effective in this case because the frequency domain characteristics of the LED blip artifact is similar to the heart beat signal(QRS). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any effective way to remove this artifact..? I was think of using the blip as a mother wavelet and performing a multi-scale correlation with the ECG signal to detect the spikes. Is this the procedure for wavelet denoising? Is there any other effective way of denoising for this case?&lt;/p&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="11242" LastEditDate="2015-05-26T17:47:24.027" LastActivityDate="2017-01-09T20:15:00.893" Title="Removing periodic spike noise from ECG signal" Tags="|wavelet|denoising|ecg|" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23683" PostTypeId="2" ParentId="23681" CreationDate="2015-05-26T18:15:59.350" Score="2" Body="&lt;p&gt;In the first place I would suggest you to look for some electrical methods of avoiding those spikes... If it's impossible to do so, then you must find a close enough mathematical model of your noise generation process from which you may decide to choose an adequate method of noise removal...Provided you can do so...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-05-26T18:15:59.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23684" PostTypeId="2" ParentId="23681" CreationDate="2015-05-26T18:35:18.667" Score="1" Body="&lt;p&gt;Because the frequency is known and appears to be quite consistant through out, why not create a filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like fourier transform -&gt; remove data of the noise frequency (set equal to zero) -&gt; inverse fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not an expert, but that seems like one means to do this.&lt;/p&gt;&#xA;" OwnerUserId="15953" LastActivityDate="2015-05-26T18:35:18.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23685" PostTypeId="2" ParentId="23680" CreationDate="2015-05-26T19:20:58.390" Score="2" Body="&lt;p&gt;JPEG uses, in its core, a block-based transform called Discrete Cosine Transform. The inherent result of this choice is known as the blocking artifact. To overcome this artifact and to accomodate many new advanced features required by the complex communication environment and demanding applications of the global communicaitons era it was required to be replaced by a wavelet type of multiresolution transform within the JPEG2000 codec. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;JPEG2000 provides more efficient compression, with many added modern features. The most important artifact of JPEG2000 is called as the washed-out effect observed at very low bitrates, which results in muddy outputs. Note however that JPEG at such low bitrates totally fails.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, JPEG 2000 is a better but more complicated codec. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-05-27T11:00:28.983" LastActivityDate="2015-05-27T11:00:28.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23686" PostTypeId="1" AcceptedAnswerId="23690" CreationDate="2015-05-26T22:47:10.833" Score="1" ViewCount="299" Body="&lt;p&gt;Having trouble finding the inverse DTFT of $\ X(\ e^{j \omega}) = \frac{3 - \frac{1}{4} e^{-j\omega}}{1 - \frac{1}{4} e^{-2j\omega}}  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the IDFT of $Xe^{j \omega}$ as : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n) = \frac{1}{2\pi} \int_{-\pi}^{\pi} X(\ e^{j \omega}) \cdot e^{j \omega n} d\omega$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tried long division as an option and reduction to partial fractions but not to any good so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure on how to proceed.&lt;/p&gt;&#xA;" OwnerUserId="15986" LastEditorUserId="15986" LastEditDate="2015-05-26T22:53:04.720" LastActivityDate="2015-05-27T02:33:05.803" Title="Inverse DTFT Problem" Tags="|fourier-transform|dtft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23687" PostTypeId="2" ParentId="23516" CreationDate="2015-05-27T00:10:22.153" Score="1" Body="&lt;p&gt;To follow up, the problem I was having was that I had no virtual MIDI driver installed, so nothing was showing up as available for MIDI input/output. I fixed this problem by downloading and installing &lt;a href=&quot;http://www.nerds.de/en/loopbe1.html&quot; rel=&quot;nofollow&quot; title=&quot;LoopBe1&quot;&gt;LoopBe1&lt;/a&gt; which is free for personal use. Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="15893" LastActivityDate="2015-05-27T00:10:22.153" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23688" PostTypeId="2" ParentId="23646" CreationDate="2015-05-27T01:09:09.263" Score="1" Body="&lt;p&gt;A good starting point to better help you understand the differences between several available methods for Transfer Function measurements is the Müller and Massarani paper entitled &quot;&lt;a href=&quot;http://www.aes.org/e-lib/browse.cfm?elib=10189&quot; rel=&quot;nofollow&quot;&gt;Transfer-Function Measurements with Sweeps&lt;/a&gt;&quot;.  Whilst the title eludes to coverage of only the ESS method, it does do a good job at covering other techniques too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Angelo Farina has also contributed many works regarding Transfer Function measurements for a variety of applications, all of which he makes freely available here:  &lt;a href=&quot;http://pcfarina.eng.unipr.it/Public/Papers/list_pub.htm&quot; rel=&quot;nofollow&quot;&gt;http://pcfarina.eng.unipr.it/Public/Papers/list_pub.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that this assists with your literature quest.  Following reading these papers you should have a better understanding of the different methods, along with their respective pro's and con's, so you can make an educated decision regarding which technique best suits your application.&lt;/p&gt;&#xA;" OwnerUserId="11857" LastActivityDate="2015-05-27T01:09:09.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23689" PostTypeId="1" CreationDate="2015-05-27T01:32:23.130" Score="13" ViewCount="24908" Body="&lt;p&gt;Can anyone explain what spectral entropy is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does noise with a restricted bandwidth have the same spectral entropy as white noise?&lt;/p&gt;&#xA;" OwnerDisplayName="user15987" LastEditorDisplayName="user15987" LastEditDate="2015-05-28T20:05:10.267" LastActivityDate="2015-05-28T20:05:10.267" Title="What is spectral entropy?" Tags="|audio|frequency-spectrum|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23690" PostTypeId="2" ParentId="23686" CreationDate="2015-05-27T02:33:05.803" Score="1" Body="&lt;p&gt;You can use partial fractions first to expand the $X(e^{j\omega})$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\omega})=\frac{\tfrac{7}{4}}{1+\frac{1}{2}e^{-j\omega}}+\frac{\tfrac{5}{4}}{1-\frac{1}{2}e^{-j\omega}} $$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then taking the inverse DTFT you get $\tfrac{7}{4}(-\frac{1}{2})^{n}u(n)+\tfrac{5}{4}(\frac{1}{2})^{n}u(n)$&lt;/p&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2015-05-27T02:33:05.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23691" PostTypeId="1" AcceptedAnswerId="23712" CreationDate="2015-05-27T02:58:19.063" Score="2" ViewCount="112" Body="&lt;p&gt;I  have been learning IEEE 802.11ad and the following processing algorithm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering what is the need for spreading with Golay sequence. I am guessing it has to with something like spread spectrum in CDMA applications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know why and whats the purpose of using such a block after modulation block?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-06-17T14:12:54.707" LastActivityDate="2015-06-17T14:12:54.707" Title="Spreading symbols with sequence before transmission" Tags="|digital-communications|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="23692" PostTypeId="2" ParentId="23689" CreationDate="2015-05-27T03:17:20.403" Score="3" Body="&lt;p&gt;Maximal variance in &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral flatness&lt;/a&gt; can be observed in white noise (versus minimal variance in flatness from a pure sine tone). So white noise is your answer and yes, you can generate that in Audacity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cldyN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-05-27T03:17:20.403" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23694" PostTypeId="1" CreationDate="2015-05-27T05:17:01.080" Score="1" ViewCount="57" Body="&lt;p&gt;In the early 1900s, Bernstein proved you could approximate any continuous function with the sums of polynomials.  I know this is a bit weak for DSP because it isn't strictly periodic, but is Bernstein ever used (or was ever used much in the past) for signal reconstruction or up sampling or anything else DSP related?&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-05-27T05:17:01.080" Title="Is Bernstein ever used in DSP?" Tags="|sampling|resampling|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23695" PostTypeId="1" CreationDate="2015-05-27T06:00:58.933" Score="3" ViewCount="4929" Body="&lt;p&gt;As you can see there are 2 images from the Tom and Jerry cartoon program.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/nKONM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/UHmSI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the 1st image both Tom and Jerry are present. But in the 2nd one,only Tom is present.Now,we can clearly see this difference in spatial domain. But i want to compare these images in Frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;So can anybody explain how do we compare these 2 images and find out the missing part from the 2nd image i.e. image of Jerry using &lt;strong&gt;Fourier transform&lt;/strong&gt; ? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also,is it possible to find out location  of Jerry in the image &lt;strong&gt;using any frequency transform method?&lt;/strong&gt; If yes can you explain how?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="1629" LastEditDate="2016-06-23T22:30:53.410" LastActivityDate="2022-01-26T21:55:50.560" Title="Comparison between 2 images in Frequency domain" Tags="|image-processing|matlab|fourier-transform|wavelet|frequency-domain|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23696" PostTypeId="2" ParentId="23681" CreationDate="2015-05-27T06:20:17.427" Score="2" Body="&lt;p&gt;If duration of this spike is a only few point in time (1 or 2) , you can use median filter (&lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt;) with size 3 or 5. But be careful - if useful signal has same duration, you will lose information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.&lt;br&gt;&#xA;As Fat32 write above, I suggest &quot;to look for some electrical methods of avoiding those spikes&quot;&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2015-05-27T06:20:17.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23697" PostTypeId="2" ParentId="23689" CreationDate="2015-05-27T07:52:56.423" Score="17" Body="&lt;p&gt;Spectral Entropy describes the complexity of a system. It is defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the spectrum $X(\omega_i)$ of your signal.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the Power Spectral Density of your signal via squaring its amplitude and normalizing by the number of bins.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$P(\omega_i)=\dfrac{1}{N}\left|X(\omega_i) \right|^2 $$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Normalize the calculated PSD so that it can be viewed as a Probability Density Function (integral is equal to 1).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$p_i=\dfrac{P(\omega_i)}{\sum_iP(\omega_i)} $$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;The Power Spectral entropy can be now calculated using a standard formula for an entropy calculation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$PSE = -\sum_{i=1}^np_i\ln p_i $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of boosting of your noise signal, without performing any other processing, the Entropy will change. I guess there is no other way around that.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-05-27T07:52:56.423" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23699" PostTypeId="1" AcceptedAnswerId="23704" CreationDate="2015-05-27T08:42:00.537" Score="4" ViewCount="1915" Body="&lt;p&gt;I have a collection of data: number of hours per day, over the course of several years.  I want to create an FFT of this data.  Since my sampling rate isn't seconds, but days, I think I have two choices when constructing the FFT.  One, I can specify that the sample rate Fs=1/86400 samples per second (86400 seconds in a day.)  But I think that's not right.  So maybe I can: two, say Fs=7 samples per week, then my resulting FFT has a scale, instead of cycles-per-second, of cycles-per-week.  Is this reasonable, or is there a better way to go about doing FFT for daily-periodic data?&lt;/p&gt;&#xA;" OwnerUserId="10591" LastActivityDate="2015-05-27T10:10:51.403" Title="FFT with day-periodic data" Tags="|fft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23700" PostTypeId="1" CreationDate="2015-05-27T08:51:26.687" Score="0" ViewCount="822" Body="&lt;p&gt;am trying to implement OQPSK modulation with half sine pulse shaping. If I simulate the OQPSK modulation without pulse shaping, the simulated curve is similar to the theoretical value. However, when I introduce pulse shaping, the simulated values are lesser than the theoretical case. I am not sure where I am going wrong. Below is the code where I am using pulse shaping:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  Rc = 2e6;       % Chip rate&#xA;  Tc = 1/Rc;      % inverse of chip rate&#xA;  Fs = 12e6;      % sampling frequency&#xA;  dt = 1/Fs;&#xA;  over = Fs/Rc;   % sampling factor&#xA;  TSim = 0.01;&#xA;  N = floor(TSim/4e-6);&#xA;  data = randi([0 1],N,1); &#xA;&#xA;  hMod = comm.OQPSKModulator('BitInput',true);&#xA;  modulated_data = step(hMod, data);&#xA;&#xA;   %% Upsample&#xA;  over_data = upsample(modulated_data,over);&#xA;&#xA;  %% Pulse Shape&#xA;  time = 0:dt:2*Tc;&#xA;  hSineflt = sin(pi*time/(2*Tc)); &#xA;  tx=conv(over_data,hSineflt,'same');&#xA;&#xA;  %% AWGN channel&#xA;  hAWGN = comm.AWGNChannel('EbNo',SNR);&#xA;  noisy_signal = step(hAWGN, tx); &#xA;&#xA;  %% Matched filter&#xA;  rx=conv(noisy_signal,hSineflt,'same');&#xA;&#xA;  %% Downsample&#xA;  downsampled_signal = rx(1:over:end);&#xA;&#xA;  %% OQPSK Demodulation&#xA;  hDemod = comm.OQPSKDemodulator('BitOutput',true);&#xA;  demod_data = step(hDemod,downsampled_signal);&#xA;&#xA;  %% BER &#xA;  hError = comm.ErrorRate('ReceiveDelay',2);&#xA;  errors = step(hError,data, demod_data);&#xA;  BER_sim = errors(1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the part where I calculated the theoretical value&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  BER_Theo = berawgn(SNR,'oqpsk','nondiff');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I expect both BER_sim and BER_Theo to be almost the same. But I am unable to figure out where I am going wrong.&lt;/p&gt;&#xA;" OwnerUserId="15794" LastEditorUserId="15794" LastEditDate="2015-05-27T09:50:08.900" LastActivityDate="2015-05-27T09:50:08.900" Title="Effect of Pulse shaping on BER" Tags="|matlab|filters|modulation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23701" PostTypeId="1" CreationDate="2015-05-27T08:59:32.293" Score="1" ViewCount="1176" Body="&lt;p&gt;I have to write some simple examples in Matlab which use spectral subtraction. These examples will be included in a paper to help a friend understand spectral subtraction. But I don't know where to start with spectral subtraction ?&#xA;Please, explain the technique and maybe give me some tips for what can I do with this method in Matlab. Some snippets of code would be very useful for me as I am not an expert in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="15981" LastActivityDate="2015-05-27T08:59:32.293" Title="What is spectral subtraction?" Tags="|matlab|signal-analysis|noise|background-subtraction|" AnswerCount="0" CommentCount="1" ClosedDate="2015-05-27T14:22:37.893" ContentLicense="CC BY-SA 3.0" />
  <row Id="23702" PostTypeId="2" ParentId="23699" CreationDate="2015-05-27T09:35:28.490" Score="1" Body="&lt;p&gt;you have a sampling period Ts of 1 day per sample = 3600*24 seconds per sample, from which you can obtain your samping frequency as Fs = 1/Ts in physical hertz units and multiply it by 2*pi for getting angular frequency of sampling...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-05-27T10:01:54.593" LastActivityDate="2015-05-27T10:01:54.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23703" PostTypeId="2" ParentId="23699" CreationDate="2015-05-27T09:40:12.810" Score="2" Body="&lt;p&gt;Saying &quot;7 samples per week&quot; is perfectly reasonable.  The FFT doesn't care how the rate is defined, it only requires it to be constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I fiddle with really low rates, I use the same concept.  Say, samples per minute or samples per year.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, it doesn't matter.  You know yourself that the number 1/86400 samples per second is mathematically the same as 7 samples per week - you calculated them both, after all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only effect it will have is in how you translate the FFT bins into a frequency - and you have to do that anyway, regardless of how you represent the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For myself, I find it easier to think of the numbers and samples when represented as some whole number of samples per time unit. &lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-05-27T09:40:12.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23704" PostTypeId="2" ParentId="23699" CreationDate="2015-05-27T10:10:51.403" Score="2" Body="&lt;p&gt;The basis function of the FFT is a sinusoid that is characterised by Frequency (Phase) and Amplitude. For the frequency to be expressed in Hz, the time unit must be expressed in seconds but there is nothing stopping you using orders of magnitude, like kHz or MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are sampling once every 24hr then your sampling frequency is approximately 11.57407 uHz (micro-Hertz) and your Nyquist frequency will be at 5.787035 uHz which, working backwards, is approximately 2 days. This means that you can't &quot;see&quot; cycles that occur more frequently than once every two days.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that you do an N-point FFT, your resolution is Fs/N and the frequency of each $k^{th}$ ($0&amp;lt;=k&amp;lt;=N$) bin is $k \times \frac{Fs}{N}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuing with the data as above and assuming a convenient $N=128$ point FFT, at $k=0$ is your DC point, that is, a constant value underlying your quantity (a constant &quot;number of hours per day&quot;), at $k=1$ you are at $1 \times 11.57407uHz/128 \approx 0.090422 uHz$ or, working backwards, at approximately 1 cycle every 4.2 &lt;strong&gt;months&lt;/strong&gt;. The next bin is at $2 \times 11.57407uHz/128$ or at approximately 1 cycle every 2.1 &lt;strong&gt;months&lt;/strong&gt; and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this is just the time-scale, you will also be assessing the strength of the sinusoid at each time-scale to get an accurate image of how does your quantity of &quot;number of hours in a day&quot; really fluctuates across time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two final notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In fields such as sea tides analysis or astronomy, certain time&#xA;scales have specific names, instead of reporting XYZ uHz. For&#xA;example, diurnal (daily), semi-diurnal cycles and so on. For more&#xA;information please see &lt;a href=&quot;http://web.vims.edu/physical/research/TCTutorial/tideanalysis.htm&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0264370714000283&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://www.psmsl.org/train_and_info/training/reading/canadian_manual/chapter3.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; link.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure that you double check the sort of accuracy required when&#xA;reporting these figures. A difference of 1 at the scale of magnitude&#xA;of uHz is approximately two hours (1.90998).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-05-27T10:10:51.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23708" PostTypeId="2" ParentId="23547" CreationDate="2015-05-27T12:33:17.987" Score="1" Body="&lt;p&gt;I have already solved this problem:&#xA;I have a white noise generated as an array of doubles:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static double[] whiteNoise(int length) {&#xA;    double[] out = new double[length];&#xA;    for (int i = 0; i &amp;lt; length; i++) {&#xA;        out[i] = (Math.random() * 2 - 1.0)/2.0;&#xA;    }&#xA;    return out;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I obtain the red noise from the white noise in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static double[] redNoise(int length, int m) {&#xA;    double out[] = whiteNoise(length);&#xA;&#xA;    for (int i=0; i&amp;lt;length/m-1; i++) {&#xA;        int k = i*m;&#xA;        int l = ((i+1)*m &amp;lt;= length-1) ? (i+1)*m : length-1;&#xA;        double d = (out[l] - out[k])/((double)(m));&#xA;        for (int j=0; j&amp;lt;m; j++) {&#xA;            out[k+j] = out[k] + d*j;&#xA;        }&#xA;    }&#xA;    return out;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the m parameter is the number of interpolated samples (we take the first sample, and the m+1 sample, and interpolate values of all samples between these two).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;And now the SHOW BEGINS&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I generate the red noise with the interpolation number equals to let's say 10000. According to the value of consecutive samples, I alter this red noise with different values obtained from these samples taken as the interpolation number parameter. In this way a rocket sound effect is obtained.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int interpolatedframes = 10000;&#xA;    double[] rednoise1 = SigGen.redNoise(duration, interpolatedframes);&#xA;    while(i&amp;lt;rednoise1.length-1)&#xA;    {&#xA;        selectedNumber = (int)Math.floor(Math.abs((100*(rednoise1[i]+0.5)+100)));&#xA;        if(i+selectedNumber &amp;lt; rednoise1.length-1) {&#xA;            rednoise1 = SigGen.alterRedNoise(rednoise1, i, selectedNumber);&#xA;        }&#xA;        else&#xA;        {&#xA;            break;&#xA;        }&#xA;        i+=selectedNumber;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the following code the array with the noise is altered in a way, that it interpolates &quot;interpolationNumber&quot; of samples beginning from the startingIndex. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static double[] alterRedNoise(double[] input, int startIndex, int interpolationNumber)&#xA;{&#xA;        int k = startIndex;&#xA;        int l = ((startIndex + interpolationNumber)&amp;lt;input.length-1?(startIndex+interpolationNumber):input.length-1);&#xA;        double d = (input[l] - input[k])/((double)(interpolationNumber));&#xA;        for (int j=0; j&amp;lt;interpolationNumber; j++) {&#xA;            input[k+j] = input[k] + d*j;&#xA;        }&#xA;    return input;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sorry for a bit messy code, but I just wanted to publish it ASAP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;#EDIT 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sound which is supposed to be generated is the sound of a rocket being launched. Take a look at this movie (maybe from 1:45): &lt;a href=&quot;https://www.youtube.com/watch?v=OnoNITE-CLc&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=OnoNITE-CLc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To have the effect of the rocket flying over, an envelope generator might be used. It can be implemented as a simple multiplication of the samples obtained from the described method in such way, that it will be gradually suppressed.&lt;/p&gt;&#xA;" OwnerUserId="15912" LastEditorUserId="15912" LastEditDate="2015-05-28T20:49:09.707" LastActivityDate="2015-05-28T20:49:09.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23710" PostTypeId="2" ParentId="450" CreationDate="2015-05-27T13:13:13.130" Score="0" Body="&lt;p&gt;Your FFT is very poor quality, there is little point in trying to extract patterns using poor tools to gather the info. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check each point for it's nearest neighbour and do a dot to dot diagram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use a gaussian filter to blur your spectrogram as they are not very well printed for viewing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your first graph has very little patterns to it at all. it is almost noise. you can perform tests to find how disparate the points are, the noisiness of it. for serious patterns you need serious detail.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2015-05-27T13:13:13.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23711" PostTypeId="2" ParentId="23680" CreationDate="2015-05-27T13:15:18.850" Score="4" Body="&lt;p&gt;JPEG is far simpler.  It divides the image into 8x8 pixel blocks, and processes each using a Discrete Cosine Transform.  The results are quantised and then encoded.  The quality is fixed by the encoder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;JPEG2000 uses a 2D wavelet function, the output of which is four &quot;images&quot;, each a quarter the size of the original.  One of those is actually an image, while the others are high-frequency components that can be added to it to re-construct the full-resolution image.  The wavelet process may be repeated multiple times.  The result is a tiny image, and a series of high frequency components that may be combined with it.  Each resulting component is quantised and encoded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;JPEG is fine for high quality and modest compression, which is why it is still very widely used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;JPEG2000 offers several advantages:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;To achieve very high compression, it is possible to throw away or heavily quantise the high frequency components.  This gives a poor quality - but usable - image where JPEG would fail completely.&lt;/li&gt;&#xA;&lt;li&gt;Images can be re-constructed progressively at ever improving quality.  This can be either in terms of increasing resolution or bit depth as required.&lt;/li&gt;&#xA;&lt;li&gt;It supports the JPIP protocol for progressively transmitting images to a client.  The client may retrieve low-resolution thumbnails and then just the parts of the image they want at better resolutions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-05-27T13:15:18.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23712" PostTypeId="2" ParentId="23691" CreationDate="2015-05-27T13:56:52.173" Score="1" Body="&lt;p&gt;It is just the control channel that is spread.  It appears that it is spread primarily to make the signal more robust in the face of frequency selective fading, which is probably a major problem at 60 GHz.  It is easy to use spreading to get the robustness because the data rate of the control channel is low.  In other words, the spreading is fulfilling two roles: converting the low control channel data rate to the high OFDM symbol rate, and increasing the control channel's robustness.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2015-05-27T14:13:11.103" LastActivityDate="2015-05-27T14:13:11.103" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23713" PostTypeId="2" ParentId="23646" CreationDate="2015-05-27T17:01:08.453" Score="0" Body="&lt;p&gt;Personally:The impulse response gives a visual way of understanding the system response and can be used in a convolution calculation.  But you will find a vast number of distinct systems yield very similar waveforms for the impulse response; requiring great precision to identify.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sine wave response makes up for this by redundancy in measurements and provides information for various regulations, requirements, and control design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just for your information: you should be aware that things with long intricate time constants confound simple measurements; like thermal control systems where every little edge and connection slowly heats up and &quot;reflects&quot; energy back.&#xA;For these systems I threw in the towel and used pulse response over a long time and then constructed approximation models and then worked from the approximations when they were good enough.&#xA;The truth is that all of this is approximations to &quot;reality&quot; anyway.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2015-05-27T17:01:08.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23714" PostTypeId="1" AcceptedAnswerId="23721" CreationDate="2015-05-27T19:12:12.080" Score="2" ViewCount="101" Body="&lt;p&gt;In digital communications systems we say that the received signal can be expressed as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)= x(t)+ n(t)\tag1$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if x(t) is the transmitted signal and $n(t)$ is the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering whether a better model would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)= x(t-t_0)+ n(t)\tag2$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To account for delay caused by channel. Is my logic correct? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so then, what are the assumptions made when using (1) and what are we accounting for if we use (2)? ie what type of errors are we accounting for (delay spread, or time acquistion error...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking forward to hearing your responses and discussion on this. thanks&lt;/p&gt;&#xA;" OwnerUserId="15315" LastActivityDate="2015-05-27T20:28:40.833" Title="Output signal in digital communication" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23716" PostTypeId="1" CreationDate="2015-05-27T19:16:10.260" Score="2" ViewCount="1527" Body="&lt;p&gt;I have designed using MATLAB a FIR filter with some coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an array that is normalized to -+1. The array is float.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used this method to apply the FIR to the array but I'm not sure if this is fine: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static float[] FirFilter(float[] b, float[] x)&#xA;    {&#xA;        int M = b.Length;// b == coffecients of FIR&#xA;        int n = x.Length;// x == mySignalSamples&#xA;        //y[n]=b0x[n]+b1x[n-1]+....bmx[n-M]&#xA;        var y = new float[n];&#xA;        for (int yi = 0; yi &amp;lt; n; yi++)&#xA;        {&#xA;            float t = 0.0f;&#xA;            for (int bi = M - 1; bi &amp;gt;= 0; bi--)&#xA;            {&#xA;                if (yi - bi &amp;lt; 0) continue;&#xA;&#xA;                t += b[bi] * x[yi - bi];&#xA;            }&#xA;            y[yi] = t;&#xA;        }&#xA;        //return Convert.ToDouble(y);&#xA;        return y;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I doing that right?&lt;/p&gt;&#xA;" OwnerUserId="15637" LastEditorUserId="8764" LastEditDate="2015-05-27T19:45:10.290" LastActivityDate="2015-05-27T19:45:10.290" Title="Applying a FIR filter to floating point array c#" Tags="|filters|c#|finite-impulse-response|floating-point|" AnswerCount="0" CommentCount="4" ClosedDate="2015-05-28T07:23:19.470" ContentLicense="CC BY-SA 3.0" />
  <row Id="23718" PostTypeId="1" AcceptedAnswerId="23753" CreationDate="2015-05-27T19:41:52.233" Score="3" ViewCount="885" Body="&lt;p&gt;Does extreme clipping white noise colour the audio spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought (and hoped!) not on the basis of this from research.net&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Clipping is mathematically equivalent to the addition of impulse&#xA;  noise, (at the point of clipping you are effectively adding a negative&#xA;  impulse to the original waveform); consequently the effect on the&#xA;  spectrum is similar to additive impulse noise, with a fairly uniformly&#xA;  flat spectrum (depending on the degree of clipping). &lt;strong&gt;The spectrum is&#xA;  obviously going to be coloured if the clipping occurs with some&#xA;  periodicity&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Emphasis mine.&lt;/p&gt;&#xA;" OwnerDisplayName="user15987" LastActivityDate="2017-07-23T19:44:51.530" Title="Does clipping noise colour the spectrum" Tags="|noise|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23720" PostTypeId="2" ParentId="374" CreationDate="2015-05-27T20:27:13.017" Score="2" Body="&lt;p&gt;(Sorry, this post doesn't come with awesome demonstrations.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to work with information TeX already has (letters and positions), you can manually classify letters and letter pairs as &quot;sloping&quot; in one direction or another.  For example, &quot;w&quot; has SW and SE corner slopes, the &quot;al&quot; combo has a NW corner slope, &quot;k&quot; has a NE corner slope.  (Don't forget punctuation - a quote followed by a letter that fills the lower half of the glyph box establishes a nice slope; quote followed by q is particularly strong.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, look for occurrences of corresponding slopes on opposite sides of a space - &quot;w al&quot; for a SW-to-NE river or &quot;k T&quot; for a NW-to-SE river.  When you find one on a line, see if a similar one occurs, appropriately shifted left or right, on the lines above/below; when you find a run of these, there's probably a river.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, obviously, just look for spaces stacked nearly vertically, for the plain vertical rivers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get a little more sophisticated by measuring the &quot;strength&quot; of the slope: how much of the advance box is &quot;empty&quot; due to the slope and thus contributing to the river's width.  &quot;w&quot; is fairly small, as it has only a small corner of its advance box to contribute to the river, but &quot;V&quot; is very strong.  &quot;b&quot; is slightly stronger than &quot;k&quot;; the gentler curve gives a more visually-continuous river edge, making it stronger and visually wider.&lt;/p&gt;&#xA;" OwnerUserId="15995" LastActivityDate="2015-05-27T20:27:13.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23721" PostTypeId="2" ParentId="23714" CreationDate="2015-05-27T20:28:40.833" Score="2" Body="&lt;p&gt;Equation (1) in your question is a pure additive noise channel without any further distortion of the signal. Equation (2) takes a delay into account, but this is usually not relevant. A pure delay does not affect the quality of the communication link in terms of bit error rate. (I'm not talking about the annoying effect of delay in voice communication).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the model in Equation (2) is often not relevant and can be replaced by Equation (1). A more general and useful model, which includes Eq. (2) as a special case, is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=(x*h)(t)+n(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h(t)$ is the impulse response of the channel, and $*$ denotes convolution. This model represents a linear time-invariant channel with additive noise. Eq. (2) is obtained as a special case with $h(t)=\delta(t-t_0)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-27T20:28:40.833" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23722" PostTypeId="1" CreationDate="2015-05-27T20:30:55.210" Score="0" ViewCount="1005" Body="&lt;p&gt;I have to design high-pass IIR Biquad filter with cutoff frequency of 80Hz, sampling frequency 24kHz, and filter slope of 24dB/oct @ 80Hz. I have used formula for HPF biquad coefficients from &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. However, the slope is less steep for frequencies lower than 80Hz, please see the picture. How I can design a filter to give me 24dB/oct for the frequencies lower than 80Hz, to match the reference curve on the picture?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3xjM9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15718" LastActivityDate="2015-05-27T20:30:55.210" Title="Biquad high-pass filter - calculating filter slope" Tags="|filters|infinite-impulse-response|dsp-core|biquad|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23723" PostTypeId="1" CreationDate="2015-05-27T20:42:39.300" Score="1" ViewCount="568" Body="&lt;p&gt;I am trying to understand how SURF extracts features using a Hessian matrix. &#xA;What I am a bit confused about, is why a second derivative Gaussian filter is used, rather than a standard Gaussian filter? What effect does this have on the system?&lt;/p&gt;&#xA;" OwnerUserId="15908" LastEditorUserId="7338" LastEditDate="2017-06-15T15:47:31.993" LastActivityDate="2017-06-15T15:47:31.993" Title="SURF feature extractor and descriptor" Tags="|image-processing|computer-vision|gaussian|smoothing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23725" PostTypeId="1" AcceptedAnswerId="24922" CreationDate="2015-05-27T22:17:15.960" Score="0" ViewCount="511" Body="&lt;p&gt;I am working on an algorithm (in MATLAB) to identify/classify a given bar code (image) as 1 D or 2 D. I have considered using the contrast of THE IMAGE matrix as a parameter or using the FFT of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be grateful for any ideas or suggestions on what you consider the best approach for this problem&lt;/p&gt;&#xA;" OwnerUserId="15998" LastEditorUserId="7338" LastEditDate="2015-07-31T22:08:59.670" LastActivityDate="2015-07-31T22:17:32.563" Title="Identification of a given barcode as either 1 D or 2 D" Tags="|computer-vision|image-processing|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23729" PostTypeId="2" ParentId="23646" CreationDate="2015-05-28T06:53:19.477" Score="0" Body="&lt;p&gt;My background is related to structural system analysis, so my answer will take into account the input usually used during structural testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effects of &lt;strong&gt;sine-sweep excitation&lt;/strong&gt; on the system response have been analyzed, among the others, in the paper listed below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;G. Gloth, M. Sinapius, Detection of Non-Linearities in Swept-Sine&#xA;Measurements, XXI International Modal Analysis Conference - IMAC,&#xA;Orlando, Florida, 2003 (here it talks also about non-linearities identification, which is not your case, but still it can give you useful infos about the effect of this type of excitation)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J.A. Lollock, The effect of swept sinusoidal excitation on the response of&#xA;a single degree of freedom oscillator, 43rd AIAA Structures, Structural&#xA;Dynamics and Materials Conference, Denver, Colorado, 2002&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P. Nali, A. Bettacchioli, Beating phenomena in spacecraft sine tests and an&#xA;attempt to include the sine sweep rate effect in the test-prediction&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Impulse excitation&lt;/strong&gt; is usually give by means of an impact and this makes it a simple and fast way for measuring frequency response functions. Impact testing produces responses with high crest factors, but it suffers of the same problems as those of random excitation: the input is a broad spectrum and the energy associated with an individual frequency is small. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both are transient excitations.&lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2015-05-28T06:53:19.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23731" PostTypeId="1" CreationDate="2015-05-28T08:18:14.487" Score="2" ViewCount="266" Body="&lt;p&gt;Given the absence of information about the algorithms of spectral whitening functions in software packages:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many ways do you know for doing spectral whitening?&#xA;What are the differences?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-05-28T08:26:05.053" LastActivityDate="2015-05-28T08:26:05.053" Title="Spectral Whitening: Approches" Tags="|filters|normalization|linear-prediction|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23733" PostTypeId="1" AcceptedAnswerId="23734" CreationDate="2015-05-28T12:07:49.007" Score="9" ViewCount="49440" Body="&lt;p&gt;I have a very simple question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Oppenheim book, it says that: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If CT Fourier transform of $x(t)$ is $X(j\omega)$ then, CT Fourier&#xA;  transform of $x^*(t)$ is $X^*(-j\omega)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What I can't understand is what is $X^*(-j\omega)$? Or what is $X^*(j\omega)$? Can you tell me what I should understand when I see $X^*(-j\omega)$ or $X^*(j\omega)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example $x(t) = (a + bj)t$ and $X(j\omega) = (c + dj)\omega$ what should be $X^*(-j\omega)$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8955" LastEditorUserId="8202" LastEditDate="2015-05-28T12:21:54.200" LastActivityDate="2021-07-02T11:45:44.423" Title="Conjugation in Fourier Transform" Tags="|fourier-transform|conjugate|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23734" PostTypeId="2" ParentId="23733" CreationDate="2015-05-28T12:33:20.843" Score="17" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X^*(j\omega)$&lt;/span&gt; is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Complex_conjugate&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex conjugate&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$X(j\omega)$&lt;/span&gt;. So if&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X(j\omega)=X_R(\omega)+jX_I(\omega)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X^*(j\omega)=X_R(\omega)-jX_I(\omega)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X^*(-j\omega)=X_R(-\omega)-jX_I(-\omega)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X_R(\omega)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_I(\omega)$&lt;/span&gt; refer to the real and imaginary parts of &lt;span class=&quot;math-container&quot;&gt;$X(j\omega)$&lt;/span&gt;, respectively. [Note that they are not the respective Fourier transforms of the real and imaginary parts of the time domain signal.]&lt;/p&gt;&#xA;&lt;p&gt;Also, the notation &lt;span class=&quot;math-container&quot;&gt;$X^*(j\omega)$&lt;/span&gt; is to be understood as &lt;span class=&quot;math-container&quot;&gt;$\left[X(j\omega)\right]^*$&lt;/span&gt;, i.e., the whole expression for &lt;span class=&quot;math-container&quot;&gt;$X(j\omega)$&lt;/span&gt; is conjugated. Similarly for &lt;span class=&quot;math-container&quot;&gt;$X^*(-j\omega)$&lt;/span&gt;, i.e., &lt;span class=&quot;math-container&quot;&gt;$X^*(-j\omega)=\left[X(-j\omega)\right]^*$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To gain some more understanding, consider the definition of the Fourier transform:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X(j\omega)=\int_{-\infty}^{\infty}x(t)e^{-j\omega t}dt$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X(-j\omega)=\int_{-\infty}^{\infty}x(t)e^{j\omega t}dt$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X^*(-j\omega)=\int_{-\infty}^{\infty}x^*(t)e^{-j\omega t}dt=\mathcal{F}\{x^*(t)\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as claimed in the quote of your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2021-07-02T11:45:44.423" LastActivityDate="2021-07-02T11:45:44.423" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="23735" PostTypeId="1" CreationDate="2015-05-28T13:11:36.643" Score="2" ViewCount="429" Body="&lt;p&gt;We have a sensing matrix $\Phi$, satisfying the &lt;a href=&quot;http://en.wikipedia.org/wiki/Restricted_isometry_property#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;restricted isometry property (RIP)&lt;/a&gt;, and a sparse signal $x$. We want to recover $\hat x$ from the measurement $y=\Phi x$ by using $l_1$-minimization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering about, how the RIP can guarantee the uniqueness of the recovered sparse vector solution $\hat x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.brainshark.com/brainshark/brainshark.net/portal/title.aspx?pid=zAvz9F41cz0z0&quot; rel=&quot;nofollow noreferrer&quot;&gt;On slide 4, at 01:15 minute&lt;/a&gt;, Mark Davenport says in his presentation about compressed sensing: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The RIP is what we need to ensure, that this hyperplane is oriented in a way, that guarantees us, that there is actually only one sparse vector in this hyperplane. So we are going to be guaranteed to get the right answer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But why is that? I do not see that the RIP can guarantee this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider this picture below. It's a slide from the linked presentation. The blue hyperplane also intersects at least one other axis. How can we be sure, that this other sparse vector isn't the actual solution, i.e. was our formler signal $x$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MlQvz.png&quot; alt=&quot;Screenshot of Mark Davenports slides&quot;&gt; &lt;/p&gt;&#xA;" OwnerUserId="16008" LastEditorUserId="128" LastEditDate="2019-06-03T04:30:08.383" LastActivityDate="2019-06-03T04:30:08.383" Title="How Come RIP Guarantees Unique Restoration of the Sparse Solution by $ {L}_{1} $ Minimization?" Tags="|convex-optimization|compressive-sensing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23737" PostTypeId="1" AcceptedAnswerId="23739" CreationDate="2015-05-28T14:33:36.397" Score="0" ViewCount="231" Body="&lt;p&gt;I have the following expression:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z) = \frac{16}{15}\frac{1}{1-\frac14z^{-1}} - \frac{16}{15}\frac{1}{1-4z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to my understanding this should become:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n) = \frac{16}{15}\left(\frac14\right)^n  u(n) - \frac{16}{15} 4^n  u(n)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But according to my source it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n) = \frac{16}{15}\left(\frac14\right)^n  u(n) + \frac{16}{15} 4^n  u(-n-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are these expressions equal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they are, how can $-u(n) = u(-n-1)$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used $a^nu(n)\Longleftrightarrow  \frac{1}{1-az^{-1}}$.&lt;/p&gt;&#xA;" OwnerUserId="15741" LastEditorUserId="4298" LastEditDate="2015-05-28T15:08:43.763" LastActivityDate="2015-05-28T15:14:37.827" Title="Inverse Z-transform mystic simplification" Tags="|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23738" PostTypeId="1" AcceptedAnswerId="23742" CreationDate="2015-05-28T15:12:15.880" Score="5" ViewCount="2585" Body="&lt;p&gt;In IEEE 802.11a standards, there are many fields. Of which is the Data field which has 52 available sub-carriers used for transmission of coded bits. If the subcarrier locations are numbered from 32,-31,...0,1,...31.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read in the book that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;that 48 out of 52 subcarriers are used for transmission of data bits. While 4 pilots are used as pilots for phase and frequency tracking and training. The pilot subcarriers are located at -21,-7,7,21 with values 1 (at -21,-7,7) and -1 at 21.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am just wondering, usually the preamble (fields before the data field) is used to estimate the channel by sending a pilot symbol (using ALL subcarriers). Then my questions are &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) what is the purpose of sending these 4 pilot tones? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I am guessing phase and frequency tracking is different from channel estimations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) My last question is do we send the pilot values on the predefined pilot subcarriers &lt;strong&gt;ALONG&lt;/strong&gt; with the data bits? so basically is each OFDM symbol made up of pilot and data tones? This is different than the procedure in preamble where  &lt;strong&gt;ALL&lt;/strong&gt; subcarriers are used to send one pilot symbol, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="1606" LastEditDate="2015-05-28T15:48:16.057" LastActivityDate="2015-05-28T15:57:58.353" Title="Pilot symbols in IEEE 802.11a" Tags="|digital-communications|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23739" PostTypeId="2" ParentId="23737" CreationDate="2015-05-28T15:14:37.827" Score="1" Body="&lt;p&gt;This is probably homework, so I'll just give you a few hints to get you on the right track. First of all, given an expression $X(z)$, the corresponding sequence is usually not unique. Your solution is correct if the region of convergence (ROC) of $X(z)$ is $|z|&amp;gt;4$, which gives you an exponentially increasing sequence. If this were the impulse response of a discrete-time system, then the system would be causal but unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other solution assumes that the ROC is $\frac14&amp;lt;|z|&amp;lt;4$, which includes the unit circle. This corresponds to a two-sided decaying sequence. As an impulse response it would correspond to a non-causal but stable system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to answer your question, both solutions are correct but they are not identical, because they are inverse transforms of $X(z)$ assuming different regions of convergence.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-28T15:14:37.827" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="23741" PostTypeId="1" CreationDate="2015-05-28T15:42:00.413" Score="0" ViewCount="8277" Body="&lt;p&gt;I have signal as seen in the picture. It has high frequency noise and drifting baseline. I am able to remove the noise in MATLAB but I am not sure what can I do about the drift. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/dsK1s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like the signal to have a stable baseline. Any help or hints on how I can do that would be most helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16009" LastActivityDate="2015-05-28T22:12:07.027" Title="Help for baseline drift removal/correction" Tags="|matlab|filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23742" PostTypeId="2" ParentId="23738" CreationDate="2015-05-28T15:47:51.407" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;A frequency offset $f_\mathrm{off}$ between the carrier frequency and the local oscillator (at the receiver) results in a linear phase, i.e. the received signal contains a factor $\mathrm{exp}(j2\pi f_\mathrm{off}/f_\mathrm{s}n)$, where $f_\mathrm{s}$ is the sampling frequency and $n$ is the discrete time. If the frequency offset is sufficiently low (e.g. because it has been estimated and compensated for in an earlier step) the linearly changing phase can be assumed constant during one OFDM symbol. This means that all samples of the received OFDM symbol have a constant phase offset that can be estimated using the pilot subcarriers. As the phase is changing slowly, this has to be done for every OFDM symbol individually. The pilot symbols can also be used to estimate phase noise.&lt;/li&gt;&#xA;&lt;li&gt;Yes, see 1. Frequency and phase offsets are time varying effects while the channel is assumed to be constant for at least some OFDM symbols.&lt;/li&gt;&#xA;&lt;li&gt;Yes, pilot tones are sent in &lt;em&gt;every&lt;/em&gt; OFDM symbol, along with data subcarriers.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2015-05-28T15:57:58.353" LastActivityDate="2015-05-28T15:57:58.353" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23743" PostTypeId="2" ParentId="11087" CreationDate="2015-05-28T16:46:16.147" Score="3" Body="&lt;p&gt;Advantages:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;code&gt;ST&lt;/code&gt; does the phase of the &lt;code&gt;TFR&lt;/code&gt;.  For instance, if you have a constant cosine function i.e., &lt;span class=&quot;math-container&quot;&gt;$h(t) = Acos(2 \pi f t + \theta),$&lt;/span&gt;  then the phase of the &lt;code&gt;ST&lt;/code&gt; result for that voice &lt;code&gt;(frequency f)&lt;/code&gt;  is exactly equal to theta for all time.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;you can get the &lt;code&gt;FFT&lt;/code&gt; spectrum (the complex values)  by averaging the ST over time.  Which makes a lot of sense to me,  if you have the time varying spectrum you average over time to get the global or FFT spectrum.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Citations:&lt;br /&gt;&#xA;&lt;a href=&quot;https://ieeexplore.ieee.org/document/492555&quot; rel=&quot;nofollow noreferrer&quot;&gt;Localization of the complex spectrum&lt;/a&gt;: the S transform&#xA;RG Stockwell, L Mansinha, RP Lowe, Signal Processing, IEEE Transactions on 44 (4), 998-1001&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://bytebucket.org/cleemesser/stockwelltransform/raw/d87ff20d787d36d5280dcd26cbaf309dcd982bf4/ref/Stockwell-Why%20Use%20the%20S-Transform.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Why use the S-transform Authors&lt;/a&gt; RG Stockwell&#xA;Publication date 2007 &lt;a href=&quot;https://bookstore.ams.org/fic-52&quot; rel=&quot;nofollow noreferrer&quot;&gt;Journal Pseudo-differential operators: partial differential equations and time-frequency analysis&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16011" LastEditorUserId="7092" LastEditDate="2022-07-12T12:48:05.727" LastActivityDate="2022-07-12T12:48:05.727" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="23744" PostTypeId="2" ParentId="23725" CreationDate="2015-05-28T17:02:55.410" Score="0" Body="&lt;p&gt;One dimensional barcodes have distinct &quot;texture&quot; differences than two dimensional ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, &lt;a href=&quot;http://en.wikipedia.org/wiki/Barcode&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear barcodes&lt;/a&gt; are smooth in the Y direction but use their width in the X direction to encode information and that is where the differences in texture stem from. Two dimensional barcodes (e.g. &lt;a href=&quot;http://en.wikipedia.org/wiki/QR_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;QR Codes&lt;/a&gt;) use both directions to encode information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To assess differences in texture, you can train a classifier using Haralick's features that directly estimate differences in texture information via different metrics of a co-occurence matrix derived by each image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information please &lt;a href=&quot;http://murphylab.web.cmu.edu/publications/boland/boland_node26.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Co-occurrence_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; , &lt;a href=&quot;http://mahotas.readthedocs.org/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; (for a Python library that implements Haralick features) and also &lt;a href=&quot;https://dsp.stackexchange.com/questions/22777/haralick-features-am-i-approaching-this-correcly&quot;&gt;this relevant response&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-05-28T17:02:55.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23746" PostTypeId="2" ParentId="23741" CreationDate="2015-05-28T17:43:25.710" Score="1" Body="&lt;p&gt;A drifting baseline to me looks like a displacement from zero by the mean amplitude. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;From a stats point of view, you will want compute the rolling mean and subtract. &lt;/li&gt;&#xA;&lt;li&gt;From a signals point of view, this problem is a DC offset, and can be corrected with a high pass filter, with a very low cutoff, that essentially removes this low frequency amplitude modulation. There are a number of prior discussion &lt;a href=&quot;https://dsp.stackexchange.com/questions/17453/how-to-design-a-high-pass-filter-to-remove-dc-offset-from-signal&quot;&gt;here&lt;/a&gt;, and &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/DC_Blocker_Software_Implementations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;implementations&lt;/a&gt;. If you're in MATLAB, &lt;a href=&quot;http://www.mathworks.com/help/ident/ref/detrend.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;detrend&lt;/a&gt; can be useful as already mentioned.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-05-28T17:43:25.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23747" PostTypeId="1" CreationDate="2015-05-28T18:40:43.530" Score="0" ViewCount="2822" Body="&lt;p&gt;I've got a video of a ball, I've done background subtraction (using MOG2) to isolate the change in the image. And I'm performing a blur to remove some of the noise caused by light/shadows/etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now that I have clearer image to work on, I'm using &lt;code&gt;GoodFeaturesToTrack&lt;/code&gt; to and &lt;code&gt;OpticalFlow.PyrLK&lt;/code&gt; to draw lines from frame to frame, to track the motion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I still don't know how I can differentiate which motion is caused by a ball, and which is random, a person, etc... I'm just drawing lines tracking points that moved...but how do I determine which, if any, of those points were actually on the ball?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I currently have&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Program&#xA;{&#xA;    static Timer _myTimer;&#xA;    static Capture _capture;&#xA;    static ImageViewer _viewer;&#xA;    static readonly BackgroundSubtractorMOG2 MogDetector = new BackgroundSubtractorMOG2(0, 32.0f, true);&#xA;    static int _frameNumber;&#xA;&#xA;    private static Image&amp;lt;Gray, byte&amp;gt; _previousFrame;&#xA;    private static PointF[] _previousFeatures;&#xA;&#xA;    static void Main(string[] args)&#xA;    {&#xA;        const int fps = 30;&#xA;&#xA;        _myTimer = new Timer();&#xA;        _myTimer.Interval = 1000 / fps;&#xA;        _myTimer.Tick += MyTimerTick;&#xA;        _myTimer.Start();&#xA;&#xA;        _capture = new Capture(@&quot;C:\source\dungeon\ComputerVision\Camera\App_Data\converted.avi&quot;);&#xA;        _viewer = new ImageViewer();&#xA;        _viewer.ShowDialog(); &#xA;    }&#xA;&#xA;    private static void MyTimerTick(object sender, EventArgs e)&#xA;    {&#xA;        var rawFrame = _capture.QueryFrame();&#xA;        var originalRoi = rawFrame.ROI;&#xA;        var roi = new Rectangle(0, rawFrame.Height / 2, rawFrame.Width, rawFrame.Height - rawFrame.Height / 2);&#xA;&#xA;        var cropFrame = rawFrame&#xA;            .GetSubRect(roi)&#xA;            .Convert&amp;lt;Gray, byte&amp;gt;()&#xA;            .SmoothGaussian(17);&#xA;&#xA;        if (_frameNumber++ &amp;lt; 100) &#xA;            MogDetector.Update(cropFrame.Convert&amp;lt;Bgr, byte&amp;gt;());&#xA;        else&#xA;            MogDetector.Update(cropFrame.Convert&amp;lt;Bgr, byte&amp;gt;(), 1.0e-5);&#xA;&#xA;        //Find the motion&#xA;        var motionMask = MogDetector.ForegroundMask&#xA;            .ThresholdBinary(new Gray(250), new Gray(255)) // Removes shadows&#xA;            //.Erode(3).Dilate(3) // Removes small artifacts that aren't really moving&#xA;            ;&#xA;&#xA;        //var motion = frame.Copy(motionMask);&#xA;        //var motion = rawFrame.Add(motionMask);&#xA;        var motion = rawFrame.Copy();&#xA;        motion.ROI = roi;&#xA;        motion.Add(motionMask.Convert&amp;lt;Bgr, byte&amp;gt;());&#xA;&#xA;        if (_previousFrame != null)&#xA;        {&#xA;            PointF[] returnFeatures;&#xA;            byte[] status;&#xA;            float[] trackError;&#xA;&#xA;            _previousFeatures = _previousFrame.GoodFeaturesToTrack(100, .01, .1, 3)[0];&#xA;            OpticalFlow.PyrLK(_previousFrame, motionMask, _previousFeatures, new Size(15, 15), 5, new MCvTermCriteria(5), out returnFeatures, out status, out trackError);&#xA;&#xA;            //Console.WriteLine(&quot;Features Found:&quot; + returnFeatures.Length);&#xA;            for (var i = 0; i &amp;lt; returnFeatures.Length; i++)&#xA;            {&#xA;                var prevPoint = _previousFeatures[i];&#xA;                var currPoint = returnFeatures[i];&#xA;                var state = status[i];&#xA;                var error = trackError[i];&#xA;&#xA;                var line = new LineSegment2D(new Point((int)prevPoint.X, (int)prevPoint.Y), new Point((int)currPoint.X, (int)currPoint.Y));&#xA;                var travelUp = prevPoint.Y - currPoint.Y;&#xA;                var travelLeft = prevPoint.X - currPoint.X;&#xA;&#xA;                //if (state != 1 || !(line.Length &amp;gt; 15) || !(error &amp;lt; 10)) &#xA;                if (!(state == 1 &amp;amp;&amp;amp; line.Length &amp;gt; 15 &amp;amp;&amp;amp; error &amp;lt; 10))&#xA;                    continue;&#xA;&#xA;                motion.Draw(line, new Bgr(Color.Red), 3);&#xA;                Console.WriteLine(&quot;Error: {0}, Up: {1}, Left: {2}, Length: {3}&quot;, &#xA;                    error, travelUp, travelLeft, line.Length);&#xA;            }&#xA;        }&#xA;        _previousFrame = motionMask;&#xA;&#xA;        motion.ROI = originalRoi;&#xA;        _viewer.Image = motion;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A few other things that I'm struggling on are what the different thresholds, and values mean that I'm passing into &lt;code&gt;GoodFeaturesToTrack&lt;/code&gt;, &lt;code&gt;Mog2&lt;/code&gt;, etc, the documentation tends to just say &quot;it's the threshold&quot; ... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="704" LastActivityDate="2015-05-28T18:40:43.530" Title="Tracking a ball (using EmguCV)" Tags="|opencv|visual-tracking|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23748" PostTypeId="1" AcceptedAnswerId="23754" CreationDate="2015-05-28T20:08:59.133" Score="0" ViewCount="931" Body="&lt;p&gt;Given a discrete signal $ r(nT_c)$ specified at a rate $T_c$, assume we want to resample with a 3/2 rate change to match the sampling rate of some other signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would like to upsample it by 3, then filter it by filter of length $K$ and then downsample by 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also assume we have the following relationship exists $$ \frac{3}{2}T_s = T_c$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1: Upsample then we have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r'(n\frac{Ts}{2}) = \left\{ \begin{array}{ll}&#xA;        r(n\frac{Ts}{3}) &amp;amp; \mbox{if $n = 0,3,6$};\\&#xA;        0 &amp;amp; \mbox{if OW}.\end{array} \right.$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2: Filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{r}(n\frac{Ts}{2})= \sum_{k=0}^{K-1}r(\frac{(n-k)T_s}{2})h_{filter}(k)\,\,\,\,\,\,\,n=0,1....$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r_o(nT_s)= \hat{r}(n\frac{Ts}{2}-\underbrace{\frac{K-1}{2}\frac{T_s}{2}}{???}) \,\,\,\,\,n=0,1,$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand two of the above steps&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) why do we need use a filter to resample and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)  why isnt it the part underbrace $$\hat{r}(n\frac{Ts}{2}) \,\,\,\,\,n=0,1,....$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-05-29T01:09:32.697" LastActivityDate="2015-05-29T04:08:37.373" Title="Upsample - filter - downsample" Tags="|sampling|downsampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23749" PostTypeId="1" AcceptedAnswerId="23757" CreationDate="2015-05-28T20:48:07.420" Score="0" ViewCount="1211" Body="&lt;p&gt;I'm trying to detect some frequencies of 18Khz with sample rate of 44100 [samples/sec].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I pass a buffer(~4500 samples) to the algorithm it returns a magnitude in a very strange range. Sometimes i get 0.1, or 7 or 250(!) or 154 or 25000 - very strange. I can't decide on a threshold boundary for the filter. Is there any way noramlizing that result? (My result is the magnitude of the complex calculation of real and image) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my Goertzel code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public float goertzel_mag(float[] data,int numSamples, int TARGET_FREQUENCY, int SAMPLING_RATE,int start,int end)&#xA;    {&#xA;        int k, i;&#xA;        float floatnumSamples;&#xA;        float omega, sine, cosine, coeff, q0, q1, q2, magnitude, real, imag;&#xA;&#xA;        float scalingFactor = (float)(numSamples / 2.0);&#xA;&#xA;        floatnumSamples = (float)numSamples;&#xA;        k = (int)(0.5 + ((floatnumSamples * TARGET_FREQUENCY) / SAMPLING_RATE));&#xA;        omega = (float)(2.0 * Math.PI * k) / floatnumSamples;&#xA;        sine = (float)Math.Sin(omega);&#xA;        cosine = (float)Math.Cos(omega);&#xA;        coeff = (float)2.0 * cosine;&#xA;        q0 = 0;&#xA;        q1 = 0;&#xA;        q2 = 0;&#xA;&#xA;        for (i = start; i &amp;lt; end; i++)&#xA;        {&#xA;            q0 = coeff * q1 - q2 + data[i];&#xA;            q2 = q1;&#xA;            q1 = q0;&#xA;        }&#xA;&#xA;        // calculate the real and imaginary results&#xA;        // scaling appropriately&#xA;        real = (q1 - q2 * cosine) / scalingFactor;&#xA;        imag = (q2 * sine) / scalingFactor;&#xA;&#xA;        magnitude = (float)Math.Sqrt(real * real + imag * imag);&#xA;        return magnitude;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15637" LastActivityDate="2015-05-29T05:20:36.897" Title="Normalizing the magnitude of Goertzel Filter c#" Tags="|fft|sound|bandpass|c#|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23751" PostTypeId="2" ParentId="23741" CreationDate="2015-05-28T22:12:07.027" Score="2" Body="&lt;p&gt;Like I already mentioned in the comment, you might find MATLAB's &lt;code&gt;detrend&lt;/code&gt; function useful. Generally it is useful for removal of linear (or piecewise linear) trend:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = detrend(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another solution, that should work in your case, is to use the polynomial fitting. This will remove the non-linear trend (providing you want that). A minimal code example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% vectors t,x are given (time and the signal)&#xA;degree = 5; % to be adjusted&#xA;[p, S, mu] = polyfit(t, x, degree);&#xA;xp = polyval(p, t, [], mu);&#xA;y = x - xp;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Personally I do not recommend any Moving Average filtering, since it is introducing delay and can distort your signal.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-05-28T22:12:07.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23753" PostTypeId="2" ParentId="23718" CreationDate="2015-05-29T00:33:58.107" Score="2" Body="&lt;p&gt;Clipping is a non-linear operation and it introduces new frequencies, so it will change the spectrum's shape. The text you quoted is pretty clear on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as a quick demo, I generated flat noise in Matlab, limited in frequency to the 100 to 300 Hz range. The spectrum is: &lt;img src=&quot;https://i.stack.imgur.com/IJrSB.jpg&quot; alt=&quot;no clipping&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the spectrum is close to zero outside the specified range. Also, this noise is not white; it is flat (or would be if I could simulation an infinite number of samples). White noise, by definition, covers the entire frequency range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I clipped all amplitudes larger than 0.75 to 0.75, and the resulting spectrum is: &lt;img src=&quot;https://i.stack.imgur.com/ioakj.jpg&quot; alt=&quot;clipped noise&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the difference is clear.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-29T00:33:58.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23754" PostTypeId="2" ParentId="23748" CreationDate="2015-05-29T04:08:37.373" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Your goal is to create a signal with 3 times more samples. The first step is to insert 2 zeros between each sample.&lt;br&gt;&#xA;Technically, you now have a signal with 3 time more samples, as you require. However most of the samples are zeros. What you need to do next is to interpolate the 2 samples between each 2 nonzero samples. And this is exactly what the low-pass filter does (or, at least, this one way to look at it).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Digital filters introduce delay to the signal by half the filter's length. I believe this is the reason for the time shifting&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-05-29T04:08:37.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23756" PostTypeId="2" ParentId="23633" CreationDate="2015-05-29T04:31:55.060" Score="3" Body="&lt;p&gt;Play sine waves, then composite sine waves, then white noise and eventually music visualizing the output via a real-time spectrum analyzer, or software EQ plugin with input monitoring. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For complete newbies, playing something (a guitar tone or a single sine-wave) and getting visual/intuitive feedback on the screen about what's going on is a powerful way to set the mental-framework for more complicated topics like filters, transforms, wavelets, etc. Plus there's plenty of material online/youtube/etc and everyone likes music. Best of luck!&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="11372" LastEditDate="2015-05-30T04:42:10.203" LastActivityDate="2015-05-30T04:42:10.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23757" PostTypeId="2" ParentId="23749" CreationDate="2015-05-29T05:20:36.897" Score="0" Body="&lt;p&gt;Your Goertzel code looks okay, the standard fare.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding normalization and thresholds, if you're detecting 18kHz, you should calibrate your signal at different levels and establish a threshold from that data&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start with full-scale (1.0, 0dBFS) 18kHz tones, as those should give you the highest magnitude over the course of your buffer (4500 samples) and then&lt;/li&gt;&#xA;&lt;li&gt;Repeat the Goertzel filter mag measurements on tones all the way down in level, as much as you care but I would measure at least 6dB.&lt;/li&gt;&#xA;&lt;li&gt;Finally, run your Goertzel filter over non-tonal material, or buffers of audio that don't contain what you're looking for. This will give you an idea of what the filter will output in the non-tone case. In my application, environmental audio/speech can have incidental tones in the range I'm looking for (400-600Hz) and I want to make sure to understand what Goertzel magnitudes I would get versus Goertzel magnitudes in the presence of a real tone.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-05-29T05:20:36.897" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="23758" PostTypeId="1" CreationDate="2015-05-29T08:28:33.933" Score="7" ViewCount="1964" Body="&lt;p&gt;I am working on a project in image processing which is based on importance of phase only reconstruction of a signal obtained using Fourier transform.For more information about phase only reconstruction,you can see the answer given by geometrikal in the &lt;a href=&quot;https://dsp.stackexchange.com/questions/16462/how-moving-part-pixel-intensity-values-of-video-frames-becomes-dominant-compared&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now ,I have detected moving objects from the &lt;a href=&quot;https://signal642.shutterfly.com/pictures/8&quot; rel=&quot;nofollow noreferrer&quot;&gt;video of Traffic on road taken using stationary camera&lt;/a&gt; ( Please download  the 1.47 MB video for testing MATLAB Code by ( step1) &lt;strong&gt;click on the play button&lt;/strong&gt; then (step2) right clicking on video then ( step3 ) click on save as option )&lt;/p&gt;&#xA;&lt;p&gt;Algorithm No. 1&#xA;The proposed approach&lt;/p&gt;&#xA;&lt;p&gt;Requirement: An input image sequence I(x, y, n) (where x and y are image dimensions and n represent frame number in a video) which is extracted from video.&lt;/p&gt;&#xA;&lt;p&gt;Outcome: The segmentation mask of moving object for each frame&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For each frame in a input video perform step 2, append step 2 result in resultant array ‘I(x, y, n)’&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Smoothen the current frame using 2D Gaussian filter&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform 3D FFT for the whole sequence I(x, y, n) using &lt;a href=&quot;http://it.thislife.com/exzPhP&quot; rel=&quot;nofollow noreferrer&quot;&gt;(Eq.4.1)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the phase spectrum using the real and imaginary parts of 3D DFT&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the reconstructed sequence Î(x, y, n) using (Eq.4.2)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each frame in a input video perform step 7 to step 10 to get segmentation mask for each frame and append step 10 result in resultant segmentation mask array BW(x,y,n)’&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Smooth the reconstructed frame of Î(x, y, n) using the averaging filter.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the mean value of the current frame&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert the current frame into binary image using mean value as the threshold&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform morphological processing, i.e., filling and closing, to obtain segmented mask of moving object for the current frame&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;End algorithm.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If you run my MATLAB code, you can observe that I am quite successful in detecting all the moving objects in each video frames. But now I want to detect &lt;strong&gt;only one&lt;/strong&gt; moving object at a time from current frame and &lt;strong&gt;avoid other moving objects&lt;/strong&gt; by making changes in the &lt;strong&gt;same code or algorithm&lt;/strong&gt; .But  don't understand how it can be done.&lt;/p&gt;&#xA;&lt;p&gt;so can anybody tell me&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to do &lt;strong&gt;single&lt;/strong&gt; vehicle tracking using Fourier transform?&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NamS8.jpg6.&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    tic&#xA;clc;&#xA;clear all;&#xA;close all;&#xA;  &#xA;%read video file&#xA;video = VideoReader('D:\dvd\Matlab code\test videos\5.mp4');&#xA;&#xA;T= video.NumberOfFrames  ;           %number of frames%&#xA;&#xA;frameHeight = video.Height;          %frame height&#xA;&#xA;frameWidth = video.Width ;           %frameWidth&#xA;&#xA;get(video);                          %return graphics properties of video&#xA;&#xA;&#xA;i=1;&#xA;&#xA;for t=300:15:550  %select frames between 300 to 550 with interval of 15 from the video  &#xA;    frame_x(:,:,:,i)= read(video, t); &#xA;    frame_y=frame_x(:,:,:,i);&#xA;&#xA;    %figure,&#xA;    %imshow(f1),title(['test frames :' num2str(i)]);&#xA;    frame_z=rgb2gray(frame_y);                 %convert each colour frame into gray&#xA;    &#xA;    frame_m(:,:,:,i)=frame_y; %Store colour frames in the frame_m array &#xA;     &#xA;    %Perform Gaussian Filtering&#xA;    h1=(1/8)*(1/8)*[1 3 3 1]'*[1 3 3 1]  ;   % 4*4 Gaussian Kernel  &#xA;    convn=conv2(frame_z,h1,'same');&#xA;        &#xA;    g1=uint8(convn);&#xA;    &#xA;                    &#xA;    Filtered_Image_Array(:,:,i)=g1; %Store filtered images into an array&#xA;    i=i+1;&#xA;end&#xA;&#xA;%Apply 3-D Fourier Transform on video sequences&#xA;f_transform=fftn(Filtered_Image_Array);&#xA;&#xA;%Compute phase spectrum array from f_transform&#xA;phase_spectrum_array =exp(1j*angle(f_transform));&#xA;&#xA;%Apply 3-D Inverse Fourier Transform on phase spectrum array and&#xA;%reconstruct the frames&#xA;reconstructed_frame_array=(ifftn(phase_spectrum_array));&#xA;&#xA;&#xA;k=i;&#xA;&#xA;i=1;&#xA;for t=1:k-1&#xA;    &#xA;    %Smooth the reconstructed frame of Î(x, y, n) using the averaging filter.&#xA;    Reconstructed_frame_magnitude=abs(reconstructed_frame_array(:,:,t));  &#xA;    H = fspecial('disk',4);&#xA;    circular_avg(:,:,t) = imfilter(Reconstructed_frame_magnitude,H);&#xA;        &#xA;    &#xA;    %Convert the current frame into binary image using mean value as the threshold&#xA;    mean_value=mean2(circular_avg(:,:,t));  &#xA;    binary_frame = im2bw(circular_avg(:,:,t),1.6*mean_value);&#xA;    &#xA;    &#xA;    %Perform Morphological operations&#xA;    se = strel('square',3);&#xA;    morphological_closing = imclose(binary_frame,se); &#xA;    morphological_closing=imclearborder(morphological_closing); %clear noise present at the borders of the frames&#xA;    &#xA;    &#xA;    %Superimpose segmented masks on it's respective frames to obtain moving&#xA;    %objects&#xA;    moving_object_frame = frame_m(:,:,:,i);&#xA;    moving_object_frame(morphological_closing) = 255;  &#xA;    figure,&#xA;    imshow(moving_object_frame,[]), title(['Moving objects in Frame :' num2str(i)]);&#xA;    &#xA; i=i+1;&#xA;end&#xA;toc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9035" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2018-11-23T09:43:37.563" Title="Is it possible to do single vehicle tracking using Fourier transform?" Tags="|image-processing|matlab|fft|fourier-transform|tracking|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23759" PostTypeId="1" AcceptedAnswerId="23762" CreationDate="2015-05-29T08:33:00.257" Score="11" ViewCount="5110" Body="&lt;p&gt;I have a signal with a sample time of 0.5 micro seconds and I would like to shift this signal by a fraction of the sample time, say by 3 nano seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read a few online resources about fractional delay filtering and about using the FFT and IFFT to perform such delay. Can someone point me to some theory on this or give me an idea on how to implement it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the regular shifting of the signal for integer samples, I have implemented this by shifting the signal by the required number of samples and adding zeros at the beginning. Is this approach correct?&lt;/p&gt;&#xA;" OwnerUserId="15794" LastEditorUserId="4298" LastEditDate="2018-07-18T20:21:42.363" LastActivityDate="2019-07-02T05:16:42.803" Title="Shift a signal by fraction of a sample" Tags="|filters|discrete-signals|signal-analysis|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23760" PostTypeId="1" AcceptedAnswerId="23765" CreationDate="2015-05-29T09:16:19.563" Score="0" ViewCount="962" Body="&lt;p&gt;I know how to up-sample a discrete, real signal (by an integer factor n) that is band-limited to frequencies between $f_1 = 0 \mathrm{Hz}$ and and $f_2$: Just insert $n-1$ zeros between every original sample (thereby multiplying the sampling rate by $n$) and send the result through a brick wall (sinc) filter to get the interpolated values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my DSP book I've read about a generalization of the sampling theorem:&#xA;If I have a discrete, real signal that is band-limited to frequencies between $f_1 = f_0  k$ and and $f_2 = f_0  (k + 1)$, with $k$ even, I can just subsample it with a frequency of $2 f_0$ (i.e. decimate) it, and I will retain the complete information (basically the frequencies get shifted down to the baseband between $0 \mathrm{Hz}$ and $f_0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question to you&lt;/strong&gt;: does the following method let me correctly reconstruct the original signal (in the frequency range between $f_1$ and $f_2$ as given in the previous paragraph) from the decimated signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just insert $k-1$ zeros between every original sample (thereby multiplying the sampling rate by $k$) and send the result through a brick wall filter (bandpass filter with passband $f_1$ … $f_2$) to get the interpolated values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this method is not correct, what needs to be changed to get the correct results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume the problem could also be solved by converting to an analytic signal, upsampling in the baseband and then shifting the frequencies up by $f_1$. I want to avoid this because of the additional cpu load this would cause. Please let me know whether you think the method above would work as well, or some other ways to save some processing costs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking forward to your tips,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Flo&lt;/p&gt;&#xA;" OwnerUserId="16016" LastEditorUserId="16016" LastEditDate="2015-05-29T09:31:55.500" LastActivityDate="2017-10-10T08:07:22.727" Title="Reconstruction of bandpass filtered signal from decimated version of itself" Tags="|bandpass|downsampling|reconstruction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23761" PostTypeId="2" ParentId="23760" CreationDate="2015-05-29T09:45:38.110" Score="1" Body="&lt;p&gt;Zero stuffing (which is what you propose) will cause a lot of harmonics in the upsampled signal.  They will be proportional to the strength of the original signal.  Your brick wall filter (a low pass will do, no need for a bandpass) will greatly reduce them, but won't get rid of them entirely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on your application, the result of zero stuffing and filtering may be fine.  If not, you could minimize the harmonics with a couple of methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could duplicate samples (original sample+ (n-1) copies.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could interpolate (calculate values along the line between sample und sample+1.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Duplicating is easy and will cost about as much processor time as zero stuffing.&#xA;Interpolating would be smoother but would cost more time as you must calculate individual values.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2015-05-29T10:01:59.420" LastActivityDate="2015-05-29T10:01:59.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23762" PostTypeId="2" ParentId="23759" CreationDate="2015-05-29T09:46:50.150" Score="14" Body="&lt;p&gt;There's a good overview article which appeared in 1996 in the IEEE Signal Processing Magazine: &lt;a href=&quot;http://home.agh.edu.pl/~turcza/sr/Splitting%20the%20Unit%20Delay.pdf&quot;&gt;Splitting the unit delay: tools for fractional delay filter design&lt;/a&gt;. The nice thing about it is that there's also a set of &lt;a href=&quot;http://legacy.spa.aalto.fi/software/fdtools/&quot;&gt;related Matlab files&lt;/a&gt; available. These routines will allow you to design such a system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for shifting by an integer number of samples, what you did is obviously correct.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-29T09:46:50.150" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23764" PostTypeId="2" ParentId="23647" CreationDate="2015-05-29T11:31:06.433" Score="1" Body="&lt;p&gt;The mapping from $z_n$ to $s_n$ is not bijective, so it can't be inverted. This means that even in the transmitter, $z_n$ cannot be recovered from $s_n$. This is why the constant modulus algorithm (CMA) need not (and cannot) be modified to estimate $z_n$. It can only be used to estimate $s_n$, and for this purpose no modification is necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thesis you referred to in a comment is mainly about blind signal separation. The update rules (3.16) and (3.17) apply to the iterative maximization of the log-likelihood function in order to compute the maximum likelihood solution of a source separation problem. The nonlinear vector-valued function $\mathbf{g}(\mathbf{u})$ depends on the probability density functions of the different source signals. The underlying model and the problem formulation are different from the model and the problem underlying the CMA, so there is no direct relation between the two, and the update rules mentioned above are not applicable to the CMA.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-29T11:31:06.433" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23765" PostTypeId="2" ParentId="23760" CreationDate="2015-05-29T14:40:11.167" Score="1" Body="&lt;p&gt;The sampling technique you describe is sometimes called bandpass sampling, or undersampling (read more about it &lt;a href=&quot;https://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;). You can get the original signal back, but the process is not as simple as you describe it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to realize that the undersampled signal consists of an infinite number of replicas of the original spectrum. If you choose your sampling frequency correctly, one of those replicas will be centered around $f=0$. That particular replica corresponds to a baseband signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can eliminate all replicas except the one at baseband with a low-pass filter with an appropriate cut-off frequency. After that, you can upsample and then upconvert the baseband signal back to $f_0$. The resulting signal will be (ideally) the same as the original.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-05-29T14:40:11.167" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23768" PostTypeId="1" CreationDate="2015-05-29T16:48:10.380" Score="4" ViewCount="118" Body="&lt;p&gt;I'm teaching an undergraduate linear algebra course, and looking for applications.  The New Horizons spacecraft is approaching Pluto, and returning images I find fascinating:&#xA;&lt;a href=&quot;http://pluto.jhuapl.edu/index.php&quot; rel=&quot;nofollow&quot;&gt;http://pluto.jhuapl.edu/index.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They briefly refer to 'image deconvolution'.  I expect they are using the most sophisticated tools available, some nonlinear, but my vague understanding is that some simple methods are linear algebra based.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone provide a reference or expository paper on linear algebra methods for image deconvolution that would be a good starting point?&lt;/p&gt;&#xA;" OwnerUserId="16021" LastActivityDate="2015-05-30T01:47:49.807" Title="New Horizons at Pluto" Tags="|image-processing|reference-request|linear-algebra|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23769" PostTypeId="1" CreationDate="2015-05-29T17:10:50.853" Score="1" ViewCount="304" Body="&lt;p&gt;I have a requirement to design bandpass Raised-Cosine filter with the magnitude and phase response as outlined in the picture below. I have read some literature online (still learning DSP) and I have found some formula in time and frequency domain for Raised-Cosine LPF only. I have a bandpass specification. I have to implement design in C++ code. What is the best way to design Raised-Cosine filter? How I can obtain filter's coefficients in the function of number of taps? How I specify the desired phase? I don't want to use MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cutqb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="15718" LastEditDate="2015-06-01T15:44:12.703" LastActivityDate="2015-06-01T15:44:12.703" Title="Raised-Cosine filter - design" Tags="|filters|dsp-core|finite-impulse-response|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23770" PostTypeId="1" AcceptedAnswerId="23771" CreationDate="2015-05-29T18:16:13.337" Score="1" ViewCount="89" Body="&lt;p&gt;I have a requirement to design minimax filter with linear programing (&lt;code&gt;linprog&lt;/code&gt; in MATLAB).&#xA;To build the filter I must choose vector $\omega$ (frequency sample), how many values I need to take to get the optimal result? How to spread them across the interval $[0,\pi]$?&lt;/p&gt;&#xA;" OwnerUserId="16023" LastEditorUserId="8202" LastEditDate="2015-05-29T21:26:06.877" LastActivityDate="2015-05-30T16:11:04.437" Title="Equiripple Filter-Design" Tags="|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23771" PostTypeId="2" ParentId="23770" CreationDate="2015-05-29T19:41:18.227" Score="1" Body="&lt;p&gt;There is no real rule, but you would usually choose around $10N$ frequency points, where $N$ is the desired filter order. Distribute the points equidistantly over pass band(s) and stop band(s). This does not mean that they are equidistant in the interval $[0,\pi]$ because usually there is at least one &quot;don't care&quot; region where no desired response is specified (such as in the transition band between pass band and stop band).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-30T16:11:04.437" LastActivityDate="2015-05-30T16:11:04.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23772" PostTypeId="2" ParentId="23582" CreationDate="2015-05-29T21:03:24.403" Score="0" Body="&lt;p&gt;You cannot detect these two words as you are doing. The features you're using, i.e. the waveform, does not have the discriminability you're looking for. Speech recognition (the problem here) uses features that are much more cooked (MFCCs, etc) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend using a popular open-source speech recognition packages like Sphinx3/4 (Java/C using HMMs) or Kaldi (C++/neural nets).&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-05-29T21:03:24.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23773" PostTypeId="1" AcceptedAnswerId="23774" CreationDate="2015-05-29T21:20:18.227" Score="2" ViewCount="2441" Body="&lt;p&gt;I am doing a project where I need to take the FFT and IFFT of a photo in MATLAB. There is a principle in optics where the intensity distribution from a lens is equal to the Fourier transform of the aperture that the light initially goes through. I'm having issues finding the FFT and IFFT of an ideal source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A circular aperture should have an intensity pattern called Airy disk, which should result from the Fourier Transform of a circle. Here is a photo of the Airy disk that I'm using in my code: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/guAby.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the inverse Fourier transform of the Airy disk should result in an image of a circular aperture, but all I'm seeing is black when I convert to uint8. If I leave it as type double then I see things that also look like Airy disks in the corners. Here is the code I'm using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pic=imread('airy.jpg');  &#xA;pic=rgb2gray(pic); %Convert to grayscale  &#xA;imshow(pic)  &#xA;title('Initial');  &#xA;&#xA;pic=double(pic); %Convert to double before transforms  &#xA;pic=ifft2(pic); %Take IFFT of Airy disk  &#xA;pic=real(pic); %Take real part  &#xA;&#xA;figure()  &#xA;pic=uint8(pic); %If commented out, black screen has Airy disks in corners  &#xA;imshow(pic);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any ideas on why the IFFT of the Airy disk doesn't return a circle? Thank you&lt;/p&gt;&#xA;" OwnerUserId="16026" LastEditorUserId="16026" LastEditDate="2015-05-29T21:32:01.910" LastActivityDate="2015-06-28T22:47:09.470" Title="Fourier transform of an image" Tags="|image-processing|matlab|fft|fourier-transform|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23774" PostTypeId="2" ParentId="23773" CreationDate="2015-05-29T22:07:14.880" Score="1" Body="&lt;p&gt;You have the gist of it, but there are a couple of problems. I'm sorry, I don't have MATLAB, but I'll do my best to give you MATLAB-like pseudo-code to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main problem is that your Airy disk is an image, i.e. amplitude only (the result of taking &lt;code&gt;abs&lt;/code&gt;). To reconstruct the circular aperture, you need phase as well. Here's code to first generate your complex Airy disk (PSF), from which you can then reconstruct the circular aperture (pupil function). Starting with this file, &lt;code&gt;circ.jpg&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vCBYg.jpg&quot; alt=&quot;a circular aperture&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pupil = imread('circ.jpg');&#xA;pupil = rgb2gray(pupil);&#xA;% use fftshift to block-swap the fft output (move DC to the center)&#xA;complex_airy = fftshift(fft2(pupil));&#xA;&#xA;% now, starting with this complex airy pattern, you were close:&#xA;pupil_reconstructed = ifft2(complex_airy);&#xA;pupil_reconstructed = abs(pupil_reconstructed);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Below are the amplitude and phase of the complex_airy pattern, obtained using &lt;code&gt;abs(complex_airy)&lt;/code&gt; and &lt;code&gt;angle(complex_airy)&lt;/code&gt;, respectively. (I've included only the centers of the images, to show detail.) The problem with your initial approach is that it's an ill-formed inverse problem: a single Airy amplitude pattern can correspond to an infinite number of pupil functions. When you inverse transformed the amplitude only, you assume the phase is everywhere zero, which--as is clear from the phase image below--it's not. There are statistical approaches for estimating the pupil function from the Airy amplitude alone, using lots of other constraints gleaned from the light source properties and optical system, but I don't think that's what you were after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/I1CuM.png&quot; alt=&quot;Imgur&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/H2DvV.png&quot; alt=&quot;Imgur&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16025" LastEditorUserId="16025" LastEditDate="2015-05-29T22:27:16.747" LastActivityDate="2015-05-29T22:27:16.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23775" PostTypeId="2" ParentId="23633" CreationDate="2015-05-29T23:29:07.653" Score="4" Body="&lt;p&gt;In my personal opinion, it's best to study how the master teachers of the field have presented this information, and to the extent possible, copy their approaches and their style.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two teachers in the field who have more or less taught a generation of DSP engineers their craft, either by direct teaching, or by teaching teachers.  They are Alan V. Oppenheim and Richard G. Lyons.  In Oppenheim's case, the Signals and Systems courses that he taught are still available on MIT's web site for free viewing, and his Discrete-Time Signal Processing is still the bible for many engineers on the topic.  Lyons still teaches and writes from Besser Associates, and his &quot;Understanding Digital Signal Processing&quot; book is simple and lucid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't go too far wrong by copying the masters.&lt;/p&gt;&#xA;" OwnerUserId="13700" LastActivityDate="2015-05-29T23:29:07.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23776" PostTypeId="1" AcceptedAnswerId="23858" CreationDate="2015-05-29T23:37:00.133" Score="14" ViewCount="42565" Body="&lt;p&gt;What is the significance of the noise covariance matrices in the Kalman Filter framework? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am referring to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;process noise covariance matrix &lt;strong&gt;Q&lt;/strong&gt;, and &lt;/li&gt;&#xA;&lt;li&gt;measurement noise covariance matrix &lt;strong&gt;R&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;at any time step t.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I interpret these matrices? What do they represent? Do they talk about how one observation's noise varies with respect to another observation's noise in the state vector? &lt;/p&gt;&#xA;" OwnerUserId="7460" LastActivityDate="2022-12-30T12:47:14.590" Title="Kalman filter - understanding the noise covariance matrix" Tags="|filters|noise|kalman-filters|tracking|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23777" PostTypeId="2" ParentId="23759" CreationDate="2015-05-30T00:40:46.680" Score="2" Body="&lt;p&gt;Besides doing fft type solutions you can also use interpolation, the specific kind of interpolation that is appropriate would be based on your needs of course!  Linear interpolation has worked well for me in the past with flange effects, but your mileage may vary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lagrange interpolation might also be worth looking into btw, if linear interpolation isn't good enough.&#xA;&lt;a href=&quot;http://blog.demofox.org/2015/07/08/lagrange-interpolation/&quot; rel=&quot;nofollow&quot;&gt;http://blog.demofox.org/2015/07/08/lagrange-interpolation/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15130" LastEditorUserId="15130" LastEditDate="2015-08-04T15:45:17.133" LastActivityDate="2015-08-04T15:45:17.133" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23778" PostTypeId="2" ParentId="23768" CreationDate="2015-05-30T01:47:49.807" Score="3" Body="&lt;p&gt;When talking about image deconvolution, it is referring to the process of correcting an image for distortion caused by the optical properties of the camera or imaging system. This distortion is characterized by the point spread function of the optical system. The point spread function describes the response of an imaging system to a point source. For a non point source ,the image is a superposition of the point spread function of multiple point sources representing the non point source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many techniques of image deconvolution and references, too many to list in this format. But for examples of applications using linear algebra, you may want to begin by looking for references on image deconvolution using&#xA;Wiener filters, or the Richardson-Lucy method. Both require knowledge of the point spread function of  the system , but both involve linear algebra.&lt;/p&gt;&#xA;" OwnerUserId="10282" LastActivityDate="2015-05-30T01:47:49.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23779" PostTypeId="1" AcceptedAnswerId="23780" CreationDate="2015-05-30T07:03:04.367" Score="4" ViewCount="14293" Body="&lt;p&gt;I don't know where to start from. and this question might be very silly,&lt;/p&gt;&#xA;&lt;p&gt;I have found such as comment from someone at &lt;a href=&quot;https://dsp.stackexchange.com/questions/15967/poisson-noise-and-curve-fitting-denoise-first&quot;&gt;Poisson noise and curve fitting - denoise first?&lt;/a&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;I think if your noise is zero-mean it doesn't matter, if not it does (you should de-noise first). I'm not entirely sure though so I won't put it in an answer yet.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Q1. Actually, I want to know what does zero-mean noise mean? and what does it not matter means?&lt;/p&gt;&#xA;&lt;p&gt;Q2. Why we presume that the noise in Gaussian filter have sigma 1 and mean 0 ?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="7092" LastEditDate="2021-05-29T13:21:29.737" LastActivityDate="2021-05-29T13:21:29.737" Title="What does zero-mean noise mean?" Tags="|noise|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23780" PostTypeId="2" ParentId="23779" CreationDate="2015-05-30T07:53:30.507" Score="2" Body="&lt;p&gt;It is an easy concept but a sometimes it is hard to express it compactly.&#xA;The difficulty arises because of additional concepts to be known for any formal description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you may know, mathematical analysis of noise variables and signals are handled via the tools of probability theory, in particular by the stochastic (random) processes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual progress is such that first properties of random variables are described and then properties of random signals are derived based on it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mean for a random variable, X, is defined to be its Expected Value E(X) and computed based on its Probability Density Function $f_X(x)$ such as $\mu_X = \int {xf_X(x) dx}$ with the limits from minus to plus infinity for a continuous random variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a zero mean random variable is that one for which the above integral is zero. (for a discrete random variable the integral is replaced by a sum and pdf is replaced by a pmf). This is also called as the average value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Random signals are considered to be made up of an infinite set of random variables each making a single value at a single instance of observation of the instance being created. Hence there is the concept of ensemble and time averages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now coming to random signals X(t) (noise) expected value of a random signal is also expressed as E(X(t)) which for a Stationary (or at east Weakly Stationary up to second order) Process is a fixed value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your answer is that a zero mean noise is that one for which E(X(t)) is zero for all t. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However above is a theoretical description of Mean. In practice to compute mean and other theoretical parameters, you will refer to statistical computation which deal with practically observed data and computations based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key which connects statistically made (practical) computations to theoretical computations is the Ergodicity Theorem which states that for an ergodic random process theoretical computations are equal to statistical ones.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-05-30T08:54:06.710" LastActivityDate="2015-05-30T08:54:06.710" CommentCount="22" ContentLicense="CC BY-SA 3.0" />
  <row Id="23781" PostTypeId="1" AcceptedAnswerId="23788" CreationDate="2015-05-30T08:36:02.903" Score="0" ViewCount="164" Body="&lt;p&gt;okay , so there is an 8-bit linear PCM encoder . Now this mean that the amplitude of quantization levels is 2^8= 256 or I have to measure the values from oscilloscope ? does anybody have any idea how to answer that?&lt;/p&gt;&#xA;" OwnerUserId="16027" LastActivityDate="2015-05-30T21:06:54.400" Title="what is the amplitude of quantization levels?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23782" PostTypeId="1" CreationDate="2015-05-30T08:56:56.673" Score="5" ViewCount="1124" Body="&lt;p&gt;I'm looking to apply an optimal LQR filter to a discrete signal of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n]=A\sin[\omega_0n + \phi]+ v[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude $A$ and the phase $\phi$ are unknown variables I want to estimate using the filter, and $v[n]$ is an uncorrelated noise signal of variance ${\sigma_v}^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to build a state model to generate this sine wave, and proceed from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your help.&lt;/p&gt;&#xA;" OwnerUserId="15967" LastEditorUserId="128" LastEditDate="2018-06-21T05:59:30.620" LastActivityDate="2022-10-11T18:43:06.183" Title="Discrete Sinusoidal to State Space" Tags="|estimation|kalman-filters|filtering|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23783" PostTypeId="2" ParentId="23633" CreationDate="2015-05-30T09:30:00.113" Score="1" Body="&lt;p&gt;Even during my college days, I did not have lecturers who could teach this subject very well, however that did not stop me from learning and what I found was --&gt;Check out &lt;a href=&quot;http://ocw.mit.edu/resources/res-6-008-digital-signal-processing-spring-2011/&quot; rel=&quot;nofollow&quot;&gt;http://ocw.mit.edu/resources/res-6-008-digital-signal-processing-spring-2011/&lt;/a&gt;, lectures and course materials by &lt;em&gt;Prof. Alan V. Oppenheim&lt;/em&gt;. And also &lt;a href=&quot;http://www.dspguide.com/pdfbook.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/pdfbook.htm&lt;/a&gt; by Steven W. Smith. These resources are great for self learning. For gaining further grasp of concepts clearly, I'd suggest you start off by implementing some DSP functions in C++ like Fourier transforms. &lt;/p&gt;&#xA;" OwnerUserId="9152" LastActivityDate="2015-05-30T09:30:00.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23784" PostTypeId="1" CreationDate="2015-05-30T10:54:46.610" Score="0" ViewCount="559" Body="&lt;p&gt;I am using a MatLab audio feature extraction toolbox (MIRToolbox), and I am in the process of cross correlating an onset curve (envelope).  I am aware of what the lag means when using Matlab's &lt;code&gt;xcorr&lt;/code&gt; function since you normally pass in indices, but I am struggling to work out what the lag means when referred to in seconds on the x-axis.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the user manual, it has a minimum time of 0.2(s) and a maximum of 2(s) with onset envelopes.  Does this mean it only cross correlates for 2 seconds?  Its just that I have experimented with a 10(s), 30(s), and 3+(mins) edit of an audio file, and the plot is always showing 3 peaks, and looks more or less the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JdI7G.jpg&quot; alt=&quot;Onset Detection&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cV72c.jpg&quot; alt=&quot;Autocorr&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15770" LastEditorUserId="15770" LastEditDate="2015-06-02T10:02:17.587" LastActivityDate="2015-06-02T10:02:17.587" Title="Autocorrelation Lag In Seconds Explanation?" Tags="|autocorrelation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23785" PostTypeId="1" CreationDate="2015-05-30T13:34:38.373" Score="1" ViewCount="92" Body="&lt;p&gt;I have been looking for libraries for Image Processing using hadoop, but by now, only have been able to know about hipi, and to some extent hadoopy. Are there any other libraries for the same?&#xA;Hipi uses java programming, so I am looking for some sort of python-integrated programming with Hadoop? Kindly help!&lt;/p&gt;&#xA;" OwnerUserId="7914" LastActivityDate="2015-05-30T13:34:38.373" Title="Are there any other libraries for Image Processing using hadoop?" Tags="|image-processing|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23788" PostTypeId="2" ParentId="23781" CreationDate="2015-05-30T21:01:24.190" Score="0" Body="&lt;p&gt;Practically speaking an 8-bit linear PCM encoder is implemented inside an 8-bit ADC (Analog to Digital Converter). Such an encoder accepts an analog input within a given refence voltage range and divides this range into 256 equally spaced quantization levels. Some minor deviations may occur based on the quantizer level distributions especially at the first and last levels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this stage analog input is converted into a PCM bit stream consisting of 8 bits of quantization codes per each sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to view these codes ? you can use a binary analyser to see each bit on or off in parallel... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if you mean observing the output of a DAC (Digital to Analog Converter) driven by this bit stream then you will be converting these bits back into analog and view it using the oscilloscope. The values will be steppy and be scaled by a reference voltage.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-05-30T21:06:54.400" LastActivityDate="2015-05-30T21:06:54.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23789" PostTypeId="1" AcceptedAnswerId="23790" CreationDate="2015-05-31T02:37:43.620" Score="3" ViewCount="102" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QzuBu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As is shown in the picture,&#xA;a template signal is delayed and overlapped in time domain, &#xA;the shape of  template signal is already known&#xA;The positions of each template are already known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each template has its own carrier frequency, and amplitude.&#xA;Or the carrier has a Gaussian distribution $\mathcal{N}$($\mu$,$\sigma^2$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to estimate them？ Please provide some recommendations, thank you.&lt;/p&gt;&#xA;" OwnerUserId="16038" LastEditorUserId="128" LastEditDate="2019-10-31T05:59:49.313" LastActivityDate="2019-10-31T05:59:49.313" Title="How to Estimate Carrier Frequency &amp; Amplitude for Several Overlapped Template Signal" Tags="|frequency-spectrum|signal-detection|matched-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="23790" PostTypeId="2" ParentId="23789" CreationDate="2015-05-31T05:48:02.207" Score="1" Body="&lt;p&gt;If the auto correlation of the signal is sharp enough, you can do Matched Filter and search for local extreme points.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet it seems the figure you'e displaying is in the frequency domain.&lt;br&gt;&#xA;But we can treat the frequency domain as it was time domain and work with the same &quot;Trick&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely searching for the frequency in the frequency is like searching for the delay in the time domain.&lt;br&gt;&#xA;Since the signal is known, its multiplication by a carrier is known whihc will be used as the Matched Filter.&lt;br&gt;&#xA;Applying it will yield 3 peaks each with its own &quot;Delay&quot; which corresponds to its frequency.&lt;br&gt;&#xA;Going back to that frequency bin (Or calculating the DTFT at that point) will yield the amplitude.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-05-31T05:48:02.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23791" PostTypeId="1" CreationDate="2015-05-31T07:41:53.477" Score="1" ViewCount="3504" Body="&lt;p&gt;I &lt;em&gt;suggested&lt;/em&gt; to someone that one can create a sinc filter that is ideal enough to be indistinguishable from the ideal, given certain limitations with the data in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was only a suggestion yet it was met with unhelpfulness.&lt;/p&gt;&#xA;" OwnerDisplayName="user15987" LastActivityDate="2022-03-10T10:23:37.760" Title="What does it mean to say that &quot;sinc&quot; filters are ideal?" Tags="|filters|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23794" PostTypeId="2" ParentId="23791" CreationDate="2015-05-31T08:33:09.697" Score="3" Body="&lt;p&gt;An ideal system (such as a briwckwall filter) is the one which can be described theoretically (mathematically) but cannot be realized practically (physically).&lt;/p&gt;&#xA;&lt;p&gt;The ideality of the sinc filter, aka the brickwall, results from its frequency-domain definition: an LTI low-pass filter with no ripples in the pass &amp;amp; stop bands and zero transition width.&lt;/p&gt;&#xA;&lt;p&gt;Having this specification, an ideal lowpass filter, can be described mathematically, but cannot be realized using any practical techniques. One can find the impulse response of an ideal lowpass filter by using any suitable mathematical tools such as the the frequency to time-domain transformation of the given frequency reponse of the filter.&lt;/p&gt;&#xA;&lt;p&gt;It results that an ideal low-pass filter has an impulse response in the form of a sinc(x) function, which extends from minus to plus infinity in time, a manifestation of its ideality.&lt;/p&gt;&#xA;&lt;p&gt;Thus, when a sinc filter is to be implemented in practice, it can only be approximated; by truncatation in time for the sinc filter case. The approximation gets better as the length of the truncation increases which, however, is an undesired consequence.&lt;/p&gt;&#xA;&lt;p&gt;Instead of forcing approximations to ideal sinc filters this way, it is practically more effective to use other techniques, such as weighted windowing, to realize those ideal filters, which follows the conversion of filter characteristics from those of the ideal one to that of the realizable one.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2022-03-10T10:23:37.760" LastActivityDate="2022-03-10T10:23:37.760" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23795" PostTypeId="2" ParentId="23791" CreationDate="2015-05-31T08:35:02.957" Score="1" Body="&lt;p&gt;A sinc filter is unstable and not causal, so as such it can't be implemented. In discrete-time you can in principle approximate it arbitrarily closely by applying a (very long) window to the ideal filter impulse response, and shifting it such that it becomes causal. The latter will add a delay but it will not affect the magnitude response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-05-31T08:35:02.957" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="23797" PostTypeId="1" CreationDate="2015-05-31T11:33:52.540" Score="3" ViewCount="268" Body="&lt;p&gt;It seems apparent that different FFT algorithms (e.g. Numpy.fft vs FFTS) produce slightly different results. I'm seeing deviations around 0.005 to 0.01 between programs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for these, I guess, lies in computer arithmetic, but are there simple ways for finding out where the differences are caused? Or to tell, which algorithm is more precise?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-05-31T11:44:19.833" LastActivityDate="2016-04-26T03:07:39.653" Title="How much deviation is acceptable in FFT calculations (using computer algorithms)?" Tags="|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23798" PostTypeId="1" AcceptedAnswerId="23799" CreationDate="2015-05-31T12:02:56.447" Score="0" ViewCount="760" Body="&lt;p&gt;I'm studying the transfer function of an aircraft that relates the pitch angle, $\theta$, with the horizontal stabilizer angle, $\delta$.&#xA;$$ H(s) = \dfrac{\theta (s)}{\delta (s)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have computed the frequency response by using Matlab, and I plotted the Bode Diagram: amplitude plot and phase plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3t7Tl.png&quot; alt=&quot;Bode Diagram&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand what is the amplitude curve indicating and I'm able to comment the result obtained. But when it comes to studying the &lt;strong&gt;phase curve&lt;/strong&gt; (second figure above) I don't know what is the meaning and how it is related with the other curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is: what can I say from the phase plot by looking at the Bode Diagram of the studied transfer function, $H(s)$? &lt;/p&gt;&#xA;" OwnerUserId="15843" LastEditorUserId="15843" LastEditDate="2015-05-31T12:10:32.093" LastActivityDate="2015-05-31T15:06:29.900" Title="Phase plot in Bode Diagrams" Tags="|frequency-response|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23799" PostTypeId="2" ParentId="23798" CreationDate="2015-05-31T12:21:19.217" Score="3" Body="&lt;p&gt;The Bode diagram shows you the properties of the transfer function $H(s)$ for $s=j\omega$, i.e. the complex frequency response. Since $H(j\omega)$ is generally a complex function it has a magnitude and a phase:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\omega)=|H(j\omega)|e^{j\phi(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot shows the principal value of the phase in the interval $[-\pi,\pi)$, that's why you see a jump (of $2\pi$), which is no actual phase jump but it just comes from mapping the phase back to the interval $[-\pi,\pi)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitude of $H(j\omega)$ tells you the relative amplification/attenuation of the different frequency components, whereas the phase shows you the relative alignment of the different components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a sinusoid $x(t)=A\sin(\omega_0t+\theta)$ will appear at the output of the system as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=A|H(j\omega_0)|\sin(\omega_0t+\theta+\phi(\omega_0))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi(\omega_0)$ is the system's phase response evaluated at the input frequency $\omega_0$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-31T15:06:29.900" LastActivityDate="2015-05-31T15:06:29.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23800" PostTypeId="1" CreationDate="2015-05-31T14:07:43.107" Score="-1" ViewCount="3935" Body="&lt;p&gt;What wavelet-based peak finding functions are there for C++?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for something similar to:&#xA;&lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.signal.find_peaks_cwt.html&quot; rel=&quot;nofollow&quot;&gt;http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.signal.find_peaks_cwt.html&lt;/a&gt;. Preferably something that produces the same exact results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have tried:&#xA;&lt;a href=&quot;https://github.com/xuphys/peakdetect&quot; rel=&quot;nofollow&quot;&gt;https://github.com/xuphys/peakdetect&lt;/a&gt;,&#xA;but this does not operate on floats (but shorts) and gives different results (either because of shorts or if it's not wavelet-based). The difference produced is around 20%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My signals are audio signals and I'm doing $f_0$ estimation from an autocorrelation (ACF) signal (can be noisy, can be polyphonic).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, how does one in general interpret, whether the algorithm produces &quot;the right peaks&quot;? Just by plotting?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-05-31T17:32:43.923" LastActivityDate="2023-09-05T06:29:29.880" Title="Wavelet-based C/C++ Peak finding libraries" Tags="|wavelet|peak-detection|c++|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23801" PostTypeId="1" CreationDate="2015-05-31T14:52:54.900" Score="5" ViewCount="1613" Body="&lt;h1&gt;The goal&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I wish to compute the coherence estimate using the continuous wavelet transform (CWT) of a real-valued signal with the complex Morlet (a.k.a. Gabor) wavelet. I compute the cwt of the signal in a very similar way as in the &lt;a href=&quot;https://github.com/regeirk/pycwt/blob/master/wav.py#L435&quot; rel=&quot;nofollow noreferrer&quot;&gt;pycwt library&lt;/a&gt;, but I use the pyfftw library for faster FFT computation. I'm confident that the cwt is computed correctly, because I get nearly identical results to &lt;code&gt;pycwt.cwt&lt;/code&gt; and the scalograms compare well to STFT spectrograms. Although I use Python, I think it is not language specific.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Coherence calculation resources&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;However, I'm not so confident as to how to compute the coherence estimate. I based my coherence calculation on the classic &lt;a href=&quot;http://paos.colorado.edu/research/wavelets/interdecadal.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Torrence &amp;amp; Webster 1999&lt;/a&gt; paper (as does pycwt) where prior to computing the &lt;a href=&quot;https://en.wikipedia.org/wiki/Coherence_(signal_processing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;coherence fraction&lt;/a&gt; they smooth the cross-power density (&lt;code&gt;cwt(sig)1 * cwt(sig2).conj()&lt;/code&gt;) and power densities (&lt;code&gt;abs(cwt(sig))**2&lt;/code&gt;) in time with a Gaussian kernel with a standard deviation equal to the scale for each scale. This makes sense to me, because the spectral characteristic changes at a slower rate for larger scales, so a larger smoothing window is necessary than for smaller scales. They also smooth them in the scale domain with a simple moving average, which makes less sense to me.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Issues with the definition and implementation&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Here are my issues with the implementation and/or definition of this smoothing operator for which I seek explanation and/or help&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Smoothing in the time domain&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Gaussian smoothing in time doesn't seem to have a wide-enough smoothing window at small scales (I suspect because the std. deviation is close to the sampling step so it doesn't smooth much) and the resulting coherence at small scales (high frequencies close to Nyquist) is almost always unity. I compute this convolution via multiplication with FFT (as &lt;a href=&quot;https://github.com/regeirk/pycwt/blob/master/wav.py#L118&quot; rel=&quot;nofollow noreferrer&quot;&gt;does pycwt&lt;/a&gt;). &lt;strong&gt;Is this Gaussian window inappropriate for some reason in my case or is there something wrong with my implementation?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Smoothing with a moving average produces much more reasonable results at high frequencies, but understandably worse at low frequencies (large scales). It seems the MATLAB wavelet toolbox also uses a moving window for time domain smoothing in &lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/wcoher.html#namevaluepairs&quot; rel=&quot;nofollow noreferrer&quot;&gt;wcoher&lt;/a&gt;. &lt;strong&gt;Is this the recommended approach then? What about lower frequencies?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Smoothing in the scale domain &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The moving average smoothing in the scale domain seems to be empirical, but I can live with that. I's just that there seems to be now real explanation why it is necessary (it isn't done in &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/mscohere.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Welch's method of coherence estimation&lt;/a&gt; as far as I know). &lt;strong&gt;Is there a good reason to perform smoothing in the scale domain?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;What really confuses me is that &lt;a href=&quot;https://github.com/regeirk/pycwt/blob/master/wav.py#L118&quot; rel=&quot;nofollow noreferrer&quot;&gt;pycwt computes&lt;/a&gt; it on logarithmically-spaced scales, which is a non-linear filter and I'm not sure whether that makes any sense. &lt;strong&gt;Does it make sense even as a non-linear filter?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h1&gt;Results so far&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;So far I've used just a simple moving average filter only in the time domain and that gives reasonable results above low frequencies. However, I don't feel confident about the results and I will need coherence at lower frequencies in the future, so I'm asking here. I also tried using the Gaussian window with a much larger standard deviation to get results similar to the moving average window smoothing results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thick lines in every first subplot are lowpass-filtered versions of the original, semi-transparent signals. I added these lowpassed signals to make it simpler to distinguish the two signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With logarithmic frequency axes (shows low frequencies better):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/uSGwg.png&quot; alt=&quot;example of xwt with log freq axes&quot;&gt;&#xA;With linear frequency axes (shows general coherency):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4819F.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;This is the part of the code that I use for smoothing, &lt;code&gt;fftmod&lt;/code&gt; is &lt;code&gt;pyfftw.interfaces.numpy_fft&lt;/code&gt; (which provides the same functions as the &lt;code&gt;numpy.fft&lt;/code&gt; module)&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# smoothing in time domain&#xA;freqs = fftmod.fftfreq(self.time_axis.data.shape[0],&#xA;                       self.axis_step(0))[:,np.newaxis]&#xA;freqs0 = self.axis1.data&#xA;if smoothing_window:  # moving average&#xA;    if isinstance(smoothing_window, complex):&#xA;        # in time units, convert to number of points&#xA;        smoothing_window = abs(smoothing_window) / self.axis_step(0)&#xA;    smoothing_window = np.empty(smoothing_window)[:,np.newaxis]&#xA;    smoothing_window.fill(1.0 / smoothing_window.size)&#xA;    smoothing_ft = fftmod.fft(smoothing_window, n=freqs.size,&#xA;                              axis=0, **fftw_kwargs)&#xA;else: # gaussian smoothing, gaussian_std_mul multiplies the std dev&#xA;    # FT of smoothing window which is a gaussian with std dev 1/f0&#xA;    # is a gaussian with std dev f0 without f0 in normalization const&#xA;    smoothing_ft = np.exp(-(freqs/freqs0 * gaussian_std_mul)**2 / 2.0) / _SQRT_2PI&#xA;# smooth by convolution with window as multiplication in Fourier domain&#xA;csd = fftmod.ifft(smoothing_ft * fftmod.fft(&#xA;    csd, axis=0, **fftw_kwargs), axis=0, **fftw_kwargs) # TODO maybe fft of vstack&#xA;psd_self = fftmod.ifft(smoothing_ft * fftmod.fft(&#xA;    psd_self, axis=0, **fftw_kwargs), axis=0, **fftw_kwargs).real&#xA;psd_signal = fftmod.ifft(smoothing_ft * fftmod.fft(&#xA;    psd_signal, axis=0, **fftw_kwargs), axis=0, **fftw_kwargs).real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;More recent resources&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I did some further digging and found an article from 2007 by Bernard Cazelles. The &lt;a href=&quot;http://www.biologie.ens.fr/~cazelles/bernard/Research.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;code available on his website&lt;/a&gt; (includes the article in the zip file) seems to suggest that he also uses smoothing both in the scale and frequency domain with various different windows (Barttlet, Hamming, Boxcar,...), but does use different window lengths for different scales in the time domain and just one length in the scale domain. The code shows that the scale domain is again logarithmic and yet is smoothed with a linear window. However, at least he cites Chatfield 1989 who cites a suggestion from P. J. Daniell in 1946 that smoothing in the frequency domain is also needed.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastEditorUserId="15679" LastEditDate="2016-02-21T15:49:05.860" LastActivityDate="2021-08-25T00:07:35.760" Title="Issues with the smoothing operator in coherence estimation using the complex Morlet (Gabor) wavelet" Tags="|wavelet|python|smoothing|gabor|coherence|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23804" PostTypeId="2" ParentId="23758" CreationDate="2015-05-31T16:35:52.193" Score="4" Body="&lt;p&gt;From my understanding of the linked answer which you base your algorithm on I would conclude that the FT will detect all the edges in the frame domain, so all the moving objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to localize the transform information, I suggest you use a wavelet transform with a complex wavelet. Instead of correlating the signal with $e^{i2\pi fx}$ as FT does it would be correlated with oscillations localized by some window. A commonly used wavelet is the complex Morlet (a.k.a. Gabor) wavelet $e^{i2\pi fx - (xf_p)^2}$ which uses a Gaussian window to localize the oscillation (I left out the normalization constants). Commonly $f=f_p$ is used to get a so called constant Q transform. Note that this is just an example of a wavelet that I use for analyzing evolution of spectra of some simple 1D signals, you may find that a different choice of a wavelet suits your needs better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://www.mathworks.com/help/wavelet/index.html&quot; rel=&quot;nofollow&quot;&gt;MATLAB wavelet toolbox&lt;/a&gt; is designed for 1D or 2D signals. Because you need to localize the transform only in the x and y dimensions, so you might be able to apply the 2D cwt on each slice and then compute the FFT only accross the frame dimension. You equation (4.1) would then have the terms $e^{-(xu)^2 - (yv)^2}$ added in the case of the complex Morlet wavelet. Note that the resulting transform matrix will have also dimensions for the (x,y) coordinates. All in all I think it will be really hard to interpret the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps a simpler way would be to use your existing algorithm and select a mask (region) in the image corresponding to the object of interest and then perform a correlation of that region with the next frame. Assuming the object won't greatly change in the next frame (which in this head-on view of the highway might work, but may fail if it  becomes larger in the objective of the camera), the correlation should give you a maximum in the next frame in the region where it moved to.  Then you perform the correlation of this new region with the following frame. These correlation maximums then create a trail in the frame domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also cut down on the computation time by computing the correlation only in the regions  that are moving. If the regions don't overlap and move slowly, you could just select the region in the next frame that is the closest to the region location in the current frame. This would be more robust in terms of the object becoming larger, but would require slow movement and that the trails don't suddenly cross.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: If you insist on using STFT (but I really think the correlation/detecting region movement would be a lot simpler), it would essentially require the algorithm to partition the FFT computation into several windows, so the whole algorithm beginning with the line &lt;code&gt;%Apply 3-D ...&lt;/code&gt; would run in nested for loops (one for each dimension), each iteration representing a single x,y window&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Complete_Filtered_Image_Array = Filtered_Image_Array;  % store the whole array&#xA;x_window_len = 20;  % you will have to determine these values empirically&#xA;x_window_overlap = 10;  % half overlap is a reasonable default&#xA;y_window_len = 10;&#xA;y_window_overlap = 5;&#xA;for x = 0:x_window_overlap:frameWidth-x_window_len&#xA;    for y = 0:y_window_overlap:frameHeight-y_window_len&#xA;        Filtered_Image_Array = Complete_Filtered_Image_Array(x:x+x_window_len, y:y+y_window_len, :);&#xA;        % continue the previous algorithm with this sliced Filtered_Image_Array&#xA;        %Apply 3-D ...&#xA;        f_transform=fftn(Filtered_Image_Array);&#xA;        ...&#xA;     end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'd also have to create a way to select the initial window with the object of interest and track which window it moves to, so in the end I think you'll be using the correlation/region movement technique anyways, so perhaps you don't need the STFT step at all.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastEditorUserId="15679" LastEditDate="2015-06-06T11:39:26.547" LastActivityDate="2015-06-06T11:39:26.547" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23805" PostTypeId="1" AcceptedAnswerId="23808" CreationDate="2015-05-31T16:52:13.357" Score="2" ViewCount="236" Body="&lt;p&gt;Given a signal X which is sampled at a certain frequency. The value we currently compute is given as the integral of the upsampled signal. Thus: Y = X but 100 times upsampled, by means of sinc interpolation or by using an FFT resampler. The integral is simply the sum of all values in Y.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The calculation of this integral is easy, yet I would like to speed it up by avoiding the upsampling step. Is there any possibility to obtain the integral of the upsampled signal, without actually resampling it ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/10430/preserving-integral-through-downsampling&quot;&gt;Preserving integral through downsampling&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/3243/do-lowpass-filters-affect-the-integral-over-the-signal&quot;&gt;Do lowpass filters affect the integral over the signal?&lt;/a&gt; are similar questions, but deal with cases of downsampling or bandlimiting. In both cases, it is clear that an integral will not exactly be preserved by downscaling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, in this question, we are talking about upsampling. I suspect this is possibly because X does contain all information necessary to create Y.&lt;/p&gt;&#xA;" OwnerDisplayName="user7488" LastEditorUserId="-1" LastEditorDisplayName="user7488" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-05-31T20:43:58.653" Title="Integral of an upsampled signal, without actually resampling it" Tags="|resampling|integration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23806" PostTypeId="2" ParentId="9337" CreationDate="2015-05-31T17:54:10.267" Score="0" Body="&lt;p&gt;Flexible Audio Source Separation Toolbox is available in Python, C++ and Matlab and it has demonstration files here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://bass-db.gforge.inria.fr/fasst/&quot; rel=&quot;nofollow&quot;&gt;http://bass-db.gforge.inria.fr/fasst/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2015-05-31T17:54:10.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23807" PostTypeId="2" ParentId="23800" CreationDate="2015-05-31T18:09:21.537" Score="1" Body="&lt;p&gt;If you're already satisfied with the scipy version, you could use Cython to translate it to C code. Of course, Cython will not generate super nice C code by default, but that can be changed by compiler directives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there might be a better approach than peak detection. If you show us some plots, we might be able to point you in the better direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for &quot;the right peaks&quot; question, if you were able to mathematically define what you mean by that (e.g. statistical distribution of values, noise or frequency characteristic), then you could use that to construct a perfect detector in the first place. It is usually very hard to define the characteristics of &quot;the right peak&quot;, so it is often much simpler to use one of the most advanced detectors: our eyes and our mind.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastActivityDate="2015-05-31T18:09:21.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23808" PostTypeId="2" ParentId="23805" CreationDate="2015-05-31T19:19:09.253" Score="4" Body="&lt;p&gt;If you upsample a causal discrete-time signal $x[n]$ by an integer factor $L$ and you use an interpolation filter with a causal impulse response $h[n]$, the upsampled and interpolated signal is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=0}^{\infty}x[k]h[n-kL]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that the requirement of causality can be easily removed; I just use it to have the lower summation indices start with the value $0$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to compute the sum of $y[n]$, you would need to compute&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_y=\sum_{n=0}^{\infty}y[n]=\sum_{n=0}^{\infty}\sum_{k=0}^{\infty}x[k]h[n-kL]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can interchange the sums in (2), resulting in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_y=\sum_{k=0}^{\infty}x[k]\sum_{n=0}^{\infty}h[n-kL]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of the inner sum in (3) is independent of the index $k$, so we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_y=s_h\cdot \sum_{k=0}^{\infty}x[k]=s_h\cdot s_x\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_h=\sum_{n=0}^{\infty}h[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the sum of the upsampled and interpolated signal is simply the sum of the original signal times a factor which is given by the sum over the impulse response values of the interpolation filter. Note that for the ideal sinc filter, this factor equals the upsampling factor $L$. This is also at least approximately true for all practical interpolation filters, because the sum over the impulse response equals the DC gain of the interpolation filter, which should ideally equal $L$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to keep things simple (and why wouldn't you?), you could use&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_y\approx L\cdot s_x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a very good approximation (or even exactly true) for any reasonable interpolation filter.&#xA;&lt;hr&gt;&#xA;In the above derivations I've assumed that all the (infinite) sums exist, which in practice is always the case if we deal with finite length signals and with stable interpolation filters.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-05-31T20:17:11.773" LastActivityDate="2015-05-31T20:17:11.773" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23810" PostTypeId="2" ParentId="23797" CreationDate="2015-05-31T21:18:33.823" Score="1" Body="&lt;p&gt;I wouldn't like to give a trivial answer as &quot;it depends on the application&quot; but indeed it does depend on the application! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering the fact that FFT computation will not be the only source of error in many applications it is reasonable to allow some acceptable deviations but generally being bounded by such as the required precision of the overall system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand very strict precision bounds may be defined on such as IEEE floating point hardware (or soft simulation) units so that a prescribed set of computations will not generate an error larger than very small epsilon values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if such a set of normalized limits exist specificaly for FFT or like algorithms. If you find out that there are mismatches from ideal DFT values and the corresponding fast algorithms you must make your own decision as to whether you should allow this error in favor of some other gains. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-05-31T21:18:33.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23811" PostTypeId="2" ParentId="23791" CreationDate="2015-05-31T22:41:57.870" Score="2" Body="&lt;p&gt;the &lt;em&gt;&amp;quot;ideal&amp;quot;&lt;/em&gt; property of a &lt;span class=&quot;math-container&quot;&gt;$\operatorname{sinc}(\cdot)$&lt;/span&gt; filter is in reference to its Fourier Transform&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathscr{F} \left\{ 2 f_0 \ \operatorname{sinc}(2 f_0 t) \right\} \ = \  \operatorname{rect}\left( \frac{f}{2f_0} \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{sinc}(x) \triangleq&#xA;\begin{cases}&#xA;\frac{\sin(\pi x)}{\pi x}, &amp;amp; \text{if }x \ne 0 \\&#xA;1, &amp;amp; \text{if }x = 0&#xA;\end{cases} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{rect}(x) \triangleq&#xA;\begin{cases}&#xA;1, &amp;amp; \text{if }|x|&amp;lt;\frac{1}{2} \\&#xA;0, &amp;amp; \text{if }|x|&amp;gt;\frac{1}{2}&#xA;\end{cases} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;the &lt;span class=&quot;math-container&quot;&gt;$\operatorname{sinc}(\cdot)$&lt;/span&gt; filter perfectly and totally excludes all frequency components above &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt; and perfectly and totally leaves all frequency components below &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt; unmolested.  that's why it's ideal.  it's an ideal (and impossible to attain) filtering operation.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2022-03-09T21:51:47.607" LastActivityDate="2022-03-09T21:51:47.607" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23812" PostTypeId="1" AcceptedAnswerId="23816" CreationDate="2015-06-01T03:26:39.460" Score="2" ViewCount="567" Body="&lt;p&gt;I have read a paper that performs Channel Estimation of Wireless Channel as follows.&lt;/p&gt;&#xA;&lt;p&gt;A training sequence of length &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, lets call it &lt;span class=&quot;math-container&quot;&gt;$a_N(i)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i\in[0:N-1]$&lt;/span&gt;  is repeated twice then sent out over the channel.&lt;/p&gt;&#xA;&lt;p&gt;Assume the transmit sequence formed of this two sequences is denoted by &lt;span class=&quot;math-container&quot;&gt;$s_{CE}(t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The received signal is given by (assuming channel of length &lt;span class=&quot;math-container&quot;&gt;$T_{CH}$&lt;/span&gt;) is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$r_{CE}(t) = \sum_{t'=0}^{T_{CH}-1}h(t')s_{CE}(t-t')+n(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The authors claim that if one takes the autocorrelation between a sequence &lt;span class=&quot;math-container&quot;&gt;$a_N(i)$&lt;/span&gt; and the received signal then we can mathematically write the autorcorrelation as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R(t)= \frac{1}{N}\sum_{d=0}^{N-1}r_{CE}(t+d\underbrace{-N+1}_{????}) a_{N}^*(d) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is why is there a need for the term I have underbrace &lt;span class=&quot;math-container&quot;&gt;$-N+1$&lt;/span&gt;. I thought that the autocorrelation is in general expressed as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R(t)= \frac{1}{N}\sum_{d=0}^{N-1}r_{CE}(t+d) a_{N}^*(d) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thanks looking forward for your view!&lt;/p&gt;&#xA;&lt;p&gt;Update: The following is the reference&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/4699819&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I particular (25) and (26) are my main concerns.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="7092" LastEditDate="2022-05-12T11:20:04.697" LastActivityDate="2022-05-12T11:20:04.697" Title="Autocorrelation function between received and training signal used for channel estimation" Tags="|digital-communications|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="23813" PostTypeId="1" AcceptedAnswerId="23818" CreationDate="2015-06-01T05:27:54.123" Score="1" ViewCount="325" Body="&lt;p&gt;This is purely theoretical question but can an actual delta-dirac function ever be sampled? To make it clear again, I'm not talking about an impulse response from the impulse function. Lets say we have a truly instantaneous impulse as defined with delta-Dirac that the impulse with infinite(or finite) height and no width, an instantaneous pulse. This pulse is to be detected by sampling, but to find this instant signal, wouldn't this require an infinitely fast sampling or infinite sampling rate? Thinking this in terms of frequency domain, I believe delta function is 1 or has infinite spectrum. So would delta function ever be sampled unless we have infinite sampling rate?&lt;/p&gt;&#xA;" OwnerUserId="16045" LastEditorUserId="4298" LastEditDate="2023-03-16T12:51:59.050" LastActivityDate="2023-03-16T12:51:59.050" Title="Can an Delta Dirac function (not response) ever be sampled?" Tags="|sampling|dirac-delta-impulse|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23814" PostTypeId="2" ParentId="23813" CreationDate="2015-06-01T05:58:32.743" Score="-2" Body="&lt;p&gt;Yeah, I think your conclusion is right. According to Nyquist' sampling theorem, the sampling rate should be at least twice as many as the maximum frequency of the target signal. And the maximum frequency of delta function is infinite. If sampled, aliasing must occur. In fact, the discrete delta function $\delta(n)$ is a sampled version of continuous delta function $\delta(t)$. The spectrum is overlapped while sampling, of course.&lt;/p&gt;&#xA;" OwnerUserId="16046" LastActivityDate="2015-06-01T05:58:32.743" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23815" PostTypeId="1" AcceptedAnswerId="23828" CreationDate="2015-06-01T06:22:44.620" Score="1" ViewCount="20222" Body="&lt;p&gt;In theory of noise,Typically, the standard deviation of noise has 1 and mean has 0.&#xA;I think that the reason of noise mean has 0 that we can assume that all noise signal go to zero when we sum it all.&#xA;But I can't understand standard deviation of noise has 1 in image noise.&#xA;They are always 0~255. There is no negative value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/23779/what-does-zero-mean-noise-mean/23780?noredirect=1#comment43725_23780&quot;&gt;What does zero-mean noise mean?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Especially, but I have got an idea as following. I can't catch quite a bit. So would you please let me know how to illustrate following answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;for an image intensity which is always non-negative, you can simply modify your added N(0,1) standard gaussian noise in 3 steps: 1-scale it so that your noise has whatever std you wish. 2-add whatever proper mean you need such as 128. 3-clip the noise for below zero and above 255 samples. This is simple bt It will help you get what you need at least initially.&quot;&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2017-06-23T14:08:49.687" Title="What does standard deviation of noise 1 mean?" Tags="|noise|statistics|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23816" PostTypeId="2" ParentId="23812" CreationDate="2015-06-01T06:48:15.730" Score="0" Body="&lt;p&gt;I think it's just a trick which makes $R(t)=0, \mathrm{when}\quad t&amp;lt;0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, $-N+1$ is just a time offset and not affect the essence of function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r_{CE}(t)$ is bounded to $[0, 2N+T_{CH}-2]$, and $a_N(t)$ to $[0, N-1]$. In the form you gave, $R(t)$ is bounded to $[-N+1, 2N+T_{CH}-2]$. May be the author want the non-zero value of $R(t)$ also starts at 0, so he just move it right with $N-1$ length, which causes the $-N+1$ term in the equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--------- Why $R(t)$ is bounded as that -------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just a explanation to give some intuition, not a formal proof. Consider two function $f(t)$ and $g(t)$, which $f(t)=0, t \notin [a, b]$ and $g(t)=0, t\notin [c, d]$. Now we want to calculate the sum of products, i.e., $S=\sum_t f(t)g(t)$, $[a,b]$ and $[c,d]$ must be overlapped, right? Thus we get $a \le d $ and $c\le b$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Get back to the $R(t)=\sum _d r_{CE}(t+d)a^*(d)$(note here the argument is $d$), $a^*(d)$ is bounded to $[0, N-1]$ and $r_{CE}(t+d)$ to $[-t, L-1-t]$, in which $L=2N+T_{CH}-1$ is the length of $r_{CE}(d)$. Here we get $a=0, b=N-1, c=-t, d=L-1-t$. Using $a \le d $ and $c \le b$, we get $-(N-1) \le t \le L-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to why $r_{CE}$ is bounded as that, you can make a same process to understand it.&lt;/p&gt;&#xA;" OwnerUserId="16046" LastEditorUserId="16046" LastEditDate="2015-06-11T06:53:05.230" LastActivityDate="2015-06-11T06:53:05.230" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23818" PostTypeId="2" ParentId="23813" CreationDate="2015-06-01T07:14:26.537" Score="2" Body="&lt;p&gt;A Dirac delta impulse cannot be sampled because it is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Distribution_%28mathematics%29&quot; rel=&quot;nofollow&quot;&gt;distribution&lt;/a&gt; and as such it does not make sense to talk about the value of $\delta(t)$ for e.g. $t=0$ because that value isn't defined. However, sampling extracts values of a function for certain values of $t$. The Dirac impulse is no function in the conventional sense. It's only under an integral that $\delta(t)$ makes sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the mathematical description of sampling is a multiplication with a Dirac comb. However, the expression $\delta^2(t)$ is undefined, so sampling a Dirac impulse can't be described mathematically in any meaningful way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the discrete-time unit impulse $\delta[n]$ can be sampled without any problem, because it has well-defined values for any $n$, unlike its continuous-time counterpart.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-01T07:14:26.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23819" PostTypeId="1" CreationDate="2015-06-01T07:37:38.390" Score="5" ViewCount="147" Body="&lt;p&gt;I read in a book that the first radar was a CW one that was used to detect ships.  Since it was CW, did it use Doppler to detect the moving ships?  What was the signal processing used in it?  Is there any reference to this information?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2015-06-01T19:45:03.953" Title="This is about signal processing in the first radar" Tags="|signal-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23820" PostTypeId="1" CreationDate="2015-06-01T08:40:12.540" Score="2" ViewCount="204" Body="&lt;p&gt;I want to determine the distribution of micro glass spheres in SEM (scanning electron microscope) images, which can be obtained after finding the contours of the little spheres. I think the difficulties are the variance of the brightness and the overlap among the spheres. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the beginning, I guess canny edge detector may help to find the edges. However the result is not very good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help and share!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sfUee.png&quot; alt=&quot;The original obtained from a SEM&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eJwL1.png&quot; alt=&quot;The result with canny detector&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16048" LastEditorUserId="1606" LastEditDate="2015-06-01T09:00:26.300" LastActivityDate="2015-06-01T11:13:21.310" Title="How to detect spheres in SEM (scanning electron microscope) images?" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23821" PostTypeId="1" AcceptedAnswerId="23823" CreationDate="2015-06-01T09:13:51.297" Score="1" ViewCount="268" Body="&lt;p&gt;I want to perform automatic character recognition on licence plates. One of my preprocessing step is binarization. However I have four different class of images and I have to use a different automatic thresolding algorithm on each class to get good binarization results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to choose the right algorithm automaticaly, my idea is to first perform classification on the licence plates images. In the following picture, each row represent a class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/answers/uploaded_files/31813/class.jpg&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/answers/uploaded_files/31813/class.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with MATLAB, how can I do that?? what is the best way?&#xA;Any ideas are appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14844" LastEditorUserId="13315" LastEditDate="2015-06-02T07:34:45.083" LastActivityDate="2015-06-03T08:33:08.147" Title="How can I classifying this License Plate images? Matlab , LPR ," Tags="|image-processing|matlab|classification|matlab-cvst|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23822" PostTypeId="2" ParentId="23820" CreationDate="2015-06-01T11:13:21.310" Score="1" Body="&lt;p&gt;The usual next step in such a case would be to obtain the Hough (or Radon) transform and then try to identify the spheres (or, here, circles) in the domain that results from the transform. For more information on how this works please see &lt;a href=&quot;http://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt; and also related response &lt;a href=&quot;https://dsp.stackexchange.com/questions/2420/alternatives-to-hough-transform-for-detecting-a-grid-like-structure/2421#2421&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, these transforms will not improve the situation of overlapping objects. For this reason, you might also want to check two dimensional frequency domain / matched filter type (or curve-fitting) methods. For more information on this and an indicative technique, please see &lt;a href=&quot;http://math.ryerson.ca/~ferrando/publications/cellRec.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (and potentially &lt;a href=&quot;http://www.academia.edu/4309184/Analysis_of_White_Blood_Cell_Differential_Counts_Using_Dual-Tree_Complex_Wavelet_Transform_and_Support_Vector_Machine_Classifier&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; too). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of work around this type of problems has been performed in biomedical engineering and specifically the problem of automatically counting blood cells (which can present themselves as ellipsoids) or detecting and automatically counting &quot;spots&quot; (which, again, present themselves as ellipsoids) from an analysis process called &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Electrophoresis&quot; rel=&quot;nofollow noreferrer&quot;&gt;electrophoresis&lt;/a&gt;&quot;. Searching for &quot;automatic blood cell count wavelets&quot; for example, in a relevant journal search engine, will return a very large number of results. The added benefit to potentially using wavelets here might be that you can find a wavelet mother function that closely resembles the profile of the sphere, which then gives you a better chance at detectability. For more information about this, please see &lt;a href=&quot;https://dsp.stackexchange.com/questions/2149/wavelet-transform/2151#2151&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/22246/3d-intensity-map-for-grayscale-image/22266#22266&quot;&gt;this&lt;/a&gt; link, towards the end of the latter there is a link to a thesis that provides a very good summary of relevant methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-06-01T11:13:21.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23823" PostTypeId="2" ParentId="23821" CreationDate="2015-06-01T12:05:06.910" Score="0" Body="&lt;p&gt;Here's a procedure you should try in a first attempt :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have RGB images, so each images is a 3*R&lt;em&gt;C matrix, where R is the number of rows and C the number of columns.&lt;br&gt;&#xA;We will consider each pixel of an image as a realization of a random vector $\mathbf{x}$ of dimention 3. Hence, having an image, you have R&lt;/em&gt;C realization of $\mathbf{x}$. With the classification exemple you gave, each classe has 4 images, so we have 4*R*C realization of $\mathbf{x}$. We are abble to estimate some stastical moments, that we hope will be good descriptor, such as mean, covariance etc ... (mean can be estimated with empirical mean or median).&lt;br&gt;&#xA;Let's just stick with the mean for now. Let us call $m_1,m_2,m_3,m_4$ the means of each class you gave.&lt;br&gt;&#xA;Now we have a new image we want to classify, we estimate it's 3-dimensional mean $\mathbf{\mu}$, then using nearest neighbour, the class is given by :&#xA;$$&#xA;C=\arg_i\min\left(\lVert\mathbf{\mu}-m_i \rVert _2\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is very basic.&lt;br&gt;&#xA;You may improve this scheme using additional features like variance (diagonal of the covariance matrix) or covariance matrix. You may estimate variance or covariance using empirical variance or empirical covariance estimator (realy just the classical formulae). However the euclidian distance won't be a good distance since you will comparing inhomogenous vector (the features will be composed of mean + covariance), you'll want to use a more advanced distance such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Bhattacharyya_distance&quot; rel=&quot;nofollow&quot; title=&quot;Bhattacharyya distance&quot;&gt;Bhattacharyya distance&lt;/a&gt; for the special case of gaussian distribution.   &lt;/p&gt;&#xA;" OwnerUserId="13315" LastEditorUserId="13315" LastEditDate="2015-06-03T08:33:08.147" LastActivityDate="2015-06-03T08:33:08.147" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="23824" PostTypeId="2" ParentId="23819" CreationDate="2015-06-01T12:20:04.933" Score="3" Body="&lt;p&gt;Indeed, in the very first time of radar, the technology necessary to measure delay between transmited and received echoes wasn't avaible for EM waves. &#xA;I think that these first type of CW radars weren't used for ranging, only for detection. &#xA;Using only one sensor which emit and receive the CW signal you can't perform ranging. In a bistatic configuration, i.e. the transmitter and the receiver arn't colocated, you may perform rangin by imposing a constraint on the target's kinematic (for instance, constant speed) and integrating measurments over time. &#xA;Using a network of sensor (so called multistatic configuration) you may perform &quot;real time&quot; ranging without having to integrate measurments nor imposing a kinematic model on the target's motion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Direct answer : These early radar were used only for detection and not for ranging.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastEditorUserId="13315" LastEditDate="2015-06-01T15:09:28.657" LastActivityDate="2015-06-01T15:09:28.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23825" PostTypeId="1" CreationDate="2015-06-01T13:00:53.427" Score="2" ViewCount="1126" Body="&lt;p&gt;I'm not a DSP specialist.I'm working in transmission and distribution.&#xA;I need to retrieve the amplitude and phase angle of a discrete 50Hz COSINUS signal as fast as possible. Right now I'm using a Sliding DFT an I can manage to get this information in 10ms (half period) but I would like to know if it's possible to have it faster. I can adjust the sample time up to 1micro second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to have this information (amplitude and phase angle) as fast as possible because it will determine the time constant of my corrector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for your precious answer&lt;/p&gt;&#xA;" OwnerUserId="16051" LastActivityDate="2015-06-03T01:25:32.413" Title="What's the fastest way to get the phase angle and amplitude of a COSINUS 50hz signal?" Tags="|dft|phase|amplitude|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23826" PostTypeId="1" CreationDate="2015-06-01T14:02:17.470" Score="0" ViewCount="1101" Body="&lt;p&gt;Hi I have a question regarding primary sync signal in LTE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is generated in frequency domain and its length is 63. How to convert this signals frim frequency to time domain. Should I use IFFT? what is the length of IFFT and the signal in time domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Thanks&lt;/p&gt;&#xA;" OwnerUserId="15989" LastActivityDate="2015-09-29T21:00:39.877" Title="PSS convertion from Frequency to time domain" Tags="|matlab|fft|autocorrelation|cross-correlation|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23827" PostTypeId="1" AcceptedAnswerId="23829" CreationDate="2015-06-01T14:26:17.363" Score="0" ViewCount="453" Body="&lt;p&gt;The questions below are for OFDM, IFFT, FFT operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In OFDM modulation, a stream of parallel symbols are input to an IFFT operation of size $M$ for example and the output is time domain samples of size $M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us take for example, the fact that the input symbols to the FFT operation are QAM symbols. Then, at the output of IFFT I receive $M$ samples. Each sample is weighted sum of modulated subcarriers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it mean that each QAM symbol (input of IFFT) is sent out on ONE subcarrier?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen a paper that take the time domain samples of an impulse response of channel of length $T_{CH}$ puts them into  M-FFT operation and the result was $H(k)$ for $k\in[1:M]$ which the authors state are the frequency response of the $k$th subcarrier. Why is that the FFT generated the subcarrier frequency response? According to Example 1, each sample should be weighted sum of all input ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain to me whats the connection between two examples?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and looking forward for your clarification.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastActivityDate="2015-06-01T16:19:28.863" Title="Questions regarding OFDM, FFT, IFFT" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23828" PostTypeId="2" ParentId="23815" CreationDate="2015-06-01T14:54:17.867" Score="2" Body="&lt;p&gt;Your question is too basic, and it gives the impression that you haven't done enough study of the subject on your own. I'll provide a few hints:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;To understand noise, you first need to specify its probability distribution. I assume you're refering to Gaussian noise in your question, but not all noise is Gaussian. In particular, in digital capture of an image, there are several kinds of noise present.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Gaussian noise is specified by its mean and its variance ($\sigma_n^2$) or its standard deviation ($\sigma_n$). The physical interpretation of the variance is that it is related to the noise power. There is nothing special about $\sigma_n=1$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Most computer random generators (for instance, Matlab's &lt;code&gt;randn&lt;/code&gt;) generate samples of a Gaussian random variable with zero mean and variance 1. It is easy to convert this random variable to another Gaussian random variable with any specified mean and variance.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You need to understand the effects of clipping Gaussian noise. Think about a sensor photosite being pulled or pushed beyond its dynamic range by the noise. However, as I said in another answer, the resulting noise is no longer Gaussian.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-01T14:54:17.867" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23829" PostTypeId="2" ParentId="23827" CreationDate="2015-06-01T16:19:28.863" Score="2" Body="&lt;p&gt;To your first question, yes, each symbol is sent on a separate subcarrier; that's the basic idea of OFDM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure where your confusion lies with your second question. It's well-known that the Fourier transform of a system's impulse response gives its frequency response. In this case, the system is the communication channel. If you choose the sample rate of your impulse response measurement properly, and use the appropriately-sized FFT, you can get a frequency response measurement whose bins line up with the subcarrier frequency grid. This can be used for equalizing the channel.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-06-01T16:19:28.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23830" PostTypeId="1" AcceptedAnswerId="23832" CreationDate="2015-06-01T17:45:14.547" Score="4" ViewCount="15113" Body="&lt;p&gt;I want to add white gaussian noise to an image of 10 dB in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use Matlab function imnoise but I couldn't figure out what values for mean and variance should I choose to add noise of 10 dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do this ?&lt;/p&gt;&#xA;" OwnerUserId="15981" LastActivityDate="2016-08-11T05:56:14.823" Title="How to add white gaussian noise to an image in Matlab?" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23831" PostTypeId="2" ParentId="23821" CreationDate="2015-06-01T18:32:09.667" Score="-1" Body="&lt;p&gt;Take a look at this &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/automatically-detect-and-recognize-text-in-natural-images.html&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; that uses MSER regions to detect text, and the &lt;code&gt;ocr&lt;/code&gt; function to recognize it.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-06-01T18:32:09.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23832" PostTypeId="2" ParentId="23830" CreationDate="2015-06-01T19:24:17.560" Score="9" Body="&lt;p&gt;Additive noise is usually mean-free, i.e. the mean should be 0. A noise level of 10 dB = 1 B (&quot;bel&quot;) usually means that the variance of the noise is by a factor 10¹ = 10 smaller than the variance of the image. As the &lt;a href=&quot;https://www.mathworks.com/help/images/ref/imnoise.html&quot; rel=&quot;noreferrer&quot;&gt;documentation&lt;/a&gt; states, the variance parameter to &lt;code&gt;imshow&lt;/code&gt; is interpreted under the assumption that the image data are doubles in the range [0, 1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Load sample grayscale image included with Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[I, map] = imread('eight.tif');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That image is of data type &lt;code&gt;uint8&lt;/code&gt;, i.e. integers in the range 0 to 255. Let's convert it to a double in [0, 1]:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = double(I) / 255;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Compute the image variance&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v = var(I(:));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and tell &lt;code&gt;imnoise&lt;/code&gt; to add Gaussian white noise with mean 0 and a tenth of that variance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;J = imnoise(I, 'gaussian', 0, v / 10);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2cYav.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because &lt;code&gt;imnoise&lt;/code&gt; clips the data to the range [0, 1] after adding noise, the actual noise variance is smaller,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var(J(:) - I(:)) / v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives something like 0.093.&lt;/p&gt;&#xA;" OwnerUserId="5834" LastActivityDate="2015-06-01T19:24:17.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23833" PostTypeId="1" AcceptedAnswerId="23837" CreationDate="2015-06-01T19:26:48.250" Score="0" ViewCount="137" Body="&lt;p&gt;Lets say we want implement simply the mean with constant coefficients. So all b's are set to e.g. b=0.5. In this case I do not understand the delay line in the picture below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean I understand it for von Neumann, Harvard architectures.., but how about if I just calculate everything on parallel FPGA? Shouldn't be possible to implement the whole structure without any delays? (..because it is all parallel and there is no feedback) or is it in practice just not possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Finite_impulse_response#/media/File:FIR_Filter.svg&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Finite_impulse_response#/media/File:FIR_Filter.svg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(What I would understand is that there is maybe a delay at the end when the summation takes place)&lt;/p&gt;&#xA;" OwnerUserId="11606" LastEditorUserId="11606" LastEditDate="2015-06-01T19:35:49.157" LastActivityDate="2015-06-01T20:45:13.933" Title="Is the common FIR Filter delay line (see pic) also valid on purely logical FPGA implementations?" Tags="|filters|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23834" PostTypeId="2" ParentId="23826" CreationDate="2015-06-01T19:31:49.137" Score="1" Body="&lt;p&gt;The PSS signal is generated based on Zadoff-Chu sequence and is mapped to the central 62 sub-carriers apart from DC sub-carrier as explained &lt;a href=&quot;http://www.mathworks.com/help/lte/ug/synchronization-signals-pss-and-sss.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. If you want to view the PSS alone, leaving aside other subcarriers in the PSS containing OFDM symbols then yes, you'll have to do a 64 IFFT on the length 63 Zadoff-Chu + DC symbols. It is worth nothing that on the receiver side, synchronization is achieved by locking on to the central 63 subcarriers using a 64 point FFT.  &lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-06-01T19:31:49.137" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23835" PostTypeId="2" ParentId="23819" CreationDate="2015-06-01T19:45:03.953" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Skolnik, M.I., Introduction to Radar Systems, 2ed., McGraw-Hill,&#xA;1980; there may be later editions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In Eaves, Jerry L. &amp;amp; Reedy, Edward K., Principles of Modern Radar, Van Nostrand Reinhold, 1987, p.4, Table 1-2, mention is made:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;1903 Hülsmeyer (German engineer) detected radio waves reflected&#xA;from ships.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1922  Marconi made a speech to the Institute of Radio Engineers (now&#xA;the Institute of Electrical and Electronics Engineers) urging the&#xA;use of short wave radio waves for detection of objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1922 Tylor and Young at the Naval Research Laboratory (NRL) detected&#xA;wooden ships with CW radar having a 5-m wavelength.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1930 Hyland (NRL) detected aircraft with CW radar.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that some of this information is possibly incorrect. In the&#xA;next reference, it's stated that Marconi made the 1922 speech to the&#xA;Institution of Electronic Engineers (London).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/History_of_radar&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/History_of_radar&lt;/a&gt;. Note especially reference 33 -  Hyland, L.A., A.H. Taylor, and L.C. Young; &quot;System&#xA;for detecting objects by radio&quot;, U.S. Patent No. 1981884, 27 Nov.&#xA;1934&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16052" LastActivityDate="2015-06-01T19:45:03.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23837" PostTypeId="2" ParentId="23833" CreationDate="2015-06-01T20:45:13.933" Score="0" Body="&lt;p&gt;I'm not sure if I understood our question right, and therefore sorry if I point something wrong, but the delay in the delay line comes from signal sampling and not from computational processing type. Therefore whether you realize that signal flow graph in a von Neumann type serial architecture or in aparallel FPGA based architecture doesn't matter. You will always have the delay per input sample as dictated by your systems sampling rate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand of course a parallel implementation would take much less clock cycles, based on the amount of parallelisation, to compute per sample output campared to a serial architecture of a general purpose CPU, however as I said the delay in the delay line is nothing related with computational delay of the hardware system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally the signal flow graph yields a pictorial representation of processing structure, you don't really implment those delays. They are represented by registers or memory locations, as possibly you know, which are updated either per sampling clock or via buffer copies which provides that delay effect represented in the flow graph.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-06-01T20:45:13.933" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23838" PostTypeId="1" CreationDate="2015-06-02T00:26:55.143" Score="3" ViewCount="587" Body="&lt;p&gt;I have a question about the zero-frequency (DC) response of a IIR filter. The coefficients of the 3rd order IIR filter are as follows,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% polynomial coefficients for the numerator of the IIR transfer function&#xA;b = [0.0066324, -0.0130292, 0.0063988]; &#xA;&#xA;% polynomial coefficients for the denominator of the IIR transfer function&#xA;a = [1, -1.4158855, 0.4158913];  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the roots of &lt;code&gt;a&lt;/code&gt; are all less than unity, but one is quite close to the unity. I am trying to understand why MATLAB's &lt;code&gt;filter()&lt;/code&gt; function produces the following results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rng default;&#xA;x = rand(15,1);&#xA;y = filter(b,a,x);&#xA;mean(y)/mean(x)   &#xA;&#xA;&amp;gt;&amp;gt; 0.0012&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the last statement, I computed the ratio of the input and output mean, MATLAB returns 0.0012.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, from the zero-frequency of the transfer function $H(z)=0.3448$ (i.e., &lt;code&gt;sum(b)/sum(a)=0.3448&lt;/code&gt;), I have expected that &lt;code&gt;mean(y)/mean(x)=0.3448&lt;/code&gt;. Checking this,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[H,W] = freqz(b,a);&#xA;H(1)&#xA;&#xA;&amp;gt;&amp;gt; 0.3448&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Have I misunderstood something here about MATLAB's &lt;code&gt;filter()&lt;/code&gt; function, or other misconception of the zero-frequency response of a transfer function? Thanks to anyone who is able to provide an insight to this problem.&lt;/p&gt;&#xA;" OwnerUserId="16055" LastEditorUserId="8202" LastEditDate="2015-06-02T06:26:29.830" LastActivityDate="2015-06-04T17:21:04.993" Title="Zero-frequency response of an IIR transfer function" Tags="|matlab|filters|frequency|infinite-impulse-response|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23839" PostTypeId="2" ParentId="23611" CreationDate="2015-06-02T06:23:09.753" Score="2" Body="&lt;p&gt;The commonly called 5.1 format uses only surround channels, which are defined as &lt;em&gt;rear/side channels&lt;/em&gt; in &lt;a href=&quot;https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.775-3-201208-I!!PDF-E.pdf&quot; rel=&quot;nofollow&quot;&gt;ITU-R BS 775&lt;/a&gt;. The case you want to deal with (turning rear surround channels to side surround channels) is therefore not explicitly defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that in the referenced ITU document, the case of changing the number of rear/sides loudspeakers reproducing a common rear/side signal is mentioned (see Note 5) :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If more than two rear/side loudspeakers are used, the LS signal should&#xA;  be fed to each of the side/rear loudspeakers on the left side of the&#xA;  room and the RS signal should be fed to each of the side/rear&#xA;  loudspeakers on the right side of the room. In doing so, it will be&#xA;  necessary to reduce the signal gain such that the total power emitted&#xA;  by the loudspeakers carrying the LS (or RS) signal is the same as if&#xA;  that signal had been reproduced over a single loudspeaker.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In your case, as you are keeping the same number of loudspeakers, I would simply map Rear Left (resp. Rear Right) to Side Left (resp. Side Right) with a gain of 1.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The case is different if you want to downmix a 7.1 format (of which several mappings are mentioned in &lt;a href=&quot;http://www.itu.int/dms_pub/itu-r/opb/rep/R-REP-BS.2159-4-2012-PDF-E.pdf&quot; rel=&quot;nofollow&quot;&gt;ITU-R BS 2159&lt;/a&gt;, see figure 20) to a 5.1 format, where you will need to take into account which mapping is used in the 7.1 format to define downmix coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also notice that although there are commonly used coefficients when downmixing multi-channels formats, most codecs use metadata sets to allow the content creator to specify it's own coefficients in order to preserve artistic intent (see &lt;a href=&quot;http://www.dolby.com/us/en/technologies/a-guide-to-dolby-metadata.pdf&quot; rel=&quot;nofollow&quot;&gt;Dolby Metadata Guide&lt;/a&gt;, part 4 for example).&lt;/p&gt;&#xA;" OwnerUserId="3485" LastEditorUserId="3485" LastEditDate="2015-06-02T06:45:05.887" LastActivityDate="2015-06-02T06:45:05.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23840" PostTypeId="2" ParentId="23791" CreationDate="2015-06-02T06:39:55.143" Score="0" Body="&lt;p&gt;If you mean that the filter impulse response is a sinc function, then you are talking about a function with infinite support, i.e, the length of the filter is infinite. This is impractical to implement, but you can approximate it by truncation. The longer the segment resulting from your truncation, the better the approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, your statement is rather correct.&lt;/p&gt;&#xA;" OwnerUserId="16058" LastActivityDate="2015-06-02T06:39:55.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23841" PostTypeId="2" ParentId="23838" CreationDate="2015-06-02T07:19:25.780" Score="3" Body="&lt;p&gt;Because of the pole near the unit circle the impulse response doesn't really settle until after tens of thousands of samples. In comparison, your input of 15 samples is very short. Try making it longer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(15E6,1);&#xA;y = filter(b,a,x);&#xA;mean(y)/mean(x)&#xA;&#xA;&amp;gt;&amp;gt; 0.34252&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, the filter starts in a state that corresponds to an all-zeros input history. If you precondition it with a run of the actual input, the result will converge faster:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(15E6,1);&#xA;y = filter(b,a,x);&#xA;mean(y(5E6:length(y)))/mean(x(5E6:length(x)))&#xA;&#xA;&amp;gt;&amp;gt; 0.34483&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-06-02T07:19:25.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23842" PostTypeId="1" AcceptedAnswerId="23846" CreationDate="2015-06-02T07:31:32.053" Score="0" ViewCount="446" Body="&lt;p&gt;I have 3 times series representing detected rssi signal power from 3 emitting devices. The devices are at 1 meter distance from the receptor, plotting the 3 time-series gives the following results :&#xA;&lt;img src=&quot;https://i.stack.imgur.com/fdb9o.png&quot; alt=&quot;First plot&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/goMrd.png&quot; alt=&quot;Second plot&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sFwes.png&quot; alt=&quot;Third plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is&lt;/strong&gt; : Is there a way, a general mechanism, a filter, or an algorithm for processing these signal, so that I can find some common regularities between them to which I can &lt;strong&gt;assign the distance 1 meter&lt;/strong&gt;, and predict that distance for different time-series?&lt;/p&gt;&#xA;" OwnerUserId="16060" LastActivityDate="2015-06-02T10:37:54.403" Title="how to extract meaning from signal (distance estimation)?" Tags="|filters|algorithms|estimation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23843" PostTypeId="1" CreationDate="2015-06-02T08:11:56.357" Score="1" ViewCount="611" Body="&lt;p&gt;I've found a paper with a filter described in terms of transfer function, amplitude response and difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;transfer function of the second-order low-pass filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = \frac{(1-z^{-6})^{2}}{(1-z^{-1})^{2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;amplitude response (T - sampling period):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|H(\omega T)| = \frac{\sin^{2}(3\omega T)}{\sin^{2}(\omega T/2)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;difference equation of the filter (cut-off 11 Hz, gain 36):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[nT] = 2y[nT-T] - y[nT-2T] + x[nT] - 2x[nT- 6T] + x[nT- 12T]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What was the process to create these equations and how to run the filter on the signal?&lt;/p&gt;&#xA;" OwnerUserId="390" LastEditorUserId="8202" LastEditDate="2015-06-02T09:27:42.427" LastActivityDate="2015-06-02T09:27:42.427" Title="Transfer function, amplitude response and difference equation for a filter" Tags="|filters|lowpass-filter|z-transform|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23844" PostTypeId="2" ParentId="23843" CreationDate="2015-06-02T09:01:09.830" Score="1" Body="&lt;p&gt;start from the transfer function: $$&#xA;H(z) = \frac{(1-z^{-6})^{2}}{(1-z^{-1})^{2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;expand it: $$&#xA;H(z) = \frac{ 1-2z^{-6} + z^{-12} }{ 1 -2z^-1 + z^{-2}  }&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency response is:&#xA;$$&#xA;H(e^{j\omega}) = \frac{ 1-2e^{-j6\omega} + e^{-j12\omega} }{ 1 -2e^{-j\omega} + e^{-j2\omega}  }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: this may be simplified by proper algebraic grouping and cancellations to what you have provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transform this rational H(z) directly back into its corresponding LCCDE:&#xA;$$y[n]-2y[n-1]+y[n-2] = x[n]-2x[n-6]+x[n-12]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't figure out a meaning for the wT representation, nor if it is necessary...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-06-02T09:01:09.830" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23845" PostTypeId="2" ParentId="23838" CreationDate="2015-06-02T10:03:32.733" Score="0" Body="&lt;p&gt;Your basic assumption is correct: if you convolve two sequences&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=(x\star h)[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then their $\mathcal{Z}$-transforms are related by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=X(z)H(z)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(1)=X(1)H(1)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;follows. In the case of a recursive filter, $H(z)=B(z)/A(z)$ and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(1)=\frac{B(1)}{A(1)}=\frac{\sum_nb_n}{\sum_na_n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a_n$ and $b_n$ are the denominator and numerator coefficients, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with your implementation is that the function &lt;code&gt;filter()&lt;/code&gt; does not compute the &lt;em&gt;complete&lt;/em&gt; convolution of the input signal with the filter's impulse response, but it only computes as many output samples as there are input samples. Note that the length of the actual convolution result is always longer than the input sequence. And in your case it is &lt;em&gt;very&lt;/em&gt; long, actually infinitely long (because you have an IIR filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Olli Niemitalo's solution is OK, but it does not address all details of the problem, because making the input signal longer does not completely solve the problem. It only decreases the relative contribution of the transient due to the filter's memory. The transient response of the filter after the input signal is switched off is still not taken into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation (3) must of course hold for any input signal, also for very short signals. So what you need to do is append zeros to the input signal such that you also get the transient response after the input signal is switched off. Theoretically you would need to append infinitely many zeros because your filter's memory is (theoretically) infinitely long. And since one of the filter's poles is very close to the unit circle, your filter's memory is especially large, even for practical purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab/Octave you could do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;b = [0.0066324, -0.0130292, 0.0063988];&#xA;a = [1, -1.4158855, 0.4158913];&#xA;x = rand(15,1);&#xA;x0 = [x;zeros(1e6,1)];&#xA;y0 = filter(b,a,x0);&#xA;[sum(y0)/sum(x0),sum(b)/sum(a)]    % should be (almost) the same&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-02T13:12:06.087" LastActivityDate="2015-06-02T13:12:06.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23846" PostTypeId="2" ParentId="23842" CreationDate="2015-06-02T10:37:54.403" Score="0" Body="&lt;p&gt;In general, you can apply a filter with some time constant T which will be giving you a more reliable RSSI value but even in this case, the RSSI will only be an accurate indication of distance under certain assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two types of filters you could use here, a moving average low pass filter which would effectively produce a smoothed out version of the RSSI waveform or a non-linear modal-mean or median filter. An example of an easily implemented moving average Finite Impulse Response (FIR) filter would be h=ones(N)./N where N is the order of the filter that is directly proportional to the Group Delay (or time constant) of the filter (for instance a [0.25,0.25,0.25,0.25] N=4 filter). Applied over a sliding window of N samples, this filter would return an average, slow changing, estimate of the RSSI curve which you could then associate with distance. Similarly, the non-linear filter is applied over a sliding window of size N but in this case you just estimate the modal mean (i.e. the most frequently occurring RSSI value of the N available in the sample) or the median value. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;median filter&lt;/a&gt; would tend to remove the spikes and could possibly be a better alternative for this application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relationship between RSSI and distance would be established through the &lt;a href=&quot;http://en.wikipedia.org/wiki/Free-space_path_loss&quot; rel=&quot;nofollow&quot;&gt;Free Space Path Loss&lt;/a&gt; but the main assumptions here would be that a) there is a direct line-of-sight between transmitter and receiver and b) the RSSI is accurately estimated by the device. In other words, if you start moving the device in space, it is not necessary that the distance estimation will remain accurate. You might also want to check &lt;a href=&quot;http://en.wikipedia.org/wiki/Link_budget&quot; rel=&quot;nofollow&quot;&gt;this link as well&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-06-02T10:37:54.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23848" PostTypeId="1" CreationDate="2015-06-02T12:52:35.987" Score="0" ViewCount="45" Body="&lt;p&gt;I wonder why in all spectrum estimation techniques, the analysis depend on the Fourier transform? Why not deal with the signals in time domain?&lt;/p&gt;&#xA;" OwnerUserId="16064" LastEditorUserId="11256" LastEditDate="2015-06-02T16:23:51.240" LastActivityDate="2015-06-02T16:23:51.240" Title="ًWhy we use fourier transform in most of spectrum estimation approaches?" Tags="|power-spectral-density|fourier|spectral-efficiency|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23851" PostTypeId="1" CreationDate="2015-06-02T14:23:08.270" Score="8" ViewCount="7989" Body="&lt;p&gt;What is the meaning of Restricted Isometry Property (RIP) condition in Compressive Sensing for Sparse Signal Analysis?&#xA;How can we define Restricted Isometry Constant (RIC) for the RIP condition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in Advance!&lt;/p&gt;&#xA;" OwnerUserId="9014" LastActivityDate="2015-07-17T12:18:36.780" Title="Restricted Isometry Property (RIP) in Compressive Sensing" Tags="|compressive-sensing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23852" PostTypeId="2" ParentId="21866" CreationDate="2015-06-02T14:50:23.023" Score="3" Body="&lt;p&gt;OBPSK in the way that you describe it is also called $\pi/2$-BPSK meaning that the signal constellation is different from bit to bit, rotating by $\pi/2$ after it is used. There are two variations of this format.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use $\pm \cos(\omega_0 t)$ to transmit one bit and &#xA;$\mp \sin(\omega_0 t)$ to transmit the next bit. Repeat this over and over again.  Note the $\mp$ before the $\sin$ carrier.&lt;br&gt;&#xA;This method rotates the constellation by $\pi/2$ &lt;em&gt;counterclockwise&lt;/em&gt; in going from $\pm \cos(\omega_0 t)$ to $\mp \sin(\omega_0 t)$, and &lt;em&gt;clockwise&lt;/em&gt; when going from $\mp \sin(\omega_0 t)$ to $\pm \cos(\omega_0 t)$.&lt;/li&gt;&#xA;&lt;li&gt;Use&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\pm \cos(\omega_0 t)$ to transmit the first bit&lt;/li&gt;&#xA;&lt;li&gt;$\mp \sin(\omega_0 t)$ to transmit the second bit&lt;/li&gt;&#xA;&lt;li&gt;$\mp \cos(\omega_0 t)$ to transmit the third bit&lt;/li&gt;&#xA;&lt;li&gt;$\pm \sin(\omega_0 t)$ to transmit the fourth bit,&lt;br&gt;&#xA;and repeat this over and over. Note the $\mp$ and $\pm$ signs. This&#xA;corresponds to the constellation rotating by $\pi/2$ &lt;em&gt;counterclockwise&lt;/em&gt; after each and every bit transmission.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Neither form of OBPSK signal can be demodulated very well&#xA;using a OQPSK demodulator, though it would be &lt;em&gt;possible&lt;/em&gt; to do&#xA;so. In OQPSK,&#xA;even-numbered bits are transmitted using $\pm\cos(\omega_0t)$ and&#xA;odd-numbered bits using $\mp\sin(\omega_0 t)$ but the &lt;em&gt;important&#xA;difference&lt;/em&gt; is that the $2n$-th bit is transmitted during the&#xA;time interval&#xA;$[2nT, (2n+2)T)$ while the $(2n+1)$-th bit is transmitted during&#xA;the time interval $[(2n+1)T, (2n+3)T)$, i.e. in overlapping but &lt;em&gt;offset&lt;/em&gt; time intervals.&#xA;At the demodulator, the matched filters/correlators in the I branch&#xA;and Q branch thus integrate/correlate over offset time intervals,&#xA;and the demodulated data bits come out of the OQPSK demodulator alternately on the I and Q lines, one every T seconds. &#xA;On the other hand, in&#xA;OBPSK, the $2n$-th bit is transmitted during $[2nT, (2n+1)T)$ and&#xA;the $(2n+1)$-th bit during $[(2n+1)T, (2n+2)T)$. If demodulated with&#xA;a plain vanilla OQPSK demodulator, during $[(2n+1)T, (2n+2)T)$ the matched filter/correlator input in the I branch would be just &lt;em&gt;noise&lt;/em&gt; &#xA;(and similarly for the Q branch).&#xA;This will decrease the effective SNR. So, Yes, a standard OQPSK&#xA;receiver &lt;em&gt;could&lt;/em&gt; be used to demodulate an OBPSK signal, but&#xA;there are better ways of demodulating an OBPSK signal than just&#xA;processing it through an OQPSK receiver.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-06-02T15:07:16.067" LastActivityDate="2015-06-02T15:07:16.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23854" PostTypeId="1" AcceptedAnswerId="23856" CreationDate="2015-06-02T17:13:59.233" Score="1" ViewCount="5454" Body="&lt;p&gt;Why is a LPF ideal filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Not useful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) Hard to make?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was asked to make a Low pass filter (simulink block) that will take an input of a cutoff frequency, and for a signal with a frequency higher then that cutoff frequency, the amplitude would be zero &amp;amp; with zero roll-off. Hence ideal. Is this an impossible task? &lt;/p&gt;&#xA;" OwnerUserId="15920" LastActivityDate="2015-06-03T16:01:07.193" Title="Why are ideal filters not particularly useful/ hard to do?" Tags="|filters|lowpass-filter|digital-filters|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23856" PostTypeId="2" ParentId="23854" CreationDate="2015-06-02T18:46:20.960" Score="2" Body="&lt;p&gt;You can only make a finite-order digital filter, since you don't have infinite CPU capacity, infinite RAM, infinite numerical precision and infinite time to wait.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a finite-order filter, the Z-transform will be an analytic function over the complex domain. The frequency response is the Z-transform evaluated over the closed path $z = e ^{j\Omega}$ (i.e. the unit circle), where $\Omega$ is the frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An analytical function evaluated over a path will result in an infinitely derivable and continuous frequency response (property of analytical functions, as long as you don't step over poles).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ideal LPF is discontinuous at the cutoff frequency. So not possible to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, since the ideal LPF is a discontinuous frequency response, adding more coefficients to your filter will converge slowly to the desired frequency response (convergence is in mean-quadratic sense, which is &lt;em&gt;slow&lt;/em&gt;). So you will end up with a filter with &lt;em&gt;many&lt;/em&gt; coefficients, bad frequency response, lot of delay, and lots of roundoff errors.&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2015-06-03T16:01:07.193" LastActivityDate="2015-06-03T16:01:07.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23858" PostTypeId="2" ParentId="23776" CreationDate="2015-06-02T20:03:41.813" Score="20" Body="&lt;p&gt;Roughly speaking, they are the amount of noise in your system. Process noise is the noise in the &lt;em&gt;process&lt;/em&gt; - if the system is a moving car on the interstate on cruise control, there will be slight variations in the speed due to bumps, hills, winds, and so on. Q tells how much variance and covariance there is. The diagonal of Q contains the variance of each state variable, and off diagonal contain the covariances between the different state variables (e.g. velocity in x vs position in y). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;R contains the variance of your measurement. In the above example, our measurement might just be speed from the speedometer. Suppose it's reading has a standard deviation of 0.2 mph. Then R=[0.2^2]=[0.04]. Squared because variance is the square of the standard deviation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q is in &lt;em&gt;state space&lt;/em&gt;, and &lt;em&gt;R&lt;/em&gt; is in measurement space. In the example above, our state might be position only $[x, y]^T$, and measurement space is velocity $[v]$. That is problematic because that is not velocity in terms of x and y - you need the heading to convert. The Kalman filter matrix H is used to do that conversion, and in nonlinear systems you tend to have to linearize that in some manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shameless plug: my free book on the Kalman filter goes into this in great detail: &lt;a href=&quot;https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14915" LastActivityDate="2015-06-02T20:03:41.813" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23859" PostTypeId="1" AcceptedAnswerId="23860" CreationDate="2015-06-02T20:07:36.937" Score="2" ViewCount="447" Body="&lt;p&gt;The following sequence is used to modulate 52 subcarriers. Twelve out of 52 are non zero. I was wondering &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S_{[–26, 26]} = \sqrt{13/6} \{0, 0, 1+j, 0, 0, 0, –1–j, 0, 0, 0, 1+j, 0, 0, 0, –1–j, 0, 0, 0, –1–j, 0, 0, 0, 1+j, 0, 0, 0, 0,&#xA;0, 0, 0, –1–j, 0, 0, 0, –1–j, 0, 0, 0, 1+j, 0, 0, 0, 1+j, 0, 0, 0, 1+j, 0, 0, 0, 1+j, 0,0\}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The book says that The multiplication by a factor of $\sqrt{13/6}$ is in order to normalize the average power of the resulting OFDM&#xA;symbol, which utilizes 12 out of 52 subcarriers&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to compute it..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that the average energy in such sequence before normalization would be $$12\times \frac{\sqrt{2}}{52}=\frac{3\sqrt{2}}{13}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\sqrt{2} = \sqrt{1^2+1^2}$ from the complex symbols withing the sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then why is the normalization factor $\frac{\sqrt{13}}{\sqrt{6}}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="4298" LastEditDate="2015-06-02T20:26:52.583" LastActivityDate="2015-06-02T20:26:52.583" Title="A sequence OFDM modulated with normalization factor" Tags="|digital-communications|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23860" PostTypeId="2" ParentId="23859" CreationDate="2015-06-02T20:25:48.613" Score="3" Body="&lt;p&gt;The power of the non-zero elements is $|1+j|^2=2$, so the average power is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\overline{P}=\frac{12\cdot 2}{52}=\frac{24}{52}=\frac{6}{13}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in order to get unity average power, you have to normalize by $\sqrt{13/6}$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-02T20:25:48.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23862" PostTypeId="1" AcceptedAnswerId="23869" CreationDate="2015-06-02T21:53:50.820" Score="1" ViewCount="1176" Body="&lt;p&gt;I found the subject at here like this &amp;quot;Does clipping noise colour the spectrum&amp;quot;&#xA;When I researching for clipping noise.&lt;/p&gt;&#xA;&lt;p&gt;But I can't understand because typically something has clipped means something has removed.&#xA;But he has some different point of view about this.&#xA;so I want to know what is the clipping noise and how to undertand the posing about &amp;quot;Does clipping noise colour the spectrum&amp;quot;?&lt;/p&gt;&#xA;&lt;h1&gt;update&lt;/h1&gt;&#xA;&lt;p&gt;Especially, I want to know the meanning  about clipping gaussian noise.&lt;/p&gt;&#xA;&lt;p&gt;Especially this part&#xA;IV. CLIPPING (CENSORING)&#xA;A. Clipped observations model&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-06-04T15:17:31.543" Title="What does clipping gaussian noise mean?" Tags="|noise|" AnswerCount="1" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="23863" PostTypeId="2" ParentId="23825" CreationDate="2015-06-03T01:13:53.080" Score="2" Body="&lt;p&gt;Depending on how the signal will look like you can get away with only two or three samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = A + B \cos(\omega t + \theta)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know what the main value, $A_0$, would be, then only two samples would be required. Namely the cosine, shifted by a phase angle $\theta$, can be rewritten as a linear combination of a unshifted sine and cosine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = A_0 + A_1 \cos(\omega t) + B_1 \cos(\omega t) = A_0 + \sqrt{A_1^2 + B_1^2} \cos\left(\omega t - \tan^{-1}{\frac{A_1}{B_1}}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gains can be solved for by solving the following linear system of equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix}&#xA;1 &amp;amp; \sin \theta_0 &amp;amp; \cos \theta_0 \\&#xA;1 &amp;amp; \sin \theta_1 &amp;amp; \cos \theta_1 \\&#xA;1 &amp;amp; \sin \theta_2 &amp;amp; \cos \theta_2&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;A_0 \\&#xA;A_1 \\&#xA;B_1&#xA;\end{bmatrix}&#xA;=&#xA;\begin{bmatrix}&#xA;y_0 \\&#xA;y_1 \\&#xA;y_2&#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta_i=2\pi f(t_0+i\Delta t)$, with $f=50\ Hz$ and the $t_0+i\Delta t$ are the consecutive moments in time used for for the three measurements and $y_i$ is the measured signal at those moments in time. The values found for $A_0$, $A_1$ and $B_1$ can then be used to find the constants of the initial equation, namely:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;A = A_0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;B = \sqrt{A_1^2 + B_1^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\theta = -\tan^{-1}{\frac{A_1}{B_1}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should work for any different points in time, which are not a multiple of the period of the signal spaced apart, however this does assume that there is no noise present in the signal. If there is noise then you might want to consider using more points and performing a &lt;a href=&quot;http://math.mit.edu/~gs/linearalgebra/ila0403.pdf&quot; rel=&quot;nofollow&quot;&gt;least squares method&lt;/a&gt;. Also a shorter sample time/higher sample rate would make these calculations more sensitive to the noise, but you will be able to take more samples in the same amount of time.&lt;/p&gt;&#xA;" OwnerUserId="7579" LastEditorUserId="7579" LastEditDate="2015-06-03T01:25:32.413" LastActivityDate="2015-06-03T01:25:32.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23864" PostTypeId="1" CreationDate="2015-06-03T06:16:52.653" Score="0" ViewCount="140" Body="&lt;p&gt;I found a filter for Hankel Transform . As far as i understand this is effectively used as an approximation for $J_0(x)$ and $J_1(x)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how will the change in input affect these filter terms (e.g. $J_0(r) \rightarrow J_0(2r)$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oVmr3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References : &lt;a href=&quot;http://onlinelibrary.wiley.com/doi/10.1046/j.1365-2478.1997.500292.x/full&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://onlinelibrary.wiley.com/doi/10.1046/j.1365-2478.1997.500292.x/full&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16066" LastEditorUserId="1629" LastEditDate="2016-07-27T16:25:39.700" LastActivityDate="2016-07-27T16:25:39.700" Title="Help with Hankel transform filters" Tags="|filters|filter-design|transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23865" PostTypeId="1" CreationDate="2015-06-03T06:44:33.060" Score="0" ViewCount="70" Body="&lt;p&gt;I modulate some data over sound in a 17.7Khz and 17.8Khz. It works like an FSK with a pulse duration of 0.015sec. When playing a string the speaker gives a very strange noise that it seems to be the phase 180 degrees change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to reduce this noice ? &lt;/p&gt;&#xA;" OwnerUserId="15637" LastActivityDate="2015-06-03T06:44:33.060" Title="Changes of phase in high frequency makes the speaker &quot;clicks&quot;" Tags="|signal-analysis|phase|fsk|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23866" PostTypeId="1" CreationDate="2015-06-03T10:36:12.893" Score="0" ViewCount="2281" Body="&lt;p&gt;I'm new with signal processing and have started to learn it for physics research I am involved in. I have a signal which I want to process to find the amplitude of one frequency of. To do this, I'm multiplying the signal numerically by sin(2πft) and cos(2πft), so Y = signal * sin(2πft), X = signal * cos(2πft).  then taking the square root of the sum of these squared for the amplitude and arctan of Y/X for the phase over time. What does the plot of arctan(Y/X) actually show me? For an example, I have a code in Python I'm using for testing this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from matplotlib.pyplot import *&#xA;from numpy import *&#xA;from scipy.signal import butter, lfilter&#xA;&#xA;def butter_lowpass_filter(data, cutoff, fs, order=5):&#xA;    '''Creates a lowpass filter for the data'''&#xA;    nyq = 0.5 * fs&#xA;    normal_cutoff = cutoff / nyq&#xA;    b, a = butter(order, normal_cutoff, btype='low', analog=False) #filters data&#xA;    y = lfilter(b, a, data) #filters data&#xA;    return y&#xA;&#xA;def sin_stat(time, f0, method = 'sin'):&#xA;    '''Creates sine and cosine data to be used for manipulating data'''&#xA;    if method == 'sin':&#xA;        return [2.0 * np.sin(2*pi*f0 * t) for t in time] #2 in front to cancel out 1/2 later&#xA;    if method == 'cos':&#xA;        return [2.0 * np.cos(2*pi*f0 * t) for t in time]&#xA;&#xA;def stats(time, signal,f0,sample_freq, cutoff = 1): #cutoff is in hz&#xA;    ''' first creates list of sine and cosine data to numerically multiply all &#xA;    data by. Then Makes X, Y, which are data times cosine data and sine data&#xA;    respectively. '''&#xA;    C = sin_stat(time, f0, method = 'cos')&#xA;    S = sin_stat(time, f0, method = 'sin')&#xA;&#xA;    X = [d * c for d,c in zip(signal,C)]&#xA;    Y = [d * s for d,s in zip(signal,S)]&#xA;&#xA;    X_low = butter_lowpass_filter(X, cutoff, sample_freq) #lowpass each&#xA;    Y_low = butter_lowpass_filter(Y, cutoff, sample_freq)&#xA;&#xA;    amp = [np.sqrt(x**2 + y**2) for x,y in zip(X_low, Y_low)]&#xA;    phase = [np.arctan(y/x) for y,x in zip(Y_low,X_low)]&#xA;&#xA;    phase = [2 * (x + np.pi/2) for x in phase]&#xA;    phase = np.unwrap(phase)&#xA;    phase = [x/2.0 for x in phase]&#xA;    return (amp,phase)&#xA;&#xA;sample_freq = 100 #hz&#xA;end = 1000&#xA;t = linspace(0,end,end*sample_freq)&#xA;s = 5*sin(2*pi*10*t + 2) + 2*sin(2*pi*7*t + 1) + sin(2*pi*4*t +.5) + .2*sin(2*pi*2.3*t+.7)&#xA;plot(t,s)&#xA;show()&#xA;close()&#xA;amp, phase = stats(t,s,2.3,sample_freq,.5)&#xA;plot(t,amp)&#xA;show()&#xA;close()&#xA;plot(t,phase)&#xA;show()&#xA;close()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The amplitude plot shows the amplitude converge to the amplitude I define in the signal, but the phase plot does not. If my guess for the frequency in my In-phase and Quadrature signals is the same as in the simulated signal with a low-pass cutoff of .5 hz, I receive this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3NjTe.png&quot; alt=&quot;img1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I change the guess frequency to something not exactly the frequency, say 2.4 Hz, I receive this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DRThK.png&quot; alt=&quot;img2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone explain what I am actually seeing? What does the slope of this represent? In my real data, I always have a slope of some sort due to not knowing the exact frequency of what I am looking for, only an approximation. I would like to calculate frequency vs time to perform an allan deviation plot, but am unsure of how to calculate frequency from this. I feel I am on the right track, but am a little confused. I've been using this for understanding a little of what I'm doing: &lt;a href=&quot;http://www.thinksrs.com/downloads/PDFs/ApplicationNotes/AboutLIAs.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.thinksrs.com/downloads/PDFs/ApplicationNotes/AboutLIAs.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16054" LastEditorUserId="16054" LastEditDate="2015-06-03T13:59:01.897" LastActivityDate="2018-01-31T16:27:42.760" Title="In-phase and Quadrature demodulation" Tags="|signal-analysis|demodulation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23867" PostTypeId="1" CreationDate="2015-06-03T10:44:44.980" Score="-1" ViewCount="610" Body="&lt;p&gt;when do we use HSV color space and when do we use CIE-Lab color space?&lt;/p&gt;&#xA;" OwnerUserId="11740" LastActivityDate="2015-06-03T11:52:55.787" Title="what is the difference between HSV and CIE-Lab color space?" Tags="|computer-vision|image-processing|color|" AnswerCount="1" CommentCount="0" ClosedDate="2015-06-04T15:28:42.820" ContentLicense="CC BY-SA 3.0" />
  <row Id="23868" PostTypeId="1" AcceptedAnswerId="23872" CreationDate="2015-06-03T11:10:14.177" Score="0" ViewCount="531" Body="&lt;p&gt;A naive question I guess. Would it make a difference in the results when a system is simulated at Baseband or at Passband. If I have a plot of a BER vs SNR curve that has been plotted at Baseband, will the same change if I perform the simulation at Passband with a carrier frequency of 2.4GHz? AFAIK, it should not make a difference, but I would like to know if what I am thinking is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question is that if I have two signals from two transmitters and add these signals at the receiver, does it make a difference if these two signals are passband or baseband. Do the results vary? Since Passband simulation consumes a lot of time, would it be correct if I simulate the behavior at Baseband and assume that the result would be almost the same at the Passband?&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2017-03-03T08:26:19.603" Title="Simulation at Baseband or Passband" Tags="|signal-analysis|dsp-core|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23869" PostTypeId="2" ParentId="23862" CreationDate="2015-06-03T11:12:33.193" Score="1" Body="&lt;p&gt;If your noise has independent and identically distributed samples from a zero-mean distribution (for example Gaussian), it is white. Other definitions of white noise also require the distribution to be symmetrical, but that is not required for the spectrum to be flat. Clipping the samples of such white noise will only change the common probability distribution of the samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hOfpu.png&quot; alt=&quot;clipping of a probability density function&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will affect the mean of the distribution, but if both sides are clipped in a way that preserves the zero mean of the distribution, then there is no &quot;coloring&quot; of the spectrum by a 0 Hz peak and the noise remains white.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example in Octave (MATLAB clone):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create random variables from a Gaussian distribution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 65536;&#xA;x = normrnd(zeros(N, 1), ones(N, 1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Clip from above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = min(x, 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Clip symmetrically from below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z = max(y, -1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Plot values of Gaussian random variables (blue), clipped above (green), clipped symmetrically (red). Horizontal axis = index, vertical axis = value:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(1:N, x, 1:N, y, 1:N, z)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/trXrZ.png&quot; alt=&quot;Plot values of Gaussian random variables (blue), clipped above (green), clipped symmetrically (red). Horizontal axis = index, vertical axis = value&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot spectrum of Gaussian random variables (blue), clipped above (green), clipped symmetrically (red). Horizontal axis = frequency, vertical axis = magnitude:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;loglog(1:N/2, abs(fft(x)(1:N/2)), 1:N/2, abs(fft(y)(1:N/2)), 1:N/2, abs(fft(z)(1:N/2)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3FXIP.png&quot; alt=&quot;Plot spectrum of Gaussian random variables (blue), clipped above (green), clipped symmetrically (red). Horizontal axis = frequency, vertical axis = magnitude&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sequence that was clipped from above has a spectral peak at 0 Hz. Otherwise, the spectral envelopes are flat. This is not very easy to see because of the increasing density of plot points in the high frequencies in the logarithmic scale plot. &lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-06-04T15:17:31.543" LastActivityDate="2015-06-04T15:17:31.543" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="23870" PostTypeId="2" ParentId="23864" CreationDate="2015-06-03T11:41:52.243" Score="1" Body="&lt;p&gt;I think you misunderstand what this filter is doing. It does not compute approximations of the Bessel functions $J_0(x)$ and $J_1(x)$, but it computes an approximation of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Hankel_transform&quot; rel=&quot;nofollow&quot;&gt;Hankel transform&lt;/a&gt; of some input function. The function is expressed as a weighted sum of Bessel functions, and the result of the transform are the weights. The digital filtering approach is an efficient alternative to solving the transform integral by standard methods of numerical integration.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-03T11:41:52.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23871" PostTypeId="2" ParentId="23867" CreationDate="2015-06-03T11:52:55.787" Score="2" Body="&lt;p&gt;HSV has very intuitive axes (hue, saturation, value) and is useful for manual choosing and adjustment of colors. It is defined in relation to an arbitrary RGB color space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In CIELAB, only the lightness (L) axis has an intuitive meaning (in my opinion). Euclidean distances in CIELAB coordinates approximate perceptual distances of colors, which can be useful. It is defined in relation to the CIE 1931 XYZ color space, given a white point.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-06-03T11:52:55.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23872" PostTypeId="2" ParentId="23868" CreationDate="2015-06-03T13:16:09.620" Score="2" Body="&lt;p&gt;The only thing I could see, with the information you gave, is that the way you get from passband to baseband and vice-versa could affect your performances. It should not, but it could. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have to down sample to get to baseband, and up sample to do the contrary and you use filters to do so. If your filters have variations of 1dB in their passband and a cutoff frequency that cuts some of your baseband signal, then your performances could be deteriorated. In an ideal situation it should not, but some considerations (restriction on the number of coefficients of your filters, for example) may imply some performance degradation.&lt;/p&gt;&#xA;" OwnerUserId="12161" LastActivityDate="2015-06-03T13:16:09.620" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23873" PostTypeId="1" AcceptedAnswerId="23874" CreationDate="2015-06-03T13:57:32.713" Score="0" ViewCount="63" Body="&lt;p&gt;a Nyquist series should look something like {...-1, 1, -1, 1, ... }, which i think means it is a sine wave sampled at the peaks and valleys exactly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, given a sampling rate of 48 Hz, the Nyquist frequency should be 24 Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am not mistaken, Nyquist series is basically the the dataset of a sine wave of frequency = Nyquist Frequency, sampled at the sampling rate given above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;in short, these are my matlab vars:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SR = 48;             //sampling rate (hz)&#xA;X  = 0:1/SR:2*pi;    //domain (time in general)&#xA;fNy= SR/2;           //nyquist frequency&#xA;Y1 = sin(2*pi*fNy*X);// a sine wave with freq = nyquist frequency.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when i plot X and Y1, i get a really messed up plot. (i think its zero since its so small in magnitude)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JNpTK.jpg&quot; alt=&quot;Nyq Fail&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that Y1 should be exactly = 1, -1, 1, -1, 1, -1 ... &#xA;Where did I go wrong? thanks &lt;/p&gt;&#xA;" OwnerUserId="16071" LastActivityDate="2015-06-03T14:10:06.303" Title="Cannot recreate a simple Nyquist series in Matlab" Tags="|frequency|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23874" PostTypeId="2" ParentId="23873" CreationDate="2015-06-03T14:10:06.303" Score="0" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try &lt;code&gt;Y1 = cos(2*pi*fNy*X);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(And think about the $x$-axis values at which you sampled the sine)&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-03T14:10:06.303" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23875" PostTypeId="1" CreationDate="2015-06-03T15:41:23.590" Score="0" ViewCount="251" Body="&lt;p&gt;I try to decode freqs of 17k &amp;amp; 17.8k which carry on a sinus of 15ms duration.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to decode them with a goertzel filter. It seems fine when one of the filters show a magnitude that is around 800.&#xA;But, the filter has his own mood and after several hours of checking the system again it produces a very low magnitude. I thought of using a band pass filter so I can decide if the frequency is there or not by extraction the energy inside the BPF. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public class Goertzel&#xA;{&#xA;    public double GoertzelFilter(float[] samples, int start, int end,double coeff)&#xA;    {&#xA;        double sPrev = 0.0;&#xA;        double sPrev2 = 0.0;&#xA;        int i;&#xA;        for (i = start; i &amp;lt; end; i++)&#xA;        {&#xA;            double s = samples[i] + coeff * sPrev - sPrev2;&#xA;            sPrev2 = sPrev;&#xA;            sPrev = s;&#xA;        }&#xA;        double power = sPrev2 * sPrev2 + sPrev * sPrev - coeff * sPrev * sPrev2;&#xA;        return power;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15637" LastEditorUserId="15637" LastEditDate="2015-06-04T07:49:42.590" LastActivityDate="2015-06-04T07:49:42.590" Title="goertzel or bandpass?" Tags="|audio|bandpass|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23877" PostTypeId="1" AcceptedAnswerId="23899" CreationDate="2015-06-03T18:50:57.297" Score="0" ViewCount="61" Body="&lt;p&gt;I have function that I want to sample with sampleing rate 20 Msamples/sec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The funciton is the one below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w_T(t)= \left\{ \begin{array}{ll}&#xA;         \sin^2(\frac{\pi}{2}(0.5+\frac{t}{T_{TR}})) &amp;amp; \mbox{if $-T_{TR}/2 &amp;lt; t&amp;lt;T_{RT}/2$};\\&#xA;        1 &amp;amp; \mbox{if $T_{TR}/2 &amp;lt; t&amp;lt;T-T_{TR}/2$}\\&#xA; \sin^2(\frac{\pi}{2}(0.5-\frac{t-T}{T_{TR}})) &amp;amp; \mbox{if $T-T_{TR}/2 &amp;lt; t&amp;lt;T+T_{TR}/2$};\\&#xA;\end{array} \right. $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw the solution is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w_T(n)=\left\{ \begin{array}{ll}&#xA;         1 &amp;amp; \mbox{if $1&amp;lt;n&amp;lt;79$};\\&#xA;        0.5 &amp;amp; \mbox{if $0,80$}.\end{array} \right. $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to see why it so so I put $t=n T_s= n \frac{1}{20\times10^{-6}}$. It is also given that $T_{TR}= 100 ns$ and $T=4&#xA;\mu sec$. But i fail to reach the discrete funciton.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to reach solution?&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="15590" LastEditDate="2015-06-04T01:15:30.677" LastActivityDate="2015-06-04T16:10:09.773" Title="change function from continuous to discrete" Tags="|sampling|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23878" PostTypeId="1" AcceptedAnswerId="23879" CreationDate="2015-06-03T18:54:28.200" Score="1" ViewCount="681" Body="&lt;p&gt;I am confused on what the difference between transport delay and dead time is. They seem to have the same function, but I'm not sure. Can someone explain the difference if there is one?&lt;/p&gt;&#xA;" OwnerUserId="15920" LastActivityDate="2015-06-03T21:02:16.760" Title="What is the difference between transport delay and dead time?" Tags="|discrete-signals|delay|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23879" PostTypeId="2" ParentId="23878" CreationDate="2015-06-03T21:02:16.760" Score="1" Body="&lt;p&gt;According to &lt;a href=&quot;http://www.multimechatronics.com/images/uploads/mech_n/First-Order%20Process%20with%20Time%20Delay.pdf&quot; rel=&quot;nofollow&quot;&gt;this document&lt;/a&gt; (p. 4) and &lt;a href=&quot;http://scholarworks.sjsu.edu/cgi/viewcontent.cgi?article=5034&amp;amp;context=etd_theses&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt; (p. 13), transport delay and dead time denote the same thing: latency.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-03T21:02:16.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23881" PostTypeId="1" AcceptedAnswerId="23887" CreationDate="2015-06-04T00:10:01.503" Score="6" ViewCount="12248" Body="&lt;p&gt;I want to know the difference between independent and identically distributed (i.i.d) noise and white noise.&lt;/p&gt;&#xA;&lt;p&gt;In my short knowledge, i.i.d is that there is no relationship about time dependency. White noise means that there are relationship about time dependency.&lt;/p&gt;&#xA;&lt;p&gt;Actually, I'm not sure whether this is correct or not. Also I want to know  what is an i.i.d white noise.&lt;/p&gt;&#xA;&lt;p&gt;Can you tell me where we find the iid noise in the nature?&lt;/p&gt;&#xA;&lt;h1&gt;update&lt;/h1&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jHPv7.png&quot; alt=&quot;enter image description here&quot; /&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/KFOtm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="7092" LastEditDate="2022-03-03T11:45:23.997" LastActivityDate="2022-03-03T11:45:23.997" Title="What is the difference between i.i.d noise and white noise?" Tags="|noise|" AnswerCount="1" CommentCount="0" ClosedDate="2015-06-05T13:00:07.057" ContentLicense="CC BY-SA 4.0" />
  <row Id="23883" PostTypeId="1" CreationDate="2015-06-04T04:21:57.047" Score="2" ViewCount="777" Body="&lt;p&gt;I want to select the staff lines as individual blobs in either of these images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7LJ25.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/V95Le.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="16083" LastEditorUserId="8202" LastEditDate="2015-06-04T09:30:36.840" LastActivityDate="2015-06-04T09:30:36.840" Title="Getting blobs from similar colored contours in grayscale image" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23884" PostTypeId="2" ParentId="17333" CreationDate="2015-06-04T04:26:15.440" Score="0" Body="&lt;p&gt;There are research papers which mentioned the used of Kalman filter in EEG signals. One of the major challenges is deriving or implementation of a model. It may be difficult but not impossible.&lt;/p&gt;&#xA;" OwnerUserId="16084" LastActivityDate="2015-06-04T04:26:15.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23885" PostTypeId="1" CreationDate="2015-06-04T04:51:42.340" Score="0" ViewCount="841" Body="&lt;p&gt;Assuming we have &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;time vector $T$ with constant time step $dt$&lt;/li&gt;&#xA;&lt;li&gt;position vector $X$&lt;/li&gt;&#xA;&lt;li&gt;velocity vector $V$&lt;/li&gt;&#xA;&lt;li&gt;acceleration vector $A$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All vectors $X, V, A$ have noise on their measurement ( $n_x$ , $n_v$ , $n_a$ ). And all should be filtered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to form &lt;strong&gt;Kalman&lt;/strong&gt; filter for the the matrices:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_k= A x_{k-1} + B u_k + w_{k-1} $$&#xA;$$ y_k= H x_k + v_k $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w$ and $n$ are normal noise. Each $x_k$ is $\begin{bmatrix} X_k  &amp;amp; V_k &amp;amp; A_k\end{bmatrix}^T$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came up with two matrix assumption for kalman filtering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which one is correct?&#xA;$$A=\begin{bmatrix} 1 &amp;amp; dt &amp;amp; \frac{1}{2}dt^2 \\ 0 &amp;amp; 1 &amp;amp; dt \\ 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix}$$&#xA;$$B=\begin{bmatrix}0 &amp;amp; 0 &amp;amp; 0\end{bmatrix}^T$$&#xA;$$H=I$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or this one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A=\begin{bmatrix} 1 &amp;amp; dt &amp;amp; \frac{1}{2}dt^2 \\ 0 &amp;amp; 1 &amp;amp; dt \\ 0 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}$$&#xA;$$B=\begin{bmatrix} 0 &amp;amp;  0 &amp;amp; 1 \end{bmatrix}^T$$&#xA;$$H=I$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The acceleration is not constant and there is a variable input acceleration. I need to fix acceleration as well as velocity and position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please explain why which one is correct and the other is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code. How to extend it for variable acceleration?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time_resolution=0.016;&#xA;tmp1=diag((1:9)*0+1,3);&#xA;tmp2=diag((1:9)*0+1,6);&#xA;A_T=eye(9)+tmp1(1:9,1:9)*time_resolution+0.5*tmp2(1:9,1:9)*time_resolution*time_resolution;&#xA;A=A_T;&#xA;C=eye(size(A));&#xA;p_tmp=[position_x;position_y;position_z];&#xA;v_tmp=[velocity_x;velocity_y;velocity_z];&#xA;a_tmp=[acceleration_x;acceleration_y;acceleration_z];&#xA;X=[p_tmp;v_tmp;a_tmp];&#xA;&#xA;xh_=X*0;&#xA;yh_=X*0;&#xA;inov=X*0;&#xA;xh=zeros(size(X)+[0,1]);&#xA;xh(:,1)=X(:,1);&#xA;&#xA;R=1;&#xA;Q=100*diag([.1 .1 .1 .5 .5 .5 10 10 10]);&#xA;Px=eye(size(A));&#xA;&#xA;for i = 1 : size(X,2)&#xA;    % x(t|t-1) = A*x(t-1|t-1)&#xA;    xh_(:,i) = A * xh(:,i);&#xA;&#xA;    % P(t|t-1) = A*P(t-1|t-1)*A' + Q&#xA;    Px_ = A*Px*A' + Q;&#xA;&#xA;    % K(t) = P(t|t-1) * C' * inv(C*P(t|t-1) * C' + R) )&#xA;    K = Px_ * C' /(C*Px_*C' + R);&#xA;&#xA;    % y(t|t-1) = C*x(t|t-1) + R&#xA;    yh_(:,i) = C * xh_(:,i) + R;&#xA;&#xA;    % innovation error  y(t) - y(t|t-1)&#xA;    inov(:,i) = X(:,i) - yh_(:,i);&#xA;&#xA;    % x(t|t) = x(t|t-1) + K(t)*(y(t)-y(t|t-1))&#xA;    xh(:,i+1) = xh_(:,i) + K * inov(:,i);&#xA;&#xA;    % P(t|t) = (I - K(t)*C) * P(t|t-1)&#xA;    Px = Px_ - K*C*Px_;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16086" LastEditorUserId="16086" LastEditDate="2015-06-05T02:17:25.097" LastActivityDate="2015-11-02T13:47:56.487" Title="How to form Kalman filtering matrices for a problem with variable acceleration?" Tags="|noise|kalman-filters|control-systems|state-space|motion|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23886" PostTypeId="2" ParentId="23883" CreationDate="2015-06-04T06:45:19.330" Score="2" Body="&lt;p&gt;Here is a simple steps in c++ to identify the Objects you want to detect! Hope this solves your problem!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void main()&#xA;{&#xA;    Mat mSource_Bgr,mSource_Gray,mSmoothed,mEdge,mThres;&#xA;    mSource_Bgr= imread(FileName_S.c_str(),IMREAD_COLOR);&#xA;    cvtColor(mSource_Bgr,mSource_Gray,COLOR_BGR2GRAY);&#xA;&#xA;    medianBlur(mSource_Gray,mSmoothed,5); /*Just to smooth the Edges*/&#xA;/*This is for Automatically calculating the Canny Threshold values*/&#xA;    double CannyAccThresh = threshold(mSmoothed,mThres,0,255,CV_THRESH_BINARY|CV_THRESH_OTSU);&#xA;    double CannyThresh = 0.1 * CannyAccThresh;&#xA;&#xA;    Canny(mSmoothed,mEdge,CannyThresh,CannyAccThresh); &#xA;&#xA;    Mat kernal_E,kernal_D;&#xA;    int erosion_size=2,dilation_size=2;&#xA;    kernal_E= getStructuringElement( MORPH_RECT,Size( 2*erosion_size + 1, 2*erosion_size+1 ),&#xA;                                       Point( erosion_size, erosion_size ) );&#xA;    kernal_D= getStructuringElement( MORPH_RECT,Size( 2*dilation_size + 1, 2*dilation_size+1 ),&#xA;                                       Point( dilation_size, dilation_size ) );&#xA;    dilate(mEdge,mEdge,kernal_D);//Just to make sure all the Edges are closed&#xA;    erode(mEdge,mEdge,kernal_E);&#xA;&#xA;    imshow(&quot;mCanny_Edge&quot;,mEdge);&#xA;    imwrite(FileName_S+ &quot;mCanny_Edge.bmp&quot;,mEdge);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rVI9u.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    vector&amp;lt;vector&amp;lt;Point&amp;gt; &amp;gt; contours;&#xA;    vector&amp;lt;Vec4i&amp;gt; hierarchy;&#xA;    /// Find contours&#xA;    findContours( mEdge.clone(), contours, hierarchy, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );&#xA;    /// Approximate contours to polygons + get bounding rects and circles&#xA;    vector&amp;lt;vector&amp;lt;Point&amp;gt; &amp;gt; contours_poly( contours.size() );&#xA;    for( size_t i = 0; i &amp;lt; contours.size(); i++ )&#xA;    { &#xA;        approxPolyDP( Mat(contours[i]), contours_poly[i], 1, true );&#xA;    }&#xA;&#xA;    for (int i = 0; i &amp;lt; contours_poly.size(); i++)&#xA;    {&#xA;        if(contours_poly[i].size()&amp;gt;100)//Just a filter You can add more here&#xA;            drawContours(mSource_Bgr,contours_poly,i,Scalar(0,255,0),2);&#xA;    }&#xA;    imshow(&quot;mResult&quot;,mSource_Bgr);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vULrM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;    }&lt;/p&gt;&#xA;" OwnerUserId="5912" LastActivityDate="2015-06-04T06:45:19.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23887" PostTypeId="2" ParentId="23881" CreationDate="2015-06-04T07:05:14.157" Score="6" Body="&lt;p&gt;Independence is 'stronger' than whiteness. I believe that independence between the random variables implies whiteness but whiteness does not imply independence. Whiteness means that the random variables are uncorrelated but not necessarily independent. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use of i.i.d noise is seen very often when formulating probabilistic models because it makes inference much easier. For instance if two random variables $X_1$ and $X_2$ are i.i.d it means that the joint pdf $p(X_1,X_2)$ factors into the product of the individual pdfs $p(X_1)p(X_2)$. If the two random variables are uncorrelated this factorization is not valid. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In ML estimation typically the log of the product is considered $\log(p(X_1)p(X_2)) = \sum \log p(X)$ because then differentiation with respect to the parameter of interest is much more straight forward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure where to find i.i.d noise in the real world but I believe that the assumption about i.i.d observation noise is made more of convenience than because it is realistic.&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditDate="2017-10-23T10:03:47.657" LastActivityDate="2017-10-23T10:03:47.657" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="23888" PostTypeId="1" AcceptedAnswerId="23948" CreationDate="2015-06-04T08:53:00.267" Score="0" ViewCount="461" Body="&lt;p&gt;I am trying to recreate MATLAB's hough function with mine. My code follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [H,T,R] = my_hough(x,dr,dtheta)&#xA;    rows = size(x,1);&#xA;    cols = size(x,2);&#xA;    D = sqrt((rows - 1)^2 + (cols - 1)^2);&#xA;    Nr = 2*(ceil(D/dr)) + 1;&#xA;    diagonal = dr*ceil(D/dr);&#xA;    R = -diagonal:dr:diagonal;&#xA;    T = -90:dtheta:90-dtheta;&#xA;    Ntheta = length(T);&#xA;    H = zeros(Nr,Ntheta);&#xA;    for i = 1:Ntheta&#xA;        for n1 = 1:rows&#xA;            for n2 = 1:cols&#xA;                if x(n1,n2)==1&#xA;                    r = n2*cos(T(i)*pi/180) + n1*sin(T(i)*pi/180);&#xA;                    [~,j] = min(abs(R-ones(1,Nr)*r));&#xA;                    H(j,i) = H(j,i) + 1;&#xA;                end&#xA;            end&#xA;        end    &#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;dr&lt;/code&gt; and &lt;code&gt;dtheta&lt;/code&gt; are distance and angle resolution. Printing the difference between my Hough table and MATLAB's there are many zeros, but there are also some non-zero elements. Any idea why this is happening?&lt;/p&gt;&#xA;" OwnerUserId="14901" LastActivityDate="2015-06-07T23:09:34.340" Title="Difference between MATLAB hough and my implementation" Tags="|image-processing|matlab|hough-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23890" PostTypeId="1" AcceptedAnswerId="23894" CreationDate="2015-06-04T09:48:46.463" Score="0" ViewCount="490" Body="&lt;p&gt;I am using Chebychev window for its narrow main lobe. The problem of chebychev window is that it has discontinuities at the edge, and it seems that Taylor window solves this issue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More detail:&#xA;&lt;a href=&quot;http://de.mathworks.com/help/signal/ref/taylorwin.html&quot; rel=&quot;nofollow&quot;&gt;http://de.mathworks.com/help/signal/ref/taylorwin.html&lt;/a&gt;&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Window_function#Dolph.E2.80.93Chebyshev_window&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Window_function#Dolph.E2.80.93Chebyshev_window&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've searched around but I can't find any information on how to implement a Taylor window. Any information on taylor window or suggestions on fixing this issue of edge discontinuities would be very appreciated.&lt;/p&gt;&#xA;" OwnerUserId="16093" LastEditorUserId="16093" LastEditDate="2015-06-04T11:01:35.220" LastActivityDate="2015-06-04T14:04:52.123" Title="Discontinuity at the edge of Chebychev window" Tags="|fft|window-functions|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23891" PostTypeId="2" ParentId="23138" CreationDate="2015-06-04T10:52:01.407" Score="1" Body="&lt;p&gt;The questions ask, Is it possible to determine the frequency of one tone, and is it possible to distinguish (recognize if there are) two tones?  The only way to see if something is possible is to try it yourself.  You need to use software to generate the various-length tone sequences described in the problem.  Then perform your FFTs and plot the spectral magnitudes of your FFT results.  Inspect the FFT magnitude samples to see if you can determine the frequency of one tone, and distinguish (recognize if there are) two tones. (By sure and try two tones that close to each other frequency in the two-tone case.)&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-06-04T10:52:01.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23892" PostTypeId="1" CreationDate="2015-06-04T10:58:27.277" Score="1" ViewCount="1396" Body="&lt;p&gt;I have sampled digital signal with noise. I want to get main frequency of this signal how to do it?&#xA;Currently it is smoothed by moving average. Is good way to make Fourier Transform an take the highest peak? Or the first peak?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2015-12-02T09:59:46.713" Title="How to get main frequency from digital signal" Tags="|fft|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23893" PostTypeId="1" CreationDate="2015-06-04T11:10:53.440" Score="1" ViewCount="82" Body="&lt;p&gt;This is a soft question. There are different types of signals&#xA;like analog ,discrete or digital one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my question is how can one put information within a signal waveform and make it to traverse through different kind of physical medium, electronic circuits,devices etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover ,in physics,we have Newtons laws for conservation of mass and energy . Now,is there any similar law in case of &lt;strong&gt;signals&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15429" LastEditorUserId="15429" LastEditDate="2015-06-04T14:07:40.810" LastActivityDate="2015-06-05T06:47:02.153" Title="How can one put information within a signal waveform and make it to traverse through different kind of medium?" Tags="|discrete-signals|signal-analysis|continuous-signals|" AnswerCount="2" CommentCount="6" ClosedDate="2015-06-06T17:08:09.023" ContentLicense="CC BY-SA 3.0" />
  <row Id="23894" PostTypeId="2" ParentId="23890" CreationDate="2015-06-04T11:21:58.660" Score="0" Body="&lt;p&gt;You've probably seen that at the bottom of the mathworks page on the Taylor window there are two references. But I guess it might be hard access these publications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's indeed difficult to find the formula online, but on the bottom of &lt;a href=&quot;http://savannah.gnu.org/patch/?8506&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt; you can find a link to a (not yet released) Octave function implementing the Taylor window. I guess it's not too hard to distill the formula from the code. And &lt;a href=&quot;https://javamob.wordpress.com/tag/matlab-to-c/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; is a C implementation of the Matlab function &lt;code&gt;taylorwin.m&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-04T14:04:52.123" LastActivityDate="2015-06-04T14:04:52.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23895" PostTypeId="2" ParentId="23890" CreationDate="2015-06-04T11:24:03.973" Score="0" Body="&lt;p&gt;A little Googling came up with &lt;a href=&quot;http://www.tek.com/dl/37W-25531-0.pdf&quot; rel=&quot;nofollow&quot;&gt;this reference&lt;/a&gt;, which indicates that the impulse response for a Taylor window is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;h[n] = 1 + 2 \sum_{m=1}^{\tilde{n}-1} F_m \cos\left(\frac{2\pi m}{N} \left(n-\frac{N}{2}+\frac{1}{2}\right)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\tilde{n}$ is a parameter for controlling how many equal-height sidelobes there are in the window. $F_m$ is a parameter that is related to the maximum sidelobe height; the references given in Matt L's answer give more detail on how it is calculated.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-06-04T11:24:03.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23897" PostTypeId="2" ParentId="23893" CreationDate="2015-06-04T13:30:19.463" Score="0" Body="&lt;p&gt;Signal carries information by mapping.One way is in terms of binary.Assume signal with 100KHz as 0 bit and 200KHz as bit 1.So if you detect the frequencies of the signal the you would get the required bit stream from the sender.More specifically assume the signal is sent for 1s steps.You get a signal for 10s and you divide it into 10 signals of 1s each you take the spectrum and see the frequency based on this you get a 10 bit information.This example is similar to Frequency Shift Keying(FSK).There can be other ways  by using other parameters of the signal like amplitude,phase etc.&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-06-04T13:30:19.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23898" PostTypeId="2" ParentId="23888" CreationDate="2015-06-04T15:42:15.667" Score="0" Body="&lt;p&gt;I don't have the rep to comment on Dima's answer, but the code in the question does convert the $\theta$ to radians already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my implementation of the routine for detecting lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ theta,rho,height,width,Accumulator] = SHTanalyse( m,delta_theta,delta_rho )&#xA;%% Get dimensions of input image&#xA;[height, width] = size(m);&#xA;&#xA;% Create array for theta &#xA;theta = -90:delta_theta:90;&#xA;costheta = cosd(theta); % Create lookup tables to optimize computation of cos theta and sin theta&#xA;sintheta = sind(theta);&#xA;&#xA;% Find bounds on rho&#xA;rhomax = round(sqrt(height^2 + width^2));&#xA;&#xA;% Create array for rho&#xA;rho = -rhomax:delta_rho:rhomax;&#xA;&#xA;% Get edgel coordinates&#xA;[yEdges,xEdges] =  find(m);&#xA;&#xA;% Initialize the accumulator&#xA;Accumulator = zeros(numel(rho),numel(theta));&#xA;&#xA;% Voting process&#xA;for k = 1:numel(yEdges) % Loop through edge pixels&#xA;    for t = 1:numel(theta)&#xA;        % Compute the corresponding rho&#xA;        rhvalue = round(xEdges(k).*costheta(t) + yEdges(k).*sintheta(t));&#xA;        % Increment accumulator&#xA;        Accumulator(rhvalue + round(0.5*numel(rho)) + 1,theta(t) + 90 + 1) = Accumulator(rhvalue + round(0.5*numel(rho)) + 1,theta(t) + 90 + 1) + 1;&#xA;    end&#xA;end    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can compare its performance with the MATLAB's own Hough function to figure out the discrepancy.&lt;/p&gt;&#xA;" OwnerUserId="8861" LastEditorUserId="14901" LastEditDate="2015-06-04T21:51:18.610" LastActivityDate="2015-06-04T21:51:18.610" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23899" PostTypeId="2" ParentId="23877" CreationDate="2015-06-04T15:53:31.887" Score="0" Body="&lt;p&gt;if you take sampling frequency as 20Msamples/sec then sampling time Ts is&#xA;$$T_s=\frac{1}{f_s}\\T_s=\frac{1}{20\times10^6}\\T_s=50ns$$since the solution is till n=79 we can see that t=79*50=3950&lt;br&gt;&#xA;From the continues time function this  Trt/2=50ns and T-Trt/2=3950ns hence we get 1 n=1 to 79 when n=0 we get the first case which is equal to 0.5 similarly of n=80.This can be see as$$&#xA;w_T(nT_s)=&#xA;\begin{cases}&#xA;    \sin^2(\frac{\pi}{2}(0.5 +\frac{n50ns}{100ns})),&amp;amp; \text{if } -50\times10^{-6}&amp;lt;n50\times10^{-6}&amp;lt;50\times10^{-6}\\&#xA;    1,              &amp;amp; \text{if  } 50\times10^{-6}\leq n50\times10^{-6}\leq 3950\times 10^{-6}\\&#xA; \sin^2(\frac{\pi}{2}(0.5 -\frac{n50ns-4000ns}{100ns})),&amp;amp;\text{if } other case&#xA;\end{cases}$$&#xA;which comes down to&lt;br&gt;&#xA;$$&#xA;    w(n)=&#xA;\begin{cases}&#xA;    \sin^2(\frac{\pi}{2}(0.5 +\frac{n}{2})),&amp;amp; \text{if } -1&amp;lt;n&amp;lt;1\\&#xA;    1,              &amp;amp; \text{if  } 1\leq n\leq79\\&#xA; \sin^2(\frac{\pi}{2}(0.5 -\frac{n-79}{2})),&amp;amp;\text{if } 79&amp;lt;n&amp;lt;81  &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&#xA;In the above equation we can remove the $$-1&amp;lt;n&amp;lt;1$$as n=0 when n=0 w(0)=0.5 for n=1to78 w(n)=1.When n=80 the third one become zero.Hence you get the finalized expression.I hope this answers your question&lt;/p&gt;&#xA;" OwnerUserId="11819" LastEditorUserId="8202" LastEditDate="2015-06-04T16:10:09.773" LastActivityDate="2015-06-04T16:10:09.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23900" PostTypeId="1" CreationDate="2015-06-04T16:17:11.040" Score="1" ViewCount="2189" Body="&lt;p&gt;I am having trouble with all of the forums that I have looked at thus far.&#xA;I have one day's worth of Sonic Anemometer data. I want to see the spectral analysis of this data. When the anemometer data was being logged it appears that the frequency ranges between 31 and 32 hz. I am looking to analyze this data in thirty minute chunks and I would just like some guidance as to how to go about this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already removed the bad data (stray data points with 98 m/s winds x.x).  I am not sure if I am supposed to detrend the data then apply a Hamming window and take the Fourier transform, or if I'm supposed to just apply the Hamming window and then take the Fourier transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also should I calculate the sampling frequency for each 30 minute interval since it appears to change or is that change insignificant? (or should I analyze the whole data set together?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long post but I have been hacking away on forums all week and I cannot seem to find a consistent solution. &lt;/p&gt;&#xA;" OwnerUserId="16098" LastEditorUserId="15892" LastEditDate="2016-03-03T17:14:11.633" LastActivityDate="2019-08-17T00:04:41.337" Title="How do I perform Spectral Analysis (FFT, Windowing, Detrending) on Sonic Anemometer Data?" Tags="|matlab|fft|signal-analysis|fourier-transform|power-spectral-density|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23901" PostTypeId="1" CreationDate="2015-06-04T16:27:26.810" Score="1" ViewCount="73" Body="&lt;p&gt;In &lt;a href=&quot;http://www.eng.ucy.ac.cy/cpitris/courses/ECE623/presentations/DSP-LECT-10-11-12.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.eng.ucy.ac.cy/cpitris/courses/ECE623/presentations/DSP-LECT-10-11-12.pdf&lt;/a&gt;, it says that when sinusoidal input $X(z)$ starts at n=0 (with n&amp;lt;0 having zero input) and the input passes through digitl filter $H(z)$, resulting in output z-transform $Y(z) = H(z)X(z)$, transient response is associated with poles of the filter while steady-state response is associated with the poles of the input. Is this true? If so, how does one prove this?&lt;/p&gt;&#xA;" OwnerUserId="16100" LastActivityDate="2015-06-04T19:00:51.213" Title="When sinusoidal input starts at n=0, why are transient response associated with z-transform poles of digital filter?" Tags="|discrete-signals|z-transform|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23902" PostTypeId="2" ParentId="23901" CreationDate="2015-06-04T16:56:26.933" Score="2" Body="&lt;p&gt;Yes, that's true if the $\mathcal{Z}$-transform of the input signal has poles on the unit circle (i.e., the input is a constant or a sinusoid, starting at $n=0$), and if the filter is stable, i.e. all its poles are inside the unit circle. If you split up $Y(z)$ by a partial fraction expansion, you get a contribution for each pole. The contributions from the poles of $H(z)$ all decay to zero because we've assumed that the filter is stable, i.e. all its pole magnitudes are smaller than $1$, and consequently, these terms decay exponentially. On the other hand, the contributions from the poles of $X(z)$ do not decay because the corresponding poles lie on the unit circle. This means that after a while, all contributions associated with the poles of $H(z)$ will be very small (practically zero; transients), whereas the contributions from the poles of $X(z)$ remain at a constant amplitude (steady-state response).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-04T19:00:51.213" LastActivityDate="2015-06-04T19:00:51.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23903" PostTypeId="2" ParentId="23838" CreationDate="2015-06-04T17:21:04.993" Score="0" Body="&lt;p&gt;Part A: Bilinear Transformation Method&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Design lowpass IIR filter with the following specifications:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Filter order = 2, Butterworth type&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cut-off frequency=800 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling rate =8000 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Design using the bilinear z-transform design method&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Print the lowpass IIR filter coefficients and plot the frequency responses &#xA;using MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB&gt;&gt;freqz(bLP,aLP,512,8000); axis([0 4000 –40 1]); % sampling rate=8000 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Label and print your graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the filter gains for stopband at the cut-off frequency and 2000 Hz, and passband at 50 Hz based on the plot of the magnitude frequency response?&lt;/p&gt;&#xA;" OwnerUserId="16101" LastActivityDate="2015-06-04T17:21:04.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23904" PostTypeId="1" AcceptedAnswerId="23912" CreationDate="2015-06-04T17:28:51.337" Score="2" ViewCount="1975" Body="&lt;p&gt;I am trying to synthesize sinusoids by using window function in the frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It involves:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In frequency domain, shift the window to center around the peak frequency&lt;/li&gt;&#xA;&lt;li&gt;To generate a DFT frame, sample a few values of the window around the peak as the spectral motif&lt;/li&gt;&#xA;&lt;li&gt;Inverse-Fourier transform the spectral motif, to generate the sinusoid in the desired frequency&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This approach works great in general, except for synthesising low frequencies. Because when shifting the window to the low frequency, the left side of the window will sit in the negative frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figure in the middle demonstrates the issue (T(k) sits in the negative domain)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/UlooI.png&quot; alt=&quot;figure&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a solution &lt;a href=&quot;http://www.google.de/patents/US6311158#classifications&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, it suggested to add the complex conjugate value of the left tail of the window (in the negative domain) to the DFT bin that’s on the right tail of the window (in the positive domain). Which I can’t make sense of, and following this solution creates even more distortion. So I wonder if anyone knows how to do it properly. Any suggestions would be very appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some excerpt from the aforementioned solution:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The reflection about the k=0 axis is due to the specific embodiment&#xA;  described herein for synthesizing a sinusoid. For each real sinusoid,&#xA;  one peak exists in the positive frequency bins and another peak exists&#xA;  in the negative frequency bins. In the embodiment wherein only the&#xA;  peak in the positive frequency bins is synthesized, a peak centered&#xA;  about a low positive frequency bin spills into the negative&#xA;  frequencies (as shown by the plot for Ht(k−bc) in FIG. 3). Similarly,&#xA;  a peak centered about a low negative frequency bin spills into the&#xA;  positive frequencies. The portion of Ht(k−bc) in the negative&#xA;  frequencies that is reflected, or T*(−k), represents the portion of&#xA;  the peak centered about the negative frequency bin that spills into&#xA;  the positive frequencies.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;PS. Some time ago I've raised this question on &lt;a href=&quot;http://www.dsprelated.com/showthread/comp.dsp/274124-1.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DSP-related forum&lt;/a&gt;. I've got very detailed suggestion from Robert, to ignore the bins lying on negative domain to specify the whole positive frequency, and then complex conjugate to reflect it to the negative frequency, which has improved the problem but it still can’t go down below 80 Hz. So I thought I’ll post again here.&lt;/p&gt;&#xA;" OwnerUserId="16093" LastEditorUserId="16093" LastEditDate="2015-06-06T12:26:34.610" LastActivityDate="2015-06-06T12:49:21.433" Title="Reflecting negative frequency to positive frequency" Tags="|fft|frequency-spectrum|frequency-domain|ifft|aliasing|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23907" PostTypeId="2" ParentId="23885" CreationDate="2015-06-04T18:51:20.690" Score="0" Body="&lt;p&gt;Assuming $u_k$ is your input and you control the acceleration directly you should use the second one. If you use the first one your input will have no effect at all since $B u_k$ becomes exactly zero always. If you control the variations of the acceleration instead of the acceleration directly you should replace only your $A$ matrix by the first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, develop your matrix equations into scalar ones for each variable (position, speed, acceleration) and you won't need any help with this kind of question anymore&lt;/p&gt;&#xA;" OwnerUserId="15743" LastActivityDate="2015-06-04T18:51:20.690" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23908" PostTypeId="1" AcceptedAnswerId="23909" CreationDate="2015-06-04T18:52:16.933" Score="1" ViewCount="334" Body="&lt;p&gt;I'm currently trying to reduce the noise in/smooth sampled signal strength data. The context is that I collected data from a transmitting device using bluetooth - the available data is basically a series of timestamps and the receiving signal strength.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem: The signal strength fluctuates quite strongly, which is why I want to smooth my data. Actually the data is not equally spaced - some signals get lost, the transmitter has some quirks leading to irregular periods in which signals are sent etc. - but I could aggregate them on a fixed time-period, if that's necessary / recommended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read some articles but are still not sure how to approach this. What kind of filter would probably lead to the best results? Kalman, Savitzky-Golay, adaptive, exponential...many to choose from and not enough experience to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would you recommend?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="15491" LastActivityDate="2016-10-27T04:14:38.207" Title="Smooth (not) equally-spaced signal strength data" Tags="|filters|discrete-signals|noise|denoising|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23909" PostTypeId="2" ParentId="23908" CreationDate="2015-06-04T19:06:28.077" Score="0" Body="&lt;p&gt;Between these I only have experience with Kalman filters. They don't need equally spaced measurements but you can make it a lot easier with it. Missing measurements are really easy to cope with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a simple solution and you think that the most likely outcome of your next measurement is the same as the last one (there are no 'dynamics') you could also interpolate your missing values and use a linear filter.&lt;/p&gt;&#xA;" OwnerUserId="15743" LastActivityDate="2015-06-04T19:06:28.077" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23910" PostTypeId="2" ParentId="23782" CreationDate="2015-06-04T19:17:42.547" Score="1" Body="&lt;p&gt;Kalman filters assume that you know the model and that you want to estimate the real state of $x[n]$, and if I understand well this is not your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should probably look into &lt;a href=&quot;http://en.wikipedia.org/wiki/Spectral_density_estimation&quot; rel=&quot;nofollow&quot;&gt;frequency estimation&lt;/a&gt;. If your noise is really high I suggest you to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Multiple_signal_classification&quot; rel=&quot;nofollow&quot;&gt;MUSIC&lt;/a&gt;. If not just FFT your signal and pick the highest peak. Having the frequency estimating the phase should be easy with correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to filter your signal then start by finding the missing values as I described, proceed by finding a differential equation for which the sine wave is a solution, transform the differential equation into a difference equation by finite differences and finally the difference equation into a state-space model.&lt;/p&gt;&#xA;" OwnerUserId="15743" LastEditorUserId="15743" LastEditDate="2015-06-04T19:23:11.993" LastActivityDate="2015-06-04T19:23:11.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23911" PostTypeId="1" AcceptedAnswerId="24190" CreationDate="2015-06-04T21:51:11.680" Score="2" ViewCount="102" Body="&lt;p&gt;I am quite interested in biomedical signal processing and I am looking for some biomedical signal processing papers in order to reproduce the results that they obtained. The idea is to redo what they did so I can learn about the topic and improve my research skills.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The papers should fit the following requisites:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The data that they use must be public.&lt;/li&gt;&#xA;&lt;li&gt;Most of the work could be done in Matlab or similar software.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Papers about biomedical image processing are also welcomed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="16102" LastActivityDate="2015-06-17T09:27:17.363" Title="Any basic paper on biomedical signal processing to practise with?" Tags="|matlab|signal-analysis|signal-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23912" PostTypeId="2" ParentId="23904" CreationDate="2015-06-04T21:53:56.627" Score="3" Body="&lt;p&gt;You could use another approach: allow negative frequencies, do a complex IFFT, discard the imaginary parts of the time domain samples, and multiply the result by 2.&#xA;Let's try it in Octave (MATLAB clone) with a motif $[1 + 2i, 3 + 4i, 5 + 6i, 7 + 8i]$ shifted so that its leftmost bin ($1 + 2i$) lands on a negative frequency. FFT length is 8. (I rewrote the results for readability.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; g = [3 + 4i, 5 + 6i, 7 + 8i, 0, 0, 0, 0, 1 + 2i]&#xA;g =&#xA;&#xA;   3 + 4i   5 + 6i   7 + 8i   0 + 0i   0 + 0i   0 + 0i   0 + 0i   1 + 2i&#xA;&#xA;&amp;gt; y = real(ifft(g))*2&#xA;y =&#xA;&#xA;   4.00000  -0.89645  -2.00000   0.98223   1.00000  -1.60355   0.00000   4.51777&#xA;&#xA;&amp;gt; fft(y)&#xA;ans =&#xA;&#xA;   6 + 0i   6 + 4i   7 + 8i   0 + 0i   0 + 0i   0 + 0i   7 - 8i   6 - 4i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The same time-domain signal $y$ can be generated by synthesizing the first 5 bins of $\text{fft}(y)$ and feeding them to real IFFT (which I assume you use). The 3 remaining negative-frequency bins the IFFT kind of generates internally. You can follow these steps for the synthesis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) For each bin of the shifted motif that lands on a positive-frequency bin, copy the value verbatim. (You are already doing this)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) For a bin of the shifted motif that lands on the 0 Hz bin, double its real part and write that to the 0 Hz bin, discarding the imaginary part, like $3 + 4i \rightarrow 6 + 0i$ in the example. (You are already doing this)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) For each bin of the shifted motif that lands on a negative-frequency bin, add its complex conjugate (same real part, sign of imaginary part flipped) to the positive-frequency bin that is at the same distance from the 0 Hz bin. This will be one of the bins already written to in step 1. In the second bin of the example $5+6i$ and $\text{conj}(1 + 2i) = 1 - 2i$ were summed to get $6 + 4i$. Don't expect the imaginary parts to cancel, because even if the motif might be symmetrical, those two motif bins are not located symmetrically on the opposite sides of the motif, unless you are synthesizing a 0 Hz sinusoid. It is perfectly fine if the imaginary part remains non-zero; frequency domain bins can have complex values and still yield real-valued time-domain data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, and if the shifted motif reaches the Nyquist bin (corresponding to half the sampling frequency) or beyond, do exactly the same things there, mirroring around the Nyquist bin.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-06-05T12:26:29.820" LastActivityDate="2015-06-05T12:26:29.820" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23914" PostTypeId="2" ParentId="23904" CreationDate="2015-06-04T22:33:53.450" Score="0" Body="&lt;p&gt;so, if you know what the window shape will be in the time-domain, then you know what the &lt;em&gt;&quot;motif&quot;&lt;/em&gt; (i haven't thought of using that word) of the window is in the frequency domain.  the Fourier transform of the window is your motif centered at DC (bin 0).  at some point you need to truncate the sidelobes of the motif to zero.  with a Gaussian window, the motif shape will also be Gaussian and will decay to zero rapidly on both sides and when it gets to, say, $10^{-9}$ or so, then you can truncate the Gaussian motif to zer0.  if you want your sinusoid frequencies to have fractional-bin precision, you will need to be able to interpolate the motif at different fractional-bin offsets and maybe store a variety of slightly different motif templates for different fractional-bin offsets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, first start out by clearing your entire spectrum to 0.  for each frequency component, you plop down a motif shifted to that frequency and, where the motif is non-zero, you must add it to the existing spectrum (which is initialized to zero).  that means some of the tails of motifs of different sinusoidal frequencies will overlap.  make sure you overlap-add and not just write over existing non-zero values in your spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;do this for both the positive and negative frequency components of each real sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the frequency is so low that some of the tail of the motif extends past DC (bin 0) then allow that and add it in.  i.e. the motif for the positive frequency component will extend into the negative frequencies and the reflected motif for the negative frequency component will extend into the positive frequencies.  just do it and allow the tails to overlap and add whether they cross over to the other sign of frequencies or not.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-06-04T22:33:53.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23916" PostTypeId="2" ParentId="23892" CreationDate="2015-06-05T04:18:42.783" Score="2" Body="&lt;p&gt;Generally, yes, you should perform FFT and take the highest peak from the first half of the transformed signal. However, if the frequency your are looking for is constant (or close to constant), i.e. doesn't change (much) throughout the observation time, I would recommend using &lt;a href=&quot;http://en.wikipedia.org/wiki/Welch&amp;#39;s_method&quot; rel=&quot;nofollow&quot;&gt;Welch's method&lt;/a&gt; instead of a simple FFT.&lt;br&gt;&#xA;If the accuracy is not good enough you can perform interpolation around the peak, or on the entire signal using zero-padding.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-06-05T04:18:42.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23917" PostTypeId="1" CreationDate="2015-06-05T05:59:36.490" Score="0" ViewCount="634" Body="&lt;p&gt;I am given an amplitude spectrum (no phase) and the envelope of a signal. What I know about the original signal is, that it can be thought of as wavepacket like structure (sinusoids under a bell curve) and the spectrum is narrow banded.&#xA;To be able to further analyse the original signal I would like to recover the input signal from those two given functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are:&lt;/strong&gt; Can I recover the signal from its amplitude spectrum and envelope or would you advice me to do otherwise.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To clarify what is given:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal is thought of wavepacket structure, which is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) \approx \sum_n\frac{1}{\sigma_n\sqrt{2\pi}}e^{-\dfrac{1}{2}\left(\dfrac{x-\mu_n}{\sigma_n}\right)^2} \cdot \sin(2\pi f_n x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $n \gt 1$, $\lvert\mu_k-\mu_l\rvert \lt \sigma_k, \sigma_l$ and if $\mu_k \gt \mu_l$ then $f_k \lt f_l$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude spectrum is the absolute of the Fourier transform of the signal, which is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(\omega) = \lvert\mathcal{F}\{x(t)\}\rvert$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The envelope can be thought of as absolute value of the analytic signal, which is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e(t) = \lvert x(t) + j \cdot \mathcal{H}\{x(t)\}\rvert$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if it is possible or even that beneficial to recover the signal and I am pleased for any answer or every hint.&lt;/p&gt;&#xA;" OwnerUserId="1599" LastEditorUserId="1629" LastEditDate="2016-06-01T22:47:22.023" LastActivityDate="2016-09-30T03:55:20.617" Title="Recover signal from its spectral amplitude and envelope" Tags="|fourier-transform|frequency-spectrum|analytic-signal|" AnswerCount="2" CommentCount="9" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23919" PostTypeId="2" ParentId="23893" CreationDate="2015-06-05T06:47:02.153" Score="2" Body="&lt;p&gt;Maybe what you want is &lt;a href=&quot;https://en.wikipedia.org/wiki/Information_theory&quot; rel=&quot;nofollow&quot;&gt;information theory&lt;/a&gt;. Information can be quantified by &lt;a href=&quot;https://en.wikipedia.org/wiki/Entropy_(information_theory)&quot; rel=&quot;nofollow&quot;&gt;Shannon entropy&lt;/a&gt;. An analog signal channel always has some level of noise which limits the rate of information that can be sent through it. That limit is called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Noisy-channel_coding_theorem&quot; rel=&quot;nofollow&quot;&gt;Shannon limit&lt;/a&gt;, or more specifically for a given channel bandwidth the &lt;a href=&quot;https://en.wikipedia.org/wiki/Shannon%E2%80%93Hartley_theorem&quot; rel=&quot;nofollow&quot;&gt;Shannon–Hartley theorem&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-06-05T06:47:02.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23923" PostTypeId="1" AcceptedAnswerId="23926" CreationDate="2015-06-05T17:19:37.897" Score="3" ViewCount="235" Body="&lt;p&gt;I notice that in the general Synchronous Overlap and Add (SOLA) algorithm, we need to obtain the best overlapping start index using, for example, cross-correlation. But won't that start index change the desired stretch factor? After all, the factor is determined by Rs/Ra (Rs is the synthesis hop and Ra is the analysis hop).&lt;/p&gt;&#xA;" OwnerUserId="16111" LastActivityDate="2015-06-06T08:50:11.693" Title="stretch factor in SOLA time stretch methods" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23924" PostTypeId="1" CreationDate="2015-06-05T18:16:38.870" Score="2" ViewCount="67" Body="&lt;p&gt;I want to know if there is an exact solution for the following problem and how to approach solving it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a discrete-time signal where the Nyquist theorem is satisfied:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r_k = \sum_i a_i^{(1)}h^{(1)}(kT-iT-\tau_i^{(1)}) +\sum_i a_i^{(2)}h^{(2)}(kT-iT-\tau_i^{(2)})$, &#xA;where $a_i^{(1)}$ and $a_i^{(2)}$ are two independent random streams of ${\pm 1}$ and $h^{(1)}(t)$ and $h^{(2)}(t)$ are their corresponding pulses, and $T$ is the bit period, and $\tau_i^{(1)}$ and $\tau_i^{(2)}$ are timing errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that I want to calculate another set of samples while all the parameters of the above equation are known. I want to obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$s_k = \sum_i a_i^{(1)}h^{(1)}(kT-iT) +\sum_i a_i^{(2)}h^{(2)}(kT-iT)$, which looks exactly like the original samples except for that the timing errors do not exist anymore. I know that I cannot achieve this just by resampling. How do I approach this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please share your thoughts.&lt;/p&gt;&#xA;" OwnerUserId="15404" LastActivityDate="2015-06-05T18:16:38.870" Title="Is there an exact solution for this re-sampling problem?" Tags="|discrete-signals|resampling|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23925" PostTypeId="2" ParentId="23917" CreationDate="2015-06-05T18:54:02.497" Score="0" Body="&lt;p&gt;You could try matching the theoretical Fourier transform of your equation to your data using an optimization framework such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\min_{\mu, \sigma, f}{ ||a_{observed}(w) - |\mathcal{F}(x(t))|||^2_2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use some derivate-free optimization method if you don't want to get your hands dirty&lt;/p&gt;&#xA;" OwnerUserId="15743" LastEditorUserId="15743" LastEditDate="2015-06-05T18:59:03.650" LastActivityDate="2015-06-05T18:59:03.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23926" PostTypeId="2" ParentId="23923" CreationDate="2015-06-06T08:50:11.693" Score="4" Body="&lt;p&gt;No, the start index doesn't change the stretch factor because the overlapping windows do not have to absolutely fit the available length of the recording.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can still effectively pad the original signal with zeros by returning a zero value for any request of samples outside the time interval of the original recording.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-06-06T08:50:11.693" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23928" PostTypeId="2" ParentId="23917" CreationDate="2015-06-06T11:30:58.703" Score="1" Body="&lt;p&gt;One counterexample is two wave packets of identical spread and amplitude, well separated in time so that their envelopes do not overlap, and of high enough (differing) well-separated frequencies such that their analytic signals can be considered Gaussian-enveloped complex exponentials. The Hilbert envelope will thus consist of two identical well-separated Gaussians. The amplitude spectrum will consist of well-separated Gaussians of identical magnitude. There is not enough information to assign the frequencies to the wave packets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t84vj.png&quot; alt=&quot;Two wave packets&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in general you cannot resolve the original signal, not even up to an ambiguity of a constant phase shift over all frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With sufficiently large time spreads of the two wave packets their frequencies need not be far apart to still be well separated in the spectrum, satisfying your constraint for a narrow-banded signal.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-06-07T07:18:26.873" LastActivityDate="2015-06-07T07:18:26.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23929" PostTypeId="2" ParentId="23904" CreationDate="2015-06-06T12:40:15.650" Score="0" Body="&lt;p&gt;Thanks so much olli! It works! To do it with real fft, just follow these 3 steps described by Olli, then complex conjugate the first half of the spectrum to the latter half.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extending Olli's example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the spectral motif [1 + 2i , 3 + 4i, 5 + 6i, 7 + 8i] and fft size of 8, after doing what olli said you'll first get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[6 + 0i, 6 + 4i, 7 + 8i, 0 + 0i, 0 + 0i, 0 + 0i, 0 + 0i, 0 + 0i]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then perform a complex conjugate of the first 4 bins to the latter half:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[6 + 0i, 6 + 4i, 7 + 8i, 0 + 0i, 0 + 0i, 0 + 0i, 7 - 8i, 6 - 4i]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then perform ifft, which should give you real-valued time-domain data.&lt;/p&gt;&#xA;" OwnerUserId="16093" LastEditorUserId="16093" LastEditDate="2015-06-06T12:49:21.433" LastActivityDate="2015-06-06T12:49:21.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23930" PostTypeId="1" CreationDate="2015-06-06T15:50:23.620" Score="0" ViewCount="1204" Body="&lt;p&gt;I am new to signal processing and examine ECG data corrupted with noise. The clean data has a frequency spectrum like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://photos-6.dropbox.com/t/2/AAC7uRjL4izCrFIZ7tpVn_CLkdX65DdgPjAD1ptjbtS05g/12/77998751/jpeg/32x32/1/_/1/2/clean_Freq.jpg/CJ_VmCUgASACIAMgBCAFIAYgBygBKAI/yRNe99XSLlyW8oaZN6iuIQoT2djoouIK8hyyWnbvtCY?size=1280x960&amp;amp;size_mode=2&quot; alt=&quot;Spectrum1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the corrupted one looks like  this (sorry for the different scale)&#xA;&lt;img src=&quot;https://photos-4.dropbox.com/t/2/AAD87EQ6JHMtgIJWmCUUCxjEda8EcnqMPH4EZXc7IqHAOw/12/77998751/jpeg/32x32/1/_/1/2/corrupted_freq.jpg/CJ_VmCUgASACIAMgBCAFIAYgBygBKAI/YEH4B1tRPKlCGPFpdHesDs6-4Nvhr1av6eHaEyXSqUw?size=1280x960&amp;amp;size_mode=2&quot; alt=&quot;Spectrum2&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am asked to find a FIR band pass filter in matlab to filter out the noise. Unfortunatly I am using filters for the first time so I played with the coefficients and found something like this (The only thing that seems to be clear to me is that the bandpass has to be between something like 1-30 but I have trouble choosing the other parameters.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Fstop1 = 0.01$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Fpass1 = 3$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Fpass2 = 25$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Fstop2 = 60$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Astop1 = 80$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Apass = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Astop2 = 30$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Fs = 250$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is not 100% satisfying (I am still having a lot of baseline fluctuations). Is it possible to get &quot;good&quot; results in doing this? Can anybody see heavy mistakes in my parameters that could lead to problems? Or can anyone tell me better coefficients to use?&lt;/p&gt;&#xA;" OwnerUserId="16125" LastEditorUserId="47790" LastEditDate="2020-04-02T12:08:46.513" LastActivityDate="2020-04-02T12:08:46.513" Title="ECG noise filtering using FIR Bandpass Filter" Tags="|matlab|filter-design|noise|bandpass|finite-impulse-response|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="23933" PostTypeId="1" AcceptedAnswerId="23949" CreationDate="2015-06-06T19:24:32.940" Score="2" ViewCount="123" Body="&lt;p&gt;For sequences that are transmitted over channels with memory $\mu=n$ and response H=$[h_0 h_1 \ldots h_n]$,Viterbi algorithm implements Maximum Likelihood (ML) detection and BCJR implements Maximum A-Posteriori (MAP) Detector. Trellis over which these detectors operate have total states = $2^n$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While applying any trellis based detector either ML or MAP detectors, channels are always considered causal i.e. $h_i=0 \quad \forall i&amp;lt;0$. More over equalizers/detectors are tested for channels that have $h_0=\max(h_i)\quad \forall i=0, \ldots,N$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is related BER vs SNR performance of these trellis based detectors (that jointly equalize and detect) when applied to channels that are not causal and have a peak at $t=k,k\neq 0$. Since a delay to shift response to right has no effect on the structure of trellis, one can easily achieve this. But now the peak is no more at $t=0$. Following is an example to make it more clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $h_{ij}$ represent the $j^{th}$ coefficient for channel $i$. Consider two channels,  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}H_1 &amp;amp;=\left[h_{10} \space h_{11} \space h_{12}\right]=[4 \space 2 \space 1]\\H_2&amp;amp;=\left[h_{20} \space h_{21} \space h_{22}\right]=[2 \space 4 \space 1]\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The performance of ML and MAP detector on $H_1$ is better than that of $H_2$ which is obviously because of high ISI in $H_2$ as compared to $H_1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What transformation on $H_2$ can be done so that the resulting channel has a BER vs SNR that is close to $H_1$?&lt;/p&gt;&#xA;" OwnerUserId="16080" LastEditorUserId="128" LastEditDate="2017-09-27T10:32:04.350" LastActivityDate="2017-09-27T10:32:04.350" Title="Performance of Viterbi detector over non-minimum phase channels" Tags="|digital-communications|estimation|viterbi-algorithm|maximum-a-posteriori-estimation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="23937" PostTypeId="1" CreationDate="2015-06-06T23:37:16.233" Score="0" ViewCount="1004" Body="&lt;p&gt;What is the minimum sampling rate of a $\sin(\pi t)$ signal? When the sampling frequncy is twice that of the frequency, the spectrum is not present and in time domain all the samples we get is 0. In this case does the sampling rate should be greater than $2 f_\text{s}$? Then how does the Nyquist rate fit in this?&lt;/p&gt;&#xA;" OwnerUserId="16129" LastEditorUserId="4346" LastEditDate="2015-06-07T01:00:30.307" LastActivityDate="2015-06-07T01:00:30.307" Title="Sampling rate of a sinusoidal Signal" Tags="|sampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23938" PostTypeId="2" ParentId="23937" CreationDate="2015-06-07T00:49:56.653" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the minimum sampling rate of a $\sin(\pi t)$ signal? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$$F_\text{s} = 1 + \epsilon$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\epsilon &amp;gt; 0$.  you must sample at some frequency &lt;strong&gt;exceeding&lt;/strong&gt; twice the bandwidth.  (all this assmuming real $x(t)$ and none of this bandpass sampling stuff.)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When the sampling frequncy is twice that of the frequency, the spectrum is not present and in time domain all the samples we get is 0.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;nooooooo!&lt;/strong&gt; that's not the case!  you could miss-sample it by $90^\circ $ and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = x(nT) = \cos(\pi n) = (-1)^n$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;instead.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In this case does the sampling rate should be greater than $2 f_\text{s}$? then how does Nyquist rate fit in this&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;the original Nyquist paper (i'll try to find a link to it), actually excludes pure sinusoids, particularly a pure sinusoid sitting at Nyquist.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;to deal with the $x[n] = x(nT) = \cos(\pi n + \phi)$ thing (a sinusoid at the Nyquist frequency), you have to accept the notion of Dirac delta functions, $\delta(f)$ in the frequency domain.  and then you will see that, at Nyquist, ($f = \frac{F_\text{s}}{2}$), there will be overlapping and aliasing.  but unlike other aliasing, you lose only half of your information, just the phase.  so if there were reconstruction done, it would be only on the basis of the quadrature component of the&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = cos(\pi t + \phi) = \cos(\phi)\cos(\pi t) - \sin(\phi)\sin(\pi t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;input. if $F_\text{s} \triangleq \frac{1}{T} = 1$ and $x[n]=x(nT)$, only the $\cos(\phi)\cos(\pi t)$ term counts.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-06-07T00:55:41.657" LastActivityDate="2015-06-07T00:55:41.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23939" PostTypeId="2" ParentId="23900" CreationDate="2015-06-07T02:21:18.510" Score="0" Body="&lt;p&gt;– Use one of the standard &lt;a href=&quot;https://www.mathworks.com/help/signal/spectral-analysis.html&quot; rel=&quot;nofollow&quot;&gt;spectral estimation&lt;/a&gt; functions of Matlab to process the data; the best place to start is probably &lt;a href=&quot;https://www.mathworks.com/help/signal/ref/pwelch.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;pwelch&lt;/code&gt;&lt;/a&gt;. That function implements the &quot;modified periodogram&quot; method of spectral estimation, which involves windowing (by default using a Hamming window), Fourier transform &amp;amp; computation of modulus-squared coefficients, and averages over multiple sub-windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– If you have to remove outliers, probably the best thing to do is to replace these values with the average of the surrounding data points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– Whether to detrend the data depends on whether you consider that trend to be an artefact, or as a property of the interesting signal itself. Spectral estimation works either way, you will only get a stronger signal component at low frequencies if you do not detrend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;– If you have reason to believe that your signal is not &lt;a href=&quot;http://en.wikipedia.org/wiki/Stationary_process&quot; rel=&quot;nofollow&quot;&gt;stationary&lt;/a&gt; (has a frequency composition that changes over time), computing spectra on sequential windows is a reasonable approach. If this is done systematically, the result is called a spectrogram, as is the corresponding &lt;a href=&quot;https://www.mathworks.com/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow&quot;&gt;Matlab function&lt;/a&gt;. Whether it makes sense to assume instationarity is something you have to decide based on your background knowledge of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="5834" LastActivityDate="2015-06-07T02:21:18.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23941" PostTypeId="1" CreationDate="2015-06-07T10:31:17.940" Score="2" ViewCount="628" Body="&lt;p&gt;I want to use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Pyramid_(image_processing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laplacian pyramid&lt;/a&gt; framework for representing images. The &lt;a href=&quot;https://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0CCAQFjAA&amp;amp;url=http%3A%2F%2Fpersci.mit.edu%2Fpub_pdfs%2Fpyramid83.pdf&amp;amp;ei=sBt0VZy6OaS-mgXi6YH4Bw&amp;amp;usg=AFQjCNE8v1RgJKnSCaQPoWhLiXG6vPzalw&amp;amp;sig2=Kf1J5Y-ZxZYbwCuNr_p7ZA&amp;amp;bvm=bv.95039771,d.dGY&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Laplacian Pyramid as a Compact Image Code's&lt;/a&gt; language seems to provide freedom in the choice of blurring/interpolation kernel, subject to certain constraints. However, as we are performing subsampling when constructing pyramids, would aliasing be a problem with an injudicious choice?&lt;/p&gt;&#xA;&lt;p&gt;I read in the &lt;a href=&quot;http://www.cs.toronto.edu/%7Ejepson/csc320/notes/pyramids.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toronto lecture notes on image pyramids&lt;/a&gt; (Slide 8) that a laplacian pyramid can reconstruct an image exactly, agnostic of the kernel. Can i take this to be a guarantee against aliasing, or can aliasing be &amp;quot;hidden&amp;quot; by the reconstruction process?&lt;/p&gt;&#xA;" OwnerUserId="16123" LastEditorUserId="7092" LastEditDate="2022-05-08T13:41:12.833" LastActivityDate="2022-05-08T13:41:12.833" Title="Can Aliasing Happen in Laplacian Pyramids?" Tags="|image-processing|aliasing|multi-scale-analysis|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="23943" PostTypeId="2" ParentId="23941" CreationDate="2015-06-07T12:23:36.063" Score="3" Body="&lt;p&gt;The reconstruction will remove aliasing, no matter which filter kernel is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The lower layer of the 2-layer Laplacian pyramid on page 8 of the &lt;a href=&quot;http://www.cs.toronto.edu/~jepson/csc320/notes/pyramids.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toronto lecture notes&lt;/a&gt;, adapted here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kLZGp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kLZGp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;em&gt;Figure 1. A 2-layer Laplacian pyramid.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be redrawn as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QsMA0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QsMA0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;br&gt;&lt;em&gt;Figure 2. An alternative presentation of the lower layer of the Laplacian pyramid of fig. 1.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This layer is an identity operation: what is subtracted is also added. This allows to draw the next (and in this case the only) layer above it the same way and it also can be identified to be an identity operation. And so on until the whole process becomes an identity operation.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2019-01-01T21:46:52.377" LastActivityDate="2019-01-01T21:46:52.377" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="23944" PostTypeId="1" AcceptedAnswerId="23945" CreationDate="2015-06-07T13:24:45.923" Score="1" ViewCount="1346" Body="&lt;p&gt;I have two signals with nearly the same frequency, and i would like to find the phase shift between them, since i am using micro-controller, i would like to do it in the less expensive way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to calculate Goertzel for a specific frequency bin (for each signal), but how do i calculate the angle for this bin by using Goertzel? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know a lower computational method, please advice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="9059" LastActivityDate="2017-12-15T07:57:20.160" Title="Using Goertzel to find phase shift" Tags="|algorithms|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23945" PostTypeId="2" ParentId="23944" CreationDate="2015-06-07T14:01:42.197" Score="3" Body="&lt;p&gt;If the complex frequency bin outputs of the two Goertzel filters are $a$ and $b$, you can calculate the phases as $\alpha = \text{atan2}\left(\text{Im}(a),\ \text{Re}(a)\right)$ and $\beta = \text{atan2}\left(\text{Im}(b),\ \text{Re}(b)\right)$, where $\text{Re}$ returns the real component and $\text{Im}$ returns the imaginary component of the argument. Most programming languages will have the two-argument $\text{atan2}$ function. The phase difference can be calculated as $\alpha - \beta = \text{atan2}\left(\text{Im}\left(a\ \text{conj}(b)\right),\ \text{Re}\left(a\ \text{conj}(b)\right)\right)$, where $\text{conj}$ denotes taking the complex conjugate, saving you one $\text{atan2}$ evaluation and wrapping of the phase, at the cost of one complex multiplication. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's one more trick available to calculate $a\ \text{conj}(b)$. Multiply the Goertzel output $a$ by the second input signal and lowpass filter the result. In frequency domain it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9MMH7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The lowpass filtering isolates the circled spectral peak that corresponds to $a\ \text{conj}(b)$. This saves you one Goertzel filter at the cost of a lowpass filter. If you use this trick you must also take into account the phase shift due to the lowpass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fast $\text{atan2}$ see &lt;a href=&quot;https://dsp.stackexchange.com/q/28814/15347&quot;&gt;Methods of computing fixed point atan2 on FPGA&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2017-12-15T07:57:20.160" LastActivityDate="2017-12-15T07:57:20.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23946" PostTypeId="2" ParentId="23944" CreationDate="2015-06-07T16:25:44.367" Score="0" Body="&lt;p&gt;Following is just a lazy copy-paste from my own code in case that you're stuck at the implementation for real/imag extraction of the goertzel filter. Otherwise, go look at Olli's answer.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;template&amp;lt;typename Scalar, class Vector&amp;gt;&#xA;static std::complex&amp;lt;Scalar&amp;gt; goertzel(const Vector &amp;amp; data, std::size_t size, Scalar omega)&#xA;{&#xA;    Scalar sine, cosine, coeff, q0(0), q1(0), q2(0);&#xA;&#xA;    sine = sin(omega);&#xA;    cosine = cos(omega);&#xA;    coeff = 2.0 * cosine;&#xA;&#xA;    for (Types::fint_t t = 0; t &amp;lt; size; t++)&#xA;    {&#xA;        q0 = coeff * q1 - q2 + data[t];&#xA;        q2 = q1;&#xA;        q1 = q0;&#xA;    }&#xA;&#xA;    Scalar real = (q1 - q2 * cosine);&#xA;    Scalar imag = (q2 * sine);&#xA;&#xA;    return std::complex&amp;lt;Scalar&amp;gt;(real, imag);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    angle = std::arg(complex_number); // which is equivalent to atan2(imag, real);&#xA;    magnitude = std::abs(complex_number); // again, same as sqrt(imag^2 + real^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2015-06-07T16:25:44.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23947" PostTypeId="2" ParentId="17925" CreationDate="2015-06-07T16:58:49.447" Score="2" Body="&lt;p&gt;The observed phenomenon is simply due to the fact that when you set window length to 100 it is as if you were doing fft with 100 samples instead of 1000. So Nw=100 similar to NFFT = 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And why does FFT size affect results (level of noise VS level of tone)? Good question&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two types of spectral densities:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) PWELCH-like PSD: &quot;PSDW&quot;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A tone grows in dB as FFT size increases. As in a true PSD the tone is a Dirac's delta for NFFT-&gt;inf. Larger NFFT means smaller dF, and larger A, in such a way that A * dF = constant&lt;/li&gt;&#xA;&lt;li&gt;A unit power noise stays at 0dB. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is really a [Watt/Hz] spectral density and total power given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;totalPower = trapz(F,PSDW)  =  trapz(fs * F,PSDW/fs)  = sum(PSDW)/NFFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) OSCILLOSCOPE-like PSD: &quot;PSDO&quot;, PSDO = PSDW/NFFT &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A tone remains the same dB as FFT size increases&lt;/li&gt;&#xA;&lt;li&gt;A unit power noise becomes less dBs as NFFT increases.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is a [Watt/Hz/NFFT] measure, with power:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;totalPower = NFFT * trapz(F,PSDO) =  NFFT*trapz(fs * F,PSDO/fs)  = sum(PSDO)&lt;/p&gt;&#xA;" OwnerUserId="8043" LastEditorUserId="8043" LastEditDate="2015-06-07T17:03:54.287" LastActivityDate="2015-06-07T17:03:54.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23948" PostTypeId="2" ParentId="23888" CreationDate="2015-06-07T17:35:30.203" Score="0" Body="&lt;p&gt;Well, actually it was a very silly mistake...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r = n2*cos(T(i)*pi/180) + n1*sin(T(i)*pi/180);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;must be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r = (n2-1)*cos(T(i)*pi/180) + (n1-1)*sin(T(i)*pi/180); thanks to this weird &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MATLAB indexing...&lt;/p&gt;&#xA;" OwnerUserId="14901" LastEditorUserId="8202" LastEditDate="2015-06-07T23:09:34.340" LastActivityDate="2015-06-07T23:09:34.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23949" PostTypeId="2" ParentId="23933" CreationDate="2015-06-07T18:46:06.190" Score="1" Body="&lt;p&gt;The Viterbi algorithm for optimum detection in the presence of intersymbol interference (ISI) is always preceded by a whitened matched filter (cf. &lt;a href=&quot;http://www2.nau.edu/~sh295/CommsTopics/Projects/ForneyMLSEIT70.pdf&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt; by G.D. Forney). So if you use - as mentioned in a comment - the equivalent discrete-time channel, which then also includes the whitened matched filter (WMF), then, due to the properties of the WMF, this model must always be &lt;em&gt;causal and minimum-phase&lt;/em&gt;. So, regardless of the actual impulse response of the channel, the complete equivalent discrete-time model (including the WMF) can never be non-causal or non-minimum-phase if implemented correctly.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-07T18:46:06.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23953" PostTypeId="1" CreationDate="2015-06-07T23:47:57.783" Score="3" ViewCount="1235" Body="&lt;p&gt;This is the function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(n) = &#xA;\begin{cases}&#xA;1, &amp;amp; \text{-N  $\leq$ n $\leq$ N ;}\\&#xA;0, &amp;amp; \text{otherwise.}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I tried to solve it, using sigma notation or summation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\ r_{xx}(l) = \displaystyle\sum_{n=-\infty}^{\infty} x(n)x(n-l) \end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get 2N-1 but that is wrong. Because when I do the autocorrelation in MATLAB I get something like:&#xA;For exmple if N = 2, the discrete function rxx(l) would be like:&lt;img src=&quot;https://i.stack.imgur.com/DH5dI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is something like rxx(l) = 2N-1+|l|&#xA;But I don't know how to get there... Can you help me?&lt;/p&gt;&#xA;" OwnerUserId="16142" LastActivityDate="2015-06-08T12:00:40.647" Title="How to get the autocorrelation of this finite discrete function?" Tags="|autocorrelation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23956" PostTypeId="1" CreationDate="2015-06-08T02:28:44.393" Score="3" ViewCount="238" Body="&lt;p&gt;According to &lt;a href=&quot;https://answers.yahoo.com/question/index?qid=20060914124533AAx79Wn&quot; rel=&quot;nofollow&quot;&gt;Dr. Math&lt;/a&gt; the Z-transform can create closed-form solutions for 1D series defined by difference equations (e.g. the Fibonacci series).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My 3D surface $z=LC(x,y)$ is defined by difference equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;t_0 &amp;amp;=&amp;amp; N^2 \\&#xA;t_1 &amp;amp;=&amp;amp;(N-y)^2 \\&#xA;t_i &amp;amp;=&amp;amp;2*t_{i-1}-t_{i-2}+2y^2&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in preserving the absolute minima of this surface iff it lies on an integer boundary.  My first question is: how do I modify the closed-form solution for a 2D signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second question is: should I expect the closed-form solution to be different from the original formula? { The original formula is $t=(N-xy)^2$ }&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;POSTSCRIPT&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The difference equations come from the relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;(1) &amp;amp; (N - (i+2)*y)^2 - (N-iy)^2 &amp;amp;=&amp;amp; -4Ny - 4y^2i - 4y^2\\&#xA;(2) &amp;amp; (N - (i+1)*y)^2 - (N-iy)^2 &amp;amp;=&amp;amp; -2Ny - 2y^2i - y^2\\&#xA;(1)-(2) &amp;amp; t(i+2)-t(i) &amp;amp;=&amp;amp; \hspace{1em}2 ( t(i+1) - t(i) ) - 2y^2&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function has an absolute minima at zero in t.  When N=UV, it is the same absolute minima that occurs for the difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;(1) &amp;amp; (N - (x+2U)*y)^2 - (N-xy)^2 &amp;amp; = &amp;amp; -4UNy - 4xUy^2 - 4(Uy)^2\\&#xA;(2) &amp;amp; (N - (x+U)*y)^2 - (N-xy)^2 &amp;amp; = &amp;amp; -2UNy - 2xUy^2 - (Uy)^2\\&#xA;(1),(2) &amp;amp; t_{i+2}-t_i &amp;amp; = &amp;amp; \hspace{1em} 2 ( t_{i+1} - t_i ) - 2U^2y^2&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The initial conditions and the value of U are critical to the problem definition. My feeling is that even though the inverse z-transform is &lt;a href=&quot;http://mathworld.wolfram.com/Z-Transform.html&quot; rel=&quot;nofollow&quot;&gt;not unique&lt;/a&gt;, the set of inverse transforms will not converge at x=U, y=V, t=0 without prior knowledge of U.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;z-transform&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;So, if I understand the process, the generalized z-transform for t along the x axis is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;Z[ - 2(Uy)^2 ] &amp;amp; = &amp;amp; Z[ t_{i+2} - 2 t_{i+1} + t_{i} ]  \\&#xA;\frac{-2(Uy)^2z}{z-1}&amp;amp;=&amp;amp; z^2(T_z - t(0) -t(U)/z) - 2z(T_z - t(0)) + T_z  \\&#xA;\frac{-2(Uy)^2z}{z-1}&amp;amp;=&amp;amp; T_z(z^2 - 2z + 1) -z^2t(0)-z(t(U)-2t(0))  \\&#xA;-2(Uy)^2z&amp;amp;=&amp;amp; T_z(z- 1)^3 -z^3t(0)-z^2(t(U)-3t(0))-z(t(U)-2t(0))  \\&#xA;-2(Uy)^2z&amp;amp;=&amp;amp; T_z(z- 1)^3 -z^3N^2-z^2((N-Uy)^2-3N^2)-z((N-Uy)^2-2N^2)  \\&#xA;T_z(z- 1)^3 &amp;amp; = &amp;amp; z^3N^2+z^2((N-Uy)^2-3N^2)-z((N-Uy)^2-2N^2-2(Uy)^2)   \\&#xA;T_z(z- 1)^3 &amp;amp; = &amp;amp;z^3 N^2 - z^2(2N^2+2NUy-(Uy)^2) + z((Uy)^2+2NUy+N^2 )\\[2em]&#xA;\frac{T_z}{z} &amp;amp; = &amp;amp;\frac{z^2 N^2 - z(2N^2+2NUy-(Uy)^2) + ((Uy)^2+2NUy+N^2 )}{(z- 1)^3}\\&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\frac{z^2 - z(2+2y/V-(y/V)^2) + ((y/V)^2+2y/V+1 )}{(z- 1)^3}\\&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\frac{z^2 -2z +1 - z(2y/V-(y/V)^2) + ((y/V)^2 + 2y/V )}{(z- 1)^3}\\&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\frac{z^2 -2z +1 - (z-1)(2y/V) + (z-1)(y/V)^2 + 2(y/V)^2}{(z- 1)^3}\\&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\left(\frac{1}{z- 1}-\frac{2y/V-(y/V)^2}{(z- 1)^2}+\frac{2(y/V)^2}{(z- 1)^3}\right)\\&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\left(\frac{1}{z- 1}-\frac{2y/V}{(z- 1)^2}+\frac{(y/V)^2*(z-1)+2(y/V)^2}{(z- 1)^3}\right)\\&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\left(\frac{1}{z- 1}-\frac{2y/V}{(z- 1)^2}+\frac{(y/V)^2z+(y/V)^2}{(z- 1)^3}\right)\\&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\left(\frac{1}{z- 1}-\frac{2y/V}{(z- 1)^2}+\frac{(y/V)^2(z+1)}{(z- 1)^3}\right)&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;normalization along y&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The final form of the z-transform is dependent on the ratio $\Upsilon$ of $y$ to $V$, which we know will vary from $0$ to $1$.  Along the cross-section when $y=V, \Upsilon=1$, the trivial case occurs with a sequence $N^2, 0, N^2, 4N^2, ...$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\left(\frac{1}{z- 1}-\frac{2y/V-(y/V)^2}{(z- 1)^2}+\frac{2(y/V)^2}{(z- 1)^3}\right)\\&#xA;\frac{T_z}{z} &amp;amp; = N^2&amp;amp;\left(\frac{1}{z- 1}-\frac{2\Upsilon-\Upsilon^2}{(z- 1)^2}+\frac{2\Upsilon^2}{(z- 1)^3}\right)\\&#xA;\left.\frac{T_z}{z}\right\rvert_{\Upsilon=1} &amp;amp; = N^2&amp;amp;\left(\frac{1}{z- 1}-\frac{1}{(z- 1)^2}+\frac{2}{(z- 1)^3}\right)&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;inverse z-transform&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;A unique time-domain function can be obtained using lookup tables and numerical methods such as those found at Wolfram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;t_i &amp;amp; = N^2(i\Upsilon - 1)^2&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step is to use Direct Inversion to calculate the inverse transform.  This method involves calculating a closed integral as defined by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$t=\frac{1}{2{\pi}j}\oint_H Tz^{x-1} \,dz$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $t$ to be unique, $H$ must encircle all poles and zeros (aka ROC), however here it is desired to investigate what happens when $H$ is smaller than the ROC. Specifically, we desire to find a contour $H$ so that the inverse transform is equivalent to spline interpolation of our point cloud.&lt;/p&gt;&#xA;" OwnerUserId="16141" LastEditorUserId="16141" LastEditDate="2015-06-12T22:49:33.907" LastActivityDate="2018-05-29T13:51:20.323" Title="Can the Z-Transform be used to create smoothed 3D surfaces from point clouds?" Tags="|z-transform|point-cloud|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23957" PostTypeId="1" AcceptedAnswerId="23970" CreationDate="2015-06-08T03:06:34.210" Score="1" ViewCount="61" Body="&lt;p&gt;I have been studying a book which describes how to write the waveform of  sequence that has certain chip rate $T_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sequence with chip rate $T_c$ is for example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X=[-1 -1 +1 +1 +1 +1 +1 +1 +1 -1 +1 -1 -1 +1 +1 -1 -1 -1 +1 +1 -1 -1 -1 -1 +1 -1 +1 -1 +1 -1 -1 +1&#xA;+1 +1 -1 -1 -1 -1 -1 -1 -1 +1 -1 +1 +1 -1 -1 +1 -1 -1 +1 +1 -1 -1 -1 -1 +1 -1 +1 -1 +1 -1 -1 +1&#xA;+1 +1 -1 -1 -1 -1 -1 -1 -1 +1 -1 +1 +1 -1 -1 +1 +1 +1 -1 -1 +1 +1 +1 +1 -1 +1 -1 +1 -1 +1 +1 -1&#xA;+1 +1 -1 -1 -1 -1 -1 -1 -1 +1 -1 +1 +1 -1 -1 +1 -1 -1 +1 +1 -1 -1 -1 -1 +1 -1 +1 -1 +1 -1 -1 +1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets assume that $X$ is of length 128. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the book explains that the waveform can be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$r(nT_c)= X(n ) \underbrace{\exp( (j\pi \frac{n}{2})}_{???}\hspace{1cm} n=0,1,\cdots,127$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The chip rate $Tc=0.57 ns$...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand is the part I have ??? under...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best Regards. &lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="15590" LastEditDate="2015-06-08T14:32:04.440" LastActivityDate="2015-06-08T14:32:04.440" Title="How to write time waveform of transmitted sequence with certain chip rate?" Tags="|digital-communications|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23959" PostTypeId="1" AcceptedAnswerId="24186" CreationDate="2015-06-08T05:04:11.723" Score="2" ViewCount="720" Body="&lt;p&gt;I'm doing research on block noise caused by video compression (especially in newer codecs) and I've read the IEEE article about the HEVC deblocking filter (&lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=6324414&quot; rel=&quot;nofollow&quot; title=&quot;HEVC Deblocking Filter&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when reading the algorithm I'm confused because the formula seems wrong. The first formula to determine if the deblocking filter will affect a block is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ |p_2,_0 - 2p_1,_0+p_0,_0|+|p_2,_3 - 2p_1,_3+p_0,_3|+|q_2,_0 - 2q_1,_0+q_0,_0|+|q_2,_3 - 2q_1,_3+q_0,_3|&amp;gt;\beta \ (1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also written (and shown in a figure) that $\beta $ increases with the quantification parameter QP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, later it is written that to choose between normal and strong deblocking, the following equation is used (with $i$ going from $0$ to $3$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ |p_2,_i - 2p_1,_i+p_0,_i|+|q_2,_i - 2q_1,_i+q_0,_i|&amp;lt;\beta/8 \ (2) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since IEEE is a respectable source and the paper is a couple years old, it would surprise me that there is a typo. However, I do not understand how this formula can work. It does seem to me that the second inequation would always be wrong at least for some $i$ if the first one is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I misunderstanding how the filter works or is it a typo in the paper?&lt;/p&gt;&#xA;" OwnerUserId="16145" LastActivityDate="2015-07-15T06:34:35.823" Title="HEVC Deblocking filter algorithm" Tags="|video-processing|video-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23960" PostTypeId="2" ParentId="23953" CreationDate="2015-06-08T05:29:41.750" Score="3" Body="&lt;p&gt;Calculating the autocorrelation of this function is relatively easy. You just need to follow the formula you have written:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\ r_{xx}(l) = \displaystyle\sum_{n=-\infty}^{\infty} x(n)x(n-l) \end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It gets much easier because your function is $\neq0$ for only a few values ($2N+1$ exactly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of this the previous sum can be replaced with this much simpler one: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\ r_{xx}(l) = \displaystyle\sum_{n=-N}^{N} x(n-l) \end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is basically just counting how many times $x(n-l)$ is not zero on that finite interval. Because of this it appears easily that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;r_{xx}(l)=max(2N-1-|l|,0)  \end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You almost had it in your question but the sign was wrong.&lt;/p&gt;&#xA;" OwnerUserId="16145" LastEditorUserId="90" LastEditDate="2015-06-08T12:00:40.647" LastActivityDate="2015-06-08T12:00:40.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23961" PostTypeId="2" ParentId="19485" CreationDate="2015-06-08T06:58:49.710" Score="0" Body="&lt;p&gt;Get Adobe Audition. In the spectrogram mode, find the noise you want to remove. Copy unwanted-noise-free blocks from similar areas (copy, paste, undo, mute, mix-paste) and adjust the volume of some areas by a few decibels to make it look smooth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/qGfLD.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-06-08T07:28:11.617" LastActivityDate="2015-06-08T07:28:11.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23962" PostTypeId="1" AcceptedAnswerId="23965" CreationDate="2015-06-08T07:59:20.130" Score="1" ViewCount="1934" Body="&lt;p&gt;While simulating a MISO system, I am trying to consider the effect of varying the distance between the transmitter and receiver on the BER.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My search for the effect of varying distance has pointed me to Log Distance Path Loss. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My query is where should I include this path loss during the Matlab implementation. Should the received signal be convoluted with the path loss?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am completely clueless as to how this can be included. Any resources or pointers to theory would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-06-08T14:42:37.813" Title="Log Distance Path Loss Model" Tags="|signal-analysis|dsp-core|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23964" PostTypeId="1" AcceptedAnswerId="23977" CreationDate="2015-06-08T09:13:36.543" Score="0" ViewCount="35" Body="&lt;p&gt;Consider that I have simulated a communication system at baseband and would implement the same on hardware but using a carrier at 2.4GHz(Passband conversion). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it make sense to compare the simulated results at baseband and the results from the experiment at passband? Or should the simulation also be performed at Passband frequency and then compare the experimental results with the simulated results at Passband?&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-06-08T14:06:17.957" Title="Comparison of Baseband simulation results and experimental results at Passband" Tags="|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23965" PostTypeId="2" ParentId="23962" CreationDate="2015-06-08T10:13:36.737" Score="1" Body="&lt;p&gt;There are direct and indirect effects of distance to the Bit Error Rate (BER) between two transceivers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The direct effect that distance has on the BER is through the attenuation of the signal. As the transmitter get's further away from the receiver, the power of the received signal is diminished which makes the Signal to Noise Ratio lower which makes signal reception more difficult and the likelihood for a misinterpreted symbol higher. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the simplest case with the transceivers operating in free space where theoretically there are no other objects or sources of &quot;noise&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The indirect effect of distance on the BER in a realistic environment (i.e. one containing surfaces that the signal can bounce off, such as buildings) is the introduction of multipath propagation. This means that multiple copies of the same signal arrive at the receiver at slightly different times having followed slightly different paths. Depending on the frequency of the signals, these slight delays may lead to destructive interference. In other words, two versions of the same signal cancel out each other. This condition leads, again, to a decrease in the SNR and signal distortions which leads to a higher probability for errors in symbol reception. A similar (indirect) effect is introduced due to the Doppler shift of the frequencies if the velocity of movement of the transmitter is comparable to the wavelength of the used frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are multiple ways by which you can include these effects to a simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When simulating the full transceiver stack, i.e. Source, encoder, modulator, channel, demodulator, decoder, Target then Free Space Loss can be applied at the output of the modulator (as part of the &quot;channel&quot; building block) as an attenuation of the produced signal given a distance L.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multipath propagation can also be applied at the &quot;channel&quot; stage, either by convolving the modulator's output with a suitable impulse response or by generating an &quot;envelope&quot; signal from a Rayleigh distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, please see &lt;a href=&quot;http://en.wikipedia.org/wiki/Free-space_path_loss&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Rayleigh_fading&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; (&lt;a href=&quot;http://en.wikipedia.org/wiki/Multipath_propagation&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;) and &lt;a href=&quot;http://www.ni.com/white-paper/14909/en/&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; link.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-06-08T10:13:36.737" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23966" PostTypeId="1" CreationDate="2015-06-08T11:22:05.283" Score="2" ViewCount="36" Body="&lt;p&gt;I have a sequence which is made of complex exponentials with arbitrary amplitudes and initial phases.  No noise.  That is it is a sum of the complex exponentials of the form $A_i e^{jnw_i+p_i}$.  For example, let us say i ranges from 1 to 10.  What is the minimum necessary data (number of samples) to calculate their amplitudes, initial phases and frequencies exactly i.e. $A$, $w$ and $p$ s?  And how can we find them? $j$ here is square root of -1 and $n$ is the sample number.  &lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="15664" LastEditDate="2015-06-08T11:49:22.223" LastActivityDate="2015-06-08T11:49:22.223" Title="I have a sequence which is made of complex exponentials with arbitrary amplitudes and initial phases. No noise" Tags="|frequency-spectrum|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23967" PostTypeId="1" CreationDate="2015-06-08T11:45:28.407" Score="0" ViewCount="90" Body="&lt;p&gt;I'm doing a simple mini project on FPGA board, electronic lock which open when a short track (the &quot;password&quot;) is play next to the lock's mic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i want to save samples of the chosen song to an array x[n]&#xA;and and then take samples from the mic and save them to a FIFO list y[n].&#xA;then compare the the conv result z[n]=x[n]*y[n] and when it is big enough the lock is open.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the question is how many samples i need for 3-4 sec of rock song for this purpose?&lt;/p&gt;&#xA;" OwnerUserId="16151" LastActivityDate="2015-11-05T17:28:07.920" Title="what sampling rate and bit depth should i use?" Tags="|sampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23968" PostTypeId="2" ParentId="23967" CreationDate="2015-06-08T12:02:08.697" Score="1" Body="&lt;p&gt;The typical audio sampling rate is 44 kHz, so you would need between 130 000 and 175 000 samples.&#xA;In practice though, it depends on the sampling rate you use on your FPGA. You can lower, but you will need to low-pass your signal before sampling it to avoid aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you put a threshold on z[n]=x[n]*y[n], it will not be invariant to volume differences. &lt;/p&gt;&#xA;" OwnerUserId="15001" LastActivityDate="2015-06-08T12:02:08.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23969" PostTypeId="1" CreationDate="2015-06-08T12:02:37.817" Score="0" ViewCount="51" Body="&lt;p&gt;I have a signal with bandwidth between 0-2KHz.&#xA;If i would like to know the signal's frequency spectrum energy, then I use Parseval's theorem and calculate it over time.&#xA;Now it's my question:&#xA;What if I would like to know only part of the spectrum energy, let's say 1.5Khz-2Khz, Is there a low cost way to do it, instead of FFT the signal and then sum the relevant frequency band?&lt;/p&gt;&#xA;" OwnerUserId="9059" LastActivityDate="2015-06-08T12:02:37.817" Title="signal's spectrum energy" Tags="|algorithms|power-spectral-density|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23970" PostTypeId="2" ParentId="23957" CreationDate="2015-06-08T12:09:52.407" Score="1" Body="&lt;p&gt;While a reference to where you got this from would be helpful, I have a theory on where the term in question comes from. Note its form for increasing $n$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\exp\left({j\frac{\pi n}{2}}\right) = [1, j, -1, -j, 1, j, -1, -j, \ldots ], \ n = [0, 1, 2, 3, 4, 5, 6, 7, \ldots]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a discrete-time complex sinusoid whose frequency is one-fourth of the sample rate. In digital communications signal processing, this is a very common &lt;a href=&quot;http://en.wikipedia.org/wiki/Intermediate_frequency&quot; rel=&quot;nofollow&quot;&gt;intermediate frequency&lt;/a&gt; selection when using real-valued sampling. It is often chosen because the center of the desired passband lies in the center of the single independent sideband that you get when using real samples. Shifting the resulting signal to &lt;a href=&quot;http://en.wikipedia.org/wiki/Baseband#Equivalent_baseband_signal&quot; rel=&quot;nofollow&quot;&gt;complex baseband&lt;/a&gt; is often a subsequent processing step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the equation that you gave may express that you have a chip sequence that is modulated onto a complex-valued carrier at one-fourth of the sample rate. Since you don't indicate what the values of the signal are at time instants other than $nT_c$, it's hard to say whether this is actually the case.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2015-06-08T13:43:14.263" LastActivityDate="2015-06-08T13:43:14.263" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23971" PostTypeId="1" AcceptedAnswerId="26471" CreationDate="2015-06-08T12:25:10.423" Score="0" ViewCount="418" Body="&lt;p&gt;First of, I'm new to signal processing. I have a signal which is a linear composition of several basis signals, whereas the same basis signal can occur several times, that is translated, but not scaled. These basis signals look very similar to wavelets. I'm thinking of using a continuous wavelet transform to get the decomposition of the signal with respect the basis signals. However, I assume that a set of basis signals needs to fulfill certain properties to be considered a wavelet family. Could you please point out to me what these may be?&lt;/p&gt;&#xA;" OwnerUserId="16072" LastActivityDate="2016-04-14T08:21:06.823" Title="Properties of a custom wavelet family for continuous wavelet transform" Tags="|wavelet|continuous-signals|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="23972" PostTypeId="1" CreationDate="2015-06-08T12:36:16.390" Score="1" ViewCount="653" Body="&lt;p&gt;why does it describe the transfer function.. How come? Especially for LTI systems. &#xA;I thinking about the theory about how come an impulse input can provide information about a complete system.. As it doesn't operate fully of all configuration. &lt;/p&gt;&#xA;" OwnerUserId="15908" LastEditorUserId="15908" LastEditDate="2015-06-09T13:00:20.313" LastActivityDate="2015-06-09T13:00:20.313" Title="Why does the impulse response determine the transfer function of a system?" Tags="|infinite-impulse-response|transfer-function|finite-impulse-response|control-systems|" AnswerCount="1" CommentCount="3" ClosedDate="2015-06-09T01:43:54.937" ContentLicense="CC BY-SA 3.0" />
  <row Id="23973" PostTypeId="1" CreationDate="2015-06-08T13:03:08.433" Score="0" ViewCount="491" Body="&lt;p&gt;In my problem the signals $x(t), h(t), w(t), y(t)$ and $y_w(t)$  are defined as follows: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;x(t)&amp;amp;=\sum_{i=1}^M a_i\delta(t-\tau_i) \\&#xA;h(t)&amp;amp;=e^t\exp\left(-e^t\right) \\&#xA;w(t)&amp;amp;=\begin{cases} 1, &amp;amp; \text{when}\quad |t|\le\frac{\tau_0}{2}\\&#xA;0, \quad &amp;amp;\text{elsewhere} \end{cases}\\&#xA;y(t)&amp;amp;=x(t)*h(t) \\&#xA;y_w(t)&amp;amp;=y(t)w(t)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can any one recommend me a way how to get the $x(t)$ for only measuring $y_w(t)$ and knowing the $\tau_0$ by using the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hints:&#xA;\begin{align}&#xA;X(\omega)&amp;amp;=\sum_{i=1}^M a_ie^{j\tau_i\omega}\\&#xA;H(\omega)&amp;amp;=\Gamma\left(1-j\omega\right)\\&#xA;W(\omega)&amp;amp;=\tau_0\textrm{sinc}\left(\frac{\tau_0\omega}{2\pi}\right)&#xA;\end{align}&lt;/p&gt;&#xA;" OwnerUserId="16152" LastEditorUserId="19249" LastEditDate="2017-01-31T06:03:10.373" LastActivityDate="2020-08-14T07:03:50.320" Title="Filtering of complex exponential functions" Tags="|frequency-spectrum|homework|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23975" PostTypeId="2" ParentId="23972" CreationDate="2015-06-08T13:13:28.830" Score="3" Body="&lt;p&gt;Because every signal can be decomposed into a linear series of scaled impulses that are shifted in time. Thus applying a &lt;strong&gt;linear time-invariant&lt;/strong&gt; system on each impulse in the series and then summing the results again will give the same result as applying it on the whole signal. Therefore, one only needs to know how the system responds to an impulse to be able to calculate its response to an arbitrary signal and all properties of the system.&#xA;This &lt;a href=&quot;http://www.dspguide.com/ch6/3.htm&quot; rel=&quot;nofollow&quot;&gt;DSP guide chapter&lt;/a&gt; has some nice illustrations on the subject.&#xA;This &lt;a href=&quot;http://www.dspguide.com/CH33.PDF&quot; rel=&quot;nofollow&quot;&gt;DSP guide chapter (only in PDF)&lt;/a&gt; shows how from the impulse response as written in the form of a difference equation the transfer function can be derived using the z-transform. For FIR filters the $b_i$ coefficients will be zero in equation 33-2.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastEditorUserId="11256" LastEditDate="2015-06-08T13:47:27.000" LastActivityDate="2015-06-08T13:47:27.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23977" PostTypeId="2" ParentId="23964" CreationDate="2015-06-08T14:06:17.957" Score="1" Body="&lt;p&gt;Most of the time there is no good reason to simulate at passband, as long as you simulate the signal's and the channel's low-pass representation. Furthermore, assuming that you're using a modern radio such as an SDR, most of the hardware is operating at baseband anyway -- frequency up- and down-conversion are performed as close to the antenna as is feasible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, be aware that, most likely, your simulation and experimental results will be hard to compare directly. For example, it is hard to find exactly what the SNR at the receiver is; you'll have to estimate it. Also, it's hard to determine the exact channel parameters. Other factors are non-linearities in the power amplifiers, synchronization imperfections, etcetera.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-08T14:06:17.957" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23978" PostTypeId="2" ParentId="23962" CreationDate="2015-06-08T14:42:37.813" Score="2" Body="&lt;p&gt;The log-distance path loss model is a simplified model that tries to model fluctuations in the received signal power. It is generally used in dense urban environments (i.e. a city center or suburbs) or inside a building (where transmitter and receiver are not in the same room). It also assumes large distances (much more than tens of feet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this model, the path loss is divided in three separate processes. First, you have the free-space loss, due to the distance between antennas, and which changes with the square of the distance. Then, you have a path loss due to the environment, which changes with a different exponent (not square). The exponent depends on the kind of materials the signal has to travel through. Generally, this exponent is calculated empirically for each propagation environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These firt two losses are deterministic. The third loss process is random. In an urban environment, you'll have shadowing, which is caused by the receiver antenna moving behind buildings or trees. The logarithm of this loss is Gaussian distributed. You will also have signal attenuation due to fading caused by multipath; assuming flat, slow fading, this will follow a Rayleigh distribution. You can find the equation in wikipedia (&lt;a href=&quot;https://en.wikipedia.org/wiki/Log-distance_path_loss_model&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Log-distance_path_loss_model&lt;/a&gt;). This model is also very well explained in &quot;Wireless Communications&quot; by Andrea Goldsmith, in chapter 3 if I remember correctly. The book provides many examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding how to implement this model in Matlab: the model allows you to calculate an overall path loss $PL_{dB}$. If your transmit power is $T_{dB}$, then the received power is $R_{dB}=T_{dB}-PL_{dB}$. In general, $PL_{dB}$ is random; you would generate appropriate random numbers in Matlab and change the received signal's power to account for the loss.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said all this, if you're running your experiments in a lab, I don't think this model is appropriate. What I would do is to try to set up a fixed environment (no people or objects moving around when you're doing the experiment). If your signal is narrowband, the loss will be a single number that you can determine empirically. This number is random but does not change with time, as would be the case in a dynamic environment.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-08T14:42:37.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23979" PostTypeId="2" ParentId="23973" CreationDate="2015-06-08T15:11:23.673" Score="1" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the given $X(\omega)$ is the Fourier transform of $x(t)$, what does $x(t)$ look like? It will turn out that removing exponential terms with certain values $\tau_i$ is equivalent to suppressing certain time intervals in the time domain.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-08T15:11:23.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23980" PostTypeId="1" AcceptedAnswerId="23982" CreationDate="2015-06-08T15:22:14.623" Score="0" ViewCount="623" Body="&lt;p&gt;I am attempting to implement a cascaded IIR filter in MATLAB.  I used fdatool to design the filter and exported it as an object, Hd.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my script, I import a log file of data I captured and store my data in a vector called serial.  I then use MATLAB's filter(Hd,serial) to filter it and plot the results.  The filter works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to check and improve my understanding of how to implement this filter in real life (before I attempt to embed it using C) I want to filter my data using my own code and compare the results with those obtained using MATLAB's filter function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Hd object consists of the following parameters:&#xA;SOSMatrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.25, 0.5, 0.25, 1, -1.9513, 0.95189&#xA;0.25, 0.5, 0.25, 1, -1.9584, 0.95907&#xA;0.25, 0.5, 0.25, 1, -1.9718, 0.97246&#xA;0.25, 0.5, 0.25, 1, -1.9896, 0.99024&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Scale Values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.4055e13&#xA;1&#xA;1&#xA;1&#xA;1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to implement my filter I have stored each line of my SOS matrix under the following titles:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    Section1 = [0.25 0.5 0.25 1 -1.9513 0.95189]&#xA;    Section2 = [0.25 0.5 0.25 1 -1.9584 0.95907]&#xA;    Section3 = [0.25 0.5 0.25 1 -1.9718 0.97246]&#xA;    Section4 = [0.25 0.5 0.25 1 -1.9896 0.99024]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My attempt at implementing the filter is given below (as I said earlier, my input data is called &quot;serial&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I initialize the outputs from each of the 4 stages to zeros...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    output_section_1=zeros(size(serial,1),1);&#xA;    output_section_2=zeros(size(serial,1),1);&#xA;    output_section_3=zeros(size(serial,1),1);&#xA;    output_section_4=zeros(size(serial,1),1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I multiply my input (serial) by the first scale factor.  As the rest of the values are 1, I don't bother multiplying any of the other sections.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    serial=serial*1.4055e13;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I run a loop for my filter...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    for i=10:size(serial,1)&#xA;&#xA;% Section 1&#xA;output_section_1(i)=Section1(1)*serial(i) + Section1(2)*serial(i-1) + Section1(3)*serial(i-2) - Section1(5)*serial(i-1) - Section1(6)*serial(i-2);&#xA;&#xA;% Section 2&#xA;output_section_2(i)=Section2(1)*output_section_1(i) + Section2(2)*output_section_1(i-1) + Section2(3)*output_section_1(i-2) - Section2(5)*output_section_1(i-1) - Section2(6)*output_section_1(i-2);&#xA;&#xA;% Section 3&#xA;output_section_3(i)=Section3(1)*output_section_2(i) + Section3(2)*output_section_2(i-1) + Section3(3)*output_section_2(i-2) - Section3(5)*output_section_2(i-1) - Section3(6)*output_section_2(i-2);&#xA;&#xA;% Section 4&#xA;output_section_4(i)=Section4(1)*output_section_3(i) + Section4(2)*output_section_3(i-1) + Section4(3)*output_section_3(i-2) - Section4(5)*output_section_3(i-1) - Section4(6)*output_section_3(i-2);&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output obtained using MATLAB's filter function looks good and is nice and smooth as would be expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output obtained using my own implementation looks just like the input (noisy) except that the values have changed and there is an initialization at the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure I've made a very schoolboy mistake but I cannot see where I have gone wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice anyone could give me would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="16153" LastActivityDate="2015-06-08T15:45:04.637" Title="Implementation of a cascaded IIR filter" Tags="|matlab|lowpass-filter|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23982" PostTypeId="2" ParentId="23980" CreationDate="2015-06-08T15:45:04.637" Score="0" Body="&lt;p&gt;You did not implement a &lt;em&gt;recursive&lt;/em&gt; filter, but a non-recursive filter. Note that in your implementation each output only depends on possibly delayed input values, whereas in a recursive filter, the output depends on delayed input &lt;em&gt;and&lt;/em&gt; output values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the coefficients of one second-order section are given by&#xA;$[b_0, b_1, b_2, 1, a_1, a_2]$, then if $x[n]$ is the input sequence, the output sequence $y[n]$ is computed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=b_0x[n]+b_1x[n-1]+b_2x[n-2]-a_1y[n-1]-a_2y[n-2]$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-08T15:45:04.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23984" PostTypeId="1" CreationDate="2015-06-08T19:14:32.147" Score="4" ViewCount="5109" Body="&lt;p&gt;I am developing a machine vision project to find defects on metal surfaces. I want to learn and implement algorithms which commercial systems are use for metal surface defect. My sample object as below:&lt;img src=&quot;https://i.stack.imgur.com/4UAdq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;a href=&quot;https://i.stack.imgur.com/7OzYW.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7OzYW.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/HjQxU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HjQxU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/zM1Q7.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zM1Q7.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/jePBM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jePBM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/nsB1C.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nsB1C.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using OpenCV. I could find sharp defects with standard edge detection methods. But it is not sufficient. There is some samples of commercial solutions:&lt;br&gt;&#xA;- &lt;a href=&quot;http://www.keyence.co.uk/products/vision/vision-sys/cv-5000/features/movie06.jsp&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.keyence.co.uk/products/vision/vision-sys/cv-5000/features/movie06.jsp&lt;/a&gt;&lt;br&gt;&#xA;- &lt;a href=&quot;http://www.keyence.com/products/vision/vision-sys/cv-5000/features/movie09.jsp&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.keyence.com/products/vision/vision-sys/cv-5000/features/movie09.jsp&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or like this picture:&lt;br&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/NlV01.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1OcgH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea about algorithms which is used in commercial systems? &lt;/p&gt;&#xA;" OwnerUserId="16156" LastEditorUserId="16156" LastEditDate="2015-09-13T13:50:44.183" LastActivityDate="2015-09-13T13:50:44.183" Title="Metal Defect Detection" Tags="|image-processing|computer-vision|opencv|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="23985" PostTypeId="1" AcceptedAnswerId="23989" CreationDate="2015-06-08T19:41:40.253" Score="0" ViewCount="2729" Body="&lt;p&gt;Recently I study frequency Offset estimation due to mismatch in carrier frequency from the oscillator at the receiver. I understand how this cause problem can cause a phase shift. But I also saw that this cause problem called CARRIER LEAKAGE. So I look online and I saw the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Certain transmitter implementations may cause leakage of&#xA;the center frequency component. Such carrier Leakage can&#xA;occur in some transmitter because of DC offset. This issue&#xA;is seen on the receiver side as energy in the transmit center&#xA;frequency&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does carrier leakage mean an increase in interference power?? I thought that carrier offset happens at receiver and not transmitter. I also saw that carrier leakage can cause increase in the Error Vector Magnitude (EVM), I can't see the relationship between carrier leakage and EVM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking forward for your discussion.&lt;/p&gt;&#xA;" OwnerUserId="15590" LastActivityDate="2015-06-09T00:05:40.107" Title="Carrier frequency offset and carrier leakage" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23986" PostTypeId="1" CreationDate="2015-06-08T19:46:07.850" Score="4" ViewCount="3057" Body="&lt;p&gt;I just tried the Fourier denoising method with a hard threshold and my code is as follow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F = imnoise(phantom(128),'gaussian');&#xA;B = fft(F);&#xA;s = 0.3;&#xA;for i = 1:128&#xA;for j = 1:128&#xA;    if abs(B(i,j))&amp;lt;s&#xA;        B(i,j)=0;&#xA;    end&#xA;end&#xA;end&#xA;&#xA;C=ifft(B);&#xA;subplot(121)&#xA;imshow(F,[])&#xA;subplot(122)&#xA;imshow(C,[])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/MgX2d.png&quot; alt=&quot;my result&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Left is the phantom after adding noise and the right is the denoised image from my code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier denoising hard threshold method just uses threshold value to keep high frequency coefficients and the coefficients below the threshold to be 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my code, I just added gaussian noise with default mean 0 and variance 0.01 to my phantom image and then I set the threshold to be 3 times of the standard deviation of the noise, which is 0.3 (this is some good practical threshold I looked at from literature). But why the result is not good? It seems it is still very noisy. Even I change my threshold the result is not good. Why? And I want to my denoised image as close to the original phantom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="11694" LastEditorUserId="128" LastEditDate="2019-10-31T06:00:52.690" LastActivityDate="2019-10-31T06:00:52.690" Title="Implementation of Fourier Domain Denoising with Hard Threshold" Tags="|image-processing|matlab|fourier-transform|denoising|thresholding|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="23988" PostTypeId="1" AcceptedAnswerId="24008" CreationDate="2015-06-08T23:33:10.883" Score="3" ViewCount="4625" Body="&lt;p&gt;Given a discrete-time LTI system defined by the impulse response &lt;span class=&quot;math-container&quot;&gt;$h[n]$&lt;/span&gt;, why is the output &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; of this system for an input &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;y[n] = x[n] * h[n]=\sum\limits_{i=-\infty}^{\infty} x[i]  h[n-i]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="52433" LastEditDate="2021-11-15T21:32:03.887" LastActivityDate="2022-08-29T16:00:52.673" Title="Why is the output of an LTI system expressed as the convolution of the input with its impulse response?" Tags="|convolution|linear-systems|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="23989" PostTypeId="2" ParentId="23985" CreationDate="2015-06-09T00:05:40.107" Score="0" Body="&lt;p&gt;I think you are confusing two different things.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Carrier offset is the difference between the transmitter's and the receiver's local oscillator (LO). The receiver needs to eliminate or reduce the offset if it hopes to receive data consistently. This is done by estimating the offset and adjusting the frequency of the LO.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Carrier leakage causes a DC offset in the receiver. Consider the receiver mixer: it has two inputs, one is the received signal, and the other is the local oscillator. In practice, the LO signal will be present at both inputs, because it is very difficult to isolate high-frequency signals in a PCB. This causes the LO to mix with itself, producing a DC term at the mixer's output.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-09T00:05:40.107" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23992" PostTypeId="2" ParentId="23986" CreationDate="2015-06-09T05:48:37.290" Score="1" Body="&lt;p&gt;You added noise with Variance of 0.01 in the spatial domain.&lt;br&gt;&#xA;Now you need to calculate what's the variance of the Noise per each bin in the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not the same, there are gains in the DFT domain, otherwise no one would use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, there are much faster methods to apply &quot;Hard Threshold&quot; than the loop in your program. Use logical indexing to do it faster.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="8475" LastEditDate="2015-06-09T09:31:39.700" LastActivityDate="2015-06-09T09:31:39.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="23993" PostTypeId="2" ParentId="23973" CreationDate="2015-06-09T08:10:51.133" Score="0" Body="&lt;p&gt;Your signal $x(t)$ is of the form $$x(t)=\sum_{i=1}^{M}a_{i}\delta(t+\tau_{i}).$$&#xA;Assuming $\tau_{i}&amp;gt;0$, then this is a sequence of Dirac impulses which are not zero only for some negative time indexes. &#xA;From there, I am no expert, but I think you may be able to write the z-transfer function of the system and obtain the filter which will output your desired signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About negative time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside a signal processing system, negative time just means &quot;in advance with respect to a given time reference&quot;. That is, the system output depends on the current input and the future input. Of course, physically you cannot travel in the future to go get your future input, you actually need to wait for it to happen and become as well the current input. This waiting incurs a delay on the output of the system. So your system is not real-time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume that $\tau_{i}&amp;lt;\tau_{j}$ for all $i&amp;lt;j$. If your function $x(t)$ was the impulse response of a system, then, to create the output at time $t$, you need to look at all your input from time $t$ to time $t+\tau_{M}$ then do the required processing to get your output (which actually will be produced at $t+\tau_{M}$, but corresponds to input time $t$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="16058" LastEditorUserId="80" LastEditDate="2017-09-28T18:47:50.627" LastActivityDate="2017-09-28T18:47:50.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23994" PostTypeId="1" AcceptedAnswerId="23996" CreationDate="2015-06-09T08:42:22.570" Score="20" ViewCount="51030" Body="&lt;p&gt;Say $f$ is a signal of time $t$, $F$ its Fourier transform of the variable $v$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is known that in polar coordinate, $|F(v)|$ tells us how much the frequency $v$ is present over the signal, and $Arg(F(v))$ tells us how much the contribution of this frequency is phase-shifted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What information do its real and imaginary part tell us ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if I reformulate my question : can we give an interpretation of the Fourier transform in Cartesian coordinate like we can do in polar coordinate ?&lt;/p&gt;&#xA;" OwnerUserId="16163" LastActivityDate="2019-04-08T14:51:22.997" Title="Meaning of Real and Imaginary part of Fourier Transform of a signal" Tags="|fourier-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="23995" PostTypeId="2" ParentId="23994" CreationDate="2015-06-09T09:09:26.470" Score="-1" Body="&lt;p&gt;Fourier transform of a system is its transfer function and gives the multiplication factor when $e^{j\omega t}$ is  the input.  $\omega$ is frequency.  If you consider the input as current, the transfer function or Fourier transform as impedance then the output is potential. If Fourier transform is impedance, then the real part of FT is resistive part of the impedance and imaginary part is the reactive part of the impedance. &lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="8202" LastEditDate="2015-06-09T11:39:52.320" LastActivityDate="2015-06-09T11:39:52.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="23996" PostTypeId="2" ParentId="23994" CreationDate="2015-06-09T09:09:55.583" Score="20" Body="&lt;p&gt;The real and imaginary parts of the Fourier transform of a signal $x(t)$ are the Fourier transforms of the signal's even and odd parts, respectively:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_R(\omega)=\frac12[X(\omega)+X^*(\omega)]\Longleftrightarrow\frac12[x(t)+x^*(-t)]=x_e(t)\\&#xA;X_I(\omega)=\frac{1}{2j}[X(\omega)-X^*(\omega)]\Longleftrightarrow\frac{1}{2j}[x(t)-x^*(-t)]=-j\cdot x_o(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $X_R(\omega)$ and $X_I(\omega)$ are the real and imaginary parts of $X(\omega)$, and $x_e(t)$ and $x_o(t)$ are the even and odd parts of $x(t)$, respectively.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-09T09:09:55.583" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="23997" PostTypeId="1" CreationDate="2015-06-09T09:15:13.770" Score="0" ViewCount="69" Body="&lt;p&gt;I am currently referring to the &lt;a href=&quot;http://www.ee.iitm.ac.in/~giri/pdfs/EE6002/book-cho.pdf&quot; rel=&quot;nofollow&quot;&gt;following &lt;/a&gt;book &lt;em&gt;MIMO-OFDM Wireless Communications with Matlab&lt;/em&gt; in which the log distance path loss model is given by the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{LD}(d)[dB] = PL_F(d_0) + 10nlog(d/d_0)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $d_0$ is a reference distance and $PL_F(d_0)$ is given by $20log(4\pi d_0/\lambda)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a system operating at 2.4GHz carrier frequency, should I consider $\lambda$ as $3e8/2.4e9$? How should I decide upon the path loss exponent $n$ and what reference distance $d_0$ should I consider? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The environment I am trying to simulate is the cabin of an aircraft. So, I need to vary $d$ between $1m$ to $50m$ but I am unsure of $d_0$ and $n$.&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-06-09T09:15:13.770" Title="Parameter selection for log distance path loss model" Tags="|digital-communications|dsp-core|fading-channel|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23999" PostTypeId="1" AcceptedAnswerId="24004" CreationDate="2015-06-09T12:22:33.193" Score="1" ViewCount="132" Body="&lt;p&gt;Suppose I have two camera shoots(Image1,Image2) for the exactly same scene (each pixel is alignment correctly) but from different cameras and different light conditions. I want to remove this light difference. I tried two way till now:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;S,V component adjustment&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Gamma correction&lt;/p&gt;&#xA;&lt;p&gt;I am getting result around 7/255 difference after adjustment.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I am looking for a mathematical transform &amp;quot;F&amp;quot;, something like &lt;code&gt;Adjusted_Image=F(Image1)&lt;/code&gt;  which leads to &lt;code&gt;|Image1-Image2| ~ 0&lt;/code&gt;&#xA;The &amp;quot;F&amp;quot; function will contains must-tuned parameters (a,b,c,....).&lt;/p&gt;&#xA;&lt;p&gt;Any ideas of the formula of &amp;quot;F&amp;quot;?&lt;/p&gt;&#xA;&lt;p&gt;many thanks,&lt;/p&gt;&#xA;" OwnerUserId="15118" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-06-09T16:19:57.973" Title="mathematical transfer for different camera attributes" Tags="|image-processing|opencv|image-registration|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24000" PostTypeId="1" AcceptedAnswerId="24001" CreationDate="2015-06-09T13:07:22.200" Score="1" ViewCount="2912" Body="&lt;p&gt;Good Afternoon Everybody. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am developing filters for EEG signals in these days. During the Develop I find some problems: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter is FIR (band-pass using a convolution of low-pass filter and &#xA;high-pass filter) they are 5 filters in different bands and the order is high and the coefficients are very small. I have coefficients of range from 3.8145e-10 to 0.2279, and the filter orders are: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alpha:     133&#xA;Beta:      117&#xA;Theta:     124&#xA;Delta:     11 (IIR filter)&#xA;Gamma:     125&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The lines codes (only of the filters) are these:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%%Filtro for alpha, beta and gamma signals is the same&#xA;[n,fo,ao,peso]=firpmord([Fapp2 Fass2],[1 0],[0.005 0.005],2);&#xA;ba=firpm(n,fo,ao,peso);&#xA;[n1,fo,ao,peso]=firpmord([Fass1 Fapp1],[0 1],[0.005 0.005],2);&#xA;b1a=firpm(n1,fo,ao,peso);&#xA;ba=conv(ba,b1a);&#xA;Na=length(ba);&#xA;&#xA;%%Filtro señal theta&#xA;[n,fo,ao,peso]=firpmord([Ftpp2 Ftss2],[1 0],[0.005 0.1],2);&#xA;bt=firpm(n,fo,ao,peso);&#xA;[n1,fo,ao,peso]=firpmord([Ftss1 Ftpp1],[0 1],[0.1 0.005],2);&#xA;b1t=firpm(n1,fo,ao,peso);&#xA;bt=conv(bt,b1t);&#xA;Nt=length(bt);&#xA;&#xA;%%Filtro señal delta&#xA;[n,Wn]=buttord(Fdpp2, Fdss2,0.005,60);&#xA;[bd,ad]=butter(n,Wn);&#xA;[n1,Wn]=buttord(Fdss1,Fdpp1,0.005,60);&#xA;[b1d,a1d]=butter(n1,Wn,'high');&#xA;bd=conv(bd,b1d);&#xA;ad=conv(ad,a1d);&#xA;Nd=length(bd);Nd1=length(ad);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This part is only the pre-processing part but the coefficients are very &#xA;small. the Fs is 250Hz and the delay group will be 0.5320 seconds. If I &#xA;change IIR filter to FIR the order is near 200 and the delay group will be &#xA;major (I tried that using only the band-pass filter without the convolution but the order was major than the actual orders). &#xA;my questions are: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Are there methods for reduce order of the filter without lose quality &#xA;as the ripple or attenuation? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I change FIR by IIR, could I lose or distort information? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is normal that the coefficients be very small or how could I convert &#xA;them in bigger numbers (near to order of 0.01 or 0.001 as minimum)? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, I tried to use only High-pass filter and Notch Filter then to do the features extractions but I have similar problem with the delay group too because I want to implement in a FPGA or DSP (for real time process) but the delay group is high compare with anothers works like my work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry, my english is not good.&#xA;Thank you so much for your time.&lt;/p&gt;&#xA;" OwnerUserId="16166" LastEditorUserId="7092" LastEditDate="2015-06-09T21:26:46.930" LastActivityDate="2015-06-09T21:26:46.930" Title="Pre-processing EEG signals" Tags="|matlab|filters|real-time|eeg|finite-impulse-response|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24001" PostTypeId="2" ParentId="24000" CreationDate="2015-06-09T14:16:38.023" Score="2" Body="&lt;p&gt;The advantage to using FIR-filters here is that you can (relatively easily) account for the delay.&lt;br&gt;&#xA;Assuming filters with constant group delay (&lt;a href=&quot;https://dsp.stackexchange.com/questions/9408/fir-filter-with-linear-phase-4-types&quot;&gt;see examples here,&lt;/a&gt;) - which seems likely given that your filters have an odd number of taps - all you have to do is to remove (n-1)/2 samples (where n is the filter order) from the beginning of your data after it has gone through the filter.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&#xA;Filter your data with the Alpha filter.&lt;br&gt;&#xA;It is now longer by 133 samples.&lt;br&gt;&#xA;Remove (133-1)/2 samples from the start of the filtered data, and the delay is gone.&#xA;Do the same for all of your filters, and you can keep the output of all of your filters in sync.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With an IIR, the delay is not that simple to account for.  Getting the outputs of you filter back in sync would be challenging if you used IIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If keeping the filtered signals in sync isn't important, you could switch to using IIR filters for all of your filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would greatly reduce the computational load as well as the amount of memory needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As with the FIR, there are design methods for IIR that use the desired passband, ripple, and attenuation to calculate the needed coefficients so that you should be able to generate coefficients for the IIR filters that match your FIR filters in everything except having a constant delay.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the coefficients, I wouldn't worry about the actual values unless you have trouble representing them on your selected hardware.  Use what your design tool gives you for the coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are design tools which can help improve your FIR filters.  Check some of the online tools (like &lt;a href=&quot;http://t-filter.appspot.com/fir/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;.)  Given the separation of the various bands (&lt;a href=&quot;http://en.wikipedia.org/wiki/Electroencephalography&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia entry for EEG&lt;/a&gt;,)  it looks to me like your current filters can't be provoding very good performance, any way.  I get only 22dB of attenuation using 133 taps for the alpha filter.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;IIR filters that sharp may be difficult to attain, and may be unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It all depends on how much attenuation you need.  Since the bands are defined with only a 1Hz transition, any high degree of attenuation will require high order IIR filters or very long FIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As with any design project, it comes down to making the best compromise between performance and cost - and you need to know what performance is required.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-06-09T14:16:38.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24002" PostTypeId="1" AcceptedAnswerId="24011" CreationDate="2015-06-09T14:53:43.047" Score="1" ViewCount="4584" Body="&lt;p&gt;I am trying to demodulate an AM signal in GNU Radio, and I am having problems with the sampling rates.  I will start off with an example where the flow graph was working. The sampling rate is 256kHz, and it works just fine:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TWCZ3.png&quot; alt=&quot;Figure 1 - sampling rate 256K (works)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I tried a sampling rate of 192kHz, and then it didn't work.  Is there a problem with this flow graph?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vtQDp.png&quot; alt=&quot;Figure 2 - sampling rate 192kHz (not working)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I modified the 2nd flow graph (changed the sampling rate, but didn't need to), and it worked almost perfectly, other than that the voice sounded very slightly too low pitch/slow.  This sampling rate suffered from the same problem as that of figure 2, however I tweaked the rational resampler block until the voices sounded normal.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Fh95B.png&quot; alt=&quot;Figure 3 - sampling rate 320K (mostly works)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As some background, I am running an RTL SDR (DVB-T) dongle, on an Odroid U3 (ARM architecture).  I have a &quot;Ham it up&quot; upconverter, so that the AM (810Kkz) is shifted up by 125MHz, into the VHF band that the dongle can actually receive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:  There were two issues with the flow graph: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The filter cutoff frequency needed to be calculated using normalized frequency (see MBaz's detailed answer).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The R820T chip does indeed, as MBaz ascertained in the comment section, have only a limited set of sampling rates that it supports.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In order for the flow graph to output natural sounding audio, it must use one of the acceptable sampling rates, and also have the proper filter setting.  The 2nd and 3rd flow graphs didn't work because they had the wrong sample rates.&lt;/p&gt;&#xA;" OwnerUserId="16168" LastEditorUserId="13320" LastEditDate="2016-04-08T14:57:23.437" LastActivityDate="2016-04-08T14:57:23.437" Title="Why isn't this AM Demod GNU Radio flow graph working with different sampling rates?" Tags="|sampling|demodulation|gnuradio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24003" PostTypeId="2" ParentId="24000" CreationDate="2015-06-09T15:06:38.240" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there methods for reduce order of the filter without lose&#xA;  quality as the ripple or attenuation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For any filter implementation there will be compromise/trade-off between Filter Order, Passband and Stopband ripple and Transition band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Sharp roll-off is your main priority, then explore Chebychev(type II) filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;filtfilt()&lt;/em&gt; function in Matlab will remove the group delay due to the filter, but will double the filter order and hence may increase the processing time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency domain using FFT is usually faster than time-domain convolution of transfer function and signal.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I change FIR by IIR, could I lose or distort information?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;IIR filters are not linear phase and this will distort the signal based on the extent of non-linearity of phase. If the phase response is close to linear, then it can be considered to a linear. It all depends on what your application is. If you want to extract cognitive information from the EEG signal through information theory based approaches, then you will need a very clean signal. On the other hand, if it is just to identify spatial or temporal activation of EEG bands, for example, excitation of Alpha band over time when a subject is presented with sporadic visual stimuli, then you will only need approximate estimation of PSD in the Alpha band over time for visualizations like spectrograms.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is normal that the coefficients be very small or how could I convert&#xA;  them in bigger numbers (near to order of 0.01 or 0.001 as minimum)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why would you want to increase the coefficients? Coefficient are just weights for delay components of the signal. Small coefficient means lesser weightage for the corresponding frequency component. If certain coefficient are very small relative to the mean of the signal, then you should be approximating them to zero to get some minor computational gain rather than increasing them.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notch filter is generally used only for removing Line noise at 60 Hz. &lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2015-06-09T15:06:38.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24004" PostTypeId="2" ParentId="23999" CreationDate="2015-06-09T16:19:57.973" Score="1" Body="&lt;p&gt;This Process is Known as Color Correction.It is Explained in more detail &lt;a href=&quot;http://ia802707.us.archive.org/23/items/Lectures_on_Image_Processing/EECE253_05_ColorCorrection.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To Give a short Explanation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets suppose &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have a Input Color Matrix represented as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    | R_O1 G_O1 B_O1 |&#xA;A = | R_O2 G_O2 B_O2 |&#xA;    | R_On G_On B_On |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and a Reference Target Color Matrix represented as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    | R_T1 G_T1 B_T1 |&#xA;B = | R_T2 G_T2 B_T2 |&#xA;    | R_Tn G_Tn B_Tn |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Color Correction Matrix X is computed as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            **A X = B** &#xA;&#xA;    | R_O1 G_O1 B_O1 |     | A11 A12 A13 |   =  | R_T1 G_T1 B_T1 |  &#xA;    | R_O2 G_O2 B_O2 |   * | A21 A22 A23 |      | R_T2 G_T2 B_T2 |&#xA;    | R_On G_On B_On |     | A31 A32 A33 |      | R_Tn G_Tn B_Tn |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;X = (B.A^T)(A.A^T)^-1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some one please help me editing the formulas!&lt;/p&gt;&#xA;" OwnerUserId="5912" LastActivityDate="2015-06-09T16:19:57.973" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24005" PostTypeId="2" ParentId="24000" CreationDate="2015-06-09T16:34:56.983" Score="0" Body="&lt;p&gt;mmm... Sorry I didn't know it, then I will use High-pass Filter and Notch filter and maybe a Low-pass filter, after that I will try to analyze with anothers feature extraction methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for implementation I need a low order, I read about filtfilt() and only like help in the simulation part, the Low-pass filter has the range of 0-100Hz and the High-pass 0.5Hz-Fs=500/2. But I am continue having hgh orders, I could try to do the convolution between a IIR filter and FIR filter for reduce the ripple and not loss the trade-off&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am proving FDATOOL of MATLAB too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again sorry for my english.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much for your time.&lt;/p&gt;&#xA;" OwnerUserId="16166" LastActivityDate="2015-06-09T16:34:56.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24006" PostTypeId="2" ParentId="23986" CreationDate="2015-06-09T18:08:01.863" Score="1" Body="&lt;p&gt;You should use the 2D Fourier transform function &lt;em&gt;fft2&lt;/em&gt; instead of &lt;em&gt;fft&lt;/em&gt;. When provided with a 2D array arguement, &lt;em&gt;fft&lt;/em&gt; returns 1D FFT results for the columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to remove the noise you should apply a low pass filter, as opposed to zeroing coefficients with small magnitudes. By using the &lt;em&gt;fftshift&lt;/em&gt; and &lt;em&gt;meshgrid&lt;/em&gt; functions you can easily do this in frequency space.&lt;/p&gt;&#xA;" OwnerUserId="16173" LastActivityDate="2015-06-09T18:08:01.863" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24008" PostTypeId="2" ParentId="23988" CreationDate="2015-06-09T19:38:57.470" Score="8" Body="&lt;p&gt;it takes more work to do this for continuous-time systems, so i'll just do it for discrete-time and we can all wave our arms to extend to continuous-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a general discrete-time input signal can be expressed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \sum\limits_{i=-\infty}^{\infty} x[i] \delta[n-i] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta[n]$ is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_delta&quot; rel=&quot;noreferrer&quot;&gt;Kronecker delta&lt;/a&gt; or &quot;unit impulse function&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \delta[n] \triangleq&#xA;\begin{cases}&#xA;1, &amp;amp; \text{if }n = 0 \\&#xA;0, &amp;amp; \text{if }n \ne 0&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so think of your input $x[n]$ as the sum of a bunch of individual impulse functions, each delayed to time $i$ and weighted by a constant which is equal to $x[i]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, let's say we have a Linear and Time-Invariant discrete-time system, represented with operator, $\mathbb{T}$, and output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = \mathbb{T}\left\{ x[n] \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we input into that system a single unit impulse, $\delta[n]$.  by definition, the &quot;impulse response&quot; of the LTI system is the output coming out when a unit impulse, $\delta[n]$, is input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h[n] \triangleq \mathbb{T}\left\{ \delta[n] \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, imagine a general input, $x[n]$ is input to $\mathbb{T}\{ \}$.  then, because it's Linear:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;y[n] &amp;amp; = \mathbb{T}\left\{ x[n] \right\} \\&#xA;&amp;amp; = \mathbb{T}\left\{ \sum\limits_{i=-\infty}^{\infty} x[i] \delta[n-i] \right\} \\&#xA;&amp;amp; = \sum\limits_{i=-\infty}^{\infty} \mathbb{T}\left\{ x[i] \delta[n-i] \right\} \\&#xA;&amp;amp; = \sum\limits_{i=-\infty}^{\infty} x[i]  \mathbb{T}\left\{ \delta[n-i] \right\} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and because it's Time Invariant, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h[n-i] = \mathbb{T}\left\{ \delta[n-i] \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then, putting the two together, you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;y[n] &amp;amp; = \sum\limits_{i=-\infty}^{\infty} x[i]  \mathbb{T}\left\{ \delta[n-i] \right\} \\&#xA;&amp;amp; = \sum\limits_{i=-\infty}^{\infty} x[i]  h[n-i] \\&#xA;\end{align} $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-06-09T19:44:45.957" LastActivityDate="2015-06-09T19:44:45.957" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24009" PostTypeId="1" AcceptedAnswerId="24019" CreationDate="2015-06-09T19:59:42.347" Score="1" ViewCount="2291" Body="&lt;p&gt;In normal cross-correlation or convolution between a signal and a template(say a small portion of the signal) the template is moved along length of the signal without changing the amplitude offset of the template. But is there any function (in MATLAB or general) that alters the amplitude offset of the template according to the changes in the amplitude of the signal during cross-correlation or convolution? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider the following ECG signal which is has a large amount of baseline wander due to motion artifacts. The sharp peaks and trough are the heartbeat signals. The beat signal contained in the red box is taken as a template to perform cross-correlation with the full ECG signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/T5b9H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the large baseline wander, after doing normal cross-correlation, the heartbeat peaks are getting de-emphasized.But, there is strong possibility that the heart-beats will be emphasized if the amplitude offset(offset along y axis) of the template follows the signal amplitude during correlation. In other words, the template must be more or less alighted with the heart-beat in both time and amplitude during convolution or xcross operation. I hope the above illustration adds clarity to the question and the requirement. If there is any alternate method for template matching that will give better results for the above scenario, please do suggest the same.&lt;/p&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="11242" LastEditDate="2015-06-09T20:04:45.447" LastActivityDate="2015-06-10T10:03:40.560" Title="Baseline correlation for template matching" Tags="|convolution|cross-correlation|template-matching|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24011" PostTypeId="2" ParentId="24002" CreationDate="2015-06-10T01:12:31.070" Score="1" Body="&lt;p&gt;In order to make the filter calculations easer, you should specify its sampling rate equal to the source's. Assume that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$D$ is the filter's decimation factor&lt;/li&gt;&#xA;&lt;li&gt;$f_s$ is the source sampling rate&lt;/li&gt;&#xA;&lt;li&gt;$f_c$ is the filter's specified cutoff frequency&lt;/li&gt;&#xA;&lt;li&gt;$f_f$ is the filter's specified sampling rate&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;actual&lt;/em&gt; cutoff frequency from the point of view of the filter's output, $f_a$, is calculated as: $$f_a=\frac{2Df_c}{f_f}\frac{f_s}{2D}=\frac{f_cf_s}{f_f}.$$ This is because the filter doesn't care what the actual sampling rate is; what it needs to know is the cutoff frequency as a fraction of the normalized Nyquist frequency, which is $2Df_c/f_f$ after accounting for the decimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your first flowgraph, the actual cutoff frequency is $5\cdot256/64=20$ kHz, not 5 kHz (the same problem occurs in the second flowgraph; in the third, the cutoff is 25 kHz). If you specify the filter sampling rate equal to the source rate ($f_s/f_f=1$), then your signal will actually be filtered at 5 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need to make sure that the product of the source sampling rate, times all your interpolation, divided by all your decimation, is equal to the sink sampling rate. In the third flowgraph, the sampling rate into the sink is 16 kHz, not 48 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, I think there's another problem in your flowgraph. I assume that you're demodulating AM DSB-LC. If the RTL-SDR device is centered exactly at the carrier frequency, then you only need the low-pass filter; no complex to mag conversion is necessary. You only need to keep the real part of the signal (send the imaginary part to a null sink -- you can do this right after the RTL-SDR and save some computations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only need to do envelope detection when the AM signal is not in baseband. In that case, you calculate its absolute value and &lt;em&gt;then&lt;/em&gt; low-pass filter it. You also need a final high-pass filter to eliminate the DC bias present at the LPF output.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-06-11T02:18:37.893" LastActivityDate="2015-06-11T02:18:37.893" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24012" PostTypeId="1" AcceptedAnswerId="24014" CreationDate="2015-06-10T06:23:38.533" Score="1" ViewCount="588" Body="&lt;p&gt;I've been learning about &lt;a href=&quot;http://en.wikipedia.org/wiki/Blind_signal_separation&quot; rel=&quot;nofollow&quot;&gt;blind signal separation&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have noticed that there are a number of algorithms for performing blind signal separation. (eg: Independent component analysis)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which begs the question, are there any 'non-blind' signal separation algorithms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been searching for a while and I haven't found anything. Nothing is listed on the wiki page and I've never noticed any in open libraries such as open CV.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not even sure what search terms to look for.&lt;/p&gt;&#xA;" OwnerUserId="4283" LastEditorUserId="13320" LastEditDate="2016-11-21T12:54:33.083" LastActivityDate="2017-07-04T22:03:02.763" Title="Blind Signal separation vs .... what?" Tags="|source-separation|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24014" PostTypeId="2" ParentId="24012" CreationDate="2015-06-10T08:17:36.193" Score="5" Body="&lt;p&gt;The opposite of blind-signal separation is not &quot;non-blind signal separation&quot;. The thing is, depending on what you know on the signals you will use different algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you know that there is a low frequency signal mixed with a higher frequency one, you can use low/high-pass filtering to get the two signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's no real name for what you're looking for because every case is different. The generic way is more or less filtering the signals with the information you know. But the filtering is always different.&lt;/p&gt;&#xA;" OwnerUserId="16145" LastActivityDate="2015-06-10T08:17:36.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24017" PostTypeId="1" AcceptedAnswerId="24021" CreationDate="2015-06-10T09:23:26.300" Score="3" ViewCount="3742" Body="&lt;p&gt;I’m new to DSP and I have to do an audio equalizer in c++.&lt;br&gt;&#xA;I did a lot of research about it  and tried some stuff in the last month, but I’m a little overwhelmed with all those informations and it’s not working yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I decided to start over and for now, all I got is a function which fills the audio buffer with a sin wave (1kHz). And I’m trying to apply a filter with those values to it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Filter&amp;gt;&#xA;    &amp;lt;Bands num-bands=&quot;28&quot;&amp;gt;&#xA;        &amp;lt;band0    freq=&quot;31.25&quot;      width=&quot;7.23625&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band1    freq=&quot;39.3725&quot;    width=&quot;9.1171&quot;      gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band2    freq=&quot;49.6063&quot;    width=&quot;11.4868&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band3    freq=&quot;62.5&quot;       width=&quot;14.4725&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band4    freq=&quot;78.7451&quot;    width=&quot;18.2342&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band5    freq=&quot;99.2126&quot;    width=&quot;22.9737&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band6    freq=&quot;125&quot;        width=&quot;28.945&quot;      gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band7    freq=&quot;157.49&quot;     width=&quot;36.4684&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band8    freq=&quot;198.425&quot;    width=&quot;45.9473&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band9    freq=&quot;250&quot;        width=&quot;57.89&quot;       gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band10   freq=&quot;314.98&quot;     width=&quot;72.9368&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band11   freq=&quot;396.85&quot;     width=&quot;91.8946&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band12   freq=&quot;500&quot;        width=&quot;115.78&quot;      gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band13   freq=&quot;629.961&quot;    width=&quot;145.874&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band14   freq=&quot;793.701&quot;    width=&quot;183.789&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band15   freq=&quot;1000&quot;       width=&quot;231.56&quot;      gain=&quot;6&quot; /&amp;gt;&#xA;        &amp;lt;band16   freq=&quot;1259.92&quot;    width=&quot;291.747&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band17   freq=&quot;1587.4&quot;     width=&quot;367.579&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band18   freq=&quot;2000&quot;       width=&quot;463.12&quot;      gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band19   freq=&quot;2519.84&quot;    width=&quot;583.495&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band20   freq=&quot;3174.8&quot;     width=&quot;735.157&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band21   freq=&quot;4000&quot;       width=&quot;926.24&quot;      gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band22   freq=&quot;5039.68&quot;    width=&quot;1166.99&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band23   freq=&quot;6349.6&quot;     width=&quot;1470.31&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band24   freq=&quot;8000&quot;       width=&quot;1852.48&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band25   freq=&quot;10079.4&quot;    width=&quot;2333.98&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band26   freq=&quot;12699.2&quot;    width=&quot;2940.63&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;        &amp;lt;band27   freq=&quot;16000&quot;      width=&quot;3704.96&quot;     gain=&quot;0&quot; /&amp;gt;&#xA;    &amp;lt;/Bands&amp;gt;&#xA;&amp;lt;/Filter&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So here are my questions :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In which domain should I apply the filter ?&#xA;I started in the frequency domain, but this blog (&lt;a href=&quot;http://blog.bjornroche.com/2012/08/why-eq-is-done-in-time-domain.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://blog.bjornroche.com/2012/08/basic-audio-eqs.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;) shows me that it’s not the best and only solution. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Which kind of filter should I use ?&#xA;I’m lost with all those high pass, low pass, peaking, shelving filters; and I don’t know which one to choose.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I only found “tutorial” to create a filter which modify only one frequency / band. Is it possible to create a filter that is a sum of multiples filters ? Or applying multiples filters in series to the signal ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Feel free to ask if I forgot something that might help to understand my problem.&lt;br&gt;&#xA;Thanks for your time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS : Sorry if this post is not very specific, but I want to clear that out before posting specifics problems or code.&lt;/p&gt;&#xA;" OwnerUserId="15579" LastEditorUserId="15579" LastEditDate="2015-06-10T09:43:17.427" LastActivityDate="2015-06-10T10:25:27.157" Title="Which filter for an audio equalizer" Tags="|filters|audio|filter-design|equalization|c++|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24019" PostTypeId="2" ParentId="24009" CreationDate="2015-06-10T10:03:40.560" Score="4" Body="&lt;p&gt;This would be a cumbersome way to detect heart beats (or the QRS complex), if that is what you are trying to do ultimately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little bit about what you are trying to do currently:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your observations are correct and to these I would like to add that no two heart beats are the same and therefore, strictly speaking, your template will be aligning just with similar heart beats. What if the subject started running in the mean time? That would be quite a different heart beat template to compare against.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you absolutely must use a template matching technique and apply a hard threshold on the peaks of the cross correlation, here is a set of points that might help you:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a high pass filter in the region of 0-5Hz. This will remove the slow varying components and what you observe as &quot;drift&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Select a number of heart beats, at random, &lt;em&gt;from the filtered signal&lt;/em&gt; and create an average &quot;beat&quot;. Use this as your template.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A little bit about how is this task usually done:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Picking up the heart beats from an ECG signal usually involves rectification of the signal and sliding window integration with the possible addition of some filtering to reduce the effect of artefacts. The &quot;ideal&quot; result of this is a time series that looks like a square pulse with the positive transition of the pulse almost aligned with the start of the QRS complex and the negative transition of the pulse aligned with the end of the QRS complex. But in practice, you might find that this signal is more &quot;floating&quot; due to noise and artefacts which means that you might also have to use an adaptive threshold technique to improve the detection performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information please see this &lt;a href=&quot;http://www.physik.uni-freiburg.de/~severin/ECG_QRS_Detection.pdf&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;. For much more information, including signals, please see this &lt;a href=&quot;http://physionet.org/physiotools/software-index.shtml&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-06-10T10:03:40.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24020" PostTypeId="2" ParentId="24017" CreationDate="2015-06-10T10:24:49.710" Score="0" Body="&lt;p&gt;first of all if you want to test your equalizer you should not use a sine wave as input signal, but a signal with a richer spectrum. In this way you can compare the input and output spectrum and check the equalizer performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) It is not true that the time domain always outperforms the frequency domain. However, if you are a beginner this should not be your first problem. Start with the easiest solution and when the eq works focus on performances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 and 3) I think you are looking for a &lt;strong&gt;filterbank&lt;/strong&gt;, which is a group of filters that are applied in parallel. In this case you want a bank of bandpass filter, where each filter has the center frequency and the width that you specified above.&lt;/p&gt;&#xA;" OwnerUserId="15543" LastActivityDate="2015-06-10T10:24:49.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24021" PostTypeId="2" ParentId="24017" CreationDate="2015-06-10T10:25:27.157" Score="5" Body="&lt;p&gt;Simply put, you need a bank of passband filters.  You feed your signal through each of the filters, and sum up the outputs from the filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Designing the filters is where the fun comes in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, assuming this is just audio (music or the like) then there's no need of special filters.  You can use the simplest and fastest and not worry too much about phase and ripple.&lt;br&gt;&#xA;You will want to use IIR filters, as they require the least amount of calculation - since you have 28 bands and presumably are working in stereo, you will want to reduce the load on the CPU else the computer won't be able to do much else.  IIR uses less CPU time than FIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are online tools that you can use to create the needed coefficients for the filters.  Matlab or Gnu Octave can also be used.&#xA;You will need to look up algorithms for implementing IIR Filters, and how to make use of the calculated coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifying the bands is the next fun step.&#xA;When a filter passes audio, it doesn't simply remove everything out side of its passband.  It just isn't possible to do so.  Frequencies outside of the passband of a filter sort of slope off down towards zero amplitude.&lt;br&gt;&#xA;At some frequency outside of its passband, the audio amplitude will drop by one half.  This is the -3dB point, and is used in specifying filters.&lt;br&gt;&#xA;What you want to do is to arrange your passbands such that the -3dB points of adjacant filters are at the same frequency.&#xA;Say you have two filters.  One should pass frequencies from 500 to 1000Hz and the next from 1000 to 2000Hz.  You would want to make the high cutoff of the lower filter to be 1000Hz, and the low cutoff of the high filter also be 1000Hz.  Design the filters such that 1000Hz is down by half in each filter (usually, just specifying it as the cutoff is enough.)  When you now sum the outputs of the two, they add up to just the audio from 500 to 200Hz, with everything in that range at (more or less) the same amplitude as before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, with your audio split into banks, you can multiply the output of each filter with some constant to dampen or emphasize that band.&#xA;This image demonstrates what I mean about the way the bands have to be layed out.  &lt;img src=&quot;https://i.stack.imgur.com/J0Ifk.jpg&quot; alt=&quot;equalizer&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-06-10T10:25:27.157" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24022" PostTypeId="1" CreationDate="2015-06-10T13:57:26.283" Score="1" ViewCount="99" Body="&lt;p&gt;An ISI channel of length 'L+1' $\mathbf{h}=[h_0 \space h_1 \space … \space h_L]$can always be modeled as a finite state machine(FSM) of memory 'L'. For a binary input $x\in\{+1,-1\}$,a state can be defined as $\mathbf{s}=[x_{1}\space  x_{2} \space … \space x_{L}]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently came across a paper (cf. &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=5257126&amp;amp;queryText=an+itertrack+interference+mitigation+technique+using+partial+ITI+estimation+in+pattterned+media+storage&amp;amp;newsearch=true&amp;amp;searchField=Search_All&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Myint, L.M.M.; Supnithi, P.; Tantaswadi, P., &quot;An Inter-Track Interference Mitigation Technique Using Partial ITI Estimation in Patterned Media Storage,&quot; Magnetics, IEEE Transactions on , vol.45, no.10, pp.3691,3694, Oct. 2009&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in which $\mathbf{h}=[h_{k-1} \space h_k \space h_{k+1}]=[\beta \space b \space \beta]$, where the authors define gain=$b$ and ISI-coefficient=$\beta$ (ref:eq 3,4,5) . the noiseless channel output is defined as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;y_{k} = bx_k+\beta(x_{k-1}+x_{k+1})\\&#xA;r_{k} = y_k + n_k&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and create a 4-state trellis using $[x_{k-1} \space x_{k+1}]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The branch metric is computed as $\lambda_k=(r_k-y_k)^2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is approach is different from the conventional state definition $[x_{k-1} \space x_{k}]$. Since this paper is published in IEEE transactions on magnetics, I am hesitant to say that there is a mistake here but on the other hand this definition doesn't sound right to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be very grateful if someone can comment on this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\color{red}{New \space Edit:}$&#xA;While searching for the answer I came across another paper&#xA;(cf. &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/abstractReferences.jsp?arnumber=4476459&amp;amp;queryText=ISI+Mitigation+Capability+of+MLSE+Direct-Detection+Receivers&amp;amp;newsearch=true&amp;amp;searchField=Search_All&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rubsamen, M.; Gene, J.M.; Winzer, P.J.; Essiambre, R., &quot;ISI Mitigation Capability of MLSE Direct-Detection Receivers,&quot; Photonics Technology Letters, IEEE , vol.20, no.8, pp.656,658, April15, 2008&#xA;doi: 10.1109/LPT.2008.919597&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That takes a similar approach.&lt;/p&gt;&#xA;" OwnerUserId="16080" LastEditorUserId="16080" LastEditDate="2015-06-10T15:13:14.127" LastActivityDate="2015-06-10T15:13:14.127" Title="State definition in Viterbi Algorithm?" Tags="|digital-communications|digital-filters|viterbi-algorithm|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24023" PostTypeId="1" AcceptedAnswerId="24049" CreationDate="2015-06-10T14:30:16.883" Score="0" ViewCount="2797" Body="&lt;p&gt;I want to remove the noise gaussian and poisson noise.&#xA;But I'm unfamilier with noise remove methods but from my understanding it's similler to average filter which is median filter.&#xA;But I want to know exactly how to remove those kind of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My interest is in image.&#xA;And I think that if I make an image with gassian noise +poisson noise then I have to use two remove stages. But I'm not sure whether can I use just one median filter to remove all noise or there are especially methds in there.&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="15650" LastEditDate="2015-06-10T21:33:42.560" LastActivityDate="2015-06-11T09:17:28.883" Title="How to remove gaussian noise and poisson noise?" Tags="|noise|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24024" PostTypeId="1" CreationDate="2015-06-10T16:03:09.993" Score="0" ViewCount="76" Body="&lt;p&gt;I know its an old technique but can someone tell me in which areas the image dithering technique is used and why?&lt;/p&gt;&#xA;" OwnerUserId="16185" LastEditorUserId="8202" LastEditDate="2015-06-10T16:07:32.920" LastActivityDate="2015-06-10T16:17:39.110" Title="In which area the image dithering technique is used?" Tags="|matlab|" AnswerCount="1" CommentCount="0" ClosedDate="2015-06-11T14:23:35.557" ContentLicense="CC BY-SA 3.0" />
  <row Id="24026" PostTypeId="2" ParentId="24024" CreationDate="2015-06-10T16:17:39.110" Score="1" Body="&lt;p&gt;In image compression, when the number of bits per pixel are reduced, you might see an artifact called contouring.  Dithering is used to reduce this artifact.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, please see&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dither&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Dither&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2015-06-10T16:17:39.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24027" PostTypeId="2" ParentId="23984" CreationDate="2015-06-10T17:22:12.577" Score="0" Body="&lt;p&gt;Apparently, the commercial solutions are purely visual (not current or ultrasonic, as one poster suggested). There's two ways shown: detection of stains or defects on a surface parallel to the image surface, and detection of a defect in an edge perpendicular to that. To me, it appears that those programs first separate out accidental data (like roughness or lighting). Maybe there's some learning involved, that is, an estimation of &quot;typical&quot; accidental data - for example, in your case you could evaluate the variations in several images. There's some types of variations that would need to be accounted for:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Geometry and position of the imaged object (maybe its dimension are a little off, or it is slightly misadjusted, in both cases there'd be a difference you'd have to ignore)&lt;/li&gt;&#xA;&lt;li&gt;Unavioidable but harmless variation (surface roughness, lighting effects)&lt;/li&gt;&#xA;&lt;li&gt;Actual variation (the defects which you're looking for)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'd first build a model of the expected image. For example, I could use a wavelet transformation to characterize expected variation - medium values and standard derivations of coefficients. So I would capture both size and &quot;strength&quot; of a visual variation. Roughness outside of the expected surface roughness either in size or in strength or depth would stand out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When taking in account different orientations, it might be useful to align the image instead of the part. That is, I could identify useful orientation points (the edges maybe) and rotate, translate and scale the image accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lighting effects are probably hardest to understand and model. For example, when wavelets are used, one could find (using several &quot;good&quot; images) correlations in means and standard deviations between different coefficients. These correlations would then further restrict expected coefficient values. These correlations would be quite hard to calculate (basically, pixels squared times number of evaluated images), however their evaluation can be a lot simpler - some coefficients would carry the most information, and could be used to &quot;lead&quot; the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope you'd understand my reply, and I'd like to thank you for posting such an interesting problem. I never thought about it before. Edge detection apparently works differently, and apparently is not of much use in your case. Would you be so kind and submit a few (maybe 20) images for testing?&lt;/p&gt;&#xA;" OwnerUserId="7358" LastActivityDate="2015-06-10T17:22:12.577" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24029" PostTypeId="1" AcceptedAnswerId="24034" CreationDate="2015-06-10T18:23:30.193" Score="-2" ViewCount="880" Body="&lt;p&gt;I need some clue on how to apply the Fourier transform to a wideband discrete signal like speech in Matlab. What I want to do is to apply the MUSIC algorithm to the speech recorded by a set of microphones and in order to do that I need to take the FFT and then apply the MUSIC algorithm to the bins of frequencies which now I consider them narrowband .&lt;/p&gt;&#xA;" OwnerUserId="9130" LastEditorUserId="1212" LastEditDate="2015-06-11T08:07:09.150" LastActivityDate="2015-06-11T08:07:09.150" Title="Fourier Transform for speech signal" Tags="|matlab|fft|discrete-signals|fourier-transform|speech|" AnswerCount="1" CommentCount="1" ClosedDate="2015-06-10T23:53:17.917" ContentLicense="CC BY-SA 3.0" />
  <row Id="24031" PostTypeId="1" CreationDate="2015-06-10T20:02:50.640" Score="0" ViewCount="1818" Body="&lt;p&gt;I would like to be able to implement an All-Pass filter with a frequency-dependent group delay.  I need a maximum group delay at low frequency of about 20 samples (for F&lt;em&gt;s&lt;/em&gt; = 44.1kHz), and it needs to fall to zero(-ish) at the Nyquist frequency.  Ideally, I would like to specify a corner frequency and a rate at which the delay falls off either side of it.  How the heck would I design such a thing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm afraid I'm not sufficiently competent to follow the design approaches I can find on the web that plunge straight into poles, zeros, transfer functions and complex conjugates.  What I can do, though, is implement the darned thing efficiently in code once it is designed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to use Matlab to design FIR and IIR low-pass filters, because it has a built-in tool that spits them out.  But it doesn't have an All-Pass filter design tool (at least not one I can find).&lt;/p&gt;&#xA;" OwnerUserId="16190" LastActivityDate="2016-07-01T11:42:53.160" Title="Any simple Digital All-Pass Filter Design Tools?" Tags="|filter-design|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24032" PostTypeId="1" CreationDate="2015-06-10T12:27:45.813" Score="0" ViewCount="1088" Body="&lt;p&gt;I'm new to signal processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could somebody explain to me what are the benefits and reasons for decomposing a signal into real and especially imaginary parts? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking at the hilbert transform in matlab. &#xA;&lt;a href=&quot;http://uk.mathworks.com/help/signal/ref/hilbert.html&quot; rel=&quot;nofollow&quot;&gt;Matlal hilbert transform&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The imaginary part is a version of the original real sequence with a 90° phase shift. What exactly is a phase shift of 90 degrees. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if I have a data sequence of [100, 100, 200, 100, 200], how are the imaginary parts calculated? How do you phase shift 90 degrees? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerDisplayName="lucozade" LastActivityDate="2015-06-15T15:52:15.843" Title="Signal processing - why compute imaginary part?" Tags="|matlab|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24033" PostTypeId="2" ParentId="24032" CreationDate="2015-06-10T13:32:20.430" Score="2" Body="&lt;p&gt;One use of Hilbert Transform is to recover the amplitude envelope of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a practical example: &lt;a href=&quot;https://dsp.stackexchange.com/questions/715/extracting-binary-magnetic-strip-card-data-from-raw-wav&quot;&gt;Extracting Binary Magnetic-Strip Card Data from raw WAV&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often the shortest distance between two points is through complex analysis.  Even if the start and destination don't appear to involve complex numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding &quot;What is the phase shift of 90°?&quot;: If it is single cisoid, i.e. a single point making a circular orbit around the origin on the complex plane, then applying a phase shift of 90° obviously sets it backwards or forwards by a quarter-cycle.  Now if you consider an arbitrary waveform to be a sum of cisoids with different amplitude, phase and frequency, (Fourier Theory shows that you can generally achieve this), you can just set each one back by a quarter cycle, and recombine. That's one way to accomplish the Hilbert Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://bl.ocks.org/jinroh/7524988&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://bl.ocks.org/jinroh/7524988&lt;/a&gt; &amp;lt;-- this gives a visual example of combining cisoids into the target waveform.&lt;/p&gt;&#xA;" OwnerUserId="595" OwnerDisplayName="P i " LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-06-13T14:45:24.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24034" PostTypeId="2" ParentId="24029" CreationDate="2015-06-10T23:30:29.847" Score="0" Body="&lt;p&gt;You can take the samples of the speech satisfying Nyquist criterion.  Say you got a vector of samples called x.  spectrogram(x) would give you the short time Fourier Transform of x.  fft(x) would give you the dft of the speech signal in a more computation-efficient manner compared to direct computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please visit &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://in.mathworks.com/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow&quot;&gt;http://in.mathworks.com/help/signal/ref/spectrogram.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see help fft and choose whatever you want.&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="15664" LastEditDate="2015-06-10T23:46:01.423" LastActivityDate="2015-06-10T23:46:01.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24035" PostTypeId="1" CreationDate="2015-06-10T23:31:30.440" Score="0" ViewCount="4675" Body="&lt;p&gt;I am trying to take a Fourier transform of a femtosecond pulse train and plot the frequency spectrum.&lt;br&gt;&#xA;I followed &lt;a href=&quot;https://dsp.stackexchange.com/questions/18043/simple-fft-to-gaussian-pulse-with-matlab&quot;&gt;this question&lt;/a&gt; and am able to create a pulse train and plot both the time and frequency domain.&lt;br&gt;&#xA;My question is, why do the pulses overlap in the time domain graph, since their width is on the order of femtoseconds, and the distance between them (T) is much larger?&lt;br&gt;&#xA;Is it an issue with my time vector or am I interpreting the graph incorrectly?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Using a Gaussian carrier envelope for the e-field, I show a comb of laser&#xA;%frequencies defining frep, and its representation in freq space. The&#xA;%sampling frequency is 10 times the freq (f=10*fs, fs=fr so fr=f/10).&#xA;&#xA;%Define variables&#xA;fr=120e6;             %rep rate, units: Hz    &#xA;fs=10*fr;             %sampling frequency, units: Hz&#xA;T=1/fs;               %period, units: s (~fs) (sampling time)&#xA;tau=100e-15;           %proportional to pulse duration, units: s&#xA;%tau=(pulse_duration)/sqrt(2*log(2));&#xA;wl=2*pi*fr;           %carrier frequency, units: Hz&#xA;ceo=0;                %offset freq., can change later&#xA;&#xA;%Define electric field&#xA;L=1500;               %sets axis length&#xA;t=(0:L-1)*T;          %time, units: s&#xA;&#xA;Es=zeros(length(t));&#xA;for n=0:100           %n is the number of pulses (depends on L)&#xA;    for i=1:length(t)&#xA;        Es(n+1,i)=exp(-(t(i)-n*T)^2/tau^2)*exp(-1i*wl*t(i));&#xA;    end               &#xA;end    &#xA;E=sum(Es,1);&#xA;&#xA;%Fourier Transform to frequency&#xA;F=abs(fft(E));        %Fourier transform the vector Es&#xA;FT=F(L/2:L-1);           %Take out half due to symmetry&#xA;FTn=FT/max(FT);        %Normalized y-axis&#xA;f=(1/L)*(L/2:L-1)*fs;    %Frequency for plotting&#xA;&#xA;%Plots versus time and frequency&#xA;figure(1)&#xA;plot(t,real(E))&#xA;xlim([0 max(t)/2])&#xA;xlabel('Time (s)')&#xA;ylim([-1.2 1.2])&#xA;ylabel('Amplitude')&#xA;figure(2)&#xA;plot(f,FTn,'k')&#xA;xlabel('Frequency (Hz)')&#xA;xlim([min(f) max(f)])&#xA;ylabel('Normalized Amplitude')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16191" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2021-12-09T04:08:10.720" Title="Fourier Transform of a Pulse Train (Frequency Comb Simulation)" Tags="|matlab|fft|frequency-spectrum|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24036" PostTypeId="2" ParentId="24032" CreationDate="2015-06-10T23:42:50.720" Score="1" Body="&lt;p&gt;This is really more than one question and for any answer to make sense, you have to come to terms (or be okay with) with Euler's formula: &#xA; $$e^{i\theta}=\cos(\theta) +i\sin(\theta)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a good &lt;a href=&quot;https://math.stackexchange.com/questions/993452/how-to-visulaize-euler-formula&quot;&gt;math.stackexchange&lt;/a&gt; with plenty of fodder to gain &lt;a href=&quot;http://www.ctralie.com/Teaching/Euler/&quot; rel=&quot;nofollow noreferrer&quot;&gt;intuition&lt;/a&gt;. Then reasoning about imaginary parts, harmonic conjugates, Hilbert &amp;amp; its relationship to Fourier becomes more straightforward. Also, it makes reading the docs for any (MATLAB) implementation less &quot;WTF?&quot;. Good luck.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-06-10T23:42:50.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24037" PostTypeId="1" CreationDate="2015-06-11T01:10:23.640" Score="1" ViewCount="100" Body="&lt;p&gt;I have taken an video of the following static scene for 10 mins (3 frames/Sec); totally 1800 frames for 10 mins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tPgZy.png&quot; alt=&quot;Static scene&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also show here the pixel time series, that is, a set of values of a particular pixel say (1,1) for 1800 frames..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bg46b.png&quot; alt=&quot;Pixel time series of the pixel (1,1)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could see a linear trend in the series. For some pixels the trend is increasing and for some the trend is decreasing. Due to trend, though the scene is static, there appears to be a small movement in the object. It is possible to de-trend it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Question is: what are the causes of this trend? I use a standard camera fixed on a immovable plane and I illuminate with light in order to photograph it.   &lt;/p&gt;&#xA;" OwnerUserId="8475" LastEditorUserId="8475" LastEditDate="2015-06-11T03:10:29.990" LastActivityDate="2015-07-03T09:19:34.077" Title="Pixel time series trend: What are the causes?" Tags="|image-processing|discrete-signals|signal-analysis|time-series|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24038" PostTypeId="2" ParentId="24035" CreationDate="2015-06-11T03:46:43.230" Score="1" Body="&lt;p&gt;Let us first see the theory.  By pulse train I guess you mean a periodic function from minus infinity to plus infinity.  Your pulse train will have the Fourier series(FS) in stead of Fourier transform(FT).  Fortunately the FT of a single pulse and the FS of the pulse train are related.  Let the pulse train be periodic with P Hz.  Then the FS of the pulse train will be sampled version of FT with a sampling rate of P Hz.  i.e. except for a scaling factor, the FS values are the samples of the FT sampled at P Hz. And the single pulse FT is a sinc function.  Thus pulse train will have FS coefficients which are samples of the sinc function.   &lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2015-06-11T03:46:43.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24039" PostTypeId="1" AcceptedAnswerId="24042" CreationDate="2015-06-11T03:51:19.577" Score="-1" ViewCount="67" Body="&lt;p&gt;Here are two $x$,$y$ coordinates: $(2,2)$ ,$(4,3)$.&#xA;And I want to know if I choose $x$ between above coordinate.&#xA;How can I know the $y$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I know a slope of line equation is like this.&#xA;$$y= mx+b$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I apply the coordinate into above equation.&#xA;$$m= \dfrac{3-2}{4-2} = \dfrac{1}{2}$$&#xA;$$b= 2$$&#xA;$$y= \dfrac{1}{2} x + b$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I choose $x$ to be $4$ then I can get a value $4$ not $3$.&#xA;I don't know how to resolve this problem.&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="7092" LastEditDate="2015-06-26T15:39:30.980" LastActivityDate="2015-06-26T15:39:30.980" Title="How can I get a equation of slope?" Tags="|camera-calibration|" AnswerCount="1" CommentCount="6" ClosedDate="2015-07-16T02:53:45.133" ContentLicense="CC BY-SA 3.0" />
  <row Id="24040" PostTypeId="1" CreationDate="2015-06-11T03:53:05.370" Score="5" ViewCount="2910" Body="&lt;p&gt;There are set of complementary sequences known as &lt;em&gt;Golay sequences&lt;/em&gt; that are used for channel estimation because of the nice property they have which is that the sum of the autocorrelation function of each gives dirac function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, these are two complementary sequences&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Ga=[+1, +1, +1, −1, +1, +1, −1, +1]$$&#xA;$$Gb=[+1, +1, +1, −1, −1, −1, +1, −1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_a(i)+R_b(i) = \delta(i)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to this nice correlation property, they are used in digital communication for as known pilot sequences for channel estimation of wireless channel. For example assume the channel we want to estimate is $h(t)$ then sending $Ga$ and $Gb$ over channel first and then performing correlation at receiver with Ga and Gb provides a good estimate of channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(h(t)*Ga)*Ga + (h(t)*Gb)*Gb =h(t)*(R_a+R_b)= h(t) \delta(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory, this is easy to understand. However I am trying to implement a more realistic setup in MATLAB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $G_a$ and $G_b$ are 10 chip in length with have a chip time of $T_c=0.57 ns$ and the channel is a 2 tap with delay spread of the channel is $T_{delay}=2.7 ns$. And assume we have Additive White Gaussian noise. My aim to estimate the channel. Below is my code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;channel =[1 0.2]';&#xA;Ga=[+1, +1, +1, -1, +1, +1, -1, +1]';&#xA;Gb=[+1, +1, +1, -1, -1, -1, +1, -1]';&#xA;y1=conv(channel,Ga);&#xA;y2=conv(channel,Gb);&#xA;r1=awgn(y1,10);&#xA;y2=awgn(y2,10);&#xA;hac1 = dsp.Autocorrelator;&#xA;correlation_output1=step(hac1,Ga);&#xA;correlation_output2=step(hac1,Gb);&#xA;channel_estimation=correlation_output1+ correlation_output2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can tell, I have not included the delay spread $T_{delay}$ neither the chip rate $T_c$. Can anyone help me understand how I can incorporate such in my MATLAB code?&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-06-11T11:43:18.270" LastActivityDate="2020-12-25T06:02:15.223" Title="Golay complementary sequences for channel estimation - MATLAB" Tags="|digital-communications|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24042" PostTypeId="2" ParentId="24039" CreationDate="2015-06-11T04:10:41.243" Score="1" Body="&lt;p&gt;Your $b$ is wrong. Take a look &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_equation&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. The form $y=mx+b$ is called Slope-Intercept form where $b$ is the intersection with the y-axis (which is 1 in your case). You should use the &lt;a href=&quot;http://en.wikipedia.org/wiki/Linear_equation#Two-point_form&quot; rel=&quot;nofollow&quot;&gt;two-point form&lt;/a&gt;:&#xA;$$&#xA;y - y_1 = \frac{y_2 - y_1}{x_2 - x_1} (x - x_1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which yields&#xA;$$&#xA;y - 2 = \frac{1}{2} (x - 2)&#xA;$$&#xA;or&#xA;$$&#xA;y = \frac{1}{2} x + 1&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-06-11T04:10:41.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24043" PostTypeId="2" ParentId="14306" CreationDate="2015-06-11T04:47:49.370" Score="1" Body="&lt;p&gt;I had a similar situation as yours and I chose the mean absolute percentage error &lt;a href=&quot;http://en.wikipedia.org/wiki/Mean_absolute_percentage_error&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Mean_absolute_percentage_error&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$mape=\dfrac{1}{n}\sum{\left|\dfrac{m_i-s_i}{m_i}\right|}$$ where $m_i$ and $s_i$ are the measured and simulated values resp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can implement this in &lt;code&gt;R&lt;/code&gt; as &lt;code&gt;mape = mean((m+s)/m)&lt;/code&gt; where &lt;code&gt;m&lt;/code&gt; and &lt;code&gt;s&lt;/code&gt; are arrays with the values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see the &lt;em&gt;mape&lt;/em&gt; at a specific point just use $$mape_i = \left|\dfrac{m_i-s_i}{m_i}\right|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like this because you can analyse how the error changes overtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used both errors measures.&#xA;I used the later because, in my problem, the domain was a parameter of my model, and I wanted to see how good my model was for different values of the parameter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer: I did computer science, thus I'm not mathematician nor statistician...&lt;/p&gt;&#xA;" OwnerUserId="16194" LastEditorUserId="8202" LastEditDate="2015-06-11T19:06:28.743" LastActivityDate="2015-06-11T19:06:28.743" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24044" PostTypeId="1" CreationDate="2015-06-11T04:49:00.867" Score="0" ViewCount="333" Body="&lt;p&gt;I have time series vibration signal recorded for 10 seconds. I segmented the vibration signal into a number of frames. I need to use an Auto-regressive model for this signal. AR model is used to extract the data from the vibration signal. The goal of an AR model is to estimate the AR coefficient  that can fit the original data as much as possible through an optimization process. I am going to classify the vibration signal using the AR coefficient as the features. In order to find the effective classification accuracy, frame analysis has been done. AR model coefficients are extracted from each frame. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is, how can I develop the AR model? How do I determine the order of polynomial from the AR model? And also how do I find the coefficient?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps, can anyone provide me the Matlab code for this?&lt;/p&gt;&#xA;" OwnerUserId="15614" LastEditorDisplayName="user11906" LastEditDate="2015-07-14T07:43:31.420" LastActivityDate="2015-07-14T07:43:31.420" Title="How to determine the order from Auto-Regressive model in Matlab?" Tags="|matlab|classification|autoregressive-model|" AnswerCount="0" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="24045" PostTypeId="2" ParentId="9518" CreationDate="2015-06-11T06:04:52.160" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;BlockquoteCan anyone explain what are Autoregressive Coefficients? What is their meaning that is.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;AR coefficients can be thought of as describing the envelope of the spectrum. In your function declaration you need to pass an order argument. The rule of thumb is that the order must be set to two times the expected number of peaks in the spectrum. So if you expect 5 peaks in the spectrum (as in speech) the order should be 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example where the block size is 256 and you for instance set order to 10 the AR coefficients provides a smooth and compact representation of the signal spectrum. It 'throws away' the details in the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Matt L $z^{-1} \rightarrow z^i$&lt;/p&gt;&#xA;" OwnerUserId="199" LastActivityDate="2015-06-11T06:04:52.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24047" PostTypeId="1" AcceptedAnswerId="24048" CreationDate="2015-06-11T08:02:03.277" Score="1" ViewCount="684" Body="&lt;p&gt;Does including log distance path loss to a communication system cause a drastic difference to the BER of the system? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if I have a simulation for a communication system without path loss, does the BER vs SNR curve differ drastically when I add path loss or should both the BER vs SNR curves(with and without path loss) look similar?&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-11-15T14:31:55.973" Title="Path loss effect on BER" Tags="|signal-analysis|digital-communications|dsp-core|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24048" PostTypeId="2" ParentId="24047" CreationDate="2015-06-11T08:59:05.130" Score="2" Body="&lt;p&gt;Generally speaking, the BER only depends on the SNR. If the received signal power $P_\mathrm{S}$ is reduced due to path loss, while the noise power $P_\mathrm{N}$ remains constant, then the SNR will be reduced, because the SNR is defined as&#xA;$$&#xA;\gamma = \frac{P_\mathrm{S}}{P_\mathrm{N}}&#xA;$$&#xA;Consequently, the BER will be increased and the answer to your first question is: yes. However, this should &lt;em&gt;not&lt;/em&gt; influence your BER vs SNR curves. Thus the answer to your second question is: no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your simulation behaves differently, i.e. if introducing a path loss &quot;shifts&quot; your BER curves, then the SNR is probably not calculated correctly. I suggest that you estimate the received signal power $\hat P_\mathrm{S}$ at the receiver (just before the sampler). Then the power of the additive noise should be calculated by&#xA;$$&#xA;P_\mathrm{N}=\frac{\hat P_\mathrm{S}}{\gamma}.&#xA;$$&#xA;Then add noise with mean power $P_\mathrm{N}$ to the received signal. With this setup, your BER/SNR curves should be independent of path loss.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-06-11T08:59:05.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24049" PostTypeId="2" ParentId="24023" CreationDate="2015-06-11T09:17:28.883" Score="0" Body="&lt;p&gt;If you want to remove noise from an image corrupted by a mixture of Poisson-Gaussian noise (e.g. low photon counts lead to a Poisson noise component, and detector noise gives the Gaussian component) then there are couple of options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a variance-stabilizing transform such as the Anscombe Transform to essentially make the noise Gaussian, then use any technique for additive Gaussian noise removal. A good example is &lt;em&gt;Optimal inversion of the Anscombe and Generalized Anscombe variance-stabilizing transformations&lt;/em&gt;, Mäkitalo &amp;amp; Foi (2014), &lt;a href=&quot;http://www.cs.tut.fi/~foi/papers/OptGenAnscombeInverse-doublecolumn-preprint.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; and &lt;a href=&quot;http://www.cs.tut.fi/~foi/invansc/&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Work with the Poisson-Gaussian statistics directly. For example, &lt;em&gt;Image Denoising in Mixed Poisson–Gaussian Noise&lt;/em&gt;, Luisier &lt;em&gt;et al.&lt;/em&gt; (2011), &lt;a href=&quot;http://bigwww.epfl.ch/publications/luisier1101.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; and &lt;a href=&quot;http://bigwww.epfl.ch/algorithms/denoise/&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt; are available.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8761" LastActivityDate="2015-06-11T09:17:28.883" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24050" PostTypeId="2" ParentId="19150" CreationDate="2015-06-11T10:42:59.000" Score="1" Body="&lt;p&gt;Using matlabs &lt;a href=&quot;http://uk.mathworks.com/help/dsp/ref/tf2cl.html&quot; rel=&quot;nofollow&quot;&gt;tf2cl&lt;/a&gt;, it may require the DSP toolbox, you can turn the transsfer function (numerator and denominator coefficients) in to a cascade allpass lattice coefficients, which is a two phase filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Generate some IIR filter coefficients&#xA;[b,a]=cheby1(9,.5,.4);&#xA;&#xA;% Coupled allpass decomposition&#xA;[k1,k2]=tf2cl(b,a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1603" LastActivityDate="2015-06-11T10:42:59.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24051" PostTypeId="1" AcceptedAnswerId="24055" CreationDate="2015-06-11T11:00:26.097" Score="0" ViewCount="388" Body="&lt;p&gt;A person can recognise a large variety of sounds and fairly subtle differences in sound, even if they have only heard the sound once.  Is it possible to recreate this with software, and how?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Consider these two problems:&lt;/em&gt;&lt;br&gt;&#xA;&lt;strong&gt;(1)&lt;/strong&gt;  You have a recording of a dog bark and a cat meow (same volume).  You then record another bark, how would you go about comparing the sounds in order to tell them apart?&lt;br&gt;&#xA;&lt;strong&gt;(2)&lt;/strong&gt;  A person says &quot;Yay&quot; and &quot;Tray&quot;.  Similar, but we can all tell the difference.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I have already investigated the following:&lt;/em&gt;&lt;br&gt;&#xA;&lt;strong&gt;(1)&lt;/strong&gt;  &lt;a href=&quot;http://en.wikipedia.org/wiki/Acoustic_fingerprint&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fingerprinting&lt;/a&gt;:  Does not work unless the sounds you are comparing are identical.  So it does not work if a different dog barks.  --- &lt;a href=&quot;http://willdrevo.com/fingerprinting-and-audio-recognition-with-python/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dejavu Python Package&lt;/a&gt; and &lt;a href=&quot;https://github.com/worldveil/dejavu&quot; rel=&quot;nofollow noreferrer&quot;&gt;its GitHub repo&lt;/a&gt;&lt;br&gt;&#xA;&lt;strong&gt;(2)&lt;/strong&gt;  &lt;a href=&quot;http://www.explainthatstuff.com/voicerecognition.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Generic Voice recognition&lt;/a&gt;:  Very inaccurate if the recorded word does not come with context.  Also, dogs and cat's don't speak English.  --- &lt;a href=&quot;https://github.com/Uberi/speech_recognition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python Speech recognition package&lt;/a&gt;, &lt;a href=&quot;http://cmusphinx.sourceforge.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CMU speech recognition&lt;/a&gt;&lt;br&gt;&#xA;&lt;strong&gt;(3)&lt;/strong&gt;  &lt;a href=&quot;http://en.wikipedia.org/wiki/Phoneme&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phonetics/ phonemes&lt;/a&gt;:  The breakup of a (speech) sound into constituent pieces.  E.g: &lt;code&gt;&quot;word&quot;&lt;/code&gt; becomes &lt;code&gt;w ə r d&lt;/code&gt;.  It returns rubbish if a sound is just taken out of context. --- &lt;a href=&quot;https://github.com/bambocher/pocketsphinx-python&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python pocketsphinx library&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/a/30715295/3421652&quot;&gt;example code&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16165" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-06-11T13:27:42.580" Title="How to emulate human sound recognition" Tags="|audio|sound|speech-recognition|classification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24052" PostTypeId="1" AcceptedAnswerId="25301" CreationDate="2015-06-11T11:34:57.180" Score="0" ViewCount="176" Body="&lt;p&gt;If possible, I would like to write a little script that can identify different musical instruments from just a recording.  Apart from variations of amplitude and frequency over time (which can be shown by time-dependant and spectrogram, respectively), what other variables are there?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, how would one do the classification?  Fingerprinting is an option, but that would only work if a single piece at a time is played.&lt;/p&gt;&#xA;" OwnerUserId="16165" LastActivityDate="2015-08-18T06:10:21.290" Title="Can software distinguish between different musical instruments" Tags="|audio|classification|music|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24054" PostTypeId="1" CreationDate="2015-06-11T12:48:18.203" Score="0" ViewCount="222" Body="&lt;p&gt;I would like to determine with high accuracy the relative distances between three RF transmitters a few meters apart by analysis of phase interference in the received wave, the receiver being at an undefined distance a few hundred meters away. Is there a simple method for this? The three RF transmitters can be arranged to transmit the same phase and frequency, or differing frequencies, whatever is required. Is there some kind of radar or reflection interferometry technique that exists and provides the information required, from reflectors?&lt;/p&gt;&#xA;" OwnerUserId="16200" LastActivityDate="2015-06-18T18:33:51.800" Title="How to determine relative distance between 3 in-phase transmitters by analysis of received signal" Tags="|fft|phase|distance-metrics|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24055" PostTypeId="2" ParentId="24051" CreationDate="2015-06-11T13:00:48.923" Score="2" Body="&lt;p&gt;I do not think that there is a standard approach to this problem, because as far as I know it has not yet been solved satisfactorily. I believe that you can find a solution to a (very) simplified version of the problem by restricting it for example to the recognition of a fixed set of animal sounds. The way to go would probably be to use methods from speech recognition (Hidden Markov Models, HMM), because the problem is similar to voice control systems, where commands from a fixed set of predefined commands are identified. With some good engineering, these systems can work relatively well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of animal sounds you would need to define a fixed set of animal sounds that you want to be able to recognize, collect a large database of such sounds, and use the data to train HMM models, which can then be used to score unknown sounds. Of course, such a system does not even come close to human capability of distinguishing sounds, but for such a restricted application it may work well enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in that sense I do not agree that voice control systems are &quot;very inaccurate&quot; if there is no context available, because that's the usual scenario for simple voice control systems, which can in fact be made to work in practice.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-11T13:00:48.923" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24056" PostTypeId="1" AcceptedAnswerId="24058" CreationDate="2015-06-11T13:30:28.783" Score="3" ViewCount="3412" Body="&lt;p&gt;I am reading &lt;a href=&quot;http://www.dsprelated.com/freebooks/mdft/Sinusoids_Exponentials.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; tutorial. Quoting the lines from the topic &quot;Analytic signals and Hilbert transform filters&quot;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the corresponding analytic signal $ z(t)=x(t) + j {\cal H}_t\{x\}$ has the property that all ``negative frequencies'' of $ x(t)$ have been &quot;&lt;strong&gt;filtered out&lt;/strong&gt;''&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have a few questions about this: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;what is the purpose of filtering out negative frequencies?&lt;/li&gt;&#xA;&lt;li&gt;What is the interpretation of filtering out negative frequency?&lt;/li&gt;&#xA;&lt;li&gt;What are negative frequencies in physical world? I read that&#xA;    negative frequencies doesn't exist and are introduced to simplify&#xA;    the mathematics behind theory.&lt;/li&gt;&#xA;&lt;li&gt;If negative frequencies don't exist, then why do we all plot two&#xA;sided spectrum?&lt;/li&gt;&#xA;&lt;li&gt;If negative frequencies exist, why do we only consider the first&#xA;half of an N-point FFT?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7868" LastEditorUserId="11256" LastEditDate="2015-06-11T14:21:46.947" LastActivityDate="2015-06-11T14:21:46.947" Title="What is the reason for filtering out the negative frequencies of a signal?" Tags="|fft|signal-analysis|frequency-spectrum|dft|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24057" PostTypeId="1" AcceptedAnswerId="24102" CreationDate="2015-06-11T13:33:22.223" Score="0" ViewCount="370" Body="&lt;p&gt;I have this state-space model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CyvqD.png&quot; alt=&quot;State Space&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this state space model nonlinear? If it is, why is that?&lt;/p&gt;&#xA;" OwnerUserId="16201" LastActivityDate="2015-06-13T15:21:15.890" Title="Is this model nonlinear?" Tags="|state-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24058" PostTypeId="2" ParentId="24056" CreationDate="2015-06-11T14:18:51.513" Score="3" Body="&lt;p&gt;I'll answer your questions out of order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Negative frequencies do exist. There is nothing controversial about them.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For a cosine signal: since $\cos(2\pi(-f)t)=\cos(2\pi ft)$, a cosine of negative frequency $-f$ is equal to a cosine of frequency $f$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since $\sin(2\pi(-f)t)=-\sin(2\pi ft)$, a sine of frequency $-f$ is $\pi$ radians out of phase with respect to a sine of frequency $f$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;More importantly, a complex exponential $e^{2\pi ft}$ can be represented by a point in the complex plane, which rotates counter-clockwise if $f$ is positive and clockwise if $f$ is negative.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;5.&lt;/strong&gt; It turns out that, for all physical signals (whose imaginary part is zero), the magnitude spectrum is even (the negative frequencies are a mirror image of the positive frequencies). There is no need to display or calculate them. That's the reason a spectrum analyzer will only display positive frequencies. Complex signals do not have an even magnitude spectrum, and you need to calculate it for negative as well as positive frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Filtering out the negative frequencies is just that: remove the negative frequencies of a signal. The result is a complex signal, because the resulting spectrum is not even. The Hilbert transform you mention at the start of your question is an easy way to implement such a filter. Without it, you'd need a complex filter, which are not trivial to implement and use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; There can be many reasons to filter out the negative frequencies of a signal. In digital communications, it is used as one step in obtaining the &lt;em&gt;complex envelope&lt;/em&gt; of a modulated signal. In general, a modulated signal looks like $s(t)=\Re[a(t)e^{2\pi f_ct}]$, where $a(t)$ is a quadrature signal, and is complex, and where $f_c$ is very large (up to several gigahertz). However, the information is contained in $a(t)$, so we would like to recover it from $s(t)$. This is accomplished by:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Filtering out the negative frequencies of $s(t)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Downconverting the result to baseband&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-11T14:18:51.513" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24059" PostTypeId="1" CreationDate="2015-06-11T14:39:45.593" Score="1" ViewCount="104" Body="&lt;p&gt;A follow on question form this one (&lt;a href=&quot;https://dsp.stackexchange.com/questions/1358/what-is-meant-by-spectral-moment&quot;&gt;What is meant by &amp;quot;spectral moment&amp;quot;?&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In answers to the above referenced question spectral moment is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;m_k=\int_{-\infty}^{\infty} f^k|X(f)|^2\ df&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The limits on the integral include negative frequency. So is the negative frequency really important? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I filter out all negative frequencies before calculating the moments will they be wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $|X_f|^2$ is symmetrical about zero then does this not mean that $m_k=0$ for all odd values of $k$?&lt;/p&gt;&#xA;" OwnerUserId="16205" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-06-11T15:12:22.757" Title="Is negative frequency important in calculating Spectral Moments" Tags="|fft|signal-analysis|frequency-spectrum|dft|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24061" PostTypeId="1" CreationDate="2015-06-11T15:04:49.477" Score="1" ViewCount="528" Body="&lt;p&gt;I have a pitch tracker that can be quite unsmooth in its output (in Hz). A Savitzky-Golay filter has been good at smoothing but it looks like it adds a lot of multiplies on top of the already intensive &lt;code&gt;O(N^2)&lt;/code&gt; multiplies from the autocorrelator doing the pitch tracking. Should I just do linearly interpolate between the previous point, or the point before that? What else can I look into? Will a single lowpass biquad deal with it?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-06-11T15:04:49.477" Title="Computationally 'lightweight' smoothing in realtime" Tags="|smoothing|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24062" PostTypeId="1" CreationDate="2015-06-11T15:17:52.193" Score="3" ViewCount="602" Body="&lt;p&gt;If a sequence of +1 and -1 with chip rate ($\frac{1}{0.57 ns}$) is being used for purpose of estimating channel impulse response with delay spread of 6ns. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We decide to have a new rate change to rate $\frac{1}{0.38 ns} $. Then in the digital domain we upsample by 3 the initial signal, filter than downsample by 2  and we have a new sequence with new chip rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, given the fact that the to &lt;em&gt;sequence length should be longer than maximum length of channel impulse response to estimate CIF accurately&lt;/em&gt; in this case $6 ns$. What is the number of chips that is required for best estimation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two possible answers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Minimum number of chips * 0.57 $\geq 6 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Minimum number of chips * 0.38 $\geq 6 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the correct answer is 2, what do you think?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15315" LastEditorUserId="15315" LastEditDate="2015-06-14T15:22:39.703" LastActivityDate="2015-06-14T15:22:39.703" Title="Chip rate and sample rate" Tags="|sampling|digital-communications|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24063" PostTypeId="2" ParentId="10204" CreationDate="2015-06-11T15:21:27.283" Score="1" Body="&lt;p&gt;If there are more zeros than poles, then there  is added lags(power of Z^(-1)) in the output which makes the output more lagged while the input remain the same. This makes the system non-causal.&lt;/p&gt;&#xA;" OwnerUserId="16208" LastActivityDate="2015-06-11T15:21:27.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24064" PostTypeId="1" CreationDate="2015-06-11T16:28:10.487" Score="3" ViewCount="9083" Body="&lt;p&gt;I am working on my paper about comparing between mean filter and ordering statistics filter, The mean filter is contraharmonic mean filter and the ordering statistic filter is alphatrimmed mean filter. So, I compare contraharmonic mean filter and alphatrimmed mean filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and i've read a slide presentation that explain mean filter is good for removing some kind of gaussian noise (uniform noise) and order statistics filter is good for removing some kind of exponential noise and salt &amp;amp; pepper noise (rayleigh noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody here show me the book source of that statement? is it in gonzales book? Thank you so much, your answers will help me a lot&#xA;and sorry for my poor english :(&lt;/p&gt;&#xA;" OwnerUserId="16210" LastActivityDate="2016-04-12T09:45:57.740" Title="difference between mean filter and order statistic filter" Tags="|image-processing|filtering|" AnswerCount="4" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24066" PostTypeId="1" AcceptedAnswerId="24070" CreationDate="2015-06-11T16:45:00.503" Score="0" ViewCount="179" Body="&lt;p&gt;&lt;a href=&quot;http://www.ericsson.com/res/thecompany/docs/journal_conference_papers/atsp/effect_of_transmitter_and_receiver_impairments_on_the_performance_of_mimo_in_hsdpa.pdf&quot; rel=&quot;nofollow&quot;&gt;A paper I read&lt;/a&gt; studied the effect of transmitter impairments and receiver impairments by modeling both as additive white Gaussian noise. The noise for transmitter impairmenets are added before the antenna before transmission. The noise modelling receiver impairments is added as an additional white Gaussian noise to the thermal white Gaussian noise. A conclusion was made as follows&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The main reason for this is that the noise added at the transmitter (modeling Tx EVM) experiences the same frequency- and time-selective fading as the desired signal. In contrast, the noise added at the receiver (modeling Rx EVM) does not experience frequency-selective fading (only time-selective fading).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does the quoted conclusion above make sense?&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="1629" LastEditDate="2016-05-19T08:24:10.420" LastActivityDate="2016-05-19T08:24:10.420" Title="Modelling transmitter and receiver impairments in communication system" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24068" PostTypeId="1" AcceptedAnswerId="24072" CreationDate="2015-06-11T18:54:35.707" Score="5" ViewCount="11503" Body="&lt;p&gt;I have a program that uses OpenCV to compute either the convolution or cross-correlation of an image with a specified kernel. I compute cross-correlation by setting the conjB flag to true when calling &lt;a href=&quot;http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#mulspectrums&quot; rel=&quot;noreferrer&quot;&gt;cv::mulSpectrums&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution consistently produces correct results. However, the result of cross-correlation is always wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the convolution results, the spectra of the kernel and image are correct. The only change is that the kernel spectrum is conjugated before multiplying. Both were computed using cv::dft, and so are in the CCS-packed format expected by mulSpectrums. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm comparing the result with the output from scipy.signal.correlate, using Python. I tried flipping the the kernel before computing the DFT, and that produces the correct cross-correlation. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::dft( dft_buf, dft_buf, 1, img_in.rows );&#xA;cv::mulSpectrums( dft_buf, kernel_dft, dft_buf, 0, CORRELATE );&#xA;dft( dft_buf, dft_buf, cv::DFT_INVERSE + cv::DFT_SCALE, kernel.rows/2 + img_in.rows );&#xA;&#xA;int col_offset = ( kernel.cols % 2 ) ? ( kernel.cols/2 ) : ( kernel.cols/2 - 1 ); // is odd?&#xA;int row_offset = ( kernel.rows % 2 ) ? ( kernel.rows/2 ) : ( kernel.rows/2 - 1 );&#xA;&#xA;cv::Mat result_roi( dft_buf, cv::Rect( col_offset, row_offset, img_in.cols, img_in.rows ) );&#xA;result_roi.copyTo( img_out );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16212" LastActivityDate="2015-06-13T16:09:16.913" Title="Computing cross-correlation of two images using OpenCV" Tags="|image-processing|dft|opencv|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24069" PostTypeId="1" CreationDate="2015-06-11T18:57:12.983" Score="3" ViewCount="534" Body="&lt;p&gt;I have a question on CP-OFDM.&#xA;In recent years people are talking about filter bank approach where they are trying to filter out the out of band side lobes using filters. Besides they are presuming that this approach may provide some robustness and spectral efficiency since they can get rid of CP. Is this true and what aspects we can remove CP and make spectral efficiency equal one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ref.&#xA;F. Schaich, T. Wild, Y. Chen , „&lt;a href=&quot;https://www.metis2020.com/wp-content/uploads/publications/VTCSpring_2014_Schaich_etal_WaveformContendersFor5G.pdf&quot; rel=&quot;nofollow&quot;&gt;Waveform contenders for 5G – suitability for short packet and low latency transmissions&lt;/a&gt;“, accepted for IEEE VTCs’14, Seoul, Korea, April 2014&lt;/p&gt;&#xA;" OwnerUserId="11197" LastActivityDate="2015-09-10T09:14:46.597" Title="Necessity of Cyclic Prefix in OFDM" Tags="|filter-design|digital-communications|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24070" PostTypeId="2" ParentId="24066" CreationDate="2015-06-11T19:10:33.040" Score="0" Body="&lt;p&gt;It makes sense to me. If the ideal transmitted signal is $s(t)$, the signal that is actually transmitted is $s(t)$ plus noise and distortion. This is the signal that suffers attenuation and fading, and to which an extra heaping of noise and distortion is added in the receiver. Modeling transmitter imperfections is not something that is included in most introductory textbooks, but it's very important to implement a system with good performance. You may see for example &quot;RF System Design of Transceivers for Wireless Communications&quot; by Qizheng Gu for more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, modeling the transmitter imperfections as just Gaussian noise is a bit optimistic, but it may be a step in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-11T19:10:33.040" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24071" PostTypeId="1" AcceptedAnswerId="24075" CreationDate="2015-06-11T19:11:12.347" Score="0" ViewCount="1324" Body="&lt;p&gt;I have a function with an equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C = 1.6925\left( e^{-0.136t}-e^{-1.192t}\right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $C$ is real and $t$ represents time in hours. Beneath is the representation of my function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sHk7j.jpg&quot; alt=&quot;Represents a pharmaceutical drug concentration increase and decay in the body from absorption point at t=0&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to find the best sampling step (based on Nyquist-Shannon theorem) to sample and reconstruct this function using a Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After using a Fast Fourier Transform algorithm in MATLAB (&lt;code&gt;fft&lt;/code&gt;), by setting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x= fft(c);&#xA;xmag=abs(x); (amplitude estimation)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I find the below spectrum for the function for a $t$ between $0$ and $100$ sampled at $1000 \text{Hz}$  , with the highest amplitude at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;bin(1) = 1.1025e+04&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the second highest at &lt;code&gt;bin(100001)&lt;/code&gt; with an amplitude of &lt;code&gt;9.9946e+03&lt;/code&gt;. the bin number &lt;code&gt;100001&lt;/code&gt; represents also the length of &lt;code&gt;xmag&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is how would you interpret the spectrum? Specifically I would like to know how to determine the highest frequency at which I can sample this function and reconstruct it without aliasing?&#xA;&lt;img src=&quot;https://i.stack.imgur.com/olUXd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16213" LastEditorUserId="8202" LastEditDate="2015-06-11T19:21:18.903" LastActivityDate="2015-06-12T03:03:42.237" Title="Sample and reconstruct a real exponential (just one period)" Tags="|sampling|reconstruction|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24072" PostTypeId="2" ParentId="24068" CreationDate="2015-06-11T22:02:50.643" Score="4" Body="&lt;p&gt;On closer inspection, I discovered that the erroneous correlation result resembles the correct result, but shifted up and to the left. The former was displayed in scientific format, so it was hard to see the pattern at first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that taking the conjugate is equivalent to flipping the whole zero-padded kernel, and not just the original kernel (which is what we want). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The naive response would be to simply select another ROI from the output. However, the result is actually shifted circularly, so that wouldn't work. The correct result is present, but disjoint. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two possible solutions: flip the kernel before zero-padding it and computing the DFT, or change the location of the image in the zero-pad buffer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did was place the image with the upper-left corner at (kernel.cols-1, kernel.rows-1). The kernel is at (0,0), but taking the conjugate flips it vertically and horizontally. Multiplying the DFTs implicitly flips it again (convolution). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the DFT multiplication property is equivalent to a circular convolution, the kernel buffer wraps around diagonally. So it will be the trailing portion, or &quot;wrapped&quot; part of the kernel buffer that &quot;slides&quot; across the image, and not the leading edge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2D circular convolution can be visualized as a plain containing infinite adjacent copies of the zero-padded image. Rather than wrapping the zero-padded kernel around, it can be visualized as linear convolution with the lower-right copy, with adjacent copies providing the &quot;history.&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;111100000 | 111100000&#xA;111100000 | 111100000&#xA;000000000 | 000000000&#xA;000000000 | 000000000&#xA;----------------------&#xA;111100000 | 111100000&#xA;111100000 | 111100000&#xA;000000000 | 000000000&#xA;000000000 | 000000000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For correlation with a 2x2 kernel, you could change it to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;000000000 | 000000000&#xA;011110000 | 011110000&#xA;011110000 | 011110000&#xA;000000000 | 000000000&#xA;----------------------&#xA;000000000 | 000000000&#xA;011110000 | 011110000&#xA;011110000 | 011110000&#xA;000000000 | 000000000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You might think that the image should actually be shifted down and to the right by one more space, so that the &quot;wrapped&quot; kernel buffer will start with the kernel overlapping only the upper-left element of the image. The idea being that, convolution will first flip the conjugate kernel to look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;110000000&#xA;110000000&#xA;000000000&#xA;000000000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, this is incorrect. The conjugate symmetry of the Fourier Transform states that flipping a signal, or an image, is equivalent to taking the complex conjugate of its Fourier Transform. However, the computer representation of the time-series is different than expected. For a 1D signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 1, 2, 3, 4, 0, 0 ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;flips to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 1, 0, 0, 4, 3, 2 ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and not:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 0, 0, 4, 3, 2, 1 ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Carrying this over to 2D, our 2x2 kernel would actually look like this, after conjugating its DFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;100000001&#xA;000000000&#xA;000000000&#xA;100000001&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's difficult to visualize how to index the correlation using this kernel. However, in 1D, this can be interpreted as flipping the array, and then circular shifting by one to the right. In 2D, it flips the kernel vertically and horizontally, and then circular shifts it down and right by one. What this means is that the kernel will be up and to the left by one more than expected at the start of convolution. I'll scale the kernel by 2 to make this easier to show. So instead of this (kernel 2s, image 1s) :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;000000000&#xA;022000000&#xA;022111000&#xA;001111000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We have this (note that the image has been moved accordingly):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;220000000&#xA;221110000&#xA;011110000&#xA;000000000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Remember that I'm showing the wrapped portion of the kernel buffer here, at the start of convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is hard to really show without an animation, but this is the best I could do here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// copy image to buffer&#xA;int col_offset = ( CORRELATE ) ? ( kernel.cols - 1 ) : ( 0 );&#xA;int row_offset = ( CORRELATE ) ? ( kernel.rows - 1 ) : ( 0 );&#xA;cv::Mat image_roi( dft_buf, cv::Rect( col_offset, row_offset, img_in.cols, img_in.rows ) );&#xA;img_in.copyTo( image_roi );&#xA;&#xA;// Compute DFT of image, and multiply it with kernel DFT&#xA;int non_zero_rows = ( CORRELATE ) ? ( img_in.rows + kernel.rows - 1 ) : ( img_in.rows );&#xA;cv::dft( dft_buf, dft_buf, 0, non_zero_rows );&#xA;cv::mulSpectrums( dft_buf, kernel_dft, dft_buf, 0, CORRELATE );&#xA;&#xA;// Compute IDFT&#xA;dft( dft_buf, dft_buf, cv::DFT_INVERSE + cv::DFT_SCALE, kernel.rows/2 + img_in.rows );&#xA;&#xA;// Select ROI from result, and either copy or pass reference to output buffer&#xA;col_offset = ( kernel.cols % 2 ) ? ( kernel.cols/2 ) : ( kernel.cols/2 - 1 ); // is odd?&#xA;row_offset = ( kernel.rows % 2 ) ? ( kernel.rows/2 ) : ( kernel.rows/2 - 1 );&#xA;cv::Mat result_roi( dft_buf, cv::Rect( col_offset, row_offset, img_in.cols, img_in.rows ) );&#xA;result_roi.copyTo( img_out );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16212" LastEditorUserId="16212" LastEditDate="2015-06-13T16:09:16.913" LastActivityDate="2015-06-13T16:09:16.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24074" PostTypeId="2" ParentId="24071" CreationDate="2015-06-12T00:25:23.923" Score="-1" Body="&lt;p&gt;How did you arrive at sampling frequency of 1000 Hz?  Ideally speaking, you should find the Fourier transform of the given function analytically.  This can be done using the FT tables for exponentials.  Then you should find the highest frequency beyond which the FT is almost zero i.e less than the smallest number represented by finite precision you are using. Twice or more of this frequency is your sampling rate.  How many samples should you take?  The signal is almost zero beyond 5 x 10$^4$  as can be seen from the figure.  So you take samples upto this time point.  Now you take the FFT of these samples and it would be equal to the FT you analytically calculated i.e it would be sampled version of the FT.  If you used sampling rate less than this procedure explained, the resulting FFT would be aliased version.&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="15664" LastEditDate="2015-06-12T01:14:36.063" LastActivityDate="2015-06-12T01:14:36.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24075" PostTypeId="2" ParentId="24071" CreationDate="2015-06-12T03:03:42.237" Score="2" Body="&lt;p&gt;First, since $t&amp;gt;0$ in your case, you can write your function as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;C(t)=1.6925\left(\exp^{-0.136t}- \exp^{-1.192t} \right) u(t)&#xA;\end{equation}&#xA;where $u(t)$ is a unit-step function. Then, denote the FT of $C(t)$ as $C(F)$, which is given by&#xA;\begin{equation}&#xA;C(f)=1.6925\left(\frac{1}{0.136+2\pi jf}- \frac{1}{1.192+ 2\pi jf} \right) &#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectrum $C(f)$ is plotted below. We can see that $C(f)$ is almost zero after 5 Hz. You can choose the sampling frequency according to the Nyquist criterion as $f_{\max} \geq 10$ Hz. You have taken a very high sampling rate (1000 Hz) that is 100 times more than the required rate. When I took 10 Hz to sample the signal above and took the FFT I got the results as follows  (in order time domain $C(t)$, frequency domain signal $C(f)$, frequency domain domain signal obtained via FFT, that is, FFT(C(t)). Note the inherent periodicity of the FFT spectrum) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gx2gD.png&quot; alt=&quot;Fig.1 &quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VsLe1.png&quot; alt=&quot;Fig. 2&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TWG57.png&quot; alt=&quot;Fig. 3&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the MATLAB/Octave code for your reference..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; clc;close all;&#xA;&#xA;%% Time-domain signal&#xA;Ts=0.1; % Sampling time (obtained from the frequency domain plot)&#xA;t=0:Ts:60; % in sec&#xA;C=1.6925* (exp(-0.136*t)-exp(-1.192*t));&#xA;figure,plot(t,C);&#xA;title('Time domain signal');&#xA;xlabel('Time in sec')&#xA;&#xA;%Frequency domain signal&#xA;f=0:.1:10;&#xA;F1=1.6925*((1./(0.136+(j*2*pi*f)))-(1./(1.192+(j*2*pi*f))));&#xA;figure,plot(f,abs(F1));&#xA;title('Frequency domain signal');&#xA;xlabel('Frequency in Hz')&#xA;% Via FFT&#xA;F2=fft(C);&#xA;L=length(F2);&#xA;figure,plot((0:L-1)*(1/(L*Ts)),abs(F2));&#xA;title('Frequency domain signal via FFT of C(t)');&#xA;xlabel('Frequency in Hz')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2015-06-12T03:03:42.237" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24076" PostTypeId="1" CreationDate="2015-06-12T06:07:01.727" Score="0" ViewCount="65" Body="&lt;p&gt;I'm trying to apply a goertzel filter on my sound data of 20500 Hz with sampling rate of 44100[samples/sec]. My bit duration which is passed to the goertzel function is returning a very low magnitude at high freqs. So, I've noticed that as bit duration is lower the magnitude also is lower. The 2 parameters of increasing the freq and decreasing the singal's duration is making the magnitude be closer to 0. For instance: 0.00005.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw on wikipedia that the filter has 2 poles on the unity circle of it's Z-Transform - causing it be unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: if I use a very small signal duration, for example 5ms would it make a sense to duplicate this frame's singal several times to make the whole new frame larger so the goertzel have a lot of more samples?&lt;/p&gt;&#xA;" OwnerUserId="15637" LastActivityDate="2015-06-12T06:07:01.727" Title="Goertzel filter Poles on unity circle influence of a behavior of a signal at high frequency" Tags="|signal-analysis|audio|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24077" PostTypeId="2" ParentId="24069" CreationDate="2015-06-12T07:19:28.553" Score="1" Body="&lt;p&gt;In CP-OFDM, the transmitted signal is the output of the IDFT appended with a cyclic prefix. No pulse-shaping is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In so-called &quot;new waveforms&quot; proposed as candidate for 5G, pulse shaping is heavily used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In FBMC, each subcarrier (i.e each complex exponential) is convoluted with a pulse with a certain shape (usually a bell shape with beginning and end at zero amplitude). As a consequence of convolution, the amplitude of each filtered subcarrier at the beginning and at the end of the multicarrier symbol goes to zero. &#xA;Consequently, in case of multi-path, this zero-valued beginnings and ends avoid ISI, since the part of the previous symbol overlapping most with the current one is its end, which as we said is zero-valued (or almost) and the current symbol has little energy at its beginning (zero or almost).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="16058" LastActivityDate="2015-06-12T07:19:28.553" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24078" PostTypeId="2" ParentId="19150" CreationDate="2015-06-12T08:36:15.967" Score="2" Body="&lt;p&gt;I assume that you are trying to rewrite your transfer function $H(z)$ as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \sum_{i=0}^{N-1} A_i(z^N),$$&#xA;where $A_i(z^N)$ are allpass filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, no, as the pole and zero locations are related when you implement it as parallel all pass filters. It typically works for the standard filter approximations and $N=2$ filters though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you may be looking for are the papers Recursive Nth-band digital filters - Parts I and II by Renfors and Saramäki. These describe how to design filters which consists of N parallel allpass filters, each allpass filter being a polynomial in $z^N$, and are useful for decimation/interpolation as one can change order of filtering and compression/expansion.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2015-06-12T09:00:26.457" LastActivityDate="2015-06-12T09:00:26.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24079" PostTypeId="1" CreationDate="2015-06-12T14:34:38.830" Score="1" ViewCount="2265" Body="&lt;p&gt;Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pyaudio&#xA;import wave&#xA;import sys&#xA;import spl_lib as spl &#xA;from scipy.signal import lfilter&#xA;import numpy&#xA;&#xA;CHUNK = 4096   # This is the sample size&#xA;               # math.pow(2, 12) =&amp;gt; RATE / CHUNK = 100ms = 0.1 sec&#xA;FORMAT = pyaudio.paInt16    # 16 bit&#xA;CHANNEL = 1    # 1 means mono. If stereo, put 2&#xA;RATE = 48000&#xA;&#xA;error_count = 0&#xA;numerator, denominator = spl.A_weighting(RATE)&#xA;&#xA;pa = pyaudio.PyAudio()&#xA;&#xA;stream = pa.open(format = FORMAT,&#xA;                channels = CHANNEL,&#xA;                rate = RATE,&#xA;                input = True,&#xA;                frames_per_buffer = CHUNK)&#xA;&#xA;&#xA;print &quot;Listening&quot;&#xA;&#xA;while True:&#xA;    try:&#xA;        # read() returns string. You need to decode it into an array later.&#xA;        block = stream.read(CHUNK)&#xA;    except IOError, e:&#xA;        error_count += 1&#xA;        print(&quot; (%d) Error recording: %s&quot; % (errorcount, e))&#xA;&#xA;    decoded_block = numpy.fromstring(block, 'Int16')&#xA;    y = lfilter(numerator, denominator, decoded_block)&#xA;    decibel = 20*numpy.log10(spl.rms_flat(y))&#xA;    print('A-weighted: {:+.2f} dB'.format(decibel))&#xA;&#xA;&#xA;stream.stop_stream()&#xA;stream.close()&#xA;pa.terminate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code is calculating dBA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set CHUNK as 4096 because it is approximately 100ms and I thought that's a reasonable length. I thought chunk sizes should be power of 2 because all the web articles I read had 1024. This threw an error about every 1 second:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Errno Input overflowed] -9981&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought it was a memory issue but when I ran &quot;top&quot; or &quot;free -m&quot; I had enough memory. Then I changed the chunk size as 8192(2^13) and 1024. I expected chunk size of 8192 would throw more error as it will have calculations with larger buffer. However the result was interesting. It didn't matter whether it was 256 or 8192. They were all small enough for Raspberry Pi 2. However, what was more interesting or even exciting was that small difference of chunk size would bring dramatically different results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a chunk size of 258, error happened for every loop when 256 was error-free.&#xA;I carefully made an assumption: Why does a chunk size should be a power of 2? So I tried with 4800 which is a tenth of 48000 and then it didn't throw any error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm really confused. What is it to do with chunk size? Does it necessarily need to be power of 2? Why did 256 didn't throw an error when 258 threw error on every loop?&lt;/p&gt;&#xA;" OwnerUserId="16224" LastActivityDate="2015-06-12T14:34:38.830" Title="What is a proper chunk size for audio analysis?" Tags="|signal-analysis|audio|" AnswerCount="0" CommentCount="5" ClosedDate="2015-06-13T03:41:03.330" ContentLicense="CC BY-SA 3.0" />
  <row Id="24080" PostTypeId="1" CreationDate="2015-06-12T15:56:05.440" Score="0" ViewCount="86" Body="&lt;p&gt;I'm using FFTW to compute some DFTs, and as a memory space optimization, you can give it a $v \in \mathbb{R}^{n}$ and it will return a $\hat{v} \in \mathbb{C}^{\lfloor n/2 \rfloor + 1}$ via the call &lt;code&gt;fftw_execute_dft_r2c&lt;/code&gt;. (To those without context, it's just claiming that since $\overline{\hat{v}_{k}} = \hat{v}_{n-k}$, then you just don't need to care about the top half of the complex vector.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, you can take $\hat{v}$ back to $\mathbb{R}^{n}$ via &lt;code&gt;fftw_execute_dft_c2r&lt;/code&gt;, but of course no one does that, they want to apply some filter to $\hat{v}$ and then call &lt;code&gt;fftw_execute_dft_c2r&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the largest class of operations on $\hat{v}$ such that &lt;code&gt;fftw_execute_dft_c2r&lt;/code&gt; make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Clearly, pointwise multiplication by the DFT of another real function is allowed, but it's not clear to me that every bandpass filter produces a sensible output and many other operations seem suspect.)&lt;/p&gt;&#xA;" OwnerUserId="16227" LastActivityDate="2015-08-12T11:31:59.003" Title="Conditions on $v \in \mathbb{C}^{n}$ such that the complex to real DFT is sensible" Tags="|fft|filters|dft|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24082" PostTypeId="2" ParentId="19629" CreationDate="2015-06-12T16:59:41.280" Score="2" Body="&lt;p&gt;The SciPy library for scientific computing in Python contains functions for Savitzky-Golay filtering in its &lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.15.1/reference/signal.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;scipy.signal&lt;/code&gt; module&lt;/a&gt; since version 0.14.0, specifically you'll most likely be interested in the &lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.signal.savgol_coeffs.html#scipy.signal.savgol_coeffs&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;scipy.signal.savgol_coeffs&lt;/code&gt; function&lt;/a&gt; if you're only interested in the coefficients, or the &lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.signal.savgol_filter.html#scipy.signal.savgol_filter&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;scipy.signal.savgol_filter&lt;/code&gt; function&lt;/a&gt; which provides a nice interface for filtering alone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When implementing some DSP method in Python, it's usually best to look into SciPy or scikits-* libraries rather than reinvent the wheel.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastActivityDate="2015-06-12T16:59:41.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24083" PostTypeId="1" AcceptedAnswerId="24114" CreationDate="2015-06-12T17:59:57.200" Score="0" ViewCount="253" Body="&lt;p&gt;I'm working on an application where I want to grab high-resolution pieces of the spectrum, but I don't need the whole spectrum-- just a few bands. I've looked into using the Goertzel algorithm (too slow; with the number of points we want the regular FFT is faster), &lt;a href=&quot;http://www.fftw.org/pruned.html&quot; rel=&quot;nofollow&quot;&gt;pruned FFTs&lt;/a&gt; (doesn't look like much of an improvement in performance), and &lt;a href=&quot;http://cnx.org/contents/3dea9cf9-32b6-4bf2-940b-cf8d251a0a84@15/Uniformally_Modulated_%28DFT%29_Fi&quot; rel=&quot;nofollow&quot;&gt;polyphase filter banks (PFBs)&lt;/a&gt; (the problem being that it requires an FFT of the same size that I would have otherwise already computed, defeating the point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The books that I've looked at so far (&quot;Digital Signal Processing, 4th ed&quot; by Proakis/Manolakis and &quot;Signal Analysis: Wavelets, Filter Banks, Time-Frequency Transforms and Applications&quot; by Mertins) both focus on either &quot;critically sampled&quot;, where the decimation rate $D$ equals the number of subbands $N$ or &quot;oversampled&quot; where $N &amp;gt; D$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to produce a computationally efficient PFB such that $D &amp;gt; N$? In my application the loss of information is unimportant because I only need a few subbands of small bandwidth. &lt;/p&gt;&#xA;" OwnerDisplayName="user16223" LastActivityDate="2015-06-14T12:44:02.687" Title="&quot;Undersampled&quot; Polyphase Filter Bank" Tags="|frequency-spectrum|filter-bank|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24084" PostTypeId="2" ParentId="24080" CreationDate="2015-06-12T18:43:05.070" Score="1" Body="&lt;p&gt;Obviously any operation is allowed that keeps the symmetry of the frequency domain data intact, i.e. any operation that doesn't add an imaginary part to the time domain sequence. And this is the case for all standard filtering operations unless you &lt;em&gt;want&lt;/em&gt; to generate a complex valued (time-domain) signal by some operation. This could be the case if you want to generate an analytic signal, but in that case you actually make &lt;em&gt;two&lt;/em&gt; signals out of one (the real part and the imaginary part in the time domain). So for normal low pass, band pass, high pass etc. filtering you don't need to worry. As long as you do things right, the symmetry of the time domain sequence should not be changed by these operations.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-13T07:39:09.230" LastActivityDate="2015-06-13T07:39:09.230" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24086" PostTypeId="1" CreationDate="2015-06-12T20:08:45.713" Score="1" ViewCount="628" Body="&lt;p&gt;I have a range of songs where I have took an 'unfolded' chromagram computed from a series of short-term windows.  Specifically, for one song, I have one vector which contains the amplitudes of the chroma's, and a second vector which contains the corresponding MIDI notes.  For now, I can plot a histogram of the amplitudes w.r.t the MIDI notes that gives me a visual idea of the range of notes used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two songs graphed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/bilOX.jpg&quot; alt=&quot;graphs&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we can see, the 'classical' example is in my opinion more sparse than its neighbouring graph.  I've been trying to figure out a way as to how to measure for something like this, since I need to fold such a feature vector into 1 useful statistic.&lt;/p&gt;&#xA;" OwnerUserId="15770" LastEditorUserId="15892" LastEditDate="2015-10-24T19:12:08.717" LastActivityDate="2016-01-22T20:50:46.077" Title="Determining The Sparsity or Density of a Chroma Vector" Tags="|matlab|audio|sparsity|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24087" PostTypeId="1" CreationDate="2015-06-12T21:25:21.247" Score="2" ViewCount="1025" Body="&lt;p&gt;Currently I'm using the built-in Equalizer (EQ) object from Matlab to equalize my signal. For the EQ there is a parameter called the Reference tap. With different value of the reference tap i got also different results and maybe also different delay of the EQ. My question is: what exactly is the reference tap of a FIR filter and how should i set it to achieve the best performance ? Thank you in advance LA&lt;/p&gt;&#xA;" OwnerUserId="16231" LastActivityDate="2015-08-12T09:27:36.700" Title="What is the Reference tap of an equalizer (FIR Filter)" Tags="|filter-design|finite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24088" PostTypeId="1" AcceptedAnswerId="24095" CreationDate="2015-06-12T23:36:33.620" Score="0" ViewCount="42" Body="&lt;p&gt;Let $F[z]=N^2\frac{z(z-(3+j\sqrt{7})/2)(z-(3-j\sqrt{7})/2)}{(z-1)^3}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has 3 poles at $z=1$; one zero at $z=0$; and a conjugate pair of zeros at $z=\frac{3\pm{}j\sqrt{7}}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming a contour $H$ encircles these roots and zeros, a unique inverse is obtained from direct inversion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f=\frac{1}{2{\pi}j}\oint_H Fz^{n-1} \,dz$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What, if any, is the mathematical interpretation of taking a contour around a single pole or zero?&lt;/p&gt;&#xA;" OwnerUserId="16141" LastActivityDate="2015-06-13T11:02:53.387" Title="What is the mathematical interpretation of using direct inversion around a single pole/zero" Tags="|filters|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24089" PostTypeId="1" CreationDate="2015-06-13T06:34:32.273" Score="0" ViewCount="303" Body="&lt;p&gt;OCR is a quite an old subject in Image Processing &amp;amp; Vision. However, the most literature that I had come across &lt;a href=&quot;http://www.ijmlc.org/papers/137-L0022.pdf&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;http://www.airccse.org/journal/ijcses/papers/3412ijcses03.pdf&quot; rel=&quot;nofollow&quot;&gt;2&lt;/a&gt;, &lt;a href=&quot;http://www.academia.edu/3732087/A_survey_of_modern_optical_character_recognition_techniques&quot; rel=&quot;nofollow&quot;&gt;3&lt;/a&gt; shows various matured techniques which I am sure will give some good results in document processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, most OCR begins with document and that's when its utility gets limited. If you look at more generic scenario when a person goes to airport figures out where the sign board is and &quot;reads&quot; the signs board; now if we want to get a robot to achieve something like this, how does one go about achieving this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a more generic &quot;text recognition&quot; systems and algorithms? &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2015-06-17T20:39:54.700" Title="Generic text recognition" Tags="|ocr|text-recognition|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24090" PostTypeId="2" ParentId="20002" CreationDate="2015-06-13T08:01:32.840" Score="2" Body="&lt;p&gt;Shadow has very specific properties that makes it very clear way of making it distinguishable from the regular object. A lot of work in the area of background subtraction and surveillance has been using this to eliminate the shadows or to avoid them being mistaken as the actual object (or human). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As observed by Daniel Grest &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To distinguish the shadows from the person in the segmented image we&#xA;  assume the following properties:  &lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;a shadow pixel is darker than the corresponding pixel in the background image,&lt;/li&gt;&#xA;  &lt;li&gt;the texture of the shadow is correlated with the corresponding texture of the background image.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This paper models in detail the property of color correlation and develops the Nromalized Cross-Corelation matrix method to identify the shadow pixels. &#xA;See &lt;a href=&quot;https://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0CCIQFjAAahUKEwj7s8Oki4zGAhUln6YKHbYkAFU&amp;amp;url=http%3A%2F%2Fwww.cs.unc.edu%2F~jmf%2Fpublications%2Fgrest_frahm_koch_vmv03.pdf&amp;amp;ei=zNN7VfudNaW-mgW2yYCoBQ&amp;amp;usg=AFQjCNH-f0HhSsBnG6I2j2_4va7KeS_Q9Q&amp;amp;bvm=bv.95515949,d.dGY&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Julio Cezar uses and extends the performance by localization. It also uses it in monochromatic conditions which would be harder than color. See &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.124.4306&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;2&lt;/a&gt; for details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Horprasert characterizes shadow as &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Shaded background or shadow (S) if it has similar chromaticity but&#xA;  lower brightness than those of the same pixel in the background image.&#xA;  This is based on the notion of the shadow as a semi-transparent region&#xA;  in the image, which retains a representation of the underlying surface&#xA;  pattern, texture or color value&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This technique is used to classify scene in background, shadow and a moving object. See &lt;a href=&quot;http://www.vast.uccs.edu/~tboult/FRAME/Horprasert/HorprasertFRAME99.pdf&quot; rel=&quot;nofollow&quot;&gt;3&lt;/a&gt; for more details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a sense, these papers are indicating the properties you mentioned - but they show the mathematical model for the same which allows computationally identifying the shadows.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0CCIQFjAAahUKEwj7s8Oki4zGAhUln6YKHbYkAFU&amp;amp;url=http%3A%2F%2Fwww.cs.unc.edu%2F~jmf%2Fpublications%2Fgrest_frahm_koch_vmv03.pdf&amp;amp;ei=zNN7VfudNaW-mgW2yYCoBQ&amp;amp;usg=AFQjCNH-f0HhSsBnG6I2j2_4va7KeS_Q9Q&amp;amp;bvm=bv.95515949,d.dGY&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Daniel Grest et. al.&lt;/em&gt; &lt;strong&gt;A Color Similarity Measure for Robust Shadow Removal in Real-Time&lt;/strong&gt;&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.124.4306&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Julio Cezar et. al.&lt;/em&gt; &lt;strong&gt;Background Subtraction and Shadow Detection in Grayscale Video Sequences&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.vast.uccs.edu/~tboult/FRAME/Horprasert/HorprasertFRAME99.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Thanarat Horprasert&lt;/em&gt;, &lt;em&gt;David Harwood&lt;/em&gt; &lt;strong&gt;A Statistical Approach for Real-time Robust Background Subtraction and Shadow Detection&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastActivityDate="2015-06-13T08:01:32.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24091" PostTypeId="2" ParentId="23336" CreationDate="2015-06-13T08:37:12.970" Score="1" Body="&lt;p&gt;This question is more of a hardware setup. Books like Gonzalez will be more relevant when you have images as pixels and process them to transform to more desirable images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the few tips: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Setup a hardware like &lt;a href=&quot;https://www.raspberrypi.org/&quot; rel=&quot;nofollow&quot;&gt;Raspberry PI&lt;/a&gt; - a small general purpose computer&lt;/li&gt;&#xA;&lt;li&gt;Add hardware I/O interface like &lt;a href=&quot;https://www.raspberrypi.org/products/camera-module/&quot; rel=&quot;nofollow&quot;&gt;Camera Module&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;You can use standard USB Dongles and make it work on your pi. &lt;/li&gt;&#xA;&lt;li&gt;Write your application which will now collect pics and send across to the app on your smart phone! &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thats' it, really! &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2015-06-13T08:37:12.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24092" PostTypeId="2" ParentId="24087" CreationDate="2015-06-13T09:00:08.027" Score="4" Body="&lt;p&gt;I haven't checked the code, but that parameter refers to the delay of the reference signal when computing the error used for updating the filter coefficients. If $y[n]$ is the output of the linear equalizer, and $r[n]$ is the reference signal (e.g., the training signal when in training mode), the error is computed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e[n]=y[n]-r[n-d]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $d$ is the delay defined by &lt;code&gt;d=RefTap-1&lt;/code&gt;. This means that if the channel introduces a pure delay and the parameter &lt;code&gt;RefTap&lt;/code&gt; is set to match that delay, the equalizer doesn't need to do anything. Otherwise, the equalizer would need to try to compensate for that delay, which is impossible for a causal filter (because it would try to implement an advance in time). So that parameter is indeed very important in order to achieve the best possible equalization for a given equalizer filter length. Since in practice the channel delay is often unknown, a reasonable choice is to set the parameter &lt;code&gt;RefTap&lt;/code&gt; to half the equalizer length. Then, on average, the best use is made of the equalizer's weights. If the performance is not satisfactory, the number of weights needs to be increased (and the parameter &lt;code&gt;RefTap&lt;/code&gt; must be changed accordingly).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-13T09:00:08.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24093" PostTypeId="1" CreationDate="2015-06-13T10:31:10.180" Score="0" ViewCount="477" Body="&lt;p&gt;I am using the following IIR code as a low-pass filter in a software project, and it works great. However, I would like the slope of the filter to be much steeper as the one here seems to be very gradual (6 db/octave, from what I understand):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define CUTOFF_FREQ 500.0&#xA;#define SAMPLE_RATE 48000.0&#xA;&#xA;float RC = 1.0/(CUTOFF_FREQ*2*M_PI);&#xA;float dt = 1.0/SAMPLE_RATE;&#xA;float alpha = dt/(RC+dt);&#xA;&#xA;float output_sample,prev_sample,cur_sample;&#xA;&#xA;/* Run the filter on the two samples (normally done inside a loop) */&#xA;output_sample = prev_sample + (alpha*(cur_sample - prev_sample));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like perhaps a 12 db/octave slope or even 18 db/octave, similar to the low-pass filters in popular audio programs. Is it possible to modify this code for this purpose? Or should I be looking into alternate implementations altogether?&lt;/p&gt;&#xA;" OwnerUserId="16235" LastActivityDate="2015-06-13T10:46:37.990" Title="Possible to implement simple IIR filter with greater than 6 db/octave slope?" Tags="|filters|audio|filter-design|lowpass-filter|c|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24094" PostTypeId="2" ParentId="24093" CreationDate="2015-06-13T10:46:37.990" Score="1" Body="&lt;p&gt;You need a filter with a higher filter order, which means that your filter memory must be longer. The current output sample $y[n]$ is computed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=a_1y[n-1]+a_2y[n-2]+\ldots + a_Ny[n-N]+b_0x[n]+b_1x[n-1]+\ldots + b_Nx[n-N]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is the current input sample, $N$ is the filter order, and $a_i$ and $b_i$ are the filter coefficients. You can design the filter (i.e., compute the coefficients) using some tool like Matlab or Octave.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-13T10:46:37.990" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24095" PostTypeId="2" ParentId="24088" CreationDate="2015-06-13T11:02:53.387" Score="1" Body="&lt;p&gt;For the integral to be an &lt;a href=&quot;https://en.wikipedia.org/wiki/Z-transform#Inverse_Z-transform&quot; rel=&quot;nofollow&quot;&gt;inverse Z transform&lt;/a&gt;, the contour $H$ must enclose the origin, and it must be inside the region of convergence (ROC). In this way, the contour defines the ROC. E.g., if it encircles all poles, the corresponding sequence is causal. If all poles are outside the contour, then the resulting sequence is anti-causal. Finally, if there are poles inside and outside the contour, the resulting sequence is two-sided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, all poles are at $z=1$, so there are only two options: either the contour encloses these poles, then the sequence is causal. Otherwise, the sequence is anti-causal. Note that the location of the zeros is irrelevant here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you had two distinct poles, you would have three choices:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;both poles are outside $H$: the resulting sequence is anti-causal (left-sided)&lt;/li&gt;&#xA;&lt;li&gt;$H$ encloses only 1 pole: the resulting sequence is two-sided (non-causal)&lt;/li&gt;&#xA;&lt;li&gt;$H$ encloses both poles: the resulting sequence is causal (right-sided)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-13T11:02:53.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24098" PostTypeId="2" ParentId="18649" CreationDate="2015-06-13T13:48:36.927" Score="0" Body="&lt;p&gt;For a discrete signal in three dimensions (maybe a triaxial accelerometer sampled) the algorithm to compute SMA is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    //Signal magnitude area&#xA;    public double sma(double[] x, double[] y, double[] z){&#xA;        double sum = 0;&#xA;        for(int i=0; i&amp;lt;x.length; i++)&#xA;            sum += (Math.abs(x[i]) + Math.abs(y[i]) + Math.abs(z[i]));&#xA;        return sum /x.length;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;mean()&lt;/code&gt; is a function to compute the mean of the array and where we assume the arrays to have the same length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I created this function starting from the definition here &lt;a href=&quot;https://en.wikipedia.org/wiki/Signal_magnitude_area&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Signal_magnitude_area&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16236" LastEditorUserId="16236" LastEditDate="2015-06-17T08:54:25.500" LastActivityDate="2015-06-17T08:54:25.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24099" PostTypeId="1" AcceptedAnswerId="24103" CreationDate="2015-06-13T14:35:03.373" Score="0" ViewCount="319" Body="&lt;p&gt;The mathematical formula of the Laplace and Z transforms are same with just one difference.  I.e. in the first we use $t$ for continuous-time signal and in the latter uses $n$ for discrete-time signal. I don't think that there are any other differences. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While discussing Fourier transform for continuous-time (normally analog) signals, we use the continuous Fourier transform and for discrete-time (most often digital) signals we use the discrete-time Fourier transform (DTFT). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is why the Z transform is considered a separate transform? Why it is not named the &lt;em&gt;&quot;Discrete Laplace Transform&quot;&lt;/em&gt; ? &lt;/p&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="4346" LastEditDate="2015-06-13T16:51:46.070" LastActivityDate="2015-06-13T16:54:09.007" Title="Why Z-transform is considered as separate transform?" Tags="|z-transform|transform|laplace-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24102" PostTypeId="2" ParentId="24057" CreationDate="2015-06-13T15:21:15.890" Score="1" Body="&lt;p&gt;This is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_differential_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear differential equation&lt;/a&gt; . It stems from the following electric circuit :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uvNdc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Were the resistor &lt;code&gt;R&lt;/code&gt;, the capacitor &lt;code&gt;C&lt;/code&gt; and the inductor &lt;code&gt;L&lt;/code&gt; are ideal &lt;a href=&quot;https://en.wikipedia.org/wiki/Electrical_element&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear components&lt;/a&gt;. &lt;code&gt;x1&lt;/code&gt; is the current from the generator of voltage &lt;code&gt;d.u1&lt;/code&gt; and &lt;code&gt;x2&lt;/code&gt; is the voltage of the resistor-capacitor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check linearity, let &lt;code&gt;u1_1(t)&lt;/code&gt; and &lt;code&gt;u1_2(t)&lt;/code&gt; be two input signals. The corresponding output signals are &lt;code&gt;x1_1(t),x2_1(t)&lt;/code&gt; and &lt;code&gt;x1_2(t),x2_2(t)&lt;/code&gt;. Then it is easy to see that the output signal corresponding to &lt;code&gt;u1_1(t)+u1_2(t)&lt;/code&gt; is &lt;code&gt;x1_1(t)+x1_2(t),x2_1(t)+x2_2(t)&lt;/code&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Laplace transform and the Fourier transform can be used to study this system and compute output signals whenever possible.&lt;/p&gt;&#xA;" OwnerUserId="15490" LastActivityDate="2015-06-13T15:21:15.890" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24103" PostTypeId="2" ParentId="24099" CreationDate="2015-06-13T15:49:12.247" Score="3" Body="&lt;p&gt;There is indeed a transform called &lt;em&gt;discrete Laplace transform&lt;/em&gt; and it is of course closely related to the $\mathcal{Z}$-transform. The (unilateral) discrete Laplace transform of a sequence $f_n$ is defined by (cf. &lt;a href=&quot;https://books.google.nl/books?id=wCIGCAAAQBAJ&amp;amp;lpg=PA78&amp;amp;ots=FDqF81ObPp&amp;amp;dq=%22discrete%20laplace%20transform%22&amp;amp;pg=PA77#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{L}_T\{f_n\}=\sum_{n=0}^{\infty}f_ne^{-snT}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with some $T&amp;gt;0$. The discrete Laplace transform can be interpreted as the Laplace transform of a sampled function $f(t)\cdot\sum_n\delta(t-nT)$  with $f_n=f(nT)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice it is not convenient to have the factor $e^{sT}$ appear everywhere. If one substitutes $z=e^{sT}$, the discrete Laplace transform is called (unilateral) $\mathcal{Z}$-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{Z}\{f_n\}=\sum_{n=0}^{\infty}f_nz^{-n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same can obviously be done for the bilateral versions of the transforms, where the integrals and the sums start at $-\infty$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-13T16:54:09.007" LastActivityDate="2015-06-13T16:54:09.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24104" PostTypeId="1" AcceptedAnswerId="24105" CreationDate="2015-06-13T16:28:00.247" Score="3" ViewCount="2031" Body="&lt;p&gt;I have a dataset that looks as follows&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ZXgCS.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Now, this is from an actual measurement (of the reflection coefficient of a microchip with four LC resonators connected in a periodic fashion) so there is obviously noise involved. For reference, this is what it should look like in theory (with different numerical parameters)&#xA;&lt;img src=&quot;https://i.stack.imgur.com/6cUsq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there's a few things about the data. First of all there is gaussian(?) noise around the 'mean'. This is not really an issue; I'm only really interested in the positions/sharpness/depths of the resonances, and the noise doesn't complicate it too much. I suppose that if it would be very problematic, one could use Gaussian filter? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then there's a more problematic issue, and that is also why I put accents around mean. The data is not in a straight line; there is some nonlinear trend over the range of the data. This is what my question is about; getting rid of this trend so that the data is on a straight line. Once that is done, getting it to have its mean at 1 is of course easy, and I'll have a dataset that can be fitted with the model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My issue is that I don't really know where to start. I did some searching, but either my search terms are terrible or this hasn't really been discussed; it is quite specific after all. I'd like your advice on how to proceed, as personally I don't have any clue. Maybe I should fit the data with some general function? It does seem to be somewhat oscillatory, but not very nicely. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apologize for not providing some code to generate similar looking data. I would, if I had an idea of how to go about that, but I don't as I'm not sure what kind of function would generate this type of trend. &lt;strong&gt;Instead I have uploaded&lt;/strong&gt; the x-coordinates (Frequency in GHz) and the y-coordinates (complex reflection coefficient) &lt;a href=&quot;https://www.dropbox.com/s/dd6spic783d98wl/CQData.dat?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. As commented, this is a rather strange format for the data if you are not using Mathematica. &lt;a href=&quot;https://www.dropbox.com/s/m9vz4tngbfxauoh/CQDataAbs.dat?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is a different version which should work anywhere, and/but already has only the absolute value of the y-coordinates (as mathematica's way of storing complex numbers is a little nonstandard)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Dropbox, should be safe and registration free to download it). I should definitely add that what is plotted above is the absolute value of the y-coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that it doesn't require registration. It'll pop up a registration dialog when you open the site, but you can close this, and then you can click the download button (although it seems greyed out, but it isn't). They write this here too dropbox.com/help/20&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the source of the noise. This is one dataset of many, taken with a Vector Network Analyser. It's connected to the device with SMP cables, which are calibrated before doing the measurement. The calibration is supposed to take care of these trends, but in this case it didn't. So, does theory tell us something.. I'm not sure. I think the noise comes from the cables, and that it might have some oscillatory component to it, but beyond that I can't say to be honest, I have almost no experience with the system. The reason I don't just remeasure is that it is done at liquid helium temperatures, so I'd rather post process&lt;/p&gt;&#xA;" OwnerUserId="8593" LastEditorUserId="8593" LastEditDate="2015-06-13T18:26:22.543" LastActivityDate="2015-06-13T18:49:29.283" Title="Removing a non linear noise trend from data" Tags="|filters|noise|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24105" PostTypeId="2" ParentId="24104" CreationDate="2015-06-13T17:57:40.633" Score="2" Body="&lt;p&gt;The trend can be perceived as some low frequency signal, so a simple highpass filter should remove it. It will naturally slightly decrease the peaks, but by very little, because such narrow peaks are mainly composed of high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some concept code in Python (using the NumPy, SciPy and Matplotlib libraries)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import scipy.signal as scisig&#xA;import matplotlib.pyplot as plt&#xA;# assumes it has just two columns with f, r values&#xA;f, data = np.loadtxt('CQDataAbs.dat', unpack = True) &#xA;# order4 IIR Butterworth highpass filter coefficients,&#xA;# the critical frequency is relative to the Nyquist frequency,&#xA;# determining the right value might require some experimentation&#xA;# note that using a higher order with such low cuttof will likely&#xA;# be numerically unstable, if you need higher orders,&#xA;# split it into several lower-order stages applied sequentially&#xA;b, a = scisig.butter(4, 0.0003, btype='highpass')  &#xA;# forward-backwards filter application with edge padding (mitigates edge defects),&#xA;# results in zero phase lag and an effective filter order 8 as it is applied twice&#xA;filtered = scisig.filtfilt(b, a, data)  &#xA;plt.plot(f, filtered, 'b.')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the result&#xA;&lt;img src=&quot;https://i.stack.imgur.com/yAQzc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The shoot-up at the end may indicate that there are some higher frequencies in that area. Perhaps you can just disregard that region during fitting if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were interested in the trend itself, you would obtain it by using a lowpass filter instead of a highpass filter. With zero phase lag application the result of highpass filtering should be almost identical (within numerical accuracy) to subtracting this lowpass trend from the original data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you may find that a different filter type might give you better results. A Butterworth IIR filter (with forward-backwards application to remove phase lag) is usually a good choice when the shape of the signal is important, because the frequency response within the pass-band is maximally flat. You could of course use some large FIR filter for better performance if you have enough processing power. With FIR filters you also don't have to worry about numerical instability that can occur in IIR filters of high orders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just in case you think about using a moving average (which is a FIR lowpass filter): That will likely perform terribly in this case, because in each window containing a peak the average will shoot up and subtracting that from the original data will greatly decrease the peaks. From a frequency perspective, the moving average filter does not mitigate higher frequencies very well, which are very significant within the region of the peaks.&lt;/p&gt;&#xA;" OwnerUserId="15679" LastEditorUserId="15679" LastEditDate="2015-06-13T18:49:29.283" LastActivityDate="2015-06-13T18:49:29.283" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="24106" PostTypeId="2" ParentId="23956" CreationDate="2015-06-13T20:10:19.893" Score="1" Body="&lt;p&gt;I'm going to go ahead and answer this question with a &quot;Maybe, but not necessary&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found an article written by Wolberg G entitled &quot;an energy-minimization framework for monotonic cubic spline interpolation&quot; which seems to be on the mark, at least from reading the abstract.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will take me a little longer to figure out the paper and how to apply it to my specific example, but in general I think it demonstrates that there is research in the field which can control the amount of oscillation when trying to preserve the absolute minima of a point cloud. &lt;/p&gt;&#xA;" OwnerUserId="16141" LastActivityDate="2015-06-13T20:10:19.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24107" PostTypeId="1" CreationDate="2015-06-13T20:21:32.507" Score="1" ViewCount="134" Body="&lt;p&gt;I know in naive decimation the signal should filtered by a low-pass filter with cutoff frequency equals to Nyquist rate.I don't know how the filter banks like for polyphase decimation. Are them still low-pass filters? and what are their cutoff frequency.&lt;/p&gt;&#xA;" OwnerUserId="16239" LastActivityDate="2015-06-13T20:21:32.507" Title="How are filters for polyphase decimation like?" Tags="|filters|decimation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24109" PostTypeId="1" CreationDate="2015-06-14T02:25:18.010" Score="2" ViewCount="609" Body="&lt;p&gt;Suppose we have a noise process $V(t)$ which is the result of passing Gaussian white noise through a filter with frequency response function $H(\omega)$.&#xA;Can we represent realizations of this process as a Fourier transform&#xA;$$V(t) = \int \frac{d\omega}{2\pi} M(\omega) e^{i \phi(\omega)}$$&#xA;where $M(\omega)$ and $\phi(\omega)$ are random variables?&#xA;If so, what are the statistics of $M(\omega)$ and $\phi(\omega)$?&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="7361" LastEditDate="2015-06-14T20:03:40.150" LastActivityDate="2015-06-14T20:23:42.223" Title="Can realizations of a filtered Gaussian white noise process be represented as a Fourier transform?" Tags="|fourier-transform|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24111" PostTypeId="2" ParentId="24089" CreationDate="2015-06-14T05:36:03.207" Score="2" Body="&lt;p&gt;A short answer to your question is &quot;NO&quot;. To my best knowledge, there is no such a smart end-to-end OCR system that can handle various OCR tasks. However, there are OCR products could reasonably handle some tasks under controlled environments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You seem to be confused of different OCR related tasks and you erroneously believe these tasks are quite similar ( and thus something works well on document could also work well on reading signs ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here lists several levels of OCR tasks:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;level 0: single character recognition &lt;/li&gt;&#xA;&lt;li&gt;level 1: word recognition level&lt;/li&gt;&#xA;&lt;li&gt;level 2: sentence recognition&lt;/li&gt;&#xA;&lt;li&gt;level 3: paragraph recognition &lt;/li&gt;&#xA;&lt;li&gt;level 4: document recognition &lt;/li&gt;&#xA;&lt;li&gt;level 5: OCR in the wild&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Depending on the source of characters, you may classify texts into 1) machine printed texts ; 2) handwritten texts; and 3) scene text. All these are OCR related tasks, and thus can all be called &quot;OCR&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These tasks are clearly of different difficulties. Basically, the higher the level the more difficult it is. More importantly, all these tasks are NOT just about recognition. Sometimes pre- and post- processing are both important. For example, it is well known that the line segmentation problem in handwritten document recognition is very challenging when text lines are cursive, or touched, or mixed of texts from different directions, etc. If you cannot first segment text line correctly, how to recognize them? For another example, it is also well known that deciding the reading order of multi-column document mixed with pictures is challenging. Even if you recognize every sentence correctly, you may still make mistakes in organizing different paragraphs. In your interested scene text recognition tasks, text localization itself is challenging in the sense that texts can be any font in anywhere with any direction and perspective change. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For these reasons, a good end-to-end OCR engine is at least a mix of image processing, pattern recognition, and natural language processing, and thus this is a quite big system requiring knowledge from all these parts. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I put my comments of 'prior knowledge' below. &#xA;To discuss 'prior knowledge', it is better to clarify its definition. &#xA;- For recognition, it often means there is prior distribution to tell you how likely a character is expected to see. If you said you have no prior knowledge, then you believe it is equally likely to see all possible characters. Think about how many valid characters in all languages. This number is big, and the number of valid words in all languages is even bigger. &#xA;- For image processing, it often means you have (explicit or implicit) assumptions about a given image. Such assumptions could be 'one-column document', 'car plate', 'taken by iphone', etc. If you say I have no prior knowledge about where a car plate is, then this simply means you treat the possibility of seeing a car plate is equally likely for any image patch size and location. Think about how many possible image patches you will have. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is clear that doing OCR without prior knowledge is the worst thing we can try. In other words, we could do better when we have more prior knowledge for our task. In practice, people are using various prior knowledge, but often in an implicit way, and thus they even donot notice it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One typical example is training data. Because your training data is not the entire universe, any rules, distributions, characteristics etc you learnt from this dataset may not necessarily apply to the rest of the world. However, you are still use your trained models to do various tasks. Your prediction is based on the prior knowledge that you learnt from data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back to your 'car plate' OCR problem. We know a car plate is of a rectangular shape under some perspective transformation. We know it is very likely to locate at the lower part of a car. We know it cannot be to too thin nor too small. Such prior knowledge helps quickly locate a candidate plate while avoiding a lot false alarms. When you recognize a plate, there is more noticeable prior knowledge. If you know only digits are allowed in your plate, then you cut your solution space to the digit space. Even if you see something more similar to letter 'g' than digit '9', you can safely say &quot;this must be '9'&quot; because of your prior knowledge. For the same reason, if you know plate are valid, you can safely thrown away any candidate solution that is invalid. Even 'not that useful prior knowledge' helps. For example, if you know no plate in our world has more than N characters, you know a plate candidate you are recognizing is NOT a valid plate because its length is above N. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you donot have any prior knowledge, what happens? For me, it is similar to ask me find some object named '%#$$' on an image, which I completely have no idea what it is. And this is an impossible task. However, if I have the knowledge that '%#$#' is the ciphertext of 'ball', then I can easily do this task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that I convince you that prior knowledge is useful and closely associated with each processing step, and we cannot do OCR without prior knowledge. Indeed, this is the exact reason why we need to combine models from different aspects for OCR. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Donot be fooled by the name of OCR &quot;optical character recognition&quot;. It is not just character recognition: we are actually reading words, sentences, paragraphs from an image that is taken by someone using some particular device... and thus we need prior knowledge at many different levels. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="1867" LastEditDate="2015-06-17T20:39:54.700" LastActivityDate="2015-06-17T20:39:54.700" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24112" PostTypeId="2" ParentId="24109" CreationDate="2015-06-14T08:45:16.147" Score="3" Body="&lt;p&gt;I don't think it makes sense to talk about the Fourier transform of a (realization of a) random process, because it generally doesn't exist if no further restrictions are imposed. This problem is also discussed &lt;a href=&quot;https://books.google.nl/books?id=QkLy3mvvw1cC&amp;amp;lpg=PA448&amp;amp;ots=VX3D2LSbDl&amp;amp;dq=fourier%20transform%20of%20realization%20of%20random%20process&amp;amp;pg=PA448#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What &lt;em&gt;can&lt;/em&gt; be done is analyze the statistics of the discrete Fourier transform (DFT) and the discrete-time Fourier transform (DTFT) of a windowed version of a discrete-time stationary random process. This has been done in &lt;a href=&quot;http://users.ece.gatech.edu/mrichard/DFT%20of%20Noise.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-14T20:23:42.223" LastActivityDate="2015-06-14T20:23:42.223" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24114" PostTypeId="2" ParentId="24083" CreationDate="2015-06-14T09:35:28.973" Score="0" Body="&lt;p&gt;To analyze a slice of the spectrum:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use an IQ mixer to translate the centre of the slice, $F_c$, to 0 Hz. This is done by multiplying the signal with $e^{-j2\pi F_c/F_s}$, where $F_s$ is the sample frequency.&lt;/li&gt;&#xA;&lt;li&gt;Use a decimation low-pass FIR filter to remove the signal components outside the slice. The pass band of the filter is half the slice width. Output from this process is the down-converted slice sampled at a low sampling rate (just meeting the Nyquist criteria).&lt;/li&gt;&#xA;&lt;li&gt;Apply your favourite window function and FFT to the time signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This process is repeated for each of the wanted slices.&lt;/p&gt;&#xA;" OwnerUserId="325" LastEditorUserId="8202" LastEditDate="2015-06-14T12:44:02.687" LastActivityDate="2015-06-14T12:44:02.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24115" PostTypeId="1" AcceptedAnswerId="24116" CreationDate="2015-06-14T10:40:54.787" Score="0" ViewCount="443" Body="&lt;p&gt;I want to learn how to compute linear coefficient, but to be honest - I can't.&#xA;I know how to use them if i have it and why I want them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose this toy example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal $x=[-1, -2, 0, 1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to matlab function &lt;code&gt;lpc(X,p)&lt;/code&gt; if I want to compute the 2th order coefficients of this signal the result is $a = [1.0, -0.50, 0.50]$ and $ g=1.0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I Know how to compute the g using $A(k)$ formula and that $a_0=1$ always, but can someone explain me why $a_1=-0.5,  a_2=0.5$ how to compute them without using matlab or any other software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S It there any method which allow me using  $A(k)$ to compute directly the coefficients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="16244" LastEditorUserId="8202" LastEditDate="2015-06-14T16:02:06.090" LastActivityDate="2015-06-14T16:02:06.090" Title="Linear Prediction Coefficients" Tags="|signal-analysis|autocorrelation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24116" PostTypeId="2" ParentId="24115" CreationDate="2015-06-14T11:39:39.420" Score="2" Body="&lt;p&gt;First you need to compute the signal's autocorrelation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R(k)=\sum_nx(n)x(n+k),\quad k=0,1,\ldots,p$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case with $p=2$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}R(0)&amp;amp;=(-1)(-1)+(-2)(-2)+0\cdot 0+1\cdot 1=6\\&#xA;R(1)&amp;amp;=(-1)(-2)+(-2)\cdot 0+0\cdot 1=2\\&#xA;R(2)&amp;amp;=(-1)\cdot 0+(-2)\cdot 1=-2\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you have to solve a system of linear equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{bmatrix}R(0)&amp;amp;R(1)\\&#xA;R(1)&amp;amp;R(0)\\&#xA;\end{bmatrix}&#xA;\begin{bmatrix}a_1\\a_2\end{bmatrix}=&#xA;-\begin{bmatrix}R(1)\\R(2)\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives the values $a_1=-0.5$ and $a_2=0.5$. Of course $a_0=1$, as you've already noted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix that occurs in the system of linear equations is a Toeplitz matrix, i.e. all its diagonals have the same elements. As a result, such systems can be solved by specialized and efficient algorithms, such as Levinson's algorithm.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-14T11:39:39.420" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24117" PostTypeId="1" AcceptedAnswerId="24118" CreationDate="2015-06-14T13:41:20.827" Score="2" ViewCount="291" Body="&lt;p&gt;The expression for Fourier transform is given as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ F(\omega) = \int\limits_{-\infty}^{+\infty} f(t) \ e^{-j \omega t} \ dt  \tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, let one function be &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; and other be &lt;span class=&quot;math-container&quot;&gt;$e^{j\omega t}$&lt;/span&gt; then their convolution at &lt;span class=&quot;math-container&quot;&gt;$p(0)$&lt;/span&gt; is given as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ p(0) = \int\limits_{-\infty}^{+\infty} f(t) \ e^{-j \omega t} \ dt  \tag{2}$$&lt;/span&gt; same as in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also, if we split the exponential term into sinusoidal,the expression &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ F(\omega) = \int\limits_{-\infty}^{+\infty} (f(t) \cos{\omega t} -j f(t)\sin{\omega t})\ dt  \tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$f(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos{\omega t}$&lt;/span&gt; be 2 functions. So their correlation  at value&#xA;&lt;span class=&quot;math-container&quot;&gt;$q(0)$&lt;/span&gt;  is given as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ q(0) = \int\limits_{-\infty}^{+\infty} (f(t) \cos{\omega t}) \ dt  \tag{4}$$&lt;/span&gt; same as in &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt;. (we can do with f(t) and sine function also.)&lt;/p&gt;&#xA;&lt;p&gt;So I want to know&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Whether Fourier transform formula be considered as Convolution or Correlation?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, what is meaning of &lt;span class=&quot;math-container&quot;&gt;$p(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q(0)$&lt;/span&gt; terms ?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15429" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-06-15T05:44:55.037" Title="Whether Fourier transform formula be considered as Convolution or Correlation?" Tags="|fourier-transform|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24118" PostTypeId="2" ParentId="24117" CreationDate="2015-06-14T14:05:03.547" Score="7" Body="&lt;p&gt;Correlation and convolution are basically the same operations. You can express the cross-correlation of two functions $f(t)$ and $g(t)$ by a convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{fg}(\tau)=f(\tau)\star g^*(-\tau)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes convolution, and $*$ denotes complex conjugation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you evaluate the cross-correlation at $\tau=0$ you get the inner product of $f(t)$ and $g(t)$, and that's exactly what the Fourier transform is: it is the projection of $f(t)$ on the complex exponential $e^{j\omega t}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to answer your questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It is actually an inner product. Due to the equivalence of convolution and correlation, it can be seen as both, evaluated at $\tau=0$.&lt;/li&gt;&#xA;&lt;li&gt;As already mentioned, the meaning of these terms is an &lt;em&gt;inner product&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-14T14:05:03.547" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24119" PostTypeId="1" AcceptedAnswerId="24120" CreationDate="2015-06-14T14:56:50.877" Score="2" ViewCount="770" Body="&lt;p&gt;I read a digital communication problem and they interchange terms as windowing function and pulse shaping and refer to it as same entity. For example the following windowing function with Transition time $T_R$ used to smooth transitions between symbols is also refered to as pulse shaping &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w_T(t)= \left\{ \begin{array}{ll}&#xA;         \sin^2(\frac{\pi}{2}(0.5+\frac{t}{T_{TR}})) &amp;amp; \mbox{if $-T_{TR}/2 &amp;lt; t&amp;lt;T_{RT}/2$};\\&#xA;        1 &amp;amp; \mbox{if $T_{TR}/2 &amp;lt; t&amp;lt;T-T_{TR}/2$}\\&#xA; \sin^2(\frac{\pi}{2}(0.5-\frac{t-T}{T_{TR}})) &amp;amp; \mbox{if $T-T_{TR}/2 &amp;lt; t&amp;lt;T+T_{TR}/2$};\\&#xA;\end{array} \right. $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that a pulse shaping function limits signal bandwidth to transmission bandwidth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How come the two are refered to as same?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="15590" LastEditDate="2015-06-14T15:21:15.080" LastActivityDate="2015-06-14T22:19:35.327" Title="Are pulse shaping and windowing functions the same in concept?" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24120" PostTypeId="2" ParentId="24119" CreationDate="2015-06-14T16:31:38.010" Score="1" Body="&lt;p&gt;Windowing and pulse shaping are very similar, and are implemented in similar ways, but their purposes are different.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Windowing means multiplying a discrete signal by a pulse with certain spectral properties before calculating its Fourier transform. The purpose is reducing the effect of discontinuities at both ends of the discrete signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In QAM and related digital signals, the information is transmitted in the amplitudes of a sequence of pulses. Pulse shaping means choosing a pulse with the desired spectral and orthogonality properties.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that some digital communications textbooks assume (many times implicitly) a rectangular pulse shape, which is then converted to another pulse shape (using a filter, as in the example in your question). In my opinion, this formulation is unncecessarily complex -- it is better to explicity select  a pulse shape from the start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that pulse shaping may be understood as the convolution of a stream of deltas with a pulse shape; in that sense, pulse shaping is a sort of &quot;dual&quot; of windowing.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-06-14T22:19:35.327" LastActivityDate="2015-06-14T22:19:35.327" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="24121" PostTypeId="1" CreationDate="2015-06-14T17:19:51.717" Score="0" ViewCount="163" Body="&lt;p&gt;Is it possible to have negative zero crossing rate? (can rate be negative?!?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I saw a figure which the signal has been broken in frames each of 10msec, with the plot of zero crossing rate taking negative values, going under the horizontal line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also this figure instead of having Zr in the vertical line it has Zc/10msec, maybe thats the reason?&lt;/p&gt;&#xA;" OwnerUserId="16244" LastEditorUserId="13320" LastEditDate="2016-11-13T12:51:21.237" LastActivityDate="2016-11-13T12:51:21.237" Title="Zero Crossing rate" Tags="|signal-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24123" PostTypeId="2" ParentId="18966" CreationDate="2015-06-14T17:48:04.207" Score="1" Body="&lt;p&gt;&quot;I know that $\phi(t)$ is Gaussian distributed&quot; is not the same as saying&#xA;&quot;$\{\phi(t)\}$ is a Gaussian process&quot; but I will assume that the latter is meant. With this assumption, and the additional assumption that the process is&#xA;&lt;em&gt;wide-sense-stationary&lt;/em&gt; (the autocorrelation function is listed as having only one argument), the process is &lt;em&gt;strictly stationary&lt;/em&gt; and thus&#xA;$\phi(t)$ and $\phi(0)$ are &lt;em&gt;jointly&lt;/em&gt; Gaussian random variables. They have&#xA;the same mean $\mu$ and variance $\sigma^2$, and &#xA;their correlation coefficient is $\rho$ where&#xA;$$\mu = \sqrt{\lim_{t\to \infty} A(t)}, \qquad \sigma^2 = A(0)-\mu^2,&#xA;\qquad \rho(t) = \frac{A(t)-\mu^2}{\sigma^2}.$$&#xA;Consequently the &lt;em&gt;conditional&lt;/em&gt; distribution of $\phi(t)$ given&#xA;that $\phi(0)$ has taken on value $\phi_0$ is &lt;em&gt;Gaussian&lt;/em&gt;&#xA;with mean $\mu + \rho(t)(\phi_0 - \mu) = \rho(t) \phi_0 + (1-\rho(t))\mu$&#xA;and variance $\sigma^2(1-\rho(t)^2)$. Note that as $t\to\infty$, &#xA;the &lt;em&gt;conditional&lt;/em&gt; distribution of $\phi(t)$ approaches the&#xA;&lt;em&gt;unconditional&lt;/em&gt; distribution of $\phi(t)$: the distant past affects&#xA;the present state less and less.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information about Gaussian processes, see, for example,&#xA;&lt;em&gt;&lt;a href=&quot;https://dsp.stackexchange.com/q/481/235&quot;&gt;this answer&lt;/a&gt;&lt;/em&gt; to a&#xA;different question.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-06-15T20:23:50.623" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24124" PostTypeId="1" AcceptedAnswerId="24150" CreationDate="2015-06-14T17:59:21.940" Score="3" ViewCount="7431" Body="&lt;p&gt;Interleaving is often encountered in digital communication systems. I have seen interleaving between codewords in a single OFDM symbols as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the bits are denoted by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\{c_o,c_1,c_2,\cdots,\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And assume we use 16-QAM and we have many codeword each of length $N_{CW}$. Then to perform interleaving we do the following, the first 16 QAM symbol (first subcarrier) in the OFDM symbol is from  $$\{c_o,c_1,c_2,c_3\} $$ The second 16 QAM symbol in the OFDM symbol is from $$\{c_{N_{CW}},c_{N_{CW+1}},c_{N_{CW+2}},c_{N_{CW+3}}\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mapping is easy to understand, I don't understand how this helps in an OFDM system. Essentially we are mapping non adjacent bits to one OFDM symbol? What are the benefits over mapping adjacent bits to non adjancent OFDM symbols?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="15590" LastEditDate="2015-06-15T15:53:32.540" LastActivityDate="2015-06-15T17:29:32.940" Title="Purpose of interleaving in OFDM systems" Tags="|digital-communications|ofdm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24125" PostTypeId="1" CreationDate="2015-06-14T18:17:31.830" Score="0" ViewCount="61" Body="&lt;p&gt;I have a recording of a newer type of siren that uses two pitches sliding back and forth in time. I want to be able to detect both of the pitches simultaneously or overlapping at short intervals. Autocorrelation is not yielding good results in this case. Since I know the frequency range of interest for these pitches, is there a frequency-domain method that can be used to detect both pitches as they change?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/n9PBz.jpg&quot; alt=&quot;siren with two pitches&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-06-15T18:41:22.297" LastActivityDate="2015-06-15T18:41:22.297" Title="Detecting two changing inharmonic pitches" Tags="|fft|autocorrelation|pitch|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24126" PostTypeId="1" CreationDate="2015-06-14T19:28:44.820" Score="2" ViewCount="207" Body="&lt;p&gt;The FAA's NextGen routes, which were modeled, not measured, have created a bunch of aircraft noise for tens of thousands of people. I want to make it easy for those people (including me) to buy a cheap USB microphone, plug it into a laptop or PC, detect aircraft noise, correlate that with publicly available flight-path data, and file complaints with the FAA, airport(s), and legislators. With enough actual (as opposed to theoretical) data, we might be able to get them to roll back the route changes. Or not, but it's worth a try.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, I need some help with the &quot;detect aircraft noise&quot; part of the problem. It's not enough to trigger off noise above a certain dB threshold, because lawnmowers, leaf blowers, trucks, etc. also make noise. I can weed out some over-threshold noise that doesn't last long enough or lasts too long (aircraft take 5-10 seconds to pass overhead, vs. minutes for lawnmowers and a couple of seconds for trucks), but that's a pretty crude approach. And I still need to be able to factor multiple noise sources into individual components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlation would probably be easier with a pair or array of microphones, to establish noise direction that could be tied to flight paths, but that adds a lot more hardware and complexity. Ideally we'd just need one microphone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aircraft include airplanes (jets, turboprops, and standard propellor-driven), as well as helicopters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a good coder (Java expert, former C expert), but have zero experience with DSP or training algorithms. Can you help me get started?&lt;/p&gt;&#xA;" OwnerUserId="16247" LastEditorUserId="16247" LastEditDate="2015-06-14T19:41:40.443" LastActivityDate="2016-11-30T19:46:33.530" Title="What is a good way to distinguish aircraft noise from other sounds?" Tags="|classification|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24127" PostTypeId="2" ParentId="3433" CreationDate="2015-06-14T20:34:47.923" Score="0" Body="&lt;p&gt;To answer the OPs questions directly:&#xA;&quot;Is training data the data you will have after the pre-processing stage which is also called feature extraction? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, that (i.e. feature extraction) is not what makes a set of data &quot;training data&quot;. You will have to extract features in the same was as the training data from your testing data.&#xA;Here is an example set of steps to distinguish these terms:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get raw data. [This set comprises of train/validation/test data].&lt;/li&gt;&#xA;&lt;li&gt;Divide the data in train/validation/test splits.&lt;/li&gt;&#xA;&lt;li&gt;Use the train data &lt;em&gt;only&lt;/em&gt; to fit/classify your data using models such as SVM, neural networks etc.&lt;/li&gt;&#xA;&lt;li&gt;Now use test/validation data to check how good of a model you have.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Where test data is the original input. Am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The test data is the data you keep aside while select/learn the parameters of your model. You later use this data to test how good of a model you have. The key assumption is your test data distribution is same as your train data distribution.&lt;/p&gt;&#xA;" OwnerUserId="5432" LastActivityDate="2015-06-14T20:34:47.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24128" PostTypeId="2" ParentId="24126" CreationDate="2015-06-14T21:11:34.040" Score="-1" Body="&lt;p&gt;Your objective is to measure &lt;a href=&quot;https://en.wikipedia.org/wiki/Sound_pressure#Sound_pressure_level&quot; rel=&quot;nofollow&quot;&gt;Sound Pressure Level (SPL)&lt;/a&gt; &lt;strong&gt;at some position&lt;/strong&gt; on the ground and compare it against safe levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There already exist instruments that are doing exactly that and are called &lt;a href=&quot;https://en.wikipedia.org/wiki/Sound_level_meter&quot; rel=&quot;nofollow&quot;&gt;Sound Level Meters&lt;/a&gt;. These instruments are not cheap because of all the hard work that is required to produce a valid measurement. Their functionality cannot be simply replaced by a &quot;cheap USB microphone&quot;. For example, to derive SPL from the microphone's output, you need to have the microphone calibrated (not a cheap process) or use a measurement microphone (not a cheap microphone). To further ensure the validity of the measurement, you need to make sure that amplification and conversion to digital form has been linear and remains linear throughout the frequency spectrum of interest irrespectively of changing factors such as temperature, voltage, etc (not cheap hardware). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you could do to get some indication of the problem in a relatively simple way is this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use a Sound Level Meter with data logging capability.&lt;/li&gt;&#xA;&lt;li&gt;Set the meter up in the desired area&lt;/li&gt;&#xA;&lt;li&gt;Examine the recording of the sound level meter and look for regions that are over safe levels. Hopefully, these are not going to be many.&lt;/li&gt;&#xA;&lt;li&gt;Cross reference the timings that safe levels are exceeded with aircraft arrivals / departures (obviously, adjusted for the location of the mic)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In this way, you have the opportunity to estimate a background SPL (in between aircraft noise) that residents are constantly exposed to and the additional contribution to it by aircraft. By &quot;cross correlating&quot; aircraft timings with SPL measurements, you are doing away with all the problems of trying to distinguish the type of aircraft engine that contributes to the sound level. SPL peaks should correlate more with the aircraft schedule and less with the occasional leaf blower.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To further rule out false positives, that is occasions where the SPL exceeds safety levels because of any reason other than an aircraft, you could set up a cheap sound recorder too and automate the whole process by using the SPL curve to automatically preview the sound recording for what caused the peak at that time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, be prepared that &lt;strong&gt;the position&lt;/strong&gt; of the sound level meter could be challenged and the &quot;simplest&quot; way out of this is to obtain many measurements at different positions to reduce its effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Potentially Useful Links&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.faa.gov/about/office_org/headquarters_offices/apl/noise_emissions/&quot; rel=&quot;nofollow&quot;&gt;Noise and Emissions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.faa.gov/about/office_org/headquarters_offices/apl/noise_emissions/airport_aircraft_noise_issues/&quot; rel=&quot;nofollow&quot;&gt;Aircraft Noise Issues&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2015-06-14T21:21:16.427" LastActivityDate="2015-06-14T21:21:16.427" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24129" PostTypeId="1" CreationDate="2015-06-14T22:25:14.733" Score="3" ViewCount="247" Body="&lt;p&gt;Suppose we have a noise process $F(t)$.&#xA;Suppose $F$ is stationary and we know its autocorrelation function&#xA;$$\rho_F(\tau) \equiv \langle F(0)F(\tau) \rangle$$&#xA;where the average is over realizations of the process.&#xA;We then construct a new noise process $G(t) \equiv \cos(\Omega t)F(t)$.&#xA;Obviously, $G$ is not stationary.&#xA;The autocorrelation function of $G$ is&#xA;\begin{align}&#xA;\langle G(t_1) G(t_2)\rangle&#xA;&amp;amp;= \langle F(t_1) \cos(\Omega t_1)F(t_2) \cos(\Omega t_2) \rangle \\&#xA;&amp;amp;= \langle F(t_1) F(t_2) \rangle \cos(\Omega t_1) \cos(\Omega t_2) \\&#xA;&amp;amp;= \rho_F(t_2 - t_1) \cos(\Omega t_1) \cos(\Omega t_2) \, .\\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectral density of $F$ can be usefully defined as&#xA;$$S_F(\omega) = \int \frac{d\omega}{2\pi} \rho_F(\tau) e^{-i \omega \tau} \, . $$&#xA;However, since $\langle G(t_1) G(t_2) \rangle$ depends on $t_1$ and $t_2$ and not just their difference, we cannot easily define $S_G(\omega)$.&#xA;This is distressing because for deterministic signals we expect modulation by a sinusoid to just shift the spectral density, so we expect there should be a simple formula for $S_G(\omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What, if any, is a meaningful way to construct the spectral density of $G$?&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="7361" LastEditDate="2015-06-14T22:47:03.430" LastActivityDate="2022-11-05T12:05:38.020" Title="Spectral density of modulated noise process" Tags="|noise|modulation|power-spectral-density|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24130" PostTypeId="2" ParentId="24126" CreationDate="2015-06-14T23:14:12.423" Score="2" Body="&lt;p&gt;You need to train a classifier. The way I would approach it is to allow users to submit audio recordings through your app, and indicate which sections of the recordings contain the plane. This would enable you to quickly crowd source a lot of data with which to build a model. Then you would find the &lt;a href=&quot;https://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;STFT&lt;/a&gt; and volume of the signal over time. Finally, train the classifier (such as an &lt;a href=&quot;https://en.wikipedia.org/wiki/Support_vector_machine&quot; rel=&quot;nofollow&quot;&gt;SVM&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Artificial_neural_network&quot; rel=&quot;nofollow&quot;&gt;neural network&lt;/a&gt;) using the amplitude spectrum and volume features. Once you have trained the classifier, you can use it to detect planes by extracting the same features on live audio (STFT isn't computationally expensive, so it should be feasible to do on the phone).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a backgrounder on &lt;a href=&quot;http://mtg.upf.edu/ismir2004/graduateschool/people/Klapuri/classification.pdf&quot; rel=&quot;nofollow&quot;&gt;Audio signal classification&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2015-06-14T23:14:12.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24135" PostTypeId="1" AcceptedAnswerId="24733" CreationDate="2015-06-15T05:44:14.150" Score="0" ViewCount="514" Body="&lt;p&gt;I have a fixed point DSP library fft function that does not use a block exponent.&#xA;I don't have prior knowledge of that implementation but whatever I could read online, my understanding is that its used in each butterfly stage to determine  redundant sign bits and hence left shift by same amount.However, in my case, library function does not give me parameter for the block exponent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is it possible to do same precision improvement as happens with block exponent for FFT , but done on streamed/block of input data that goes into fft?&lt;br&gt;&#xA;2) if yes, Can anyone show me how that can be done using small C code, assuming 24 bit fixed point data(4 int,20 frac) and explain the logic behind it ( with clear explanation at bit/binary level,as I couldn't find that anywhere) assuming input data divided into frames/blocks of size 256 for FFT size 256.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &#xA;sedy&lt;/p&gt;&#xA;" OwnerUserId="11096" LastEditorUserId="11096" LastEditDate="2015-06-15T05:50:33.610" LastActivityDate="2015-07-16T16:20:18.050" Title="FFT block exponent" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24136" PostTypeId="1" CreationDate="2015-06-15T06:25:48.993" Score="0" ViewCount="229" Body="&lt;p&gt;I currently have FM discriminated data in a .wav file.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/OzO0G.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;How can I convert it to binary data (+0.5 == high bit, -0.5 == low bit) given a baud rate.&lt;/p&gt;&#xA;" OwnerUserId="16249" LastEditorUserId="16249" LastEditDate="2015-06-15T06:36:09.930" LastActivityDate="2015-06-15T06:36:09.930" Title="How can I convert a FM discriminated signal to binary data using software" Tags="|audio|digital|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24137" PostTypeId="2" ParentId="24126" CreationDate="2015-06-15T08:42:41.093" Score="0" Body="&lt;p&gt;Some suggested that you go for some machine learning madness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An other solution is to see if you can extract narrow band noise from the motors of aircrafts / road traffic and see if you can discriminate them based only on that. Additionaly, even if the narrow band noise are in the same band, you could use doppler to discriminate them (For example, if your microphone is close to road traffic, the doppler shift from it should be much more sharp than the doppler from aircrafts).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But before talking to much about how you could discriminate aircraft noise from road traffic, set up some microphone, gather the data and perform a time-frequency analysis to see how your signals look like.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-06-15T08:42:41.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24138" PostTypeId="1" AcceptedAnswerId="24139" CreationDate="2015-06-15T09:09:23.787" Score="1" ViewCount="361" Body="&lt;p&gt;in my notes for DSP they have the difference equation general form as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(k) + a1*y(k-1) + a2*y(k-2) + ... + an*y(k-N) = b0*x(k) + b1*x(k-1) + ... + bm*x(k-M)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the claim that for the output to not depend on future values of the input then M&amp;lt;=N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this the case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, if I'm not missing something here I think I can provide a counterexample:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;y(k) = x(k-1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has N = 0 and M = 1.&#xA;But this is just a unit delay, the output is just the previous value of the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's going on here?&lt;/p&gt;&#xA;" OwnerUserId="16250" LastActivityDate="2015-06-15T09:26:40.123" Title="Difference Equations, why M&lt;=N for causality?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24139" PostTypeId="2" ParentId="24138" CreationDate="2015-06-15T09:26:40.123" Score="1" Body="&lt;p&gt;You're right, it's simply not true that $M\le N$ is necessary for causality. The difference equation in your question can always be implemented by a causal system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, note that the difference equation is not uniquely related to a causal system. A simple example is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=ay[n-1]+bx[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can obviously be implemented by a causal system. But for $a\neq 0$ you can also rewrite (1) as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n-1]=\frac{1}{a}(y[n]-bx[n])\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which suggests an anti-causal system, even though (1) and (2) are completely equivalent. This difference is reflected by the transfer functions ($\mathcal{Z}$-transforms) of the corresponding systems. For a causal system the region of convergence (ROC) is outside a circle enclosing all poles, whereas for an anti-causal system the ROC is inside a circle outside of which all poles are located.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-15T09:26:40.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24140" PostTypeId="2" ParentId="24129" CreationDate="2015-06-15T10:14:48.130" Score="5" Body="&lt;p&gt;This is a standard problem in (among others) the theory of analog or digital communication systems. If &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt; is real-valued, then the standard gimmick is indeed - as already pointed out in a comment by Dilip Sarwate - to add a random phase to the carrier phase. This is not only a trick but it actually reflects reality in the sense that we often do not know (and do not care to know) the exact phase of the carrier with respect to the signal &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt;. So what we actually want is NOT the power spectrum of &lt;span class=&quot;math-container&quot;&gt;$F(t)\cos(\omega_0 t)$&lt;/span&gt; (which does not exist), but the power spectrum of the process &lt;span class=&quot;math-container&quot;&gt;$F(t)\cos(\omega_0 t+\theta)$&lt;/span&gt; with some unknown phase &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, the obvious model of which is a random variable with a uniform distribution in &lt;span class=&quot;math-container&quot;&gt;$[0,\pi)$&lt;/span&gt;. This random phase is of course constant over time, but its value is chosen at random reflecting our uncertainty about the origin of the time axis. With this random phase the resulting process is wide-sense stationary (WSS) (if &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt; is), and the power spectrum looks exactly as one would expect.&lt;/p&gt;&#xA;&lt;p&gt;Now comes the interesting part. If &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt; is a WSS complex-valued process and if we're interested in the power spectrum of the process&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$G(t)=\text{Re}\left\{F(t)e^{j\omega_0 t}\right\}\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then we could also use the random phase trick, but under some reasonable assumptions we don't even need it. The process &lt;span class=&quot;math-container&quot;&gt;$G(t)$&lt;/span&gt; in (1) occurs e.g. in systems using quadrature modulation. It is straightforward to show that the autocorrelation of &lt;span class=&quot;math-container&quot;&gt;$G(t)$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}R_G(t,\tau)&amp;amp;=E\left\{G(t+\tau)G^*(t)\right\}=\\&amp;amp;=\frac12\text{Re}\left\{R_F(\tau)e^{j\omega_0\tau}\right\}+\frac12\text{Re}\left\{R_{FF^*}(\tau)e^{j\omega_0(\tau+2t)}\right\}\tag{2}\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which becomes independent of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$R_{FF^*}(\tau)=0$&lt;/span&gt;, i.e. if the cross-correlation of &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$F^*(t)$&lt;/span&gt;, vanishes. If &lt;span class=&quot;math-container&quot;&gt;$F(t)=A(t)+jB(t)$&lt;/span&gt;, it can be shown that this is the case if&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_A(\tau)=R_B(\tau)\tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_{AB}(\tau)=-R_{AB}(-\tau)\tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if conditions (3) and (4) are satisfied, we don't even need a random carrier phase in order to define a power spectrum of &lt;span class=&quot;math-container&quot;&gt;$G(t)$&lt;/span&gt; as defined in (1). Conditions (3) and (4) mean that the real and imaginary parts of &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt; have the same autocorrelation, i.e. the same power spectrum, and that their cross-correlation is an odd function, i.e. their cross-power spectrum is purely imaginary. This last condition also implies &lt;span class=&quot;math-container&quot;&gt;$R_{AB}(0)=0$&lt;/span&gt;, i.e the real and imaginary part are uncorrelated when sampled at the same time. It turns out that for many practical problems these conditions are at least approximately satisfied.&lt;/p&gt;&#xA;&lt;p&gt;Given that conditions (3) and (4) are satisfied, the autocorrelation function of &lt;span class=&quot;math-container&quot;&gt;$G(t)$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_G(\tau)=\frac12\text{Re}\left\{R_F(\tau)e^{j\omega_0\tau}\right\}\tag{5}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and its power spectral density is given by the Fourier transform of (5):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S_G(\omega)=\frac14\left[S_F(\omega-\omega_0)+S^*_F(-\omega-\omega_0)\right]\tag{6}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$S_F(\omega)$&lt;/span&gt; is the power spectral density of &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2022-11-05T12:05:38.020" LastActivityDate="2022-11-05T12:05:38.020" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24142" PostTypeId="1" CreationDate="2015-06-15T10:35:54.490" Score="0" ViewCount="149" Body="&lt;p&gt;I'm trying to design a PID controller but I have a problem in the following case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process variable can only be between 0 and 1.&#xA;The setpoint can be close to one, for instance 0.97.&#xA;Hence the lowest possible error is -0.03  (0.97 - 1), and the maximal error 0.97 (0.97 - 0).&#xA;As a result, the controller output usually decreases much more slowly than it increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like it to be able to decrease faster, with the same set point. Is there a correct way to do that? Of course I could multiply the error by some constant only when it's negative, but I'm not sure it's right to do that (I don't have a lot of experience in control theory).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="16251" LastActivityDate="2015-06-15T10:35:54.490" Title="PID Control - process variable / setpoint" Tags="|discrete-signals|signal-analysis|control-systems|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24145" PostTypeId="1" CreationDate="2015-06-15T13:11:59.743" Score="1" ViewCount="168" Body="&lt;p&gt;Could anyone recommend good  speech pre-processing/filtering  algorithms/methods that would improve the performance of my speech recognition. I have been primarily been doing image processing related stuff and hence am not much aware of  speech pre-processing methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently using Google's Web Speech API for speech to text recognition. This is the current flow of things. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take input from microphone&lt;/li&gt;&#xA;&lt;li&gt;Segment the audio using Voice Activity Detection. This is done since Google's API has a limit on the length of the segment it can process. &lt;/li&gt;&#xA;&lt;li&gt;Send the segment to Google's web speech API (on a thread)&lt;/li&gt;&#xA;&lt;li&gt;Print the response of the API&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Using this I could only get up to 60-65% conversion accuracy. Is there any way to improve this? Would doing a pre-processing on the audio (noise-removal, filtering, etc.) help? &lt;/p&gt;&#xA;" OwnerUserId="16146" LastEditorUserId="16146" LastEditDate="2015-06-18T06:37:12.370" LastActivityDate="2015-06-19T16:36:03.680" Title="Improve performance of speech recognition" Tags="|speech-recognition|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24147" PostTypeId="2" ParentId="24032" CreationDate="2015-06-15T15:52:15.843" Score="0" Body="&lt;p&gt;A window of samples can be decomposed into an even vector (symmetric about the center) and an odd vector (anti-symmetric about the center).  The even vector is the &quot;real&quot; or cosine component in the frequency domain, the odd vector is the &quot;imaginary&quot; or sine component in the frequency domain.  These two vectors are orthogonal under certain operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only use the real component, then you can only analyze symmetric windows of data (or cosine compositions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining the two components, cosine and sine, into a single complex data type representation allows writing many of the equations regarding signal processing using less pencil or chalk (half as many symbols to scribble).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-06-15T15:52:15.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24148" PostTypeId="1" AcceptedAnswerId="24158" CreationDate="2015-06-15T16:34:39.770" Score="5" ViewCount="66" Body="&lt;p&gt;I have unit vectors in a high-dimensional space (~300) that are non-uniformly distributed over this hypersphere. There is physical meaning when the vectors are clustered together, but I'm hypothesizing that there is additional meaning when the vectors form a &quot;path&quot; along this hypersphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the purposes of this question, let's assume that the deviation between the geodesic across the hypersphere and a straight line are are approximately equal (that is, I'm assuming the distances are small relative to the radius).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question becomes, &quot;From a large 300-dimensional point cloud in Euclidian space, how do I detect groups of points that are aligned in any direction?&quot;&lt;/p&gt;&#xA;" OwnerUserId="1159" LastActivityDate="2015-06-16T03:58:18.540" Title="Finding filaments in high dimensional space" Tags="|filters|transform|classification|measurement|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24149" PostTypeId="2" ParentId="24148" CreationDate="2015-06-15T17:01:39.793" Score="0" Body="&lt;p&gt;You know that in a two dimensional plane two points form a line why a simple equation holds namely - $y = mx + c$ put the other way if dimensions are $x1$ and $x2$ than for a line to exist, the equation $ a_1x_1 + a_2x_2 = C $ holds true for any value of $a_1$ and $a_2$ and $C$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generalizing this in an $N$ dimensional space, it is a line if $ a_1x_1 + a_2x_2 + .... a_nx_n = C $ holds true! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This of course gets hard exponentially as $N$ increases. So you may apply variety of search algorithms or dimensionality reduction algorithms. You can also use linear regression if you are seeing that large number of points are essentially lined up around a single line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I have understood and answered your question correctly! (still unsure though). &lt;/p&gt;&#xA;" OwnerUserId="440" LastActivityDate="2015-06-15T17:01:39.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24150" PostTypeId="2" ParentId="24124" CreationDate="2015-06-15T17:29:32.940" Score="7" Body="&lt;p&gt;Interleaving is not specific to OFDM. It is an age old technique used for improving error correcting codes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, most error correction coding techniques are good at suppressing bit-wise errors which are independent and random. However, when channels are not memoryless, there could be burst errors. i.e. several bit errors are likely to see in close by given the first bit error occurs. Hence, in such cases typical ECCs gets much weaker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Burst errors in general are more adverse not only because they get better of error correction codes but they tend to produce more profound local gaps (such as hicups in voice or patch in video data). And yet, in most wireless and satellite channels they are more common. This is also applicable in storage mediums. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interleaving, a very simple technique resolves this very efficient way. Basically you take a block of bits and interleave it in a particular known order. Now when a burst error occurs, after the de-interleaving at receiver the effected bits are now speared apart much more than the original burst. And hence it improves the work of ECC significantly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many modern channel encoding uses interleaving built-in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read a very detailed outline here: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www2.siit.tu.ac.th/chalie/tcs395/interleaving.pdf&quot;&gt;&lt;em&gt;Yun Q. Shi&lt;/em&gt;, &lt;strong&gt;Interleaving for Combating Bursts of Errors&lt;/strong&gt; IEEE CIRCUITS AND SYSTEMS MAGAZINE FIRST QUARTER 2004 pp 29&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastActivityDate="2015-06-15T17:29:32.940" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24151" PostTypeId="2" ParentId="24064" CreationDate="2015-06-15T18:38:52.800" Score="0" Body="&lt;p&gt;I would try to help you more than answering! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK - in simple terms mean filter is the low pass filter applied through averaging of a fixed window convoluted through the image. You can learn from &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/filtops.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; about the basic filter theory. This filter creates smoothing and blurring of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another filter is a median filter where from the given window the median value is selected. From the same site as above &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/median.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; is the explanation of the median filter. This filter is best and simplest when it comes to removing outliers and hence noise of salt paper types. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that simple mean filter is linear where as median filter is a non-linear one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alpha-trimmed mean filter is a class of filters, by its nature is hybrid of the mean and median filters. In a pure median filter you arrange all values in a pertaining window in a sorted order and discard all values except the center one. In Alpha-trimmed mean filter you discard the extreme ends but then do averaging. See &lt;a href=&quot;http://www.librow.com/articles/article-7&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for more details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Contra-harmonic mean filter is defined here as equation : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{f}(x,y)=\frac{\sum_{(s,t)\in S_{xy}}^{}g(s,t)^{Q+1}}{\sum_{(s,t)\in S_{xy}}^{}g(s,t)^{Q}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $g(s,t)$ is essentially the pixel value of image $g$ at location $(s,t)$. We can notice that when $Q=0$ this is an ordinary mean filter. When $Q=-1$, it is same as harmonic mean filter which is inverse of the mean filter. &#xA;So for $Q&amp;lt;0$ the filter works very well for salt noise and $Q&amp;gt;1$ works better for pepper noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this document to see all definitions: &lt;a href=&quot;http://masters.donntu.org/2007/kita/gett/library/eng.htm&quot; rel=&quot;nofollow&quot;&gt;http://masters.donntu.org/2007/kita/gett/library/eng.htm&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="8202" LastEditDate="2016-02-12T08:20:02.333" LastActivityDate="2016-02-12T08:20:02.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24152" PostTypeId="2" ParentId="13913" CreationDate="2015-06-15T19:25:21.897" Score="-1" Body="&lt;p&gt;you can also this two papers for iris and normalization:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;S Zeriouh, M Boutahri, SE Yamani, A Roukhe. &quot;&lt;a href=&quot;http://ijcsse.org/published/volume4/issue5/p4-V4I5.pdf&quot; rel=&quot;nofollow&quot;&gt;Contribution of Artificial Neural Networks to the Identification and Detection of Targets Concerning Mobility on Remote Sensing Images.&lt;/a&gt;&quot; International Journal of Computer Science and Software Engineering 4, no. 5 (2015): 130-136.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to implement iris normalization?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;R Safdari, Z Azadmanjir. &quot;&lt;a href=&quot;http://www.ijcncs.org/published/volume2/issue6/p1_2-6.pdf&quot; rel=&quot;nofollow&quot;&gt;Wireless Networks in Hospitals; a Framework of Use and Implementation for Nursing Care.&lt;/a&gt;&quot; International Journal of Computer Networks and Communications Security 2, no. 6 (2015): 188-196.&lt;/p&gt;&#xA;" OwnerUserId="16256" LastEditorUserId="16256" LastEditDate="2015-06-27T10:03:55.097" LastActivityDate="2015-06-27T10:03:55.097" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24154" PostTypeId="1" AcceptedAnswerId="24164" CreationDate="2015-06-15T23:01:04.980" Score="6" ViewCount="16790" Body="&lt;p&gt;In control systems engineering, the stability of a system (modeled in the form of Transfer Function) is determined by the poles of the system in the right or left hand sides.&#xA;When the model is represented using State Space approach, the eigen values of the (A) state matrix are equivalent to the poles in the Transfer Function approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;why are both eigen values and poles equivalent? why do they give the same information?&lt;/p&gt;&#xA;" OwnerUserId="16258" LastEditorUserId="4298" LastEditDate="2021-02-10T18:45:23.957" LastActivityDate="2021-02-10T18:45:23.957" Title="Why eigen values and poles of a system are equivalent?" Tags="|z-transform|transfer-function|control-systems|state-space|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24155" PostTypeId="2" ParentId="22035" CreationDate="2015-06-15T23:11:28.520" Score="1" Body="&lt;p&gt;It sounds like you're doing things correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of LPC as a compression method. A lossy method at that, &lt;em&gt;if&lt;/em&gt; you discarded the residual and replaced it with a synthetic pulse train (which might consider using for pitch shifting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a perfect world where the LPC coefficients were a perfect match to the formant filtering applied by the throat/mouth/nose, the residual would be exactly the glottal impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since the LPC is just an approximation, the residual contains additional information.&lt;/p&gt;&#xA;" OwnerUserId="16259" LastActivityDate="2015-06-15T23:11:28.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24156" PostTypeId="1" AcceptedAnswerId="24159" CreationDate="2015-06-15T23:59:40.003" Score="3" ViewCount="4457" Body="&lt;p&gt;I want to understand what is soft thresholding operator? Why we use this operator? I came across this term while I was reading the paper - &lt;a href=&quot;http://link.springer.com/article/10.1007%2Fs00034-013-9714-0#page-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;A New Algorithm Based on Linearized Bregman Iteration with Generalized Inverse for Compressed Sensing&lt;/a&gt; (at page no 4.). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any reference that can explain this will also help me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help.&lt;/p&gt;&#xA;" OwnerUserId="16199" LastEditorUserId="128" LastEditDate="2020-03-18T07:11:52.837" LastActivityDate="2020-03-18T07:11:52.837" Title="Understanding Soft Thresholding Operator" Tags="|compressive-sensing|convex-optimization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24157" PostTypeId="1" CreationDate="2015-06-16T03:16:34.437" Score="1" ViewCount="124" Body="&lt;p&gt;A particular, frequency-domain sequence of +1 and -1  as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X=[-1, -1, +1, +1, +1, +1, +1, +1, +1, -1, +1, -1, -1, +1, +1, -1, -1, -1, +1, +1, -1, -1, -1, -1, +1, -1, +1, -1, +1, -1, -1, +1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is being transformed to the time-domain and transmitted over a wireless channel. It was stated that if $X$ is &lt;em&gt;phase shifted&lt;/em&gt; i.e. multiplied by the following sequence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w= [1, j,-1,-j,1, j,-1,-j,1, j,-1,-j,1, j,-1,-j,1, j,-1,-j,1, j,-1,-j..]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting time-domain sequence would have a lower peak to average power ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me why?&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="1606" LastEditDate="2015-12-16T09:19:37.753" LastActivityDate="2016-07-14T11:09:59.273" Title="Lower peak to average power ratio by phase shifting" Tags="|digital-communications|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24158" PostTypeId="2" ParentId="24148" CreationDate="2015-06-16T03:58:18.540" Score="2" Body="&lt;p&gt;Following my comment, I now have time to post it as an answer.&lt;br&gt;&#xA;If you expect that a large enough portion of the vectors belong to that line, you can use &lt;a href=&quot;https://en.wikipedia.org/wiki/RANSAC&quot; rel=&quot;nofollow&quot;&gt;RANSAC&lt;/a&gt;.&lt;br&gt;&#xA;RANSAC works by selecting a small and random subset of the data and fit it to the desired model (say a line). The fitting can be achieved in any way you like, e.g. least-squares. Then, the data is divided to inliers (the points in space that &quot;agree&quot; with the model) and outliers (those who don't &quot;agree&quot;). The process is repeated until you have enough inliers.&lt;br&gt;&#xA;This would only work if the probability of selecting the points on the line is high enough.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as multiple lines, I don't think RANSAC supports this inherently. You can do it iteratively by removing all inliers from the set once a line has been found.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are working in MATLAB\Octave, my favourite RANSAC implementation can be downloaded from &lt;a href=&quot;http://www.csse.uwa.edu.au/~pk/research/matlabfns/#robust&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-06-16T03:58:18.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24159" PostTypeId="2" ParentId="24156" CreationDate="2015-06-16T04:27:06.800" Score="5" Body="&lt;p&gt;The soft-thresholding function finds the minimizer of an objective function  that involves data fitting in an &lt;span class=&quot;math-container&quot;&gt;$\ell_2$&lt;/span&gt; sense as well as minimization of the &lt;span class=&quot;math-container&quot;&gt;$\ell_1$&lt;/span&gt; norm (i.e. absolute value). The &lt;a href=&quot;http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/sparse_penalties.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture Notes - Penalty and Shrinkage Functions for Sparse Signal Processing&lt;/a&gt; gives a good discussion of how the soft threshold function is derived.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="128" LastEditDate="2020-03-18T07:10:11.547" LastActivityDate="2020-03-18T07:10:11.547" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24160" PostTypeId="2" ParentId="24135" CreationDate="2015-06-16T04:46:39.473" Score="0" Body="&lt;p&gt;Block (floating point) has been implemented in a Vector Signal Processor developed by Zoran (sold by now) over 30 years ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may get very close results to such implementation by employing a floating point (even double precision) and than scale the result so the maximal value of the FFT uses all 24 bits (usually you use 2's complement representation of the signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not think that you will find articles that really explain the power of Block Floating Point as means to greatly improve the processing of fixed point hardware.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-06-16T04:46:39.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24161" PostTypeId="1" CreationDate="2015-06-16T07:12:34.937" Score="4" ViewCount="1414" Body="&lt;p&gt;I am currently working of 24GHz FMCW radar signal processing. The Module I'm using has 2 receiving antennas and each has 2 outputs (I and Q channel). So overall I've 4 channels. I'm using combination of harware and software for the processing in frequency domain. Range and velocity is fine, if I sample any one channel out of those 4 (either I or Q) I can find the R and V values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm interested in finding the direction of a object, when it is moving (away from sensor or towards sensor) and the position of the object (right of the sensor or left or the senor, at the best the horizontal angle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the datasheet of the radar sensor I read 2 lines in the features, that gives me some idea in finding the direction and location. Below are the lines:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&quot;two receiving antenna for phase comperision operation&quot;&lt;/li&gt;&#xA;&lt;li&gt;&quot;I/Q channels for direction of motion discrimination&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now I'm thinking how to find out the position or the horizontal angle of the target using phase comperision of the 2 antennas. Below is the diagram I made for analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tz8s1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surely the 2 antennas receives reflection from a single target with a phase shift. Now the question is how to I find the phase shift processing the I channel (let's say) from the 2 antennas. I'm not aware of any DSP technique, so want suggestions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the direction of motion, what technique can be ised with the I and Q channel of a antenna to deduce it. I'm again on poor dsp knowledge, how do I process the I and Q channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate any suggestion of improve my knowledge and know about more dsp techniques in signal analysis.&lt;/p&gt;&#xA;" OwnerUserId="11676" LastActivityDate="2015-06-16T12:45:19.247" Title="How to find phase shift and process I/Q channel" Tags="|fft|phase|dsp-core|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24163" PostTypeId="1" AcceptedAnswerId="24165" CreationDate="2015-06-16T09:01:44.883" Score="0" ViewCount="176" Body="&lt;p&gt;If I have a LTI system which has impulse response &lt;span class=&quot;math-container&quot;&gt;$h(n) = \left(\frac{1}{2}\right)^nu(n)$&lt;/span&gt;   and the entry is &lt;span class=&quot;math-container&quot;&gt;$x[n]=u[n]-u[n-1]$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$u[n]$&lt;/span&gt; is the unit step function. In order to find the output I have to convolute the &lt;span class=&quot;math-container&quot;&gt;$h[n]$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$u[n]$&lt;/span&gt; and knowing &lt;span class=&quot;math-container&quot;&gt;$x(n)=u[n]-u[n-1]\Longrightarrow y(n)=h(n)+h(n-1)$&lt;/span&gt; take the result. Is my thought right? Because I saw somewhere some examples solving differently.&lt;/p&gt;&#xA;&lt;p&gt;for the above example the result is &lt;span class=&quot;math-container&quot;&gt;$y[n]=\left(\frac{1}{2}\right)^nu(n)-\left(\frac{1}{2}\right)^{n-1}u(n-1)  $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(there is a similar question &lt;a href=&quot;https://dsp.stackexchange.com/questions/20199/lti-system-output&quot;&gt;link&lt;/a&gt; but I have confused from the discussion.)&lt;/p&gt;&#xA;" OwnerUserId="16244" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-06-16T10:14:38.733" Title="LTI system impulse response output" Tags="|linear-systems|impulse-response|" AnswerCount="1" CommentCount="6" ClosedDate="2015-06-17T00:24:48.800" ContentLicense="CC BY-SA 3.0" />
  <row Id="24164" PostTypeId="2" ParentId="24154" CreationDate="2015-06-16T09:58:21.840" Score="13" Body="&lt;p&gt;Let's consider a discrete-time state space model (the derivation for a coninuous-time system is completely analogous):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\mathbf{q}[n+1]&amp;amp;=\mathbf{Aq}[n]+\mathbf{b}x[n]\\&#xA;y[n]&amp;amp;=\mathbf{c}^T\mathbf{q}[n]+dx[n]\tag{1}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is the input, $y[n]$ is the output, and $\mathbf{q}[n]$ is the state vector. Taking the $\mathcal{Z}$-transform of (1) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}z\mathbf{Q}(z)&amp;amp;=\mathbf{AQ}(z)+\mathbf{b}X(z)\\&#xA;Y(z)&amp;amp;=\mathbf{c}^T\mathbf{Q}(z)+dX(z)\tag{2}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the top equation of (2) we can express $\mathbf{Q}(z)$ in terms of $\mathbf{A}$, $\mathbf{b}$, and $X(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{Q}(z)=(z\mathbf{I}-\mathbf{A})^{-1}\mathbf{b}X(z)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{I}$ is the identity matrix of appropriate dimension. Plugging (3) into the second equation in (2) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=\mathbf{c}^T(z\mathbf{I}-\mathbf{A})^{-1}\mathbf{b}X(z)+dX(z)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which follows the expression for the transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y(z)}{X(z)}=\mathbf{c}^T(z\mathbf{I}-\mathbf{A})^{-1}\mathbf{b}+d\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix $(z\mathbf{I}-\mathbf{A})^{-1}$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(z\mathbf{I}-\mathbf{A})^{-1}=\frac{1}{\text{det}(z\mathbf{I}-\mathbf{A})}\mathbf{B}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{B}$ is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Adjugate_matrix&quot;&gt;adjugate matrix&lt;/a&gt; of $(z\mathbf{I}-\mathbf{A})$ whose elements are polynomials in $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging (6) into the expression for the transfer function (5) shows that the denominator of $H(z)$ is given by $\text{det}(z\mathbf{I}-\mathbf{A})$, which is the &lt;a href=&quot;https://en.wikipedia.org/?title=Characteristic_polynomial&quot;&gt;characteristic polynomial&lt;/a&gt; of $\mathbf{A}$ the roots of which are the eigenvalues of $\mathbf{A}$. Since the roots of the denominator of $H(z)$ are the system's poles, the eigenvalues of $\mathbf{A}$ and the poles of $H(z)$ are equivalent.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-16T09:58:21.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24165" PostTypeId="2" ParentId="24163" CreationDate="2015-06-16T10:02:23.113" Score="1" Body="&lt;p&gt;If your input signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=u[n]-u[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then it is in fact a unit impulse: $x[n]=\delta[n]$, which has only one non-zero value for $n=0$ ($x[0]=1$). All other values are zero. So the response to this input signal is the system's impulse response, because that's the definition of the impulse response: $y[n]=h[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $u[n]$ is the unit step, and the response to a unit step is not the impulse response but the step response. But for this example you don't need to compute the step response, because, as already mentioned, the input signal is simply a unit impulse.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-16T10:02:23.113" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="24166" PostTypeId="1" AcceptedAnswerId="24169" CreationDate="2015-06-16T11:52:44.133" Score="4" ViewCount="6245" Body="&lt;p&gt;What is the advantage of using a polyphase filter bank (PFB) for spectral analysis over just using the FFT? In the standard &lt;a href=&quot;http://cnx.org/contents/3dea9cf9-32b6-4bf2-940b-cf8d251a0a84@15/Uniformally_Modulated_%28DFT%29_Fi&quot; rel=&quot;nofollow&quot;&gt;&quot;critically sampled&quot; uniform DFT filterbank&lt;/a&gt;, the polyphase decimation/filtering is followed by an $M$-point DFT block, which implements the last step of the PFB in a computationally efficient manner using the FFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have to do an FFT anyways, why bother with the PFB? Is the reason that I can choose a custom prototype low-pass filter on the front-end? Are there some computational savings I'm missing out on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: If comparing this to a bank of quadrature downconverters, what is the point of using a PFB if the FFT is the same mathematically? It can't be the delay of $N$ samples requried to fill up an FFT block because the decimated branches have $1/N$ the rate, which means you will be waiting the same amount of time on average with either approach. What am I missing?&lt;/p&gt;&#xA;" OwnerDisplayName="user16223" LastEditorDisplayName="user16223" LastEditDate="2015-06-16T13:04:39.327" LastActivityDate="2015-06-16T13:04:39.327" Title="Purpose of using polyphase filter bank (PFB)" Tags="|frequency-spectrum|filter-bank|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24167" PostTypeId="2" ParentId="24166" CreationDate="2015-06-16T12:41:16.987" Score="0" Body="&lt;p&gt;The PFB is not really for spectral analysis.  The primary feature of the PFB is that you can use it to create multiple independent streams from the FFT output as if you had multiple independent quadrature downconverters, while being much more computationally efficient than the quadrature downconverter approach.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2015-06-16T13:04:24.653" LastActivityDate="2015-06-16T13:04:24.653" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24168" PostTypeId="2" ParentId="24161" CreationDate="2015-06-16T12:45:19.247" Score="2" Body="&lt;p&gt;The way to do it is to correlate the received signal with the signal you sent out- likely a chirp or something.  You correlate it with the signal from antenna 1, which will give you a time (location of the cross correlation peak) and phase (phase of the complex value of the peak).  You do the same with the signal from antenna 2, getting a time and phase.  If all is right the time should be the same (or, depending on your time resolution, very, very close).  The phase difference is simply the difference of the phases of the cross correlation peaks from the two antennas.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-06-16T12:45:19.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24169" PostTypeId="2" ParentId="24166" CreationDate="2015-06-16T13:03:23.010" Score="2" Body="&lt;p&gt;One advantage of a polyphase filterbank approach is, as you guessed, that you can control the frequency response of each channel. When using a DFT alone, you have limited control over the frequency band covered by each bin (characterized by a &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirichlet_kernel&quot; rel=&quot;nofollow&quot;&gt;Dirichlet kernel&lt;/a&gt; in the unwindowed case, or by the frequency response of whichever window function you select). This is sufficient for a lot of applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some other applications, however, you might want tighter control over the per-channel frequency response. Say you wanted to construct a DFT-based spectrum analyzer with very particular specifications (e.g. -3 dB response at the midpoint between output bins, -80 dB response at a one-bin spacing from center). You can utilize the polyphase filterbank structure to implement whatever filter is needed to achieve the specified level of performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another application is in cases where reconstruction is needed after the channelizer: if you're careful in the design of the polyphase filter, you can actually perform straightforward spectral modification (similar to the &quot;ideal filtering&quot; that many signal processing beginners attempt using the DFT) in the frequency domain, then use a synthesis filterbank to take the composite signal back into the time domain. This structure, with cascaded analysis and synthesis stages, is known as a &lt;a href=&quot;http://www.ece.mcgill.ca/~pkabal/papers/1990/Ramachandran1990.pdf&quot; rel=&quot;nofollow&quot;&gt;transmultiplexer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-06-16T13:03:23.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24170" PostTypeId="1" AcceptedAnswerId="24171" CreationDate="2015-06-16T16:07:30.260" Score="13" ViewCount="17443" Body="&lt;p&gt;Consider a white Gaussian noise signal &lt;span class=&quot;math-container&quot;&gt;$ x \left( t \right) $&lt;/span&gt;.&lt;br&gt;&#xA;If we sample this signal and compute the discrete Fourier transform, what are the statistics of the resulting Fourier amplitudes?&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="15347" LastEditDate="2019-08-20T06:52:51.737" LastActivityDate="2020-03-17T19:46:00.853" Title="What are the statistics of the discrete Fourier transform of white Gaussian noise?" Tags="|fourier-transform|noise|dft|random-process|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="24171" PostTypeId="2" ParentId="24170" CreationDate="2015-06-16T16:07:30.260" Score="16" Body="&lt;h1&gt;Math tools&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;We can do the calculation using some basic elements of probability theory and Fourier analysis.&#xA;There are three elements (we denote the probability density of a random variable $X$ at value $x$ as $P_X(x)$):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Given a random variable $X$ with distribution $P_X(x)$, the distribution of the scaled variable $Y = aX$ is $P_Y(y) = (1/a)P_X(y/a)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The probability distribution of a sum of two random variables is equal to the convolution of the probability distributions of the summands. In other words, if $Z = X + Y$ then $P_Z(z) = (P_X \otimes P_Y)(z)$ where $\otimes$ indicates convolution.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Fourier transform of the convolution of two functions is equal to the product of the Fourier transforms of those two functions. In other words:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$\int dx \, (f \otimes g)(x) e^{-i k x} =&#xA;\left( \int dx \, f(x) e^{-ikx} \right)&#xA;\left( \int dx \, g(x) e^{-ikx} \right) \, .&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Calculation&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Denote the random process as $x(t)$.&#xA;Discrete sampling produces a sequence of values $x_n$ which we assume to be statistically uncorrelated.&#xA;We also assume that for each $n$ $x_n$ is Gaussian distributed with standard deviation $\sigma$.&#xA;We denote the Gaussian function with standard deviation $\sigma$ by the symbol $G_\sigma$ so we would say that $P_{x_n}(x) = G_{\sigma}(x)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete Fourier transform amplitudes are defined as&#xA;$$X_k \equiv \sum_{n=0}^{N-1} x_n e^{-i 2 \pi n k /N} \, .$$&#xA;Focusing for now on just the real part we have&#xA;$$\Re X_k = \sum_{n=0}^{N-1} x_n \cos(2 \pi n k /N) \, .$$&#xA;This is just a sum, so by rule #2 the probability distribution of $\Re X_k$ is equal to the multiple convolution of the probability distributions of the terms being summed.&#xA;We rewrite the sum as&#xA;$$\Re X_k = \sum_{n=0}^{N-1} y_n$$&#xA;where&#xA;$$y_n \equiv x_n \cos(2\pi n k / N) \, .$$&#xA;The cosine factor is a deterministic scale factor.&#xA;We know that the distribution of $x_n$ is $G_\sigma$ so we can use rule #1 from above to write the distribution of $y_n$:&#xA;$$P_{y_n}(y) = \frac{1}{\cos(2 \pi n k / N)}G_\sigma \left( \frac{y}{\cos(2 \pi n k / N)} \right) = G_{\sigma c_{n,k}}(y)$$&#xA;where for brevity of notation we've defined $c_{n,k} \equiv \cos(2\pi n k / N)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the distribution of $\Re X_k$ is the multiple convolution over the functions $G_{\sigma c_{n,k}}$:&#xA;$$P_{\Re X_k}(x) = \left( G_{\sigma c_{0,k}} \otimes G_{\sigma c_{1,k}} \otimes \cdots \right)(x) \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not obvious how to do the multiple convolution, but using rule #3 it's easy.&#xA;Denoting the Fourier transform of a function by $\mathcal{F}$ we have&#xA;$$\mathcal{F}(P_{\Re X_k}) = \prod_{n=0}^{N-1} \mathcal{F}(G_{\sigma c_{n,k}}) \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of a Gaussian with width $\sigma$ is another Gaussian with width $1/\sigma$, so we get&#xA;\begin{align}&#xA;\mathcal{F}(P_{\Re X_k})(\nu)&#xA;&amp;amp;= \prod_{n=0}^{N-1} G_{1/\sigma c_{n,k}}\\&#xA;&amp;amp;= \prod_{n=0}^{N-1} \sqrt{\frac{\sigma^2 c_{n,k}^2}{2\pi}} \exp \left[ \frac{-\nu^2}{2 (1 / \sigma^2 c_{n,k}^2)}\right] \\&#xA;&amp;amp;= \left( \frac{\sigma^2}{2\pi} \right)^{N/2} \left(\prod_{n=0}^{N-1}c_{n,k} \right) \exp \left[ -\frac{\nu^2}{2} \sigma^2 \sum_{n=0}^{N-1} \cos(2\pi nk/N)^2 \right] \, .&#xA;\end{align}&#xA;All of the stuff preceding the exponential are independent of $\nu$ and are therefore normalization factors, so we ignore them.&#xA;The sum is just $N/2$ so we get&#xA;\begin{align}&#xA;\mathcal{F}(P_{\Re X_k}) &amp;amp;\propto&#xA;\exp \left[ - \frac{\nu^2}{2} \sigma^2 \frac{N}{2}\right]\\&#xA;&amp;amp;= G_{\sqrt{2 / \sigma^2 N}}&#xA;\end{align}&#xA;and therefore&#xA;$$P_{\Re X_k} = G_{\sigma \sqrt{N/2}} \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have therefore computed the probability distribution of the real part of the Fourier coefficient $X_k$.&#xA;It is Gaussian distributed with standard deviation $\sigma \sqrt{N/2}$.&#xA;Note that the distribution is independent of the frequency index $k$, which makes sense for uncorrelated noise.&#xA;By symmetry the imaginary part should be distributed exactly the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively we expect adding more integration should reduce the width of the resulting noise distribution.&#xA;However, we found that the standard deviation of the distribution of $X_k$ &lt;em&gt;grows&lt;/em&gt; as $\sqrt{N}$.&#xA;This is just due to our choice of normalization of the discrete Fourier transform.&#xA;If we had instead normalized it like this&#xA;$$X_k = \frac{1}{N} \sum_{n=0}^{N-1} x_n e^{-i 2 \pi n k /N}$$&#xA;then we would have found&#xA;$$P_{\Re X_k} = G_{\sigma / \sqrt{2N}}$$&#xA;which agrees with the intuition that the noise distribution gets smaller as we add more data.&#xA;With this normalization, a coherent signal would demodulate to a fixed amplitude phasor, so we recover the usual relation that the ratio of the signal to noise amplitudes scales as $\sqrt{N}$.&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="7361" LastEditDate="2015-06-16T21:59:45.310" LastActivityDate="2015-06-16T21:59:45.310" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="24172" PostTypeId="1" AcceptedAnswerId="24173" CreationDate="2015-06-16T17:46:22.227" Score="3" ViewCount="121" Body="&lt;p&gt;I have a sensor reduction model which gives me a velocity estimate of a suspension system(velocity 1) .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This suspension system estimate velocity is used to calculate another velocity(velocity 2) via a transfer function/plant model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I use velocity 2 to improve my velocity estimate (velocity 1) through Kalman filtering or through some feedback system.??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KIdVs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16264" LastEditorUserId="128" LastEditDate="2019-10-31T06:04:27.047" LastActivityDate="2019-10-31T06:04:27.047" Title="Improving Velocity Estimation Using Multiple Sensors in a Dynamic System" Tags="|signal-analysis|kalman-filters|control-systems|dynamic-system|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24173" PostTypeId="2" ParentId="24172" CreationDate="2015-06-16T18:20:42.553" Score="2" Body="&lt;p&gt;You can do that if you have new data to merge in.&lt;br&gt;&#xA;For instance if you have a sensor for Velocity 1 and a sensor for Velocity 2 and in addition a connection between Velocity 1 and Velocity 2 you can use Kalman.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet if you have only one sensor for Velocity 1 which with the transfer system you estimate the Velocity 2 there is no additional info to fuse in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What might be done is that if you have information about the model of Velocity 2 in time you can use that (Though, the right thing to do would be reflect this model into Velocity 1 by the connection of the two, apply Kalman on Velocity 1 and from there infer Velocity 2).&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-06-16T18:20:42.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24174" PostTypeId="2" ParentId="24157" CreationDate="2015-06-16T18:33:51.083" Score="1" Body="&lt;p&gt;Each symbol (in the narrow sense - bit) in your frame modulates a sine wave of frequency depends on symbol's number and phase depends of symbol's value. It can be watched from the Inverse Fourier transform. Then these sin waves are added to each other to create time domain signal. If you change phase relations in your data frame, you change phase relations in sine waves in the sum. By this multiplication you actually do this. So obviously it alter PAPR. OFDM precoding technique (e.g. based on Hadamard orthogonal transform) is an example of using this Fourier property.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-06-16T18:33:51.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24176" PostTypeId="1" CreationDate="2015-06-16T19:38:18.703" Score="1" ViewCount="43" Body="&lt;p&gt;If&#xA;$$\alpha_k = \sum_l a_l \ \ g((k-l)T-l\Delta T)$$&#xA;$$s_k = \sum_l \alpha_l \ \ q((k-l)T+k\Delta T)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a_l \in \pm1$ and $g(t) = \frac {\sin(\pi t/T)}{\pi t/T}$ and $q(t) = \frac {\sin(\pi t/(T+\Delta T))}{\pi t/(T+\Delta T)}$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can we prove $\forall k, s_k =a_k $?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_k = \sum_l \sum_i a_i g((l-i)T-i\Delta T) \ \ q((k-l)T+k\Delta T)$$&#xA;$$  \ \ \ =\sum_i a_i \sum_l g((l-i)T-i\Delta T) \ \ q((k-l)T+k\Delta T)$$&#xA;If $k=i$,&#xA;$$=a_k \sum_l g((l-k)T-k\Delta T) \ \ q((l-k)T-k\Delta T)$$&#xA;Now, is $\sum_l g((l-k)T-k\Delta T) \ \ q((l-k)T-k\Delta T)=1$? How to proceed for $k\not=i$?&lt;/p&gt;&#xA;" OwnerUserId="15404" LastActivityDate="2015-06-16T19:38:18.703" Title="How to proceed with this convolution problem?" Tags="|sampling|interpolation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24179" PostTypeId="2" ParentId="23535" CreationDate="2015-06-16T21:33:35.633" Score="1" Body="&lt;p&gt;This answer is related to my answer to &lt;a href=&quot;https://dsp.stackexchange.com/questions/24129/spectral-density-of-modulated-noise-process&quot;&gt;this question of yours&lt;/a&gt;. The short answer is that in general the random process $f(t)$ has no power spectral density because it is not wide sense stationary (WSS), even if $I(t)$ and $Q(t)$ are.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I will first introduce some &lt;strong&gt;notation&lt;/strong&gt;. I use the following definition of the autocorrelation function of a (possibly complex) random process $X(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_X(t,\tau)=E\{X(t+\tau)X^*(t)\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $E\{\cdot\}$ denotes the expectation operator, and $^*$ denotes complex conjugation. Note that this definition with the complex conjugate is consistent with the usual definition of the inner product of complex functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cross-correlation of two (possible complex) random processes $X(t)$ and $Y(t)$ is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{XY}(t,\tau)=E\{X(t+\tau)Y^*(t)\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, the cross-correlation of $X(t)$ and its complex conjugate $X^*(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{XX^*}=E\{X(t+\tau)X(t)\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $X(t)$ is wide-sense stationary (WSS), then its autocorrelation function only depends on the time difference $\tau$ and is written as $R_X(\tau)$. Similarly, if two processes $X(t)$ and $Y(t)$ are jointly WSS, their cross-correlation function only depends on the time difference $\tau$ and is written as $R_{XY}(\tau)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For WSS processes, the power spectrum is defined as the Fourier transform of their autocorrelation function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_X(\omega)=\int_{-\infty}^{\infty}R_X(\tau)e^{-j\omega\tau}d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for two jointly WSS processes, their cross-spectral density is given by the Fourier transform of their cross-correlation function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_{XY}(\omega)=\int_{-\infty}^{\infty}R_{XY}(\tau)e^{-j\omega\tau}d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now for the &lt;strong&gt;answer&lt;/strong&gt; of the question. To see that $f(t)$ is generally not WSS, define a complex-valued WSS process $X(t)$ by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(t)=I(t)+jQ(t)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with real-valued and jointly WSS processes $I(t)$ and $Q(t)$.&#xA;The process $f(t)$ is then given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\Re\{X(t)e^{j\Omega t}\}=\frac12(X(t)e^{j\Omega t}+X^*(t)e^{-j\Omega t})\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The auto-correlation function of the real-valued process $f(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_f(t,\tau)=E\{f(t+\tau)f(t)\}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging (2) into (3) gives (after some straightforward manipulations)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_f(t,\tau)=\frac12\Re\{R_X(\tau)e^{j\Omega\tau}\}+&#xA;\frac12\Re\{R_{XX^*}(\tau)e^{j\Omega(\tau+2t)}\}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (4) it is clear that the auto-correlation function of $f(t)$ depends on $t$, and, consequently, the power spectral density of $f(t)$ is not defined. However, if $R_{XX^*}(\tau)=0$ and if $E\{X(t)\}=0$ then $f(t)$ is WSS and has a power spectral density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cross-correlation of $X(t)$ and $X^*(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}R_{XX^*}(\tau)&amp;amp;=E\{X(t+\tau)X(t)\}\\&amp;amp;=E\{(I(t+\tau)+jQ(t+\tau))(I(t)+jQ(t))\}\\&amp;amp;=\ldots\\&amp;amp;=R_I(\tau)-R_Q(\tau)+j(R_{IQ}(\tau)+R_{IQ}(-\tau))\end{align}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $R_I(\tau)$ and $R_Q(\tau)$ are the auto-correlation functions of $I(t)$ and $Q(t)$, respectively, and $R_{IQ}(\tau)$ is the cross-correlation of $I(t)$ and $Q(t)$. From (5) it is obvious that the condition $R_{XX^*}(\tau)=0$ is satisfied if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}R_I(\tau)&amp;amp;=R_Q(\tau)\\&#xA;R_{IQ}(\tau)&amp;amp;=-R_{IQ}(-\tau)\end{align}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is satisfied, i.e. if $I(t)$ and $Q(t)$ have the same auto-correlation function (and thus the same power spectrum), and if $R_{IQ}(\tau)$ is an odd function, the latter implying $R_{IQ}(0)=0$, i.e. $I(t)$ and $Q(t)$ are uncorrelated when sampled at the same instant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The auto-correlation function $R_X(\tau)$ can be expressed in terms of $R_I(\tau)$, $R_Q(\tau)$, and $R_{IQ}(\tau)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}R_X(\tau)&amp;amp;=E\{X(t+\tau)X^*(t)\}\\&amp;amp;=\ldots\\&amp;amp;=R_I(\tau)+R_Q(\tau)-j(R_{IQ}(\tau)-R_{IQ}(-\tau))\end{align}\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the conditions (6) are satisfied, this becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_X(\tau)=2(R_I(\tau)-jR_{IQ}(\tau))\tag{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pluggin (8) into (4) gives for the auto-correlation function of $f(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_f(\tau)=R_I(\tau)\cos(\Omega\tau)+R_{IQ}\sin(\Omega\tau)\tag{9}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(assuming the conditions (6) are satisfied). From (9) the power spectral density of $f(t)$ can be expressed by the power spectral densities of $I(t)$ and $Q(t)$, and by the cross-power spectral density of $I(t)$ and $Q(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_f(\omega)=\frac12[S_I(\omega-\Omega)+S_I(\omega+\Omega)]+\frac{1}{2j}[S_{IQ}(\omega-\Omega)-S_{IQ}(\omega+\Omega)]\tag{10}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the final result. Note that $S_f(\omega)$ is of course real-valued because due to the second condition in (6), the cross-power spectral density $S_{IQ}(\omega)$ is purely imaginary and, consequently, the second term on the right-hand side of (10) is real-valued.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-06-18T08:19:57.107" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24180" PostTypeId="1" CreationDate="2015-06-16T22:23:09.930" Score="0" ViewCount="1084" Body="&lt;p&gt;I've seen many implementations to filter out frequency components of some time domain signal by performing a DFT, zeroing the unwanted frequency bins, and performing the IDFT to get the filtered signal, but more than a few times I've seen the results of the DFT treated as frequency components from 0 to the sampling rate instead of 0 to half the sampling rate then the complex conjugates. Take for example this bandpass implementation by a group at MIT: &lt;a href=&quot;https://github.com/diego898/matlab-utils/blob/master/toolbox/EVM_Matlab/ideal_bandpassing.m&quot; rel=&quot;nofollow&quot;&gt;https://github.com/diego898/matlab-utils/blob/master/toolbox/EVM_Matlab/ideal_bandpassing.m&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's defining the frequency bins and corresponding bandpass filter as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Freq = 1:n;&#xA;Freq = (Freq-1)/n*samplingRate;&#xA;mask = Freq &amp;gt; wl &amp;amp; Freq &amp;lt; wh;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;n being the number of samples and wl and wh being the low and high frequencies respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first intuition is that that's incorrect, but it makes me wonder if I'm missing something since I've seen it done this way multiple times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the more interesting question to me is, assuming it is wrong: what physical meaning, if any, does removing one but not both of these complex conjugates have? For example, if I used the above bandpass implementation to make a low-pass filter which filtered out one half the sampling frequency, I would keep the DC component and all the first complex values. But then I would remove all of their conjugates. While I don't actually think that's the low pass filter intended, it does still have the effect of smoothing out the signal, but how would you describe that? I don't imagine it's still considered a temporal filter in that case.&lt;/p&gt;&#xA;" OwnerUserId="16269" LastEditorUserId="7092" LastEditDate="2015-06-16T22:41:15.023" LastActivityDate="2015-12-14T16:23:21.047" Title="Frequency filtering with a DFT and meaning of removing complex conjugates" Tags="|matlab|filters|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24181" PostTypeId="2" ParentId="23911" CreationDate="2015-06-17T01:32:35.920" Score="0" Body="&lt;p&gt;I would suggest you go to &lt;a href=&quot;http://journals.plos.org/plosbiology/&quot; rel=&quot;nofollow&quot;&gt;PLOS Biology&lt;/a&gt; and do a search for &quot;Signaling MatLab&quot;.  There are many scientific papers there on various biology research topics.  Some even give the Matlab commands used.  &lt;/p&gt;&#xA;" OwnerUserId="15148" LastActivityDate="2015-06-17T01:32:35.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24183" PostTypeId="1" AcceptedAnswerId="24184" CreationDate="2015-06-17T02:09:55.780" Score="0" ViewCount="605" Body="&lt;p&gt;Is it correct to say that the spectrum of an OFDM signal is rectangular pulse?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about the spectrum of each transmitted signal over subcarriers? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the OFDM signal has a rectangular frequency domain spectrum, then the time domain after IDFT is much like a sinc function. Do we need pulse shaping in this case, since sinc function already looks like pulse shape?&lt;/p&gt;&#xA;" OwnerUserId="15590" LastActivityDate="2015-06-17T03:04:00.463" Title="OFDM signal spectrum and characterisitics" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24184" PostTypeId="2" ParentId="24183" CreationDate="2015-06-17T03:04:00.463" Score="2" Body="&lt;p&gt;Your statement isn't strictly correct; the spectrum of an OFDM signal isn't a rectangular pulse. Think about it this way: OFDM is really just a method to efficiently modulate multiple low-rate narrowband signals that are sent simultaneously. Therefore, the OFDM signal's spectrum is really just the sum of the spectra of each of its narrowband components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your OFDM signal has 64 BPSK subcarriers, then its spectrum is equal to the spectra of 64 narrowband BPSK signals, spaced at the OFDM subcarrier spacing. If you were to estimate the OFDM signal's power spectrum with a wide enough resolution bandwidth, then the spectrum would appear to be rectangular. However, if you look closely enough at the signal's spectrum, you'll notice that it isn't flat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example MATLAB script that demonstrates the phenomenon:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% generate random BPSK symbol vector; this is equal to the &quot;low-resolution&quot;&#xA;% spectrum, calculated with bin spacing synchronized with the OFDM&#xA;% subcarrier grid&#xA;X = 1 - 2 * (randn(64,1) &amp;gt; 0.5);&#xA;f = -0.5 + (0:length(X)-1) / 64;&#xA;% create time-domain OFDM symbol using the IFFT&#xA;x = ifft(X);&#xA;% calculate interpolated spectrum to see what it looks like between OFDM&#xA;% subcarrier centers&#xA;Sh = fftshift(fft(x,4096));&#xA;fh = -0.5 + (0:length(Sh)-1) / 4096;&#xA;&#xA;figure; &#xA;plot(f,abs(X)); hold all; grid on;&#xA;plot(fh,abs(Sh));&#xA;legend('Regular', 'Interpolated');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/txRAy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the modulated OFDM signal doesn't have a perfectly rectangular spectrum as you guessed, it does not necessarily have a sinc-like shape in the time domain either.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-06-17T03:04:00.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24185" PostTypeId="2" ParentId="24180" CreationDate="2015-06-17T05:14:34.940" Score="1" Body="&lt;p&gt;If the filtered result in the frequency domain is no longer conjugate symmetric, then then the time domain result after a full IFFT will be complex, not real.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one ignores the imaginary component of this complex time domain result, then all the sine components will be thrown away.  Sure the signal will be filtered, but a lot more will be filtered out than expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But they might might be doing an inverseRealFFT, which essentially forces the input to a full IFFT be conjugate symmetric, thus ignoring the incorrectly filtered upper or negative portion of the FFT vector.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-06-17T05:14:34.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24186" PostTypeId="2" ParentId="23959" CreationDate="2015-06-17T07:45:44.827" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://github.com/FFmpeg/FFmpeg&quot; rel=&quot;nofollow&quot;&gt;ffmpeg&lt;/a&gt; implementation of the HEVC decoding follows this formula instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ |p_2,_0 - 2p_1,_0+p_0,_0|+|p_2,_3 - 2p_1,_3+p_0,_3|+|q_2,_0 - 2q_1,_0+q_0,_0|+|q_2,_3 - 2q_1,_3+q_0,_3|&amp;lt;\beta \ (1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This appears in the &lt;a href=&quot;https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/x86/hevc_deblock.asm&quot; rel=&quot;nofollow&quot;&gt;hevc_deblock.asm&lt;/a&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;;compare&#xA;    pcmpgtw         m15, m13, m14&#xA;    movmskps        r13, m15 ;filtering mask 0d0 + 0d3 &amp;lt; beta0 (bit 2 or 3) , 1d0 + 1d3 &amp;lt; beta1 (bit 0 or 1)&#xA;    test            r13, r13&#xA;    je              .bypassluma&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So I conclude that there is a mistake in the paper and the correct formula is that one (since it also makes more sense).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: As the comment suggested, I checked in the reference implementation for the algorithm and the interesting part is here in the file &lt;a href=&quot;https://hevc.hhi.fraunhofer.de/svn/svn_HEVCSoftware/trunk/source/Lib/TLibCommon/TComLoopFilter.cpp&quot; rel=&quot;nofollow&quot;&gt;TComLoopFilter.cpp&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (UInt iBlkIdx = 0; iBlkIdx&amp;lt;uiBlocksInPart; iBlkIdx ++)&#xA;      {&#xA;        Int dp0 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+0), iOffset);&#xA;        Int dq0 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+0), iOffset);&#xA;        Int dp3 = xCalcDP( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+3), iOffset);&#xA;        Int dq3 = xCalcDQ( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+3), iOffset);&#xA;        Int d0 = dp0 + dq0;&#xA;        Int d3 = dp3 + dq3;&#xA;&#xA;        Int dp = dp0 + dp3;&#xA;        Int dq = dq0 + dq3;&#xA;        Int d =  d0 + d3;&#xA;&#xA;//...&#xA;&#xA;        if (d &amp;lt; iBeta) //&amp;lt;-not a &amp;gt;Beta as the paper said&#xA;        {&#xA;          Bool bFilterP = (dp &amp;lt; iSideThreshold);&#xA;          Bool bFilterQ = (dq &amp;lt; iSideThreshold);&#xA;&#xA;          Bool sw =  xUseStrongFiltering( iOffset, 2*d0, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+0))&#xA;          &amp;amp;&amp;amp; xUseStrongFiltering( iOffset, 2*d3, iBeta, iTc, piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+3));&#xA;&#xA;          for ( Int i = 0; i &amp;lt; DEBLOCK_SMALLEST_BLOCK/2; i++)&#xA;          {&#xA;            xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+i), iOffset, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ, bitDepthLuma);&#xA;          }&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16145" LastEditorUserId="16145" LastEditDate="2015-07-15T06:34:35.823" LastActivityDate="2015-07-15T06:34:35.823" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24188" PostTypeId="1" AcceptedAnswerId="24213" CreationDate="2015-06-17T08:15:18.110" Score="4" ViewCount="11139" Body="&lt;p&gt;The condition for Discrete time Fourier transform to exist for function $f(n)$ is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{-\infty}^\infty |f(n)|  &amp;lt; \infty.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of continuous Fourier transform the difference is summation is replaced by integration in the above equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks something&#xA;strange for me because on left side we are&#xA;taking the signal within 1. &lt;strong&gt;infinity&#xA;limits&lt;/strong&gt;. Also,2. it is again of &lt;strong&gt;summation type&lt;/strong&gt; and &lt;strong&gt;we are expecting right side to be less than infinity&lt;/strong&gt;. How is it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us take two  examples&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Suppose there is unit step signal $u(n)$&#xA;  with constant unity magnitude&#xA;  ranging from o to $\infty$ .then we&#xA;  can clearly see by putting value&#xA;  in the above formula&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;L.H.S=1+1+1+......upto ${\infty}$&#xA;So R.H.S. =$\infty$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So can I say that DTFT of unit step signal doesn't exist?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;Similarly, if I represent the  power signal like $cos(wn)$  using the exponential terms and compute it's value from the formula of condition of existence ,it will come out to be&#xA;  $\infty$ .&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So can I say that DTFT of power signal like &#xA; $cos(wn)$ doesn't exist?&lt;/p&gt;&#xA;" OwnerUserId="15429" LastEditorUserId="15429" LastEditDate="2015-06-17T15:51:20.993" LastActivityDate="2015-06-19T14:13:21.990" Title="How condition for existence of Fourier transform is valid?" Tags="|fft|signal-analysis|fourier-transform|transform|dtft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24190" PostTypeId="2" ParentId="23911" CreationDate="2015-06-17T09:27:17.363" Score="0" Body="&lt;p&gt;I don't have enough reputation to comment... You can use&#xA;&lt;a href=&quot;http://physionet.org/&quot; rel=&quot;nofollow&quot;&gt;Physionet&lt;/a&gt;. Through it you have access to physiological databases and software kits for data analysis. The software tools are programmed in MATLAB. Relevant papers can be found in the software documentation or in the Physionet library under publications. Also, it's free. &lt;/p&gt;&#xA;" OwnerUserId="10646" LastActivityDate="2015-06-17T09:27:17.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24191" PostTypeId="1" CreationDate="2015-06-17T09:59:01.017" Score="0" ViewCount="2367" Body="&lt;p&gt;I am currently analysing my signal by looking at its spectrogram to determine the sinusoidal frequency content at the local sections of my signal overtime. I can do my spectrogram in 2 ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Directly get the FFT of each local sections. Same as I multiply each section by a rectangular window with a height 1 and get the FFT.&lt;/li&gt;&#xA;&lt;li&gt;Multiply each section by a Gaussian window and get the FFT.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Apparently, I get 2 different pictures of my spectrogram. Number 2 is known as the Gabor Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question here is, what is the motivation for doing the Gabor Transform vs directly doing the FFT at each section of a signal?&lt;/p&gt;&#xA;" OwnerUserId="16273" LastEditorUserId="4346" LastEditDate="2016-04-13T18:53:08.517" LastActivityDate="2017-04-09T07:26:08.057" Title="STFT multiplied with Gaussian window vs STFT multiplied by rectangular window" Tags="|transform|spectrogram|gabor|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24193" PostTypeId="2" ParentId="23735" CreationDate="2015-06-17T11:09:44.457" Score="1" Body="&lt;p&gt;Compressed sensing theory (see for example &lt;a href=&quot;http://dsp.rice.edu/sites/dsp.rice.edu/files/cs/CSintro.pdf&quot; rel=&quot;nofollow&quot;&gt;Candès &amp;amp; Wakin, 2008&lt;/a&gt;) states that, given you have enough measurements $y$, the shown $\ell_1$ minimisation problem recovers $x$ exactly with very high probability. This means that your correct solution must have the smallest possible $\ell_1$ norm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what the figure shows; the &quot;$\ell_1$ ball&quot; intersects the plane given by $\Phi x' = y$ at the point $x'$ with the smallest $\ell_1$ norm. There are, as you mention, other sparse solutions - i.e. the ones where the plane intersects the other two axes. As we can imagine from the figure, these points however have larger $\ell_1$ norm and are therefore not the correct solution.&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2015-06-17T11:09:44.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24194" PostTypeId="1" CreationDate="2015-06-17T11:22:51.070" Score="0" ViewCount="229" Body="&lt;p&gt;I'm trying to analyse a series of CT scans of coral samples, but am fairly new to this sort of image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I've hit is that a lot of the coral is hollow (in the images), and even worse, a lot is hollow but open sided (ie incomplete holes). For the complete circles I can use a Fill Holes process, which tends to work well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, since most of the coral holes are only semicircles the software cannot detect it's true shape. Is there something that might interpolate the missing coral and then fill the internal structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/KrnZ4.png&quot; alt=&quot;Some complete and some incomplete holes&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As seen in this image, some of the coral structure creates a complete circle (eg bottom right), but others are just semicircular shapes, or even hollow tubes (mid-right, top-right, all over the place...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may be further confused by the fact that in reality it is trying to fill a volume (as opposed to an area) because the images stack up into a 3d structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to use ImageJ, but am willing to try other tools if there is a way around this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Chris&lt;/p&gt;&#xA;" OwnerUserId="16275" LastEditorUserId="128" LastEditDate="2023-07-14T19:09:35.517" LastActivityDate="2023-07-14T19:09:35.517" Title="Fill Incomplete Holes in 3D Image of Corals" Tags="|image-processing|image-segmentation|morphological-operations|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24195" PostTypeId="2" ParentId="23851" CreationDate="2015-06-17T11:29:27.320" Score="8" Body="&lt;p&gt;The restricted isometry property states that:&#xA;$$\begin{equation}&#xA;  (1-\delta_S)||x||_2^2 \le ||A x||_2^2 \le (1+\delta_S)||x||_2^2&#xA;\end{equation}$$&#xA;for any $S$-sparse vector $x$. The restricted isometry constant is $\delta_S$, $0 &amp;lt; \delta_S &amp;lt; 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that the matrix $A$ is guaranteed to only change the length of any vector $x$ &quot;very little&quot; as long as the vector $x$ is at least $S$-sparse (has at most $S$ non-zero coefficients).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have arbitrary $\frac{S}{2}$-sparse vectors $x$. In order to be able to reconstruct such vectors in general, from measurements taken as $y = A x$, we need to be sure that it is possible to distinguish between measurements $y_1 = A x_1$ and $y_2 = A x_2$ of any two such vectors. If $y_1 = y_2$ for any two such vectors $x_1$ and $x_2$, we would not be able to distinguish them and reconstruct them unambigously. Therefore we need to make sure that measurements of any two $\frac{S}{2}$-sparse vectors are &quot;sufficiently different&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we calculate the difference between any two $\frac{S}{2}$-sparse vectors, their difference can be at most $S$-sparse. So for reconstructing any $\frac{S}{2}$-sparse vector correctly from measurements taken with $A$, the restricted isometry property quantifies how well $A$ lets us do that (the smaller $\delta_S$, the better).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an early introduction to compressed sensing and the restricted isometry property (and other concepts), see &lt;a href=&quot;http://dsp.rice.edu/sites/dsp.rice.edu/files/cs/CSintro.pdf&quot; rel=&quot;noreferrer&quot;&gt;Candès &amp;amp; Wakin, 2008&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2015-06-17T11:29:27.320" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24196" PostTypeId="2" ParentId="22839" CreationDate="2015-06-17T12:16:25.580" Score="2" Body="&lt;p&gt;As far as choosing the right dictionary (basis) goes, there are several things to take into account. You do want your representation $s$ to be as sparse as possible and that depends a lot on the chosen dictionary. In practice, people are often looking at a particular type of signals $x$ which they know from domain knowledge to be sparse in some dictionary (discrete wavelet transform, discrete Fourier transform, etc.). However, you also need the dictionary $\Psi$ to &quot;work well&quot; together with the measurement matrix $\Phi$. This can be measured by their coherence (see e.g. &lt;a href=&quot;http://dsp.rice.edu/sites/dsp.rice.edu/files/cs/CSintro.pdf&quot; rel=&quot;nofollow&quot;&gt;Candès &amp;amp; Wakin, 2008&lt;/a&gt;). If you are free to choose $\Phi$ as you like, you can select the dictionary $\Psi$ that gives you the sparsest representation and then select $\Phi$ to be incoherent with $\Psi$. In practice $\Phi$ is often limited by hardware constraints and then you may have to select a suboptimal $\Psi$ with respect to sparsity in order to achieve incoherence with $\Phi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach is dictionary learning where you can use (many) examples of the type of signal $x$ you are looking for to learn a dictionary $\Psi$, see for example &lt;a href=&quot;http://www.cs.technion.ac.il/~elad/publications/journals/2004/32_KSVD_IEEE_TSP.pdf&quot; rel=&quot;nofollow&quot;&gt;Aharon, Elad, Bruckstein, 2006&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2015-06-17T12:16:25.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24198" PostTypeId="2" ParentId="24188" CreationDate="2015-06-17T14:00:11.033" Score="1" Body="&lt;p&gt;It's sufficient for a function to be in $L^1$ (i.e. $\int_{-\infty}^\infty |f|&amp;lt; \infty$) or $L^2$  (i.e. $\int_{-\infty}^\infty |f|^2 &amp;lt; \infty$) to have the Fourier transform exist, but not necessary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example where a Fourier transform exists but the function is not in $L^1$ or $L^2$ is the complex sinusoids $e^{j \omega_0 t}$ (which has the Fourier transform being given as the distribution $\delta(\omega - \omega_0)$). Since you can write cosine as a sum of two complex sinusoids, you get the existence of its Fourier transform that way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the unit step, it requires some finesse so see &lt;a href=&quot;http://web.stanford.edu/class/ee102/lectures/fourtran&quot; rel=&quot;nofollow&quot;&gt;these notes&lt;/a&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-06-17T14:00:11.033" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="24199" PostTypeId="1" CreationDate="2015-06-17T16:54:38.557" Score="0" ViewCount="298" Body="&lt;p&gt;The following has been mentioned regarding spreading using a 32 chip sequence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;32x spreading contributes a theoretical 15 dB gain to the link budget,&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no clue, why so? Are we referring to the processing gain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought spreading was  performed to mitigate narrow band noise and ISI.&lt;/p&gt;&#xA;" OwnerUserId="15590" LastActivityDate="2015-06-17T16:54:38.557" Title="Spreading sequence and processing gain" Tags="|digital-communications|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24203" PostTypeId="2" ParentId="23801" CreationDate="2015-06-17T19:58:27.443" Score="1" Body="&lt;p&gt;I'm not sure if I can help you with a perfect solution, but hopefully at least with some hints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell the kernel for the smoothing filter of the wavelet (power/amplitude) spectrum has to scale with the size of the reproducing kernel of the wavelet, i.e. the window width in time scales with wavelet scale, and window width in scale depends on your 'sampling' in scale direction – for instance you use a fixed window width for log scaling, but you would need to adapt the smoothing filter window width if you would decide for a linear scaling in scale, which is also quite common in cwt analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding problems close to nyquist I can say that any analysis of frequencies close to nyquist have to be taken with care as your approximation of the continuous (!) wavelet transform get's pretty bad close to nyquist. Further you smoothing filter will cause boundary effects especially close to nyquist as you cannot go above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally I want to recommend you &lt;a href=&quot;https://publishup.uni-potsdam.de/opus4-ubp/files/811/maraun_diss.pdf&quot; rel=&quot;nofollow&quot;&gt;this PhD Thesis&lt;/a&gt; by Douglas Maraun which focuses exactly on this topic and extends the work done by Torrence and formalizes it in a mathematical more rigorous way. There is some software package &lt;a href=&quot;http://tocsy.pik-potsdam.de/wavelets/&quot; rel=&quot;nofollow&quot;&gt;available&lt;/a&gt; as well, not sure, however, if this is still maintained.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2015-06-17T19:58:27.443" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24205" PostTypeId="1" CreationDate="2015-06-17T20:59:36.550" Score="2" ViewCount="123" Body="&lt;p&gt;For each frame, what's sent over to the receiver for decoding? The coefficients , pitch in some bits, voiced/unvoiced classification in another bit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another broad question to develop intuition about LPC and CELP for speech encoding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using spectral envelope estimation with LPC and related speech coders, does the bitrate reduction happen because the original fluctuations in the frequency spectrum envelope of the original audio signal require more bits to represent? And so in approximating the amplitude spectral envelope fewer bits can be used to represent the speech? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, the quality reduction is the result of the elimination of the spectral envelope fluctuations and the bitrate reduction results from only transmitting the LPC coefficients, pitch period, and voiced/unvoiced classification versus transmitting some stream of data for each frame, and then the receiver decodes the coefficients, voiced/unvoiced, and pitch info...?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-06-19T02:49:37.703" LastActivityDate="2015-06-19T02:49:37.703" Title="What is actually transmitted following LPC of a speech frame?" Tags="|digital-communications|speech|lpc|speech-synthesis|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24206" PostTypeId="2" ParentId="23428" CreationDate="2015-06-17T21:45:22.037" Score="2" Body="&lt;p&gt;For audio files you want to use dBFS, dB relative to full scale:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/DBFS&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/DBFS&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="16283" LastActivityDate="2015-06-17T21:45:22.037" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24207" PostTypeId="2" ParentId="22712" CreationDate="2015-06-17T23:13:44.593" Score="2" Body="&lt;p&gt;I think all these answers fail to provide a descent methodology. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should consider &quot;the closeness&quot; of the images as the availability of the initial pose and cast this as a registration problem. The solution can typically be obtained through a least-squares adjustment, i.e., by minimizing the distances of the model points (from first image) to their corresponding image points. In case of a perspective distortion, you could optimize the 9 parameters of the homography matrix. Methods like &lt;a href=&quot;http://de.mathworks.com/matlabcentral/fileexchange/24677-lucas-kanade-affine-template-tracking&quot; rel=&quot;nofollow&quot;&gt;Lukas Kanade&lt;/a&gt;, &lt;a href=&quot;http://far.in.tum.de/pub/benhimane2004iros1/benhimane2004iros1.pdf&quot; rel=&quot;nofollow&quot;&gt;ESM&lt;/a&gt; or &lt;a href=&quot;http://campar.in.tum.de/twiki/pub/Chair/TeachingWs09MATDCV/Juries-Hyperplane.pdf&quot; rel=&quot;nofollow&quot;&gt;hyperplane tracking&lt;/a&gt; are some ways to do that. In essence, the procedure is similar to &lt;a href=&quot;https://en.wikipedia.org/wiki/Iterative_closest_point&quot; rel=&quot;nofollow&quot;&gt;ICP&lt;/a&gt;, where an iterative procedure is applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.robots.ox.ac.uk/~cmei/articles/single_view_track_ITRO.pdf&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is one work, extending ESM and comparing a few methods. If your camera is calibrated, you could benefit from some &lt;a href=&quot;http://handheldar.icg.tugraz.at/download/Pi11-ISMAR.pdf&quot; rel=&quot;nofollow&quot;&gt;alternative methods&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, to begin with, one could always resort to a simple approach, where you try different combinations of rigid motion $[-2,2]$ degrees for rotation and $[-5,5]$ pixels for translation. Then transform your template with all possible poses (in this case ~$40-50$). Then interpolate the sum of squared differences or normalized cross correlation scores in the pose space (6DOF freedom or 9DOF homography) to get a subpixel accurate refinement. This should give you a rough yet a better alignment. Keep in mind that you could also use this scheme iteratively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have absolutely no clue on how to do any of these, check out &lt;a href=&quot;http://www.codeproject.com/Articles/25435/Image-Alignment-Algorithms-Part-II&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-06-17T23:13:44.593" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24209" PostTypeId="2" ParentId="6313" CreationDate="2015-06-18T01:20:23.577" Score="1" Body="&lt;p&gt;It's already been pointed out that $n$ and $m$ are to be chosen based on $\sigma$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've spent some time thinking on how to pick $\sigma$ best. &lt;a href=&quot;http://www.evoid.de/page/the-caveats-of-image-down-sampling/&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; are my considerations. &lt;strong&gt;tl;dr:&lt;/strong&gt; Maybe I made some mistake, but $\sigma^2\approx3.37$ looks like a good choice for down-sampling by factor 2.&lt;/p&gt;&#xA;" OwnerUserId="15991" LastActivityDate="2015-06-18T01:20:23.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24210" PostTypeId="2" ParentId="23389" CreationDate="2015-06-18T02:26:19.107" Score="-1" Body="&lt;p&gt;Please add the following lines to your program to get what you want...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L=length(x_comp_mag);&#xA;f=(0:(L-1))*(Fs/L); % Frequency in Hz.&#xA;figure,plot(f,20*log10(x_comp_mag));&#xA;xlabel('Frequency in Hz');&#xA;axis([0 4000 -80 100])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I got the following plot after adding these lines to your program. Is this what you want?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/oOuaG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2015-06-18T02:26:19.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24211" PostTypeId="2" ParentId="24188" CreationDate="2015-06-18T07:12:39.187" Score="2" Body="&lt;p&gt;the cosine transform can serve as an example to show that the sum is not infinite, if not rather a distribution, in the case of cosine eg are distributions deltas of Dirac spaced periodically in the frequency domain, likewise a train of Kronecker deltas (the Kronecker delta function is analogous to the Dirac delta in the discrete domain and one of its uses is to model the sampling of a signal) or sin(w0n) have transformed that are frequency distributions, I'll show you the images the case of cos(w0n) eg. On the other hand, the transform of the pulse heviside function is still a mystery to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.freeimagehosting.net/commercial-photography/texas/houston/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RL8Gv.jpg&quot; alt=&quot;Houston commercial photography&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.freeimagehosting.net/commercial-photography/texas/houston/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iCfxb.jpg&quot; alt=&quot;Houston commercial photography&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16285" LastEditorUserId="16285" LastEditDate="2015-06-19T14:13:21.990" LastActivityDate="2015-06-19T14:13:21.990" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24213" PostTypeId="2" ParentId="24188" CreationDate="2015-06-18T08:44:48.877" Score="6" Body="&lt;p&gt;As mentioned in Batman's answer, the condition of the sequence being absolutely summable is only sufficient but not necessary. The Fourier transform can be extended to $\ell_2$ sequences, i.e. sequences for which&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}|f[n]|^2&amp;lt;\infty$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is satisfied. A further generalization is possible if you allow distributions and their derivatives (such as the Dirac delta function) as Fourier transforms. Then also sequences with polynomial growth have a Fourier transform in that generalized sense. Just sequences with exponential growth have no Fourier transform. However, they can be handled by the $\mathcal{Z}$-transform. Note that everything said above also holds for continuous-time functions (if your replace &quot;$\mathcal{Z}$-transform&quot; by &quot;Laplace transform&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sequences with a constant amplitude (such as the step function or a sinusoid) will have a Dirac delta in their Fourier transform. Sequences with a linear growth will have the (generalized) derivative of a Dirac delta in their Fourier transform, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as for your question how it is possible for a sum over infinitely many elements to be finite, your should as a first basic example read up on the &lt;a href=&quot;https://en.wikipedia.org/?title=Geometric_series&quot; rel=&quot;noreferrer&quot;&gt;geometric series&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we allow a Dirac delta impulse as a Fourier transform, we can ask what the corresponding time function would be. By taking the inverse Fourier transform of a shifted Dirac delta impulse $\delta(\omega-\omega_0)$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi}\int_{-\infty}^{\infty}\delta(\omega-\omega_0)e^{j\omega t}d\omega=\frac{1}{2\pi}e^{j\omega_0t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which follows from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_delta_function#Translation&quot; rel=&quot;noreferrer&quot;&gt;sifting property&lt;/a&gt; of the Dirac delta impulse. So we now have the Fourier transform pair&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{j\omega_0t}\Longleftrightarrow2\pi\delta(\omega-\omega_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which the transforms of $\cos(\omega_0t)$ and $\sin(\omega_0t)$ follow directly by rewriting these functions as $\cos(\omega_0t)=\frac12(e^{j\omega_0t}+e^{-j\omega_0t})$ and $\sin(\omega_0t)=\frac{1}{2j}(e^{j\omega_0t}-e^{-j\omega_0t})$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-18T12:55:36.677" LastActivityDate="2015-06-18T12:55:36.677" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="24214" PostTypeId="1" CreationDate="2015-06-18T09:17:43.207" Score="0" ViewCount="401" Body="&lt;p&gt;i have some data series in time domain which are in different length. i'm using FFT to transform them to frequency domain and now i want to calculate their average.&#xA;Since their lengths are not equal i'm doing:&#xA;(1) normalized the series before applying FFT &#xA;(2) appending zeros in the end of sequences to complete the max series length &lt;/p&gt;&#xA;&#xA;&lt;p&gt;however, once i'm applying inverse FFT after averaging the series, i'm getting discontinuous results.  the result up to the point of equal length is exactly the average, but from the point of the the difference it's completely out of bounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;could you please advice what i'm doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="16289" LastActivityDate="2015-06-18T09:17:43.207" Title="FFT analysis for series of different length" Tags="|fft|time-series|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24215" PostTypeId="2" ParentId="24191" CreationDate="2015-06-18T09:49:45.067" Score="-1" Body="&lt;p&gt;Here is the answer to my question. The explanations in this page is quite clear: &lt;a href=&quot;http://www.ni.com/white-paper/4844/en/#toc2&quot; rel=&quot;nofollow&quot;&gt;http://www.ni.com/white-paper/4844/en/#toc2&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16273" LastActivityDate="2015-06-18T09:49:45.067" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24217" PostTypeId="1" CreationDate="2015-06-18T10:55:20.980" Score="0" ViewCount="2550" Body="&lt;p&gt;I'm new to signal processing and I need your help: I have an array of 128 elements (call it &lt;code&gt;Window&lt;/code&gt;) filled with 128 samples taken from a sensor. I was wondering how to find the derivative of this digital signal. I found this formula on wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;m = F[n] - F[n-1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where, for me, &lt;code&gt;F[n]&lt;/code&gt; is &lt;code&gt;Window[n]&lt;/code&gt;. I'd like to obtain an array &lt;code&gt;M&lt;/code&gt; filled with all the derivatives. But there's something I miss: The first step would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M[0] = Window[0] - Window[-1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I haven't &lt;code&gt;Window[-1]&lt;/code&gt;. How can I manage this issue? Thank you in advance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikibooks.org/wiki/Digital_Signal_Processing/Discrete_Operations#Derivatives&quot; rel=&quot;nofollow&quot;&gt;https://en.wikibooks.org/wiki/Digital_Signal_Processing/Discrete_Operations#Derivatives&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16236" LastActivityDate="2015-07-18T17:58:36.353" Title="Digital signal derivative" Tags="|discrete-signals|digital|derivative|derivation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24219" PostTypeId="1" AcceptedAnswerId="24220" CreationDate="2015-06-18T11:38:03.380" Score="0" ViewCount="1319" Body="&lt;p&gt;Is shifting a signal by a given number of samples, say $n$ samples, the same as the following in matlab: signal(n:end) instead of signal(1:end).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, if the size of $signal$ is 200x1, does it make sense to remove the first $n$ rows and consider the size of $signal$ at (200-n)x1 for the shifted signal?&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-06-18T13:05:17.527" Title="Shift a signal by a given number of samples" Tags="|matlab|signal-analysis|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24220" PostTypeId="2" ParentId="24219" CreationDate="2015-06-18T12:08:47.890" Score="2" Body="&lt;p&gt;No, this is not shifting but windowing by a rectangular window. Shifting will not change the values of the samples, it will just change the relation between the sample values and the corresponding time indices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab a (finite length, discrete-time) signal is simply represented by a vector of numbers. There is no relation to time indices. The interpretation which sample value corresponds to the index $n=0$ is up to you. So shifting a signal without any further processing in Matlab (or any other software) is meaningless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's just about plotting, you can use &lt;code&gt;stem(n,x)&lt;/code&gt; where &lt;code&gt;x&lt;/code&gt; is your signal vector, and &lt;code&gt;n&lt;/code&gt; is the corresponding vector of time indices. Shifting just involves specifying a different vector &lt;code&gt;n&lt;/code&gt;, the data in &lt;code&gt;x&lt;/code&gt; remain of course unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shifting becomes important if it is part of some processing involving more than one signal, e.g. the computation of the deterministic auto-correlation or cross-correlation. In such a case you simply have to implement the corresponding formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have two signal vectors &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; which have the same number of elements &lt;code&gt;N&lt;/code&gt;, and you want to add a shifted (e.g., delayed) version of &lt;code&gt;y&lt;/code&gt; to the signal &lt;code&gt;x&lt;/code&gt; then you can do two things. If &lt;code&gt;y&lt;/code&gt; is shifted by &lt;code&gt;M&lt;/code&gt; samples, you could define the sum by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;z = [x(:),zeros(M,1)]+[zeros(M,1),y];&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case the indices where only one of the two signals in non-zero (due to the shifting operation) are also taken into account. This may or may not be useful. If you want to disregard these regions and only take into account indices where both signals overlap, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;z = x[M+1:N]+y[1:N-M];&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is simply the middle region of the other sum vector &lt;code&gt;z&lt;/code&gt; defined above.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-18T13:05:17.527" LastActivityDate="2015-06-18T13:05:17.527" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24222" PostTypeId="1" AcceptedAnswerId="24224" CreationDate="2015-06-18T13:01:04.200" Score="2" ViewCount="3870" Body="&lt;p&gt;Using formulae from Audio EQ Cookbook from &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; it was easy to implement biquad IIR filters in C++, i.e. to calculate coefficients b0, b1, b2, a0, a1, a2.&lt;/p&gt;&#xA;&lt;p&gt;Now, I want to calculate the phase response for a given IIR filter. I have read a number of papers about IIR design, read the websites (&lt;a href=&quot;http://www.dspguide.com/ch19/4.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;DSP Guide&lt;/a&gt;) but could not find the way to do it. How I can calculate and specify the phase of an IIR filter during the design?&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="4346" LastEditDate="2021-11-27T22:50:57.473" LastActivityDate="2021-11-27T22:50:57.473" Title="IIR Filter - calculating the phase response" Tags="|filters|infinite-impulse-response|dsp-core|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="24223" PostTypeId="2" ParentId="24217" CreationDate="2015-06-18T13:15:46.597" Score="0" Body="&lt;p&gt;Suppose&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;length(Window)=L&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could try something like this: extend &lt;code&gt;Window&lt;/code&gt; by adding a new value at the beginning and end:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Window[-1] = Window[0] - (Window[1]-Window[0])&#xA;Window[L]  = Window[L-1] + (Window[L-1]-Window[L-2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then for &lt;code&gt;n=0..L-1&lt;/code&gt; put:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;M[n] = (Window[n+1] - Window[n-1])/2.0&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="12119" LastActivityDate="2015-06-18T13:15:46.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24224" PostTypeId="2" ParentId="24222" CreationDate="2015-06-18T13:23:11.860" Score="4" Body="&lt;p&gt;Finding the phase response of a biquad at a specific frequency is simple. Recall the transfer function of a biquad:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = \frac{b_0 + b_1z^{-1} + b_2z^{-2}}{a_0 + a_1z^{-1} + a_2z^{-2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response of a system can be calculated by letting $z = e^{j\omega}$, where $\omega$ is a normalized frequency in the range $[-\pi, \pi)$. SO, it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(e^{j\omega}) = \frac{b_0 + b_1e^{-j\omega} + b_2e^{-j2\omega}}{a_0 + a_1e^{-j\omega} + a_2e^{-j2\omega}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the complex exponentials, the value of $H(e^{j\omega})$ will be complex. The phase response at the frequency $\omega$ is just the phase angle of the resulting complex number. The magnitude response at the same frequency is likewise equal to the magnitude of the number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only other detail you might need is how to arrive at $\omega$: given a signal sampled at sample rate $f_s$ Hz, if you want to know the frequency response at a given frequency $f$ Hz, you can use the above equation, and let:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\omega = \frac{2 \pi f}{f_s}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2015-06-18T13:29:04.553" LastActivityDate="2015-06-18T13:29:04.553" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24225" PostTypeId="2" ParentId="24222" CreationDate="2015-06-18T13:23:23.543" Score="3" Body="&lt;p&gt;You need the argument of the filter's frequency response. The latter is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=\frac{b_0+b_1e^{-j\omega}+b_2e^{-2j\omega}}{a_0+a_1e^{-j\omega}+a_2e^{-2j\omega}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a complex function and its argument can be computed by using the function &lt;code&gt;atan2(y,x)&lt;/code&gt;, where &lt;code&gt;y&lt;/code&gt; is the imaginary part of $H(\omega)$ and &lt;code&gt;x&lt;/code&gt; is the real part of $H(\omega)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-18T13:23:23.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24226" PostTypeId="2" ParentId="23971" CreationDate="2015-06-18T14:11:05.860" Score="1" Body="&lt;p&gt;It sounds like you don't need a wavelet. A wavelet's translation and dilation properties allow you to get both time and frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;matched filter&lt;/a&gt; takes an inner product of a signal with another signal, allowing you to detect a known signal in noise (by correlating the signal you have with the known signal). You may want to use this idea instead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another idea is &lt;a href=&quot;https://en.wikipedia.org/wiki/Matching_pursuit&quot; rel=&quot;nofollow&quot;&gt;matching pursuit&lt;/a&gt; type algorithms -- if you have an overcomplete set of signals, and you want to find an approximation of a signal with respect to these overcomplete set of signals, you can do this through a matching pursuit algorithm. Basically, iteratively form a residual by finding the largest inner product signal in the set and then subtracting a scaled verison of the signal. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2015-06-18T16:22:31.737" LastActivityDate="2015-06-18T16:22:31.737" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24227" PostTypeId="1" AcceptedAnswerId="24229" CreationDate="2015-06-18T15:15:13.990" Score="2" ViewCount="279" Body="&lt;p&gt;I've been try to either prove or find a counter-example to the idea of jointly-wss being transitive.&lt;br&gt;&#xA;In other words: does ($x$ and $y$ are jointly wss) $\wedge$ ($y$ and $z$ are jointly wss) imply that $x$ and $z$ are jointly wss?&lt;br&gt;&#xA;Obviously it boils down to only asking about the cross-correlation condition, so one can ask:&lt;br&gt;&#xA;Does $\forall t, \Delta t : C_x,_y(t, t+\Delta t)=C_x,_y(0, \Delta t) \ and \   C_y,_z(t, t+\Delta t)=C_y,_z(0, \Delta t)$ imply that $\forall t, \Delta t : C_x,_z(t, t+\Delta t)=C_x,_z(0, \Delta t)\ $?&lt;br&gt;&#xA;My basic intuition is that this is not the case, but I cannot find an appropriately pathological set of signals...Nor have I managed to prove transitivity.&lt;br&gt;&#xA;Any help would be very much appreciated!&lt;br&gt;&#xA;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="16294" LastActivityDate="2015-06-18T16:09:58.610" Title="Is jointly wss (wide sense stationary) a transitive relation?" Tags="|cross-correlation|stationary|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24228" PostTypeId="2" ParentId="24222" CreationDate="2015-06-18T15:23:27.040" Score="0" Body="&lt;p&gt;If you factor the transfer function of an IIR into the locations of its poles and zeros, you can graphically solve (or even visually inspect for a small number of poles/zeros) the phase response.  Walk around the unit circle in the complex plane, and add/subtract the angles from all the transfer functions poles and zeros to any point on the unit circle for the phase response at the frequency represented by that point.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-06-18T15:23:27.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24229" PostTypeId="2" ParentId="24227" CreationDate="2015-06-18T16:09:58.610" Score="1" Body="&lt;p&gt;The simplest counter example I can think of (and it is certainly pathological) is $y(t)=0$ for any $x,z$ which are not jointly WSS. &lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-06-18T16:09:58.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24230" PostTypeId="2" ParentId="24054" CreationDate="2015-06-18T18:33:51.800" Score="-1" Body="&lt;p&gt;Check this out, it does calculate the similarities of 2 or more signals&#xA;&lt;a href=&quot;http://www.mathworks.com/help/signal/examples/measuring-signal-similarities.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/signal/examples/measuring-signal-similarities.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16297" LastActivityDate="2015-06-18T18:33:51.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24231" PostTypeId="1" CreationDate="2015-06-18T18:57:14.390" Score="1" ViewCount="1431" Body="&lt;p&gt;Is the frequency spectrum of &lt;span class=&quot;math-container&quot;&gt;$x^*(t)$&lt;/span&gt; the same as the one of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm telling this because I found that &lt;span class=&quot;math-container&quot;&gt;$$X^\ast(f) = (X(-f))^\ast$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to find &lt;span class=&quot;math-container&quot;&gt;$X^\ast(f)$&lt;/span&gt;, intuitively i would just flip &lt;span class=&quot;math-container&quot;&gt;$X(f)$&lt;/span&gt; because of the minus sign and reflip it because of the conjugate. Then flipping two times gives me the original spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tell me if I'm doing something wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="15706" LastEditorUserId="47251" LastEditDate="2020-02-11T20:26:44.347" LastActivityDate="2020-02-11T20:26:44.347" Title="frequency spectrum of the conjugate of $x(t)$" Tags="|fourier-transform|frequency-spectrum|fourier|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24232" PostTypeId="2" ParentId="24231" CreationDate="2015-06-18T20:43:19.753" Score="4" Body="&lt;p&gt;If $X(f)$ is the Fourier transform of $x(t)$, then the Fourier transform of $x^*(t)$ is given by $X^*(-f)$. That's why for real signals $X(f)=X^*(-f)$ holds.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-19T09:49:41.240" LastActivityDate="2015-06-19T09:49:41.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24235" PostTypeId="1" CreationDate="2015-06-19T06:35:28.853" Score="2" ViewCount="1634" Body="&lt;p&gt;With almost no experience/knowledge in computer vision, I am currently trying to segment and label the separate squares on a chessboard (i.e. a1 ... h8). My goal is to use the information to physically play chess with an AI using a webcam and a robotic arm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am writing the vision program in C# (using Emgu CV) for simpler programming and GUI implementation. As my first step, I attempted to detect squares by following this &lt;a href=&quot;http://www.emgu.com/wiki/index.php/Shape_(Triangle,_Rectangle,_Circle,_Line)_Detection_in_CSharp&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7Ht04.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we can see, not all of the squares were detected and I believe some of the squares were detected more than once (as 91 boxes were created).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Questions&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What are the factors to consider in determining the suitable values for Canny threshold and threshold linking? i.e &lt;code&gt;gray.Canny(cannyThreshold, cannyThresholdLinking)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The squares in the original image appear as straight lines to us but to the computer, it is slightly tilted. What is the cause of this? Is it because of aliasing at the edges?&lt;/li&gt;&#xA;&lt;li&gt;Why are most of the squares not detected? Could it be the lighting?&lt;/li&gt;&#xA;&lt;li&gt;What are the proper techniques/methods I should investigate to solve this problem? I am only familiar with the keywords: Canny, Hough (for circles I believe) and Sobel at the moment.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Code&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Image&amp;lt;Bgr, Byte&amp;gt; image = new Image&amp;lt;Bgr, Byte&amp;gt;(Emgu_CV.Properties.Resources.Chessboard).Resize(0.15, INTER.CV_INTER_LINEAR);&#xA;Image&amp;lt;Gray, Byte&amp;gt; gray = image.Convert&amp;lt;Gray, Byte&amp;gt;(); //.PyrDown().PyrUp() worsens detection&#xA;&#xA;imageBox.Image = image;&#xA;&#xA;double cannyThreshold = 180.0;&#xA;double cannyThresholdLinking = 150.0;   &#xA;&#xA;Image&amp;lt;Gray, Byte&amp;gt; cannyEdges = gray.Canny(cannyThreshold, cannyThresholdLinking);&#xA;&#xA;List&amp;lt;MCvBox2D&amp;gt; boxList = new List&amp;lt;MCvBox2D&amp;gt;();&#xA;&#xA;using (MemStorage storage = new MemStorage())&#xA;    for (Contour&amp;lt;Point&amp;gt; contours = cannyEdges.FindContours(); contours != null; contours = contours.HNext)&#xA;    {&#xA;        Contour&amp;lt;Point&amp;gt; currentContour = contours.ApproxPoly(contours.Perimeter * 0.05, storage); // don't quite understand the purpose of *0.05&#xA;        if (contours.Area &amp;gt; 250 &amp;amp;&amp;amp; contours.Area &amp;lt; 10000)&#xA;        {&#xA;            if (currentContour.Total == 4)&#xA;            {&#xA;                bool isSquare = true;&#xA;                Point[] pts = currentContour.ToArray();&#xA;                LineSegment2D[] edges = PointCollection.PolyLine(pts, true);&#xA;&#xA;                for (int i = 0; i &amp;lt; edges.Length; i++)&#xA;                {&#xA;                    double angle = Math.Abs(edges[(i + 1) % edges.Length].GetExteriorAngleDegree(edges[i]));&#xA;&#xA;                    if (angle &amp;lt; 80 || angle &amp;gt; 95)&#xA;                    {&#xA;                         isSquare = false;&#xA;                         break;&#xA;                    }&#xA;&#xA;                    if (isSquare) boxList.Add(currentContour.GetMinAreaRect());                    &#xA;                } &#xA;            }&#xA;        }     &#xA;    }&#xA;&#xA;Image&amp;lt;Bgr, Byte&amp;gt; squareImage = image.CopyBlank();&#xA;foreach (MCvBox2D box in boxList)&#xA;    squareImage.Draw(box, new Bgr(Color.Yellow), 1);&#xA;outputBox.Image = squareImage;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10975" LastActivityDate="2016-04-14T20:17:01.530" Title="Segmenting and labeling chessboards through computer vision" Tags="|image-processing|computer-vision|opencv|image-segmentation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24238" PostTypeId="2" ParentId="17416" CreationDate="2015-06-19T07:45:00.457" Score="8" Body="&lt;p&gt;the solution for a sparse recovery problem is given by: &#xA;$$\text{min} ||x||_0$$&#xA;                    $$\text{s.t} \hspace{2mm}  y = Ax$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of $||x||_0$ is no. of non-zero entries in $x$. This is also called the sparsity of the vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e., we are asking for the sparsest solution $x$, that satisfies $y = Ax$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the simplest case where $x$ is 1-sparse but you don't know the location of that non-zero entry. In such a case, we have $\binom{N} {1}$ possibilities for a 1-sparse vector and to find the solution we have to examine the values of all the $\binom{N} {1}$ possibilities for finding the unique minimizer. &#xA;Similarly, if you are told that $x$ is $k$-sparse, you need to search $\binom{N} {k}$ possibilities. &#xA;i.e., the algorithm grows as $\binom{N}{k}$ with increase in $k$. Since $k$ is not known a priori, you have to check for all the $N$ possible values of $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the complexity of the algorithm is $\displaystyle\sum_{i=1}^N \binom{N}{i}$. This is called as NP hard problem which is an acronym for Non-polynomial time complexity. &lt;/p&gt;&#xA;" OwnerUserId="16303" LastEditorUserId="80" LastEditDate="2015-10-06T00:01:05.583" LastActivityDate="2015-10-06T00:01:05.583" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24239" PostTypeId="2" ParentId="24235" CreationDate="2015-06-19T07:48:44.433" Score="2" Body="&lt;p&gt;I have once done something similar. You should give a try to &lt;a href=&quot;http://docs.opencv.org/doc/tutorials/calib3d/camera_calibration/camera_calibration.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenCV's checkerboard detection&lt;/a&gt;. There are also works on &lt;a href=&quot;https://stackoverflow.com/questions/10196198/how-to-remove-convexity-defects-in-a-sudoku-square&quot;&gt;Sudoku square detection&lt;/a&gt;, which might give you a hint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If these don't work for you, then I would suggest the following: Forget about detection the checkerboard. Initially, assume that every piece is in place and take the snapshot of the board (you can even manually place an initial board, doesn't matter). Then, whenever a piece is moved, grab a new image and apply a differencing of two images (this is somewhat like a background subtraction). Note that this way, you easily get the location of the moved piece. And since you know the piece and what was in the previous location beforehand, you get the complete information of the move.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use a downward looking camera, just like you showed.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-06-19T07:48:44.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24240" PostTypeId="2" ParentId="24235" CreationDate="2015-06-19T08:18:06.330" Score="0" Body="&lt;p&gt;The canonical algorithm to detect straight lines is the radon (hough for lines) transform because it transform lines into points. A contour detection filter followed by thresold on such a transform should give you a nice segmentation. Then use the watershed algorithm to label your region.&lt;/p&gt;&#xA;" OwnerUserId="13315" LastActivityDate="2015-06-19T08:18:06.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24241" PostTypeId="1" AcceptedAnswerId="24242" CreationDate="2015-06-19T08:27:03.073" Score="1" ViewCount="342" Body="&lt;p&gt;We can use Fourier transform of an aperiodic signal and Fourier series of periodic signal. But we can use Fourier transform formula for periodic function also. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let us consider a periodic square wave with fundamental period $T$ . Then I want to ask is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is difference between the outputs of Fourier transform and Fourier series of a periodic square waveform? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="14872" LastEditorUserId="14872" LastEditDate="2015-06-19T17:24:22.463" LastActivityDate="2015-06-19T17:24:22.463" Title="What is difference between outputs of Fourier transform and Fourier series of a periodic square waveform?" Tags="|signal-analysis|fourier-transform|fourier-series|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24242" PostTypeId="2" ParentId="24241" CreationDate="2015-06-19T09:40:34.917" Score="1" Body="&lt;p&gt;The Fourier transform $X(\omega)$ of a $T$-periodic function $x(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t+T) = x(t) \quad \quad \forall t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;having complex Fourier coefficients $c_n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \sum_{n=-\infty}^{\infty} c_n e^{j 2 \pi n t/T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_n = \frac{1}{T} \int_{0}^T x(t) e^{-j 2 \pi n t/T} \ dt \tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be expressed as a weighted sum of Dirac impulses, where the weights are given by the complex Fourier coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega) \triangleq \mathcal{F}\left\{ x(t) \right\} = 2 \pi \sum_{n=-\infty}^{\infty} c_n \delta\left(\omega - \frac{2\pi n}{T}\right) \tag{2}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4346" LastEditDate="2015-06-19T15:21:43.430" LastActivityDate="2015-06-19T15:21:43.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24243" PostTypeId="1" AcceptedAnswerId="24255" CreationDate="2015-06-19T09:44:29.547" Score="0" ViewCount="225" Body="&lt;p&gt;I am working on a research project that involves machine vision. The camera we are using implements infinite focus - I have been informed that this can affect the accuracy of computer vision algorithms, why is this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment we are implementing ORB for feature matching, out of a total of 175 possible detection events 10 of those appear to be missed due to the object not being clearly focused - but it was my understanding that the point of infinity focus was that everything between the lens and &quot;infinity&quot; would be in acceptable focus?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other effect of infinity focus that could account for this?&lt;/p&gt;&#xA;" OwnerUserId="16094" LastActivityDate="2015-06-20T11:01:41.600" Title="Machine Vision - Infinity Focus effect" Tags="|image-processing|computer-vision|camera|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24244" PostTypeId="2" ParentId="24235" CreationDate="2015-06-19T13:02:32.040" Score="0" Body="&lt;p&gt;If you are not entirely locked into C#, I would recommend the &lt;a href=&quot;http://www.mathworks.com/help/vision/ref/detectcheckerboardpoints.html&quot; rel=&quot;nofollow&quot;&gt;detectCheckerboardPoints&lt;/a&gt; function in the Computer Vision System Toolbox for MATLAB. It is more robust than the similar function in OpenCV.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-06-19T13:02:32.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24245" PostTypeId="1" AcceptedAnswerId="26591" CreationDate="2015-06-19T13:32:23.637" Score="3" ViewCount="1042" Body="&lt;p&gt;I want to compute phase response of an raised-cosine FIR filter. I have trouble finding the complex transfer function of the filter in literature (there is a real valued transfer function of frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found formula for magnitude for raised-cosine filter (paper “Raised Cosine Equalization Utilizing Log Scale Filter Synthesis”, D. McGrath, J. Baird, B. Jackson) but there is no mention of phase response. I have read the IEEE paper “Generalized Raised-Cosine Filters” by N. S. Alagha, P. Kabal, but did not find the clear way how to calculate the phase response. In the first mentioned paper the phase is not linear and it's said that it is minimum phase filter. Here is the plot from McGrath at al. paper, page 8:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9u4P8.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the way to calculate phase response for an raised-cosine FIR filter? I don't want to use MATLAB, I need to implement the solution in C++.&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="15718" LastEditDate="2015-06-23T13:07:59.383" LastActivityDate="2015-10-22T11:55:38.860" Title="Raised-Cosine Filter - calculating phase response" Tags="|filters|dsp-core|finite-impulse-response|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24246" PostTypeId="2" ParentId="24245" CreationDate="2015-06-19T14:59:10.967" Score="2" Body="&lt;p&gt;Just like the sinc pulse, a raised cosine pulse with zero delay (centered around $t=0$) has a real Fourier transform. You can find its expression in section 11.4 of &quot;Telecommunications Breakdown&quot; by Johnson and Sethares (a free draft version is available &lt;a href=&quot;http://eceserv0.ece.wisc.edu/~sethares/telebreak.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a time-shifted pulse, you can apply the time-shift property of the Fourier Transform.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-19T14:59:10.967" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24247" PostTypeId="1" CreationDate="2015-06-19T15:57:11.063" Score="0" ViewCount="507" Body="&lt;p&gt;Working on my communication class right now, and I'm having a bit of a problem with the matched filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I see it the matched filters &quot;eliminate&quot; some of the noise. We project the received signal on our orthonormal base and everything that can't be generated by it is considered to be noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let &lt;code&gt;X(t)&lt;/code&gt; be our only signal we send, time-limited to &lt;code&gt;[0;T]&lt;/code&gt;. The matched filter at the receiver's end would have an impulse response of &lt;code&gt;h(t) = X(T-t)&lt;/code&gt;.&#xA;After our received signal &lt;code&gt;R(t)&lt;/code&gt; passes through this filter we sample at &lt;code&gt;ts=T&lt;/code&gt; and we get our &lt;code&gt;Y(t)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After all that we can make our final decision based on &lt;code&gt;Y(t)&lt;/code&gt; and the expected &lt;code&gt;X(t)&lt;/code&gt;, to see if the transmitter sent &lt;code&gt;X(t)&lt;/code&gt; or zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is why do we use a shifted time-reversed function, instead of just &lt;code&gt;X(t)&lt;/code&gt;? Someone told me that it's because having &lt;code&gt;h(t)=X(t)&lt;/code&gt; is too costly in the real world on the hardware level. But I'm not really sure it's this. Or maybe I'm completely wrong and and with &lt;code&gt;h(t)=X(t)&lt;/code&gt; it would work or be less effective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank in advance for any answers.&lt;/p&gt;&#xA;" OwnerUserId="15243" LastActivityDate="2015-06-19T15:57:11.063" Title="Matched filters" Tags="|digital-communications|matched-filter|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24249" PostTypeId="2" ParentId="13728" CreationDate="2015-06-19T17:53:30.313" Score="4" Body="&lt;p&gt;What is intended to do with the loop &lt;code&gt;for&lt;/code&gt; is to record a determined number of seconds. This number is specified by &lt;code&gt;RECORD_SECONDS&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to do it, it is necessary know how many samples we have to take. In your example &lt;code&gt;RECORD_SECONDS = 5&lt;/code&gt; , so we want to record 5 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the variable &lt;code&gt;RATE&lt;/code&gt; says how many samples are taken per second. Its unit is Hz = samples/second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, &lt;code&gt;CHUNCK = 1024&lt;/code&gt; says how many bytes a piece of sound will have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing this, now we can understand why the operation &lt;code&gt;RATE / CHUNK * RECORD_SECONDS&lt;/code&gt; is done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I have said,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;RATE: Hz = samples/second&lt;/li&gt;&#xA;&lt;li&gt;CHUNK = bytes&lt;/li&gt;&#xA;&lt;li&gt;RECORD_SECONDS = seconds&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This operation is in charge of controlling how many iterations loop &lt;code&gt;for&lt;/code&gt; makes. In every iteration, 1024 bytes are recorded (&lt;code&gt;data = stream.read(CHUNK)&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, to record 5 seconds, we have to take 16 000 samples/second  * 5 seconds = 80 000 samples. Finally, if each iteration takes 1024 samples, the &lt;code&gt;for&lt;/code&gt; will have to loop 80 000/1024 times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that's why it is necessary to write the expression &lt;code&gt;RATE / CHUNK * RECORD_SECONDS&lt;/code&gt; in order to record the desired amount of seconds.&lt;/p&gt;&#xA;" OwnerUserId="16308" LastEditorUserId="16308" LastEditDate="2015-06-21T17:43:14.503" LastActivityDate="2015-06-21T17:43:14.503" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24250" PostTypeId="1" CreationDate="2015-06-19T18:03:31.133" Score="0" ViewCount="48" Body="&lt;p&gt;I found this formula in a paper : &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?reload=true&amp;amp;arnumber=5655742&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?reload=true&amp;amp;arnumber=5655742&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;could someone explain the meaning of &quot;j is frequency sample in the highlighted part.(since frequency limits have defined earlier)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/RyPYs.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16066" LastActivityDate="2015-06-19T18:03:31.133" Title="Doubt related to application of FFT" Tags="|fft|fourier-transform|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24252" PostTypeId="1" AcceptedAnswerId="24254" CreationDate="2015-06-19T19:34:12.397" Score="0" ViewCount="7365" Body="&lt;p&gt;For example from this diagram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5x6J8.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16310" LastActivityDate="2015-06-19T21:10:06.777" Title="How to calculate the required bandwidth from a spectrum diagram? [FM]" Tags="|frequency-spectrum|bandwidth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24253" PostTypeId="1" CreationDate="2015-06-19T20:30:50.813" Score="1" ViewCount="609" Body="&lt;p&gt;I have been working on a problem where I am given two songs which are of the same category but there is a time difference between them. Eg. one song starts at x sec and other song starts at y sec. So my task is to find the x and y.&lt;br&gt;&#xA;The length of the two songs can vary but the content of the two songs will remain the same.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am using cross-correlation using FFT for finding the offset between them but it is not giving me correct results.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For making the length of signals same I am zero padding the signal which is shorter in length. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone guide me what I am doing wrong in this problem ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really appreciate your responses.&#xA;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks guys for replying.. &#xA;I am doing in Python and using below algorithm for finding the offset:&lt;br&gt;&#xA;1. Using librosa.load function to get the audio signals of both the songs.&lt;br&gt;&#xA;2. Then I zero pad the shorter signal from last and make sure it is power of 2.&lt;br&gt;&#xA;3. Find the FFT of the two signals using scipy library function of python.(spipy.fftpack.fft)&lt;br&gt;&#xA;4. Once I get the fft , I take the cojugate of one of the signals.&lt;br&gt;&#xA;5. Elementwise multiplication of the two fft signals&lt;br&gt;&#xA;6. Doing ifft of the numpy array of the output signals after multiplication.&lt;br&gt;&#xA;7. Finding the peak index of that array.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. The song length can be around 5-6 mins so I am sampling at the rate of 44.1Khz . So you can expect very large sample space.&#xA;Also , the bitrate of the two songs can be different.(I am not sure that will effect it or not)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea if I am doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="16311" LastEditorUserId="35" LastEditDate="2015-06-21T16:24:09.470" LastActivityDate="2015-08-20T16:56:18.307" Title="Cross-Correlation to find the similartity of songs" Tags="|fft|cross-correlation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24254" PostTypeId="2" ParentId="24252" CreationDate="2015-06-19T21:10:06.777" Score="0" Body="&lt;p&gt;There are many definitions of bandwidth; see for example section 2.2 in &lt;a href=&quot;http://sethares.engr.wisc.edu/telebreak.html&quot; rel=&quot;nofollow&quot;&gt;this book&lt;/a&gt; (PDF linked at the end of the page). In your case, it is easy to use the &quot;absolute bandwidth&quot;, which is defined as $B=f_{max}-f_{min}$, where $f_{max}$ is the largest frequency in the spectrum, and $f_{min}$ is the smallest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to this definition, you'd have $B=(100.028-99.972)\mathrm{\,MHz}=56\mathrm{\,kHz}$.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-19T21:10:06.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24255" PostTypeId="2" ParentId="24243" CreationDate="2015-06-20T11:01:41.600" Score="0" Body="&lt;p&gt;&quot;Infinity focus&quot; refers to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hyperfocal_distance&quot; rel=&quot;nofollow&quot;&gt;Hyperfocal Distance&lt;/a&gt; of the camera's lens. This is the distance &lt;strong&gt;beyond which&lt;/strong&gt; all objects will appear acceptably focused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, if your objects come closer (to the camera) than its hyperfocal distance they will appear blured and detection of sharp features such as corners will become more challenging.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-06-20T11:01:41.600" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24256" PostTypeId="1" AcceptedAnswerId="24257" CreationDate="2015-06-20T11:19:35.127" Score="2" ViewCount="167" Body="&lt;p&gt;Suppose I have an image of a cat and a binary mask image corresponding to cat's location as shown &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CUEVr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/terte.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to blur the image region surrounding the cat but as a function of distance from the cat's boundary pixels. Essentially, the further a pixel is away from the boundary, the greater the degree to which it gets blurred. The ideal distance measure would be iso-contours which extend radially from the cat's boundary pixels, but this is possibly complicated. I would settle for Euclidean distance for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how I can accomplish this ? &lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2015-06-20T11:40:24.357" Title="Contour based blurring" Tags="|image-processing|filtering|anisotropic-diffusion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24257" PostTypeId="2" ParentId="24256" CreationDate="2015-06-20T11:34:05.100" Score="2" Body="&lt;p&gt;Compute the &lt;a href=&quot;https://en.wikipedia.org/wiki/Distance_transform&quot; rel=&quot;nofollow&quot;&gt;distance transform&lt;/a&gt;. You can do that very efficiently. This will give you the Euclidean distance to the closest boundary pixel, as well as the index of that pixel. Then, normalize all the distances in the mask so that the maximum becomes 1. This is required for the next stage: At each point initiate a Gaussian kernel. The kernel size $h$ (and similarly the standard deviation $\sigma$) should be a function of the weight, obtained from distance normalization. You can either use a coefficient - linear proportionality - or a complex kernel, depending on the blurring requirements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, blur the signal at each pixel using the generated mask. Each pixel gets a unique mask and thus a different blurring. Note that, some of the pixels could get the same blur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only need to adjust the kernel size $h$, as for typical Gaussian kernels, $\sigma$ is a function of $h$. The function is simply a lookup table:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   $h$  $\sigma$&#xA;    3    (0.65)&#xA;    5    (0.87)&#xA;    7    (1.43)&#xA;    9    (1.88)&#xA;    11   (2.31)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-06-20T11:40:24.357" LastActivityDate="2015-06-20T11:40:24.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24258" PostTypeId="2" ParentId="24253" CreationDate="2015-06-20T11:35:07.567" Score="1" Body="&lt;p&gt;First of all, apply a normalized cross correlation, which is more robust to certain variations. MATLAB's xcorr function has an option to do that. Next, apply it in a sliding window fashion, where you apply the correlation as a running filter. Then, simply select the maximum peak. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-06-20T11:35:07.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24259" PostTypeId="2" ParentId="10609" CreationDate="2015-06-20T13:46:15.287" Score="0" Body="&lt;p&gt;That's the result I got when I implemented the filter on MatLab. Notice that the yellow line is the usual implementation, with alpha = 0.95.&#xA;So, indeed, it doesn`t seem to eliminate the DC drift, although it do filter the high frequency input the bigger the alpha.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/75AUO.png&quot; alt=&quot;implementation of complementary filter&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16316" LastActivityDate="2015-06-20T13:46:15.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24260" PostTypeId="1" AcceptedAnswerId="24263" CreationDate="2015-06-20T14:06:00.187" Score="0" ViewCount="232" Body="&lt;p&gt;I have a very basic question regarding common compressing approaches. Often, I have heard something like &quot;The problem in our common way to compress data is, that we have to acquire a huge number of samples from our signal, because of the Nyquist-Shannon theorem. &lt;em&gt;But then, when we compress these samples, we throw most of the information away.&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not really understand the last sentence, probably because of lack of knowledge. So, my question is: what do you throw away and why? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some sources:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://youtu.be/tauFgfBvjTk&quot; rel=&quot;nofollow&quot;&gt;Michael Lustig&lt;/a&gt;, at 0:26 he says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why we need to acquire all the data in the first place, and then throw most of it away.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.brainshark.com/brainshark/brainshark.net/portal/title.aspx?pid=zCdz10BfTRz0z0&quot; rel=&quot;nofollow&quot;&gt;Mark Davenport&lt;/a&gt;, on Slide 4 at 0:45 he says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The very first thing that we do after we acquire some data is we compress it and seemingly throw away a lot of information that we painstakingly acquired.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="16318" LastActivityDate="2015-06-20T15:51:21.983" Title="Compressed Sensing vs Common Compression Approaches" Tags="|sampling|nyquist|compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24261" PostTypeId="2" ParentId="23542" CreationDate="2015-06-20T14:20:36.153" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What effects does have a different input such as impulse, step, sine&#xA;  sweep etc. on performing a system identification?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;These are not the only signals in use but it really depends on what you are trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theoretically, exciting a Linear Time Invariant system with &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_delta_function#Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;the unit impulse&lt;/a&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/LTI_system_theory#Impulse_response_and_convolution&quot; rel=&quot;nofollow&quot;&gt;will result in its impulse response&lt;/a&gt;. In practice however, what would be applied as input to a system would be &lt;a href=&quot;https://en.wikipedia.org/wiki/Rectangular_function&quot; rel=&quot;nofollow&quot;&gt;the unit pulse&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exciting a system with the unit impulse will result in a time series called its &quot;Impulse Response&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exciting a system with &lt;a href=&quot;https://en.wikipedia.org/?title=Chirp&quot; rel=&quot;nofollow&quot;&gt;a chirp&lt;/a&gt; and integrating its output will result, directly, to its frequency amplitude response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other typical signals in use are, the step function, the ramp and the parabolic. Exciting a system with these inputs and obtaining the outputs can lead to identification of various parameters. Very briefly, the step function is used to characterise the transient response of a system as well as its &quot;position&quot; error, the ramp is used to determine the &quot;velocity&quot; error and the parabolic is used to determine the &quot;accelleration&quot; error. For more information please see &lt;a href=&quot;https://en.wikibooks.org/wiki/Control_Systems/System_Metrics&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;. For much more information it would be worth having a look at the books &quot;Signals and Systems&quot; (by Oppenheim, Willsky and Hamid-Nawab) and &quot;Feedback Control of Dynamic Systems&quot; (by Franklin, Powell and Emami-Naeini).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-06-20T14:20:36.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24262" PostTypeId="1" CreationDate="2015-06-20T15:08:45.823" Score="0" ViewCount="55" Body="&lt;p&gt;How to calculate the frequency of the information signal from the follow spectrum diagram (it contains only one frequency)? Information signal is also called as original signal but i'm not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/biyiB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16310" LastEditorUserId="13320" LastEditDate="2016-11-13T12:51:46.167" LastActivityDate="2016-11-13T12:51:46.167" Title="How to calculate the frequency of the analog information signal? [FM]" Tags="|frequency-modulation|" AnswerCount="0" CommentCount="6" ClosedDate="2015-06-22T15:33:39.830" ContentLicense="CC BY-SA 3.0" />
  <row Id="24263" PostTypeId="2" ParentId="24260" CreationDate="2015-06-20T15:51:21.983" Score="1" Body="&lt;p&gt;Compression works by reducing redundancy and there are a number of ways that this can be done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very briefly, consider the pair of functions $C = f(S_{original}, \Theta_{f}), S_{recovered} = g(C, \Theta_g)$, where $f,g$ are the compressor and decompressor functions respectively, $\Theta$ is the set of parameters specific to $f,g$ and $C, S_{original}, S_{recovered}$ are the compressed, original and decompressed sequences respectively. If the compression is &lt;strong&gt;loseless&lt;/strong&gt; then the error between the original and recovered sequences should be zero ($S_{recovered}-S_{original}=0$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we might accept some small error so that $S_{recovered}-S_{original}&amp;lt;=e$. In this case, the compression is &lt;strong&gt;lossy&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What $f$ does is to reduce the redundancy in $S_{original}$ so that it can be represented using &lt;strong&gt;less&lt;/strong&gt; data so that the length of $C$ is less than the length of $S_{original}$ ($|C| &amp;lt; |S_{original}|$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Run-length_encoding&quot; rel=&quot;nofollow&quot;&gt;Run-length encoding&lt;/a&gt; achieves this by looking for sequences of repeated values and substituing them for a pair of &quot;value, count&quot;. The redundancy here is most obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Huffman_coding&quot; rel=&quot;nofollow&quot;&gt;Huffman encoding&lt;/a&gt;, does this by creating a carefully constructed &quot;dictionary&quot; of codewords based on knowledge about the source of a signal. In this, frequently occuring values are mapped to short codewords and infrequently occuring values are mapped to longer codewords. In this way, instead of representing &lt;strong&gt;all&lt;/strong&gt; values with the same amount of data (for example 8 bits), frequent values are represented with less data (less than 8 bits) and &lt;strong&gt;on average&lt;/strong&gt; lead to describing a long $S_{original}$ with a short $C$. More frequently appearing characters than others, again, imply redundancy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch&quot; rel=&quot;nofollow&quot;&gt;Lempel-Ziv-Welch encoding&lt;/a&gt; reduces redundancy by looking for repeating sequences. Once a repeating sequence is found it is placed in memory and assigned a codeword. The next time the same sequence is found it is substituted with its codeword. In this way, long sequences (of more than one values) are substituted with just one value (an index into the dictionary).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other methods rely on preserving just a part of the frequency spectrum of a signal or image therefore reducing the overall ammount of data that needs to be described.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key thing to remember here is &lt;strong&gt;redundancy&lt;/strong&gt;. Repeating values, slow varying signals (which again implies nearby samples having similar values) or even components with negligible contribution. If a signal contains redundancy then it is predictable and if it is predictable then it can be captured in a model. (As a side note, please note that this redundancy, or amount of information in a signal can be quantified by &lt;a href=&quot;https://en.wikipedia.org/wiki/Entropy_%28information_theory%29&quot; rel=&quot;nofollow&quot;&gt;Entropy&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, compressed sensing is in a way similar to lossy compression in the sense that we are trying to recover an $S_{original}$ from a (shorter) $C$ accepting some small error $e$ in the recovery with some &quot;decompressor&quot; $g$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BUT&lt;/strong&gt;, to do this we need to make certain assumptions about the dynamics of $S_{original}$. For example, it is varying slowly, therefore it is not necessary to sample the full spectrum of frequencies that could generate some potential $S_{original}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to think about this is to look at a picture or a drawing and cut (or black)out a rectangle from it. That is, throw away some data or, don't acquire a part of data from the beginning. If the picture is &lt;a href=&quot;http://st.depositphotos.com/1454700/3481/i/950/depositphotos_34814027-White-Bar-Jail-Cell-Perspective-Locked.jpg&quot; rel=&quot;nofollow&quot;&gt;predictable enough&lt;/a&gt; then it is easy to reconstruct the missing part. &lt;strong&gt;WHY&lt;/strong&gt; is it predictable? Because it is a repeating pattern and we &lt;strong&gt;assume&lt;/strong&gt; that the missing bit behaves similarly. If the picture is &lt;a href=&quot;https://whisperingsbyjkl.files.wordpress.com/2014/09/leaves.jpg&quot; rel=&quot;nofollow&quot;&gt;less predictable&lt;/a&gt; then we can still attempt to reconstruct a rectangle of it from the surrounding information but perhaps it will not be as accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we were to take this to the extreme (as it is done in practice anyway), then we could say that we don't really need to acquire &lt;strong&gt;all&lt;/strong&gt; of the pixels of the image. We can acquire &lt;strong&gt;some&lt;/strong&gt; of the data and by exploiting the redundancy of the signal and the fact that it is not going to be too unpredictable (i.e. we can model it) reconstruct the missing bits...almost as closely to reality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is exactly what &lt;a href=&quot;https://en.wikipedia.org/wiki/Iterative_reconstruction#Advantages&quot; rel=&quot;nofollow&quot;&gt;iterative reconstruction techniques&lt;/a&gt; (a family of $g$ &quot;decompressors&quot;) are doing by progressively trying to minimise the error between an $S_{recovered}$ at some iteration $n$ and the subset of known values contained in the actually acquired $C$ and stopping this process once the error drops below an &quot;acceptable&quot; $e$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information please see &lt;a href=&quot;https://en.wikipedia.org/wiki/Algebraic_Reconstruction_Technique&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt; which is a relatively simple iterative reconstruction scheme that shows how to &quot;update&quot; the unknown values from the known values. For even more information please &lt;a href=&quot;http://www3.cs.stonybrook.edu/~mueller/teaching/cse377/iterativeRecon_new.pdf&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-06-20T15:51:21.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24264" PostTypeId="1" AcceptedAnswerId="24339" CreationDate="2015-06-20T16:33:09.713" Score="1" ViewCount="621" Body="&lt;p&gt;There are some research papers in the literature which apply Singular Value Decomposition (SVD) on an image to decompose the image matrix into &lt;code&gt;U&lt;/code&gt;, &lt;code&gt;S&lt;/code&gt; and &lt;code&gt;V&lt;/code&gt; components. The eigenvalues in the singular matrix &lt;code&gt;S&lt;/code&gt; are multiplied by a suitable factor and the image is then reconstructed. The resulting image's luminance is enhanced. To refer to one such paper, click &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6394687&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In curiosity, I was trying to study the variation of eigenvalues with respect to the luminance of an image. For calculating luminance, I am using log-average luminance described &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/windows/desktop/bb173486%28v=vs.85%29.aspx&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I will call log-average luminance  &lt;code&gt;Key Value&lt;/code&gt; from here on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment:&lt;/strong&gt;&#xA;I began my experiment by building a data set first. I took back-to-back multiple images of the same scene with different exposures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each image in such a set, I calculated luminance and obtained eigenvalues for each image. Following is the kind of graph I got for R, G and B channels respectively:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZP7ZV.png&quot; alt=&quot;Graph for R-channel&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TIcD1.png&quot; alt=&quot;Graph for G-channel&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TVXos.png&quot; alt=&quot;Graph for B-channel&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clear any ambiguity about what these graphs represent, I'll explain briefly here. These graphs are for one set of images (11 images). For each image in the set, I calculated key-value. Next, I calculated average eigenvalues for each channel.&#xA;&lt;strong&gt;For calculating average I used only the first 20 eigenvalues.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I observed one thing about eigenvalues which I don't understand. Not all the eigenvalues increase with the key-value of image. When key-value was more than ~0.85, out of 20 eigenvalues, only the first two or three tend to increase; the rest started decreasing. So this led to a turning point in the graph for images with key-value more than 0.85, so I neglected those images. Does this mean only the first few eigenvalues carry the maximum information about image brightness? Is there any reason for such observation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, if I fit a curve to the obtained data points, can I generalize a formula for all images? So that for a given key-value I can get a fair estimate of eigenvalue (maximum or average). Or is there any other recommendation to fit a curve for getting a generalized formula?&lt;/p&gt;&#xA;" OwnerUserId="15188" LastEditorUserId="-1" LastEditDate="2015-06-24T09:44:54.300" LastActivityDate="2015-06-24T09:44:54.300" Title="relation between luminance and eigen values of an image" Tags="|matlab|signal-analysis|computer-vision|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24266" PostTypeId="2" ParentId="20390" CreationDate="2015-06-20T18:41:53.327" Score="1" Body="&lt;p&gt;I shall try to give an intuition. The way we could probably think is : &quot;One Dirac delta gives us a 1 in frequency domain. Now I give infinite number of Dirac deltas. Shouldn't I get a higher DC?&quot;&#xA;Now let us see whether by adding all those frequency components mentioned in the Dirac comb in the frequency domain(FD), we get another Dirac comb in time domain(TD). We are adding continuous waveforms and getting deltas at discrete points. Sounds weird. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming back to the FD. We have a Dirac comb with spacing $ \omega_0 $. To put it in words, we have deltas at $ 0,\pm\omega_0,\pm2\omega_0,\pm3\omega_0 $ and so on. We thus have a DC and infinite number of cosines, namely $ \cos(\omega_0 t), \cos(2\omega_0 t), \cos(3\omega_0 t) $ and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider points in time domain corresponding to $ t = \frac{2n\pi}{\omega_0}$. All the above cosine waves will give us value 1. Hence they all add up and give us non zero value at those points. Now what about any other t? We need to get convinced that they will all add up to zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now deviating slightly, let's consider a waveform $cos(kn) ; n = 0,1,2,3,4...\infty$. We know that unless k can be expressed as a fraction multiplied by $\pi$, it's aperiodic. What does that mean? There is not a single repeating sample. Each of the samples are unique. Looking it from another perspective, we have infinite number of samples which are unique and part of a cosine wave. This means taking all the infinite points, we will be able to construct a single CONTINUOUS cosine wave completely once.  What if $cos(kn)$ is periodic? We already know that the sum of samples will be zero periodically based on value of k. Hence, sum of all the samples of $cos(kn)$ will give us zero for any value of k, except $k = 2\pi$'s multiple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Returning back to our original problem : We now take an arbitrary $t=t_0 \neq 2r\pi$. Now we have $ \cos(0\omega_0 t_0)[dc] + \cos(\omega_0 t_0) + \cos(2\omega _0 t_0) + \cos(3\omega_0 t_0) $....as the value at $t=t_0$. But we have already proved this infinite sum =0 for any t except $ t=\frac{2n\pi}{\omega _0} $, where all these cosines add up to give dirac deltas.  &lt;/p&gt;&#xA;" OwnerUserId="16320" LastEditorUserId="8202" LastEditDate="2015-06-21T07:41:18.347" LastActivityDate="2015-06-21T07:41:18.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24268" PostTypeId="1" CreationDate="2015-06-20T22:54:06.790" Score="4" ViewCount="24129" Body="&lt;p&gt;I read somewhere in SE about stereo and mono videos. Stereo videos are captured by using two cameras with which we are allowed to measure depth accurately. But what about still images? what is difference between stereo image and mono one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question: if I apply an algorithm on a stereo data set, the same result will be acquired as mono data set? to what extent segmentation of stereo images is different in comparison with other type of images?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="80" LastEditDate="2015-11-18T21:49:40.623" LastActivityDate="2016-02-16T23:28:10.653" Title="What is the difference between monocular and stereo image?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24270" PostTypeId="2" ParentId="24268" CreationDate="2015-06-21T05:54:12.693" Score="1" Body="&lt;p&gt;In stereo video/images you have more information per frame/image allowing for creating a 3D presentation of the image/video signal (depth). You may create mono images/video from the 3D.&#xA;You are not able to create a 3D presentation from a mono image/video signal. That the reason that old movies, that were not captured with two cameras from two slightly different direction are not convertible into 3D.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-06-21T05:54:12.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24272" PostTypeId="1" CreationDate="2015-06-21T07:06:35.947" Score="3" ViewCount="165" Body="&lt;p&gt;Normally, when talking about adding noise to simulation data, the choice are AWGN, pink noise and so on. However, in practice, the noise in the experiments changes the locations of frequency peaks as well. How can I simulate this kind of noise? &lt;/p&gt;&#xA;" OwnerUserId="7602" LastEditorUserId="128" LastEditDate="2019-10-31T06:05:46.480" LastActivityDate="2022-07-01T16:54:37.260" Title="What Noise Will Change the Frequencies Components of a Signal?" Tags="|frequency-spectrum|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24273" PostTypeId="2" ParentId="24272" CreationDate="2015-06-21T10:00:37.383" Score="1" Body="&lt;p&gt;I'm not sure I understand your question.&lt;/p&gt;&#xA;&lt;p&gt;But usually the noise model is additive.&lt;br /&gt;&#xA;Namely, due to the linearity of the DFT, at each bin you will have the summation of the signal contribution and the noise contribution at this specific frequency bin.&lt;/p&gt;&#xA;&lt;p&gt;Now, let's say we have 2 bins.&lt;br /&gt;&#xA;At the first the signal is 7 at the second is 6.&lt;br /&gt;&#xA;The noise is 3 and 5 respectively, now the summation will shift the DFT peak though the signal isn't changed.&lt;/p&gt;&#xA;&lt;p&gt;In some cases the noise might be colored (With time correlation) which means most / some of its energy might be concentrated in a small band of frequencies.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-07-01T16:54:37.260" LastActivityDate="2022-07-01T16:54:37.260" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="24274" PostTypeId="1" AcceptedAnswerId="24275" CreationDate="2015-06-21T10:34:36.200" Score="0" ViewCount="95" Body="&lt;p&gt;I'm learning of digital filters and found a question asking why a filter with a impulse response &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]= \begin{cases} &#xA;      \frac{1}{n^2+3n+2} &amp;amp; n\geq 0 \\&#xA;     0 &amp;amp; n&amp;lt;0 \\&#xA;   \end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cannot be implemented. My only guess is because of the infinite amount of computation required, but the problem in the book states it is not only beacuse of this. Also, which would be good alternative filters with a finite complexity such that thay would have a close frequency response to this filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="15442" LastEditorUserId="4298" LastEditDate="2015-06-21T11:11:23.873" LastActivityDate="2015-06-21T11:25:05.183" Title="Filter implementation and alternatives" Tags="|filters|filter-design|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24275" PostTypeId="2" ParentId="24274" CreationDate="2015-06-21T11:11:07.107" Score="0" Body="&lt;p&gt;Only &lt;em&gt;rational&lt;/em&gt; transfer functions can be implemented by a combination of adders, multipliers, and delay elements. The transfer function corresponding to this impulse response (i.e., its $\mathcal{Z}$-transform) is not rational (see&#xA;&lt;a href=&quot;http://wolfr.am/5tef8kbY&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that filters with infinitely long impulse responses &lt;em&gt;can&lt;/em&gt; be implemented by recursion, so the infinite length by itself is no problem, as long as the transfer function is rational. A way to approximate this impulse response by a realizable filter is to truncate the impulse response by multiplying it with some (right-sided) window function, resulting in a finite impulse response (FIR) filter, which can always be implemented.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-21T11:25:05.183" LastActivityDate="2015-06-21T11:25:05.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24276" PostTypeId="2" ParentId="22472" CreationDate="2015-06-21T13:13:52.257" Score="1" Body="&lt;p&gt;There is a &lt;a href=&quot;http://octave.sourceforge.net/video/index.html&quot; rel=&quot;nofollow&quot;&gt;package from octave&lt;/a&gt;. I am using debian jessie and this version of octave-video producing errors and can not be installed. Also, there is no debian package with name octave-video.&lt;/p&gt;&#xA;" OwnerUserId="16328" LastActivityDate="2015-06-21T13:13:52.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24277" PostTypeId="1" CreationDate="2015-06-21T17:35:26.910" Score="0" ViewCount="540" Body="&lt;p&gt;We know that a linear phase ramp in the frequency domain corresponds to a time shift in the time domain. Qualititavely, it seems a sawtooth phase mask in the frequency domain could produce the same time shift effect as the linear phase ramp, but I need help with the mathematical derivation to see what the actual effect is.&lt;/p&gt;&#xA;" OwnerUserId="8519" LastActivityDate="2019-06-27T08:43:11.390" Title="What is the effect of a sawtooth phase mask in the frequency domain?" Tags="|fourier-transform|phase|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24279" PostTypeId="1" CreationDate="2015-06-21T20:04:05.160" Score="2" ViewCount="425" Body="&lt;p&gt;I have written a function that implements a gaussian filter. I use &lt;code&gt;fft2&lt;/code&gt; to transform my image and my filter to 2d fourier transform. Then I multiply them and then use &lt;code&gt;ifft2&lt;/code&gt;. The resulting image is called (I).&lt;/p&gt;&#xA;&lt;p&gt;I use &lt;code&gt;fspecial&lt;/code&gt; in order to make a gaussian filter and use &lt;code&gt;imfilter&lt;/code&gt; to get what resulted in (I). However, They are different. I checked my gaussian filter in both cases. They are the same. But in (I) the border of image is not smooth and dark and in the second case (which seems to be the correct case) the borders are smooth and darker than before.&lt;/p&gt;&#xA;&lt;p&gt;I want to know what I am missing that results in an incorrect result?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="16332" LastEditorUserId="7092" LastEditDate="2022-01-19T17:19:00.373" LastActivityDate="2022-01-19T17:19:00.373" Title="Filter by 2D Gaussian Kernel in MATLAB" Tags="|image-processing|matlab|filters|gaussian|frequency-domain|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24280" PostTypeId="2" ParentId="24279" CreationDate="2015-06-21T22:53:55.650" Score="3" Body="&lt;p&gt;You have to remember that the FFT operation treats your data as if it's a &lt;em&gt;periodic&lt;/em&gt; function. This means that, if you think of your image being defined over the range $x=0..(X-1)$  and $y=0..(Y-1)$  (so the image size is $X\times Y$) then the image should be though of as though it's just one rectangular $X\times Y$ sample taken from an infinite array of images that repeat every $X$ samples in the $x$ direction, and every $Y$ samples in the $y$ direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your filtering operation will 'spread' each pixel form the input image over a larger areas in the output image, and this spreading operation will also span across these periodic boundaries. So, the pixel at $(7,X-1)$ will spread in all directions, and in particular, the 'spreading' to the right will affect pixel $(7,X)$, which is really $(7,0)$ (because the image 'repeats' every $X$ pixels).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use the FFT2 function to do your filtering, and you want to avoid this periodic 'wrap-around' effect, you need to enlarge your image first. If your Gaussian filter kernel is of size $2*N+1$ (it's usually odd), then you need to add a border of $N$ pixels on the left, right, top and bottom of the image. You also have to choose what pixel values to put in these border pixels. A good choice is to replicate the left-most pixel of each row in the image across the entire row in the left border (and do a similar replication operation into the other borders).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this answers your question&lt;/p&gt;&#xA;" OwnerUserId="11204" LastActivityDate="2015-06-21T22:53:55.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24281" PostTypeId="1" CreationDate="2015-06-22T09:49:04.647" Score="1" ViewCount="69" Body="&lt;p&gt;I am using a Sigma Delta ADC and really understood the working of it&#xA;I need to sample a signal at 8.5 Mhz.&#xA;The SD ADC has a Demodulator and decimating FIR filter&#xA;The Oversampling ratio options are 32/64/128/256 and FIR filter has 32 taps&#xA;What should be OSR ratio and how to determine the FIR coefficients&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16342" LastEditorUserId="21075" LastEditDate="2020-04-30T16:58:36.883" LastActivityDate="2020-04-30T16:58:36.883" Title="Sigma Delta Sampling" Tags="|analog-to-digital|delta-sigma|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24282" PostTypeId="1" CreationDate="2015-06-22T09:59:22.770" Score="2" ViewCount="2482" Body="&lt;p&gt;If I have two signals $x$ and $y$ and this expression $E\{x[n]y[n-k]\}$, what is the expected value of the product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a basic understanding of EV based on probability, such as $$E[X]=\sum_{i=1}^{\inf}x_ip_i$$ and I understand that EV of flipping coin is 0.5 if $x_1=0$ and $x_2=1$ and both probabilities are 0.5 or for rolling a dice is 3.5 etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I see the expression like this the one above, I find it confusing. I don't know for instance where the probability term is.&lt;/p&gt;&#xA;" OwnerUserId="4721" LastActivityDate="2015-08-21T13:15:48.440" Title="Expected value of signals" Tags="|signal-analysis|statistics|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24283" PostTypeId="2" ParentId="24282" CreationDate="2015-06-22T10:50:18.147" Score="1" Body="&lt;p&gt;This is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;cross-correlation function&lt;/a&gt; of the two discrete-time random processes $x[n]$ and $y[n]$. It measures the similarity of the processes for a given time lag between the two. If $x[n]$ and $y[n]$ are jointly wide-sense stationary, then the cross-correlation only depends on the lag $k$, and not on the absolute time index $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of probabilities (or rather probability density functions), the expectation $E\{x[n]y[n-k]\}$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E\{x[n]y[n-k]\}=\int_{-\infty}^{\infty}xyf_{XY}(x,y;n,n-k)dxdy$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_{XY}(x,y;n_1,n_2)$ is the joint probability density function of $x[n_1]$ and $y[n_2]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, we usually hope that the processes are &lt;a href=&quot;https://en.wikipedia.org/wiki/Ergodic_process&quot; rel=&quot;nofollow&quot;&gt;ergodic&lt;/a&gt;, which allows us to estimate such an expectation by taking the appropriate time averages.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-22T12:39:49.633" LastActivityDate="2015-06-22T12:39:49.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24284" PostTypeId="1" AcceptedAnswerId="24285" CreationDate="2015-06-22T10:54:02.380" Score="7" ViewCount="1273" Body="&lt;p&gt;considering an OFDM symbol of x(0)x(1)x(2)x(3)x(4)....x(n-2)x(n-1)x(n).&#xA;To perform cyclic prefix we prefix some samples from end of this OFDM symbol to the beginning of the OFDM symbol,  like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(n-3)x(n-2)x(n-1)x(n)x(0)x(1)x(2)x(3)........ x(n-4)x(n-3)x(n-2)x(n-1)x(n).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of taking x(n-3)x(n-2)x(n-1)x(n), if we prefix with zeros what will happen?&lt;/p&gt;&#xA;" OwnerUserId="16089" LastEditorUserId="16089" LastEditDate="2015-06-22T11:03:24.850" LastActivityDate="2015-06-22T11:42:31.820" Title="Can we do cyclic prefix with zeros in OFDM rather than with samples from end of the ofdm symbol?" Tags="|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24285" PostTypeId="2" ParentId="24284" CreationDate="2015-06-22T11:42:31.820" Score="6" Body="&lt;p&gt;There are two major approaches for cyclic extension in OFDM systems - CP (cyclic prefix) and ZP (zero padding, also called Trailing Zeros, TZ). Generally they show the same performance, I mean in AWGN or Fading channel. CP method is the simplest one so it is preferred in the most cases. ZP approach leads to slightly less transmission power level for obvious reason. Doppler performance is the same. The main idea of using ZP as I understood is the existence of equalization techniques for combating spectral nulls that is the major problem of OFDM equalizers. I can't explain this technique because I haven't modeled or implemented it, but you can search some articles in the Web. In one of the article it stands that for CP the simple equalizer exists but symbol recovery isn't guaranteed. But for ZP symbol recovery is guaranteed with complexity of equalizer increasing. I think it is the ckear idea. But I suppose it leads to some matrix subspace algorithms e.g. SVD, so it can be too difficult to implement. I've heard ZP is popular in hydroacoustic OFDM techniques of equalization so you can also refer to this topic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps. &lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-06-22T11:42:31.820" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24287" PostTypeId="1" CreationDate="2015-06-22T11:58:39.270" Score="0" ViewCount="229" Body="&lt;p&gt;I came across an interesting problem when using 'xcorr' in MATLAB. The expected signal and generated signal both are at zero DC. So, I expect correlation coefficient to be 1 or perfectly correlated. To my surprise, It is showing the highest error and time lag !!! Pls help ! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &lt;/p&gt;&#xA;" OwnerUserId="16344" LastActivityDate="2015-06-22T14:22:51.120" Title="'xcorr' function in matlab not working for zero signal" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24289" PostTypeId="1" CreationDate="2015-06-22T13:13:03.237" Score="1" ViewCount="582" Body="&lt;p&gt;Here is the formula to compute magnitude of a raised-cosine filter:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/puXGh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that 0 &amp;lt;= Beta &amp;lt;= 1. I am not sure what are the values for f (frequency) and Ts. I assume that some normalization will take place. I also know that Ts is symbol period and it is reciprocal of symbol rate. What are these parameters and relationship between them? Can someone provide an example of typical values of these parameters as used in the raised-cosine formula? Here is the graph from Wikipedia. How the normalization of frequency and magnitude is done? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/32woF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="15718" LastEditDate="2015-06-22T17:07:12.583" LastActivityDate="2015-06-22T17:07:12.583" Title="Raised-Cosine Filter - calculating magnitude response" Tags="|filters|dsp-core|finite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24290" PostTypeId="2" ParentId="24287" CreationDate="2015-06-22T14:22:51.120" Score="1" Body="&lt;p&gt;the xcorr function is defined as&#xA;$$R_{xy}(m)=&#xA;\left\{&#xA;	\begin{array}{ll}&#xA;		\sum\limits_{n=0}^{N-m-1}x_{n+m}y^*_n  &amp;amp; \mbox{if } m \geq 0 \\&#xA;		R^*_{yx}(-m)&amp;amp; \mbox{if } m &amp;lt; 0&#xA;	\end{array}&#xA;\right.$$&#xA;The output is given as $$c(m)=R_{xy}(m-N)$$ where N is the length of the signal by the above definition the output for zero signal is zero&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-06-22T14:22:51.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24291" PostTypeId="2" ParentId="24289" CreationDate="2015-06-22T15:08:17.560" Score="1" Body="&lt;p&gt;The frequency $f$ is no parameter but it's the independent variable. The frequency response $Z(f)$ is a &lt;em&gt;function&lt;/em&gt; of frequency. The only real parameter is $\beta$, defining the excess bandwidth, but you already know that $0\le \beta\le 1$. You also know that $T_s$ is the symbol period, so $1/T_s$ is indeed the baud rate, which is part of the system's specifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the formula you can see that the minimum bandwidth is half the baud rate (for $\beta=0$, i.e. zero excess bandwidth). For $\beta=1$ (i.e., $100\%$ excess bandwidth), the bandwidth is twice as large, i.e. it equals the baud rate $1/T_s$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-22T15:08:17.560" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24292" PostTypeId="2" ParentId="24289" CreationDate="2015-06-22T15:14:17.413" Score="1" Body="&lt;p&gt;The frequency $f$ is continuous and takes values between $-\infty$ and $\infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbol period $T_s$ can take any value you want, depending on how fast you want to transmit. Note that, if you decrease $T_s$ (you transmit at a higher rate), then $Z(f)$ is non-zero for larger values of $f$; that is, its bandwidth increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you want to transmit 1,000 pulses per second, so that $T_s=1\times10^{-3}$ seconds. Then, the pulse's bandwidth is $$B=\frac{1+\beta}{.002}.$$ For $\beta=0$, the bandwidth is $B=500\,\textrm{Hz}$. For \beta=1$, the bandwidth is 1000 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When $\beta=0$, the pulse is a sinc, which has large sidelobes and decreases slowly. When $\beta=1$, the pulse has very small sidelobes and can be truncated in time, to give it a short duration, with little effect on its bandwidth. Which $\beta$ to use depends on the compromise you're willing to make on complexity (sinc pulses) and bandwidth (large $\beta$).&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-22T15:14:17.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24293" PostTypeId="1" AcceptedAnswerId="24296" CreationDate="2015-06-22T15:21:28.217" Score="2" ViewCount="1965" Body="&lt;p&gt;for a filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z)=\frac{1+0.1z^{-1}}{1+0.1z^{-1}+0.9998z^{-2}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which precautions could be taken to ensure that the filter does not become unstable because of coefficient quantization? I've think that it would depend of the implementation chosen (I've read there are implementations pretty robust against quantization), but not really sure.  Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="15442" LastActivityDate="2015-06-23T15:50:22.757" Title="ensure stability against coefficient quantization" Tags="|digital-filters|self-study|quantization|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24295" PostTypeId="1" AcceptedAnswerId="24843" CreationDate="2015-06-22T16:32:54.173" Score="1" ViewCount="50" Body="&lt;p&gt;Consider the following black-and-white image. It depicts a freehand sketch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TMV3q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to characterize the &quot;density&quot; of sketch strokes. For e.g. the hair strokes are densely grouped together. So are strokes near the wrists and the necklace stone. Other strokes are somewhat scattered and &quot;far&quot;, e.g. the nearly vertical strokes depicting the dress.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a good measure (texture-like ?) which can be used to quantify the above notion ?&lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2015-07-23T11:54:18.773" Title="Texture-like measures for quantifying density of data in binary images" Tags="|image-processing|filtering|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24296" PostTypeId="2" ParentId="24293" CreationDate="2015-06-22T17:25:53.813" Score="3" Body="&lt;p&gt;your filter is in the form of a standard biquad with 5 independent coefficients ($b_2=0$ in your case):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = \frac{b_0 + b_1 z^{-1} + b_2 z^{-2}}{ 1 + a_1 z^{-1} + a_2 z^{-2}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;your two poles are the value of $z$ that make the denominator equal to zero&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 1 + a_1 z_p^{-1} + a_2 z_p^{-2} = 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or (multiplying both sides by $z_p^2$),&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ z_p^2 + a_1 z_p + a_2 = 0 \tag{1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and stability depends entirely on whether your poles (after coefficient quantization) are contained in the unit circle:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |z_p| &amp;lt; 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |z_p|^2 &amp;lt; 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the solution to Eq. 1 is (quadratic formula):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ z_p = -\frac{a_1}{2} \pm \sqrt{\left(\frac{a_1}{2}\right)^2 - a_2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, if the poles are complex conjugate, then $\left(\frac{a_1}{2}\right)^2 &amp;lt; a_2$ and your complex conjugate poles are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ z_p = -\frac{a_1}{2} \pm j \sqrt{a_2 - \left(\frac{a_1}{2}\right)^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the case of two real poles, when $\left(\frac{a_1}{2}\right)^2 \ge a_2$, you must guarantee (to ensure stability):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ -1 &amp;lt; -\frac{a_1}{2} \pm \sqrt{\left(\frac{a_1}{2}\right)^2 - a_2} &amp;lt; +1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that means both of the following must be guaranteed (after quantization):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ -\frac{a_1}{2} + \sqrt{\left(\frac{a_1}{2}\right)^2 - a_2} &amp;lt; +1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ -1 &amp;lt; -\frac{a_1}{2} - \sqrt{\left(\frac{a_1}{2}\right)^2 - a_2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is necessary (but not sufficient) is that $|a_1| &amp;lt; 2$ and what also must be true is (getting rid of the $\sqrt{\cdot}$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \left(\frac{a_1}{2}\right)^2 - a_2 &amp;lt; \left(1 + \frac{a_1}{2}\right)^2 = 1 + a_1 + \left(\frac{a_1}{2}\right)^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \left(\frac{a_1}{2}\right)^2 - a_2 &amp;lt; \left(1 - \frac{a_1}{2}\right)^2  = 1 - a_1 + \left(\frac{a_1}{2}\right)^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_2 &amp;gt; -1 - a_1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_2 &amp;gt; -1 + a_1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so for real poles ($\left(\frac{a_1}{2}\right)^2 \ge a_2$) you must make sure, after quantization that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|a_1| &amp;lt; 2$$&#xA;and&#xA;$$-1 + |a_1| &amp;lt; a_2 \le \left(\frac{a_1}{2}\right)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for complex conjugate poles ($\left(\frac{a_1}{2}\right)^2 &amp;lt; a_2$), it's much, much easier.  i'll leave this for an exercise for the reader but you can easily show that (for complex conjugate):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |z_p|^2 = a_2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 0 &amp;lt; |z_p|^2 = a_2 &amp;lt; 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you still will see that $|a_1| &amp;lt; 2$ is necessary because $|a_1| &amp;lt; 2 a_2 &amp;lt; 2$.  it turns out that $-\frac{a_1}{2}$ is the point on the $\mathfrak{Re}(z)$ axis that is midway between the two poles, whether they be real or complex conjugate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, if your digital filter is slewing from one stable complex pole case to another stable complex pole place, then $a_2$ is slewing from one value less than 1 to another value less than one and all filters in between will have $a_2$ less than one and will be stable, at least in a &quot;static&quot; sense.  rapid coefficient slewing can create instabilities in and of itself, but if the slewing stops (at a stable condition), any instability also stops.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so in both real and complex conjugate cases, to have stability in the above biquad you must have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ -2 &amp;lt; a_1 &amp;lt; 2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 0 &amp;lt; a_2 &amp;lt; 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the complex conjugate case $a_1^2 &amp;lt; 4 a_2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-1 + |a_1| &amp;lt; a_2 \le \left(\frac{a_1}{2}\right)^2 = \frac{|a_1|^2}{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the real pair case $a_1^2 \ge 4 a_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that, in the real pole pair case, we know that $$-1 + |a_1| &amp;lt;  \frac{|a_1|^2}{4}$$ because $$-1 + |a_1| - \frac{|a_1|^2}{4} = -\frac{1}{4}(|a_1|-2)^2 &amp;lt; 0$$.  so there is always a gap for $a_2$ to fit into.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-06-23T00:41:59.710" LastActivityDate="2015-06-23T00:41:59.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24297" PostTypeId="2" ParentId="24277" CreationDate="2015-06-22T17:36:58.343" Score="1" Body="&lt;p&gt;let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \phi_0 \triangleq \phi - 2 \pi \left \lfloor \frac{\phi}{2\pi} \right \rfloor $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\lfloor \cdot \rfloor$ is the &lt;code&gt;floor()&lt;/code&gt; function, the largest integer not exceeding the argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it shouldn't be too hard to show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ e^{j \phi_0} = e^{j \phi} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for all real $\phi$. &lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-06-22T17:36:58.343" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24298" PostTypeId="1" CreationDate="2015-06-22T17:53:00.230" Score="0" ViewCount="814" Body="&lt;p&gt;I have recently seen some code written in modelling tool like Simulink, ASCET which uses PT1 filter? Why do we use a pulse train filter? What is the difference between FIR, IIR, Chebyschev, Butterworth and a Pulse Train filter? When a signal continuous passes through a pulse train what happens?&lt;/p&gt;&#xA;" OwnerUserId="16348" LastActivityDate="2015-06-22T17:53:00.230" Title="What is pulse train filter?" Tags="|matlab|filters|kalman-filters|filtering|control-systems|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24299" PostTypeId="2" ParentId="24293" CreationDate="2015-06-22T18:46:44.180" Score="2" Body="&lt;p&gt;The poles of that filter are extremely close to the unit circle (pole radius $=0.9999$). You will run into problems with any fixed-point implementation of that filter (with any reasonable word length), because it is not only coefficient quantization that will give you problems but also round-off noise (due to signal quantization). If you only consider coefficient quantization (not signal quantization), you need at least 14 bits for theoretical stability (for a direct-form structure). There are other filter structures, but they won't help much for such a critical case as given in your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to do is ensure a certain stability margin, i.e. a maximum pole radius $r\le r_0$, where $r_0&amp;lt;1$. The appropriate value for the limit $r_0$ on the maximum radius depends on the available coefficient word length and on the chosen filter structure. Note that the shift of the pole locations due to coefficient quantization also depends on the pole angle (unless you use a coupled-form structure), so unfortunately there is no general rule for determining $r_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll add some explanation in reaction to RBJ's comments. RBJ correctly claims that even when the coefficients are quantized, then, regardless of the number of bits, a second order section can always be made stable. This is obviously true, because we can always make sure that the (direct-form) coefficients $a_1$ and $a_2$ of the denominator polynomial $A(z)=1+a_1z^{-1}+a_2z^{-2}$ are inside the &lt;a href=&quot;https://books.google.nl/books?id=qtDkBwAAQBAJ&amp;amp;lpg=PA376&amp;amp;ots=G_2RAnYpFb&amp;amp;dq=%22stability%20triangle%22%20filter%20digital&amp;amp;pg=PA112#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;stability triangle&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}a_2&amp;amp;\ge -a_1-1\\&#xA;a_2&amp;amp;\ge a_1-1\\&#xA;a_2&amp;amp;\le 1\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tidaj.png&quot; alt=&quot;stability triangle&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I was talking about was the straightforward (or naive) quantization, where you just choose the quantized coefficient that is closest to the original coefficient given the number of available bits and the desired range of values. If you do this for the filter given in your question then you indeed need 14 bits in order to obtain a (theoretically) stable filter. As mentioned before, due to signal quantization that filter will still not be useful in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the approach I was talking about is to change the (unquantized) pole locations such that the maximum pole radius is less or equal to some chosen $r_0&amp;lt;1$, and then apply (naive) quantization (and of course check the result). RBJ's equivalent approach would be to do this in one step, i.e. quantize but at the same time guarantee that the quantized coefficients end up inside the stability triangle. Either way, you end up with a stable filter that deviates from the ideal filter. The magnitude of that deviation depends on how much the actual pole locations have to be changed in order to obtain a stable filter for the given number of bits spent on the coefficients.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-06-23T15:50:22.757" LastActivityDate="2015-06-23T15:50:22.757" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24300" PostTypeId="2" ParentId="24295" CreationDate="2015-06-22T18:51:44.563" Score="0" Body="&lt;p&gt;If you are dealing purely with binary images then simply counting the number of foreground pixels versus the number of background pixels in a sliding $M \times N$ window will produce another image depicting the areas of higher &quot;ink&quot; density. This is probably the most simple metric you can use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For images with colour depth greater than 2, &lt;a href=&quot;https://en.wikipedia.org/wiki/Entropy_%28information_theory%29&quot; rel=&quot;nofollow&quot;&gt;Entropy&lt;/a&gt; (again, evaluated over a sliding window) would be a better metric in quantifying the complexity of an area of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, Haralick's features offer a larger selection of features used to quantify various aspects of texture. For more information please see &lt;a href=&quot;https://en.wikipedia.org/wiki/Co-occurrence_matrix&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://murphylab.web.cmu.edu/publications/boland/boland_node26.html&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-06-22T18:51:44.563" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24301" PostTypeId="1" AcceptedAnswerId="24302" CreationDate="2015-06-22T18:56:48.577" Score="2" ViewCount="867" Body="&lt;p&gt;I'm working on trying to find an efficient way to implement a FIR comb/decimating filter. For a given &quot;prototype&quot; low-pass filter $&#xA;H(z)$, a comb that &quot;repeats&quot; $L$ times in the frequency domain can be constructed by upsampling (stuffing $L-1$ zeros in between each sample), yielding $H(z^L)$ (Proakis and Manolakis 342). We will denote the impulse response of the comb filter by $c[k]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also wish to decimate the comb filter output by a factor of $D$. I do not wish to cascade an integrator to make a CIC filter, and I am aware that aliasing will be introduced. I am okay with this. To implement the decimating FIR filter, I have chosen to use a polyphase implementation. This means that I will have $D$ branches, each of which will contain a downsampled and delayed version of the base FIR filter (Proakis and Manolakis 767), i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;    p_i[n] = c[nD + i]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since $c[k]$ is $L$-sparse, i.e. only one out of every $L$ samples is nonzero, each polyphase branch, even though they are all downsampled, will still have a lot of zeros in them. In general, $L &amp;gt; D$ for my application, so effectively each branch filter $p_i[k]$ is a resampled version of $h[k]$ by a factor of $L/D$ (with no interpolation/decimation filter in between the upsampling and downsampling steps). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a computationally efficient way to take advantage of the fact that most of the taps are zero? Does multiplying by zero in floating point arithmetic take less computational effort or the same amount as multiplying two nonzero numbers? If so, then perhaps a naive implementation would be sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Works Cited:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Proakis, John and Dimitris Manolakis. &lt;em&gt;Digital Signal Processing: Principles, Algorithms, and Applications.&lt;/em&gt; 4th ed. Upper Saddle River, NJ: Pearson 2006. Print.&lt;/p&gt;&#xA;" OwnerDisplayName="user16223" LastActivityDate="2015-06-22T19:06:48.023" Title="Efficient implementation of FIR comb/decimating filter" Tags="|decimation|finite-impulse-response|comb|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24302" PostTypeId="2" ParentId="24301" CreationDate="2015-06-22T19:06:48.023" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Is there a computationally efficient way to take advantage of the fact that most of the taps are zero?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;is there a pattern to those taps (or to the taps that are potentially non-zero)?  can you skip over those taps that are known in advance to have zero coefficient?&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-06-22T19:06:48.023" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24303" PostTypeId="1" AcceptedAnswerId="24342" CreationDate="2015-06-22T19:31:00.480" Score="1" ViewCount="756" Body="&lt;p&gt;In the &lt;a href=&quot;https://dsp.stackexchange.com/questions/24245/raised-cosine-filter-calculating-phase-response&quot;&gt;previous post&lt;/a&gt; it has been mentioned that the phase response of Raised-Cosine filter is linear and is given with ϕ(ω)=−ωT, where T is the delay. But, I have also read in literature that it is also a minimum phase filter and non-linear. Which one is correct, and if it is minimum phase how I can calculate it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have three kinds of Raised-Cosine filters, as per picture below. What is the phase response for each kind of filter? How the phase response graph will look like for each filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ICezY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-06-24T11:09:28.167" Title="Raised-Cosine Filter - phase response graphs for three kinds of filter" Tags="|filters|dsp-core|finite-impulse-response|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24304" PostTypeId="2" ParentId="24293" CreationDate="2015-06-22T19:58:01.517" Score="0" Body="&lt;p&gt;To answer the direct question: the easiest test is the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Quantize the coefficients &lt;/li&gt;&#xA;&lt;li&gt;Turn the resulting fixed point numbers back into double precision floating point (i.e. something with significantly higher precision than your fixed point representation)&lt;/li&gt;&#xA;&lt;li&gt;Re-Calculate the new pole locations and check whether they are still nicely inside the unit circle&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This will also you allow to assess whether the quantization has changed the shape of the transfer function in an unacceptable way, even if it's still stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this specific filter will be very difficult to implement, it may be stable, but it will incredibly noise. The quantization during calculation induces the noise and this noise is amplified by the pole transfer function. This particular example has a maximum noise gain of 72 dB, so you will need a LOT of bits depending on what our signal to noise requirements are or consider implementing the fixed point math in double precision. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2015-06-22T22:01:03.617" LastActivityDate="2015-06-22T22:01:03.617" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24305" PostTypeId="1" CreationDate="2015-06-22T20:38:14.400" Score="0" ViewCount="582" Body="&lt;p&gt;I've been doing some thinking lately. I know that for image files a larger portion of information is contained in the phase of the signal. How does that go for the audio? Does the same hold or is the amplitude the one with the more information content? Thx all.&lt;/p&gt;&#xA;" OwnerDisplayName="user16349" LastActivityDate="2016-01-13T19:13:32.857" Title="phase, magnitude, audio file and information" Tags="|fft|audio|phase|magnitude|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24306" PostTypeId="2" ParentId="15770" CreationDate="2015-06-22T21:24:01.973" Score="1" Body="&lt;p&gt;This might help partially - &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, possibly track the person's head from his hair color(usually black), so can be distinguished from the background. This tracking just needs a simple RGB Filter like &lt;code&gt;( r&amp;lt;val2 &amp;amp;&amp;amp; g&amp;lt;val4 &amp;amp;&amp;amp; b&amp;lt;val3)&lt;/code&gt;. Then, you can calibrate the program to respond when the centroid of that hair-region crosses your desired lines/boundaries.&lt;/p&gt;&#xA;" OwnerUserId="7914" LastActivityDate="2015-06-22T21:24:01.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24307" PostTypeId="2" ParentId="24305" CreationDate="2015-06-22T21:58:52.087" Score="1" Body="&lt;p&gt;As the comments said. &quot;monoaural phase&quot; is not very important and monoaural phase changes are often inaudible. &quot;binaural&quot; phase is very important for localisation and imaging, particularly in stereo files.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;monoaural&quot; means the phase of a single channel or that the same phase shift or modification is applied to all channels the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;binaural&quot; means specifically the difference in the signal at the left and the right ear. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-06-22T21:58:52.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24308" PostTypeId="1" CreationDate="2015-06-22T22:45:20.807" Score="-1" ViewCount="162" Body="&lt;p&gt;In this question I have asked what are the benefits from interleaving between two codewords over ONE OFDM symbol in packet based transmission made up of more than one OFDM symbol&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/24124/purpose-of-interleaving-in-ofdm-systems&quot;&gt;Purpose of interleaving in OFDM systems&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer was satisfying. I have another question now and I am looking for your opinion on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I decide to do interleaving outside of a single OFDM symbol, (say for example in packet based transmission) then is there any benefit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="21075" LastEditDate="2020-04-29T20:56:28.887" LastActivityDate="2022-05-20T00:02:15.220" Title="Interleaving over OFDM symbols in same transmission" Tags="|digital-communications|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24310" PostTypeId="2" ParentId="3541" CreationDate="2015-06-23T00:28:52.973" Score="0" Body="&lt;p&gt;I manage this (in a pretty much perfect manner), in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming that you have a set of lowpass &amp;amp; highpass filters,  where LPx and HPx are at the same frequency in order to do the splitting.  LP0 is the lowest crossover frequency, LP2 is the highest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generate the signals like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;----- LP0 ----- LP1 ----- LP2 --- lowest frequency subband&#xA;  |&#xA;  --- HP0 ----- LP1 ----- LP2 ---&#xA;            |&#xA;            --- HP1 ----- LP2 --- &#xA;                      |&#xA;                      --- HP2 --- highest frequency subband&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With this filter network, all signals have the same delay, and can be added back together in a pretty much perfect manner.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works like a charm for me.  Please vote up or accept my answer if you like it :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA; -Caleb&lt;/p&gt;&#xA;" OwnerUserId="16284" LastActivityDate="2015-06-23T00:28:52.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24311" PostTypeId="2" ParentId="24308" CreationDate="2015-06-23T02:11:26.577" Score="0" Body="&lt;p&gt;Interleaving data that can be contained in one OFDM symbol between $n$ OFDM symbols will significantly reduce your bitrate and spectral efficiency by a factor of $\frac{1}{n}$. The advantage of doing this would be to increase your resilience to short bursts of noise, but only over $n$ symbols, at the cost of reducing your bitrate by $\frac{1}{n}$. I don't think many applications (if any) would benefit from this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I think my initial response wasn't right. Suppose you're interleaving $n=10$ symbols with each other over 10 symbols, and only after you receive the whole block of 10 symbols can you read the code. The amount of information transmitted over the channel over time is the same as when symbols aren't interleaved, there is just some additional latency for the receiver to get the message. As long as your data can wait the extra time, it's worth it for your data to be that much more resilient to noise.&lt;/p&gt;&#xA;" OwnerUserId="16326" LastEditorUserId="16326" LastEditDate="2015-06-24T02:50:50.137" LastActivityDate="2015-06-24T02:50:50.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24313" PostTypeId="2" ParentId="24305" CreationDate="2015-06-23T05:34:44.833" Score="1" Body="&lt;p&gt;Audio for humans?  The human ear-brain system appears to be insensitive to absolute phase within stationary pitches, but more sensitive or responsive to differential phase (between the two ears), periodic or patterned changes in phase (pitch modulations), and perhaps phase coincidence within the spectrum to help characterize transient envelopes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Animals that use echo location to hunt their meals may be far more sensitive to the absolute phase of audio signals (both emitted and heard).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-13T19:13:32.857" LastActivityDate="2016-01-13T19:13:32.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24314" PostTypeId="1" AcceptedAnswerId="24315" CreationDate="2015-06-23T07:14:26.037" Score="5" ViewCount="116" Body="&lt;p&gt;I've got a JAI GO-5000-USB camera and have tried several cable lengths, ranging from 40cm to 5m. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I haven't observed many differences in the quality of the pictures I've taken. Since I want to avoid a later realization that the quality isn't that good after all, I'm hoping that someone with experience with USB 3.0 cameras and longer cable lengths could warn me in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is:&#xA;Has anyone experienced a decreasing quality of taken pictures depending on longer cable lengths? When did the problems start and in which way did they appear? Is it possible to measure or visualize those effects?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to visualize them with histograms, but that didn't really show anything useful at all.&lt;/p&gt;&#xA;" OwnerUserId="16355" LastEditorUserId="128" LastEditDate="2019-10-31T06:06:33.753" LastActivityDate="2019-10-31T06:06:33.753" Title="Does the Quality of the Pictures Taken by a USB 3.0 Camera Depend on Cable Length?" Tags="|digital-communications|snr|camera|hardware|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24315" PostTypeId="2" ParentId="24314" CreationDate="2015-06-23T07:25:54.787" Score="5" Body="&lt;p&gt;No, the data in the USB cable is digital.&lt;br&gt;&#xA;Namely there is either an error in the data or the data is the same at any place along the cable.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-06-23T07:25:54.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24316" PostTypeId="1" AcceptedAnswerId="24319" CreationDate="2015-06-23T07:56:31.080" Score="0" ViewCount="284" Body="&lt;p&gt;When I read the  article &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;Windowing Functions&lt;/a&gt;, there are two terms that are does not understanding them well, sensitiviy and resolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked for this two terms on the web, And I conclude that sensitivity are how much you can distinguish the components of the signal, and resolution how many components you can have for a signal. Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my above conclusion was correct I see that the more resolution the more components I have, yields less distinguishing of that components, which means the more resolution the less sensitivity, does that also is correct? Also, does the overlpping windows is a solution for the little resolution that some windows has, for example hanning window?&lt;/p&gt;&#xA;" OwnerUserId="15174" LastEditorUserId="15174" LastEditDate="2015-06-23T10:16:00.827" LastActivityDate="2015-06-23T12:00:28.340" Title="Sensitiviy and Resolution in Windowing Functions" Tags="|window-functions|resolution|window|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24317" PostTypeId="1" CreationDate="2015-06-23T08:04:48.200" Score="0" ViewCount="2057" Body="&lt;p&gt;I heard that an IIR filter has delay and phase shift effect, but not clearly what are they. For example, 1-pole Lowpass has 90 degree phase shift, 2-pole Lowpass has 180 degree? So does it mean two 2-pole Lowpass filters has 360 degree phase shift? Beside the HighPass, LowPass, AllPass filter, other IIR filter like LowShelf, HighShelf, Peak... has phase shift too?&lt;br/&gt;&#xA;When I apply an IIR filter using biquad transfer function, does it has any phase shift diffirent if I use direct form I (4 delay registers) vs direct form II (2 delay registers)?&lt;br/&gt;&#xA;If IIR filter has phase shift, the phase shift occurred at the filter's target frequency, or all the frequencies? How can I phase shift (all frequencies) 90 degree clockwise &amp;amp; counterclockwise just using AllPass filter?&lt;br/&gt;&lt;br/&gt;&#xA;I know some of my questions are noob, but I'm just study dsp myself, and there're somethings that I really confused about. Sorry for my bad English too :)&lt;/p&gt;&#xA;" OwnerUserId="15039" LastActivityDate="2015-06-24T06:03:38.157" Title="IIR filter and phase shift" Tags="|phase|infinite-impulse-response|" AnswerCount="1" CommentCount="1" ClosedDate="2015-07-03T14:57:57.297" ContentLicense="CC BY-SA 3.0" />
  <row Id="24318" PostTypeId="2" ParentId="24040" CreationDate="2015-06-23T09:42:32.060" Score="1" Body="&lt;p&gt;I would try with this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;channel =[1 0.2]';&#xA;Ga=[+1, +1, +1, -1, +1, +1, -1, +1]';&#xA;Gb=[+1, +1, +1, -1, -1, -1, +1, -1]';&#xA;y1=conv(channel,Ga);&#xA;y2=conv(channel,Gb);&#xA;correlation_output1=xcorr(y1,Ga);&#xA;correlation_output2=xcorr(y2,Gb);&#xA;channel_estimation=correlation_output1+ correlation_output2;&#xA;stem(channel_estimation./length(Gb)) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Best regards, &lt;/p&gt;&#xA;" OwnerUserId="16357" LastActivityDate="2015-06-23T09:42:32.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24319" PostTypeId="2" ParentId="24316" CreationDate="2015-06-23T12:00:28.340" Score="1" Body="&lt;p&gt;I object to the Wiki author's use of the words &quot;resolution&quot; and &quot;sensitivity.&quot; Those words are vague and the author does not define or explain them in any meaningful way. If I was forced to use the author's poor terminology I'd say, &quot;A fine-resolution window is a window having a narrow main lobe. (And windows whose main lobe widths are narrow have high-level sidelobes.) A window with good sensitivity is a window with low-level sidelobes. (And windows with low-level sidelobes have wider main lobes.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand the 2nd and 3rd paragraphs of your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A window with a narrow main lobe improves your ability to distinguish (recognize, discriminate), in the frequency domain, two closely spaced spectral sinusoids.  A window with low sidelobe levels improves your ability to detect, in the frequency domain, a low-level sine wave that is close in frequency to a high-level sinusoid.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-06-23T12:00:28.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24321" PostTypeId="1" AcceptedAnswerId="24323" CreationDate="2015-06-23T14:38:28.090" Score="0" ViewCount="3561" Body="&lt;p&gt;Does the energy signal or finite energy signal have 0 dc component always?How to confirm this from the frequency spectrum? &lt;/p&gt;&#xA;" OwnerUserId="16360" LastActivityDate="2015-06-23T15:25:56.457" Title="how to calculate the dc component of an energy signal?" Tags="|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24322" PostTypeId="1" CreationDate="2015-06-23T15:11:33.690" Score="1" ViewCount="943" Body="&lt;p&gt;I am doing a LPC analysis of a speech signal using the autocorrelation method. To calculate the LPCs I am using the &lt;a href=&quot;https://en.wikipedia.org/?title=Levinson_recursion&quot; rel=&quot;nofollow&quot;&gt;Levinson–Durbin recursion&lt;/a&gt;. In my literature the error is initialized with the first element of the autocorrelation sequence. The algorithm later uses the error (from the previous pass) to calculate the reflection coefficient. However, the error is used as divisor in a division. Thus, in case the first element of the autocorrelation sequence is zero this leads to a problem in my C++ implementation of LPC analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen implementations setting all LPCs to zero in case the first element of the autocorrelation sequence is zero. Other implementations ensure that the first element of the autocorrelation is always at least 1.&#xA;Matlab gives me LPCs of &lt;em&gt;NaN&lt;/em&gt; if the first element of the autocorrelation is zero in a call to its &lt;em&gt;levinson&lt;/em&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the &quot;correct&quot; way to cope with this divison-by-zero-problem? Or what is the most suitable for LPC analysis of a speech signal?&lt;/p&gt;&#xA;" OwnerUserId="16361" LastActivityDate="2017-08-12T07:59:04.957" Title="Division by zero in Levinson–Durbin recursion?" Tags="|audio|autocorrelation|speech-processing|lpc|linear-prediction|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24323" PostTypeId="2" ParentId="24321" CreationDate="2015-06-23T15:25:56.457" Score="1" Body="&lt;p&gt;An energy signal $f(t)$ satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}|f(t)|^2dt&amp;lt;\infty\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. it has finite energy. If $f(t)$ had a non-zero DC component $f_0$ defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_0=\lim_{T\rightarrow\infty}\frac{1}{T}\int_{-T/2}^{T/2}f(t)dt\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the integral in (1) wouldn't converge. So an energy signal must have a zero DC component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there is some confusion about the term &quot;DC component&quot;. Some people would call $F(0)$, i.e. the value of the Fourier transform of $f(t)$ at frequency $\omega=0$, the &quot;DC component&quot; of $f(t)$. However, note that $F(0)$ given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(0)=\int_{-\infty}^{\infty}f(t)dt\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be non-zero (but finite), even if (1) is satisfied. One example of such a signal satisfying (1) but with $F(0)\neq 0$ is a sinc pulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also have a look a &lt;a href=&quot;https://dsp.stackexchange.com/questions/21583/difference-between-dc-component-and-zero-frequency-component-of-signal/21588#21588&quot;&gt;this answer&lt;/a&gt; to a related question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-06-23T15:25:56.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24324" PostTypeId="2" ParentId="24303" CreationDate="2015-06-23T15:42:49.063" Score="1" Body="&lt;p&gt;You need to realize that the term &quot;raised cosine&quot; says absolutely nothing about the related phase response. I think the context of this question of yours is audio equalization, and in that context filters with certain desired &lt;em&gt;magnitude response&lt;/em&gt; shapes are sometimes described by piecewise constant values which are smoothly connected by raised cosine shapes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So those shapes in your figures are idealized magnitude responses. Now you can use &lt;em&gt;any&lt;/em&gt; filter design technique to approximate such a response. Still nothing is said about the phase, and it depends on the design technique which phase response you'll end up with. Analog filter designs will usually result in a minimum phase response. But note that this has absolutely nothing to do with the raised cosine shape of the desired magnitude response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In digital communications raised cosine pulses are used because they satisfy the Nyquist criterion. There also the phase is important and the frequency response of the ideal pulse has a raised cosine magnitude shape and a &lt;em&gt;linear&lt;/em&gt; phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, it is important to understand that the &quot;raised cosine&quot; property is a description of the magnitude response, and the application and/or the filter design process will determine the phase response, which can be linear, minimum phase, or anything else.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-23T15:42:49.063" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24325" PostTypeId="2" ParentId="24322" CreationDate="2015-06-23T16:04:30.783" Score="1" Body="&lt;p&gt;Matt, this is a concise snippet of code from long ago:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**********************************************************************&#xA;*                                                                     *&#xA;* Levinson-Durbin Algorithm for LPC Coefficients                      *&#xA;*                                                                     *&#xA;*   input:                                                            *&#xA;*   n  = LPC order                                                    *&#xA;*   r -&amp;gt; r[0] to r[n]    autocorrelation values                       *&#xA;*                                                                     *&#xA;*   output:                                                           *&#xA;*   a -&amp;gt; a[0] to a[n]    LPC coefficients, a[0] = 1.0                 *&#xA;*   k -&amp;gt; k[0] to k[n]    reflection coefficients, k[0] = unused       *&#xA;*                                                                     *&#xA;*                                                                     *&#xA;**********************************************************************/&#xA;&#xA;#define N   17&#xA;&#xA;levinson_durbin(const int n, const double* r, double* a, double* k)&#xA;  {&#xA;  double a_temp[N], alpha, epsilon;         /* n &amp;lt;= N = constant  */&#xA;  int i, j;&#xA;&#xA;  k[0]      = 0.0;                          /* unused */&#xA;&#xA;  a[0]      = 1.0;&#xA;  a_temp[0] = 1.0;                          /* unnecessary but consistent */&#xA;&#xA;  alpha     = r[0];&#xA;&#xA;  for(i=1; i&amp;lt;=n; i++)&#xA;      {&#xA;      epsilon = r[i];                       /* epsilon = a[0]*r[i]; */&#xA;      for(j=1; j&amp;lt;i; j++)&#xA;          {&#xA;          epsilon += a[j]*r[i-j];&#xA;          }&#xA;&#xA;      a[i] = k[i] = -epsilon/alpha;&#xA;      alpha = alpha*(1.0 - k[i]*k[i]);&#xA;&#xA;      for(j=1; j&amp;lt;i; j++)&#xA;          {&#xA;          a_temp[j] = a[j] + k[i]*a[i-j];   /* update a[] array into temporary array */&#xA;          }&#xA;      for(j=1; j&amp;lt;i; j++)&#xA;          {&#xA;          a[j] = a_temp[j];                 /* update a[] array */&#xA;          }&#xA;      }&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;now i see many places (well, one place, but many instances) where division by zero is possible.  any time &lt;code&gt;k[i]&lt;/code&gt; = 1 or -1.  can't that conceivably happen with a non-zero input?&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-06-23T16:04:30.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24326" PostTypeId="2" ParentId="1759" CreationDate="2015-06-23T17:23:55.093" Score="0" Body="&lt;p&gt;The Z-transform of $x(n) = a^ncos(nθ)u(n)...$ will be:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/njNYg.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;                 Hope its helpful&lt;/p&gt;&#xA;" OwnerUserId="16363" LastEditorUserId="7092" LastEditDate="2015-06-23T20:56:29.363" LastActivityDate="2015-06-23T20:56:29.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24327" PostTypeId="1" CreationDate="2015-06-23T19:46:02.513" Score="1" ViewCount="226" Body="&lt;p&gt;To be concrete, given 2D numerical data as is shown as line plots below. There are peaks on a background average movement (with small vibrations). We want to find the values of pairs (x1, x2) if those peaks drops down to average; or (x1) only if the line doesn't back to the average.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/2TeLq.png&quot; alt=&quot;how to find x1 and x2 from data without plotting?&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/eVnwb.png&quot; alt=&quot;how to find x1 from data without plotting?&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are thousands of such 2D data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the right statistic or machine learning algorithm to find x1 and x2 above without plotting?&lt;/p&gt;&#xA;" OwnerUserId="16369" LastActivityDate="2016-02-19T00:53:16.043" Title="What is the right algorithm to detect segmentations of a line chart?" Tags="|signal-analysis|signal-detection|machine-learning|decomposition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24328" PostTypeId="2" ParentId="24327" CreationDate="2015-06-23T20:57:24.610" Score="2" Body="&lt;p&gt;Basically, it looks like you need to know some threshold to detect peaks:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;detect bottom edge (Xbe)&lt;/li&gt;&#xA;&lt;li&gt;calculate the moving average (until the last edge)&lt;/li&gt;&#xA;&lt;li&gt;detect peak itself (current value - average value &gt; threshold)&lt;/li&gt;&#xA;&lt;li&gt;start of peak found: X1=Xbe&lt;/li&gt;&#xA;&lt;li&gt;detect peak end (current value - average value &amp;lt; threshold)&lt;/li&gt;&#xA;&lt;li&gt;detect bottom age (Xbe)&lt;/li&gt;&#xA;&lt;li&gt;end of peak found: X2=Xbe&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Bottom edge detection in the simplest way is when you make moving subtract for two consecutive values and sign changes from negative to positive.&lt;/p&gt;&#xA;" OwnerUserId="4004" LastActivityDate="2015-06-23T20:57:24.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24329" PostTypeId="1" AcceptedAnswerId="24331" CreationDate="2015-06-23T20:59:21.540" Score="5" ViewCount="1665" Body="&lt;p&gt;In the context of &lt;a href=&quot;https://en.wikipedia.org/wiki/Scale_space&quot; rel=&quot;noreferrer&quot;&gt;scale space image pyramids&lt;/a&gt; using Gaussian filters I noticed that it's common to downsample the image after blurring with $\sigma = 2*\sigma_{init}$ . My question is: What is the relation between variance and downsampling? What is the proof that I'm not losing information when the image is downsampled after blurring with this factor? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this can easily be shown using Nyquist and the cut-off frequency of the Gaussian filter, but I'm not sure how. &lt;/p&gt;&#xA;" OwnerUserId="16371" LastEditorUserId="128" LastEditDate="2019-12-31T09:55:20.240" LastActivityDate="2019-12-31T09:55:20.240" Title="Downsampling and Gaussian Filtering in the Context of Scale Space Pyramids" Tags="|image-processing|gaussian|downsampling|nyquist|scale-space|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24331" PostTypeId="2" ParentId="24329" CreationDate="2015-06-23T22:09:33.257" Score="4" Body="&lt;p&gt;You're correct, it has to do with the Cut Off frequency of the Gaussian Blur Filter in its Frequency Domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to see it, just apply a DFT (Using MATLAB it can be achieved by &lt;code&gt;fft&lt;/code&gt; / &lt;code&gt;fft2&lt;/code&gt;) and look on the absolute value.&lt;br&gt;&#xA;Look for the -3dB point and you'll see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also an intuitive explanation on the original article which say that blurring using Gaussian Kernel with $ \sigma $ means removing any detail which its size is smaller than $ \sqrt{ \sigma } $.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-06-23T22:09:33.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24333" PostTypeId="2" ParentId="24264" CreationDate="2015-06-23T23:14:11.520" Score="0" Body="&lt;p&gt;In general, you can always explore the relationship between random vector $X$ and target variable $y$ via a supervised regression model. This requires you to prepare pairs of ($X$, $y$), and you may use whatever model you are interested in, e.g. linear regression, and use some qualitative metric to evaluate the performance of this regression model, e.g. mean square error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may find it is better to prepare input $X$ as a vector, instead of a random variable. In other words, you can use other types of features, and other forms of your current features (e.g. use median and standard deviation instead of average). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, donot be suprised that if you see $X$ can somewhat explain $y$, but not always. This phenomenon is not uncommon, because there could be some latent variables $Z$ which this $y$ also depends on. If so, there is not way for you to figure out ${\rm{argmax}}_{y} {\rm{Pr}}(y,X,Z)$ without knowning $Z$.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-06-23T23:14:11.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24335" PostTypeId="1" AcceptedAnswerId="24337" CreationDate="2015-06-24T04:11:02.023" Score="3" ViewCount="1286" Body="&lt;p&gt;I am writing a program that receives a continual stream of PCM data from various sources. Some sources have different volumes than others. The PCM data is always a live continuous stream of 16 not signed data single channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I dynamically make sure that all samples are not too low in volume or high in volume to effectively normalize its output realtime?&lt;/p&gt;&#xA;" OwnerUserId="16376" LastActivityDate="2023-02-15T21:02:20.277" Title="Adaptive volume normalization on a stream of PCM data" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24336" PostTypeId="2" ParentId="24317" CreationDate="2015-06-24T06:03:38.157" Score="1" Body="&lt;p&gt;I believe you have received no answers to your questions because your first three questions are so strange, so puzzling, that no one where to start to even begin to compose answers.  See:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.bing.com/videos/search?q=digital%20filter%20phase%20response&amp;amp;qs=n&amp;amp;form=QBVR&amp;amp;pq=digital%20filter%20phase%20response&amp;amp;sc=0-0&amp;amp;sp=-1&amp;amp;sk=#view=detail&amp;amp;mid=3DC56A834B9C701B5FE93DC56A834B9C701B5FE9&quot; rel=&quot;nofollow&quot;&gt;http://www.bing.com/videos/search?q=digital%20filter%20phase%20response&amp;amp;qs=n&amp;amp;form=QBVR&amp;amp;pq=digital%20filter%20phase%20response&amp;amp;sc=0-0&amp;amp;sp=-1&amp;amp;sk=#view=detail&amp;amp;mid=3DC56A834B9C701B5FE93DC56A834B9C701B5FE9&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.bing.com/videos/search?q=digital%20filter%20phase%20response&amp;amp;qs=n&amp;amp;form=QBVR&amp;amp;pq=digital%20filter%20phase%20response&amp;amp;sc=0-0&amp;amp;sp=-1&amp;amp;sk=#view=detail&amp;amp;mid=85921946745DEDD05D7385921946745DEDD05D73&quot; rel=&quot;nofollow&quot;&gt;http://www.bing.com/videos/search?q=digital%20filter%20phase%20response&amp;amp;qs=n&amp;amp;form=QBVR&amp;amp;pq=digital%20filter%20phase%20response&amp;amp;sc=0-0&amp;amp;sp=-1&amp;amp;sk=#view=detail&amp;amp;mid=85921946745DEDD05D7385921946745DEDD05D73&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good Luck.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-06-24T06:03:38.157" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24337" PostTypeId="2" ParentId="24335" CreationDate="2015-06-24T08:01:53.720" Score="1" Body="&lt;p&gt;What you want is called &lt;a href=&quot;http://en.wikipedia.org/wiki/Automatic_gain_control&quot; rel=&quot;nofollow noreferrer&quot;&gt;automatic gain control&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Dynamic_range_compression&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamic range compression&lt;/a&gt;. It can be implemented in a dynamics processor that takes the input audio, uses an &lt;a href=&quot;http://en.wikipedia.org/wiki/Envelope_detector&quot; rel=&quot;nofollow noreferrer&quot;&gt;envelope follower&lt;/a&gt; to analyze the volume of the input as it changes over time and modifies the audio so that the envelope of its output corresponds to the input envelope put through a non-linear function such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cMktz.png&quot; alt=&quot;Adobe Audition Dynamics Processing&quot;&gt;&lt;br&gt;&#xA;&lt;em&gt;Adobe Audition Dynamics Processing&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what is the best practice in how the envelope should be modified to match the target envelope, but usually there are separate parameters for attack and decay that control how fast the applied gain should be increased or decreased, respectively, to make the resultant envelope approach the target envelope. You could try the potentially unstable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{gain}(t) = \text{target_envelope}(t)/\text{input_envelope}(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $t$ is time. The resultant $\text{gain}(t)$ should be smoothed (lowpass filtered) before applying it, to get the wanted attack and decay behavior. The envelope detector can have additional controls for changing the (usually &lt;a href=&quot;http://en.wikipedia.org/wiki/Root_mean_square&quot; rel=&quot;nofollow noreferrer&quot;&gt;root mean square&lt;/a&gt; or peak) analysis window, and a lookahead time setting that enables the dynamics processor to respond to volume changes before they take place, by delaying the input audio after envelope detection. The root mean square calculation can be done by calculating the square of the input audio, lowpass filtering that and taking the square root of the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GptTG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;br&gt;&#xA;&lt;em&gt;Adobe Audition Dynamics Processing attack, decay and lookahead controls&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These parameters and the non-linear function should be tuned (by listening) for minimal audible artifacts such as pumping of the volume and low-frequency distortion.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-06-24T09:06:58.867" LastActivityDate="2015-06-24T09:06:58.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24338" PostTypeId="1" CreationDate="2015-06-24T08:52:26.137" Score="3" ViewCount="130" Body="&lt;p&gt;Considering this image, where I have a spectral decomposition of a light bulb.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pl2l0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the non point shaped light source, the spectral decomposition using a diffraction grating in front of my camera leads to overlapping spectral components. As a human though I can still perceive the structure of the main four or five spectral components because I know they should have the same shape as the lamp. Knowing the structure of the lamp, is it possible to isolate each of those spectral components with their correct amplitude, and what algorithm would be used in that case?&lt;/p&gt;&#xA;" OwnerUserId="16379" LastActivityDate="2015-06-25T09:37:03.493" Title="Extracting original signal from overlapping area" Tags="|frequency-spectrum|spectrogram|deconvolution|decomposition|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24339" PostTypeId="2" ParentId="24264" CreationDate="2015-06-24T09:27:02.657" Score="1" Body="&lt;p&gt;Focusing too much on the eigenvalues neglects the eigenvectors which are more important here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a way, it is natural to associate eigenvalues with brightness but what is actually achieved with such techniques is &lt;a href=&quot;https://en.wikipedia.org/wiki/Contrast_%28vision%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;contrast&lt;/strong&gt;&lt;/a&gt; enhancement. This is not a mere scaling of the magnitude of the pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, given an image $A$, its pixel brightness can be changed by $2 \times A$. $A$ will now appear brighter but the relationships between the values of the pixels will have been preserved. Therefore, any objects hidden in shaddows (small pixel differences relative to their background) will remain hidden in the shadows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see those objects, you would have to change the &lt;strong&gt;contrast&lt;/strong&gt;, that is, the relationship &lt;strong&gt;BETWEEN&lt;/strong&gt; pixel values. The most simple way to achieve this is with an image window (nothing to do with spectral windows). For more information about this please see &lt;a href=&quot;http://www.cs.ioc.ee/~khoros2/one-oper/window-level/front-page.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://image.slidesharecdn.com/imageprocessingbasics-090420034842-phpapp02/95/image-processing-basics-12-728.jpg?cb=1240199398&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt;. There are other ways to modify contrast, often equivalent to a complex window, such as equalisation, normalisation and others but these are not the only ways to modify contrast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We usually tend to think of some matrix $A$ as a whole (e.g. an image). However, for the purposes of &lt;a href=&quot;https://en.wikipedia.org/wiki/Eigendecomposition_of_a_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;eigendecomposition&lt;/a&gt;, it is more useful to look at some $A$ with dimensions $M \times N$ as a way of grouping together a set of vectors from a multidimensional space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in our mind, we now abandon the view of $A$ as a spatial index of intensity (which is what an image is) and we start thinking about a huge &quot;box&quot; into which we see lots and lots of little vectors that are pointing towards all sorts of directions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, imagine that you take a completely new vector, of equal dimensions and you stick it in this space at some orientation. You can then estimate how many vectors are aligned with this direction and make a note of it that looks like (Direction, Number of vectors aligned with that direction). Change the direction of your &quot;controlled vector&quot; and do it again, do it again and again and again and again and again until you have a (very) long list of (Direction, Magnitude) measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, a non random &quot;vector cloud&quot; such as the one we are imagining here will have some sort of orientation. That is, most of the vectors will be pointing mostly (not necessarily EXACTLY) towards some specific direction. This direction will have very high &quot;counts&quot; (of aligned vectors) and as the direction of your &quot;controlled&quot; vector moves away from this your counts will be decreasing rapidly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's get back to the eigendecomposition now. Eigendecomposition is a way of discovering these pairs of (Direction, Magnitude) &lt;strong&gt;WITHOUT&lt;/strong&gt; having to stick a &quot;controlled&quot; vector at different orientations and count alignments. In the end of this process, you get pairs of (Eigenvector (a.k.a Direction), Eigenvalue (a.k.a Magnitude)). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as a side note, if you can decompose the &quot;vector cloud&quot; into (Eigenvector, Eigenvalue) pairs then you can recompose it from these pairs too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back to our original problem: &quot;So what? I don't have vectors, I have an image, how does playing around with little arrows affects the image?&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that your &quot;vector cloud&quot; assumes a particular form (a shape) in this multidimensional space. That's not hard to do because an image that is not noise &lt;strong&gt;does&lt;/strong&gt; show something so the pixels do have &lt;strong&gt;some&lt;/strong&gt; sort of order and are not all over the place. &lt;strong&gt;BUT&lt;/strong&gt;, the vectors in this &quot;vector cloud&quot; might be corrupted by some random fluctuations in their directions (a.k.a noise). So, in this case, we can take advantage of the fact that a very large number of vectors are pointing in some general direction which we can recover. All we have to do now is &lt;strong&gt;RECOMPOSE&lt;/strong&gt; the vector cloud keeping only a subset of the stronger (Eigenvector, Eigenvalue) pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This, is the main idea. But it is not always applied directly on a given image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the case of &lt;a href=&quot;https://en.wikipedia.org/wiki/Eigenface&quot; rel=&quot;nofollow noreferrer&quot;&gt;eigenfaces&lt;/a&gt;, the eigendecomposition is applied on the covariance matrix &lt;strong&gt;between&lt;/strong&gt; images. This provides the general direction of a &quot;vector cloud&quot; that describes covariances between images. In effect, eigenfaces are a small set of elementary images that describe a very large set of faces as linear combinations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first paper that you are linking in your original post, the eigendecomposition is applied on the Discrete Cosine Transform (DCT) field of the actual satelite images, again, the main idea is the same but here authors are discovering a set of elementary spatial frequency components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, please see &lt;a href=&quot;https://engineering.purdue.edu/~bouman/grad-labs/Eigen-Image-Analysis/pdf/lab.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://math.stackexchange.com/questions/92171/what-do-eigenvalues-have-to-do-with-pictures&quot;&gt;this&lt;/a&gt; link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us now turn briefly to your experiments. It is probably obvious by now that by focusing on the eigenvalues you are obtaining a rough approximation of the scene's brightness. Furthermore, the logarithmic dependence that you see in your graph is perfectly normal and due to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Sensitometry&quot; rel=&quot;nofollow noreferrer&quot;&gt;characteristic curve&lt;/a&gt; of the imaging device you are using (e.g. a digital camera at different &lt;a href=&quot;https://en.wikipedia.org/wiki/F-number&quot; rel=&quot;nofollow noreferrer&quot;&gt;f-number&lt;/a&gt; settings.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all you are trying to do is...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;study the variation of eigen values with respect to luminance of an&#xA;  image&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;...then there will be some dependence but it will be indirect. As you are modifying the exposure of a given scene, you will pass from a set of obvious points. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Point-1: Image severely underexposued, in this case most of the&#xA;image is dark, it has very low contrast and is associated with very&#xA;low eigenvalues and very few eigenvectors...There is not much to&#xA;describe here. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Point-2: Image perfectly exposed, in this case you are getting the&#xA;maximum of contrast that can be obtained from a given scene with a&#xA;given imaging device. You will get higher number of eigevectors and&#xA;eigenvalues than point-1 because every pixel of your image now&#xA;contains some information about the scene being imaged.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Point-3: Image severely over-exposed, in this case you are again&#xA;operating at a region of low contrast but this time it is because&#xA;the sensor is saturated. Any sort of difference in luminus flux goes&#xA;unnoticed by the sensor which is simply recording the maximum of&#xA;value it can produce at its output. Consequently, you get a mostly&#xA;washed out image which again has a lower number of eigenvectors (but&#xA;possibly high eigenvalues).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-06-24T09:27:02.657" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24342" PostTypeId="2" ParentId="24303" CreationDate="2015-06-24T11:09:28.167" Score="1" Body="&lt;p&gt;Matt L. is right. The raised cosine shape describes the magnitude response of the filter, but the phase response is generated as a side-effect of the chosen implementation. The two most common choices for the phase response are Linear-Phase and Minimum-Phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, try doing this in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFTLen = 8192;&#xA;FSample = 48000;&#xA;Freq = (0:FFTLen/2)' * FSample/FFTLen;&#xA;FreqOct = log2(Freq/1000);&#xA;Gain_dB = 6 * sin(interp1( [-20 0.5 1 1.5 20], [0 0 1 0 0], FreqOct, 'linear', 'extrap')*pi/2).^2;&#xA;semilogx( Freq, Gain_dB); grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code creates a column vector (&lt;code&gt;Freq&lt;/code&gt;) that defines the frequencies of the FFT bins between 0 and 24000Hz, for an FFT of length 8192. The &lt;code&gt;Freq&lt;/code&gt; vector will actually be 4097 long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The column vector &lt;code&gt;FreqOct&lt;/code&gt; expresses the frequency in Octaves, relative to 1kHz. The Matlab function &lt;code&gt;interp1()&lt;/code&gt; creates a piecewise linear function that ramps from 0 to 1 and back to 0 again, to define a &quot;raised triangle&quot; filter response centered at 1-octave (that's 2kHz). Finally, the expression &lt;code&gt;sin( xxx * pi/2).^2&lt;/code&gt;  is a quick way to convert the raised triangle shape to a raised cosine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting magnitude response looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jeoyC.jpg&quot; alt=&quot;Magnitude Response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, this magnitude response needs to be 'mirrored', so that it extends all the way to 48kHz. Then, we can compute a linear-phase impulse response by simply taking the inverse-FFT of this (real) magnitude response (and we also shift it to the middle of the vector, using the &lt;code&gt;fftshift()&lt;/code&gt; function):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;MagResp = 10 .^ ( Gain_dB( [1:end,end-1:-1:2] )/20 );&#xA;IR_LinearPhase = fftshift( real( ifft( MagResp )));&#xA;plot( -FFTLen/2:FFTLen/2-1, IR_LinearPhase ); grid on; title('Linear-Phase Impulse Response');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8yZnq.jpg&quot; alt=&quot;Linear-phase IR&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, we can create the Minimum-phase Impulse Response, by using the &lt;code&gt;hilbert()&lt;/code&gt; function, applied to the logarithm of the magnitude response:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IR_MiniumPhase = fftshift( real( ifft( conj( exp( hilbert( log( MagResp )))))));&#xA;plot( -FFTLen/2:FFTLen/2-1, IR_MinimumPhase ); grid on; title('Minimum-Phase Impulse Response');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vxLTm.jpg&quot; alt=&quot;Minimum-phase IR&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting phase response of the minimum-phase filter is shown here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BZlr6.jpg&quot; alt=&quot;Phase Resp&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, it's clear that the Linear-Phase filter (as it's plotted up above) cannot be realised in a practical system, because the impulse response contains non-zero values prior to time zero. The 'pre-ripple' in the linear-phase impulse response extends about 50-80 samples prior to time zero, so it's reasonable to expect that we might be able to implement this linear-phase filter if we add about 50-80 samples delay (with a window function applied to give us a smoother result):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IR_Delayed = IR_LinearPhase(4096-80:4096+80) .* hanning(161);&#xA;plot(IR_Delayed); grid on; title('161-tap Linear-phase filter with 80-sample delay');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/L9aIk.jpg&quot; alt=&quot;IR_Delayed&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11204" LastActivityDate="2015-06-24T11:09:28.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24343" PostTypeId="1" AcceptedAnswerId="24347" CreationDate="2015-06-24T13:22:07.467" Score="0" ViewCount="47" Body="&lt;p&gt;I'm having some trouble visualising (and understanding) the filtering of a sampled signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly, after sampling a signal, it is desired to have it go through a lowpass to retrieve the original signal again. The literature states the following below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\omega_0 &amp;lt; B &amp;lt; \omega_s - \omega_0$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\omega_s$ is the sampling frequency and &lt;code&gt;B&lt;/code&gt; is, what I assume, the bandwith of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand what is meant by the above expression and the literature is kind of crap at explaining it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping someone can visualise this for me.&lt;/p&gt;&#xA;" OwnerUserId="16382" LastActivityDate="2015-06-24T17:43:25.297" Title="Visualisation of bandwith of filter with sampling" Tags="|filters|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24344" PostTypeId="1" CreationDate="2015-06-24T13:25:56.173" Score="0" ViewCount="219" Body="&lt;p&gt;How to generate the coefficients of an itu-r 2k filter when all I know is my 0 dB point is at 2 kHz and my maximum of 6 dB is at 7 kHz &lt;/p&gt;&#xA;" OwnerUserId="16383" LastActivityDate="2015-06-24T13:25:56.173" Title="ITU-R 2k filter implementation" Tags="|filters|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24346" PostTypeId="1" CreationDate="2015-06-24T16:31:15.083" Score="16" ViewCount="21216" Body="&lt;p&gt;What is the difference between feature detectors and feature descriptors? Which among these are detectors and which are descriptors: Harris, SURF, Min Eigen, FAST, SIFT, BRISK&lt;/p&gt;&#xA;" OwnerUserId="11235" LastEditorDisplayName="user40095" LastEditDate="2020-05-12T14:59:10.613" LastActivityDate="2020-05-12T14:59:10.613" Title="What is the difference between feature detectors and feature descriptors?" Tags="|image-processing|computer-vision|local-features|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24347" PostTypeId="2" ParentId="24343" CreationDate="2015-06-24T17:43:25.297" Score="1" Body="&lt;p&gt;$B$ is the cut-off frequency of the anti-alias filter needed before sampling; $\omega_0$ is the signal bandwidth, and $\omega_s$ is the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B$ can also be the cut-off frequency of the (ideal) reconstruction filter (band-limited interpolator).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is the case, this suggests that the reconstruction filter is an ideal low-pass filter with cut-off frequency between the signal bandwidth and the next overlapped frequency component ($\omega_s - \omega_0$). The sampled signal contains repetitions of the original specturm every $\omega_s$, so when reconstructing, you want to get rid of all these repetitions and keep only the spectrum centered at 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what literature you are referring to, and why is it so &lt;em&gt;crappy&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-06-24T17:43:25.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24348" PostTypeId="1" AcceptedAnswerId="24484" CreationDate="2015-06-24T17:48:33.730" Score="5" ViewCount="198" Body="&lt;p&gt;I am trying to do blind system identification of a univariate linear FIR model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unsure if the approach is correct or not and any help to further proceed with the maximization will be great. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="780" LastEditDate="2015-08-03T23:18:46.117" LastActivityDate="2015-08-03T23:18:46.117" Title="Expectation maximization of moving average with binary source input" Tags="|discrete-signals|estimation|system-identification|state-space|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24353" PostTypeId="1" AcceptedAnswerId="24393" CreationDate="2015-06-25T01:51:49.370" Score="2" ViewCount="176" Body="&lt;p&gt;The paper &lt;a href=&quot;http://inds08.uni-klu.ac.at/INDS2008/INDS08_System_Identification_using_Symbolic_Chaotic_Sequence.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;System Identification using Symbolic Chaotic&#xA;Sequence&lt;/a&gt; proposes EM-UKS estimator for system identification of a linear FIR channel when excited by non linear input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Fig 3 of the paper there is a comparative plot of system identification of FIR model&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ y[n] = H^T x[n] + w[n] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is a chaotic input and &lt;span class=&quot;math-container&quot;&gt;$w[n]$&lt;/span&gt; is AWGN with unknown variance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performance is compared using CRLB vs MSE when the FIR system is driven by (a) chaotic deterministic numerical input, (b) chaotic quantized input (called as symbolic input), (c) filtered Gaussian input, and (d) PRBS input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q1:&lt;/strong&gt; What is the estimation technique when the input is white Gaussian and PRBS ? Is it Ordinary Least Square as they mention that they are comparing with the CRLB of non-blind. So, OLS is a non-blind technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I implemented when the input is white noise:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; h = [1    0.65   -0.2];  % MA channel coefficients&#xA;    x = randn(1000,2);  % white noise input&#xA;    u = filter(h,1,x);&#xA;    y = awgn(u,10,'measured'); % adding noise w of SNR =10dB&#xA;    X = [y,ones(n,1)];&#xA;    [b,C]=lscov(X,y) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q2:&lt;/strong&gt; I am not sure how to implement using PRBS. Can somebody please provide the code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q3:&lt;/strong&gt; Is the system identification using EM-UKS when the input is chaotic and symbolic proposed by the Authors blind or semi-blind and why? &lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="128" LastEditDate="2020-03-01T12:01:08.210" LastActivityDate="2020-03-01T12:01:08.210" Title="What is the estimator used in this paper for system identification?" Tags="|matlab|estimation|system-identification|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24354" PostTypeId="2" ParentId="21808" CreationDate="2015-06-25T02:29:46.493" Score="1" Body="&lt;p&gt;Here is the poor man's approach:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var histogram = []&#xA;foreach pixel&#xA;    histogram.append(abs(pixel.value - pixel.south.value))&#xA;    histogram.append(abs(pixel.value - pixel.east.value))&#xA;sort(histogram)&#xA;sharpness = histogram[histogram.count * 0.95]&#xA;upscaled = sharpness &amp;lt; X // You choose X experimentally&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1171" LastActivityDate="2015-06-25T02:29:46.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24355" PostTypeId="1" CreationDate="2015-06-25T03:16:59.133" Score="4" ViewCount="482" Body="&lt;p&gt;I modulated signal using BPSK modulation and I have series of -1 and 1. Now I have to pass these signal from band limited channel that has frequency response of the form $$\frac{s^2}{as^5+bs^4+cs^3+ds^2+es+f}.$$ Now I am thinking to convolve my -1 and 1 with time domain version of the above frequency response. I defined $a$, $b$, $c$... as a symbolic variable and I have their numerical value  however I need to have my impulse response in terms $a$, $b$, $c$... Therefore I would like to know:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How to find impulse response when the frequency response is order 5 in denominator? Matlab seems to give me error message when I leave the expression in terms of symbolic coefficients.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is my reasoning correct to multiply square pulse shape with a carrier and then convolve it with the impulse response of the channel?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also what do you think is a good way to demodulate the signal? would that be sufficient to multiply the received signal by my basis vector like cosine or sine?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10758" LastEditorUserId="10758" LastEditDate="2015-06-26T21:21:45.110" LastActivityDate="2017-08-15T09:34:15.073" Title="BPSK modulation under bandlimited channel" Tags="|matlab|convolution|modulation|frequency-response|impulse-response|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24356" PostTypeId="1" CreationDate="2015-06-25T03:22:34.163" Score="1" ViewCount="761" Body="&lt;p&gt;How to prove a cosine signal with irrational period and another cosine signal with a rational period are orthogonal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, $\cos(4t)$ and $\cos(4\pi t)$ sum is aperiodic. Hence it is said that these two signals are orthogonal over infinite limits? But how to prove this? Normal integration of product of the two signals cannot be used because we get $\cos(\infty)$ which is unknown.  &lt;/p&gt;&#xA;" OwnerUserId="16360" LastEditorUserId="13320" LastEditDate="2016-11-21T12:53:51.963" LastActivityDate="2016-11-21T12:53:51.963" Title="Proving orthogonality" Tags="|fourier-transform|continuous-signals|orthogonal-signals|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24357" PostTypeId="1" AcceptedAnswerId="24359" CreationDate="2015-06-25T04:27:23.810" Score="0" ViewCount="157" Body="&lt;p&gt;I want to shift the response phase of an audio signal (float array, length N, value range -1..1). I'm about using Fast Hartley Transform to transform it to the frequency-domain, process phase shift, then convert back to the time-domain and output the result.&lt;br/&gt;&#xA;I'm now can do the Hartley transform, and I also can calculate the phase of k&lt;em&gt;th&lt;/em&gt; bin:&lt;br/&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;real(k) = (x(k) + x(-k))/2&#xA;imag(k) = (x(k) - x(-k))/2&#xA;phase(k) = atan2(imag(k), real(k))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to shift the phase(k) by an α degree. What should I do?&lt;/p&gt;&#xA;" OwnerUserId="15039" LastActivityDate="2015-06-25T07:34:58.710" Title="Audio phase shift using Hartley Transform" Tags="|phase|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24358" PostTypeId="2" ParentId="24356" CreationDate="2015-06-25T05:35:47.843" Score="0" Body="&lt;p&gt;Using some trigonometry it can be shown that the product can be written as the following sum,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\cos(4 t) \cos(4\pi t) = \frac{\cos(4(\pi+1)t) + \cos(4(\pi-1)t)}{2}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we can show that the integral of just a cosine over infinite bounds is zero, then the infinite integral of this product will be zero as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The integral of the cosine will be split up  into the following parts,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{-\infty}^{\infty}\cos(x)dx = \int_{-\infty}^{-\pi/2}\cos(x)dx+\int_{-\pi/2}^{\pi/2}\cos(x)dx+\int_{\pi/2}^{\infty}\cos(x)dx&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The left and right part will be equal to each other because the cosine is an even function and the middle part is equal to 2. The left/right integral can be split up into infinitely many intervals defined by each zero crossing, such that the integral of each interval will be either $-2$ or $2$. Therefore it would be equivalent to write this integral as the following infinite summation,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;2 \sum_{n=1}^\infty (-1)^n.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar summation is known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Grandi%27s_series&quot; rel=&quot;nofollow&quot;&gt;Grandi's series&lt;/a&gt;, which has the solution $1/2$. In our case the series is multiplied by $2$ and starts with $-1$ instead of $+1$, so the sum will be equal to $-1$. Now by adding the left, middle and right part of the integral it can be shown that those add up to zero, thus the two cosines are orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would argue that the Grandi's series does not converges, then you should agree that a finite integral of a cosine will have a limited range of $[-2,2]$. This can be used when calculating the &lt;a href=&quot;https://en.wikipedia.org/?title=Fourier_series&quot; rel=&quot;nofollow&quot;&gt;Fourier coefficient&lt;/a&gt;, which is defined as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a_n = \frac{2}{P} \int_{x_0}^{x_0+P} s(x)\ \cos\left(\frac{2\pi nx}{P}\right) dx.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you choose the period $P$ to be an integer, define $s(x)$ as $\cos(4x)$, then for $n=2P$ you will find the Fourier coefficient of the $\cos(4\pi x)$ component of $\cos(4x)$. For this you do have to take the limit of $P\to\infty$. As shown before, this integral has a limited range, thus as $P$ gets bigger, then $a_n$ gets smaller and with the limit $a_n$ will go to zero.&lt;/p&gt;&#xA;" OwnerUserId="7579" LastEditorUserId="7579" LastEditDate="2015-06-25T15:57:01.587" LastActivityDate="2015-06-25T15:57:01.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24359" PostTypeId="2" ParentId="24357" CreationDate="2015-06-25T07:34:58.710" Score="0" Body="&lt;p&gt;I think your notation is a bit fishy but I'll use it. Assuming that your $\text{phase}(k)$ calculation is correct, do a complex multiplication of $\text{real}(k) + i\ \text{imag}(k)$ by $e^{i\alpha} = \cos(alpha) + i\sin(alpha)$. That can be done using four real multiplications and a few add/sub. Then you need to reverse the process of how you obtained $\text{real}(k)$ and $\text{imag}(k)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(k) = \text{real}(k) + \text{imag}(k)$$&#xA;$$x(-k) = \text{real}(k) - \text{imag}(k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally retransform.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-06-25T07:34:58.710" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24360" PostTypeId="1" AcceptedAnswerId="24362" CreationDate="2015-06-25T08:33:44.517" Score="1" ViewCount="52" Body="&lt;p&gt;I have 2 ADC channels of constant voltage measurement with small amount of high frequency noise only and no low frequency oscillations. The final signal should be the simple sum of those and denoised with the moving average in the end. Does the moving average denoising of each separate channel before final summation be more noise effective than applying summation first and do the final moving average later?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;channel_1_noisy = channel_1_clean + noise_1&#xA;channel_2_noisy = channel_2_clean + noise_2&#xA;&#xA;sum_noisy = channel_1_noisy + channel_2_noisy&#xA;sum_denoised = moving_average(sum_noisy)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or sacrificing computer time for 2 moving average filtering operations?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;channel_1_denoised = moving_average(channel_1_noisy)&#xA;channel_2_denoised = moving_average(channel_2_noisy)&#xA;sum_denoised = channel_1_denoised + channel_2_denoised&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Having more channels will the effect be exaggerated?&lt;/p&gt;&#xA;" OwnerUserId="390" LastActivityDate="2015-06-25T09:54:21.343" Title="Denoising approach for a combination of several ADC voltage channles" Tags="|lowpass-filter|denoising|moving-average|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24361" PostTypeId="2" ParentId="24338" CreationDate="2015-06-25T09:37:03.493" Score="1" Body="&lt;p&gt;I'd calculate the horizontal point spread function for each color channel separately and use the spectral sensitivity ratios of the channels for frequency calibration; the resulting sensitivity-weighted spectra should obey the same ratios.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Deconvolution can be implemented as frequency domain division of each diffracted row by the corresponding direct transmission row. The division results can be averaged over all rows, excluding from statistics any noisy bins that came from division by a value too close to zero. Hopefully the rows differ enough to cover all frequency bins. Combining the color channels at the end further reduces noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this to work properly, the image should be corrected for any distortion and rotated so that the point spread function due to diffraction is fully horizonal. Chromatic aberrations will be hard to fix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A completely different approach would be kind of a matching pursuit, which should work quite fast thanks to the spiky spectra of fluorescent phosphors. There you'd try to pattern-recognize what position in the diffracted image is most similar to an intensity-scaled copy of the direct transmission image (using a color appropriate to that position, according to a calibration). Then you'd subtract the match from that position in the diffracted image and simultaneously accumulate an estimate of the spectrum. You'd repeat the process until you'd get good enough an estimate, or would no longer be able to find a good match. It should be possible to do image geometry correction in the pattern recognition part of this approach, which would also be able to avoid problems due to chromatic aberration.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-06-25T09:37:03.493" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24362" PostTypeId="2" ParentId="24360" CreationDate="2015-06-25T09:54:21.343" Score="2" Body="&lt;p&gt;According to your processing chains (filter --&gt; sum vs sum --&gt; filter) the two approaches, by being LTI systems, should produce the same results under infinite precision arithmetic. You can show this mathematically by using the properties of convolution operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a moving average filter is just an ordinary LTI system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that nonlinearities such as quantization operations may affect the above fact's validity.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-06-25T09:54:21.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24363" PostTypeId="1" AcceptedAnswerId="24495" CreationDate="2015-06-25T10:17:44.740" Score="0" ViewCount="375" Body="&lt;p&gt;I'm trying to generate a sawtooth wave using the IFFT. I can do this successfully by first performing an FFT and then putting that analysed spectrum into the IFFT, however I would really like to be able to write a UI that enables me to draw the bin magnitudes and generate a full spectrum ready for IFFT from that. I have been partially successful, however the waveforms don't look/sound quite right even though the spectrum input is per the formula for synthesising a sawtooth wave.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how do I generate a spectrum array of complex values for an IFFT when all I have are the magnitude values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that bin 0 and 1 are zero valued. I've been trying to render the wave by only calculating the magnitudes and phases for the significant bins (bins with magnitude &gt; 0). &#xA;Am I able to put white noise in the remaining magnitude bins and then calculate the accompanying phases at the centre frequency or alternatively calculate these non significant bins  as random phase?  my start phase is -90, bin size 1024, complex fft.   Thanks in advance for your contribution.&lt;/p&gt;&#xA;" OwnerUserId="16389" LastActivityDate="2015-07-03T05:29:07.920" Title="IFFT Synthesis from an empty spectrum" Tags="|fft|ifft|signal-synthesis|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24364" PostTypeId="1" AcceptedAnswerId="24374" CreationDate="2015-06-25T13:04:50.317" Score="0" ViewCount="681" Body="&lt;p&gt;Following relationship between magnitude response and phase response for minimum phase:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/y9MTy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have implemented in C++ code using the Hilbert Transform C code from file found online &lt;a href=&quot;http://www.physionet.org/physiotools/apdet/apdet-1.0/ht.c&quot; rel=&quot;nofollow noreferrer&quot;&gt;ht.c&lt;/a&gt;. However, I am not getting the phase response as expected. My magnitude response follows raised cosine formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sqeLY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&#xA;Essentially I provide $|H(j\omega)| = \text{Gain}(f)$ to be all real values as per this cosine formula. The phase response is not as expected. Also, how am I suppose to handle $\log(|H(i\omega)|)$ when $|H(i\omega)| = 0$? Am I missing any steps to obtain phase response in this process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how phase and magnitude response should look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/0Rmor.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="15718" LastEditDate="2015-06-25T18:08:27.020" LastActivityDate="2015-06-25T19:47:50.087" Title="Filters - Hilbert Transform and Absolute Value of Magnitude Response" Tags="|filters|dsp-core|hilbert-transform|" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="24366" PostTypeId="2" ParentId="24355" CreationDate="2015-06-25T14:26:59.493" Score="1" Body="&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Matlab can't handle symbolic calculations by itself. You need to use a symbolics-capable package, such as Matlab's own symbolic toolbox, Sage, SymPy, Maple, Mathematica, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; No, it is not correct. The sequence of -1 and 1 is a sequence of symbols, but what is actually transmitted over the channel is an analog signal. Between the symbols and the channel you need a pulse-shaping filter, which determines the transmitted signal's bandwidth and spectral characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; The receive process will depend on the channel's frequency response. Say your transmitted signal has bandwidth $B$. If the channel response is (mostly) flat over that bandwidth, then the channel doesn't distort the signal and you can recover the information present in the signal by matched filtering. On the other hand, if the channel's response is not flat, then the signal will be distorted. In this case, you can perform channel equalization followed by matched filtering. A channel equalizer is a filter that is the &quot;inverse&quot; of the channel; the equalizer's output is an undistorted signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used a few concepts without explaining them, like pulse shaping and matched filtering. There are already many answers in this site regarding those concepts. If you need further help with these, please leave a comment.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-06-25T14:26:59.493" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24367" PostTypeId="1" AcceptedAnswerId="24371" CreationDate="2015-06-25T15:59:38.883" Score="0" ViewCount="1576" Body="&lt;p&gt;I'm working on a audio Equalizer, and I'm not sure if the way I obtain the power per octave of my signal is good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I have :&lt;br&gt;&#xA;&lt;em&gt;(I use the &lt;a href=&quot;http://www.engineeringtoolbox.com/octave-bands-frequency-limits-d_1602.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;third octave bands&lt;/a&gt;, which is initialized earlier in the program)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void    Record::ProcessData(short* Buffer, size_t BufferSize)&#xA;{&#xA;    /* BufferSize is usualy equal to 131072 */&#xA;    /* Initialize the signal and the Hanning Window */&#xA;    Aquila::SignalSource signal = Aquila::SignalSource(Buffer, BufferSize, 44100);&#xA;    Aquila::HannWindow HannWindow(BufferSize);&#xA;&#xA;    /* FFT */&#xA;    /* The library overload the + operator, so the signal is multiplied with the window */&#xA;    auto fft = Aquila::FftFactory::getFft(BufferSize);&#xA;    Aquila::SpectrumType spectrum = fft-&amp;gt;fft((signal + HannWindow).toArray());&#xA;&#xA;    /* Set the imaginary part to 0 */&#xA;    for (size_t i = 0; i &amp;lt; BufferSize; i++)&#xA;        spectrum[i]._Val[1] = 0;&#xA;&#xA;    /* OctaveRange is a class with the minimum, center and maximum frequency of an octave band */&#xA;    list&amp;lt;OctaveRange&amp;gt;::iterator it;&#xA;    map&amp;lt;double, double&amp;gt; sumMap;&#xA;    double db, f, key;&#xA;&#xA;    /* Initialize the map values to 0 */&#xA;    for (it = thirdOctave.begin(); it != thirdOctave.end(); it++)&#xA;        sumMap[(*it).getCtr()] = 0.0;&#xA;&#xA;    /* The calcul of the power per octave starts from here */&#xA;    for (size_t i = 0; i &amp;lt; (BufferSize / 2); i++)&#xA;    {&#xA;        /* f = frequency at bin i */&#xA;        f = (double(i * 44100) / BufferSize);&#xA;        for (it = thirdOctave.begin(); it != thirdOctave.end(); it++)&#xA;        {&#xA;            key = (*it).getCtr();&#xA;            if (f &amp;gt;= (*it).getMin() &amp;amp;&amp;amp; f &amp;lt; (*it).getMax())&#xA;                sumMap[key] += pow(spectrum[i].real(), 2) + pow(spectrum[i].imag(), 2);&#xA;        }&#xA;    }&#xA;&#xA;    for (it = thirdOctave.begin(); it != thirdOctave.end(); it++)&#xA;    {&#xA;        key = (*it).getCtr();&#xA;        /* db is the power (in dB) per third octave. */&#xA;        db = 20.0 * std::log10(sqrt(sumMap[key]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I record pink noise with this I obtain some &lt;a href=&quot;https://i.stack.imgur.com/3n6IB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;believable values&lt;/a&gt;, but I'm still not sure if this is because the code is good, or if it's a happy coincidence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is simple :&lt;br&gt;&#xA;&lt;strong&gt;Is this the good way to obtain the power per octave band of a signal ?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to ask if something is not clear enough.&lt;br&gt;&#xA;Thanks for your time.  &lt;/p&gt;&#xA;" OwnerUserId="15579" LastEditorUserId="15579" LastEditDate="2015-06-26T12:18:25.277" LastActivityDate="2015-06-26T12:18:25.277" Title="EQ - Calculate the power per Octave of a signal through FFT" Tags="|fft|audio|noise|power-spectral-density|c++|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24368" PostTypeId="1" AcceptedAnswerId="24369" CreationDate="2015-06-25T17:03:49.750" Score="2" ViewCount="2473" Body="&lt;p&gt;This is my discrete time periodic signal, the time resolution of the samples is 0.2ms. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/3t0gV.png&quot; alt=&quot;http://www.sp4comm.org/webversion/livre28x.png&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it's periodic after each 11 samples. So the fundamental period of the signal is 2ms or the fundamental frequency of this sequence is 500Hz. The amplitude of each pulse increases from -5V with unit step to +5V.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I want to find its frequency (which is 500 Hz) by calculating its FFT and plot of FFT spectrum. Please help me. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="16395" LastEditorUserId="128" LastEditDate="2020-03-13T08:50:59.337" LastActivityDate="2020-03-13T08:50:59.337" Title="How to Calculate the Period of the Discrete Time Sequence from Taking Its DFT" Tags="|fft|discrete-signals|dft|periodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24369" PostTypeId="2" ParentId="24368" CreationDate="2015-06-25T17:21:51.453" Score="-1" Body="&lt;p&gt;Sample the signal into MATLAB.&lt;br&gt;&#xA;Apply the &lt;code&gt;fft&lt;/code&gt; function on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot the absolute value of the DFT signal (Its first half of samples).&lt;br&gt;&#xA;Look for its peak, the index number of the peak multiplied by the sampling frequency divided by the number of samples will give the frequency.&lt;br&gt;&#xA;Look at its inverse and your answer will pop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you upload a digital copy of the signal, I will show you in code.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-06-25T17:21:51.453" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24370" PostTypeId="2" ParentId="24346" CreationDate="2015-06-25T17:23:35.537" Score="27" Body="&lt;p&gt;An interest point (key point, salient point) detector is an algorithm that chooses points from an image based on some criterion. Typically, an interest point is a local maximum of some function, such as a &quot;cornerness&quot; metric.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A descriptor is a vector of values, which somehow describes the image patch around an interest point. It could be as simple as the raw pixel values, or it could be more complicated, such as a histogram of gradient orientations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Together an interest point and its descriptor is usually called a local feature. Local features are used for many computer vision tasks, such as image registration, 3D reconstruction, object detection, and object recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Harris, Min Eigen, and FAST are interest point detectors, or more specifically, corner detectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SIFT includes both a detector and a descriptor. The detector is based on the difference-of-Gaussians (DoG), which is an approximation of the Laplacian. The DoG detector detects centers of blob-like structures. The SIFT descriptor is a based on a histogram of gradient orientations.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;SURF is meant to be a fast approximation of SIFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BRISK, like SIFT and SURF, includes a detector and a descriptor. The detector is a corner detector.  The descriptor is a binary string representing the signs of the difference between certain pairs of pixels around the interest point.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-06-25T17:23:35.537" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24371" PostTypeId="2" ParentId="24367" CreationDate="2015-06-25T17:29:00.627" Score="1" Body="&lt;p&gt;Difficult to say without a reference to the library functions and classes that you are using. In general it looks okay (if fairly inefficient).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few things to look at:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Hamming window needs to be multiplied with the signal, not added to it. Whether the code is correct really depends on how the &quot;+&quot; operator for the clasess is defined&lt;/li&gt;&#xA;&lt;li&gt;db() can be 10*log or 20*log, whether you need the sqrt depends again on how its's defined in the library&lt;/li&gt;&#xA;&lt;li&gt;Your octave band filters are bascially &quot;brick wall&quot; filters. Most spectrum analyzers do have a finite slope filters so any one frequency contributes to multiple bands (just by different amounts). Whether that's a problem or not depends on the application&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Re point 3: consider the output of the analyzer when you input a sine wave and slowly sweep the frequency from 1kHz to 2 kHz. With a finite slope filter you will see the energy in the 1 kHz octave band slowly going down and the one in the 2 kHz band slowly coming up. They will be equal when the frequency is 1414 Hz. In your case the 1 kHz octave band energy will be constant and once you reach 1414 Hz all the energy will immediately flip to the 2 kHz band.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-06-25T17:29:00.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24372" PostTypeId="1" AcceptedAnswerId="24373" CreationDate="2015-06-25T19:10:15.730" Score="10" ViewCount="3604" Body="&lt;p&gt;We would like to compute the quantitative relation between analog noise near the LO frequency and the statistics of points found in the IQ plane after IQ demodulation.&#xA;In order to completely understand the question we first give a detailed description of the IQ demodulation system.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;IQ demodulation system&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;An IQ mixer takes signals at high frequency and brings them to lower frequency so they can be more easily processed.&#xA;Figure 1 shows a schematic of an IQ mixer.&#xA;The local oscillator (LO) signal $\cos(\Omega t$) is used to mix the RF signal down to a lower frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mp8KJ.png&quot; alt=&quot;Complete IQ demodulation system&quot;&gt;&#xA;&lt;strong&gt;Figure 1:&lt;/strong&gt; Complete signal processing chain. Microwave frequency signal (and noise) come into the IQ mixer via the RF port. This signal is mixed with a local oscillator (LO) to convert to intermediate frequency signals $I$ and $Q$. The intermediate frequency signals are then filtered to remove the remaining high frequency component (see text) and digitally sampled. Detection of the amplitude and phase of each frequency component is done via discrete Fourier transform in digital logic.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Coherent signal - dc case&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Suppose in the incoming RF signal were $M \cos(\Omega t + \phi)$.&#xA;Then the $I$ and $Q$ signals would be&#xA;\begin{align}&#xA;I(t) &amp;amp;= \frac{M}{2} \cos(\phi) + \frac{M}{2} \cos(2\Omega t + \phi) \\&#xA;Q(t) &amp;amp;= -\frac{M}{2} \sin(\phi) - \frac{M}{2} \sin(2\Omega t + \phi) \, .&#xA;\end{align}&#xA;We pass these signals through low pass filters to remove the $2 \Omega$ terms, yielding&#xA;\begin{align}&#xA;I_F(t) &amp;amp;= \frac{M}{2} \cos(\phi) \\&#xA;Q_F(t) &amp;amp;= -\frac{M}{2} \sin(\phi) \, .&#xA;\end{align}&#xA;As we can see, the dc $I$ and $Q$ voltages can be thought of as the Cartesian coordinates giving the amplitude and phase of the original signal.&#xA;Therefore, the mixer has done its job of allowing us to find the amplitude and phase of a high frequency signal by making only low frequency measurements.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Coherent signal - ac case&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;In practice we usually do not demodulate the RF signal to dc.&#xA;There are several reasons for this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Noise spectral density almost always incraeses sharply at low frequencies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If we want to simultaneously measure the amplitude and phase of several sinusoidal components at different frequencies we cannot directly demodulate to dc in the analog part of the system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As an example related to #2, we might have&#xA;\begin{equation}&#xA;RF(t) = M_1 \cos([\Omega + \omega_1] t + \phi_1 ) + M_2 \cos([\Omega + \omega_2] t + \phi_2) \, .&#xA;\end{equation}&#xA;In order to find the amplitude and phase of both frequency components we must use slightly more complex signal processing.&#xA;The $I_F$ and $Q_F$ wave forms in this case are&#xA;\begin{align}&#xA;I_F(t) &amp;amp;= \frac{M_1}{2} \cos(\omega_1 t + \phi_1) + \frac{M_2}{2} \cos(\omega_2 t + \phi_2) \\&#xA;Q_F(t) &amp;amp;= -\frac{M_1}{2} \sin(\omega_1 t + \phi_1) - \frac{M_2}{2} \sin(\omega_2 t + \phi_2) \, .&#xA;\end{align}&#xA;In order to find both amplitudes and both phases, we need to essentially perform a Fourier transform.&#xA;To do this, we digitize the wave forms, yielding&#xA;\begin{align}&#xA;I_n &amp;amp;= \frac{M_1}{2} \cos(\omega_1 n \delta t + \phi_1) + \frac{M_2}{2} \cos(\omega_2 n \delta t + \phi_2) \\&#xA;Q_n &amp;amp;= - \frac{M_1}{2} \sin(\omega_1 n \delta t + \phi_1) - \frac{M_2}{2} \sin(\omega_2 n \delta t + \phi_2)&#xA;\end{align}&#xA;where $\delta t$ is the digital sampling interval.&#xA;Then, in digital logic we construct the complex series $z_n$ defined by $z_n \equiv I_n + i Q_n$.&#xA;For the signals written above this is&#xA;\begin{equation}&#xA;z_n =&#xA;\frac{M_1}{2} \exp \left( i \left[ \omega_1 n \delta t + \phi_1 \right] \right)&#xA;+ \frac{M_2}{2} \exp \left( i \left[ \omega_2 n \delta t + \phi_2 \right] \right) \, .&#xA;\end{equation}&#xA;If we now, in digital logic, compute the sum&#xA;\begin{equation}&#xA;Z(\omega_k) = \frac{1}{N}\sum_{n=0}^{N-1} z_n e^{-i \omega_k n \delta t}&#xA;\end{equation}&#xA;we recover the amplitude and phase for the component at frequency $\omega_k$.&#xA;For example, if we were to compute $Z(\omega_1)$ we would get $(M_1/2) \exp(i \phi_1)$.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Noise&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;In practice the signal always comes with noise.&#xA;The effect of the noise is to make $Z(\omega)$ a random variable instead of a deterministic value.&#xA;In other words, &lt;em&gt;for each&lt;/em&gt; $\omega$ $Z(\omega)$ is random and will be different &lt;em&gt;for each realization&lt;/em&gt; of the experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can guess from intuition that in the presence of noise $Z(\omega)$ has a circularly symmetric distribution in the IQ plane with mean equal to the deterministic value $(M/2)\exp(i \phi)$.&#xA;The question is what exactly is the statistical distribution of $Z$ in the presence of noise?&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="21075" LastEditDate="2020-04-30T15:51:58.410" LastActivityDate="2020-04-30T15:51:58.410" Title="What is the connection between analog signal to noise ratio and signal to noise ratio in the IQ plane in a quadrature demodulation system?" Tags="|noise|demodulation|snr|statistics|quadrature|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24373" PostTypeId="2" ParentId="24372" CreationDate="2015-06-25T19:10:15.730" Score="10" Body="&lt;p&gt;Because each step in the processing chain is linear we consider a case with only noise and no coherent signal.&#xA;Denote the noise $\xi(t)$.&#xA;The $I$ and $Q$ signals are&#xA;\begin{align}\&#xA;I(t) &amp;amp;= \xi(t) \cos(\Omega t) \\&#xA;Q(t) &amp;amp;= - \xi(t) \sin(\Omega t) \, .&#xA;\end{align}&#xA;We express the effect of the filter as a convolution with the time response function $h$,&#xA;\begin{equation}&#xA;I_F(t) = \int_{-\infty}^\infty dt' \, \xi(t') \cos(\Omega t') h(t - t')&#xA;\end{equation}&#xA;and similarly for $Q_F$.&#xA;Note that, because the filter is causal, $h(t)=0$ for $t&amp;lt;0$.&#xA;The sampling simply selects the value of $I_F$ and $Q_F$ at the times $\{ n \delta t \}$,&#xA;\begin{equation}&#xA;I_n = \int_{-\infty}^\infty dt' \, \xi(t') \cos(\Omega t') h(n \delta t - t')&#xA;\end{equation}&#xA;and similarly for $Q_n$.&#xA;Following the construction described above for the digital part of the processing chain we have&#xA;\begin{equation}&#xA;Z(\omega) =&#xA;\frac{1}{N}\sum_{n=0}^{N-1} \int_{-\infty}^\infty dt' \, \xi(t') e^{-i \Omega t'} h(n \delta t - t') e^{-i \omega n \delta t} \, .&#xA;\end{equation}&#xA;Our problem is therefore to compute the statistics of this expression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing variables $n \delta t - t' \rightarrow t'$ produces&#xA;\begin{equation}&#xA;Z(\omega) = \frac{1}{N} \sum_{n=0}^{N-1} \int_{-\infty}^\infty dt' \, \xi(n \delta t - t') e^{-i \Omega (n \delta t - t')} h(t') e^{-i \omega n \delta t}  \, .&#xA;\end{equation}&#xA;At this stage we can do a sanity check by computing the average value of $Z(\omega)$.&#xA;Remember, this is an &lt;em&gt;ensemble&lt;/em&gt; average.&#xA;In other words, we are computing the average value of $Z(\omega)$ which we would find by converting many instances of demodulated noise into IQ points and then taking the mean of all those points.&#xA;In any case, the result is&#xA;\begin{align}&#xA;\langle Z(\omega) \rangle&#xA;&amp;amp;= \frac{1}{N} \sum_{n=0}^{N-1} \int_{-\infty}^\infty dt' \, \underbrace{\langle\xi(n \delta t - t')\rangle}_0 e^{-i \Omega (n \delta t - t')} h(t') e^{-i \omega n \delta t} \\&#xA;&amp;amp;= 0 \, .&#xA;\end{align}&#xA;This makes sense as we expect the noise should not change the average value of the demodulated IQ point, but should only add some randomness centered about the deterministic value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know how to compute the statistics of $Z(\omega)$ directly, so we take an alternative approach by computing instead the mean square of $Z(\omega)$.&#xA;By the &lt;a href=&quot;https://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;noreferrer&quot;&gt;central limit theorem&lt;/a&gt; the real and imaginary parts of $Z$ should be at least approximately Guassian distributed (and, as we'll point out, uncorrelated) so finding the mean square modulus of $Z$ actually tell us all we need to know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We proceed by directly constructing $|Z(\omega)|^2$ and taking the statistical average (statistical average is denoted by $\langle \cdot \rangle$).&#xA;\begin{align}&#xA;\langle \left| Z(\omega) \right| ^2 \rangle&#xA;&amp;amp;= \int_{-\infty}^\infty \int_{-\infty}^\infty dt' \, dt'' \, \frac{1}{N^2} \sum_{n,m=0}^{N-1} \nonumber \\&#xA;&amp;amp; e^{i\Omega (t' - t'')} h(t') h(t'') \langle \xi(n\delta t - t') \xi(m\delta t - t'') \rangle e^{-i(\Omega + \omega)(n - m)\delta t} \, . \qquad (*)&#xA;\end{align}&#xA;We now use the Wiener-Khinchin theorem which says that for a stationary stochastic process $\xi(t)$ the statistical average $\langle \xi(\tau) \xi(0) \rangle$  is related to the power spectral density $S_\xi$ via the following equation:&#xA;\begin{equation}&#xA;\langle \xi(\tau) \xi(0) \rangle = \frac{1}{2}\int_{-\infty}^\infty \frac{d\omega}{2\pi} S_\xi(\omega) e^{i \omega \tau} \, .&#xA;\end{equation}&#xA;Using this formula for $\langle \xi(n\delta t - t') \xi(m\delta t - t'')$ yields&#xA;\begin{align}&#xA;\langle|Z(\omega)|^2 \rangle&#xA;&amp;amp;= \frac{1}{2} \int_{-\infty}^\infty \int_{-\infty}^\infty dt' \, dt'' \, \int_{-\infty}^\infty \frac{d\omega'}{2\pi}\frac{1}{N^2} \sum_{n,m=0}^{N-1} \nonumber \\&#xA;&amp;amp; e^{i\Omega (t' - t'')} h(t') h(t'') S_\xi(\omega') e^{i\omega' ((n-m)\delta t - (t' - t''))} e^{-i(\Omega + \omega)(n - m)\delta t} \\&#xA;&amp;amp;= \frac{1}{2} \int_{-\infty}^\infty \frac{d\omega'}{2\pi} |h(\omega' - \Omega)|^2 S_\xi(\omega') \left| \frac{1}{N} \sum_{n=0}^{N-1} e^{-i(\Omega + \omega - \omega') n \delta t} \right|^2 \\&#xA;&amp;amp;= \frac{1}{2N} \int_{-\infty}^\infty \frac{d\omega'}{2\pi} |h(\omega' - \Omega)|^2 S_\xi(\omega') \underbrace{&#xA;\frac{1}{N} \left( \frac{\sin([\Omega + \omega - \omega'] \delta t N / 2)}{\sin([\Omega + \omega - \omega']\delta t / 2)} \right)^2&#xA;}_{N^{\text{th}}\text{ order Fejer kernel}} \\&#xA;&amp;amp;= \frac{1}{2N} \int_{-\infty}^\infty \frac{d\omega'}{2\pi} |h(\omega' - \Omega)|^2 S_\xi(\omega') \mathcal{F}_N([\Omega + \omega - \omega'] \delta t / 2) \\&#xA;\end{align}&#xA;where $\mathcal{F}_N$ is the $N^{\text{th}}$ order &lt;a href=&quot;https://en.wikipedia.org/wiki/Fej%C3%A9r_kernel&quot; rel=&quot;noreferrer&quot;&gt;Fejer kernel&lt;/a&gt;.&#xA;Changing variables $\Omega - \omega' \rightarrow \omega'$ we get&#xA;\begin{equation}&#xA;\langle |Z(\omega)|^2 \rangle =&#xA;\frac{1}{2N} \int_{-\infty}^\infty \frac{d\omega'}{2\pi} |h(-\omega')|^2 S_\xi(\Omega - \omega') \mathcal{F}_N([\omega' + \omega]\delta t / 2) \, .&#xA;\end{equation}&#xA;So far the results have been exact and precise results can be found by numeric evaluation of the integrals.&#xA;We now make a series of relatively weak assumptions to arrive at a practical formula.&#xA;The Fejer kernel $\mathcal{F}_N(x)$ has weight concentrated near $x=0$.&#xA;Therefore, we integrate over $S_\xi$ only for frequencies near $\Omega$ and so, in this integral, we can approximate $S_\xi$ as a constant $S(\Omega - \omega') \approx S_\xi(\Omega)$, giving&#xA;\begin{equation}&#xA;\langle |Z(\omega)|^2 \rangle =&#xA;\frac{1}{2N} S_\xi(\Omega) \int_{-\infty}^\infty \frac{d\omega'}{2\pi} |h(-\omega')|^2 \mathcal{F}_N([\omega' + \omega]\delta t / 2) \, .&#xA;\end{equation}&#xA;We can already see here that the noise statistics of the demodulated IQ point depends only on the RF spectral density near the LO frequency.&#xA;This makes sense; the IQ mixer is designed to take signal content near the LO frequency and bring it down to a lower IF where it can be processed.&#xA;The anti-aliasing filters remove all frequency components which are too far away from the LO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first null of $\mathcal{F}_N(x)$ occurs at $x = 2\pi / N$, and most of the weight is contained in the first few lobes.&#xA;The first nulls are therefore at&#xA;\begin{equation}&#xA;\frac{\omega'_{\text{null}}}{2\pi}&#xA;= - \frac{\omega}{2\pi} \pm \frac{1}{N \delta t} \, .&#xA;\end{equation}&#xA;This means that the integral over $\omega'$ is dominated by frequencies in a range given by the sampling frequency divided by $N$.&#xA;In most practical applications this range is so small that $h(\omega)$ is roughly constant over this range.&#xA;If that's the case, we can replace $h(-\omega')$ with $h(\omega)$ (note that $h(-\omega) = h(\omega)$) finding&#xA;\begin{align}&#xA;\langle |Z(\omega)|^2 \rangle&#xA;&amp;amp;= \frac{1}{2N}S_\xi(\Omega)|h(\omega)|^2&#xA;\underbrace{&#xA;\int_{-\infty}^\infty \frac{d\omega'}{2\pi} \mathcal{F}_N([\omega' + \omega] \delta t / 2 N)&#xA;}_{1 / \delta t} \\&#xA;&amp;amp;= \frac{S_\xi(\Omega)}{2 T} |h(\omega)|^2&#xA;\end{align}&#xA;where $T \equiv N \delta t$ is the total measurement time.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Signal to noise ratio&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;It is reasonably well known that if a random variable $Z$ has Gaussian  and independently distributed real and imaginary parts, and has average squared modulus $R$, then the distributions of the real and imaginary parts of that variable have standard deviation $\sqrt{R/2}$.$^{[a]}$&#xA;Therefore, taking our result for $\langle |Z(\omega)|^2 \rangle$, our observation that the real and imaginary parts of $Z$ are Gaussian distributed, and the fact that they're uncorrelated,$^{[b]}$ we know that the standard deviations of the distributions of the real and imaginary parts are&#xA;\begin{equation}&#xA;\sigma = \sqrt{S_\xi(\Omega) |h(\omega)|^2 / 4 T} \, .&#xA;\end{equation}&#xA;As discussed at the beginning, a signal $M \cos([\Omega + \omega] t + \phi)$ becomes $(M/2)e^{i \phi}$ in the IQ plane.&#xA;Of course there we ignored the effect of the filter which is simply to scale the amplitude to&#xA;\begin{equation}&#xA;Z(\omega) = \frac{M |h(\omega)|}{2} e^{i \phi} \, .&#xA;\end{equation}&#xA;Suppose, as illustrated in Figure 2, we are using the IQ demodulation system to distinguish between two or more signals, each with a different phase but with all the same amplitude $M$.&#xA;Due to the noise, each of the possible amplitude/phases leads to a cloud of points in the IQ plane with radial distance $M |h(\omega)|/2$ from the origin.&#xA;The distance between two clouds' centers is $g(M/2)|h(\omega)|$ where $g$ is a geometrical factor which depends on the phases of the clouds.&#xA;If the arc angle between two clouds is $\theta$ and each cloud's center is equidistant from the origin then $g = 2 \sin(\theta / 2)$.&#xA;For example, if the two phases are $\pm\pi/2$ then $g=2 \sin(\pi/2) = 2$.&#xA;Geometrically this is because the distance between the clouds' centers is twice bigger than the distance of either cloud from the origin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal to noise ratio (SNR) is&#xA;\begin{align}&#xA;\text{SNR}&#xA;&amp;amp; \equiv \frac{\text{separation}^2}{2 \times (\text{cloud std deviation})^2} \\&#xA;&amp;amp;= \frac{(g M |h(\omega)|/2)^2}{2 S_\xi(\Omega) |h(\omega)|^2 / 4T} \\&#xA;&amp;amp;= \frac{(g M)^2 T}{2 S_\xi(\Omega)}\\&#xA;&amp;amp;= \frac{g^2 P T}{S_\xi(\Omega)} \, .&#xA;\end{align}&#xA;where $P \equiv M^2/2$ is the incoming analog power.&#xA;Note that the SNR does not depend on $h$.&#xA;To remember this result, note that the noise power is the spectral density multiplied by a bandwidth $B$.&#xA;Taking $B = 1/T$ we see that our result just says that the SNR in the IQ plane is exactly equal to the analog SNR multiplied by the geometrical factor $g^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5E7uP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Two IQ clouds. The separation between the clouds' centers is proportional to their radial magnitude $M$, but scaled by a geometrical factor $g$. Projected onto the line connecting their centers, each cloud becomes a Gaussian distribution with width $\sqrt{S_\xi(\Omega)|h(\omega)|^2/4T}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[a]$: Look up the &lt;a href=&quot;https://en.wikipedia.org/wiki/Chi-squared_distribution&quot; rel=&quot;noreferrer&quot;&gt;chi square distribution&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[b]$: We can see that the real and imaginary parts of $Z$ are in fact uncorrelated by writing the equivalent of equation $(*)$ but for $\langle \Re Z \Im Z \rangle$. Doing this we'd find that the sum which turned into the Fejer kernel in the case for $\langle |Z|^2 \rangle$ would go to zero (at least approximately) because it would be roughly the overlap of a sine and cosine, which are orthogonal.&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="7361" LastEditDate="2015-10-15T00:06:53.733" LastActivityDate="2015-10-15T00:06:53.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24374" PostTypeId="2" ParentId="24364" CreationDate="2015-06-25T19:39:14.437" Score="1" Body="&lt;p&gt;Neb, i dunno where you got that frequency response expression from, but it's flawed.  from the description (of parameters like $W$ in &quot;octaves&quot;), it should be like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Gain(f) = \begin{cases}&#xA;10^{Boost/20} \times \frac{1}{2}\left\{1 + \cos\left(\pi \frac{\log_2(f/F_c)}{W} \right) \right\}, &amp;amp; \text{if }|\log_2(f/F_c)|&amp;lt;W \\&#xA;0, &amp;amp; \text{otherwise } \end{cases} $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-06-25T19:47:50.087" LastActivityDate="2015-06-25T19:47:50.087" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24375" PostTypeId="1" AcceptedAnswerId="24376" CreationDate="2015-06-26T01:54:03.050" Score="14" ViewCount="34876" Body="&lt;p&gt;I have a MATLAB program that uses &lt;code&gt;fft&lt;/code&gt; and &lt;code&gt;ifft&lt;/code&gt; a lot. Now I want to translate it to C++ for production. I used OpenCV but I noticed that OpenCV's implementation of &lt;code&gt;fft&lt;/code&gt; is 5 times slower than MATLAB's. Then I tried armadillo but it was even slower. It was 10 times slower than MATLAB. Now I wonder is there any implementation of &lt;code&gt;fft&lt;/code&gt; in C++ that is fast enough to compete with MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="16402" LastEditorUserId="10650" LastEditDate="2015-06-26T15:38:38.110" LastActivityDate="2023-07-22T20:11:37.653" Title="Fastest implementation of fft in C++?" Tags="|fft|fourier-transform|c++|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24376" PostTypeId="2" ParentId="24375" CreationDate="2015-06-26T06:57:28.427" Score="13" Body="&lt;p&gt;Matlab's fft functions are all based on &lt;a href=&quot;http://www.fftw.org/&quot;&gt;FFTW&lt;/a&gt; (this is confirmed &lt;a href=&quot;http://nl.mathworks.com/help/matlab/ref/fft.html#moreabout&quot;&gt;here&lt;/a&gt;), so I guess the obvious choice for you should be FFTW. FFTW is hardware-independent but it can take advantage of some hardware-specific features.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-26T06:57:28.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24377" PostTypeId="2" ParentId="24367" CreationDate="2015-06-26T07:53:09.107" Score="0" Body="&lt;p&gt;You are setting the imaginary part of your spectrum to 0, so when you calculate the power here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; sumMap[key] += pow(spectrum[i].real(), 2) + pow(spectrum[i].imag(), 2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it's just the squared real part. I don't see any reason for this in your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you could save yourself a sqrt() in each bin and just do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;db = 10.0 * std::log10(sumMap[key]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Those points aside, the general approach is sound. Parseval's theorum backs this up. Although, as Hilmar stated, usually fractional octave band filters in analysers are not brick wall filters.&lt;/p&gt;&#xA;" OwnerUserId="16404" LastActivityDate="2015-06-26T07:53:09.107" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24378" PostTypeId="1" AcceptedAnswerId="24379" CreationDate="2015-06-26T08:16:20.070" Score="1" ViewCount="197" Body="&lt;p&gt;I need to&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;read a &lt;code&gt;.wav&lt;/code&gt; file&lt;/li&gt;&#xA;&lt;li&gt;make a 2D matrix from it using the STFT&lt;/li&gt;&#xA;&lt;li&gt;generate its singular value decomposition&lt;/li&gt;&#xA;&lt;li&gt;do some watermarking&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;but I can't build the original matrix again via matrix multiplication:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; x = audioread('0.wav');&#xA; stft = spectrogram(x); &#xA; [U,S,V] = svd(stft);&#xA; stftb=U*S*V.';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that STFT and STFTb are not the same.&lt;/p&gt;&#xA;" OwnerUserId="16405" LastEditorUserId="21075" LastEditDate="2016-10-17T11:28:08.083" LastActivityDate="2016-10-17T11:28:08.083" Title="Could not construct original matrix using SVD" Tags="|matlab|stft|spectrogram|svd|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24379" PostTypeId="2" ParentId="24378" CreationDate="2015-06-26T09:55:17.760" Score="3" Body="&lt;p&gt;Don't have enough reputation to comment but you need to use the conjugate transpose in your formula for the result to be correct. So try &lt;code&gt;stftb=U*S*V';&lt;/code&gt; in the last line of code. Note that I removed the &lt;code&gt;.&lt;/code&gt; which makes a difference since the matrices you are working with are complex.    &lt;/p&gt;&#xA;" OwnerUserId="10646" LastActivityDate="2015-06-26T09:55:17.760" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24380" PostTypeId="2" ParentId="24367" CreationDate="2015-06-26T10:47:09.163" Score="0" Body="&lt;p&gt;If setting the imaginary part to zero does not make much difference, it's coincidental.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a page with some discussion of how to sum the FFT bins for octave analysis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mstarlabs.com/docs/tn257.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mstarlabs.com/docs/tn257.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more sophisticated way to sum the FFT bins to get the octave band amplitudes is to use the constant Q transform.  You can find references on the Wikipedia page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Constant_Q_transform&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Constant_Q_transform&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference 3 has the math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &quot;traditional&quot; method you apply a filter bank for the top octave, decimate by 2, apply the same filter bank to the top octave of the result, and so on.  For a MATLAB implementation and references see (PDF) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.57.5728&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.57.5728&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="16283" LastActivityDate="2015-06-26T10:47:09.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24382" PostTypeId="2" ParentId="24375" CreationDate="2015-06-26T12:48:33.390" Score="4" Body="&lt;p&gt;I second the fftw suggestion. One of the nice features of fftw is &quot;wisdom&quot;. That is, if you call many times the same Fourier Transform (with the same array size), you can ask fftw to look for the fastest way to do it, and then it will use that way for all the following computation in your code.&lt;/p&gt;&#xA;" OwnerUserId="15001" LastActivityDate="2015-06-26T12:48:33.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24384" PostTypeId="2" ParentId="16939" CreationDate="2015-06-26T14:38:48.310" Score="2" Body="&lt;p&gt;Do not underestimate the power of 1 kHz sine wave at 0 dBFS. In mono. A lot of things that are wrong with signal paths can be found with that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've built and calibrated enough audio systems that I can whistle 1 kHz pretty exactly. From simple memory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, I.G.Y by Donald Fagen is so popular as test track that it's been forbidden by a number of festivals. &lt;/p&gt;&#xA;" OwnerUserId="16410" LastEditorUserId="7092" LastEditDate="2015-06-26T15:38:16.290" LastActivityDate="2015-06-26T15:38:16.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24386" PostTypeId="1" CreationDate="2015-06-26T18:15:39.020" Score="0" ViewCount="441" Body="&lt;p&gt;By negative frequency, I refer to Fourier transform. Often, the frequency response of a digital filter is only displayed for positive frequencies. For a linear IIR digital filter, what happens for negative frequencies? Are frequency response for negative frequencies mirror images of what happens for positive frequencies?&lt;/p&gt;&#xA;" OwnerUserId="16413" LastActivityDate="2015-06-28T02:54:55.773" Title="For linear IIR digital filter, what happens for negative frequencies?" Tags="|filters|discrete-signals|z-transform|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24387" PostTypeId="2" ParentId="24375" CreationDate="2015-06-26T18:24:27.690" Score="3" Body="&lt;p&gt;There's also FFTS (written in C, not C++, though), which has some impressive benchmarks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/anthonix/ffts&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/anthonix/ffts&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I compiled it under Linux, but haven't had a chance to play with it yet.&lt;/p&gt;&#xA;" OwnerUserId="16283" LastEditorUserId="80" LastEditDate="2019-10-30T13:50:54.770" LastActivityDate="2019-10-30T13:50:54.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24388" PostTypeId="2" ParentId="24386" CreationDate="2015-06-26T19:27:01.953" Score="3" Body="&lt;p&gt;It may be easier to start with analog signals. If the filter's impulse response $h(t)$ is real, then its frequency response $H(f)$ is conjugate symmetric: $H(-f)=H^*(f)$, where $(\cdot)^*$ indicates complex conjugate. Since $H(f)=|H(f)|e^{j\angle H(f)}$, then conjugate symmetry implies that $|H(f)|=|H(-f)|$ and $\angle H(f) = - \angle H(-f)$. This is true for any kind of filter, FIR or IIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if the filter input $x(t)$ is $$x(t)=A_0\cos(2\pi f_0t+\phi_0)=\frac{A_0}{2}\left(e^{j2\pi f_0t}e^{j\phi_0}+e^{-j2\pi f_0t}e^{-j\phi_0}\right),$$ then the filter output is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{align*}&#xA;y(t) &amp;amp;= \frac{|H(f_0)|A_0}{2}\left(e^{j2\pi f_0t}e^{j(\phi_0+\angle H(f_0))}+e^{-j2\pi f_0t}e^{-j(\phi_0+\angle H(f_0)}\right) \\&#xA;&amp;amp;= |H(f_0)|A_0\cos\left(2\pi f_ot+\phi_0+\angle H(f_0)\right).&#xA;\end{align*}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the amplitude of negative frequencies are affected exactly the same as positive frequencies. The phases are affected in a similar fashion, but with phase of opposite sign for negative frequencies. Note that this is necessary to preserve the symmetries that real signals have in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of discrete signals and filters, the conclusion regarding negative frequencies is the same. Finding the actual gain and phase at a particular frequency is slightly more difficult, though. The reason is that the DFT of the filter's impulse response defines the filter's gain and phase only at a finite number of frequencies. In general, the filter's gain and phase at an arbitrary frequency $f_0$ can be found by evaluating the filter's transfer function at $z=e^{j2\pi f_0}\,$.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-06-28T02:54:55.773" LastActivityDate="2015-06-28T02:54:55.773" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24390" PostTypeId="1" AcceptedAnswerId="24392" CreationDate="2015-06-27T09:19:26.403" Score="5" ViewCount="1778" Body="&lt;p&gt;Suppose I compute phase spectrum from the fftn function in MATLAB as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image1=imread('cameraman.tif');&#xA;figure,imshow(image1);&#xA;&#xA;&#xA;fourier_transform=fft2(image1);%take fourier transform of gray scale image&#xA;&#xA;phase_spectrum=exp(1j*angle(fourier_transform));&#xA;imshow(phase_spectrum, [])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here, by using &lt;code&gt;imshow(phase_spectrum,[])&lt;/code&gt;  we first&#xA;discard the imaginary part and then normalize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But why do we discard the imaginary part of the phase spectrum ? Whether it's spectrum  is same as real part with 90 degree phase shift ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it not useful ? Also,what should be done to get whole phase spectrum not just real part of it?&lt;/p&gt;&#xA;" OwnerUserId="15042" LastEditorUserId="8140" LastEditDate="2015-06-29T05:32:35.020" LastActivityDate="2015-06-29T05:32:35.020" Title="Why do we discard imaginary part of the phase spectrum?" Tags="|matlab|fft|fourier-transform|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24391" PostTypeId="1" CreationDate="2015-06-27T10:08:03.600" Score="3" ViewCount="4900" Body="&lt;p&gt;How do i determine which FIR filter (LP, HP, BS, BP) it is from looking at it's z-plane plot?&lt;/p&gt;&#xA;" OwnerUserId="16417" LastActivityDate="2015-06-30T22:56:59.493" Title="Determining which Filter from a Z-Plane Plots?" Tags="|infinite-impulse-response|z-transform|finite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24392" PostTypeId="2" ParentId="24390" CreationDate="2015-06-27T11:05:46.703" Score="2" Body="&lt;p&gt;Phase spectrum by itself is a real function of frequency and, therefore, does not contain any imaginary parts. It is the fourier transform which is in general a complex function of frequency, henceforth, may include real and imaginary parts. But neither the magnitude spectrum nor the phase spectrum contain(s) any imaginary parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase spectrum is a real function. Whatever methods/functions (correct or not) you use to obtain it does not and shall not change this fact. $H(e^{j\omega}) = |H(e^{j\omega})| e^{j\phi(w)} $ where the $\phi(w)$ contains the phase spectrum and the absolute value part is the magnitude spectrum. Both are real. You shall use a proper function and method in your environment to obtain those signals from $H(e^{j\omega})$&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-06-27T12:39:16.430" LastActivityDate="2015-06-27T12:39:16.430" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24393" PostTypeId="2" ParentId="24353" CreationDate="2015-06-27T13:35:16.060" Score="2" Body="&lt;p&gt;Interesting paper!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: yes, seems like OLS, non-blind. Usually OLS is non-blind. Some sort of regulated least squares can be used in a bayesian ML-setting, blind. This paper looks interesting: &lt;a href=&quot;http://www.cs.berkeley.edu/~jordan/papers/lindsten-etal-sysid12.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.berkeley.edu/~jordan/papers/lindsten-etal-sysid12.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: PBRS: &lt;a href=&quot;https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence&lt;/a&gt;. There is a lot of literature on this, e.g. Coleman Brosilow, Babu Joseph, &quot;Techniques of Model-Based Control&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q3:they say it is semi-blind since the dynamics of the sequence generator is known.&lt;/p&gt;&#xA;" OwnerUserId="15215" LastEditorUserId="15215" LastEditDate="2015-06-27T22:05:36.997" LastActivityDate="2015-06-27T22:05:36.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24394" PostTypeId="1" AcceptedAnswerId="24396" CreationDate="2015-06-27T16:50:48.890" Score="0" ViewCount="84" Body="&lt;p&gt;How is it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking of taking just the real part of the DFT of my signal (isn't that zeroing out phases?) with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;real(fft(X))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but the magnitudes of that result don't match :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;abs(real(fft(X))) != abs(fft(X))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="16418" LastActivityDate="2015-06-27T17:46:35.930" Title="zero-phasing frequency components while keeping the same magnitude, in Matlab" Tags="|matlab|fft|dft|phase|magnitude|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24395" PostTypeId="1" CreationDate="2015-06-27T16:56:24.250" Score="1" ViewCount="106" Body="&lt;p&gt;I am new to Kalman and trying to use it for a particle tracking technique for velocity measurments in Multiphase systems. I have particle locations but there are error associated with these locations. Can use of Kalman Filter be useful in reducing error in this case?&lt;/p&gt;&#xA;" OwnerUserId="16419" LastActivityDate="2015-06-27T16:56:24.250" Title="Kalman Filter for particle tracking" Tags="|kalman-filters|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24396" PostTypeId="2" ParentId="24394" CreationDate="2015-06-27T17:46:35.930" Score="1" Body="&lt;p&gt;it is obvious that abs(real(fft(x)))!=abs(fft(x)) since you are removing the imaginary part while taking the real function.One way if you want a signal with all dft components being real.Is to normal to just take abs(fft(x)) as the spectrum itself rather than taking the real components.In this you maintain the magnitude and all the components have zero phase.I hope this answers your question  &lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-06-27T17:46:35.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24397" PostTypeId="1" CreationDate="2015-06-27T20:18:26.397" Score="0" ViewCount="626" Body="&lt;p&gt;I read a similar &lt;a href=&quot;https://dsp.stackexchange.com/questions/22336/whats-the-best-technique-to-determine-if-the-contents-of-two-images-are-the-sam&quot;&gt;question&lt;/a&gt;, but I'm not sure the techniques discussed will help me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take for example the two following images: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fJTNk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HboQH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to determine if the above images are sourced from the same image as well as whether the objects in the following image are the same or similar enough to safely consider them the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TxzxA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&#xA;Joe&lt;/p&gt;&#xA;" OwnerUserId="16422" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-06-28T08:26:56.043" Title="What's the best way to compare the same object from different &quot;crops&quot; or angles within multiple images?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24401" PostTypeId="2" ParentId="24375" CreationDate="2015-06-28T08:26:17.303" Score="2" Body="&lt;p&gt;The two that I see being used most often are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ooura FFT: &lt;a href=&quot;http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html&quot; rel=&quot;nofollow&quot;&gt;http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IPP: &lt;a href=&quot;https://software.intel.com/en-us/intel-ipp&quot; rel=&quot;nofollow&quot;&gt;https://software.intel.com/en-us/intel-ipp&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to pay for a license for IPP (Intel Performance Primatives) but it would be the tool of choice for a commercial offering. Ooura FFT has good all round performance and a permissive license. On a MAC I believe Apple has a free FFT routine which offers performance comparable to IPP/FFTW.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beware relying on benchmarks many are out of date or focus too heavily on certain use cases which may or may not apply to your use case.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastActivityDate="2015-06-28T08:26:17.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24402" PostTypeId="2" ParentId="24397" CreationDate="2015-06-28T08:26:56.043" Score="1" Body="&lt;p&gt;There are many ways to achieve this. You could use an image based, direct similarity metric such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Sum_of_absolute_differences&quot; rel=&quot;nofollow&quot;&gt;Sum of Absolute Distances&lt;/a&gt;, Sum of Squared Distances or &lt;a href=&quot;http://de.mathworks.com/help/images/examples/registering-an-image-using-normalized-cross-correlation.html&quot; rel=&quot;nofollow&quot;&gt;Normalized Cross Correlation&lt;/a&gt;. For a general overview look &lt;a href=&quot;https://siddhantahuja.wordpress.com/tag/sum-of-squared-differences/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. These approaches generalize to &lt;code&gt;template matching&lt;/code&gt; where a convolutional procedure is conducted, such as the one &lt;a href=&quot;https://en.wikipedia.org/wiki/Template_matching&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Template matching methods could tolerate rigid transformations (rotation, translation) and scaling. However, for the case of affine deformations (e.g. the second image set in the question), they would not suffice. It is then better to benefit from &lt;a href=&quot;https://en.wikipedia.org/wiki/Feature_detection_(computer_vision)&quot; rel=&quot;nofollow&quot;&gt;feature based&lt;/a&gt; matching techniques, where some repeatable keypoints are first extracted from the image, and invariant descriptors of the local neighborhoods are computed and store. This is done for both images. Finally the descriptor are compared using a nearest neighbor search. &lt;a href=&quot;https://en.wikipedia.org/wiki/Scale-invariant_feature_transform&quot; rel=&quot;nofollow&quot;&gt;SIFT&lt;/a&gt; is one of those robust descriptors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, while in the first scenario, the template transformation can be defined simply by a translation, the second case is not like that. You should either solve for &lt;a href=&quot;https://en.wikipedia.org/wiki/Affine_transformation&quot; rel=&quot;nofollow&quot;&gt;affine parameters&lt;/a&gt;, or compute a general perspective &lt;a href=&quot;https://en.wikipedia.org/wiki/Homography&quot; rel=&quot;nofollow&quot;&gt;homography&lt;/a&gt; to represent the pose of the second image w.r.t the first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is very general, and often times analyzed under the roof of &lt;a href=&quot;https://en.wikipedia.org/wiki/Object_detection&quot; rel=&quot;nofollow&quot;&gt;object detection&lt;/a&gt;. You could review this literature and choose a method suited to your problems. &lt;a href=&quot;http://opencv.org/&quot; rel=&quot;nofollow&quot;&gt;OpenCV&lt;/a&gt; implements most of the techniques, I described in this answer.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-06-28T08:26:56.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24403" PostTypeId="1" CreationDate="2015-06-28T09:22:08.843" Score="0" ViewCount="531" Body="&lt;p&gt;I have designed a &lt;a href=&quot;https://en.wikipedia.org/wiki/Cascaded_integrator%E2%80%93comb_filter&quot; rel=&quot;nofollow&quot;&gt;CIC filter&lt;/a&gt; in Verilog and I would like to test its impulse response, but I am not sure where to start from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My input sampling frequency is 51200Hz, the filter is a third order decimating CIC with downsampling ratio = 256, so the output sampling frequency is 200Hz. The differential delay was set to one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input word is one bit wide, while the output will be 16 bits. I have already calculated all the internal registers dimensions and I am satisfied with that, my current Verilog design does not use true registers but integer numbers so that is not a problem anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How am I supposed to compute its impulse response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all there's the problem that the sequence '1000...' is &lt;strong&gt;not&lt;/strong&gt; an impulse, because 1 corresponds to +1 while 0 corresponds to -1. I have solved that doing two simulations, one with '10101010...' and the other with '11010101010...' as input sequences. The impulse response is then half of the sum of the two responses. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I want the frequency magnitude response referred with the output sampling frequency I figured that my input impulse should be 256 high frequency samples wide, is that correct? I have done such a simulation and computed the specter in Matlab, the result is qualitatively satisfying but I have a lot of noise, especially in the low frequency part of the specter. I have also tried some windowing without much luck. I simulated my sistem for about half a second, that's 25000 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I must note that my simulation output gives out samples at an higher non constant rate, I've tried resampling my signal with no luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given my limited experience with digital signal processing I am out of ideas. Is there something fundamentally wrong in my approach? Is it ok but there's something I should poke to get better results?&lt;/p&gt;&#xA;" OwnerUserId="16425" LastActivityDate="2015-07-29T01:26:59.360" Title="Simulating the impulse response of a multirate digital filter" Tags="|impulse-response|multirate|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24404" PostTypeId="2" ParentId="24403" CreationDate="2015-06-28T13:29:27.847" Score="0" Body="&lt;p&gt;You should probably start with floating point filter representation in MATLAB. You can specify it as CIC coefficients vector, $cic = [C0, C1, C2]$ for third order one. Next you need a filtering function, something like $y=cicFilter(cic, x)$, you can find the ready one or write it (if you've already done some HDL code for this filter it won't be difficult to implement proper MATLAB code). So you can specify test vector $x = [0,0,0,...,1,0,0,0...]^T$ and use to find impulse response of your filter (there are coefficients $cic$ to be tested, nothing more). By doing $FFT$ of result $y$ you'll obtain the frequency response evidently. For it's magnitude part it will be a smooth curve, the filter magnitude spectrum with no noise, since no noise is presented at the filter input. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After such simple verification you can start to test your HDL implementation. I'm curious about one bit representation of the input signal since filter is designed to work with signed numbers. So maybe you should represent your input as 2 bits signed number instead of one bit unsigned. Then it's possible to feed your filter with test vector the same as we've used in MATLAB ideal model. This test vector are signed integers truncated to 2 bits signed representation. Then capture the output data, store it and analyze in MATLAB. Its frequency magnitude response must be similar to the ideal one. Plot it in Log scale to see fixed point degradation with respect to floating point ideal representation. Also by varying bit width of the input, output and processing operations at each stage you can look different performance with such a plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-06-28T13:29:27.847" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24410" PostTypeId="1" AcceptedAnswerId="24426" CreationDate="2015-06-29T01:40:51.027" Score="9" ViewCount="3206" Body="&lt;p&gt;There are many question related to the zero padding a time domain signal to get more frequency bins after performing Fourier transform. As I understand this process is equivalent to trigonometric interpolation in the frequency domain. However, I am not certain of this fact. Can anyone verify this correct or incorrect mathematically?&lt;/p&gt;&#xA;" OwnerUserId="15437" LastEditorUserId="4298" LastEditDate="2021-02-09T11:31:34.617" LastActivityDate="2021-02-09T11:31:34.617" Title="Zero Padding of FFT" Tags="|fft|discrete-signals|fourier-transform|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24412" PostTypeId="1" CreationDate="2015-06-29T04:10:17.337" Score="0" ViewCount="98" Body="&lt;p&gt;What are the invertible (preferably linear) representations of an audio/speech signal which captures the essence of signal in different resolutions and details. Basically, I am looking for Laplacian/Gaussian pyramid, not for images, but for audio signals. The interesting aspect of it for me is that it keeps the coarse-level perceptual details and gradually fills in the fine-level perceptual details.&lt;/p&gt;&#xA;" OwnerUserId="16433" LastActivityDate="2015-06-29T04:10:17.337" Title="Invertible multi-resolution representation of audio/speech signals" Tags="|audio|speech-processing|resolution|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24413" PostTypeId="1" AcceptedAnswerId="24415" CreationDate="2015-06-28T20:19:06.423" Score="2" ViewCount="152" Body="&lt;p&gt;Paper: &lt;em&gt;A novel channel equalizer for chaotic digital communication system&lt;/em&gt; (&lt;a href=&quot;http://dx.doi.org/10.1109/ICASSP.1999.756218&quot; rel=&quot;nofollow noreferrer&quot;&gt;DOI&lt;/a&gt;, &lt;a href=&quot;http://www.researchgate.net/publication/3794236_A_novel_channel_equalizer_for_chaotic_digital_communicationssystems&quot; rel=&quot;nofollow noreferrer&quot;&gt;RS link&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having problem in understanding their claim which is that a nonlinear system, considered here to be a chaotic system given by Eq (1)&#xA;$x[n] = f(x[n-1])$ is represented as a symbolic system $x[n] = 0.b_nb_{n+1}...$ where the $b$'s are {0,1} and so a time series in terms of the binary expansion of a number $x[n]$ describes the dynamics of the system. This is explained in Section 2. Then they say that a linear filter of the form Eq(5)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n] = \sum b[n-k]h[k]$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the $b$'s are the information bit sequence and the output $x[n]$, is chaotic. So, this Equation according to them is a way of linearizing the nonlinear dynamics of Eq(1). If this is a linear representation, then how come it is chaotic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to understand how the bits-- $b$'s that they are talking about is generated and how the binary bit sequence can be used as the input&#xA;to the filter of Eq. (5) to get a chaotic data sequence i.e. why &#xA;is this representation chaotic? One of the ways to produce symbolic dynamics of a trajectory of a map is by thresholding explained as: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b[n] = 1, if x[n] &amp;gt;= threshold, otherwise b[n] = 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this how the $b$'s are generated from the same map or these bits are coming from some other source?&lt;/p&gt;&#xA;" OwnerUserId="750" OwnerDisplayName="SKM" LastEditorUserId="26573" LastEditDate="2018-05-06T21:33:42.110" LastActivityDate="2018-05-06T21:33:42.110" Title="On the application of chaos in signal processing" Tags="|digital-communications|equalizer|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="24415" PostTypeId="2" ParentId="24413" CreationDate="2015-06-29T09:38:20.070" Score="2" Body="&lt;p&gt;A typical communications system is composed of the following parts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Message (Information Source) --&amp;gt; Encoding --&amp;gt; Modulation --&amp;gt; Channel --&amp;gt; Demodulation --&amp;gt; Decoding --&amp;gt; Recovered Message&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A &quot;chaotic modulator&quot; is just another way of doing the &lt;code&gt;Modulation&lt;/code&gt; building block. This is depicted in Figure 1 of the paper that is cited in the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input to the &lt;code&gt;Modulator&lt;/code&gt; is a binary sequence and the output of it is a digital (or directly analog, depending on the system) signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, to clarify (rather than answer) the first issue: As per Figure 1, the &lt;code&gt;b&lt;/code&gt;s are essentially your &lt;code&gt;Message&lt;/code&gt; (or &lt;code&gt;Message&lt;/code&gt; after it has been encoded for whatever purpose (e.g. error correction).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical &lt;code&gt;Modulator&lt;/code&gt;'s job is to map binary symbols to &lt;code&gt;carrier symbols&lt;/code&gt; with the carrier signal being one that is suitable for transmission effectively through the &lt;code&gt;Channel&lt;/code&gt;. In a typical system, we can literally see this &lt;strong&gt;mapping&lt;/strong&gt; in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Constellation_diagram&quot; rel=&quot;nofollow&quot;&gt;Constellation Diagram&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a chaotic modulator though, binary symbols are mapped to different states of the chaotic modulator. This is mentioned in the introduction of the paper as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Rather than using structured signals, such as rectangular  pulses or&#xA;  sinusoids, to denote ‘0’s and ‘l’s, these communications systems embed&#xA;  the information in the time evolution, or dynamics, of the transmitted&#xA;  signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A simpler way to think about this is to take some difference equation (such as &lt;code&gt;f&lt;/code&gt;) and produce a few values with some initial condition &lt;code&gt;x0&lt;/code&gt; and a few values for some initial condition &lt;code&gt;x1&lt;/code&gt;. If the two time series are distinct enough, then perhaps it is possible to recover which of the two x0,x1 might have generated this time series. In this case, of going from time series to some initial condition, we are looking at some sort of &lt;code&gt;Demodulator&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, chaotic of not, a difference equation provides a &lt;strong&gt;model&lt;/strong&gt;. A model imposes a set of constraints and some sort of structure to the signal. This is what is exploited here (please keep in mind that we are talking about a pseudo-chaotic system). So, what if I take look at the difference equation and realise that I can express it as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Digital_filter#Analysis_techniques&quot; rel=&quot;nofollow&quot;&gt;typical digital filter&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, to clarify, rather than answer, this is what Drake &amp;amp; Williams did with &quot;Pseudo-chaos for direct sequence spread spectrum communications&quot;. From the paper linked in the question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;More  importantly, Drake  and Williams  [7] have  shown  that the&#xA;  sawtooth  map's  output is equivalent  to the response of a linear&#xA;  filter to a binary sequence.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Having clarified this, it is also important to highlight Figure 2 (and 3 to some extent) from the original paper which shows that by inversing the filtering operation it is effectively possible to do &lt;code&gt;Modulation&lt;/code&gt; and &lt;code&gt;Demodulation&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This, hopefully, clarifies the &quot;representation&quot; missunderstanding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I would like to stress the &lt;strong&gt;pseudo-chaotic&lt;/strong&gt; nature of the generated signal which comes as a result of the modifications that are also explained in section 2, from &quot;In practice this is not a possible because this filter...&quot; (sic) onwards. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to recommend that you take a brief look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Pseudorandom_number_generator&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Pseudo-random&lt;/strong&gt; number generators&lt;/a&gt;, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_congruential_generator&quot; rel=&quot;nofollow&quot;&gt;Linear congruential generator&lt;/a&gt; and finally the &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_feedback_shift_register&quot; rel=&quot;nofollow&quot;&gt;linear feedback shift register&lt;/a&gt; (LSFR) for examples of seemingly linear &quot;representations&quot; that still produce rather complex sequences and then taking a brief look at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dyadic_transformation&quot; rel=&quot;nofollow&quot;&gt;Dyadic Mapping&lt;/a&gt; where it is also mentioned that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The name bit shift map arises because, if the value of an iterate is&#xA;  written in binary notation, the next iterate is obtained by shifting&#xA;  the binary point one bit to the right, and if the bit to the left of&#xA;  the new binary point is a &quot;one&quot;, replacing it with a zero.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In view of additional comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the chaotic map is denoted by the state variable $x$, then these&#xA;  $b$ are the bits. Further, are the $b$′s obtained from the binary&#xA;  expansion of some numeric value of the iterate of chaotic map $x$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is an alternative way to go about this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that this is not a modulator. Ultimately, $x$ is the output from the mapping. We start with some initial value $x_0$ and produce $x_1$ which we send back into the map and get back $x_2$ and again through the map to get $x_3$ and back through it once more to get a $x_4$ and so on to get $x_n$. Since we are operating on a computer with numbers of finite wordlength, $x$ contains &lt;strong&gt;DIGITAL&lt;/strong&gt; values (in the decimal system) with a well defined minimum and maximum. So, if $x$ is a &lt;strong&gt;byte&lt;/strong&gt;, then the min value is 0 and the maximum value is 255.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each one of these $x_n$ &lt;strong&gt;decimal&lt;/strong&gt; values has a binary representation as well. Therefore:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_0$ is equivalent to some binary number $0100101$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_1$ is equivalent to some binary number $1001010$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_2$ is equivalent to some binary number $0010100$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And eventually...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_n$ will be equivalent to some $b_m b_{m+1} b_{m+2} ...$ where some $b \in {0,1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, &lt;strong&gt;it is&lt;/strong&gt; possible to have a binary string of digits (0010001101...) for a &lt;strong&gt;pseudo&lt;/strong&gt;-chaotic sequence $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us now ask the reverse question: What if all we have is the binary sequence. Can we go from the binary sequence to the output it would produce?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, you would have to establish a relationship between the $b$ (binary sequence) and $x$ (decimal sequence / digital signal). It turns out that this is possible via the work of reference 7 as mentioned above, through $h$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To recap and put it in the context of communications:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$b$ is your &lt;code&gt;Message&lt;/code&gt;. If the message was &quot;ABC&quot;, its ASC representation would be 65,66,67 and the binary representation of that would be &quot;010000010100001001000011&quot;. This is your $b$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x$ is the output from the &lt;code&gt;Modulator&lt;/code&gt; with &lt;strong&gt;pseudo&lt;/strong&gt;-chaotic dynamics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h$ is now the tool by which &lt;strong&gt;the map is applied to the data&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please see figures 2,3 in the original paper).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can the convolution of $b$ with impulse give rise to a chaotic&#xA;  map, $x$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again...The input to the modulator is a binary sequence ($b$). Each $b$ is either $0$ or $1$. The output from the modulator is a digital signal ($x$) (decimal values of some wordlength). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take a look at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n] = \sum_{k=-\infty}^{\infty}{b[n-k] \times h[k]}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We realise that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$x$ is a weighted sum of $b$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To produce &lt;strong&gt;one&lt;/strong&gt; $x_n$, we need to sum &lt;strong&gt;many&lt;/strong&gt; bits from $b$. How many? $k$ many.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Obviously, $k$ cannot remain infinity in a practical system. That's where truncation of $h$ comes in.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2015-06-30T08:38:46.997" LastActivityDate="2015-06-30T08:38:46.997" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24417" PostTypeId="1" CreationDate="2015-06-29T11:43:10.413" Score="6" ViewCount="6557" Body="&lt;p&gt;I am new to the subject of Kalman filtering and therefore my question might seem trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that there is a tight connection between Kalman filter and EM algorithm when one wants to predict the next state of a given signal. My question is what is the connection and how we can combine them in the prediction process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16435" LastEditorUserId="16435" LastEditDate="2015-06-29T11:51:00.063" LastActivityDate="2016-03-17T14:28:45.980" Title="EM algorithm and Kalman filter" Tags="|image-processing|filters|discrete-signals|kalman-filters|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24418" PostTypeId="1" CreationDate="2015-06-29T12:15:39.427" Score="0" ViewCount="196" Body="&lt;p&gt;I am trying to delay a signal by a certain number of samples. This certain number, I would like to generate using a random normal distribution in Matlab. I am using the following for generating the number of samples r = randn(1,1)/sampleTime. This however generates negative numbers too. In order to avoid the negative numbers, I am taking the absolute value of r but I know that this is not the right way, since in this case I would be ignoring the left part of the distribution. Is there a way I can use just positive samples without shifting the mean too much? &lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-11-27T02:08:03.727" Title="Delay signal according to normal distribution" Tags="|matlab|signal-analysis|delay|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24419" PostTypeId="2" ParentId="24391" CreationDate="2015-06-29T13:35:32.880" Score="1" Body="&lt;p&gt;You obtain the filter's frequency response by evaluating its transfer function $H(z)$ on the unit circle $z=e^{j\omega}$, where $\omega=2\pi f/f_s$ is the normalized angular frequency, and $f_s$ is the sampling frequency. So DC corresponds to $z=1$, and Nyquist (the maximum frequency) corresponds to $z=\pm\pi$. Since for real-valued filters the magnitude response is symmetric, you only need to consider the upper half of the unit circle, i.e. you look at frequencies $\omega\in[0,\pi]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the pole-zero plot in the $z$-plane, you need to identify the pass bands and the stop bands of the filter. Since you're considering FIR filters, you only have to look at the zeros (the poles are at the origin, or at infinity if the filter is not causal). In the stop band(s), there must be zeros on the unit circle or at least very close to the unit circle to guarantee a reasonable stop band attenuation. In the pass band(s) there mustn't be any zeros very close to the unit circle because you want the filter to pass all frequency components in the pass band. You do get zeros at angles corresponding to the pass band(s), but they are much further away from the unit circle. They are there to guarantee a more or less flat pass band response, and they also determine the phase response in the pass band. If you have a linear phase FIR filter, each zero inside the unit circle must have a mirror image outside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, identify the stop band(s) by finding regions on the unit circle where there are zeros on (or very close to) the circle. All other regions are pass bands. Obviously, a low pass filter must have one stop band extending from some given band edge to Nyquist. A high pass filter has its stop band between DC and some given cut-off frequency. I guess you can figure it out yourself for band pass and band stop filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, the figure below shows a pole-zero plot of a typical linear-phase low pass FIR filter. Note the zeros on the unit circle in the stop band, and the zeros symmetrical to the unit circle in the pass band. Also note that all poles are at the origin since the filter is a causal FIR filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/znZui.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-06-29T13:35:32.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24421" PostTypeId="1" AcceptedAnswerId="24423" CreationDate="2015-06-29T14:56:34.820" Score="0" ViewCount="254" Body="&lt;p&gt;So I have a frequency response (got it by windowed fft-ing) of a note E4 played on a guitar and now I'm trying to implement a dynamic threshold for finding the peaks (fundamental frequency of the note and its harmonics).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found an &lt;a href=&quot;http://xm2vtsdb.ee.surrey.ac.uk/CVSSP/Publications/papers/every-ieee-2006.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; that describes doing it by convolving normalized Hamming window with the frequency response. Now, I've done it, but I just don't know how to plot it correctly as the convoluted signal is delayed for a few samples like this (the red one):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Zp8tk.jpg&quot; alt=&quot;frequency response&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code in Scilab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// plot the frequency response&#xA;x_axis = linspace(0, Fs, row);&#xA;plot(x_axis(1 : $/2), win_response);&#xA;&#xA;// calculate convolution on each window, siggram_n is just normalized&#xA;// matrix of windowed freq. response&#xA;[rows_sig, cols] = size(siggram_n);&#xA;conv = [];&#xA;for i = 1 : cols&#xA;    conv = [conv (convol(siggram_n(:, i), win_response))'];&#xA;end&#xA;&#xA;// calculate the average of all convolutions&#xA;[rows, cols] = size(ko);&#xA;conv_n = [];&#xA;for i = 1 : rows&#xA;    conv_n = [conv_n sum(conv(i, :))/cols];&#xA;end&#xA;&#xA;// raise to the power of 0.7 to flatten the threshold - from the article&#xA;conv_n = conv_n .^ 0.7;&#xA;&#xA;// plot the convoluted signal&#xA;x_axis = linspace(0, Fs, 2*length(conv_n));&#xA;plot(x_axis(1 : $/2), conv_n, 'red');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's not only important that I know how to plot this, because I'll need to find the peaks, so I have to somehow &quot;synchronize&quot; both signals. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="16438" LastActivityDate="2015-06-29T15:32:44.393" Title="Plotting convoluted and original signals on the same graph" Tags="|frequency-spectrum|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24423" PostTypeId="2" ParentId="24421" CreationDate="2015-06-29T15:27:02.223" Score="0" Body="&lt;p&gt;Looks like you need to do a couple of things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use conv instead of convol&lt;/li&gt;&#xA;&lt;li&gt;Change the order of the parameters of convol like this: conv( win_response,siggram_n(:, i))&lt;/li&gt;&#xA;&lt;li&gt;Tell conv that it should return an array the same size as the first parameter conv( win_response,siggram_n(:, i),&quot;same&quot;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you don't use &quot;same&quot; then you get a convolution result back that is the length of the first array plus twice the length of the second array.  Convol has the parameters in the opposite order, and doesn't have a &quot;same&quot; option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, change the name of your variable conv to something else.  It is bad practice to use keywords as variable names.  In this case, you have to change it else you can't use the conv method properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://help.scilab.org/docs/5.5.2/en_US/conv.html&quot; rel=&quot;nofollow&quot;&gt;See the documentation for conv&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2015-06-29T15:32:44.393" LastActivityDate="2015-06-29T15:32:44.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24425" PostTypeId="2" ParentId="24418" CreationDate="2015-06-29T18:11:13.233" Score="0" Body="&lt;p&gt;You could try a distribution like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gamma_distribution&quot; rel=&quot;nofollow&quot;&gt;Gamma distribution&lt;/a&gt; which is defined only on the positive x-axis unlike the Normal distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB seems to have &lt;a href=&quot;http://in.mathworks.com/help/stats/gamma-distribution.html&quot; rel=&quot;nofollow&quot;&gt;functions&lt;/a&gt; to produce it.&lt;/p&gt;&#xA;" OwnerUserId="7365" LastActivityDate="2015-06-29T18:11:13.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24426" PostTypeId="2" ParentId="24410" CreationDate="2015-06-29T18:47:17.623" Score="12" Body="&lt;p&gt;It's true that zero-padding in the time domain corresponds to interpolation in the frequency domain. If you have a length $N$ signal $x[n]$, its discrete Fourier transform (DFT) is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal $x[n]$ can be expressed in terms of its DFT coefficients $X[k]$ by the inverse DFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the coefficients $X[k]$ contain the same information as the signal $x[n]$, anything that can be computed from $x[n]$ can also be computed from $X[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\tilde{X}(\omega)$ denote the discrete-time Fourier transform (DTFT) of $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{X}(\omega)=\sum_{n=0}^{N-1}x[n]e^{-jn\omega}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $\omega$ is a continuous variable. Comparing (1) and (3) shows that the DFT is simply a sampled version of the DTFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\tilde{X}(2\pi k/N),\quad k=0,\ldots,N-1\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, a length $L$ DFT ($L&amp;gt;N$) of $x[n]$ simply corresponds to a more densely sampled version of $\tilde{X}(\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_L[l]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nl/L}=\tilde{X}(2\pi l/L),\quad l=0,\ldots,L-1\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's express $\tilde{X}(\omega)$ in terms of the length $N$ DFT of $x[n]$. Rewriting (3) using (2) gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\tilde{X}(\omega)&amp;amp;=\sum_{n=0}^{N-1}\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}e^{-jn\omega}\\&#xA;&amp;amp;=\sum_{k=0}^{N-1}X[k]\underbrace{\frac{1}{N}\sum_{n=0}^{N-1}e^{-jn(\omega-2\pi k/N)}}_{G(\omega-2\pi k/N)}&#xA;\end{align}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $G(\omega)$ is an interpolation function which can be expressed by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega)=\frac{1}{N}\sum_{n=0}^{N-1}e^{-jn\omega}=\frac{e^{-j\omega(N-1)/2}}{N}\frac{\sin(N\omega/2)}{\sin(\omega/2)}\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By setting $\omega=2\pi l/L$ in (6) and using (5) you can see that the length $L$ zero-padded DFT of $x[n]$ can be computed from the length $N$ DFT using the interpolation function given by (7):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_L(l)=\tilde{X}(2\pi l/L)=\sum_{k=0}^{N-1}X[k]G(2\pi l/L-2\pi k/N)\tag{8}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-06-28T18:39:27.433" LastActivityDate="2016-06-28T18:39:27.433" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="24429" PostTypeId="2" ParentId="24418" CreationDate="2015-06-29T23:49:20.643" Score="1" Body="&lt;p&gt;Normal distribution regardless of whatever mean and variance you provide, can still produce large positive and negative numbers(albeit with a small probability). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you want to specifically use normal distribution, or all you need is a random delay generator? If latter is the case, you can use rand() from MATLAB, also you could use randi if you need integer delays. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also you could use something like &lt;a href=&quot;http://www.mathworks.com/help/matlab/math/floating-point-numbers-within-specific-range.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; to generate uniformly distributed random numbers in a specific range. &lt;/p&gt;&#xA;" OwnerUserId="15450" LastActivityDate="2015-06-29T23:49:20.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24430" PostTypeId="1" CreationDate="2015-06-30T00:05:17.740" Score="0" ViewCount="5728" Body="&lt;p&gt;I'm newbie in DSP (maybe the question title is misleading for this reason, I apologize for this, please feel free to edit it) but not in programming. I want to experiment with Fourier (or FFT) transformation. Basically I need the generator which will give me signal looking like this:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/MjIve.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to add/remove to/from this signal some noise, This is example for sine wave but I hope you get the point.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/x7V9x.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible for someone whom only knowledge about Fourier transformation is that is composition of sines and cosines with the aim of being able to create signal of any shape? I've been searching for some code snippet where I can change parameters and see how the signal is changing but my google-fu was not enough for this. Preferred language is python (where i can import module and call function) or R or something multi platform (open source) and simple and fast. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="16441" LastEditorUserId="13320" LastEditDate="2016-11-13T13:18:51.563" LastActivityDate="2016-11-13T13:18:51.563" Title="Generate fourier transform signal" Tags="|fourier-transform|python|fourier|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24433" PostTypeId="1" CreationDate="2015-06-30T02:44:10.383" Score="0" ViewCount="69" Body="&lt;p&gt;A particular communication system I came across defines chip time to be 0.57 ns and consequently chip rate is 1760 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transmission bandwidth is 2.16 GHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering, do we suspect to have aliasing? Given the fact that the chip rate is smaller than the bandwidth of transmission? In other words shouldnt the sampling rate (which I assume is 1760 MHz) be at least greater than 2.16 GHz so as to prevent aliasing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="15590" LastEditDate="2015-06-30T14:50:23.607" LastActivityDate="2015-06-30T14:50:23.607" Title="Do we have aliasing with this chip rate and transmission bandwidth" Tags="|digital-communications|nyquist|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24434" PostTypeId="2" ParentId="24430" CreationDate="2015-06-30T03:37:17.713" Score="1" Body="&lt;p&gt;You can create a sine wave in numpy.  Think of it as if you were sampling data from a signal, only you are sampling a mathematical function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sample_rate = 1024&#xA;dt = 1.0/sample_rate&#xA;t = np.arange(sample_rate)*dt  # 1 second of samples&#xA;freq = 5&#xA;amp = 1.0&#xA;sine1 = amp*np.sin(2*np.pi*freq*t)&#xA;sine2 = .5*np.sin(2*np.pi*15*t)&#xA;sinsum = sine1 + sine2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16283" LastActivityDate="2015-06-30T03:37:17.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24436" PostTypeId="1" CreationDate="2015-06-30T06:49:51.053" Score="4" ViewCount="542" Body="&lt;p&gt;&lt;em&gt;Note -- I would appreciate any comments on ho to improve the question -- I did the best I could but it I feel it may still be sup-par.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cns.nyu.edu/home/msl/hipsdescr.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;HIPS&lt;/a&gt; was/is an excellent image processing software. It was basically a large number of unix command line tools each that did something very well and you used UNIX pipes to combine them.&lt;/p&gt;&#xA;&lt;p&gt;I'm either looking for something equivalent or a library that has equivalent functions that I can write command line wrappers around.&lt;/p&gt;&#xA;&lt;p&gt;A library in Java would be Devine, Open Source is a must.&lt;/p&gt;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&lt;p&gt;Some example of the tools HIPS had (full list &lt;a href=&quot;http://www.cns.nyu.edu/home/msl/proglist.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;h3&gt;Geometric and Other Operations on Pictures&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;abspix - take the absolute value of pixels&lt;/li&gt;&#xA;&lt;li&gt;bnoise - add binomial noise to an image&lt;/li&gt;&#xA;&lt;li&gt;calcpix - generate and execute a program which manipulates byte-formatted sequences&lt;/li&gt;&#xA;&lt;li&gt;exppix - take the exponential of an image&lt;/li&gt;&#xA;&lt;li&gt;fcalcpix - generate and execute a program which manipulates float-formatted sequences&lt;/li&gt;&#xA;&lt;li&gt;gnoise - pipe sequence through a channel with Gaussian noise&lt;/li&gt;&#xA;&lt;li&gt;histoeq - histogram equalization&lt;/li&gt;&#xA;&lt;li&gt;histostretch - stretch contrast by ignoring outlier pixel values&lt;/li&gt;&#xA;&lt;li&gt;logimg - take the natural logarithm of an image&lt;/li&gt;&#xA;&lt;li&gt;mean0 - subtract the mean from an image so that it has a mean of zero&lt;/li&gt;&#xA;&lt;li&gt;neg - take the photographic negative of an image&lt;/li&gt;&#xA;&lt;li&gt;noise - simulate a noisy digital communication channel&lt;/li&gt;&#xA;&lt;li&gt;powerpix - raise to a power and normalize each pixel of a frame&lt;/li&gt;&#xA;&lt;li&gt;scale - scale a sequence of images&lt;/li&gt;&#xA;&lt;li&gt;scalemeansd - scale images to have a specified mean and standard deviation&lt;/li&gt;&#xA;&lt;li&gt;shiftpix - shift pixel values&lt;/li&gt;&#xA;&lt;li&gt;stretchpix - stretch or compress the range of gray-levels&lt;/li&gt;&#xA;&lt;li&gt;thresh - apply a threshold&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Frame Arithmetic&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;absdiffseq - compute the absolute value of the difference of image pixels&lt;/li&gt;&#xA;&lt;li&gt;addseq - add two sequences, pixel by pixel&lt;/li&gt;&#xA;&lt;li&gt;andseq - compute the logical AND of two sequences&lt;/li&gt;&#xA;&lt;li&gt;autodiff - absolute value of the difference between successive frames&lt;/li&gt;&#xA;&lt;li&gt;calccomb - generate and execute a program which combines byte-formatted sequences&lt;/li&gt;&#xA;&lt;li&gt;colorkey - perform a `color keying' operation for merging several images&lt;/li&gt;&#xA;&lt;li&gt;diffseq - subtract two sequences, pixel by pixel&lt;/li&gt;&#xA;&lt;li&gt;divseq - divide two sequences, pixel by pixel&lt;/li&gt;&#xA;&lt;li&gt;fcalccomb - generate and execute a program which combines float-formatted sequences&lt;/li&gt;&#xA;&lt;li&gt;maxabsseq - compute the maximum absolute value of two sequences, pixel by pixel&lt;/li&gt;&#xA;&lt;li&gt;maxseq - compute the maximum of two sequences, pixel by pixel&lt;/li&gt;&#xA;&lt;li&gt;minabsseq - compute the minimum absolute value of two sequences, pixel by pixel&lt;/li&gt;&#xA;&lt;li&gt;minseq - compute the minimum of two sequences, pixel by pixel&lt;/li&gt;&#xA;&lt;li&gt;mulseq - multiply two sequences, pixel by pixel&lt;/li&gt;&#xA;&lt;li&gt;orseq - compute the logical OR of two sequences&lt;/li&gt;&#xA;&lt;li&gt;xorseq - compute the logical XOR of two sequences&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Convolution, Correlation, Edge Detection and Other Spatial Operations&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;abdou - Abdou's edge fitting procedure&lt;/li&gt;&#xA;&lt;li&gt;bclean - remove small 8-connected components&lt;/li&gt;&#xA;&lt;li&gt;btcsmooth - smooth a btc image&lt;/li&gt;&#xA;&lt;li&gt;convolve - 3D convolution&lt;/li&gt;&#xA;&lt;li&gt;correl - cross-correlate two images&lt;/li&gt;&#xA;&lt;li&gt;discedge - a discrete domain regional edge detector&lt;/li&gt;&#xA;&lt;li&gt;discedge2 - a discrete domain regional edge detector with offsets&lt;/li&gt;&#xA;&lt;li&gt;dog - filter an image by applying difference of Gaussians mask&lt;/li&gt;&#xA;&lt;li&gt;extremum - apply an extremum filter to an image&lt;/li&gt;&#xA;&lt;li&gt;mask - generalized filtering program&lt;/li&gt;&#xA;&lt;li&gt;maskseq - convert a mask set into a HIPS sequence&lt;/li&gt;&#xA;&lt;li&gt;median - apply a median filter to an image&lt;/li&gt;&#xA;&lt;li&gt;morphdilate - apply the morphological operator of dilation&lt;/li&gt;&#xA;&lt;li&gt;morpherode - apply the morphological operator of erosion&lt;/li&gt;&#xA;&lt;li&gt;nonisot - nonisotropic convolution&lt;/li&gt;&#xA;&lt;li&gt;thicken - thicken a white-on-black image&lt;/li&gt;&#xA;&lt;li&gt;thin - thin and categorize a white-on-black image&lt;/li&gt;&#xA;&lt;li&gt;zc - find zero-crossings in a convolved sequence&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Digital Transforms and Filters&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;bandpass - apply a bandpass filter to a sequence&lt;/li&gt;&#xA;&lt;li&gt;bandreject - apply a band rejection filter to a sequence&lt;/li&gt;&#xA;&lt;li&gt;dct - discrete cosine transform&lt;/li&gt;&#xA;&lt;li&gt;dispwbasis - output the basis set for the Walsh transform of a 16X16 array&lt;/li&gt;&#xA;&lt;li&gt;flipquad - swap opposite image quadrants&lt;/li&gt;&#xA;&lt;li&gt;fourtr - Fourier transform and spectrum&lt;/li&gt;&#xA;&lt;li&gt;fourtr3d - 3D Fourier transform and spectrum&lt;/li&gt;&#xA;&lt;li&gt;highpass - apply a highpass filter to a sequence&lt;/li&gt;&#xA;&lt;li&gt;inv.dct - inverse discrete cosine transform&lt;/li&gt;&#xA;&lt;li&gt;inv.fourtr - inverse Fourier transform&lt;/li&gt;&#xA;&lt;li&gt;inv.walshtr - inverse Walsh transform&lt;/li&gt;&#xA;&lt;li&gt;lowpass - apply a lowpass filter to a sequence&lt;/li&gt;&#xA;&lt;li&gt;walshtr - Walsh transform&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Gaussian and Laplacian Pyramid Operations&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;imgtopyr - compute a Laplacian or Gaussian pyramid&lt;/li&gt;&#xA;&lt;li&gt;pyrdisplay - convert an image pyramid to a single image for display&lt;/li&gt;&#xA;&lt;li&gt;pyrexpand - apply the pyramid expand operation to an image or pyramid&lt;/li&gt;&#xA;&lt;li&gt;pyrextract - extract a subset of pyramid levels&lt;/li&gt;&#xA;&lt;li&gt;pyrmerge - merge several images or pyramids into a single pyramid&lt;/li&gt;&#xA;&lt;li&gt;pyrreduce - apply the pyramid reduce operation to an image or pyramid&lt;/li&gt;&#xA;&lt;li&gt;pyrtoimg - reconstruct an image from a Laplacian pyramid&#xA;-Image Compression&lt;/li&gt;&#xA;&lt;li&gt;ahc3 - 3D adaptive hierarchical coding into binary trees of binary images&lt;/li&gt;&#xA;&lt;li&gt;ahc3_r - decode an ahc3-coded sequence into a byte formatted sequence&lt;/li&gt;&#xA;&lt;li&gt;binquad - 3D binary (temporal) and quadtree (spatial)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8259" LastEditorUserId="7092" LastEditDate="2022-02-20T16:30:46.207" LastActivityDate="2022-02-20T16:30:46.207" Title="Looking for Open Source Image Processing Library that is equivalent to HIPS" Tags="|image-processing|computer-vision|software-implementation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="24439" PostTypeId="1" CreationDate="2015-06-30T12:37:24.180" Score="0" ViewCount="426" Body="&lt;p&gt;I am working on a project that involves Spatial Modulation for MIMO channels. This uses a ML (Maximum Likelihood) detector which is computationally intensive. Sphere Decoders are developed to reduce this computations by limiting the search spaces. I understand that it uses a radius (can be soft or hard) to determine this and that it uses QR decomposition where R is triangular and uses this to create a tree structure. This is where I'm lost as to how this tree is created. If any can explain this or provide a link which explains this I would be very grateful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to learn the basics of sphere decoding so as to be able to implement the algorithm in this paper: &lt;a href=&quot;http://arxiv.org/abs/1305.1478&quot; rel=&quot;nofollow&quot;&gt;http://arxiv.org/abs/1305.1478&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16449" LastActivityDate="2015-06-30T12:37:24.180" Title="Basics of Sphere Decoding for MIMO" Tags="|modulation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24440" PostTypeId="1" CreationDate="2015-06-30T13:50:20.757" Score="0" ViewCount="474" Body="&lt;p&gt;I am trying to determine the synchronicity between two oscillating signals. I was attempting to do this by making use of the cross correlation between the two signals and looking at the maximum value. Is this a correct approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, which would be the better approach, to normalize the signals between 0 and 1 or to normalize the cross correlation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really mind about the difference in amplitude but I would like to see levels of synchronicity. Originally I thought to do cross correlation and look at the max of the graph however, I am not sure that this is the correct approach. I have also been looking at coherence of the spectra&lt;/p&gt;&#xA;" OwnerUserId="10933" LastEditorUserId="4346" LastEditDate="2015-10-04T02:48:55.417" LastActivityDate="2015-10-04T02:55:33.977" Title="Synchronicity of two signals" Tags="|coherence|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24441" PostTypeId="2" ParentId="24440" CreationDate="2015-06-30T13:57:49.397" Score="0" Body="&lt;p&gt;there's a very interesting approach based on correntropy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you may be interested on this material:&#xA;&lt;a href=&quot;http://www.cnel.ufl.edu/~weifeng/filesfordownload/paper/localized_similarity_measure.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.cnel.ufl.edu/~weifeng/filesfordownload/paper/localized_similarity_measure.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you're using matlab, there's a suppor for that, take a look:&#xA;&lt;a href=&quot;http://www.sohanseth.com/Home/codes&quot; rel=&quot;nofollow&quot;&gt;http://www.sohanseth.com/Home/codes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i hope it can be of benefict for you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cheers&lt;/p&gt;&#xA;" OwnerUserId="16450" LastActivityDate="2015-06-30T13:57:49.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24442" PostTypeId="2" ParentId="24440" CreationDate="2015-06-30T14:59:55.753" Score="1" Body="&lt;p&gt;Using cross-correlation and finding the peak is one way of finding the time delay between two signals.&lt;br&gt;&#xA;This assumes that the two signals are periodic and have the same fundamental frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the two signals have close, but not equal fundamental frequency, the lag position of the maximum cross correlation value will change in time.  If the lag of the maximum does not change (and some thresholds are satisfied so you're not just cross-correlating two very weak signals with the same 60 Hz hum in the background), the two signals are synchronous.  If it changes slowly, that indicates the degree that the two signals have different frequencies.  If the lag requires T seconds for the lag to slide one period (which would be the distance between lags of maximum correlation) in one second, the two signals differ in frequency by 1 Hz. &lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="4346" LastEditDate="2015-10-04T02:55:33.977" LastActivityDate="2015-10-04T02:55:33.977" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24443" PostTypeId="1" CreationDate="2015-06-30T15:41:41.010" Score="0" ViewCount="575" Body="&lt;p&gt;Consider I have two transmitters $tx_1$ and $tx_2$ at say a distance of $d_1=5\text{ m}$ and $d_2 = 15\text{ m}$ respectively from a receiver. Now, if I consider the effect of path loss in such a system and plot the power spectral density for both the transmitters, the PSD of $tx_1$ should be higher than the PSD of $tx_2$. In my simulation, I notice that the PSD of $tx_1$ has its peak at $130\text{ dB}_m$ whereas PSD of $tx_2$ has its peak at $160\text{ dB}_m$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if I am missing something or I have understood this wrong. I think the peak should be vice versa, i.e., $130\text{ dB}_m$ for $tx_2$ and $160\text{ dB}_m$ for $tx_1$. I have used a reference distance $d_0=1\text{ m}$, pathloss exponent $n=3$ and $\lambda=3e8/2.4e9$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the formula I have been using for calculating the pathloss:&#xA;$PL(dB)= -20\log_{10}(\lambda/(4\pi d_0))+10 n \log_{10}(d/d0)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$PL(linear) = 10^{PL(dB))/10}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once , I have the PL, I am multiplying this PL with the signal to be transmitted. Could someone advise where I might be going wrong.&lt;/p&gt;&#xA;" OwnerUserId="15794" LastEditorUserId="15794" LastEditDate="2015-07-01T06:32:38.340" LastActivityDate="2015-07-01T06:32:38.340" Title="Effect of pathloss on signal power" Tags="|matlab|signal-analysis|multipath|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24445" PostTypeId="1" CreationDate="2015-06-30T19:27:05.460" Score="0" ViewCount="2940" Body="&lt;p&gt;currently I am writing my masther thesis. The theory part is about the turbulent wind field generation, where the coherence (not magnitude squared) is used:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{coh}(f) = \frac{|P_{xy}|}{\sqrt{P_{xx} P_{yy}}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering what is the general advantage of using the magnitude squared coherence instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{coh}^2(f) = \frac{|P_{xy}|^2}{P_{xx} P_{yy}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this relationship is similar to that of the correlation coefficient $R$ and coefficient of determination $R^2$. I tried to google the difference regarding the coherence, but unfortunately I don't find any (good) explanations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone can help me. Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apollo3zehn&lt;/p&gt;&#xA;" OwnerUserId="16454" LastEditorUserId="16454" LastEditDate="2015-07-03T07:21:58.993" LastActivityDate="2021-08-13T06:03:20.427" Title="Coherence vs. Magnitude Squared Coherence" Tags="|power-spectral-density|magnitude|coherence|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24448" PostTypeId="1" CreationDate="2015-06-30T21:15:50.890" Score="0" ViewCount="535" Body="&lt;p&gt;I have a function with an equation: &#xA;\begin{equation}&#xA;C(t)=1.6925\left(\exp^{-0.136t}- \exp^{-1.192t} \right) u(t)&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where u(t) is a unit-step function. Then, denoting  the Fourier Transform of C(t) as C(F), we have &#xA;\begin{equation}&#xA;C(f)=1.6925\left(\frac{1}{0.136+2\pi jf}- \frac{1}{1.192+ 2\pi jf} \right) &#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A time and signal representation of the signal is given by the below figures:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/gx2gD.png&quot; alt=&quot;enter image description here&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/VsLe1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see that the C(f) is almost zero after 0.8 Hz therefore sampling at 1.6 Hz based on the Nyquist criterion, we can obtain theoretically a good sample of the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However 1.6 Hz, is about a sampling period of 0.625 seconds, which in my context of biological studies that is way too frequent. I am looking at other avenues to reduce the sampling rate or increase the sampling period and a search in the litterature has yielded decimation as a possible avenue. A quick hack in matlab using the decimate function yields the below figures for a decimated signal after being sampled at 1.6Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My end goal is to compute the surface below my original signal within a time interval or its sampled or decimated versions, do you think that decimation can allow me to do that? How can i measure aliasing between the different versions of my signal? Is there a better way to sample that signal and reconstruct it from a limited number of samples?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my current Matlab Code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; clc;close all;&#xA;&#xA;%% Time-domain signal&#xA;Ts=0.625; % Sampling time (obtained from the frequency domain plot)&#xA;t=0:Ts:60; % in sec&#xA;C=1.6925* (exp(-0.136*t)-exp(-1.192*t));&#xA;clog= log(C);&#xA;figure,plot(t,C);&#xA;figure,plot(t,clog);&#xA;title('Time domain signal');&#xA;xlabel('Time in sec')&#xA;&#xA;%Frequency domain signal&#xA;f=0:.1:1.6;&#xA;F1=1.6925*((1./(0.136+(j*2*pi*f)))-(1./(1.192+(j*2*pi*f))));&#xA;figure,plot(f,abs(F1));&#xA;title('Frequency domain signal');&#xA;xlabel('Frequency in Hz')&#xA;% Via FFT&#xA;F2=fft(C);&#xA;L=length(F2);&#xA;figure,plot((0:L-1)*(1/(L*Ts)),abs(F2));&#xA;title('Frequency domain signal via FFT of C(t)');&#xA;xlabel('Frequency in Hz')&#xA;&#xA;%Downsampling a signal and decimation with interpolation&#xA;y = decimate(C,10);&#xA;&#xA;subplot 211&#xA;stem(0:48,C(1:49),'filled','markersize',3)&#xA;grid on&#xA;xlabel 'Sample number',ylabel 'Original'&#xA;subplot 212&#xA;stem(0:4,y(1:5),'filled','markersize',3)&#xA;grid on&#xA;xlabel 'Sample number',ylabel 'Decimated'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tsg72.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16213" LastActivityDate="2015-06-30T21:15:50.890" Title="Optimal signal sampling reduction method : Decimation, interpolation or both?" Tags="|interpolation|downsampling|decimation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24450" PostTypeId="2" ParentId="24391" CreationDate="2015-06-30T22:56:59.493" Score="2" Body="&lt;p&gt;just to add a little to Matt's answer.  if you know where your poles, $p_n$, and zeros, $q_m$, are your transfer function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = H_0 \frac{(z-q_1)(z-q_2)(z-q_3)...(z-q_M)}{(z-p_1)(z-p_2)(z-p_3)...(z-p_N)} \quad \quad M \le N $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the complex frequency response (which contains both magnitude and phase information) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(e^{j\omega}) = H_0 \frac{(e^{j\omega}-q_1)(e^{j\omega}-q_2)(e^{j\omega}-q_3)...(e^{j\omega}-q_M)}{(e^{j\omega}-p_1)(e^{j\omega}-p_2)(e^{j\omega}-p_3)...(e^{j\omega}-p_N)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the magnitude response (which is where you determine if it's a LPF or BPF or HPF or something else like that) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |H(e^{j\omega})| = |H_0| \frac{|e^{j\omega}-q_1| \ |e^{j\omega}-q_2| \ |e^{j\omega}-q_3|...|e^{j\omega}-q_M|}{|e^{j\omega}-p_1| \ |e^{j\omega}-p_2| \ |e^{j\omega}-p_3|...|e^{j\omega}-p_N|} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $e^{j\omega}$ is a point on the unit circle.  what this means is, as your frequency increases from DC (or $\omega=0$), that corresponds to moving along the unit circle from $z=e^{j0}=1$ to other points on the unit circle.  then as your point on the unit circle gets close to a zero $q_m$, a factor of $|e^{j\omega}-q_m|$ gets small.  $|e^{j\omega}-q_m|$ is literally the distance your point on the unit circle is from that particular zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;likewise for the poles, but your poles are in the denominator, so as your point on the unit circle gets close to a pole $p_n$, a factor of $|e^{j\omega}-p_n|$ gets small, but since you're dividing by that small number, the effect on the gain magnitude is to increase it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so a LPF will have poles closer to the DC point of $z=e^{j0}=1$ and, perhaps, zeros closer to Nyquist $z=e^{j\pi}=-1$ so when you're close to DC you're multiplying by big numbers and when you're close to Nyquist, you're multiplying by small numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;likewise for a HPF, you'll have poles closer to Nyquist and zeros closer to DC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for a BPF, you might have zeros close to both DC and Nyquist and poles close to the unit circle at other places where they will boost the gain for those bandpass frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that's how you look at the pole-zero plots on the $z$-plane to judge if it's a LPF or whatever.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-06-30T22:56:59.493" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24453" PostTypeId="1" AcceptedAnswerId="24462" CreationDate="2015-07-01T07:11:35.317" Score="0" ViewCount="46" Body="&lt;p&gt;In many single parameter estimation process average is the optimal. Can anyone tell under what condition average is optimal? For example is average optimal if the data is iid, Gaussian or something else?&lt;/p&gt;&#xA;" OwnerUserId="15437" LastEditorUserId="4298" LastEditDate="2015-07-01T07:20:46.240" LastActivityDate="2015-07-01T13:35:01.543" Title="Condition for optimal value to be the average" Tags="|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24454" PostTypeId="1" AcceptedAnswerId="24470" CreationDate="2015-07-01T07:19:05.720" Score="0" ViewCount="703" Body="&lt;p&gt;Wondering about the resconstruction of the input signal when an overlapped windowing function has been applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm specifically applying a Hamming window with 50% overlap and I wish to reconstruct the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;a href=&quot;http://www.dsprelated.com/showthread/comp.dsp/105321-1.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showthread/comp.dsp/105321-1.php&lt;/a&gt; it's given that summing the 50% overlapped windows gives a sum of 1.08.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to reconstruct the input signal (with the same exact amplitudes), then can I merely subtract the extra ~&quot;.08&quot; from all the samples? Or, equivalently, divide by 1.08? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The overlapp-add does not result into the exact same signal though, but there's some miniscule variation for some reason. By testing with an array of 1.0s I get back varying values that are of the form 0.999 ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess reconstructing doesn't always lead to the same exact input signal, depending on the windowing function and the amount of overlap?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-07-01T08:56:02.290" LastActivityDate="2016-06-26T12:04:48.260" Title="Reconstruction of a windowed signal (specifically Hamming windowed)" Tags="|window-functions|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24458" PostTypeId="1" CreationDate="2015-07-01T08:54:09.423" Score="1" ViewCount="2606" Body="&lt;p&gt;I am taking a real-time &lt;code&gt;fft&lt;/code&gt; of an audio signal using &lt;code&gt;fftw&lt;/code&gt; library. I take the output of the &lt;code&gt;fftw&lt;/code&gt; signal on $y$-axis and plot it against the linear frequency bins on $x$-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've noticed that spectrum analyzers use a skewed &lt;code&gt;plot(log plot)&lt;/code&gt;. I can get my $y$-axis (&lt;code&gt;magnitude&lt;/code&gt;) into $\rm dB$ by doing &lt;code&gt;20*log(magnitude)&lt;/code&gt; but I don't know how to get my frequency axis($x$-axis) into log-scale. I need some help in doing that in C/C++ not Matlab.&lt;/p&gt;&#xA;" OwnerUserId="16391" LastEditorUserId="1629" LastEditDate="2016-03-27T21:15:25.700" LastActivityDate="2016-03-27T21:15:25.700" Title="FFTW log-log plot" Tags="|fft|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24459" PostTypeId="1" CreationDate="2015-07-01T11:37:27.417" Score="3" ViewCount="5859" Body="&lt;p&gt;I am trying to get the hang of camera calibration. For this purpose, I have mainly watched this lecture on youtube: &lt;a href=&quot;https://www.youtube.com/watch?v=NWOL8yXL6xI&quot; rel=&quot;nofollow&quot;&gt;Lecture 12: Camera Model by UCF CRCV&lt;/a&gt;. I believe that I understood the main ideas:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We basically deal with the question to relate 3D world points to 2d image points. In order to do this&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We take the 3D point W in homogenous coordinates (in a defined world coordinate system)&lt;/li&gt;&#xA;&lt;li&gt;Apply transformations (rotation, translation) to bring the camera and world coordinate system in alignment&lt;/li&gt;&#xA;&lt;li&gt;Use perspective projection (from the pinhole camera model) to calculate the image point I.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If we do not have the perspective projection (that is the intrinsic parameters) and we do not have the camera position and orientation in the world (extrinsic parameters), we can calculate them (=calibration) by using an object with easily findable points in the world, identifying those points in the taken image and building a system of equations which we can then solve using least squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now noticed, that many calibration tools actually require multiple images to calibrate reliably. Concerning this, I have a couple of questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How do we relate the multiple images we might have taken from the same object that we have moved? I have seen that the world origin is often placed in a chessboards corner, but this origin will change if you move the chessboard. Don't the origins have to match, such that we can calculate the extrinsic parameters over multiple images? &lt;/li&gt;&#xA;&lt;li&gt;Why exactly is it better to use multiple images? Couldn't you just use a big chessboard that gives you a sufficient number of points to solve the system of equations?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16462" LastActivityDate="2018-03-20T13:00:12.913" Title="Camera calibration using multiple images" Tags="|computer-vision|camera|camera-calibration|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24460" PostTypeId="2" ParentId="24458" CreationDate="2015-07-01T12:26:31.137" Score="1" Body="&lt;p&gt;You interpolate between the bins such that they map to your output grid (you may even need this for any kind of display where your output pixels doesn't match your transform size).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will get the best result using sinc-interpolation on both the real and imaginary outputs (or just magnitude if you don't care). Look up lanczos interpolation for a smaller, windowed version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To transform your x-axis into a exponential scale, you can use a mapping function like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;min * (max/min) ^ x&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where x is between 0 and 1, and max is the end of the graph - usually samplerate / 2. The graph starts at min. Here's the inverse function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;log(y/min) / log(max/min)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8650" LastEditorUserId="8650" LastEditDate="2015-07-01T12:33:19.087" LastActivityDate="2015-07-01T12:33:19.087" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24462" PostTypeId="2" ParentId="24453" CreationDate="2015-07-01T13:35:01.543" Score="2" Body="&lt;p&gt;You don't need to assume anything about the data in order for the average to be optimal (in a least squares sense) for certain estimation problems. As an example, assume you want to estimate a constant value $x$ and you are given $N$ noisy measurements:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_n=x+e_n,\quad n=0,1,\ldots,N-1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $e_n$ is the error of the $n^{th}$ measurement. If our goal is to minimize the mean squared error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{N}\sum_{n=0}^{N-1}e_n^2=\frac{1}{N}\sum_{n=0}^{N-1}(y_n-x)^2\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the optimal estimate $\hat{x}$ is obtained by minimizing (2). Taking the derivative of the right-hand side of (2) with respect to $x$ and setting it to zero gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2}{N}\sum_{n=0}^{N-1}(y_n-\hat{x})=0\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From (3) the optimum estimate is obtained as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{x}=\frac{1}{N}\sum_{n=0}^{N-1}y_n\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is simply the average of all observations.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-01T13:35:01.543" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24463" PostTypeId="1" AcceptedAnswerId="24465" CreationDate="2015-07-01T14:17:15.943" Score="0" ViewCount="187" Body="&lt;p&gt;This is probably a very simple case but I am not sure where I am going wrong. In order to estimate the effect of path loss in Matlab, the function &lt;code&gt;fspl(R,lambda)&lt;/code&gt; gives a pathloss value for a distance &lt;code&gt;R&lt;/code&gt;in $dB$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is that, for using this function should one directly multiply the path loss value in $dB$ or convert it to linear scale and then multiply. If I use the $dB$ value, the signal power increases and if I use the linear scale value, there is a lot of difference between the transmitted and received power. Here's a snippet of my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SNR =2;    &#xA;Fs=12e6;&#xA;Fc = 2.4e9;&#xA;d = 5; lambda = physconst('LightSpeed')/Fc;    &#xA;data=randi([0 1],3000,1);&#xA;hMod = comm.OQPSKModulator('BitInput',true);&#xA;modulated_sgl = step(hMod, data);&#xA;pathloss_dB = fspl(d,lambda);&#xA;tx_sgl = modulated_sgl * pathloss_dB ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I try to plot the power spectral density of &lt;code&gt;tx_sgl&lt;/code&gt; and &lt;code&gt;modulated_sgl&lt;/code&gt; using the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hss = dsp.SpectrumAnalyzer('SampleRate', Fs); &#xA;step(hss,[tx_sgl modulated_sgl]);&#xA;release(hss);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I observe however that the power of &lt;code&gt;tx_sgl&lt;/code&gt; is higher than the &lt;code&gt;modulated_sgl&lt;/code&gt;. Can someone guide me where I may be going wrong.&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2015-07-01T17:17:56.203" Title="Using pathloss in matlab" Tags="|matlab|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24464" PostTypeId="2" ParentId="24459" CreationDate="2015-07-01T16:41:36.450" Score="3" Body="&lt;p&gt;You are correct: to calibrate a camera you need a correspondence between 3D world points and 2D image points. The problem is that the 3D points cannot be co-planar, so people were building 3D calibration rigs, e. g. a box made of checkerboards. One image of a rig like that would be enough to calibrate, but those rigs are hard to build, because you have to get the planes to be at exactly right angles to each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then Zhengyou Zhang came up with the &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/zhang/calib/&quot; rel=&quot;nofollow&quot;&gt;algorithm to calibrate from multiple images of a planar pattern, like a checkeboard&lt;/a&gt;. You still need non-coplanar points, but you get them from multiple images of a planar pattern in different 3D orientations, rather than a single image of a 3D rig.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise and errors are another reason why you need multiple images. You cannot detect the checkerboard corners with infinite precision. So you need a lot of points, to estimate the camera parameters more reliably.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-07-01T16:41:36.450" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24465" PostTypeId="2" ParentId="24463" CreationDate="2015-07-01T17:17:56.203" Score="1" Body="&lt;p&gt;The function gives you the path &lt;em&gt;loss&lt;/em&gt; in dB. This number is positive, i.e. a path loss of $3$ dB corresponds to a gain of $-3$ dB. So for a given path loss $x$ (in dB), the signal is attenuated by a factor $10^{-x/20}$. Note that multiplication with a dB value hardly ever makes any sense.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-01T17:17:56.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24467" PostTypeId="2" ParentId="24454" CreationDate="2015-07-01T17:28:59.743" Score="0" Body="&lt;p&gt;If your process has a gain of 1.08, then you will need to divide the processes result by 1.08, not subtract a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finite numerical processes involving transcendental functions should not be expected to produce exact results in the general case.  Common fast computer processor arithmetic is &quot;only&quot; accurate to about a dozen significant digits.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-07-01T17:28:59.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24468" PostTypeId="1" CreationDate="2015-07-01T19:05:07.150" Score="5" ViewCount="6727" Body="&lt;p&gt;In many of the papers it is said that the derivative filter transfer function is given by: $$H(z) = \dfrac{1}{8T}\left(-z^{-2} - 2z^{-1} + 2z + z^{2}\right)$$ But no one gave the detailed information about it. Anyone has an idea about this?&lt;/p&gt;&#xA;" OwnerUserId="16466" LastEditorUserId="4298" LastEditDate="2017-12-15T10:45:17.923" LastActivityDate="2017-12-15T10:45:17.923" Title="derivative filter transfer function" Tags="|filters|transfer-function|derivative|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24469" PostTypeId="1" CreationDate="2015-07-01T21:59:12.083" Score="1" ViewCount="190" Body="&lt;p&gt;I was wondering if I could get some tips/resources on how to pick out the singularity from my 2D Continuous Wavelet Transform Coefficient Plot (scalogram) using the Gaussian Derivative as the mother-wavelet (the Mexican-Hat works well as well). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E5gRe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is an example of a plot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I prevent false detections? What is the best way to sort through this to find the singularity? Should I only be looking at one scale and do a 1D signal peak Detection? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="15740" LastActivityDate="2015-07-01T21:59:12.083" Title="Singularity Detection from 2D Wavelet Modulus Plot" Tags="|matlab|wavelet|python|edge-detection|2d|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24470" PostTypeId="2" ParentId="24454" CreationDate="2015-07-01T22:24:47.440" Score="1" Body="&lt;p&gt;did you ask this at &lt;em&gt;comp.dsp&lt;/em&gt;?  appears so.  if you do what hotpaw says, your Hamming window will be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ w(t) =&#xA;\begin{cases}&#xA;0.426 \cdot \cos(\pi t) + 0.5 &amp;amp; \text{if }|t| &amp;lt; 1 \\&#xA;0.037 &amp;amp; \text{if }|t| = 1 \\&#xA;0 &amp;amp; \text{if }|t| &amp;gt; 1&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;still a Hamming window, but it overlap-adds to 1 (with 50% overlap), rather than 1.08.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-11-29T06:00:59.953" LastActivityDate="2015-11-29T06:00:59.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24471" PostTypeId="2" ParentId="24440" CreationDate="2015-07-01T22:42:51.687" Score="0" Body="&lt;p&gt;I guess another approach may be to use cross wavelet coherence analysis (phase analysis) to see how one signal and the other signal phases move in time in relation to each other. For example you may find that one signal moves for a given time spand in tandem or anticipates or lags the other signal. So you can visualize them across time. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-07-05T19:02:43.867" LastActivityDate="2015-07-05T19:02:43.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24472" PostTypeId="2" ParentId="24468" CreationDate="2015-07-02T02:28:50.013" Score="1" Body="&lt;p&gt;It seems to be some kind of weighted &lt;a href=&quot;http://mathfaculty.fullerton.edu/mathews/n2003/differentiation/numericaldiffproof.pdf&quot; rel=&quot;nofollow&quot;&gt;central-difference formula&lt;/a&gt; over different time intervals, maybe to minimize the effect of noise on the signal for shorter time intervals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case the weighted central-difference formula can be written as,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\dot{y}(t) \approx \frac{\frac{y(t+2T) - y(t-2T)}{4T} + \frac{y(t+T) - y(t-T)}{2T}}{2} = \frac{-y(t-2T) - 2y(t-T) + 2 y(t+T) + y(t+2T)}{8T}.&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="7579" LastActivityDate="2015-07-02T02:28:50.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24473" PostTypeId="1" AcceptedAnswerId="24480" CreationDate="2015-07-02T04:11:45.413" Score="1" ViewCount="564" Body="&lt;p&gt;This answer may be straight forward but I cannot figure out. One can understand the difference between cross-correlation and convolution from the link below:   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/2654/what-is-the-difference-between-convolution-and-cross-correlation&quot;&gt;What is the difference between convolution and cross-correlation?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is can there be two complex signal which are uncorrelated but their spectrum overlaps? In other words spectrum is not disjoint or product of power spectrum of each signal is not zero in each frequencies?&lt;/p&gt;&#xA;" OwnerUserId="15437" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-07-04T11:24:43.370" Title="Uncorrelated but overlapping spectrum." Tags="|discrete-signals|fourier-transform|linear-systems|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24474" PostTypeId="1" AcceptedAnswerId="24477" CreationDate="2015-07-02T07:16:47.477" Score="0" ViewCount="918" Body="&lt;p&gt;I obtained this polynomial equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(z) = 1 - 0.7987 z^{-1} - 0.125 z^{-2} - 0.511 z^{-3} + 0.06889 z^{-4} + 0.3465 z^{-5} + 0.4809 z^{-6} + 0.04951 z^{-7} - 0.5298 z^{-8} + 0.1828 z^{-9}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I plot the root of this polynomial equation? I want to observe how the roots are moving inside the system.&lt;/p&gt;&#xA;" OwnerUserId="15614" LastEditorUserId="8202" LastEditDate="2015-07-02T08:38:21.760" LastActivityDate="2015-07-02T09:18:49.620" Title="How to plot the root of polynomial in Matlab?" Tags="|matlab|discrete-signals|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24475" PostTypeId="2" ParentId="24468" CreationDate="2015-07-02T07:55:50.610" Score="3" Body="&lt;p&gt;This is not a &lt;a href=&quot;https://en.wikipedia.org/wiki/Numerical_differentiation#Higher-order_methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard 5-point derivative formula&lt;/a&gt;, the corresponding transfer function of which is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{12}\left(-z^2+8z-8z^{-1}+z^{-2}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figure below shows the magnitude responses of an ideal differentiator (red), of the standard 5 point approximation given by (1) (green), and of the approximation in your question (blue):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hv2fS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the non-standard approximation approximates the ideal differentiator only in a frequency region up to about $1/10$ of the Nyquist frequency (half the sampling frequency), whereas the standard approximation approximates the ideal differentiator quite well up to about a normalized frequency of $0.3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The differentiator in your question is a &lt;a href=&quot;http://eeweb.poly.edu/iselesni/lowdiff/&quot; rel=&quot;nofollow noreferrer&quot;&gt;maximally flat lowpass differentiator&lt;/a&gt;. It avoids amplification of high-frequency noise. It achieves a maximally flat approximation of the ideal differentiator at $\omega=0$ and it has a given number of zero derivatives at $\omega=\pi$ (Nyquist), i.e. it is has a flat response at Nyquist, which causes high frequencies to be attenuated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The design formula is derived in &lt;a href=&quot;http://eeweb.poly.edu/iselesni/lowdiff/lowdiff.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. There is also a Matlab program available to design such maximally flat differentiators: &lt;a href=&quot;http://eeweb.poly.edu/iselesni/lowdiff/lowdiff.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;. Your specific filter is obtained by the command &lt;code&gt;h=lowdiff(3,0);&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-07-02T12:37:20.030" LastActivityDate="2015-07-02T12:37:20.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24476" PostTypeId="1" AcceptedAnswerId="24483" CreationDate="2015-07-02T09:14:38.777" Score="2" ViewCount="1892" Body="&lt;p&gt;I am trying split call-center recording by speakers. &lt;a href=&quot;http://lium3.univ-lemans.fr/diarization/doku.php/overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;LIUM&lt;/a&gt; seems to fit great. But results look random to me (green is etalon, gray is what I get):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/d2EX3.png&quot; alt=&quot;diarization result&quot;&gt;&#xA;So I think I am doing something wrong. Maybe features are not extracted correctly? Command I am running is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;java -cp lium_spkdiarization-8.4.1.jar fr.lium.spkDiarization.system.Telephone \&#xA;     --saveAllStep --doCEClustering \&#xA;     --fInputMask sound.wav --sOutputMask=%s.xml \&#xA;     --sOutputFormat=seg.xml,UTF8 sound&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;sound.wav is &lt;code&gt;RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz&lt;/code&gt;. One can download it here &lt;a href=&quot;https://yadi.sk/d/w0doqi7QhcjJj&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://yadi.sk/d/w0doqi7QhcjJj&lt;/a&gt; . Please, help!&lt;/p&gt;&#xA;" OwnerUserId="16471" LastEditorUserId="7338" LastEditDate="2015-07-02T14:37:48.143" LastActivityDate="2017-02-13T09:13:40.893" Title="Phone conversation diarization with LIUM" Tags="|speech-processing|speech|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24477" PostTypeId="2" ParentId="24474" CreationDate="2015-07-02T09:18:49.620" Score="0" Body="&lt;p&gt;If the vector &lt;code&gt;a&lt;/code&gt; contains the polynomial coefficients, you can compute the roots of the polynomial by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;r = roots(a);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then you can plot those roots as points in the complex plane with some marker (e.g., 'x'):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;plot(r,'x')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-02T09:18:49.620" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24478" PostTypeId="1" AcceptedAnswerId="24479" CreationDate="2015-07-02T10:54:25.953" Score="0" ViewCount="172" Body="&lt;p&gt;Having photo-diodes with a very narrow field of view (+-10 degrees for half power) what should I consider when designing a beam-forming algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I could use many photo-diodes mounted in an arc to cover 180 degrees for example but the uncertainty of 10 degrees is too big. As an alternative to classical beam-forming, what would be the methods to use to isolate a signal coming from one direction with a high precision (under 1 degree)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to analyze the flickering of lamps, knowing their position from analyzing camera data, I want to isolate the signal coming from their direction.&lt;/p&gt;&#xA;" OwnerUserId="16379" LastActivityDate="2015-07-02T11:56:07.783" Title="Beamforming with directional sensors" Tags="|beamforming|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24479" PostTypeId="2" ParentId="24478" CreationDate="2015-07-02T11:56:07.783" Score="0" Body="&lt;p&gt;Given the horizontal and vertical component of the distance vector from the source to the sensor array be X and Y, then the angle between the sensor array and the source is given by:&#xA;$$ \theta = \tan^{-1} (Y/X) $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the linear distance between each sensor is $d$, each sensor should experience a delay:&#xA;$$ \delta t = d \sin(\theta)/c $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you can measure the delays (high precision measurement will lead to higher accuracy), and have the knowledge of $d$, you can find the angle $\theta$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Warning: Practical errors and considerations are not taken into account in this approach.&lt;/em&gt;   &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2015-07-02T11:56:07.783" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24480" PostTypeId="2" ParentId="24473" CreationDate="2015-07-02T12:32:04.547" Score="1" Body="&lt;p&gt;If you mean correlation at the origin (no signal shifts), then yes so long as all the overlapping frequencies the two signals are 90 degrees out of phase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, for all positive $\omega$ that are overlapping, $h_1(\omega) = k_\omega h_2(\omega) e^{\pm i \tfrac{\pi}{2}}$, where $h_1$ and $h_2$ are the spectrums and $k_\omega$ is just a real scalar. The negative frequencies will be the conjugate of these.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you mean correlation with signal shifts (cross-correlation - similar to convolution) then no, because if both signals have the same non-zero frequency then at some shift the sinusoids will not be 90 degrees out of phase, and therefore correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More simply&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine a signal consisting of a sine wave and another consisting of a cosine wave of the same frequency. They will have overlapping spectrums (same frequency) but have zero correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add to the first signal a sinusoid of a certain frequency, and add to the second signal the same sinusoid but 90 degrees phase shifted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Barbara image with DC component removed, and Barbara image with DC removed and half spectrum multiplied by $i$ and the other half by $-i$ (90 degrees phase shift and conjugate for the negative frequencies)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ddN8H.png&quot; alt=&quot;enter image description here&quot;&gt;  &lt;img src=&quot;https://i.stack.imgur.com/qPtVc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their spectrums overlap completely but they have zero correlation (at shift 0).&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2015-07-04T01:24:06.607" LastActivityDate="2015-07-04T01:24:06.607" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24481" PostTypeId="1" CreationDate="2015-07-02T14:00:00.840" Score="0" ViewCount="1392" Body="&lt;p&gt;I am doing Speech dereverberation using Non-negative matrix factorization. I need to initialize an impulse response($H$) such that its reverberation time ($t_{60}$) is $300$ ms. Let the length of $H$ be $10$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of doing that by identically initializing each row of $H$ using a linearly decaying envelope. Somewhat like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=1:10;&#xA;h = exp(-x/2);&#xA;H = repmat(h,600,1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will give me a $H$ of dimension $600$ X $10$. But, I don't understand how to use $t_{60}$ for the initialization in MATLAB. Please tell me.&lt;/p&gt;&#xA;" OwnerUserId="16473" LastEditorUserId="7338" LastEditDate="2015-07-02T14:40:18.650" LastActivityDate="2020-02-25T04:38:43.813" Title="Initialize a Room Impulse Response using reverberation time(T60)" Tags="|matlab|impulse-response|speech-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24482" PostTypeId="2" ParentId="24481" CreationDate="2015-07-02T15:08:55.143" Score="1" Body="&lt;p&gt;A good method is to generate white noise apply an exponential envelope with the reverb time. In general you will need lots of samples. Typically 10s of thousands. If you want to get fancier you can window out the front part and put in a direct sound spike and a few discrete reflections. Below an example of how to create a simulated room impulse response with a given reverb time and sample rate&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% create an room impulse response with a given t60&#xA;fs = 44100; % sample rate in Hz&#xA;t60 = 0.35; % reverb time in seconds&#xA;% 1. Detemine the length of the impulse response. It's an infinite response&#xA;%    so some truncation is neccessary. A good starting point 1.5 times the&#xA;%    t60 which will result in 90 dB of dynamic range&#xA;n = round(fs*1.5*t60);&#xA;t = (0:n-1)'/fs;  % time vector&#xA;% 2. initialize to white noise, gaussian distributed&#xA;h = randn(n,1);&#xA;% 3. Calculate the decay. During the reverb time the envelope decays by 60&#xA;%    dB, so we have exp(decay*t60) = 1e-3; We can solve to&#xA;decay = log(1e-3)/t60;&#xA;% 4. Apply the envelope&#xA;h = h.*exp(decay.*t);&#xA;figure(1); clf&#xA;plot(t,h);&#xA;xlabel('Time in s');&#xA;&#xA;&#xA;%% we can calcuale the energy decay curve through reverse integration&#xA;decayCurveInDB = 10*log10(flipud(cumsum(flipud(h.^2))));&#xA;% normalize to 0 dB&#xA;decayCurveInDB = decayCurveInDB-decayCurveInDB(1);&#xA;% and plot it&#xA;figure(2);clf;&#xA;h = plot(t,decayCurveInDB);&#xA;set(h,'Linewidth',2);&#xA;xlabel('Time in s');&#xA;ylabel('Decay in dB');&#xA;% mark the t60 spot&#xA;hold on &#xA;set(gca,'ylim',[-100,0]);&#xA;y = get(gca,'ylim');&#xA;h = plot(t60*[1 1],y,'r');&#xA;set(h,'Linewidth',2);&#xA;grid('on');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-02T15:08:55.143" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24483" PostTypeId="2" ParentId="24476" CreationDate="2015-07-02T15:29:16.783" Score="2" Body="&lt;p&gt;&lt;code&gt;system.Telephone&lt;/code&gt; is just for detection of speech, that's why you get only init clusters.  You can use default &lt;code&gt;fr.lium.spkDiarization.system.Diarization&lt;/code&gt; it will do proper steps as described in &lt;a href=&quot;http://www-lium.univ-lemans.fr/diarization/doku.php/single-show_diarization&quot; rel=&quot;nofollow&quot;&gt;LIUM docs&lt;/a&gt;, result will be like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;;; cluster S0&#xA;file 1 0 1135 M S U S0&#xA;file 1 5722 300 M S U S0&#xA;file 1 9266 359 M S U S0&#xA;file 1 12670 370 M S U S0&#xA;;; cluster S1&#xA;file 1 1135 832 F S U S1&#xA;file 1 5372 350 F S U S1&#xA;file 1 6022 572 F S U S1&#xA;file 1 10167 1550 F S U S1&#xA;file 1 13040 466 F S U S1&#xA;file 1 13623 352 F S U S1&#xA;;; cluster S10 [ merge HCLR 0 = S10 in S11 with 1.208107727685253 ]&#xA;file 1 1967 693 F S U S10&#xA;file 1 2660 1644 F S U S10&#xA;file 1 4304 1068 F S U S10&#xA;file 1 6594 937 F S U S10&#xA;;; cluster S12&#xA;file 1 7531 429 F S U S12&#xA;file 1 8692 574 F S U S12&#xA;;; cluster S13&#xA;file 1 7960 732 M T U S13&#xA;;; cluster S16&#xA;file 1 9625 542 F S U S16&#xA;file 1 11717 953 F S U S16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;LIUM models included into jar are trained for 16khz, so the input should be better 16khz, you need to resample your 48khz file to 16khz before you feed into LIUM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to run on telephone speech, you might need to retrain mail/female/ubm models for that. It is also worth to note that LIUM models are trained for French, for other languages they should be better retrained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, LIUM is not expected to work out of box, you might need to spend some time to make it work properly.&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2015-07-02T15:29:16.783" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="24484" PostTypeId="2" ParentId="24348" CreationDate="2015-07-02T15:46:59.250" Score="3" Body="&lt;p&gt;I think your E-step is correct(only one term missing in the last expression: $-N\ln\sigma_w$ ). &#xA;To obtain the M-step you have to differentiate with respect to all your parameters. You don't have to include $u(n)$  in $\theta$, since it's defined by $p$. So you compute $\frac{\partial Q}{\partial\theta}=0$. Solving for $\theta$, and this is your new $\theta$ i.e. $\theta_{m+1}$. E.g. for $h$ we gets $\frac{\partial Q}{\partial h}=-(-2\sum y_nz_n^s+2h\sum P_n^s)/(2\sigma_w^2)=0$.&lt;br&gt;&#xA;Solving: $h=h_{m+1}=\sum y_nz_n^s(\sum P_n^s)^{-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-For $p$: &#xA;$Q'(p)=\sum z_n^s/p -(N-\sum z_n^s)/(1-p)=0,p=\sum z_n^s/N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is typical Bernoulli/binomial. So it seems right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-For $\sigma_w$:&#xA;$Q'(\sigma_w)=-(\sum y_n^2-2h^T\sum y_nz_n^s+h^Th\sum P_n^s)\cdot (-2/(2\sigma_w^3))-N/\sigma_w=0,&#xA;\sigma_w^2=(\sum y_n^2-2h^T\sum y_nz_n^s+h^Th\sum P_n^s)/N$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and updating the parameters in a loop until convergence. &lt;/p&gt;&#xA;" OwnerUserId="15215" LastEditorUserId="15215" LastEditDate="2015-07-03T15:31:12.653" LastActivityDate="2015-07-03T15:31:12.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24487" PostTypeId="1" CreationDate="2015-07-02T19:29:45.610" Score="11" ViewCount="13897" Body="&lt;p&gt;I'm new to the principle of calculating the instantaneous frequency, and came up with a lot of questions on it. You find them all in a bullet-point list at the end of this text. The text might be a little long, excuse me for that, but I really tried to work on that problem on my own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm interested in the instantaneous frequency &lt;span class=&quot;math-container&quot;&gt;$f(t)$&lt;/span&gt; of a real valued signal &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;. The calculation is done with the help of an analytic signal &lt;span class=&quot;math-container&quot;&gt;$z(t) = x(t) + j y(t)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt; is the Hilbert transformation of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate the instantaneous frequencies from the analytic signal &lt;span class=&quot;math-container&quot;&gt;$z(t)$&lt;/span&gt; I followed the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;ftp://ftp.ecn.purdue.edu/ayhan/Jeffrey/Calculation%20of%20instantaneous%20frequency%20and%20instantaneous%20bandwidth.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The calculation of instantaneous frequency and&#xA;instantaneous bandwidth&lt;/a&gt; by Arthur E. Barns from 1992. In this paper he introduces multiple methods to calculate the instantaneous frequency. I write down, all formulas he proposed (and I used) in a moment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &quot;learning&quot;, I played around with a very simple, and two a little more complex signals, in MATLAB, and wanted to get their instantaneous frequencies.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;                                            % sampling-rate = 1kHz&#xA;t = 0:1/Fs:10-1/Fs;                                    % 10s 'Timevector'&#xA;chirp_signal = chirp(t,0,1,2);                         % 10s long chirp-signal, signal 1&#xA;added_sinusoid = chirp_signal + sin(2*pi*t*10);        % chirp + sin(10Hz), signal 2&#xA;modulated_sinusoid = chirp_signal .* sin(2*pi*t*10);   % chirp * sin(10Hz), signal 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plots in time domain of those three signals look the following:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/4R848.jpg&quot; alt=&quot;Time domain plots&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plots of all instantaneous frequencies I got after applying all methods from the paper, are the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Instantaneous frequencies of pure chirp signal:&lt;/em&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/z5c2P.jpg&quot; alt=&quot;Instantaneous frequencies of pure chirp signal&quot;&gt;&#xA;&lt;em&gt;Instantaneous frequencies of chirp signal with added sinusoid:&lt;/em&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SHCRQ.jpg&quot; alt=&quot;Instantaneous frequencies of chirp signal with added sinusoid&quot;&gt;&#xA;&lt;em&gt;Instantaneous frequencies of modulated chirp signal:&lt;/em&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5fdmq.jpg&quot; alt=&quot;Instantaneous frequencies of modulated chirp signal&quot;&gt;&#xA;Please note, that in all three images, the y-axis of plot 3 and 4 are zoomed in, so the amplitudes of those signals are very tiny!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first possibility to get from the analytic signal to the instantaneous frequency is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;f_{2}(t) = \frac{1}{2\pi} \frac{d}{dt}\theta(t)&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\theta(t)$&lt;/span&gt; is the instantaneous phase. I think this is the most common method used today, at least on &lt;a href=&quot;http://de.mathworks.com/help/signal/ug/hilbert-transform-and-instantaneous-frequency.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MATLAB's webpage&lt;/a&gt; it is calculated that way. The code looks the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [instantaneous_frequency] = f2(analytic_signal,Fs)&#xA;    factor =  Fs/(2*pi);&#xA;    instantaneous_frequency = factor * diff(unwrap(angle(analytic_signal)));&#xA;    % Insert leading 0 in return-vector to maintain size&#xA;    instantaneous_frequency = [0 instantaneous_frequency];&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the paper Barns now suggest (or rather said compiles) four other ways to calculate instantaneous frequencies from the analytic signal. He also mentions the upper formula, but is the opinion that it is impractical due to ambiguities in the phase. I guess, he did not know of the &lt;code&gt;unwrap()&lt;/code&gt; method, or to be more precise the math behind it. (I, myself did learn about that method just today, when looking at some other source codes on instantaneous frequencies)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In his paper, the formula has label Number (2), therefore, I gave the f(t) the index 2. All other indexes correspond the same way to their numbers in the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the ambiguities in phase, he rather suggests:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;f_{3}(t) = \frac{1}{2\pi}\cdot\frac{\overbrace{x(t)y'(t)}^\text{a}-\overbrace{x'(t)y(t)}^{\text{b}}}{\underbrace{x(t)^2}_{\text{c}}+\underbrace{y(t)^2}_{\text{d}}}&#xA;\end{equation}&lt;/span&gt;&#xA;I introduced the symbols &quot;a&quot;,&quot;b&quot;,&quot;c&quot; and &quot;d&quot;, to make the programming a little easier:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [instantaneous_frequency] = f3(analytic_signal,Fs,T)&#xA;    x = real(analytic_signal);&#xA;    y = imag(analytic_signal);&#xA;    diff_x = diff(x);&#xA;    diff_y = diff(y);&#xA;    factor = Fs/(2*pi);&#xA;    a = x(2:end).*diff_y;&#xA;    b = y(2:end).*diff_x;&#xA;    c = x(2:end).^2;&#xA;    d = y(2:end).^2;&#xA;    instantaneous_frequency = factor * ((a-b)./(c+d));&#xA;    % Insert leading 0 in return-vector to maintain size&#xA;    instantaneous_frequency = [0 instantaneous_frequency];&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then Barner gives three more formulas which he names &quot;instantaneous frequency approximations&quot;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;f_{9}(t) = \frac{1}{2\pi T}\cdot\text{arctan}\left[\frac{\overbrace{x(t)y(t+T)}^{\text{a}}-\overbrace{x(t+T)y(t)}^{\text{b}}}{\underbrace{x(t)x(t+T)}_{\text{c}}+\underbrace{y(t)y(t+T)}_{\text{d}}}\right]&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function[instantaneous_frequency] = f9(analytic_signal, Fs, T)&#xA;    x = real(analytic_signal);&#xA;    y = imag(analytic_signal);&#xA;    factor = Fs/(2*pi*T);&#xA;    a = x(1:end-T).*y(1+T:end);&#xA;    b = x(1+T:end).*y(1:end-T);&#xA;    c = x(1:end-T).*x(1+T:end);&#xA;    d = y(1:end-T).*y(1+T:end);&#xA;    instantaneous_frequency = factor.*atan((a-b)./(c+d));&#xA;    % Append 0 to return-vector to maintain size&#xA;    instantaneous_frequency = [instantaneous_frequency zeros(1,T)];&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;f_{11}(t) = \frac{1}{4\pi T}\cdot\text{arctan}\left[\frac{\overbrace{x(t-T)y(t+T)}^{\text{a}}-\overbrace{x(t+T)y(t-T)}^{\text{b}}}{\underbrace{x(t-T)x(t+T)}_{\text{c}}+\underbrace{y(t-T)y(t+T)}_{\text{d}}}\right]&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [instantaneous_frequency] = f11(analytic_signal, Fs, T)&#xA;    x = real(analytic_signal);&#xA;    y = imag(analytic_signal);&#xA;    factor = Fs/(4*pi*T);&#xA;    a = x(1:end-2*T).*y(1+2*T:end);&#xA;    b = x(1+2*T:end).*y(1:end-2*T);&#xA;    c = x(1:end-2*T).*x(1+2*T:end);&#xA;    d = y(1:end-2*T).*y(1+2*T:end);&#xA;    instantaneous_frequency = factor.*atan((a-b)./(c+d));&#xA;    % Append and insert 0s to maintain size&#xA;    instantaneous_frequency = [zeros(1,T) instantaneous_frequency zeros(1,T)];&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;f_{14}(t)=\frac{2}{\pi T}\left[\frac{\overbrace{x(t)y(t+T)}^{\text{a}}-\overbrace{x(t+T)y(t)}^{\text{b}}}{\underbrace{(x(t)+x(t+T))^2}_{\text{c}}+\underbrace{(y(t)+y(t+T))^2}_{\text{d}}}\right]&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [instantaneous_frequency] = formula14(analytic_signal, Fs, T);&#xA;    x = real(analytic_signal);&#xA;    y = imag(analytic_signal);&#xA;    factor = 2*Fs/(pi*T);&#xA;    a = x(1:end-T).*y(1+T:end);&#xA;    b = x(1+T:end).*y(1:end-T);&#xA;    c = (x(1:end-T)+x(1+T:end)).^2;&#xA;    d = (y(1:end-T)+y(1+T:end)).^2;&#xA;    instantaneous_frequency = factor * ((a-b)./(c+d));&#xA;    % Append and insert 0s to maintain size&#xA;    instantaneous_frequency = [instantaneous_frequency zeros(1,T)];&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In all 3 approximation Formulas T was set to Fs (T = Fs = 1000 = 1s), as suggested in the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question's are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Formulas f2 and f3 return the same result for the pure chirp signal. I think that's good, as they do calculate the same. The three approximation methods do not return the same, not even something which is close to it! Why is that the case? (I hope it is not just an programming-bug...)&lt;/li&gt;&#xA;&lt;li&gt;Although they return the same, especially at the end of the plot they start to 'wiggle' &lt;em&gt;a lot&lt;/em&gt;. What is the explanation for that? I first thought of something like aliasing, but my sampling frequency is quite high, compared to the signals' frequency, so I think that can be excluded.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At least f2 and f3 seem to work appropriate on a pure chirp signal, but all methods, including f2 and f3 seem to fail horrible, when it comes to more than one frequency in the signal. In reality having more than one frequency in a signal is rather always the case. So how can one get the (more or less) correct instantaneous frequency?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I actually don't even know what to expect, when more than one frequency is present in the signal. The calculation returns one number for a given point in time, so what should it do when, like here, more frequencies are present? Return the average of all frequencies or something like that?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And my probably &lt;em&gt;most important question&lt;/em&gt; is, how is that handled in a real and elaborated software? Let's say I want to know the instantaneous frequency of the modulated signal at 1.75 s, and I chose method f2, than I can be 'lucky' and get a number close to 6[Hz] which is most likely the correct answer, or I pick my results few samples next to it and suddenly I get some wired, way to high, result, because I unfortunately picked a value in the spike. How can this be handled? By postprocessing it with mean or even better a median filter? I think even that might get really difficult especially in regions where many spikes are next to each other.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And one last, not so important question, why is it that most papers I find on instantaneous frequencies are from the area of geography, especially in calculating seismographic events like earthquakes. Barne's paper also takes that as an example. Isn't the instantaneous frequency interesting in many areas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's it so far, I'm very thankful for every reply, especially when somebody gives me tips on how to implement it in an &lt;em&gt;real software project&lt;/em&gt; ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kind regards,&#xA;Patrick&lt;/p&gt;&#xA;" OwnerUserId="4778" LastEditorUserId="36150" LastEditDate="2019-09-10T10:09:13.400" LastActivityDate="2019-09-10T10:09:13.400" Title="Calculate and interpret the instantaneous frequency" Tags="|signal-analysis|frequency|phase|hilbert-transform|analytic-signal|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24488" PostTypeId="1" AcceptedAnswerId="24616" CreationDate="2015-07-02T20:29:53.930" Score="0" ViewCount="2277" Body="&lt;p&gt;I think I have a bug in my understanding of the complex FFT and it's leading me to get half of my expected frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to calculate the frequency of an input signal of known frequency (440Hz) using the FFT. My sampling rate is 8kHz, which is well above the Nyquist rate, and I'm using an analog filter with a knee at 4kHz. I toggle a pin on each sample and measure with the oscilloscope, so I know it's sampling at 8kHz. (maybe I am wrong there?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;I have the same results for triangular, square, and sinusoidal inputs.  They are created by a 555-Timer and are completely positive (ranging from 0-5V) with a DC offset of around 2.5.  Here is an example of the (more-or-less) triangular input (after sampling):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;{&quot;2560&quot;, &quot;2C00&quot;, &quot;3390&quot;, &quot;3970&quot;, &quot;4000&quot;, &quot;4610&quot;, &quot;4C30&quot;, &quot;51A0&quot;, \&#xA;  &quot;5700&quot;, &quot;5C70&quot;, &quot;61D0&quot;, &quot;65E0&quot;, &quot;6BD0&quot;, &quot;70A0&quot;, &quot;7500&quot;, &quot;7980&quot;, \&#xA;  &quot;7DF0&quot;, &quot;7FF0&quot;, &quot;78C0&quot;, &quot;6860&quot;, &quot;59E0&quot;, &quot;4BC0&quot;, &quot;3FE0&quot;, &quot;3370&quot;, \&#xA;  &quot;2880&quot;, &quot;1E10&quot;, &quot;1450&quot;, &quot;0AA0&quot;, &quot;0230&quot;, &quot;01B0&quot;, &quot;0A50&quot;, &quot;1200&quot;, \&#xA;  &quot;1A10&quot;, &quot;2140&quot;, &quot;28A0&quot;, &quot;2F50&quot;, &quot;3650&quot;, &quot;3C40&quot;, &quot;4300&quot;, &quot;4870&quot;, \&#xA;  &quot;4EC0&quot;, &quot;5400&quot;, &quot;59B0&quot;, &quot;5EF0&quot;, &quot;6400&quot;, &quot;6900&quot;, &quot;6DF0&quot;, &quot;72A0&quot;, \&#xA;  &quot;7720&quot;, &quot;7B70&quot;, &quot;7FC0&quot;, &quot;7FF0&quot;, &quot;7130&quot;, &quot;61A0&quot;, &quot;53A0&quot;, &quot;46A0&quot;, \&#xA;  &quot;3A30&quot;, &quot;2E80&quot;, &quot;23B0&quot;, &quot;1950&quot;, &quot;0FE0&quot;, &quot;06E0&quot;, &quot;FE50&quot;, &quot;0540&quot;, \&#xA;  &quot;0D80&quot;, &quot;1590&quot;, &quot;1D30&quot;, &quot;2480&quot;, &quot;2BA0&quot;, &quot;3230&quot;, &quot;3900&quot;, &quot;3ED0&quot;, \&#xA;  &quot;4550&quot;, &quot;4B60&quot;, &quot;5130&quot;, &quot;5650&quot;, &quot;5C20&quot;, &quot;6100&quot;, &quot;65D0&quot;, &quot;6B30&quot;, \&#xA;  &quot;6FE0&quot;, &quot;7480&quot;, &quot;7910&quot;, &quot;7D30&quot;, &quot;7FF0&quot;, &quot;7AD0&quot;, &quot;6AD0&quot;, &quot;5BC0&quot;, \&#xA;  &quot;4E30&quot;, &quot;4170&quot;, &quot;34F0&quot;, &quot;29C0&quot;, &quot;1F50&quot;, &quot;1550&quot;, &quot;0BF0&quot;, &quot;0370&quot;, \&#xA;  &quot;0040&quot;, &quot;08E0&quot;, &quot;1150&quot;, &quot;18B0&quot;, &quot;2020&quot;, &quot;2780&quot;, &quot;2E30&quot;, &quot;3530&quot;, \&#xA;  &quot;3B40&quot;, &quot;4190&quot;, &quot;47B0&quot;, &quot;4DA0&quot;, &quot;5370&quot;, &quot;58C0&quot;, &quot;5E20&quot;, &quot;62D0&quot;, \&#xA;  &quot;6910&quot;, &quot;6CD0&quot;, &quot;74C0&quot;, &quot;7650&quot;, &quot;7B30&quot;, &quot;7EA0&quot;, &quot;7FF0&quot;, &quot;73F0&quot;, \&#xA;  &quot;6470&quot;, &quot;5600&quot;, &quot;47F0&quot;, &quot;3BD0&quot;, &quot;3000&quot;, &quot;2530&quot;, &quot;1B30&quot;, &quot;1120&quot;, \&#xA;  &quot;08B0&quot;, &quot;FFD0&quot;, &quot;04C0&quot;, &quot;0C80&quot;, &quot;1490&quot;, &quot;1C40&quot;, &quot;2340&quot;, &quot;2A70&quot;, \&#xA;  &quot;3140&quot;, &quot;3760&quot;, &quot;3E10&quot;, &quot;4470&quot;, &quot;4A20&quot;, &quot;4FF0&quot;, &quot;55F0&quot;, &quot;5B70&quot;, \&#xA;  &quot;6000&quot;, &quot;65B0&quot;, &quot;6AA0&quot;, &quot;6F00&quot;, &quot;7410&quot;, &quot;7820&quot;, &quot;7CF0&quot;, &quot;7FF0&quot;, \&#xA;  &quot;7DF0&quot;, &quot;6D00&quot;, &quot;5E20&quot;, &quot;5030&quot;, &quot;4340&quot;, &quot;3680&quot;, &quot;2B80&quot;, &quot;20F0&quot;, \&#xA;  &quot;1740&quot;, &quot;0D80&quot;, &quot;04F0&quot;, &quot;FC70&quot;, &quot;0780&quot;, &quot;0FB0&quot;, &quot;17B0&quot;, &quot;1F40&quot;, \&#xA;  &quot;2650&quot;, &quot;2D30&quot;, &quot;3410&quot;, &quot;3A60&quot;, &quot;4100&quot;, &quot;46F0&quot;, &quot;4CD0&quot;, &quot;5290&quot;, \&#xA;  &quot;5860&quot;, &quot;5D10&quot;, &quot;6300&quot;, &quot;6790&quot;, &quot;6C80&quot;, &quot;7200&quot;, &quot;75F0&quot;, &quot;7A40&quot;, \&#xA;  &quot;7EC0&quot;, &quot;7FF0&quot;, &quot;75D0&quot;, &quot;6640&quot;, &quot;57B0&quot;, &quot;4A60&quot;, &quot;3D80&quot;, &quot;30B0&quot;, \&#xA;  &quot;22E0&quot;, &quot;1CA0&quot;, &quot;12D0&quot;, &quot;09F0&quot;, &quot;0120&quot;, &quot;0290&quot;, &quot;0B40&quot;, &quot;1350&quot;, \&#xA;  &quot;1B40&quot;, &quot;2230&quot;, &quot;2970&quot;, &quot;3000&quot;, &quot;3700&quot;, &quot;3D70&quot;, &quot;4360&quot;, &quot;4940&quot;, \&#xA;  &quot;4F50&quot;, &quot;5490&quot;, &quot;5A40&quot;, &quot;5F70&quot;, &quot;64B0&quot;, &quot;69C0&quot;, &quot;6EB0&quot;, &quot;72F0&quot;, \&#xA;  &quot;77C0&quot;, &quot;7BD0&quot;, &quot;7FF0&quot;, &quot;7FF0&quot;, &quot;6FC0&quot;, &quot;60B0&quot;, &quot;52A0&quot;, &quot;4550&quot;, \&#xA;  &quot;3930&quot;, &quot;2D90&quot;, &quot;22C0&quot;, &quot;18A0&quot;, &quot;0F50&quot;, &quot;0640&quot;, &quot;FE00&quot;, &quot;0600&quot;, \&#xA;  &quot;0E60&quot;, &quot;1600&quot;, &quot;1DD0&quot;, &quot;2510&quot;, &quot;2C20&quot;, &quot;3270&quot;, &quot;3970&quot;, &quot;3F80&quot;, \&#xA;  &quot;45B0&quot;, &quot;4B90&quot;, &quot;5170&quot;, &quot;56C0&quot;, &quot;5C80&quot;, &quot;61A0&quot;, &quot;66A0&quot;, &quot;6B80&quot;, \&#xA;  &quot;70A0&quot;, &quot;74D0&quot;, &quot;7960&quot;, &quot;7DA0&quot;, &quot;7FF0&quot;, &quot;7900&quot;, &quot;69A0&quot;, &quot;5A70&quot;}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uCmJZ.png&quot; alt=&quot;Triangular input after normalizing to 1.&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set a breakpoint after the ADC has collected all 256 points, and when I graph it one cycle takes around 17 points &lt;strong&gt;(ACTUALLY 33)&lt;/strong&gt;. Each point is 1/8000=.000125s, so one period is &lt;strong&gt;.004125&lt;/strong&gt; , which gives me &lt;strong&gt;242Hz&lt;/strong&gt;. Not perfect, but also not the cause of my problem. &lt;strong&gt;(Edited: I read the period incorrectly.  Therefore, the FFT data is correct, but the sampling only gets either half the data or is somehow sampling too slowly.  Any ideas?)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I run an FFT on these datapoints in Mathematica, I get that the 8th bin has the greatest magnitude, which would give a frequency of 8*(8000/256) = 250Hz and half of what I expect. (well, more than half, but the frequency resolution is about 31.25 Hz/bin)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take the 256 data points and plug them into the first half of a 256-point fractional complex array in the microcontroller. Then I reorder the data so that they are every other point in the array, and fill in 0's for the complex values. Then I run the FFT from the Microchip library and also get bin 8.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I using the complex FFT or the bin number incorrectly? If so, could someone please explain where I'm going astray?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: The following picture is referenced in a comment to Peter K's answer.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Z9uJ3.png&quot; alt=&quot;Complex_DFT_visual&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="9071" LastEditorUserId="9071" LastEditDate="2015-07-09T16:48:16.637" LastActivityDate="2015-07-10T12:19:01.027" Title="FFT frequency is always half of expected" Tags="|fft|sampling|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24491" PostTypeId="2" ParentId="24487" CreationDate="2015-07-02T22:37:45.740" Score="4" Body="&lt;p&gt;Not really an answer but maybe helpful: Personally I found that the concept of instantaneous frequency is only useful for sufficiently narrow band signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the simple example of two steady sine waves, say 100Hz and 934Hz. In this case you can certainly define and calculate the instantaneous frequency (in whatever way you want) but what should the result be? What possible insight or properties can the instantaneous frequency have that say anything meaningful about the signal? Applying the concept of instantaneous frequency to signals that have multiple frequencies at the same time, simply doesn't make a lot of sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why you get decent results for the sweeps but odd curves for the Sweep+sine. It's also the reason why you see the wiggles a the high part of the sweep. The bandwidth of the signal gets too high to assign a single frequency number to it and so the results jumps around.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-02T22:37:45.740" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24492" PostTypeId="2" ParentId="24487" CreationDate="2015-07-02T22:58:57.817" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;At least f2 and f3 seem to work appropriate on a pure chirp signal, but all methods, including f2 and f3 seem to fail horrible, when it comes to more than one frequency in the signal. In reality having more than one frequency in a signal is rather always the case. So how can one get the (more or less) correct instantaneous frequency?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;as Hilmar suggests, the Hilbert transform (or &quot;Analytic Signal&quot;) method does not work on wide-band because there are more than one frequency component.  you can do this method &lt;strong&gt;only&lt;/strong&gt; for a single sinusoidal component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, with the Analytic Signal approach, what you want to do is make use of this identity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \arctan u - \arctan v = \arctan \left( \frac{u-v}{1+uv} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $|u-v|$ is small enough, which you can derive Barner's &quot;$f_9$&quot; formula from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but there must be only one time-varying sinusoid in the Hilbert transform calculation to do that correctly.  and you better line up the &quot;in-phase&quot; component with the output of the Hilbert transform (which is delayed with a causal FIR filter).  otherwise you'll get crap.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-07-02T22:58:57.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24493" PostTypeId="2" ParentId="24473" CreationDate="2015-07-02T23:21:42.787" Score="0" Body="&lt;p&gt;Let $x(t)$ and $y(t)$ denote two complex-valued signals. Their crosscorrelation function is given by&#xA;$$R_{x,y}(t) = \int_{-\infty}^\infty x(\tau)[y(\tau-t)]^* \,\mathrm d\tau&#xA;\tag{1}$$&#xA;where $\,^*$ denotes complex conjugate. The Fourier transform of the crosscorrelation function&#xA;$R_{x,y}(t)$ is $S_{x,y}(f)$, which is sometimes called the cross-spectral density, happens to satisfy the identity &#xA;$$S_{x,y}(f) = X(f)[Y(f)]^*, ~ -\infty &amp;lt; f &amp;lt; \infty, \tag{2}$$&#xA;where $X(f)$ and $Y(f)$ are the Fourier transforms of $x(t)$ and $y(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signals $x(t)$ and $y(t)$ are said to be &lt;em&gt;uncorrelated&lt;/em&gt;&#xA;if $R_{x,y}(t)$ equals $0$ for all $t, -\infty &amp;lt; t &amp;lt; \infty$.&#xA;I leave it for&#xA;you to decide whether the property $R_{x,y}(t)=0$ for all $t$ is compatible with the&#xA;claim that there is an interval $G$ on the frequency axis such&#xA;that $X(f) \neq 0$ and $Y(f) \neq 0$ for &lt;em&gt;all&lt;/em&gt; $f \in G$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-07-02T23:21:42.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24494" PostTypeId="2" ParentId="24487" CreationDate="2015-07-02T23:30:12.407" Score="1" Body="&lt;p&gt;Wow, what a huge question.  I'm going to answer the not-so-important question first:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And one last, not so important question, why is it that most papers I find on instantaneous frequencies are from the area of geography, especially in calculating seismographic events like earthquakes. Barne's paper also takes that as an example. Isn't the instantaneous frequency interesting in many areas?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The reason is that the &lt;a href=&quot;http://www.terrexseismic.com/terrex-seismic/equipment/vibroseis-trucks.aspx&quot; rel=&quot;nofollow&quot;&gt;seismographic system &quot;vibroseis&quot;&lt;/a&gt; is used in the oil industry to do seismic surveys.  The trucks I've linked to vibrate from about 5 Hz to about 90 Hz and can be made to do chirp signals.  There is much money in the oil industry, and processing the returns from these signals can be very, very lucrative. Hence, many people have spent many hours analyzing such signals, including looking at instantaneous frequency techniques.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As for your more important questions: generally, doing arithmetic differences and calculating arctangents on discrete-time signals is a Bad Thing$^{\rm TM}$.  This is because discrete-time frequency estimates need to be calculated using &quot;circular arithmetic&quot; (AKA vector arithmetic).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.cecs.anu.edu.au/~williams/papers/P12.pdf&quot; rel=&quot;nofollow&quot;&gt;Check out this paper.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Better approaches tend to use &quot;phase weighted averagers&quot; as implemented &lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. &lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms/wlp&quot; rel=&quot;nofollow&quot;&gt;Or here for a direct link to the matlab&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-07-02T23:40:44.543" LastActivityDate="2015-07-02T23:40:44.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24495" PostTypeId="2" ParentId="24363" CreationDate="2015-07-03T05:29:07.920" Score="0" Body="&lt;p&gt;I believe that if you will keep the phases and not convert it into magnitude (power spectrum) the IFFT will work. When you use the center frequency, the phase is 0, in other words, the real part is also the magnitude. As you move from the center frequency the error in magnitude growth as the phase growth. As result your error in recovery by means of IFFT growth.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-07-03T05:29:07.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24496" PostTypeId="1" AcceptedAnswerId="24501" CreationDate="2015-07-03T07:56:18.350" Score="1" ViewCount="2439" Body="&lt;p&gt;I have a real 2d matrix. I am taking its fft using &lt;code&gt;fftw&lt;/code&gt;. But the result of using a real to complex fft is different from a complex ( with imaginary part equal to zero) to complex fft. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;real matrix&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0     1     2&#xA; 3     4     5&#xA; 6     7     8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;result of real to complex fft&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;36 -4.5+2.59808i  -13.5+7.79423i &#xA;0  -13.5-7.79423i 0 &#xA;0  0              0 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int r = 3, c = 3;&#xA;int sz = r * c;&#xA;double *in = (double*) malloc(sizeof(double) * sz);&#xA;fftw_complex *out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * sz);&#xA;fftw_plan p = fftw_plan_dft_r2c_2d(r, c, in, out, FFTW_MEASURE);&#xA;for ( int i=0; i&amp;lt;r; ++i ){&#xA;    for ( int j=0; j&amp;lt;c; ++j ){&#xA;        in[i*c+j] = i*c + j;&#xA;    }&#xA;}&#xA;fftw_execute(p);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;using a complex matrix with imaginary part of zero&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;complex matrix&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 0+0i     1+0i     2+0i&#xA; 3+0i     4+0i     5+0i&#xA; 6+0i     7+0i     8+0i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;result of complex to complex fft&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;36               -4.5 + 2.59808i  -4.5 - 2.59808i &#xA;-13.5 + 7.79423i 0               0 &#xA;-13.5 - 7.79423i 0               0  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int r = 3, c = 3;&#xA;int sz = r * c;&#xA;fftw_complex *out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * sz);&#xA;fftw_complex *inc = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * sz);&#xA;p = fftw_plan_dft_2d( r,c, inc, out, FFTW_FORWARD,FFTW_MEASURE);&#xA;for ( int i=0; i&amp;lt;r; ++i ){&#xA;    for ( int j=0; j&amp;lt;c; ++j ){&#xA;        inc[i*c+j][0] = i*c+j;&#xA;        inc[i*c+j][1] = 0;&#xA;    }&#xA;}&#xA;fftw_execute(p);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am after the result of complex to complex fft. But the real to complex fft is much faster and my data is real. Am I making a programming mistake or the result should be different?&lt;/p&gt;&#xA;" OwnerUserId="16402" LastActivityDate="2015-07-03T10:33:17.807" Title="Difference between real fft and complex fft with imaginary part of zero in fftw?" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24498" PostTypeId="2" ParentId="24037" CreationDate="2015-07-03T09:19:34.077" Score="1" Body="&lt;p&gt;You are very likely to observe trends in either your camera or your light source. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sources from the camera can include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;thermal effects inside the sensor (basically, the more you use it, the more current will traverse it in various parts and it will get warmer)&lt;/li&gt;&#xA;&lt;li&gt;drift in the ADC of your sensor (probably linked to the aforementioned).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, light sources can also drift with time: thermal effects will influence light bulbs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try to mitigate these effects by:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;changing your light source (I would assume LED lamps are more stable, but this needs to be checked)&lt;/li&gt;&#xA;&lt;li&gt;waiting long enough before starting the measurements in order to avoid transitory phenomenon&lt;/li&gt;&#xA;&lt;li&gt;carefully playing with the settings of your camera. Typically, I would fix manually all the exposure-related settings (exposure time, gain, framerate...) so that the autocontrols do not make vary the exposure values when an object enters the scene. However, this will prevent the camera from tracking natural scene trends.&lt;/li&gt;&#xA;&lt;li&gt;simply fitting a linear regression to your signal in order to remove the trend while processing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1355" LastActivityDate="2015-07-03T09:19:34.077" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24500" PostTypeId="1" CreationDate="2015-07-03T10:29:05.990" Score="0" ViewCount="1483" Body="&lt;p&gt;I need to compute period, amplitude and phase of the signal from spectrum analyser. It looks like a sine wave. Since i am new to MATLAB and also have limited idea about Fourier transforms, I am looking for a simplified explanation of how i might use FFT to compute period, phase and amplitude through MATLAB programming. The information i have regarding signal are: &lt;code&gt;sweep time: 0.3183s sweep: 2001 save loop: 100&lt;/code&gt;. Thank you so much in anticipation.&lt;/p&gt;&#xA;" OwnerUserId="16484" LastEditorUserId="15794" LastEditDate="2015-07-07T14:47:44.457" LastActivityDate="2016-08-03T06:02:27.220" Title="Period, amplitude and phase through FFT in MATLAB" Tags="|matlab|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24501" PostTypeId="2" ParentId="24496" CreationDate="2015-07-03T10:33:17.807" Score="1" Body="&lt;p&gt;I haven't tried this myself but I think it's just a problem of ordering the output data. In the real-to-complex case, your output matrix is not a $3\times 3$ matrix, but - due to the implied symmetry - a $3 \times 2$ matrix. So re-arranging your output gives&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 36            -4.5+2.59808i&#xA;-13.5+7.79423i  0&#xA;-13.5-7.79423i  0  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the &quot;missing&quot; third column would just be the complex conjugate of the second column. This is also explained &lt;a href=&quot;http://www.fftw.org/doc/Multi_002dDimensional-DFTs-of-Real-Data.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-03T10:33:17.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24502" PostTypeId="1" AcceptedAnswerId="24519" CreationDate="2015-07-03T13:13:24.393" Score="0" ViewCount="437" Body="&lt;p&gt;How are Chebyshev polynomials used in wavetables for audio synthesis? I dont understand how to store these inside wavetables? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does the synthesized audio result in matching to the correct index in the wavetable and what part of the Chebyshev polynomials are actually stored in the wavetable?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2015-07-03T19:17:20.240" LastActivityDate="2015-07-04T14:16:15.543" Title="Using Chebyshev polynomials in wavetables" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24503" PostTypeId="1" CreationDate="2015-07-03T15:15:03.120" Score="2" ViewCount="819" Body="&lt;p&gt;Relationship between magnitude response and phase response for minimum phase is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dkvic.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase plots are obtained from Hilbert transform of real magnitude values. Input to Hilbert transform was a vector (array) of real magnitude values in dB. Magnitude vs. frequency (Fig. 1.) is a raised-cosine function defining a Mesa filter with plateau. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I obtained phase values in two ways. In Fig. 2. the resulting phase plot (phase from the previous formula, not the phase from analytic signal) is obtained from SciLab using command &lt;code&gt;x = -hilbert(xr)&lt;/code&gt;, printing &lt;code&gt;imag(x)&lt;/code&gt;. Variable xr is vector holding magnitude values. In Fig. 3. the phase plot (phase from the previous formula, not the phase from analytic signal) is obtained from C implementation of Hilbert transform taken from &lt;a href=&quot;http://www.physionet.org/physiotools/apdet/apdet-1.0/ht.c&quot; rel=&quot;nofollow noreferrer&quot;&gt;ht.c&lt;/a&gt; file on the web. Hilbert transform here is implemented as convolution and the values are in &lt;code&gt;xh[i]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although similar, the phase plots on Fig. 2. and Fig. 3. are quite different. Any insights why I am getting two different graphs of phase?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ogUSN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="15718" LastEditDate="2015-07-06T12:01:28.503" LastActivityDate="2015-07-06T12:01:28.503" Title="Hilbert Transform, filters - two different phase graphs" Tags="|filters|phase|dsp-core|hilbert-transform|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24505" PostTypeId="1" AcceptedAnswerId="24508" CreationDate="2015-07-03T19:36:10.317" Score="0" ViewCount="694" Body="&lt;p&gt;I have a function :&#xA;\begin{equation}&#xA;C(t)=\left(1.42*\exp^{-1.192t}- 12.44*\exp^{-1.192t} +11.02 \right) u(t)&#xA;\end{equation}&#xA;where u(t) is a unit-step function&#xA;What is its fourier transform? a step by step breakdown would greatly be appreciated: notably how would you manage the fact that it is a summation, would the linearity of a fourier property apply? How would you compute the power and the phase of the sum?&lt;/p&gt;&#xA;" OwnerUserId="16213" LastActivityDate="2015-07-05T00:57:18.867" Title="Fourier transform of a sum" Tags="|fourier-transform|power-spectral-density|linear-phase|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24507" PostTypeId="1" AcceptedAnswerId="24510" CreationDate="2015-07-03T20:30:34.610" Score="0" ViewCount="909" Body="&lt;p&gt;this is the only code I know, but it is for one specific frequency and not for its harmonic series, I am trying to get all the partials as individual files, eg. If I want to generate 40hz sine wavwrite file and its harmonic series which would be 40-80-120-140hz etc, about 551 individual audio sine wav files all at harmonic series frequency values in one go generated with an Matlab Code...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 44100; % sampling frequency&#xA;nbits= 16;&#xA;file = 'output.wav'&#xA;d = 40; % duration&#xA;f = 60; % wave frequency&#xA;phi = pi/2; % phase shift - will produce cosinusoid for pi/2&#xA;t = linspace(1/fs, d, d*fs); % time vector&#xA;y = sin(2*pi*f*t + phi);&#xA;plot(t,y);&#xA;wavwrite( y, fs, nbits, file)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8684" LastEditorUserId="8684" LastEditDate="2015-07-03T21:21:34.090" LastActivityDate="2015-07-05T00:26:23.303" Title="How can I generate audio wave files of harmonic series/partials for a specific frequency in Matlab" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24508" PostTypeId="2" ParentId="24505" CreationDate="2015-07-03T21:12:59.833" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;would the linearity of a fourier property apply?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Of course, why not?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How would you compute the power and the phase of the sum?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Computing each term in complex numbers, summing and converting to power/phase representation&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a step by step breakdown would greatly be appreciated&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\begin{split}&#xA;C(t)&amp;amp;=\left(1.42 \exp^{-1.192t}- 12.44 \exp^{-1.192t} +11.02 \right) u(t) \\&#xA; &amp;amp; = 1.42 \exp^{-1.192t} u(t) - 12.44 \exp^{-1.192t} u(t) +11.02 u(t)&#xA;\end{split}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\mathcal{F}(C(t)) = 1.42 \mathcal{F}\left( \exp^{-1.192t} u(t)\right) - 12.44 \mathcal{F}\left(\exp^{-1.192t} u(t)\right) + 11.02\mathcal{F}\left( u(t)\right)&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you go from here? And why aren't you summing your exponential terms?&lt;/p&gt;&#xA;" OwnerUserId="15743" LastActivityDate="2015-07-03T21:12:59.833" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24509" PostTypeId="1" AcceptedAnswerId="24511" CreationDate="2015-07-03T22:10:42.573" Score="0" ViewCount="925" Body="&lt;p&gt;I'm trying to test some intuition using the matplotlib specgram routine. I first generate a simple sine wave&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.mlab as mlab&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;&#xA;t = linspace(0,100,1000)&#xA;omega = 2*np.pi*1&#xA;y = np.sin(omega*t)&#xA;plt.plot(t,y)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This generates the expected image of a sine wave&lt;img src=&quot;https://i.stack.imgur.com/DIlw1.png&quot; alt=&quot;sine wave&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can also look at the mod squared of the FFT of this signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;the_fft = np.fft(y)&#xA;spacing = t[1] - t[0]&#xA;ps = the_fft * np.conj(the_fft)&#xA;freqs = np.fft.fftfreq(len(t),spacing)&#xA;idx = np.argsort(freqs)&#xA;plt.plot(freqs[idx],ps[idx])&#xA;plt.show() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which gives me the square of the Fourier transform, which has a peak at 1 as expected (since my frequency is 1). &lt;img src=&quot;https://i.stack.imgur.com/Z3Lx6.png&quot; alt=&quot;fft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then try to compute the specgram, as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;_ = plt.specgram(the_fft,NFFT=100,noverlap=0,Fs=1./spacing,window=mlab.window_none)&#xA;plt.show()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which then gives me this &lt;img src=&quot;https://i.stack.imgur.com/lu73N.png&quot; alt=&quot;specgram&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this it's not easy to tell that the only frequency present in the signal is 1. What needs to be done in the specgram call to see this? Of course this is probably the expected output of this, so I'm really also asking a basic DSP question at the same time. &lt;/p&gt;&#xA;" OwnerUserId="11368" LastEditorUserId="11368" LastEditDate="2015-07-03T22:23:42.613" LastActivityDate="2015-07-03T23:25:51.807" Title="Why does the specgram of this simple sine wave look strange?" Tags="|fourier-transform|python|power-spectral-density|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24510" PostTypeId="2" ParentId="24507" CreationDate="2015-07-03T22:14:50.367" Score="1" Body="&lt;p&gt;use a for loop to save each frequency into a different named wav file, use string manipulation command num2str() of Matlab. The following will help:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc; clear all; close all;&#xA;&#xA;Fs = 44100;         % Sampling frequency&#xA;F0 = 200;            % base frequency&#xA;t = [0:1/Fs:0.1];   % time index&#xA;k = 0;              % harmonic index&#xA;&#xA;for fsine=F0:F0:Fs/2&#xA;    x = sin(2*pi*fsine*t);&#xA;    filename = ['wav' num2str(k)];&#xA;    wavwrite(x, Fs,16, filename);&#xA;    k = k+1;  &#xA; end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-07-05T00:26:23.303" LastActivityDate="2015-07-05T00:26:23.303" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24511" PostTypeId="2" ParentId="24509" CreationDate="2015-07-03T23:25:51.807" Score="0" Body="&lt;p&gt;You are computing the spectrogram of the DFT as if it were a time signal. Try this instead&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.mlab as mlab&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;&#xA;t = np.linspace(0,100,1000)&#xA;omega = 2*np.pi*1&#xA;y = np.sin(omega*t)&#xA;&#xA;spacing = t[1] - t[0]&#xA;plt.specgram(y,NFFT=100,noverlap=0,Fs=1./spacing,window=mlab.window_none)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15743" LastActivityDate="2015-07-03T23:25:51.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24512" PostTypeId="1" CreationDate="2015-07-03T23:29:05.367" Score="6" ViewCount="1169" Body="&lt;p&gt;I want to remove a noise for an image using MATLAB, when the observed image is &#xA;$$f=u+v$$&#xA;where $u$ is the restored image (is the image i want recovered) and $v$ is the gaussian noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To restore $u$, I solve the following minimization problem:&#xA;$$\min_{u \in H^1(\Omega)} \int_\Omega \gamma|\nabla u(x)|^2dx+  \int_\Omega (f(x)-u(x))^2dx,$$&#xA;where $\gamma$ is the regularization coefficient and $\Omega=[0,n]\times[0,m]$ and $[n,m]=$size($u$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to solve the PDE (Euler-Lagrange) using MATLAB:&#xA;\begin{eqnarray}&#xA;div(\gamma \nabla u) + u = f \;in \;\Omega \\&#xA;\frac{\partial u}{\partial n}=0 \; in \; \partial \Omega&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me to solve this problem? Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried the following code :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all, close all,clc&#xA;&#xA;uor=imread('gourd.bmp'); % the original image &#xA;u0 = imnoise(uor,'gaussian',0,0.01);&#xA;u0=double(u0);&#xA;[m n]=size(u0);&#xA;uor=double(uor);&#xA;u=u0;&#xA;c=0.028;&#xA;h=1;     &#xA;for Iter=1:50, &#xA;    for i=2:m-1,&#xA;      for j=2:n-1,&#xA;          Lap=0.003*(u(i+1,j)+u(i-1,j)-4*u(i,j)+u(i,j+1)+u(i,j-1));&#xA;          u(i,j)=(u0(i,j)+(1/(2*c*h*h))*Lap);&#xA;     end&#xA;    end&#xA;    for i=2:m-1,&#xA;          u(i,1)=u(i,2);&#xA;          u(i,n)=u(i,n-1);&#xA;        end&#xA;&#xA;    for j=2:n-1,&#xA;          u(1,j)=u(2,j);&#xA;          u(m,j)=u(m-1,j);&#xA;        end&#xA;&#xA;        u(1,1)=u(2,2);&#xA;        u(1,n)=u(2,n-1); &#xA;        u(m,1)=u(m-1,2);&#xA;        u(m,n)=u(m-1,n-1);&#xA;&#xA;en=0.0;  &#xA;    for i=2:m-1,&#xA;      for j=2:n-1,&#xA;      ux=(u(i+1,j)-u(i,j))/h;&#xA;      uy=(u(i,j+1)-u(i,j))/h;&#xA;      fidelity=(u0(i,j)-u(i,j))*(u0(i,j)-u(i,j));&#xA;&#xA;      en=en+c*fidelity;&#xA;      end&#xA;    end&#xA;&#xA;&#xA;Energy(Iter)=en; &#xA;&#xA;%  Error between uor and u0&#xA; ur=reshape(u,m*n,1);&#xA; uori=reshape(uor,m*n,1);&#xA; residu=norm(ur-uori)/norm(uori);&#xA;&#xA; [peaksnr, snr] = psnr(uor, u);&#xA;&#xA;disp(['    iter ' num2str(Iter), ' :     Error = ' num2str(residu), ...&#xA;    ' ,    Peak-snr ' num2str(-peaksnr), ' ,    SNR ' num2str(snr)]);&#xA;&#xA;&#xA;  end &#xA;&#xA;% show the structural similarity index for measuring image quality &#xA;[ssimval, mapssim] = ssim(u,uor);&#xA;disp([' the structural similarity index is ' num2str(ssimval)]);&#xA;figure,imshow(mapssim,[]); axis square; &#xA;&#xA;figure,imagesc(u); axis image; axis off; colormap(gray);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The original image is here :&#xA;&lt;a href=&quot;https://www.dropbox.com/s/4bccby1f4lxp4j9/gourd.rar?dl=0&quot; rel=&quot;noreferrer&quot;&gt;https://www.dropbox.com/s/4bccby1f4lxp4j9/gourd.rar?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/n8XnC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n8XnC.png&quot; alt=&quot;gourd&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards&lt;/p&gt;&#xA;" OwnerUserId="16063" LastEditorUserId="128" LastEditDate="2018-08-22T19:20:10.840" LastActivityDate="2018-08-22T19:20:10.840" Title="Denoise Image with Gaussian Noise Using MATLAB / Octave" Tags="|image-processing|matlab|image-segmentation|denoising|octave|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24513" PostTypeId="1" CreationDate="2015-07-04T03:28:06.383" Score="0" ViewCount="1253" Body="&lt;p&gt;I'm a newcomer to signal processing, so forgive my ignorance. I'm working on a project in Python that will play a .wav file and pick out the dominant frequency as it plays. I've found a few examples on the web, but none seem to be accurate for stereo files. It seems like I need to do something with an FFT, but I don't know too much about it.&#xA;Any help would be greatly appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="16492" LastActivityDate="2015-07-04T05:48:09.757" Title="Real-time frequency recognition in python" Tags="|fft|frequency|python|pitch|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24514" PostTypeId="1" CreationDate="2015-07-04T04:38:10.347" Score="0" ViewCount="131" Body="&lt;p&gt;Good Day, I have 9 polynomial roots. i have plotted the roots. my problems are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)how to find the distance of the roots from origin? I want to find the distance of all the roots from the origin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I have 3 models and I want to differentiate between them using the polynomial roots. I want to observes how the roots are moving from each models. Is it possible for me to arrange the roots in ascending order? the one that is closer to the origin and farther from the origin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea? Looking for your reply. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15614" LastEditorUserId="13320" LastEditDate="2016-11-13T12:52:19.823" LastActivityDate="2016-11-13T12:52:19.823" Title="how to find the distance of the root from the origin?" Tags="|matlab|discrete-signals|autoregressive-model|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24515" PostTypeId="2" ParentId="24513" CreationDate="2015-07-04T05:48:09.757" Score="-1" Body="&lt;p&gt;Here's a recent blog post that may be helpful:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://jakevdp.github.io/blog/2013/08/28/understanding-the-fft/&quot; rel=&quot;nofollow&quot;&gt;https://jakevdp.github.io/blog/2013/08/28/understanding-the-fft/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to install numpy (and probably scipy, too), and read up on the Discrete Fourier Transform (DFT; this is what the FFT computes).  I'm not that up on Python media packages for the playback part. Python's wave module may be enough. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm could be as simple as computing the FFT of the last, say, 4096 samples, getting the index of the maximum absolute value, and multiplying by the bin width.  Or you can get fancier and use a Hanning window, peak interpolation, overlap processing, and exponential averaging.&lt;/p&gt;&#xA;" OwnerUserId="16283" LastActivityDate="2015-07-04T05:48:09.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24516" PostTypeId="2" ParentId="24473" CreationDate="2015-07-04T11:24:43.370" Score="1" Body="&lt;p&gt;At the risk of being redundant, I add yet another answer because I think that not all things have been addressed as clearly as necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned in Dilip Sarwate's answer, the cross-correlation function of two signals $x(t)$ and $y(t)$ cannot vanish (for all values of its argument) if their spectra overlap, because this would mean that their cross-spectral density given by $X(\omega)Y^*(\omega)$ must equal zero. And the latter can't be true if $X(\omega)$ and $Y(\omega)$ overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other question is if the cross-correlation can be zero for zero shifts if the spectra overlap. This would mean that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}x(t)y^*(t)dt=0\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, equivalently,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}X(\omega)Y^*(\omega)d\omega=0\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This condition is called &lt;em&gt;orthogonality&lt;/em&gt;. It can be satisfied for signals that overlap in time &lt;em&gt;and&lt;/em&gt; that have overlapping spectra, if they - or their spectra - form a &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow&quot;&gt;Hilbert transform&lt;/a&gt; pair. E.g., if $x(t)$ and $y(t)$ are a Hilbert transform pair then their Fourier transforms are related by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(\omega)=-j\cdot\text{sign}(\omega)X(\omega)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is what geometrikal addressed in his answer.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The integral in (2) then becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$j\int_{-\infty}^{\infty}|X(\omega)|^2\text{sign}(\omega)d\omega\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, if it exists (if necessary as a Cauchy principal value), is indeed zero, even though both signals overlap in time as well as in frequency.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-04T11:24:43.370" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24517" PostTypeId="1" CreationDate="2015-07-04T11:31:47.700" Score="4" ViewCount="7113" Body="&lt;p&gt;&lt;strong&gt;System:&lt;/strong&gt; Cantilever beam type models, with an accelerometer on the end. The beam base is excited at various frequencies in harmonic fashion on a shake table. This results in vibration in the beam. The accelerometer is ICP type, and details &lt;a href=&quot;http://www.pcb.com/Products.aspx?m=333B32&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. This accelerometer connects to a compatible FFT analyzer, make OROS-34, details &lt;a href=&quot;http://www.oros.com/3890-or34-compact-analyzer.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Results:&lt;/strong&gt;&#xA;Graph of response - acceleration v/s time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/M92w2.jpg&quot; alt=&quot;Graph of response - acceleration v/s time &quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graph of FFT of above signal - acceleration v/s frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xjHsg.jpg&quot; alt=&quot;Graph of FFT of above signal - acceleration v/s frequency&quot;&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;  I want to understand what the FFT of the original signal means. For example, I have heard that the FFT of the acceleration-time signal would give the natural frequency of the system, as the natural frequency would have the greatest contribution. So the spike in the graph of FFT should correspond to natural frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone suggest some reference for the theory above ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is true, then whatever be the base excitation, the natural frequency of the structure should not change, the spikes in the acc-freq curve for other frequencies should match this one. This also doesnt happen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Better images: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graph of acceleration vs time for excitation freq of 15Hz with displacement amplitude of 50mm. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/UITuB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graph of FFT of previous curve, i.e. acceleration vs freq&#xA;&lt;img src=&quot;https://i.stack.imgur.com/r3H0C.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The vertical red line in the image FFT image is a marker for reading X and Y coordinates at peak.&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per the suggested methods and theory, the frequency of oscillation of the structure should be same as forcing freq, however the FFT peak is far from that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Promise: No more edits. :)&lt;/p&gt;&#xA;" OwnerUserId="16494" LastEditorUserId="16494" LastEditDate="2015-07-08T10:23:20.167" LastActivityDate="2021-04-08T22:04:10.570" Title="Interpreting the FFT results of a structural vibration problem" Tags="|fft|signal-analysis|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24518" PostTypeId="2" ParentId="24356" CreationDate="2015-07-04T11:41:55.273" Score="3" Body="&lt;p&gt;Sinusoids are power signals, and in the case of power signals, cross-correlation between two signals $x(t)$ and $y(t)$ is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{xy}(t)=\lim_{T\rightarrow\infty}\frac{1}{2T}\int_{-T}^{T}x(\tau)y(t+\tau)d\tau\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $x(t)=\cos(\omega_1 t)$ and $y(t)=\cos(\omega_2 t)$ then for $\omega_1\neq\omega_2$ the cross-correlation at $t=0$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}R_{xy}(0)&amp;amp;=\lim_{T\rightarrow\infty}\frac{1}{2T}\int_{-T}^{T}\cos(\omega_1 t)\cos(\omega_2 t)dt\\&#xA;&amp;amp;=\lim_{T\rightarrow\infty}\frac{1}{2T}\left[\frac{\sin((\omega_1-\omega_2)T)}{\omega_1-\omega_2}+\frac{\sin((\omega_1+\omega_2)T)}{\omega_1+\omega_2}\right]\\&amp;amp;=0&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the definition (1) avoids all convergence problems that you would encounter otherwise.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-07-06T18:55:17.163" LastActivityDate="2015-07-06T18:55:17.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24519" PostTypeId="2" ParentId="24502" CreationDate="2015-07-04T14:16:15.543" Score="1" Body="&lt;p&gt;Chebyshev polynomials are mainly used for &lt;a href=&quot;https://en.wikipedia.org/wiki/Waveshaper&quot; rel=&quot;nofollow&quot;&gt;waveshaping&lt;/a&gt;, where an input signal is distorted by applying a memory-less non-linear function to it. This shaping function is stored in a look-up table (wavetable). If you use Chebyshev polynomials, then the polynomial just defines the shaping function, and the wavetable is generated just like for any other shaping function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the output is given by $y=f(x)$, where $x$ is the input, then the wavetable contains values $y$ for a given range of input values $x$. The function $f(x)$ can be defined in any desired way, and one way to define it is to use Chebyshev polynomials, which for a pure sinusoidal input generate a given harmonic.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-04T14:16:15.543" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24520" PostTypeId="2" ParentId="24356" CreationDate="2015-07-04T14:32:29.397" Score="0" Body="&lt;p&gt;Orthogonality requires the definition of an inner product. An inner product definition typically looks like this. &#xA;$$\langle f, g\rangle_w = \int_a^b f(x)g(x)w(x)\,dx. $$ &#xA;sometimes with a lim thrown in there as well. The choice of weighting function and integral boundaries impact this a lot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use the inner product definition from Matt L, they are orthogonal, if you use the inner product definition from fibonatic, they are not (despite fibonatic's answer, the integral does not converge).&#xA;So if you treat them as &quot;power signals&quot; they are orthogonal and if you treat them as &quot;energy signals&quot; they are not. Both are actually valid approaches depending on the context you want to use the orthogonal properties for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't really answer a orthogonality question without a definition of an inner product.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-04T14:32:29.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24521" PostTypeId="1" CreationDate="2015-07-04T16:38:38.180" Score="0" ViewCount="554" Body="&lt;p&gt;I am using BPSK modulation to modulate a signal in continuous time (making rectangular waveform, multiplying by a carrier). The channel is band-limited and frequency-selective, and has the following magnitude response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/aAV4P.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that I passed the signal through AWGN channel to add noise and then multiplied by carrier again, and then performed detection. Here is the sequence of steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;convert binary signal to -1 and 1 and make continuous rectangular pulse&lt;/li&gt;&#xA;&lt;li&gt;multiply by cosine or sine carrier&lt;/li&gt;&#xA;&lt;li&gt;take the FFT of the modulated signal&lt;/li&gt;&#xA;&lt;li&gt;multiply by frequency response of channel&lt;/li&gt;&#xA;&lt;li&gt;take IFFT of the result&lt;/li&gt;&#xA;&lt;li&gt;add AWGN noise&lt;/li&gt;&#xA;&lt;li&gt;multiply signal by carrier&lt;/li&gt;&#xA;&lt;li&gt;pass signal through bank of correlators&lt;/li&gt;&#xA;&lt;li&gt;detection &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Frequency response of my bandpass signal is &lt;img src=&quot;https://i.stack.imgur.com/TWcmO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I plotted the BER vs SNR. However what I noticed is that for a given BER my SNR value is very high. Here is what I got :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HC5WD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please tell me why I am getting such high SNR? does the BER vs SNR make sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10758" LastEditorUserId="10758" LastEditDate="2015-07-05T20:41:39.930" LastActivityDate="2015-07-05T20:41:39.930" Title="Very high SNR BPSK modulation" Tags="|matlab|frequency|modulation|demodulation|bpsk|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24522" PostTypeId="1" AcceptedAnswerId="24525" CreationDate="2015-07-04T20:25:23.197" Score="8" ViewCount="1806" Body="&lt;p&gt;From my understanding our ears have hairs/cilia in the cochlea that resonate at frequencies within our hearing range.  To me this means we are hearing in the frequency domain as opposed to the time domain. But does that mean we are constantly ifft-ing the sound in order to process it?&lt;/p&gt;&#xA;" OwnerUserId="16501" LastActivityDate="2019-01-11T08:42:06.113" Title="Does our brain constantly ifft to hear?" Tags="|fft|sound|ifft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24525" PostTypeId="2" ParentId="24522" CreationDate="2015-07-04T21:24:23.580" Score="18" Body="&lt;p&gt;No. Why do you think it would? First of all, the human brain works very different then any human constructed computer (to date); so the assumption that it runs mathematical &quot;algorithms&quot; is somewhat dicey..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is roughly how it works:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sound wiggles the air drum&lt;/li&gt;&#xA;&lt;li&gt;That vibration is transferred by the ossicles to the cochlea. The ossicles  act mainly as a mechanical transformer. &lt;/li&gt;&#xA;&lt;li&gt;Inside the cochlea the vibration induces a bending wave on the basilar membrane. Due to its shape certain frequencies wiggle preferably at different spots. That's how the frequency selectivity is created. In essence this is a mechanical way of doing a short term Fourier transform.&lt;/li&gt;&#xA;&lt;li&gt;There are special type of neurons (nerve cells) called hair cells or cilia in the cochlea. When the basilar membrane wiggles it shears the hairs and induces the neurons to fire electrical impulses.&lt;/li&gt;&#xA;&lt;li&gt;Interestingly enough about 20% of the neurons go from the brain back to the cochlea. This implements an active feedback mechanisms that greatly enhances the frequency selectivity. If that feedback loop goes out of whack you can &quot;hear your ears ringing&quot;. That's one of the main causes of tinnitus. &lt;/li&gt;&#xA;&lt;li&gt;Neurons are inherently somewhat digital. They are amplitude discrete (i.e. they fire or not) but they are time continuous. The more stimulus is there, the more frequent they fire, but the size of the impulse stays always the same.&lt;/li&gt;&#xA;&lt;li&gt;From there on upward it all stays in the neural domain. Everything that can be observed are firing patterns of active cells. Every layer of the brain is connected to the next layer by a huge number of connections which transform one firing pattern into a different one. Certain firing patterns mean that you actually &quot;hear&quot; something and are related to conscious perception.&lt;/li&gt;&#xA;&lt;li&gt;The human brain has a huge number of active neurons and glia. There are more than 100 billion cells in your head that can process information. Needless to say this is a very complicated process. &lt;/li&gt;&#xA;&lt;li&gt;However, there is no need for the brain to reconstruct the original time domain waveform. It actually has no good way of representing a fast analog waveform. Neurons are pretty slow with a maximum firing rate of about 100 times per second. That's really not a good match for sound signals. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="16130" LastEditDate="2019-01-11T08:42:06.113" LastActivityDate="2019-01-11T08:42:06.113" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24526" PostTypeId="2" ParentId="24517" CreationDate="2015-07-05T00:46:08.710" Score="1" Body="&lt;p&gt;If the beam is under the excitation of a sweeping wave, then the peak(s) in the FFT of the response is not necessarily the natural frequency of the beam. As an extreme, if you are exciting the beam with a constant frequency omega, your FFT of the acceleration time history will have a dominant peak at omega.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if the beam is under random excitation, or an impulse, the first peak in you FFT will be your natural frequency. And there is a method named &quot;peak-picking method&quot; to find out the natural frequency. Here is a reference for that: &lt;a href=&quot;https://books.google.com/books?id=AKjnOnhGDXYC&amp;amp;pg=PA738&amp;amp;lpg=PA738&amp;amp;dq=peak%20picking%20natural%20frequency&amp;amp;source=bl&amp;amp;ots=S7CT6TN6-M&amp;amp;sig=VpEtCrndhaCgExA4F8VUY_VY1wU&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ei=532YVa64HcqZsAWxgZPgCA&amp;amp;ved=0CB4Q6AEwAA#v=onepage&amp;amp;q=peak%20picking%20natural%20frequency&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;Google books&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16503" LastActivityDate="2015-07-05T00:46:08.710" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24527" PostTypeId="2" ParentId="24505" CreationDate="2015-07-05T00:57:18.867" Score="0" Body="&lt;p&gt;Fourier transform is a linear filter &lt;a href=&quot;http://mathworld.wolfram.com/FourierTransform.html&quot; rel=&quot;nofollow&quot;&gt;wolfram&lt;/a&gt;. Linearity means:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;F[ax+by] = aF[x] + bF[y]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for any constants a and b, and for any signal/variable/function x and y. So of course, the linearity applies to your signal C(t).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a signal of form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;exp(-at)u(t)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;its Fourier transform is readily available &lt;a href=&quot;https://uspas.fnal.gov/materials/11ODU/FourierTransformPairs.pdf&quot; rel=&quot;nofollow&quot;&gt;See Page 3&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="16503" LastActivityDate="2015-07-05T00:57:18.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24528" PostTypeId="2" ParentId="24517" CreationDate="2015-07-05T05:21:57.387" Score="0" Body="&lt;p&gt;Vibration analysis is often done using the steady state response of the system. I presume your upper time domain graph is the output of the system you're trying to measure, based on one of the harmonic inputs.  In other words, you're hitting your cantilever beam base with a series of harmonic excitations (eg: input 1f, measure output/take FFT, input 2f, measure output/take FFT, input 3f, measure output/FFT, etc.) similar to the description in the following link (see section 5.4.6):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.brown.edu/Departments/Engineering/Courses/En4/Notes/vibrations_forced/vibrations_forced.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.brown.edu/Departments/Engineering/Courses/En4/Notes/vibrations_forced/vibrations_forced.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the FFT results should show you the amplitude versus frequency response (similar to the graph shown in the link), from which you can obtain the natural frequency and damping coefficient of your system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it should be cautioned that vibration analysis is a complex and wide-ranging field.  There is a lot of specialized knowledge for different structures, machinery, etc., and your methods should be appropriate to the problem.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastEditorUserId="14819" LastEditDate="2015-07-05T06:28:45.283" LastActivityDate="2015-07-05T06:28:45.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24529" PostTypeId="2" ParentId="20353" CreationDate="2015-07-05T05:22:40.653" Score="3" Body="&lt;p&gt;What you are asking is called 'page layout analysis' in OCR. Take a look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Document_layout_analysis&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Document_layout_analysis&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-07-05T05:22:40.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24530" PostTypeId="1" CreationDate="2015-07-05T10:32:49.970" Score="1" ViewCount="415" Body="&lt;p&gt;I want to know the following&#xA;what is the difference among noise,blurring and contrast ?&lt;/p&gt;&#xA;" OwnerUserId="16504" LastEditorUserId="13320" LastEditDate="2016-11-21T13:07:29.840" LastActivityDate="2016-11-21T13:07:29.840" Title="what is the difference among noise,blurring and contrast?" Tags="|noise|image-processing|" AnswerCount="0" CommentCount="1" ClosedDate="2015-07-06T20:10:28.887" ContentLicense="CC BY-SA 3.0" />
  <row Id="24531" PostTypeId="2" ParentId="23101" CreationDate="2015-07-05T12:08:55.943" Score="1" Body="&lt;p&gt;If you're averaging multiple (two, in your case) spectral magnitude sequences your result will be valid, correct, as long as the sequences are equal in length.  Now whether the &quot;averaged spectral magnitude&quot; result gives you useful information, that you will have to decide on your own.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-07-05T12:08:55.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24533" PostTypeId="1" AcceptedAnswerId="24534" CreationDate="2015-07-05T19:14:25.680" Score="4" ViewCount="3482" Body="&lt;p&gt;I have recently left the safe and easy MATLAB environment and begun to use CUDA-C/C++ for image processing.   Since CUDA doesn't allow 2D arrays to be passed into kernels I am now used to linearizing my gray-scale images (2D matrices) into 1D arrays before processing them.  I seem to have no problem applying 1D-DFT's to my linearzied arrays.  This leads me to wonder why people use 2D-DFT's at all?   Why not just linearize your matrices into 1D-arrays and apply 1D-DFT's?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can 1D-DFT's always operate on 2D-data by simply laying the matrix out into a 1D array?&lt;/p&gt;&#xA;" OwnerUserId="16507" LastEditorUserId="128" LastEditDate="2019-10-07T20:15:17.613" LastActivityDate="2019-10-07T20:16:37.680" Title="Difference between 2D DFT's and 1D DFT's of Linearized Matrices" Tags="|image-processing|fft|fourier-transform|dft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24534" PostTypeId="2" ParentId="24533" CreationDate="2015-07-05T19:50:41.033" Score="2" Body="&lt;p&gt;The DFT is &quot;Separable Operator&quot; (Also the classic Fourier Transform) and hence can be applied on the Rows and Columns of the image separately (It can be generalized to N dimension and not only 2).&lt;br&gt;&#xA;Yet, if you create  1D signal from your image (Let's say by Column Stack) and apply 1D DFT you don't get the information you would by using 2D DFT (By going on the Row and them Columns).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember, Fourier Transform is all about synthesizing the signal using different functions. In this case if it is 2D signal you want to build it using 2D Signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to play with the indices to first apply it on each row and later on each column.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-10-07T20:16:37.680" LastActivityDate="2019-10-07T20:16:37.680" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24535" PostTypeId="1" AcceptedAnswerId="24538" CreationDate="2015-07-05T21:36:22.777" Score="1" ViewCount="7636" Body="&lt;p&gt;I am recently learning about Computer Vision and I am having a trouble understanding Difference of Gaussian (DoG) algorithm. I get how the algorithm works in high level idea, but I am trying to implement my own and I am confused about some steps. &lt;br&gt;&lt;br&gt;&#xA;For instance, I am trying to create 5 blur level for each octave, and I am confused about which filter and sigma value applying to which image. Using Matlab, for the first octave, I created a filter and applied:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sigma = 0.5;&#xA;gauss = fspecial('gaussian', [5 5], sigma);&#xA;blur1 = imfilter(img, gauss, 'replicate');&#xA;dog1 = img - blur1;&#xA;%Next level&#xA;blur2 = imfilter(blur1, gauss, 'replicate');&#xA;dog2 = blur1 - blur2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am not so sure if this is how I need to apply? Do I apply gaussian filter to previously applied image? I also saw code using &lt;code&gt;k*sigma&lt;/code&gt;. I am not sure what &lt;code&gt;k&lt;/code&gt; means and how to apply? Oh and what value should I used for sigma? Is it in [0, 1] range or can be bigger than that? Could someone help me on this? Thank you very much.&#xA;&lt;br&gt;Thank you so much!&lt;/p&gt;&#xA;" OwnerUserId="16508" LastEditorUserId="1355" LastEditDate="2015-07-07T06:47:59.310" LastActivityDate="2015-07-07T06:47:59.310" Title="Question about Difference of Gaussian (DoG) algorithm" Tags="|matlab|computer-vision|gaussian|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24538" PostTypeId="2" ParentId="24535" CreationDate="2015-07-05T23:45:02.673" Score="1" Body="&lt;p&gt;Difference of gaussian is the difference in the output of two Gaussian filters with different blur amounts (sigma).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sigma is the size of the Gaussian filter. A bigger sigma gives you a bigger amount of blurring. A good way to think about it is a Gaussian filter with variance sigma is very roughly like averaging 3 x sigma samples wide (or 3 x 3 in an image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. from wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/nyREZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Very Important&lt;/strong&gt; when making a Gaussian filter in MATLAB make sure the size of the filter is at least 6 x sigma. In your above code you have 5 x 5 which is fine for sigma = 0.5, but for sigma = 1 you would want 6 x 6 or bigger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;k&lt;/code&gt; is simply a multiplier for sigma.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sigma = 0.5;&#xA;gauss1 = fspecial('gaussian', round([10*sigma 10*sigma]), sigma);&#xA;sigma = 1;&#xA;gauss2 = fspecial('gaussian', round([10*sigma 10*sigma]), sigma);&#xA;blur1 = imfilter(img, gauss1, 'replicate', 'same');&#xA;blur2 = imfilter(img, gauss2, 'replicate', 'same');&#xA;dog2 = blur1 - blur2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A more complete code example that allows you to set the number of octaves and the steps per octave:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Filter using DoG&#xA;stepsPerOctave = 5;&#xA;octaves = 4;&#xA;mult = nthroot(2,stepsPerOctave);&#xA;&#xA;% Create blurry images&#xA;sigma = 0.5;&#xA;kernelSize = [10*sigma*2^(octaves),10*sigma*2^(octaves)]&#xA;for k = 1:octaves*stepsPerOctave+1&#xA;    disp(['Sigma is ' num2str(sigma)]);&#xA;    gauss = fspecial('gaussian', kernelSize, sigma);&#xA;    blur(:,:,k) = imfilter(I, gauss, 'replicate', 'same');&#xA;    imagesc(blur(:,:,k)); colorbar; title(['Gaussian ' num2str(k)]); pause;&#xA;    sigma = sigma * mult;&#xA;end&#xA;&#xA;% Create DoG&#xA;for k = 1:octaves*stepsPerOctave&#xA;    dog(:,:,k) = blur(:,:,k+1) - blur(:,:,k);&#xA;    imagesc(dog(:,:,k)); colorbar; title(['DoG ' num2str(k)]); pause;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-07-05T23:45:02.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24539" PostTypeId="1" CreationDate="2015-07-06T02:39:32.833" Score="0" ViewCount="156" Body="&lt;p&gt;I have data from accelerometer (time domain) and convert it to fft using Fourier Transform. However, I need to do the curve fit to the plot. &#xA;Can somebody share with me the coding.I don't know how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="13462" LastEditorUserId="15794" LastEditDate="2015-07-08T08:47:49.837" LastActivityDate="2015-07-08T08:47:49.837" Title="Curve fit for fft dplot" Tags="|matlab|fft|frequency|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24543" PostTypeId="1" CreationDate="2015-07-06T11:55:29.850" Score="0" ViewCount="444" Body="&lt;p&gt;We have unnormalized Haar matrix which, is for example,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;H4=[1 1 1 1;1 1 -1 -1;1 -1 0 0;0 0 1 -1]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After normalizing it, we use for haar transform. I know how to produce it using kronecker product. Can we generate other unnormalized wavelet family matrixes? For example, how can I generate unnomalized Daubechies or symlet matrixes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks  &lt;/p&gt;&#xA;" OwnerUserId="15293" LastEditorUserId="15794" LastEditDate="2015-07-07T14:47:30.267" LastActivityDate="2015-07-07T14:47:30.267" Title="Generating Wavelet family matrixes" Tags="|matlab|signal-analysis|wavelet|transform|matrix|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24545" PostTypeId="1" AcceptedAnswerId="24552" CreationDate="2015-07-06T15:57:06.940" Score="4" ViewCount="148" Body="&lt;p&gt;I have a video filmed in a relatively low quality and resolution and a sequence of photos of higher quality taken of the same scene at the rate of about one image every two seconds or so. Could those photos be used to filter the video sequence to upscale it without loss to the sharpness?&lt;/p&gt;&#xA;" OwnerUserId="16517" LastEditorUserId="128" LastEditDate="2019-11-18T06:59:35.493" LastActivityDate="2019-11-18T06:59:35.493" Title="How to Increase the Resolution of a Video from a Sequence of Photos?" Tags="|resampling|video-processing|resolution|inverse-problem|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="24546" PostTypeId="1" AcceptedAnswerId="24547" CreationDate="2015-07-06T17:42:09.927" Score="0" ViewCount="5113" Body="&lt;p&gt;Say I take a real valued function in the time domain, take the Fourier transform to get its frequency domain representation, do some work on it in the frequency domain, which leads to imaginary values, and then take the inverse Fourier transform to get a new time domain signal.  What does it mean if the values of the time domain signal are imaginary?  I understand that imaginary values in the frequency domain allow for the representation of phase of each frequency (&lt;a href=&quot;https://stackoverflow.com/questions/10304532/why-does-fft-produce-complex-numbers-instead-of-real-numbers&quot;&gt;https://stackoverflow.com/questions/10304532/why-does-fft-produce-complex-numbers-instead-of-real-numbers&lt;/a&gt;).  But what do imaginary numbers mean in the time domain?   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can tell you what my particular application is, but I believe that this is a general question that others might come across in the future.  &lt;/p&gt;&#xA;" OwnerUserId="16518" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2015-07-06T17:58:41.837" Title="What is the meaning of imaginary values in the time domain?" Tags="|fft|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24547" PostTypeId="2" ParentId="24546" CreationDate="2015-07-06T17:58:41.837" Score="3" Body="&lt;p&gt;Imaginary values in the time domain simply mean that you actually have two signals, the real-part and the imaginary part. If you start out with a real-valued signal, take the Fourier transform, do some processing in the frequency domain, then transform back, and you end up with a complex-valued signal, then 9 out of 10 times you've done something wrong (or, if the imaginary part is very small, it is numerical noise due to round-off errors). In other words, in most cases the frequency domain processing should not make your originally real-valued time domain signal complex-valued, i.e. it should retain the conjugate symmetry of the signal's Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-06T17:58:41.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24548" PostTypeId="1" AcceptedAnswerId="24550" CreationDate="2015-07-06T19:00:36.147" Score="0" ViewCount="1206" Body="&lt;p&gt;I am listening for a very definite pop in a real time audio signal. So far I have managed to get the audio signal in at a sampling rate of 44100.0 Hz and 2048 frames per second. I have visualized the waveform and computed and visualized the FFT. I am currently looking for distinct features to recognize this pop sound (it is the sound of a ping pong ball on the table).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a few papers which suggested features such as the zero crossing rate of a percussive sound like this &lt;a href=&quot;http://www.csl.sony.fr/downloads/papers/2000/gouyon-dafx2000.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.csl.sony.fr/downloads/papers/2000/gouyon-dafx2000.pdf&lt;/a&gt;. However I am struggling a bit to identify the percussive envelop within the signal. I would like to identify a peak in a certain frequency range within my FFT as well, then combine the existence of an envelope with a peak in the correct range to determine whether a sound was heard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions, how would I identify an envelope in the time domain, or how would I approach this problem. Further, how could I identify a peak in the frequency domain when I have a very fine mesh FFT (lots of bins and noise). I also have a lot of pink noise as this is a real time audio recording, so I have louder frequencies toward the bottom end than the top end, but I haven't managed to get those frequencies out of my FFT (I don't need to worry about converting back to the time domain).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Identify envelopes beside natural noise&lt;/li&gt;&#xA;&lt;li&gt;Identify FFT peaks beside natural noise&lt;/li&gt;&#xA;&lt;li&gt;Any experience with noticing percussive transients?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16431" LastActivityDate="2015-07-08T23:59:17.960" Title="Detecting a specific pop in a real time audio signal" Tags="|fft|discrete-signals|sound|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24549" PostTypeId="2" ParentId="13119" CreationDate="2015-07-06T19:26:11.483" Score="1" Body="&lt;p&gt;First is your signal stationary or non stationary?. If the FFT is applied to a non stationary signal then its resulting spectrum is not valid.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT has the implicit assumption that your signal is periodic and your signal does not look periodic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would try to have weak sense stationarity to the series and then apply multitaper spectrum and run an F test for white noise as to pint point where your signal truly resides and use a band pass filter as to filter the noise out from the frequencies of interest where your signal resides.&lt;/p&gt;&#xA;" OwnerUserId="7478" LastActivityDate="2015-07-06T19:26:11.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24550" PostTypeId="2" ParentId="24548" CreationDate="2015-07-06T21:32:05.080" Score="0" Body="&lt;p&gt;One of the simplest methods to optimally (minimising the error energy while restricted to LTI filters) detect the existance of a known signal inside another is to use a matched filter. A matched filter will have its impulse response equal to the signal being searched in time-reversed form. This resulting filter equivalently computes the correlation of the known signal with the measured signal. And the peaks of this correlator yields the position of the best possible matches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let the searched signal be $s[n]$ with $s= \{-2,-1,0,0,1,2\}$ with $s[0]=-2$ and $s[5]=2$ and length of signal is $L=6$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that this signal is embedded into various locations of another longer and uncorrelated signal x[n] with its length M &gt; N. Then the resulting combined (by adding sifted versions of the test signal s[n] into x[n] at various locations) signal is called as y[n] of length M.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to optimally find the index of the locations into where the signal s[n] was added, we can use an LTI filter with impulse respose h[n] which is the time reversed version of s[n] as: $$h[n] = s[-n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(you can refer to Simon Haykin Communication Systems Theory for a simple and accessible derivation of this optimal filter which is called as the matched filter. Note that the impulse response h[n] of this optimal filter is the same (except time reversal) as the signal being searched, therefore it's called as &quot;matched&quot;: optimal detector's impulse response matches the signal being searched) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the example of $s[n] = \{-2,-1,0,0,1,2\}$ then $h[n] = \{2,1,0,0,-1,-2\}$ &#xA;Now however $h[-5]=2$ and $h[0]=-2$. This is an non-causal signal. In practice (using computer system) it is wiser to shift it right, enough to make it causal. It is just a convenience and will not effect the operation performance. Then we will have the following same impulse response $h[n]= \{2,1,0,0,-1,-2\}$ with $h[0]=2$ and $h[5]=-2$ for mathematical convenience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the output of the LTI filter is $$z[n] = h[n]*y[n]$$ This is the convolution operator, which enables the computation of the output of the any discrete time LTI filter and is expressed as $$z[n] = \sum_{k=0}^{k=M-1} {h[n-k]x[k]}$$ The dummy index k ranges within the intersection of the valid signal ranges which is k=0 to k=M-1 for this particular example. Also the output index n will also range from 0 to M-1, which is by convention...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the output sequence z[n] is expected to inlcude some peaks, these peak locations after being thresholded indicates a possible detection of signal s[n] inside y[n]. (practically the exact location will be L samples back)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if the signal s[n] is not only shifted but also scaled? Then the peak value will be reduced as much as the scaling. Hence the threshold must be selected very carefully. Or you must find a way to estimate the scaling a priorily.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-07-08T23:59:17.960" LastActivityDate="2015-07-08T23:59:17.960" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="24551" PostTypeId="2" ParentId="19559" CreationDate="2015-07-06T21:46:31.540" Score="1" Body="&lt;p&gt;The answers to the questions are &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Yes WSS is sufficient. &lt;/li&gt;&#xA;&lt;li&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Quasiperiodic&lt;/strong&gt; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/SIYxV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Semiperiodic&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9ROKX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="1629" LastEditDate="2016-06-01T07:02:58.423" LastActivityDate="2016-06-01T07:02:58.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24552" PostTypeId="2" ParentId="24545" CreationDate="2015-07-07T05:15:50.497" Score="1" Body="&lt;p&gt;One way to do it is to solve a MAP problem of the up scaled video and using the High Resolution images as a prior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try looking at the articles - &lt;a href=&quot;https://www.google.com/webhp?sourceid=chrome-instant&amp;amp;ion=1&amp;amp;espv=2&amp;amp;ie=UTF-8#q=super%20resolution%20MAP&quot; rel=&quot;noreferrer&quot;&gt;Super Resolution MAP&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-07-07T05:15:50.497" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24555" PostTypeId="1" AcceptedAnswerId="24556" CreationDate="2015-07-07T08:42:02.197" Score="1" ViewCount="6213" Body="&lt;p&gt;I am trying to find the difference between two images, using Matlab. The classic built in function that Matlab provides for this is because the two images don't have the same dimensions (The objects in the images are the same, but in the second image other objects are introduced).&#xA;i need to use a metric or function can calculate the number of matching feature between two images and give me a value to decide according to threshold .. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;source = imread('source.png');&#xA;target = imread('target.png');&#xA;source = rgb2gray(source);&#xA;target = rgb2gray(target);&#xA;  sourcePoints=detectSURFFeatures(source,'MetricThreshold',100.0,'NumOctaves',1,'N   umScaleLevels',6);&#xA; targetPoints=detectSURFFeatures(target,'MetricThreshold',100.0,'NumOctaves',1,'NumScaleLevels',6);&#xA;     [sourceFeatures,sourcePoints]=extractFeatures(source,sourcePoints,'SURFSize',64);&#xA;     [targetFeatures,targetPoints]=extractFeatures(target,targetPoints,'SURFSize',64);&#xA;&#xA;  boxPairs = matchFeatures(sourceFeatures, targetFeatures);&#xA;&#xA;  matchedSourcePoints = sourcePoints(boxPairs(:, 1), :);&#xA;  matchedTargetPoints = targetPoints(boxPairs(:, 2), :);&#xA;&#xA;  % IS there any metric can used to make accurate decision if there is a match or not instead of percentage because its not accurate as required &#xA;  numPairs = length(boxpairs); %the number of pairs&#xA;  percentage  = numPairs/100;&#xA;&#xA;     if percentage &amp;gt;= 0.40&#xA;     disp('We have this');&#xA;       else&#xA;     disp('We do not have this');&#xA;     disp(percentage);&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;IS there any metric can used to make accurate decision if there is a match or not instead of percentage because its not accurate as required &lt;/p&gt;&#xA;" OwnerUserId="16525" LastEditorUserId="53" LastEditDate="2015-07-07T15:37:23.720" LastActivityDate="2015-08-06T17:23:55.057" Title="Using SURF algorithm to match objects on MATLAB" Tags="|image-processing|matlab|computer-vision|matlab-cvst|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24556" PostTypeId="2" ParentId="24555" CreationDate="2015-07-07T09:21:34.590" Score="0" Body="&lt;p&gt;People generally use Euclidean distances, just like you do and it works as it is, pretty well. However, if you require further robustness, I propose the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute the matching both ways: image1-&gt;image2 and image2-&gt;image and then retrieve only the agreeing matches. This introduces some consensus.&lt;/li&gt;&#xA;&lt;li&gt;Assuming you have planar patches, you run a homography using RANSAC. The good thing here is that RANSAC is robust to outliers, given a predifined tolerance. This way prune away a lot of matches, and you will be left with a meaningful set of inliers.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Using these two together should really give you robust and repeatable matches.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-07-07T09:21:34.590" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24557" PostTypeId="1" AcceptedAnswerId="24568" CreationDate="2015-07-07T09:52:11.570" Score="4" ViewCount="6161" Body="&lt;p&gt;I have a signal that has a spectral shape very similar to the transfer function of a second-order lowpass filter (butterworth design).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/t5bQ6.png&quot; alt=&quot;Filter-Spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to whiten the spectrum of this spectrum in the time domain. For that, I need a filter that reverses the effect of the second-order lowpass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can calculate the inverse filter of the second-order lowpass by exchanging the A- and B-coefficients, but this will amplify high frequency components to infinity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I design a filter that has the inverse transfer function of a second-order butterworth design but does not amplify to infinity at $f_s/2$? The transfer function should have the same corner frequency, but smoothly rise with 12 dB per octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this even possible? Any pointers as to how to design such a filter would be helpful!&lt;/p&gt;&#xA;" OwnerUserId="3543" LastEditorUserId="4298" LastEditDate="2020-11-08T17:07:41.040" LastActivityDate="2023-02-07T10:59:35.983" Title="How to design an inverse for a Butterworth low-pass filter?" Tags="|filters|filter-design|infinite-impulse-response|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24558" PostTypeId="1" CreationDate="2015-07-07T10:30:09.033" Score="2" ViewCount="81" Body="&lt;p&gt;I am working in level set/active contour method using spatial prior information . The main papers that I am focusing:&quot;Automatic segmentation of neonatal images using convex optimization and coupled level sets&quot;-2011. It is very nice papers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am confusing about some points in the paper. In the paper, the author said that &quot;For a given subject image, by using HAMMER algorithm to warp the atlas image into the subject image space, we can derive spatial prior information priori for WM, GM and CSF, respectively, for the subject image&quot;.As my understand, we have a original image (need to segment), a template image, and a spatial prior image (range [0,1]). Using HAMMER method, you will transform spatial prior image in to original image. Then, original image is fixed and prior image is moving. Is it right? Or vice versa, the spatial prior image is fixed and original image is moving, which is correct? Because the main reason of warping step is that we want to find a corresponding prior value of a given input pixel in the spatial prior map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I read some tool such as SPM, I saw that original image often fixed and spatial prior information is moving. Is it correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2015-07-07T10:30:09.033" Title="Understand about registration between spatial prior and original image" Tags="|image-processing|computer-vision|image-segmentation|image-registration|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24560" PostTypeId="2" ParentId="24557" CreationDate="2015-07-07T10:41:07.190" Score="1" Body="&lt;p&gt;If you are using Matlab or Octave, then consider trying firls. It allows you to specify an amplitude vs frequency template for the filter, which you can specify to avoid blow-up at high frequencies.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2015-07-07T10:41:07.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24562" PostTypeId="1" CreationDate="2015-07-07T13:45:45.847" Score="0" ViewCount="95" Body="&lt;p&gt;I have written this MATLAB function to plot the impulse response. But it doesn't give me the desired output (impulse function). I am new to MATLAB. Can anyone tell me where i went wrong with the code?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   function [] = impulse() &#xA;   t=-10:1:10;&#xA;   x=zeros(length(t));&#xA;   for(i=-10:1:10)&#xA;     if(i==0)&#xA;       x=1;&#xA;     end&#xA;     plot(t,x);&#xA;     xlabel('t');&#xA;     ylabel('delta(t)');&#xA;     title('impulse response');&#xA;     axis([-10,10,-1,2])&#xA;   end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16530" LastEditorUserId="80" LastEditDate="2015-08-07T12:39:23.803" LastActivityDate="2015-08-07T12:39:23.803" Title="Impulse calculation" Tags="|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24563" PostTypeId="2" ParentId="24562" CreationDate="2015-07-07T14:09:29.013" Score="1" Body="&lt;p&gt;In your code there is no end statement for the loop.There should be an end statement after the end for the if statement.Also x=1 inside the if condition converts the x vector into a vector of length 1.It should be changed as x(i+11)=1.Then the code works to give you a plot of a delta function&lt;/p&gt;&#xA;" OwnerUserId="11819" LastActivityDate="2015-07-07T14:09:29.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24565" PostTypeId="1" CreationDate="2015-07-07T15:07:19.577" Score="0" ViewCount="75" Body="&lt;p&gt;Using a diffraction grating in front of my smartphone's camera, I can decompose light sources into their spectral components. The problem is that the background is not always dark and there might be interference between the spectral intensity and bright objects in the back ground.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of an image taken with a diffraction grating of a fluorescent lamp:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8Q9vJ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case the background is not so bright but you can see that the dark and bright spots on the vacuum cleaner already change how the blue band looks like.&#xA;I thought about having a second camera next to the first camera and taking a similar picture without the diffraction grating:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/eKJKq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I isolate this spectrum that overlaps on my first image and how precise can be this recovery of the original spectral signal? I will be using monochrome cameras. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I tried until now is to put a black sheet in front of the right half of my lens to block background light landing on the right part of the sensor such that the spectrum can be visualized in a black background environment but I think this limits the flexibility of such method&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS:Here my hand moved in order to remove the taped diffraction grating so the picture was not taken from the same pose but later I thought about having fixed cameras looking at the same direction with a minimal baseline to know their relative pose and easily register both images before proceeding with the spectrum isolation.&lt;/p&gt;&#xA;" OwnerUserId="16379" LastEditorUserId="16379" LastEditDate="2015-07-07T15:25:27.487" LastActivityDate="2015-07-07T15:25:27.487" Title="Isolating overlapping image" Tags="|image-processing|deconvolution|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24566" PostTypeId="2" ParentId="24555" CreationDate="2015-07-07T15:42:04.550" Score="0" Body="&lt;p&gt;You can try estimating a geometric transformation between the matched sets of features using &lt;code&gt;estimateGeometricTransform&lt;/code&gt;. The number of inliers returned by  the function could be used to decide whether an object is present. See &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/object-detection-in-a-cluttered-scene-using-point-feature-matching.html&quot; rel=&quot;nofollow&quot;&gt;this example&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-07-07T15:42:04.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24567" PostTypeId="1" AcceptedAnswerId="24579" CreationDate="2015-07-07T16:18:54.663" Score="4" ViewCount="541" Body="&lt;p&gt;I'm measuring a &quot;charge&quot; signal in function of time from an amplifier.&#xA;Here is a measured signal (x-axis is the time in some arbitrary units, y-axis is the charge in ADU):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/xBKIx.png&quot; alt=&quot;Measured signal (x-axis is the time in some arbitrary units, y-axis is the charge in ADU)&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to get the &quot;true&quot;, original signal, by deconvolving the instrument's response from the measured signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the response of the instrument to an Heaviside step function:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ob7WH.png&quot; alt=&quot;Response to an Heaviside (x-axis is the time in some arbitrary units, y-axis normalized&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this should help me characterize the instrument's response, and do the deconvolution. &#xA;I read about SVD and Bayesian unfolding, but these don't seem to do the trick (I need to built a transfer matrix first).&#xA;Could you suggest me any tool/algorithm to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help.&lt;/p&gt;&#xA;" OwnerUserId="16533" LastEditorUserId="128" LastEditDate="2019-12-31T09:57:39.893" LastActivityDate="2019-12-31T09:57:39.893" Title="Deconvolution Using Response to an Heavy Side" Tags="|transfer-function|impulse-response|deconvolution|inverse-problem|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24568" PostTypeId="2" ParentId="24557" CreationDate="2015-07-07T17:49:17.113" Score="6" Body="&lt;p&gt;The simplest and probably best approach is to use a second order IIR filter exchanging numerator and denominator from the original filter - as you suggested - but move the double pole at &lt;span class=&quot;math-container&quot;&gt;$z=-1$&lt;/span&gt; (Nyquist) slightly towards &lt;span class=&quot;math-container&quot;&gt;$z=0$&lt;/span&gt;, i.e. slightly decrease the pole radius to make the filter stable. Just play around with the exact value. The higher the value, the closer to Nyquist will the approximation of the inverse filter be.&lt;/p&gt;&#xA;&lt;p&gt;This little Matlab/Octave program shows how to do it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n = 2;                          % filter order      &#xA;[b,a] = butter(n,.1);           % some nth order Butterworth filter&#xA;r = 0.98;                       % desired EQ pole radius &amp;lt; 1&#xA;b2 = a;                         % EQ numerator&#xA;a2 = poly( - r * ones(n,1) );   % EQ denominator&#xA;k = sum(a2)/sum(b2);&#xA;b2 = k*b2;                      % scaling (for 0dB gain)&#xA;[H1,w] = freqz(b,a,1024);       % Butterworth frequency response&#xA;H2 = freqz(b2,a2,1024);         % EQ frequency response&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TUye5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TUye5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2023-02-07T10:59:35.983" LastActivityDate="2023-02-07T10:59:35.983" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="24569" PostTypeId="1" AcceptedAnswerId="24577" CreationDate="2015-07-07T23:51:41.597" Score="0" ViewCount="67" Body="&lt;p&gt;For speech signals, do the harmonics have a constant bandwidth above some threshold (arbitrarily, -6 dB  dropoffs)? Or does this bandwidth decrease with the upper harmonics? If this is not known, how can it be measured? (I could imagine one way would be find -6 dB dB points around peaks of a given frame of samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4OEKt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-07-08T00:51:00.527" LastActivityDate="2015-07-08T16:38:05.377" Title="Bandwidth of time-varying harmonics of speech" Tags="|filters|speech-processing|speech|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="24571" PostTypeId="1" AcceptedAnswerId="24573" CreationDate="2015-07-08T02:03:17.667" Score="0" ViewCount="2266" Body="&lt;p&gt;I use matlab R2015a, when I run my script I want print the date and the time of exection &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Dtimes=datetime('now','TimeZone','local','Format','d-MMM-y HH:mm:ss Z');&#xA;% the first test&#xA;disp(' Date and time is ' Dtimes ); % But not work&#xA;% second test&#xA;disp(sprintf('date and time is %s  ',Dtimes)) %also not work&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But with this command is worked :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;disp(sprintf('date and time is %s  ',datestr(now)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the problem?&lt;/p&gt;&#xA;" OwnerUserId="16063" LastEditorUserId="13320" LastEditDate="2016-11-21T13:15:05.207" LastActivityDate="2016-11-21T13:15:05.207" Title="print a date and time in command window MATLAB" Tags="|matlab|" AnswerCount="2" CommentCount="1" ClosedDate="2015-07-09T12:22:56.627" ContentLicense="CC BY-SA 3.0" />
  <row Id="24572" PostTypeId="2" ParentId="24571" CreationDate="2015-07-08T03:54:06.923" Score="0" Body="&lt;p&gt;Based on Mathworks' documentation &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/datetime.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, &lt;code&gt;datetime&lt;/code&gt; returns an array, not a string. Therefore, you cannot use disp to display a string &lt;code&gt;Date and time is&lt;/code&gt; together with that returned array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your second method is also not working because again Dtimes is an array and you cannot use &lt;code&gt;%s&lt;/code&gt; to print it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your last method is working because &lt;code&gt;datestr&lt;/code&gt; returns a string &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/datestr.html?searchHighlight=datestr&quot; rel=&quot;nofollow&quot;&gt;see documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if this explanation is not clear/enough.&lt;/p&gt;&#xA;" OwnerUserId="16503" LastActivityDate="2015-07-08T03:54:06.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24573" PostTypeId="2" ParentId="24571" CreationDate="2015-07-08T03:55:44.973" Score="0" Body="&lt;p&gt;While significantly off topic, this one is easy: Dtimes is datetime object and not a string. What would work is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;display(Dtimes)&#xA;disp([' Date and time is ' char(Dtimes)] ); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-08T03:55:44.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24574" PostTypeId="2" ParentId="24562" CreationDate="2015-07-08T10:43:27.427" Score="-1" Body="&lt;p&gt;If you write &lt;code&gt;zeros(length(t))&lt;/code&gt; you are creating a matrix with &lt;code&gt;length(t)&lt;/code&gt; rows and &lt;code&gt;length(t)&lt;/code&gt; columns. Instead, you should write &lt;code&gt;zeros(1, length(t))&lt;/code&gt; in order to have an array. Also you don't need a for loop. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   t = -10:1:10;&#xA;   x = zeros(1, length(t));&#xA;   x(t==0) = 1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, an &lt;code&gt;end&lt;/code&gt; is missing in your code, because both &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;for&lt;/code&gt; need it, and you should write &lt;code&gt;x(i)&lt;/code&gt; in order to insert &lt;code&gt;1&lt;/code&gt; in that specific position.&lt;/p&gt;&#xA;" OwnerUserId="15543" LastEditorUserId="15543" LastEditDate="2015-07-08T12:04:31.253" LastActivityDate="2015-07-08T12:04:31.253" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24575" PostTypeId="2" ParentId="24512" CreationDate="2015-07-08T12:48:51.283" Score="1" Body="&lt;p&gt;You're trying to solve what's called &lt;a href=&quot;https://en.wikipedia.org/wiki/Anisotropic_diffusion&quot; rel=&quot;noreferrer&quot;&gt;Perona Malik Non Linear Diffusion&lt;/a&gt; Problem (Sometimes people call it, by mistake, Anisotropic Diffusion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyhow, the simplest code for that is &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/14995&quot; rel=&quot;noreferrer&quot;&gt;Anisotropic Diffusion (Perona &amp;amp; Malik)&lt;/a&gt; on The &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange&quot; rel=&quot;noreferrer&quot;&gt;MATLAB File Exchange&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a more advanced (Anisotropic for real) algorithm in &lt;a href=&quot;https://github.com/RoyiAvital/Fast-Anisotropic-Curvature-Preserving-Smoothing&quot; rel=&quot;noreferrer&quot;&gt;Fast Anisotropic Curvature Preserving Smoothing&lt;/a&gt; (Also on the File Exchange - &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/48369&quot; rel=&quot;noreferrer&quot;&gt;Fast Anisotropic Curvature Preserving Smoothing&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enjoy...&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-07-08T12:48:51.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24576" PostTypeId="2" ParentId="23967" CreationDate="2015-07-08T15:31:36.553" Score="1" Body="&lt;p&gt;Like another answerer stated, 44.1 kHz is a standard sample rate used (44 kHz is a common &quot;approximation&quot;), such as for CD audio (&lt;a href=&quot;https://en.wikipedia.org/wiki/Compact_Disc_Digital_Audio&quot; rel=&quot;nofollow&quot;&gt;Red Book standard&lt;/a&gt;), so the number of samples would be 44e3*n_seconds.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, one other consideration is the source sound data-- if it is coming from an &lt;a href=&quot;https://en.wikipedia.org/wiki/MP3&quot; rel=&quot;nofollow&quot;&gt;mp3&lt;/a&gt; file (or wma, aac, mp4, etc.), the audio is compressed and you would need to have a &lt;a href=&quot;https://en.wikipedia.org/wiki/Codec&quot; rel=&quot;nofollow&quot;&gt;codec&lt;/a&gt; on your board to uncompress it. This might be a lot of work because decoding compressed audio would be harder than your actual project, so you'd need to find someone else's implementation and integrate it into your project. If you had uncompressed audio, like PCM (&lt;a href=&quot;https://en.wikipedia.org/wiki/Pulse-code_modulation&quot; rel=&quot;nofollow&quot;&gt;pulse coded modulation&lt;/a&gt;) inside a .&lt;a href=&quot;https://en.wikipedia.org/wiki/WAV&quot; rel=&quot;nofollow&quot;&gt;wav&lt;/a&gt; file &lt;a href=&quot;https://en.wikipedia.org/wiki/Digital_container_format&quot; rel=&quot;nofollow&quot;&gt;container&lt;/a&gt;, you could just pull the raw samples directly from the file and play them with out too much hassle.&lt;/p&gt;&#xA;" OwnerDisplayName="user16223" LastActivityDate="2015-07-08T15:31:36.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24577" PostTypeId="2" ParentId="24569" CreationDate="2015-07-08T16:38:05.377" Score="1" Body="&lt;p&gt;If the process that creates a spectrogram includes the use of a windowing function, then the artifacts of that windowing will have a nonzero bandwidth associated with that particular window function (including its length).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a signal is modulated, then it will have a non-zero bandwidth.  Any tiny variations in the mouth cavity shape or in the amplitude of the glottal closures or in the time period between glottal closures of voiced speech could be a cause of modulation of the harmonics.  These factors seem unlikely to be a fixed constant for all humans at all times.  Which might lead one to doubt a hypothesis of fixed bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-07-08T16:38:05.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24578" PostTypeId="1" CreationDate="2015-07-08T16:51:21.203" Score="2" ViewCount="285" Body="&lt;p&gt;I am trying to register two images of daily objects from different viewpoints (5 to 20 degrees angle). I have been reading about image registration and I feel like the best way to go is using Feature-Based methods for my purpose. But I still have some doubts about that.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is your method recommendation for images like below? Can rigid transformation methods be an option for me?&lt;/li&gt;&#xA;&lt;li&gt;What is your error measurement recommendation? I use 'root mean square error' currently. And my experiments show that Feature-Based better than Intensity Based methods on these kind of images (At least better than matlab's auto registration).&lt;/li&gt;&#xA;&lt;li&gt;What is the effect of registration process on the entropy of an image? I feel like registration should decrease the entropy.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reference Image&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1hNMW.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Target Image&lt;/strong&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/a6vQD.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot&lt;/p&gt;&#xA;" OwnerUserId="16542" LastActivityDate="2017-01-25T19:43:24.690" Title="Image Registration" Tags="|image-processing|matlab|image-registration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24579" PostTypeId="2" ParentId="24567" CreationDate="2015-07-08T17:55:49.507" Score="2" Body="&lt;p&gt;If we can assume no noise (Or the SNR is very high) you can get the response by applying the inverse filter in frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say $ y [n] $ are the signal samples.&lt;br&gt;&#xA;Given $ x [n] $ the samples of the ideal signal you can apply on both of them the DFT to get $ Y [k] $ and $ X [k] $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response is given by the Inverse DFT of the division $ \frac{Y[k]}{X[k]} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's some noise you need to regulate the result.&lt;br&gt;&#xA;Easy choice would be the &lt;a href=&quot;https://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;noreferrer&quot;&gt;Wiener Filter&lt;/a&gt; or more specifically &lt;a href=&quot;https://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;noreferrer&quot;&gt;Wiener Deconvolution&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-07-08T17:55:49.507" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24580" PostTypeId="1" CreationDate="2015-07-08T18:14:28.483" Score="4" ViewCount="1030" Body="&lt;p&gt;I have complex frequency response data (of an analog system) in the range of 100 Hz to 100 GHz, and it is sampled in frequency with logarithmic spacing. I would like to be able to turn this into a filter in MATLAB such that I can multiply it with the fft of time-domain signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not seeing a good match when using invfreqs.  What is the best way to do this?&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2016-12-06T19:54:35.730" Title="Transfer function estimation from logarithmic sweep frequency response data" Tags="|transfer-function|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24581" PostTypeId="1" CreationDate="2015-07-08T21:02:06.273" Score="0" ViewCount="288" Body="&lt;p&gt;I'm struggling with &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/cpsd.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;cpsd&lt;/code&gt;&lt;/a&gt; for 2D matrices. In my test, I've generated two 100x100 matrices (sine waves) &lt;code&gt;s1&lt;/code&gt; and &lt;code&gt;p1&lt;/code&gt; with a small phase difference between them. I'm trying to identify the propagation direction using this phase difference, hence using &lt;code&gt;cpsd&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Psp F] = cpsd(s1,p1....).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My guess is that &lt;code&gt;cpsd&lt;/code&gt; is the one for the job. However I'm not sure if I'm doing the right thing. When the crests of &lt;code&gt;s1&lt;/code&gt; and &lt;code&gt;p1&lt;/code&gt; are orthogonal to the axis, my script works just fine. However, if they have some angle, instead of two components, let's say in the 1st and 3rd quadrant, I end up with 4 components, in all quadrants. Not good...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose there's something wrong with the way I'm using &lt;code&gt;cpsd&lt;/code&gt; for matrices. Anyone out there could give me a hand? Many thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code so far&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[numrow numcol] = size(s1);&#xA;for c = 1:numcol&#xA;    [Psp1(:,c),F]= cpsd(s1(:,c),p1(:,c),[],[],[],dt,'twosided');&#xA;end&#xA;for l = 1:numrow&#xA;    [Psp2(l,:),F]= cpsd(s1(l,:),p1(l,:),[],[],[],dt,'twosided');&#xA;end&#xA;Psp=Psp1*Psp2;&#xA;F1=F-1/(2*dt); % &#xA;[XF YF] = meshgrid(F, F);      &#xA;[XF1 YF1] = meshgrid(F1, F1);            &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16456" LastEditorUserId="80" LastEditDate="2015-07-08T22:20:04.453" LastActivityDate="2015-07-08T22:20:04.453" Title="Cross spectrum using `cpsd` (matlab) of 2D matrices" Tags="|signal-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24582" PostTypeId="2" ParentId="24488" CreationDate="2015-07-08T22:19:30.940" Score="0" Body="&lt;p&gt;Your problem is this calculation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;8*(8000/256) &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If the bin number is 8, then the frequency of that bin will be &lt;code&gt;8*(8000/128)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why? Because the maximum frequency that sampling at 8kHz can show (without aliasing) is 4kHz.  So the bin at about &lt;code&gt;N/2&lt;/code&gt; (where &lt;code&gt;N&lt;/code&gt; is the number of points in your FFT) will correspond to half the sampling frequency...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bin at &lt;code&gt;N=256&lt;/code&gt; will correspond to a frequency of &lt;code&gt;-8000/256&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-07-08T22:19:30.940" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="24585" PostTypeId="1" AcceptedAnswerId="24587" CreationDate="2015-07-09T04:32:04.530" Score="0" ViewCount="1958" Body="&lt;p&gt;So I'm apply the median filter to an image, but at the output, there's blue semi-dots appearing. What are they?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the output&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YIhNh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the python code for anyone interested&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy.ndimage.filters import median_filter&#xA;from matplotlib.pylab import imread, imshow, subplot, title, show, get_cmap&#xA;&#xA;img = imread('images/speckle.gif')&#xA;new = median_filter(img, 3)&#xA;&#xA;subplot(121); imshow(img, cmap=get_cmap('gray'));&#xA;title('The original')&#xA;subplot(122); imshow(new, cmap=get_cmap('gray'));&#xA;title('Filtered with the median_filter')&#xA;&#xA;show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16548" LastActivityDate="2015-07-09T18:05:46.737" Title="noise remains after applying median filter" Tags="|image-processing|filters|python|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24587" PostTypeId="2" ParentId="24585" CreationDate="2015-07-09T07:18:19.280" Score="1" Body="&lt;p&gt;Convert the image to gray scale before applying the median filter.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-07-09T07:18:19.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24591" PostTypeId="1" CreationDate="2015-07-09T08:49:15.880" Score="4" ViewCount="999" Body="&lt;p&gt;I have a bandpass signal x. I am taking hilbert transform of it. I want to reconstruct amplitude and phase of the signal.Therefore, i am using Hilbert transform.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hil = hilbert(x);&#xA;&#xA;f = ?&#xA;&#xA;amp = abs(hil);&#xA;&#xA;figure, plot(f,abs(hil);&#xA;&#xA;phase = angle(hil);&#xA;&#xA;figure, plot(f,angle(hil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here how to define the frequency axis, so i can get the amplitude graph 's length equal to my bandwidth. Moreover, is this the correct way for amplitude and phase reconstruction? My bandwidth is here 40 KHz. Thank you everyone in advance&lt;/p&gt;&#xA;" OwnerUserId="16555" LastEditorUserId="16555" LastEditDate="2015-07-10T11:26:27.987" LastActivityDate="2017-10-31T01:53:45.513" Title="Hilbert transform of a bandpass signal" Tags="|matlab|digital-communications|dsp-core|hilbert-transform|" AnswerCount="2" CommentCount="4" ClosedDate="2017-10-31T19:07:13.810" ContentLicense="CC BY-SA 3.0" />
  <row Id="24592" PostTypeId="2" ParentId="24500" CreationDate="2015-07-09T09:39:19.217" Score="1" Body="&lt;p&gt;Suppose your signal is x. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L = length(x);                   %%% Length of your signal&#xA;nfft = L;                        %%% number of points in your fft&#xA;res = fft(x,nfft)/nfft;          %%% taking fft of your signal&#xA;f = fs/2*linspace(0,1,nfft/2+1); %%% defining correct frequency axis&#xA;res = res(1:nfft/2+1);           % half spectrum becos fft result is mirror&#xA;figure, plot(f,abs(res));        % here you can amplitude in freq domain  &#xA;figure, plot(f,angle(res));      % here you can see phase in freq domain.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully, this will be helpful to you.&lt;/p&gt;&#xA;" OwnerUserId="16555" LastEditorDisplayName="user11906" LastEditDate="2015-07-10T00:42:56.550" LastActivityDate="2015-07-10T00:42:56.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24594" PostTypeId="1" CreationDate="2015-07-09T13:15:52.477" Score="2" ViewCount="236" Body="&lt;p&gt;Take a general linear Gaussian state space model (SSM)(aka Dynamic Linear Model DLM):&#xA;\begin{align}&#xA;X_{t+1}&amp;amp;=FX_t + V_t\\  &#xA;Y&amp;amp;=HX_t+W_t\\  &#xA;V_t &amp;amp;\sim \mathcal N(0,Q)\\ &#xA;W_t &amp;amp;\sim \mathcal N(0,R)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in the unidentifiability issues related to these models: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hamilton (1994) states that: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;in the absence of restrictions on $F$, $H$, $Q$ and $R$, the parameters of the state-space representation are unidentified - more than one set of&#xA;  values for the parameters can give rise to the identical value of the&#xA;  likelihood function, and the data give us no guide for choosing among&#xA;  these&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now I realise that this representation is not unique as multiplication by any orthonormal matrix $M$ produces a new representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;MX_{t+1}&amp;amp;=MFM^{-1}X_t + MV_t\\ &#xA;Y&amp;amp;=HM^{-1}MX_t+W_t&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of unidentifiability where the observed values can be produced by various orthonormal transformations of the state variables is inherent to state space models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I also came across another type of unidentificability that seems to be related to the estimation method. In this case &quot;Kalman Filtering&quot;. See the simple example starting &lt;a href=&quot;https://rucore.libraries.rutgers.edu/rutgers-lib/25840/pdf/1/&quot; rel=&quot;nofollow&quot;&gt;on page 8 here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case there is a linear transformation of the observation equation and an offsetting one made to the variance of the state equation  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Do both the transformations above give rise to the same kind of identifiability issues described by Hamilton (I believe they do but want to check) ?&lt;/li&gt;&#xA;&lt;li&gt;Are there other ways in which identifiability issues can manifest themselves in Linear Gaussian SSMs ?&lt;/li&gt;&#xA;&lt;li&gt;Is the fix always the same find constraints or analogously (Bayesian priors) that will ensure that the final parameters are correct ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Lastly, &lt;a href=&quot;http://uk.mathworks.com/help/ident/ref/idss.html#btq_tib-1&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt; in Matlab suggests that it is possible to build an &quot;identifiable SSM&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the link doesn't explain the theory:&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;It is possible to translate any Linear Gaussian SSM into an &quot;identifiable form&quot; ? Can someone please supply a link reference explaining how this works. It would seem at first blush that no matter what representation is used initially it would still be subject to the problems shown above ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Baz&lt;/p&gt;&#xA;" OwnerUserId="8943" LastEditorUserId="1629" LastEditDate="2016-02-15T01:10:08.740" LastActivityDate="2016-02-15T01:10:08.740" Title="Identifiability of a state space model (Dynamic Linear Model)" Tags="|kalman-filters|system-identification|state-space|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24598" PostTypeId="1" AcceptedAnswerId="24600" CreationDate="2015-07-09T14:06:08.593" Score="1" ViewCount="4410" Body="&lt;p&gt;There is a low pass filter with difference equation already provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y_n = (x_n - 2x_{n-6} + x_{n-12}) - (-2y_{n-1} + y_{n-2})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;a_0 = 1, a_1 = -2, a_2 = 1&#xA;$$&#xA;$$&#xA;b_0 = 1, b_6 = -2, b_{12} = 1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the filter was designed with some gain as the filtered output is significantly exceeds original signal dynamic range &lt;code&gt;x1 = scipy.signal.lfilter(b, a, x&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to normalize filter coefficients to have the same as input signal dynamic range or approximately redesign it from filter frequency response?&lt;/p&gt;&#xA;" OwnerUserId="390" LastActivityDate="2015-07-09T15:51:47.197" Title="How to normalize predesigned IIR filter coefficients to have unity gain?" Tags="|filters|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24599" PostTypeId="1" CreationDate="2015-07-09T14:09:38.937" Score="3" ViewCount="2419" Body="&lt;p&gt;I don't think this question has a good answer but will ask nevertheless since it has been bothering me for a few days.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in computing as efficiently as possible the N-point FFT of a N/2 vector that has been zero-padded with N/2 zeros.  (I am actually interested in doing the same for vectors zero-padded with many more zeros but let's discuss the simplest case simple here.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple obvious optimization consists in skipping half of the computations in the first FFT stage which correspond to multiplying a zero input value by a twiddle factor.  One could further skip a quarter of the computations that have zeros in the second stage, and so on, but the savings quickly dwindle down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping we could do better.  After all, an FFT of a zero-padded vector is essentially a sinc interpolation of a smaller FFT taken on the non-zero smaller input vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, writing down the math shows exactly that.  If I call the FFT of the non-zero N/2 vector y, the FFT of the zero-padded vector ypad, @ represents the circular convolution, and SINC the N/2 FFT of the first N/2 twiddles of an N-point FFT, we have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ypad[2k]   = y[k]  &lt;/li&gt;&#xA;&lt;li&gt;ypad[2k+1] = ( y  @ SINC )[k]  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Problem is: computing the circular convolution of y by the SINC function for each odd point is very costly and doesn't lead to a faster implementation that computing the N-point FFT.  My last hope is that once we have computed the circular convolution in one point, the circular convolution for other points can be derived with fewer computations, but I currently don't think so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone an idea on how to compute efficiently the N-point FFT from the N/2-point FFT of the non-zero vector or is that a dead end?&lt;/p&gt;&#xA;" OwnerUserId="15857" LastActivityDate="2015-07-10T02:35:14.133" Title="Efficient FFT computation of a zero-padded vector" Tags="|fft|convolution|algorithms|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24600" PostTypeId="2" ParentId="24598" CreationDate="2015-07-09T15:21:35.770" Score="2" Body="&lt;p&gt;In general, divide each of the $b$ coefficients by the maximum gain of your filter. This is equivalent to adding an attenuator before or after the original filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this particular case, the maximum gain seems to occur at frequency 0 (where there is a double zero-pole cancellation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At frequency 0, the gain of your filter is 36. So divide $b[]$ by 36.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; the math&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response comes from evaluating $H(z)$ at $z = e^{j\theta}$. Substituting and operating, and ignoring the phase, you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|H(e^{j\theta})| = \frac{\sin(\theta/2)^2}{\sin(6\theta/2)^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the limit as $\theta \rightarrow 0$ you get $H(e^{j0}) = 36$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is a simpler (and well known) filter applied twice. It corresponds the moving average of 6 samples (with the 1/6 factor missing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it is like two filters in cascade, each of which sums 6 consecutive samples. Each is a low-pass filter with gain 6 at 0 frequency.&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2015-07-09T15:51:47.197" LastActivityDate="2015-07-09T15:51:47.197" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24602" PostTypeId="1" AcceptedAnswerId="24604" CreationDate="2015-07-09T16:15:58.393" Score="0" ViewCount="216" Body="&lt;p&gt;I generate a sinus which duration is 15ms and frequeuncy of 13KHz. Is its bandwidth is (1/15ms) ? Or in other words, BW = 66.6Hz?&#xA;I ask that because I have two freqs in my system: 13K &amp;amp; 13.1K. &#xA;I know that they are seperated by 100Hz. And as the tone I generate have a lower duration I think it spreads into its friend area.     &lt;/p&gt;&#xA;" OwnerUserId="15637" LastActivityDate="2015-07-09T16:45:33.273" Title="Bandwidth of a trimmed sinus wave" Tags="|signal-analysis|frequency-spectrum|bandwidth|fsk|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24604" PostTypeId="2" ParentId="24602" CreationDate="2015-07-09T16:45:33.273" Score="1" Body="&lt;p&gt;The spectrum of your windowed sinusoid is just a shifted sinc function (assuming a rectangular window). If $T=0.015s$ is the length of the signal then the magnitude of the spectrum at positive frequencies is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(f)=T|\text{sinc}((f-f_0)T)|,\quad f&amp;gt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $f_0$ the frequency of the sinusoid, and where I use the definition $\text{sinc}(x)=\sin(\pi x)/(\pi x)$. So with $\Delta f=100Hz$ (the distance to the other sinusoid), you get a relative attenuation of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\text{sinc}(\Delta f\cdot T)|=0.21221\doteq 13.5\,\text{dB}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at the frequency of the neighboring sinusoid, the spectrum of the other (finite length) sinusoid is about $13.5\,\text{dB}$ lower.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-09T16:45:33.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24607" PostTypeId="1" CreationDate="2015-07-09T18:03:58.157" Score="1" ViewCount="918" Body="&lt;p&gt;I am dealing with 2D signals that are random. To be more specific my input is a matrix of 1's and 0's. Moreover, at any position (n1,n2) the probability of having a 1 or a 0 is same. One example is shown below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/9atnb.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I look at books dealing with 2D signal processing, everything is explained wrt to image processing. In my understanding, image is a very special kind of 2D signal where one can expect to see some relationship between the pixels like EDGES. Such features are useful when doing image restoration,etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Inioh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These books start with defining 2D signals and system but explain everything wrt to image processing application which is a bit restrictive. &#xA;Why is the case? &lt;/p&gt;&#xA;" OwnerUserId="16080" LastActivityDate="2015-12-07T21:24:53.340" Title="why always structured Images are considered as 2D signals?" Tags="|image-processing|" AnswerCount="2" CommentCount="1" ClosedDate="2015-12-07T21:55:13.183" ContentLicense="CC BY-SA 3.0" />
  <row Id="24608" PostTypeId="2" ParentId="24585" CreationDate="2015-07-09T18:05:46.737" Score="0" Body="&lt;p&gt;Instead of converting this image to gray and then apply median filter, an alternative is to use the vector median filter. In this context, a vector median filter considers each pixel as a 3D-vector composed by R, G, and B channel intensities, and finds a median w.r.t. to this vector instead one median for each channel. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-07-09T18:05:46.737" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24609" PostTypeId="1" CreationDate="2015-07-09T19:12:11.997" Score="1" ViewCount="136" Body="&lt;p&gt;I am using a matched filter to recognize an audio sample within a noisy input stream by cross correlating my sample with the input array and checking if the maximum crosses over my threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently my threshold is static and my input is not normalized, and my results are greatly affected by the gain of my input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I normalize my input signal vector, or dynamically calculate my threshold based on the input gain? If either is a good choice, how would I go about implementing this?&lt;/p&gt;&#xA;" OwnerUserId="16431" LastActivityDate="2015-07-09T19:12:11.997" Title="Should I normalize my input vector when using a matched filter?" Tags="|audio|matched-filter|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24610" PostTypeId="1" AcceptedAnswerId="24626" CreationDate="2015-07-09T21:19:08.620" Score="3" ViewCount="624" Body="&lt;p&gt;&lt;strong&gt;For this may be a X-Y question, I'm providing the full background story:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to test for the correctness for a fixed point implementation of bilateral filter written in C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current approach is to compare it's output with a double-precision Matlab version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This helps me capture issues like insufficient precision, pointer out of bound and uninitialized variables and other (stupid) bugs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the C version matches Matlab version with sufficient precision and with no obvious bugs, but I'm not very confident that Matlab version is correct at all, for it is not fully tested or reviewed by anyone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having worked as a tester for a while, I have the feeling that be best way, if not the only way, to test for correctness of the implementation of a signal processing algorithm, is to check for it's properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, &lt;a href=&quot;http://www.getreuer.info/home/waveletcdf97&quot; rel=&quot;noreferrer&quot;&gt;this CDF 9/7 wavelet example&lt;/a&gt; uses &quot;perfect reconstruction&quot; property and &quot;N vanishing moments&quot; property as test cases, and it indeed established a fair amount of confidence that his implementation works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only property of bilateral filer is &quot;edge preserving&quot;, which isn't a strong proof of correctness. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does bilateral filter has other properties that can be used as proof of correctness of an implementation?&lt;/p&gt;&#xA;" OwnerUserId="16565" LastEditorUserId="128" LastEditDate="2018-08-23T09:20:55.330" LastActivityDate="2019-08-18T14:00:45.137" Title="How to Validate Bilateral Filter Implementation?" Tags="|image-processing|software-implementation|edge-preserving-filter|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24611" PostTypeId="1" CreationDate="2015-07-09T23:39:47.320" Score="1" ViewCount="466" Body="&lt;p&gt;I'm trying to find the phase shift between two 100x100 matrices, s and p. To start with I'm using two sine waves (2D) slightly shifted. I manage to compute the correct amplitude spectrum (using the Fourier Transform of the cross correlation between s and p) but the phase value at the peaks is not the one that I have set. I'm not using cpsd because I did not manage to understand the correct way to use it for 2D matrices. The manual is very confusing and I couldn't get any help online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I do the same procedure for 1D sine waves, using cpsd or fft of xcorr employing the welch method, I get both the amplitude and phase right. I suppose that conceptually I'm doing the right thing, but there's sth about how to get the phase shift between two matrices that is bugging me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really would appreciate any tips on how to compute the phase shift between matrices. Some real piece of code would be lovely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank you in advance for your time&lt;/p&gt;&#xA;" OwnerUserId="16456" LastActivityDate="2015-07-09T23:39:47.320" Title="phase shift between two images (matrices)" Tags="|image-processing|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24612" PostTypeId="2" ParentId="24599" CreationDate="2015-07-10T02:35:14.133" Score="3" Body="&lt;p&gt;You can decompose the FFT that you describe into some smaller transforms. Take a look at what you're calculating when you zero-pad a vector $x[n]$ of length $N \over 2$ to length $N$ and calculate a DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X[k] = \sum_{n=0}^{\frac{N}{2}-1} x[n] e^{-j2\pi nk \over N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To split this up into two transforms, first look at just the even-indexed terms in the $N$-point sequence $X[k]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;X[2k] &amp;amp;= \sum_{n=0}^{\frac{N}{2}-1} x[n] e^{-j2\pi n2k \over N} \\&#xA;&amp;amp;= \sum_{n=0}^{\frac{N}{2}-1} x[n] e^{-j2\pi nk \over \frac{N}{2}}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Via inspection of the above, we can conclude that the even-indexed terms of the zero-padded DFT are just equal to the $\frac{N}{2}$-point DFT of the original input sequence (with no zero-padding). What about the odd-indexed terms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;X[2k+1] &amp;amp;= \sum_{n=0}^{\frac{N}{2}-1} x[n] e^{-j2\pi n(2k+1) \over N} \\&#xA;&amp;amp;= \sum_{n=0}^{\frac{N}{2}-1} x[n] e^{-j2\pi n \over N} e^{-j2\pi nk \over \frac{N}{2}}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a similar expression to the even-indexed terms $X[2k]$. We take the original $N\over 2$-length sequence, multiply it by a complex exponential sequence $e^{-j2\pi n \over N}$, then calculate the $N \over 2$-length DFT of the result. This makes intuitive sense if we write the exponential as $e^{-j2\pi 0.5n \over \frac{N}{2}}$: multiplying by such a complex exponential yields a shift in the frequency domain of half of a $N \over 2$-length DFT bin width. This gives the interpolation-by-2 effect that the zero-padding is known to yield.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In summary:&lt;/strong&gt; To decompose an $N$-point DFT that consists of an $N \over 2$-point signal $x[n]$ followed by $N \over 2$ zeros, do the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate an $N \over 2$-point DFT of the original signal $x[n]$. This make up the even-indexed values in the zero-padded DFT result.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiply the original signal by the complex exponential function $e^{-j2\pi n \over N}$. Calculate an $N \over 2$-point DFT of the product. This makes up the odd-indexed values in the zero-padded DFT result.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The caveat:&lt;/strong&gt; While it depends on your DFT size $N$, this may not effect any tangible reduction in complexity beyond just calculating the zero-padded DFT directly. I have an application where I've tried to make a similar optimization myself in the past, although it is on a very different platform from what you described (mine runs on high-performance server machines using highly-optimized FFT libraries like Intel Math Kernel Library). While you may be able to achieve a theoretical reduction in the total number of arithmetic operations that you need, due to other effects like memory accesses, caching, and so on, it's common that trying to do 2 $N \over 2$-point FFTs is slower than just doing one $N$-point FFT directly. In my case, I've never been able to beat the existing library's $N$-point transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To estimate the complexity reduction by doing this, we can estimate the number of arithmetic operations that each method needs. Using the rule of thumb that an $N$-point FFT requires approximately $5 N \log N$ arithmetic operations, we can estimate the savings in operations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{savings} = 5 N \log N - \left(2\left(5 \frac{N}{2} \log \frac{N}{2} \right)+5 \frac{N}{2}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{savings} = 5 N \log N - \left(5 N \log \frac{N}{2} +5 \frac{N}{2}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first term in the parentheses counts the approximate number of operations required by the 2 $\frac{N}{2}$-point DFTs, while the second term counts the number of operations needed for the $\frac{N}{2}$-point complex vector multiplication (there are 5 scalar operations per complex multiply).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, as $N$ increases, the amount of savings diminishes because of the logarithmic scaling of the DFT. For typical DFT sizes, you will likely find that this approach yields little complexity reduction.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-07-10T02:35:14.133" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24614" PostTypeId="2" ParentId="24012" CreationDate="2015-07-10T11:42:29.637" Score="1" Body="&lt;p&gt;The key point of blind signal separation is the separation of a mixture of signals when there is mathematically insufficient knowledge to do so. On the contrary if you, mathematically, have sufficient information to distinguish two or more signals from a given mixture of them, then you can, as mathematically expected, perfectly separate them using well known fundamental operations of signal processing (algebra, calculus, etc.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This latter operation is not coined a specific name for it, since its principles directly follow that of well known basic signal processing manipulations. Blind source separation however makes some claims about the type of mixture and imposes some structures on the characteristics of the signals, which is used to compensate the lack of information necessary in the separation of the mixture. That's why it is given a specific name.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-07-10T11:42:29.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24615" PostTypeId="1" AcceptedAnswerId="24625" CreationDate="2015-07-10T12:10:58.177" Score="0" ViewCount="248" Body="&lt;p&gt;I have designed a FIR filter with following parameters &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=30, &#xA;f_pass1 = 1, stop1 = 0.5, f_pass2 = 3, f_stop2 = 4,&#xA;A_pass = 1,A_stop = 40&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is code : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs_filter=30;&#xA;&#xA;f_pass1 = 1; %1.2&#xA;f_stop1 = 0.5;%0.7&#xA;&#xA;f_pass2 = 3;&#xA;f_stop2 = 4; %6&#xA;&#xA;A_pass = 1;&#xA;A_stop = 40;&#xA;&#xA;del_f1 = -f_stop1 + f_pass1;&#xA;del_f2 = f_stop2-f_pass2;&#xA;&#xA;del_f = min(del_f1,del_f2);&#xA;&#xA;fc1 = f_pass1 -(( del_f)/2);&#xA;fc2 = f_pass2 +( (del_f)/2);&#xA;&#xA;w_c1 = (2*pi*fc1)/(fs_filter);&#xA;w_c2 = (2*pi*fc2)/(fs_filter);&#xA;&#xA;S_pass = ((10^(A_pass/20))-1)/((10^(A_pass/20))+1);&#xA;S_stop = 10^(-A_stop/20);&#xA;&#xA;S = min(S_pass ,S_stop);&#xA;&#xA;A = -20*log10(S)&#xA;&#xA;alpha =0;&#xA;D = 0.922;&#xA;&#xA;if A &amp;gt; 21 &amp;amp;&amp;amp; A &amp;lt; 50 &#xA;    alpha = 0.5842*((A-21)^0.4)+0.07886*(A-21);&#xA;    D = (A-7.95)/14.35;&#xA;elseif A&amp;gt;=50&#xA;    alpha = 0.1102*(A-8.7);&#xA;    D = (A-7.95)/14.35;&#xA;end &#xA;&#xA;N = floor(((D*fs_filter)/del_f)+1);&#xA;&#xA;N = N + mod(N-1,2)&#xA;&#xA;M = (N-1)/2;&#xA;&#xA;coeff= zeros(1,N);&#xA;w   = zeros (1,N);&#xA;d   = zeros (1,N); &#xA;&#xA;for i=0:N-1&#xA;    x_b= sqrt(1-(((i-M)/M)^2));&#xA;&#xA;    w(i+1) = besseli(0,(alpha*x_b))/besseli(0,alpha);&#xA;&#xA;    if i ~= M&#xA;    d(i+1) =((w_c2/pi)*(sin(w_c2*(i-M)))/(w_c2*(i-M)))-((w_c1/pi)*(sin(w_c1*(i-M)))/(w_c1*(i-M)));&#xA;    coeff(i+1) = w(i+1)*d(i+1);&#xA;    else&#xA;    d(i+1) = ((w_c2-w_c1)/pi);&#xA;    coeff(i+1) = w(i+1)*d(i+1);&#xA;    end&#xA;&#xA;end&#xA;&#xA;fft_coeff = abs(fft(coeff));&#xA;num_bins = length(fft_coeff);&#xA;bins = 0 : num_bins-1;&#xA;bin_Hz = bins*fs_filter/num_bins;&#xA;N_2 = ceil(num_bins/2);&#xA;&#xA;plot(bin_Hz(1:N_2) , fft_coeff(1:N_2),'x');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/sQXiM.jpg&quot; alt=&quot;ftt of the filter coeff&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when i am convoluting it with the sin wave of say frequency f ( 0.1 to 5) sampled at fs = 50 the output of the signal is not actually following the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code for generating signal :- &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    fs=50;&#xA;    f0 = 0.6593;&#xA;    cyc = 50;&#xA;    t = 0:1/fs:cyc/f0;&#xA;    x = sin(2*pi*f0*t);&#xA;    y = conv(x,coeff,'valid');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;am i missing something ?&lt;/p&gt;&#xA;" OwnerUserId="16571" LastEditorUserId="7092" LastEditDate="2015-07-10T22:18:17.307" LastActivityDate="2015-07-10T22:18:17.307" Title="Fir filter not working according to frequency response" Tags="|matlab|filters|discrete-signals|filter-design|finite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24616" PostTypeId="2" ParentId="24488" CreationDate="2015-07-10T12:19:01.027" Score="0" Body="&lt;p&gt;Dumb mistake.  I was toggling the pin at 8kHz, which means the sample rate was double that of the pin oscillations. (pin high + pin low = 2 samples, but one pin period.) The FFT and ADC config except the sample rate were actually correct the whole time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for all the help.  Unfortunately, I have too few reputation points to give anybody an upvote.&lt;/p&gt;&#xA;" OwnerUserId="9071" LastActivityDate="2015-07-10T12:19:01.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24618" PostTypeId="2" ParentId="2736" CreationDate="2015-07-10T12:51:34.487" Score="4" Body="&lt;p&gt;While explaining the two-dimensional case very well, the answer proposed by Jav_Rock does not provide a valid solution for camera poses in three-dimensional space. Note that for this problem multiple possible solutions exist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://hal.inria.fr/inria-00174036v3/document&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; provides closed formulas for decomposing the homography, but the formulas are somewhat complex. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;OpenCV 3 already implements exactly this decomposition (&lt;a href=&quot;http://docs.opencv.org/3.0-beta/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#int%20decomposeHomographyMat%28InputArray%20H,%20InputArray%20K,%20OutputArrayOfArrays%20rotations,%20OutputArrayOfArrays%20translations,%20OutputArrayOfArrays%20normals%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;decomposeHomographyMat&lt;/a&gt;). Given an homography and a correctly scaled intrinsics matrix, the function provides a set of four possible rotations and translations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intrinsics matrix in this case needs to be given in pixel units, that means your principal point is usually &lt;code&gt;(imageWidth / 2, imageHeight / 2)&lt;/code&gt; and your focal length is usually &lt;code&gt;focalLengthInMM / sensorWidthInMM * imageHeight&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="16573" LastEditorUserId="16573" LastEditDate="2017-06-23T08:33:16.517" LastActivityDate="2017-06-23T08:33:16.517" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24619" PostTypeId="2" ParentId="23310" CreationDate="2015-07-10T14:27:37.593" Score="1" Body="&lt;pre&gt;&lt;code&gt;combinedImage = [leftImage, rightImage];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="7092" LastEditDate="2015-07-10T15:32:39.513" LastActivityDate="2015-07-10T15:32:39.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24620" PostTypeId="2" ParentId="24607" CreationDate="2015-07-10T14:46:18.307" Score="0" Body="&lt;p&gt;A grayscale image is typically a 2D scalar valued signal, while a colour image is a 2D vector valued signal. It doesn't have to be structured, I would call your example a noise image. Most images are of real-life objects, and so naturally contain some structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of image analysis is to extract information from an image. Most of that information is contained within image features such as lines or edges. Random noisy images contain very little information and are not really of interest. Hence why textbooks don't feature them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One kind of 2D signal without structure but which is of great interest is the Fourier transform of an image. These typically have few lines or edges.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2015-07-10T15:23:42.950" LastActivityDate="2015-07-10T15:23:42.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24621" PostTypeId="1" AcceptedAnswerId="41065" CreationDate="2015-07-10T14:51:01.913" Score="0" ViewCount="1148" Body="&lt;p&gt;I am doing fmcw radar simulation. I have an output of mixer and from that I want to reconstruct the amplitude and phase of the signal. Therefore, I am taking hilbert transform and by the &lt;code&gt;abs()&lt;/code&gt; and &lt;code&gt;angle()&lt;/code&gt;, I can get the phase and amplitude information. Since the hilbert transform is in time domain, I want to map this time domain axis into frequency domain so I can see the value of amplitude and phase at different frequencies. FFT is not an option since by taking the fft, I will get the beat frequency.Therefore, how to map this time domain axis to frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here are some of the relations between time and frequency. &lt;code&gt;t = f/K&lt;/code&gt;, where&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;K = Bw / Tm&#xA;f = frequency,&#xA;Bw = bandwidth,&#xA;Tm = transmit time&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess here, &lt;code&gt;deltaf = 1/ t(2)-t(1)&lt;/code&gt; and &lt;code&gt;fmax = 1/deltat&lt;/code&gt;, I am trying to map the time axis into frequency, but it gives dimension mismatch. Still there is something missing( some multiplyting factor or diving).Acoordig to my SV, its a demultiplexing process. That woud be really good if anyone can help me.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mixed1=(y.*(Y2));&#xA;hil = hilbert(y_filt);&#xA;figure, plot(t,abs(hil));&#xA;figure, plot(t,angle(hil));&#xA;deltaf = 1/t(2) - t(1);&#xA;fmax = 1/delta t;&#xA;f =?            %%% how to define frequency axis so i can plot amplitude &amp;amp; phase&#xA;figure, plot(f,abs(hil));&#xA;figure, plot(f,angle(hil));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16555" LastEditorUserId="7092" LastEditDate="2015-07-13T19:36:57.713" LastActivityDate="2017-05-18T07:26:00.097" Title="Signal reconstruction in FMCW radar" Tags="|matlab|signal-analysis|continuous-signals|signal-detection|hilbert-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24622" PostTypeId="1" CreationDate="2015-07-10T14:53:47.630" Score="0" ViewCount="541" Body="&lt;p&gt;I write this question as a new reference point because it is difficult to find something exhaustive regarding this topic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm talking about the calculus and interpretation of the phase delay of a recorded audio signal, i.e. NOT the phase response of a digital filter, as this topic is fully tackled around here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm analyzing an audio signal of a hammer hit on a material, so my signal resembles a finite impulse response. I want to check if the phase can give me any physical information about my material, so I started analyzing the phase response, in terms of Phase Delay and Group Delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculate the phase delay of my audio signal as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Take the whole audio file, call it $x(t)$;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;calculate $X(f) = \mathfrak{F}\{x(t)\}$;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$f$ is scaled so as to correspond to Hertz scale. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;calculate phase $\phi_x(f) = \arg\{(X(f)\}$, this gives me the phase shift expressed in radians; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Unwrap my phase response, $\phi_x(f) \leftarrow \phi_x(f) + n 2 \pi$. This ensures that all appropriate multiples of $2 \pi$ have been added to my phase response so that $\phi_x(f)$ is continuous (as much as possible);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;calculate phase delay as: $\tau_{\phi x}(f) = - \frac{\phi_x(f)}{2 \pi f}$;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Phase delay should tell me the time delay in seconds experienced by each sinusoidal component of the input signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I know the time delay between the begin of my audio signal and the onset, and the &quot;bias&quot; of my phase delay (a time delay common to all frequencies) should be the same of the time delay I'm aware of. Practically, I obtain a phase delay value that is quite higher. If the time delay of the onset is about 200 samples the phase delay converted in samples approaches about 1800 samples. Why? Am I sure my scale is in seconds? It should be, because in phase delay I'm dividing radians for radians/seconds. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What's the meaning of negative values of my phase delay? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) This is the plot of my phase delay:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4cYbh.png&quot; alt=&quot;Phase Delay of my signal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why higher frequencies (&gt;8000 Hz) tend to be progressively more and more delayed? Has it a physical meaning or something concerned with the behaviour of the audio cards (non linear phase response toward high frequencies) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) What about the frequencies components which &quot;tend&quot; to be not present in my audio signal (practically speaking it's impossible that in such a wideband signal a frequency amplitude can go to zero)? Is their phase calculus reliable as the most prominent frequency amplitudes? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) If I take different windows of my signal starting after the onset, at first phase delay tends to zero, and this is logical, I'm approaching the beginning of my frequency components. When I pass with my windows the peak area of my audio signal the phase delay tends to become incomprehensible, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YDZfI.png&quot; alt=&quot;second graphic of the phase, taking a slice of the signal at which the audio response already started&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot understand why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) Last question, I need to apply windowing when I compute the frequency amplitude response of my audio signal to avoid frequency leakage and cross talk phenomena, I'm not applying it in case of the phase response computation, am i wrong with that? &lt;/p&gt;&#xA;" OwnerUserId="15350" LastEditorUserId="4346" LastEditDate="2015-07-10T20:05:17.377" LastActivityDate="2015-07-10T20:05:17.377" Title="Detailed Analysis of Phase Delay of an Audio Signal" Tags="|signal-analysis|audio|phase|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24623" PostTypeId="1" CreationDate="2015-07-10T15:14:29.057" Score="0" ViewCount="393" Body="&lt;p&gt;I've noticed a couple of similar questions which haven't been answered such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/24381/derivation-of-transfer-function-from-bode-plot&quot;&gt;https://dsp.stackexchange.com/questions/24381/derivation-of-transfer-function-from-bode-plot&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, I thought I would ask since it hasn't been answered.&#xA;So as I understand the s-variable in the s-domain can be thought of as $j\omega $.&#xA;I have a Bode plot so I have values of $$H(j\omega)=H(j\omega) \exp[j\arg(H(j\omega))]=\textsf{gain}\cdot\exp(j \cdot\textsf{phase})$$&#xA;(The graph I had was not a magnitude in terms of decibel but not gain)&#xA;Now I tried to do a regression on it(actually probably technically not a regression from a statisticians' point of view by trying to minimise the least square error of a rational function $$(as^2+bs+c)/(ds^2+es+f)$$ and the values of $H(j\omega)$ that we have from the Bode plot. (Tried higher order rational function as well like of degree 10). And I get absolutely rubbish results for $a$,$b$,$c$,$d$,$e$,$f$ with Bode plots which look nothing alike. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="16574" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-07-13T08:01:29.720" Title="What am I doing wrong?-Bode plots to get transfer function" Tags="|fourier-transform|transfer-function|laplace-transform|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24624" PostTypeId="1" CreationDate="2015-07-10T16:04:15.677" Score="1" ViewCount="149" Body="&lt;p&gt;Not sure if this is the best stack exchange but I'll give it a shot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am performing background subtraction to collect Electroluminescent emission (i.e image w/ emission - image w/o emission = emission). Anyway, I am using a DSLR and collecting these images in .cr2 (canon raw format). Since the emission is weak, we wan't to make sure that we have the most data available to us and that it is as unprocessed as possible so we are converting the RAW images to .pgm (pre-bayer image data). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an issue, in some of the background that does not emit EL, for example a cabinet with drawers, when we perform background subtraction, we can detect all of the edges. Additionally, even if I try to do subtraction on 2 background images (both have no emission), the edges can still be clearly detected where we would expect simply black areas in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would anyone have insight on whether this is due to using .pgm, etc. Any suggestions at all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to ask more questions about the project etc. &#xA;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is what I get subtracting 2 images which should be essentially the same. I capture the raw image .cr2, convert it to .pgm using dcraw then subtract them using python numpy arrays and output a viewable png (what you see below.). Although, we would expect a black image(i.e subtracting two same/similar images), here I can detect all of the edges which makes no sense to me. Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gOfq5.jpg&quot; alt=&quot;Subtracting two background images&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16576" LastEditorUserId="-1" LastEditDate="2015-07-13T22:49:50.127" LastActivityDate="2015-07-13T22:49:50.127" Title="Image Subtraction using Pre-bayer data (.pgm)" Tags="|image-processing|python|background-subtraction|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24625" PostTypeId="2" ParentId="24615" CreationDate="2015-07-10T16:12:07.140" Score="1" Body="&lt;p&gt;Your normalized stop band and pass band edges are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}f_{s1}&amp;amp;=0.5/30=0.017\\&#xA;f_{p1}&amp;amp;=1/30=0.033\\&#xA;f_{p2}&amp;amp;=3/30=0.1\\&#xA;f_{s2}&amp;amp;=4/30=0.133\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the normalized frequency of your sinusoidal input signal is $0.6593/50\approx 0.013$, which is smaller than $f_{s1}$, so it's in the filter's stop band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you've designed your filter for a certain sampling frequency, and that it is only the &lt;em&gt;normalized&lt;/em&gt; band edges that are fixed; the absolute frequencies of the band edges change according to the sampling rate.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-10T16:12:07.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24626" PostTypeId="2" ParentId="24610" CreationDate="2015-07-10T16:32:42.113" Score="1" Body="&lt;p&gt;I'm assuming implementation which is defined by two parameters - Color Range STD and Spatial STD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Few Properties:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If you set the Color Range STD to be high, the result should be very very similar to Gaussian Blur with the Spatial STD.&lt;/li&gt;&#xA;&lt;li&gt;If you set the Color Range STD to be very near zero, the output image should be with no change (No smoothing at all).&lt;/li&gt;&#xA;&lt;li&gt;Good image to test things on is Black White rectangles (Like Checkers).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-07-10T16:32:42.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24629" PostTypeId="1" AcceptedAnswerId="24632" CreationDate="2015-07-10T18:47:31.837" Score="1" ViewCount="95" Body="&lt;p&gt;I have frequency response data of an analog system that I would like to turn into a digital filter in Matlab.  Is it kosher to think of my frequency samples as constituting a DFT of the system impulse response, even though there was never a time-domain signal in the first place?  If I do an ifft on the frequency response data, can this be treated as the impulse response of the system?  If so, what is the sample rate?  Do I assume it is twice the highest measured frequency?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to build a digital filter from impulse response data without knowing the sample rate?    &lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-07-10T19:49:57.200" Title="Treating the measured frequency response of a system as a DFT" Tags="|filters|sampling|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24632" PostTypeId="2" ParentId="24629" CreationDate="2015-07-10T19:49:57.200" Score="2" Body="&lt;p&gt;So, after worrying about whether the frequency response is &quot;low pass in nature&quot; (i don't think it needs to be a LPF, it &lt;em&gt;could&lt;/em&gt; be high pass in nature, but all of the interesting features of your frequency response should be below Nyquist and maybe well below Nyquist), you might also wonder about if you have the necessary phase information in your frequency response.  if it is magnitude-only data, then you might have to guess at the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you iFFT the magnitude-only data (mirroring it about $f=0$), you will come up with an impulse response that is also mirrored about $t=0$.  that's fine, give it a delay of half of the length of the impulse response, and you have a linear-phase FIR.  you get linear phase because you started not knowing anything of the phase.  you can also take that FIR, factor it with some nasty factorization program (maybe MATLAB has that), reflect (using the reciprocal function) all zeros outside the unit circle to inside the unit circle, the re-multiply all of the factors and you will have a minimum-phase FIR with the same magnitude frequency response.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-07-10T19:49:57.200" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24633" PostTypeId="1" CreationDate="2015-07-10T21:06:29.717" Score="1" ViewCount="1201" Body="&lt;p&gt;I'm wondering of anyone can explain why invfreqs() is unable to fit a polynomial to the data in the image below.  The red line is the measured frequency response of an analog system.  I should mention that this data is a logarithmic sweep from 100 Hz to 100 GHz. The blue line is the 11th order invfreqs fit (11th order in both numerator and denominator).  11th order does the best job, but as you can see, there is a massive offset from DC to a few MHz.  Everything from 1 GHz and above is a stellar fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea why the low freqs don't fit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3PXJF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE:  Problem solved. The frequency vector must be normalized to keep the computation accurate.  I divided it by 1e6.  Then the b,a coefficients are converted into zpk form.  Multiply z and p by 1e6.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% estimate transfer function using invfreqs()&#xA;&#xA;H = freq_resp;&#xA;samples = length(H);&#xA;&#xA;w_norm = w/1e6;&#xA;&#xA;wts = 0:samples-1;&#xA;wts = exp(-wts);&#xA;&#xA;[b,a] = invfreqs(H,w_norm,15,15,wts,50);&#xA;&#xA;[z,p,k] = tf2zp(b,a);&#xA;&#xA;zs = z*1e6 ;&#xA;ps = p*1e6 ;&#xA;&#xA;[bs,as] = zp2tf(zs,ps,k);&#xA;&#xA;sys_pred = tf(bs,as);&#xA;figure&#xA;bode(sys_true,'r',sys_pred,'b')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jqyp3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16238" LastEditorUserId="8202" LastEditDate="2015-07-13T06:52:29.683" LastActivityDate="2015-07-13T06:52:29.683" Title="Matlab's invfreqs won't fit at low frequencies" Tags="|frequency-response|transfer-function|system-identification|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24634" PostTypeId="1" CreationDate="2015-07-10T21:38:41.897" Score="0" ViewCount="507" Body="&lt;p&gt;I have written Matlab script for BPSK modulation. The way my code works is as follow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;series of 0 and 1----&gt; NRZ data (continuous rectangular pulses with amplitude -1 and 1)---&gt;multiply by carrier----&gt; add noise--&gt;  multiply by carrier---&gt; integration---&gt;detection---&gt; Bit Error collection?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know can anyone tell me where I should apply DAC and ADC ?&#xA;I am wondering should it be after NRZ data or before that for DAC ? &#xA;:!:&lt;/p&gt;&#xA;" OwnerUserId="10758" LastEditorUserId="21075" LastEditDate="2020-04-29T20:56:22.113" LastActivityDate="2020-04-29T20:56:22.113" Title="DAC ADC for BPSK modulation" Tags="|matlab|digital-communications|bpsk|analog-to-digital|digital-to-analog|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24635" PostTypeId="1" AcceptedAnswerId="24645" CreationDate="2015-07-11T01:09:15.783" Score="1" ViewCount="788" Body="&lt;p&gt;This is my first dive in DSP. I would like to familiarize myself with frequency analysis. I have two audio tracks which should be digitized at 16bit-44.1kHz and 24bit-192kHz (music, presented as a 24bit-192kHz sample) respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to identify the effect of the low-pass filter around the Nyquist frequency (22.05kHz and 96kHz respectively).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I completely reworked the question.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;em&gt;Software used:&lt;/em&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I basically estimated the power spectral density using Welch's method &#xA;as implemented by &lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.welch.html#scipy.signal.welch&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;scipy.signal.welch&lt;/code&gt;&lt;/a&gt; in the &lt;code&gt;Scipy&lt;/code&gt; library of the &lt;code&gt;Python&lt;/code&gt; programming language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I used a script equivalent to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from matplotlib import pyplot as plt&#xA;from scipy import signal&#xA;from waveio import readwav&#xA;&#xA;# Load data from one channel (#0) for each sample file &#xA;wav192 = readwav(&quot;24b-192khz.wav&quot;)[:,0]&#xA;wav44 = readwav(&quot;16b-44khz.wav&quot;)[:,0]&#xA;&#xA;# DoE: 2 sample size and two windows types&#xA;chunks = [256, 4096]&#xA;windows = [&quot;hanning&quot;, &quot;boxcar&quot;] # boxcar is rectangular&#xA;&#xA;# Prepare a figure&#xA;plt.figure()&#xA;# Calculate density spectra and plot&#xA;for N in chunks:&#xA;    for w in windows:&#xA;        f, Pxx44 = signal.welch(wav44, fs=44100, window=w, nperseg=N, nfft=2*N, scaling=&quot;density&quot;)&#xA;        plt.semilogy(f, Pxx44)&#xA;plt.legend([&quot;chunk=%d; window=%s&quot;%(c, w) for c in chunks for w in windows])&#xA;plt.xlabel(&quot;Frequency (Hz)&quot;)&#xA;plt.ylabel(&quot;Density (I$^2$/Hz)&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;em&gt;The power spectral density of the &lt;strong&gt;44.1kHz&lt;/strong&gt; audio sample:&lt;/em&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xm4Q7.png&quot; alt=&quot;44100Hz 16bit&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is basically just as expected:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The chunk size, i.e. the number of samples per fft-transform segment in the real domain, does not change the density a lot if a Hann window is used.&lt;/li&gt;&#xA;&lt;li&gt;The chunk size effect is clearly visible with the boxcar (rectangular) window. From what I understand, this is because of spectral leakage which diminishes as the chunk size increases. Is that correct?&lt;/li&gt;&#xA;&lt;li&gt;The low-pass filter effect at the Nyquist frequency (22.05kHz)  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So far, so good.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;em&gt;The power spectral density of the &lt;strong&gt;192kHz&lt;/strong&gt; audio sample:&lt;/em&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/l7gZj.png&quot; alt=&quot;192kHz 24bit&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good point:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Same behaviour in regard to the chunk size and the window. Is spectral leakage really that strong? That's pretty impressive.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Oddities:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What the heck is happening? &lt;/li&gt;&#xA;&lt;li&gt;Where is the low-pass filter near the Nyquist frequency?&lt;/li&gt;&#xA;&lt;li&gt;Why are very-high frequencies even &lt;em&gt;increasing&lt;/em&gt;? Could that be related to the choice of the windowing function?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From my interpretation, there is no low-pass filter visible because basically no audio system would go above 192kHz and generally, the software/hardware creator are smart enough to apply a low-pass filter designed with regard to the actual output bandwidth of the audio system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the increasing audio signal above 57kHz, I really can't explain it: the original audio sample is some classical music. I wouldn't expect any instrument to generate louder sounds in that range or frequencies. Any idea? Could this be an example of upsampling?&lt;/p&gt;&#xA;" OwnerDisplayName="user13706" LastEditorDisplayName="user13706" LastEditDate="2015-07-11T17:27:09.830" LastActivityDate="2015-07-12T03:41:58.347" Title="How to interpret these different Fourier analysis of this audio signal?" Tags="|audio|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24636" PostTypeId="2" ParentId="23323" CreationDate="2015-07-11T02:39:05.217" Score="0" Body="&lt;p&gt;As far as the rfft is concerned (real-valued time domain), your analysis is not exact even tough you are not far. First you have to remember that &lt;code&gt;rfft(x) -&amp;gt; X&lt;/code&gt; transforms the time domain discreet signal &lt;code&gt;x&lt;/code&gt; to a frequency spectrum X composed of N/2+1 real values and N/2+1 imaginary values (for &lt;code&gt;N=len(x)&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only question here is how is it possible to create information from nothing (&lt;code&gt;N/2+1 + N/2+1 = N+2&lt;/code&gt; not &lt;code&gt;N&lt;/code&gt;). The answer is that you don't and you already discussed the reason: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;N=1: only the DC offset as you said, so it is defined for cosine but it is not for sine (since &lt;code&gt;ci1/N * sin(k*0) = 0&lt;/code&gt;). So ci1, the corresponding coefficient in Fourier space is set to 0. In other words, here is one point here conveying no information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;N=2: you are actually wrong on this one. Just try it. The 0 values are not the only one that can be sampled, so ci2 conveys information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;N=N/2+1: this is the missing piece of the fake information creation. Because of symmetry, if N is even, the Fourier coefficient should be real (&quot;giving&quot; a &quot;pure&quot; cosine) removing another piece of meaningful information so that none is ultimately created. If it is odd, the coefficient should be complex without any other restriction.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, yes, in some case there are more cosine than sine. But as stated otherwise, this is not conceptually important nor unsettling. On the contrary...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You were talking about odd functions, how is the DC component only odd or even? And in the end, the choice of an extra odd/even function depends only on the number of original points. :)  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; for me &lt;code&gt;N&lt;/code&gt; was a number of components, &lt;em&gt;not&lt;/em&gt; the number of samples!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then yes: for &lt;code&gt;N=2&lt;/code&gt;, you've got a real-valued &lt;code&gt;rfft&lt;/code&gt; because of what you explained. However, this is not actually a property of the second bin of your &lt;code&gt;rfft&lt;/code&gt;, this is a property of the &lt;em&gt;last&lt;/em&gt; bin (if &lt;code&gt;N&lt;/code&gt; is even).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for N=2, two real numbers, for N=3, two real numbers and one imaginary, for N=4, 3 real numbers and 1 imaginary, for N=5, 3 real numbers and 2 imaginary and so one.&lt;/p&gt;&#xA;" OwnerDisplayName="user13706" LastEditorDisplayName="user13706" LastEditDate="2015-07-13T16:49:41.667" LastActivityDate="2015-07-13T16:49:41.667" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24638" PostTypeId="1" CreationDate="2015-07-11T14:23:10.380" Score="1" ViewCount="123" Body="&lt;p&gt;&lt;strong&gt;Preconditions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For measuring the position of a mobile device in 3D space, I utilize two sensors with different characteristics that measure device orientation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sensor A (a combined sensor of accelerometers, a compass and a gyroscope) does a great job of estimating the device orientation, but is subject to compass drift. Therefore, the rotation measured drifts around the axis pointing down to the earths core. Notice the gap in the image where the sensor &quot;jumped&quot; to balance previous drift. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/A2x1P.jpg&quot; alt=&quot;Image Series with positioning from Sensor A&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sensor B (a camera with feature extraction and motion estimation) is capable of detecting rotations around the gravity axis very well, but is prone to incremental errors, since all measured rotations are relative and have to be added to gain an absolute value. Notice the incremental error around the axis pointing away from the camera in the image below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/TgXad.jpg&quot; alt=&quot;Image Series with positioning from Sensor B&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for motions around the gravity axis, the results of B are still preferable over A. For the other axis, taking the measurements of A would be better. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm familiar with the concepts of Kalman filters for data fusion. What boggles my mind however, is that I would like to weight different rotational components of the given sensors differently when combining the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What mathematical approaches to represent the rotations could I use for an elegant solution? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I've considered&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Representing the rotations as Euler angles might be difficult, since Euler angles are aligned with the coordinate system. This works fine as long as I hold the device even, but no longer for complex movements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Representing the rotations as Matrices or Quaternions is also not useful, since the rotation is represented in a way where it is not possible to access or modify single components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please leave a comment if those considerations seem wrong. &lt;/p&gt;&#xA;" OwnerUserId="16573" LastActivityDate="2015-07-11T14:23:10.380" Title="Sensor Data Fusion with Orientation Sensors in 3D Euclidian Space" Tags="|kalman-filters|3d|matrix|sensor|position|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24639" PostTypeId="1" CreationDate="2015-07-11T14:35:31.990" Score="1" ViewCount="176" Body="&lt;p&gt;I am trying to build a software that records audio to a server and then broadcasts that audio into the same room that the microphone is present. This means that the audio signal is uploaded to the server and travelling back again. This adds a variable delay in its playback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far what I've experienced is the recorded audio is then picked up again by the microphone and played back over the speakers. This is, of course, much less than desired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that I will not know very easily the delay in time that it will take for the audio to start playing from the speakers (may be even seconds afterwards), how can I eliminate audio being broadcasted to then be recorded again by the microphone?&lt;/p&gt;&#xA;" OwnerUserId="16376" LastEditorUserId="13320" LastEditDate="2016-11-21T13:14:49.720" LastActivityDate="2017-09-17T19:44:49.123" Title="Cancelling the acoustic echo that occurs with a variable delay and volume" Tags="|filters|audio|voice|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24642" PostTypeId="1" CreationDate="2015-07-11T19:15:25.800" Score="1" ViewCount="152" Body="&lt;p&gt;Why can't I just take the square root of the power spectrum &lt;span class=&quot;math-container&quot;&gt;$P(f) = Cf^{-\alpha}$&lt;/span&gt;, multiply with &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta_n}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\theta_n$&lt;/span&gt; being &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; random phases in &lt;span class=&quot;math-container&quot;&gt;$[0, 2\pi]$&lt;/span&gt;), and then do an inverse Fourier transform?  This can produce arbitrarily long time series with a &lt;span class=&quot;math-container&quot;&gt;$1/f^\alpha$&lt;/span&gt; spectrum.  Quite obviously, I'm missing something.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: To be honest, I'm actually looking at methods to generate fractional Brownian motions (fBm).  An fBm is characterized by a power spectrum &lt;span class=&quot;math-container&quot;&gt;$P(f) = Cf^{-(2H + 1)}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$0 &amp;lt; H &amp;lt; 1$&lt;/span&gt; being the Hurst parameter.  For example, a popular book on chaos theory by A.A. Tsonis (pp. 62-53) suggests the exact same method for generating an fBm trace:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;How To Generate an fBM Trace with a Desired Spectral Density Function&lt;/em&gt;. A time series &lt;span class=&quot;math-container&quot;&gt;$X_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i = 1, ..., N$&lt;/span&gt;, whose spectral density function satisfies the relation &lt;span class=&quot;math-container&quot;&gt;$S(f) = Cf^{-a}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a = 2H + 1$&lt;/span&gt;, is obtained via the relation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x_i = \sum^{N/2}_{k=1} \left[Ck^{-a}\left(\frac{2\pi}{N}\right)^{1-a}\right]^{1/2}\cos{\left(\frac{2\pi ik}{N} + \phi_k\right)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is a constant and &lt;span class=&quot;math-container&quot;&gt;$\phi_k$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; random phases randomly distributed in &lt;span class=&quot;math-container&quot;&gt;$[0, 2\pi]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;While this method is very simple, almost no papers on fBm generation discuss it.&lt;/p&gt;&#xA;" OwnerUserId="16586" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-07-12T10:26:40.223" Title="Why is generating $1/f^\alpha$ noise so complicated?" Tags="|noise|power-spectral-density|" AnswerCount="0" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24645" PostTypeId="2" ParentId="24635" CreationDate="2015-07-12T03:41:58.347" Score="0" Body="&lt;p&gt;If you look at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function#Rectangular_window&quot; rel=&quot;nofollow&quot;&gt;Rectangular window&lt;/a&gt; the best its rejection gets is about 40 dB. So that behavior, especially obvious in the bottom plot, for the rectangular window is to be expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know for sure if this explains everything but look at the level between your peak signal and the high-frequency components. There is almost 60 dB of rejection there. I've always heard that a good rule of thumb is to get 60 dB of rejection from your filters. I know that's not the full 96 dB offered by 16-bit music, but I bet you'd be hard pressed to actually hear that. Of course, there's the silliness of having music at that sample rate. Humans just can't hear anything above around 20 kHz, give or take. &lt;a href=&quot;http://xiph.org/~xiphmont/demo/neil-young.html&quot; rel=&quot;nofollow&quot;&gt;This article&lt;/a&gt; gives a good summary of the issues. It also brings up a good point, that that sample rate has the potential to pick up harmonics and other high-frequency distortion caused by equipment and electronics, despite the fact that we can't hear it. Perhaps something like that is going on? &lt;/p&gt;&#xA;" OwnerUserId="1678" LastActivityDate="2015-07-12T03:41:58.347" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="24646" PostTypeId="1" CreationDate="2015-07-12T07:17:37.747" Score="0" ViewCount="78" Body="&lt;p&gt;i'm doing a project on log gabor filters, can i use log gabor filter on an edge detected image for feature extraction,and use these features for classification by ANN&lt;/p&gt;&#xA;" OwnerUserId="16589" LastActivityDate="2015-07-12T07:17:37.747" Title="Can Log Gabor Filters be used on an edge detected image" Tags="|image-processing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24647" PostTypeId="2" ParentId="3474" CreationDate="2015-07-12T12:26:07.413" Score="4" Body="&lt;p&gt;My survey paper on compression, &lt;a href=&quot;https://www.academia.edu/12429529/A_Survey_Of_Architectural_Approaches_for_Data_Compression_in_Cache_and_Main_Memory_Systems&quot; rel=&quot;nofollow&quot;&gt;&quot;A Survey Of Architectural Approaches for Data Compression in Cache and Main Memory Systems&quot;&lt;/a&gt;, shows that most practical techniques on general benchmarks achieve compression ratio ~2X and some upto 4X, although higher potential (e.g. ~16X in some cases) exists  (see Section 2.2). The reason for not achieving full potential is that techniques with higher compression ratio also have higher overhead (e.g. extra hardware which consumes power, lot of extra processing, etc.) or they may not be general enough (e.g. compressing file with all zeros). &lt;/p&gt;&#xA;" OwnerUserId="16590" LastEditorUserId="16590" LastEditDate="2015-08-18T18:26:52.483" LastActivityDate="2015-08-18T18:26:52.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24648" PostTypeId="1" AcceptedAnswerId="37441" CreationDate="2015-07-12T13:05:27.220" Score="2" ViewCount="2465" Body="&lt;p&gt;I wanted to write a code to detect baby cry sound.&#xA;I am using Windows as platform.  Presently, I am able to get audio samples and its frequency plot(using FFT) but not sure how to proceed forward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to ask what steps I should follow to detect the baby cry sound given its time-frequency plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw some methods such as median filter followed by HMM in speech recognition. But for simple sound detection do I need to go for such sophiticated method? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be very grateful if you could help me. &lt;/p&gt;&#xA;" OwnerUserId="16233" LastEditorUserId="8202" LastEditDate="2017-11-14T15:09:46.483" LastActivityDate="2017-11-14T15:09:46.483" Title="Baby Cry Sound detection" Tags="|fft|sound-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24650" PostTypeId="1" AcceptedAnswerId="24667" CreationDate="2015-07-12T22:37:34.003" Score="1" ViewCount="724" Body="&lt;p&gt;Does anyone know if there is a procedure as to separate the stationary and non stationary parts of a univariate signal. I have seen signal source separation and blind separation algorithms (all of them assuming that the signal is a linear superpossition of underlying hidden source signals where the signals are statistically independent - linearly independent - not sure if colored noises are linearly independent) where different signals are mixed in a single combined signal. For this several methods exist as to separate the sources mostly based on either orthogonality, correlation, variance and distances, however all of them based on having already multivariate variables: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Principal components analysis&#xA;Singular value decomposition&#xA;Independent component analysis&#xA;Dependent component analysis&#xA;Non-negative matrix factorization&#xA;Low-complexity coding and decoding&#xA;Stationary subspace analysis&#xA;Common spatial pattern&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is that if you could treat a single signal which is the combination of signal + uncorrelated stationary noise colors (white) + correlated noise colors (pink,brown,etc) as a source problem (implying that there is a mix of signals formed by the stationary noise, non stationary noise and signal) and thus apply a specific blind signal separation algorithm as to separate the sources statistically (for example as in stationary subspace analysis there is identification of the stationary and non stationary parts). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All blind signal separation algos I have seen can only be applied to multiple variables, my question is if there are there any blind separation algorithms that can be applied to univariate series where stationary and non stationary components can be separated as individual signal sources.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following comments from LPT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the signal is spread across a wide range of frequencies from the Evoluionary power spectrum. I know uncorrelated stationary white noise affects the signal and that other unidentifed stationary correlated colors do as well but ignore their mix. My idea was to run a wavelet at one level decomposition as to have two range of frequencies and use this as to run one of the analysis above as to determine the stationary and non stationary parts. As the stationary parts will correspond to correlated and uncorrelated noise colors which I will assume to be non gausian and additive. As the nature of the signal is non stationary I would effectively have separated the signal from noise. Then from noise I will run wavelet thresholding as to eliminate white noise based on a MA MAD and remain with correlated noises which via FFT and their power relation understand the type dominating noise color or identify their mix. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-07-20T23:56:56.103" LastActivityDate="2015-07-20T23:56:56.103" Title="separating stationary and non stationary parts of univariate signal" Tags="|signal-analysis|stationary|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24651" PostTypeId="2" ParentId="18651" CreationDate="2015-07-13T00:26:43.857" Score="0" Body="&lt;p&gt;A short answer is YES, you can use correlation to measure the similarity between two signals. A long answer maybe NO, because what correlation coefficients can reflect is the strength of linear relationship between a test signal $X$ and a reference signal $Y$. If the similarity between $X$ and $Y$ in your mind is different from this, you'd better not use it. Therefore, you should first sit down and think about how to define your interested similarity measure. For example, how about rank correlation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you also have difficulties to define such a similarity metric, you probably should think of the generic machine learning approach. In this approach, you will implicitly define such a metric by providing the so-called training data, namely a pairwise data $(X_i,Y_i)$ and its reference label $s_i\in\{\rm{True},False\}$. Once you prepare these training samples, many existing tools can build you a classifier $C(X,Y)$ and predict you the corresponding similarity label $s$. However, the major difficulty of this approach is `&lt;strong&gt;training data&lt;/strong&gt;', which may be not easy to obtain. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-07-13T00:26:43.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24652" PostTypeId="2" ParentId="18651" CreationDate="2015-07-13T01:20:32.953" Score="1" Body="&lt;p&gt;so i'll throw the cross-correlation and/or matched-filter thing at you.  a little bit similar to Karthik but maybe a little more rigor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so you have a reference signal, $y(t)$, and a measured signal $x(t)$.  suppose they have something in common and some differences and may &lt;strong&gt;one&lt;/strong&gt; of the differences is a misalignment in time.  but if you investigate what these two signals have in common (or what they don't) for a variety of different offsets in time, that dissimilarity due to time misalignment can be made non-salient (or maybe you want to &lt;strong&gt;know&lt;/strong&gt; the time offset).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so first consider measuring the dissimilarity (at a variety of different offsets or &quot;lags&quot;) as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Q_{xy}(\tau) \triangleq \int\limits_{-\infty}^{+\infty} \left( x(t) - y(t+\tau) \right)^2 dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so you're looking at how much $x(t)$ and $y(t+\tau)$ are different, for different lags, $\tau$, squaring that difference or &quot;error&quot; so that it's always positive (this is analytically easier than if you use the absolute value), adding up the total squared-difference over all of time and you have an overall measure in how dissimilar $x(t)$ and $y(t+\tau)$ are.  then picking the lag $\tau$ so that $Q_{xy}(\tau) \ge 0$ is minimum might be considered to be a measure on how dissimilar $x(t)$ and $y(t+\tau)$ are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the smaller this measure (which is always non-negative), the more similar $x(t)$ and $y(t+\tau)$ are.  this is the Average Squared Difference Function (ASDF) and has a similar motivation in its definition as does the more well-known and historical AMDF function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now the cool thing you get that you don't if it's AMDF is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;Q_{xy}(\tau) &amp;amp; = \int\limits_{-\infty}^{+\infty} \left( x(t) - y(t+\tau) \right)^2 \ dt  \\&#xA;&amp;amp; = \int\limits_{-\infty}^{+\infty} x^2(t) + y^2(t+\tau) - 2x(t)y(t+\tau) \ dt \\&#xA;&amp;amp; = \ \int\limits_{-\infty}^{+\infty} x^2(t) dt \ + \ \int\limits_{-\infty}^{+\infty}y^2(t+\tau) dt \ - \ 2\int\limits_{-\infty}^{+\infty}x(t)y(t+\tau) dt \\&#xA;&amp;amp; = \ \int\limits_{-\infty}^{+\infty} x^2(t) dt \ + \ \int\limits_{-\infty}^{+\infty}y^2(t) dt \ - \ 2\int\limits_{-\infty}^{+\infty}x(t)y(t+\tau) dt \\&#xA;&amp;amp; = \ E_x \ + \ E_y \ - \ 2\int\limits_{-\infty}^{+\infty}x(t)y(t+\tau) dt \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E_x$ and $E_y$ are the energies of $x(t)$ and $y(t)$ and not functions of $\tau$.  so $Q_{xy}(\tau)$ will be minimum with a $\tau$ that makes the integral on the right maximum.  we'll give that integral a name:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{xy}(\tau) \triangleq \int\limits_{-\infty}^{+\infty}x(t)y(t+\tau) dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we see that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$  Q_{xy}(\tau) = E_x + E_y - 2  R_{xy}(\tau) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so so $Q_{xy}(\tau)$ is minimum when $R_{xy}(\tau)$ is maximum.  in fact, with a scaling constant of $2$ tossed in there $Q_{xy}(\tau)$ and $R_{xy}(\tau)$ are upside-down mirror images of each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we call $R_{xy}(\tau)$, the cross-correlation function of $x(t)$ and $y(t)$ and is the inner product (if we're pretending we're living in a Hilbert space) of $x(t)$ and $y(t+\tau)$.  if we're dealing with complex $x(t)$ and $y(t)$ (we're not, i hope) then $y(t)$ should be complex-conjugated.  where $R_{xy}(\tau)$ is maximum is the time offset that $x(t)$ and $y(t)$ are most similar to each other.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the above can be rearranged:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{xy}(\tau) = \frac{1}{2} \left( E_x + E_y - Q_{xy}(\tau) \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{R_{xy}(\tau)}{\frac{1}{2}(E_x + E_y)} =  1 - \frac{Q_{xy}(\tau)}{E_x + E_y} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the cross-correlation is getting normalized by the average energy of $x(t)$ and $y(t)$.  we're always subtracting a non-negative number from 1 so that normalized cross-correlation is never larger than 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and pick the $\tau_0 \ne 0$ where $R_{xy}(\tau_0)&amp;gt;R_{xy}(\tau)$ for all other $\tau$ and calculate that normalized cross-correlation and you have a measure of similarity with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ -1 \le \frac{R_{xy}(\tau_0)}{\frac{1}{2}(E_x + E_y)} \le 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if it's -1, they are identical but with opposite polarity.  if it's 1, they're totally similar (at that offset of $\tau_0$).&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-07-13T01:35:33.900" LastActivityDate="2015-07-13T01:35:33.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24653" PostTypeId="2" ParentId="24648" CreationDate="2015-07-13T02:27:34.867" Score="0" Body="&lt;p&gt;Since you have frequency bucket information, you essentially have a frequency histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you treat histograms as n dimensional vectors, you can use dot product to get a similarity value that goes from 0 to 1 and could tune that so that sounds that have a value greater than say 0.6 are considered a match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information check this out:  &lt;a href=&quot;http://blog.demofox.org/2015/02/13/writing-a-basic-search-engine-aka-calculating-similarity-of-histograms-with-dot-product/&quot; rel=&quot;nofollow&quot;&gt;http://blog.demofox.org/2015/02/13/writing-a-basic-search-engine-aka-calculating-similarity-of-histograms-with-dot-product/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternately you could get a little more advanced and use support vector machines, which require training data of both negatives and positives to find a way to differentiate hits and misses.&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-07-13T02:27:34.867" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24654" PostTypeId="1" AcceptedAnswerId="24656" CreationDate="2015-07-13T03:08:18.880" Score="4" ViewCount="1196" Body="&lt;p&gt;Often we need to estimate the time difference of arrival between two signals to find the location of a target. Many algorithms gives the time delay corresponding to a sample number or time delay is a function of the sampling frequency. To get away with this problem subsample time delay estimation procedure is used. One can see that if the sampling frequency is very high the subsample may not be necessary. Can anyone help to find when subsample is necessary and when it become irrelevant? I am trying to understand the other associated factor. &lt;/p&gt;&#xA;" OwnerUserId="15437" LastEditorUserId="128" LastEditDate="2019-11-18T07:01:29.297" LastActivityDate="2021-03-23T21:33:23.793" Title="Subsample Time Delay Estimation" Tags="|estimation|statistics|time-of-arrival|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24655" PostTypeId="1" CreationDate="2015-07-13T03:27:22.350" Score="2" ViewCount="351" Body="&lt;p&gt;Forgive me if this is the wrong site for this question. Here's my problem: I am creating a game where players have to search for a hidden detail within the overall image. I downloaded an 11MB compressed photo from the internet which is 85MP in size (14000 x 6000 pixels). I had a very small image within this &lt;a href=&quot;http://content.altfonts.com:88/img/P/I/Pixelated0.png&quot; rel=&quot;nofollow&quot;&gt;(a pixel-sized number).&lt;/a&gt; The color and brightness of this number closely matches the surrounding pixels so that it blends in. Now, when I went to save this image, the compression destroyed the hidden number, even at JPEG 12/Maximum. This maximum compressed JPEG increased the file size to 50MB even though the original was just 11MB. An uncompressed save file (TIF/PNG) reaches up to 250MB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I can do to compress the image while still preserving the integrity of the number? The number only encompasses a few pixels, but the addition of this small data has increased the file size 25x. I have access to Photoshop and Gimp. Thanks in advance, if you need to see the file then I can provide a link to it (at 250MB size or 50MB size).&lt;/p&gt;&#xA;" OwnerUserId="16596" LastActivityDate="2018-09-19T13:53:44.397" Title="Selective image compression?" Tags="|image-processing|compression|image-compression|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24656" PostTypeId="2" ParentId="24654" CreationDate="2015-07-13T04:04:45.453" Score="2" Body="&lt;p&gt;Even though the signals are sampled you can get accuracy which is well above the accuracy offered by the samples as long as you sample using Nyquist.&lt;/p&gt;&#xA;&lt;p&gt;Actually, Using the Matched Filter you can achieve the CRLB (Cramer Rao Lower Bound) for Delay Estimation (Easy to derive for white noise).&lt;br /&gt;&#xA;If you calculate the CRLB for Time Delay Estimation you'll see it depends on the Signal BW and the SNR and not the sampling frequency (Given Nyquist sampling).&lt;/p&gt;&#xA;&lt;p&gt;How can that be achieved?&lt;br /&gt;&#xA;You can interpolate the the cross correlation signal and by simple math infer the time delay in resolutions well beyond the sampling resolution.&lt;/p&gt;&#xA;&lt;p&gt;For instance, with signals with BW of ~ 15 MHz we shall sample by 60 Mhz.&lt;br /&gt;&#xA;The sampling resolution (Assuming RADAR) is ~ 2.5 [Meter] yet the CRLB at decent SNR will give you a bound of few Centi Meters which can be achieved using the Matched Filter + Interpolation.&lt;/p&gt;&#xA;&lt;p&gt;Enjoy.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2021-03-23T21:33:23.793" LastActivityDate="2021-03-23T21:33:23.793" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="24657" PostTypeId="2" ParentId="24655" CreationDate="2015-07-13T09:04:39.563" Score="4" Body="&lt;p&gt;To insert a JPEG image into another without recompression, you can use a &lt;a href=&quot;http://jpegclub.org/jpegtran/&quot; rel=&quot;nofollow noreferrer&quot;&gt;jpegtran&lt;/a&gt; version with crop 'n' drop. It is safest to insert into coordinates that are multiples of the 16x16 pixel JPEG block size. On command line:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jpegtran.exe -drop +16+16 pixelated.jpg piano.jpg out.jpg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/uUDk5.jpg&quot; alt=&quot;pixelated.jpg&quot;&gt;&lt;i&gt;pixelated.jpg&lt;/i&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mabGs.jpg&quot; alt=&quot;piano.jpg&quot;&gt;&lt;i&gt;piano.jpg&lt;/i&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XXwUg.jpg&quot; alt=&quot;out.jpg&quot;&gt;&lt;i&gt;out.jpg&lt;/i&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Difference images made in Gimp show only black, so there was no lossy recompression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/jUnna.jpg&quot; alt=&quot;Difference image: piano.jpg vs. out.jpg&quot;&gt;&lt;i&gt;Difference image: piano.jpg vs. out.jpg&lt;/i&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/llpAq.jpg&quot; alt=&quot;Difference image: pixelated.jpg (aligned) vs. out.jpg&quot;&gt;&lt;i&gt;Difference image: pixelated.jpg (aligned) vs. out.jpg&lt;/i&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before all this, you can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jpegtran -crop &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to copy the target region in the big image to a file for modification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if jpegtran can handle your huge files. My test files were quite small.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-07-13T16:02:07.517" LastActivityDate="2015-07-13T16:02:07.517" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24659" PostTypeId="1" AcceptedAnswerId="24663" CreationDate="2015-07-13T12:07:15.640" Score="0" ViewCount="1567" Body="&lt;p&gt;I try to detect some FSK signals made by audio in near real time. I know that I will get some latency. &#xA;In the start I try to detect some tones of 10Khz in a duration of 75ms. &#xA;That is achieved by a Goertzel filter. &#xA;What is the prefered technique for that issue? &#xA;I thought of making a little buffer that will always be detected by the Goertzel, but this sounds bad because I don't know when the the signal starts. &#xA;Can you give me some help or idea ? Thanks &lt;/p&gt;&#xA;" OwnerUserId="15637" LastActivityDate="2015-07-13T13:56:47.240" Title="Detecting FSK near real time with c#" Tags="|signal-detection|real-time|fsk|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24662" PostTypeId="2" ParentId="24655" CreationDate="2015-07-13T13:25:01.087" Score="1" Body="&lt;p&gt;First of all, TIF/PNG is already compressed. But it is lossless compression. That means that your image should be unchanged but the price for complicated pictures is a higher memory footprint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rapid calculation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(14000 * 6000 * 24 / 8) / (1024 * 1024) = 240 MB&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(assuming 24-bit depth).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it seems that your image is either pure random noise OR something went wrong and you did not get a proper PNG. Based on these data, I would first recommend to resize your image as such a size is simply insane for a point&amp;amp;click game.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Secondly, what you are asking cannot be trivially done the way you want it done. You said it yourself:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The color and brightness of this number closely matches the&#xA;  surrounding pixels so that it blends in.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;JPEG is lossy and achieves such high compression ratios by removing the visual feature that are the hardest for the human eye to differentiate: similar colors, similar brightness, highly localized data, etc. It does so because that's what allows to keep the highest quality while increasing the compression ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I think that you understand that &lt;strong&gt;what you are trying to keep is precisely what JPEG was designed to remove first&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There are a few ways to avoid that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use another codec.&lt;/li&gt;&#xA;&lt;li&gt;&quot;Blend&quot; less so that the codec does not remove it.&lt;/li&gt;&#xA;&lt;li&gt;Use tools like &lt;code&gt;pngquant&lt;/code&gt; to achieve lossy compression in png, resize your original image, etc. to keep the size low and the quality up.&lt;/li&gt;&#xA;&lt;li&gt;Change the type of image: do you really need photo-realistic pictures?&lt;/li&gt;&#xA;&lt;li&gt;Change the way you make your program.&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &quot;Change the way you make your program&quot; part is the most sensible to me. You basically just use the original (preferably resized) image but before rendering it on screen, you add the information where you want it to be. This is far easier than tricking a compression algorithm into not doing its job and it's also a great win quality-wise and size-wise (you only need one copy of the original image, not X copies each containing your watermark).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Finally, if what you want is steganography, this is not a recommendable way to achieve it. &lt;/p&gt;&#xA;" OwnerDisplayName="user13706" LastEditorUserId="-1" LastEditDate="2018-09-19T13:53:44.397" LastActivityDate="2018-09-19T13:53:44.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24663" PostTypeId="2" ParentId="24659" CreationDate="2015-07-13T13:56:47.240" Score="2" Body="&lt;p&gt;People have been decoding FSK signals for ages with very weak microprocessors.  The usual method is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Zero-crossing_rate&quot; rel=&quot;nofollow&quot;&gt;zero crossing detection.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You basically just measure time (count the number of samples) between the times when the signal crosses the zero volt line.&lt;br&gt;&#xA;The number of samples multiplied by the sampling rate tells you the rate as a time period.  One divided by that number is the frequency of your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That works well enough with clean signals.  If your signal has noise mixed in with it, then you use a band pass filter to just pass the frequencies you are interested in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd work up an FSK demodulator using zero crossing that works for clean signals.  Once that works, you can worry about filters and improving the performance.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-07-13T13:56:47.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24667" PostTypeId="2" ParentId="24650" CreationDate="2015-07-13T15:26:33.837" Score="2" Body="&lt;p&gt;All these algorithms are based on the determination of a new basis (i.e. a new set of basis vectors), chosen according to a given constrain (to maximize the variance of each component in PCA for instance). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have only one signal, you have only &lt;strong&gt;one&lt;/strong&gt; basis vector. So you cannot use these algorithms because you don't have enough information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In lower dimensions, you can think of it as the calculation of the arithmetic mean from a set of noisy values corresponding to the same measurement. You need multiple measurement to be sure to get close to the &quot;true&quot; value of the measurement. What you are asking is how to get the &quot;true&quot; value from only one measurement without any repetition. That cannot be done because you don't have enough information even to do anything.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, depending on you signal and its specific noise, there might be other ways to achieve what you want. Actually, all you have to do is to identify a way to differentiate noise from signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their distributions are obviously different, but these are mere projections, so again, you have too few data to use them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One &lt;em&gt;working&lt;/em&gt; possibility is to filter your data to remove high frequency components (to remove most of the noise) and very low frequency components (to remove pink noise, but usually pink noise is really not a problem). But that would work only if you have an idea of the bandwidth of your signal (the maximum frequency beyond which your signal has no meaning anymore). &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What you describe won't work. If I continue my analogy of the average over noisy measurement data, it is like saying that you will split the result of you unique measurement (say, 15 = 12 + 3) and use that result (12 and 3) to calculate the mean (7.5). I hope you understand that this makes no sense (the mean of 15 is at best undefined, or at worst 15). And even if it did, your decomposition would be quite arbitrary (why not use 10+5 or 20-5 or 13264585120-13264585105?). Again, you &lt;strong&gt;won't&lt;/strong&gt; get more information by decomposition of your signal.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Final word:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If you really want us to help you or to give you more details about why this won't work as you expect, please open a new question, provide actual data and explain your setup.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user13706" LastEditorDisplayName="user13706" LastEditDate="2015-07-13T17:07:16.663" LastActivityDate="2015-07-13T17:07:16.663" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24674" PostTypeId="1" CreationDate="2015-07-14T10:10:35.260" Score="1" ViewCount="173" Body="&lt;p&gt;What is the difference between video mosaicing and video stitching ,is this both are similar or is there any methodology difference?&lt;/p&gt;&#xA;" OwnerUserId="15525" LastActivityDate="2015-07-14T10:10:35.260" Title="Difference between video mosaicing and video stitching" Tags="|computer-vision|video-processing|video-compression|stitching|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24676" PostTypeId="1" CreationDate="2015-07-14T11:25:50.963" Score="1" ViewCount="2602" Body="&lt;p&gt;I am quite new to vision and OpenCV, so forgive me if this is a stupid question but I have got really confused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to detect an object in an image and estimate its actual size. Assume for now I only want length and width, not depth.&#xA;Lets say I can detect the object, find its size(length and width) in pixels and I have both the intrinsic and extrinsic parameters of the camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The documentation of camera calibration as I understand says that the intrinsic and extrinsic camera parameters can be used to transform from camera coordinate system to world coordinate system. So this should mean converting from pixel coordinates to real coordinates right? And so I should be able to use pixel size and these parameters to find the real size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, say the object is photographed at different depth (distance from camera), then its size would come out different using above method. So.....what does it mean transforming from camera to world coordinates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any kind of explanation/links/help would be highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="16615" LastEditorUserId="8202" LastEditDate="2015-07-14T16:40:58.113" LastActivityDate="2016-06-09T03:20:59.857" Title="How to find the actual size of an existing object from the pixels of an image?" Tags="|image-processing|computer-vision|opencv|camera-calibration|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24678" PostTypeId="1" CreationDate="2015-07-14T12:28:07.270" Score="3" ViewCount="926" Body="&lt;p&gt;I have a digital signal that was made from analog one by staggering sampling rate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\tau_i = \begin{cases}\tau_{even}&amp;amp; \text{if } i = 2n\\&#xA;\tau_{odd} &amp;amp; \text{if } i = 2n+1\end{cases}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I have a simple correlative filter, for example, smoothing filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1, -2, 1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How should I calculate frequency response of such a filter?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5343" LastEditorDisplayName="user13706" LastEditDate="2015-07-14T16:40:28.883" LastActivityDate="2023-01-30T19:18:10.093" Title="How to filter signals with non-uniform sampling rate?" Tags="|filters|frequency-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24679" PostTypeId="1" CreationDate="2015-07-14T12:36:22.140" Score="1" ViewCount="37634" Body="&lt;p&gt;Can someone please explain how to compute the bandwidth of a signal? Like why the bandwidth of $5\sin(2t)$ is $0$ and of $\sin(2t) + \sin(3t)$ is $1$?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="16616" LastEditorDisplayName="user13706" LastEditDate="2015-07-14T16:40:36.480" LastActivityDate="2020-03-09T08:57:01.513" Title="How to calculate the bandwidth of a continuous signal?" Tags="|signal-analysis|bandwidth|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24680" PostTypeId="1" AcceptedAnswerId="24719" CreationDate="2015-07-14T13:26:15.787" Score="2" ViewCount="724" Body="&lt;p&gt;While working with FFT, I have a strange case with a current experimental setup. I am working with beat frequencies (intermediate frequency output) and using a standard FFT algorithm (complex to complex). My sampled data are real-valued so I created a double size array with alternating real and complex values (with complex values set to zero) as in the figure below. The particular implementation of FFT that I used (&lt;a href=&quot;http://www.lomont.org/Software/Misc/FFT/LomontFFT.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;LomontFFT&lt;/a&gt;) requires that to work around the lack of complex-value-type handling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7iVWi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the ADC samples 400 data points and then 112 bits are zero padded after Hanning to make 512 data points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code I have written (C#):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public void fftElavualtion (double[] adcValues)&#xA;{&#xA;        int N = 512;&#xA;        double Fs = 195312.5;&#xA;        double[] data_sample = Enumerable.Repeat(0.0, N).ToArray();&#xA;        double[] data_sampleHanned = new double[adcValues.Length];&#xA;        double[] fftData = new double[N * 2];&#xA;        double[] magnitude = new double[N];&#xA;        double max_magnitude = double.NegativeInfinity;&#xA;        int max_index = -1;&#xA;        double fundamentalFrequency;&#xA;&#xA;        data_sampleHanned = HanningWindow(adcValues);&#xA;&#xA;        Array.Copy(data_sampleHanned, data_sample, data_sampleHanned.Length);&#xA;&#xA;        for (int i = 0; i &amp;lt;= (N - 1); i++)&#xA;        {&#xA;            fftData[2 * i] = data_sample[i];&#xA;            fftData[(2 * i) + 1] = 0;&#xA;        }&#xA;&#xA;        var fftMethod = new Lomont.LomontFFT();&#xA;        fftMethod.FFT(fftData, true);&#xA;&#xA;        for (int y = 0; y &amp;lt;= (N - 1); y++)&#xA;        {&#xA;            double re = fftData[2 * y];&#xA;            double im = fftData[2 * y + 1];&#xA;            magnitude[y] = Math.Sqrt(re * re + im * im);&#xA;        }&#xA;&#xA;        for (int k = 1; k &amp;lt;= (N - 1); k++)&#xA;        {&#xA;            if (magnitude[k] &amp;gt; max_magnitude)&#xA;            {&#xA;                max_magnitude = magnitude[k];&#xA;                max_index = k;&#xA;            }&#xA;        }&#xA;&#xA;        fundamentalFrequency = max_index * Fs / N;&#xA;&#xA;        textBoxFundaFreq.Text = &quot;Freq = &quot; + fundamentalFrequency.ToString();&#xA;        for (int x = 1; x &amp;lt; N; x++)&#xA;        {&#xA;            this.chart2.Series[0].Points.AddXY(x, magnitude[x]);&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problems are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Each frequency bin represents a bandwidth of (Sample Rate)/(total number of samples) so 200,000/512. i.e., approx 390 Hz. Is this too high for a bin? If so how do I manage as I can have only 400 samples and also can't change sampling rate (system constraint). Does zero padding improve?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To find the fundamental frequency I am locating the index of highest magnitude (max_index) and multiplying it with badwidth of each bin. This yields me the same frequency for all trials as second place of magnitude is always high irespective to what signal is fed to the processing system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What is a possible reason for always the second bin having the highest energy or highest magnitude?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I am ignoring the case of a problem in FFT, as LomontFFT is trusted.&#xA;Info: (Example double valued sampled with ADC - 400 data points in CSV)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 2047.5,2063.88,2082.99,2099.37,2115.75,2140.32,2149.875,2156.7,2167.62,2178.54,2194.92,2205.84,2214.03,2222.22,2231.775,2238.6,2184,2115.75,2061.15,2013.375,1951.95,1897.35,1835.925,1774.5,1842.75,1911,2033.85,2115.75,2184,2293.2,2375.1,2457,2375.1,2252.25,2129.4,1992.9,1842.75,1706.25,1610.7,1501.5,1638,1777.23,1919.19,2059.785,2199.015,2336.88,2476.11,2613.975,2457,2297.295,2170.35,1904.175,1636.635,1449.63,1365,1236.69,1569.75,1835.925,1979.25,2080.26,2306.85,2457,2605.785,2852.85,2730,2661.75,2530.71,2429.7,2306.85,2182.635,2115.75,2047.5,1911,1774.5,1638,1501.5,1365,1228.5,1092,955.5,1092,1228.5,1365,1501.5,1638,1774.5,1911,2047.5,2197.65,2347.8,2497.95,2648.1,2798.25,2948.4,3091.725,3228.225,3084.9,2934.75,2784.6,2634.45,2484.3,2334.15,2190.825,2047.5,1774.5,1528.8,1228.5,1092,962.325,832.65,709.8,655.2,791.7,941.85,1090.635,1283.1,1528.8,1760.85,1911,2047.5,2293.2,2455.635,2593.5,2852.85,3016.65,3289.65,3412.5,3549,3412.5,3262.35,3001.635,2728.635,2455.635,2319.135,2115.75,2047.5,1794.975,1542.45,1365,1078.35,941.85,764.4,477.75,273,526.4805,682.5,832.65,1090.635,1337.7,1501.5,1909.635,2047.5,2184,2443.35,2661.75,2989.35,3274.635,3562.65,3701.88,3842.475,3685.5,3535.35,3207.75,2934.75,2730,2525.25,2306.85,2047.5,1842.75,1490.58,1119.3,982.8,709.8,436.8,163.8,40.95,204.75,436.8,764.4,1078.35,1300.845,1610.7,1883.7,2047.5,2320.5,2613.975,2907.45,3194.1,3480.75,3753.75,3890.25,4093.635,3549,2866.5,2184,1842.75,1706.25,1228.5,682.5,1.092,271.635,464.1,750.75,955.5,1228.5,1569.75,1842.75,2047.5,2320.5,2593.5,2866.5,3139.5,3412.5,3685.5,3822,3999.45,3822,3685.5,3412.5,3139.5,2866.5,2593.5,2320.5,2047.5,1774.5,1501.5,1228.5,955.5,682.5,518.7,313.95,135.135,313.95,518.7,682.5,955.5,1228.5,1501.5,1774.5,2047.5,2252.25,2525.25,2757.3,3057.6,3344.25,3494.4,3671.85,3842.475,3671.85,3494.4,3344.25,3057.6,2757.3,2525.25,2252.25,2047.5,1774.5,1501.5,1228.5,955.5,819,696.15,477.75,375.375,477.75,696.15,819,955.5,1228.5,1501.5,1774.5,2047.5,2320.5,2593.5,2866.5,3016.65,3139.5,3276,3426.15,3617.25,3426.15,3276,3139.5,3016.65,2866.5,2593.5,2320.5,2047.5,1829.1,1556.1,1255.8,1146.6,955.5,873.6,764.4,679.77,846.3,955.5,1201.2,1351.35,1501.5,1706.25,1842.75,2047.5,2184,2347.8,2525.25,2702.7,2866.5,3003,3139.5,3288.285,3139.5,3003,2866.5,2702.7,2525.25,2347.8,2184,2047.5,1911,1774.5,1638,1501.5,1365,1228.5,1092,1044.225,1092,1228.5,1365,1501.5,1638,1774.5,1911,2046.135,2184,2317.77,2454.27,2525.25,2593.5,2689.05,2852.85,2921.1,2852.85,2689.05,2593.5,2525.25,2454.27,2317.77,2184,2047.5,1965.6,1815.45,1733.55,1636.635,1474.2,1228.5,1351.35,1481.025,1562.925,1644.825,1726.725,1808.625,1890.525,1945.125,2027.025,2047.5,2095.275,2145.78,2197.65,2245.425,2293.2,2327.325,2361.45,2388.75,2361.45,2327.325,2293.2,2245.425,2197.65,2145.78,2095.275,2047.5,2020.2,1992.9,1965.6,1938.3,1911,1883.7,1829.1,1774.5,1842.75,1911,1979.25,2047.5,2115.75,2184,2115.75,2047.5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11676" LastEditorDisplayName="user13706" LastEditDate="2015-07-15T18:25:51.003" LastActivityDate="2015-07-15T18:35:49.460" Title="Why is the magnitude of the second component of my FFT spectrum always the largest one?" Tags="|fft|frequency-spectrum|frequency|sampling|zero-padding|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24681" PostTypeId="2" ParentId="24676" CreationDate="2015-07-14T13:26:41.747" Score="1" Body="&lt;p&gt;I really am no expert in cameras (nor in OpenCV in which I'm pretty sure everything can be handled automatically et efficiently without doing calculations yourself). But without knowing the distance between the lens and your object, that will be difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, knowing the focal length of your camera and the distance from the nodal point to the image plane, you can deduce the distance from the nodal point to the object. Then just use Thales' theorem and you can do exactly what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem of this method is that it relies on how well the focus is done on the camera. And because of the varying depth of field of your camera, the magnitude of the error will vary too. AFAIK, this method should work pretty well for short distances. For longer ones, that can be very difficult as the focal point is near infinity and the depth of field is really large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative, you can put an object of known size next to the object which size you are measuring. Thales' theorem again and you get your data.&lt;/p&gt;&#xA;" OwnerDisplayName="user13706" LastEditorDisplayName="user13706" LastEditDate="2015-07-14T13:33:03.853" LastActivityDate="2015-07-14T13:33:03.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24683" PostTypeId="2" ParentId="24679" CreationDate="2015-07-14T14:03:35.050" Score="1" Body="&lt;p&gt;I suppose the correct expressions you meant are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) &lt;span class=&quot;math-container&quot;&gt;$5\sin(2t)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) &lt;span class=&quot;math-container&quot;&gt;$\sin(2t) + \sin(3t)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bandwidth is defined as the difference between the highest and lowest frequencies of a given signal ou system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this in mind, signal a) has one single frequency of 2 rad/s and so its bandwidth is 2-2=0 rad/s.&#xA;Similarly, signal b) has 2 frequencies: 2 rad/s and 3 rad/s. So, bandwidth is 3-2=1 rad/s.&lt;/p&gt;&#xA;" OwnerUserId="16617" LastEditorUserId="8202" LastEditDate="2020-03-09T08:57:01.513" LastActivityDate="2020-03-09T08:57:01.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24684" PostTypeId="2" ParentId="24679" CreationDate="2015-07-14T14:06:05.463" Score="0" Body="&lt;p&gt;In the frequency domain a sinusoid is a &quot;spike&quot;, an impulse function at the sinusoid's frequency.  Theoretically at least, a single sinusoid has 0 bandwidth.  In practice they actually have a small but non-zero bandwidth because in order to have zero bandwidth the sinusoid would have to be perfect and started at time $-\infty$ and end at time $+\infty$.  But nevermind that, let's stick to the ideal theoretical world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason that the bandwidth of the two sinusoids together is one is because the first sinusoid is at 2 Hz (assuming that there is an implied $2\pi$ in the frequency constant) and the second sinusoid is at 3 Hz.  Individually they have a bandwidth of 0 Hz, but since they are 1 Hz apart together they have a bandwidth of 1 Hz.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-07-14T14:06:05.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24685" PostTypeId="1" CreationDate="2015-07-14T14:11:31.213" Score="5" ViewCount="7109" Body="&lt;p&gt;The frequency resolution of a DFT with a rectangular window of size $N$ is given by $f_s/N$. However, when using other window functions like a Hamming or Hanning window the resolution gets worse. How can I calculate the frequency resolution of a DFT when using a Hamming/Hanning window of size $N$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some numbers regarding &quot;effective noise bandwidth (ENBW)&quot; but am not sure what exactly it means. The numbers were 1 for a rectangular window, 1.5 for Hanning and 1.37 for Hamming window. Does that mean the frequency resolution using a Hanning window is $1.5 \cdot f_s/N$?&lt;/p&gt;&#xA;" OwnerUserId="13662" LastEditorDisplayName="user13706" LastEditDate="2015-07-14T16:15:58.393" LastActivityDate="2018-12-30T14:13:13.783" Title="How to calculate resolution of DFT with Hamming/Hann window?" Tags="|frequency-spectrum|dft|window-functions|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24686" PostTypeId="1" CreationDate="2015-07-14T14:25:00.050" Score="0" ViewCount="559" Body="&lt;p&gt;I am editing audio from video that was captured from the sound board. The audio was recorded too loud since someone turned up the board and and the bass and vocals sound scratchy. I have brought the levels down a bit to normalize them but still have the scratchy sound with the vocals. Is there an effect in Adobe Audition to help this?&lt;/p&gt;&#xA;" OwnerUserId="16618" LastEditorDisplayName="user13706" LastEditDate="2015-07-15T09:22:39.250" LastActivityDate="2015-07-15T09:22:39.250" Title="How to fix audio clipping in Adobe Audition?" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24687" PostTypeId="1" CreationDate="2015-07-14T15:07:23.560" Score="5" ViewCount="2879" Body="&lt;p&gt;Is there a way to estimate the radial distortion coefficients without calibration, given the lens characteristics, such as its diameter and its focal length?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically for camera calibration a pinhole camera model is used, and then radial distortion is added on top of that. Radial distortion is a 4th or 6th degree polynomial with 2 or 3 coefficients. During calibration, these coefficients are not derived from anything. They are initially assumed to be 0, and then estimated from data using numeric optimization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am asking is whether or not there is an equation relating lens characteristics that you can read off the manufacturer's spec (focal length, aperture, field of view) to the radial distortion coefficients from the typical polynomial distortion model? In other words, is it possible to get some approximation of the distortion coefficients from the camera spec, before doing the calibration.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2015-07-14T17:36:40.727" LastActivityDate="2016-06-09T16:32:47.697" Title="How to estimate radial distortion from lens characteristics?" Tags="|computer-vision|camera|distortion|camera-calibration|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24689" PostTypeId="1" CreationDate="2015-07-14T15:45:48.617" Score="2" ViewCount="1921" Body="&lt;p&gt;I guess the most straightforward way of adding an artificial echo to a sound signal is to add its time-delayed version to the original signal. However, I am not sure how realistic that would sound like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was reading papers on room geometry estimation from impulse responses (see for example &lt;a href=&quot;http://www.mirlab.org/conference_papers/International_Conference/ICASSP%202012/pdfs/0000513.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;). So, perhaps one should have several echoes instead of just one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess something also happens to a sound signal when it is reflected (kind of filtering).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would you suggest here?&lt;/p&gt;&#xA;" OwnerUserId="16619" LastActivityDate="2016-08-08T06:57:24.703" Title="How to generate realistic echo to sounds?" Tags="|filters|audio|impulse-response|delay|geometry|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24691" PostTypeId="2" ParentId="24687" CreationDate="2015-07-14T16:19:51.010" Score="2" Body="&lt;p&gt;Find the equations (for instance in &lt;a href=&quot;http://www.researchgate.net/publication/220436724_Rational_Radial_Distortion_Models_of_Camera_Lenses_with_Analytical_Solution_for_Distortion_Correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). And solve them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is good enough for you, you can make use of the usual &lt;a href=&quot;https://math.stackexchange.com/questions/302093/how-to-calculate-the-lens-distortion-coefficients-with-a-known-displacement-vect&quot;&gt;quadratic formulae&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In parallel to this I've heard of the actual use of ray tracing as a Monte-Carlo-typed method to get the same information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I guess that even with that, a few effects are not taken into account. But again, it depends on the precision you need.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &#xA;AFAIK, diameter and focal length is not enough: the full shape is important. With the diameter and the focal length alone, you need to make extra assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if you are in the thin-lens approximation, the answer is easy: there is no distortion whatever its diameter or its focal length.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I guess I understand now, intrinsics such as the lens actual curvature, shape and composition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is perfectly possible: that's what's called &lt;a href=&quot;https://en.wikipedia.org/wiki/Geometrical_optics&quot; rel=&quot;nofollow noreferrer&quot;&gt;geometrical optics&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want is ray tracing. If the shape is good enough, you can solve everything analytically and therefore derive an equation linking what you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in contrast with a real calibration, with real images, this technique does not take a few effects into account (like diffraction, interferences, non-linearities or the errors in the specifications compared to the actual lens).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main equation is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Refraction&quot; rel=&quot;nofollow noreferrer&quot;&gt;refraction&lt;/a&gt; one (used in ray-tracing setups) and there is little more to say about it.&lt;/p&gt;&#xA;" OwnerDisplayName="user13706" LastEditorUserId="-1" LastEditorDisplayName="user13706" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-07-14T17:50:12.947" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24692" PostTypeId="2" ParentId="24685" CreationDate="2015-07-14T16:40:08.237" Score="-6" Body="&lt;p&gt;The frequency resolution does not depend on the type of the window. It is the length that matters. The frequency resolution is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\qquad\text{frequency resolution} = \displaystyle\frac{\text{sampling frequency}}{\text{window length}}.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say you have an audio signal with $f_{s} = 44100$ Hz. If the window length is $2\text{ s} = 2\cdot 44100 = 88200$ samples then the frequency resolution will be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\qquad\displaystyle\frac{44100\text{ Hz}}{88200} = 0.5\text{ Hz}.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to clarify, what I am describing here is the resolution of the DFT.&lt;/p&gt;&#xA;" OwnerUserId="16619" LastActivityDate="2015-07-14T16:40:08.237" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24693" PostTypeId="2" ParentId="24676" CreationDate="2015-07-14T16:42:28.460" Score="0" Body="&lt;p&gt;With a single calibrated camera you can determine the object's size if you know its distance from the camera.  Conversely, you can determine the object's distance if you know its size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do not know either the distance or the size, then you would need two calibrated cameras, and you would need to know the rotation and translation between them.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-07-14T16:42:28.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24695" PostTypeId="2" ParentId="24689" CreationDate="2015-07-14T18:24:15.173" Score="1" Body="&lt;p&gt;A very simple model is a sum of attenuated and delayed replicas of the signal. Such signal can be be generated using FIR filter. The length of the filter is the &quot;echo time&quot;, i.e. how long the echoes last.&lt;br&gt;&#xA;The simplest approach would be to generate sparse impulse response. Build a filter with $n$ non-zero coefficient and fading amplitude (for example the amplitude can be generated with Rayleigh distribution).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a more realistic scenario, I suggest using the &lt;a href=&quot;https://www.audiolabs-erlangen.de/fau/professor/habets/software/rir-generator&quot; rel=&quot;nofollow&quot;&gt;Room Impulse Response (RIR) generator&lt;/a&gt; by Emanuel Habets.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-07-14T18:24:15.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24697" PostTypeId="1" CreationDate="2015-07-14T19:19:12.703" Score="3" ViewCount="2449" Body="&lt;p&gt;When working with a decoder such as LDPC that can take in soft-decision inputs (or channel posterior probabilities as I've seen them called as well), how are these soft-decision values calculated for general M-ary modulations like M-FSK, PSK, or QAM?  I have only been able to find the BPSK case so far in Todd Moon's Error Correction Coding Book. I'm assuming AWGN channels and binary FEC codewords over GF(2).  Sources to information are fine too if the answers to this would be too long.&lt;/p&gt;&#xA;" OwnerUserId="16489" LastEditorUserId="16489" LastEditDate="2015-07-15T15:05:19.643" LastActivityDate="2017-07-12T11:52:16.283" Title="How to compute bit level soft decisions from an M-ary symbol?" Tags="|digital-communications|demodulation|forward-error-correction|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24698" PostTypeId="2" ParentId="24697" CreationDate="2015-07-14T19:38:51.230" Score="1" Body="&lt;p&gt;In each case, the soft-decision output is just the matched filter's output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say you transmit the bit sequence $1,1$ with codeword $1,0,1,1$. You transmit these bits using, say, QPSK symbols $0.5+0.5j,0.5-0.5j$. After matched filtering in the receiver, you will get two noisy complex numbers, for example $0.55+0.45j,1.2-0.49j$. A hard-decision decoder will turn those numbers into QPSK symbols and then bits before FEC. A soft-decision decoder will use those numbers without any further processing (except maybe some quantization).&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-07-14T19:38:51.230" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24699" PostTypeId="2" ParentId="24686" CreationDate="2015-07-14T19:44:08.890" Score="1" Body="&lt;p&gt;In Adobe Audition 3 there is Effects... Restoration... Clip Restoration (process).&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-07-14T19:44:08.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24701" PostTypeId="2" ParentId="24689" CreationDate="2015-07-14T21:22:57.947" Score="1" Body="&lt;p&gt;There are two different things you could be talking a out: delay and reverb.  I think what you are looking for is reverb.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two ways to do reverb are multitap reverb and convolution reverb. Multitap is faster but convolution is higher quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some links with more info and example c++ code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://blog.demofox.org/2015/03/17/diy-synth-multitap-reverb/&quot; rel=&quot;nofollow&quot;&gt;http://blog.demofox.org/2015/03/17/diy-synth-multitap-reverb/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://blog.demofox.org/2015/03/23/diy-synth-convolution-reverb-1d-discrete-convolution-of-audio-samples/&quot; rel=&quot;nofollow&quot;&gt;http://blog.demofox.org/2015/03/23/diy-synth-convolution-reverb-1d-discrete-convolution-of-audio-samples/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15130" LastActivityDate="2015-07-14T21:22:57.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24702" PostTypeId="2" ParentId="24580" CreationDate="2015-07-15T00:05:33.190" Score="1" Body="&lt;p&gt;Use FDLS (Frequency Domain Least Squares) to create a model of your measured frequency response. Use the frequency response of that model, evaluated at the FFT bin frequencies, as your filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternate: if a low-order IIR (or perhaps even FIR) model provides a good-enough fit, then use the model as your filter for direct time-domain convolution.&lt;/p&gt;&#xA;" OwnerUserId="11085" LastActivityDate="2015-07-15T00:05:33.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24703" PostTypeId="1" AcceptedAnswerId="24705" CreationDate="2015-07-15T00:37:10.863" Score="1" ViewCount="338" Body="&lt;p&gt;I have a signal, $f(t)$.  I know a function that can be used to generate this signal, such that I can determine its Fourier series.  I want to express this Fourier series in simpler terms so that the waveform can be rendered by a GPU in parallel, with the added ability to change the lowpass cutoff frequency of the signal dynamically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take for example a saw wave with a fundamental frequency of 1 Hz, represented by the function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = {-2\tan^{-1}(\cot(\pi t)) \over \pi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using this form of the saw wave because it's cyclic and easy for a GPU to calculate.  Its Fourier series is rather difficult to solve, but I have the series on hand:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(t, n) = {-2 \over \pi} \sum_{k=1}^n {\sin(k \pi t) \over k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I could technically use additive synthesis to generate the waveform using this series, but my project has real-time constraints and this simply won't do.  A single saw wave might have hundreds of partials up to the Nyquist frequency.  This takes a lot of time to compute, and on a GPU it's a branching nightmare.  Since I'm rendering all of the samples in parallel, there is no history buffer for existing filtering algorithms to operate on, and I can't do that either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm trying to do is approximate this series as a function of $n \in Z$, without the summation.  That way, it doesn't matter what cut-off I use, I get consistent performance across the board that's most likely a huge improvement over additive synthesis.  Right now I'm trying to fit the curve manually, but this is a laborious process.  Is there a way to find $h(t, n) \approx g(t, n)$, where $h(t, n)$ is the approximation of the series?&lt;/p&gt;&#xA;" OwnerUserId="10577" LastEditorUserId="10577" LastEditDate="2015-07-17T04:24:25.447" LastActivityDate="2015-07-17T04:24:25.447" Title="How to simplify the Fourier Series Using an Approximation?" Tags="|audio|fourier-series|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24705" PostTypeId="2" ParentId="24703" CreationDate="2015-07-15T02:43:32.203" Score="2" Body="&lt;p&gt;Sounds like bandlimited synthesis.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;with the added ability to change the lowpass cutoff frequency of the signal dynamically.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That makes it even more complicated.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The simplest way to do this right is additive synthesis, as you know.   That way you can adjust each harmonic's frequency and phase and amplitude on the fly. Yes, there are a lot of calculations if the fundamental frequency is low, but you can use approximations of &lt;code&gt;sin()&lt;/code&gt; if that speeds things up.  The 2-&lt;a href=&quot;https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation&quot; rel=&quot;nofollow noreferrer&quot;&gt;MAC&lt;/a&gt; resonant filter/oscillator (&lt;a href=&quot;http://www.research.scea.com/research/pdfs/RGREENfastermath_GDC02.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;http://www.musicdsp.org/showArchiveComment.php?ArchiveID=10&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;), for instance:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/XqjU9.jpg&quot; alt=&quot;resonant oscillator waveform and spectrum&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or various &lt;a href=&quot;http://krisgarrett.net/papers/l2approx.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;polynomial approximations&lt;/a&gt; with varying amounts of distortion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/v5PCe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;If the waveform is fixed and a submultiple of the sample rate, you could use IFFT synthesis, but for anything else I imagine this would be difficult because the harmonics cover multiple FFT bins.  Maybe with overlapping and fading between chunks?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Otherwise the best solution depends on what exact waveform you're trying to synthesize.  &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;If you only need a &quot;sawtooth-like&quot; waveform, for instance, you can use the &lt;a href=&quot;http://www.verklagekasper.de/synths/dsfsynthesis/dsfsynthesis.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DSF&lt;/a&gt; directly, which produces waveforms with harmonics that fall off linearly:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/K9XZO.png&quot; alt=&quot;sawtooth-like DSF&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;but if you want an actual square wave you use the DSF to generate a &quot;bipolar&quot; band-limited impulse train (BLIT):&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/fxNw7.gif&quot; alt=&quot;2 summed BLITs&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.music.mcgill.ca/~gary/307/week5/bandlimited.html#SECTION00028000000000000000&quot; rel=&quot;nofollow noreferrer&quot;&gt;and then leaky-integrate the sum&lt;/a&gt;. &lt;a href=&quot;https://stackoverflow.com/q/28199783/125507&quot;&gt;2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These methods can't be used for arbitrary waveforms, however, and can't be used for swept-frequency chirps or swept-frequency LPFs (as you want?), since the harmonics suddenly disappearing from one sample to the next produces a pop or click which can't be filtered out after the fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could probably use this method for the low harmonics and then combine with additive synthesis of the top harmonics and then fade those in and out to prevent the clicks.  In other words, as a harmonic disappears from one sample, you seamlessly replace it with an additive-synthesis harmonic at the same frequency and phase, which you can then fade out more smoothly.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Wavetable synthesis, fading between wavetables as harmonics disappear?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then there are other methods.  :)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~stilti/papers/blit.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ccrma.stanford.edu/~stilti/papers/blit.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2015-07-15T02:59:25.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24706" PostTypeId="1" CreationDate="2015-07-15T04:43:53.990" Score="1" ViewCount="3257" Body="&lt;p&gt;Apologies in advance if my question doesn't make sense. I'm not the most fluent person in signal processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an array of time domain values that I would like to apply a time delay to by computing the fft then apply the Fourier transform &#xA;$f(t - \tau) = F(\omega)\exp(-i \omega\tau)$ and then compute the inverse fft to get my delayed signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that the delay is very large (three times further than the range of my original signal) so in order to get the delayed signal I have been zero padding my original signal by a significant amount which greatly increase the computation time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a better way to compute the delay using Fourier transform without the need to zero pad?&lt;/p&gt;&#xA;" OwnerUserId="16627" LastEditorUserId="4298" LastEditDate="2015-07-15T09:40:18.710" LastActivityDate="2015-08-16T00:52:43.337" Title="How to perform a time domain shift in the frequency domain without zero padding" Tags="|fourier-transform|zero-padding|delay|" AnswerCount="2" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24707" PostTypeId="1" CreationDate="2015-07-15T06:59:31.963" Score="0" ViewCount="192" Body="&lt;p&gt;I have filtered out the low frequency noise from the signal. For further analysis, I want to compare it with FIR filters (for which I require cut off frequency). Hence, I took the power density spectrum of noise using Welch method and found its peak and used the same as cut off frequency. The PSD looks like this &lt;img src=&quot;https://i.stack.imgur.com/OZIXv.jpg&quot; alt=&quot;https://i.stack.imgur.com/OZIXv.jpg&quot;&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the cut off frequency? The peak occurs at $0.0031$ Hz or should I take a value between $0-0.5$Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The frequency range of my signal is $0-2$ Hz&lt;/p&gt;&#xA;" OwnerUserId="16628" LastEditorUserId="7092" LastEditDate="2015-07-15T20:39:05.407" LastActivityDate="2015-07-15T20:39:05.407" Title="How to determine cut off frequency for high pass filter using spectral density?" Tags="|filter-design|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24709" PostTypeId="2" ParentId="24706" CreationDate="2015-07-15T09:21:44.387" Score="1" Body="&lt;p&gt;Delay in the frequency domain, as you are attempting, can only be circular, so you must zero pad unless you want your signal to wrap around in time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing there is a good reason why you cannot just prepend the appropriate number of zeros in the time domain?&lt;/p&gt;&#xA;" OwnerUserId="16404" LastActivityDate="2015-07-15T09:21:44.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24710" PostTypeId="1" AcceptedAnswerId="24725" CreationDate="2015-07-15T11:15:20.807" Score="5" ViewCount="2788" Body="&lt;p&gt;I have a system where there's a transceiver which transmits tones on specific frequencies (about 260kHz) and a receiver which is supposed to recognize those tones. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transmitted tones are of low frequencies and has a very narrow band. At the receiver side I sample the band with ADC with sampling rate about 600kHz. The interesting band is about 1kHz wide, but whole analysed band is about 300kHz. To recognize if the signal exists I'm using 65k FFT? It takes about 100ms to collect samples. My goal is to find high-resolution tone power level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I heard about &lt;a href=&quot;http://www.embedded.com/design/other/4213370/Using-Zoom-FFT-for-spectral-analysis&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;zoom-fft&lt;/strong&gt;&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Chirp_Z-transform#Bluestein.27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;chirp-z&lt;/strong&gt;&lt;/a&gt;, but is there another without expanding sampling time? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe i should ask a question diffrently:&#xA;What method (algorithm) gives the highest resolution (Hz) when I have a constant number of samples, and want to see only a small part of whole band (e.g. 1kHz in 300kHz)?&lt;/p&gt;&#xA;" OwnerUserId="16630" LastEditorUserId="128" LastEditDate="2019-06-11T18:32:49.347" LastActivityDate="2019-06-11T18:32:49.347" Title="What Are the Alternatives to FFT for Computing High Resolution Tone Power Levels?" Tags="|filters|dft|signal-detection|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="24714" PostTypeId="1" CreationDate="2015-07-15T14:19:32.457" Score="2" ViewCount="95" Body="&lt;p&gt;Consider following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/CIy7C.jpg&quot; alt=&quot;Stonehenge&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have some real references here: Stonehenge measurements (stone dimensions and distances), some strait lines at the back of carts, cart wheels that are almost of the same size for both carts. At the same time we don't know the specification of the camera lens.&#xA;Question: Is it possible to calculate distance of the cart from stones? Or can we even deduce that the cart belongs to the scene or not?&lt;/p&gt;&#xA;" OwnerUserId="16634" LastActivityDate="2015-07-15T16:04:38.060" Title="Distances In a Single Image With Some Real References" Tags="|image-processing|distance-metrics|distortion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24715" PostTypeId="1" AcceptedAnswerId="24717" CreationDate="2015-07-15T15:03:19.640" Score="1" ViewCount="337" Body="&lt;p&gt;I am doing some research related to real-time voice/hotword recognition engines. In most current implementations, input is divided into frames (overlapping or not), and audio features are extracted per frame (most common being MFCCs) and fed into a Hidden Markov Model or a Neural Network of sorts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most papers I read address issues such as noise removal/reduction (using methods like Cepstral Mean Normalization), however I couldn't find any mention of how different voice amplitudes are handled. For example, I can train an engine to recognize my voice when I speak normally, however if I change my volume (speak louder), then the extracted features would look different (same shape but larger magnitude). Since this is a real-time system, I am not sure how real-time normalization is even possible, or whether it should be applied on the voice samples, or the extracted features. Or perhaps it is solved by training the system on variations in the speaker's volume?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your help is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="16635" LastActivityDate="2015-07-15T16:39:27.450" Title="In speech recognition applications, how are different voice amplitudes handled? (i.e loud vs. quiet tones)" Tags="|speech-recognition|real-time|amplitude|normalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24716" PostTypeId="2" ParentId="24714" CreationDate="2015-07-15T16:04:38.060" Score="2" Body="&lt;p&gt;Well, you can have an approximation. Due to the forms in the image are non regular, completely plain, its hard if not impossible to know the camera distortion. But if you know the size of the wheels and also you have the measures of the stones you can approximate the distance of the cart to the stones by using this equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;D_w = \frac{S_w * f}{P_w},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where: $D_w$ is the distance from the camera to the wheel, $S_w$ is the real height of the wheel, $f$ is the distance of the focal to the film when the film is in the camera (You need to search for this parameter to use this approach, also you need to know the proportion of the real impressed picture with the film) and $P_w$ is the height of the wheel in the film. The same thing for the stone:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;D_r = \frac{S_r * f}{P_r},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where: $D_r$ is the distance from the camera to the stone, $S_r$ is the real height of the stone and $P_r$ is the height of the stone in the film. Finally the distance $D_t$ from the wheel to the stone is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$D_t= D_r -D_w$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recomend you to use the objects that are marked in red in the next image, because are the nearest to the epipolar line.&lt;img src=&quot;https://i.stack.imgur.com/sX5iz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this could help, Best.&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-07-15T16:04:38.060" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24717" PostTypeId="2" ParentId="24715" CreationDate="2015-07-15T16:39:27.450" Score="2" Body="&lt;p&gt;Some of the channel effects can be indeed removed by doing the Cepstral Mean Subtraction/Normalization. Nevertheless that generally applies only to &quot;convolutive&quot; distortions that are constant. Any additive distortions, i.e. white noise, babble noise usually cannot be removed via CMS. But like you said this topic is handled via different methods to cope with the noise removal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the immunity of MFCC's with respect to different audio levels, you can do it easily by taking the appropriate coefficients. Generally the first MFCC coefficients is obtained by fitting the constant value curve ($\cos(0)$) to your log-energy filter banks. Therefore it is highly correlated to the RMS energy of your signal. If your remove that coefficient (often called 'static') then in theory you make your model volume (gain) independent. The rest of coefficients is not really related to the energy of your signal. Usually researchers drop the first coefficient, but they are adding it first and second derivative to the $\Delta$ and $\Delta\Delta$ features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously there is more to that. For example the Lombard Effect might take place and it's obviously changing the envelope of your signal. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-07-15T16:39:27.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24718" PostTypeId="1" CreationDate="2015-07-15T17:55:22.100" Score="0" ViewCount="231" Body="&lt;p&gt;What is the frequency range in which acoustic feedback can be found?  Most importantly, is there some lowest frequency below which one can expect not to find any feedback?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My conclusion from the reading I've done and from working with a limited number of audio feedback samples is that it can be found anywhere from 900 Hz upward. However, I've also found an &lt;a href=&quot;http://www.freesound.org/people/zerolagtime/sounds/269446/&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; where &#xA;the feedback in question shows up in the spectrogram around 550 Hz.  Now, the creator of that sound may well have shifted the sound's pitch down after recording it (I've asked the uploader and I'll wait for an answer).  But in any case, it made me wonder if such a situation actually might arise in practice.&lt;/p&gt;&#xA;" OwnerUserId="16637" LastActivityDate="2015-07-15T17:55:22.100" Title="Frequency range of acoustic feedback" Tags="|spectrogram|feedback|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24719" PostTypeId="2" ParentId="24680" CreationDate="2015-07-15T18:13:06.327" Score="0" Body="&lt;p&gt;Ok, so I tried to perform the same calculation (but forgive me, I did it in Python, but it should be readable).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np                    # Linear algebra module&#xA;from matplotlib import pyplot as plt  # Plot module&#xA;from scipy import signal              # One common DSP module&#xA;&#xA;# Spectral density calculation&#xA;data = np.array([2047.5,2063.88,2082.99,2099.37,2115.75,2140.32,2149.875,2156.7,2167.62,2178.54,2194.92,2205.84,2214.03,2222.22,2231.775,2238.6,2184,2115.75,2061.15,2013.375,1951.95,1897.35,1835.925,1774.5,1842.75,1911,2033.85,2115.75,2184,2293.2,2375.1,2457,2375.1,2252.25,2129.4,1992.9,1842.75,1706.25,1610.7,1501.5,1638,1777.23,1919.19,2059.785,2199.015,2336.88,2476.11,2613.975,2457,2297.295,2170.35,1904.175,1636.635,1449.63,1365,1236.69,1569.75,1835.925,1979.25,2080.26,2306.85,2457,2605.785,2852.85,2730,2661.75,2530.71,2429.7,2306.85,2182.635,2115.75,2047.5,1911,1774.5,1638,1501.5,1365,1228.5,1092,955.5,1092,1228.5,1365,1501.5,1638,1774.5,1911,2047.5,2197.65,2347.8,2497.95,2648.1,2798.25,2948.4,3091.725,3228.225,3084.9,2934.75,2784.6,2634.45,2484.3,2334.15,2190.825,2047.5,1774.5,1528.8,1228.5,1092,962.325,832.65,709.8,655.2,791.7,941.85,1090.635,1283.1,1528.8,1760.85,1911,2047.5,2293.2,2455.635,2593.5,2852.85,3016.65,3289.65,3412.5,3549,3412.5,3262.35,3001.635,2728.635,2455.635,2319.135,2115.75,2047.5,1794.975,1542.45,1365,1078.35,941.85,764.4,477.75,273,526.4805,682.5,832.65,1090.635,1337.7,1501.5,1909.635,2047.5,2184,2443.35,2661.75,2989.35,3274.635,3562.65,3701.88,3842.475,3685.5,3535.35,3207.75,2934.75,2730,2525.25,2306.85,2047.5,1842.75,1490.58,1119.3,982.8,709.8,436.8,163.8,40.95,204.75,436.8,764.4,1078.35,1300.845,1610.7,1883.7,2047.5,2320.5,2613.975,2907.45,3194.1,3480.75,3753.75,3890.25,4093.635,3549,2866.5,2184,1842.75,1706.25,1228.5,682.5,1.092,271.635,464.1,750.75,955.5,1228.5,1569.75,1842.75,2047.5,2320.5,2593.5,2866.5,3139.5,3412.5,3685.5,3822,3999.45,3822,3685.5,3412.5,3139.5,2866.5,2593.5,2320.5,2047.5,1774.5,1501.5,1228.5,955.5,682.5,518.7,313.95,135.135,313.95,518.7,682.5,955.5,1228.5,1501.5,1774.5,2047.5,2252.25,2525.25,2757.3,3057.6,3344.25,3494.4,3671.85,3842.475,3671.85,3494.4,3344.25,3057.6,2757.3,2525.25,2252.25,2047.5,1774.5,1501.5,1228.5,955.5,819,696.15,477.75,375.375,477.75,696.15,819,955.5,1228.5,1501.5,1774.5,2047.5,2320.5,2593.5,2866.5,3016.65,3139.5,3276,3426.15,3617.25,3426.15,3276,3139.5,3016.65,2866.5,2593.5,2320.5,2047.5,1829.1,1556.1,1255.8,1146.6,955.5,873.6,764.4,679.77,846.3,955.5,1201.2,1351.35,1501.5,1706.25,1842.75,2047.5,2184,2347.8,2525.25,2702.7,2866.5,3003,3139.5,3288.285,3139.5,3003,2866.5,2702.7,2525.25,2347.8,2184,2047.5,1911,1774.5,1638,1501.5,1365,1228.5,1092,1044.225,1092,1228.5,1365,1501.5,1638,1774.5,1911,2046.135,2184,2317.77,2454.27,2525.25,2593.5,2689.05,2852.85,2921.1,2852.85,2689.05,2593.5,2525.25,2454.27,2317.77,2184,2047.5,1965.6,1815.45,1733.55,1636.635,1474.2,1228.5,1351.35,1481.025,1562.925,1644.825,1726.725,1808.625,1890.525,1945.125,2027.025,2047.5,2095.275,2145.78,2197.65,2245.425,2293.2,2327.325,2361.45,2388.75,2361.45,2327.325,2293.2,2245.425,2197.65,2145.78,2095.275,2047.5,2020.2,1992.9,1965.6,1938.3,1911,1883.7,1829.1,1774.5,1842.75,1911,1979.25,2047.5,2115.75,2184,2115.75,2047.5])&#xA;freq, spectrum = signal.periodogram(data, window=&quot;hann&quot;, fs=195312.5, nfft=1024) # using Hann window and padding with 1024 - 400 zeros&#xA;&#xA;# Plotting&#xA;plt.figure()&#xA;plt.xlabel(&quot;Frequency&quot;)&#xA;plt.ylabel(&quot;Magnitude&quot;)&#xA;plt.title(&quot;Spectral density&quot;)&#xA;plt.plot(freq, spectrum)&#xA;&#xA;## zoom and plot points&#xA;plt.figure()&#xA;plt.xlim([0, 10000])&#xA;plt.xlabel(&quot;Frequency&quot;)&#xA;plt.ylabel(&quot;Magnitude&quot;)&#xA;plt.title(&quot;Spectral density&quot;)&#xA;plt.plot(freq, spectrum)&#xA;plt.plot(freq, spectrum, &quot;ko&quot;)&#xA;&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I got this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6XTLG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5ML7s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First thing then: you should use the &lt;code&gt;RealFFT&lt;/code&gt; since your input is real-valued. From &lt;code&gt;N&lt;/code&gt; samples, you get &lt;code&gt;N//2+1&lt;/code&gt; samples. This is faster and less error prone. You also need to get rid of redundancy everywhere: this is a mess.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As far as your problem is concerned, &lt;strong&gt;you forgot to remove the DC component&lt;/strong&gt; (aka &lt;strong&gt;&lt;em&gt;detrend&lt;/em&gt;&lt;/strong&gt;-ing) which is obviously leaking there. Removing the mean value of your data should be enough to get rid of it.&lt;/p&gt;&#xA;" OwnerDisplayName="user13706" LastEditorDisplayName="user13706" LastEditDate="2015-07-15T18:35:49.460" LastActivityDate="2015-07-15T18:35:49.460" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24721" PostTypeId="1" CreationDate="2015-07-03T03:56:27.130" Score="0" ViewCount="1381" Body="&lt;p&gt;I am building an simple website to show the first train arrival and last train departure timing in Singapore. I already wrote a simple code which could be &lt;a href=&quot;https://github.com/rengas/sgfirstlasttrain&quot; rel=&quot;nofollow noreferrer&quot;&gt;found&lt;/a&gt; here. I am placing an circle on top of each station so when hovered &#xA;it will display the timing for each station.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/heBEa.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus far I found the location(X and Y Coordinates) of each station manually added it to the code. But then I just realized that the map I am using is not the latest MRT Map. I don't want to go through the process again waste time for the new map. I am looking for a easy way to do this from the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two techniques I can think of right now:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find Equations for each Line assuming circle as points.Then place&#xA;the circle at the x and y coordinate. I understand  that one only&#xA;Harbourfront to Punngol(Purple) line is the easiest because its a&#xA;straight line. I am not so sure what is the equations for other&#xA;lines.&lt;/li&gt;&#xA;&lt;li&gt;Use template matching technique. Take a copy of the circle and look&#xA;for that circle in the whole image and get the coordinates.I&#xA;understand OpenCV can do template matching but how to do it in&#xA;JavaScript? Is there any simple JavaScript  image library to do&#xA;template matching?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any other suggestions?&lt;/p&gt;&#xA;" OwnerUserId="10532" OwnerDisplayName="Rengas" LastActivityDate="2015-09-14T15:42:34.033" Title="How to get the X and Y Coordinates of the circles from an image?" Tags="|image-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24722" PostTypeId="2" ParentId="24721" CreationDate="2015-07-15T20:42:19.847" Score="0" Body="&lt;p&gt;You can use &lt;a href=&quot;https://stackoverflow.com/questions/31320579/opencv-circle-detection-c-sharp-implementation/31321100#31321100&quot;&gt;this&lt;/a&gt; option for detect the circles, also I can see a lot of circles, are you interested in all of them?&lt;/p&gt;&#xA;" OwnerUserId="16620" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-07-15T20:42:19.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24725" PostTypeId="2" ParentId="24710" CreationDate="2015-07-15T22:18:56.573" Score="2" Body="&lt;p&gt;Actually all those &quot;Angle of Arrival&quot; algorithms can be used for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Multiple_signal_classification&quot; rel=&quot;noreferrer&quot;&gt;MUSIC&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Pisarenko_harmonic_decomposition&quot; rel=&quot;noreferrer&quot;&gt;Pisarenko Harmonic Decomposition&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Sensor_array&quot; rel=&quot;noreferrer&quot;&gt;Sensor Array&lt;/a&gt; (MVDR).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-07-15T22:18:56.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24726" PostTypeId="1" CreationDate="2015-07-16T00:34:14.753" Score="0" ViewCount="204" Body="&lt;p&gt;Me and a coworker are currently in the process of making an audio dsp library. We are wondering what some good FIR and IIR filters to use were. I know ALOT of them but what do you guys think in best/necessary for audio? Also if you have any other ideas not related to FIR and IIR filters please give your input.&lt;/p&gt;&#xA;" OwnerUserId="16642" LastActivityDate="2015-07-16T00:34:14.753" Title="DSP Library IIR and FIR filters" Tags="|audio|infinite-impulse-response|finite-impulse-response|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24728" PostTypeId="1" CreationDate="2015-07-16T11:56:13.123" Score="0" ViewCount="59" Body="&lt;p&gt;I am trying to add phase noise in signal. However, when i see the graph in frequency domain the spectrum is not broading. Can anyone tell me what mistake i am making?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sigma = 0.5;      %%% standard deviation,&#xA;t = 0:0.01:1;&#xA;sig = cos(2*pi*4*t); % original signal&#xA;A = sigma *randn(1,length(t)); % standard deviation of phase noise, increase&#xA;sig2 = (A).*cos(2*pi*4*t + sigma*rand(1,length(t))); %signal with phase noise &amp;amp; amplitud4e noise&#xA;figure,plot(t,sig,'r',t,sig2, 'b');&#xA;figure, plot(abs(fft(sig,10*length(sig))));&#xA;figure, plot(abs(fft(sig2,10*length(sig2))));&#xA;return&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16555" LastActivityDate="2015-07-16T12:12:36.687" Title="noise in signal" Tags="|fft|signal-analysis|noise|digital-communications|phase|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24731" PostTypeId="1" CreationDate="2015-07-16T15:15:08.613" Score="0" ViewCount="209" Body="&lt;p&gt;I need to calculate the poles and zeros from minimum 4th order (max ~20) filter coefficients. I have limitations that prohibit the companion matrix/eigen decomposition method used by roots() in Matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see many methods for general iterative root solving, but would really appreciate some advice whether there are any methods that work well for digital filters.&lt;/p&gt;&#xA;" OwnerUserId="16404" LastActivityDate="2015-07-16T15:15:08.613" Title="Calculating poles/zeros from 4+ order transfer function" Tags="|filters|poles-zeros|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24732" PostTypeId="2" ParentId="8692" CreationDate="2015-07-16T15:54:26.387" Score="5" Body="&lt;p&gt;I realize this question is 2 years old now, and it looks like OP eventually achieved a pretty decent phase response - but at the cost of magnitude response accuracy (according to the update in the post).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since OP asked for help on the &lt;em&gt;topic&lt;/em&gt; (not just the specific implementation), I believe I can add something useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out there is actually quite an easy way to implement a Hilbert Transformer with an IIR parallel all-pass structure: A method based on a particular geometric sequence of poles and zeros in the complex plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/46az0.png&quot; alt=&quot;Figure 1 - Hilbert generator all-pass filter&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entire structure in Figure 1 is all-pass, pure real (jy = 0), with the sequence of x-coordinates for the zeros on the RHS of the z-plane (x&gt;0) being generated with the formula: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;{(z_n)}^{k}_{n=0},\quad ‎‎z_n = e^{\frac{\pi}{2^n}}\quad&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For odd &lt;strong&gt;&lt;em&gt;k&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The example shows k=19; zeros at +/- 23.1407 and +/- 4.8105 have been omitted for clarity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The RHS poles inside the unit circle (0 &amp;lt; x &amp;lt; 1) are the inverse of the zeros:&#xA;\begin{equation}&#xA;{(p_n)}^{k}_{n=0},\quad p_n = \frac{1}{z_n}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the (x&amp;lt;0) LHS of the z-plane, the poles and zeros are simply the mirror image of those on the RHS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A pair of all-pass filter sections can be obtained from the above layout by separating &lt;em&gt;alternate&lt;/em&gt; zeros (by odd and even &lt;strong&gt;&lt;em&gt;k&lt;/em&gt;&lt;/strong&gt;), along with their corresponding p=1/z poles, to give the following structures:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WbasM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Effectively, we have split the filter generator function into 2 parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;Filter A:\quad {(z_n)}^{(k-1)/2}_{n=0}, ‎‎z_n = e^{\frac{\pi}{2^{(2n)}}}\qquad&#xA;Filter B:\quad {(z_n)}^{(k-1)/2}_{n=0},\quad ‎‎z_n = e^{\frac{\pi}{2^{(2n+1)}}}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase difference between the filter pair A and B is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J97gY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can straighten those lines to a constant phase difference by adding a unit delay (${z^{-1}}$: itself an allpass filter with a pole at 0 and zero at ∞) in series with Filter A:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VBP35.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see this gives you a ${\frac{\pi}{2}}$ = 90° phase difference between DC and the Nyquist frequency (at ${\pi}$ Hz), with sharp slopes at those 2 theoretical discontinuities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the amplitude response is perfectly flat since the structure is all-pass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The higher the &lt;strong&gt;&lt;em&gt;k&lt;/em&gt;&lt;/strong&gt; in the filter generator function, the closer to the unit circle the resulting pole/zero pairs, and the tighter the phase response near DC (with symmetrical behaviour near Nyquist) - at the expense of filter settling time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a bonus, you can rotate the positive and negative 'arms' of the combined filter in figure 1 into a conjugate '&lt;strong&gt;&amp;lt;&lt;/strong&gt;' shaped pair mirrored in the x-axis. Dividing the filter in the same fashion previously explained, and inserting a unit delay in series on one branch, will give you a pair of outputs exhibiting a ${\pi}$ = 180° phase difference with a transition frequency which is dependent on the angle of the '&lt;strong&gt;&amp;lt;&lt;/strong&gt;'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By adding and subtracting the outputs of such a filter you get a low pass and high pass response, all from the same basic design.&lt;/p&gt;&#xA;" OwnerUserId="16644" LastActivityDate="2015-07-16T15:54:26.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24733" PostTypeId="2" ParentId="24135" CreationDate="2015-07-16T16:20:18.050" Score="1" Body="&lt;p&gt;i don't have a C version of fixed-point FFT, but i have an old 56K version.  i used to have a 68K version but that's in a Mac that has died decades ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you can get a good fixed-point version of the FFT in C that you like, i can show you where to place the magnitude tests and where to kick it into &lt;em&gt;&quot;divide-by-two&quot;&lt;/em&gt; mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;your magnitude test should confirm that at least the 3 MSBs are identical (that the magnitude does not exceed 1/4 full scale) for every real and imaginary result of an FFT pass for the following pass to be unscaled.  if the magnitude of any value exceeds 1/4 full scale, then a sticky bit should be set and the following pass should be in &lt;em&gt;divide-by-two&lt;/em&gt; mode.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;page    255&#xA;opt cex,mex&#xA;lstcol  8,8,10,13,13&#xA;&#xA;&#xA;;&#xA;;       copyright (C) 1994 by Robert Bristow-Johnson&#xA;;                             tel:  201/429-1509&#xA;;&#xA;;&#xA;;&#xA;;       This subroutine is identical to the Motorola benchmark fftr2a&#xA;;       except that scaling is optimized using block floating point. &#xA;;       This requires a DSP56002, DSP56004, DSP56007 or DSP56001A.&#xA;;       Some FFT passes have the divide by 2 scaling mode set (depending&#xA;;       on the result of the S bit in the CCR).  This insures&#xA;;       against, overflow for any signal.  N must be a power of 2.&#xA;;&#xA;;       To be completely safe, the input should be scaled so that&#xA;;       the magnitude of every real or imaginary part does not&#xA;;       exceed 0.31066 ($27C3B5) .&#xA;;&#xA;;&#xA;;                    N-1&#xA;;       X[n] =  1/M  SUM{ x[k]exp(-j2 PI nk/N) }&#xA;;                    k=0&#xA;;&#xA;;              where&#xA;;                   x[k] = input in normal order&#xA;;                   X[n] = output in bit reverse order&#xA;;&#xA;;                   N = 2^p &#xA;;&#xA;;                   M = 2^q (q = integer, number of passes that &#xA;;                                 right shifting was necessary.&#xA;;                                 0 &amp;lt;= q &amp;lt;= p  )&#xA;;&#xA;;&#xA;;       input:  r1 -&amp;gt; data;  x:(r1) is real part, y:(r1) is imag part&#xA;;               r2 -&amp;gt; twiddle coeffients;  x:(r2) is cos, y:(r2) is sin&#xA;;               n1 = log2(number of points) = p&#xA;;               r4 = block floating point exponent input&#xA;;&#xA;;      output:  r4 = block floating point exponent output&#xA;;                  = q + r4 (input)&#xA;;&#xA;;        uses:  a, b, x0, x1, y0, y1, mr, ccr&#xA;;                      r1, r2, r3, r4, r5, r6&#xA;;                      n1, n2, n3,     n5, n6&#xA;;                      m1, m2, m3, m4, m5, m6&#xA;;               x:&amp;lt;data&#xA;;               x:&amp;lt;coef&#xA;;               x:&amp;lt;n_grp&#xA;;&#xA;;       Leaves mr in no scaling mode.&#xA;;&#xA;;       Requires 78 words of internal p: memory&#xA;;       and p*( 3*N + 20 ) + 8*N + 15 instruction cycles.&#xA;;&#xA;;       To execute optimally, the fft routine sould be in&#xA;;       internal p: space.&#xA;;&#xA;;&#xA;&#xA;org x:$0&#xA;    data	ds	$1&#xA;n_grp   ds  $1&#xA;    coef	ds	$1&#xA;&#xA;&#xA;org p:$40&#xA;    fft&#xA;	clr	a		r1,x:&amp;lt;data			;1&#xA;	move			#&amp;lt;1,a1				;1&#xA;	move			a1,x:&amp;lt;n_grp			;1 init groups per pass&#xA;	do	n1,_shift					;3&#xA;	asl	a						;p&#xA;    _shift&#xA;	lsr	a		r2,x:&amp;lt;coef			;1&#xA;	lsr	a		a1,n5				;1 init bfly per group (and offset between bfly top and bfly bottom addresses)&#xA;	move			a1,n3				;1 init twiddle pointer offset&#xA;	move			#&amp;gt;-1,m5				;2 init bfly top and bfly bottom address modifiers&#xA;	move			m5,m6				;1 for linear addressing&#xA;	move			m5,m4				;1&#xA;	move			m5,m1				;1&#xA;	move			m5,m2				;1&#xA;	move			#&amp;lt;0,m3				;1 init twiddle address modifier for bit-reversed addressing&#xA;	andi	#$7F,ccr                    ;1 clear sticky bit&#xA;;&#xA;;   Do FFT passes with triple nested DO loop.&#xA;;&#xA;do  n1,end_pass                 ;3&#xA;move            x:&amp;lt;data,r5          ;p   init bfly top input pointer&#xA;move            r5,r1               ;p   init bfly top output pointer&#xA;lua (r5)+n5,r6                  ;p   init bfly bottom input pointer&#xA;move            x:&amp;lt;coef,r3          ;p   init twiddle pointer&#xA;lua (r6)-,r2                    ;2p  init bfly bottom output pointer&#xA;move            n5,n6               ;p   init bfly pointer offsets&#xA;move            n5,n1               ;p&#xA;move            n5,n2               ;p&#xA;&#xA;jset    #7,sr,scale_down                ;2p  test scaling bit&#xA;&#xA;andi    #$F3,mr                     ;p   reset scaling to normal scaling mode&#xA;do  x:&amp;lt;n_grp,_end_group1                ;3p&#xA;move            x:(r6),x1   y:(r3),y0   ;N-1 preload x1, lookup -sin  value&#xA;move            x:(r2),a    y:(r5),b    ;N-1 preload a and b&#xA;move            x:(r3)+n3,x0            ;N-1 lookup -cos value, update twiddle pointer&#xA;do  n5,_end_bfly1                   ;3(N-1)&#xA;mac x1,y0,b             y:(r6)+,y1  ;pN/2    Im[top] - sin*Re[bot]&#xA;macr    -x0,y1,b    a,x:(r2)+   y:(r5),a    ;pN/2    Im[top] - sin*Re[bot] + cos*Im[bot] = Im[ top + twiddle*bot ]&#xA;subl    b,a     x:(r5),b    b,y:(r1)    ;pN/2    2*Im[top] - (Im[top] - sin*Re[bot] + cos*Im[bot]) = Im[top] + sin*Re[bot] - cos*Im[bot] = Im[ top - twiddle*bot ]&#xA;mac -x1,x0,b    x:(r5)+,a   a,y:(r2)    ;pN/2    Re[top] + cos*Re[bot]&#xA;macr    -y1,y0,b    x:(r6),x1           ;pN/2    Re[top] + cos*Re[bot] + sin*Im[bot] = Re[ top + twiddle*bot ]&#xA;subl    b,a     b,x:(r1)+   y:(r5),b    ;pN/2    2*Re[top] - (Re[top] + cos*Re[bot] + sin*Im[bot]) = Re[top] - cos*Re[bot] - sin*Im[bot] = Re[ top - twiddle*bot ]&#xA;_end_bfly1&#xA;move            a,x:(r2)+n2 y:(r6)+n6,y1    ;N-1 update bfly top and bfly bottom pointers&#xA;move            x:(r5)+n5,x1    y:(r1)+n1,y1    ;N-1&#xA;_end_group1&#xA;jmp &amp;lt;pass_common                    ;2p&#xA;&#xA;scale_down&#xA;move            (r4)+               ;(p) increment r4 to indicate one pass of scaling down&#xA;andi    #$7F,ccr					;(p) clear sticky bit&#xA;	ori	#$04,mr                      ;(p) set scaling mode to divide by 2&#xA;do  x:&amp;lt;n_grp,_end_group2                ;(3p)&#xA;move            x:(r6),x1   y:(r3),y0   ;(N-1) preload x1, lookup -sin value&#xA;move            x:(r2),a    y:(r5),b    ;(N-1) preload a and b&#xA;asl a       x:(r3)+n3,x0            ;(N-1) double a to compensate for div by 2 scaling, lookup -cos value, update twiddle pointer&#xA;do  n5,_end_bfly2                   ;(3(N-1))&#xA;mac x1,y0,b             y:(r6)+,y1  ;(pN/2)&#xA;macr    -x0,y1,b    a,x:(r2)+   y:(r5),a    ;(pN/2)&#xA;subl    b,a     x:(r5),b    b,y:(r1)    ;(pN/2)&#xA;mac -x1,x0,b    x:(r5)+,a   a,y:(r2)    ;(pN/2)&#xA;macr    -y1,y0,b    x:(r6),x1           ;(pN/2)&#xA;subl    b,a     b,x:(r1)+   y:(r5),b    ;(pN/2)&#xA;_end_bfly2&#xA;move            a,x:(r2)+n2 y:(r6)+n6,y1    ;(N-1) update bfly top and bfly bottom pointers&#xA;move            x:(r5)+n5,x1    y:(r1)+n1,y1    ;(N-1)&#xA;_end_group2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;pass_common&#xA;    move            n5,b1               ;p divide bfly per group by 2&#xA;    lsr b       x:&#xA;&#xA;&lt;pre&gt;&lt;code&gt;;&#xA;;pi equ 3.141592654&#xA;;freq   equ 2.0*pi/@cvf(points)&#xA;;&#xA;;   org x:coef&#xA;;count  set 0&#xA;;   dup points/2&#xA;;   dc  -@cos(@cvf(count)*freq)&#xA;;count  set count+1&#xA;;   endm&#xA;;&#xA;;   org y:coef&#xA;;count  set 0&#xA;;   dup points/2&#xA;;   dc  -@sin(@cvf(count)*freq)&#xA;;count  set count+1&#xA;;   endm&#xA;;&#xA;;   endm    ;end of sincos macro&#xA;;&#xA;&#xA;&#xA;&#xA;&#xA;;&#xA;;   this generates the FFT twiddle coefficients in normal order.&#xA;;   fft expects that and uses bit reversed addressing to fetch the twiddle coefs.&#xA;;&#xA;;   the values are negated because -1.0 can be exactly represented but +1.0 cannot.&#xA;;   fft expects that and negates the multiplications in the butterflies.&#xA;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;sincos&#xA;    andi    #$F3,mr&#xA;    move            #&gt;-1,m5&#xA;    move            m5,m2&#xA;    clr a       #delta_table,r5&#xA;    move            #&amp;lt;2,n5&#xA;    move            #&amp;lt;1,a1&#xA;    do  n1,_shift&#xA;    asl a       (r5)+n5&#xA;    _shift&#xA;    lsr a       #&amp;lt;-1.0,x0           ;-cos&#xA;    move            a,n5                ;N/2&#xA;    move            p:(r5)+,x1          ;-cosdel&#xA;    move            p:(r5)+,y1          ;-sindel&#xA;    mpyr    -x0,x1,a    #&amp;lt;0.0,y0            ;-sin&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;do  n5,_sincos_loop&#xA;mpy -x0,y1,b    a,x0&#xA;macr    -y0,x1,b    a,x:(r2)            ; b = new sin&#xA;mpy -x0,x1,a            b,y0&#xA;macr    y0,y1,a     b,y:(r2)+           ; a = new cos&#xA;_sincos_loop&#xA;rts&#xA;&#xA;twopi   equ 6.28318530717959&#xA;&#xA;delta_table&#xA;dc  -@cos(twopi/1.0)&#xA;dc  -@sin(twopi/1.0)&#xA;dc  -@cos(twopi/2.0)&#xA;dc  -@sin(twopi/2.0)&#xA;dc  -@cos(twopi/4.0)&#xA;dc  -@sin(twopi/4.0)&#xA;dc  -@cos(twopi/8.0)&#xA;dc  -@sin(twopi/8.0)&#xA;dc  -@cos(twopi/16.0)&#xA;dc  -@sin(twopi/16.0)&#xA;dc  -@cos(twopi/32.0)&#xA;dc  -@sin(twopi/32.0)&#xA;dc  -@cos(twopi/64.0)&#xA;dc  -@sin(twopi/64.0)&#xA;dc  -@cos(twopi/128.0)&#xA;dc  -@sin(twopi/128.0)&#xA;dc  -@cos(twopi/256.0)&#xA;dc  -@sin(twopi/256.0)&#xA;dc  -@cos(twopi/512.0)&#xA;dc  -@sin(twopi/512.0)&#xA;dc  -@cos(twopi/1024.0)&#xA;dc  -@sin(twopi/1024.0)&#xA;dc  -@cos(twopi/2048.0)&#xA;dc  -@sin(twopi/2048.0)&#xA;dc  -@cos(twopi/4096.0)&#xA;dc  -@sin(twopi/4096.0)&#xA;dc  -@cos(twopi/8192.0)&#xA;dc  -@sin(twopi/8192.0)&#xA;dc  -@cos(twopi/16384.0)&#xA;dc  -@sin(twopi/16384.0)&#xA;dc  -@cos(twopi/32768.0)&#xA;dc  -@sin(twopi/32768.0)&#xA;&#xA;END&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-07-16T16:20:18.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24734" PostTypeId="1" CreationDate="2015-07-16T17:41:01.877" Score="4" ViewCount="8071" Body="&lt;p&gt;Chessboards are very frequently used for camera calibration, this website also talks a bit about why: &lt;a href=&quot;https://en.wikipedia.org/wiki/Chessboard_detection&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt;. One of the reasons is, that chessboards define many natural interest points. &#xA;Now my (very simple?) question: Why don't we just use a white board with black dots on it instead of the checkerboard pattern where we first need to detect the corner points? I believe the black dots would be even easier to find...&lt;/p&gt;&#xA;" OwnerUserId="16462" LastActivityDate="2015-07-22T09:52:19.870" Title="camera calibration: why chessboards?" Tags="|computer-vision|camera-calibration|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24736" PostTypeId="2" ParentId="24734" CreationDate="2015-07-16T19:55:16.720" Score="4" Body="&lt;p&gt;You can use any target you'd like as long as you can find the features in a robust way, and you know their location in the real world. For example I used once ISO12233 chart image to calibrate radial distortion with fair accuracy, by knowing what features to look for, and what is their relative location.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/6VdnS.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both chessboard and dot chart are regular patterns (same distance between them), which means you don't care about displacement in the world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chessboard might be slightly better than dots because dots are large objects and not points, which means they are affected by radial distortion,(Their center in the distorted image is not the center in the undistorted).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/AwiXg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chessboard is more common in home environment, which makes it more popular. It  has less features, since it is harder to stack squares in a chart than dots. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LFgmA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all, there isn't a lot of difference between the charts, and for any reasonable purpose you can use any of them, but chessboard is just more common, which is why it is used frequently.&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-07-16T19:55:16.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24737" PostTypeId="1" CreationDate="2015-07-16T20:27:29.830" Score="2" ViewCount="306" Body="&lt;p&gt;I'm a newbie to Signal Processing - and so I'm providing a &quot;background&quot; and a &quot;question&quot; section separately. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Background:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a &lt;strong&gt;linear&lt;/strong&gt; filter (w.r.t. given as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\theta_{t+1} = \theta_t + \lambda (x_t - \theta_t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Financial Trading, such a filter is often called an exponential moving average, often applied to both prices (to get smoothened prices) and to square of price returns (to get &quot;EWMA&quot; volatility). By conventional definition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lambda =  \frac{2}{n+1}$, where $n$ is periods (example $20$-day EWMA volatility). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, a lot of folks in Financial Trading define &lt;strong&gt;&quot;lag&quot;&lt;/strong&gt; as the expected value of the filter, when $x_u$ is replace by $t-u$. For instance, the above filter can also be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\theta_{t+1} = \lambda (x_t+(1-\lambda) x_{t-1}+ (1-\lambda)^2 x_{t-2}+ ...)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the &lt;strong&gt;&quot;lag&quot;&lt;/strong&gt; of this filter in Financial Trading, we write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L(\theta) = \lambda (0+(1-\lambda) 1+ (1-\lambda)^2 2+ ...)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L(\theta) = (1-\lambda)/\lambda = \frac{n-1}{2}$. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Question:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose I have a filter that is non-linear in $\theta$. Example, suppose it is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\theta_{t+1} = \theta_t + \lambda \frac{1}{2}(x_{t}^2 e^{2\theta_t}-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea what would be the equivalent of a &lt;strong&gt;lag&lt;/strong&gt; here. Some folks told me that the definition of &lt;strong&gt;lag&lt;/strong&gt; in Financial Trading is equivalent to the &lt;strong&gt;group delay&lt;/strong&gt; (or may be &lt;strong&gt;phase delay&lt;/strong&gt;) in Signal Processing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) I looked up the definition of &lt;strong&gt;group delay&lt;/strong&gt; and &lt;strong&gt;phase delay&lt;/strong&gt; (e.g. on Wiki), but I couldn't exactly relate them to the definition of &lt;strong&gt;lag&lt;/strong&gt; in Financial Trading. For the linear example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\theta_{t+1} = \theta_t + \lambda (x_t - \theta_t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what would be the &lt;strong&gt;group delay&lt;/strong&gt; (or may be &lt;strong&gt;phase delay&lt;/strong&gt; if that's more equivalent)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) For the non-linear example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\theta_{t+1} = \theta_t + \lambda \frac{1}{2}(x_{t}^2 e^{2\theta_t}-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what would be the &lt;strong&gt;group delay&lt;/strong&gt; / &lt;strong&gt;phase delay&lt;/strong&gt; or the equivalent of &lt;strong&gt;lag&lt;/strong&gt; as applied to the linear filters in Financial Trading?&lt;/p&gt;&#xA;" OwnerUserId="16651" LastEditorUserId="16651" LastEditDate="2015-07-16T20:54:35.713" LastActivityDate="2015-09-15T03:18:00.477" Title="Lag in financial trading vs Group Delay in signal processing" Tags="|filters|lowpass-filter|group-delay|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24738" PostTypeId="1" AcceptedAnswerId="24807" CreationDate="2015-07-16T22:43:51.737" Score="0" ViewCount="157" Body="&lt;p&gt;A Pseudo-random Noise (PN) sequence is a sequence of binary numbers, e.g. ±1, which appears to be random; but is in fact perfectly deterministic. The sequence appears to be random in the sense that the binary values and groups or runs of the same binary value occur in the sequence in the same proportion they would if the sequence were being generated based on a fair &quot;coin tossing&quot; experiment. In the experiment, each head could result in one binary value and a tail the other value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a model, $$ x(t) = h^T u(t) +w(t)  \tag{1}$$&#xA;where $u$ is the input and $w$ is Additive White Gaussian noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Book : Fundamentals of Statistical Signal Processing by Steven Kay, Chapter 4 : Eq(4.21) finds the variance of the estimated coefficients when the input is PRN as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$var(\hat{h_i} )= \sigma_w^2/Nr_{uu}[0] \tag{2}$$ under the assumption of the input to be a PN .&#xA;where $\sigma_w^2$ is the variance of the measurement noise; $\sigma_u^2$ is the variance of the input&#xA;The MVU estimator using a PRN sequence is mentioned as $\hat{\theta }= (H^TH)^{-1} H^T x$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is stated that for the deterministic sequence $u$ the $H^TH$ becomes a symmetric Toeplitz autocorrelation matrix. For $H^TH$ to be diagonal we should use a PRN sequence as input which yileds $H^TH = Nr_{uu}[o]I$.&#xA;These expressions can be found in &lt;a href=&quot;http://people.duke.edu/~hpgavin/SystemID/References/Estimation_Theory.pdf&quot; rel=&quot;nofollow&quot;&gt;document&lt;/a&gt; Pg 7 Section 4.1.3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that I am confused if PRN means binary or $\pm1$ sequence or only $iid$ real valued White Gaussian noise. If PRN is different from PN or binary, then what will be the estimates and the CRLB?&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="750" LastEditDate="2015-07-20T21:32:09.303" LastActivityDate="2015-07-21T03:26:33.657" Title="Confusion related to PN sequence : Terminology and application in statistical signal processing" Tags="|discrete-signals|estimation|self-study|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24739" PostTypeId="2" ParentId="8119" CreationDate="2015-07-16T23:01:46.687" Score="0" Body="&lt;p&gt;Differential encoder to the Gray mapping is to remove the 90 degree phase variance, e.g. the received constellations are 90 degree rotated. The receiver doesn't reply on the absolute phase of the QAM constellations but uses the transition between consecutive symbols to demodulate the data.  &lt;/p&gt;&#xA;" OwnerUserId="16655" LastActivityDate="2015-07-16T23:01:46.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24741" PostTypeId="1" CreationDate="2015-07-17T01:25:34.923" Score="2" ViewCount="290" Body="&lt;p&gt;&lt;strong&gt;My first question :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I want to know why an image is noisy ?.&lt;/li&gt;&#xA;&lt;li&gt;why the ultrasound, SAR and Laser... images are noisy by a multiplicative noise not an additive noise? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Another question :&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the dominant noise in ultrasound image is  the Speckle noise, but the confusion in my mind is : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The speckle noise is of multiplicative nature, the mathematical writing is&#xA;$$f(x,y)=u(x,u)\eta(x,y)\tag{1}$$&#xA;where $f$ is the observed image, $\eta$ the noise and $u$ the dispeckle (recovered) image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in some paper (as &lt;a href=&quot;http://perso.telecom-paristech.fr/~angelini/SI241/papers_for_project/kikinis.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;) the perturbed images with the speckle noise can write as :&#xA;$$f(x,y)=u(x,y)+\sqrt{u(x,y)}\eta(x,y)\tag{2}$$&#xA;and $\eta$ is with zero-mean Gaussian variable, the first constraint it must $u&amp;gt;0$ and then the model (2) is characteris of the Gaussian distribution, So this is the case of additive noise&lt;/p&gt;&#xA;" OwnerUserId="16063" LastEditorUserId="16063" LastEditDate="2015-07-29T17:58:08.123" LastActivityDate="2015-07-29T17:58:08.123" Title="why the ultasound image is noisy by speckle noise?" Tags="|image-processing|filters|computer-vision|noise|denoising|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24742" PostTypeId="2" ParentId="24737" CreationDate="2015-07-17T02:05:19.387" Score="2" Body="&lt;p&gt;i'm gonna work on this using the EE DSP notation i think is most conventional in the EE DSP field.  your exponentially-decaying 1-pole filter has this simple &lt;strong&gt;difference equation&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = (1-p) \, x[n] \ + \ p \, y[n-1] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;turns out (as we shall see below) that $p$ is the pole.  applying the Z transform gets you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y(z) = (1-p) \, X(z) \ + \ p \, z^{-1}Y(z) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which we can solve for the &lt;strong&gt;transfer function&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) \triangleq \frac{Y(z)}{X(z)} = \frac{1-p}{1-p\,z^{-1}} = (1-p)\frac{z}{z-p} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so there is a zero at $z=0$ and a (real) pole at $z=p$.  the zero would go away if we took our input from $x[n-1]$ instead of $x[n]$ which would create a pole at $z=0$ and cancel the zero, but all that does is introduce another sample period of delay.  i don't think you wanna do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the (Kronecker) &lt;strong&gt;impulse response&lt;/strong&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;h[n] &amp;amp; = (1-p) p^n u[n] \\&#xA;&amp;amp; = (1-p) e^{\log(p) \, n} u[n] \\&#xA;&amp;amp; = (1-p) e^{n / \tau} u[n] \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where u[n] is the Heaviside unit step function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u[n] \triangleq&#xA;\begin{cases}&#xA;1, &amp;amp; \text{if }n \ge 0 \\&#xA;0, &amp;amp; \text{if }n &amp;lt; 0&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $\tau$ is the &lt;em&gt;&quot;time constant&quot;&lt;/em&gt; of the decaying exponential.  in order for the filter to be stable, the exponential must be decaying which means that $\tau &amp;gt; 0$, $\log(p) &amp;lt; 0$, and $0 &amp;lt; p &amp;lt; 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;okay, so now the &lt;strong&gt;complex frequency response&lt;/strong&gt; of $H(z)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;H(z)\bigg|_{z=e^{j\omega}} = H(e^{j\omega}) &amp;amp; = \frac{1-p}{1-p \, e^{-j\omega}} \\&#xA;&amp;amp; = \frac{1-p}{1-p \, \left(\cos(\omega) + j\sin(\omega) \right)} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the &lt;strong&gt;magnitude response&lt;/strong&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;|H(e^{j\omega})| &amp;amp; = \left|\frac{1-p}{1-p \, e^{-j\omega}} \right| \\&#xA;&amp;amp; = \left| \frac{1-p}{1-p \, \left(\cos(\omega) + j\sin(\omega) \right)} \right| \\&#xA;&amp;amp; = \frac{1-p}{\sqrt{ (1-p\cos(\omega))^2 + (p\sin(\omega))^2 }} \\&#xA;&amp;amp; = \frac{1-p}{\sqrt{ 1 + p^2 - 2 p \cos(\omega) }} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is pretty familiar.  less oft observed is the &lt;strong&gt;phase response&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;\phi(\omega) \triangleq \arg \{ H(e^{j\omega}) \} &amp;amp; = \arg \left\{ \frac{1-p}{1-p \, e^{-j\omega}} \right\} \\&#xA;&amp;amp; = \arg \{ 1-p \} - \arg \{1-p \, e^{-j\omega} \} \\&#xA;&amp;amp; = 0 - \arg \{1-p (\cos(\omega) + j \sin(\omega)) \} \\&#xA;&amp;amp; = - \arctan \left( \frac{p \sin(\omega)}{1-p \cos(\omega)} \right) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the &lt;strong&gt;phase delay&lt;/strong&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tau_\phi(\omega) \triangleq -\frac{\phi(\omega)}{\omega} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the &lt;strong&gt;group delay&lt;/strong&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tau_g(\omega) \triangleq -\frac{d\phi(\omega)}{d\omega} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;gotta go.  i'll post this now and finish it later.  perhaps someone else wants to finish it.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-07-17T02:05:19.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24744" PostTypeId="2" ParentId="3581" CreationDate="2015-07-17T03:57:34.237" Score="2" Body="&lt;p&gt;Lower the global volume. Impulse tracker classically outputs channels at about 33% volume max by default.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That seems to be both loud enough for music with few channels (4 channel Amiga MODs) and soft enough for songs with 50 channels (since channel contents are typically not correlated so volume doesn't add up that fast past a certain level... plus few channels will be outputting at max volume with that much stuff going on). It also leaves enough headroom for hard-left or hard-right panned channels (which use 66% of the range).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also you don't want to add your channels together in 16bits, you want to add them together in 32bits, then clip the result and reduce to 16bits at the very end. You will need the higher range so that it doesn't wrap around while doing the math. Another option is to use 32bit floating point (which is convenient for doing filters, effects etc).&lt;/p&gt;&#xA;" OwnerUserId="16661" LastActivityDate="2015-07-17T03:57:34.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24746" PostTypeId="1" CreationDate="2015-07-17T11:13:47.780" Score="-3" ViewCount="1921" Body="&lt;p&gt;Why we use 1536 point FFT for 15 MHz bandwidth, when we can use 1024 point FFT, as in bandwidth of 15 MHz we have only 900 subcarriers.&lt;/p&gt;&#xA;" OwnerUserId="16665" LastEditorUserId="13320" LastEditDate="2016-11-13T12:49:00.413" LastActivityDate="2016-11-13T12:49:00.413" Title="Why 1536 FFT size for 15 MHz in LTE" Tags="|ofdm|communication-standard|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24747" PostTypeId="1" CreationDate="2015-07-17T12:06:15.560" Score="2" ViewCount="787" Body="&lt;p&gt;I am trying to understand, intuitively, the mapping of a sinusoidal signal's fundamental frequency from time domain to frequency domain using $\textrm{DFT}$ formula. Given the time domain samples $\{x[0], x[1], \dots, x[N - 1]\}$; we have from the $\textrm{DFT}$ formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(f_k) = \displaystyle \sum_{n = 0}^{N - 1}x[n]\exp\left(-j2\pi f_kn\right)\tag{1} \label{dft}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $f_k = k/N$ and $k =0, 1, \cdots, N - 1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this purpose I used a sinusoidal signal in Matlab and its windowed version. Here is an excerpt from my Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000; &#xA;Ts = 1/Fs;&#xA;t = 0:Ts:(1000 - 1)*Ts; %1sec&#xA;&#xA;A = 2;&#xA;F = 20; &#xA;y1 = A*sin(2*pi*F*t); &#xA;y2 = y1.*hann(length(y1))';&#xA;&#xA;nfft = 2^nextpow2(length(y1));&#xA;Fy = (Fs/2)*linspace(0, 1, nfft/2+1);&#xA;&#xA;Y1 = 2*abs(fft(y1, nfft));&#xA;Y1(1) = .5*Y1(1);&#xA;Y1 = Y1./max(Y1);&#xA;&#xA;Y2 = 2*abs(fft(y2, nfft));&#xA;Y2(1) = .5*Y2(1);&#xA;Y2 = Y2./max(Y2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See the figure below for the time domain and frequency domain plots of the signals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/51ALn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How can one intuitively see that the linear combination of exponentials from $\eqref{dft}$ will yield a sum with an absolute amplitude $\left| X(f_k)\right|$ that has a maximum at the fundamental frequency $\textrm{F = 20 Hz}$ ? Or is this an optimization problem of the absolute amplitude spectrum $\left|X(f_k)\right|$ wrt to $f_k$ ? Or is this just the magic of the $\textrm{DFT}$ ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How is the tapering of the signal by non-rectangular window explain from $\eqref{dft}$ the &lt;em&gt;better&lt;/em&gt; localization of the maximum at $\textrm{F = 20 Hz}$ (i.e minimized leakage around the fundamental frequency) ? I am well aware of the theory on windows, leakages. I'm more looking for an explanation based on equation $\eqref{dft}$. From the visual inspection of $y_1$ and $y_2$ on the top figure, how could one conclude, from the linear combinations in $\eqref{dft}$, the difference of shapes in  $\left|Y_1(f_k)\right|$ and $\left|Y_2(f_k)\right|$?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1629" LastActivityDate="2015-07-17T12:06:15.560" Title="DFT sinusoid's fundamental frequency, intuitively" Tags="|dft|window-functions|fundamental-frequency|" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="24749" PostTypeId="2" ParentId="24180" CreationDate="2015-07-17T13:31:16.213" Score="1" Body="&lt;p&gt;Here is a different way to look at it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The violation of complex conjugate symmetry produces and &quot;error&quot;. That error is, that the impulse response becomes complex. By applying the &quot;real()&quot; operator on the inverse FFT, the error is eliminated again.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-17T13:31:16.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24750" PostTypeId="1" AcceptedAnswerId="24755" CreationDate="2015-07-17T14:01:09.873" Score="3" ViewCount="277" Body="&lt;p&gt;It is known that an LTI system is defined by its Impulse Response and the Convolution Operator.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could some put some intuition behind?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="16329" LastEditorUserId="60971" LastEditDate="2022-02-12T12:41:52.180" LastActivityDate="2022-02-12T12:41:52.180" Title="What Is the Intuition of Convolution in The Signal Processing World" Tags="|convolution|linear-systems|math|" AnswerCount="1" CommentCount="3" ClosedDate="2015-07-17T22:02:16.093" ContentLicense="CC BY-SA 3.0" />
  <row Id="24751" PostTypeId="2" ParentId="24741" CreationDate="2015-07-17T15:08:16.257" Score="2" Body="&lt;p&gt;There are a lot of factors, the answer can be very ambiguous, I'm going to tell you an example: In a simple digital camera you have inside a matrix of sensor to transform the viewed space in a digital sample of it, the sensors are capable to receive red, green, blue and in some cases white light, one pixel is made by a combination of this sensors and the light beams don't arrive in the same proportion to the sensors, actually a normal distribution of the arriving beam is supposed on each sensor. This can be appreciated in the video of a non moving scene, if you look meticulously you will see how some pixels change its color in a noisy way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this simple effect is present in a simple camera can you imagine what are the problems in other types of sensors. In ultrasound the image is acquired using the same principle, there is a matrix of sensors to collect some information, this information is the reflected sound which is affected by the tissue of the observed region, the sounds of the observed region and a lot of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are simple examples that could you to understand why images are noisy. If you are interested in more information, take a look in imaging extraction Technics, but always keep in mind that there are a lot of things that could interfere in the extraction process and think which can be these artifacts.&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-07-17T15:08:16.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24752" PostTypeId="2" ParentId="24734" CreationDate="2015-07-17T15:10:00.457" Score="7" Body="&lt;p&gt;This is mostly a matter of history. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checkerboard patterns have proven in the past to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;yield calibration accurate results&lt;/li&gt;&#xA;&lt;li&gt;be easy and robust to implement.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This was confirmed (for example) by a benchmark performed by NASA long time ago, where they were assessing visual solutions to control robotic arms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are checkerboards robust and accurate? Because they provide features that can ve computed as &lt;strong&gt;intersection of lines&lt;/strong&gt;.&#xA;Linear features were easy to detect accurately (using Canny-Deriche, SUSAN, Hough transform...), while most point detectors were computed with pixel accuracy. &#xA;Furthermore, checkerboards do provide line &lt;strong&gt;intersections&lt;/strong&gt;, which are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;robust: if a part of the calibration pattern is occluded, you can still get the coordinates of the intersection points thanks to the line equation&lt;/li&gt;&#xA;&lt;li&gt;accurate: line equations can be interpolated from sample points, and this is the case for their intersection too. Thus, you naturally get subpixel precision. This holds also for the old-fashioned pipelines where the corners were actually clicked by somebody&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;By robust to occlusion, I mean that you just have to continue the parts of the lines that are visible to get the intersection coordinates.&#xA;With dots this is more hazardous, because you have less clues to infer the overall line direction. Also, when some dots are occluded, it's very difficult to know which ones are indeed occluded. Instead, using checkerboards of known size (e.g. $8 \times 8$ squares), then you can infer which tile exactly is hidden as long as you see the borders of the checkerboard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possible advantage of checkerboard patterns is that since you have line featurs, then it may be easier to infer distortion coefficient values, which is harder to do if you need to &quot;connect the dots&quot; of aligned points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Modern point detectors (starting from Harris corners) perform interpolation to reach subpixel accuracy in point detection, and since checkerboards provide a lot of corners they continued to be used, just switching from line primitives to corner primitives.&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="1355" LastEditDate="2015-07-22T09:52:19.870" LastActivityDate="2015-07-22T09:52:19.870" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24753" PostTypeId="1" AcceptedAnswerId="24754" CreationDate="2015-07-17T17:07:57.073" Score="3" ViewCount="496" Body="&lt;p&gt;Assuming I have a linear differential equation of first order low pass filter:&#xA;$$RC*y(t)'+y(t) = x(t) $$&#xA;And Assuming i know now that the input x(t) is being sampled at a rate of   $T_s$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how can now switch the equation to describe in the discrete time form?&#xA;I know that the answer is:&#xA;$$x[n] = y[n] + RC/T_s* (y[n]-y[n-1])$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but i can't figure how to get there. &#xA;I know that there is a strong relation between DTFT and fourier transform but i couldn't figure how to use it.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16669" LastEditorUserId="128" LastEditDate="2019-11-18T07:03:34.043" LastActivityDate="2019-11-19T05:09:48.157" Title="Transform a Continuous Time Differential Equation of a Low Pass Filter to Discrete Time" Tags="|discrete-signals|sampling|continuous-signals|lowpass-filter|differential-equation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24754" PostTypeId="2" ParentId="24753" CreationDate="2015-07-17T17:32:31.993" Score="1" Body="&lt;p&gt;The answer comes from a discrete approximation of the derivative operator.&lt;br&gt;&#xA;Sometime it is called &quot;Finite Differences&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at &lt;span class=&quot;math-container&quot;&gt;$ \frac{ y \left[ n {T}_{s} \right] - y \left[ n {T}_{s} - {T}_{s} \right] }{ {T}_{s} } $&lt;/span&gt;, what happens when &lt;span class=&quot;math-container&quot;&gt;$ {T}_{s} \to 0 $&lt;/span&gt;?&lt;br&gt;&#xA;We got the definition of the drivative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since we sample at interval of &lt;span class=&quot;math-container&quot;&gt;$ {T}_{s} $&lt;/span&gt; we can agree that &lt;span class=&quot;math-container&quot;&gt;$ y \left[ n {T}_{s} \right] = y \left[ n \right] $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ y \left[ n {T}_{s} - {T}_{s} \right] = y \left[ n - 1 \right] $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do that and you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ R C {y}' \left ( t \right ) + y \left ( y \right ) = x \left ( t \right ) \approx R C \frac{ y \left [ n \right ] - y \left [ n - 1 \right ] }{ {T}_{s} } + y \left [ n \right ] = x \left [ n \right ] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now simple adjustment and you have what you need.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-11-19T05:09:48.157" LastActivityDate="2019-11-19T05:09:48.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24755" PostTypeId="2" ParentId="24750" CreationDate="2015-07-17T17:40:11.387" Score="0" Body="&lt;p&gt;I think this MathOverflow post gives a lot of intuition about Convolution: &lt;a href=&quot;https://mathoverflow.net/questions/5892/&quot;&gt;What's convolution intuitively&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;p&gt;In the Signal Processing world, an LTI (Linear and Time Invariant) system basically scales and sums delayed versions of the input signal.&lt;/p&gt;&#xA;&lt;p&gt;This can be mathematically described using the integral known as convolution.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="60971" LastEditDate="2022-02-12T05:47:47.077" LastActivityDate="2022-02-12T05:47:47.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24756" PostTypeId="1" CreationDate="2015-07-17T18:18:01.973" Score="3" ViewCount="7460" Body="&lt;p&gt;I have recently started to use &lt;a href=&quot;http://numerics.mathdotnet.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MathNet.Numerics&lt;/a&gt;, and one of my needs is to perform FFT analysis of Electromyographical signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first test I did was to get some 15 seconds of signals at 2kHz, this is how it plots:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/gn9cd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Python script I wrote some time ago, and the FFT spectrum generated is below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lenfft = len(signal)/2.&#xA;nyq = 2000/2.&#xA;freq_axis = numpy.linspace(0, nyq, lenfft+1)&#xA;spectrum = numpy.abs(numpy.fft.rfft(signal))&#xA;plt.plot(freq_axis, spectrum)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/PbmLT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, when I use MathNet.Numerics, I get a weird result (code and image below):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Complex[] signal = ArrayOfDoublesFromFile()&#xA;                        .Select(val =&amp;gt; new Complex(val, 0))&#xA;                        .ToArray();&#xA;&#xA;Fourier.Forward(signal, FourierOptions.Default); // inplace&#xA;&#xA;SaveToFile(signal);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/NiOuN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that if the inputs are pure real numbers, the output &lt;em&gt;should&lt;/em&gt; be symmetrical or something like that, but since &lt;code&gt;Fourier.Forward()&lt;/code&gt; requires a &lt;code&gt;MatNet.Numerics.Complex[]&lt;/code&gt; array, I am creating an array with imaginary part set to zero, and also using only real part of result for plotting, is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the question is: whats the meaning of the output generated by &lt;a href=&quot;http://numerics.mathdotnet.com/api/MathNet.Numerics.IntegralTransforms/Fourier.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;MathNet.Numerics.Fourier.Forward()&lt;/code&gt;&lt;/a&gt;, and what should I make if I want a result in the visual form most commonly associated with FFT, that is, the middle figure?&lt;/p&gt;&#xA;" OwnerUserId="1558" LastEditorUserId="1558" LastEditDate="2015-07-17T19:16:16.803" LastActivityDate="2016-11-16T20:00:16.877" Title="How to interpret these FFT results?" Tags="|fft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24757" PostTypeId="2" ParentId="24741" CreationDate="2015-07-17T22:00:17.583" Score="4" Body="&lt;p&gt;There are plenty of sources of noise in an imaging system. In the domain of sonar systems (which I work in) there is a big problem of reverberation, which is a fancy way of saying &quot;sound from something that we aren't interested in. When using a sonar at sea, you get reverb from the sea surface, sea bed and the water volume. Taking volume reverb as a simple example, this is the water itself (or particles in it) returning sound to the receiver. The best way to relate to this is like driving your car on a foggy night. The sea bed and surface can absorb or reflect sound energy, depending on their composition (e.g. sea state). It's worth noting that this will bugger up your sonar image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another overlooked source of noise is in the signal processing itself. Your sensor is not going to be perfect and will quite happily distort both the amplitude and phase of the phenomena its trying to measure. In acoustics, you'll find microphones and hydrophones will be &quot;tuned&quot; for a certain bandwidth, and are quite useless outside of this frequency range. Typically your analogue to digit convertor will have some form of quantisation error with the values its spits out. It simply doesn't have the infinite precision required to represent measurements of the real world. Before we move off the subject, we should be aware that any electronics experiences interference from its  environment (e.g. induction, radiation, poor design). Add all this together and you have an estimate of what's called your &quot;noise floor&quot; and as a designer, you want to both minimise this by design and use other techniques to boost the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once in the digital world, your sample values are pretty much safe from additional noise. But wait there's more. In acoustics you'll want to electrically steer your array and spatially filter the incoming signal (look in different directions). This is also known as beam forming. The basic principle of beam forming is that you apply delays to the signals you receive and then sum them all together. Using the awesome power of constructive and destructive  interference, incoherent signals cancel out, and coherent signals emphasised. This isn't perfect either because the degree of spatial attenuation varies depending on a number of factors (e.g. array length and element spacing). It's worth pointing out that this aspect of processing features quite a bit of arithmetic on data types that have limited precision. Usually it's not noticeable but its there, trust me.&lt;/p&gt;&#xA;" OwnerUserId="12066" LastActivityDate="2015-07-17T22:00:17.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24758" PostTypeId="2" ParentId="24756" CreationDate="2015-07-17T22:11:15.367" Score="0" Body="&lt;p&gt;Typically for spectral analysis, the magnitude is plotted of the fft output. Hence the absolute value of the fft output is taken in your example python code. The maths behind the fft expect the input to be complex but we usually input only real values, but this is OK. By outputting only the real, you're only looking at the energy estimate in the cosine waves that comprising your signal whilst ignoring the sines. The magnitude is the square root, of the sum, of the  squares (of both real and imaginary parts).&lt;/p&gt;&#xA;" OwnerUserId="12066" LastActivityDate="2015-07-17T22:11:15.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24759" PostTypeId="2" ParentId="24746" CreationDate="2015-07-17T22:51:55.480" Score="2" Body="&lt;p&gt;The LTE standard requires different FFT sizes for different bandwidths:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ltemaster.blogspot.com/2009/12/1536-fft-implementation-in-lte.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ltemaster.blogspot.com/2009/12/1536-fft-implementation-in-lte.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And all the parameters have to fit together, as shown in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://tuxbyte.blogspot.com/2015/07/sampling-and-fft-size-derivation-in-lte.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://tuxbyte.blogspot.com/2015/07/sampling-and-fft-size-derivation-in-lte.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;LTE parameters have been chosen such that FFT lengths and sampling rates are easily obtained for all operation modes while at the same time ensuring the easy implementation of dual-mode devices with a common clock reference.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the above link, the 15 MHz bandwidth has 901 subcarriers and 635 guard subcarriers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see this post:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1608/whats-the-baseband-fft-size-of-lte&quot;&gt;what&amp;#39;s the baseband FFT size of LTE?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14819" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-07-17T22:51:55.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24760" PostTypeId="1" CreationDate="2015-07-17T22:58:59.950" Score="0" ViewCount="163" Body="&lt;p&gt;I am doing a project where I have to use the fourier domain for convolution. I have been reading &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/013168728X&quot; rel=&quot;nofollow&quot;&gt;Digital Image processing by Rafael Gonzalez&lt;/a&gt; but I unsure about one thing, and I could not find anything in the book or online to answer my questions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book states, in order to preserve a filter's odd symmetry you would place the filter in the center of a padded array before doing the fourier transform. If for example a filter is of size 4x4, which has a center defined at (1,1) which does not exhibit any symmetry (or can't in this manner), and I have an image of size 31x31, so the Padded Array size would be 34x34 for the image and filter.  &lt;strong&gt;Do I still need to place the filter in the center of the padded array before doing the fourier transform to get the same results as convolving in the spatial domain?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to, &lt;strong&gt;do I need to place the image in the center of the padded array, or is the padding there just to get rid of any wrap around error?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16673" LastEditorUserId="16673" LastEditDate="2015-07-18T15:17:24.093" LastActivityDate="2015-07-18T15:17:24.093" Title="Filtering with filters without even or odd symmetry in the fourier domain" Tags="|filters|fourier-transform|frequency|convolution|symmetry|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24761" PostTypeId="1" CreationDate="2015-07-18T01:41:00.590" Score="0" ViewCount="51" Body="&lt;p&gt;I have two video where two person having conversation. They begin recording different times. I want to match these two videos' frame numbers, i.e. By matching audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do that?&lt;/p&gt;&#xA;" OwnerUserId="16675" LastActivityDate="2015-09-24T23:56:45.623" Title="Matching two video conversations" Tags="|audio|speech-recognition|speech|video-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24762" PostTypeId="2" ParentId="19625" CreationDate="2015-07-18T16:40:52.653" Score="2" Body="&lt;p&gt;I would like to suggest a variation on the procedure given by Matt L.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think a better approach is to use a large number of frequency samples (&gt; 1024) no matter the number of taps needed. This prevents the loss of so much frequency domain information when only a few taps are required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency samples describe a linear phase filter, then the desired taps will be located in the center bins of the Inverse FFT output. Simply truncate the output to the desired length and apply an appropriate time domain window, such as a Kaiser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one works through a simple example of a windowed filter, this use of over sampling gives the same results, to several decimal places, as the commonly used sinc pulse formula. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://www.iowahills.com/FIRFiltersByFreqSampling.html&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; describes this method of frequency over sampling in some detail. In particular, it shows how to set the frequency domain phase for the various filter types (even or odd tap count, low pass, band pass, etc).&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2015-07-18T16:40:52.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24763" PostTypeId="2" ParentId="24217" CreationDate="2015-07-18T17:58:36.353" Score="1" Body="&lt;p&gt;In theory, &lt;code&gt;M[0]&lt;/code&gt; doesn't exist. Your discrete derivative is only defined on &lt;code&gt;[1,127]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a practical solution, you can define &lt;code&gt;M[0]&lt;/code&gt; as a null element of your signal. For example if you expect values between &lt;code&gt;-1&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;, take &lt;code&gt;M[0] = 0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of real-time, there is two options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Either you save the last value of your buffer so you can take &lt;code&gt;M[0] = last&lt;/code&gt; for the next ones, and initialize &lt;code&gt;last&lt;/code&gt; as &lt;code&gt;0&lt;/code&gt;, or whatever seems coherent with your expected signal;&lt;/li&gt;&#xA;&lt;li&gt;Either you start computing the derivative at &lt;code&gt;M[1]&lt;/code&gt; and your processing will have a latency of 1 sample. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="16680" LastActivityDate="2015-07-18T17:58:36.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24766" PostTypeId="1" CreationDate="2015-07-18T20:49:08.313" Score="1" ViewCount="132" Body="&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/STFT_and_WT.jpg/500px-STFT_and_WT.jpg&quot; alt=&quot;STFT and Wavelet&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelet transform gives good time resolution for high-frequency events and good frequency resolution for low-frequency events. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;=&gt; I want to have complete opposite of wavelet transform, where I get good time resolution for low frequency events? Is there any known transform or specific window to get it?&lt;/p&gt;&#xA;" OwnerUserId="11303" LastActivityDate="2015-08-21T08:02:50.783" Title="Opposite of wavelet transform?" Tags="|fourier-transform|wavelet|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24767" PostTypeId="2" ParentId="15756" CreationDate="2015-07-18T23:49:55.937" Score="0" Body="&lt;p&gt;There is an error :&#xA;correct your source by converting &lt;code&gt;int8&lt;/code&gt; to &lt;code&gt;double&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mLocalSumFilter = ones(filterWinSize, filterWinSize);&#xA;vGradXFilter = [-0.5, 0, 0.5];&#xA;vGradYFilter = [-0.5; 0; 0.5];&#xA;mInputImageGradX = imfilter(mInputImage, vGradXFilter, 'replicate', 'same', 'corr');&#xA;mInputImageGradY = imfilter(mInputImage, vGradYFilter, 'replicate', 'same', 'corr');&#xA;&#xA;mInputImageGradX1=im2double(mInputImageGradX);&#xA;mInputImageGradY1=im2double(mInputImageGradY);&#xA;mInputImageGradNorm = sqrt((mInputImageGradX1 .^ 2.0) + (mInputImageGradY1 .^ 2.0));&#xA;mInputImageGradNorm = imfilter(mInputImageGradNorm, mLocalSumFilter, 0, 'same', 'corr') ;&#xA;imshow(mInputImageGradNorm);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16684" LastEditorUserId="7092" LastEditDate="2015-07-19T04:10:20.530" LastActivityDate="2015-07-19T04:10:20.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24769" PostTypeId="1" AcceptedAnswerId="24770" CreationDate="2015-07-19T05:21:07.763" Score="0" ViewCount="596" Body="&lt;p&gt;I understand the definition of a random process $X(t)$ being ergodic in mean (first-order ergodic) is that the expectation of the sample mean $&amp;lt;u_X&amp;gt;_T=\frac{1}{T} \int_{\frac{-T}{2}}^{\frac{T}{2}} X_w(t)dt $ should converge to the ensemble mean as $T \rightarrow \infty$. Can we define ergodic in mean property for processes which do not have constant mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the property of being ergodic in ACF, second-order ergodic, requires WSS assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is motivated by the fact that the requirement of WSS is not given in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Ergodic_process&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt; article describing ergodic process but used in the example illustrating the same. &lt;/p&gt;&#xA;" OwnerUserId="16685" LastActivityDate="2015-07-19T08:36:49.047" Title="Is ergodic in mean a property defined only for WSS stochastic processes?" Tags="|ergodic|stochastic|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24770" PostTypeId="2" ParentId="24769" CreationDate="2015-07-19T08:36:49.047" Score="1" Body="&lt;p&gt;Time average is defined over a time interval, T which will always result in a constant value. Keeping this constraint in mind, ensemble mean is always forced to be constant for satisfying the condition of ergodicity.&lt;/p&gt;&#xA;" OwnerUserId="16677" LastActivityDate="2015-07-19T08:36:49.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24772" PostTypeId="1" CreationDate="2015-07-19T10:46:04.267" Score="1" ViewCount="534" Body="&lt;p&gt;I'm trying to do frequency-band specific dynamic range compression (like multi-band compression) and was thinking of whether dynamic range compression is doable in the frequency domain or whether it's done in the &quot;typical&quot; filtering, gain reduction and then mixing (recombining filtered and GR'ed signals) way using time-domain signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what are the benefits/drawbacks over time-domain?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="29" LastEditDate="2016-01-30T03:37:44.533" LastActivityDate="2016-01-30T03:37:44.533" Title="Dynamic range compression in the frequency domain?" Tags="|fft|audio|dynamic-range-compression|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24773" PostTypeId="5" CreationDate="2015-07-19T15:41:50.327" Score="0" Body="&lt;p&gt;Speech processing is the study of speech signals and the processing methods of these signals. The signals are usually processed in a digital representation, so speech processing can be regarded as a special case of digital signal processing, applied to speech signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speech signal is one form of audio signal. The others are tone, music and noises. A method in signal processing usually tested with music, speech and mixture of both to test the developed algorithm.&lt;/p&gt;&#xA;" OwnerUserId="11684" LastEditorUserId="11684" LastEditDate="2015-07-20T01:27:09.273" LastActivityDate="2015-07-20T01:27:09.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24774" PostTypeId="4" CreationDate="2015-07-19T15:41:50.327" Score="0" Body="Speech processing is the study of speech signals and the processing methods of these signals." OwnerUserId="11684" LastEditorUserId="11684" LastEditDate="2015-07-20T07:47:27.710" LastActivityDate="2015-07-20T07:47:27.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24775" PostTypeId="5" CreationDate="2015-07-19T16:07:53.023" Score="0" Body="&lt;p&gt;Source separation is the study of separating signal(s) from mixed sources. The goal is to estimate the desired signal and remove other unwanted signals. Source separation methods in digital signal processing are commonly classified as blind and unblind source separation (including semi-blind). In blind source separation, no prior information used to recover target signal. In unblind and semiblind, some prior information is used to estimate target signal such as number of source, mixing matrix and others. The nature of source separation is the ability of human auditory processing to focus on on target signal while ignore other noises in cocktail party phenomena. There are some application of source separation like speech recognition, auralization, noise suppression and signal enhancement and voice assistant.&lt;/p&gt;&#xA;" OwnerUserId="11684" LastEditorUserId="11684" LastEditDate="2015-07-19T22:40:16.230" LastActivityDate="2015-07-19T22:40:16.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24776" PostTypeId="4" CreationDate="2015-07-19T16:07:53.023" Score="0" Body="Source separation is the study of separating signal(s) from mixed sources. " OwnerUserId="11684" LastEditorUserId="11684" LastEditDate="2015-07-20T07:47:34.500" LastActivityDate="2015-07-20T07:47:34.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24780" PostTypeId="1" AcceptedAnswerId="24815" CreationDate="2015-07-19T18:49:46.040" Score="22" ViewCount="78279" Body="&lt;p&gt;What's the difference between these? Both are measurements of some form of signal power, but surely there's some difference between the power they are measuring?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-07-22T10:13:35.067" LastActivityDate="2015-11-21T11:51:22.520" Title="Power spectral density vs. FFT bin magnitude" Tags="|fft|power-spectral-density|magnitude|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24781" PostTypeId="1" AcceptedAnswerId="24784" CreationDate="2015-07-19T19:27:32.310" Score="2" ViewCount="679" Body="&lt;p&gt;Is there any general knowledge regarding the costs of computation time (computation complexity) of filters? Like what types are &quot;generally&quot; less/more costly than others.&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-07-20T07:34:55.970" LastActivityDate="2015-09-18T09:15:34.130" Title="Computation Costs of Filters" Tags="|filters|real-time|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24782" PostTypeId="1" CreationDate="2015-07-19T19:47:07.873" Score="2" ViewCount="3248" Body="&lt;p&gt;I'm wondering how I would go about filtering out a regular sine-wave signal with a constant frequency and voltage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really new to the whole DSP-area but imagine I would have a regular sinewave at a specific frequency (let's say 30Hz), and on top of that signal I have a bunch of other small peaks (which are the ones I would want to sample and read). What method would I choose?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a visualization of what I meant:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hrQD4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Excuse my terrible Paint-skills but how would I filter out that sinewave, and &lt;em&gt;just&lt;/em&gt; keep the small spikes in voltage? What might be worth sharing is that the time between the spikes does have an impact on my measurement of the spikes, or to rephrase: The amount of spikes within x-units of time does have an impact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any guidance to the right direction would really be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15372" LastActivityDate="2015-10-20T13:20:43.313" Title="Filtering out a specific frequency in an analog signal" Tags="|filtering|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24783" PostTypeId="1" AcceptedAnswerId="25925" CreationDate="2015-07-19T20:44:06.333" Score="3" ViewCount="175" Body="&lt;p&gt;I am sure this question must be fairly easy and could have been answered on this site but perhaps I am not finding the right keywords to search for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know what are the common techniques to estimate an image filter from a set of input (unfiltered) and post-filtered images. From a machine learning point of view, this seems easy to do under some assumptions and constraints. Assuming the filters are linear, we might have to estimate the parameters of a convolution kernel using an optimization algorithm such as gradient descent. A similar approach may be done for non-linear kernels assuming a suitable non-linear model. However, I have still not found lots of literature discussing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, my questions are the following: How I can perform this operation in practice, how it is typically referenced in the image processing literature, and where can I find more information about it?&lt;/p&gt;&#xA;" OwnerUserId="16689" LastEditorUserId="128" LastEditDate="2019-07-17T13:25:11.003" LastActivityDate="2019-07-17T13:25:11.003" Title="Estimating an Image Filter from Examples" Tags="|image-processing|filters|digital-filters|blind-deconvolution|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="24784" PostTypeId="2" ParentId="24781" CreationDate="2015-07-20T02:23:23.670" Score="3" Body="&lt;p&gt;it's in textbooks.  you'll find that, for a sharp filter of given sharpness, that IIR filters will cost less than FIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;given it's IIR, you'll find that the Direct Form I and Direct Form II will have less computational cost than the State-Variable Filter, Lattice, Normalized Ladder, Gold-Rader, or Zölzer, or Harris-Brooking forms (and there are a zillion other forms, i s'pose, but i can't see them being cheaper to implement than the Direct Forms).  and then you can implement many forms (like DF1, DF2, or Lattice) as one-big direct filter section or as a cascade of second-order sections.  but there are numerical tradeoffs doing it the cheap (from a computation time POV) way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;given it's FIR, there are at least 3 different ways of implementing an FIR, all with different cost issues.  if the FIR filter is totally general (but still causal), then the choice is between the simple direct method (the &quot;transversal&quot; FIR form) and what we like to call &lt;strong&gt;Fast Convolution&lt;/strong&gt; (implementing a long FIR using the FFT).  for some FIRs of a greatly restricted class (that is FIRs that look like IIRs), there is a method that is called &lt;strong&gt;Truncated IIR&lt;/strong&gt; (TIIR) that is about as cheap as an IIR, but it's mathematically FIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;good question, no short answer that is also comprehensive.  need to get O&amp;amp;S and read it.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-07-20T02:23:23.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24786" PostTypeId="1" AcceptedAnswerId="24792" CreationDate="2015-07-20T07:11:37.130" Score="0" ViewCount="1631" Body="&lt;p&gt;GPS satellites send 50 BPS of info apart from 1 MBPS PRN. What is the basis for choosing 50 BPS. Why can it not be 100 or 1500? The reason I am asking this is Almanac download time is 12.5 mins which is quite long.&lt;/p&gt;&#xA;" OwnerUserId="16691" LastActivityDate="2015-07-20T13:29:10.027" Title="Slow Data rate of GPS data" Tags="|position|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24788" PostTypeId="1" CreationDate="2015-07-20T09:41:36.603" Score="-1" ViewCount="1768" Body="&lt;p&gt;I have a data signal (column vector) with N values taken over at specific sample rate (dx) at a fixed frequency. After taking the Fourrier transform of this signal and representing it in the Fourier Domain (with fftshift), I need to eliminate the parts situated in the origin and in the positive side. The final signal I need is the one with the negative shift. Therefore, after filtering the unwanted parts I will need to perform an inverse Fourier transform to recover the signal in time domain and center it in the origin. &#xA;Finally, I do not understand how to filter the spectrum when there is no frequency variation and when I’ve tried specifying a sample frequency and then applying a matlab filter I didn’t get any results. Can anyone help me to understand how to make this work please? &#xA;PS: the spectrum is in the figure below &#xA; &lt;img src=&quot;https://i.stack.imgur.com/GRX7B.png&quot; alt=&quot;spectrum&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16693" LastActivityDate="2022-04-17T03:03:00.340" Title="MATLAB : How to filter a data signal" Tags="|matlab|fft|frequency-spectrum|window-functions|filtering|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24790" PostTypeId="2" ParentId="24782" CreationDate="2015-07-20T11:34:59.807" Score="-1" Body="&lt;p&gt;You can sample the raw signal and then use a bandstop filter to filter out the 30 Hz frequency component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/examples/introduction-to-the-filter-design-and-analysis-tool-fdatool.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/signal/examples/introduction-to-the-filter-design-and-analysis-tool-fdatool.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fdatool is a MATLAB tool simply to use&lt;/p&gt;&#xA;" OwnerUserId="15181" LastActivityDate="2015-07-20T11:34:59.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24791" PostTypeId="2" ParentId="24783" CreationDate="2015-07-20T12:18:54.397" Score="0" Body="&lt;p&gt;This question is not easy at all, and I believe that you posed it in a very understandable way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first place, please take a look at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Deconvolution&quot; rel=&quot;nofollow&quot;&gt;deconvolution&lt;/a&gt; literature. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In certain special cases, where you know that your filter is some sort of a blur kernel, you might also consider estimating &lt;a href=&quot;https://en.wikipedia.org/wiki/Point_spread_function&quot; rel=&quot;nofollow&quot;&gt;point spread functions&lt;/a&gt; (PSF), which would make your life easier. One way to estimate the PSF is &lt;a href=&quot;https://en.wikipedia.org/wiki/Richardson%E2%80%93Lucy_deconvolution&quot; rel=&quot;nofollow&quot;&gt;Richardson–Lucy deconvolution&lt;/a&gt;, which is an intuitive iterative procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Photoshop's motion de-blur filters are for example based on PSFs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entropy minimization methods are also common approaches to this problem. There is a MATLAB example &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/29151-minimum-entropy-deconvolution--med-1d-and-2d-&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that these give you certain guidelines and keywords to further investigate the topic.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-07-20T12:18:54.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24792" PostTypeId="2" ParentId="24786" CreationDate="2015-07-20T13:29:10.027" Score="2" Body="&lt;p&gt;The low data rate comes from the need to transmit the data reliably over a noisy channel with a low power transmitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A GPS receiver has to be capable of picking out a signal under conditions that other radio systems would just call &quot;total loss of signal.&quot;&lt;br&gt;&#xA;In a typical two-way radio (analog police radio and the like) the signal is usually unusable if the received signal strength gets below -120dBm.  Digital signals usually get lost long before you get down that low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GPS receivers work in ranges where a good signal is -155dBW.  In order to fish the data out of the noise, they use a faster signal (1023 million &quot;chips&quot; per second for the civilian codes) that is then modulated with the actual data.  You modulate the data on the chip signal, and modulate that onto the transmit frequency.  You use correlation on the chip signal to recover it, and demodulate the data from that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The end result works like a very narrow band filter that only lets through data at a low rate, but very clearly.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The chip modulation scheme also has the advantage that you can transmit a bunch of them on a single carrier frequency, but be able to separate them cleanly on the receive side.  This is known as Code Domain Multiple Access (CDMA) and is the reason that the US GPS system only needs a single transmit/receive frequency despite having some 30 satellites.  Glonass uses 15 carrier frequencies (each used twice) to cover the globe with 30 satellites.  It makes the transmitters and the receivers just that bit more complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest reading the &lt;a href=&quot;https://en.wikipedia.org/wiki/Global_Positioning_System&quot; rel=&quot;nofollow&quot;&gt;Wikipedia GPS article.&lt;/a&gt;  It includes a lot of details I've glossed over in trying to keep this short.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-07-20T13:29:10.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24793" PostTypeId="1" AcceptedAnswerId="24797" CreationDate="2015-07-20T14:14:07.377" Score="4" ViewCount="2134" Body="&lt;p&gt;Everyone knows that JPEG2000 can obtain much better compression result than JPEG. The fundamental transform behind JPEG2000 is wavelet while the basic transform in JPEG is DCT. So my question is why wavelet is more suitable for image compression compared to DCT. Thanks. &lt;/p&gt;&#xA;" OwnerUserId="1674" LastEditorUserId="128" LastEditDate="2018-08-26T06:22:23.583" LastActivityDate="2018-08-26T06:23:35.307" Title="Why Wavelet based Transform Is More Suitable for Image Compression Compared to DCT?" Tags="|wavelet|image-processing|dct|image-compression|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24797" PostTypeId="2" ParentId="24793" CreationDate="2015-07-20T15:40:56.340" Score="3" Body="&lt;p&gt;Both JPEG and JPEG 2000 use the change of basis compression type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely, we transform the data into a different representation assuming in this representation the number of parameters needed to describe to data is lower.&lt;br&gt;&#xA;Or to the least, most of the information is gathered within few parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you look at the energy level of the DCT coefficients of real world images you'd see most of the energy is limited to the very few coefficients.&lt;br&gt;&#xA;This is what JPG does, keeps only the few dominant coefficients and throws the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How efficient is DCT?&lt;br&gt;&#xA;It depends on how less coefficients are needed to describe the image in an acceptable quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that for Wavelets the situation is better.&lt;br&gt;&#xA;Namely on real world images less coefficients are needed to describe the image with the same perceived quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This property is called the ability to decorrelate the data / being energy densed, etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end, it is all up to how much less parameters are needed to describe the same data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.&lt;br&gt;&#xA;Using &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular-value_decomposition&quot; rel=&quot;noreferrer&quot;&gt;SVD&lt;/a&gt; / &lt;a href=&quot;https://en.wikipedia.org/wiki/Karhunen%E2%80%93Lo%C3%A8ve_theorem&quot; rel=&quot;noreferrer&quot;&gt;KLT&lt;/a&gt; (They are equivalent in this sense) would be even more efficient in the sense of how much less coefficients are needed for the same quality (In the $ {\ell}_{2} $ sense).&lt;br&gt;&#xA;The problem is those bases are adaptive to the data and hence if you use them you have to include them to be able to decompress the data.&lt;br&gt;&#xA;What's so nice, you can ask which, in general, approximate the SVD better?&lt;br&gt;&#xA;It turns out that Wavelets are better doing so.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-08-26T06:23:35.307" LastActivityDate="2018-08-26T06:23:35.307" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24798" PostTypeId="2" ParentId="24788" CreationDate="2015-07-20T16:22:53.233" Score="-4" Body="&lt;p&gt;In general, removing the energy at DC and all the positive frequencies is equivalent to subtracting the mean and dividing by two.  The FFT will always be two-sided and symmetrical.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-07-20T16:22:53.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24799" PostTypeId="1" CreationDate="2015-07-20T17:56:52.887" Score="10" ViewCount="4095" Body="&lt;p&gt;I want to monitor (automatic-)gearbox failures on some vehicles. For each vehicle I have a captured signal representing the selected gear at each one millisecond. An example of two signals are shown on the figure bellow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to compute extract some features from each signal (and represent it as a feature vector) in order to compare a specific signal to other signals (compute its distance to other signals) and see if it is deviating from most of the other signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea on how to represent this type of signals as feature vectors ? Which kind of features can we extract from those ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8875C.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="16697" LastEditorUserId="128" LastEditDate="2023-07-03T19:15:10.067" LastActivityDate="2023-07-03T19:15:10.067" Title="What Kind of Features Can I Extract from a Signal" Tags="|machine-learning|classification|local-features|empirical-mode-decomposition|fractal-dimension|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="24800" PostTypeId="2" ParentId="24799" CreationDate="2015-07-20T18:43:11.633" Score="12" Body="&lt;p&gt;Some Features:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mean.&lt;/li&gt;&#xA;&lt;li&gt;Variance.&lt;/li&gt;&#xA;&lt;li&gt;Skewness.&lt;/li&gt;&#xA;&lt;li&gt;Kurtosis.&lt;/li&gt;&#xA;&lt;li&gt;Dominant 3 frequencies in the DFT.&lt;/li&gt;&#xA;&lt;li&gt;Energy of the 3 dominant frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Max Value.&lt;/li&gt;&#xA;&lt;li&gt;Min Value.&lt;/li&gt;&#xA;&lt;li&gt;Median (Percentile).&lt;/li&gt;&#xA;&lt;li&gt;Total Variation.&lt;/li&gt;&#xA;&lt;li&gt;Pitch and Pitch Confidence (Audio).&lt;/li&gt;&#xA;&lt;li&gt;Spectral Centroid and Spectral Spread.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Usually I'd compute them in running windows.&lt;br /&gt;&#xA;Another great information is the Histogram of the Derivative.&lt;br /&gt;&#xA;Or just all the above of the Derivative.&lt;/p&gt;&#xA;&lt;p&gt;Modern methods might include ideas like in MiniRocket.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark&lt;/strong&gt;: In the above &lt;em&gt;derivative&lt;/em&gt; means first order difference.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2023-07-03T19:13:37.673" LastActivityDate="2023-07-03T19:13:37.673" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="24801" PostTypeId="2" ParentId="24799" CreationDate="2015-07-20T19:12:24.013" Score="2" Body="&lt;p&gt;Well, this is a known problem, so many works exists on that such as &lt;a href=&quot;http://or.nsfc.gov.cn/bitstream/00001903-5/80355/1/1000008844744.pdf&quot; rel=&quot;nofollow&quot;&gt;Hilbert Huang transform&lt;/a&gt;. However, I guess, if you feed these signals (and various shifted versions) directly into a neural network, you should be able to create such a classifier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess standard MLP would also work in novelty detection mode, but you would be better of with a &lt;a href=&quot;https://en.wikipedia.org/wiki/Deep_learning&quot; rel=&quot;nofollow&quot;&gt;deep network&lt;/a&gt;. Don't forget that at the end, this is a binary classification.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-07-20T19:12:24.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24803" PostTypeId="2" ParentId="24788" CreationDate="2015-07-20T20:28:53.470" Score="0" Body="&lt;p&gt;This task its not so hard, you only should create a vector, using ones, of the same size and set to zero the positions that correspond with the frequencies that you don't want. Apply an element-element multiplication between the vector and your signal. Finally apply the inverse Fourier transform in the obtained vector. The response you will obtain will be a complex one, so you need to graphic only real or imaginary part if you want to appreciate it in a graphical way, you also can graphic the absolute of the signal in order to observe the magnitude of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This type of filter is known as ideal filter and is impossible to apply in real world. In Fourier domain, filter is just a multiplication while in space domain to filter is necessary to apply a convolution between the signal and a kernel.&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-07-20T20:28:53.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24804" PostTypeId="2" ParentId="24780" CreationDate="2015-07-20T23:27:36.207" Score="6" Body="&lt;p&gt;The FFT is the Fast Fourier Transform.  It is a special case of a Discrete Fourier Transform (DFT), where the spectrum is sampled at a number of points equal to a power of 2.  This allows the matrix algebra to be sped up. The FFT samples the signal energy at discrete frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Power Spectral Density (PSD) comes into play when dealing with stochastic signals, or signals that are generated by a common underlying process, but may be different each time the signal is measured.  Given just one &quot;realization&quot; of a stochastic process--a stochastic signal--you can only estimate what the underlying Power Spectral Density is.  You can make this estimate poorly with the Periodogram, which involves squaring the FFT (amplitude squared yields power).  The periodogram suffers from very high variance and is not a good estimator.  You are better off using Welch's method of periodogram averaging, or better yet, the Blackman-Tukey method of periodogram smoothing.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-07-20T23:27:36.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24806" PostTypeId="1" CreationDate="2015-07-21T02:44:05.103" Score="0" ViewCount="522" Body="&lt;p&gt;This &lt;a href=&quot;http://www.pentek.com/tutorials/15_4/digdown.cfm&quot; rel=&quot;nofollow&quot;&gt;article&lt;/a&gt; mentions that the DFT/FFT can be used as a channeliser in a similar way to a filterbank. I get how the DFT filters into spectral bins, but its output is in the frequency domain, i.e. Fourier coefficients, nolonger in the time domain, so either I'm missing something or they've neglected to mention that DFT filterbank output would need to be transformed back to the time domain to function like an actual filterbank. Can someone shed light on this?&lt;/p&gt;&#xA;" OwnerUserId="10620" LastActivityDate="2015-07-24T02:58:30.350" Title="Using FFT as a channeliser" Tags="|fft|dft|filter-bank|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24807" PostTypeId="2" ParentId="24738" CreationDate="2015-07-21T03:26:33.657" Score="2" Body="&lt;p&gt;If the output $x[\cdot]$ of a discrete-time linear system is related to the input via&#xA;$$x[n] = \sum_{i=0}^m h[i]u[n-i] \tag{1}$$&#xA;where $u[\cdot]$ is a &lt;em&gt;periodic&lt;/em&gt; sequence with period $N \gg m$, then $x[\cdot]$ is also a sequence with period $N$ and&#xA;the&#xA;periodic &lt;em&gt;cross-correlation&lt;/em&gt; function $R_{x,u}[\cdot]$ between $x[\cdot]$&#xA;and $u[\cdot]$ is the periodic &lt;em&gt;convolution&lt;/em&gt; between the sequence $h[\cdot]$&#xA;and the periodic &lt;em&gt;autocorrelation&lt;/em&gt; function $R_{u,u}[\cdot]$. That is,&#xA;$$R_{x,u} = x \star u = (h * u) \star u = h * (u \star u) = h* R_{u,u}&#xA;\tag{2}$$&#xA;  If&#xA;$u[\cdot]$ is a binary pseudonoise (PN) a.k.a. pseudorandom noise (PRN) sequence that takes on values $\pm 1$, then &#xA;$$R_{u,u}[n] = \begin{cases}N, &amp;amp; n \equiv 0 \bmod N,\\&#xA;-1, &amp;amp;\text{otherwise}\end{cases}\tag{3}$$&#xA;which is essentially a periodic digital impulse function,&#xA; and by ignoring that $-1$ as inconsequential compared to $N$, we get from $(2)$ that&#xA;$$N h[n] = R_{x,u} \implies h[n] = N^{-1} R_{x,u}[n].\tag{4}$$&#xA;If we include additive white Gaussian noise $w[n]$ &#xA;of variance $\sigma^2$ on the right side of $(1)$,&#xA;then $(2)$ becomes &#xA;$$R_{x+w,u} = (x + w)\star u = (h * u + w) \star u = h * (u \star u) &#xA;+ w \star u= h* R_{u,u} + \hat{w}&#xA;\tag{5}$$&#xA;where $\hat{w} \sim \mathcal N(0, N\sigma^2)$. Thus, the measured&#xA;&lt;em&gt;cross-correlation&lt;/em&gt; function is now a Gaussian random variable&#xA;with mean $Nh[n]$ and variance $N\sigma^2$.  The &lt;em&gt;estimator&lt;/em&gt; for&#xA;$h[n]$ is thus just $N^{-1}$ times the measured value of the&#xA;cross-correlation function, and its variance is thus&#xA;$\displaystyle \frac{\sigma^2}{N}$, This matches up perfectly with&#xA;Kay's result&#xA;$$\operatorname{var}(\hat{h}[n]) = \frac{\sigma_{w}^2}{Nr_{u,u}[0]}$$&#xA;since we have assumed that $u[n] \in \{+1, -1\}$ and hence&#xA;$r_{u,u}[0] = 1$: all the $u[n]$, regarded as random instead of&#xA;pseudorandom, have variance $1$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-07-21T03:26:33.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24808" PostTypeId="2" ParentId="24806" CreationDate="2015-07-21T04:13:32.727" Score="1" Body="&lt;p&gt;First, I suggest you take a look at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Short-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;STFT&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let say you use $N$-point FFT, then you filterbank has $N/2$ filters (assuming real signal). Usually, you divide your signal into $K$ segments, each $N$ samples long (could be overlapping) and apply the FFT to each segment. Every time you apply the FFT you get a single sample for each filter. Therefore your filterbank has $N/2$ filters with $K$ samples.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-07-21T04:13:32.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24811" PostTypeId="1" AcceptedAnswerId="24812" CreationDate="2015-07-21T10:41:37.513" Score="0" ViewCount="1383" Body="&lt;p&gt;In noise reduction, having read that directivity index is used to reduce diffuse noise and white noise gain reduces spatially white noise, I would like to know the difference between both the noise types. Is it that diffuse noise is identically distributed but not white? Hope some one could help :)&lt;/p&gt;&#xA;" OwnerUserId="16708" LastEditorUserId="16708" LastEditDate="2015-07-21T11:55:44.477" LastActivityDate="2015-07-21T12:57:25.317" Title="How does spatially white noise differ from diffuse noise" Tags="|audio|noise|denoising|background-subtraction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24812" PostTypeId="2" ParentId="24811" CreationDate="2015-07-21T12:57:25.317" Score="1" Body="&lt;p&gt;In a diffuse noise field the noise energy flows in all directions with equal probability. This does not mean that the noise at one point is uncorrelated with the noise measured at another point. On the other hand, for spatially white noise, also called incoherent noise, the noise signals at two different points in space are always uncorrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example for a diffuse noise field is noise in a car or in an office. An example for spatially white noise would be amplifier noise in a microphone array, where the noise in each channel is independent of the noise in other channels.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-21T12:57:25.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24814" PostTypeId="1" CreationDate="2015-07-21T14:55:33.757" Score="3" ViewCount="10065" Body="&lt;p&gt;I'm looking for an open-source tool/code or some guidance to extract the motion vectors (MVs) of a H.264 encoded bit sequence. I'm already aware that motion vectors can be visualized using ffmpeg with the following command:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I want to produce a log file where the MVs of P and B frames are listed frame by frame. I checked out the structure of MVs from &lt;em&gt;libavutil/motion_vector.h&lt;/em&gt;, but I couldn't find an example which shows how they are extracted and laid over the original sequence by ffplay. I thought that if I can find that out, I could possibly re-arrange the code to extract the MVs to a text file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any example codes or hints.  &lt;/p&gt;&#xA;" OwnerUserId="8751" LastActivityDate="2018-09-11T04:09:06.340" Title="Extracting motion vectors from H.264 bitstream" Tags="|video-compression|motion-detection|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24815" PostTypeId="2" ParentId="24780" CreationDate="2015-07-21T15:32:09.023" Score="26" Body="&lt;p&gt;The fast Fourier transform ($\textrm{FFT}$) algorithms are fast algorithms for computing the discrete Fourier transform ($\textrm{DFT}$). This is achieved by successive decomposition of the $N$-point $\textrm{DFT}$ into smaller-block $\textrm{DFT}$, and taking advantage of periodicity and symmetry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the $N$-point $\textrm{DFT}$ of a sequence $\{x[0], x[1],\cdots, x[N-1]\}$ is: &#xA;\begin{equation}&#xA;X(f_k) = \displaystyle \sum_{n = 0}^{N - 1} x[n]\exp\left(-j2\pi f_kn\right) \tag{1}&#xA;\end{equation}&#xA;For $f_k = k/N$ and $k = 0, 1, \cdots, N - 1$. And the $\textrm{FFT}$ magnitude at bin $k$ &lt;strong&gt;is&lt;/strong&gt; the $\textrm{DFT}$magnitude at bin $k$. For a given $N$ that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\left|X(f_k)\right| = \left|X\left(\frac{k}{N}\right)\right| = \left|X(k)\right| = \displaystyle \left|\sum_{n = 0}^{N - 1} x[n]\exp\left(-j2\pi nk/N\right)\right| \tag{2}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You talk about power spectral &lt;strong&gt;estimation&lt;/strong&gt; when the signals being analyzed are characterized as random processes. With random fluctuations in such signals, statistical characteristics and average characteristics are normally adopted. For a wide sense stationary $(\textrm{WSS})$ discrete random process, the PSD is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;P(f) = \displaystyle \sum_{m = -\infty}^{\infty} r_{xx}[m]\exp\left(-j2\pi fm\right) \tag{3}&#xA;\end{equation}    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reasons you can find in &lt;a href=&quot;https://dsp.stackexchange.com/questions/4691/what-is-the-difference-between-psd-and-squared-magnitude-of-frequency-spectrum?lq=1&quot;&gt;this answer&lt;/a&gt;, you see that the squared magnitude of the signal's $\textrm{DFT}$ is taken as the &lt;em&gt;estimate&lt;/em&gt; of the PSD in most practical situations. One form, among other variations/methods, is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;P(f_k) = \frac{1}{N} \displaystyle \left| \sum_{n = 0}^{N - 1} x[n]\exp\left(-j2\pi f_kn\right) \right|^2 \tag{4} &#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What's the difference between these? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Comparing $(2)$ and $(4)$, you have: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;P(f_k) = \frac{1}{N} \left| X(f_k)\right|^2&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the bin number $k$ to frequency in $\textrm{Hz}$, $F = \frac{F_s}{N}k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more reading on PSD estimation check &lt;a href=&quot;https://dsp.stackexchange.com/questions/17788/is-the-periodogram-squared-magnitude-dft-or-squared-average-dft?rq=1&quot;&gt;this question&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/2711/is-autospectrum-the-same-as-power-spectrum-density?lq=1&quot;&gt;that question&lt;/a&gt;, and &lt;a href=&quot;https://dsp.stackexchange.com/questions/10148/power-spectral-density-vs-energy-spectral-density?rq=1&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The power spectral density, $\textrm{PSD}$, describes how the power of your signal is distributed over frequency whilst the $\textrm{DFT}$ shows the spectral content of your signal, the amplitude and phase of harmonics in your signal. You pick one or the other depending on what you want to observe/analyze. And no they're not the same as you can see from the equations above and links given. Their spectra are &lt;em&gt;generally&lt;/em&gt; not the same. One is &lt;strong&gt;estimated&lt;/strong&gt; as the squared magnitude of the other.&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-07-24T10:49:56.810" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24816" PostTypeId="2" ParentId="24268" CreationDate="2015-07-21T15:43:40.100" Score="6" Body="&lt;p&gt;Have you ever wondered why people and many animals have two eyes? By using two eyes we can have a perception of depth. The principle is very simple, while you are looking the screen keep your head fix and close one of your eyes, try to watch all the things behind your screen, now open your closed eye and close the other one and try to watch the same things, can you see the difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each eye send information to our brain. This information is almost the same, if you could have two pictures of your both eyes and you try to overlap this pictures you will see that there are big displacements in the nearest objects to your eyes while the displacements in the objects that are far away will be very small. These observed displacements are translated to the depth of the objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now other experiment that could help you to understand this concept is this: Try to keep your view fix close your eyes for a while, now open only one eye but try to don't move your view, try to touch the things around you, but remember keep your view fix, is it simple?. Now with one of your eyes closed, move your head and try to do the same, is it easier?. By moving your head, you are giving information to your brain of how far are the objects because in the nearest objects the observable displacements will be bigger. Of course you should consider that the eyes have also other kind of cells that help us to perceive depth. But in a simple stereo pair of cameras the information that we could recuperate is only the distance of the same point in each image, &lt;a href=&quot;https://stackoverflow.com/questions/7337323/definition-of-a-disparity-map&quot;&gt;the disparity map&lt;/a&gt;, and there are a lot of ways to recuperate it, optical flow is very common. This kind of information is normally used to know the 3D space and the segmentation is applied comparing the the distance between the cameras and the objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While by using only a camera you can compare only the intensities changes and try to detect the main changes by using a lot of metrics. Is very common to use this kind of systems in tracking of objects by keeping the camera fix and trying to omit the things that aren't moving in the scene.&lt;/p&gt;&#xA;" OwnerUserId="16620" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-07-21T15:43:40.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24819" PostTypeId="1" AcceptedAnswerId="24826" CreationDate="2015-07-21T21:09:27.127" Score="7" ViewCount="5218" Body="&lt;p&gt;First the question(s):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How should I write unit tests for a digital filter (band-pass/band-stop) in software? What should I be testing? Is there any sort of &lt;em&gt;canonical test suite&lt;/em&gt; for filtering?&lt;/p&gt;&#xA;&lt;p&gt;How to select test inputs, generate expected outputs, and define &amp;quot;conformance&amp;quot; in a way that I can say the actual output &lt;em&gt;conforms&lt;/em&gt; to expected output?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Now the context:&lt;/p&gt;&#xA;&lt;p&gt;The application I am developing (electromyographic signal acquisition and analysis) needs to use digital filtering, mostly band-pass and band-stop filtering (C#/.Net in Visual Studio).&lt;/p&gt;&#xA;&lt;p&gt;The previous version of our application has these filters implemented with some legacy code we could use, but we are not sure how mathematically correct it is, since we don't have unit-tests for them.&lt;/p&gt;&#xA;&lt;p&gt;Besides that we are also evaluating &lt;a href=&quot;http://filtering.mathdotnet.com/&quot; rel=&quot;noreferrer&quot;&gt;Mathnet.Filtering&lt;/a&gt;, but their unit test suite doesn't include subclasses of &lt;code&gt;OnlineFilter&lt;/code&gt; yet.&lt;/p&gt;&#xA;&lt;p&gt;We are not sure how to evaluate one filtering library over the other, and the closest we got is to filter some sine waves to eyeball the differences between them. That is not a good approach regarding unit tests either, which is something we would like to automate (instead of running scripts and evaluating the results elsewhere, even visually).&lt;/p&gt;&#xA;&lt;p&gt;I imagine a good test suite should test something like?&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Linearity and Time-Invariance: how should I write an automated test (with a boolean, &amp;quot;pass or fail&amp;quot; assertion) for that?&lt;/li&gt;&#xA;&lt;li&gt;Impulse response: feeding an impulse response to the filter, taking its output, and checking if it &amp;quot;conforms to expected&amp;quot;, and in that case:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How would I define &lt;em&gt;expected&lt;/em&gt; response?&lt;/li&gt;&#xA;&lt;li&gt;How would I define &lt;em&gt;conformance&lt;/em&gt;?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Amplitude response of sinusoidal input;&lt;/li&gt;&#xA;&lt;li&gt;Amplitude response of step / constant-offset input;&lt;/li&gt;&#xA;&lt;li&gt;Frequency Response (including Half-Power, Cut-off, Slope, etc.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I could not be considered an expert in programming or DSP (far from it!) and that's exactly why I am cautious about filters that &amp;quot;seem&amp;quot; to work well. It has been common for us to have clients questioning our filtering algorithms (because they need to publish research where data was captured with our systems), and I would like to have &lt;em&gt;formal proof&lt;/em&gt; that the filters are working as expected.&lt;/p&gt;&#xA;" OwnerUserId="1558" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-07-22T09:36:43.423" Title="How to test digital filters?" Tags="|filters|filter-design|bandpass|software-implementation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24820" PostTypeId="2" ParentId="2284" CreationDate="2015-07-21T21:15:54.253" Score="3" Body="&lt;p&gt;Mixing audio with a carrier is exactly the same as mixing an incoming signal with a local oscillator to get an intermediate frequency.  In both cases you result with the original frequencies, the sum of the frequencies, and the difference between the two frequencies.  Whenever you mix frequencies, this results.  When two people sing together, harmonics result.  If the difference between their notes is in the audible range, you will hear it.  I have heard quartets sing, and a deep bass note emerge that wasn't sung or played.&lt;/p&gt;&#xA;" OwnerUserId="16717" LastActivityDate="2015-07-21T21:15:54.253" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24823" PostTypeId="2" ParentId="24799" CreationDate="2015-07-22T07:42:58.233" Score="3" Body="&lt;p&gt;Hello I will be brief and I hope you understand, due to the shape of your signal I think it is best treated with wavelet transform base HAAR, the reason for using this transform is that it will give a representation in time and frequency where you can get the relevant information of the signal, now an important parameter is that you use the base HAAR (there are other bases as for example the Mexican hat) because your signal has rectangular shapes so the expancion be very compact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you also need to classify Might signals using MLP or RBF.&lt;/p&gt;&#xA;" OwnerUserId="16285" LastActivityDate="2015-07-22T07:42:58.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24824" PostTypeId="2" ParentId="24766" CreationDate="2015-07-22T07:58:59.887" Score="-2" Body="&lt;p&gt;wavelet transform also serves to you what you want to do, all you have to do is to first apply a low-pass your signal so as to keep the frequency range you want to scan only, another approach is to transform Gabor where you have to define the size and shape of the analysis window, but I would recommend better  using wavelet transform applying a lowpass filter your signal first.&lt;/p&gt;&#xA;" OwnerUserId="16285" LastActivityDate="2015-07-22T07:58:59.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24826" PostTypeId="2" ParentId="24819" CreationDate="2015-07-22T09:36:43.423" Score="4" Body="&lt;p&gt;Some thoughts on it at least.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, if you can shown linearity and time-invariance and you know that the filter has the correct impulse response you are home. Given that the filter is stable. So in this case there is no need to run different other input signals and the frequency response is given based on the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Checking impulse response is obviously quite simple. Linearity and time-invariance I guess is actually really complicated (any specific input signal you test may just work out of coincidence, but others may not). However, as the filter code in most cases shouldn't be that complicated, it should be possible to eye-ball the code and see that it does what is expected (no non-linear operators, no if-cases based on signal values etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remains stability. For IIR filters this is a really complicated issue and I will not go into that discussion. For FIR filters, they will always be stable (unless they are implemented using some recursive algorithm). However, you may run into numerical issues relating to overflow (most likely not underflow) and round-off noise. You can find formal proofs that an FIR filter will not overflow (maximum output is the sum of the absolute values of the impulse response coefficients times the maximum input magnitude). For round-off errors you can find statistical expressions, but they are not of much use in formally proving anything (but rather as an argument that the expected output with &quot;infinite precision&quot; and the actual output still conforms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also not that all impulse responses etc should be evaluated using the actual (possibly rounded) coefficients not the (possibly higher precision) ones obtained from the filter design tool. This is because the filter will always realize the transfer function given by the coefficients that it use, no matter how they were derived. This may still not be the impulse response you get at the output though, as there may be round-off issues. An easy way to see that is to use a scaled impulse (i.e. not one) and note that typically not only the magnitude of the frequency-response will change, but also the shape. The filter will still implement the same transfer function, but the round-off noise added to the two different input signals are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this gives you a bit more insight.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2015-07-22T09:36:43.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24831" PostTypeId="1" AcceptedAnswerId="24832" CreationDate="2015-07-22T17:16:42.813" Score="0" ViewCount="155" Body="&lt;p&gt;Can filter &quot;depth&quot; be adjusted by mixing dry and wet signals? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e. can I simulate e.g. a +6dB bandshelf/peak filter at 1kHz by mixing in some of the dry unequalized signal and some of a wet signal that has been bandpass filtered at 1kHz and the filter has around the same shape as the bandshelf/peak. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can it be theoretically the same?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2021-11-27T22:59:01.157" Title="Can filter &quot;depth&quot; be adjusted by mixing dry and wet signals?" Tags="|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24832" PostTypeId="2" ParentId="24831" CreationDate="2015-07-22T18:09:19.553" Score="2" Body="&lt;p&gt;adding the input to the output of a scaled 2nd-order bandpass IIR &lt;strong&gt;will&lt;/strong&gt; get you the classic peak/cut EQ curve.&lt;/p&gt;&#xA;&lt;p&gt;adding the input to the output of a scaled 1st-order LPF or HPF &lt;strong&gt;will&lt;/strong&gt; get you a 1st-order low-shelf or high-shelf EQ.&lt;/p&gt;&#xA;&lt;p&gt;adding the input to the output of a scaled 2nd-order LPF or HPF will get you a &lt;em&gt;particular&lt;/em&gt; form of a 2nd-order low or high shelving EQ, but there are many others.  doing it this way will often leave an unintended null or lump in the frequency response.  if you want a symmetric (in log frequency) and perfectly monotonic gain vs. frequency curve, i might suggest referring to the &lt;a href=&quot;https://www.w3.org/TR/audio-eq-cookbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audio EQ Cookbook&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2021-11-27T22:59:01.157" LastActivityDate="2021-11-27T22:59:01.157" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24833" PostTypeId="2" ParentId="24831" CreationDate="2015-07-22T18:22:23.207" Score="0" Body="&lt;p&gt;The problem is that if the phase delays between the dry and wet path at every frequency in both passbands don't match, you can get partial cancellations or notches in the frequency response curve that you wouldn't get with a unified filter design.  So, to do this mix without that distortion, you might want a linear phase wet filter matched with an identical delay in the dry path before the mixer.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-07-22T18:22:23.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24834" PostTypeId="2" ParentId="24806" CreationDate="2015-07-22T18:33:46.093" Score="0" Body="&lt;p&gt;An FFT of an appropriate length can be used as a channelizer if the system doesn't need the actual time domain signals within each channel from the filter bank, but rather just a measure or estimate over a given time period of the magnitude and/or phase of the signal within each channel.  Often (but not always) this is all that is needed for certain multi-channel detection and/or demodulation purposes.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-07-22T18:33:46.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24835" PostTypeId="2" ParentId="24799" CreationDate="2015-07-22T19:55:13.977" Score="5" Body="&lt;p&gt;In addition to the features mentioned so far I would like to mention measures of complexity such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Entropy_%28information_theory%29&quot; rel=&quot;noreferrer&quot;&gt;Shannon Entropy&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://mateoaboy.com/f5/page16/files/Aboy.06.pdf&quot; rel=&quot;noreferrer&quot;&gt;LZ Complexity&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fractal_dimension&quot; rel=&quot;noreferrer&quot;&gt;Fractal Dimension&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are also &lt;a href=&quot;https://homepages.cae.wisc.edu/~ece533/project/f06/karrels_ppt.pdf&quot; rel=&quot;noreferrer&quot;&gt;Fourier Descriptors&lt;/a&gt; (as hinted by Drazick already) and their equivalent in Wavelet Analysis and of course simple &lt;a href=&quot;https://en.wikipedia.org/wiki/Histogram&quot; rel=&quot;noreferrer&quot;&gt;histogram&lt;/a&gt; bins which would return how frequently each gear is engaged en route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But also, that you will sooner or later need to put these features and the results of analysis involving them in some context relevant to the real world. This will give some sort of meaning to these quantities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a mean value would provide information about the gears mostly used in the &quot;average&quot; route the vehicle was running on while data capture was taking place (e.g. mostly lower gears, or mostly higher gears). Variance could provide a measure of the range of gears used en route. A simpler measure of gear change could be the amount of different states the gear box seems to be going through, per unit of time. For example 3.5 gear changes per minute. You can use these to cluster the data into frequent and less frequent gear changers and investigate the question of whether or not frequent gear changes have an impact on gearbox failure, if gearbox failure is mostly associated with lower gears (i.e higher load) and other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just blindly calculating features off of the waveforms and using them to bundle cases together is not going to be enough, sooner or later you are going to have to ask yourself &quot;What does this mean in the real world?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-07-22T19:55:13.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24836" PostTypeId="1" AcceptedAnswerId="24837" CreationDate="2015-07-23T06:20:55.620" Score="1" ViewCount="806" Body="&lt;p&gt;I have been using the Canny edge detection function in OpenCV to detect the edge of an elliptic annulus (light object, dark background). In theory there should be two edges. However, it sometimes does not all edges on the outer ring. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j1six.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j1six.png&quot; alt=&quot;Canny edges&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I radially plot my detected points it looks like this (x: angle, y: radius from center of mass)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xs1ns.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xs1ns.png&quot; alt=&quot;Rad v. angle&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a wavy line which is the outer border of my object and a few outliers which are the inner border (you can tell because they look like they are systematically offset). I don't know the exact breadth of the annulus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q: Is there any way to programmatically get rid of these &quot;obvious&quot; outliers so that the exact outer contour is interpolated? &lt;/p&gt;&#xA;" OwnerUserId="16734" LastActivityDate="2015-07-23T07:38:33.507" Title="Getting rid of Canny outliers" Tags="|canny-edge-detector|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24837" PostTypeId="2" ParentId="24836" CreationDate="2015-07-23T07:38:33.507" Score="0" Body="&lt;p&gt;Please see my answer to this question: &lt;a href=&quot;https://dsp.stackexchange.com/questions/16786/detecting-and-isolating-part-of-an-image/&quot;&gt;Detecting and isolating part of an image&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use circular shortest path to do this quite elegantly. You are using OpenCV and and not MATLAB so some modification of my code is required.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-07-23T07:38:33.507" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24838" PostTypeId="1" AcceptedAnswerId="24841" CreationDate="2015-07-23T09:31:30.467" Score="4" ViewCount="1525" Body="&lt;p&gt;I would like to create complex normal Gaussian noise with dimensions $(M,N)$. The noise should be zero mean and the variance should be equal to one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do so?&lt;/p&gt;&#xA;" OwnerUserId="16738" LastEditorUserId="1629" LastEditDate="2016-12-08T11:08:12.500" LastActivityDate="2016-12-08T11:08:12.500" Title="Complex normal Gaussian noise" Tags="|noise|gaussian|random|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24841" PostTypeId="2" ParentId="24838" CreationDate="2015-07-23T10:25:24.433" Score="5" Body="&lt;p&gt;You should use the the standard formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = randn(m, n) + 1i*randn(m, n);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And as pointed out by MBaz, the output should be scaled accordingly by $\frac{1}{\sqrt{2}}$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = s/sqrt(2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More on that topic you can find for example in a book &lt;a href=&quot;http://www.amazon.co.uk/Digital-Media-Processing-Hazarathaiah-Malepati/dp/1856176789/ref=sr_1_1?ie=UTF8&amp;amp;qid=1437659551&amp;amp;sr=8-1&amp;amp;keywords=Digital+Media+Processing%3A+DSP+Algorithms+Using+C&quot; rel=&quot;noreferrer&quot;&gt;Digital Media Processing by Hazarathaiah Malepati&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sKbAf.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sKbAf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should generate exactly what you want.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-07-23T13:54:12.700" LastActivityDate="2015-07-23T13:54:12.700" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24842" PostTypeId="2" ParentId="10564" CreationDate="2015-07-23T11:43:49.923" Score="1" Body="&lt;p&gt;You should use &quot;objectness&quot; measures or object proposals. There are many works on that such as &lt;a href=&quot;https://pdollar.wordpress.com/2013/12/22/generating-object-proposals/&quot; rel=&quot;nofollow&quot;&gt;[1]&lt;/a&gt; and &lt;a href=&quot;https://github.com/batra-mlp-lab/object-proposals&quot; rel=&quot;nofollow&quot;&gt;[2]&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-07-23T11:43:49.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24843" PostTypeId="2" ParentId="24295" CreationDate="2015-07-23T11:48:01.853" Score="0" Body="&lt;p&gt;I ended up using the &lt;a href=&quot;http://in.mathworks.com/help/images/ref/radon.html&quot; rel=&quot;nofollow&quot;&gt;radon transform&lt;/a&gt; in 8 canonical directions. I then normalized the resulting distribution and computed its entropy. The numbers seem to correlate with level of texture in the image.&lt;/p&gt;&#xA;" OwnerUserId="4515" LastActivityDate="2015-07-23T11:48:01.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24844" PostTypeId="2" ParentId="24295" CreationDate="2015-07-23T11:54:18.773" Score="1" Body="&lt;p&gt;One of the most obvious that comes to mind is MPEG-7's Edge Histogram Descriptor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this, you divide the image into blocks and consider the edge pixels across different angles forming the complete local histogram. This is organized the same way as a Gabor transform features at angular orientation at different angles. This is fairly a very good indicator to classify and search pictures with similarity in their structures and hence edges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this reference &lt;a href=&quot;http://www.ee.columbia.edu/~sfchang/course/svia-F03/papers/MPEG-7colortexture.pdf&quot; rel=&quot;nofollow&quot;&gt;2&lt;/a&gt; which is a great introduction to MPEG 7 color and texture. See Reference &lt;a href=&quot;http://www.dcc.fc.up.pt/~mcoimbra/lectures/VC_1415/VC_1415_P8_LEH.pdf&quot; rel=&quot;nofollow&quot;&gt;3&lt;/a&gt; for a more detailed coverage for the Local Edge descriptors. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.cs.ucy.ac.cy/~nicolast/courses/cs422/ReadingProjects/MPEG-7visual.pdf&quot; rel=&quot;nofollow&quot;&gt;Thomas Sikora, &lt;strong&gt;The MPEG-7 Visual Standard for Content&#xA;Description—An Overview&lt;/strong&gt; &lt;em&gt;IEEE TRANSACTIONS ON CIRCUITS AND SYSTEMS FOR VIDEO TECHNOLOGY, VOL. 11, NO. 6, JUNE 2001&lt;/em&gt;&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.ee.columbia.edu/~sfchang/course/svia-F03/papers/MPEG-7colortexture.pdf&quot; rel=&quot;nofollow&quot;&gt;B. S. Manjunath, Jens-Rainer Ohm, Vinod V. Vasudevan, and&#xA;Akio Yamada &lt;strong&gt;Color and Texture Descriptors&lt;/strong&gt; &lt;em&gt;IEEE TRANSACTIONS ON CIRCUITS AND SYSTEMS FOR VIDEO TECHNOLOGY, VOL. 11, NO. 6, JUNE 2001&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.dcc.fc.up.pt/~mcoimbra/lectures/VC_1415/VC_1415_P8_LEH.pdf&quot; rel=&quot;nofollow&quot;&gt;Dong Kwon Park, Yoon Seok Jeon, Chee Sun Won &lt;strong&gt;Efficient Use of Local Edge Histogram Descriptor&lt;/strong&gt; &lt;em&gt;Proceeding MULTIMEDIA '00 Proceedings of the 2000 ACM workshops on Multimedia Pages 51-54&lt;/em&gt;&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="440" LastActivityDate="2015-07-23T11:54:18.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24845" PostTypeId="1" AcceptedAnswerId="24859" CreationDate="2015-07-23T12:38:18.380" Score="0" ViewCount="887" Body="&lt;p&gt;anybody knows what this is?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mat mat = (Mat_&amp;lt;double&amp;gt;(3, 4) &amp;lt;&amp;lt; 0, 0, width, width, 0, height, height, 0, 1, 1, 1, 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I dont know what mat would be in this case.. furthermore i got no idea how to fix this error for the above declaration:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error: Mat and int are incompatible&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that Mat_ will call&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;template&amp;lt;typename _Tp&amp;gt; inline Mat_&amp;lt;_Tp&amp;gt;::Mat_(int _rows, int _cols)&#xA;    : Mat(_rows, _cols, DataType&amp;lt;_Tp&amp;gt;::type) {}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i do not understand the purpose of this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt; 0, 0, width, width, 0, height, height, 0, 1, 1, 1, 1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Kindly Tape&lt;/p&gt;&#xA;" OwnerUserId="7916" LastActivityDate="2015-07-24T03:47:12.320" Title="Mat and int are incompatible?" Tags="|opencv|matrix|" AnswerCount="1" CommentCount="2" ClosedDate="2015-07-26T21:24:38.330" ContentLicense="CC BY-SA 3.0" />
  <row Id="24846" PostTypeId="1" AcceptedAnswerId="24959" CreationDate="2015-07-23T15:55:55.347" Score="2" ViewCount="373" Body="&lt;p&gt;I'm using python 2.7 to compare tonal differences in guitar stings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found that in matplotlib, there are some great built-in features such as&#xA;&lt;a href=&quot;http://matplotlib.org/api/mlab_api.html#matplotlib.mlab.magnitude_spectrum&quot; rel=&quot;nofollow noreferrer&quot;&gt;matplotlib.mlab.magnitude_spectrum&lt;/a&gt;&#xA;and&#xA;&lt;a href=&quot;http://matplotlib.org/api/mlab_api.html#matplotlib.mlab.psd&quot; rel=&quot;nofollow noreferrer&quot;&gt;matplotlib.mlab.psd&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitude_spectrum function seems to be the no brainer, as it is the FFT of the signal, showing each specific harmonic. However, when comparing various guitar strings, it's tricky to pinpoint each peak to compare. The PSD function gives very nice smooth graphs, which is perfect for obvious visual comparisons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that PSD's are useful for random signals but not necessarily known signals. Is this true? And is there any reason I shouldn't be using the PSD for guitar string comparisons?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what the PSD and magnitude_spectrum graphs look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that these are plucks of the same string and not different strings. I'm trying to make sure that my plucks are consistent prior to comparing various strings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rU4Gn.png&quot; alt=&quot;PSD&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/9l17k.png&quot; alt=&quot;Magnitude Spectrum&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11852" LastActivityDate="2015-08-10T09:52:28.370" Title="Is it appropriate to use PSD on the analysis of a plucked guitar string?" Tags="|fft|python|music|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24847" PostTypeId="1" AcceptedAnswerId="24932" CreationDate="2015-07-23T17:14:42.457" Score="3" ViewCount="1279" Body="&lt;p&gt;I am trying to implement an extended Kalman filter (EKF) in MATLAB for the estimation of joint trajectories (angular position, angular velocity and angular acceleration) from noisy motion capture measurements using a constant angular jerk process model. This is my process model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_{prior}^k = \begin{bmatrix} 1 &amp;amp; \Delta t &amp;amp; \frac{\Delta t^2}{2} &amp;amp; \frac{\Delta t^3}{6} \\ 0 &amp;amp; 1 &amp;amp; \Delta t &amp;amp; \frac{\Delta t^2}{2} \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \Delta t \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix} \cdot x_{postiror}^{k-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and process noise covariance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Q = 2 \cdot \sigma_p^2 \cdot \begin{bmatrix} \frac{\Delta t^7}{252} &amp;amp; \frac{\Delta t^6}{72} &amp;amp; \frac{\Delta t^5}{30} &amp;amp; \frac{\Delta t^4}{24} \\&#xA;\frac{\Delta t^6}{72} &amp;amp; \frac{\Delta t^5}{20} &amp;amp; \frac{\Delta t^4}{8} &amp;amp; \frac{\Delta t^3}{6} \\&#xA;\frac{\Delta t^5}{30} &amp;amp; \frac{\Delta t^4}{8} &amp;amp; \frac{\Delta t^3}{3} &amp;amp; \frac{\Delta t^2}{2} \\&#xA;\frac{\Delta t^4}{24} &amp;amp; \frac{\Delta t^3}{6} &amp;amp; \frac{\Delta t^2}{2} &amp;amp; \Delta t \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My estimates for the angular positions look ok, but my estiamtes for the derivatives are quite wrong. Here is a graph from a simple example application with a comparisson between the angular velocity estimated by my implementation (EKF) and a quite noisy central difference (CD).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZmPAq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZmPAq.png&quot; alt=&quot;Difference between filter estimate (EKF) and central difference estimate (CD) of the first derivative.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Somehow, I cannot improve the estimation of the derivatives by tuning the covariances, initial values or (almost) anything else. So I think there must be something wrong with my implementation. But I cannot find anything, maybe I suffer from tunnel vision...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I adopted the EKF equations from the paper by Yu et al. &lt;a href=&quot;http://users.ece.cmu.edu/~byronyu/papers/derive_eks.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Apply extended Kalman filter equations &#xA;for k = 1:T&#xA;&#xA;% Apply time update&#xA;if k == 1&#xA;&#xA;    % Equation (15) in [Yu2004]&#xA;    X_prior(k, :) = f(x0);&#xA;    A = dfdx(x0);&#xA;    W = dfdw(x0);&#xA;&#xA;    % Equation (12) in [Yu2004]&#xA;    P_prior(:, :, k) = A * P0 * A' + W * Q * W';&#xA;&#xA;else&#xA;&#xA;    % Equation (15) in [Yu2004]&#xA;    X_prior(k, :) = f(X_posterior((k - 1), :)');&#xA;    A = dfdx(X_posterior((k - 1), :)');&#xA;    W = dfdw(X_posterior((k - 1), :)');&#xA;&#xA;    % Equation (12) in [Yu2004]&#xA;    P_prior(:, :, k) = A * P_prior(:, :, (k - 1)) * A' + W * Q * W';&#xA;&#xA;end&#xA;&#xA;% Apply measurement update&#xA;H = dhdx(X_prior(k, :)');&#xA;V = dhdv(X_prior(k, :)');&#xA;&#xA;% Equation (11) in [Yu2004] using the pseudo inverse to handle&#xA;% badly scaled matrices &#xA;K = P_prior(:, :, k) * H' / (V * R * V' + H * P_prior(:, :, k) * H');&#xA;&#xA;% Equation (14) in [Yu2004]&#xA;X_posterior(k, :) = X_prior(k, :) + (K * (Z(k, :)' - h(X_prior(k, :)')))';&#xA;&#xA;% Equation (10) in [Yu2004]&#xA;P_posterior(:, :, k) = P_prior(:, :, k) - K * H * P_prior(:, :, k);&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There seems to be one difference in the computation of the prior error covariance compared to the equations given in the paper by Welch and Bishop &lt;a href=&quot;http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yu et al.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{prior}^k = A \cdot P_{prior}^{k - 1} \cdot A^T + W \cdot Q \cdot W^T$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Welch and Bishop:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_{prior}^k = A \cdot P_{posterior}^{k - 1} \cdot A^T + W \cdot Q \cdot W^T$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation by Yu et al. produces the wrong derivatives and the equation by Welch and Bishop seems to result in instable estimations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I compiled a simple example application with my implementation &lt;a href=&quot;https://www.dropbox.com/s/ehdgtwnay6f248b/EKF.zip?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;4&lt;/a&gt;. It should work out of the box, if you run &quot;TestKalmanFilter.m&quot; in MATLAB and you should see the given graph and a small animation of a double pendulum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated.&#xA;Janis&lt;/p&gt;&#xA;" OwnerUserId="16742" LastEditorUserId="16742" LastEditDate="2015-07-27T13:03:19.263" LastActivityDate="2016-09-22T17:17:09.530" Title="Wrong estimation of derivatives with an extended Kalman filter" Tags="|kalman-filters|derivative|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24851" PostTypeId="1" AcceptedAnswerId="25396" CreationDate="2015-07-23T21:35:14.170" Score="0" ViewCount="299" Body="&lt;p&gt;I have an EEG signal. It is amplitude verses time. I want to find out how certain frequencies in that signal vary with time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way I think I can do this is to do a short-time-Fourier-transform on it (that is, split it in small pieces and do a Fourier transform on each piece), then track the frequency I am interested in across the slices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a different/standard way of doing this? I only ask because Its going to be a lot of processing overhead doing it my way and I'm doing this in python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cleerline&lt;/p&gt;&#xA;" OwnerUserId="16746" LastEditorUserId="8202" LastEditDate="2015-07-24T09:53:33.913" LastActivityDate="2015-08-23T20:55:06.947" Title="How to find a certain frequency in a signal that varies in time?" Tags="|fourier-transform|time-frequency|time-series|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24852" PostTypeId="1" AcceptedAnswerId="24855" CreationDate="2015-07-23T21:43:23.230" Score="0" ViewCount="917" Body="&lt;p&gt;This question refers to the example 5.2-1 of the book &quot;Digital Communications, 5th Edition by John Proakis, Masoud Salehi&quot; (example 6.2-1 in the 4th edition of the book) which asks for the estimate carrier phase $\phi$ that maximizes the log-likelihood function and equivalently the likelihood function.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The received signal is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r(t)=A\cos(2\pi f_ct+\phi)+n(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A$ is the amplitude of the transmitted signal (known), $f_c$ is the carrier frequency (known) and $n(t) $ is the AWGN noise added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log-likelihood function is given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Lambda_L(\phi)=\frac{2A}{N_0}\int_{T_0}r(t)\cos(2\pi f_ct+\phi)dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\frac{N_0}{2}$ is the power spectral density of AWGN (known constant for all frequencies)&#xA;In order to get the maximum value of this we require:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{d\Lambda_L(\phi)}{d\phi}=0 \\&#xA;\Rightarrow \int_{T_0}r(t)\sin(2\pi f_ct+\hat{\phi}_{ML})dt=0 \\&#xA;\Rightarrow \hat{\phi}_{ML}=-\tan^{-1}\Bigg[\frac{\int_{T_0}r(t)\sin(2\pi f_ct)dt}{\int_{T_0}r(t)\cos(2\pi f_ct)dt}\Bigg]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything OK until the last line. I don't understand how this equation is solved.&lt;/p&gt;&#xA;" OwnerUserId="7001" LastEditorUserId="1629" LastEditDate="2016-02-14T01:53:20.433" LastActivityDate="2016-02-14T01:58:58.380" Title="Maximum Likelihood carrier phase estimation of $A\cos(2\pi f_ct)$" Tags="|noise|phase|modulation|power-spectral-density|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24853" PostTypeId="1" CreationDate="2015-07-23T23:01:46.157" Score="1" ViewCount="196" Body="&lt;p&gt;I have a sampled pulse shape: &#xA;$ h = [1, 0.5]$ and I do not know what is its real underlying continuous-time pulse. I want to compute the samples of $h(t-\Delta t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I write the continuous pulse with $\text{sinc}$ basis functions, I have:&#xA;$$ h(t) = \text{sinc}(t) + 0.5\times \text{sinc}(t-1)$$&#xA;Therefore, here, I can compute the new samples (samples of the time-shifted continuous pulse shape) with $\text{sinc}$ interpolation i.e. convolving with a $\text{sinc}$:&#xA;$$h'_k = g_k(\Delta t)* h_k$$&#xA;where $g_k = \text{sinc}(kT+\Delta t)$ and $h_k = h(kT)$ where $T$ is the sampling period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the question is that If I write $h(t)$ in terms of another basis, e.g. a spline, how can I apply the shift then? convolving with the same but shifted spline?&lt;/p&gt;&#xA;" OwnerUserId="15404" LastActivityDate="2015-07-23T23:01:46.157" Title="How to shift with spline interpolation?" Tags="|discrete-signals|interpolation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24855" PostTypeId="2" ParentId="24852" CreationDate="2015-07-23T23:49:11.237" Score="1" Body="&lt;p&gt;for the last line&#xA;$$\sin(2 \pi  f_{c}t + \phi_{ML} ) =\sin(2 \pi  f_{c}t)\cos (\phi_{ML}) +\cos(2 \pi  f_{c}t)\sin(\phi_{ML})&#xA;$$&#xA;so the integral could be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA; \int_ {T_{0}} r(t)(\sin(2 \pi  f_{c}t)\cos (\phi_{ML}) +\cos(2 \pi  f_{c}t)\sin(\phi_{ML}))&amp;amp;= 0\\&#xA;\Rightarrow \cos(\phi_{ML})\int_ {T_{0}} r(t)\sin(2 \pi  f_{c}t) + \sin(\phi_{ML})\int_ {T_{0}} r(t) \cos(2 \pi  f_{c}t) &amp;amp;= 0&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore,&#xA;$$&#xA;\tan(\phi_{ML})= -\frac{\int_ {T_{0}} r(t)\sin(2 \pi  f_{c}t)}{\int_ {T_{0}} r(t) \cos(2 \pi  f_{c}t)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the result.&lt;/p&gt;&#xA;" OwnerUserId="15450" LastEditorUserId="1629" LastEditDate="2016-02-14T01:58:58.380" LastActivityDate="2016-02-14T01:58:58.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24858" PostTypeId="2" ParentId="24806" CreationDate="2015-07-24T02:58:30.350" Score="0" Body="&lt;p&gt;There is no extra transform to get back into the time domain.  Try not to get caught up in the time vs. frequency domain thought process. Use of the fft provides a resource efficient way to implement a bank of bandpass filters. You don't have to use an fft, but you'd require more multiply/add operations without it. The Fred Harris book &quot;Multirate Signal Processing&quot; does a pretty good job of explaining how one arrives at the FFT implementation.&lt;/p&gt;&#xA;" OwnerUserId="7899" LastActivityDate="2015-07-24T02:58:30.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24859" PostTypeId="2" ParentId="24845" CreationDate="2015-07-24T03:47:12.320" Score="1" Body="&lt;p&gt;Hi I do not understand it gives you that error, since my trouble compiling me, on the other hand the operator &quot;&amp;lt;&amp;lt;&quot; is useful to be able to initialize the array, thus &quot;0, 0, width, width&quot; correspond to the first row, &quot;0, height, height, 0&quot; correspond to the second row and &quot;1, 1, 1, 1&quot; correspond to the third row.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/R2Fn6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/R2Fn6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16285" LastActivityDate="2015-07-24T03:47:12.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24860" PostTypeId="1" AcceptedAnswerId="24867" CreationDate="2015-07-24T07:06:19.673" Score="0" ViewCount="868" Body="&lt;p&gt;I'm trying to synthesise a sine waveform and I'm noticing that if I perform the IFFT with the Sine aligned to a bin frequency the phase is zeroed, however if I tune the sine off of the bin frequency the phase is no longer zeroed even if I start the waveform at -90.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What gives?   how do I compensate for this.  I've tried to minus the delta (frequency - binFrequency) but this doesn't seem to work.   I accept it could be my calculation is incorrect but I'm hoping someone can explain how I zero phase this sine?&lt;/p&gt;&#xA;" OwnerUserId="16389" LastActivityDate="2015-07-24T17:34:55.570" Title="Zero phase in IFFT" Tags="|fft|ifft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24864" PostTypeId="2" ParentId="24851" CreationDate="2015-07-24T12:03:25.770" Score="0" Body="&lt;p&gt;If I understood it right, you intend to figure out how some frequency content of a given signal evolves in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next to short time Fast Fourier Transform, you have the opportunity to make use of a time-frequency analysis. I would suggest you to use either the Hilbert Transform (&lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Hilbert_transform&lt;/a&gt;) or the Teager-Kaiser energy operator (&lt;a href=&quot;http://folk.uio.no/eivindkv/ek-thesis-2003-05-12-final-2.pdf&quot; rel=&quot;nofollow&quot;&gt;http://folk.uio.no/eivindkv/ek-thesis-2003-05-12-final-2.pdf&lt;/a&gt;). Both methods are able to make estimation of istantaneous magnitude and frequency of a signal over time. I assume that your signal is multicomponent, therefore you should first isolate the frequency components you want to analyze by means e.g. of a filter-bank and then apply one of the two mentioned methods.&#xA;Otherwise, you could directly go for an Empirical Mode Decomposition (&lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert%E2%80%93Huang_transform&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Hilbert%E2%80%93Huang_transform&lt;/a&gt;). Such a method will decompose the signal in terms of frequency components: after that you can again apply Hilbert or Teager-Kaiser methods to check how your target-frequency develops over time.&lt;/p&gt;&#xA;" OwnerUserId="3666" LastActivityDate="2015-07-24T12:03:25.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24866" PostTypeId="2" ParentId="24860" CreationDate="2015-07-24T13:13:10.103" Score="0" Body="&lt;p&gt;Mathematically the FFT is a flavor of the Discrete Fourier Series (DFS) sometimes also called Discrete Time Fourier Transform (which is not a great name for it)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See:&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&lt;/a&gt;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_series&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Discrete_Fourier_series&lt;/a&gt;&#xA;&lt;a href=&quot;http://pages.jh.edu/~signals/discretefourier/&quot; rel=&quot;nofollow&quot;&gt;http://pages.jh.edu/~signals/discretefourier/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both domains (time &amp;amp; frequency) are discretized over a finite interval, N. A time vector of N=1024 points will give a frequency vector of 1024 frequencies. It you sample it in one domain, you automatically imply that it's periodic with N in the other domain. That's the way the math works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sine wave that aligns with an FFT bin has a period that is an integer fraction of N. If you periodically repeat this time vector, it stays a sign wave. You could say it has the &quot;same phase&quot; at the beginning and the end of the time vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sine wave that's not aligned, that's not the case. The phase is different at both ends and if you periodically repeat this you don't get a sine wave, but sine wave segments that are sliced together with a discontinuity every N samples. Such a signal contains multiple frequencies each with its own phase and it doesn't make sense to assign a single phase value to it. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-24T13:13:10.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24867" PostTypeId="2" ParentId="24860" CreationDate="2015-07-24T17:12:08.843" Score="0" Body="&lt;p&gt;The cosine and sine components, or the real and imaginary components of a complex DFT, can also be thought of as the even and odd decomposition of a waveform.  For a waveform to have pure sine components (no added phase due to a non-zero cosine components), the waveform must be purely odd, thus has to be anti-symmetric around the center of the DFT/FFT window.  And only a sine wave with a phase of zero or pi at the center of a window is a purely anti-symmetric sinusoid in that window for any frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to create your sine wave with a DFT phase of pi/2, you need to start your sine wave with a phase of zero or pi at the center (N/2) of your vector of N=1024, not zero or pi or pi/2 at the left end.  This guarantees that it is anti-symmetric for any frequency (not just DFT/FFT bin-center frequencies).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that pure sinusoids that are not exactly integer periodic in aperture will have a discontinuity between the left and right ends of the vector or DFT window (as well as have a non-zero magnitude in multiple DFT result bins).  That's why you can't start arbitrary frequency sinusoidal synthesis with a phase of zero or +-pi/2 at either end if you want a guaranteed DFT phase of +-pi/2.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-07-24T17:34:55.570" LastActivityDate="2015-07-24T17:34:55.570" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24870" PostTypeId="1" CreationDate="2015-07-24T19:47:09.533" Score="0" ViewCount="29" Body="&lt;p&gt;I have two signals, $x$ and $y$. I know that &#xA;$F(x)=F(s)+F(n)$ and $F(y)=F(n)$, where $s$ is the 'clean' signal, $n$ is the added noise and $F$ donate Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To obtain the clean signal, I am trying the following: $s=F^{-1}[F(x)-F(y)]$. Is there any better way that I should try?&lt;/p&gt;&#xA;" OwnerUserId="8825" LastActivityDate="2015-07-24T19:47:09.533" Title="If a signal is added to another in the freq. domain, how to filter it out?" Tags="|filtering|measurement|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24871" PostTypeId="1" AcceptedAnswerId="24875" CreationDate="2015-07-24T20:39:29.393" Score="1" ViewCount="233" Body="&lt;p&gt;I am trying to understand the math.  The inverse $\mathcal Z$-transform is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = \displaystyle\frac{1}{j2\pi} \int_cX(z)z^{n-1}dz$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\displaystyle \int_c$ is a contour integral. The inverse Fourier transform is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = \displaystyle\frac{1}{2\pi}\int_{-\pi}^\pi X(e^{j\omega})e^{j\omega n}d\omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My textbook claims, and I agree, that evaluating the inverse z-transform at $z=e^{j\omega}$ will result in the inverse Fourier transform.  However, I can't get the math to show this. Substituting $z=e^{j\omega}$, I get as far as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = \displaystyle \frac{1}{j2\pi}\int_cX(e^{j\omega})e^{j\omega n}e^{-j\omega}d(e^{j\omega})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody tell me intuitively how to simplify this equation to look like the inverse Fourier transform? Is my confusion due to a lack of understanding of the contour integral?&lt;/p&gt;&#xA;" OwnerUserId="16238" LastEditorUserId="1629" LastEditDate="2016-03-10T00:45:34.430" LastActivityDate="2016-03-10T00:45:34.430" Title="Evaluating the inverse $\mathcal Z$-transform on the unit circle" Tags="|fourier-transform|z-transform|integration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24872" PostTypeId="1" AcceptedAnswerId="24885" CreationDate="2015-07-24T20:41:55.870" Score="4" ViewCount="1099" Body="&lt;p&gt;If I take a two dimensional image and conduct a fourier transform on it, I would get a two dimensional matrix of complex values. &lt;strong&gt;If I want to find the amplitude of each value, is that the same as calculating the magnitude of each component, ie Mag(re,im) = sqrt(re^2+im^2)?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="16673" LastEditorUserId="128" LastEditDate="2019-11-16T06:14:23.683" LastActivityDate="2019-11-16T06:14:23.683" Title="Amplitude of an Image" Tags="|fft|image-processing|fourier|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24874" PostTypeId="1" AcceptedAnswerId="24879" CreationDate="2015-07-24T21:28:50.767" Score="7" ViewCount="7140" Body="&lt;p&gt;The context is communication where we have a front-end that samples a signal and a noise (but here we focus only on the noise). My goal is to determine the noise power that I should use to simulate (in Matlab) the discrete noise after the ADC.&lt;br&gt;&#xA;This post is related to &lt;a href=&quot;https://dsp.stackexchange.com/questions/13328&quot;&gt;this one&lt;/a&gt;, and I will refer to it. Below are figures to illustrate the discussion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider a (virtual) continuous white noise of PSD $N_0/2$ (see Fig. 1). It passes through an ideal filter of bandwidth $[-B; B]$. So, we obtain a band-limited white noise, of power $N_0 B$ (see Fig. 2, with $B$ = 10 kHz). Here, we are just before the ADC of the front-end. After that, the signal is sampled, and here is how I see the things :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal is sampled at a higher frequency than twice the bandwith (e.g. 30 kHz), the output is no more a white noise, since the PSD is not constant (see Fig. 3, in red is the duplicate of the spectrum around $±f_s$, so the actual spectrum is the grey curve plus the red curve).&lt;br&gt;&#xA;Dilip Sarwate illustrates this very clearly using the autocorrelation function of the output noise in &lt;a href=&quot;https://dsp.stackexchange.com/questions/13328&quot;&gt;this post&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal is sampled at a frequency equal to twice the bandwith (i.e. 20 kHz), the output is a white noise since the PSD is constant and equal to $N_0/2$ (see Fig. 4).&lt;br&gt;&#xA;However, this disagrees with the development of Dilip Sarwate still in &lt;a href=&quot;https://dsp.stackexchange.com/questions/13328&quot;&gt;this post&lt;/a&gt;, where with 20 kHz we are not anymore on a zero of the sinc and thus the output samples are correlated...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal is sampled at a frequency lower than the bandwith (e.g. 10 kHz), the output is also a white noise since the PSD is constant; but there is aliasing which increases the amount of noise and the PSD is now $N_0$ (Fig. 5). With lower sampling frequencies, the increase would be higher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, for me, if I want to simulate in Matlab the discrete noise after the ADC, I should consider $f_s = 2 B$ to assume the noise as AWGN, and the noise power should be $\sigma^2 = N_0 B = N_0 f_s / 2$, whatever the actual front-end bandwidth is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you tell me where my reasoning is wrong regarding the case of Fig. 4 ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PEDOj.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PEDOj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16758" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2017-06-22T14:34:48.537" Title="Sampling of band-limited white noise" Tags="|noise|sampling|aliasing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24875" PostTypeId="2" ParentId="24871" CreationDate="2015-07-24T22:30:24.667" Score="2" Body="&lt;p&gt;&lt;strong&gt;Hint&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $z = e^{j\omega}$, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align} &#xA;\displaystyle \frac{dz}{d\omega} &amp;amp;= je^{j\omega}\\&#xA;\Rightarrow dz &amp;amp;= je^{j\omega} d\omega&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $-\pi \leq \omega \leq \pi$, your contour integral goes from $-\pi$ to $\pi$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can somebody tell me intuitively how to simplify this equation to look&#xA;  like the inverse Fourier transform?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Plugging all the above should do the job.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is my confusion due to a lack of understanding of the contour&#xA;  integral?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is more the change of variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $\omega$ is taken in the fundamental interval $\left[-\pi, \pi\right]$ because $X(\omega)$ is periodic with period $2\pi$. So, $\displaystyle \int_c$ becomes $\displaystyle \int_{2\pi}$ &lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2015-07-24T23:03:44.703" LastActivityDate="2015-07-24T23:03:44.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24876" PostTypeId="1" AcceptedAnswerId="24884" CreationDate="2015-07-24T22:59:21.187" Score="5" ViewCount="330" Body="&lt;p&gt;I'm a newbie to Signal Processing - my apologies if this question is too obvious (I'm a financial trader trying to use DSP techniques). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a linear filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = (1-p) x[n]+p y[n-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can the write &lt;strong&gt;Transfer Function&lt;/strong&gt; as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = \frac{1-p}{1-pz^{-1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But instead, suppose I have a non-linear filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = y[n-1]+(1-p)\frac{1}{2}(x[n]e^{-2 y[n-1]}-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I write a &lt;strong&gt;Transfer Function&lt;/strong&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I simply replace $y[n-1]$ by $y[n]z^{-1}$ and rewrite I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H(z) = \frac{(1-p)\frac{1}{2}(x[n]e^{-2 z^{-1} y[n]}-1)}{1-z^{-1}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a function of $x[n]$ and $y[n]$ in addition to being a function of $z$?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can this be written merely as a function of $z$?&lt;/p&gt;&#xA;" OwnerUserId="16651" LastEditorUserId="128" LastEditDate="2019-11-16T06:13:54.683" LastActivityDate="2021-08-25T20:51:15.067" Title="Transform Function with Non Linearity" Tags="|transfer-function|z-transform|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="24877" PostTypeId="1" CreationDate="2015-07-25T02:49:43.263" Score="4" ViewCount="8680" Body="&lt;p&gt;I am currently attempting to demodulate an audio file using MATLAB. After taking the fft of the signal, I receive this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/g6unv.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/g6unv.jpg&quot; alt=&quot;FFT of the Signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some more coding, I found the following values: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Fs = 44100; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Window size = 441000 (by taking length(signal)) &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fc = 11416 &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My guess is that this signal is a SSB with a full carrier, and I have read that to recover the original signal from the IF SSB signal, the SSB must be frequency shifted down to its original range of baseband frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question here is: &lt;strong&gt;How could I shift the frequency spectrum of this signal to center at 0 Hz?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been reading up on the fft size/bins and its relationship to the sampling frequency. Will this value be needed? I have also tried using fftshift(), but to no avail. The goal here is to shift the frequencies to be centered at 0 Hz, use a filter to get rid of some of the frequencies, then use an ssb demod function to &lt;strong&gt;hopefully&lt;/strong&gt; get the correct sound from it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, I appreciate you taking the time to help another guy out.&lt;/p&gt;&#xA;" OwnerUserId="16760" LastActivityDate="2019-11-16T06:41:08.687" Title="Frequency Shifting in MATLAB" Tags="|matlab|frequency|demodulation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24878" PostTypeId="1" CreationDate="2015-07-25T05:04:43.137" Score="0" ViewCount="110" Body="&lt;p&gt;In my attempt to generate a standard sine wave out of a sound card, I started using matlab which has a function soundsc for scaling the output &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; t = 0:1/48000:10;&#xA; y = sin(1000*2*pi*t);&#xA; soundsc(y,48000,[a b]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It's ok when my a and b are -1 and 1 respectively. When I try to make them even -0.9 and 0.9 respectively, the standard sine wave of 1Khz gets distorted, why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are our sound cards not able to handle standard sounds?&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="13320" LastEditDate="2016-11-21T12:52:35.457" LastActivityDate="2016-11-21T12:52:35.457" Title="Why does the standard waveform from audio out get distorted when I reduce the amplitude?" Tags="|matlab|sound|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24879" PostTypeId="2" ParentId="24874" CreationDate="2015-07-25T06:09:02.720" Score="4" Body="&lt;p&gt;There are two things to consider here: the noise power after sampling, and the fact whether the sampled noise is uncorrelated or not. Note that the autocorrelation function of the sampled noise equals the sampled autocorrelation function of the continuous-time noise. For a wide-sense stationary (WSS) band-limited white noise signal $X(t)$ with bandwidth $B$ and one-sided noise density $N_0$, the autocorrelation function is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_X(\tau)=BN_0\,\text{sinc}(2B\tau)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I use $\text{sinc}(x)=\sin(\pi x)/(\pi x)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you define a discrete time process $Y[n]=X(nT)$, where $f_s=1/T$ is the sampling frequency, then its autocorrelation function is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_Y[k]=R_X(kT)=BN_0\,\text{sinc}(2BkT)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the power of the discrete-time noise $Y[n]$ is given by $R_Y[0]=BN_0$, it is obvious that the sampling frequency has no influence on the noise power. So no matter how fast you sample the original continuous-time noise, the power of the resulting discrete-time noise always equals the power of the noise before sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's have a look at the correlation between the noise samples. The autocorrelation function $R_X(\tau)$ has zeros at&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tau_i=\frac{i}{2B},\quad i=1,2,\ldots$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which for $B=10\,\text{kHz}$ gives $\tau_i=i\cdot 50\mu s$ (this is the small numerical error in Dilip Sarwate's post you referred to in your question). This means that if you choose a sampling interval which is an integer multiple of $50\mu s$, the resulting sampled noise will be uncorrelated. This corresponds to sampling frequencies $f_s=2B/i$, $i=1,2,\ldots$, i.e. $20\,\text{kHz}$, $10\,\text{kHz}$, $6.67\,\text{kHz}$, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So with a sampling frequency of $20\,\text{kHz}$ you do get uncorrelated noise samples.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-07-25T07:43:44.097" LastActivityDate="2015-07-25T07:43:44.097" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24880" PostTypeId="1" AcceptedAnswerId="24881" CreationDate="2015-07-25T07:58:15.543" Score="17" ViewCount="6323" Body="&lt;p&gt;I was glancing through &lt;em&gt;&amp;quot;The Fourier Transform &amp;amp; Its Applications&amp;quot;&lt;/em&gt; by Ronald N. Bracewell, which is a good intro book on Fourier Transforms. In it, he says that if you take the Fourier transform of a function 4 times, you get back the original function, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal F\Bigg\{ \mathcal F\bigg\{  \mathcal F\big\{  \mathcal F\left\{  g(x) \right\} \big\} \bigg\} \Bigg\} = g(x)\,. $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Could someone kindly show me how this is possible? I'm assuming the above statement is for complex &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and this has something to do with &lt;span class=&quot;math-container&quot;&gt;$i^0=1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i^1=i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i^2=-1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i^3 = -i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i^4=1$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Thank you for your enlightenment.&lt;/p&gt;&#xA;" OwnerUserId="13407" LastEditorUserId="1629" LastEditDate="2020-11-17T11:13:16.663" LastActivityDate="2023-07-13T05:19:29.427" Title="Fourier transform 4 times = original function (from Bracewell book)" Tags="|fourier-transform|transform|fourier|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24881" PostTypeId="2" ParentId="24880" CreationDate="2015-07-25T08:51:42.760" Score="24" Body="&lt;p&gt;I'll use the non-unitary Fourier transform (but this is not important, it's just a preference):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X(\omega)=\int_{-\infty}^{\infty}x(t)e^{-i\omega t}dt\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty}X(\omega)e^{i\omega t}d\omega\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where (1) is the Fourier transform, and (2) is the inverse Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;Now if you formally take the Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$X(\omega)$&lt;/span&gt; you get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{F}\{X(\omega)\}=\mathcal{F}^2\{x(t)\}=\int_{-\infty}^{\infty}X(\omega)e^{-i\omega t}d\omega\tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Comparing (3) with (2) we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{F}^2\{x(t)\}=2\pi x(-t)\tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the Fourier transform equals an inverse Fourier transform with a sign change of the independent variable (apart from a scale factor due to the use of the non-unitary Fourier transform).&lt;/p&gt;&#xA;&lt;p&gt;Since the Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$x(-t)$&lt;/span&gt; equals &lt;span class=&quot;math-container&quot;&gt;$X(-\omega)$&lt;/span&gt;, the Fourier transform of (4) is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{F}^3\{x(t)\}=2\pi X(-\omega)\tag{5}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And, by an argument similar to the one used in (3) and (4), the Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$X(-\omega)$&lt;/span&gt; equals &lt;span class=&quot;math-container&quot;&gt;$2\pi x(t)$&lt;/span&gt;. So we obtain for the Fourier transform of (5)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{F}^4\{x(t)\}=2\pi\mathcal{F}\{X(-\omega)\}=(2\pi)^2x(t)\tag{6}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is the desired result. Note that the factor &lt;span class=&quot;math-container&quot;&gt;$(2\pi)^2$&lt;/span&gt; in (6) is a consequence of using the non-unitary Fourier transform. If you use the unitary Fourier transform (where both the transform and its inverse get a factor &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2\pi}$&lt;/span&gt;) this factor would disappear.&lt;/p&gt;&#xA;&lt;p&gt;In sum, apart from irrelevant constant factors, you get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\bbox[#f8f1ea, 0.6em, border: 0.15em solid #fd8105]{x(t)\overset{\mathcal{F}}{\Longrightarrow} X(\omega)\overset{\mathcal{F}}{\Longrightarrow} x(-t)\overset{\mathcal{F}}{\Longrightarrow} X(-\omega)\overset{\mathcal{F}}{\Longrightarrow} x(t)}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2020-10-24T18:22:00.020" LastActivityDate="2020-10-24T18:22:00.020" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="24883" PostTypeId="2" ParentId="24877" CreationDate="2015-07-25T09:06:01.877" Score="1" Body="&lt;p&gt;Try to remember what happens when you multiply a signal with a cosine function with a frequency of &lt;code&gt;Fc&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely, what's the shifting operator in Frequency domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we're talking on visualization, so the operator in MATLAB is called &lt;a href=&quot;https://www.mathworks.com/help/matlab/ref/fftshift.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;fftshift()&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enjoy...&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2019-11-16T06:41:08.687" LastActivityDate="2019-11-16T06:41:08.687" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="24884" PostTypeId="2" ParentId="24876" CreationDate="2015-07-25T09:08:18.507" Score="0" Body="&lt;p&gt;Transfer function tries to describe a system using the Fourier Transform (More generally the &lt;a href=&quot;https://en.wikipedia.org/wiki/Laplace_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laplace Transform&lt;/a&gt; / &lt;a href=&quot;https://en.wikipedia.org/wiki/Z-transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Z Transform&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Yet in order for the Transform function to dependent on the frequency and amplitude only the input system must be LTI system.&lt;/p&gt;&#xA;&lt;p&gt;Hence there is no Transfer Function in the Fourier Domain to your system which can be described the way you want.&lt;/p&gt;&#xA;&lt;h3&gt;Linear Time Invariant (LTI) System&lt;/h3&gt;&#xA;&lt;p&gt;By &lt;a href=&quot;https://en.wikipedia.org/wiki/Convolution_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Convolution Theorem&lt;/a&gt; a convolution of &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_time-invariant_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;LTI System&lt;/a&gt; can be described by a transfer function in Fourier Domain.&lt;/p&gt;&#xA;&lt;p&gt;What do mean by a transfer function? We mean having &lt;span class=&quot;math-container&quot;&gt;$ H \left( \omega \right) $&lt;/span&gt; which is independent of the input.&lt;br /&gt;&#xA;As for any output and input we can calculate the Fourier Transform and have the ratio of them as the Transfer Function. But only for LTI the result of this ratio will be constant.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2021-03-20T21:49:22.673" LastActivityDate="2021-03-20T21:49:22.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24885" PostTypeId="2" ParentId="24872" CreationDate="2015-07-25T09:10:16.903" Score="0" Body="&lt;p&gt;I don't see the question here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you're right.&lt;br&gt;&#xA;On the DFT map of the image, the magnitude / amplitude, etc. are powers of the length of the vector of the complex number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On more useful visualization to help working with large Dynamic Range is using the log(1 + abs()) on the DFT.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-07-25T09:10:16.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24886" PostTypeId="1" CreationDate="2015-07-25T09:33:57.847" Score="0" ViewCount="352" Body="&lt;p&gt;I am trying to understand how modulation with carriers works(transmission part). I will express my question in terms of BFSK for simplicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us condiser BFSK modulation with symbols {1,2}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then for a single symbol period:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the transmitted waveform for symbol 1 is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_1(t)=\sqrt{P\over T}e^{j2\pi f_1 t}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the transmitted waveform for symbol 2 is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_2(t)=\sqrt{P\over T}e^{j2\pi f_2 t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $P , T$ denote signal strength and period respectively and $f_1 , f_2$ denote carrier frequencies for symbols $1 , 2$ respectively .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also know that $s_1(t)$ has an equivalent &#xA;$$s_1'(t)=\Re{(s_1(t))}=\Re{(\sqrt{P\over T}e^{j2\pi f_1 t}})=\sqrt{P\over T}cos(2 \pi f_1 t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same thing for $s_2(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_2'(t)=\Re{(s_2(t))}=\Re{(\sqrt{P\over T}e^{j2\pi f_2 t}})=\sqrt{P\over T}cos(2 \pi f_2 t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 1:&lt;/strong&gt; When I send symbol $1$ which signal is actually transmitted from the transmitter, $s_1(t)$ or $s_1'(t)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2:&lt;/strong&gt; For signals $s_1(t)$ and $s_1'(t)$ which one of two is the low-pass equivalent and which one is the highpass equivalent?&lt;/p&gt;&#xA;" OwnerUserId="16738" LastActivityDate="2015-07-25T09:33:57.847" Title="BFSK modulation what signal the transmitter actually sends?" Tags="|signal-analysis|digital-communications|modulation|fsk|" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24887" PostTypeId="1" CreationDate="2015-07-25T12:51:15.820" Score="0" ViewCount="326" Body="&lt;p&gt;I'm developing a PID controller to control the position of a laser beam. The position is measured using a Position Sensitive Device (PSD). I modeled the plant according to the manufacturer specs and I'm using Matlab/Simulink with PID tuner and embedded coder to generate the code for an F28335 micro-controller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As long as I use a PI controller, the results are consistent with the model, but as soon as I introduce a differentiator and try to obtain a sharper step response, the system becomes unstable, with a lot of oscillation and saturation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that the problem is the noise in the feedback sensor, so I tried to filter both the feedback signal and the error to no avail. Is there any other reason why the real system becomes so unstable? Any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the compensator formula provided by the Simulink PID block:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HtBdh.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HtBdh.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16740" LastEditorUserId="16740" LastEditDate="2015-07-25T20:24:11.033" LastActivityDate="2015-07-25T20:24:11.033" Title="Troubleshooting PID controller" Tags="|control-systems|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24888" PostTypeId="2" ParentId="24876" CreationDate="2015-07-25T13:24:48.380" Score="3" Body="&lt;p&gt;The idea of the transfer function is roughly the following:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Break your input signal down into sine waves&lt;/li&gt;&#xA;&lt;li&gt;Run the sine waves through the system&lt;/li&gt;&#xA;&lt;li&gt;Assemble the output signal by summing up the output sine waves&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This only works if systems output to a sine wave is a sine wave of the same frequency but with different amplitude and phase. That amplitude and phase modification is exactly the transfer function. However only  LTI systems have the &amp;quot;one frequency in&amp;quot; &amp;quot;same frequencies out&amp;quot; property.&lt;/p&gt;&#xA;&lt;p&gt;Non linear systems are typically &amp;quot;one frequency&amp;quot; &amp;quot;many frequencies&amp;quot; out, so simple transfer function doesn't work any more. There are advanced methods that can handle &amp;quot;one in&amp;quot; to &amp;quot;many out&amp;quot;, and are based on sine waves, polynomial or Taylor series. See for example &lt;a href=&quot;https://en.wikipedia.org/wiki/Volterra_series&quot; rel=&quot;nofollow noreferrer&quot;&gt;Volterra Series&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="7092" LastEditDate="2021-08-25T20:51:15.067" LastActivityDate="2021-08-25T20:51:15.067" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="24889" PostTypeId="2" ParentId="24878" CreationDate="2015-07-25T13:35:04.767" Score="2" Body="&lt;p&gt;Primarily because the documentation is poorly written. If you want to play at half amplitude you need to use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;soundsc(y,48000,[-2 2]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The range argument is the input amplitude range that gets mapped to the maximum available range of the sound card. So if the max of your input exceeds the max in the range argument, you will get clipping.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-25T13:35:04.767" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24890" PostTypeId="1" AcceptedAnswerId="24893" CreationDate="2015-07-25T14:18:38.427" Score="7" ViewCount="728" Body="&lt;p&gt;In signal processing, convex optimization plays a useful role in problems such as sparse signal recovery and filter design. What other places does convex optimization appear?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in compressed sensing the Basis pursuit Denoising problem, the LASSO problem and the Dantzig selector can be posed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;\min_{x} \ell(Ax-b)+r(x)&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\ell(\cdot)$ is and $r(\cdot)$ are appropriate loss and regularization terms, respectively. Moreover, the design of a filter subject to time and frequency constraints often yields a convex formulation.&lt;/p&gt;&#xA;" OwnerUserId="16767" LastEditorUserId="128" LastEditDate="2018-04-02T14:58:14.540" LastActivityDate="2018-04-02T14:58:33.797" Title="Convex Optimization in Signal and Image Processing" Tags="|computer-vision|algorithms|reference-request|optimization|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24892" PostTypeId="1" AcceptedAnswerId="24896" CreationDate="2015-07-25T17:05:44.343" Score="2" ViewCount="6521" Body="&lt;p&gt;A real band-pass signal $s(t)$ with center frequency $f_c$ can always be represented as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s(t) = A(t) \cos(2\pi f_c t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A(t)$ is real and can be viewed as amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s(t) = A(t) \cos(2\pi f_ct) = \Re\left\{(A(t) e^{j2\pi f_ct})\right\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we consider&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_l(t)= A(t) e^{j2\pi f_ct}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to be the corresponding complex band-pass signal of $s(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how can I find the real low pass equivalent of $s(t)$ and the complex low pass equivalent of $s_l(t)$?&lt;/p&gt;&#xA;" OwnerUserId="16738" LastEditorUserId="1629" LastEditDate="2020-11-26T18:44:37.963" LastActivityDate="2020-11-26T18:44:37.963" Title="Real and complex low pass equivalent of band-pass signal" Tags="|continuous-signals|modulation|bandpass|analytic-signal|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24893" PostTypeId="2" ParentId="24890" CreationDate="2015-07-25T18:26:55.260" Score="6" Body="&lt;p&gt;There's a whole area of signal processing dedicated to optimal filtering. In pretty much every case I've seen the filtering problem is formulated with a convex cost function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a freely available book on the subject - &lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/osp2e/osp2e.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sophocles J. Orfanidis - Optimum&#xA;Signal Processing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11618" LastEditorUserId="128" LastEditDate="2018-04-02T14:26:20.740" LastActivityDate="2018-04-02T14:26:20.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24894" PostTypeId="2" ParentId="24890" CreationDate="2015-07-25T18:43:01.973" Score="2" Body="&lt;h3&gt;Papers&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://scicomp.stackexchange.com/questions/11387/interpolation-by-solving-a-minimization-problem-optimization&quot;&gt;Interpolation by Solving an Optimization Problem&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Chebyshev_center&quot; rel=&quot;noreferrer&quot;&gt;Chebyshev Center Problem&lt;/a&gt; could be thought as &lt;a href=&quot;https://arxiv.org/abs/1701.00900&quot; rel=&quot;noreferrer&quot;&gt;Robust Localization Problem&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Books&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cambridge.org/9780521762229&quot; rel=&quot;noreferrer&quot;&gt;Daniel P. Palomar, Yonina C. Eldar - Convex Optimization in Signal Processing and Communications&lt;/a&gt;.  &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://web.stanford.edu/~boyd/cvxbook/&quot; rel=&quot;noreferrer&quot;&gt;Stephen Boyd, Lieven Vandenberghe - Convex Optimization&lt;/a&gt;.&lt;br&gt;&#xA;Many of the exercises and examples are from the Signal / Image Processing world.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Courses&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/ece525/&quot; rel=&quot;noreferrer&quot;&gt;Optimum Signal Processing&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://stanford.edu/~boyd/papers/rt_cvx_sig_proc.html&quot; rel=&quot;noreferrer&quot;&gt;Real Time Convex Optimization in Signal Processing&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2018-04-02T14:58:33.797" LastActivityDate="2018-04-02T14:58:33.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24895" PostTypeId="2" ParentId="15843" CreationDate="2015-07-25T18:55:22.753" Score="1" Body="&lt;p&gt;You could try a Savitzky-Golay filter, followed by standard peak detection. The S-G filter will preserve the location of your peaks. If you're using Matlab it comes with the signal processing toolbox. See &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/sgolayfilt.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. If you're using python I &lt;a href=&quot;https://stackoverflow.com/questions/20618804/how-to-smooth-a-curve-in-the-right-way/20642478#20642478&quot;&gt;wrote about them here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11618" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-07-25T18:55:22.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24896" PostTypeId="2" ParentId="24892" CreationDate="2015-07-25T19:18:08.740" Score="6" Body="&lt;p&gt;It's not true that any real-valued band pass signal can be written as shown in your first equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=A(t)\cos(\omega_c t)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most general representation of a real-valued band pass signal is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=\Re\{a(t)e^{j\omega_c t}\}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a(t)$ is a complex-valued function, called the &lt;em&gt;complex envelop&lt;/em&gt; of $s(t)$. It is the complex baseband (low pass) representation of $s(t)$. With $a(t)=a_I(t)+ja_Q(t)$, (2) can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=a_I(t)\cos(\omega_c t)-a_Q(t)\sin(\omega_c t)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a_I(t)$ and $a_Q(t)$ are called the in-phase and the quadrature components, respectively. Both $a_I(t)$ and $a_Q(t)$ are real-valued baseband (low pass) signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third, equivalent, representation of $s(t)$ is obtained by writing the complex envelop as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a(t)=b(t)e^{j\phi(t)}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $b(t)$ is the (real-valued) envelop, and $\phi(t)$ is the phase. Using (4) and (2), the band pass signal $s(t)$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=b(t)\cos(\omega_ct+\phi(t))\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equations (2), (3) and (5) are three equivalent representations of a general real-valued band pass signal. If you compare representation (5) to Equation (1), you see that Equation (1) is a special case for $\phi(t)=2\pi k$, $k=0,1,\ldots$, i.e. for a constant phase which is zero (or a multiple of $2\pi$). From Equation (3), this is equivalent with the condition that the quadrature component $a_Q(t)$ is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the complex-valued band pass signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{s}(t)=a(t)e^{j\omega_c t}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is the analytic signal mentioned in a comment. It has no negative frequency components and it can be obtained from $s(t)$ by computing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{s}(t)=s(t)+j\mathcal{H}\{s(t)\}\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathcal{H}\{\cdot\}$ denotes the Hilbert transform.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-07-25T22:52:36.643" LastActivityDate="2015-07-25T22:52:36.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24900" PostTypeId="1" CreationDate="2015-07-26T02:14:13.433" Score="5" ViewCount="4090" Body="&lt;p&gt;I am reading through &lt;a href=&quot;http://deeplearning.net/tutorial/lenet.html&quot; rel=&quot;noreferrer&quot;&gt;this page&lt;/a&gt; about convolutional neural networks and I am confused about the part about max-pooling (downsampling a signal/image with the maximum value in a block).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently, one of the advantages of max-pooling is translation invariance:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It provides a form of translation invariance. Imagine cascading a max-pooling layer with a convolutional layer. There are 8 directions in which one can translate the input image by a single pixel. If max-pooling is done over a 2x2 region, 3 out of these 8 possible configurations will produce exactly the same output at the convolutional layer. For max-pooling over a 3x3 window, this jumps to 5/8.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I kept thinking about this and I can't figure out why this is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am assuming the author means doing a translation to the left/right of the image, passing through a max-pooling layer and convolving. Then comparing the outputs of the convolution with the same process but for a different translation direction&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I even did a Python script to illustrate the process of max-pooling -&gt; convolution with 8 different translations by one pixel and the original matrix&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from itertools import product&#xA;&#xA;from cv2 import warpAffine&#xA;from matplotlib.pyplot import figure, gca, imshow, show, subplot&#xA;from numpy import asarray, concatenate, eye, float32, max, min, mod, reshape, zeros&#xA;from numpy.random import binomial&#xA;from scipy.signal import convolve2d&#xA;from skimage.measure import block_reduce&#xA;&#xA;def list_to_2d(x):&#xA;    return reshape(asarray(x), (len(x), 1))&#xA;&#xA;def npix_to_m(x):&#xA;    return concatenate((eye(2), list_to_2d(item)), axis=1)&#xA;&#xA;def show_images(xl):&#xA;    vmin = min(asarray(xl))&#xA;    vmax = max(asarray(xl))&#xA;    figure(figsize=(4.6,4.6))&#xA;    for (x, i) in zip(xl, range(len(xl))):&#xA;        subplot(3, 3, i+1)&#xA;        gca().xaxis.set_major_locator(plt.NullLocator())&#xA;        gca().yaxis.set_major_locator(plt.NullLocator())&#xA;        imshow(x, interpolation='None', cmap='gray', vmin=vmin, vmax=vmax)&#xA;    show()&#xA;&#xA;x = float32(binomial(3, 0.5, (10,10)))&#xA;&#xA;translations = list(product((-1, 0, 1), repeat=2))&#xA;&#xA;M_list = [npix_to_m(item) for item in translations]&#xA;&#xA;x_trans = [warpAffine(x, M, (10,10)) for M in M_list]&#xA;show_images(x_trans)&#xA;print 'Original matrices\n'&#xA;&#xA;x_maxp = [block_reduce(x, block_size=(2,2), func=max) for x in x_trans]&#xA;show_images(x_maxp)&#xA;print 'Max-pooled matrices\n'&#xA;&#xA;filt = float32(binomial(3, 0.5, (2,2)))&#xA;x_conv = [convolve2d(x, filt, mode='valid') for x in x_maxp]&#xA;show_images(x_conv)&#xA;print 'Convolved max-pooled matrices\n'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These are the outputs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0D3BP.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0D3BP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see none of them are exactly the same. So what am I not understanding here?&lt;/p&gt;&#xA;" OwnerUserId="15743" LastActivityDate="2017-02-25T06:47:44.393" Title="Translation invariance in max-pooling and cascading with convolutional layer" Tags="|image-processing|computer-vision|convolution|downsampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24901" PostTypeId="2" ParentId="24086" CreationDate="2015-07-26T13:18:37.513" Score="1" Body="&lt;p&gt;I am considering a similar problem as well and I found Gini index as one of the solution: &lt;a href=&quot;http://www.eng.nus.edu.sg/eleashra/TJSTSP_Gini.pdf&quot; rel=&quot;nofollow&quot;&gt;Gini Index as Sparsity Measure for Signal Reconstruction from Compressive Samples&lt;/a&gt;. Please have a look at the definition in page 3. It is normalized in the range from 0 to 1 as the least sparse or the most sparse the vector is, respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below is an implementation in Python, though I am not sure about returning 0 if the input is a zero vector:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def gini(v):&#xA;    v = np.array(v)&#xA;    sort_v = sort(abs(v))&#xA;    norm_v = sum(sort_v)&#xA;    if norm_v==0:&#xA;        return(0)&#xA;    else:&#xA;        sig = 0 &#xA;        for k in arange(len(sort_v))+1:&#xA;            sig+=(sort_v[k-1]/(norm_v))*((len(sort_v)-k+0.5)/len(sort_v))&#xA;        return(1-2*sig)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16770" LastActivityDate="2015-07-26T13:18:37.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24904" PostTypeId="1" AcceptedAnswerId="26064" CreationDate="2015-07-27T08:05:34.407" Score="2" ViewCount="112" Body="&lt;p&gt;I'm reading the text book &quot;Time-Frequency Analysis&quot; by Leon Cohen and I've made my way through a decent portion. There is however a conceptual issue I keep coming back to. The book states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If we consider $\lvert s(t)\rvert^2$ as a density in time, the average&#xA;  time can be defined in the usual way any average is defined:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$  \langle t \rangle  = \int t \lvert s(t)\rvert^2dt$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand conceptually why multiplying by $t$ in the integration will provide us with an average. I didn't know that was the typical way to define an average either despite the books insistence that this is common knowledge (which it very may well be I'm just not interpreting it correctly). I've always thought about an average as dividing by some base, say by the total period of time $T$ NOT multiplying by $t$ inside the integral. It states earlier that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\lvert s(t)\rvert^2$ is the energy per unit time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I was thinking that perhaps mathematically multiplying by $t$ which has units of $s$ would get rid of the per unit time portion, but the units of $\lvert s(t)\rvert^2$ aren't actually $v^2/s$ as that would be the derivative, it's just $v^2$ so that doesn't make much sense (assuming the signal is an electrical signal and the unit time is seconds). Can someone point me in the right direction on how to think about this? I know it's a simple concept but I'm just having trouble making it over this hurdle. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="14943" LastEditorUserId="14943" LastEditDate="2015-07-27T12:18:49.047" LastActivityDate="2020-05-16T23:08:14.390" Title="Defining an average in time for a density in time" Tags="|power-spectral-density|time-frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24905" PostTypeId="2" ParentId="24904" CreationDate="2015-07-27T08:30:20.573" Score="2" Body="&lt;p&gt;I think it is implied that $\int_{-\infty}^{\infty}|s(t)|^2 dt = 1$ (which is why the author refers to $|s(t)|^2$ as a &lt;em&gt;density&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree with your sentiment &quot;I've always thought about an average as dividing by some base&quot;, but in this case, the base would be 1, so no division is needed. If you were to plot $|s(t)|^2$ as a function of $t$, and think of this plot as a histogram, the the integral:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}t|s(t)|^2 dt $$&#xA;will tell you the average value, since each value of $t$ is weighted by the density function.&lt;/p&gt;&#xA;" OwnerUserId="11204" LastEditorUserId="11204" LastEditDate="2015-07-27T10:28:45.397" LastActivityDate="2015-07-27T10:28:45.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24906" PostTypeId="1" AcceptedAnswerId="24935" CreationDate="2015-07-27T09:02:01.383" Score="-1" ViewCount="88" Body="&lt;p&gt;I want to simulate short term white noise with  Yuler and Burg. It's said that it can give better results than Gauss-Markov.&#xA;The problem is that each time the series diverge. Do you think that I made a mistake in  my code&#xA;Burg&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;import pywt&#xA;from scipy import signal&#xA;from spectrum import *&#xA;from pylab import *&#xA;&#xA;&#xA;def simulate_noise_burg(self,x,ordre):#x = data series&#xA;    var=numpy.var(x)&#xA;    noise = np.random.normal(0, var**0.5, len(x))&#xA;    ar, variance, coeff_reflection = arburg(x, ordre)&#xA;    i=0&#xA;    tmp_ar=[]&#xA;    tmp_coef=[]&#xA;    while i&amp;lt;len(ar):&#xA;        tmp_ar.append(ar[i].real)&#xA;        tmp_coef.append(coeff_reflection[i].real)&#xA;        i+=1&#xA;&#xA;    last_elements=np.array(tmp_ar)&#xA;    coeff_reflection=np.array(tmp_coef)&#xA;&#xA;    result=[]&#xA;    i=0&#xA;    new_element=0&#xA;    while i&amp;lt;len(x): &#xA;        new_element= last_elements.dot(coeff_reflection)+ noise[i]&#xA;        resultat.append(float(new_element))&#xA;        j=1&#xA;        while j&amp;lt;len(last_elements):&#xA;            last_elements[j]=last_elements[j-1]&#xA;            j+=1&#xA;        last_elements[0]=new_element&#xA;        i+=1&#xA;    return result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yuler&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;import pywt&#xA;from scipy import signal&#xA;from spectrum import *&#xA;from pylab import *&#xA;&#xA;&#xA;def simulate_noise_yuler (self,x,ordre):#x = data series&#xA;    var=np.var(x)&#xA;    noise = np.random.normal(0, var**0.5, len(x))&#xA;    ar, variance, coeff_reflection = aryule(x, ordre)&#xA;&#xA;    last_elements=np.array(ar)&#xA;&#xA;    tmp_coef=[]&#xA;    i=0&#xA;    while i&amp;lt;len(coeff_reflection):&#xA;        tmp_coef.append([coeff_reflection[i]])&#xA;        i+=1&#xA;    coef=np.array(tmp_coef)&#xA;&#xA;    result=[]&#xA;    i=0&#xA;    new_element=0&#xA;    while i&amp;lt;len(x): &#xA;        new_element= last_elements.dot(coef)+ noise[i]&#xA;        resultat.append(float(new_element))&#xA;        j=1&#xA;        while j&amp;lt;len(last_elements):&#xA;            last_elements[j]=last_elements[j-1]&#xA;            j+=1&#xA;        last_elements[0]=new_element&#xA;        i+=1&#xA;    return result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16778" LastEditorUserId="16779" LastEditDate="2015-07-27T19:44:08.707" LastActivityDate="2015-07-28T10:13:56.260" Title="simulating noise with Yuler and burg" Tags="|signal-analysis|noise|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24908" PostTypeId="1" AcceptedAnswerId="24910" CreationDate="2015-07-27T11:20:11.997" Score="1" ViewCount="2003" Body="&lt;p&gt;Is the Hilbert envelope (analytic signal) feasible to be calculated in audio frames/blocks in real-time, when using FFT with windowing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm specifically concerned with is that how does it not create or not be able to create discontinuities (in the end points) between successive frames?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-07-27T11:26:53.877" LastActivityDate="2015-07-27T12:03:53.597" Title="Is real-time Hilbert envelope feasible?" Tags="|fft|hilbert-transform|analytic-signal|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24910" PostTypeId="2" ParentId="24908" CreationDate="2015-07-27T12:03:53.597" Score="2" Body="&lt;p&gt;As with most things in Engineering the answer is &quot;depends on your requirements&quot;. In general you can't do a perfect Hilbert transform unless the signal is strictly periodic (see &lt;a href=&quot;http://andrewduncan.net/air/&quot; rel=&quot;nofollow&quot;&gt;http://andrewduncan.net/air/&lt;/a&gt; ). Since you can't do perfect you need to define what's good enough for your particular application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For most typically audio applications, that it's pretty straight forward. The Hilbert transform can be represented as a simple linear time invariant filter. Unfortunately the impulse response infinite and non-causal. For an FIR implementation you need to truncate and delay it. The larger your truncation window and your delay the more precise it will be, however it will also become more expensive computationally and the latency goes up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your application requires a really long filter (typically when you need high precision at very low frequencies) than FFT can be useful in an overlap add configuration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just care about relative phase and not absolute phase you can run the signal through a set of differential allpass filters, which is a very efficient way of implementing a band limited 90 degree phase shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use advanced filter design methods (least square, Parks McLellan etc.) to optimize any Hilbert approximation for your specific requirements.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-27T12:03:53.597" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24912" PostTypeId="2" ParentId="23029" CreationDate="2015-07-27T12:07:01.920" Score="2" Body="&lt;p&gt;I can figure out two options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Interpolate data&lt;/li&gt;&#xA;&lt;li&gt;Remember that filters are dynamical systems and solve the corresponding ordinary differential equation (ODE)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the second method, you basically use the retrieved time step as the time step in the ODE solver. Assuming you have a second order system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\ddot{y}+\frac{\omega_0}{Q}\dot{y}+y\omega_0^2=x\omega_0^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For butterworth, $Q=\frac{1}{\sqrt{2}}$ Introduce two variables $u=y$ and $v=\dot{u}$, and you get two coupled first order ODE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left\{\begin{aligned}&#xA;     \dot{u}&amp;amp;=v\\&#xA;     \dot{v}&amp;amp;=x\omega_0^2-u\omega_0^2-\frac{\omega_0}{Q}v&#xA;    \end{aligned}\right.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you do not want to have a too high cutoff frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left\{\begin{aligned}&#xA;   u&amp;amp;\leftarrow u+v\Delta t\\&#xA;   v&amp;amp;\leftarrow v+ \left(x\omega_0^2-u\omega_0^2-\frac{\omega_0}{Q}v\right)\Delta t\end{aligned}\right.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\Delta t$ is the time difference between two steps. If you want $\omega_0 &amp;gt; \frac{0.25\text{ Hz}}{2\pi}$, you need to consider the Euler backward method, or if you need more accuracy, the trapezoid method.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Addendum&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;You may not want the overshoots and undershoots of the Butterworth filter. Then, set $Q$ a bit lower. Probably, you want a critically damped system, which do not have any such effects. In that case, set $Q=\frac{1}{2}$. An interesting side-effect of choosing the ODE approach is that you get a filtered derivative for free (it is the $v$ component), if you were to trig on changes in acceleration.&lt;/p&gt;&#xA;" OwnerUserId="16781" LastEditorUserId="16781" LastEditDate="2015-08-01T08:17:39.040" LastActivityDate="2015-08-01T08:17:39.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24913" PostTypeId="1" AcceptedAnswerId="24939" CreationDate="2015-07-27T12:30:39.217" Score="1" ViewCount="957" Body="&lt;p&gt;A very simple question which can't really figure out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a simple discrete time rectangular integrator with Z transform H(z) = 1/(1-Z^(-1))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plotting the frequency response with Matlab using &lt;em&gt;freqz&lt;/em&gt; shows what it looks like a kind of low pass filter response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when finding the freq response by sending an delta pulse through the integrator via &lt;em&gt;filter&lt;/em&gt; Matlab function, and performing the FFT on its output, I just get a pulse (with amplitude equal to number of FFT points) followed of zeroes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess this kind of makes sense mathematically, as the output of the integrator is a step function, which, after FFT, is the addition of as many samples of the step output as the FFT length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why does the freqz method does not match the impulse response + FFT approach?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Am I wrong in trying to look at an integrator as a digital filter?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks a mill&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PD:&#xA;I forgot to mention that this is the closest to this question I could find on the site... However it is a leaky integrator not a rectangular (i.e. feedback multiplier is 1) integrator&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/3179/is-a-leaky-integrator-the-same-thing-as-a-low-pass-filter/3181#3181&quot;&gt;Is a leaky integrator the same thing as a low pass filter?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16783" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2019-11-13T22:31:17.737" Title="Frequency response of a (rectangular) integrator" Tags="|matlab|fft|infinite-impulse-response|frequency-response|control-systems|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24915" PostTypeId="2" ParentId="24913" CreationDate="2015-07-27T12:45:05.457" Score="0" Body="&lt;p&gt;The integrator is unstable since it has a pole on the unit circle. That's outside the region of convergence of the Z transform and therefore Z transform analysis is not valid anymore. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at the data that freqz returns you can see that its infinity for omega= 0. Freqz() is nice enough to ignore this and still produces a plot (which it probably shouldn't).&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-07-27T12:45:05.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24918" PostTypeId="1" CreationDate="2015-07-27T06:56:45.857" Score="2" ViewCount="22358" Body="&lt;p&gt;I have created a simple plot of waveforms using matplotlib of 2 wave files on python. Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;from statistics import mean&#xA;import wave&#xA;import sys&#xA;&#xA;plt.figure(1)&#xA;&#xA;class Audio:&#xA;    def __init__(self, audio):&#xA;        self.audio = wave.open(audio,'r')&#xA;        self.signal = self.audio.readframes(-1)&#xA;        self.signal = np.fromstring(self.signal, 'Int16')&#xA;        self.fr = self.audio.getframerate()&#xA;        self.time = np.linspace(0, 100, num=(len(self.signal)))&#xA;        self.fft = np.fft.fft(self.signal)&#xA;&#xA;    def plot(self):&#xA;        plt.title(&quot;Audio waveforms&quot;)&#xA;        plt.plot(self.time, self.signal, '.')&#xA;&#xA;gana = Audio('gana.wav')&#xA;humm = Audio('humm.wav')&#xA;&#xA;gana.plot()&#xA;humm.plot()&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jkvRp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jkvRp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is remove the noise from both the files. I have seen many examples that use FFT to remove noise. I have taken out the fft of the signals of these wave files but the problems I am having is I have no idea of what to do after taking out the FFT. Do I have to plot the FFT or do something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S The noise in the green wave form is hiss and in the blue is background sound. So is there any way that I could get rid of both of these noises? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="16791" OwnerDisplayName="Mohammad Areeb Siddiqui" LastActivityDate="2015-07-27T14:14:37.577" Title="Noise reduction on wave file" Tags="|python|audio|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24921" PostTypeId="2" ParentId="10483" CreationDate="2015-07-27T17:54:17.713" Score="3" Body="&lt;p&gt;The original question was well posed, while the edit made it wrong. Let's clarify things first: the term &lt;em&gt;scale normalized derivative&lt;/em&gt; was introduced (to my knowledge) in&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Mikolajczyk, K. and Schmid, C. 2001. Indexing based on scale invariant&#xA;  interest points. In Proceedings of the 8th International&#xA;  Conference on Computer Vision, Vancouver, Canada, pp. 525–&#xA;  531.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;referring to a derivative of order $m$ of image $I(\mathbf{x})$, obtained by convolving with the corresponding derivative of a Gaussian function, multiplied by the derivation scale at the power of $m$. In formulas this is&#xA;$$&#xA;D_{i_1 \dots i_m}(\mathbf{x},\sigma_D) = \sigma_D^m L_{i_1 \dots i_m}(\mathbf{x},\sigma_D)&#xA;$$&#xA;The indexes are generic because of the order is $m$. If you use order $m=1$, then you get just the two first order partial derivatives:&#xA;$$&#xA;D_x(\mathbf{x},\sigma_D) = \sigma_D L_x(\mathbf{x},\sigma_D)\\&#xA;D_y(\mathbf{x},\sigma_D) = \sigma_D L_y(\mathbf{x},\sigma_D)&#xA;$$&#xA;Why do you multiply by $\sigma_D^m$? Because, in this way, the scale normalized derivatives behave nicely under scaling of the intensity pattern. The derivatives obtained on a scaled image will have the same value of those on another scale but with the right derivation scale, that is a different level on the scale space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, just look at $L_x$, since for the other one is exactly the same. This is defined as:&#xA;$$&#xA;L_x(\mathbf{x},\sigma_D) = g_x(\sigma_D)*I(\mathbf{x})&#xA;$$&#xA;In your edited answer you observe that derivation and convolution may be exchanged, and in fact you can write:&#xA;$$&#xA;g_x(\sigma_D)*I(\mathbf{x}) = g(\sigma_D)*I_x(\mathbf{x})&#xA;$$&#xA;The problem is that in the Harris technique you introduce a non-linear operation: square and product of the two partial derivatives. So you get:&#xA;$$&#xA;\left[&#xA;\begin{array}{cc}&#xA;L_x^2(\mathbf{x},\sigma_D) &amp;amp; L_xL_y(\mathbf{x},\sigma_D)\\&#xA;L_xL_y(\mathbf{x},\sigma_D)&amp;amp;L_y^2(\mathbf{x},\sigma_D)&#xA;\end{array}&#xA;\right]&#xA;\neq&#xA;g(\sigma_D)*&#xA;\left[&#xA;\begin{array}{cc}&#xA;I_x^2(\mathbf{x},\sigma_D) &amp;amp; I_xI_y(\mathbf{x},\sigma_D)\\&#xA;I_xI_y(\mathbf{x},\sigma_D)&amp;amp;I_y^2(\mathbf{x},\sigma_D)&#xA;\end{array}&#xA;\right]&#xA;$$&#xA;So, to conclude, the first convolution is used to compute the derivatives (obtaining a representation in the scale space at the &lt;em&gt;derivatin scale&lt;/em&gt;), then you need to integrate over a window for the Harris algorithm, with the so called &lt;em&gt;integration scale&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Who introduced the two terms providing a good distinction of the two values? I believe that the first appearance of the terms is in &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Mikolajczyk, K., &amp;amp; Schmid, C. (2004). Scale &amp;amp; affine invariant interest point detectors. International Journal of Computer Vision, 60(1), 63-86.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the paper, they set $\sigma_D = 0.7\sigma_I$. Then the paper begins describing how the &lt;em&gt;Harris-Laplace Detector&lt;/em&gt; works, but it's &lt;strong&gt;really&lt;/strong&gt; complex and I still do not understand it very well (10 years after the appearance of the paper...).&lt;/p&gt;&#xA;" OwnerUserId="16788" LastActivityDate="2015-07-27T17:54:17.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24922" PostTypeId="2" ParentId="23725" CreationDate="2015-07-27T19:19:46.733" Score="1" Body="&lt;p&gt;I think this is a fairly simple problem. Just compute the absolute &lt;a href=&quot;https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients&quot; rel=&quot;nofollow noreferrer&quot;&gt;gradient histogram&lt;/a&gt; (you, probably, don't even need to normalize). If it is concentrated around one angle, this should indicate a binary code, whereas more or less equally distributed histograms should be the opposite. Of course, this approach assumes that you always see barcode images, i.e. no negative class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so I did a sample implementation for you, considering the above algorithm I described. Of course you could always make it better, but for the real-life images I tested, it gives reasonable results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [type] = classify_barcode_type(I, mingrad)&#xA;&#xA;% convert to grayscale&#xA;if (size(I,3)&amp;gt;1)&#xA;    I = rgb2gray(I);&#xA;end&#xA;&#xA;% smooth the image&#xA;I = imgaussfilt(I, 2);&#xA;&#xA;% compute sobel gradients&#xA;[Gmag,Gdir] = imgradient(I);&#xA;&#xA;% upside down are the same (180 deg. range)&#xA;gdir = mod(Gdir+180,180);&#xA;&#xA;% threshold the gradients: reduces noise&#xA;gradSelect = find(Gmag&amp;gt;mingrad);&#xA;numGrad = length(gradSelect);&#xA;&#xA;% histogram of gradients&#xA;[N, ~] = histcounts(gdir(gradSelect), 180);&#xA;&#xA;% 'relMag' percent of the gradients are pointing towards a single dir.&#xA;relMag = max(N)./numGrad;&#xA;&#xA;if (relMag&amp;lt;0.05)&#xA;    type = 'qr';&#xA;else&#xA;    type = 'linear';&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sample images for an Aztec code and Code 128 barcode are as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OiIig.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OiIig.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/iEfL7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iEfL7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use the MATLAB function as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% read the image&#xA;img = imread('real6s.png');&#xA;&#xA;% apply custom rotation for robustness test&#xA;imgr=imrotate(img,125);&#xA;&#xA;% classify&#xA;[type] = classify_1d_barcode(imgr, 40)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that, even though rotation creates many artificial edges, the approach remains to be robust, even in presence of severe rotations. In real life, you won't have the synthetic edges appearing due to rotations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figures below are plots of normalized gradient histograms ($\frac{\mathbf{N}}{\lVert \mathbf{N} \rVert}$ - also in the code). Note the difference between the aztec (QR) code and the linear barcode:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WxrMd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WxrMd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that linear barcode is rotated by 90 deg and this is clearly visible in the normalized angle histogram plot. You can get the rotation angle this way. Even though this example was for 90 deg rotation, you will get the same / similar results with any other rotation - theoretically the same results actually. Threshold (or the decision boundary) is indicated by the green line.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-07-31T22:17:32.563" LastActivityDate="2015-07-31T22:17:32.563" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="24923" PostTypeId="2" ParentId="24741" CreationDate="2015-07-27T20:15:12.787" Score="1" Body="&lt;p&gt;In Radar systems you have both additive noise and speckle. The additive noise is generally the additive thermal noise. In the case of additive noise, you can improve the SNR by simply increasing the transmitted signal power - whether or not you can practically do this for your system is another matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of multiplicative noise increasing the transmitted signal power will not improve the SNR because the noise increases in proportion to the transmitted signal power. See for example the reverberation problem in Sonar mentioned in another post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Radar, speckle is caused by the presence of lots of individual scatterers within a resolution cell (resolution due the pulse bandwidth and aperture length in Synthetic Aperture systems). Consider viewing a field of grass at 1m resolution - due the presence of a lot of individual blades of grass - the results add incoherently and produce what is known as speckle. If we increase the transmitted power, the grass will simply reflect more of that energy back to the receiver and they will still add incoherently, so you will not see any improvement in Signal to Noise Ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example you give, the noise power is proportional to the sqrt of the signal, so the variance of the noise (assuming noise with zero mean) is proportional to the signal level - but the variance is the measure of noise power. Lets say the power in the signal $u=1$ and the variance of $\eta=1$ i.e. $E(\eta^2)=1$, so the SNR $= 1/1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we scale the input signal by $A$ then, under the model you give, the signal power is $A^2$ but the noise power is $E(A\eta^2)=AE(\eta^2)=A$. Thus the new SNR = $A^2/A=A$ so there is some improvement in the SNR. But in the  case of additive thermal noise the improvement would have been $A^2$ since the power of the additive thermal noise is unaffected by the signal power i.e. they are independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your example is kind of a hybrid between the two extremes. For your reference another example of multiplicative noise, is phase noise in clocks for local oscillators, ADC etc.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-07-27T20:15:12.787" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24925" PostTypeId="1" AcceptedAnswerId="24928" CreationDate="2015-07-27T21:07:42.043" Score="3" ViewCount="2489" Body="&lt;p&gt;Let's say you want to implement an FIR filter $h[k]$ with $L$ taps and downsample the output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$v[k] = x[k] * h[k]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[m] = v[kD]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;naive&quot; way would be to compute all the samples of $v[k]$, then compute $y[m]$.  This should have complexity of $O(LD)$ to process a block of $D$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;less naive&quot; way would be to just compute every $D^{th}$ sample of $y[m]$ directly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[m] = v[mD] = \sum_{l = 0}^{L-1} x[mD - l] h[l]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should have a complexity of $O(LD/D) = O(L)$ to process a block of $D$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;smart&quot; way, according to everything I read (e.g. Proakis &amp;amp; Manolakis &lt;em&gt;Digital Signal Processing: Principles, Algorithms, and Applications, 4th ed.&lt;/em&gt; p.771, also &lt;a href=&quot;http://www.dsprelated.com/showarticle/191.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;), is to use a polyphase filter/decimator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to have the same computational burden: every $D^{th}$ timestep, you are computing the output of $D$ filters, each of which has $L/D$ taps, for a total complexity of roughly $O(DL/D) = O(L)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my analysis correct? If so, what is the advantage of using a polyphase decimator if the &quot;skip $D$&quot; method has the same complexity and is much easier to implement?&lt;/p&gt;&#xA;" OwnerDisplayName="user16223" LastEditorDisplayName="user16223" LastEditDate="2015-07-27T21:12:51.953" LastActivityDate="2015-07-28T01:53:12.643" Title="Advantage of using FIR Polyphase Decimator over just computing FIR output every D samples" Tags="|filters|decimation|finite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24927" PostTypeId="1" CreationDate="2015-07-28T01:20:38.970" Score="5" ViewCount="1828" Body="&lt;p&gt;I have been creating an application in Java that transforms an audio signal and writes it to a midi file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I tried using autocorrelation to find the fundamental frequency. However, I have been having difficulties implementing it. I resorted to finding the index of the peaks of the FFT output, finding their consecutive differences and deriving the fundamental frequency from the mode of the differences. This has given me pretty good accuracy. However, for lower notes, it is not working that great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping that reviewing it would have helped, but no avail.&#xA;Following is the output from a sample FFT and autocorrelation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is the autocorrelation method correct? a) Double the input and pad with zeros. b) Forward FFT. c) Take the absolute square. d) Inverse FFT.&lt;/li&gt;&#xA;&lt;li&gt;Am I looking for the right peak in the graph? I am assuming it should be the first peak.&lt;/li&gt;&#xA;&lt;li&gt;Do the indexes of the autocorrelation graph relate to the frequency just as the indexes of the FFT? (see computeFrequency())&lt;/li&gt;&#xA;&lt;li&gt;Is there any kind of preprocessing that I am missing, etc?&lt;/li&gt;&#xA;&lt;li&gt;Is autocorrelation dependent on multiple harmonics being present?&lt;/li&gt;&#xA;&lt;li&gt;Are there any additional techniques that I can apply to better implement autocorrelation? Or preferred fundamental frequency finding algorithms? (I have looked a little at cepstrum and was having similar problems.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help received!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the output of an FFT. The peak is at index 47. I am positive I have implemented the FFT correctly. Index 47 matches up to E4 with a sampling frequency of 16,384 Hz and a padded FFT length of 1024.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7jcXW.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7jcXW.jpg&quot; alt=&quot;FFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know, in this case, that, choosing the highest peak will suffice. However, there are FFT's that are not this kind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the output of the Autocorrelation. The first peak is at index 25 and the second at index 50.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6gJyQ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6gJyQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code for the autocorrelation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * complexData is overlapped 50%.&#xA; * @param complexData&#xA; * @return&#xA; */&#xA;private Double[] autoCorrelation(final Complex[] complexData) {&#xA;    Complex[] toFFT = doubleAndPad(complexData);&#xA;&#xA;    Double[] autoCorrelationAbsolute = new Double[toFFT.length];&#xA;&#xA;    FFT.fftForward(toFFT);&#xA;&#xA;    for(int j = 0; j &amp;lt; toFFT.length; j++) {&#xA;        //Same as Complex.mult(toFFT[j], toFFT[j].conjugate()) but simpler&#xA;        double square = toFFT[j].absoluteSquare();&#xA;        toFFT[j] = new Complex(square);&#xA;    }&#xA;&#xA;    //Effective inverse FFT&#xA;    //forward FFT == inverse FFT for real numbers.&#xA;    FFT.fftForward(toFFT);&#xA;&#xA;    for(int i = 0; i &amp;lt; toFFT.length; i++) {&#xA;        autoCorrelationAbsolute[i] = toFFT[i].absolute();&#xA;    }&#xA;    return autoCorrelationAbsolute;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the code for doubling and padding&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Returns a copy of data with the size doubled and the&#xA; * second half set to zero.&#xA; * @param data&#xA; * @return&#xA; */&#xA;private Complex[] doubleAndPad(Complex[] data) {&#xA;    Complex[] doubledData = Arrays.copyOf(data, data.length * 2);&#xA;    //Set the second half to zero&#xA;    for(int i = data.length; i &amp;lt; doubledData.length; i++) {&#xA;        doubledData[i] = new Complex(0);&#xA;    }&#xA;    return doubledData;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I use to calculate the frequency.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/**&#xA; * Computes the frequency based off of the padded FFT in autoCorrelation&#xA; * @param bin&#xA; * @param data&#xA; * @return&#xA; */&#xA;public static double computeFrequency(int bin, AudioData data) {&#xA;    return bin * data.getFormat().getSampleRate() / data.getFftLength();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16798" LastActivityDate="2022-03-25T12:06:15.703" Title="Advice on autocorrelation via FFT" Tags="|autocorrelation|java|fundamental-frequency|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24928" PostTypeId="2" ParentId="24925" CreationDate="2015-07-28T01:29:00.383" Score="0" Body="&lt;p&gt;Yes, they have the same complexity because they are exactly the same. By calculating every $D^{th}$ sample you'll see there are $D$ filters needed - each with $L/D$ taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there is no advantage because the are exactly the same.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-07-28T01:29:00.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24929" PostTypeId="2" ParentId="24925" CreationDate="2015-07-28T01:53:12.643" Score="4" Body="&lt;p&gt;One advantage of the polyphase filter is when hardware resources are limited. The polyphase approach replaces a $L$ tap filter with $N$ filter sets of $L/N$ taps. Once you've done that you can just use a single $L/N$ filter set and swap coefficients.&lt;/p&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-07-28T01:53:12.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24930" PostTypeId="2" ParentId="24927" CreationDate="2015-07-28T04:31:45.050" Score="1" Body="&lt;p&gt;Didn't check the code, but the steps you describe in 1. seems correct.&lt;br&gt;&#xA;The units of the autocorrelation are time and not frequency, and it is centred around $\tau = 0$. That means that in your $-1024 \leq\tau&amp;lt; 1023$. So you are looking at the wrong peaks.&lt;br&gt;&#xA;Now as you can see the autocorrelation doesn't produce a sharp peak which means that it is not a good measure for your case. In general, the autocorrelation doesn't work well with narrow band signals.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest you try either the &lt;a href=&quot;http://www.cs.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf&quot; rel=&quot;nofollow&quot;&gt;MPM&lt;/a&gt; or the &lt;a href=&quot;http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf&quot; rel=&quot;nofollow&quot;&gt;YIN&lt;/a&gt; methods which are based on the autocorrelation, are extremely simple to implement and from my experience yield goo results.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2015-07-28T04:31:45.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24932" PostTypeId="2" ParentId="24847" CreationDate="2015-07-28T08:03:57.820" Score="0" Body="&lt;p&gt;Finally, I found my mistake. It was a combination of unfavorable parameters and the wrong computation of the prior error covariance. Yu et al. and Welch and Bishop actually give the same equation. I just got confused by the indices used by Yu et al. So the correct listing for the EKF should be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Apply extended Kalman filter equations &#xA;for k = 1:T&#xA;&#xA;% Apply time update&#xA;if k == 1&#xA;&#xA;    % Equation (15) in [Yu2004]&#xA;    X_prior(k, :) = f(x0);&#xA;    A = dfdx(x0);&#xA;    W = dfdw(x0);&#xA;&#xA;    % Equation (12) in [Yu2004]&#xA;    P_prior(:, :, k) = A * P0 * A' + W * Q * W';&#xA;&#xA;else&#xA;&#xA;    % Equation (15) in [Yu2004]&#xA;    X_prior(k, :) = f(X_posterior((k - 1), :)');&#xA;    A = dfdx(X_posterior((k - 1), :)');&#xA;    W = dfdw(X_posterior((k - 1), :)');&#xA;&#xA;    % Equation (12) in [Yu2004]&#xA;    P_prior(:, :, k) = A * P_posterior(:, :, (k - 1)) * A' + W * Q * W';&#xA;&#xA;end&#xA;&#xA;% Apply measurement update&#xA;H = dhdx(X_prior(k, :)');&#xA;V = dhdv(X_prior(k, :)');&#xA;&#xA;% Equation (11) in [Yu2004] using the pseudo inverse to handle&#xA;% badly scaled matrices &#xA;K = P_prior(:, :, k) * H' / (V * R * V' + H * P_prior(:, :, k) * H');&#xA;&#xA;% Equation (14) in [Yu2004]&#xA;X_posterior(k, :) = X_prior(k, :) + (K * (Z(k, :)' - h(X_prior(k, :)')))';&#xA;&#xA;% Equation (10) in [Yu2004]&#xA;P_posterior(:, :, k) = P_prior(:, :, k) - K * H * P_prior(:, :, k);&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for your comments and votes!&lt;/p&gt;&#xA;" OwnerUserId="16742" LastActivityDate="2015-07-28T08:03:57.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24934" PostTypeId="1" AcceptedAnswerId="24936" CreationDate="2015-07-28T09:03:22.387" Score="0" ViewCount="596" Body="&lt;p&gt;A time domain signal can be decomposed into sinusoids which are based on basis functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a N sampled input, a cosine basis function is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C_k[i] = \cos\left[\dfrac{2\pi k i}{N}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Range of Frequency $k = 0 \ldots \frac{N}{2}$, Range of $i = 0 \ldots N-1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the sinusoid angle divided by $N$?&lt;/p&gt;&#xA;" OwnerUserId="16804" LastEditorUserId="8202" LastEditDate="2015-07-28T09:39:25.977" LastActivityDate="2015-07-28T11:11:19.373" Title="DFT: Basis functions and Significance of dividing frequency by Sample length" Tags="|discrete-signals|signal-analysis|dft|fundamental-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24935" PostTypeId="2" ParentId="24906" CreationDate="2015-07-28T10:13:56.260" Score="-1" Body="&lt;p&gt;Yuler  code : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    def simulate_noise_YULER (self,data_to_simulat,ordre):&#xA;    ar, var, coeff_reflection = aryule(data_to_simulat, ordre)&#xA;    noise = np.random.normal(0, var**0.5, len(data_to_simulat))&#xA;&#xA;    ar=np.array(ar)&#xA;    elements=np.array([0]*ar.size)&#xA;    result=[]&#xA;    i=0&#xA;    new_element=0&#xA;    while i&amp;lt;len(data_to_simulat): &#xA;        new_element= elements.dot(ar)+ noise[i]&#xA;        result.append(float(new_element))&#xA;        j=0&#xA;        while j&amp;lt;len(elements)-1:&#xA;            elements[j+1]=elements[j]&#xA;            j+=1&#xA;        elements[0]=new_element&#xA;        i+=1&#xA;    return result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and Burg :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    def simulate_noise_BURG(self,data_to_simulat,ordre):&#xA;    ar, var, coeff_reflection = arburg(data_to_simulat, ordre)&#xA;    noise = np.random.normal(0, var**0.5, len(data_to_simulat))&#xA;&#xA;    i=0&#xA;    tmp_ar=[]&#xA;    while i&amp;lt;len(ar):&#xA;        tmp_ar.append(ar[i].real)&#xA;        i+=1&#xA;&#xA;    ar=np.array(tmp_ar)&#xA;&#xA;    elements=np.array([0]*ar.size)&#xA;&#xA;    result=[]&#xA;    new_element=0&#xA;    i=0&#xA;&#xA;    while i&amp;lt;len(data_to_simulat): &#xA;        new_element= elements.dot(ar)+ noise[i]&#xA;        result.append(float(new_element))&#xA;        j=0&#xA;        while j&amp;lt;len(elements)-1:&#xA;            elements[j+1]=elements[j]&#xA;            j+=1&#xA;        elements[0]=new_element&#xA;        i+=1&#xA;&#xA;    return result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16779" LastActivityDate="2015-07-28T10:13:56.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24936" PostTypeId="2" ParentId="24934" CreationDate="2015-07-28T11:01:28.407" Score="1" Body="&lt;p&gt;This normalises the frequency such that the period of the first cosine is N samples. Then all subsequent cosines are N/2 samples, N/3 samples.... all the way to N/(N/2) = 2 samples, at the Nyqust limit where k = N/2. If you want the full DFT, including negative frequencies, k should range from 0 to N-1.&lt;/p&gt;&#xA;" OwnerUserId="16404" LastEditorUserId="16404" LastEditDate="2015-07-28T11:11:19.373" LastActivityDate="2015-07-28T11:11:19.373" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24937" PostTypeId="2" ParentId="22429" CreationDate="2015-07-28T11:58:47.830" Score="2" Body="&lt;p&gt;Usually to test interpolation algorithm (for resizing, but also rotation and all sorts of &quot;reversible&quot; image transforms, you would apply the forward algorithm several times (ie resize to twice the size, take the result and resize it to 1.5x the size, etc .) and then apply all the backward transformations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more transforms you apply the more errors you will see and the more sensitive your comparison is. It can also represent your use case better (people pick an already resized image, resize it, and publish it)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you compute the max difference (or the standard deviation, or just visually compare) between the result and the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you can also apply all the forward transforms and then resize it once to the original size.&lt;/p&gt;&#xA;" OwnerUserId="15001" LastActivityDate="2015-07-28T11:58:47.830" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24938" PostTypeId="1" AcceptedAnswerId="25976" CreationDate="2015-07-28T13:02:39.083" Score="1" ViewCount="1269" Body="&lt;p&gt;Suppose I have two cameras, c1 and c2 that are securely installed and do not move.  What I want is a matrix T, that takes a pixel of an image from camera c1 and calculates the according pixel in an image from camera c2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now wonder:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to calibrate both c1 and c2 to get their intrinsic and extrinsic parameters and additionally find a relationship between the coordinate system of camera c1 and c2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I calculate a registration between an image of c1 and an image of c2 using interest points (e.g., by MATLABs cpselect and fitgeotrans functions) and use this registration matrix also for future images?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that a generally suitable transformation matrix &lt;strong&gt;&lt;em&gt;T&lt;/em&gt;&lt;/strong&gt; between the two cameras' images is only possible to get if you first calibrate both cameras (in the sense that you calculate the extrinsic and intrinsic parameters). In my feeling it is otherwise impossible to reflect the fact that we are dealing with 3D objects. &lt;strong&gt;&lt;em&gt;T&lt;/em&gt;&lt;/strong&gt; will only be able to transform the 2D images. Is this correct? If so, can you elaborate more on why this is the case?&lt;/p&gt;&#xA;" OwnerUserId="16462" LastActivityDate="2015-09-22T14:30:48.610" Title="Camera calibration vs. registration" Tags="|camera|image-registration|camera-calibration|camera-pose|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24939" PostTypeId="2" ParentId="24913" CreationDate="2015-07-28T13:07:46.863" Score="2" Body="&lt;p&gt;Those are good questions! Here's my &quot;two cents.&quot; Hilmar is correct, the integrator is not stable because there's a pole on the z-plane's unit circle. But I'll bet a pint of beer that the region of convergence is outside the pole (and therefore outside the unit circle) because the integrator's impulse response is causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer to question# 1: Matlab's freqz() command computes the freq response at zero Hz by evaluating a ratio of polynomials at various frequencies. And that ratio has a zero-valued denominator at zero Hz. So freqz() gives a freq mag response of infinity at zero Hz.  The DFT of an impulse response that's a finite-length sequence of ones, evaluated at zero Hz, is merely the sum of the impulse response samples.  The two approaches result in freq magnitude responses that are zero-valued at all frequencies except at zero Hz.  Both approaches give similar results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer to question# 2: You could, if you wish, call an integrator a &quot;filter.&quot; But it's unstable, and unstable filters are of no value in trying to filter real-world signals.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-07-28T13:07:46.863" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24941" PostTypeId="1" CreationDate="2015-07-28T13:14:32.173" Score="1" ViewCount="1091" Body="&lt;p&gt;I have done some measurements and I got two very noisy signals. I want to extract a certain sinusoid from the signals and I want to compute the phase shift between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made some simulations and I saw that the noise modifies a lot the value of the phase shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get a trustful value for the phase shift?&lt;/p&gt;&#xA;" OwnerUserId="16809" LastEditorUserId="13320" LastEditDate="2016-11-21T12:52:17.570" LastActivityDate="2016-11-21T12:52:17.570" Title="How can I extract a sinusoid from a very noisy signal for computing the phase shift?" Tags="|matlab|noise|phase|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24945" PostTypeId="1" CreationDate="2015-07-28T17:12:25.493" Score="0" ViewCount="855" Body="&lt;p&gt;Can anybody tell me why do we use single pole filter? And may be an example of Single pole filter in matlab. Good literature recommendations are also welcomed.Moreover, that would be good if anyone graphically explains, what happens to the signal when single pole filter is applied?&lt;/p&gt;&#xA;" OwnerUserId="16555" LastEditorUserId="16555" LastEditDate="2015-07-29T07:21:36.637" LastActivityDate="2015-07-29T07:21:36.637" Title="What is Single pole filter?" Tags="|matlab|filters|filter-design|filtering|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24946" PostTypeId="1" CreationDate="2015-07-28T20:42:49.513" Score="2" ViewCount="2505" Body="&lt;p&gt;I have seen several references to target at zero Doppler and some simulations that command users to place a target at zero Doppler. I know that when a target is flying tangential to the signal the Doppler is zero (is this even true?) but I have no clues as to what the target being at zero doppler means.&lt;/p&gt;&#xA;" OwnerUserId="16612" LastEditorUserId="90" LastEditDate="2015-07-29T15:00:45.523" LastActivityDate="2015-07-29T15:12:21.070" Title="What does &quot;A Target with Zero Doppler&quot; Mean?" Tags="|algorithms|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24948" PostTypeId="2" ParentId="24946" CreationDate="2015-07-28T22:53:40.617" Score="3" Body="&lt;p&gt;In Pulse Doppler Radar, the Doppler frequency that a target's return signal exhibits can be used to calculate the Radial Velocity of target.  That means, the return frequency of a pulse will be different than the frequency of the pulse that was sent out depending on how fast the target is moving toward the source of the pulse.  If the target's &quot;Radial Velocity&quot; is zero, zero doppler will result, i.e. the resulting doppler caused by the target's Radial Velocity will be 0 Hz.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia shows the calculation of Doppler to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F_{Doppler} = \frac{2 * F_{Transmit} * V_{Range} }{c} &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c$ being the Speed of light.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if the target's Radial Velocity is zero (not moving towards or away from the observer), $F_{Doppler}$ will also be zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Pulse-Doppler_radar&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Pulse-Doppler_radar&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11064" LastEditorUserId="90" LastEditDate="2015-07-29T15:12:21.070" LastActivityDate="2015-07-29T15:12:21.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24949" PostTypeId="2" ParentId="24403" CreationDate="2015-07-29T01:26:59.360" Score="1" Body="&lt;p&gt;By definition, the Impulse Response of a Filter is the response the filter has to an Impulse: &lt;a href=&quot;https://en.wikipedia.org/wiki/Impulse_response&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Impulse_response&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your Cascaded Integrator Comb Filter is an optimized FIR filter, it's response will be Finite in length (as opposed to IIR - Infinite Impulse Response) and you can calculate this response by sending a single maximum value followed by zeros through it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mentioned [1, 0, 0, 0] is not an impulse response since 0 represents -1.  I believe the value that represents 0 would be half of the unsigned maximum value in this situation.  If your values are Unsigned integers from 0 to 255 with 0 representing the largest negative value (-1) and 255 representing the highest positive value (+1), you should put a maximum value (255) followed by zero values (128).  After the filter, you will probably shift/scale/truncate back to the previous bit-width to account for bit growth/gain of the filter.  This will give you the values of your Filter's Impulse Response.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have a right idea for calculating the Impulse Response when you tried input '10101010...'  and '11010101010...' (these are really like putting in [1 -1 1 -1 ...] and [1 1 -1 1 -1 1 ...]).  Since FIR filters (CIC in this case) are linear systems, you can use the Superposition rule and add the inputs and then filter.  You will get the same answer as filtering the signals separately and then adding. That is why your experiment gives you twice the filter impulse response.  If you add after you filter, you will still get twice the filter impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I proved this to myself with this example (MATLAB):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a is your filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = [1 -1 1 1 1 -1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and b and c are your inputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = [1 -1 1 -1 1 -1 1 -1 1 -1 1]&#xA;c = [1 1 -1 1 -1 1 -1 1 -1 1 -1]&#xA;&#xA;filter(a,1,b) + filter(a,1,c) = [2 -2 2 2 2 -2 0 0 0 0 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is two times your filter impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you still get the filter impulse response by inputting a single max input:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter(a,1,[1 0 0 0 0 0 0 0 0 0 0 ]) = [1 -1 1 1 1 -1 0 0 0 0 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For a very good treatment of CIC filter analysis, see:&#xA;&lt;a href=&quot;http://dspguru.com/sites/dspguru/files/cic.pdf&quot; rel=&quot;nofollow&quot;&gt;http://dspguru.com/sites/dspguru/files/cic.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate the Frequency Magnitude Response of your filter, you can take the FFT of the coefficients.  To plot it, you should do something like this in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;impResp = [1 -1 1 1 1 -1];&#xA;&#xA;freqDomain = fft(impResp);&#xA;fSamp = 100;&#xA;frequencies = -fSamp/2:fSamp/(numel(impResp)-1):fSamp/2;&#xA;&#xA;figure&#xA;plot(frequencies,db(abs(fftshift(freqDomain))))&#xA;xlabel('frequencies')&#xA;ylabel('db')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This filter does not have a very interesting Impulse response, though.&lt;/p&gt;&#xA;" OwnerUserId="11064" LastActivityDate="2015-07-29T01:26:59.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24950" PostTypeId="1" AcceptedAnswerId="24952" CreationDate="2015-07-29T01:46:50.437" Score="2" ViewCount="4242" Body="&lt;p&gt;Are Finite Impulse Response filters always linear? I looked at &lt;a href=&quot;https://en.wikipedia.org/wiki/Nonlinear_filter&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Nonlinear_filter&lt;/a&gt; and its says that if a filter does not obey linearity, it is non-linear filter. Thats understood? But does does linearity has to do with the length of impulse response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="16080" LastActivityDate="2015-07-29T15:00:35.167" Title="FIR filters always linear?" Tags="|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24952" PostTypeId="2" ParentId="24950" CreationDate="2015-07-29T02:35:08.483" Score="3" Body="&lt;p&gt;Yes, FIR filters are linear.  No, the length of the impulse response does not have anything to do with whether it is linear or not.  For instance, IIR filters are also linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linearity is determined by whether the filter obeys the &lt;a href=&quot;https://en.wikipedia.org/wiki/Superposition_principle&quot; rel=&quot;nofollow&quot;&gt;superposition principle&lt;/a&gt;, nothing else.  So, FIR and IIR filters are linear, &lt;a href=&quot;https://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;median filters&lt;/a&gt; are not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Technically Dilip is correct.  Finite and infinite impulse response filters can be non-linear if their impulse responses incorporate non-linear operations, such as squaring.  I was going by the &quot;industry&quot; meaning of FIR and IIR, which are linear because they only use multiplication and adding, but in the mathematical sense FIR and IIR filters can be non-linear.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2015-07-29T15:00:35.167" LastActivityDate="2015-07-29T15:00:35.167" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="24954" PostTypeId="1" CreationDate="2015-07-29T06:02:08.980" Score="1" ViewCount="162" Body="&lt;p&gt;I have a question about invariances in neural networks. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In general, neural nets with enough layers can learn arbitrarily complicated nonlinear functions. Therefore, it's not hard to understand how a neural net can learn a Fourier transform or convolution: (3rd to last paragraph of this page: &lt;a href=&quot;http://www.dspguide.com/ch26/3.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch26/3.htm&lt;/a&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fourier transforms have a useful translation (shift) invariance property, i.e. the magnitude of the FT of a function/image remains the same after you translate it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Other transforms also have useful invariance properties, e.g. the Mellin transform is scale invariant, i.e. the magnitude of the Mellin transform of a function/image remains the same after you scale it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So my question is about why neural networks don't already have built in invariances. Is it purely a matter of number of neurons? If I have an enormously large number of neurons and/or layers, do I start to get built in invariances? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(E.g. as described in above link, you need 2 layers of N nodes to learn convolution of an N sample signal. Also, not every single neuron is going to be weighted in such a way to participate in learning convolution, so you'll need many more neurons than just 2N.)&lt;/p&gt;&#xA;" OwnerUserId="13407" LastActivityDate="2016-01-26T01:04:33.930" Title="Invariances in Neural Networks" Tags="|image-processing|fourier-transform|computer-vision|machine-learning|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24956" PostTypeId="2" ParentId="24950" CreationDate="2015-07-29T08:14:57.810" Score="2" Body="&lt;p&gt;No! FIR filters are NOT always linear phase.  The acronym 'FIR&quot; only tells you that the impulse response is finite in duration, nothing more and nothing less. So called &quot;minimum phase&quot; FIR filters are not linear phase.  (A tapped-delay line, lowpass, FIR filter whose coefficients are [0.5, 0.7, 0.9, 0.8, 0.55] has a finite duration impulse response but it's NOT linear phase.) Also, phase linearity does NOT depend on the length of an FIR filter's impulse response.  FIR filters using real-valued coefficients have linear phase if those coefficient values are exactly symmetrical.  FIR differentiators &amp;amp; Hilbert transformers using real-valued coefficients have linear phase if those coefficient values are exactly antisymmetrical.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-07-29T08:14:57.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24957" PostTypeId="2" ParentId="24954" CreationDate="2015-07-29T08:28:11.123" Score="0" Body="&lt;p&gt;Convolutional neural network are translation invariant (at least the convolutionnal layers). This is enforced by the structure of the network, so you can say it is built in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They can learn rotation invariance to some extent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also build in scale invariance by presenting the input image at different resolutions to the network.&lt;/p&gt;&#xA;" OwnerUserId="15001" LastActivityDate="2015-07-29T08:28:11.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24958" PostTypeId="2" ParentId="17142" CreationDate="2015-07-29T08:48:42.200" Score="1" Body="&lt;p&gt;Here's some Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Assume 'x' is the input time-domain sequence and 'y' is it's Hilbert transform.&#xA;&#xA;Analytic_Signal = hilbert(x);&#xA;y = imag(Analytic_Signal);&#xA;&#xA;Instantaneous_Magnitude = abs(Analytic_Signal);&#xA;&#xA;Instantaneous_Phase = unwrap(atan2(y, x));&#xA;&#xA;Instantaneous_Freq = diff(Instantaneous_Phase);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="8202" LastEditDate="2015-07-29T11:08:39.633" LastActivityDate="2015-07-29T11:08:39.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24959" PostTypeId="2" ParentId="24846" CreationDate="2015-07-29T09:00:24.330" Score="1" Body="&lt;p&gt;I'd really recommend going for a short-time fourier transform such as that produced by: &lt;a href=&quot;http://matplotlib.org/api/mlab_api.html#matplotlib.mlab.specgram&quot; rel=&quot;nofollow noreferrer&quot;&gt;matplotlib.mlab.specgram&lt;/a&gt;. It gives you the change in the spectrum over time and can be calculated using PSD or the magnitude spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I'd recommend this is that your guitar signal is not spectrally stationary; your graphs are only a snapshot at one point in time. What gives your guitar string their tonal differences is the way all the harmonics shown above change over the length of the note. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a very good summary of PSD vs FFT magnitude &lt;a href=&quot;https://dsp.stackexchange.com/questions/4691/what-is-the-difference-between-psd-and-squared-magnitude-of-frequency-spectrum&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/2096/why-so-many-methods-of-computing-psd&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-08-10T09:52:28.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24960" PostTypeId="1" AcceptedAnswerId="24968" CreationDate="2015-07-29T09:01:54.127" Score="1" ViewCount="1484" Body="&lt;p&gt;How to apply single pole filter to simple signal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 500;&#xA;ts = 1/fs;&#xA;t = 0:ts:1-ts;&#xA;fc = 50;&#xA;S = cos(2*pi*fc*t);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16555" LastActivityDate="2015-07-29T15:48:39.607" Title="applying single pole filter to simple signal" Tags="|matlab|fft|filters|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24961" PostTypeId="2" ParentId="24941" CreationDate="2015-07-29T09:16:59.713" Score="1" Body="&lt;p&gt;You are correct. Estimating the instantaneous phase of a noisy sinusoid is NOT easy.  I suggest you design a narrow bandpass filter such that your sinusoid-of-interest is in the filter's passband.  (The better the filter the more noise that will be eliminated.) Pass your two signals through the bandpass filter to generate filtered signals $x_1[n]$ and $x_2[n]$.  Next, pass your $x_1[n]$ and $x_2[n]$ signals through a Hilbert transformer to generate $\hat{x}_1[n]$ and $\hat{x}_2[n]$.  Create two analytic (complex) signals as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z_1[n] = x_1[n] + j \, \hat{x}_1[n],$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and  $$z_2[n] = x_2[n] + j \, \hat{x}_2[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;\hat{x}[n] &amp;amp; = \mathcal{H}\{ x[n] \} \\&#xA;           &amp;amp; = \sum\limits_{m=-\infty}^{+\infty} \frac{1 - (-1)^{m}}{\pi \, m}   x[n-m]  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, compute two instantaneous phase sequences: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi_1[n] = \arg\{z_1[n]\}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $$\phi_2[n] = \arg\{z_2[n]\}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, compare the instantaneous phase difference between the $\phi_1[n]$ and $\phi_2[n]$ sequences.  &lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="4346" LastEditDate="2015-09-13T03:36:58.077" LastActivityDate="2015-09-13T03:36:58.077" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24962" PostTypeId="1" CreationDate="2015-07-29T09:17:54.863" Score="0" ViewCount="483" Body="&lt;p&gt;I'm trying to understand the correlation between RF analyzesrs and WiFi.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the device's datasheet I see that it has a sample rate of (max.) 100msec.&#xA;[to my understanding, the device can measure the signal strength/power 10 times  (or less) per/each 1 second].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that WiFi signals are being transmitted in bursts.&#xA;Hunderds/thousands transmissions per 1 second. &#xA;Each transmission last for a very short time, 3-5micro-second.&#xA;That is to say, that each 1 second there is a signal transmission-pause-signal transmission-pause and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the analyzer measure only 5-10 times each second, is it a &lt;strong&gt;theoretical&lt;/strong&gt; possibilty that the device can miss [shall not measure] most of the signals? &lt;/p&gt;&#xA;" OwnerUserId="16821" LastActivityDate="2015-07-29T09:17:54.863" Title="WiFi and the sampling rate of spectrum analyzer" Tags="|power-spectral-density|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24963" PostTypeId="1" AcceptedAnswerId="24965" CreationDate="2015-07-29T09:50:59.710" Score="1" ViewCount="13557" Body="&lt;p&gt;Does anyone can link me to a good C# DSP library? I saw some good C++ libraries but I don't have much with C++. Is there any way to wrap them ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My main porpuse is to apply some filters(Lowpass, Highpass,Notch....) on a a buffer. Thanks&lt;/p&gt;&#xA;" OwnerUserId="15637" LastActivityDate="2020-02-05T05:11:41.857" Title="Any good C# library for signal processing?" Tags="|discrete-signals|filter-design|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24965" PostTypeId="2" ParentId="24963" CreationDate="2015-07-29T11:06:10.747" Score="6" Body="&lt;p&gt;I can recommend these libraries:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.un4seen.com/&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;BASS&lt;/strong&gt;&lt;/a&gt; - also has lot's of functions. Although it is not written for C#, they provide you with a wrapper (Bass.Net). Keep in mind that if you want to use this library in commercial project then you have to pay for the license.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/naudio/NAudio&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;NAudio&lt;/strong&gt;&lt;/a&gt; - is a mature project with lots of functions and support for variety of codecs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/filoe/cscore&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;cscore&lt;/strong&gt;&lt;/a&gt; - rather new project with some nice capabilities, especially for visualizations, and some codecs that NAudio is missing. You might want to give it a try at some point, or even contribute to it. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-07-30T07:51:26.503" LastActivityDate="2015-07-30T07:51:26.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24966" PostTypeId="2" ParentId="24960" CreationDate="2015-07-29T12:39:03.680" Score="1" Body="&lt;p&gt;If your pole is at $z=p$ (real or complex), this will do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = filter( [1], [1, -p], S );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Free bonus: if you also want a zero at $z = c$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Y = filter( [1, -c], [1, -p], S);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This last expression corresponds to the filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{1 - c z^{-1}}{1 - p z^{-1}}$$&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-07-29T12:39:03.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24968" PostTypeId="2" ParentId="24960" CreationDate="2015-07-29T15:30:25.823" Score="1" Body="&lt;p&gt;Given the transfer function of a single pole filter (without a zero):&lt;br&gt;&#xA;$$H(z)= \frac{Y(z)}{X(z)} = \frac{1}{1-pz^{-1}}$$&#xA;Using the inverse z transform leads to the following equation: &#xA;$$y[n] = x[n] + p y[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your single pole filter can be implemented using a for-loop.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 500; &#xA;fc = 50; &#xA;K = fs;  % 1 second of data&#xA;k = 0:(K-1);&#xA;x = cos(2*pi*fc/fs*k);&#xA;&#xA;y = zeros(K,1);&#xA;&#xA;p = 0.5;&#xA;y(1) = 0;  % Choose some initialization for y(1)&#xA;for n = 2:K&#xA;    y(n) = x(n) + p*y(n-1);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another 'simple' test signal that can be used to visualize the behaviour of your filter is a random signal.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = randn(K,1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The spectrum of the filtered random signal shows the frequency characteristics of the filter. &lt;/p&gt;&#xA;" OwnerUserId="16570" LastEditorUserId="16570" LastEditDate="2015-07-29T15:48:39.607" LastActivityDate="2015-07-29T15:48:39.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24969" PostTypeId="1" CreationDate="2015-07-29T16:08:36.267" Score="4" ViewCount="254" Body="&lt;p&gt;Checking the literature about image segmentation, if I am not wrong, there are two main approaches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Variational approach e.g. level-set optimization in Chan-Vese&lt;/li&gt;&#xA;&lt;li&gt;Combinatorial approach e.g. using graph cut in GrabCut&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can someone give me some high-level comparison between these two directions? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I feel with level-set optimization one can easily  incorporate image structure (e.g. edges) into the energy function, which is not easy in Grabcut. Am I correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="16825" LastEditorUserId="128" LastEditDate="2018-07-28T16:03:44.987" LastActivityDate="2022-08-07T09:07:40.877" Title="Image Segmentation - Comparing GrabCut Method vs. Level Set Method" Tags="|image-processing|computer-vision|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="24970" PostTypeId="1" CreationDate="2015-07-29T17:54:54.470" Score="0" ViewCount="2615" Body="&lt;p&gt;I have a dataset consisting of fMRI images (from mice) which are divided into 4 groups (different drug dose levels applied). Each fMRI image is 4D, that means each voxel is a time series. For each fMRI image I want to extract one feature vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to use wavelet decomposition for feature extraction. In Matlab there exist no 4D wavelet decomposition, so I turn the 4D images into 3D by taking the average of the time series. Then I could apply 3D wavelet decomposition and taking the LL component as features, that means doing something like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WT = wavedec3(fMRI, 4, 'db4');&#xA;LL = WT.dec(1);&#xA;temp = cell2mat(LL);&#xA;feature_vector = temp(:);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course afterwards feature selection algorithms (like recursive feature elimination) could be applied to reduce dimensionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possibility would be to to the 3D wavelet decomposition for each 3D volume and extracting the LL component. This I could do for each time point and then stacking up the LL components to get a big feature vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think of this approach? Are there better approaches? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit: Here is an image: &lt;a href=&quot;https://www.dropbox.com/s/50gr2f1c66stcq4/tCut10_4D1c0_iso2238-brain.nii.gz?dl=0&quot; rel=&quot;nofollow&quot;&gt;https://www.dropbox.com/s/50gr2f1c66stcq4/tCut10_4D1c0_iso2238-brain.nii.gz?dl=0&lt;/a&gt;&#xA;I have found the following approach in a &lt;a href=&quot;http://knight.cis.temple.edu/~vasilis/research/Publications/CARS08.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;we decided to use the concatenation of the high-order sub-band&#xA;  coefficients from each decomposition as a feature vector in k-nearest&#xA;  neighbor classification&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I get the high-order sub-band coefficients in Matlab (using e.g. wavedec3)? And what do they mean with each decomposition?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8859" LastEditorUserId="8859" LastEditDate="2015-07-30T10:26:50.193" LastActivityDate="2015-07-30T10:26:50.193" Title="How to use wavelet decomposition for feature extraction (of fMRI images)?" Tags="|image-processing|matlab|wavelet|machine-learning|dct|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="24972" PostTypeId="1" AcceptedAnswerId="24978" CreationDate="2015-07-29T18:48:42.883" Score="1" ViewCount="2463" Body="&lt;p&gt;I have the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{z^3+5z^2+3z+1}{10z^3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find out whether if its IIR or FIR. Here is the steps I have gone so far:&#xA;$$H(z) = \frac{1}{10}\frac{z^3+5z^2+3z+1}{z^3}$$ &#xA;Dividing nominator with denominator to find reminder gave me(I think its wrong):&#xA;$$z^3+5z^2+3z$$&#xA;After this step I have a $1$ as remainder and I do not know what to do with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please tell me the right procedure step by step?&lt;/p&gt;&#xA;" OwnerUserId="16793" LastEditorUserId="16793" LastEditDate="2015-07-29T18:57:20.053" LastActivityDate="2015-07-30T16:22:13.793" Title="Check if a filter is IIR or FIR" Tags="|filters|infinite-impulse-response|impulse-response|finite-impulse-response|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="24973" PostTypeId="2" ParentId="24972" CreationDate="2015-07-29T19:56:48.523" Score="1" Body="&lt;p&gt;If you can express it exactly with a polynomial in $z$ or $z^{-1}$ (or both), then it will be FIR. Here $H(z)= \frac{1}{10}(1+5z^{-1}+3z^{-2}+z^{-3})$ with a simple term-by-term division. So you have a FIR filter here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionnally, a generic IIR $z$-transform $H(z) = \sum_{k = -\infty}^{\infty} h_k z^{-k}$ cannot generally be written as $P(z)/Q(z)$ or $R(z)$, with $P$, $Q$, $R$ polynomials in $z$ or $z^{-1}$. One of the important tasks in filter design is to find close approximations to  $H(z)$ as $P(z)/Q(z)$ or $R(z)$, generally with low-degree polynomials, constraints on zeroes and poles, and different types of &quot;closeness&quot; measures (in time, in frequency, etc.)&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-07-30T16:22:13.793" LastActivityDate="2015-07-30T16:22:13.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24978" PostTypeId="2" ParentId="24972" CreationDate="2015-07-30T09:26:03.690" Score="6" Body="&lt;p&gt;In the general case you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{P(z)}{Q(z)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $P(z)$ and $Q(z)$ are polynomials in $z$. If - as is the case in your example - $Q(z)$ just has one single term, $H(z)$ is definitely FIR, because you can simply divide each term of $P(z)$ by that respective power of $z$, and the number of terms of $H(z)$ equals the number of terms of $P(z)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $Q(z)$ is a polynomial with finite zeros away from $z=0$, then $H(z)$ is generally IIR, except if all zeros of $Q(z)$ are cancelled by zeros of $P(z)$. One example of such a case is a recursive moving average (where $N$ is the window length):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{N}\frac{1-z^{-N}}{1-z^{-1}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The zero of the denominator is cancelled by one of the zeros of the numerator, so the transfer function $(1)$ can equialenty be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{N}(1+z^{-1}+\ldots+z^{-N+1})\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is obviously FIR.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-07-30T09:26:03.690" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24980" PostTypeId="1" CreationDate="2015-07-30T10:23:48.330" Score="1" ViewCount="303" Body="&lt;p&gt;Sorry if this is not the right forum.&#xA;Having a velocity grid in which a wave propagates, and given a certain spatial sampling of the grid, what kind of smoothing/interpolation should be used if the grid is to be resampled (decimated) ?&#xA;In the top picture below, I have a velocity grid with a grid resolution of 5 meters. I need to decimate to 25 meters instead. The colorbar shows the velocity variation. The middle picture is the first gradient along the vertical and the bottom picture is the second gradient.&#xA;Given waves with central frequency from 10Hz to 30Hz, what kind of smoothing should be applied before decimation to avoid spatial aliasing (least possible) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/we7Xd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/we7Xd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2015-07-30T10:23:48.330" Title="Spatial resampling, how to smooth?" Tags="|smoothing|resampling|spatial|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24982" PostTypeId="1" CreationDate="2015-07-30T11:59:15.793" Score="3" ViewCount="1142" Body="&lt;p&gt;Consider the LTI system with frequency response&#xA;$$H(e^{j\omega}) = \frac{1-e^{-j2\omega}}{1+\frac{1}{2}e^{-j4 \omega}}, -\pi &amp;lt; \omega &amp;lt; \pi$$&#xA;Determine the output $y[n]$ for all $n$ if the input $x[n]$ for all $n$ is&#xA;$$x[n] = \sin \left(\frac{\pi n}{4}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My attempt&lt;/strong&gt;: $x[n]$ is an eigenfunction of the LTI system, so the output have the form&#xA;$$y[n]=|H(e^{j \omega})|\sin\left(\frac{\pi n}{4} + arg(H(e^{j \omega})\right)$$&#xA;But I dont know how to determine the phase and modulus of the frequency response with this form. For example, I think that&#xA;$$| 1 - e^{-j 2 \omega} | = \sqrt{(1-\cos(2 \omega))^2 + \sin^2(2 \omega)}$$&#xA;Analogous, doing for the denominator, I could not simplificate the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=2 \sqrt{2} \sin \left( \frac{\pi(n+1)}{4} \right) $$&lt;/p&gt;&#xA;" OwnerUserId="16832" LastActivityDate="2015-07-30T14:04:32.723" Title="System response: LTI system for $x[n] = \sin(\frac{\pi n}{4})$" Tags="|discrete-signals|frequency-response|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24984" PostTypeId="2" ParentId="24982" CreationDate="2015-07-30T13:59:19.190" Score="6" Body="&lt;p&gt;You're definitely on the right track. The way you're trying to solve the problem is the best and simplest. You just need to realize that you need to evaluate the magnitude and phase of the frequency response just for one frequency, namely the frequency of the sinusoidal input signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\left|H(e^{j\omega_0})\right|\sin\left(n\omega_0+\phi(\omega_0)\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\omega_0=\pi/4$ and $H(e^{j\omega})=\left|H(e^{j\omega})\right|e^{j\phi(\omega)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluating the given frequency response at $\omega_0=\pi/4$ gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1-e^{-j\pi/2}}{1+\frac12 e^{-j\pi}}=\frac{1+j}{1-\frac12}=2(1+j)=2\sqrt{2}e^{j\pi/4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which the correct result follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final note, you incorrectly called the sinusoidal input signal an eigenfunction of the LTI system. This is not true, it is the complex exponential $e^{jn\omega_0}$ that is an eigenfunction, because it appears at the output unchanged other than scaled by a complex constant (the eigenvalue, which happens to be the value of the complex frequency response evaluated at the given frequency). This is not true for a sinusoid, which is not simply scaled by the LTI system.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-07-30T14:04:32.723" LastActivityDate="2015-07-30T14:04:32.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24986" PostTypeId="2" ParentId="2262" CreationDate="2015-07-30T18:52:00.617" Score="1" Body="&lt;p&gt;The specific symbol rate numbers you cited are the Annex B standard values for 64 QAM and 256 QAM, which are specific profiles with set parameters including fixed symbol rates and bitrates.  Annex A is more flexible.&lt;/p&gt;&#xA;" OwnerUserId="16840" LastActivityDate="2015-07-30T18:52:00.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24989" PostTypeId="1" CreationDate="2015-07-31T01:55:54.947" Score="0" ViewCount="1014" Body="&lt;p&gt;I've been trying to design a bandpass filter using scipy but I keep getting a LinAlg Singular Matrix error. I read that a singular matrix is one that is not invertable, but I'm not sure how that error is coming up and what I can do to fix it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code takes in an EEG signal (which, in the code below, I have just replaced with an int array for testing) and filters out frequencies &amp;lt; 8Hz and &gt; 12Hz (alpha band)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone shed some light on where the singular matrix error is coming from? Or alternatively, if you know of a better way to filter a signal like this I'd love to test out other options too&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from scipy import signal&#xA;from scipy.signal import filter_design as fd&#xA;import matplotlib.pylab as plt&#xA;&#xA;#bandpass&#xA;Wp = [8, 12]   # Cutoff frequency&#xA;Ws = [7.5, 12.5]   # Stop frequency&#xA;Rp = 1             # passband maximum loss (gpass)&#xA;As = 100              # stoppand min attenuation (gstop)&#xA;&#xA;b,a = fd.iirdesign(Wp,Ws,Rp,As,ftype='butter')&#xA;w,H = signal.freqz(b,a)  # filter response&#xA;plt.plot(w,H)&#xA;&#xA;t = np.linspace(1,256,256)&#xA;x = np.arange(256)&#xA;plt.plot(t,x)&#xA;&#xA;y = signal.filtfilt(b,a,x)&#xA;plt.plot(t,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16842" LastActivityDate="2021-11-27T19:07:21.673" Title="Python bandpass filter - singular matrix error" Tags="|filters|python|bandpass|eeg|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24991" PostTypeId="1" AcceptedAnswerId="25062" CreationDate="2015-07-31T03:01:37.027" Score="1" ViewCount="137" Body="&lt;p&gt;I am research in brain segmentation task that classify a brain in to 3 classes : White Matter, Gray Matter and CSF. To validate my method, I used Dice Coefficient that compare my result and ground truth result. However, I am confusing about ground truth result. As I found that ground truth brain of &lt;a href=&quot;http://brainweb.bic.mni.mcgill.ca/faq.html#fuzzy-vs-discrete&quot; rel=&quot;nofollow&quot;&gt;brainweb service&lt;/a&gt; has two models: fuzzy and discrete models. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;A fuzzy phantom will specify a mixture of tissue classes for each voxel (eg. a voxel might contain 90% grey matter and 10% white matter). A fuzzy phantom was used to describe the tissue within each voxel during the simulation process.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;A discrete phantom specifies the tissue type with the largest proportion in each voxel. A discrete phantom was not used in the simulation process. However a user might use this phantom when comparing simulated data against the underlying tissue types (eg. a user might have a classification algorithm which classifies each voxel into one specific tissue type).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They suggest that &lt;em&gt;&quot;If your method attempts to estimate the partial volume (that is, the tissue fractions in each voxel) then the fuzzy model is probably what you want. Otherwise, the discrete model will probably do...&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that information, &lt;strong&gt;Which model can I used for segmentation task?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As my knowledge, I think that discrete model must be used. How about you? &lt;/p&gt;&#xA;" OwnerUserId="8264" LastActivityDate="2015-08-04T21:10:19.377" Title="Which anatomical model to use as &quot;ground truth&quot; for validating an MRI segmentation method?" Tags="|computer-vision|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24992" PostTypeId="2" ParentId="24989" CreationDate="2015-07-31T03:22:27.120" Score="0" Body="&lt;p&gt;I'd suggest checking again your parameter choices for&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b,a = fd.iirdesign(Wp,Ws,Rp,As,ftype='butter')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Looking at the resulting filter coefficients, you have pole/zero cancellation at DC, i.e. at $z=1$.&lt;/p&gt;&#xA;" OwnerUserId="16767" LastActivityDate="2015-07-31T03:22:27.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="24994" PostTypeId="1" CreationDate="2015-07-31T05:05:55.083" Score="4" ViewCount="2000" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4yG4X.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4yG4X.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;I have an input sequence $x(n)$ and impulse sequence &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;h(n) = \begin{cases} 0 &amp;amp; \quad \text{when } n = 0 \\ .239052 &amp;amp; \quad \text{when } n = 1 \\1.3357\exp(-0.650286n) &amp;amp; \quad \text{when } n &amp;gt; 1\\ \end{cases}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did a convolution and obtained $y(n)=x(n)*h(n)$. I trimmed some of the data  in the end from $y(n)$ and then I flipped $h(n)$ and I did reverse filtering $w(n)=y(n)*h(-n)$.&#xA;When I researched about this I found &lt;code&gt;filtfilt&lt;/code&gt; in matlab is an easier option but I am trying to implement this in C.&#xA;So my question is without trimming the first output sequence  $y(n)$ I am getting a drifted version of the result (there is a delay). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it trimming really necessary or am I doing something wrong here.&lt;br&gt;&#xA;One more question is I can see some transients both at the start and end  of $w(n)$ sequence when I use &lt;code&gt;filtfilt&lt;/code&gt; I don't see that transients.The reason is matlab is using some initial states based on the below paper to get rid of the transients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gustafsson, F. &quot;Determining the initial states in forward-backward filtering.&quot; IEEE® Transactions on Signal Processing. Vol. 44, April 1996, pp. 988–992.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it trimming really necessary ?&#xA;PS the figure attached without trimming the the resultant data has a lag..Trimming the $y(n)$ sequence before backward filtering aligns the result.&lt;/li&gt;&#xA;&lt;li&gt;how to determine the initial states for getting rid of transients.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2006" LastEditorUserId="128" LastEditDate="2020-03-13T08:50:03.300" LastActivityDate="2020-03-13T08:50:03.300" Title="Forward and Backward Filtering (MATLAB's `filtfilt()`)" Tags="|matlab|filters|phase|c|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="24995" PostTypeId="1" CreationDate="2015-07-31T06:13:20.867" Score="-1" ViewCount="278" Body="&lt;p&gt;for Rectangular window if data length is 1K then FFT Length Should be 1K FFT only because ENBW of rectangualr window is 1.0 but for Minimum 4-Sanple BlackmannHarris window is 2.0. so for improving accuracy in terms of either frequency or amplitude which method is preferrded in below &#xA;1. for 1K Data i will append 1K zeros and Caluclate 2K FFT or &#xA;2. instead of 1K data take 2K data and calclate 2K FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or else any other method please calrify ..&lt;/p&gt;&#xA;" OwnerUserId="16557" LastActivityDate="2016-07-26T07:45:38.843" Title="what is the preffered data and FFT length for blackman harris window for improving Accuracy due to ENBW Consideration of window?" Tags="|fft|dft|window-functions|harris|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="24996" PostTypeId="2" ParentId="24994" CreationDate="2015-07-31T06:23:52.347" Score="-1" Body="&lt;p&gt;My opinion is that the trimming isn't necessary.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method in the paper is based on a simple idea, if we filter the signal $ x [n] $ forward and then backward, the result should be equal to the result of doing it backward and then forward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper shows how to chose the initial conditions which minimize the $ {\ell}_{2} $ norm between the the different approaches.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-07-31T06:23:52.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="24998" PostTypeId="1" AcceptedAnswerId="24999" CreationDate="2015-07-31T11:29:31.643" Score="4" ViewCount="1727" Body="&lt;p&gt;For a system to be linear,it follow the principles of scaling and superposition.Does scaling imply superposition?If so why are two different conditions given for linearity?If not can u specify an example for which only one of them is satisfied.&lt;/p&gt;&#xA;" OwnerUserId="16360" LastEditorUserId="80" LastEditDate="2016-11-21T08:39:59.287" LastActivityDate="2016-11-21T08:39:59.287" Title="Does scaling property imply superposition?" Tags="|linear-systems|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="24999" PostTypeId="2" ParentId="24998" CreationDate="2015-07-31T14:28:08.070" Score="4" Body="&lt;p&gt;The answer is &quot;no&quot; in general. Let us see the details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notion of linearity goes beyond systems. Let us start from vector, or linear spaces. They deal with two objects: vectors and &quot;scalars&quot;. In a vector space, one can add vectors, and multiply a vector by a scalar. More formally, a vector space over a field $F$ is a set $V$ together with two operations, vector addition and scalar multiplication. Those operations in $V$ satisfy a number of axioms. The field $F$ possesses two operations as well, satisfying different axioms, namely field axioms, ruling the addition or product of scalars. Those two operations are often assimilated to addition and multiplication. But in general the addition/multiplication in $F$ are not the same as the vector addition/vector scaling in $V$. Indeed, if $f \in F$, $v\in V$, then $f.v \in V$, but is not anymore an element of $F$. The scalar has been cast to a vector. This plays a role in the standard confusion in defining linearity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now take for instance the field of rationals $F=\mathbb{Q}$ with the two standard operations. Take $V=\mathbb{R}$ the vector space of reals over $F$ with the standard real addition and real product. To relate this to the introduction, for instance, $1.\sqrt{2}$ is not rational anymore, although the multiplication seems to be the same, because you mix a scalar ($1$) and a vector $(\sqrt{2})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you have a system $S$ that provides the following output: if $v_1\in V$ is rational, $S(v_1) = v_1$; if $v_2\in V$ is irrational, $S(v_2) = -v_2$. For any rational $q$, $q.v_1$ is rational, and  $q.v_2$ is irrational. Resultingly, $S(q.v_1) = q.v_1 = q.S(v_1)$, and  $S(q.v_2) = -q.v_2 = q.S(v_2)$. Hence, $s(q.v) = q.S(v)$ for any $v\in V$, so $S$ verifies the scaling property. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, $v_1+v_2 $ is irrational. Hence, $S(v_1+v_2) = -v_1 -v_2$, which is different in general from $S(v_1)+S(v_2) = v_1 - v_2$, take $v_1 = 1$ and $v_2 = \sqrt{2}$ for instance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So scaling does not imply superposition (in your sense) in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there exists somehow converse statements. In other domains, one sometimes calls the scaling &quot;homogeneity&quot;, and with additivity we get  the superposition principle for a system $S$: $S(q_1.v_1+q_2.v_2) = S(q_1.v_1)+S(q_2.v_2)$. Keeping with standard fields, it can be shown that additivity implies homogeneity with rational scalars, by playing on $S(v+v) = S(v)+S(v) = 2.S(v)$ etc. To go beyond rational scalar often requires additional assumptions like continuity, which could be troublesome depending on the sets you choose, see for instance &lt;a href=&quot;https://math.stackexchange.com/questions/1231637/why-doesnt-superposition-imply-linearity-why-is-homogeneity-needed&quot;&gt;Why doesn't superposition imply linearity? Why is homogeneity needed?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-08-02T20:13:48.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25000" PostTypeId="1" CreationDate="2015-07-31T20:35:09.297" Score="0" ViewCount="100" Body="&lt;p&gt;First post, and this isn't my field of study, but I'm giving this a go anyway:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My latest endeavor is to use a bit of DSP magic to match up various pairs of headphones, at least in terms of their impulse response measured at the entrance to the ear canal. So far I've taken 64 measurements on 3 sets of headphones, in this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Put on binaural mics&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Put on headphones&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Take IR measurements&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are in a nested loop with 4 iterations each, so I end up with 64 measurements. The IRs I get using a program called Aliki, free software in Linux that uses sine sweeps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to generate two filters for each headphone pairing (1&amp;lt;-&gt;2, 1&amp;lt;-&gt;3, 2&amp;lt;-&gt;3). Currently I'm eyeballing a &quot;best&quot; IR for each headphone using spectrograms, matching up the position of peaks, padding, then doing FFT division to get a transfer function (which I have read can be a really bad way of doing things). Results are actually not bad sounding, but I wonder if I can do better with a bit more legwork on the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: What's the best way to combine these IRs to get (possibly) better filters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="16841" LastActivityDate="2015-08-31T10:06:07.333" Title="Matching headphone responses" Tags="|fft|impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25001" PostTypeId="1" AcceptedAnswerId="25002" CreationDate="2015-07-31T22:44:54.003" Score="1" ViewCount="89" Body="&lt;p&gt;I've been thinking about additive synthesis and I'm wondering if all sounds begin at (theoretically) phase 0?   &lt;/p&gt;&#xA;" OwnerUserId="16389" LastActivityDate="2015-08-03T03:14:29.877" Title="Do all Harmonics of a periodic sound start from a 0 base" Tags="|fft|ifft|" AnswerCount="3" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25002" PostTypeId="2" ParentId="25001" CreationDate="2015-08-01T01:13:00.750" Score="2" Body="&lt;p&gt;It's common to not start all harmonically related sinusoids with a phase of 0 at some initial time point.  Varying the phase relationships helps reduce the peak-to-average power ratio, which allows a higher average volume without clipping or otherwise exceeding some peak limit.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-08-01T01:13:00.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25003" PostTypeId="2" ParentId="12597" CreationDate="2015-08-01T01:23:13.707" Score="1" Body="&lt;p&gt;For any arbitrary LTI sytem, the complex exponential is, to the best of my knowledge, the only known eigensignal.  On the other hand, consider the ideal LPF.  The $\operatorname{sinc}$ function: &#xA;$$\operatorname{sinc}(t) \triangleq \frac{\sin(\pi t)}{\pi t}$$&#xA;can easily be seen to be an eigen signal.  This points to the existence of LTI systems (such as the ideal LPF) having signals other than complex exponentials as eigen signals ($\frac{\sin(\pi t)}{\pi t}$ in this case).&lt;/p&gt;&#xA;" OwnerUserId="16850" LastEditorUserId="27996" LastEditDate="2017-08-25T01:34:52.680" LastActivityDate="2017-08-25T01:34:52.680" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="25004" PostTypeId="2" ParentId="24995" CreationDate="2015-08-01T02:11:12.313" Score="0" Body="&lt;p&gt;Whether to use a rectangular or another window depends on what you're trying measure in your FFT results. The use of non-rectangular windows is only necessary if you're trying to reduce spectral leakage.  Is that your goal?  What is your goal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, more &quot;accurate&quot; spectral measurements are made by performing multiple FFTs on multiple (independent) blocks of input time samples. Then you average the magnitudes of those multiple FFT output sequences. For example, let's say your multiple FFT magnitude sequences are |X1(m)|, |X2(m)|, |X3(m)|, and |X4(m)|.  Then the averaged spec mag for, say, the output sample m = 7 is [|X1(7)|+|X2(7)|+|X3(7)|+|X4(7)|]/4. &lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-01T02:11:12.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25005" PostTypeId="2" ParentId="24994" CreationDate="2015-08-01T06:24:46.797" Score="1" Body="&lt;p&gt;For the first question, I would like to propose a very rudimentary method that can help you find out what is happening. One reason is that you do not provide too many details about your implementation. This method can even be used in practice when one cannot easily estimate filter delays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your two-pass filter will be symmetric and monomodal (similar in shape to a two-sided exponential), you can estimate your &quot;computational delay&quot; (including all your windowing, padding, trimming, faulty allocations, subsampling...) by giving an input in the form of a Dirac-delta function, with its maximum 1 at a given location $k$, for instance far away from the edges. It could be like &#xA;$$0\,0\,0\,0\,1\,0\,0\,0\,0$$&#xA; Then filter it your double-way, and find the index $l$ of the maximum in the output filtered signal. It could be longer that the original one:&#xA;$$\epsilon_1\,\epsilon_2\,\epsilon_3\,\epsilon_4\,\epsilon_5\,\epsilon_6\,\epsilon_7\,\textrm{max}\,\epsilon_7\,\epsilon_6\,\epsilon_5\,\epsilon_4\,\epsilon_3\,\epsilon_2\,\epsilon_1\,$$&#xA;That $l-k$ (here $(8-5))$ gives you an integer quantity, a system delay, since your are using an LTI (linear, time-invariant) filter. Then, you can investigate where this delay comes from in your filtering process, and decide how to trim or  (circularity) shift your &quot;real signal&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second part, since your filter is partly exponential I would first suggest you to look at recursive implementations of exponential filters. You can split your filter $h$ as $h = h_1+h_2$ with &#xA;$$h_1 = \{0\,0.239052\,0\,0\,0\, \dots\}$$&#xA;and $h_2$ the exponential part. The latter can be implemented with simple recursive formulas as &lt;a href=&quot;https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average&quot; rel=&quot;nofollow&quot;&gt;exponential moving averages&lt;/a&gt;. Those can save you time, and treat borders with less pain.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-01T06:24:46.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25006" PostTypeId="2" ParentId="25000" CreationDate="2015-08-01T09:27:33.917" Score="1" Body="&lt;p&gt;Why not to simply match the frequency responses and sensitivities? That's what labs are actually doing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you have the IR's for each device, simply calculate the Frequency response of each repetition, average and compare between devices. In Python that is very simple task.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-08-01T09:27:33.917" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25008" PostTypeId="1" CreationDate="2015-08-01T15:52:38.233" Score="0" ViewCount="143" Body="&lt;p&gt;I have a live signal that needs filtering, and I'm trying to compare a Kalman filter with a simple exponential filter. For this I generated an artificial ground truth signal, add some noise and filter it with both methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that, while the result from the Kalman filter 'looks' better, I can't quantify how much better it is because its output lags behind the signal. When I simply compute the error between a noisy sample and a filtered sample at time T, the difference is always higher than between the noisy sample and the ground truth sample at the same time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of correctly computing the error in these cases? I thought about computing a least squares fit between the filtered and ground truth signals, but that feels like 'cheating' a bit, as it looks at the best possible case and also doesn't account for the filter lag.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Some graphs to give a better picture of what I'm doing&#xA;&lt;a href=&quot;https://i.stack.imgur.com/aHr8l.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aHr8l.png&quot; alt=&quot;Ground truth, noisy signal and filter outputs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've plotted the outputs up to t=140. Both the exponential filter (red) and kalman filter (green) are lagging behind the current noisy sample (blue). If I try to compute the squared error by comparing the ground truth value at t=140 with kalman or exponential values at t=140, the error will be large, and at times even larger than the error between the ground truth and the noisy signal (second picture top).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes the exponential filter look better, just because it has less lag than the kalman filter.&#xA;If I try to account for lag, i.e. compute the error between the kalman filter at t=140 and ground truth at the closest t ~ 137-ish, then the squared error graphs look better (second picture bottom), but I'm not sure if this is the correct thing to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HiaXs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HiaXs.png&quot; alt=&quot;square error between the ground truth and noisy/filtered signals&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit 2&#xA;I now realize that these are not really time series, but rather processed as a 2D signal. So 't=' should really be 'x=', with the value being y. This explains why the sequences are not synchronized in time. But I think the question is still valid.&lt;/p&gt;&#xA;" OwnerUserId="16853" LastEditorUserId="16853" LastEditDate="2015-08-02T18:25:57.903" LastActivityDate="2018-03-12T19:19:18.060" Title="Computing error between filtered and noisy time series signal" Tags="|filters|time-series|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25010" PostTypeId="1" AcceptedAnswerId="25015" CreationDate="2015-08-01T20:51:32.490" Score="0" ViewCount="2292" Body="&lt;p&gt;I have been reading this Wikipedia article:  &lt;a href=&quot;https://en.wikipedia.org/wiki/Roberts_cross&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Roberts_cross&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And it says this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ml2K4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ml2K4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now I have also been reading this for the Robert Cross operator (from Feature Extraction and Image Processing 3rd Edition):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xww7q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xww7q.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can understand The books explanation (kinda) but not wikipedia.&lt;/p&gt;&#xA;&lt;p&gt;So in Code I will have something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;EdgeValue(at x,y) = Max[(Px+1,y - Px,y+1), (Px,y - Px+1,y+1)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So from the 2 values I choose the max. And in the new image I just draw that value in x,y. Makes sense.&lt;/p&gt;&#xA;&lt;p&gt;What I do not get is Wikipedia. Why does it go on finding the gradient?&#xA;Also that looks like the Pythagorean Theorem not a gradient equation.&lt;/p&gt;&#xA;" OwnerUserId="16854" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-08-02T10:26:36.437" Title="Help Understanding the Robert Cross Operator" Tags="|image-processing|edge-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25012" PostTypeId="1" CreationDate="2015-08-01T23:22:28.127" Score="1" ViewCount="733" Body="&lt;p&gt;I realize that matlab fft is twice as fast for real input. But does matlab fft take the fact that the transform will be conjugate symmetric into consideration? Since the input is real, it would have half as much information as a complex input, so this can explain the factor of 2. I was thinking that it perhaps should be a factor of 4. 2 for conjugate symmetry, 2 for having no complex component. Am I thinking wrong?&lt;/p&gt;&#xA;" OwnerUserId="16852" LastActivityDate="2015-10-02T09:41:19.903" Title="Is matlab fft faster for real input?" Tags="|matlab|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25013" PostTypeId="1" AcceptedAnswerId="25020" CreationDate="2015-08-01T23:43:35.190" Score="0" ViewCount="11993" Body="&lt;p&gt;I have a signal and I am using Matlab command pwelch to calculate the frequency of the signal, but the frequency I obtained is changed as I change the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, when using sampling frequency equal to 8000[samples/sec], the frequency appears to be 1 Khz, while using 16000 sampling frequency the frequency of the signal appear to be 2 Khz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the correct frequency? And is there other method to calculate the frequency of a signal without a prior knowledge of the sampling frequency?&lt;/p&gt;&#xA;" OwnerUserId="16855" LastEditorUserId="15637" LastEditDate="2015-08-02T17:21:27.337" LastActivityDate="2019-08-04T14:10:14.007" Title="How to calculate the frequency of a signal without knowing the sampling frequency using Matlab" Tags="|matlab|frequency|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25014" PostTypeId="2" ParentId="12597" CreationDate="2015-08-02T06:02:24.313" Score="0" Body="&lt;p&gt;I thought I had worded my response clearly---apparently not :-).  The original question was, &quot;Are there eigensignals besides the complex exponential for an LTI system?&quot;.  The answer is, if one is given the fact that the system is LTI  but nothing else is known, then the only confirmed eignensignal is the complex exponential.  In specific cases, the system may have additional eigensignals as well.  The example I gave was the ideal LPF with sinc being such an eigensignal.  Note that the sinc function is not an eigensignal of an arbitrary LTI system.  I gave the LPF and the sinc as an example to point a non-trivial case---x(t) = y(t) will satisfy a mathematician but not an engineer :-&gt;.  I am sure one can come up with other specific non-trivial examples that have other signals as eigensignals besides the complex exponential.  But these other eigensignals will work for those specific examples only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, cos and sin are not, in general, eigensignals.  If cos(wt) is applied and the output is A cos(wt + theta), then this output cannot be expressed as a constant times the input (except when theta is 0 or pi, or A=0), which is the condition needed for a signal to be an eigensignal.  There may be conditions under which cos and sin are eigensignals, but they are special cases and not general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CSR&lt;/p&gt;&#xA;" OwnerUserId="16850" LastActivityDate="2015-08-02T06:02:24.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25015" PostTypeId="2" ParentId="25010" CreationDate="2015-08-02T07:32:25.557" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What I do not get is Wikipedia. Why does it go on finding the gradient?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You subtract two nearby pixel values. That &lt;em&gt;is&lt;/em&gt; a gradient, or as close as you can get on a discrete image.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also that looks like the Pythagorean Theorem not a gradient equation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As the book text say, &quot;&lt;em&gt;it is often better to consider the two templates as providing the components of an edge vector&lt;/em&gt;&quot;. If you want the length of a vector, you use the Pythagorean Theorem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The better question is: why use the max or the sum of the absolute values, or: what's the difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show that, it's best to try the filter on a rotationally symmetric template: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7S2Nl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7S2Nl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that way, we can see how it acts on different edge angles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jZP4q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jZP4q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, adding the absolute values of the gradient vector (this is sometimes called the &quot;L1-Norm&quot;) gives larger edge strengths for horizontal and vertical edges than diagonal edges. Taking the max of the two absolute values of the gradient vector (also known as the &quot;L-infinity Norm&quot;) gives slightly larger edge values for diagonal edges. Using the ordinary Euclidean norm (i.e. the Pythagorean Theorem) gives exactly the same edge strength for any angle, which is of course the right result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only downside (I'm aware of) is that this requires two multiplications and a square root for every pixel, which used to be very expensive operations when the Roberts operator was invented. They're still expensive on mobile or embedded platforms today, but on a PC, you might not even notice the difference.&lt;/p&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2015-08-02T10:26:36.437" LastActivityDate="2015-08-02T10:26:36.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25017" PostTypeId="1" AcceptedAnswerId="25036" CreationDate="2015-08-02T09:25:56.983" Score="3" ViewCount="663" Body="&lt;p&gt;I would like to integrate in my application a tone detector but I'm confused between 2 kinds of filters: Goertzel or Notch? &#xA;I saw that Goertzel is a recommended for tone detection. But - what if I implement a Notch filter using Matlab with order of 20 (for example)?? &lt;/p&gt;&#xA;" OwnerUserId="15637" LastActivityDate="2015-08-04T02:33:42.787" Title="What are the differences between notch filter &amp; Goertzel?" Tags="|filter-design|signal-detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25018" PostTypeId="2" ParentId="25013" CreationDate="2015-08-02T09:43:26.173" Score="0" Body="&lt;p&gt;Do you know what is the duration of each signal? If you are using known freqs  you can try to distinguish between them without calculating the exact frequency&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/31663-zero-crossing-rate/content/ZCR.m&quot; rel=&quot;nofollow&quot;&gt;using Zero Crossing Rate method&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It counts the number of zero crosses through value 0. As more crosses the frequency is higher.&lt;/p&gt;&#xA;" OwnerUserId="15637" LastEditorUserId="15637" LastEditDate="2015-08-02T13:48:31.310" LastActivityDate="2015-08-02T13:48:31.310" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25019" PostTypeId="2" ParentId="11525" CreationDate="2015-08-02T09:45:10.827" Score="0" Body="&lt;p&gt;Let us assume a one-dimensional signal of length N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complexity of the continuous wavelet transform can be $O(N)$, see for instance &lt;a href=&quot;http://infoscience.epfl.ch/record/63087/files/munoz0202.pdf&quot; rel=&quot;nofollow&quot;&gt;Continuous wavelet transform with arbitrary scales and $O({N})$ complexity&lt;/a&gt;. One should take into account that one can use scale/voice relationship, and subsample each scale or voice differently, which plays a role in the overall complexity. Complex aspects in the wavelet choice, its truncation, approximate FIR relationships are also important when you want to reconstruct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complexity of the dyadic or 2-band uniform wavelet packet (each level is decomposed in the same way) is typically $O(N\log N)$. This may be adapted when one chooses multiband or $M$-band wavelet ($M \ge 2$), best basis packet based on entropy-like measures, and useful dual-tree complex wavelet packets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Baseline S-transform is of  $O(N^2\log N)$ complexity. There are claims of recent implementations of a &lt;a href=&quot;http://sourceforge.net/projects/fst-uofc/&quot; rel=&quot;nofollow&quot;&gt;fast S-transform&lt;/a&gt; in $O(N \log N)$, from researchers in Calgary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This being said, one should balance efficiency and complexity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, simple and fast transforms might have a limited use, or require very expensive outer processing: one can get a globally very fast and efficient adaptive filtering with complex wavelet frames, which might be more difficult with a standard 2-scale orthogonal discrete wavelet transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, a lot hides in the $O$ Bachmann-Landau notation. There is a constant factor, that can be huge for mild length signals. And the bound can be pessimistic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thirdly, memory consumption, and potentials to use pipes, parallelization, GPU/DSP or hardware/software association may mitigate theoretical complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I would be very glad to see a thoroughful comparison of asymptotic complexity of such time-frequency and time-scale transforms in higher dimensions too.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-02T09:45:10.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25020" PostTypeId="2" ParentId="25013" CreationDate="2015-08-02T09:58:57.923" Score="1" Body="&lt;p&gt;If you do not have the information about the sampling frequency &lt;span class=&quot;math-container&quot;&gt;$F_s$&lt;/span&gt; of your digital data, the best option is to talk about dimensionless relative frequencies &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, or &lt;em&gt;reduced frequency&lt;/em&gt;. The frequencies you observe on periodograms will be &lt;span class=&quot;math-container&quot;&gt;$f = F/F_s$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; would be the true frequency (hoping you have no aliasing). This amounts to saying that your sampling period is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (dimensionless) and that the maximum observable frequency in your signal is &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is likely that the actual sampling frequency can be obtained from the data file, the  experiment or sensor, a recorded phenomenon with known frequency (like the 50 or 60 Hz power) or the person who gave you that signal.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2019-08-04T14:10:14.007" LastActivityDate="2019-08-04T14:10:14.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25021" PostTypeId="1" CreationDate="2015-08-02T10:05:41.193" Score="0" ViewCount="159" Body="&lt;p&gt;I am trying to find the correct filter to convolve with an image so they have the same PSF. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the final PSFs of both images: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A: PSF of the image with the wider PSF.&lt;/li&gt;&#xA;&lt;li&gt;B: PSf of the image with the narrower PSF.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(So the FWHM of B is smaller than A).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the time being I am trying to do the most simple (naive) deconvolution:  by simply dividing the Fourier transform of A with that of B. The reason is that the type of data that I am working with (astronomical images) will not have zeros in the fourier transform. Also I am using very high signal to noise images of stars (point sources) so the effect of noise is minimal. Later on, I will try to implement the Wiener deconvolution. But my problem seems to be more basic than that!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I take the naive deconvolution steps, it seems the Final PSF I get is translated by half the image width as you can see below. Just a note: I have set the sums of both images to 1 before this process. Also, the images are all inverted so zero is shown with white.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is A (the wider PSF):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/B5isb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B5isb.jpg&quot; alt=&quot;A:&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is B (the narrower PSF, same image size as A):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yDEJz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yDEJz.jpg&quot; alt=&quot;B&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the Fourier transform of A:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lN4ol.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lN4ol.jpg&quot; alt=&quot;Fourier transform of A&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the Fourier transform of B:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/W1V0d.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/W1V0d.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the pixel by pixel division of the Fourier transform of A divided by the Fourier transform of B. Following the advice &lt;a href=&quot;https://math.stackexchange.com/questions/68060/how-to-perform-deterministic-deconvolution&quot;&gt;in this stackexchange-Mathematics question&lt;/a&gt;, I have set all the pixels with a very small B value to zero (a plus-like figure in the center that is all white).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vK8kI.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vK8kI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is the inverse Fourier transform of the division:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SdOuo.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SdOuo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems reasonable, but it is not centered, its as if it has been translated by half the image size! I know I can multiply the Fourier domain results with constants to center it. But I don't understand why this happens. I am affraid I might have made a mistake somewhere! If I understand it, then applying that translation is easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using this exact algorithm for convolution (where the Fourier transforms are multiplied) and the inverse discrete Fourier transform result is centered. So, I know there is no error in my inverse discrete Fourier transform steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a summary, my question is that why does the inverse Fourier transform of the frequency space appear to give a translated (by half the image size) spatial image in division? &lt;/p&gt;&#xA;" OwnerUserId="5290" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-08-02T10:05:41.193" Title="Fourier domain division causing translation" Tags="|convolution|deconvolution|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25022" PostTypeId="1" CreationDate="2015-08-02T13:23:58.300" Score="2" ViewCount="1811" Body="&lt;p&gt;We currently have C/C++ FFT code with Hann Window function support. For a large data (over 10,000) we want to split this into 1024 samples with 50% overlap. For each 1024 sample, we window and fft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the recommended way to combine all the results from these smaller overlapping results to obtain a presentable results for the over 10,000 data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: For the poor explanation.&#xA;The process is best illustrated by the following links&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://spectraplus.com/DT_help/overlap_percentage.htm&quot; rel=&quot;nofollow&quot;&gt;https://spectraplus.com/DT_help/overlap_percentage.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=LlyH6YciDhw&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=LlyH6YciDhw&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16858" LastEditorUserId="16858" LastEditDate="2015-08-03T12:45:43.483" LastActivityDate="2015-10-02T14:43:48.967" Title="How to Combine FFT Overlap Results?" Tags="|fft|window-functions|window|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25024" PostTypeId="2" ParentId="24998" CreationDate="2015-08-02T20:54:35.857" Score="0" Body="&lt;p&gt;no.  and to prove that, all you need is a counter example, one that satisfies &lt;em&gt;scaling&lt;/em&gt; without satisfying &lt;em&gt;superposition&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;input $x(t)$ and output $y(t)$ and a system that satisfies &lt;em&gt;scaling&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = \frac{x(t) \cdot x(t-\tau_1)}{x(t-\tau_2)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\tau_1 \ne \tau_2$ and neither are zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pretty easy to show that scaling works with this and superposition does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;but&lt;/em&gt;&lt;/strong&gt;, if you're willing to neglect scaling by irrational numbers, you &lt;strong&gt;&lt;em&gt;can&lt;/em&gt;&lt;/strong&gt; show that &lt;em&gt;superposition&lt;/em&gt; implies &lt;em&gt;scaling&lt;/em&gt;.  all you really need, to get to &quot;linearity&quot; is &lt;em&gt;superposition&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;scaling&lt;/em&gt; is really not a necessary axiom unless you're gonna be very anal about irrational numbers and cannot make any assumptions about continuity of the alleged LTI system.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-08-02T20:54:35.857" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="25025" PostTypeId="2" ParentId="24998" CreationDate="2015-08-02T22:42:39.477" Score="2" Body="&lt;p&gt;Let's try an example without division by zero problems and with some practical relevance. An RMS envelope estimator like $E\{x[n]\}=\sqrt{\sum_{k=n}^{n+N} x[n]^2}$ is an example of a system that is homogeneous for non-negative numbers while not being linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, we want a system that is homogeneous for all real numbers, and we can simply do that by replacing the square(-root) by a cube(-root) as in&#xA;$$Q\{x[n]\}=\left( \sum_{k=n}^{n+N} x[n]^3 \right)^{1/3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an estimator related to skewness in statistics, so it too has some practical relevance. &lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-08-02T22:42:39.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25026" PostTypeId="2" ParentId="25001" CreationDate="2015-08-02T23:01:29.810" Score="1" Body="&lt;p&gt;I'm not knowledgeable enough to comment on &quot;all sounds&quot; found in nature. But here's an interesting experiment. Use software to generate an audio square wave containing a fundamental freq and the next higher five odd harmonics (each with appropriate peak amplitudes). Play that signal through a speaker.  Then have each of the five odd harmonics start at random initial phases.  The resultant signal will have a drastically different wave shape, &lt;em&gt;BUT&lt;/em&gt; the sound of the random-phase signal will sound VERY similar to your original square wave! It's an experiment to show that the human ear/brain combination is very tolerant of phase distortion.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-02T23:01:29.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25027" PostTypeId="2" ParentId="25001" CreationDate="2015-08-03T03:14:29.877" Score="1" Body="&lt;p&gt;i would say that is is &lt;strong&gt;not&lt;/strong&gt; common that all harmonics start with a phase of zero w.r.t. any single, specific time (like MIDI NoteOn).  BTW, to add to Rick Lyons answer, here is a MATLAB program that sorta demonstrates what you can and cannot hear regarding phase alignment of harmonics.  give it a try.  see what you can hear (or not).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%&#xA;%   square_phase.m&#xA;%&#xA;%   a test to see if we can really hear phase changes&#xA;%   in the harmonics of a Nyquist limited square wave.&#xA;%&#xA;%   (c) 2004 rbj@audioimagination.com&#xA;%&#xA;&#xA;if ~exist('Fs')&#xA;    Fs = 44100                      % sample rate, Hz&#xA;end&#xA;&#xA;if ~exist('f0')&#xA;    f0 = 110.25                     % fundamental freq, Hz&#xA;end&#xA;&#xA;if ~exist('tone_duration')&#xA;    tone_duration = 2.0             % seconds&#xA;end&#xA;&#xA;if ~exist('change_rate')&#xA;    change_rate = 1.0               % Hz&#xA;end&#xA;&#xA;if ~exist('max_harmonic')&#xA;    max_harmonic = floor((Fs/2)/f0) - 1&#xA;end  &#xA;&#xA;if ~exist('amplitude_factor')&#xA;    amplitude_factor = 0.25         % this just keeps things from clipping&#xA;end&#xA;&#xA;if ~exist('outFile')&#xA;    outFile = 'square_phase.wav'&#xA;end&#xA;&#xA;&#xA;                                  % make sure we don't uber-Nyquist anything&#xA;max_harmonic = min(max_harmonic, floor((Fs/2)/f0)-1);&#xA;&#xA;t = linspace((-1/4)/f0, tone_duration-(1/4)/f0, Fs*tone_duration+1);&#xA;&#xA;detune = change_rate;&#xA;&#xA;x = cos(2*pi*f0*t);                  % start with 1st harmonic&#xA;&#xA;n = 3;                               % continue with 3rd harmonic&#xA;while (n &amp;lt;= max_harmonic)&#xA;    if ((n-1) == 4*floor((n-1)/4))   % lessee if it's an &quot;even&quot; or &quot;odd&quot; term&#xA;        x = x + (1/n)*cos(2*pi*n*f0*t);&#xA;     else&#xA;        x = x - (1/n)*cos(2*pi*(n*f0+detune)*t);&#xA;        detune = -detune;       % comment this line in an see some&#xA;    end                          % funky intermediate waveforms&#xA;    n = n + 2;                   % continue with next odd harmonic&#xA;end&#xA;&#xA;x = amplitude_factor*x;&#xA;&#xA;% x = sin((pi/2)*x);               % toss in a little soft clipping&#xA;&#xA;plot(t, x);                      % see&#xA;sound(x, Fs);                    % hear&#xA;wavwrite(x, Fs, outFile);        % remember&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-08-03T03:14:29.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25028" PostTypeId="2" ParentId="25017" CreationDate="2015-08-03T04:23:51.337" Score="3" Body="&lt;p&gt;The Goertzel algorithm allows you to sample the DTFT of a signal with slightly lower complexity than direct computation (still $\mathcal{O}(N^2)$ to produce the DFT but with a smaller coefficient). I think of it as being advantageous in two ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If you know the frequency you are looking for (like in &lt;a href=&quot;https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling&quot; rel=&quot;nofollow&quot;&gt;telephone dialing systems&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;If you only want a small number of frequencies so that computing the FFT and discarding those you don't want is overly computational&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course if the frequency you are looking for is not a multiple of $\frac{2\pi}{N}$ where $N$ is the signal support, then the FFT won't get it anyways (sans zero padding tricks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notch filters, are, well, filters. So their complexity is straightforward. An advantage in some cases is that they can have a non-impulse frequency response (but still sharp over a small concentrated band) so that if you are only sure of a specific region the signal you are trying to detect is in, this is a good way to do some &quot;averaging&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an interesting aside, Goertzel's &lt;a href=&quot;https://courses.cs.washington.edu/courses/cse466/12au/calendar/Goertzel-original.pdf&quot; rel=&quot;nofollow&quot;&gt;original paper&lt;/a&gt; doesn't mention directly applications to Fourier analysis (but rather just people who wanted to program trigonometric series), and is less than a single page long)&lt;/p&gt;&#xA;" OwnerUserId="16767" LastActivityDate="2015-08-03T04:23:51.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25029" PostTypeId="2" ParentId="25022" CreationDate="2015-08-03T04:31:00.930" Score="1" Body="&lt;p&gt;I'm not sure what your intent is, but the organization of the computation can be done using straightforward &lt;a href=&quot;https://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;overlap-and-add&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;nofollow&quot;&gt;overlap-and-save&lt;/a&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're attempting to look at data statistics in the frequency domain, a good starting might be to look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Welch%27s_method&quot; rel=&quot;nofollow&quot;&gt;Welch's method&lt;/a&gt; and its descendents.&lt;/p&gt;&#xA;" OwnerUserId="16767" LastActivityDate="2015-08-03T04:31:00.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25030" PostTypeId="2" ParentId="25012" CreationDate="2015-08-03T04:36:26.403" Score="1" Body="&lt;p&gt;Matlab, like most computational packages, implement a pretty neat set of fast Fourier transform algorithms referred to as FFTW: fastest Fourier transform in the west. You can find more out about it &lt;a href=&quot;http://www.fftw.org/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFTW actually runs a preflight on your machine when it is first installed. At that time, it runs a bunch of test computations to figure out which prime factorization would be fastest given your processor speeds and cache sizes. Then, it uses a symbolic program to generate a bunch of FFT algorithms specific to your machine for a whole bunch of cases, like real valued, symmetric, etc. So, it's hard to say exactly what's going on under the hood except that if there's an efficiency to be had, FFTW will take advantage.&lt;/p&gt;&#xA;" OwnerUserId="16767" LastActivityDate="2015-08-03T04:36:26.403" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25031" PostTypeId="1" CreationDate="2015-08-03T06:45:00.897" Score="2" ViewCount="945" Body="&lt;p&gt;To convert power spectrum to a log-scaled one, how to define &lt;code&gt;log10(X(k))&lt;/code&gt; if &lt;code&gt;X(k)=0&lt;/code&gt; for some &lt;code&gt;k&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sake of illustration, I brief my process as follows which is a convention one:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the magnitude spectrum &lt;code&gt;X(k)&lt;/code&gt; of the time-domain signal &lt;code&gt;x(n)&lt;/code&gt; by &lt;code&gt;X(k) = abs(fft(x(n)))&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert the magnitude spectrum or power spectrum to db by &lt;code&gt;20*log10(X(k))&lt;/code&gt; or &lt;code&gt;10*log10(X(k)**2)&lt;/code&gt;, respectively. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My problem arises when there is &lt;code&gt;X(k)=0&lt;/code&gt; when computing &lt;code&gt;log10(X(k))&lt;/code&gt; which is either not defined or &lt;code&gt;-inf&lt;/code&gt;. How to deal with this?&lt;/p&gt;&#xA;" OwnerUserId="16770" LastActivityDate="2015-09-02T17:45:43.687" Title="Encounter 0 when calculating log power spectrum" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25032" PostTypeId="2" ParentId="25012" CreationDate="2015-08-03T09:02:31.567" Score="1" Body="&lt;p&gt;You can perform a real valued FFT of N points using a complex FFT of N/2 points with some wrapper math. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Slightly more efficient: If you have two real valued signals you can make a complex signal out of them and then separate in the frequency domain in the even and odd parts.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-08-03T09:02:31.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25034" PostTypeId="1" AcceptedAnswerId="25035" CreationDate="2015-08-03T13:09:01.003" Score="0" ViewCount="305" Body="&lt;p&gt;I prepared a Matlab script, which re-samples spectrum from 24kHz to 20kHz. When I used up-sampling, a fir filter, and then up-sampling again at the end, I get an additional peak at 4kHz which is not expected. When I checked via the resample function from Matlab paltette, there is no additional peak. What did I do wrong? What do I have to add to my script to avoid this kind of situation. Thank you in advance&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;close all;&#xA;clear variables;&#xA;Fs1 = 24000;&#xA;TimeStep1 = 1/Fs1;&#xA;Lenght = 10000;&#xA;time1 = (0:Lenght-1)*TimeStep1;&#xA;InputSignal = sin(2*pi*8000*time1);&#xA;NFFT1 = 2^nextpow2(Lenght);&#xA;Y1 = fft(InputSignal,NFFT1)/Lenght;&#xA;f1 = Fs1/2*linspace(0,1,NFFT1/2+1);&#xA;figure&#xA;plot(f1,2*abs(Y1(1:NFFT1/2+1))) &#xA;title('Original Spectrum')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|Y(f)|')&#xA;Fs2 = 20000;&#xA;T2 = 1/Fs2;&#xA;nGcd = gcd(Fs1, Fs2);&#xA;upY = upsample(InputSignal,Fs2/nGcd);&#xA;firCoeff = fir1(255, 0.9, 'low');&#xA;filteredY = filter(firCoeff,1,upY);&#xA;dataOut = resample(InputSignal,Fs2,ceil(Fs1));&#xA;L2 = length(dataOut);&#xA;t2 = (0:L2-1)*T2;&#xA;N=2;&#xA;lenght = (L2/N);&#xA;NFFT = 2^nextpow2(lenght);&#xA;Y = fft(dataOut,NFFT)/lenght;&#xA;f = Fs2/2*linspace(0,1,NFFT/2+1);&#xA;figure&#xA;plot(f,2*abs(Y(1:NFFT/2+1))) &#xA;title('Resampled Spectrum')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|Y(f)|')&#xA;figure&#xA;dataOut2 = downsample(filteredY,Fs1/nGcd);&#xA;Y2 = fft(dataOut2,NFFT)/lenght;&#xA;plot(f,2*abs(Y2(1:NFFT/2+1)))&#xA;title('UpFIRDwn Spectrum')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|Y(f)|')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16864" LastEditorUserId="16864" LastEditDate="2015-08-04T14:00:04.490" LastActivityDate="2015-08-04T14:21:26.363" Title="Additional peak after resampling" Tags="|matlab|frequency-spectrum|filter-design|resampling|finite-impulse-response|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25035" PostTypeId="2" ParentId="25034" CreationDate="2015-08-03T13:55:35.307" Score="3" Body="&lt;p&gt;You are upsampling by a factor 5, which creates mirrors of the original spectrum (see the spectrum of $Yup$). With the filter you intent to remove these mirrors such that you can safely downsample the signal without aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prevent aliasing, the upper limit for your cutoff frequency is half the lowest sampling rate, which is $0.5*Fs2 = 10 kHz$. However, the finite steepness of your filter creates a so-called transition band, which leads to some aliasing for higher frequencies for this maximum cutoff frequency. Therefore, a cutoff frequency a little below the absolute maximum is desired, for example 9 kHz. Choosing the transition band depends on your filter length and singal content. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a cutoff frequency of 9 kHz at 5 * 24 / 2 khz, the normalized cut-off frequency is 0.15. You can use $Fs2/nGcd * Fs2$ to calculate this normalized cutoff frequency automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some guessing from my side: &#xA;In your code you use a normalized cutoff frequency of 0.9, which might be related to the 9 kHz and the output sampling rate of 20 kHz. However, the filter is applied to the $Yup$ signal, which has a sampling rate of 5 * 24 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short: changing the normalized cutoff frequency of your filter from 0.9 to 0.15 should solve your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: Follow up on using fir2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the fir2(N, F, A) method of Matlab you can design an N points FIR filter by prescribing the filter magnitude at certain frequencies. In your case, you want to design a low pass filter, which means that the frequencies and magnitudes should be something like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = [1 1 0 0];&#xA;F = [0 wpass wstop 1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where wpass and wstop are the relative frequencies up to where you want the filter to let the signal pass or stop, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you can set these for example as follows: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wstop = Fs2/(Fs2/nGcd*Fs1);&#xA;wpass = 0.9 * wstop;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Selecting the filter length N is a tradeoff between complexity and the ripple of the filter with respect to an ideal low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: In your question you have m=[0 0 1 1], which ticks on a high pass filter.&lt;/p&gt;&#xA;" OwnerUserId="16570" LastEditorUserId="16570" LastEditDate="2015-08-04T14:21:26.363" LastActivityDate="2015-08-04T14:21:26.363" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25036" PostTypeId="2" ParentId="25017" CreationDate="2015-08-03T15:01:09.050" Score="2" Body="&lt;p&gt;A filter will pass the signal.  The output of a bandpass filter is your original signal with all of the frequencies outside the pass range attenuated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Goertzel algorithm is more like a single bin of a DFT.  Its output is just the amplitude of the signal at a given frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use a filter when you want to remove noise or interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the Goertzel algorithm when you need to know the amplitude of a signal at a particular frequency.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-08-03T15:01:09.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25037" PostTypeId="1" CreationDate="2015-08-03T15:42:47.367" Score="0" ViewCount="10258" Body="&lt;p&gt;What's the difference between cv::subtract and operator - in OpenCV?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mat original = imread...;&#xA;Mat smoothed, difference, result;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;smoothed - original image processed with Convolution with Gaussian kernel;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;difference = original - smoothed;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::subtract(smoothed, original, difference);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16696" LastActivityDate="2016-02-22T16:37:45.477" Title="Difference between cv::subtract and operator - in cv::Mat OpenCV" Tags="|computer-vision|opencv|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25038" PostTypeId="1" CreationDate="2015-08-03T15:47:05.533" Score="0" ViewCount="83" Body="&lt;p&gt;for my thesis I need to point out the distinctive deltas of my measurements for further use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The jumps can occur with different heights over different time slots. And the absolute base values can also slowly but not only marginally increase or decrease between ups and downs, caused by other means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would love to be able extract these values on the fly on the ARM Cortex M0 that gathers them.. of course delayed, so there are enough measurement values in the pipe to denoise them/calculate medians.. Matlab could also be used (even though I have no experiences in it)..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of something like: Save line when delta is higher than threshold and then sum up everything in between till another delta was undercut (multiple times). Maybe I should also add the &quot;multiple times&quot; argument to the higher than threshold to catch these jumps that consists of multiple small step?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best, just have a look at this picture:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WMRFm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WMRFm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I am playing around with the following and get ok values, but it could be better..: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;delta &gt; small_threshold? -&gt; start summation. deltasummation &gt; large_threshold after at least x additions? -&gt; wait till delta was &amp;lt; small_threshold for y times -&gt; Result. Its like a low pass + FIR I guess?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I played around with the &quot;small_threshold&quot;, &quot;large_threshold&quot;,  &quot;x&quot;, &quot;y&quot; values till I got the overall best result.. But I think there is room for improvements...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dl.dropboxusercontent.com/u/13720935/beispieldaten9t509g9sdgihjotega.csv&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example Data.csv&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16866" LastEditorUserId="16866" LastEditDate="2015-08-19T14:50:14.367" LastActivityDate="2015-08-19T14:50:14.367" Title="Get the distinctive deltas of quite noisy and very variable / dynamic measurement values" Tags="|filter-design|measurement|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25041" PostTypeId="2" ParentId="25031" CreationDate="2015-08-03T17:42:32.847" Score="2" Body="&lt;p&gt;Typically, one's data has some sort of noise floor (-96 dB, etc.).  So one common way to deal with the FFT bins that are zero (or tiny) is to replace anything below the noise floor with the noise floor level, since any value below that value is most likely not useful data.  Doing this before taking the log() function may provide some computational efficiency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-08-03T17:42:32.847" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25042" PostTypeId="2" ParentId="24846" CreationDate="2015-08-03T21:35:50.983" Score="0" Body="&lt;p&gt;Based on the description provided in the description of &lt;a href=&quot;https://dsp.stackexchange.com/questions/4691/what-is-the-difference-between-psd-and-squared-magnitude-of-frequency-spectrum&quot;&gt;PSD&lt;/a&gt; @tobassist provided the link for, the PSD is not an appropriate method to compare plucks of guitar strings. This is because the PSD &quot;is only valid for a wide-sense stationary process because its autocorrelation function is only a function of the time lag τ and not the absolute time t...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately it seems that the PSD should only be used on signals where the magnitude doesn't change over time. While i was using the PSD for only a short snippet of time (500ms or 1 second), it is likely that it is still not appropriate, especially when compared to the FFT / STFT.&lt;/p&gt;&#xA;" OwnerUserId="11852" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-08-03T21:35:50.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25043" PostTypeId="1" CreationDate="2015-08-03T22:43:38.277" Score="3" ViewCount="1417" Body="&lt;p&gt;Does anyone know the name of the first DSP (sampled data) practitioner who discovered that real-valued symmetrical-coefficient FIR filters exhibit linear phase in the frequency domain?&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2016-10-27T06:56:39.313" Title="The history of FIR filters" Tags="|finite-impulse-response|digital-filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25044" PostTypeId="2" ParentId="15556" CreationDate="2015-08-04T01:59:02.297" Score="1" Body="&lt;p&gt;@AndrewP. You have a long road ahead you. But the road is well lit and the rewards will are greater and greater as you travel along. You need to learn digital signal processing (DSP). May I humbly suggest you buy the two books &quot;The Scientist &amp;amp; Engineer's Guide to Digital Signal Processing&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0966017633&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Scientist-Engineers-Digital-Signal-Processing/dp/0966017633/ref=sr_1_2?ie=UTF8&amp;amp;qid=1438652461&amp;amp;sr=8-2&amp;amp;keywords=scientist%27s+guide+signal+smith&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &quot;Understanding Digital Signal Processing.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0137027419&quot; rel=&quot;nofollow&quot;&gt;http://www.amazon.com/Understanding-Digital-Signal-Processing-3rd/dp/0137027419/ref=ntt_at_ep_dpi_1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're widely considered to be the best ways to learn DSP for beginners. Do &lt;em&gt;NOT&lt;/em&gt; sign up for any free Internet online DSP courses!  They will only discourage you at this point in your learning. You'll need to obtain either (1) a 'Student' version of Matlab software or (2) Octave software so you can experiment with DSP on your computer. Do not take any math classes at this point--you can learn selected mathematical topics as necessary as you travel your long road. Andrew if you have enough energy and enthusiasm, to quote Susan B. Anthony, &quot;Failure is impossible.&quot; &lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15391" LastEditDate="2015-08-04T12:40:15.933" LastActivityDate="2015-08-04T12:40:15.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25045" PostTypeId="1" CreationDate="2015-08-04T02:02:19.620" Score="1" ViewCount="57" Body="&lt;p&gt;Suppose we have a time dependent noise signal $\theta(t)$.&#xA;We sample $\theta(t)$ with a device which has 1 bit of resolution and is itself stochastic in the sense that the readout value $u$ of the device follows a probability distribution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P(u) =&#xA;\sin(\theta(t)/2)^2 \delta(u - 1) +&#xA;\cos(\theta(t)/2)^2 \delta(u + 1) \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, we get $u=1$ with probability $\sin(\theta(t)/2)^2$ and $u=-1$ with probability $\cos(\theta(t)/2)^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We sample at discrete times $n\delta t$ where $\delta t$ is the sampling interval.&#xA;This yields a discrete sequence of random variables with distributions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_n(u) =&#xA;\sin(\theta_n/2)^2 \delta(u - 1) +&#xA;\cos(\theta_n/2)^2 \delta(u + 1) \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta_n \equiv \theta(n \delta t)$.&#xA;We record a series of discrete samples $u_n$ from the measurement device, and from that can compute the discrete Fourier transform of the series $u_n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How is the spectral density of $u_n$ related to the spectral density of $\theta(t)$?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem is difficult because the response of the measurement device is not linear, which means that the usual transfer function methods don't work.&#xA;We can assume, if it helps, that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\theta(t) = \frac{\pi}{2} + \delta \theta(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta \theta$ is understood to be small.&#xA;With this assumption, we have&#xA;$$\sin(\theta/2)^2 \approx \frac{1}{2}(1 + \delta \theta) \quad \text{and} \quad \cos(\theta/2)^2 \approx \frac{1}{2}(1 - \delta \theta) \, .$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;My attempt&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I tried solving this by writing out the expression for the discrete Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$U_k \equiv \sum_{n=0}^{N-1} u_n e^{-i 2 \pi k n / N} \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the real part and using some basic relations of probability distributions we can write the probability distribution of the real part of $U_k$ as&#xA;$$P_{\text{Re} U_k}(x)&#xA;= \sum_{n=0}^{N-1} \frac{1}{\cos(2 \pi k n / N)} P_n \left(\frac{x}{\cos(2\pi k n / N)} \right) \, .$$&#xA;We can next use the fact that the probability distribution of a sum of random variables is equal to the convolution of the distributions of the summands, and then additionally use the fact that convolution turns into products in the frequency domain.&#xA;Doing this yields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathcal{FT}[P_{\text{Re}U_k}](k)&#xA;&amp;amp;= \prod_{n=0}^{N-1} \frac{1}{\cos(2 \pi k n / N)} \\&#xA;&amp;amp;\left(&#xA;\sin(\theta_n/2)^2 e^{-i k \cos(2\pi k n / N)}&#xA;+ \cos(\theta_n/2)^2 e^{i k \cos(2\pi k n / N)}&#xA;\right) \, .&#xA;\end{align}&#xA;The notation is considerably simpler if we define $c_{n,k} \equiv \cos(2\pi k n / N)$, giving&#xA;$$&#xA;\mathcal{FT}[P_{\text{Re}U_k}](k)&#xA;= \prod_{n=0}^{N-1} \frac{1}{c_{n,k}}&#xA;\left(&#xA;\sin(\theta_n/2)^2 e^{-i k c_{n,k}}&#xA;+ \cos(\theta_n/2)^2 e^{i k c_{n,k}}&#xA;\right) \, .&#xA;$$&#xA;If we use the linearization mentioned above this simplifies to&#xA;\begin{align}&#xA;\mathcal{FT}[P_{\text{Re}U_k}](k)&#xA;&amp;amp;= \prod_{n=0}^{N-1} \frac{1}{2 c_{n,k}}&#xA;\left(&#xA;(1 + \delta \theta_n) e^{-i k c_{n,k}}&#xA;+ (1 - \delta \theta_n) e^{i k c_{n,k}}&#xA;\right) \\&#xA;&amp;amp;= \prod_{n=0}^{N-1} \frac{1}{c_{n,k}}&#xA;\left(&#xA;\cos(k c_{n,k}) - i \delta \theta_n \sin(k c_{n,k})&#xA;\right) \, .&#xA;\end{align}&#xA;This is where I'm stuck.&#xA;I realize there may be a considerably easier way to solve this.&#xA;I presented this strictly mathematical approach as a point of reference and to demonstrate a possible way of thinking about the problem.&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="90" LastEditDate="2015-08-04T11:27:23.700" LastActivityDate="2015-08-04T11:27:23.700" Title="Spectral density of 1-bit nonlinear detector in terms of analog spectral density" Tags="|discrete-signals|noise|non-linear|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25046" PostTypeId="2" ParentId="25017" CreationDate="2015-08-04T02:33:42.787" Score="2" Body="&lt;p&gt;@axcelenator. A Goertzel filter is a bandpass filter. And when this filter's center frequency has a certain value the Goertzel filter generates a final complex output value that's equal to a single-bin value of a DFT. In any case, a bandpass filter passes a range of frequencies and a notch filter attenuates a range of frequencies. So their behavior, like a freezer and an oven, are opposites!&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-04T02:33:42.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25047" PostTypeId="2" ParentId="25043" CreationDate="2015-08-04T07:46:53.057" Score="2" Body="&lt;p&gt;Let me propose a majorizing date for this discovery, at least in written form: Rader, C. M. and Gold, B. (1967) &lt;a href=&quot;http://dx.doi.org/10.1109/PROC.1967.5434&quot; rel=&quot;nofollow&quot;&gt;Digital filter design techniques in the frequency domain&lt;/a&gt;, Proceedings of the IEEE. Such a discussion appears on page 164, under the name of &quot;frequency sampling filters&quot;, involving the combination of &quot;elemental&quot; and &quot;comb filter&quot;. They say &quot;The phase versus frequency is exactly linear except for discontinuities of $\pi$ radians. These discontinuities occur where the magnitude response is zero&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lower bound could be Lerner, R. M. (1964) &lt;a href=&quot;http://dx.doi.org/10.1109/PROC.1964.2868&quot; rel=&quot;nofollow&quot;&gt;Band-pass filters with linear phase&lt;/a&gt;, Proceedings of the IEEE, which seems to keep analog.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-08-04T12:03:57.327" LastActivityDate="2015-08-04T12:03:57.327" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25048" PostTypeId="1" CreationDate="2015-08-04T10:47:45.110" Score="1" ViewCount="460" Body="&lt;p&gt;Given a pinhole camera model, we have an image and according camera intrinsics &lt;code&gt;K&lt;/code&gt; and extrinsic parameters &lt;code&gt;R&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we scale the image or crop it, the corresponding camera intrinsics &lt;code&gt;K&lt;/code&gt; change in ways that can be found in literature. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, assume we transform or distort the image using a projective projection &lt;code&gt;Q&lt;/code&gt;. How do the intrinsic parameters &lt;code&gt;K&lt;/code&gt; of the camera change? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further reference, &lt;code&gt;Q&lt;/code&gt; is generated by &lt;code&gt;K * U * K^-1&lt;/code&gt;, where &lt;code&gt;U&lt;/code&gt; is a rotation matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The projective transformation is illustrated in the two images below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HOcJt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HOcJt.jpg&quot; alt=&quot;Input Image&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Qn2f1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qn2f1.jpg&quot; alt=&quot;Transformed Image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transformation used in this example is a slight rotation around the vertical axis. &lt;/p&gt;&#xA;" OwnerUserId="16573" LastActivityDate="2015-08-04T10:47:45.110" Title="In which way do image transformations change camera extrinsics?" Tags="|linear-algebra|camera-calibration|camera-pose|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25053" PostTypeId="1" AcceptedAnswerId="25055" CreationDate="2015-08-04T12:27:24.313" Score="0" ViewCount="1190" Body="&lt;p&gt;I'm working on project where I'm using Independent Components Analysis (ICA) on NxN patches from images to separate components in an image signal. Each column of the resulting MxN^2 unmixing matrix is reshaped back to an NxN filter containing the independent components. For my project, this filter is then convolved with new images for feature extraction purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how do I remove the DC offset of these NxN filters that result from ICA? In order words how can I ensure that (in MATLAB parlance) &lt;code&gt;sum(sum(filter)) == 0&lt;/code&gt; returns &lt;code&gt;1&lt;/code&gt;? Is it fair to just subtract the filter's sum from each component, or will that affect the filter's response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the filter sums to some non-zero value X, is it appropriate to just subtract &lt;code&gt;X/number_of_coefficients&lt;/code&gt; from each filter coefficient?&lt;/p&gt;&#xA;" OwnerUserId="16879" LastEditorUserId="16879" LastEditDate="2015-08-04T16:23:13.357" LastActivityDate="2015-08-04T16:23:13.357" Title="Removing DC offset and ensuring zero-sum for 2D filter" Tags="|image-processing|matlab|filters|ica|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25055" PostTypeId="2" ParentId="25053" CreationDate="2015-08-04T14:03:07.313" Score="1" Body="&lt;p&gt;Removing the mean (and not the sum) from a linear filter leads to a filter that removes DC. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 10;&#xA;h = [0.5 1 0.5];&#xA;conv(ones(N,1), h, 'valid')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;leads to 2s.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=10&#xA;h = [0.5 1 0.5]; h_high=h-mean(h);&#xA;conv(ones(N,1), h_high, 'valid')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;leads to zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can use any high pass filter.&lt;/p&gt;&#xA;" OwnerUserId="16570" LastActivityDate="2015-08-04T14:03:07.313" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25056" PostTypeId="1" AcceptedAnswerId="25088" CreationDate="2015-08-04T15:03:01.400" Score="0" ViewCount="311" Body="&lt;p&gt;I just implemented some interpolated texture sampling by sampling the 4x4 nearest pixels then doing Lagrange interpolation across the x axis to get four values to use Lagrange interpolation on across the y axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the same as bicubic interpolation or is it different?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Webgl implementation here:&#xA;&lt;a href=&quot;https://www.shadertoy.com/view/MllSzX&quot; rel=&quot;nofollow&quot;&gt;https://www.shadertoy.com/view/MllSzX&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15130" LastEditorUserId="15130" LastEditDate="2015-08-04T15:47:08.353" LastActivityDate="2015-08-05T22:30:14.740" Title="Is a cubic Lagrange interpolation tensor product the same as bicubic interpolation?" Tags="|interpolation|2d|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25057" PostTypeId="1" CreationDate="2015-08-04T15:50:13.800" Score="0" ViewCount="1111" Body="&lt;p&gt;I am facing the following problem:&#xA;I have an image and a contrast sentivity function (CSF). The CSF is a function defined in the frequency domain and it is just a band-pass filter. The problem is that it is a 1D filter so I do not know how to apply it to the Fourier transform of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about creating a 2D filter based on the revolution around the zero frequency of the 1D filter but I do not know if it is mathematically correct or if it is the common procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="16102" LastActivityDate="2015-08-04T16:06:17.090" Title="How to apply a 1D filter (CSF) to an image?" Tags="|image-processing|filters|fourier-transform|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25058" PostTypeId="2" ParentId="25057" CreationDate="2015-08-04T16:06:17.090" Score="1" Body="&lt;p&gt;I believe what you want to do is take your 1D filter column vector, call it $x$, and create a 2D filter with $xx^T$.  The result of this outer product (column vector times row vector) is a matrix that you can use to do element-wise multiplication with the 2D Fourier transform of the image.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-08-04T16:06:17.090" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25059" PostTypeId="1" AcceptedAnswerId="25060" CreationDate="2015-08-04T18:00:53.487" Score="0" ViewCount="116" Body="&lt;p&gt;I don't fully understand how the output of a system can be derived from the system's differential equation and a given input. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(0-) = 1 $$&#xA;$$y'(0-) = -2$$&#xA;$$ u(t) :   \text{Heaviside function} $$&#xA;$$ S:  y''(t) +2y'(t) +y(t) = u''(t) -2u'(t) + u(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone show me a good way to find $y(t)$, given $u(t)$ and $S$?&lt;/p&gt;&#xA;" OwnerUserId="16884" LastEditorUserId="8202" LastEditDate="2015-08-05T08:02:47.667" LastActivityDate="2015-08-05T08:02:47.667" Title="Output of system defined by differential equation" Tags="|linear-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25060" PostTypeId="2" ParentId="25059" CreationDate="2015-08-04T18:33:30.923" Score="0" Body="&lt;p&gt;What you want to do is take the Laplace transform of both sides of S.  The first and second derivative terms will be replaced by expressions of $Y(s)$ and the conditions at $t=0-$, so you can solve the equation for $Y(s)$ and then do the inverse Laplace transform, or more commonly, use partial fraction expansion to go back to the time domain.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See numbers 35 and 36 in the table of Laplace transforms &lt;a href=&quot;http://tutorial.math.lamar.edu/pdf/Laplace_Table.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-08-04T18:33:30.923" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25062" PostTypeId="2" ParentId="24991" CreationDate="2015-08-04T21:10:19.377" Score="1" Body="&lt;p&gt;Your question practically answers itself in the &quot;&lt;em&gt;If your method attempts to estimate the partial volume then the fuzzy model is probably what you want. Otherwise, the discrete model will probably do...&lt;/em&gt;&quot; quote.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: if you're only going to segment each voxel into &lt;em&gt;one&lt;/em&gt; of white/gray/CSF then yes, the discrete one seems the appropriate one to use.&lt;/p&gt;&#xA;" OwnerUserId="1828" LastActivityDate="2015-08-04T21:10:19.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25063" PostTypeId="1" AcceptedAnswerId="25072" CreationDate="2015-08-05T01:34:00.793" Score="3" ViewCount="4028" Body="&lt;p&gt;Is it possible to flip a signal's spectrum around DC?  I have a simple spectrum that I made up (MATLAB code):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;spectrum =   [-1+4i 0+3i 1+2i 2+1i 3+0i 4-1i 5-2i 6-3i 7-4i 8-5i]&#xA;timeDomain = ifft(spectrum);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I looked on this website (&lt;a href=&quot;http://www.dsprelated.com/showarticle/51.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showarticle/51.php&lt;/a&gt;) and the given proof states this can be done in 3 ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Invert the Q channel (14)&lt;/li&gt;&#xA;&lt;li&gt;Swap the I and Q channels (15)&lt;/li&gt;&#xA;&lt;li&gt;Invert the I channel (16)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I tried those 3 ways on my signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)  Invert the Q channel&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;negQtd   = real(timeDomain) - 1j * imag(timeDomain);&#xA;negQSpec = fft(negQtd)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[-1-4i 8+5i 7+4i 6+3i 5+2i 4+1i 3+0i 2-1i 1-2i 0-3i]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2)  Swap the I and Q channels&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;swapTD   = imag(timeDomain) + 1j * real(timeDomain);&#xA;swapSpec = fft(swapTD)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[4-1i -5+8i -4+7i -3+6i -2+5i -1+4i -0+3i 1+2i 2+1i 3+0i]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;3)  Invert the I channel&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;negItd   = -1 * real(timeDomain) + 1j * imag(timeDomain);&#xA;negISpec = fft(negItd)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1+4i -8-5i -7-4i -6-3i -5-2i -4-1i -3-0i -2+1i -1+2i -0+3i]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each of these does flip the spectrum of the signal, but it also modifies the spectrum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Inverting Time Domain Q channel also negates/inverts the Frequency Domain Imaginary part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Swapping the I and Q channels also swaps the Frequency Domain Real and Imaginary parts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Inverting the Time Domain I channel also negates/inverts the Frequency domain Real part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some other way to simply flip the spectrum around DC or should I try a two step process?&lt;/p&gt;&#xA;" OwnerUserId="11064" LastEditorUserId="11064" LastEditDate="2015-08-05T01:53:12.503" LastActivityDate="2015-08-05T13:46:48.840" Title="How to Flip Spectrum Around DC?" Tags="|matlab|fft|fourier-transform|frequency-spectrum|frequency|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25067" PostTypeId="1" CreationDate="2015-08-05T11:37:17.297" Score="1" ViewCount="3947" Body="&lt;p&gt;In general, for autocorrelation of the deterministic signals,from the formula what is the unit of it.&lt;/p&gt;&#xA;" OwnerUserId="16360" LastEditorUserId="13320" LastEditDate="2016-11-13T13:25:08.997" LastActivityDate="2016-11-13T13:25:08.997" Title="What is the unit of autocorrelation function?" Tags="|autocorrelation|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25068" PostTypeId="1" AcceptedAnswerId="25069" CreationDate="2015-08-05T11:58:14.067" Score="2" ViewCount="356" Body="&lt;p&gt;I have the following code, which I am told is a low-pass Butterworth filter. How do I derive the frequency response and phase for this? I only have experience in analog electronics and so cannot relate this to a real filter response. I'm not sure why everything is scaled up by 2^ 16 - it must be to do with maintaining adequate resolution during the calculations?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define FILTER_TC(FC, FS) ((411775 * FC) / FS)'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;TC = (2^16) * 2pi * Fc * Fs&lt;/code&gt;, with &lt;code&gt;Fc&lt;/code&gt; the cut-off frequency in Hz, and &lt;code&gt;Fs&lt;/code&gt; the sample frequency in Hz.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define FILTER_LP(FILTER_OUT, FILTER_IN, FC, FS) \&#xA;    (FILTER_OUT += ((signed long)FILTER_TC(FC, FS) * \&#xA;    ((signed long)FILTER_IN - (signed long)(FILTER_OUT)) &amp;gt;&amp;gt; 16)'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;jmv&lt;/p&gt;&#xA;" OwnerUserId="16891" LastEditorUserId="90" LastEditDate="2015-08-05T12:03:36.440" LastActivityDate="2015-08-05T13:31:21.283" Title="C implementation of LP filter" Tags="|filters|discrete-signals|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25069" PostTypeId="2" ParentId="25068" CreationDate="2015-08-05T12:18:56.067" Score="6" Body="&lt;p&gt;You can figure out the filter's transfer function by rewriting the body of the preprocessor macro a bit. Let &lt;code&gt;FILTER_TC(FC, FS)&lt;/code&gt; (which really just defines the cutoff frequency of the filter) be equal to &lt;code&gt;k&lt;/code&gt; in the below expression.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define FILTER_LP(FILTER_OUT, FILTER_IN, FC, FS) \&#xA;    FILTER_OUT = FILTER_OUT + ((signed long) k * ((signed long) FILTER_IN - (signed long) FILTER_OUT)) &amp;gt;&amp;gt; 16)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the above, I just expanded the &lt;code&gt;+=&lt;/code&gt; operator to be a bit less terse. By inspection, we can write the discrete-time difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = y[n-1] + k(x[n] - y[n-1]) \\&#xA;y[n] = (1-k)y[n-1] + k x[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y[n]$ and $x[n]$ are equal to &lt;code&gt;FILTER_OUT&lt;/code&gt; and &lt;code&gt;FILTER_IN&lt;/code&gt; at time index $n$, respectively. This maps to a $z$-domain transfer function of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = \frac{Y(z)}{X(z)} = \frac{k}{1 - (1-k)z^{-1}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a lowpass filter, although it is not a Butterworth filter. Its frequency response is plotted below for &lt;code&gt;k = 0.25&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9L2pw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9L2pw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above frequency response plot, the blue trace shows the magnitude response and the green trace corresponds to the phase response. It shows that the example you gave isn't a particularly good lowpass filter, even for a first-order filter. You could do better with respect to high-frequency attenuation by using a correct Butterworth structure, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bit manipulations and explicit casts to &lt;code&gt;signed long&lt;/code&gt; types are used because the filter is implemented using &lt;a href=&quot;https://en.wikipedia.org/wiki/Fixed-point_arithmetic&quot; rel=&quot;nofollow noreferrer&quot;&gt;fixed-point arithmetic&lt;/a&gt;. This is a scheme by which you use integers to represent real numbers using a fixed quantization level. Fixed-point implementations of DSP algorithms were almost ubiquitous in the past, but floating-point processing is becoming more and more common. I would expect to find fixed-point implementations primarily in low-power or embedded contexts today.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2015-08-05T13:31:21.283" LastActivityDate="2015-08-05T13:31:21.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25071" PostTypeId="2" ParentId="25043" CreationDate="2015-08-05T12:51:58.703" Score="2" Body="&lt;p&gt;I believe that this question doesn't have an answer in terms of a name and a date, simply because we're not talking about a &lt;em&gt;discovery&lt;/em&gt; here. From the theory of Fourier series it is a well-known fact that the Fourier coefficients of a real-valued periodic function exhibit Hermitian symmetry. Analogously, purely imaginary periodic functions have anti-symmetric Fourier coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the filter coefficients of a transversal filter are essentially the Fourier series coefficients of the corresponding spectrum (which is also nothing that needed to be discovered), it is obvious that (conjugate) symmetric filter coefficients correspond to a real-valued spectrum (i.e., zero phase spectrum). A linear phase is of course obtained by shifting the coefficients such that the filter becomes causal. A similar thing is true for anti-symmetric coefficients, which correspond to generalized linear phase filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in sum, there's nothing that needed to be discovered, and, consequently, no single researcher can be associated with &quot;discovering&quot; this fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In answer to Richard Lyons' comment I'll explain what I meant by writing &quot;it is obvious that symmetric filter coefficients correspond to a real-valued spectrum&quot;. By &quot;symmetric filter coefficients&quot; I meant filter coefficients that satisfy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=h^*[-n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i.e., hermitian symmetry), which for real-valued coefficients means simple symmetry. The frequency response of a length $2N+1$ symmetric FIR filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\sum_{n=-N}^{N}h[n]e^{-jn\omega}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $(1)$, this can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=h[0]+\sum_{n=1}^{N}\left(h[n]e^{-jn\omega}+h^*[n]e^{jn\omega}\right)=h[0]+2\Re\left\{\sum_{n=1}^{N}h[n]e^{-jn\omega}\right\}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where from the last equality it can be seen that $H(e^{j\omega})$ is real-valued. Note that for $(1)$ to be satisfied, $h[0]$ needs to be real-valued. If you shift the center of symmetry away from $n=0$ you get a linear phase instead of a zero phase.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-10-27T06:56:39.313" LastActivityDate="2016-10-27T06:56:39.313" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="25072" PostTypeId="2" ParentId="25063" CreationDate="2015-08-05T13:46:48.840" Score="6" Body="&lt;p&gt;The article &lt;a href=&quot;http://www.dsprelated.com/showarticle/51.php&quot; rel=&quot;noreferrer&quot;&gt;Handling Spectral Inversion in Baseband Processing&lt;/a&gt; that you refer to in your question is not about simple inversion of the frequency axis, but it is about inversion of the frequency axis &lt;em&gt;and&lt;/em&gt; conjugation in the frequency domain. This is necessary because due to different mixing conventions in several conversion stages, the upper and lower side-bands can be exchanged, and the two side-bands exhibit conjugate symmetry, because the transmitted signal is real-valued. So one side-band can be obtained from the other by inverting the frequency axis &lt;em&gt;and&lt;/em&gt; by additional complex conjugation (in the frequency domain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This process of inversion and conjugation in the frequency domain corresponds to complex conjugation of the complex baseband signal in the time domain, which is equivalent to simply inverting the $Q$ component. Since a phase shift of $180$ degrees is irrelevant, one can equivalently invert the $I$ component. A phase shift of $90$ degrees corresponds to a multiplication with $j$ in the time domain, and if this phase shift can be tolerated, you get the additional option of swapping the $I$ and $Q$ channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want pure inversion of the frequency axis &lt;em&gt;without&lt;/em&gt; conjugation, then you indeed need to invert the time axis of the corresponding time domain signal (as pointed out in a comment by @curiousStudent). Luckily this is usually not needed in practice because this can't be done easily in a real-time system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final note, all three options in your question do flip the &lt;em&gt;magnitudes&lt;/em&gt; of the spectra around DC, it is just the phases that behave differently in all three cases.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-05T13:46:48.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25073" PostTypeId="2" ParentId="25067" CreationDate="2015-08-05T13:53:17.487" Score="4" Body="&lt;p&gt;It depends.  Normalized autocorrelations have no units because the units are divided out as part of the normalization process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Non-normalized autocorrelations have the original data's units squared.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-08-05T13:53:17.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25074" PostTypeId="1" CreationDate="2015-08-05T14:35:57.100" Score="2" ViewCount="113" Body="&lt;p&gt;I'm wondering if they are some state-of-art algorithms to apply the convolutional neural network approach to 3D pictures, eg. input is no longer a grid of pixels, but voxels. My objective is to extract automatically features from 3D pictures and, cherry on the cake, perform supervised learning using 3D pictures as input data. Maybe others approach exist to extract features, but I would like to stay in the scope of machine learning approach (eg. don't want to use methods such as Fourier transform). Thanks in advance for your insights!&lt;/p&gt;&#xA;" OwnerUserId="16897" LastEditorUserId="7338" LastEditDate="2015-08-06T08:38:01.340" LastActivityDate="2023-03-02T14:27:59.970" Title="neural network for 3D pictures" Tags="|image-processing|computer-vision|machine-learning|3d|deep-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25075" PostTypeId="2" ParentId="23986" CreationDate="2015-08-05T14:44:10.527" Score="1" Body="&lt;p&gt;In literature it is shown that direct thresholding does not perform well. Consider iterative thresholding. You can find some papers on that ( see basis pursuit, matching pursuit etc.,). You can also read this paper - &lt;a href=&quot;http://arxiv.org/abs/1504.00976&quot; rel=&quot;nofollow&quot;&gt;http://arxiv.org/abs/1504.00976&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5608" LastActivityDate="2015-08-05T14:44:10.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25076" PostTypeId="1" AcceptedAnswerId="25078" CreationDate="2015-08-05T15:02:44.307" Score="2" ViewCount="1476" Body="&lt;p&gt;I have been looking around on Google, and I have not been able to find an explanation of how to do baseline placement in chromatography. what are some algorithms for placing a baseline on a chromatogram, how do those algorithms work. (Referral to Python implementations are welcome).&lt;/p&gt;&#xA;" OwnerDisplayName="user16898" LastActivityDate="2018-06-22T10:08:36.277" Title="Chromatography Baseline Placement" Tags="|algorithms|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25077" PostTypeId="2" ParentId="25074" CreationDate="2015-08-05T16:34:41.747" Score="1" Body="&lt;p&gt;3D Shape Nets is published this year at CVPR (2015). You could access it at &lt;a href=&quot;https://people.csail.mit.edu/khosla/papers/cvpr2015_wu.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;3D ShapeNets: A Deep Representation for Volumetric Shapes&lt;/a&gt;. This is a good way to use voxels as input to DNNs. There are also works applying DNNs to medical imaging such as &lt;a href=&quot;http://www.cv-foundation.org/openaccess/content_cvpr_workshops_2015/W01/papers/Brebisson_Deep_Neural_Networks_2015_CVPR_paper.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep Neural Networks for Anatomical Brain Segmentation&lt;/a&gt; and &lt;a href=&quot;https://link.springer.com/chapter/10.1007/978-3-319-24553-9_69&quot; rel=&quot;nofollow noreferrer&quot;&gt;3D Deep Learning for Efficient and Robust Landmark&#xA;Detection in Volumetric Data&lt;/a&gt;. I guess these would help you a lot.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2023-03-02T14:27:59.970" LastActivityDate="2023-03-02T14:27:59.970" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="25078" PostTypeId="2" ParentId="25076" CreationDate="2015-08-05T16:40:40.357" Score="1" Body="&lt;p&gt;In some physico-chemistry methods, baselines can be modelled by closed-form lineshapes. This is not typically the case for chromatography, and it can be even worse depending on the type of chromatography (gaz, liquid).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have to rely on some morphological properties that you believe valid for your type of signal. You can model the background by a given polynomial, assume derivability of the peaks, etc. And then fit, or optimize a cost function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a recent work, we have modeled gaussian peaks as sparse with sparse derivative. We add that peaks are typically positive. Then we suppose that the baseline is smooth enough to remain after the  use of a low-pass filter. Finally, we consider Gaussian noise, yet it works with Poisson noise as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The BEADS (Baseline Estimation And Denoising w/ Sparsity) method is described, and compared with two other methods in  &quot;Chromatogram baseline estimation and denoising using sparsity (BEADS)&quot;, by Xiaoran Ning, Ivan W. Selesnick, Laurent Duval, in Chemometrics and Intelligent Laboratory Systems, December 2014, &lt;a href=&quot;http://dx.doi.org/10.1016/j.chemolab.2014.09.014&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://dx.doi.org/10.1016/j.chemolab.2014.09.014&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have made the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/49974-beads--baseline-estimation-and-denoising-w--sparsity--chromatogram-signals-&quot; rel=&quot;nofollow noreferrer&quot;&gt;associated Matlab toolbox&lt;/a&gt; available in Matlab.  Contributed versions in &lt;strong&gt;C++&lt;/strong&gt;, &lt;strong&gt;R&lt;/strong&gt;, and &lt;strong&gt;Python&lt;/strong&gt; are made available through the companion &lt;a href=&quot;http://www.laurent-duval.eu/siva-beads-baseline-background-removal-filtering-sparsity.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;BEADS&lt;/a&gt; page.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2018-06-22T10:08:36.277" LastActivityDate="2018-06-22T10:08:36.277" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25079" PostTypeId="2" ParentId="23986" CreationDate="2015-08-05T17:24:14.300" Score="6" Body="&lt;p&gt;Thresholding in the Fourier domain is an archaic method sometimes called spectral subtraction, used for background noise removal in speech. Bad results in image processing can be due to several factors:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Misinterpretation: you say &quot;The Fourier denoising hard threshold method just uses threshold value to keep high frequency coefficients&quot;. Not quite. You keep &quot;high amplitude coefficients&quot;, no matter low or high frequency.&lt;/li&gt;&#xA;&lt;li&gt;Test data: the Shepp-Logan model is known to be quite specific. Bad results on it do not imply bad results on real data, yet:&lt;/li&gt;&#xA;&lt;li&gt;Transform choice: Fourier is very good for close-to-stationnary data. Standard images with smooth parts inside contours are not well represented in the Fourier domain, at least not concentrated enough for acurate data compaction and reconstruction with few (high) coeffcients. Derivatives, or multiscale directional derivatives like wavelets can help better.&lt;/li&gt;&#xA;&lt;li&gt;Implementation: Fourier implementation via FFT suffers boundary artifacts&#xA;coefficients, not talking about the 1D implementation you seem to use (prefer fft2 here)&lt;/li&gt;&#xA;&lt;li&gt;Coefficient selection: hard and scalar thresholding typically yields more important visual artifacts than &quot;smoother&quot; thresholding and vector or group thresholding. &lt;/li&gt;&#xA;&lt;li&gt;Formulation: you can generally get better results when you do not use a &quot;parameter-tuned algorithm&quot;, but prefer a variational formulation based on your priors, including noise statistics.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So you have plenty of room to improve your results. Two references for multivariate image denoising with automated threshold (for Gaussian noise):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://arxiv.org/abs/0712.2317&quot; rel=&quot;noreferrer&quot;&gt;A nonlinear Stein based estimator for multichannel image denoising&lt;/a&gt;, 2008&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.laurent-duval.eu/Articles/Chaux_C_2010_inbook_wav_tdmi.pdf&quot; rel=&quot;noreferrer&quot;&gt;Wavelet transform for the denoising of multivariate images&lt;/a&gt;, 2010 &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-12-05T13:12:33.857" LastActivityDate="2015-12-05T13:12:33.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25080" PostTypeId="1" AcceptedAnswerId="25081" CreationDate="2015-08-05T17:25:18.723" Score="0" ViewCount="414" Body="&lt;p&gt;I have a strongly aperiodic signal and I get weird artifacts after running a fft, using a low-pass filter, and then doing an inverse fft.  I believe the artifacts are due to the way the signal is assumed to be periodic and &quot;wrapped&quot; at the ends. (Like I said, I'm a complete beginner here.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the usual way of handling aperiodic signals is via a window function, but applying a window function (say, Hamming) to my data looks like it squishes the data too much and like it would generate worse artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What sort of seems like it works is to &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;surround the signal with silence, by prepending and appending a segment of 0s,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;doing the fft, applying the filter, etc., and then inverting the fft, then&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;clipping off the silence segments off the beginning and end.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The result of step 1 looks like applying a rectangular window function to a longer signal, so I think that's ok, but...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is what I'm doing in any way reasonable?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If so, what are the effects? And what is the best way to determine the length of the segments of 0s? (Currently, 10% of the original signal seems like it's not bad.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If not, is there another way to do this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16899" LastActivityDate="2015-08-06T15:54:05.650" Title="Beginner question on aperiodic samples and DFT behavior" Tags="|fft|dft|" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="25081" PostTypeId="2" ParentId="25080" CreationDate="2015-08-05T18:25:16.687" Score="1" Body="&lt;p&gt;It sounds to me like you are experiencing time-domain aliasing. First, two basic facts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Recall that if $x[n]$ is of length $N$ and $h[n]$ is of length $M$ then $x[n]\ast h[n]$ is of length $N+M-1$. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Fact 1 does not matter in what domain you perform the convolution/filtering. So, if you modify the DFT of $x[n]$ by &quot;shaping&quot; its spectrum, then there exists an  equivalent filter $h[n]$ in the time domain, which defines an implicit length $M$. &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Taking an $N_1$-point IDFT of an $N_2$-point signal for $N_1 &amp;lt; N_2$ results in time-aliasing.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Fact 2 is the dual to frequency aliasing by undersampling. I'll illustrate this as follows: let $x_1[n]$ denote a signal of size $N_1$. Then, if we take an $N_1$-point DFT of $x_1$ and modify its spectrum so the size should be $N_2&amp;gt;N_1$, then taking an $N_1$-point IDFT is equivalent to obtaining the signal $x_2$ given by: &#xA;\begin{eqnarray}&#xA;x_2[n] = \sum_{p=0}^{\infty}x[n+pN_1]&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to be consistent with what you have mentioned. As you correctly noted, zero padding the original signal is exactly the solution! Essentially just zero-pad such that the terms in the above equation for $p&amp;gt;0$ are all zero-valued. Also, using the ideas above gives you a way to understand the exact amount of zero-padding necessary based on the implicit filter $h[n]$ your frequency domain shaping yields. Good luck!&lt;/p&gt;&#xA;" OwnerUserId="16767" LastEditorUserId="16767" LastEditDate="2015-08-05T18:36:01.603" LastActivityDate="2015-08-05T18:36:01.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25082" PostTypeId="2" ParentId="22012" CreationDate="2015-08-05T19:16:07.870" Score="0" Body="&lt;p&gt;I'm not familiar with sound effects, but given your example code, the answer by Jan-Bert and some information found on the internet I've come up with the implementation below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added the depth parameter, for which I found a value less than 1 very pleasant. Since I don't know the effect, I have no idea about desired parameter values/ranges, i.e, the lfo Frequency, Amplitude and Mean. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd love to receive some feedback on useful settings.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Read audio data&#xA;[x, fs] = audioread('myaudiofile.wav');&#xA;&#xA;% parameters:&#xA;lfo_f_Hz = 0.01; % LFO frequency in Hz&#xA;lfo_A_ms = 2.0;  % Amplitude of delay variations in ms&#xA;lfo_M_ms = 5.0;  % Average delay in ms&#xA;depth = 0.3; % Ratio between direct and echo contributions&#xA;&#xA;assert(lfo_A_ms &amp;lt; lfo_M_ms);&#xA;&#xA;% Create LFO&#xA;lfo_A = lfo_A_ms*fs/1000;  % Delay variations in samples&#xA;lfo_M = 5*fs/1000;  % Average delay in samples&#xA;N = length(x);&#xA;n = 0:(N-1); &#xA;&#xA;% Allow only integer delay values&#xA;% OPTION: calculate only one period and used it circular (saves memory)&#xA;lfo = round((lfo_A * sin(2*pi*f_lfo_Hz/fs*n)) + lfo_M); &#xA;&#xA;y = zeros(size(x)); &#xA;for ii = 1:N        &#xA;    if ii &amp;lt;= lfo(ii)  % No flanger during startup.&#xA;        y(ii) = x(ii); &#xA;    elseif lfo(ii) &amp;gt;= N  % No flanger at the end.&#xA;        y(ii) = x(ii); &#xA;    else  % Apply flanger&#xA;        % REMARK: Save at least lfo_A + lfo_M input samples!&#xA;        y(ii) = x(ii) + depth * x(ii - lfo(ii)); &#xA;    end    &#xA;end&#xA;&#xA;audiowrite('flanger.wav', y, fs);&#xA;%p = audioplayer(x,fs);&#xA;%p.play()&#xA;p = audioplayer(y,fs);&#xA;p.play()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16570" LastEditorUserId="16570" LastEditDate="2015-09-07T10:18:19.023" LastActivityDate="2015-09-07T10:18:19.023" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25087" PostTypeId="1" AcceptedAnswerId="25096" CreationDate="2015-08-05T21:59:25.557" Score="1" ViewCount="1304" Body="&lt;p&gt;I know that in the continuous-time context, if I supply a complex exponential input to a Linear Time Invariant system, the output will be of the same form as the input - for example, if the input is $x(t)=Ae^{j \omega_0 t+\phi}$, the output will be of the form $y(t)=|H(j\omega_o)|\centerdot A \centerdot e^{j(H(s)\omega_0 t+\phi +\theta_H)}$ where $H(s)|_{s=j\omega_0} = |H(j\omega_0)|e^{j\theta_H}$ is the transfer function of the system evaluated at the frequency $j\omega_0$. My point is that the system does not modify the input frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the same hold true in the discrete-time context? If I supply an input $x[n]=a^n$ to an LTI system, will the output also contain $a^n$? Or is it possible to supply $a^n$ and get the output $b^n +c^n$ where $a\ne b\ne c$ (for example, $x[n]=(1/6)^n$, $y[n]=B(1/2)^n + C(1/3)^n$)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: I've posted &lt;a href=&quot;https://dsp.stackexchange.com/questions/25100/output-of-a-discrete-time-lti-system-different-form-than-input&quot;&gt;a related question&lt;/a&gt; that contains the issue that actually prompted this question...&lt;/p&gt;&#xA;" OwnerUserId="16901" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-08-06T16:19:05.643" Title="Output of discrete-time LTI system guaranteed to be same form as input?" Tags="|discrete-signals|linear-systems|theory|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25088" PostTypeId="2" ParentId="25056" CreationDate="2015-08-05T22:30:14.740" Score="0" Body="&lt;p&gt;i don't need the points, but the Community keeps resurrecting unanswered questions (or answered questions that have no accepted answer) until i go batty seeing them on the list, time and time-again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;:-\&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i think the bicubic interpolation is more likely 3rd-order Hermite polynomial than 3rd-order Lagrange polynomial interpolation. the former guarantees continuity of both the zeroeth and first derivative. the latter only guarantees continuity of the zeroeth derivative (the interpolated function itself).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/18265/bicubic-interpolation/18273#18273&quot;&gt;this previous answer&lt;/a&gt; deals pretty completely with the necessary math of it.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-08-05T22:30:14.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25089" PostTypeId="2" ParentId="25087" CreationDate="2015-08-05T22:44:59.757" Score="2" Body="&lt;p&gt;The point is that a complex exponential function is an eigenfunction of an LTI system &lt;a href=&quot;https://en.wikipedia.org/wiki/LTI_system_theory#Exponentials_as_eigenfunctions&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;. Therefore the frequency is not changing, i.e., the LTI system translates to a (complex-valued) gain $H(j\omega_0)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For discrete systems, the eigenfunctions are sampled exponential functions &lt;a href=&quot;https://en.wikipedia.org/wiki/LTI_system_theory#Exponentials_as_eigenfunctions_2&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;, i.e., &#xA;$x[n] = A\cdot e^{j\omega_n n}$, where $\omega_0=2\pi f/f_s$ is a normalized frequency. The output of a discrete LTI system is then $y[n]=H(e^{j\omega_n})\cdot A \cdot e^{j\omega_nn}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;A discrete input signal x[n] can be written as a weighted sum of complex exponentials, i.e., $X(e^{j\omega}) = \sum_{n}x[n]e^{j\omega}$ &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;. This transformation is in fact a change of basis. Driving such a signal thru an LTI system will weight each exponential function with the complex-valued gain $H(e^{j\omega})$. Thus, no additional frequencies will be introduced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note (a bit out of scope, but good to realize):&lt;/strong&gt; &#xA;When dealing with sampling a contuous-time signal and dealing with finite length signals, then you may observe additional frequencies due to aliasing and windowing. &lt;/p&gt;&#xA;" OwnerUserId="16570" LastEditorUserId="16570" LastEditDate="2015-08-06T09:03:00.743" LastActivityDate="2015-08-06T09:03:00.743" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25090" PostTypeId="1" CreationDate="2015-08-05T22:45:30.563" Score="1" ViewCount="229" Body="&lt;p&gt;Let's consider the cyclic frequency transform and let's try to make it so that the transform of the function is itself.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=linspace(-32,32,4096);&#xA;dt=t(2)-t(1);&#xA;fq=linspace( -1/(2*dt) , 1/(2*dt) , length(t) + 1 );&#xA;fq=fq(1:  length(t)  );&#xA;x=exp(-pi*t.*t);&#xA;X=fftshift(fft(x)).*exp(-1i*2*pi*fq*t(1))*dt;&#xA;plot(t,real(X));hold on;plot(t,imag(X));hold off;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now this actually works, and believe me it was not easy for me to get these right. I basically resorted to trial and error, tried adding $\pm 1$ everywhere until I got something that looked reasonable at all. I would like to learn the method behind this madness.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is is a good idea to use something like &lt;code&gt;t=linspace(-32,32,4096);&lt;/code&gt;&lt;br&gt;&#xA;Considering how the frequency is asymmetrical, perhaps time should be as well?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What frequencies does the result of &lt;code&gt;X=fftshift(fft(x))&lt;/code&gt; actually correspond to?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Any other suggestions, etc.?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16852" LastEditorUserId="1629" LastEditDate="2016-08-01T14:43:37.110" LastActivityDate="2017-06-28T00:33:26.077" Title="Exact indices of $\tt fft$" Tags="|matlab|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25091" PostTypeId="2" ParentId="25087" CreationDate="2015-08-05T22:57:08.577" Score="0" Body="&lt;p&gt;it turns out that, solely because it's Linear and Time-Invariant, an LTI discrete-time system has output $y[n]$ mapped from input $x[n]$ using convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = \sum\limits_{i=-\infty}^{+\infty} x[i] \, h[n-i] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h[n]$ is the &lt;strong&gt;impulse response&lt;/strong&gt; of the due to an input that is the Kronecker delta&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \delta[n] =&#xA;\begin{cases}&#xA;1, &amp;amp; \text{if }n = 0 \\&#xA;0, &amp;amp; \text{if }n \ne 0&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, if $x[n]=\delta[n]$, then $y[n]=h[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, if $x[n]=e^{j \omega n}$, it is not terribly hard ('specially for discrete summation rather than the &lt;em&gt;convolution integral&lt;/em&gt; for continuous-time systems) to show that if &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=e^{j \omega n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = H(e^{j \omega}) e^{j \omega n} =  H(e^{j \omega}) x[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = \sum\limits_{n=-\infty}^{+\infty} h[n] \, z^{-n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because i'm lazy (and need to get going), i'm happy for anyone to edit this answer to include and explicit derivation.  but it's easy.  then substitute $a = e^{j \omega}$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-08-05T22:57:08.577" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25092" PostTypeId="2" ParentId="25090" CreationDate="2015-08-05T23:09:59.873" Score="1" Body="&lt;p&gt;The FFT calculates the spectrum at N points in the range from $[0, 2\pi)$ where due to the cyclic property the relative frequency 0 must be equal to the frequency $2\pi$. This is best shown via an example. Note that $2\pi$ corresponds to your sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&#xA;For a length 3 impulse response, say $h=[0.5, 1, 0.5]$, the FFT calculates the spectrum at the relative frequencies $[0, \frac{1}{3}2\pi, \frac{2}{3}2\pi]$, instead of the frequencies $[0, \frac{1}{2}2\pi, 2\pi]$. One way to calculate these frequencies in Matlab for an $N$ points FFT is as follows: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 3;&#xA;h = [0.5 1 0.5];&#xA;fq = linspace(0, 2*pi, N+1);&#xA;fq = fq(1:end-1);&#xA;H = fft(h);&#xA;figure; &#xA;plot(fq, abs(H)); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The function fftshift takes the right part of the spectrum and places it on the left such that you obtain the frequencies $[\frac{2}{3}2\pi, 0, \frac{1}{3}2\pi]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you are not using the fftshift function and just plot the range $[0, 2\pi]$, then you can use positive time indices for t.&lt;/p&gt;&#xA;" OwnerUserId="16570" LastEditorUserId="4346" LastEditDate="2016-10-30T19:11:14.727" LastActivityDate="2016-10-30T19:11:14.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25093" PostTypeId="1" AcceptedAnswerId="25182" CreationDate="2015-08-05T23:18:09.373" Score="2" ViewCount="148" Body="&lt;p&gt;There is an Autoregressive model of order 1 (AR(1)) that is excited by a non-linear signal as the input:&#xA;$$x_t = \rho x_{t-1} + u_t \tag{1}$$&#xA;The time series $u_t$ is generated from a nonlinear map,&#xA;$$u_t = f(u_{t-1},\mathbf{w}) \tag{2}$$ where $f$ is the nonlinear function.&#xA;The observations are $$y_t = x_t + v_t \tag{3}$$ where $v_t$ is the measurement noise that is an Additive White Gaussian Noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: Can I re-write the model (1) as a state space in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_t = Ax_{t-1} + f(u_{t-1},\mathbf{w}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_t =  x_t+ v_t \tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the above representation correct? If not then I shall be grateful for the correct technique to represent it. &lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="5119" LastEditDate="2015-08-07T17:26:26.703" LastActivityDate="2015-08-11T00:07:42.613" Title="How to represent the nonlinear model as a state space in Unscented Kalman Filter" Tags="|kalman-filters|state-space|self-study|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25094" PostTypeId="1" CreationDate="2015-08-06T07:07:31.647" Score="0" ViewCount="205" Body="&lt;p&gt;Assume a chirp with BW = 1 Hz (frequency range 0-1 Hz) for a period of 700 sec. The pulse compression technique (obtained through auto correlation function) applied on the chirp  generates a pulse with the main lobe width of 1.0 sec.&#xA;However, on changing the frequency range to 1-2 Hz ( the BW is same) , the width of the main lobe of the generated pulse changes to 0.6. The image shows &lt;a href=&quot;https://i.stack.imgur.com/K9IZX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K9IZX.jpg&quot; alt=&quot;the compressed pulse obtained from two different chirps at 0-1 Hz and 1-2 Hz frequency range,respectively&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know the reason behind this. Theoretically, the width of the main pulse is dependent only on the BW. (=1/2BW)&lt;/p&gt;&#xA;" OwnerUserId="7328" LastEditorUserId="13320" LastEditDate="2016-11-13T12:52:49.047" LastActivityDate="2016-11-13T12:52:49.047" Title="Variation of Pulse width with center frequency in Pulse Compression technique" Tags="|signal-analysis|convolution|time-frequency|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25095" PostTypeId="1" CreationDate="2015-08-06T07:37:24.853" Score="0" ViewCount="644" Body="&lt;p&gt;Consider a digital camera that faces an LCD and that is perfectly focused on the LCD. The LCD shows an image of $n \times n$ pixels. What resolution does the camera have to have to perfectly capture the image displayed on the LCD?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Let's keep this simple and assume that camera pixels and LCD pixels are of the same size, pixels are &quot;atomic&quot; objects, no perspective distortion, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm asking because I have found the following statement in &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6942203&quot; rel=&quot;nofollow&quot;&gt;a paper&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;To satisfy the Nyquist criteria for image resolution, each pixel of&#xA;  the image shown on the LCD should be sampled by 2 or more pixels in&#xA;  the camera.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand this. Intuitively, I would say that if camera and LCD were perfectly aligned, then a camera with $n \times n$ pixels would suffice. My (poor) understanding of theory also suggests the statement is wrong, because every row or column of the image on the LCD can have a maximum frequency component of $n/2$. The minimum sampling rate would be $n$, not $2n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="16904" LastActivityDate="2015-08-06T07:37:24.853" Title="Sampling rate: camera resolution when taking a photo of an LCD" Tags="|sampling|nyquist|camera|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25096" PostTypeId="2" ParentId="25087" CreationDate="2015-08-06T09:33:19.340" Score="2" Body="&lt;p&gt;Despite the two other answers, I'll add one more, because I have the feeling that your final paragraph has not yet been answered satisfactorily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A discrete-time LTI system with impulse response $h[n]$ has a transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\sum_{n=-\infty}^{\infty}h[n]z^{-n}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its output $y[n]$ for a given input sequence $x[n]$ is given by the convolution sum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=-\infty}^{\infty}h[k]x[n-k]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $x[n]=a^n$ we get from $(2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=-\infty}^{\infty}h[k]a^na^{-k}=a^n\sum_{k=-\infty}^{\infty}h[k]a^{-k}=a^nH(a)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where Eq. $(1)$ was used in the last equality. Eq. $(3)$ shows that for $x[n]=a^n$, the output of a discrete-time LTI system is just a weighted version of the input signal. Hence, the sequence $a^n$ is an eigenfunction of a discrete-time LTI system. &lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-06T09:33:19.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25097" PostTypeId="2" ParentId="23900" CreationDate="2015-08-06T10:07:07.393" Score="0" Body="&lt;p&gt;I agree with A. Donda's comments regarding outliers and detrending. People use Hanning windows to minimize the &quot;leakage&quot; effect inherent in the discrete Fourier transform. That is, they want to minimize a strong spectral component's leakage from corrupting the spectrum of a weaker nearby-frequency spectral component.  Is that why you're using a Hanning window?&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-06T10:07:07.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25098" PostTypeId="1" CreationDate="2015-08-06T10:13:47.337" Score="0" ViewCount="23" Body="&lt;p&gt;When I do a stereographic projection and rotationX of omnidirectionnel image, I get this image: &lt;a href=&quot;https://i.stack.imgur.com/BSF7t.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BSF7t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why I get that &quot;grille&quot; in the image, it appears only when I add rotation&lt;/p&gt;&#xA;" OwnerUserId="16905" LastActivityDate="2015-08-06T10:13:47.337" Title="Black “grille” after stereographic projection+rotation" Tags="|projection|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25099" PostTypeId="2" ParentId="25080" CreationDate="2015-08-06T15:54:05.650" Score="1" Body="&lt;p&gt;If you can determine the length of the impulse response of your filter (or a finite length above your desired noise floor), that's the amount of zeros you need to add as zero padding before your FFT-IFFT fast convolution filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that an extremely sharp filter (similar to zeroing FFT bins) will have a longer and more &quot;ripply&quot; impulse response than one with a &quot;softer&quot; transition band.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-08-06T15:54:05.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25100" PostTypeId="1" AcceptedAnswerId="25103" CreationDate="2015-08-06T16:15:41.920" Score="2" ViewCount="478" Body="&lt;p&gt;This question is related to &lt;a href=&quot;https://dsp.stackexchange.com/questions/25087/output-of-discrete-time-lti-system-guaranteed-to-be-same-form-as-input&quot;&gt;this one&lt;/a&gt;. I'm going through old exams for a 2nd year systems and transforms course, and came across this question. I'm posting this question just in case my other question doesn't actually represent this issue properly...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose &lt;em&gt;that&lt;/em&gt; we are given the following information about an LTI system: if the input to the system is $x_1[n]=(1/6)^n u[n]$, then the output is $y_1[n]=[a(1/2)^n +10(1/3)^n]u[n]$. If $x_2[n]=(-1)^n$, then the output is $y_2[n]=(7/4)(-1)^n$ &lt;em&gt;where $a$ is a real number&lt;/em&gt;. Determine the transfer function of this system and the value of the number $a$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The solution proceeds by determining the z-transform of $x_1$ and $y_1$ and stating the transfer function as $H(z)=Y_1(z)/X_1(z)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it seems to me that it's impossible for this system to generate an output of $(1/2)^n+(1/3)^n$ if the input is $(1/6)^n$,and hence the question is somewhat contrived if not outright bogus - see the discussion pertaining to my other question.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="16901" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-08-07T08:20:58.780" Title="Output of a discrete-time LTI system different form than input?" Tags="|discrete-signals|linear-systems|theory|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25101" PostTypeId="2" ParentId="25100" CreationDate="2015-08-06T18:03:35.043" Score="2" Body="&lt;p&gt;&lt;strong&gt;NOTE: The answer is not complete; however, it seems the problem cannot be solved.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have the following z-transforms of the input signals: &#xA;$$x_1[n]=(1/6)^n\cdot u[n]\quad\longleftrightarrow\quad X_1(z)=\frac{1}{1-(1/6)\cdot z^{-1}}$$&#xA;$$x_2[n] = (-1)^n\quad\longleftrightarrow\quad X_2(z)=\frac{1}{1+z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the output signals we have the following z-transforms:&#xA;$$y_1[n] = [a(1/2)^2 + 10(1/3)^n]u[n] \quad\longleftrightarrow\quad Y_1(z) = a\frac{1}{1-(1/2)\cdot z^{-1}} + 10\frac{1}{1-(1/3)\cdot z^{-1}}$$&#xA;$$y_2[n] = (7/4)(-1)^n\quad\longleftrightarrow\quad Y_2(z) = (7/4)\frac{1}{1+z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For both pairs of signals we know that the transfer function equals $H(z)=\frac{Y(z)}{X(z)}$. From $\{X_2(z),Y_2(z)\}$ we know that $H(z) = 7/4$ (Which is trivial due to linearity, i.e., it follows also directly from $\{x_2[n],y_2[n]\}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What remains is to solve $Y_1(z) = H(z)\cdot X_1(z)$ for $a$; however, I don't get a proper result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Another way to appraoch this last step is to solve the following: &#xA;$$a\frac{2}{2-z^{-1}} + b\frac{3}{3-z^{-1}} = c\frac{6}{6-z^{-1}}$$&#xA;where you may choose $b=10$ if desired. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix representation:&#xA;$$\mathbf{A}\left[\begin{array}{1}a\\b\\c\end{array}\right] = \mathbf{b}$$&#xA;the matrix $\mathbf{A}$ is a full rank size 3x3 matrix, which shows that no scalar solution for $H(z)=c$ with $b=10$ exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT2:&lt;/strong&gt;&#xA;The solution seems to be that $H(-1)=7/4$ and $a=-9$. We already found that $H(z)=7/4$ for any $z$, based on the signals $\{X_2(z), Y_2(z)\}$. When evaluating $\{X_1(z),Y_1(z)\}$ for $z=-1$, the solution $a=-9$ follows easily. However, for another value of $z$, say $z=-2$ we obtain $a\approx -9.375$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion, the decomposition only holds for $z=-1$.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="16570" LastEditorUserId="16570" LastEditDate="2015-08-06T19:04:07.267" LastActivityDate="2015-08-06T19:04:07.267" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25102" PostTypeId="2" ParentId="12694" CreationDate="2015-08-06T19:46:51.433" Score="5" Body="&lt;p&gt;The short-time Fourier transform is generally a redundant transformation, usually implemented with the same subsampling over every frequency. If the window is well chosen, it is complete: you can invert it and recover any initial signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is redundant and complete, it has many perfect inverses. It can be implemented and understood using more generic tools: (oversampled) complex filter banks. Given a window type and length plus the overlap provides you with an analysis filter bank for which you can compute whether it is invertible or not. If it does, you can compute a natural inverse, and &lt;a href=&quot;http://dx.doi.org/10.1109/TSP.2009.2023947&quot; rel=&quot;nofollow&quot;&gt;optimized inverses&lt;/a&gt; too. The overlap-add is just one on the many potential inverses, probably the most common, which often restricts the window choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard discrete wavelet transforms are filter banks too, with the difference that the subsampling is not the same in each frequency band (or more properly scale). This turns into uneven lengths for each scales. Yet, there exists redundant wavelet implementations that yield &quot;a rectangle array&quot; of coefficients you can work with. The best known schemes are called under different names: shift-invariant or &lt;a href=&quot;http://dx.doi.org/10.1109/78.533717&quot; rel=&quot;nofollow&quot;&gt;time-invariant wavelets&lt;/a&gt;, undecimated wavelets, &lt;a href=&quot;https://en.wikipedia.org/wiki/Stationary_wavelet_transform&quot; rel=&quot;nofollow&quot;&gt;stationary wavelet transform&lt;/a&gt; (SWT), and sometimes cycle-spinning. Its standard reconstruction involves steps similar to overlap-add, except they are more &quot;embedded&quot; due to the different sampling factors over scales. You can use them with any discrete wavelet from a library, or even by designing your own wavelet. The reason is that standard discrete wavelets were designed with non-redundancy in mind, which restricts the choice of wavelets. With redundancy, you wavelet choice increases, as the constraints to fulfill are less stringent. The &quot;ultimate&quot; avatar is the continuous wavelet transform, which admits &quot;almost&quot; every inverse synthesis wavelet. My last sentence is quite lousy, I hope you get the meaning: when a square matrix is invertible, it has only one inverse. When a &quot;rectangular&quot; matrix is left-invertible in a generalized way, it has several inverses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seems to be a python implementation of the &lt;a href=&quot;http://www.pybytes.com/pywavelets/ref/swt-stationary-wavelet-transform.html&quot; rel=&quot;nofollow&quot;&gt;Stationary Wavelet Transform&lt;/a&gt;. You can find a few references in the &lt;a href=&quot;http://arxiv.org/abs/1101.5320&quot; rel=&quot;nofollow&quot;&gt;2.3.4. Translation invariant wavelets chapter of the linked paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is generally much more robust for detection, denoising or restoration in practical applications (geophysics, non-destructive testing, ultrasounds, vibrations).&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-10-06T17:53:23.547" LastActivityDate="2015-10-06T17:53:23.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25103" PostTypeId="2" ParentId="25100" CreationDate="2015-08-06T20:29:22.167" Score="3" Body="&lt;p&gt;If you compute the $\mathcal{Z}$-transforms of $x_1[n]$ and of $y_1[n]$ you get (as already shown in Brian's answer)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_1(z)=\frac{1}{1-\frac16z^{-1}}\\&#xA;Y_1(z)=\frac{a}{1-\frac12z^{-1}}+\frac{10}{1-\frac13z^{-1}}=(a+10)\frac{1-\frac{a+15}{3(a+10)}z^{-1}}{(1-\frac12z^{-1})(1-\frac13z^{-1})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system's transfer function must be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y_1(z)}{X_1(z)}=(a+10)\frac{\left(1-\frac{a+15}{3(a+10)}z^{-1}\right)(1-\frac16z^{-1})}{(1-\frac12z^{-1})(1-\frac13z^{-1})}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the relation between $x_2[n]$ and $y_2[n]$ we know that $H(-1)=7/4$, because for an input signal $b^n$, the output signal of a discrete-time LTI system with transfer function $H(z)$ is $H(b)\cdot b^n$ (see also &lt;a href=&quot;https://dsp.stackexchange.com/questions/25087/output-of-discrete-time-lti-system-guaranteed-to-be-same-form-as-input/25096#25096&quot;&gt;this answer&lt;/a&gt;). If you plug that into $(1)$ you indeed get $a=-9$. With this value for $a$, the transfer function becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{(1-2z^{-1})(1-\frac16z^{-1})}{(1-\frac12z^{-1})(1-\frac13z^{-1})}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the output signal $y_1[n]$ only reflects the system's poles, i.e. the transient response, because the steady state response is zero due to the system's zero at $z=1/6$. Note that the system's reaction to the input signal $x_3[n]=(\frac16)^n$ (without the step function!) is $y_3[n]=H(\frac16)\cdot(\frac16)^n=0$. Since your input signal is switched on at $n=0$ (due to the step function) you see a decaying transient response (because the system is stable), but no other contribution from the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important to realize that you can't determine a transfer function from the relation between $x_2[n]$ and $y_2[n]$ (this was the mistake in Brian's answer, see also my comment there). That relation only determines the transfer function for one value of $z$, namely $z=-1$. Note that the sequence $x_2[n]=(-1)^n$ has no $\mathcal{Z}$-transform. The function $1/(1+z^{-1})$ is the $\mathcal{Z}$-transform of $(-1)^n\cdot u[n]$!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; (answering the questions in the comments)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The output of an LTI system just has the same form as the input for the &lt;em&gt;eigenfunctions&lt;/em&gt; $a^n$ (without the step function!), not for other functions. As mentioned before, the corresponding output is $H(a)\cdot a^n$, where $H(z)$ is the system's transfer function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A sinusoidal input signal only excites the system at one single frequency, so from the output signal you can only determine the system's response at that single frequency. The signal $(-1)^n$ is such a (discrete-time) sinusoidal signal. So from the corresponding output, only the value $H(-1)$ can be determined, nothing else.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the input signal contains all frequencies, which is the case for a signal that is switched on at a certain time (i.e., multiplied by a step function), the system's transfer function can be determined from the output signal and the given input signal. This is the case for the input $x_1[n]$, where you can simply determine $H(z)$ from $X(z)$ and $Y(z)$. Since the step function contains all frequencies, all signals multiplied by it also contain all frequencies. If you excite a system with such a signal, you can determine the system's response at all frequencies. In general, a system's response can be determined only at those frequencies that are present in the input signal. If the input signal contains a single frequency (a sinusoid), you only get information about that single frequency. In order to determine the complete transfer function, you need an input signal containing all frequencies, such as an impulse or a step (or any signal multiplied by a step).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-08-07T08:20:58.780" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25104" PostTypeId="1" AcceptedAnswerId="25106" CreationDate="2015-08-06T21:24:30.153" Score="0" ViewCount="853" Body="&lt;p&gt;I have a curve like this one:&lt;a href=&quot;https://i.stack.imgur.com/mv2XL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mv2XL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I need a function to approximate this curve, but I need that the function be a low order function (less than 5). What is a good way to obtain what I expect? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="16620" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-08-06T22:51:02.130" Title="Best way to approximate a curve?" Tags="|interpolation|optimization|taylor-expansion|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25105" PostTypeId="1" CreationDate="2015-08-06T21:49:32.063" Score="0" ViewCount="137" Body="&lt;p&gt;I've tried searching for an answer to this, but i don't think i'm looking for the right thing. Lets say i wanted to examine a signal in the frequency domain that's between 2K-2.5KHz. Can i do this with a FFT smaller than 8192, for example 1024? I understand that if i took an FFT of 8192 that i could see the signals in bins 2000 through 2500. Is there a way to take a smaller FFT, or multiple smaller FFTs in order to achieve this. I don't really care what the signal looks like outside of this range. Thanks for any help!!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastActivityDate="2015-08-06T21:49:32.063" Title="How to look at 2KHz to 2.5KHz with a 1024 FFT" Tags="|fft|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25106" PostTypeId="2" ParentId="25104" CreationDate="2015-08-06T22:18:55.437" Score="3" Body="&lt;p&gt;So, you have a bunch of datapoints of the form (x,y), and considering all of those datapoints together, you have the vectors $x$ and $y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do a curve fit, you would like to solve the equation $Aw=y$ for the column vector $w$, which holds the coefficients of your curve fit polynomial.  These coefficients are also the weights of the basis vectors in the matrix $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix $A$, for an $n^{th}$ order approximation, will hold $n+1$ columns and have a number of rows equal to the length of $x$ and/or $y$ (the number of datapoints).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first column of $A$ is the vector $x$ raised element-wise to the power of 0. So, it's just a vector of 1's.  This is the basis associated with the offset or y-intercept.  The second column of $A$ is the vector $x$ raised element-wise to the power of 1. So, it's just the vector $x$.  The third column of $A$ is the vector $x$ raised element-wise to the power of 2.  You see the pattern?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve for the weight vector, $w=pinv(A)y$, the pseudoinverse of $A$ times $y$. Note, this doesn't actually solve the equation $Aw=y$, but performs an optimal projection of your data onto the vector space described by $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:  $pinv(A)=(A^TA)^{-1}A^T$&lt;/p&gt;&#xA;" OwnerUserId="16238" LastEditorUserId="16238" LastEditDate="2015-08-06T22:51:02.130" LastActivityDate="2015-08-06T22:51:02.130" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25107" PostTypeId="1" AcceptedAnswerId="25112" CreationDate="2015-08-06T22:37:41.517" Score="2" ViewCount="2957" Body="&lt;p&gt;I am a mathematician trying to understand some signal processing terms. My first question regards the terms 'even' and 'odd' filters. What does this mean? Does it reference the fact that upon a Fourier transform, there is a cosine and a sine function, which in turn are even and odd? If not, a link to a reliable source would be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question: What is a quadrature? I have heard the term used for the phase shift between two Fourier transforms, the method for dividing a frame into four parts, and taking a gradient-like subtraction from vertical, horizontal, and both diagonal directions. Is it all of these at once? &#xA;Also, a link to a reliable source would be great. &lt;/p&gt;&#xA;" OwnerUserId="16915" LastActivityDate="2015-08-08T11:23:22.430" Title="Even and Odd Filters and Quadrature" Tags="|image-processing|fourier-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25109" PostTypeId="2" ParentId="25107" CreationDate="2015-08-07T02:50:54.383" Score="0" Body="&lt;p&gt;For the 1st part of your question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some definitions of even and odd functions here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.mathsisfun.com/algebra/functions-odd-even.html&quot; rel=&quot;nofollow&quot;&gt;https://www.mathsisfun.com/algebra/functions-odd-even.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and how this applies to the sine and cosine functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://math2.org/math/algebra/functions/sincos/properties.htm&quot; rel=&quot;nofollow&quot;&gt;http://math2.org/math/algebra/functions/sincos/properties.htm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-08-07T02:50:54.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25110" PostTypeId="1" CreationDate="2015-08-07T04:49:31.580" Score="0" ViewCount="62" Body="&lt;p&gt;I have an electromyographic signal sampled at a frequency between 10 and 40 Hz in a time window of 300ms. Is wavelet packet decomposition adequate in order to perform features extraction for subsequent pattern recognition? &lt;/p&gt;&#xA;" OwnerUserId="15048" LastEditorUserId="15048" LastEditDate="2015-08-08T02:47:46.257" LastActivityDate="2015-08-08T02:47:46.257" Title="How accurate is Wavelet packet decomposition for emg signals with frequencies from 10 to 40 Hz?" Tags="|discrete-signals|wavelet|time-frequency|emg|pattern|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25111" PostTypeId="1" CreationDate="2015-08-07T06:47:13.757" Score="1" ViewCount="2688" Body="&lt;p&gt;Now I am trying to design FIR based adaptive filter for rejection of Jamming in GPS device. (just self-learning purpose, Jamming is simple tone)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've designed NOT-BAD performance adaptive filter for low sampling frequency. (~44100 Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I use this adaptive filter for high sampling frequency (16 MHz), transient width of filter is greatly increased.&#xA;(I think it is sure because transient width is proportional to 1/degree)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is self learning purpose, I just want to know how big sampling frequency of normal GPS signal for digital filtering is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is not so high as above, I'll quit this design and concentrate on other issues(quantization error etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If sampling frequency of normal GPS signal is high as above, I'll study more about that issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How high sampling frequency of normal GPS is ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="16875" LastActivityDate="2021-10-15T08:48:37.797" Title="sampling frequency of GPS" Tags="|sampling|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25112" PostTypeId="2" ParentId="25107" CreationDate="2015-08-07T06:56:43.510" Score="2" Body="&lt;p&gt;An even function is symmetric:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = f(-x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An odd function is anti-symmetric:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-f(x) = f(-x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal in quadrature with another has all its Fourier series components phase-shifted by 90 degrees. The two signals are thus orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the quadrature signal we apply the Hilbert transform (or Riesz transform in more than 1 dimension)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g(x) = \pm \mathcal{H}[f](x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A cosine wave is even and symmetric. A sine wave is odd and anti-symmetric. Therefore if you apply the Hilbert transform to an even signal (cosine Fourier series components) you get an odd signal (sine Fourier series components). If you apply the Hilbert transform again you get the negative original signal. Apply again you get the negative of the original Hilbert transformed signal. Apply again you get the original signal. This is where the &quot;quad&quot; part comes in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is useful in signal analysis. Since the Hilbert transform only phase-shifts the Fourier series components, the energy of the signal remains constant. We can thus reconstruct the original signal (e.g. wavelet denoising). Also, given an even filter that responds to peaks and troughs, we can create an odd filter that responds to edges. The pair of filters is called a quadrature filter pair and allows the analysis of signal features. See the analytic signal for more details.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2015-08-08T11:23:22.430" LastActivityDate="2015-08-08T11:23:22.430" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25115" PostTypeId="1" AcceptedAnswerId="25117" CreationDate="2015-08-07T11:09:23.733" Score="1" ViewCount="11511" Body="&lt;p&gt;I have some 64 channel EEG data sampled at 256Hz and I'm trying to conduct a time frequency analysis for each channel and plot a spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data is stored in a numpy 3d array, where one of the dimensions has length 256, each element containing a microvolt reading over all sampled time points (total length is 1 second for each channel of data)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear: my 3D array is 64*256*913 (electrode * voltages * trial). Trial is just a single trial of an experiment. So what I want to do is take a single electrode, from a single trial, and the entire 1D voltage vector and creating a time-frequency spectrogram. So I want to create a spectrogram plot from data[0,:,0] for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each electrode, I want a plot where the y axis is frequency, x axis is time, and colour/intensity is power&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using this in python: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from matplotlib.pyplot import specgram&#xA;#data = np.random.rand(256)&#xA;specgram(data, NFFT=256, Fs=256)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives me something that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F5Ukt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F5Ukt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right off the bat this looks incorrect to me because the axis ranges are incorrect&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, when I run the same code for all EEG channels, over all of my data, I end up with the exact same plot (even though I have verified that the data is different for each)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty new to signal processing, is there somewhere that I went wrong in either how my data is laid out or how I used my function?&lt;/p&gt;&#xA;" OwnerUserId="16842" LastEditorUserId="16842" LastEditDate="2015-08-07T11:58:18.683" LastActivityDate="2015-08-08T15:21:21.070" Title="Python - time frequency spectrogram" Tags="|fft|python|time-frequency|spectrogram|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25117" PostTypeId="2" ParentId="25115" CreationDate="2015-08-07T13:47:05.170" Score="0" Body="&lt;p&gt;The idea of a spectogram is to split your signal into a number of blocks or frames, which are potentially overlapping. After windowing, an FFT is calculated per frame. The output of these FFTs are collected as column vectors in your graph. Thus, the x-axis is related to time and the y-axis is related to frequency. Since the FFT of a real-valued signal is symmetric, only half the frequencies have to be plotted. Therefore, the y-axis goes from 0 to Fs/2=128. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you have chosen the FFT length (&lt;code&gt;NFFT=256&lt;/code&gt;) equal to the lenght of your signal, you have only one full frame of data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Potential solutions are to reduce your FFT length &lt;code&gt;NFFT&lt;/code&gt; or increase your data length. For now, the easiest way seems to be in reducing &lt;code&gt;NFFT&lt;/code&gt;. Note however, that you also need to adjust &lt;code&gt;noverlap&lt;/code&gt; in that case. A widely used amount of overlap is &lt;code&gt;NFFT/2&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&#xA;The following command will give you a spectogram.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;specgram(data, NFFT=64, Fs=256, noverlap=32)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternative implementation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Nfft=64&#xA;specgram(data, NFFT=Nfft, Fs=256, noverlap=Nfft/2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The FFT length parameter &lt;code&gt;NFFT&lt;/code&gt; leads to a tradeoff between time and frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; To answer additional questions in the comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the documentation in &#xA;[&lt;a href=&quot;http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.specgram]&quot; rel=&quot;nofollow&quot;&gt;http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.specgram]&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;h1&gt;Returns the tuple (spectrum, freqs, t, im):&lt;/h1&gt;&#xA;  &#xA;  &lt;h3&gt;spectrum: 2-D array&lt;/h3&gt;&#xA;  &#xA;  &lt;p&gt;columns are the periodograms of successive segments&lt;/p&gt;&#xA;  &#xA;  &lt;h3&gt;freqs: 1-D array&lt;/h3&gt;&#xA;  &#xA;  &lt;p&gt;The frequencies corresponding to the rows in spectrum&lt;/p&gt;&#xA;  &#xA;  &lt;h3&gt;t: 1-D array&lt;/h3&gt;&#xA;  &#xA;  &lt;p&gt;The times corresponding to midpoints of segments (i.e the columns in &gt;spectrum)&lt;/p&gt;&#xA;  &#xA;  &lt;h3&gt;im: instance of class AxesImage&lt;/h3&gt;&#xA;  &#xA;  &lt;p&gt;The image created by imshow containing the spectrogram&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thus, the first element in the returned tuple contains the power values.&lt;/p&gt;&#xA;" OwnerUserId="16570" LastEditorUserId="16570" LastEditDate="2015-08-08T15:21:21.070" LastActivityDate="2015-08-08T15:21:21.070" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25119" PostTypeId="1" AcceptedAnswerId="25253" CreationDate="2015-08-07T16:14:05.043" Score="2" ViewCount="20400" Body="&lt;p&gt;(Questions after code block.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, I am generating the sinusoid and the noise separately and then normalising the amplitude so I can write the signal to a .wav file (16-bit, 16kHz).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def genSine(f0,fs,dur):&#xA;    sinusoid = []&#xA;    for t in range(dur):&#xA;        sinusoid.append(math.sin(2*math.pi*t(*freq/fs)))&#xA;    sinusoid = normalise(sinusoid)&#xA;    return sinusoid&#xA;&#xA;def genNoise(dur):&#xA;    noise = np.random.normal(0,1,dur))&#xA;    noise = normalise(noise)&#xA;    return noise&#xA;&#xA;def normalise(x,MAX_INT16):&#xA;    maxamp = max(x)&#xA;    amp = floor(MAX_INT16/maxamp)&#xA;    norm = np.zeros(len(x))&#xA;    for i in range(len(x)):&#xA;        norm[i] = amp*x[i]&#xA;    return norm&#xA;&#xA;def writeWav(w):&#xA;    # audiophilic magic&#xA;&#xA;if __name__ == '__main__':&#xA;    f0 = 440&#xA;    fs = 16000&#xA;    dur = 1*fs                      #seconds&#xA;    MAX_INT16 = 32767&#xA;    sinusoid = genSine(f0,fs,dur)&#xA;    noise = genNoise(dur)&#xA;    sum = x + y&#xA;    sum = normalise(sum,MAX_INT16)&#xA;    writeWav(sum)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there a more efficient way to sum the two signals (sine + noise), perhaps bypassing/incorporating the normalisation step (it is currently called three times, in genSine, genNoise and main)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can I ensure set the amplitude ratio between the sine and noise signals?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm new to Python and stackexchange so any help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="16575" LastEditorUserId="16575" LastEditDate="2015-08-07T16:19:42.933" LastActivityDate="2015-08-14T07:37:39.190" Title="Generating a noisy sine wave in Python, efficiently" Tags="|noise|python|wave|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25121" PostTypeId="2" ParentId="25107" CreationDate="2015-08-08T01:01:07.247" Score="0" Body="&lt;p&gt;To answer your &quot;What is quadrature?&quot; question, perhaps the discussion at: &lt;a href=&quot;http://www.dsprelated.com/blogimages/RickLyons/Quad%20Signals%20Tutorial-Lyons.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/blogimages/RickLyons/Quad%20Signals%20Tutorial-Lyons.pdf&lt;/a&gt; would be of some use to you.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-08T01:01:07.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25124" PostTypeId="2" ParentId="6182" CreationDate="2015-08-08T12:03:23.793" Score="0" Body="&lt;p&gt;The human voice has some peculiarities that might help. For one, female voice starts at about 200Hz, male lower, so &lt;strong&gt;doing a high-pass filter&lt;/strong&gt; here would help a bit. See also &lt;a href=&quot;https://dsp.stackexchange.com/questions/6268/acoustic-features-distinguishing-the-male-and-female-voice&quot;&gt;acoustic-features-distinguishing-the-male-and-female-voice&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, identify the drone frequencies via a histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing all of this in code is a bit cumbersome. Have you considered some audio program like &lt;a href=&quot;http://audacityteam.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audacity&lt;/a&gt;? &lt;/p&gt;&#xA;" OwnerUserId="16927" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-08-08T12:11:40.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25125" PostTypeId="1" AcceptedAnswerId="25586" CreationDate="2015-08-08T12:16:48.683" Score="4" ViewCount="293" Body="&lt;p&gt;There is a recording which contains very noisy voice. (voice&#xA;  with a low Signal-to-Noise ratio).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a female voice of a stationary speaker (right in front of the microphone) and there are &lt;em&gt;many other recordings of the same&#xA;  speaker&lt;/em&gt; with much better quality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What can be done to denoise the audio?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the other recordings, it might be possible to extract statistical values that allow some model to filter the speaker's voice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Existing questions &lt;a href=&quot;https://dsp.stackexchange.com/questions/1828/how-to-distinguish-voice-from-snoring&quot;&gt;only address snoring&lt;/a&gt;, have &lt;a href=&quot;https://dsp.stackexchange.com/questions/9204/filtering-voice-signal-from-randomly-added-frequencies&quot;&gt;non-random noise&lt;/a&gt;, want to identify a &lt;a href=&quot;https://dsp.stackexchange.com/questions/6182/filter-message-from-noisy-voice-signal/25124#25124&quot;&gt;specific artifact&lt;/a&gt; or a &lt;a href=&quot;https://dsp.stackexchange.com/questions/10676/in-search-of-voice-activity-detection-algorithms-what-happens-to-the-frequency&quot;&gt;moving speaker&lt;/a&gt;. The question &lt;a href=&quot;https://dsp.stackexchange.com/questions/4801/how-is-it-possible-to-filter-out-a-persons-voice-out-of-100-of-other-voices&quot;&gt;is-it-possible-to-filter-out-a-persons-voice-out-of-100-of-other-voices&lt;/a&gt; is similar, but the answer there lacks details and is more about distinguishing, less about extraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the tapes are direct copies, some are copies of copies, which have also been recorded using a lower speed setting (4.75 cm/s). This affected the quality prior to digitalization.&lt;/p&gt;&#xA;" OwnerUserId="16927" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-09-26T12:14:19.197" Title="Extract voice from magnetic tape" Tags="|noise|voice|" AnswerCount="4" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="25128" PostTypeId="1" AcceptedAnswerId="25135" CreationDate="2015-08-08T18:07:00.773" Score="3" ViewCount="79" Body="&lt;p&gt;I am curious about MATLAB function.&#xA;Can you tell me why does not it do good approach to using of MATLAB function except for speed reason?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other reason to using polynomial utility?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="128" LastEditDate="2019-11-16T06:16:59.847" LastActivityDate="2019-11-16T06:16:59.847" Title="What is the Concept of MATLAB Function Polynomial Interpolation?" Tags="|matlab|interpolation|least-squares|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25130" PostTypeId="1" CreationDate="2015-08-09T03:52:18.043" Score="9" ViewCount="10693" Body="&lt;p&gt;I am studying pyramids (expanding and reducing) and I am a newbie.&#xA;Why should the sum of the convolution mask be one when we are using gaussian distribution? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://dsp.stackexchange.com/questions/8501/when-should-the-sum-of-all-elements-of-a-gaussian-kernel-be-zero&quot;&gt;When should the sum of all elements of a gaussian kernel be zero?&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/10938/why-is-sum-of-values-of-an-edge-detection-filter-zero&quot;&gt;Why is sum of values of an edge detection filter zero?&lt;/a&gt; it should be zero not one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused.  Any precise explanation is really appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="128" LastEditDate="2019-11-18T13:21:24.323" LastActivityDate="2019-11-18T15:05:34.987" Title="Why Should the Sum of Masks / Kernel / Filter in Image Processing be One?" Tags="|image-processing|filters|computer-vision|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25131" PostTypeId="1" AcceptedAnswerId="25141" CreationDate="2015-08-09T04:43:55.013" Score="4" ViewCount="1732" Body="&lt;p&gt;Lets say I want to double the number of points in an array f. I had the idea to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F=fft(f);N=length(f);&#xA;FF=[F(1:N/2) zeros(1,N) F(N/2+1:N)];&#xA;f=ifft(FF);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the result is not exactly correct. Why is this?&lt;/p&gt;&#xA;" OwnerUserId="16852" LastEditorUserId="128" LastEditDate="2019-11-16T06:15:32.413" LastActivityDate="2022-07-05T13:13:32.340" Title="Sinc Interpolation Using DFT (FFT)" Tags="|fft|dft|interpolation|resampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25132" PostTypeId="1" AcceptedAnswerId="25144" CreationDate="2015-08-09T05:11:29.323" Score="0" ViewCount="870" Body="&lt;p&gt;Does using a gray code mapping with M-FSK improve the BER performance vs no mapping?  I know it helps QAM, and it makes intuitive sense.  Doesn't seem as clear cut for M-FSK.&lt;/p&gt;&#xA;" OwnerUserId="16489" LastActivityDate="2015-08-09T11:58:51.360" Title="Gray code and M-FSK" Tags="|digital-communications|fsk|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25133" PostTypeId="1" CreationDate="2015-08-09T05:13:21.153" Score="0" ViewCount="106" Body="&lt;p&gt;The Connes Window function is defined as :&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;w(f)=&lt;span class=&quot;math-container&quot;&gt;$(1-(\frac{f}{ \Delta f})^2)^2$&lt;/span&gt;     for &lt;span class=&quot;math-container&quot;&gt;$f&amp;lt;|\Delta f| $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;w(f)=0         otherwise&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The inverse fourier transform of this function can be analytically calculated to be a purely real valued function.&lt;/p&gt;&#xA;&lt;p&gt;However performing IFFT using matlab gives me a complex function whith real and imaginary parts.&#xA;The code I used in the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;delta_f=10;&#xA;&#xA;fs=300; &#xA;&#xA;nCyl = 5;&#xA;&#xA;t=0:1/fs:nCyl*1/f;&#xA;&#xA;x=(1-(t/delta_f).^2).^2;&#xA;&#xA;plot(t,x);&#xA;&#xA;NFFT=1024;  &#xA; &#xA;X=fftshift(ifft(x,NFFT));       &#xA;&#xA;fVals=fs*(-NFFT/2:NFFT/2-1)/NFFT;   &#xA; &#xA;plot(fVals,real(X),'b'); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I think this discrepancy has something to do with the function being piecewise.&#xA;Is there something which I am missing?&lt;/p&gt;&#xA;" OwnerUserId="16931" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-08-09T05:32:48.297" Title="How to take IFFT of Connes Window?" Tags="|matlab|fft|discrete-signals|fourier-transform|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25134" PostTypeId="2" ParentId="25131" CreationDate="2015-08-09T06:09:03.957" Score="2" Body="&lt;p&gt;Doing DFT based interpolation has to keep 3 principles:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Keep the zeros outside the data (Looking form &lt;span class=&quot;math-container&quot;&gt;$ -\pi $&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$ \pi $&lt;/span&gt;). Namely add zeros to the higher frequencies.&lt;/li&gt;&#xA;&lt;li&gt;If it is real signal, keep the symmetry (If needed, divide the highest frequency into 2 items).&lt;/li&gt;&#xA;&lt;li&gt;Preserve the energy (By the division by 2 if needed).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;By the way, the interpolation isn't by a Sinc Kernel, it is done with its discrete form - &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirichlet_kernel&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Dirichlet Kernel&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;https://dsp.stackexchange.com/questions/72433&quot;&gt;The Proper Way to Do Sinc Downsampling (DFT Downsampling) for Uniformly Sampled Discrete Signals with Finite Number of Samples&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2021-01-14T10:03:13.010" LastActivityDate="2021-01-14T10:03:13.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25135" PostTypeId="2" ParentId="25128" CreationDate="2015-08-09T06:14:09.870" Score="1" Body="&lt;p&gt;It is basically an approach choice.&lt;br&gt;&#xA;Inside the math is identical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, when doing Least Squares curve fitting, you're not looking for the Polynomial coefficients but a scaled version of them.&lt;br&gt;&#xA;For instance, if you try to estimate Range, Velocity and Acceleration from Range Measurements using LS you need to scale the Polynomial Coefficients according to the dynamic model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, most of the times, you can do the LS estimation using $ {\left( {H}^{T} H \right)}^{-1} {H}^{T} $ which would be faster than &lt;code&gt;pinv&lt;/code&gt;.&lt;br&gt;&#xA;The only case it won't work is when $ \left( {H}^{T} H \right) $ isn't invertible (Rarely occurs in real world measurements).&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-08-09T06:14:09.870" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25136" PostTypeId="2" ParentId="25130" CreationDate="2015-08-09T06:16:57.387" Score="4" Body="&lt;p&gt;When you're trying to create a blurring kernel (namely a weighted mean of the data) you keep the mask sum as one.&lt;br&gt;&#xA;This preserves the mean of the filtered image (think about the DFT, if the sum mask is 1 its DC gain is 1 which means it keeps the sum of the image which means it keeps the mean value of the image.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're trying to apply a high pass filter you want to have gain of zero at the DC coefficient.&lt;br&gt;&#xA;This is done by having the sum of the mask as zero (same reason as above.)&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="10650" LastEditDate="2019-11-18T13:19:36.277" LastActivityDate="2019-11-18T13:19:36.277" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25138" PostTypeId="1" CreationDate="2015-08-09T07:48:31.083" Score="4" ViewCount="162" Body="&lt;p&gt;I know that there are some Technic for finding curve fitting like polyfit() or pinv(). so we can get a some polynomial equation. it's OK good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get successively a polynomial equation for each curve by using polyfit() or pinv()..it easy. no problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my problems is here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually I want to know a concept to make one equation which from all polynomial equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example, &#xA;if I get 3 equations(curve #1's equation ,curve #2's equation ,curve #3's equation) then I want to make all in one equation.\&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? what kinds of Technic is exist?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;UPDATE: &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;I've got 4 polynomials &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1) 3.1734x^3−5.8952x^2+3.8194x−0.0377&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;2) 2.1489x^3−3.9026x^2+2.8169x−0.0160&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;3) 1.0796x^3−1.9013x^2+1.8500x+0.0008&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;4) x &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;But I'm not sure how to apply your way about extracting the corresponding parameters.  Would you please help me a small bit more ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="128" LastEditDate="2020-10-14T06:24:04.587" LastActivityDate="2020-10-14T06:24:04.587" Title="Looking for the Concept About All In One Curve Fitting" Tags="|image-processing|matlab|estimation|least-squares|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25139" PostTypeId="2" ParentId="25130" CreationDate="2015-08-09T09:35:56.863" Score="4" Body="&lt;p&gt;Standard linear filtering on regularly-sampled data acts &quot;separately&quot; in each cartesian direction: along rows, columns (and time, depth or wavelength for 3D data, like video, tomography or multispectral images). If you look at a given 2D filter (applies to 3D too) in each direction &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, you can feel the nature of the filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the coefficients sum to one, then a constant input signal turns into a constant output signal of the same amplitude. Constant signal are low frequency, so by continuity, you expect a low-pass behavior. If the coefficients sum to zero, then a constant signal turns to zero, so you can imagine a low-cut behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a dual manner, if the sum of coefficients with alternating signs (&lt;span class=&quot;math-container&quot;&gt;$c_1,c_2,\ldots,c_n \to -c_1,c_2,\ldots,(-1)^n c_n$&lt;/span&gt;) is one, then you can expect a high-pass behavior. If they sum to zero, then a high-cut effect is plausible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can interpret this as integrating in one direction, differentiating in the other. You can also look at the sums not only in the horizontal and vertical directions, but along diagonal or other slopes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So keeping with linear filters, many useful filters in image processing either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sum to 1 in both directions (and often sum to a small value with alternating signs): they are mostly blurring kernels&lt;/li&gt;&#xA;&lt;li&gt;Sum to 1 in one direction, to 0 in the other: they are directional filters, detecting edges along the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;-sum direction&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Some filters, like the Laplacian mask, sum to zeros by combining both directions.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2019-11-18T15:05:34.987" LastActivityDate="2019-11-18T15:05:34.987" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25140" PostTypeId="1" AcceptedAnswerId="25142" CreationDate="2015-08-09T09:47:14.363" Score="4" ViewCount="198" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5yEDM.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5yEDM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;blue is how I tried to sinc interpolate. why would something like this happen?&lt;/p&gt;&#xA;" OwnerUserId="16852" LastEditorUserId="128" LastEditDate="2019-11-01T05:45:35.737" LastActivityDate="2021-09-01T08:16:08.027" Title="Unexpected Result When Using Sinc Interpolation" Tags="|sampling|interpolation|resampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25141" PostTypeId="2" ParentId="25131" CreationDate="2015-08-09T10:41:37.673" Score="6" Body="&lt;p&gt;If &lt;code&gt;N&lt;/code&gt; is odd it's a bit simpler:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FF=2*[F(1:(N+1)/2),zeros(1,N),F((N+3)/2:N)];&#xA;ff=real(ifft(FF));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is very close to what you had (apart from the scaling). Also note that due to numerical inaccuracies you have to take the real part of the IFFT operation. However, you should always check that the imaginary part (which you throw away) is very small (in the order of &lt;span class=&quot;math-container&quot;&gt;$10^{-16}$&lt;/span&gt; when using double).&lt;/p&gt;&#xA;&lt;p&gt;If &lt;code&gt;N&lt;/code&gt; is even, you need to split the value at Nyquist:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FF=2*[F(1:(N/2)),.5*F(N/2+1),zeros(1,N-1),.5*F(N/2+1),F((N/2+2):N)];&#xA;ff=real(ifft(FF));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="60971" LastEditDate="2022-07-05T13:13:32.340" LastActivityDate="2022-07-05T13:13:32.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25142" PostTypeId="2" ParentId="25140" CreationDate="2015-08-09T11:01:10.883" Score="3" Body="&lt;p&gt;Since Sinc based Interpolation requires you to know the data at any point. Hence it is not feasible.&lt;/p&gt;&#xA;&lt;p&gt;You might do a Truncated Sinc Interpolation.&lt;br /&gt;&#xA;The artifacts you're seeing can be caused by a kernel which is too short or the parameters aren't good.&lt;/p&gt;&#xA;&lt;p&gt;In order to create a good Sinc kernel you need to know things about the Band Width of the signal and the Sampling Rate.&lt;br /&gt;&#xA;Did you took those into account?&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="54457" LastEditDate="2021-09-01T08:16:08.027" LastActivityDate="2021-09-01T08:16:08.027" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="25143" PostTypeId="1" AcceptedAnswerId="25145" CreationDate="2015-08-09T11:54:05.417" Score="4" ViewCount="104" Body="&lt;p&gt;I've been wrestling with this question for way too long. I appreciate any insight you can offer. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the $9$-point sample sequence $x(n)$ represents a time domain signal sampled at $48\textrm{ kHz}$, what frequency does the eighth term $X[7]$ in its DFT correspond to?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="16934" LastEditorUserId="128" LastEditDate="2021-01-31T16:13:38.327" LastActivityDate="2021-01-31T16:13:38.327" Title="Frequency of a DFT Bin" Tags="|frequency|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25144" PostTypeId="2" ParentId="25132" CreationDate="2015-08-09T11:58:51.360" Score="0" Body="&lt;p&gt;No, Gray code mapping does not help M-FSK at all. In M-FSK, a transmitted&#xA;signal is equally likely to be mistaken for any of the other signals: the&#xA;signals are equi-distant in signal space, whereas with QAM (including as&#xA;a special case QPSK or 4PSK), some signals are closer than others and a transmitted signal is more likely to be confused with one of its nearest&#xA;neighbors than with one of its more distant neighbors. The Gray coding&#xA;ensures that nearest neighbors differ in only one bit and so the most&#xA;likely &lt;em&gt;symbol&lt;/em&gt; errors contribute only one bit&#xA;error to the BER calculation.&#xA;Gray coding also help with M-PSK signals where there are nearest&#xA;neighbors. But, with&#xA;equi-distant signals as in MFSK, no advantage results with Gray coding.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-08-09T11:58:51.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25145" PostTypeId="2" ParentId="25143" CreationDate="2015-08-09T12:24:41.930" Score="1" Body="&lt;p&gt;If you have a signal of 9 samples, namely $ {\left\{ {x}_{n} \right\}}_{n = 0}^{8} $ its DFT is given by $ {\left\{ {X}_{k} \right\}}_{k = 0}^{8} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if the sampling rate is $ {F}_{s} $ the bin frequency interval is given by $ \frac{{F}_{s}}{N} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you have 9 samples, 1 is the DC ($ k = 0 $) and the rest spans $ \left[ \frac{-{F}_{s}}{2}, \frac{{F}_{s}}{2} \right] $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look on the first 5 which are $ \left\{ 0, \frac{{F}_{s}}{9}, \frac{2 {F}_{s}}{9}, \frac{3 {F}_{s}}{9}, \frac{4 {F}_{s}}{9} \right\} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the 7 bin would have to be symmetric and hence would be $ \frac{-3 {F}_{s}}{9} $.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-08-09T12:24:41.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25146" PostTypeId="2" ParentId="25138" CreationDate="2015-08-09T12:34:02.407" Score="1" Body="&lt;p&gt;You can always augment the matrices to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume the first model is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {y}_{1} = {H}_{1} * {\theta}_{1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second model is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {y}_{2} = {H}_{2} * {\theta}_{2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third model is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {y}_{3} = {H}_{3} * {\theta}_{3} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume the number of parameters of the model are the same, namely $ {\theta}_{1}, {\theta}_{2}, {\theta}_{3} \in {\mathbb{R}}^{d} $ and $ {y}_{i} \in {\mathbb{R}}^{{n}_{i}} $ by the following augmentation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y = H \theta $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ y = {\left[ {{y}_{1}}^{T}, {{y}_{2}}^{T}, {{y}_{3}}^{T} \right]}^{T} $, $ H = {\left[ {{H}_{1}}^{T} \mid {{H}_{2}}^{T} \mid {{H}_{3}}^{T} \right]}^{T} $ and $ y = {\left[ {{\theta}_{1}}^{T}, {{\theta}_{2}}^{T}, {{\theta}_{3}}^{T} \right]}^{T} $ you can get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{\theta} = {\left( {H}^{T} H \right)}^{-1} {H}^{T} y $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extracting the the corresponding parameters is easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the parameters vectors are not the same dimension, you can use zeros to make everything work.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2015-08-09T12:40:31.243" LastActivityDate="2015-08-09T12:40:31.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25147" PostTypeId="1" CreationDate="2015-08-09T16:24:02.383" Score="0" ViewCount="142" Body="&lt;p&gt;I have cross across an OFDM modulator that says that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A frequency domain sequence is passed into a 64 point IFFT. A cyclis prefix is added (0.8 $\mu$sec) and creates as a result a 4 $\mu$sec time domain sequence (OFDM symbol). I am wondering The input of IFFT is discrete the output is also discrete of length 64. Then what do the authors mean by 3.2 $\mu$sec OFDM symbol? Is it a continuous time domain signal?&lt;/p&gt;&#xA;" OwnerUserId="15315" LastActivityDate="2015-09-08T22:43:33.473" Title="A General Question regarding OFDM symbol" Tags="|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25149" PostTypeId="2" ParentId="25147" CreationDate="2015-08-09T21:58:22.650" Score="1" Body="&lt;p&gt;Your question is a little confusing, but I'll give it a shot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 64 sample sequence output from the IFFT is a discreet sampled time domain sequence of complex values.  (A signal at complex base band)  The 3.2usec length comes from the sample rate (Fs) of the system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case it sounds like Fs is 20MHz.  That Fs comes from the fact that there are 64 sub-carriers (FFT = 64)  therefore the frequency spacing to maintain orthogonality between sub-carriers is 1/Tu = 1/3.2usec = 312.5KHz.  Tu is the &quot;used time&quot;, which in this case is that 3.2usec.  The total bandwidth is then 64*(sub carrier frequency spacing) = 64*312.5kHz = 20MHz.  Since the signal is complex Fs = BW.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Fs = BW = NFFT / Tu = 64 / 3.2usec = 20MHz&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my experience an OFDM symbol (or FFT symbol) refers to the data without the cyclic prefix added with its length equal to the FFT size.  I call the OFDM symbol plus the cyclic prefix and OFDM frame. Other people may have a different definitions.  It looks like this author uses the same definition as me not including the 0.8usec cyclic prefix in what they call an OFDM symbol.  That 0.8usec is also called the guard time and acts like a spacing in between successive OFDM symbols offering multipath protection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if that will help or not.&lt;/p&gt;&#xA;" OwnerUserId="16489" LastActivityDate="2015-08-09T21:58:22.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25150" PostTypeId="2" ParentId="22022" CreationDate="2015-08-10T00:30:40.320" Score="0" Body="&lt;p&gt;Standard inpainting procedures first compute a distance transform and then sort the pixel values according to distances (to the closest edge of the binary mask). This way, the center of the region is inpainted at last. Curvature term basically contributes to this sorting as a second means of priority setting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't like Eq. 7 in this paper. It is not clear to me how they weight the importance of curvature vs. color.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-08-10T00:30:40.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25151" PostTypeId="1" AcceptedAnswerId="25730" CreationDate="2015-08-10T01:56:27.767" Score="1" ViewCount="729" Body="&lt;p&gt;I'm trying to learn Fourier Transform &amp;amp; Signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can visualize how this expression $ A \sin(2 \pi f t)$ could turn into that curvy sinusoidal signal.&#xA;But i couldn't visualize how $F(\nu)e^{2 \pi i f t}$ would look like as a signal....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the natural exponent suddenly popped up? what does it do?&#xA;i understand that $F(\nu)$ gives information of the amplitude and the phase shift, but what sort of information i could get from $e$ ?&#xA;Does all signals always decaying/growing by time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw this a lot in Laplace Transform: $e^{-st}$ but don't understand how it would look like as a signal.&lt;/p&gt;&#xA;" OwnerUserId="16940" LastEditorUserId="4346" LastEditDate="2015-08-10T04:31:52.777" LastActivityDate="2016-03-21T09:40:55.780" Title="Equation visualization of complex sinusoid function" Tags="|transform|visualization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25153" PostTypeId="2" ParentId="24417" CreationDate="2015-08-10T05:27:44.453" Score="2" Body="&lt;p&gt;What I understand is that EM algorithm used in Kalman filter is for parameter estimation. When we use Kalman filter, we need to provide some parameters, such as the co-variance of system noise and measurement noise, as well as the error co-variance. However, it is time consuming to tune all of these parameters. Therefore, we use EM algorithm to estimate these parameters from the observation data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, EM algorithm has a drawback. It only gives suboptimal solution. In other words, the parameters estimated by EM algorithm are only local minimum/maximum, rather than global minimum/maximum. Therefore, further turning may be needed.&lt;/p&gt;&#xA;" OwnerUserId="16942" LastActivityDate="2015-08-10T05:27:44.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25154" PostTypeId="1" CreationDate="2015-08-10T05:30:48.513" Score="1" ViewCount="298" Body="&lt;p&gt;I have a question about the smoothing (backward) process of Kalman filter. Is it correct to say &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E[x_{t|T}] = x_{t|t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_{t|t}$ is the estimated result from forward process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am struggling to understand the smoothing process of Kalman filter. Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="16942" LastActivityDate="2016-05-16T16:27:28.450" Title="Smoothing process of Kalman filter" Tags="|kalman-filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25155" PostTypeId="1" AcceptedAnswerId="25159" CreationDate="2015-08-10T05:44:22.357" Score="2" ViewCount="1208" Body="&lt;p&gt;I have an EEG signal thats about 1second long, sampling frequency of 256Hz, measured in microvolts, and I want to calculate the power of a specific frequency band (8-12Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the correct way to do this is to do an FFT which will give you frequency domain information, from which you can directly extract power. Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for a way to do this without FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have applied a butterworth filter to my signal, bandpass at 8-12Hz. This, I think, will result in a filtered signal that shows only the contribution from sinusoids within those frequency ranges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to extract power directly from this bandpassed signal without having to run an FFT? Would it simply be the average (squared?) voltage across the entire signal? Or would it be more complex than that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm doing this in Python, so if there's any specific code I can take a look at then that'd be useful&lt;/p&gt;&#xA;" OwnerUserId="16842" LastActivityDate="2015-08-10T07:51:22.840" Title="Signal power without FFT" Tags="|filters|power-spectral-density|bandpass|eeg|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25156" PostTypeId="2" ParentId="24417" CreationDate="2015-08-10T07:29:23.697" Score="3" Body="&lt;p&gt;EM-algorithm jointly estimates the state space model parameters as well as state estimates. The E-step is a Kalman filter, which uses the current estimates to predict the new states. The M-step uses this result in an MLE procedure to obtain the parameter estimates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest that you read the &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.314.2260&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;following paper&lt;/a&gt;, which explains a generative model, from which all of the tools such as HMM, Kalman Filter, VQ and etc. are derived:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Read Roweis, Ghahramani, &quot;A Unifying Review of Linear&#xA;  Gaussian Models&quot;, Neural Computation, Vol. 11, No. 2, 1999.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-08-10T07:29:23.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25159" PostTypeId="2" ParentId="25155" CreationDate="2015-08-10T07:49:10.180" Score="1" Body="&lt;p&gt;After performing the band-pass filter, the energy in that frequency band is given by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sum( abs( signal ) ^ 2 )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By &lt;code&gt;abs&lt;/code&gt; I mean the magnitude of a complex number, or the absolute (positive) value of a real number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works because of &lt;a href=&quot;https://en.wikipedia.org/wiki/Plancherel_theorem&quot; rel=&quot;nofollow&quot;&gt;Plancherel's theorem&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="16944" LastActivityDate="2015-08-10T07:49:10.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25160" PostTypeId="2" ParentId="25155" CreationDate="2015-08-10T07:51:22.840" Score="1" Body="&lt;p&gt;Yes, it is simply the sum of the squered signal samples.&#xA;This is a result of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's theorem&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16946" LastActivityDate="2015-08-10T07:51:22.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25163" PostTypeId="1" CreationDate="2015-08-10T08:38:55.427" Score="1" ViewCount="440" Body="&lt;p&gt;I'm in the process of building features for an EEG machine learning problem and have been doing some reading about what features may be useful. Turns out, that alpha band (8-12Hz) power can make a good distinction between my categories. The nuance is that for 1 category, alpha power rises and then falls over the time series, but for the other category alpha power begins low and then rises&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a butterworth filtered signal which gives me a fairly clean alpha wave, but is it possible to determine power of this band at every time point over the series?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I can get away with doing the calculations on just the filtered signal then that'd be ideal, without having to resort to running an FFT (the eventual goal is to do this online and my concern is speed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could it simply be the squared amplitude at every time point? Or do I need to run a specific FFT/time-frequency type analysis for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to find some Python code for this but haven't had much luck because I mostly am not sure the best way forward&lt;/p&gt;&#xA;" OwnerUserId="16842" LastActivityDate="2015-08-11T15:25:11.470" Title="EEG Power at specific time points" Tags="|filters|power-spectral-density|time-frequency|eeg|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25164" PostTypeId="2" ParentId="25151" CreationDate="2015-08-10T08:44:29.277" Score="0" Body="&lt;p&gt;You can use &lt;code&gt;fft&lt;/code&gt; function and plot it, I didn't know if you're already try that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NFFT = 2^nextpow2(L); % Next power of 2 from length of y&#xA;Y = fft(y,NFFT)/L;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;% Plot single-sided amplitude spectrum.&#xA;plot(f,2*abs(Y(1:NFFT/2+1))) &#xA;title('Single-Sided Amplitude Spectrum of y(t)')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|Y(f)|')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/fft.html&quot; rel=&quot;nofollow&quot;&gt;More information: Matlab Help&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16905" LastEditorUserId="80" LastEditDate="2015-10-09T12:16:18.757" LastActivityDate="2015-10-09T12:16:18.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25165" PostTypeId="1" CreationDate="2015-08-10T08:52:46.223" Score="0" ViewCount="6464" Body="&lt;p&gt;I have pairs of EEG signals filtered to give me just alpha bands. For a machine learning problem I have found that calculating the phase locking value between the alpha signals of these 2 channels would be a useful classification feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using this paper as a reference: &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/22661936&quot; rel=&quot;nofollow&quot;&gt;http://www.ncbi.nlm.nih.gov/pubmed/22661936&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering what the correct method/implementation is to calculate PLV/synchrony in Python?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have not been able to find any modules/code that would help me with this problem. That paper, for example, calculates synchrony between independent components after ICA, but I'm not employing that method here so not sure if their formula translates or if any adjustments are necessary for filtered signals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest thing I have found is this: &lt;a href=&quot;https://www.nbtwiki.net/doku.php?id=tutorial:phase_locking_value#.VchjR6ZVhBc&quot; rel=&quot;nofollow&quot;&gt;https://www.nbtwiki.net/doku.php?id=tutorial:phase_locking_value#.VchjR6ZVhBc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, while the code is laid out nearer the bottom of the page, it appears to be MATLAB code. It looks like there are some MATLAB methods being employed and I'm not sure how that would translate over to Python/numpy/scipy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not particularly familiar with this domain and don't trust myself to port the code over without making logic errors, so it would be useful if someone could point me toward a Python implementation of this.&lt;/p&gt;&#xA;" OwnerUserId="16842" LastEditorUserId="13320" LastEditDate="2016-05-13T10:36:34.800" LastActivityDate="2017-06-27T16:52:07.490" Title="Phase locking value / phase synchronization" Tags="|filters|phase|eeg|coherence|synchronization|" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25168" PostTypeId="1" CreationDate="2015-08-10T11:05:06.357" Score="1" ViewCount="1255" Body="&lt;p&gt;How to use ImageNet Database in Matlab for object classification or recognition? I didn't find any tutorial which could practically tell me how to train images on ImageNet database and classify the objects.&lt;/p&gt;&#xA;" OwnerUserId="16949" LastEditorUserId="7338" LastEditDate="2015-08-11T11:47:20.100" LastActivityDate="2015-08-11T11:47:20.100" Title="How to use ImageNet Database in Matlab" Tags="|matlab|computer-vision|classification|object-recognition|machine-learning|" AnswerCount="1" CommentCount="2" ClosedDate="2015-08-12T12:12:55.743" ContentLicense="CC BY-SA 3.0" />
  <row Id="25169" PostTypeId="2" ParentId="25168" CreationDate="2015-08-10T11:44:23.207" Score="0" Body="&lt;p&gt;Use &lt;a href=&quot;http://www.vlfeat.org/matconvnet/&quot; rel=&quot;nofollow&quot;&gt;MatConvNet&lt;/a&gt;. They have samples for image-net classification, such as &lt;a href=&quot;http://www.vlfeat.org/matconvnet/pretrained/&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;. Pre-trained models already exist. You could also train on your own.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check &lt;code&gt;cnn_imagenet&lt;/code&gt; function in MatConvNet. You will find it useful.&lt;/li&gt;&#xA;&lt;li&gt;There are tutorials. For example &lt;a href=&quot;http://clojurehackers.com/p/quantombone/matconvnet&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-08-11T11:46:19.843" LastActivityDate="2015-08-11T11:46:19.843" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25170" PostTypeId="1" AcceptedAnswerId="25176" CreationDate="2015-08-10T13:30:09.163" Score="1" ViewCount="1905" Body="&lt;p&gt;I have 2 signals S1 and S2 that contain the same information, but S2 is shifted and scaled compared to S1 by an unknown amount (but small; eg shift would be of the order of 1-10 samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best (=most effective yet simple) way to calculate (or estimate) the shift and scaling factor to apply to S2 in order to 'match' with S1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read a few papers referring to using the phase information in FFT, but those were working on signals where scaling was not really an issue (and i must admit not to have understood them completely anyway). I am a bit lost on how to put this in practice when developing that in Matlab (actually I use Octave).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would love to have an explanation using Matlab/Octave code if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steve&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I add the tag 'image processing' because I suspect that such techniques would be used in automatic stitching of images (in panoramas for example)&lt;/p&gt;&#xA;" OwnerUserId="7335" LastEditorUserId="128" LastEditDate="2020-01-16T18:27:14.700" LastActivityDate="2020-01-16T18:27:14.700" Title="How to Match 2 Signals which Are a Shifted and Scaled Version of Each Other" Tags="|image-processing|fft|discrete-signals|fourier-transform|cross-correlation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25171" PostTypeId="2" ParentId="25140" CreationDate="2015-08-10T13:56:56.743" Score="0" Body="&lt;pre&gt;&lt;code&gt;t=linspace(-.5,.5,256);&#xA;x=exp(-pi*t.^2*16).*(sin(2*pi*40*t)+0.154*cos(2*pi*47*t)-1.454*cos(2*pi*27*t));&#xA;figure;plot(t,x)&#xA;&#xA;tt=linspace(-.5,.5,256*8-7);&#xA;xorj=exp(-pi*tt.^2*16).*(sin(2*pi*40*tt)+0.154*cos(2*pi*47*tt)-1.454*cos(2*pi*27*tt));&#xA;figure;plot(tt,xorj)&#xA;&#xA;xf=SincInt(x,8,1);&#xA;sh=0;&#xA;xf=[ xf(1+sh:end) zeros(1,sh)];&#xA;figure;plot(tt,xf)&#xA;hold on;plot(tt,xorj)&#xA;figure;plot(tf,xf-xorj)&#xA;&#xA;function f = SincInt( f,k ,varargin)&#xA;% function f = SincInt( f,k ,varargin)&#xA;% varargin=1 to keep the beginning and the end the same&#xA;&#xA;nargin=length(varargin);&#xA;&#xA;N=length(f);&#xA;f=[zeros(1,N*(k-1)) f];&#xA;for  i = 1: N&#xA;    f(k*i-k+1:k*i)= [zeros(1,k-1) f(N*(k-1)+i)];&#xA;end&#xA;&#xA;f=conv(f,sinc(-60:1/k:60),'same');&#xA;&#xA;if(nargin==1 &amp;amp;&amp;amp; varargin{1})&#xA;    f=[f(k:length(f)) ];&#xA;end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16852" LastActivityDate="2015-08-10T13:56:56.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25172" PostTypeId="1" CreationDate="2015-08-10T14:10:07.717" Score="0" ViewCount="94" Body="&lt;p&gt;I have data from a vibration experiment on a structure. This data was obtained by attaching an accelerometer to a FFT analyser, which records the data at a high sampling rate (typically in kHz range) and can also perform real-time FFT of the recorded data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/37YER.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/37YER.jpg&quot; alt=&quot;sample signal and its FFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image above shows the recorded signal below and the FFT above. The FFT shows all the dominant frequencies in the original signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What more patterns/ important data points can I discern from this data, that might have utility ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, one being, the RMS value of the signal. What else ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the recorded data &lt;a href=&quot;https://drive.google.com/file/d/0B9fbkDTtTJfSblh3b0c2OXBYYzA/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; as a mat file, which can be loaded in matlab, the data in a variable called Track1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physics of the problem: The data is collected from a shake table, a rigid platform, that oscillates back and forth, so the sharp edges in the original signal periodically, representing the point of return. &lt;/p&gt;&#xA;" OwnerUserId="16494" LastActivityDate="2015-11-08T23:14:09.683" Title="How to analyse periodic data obtained from a vibration experiment?" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25175" PostTypeId="2" ParentId="25170" CreationDate="2015-08-10T16:22:11.547" Score="1" Body="&lt;p&gt;Matlab has a function called xcorr() that computes the cross correlation between two vectors.  The cross correlation will be highest when the two signals overlap.  The following code will compute the shift in units of samples:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;x = xcorr(s1,s2)&lt;/p&gt;&#xA;&lt;p&gt;[val,idx] = max(x);&lt;/p&gt;&#xA;&lt;p&gt;shift = length(s1) - idx&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The scaling factor should be given by:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;scale = max(s1)/max(s2)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="16238" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-08-10T16:22:11.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25176" PostTypeId="2" ParentId="25170" CreationDate="2015-08-10T16:48:46.490" Score="1" Body="&lt;p&gt;In case you specifically want to find a shift and scale you can use the cross correlation function of Matlab. Some additional options for the Matlab xcorr function are the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = xcorr(s1, s2, M, 'unbiased'); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here &lt;code&gt;M&lt;/code&gt; is the maximum number of lags for calculating the cross correlation function. &#xA;The input argument &lt;code&gt;unbiased&lt;/code&gt; takes care of finite lenght effects of the signals. The biased estimator calculates &#xA;$$r[k] = \frac{1}{N}\sum_{n=1}^N s_1[n]s_2[n-k]$$ &#xA;and the unbiased estimator calculates &#xA;$$r[k] = \frac{1}{N-k}\sum_{n=1}^N s_1[n]s_2[n-k]$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another technique that you can in case the relation between $s_1$ and $s_2$ is more complex than an integer delay and a gain is to calculate a Wiener filter &lt;a href=&quot;https://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;. If the relation changes over time, then an adaptive filter can be useful, e.g., using the lms algorithm.&lt;/p&gt;&#xA;" OwnerUserId="16570" LastActivityDate="2015-08-10T16:48:46.490" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25177" PostTypeId="1" CreationDate="2015-08-10T17:59:39.823" Score="0" ViewCount="89" Body="&lt;p&gt;I have some 4 polynomials  like this. these equation is made by &lt;code&gt;polyfit()&lt;/code&gt; from   MATLAB tool.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;eq1) 3.1734x^3 -5.8952x^2 +3.8194x -0.0377&#xA;eq2) 2.1489x^3 -3.9026x^2 +2.8169x -0.0160&#xA;eq3) 1.0796x^3 -1.9013x^2 +1.8500x +0.0008&#xA;eq4) x&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then I want to make these 4 polynomials to one polynomial But I don't know how to apply this concept to my 4 polynomials .&lt;/p&gt;&#xA;&lt;h1&gt;Update :&lt;/h1&gt;&#xA;&lt;p&gt;Here is referencing.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f(x) = 3x^3 - 4x^4 + 3x -7$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f(x) = 3x^3 - 3x^2 + 2x -1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kBn0S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kBn0S.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Actually, I want to apply above concepts to in my case.&lt;/p&gt;&#xA;&lt;p&gt;How can I get a &lt;span class=&quot;math-container&quot;&gt;$\left(H^TH\right)^{-1}H^Ty$&lt;/span&gt; from above equations?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="7092" LastEditDate="2022-01-28T00:39:05.933" LastActivityDate="2022-01-28T00:39:05.933" Title="How to reduce polynomial?" Tags="|interpolation|linear-algebra|" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25178" PostTypeId="2" ParentId="25172" CreationDate="2015-08-10T18:37:39.763" Score="-1" Body="&lt;p&gt;Remember that you are observing a system (the structure) driven by an input (shake table).  Assuming linearity, the FFT result was caused by the shake table &lt;em&gt;and&lt;/em&gt; the structure.  You should be able to pick out the various components to identify mechanical resonances in the structure.  For instance, you should see a strong component at the frequency of the shake table.  Exactly how to do this in more detail is out of my domain, as I am an electrical, not mechanical, engineer.&lt;/p&gt;&#xA;" OwnerUserId="16951" LastActivityDate="2015-08-10T18:37:39.763" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25179" PostTypeId="1" CreationDate="2015-08-10T19:13:31.393" Score="0" ViewCount="240" Body="&lt;p&gt;Thanks in advance for any help with my newbie question. I've been consulting quite a large number of resources in order to understand how I can create and playback a nice sawtooth without aliasing, but I feel something is really not clicking, since explanations I've been reading have only been confusing me further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's my understanding that aliasing should not occur if my signal does not contain any sinusoidal components above the Nyquist frequency. So, to be safe, I create a sawtooth using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            fs = 48000;&#xA;            a = linspace(0,(fs/20),fs);&#xA;            SinAudio = sin(2*pi*a+0.5*pi);&#xA;&#xA;            for i = 1:(length(amaxi)-1)&#xA;                SawElement{i} = linspace(-1, 1, (amaxi(i+1)-amaxi(i)));&#xA;            end&#xA;&#xA;            % Make first sawtooth element&#xA;            Saw = linspace(0,1,amaxi(1));&#xA;&#xA;            % Concatenate rest of elements&#xA;            for i = 1:length(SawElement)&#xA;                Saw = [Saw, 0, SawElement{i}];&#xA;            end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case, what I perceived as aliasing is apparent as a lot of clearly audible low frequencies, that sort of sound bubbly, especially when I sweep the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the base frequency is way below my sampling frequency, and the way I concatenate the elements of the sawtooth, I take two samples to go from 1 to -1. Intuitively, I feel like this is where it goes wrong, because if you were to create a signal like that from individual sinusoids, you would need A LOT of harmonics, which would be why I get aliasing..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HOWEVER, there should be no more harmonics there than when I create a sine wave like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 48000;&#xA;a = linspace(0,(fs/4),fs);&#xA;x = sin(2*pi*a+0.5*pi);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is a sinewave with a frequency of half the nyquist frequency, and therefor I wouldn't expect aliasing... I think?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my questions are:&#xA;1) Why does a generated signal with maximum frequency at half the nyquist rate still alias? &#xA;2) How do I create a bandlimited sawtooth or squarewave? I tried using wavetable synthesis, and although I haven't tested the resulting signal yet, I don't see how bandlimited wavetable synthesis would give me any different results from the two pieces of code I described above; ultimately, there's going to be a point where my signal goes from 1 to -1 over the course of 2 or 3 samples, no matter how I generate my signal..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, I've really been breaking my head over this....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Paul&lt;/p&gt;&#xA;" OwnerUserId="16953" LastEditorUserId="16953" LastEditDate="2015-08-11T07:32:55.657" LastActivityDate="2015-08-11T07:32:55.657" Title="I still get aliasing of my signal, even though I stay below the Nyquist frequency. What am I missing?" Tags="|bandwidth|nyquist|aliasing|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25182" PostTypeId="2" ParentId="25093" CreationDate="2015-08-11T00:07:42.613" Score="2" Body="&lt;p&gt;Rather than write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_t = Ax_{t-1} + f(u_{t-1},\mathbf{w})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as the state update equation, I'd write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\xi = \left[ \begin{array}{c}&#xA;x_t\\&#xA;u_t &#xA;\end{array}&#xA;\right] &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then&#xA;$$&#xA;\xi_t = g(\xi_{t-1},A,\mathbf{w})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that&#xA;$$&#xA;y_t = \left[ 1\ \ \ 0 \right] \xi_t + v_t&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could apply the &lt;a href=&quot;https://en.wikipedia.org/wiki/Extended_Kalman_filter#Non-additive_noise_formulation_and_equations&quot; rel=&quot;nofollow&quot;&gt;non-additive noise formulation of the EKF&lt;/a&gt; to get your filter equations.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-11T00:07:42.613" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25183" PostTypeId="1" CreationDate="2015-08-11T05:00:33.057" Score="3" ViewCount="504" Body="&lt;p&gt;I am studying SIFT. I am a little confused in some of Lowe's algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to have a descriptor invariant to translations like scaling, we must get rid of the scaling factor in LoG (Laplacian of Gaussian). I know that the LoG is represented like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yeGN9.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yeGN9.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the scale invariant LoG would look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xuDgN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xuDgN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how the DoG can be like this?:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3J8Uy.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3J8Uy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, how by approximation,using DoG, we get rid of that scale factor in SIFT. I know how DoG is computed, but the thing is I cannot understand how we get rid of that factor to have a invariant-to-scale LoG approximation.&#xA;Any precise explanation is really appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: some more questions, Please answer precisely. Thanks :-)&#xA;1- At the final step of SIFT, we calculate feature vector using Gradient Orientation. to do do, the keypoint's rotation is subtracted from each orientation. I cannot understand why we subtract them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- What about Illumination dependence? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone can explain how we remove Illumination and Orientation dependency?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="15003" LastEditDate="2015-08-11T06:11:51.133" LastActivityDate="2021-07-06T00:53:33.930" Title="SIFT: why it is invariant to affine tranlsation?" Tags="|image-processing|image-segmentation|math|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25184" PostTypeId="1" AcceptedAnswerId="25215" CreationDate="2015-08-11T06:41:35.513" Score="0" ViewCount="141" Body="&lt;p&gt;I want to implement a simple signal for phase noise. According to my supervisor, i shoud be adding phase noise in the frquency. This is my signal. &lt;code&gt;A = cos(2*pi*fc*t)&lt;/code&gt; and signal with phase noise &lt;code&gt;B = cos(2*pi*(fc+deltaf)*t)&lt;/code&gt;. here how shoud i define delta f?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that when i analyse both signals using fft, spectrum of B signal should be broader than spectrum of A signal.&lt;/p&gt;&#xA;" OwnerUserId="16555" LastActivityDate="2015-08-12T13:50:11.210" Title="adding phase noise in signal thorugh freuquency" Tags="|signal-analysis|digital-communications|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25185" PostTypeId="2" ParentId="25183" CreationDate="2015-08-11T08:47:48.027" Score="1" Body="&lt;p&gt;I consider that you already know the proof of how we get DoG from LoG, so I won't go further with it.&lt;/p&gt;&#xA;&lt;p&gt;According to your question &amp;quot;how by approximation,using DoG, we get rid of that scale factor in SIFT&amp;quot;. DoG works as a feature detector to detect blobs in the given image (blob like shapes) which you can say it is a bit kind of edge detectors here is a photo of some blobs detected using DoG:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lRKbm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lRKbm.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;These blobs detected at different scales using the scale space pyramid. Using larger values of sigma you get bigger blobs. Experimentally DoG give you the best notion of scale as you can see here :&#xA;&lt;a href=&quot;https://i.stack.imgur.com/niJ9d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/niJ9d.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, experimentally DoG gives you the most robust features that are scale invariant by constructing the scale space and computing the DoG and finally extracting local maxima points.&lt;/p&gt;&#xA;&lt;p&gt;Useful links:&lt;/p&gt;&#xA;&lt;p&gt;1- &lt;a href=&quot;http://www.inf.fu-berlin.de/lehre/SS09/CV/uebungen/uebung09/SIFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture PPT&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;2- &lt;a href=&quot;https://www.youtube.com/watch?v=NPcMS49V5hg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Best known video lecture for SIFT&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13362" LastEditorUserId="13362" LastEditDate="2021-07-06T00:53:33.930" LastActivityDate="2021-07-06T00:53:33.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25186" PostTypeId="1" AcceptedAnswerId="26347" CreationDate="2015-08-11T10:06:48.287" Score="2" ViewCount="2700" Body="&lt;p&gt;I have designed a surface with a shape like a rounded rectangle and I want to detect its exact boundaries in a photo I take from it. A sample photo is like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/b7oKw.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b7oKw.jpg&quot; alt=&quot;Sample image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried thresholding the image but even after a Gaussian smoothing, the threshold won't give me an exact boundary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a technique that would give me the precise boundaries, regardless of the issues in lighting, etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&#xA;I'm sorry I didn't state the problem well, and actually I wasn't aware of the real problem (though I think it hasn't changed too much):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the new photo. The photo is taken looking down inside a plastic bucket with a small amount of water inside, and I need to segment the region inside the water from the walls of the bucket, so I can detect the objects inside the water later. There is some lighting illuminating the bottom of the bucket from underneath (actually a sheet of plexiglass is placed instead of the original bottom).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CabQx.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CabQx.jpg&quot; alt=&quot;new image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the reflections of light on the wall make it the same color as where the water is, in some areas like the bottom-center in the sample image which makes it hard to find the water level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I would appreciate any hints on how should I differentiate between the boundary related to the plexiglass, and the boundary related to the water level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16572" LastEditorUserId="16572" LastEditDate="2015-09-10T18:38:07.783" LastActivityDate="2015-10-11T02:17:15.200" Title="Detecting water level in an image" Tags="|image-processing|opencv|edge-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25187" PostTypeId="2" ParentId="25163" CreationDate="2015-08-11T10:52:40.467" Score="2" Body="&lt;p&gt;The Goertzel algorithm allows you to compute individual terms of the Discrete Fourier Transform, and is more efficient than the FFT. However, if you wish to later compute the spectrum of other bands besides alpha, Goertzel will turn out to be more computationally expensive than the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you are seriously limited by computational power, in principle, you can compute the Fast Fourier Transform in quasi-real-time, using a sliding window (also known as the Short Time Fourier Transform, or STFT). The Discrete Wavelet Transform is also sometimes used for real-time EEG power estimation. To find the power in the alpha band, you can look at the corresponding frequency bins of the STFT for either the original or the filtered signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the STFT will be delayed by the length of your window (as you need all the samples inside the window to arrive before computing the power in that time bin). However, with a window length of 512 samples under 8kHz sampling rate, for example, this amounts to 0.064 seconds delay, which is fairly close to 0.0 seconds!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The STFT (Short-Time Fourier Transform) is effectively a computation of the FFT one 'chunk' or 'time-frame' of the signal at a time. Often these chunks are overlapped by some amount, such as 50%, meaning that if the window length is 512 samples, then halfway through the first frame (at the 256th sample), you already begin to process samples that contribute to the second time-frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of using overlapping frames is to avoid artefacts caused by taking square slices of the signal. (Computing the power of one sample at a time, like you suggest, amounts to convolving your signal with a square window, which is equivalent to convolving the frequency representation of your signal with a sinc function. This causes spectral leakage, or 'ringing' artfeacts. Thus, it is common to use a sliding window with smooth edges, such as a Hamming window, to reduce these artefacts.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the choice of window length will affect your spectro-temporal resolution. A longer window will have better frequency resolution, but worse temporal resolution, and vice-versa. This phenomenon is known as the Gabor limit, or Heisenberg-Gabor limit.&lt;/p&gt;&#xA;" OwnerUserId="16575" LastEditorUserId="16575" LastEditDate="2015-08-11T11:01:45.537" LastActivityDate="2015-08-11T11:01:45.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25188" PostTypeId="2" ParentId="25186" CreationDate="2015-08-11T12:10:34.670" Score="0" Body="&lt;p&gt;Use level sets, or active contours. They are good at handling such problems and typically robust to noise. They're also sub-pixel accurate in certain respect. The best part is that many open source projects exist:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/19567-active-contour-segmentation&quot; rel=&quot;nofollow&quot;&gt;Active Contour Segmentation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.shawnlankton.com/2009/04/sfm-and-active-contours/&quot; rel=&quot;nofollow&quot;&gt;Sparse Field Active Contours&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://liris.cnrs.fr/julien.mille/code.html&quot; rel=&quot;nofollow&quot;&gt;Combination of Piecewise-Geodesic Paths&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-08-11T12:10:34.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25189" PostTypeId="1" CreationDate="2015-08-11T12:48:50.530" Score="1" ViewCount="4596" Body="&lt;p&gt;I have a certain signal that has a linear trend that should be removed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qegFR.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qegFR.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that the signal needs to be processed in real time(sampling rate is 20Hz). &#xA;If I only apply the detrending per window of say, 20 samples and then concatenate detrending results, the signal is disrupted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if there is some efficient technique to detrend the data per window in real time and then concatenate it so the final signal will make sense? Or should I just detrend every new incoming data with the older data which is far from being efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to note that taking the entire signal and processing it offline using MATLAB's &lt;code&gt;detrend&lt;/code&gt; works correctly. The problem occurs when breaking the signal into certain fixed size windows and then applying &lt;code&gt;detrend&lt;/code&gt; on each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks, &#xA;Mike&lt;/p&gt;&#xA;" OwnerUserId="16959" LastEditorUserId="8202" LastEditDate="2015-09-03T12:55:28.507" LastActivityDate="2015-09-03T12:55:28.507" Title="detrending in real time" Tags="|matlab|filters|discrete-signals|signal-analysis|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25191" PostTypeId="2" ParentId="25189" CreationDate="2015-08-11T13:00:50.303" Score="1" Body="&lt;p&gt;What is the nature of the trend?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the trend is due to DC drift (perhaps due to the signal acquisition apparatus), you may be able to remove it with a simple high-pass filter around 0.1 - 0.5 Hz. This would eliminate the need for any real-time post-processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DC drift gives a slowly rising/falling DC component, such as in the first figure &lt;a href=&quot;http://uk.mathworks.com/help/signal/ug/remove-trend-from-data.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QkZzd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QkZzd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16575" LastEditorUserId="8202" LastEditDate="2015-09-03T12:25:12.783" LastActivityDate="2015-09-03T12:25:12.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25194" PostTypeId="1" CreationDate="2015-08-11T14:21:43.000" Score="1" ViewCount="149" Body="&lt;p&gt;I have 2 groups of images, and I want to compare these groups based on the spatial frequencies of the images.&#xA;In the end, I'd like to be able to say &quot;group A is/is not significantly different from group B based on spatial frequency&quot; or something to that effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone think of a way to do this? &lt;a href=&quot;https://dsp.stackexchange.com/questions/23695/comparison-between-2-images-in-frequency-domain&quot;&gt;This question&lt;/a&gt; seems to touch on the topic, but as far as I can see it doesn't provide the solution I'm looking for (particularly not for groups of images).&#xA;MATLAB solutions would be the most valuable to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="16948" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-08-11T14:21:43.000" Title="Comparing the spatial frequency between groups of images" Tags="|image-processing|matlab|frequency-domain|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25196" PostTypeId="2" ParentId="25163" CreationDate="2015-08-11T15:25:11.470" Score="1" Body="&lt;p&gt;is your butterworth filtered signal in the alpha band already?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if so power is just the square of the signal at each timepoint.&lt;br&gt;&#xA;if not, compute a fft on a sliding window (stft, as yunque mentioned) and sum the power in the alpha band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fft is (n log n) and fairly optimized so computation shouldn't be an issue. &#xA;in fact dsp chips in your phones run it real time&lt;/p&gt;&#xA;" OwnerUserId="16963" LastActivityDate="2015-08-11T15:25:11.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25198" PostTypeId="1" AcceptedAnswerId="25199" CreationDate="2015-08-11T18:41:05.977" Score="0" ViewCount="1458" Body="&lt;p&gt;My understanding of BIBO stability is that if a bounded input is applied to a discrete-time, linear, time-invariant BIBO system, the output will also be bounded. A sufficient condition for this is that the poles of the transfer function are within the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a system with the transfer function &#xA;$$&#xA;H(z)={(1−2z^{−1})(1−{\frac{1}{6}} z^{−1}) \over (1−\frac{1}{2}z^{−1})(1−\frac{1}{3}z^{−1})}&#xA;$$&#xA;The poles of this system are within the unit circle and so is a BIBO stable system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I apply an input of $x[n]=(\frac{1}{3})^n$, which is bounded, the output would involve $H(\frac{1}{3})=\infty$, which is unbounded - i.e. a bounded input produced an unbounded output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, there is something amiss in my understanding here, but what?&lt;/p&gt;&#xA;" OwnerUserId="16901" LastActivityDate="2015-08-11T19:31:27.200" Title="BIBO stability and input at system's pole" Tags="|discrete-signals|linear-systems|theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25199" PostTypeId="2" ParentId="25198" CreationDate="2015-08-11T18:47:12.343" Score="0" Body="&lt;p&gt;The signal $x[n] = (\frac{1}{3})^n$ is not bounded. As $n \to -\infty$, $x[n] \to \infty$; therefore, the system's response to your candidate signal $x[n]$ has no bearing on its BIBO stability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bounded, causal version of the signal (and likely what you were thinking) is $x_b[n] = (\frac{1}{3})^n u[n]$, where $u[n]$ is the unit step function. The response of the system to this signal is bounded as you would expect.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2015-08-11T19:31:27.200" LastActivityDate="2015-08-11T19:31:27.200" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25200" PostTypeId="2" ParentId="25189" CreationDate="2015-08-11T20:50:16.363" Score="0" Body="&lt;p&gt;Let me suggest you to perform the filtering in sliding blocks, not separate. Assume you want to filter the signal $\{ x_i\}$. At each index $k$, you can estimate the linear trend on the block $$X_k=[ x_{k-K_l},\ldots,x_k,\ldots, x_{k+K_r}],$$ taken at indices $$I_k=[ {k-K_l},\ldots,k,\ldots, {k+K_r}],$$ in the form $\beta_k x + \alpha_k$, and remove $\beta x_k + \alpha$ from $x_k$. If $&amp;lt;Y_k&amp;gt;$ denotes the average of the block $Y_k$, then $\beta_k = \frac{&amp;lt;I_k.X_k&amp;gt; - &amp;lt;I_k&amp;gt;&amp;lt;X_k&amp;gt;}{&amp;lt;X_k^2&amp;gt;-&amp;lt;X_k&amp;gt;^2}$, and $\alpha_k = &amp;lt;X_k&amp;gt; - \beta_k &amp;lt;I_k&amp;gt;$. All the averages $&amp;lt;I_k&amp;gt;$, $&amp;lt;X_k&amp;gt;$, $&amp;lt;I_k.X_k&amp;gt;$ and $&amp;lt;X_k^2&amp;gt;$ can be computed recursively with few computations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will end up with an implementation of a local linear regression, also known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Local_regression&quot; rel=&quot;nofollow&quot;&gt;LOESS or LOWESS smoothing&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can think of alternatives like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hodrick%E2%80%93Prescott_filter&quot; rel=&quot;nofollow&quot;&gt;Hodrick–Prescott filters&lt;/a&gt; for instance.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-11T20:50:16.363" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25204" PostTypeId="1" AcceptedAnswerId="27275" CreationDate="2015-08-12T00:38:32.377" Score="2" ViewCount="1910" Body="&lt;p&gt;I have EEG data that comes in the form of a 3D numpy array (epoch * channel * timepoint). timepoint is a 256 element array containing each sampled timepoint (1s total, at 256Hz). epoch is an experimental trial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to import the numpy array into a form Python-MNE (&lt;a href=&quot;http://martinos.org/mne/stable/mne-python.html&quot; rel=&quot;nofollow&quot;&gt;http://martinos.org/mne/stable/mne-python.html&lt;/a&gt;) understands, but I'm having some trouble&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I'm not sure if I should be importing this raw data as a RawArray or an EpochsArray. I tried the latter with this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ch_names = list containing my 64 eeg channel names&#xA;allData = 3d numpy array as described above&#xA;&#xA;info = mne.create_info(ch_names, 256, ch_types='eeg')&#xA;&#xA;event_id = 1&#xA;&#xA;#I got this from a tutorial but really unsure what it does and I think this may be the problem&#xA;events = np.array([200, event_id])  #I got this from a tutorial but really unsure what it does and I think this may be the problem&#xA;&#xA;raw = mne.EpochsArray(allData, info, events=events)&#xA;&#xA;picks = mne.pick_types(info, meg=False, eeg=True, misc=False)&#xA;&#xA;raw.plot(picks=picks, show=True, block=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I run this I get an index error: &quot;too many indices for array&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately I want to do some STFT and CSP analysis on the data, but right now I'm in need of some help with the initial restructuring and importing into MNE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whats the correct way to import this numpy data that would make it easiest to complete my intended analyses?&lt;/p&gt;&#xA;" OwnerUserId="16842" LastActivityDate="2017-03-19T08:06:15.057" Title="Python MNE - reading EEG data from array" Tags="|signal-analysis|python|eeg|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25207" PostTypeId="2" ParentId="20148" CreationDate="2015-08-12T07:40:40.373" Score="0" Body="&lt;p&gt;I would go for option a combined approach, which requires a stereo setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, 3D depth information (which you would use as an additional cue) can be obtained through a stereo matching method. Depth images mean that you end up with 3D surfaces. At this point you could use a surface matching algorithm to initialize the positions of these objects (or cubes). I have implemented such an algorithm in OpenCV. You could find this &lt;a href=&quot;http://docs.opencv.org/3.0-beta/modules/surface_matching/doc/surface_matching.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily, for a calibrated stereo setup, you will have the intensity images and can use those as well. By now, you have the initial poses of the cubes and you would like to refine them. I would then suggest that you use a projective version of the ICP (iterative closest point) algorithm to obtain the most accurate fitting, to the image edges. Again, you could use both cameras in your error function (which you minimize) to reduce noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, the stereo images may suffer from extrinsic calibration errors, as well as measurement errors, decreasing the overall accuracy. That's why you use it to initialize. For cases which do not necessitate accuracy you could stop at this point. If your conditions are as strict as you mention, then simply, the monocular/edge based techniques (the second stage, I described) will provide you a better result.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-09-11T19:45:37.837" LastActivityDate="2015-09-11T19:45:37.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25209" PostTypeId="1" CreationDate="2015-08-12T11:08:04.040" Score="2" ViewCount="139" Body="&lt;p&gt;I am trying to generate a set of linear block codewords of length n and have minimum hamming distance dmin. I understand Hamming codes but they are not flexible with n. One possible way I can think of is brute force search. But when trying to code this in MATLAB I am not sure how to proceed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google search helped me find this link where it does exactly what I want.&#xA;&lt;a href=&quot;http://www.ee.unb.ca/cgi-bin/tervo/hamming.pl&quot; rel=&quot;nofollow&quot;&gt;Code Generation Tool&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I would appreciate any other methods/algorithms which can achieve this in a more efficient way.&lt;/p&gt;&#xA;" OwnerUserId="16449" LastEditorUserId="16449" LastEditDate="2015-08-12T11:20:15.613" LastActivityDate="2015-08-12T19:47:53.490" Title="Generate Minimum distance codes" Tags="|channelcoding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25210" PostTypeId="1" CreationDate="2015-08-12T13:02:00.397" Score="1" ViewCount="92" Body="&lt;p&gt;I'm using the BCI Competition dataset IV 2a. I'm working on Left &amp;amp; right hand movement.  I extracted data of channels (Fz,Cz,Pz). &#xA;I filtered data [8-30], then normalized it.&#xA;I calculated the common spatial patterns of the training dataset using the CSP.m of the Biosig toolbox&#xA;I want to use the &quot;train_sc&quot; to classify my data.&#xA;My question is why do I need to duplicate the labels of each event? &#xA;ex: &#xA;for each right hand event (750 samples) I must have 750 label = 1&#xA;for each left    hand event (750 samples) I must have 750 label = 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;labels = repmat(classlabel’,n,1)’;   %where n is the number of samples/event&#xA;CC = train_sc(features,labels,'LDA');&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that mean that classification is done on samples rather than events?&#xA;Is each sample classified independently?!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results I got are very disappointing. I've tried many classifiers but the best accuracy I got was 0.5 &#xA;I need to know what I'm doing wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read too much on CSP &amp;amp; classification of the eeg signals, but still I feel that I'm missing many things :(&#xA;Any help please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best Regards,&#xA;Sahar Selim&lt;/p&gt;&#xA;" OwnerUserId="16969" LastActivityDate="2017-12-09T09:41:04.843" Title="Why do I have to duplicate the labels used for the classification process?" Tags="|matlab|dsp-core|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25214" PostTypeId="2" ParentId="4723" CreationDate="2015-08-12T13:32:39.383" Score="1" Body="&lt;p&gt;To rephrase the answers: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For signal processing it is the weighted sum of the past into the present.  Typically one term is the voltage history at an input to a filter and the other term is the a filter or some such that has &quot;memory&quot;.  Of course in video processing all of the adjacent pixels take the place of &quot;past&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For probability it is a cross probability for an event given other events; the number of ways to get a 7 in craps is the chance of getting a: 6 and 1, 3 and 4, 2 and 5.  i.e. the sum of probabilities P(2) times the probability P(7-2): P(7-2)P(2)+P(7-1)*P(1)+.....&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2015-08-12T13:32:39.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25215" PostTypeId="2" ParentId="25184" CreationDate="2015-08-12T13:50:11.210" Score="1" Body="&lt;p&gt;First - this will depend on the nature of the phase noise you wish to model. If &lt;code&gt;deltaf&lt;/code&gt; is a constant then it is just a frequency shift and really isn't considered phase noise. What you really need is &lt;code&gt;deltaf&lt;/code&gt; to be a noise vector the same length as &lt;code&gt;t&lt;/code&gt;. In matlab format you can do this by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=0:255;&#xA;fc=0.2; %just an example&#xA;deltaf = 0.001*randn(size(t));&#xA;B=cos(2*pi*(fc+deltaf).*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice that the frequency will have a finite variance in this case - but the phase variance will increase linearly over time - this may or may not be what you want. To have a finite phase variance you would do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=0:255;&#xA;fc=0.2; %just an example&#xA;ph_n = 0.0001*randn(size(t));&#xA;B=cos(2*pi*fc*t+2*pi*ph_n);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Typically you can analyze these signals by using trigonometric identities and then assuming the noise portion is small or by using Taylor series expansions for the noise components.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-08-12T13:50:11.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25216" PostTypeId="1" CreationDate="2015-08-12T14:00:39.997" Score="0" ViewCount="726" Body="&lt;p&gt;I'm trying to find the curvature of the features in an image and I was advised to calculate the gradient vector of pixels. So if the matrix below are the values from a grayscale image, how would I go about calculating the gradient vector for the pixel with the value '99'?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;21 20 22 24 18 11 23&#xA;21 20 22 24 18 11 23&#xA;21 20 22 24 18 11 23&#xA;21 20 22 99 18 11 23&#xA;21 20 22 24 18 11 23&#xA;21 20 22 24 18 11 23&#xA;21 20 22 24 18 11 23&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apologies for asking such an open ended question, I've never done much maths and am not sure how to start tackling this.&lt;/p&gt;&#xA;" OwnerUserId="8615" LastActivityDate="2015-08-13T21:49:50.160" Title="How do I compute the gradient vector of pixels in an image?" Tags="|image-processing|edge-detection|gradient|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25217" PostTypeId="1" CreationDate="2015-08-12T14:14:06.917" Score="0" ViewCount="458" Body="&lt;p&gt;I want to know how can I achieve this effect:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=DQg9M_47c3A&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=DQg9M_47c3A&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I need to use a filter? And what can I use for the crackling, poping effect?&#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="16971" LastActivityDate="2015-09-15T02:13:30.690" Title="Vinyl Crackling Effect" Tags="|filters|audio|distortion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25218" PostTypeId="1" AcceptedAnswerId="25223" CreationDate="2015-08-12T14:44:48.520" Score="2" ViewCount="1251" Body="&lt;p&gt;To compare grayscale images, I'm using SSD like the difference between the two corresponding pixels and then choose the minimum.&#xA;But when it comes to RGB images, how should it works ?&lt;/p&gt;&#xA;" OwnerUserId="16905" LastEditorUserId="15650" LastEditDate="2015-08-13T08:57:00.503" LastActivityDate="2015-08-13T08:57:00.503" Title="SSD for RGB images" Tags="|image-processing|color|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25219" PostTypeId="1" CreationDate="2015-08-12T15:19:36.110" Score="1" ViewCount="1941" Body="&lt;p&gt;I use a white-noise generator in an rf bridge to measure antenna impedance.&lt;br&gt;&#xA;The receiver is an ordinary AM/CW/SSB communications type, nothing fancy, nothing 'coherent'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I approach the null of the bridge the signal is masked by receiver noise.  To make it stand out I 'modulate' the noise with a 1kHz square wave (the noise source is switched on/off at about 1kHz.)  I 'null' on the 1kHz audio, not the received noise power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question:  What is the spectrum of the modulated noise and &lt;em&gt;how is it different from that of the 'raw' noise?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="16972" LastActivityDate="2015-12-11T11:30:05.243" Title="What is the spectrum of modulated noise?" Tags="|frequency-spectrum|noise|modulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25220" PostTypeId="1" CreationDate="2015-08-12T16:21:55.900" Score="11" ViewCount="20174" Body="&lt;p&gt;I'm writing my MSE thesis report on an inertial navigation problem I've been working on. In my work, I use a complementary filter to track the orientation of a device. Now, since my fellow students are likely not familiar with complementary filters or Kalman filters, I wish to give a brief description of what a &quot;complementary filter&quot; is, in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A definition, if you will.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what defines a complementary filter? Is it any filter on the form &lt;code&gt;z = a * x + (1 - a) * y&lt;/code&gt;, where x and y are separate measurements of a single quantity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's fine to define it in terms of Kalman filters if that's appropriate.&lt;/p&gt;&#xA;" OwnerUserId="16973" LastActivityDate="2016-10-06T12:17:01.643" Title="What is the definition of a &quot;complementary filter&quot;?" Tags="|filters|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25221" PostTypeId="1" AcceptedAnswerId="25248" CreationDate="2015-08-12T16:39:48.900" Score="5" ViewCount="778" Body="&lt;p&gt;I am attempting to analyze images using the third order image moment (aka skewness), but I am having trouble figuring out how to do so. As it turns out, there are four different types of third order image moments:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{rcl}&#xA;\mu_{21} &amp;amp;=&amp;amp; M_{21} + 2\bar{x}M_{11} - \bar{y}M_{20} + 2\bar{x}^2M_{01}\\&#xA;\mu_{12} &amp;amp;=&amp;amp; M_{12} + 2\bar{y}M_{11} - \bar{x}M_{02} + 2\bar{y}^2M_{10}\\&#xA;\mu_{30} &amp;amp;=&amp;amp; M_{30} - 3\bar{x}M_{20} + 2\bar{x}^2M_{10}\\&#xA;\mu_{03} &amp;amp;=&amp;amp; M_{03} - 3\bar{y}M_{02} + 2\bar{y}^2M_{01}&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{rcl}&#xA;M_{p,q} &amp;amp;=&amp;amp; \mbox{Raw moment of order}\ (p+q)\\&#xA;\mu_{p,q} &amp;amp;=&amp;amp; \mbox{Central moment of order}\ (p+q)\\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Formulas pulled from &lt;a href=&quot;https://en.wikipedia.org/wiki/Image_moment&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia - Image Moments&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It's been very difficult to find out what the differences are between these 4 (if there are any) on the internet. If there's anyone here that could explain in layman's terms how they differ, I would greatly appreciate it.&lt;/p&gt;&#xA;&lt;p&gt;This question is most likely asking something that's more fundamental to the calculation of moments themselves than specifically with regard to image moments. However, I have seen several questions about them here, so I figured it would be a good place to start.&lt;/p&gt;&#xA;" OwnerUserId="16974" LastEditorUserId="7092" LastEditDate="2021-09-01T11:13:01.327" LastActivityDate="2021-09-01T11:13:01.327" Title="What Are the Differences in Four Different Types of Third Order Image Moments (Skewness)?" Tags="|image-processing|feature-extraction|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25222" PostTypeId="2" ParentId="25209" CreationDate="2015-08-12T19:42:03.937" Score="1" Body="&lt;p&gt;You don't really put any constraints on the family of codes (not even the alphabet). For real applications, you do need to put more constraints on what you want for a code. And distance may not be so important (e.g. the minimum distance of many LDPC codes is quite low, but you need to decode well beyond distance/2 to come close to capacity on many channels). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brute force searching a code is a bad idea, since most codes are hard to decode (you need some structure to exploit to decode efficiently). Also, computing the minimum distance is NP hard in general (Vardy, 1997).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of a code, which has worked well for many applications (CD's, RAID arrays, TV, Voyager mission, etc.). &lt;a href=&quot;https://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction&quot; rel=&quot;nofollow&quot;&gt;Reed-Solomon Codes&lt;/a&gt; are a family of maximum distance separable (MDS) codes, i.e. for a given length n and number of information symbols k, they have the largest distance possible (n-k+1). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are also easily decodable, say by the Peterson-Gorenstein-Zierler algorithm or Berklenkamp-Massey algorithm (more efficient). You can apply these to generalized reed solomon codes as well (See R.M. Roth, Introduction to coding theory, for details). Many other codes are related to this family. For example, BCH codes are alternant codes from a RS code. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastEditorUserId="7930" LastEditDate="2015-08-12T19:47:53.490" LastActivityDate="2015-08-12T19:47:53.490" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25223" PostTypeId="2" ParentId="25218" CreationDate="2015-08-12T20:45:37.500" Score="2" Body="&lt;p&gt;There are many ways to do that. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First, you could compute SSD scores for multiple channels and average them.&lt;/li&gt;&#xA;&lt;li&gt;Another way is to directly convert the color image to gray, so that you only could compute the final SSD in a single pass. &lt;/li&gt;&#xA;&lt;li&gt;Finally, there are methods to perform template matching not using plain intensities, but the gradients. By computing the color gradient from the color structure tensor (e.g. &lt;a href=&quot;https://dsp.stackexchange.com/questions/15458/edge-detection-on-a-color-image&quot;&gt;as in here&lt;/a&gt;), you could leverage RGB information.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-08-12T20:45:37.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25224" PostTypeId="2" ParentId="25220" CreationDate="2015-08-12T22:50:25.997" Score="13" Body="&lt;p&gt;Usually, a complementary filter (like a complementary function) &lt;em&gt;complements&lt;/em&gt; another filter.  The two filters that are complementary to each other add to one.  Or, at least, add to an all-pass filter (which is what &lt;a href=&quot;http://www.rane.com/note160.html&quot;&gt;Linkwitz-Riley crossovers&lt;/a&gt; do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so either&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(f) + G(f) = 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(f) + G(f) = A(f) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $H(f)$ and $G(f)$ being complements of each other and $|A(f)|=1$ is an APF.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-08-12T22:50:25.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25225" PostTypeId="1" AcceptedAnswerId="25264" CreationDate="2015-08-12T23:43:37.207" Score="1" ViewCount="607" Body="&lt;p&gt;I am doing an experiment, where I am trying to get the same results from correlating two matrices in the fourier domain and then scaling the data by some constant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method_1: Do FFT, Correlate the data, Do IFFT, Scale data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method_2: Scale data, Do FFT, Correlate the data, Do IFFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, I am expecting that if I scale the data before I do correlation I should get the same results if I do correlation first, and then scale the data afterwards(provided that the scaling factor is the same). What's different in my case is that I am doing the correlation in the fourier domain instead of the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below illustrates an example of scaling data before or after fft, which will yield the same results&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data_1=[1,2,3,6;4,5,9,10;7,8,9,4;10,14,13,12];&#xA;%scaling constant&#xA;h=magic(4);&#xA;&#xA;%METHOD_1&#xA;&#xA;    %go to fourier domain&#xA;    method1_data1_fourier=fft2(data_1,8,8);             %zero padding&#xA;&#xA;    %do ifft&#xA;    result1=ifft2(method1_data1_fourier,8,8);&#xA;&#xA;    %scale&#xA;    result1=result1(1:4,1:4)./h;&#xA;&#xA;%METHOD_2&#xA;&#xA;    method2_data1 = data_1;&#xA;&#xA;    %scale&#xA;    method2_data1 = method2_data1./h;&#xA;&#xA;    %go to fourier domain&#xA;    method2_data1_fourier=fft2(method2_data1,8,8);              %zero padding&#xA;&#xA;    %do ifft&#xA;    result2=ifft2(method2_data1_fourier,8,8);&#xA;    %result2=result2(1:4,1:4);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Below is a matlab example of what I am trying to do in C++ with 32 bit floating point precsion and fft length of 47x47 (padded with zeros to 94x94 before transform)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%correlating data_1 against data_2&#xA;data_1=[1,2,3,6;4,5,9,10;7,8,9,4;10,14,13,12];&#xA;data_2=[7,2;9,8;3,1];&#xA;%scaling constant&#xA;h=magic(4);&#xA;&#xA;%METHOD_1&#xA;&#xA;    %go to fourier domain&#xA;    method1_data1_fourier=fft2(data_1,8,8);             %zero padding&#xA;    method1_data2_fourier=fft2(data_2,8,8);&#xA;&#xA;    %do correlation&#xA;    result1 = method1_data1_fourier.*conj(method1_data2_fourier);&#xA;&#xA;    %do ifft&#xA;    result1=ifft2(result1,8,8);&#xA;&#xA;    %scale&#xA;    result1(1:4,1:4)=result1(1:4,1:4)./h;&#xA;&#xA;%METHOD_2&#xA;&#xA;    method2_data1 = data_1;&#xA;    method2_data2 = data_2;&#xA;&#xA;    %scale&#xA;    method2_data1 = method2_data1./h;&#xA;&#xA;&#xA;    %go to fourier domain&#xA;    method2_data1_fourier=fft2(method2_data1,8,8);              %zero padding&#xA;    method2_data2_fourier=fft2(method2_data2,8,8);&#xA;&#xA;    %do correlation&#xA;    result2 = method2_data1_fourier.*conj(method2_data2_fourier);&#xA;&#xA;    %do ifft&#xA;    result2=ifft2(result2,8,8);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I am not getting the results I expected to get, as in result1 and result2 do not match at all. Can anyone tell me what is wrong with the above method I am using? I believe it has something to do with the result be being shifted after the correlation in the fourier domain because indice (3,3) of result1 and result2 are the same, and the first matlab example works fine.&lt;/p&gt;&#xA;" OwnerUserId="16673" LastEditorUserId="16673" LastEditDate="2015-08-13T03:19:24.573" LastActivityDate="2015-08-15T00:46:52.397" Title="Scaling Data before Fourier transform" Tags="|fourier-transform|cross-correlation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25230" PostTypeId="1" AcceptedAnswerId="25236" CreationDate="2015-08-13T05:36:14.203" Score="1" ViewCount="1021" Body="&lt;p&gt;I know the definition of this is simple and I do understand the concept of aliasing (I think) in the way that multiple signals can be aliases of each other. For example, I get it when some one says: sampling of a 7-kHz sinewave at a sample rate of 6 kHz will provide a discrete sequence of numbers whose spectrum ambiguously represents tones at 1 kHz, 7 kHz, 13 kHz, 19 kHz, etc. However, how do you determine what aliases to what? Obviously I have a terminology problem. I understand that signals can be aliases of each other (right??), but cannot see what signal aliases to what other signal. &lt;/p&gt;&#xA;" OwnerUserId="16983" LastEditorUserId="13320" LastEditDate="2016-11-13T13:19:08.880" LastActivityDate="2023-01-06T16:04:28.003" Title="What does it mean for a signal to alias to another?" Tags="|aliasing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25231" PostTypeId="1" CreationDate="2015-08-13T05:43:46.230" Score="0" ViewCount="1255" Body="&lt;p&gt;I am trying to find the frequency/phase response of two cheap microphones bought off Ebay. Basically, I want to graph the frequency responses and phase responses of both microphones on the same axis so I can compare their sensitivity in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach I have read is downloading and playing a file that consists of pink noise through a speaker and simultaneously recording this using both microphones, then using the two recorded signals and the original pink noise file to get the bode plots. This is achieved by first taking the FFT of the recorded signals and of the original pink noise signal, and then using the bode function in MATLAB. The frequency/phase response of the speaker is unknown, however I'm more interested in the differences between the two microphones, so my thoughts are this wont affect my analysis. Any thoughts on this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easier approach to finding the frequency/phase response of two microphones that I am not aware of using MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="16459" LastActivityDate="2015-09-15T19:46:43.790" Title="Find frequency/phase response of a microphone" Tags="|matlab|audio|phase|frequency-response|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25232" PostTypeId="1" CreationDate="2015-08-13T05:49:34.157" Score="1" ViewCount="69" Body="&lt;p&gt;Okay I am starting to understand the idea of neural networks but I still haven't been able to understand the use/benefits/implementation of convolutional neural networks especially for image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is how to detect an object of different size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say we have a weights matrix of 50*50 and a face in the training set which is of 50*50 size . Now when you take the weighted sum of the matrix it will return a particular value say &quot;X&quot; . So now I understand the idea is to run the weights matrix over the entire image to get a lock over a region which gives a weighted sum of ~&quot;X&quot; now you have detected a face.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the above mentioned understanding is true Then how is that an image of size 25*25 going to churn out a value anywhere clone to &quot;X&quot; . So the basic question is how to deal with relative sizes of the image .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If possible please suggest some good tutorials for the same .&lt;/p&gt;&#xA;" OwnerUserId="16984" LastEditorUserId="7338" LastEditDate="2015-09-12T07:52:26.330" LastActivityDate="2016-02-09T09:46:54.840" Title="Image processing using conv-neural net" Tags="|image-processing|computer-vision|convolution|python|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25234" PostTypeId="2" ParentId="25232" CreationDate="2015-08-13T05:59:22.450" Score="1" Body="&lt;p&gt;First of all, CNNs are typically used with identical sized inputs. So, you resize your input to a constant size, no matter what.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, detecting an object and recognizing an object over many samples are different tasks. For object detection, you could be better of with &lt;a href=&quot;http://www.cs.berkeley.edu/~rbg/papers/r-cnn-cvpr.pdf&quot; rel=&quot;nofollow&quot;&gt;R-CNNs&lt;/a&gt;. Its sources are also &lt;a href=&quot;https://github.com/rbgirshick/rcnn&quot; rel=&quot;nofollow&quot;&gt;available&lt;/a&gt; and there is a &lt;a href=&quot;http://tutorial.caffe.berkeleyvision.org/caffe-cvpr15-detection.pdf&quot; rel=&quot;nofollow&quot;&gt;Caffe tutorial for R-CNNs&lt;/a&gt;. Of course there are many other works on the same topic. For example, &lt;a href=&quot;http://www.cv-foundation.org/openaccess/content_cvpr_2014/papers/Erhan_Scalable_Object_Detection_2014_CVPR_paper.pdf&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-08-13T05:59:22.450" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25236" PostTypeId="2" ParentId="25230" CreationDate="2015-08-13T07:10:15.790" Score="1" Body="&lt;p&gt;Sampling of a signal leads to repetition in the frequency domain. Typically, the frequency domain is considered from $-\pi/2$ up to $\pi/2$ or from $0$ to $\pi$, where $\pi$ corresponds to the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a real-valued signal, the spectrum is also symmetric around $n\pi/2$ for any integer $n$. For your example where a sine wave with frequency $7$kHz is sampled at $6$ kHz, this means that the sampled signal contains the frequencies $1+6\cdot n$ kHz and the symmetric/mirrored frequencies $5+6\cdot n$ kHz, e.g., 1 kHz, 7 kHz, 13 kHz and 5 kHz, 11 kHz (and also the negative frequency parts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You speak of 'aliasing over another signal' when the aliases overlap with other signal content. For example, when you have a signal consisting of the sine wave of 2 kHz and 7 kHz, which you sample with a rate of 6 kHz, then you observe the frequencies 2 kHz; 4 kHz and 1 kHz; 5 kHz. These frequencies do not overlap. When the original signal contains 1 kHz and 7 kHz and you sample at a rate of 6 kHz, then the '7 kHz signal aliases over the 1 kHz signal'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this principle works also with other signals, such as narrowband, low passed and high passed signals.&lt;/p&gt;&#xA;" OwnerUserId="16570" LastActivityDate="2015-08-13T07:10:15.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25238" PostTypeId="1" CreationDate="2015-08-13T08:05:10.167" Score="2" ViewCount="352" Body="&lt;p&gt;I find this image : &#xA;&lt;a href=&quot;http://ptgmedia.pearsoncmg.com/images/chap1_9780132172288/elementLinks/01fig13_alt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DxTSd.jpg&quot; alt=&quot;CIR&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it mean that at 0ns there is one path, 10ns second path, ... and approximately at 130 ns, there is a power path?&lt;/p&gt;&#xA;" OwnerUserId="15738" LastEditorUserId="13320" LastEditDate="2015-10-14T18:15:16.550" LastActivityDate="2020-04-23T11:21:33.530" Title="Channel impulse reponse multipaths" Tags="|multipath|fading-channel|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25239" PostTypeId="2" ParentId="25231" CreationDate="2015-08-13T08:10:43.323" Score="0" Body="&lt;p&gt;I would probably proceed as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the power spectrum of both mics:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PSD = ((fftshift((((fft(Signal,numel(Signal)).*conj(fft(Signal,numel(Signal)))))))/(numel(Signal)/2)*dt));&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If both signal have been recorded at exactly same time stamps, you should only subtract the amplitudes of both spectra to figure out how the behavior of the two mics differs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Delta = abs(PSD2 - PSD1);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3666" LastActivityDate="2015-08-13T08:10:43.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25240" PostTypeId="2" ParentId="25219" CreationDate="2015-08-13T09:11:34.380" Score="1" Body="&lt;p&gt;Short answer: most likely white noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Amplitude modulation using a sinusoidal wave shifts the original spectrum in frequency by the sinusoids frequency.  For instance, if there is a source with a square spectrum spanning -100Hz to 100Hz, and it is modulated by a 1000Hz sinusoid, it will have shifted the spectrum in both positive and negative frequency.  Thew new spectrums will show two sources of energy from -1100Hz to -900Hz and 900Hz to 1100Hz.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/DiB5T.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DiB5T.png&quot; alt=&quot;Effect of amplitude modulation with sinusoid&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your question, we also should consider that their source signal is white-noise, and the carrier signal is a square wave rather than a sinusoid.  A square wave, rather than having a single peak in the frequency domain (such as a sinusoid does), has multiple harmonics of descending strength.  Modulating with a square wave will create multiple images of your source signal to appear, each centered around the square wave's harmonics and scaled by the half the strength of the harmonic. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/f2qWe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f2qWe.jpg&quot; alt=&quot;Square wave spectrum&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your input signal is true white noise (really only observed mathematically), the shifted noise signals would only add up to more white noise.  But, if you have band-limited noise, then you will see copies of the noise spectrum shifted to the square wave's harmonics.&lt;/p&gt;&#xA;" OwnerUserId="16987" LastActivityDate="2015-08-13T09:11:34.380" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25242" PostTypeId="2" ParentId="25217" CreationDate="2015-08-13T12:08:14.007" Score="1" Body="&lt;p&gt;Several approaches exist to create a vinyl crackle effect [1]. Usually, this type of disturbance is assumed to be an additive one. Hence, the crackling effect is achieved by somehow generating/obtaining a disturbance signal and adding it to the clean signal, not by filtering the original signal.&lt;/p&gt;&#xA;&lt;p&gt;If you just want to get hold of such crackle signal, you can find at least one generator online, for example &lt;a href=&quot;http://mynoise.net/NoiseMachines/dustyScratchedVinylNoiseGenerator.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. If you don't mind to pay money for software that can simulate not only vinyl disturbances but a variety of effects, have a look at &lt;a href=&quot;https://www.izotope.com/en/products/effects-instruments/trash/&quot; rel=&quot;nofollow noreferrer&quot;&gt;iZotope Trash 2&lt;/a&gt;. (This company used to offer a vinyl sound generator called &amp;quot;Vinyl&amp;quot; for free, but unfortunately this is discontinued.)&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, there are a number of free samples online (e.g. at &lt;a href=&quot;http://www.freesound.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;freesound.org&lt;/a&gt;) that can be used.&lt;/p&gt;&#xA;&lt;p&gt;If, on the other hand, you're interested in generating a plausible sounding but artificial vinyl click/crackle signal on your own, I would recommend having a look at an &lt;a href=&quot;http://research.spa.aalto.fi/publications/papers/antiquing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; by Välimäki et al., describing, among other things, how to do this.&lt;/p&gt;&#xA;&lt;p&gt;[1] S. V. Vaseghi, Advanced Digital Signal Processing and Noise Reduction. Chichester, West Sussex: Wiley, 2008.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-08-13T12:08:14.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25243" PostTypeId="2" ParentId="25220" CreationDate="2015-08-13T12:33:38.027" Score="5" Body="&lt;p&gt;In support of robert's answer, &lt;a href=&quot;https://www.mit.bme.hu/system/files/oktatas/targyak/7206/A_comparison_of_complementary_and_kalman_filtering.pdf&quot; rel=&quot;noreferrer&quot;&gt;here's a paper that explains it in a similar way.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iQ4DS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iQ4DS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8mFth.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8mFth.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-08-14T14:19:59.930" LastActivityDate="2015-08-14T14:19:59.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25244" PostTypeId="1" AcceptedAnswerId="25245" CreationDate="2015-08-13T12:57:11.343" Score="2" ViewCount="144" Body="&lt;p&gt;While Im studying wavelet transform, I have this questions in my mind which can't find it's answer:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I understand that when we take longer time windows and take the fourier transform we would suffer in the time resolution, But Why if we take a shorter time window we would suffer in frequency resolution?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;why longer time intervals are   needed for high frequency signals? and shorter time intervals are needed for low frequency signals? In another word, Why we want good frequency resolution for high frequencies and good time resoution for low frequencies?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I have a signal contains frequencies from 0 Hz to 50 Hz, How can I define the range of low and high frequencies?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15174" LastEditorUserId="15174" LastEditDate="2015-08-13T13:25:21.567" LastActivityDate="2015-08-13T13:35:27.153" Title="Time-Frquency Resolution issues" Tags="|signal-analysis|wavelet|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25245" PostTypeId="2" ParentId="25244" CreationDate="2015-08-13T13:35:27.153" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I understand that when we take longer time windows and take the fourier transform we would suffer in the time resolution, But Why if we take a shorter time window we would suffer in frequency resolution?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Imagine that your signal is two different sinusoids that are close in frequency and they both start at phase 0.  If the time window is short their end phase will be almost identical because their frequencies are close.  Thus, they are difficult to distinguish with a short time window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the time window is long the end phase will be quite different- eventually they will be opposite phases (180 degrees out of phase), and thus very easy to distinguish.  That is why longer time windows give better frequency resolution.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;why longer time intervals are needed for high frequency signals? and shorter time intervals are needed for low frequency signals? In another word, Why we want good frequency resolution for high frequencies and good time resoution for low frequencies?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You do not need longer time intervals for high frequency signals.  You'll need to clarify what you're trying to get at on #2 if you want a better response.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I have a signal contains frequencies from 0 Hz to 50 Hz, How can I define the range of low and high frequencies?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again, I'm not sure what you mean.  What you define as a &quot;high frequency&quot; or &quot;low frequency&quot; is completely arbitrary.  What you will need to do is sample the signal at more than 100 Hz to make sure that the Nyquist frequency is above 50 Hz.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-08-13T13:35:27.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25246" PostTypeId="2" ParentId="25216" CreationDate="2015-08-13T15:21:46.477" Score="2" Body="&lt;p&gt;So, if you're using Matlab, you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = your matrix&#xA;&#xA;[gx,gy] = gradient(X); % first order gradient&#xA;&#xA;[gxx,gxy] = gradient(gx); % second order gradient&#xA;&#xA;[gxy,gyy] = gradient(gy); % second order gradient&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To find the curvature of features I advise you to look into the eigenvalues and eigenvectors of a Hessian matrix. A hessian matrix is a square matrix of second-order derivatives of a scalar valued function. In this case the scalar field is the intensity, and the second order derivatives are $g_{xx}$, $g_{xy}$, $g_{yy}$.&lt;/p&gt;&#xA;" OwnerUserId="16980" LastEditorUserId="7338" LastEditDate="2015-08-13T21:49:50.160" LastActivityDate="2015-08-13T21:49:50.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25248" PostTypeId="2" ParentId="25221" CreationDate="2015-08-13T19:57:49.647" Score="2" Body="&lt;p&gt;It it based on the definition of Central Moments on 2D grid given in the Wikipedia Page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {\mu}_{pq} = \int\limits_{-\infty}^{\infty} \int\limits_{-\infty}^{\infty} (x - \bar{x})^p(y - \bar{y})^q f(x,y) \, dx \, dy $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we're dealing with 2 random variables, a multiplication which the powers sum to 3 can be achieved in 4 different methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's up to you to decide how to calculate the third moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually I'd use the Rotation Invariant Moments.&lt;br&gt;&#xA;You can find the definition on the same page.&lt;br&gt;&#xA;Enforcing the Rotation (And Scale) Invariance yields single definition.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-08-13T19:57:49.647" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25249" PostTypeId="1" AcceptedAnswerId="25268" CreationDate="2015-08-13T20:53:00.647" Score="2" ViewCount="121" Body="&lt;p&gt;I'm no signal processing guru, so I'm looking for a pretty basic explanation that I'll understand. I've seen &lt;a href=&quot;https://dsp.stackexchange.com/questions/8257/phase-locked-loop-basics%20%22this%20question&quot;&gt;this question&lt;/a&gt; about Phase Locked Loops, but I have a hard time understanding that, especially in relation to digital audio workstations (DAWs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to know is how DAWs align the phase of signals when sending them through AU or VST plugins. How do they know how much the plugins will delay a signal they send through it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may be mistaken in my assumption that any correction is actually necessary, but then how do DAWs correct for delay of each channel in parallel processing?&lt;/p&gt;&#xA;" OwnerUserId="16994" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-08-15T22:58:06.427" Title="How do DAWs align the phase when working with plugins?" Tags="|discrete-signals|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25250" PostTypeId="2" ParentId="25238" CreationDate="2015-08-13T21:21:41.023" Score="0" Body="&lt;p&gt;I've never heard of the term power path before applied to channel impulse responses. If my guess is correct, that figure depicts the CIR you get at different distances from a point, which can be the source or anywhere else. All the spikes you see at Xns are propagation paths. That is, you will receive a copy of the signal delayed Xns for every single peak.&lt;/p&gt;&#xA;" OwnerUserId="3865" LastActivityDate="2015-08-13T21:21:41.023" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25251" PostTypeId="1" AcceptedAnswerId="25261" CreationDate="2015-08-14T04:45:01.723" Score="2" ViewCount="6885" Body="&lt;p&gt;I've been studying for a signals and systems class coming this fall and am trying to understand the following problem.&#xA;$$$$&#xA;Show whether the following system is time invariant or time varying:&#xA;$$S_1:y = T_1[x],\;\; y(t) =  \int_0^t{[x(\tau)]^3\,d\tau},\;\;t\geq 0$$&#xA;solution:&#xA;$$z(x)=t[x(t-\sigma)] =  \int_0^t{[x(\tau-\sigma)]^3\,d\tau}$$&#xA;$$=  \int_{-\sigma}^{t-\sigma}{[x(\tau')]^3\,d\tau'}$$&#xA;Where the change of variable $\tau-\sigma \rightarrow \tau'$ is applied. and&#xA;$$y(t-\sigma) =  \int_0^{t-\sigma}{[x(\tau)]^3\,d\tau}$$&#xA;So I know that the answer is that $z(x) \neq y(t-\sigma)$ and thus the system is time varying. So my question is why doesn't 0 get subtracted by $\sigma$ in integral expressed in $y(t-\sigma)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore if I switch the limits of integration like so:&#xA;$$S_2:y = T_2[x],\;\; y(t) =  \int_{t}^{t+1}{[x(\tau)]^3\,d\tau},\;\; t\geq 0$$&#xA;Would $S_2$ be time invariant?&lt;/p&gt;&#xA;" OwnerUserId="16998" LastEditorUserId="1629" LastEditDate="2015-08-15T17:23:23.133" LastActivityDate="2015-08-15T17:23:23.133" Title="Determining if a system involving integrals is time varying or time-invariant" Tags="|system-identification|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25252" PostTypeId="1" AcceptedAnswerId="25258" CreationDate="2015-08-14T04:50:33.163" Score="5" ViewCount="2240" Body="&lt;p&gt;Basically what it says in the title; I have just started reading about these things and find noncausal filters pretty interesting in concept, but also they do not seem like they would have any advantage worth sacrificing real-time processing. Since &quot;I have just started reading about these things&quot; I feel as if I should make sure, and would also be interested in hearing: does anyone know if there are noncausal filters commonly used in practice? Why are they preferred? Thanks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff Boucher.&lt;/p&gt;&#xA;" OwnerUserId="17000" LastActivityDate="2015-08-14T15:17:45.360" Title="Are noncausal filters ever used in practice?" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25253" PostTypeId="2" ParentId="25119" CreationDate="2015-08-14T07:37:39.190" Score="1" Body="&lt;p&gt;The are some ways to improve your solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, use &lt;code&gt;numpy&lt;/code&gt; and vectorize your code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def genSine(f0,fs,dur):&#xA;    sinusoid = []&#xA;    for t in range(dur):&#xA;        sinusoid.append(math.sin(2*math.pi*t(*freq/fs)))&#xA;    sinusoid = normalise(sinusoid)&#xA;    return sinusoid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;becomes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;def genSine(f0, fs, dur):&#xA;    t = np.arange(dur)&#xA;    sinusoid = np.sin(2*np.pi*t*(f0/fs))&#xA;    sinusoid = normalise(sinusoid)&#xA;    return sinusoid&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You will see the biggest improvment in efficiency when vectorizing all your code like this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, concerning the normalization, you should consider the mathematics of your problem instead of doing it 3 times. You have 3 pieces of signal, the sinusoid, the noise, the mix. The first is already normalized (between -1 and 1), the second also (hence the name normal distribution for describing the noise). So you should only normalize the third.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2015-08-14T07:37:39.190" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25254" PostTypeId="1" CreationDate="2015-08-14T10:39:55.623" Score="2" ViewCount="1115" Body="&lt;p&gt;I have PPG signal that should be normalized, with offline processing I'd just do $z$-normalization, &#xA;$$&#xA;\displaystyle \frac{x- \mu_x}{\sigma_x} \quad \text{where } x \text{ is the signal.} &#xA;$$&#xA;The problem is that I get the data in chunks and I'm not sure what would be the effect on the signal when normalizing only chunks of the data at any given point. Any ideas or suggestions on how to approach this would be highly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Jack&lt;/p&gt;&#xA;" OwnerUserId="17003" LastEditorUserId="80" LastEditDate="2015-08-14T13:45:02.077" LastActivityDate="2015-08-14T23:18:15.373" Title="Per Window Normalization" Tags="|matlab|fft|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25255" PostTypeId="2" ParentId="25254" CreationDate="2015-08-14T11:25:03.750" Score="1" Body="&lt;p&gt;In several application the mean is removed by using a high pass filter. A first order high pass filter has the following structure: &#xA;$$y[k] = x[k] - x[k-1] + \beta y[k-1]$$ &#xA;or&#xA;$$y[k] = \beta x[k] - \beta x[k-1] + \beta y[k-1]$$ &#xA;where $0&amp;lt;\beta&amp;lt;1$ determines the steepness of the high pass filter, larger $\beta$ leads to a steeper/sharper filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NOTE: Multiplying $x[k]$ and $x[k-1]$ by $\beta$ (as in the second equation) ensures that the gain per frequency is at most one. Due to the next normalization step, using this $\beta$ for $x$ is redundant.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalization of the signals energy can be performed with a recursive estimation of the signal energy: &#xA;$$ P_x[k] = \alpha y[k]y[k] + (1-\alpha) P_x[k-1] $$&#xA;where $y[n]$ is the zero mean signal and $0&amp;lt;\alpha&amp;lt;1$ is a forgetting factor. Small values for $\alpha$ lead to large time-constants of the recursive filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The normalized output output $z[k]$ is calculated as follows: &#xA;$$z[k] = \frac{y[k]}{\sqrt{P_x[k]}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal $z[k]$ is a zero-mean signal with unit variance. You can scale your variance to a desired level $\sigma^2$ by applying the gain $\sqrt{\sigma^2}$ to signal $z[k]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE1: A signal in the rang [0,1] always has a non-zero mean if the signal is not zero all the time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE2: In order to guarantee the signal levels to be in a specified range such as [-1,1], either a compression technique has to be applied or you have to know the original abolute maxima and minima such that you can scale to the desired range. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE3: The variance in combination with the distribution only tells something about the majority of the samples.&lt;/p&gt;&#xA;" OwnerUserId="16570" LastEditorUserId="16570" LastEditDate="2015-08-14T23:18:15.373" LastActivityDate="2015-08-14T23:18:15.373" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25258" PostTypeId="2" ParentId="25252" CreationDate="2015-08-14T15:17:45.360" Score="5" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with a system that operates in (near) real time is that you can't look into the future. One way you can deal with this is if you only need a finite amount of look-ahead is to put some delays and then delay the output so you're still causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, many filtering problems have non-causality allowed, e.g. filtering a file on a disk (which occurs a lot. Audio or image or video files you download, time series such as finance data, or histories of systems). For example, you can collect a time series and smooth it with the rauch-tung-striebel filter rather than running a fixed lag smoother. &lt;/p&gt;&#xA;" OwnerUserId="7930" LastActivityDate="2015-08-14T15:17:45.360" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25259" PostTypeId="2" ParentId="25189" CreationDate="2015-08-14T15:43:44.447" Score="1" Body="&lt;p&gt;I've had success using &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/DC_Blocker.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DC blocking filters&lt;/a&gt; to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blue graph below shows a noisy trend.  The red graph shows the DC blocking filter applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is some scilab code to implement it. Scilab is quite close to matlab (but not quite!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YIbuK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YIbuK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 25189&#xA;N=1024;&#xA;t=[0:N-1];&#xA;trend = 0.1*t;&#xA;noisy_trend = trend + 10*rand(1,1024,&quot;normal&quot;);&#xA;&#xA;clf&#xA;plot(t,noisy_trend)&#xA;dc_blocked = [];&#xA;for idx = [2:N]&#xA;    dc_blocked(idx) = noisy_trend(idx) - noisy_trend(idx-1) + 0.9*dc_blocked(idx-1)&#xA;end&#xA;plot(t,dc_blocked,'r')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-14T15:43:44.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25260" PostTypeId="1" AcceptedAnswerId="48045" CreationDate="2015-08-14T16:01:24.920" Score="4" ViewCount="518" Body="&lt;p&gt;Say I have an impulse response...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Uextt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Uextt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(an envelope of the actual IR obtained using the Hilbert transform)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... question: how do I calculate the surrounding noise level?&#xA;Visually this looks to be ~ -54 dB w.r.t. the peak. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But before you say something like &quot;just average the surrounding parts&quot; (ok maybe with better technical terminology), I would actually like to determine the noise level programmatically, in order to deal with wider peaks, like...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZLMbv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZLMbv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just arbitrarily taking some noise samples could accidentally include part of the peak and obviously invalidate the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My hunch: set a threshold as the minimum number of samples above some level  X such that this level can be considered to be noisy. This could work well in the first case - as you increase X to above ~ -54 dB the number of samples above suddenly drops by a significant amount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach may not work so well in the second case as the decay range consists of more samples (the increase may not be so significant). I could extend the sampling time... but I can only hold my breath for so long when recording.&lt;/p&gt;&#xA;" OwnerUserId="17005" LastActivityDate="2018-05-22T14:20:42.323" Title="Measuring noise floor in an impulse response" Tags="|noise|impulse-response|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25261" PostTypeId="2" ParentId="25251" CreationDate="2015-08-14T16:25:55.963" Score="2" Body="&lt;p&gt;The fixed bound at 0 in $\int_0^t$ indeed suggests a time-variance.You only need a counter-example for $S_1$, like the constant $x(t) = 1$.  $y(t+1) = t+1$, while $S_1(x(t+1)) = S_1(x(t)) = y(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $S_2$, the two bounds moving at the same time are promising, and a standard variable change shows the time invariance. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-14T16:25:55.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25262" PostTypeId="2" ParentId="23413" CreationDate="2015-08-14T21:45:52.443" Score="-1" Body="&lt;p&gt;The ripple you see is due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Gibbs_phenomenon&quot; rel=&quot;nofollow&quot;&gt;Gibbs phenomenon&lt;/a&gt; and is caused by your filter having a step response. You will have to pass the frequency response through a &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window function&lt;/a&gt; first.&lt;/p&gt;&#xA;" OwnerUserId="17008" LastActivityDate="2015-08-14T21:45:52.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25263" PostTypeId="1" CreationDate="2015-08-15T00:28:41.997" Score="2" ViewCount="580" Body="&lt;p&gt;I have been a student of Image Processing for 3 years now and have been using C++ as the programming language to implement different Image processing operations. But I don't really why in particular C++ is so popular for Image processing rather than other languages like Java and C-sharp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please explain why C++ is so popular for image processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6990" LastActivityDate="2015-08-15T15:15:10.370" Title="Why is C++ so popular for Image Processing?" Tags="|image-processing|c++|" AnswerCount="1" CommentCount="1" ClosedDate="2015-08-17T18:59:57.577" ContentLicense="CC BY-SA 3.0" />
  <row Id="25264" PostTypeId="2" ParentId="25225" CreationDate="2015-08-15T00:46:52.397" Score="1" Body="&lt;p&gt;I figured out the problem. But there is one constraint&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) The scaling factor for the entire matrix has to be the same number to do the process efficiently&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the way correlation is done, is multiplication and accumulation of two matrices, take for example the image matrix below correlated with the signal, and the result is from the valid part of the correlation, as in no zero padding is done&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image        signal    scaling constant = 3&#xA;1  2  3      9 4&#xA;4  5  6      3 4&#xA;&#xA;result[1] = (1*9+2*4+4*3+5*4)/3 = 16.3333&#xA;result[2] = (2*9+3*4+5*3+6*4)/3 = 23&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I want to scale before the correlation, I would have to scale the whole correlation window, like so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image              signal    scaling constant = 3&#xA;1/3  2/3  3/3      9 4&#xA;4/3  5/3  6/3      3 4&#xA;&#xA;result[1] = ( (1/3)*9+(2/3)*4+(4/3)*3+(5/3)*4 ) / 3 = 16.3333&#xA;result[2] = ( (2/3)*9+(3/3)*4+(5/3)*3+(6/3)*4 ) / 3 = 23&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After scaling like above, I could alternatively go to fourier domain with the image and the signal and do correlation there, do ifft, and I still get the same results.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image              signal    scaling constant = 3&#xA;1/3  2/3  3/3      9 4&#xA;4/3  5/3  6/3      3 4&#xA;&#xA;image_fourier=fft2(image,4,6);   zero padding&#xA;signal_fourier=fft2(signal,4,6);   &#xA;result=ifft2(image_fourier.*conj(signal_fourier));&#xA;&#xA;NOTE: above is matlab syntax&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;result[1] = 16.3333&lt;br&gt;&#xA;result[2] = 23;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this will not work if the scaling factor is different for result[1] and result[2]. &lt;/p&gt;&#xA;" OwnerUserId="16673" LastActivityDate="2015-08-15T00:46:52.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25265" PostTypeId="1" CreationDate="2015-08-15T10:57:26.293" Score="1" ViewCount="143" Body="&lt;p&gt;I have tried to solve, but do not know if the answer is correct or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A person has a periodic voltage input to a circuit. The input repeats itself every 0.02 seconds i.e. the fundamental period is 0.02 seconds.&#xA;The person measures the input with a voltmeter and finds that the input may be approximated by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Vin(t) = V0*exp(a*t) ; 0 sec &amp;lt;= t &amp;lt; 0.02 sec ;  V0= 2 Volts a = -100sec^-1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graphically the function may be represented by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZKJkn.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZKJkn.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;A)Write a mathematical expression containing an integral that may be used for calculation of the Fourier-coefficients of Vin(t). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;B)Evaluate the integral analytically for the DC-term (often referred to as c0 ). Looking at the graph, how can you check if your answer is reasonable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I need to use these formulas:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dLikR.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dLikR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to calculate a0 and here I got approx 2, &#xA;according to this matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v0 = 2;&#xA;a = (-100^-1)&#xA;T = 0.02&#xA;a_0 = (1/T)*int((v0*exp(a*t)),t,0,T)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;a0&lt;/code&gt; calculated to &lt;code&gt;1.9998&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I stuck with the an and bn, because i'm not sure if that is correct or not...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;an = ((2/T)*int((v0*exp(a*t))*cos(n*w0*t),t,0,T))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;an&lt;/code&gt; calculated to &lt;code&gt;(20000*exp(-1/5000)*(exp(1/5000) - 1))/(100000000*pi^2 + 1)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bn = (2/T)*int((v0*exp(a*t))*sin(n*w0*t),t,0,T)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;bn&lt;/code&gt; calculated to &lt;code&gt;(200000000*pi*exp(-1/5000)*(exp(1/5000) - 1))/(100000000*pi^2 + 1)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="17010" LastEditorUserId="8202" LastEditDate="2015-08-17T09:29:57.447" LastActivityDate="2015-08-17T13:14:42.973" Title="Fourier series calculation" Tags="|matlab|fourier|fourier-series|" AnswerCount="1" CommentCount="1" ClosedDate="2015-08-17T19:00:14.443" ContentLicense="CC BY-SA 3.0" />
  <row Id="25266" PostTypeId="2" ParentId="12871" CreationDate="2015-08-15T11:26:51.560" Score="1" Body="&lt;p&gt;I would suggest using &lt;a href=&quot;https://en.wikipedia.org/wiki/Deep_learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep Learning&lt;/a&gt; and especially convolutional neural networks. This might be a generic approach to large scale classification tasks. One such example is identifying faces. As an example, 10.000 classes have been tackled by Sun et. al. in the following : &lt;a href=&quot;http://ieeexplore.ieee.org/document/6909640/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://ieeexplore.ieee.org/document/6909640/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And iterative learning is of course supported.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2018-01-02T13:37:35.283" LastActivityDate="2018-01-02T13:37:35.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25267" PostTypeId="2" ParentId="25263" CreationDate="2015-08-15T15:15:10.370" Score="1" Body="&lt;p&gt;At the &quot;dawn&quot; of modern image processing/computer vision, C++ had the best combination of speed and industry support (meaning tools, libraries, etc and infrastructure to support them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OpenCV is natively written in C++, look at the &lt;a href=&quot;http://opencv.org/about.html&quot; rel=&quot;nofollow&quot;&gt;OpenCV about page&lt;/a&gt;, and you can quickly get a sense for these historical currents.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-08-15T15:15:10.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25268" PostTypeId="2" ParentId="25249" CreationDate="2015-08-15T15:38:32.363" Score="4" Body="&lt;p&gt;As the author of a few AUs/VSTs an AU hosting app, I'll chime in here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is usually no phase alignment of signals passed through effects processing (AU/VST)&lt;/li&gt;&#xA;&lt;li&gt;The &quot;latency&quot; of the effect is normally reported by the effect to the &quot;hosting&quot; environment on initialization. This way the hosting app can keep all channels in sync (i.e &quot;wait&quot; until all effects have returned the same time-range of audio before mixing, etc). Core Audio SDK &lt;a href=&quot;https://developer.apple.com/library/mac/documentation/MusicAudio/Conceptual/AudioUnitProgrammingGuide/TheAudioUnit/TheAudioUnit.html&quot; rel=&quot;nofollow&quot;&gt;states&lt;/a&gt; that AUs should implement this property &lt;strong&gt;kAudioUnitProperty_Latency&lt;/strong&gt; if their latency is &gt; 0 seconds.&lt;/li&gt;&#xA;&lt;li&gt;Sometimes effects do not report their latency to the host app, so there are tools like &lt;a href=&quot;http://www.voxengo.com/product/latencydelay/&quot; rel=&quot;nofollow&quot;&gt;Voxengo&lt;/a&gt; to work around that problem.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If the hosting environment doesn't have an automatic way to handshake &amp;amp; compensate for latency, then its compensation is a manual affair. For example Ableton Live has a &lt;a href=&quot;https://www.ableton.com/en/manual/working-with-instruments-and-effects/&quot; rel=&quot;nofollow&quot;&gt;feature&lt;/a&gt; (17.5 Device Delay Compensation) to help work around these timing issues.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="11372" LastEditDate="2015-08-15T22:58:06.427" LastActivityDate="2015-08-15T22:58:06.427" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25270" PostTypeId="1" CreationDate="2015-08-15T19:59:26.713" Score="1" ViewCount="89" Body="&lt;p&gt;Can you simulate the &quot;response time&quot; of a lower window size FFT on a higher window size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, is it possible to calculate the equivalent lower window sized FFTs from a higher one in order to iterate over the equivalent e.g. 128 window sized FFTs, but plot the higher one e.g. 8192 samples window size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a problem in e.g. when one is sampling at a higher window size for the FFT, but some signal parts (e.g. strong amplitude peaks in audio) appear at a faster pace and are thus &quot;missed&quot; by the FFT. Or not necessarily the FFT, but any processing that uses that higher window size FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I therefore need is the visible resolution of a higher window size and the faster response of a lower window size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My application (in audio) requires me to be able to track frequencies that follow closely to the beats of the audio. If e.g. a drum loop plays at a high bpm, then a 8192 samples FFT might be too slow to be done reading form since it changes slower than the drum loop's frequencies.&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-08-15T21:46:12.160" LastActivityDate="2016-07-05T15:37:33.907" Title="Can you simulate the &quot;response time&quot; of a lower window size FFT on a higher window size?" Tags="|fft|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25271" PostTypeId="2" ParentId="25231" CreationDate="2015-08-15T23:03:55.753" Score="1" Body="&lt;p&gt;I would say skip MATLAB and learn more about the published frequency responses by looking up your mics here: &lt;a href=&quot;http://recordinghacks.com/microphones&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://recordinghacks.com/microphones&lt;/a&gt;. There are hundreds of mic models with responses as such:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nwwUe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nwwUe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-08-15T23:03:55.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25272" PostTypeId="2" ParentId="24706" CreationDate="2015-08-16T00:52:43.337" Score="3" Body="&lt;p&gt;You must zero-pad, whether implementing the delay in the time domain or the frequency domain. (Consider this: by delaying, you are making the signal &lt;em&gt;longer&lt;/em&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementing the delay with the FFT implements a circular shift. If you don't pad and you use the FFT, the data will simply wrap around on itself. (Imagine that if you didn't zero pad and used the FFT with $\tau = NT$, the duration of the record length. Then you would simply get back what you started with, with no delay, because of circular wrapping.) If you want only an integer number of sample delays, do it in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a fractional sample delay, you can use the FFT as you describe. It makes no difference mathematically if you implement say a 20.7 sample delay first in time by 20 samples and then in frequency by 0.7 samples, or whether you do it all in frequency by 20.7 samples. Remember—you padded first. Computationally, as you say, this can increase computation time. But you are only increasing the length by a factor of four so computation time with an FFT should increase by a factor of only two. Is this too much? Alternatively, you can do the &quot;bulk&quot; delay in time and the fractional delay in frequency. In the frequency part, you have a couple of choices. First, before doing the bulk time delay, you can do the fractional delay on the original unpadded data and accept the fractional-sample delay wrap-around error at the beginning of the sequence. Second, you can pad your data by only one sample and do the fractional shift with an FFT. If your FFT software accepts only powers-of-two record lengths and your original record length is a power of two, this will likely slow your computation by more than a factor of two because a fast algorithm is not employed. However, most modern FFT packages provide fast algorithms for sequence lengths that can be factored into products of small prime numbers, so adding one data point might not significantly increase computation time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some have suggested alternatively using an interpolater for a fractional shift. The FFT is the ideal interpolater—it exactly interpolates bandlimited data when zero padding without adding a delay exponential or when your delay exponential is added. However, cubic splines are outstanding interpolators and should be in your toolbox.&lt;/p&gt;&#xA;" OwnerUserId="17012" LastActivityDate="2015-08-16T00:52:43.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25274" PostTypeId="1" CreationDate="2015-08-16T01:49:56.893" Score="1" ViewCount="58" Body="&lt;p&gt;I want to read waves with an electret consender microphone that are slower than the speed of sound, and I figure it would make those waves easier to identify if I could process out all waves moving around the speed of sound (give or take maybe 20 m/s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: I read that someone did this by &quot;k-space filtering&quot;. Is there an easy way to learn how to do this? I'm looking for an acoustic application but most stuff I can find on the internet has to do with MRIs.&lt;/p&gt;&#xA;" OwnerUserId="17014" LastEditorUserId="17014" LastEditDate="2015-08-16T17:19:02.883" LastActivityDate="2015-08-16T17:19:02.883" Title="Using K-Space Filtering to Filter by Speed" Tags="|frequency|sound|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25276" PostTypeId="2" ParentId="24052" CreationDate="2015-08-16T05:42:06.783" Score="1" Body="&lt;p&gt;What you want to do is &lt;a href=&quot;https://www.google.com/#q=timbre+recognition&quot; rel=&quot;nofollow&quot;&gt;timbre recognition&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-08-16T05:42:06.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25277" PostTypeId="1" CreationDate="2015-08-16T09:47:30.080" Score="1" ViewCount="472" Body="&lt;p&gt;I have some FFT data, 257 dimensions, every 10 ms, with 121 frames, i.e. 1.21 secs. I think the first dimension is probably something else and the remaining are the FFT coefficients, I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, I want to calculate back some PCM signal for 44.1 Hz so I can play the sound. I asked the &lt;a href=&quot;https://math.stackexchange.com/questions/1399062/sound-fft-data-to-pcm-data&quot;&gt;same question in a more mathematical way here&lt;/a&gt; but maybe here is a better place because I actually want to implement this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I do that? Maybe I need some more information (which I have to find out somehow) - which? Maybe these missing information can be intelligently guessed somehow? What is a likely interpretation of those 257 dimensions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question is about the theory. The implementation is trivial I guess. But a concrete example in some language would be nice to help understanding the theory. Maybe C++ with FFTW? I skipped through the FFTW docs but I fail to understand all the terminology and some background, e.g. &lt;a href=&quot;http://www.fftw.org/fftw3_doc/One_002dDimensional-DFTs-of-Real-Data.html#One_002dDimensional-DFTs-of-Real-Data&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Why is it from complex to real or the other way, I only want real to real. What are those REDFT? What's a DCT, DFT, DST? FFTW_HC2R?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(I asked mostly the same question on SO &lt;a href=&quot;https://stackoverflow.com/questions/32027972/convert-fft-to-pcm&quot;&gt;here&lt;/a&gt;, but that was intended to be more about the practical side. Here on DSP I want to ask about the theory to get some understanding.)&lt;/p&gt;&#xA;" OwnerUserId="17016" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2015-08-16T09:47:30.080" Title="sound FFT data to PCM data" Tags="|fft|ifft|stft|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25278" PostTypeId="1" CreationDate="2015-08-16T15:00:43.507" Score="1" ViewCount="1567" Body="&lt;p&gt;I have not used Simulink extensively. I would like to know how to determine if a model is fixed-point or floating-point. Also, how to convert from fixed-point [back] to floating-point. The posts on the internet mostly discuss floating-point to fixed-point conversion. I need fixed-point to floating-point to learn and be able to use both floating-point and fixed-point models.&lt;/p&gt;&#xA;" OwnerUserId="16612" LastActivityDate="2015-08-18T11:54:34.157" Title="Simulink Floating-Point and Fixed-Point Modeling" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25280" PostTypeId="2" ParentId="22412" CreationDate="2015-08-16T16:01:35.720" Score="1" Body="&lt;p&gt;Weighting is a common approach to control the importance per pixel. In other words, one might require or desire different importance for different pixels. Then, the 50% percentile is estimated via taking the weights into account. Instead of treating each pixel equally, the sorting function is tweaked to consider the weights. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine, we want to process pixel $p$ in image $I$, in the neighborhood $R(p)$. The radius of this local window $R$ is $r$. Number of pixels in such locality is $(2r+1)^2$. For each neighbor $q \in R(p)$, a weight $w_{pq}$ is associated. The typical choice of weighting is the affinity  of $p$ and $q$ in the feature map $\mathbf{f}$, which can be any feature, but in general selected to be intensity, color and etc. So we write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$w_{pq}=g(\mathbf{f}(p), \mathbf{f}(q))$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A reasonable choice for function $g$ is Gaussian (common preference for affinity measures): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$g=exp(-\frac{\lVert \mathbf{f}(p)-\mathbf{f}(q) \rVert}{\sigma^2})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The weighted median operates as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p^*=\min{k}$ s.t. $\sum\limits_{q=1}^k w_{pq} \geq \frac{1}{2}\sum\limits_{q=1}^n w_{pq}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that for all pixels before the median point $p^*$, the sum is roughly half of all weights summed together.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-08-16T16:01:35.720" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25281" PostTypeId="1" CreationDate="2015-08-16T18:49:54.527" Score="2" ViewCount="4454" Body="&lt;p&gt;I need an audio processing library/API (in any programming language, preferably Java or Python) that is able to do things to sound waves such as: sum/mix sources together, apply EQ, dynamic EQ where you can change a frequency peak or amplitude setting over time, pitch shift, distortion, and convolution reverb, all programmatically without any need for a user interface. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone asked &quot;If there were, why would there be a market for premium commercial DAW software?&quot; Obviously this wouldn't be for the actual music-making composer or sound engineer because it would be unusable (it wouldn't have a GUI). I need it to automatically manipulate sound so I can churn out millions of random not-necessarily-musical sound files, without a GUI. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not same as the &quot;OpenCV for audio&quot; question, because I don't need intelligent audio feature extraction; I just need the standard features of DAW such as EQ and convolutional reverb, available as an API call, like soundFile.applyEq(myEq).applyConvReverb(myReverb);&lt;/p&gt;&#xA;" OwnerUserId="15638" LastEditorUserId="13320" LastEditDate="2018-06-10T10:50:22.337" LastActivityDate="2018-06-10T10:50:22.337" Title="Is there an audio processing library/API that contains all standard features of a digital audio workstation?" Tags="|audio|" AnswerCount="1" CommentCount="1" ClosedDate="2018-06-02T20:23:01.067" ContentLicense="CC BY-SA 3.0" />
  <row Id="25282" PostTypeId="1" AcceptedAnswerId="25295" CreationDate="2015-08-16T19:09:04.083" Score="1" ViewCount="867" Body="&lt;p&gt;This is a fairly standard belief in the audio production scene that cutting EQ is somehow &quot;cleaner&quot; than boosting EQ. You hear arguments like there being different phase characteristics or whatever. The more careful arguers refer to psychoacoustics (that it's easier to listen to the effects of cuts, rather than boosts).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, is there a difference in the filter in terms of cutting and boosting? And which one is &quot;cleaner&quot;?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2015-11-16T09:16:55.117" Title="Is cutting EQ scientifically different than boosting EQ?" Tags="|filters|audio|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25283" PostTypeId="2" ParentId="25270" CreationDate="2015-08-17T00:07:04.737" Score="1" Body="&lt;p&gt;No. The time of accumulation will determine the resolution of frequencies - how far are measures separated.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-08-17T00:07:04.737" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25285" PostTypeId="2" ParentId="25281" CreationDate="2015-08-17T04:51:26.293" Score="1" Body="&lt;p&gt;For python, I'd try out: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://pydub.com&quot; rel=&quot;nofollow&quot;&gt;pydub&lt;/a&gt; for basic audio manipulation and arrangement (slicing, concatenation, fading, repeating, etc). &lt;/li&gt;&#xA;&lt;li&gt;For effects processing, &lt;a href=&quot;http://ajaxsoundstudio.com/software/pyo/&quot; rel=&quot;nofollow&quot;&gt;pyo&lt;/a&gt; is a good python signal processing module with a musical focus. Here's a comprehensive &lt;a href=&quot;http://www.matthieuamiguet.ch/blog/diy-guitar-effects-python&quot; rel=&quot;nofollow&quot;&gt;review&lt;/a&gt;, with inline clips. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Together you should be able to get good coverage of most DAW functions. There are also fantastic python audio libraries like &lt;a href=&quot;https://github.com/bmcfee/librosa&quot; rel=&quot;nofollow&quot;&gt;librosa&lt;/a&gt;, in case you do decide to do any feature extraction or audio analysis. Good luck!&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-08-17T04:51:26.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25287" PostTypeId="2" ParentId="25265" CreationDate="2015-08-17T13:14:42.973" Score="1" Body="&lt;p&gt;Hint: this is a lot easier if you use the Euler formula &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Euler%27s_formula&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the integral simply becomes&#xA;$$X(n)=\frac{1}{L}\int_{0}^{2L}e^{(-a+i\omega)\cdot t}, a_{n}=real[X(n)], b_{n} = imag[X(n)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is pretty straight forward to solve&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-08-17T13:14:42.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25288" PostTypeId="2" ParentId="17685" CreationDate="2015-08-17T13:24:24.197" Score="8" Body="&lt;p&gt;In the transition to digital formats, audio were stored in a pseudo-video waveform that could be seen as either black or white (representing the binary format).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field rate and structure used by the television standard is as follows for 60 Hz video: 245 lines per field (excluded the first 35 blanked lines). With three samples per line that makes 60 x 245 x 3 = 44100 = 44.1 KHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This convention were later used for the CD format, due to equipment compatibility concerns (the very first equipment used to produce CD masters used for CD replication was video based).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://books.google.dk/books?id=soTOAwAAQBAJ&amp;amp;pg=PA228&amp;amp;dq=8.5%20Choice%20of%20sampling%20rate&amp;amp;hl=da&amp;amp;sa=X&amp;amp;ved=0CCgQ6AEwAGoVChMIlq6iopuwxwIVw9csCh17rAt1#v=onepage&amp;amp;q=8.5%20Choice%20of%20sampling%20rate&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;The Art of Sound Reproduction, p. 228&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17029" LastActivityDate="2015-08-17T13:24:24.197" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25289" PostTypeId="1" CreationDate="2015-08-17T13:36:23.187" Score="0" ViewCount="42" Body="&lt;p&gt;I am using Quartus 12.1 sp1, vhdl and Altera Nios II programmed in C code for DE0-Nano Development. Basically, what I have is, data is sent from fpga vhdl block to NIos II system, Nios II system sends the data to serial port, Matlab access the serial port to real time plot the graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my system, the rate the graph is plotted is much slower (11Hz) than the rate the processor speed (50MHZ). So I do some buffering and send the data for plotting afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am buffering data received from fpga vhdl say 1000 sample points and save it in sdram... after saving these 1000 sample points, the C code will send data to uart so that Matlab can access these serial port data and plot the graph real time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please refer to this image:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/sD6SS.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sD6SS.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is, a complete cycle of sinewave obtained from fpga is with a frequency of 50Hz, so it should be having a period of 0.02 seconds instead of 0.16 minutes as I got now, I don't know what could be the problem? Forgive me, I am newbie to signal processing.. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int max_sample = 1000; //number of sample points wanted&#xA;&#xA;if (a_out_data==1) //check if it is the beginning of a sinusoidal waveform?&#xA;{&#xA;&#xA;for(i=0;i&amp;lt;max_sample;i++)//start the process of buffering data&#xA;        {&#xA;vref_data = IORD_ALTERA_AVALON_PIO_DATA(vref_base); //read a single value of reference voltage from fpga&#xA;*(pSDRAM+i) =vref_data; //save this single value in a location of SDRAM specified in SDRAM_U1_BASE&#xA;        } &#xA;}&#xA;&#xA;&#xA;for(i2=0;i2&amp;lt;i;i2++) //start the process of sending data to uart for all data saved previously&#xA;    {&#xA;        data16=*(pSDRAM+i2); //access each value from SDRAM&#xA;&#xA;        //send data to uart before increment i++&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT: I posted the Matlab code here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max_packets = 20000; %maximum number of packets to keep in memory (all are saved to log file)&#xA;    update_plot = 1; %how often we should update the plot&#xA;    plot_length = 12; %maximum length of plot&#xA;    figure('Position', [10, 50, 900, 900]); % new figure&#xA;    ax1 = subplot(3,1,1); % top subplot&#xA;    ax2 = subplot(3,1,2); % bottom subplot&#xA;    ax3 = subplot(3,1,3);&#xA;    drawnow;&#xA;    s = serial(port);&#xA;    cleanupObj = onCleanup(@()cleanupFunc(s)); %clean-up function&#xA;    set(s,'BaudRate',115200,'timeout',2); %timeout is in seconds &#xA;    fopen(s);&#xA;    vref= NaN(12,max_packets);&#xA;    j = 0;&#xA;    tic; %start timer&#xA;    while 1; %do forever...&#xA;          if j &amp;lt; max_packets&#xA;          j = j+1;&#xA;      else&#xA;          fprintf('\n Buffer full, reset to 0\n');&#xA;          j = 1; %reset counter to stop memory overflow&#xA;      end    &#xA;        %get data line by line &#xA;        line = fscanf(s);&#xA;        [c,vo] = disect_line(line);&#xA;        if c == 1 %start recording from set 1 &#xA;            vref(1,j) = vo; &#xA;            for i = 2:12 %get set 2 to 12&#xA;                line = fscanf(s);&#xA;                [c,vo] = disect_line(line);&#xA;                if c == i&#xA;                    vref(i,j) = vo;&#xA;                else&#xA;                    fprintf('\nError\n');&#xA;                end&#xA;            end&#xA;           dlmwrite(logfile,[toc  vref(:,j).' ],'delimiter',',','-append'); %save data from all 12 sets to csv file&#xA;       update plot1 every update_plot packets, and after we have at least 2 data points (otherwise we get errors)&#xA;          if mod(j, update_plot)==0 &amp;amp;&amp;amp; j&amp;gt;1  &#xA;              if j &amp;lt; plot_length&#xA;                  start = 1;&#xA;              else&#xA;                  start = j-plot_length+1;&#xA;              end    &#xA;           plot(ax1, start:j, vref(1,start:j).');&#xA;                for k = 1:1&#xA;                    text(j, vref(k, j), num2str(k), 'Parent', ax1);&#xA;                end&#xA;                xlim(ax1, [start j]);&#xA;                ylabel(ax1, 'Vref');&#xA;                title(ax1, ['Time elapsed = ' num2str(toc) ' s']);   &#xA;    end&#xA;    end&#xA;    function [c, vo]  = disect_line(line)&#xA;    c = str2double(line(1:2)); %set number&#xA;    vo = str2double(line(4:7));&#xA;    end&#xA;    function cleanupFunc(s)&#xA;    fprintf('\nClosed serial port.\n')&#xA;    fclose(s);&#xA;    delete(s);&#xA;    clear s;&#xA;    end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17030" LastEditorUserId="17030" LastEditDate="2015-08-18T08:39:43.657" LastActivityDate="2015-08-18T08:39:43.657" Title="Received waveform frequency is way too low than it was sent" Tags="|sampling|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25291" PostTypeId="2" ParentId="25282" CreationDate="2015-08-17T14:03:37.253" Score="1" Body="&lt;p&gt;As a live sound engineer I know this saying all too well. I don't really think it has to do with the actual design of the EQ. Rather it is the overall practical consequence it has on cumulative gain and definition of the mix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Passive analogue EQ designs actually work by attenuation and a final makeup gain step. So in that sense you never really boost a certain frequency - you attenuate it less than the other bands. Others truly boost a specific area by first splitting the bands, then amplify and sum. The actual filter designs have great impact on how linear the device is in the end and would have a great influence on that old &quot;never-boost-always-cut&quot; saying. In active EQ designs there are other reasons such as phase displacements (for additional info on passive and active designs see &lt;a href=&quot;https://www.soundonsound.com/sos/jul07/articles/qa0707_4.htm&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, I think the old saying is rather related to gain and clarity/definition of the whole as such. Typically you would set the input gain and monitor the levels so the signal is in the safe range, perhaps make a few local EQ adjustments (local in the sense that you set these band levels listening to the source isolated). Then when the first round of getting things through the board is done, you start making the more creative interrelated adjustments. But at this point you are already done with the first gain round, and EQ boost could make the signal go too hot and this tendency builds up across the channels.&#xA;The other point about clarity and definition is simply this: do not add what you need - remove what you &lt;em&gt;do not&lt;/em&gt; need. While that makes good sense when tweaking a channel isolated, it is a rather useless point if you need additional high end on a channel compared to the rest: you'd have to lower the top on all other channels ;-)&lt;/p&gt;&#xA;" OwnerUserId="17029" LastEditorUserId="17029" LastEditDate="2015-10-17T08:45:33.010" LastActivityDate="2015-10-17T08:45:33.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25292" PostTypeId="1" AcceptedAnswerId="25293" CreationDate="2015-08-17T15:06:44.200" Score="0" ViewCount="248" Body="&lt;p&gt;I am generating a DQPSK waveform at complex base band with constellation points on the unit circle and when I add AWG noise the constellation shrinks.  The noisy constellation &quot;blob&quot; migrate inside the unit circle.  My question is why is this happening and is it supposed to happen or am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My method of adding noise is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Xnoise = X + sigma/2 * (randn(N) + 1j*randn(N))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where sigma is the overall standard deviation for the noise.  It's being divided by 2 since I'm using two separate randns for the real and imag parts and the two Gaussians added together give me the correct variance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gLagB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gLagB.png&quot; alt=&quot;Ideal DPSK&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CElc8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CElc8.png&quot; alt=&quot;Noisy DPSK Eb/N0=14&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16489" LastActivityDate="2015-08-17T15:37:28.760" Title="Why does DPSK constellation shrink when noise is added?" Tags="|noise|digital-communications|modulation|qpsk|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25293" PostTypeId="2" ParentId="25292" CreationDate="2015-08-17T15:37:28.760" Score="3" Body="&lt;p&gt;It looks like your circle got bigger. The constellation is fine.&lt;/p&gt;&#xA;" OwnerUserId="3434" LastActivityDate="2015-08-17T15:37:28.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25294" PostTypeId="1" CreationDate="2015-08-17T15:51:42.743" Score="4" ViewCount="1727" Body="&lt;p&gt;I'm trying to emulate a tape delay in a VST plugin, but I'm not sure how to handle the delay changing? I want it to sound like a tape is actually fast forwarding/rewinding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most digital delays I've looked at have two taps and they set one to the new delay time and crossfade between them. It doesn't really sound like anything.&#xA;I tried changing the delay over 40ms, by linearly moving from the old delay time to the new delay time, but that sounds very artificial. I figure the tape actually needs to accelerate and then decelerate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried different functions instead of linear for moving the delay time, including sine and quadratic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like it to sound like the tape delay in Logic Pro. Any idea what they are doing when the delay changes?&lt;/p&gt;&#xA;" OwnerUserId="4274" LastActivityDate="2015-08-18T16:45:23.933" Title="Emulate tape delay" Tags="|audio|delay|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25295" PostTypeId="2" ParentId="25282" CreationDate="2015-08-17T15:56:53.033" Score="2" Body="&lt;p&gt;There is a very compelling reason for preferring cutting over boosting. Assuming you are using the typical bell-response parametric EQ bands, then you will see a significant phase distortion around the resonant frequency, i.e. the frequency you're boosting or attenuating. (There is an exception to this rule: Linear phase EQs that are often used for mastering do not show this phenomenon. Those only exist as digital implementations however and have other problems.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most noticable effect of the phase distortion is that it comes with a certain group delay around the resonant frequency, and especially narrow changes can result in audible post-ringing and temporal distortion of transients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you're boosting what you want to hear more, you introduce this kind of problem exactly in the band that you want to give more prominence. Cutting also introduces the same issues, but you usually cut what you don't want to hear as prominently. So cutting will move the phase artefacts to the sonically less important frequency range while boosting will place it right where you don't want it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the theory at least. In practice, the rule can be relaxed in most cases. The negative effects of resonant phase distortion greatly depend on the derivative of the phase response with respect to the frequency. That means that resonances with very small bandwidth will result in greater issues than wide band resonances. And this is absolute bandwidth, not relative bandwidth. This means for a typical EQ band that has a bandwidth proportional to the center frequency (&quot;constant-Q filter&quot;), the bandwidth automatically gets larger for higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a bell EQ at a few kHz will have a large bandwidth, even if it has a rather high resonance. Therefore cutting vs boosting doesn't make a huge difference for higher frequencies. It does however get relevant for frequencies in the lower mid and the bass range, especially when you're using high Q-factors.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-08-17T15:56:53.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25299" PostTypeId="1" AcceptedAnswerId="26183" CreationDate="2015-08-18T01:49:27.627" Score="3" ViewCount="143" Body="&lt;p&gt;Given an $n$-vector $y$ (responses) and a design matrix $X$, I wish to fit them with a simple linear regression model&#xA;$$y=X\beta+e,$$ or,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_t = x_t'\beta_0 + e_t$&#xA;where $e\sim\mathcal{N}(0, \sigma^2I)$ and $\beta_0$ is the true parameter. Then, we have &#xA;$$y\sim\mathcal{N}(X\beta, \sigma^2I).$$&#xA;Then the maximum likelihood estimations (MLE) of $\beta$ which is the Ordinary Least Square estimator is&#xA;$$\hat\beta_n=(X_n^TX)^{-1}X_n^TY_n$$. Then how to calculate the Expectation of the variance of the estimation error viz. $E[(\hat{\beta_n} - \beta_0){(\hat{\beta_n} - \beta_0)}^T]$ . I am struggling to understand what to substitute for $\beta_0$ in this calculation and how to find the expression. Any help will be extremely useful. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="128" LastEditDate="2019-06-26T08:55:42.857" LastActivityDate="2019-06-26T08:55:42.857" Title="What is the Technique to Find Variance of Estimation Error" Tags="|estimation|least-squares|covariance|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25301" PostTypeId="2" ParentId="24052" CreationDate="2015-08-18T06:10:21.290" Score="-1" Body="&lt;p&gt;I think this is a bigger task than &quot;a little script&quot;, but could be done with some determination.  I've had the same idea over the years, and this is how I'd go about it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd be working with individual tracks of reference instruments, and would build an 'overtone array' of the relative power of the overtones as compared to the fundamental frequency.  You would also need to write a script to detect the fundamental frequency, of course.  Other features would also be of interest like attack and sustain characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you had that information for all of your reference instruments, you would take the same measurements of a new recording and compare it to your reference overtone arrays and other characteristics, and output whichever one it is most similar to.&lt;/p&gt;&#xA;" OwnerUserId="17038" LastActivityDate="2015-08-18T06:10:21.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25302" PostTypeId="2" ParentId="23166" CreationDate="2015-08-18T06:31:17.993" Score="0" Body="&lt;p&gt;To decode in real time either:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Use the audiorecorder object suggested inside MBaz and use it's methods inside a loop to get collections of samples to decode in real time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Take a look at this Simulink object &lt;a href=&quot;http://www.mathworks.com/help/dsp/ref/fromaudiodevice.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/dsp/ref/fromaudiodevice.html&lt;/a&gt; . It will output at the buffer size that you specify so that you can process it in real-time &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Learn how to use MATLAB directly with your hardware.&lt;/p&gt;&#xA;" OwnerUserId="17038" LastActivityDate="2015-08-18T06:31:17.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25304" PostTypeId="1" CreationDate="2015-08-18T09:51:39.943" Score="3" ViewCount="2970" Body="&lt;p&gt;I am working of FMCW radar. Below are all the parameters of FMCW radar. How can I Calculate the resolution of my radar&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Parameters            Values&#xA;Center frequency (fc)     70GHz&#xA;Bandwidth (BW)            40 GHz&#xA;Sampling frequency (fs)   10 MHz&#xA;Sweep time            0.2 ms&#xA;Number of periods    10 period&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17042" LastEditorUserId="21075" LastEditDate="2020-04-30T15:06:20.230" LastActivityDate="2023-01-29T21:22:35.120" Title="How to calculate resolution of radar?" Tags="|radar|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25305" PostTypeId="1" CreationDate="2015-08-18T10:00:29.040" Score="1" ViewCount="1473" Body="&lt;p&gt;Goodmorning,&#xA;I have to do a circle detection with android studio using opencv, i follow the example find in internet but it didn't work and i don't understand why, i'm new of android. Can someone help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code that I found in interent:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public class MainActivity extends Activity implements CvCameraViewListener2 {&#xA;private static final String    TAG = &quot;OpencvEsempio&quot;;&#xA;&#xA;private static final int       VIEW_MODE_RGBA              = 0;&#xA;private static final int       VIEW_MODE_HOUGH_CIRCLES     = 1;&#xA;private static final int       VIEW_MODE_CANNY             = 2;&#xA;private static final int       VIEW_MODE_HOUGH_LINES       = 5;&#xA;&#xA;private int                    mViewMode;&#xA;private Mat                    mRgba;&#xA;private Mat                    mIntermediateMat;&#xA;private Mat                    mGray;&#xA;&#xA;private MenuItem               mItemPreviewRGBA;&#xA;private MenuItem               mItemPreviewHoughCircles;&#xA;private MenuItem               mItemPreviewCanny;&#xA;private MenuItem               mItemPreviewFeatures;&#xA;&#xA;private CameraBridgeViewBase   mOpenCvCameraView;&#xA;&#xA;private BaseLoaderCallback  mLoaderCallback = new BaseLoaderCallback(this) {&#xA;    @Override&#xA;    public void onManagerConnected(int status) {&#xA;        switch (status) {&#xA;            case LoaderCallbackInterface.SUCCESS:&#xA;            {&#xA;                Log.i(TAG, &quot;OpenCV loaded successfully&quot;);&#xA;&#xA;&#xA;                System.loadLibrary(&quot;mixed_sample&quot;);&#xA;&#xA;                mOpenCvCameraView.enableView();&#xA;            } break;&#xA;            default:&#xA;            {&#xA;                super.onManagerConnected(status);&#xA;            } break;&#xA;        }&#xA;    }&#xA;};&#xA;&#xA;public MainActivity() {&#xA;    Log.i(TAG, &quot;Instantiated new &quot; + this.getClass());&#xA;}&#xA;&#xA;&#xA;@Override&#xA;public void onCreate(Bundle savedInstanceState) {&#xA;    Log.i(TAG, &quot;called onCreate&quot;);&#xA;    super.onCreate(savedInstanceState);&#xA;    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);&#xA;&#xA;    setContentView(R.layout.activity_main);&#xA;&#xA;    mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.circle_detection_cameraView);&#xA;    mOpenCvCameraView.setCvCameraViewListener(this);&#xA;}&#xA;&#xA;@Override&#xA;public boolean onCreateOptionsMenu(Menu menu) {&#xA;    Log.i(TAG, &quot;called onCreateOptionsMenu&quot;);&#xA;    mItemPreviewRGBA = menu.add(&quot;Preview RGBA&quot;);&#xA;    mItemPreviewHoughCircles = menu.add(&quot;Hough Circles&quot;);&#xA;    mItemPreviewCanny = menu.add(&quot;Canny&quot;);&#xA;    mItemPreviewFeatures = menu.add(&quot;Hough Line&quot;);&#xA;    return true;&#xA;}&#xA;&#xA;@Override&#xA;public void onPause()&#xA;{&#xA;    super.onPause();&#xA;    if (mOpenCvCameraView != null)&#xA;        mOpenCvCameraView.disableView();&#xA;}&#xA;&#xA;@Override&#xA;public void onResume()&#xA;{&#xA;    super.onResume();&#xA;    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, this, mLoaderCallback);&#xA;}&#xA;&#xA;public void onDestroy() {&#xA;    super.onDestroy();&#xA;    if (mOpenCvCameraView != null)&#xA;        mOpenCvCameraView.disableView();&#xA;}&#xA;&#xA;public void onCameraViewStarted(int width, int height) {&#xA;    mRgba = new Mat(height, width, CvType.CV_8UC4);&#xA;    mIntermediateMat = new Mat(height, width, CvType.CV_8UC4);&#xA;    mGray = new Mat(height, width, CvType.CV_8UC1);&#xA;}&#xA;&#xA;public void onCameraViewStopped() {&#xA;    mRgba.release();&#xA;    mGray.release();&#xA;    mIntermediateMat.release();&#xA;}&#xA;&#xA;public Mat onCameraFrame(CvCameraViewFrame inputFrame) {&#xA;    final int viewMode = mViewMode;&#xA;    WindowManager wm = (WindowManager) this.getSystemService(this.WINDOW_SERVICE);&#xA;    Display display = wm.getDefaultDisplay();&#xA;    int width = display.getHeight();&#xA;    int height = display.getWidth();&#xA;&#xA;    switch (viewMode) {&#xA;        case VIEW_MODE_HOUGH_CIRCLES:&#xA;            mRgba = inputFrame.rgba();&#xA;            Mat mGrayScale = new Mat(height + height / 2, width, CvType.CV_8UC1);&#xA;            Mat circles = new Mat();&#xA;&#xA;            int iCannyUpperThreshold = 100;&#xA;            int iMinRadius = 20;&#xA;            int iMaxRadius = 400;&#xA;            int iAccumulator = 100;&#xA;&#xA;            Imgproc.cvtColor(mRgba, mGrayScale, Imgproc.COLOR_RGB2GRAY, 4);&#xA;            Imgproc.HoughCircles(mGrayScale, circles, Imgproc.CV_HOUGH_GRADIENT,&#xA;                    1.0, mGrayScale.rows() / 8, iCannyUpperThreshold, iAccumulator,&#xA;                    iMinRadius, iMaxRadius);&#xA;&#xA;            if (circles.cols() &amp;gt; 0)&#xA;                for (int x = 0; x &amp;lt; circles.cols(); x++)&#xA;                {&#xA;                    double vCircle[] = circles.get(0,x);&#xA;&#xA;                    if (vCircle == null)&#xA;                        break;&#xA;&#xA;                    Point pt = new Point(Math.round(vCircle[0]), Math.round(vCircle[1]));&#xA;                    int radius = (int)Math.round(vCircle[2]);&#xA;&#xA;&#xA;                    Core.circle(mRgba, pt, radius, new Scalar(0,255,0), 3);&#xA;                    Core.circle(mRgba, pt, 3, new Scalar(0,0,255), 3);&#xA;                }&#xA;            break;&#xA;&#xA;        case VIEW_MODE_RGBA:&#xA;&#xA;            mRgba = inputFrame.rgba();&#xA;            break;&#xA;&#xA;        case VIEW_MODE_CANNY:&#xA;&#xA;            mRgba = inputFrame.rgba();&#xA;            Imgproc.Canny(inputFrame.gray(), mIntermediateMat, 80, 100);&#xA;            Imgproc.cvtColor(mIntermediateMat, mRgba, Imgproc.COLOR_GRAY2RGBA, 4);&#xA;            break;&#xA;&#xA;        case VIEW_MODE_HOUGH_LINES:&#xA;            mRgba = inputFrame.rgba();&#xA;&#xA;            Mat thresholdImage = new Mat(height + height / 2, width, CvType.CV_8UC1);&#xA;            Imgproc.cvtColor(mRgba, thresholdImage, Imgproc.COLOR_RGB2GRAY, 4);&#xA;&#xA;            Imgproc.Canny(thresholdImage, thresholdImage, 80, 100, 3,false);&#xA;&#xA;&#xA;            Mat lines = new Mat();&#xA;            int threshold = 50;&#xA;            int minLineSize = 20;&#xA;            int lineGap = 20;&#xA;&#xA;            Imgproc.HoughLinesP(thresholdImage, lines, 1, Math.PI/180, threshold, minLineSize, lineGap);&#xA;&#xA;&#xA;            for (int x = 0; x &amp;lt; lines.cols() &amp;amp;&amp;amp; x &amp;lt; 1; x++){&#xA;                double[] vec = lines.get(0, x);&#xA;                double x1 = vec[0],&#xA;                        y1 = vec[1],&#xA;                        x2 = vec[2],&#xA;                        y2 = vec[3];&#xA;                Point start = new Point(x1, y1);&#xA;                Point end = new Point(x2, y2);&#xA;&#xA;                Core.line(mRgba, start, end, new Scalar(255,0,0), 3);&#xA;            }&#xA;            break;&#xA;    }&#xA;&#xA;    return mRgba;&#xA;}&#xA;&#xA;public boolean onOptionsItemSelected(MenuItem item) {&#xA;    Log.i(TAG, &quot;called onOptionsItemSelected; selected item: &quot; + item);&#xA;&#xA;    if (item == mItemPreviewRGBA) {&#xA;        mViewMode = VIEW_MODE_RGBA;&#xA;    } else if (item == mItemPreviewHoughCircles) {&#xA;        mViewMode = VIEW_MODE_HOUGH_CIRCLES;&#xA;    } else if (item == mItemPreviewCanny) {&#xA;        mViewMode = VIEW_MODE_CANNY;&#xA;    } else if (item == mItemPreviewFeatures) {&#xA;        mViewMode = VIEW_MODE_HOUGH_LINES;&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;&#xA;//public native void FindFeatures(long matAddrGr, long matAddrRgba);}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it give me a lot of error, when i run it on my nexus 5 the application it's stopped. &#xA;Can someone help me please? thanks&lt;/p&gt;&#xA;" OwnerUserId="17041" LastActivityDate="2015-08-18T10:00:29.040" Title="Opencv circle detection android" Tags="|opencv|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25306" PostTypeId="2" ParentId="25278" CreationDate="2015-08-18T11:54:34.157" Score="1" Body="&lt;p&gt;The model is fixed point if it contains a single block with the data type setting &quot;fixdt()&quot;. If you want to override the fixed-point settings you should go in your Simulink model to Analysis then open &quot;Fixed-point Tool&quot;. There you should change &quot;Data Type Override&quot; from &quot;Use local settings&quot; to something else.&lt;/p&gt;&#xA;" OwnerUserId="17044" LastActivityDate="2015-08-18T11:54:34.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25307" PostTypeId="2" ParentId="25304" CreationDate="2015-08-18T13:25:36.050" Score="2" Body="&lt;p&gt;The range resolution is normally some fraction bandwidth of the pulse. The fraction will depend on how you measure it i.e. null to null, 3dB points, 6 dB points etc. Also the windowing (Hamming, Kaiser) used will reduce the resolution i.e. increase the number. For a chirp pulse with the bandwidth you stated the null to null width is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \delta r = \frac{c}{2BW}=\frac{3\cdot 10^8}{2\cdot  40\cdot 10^9 }=3.75 \cdot 10^{-3} \textrm{ m } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can reference the following links:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.acfr.usyd.edu.au/pdfs/training/sensorSystems/11%20High%20Range-Resolution%20Techniques.pdf&quot; rel=&quot;nofollow&quot;&gt;High Range Resolution Techniques&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www-ist.massey.ac.nz/conferences/icst05/proceedings/icst2005-papers/icst_111.pdf&quot; rel=&quot;nofollow&quot;&gt;Understanding Millimetre Wave FMCW Radars&lt;/a&gt;, &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.radartutorial.eu/01.basics/Range%20Resolution.en.html&quot; rel=&quot;nofollow&quot;&gt;Radar Basics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="90" LastEditDate="2015-08-18T14:05:38.197" LastActivityDate="2015-08-18T14:05:38.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25309" PostTypeId="1" CreationDate="2015-08-18T16:01:48.633" Score="3" ViewCount="7101" Body="&lt;p&gt;So I'm having some trouble conceptually and am hoping somebody can clear something up for me. This is long and I apologize for that but I want to provide as much information as possible so that the source of my confusion might be exposed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal with a sampling rate of $74767 { samples \over sec}$. I want to take the spectrogram in matlab of this signal but I'm really only interested in the content in the first $1\over2$ second. Now, if I throw out everything after 0.5 seconds and attempt to compute the spectrogram using the time-frequency tool box I've posted the link to below. (it's required I use this one) I run out of memory. To solve this I decided to keep only every $X$ samples so that I'm working with less data. This will effectively, I assume, lower my sampling frequency by a factor of $X$. That is to say then that I first throw away everything after 0.5 seconds, and then keep only ever $X^{th}$ sample. My total signal length is then equal to: $$N = {74767 \times 0.5 \over X}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My new sampling frequency should therefore be twice this value as that would be, hypothetically, the number of samples I would have collected in one second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f_s = 2 \times ({74767 \times 0.5 \over X}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having two issues however with this. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The first is that I'm slightly confused about the frequency resolution and number of bins for my spectrogram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to pass to the spectrogram calculation the number of frequency bins I want to calculate. I always pass it the length of the signal, which as discussed above is $N = {74767 \times 0.5 \over X}$. Now, I know that to plot this with the proper scale I need to know what my frequency resolution is per frequency bin. This is going to &lt;em&gt;always&lt;/em&gt; be 2 because the frequency resolution is: $$ freq_{res} = {f_s \over N} = {1 \over T}  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I've shown above, I reasoned this out, but it seems that if I increased $N$ and thereby sampled at a higher rate, then I would have more samples per second in a half-second time frame and my frequency resolution should be higher! I mean after all, if I'm looking from 0 to 0.5 seconds, and didn't have to divide by $X$ because of the memory limit, then why wouldn't I have a higher frequency resolution? I would have more samples!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The second issue I'm having trouble with is understanding the resolution of the spectrogram with respect to the number of frequency bins given by $N$. Clearly I can choose $X$ to vary $N$. As a test I included $N=3000$ and $N=8000$ below. As $N$ gets larger I start to lose precision in the frequency domain. This makes sense as I know the uncertainty principle tells us that there is a balance between precision in the frequency vs time domain. However, how do I know what a good value of $N$ is? My highest frequency content I really care about is the 25th harmonic ($60 Hz \times 25 = 1500 Hz$). Does that mean that I should perhaps choose a value of $X$ that makes my sampling frequency twice the Nyquist (in my case that would be $3000 Hz$). Doing that I get: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 3000 Hz = 2 \times ({74767 \times 0.5 \over X}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \therefore X = {{74767 \times 0.5} \over 1500 } \approx 25$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I plot that my localization in the frequency domain is great, but my localization in the time domain is pretty terrible, I've included a plain-text link screenshot of it below as well. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What then, is a good metric to decide on my localization in the time domain? And how do I reconcile the seeming contradiction above? Thank you for any help and/or advice.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;N = 3000&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F67ZF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F67ZF.png&quot; alt=&quot;N = 3000&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;N = 8000&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RR8mj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RR8mj.png&quot; alt=&quot;N = 8000&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;N = 1495. X = 25&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plain-text Link for image found here: &lt;strong&gt;i.stack.imgur.com/1HLTL.png&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I don't have enough Karma to post more than 2 links).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TFT Toolbox: tftb.nongnu.org/&lt;/p&gt;&#xA;" OwnerUserId="14943" LastEditorUserId="14943" LastEditDate="2015-08-19T04:05:46.677" LastActivityDate="2021-08-19T01:01:30.130" Title="Spectrogram, time vs frequency localization, and length of signal" Tags="|frequency-spectrum|time-frequency|spectrogram|stft|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25310" PostTypeId="2" ParentId="25294" CreationDate="2015-08-18T16:45:23.933" Score="4" Body="&lt;p&gt;From the KVR forum &lt;a href=&quot;http://www.kvraudio.com/forum/viewtopic.php?t=265070&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; above, dig in from this section:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a Tape or Bucket Brigade Delay is better emulated using a fixed delayline with a variable sampling-rate.  Classic digital delays typically modulate the length of the delay-line while, Tape and BBD modulate the speed to change the delay.&lt;/p&gt;&#xA;&lt;p&gt;It's similar to a guitar where to change pitch you can either change the length of the string or change its tension. The big advantage with modulating speed instead of position is that the delay changes are naturally smoothed/integrated/delayed by the delayline itself and that makes a huge difference sound-wise.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Regarding implementation, you'll want to write samples from your delay buffer (to your output buffer) at a fixed rate, but reading from it at interpolated/smoothed, variable rates. You'll need a good interpolation algorithm to minimize distortion (aliasing) during automation of delay times/params during playback.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-08-18T16:45:23.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25311" PostTypeId="1" CreationDate="2015-08-18T16:45:56.027" Score="0" ViewCount="522" Body="&lt;p&gt;I have an algorithm that looks at an audio frame, calculates a threshold in db-rms, and decides to filter the frame whether or not the threshold is crossed. However, filtering each block is producing discontinuities at the ends of the block. How can I rectify this? Is this an issue for overlap-add processing, and if so how can I get started with that?&#xA;Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrograph of audio clip (cropped poorly) before processing:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fiEgp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fiEgp.png&quot; alt=&quot;Before processing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OLA Spectrograph of audio clip (cropped poorly) after processing:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NHFvJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NHFvJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% file reading&#xA;filename = 'audio.wav';&#xA;[x,fs] = wavread(filename);&#xA;x = x(:,1);&#xA;xCopy = x;&#xA;&#xA;% constant filter&#xA;biQ{1} = dsp.BiquadFilter();&#xA;biQ{1}.SOSMatrix = cookEQ(fs,1000,-60,2,'lp').*0.2;&#xA;Zi = zeros(2,3);&#xA;&#xA;% window length and overlap&#xA;len = length(x);&#xA;blockLen = 256;          % window length&#xA;hop = floor((blockLen)/2);     % hop size&#xA;w = hamming(blockLen);  % window&#xA;output = zeros(len,1);&#xA;&#xA;% starting at hop to avoid if statement for first block&#xA;for pos=hop:hop:len-blockLen-hop&#xA;&#xA;    release(biQ{1});&#xA;    ndx = pos+1:pos+blockLen;      % current window location&#xA;    window1 = x(ndx-hop) .* w;&#xA;    [window1,Zi(:,1)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window1,Zi(:,1));&#xA;    window2 = x(ndx) .* w;&#xA;    [window2,Zi(:,2)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window2,Zi(:,2));&#xA;    window3 = x(ndx+hop) .* w;&#xA;    [window3,Zi(:,1)] = filter(biQ{1}.SOSMatrix(1:3),biQ{1}.SOSMatrix(4:6),window3,Zi(:,3));&#xA;&#xA;    firstHalf = window1(floor(length(window1)/2)+1:length(window1));&#xA;    secondHalf =  window3(1:floor(length(window1)/2));&#xA;    overlapAdder = [firstHalf ; secondHalf];&#xA;    output(ndx) = window2 + overlapAdder;&#xA;&#xA;end&#xA;&#xA;audiowrite([filename(1:end-4) '_ola.wav'],output,fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-08-19T19:13:25.397" LastActivityDate="2015-08-19T19:13:25.397" Title="Audio block-processing discontinuities" Tags="|filters|audio|dsp-core|real-time|adaptive-filters|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25312" PostTypeId="1" CreationDate="2015-08-18T18:51:31.467" Score="0" ViewCount="354" Body="&lt;p&gt;I have two time series.  The two series look like they follow the same function, but one appears to lag slightly behind the other.  I would like to determine if there are phase differences between the points in these time series, but each time series is only 4 points long.  Is this enough data to get accurate phase differences using the Hilbert transform?&lt;/p&gt;&#xA;" OwnerUserId="17050" LastActivityDate="2016-12-12T00:37:32.023" Title="What is the minimum number of time points recommended for accurate instantaneous phase estimates using the Hilbert transform" Tags="|fft|phase|hilbert-transform|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25313" PostTypeId="1" CreationDate="2015-08-18T18:55:04.217" Score="0" ViewCount="70" Body="&lt;p&gt;I'm working in a speech recognition project for the university. I'm using the TIMIT dataset and pylearn2 as machine learning library.&#xA;The project need to be simple, and it doesn't have to follow the state of art at all costs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've decided to use the RASTA-PLP technique to extract the features. More precisely I'm using the &lt;a href=&quot;http://labrosa.ee.columbia.edu/matlab/rastamat/&quot; rel=&quot;nofollow&quot;&gt;rastaplp.m function in Matlab&lt;/a&gt;. I want a sample for each phoneme, but when i execute the RASTA-PLP function on a single phoneme, i have multiple values for each phoneme. This is normal, considering that the RASTA-PLP function calculate his value over a certain number of temporal windows, and each phoneme has a certain lenght.&#xA;But i need for each phoneme, a single value. Actually, after having chosen the number of feature (14 in my case), i need an array (1X14), composed of one line and 14 cells.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can a transform the result to that ? Is it ok just to calculate the average value over the different values of each feature ?&lt;/p&gt;&#xA;" OwnerUserId="17051" LastEditorUserId="3453" LastEditDate="2015-08-20T20:24:12.027" LastActivityDate="2015-08-20T20:24:12.027" Title="Unique feature value for each phoneme" Tags="|speech-processing|speech-recognition|speech|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25314" PostTypeId="1" CreationDate="2015-08-18T19:00:45.273" Score="1" ViewCount="1122" Body="&lt;p&gt;I am using an FFT/iFFT library in c#, and working with arrays of audio &amp;amp; complex data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am hoping to do is take a small amount of 'background' audio signal, and use it as a fingerprint to subtract that background signal content from another 'real' signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fingerprint (F) piece of signal is an FFT transform of audio 1 window size in samples. The 'real' (R 1..n) signal is a series of FFT transforms of many windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is essentially how I understand things after trying to figure it out with a text editor, some basic maths and google ...  If anyone can point me at a step by step that a software dev with some dsp interest and basic math (intermediate maybe) can understand I would appreciate it :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initially, expecting problems, just subtracted the real part of each bin in F from the real part of each correpsonding bin of each window of R. The iFFT of the results produced a noisy signal around the window boundaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I (think) understood I need to be subtracting the magnitudes represented, not just the real parts, - and that this was in a polar coordinate system when doing the math. So I thought, just subtract the magnitudes - the phases shouldn't change?  Then came to realise (maybe?) the phases were not aligned between the fingerprint F and each real R signal window. So now I wonder can you align the phases of the bins in the fingerprint with those of each of the real signal windows, or vice versa, before subtracting the magnitudes? and then iFFT wont be noisy? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a wordy question, I understand. I think what I am really asking is,  can someone help me straighten out my understanding of what's happening/required maths wise? I &lt;em&gt;think&lt;/em&gt; I have a good mental model of whats going on, just struggling to understand how to manipulate it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand each bin represents an average of a band of frequencies - hence also phases.. I think.. though this confuses me then as to how iFFT can reproduce the signal, though I think I have that pinned down to sample rates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I understand the concept of 'windowing/convolving' the signal, but that seems like a technique to hide the problem (unless you could convolve in a way that essentially also aligns phase?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After here I get a bit lost....&lt;/p&gt;&#xA;" OwnerUserId="16990" LastEditorUserId="16990" LastEditDate="2015-08-19T21:41:54.983" LastActivityDate="2018-10-22T11:01:19.807" Title="Subtracting one FFT from another for noise reduction" Tags="|fft|ifft|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25315" PostTypeId="2" ParentId="25312" CreationDate="2015-08-18T20:17:15.723" Score="0" Body="&lt;p&gt;I would not recommend that, because, 4 points may not describe your signal really well. These 4 points can be coming from anywhere. To experiment with that I wrote the following extremely simple code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% generate a signal&#xA;x = cos(pi/4*(0:99));&#xA;y = hilbert(x);&#xA;sigphase = (unwrap(angle(y)))';&#xA;X = ones(length(sigphase),2);&#xA;X(:,2) = (1:length(sigphase))';&#xA;beta = X\sigphase;&#xA;beta(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;beta(2) will be very close to the frequency. If you generate x using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = cos(pi/4*(0:3));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you will immediately see that the frequencies do not match. This is of course a tough one due to the cosine signal, but there might be ambiguous cases, similar to that one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why don't you use a running correlation analysis instead?&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-08-18T20:17:15.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25316" PostTypeId="1" AcceptedAnswerId="25325" CreationDate="2015-08-18T20:40:08.837" Score="1" ViewCount="2621" Body="&lt;p&gt;so I'm working on a problem where I need to find a PSD for the sum of a deterministic and stochastic function. So assume $x(t)$ being this sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t) = d(t)+s(t)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $d(t)$ is the deterministic function and $s(t)$ is the stochastic function. How do I write down the autocorrelation $R(\tau )$ and the PSD for $x(t)$ that we calculate from Fourier transforming $R(\tau )$?&lt;/p&gt;&#xA;" OwnerUserId="17046" LastActivityDate="2015-08-20T06:35:09.033" Title="Autocorrelation for the sum of a deterministic and stochastic signal" Tags="|autocorrelation|power-spectral-density|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25318" PostTypeId="1" CreationDate="2015-08-19T06:32:19.930" Score="0" ViewCount="2048" Body="&lt;p&gt;I have created a flowgraph, &lt;a href=&quot;https://github.com/mossmann/im-me/blob/master/garage/garage-decode.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;based on an example of Michael Ossmann&lt;/a&gt;, which takes in a signal, and should output bits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to use the clock recovery MM block, which I do not fully understand yet. However, after reading some blogposts, I am quite sure that I can leave most of the settings default, except for the Omega one. Here's my flowgraph:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/n25r7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n25r7.png&quot; alt=&quot;flowgraph&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When running this flowgraph, it gives me the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;thread[thread-per-block[5]:&amp;lt;block clock_recovery_mm_ff (9)&amp;gt;]: mmse_fir_interpolator_ff: imu out of bounds.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While searching, I stumbled upon &lt;a href=&quot;http://gnuradio.org/redmine/projects/gnuradio/repository/revisions/ce3d887a47b47cb2d5351e14066ceb56b2b3c892/entry/gr-filter/lib/mmse_fir_interpolator_ff.cc&quot; rel=&quot;nofollow noreferrer&quot;&gt;this piece of code&lt;/a&gt; in the source of GnuRadio:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int imu = (int)rint(mu * NSTEPS);   &#xA;  if((imu &amp;lt; 0) || (imu &amp;gt; NSTEPS)) { &#xA;    throw std::runtime_error(&quot;mmse_fir_interpolator_ff: imu out of bounds.\n&quot;); &#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, I suspect it is not due to my Omega setting (which might be wrong, I have to play with that setting), but that it is due to my Mu setting, which is just the default (0.5). However, I understand that Mu needs to be between 0 and 1, so I do not really understand what the problem is. Anyone who does?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Environment details:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GNU Radio Companion 3.7.7.1&lt;/li&gt;&#xA;&lt;li&gt;Running a GNU Radio live DVD in a virtual machine (VirtualBox 4.2.12) on Windows 7.&lt;/li&gt;&#xA;&lt;li&gt;Using Volk machine: ssse3_64&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="17056" LastEditorUserId="13320" LastEditDate="2016-04-08T15:00:26.957" LastActivityDate="2017-12-21T05:09:49.950" Title="GnuRadio: Clock Recovery MM: imu out of bounds" Tags="|signal-analysis|gnuradio|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25319" PostTypeId="2" ParentId="25309" CreationDate="2015-08-19T07:14:47.773" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The frequency resolution stays the same because increasing the sampling rate increases the maximum frequency that can be resolved. For example, doubling the sampling rate would double the maximum frequency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Adjust the size of the spectrogram window, and set the number of FFT points based on that. The command is&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;[S,F,T] = spectrogram(X,WINDOW,NOVERLAP,NFFT,Fs)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;X&lt;/code&gt; is the signal&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;WINDOW&lt;/code&gt; is the size of the window, try 1000 for starters&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;NOVERLAP&lt;/code&gt; is the amount of overlap as the window is slid along. signal length / (WINDOW-NOVERLAP) is approximately how many time points you will have.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;NFFT&lt;/code&gt; is the number of FFT points. The maximum I would use is half the WINDOW value, say 500.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Fs&lt;/code&gt; is the sampling frequency. Input this and &lt;code&gt;F&lt;/code&gt; will come out as the frequency points and &lt;code&gt;T&lt;/code&gt; as the time points with no need for your own calculations.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You should not be running out of memory - I routinely calculate spectrograms on data with millions of points, you just have to tweak the input parameters. For example, putting &lt;code&gt;WINDOW&lt;/code&gt; = 1000 and &lt;code&gt;NOVERLAP&lt;/code&gt; = 999 will give you one time point for every sample and the output spectrogram will be, in your case, 74767 wide! Try the above settings and see how it goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you make &lt;code&gt;WINDOW&lt;/code&gt; large your frequency resolution will increase but you time resolution will decrease. &lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-08-19T07:14:47.773" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25320" PostTypeId="1" AcceptedAnswerId="27778" CreationDate="2015-08-19T07:21:52.850" Score="2" ViewCount="4270" Body="&lt;p&gt;Looked on few questions already there in dsp.stackexchange and couldn't get the direct answer. Basically I have a kernel of a gaussian separable filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float w[N*2+1] = {-0.00467444956f, -0.0531099625f, 0.0152470656f, 0.300147355f,  0.484779954f, 0.300147355f,  0.0152470656f, -0.0531099625f, -0.00467444956f};&#xA;&#xA;float w2[N*2+1] = {-0.00899997167f, 0.0197822638f, -0.0300691985f, 0.0374629796f, 0.963647842f, 0.0374629796f, -0.0300691985f, 0.0197822638f, -0.00899997167f};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The coefficients in first first increasing and then starts decreasing.The middle point is strongest and it is close to 0.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In 2nd the coefficients are of alternate sign with middle being storngest close to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What properties these coefficients signify?&#xA;How can I relate them to high pass or low pass filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the above kernels in the smoothening the image using Gaussian separable filter.&lt;/p&gt;&#xA;" OwnerUserId="7251" LastEditorUserId="8202" LastEditDate="2015-12-17T15:11:09.780" LastActivityDate="2022-02-10T00:44:00.607" Title="filter coefficients to know high pass and low pass filter" Tags="|image-processing|lowpass-filter|gaussian|highpass-filter|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25321" PostTypeId="1" AcceptedAnswerId="25326" CreationDate="2015-08-19T07:25:44.903" Score="1" ViewCount="1989" Body="&lt;p&gt;By investigating the implemented code of an accepted paper, I encounter with following relation to estimate the variance of noise in an image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sigma = \frac{median (|\nabla^hx-median(\nabla^hx)|)}{2*.6745},\tag{1}$$&#xA;where $\nabla^h$ compute horizontal derivative of $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the variance of some samples can be estimated by $\frac{1}{n}\Sigma_{i=1}^n (x_i-\mu)^2$, but I cannot understand $(1)$ as well as the magic number $.6745$. &lt;br&gt; &lt;br&gt;&#xA;Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="17059" LastEditorUserId="128" LastEditDate="2020-04-08T13:29:00.930" LastActivityDate="2020-04-08T13:29:00.930" Title="Estimating the Variance of Noise Using Median Function Applies on the Gradient of the Image" Tags="|noise|image-processing|estimation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25322" PostTypeId="2" ParentId="25320" CreationDate="2015-08-19T07:36:40.287" Score="2" Body="&lt;p&gt;I think the filters may be sum of a lowpass and a hightpass filter. They may use to extract some high frequency and low frequency components of a signal.&#xA;For example to extract the edges of an image and smooth then simultaneously.&lt;/p&gt;&#xA;" OwnerUserId="17059" LastEditorUserId="17059" LastEditDate="2015-08-19T08:15:24.190" LastActivityDate="2015-08-19T08:15:24.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25323" PostTypeId="1" CreationDate="2015-08-19T08:59:10.843" Score="5" ViewCount="552" Body="&lt;p&gt;I am looking for a way to characterise the frequency response of the slope from a linear regression. We are exploring the effect of window length of the regression to the magnitude of the slope of the regression and find that for our data (discrete time series data), the slope is positively related to the window length. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The slope can be thought of as the expected change of our output variable for a given input variable over a time period equal to the window length. We find that for a short window length, this slope is very low whereas for a long window length the slope is high. We interpret this to mean that the system responds to changes in the input in the long term but not in the short term. To me, that sounds a lot like a low pass filter killing off the fast changes in the input but passing the slower (or rather, more sustained) changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The slope, or beta, of the regression for a rolling window is, in a way, similar to a moving average and it is possible to characterise the frequency response of a moving average filter as a function of its window length &lt;a href=&quot;https://dsp.stackexchange.com/a/14648/8153&quot;&gt;as shown here&lt;/a&gt;. I was wondering if anyone knew of a similar way to characterise the frequency response of the beta of a rolling regression as a function of its window length in a similar manner?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I have &lt;a href=&quot;http://www.claysturner.com/dsp/FIR_Regression.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;read this paper&lt;/a&gt; which explores using regression beta as a filter but I was unable to get an intuitive understanding of why the larger the window length is, the lower the cutoff frequency appears to be. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here are a few descriptive charts of our data that might show why we are asking this question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xqq5o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xqq5o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the chart above, the thick grey line is the regression over all the data (i.e. a long window length) and has a slope of 1.79. The coloured lines (and points) show the regressions for single years of data (the betas for these lines are in the brackets in the legend of the chart). The beta for any individual year is significantly lower than the overall beta. In other words the grey line is much steeper than the other lines. This is true for any arbitrary 1 year window on the data (i.e. there is no year-long window of data that has a slope as steep as the overall data). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This next chart shows the rolling betas for different window lengths:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dpy7V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dpy7V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question we are trying to answer (and hoping to do so by characterising regression as a LPF) is why do the lines in this chart have higher biases (higher on average) as the window length increases (e.g. the yellow line is higher than the green line). How can we interpret this phenomenon?&lt;/p&gt;&#xA;" OwnerUserId="8153" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2024-04-02T06:04:25.507" Title="Frequency response of a rolling linear regression" Tags="|discrete-signals|lowpass-filter|frequency-response|moving-average|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25324" PostTypeId="1" CreationDate="2015-08-19T09:35:56.187" Score="1" ViewCount="142" Body="&lt;p&gt;I am trying to build a filter with different frequency bands in Matlab. I would like the filter to be as invisible as possible, but after the filtering, a great amount of frequencies are being attenuated and I believe it is where the filters overlap, but also one can see that the low frequencies are also attenuated though there is not any overlap there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following images show the results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original signal &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VOy0o.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VOy0o.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Filtered signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KkNTH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KkNTH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you help me understand what I am doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I am using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x,Fs] = audioread('drum-loop.wav');&#xA;&#xA;% define constants  - - - - - - - - - - - - - - - - - - - - - - - - - - - - &#xA;&#xA;ntaps = 255;                                                               % number of filter-taps&#xA;&#xA;% sampling frequencies for each branch&#xA;fs_A = 48000;                   %&#xA;fs_B = 24000;                   %&#xA;fs_C = 6000;                    %&#xA;fs_D = 1500;                    %&#xA;&#xA;% decimation for each branch&#xA;dec_A = 1;                      %&#xA;dec_B = 2;                      %&#xA;dec_C = 4;                      %&#xA;dec_D = 4;                      %&#xA;&#xA;% decimation filters  - - - - - - - - - - - - - - - - - - - - - - - - - - -&#xA;x_B = decimate(x, dec_B);&#xA;x_C = decimate(x_B, dec_C);&#xA;x_D = decimate(x_C, dec_D);&#xA;&#xA;% interpolation filters   - - - - - - - - - - - - - - - - - - - - - - - - -&#xA;% ref: https://es.mathworks.com/help/dsp/ref/mfilt.html&#xA;intfilter_B = mfilt.firinterp(dec_B);                                      % decimate signal for branch B&#xA;intfilter_C = mfilt.firinterp(dec_C);                                      % decimate signal for branch C&#xA;intfilter_D = mfilt.firinterp(dec_D);                                      % decimate signal for branch D&#xA;&#xA;&#xA;% define filters  - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&#xA;ovlp1 = 2000;&#xA;ovlp2 = 500;&#xA;ovlp3 = 250;&#xA;&#xA;% branch A: band pass filter.&#xA;bp_A = designfilt('bandpassfir','FilterOrder',ntaps-1, ...&#xA;         'CutoffFrequency1',fs_B/2-ovlp1,'CutoffFrequency2',(fs_A/2-1), ...&#xA;         'SampleRate',fs_A);&#xA;% branch B: band pass filter.&#xA;bp_B = designfilt('bandpassfir','FilterOrder',ntaps-1, ...&#xA;         'CutoffFrequency1',fs_C/2-ovlp2,'CutoffFrequency2',(fs_B/2-1), ...&#xA;         'SampleRate',fs_B);&#xA;% branch C: band pass filter.&#xA;bp_C = designfilt('bandpassfir','FilterOrder',ntaps-1, ...&#xA;         'CutoffFrequency1',fs_D/2-ovlp3,'CutoffFrequency2',(fs_C/2-1), ...&#xA;         'SampleRate',fs_C);&#xA;% branch D: band pass filter.&#xA;bp_D = designfilt('lowpassfir','FilterOrder',ntaps-1, ...&#xA;         'CutoffFrequency',(fs_D/2-1), 'SampleRate',fs_D);&#xA;&#xA;% apply filters&#xA;x_A_f = filtfilt(bp_A,x);&#xA;x_B_f = filtfilt(bp_B,x_B);&#xA;x_C_f = filtfilt(bp_C,x_C);&#xA;x_D_f = filtfilt(bp_D,x_D);&#xA;&#xA;% summation filter&#xA;y = x_A_f + interp(x_B_f,dec_B) + interp(interp(x_C_f,dec_C),dec_B) + ...&#xA;    interp(interp(interp(x_D_f,dec_D),dec_C),dec_B);&#xA;y = y/max(y);                                                              % normalize&#xA;&#xA;% write audio&#xA;audiowrite('output.wav',y,48000);&#xA;&#xA;% plot figures - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &#xA;% compute fft&#xA;figure;&#xA;subplot(3,1,1);plot(x);title('original signal')&#xA;NFFT = 2^nextpow2(length(x));                                              % Next power of 2 from length of y (in samples)&#xA;Y = fft(x,NFFT)/Fs;     &#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;subplot(3,1,2);spectrogram(x,blackman(128),60,128,1e3,'yaxis');title('spectrogram')&#xA;% subplot(3,1,3);plot(f,2*angle(Y(1:NFFT/2+1)));title('phase')&#xA;subplot(3,1,3);plot(f,abs(Y(1:NFFT/2+1)));title('fft') &#xA;&#xA;% compute fft&#xA;figure;&#xA;subplot(3,1,1);plot(y);title('filtered signal')&#xA;NFFT = 2^nextpow2(length(y));                                           % Next power of 2 from length of y (in samples)&#xA;Y = fft(y,NFFT)/Fs;     &#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;subplot(3,1,2);spectrogram(y,blackman(128),60,128,1e3,'yaxis');title('spectrogram')&#xA;% subplot(3,1,3);plot(f,2*angle(Y(1:NFFT/2+1)));title('phase')&#xA;subplot(3,1,3);plot(f,abs(Y(1:NFFT/2+1)));title('fft')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10344" LastActivityDate="2015-08-19T09:35:56.187" Title="Multirate filtering attenuates frequencies at overlap" Tags="|matlab|filters|audio|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25325" PostTypeId="2" ParentId="25316" CreationDate="2015-08-19T09:41:05.087" Score="3" Body="&lt;p&gt;The random process $x(t)$ doesn't have a power spectral density (PSD) in the conventional sense because it is non-stationary, due to the presence of the deterministic time-dependent function $d(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can compute the auto-correlation function of $x(t)$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}R_x(t_1,t_2)&amp;amp;=E\{x(t_1)x^*(t_2)\}\\&amp;amp;=E\{[d(t_1)+s(t_1)][d^*(t_2)+s^*(t_2)]\}\\&#xA;&amp;amp;=d(t_1)d^*(t_2)+d(t_1)E\{s^*(t_2)\}+d^*(t_2)E\{s(t_1)\}+E\{s(t_1)s^*(t_2)\}\\&amp;amp;=d(t_1)d^*(t_2)+d(t_1)\mu_s^*(t_2)+d^*(t_2)\mu_s(t_1)+R_s(t_1,t_2)&#xA;\end{align}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mu_s(t)$ is the (generally time-dependent) mean of the random process $s(t)$, and $R_s(t_1,t_2)$ is its auto-correlation function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you assume that $s(t)$ is wide-sense stationary (WSS), and if you further assume (for ease of notation) that $d(t)$ and $s(t)$ are real-valued, then Eq. $(1)$ simplifies to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_x(t,\tau)=d(t)d(t+\tau)+[d(t)+d(t+\tau)]\mu_s+R_s(\tau)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I've used the usual substitution $t=t_1$ and $\tau=t_2-t_1$.&#xA;Note that $(2)$ generally still depends on the absolute time $t$, and, consequently, $x(t)$ is non-stationary and has no PSD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As already pointed out in a comment, only if $d(t)=d$ is constant (and $s(t)$ is WSS) does the random process $x(t)$ become WSS with auto-correlation function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_x(\tau)=d^2+2d\mu_s+R_s(\tau)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its PSD becomes (by taking the Fourier transform of $(3)$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_x(\omega)=2\pi d(d+2\mu_s)\delta(\omega)+P_s(\omega)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta(\omega)$ is the Dirac delta impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: As mentioned in a comment by Dilip Sarwate, $P_s(\omega)$ also generally includes a Dirac impulse if the mean $\mu_s$ is non-zero. If you define a zero-mean random process $\tilde{s}(t)$ by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=\tilde{s}(t)+\mu_s\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then $P_s(\omega)$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_s(\omega)=P_{\tilde{s}}(\omega)+2\pi\mu_s^2\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using $(6)$, Eq. $(4)$ becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_x(\omega)=2\pi (d+\mu_s)^2\delta(\omega)+P_{\tilde{s}}(\omega)\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which explicitly shows all Dirac impulses in the PSD of $x(t)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-08-20T06:35:09.033" LastActivityDate="2015-08-20T06:35:09.033" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25326" PostTypeId="2" ParentId="25321" CreationDate="2015-08-19T10:11:42.470" Score="1" Body="&lt;p&gt;This method is called median absolute deviation (MAD). Unlike the version with mean, it is a robust estimator of the variance. For a univariate set $X$, MAD is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$MAD = median_{i} (| X_i-median_j(X_j) |)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is typically thought as the median of the absolute values of the deviations from the median of the data. The variance is then robustly estimated as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sigma= \kappa MAD(X)$, where $\kappa=1.4826$ is a scale factor. Note that your $0.6745=\frac{1}{1.4826}$ corresponds to such factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, MAD of the gradients are utilized to estimate variance of the noise. It is a pretty standard procedure. For more on the topic, please refer &lt;a href=&quot;https://en.wikipedia.org/wiki/Median_absolute_deviation&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, you could simply compute this via the function &lt;a href=&quot;http://de.mathworks.com/help/stats/mad.html&quot; rel=&quot;nofollow&quot;&gt;mad&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-08-19T10:11:42.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25327" PostTypeId="1" CreationDate="2015-08-19T13:47:28.130" Score="1" ViewCount="66" Body="&lt;p&gt;I have a signal in time domain, and I have to convert it into frequency domain and divide it into 100 channels, and find the center frequency of each channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not good in &quot;MATLAB&quot; so how to do that, help will be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="17060" LastActivityDate="2015-08-19T13:47:28.130" Title="Dividing a signal in channels" Tags="|time-frequency|multi-channel|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25328" PostTypeId="2" ParentId="25323" CreationDate="2015-08-19T13:48:22.873" Score="0" Body="&lt;p&gt;Essentially, the beta is like a rolling average. A rolling average will lag the the time series, so can be very inaccurate if there is a drift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better way is to use exponential weightings (&lt;a href=&quot;https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average&quot; rel=&quot;nofollow&quot;&gt;EWMA&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An even better way of is to use Kalman Filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find a description on how below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.quantopian.com/posts/quantopian-lecture-series-kalman-filters&quot; rel=&quot;nofollow&quot;&gt;https://www.quantopian.com/posts/quantopian-lecture-series-kalman-filters&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17061" LastActivityDate="2015-08-19T13:48:22.873" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25329" PostTypeId="2" ParentId="8673" CreationDate="2015-08-19T14:43:19.967" Score="0" Body="&lt;p&gt;What worked best for me was to continuously record the signal over two or more periods. So you recording A and B as a vector of the signal. Then calculate phase by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;phi = acos( dot(A,B) / (norm(A)*norm(B)) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This method worked well for sinusoidal signals of the same frequency. Becomes problematic when various frequency components are mixed in the signals.&lt;/p&gt;&#xA;" OwnerUserId="16911" LastEditorUserId="80" LastEditDate="2015-08-20T18:56:58.863" LastActivityDate="2015-08-20T18:56:58.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25332" PostTypeId="1" CreationDate="2015-08-19T16:24:53.247" Score="4" ViewCount="434" Body="&lt;p&gt;I have a recorded interview with two speakers, in which one voice's gain was much higher than the other (by three orders of magnitude). Increasing the gain does not help, because speaker 2's voice is so quiet that it is hitting the digitization limit (I believe). Audio quality is not important, but it would be very helpful to have an approximate technique so that the words may be intelligible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If helpful, I can try to post an audio example of the specific distortion here. The cadence of the voice is there, but it's so mangled the words are unintelligible. Basic interpolation and filtering (both long shots) were not successful in recovering the voice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions for analysis techniques and/or software would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15264" LastActivityDate="2017-05-12T09:32:12.007" Title="Voice recovery with high-noise, low-gain" Tags="|audio|voice|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25333" PostTypeId="1" CreationDate="2015-08-19T18:18:06.327" Score="2" ViewCount="254" Body="&lt;p&gt;I am designing a Kalman Filter for a signal which features a certain kind of noise and I do not know how to model it properly in the filter.&#xA;The noise is constructed from a white noise source, called $w(t)$&#xA;by taking the difference of the current noise-sample and the last noise sample ($\Delta t$ is the sample-time):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\eta(t) = w(t) - w(t-\Delta t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my current point of view this is basically high-pass filtered noise or some kind of differentiated white noise (I read purple noise somewhere) with a sinusiodal power spectral density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 1:&#xA;Do you agree on my thoughts above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2:&#xA;How can this noise be modeled in terms of a Kalman Filter?&#xA;Would a Markov-model be suitable? How to express the color of this noise in a Kalman Filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="17066" LastEditorUserId="128" LastEditDate="2018-07-07T15:52:05.857" LastActivityDate="2018-07-07T15:52:05.857" Title="Purple Noise Modeling / Differentiated White Noise (Kalman Filtering)" Tags="|noise|kalman-filters|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="25334" PostTypeId="1" AcceptedAnswerId="25335" CreationDate="2015-08-19T20:02:51.303" Score="3" ViewCount="2219" Body="&lt;p&gt;I am a little confused about definition of intensity scaling. It is something like histogram equalization or a method in which we just multiply all intensities by a scalar. &#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15003" LastActivityDate="2015-11-07T16:17:34.520" Title="intensity scaling: precise definition?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25335" PostTypeId="2" ParentId="25334" CreationDate="2015-08-19T20:30:30.567" Score="1" Body="&lt;p&gt;Intensity scaling can be just as you say: multiplying all intensities by a scalar value. This will obviously change the histogram, but will do nothing like histogram equalization (it will just scale the x-axis of the histogram, barring some binning effects).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, intensity scaling can change the range of intensities so that instead of going from $\tt x_{min}$ to $\tt x_{max}$ the pixel values range from $\tt x_{new\ min}$ to $\tt x_{new\ max}$ that might be better for display purposes (e.g. $\tt x_{new\ min} = 0$ to $\tt x_{new\ max} = 255$ or $\tt x_{new\ min} = 0$ to $\tt x_{new\ max} = 65535$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.imageprocessingplace.com/downloads_V3/dipum2e_downloads/dipum2e_sample_book_material_downloads/DIPUM2E_Chapter03_Pgs_80-114_abd_128-133.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;See Gozales, Woods, and Eddis for example.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/asiWi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/asiWi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-19T20:30:30.567" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25336" PostTypeId="1" AcceptedAnswerId="25355" CreationDate="2015-08-20T03:53:23.817" Score="0" ViewCount="137" Body="&lt;p&gt;I'm given a difference equation, $y[n]-0.4y[n-1]=x[n]$, and asked to find the natural response $y_n[n]$, forced response $y_f[n]$ and complete response $y[n]$ if $x[n]=4 (0.25)^nu[n]$ and $y[0]=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By one approach I've read,&#xA;$$&#xA;\text{characteristic equation:}\quad z-0.4=0 \quad\therefore y_n[n]=A(0.4)^n \\&#xA;\\&#xA;y_f[n]=B(0.25)^n \quad\text{substitute back into diffeq:}\\&#xA;B(0.25)^n -0.4B(0.25)^{n-1}=B(0.25)^n - \frac{0.4}{0.25}B(0.25)^n= 4(0.25)^nu[n]\\&#xA;\therefore B=-\frac{20}{3}, \quad y_f[n]=-\frac{20}{3}(0.25)^nu[n]\\&#xA;\therefore y[n] = A(0.4)^n-\frac{20}{3}(0.25)^nu[n]\\&#xA;y[0]=0 \rightarrow A=\frac{20}{3} \\&#xA;y[n]= \frac{20}{3}(0.4)^n-\frac{20}{3}(0.25)^nu[n]\\&#xA;$$ &#xA;Great! Alternatively, I should be able to determine $y[n]$ by taking the inverse z Transform of $Y(z)=H(z)X(z)$, which in this case is (I'm pretty sure)&#xA;$$&#xA;Y(z)= \frac{z}{z-0.4}\cdot 4 \frac{z}{z-0.25}\\&#xA;\begin{align}&#xA;\frac{Y(z)}{z} &amp;amp;= \frac{4z}{(z-0.4)(z-0.25)}=\frac{C}{z-0.4}+\frac{D}{z-0.25}\\&#xA;&amp;amp;=\frac{32}{3} \frac{1}{z-0.4} - \frac{20}{3}\frac{1}{z-0.25}\\&#xA;\end{align}\\&#xA;\therefore Y(z)=\frac{1}{3} \left[\frac{32z}{z-0.4} - \frac{20z}{z-0.25}\right]\\&#xA;\therefore y[n]= \left[ \frac{32}{3}(0.4)^n - \frac{20}{3}(0.25)^n \right] u[n]&#xA;$$&#xA;which is almost the same, but not quite.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where did I go wrong? Also, in the second approach, how do you take into account the initial condition of $y[0]=0$? And thirdly, in the first approach, is the first term of $y[n]$ multiplied by $u[n]$ or not? If so, how do you show this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(for anyone wondering, this is not homework for a course, just self study...)&lt;/p&gt;&#xA;" OwnerUserId="16901" LastActivityDate="2015-08-20T21:04:58.297" Title="Discrepancy when calculating LTI system output using inverse z-Transform" Tags="|linear-systems|z-transform|theory|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25337" PostTypeId="1" CreationDate="2015-08-20T05:35:58.203" Score="1" ViewCount="44" Body="&lt;p&gt;I want to classify the mean, energy, std, and entropy of discrete curvelet coefficients(wrapping) with Neural Net. But Neural Net can't deal with imaginary value. I have 2 option, either make it real (remove the imaginary, keep the real) or absolute it ( the imaginary become real). Which one i should choose and why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;abs(3+ 2i) = 5&lt;/p&gt;&#xA;&#xA;&lt;p&gt;real(3 + 2i) = 3&lt;/p&gt;&#xA;" OwnerUserId="17069" LastActivityDate="2015-08-20T05:35:58.203" Title="How to deal with Imaginary Value of Fast Discrete Curvelet Coefficient?" Tags="|matlab|discrete-signals|machine-learning|" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25339" PostTypeId="1" CreationDate="2015-08-20T06:55:33.610" Score="2" ViewCount="123" Body="&lt;p&gt;I am going to test a sparsity promoting algorithm with different parameters to solve the $Ax=b$ to obtain a sparse model $x$. I have to test different parameters for which my algorithm results in different answers for $x$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With different $x$'s there are different $Ax=\hat{b}$ 's. To have a better comparison, I forced my algorithm to iterate while the $\left\|Ax-b\right\|^2&amp;lt;\epsilon$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I obtained all $x$'s for which $\left\|Ax-b\right\|^2&amp;lt;\epsilon$ , how can I determine which model, $x$, is better? I know that I am looking for a model that is more sparse and have a better fit to $b$ but I think I have to consider somehow a trade-off between the sparseness and residual.      &lt;/p&gt;&#xA;" OwnerUserId="12230" LastEditorUserId="1629" LastEditDate="2016-04-19T06:52:45.467" LastActivityDate="2017-06-14T12:34:50.717" Title="Is there any trade-off between the sparseness and residual of the constructed data?" Tags="|compressive-sensing|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25341" PostTypeId="2" ParentId="25332" CreationDate="2015-08-20T08:32:07.007" Score="1" Body="&lt;p&gt;I would suggest dynamic range compression as a first port of call. Set the threshold low and the ratio quite high. Then apply make-up gain to an appropriate level. This functionality is built into many free audio editors such as Audacity. Matlab or Python implementation is also reasonably simple.&lt;/p&gt;&#xA;" OwnerUserId="5105" LastActivityDate="2015-08-20T08:32:07.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25342" PostTypeId="2" ParentId="25336" CreationDate="2015-08-20T13:02:43.680" Score="1" Body="&lt;p&gt;As Matt L pointed out, your initial condition is wrong. y[0] is NOT 0, it's 4. This is obvious from the difference equation. Once you use y[0] = 4, both results come out to be the same.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-08-20T13:02:43.680" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25343" PostTypeId="1" AcceptedAnswerId="25348" CreationDate="2015-08-20T14:47:43.160" Score="4" ViewCount="805" Body="&lt;p&gt;I am currently recording biological responses which are triggered by different events. The figure below shows the original signal (black) and the occurrence of input events (colored dots). There is typically few seconds of a delay in  response to different events, and only some of the events generate a response. These phasic responses occur simultaneously with slowly changing fluctuations (tonic component), which are also biologically important (rather than measurement noise). So it is important to come up with a model that can decompose these signals with few constraints that are biologically plausible: signal = tonic + phasic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this system, phasic responses can be well modeled with typical linear system characterization methods based on impulse response function. Also note that, these phasic responses are always positive, that is biologically speaking there is no inhibition. For this reason, if there were no slow fluctuations in the recordings, the recorded signal would never go below zero, except for measurement noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is more problematic is to account for baseline shifts (the tonic component). I would like to come up with a method that can be used to model the tonic component and phasic responses simultaneously based on the following assumptions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1/ tonic component changes slowly.&#xA;2/ phasic component changes fast.&#xA;3/ phasic component is always positive, that is: signal - tonic should contain as negative values as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem boils down to extracting slow and fast components of a signal. I have already 4 methods in mind, and I would like to see what you think is best suited or come up with an alternative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing that comes to mind is to low-pass filter the signal to obtain an estimation of the tonic component (see blue line). The main problem here is that the estimated tonic component violates the above-mentionned constraint #3. According to this assumption, no points in the recorded signal should be below the tonic component. Instead the tonic component should pass through all the data points where the phasic response is close to zero (schematically shown with the red curve in the figure below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach would be to make an assumption about the duration of phasic response. In doing so, one could use recorded samples that are at least as far as the duration of phasic response as keypoints and interpolate using cubic splines for the remaining data points. This is actually how I have drawn the red curve, but I feel like the interpolation of data points between the key points is problematic, because there are not many key points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third approach would be to work on first or second derivative space and characterize the system in this domain, as it is supposed to be less sensitive to low-variations.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fourth approach consists of extracting slow components. One could use rely more on the history, when the signal is changing fast, and update the history with new data when the signal changes slowly. I am not sure though how to mathematically tackle this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aCyFb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aCyFb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11942" LastEditorUserId="128" LastEditDate="2023-06-24T09:12:00.677" LastActivityDate="2023-06-24T09:12:00.677" Title="Decomposition of a signal to slow and fast components" Tags="|signal-analysis|decomposition|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25344" PostTypeId="1" CreationDate="2015-08-20T15:10:40.043" Score="1" ViewCount="653" Body="&lt;p&gt;I (somewhat) understand sampling and sampled formats, and their relation to the original (analog) signal, but do not quite relate it to note based (MIDI) formats. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What actually is a note based audio format, and is it related to the continuous signal? &lt;/p&gt;&#xA;" OwnerUserId="17078" LastEditorUserId="17078" LastEditDate="2015-08-20T15:30:45.493" LastActivityDate="2015-08-20T15:30:45.493" Title="Difference between note based (MIDI) and sampled (FLAC, MP3, etc.) audio formats" Tags="|audio|sampling|sound|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25346" PostTypeId="1" CreationDate="2015-08-20T16:38:56.607" Score="2" ViewCount="165" Body="&lt;p&gt;What exactly is the image power law mentioned at page 15 in &lt;a href=&quot;http://www.cs.berkeley.edu/~efros/courses/LBMV07/presentations/0208Gist.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/e5Vv2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it related to &lt;a href=&quot;https://en.wikipedia.org/wiki/Gamma_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gamma correction&lt;/a&gt; or the &lt;a href=&quot;https://en.wikipedia.org/wiki/Power_law&quot; rel=&quot;nofollow noreferrer&quot;&gt;statistical power law&lt;/a&gt; Or anything to do with &lt;a href=&quot;https://en.wikipedia.org/wiki/Point_spread_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;PSF&lt;/a&gt; of a camera?&lt;/p&gt;&#xA;" OwnerUserId="634" LastEditorUserId="634" LastEditDate="2017-11-25T11:55:13.283" LastActivityDate="2017-11-25T11:55:13.283" Title="What is the image power law?" Tags="|image-processing|power-law|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25347" PostTypeId="1" CreationDate="2015-08-20T16:59:47.923" Score="1" ViewCount="86" Body="&lt;p&gt;I am working in a traffic tracking app, I am using a background subtraction approach to obtain information about the moving vehicles. After some morphological operations I obtain blobs of the moving objects. In some cases more than one blob belong to the same object, e.g.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/a12G9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a12G9.png&quot; alt=&quot;Various formed blobs that belong to a single object&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I gather the isolated blobs to track only a single object? what features can allow me the fusion of these blobs in a single object? Thanks&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-08-22T08:06:13.133" Title="How to gather similar objects in an image?" Tags="|image-processing|computer-vision|histogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25348" PostTypeId="2" ParentId="25343" CreationDate="2015-08-20T17:12:37.340" Score="1" Body="&lt;p&gt;Your problem is pervasive in signal and image processing: being able to separate a trend (with some assumptions) from a signal (with some other assumptions) and potentially additional noise. This is an instance of (semi-)informed source separation: a sine from a drift,  a texture from a cartoon image, a biological information from instrumental artifacts, etc, that requires a more involved modeling and optimization framework.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your choices are related to fundamental questions related to the model you can build based on physical and mathematical assumptions, aside from the algorithmic tools you can program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Low-pass filtering: &#xA;Standard low-pass filtering is linear and time-invariant. Linearity is very consistent with &quot;signal = tonic + phasic&quot;. But phasic could be (on theory) negative, as &quot;$2+(-1) = 1$&quot;. As your graphic does not include x/y scales, &quot;above&quot; is clear, but i am not sure of what you can model with &quot;no points in the recorded signal should be below the tonic component&quot;, since additional noise can be fluctuating too. But positivity is a property which can be taken into account, with some non-linearity caveats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Duration:&#xA;&quot;that are at least as far as the duration of phasic response&quot; : your assumption seems to me to related to a time-delay, yet i cannot interpret it precisely so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) High-order derivatives: &#xA;&quot;A third approach would be to work on first or second derivative space and characterize the system in this domain, as it is supposed to be less sensitive to low-variations&quot; Indeed, slow variations are expected to be with limited derivatives. This could result in a &quot;sparsity&quot; prior assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Causality: &quot;rely more on the history&quot; there is some causality assumption behind that. This too is a tough stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All your four approaches seem consistent to me, and may help you ponder and state your assumptions. They are otherwise termed as “morphological component analysis (MCA)”, “geometric separation” or “clustered sparsity”, adding positivity. Such topics are addressed for instance in &quot;Blind source separation of positive and partially correlated data&quot; &lt;a href=&quot;http://dx.doi.org/10.1016/j.sigpro.2005.03.006&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1016/j.sigpro.2005.03.006&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may find additional history for instance in the introduction of (mong other papers &quot;Chromatogram baseline estimation and denoising using sparsity (BEADS)&quot; &#xA;&lt;a href=&quot;http://dx.doi.org/10.1016/j.chemolab.2014.09.014&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1016/j.chemolab.2014.09.014&lt;/a&gt; &#xA;which also deals with positivity, low-pass-filtering and derivative sparisty, yet the causal approach is not considered. So you can specify your model in more precise terms (you did do talk about the noise yet), you may find some tracks to solve your questions&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-20T17:12:37.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25349" PostTypeId="1" AcceptedAnswerId="25353" CreationDate="2015-08-20T17:14:06.733" Score="4" ViewCount="80" Body="&lt;p&gt;I am working on a novel object recognition algorithm with BoF implementation for my MSc project and it performs fairly well. I am using it on Caltech101 dataset. I want to compare the results with other techniques, like SIFT, SURF, PHOW and so on. The problem I'm facing is that none of the papers that list out their performance in terms of accuracy mention the number of categories taken into consideration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. for the Vl_feat PHOW, the script says in the comment section that it should give you about 64% accuracy. But when I run it without any changes, I'm getting 92%. When I changed it to test on all 102 categories, it's giving me an accuracy in the 30's range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am fairly new to this, so if I'm missing something that's obvious, please accept my apologies.&lt;/p&gt;&#xA;" OwnerUserId="17079" LastActivityDate="2015-08-20T18:42:24.267" Title="How to calculate performance of your object recognition algorithm and compare results with others?" Tags="|image-processing|computer-vision|object-recognition|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25350" PostTypeId="1" CreationDate="2015-08-20T18:00:47.653" Score="1" ViewCount="5428" Body="&lt;p&gt;I've whipped together a small example that tries to use the Harmonic Product Spectrum Algorithm to extract the pitch of a simple sine wave. I'm not sure about my implementation and if i understood everything completely, that's why i'm hoping for some helping hand here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is here: &lt;a href=&quot;https://gist.github.com/akuehntopf/4da9bced2cb88cfa2d19&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/akuehntopf/4da9bced2cb88cfa2d19&lt;/a&gt;&#xA;(You'll need JTransform and JavaFX to compile, though).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see what happens with the data during the processing using the&#xA;following graphs. Note: I'm using a sine wave with 160Hz and a sample rate of 8000. The duration of the sound data is 1 second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9vE4q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9vE4q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First the sine wave is displayed (see first image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, i'm applying a hamming window to the data (second image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then i calculate the power spectrum of the data as per&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private float[] powerSpectrum(float[] window) {&#xA;    float[] powerSpectrum = new float[window.length];&#xA;    float[] fftBuffer = new float[window.length * 2 + 1];&#xA;    System.arraycopy(window, 0, fftBuffer, 0, window.length);&#xA;    FloatFFT_1D fft = new FloatFFT_1D(window.length);&#xA;    fft.realForward(fftBuffer);&#xA;&#xA;    for (int i=0; i &amp;lt; fftBuffer.length / 2 - 1; i++) {&#xA;        float real = fftBuffer[2*i];&#xA;        float imag = fftBuffer[2*i+1];&#xA;&#xA;        powerSpectrum[i] = (float)Math.sqrt(real*real + imag * imag); &#xA;    }&#xA;&#xA;    return powerSpectrum;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which gives me the spectrum in the third graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe that the peak is approximately at the right spot already, but we go for HPS, so continue (i'm not really sure about everything from here on):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, i'm multiplying the signal with its compressed form several times (with increasing compression)... &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 4. Compress&#xA;float[] spectrumCopy = new float[spectrum.length];&#xA;System.arraycopy(spectrum, 0, spectrumCopy, 0, spectrum.length);        &#xA;for (int compression = 2; compression &amp;lt; 4; compression++) {&#xA;    for (int i = 1; i &amp;lt; spectrum.length; i++) {&#xA;        spectrum[i] = spectrum[i] * getCompressedSample(spectrumCopy, 1, compression, i);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it uses the function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private float getCompressedSample(float[] buffer, int offset, int compression, int loc) {&#xA;    if (offset + loc * compression &amp;lt; buffer.length) {&#xA;        return buffer[offset + loc * compression];&#xA;    }&#xA;    return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i found it somewhere on the interwebs. But my understanding is that we compress the power spectrum n times while taking only every 2, then only every 3 and so on samples from the power spectrum. The original spectrum is then multiplied with each of those compressed spectra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result i get is the fourth graph&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe that the peaks have changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my understanding the next step would be to find the bin with the highest peak, interpolate (i use quadratic interpolation) and recalculate the pitch frequency using this formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;private float getFrequencyForIndex(int index, int size, int rate) {&#xA;    float freq = (float)index * (float)rate / (float)size;&#xA;    return freq;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However this gives me wrong results. I'm pretty much stuck. Any help with this topic would be very much appreciated! Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the next step i'm hoping to be able to extract pitch frequency data from a musical instrument (guitar/ukulele), but of course first things first :-)&lt;/p&gt;&#xA;" OwnerUserId="17080" LastActivityDate="2016-07-31T17:29:19.010" Title="Pitch Detection / Harmonic Product Spectrum - What's wrong?" Tags="|fft|pitch|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25351" PostTypeId="2" ParentId="9555" CreationDate="2015-08-20T18:17:54.167" Score="2" Body="&lt;p&gt;Human eye perception is a complicated thing, the human perception tend to fail in different situations even in large changes of gray tones, also is capable of note minimal changes in the gray levels but all depends on the shape of the figure rather than its histogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases you can enhance an image by applying &lt;a href=&quot;https://en.wikipedia.org/wiki/Histogram_equalization&quot; rel=&quot;nofollow&quot;&gt;histogram equalization&lt;/a&gt; techniques but this is only to emphasize some gray tones in order to observe more details in an image. This is related to gray images.&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-08-20T18:17:54.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25352" PostTypeId="1" AcceptedAnswerId="25354" CreationDate="2015-08-20T18:25:46.400" Score="2" ViewCount="351" Body="&lt;p&gt;So I had this question (f) at my last exam that I failed and I'm now studying for my re-exam, the problem is that I still don't know what the answer is supposed to be in this question (f):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TMQ14.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TMQ14.png&quot; alt=&quot;Question&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Q6FIZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q6FIZ.png&quot; alt=&quot;My attempt&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any suggestions how to solve it?&lt;/p&gt;&#xA;" OwnerUserId="17081" LastActivityDate="2019-01-23T19:26:28.197" Title="How to simplify this sequence" Tags="|signal-analysis|convolution|homework|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="25353" PostTypeId="2" ParentId="25349" CreationDate="2015-08-20T18:42:24.267" Score="2" Body="&lt;p&gt;The problem seems to be that the authors of the other papers did not include enough information for you (or anyone) to be able to reproduce their work. This could have been oversight, or the editor (or reviewers) may have removed it prior to publication. I'd suggest contacting the authors of the problematic paper and see if they'll answer your question. Be polite (it's always nice to know someone read your paper, so let them know that you have!)&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-20T18:42:24.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25354" PostTypeId="2" ParentId="25352" CreationDate="2015-08-20T20:15:44.507" Score="1" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing you need to know is that any sequence convolved with a (shifted) delta impulse is a shifted version of itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f[n]*\delta[n-k]=f[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply this to the expression $u[n]*(\delta[n]-\delta[n-1])$, and realize that what you're left with is a very simple sequence. (The result of (a) will be helpful.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then convolve this very simple sequence with $x[n]$ to get the final result.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-20T20:15:44.507" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25355" PostTypeId="2" ParentId="25336" CreationDate="2015-08-20T21:04:58.297" Score="0" Body="&lt;p&gt;The way to solve such problems is to use the unilateral $\mathcal{Z}$-transform, which allows you to take initial conditions into account. Note that the unilateral $\mathcal{Z}$-transform of $y[n-1]$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{Z}\{y[n-1]\}(z)=z^{-1}Y(z)+y[-1]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Y(z)$ is the $\mathcal{Z}$-transform of $y[n]$. Using $(1)$ you can transform the given difference equation $y[n]-\frac25 y[n-1]=x[n]$, resulting in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=\frac{X(z)}{1-\frac{2}{5}z^{-1}}+\frac{\frac{2}{5}\cdot y[-1]}{1-\frac{2}{5}z^{-1}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $X(z)$ given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{4}{1-\frac14z^{-1}}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. $(2)$ becomes (after partial fraction expansion)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=\left(\frac{32}{3}+\frac{2y[-1]}{5}\right)\frac{1}{1-\frac{2}{5}z^{-1}}-\frac{20}{3}\frac{1}{1-\frac14z^{-1}}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(4)$, the resulting output sequence is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\left(\frac{32}{3}+\frac{2y[-1]}{5}\right)\left(\frac25\right)^nu[n]-\frac{20}{3}\left(\frac14\right)^nu[n]\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. $(5)$ is the general form of the output sequence of the given system with the given input sequence. The value $y[-1]$ is the initial condition of the system, i.e. the state the system is in right before the input signal starts. With $y[-1]=0$ you obtain the same solution as you obtained using the inverse $\mathcal{Z}$-transform (neglecting any initial conditions by using $y[n-1]\Longleftrightarrow z^{-1}Y(z)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the given constraint $y[0]=0$, you can obtain the required value of $y[-1]$ by considering the difference equation at $n=0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[0]-\frac25 y[-1]=x[0]=4$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives $y[-1]=-10$. Plugging that value into Eq. $(5)$ finally gives the result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac{20}{3}\left(\frac25\right)^nu[n]-\frac{20}{3}\left(\frac14\right)^nu[n]\tag{6}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-20T21:04:58.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25356" PostTypeId="2" ParentId="25350" CreationDate="2015-08-20T22:22:18.037" Score="3" Body="&lt;p&gt;The Harmonic Product Spectrum pitch estimation method, using pure multiplication weighting, only works well for signals that have a full set of harmonics with sufficient magnitudes.  Before using HPS, one should either validate that the signal in question meets that criteria, or add a suitably large non-zero floor to all harmonic magnitudes being multiplied together.  Otherwise a pure sinewave with zero harmonics will simply disappear from the result after being multiplied by a zero magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Guitar and ukulele sounds usually have a far richer set of harmonics than test sine waves.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-08-20T22:22:18.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25357" PostTypeId="1" CreationDate="2015-08-21T03:57:43.237" Score="2" ViewCount="63" Body="&lt;p&gt;For the mel frequency spectrum, which is used extensively in audio-processing, the technique uses subjects to identify pitches of uniform distance from one another. Isn't this distance just the 12-th root of two in the regular frequency scale. why must we incorporate subjective listening?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&#xA;a.s.&lt;/p&gt;&#xA;" OwnerUserId="17086" LastActivityDate="2015-08-21T03:57:43.237" Title="Why doesn't the mel-scale use the twelth-root of 2 instead of a biased sample listener?" Tags="|discrete-signals|fourier-transform|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25358" PostTypeId="1" CreationDate="2015-08-21T05:31:30.983" Score="2" ViewCount="1299" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/g9P9c.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/g9P9c.png&quot; alt=&quot;Input Demo Image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The task I am facing is extraction of rotated text (any angle) from a scanned image(attached Image). The image contains a blue sticker on it and need means in extracting the text (printed text) from it. The pattern of the sticker will remain the same for all the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the orientation is not stable and i would be really grateful if anyone could suggest a manner in which i could extract the text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference to the question can be found here, or the technique &lt;a href=&quot;https://dsp.stackexchange.com/questions/20353/how-to-remove-text-region-in-a-document-image-or-extract-image-from-a-document&quot;&gt;How to remove text region in a document image? or extract image from a document image&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16846" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-10-29T06:38:40.933" Title="How to extract text from a scanned document?" Tags="|image-processing|matlab|signal-analysis|computer-vision|machine-learning|" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="25359" PostTypeId="1" AcceptedAnswerId="25362" CreationDate="2015-08-21T07:18:01.627" Score="5" ViewCount="2355" Body="&lt;p&gt;I can think of two possible methods of digital down conversion. One seems superior to the the other for most cases, but I'd like to get some DSP experts' comments on the practical differences between these two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For both methods described below, I start with the assumption that the $x(t)$ input is already constrained to the band of interest, to avoid the consideration of antialiasing. Antialiasing filters may be necessary in practical applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In method A, the in phase component is generated by mixing $x(t)$ with $\cos(\omega t)$ and low pass filtering out the undesired high frequency images. Since there is excess bandwidth in the signal you can use a decimating filter instead of a straight lowpass, shown in my figure below as a blue box around a low pass and a decimator. The quadrature component is similarly obtained by mixing with $\sin(\omega t)$ and then filtering. As a formality I show multiplying the quadrature component by $j$ and adding it to the in phase component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In method B, convolution is used to perform the discrete Hilbert transform on $x(t)$. This is the reconstruction of the missing quadrature component in $x(t)$. Downconversion is accomplished by mixing the resultant complex signal with a complex sinusoid, no unwanted images generated! Depending on the bandwidth of the baseband signal, it may be smart to add a decimating filter to reduce the data rate, but the output here is usable without that filter. That is, it is not aliased (provided the input signal is limited to the appropriate band).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The primary constraint that I can see in method A is that you can't downconvert by small amounts relative to your bandwidth. Say, for example, you had a 1kHz bandwidth in your signal of interest. If you want to downconvert by 100Hz, method A will not allow for that. The band of the images generated in mixing will intersect the band of the signal of interest. I've seen vector analyzers with analog front ends that can use double down conversion to reject images. A similar method could be used in DSP of course. The problem isn't unsolvable, it just isn't solved by method A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method B appears to work around the problems with method A. The construction of a complex signal from the real signal essentially eliminates all negative frequency components, and mixing with a complex sinusoid ensures no images are created, so the only signal present in the output is the signal desired. No filtering is required. However, the convolution required to do the discrete Hilbert transform could be expensive. I would generally choose method A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vLc4Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vLc4Z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: are there advantages / drawbacks of these methods I haven't thought of? What are some practical considerations I should keep in mind before choosing a method?&lt;/p&gt;&#xA;" OwnerUserId="1737" LastEditorUserId="1629" LastEditDate="2015-08-24T02:31:12.663" LastActivityDate="2015-08-24T02:31:12.663" Title="Difference between these two digital down conversion methods" Tags="|digital-communications|algorithms|hilbert-transform|quadrature|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25360" PostTypeId="2" ParentId="3044" CreationDate="2015-08-21T07:50:51.547" Score="0" Body="&lt;p&gt;I have, since my troubles with vocoders, learned a lot about signal processing in school and gone back to revisit some of my older projects and fix them. The problem with my vocoder implementation was that I was defining bandwidths in octaves, but linearly spacing my filters. There would be more overlap in higher frequencies and less overlap in lower frequencies. I'm not sure how I got carrier bleed, perhaps a bad envelope follower, but re-implementing with better filters was the real solution.&lt;/p&gt;&#xA;" OwnerUserId="1737" LastActivityDate="2015-08-21T07:50:51.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25361" PostTypeId="2" ParentId="7720" CreationDate="2015-08-21T13:05:16.590" Score="2" Body="&lt;p&gt;Yes you should definitely use FSK but it has to asynchronical and here is why. Demodulating FSK synchronically is called coherent demodulation. Demodulating FSK coherently requires incoming carrier phase locking (phase synchronization), which is normally done with Phase lock Loops (PLL) which don´t work well unless you have a Signal to Noise Ratio (SNR) of at least 10 dB or so. Normally audio broadcast doesn´t have such a high SNR, so forget about coherent demodulation. Besides in practice with electromagnetic signals the noncoherent FSK requires, atmost, only 1 dB more Eb/No than that for coherent FSK for Pb ≤ 10−4 (this means that for obtaining the same bit error probability Pb you only need to transmit an extra dB of power in each bit). Yet the noncoherent FSK demodulator is considerably easier to build since coherent reference signals need not be generated. Therefore in practical systems almost all of the FSK receivers use noncoherent demodulation because everyone prefers transmitting an extra dB of power instead of getting in all that sync problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answering to your main considerations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;200bps bandwidth if not more:&#xA;I've achieved 200 bps using a continious phase orthogonal carriers 8fsk, setting the smartphone 1 m away from the speaker.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resilient to noise upto certain level:&#xA;I've implemented a BCH error correcting code, with the ability to repair up to 8 error per data block. BCH codes have their biggest coding gains when there is a 25 to 50% redundancy added&lt;/p&gt;&#xA;&#xA;&lt;p&gt;preferably 16khz - 20khz carrier wave with 44.1khz sampling :&#xA;I would suggest increasing the sampling frequency up to 48 kHz (which is quite common nowadays in smartphones) and limiting your operation bandwith between 17.5 or 18 and 21.5 kHz. If you use 44.1 then you have to work between 17.5 or 18 and 20.5 kHz. But you have to be very careful with the speaker and microphone you select as not all of them operate at this high frequencies. You have to make a frequency reponse analysis of them. If you're using a PC I would recommend ARTA or Audacity or if you are a programmer Matlab or Octave. If you are using a smartphone I would recommed any audio spectrum analysis app&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not too complex coding logic:&#xA;I would recommend the non coherent correlation quadrature fsk demodulator. Much lighter than any fft based implementation. Specially if you are less than 1 m away where doppler and multipath don´t afect you so much &lt;/p&gt;&#xA;" OwnerUserId="17077" LastActivityDate="2015-08-21T13:05:16.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25362" PostTypeId="2" ParentId="25359" CreationDate="2015-08-21T13:11:14.913" Score="4" Body="&lt;p&gt;As you already know, the two methods are theoretically identical if there's no noise. If there is out-of-band noise then the low pass filters in method A will further suppress the out-of-band noise, whereas there's no such noise suppression with method B. This would be one advantage of method A over method B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, however, that the phase splitter in method B (which is the complex-valued filter with a wire in the real part and a Hilbert transformer in the imaginary part) could be replaced by a complex valued band pass filter filtering out the positive in-band frequencies. With such a filter, both methods would be equivalent, even with out-of-band noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not think that the need to implement a Hilbert transformer is a disadvantage of method B, because the Hilbert transform does not need to be approximated over the whole band, just over the signal bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-21T13:11:14.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25364" PostTypeId="1" CreationDate="2015-08-21T17:30:10.783" Score="1" ViewCount="1138" Body="&lt;p&gt;Consider what I call a &quot;weighted&quot; convolution of a two-dimensional signal (image) with itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f({\bf r}) = \int d {\bf r}' \,  g({\bf r}') s({\bf r},{\bf r}') g({\bf r}-{\bf r}')$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $s$ is a weighting function, with $s({\bf r},{\bf r}') = s({\bf r}+{\bf r}',-{\bf r}')$. My ultimate goal is to perform edge detection on $g$, i.e., find discontinuities in $g$, from knowing only $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $s=1$, I believe I can obtain $g$ from $f$ using the convolution theorem and a deconvolution scheme, but with a general $0&amp;lt;s&amp;lt;1$ this is no longer possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does the integral I write above have a formal name?&lt;/li&gt;&#xA;&lt;li&gt;Is there something similar to the convolution theorem for such a &quot;weighted&quot; convolution?&lt;/li&gt;&#xA;&lt;li&gt;Is there any other result that may help me perform edge detection on $g$ from knowing only $f$?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="17091" LastEditorUserId="17091" LastEditDate="2015-08-24T08:56:53.983" LastActivityDate="2015-08-24T08:56:53.983" Title="Convolution theorem for &quot;weighted&quot; convolution?" Tags="|convolution|edge-detection|deconvolution|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25365" PostTypeId="1" CreationDate="2015-08-21T18:38:45.407" Score="2" ViewCount="1109" Body="&lt;p&gt;I am working on isolating a specific audio click in a factory type setting. After my initial analysis I determined that a 2-pole High Pass Filter set between 500 and 800Hz would work best for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The timing can be random on when the clicks occur due to human interaction. The shape of the click is a &quot;spike&quot; shape. I do not have the images with me on this workstation but I can get them next week if it helps. Thus the process is not completely automated as a user is inserting the connectors together however the goal is to limit human error so as little interaction with this implementation as possible is preferred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There will always be 3 clicks. Click A and Click B are very pronounced but Click C is very quiet and up until now a very expensive camera system was used to capture Click C visually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Potential Microphone: &lt;a href=&quot;http://www.gp-tm.com/images/datasheet/EM40PL.pdf&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I was curious as to what DSP hardware would be recommended for analyzing such waveforms in a fast and efficient manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Side Note: I am leaning towards IIR due to ease of use and tweaking if that is an incorrect assumption please correct me.&lt;/p&gt;&#xA;" OwnerUserId="17092" LastEditorUserId="17092" LastEditDate="2015-08-21T22:50:53.157" LastActivityDate="2015-08-22T02:47:51.113" Title="DSP Hardware for Detecting an Audio &quot;Click&quot;" Tags="|filters|audio|hardware-implementation|hardware|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="25366" PostTypeId="1" CreationDate="2015-08-21T19:29:03.473" Score="1" ViewCount="2274" Body="&lt;p&gt;So I feel like this should be possible, I'm just not sure how to do it. Let's say I'm generating a signal with a sample rate of 10K samples/second. Then let's say my signal is comprised of X number of frequencies( we'll use 3 for this example). For each sample I want to take the three frequencies and add them together, lets use 1000Hz, 1250Hz, and 1500Hz. Now that i've added them together, they might be too large (lets say the max value i can output is a 1) so then i need to normalize them. Is there a way to calculate the maximum or minimum value that these three frequencies will produce over a given period of time/number of samples so that i can get normalize my signal accordingly? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any input on this!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastActivityDate="2015-08-21T21:50:30.920" Title="Calculate Min/Max value of multiple sine waves added together" Tags="|signal-analysis|frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25367" PostTypeId="1" CreationDate="2015-08-21T19:49:34.313" Score="0" ViewCount="132" Body="&lt;p&gt;I have seen that to get the phase angle of a signal, we have to use PLLs. this PLL is modeling in order to get the phase angle about one frequency, which is the free running frequency of the VCO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I search a phase angle but I don't know what is the frequency of my signal, and I know that the free running frequency of a signal is far from the signal frequency, how can I do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank's&lt;/p&gt;&#xA;" OwnerUserId="11285" LastActivityDate="2015-08-21T19:49:34.313" Title="phase locked loop" Tags="|frequency|control-systems|pll|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25368" PostTypeId="2" ParentId="25366" CreationDate="2015-08-21T21:47:09.233" Score="1" Body="&lt;p&gt;The maximum value will occur when the frequencies all constructively interfere, which will certainly happen periodically if they are different frequencies.  Normalize by the sum of all the individual magnitudes.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-08-21T21:47:09.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25369" PostTypeId="2" ParentId="25366" CreationDate="2015-08-21T21:50:30.920" Score="0" Body="&lt;p&gt;You describe the sum of the signals as mathematical sum of the sine waves and get derivatives. You might get local maxima, but you know that they are limited to the range of a 250Hz period (which is a multiple that creates the 3 frequencies).&#xA;You could use a tool such as GeoGabra to get a feel of it.&#xA;Note that the phase of the three frequencies impacts the results.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2015-08-21T21:50:30.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25370" PostTypeId="2" ParentId="25364" CreationDate="2015-08-21T22:06:54.833" Score="1" Body="&lt;p&gt;1) The terms autoconvolution or selfconvolution can be found in the literature, without the kernel $s$. So you would probably have a weighed, kernel or windowed self-convolution.&#xA;However, i foresee two potential caveats on your formulation. First, i do not understand why you require a two-dimensional periodic signal (and nothing on the kernel $s$?). This could result in infinite values of your integrals. Second, don't you assume some kind of symmetry in $s(r,r′)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Suppose you can solve your system with $s=1$, then with appropriate symmetry on $s$ you may be able to factorize $s$ and slit it over $g(r')$ and $g(r-r')$. Unfortunately the convolution theorem is likely to give you a family of solutions $g$ knowing $f$ only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) You may find useful to explore a multiscale form of your weighted self-correlation operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.rni.helsinki.fi/~msa/pub/TPAMI_MSA.pdf&quot; rel=&quot;nofollow&quot;&gt;Affine invariant pattern recognition using Multiscale Autoconvolution&lt;/a&gt;&#xA;Rahtu E., Salo M., Heikkilä J.&#xA;IEEE Trans Pattern Anal Mach Intell. 2005 Jun;27(6):908-18.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.ece.gatech.edu/lanterma/papers/Deautoconvolution_3_6_05.pdf&quot; rel=&quot;nofollow&quot;&gt;An iterative deautoconvolution algorithm for nonnegative functions&lt;/a&gt;&#xA;Kerkil Choi and Aaron D Lanterman &#xA;2005 Inverse Problems 21 981&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/ICASSP.2014.6853623&quot; rel=&quot;nofollow&quot;&gt;Autoconvolution and panorama: Augmenting second-order signal analysis&lt;/a&gt; &#xA;Douglas, S.C. and  Mandic, D.P., 2014 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-08-23T08:02:42.897" LastActivityDate="2015-08-23T08:02:42.897" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25371" PostTypeId="2" ParentId="25365" CreationDate="2015-08-22T00:47:22.547" Score="1" Body="&lt;p&gt;Probably the easiest (and most accurate) way to do this is the matched filter approach suggested above.  Basically, you can record each click independently and use those as matched filters against the microphone signal.  If the clicks are always the same, click A will ring up very strong on the A matched filter.  Same with B and C.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement the matched filter, you can get a development kit with a processor or DSP chip on it.  It will take some coding to implement the solution (probably C).  In college, I worked on the &quot;TMS320C6713 DSP Starter Kit (DSK)&quot; but you can try Arduino or Beagleboard.  Your system will probably not be highly complex.  As for the microphone, you can get a relatively simple one that connects to the 3.5mm jack on the development kit.  (&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/B003GEBGA0&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.amazon.com/Pyle-Pro-PDMIC58-Professional-Handheld-Microphone/dp/B003GEBGA0/ref=sr_1_4?s=electronics&amp;amp;ie=UTF8&amp;amp;qid=1440204270&amp;amp;sr=1-4&amp;amp;keywords=microphone+3.5mm&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A matched filter works by multiplying the incoming signal by the expected stream of data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: &#xA;If click A lasts 1mS and your sampling rate is 44.1kHz, you would have a 44 sample matched filter (the click may be much shorter).  You can store this in the code and point multiply your incoming signal by this matched filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB example code:&#xA;&lt;a href=&quot;https://stackoverflow.com/a/19471009/3920284&quot;&gt;https://stackoverflow.com/a/19471009/3920284&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maximum value you get when you multiply by your input stream will correspond to the time when your click happened.  You can set a threshold like the example does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing that may change over time is your clicks' sound: as the hardware ages, the clicks will sound different since wearing out may occur.&lt;/p&gt;&#xA;" OwnerUserId="11064" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-08-22T00:47:22.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25372" PostTypeId="2" ParentId="25365" CreationDate="2015-08-22T02:47:51.113" Score="1" Body="&lt;p&gt;More details on the matched filter approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matched filter is the same thing as cross-correlation.  Input A is a template of what you expect the click to sound like, and input B is the live stream of audio.  You cross-correlate them, which will produce low-level noise unless there's a match and then it will produce a large spike.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most efficient way to do cross-correlation is using FFT method.  First, pad your template A with silence until it's the same length as a chunk, then take the FFT of your template A and store it.  You only need to do this once.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then read in chunks of live sound data continuously, and process the chunks in an overlapping way (so you don't miss the click if it occurs halfway between chunks).  For instance, combine chunks 1 and 2 and process them as a whole, then combine chunks 2 and 3 and process them as a whole, then 3 and 4, etc.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each (large) chunk you create, compute the FFT, then (complex) multiply it with the FFT of the template A, then inverse transform to get the cross-correlation.  If there's a big spike in it, you found the match.  If there's not, ignore it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multi-channel version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will only work if the assembly always happens in the same point in space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set up 2 or 3 microphones in a 3D pattern around the area, record the clicks with all the mics at the same time, which might have different delays to them because they are at different distances from the click (though this isn't necessary).  Save those waveforms as your templates, making sure to maintain the delay they each have relative to each other.  Run the matched filters on the live data as above (one for each channel).  When there's a match &lt;em&gt;at that point in space&lt;/em&gt;, all 3 matched filters will produce large spikes at the same point in time.  Combine the 3 matched filter outputs by adding or multiplying (I don't know which is theoretically better) to get location-specific waveform matching, which will reject similar sounds from other locations and different sounds from the target location.  Or if the location is a little sloppy, just look for 3 spikes within a certain amount of time of each other.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2015-08-22T02:47:51.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25374" PostTypeId="1" AcceptedAnswerId="25425" CreationDate="2015-08-22T05:49:09.010" Score="1" ViewCount="382" Body="&lt;p&gt;I am in process of creating some notes in Latex on signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GDPFM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GDPFM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know if there are softwares or tools that are useful for quickly generating these diagrams?&lt;/p&gt;&#xA;" OwnerUserId="10425" LastActivityDate="2015-09-20T01:35:25.727" Title="What tools do you use to create signal processing plots?" Tags="|soft-question|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25375" PostTypeId="2" ParentId="25347" CreationDate="2015-08-22T08:06:13.133" Score="1" Body="&lt;p&gt;First, I personally wouldn't recommend you using background subtraction in general for tracking applications.&#xA;There are way better methods like L1-minimzation of lasso problems, Kenalized Correlation Filters, Multiple Instance learnng, Struck, and whole bunch of stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you must use background subtraction,, here are my thoughts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could obviously at the first frame apply some very basic background subtraction algorithm like using median filtering.&#xA;Now once you get these blobs, you can start generating a dictionary out of each blob.&#xA;That means you can now treat each blob as an individually part where you learn a dictionary for each. Usually in dictionary learning from first frame, people usually perturb the bounding box covering the blob a little (slight translations)(Maybe by gaussian sampled translations with zero mean) and then collect all these samples and vectorize them into your dictionary matrix.&#xA;You do this for all the other parts, or blobs if you will.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now at the first frame you already have the bounding box governing the object ,which is very typical in any tracking problem. Also, you have the bounding box governing all these blobs individually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you do next in the next frame is to try track each of these parts independently say using simple cross correlation. &#xA;At last, you only need to learn one affine transformation that transforms the big box from the previous frame to cover all the blobs in the next frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this approach you divided your main task of tracking from 1 bounding box to smaller ones on which you can use simple methods of tracking. Then you combine 1 bounding box by either learning an affine transformation or simply plotting a minimum bounding box that covers all the other parts.&lt;/p&gt;&#xA;" OwnerUserId="8348" LastActivityDate="2015-08-22T08:06:13.133" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25376" PostTypeId="2" ParentId="25339" CreationDate="2015-08-22T08:17:35.780" Score="1" Body="&lt;p&gt;You can reformulate your problems as a minimization problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P1:  \min_x  \|Ax -b\|_2^2 + \lambda \|x\|_o $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\|x\|_o$ is the $\ell_o$ norm of x where it is the number of nonzero elements. Looking for a solution to p1 is essentially looking for a solution that best explains the model $\|Ax -b\|$ while having sparse coefficients. The problem is NP non convex NP hard and is extremely difficult to optimize. Another approach is to use the best convex envelope to the $\ell_o$ norm which is the $\ell_1$ norm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P2:  \min_x  \|Ax -b\|_2^2 + \lambda \|x\|_1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under some conditions on A, the two problems are in fact equivalent in the sense they have the same global optimal solution. There are many efficient solvers for P2 including ADMMS, randomized methods, ISTA and FISTA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve P2 in MATLAB, &lt;a href=&quot;http://spams-devel.gforge.inria.fr/&quot; rel=&quot;nofollow noreferrer&quot;&gt;SPAMS&lt;/a&gt; is your friend here.&lt;/p&gt;&#xA;" OwnerUserId="8348" LastEditorUserId="8348" LastEditDate="2017-06-14T12:34:50.717" LastActivityDate="2017-06-14T12:34:50.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25379" PostTypeId="2" ParentId="25359" CreationDate="2015-08-22T10:13:43.490" Score="2" Body="&lt;p&gt;Here's another difference between the two methods. If the two lowpass digital filters in Method A are identical then their frequency-domain passband magnitude responses will be identical. And that's a good thing if your final goal is phase- or FM-demodulation. In Method B any practical Hilbert transformer will have ripples (fluctuations) in its frequency-domain passband magnitude response. And that will cause freq-dependent phase error in your final complex-valued I(n) + jQ(n) output. One solution to that problem is to &quot;window&quot; (Hanning, Hamming, etc.) the Hilbert transformer's coefficients to flatten its magnitude response.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-22T10:13:43.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25380" PostTypeId="1" CreationDate="2015-08-22T11:39:00.617" Score="0" ViewCount="90" Body="&lt;p&gt;I need detect object in series of pictures. This object has something like nonsymetric relief structure with some irregularities. In this conditions.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Light conditions can change from almost dark to overlight (sometimes from only one side).&lt;/li&gt;&#xA;&lt;li&gt;Object can be in different sizes, i. e. I am interested in scale invariant shape of that object.&lt;/li&gt;&#xA;&lt;li&gt;Object can be sometimes badly focused. i. e. contours are sometimes hard to find and identify.&lt;/li&gt;&#xA;&lt;li&gt;Object can be turned along vertical axis, but obejct is symmetric along this axis.&lt;/li&gt;&#xA;&lt;li&gt;Sometimes part of this object can be hidden behind some other object.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there some way how to construct general, robust algorithm for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2015-08-22T11:39:00.617" Title="Object detection algorithm" Tags="|image-processing|object-recognition|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25381" PostTypeId="2" ParentId="9555" CreationDate="2015-08-22T13:51:16.787" Score="0" Body="&lt;p&gt;Medical imaging has the same problem of finding an optimal mapping of grey levels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The optimal mapping depends on the task to accomplish. It is determined by trying a reasonable mapping compatible with the task, and then showing it to users to get their feedback. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you could determine the range of input values that matter to you (ie. define a window center and a window width), and apply a sigmoidal LUT so that you can precisely distinguish the values in this range and still be able to see the values outside this range but with less precision. You can use this for instance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wcmXV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wcmXV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition there is a also solution to achieve &quot;perceptually linear images&quot;, ie. that a difference of 2 in the pixel value is perceived as being twice more than a difference of 1 in pixel value. This requires that the screen on which you display your image is calibrated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is achieved by a standard, the DICOM Grayscale Standard Display Function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See there for a presentation on the topic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;ftp://medical.nema.org/medical/dicom/Pixelwrk/GSDisplay.ppt&quot; rel=&quot;nofollow noreferrer&quot;&gt;ftp://medical.nema.org/medical/dicom/Pixelwrk/GSDisplay.ppt&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and there for the actual standard, with a discussion on the Barten eye model which describes the performance of the visual system at noticing light intensity differences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://medical.nema.org/dicom/2004/04_14pu.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;medical.nema.org/dicom/2004/04_14pu.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15001" LastActivityDate="2015-08-22T13:51:16.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25382" PostTypeId="2" ParentId="25374" CreationDate="2015-08-22T22:51:09.013" Score="3" Body="&lt;p&gt;I've been using the Microsoft Visio drawing software (version: 2003) for some years now.  It works pretty well. (Like all Microsoft products it has 2000 special &quot;features&quot; that I don't need so it took quite a while to learn how to create simple drawings.) I see that the current price for the 'Standard' version of Visio is now $300. That's awfully expensive! I hope you're able to find a cheaper &quot;drawing&quot; software package.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-22T22:51:09.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25384" PostTypeId="2" ParentId="25364" CreationDate="2015-08-23T09:37:15.907" Score="1" Body="&lt;p&gt;It would generally be of advantage to write your weighting function as a function $\bar{s}$ of $\mathbf{r'}$ and $\mathbf{r}-\mathbf{r'}$. That will reveal the properties and symmetries in the coordinates the convolution is symmetric in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step towards a simplification is to expand your weights into a tensorial product series:&#xA;$$\bar{s}(\mathbf{r'},\mathbf{r}-\mathbf{r'})=\sum_{n=0}^\infty u_n(\mathbf{r'})\times v_n(\mathbf{r}-\mathbf{r'})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this series has only a finite number of terms then you're done. Each term will contribute to a single convolution integral with weighting factors for the two factor functions if you use the linearity of the integral to split the series up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the series does requires infinitely many (or simply too many to handle) terms, then you should try to sort the terms by decreasing contribution and introduce a cutoff that allows you to treat it as a finite series. That is not possible in all cases, but for your discrete space there won't be problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use symmetry properties of your kernel to simplify the series expansion. This is not too hard to work out, so I won't go into the details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-08-23T09:37:15.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25385" PostTypeId="1" AcceptedAnswerId="25387" CreationDate="2015-08-23T09:46:08.720" Score="0" ViewCount="70" Body="&lt;p&gt;In my textbook, any signals could be expressed like the following formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)=\displaystyle\frac{a_0}{2}+\displaystyle\sum_{n=1}^{\infty}[a_n\cos(2{\pi}nft)+b_n\sin(2{\pi}nft)]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that any signal could be composed of periodic signals whose frequency is $f$, $2f$, $3f$, $\cdot\cdot\cdot$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand the part of &quot;$\displaystyle\frac{a_0}{2}+$&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the text book said,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_n=\displaystyle\frac2T\displaystyle\int_{T_1}^{T_2}x(t)\cos(2{\pi}nft)dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$b_n=\displaystyle\frac2T\displaystyle\int_{T_1}^{T_2}x(t)\sin(2{\pi}nft)dt$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also don't understand why $a_n$ and $b_n$ are like the formula above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for kind answers, and my first language is not English. Please let me read easy English. very Thank you.&lt;/p&gt;&#xA;" OwnerUserId="17105" LastEditorUserId="8202" LastEditDate="2015-08-23T13:38:40.650" LastActivityDate="2015-08-23T14:53:21.997" Title="Can you explain about the following formulas? in Signals and System" Tags="|continuous-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25386" PostTypeId="1" CreationDate="2015-08-23T10:38:33.853" Score="0" ViewCount="76" Body="&lt;p&gt;When I read papers, I often see the term &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Single-carrier_FDMA&quot; rel=&quot;nofollow&quot;&gt;Frequency Domain Equalizer&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand what a &quot;frequency domain equalizer&quot; is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do they mean equalizers like MMSE, LMMSE?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there an equalizer called FDE?&lt;/p&gt;&#xA;" OwnerUserId="11988" LastEditorUserId="80" LastEditDate="2015-08-27T13:24:34.873" LastActivityDate="2015-08-27T13:24:35.213" Title="Frequency Domain Equalization [Sources request]" Tags="|frequency-domain|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25387" PostTypeId="2" ParentId="25385" CreationDate="2015-08-23T14:53:21.997" Score="1" Body="&lt;p&gt;Your question is about the Fourier series decomposition of a function (called signal here). First, this does not apply to &quot;any signal&quot; in theory. In practice, it applies to most pratical &quot;periodic&quot; signals. Periodicity is quite important, althought Fourier development may exist for not strictly periodic functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In loose terms, it tells you that if a signal is periodic, then inside each period the signal can be expressed as a sum (a linear superposition) of the most simple periodic functions, sines and cosines, with frequencies taken as linear factors of the base frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $a_0/2$ term comes from the average of your signal over one period $T$. This is due to the fact that sines and cosines do not see constant signals: they are orthogonal to them, since the integral of a sine or a cosine over one period exactly sums to $0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other terms $a_n$ and $b_n$ are related to orthogonality as well, and i guess that you can, with great profit, read the following &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow&quot;&gt;Wikipedia: Fourier series&lt;/a&gt; page in your perferred language.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-23T14:53:21.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25389" PostTypeId="1" CreationDate="2015-08-23T18:06:16.327" Score="1" ViewCount="1157" Body="&lt;p&gt;I saw two examples of applying a Gaussian low pass filter to a Matlab image: one- when the filter was built in the space domain and was normalized with the sum of the filter coefficients, and another- where the filter was built in the frequency domain and no normalization was made. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it consistent that no normalization is needed in the frequency domain and why is it different in this respect from the spacial domain?&lt;/p&gt;&#xA;" OwnerUserId="17109" LastActivityDate="2015-09-22T19:51:44.070" Title="If I build a low pass gaussian filter in the frequency domain should I also normalize it with the sum of the filter coefficients?" Tags="|matlab|filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25391" PostTypeId="2" ParentId="25389" CreationDate="2015-08-23T18:39:48.223" Score="1" Body="&lt;p&gt;It is consistent to apply a normalization depending on what you really want to measure. Either on Fourier transforms, or low-pass linear filters, one customary sees three types of normalizations:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;No normalization,&lt;/li&gt;&#xA;&lt;li&gt;Normalization for a constant input,&lt;/li&gt;&#xA;&lt;li&gt;Normalization in energy.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To be brief,  for a 3-point uniform coefficient filter, that is a low-pass filter, the impulse response $h$ can be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;No normalization: $h={1,1,1}$,&lt;/li&gt;&#xA;&lt;li&gt;Normalization for constant output (mean-preserving): $h={\frac{1}{3},\frac{1}{3},\frac{1}{3}}$,&lt;/li&gt;&#xA;&lt;li&gt;Normalization in energy: $h={\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}}$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Generally, the normalization depends on the invariance one wants to preserve. For low-pass filters, one often preserves mean (i.e. a constant image remains constant after filtering) or energy. For high-pass, some preserves energy, or estimated slope (or higher-order derivatives). Very often, the sum of coefficients of a high-pass filter is zero (a constant signal is zeroe out), thus it cannot be used for normalization. Yet, many other choices are possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to preserve the average value of the data, in time you normalize so that the coefficients sum to one. In frequency, you can remember that the amplitude of the $0$th frequency obtained from the Fourier transform is proportional to the sum of coefficients in time (&quot;DC Term&quot; in &lt;a href=&quot;http://cns-alumni.bu.edu/~slehar/fourier/fourier.html&quot; rel=&quot;nofollow&quot;&gt;An Intuitive Explanation of Fourier Theory&lt;/a&gt;). So if it is non-zero, you can divise your whole Fourier spectrum by this value to get the same normalization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why people sometimes do not normalize the intensities with image filtering is that these values are often displayed and compared on a full range in the colormap (in Matlab, with function &lt;a href=&quot;http://fr.mathworks.com/help/matlab/ref/imagesc.html&quot; rel=&quot;nofollow&quot;&gt;imagesc&lt;/a&gt;). Consequently, a scalar factor on the image is not considered harmful.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-09-22T19:51:44.070" LastActivityDate="2015-09-22T19:51:44.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25393" PostTypeId="1" AcceptedAnswerId="25395" CreationDate="2015-08-23T18:41:15.337" Score="0" ViewCount="68" Body="&lt;p&gt;I have frequency response of low pass filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    M=8  %%%channel &#xA;    x=8*512 &#xA;    d1=fir1(N-1,wc/pi,w); &#xA;    % L=length(d1); &#xA;    % for k=1:L &#xA;    %     b2(k)=((-1)^k)*d1(k); &#xA;    % end &#xA;    %%%%%%Frequency response &#xA;    h1=fft(d1,x);&#xA;    a1=max(abs(h1)); &#xA;    m1=20*log10(abs(h1/ a1));&#xA;    c=0:x-1 &#xA;    plot(f1/x,m1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have to find magnitude responce at $\omega=\dfrac{\pi}{2M}$ i.e., $h_1$ at $\omega=\dfrac{\pi}{2M}$&lt;/p&gt;&#xA;" OwnerUserId="17113" LastEditorUserId="8202" LastEditDate="2015-08-24T12:22:05.103" LastActivityDate="2015-08-24T12:22:05.103" Title="Find Magnitude Responce at $\omega=\dfrac{\pi}{2M}$ where $M$ is the number of channel in QMF" Tags="|matlab|lowpass-filter|frequency-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25394" PostTypeId="1" CreationDate="2015-08-23T19:31:05.127" Score="3" ViewCount="720" Body="&lt;p&gt;In my implementation of minBLEP, overlapping minBLEPs result in a DC bias as the frequency increases. This is because each minBLEP correction (i.e. the minBLEP minus the aliased step) has a DC bias.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a frequency sweep from 100Hz to 15kHz. The second signal shows the number of active BLEPs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UJTI1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UJTI1.png&quot; alt=&quot;Blep sawtooth&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, the minBLEP paper (&lt;a href=&quot;http://www.cs.cmu.edu/~eli/papers/icmc01-hardsync.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cs.cmu.edu/~eli/papers/icmc01-hardsync.pdf&lt;/a&gt;) acts as if the DC woes are all solved by switching from integrating impulses to placing BLEPs. There's no mention of correcting DC when lots of BLEPs overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Should I just add a DC-blocker at the end?&lt;/strong&gt; Is that what is generally done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, &lt;strong&gt;why is it important that the BLEPs are minimum phase?&lt;/strong&gt; Using linear phase BLEPs would alleviate the DC bias, at the cost of delaying the oscillator output by half the length of the BLEP.&lt;/p&gt;&#xA;" OwnerUserId="17115" LastEditorUserId="17115" LastEditDate="2015-08-24T17:00:06.783" LastActivityDate="2015-12-15T14:36:41.030" Title="how to correct minBLEP sawtooth oscillator DC bias" Tags="|audio|aliasing|oscillator|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25395" PostTypeId="2" ParentId="25393" CreationDate="2015-08-23T20:21:14.860" Score="1" Body="&lt;p&gt;Your code has too many unassigned variables for us to execute it. Your FFT freq axis, in radians/sample, goes from 0 –to- 2pi. The equivalent mathematical FFT integer freq axis index goes from 0 –to- 4095. You want to know h1 at w = pi/(2M) radians/sample.  Let's use variable k to represent the mathematical FFT integer index corresponding to your w.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we can set two ratios equal to each other: k/4096 = w/2pi.  Next we write k/4096 = (pi/(2M))/2pi. This gives us k = 4096/(4M) = 4096/32 = 128 as the math index corresponding to your w. Because of Matlab's unpleasant indexing method the magnitude response you want to examine is your h1(k+1) = h1(129) FFT sample.  [By the way, as long as your M is an integer power of two, k will be an integer. If M is not an integer power of two, you'll have to use either a 'floor()' or 'ceil()' command to compute the mathematical FFT integer index k.]&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-23T20:21:14.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25396" PostTypeId="2" ParentId="24851" CreationDate="2015-08-23T20:55:06.947" Score="0" Body="&lt;p&gt;A simple solution, and possibly acceptable in your application, is to use a Goertzel filter. It's essentially a simple 2nd-order IIR bandpass filter whose center frequency is controlled by you. There's much info on the Internet regarding Goertzel filters.  Good luck.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-23T20:55:06.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25398" PostTypeId="1" CreationDate="2015-08-24T05:23:25.697" Score="1" ViewCount="2642" Body="&lt;p&gt;Since both fft ,freqz are used for finding the frequency response of digital filters.&#xA;the frequency response using freqz function is given below&lt;a href=&quot;https://i.stack.imgur.com/SoKGN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SoKGN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and frequency response using fft function is&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7Nmtg.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7Nmtg.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it seems to be that in case of fft it is mirror image of freqz response.&#xA;also i want to find value of freq response at pi/8 how can i find it using any of fft or freqz method.&lt;/p&gt;&#xA;" OwnerUserId="17113" LastActivityDate="2015-08-24T06:15:09.160" Title="Difference b/w freqz and fft" Tags="|matlab|signal-analysis|dsp-core|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25399" PostTypeId="2" ParentId="25398" CreationDate="2015-08-24T06:15:09.160" Score="1" Body="&lt;p&gt;First, it is instructive to understand the normalised frequency axis of both the fft and the freqz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, in fft, the frequency axis is normalized by the sampling frequency $f_s$. On the other hand, in freqz, the frequency axis is normalised by $f_s/2$, it seems. Having said that, we note that the radian frequency of $\pi/8$ corresponds to the normalized frequency of $\frac{1}{16}=0.0625$ ($2 \pi \frac{f}{f_s}=\frac{\pi}{8}$) in fft and $\frac{1}{8}=0.125$. In  your case, the frequency response at $\pi/8$ seems to be about $-90$ dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fft does not provides the mirror image of the freqz. Freqz only shows the half portion of the fft spectrum.  &lt;/p&gt;&#xA;" OwnerUserId="8475" LastActivityDate="2015-08-24T06:15:09.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25400" PostTypeId="1" AcceptedAnswerId="25403" CreationDate="2015-08-24T09:00:29.400" Score="7" ViewCount="2855" Body="&lt;p&gt;Consider a signal that has lowest frequency component $F_l$ and highest frequency component $F_h$.&#xA;According to the theory of bandpass sampling, this signal can be sampled and succesfully recoverd if sampled at a frequency ($F_s$) twice the difference between highest and lowest frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is, $F_s=2 \cdot \left(F_h-F_l\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My doubt is , Is there a condition or restriction on $F_h$ and $F_l$ for bandpass sampling?&lt;/p&gt;&#xA;" OwnerUserId="16089" LastEditorUserId="1629" LastEditDate="2015-08-25T08:15:54.067" LastActivityDate="2018-12-11T16:38:51.767" Title="Is there a condition for bandpass sampling?" Tags="|sampling|bandwidth|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25403" PostTypeId="2" ParentId="25400" CreationDate="2015-08-24T10:12:17.423" Score="12" Body="&lt;p&gt;It's generally not true that a band pass signal can be sampled and recovered without error if $f_s&amp;gt;2B$ is satisfied, where $B=f_h-f_l$ is the signal's bandwidth. This condition is just &lt;em&gt;necessary&lt;/em&gt; but not sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to make sure that the aliased spectra do not overlap. This results in the following condition on the sampling frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2f_h}{n+1}&amp;lt;f_s&amp;lt;\frac{2f_l}{n}\tag{1},\quad n=0,1,\ldots$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Eq. $(1)$ can only be satisfied for $n=0$, you get the familiar Nyquist sampling theorem where $f_s$ must be greater than twice the highest frequency of the signal: $f_s&amp;gt;2f_h$. The lowest possible sampling frequency is obtained for the largest integer $n$ such that $(1)$ is still satisfied. This maximum value of $n$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$n_{max}=\left\lfloor\frac{f_l}{B}\right\rfloor\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $B=f_h-f_l$ is the bandwidth. Eq. $(2)$ is obtained from $(1)$ by computing the largest value of $n$ such that the left-most term is still less than the right-most term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, take a band pass signal with $f_l=10\text{ kHz}$ and $f_h=30\text{ kHz}$. From $(2)$, Eq. $(1)$ can only be satisfied for $n=0$, so you have to choose $f_s&amp;gt;2f_h=60\text{ kHz}$, which is a stricter condition than just requiring $f_s&amp;gt;2B=40\text{ kHz}$. However, if $f_l=10\text{ kHz}$ and $f_h=14\text{ kHz}$, the maximum value of $n$ for which $(1)$ is satisfied is $n=2$, which gives you a range $2\cdot 14/3=9.33&amp;lt;f_s&amp;lt;10$ of possible sampling frequencies, all of which of course satisfy $f_s&amp;gt;2B=8\text{ kHz}$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-08-25T12:21:56.480" LastActivityDate="2015-08-25T12:21:56.480" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="25405" PostTypeId="1" AcceptedAnswerId="25406" CreationDate="2015-08-24T16:17:42.660" Score="0" ViewCount="2222" Body="&lt;p&gt;So I understand how Convolution works but Circular convolution seems a bit messy to me, all the examples seems to have even series of number like h(n)={1,2,3,4} &amp;amp;  x(n)={1,2,3,4} and they are all starting from n=0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is from my last exam and I'm trying to figure out e)&#xA;(My exam is tomorrow and I just realized I had missed to study on this, hence I won't have time to respond with Latex etc since I don't remember that and figuring it out would mean that I won't have time to study for my exam.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AhJND.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AhJND.jpg&quot; alt=&quot;Question&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt so far, but I don't know if I need to do zero padding (as I understand you only need to do it if you want to do the FFT). And I don't know if you are supposed to start from x(0)*h(-1)..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HsE7L.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HsE7L.jpg&quot; alt=&quot;My attempt so far&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grateful for all help, I have tried to search on the forum and to google it and searching on youtube.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BR Rickard&lt;/p&gt;&#xA;" OwnerUserId="17081" LastActivityDate="2015-08-24T16:41:50.833" Title="Circular Convolution of h(n)*x(n)" Tags="|signal-analysis|convolution|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25406" PostTypeId="2" ParentId="25405" CreationDate="2015-08-24T16:41:50.833" Score="2" Body="&lt;p&gt;The circular convolution is actually mainly an artefact from the Fast Convolution algorithm, that is calculating the convolution via the FFT. I am not aware of any use of the circular convolution at all. Now, to efficiently calculate the convolution between &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;h&lt;/code&gt;, you will often use the FFT, as a multiplication in the frequency domain equals a convolution in the time domain (and inversely). The algorithm is then:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;conv(x,h) = ifft( fft(x) .* fft(h) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;.*&lt;/code&gt; denotes an element-wise multiplication. You will have to use a zero-padding so both vectors have the same length and you can do the multiplication. This way to calculate the convolution is faster than the direct way in the time domain. However, as &lt;code&gt;fft(x)&lt;/code&gt;, &lt;code&gt;fft(h)&lt;/code&gt; and thus also &lt;code&gt;ifft(...)&lt;/code&gt; have the same length (here, the length of &lt;code&gt;x&lt;/code&gt;) you cannot express the &quot;real&quot;, linear convolution, which would be a longer vector. What happens is, that the result of the linear convolution gets &quot;wrapped around&quot; as you indicate in your drawings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me show you that using your example. The linear convolution is (without proof)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;conv(x,h) = [2, 5, 8, 8, 5, 4, 4]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now as in the circular convolution, the vectors are only 5 long, the last 2 entries of the result will be added in the front, so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circ_conv(x,h) = [2+4, 5+4, 8, 8, 5] = [6, 9, 8, 8, 5]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is the circular convolution. The easiest way (imho) is to first calculate the linear convolution and then wrap around that result to achieve the circular convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to calculate the linear convolution with the FFT, you only have to zero-pad both vectors such that the linear convolution fits into these vectors, i.e. to a length of 7 in your example.&lt;/p&gt;&#xA;" OwnerUserId="12102" LastActivityDate="2015-08-24T16:41:50.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25407" PostTypeId="1" CreationDate="2015-08-24T19:04:21.473" Score="1" ViewCount="265" Body="&lt;p&gt;I need to perform tomographic reconstruction of an axially symmetric object. Because of the axial symmetry only one projection of the object (one angle) was taken. I implemented the filtered back-projection algorithm in MATLAB. However, when I run this algorithm on a synthetic image which has circular symmetry, but with added noise to its projection, I get a lot of noise in the reconstruction, especially in the center of the reconstruction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to modify the filtered back-projection algorithm so that the noise in the reconstruction will be reduced while this reduction will not result in loss of information ??  or is the filtered back-projection algorithm just doesn't work for a noisy image which has circular symmetry and as a result the reconstruction is performed with only one projection ??  (I must add that I added the noise to the synthetic image projection in a symmetric image).&lt;/p&gt;&#xA;" OwnerUserId="17109" LastActivityDate="2015-08-24T19:04:21.473" Title="How to reduce reconstruction noise from a filtered back-projection reconstruction of a circularly symmetric image?" Tags="|matlab|reconstruction|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25408" PostTypeId="1" CreationDate="2015-08-24T19:31:38.610" Score="3" ViewCount="4339" Body="&lt;p&gt;The mother wavelet function $\psi(t)$ must satisfy the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int\limits_{-\infty}^{+\infty}  \frac{|\psi(\omega)|^2}{\omega} d \omega &amp;lt; +\infty,$$ &#xA;$$\psi ( \omega ) \bigg|_{ \omega =0} =0,$$&#xA;and &#xA;$$ \int\limits_{-\infty}^{+\infty}  \psi(t) \ dt = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To serve as the wavelet basis for wavelet transform &#xA;$$ \gamma (s, \tau ) = \int\limits_{-\infty}^{+\infty} f(t) \ \psi_{s, \tau }(t) \ dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ \psi_{s, \tau }(t) \triangleq \psi\left( \frac{t-\tau}{s} \right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I understand that the wavelet must be an oscillatory function having no frequency component at $\omega=0$ and effectively have a band pass filter like spectrum, from the equation of wavelet series or wavelet transform can you tell me why is it that the wavelet transform is implemented as a filter bank? What is the intuition behind it? What makes it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am asking this question since the fact that practically the DWT is implemented as a filter bank means that it is not a DWT anymore, it is just a set of low pass and high pass filters. It is mind bogling.&lt;/p&gt;&#xA;" OwnerUserId="4464" LastEditorUserId="4346" LastEditDate="2015-08-24T20:21:11.033" LastActivityDate="2023-08-08T12:20:14.510" Title="Why is a wavelet transform implemented as a filter bank?" Tags="|wavelet|transform|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25409" PostTypeId="1" CreationDate="2015-08-24T21:19:37.680" Score="0" ViewCount="18" Body="&lt;p&gt;what is magnitude responce at ω = π/2M.Code Given is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M=8 % Channel&#xA;x=512*8&#xA;d1=kaiser(N,B) &#xA;d1=fir1(N-1,wc/pi,w); &#xA;[h1,fre1]=freqz(d1,1,x) &#xA;a1=max(abs(h1)); &#xA;plot(fre1/pi,a1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;find magnitude at w=π/2M.&lt;/p&gt;&#xA;" OwnerUserId="17113" LastActivityDate="2015-08-24T21:19:37.680" Title="what is magnitude responce at ω = π/2M for freqz function" Tags="|matlab|lowpass-filter|dsp-core|frequency-response|finite-impulse-response|" AnswerCount="0" CommentCount="2" ClosedDate="2015-08-25T14:09:09.287" ContentLicense="CC BY-SA 3.0" />
  <row Id="25412" PostTypeId="2" ParentId="25374" CreationDate="2015-08-25T00:28:28.153" Score="2" Body="&lt;p&gt;It depends on your definition of &quot;quickly&quot;, but Ive used &lt;a href=&quot;https://www.sharelatex.com/learn/TikZ_package&quot; rel=&quot;nofollow&quot;&gt;tikz&lt;/a&gt; to generate plots like this in the past. You should be able to open some examples in that link and tweak them. &lt;/p&gt;&#xA;" OwnerUserId="17128" LastActivityDate="2015-08-25T00:28:28.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25413" PostTypeId="2" ParentId="25304" CreationDate="2015-08-25T00:45:22.930" Score="0" Body="&lt;p&gt;It's not clear from your question, but there's also angular resolution, or the width of the mainlobe of your radar. This can sometimes be referred to as cross range resolution, and there are many &lt;a href=&quot;http://www.satsig.net/pointing/antenna-beamwidth-calculator.htm&quot; rel=&quot;nofollow&quot;&gt;approximations&lt;/a&gt; you can use based on the type of radiator you're using. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also sampling resolution, which is similarly calculated as the range resolution, but defines the spacing between samples. Whereas the range resolution defines the minimum detection distance between two point targets. &lt;/p&gt;&#xA;" OwnerUserId="17128" LastActivityDate="2015-08-25T00:45:22.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25415" PostTypeId="1" AcceptedAnswerId="25678" CreationDate="2015-08-25T03:48:59.517" Score="1" ViewCount="624" Body="&lt;p&gt;I have two cameras of which I know focal length, principal point, rotation and position. The cameras are in an ideal parallel stereo system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know with as few calculations as possible how much the images of these cameras overlap (let's say a percentage).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to follow a guide called &lt;a href=&quot;http://paulbourke.net/stereographics/stereorender/&quot; rel=&quot;nofollow&quot;&gt;Creating correct stereo pairs from any raytracer&lt;/a&gt;, but I cannot find how to set &lt;code&gt;aperture&lt;/code&gt; and &lt;code&gt;eye separation&lt;/code&gt; to find &lt;code&gt;delta&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I do it with my current data? Or is there a better way to know how much the camera images overlap?&lt;/p&gt;&#xA;" OwnerUserId="9120" LastActivityDate="2015-09-06T21:53:49.377" Title="How to calculate binocular overlap" Tags="|computer-vision|stereo-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25416" PostTypeId="1" AcceptedAnswerId="25417" CreationDate="2015-08-25T06:07:47.907" Score="0" ViewCount="492" Body="&lt;p&gt;As I knkw the DCT is discrete cosine transform that mostly used in time domain analysis to frequency domain. Also 8x8 is used in nomaly in img processing. I don't know why that is defined by 8x8 .anyway 8x8 is used in processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, I am want to know what is the difference between 25x25 and 8x8 in dct?&#xA;Is this just for quality?&lt;/p&gt;&#xA;" OwnerUserId="15650" LastActivityDate="2015-08-25T06:50:37.123" Title="what is the differnence between 8x8 dct coefficients and 25 x 25 dct coefficients?" Tags="|dct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25417" PostTypeId="2" ParentId="25416" CreationDate="2015-08-25T06:50:37.123" Score="1" Body="&lt;p&gt;There exist different variants of discrete cosine transforms. They mostly vary on a phase shift. The most commonly-used type is known as type-II. Since the works of &lt;a href=&quot;https://en.wikipedia.org/wiki/K._R._Rao#Discrete_cosine_transform&quot; rel=&quot;nofollow&quot;&gt;K. R. Rao et al.&lt;/a&gt; in the seventies, it was shown to possess near-optimal properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DCTs are invertible, possess certain symmetry properties that make them useful and practical in sound (signal) or image processing. They can technically be applied to any patch size 13, 8x8, 25x32... Power-of-two patches benefit from faster and more optimized computations. 8x8 are standard for natural image due to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a size small enough so that image chunks are stationnary enoguh to be quite-well represented by cosine waves&lt;/li&gt;&#xA;&lt;li&gt;a small memory footprint for digital implementation&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, it is more common to find 4, 8, 16, and 32 sizes in image and video coding, and even non-square blocks (4x8) with close to DCT transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quality is not a real question for the DCT, since it is invertible. It is more related to a match between your data, the transform on the processing (e.g. compression). You might have data and applications where a 25x25 DCT would work better. Then you will probably hit some difficulties for optimized implementations.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-25T06:50:37.123" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25418" PostTypeId="2" ParentId="25408" CreationDate="2015-08-25T10:38:48.977" Score="2" Body="&lt;p&gt;First of all the basic idea of wavelet transforms lies in multi-resolution analysis. What this means is that the signal is looked at from different scales.&lt;/p&gt;&#xA;&lt;p&gt;It is probably easier to understand this with images (which are 2D signals). The idea of multi-resolution is like zooming in and out of a reference signal and compared with windows of the image according to the amount of zoom.&lt;/p&gt;&#xA;&lt;p&gt;Similarly for 1D you are trying to see how the mother wavelet at different scales (think of it as compressing and expanding in the 1D) compares with the signal at different delays (at different points on the discrete 1D).&lt;/p&gt;&#xA;&lt;p&gt;Now when you look at a given set of discrete points you want to transform based on a mother wavelet it easy to see them as filters (based on mother wavelets) that are applied at different scales.&lt;/p&gt;&#xA;&lt;p&gt;For a better understanding of wavelets and DWT I suggest you read Polikar's tutorial : &lt;a href=&quot;https://users.rowan.edu/%7Epolikar/WTtutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wavelet Tutorial&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16449" LastEditorUserId="7092" LastEditDate="2023-08-08T12:20:14.510" LastActivityDate="2023-08-08T12:20:14.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25419" PostTypeId="1" AcceptedAnswerId="25530" CreationDate="2015-08-25T11:06:39.727" Score="1" ViewCount="751" Body="&lt;p&gt;If I define a channel to have complex Gaussian coefficients, do I still need to add noise to the signal passing through this channel using the command &quot;awgn&quot; or would that be redundant?  &lt;/p&gt;&#xA;" OwnerUserId="11988" LastEditorUserId="80" LastEditDate="2015-08-31T15:02:25.653" LastActivityDate="2015-08-31T15:02:25.653" Title="Complex Gaussian Channel + AWGN noise" Tags="|gaussian|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25420" PostTypeId="2" ParentId="25374" CreationDate="2015-08-25T11:46:54.043" Score="3" Body="&lt;p&gt;I've been making such line drawings in OpenOffice Draw. It has EPS and PDF export but I never tried the output files with Latex&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-08-25T11:46:54.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25421" PostTypeId="2" ParentId="25408" CreationDate="2015-08-25T11:49:18.280" Score="1" Body="&lt;p&gt;Standard continuous wavelets behave like continuous bandpass filters. Since they rely on two continuous parameters (scale and shift), their strict implementation would be impossible, even on discrete data. It would require an non-countable numbers of convolutions(integral). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the full story is much more complex and intricated, but some milestones follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, people like Ingrid Daubechies have succeeded at sampling both the scale and the shift parameters to get a &quot;discrete&quot; and perfect implementation, that could be inverted. The subsampling factors, and the associated redundancy depends on the wavelet, and relate scale and shift. This can be send as a sampling theorem perform on the space of wavelet coefficients, just as the discrete Fourier transform samples regular frequencies in the frequency dmoain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then Yves Meyer managed to find an special wavelet family that allowed to make the transformation orthogonal and discrete, just like the discrete Fourier transform. And one knows that discrete orthogonal transforms, like the DFT, implemented in matrix form, can benefit fast algorithms (FFT) by clever relationships between Fourier coefficients at discrete frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, Stéphane Mallat among others managed to formulate a multiresolution analysis as a set of embedded subspaces with inclusion properties, yeilding a relation between two-sscale of father functions, or a father function and a mother fucntion. This linear relation could be interpreted as a convolution by a given filter. And the relation was valid across scales, and allowed a fast (linear in complexity) algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, works have been performed, either to link those coefficients with specific wavelets. This allowed to derive which wavelets could be implemented as filter banks. The theory built on finite impulse response filters (finite support wavelets like Daubechies, Coiflets, Symmlets, etc.), multi-band (M-band) filters, but also to infinite impulse filters, recursive or redundant ones, even to nonlinear filters. The wavelet arises as the result of an infinite iteration of a basic filter-bank. Which one rarely does in practice, since most data are of finite length, with a limited number of practically useful scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So not all wavelets can be implemeted perfectly (invertible) with efficient filter banks. It is well known that discrete orthogonal wavelets cannot be real/symmetric/finite-length, except the Haar wavelet. Yet there exists a great deal of discrete wavelets that can be effciient on several signal/image/point cloud/mesh data.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-25T11:49:18.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25422" PostTypeId="1" AcceptedAnswerId="25426" CreationDate="2015-08-25T13:06:44.947" Score="0" ViewCount="104" Body="&lt;p&gt;I have been reading the paper from Matthew A. Tusk and Alex Pentland&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.cs.ucsb.edu/~mturk/Papers/mturk-CVPR91.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cs.ucsb.edu/~mturk/Papers/mturk-CVPR91.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got stuck in this part. I have a couple of questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FMcDU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FMcDU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume my images are 256 by 256.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- What are G1,G2...Gm ? Row vectors? Column vectors? (1*65536) or (65536 * 1) ? Or are they 2D vectors (256*256)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- Then it says A = [ F1 F2 ... Fm] . Now I do not get this notation. Again A is what ? A matrix of matrices? or just a huge column/row vector?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="16854" LastActivityDate="2015-08-25T15:08:13.103" Title="Understanding Eigenface Face Recognition Algorithm Notations" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25423" PostTypeId="2" ParentId="23695" CreationDate="2015-08-25T13:46:14.177" Score="2" Body="&lt;p&gt;&lt;em&gt;1st question:&lt;/em&gt; there are some simple steps to change the spatial domain to freq domain, exp adding some zero to avoid ISI, you can read the procedure from a source book, you can use &lt;code&gt;fft2&lt;/code&gt; command in matlab&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;2nd question:&lt;/em&gt; Surely you can not see the differences in freq domain as clear as spatial domain, because to determine the value of one pixel in freq domain all the pixels in the spatial domain will be effective&lt;/p&gt;&#xA;" OwnerUserId="17134" LastEditorUserId="80" LastEditDate="2015-08-28T12:49:12.100" LastActivityDate="2015-08-28T12:49:12.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25424" PostTypeId="2" ParentId="25374" CreationDate="2015-08-25T14:07:58.843" Score="2" Body="&lt;p&gt;I use Inkscape, which is free. Why is it so good? Because of the most excellent arrow options and the snap to grid, it is indispensable for creating scientific diagrams, and in particular signal processing flowcharts.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-09-20T01:35:25.727" LastActivityDate="2015-09-20T01:35:25.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25425" PostTypeId="2" ParentId="25374" CreationDate="2015-08-25T14:50:42.053" Score="5" Body="&lt;p&gt;Extending a bit on the answer of @Rob. If you are writing a paper in LaTeX (and friends), it is (imho) highly desirable to draw the diagrams also in a LaTeX related way. This comes with a number of advantages:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Direct and easy integration, using either &lt;code&gt;\input&lt;/code&gt; or including as PDF using &lt;code&gt;\includegraphics&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The same fonts, font sizes, colors, etc. as in the rest of the document (main advantage in my opinion)&lt;/li&gt;&#xA;&lt;li&gt;One workflow. You can put everything under the same version control (e.g. Git, Mercurial, ...) and do not require any other software: only a LaTeX installation - which is needed anyways.&lt;/li&gt;&#xA;&lt;li&gt;No need to manually move stuff around using the arrow keys, no automatically changing grids, no vector-based programs which can't export eps, ... (yes, I'm looking at you, Visio!)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now there are a number of LaTeX related tools for this. Rob mentioned Ti&lt;em&gt;k&lt;/em&gt;Z in his answer. There are also Metapost and PSTricks which also have the capabilities to get the job done. If you want to stick closely to the LaTeX syntax you seem to already know, you might want to chose Ti&lt;em&gt;k&lt;/em&gt;Z.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do especially plots using Ti&lt;em&gt;k&lt;/em&gt;Z, you might want to have a look at the &lt;a href=&quot;http://pgfplots.sourceforge.net/pgfplots.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;PGFPlots&lt;/a&gt; package, which offers extensive plotting capabilities. All options are well described in the manual, and there is a huge &lt;a href=&quot;http://pgfplots.sourceforge.net/gallery.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;example gallery&lt;/a&gt;. For example to get a plot as the first one in your diagram, all you need is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\documentclass{article}&#xA;\usepackage{pgfplots}&#xA;\begin{document}   &#xA;\begin{tikzpicture}&#xA;\begin{axis}[&#xA;        width = 8cm, height = 4cm,&#xA;        xlabel={$\omega$},ylabel={$X(\omega)$},&#xA;        xtick = {-1,1},&#xA;        xticklabels={-B,B},&#xA;        ytick = {0,1},&#xA;        axis lines=middle,&#xA;        xmin = -4, xmax = 4,&#xA;        ymin = 0, ymax = 1.2&#xA;    ]&#xA;        \addplot[] coordinates {(-1,0)(0,1)(1,0)};&#xA;\end{axis}&#xA;\end{tikzpicture}&#xA;\end{document}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aW0GW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aW0GW.png&quot; alt=&quot;result&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12102" LastEditorUserId="12102" LastEditDate="2015-08-25T15:07:16.093" LastActivityDate="2015-08-25T15:07:16.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25426" PostTypeId="2" ParentId="25422" CreationDate="2015-08-25T15:08:13.103" Score="1" Body="&lt;p&gt;G1, G2... Gm are column vectors of length 65536.  The matrix A has columns that are the principal components.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-08-25T15:08:13.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25428" PostTypeId="1" AcceptedAnswerId="30284" CreationDate="2015-08-25T15:23:59.170" Score="5" ViewCount="144" Body="&lt;p&gt;I'm developing a device for tracking pets in a room with several motion detectors. I use a Kalman filter to estimate the position, which is based on the active outputs of the motion detectors. If an motion detector is active the center of the detection region is the measurement value (position). In some cases the filter estimates the position to be outside the room. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I restrict the Kalman filter, should I restart and reinitialise the filter when the estimated position is not in the predefined area (of the room)?&lt;/p&gt;&#xA;" OwnerUserId="17136" LastEditorUserId="17136" LastEditDate="2015-08-26T13:41:42.450" LastActivityDate="2016-06-21T22:48:28.850" Title="Kalman filter restricted by areal constraints" Tags="|kalman-filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25429" PostTypeId="1" CreationDate="2015-08-25T15:42:27.097" Score="-1" ViewCount="175" Body="&lt;p&gt;If the Nyquist rate for xa (t) is Ωs, what is the Nyquist rate for xa(2t)?&#xA;Will it be the same, increase 2 folds or decrease 2 folds?&lt;/p&gt;&#xA;" OwnerUserId="17137" LastActivityDate="2015-08-25T15:54:08.723" Title="Nyquist Rate Determination" Tags="|sampling|nyquist|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25430" PostTypeId="2" ParentId="25429" CreationDate="2015-08-25T15:54:08.723" Score="1" Body="&lt;p&gt;I'm assuming that this is homework, so I'm not going to give you the answer, but will try to help you get there yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $xa(2t)$ everything happens twice as quickly (what was time $1$ with the original signal is time $2$ with the new signal, time $2$ becomes time $4$, etc.).  Given that everything is happening twice as fast as before, what would that do to the Nyquist frequency?&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-08-25T15:54:08.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25431" PostTypeId="1" CreationDate="2015-08-25T18:06:44.957" Score="0" ViewCount="33" Body="&lt;p&gt;I am thinking to estimate the uncertainty of holes photographed from the bottom and top side. &#xA;The difference of the same hole photographed from two sides is distributed as Gaussian. &#xA;The length of the plane is $10.00 \pm 0.01 cm$ where are holes distributed hexagonally with $50 \mu m$ difference in distance. &#xA;I have attributed these factors in affecting the uncertainty of the hole in photographing it in small magnitudes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;length of the plane&lt;/li&gt;&#xA;&lt;li&gt;viewing angle of the camera (by Taylor expansion getting 3.6% systematic uncertainty)&lt;/li&gt;&#xA;&lt;li&gt;slicing of holes from the plane&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am uncertain how much can the algorithmic approach of detecting the border of the hole in the image affect the uncertainty of the diameter of the hole. &#xA;Some steps of algorithmic approach:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Canny algorithm for edges so allowing finding circles&lt;/li&gt;&#xA;&lt;li&gt;circle's diameter can be measured as maximal distance between two points in one circle&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The hole plane of 10cm is divided into smaller regions for the algorithmic approach, like the following for one sample where the Canny is applied:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v1gqt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v1gqt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a simplification, since the original data is 26.1 Mb (tiff) in a single sample picture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can you approximate the uncertainty in slicing a hole from a plane?&lt;/p&gt;&#xA;" OwnerUserId="5633" LastEditorUserId="5633" LastEditDate="2015-09-04T08:17:53.523" LastActivityDate="2015-09-04T09:19:26.503" Title="To estimate the uncertainty of Slicing holes from an image?" Tags="|image-processing|image-segmentation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25433" PostTypeId="2" ParentId="24761" CreationDate="2015-08-25T23:05:34.500" Score="1" Body="&lt;p&gt;The problem you want to solve is called automatic audio alignment, or auto-synchronization of audio. Common algorithms are phase correlation, cross correlation on the raw audio waveform. People also use more &quot;cooked&quot; audio features like MFCCs, say each 10ms frame, and measure frame-wise similarity between the audio segments to be compared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many threads on Stack overflow that show how to do this. For example: &lt;a href=&quot;https://dsp.stackexchange.com/questions/19289/find-short-clip-of-audio-within-longer-clip-of-audio?lq=1&quot;&gt;find-short-clip-of-audio-within-longer-clip-of-audio&lt;/a&gt;, &lt;a href=&quot;https://dsp.stackexchange.com/questions/18630/cross-correlation-vs-fft-for-finding-phase-between-2-signals/18634#18634&quot;&gt;cross-correlation-vs-fft-for-finding-phase-between-2-signals&lt;/a&gt;. Also some interesting repos on github, &lt;a href=&quot;https://github.com/antonxy/audiosync&quot; rel=&quot;nofollow noreferrer&quot;&gt;audiosync&lt;/a&gt;, &lt;a href=&quot;https://github.com/allisonnicoledeal/VideoSync&quot; rel=&quot;nofollow noreferrer&quot;&gt;videosync&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-08-25T23:05:34.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25434" PostTypeId="1" CreationDate="2015-08-24T20:18:54.703" Score="5" ViewCount="287" Body="&lt;p&gt;I have seen this thread: &lt;a href=&quot;https://math.stackexchange.com/questions/279980/difference-between-fourier-transform-and-wavelets&quot;&gt;Difference between Fourier transform and Wavelets&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AFAIK there is no common usage of wavelets in the real-time DSP world (excluding image and video processing). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious why is it so? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where on the other hand Fourier analysis is widely common and all the transmitter/receiver block diagrams that I have seen contains an FFT module in it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TRces.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TRces.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it related to runtime complexity issues? I guess not, since Wavelets transform can be formalized as convolution, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g aren't wavelets a good candidate to replace the Short-time Fourier transform method ?&lt;/p&gt;&#xA;" OwnerUserId="634" OwnerDisplayName="0x90" LastEditorUserId="634" LastEditDate="2019-12-18T08:25:57.650" LastActivityDate="2019-12-18T08:25:57.650" Title="Why wavelets based transmitter/receiver digital signal processing aren't common?" Tags="|fft|wavelet|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="25435" PostTypeId="1" CreationDate="2015-08-26T11:35:30.947" Score="1" ViewCount="753" Body="&lt;p&gt;If I have a set of signals each with $n$ points, I can take the DFT of each and then use the resulting frequency domain vectors as features for some classification algorithm. If the signals are differing lengths, the frequency basis used by the DFT is no longer the same. This means I can no longer directly use DFT as features if I want to compare signals of varying length. What should I do about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, I want to convert each audio signal into a length $m$ vector of frequency components, and use the same $m$ for all signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realise there is fundamentally more information in a longer signal, so any conversion will involve some loss of information.&lt;/p&gt;&#xA;" OwnerUserId="17076" LastActivityDate="2015-08-26T14:38:03.560" Title="DFT for audio classification - signals of different lengths" Tags="|audio|dft|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25436" PostTypeId="1" AcceptedAnswerId="25475" CreationDate="2015-08-26T12:23:08.643" Score="2" ViewCount="95" Body="&lt;p&gt;I have a 2D image defined on a region $\Omega$. Assume that the region can be separated into $N$ sub-regions $\Omega_i$ such that $$\forall i,j=1... N:\Omega_i \cap\Omega_j=\emptyset$$ and $$\bigcup_{n=1}^{N}\Omega_n =\Omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $u_i(x)=1$ if $x \in \Omega_i$, otherwise $u_i(x)=0$. Then for a familiy $\{f_n:n\in 1..N\}$ of functions on $\Omega$ we have $$x \in \Omega_k \implies \sum_{i=1}^{N}f_i(x)u_i(x)=f_k(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a energy function that is defined as following&#xA;$$E_1=\int_{\Omega} \sum_{i=1}^{N} f_i(x)dx$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the below equation $E_2$ equate with above energy function $E_1$? How to prove it?&#xA;$$E_2=\sum_{i=1}^{N} \int_{\Omega}  f_i(x)u_i(x)dx$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is my prove&#xA;&lt;a href=&quot;https://i.stack.imgur.com/U2aBx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U2aBx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8430" LastEditorUserId="3369" LastEditDate="2015-08-28T10:00:29.700" LastActivityDate="2015-08-28T10:13:02.700" Title="How to prove $\int_{\Omega} \sum_{i=1}^{N} f_i(x)dx$ is equivilant with $\sum_{i=1}^{N} \int_{\Omega} f_i(x)u_i(x)dx$" Tags="|image-processing|computer-vision|image-segmentation|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="25437" PostTypeId="2" ParentId="24877" CreationDate="2015-08-26T12:33:51.727" Score="0" Body="&lt;p&gt;In Matlab you can use the &lt;code&gt;fftshift()&lt;/code&gt; command. It will rearrange the samples so that the frequency range is between $-f_s/2$ and $f_s/2$.&lt;/p&gt;&#xA;" OwnerUserId="17142" LastActivityDate="2015-08-26T12:33:51.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25439" PostTypeId="2" ParentId="25435" CreationDate="2015-08-26T14:38:03.560" Score="1" Body="&lt;p&gt;As you explicitly mention, that you are aware of a loss of information and are willing to accept that, a possible solution will be &lt;em&gt;modulo-N reduction&lt;/em&gt; or &lt;em&gt;wrapping&lt;/em&gt;, as described by Orfanidis in the &lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;freely available book&lt;/a&gt; &quot;Introduction to Signal Processing&quot; on pages 489ff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In modulo-$N$ reduction, a vector $x$ with length $L &amp;gt; N$, where $N$ is the DFT length, is divided into non-overlapping blocks of length $N$. These blocks are summed up, resulting in one vector $\tilde{x}$ of length $N$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZsMZA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZsMZA.jpg&quot; alt=&quot;modulo-n&quot;&gt;&lt;/a&gt;&#xA;Figure taken from Orfanidis (linked above), Fig. 9.5.1 on page 489.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then apply the DFT on $\tilde{x}$, which results in $\tilde{X} = \text{DFT}\{ \tilde{x} \}$ with length $N$. Orfanidis proves that $\tilde{X}$ is exactly equal to the $N$-point DFT of $x$, so is equal to $X$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, that would mean you could find a minimal length $N$, which is guaranteed for all input signals. You then apply a modulo-$N$ reduction on all your input signals and compare these length-$N$ DFTs. Of course, a higher resolution would be possible for longer signals, and you just ignore this by using the modulo-$N$ reduction method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, you could just zero-pad all signals to a maximal length $M$. All your signals will then have a high frequency resolution defined by $M$. Important point: you do have that &lt;em&gt;computational&lt;/em&gt; frequency resolution, but the &lt;em&gt;physical&lt;/em&gt; frequency resolution is still determined by the length of your signals $L$. More details on this are given in any decent signal processing class or on pages 482ff in Orfanidis.&lt;/p&gt;&#xA;" OwnerUserId="12102" LastActivityDate="2015-08-26T14:38:03.560" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25442" PostTypeId="1" AcceptedAnswerId="25471" CreationDate="2015-08-26T16:13:32.337" Score="1" ViewCount="259" Body="&lt;p&gt;I am trying to simulate a simple communication system using channel estimation. I was able to estimate the channel response using the Least Squares channel estimator, and it is working properly (evaluated by the mean square error between the channel and its estimation). But once I have this knowledge, I need to equalize the signal at the receiver. I have tried to apply the zero-forcing method, but it's not providing a good performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the proper way of doing this equalization?&lt;/li&gt;&#xA;&lt;li&gt;In a system where two transmitters send information at the same time and in the same frequency, I can estimate both channels at the receiver, but how can I equalize the signal once I know both channels?&lt;/li&gt;&#xA;&lt;li&gt;Is there is any reference that anyone could indicate to read more about this topic and help answer these questions? It wold be enough for now.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="17125" LastEditDate="2015-08-27T00:56:08.073" LastActivityDate="2015-08-27T17:55:56.277" Title="Equalization knowing the Channel State Information" Tags="|estimation|equalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25443" PostTypeId="2" ParentId="25111" CreationDate="2015-08-26T17:01:33.960" Score="1" Body="&lt;p&gt;C/A code (the main civilian channel as of now) has a main lobe of around 2MHz and depending on how much processing you want to do, it is normally sampled in the low MHz range, which you are in. (you could pull it off with 2-5MHz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do know that the signal must be mixed down to a lower frequency before you sample it. The original signal is at 1.57GHz. &lt;/p&gt;&#xA;" OwnerUserId="17146" LastActivityDate="2015-08-26T17:01:33.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25444" PostTypeId="1" AcceptedAnswerId="25447" CreationDate="2015-08-26T17:41:15.810" Score="3" ViewCount="9753" Body="&lt;p&gt;I am searching for documentation on the behaviour of complex low pass filters, and their application in telecommunications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="11285" LastActivityDate="2017-09-07T12:06:08.973" Title="Complex low pass filters" Tags="|filters|filter-design|lowpass-filter|digital-filters|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25446" PostTypeId="1" CreationDate="2015-08-26T19:47:27.063" Score="6" ViewCount="4855" Body="&lt;p&gt;I need to detect the time window where a 1D-signal is above a certain threshold. If it dips below the threshold briefly I'd like to merge the two windows, if it dips below for a longer time, split them. The data are received digitally as array $S[t]$ with equally-spaced $t$ intervals and represent precipitation forecasts from a weather model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find $t_{on}$ / $t_{off}$ in signals like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IA1Ku.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IA1Ku.png&quot; alt=&quot;signal example&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ItBBi.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ItBBi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this isn't terribly hard and I can probably come up with an algorithm myself, but I thought this is a problem that smarter people than me have already thought about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm will be implemented in software and run on general-purpose datacenter servers (no specialised hardware). It doesn't have to be crazy fast, &quot;reasonable&quot; is good enough (we have a few 100k time series to process at once every now and then; each series has probably less then 1000 points).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd welcome algorithm suggestions, Google keywords, book/article recommendations. I'm rather new to data processing, in case it isn't blatantly obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;Thanks everyone for the great comments and answers. This question really couldn't have turned out much better. What I'm worrying about the most is how to handle pathological cases, like &quot;oscillations&quot; around the threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HcKxD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HcKxD.png&quot; alt=&quot;Oscillation1&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JwIlS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JwIlS.png&quot; alt=&quot;Oscillation2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My own idea was having separate on/off-thresholds, with $ thresh_{off} = f * thresh_{on} $ (with $f$ in the range of [0.5, 0.99]). I also really like Marten's idea of temporarily modifying the threshold value after the signal crosses the threshold in a hysteresis-like manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there other strategies to handle this issue that I should know about?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there other potential issues that I need to know about?&lt;/p&gt;&#xA;" OwnerUserId="17150" LastEditorUserId="17150" LastEditDate="2015-08-29T02:57:50.983" LastActivityDate="2018-11-14T10:54:10.987" Title="Algorithm for detecting the time where the signal is above a threshold" Tags="|algorithms|signal-detection|time-series|" AnswerCount="3" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="25447" PostTypeId="2" ParentId="25444" CreationDate="2015-08-26T19:57:53.667" Score="8" Body="&lt;p&gt;A low pass filter has a frequency response that satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(\omega)|\approx 0,\quad |\omega|&amp;gt;\omega_c\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_c$ is the cut-off frequency. A complex low pass filter must also satisfy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(\omega)\neq H^*(-\omega)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which causes its impulse response to be complex-valued. So the frequency response of a complex low pass filter is characterized by Eqs $(1)$ and $(2)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In discrete-time, you have the usual convolution sum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=-\infty}^{\infty}h[k]x[n-k]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y[n]$ is the output sequence, $x[n]$ is the input sequence, and $h[n]$ is the filter's impulse response. Note that all sequences in $(3)$ are generally complex-valued. If you split up (3) into its real and imaginary part you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_R[n]=\sum_{k=-\infty}^{\infty}\left(h_R[k]x_R[n-k]-h_I[k]x_I[n-k]\right)\\&#xA;y_I[n]=\sum_{k=-\infty}^{\infty}\left(h_R[k]x_I[n-k]+h_I[k]x_R[n-k]\right)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the subscripts $_R$ and $_I$ denote the real and imaginary parts, respectively. From $(4)$ you see that you have to implement two filters, one with impulse response $h_R[n]$ and the other with impulse response $h_I[n]$, and that you have to filter the real part as well as the imaginary part of the input signal with both filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for applications in digital communications, anywhere where you have in-phase and quadrature components, you can model these two signals as a complex signal, and any filtering on this complex signal requires a complex filter (or, at least, a filter with complex input and output). However, in practice you most often encounter two special cases:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The filter is actually real-valued but has a complex input and output, i.e. you simply filter the real and imaginary parts of the input signal independently with the same filter. In Eq. $(4)$ that means that $h_I[n]=0$. This is the case when you apply a low pass filter after complex demodulation. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The filter is complex-valued but the input signal is real-valued, so you filter one (real-valued) signal with two filters (the real and imaginary parts of the impulse response). In Eq. $(4)$ that means that $x_I[n]=0$. This occurs when you filter a real-valued passband signal with an analytic band pass filter &lt;em&gt;before&lt;/em&gt; complex demodulation. (Note that here the filter is a band pass, not a low pass).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A complete complex filtering operation with complex-valued inputs and outputs, &lt;em&gt;and&lt;/em&gt; a complex impulse response (as specified by Eq. $(4)$) is used for modelling a digital communication system using an equivalent discrete-time baseband channel. The corresponding baseband channel filter is generally complex-valued.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-06-16T07:25:34.457" LastActivityDate="2016-06-16T07:25:34.457" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25448" PostTypeId="2" ParentId="25444" CreationDate="2015-08-26T22:12:52.707" Score="4" Body="&lt;p&gt;Your question is sensible. Assuming you're talking about tapped-delay line FIR filters, studying complex-valued FIR filters will teach you a lot about both real- and complex-valued FIR filters. Stating Matt L.'s correct Eq. (2) in words, the freq response of a complex-valued FIR filter is not conjugate-symmetric. This means the filter's magnitude response does not exhibit mirror-image symmetry centered at zero Hz, as do real-valued FIR filters. As Matt L. says, complex FIR filters are generally bandpass filters rather than lowpass filters. As for the time-domain impulse response behavior of complex-valued FIR filters, I discuss that little-known topic in my blog titled: &quot;The Most Interesting FIR Filter Equation in the World&quot; at: &lt;a href=&quot;http://www.dsprelated.com&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com&lt;/a&gt;. Have a look at that blog.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-26T22:12:52.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25449" PostTypeId="2" ParentId="25446" CreationDate="2015-08-26T22:59:02.010" Score="0" Body="&lt;p&gt;Assuming you're working with discrete samples, it seems to me that you must execute two separate tests on your time-domain samples. One test is 'thresholding–in-amplitude' and the other test is 'thresholding–in-time-duration'. Let's assume your complete data sequence contains three wide amplitude peaks that exceed your amplitude threshold. Test# 1 is measuring time instants t_on_1, t_off_1, t_on_2, t_off_2, t_on_3, and t_off_3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Test#2 is measuring the two &quot;dip&quot; time intervals between your three peaks: dip_1 = (t_on_2 -t_off_1) and dip_2 = (t_on_3 -t_off_2). Then you must determine if either of the two &quot;dip&quot; time intervals is less than some specified time-duration threshold.  And if, for example, the &quot;dip&quot; time interval between the 2nd and 3rd peaks is too small (value dip_2 is less than the specified time-duration threshold) then you set t_off_2 = t_off_3 and discard the &lt;em&gt;original&lt;/em&gt; measured t_off_2, t_on_3, and t_on_3 values.  Finally you can claim your data sequence had only two amplitude peaks. Hope that makes sense.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-26T22:59:02.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25453" PostTypeId="1" AcceptedAnswerId="25459" CreationDate="2015-08-27T03:51:42.463" Score="1" ViewCount="208" Body="&lt;p&gt;In order to find a peak or max response in the fourier domain as in the spatial domain, I have been studying bartlett's method, welch's method, and the blackman-tukey method for more accurate power spectrum analysis after correlating two functions together in the fourier domain as depicted in this &lt;a href=&quot;http://dsp-book.narod.ru/302.pdf&quot; rel=&quot;nofollow&quot;&gt;document&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I had a few questions after reading, which I could not find in any book nor online&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) For the Bartlett method (page 11 of the pdf) what determines the value of k, or is it arbitraty. And following that, does the accuracy of the power spectrum analysis go up if k is higher, and vice versa&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) Same question as 1) but for the welch method (page 12 of the pdf)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3) For the blackman-tukey method (page 14 of the pdf), will i get the same result if I window the signal in the spatial domain, but then do the autocorrelation in the fourier domain?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="16673" LastActivityDate="2015-08-27T12:24:05.183" Title="Power Spectrum Analysis" Tags="|autocorrelation|power-spectral-density|correlation|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25454" PostTypeId="2" ParentId="25165" CreationDate="2015-08-27T05:28:33.633" Score="0" Body="&lt;p&gt;Have you had a look at &lt;a href=&quot;https://github.com/mne-tools/mne-python&quot; rel=&quot;nofollow noreferrer&quot;&gt;mne-python&lt;/a&gt;? It has routines for &lt;a href=&quot;https://github.com/mne-tools/mne-python/blob/60668ecb14917f2407c154faf57d7c0b9aedb0c0/mne/time_frequency/tfr.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;inter-trail PL-factor&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def _induced_power_cwt(data, sfreq, frequencies, use_fft=True, n_cycles=7,&#xA;                       decim=1, n_jobs=1, zero_mean=False):&#xA;    &quot;&quot;&quot;Compute time induced power and inter-trial phase-locking factor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Separately, this &lt;a href=&quot;https://github.com/mne-tools/mne-python/blob/0a49b494f9f3078c1aeba943318d2c9df6f26232/mne/connectivity/spectral.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral connectivity routine&lt;/a&gt; provides for PLV:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    'plv' : Phase-Locking Value (PLV) [2]_ given by: PLV = |E[Sxy/|Sxy|]|&#xA;&#xA;    class _PLVEst(_EpochMeanConEstBase):&#xA;     &quot;&quot;&quot;PLV Estimator&quot;&quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is an example from their &lt;a href=&quot;http://martinos.org/mne/stable/auto_examples/time_frequency/plot_source_label_time_frequency.html#example-time-frequency-plot-source-label-time-frequency-py&quot; rel=&quot;nofollow noreferrer&quot;&gt;examples page&lt;/a&gt;, computing power and phase lock in source space:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MjBvS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MjBvS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="11372" LastEditDate="2015-08-27T14:44:13.350" LastActivityDate="2015-08-27T14:44:13.350" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25456" PostTypeId="1" CreationDate="2015-08-27T08:02:56.073" Score="3" ViewCount="22527" Body="&lt;p&gt;I would like to convert FFT data which is set of 396 values for 396 frequencies (from 4Hz to 399Hz by 1Hz) in unit of g's (gravitational akcceleration) to PSD in unit of (g^2)/Hz, is it possible? Thank you for your help.&lt;/p&gt;&#xA;" OwnerUserId="17155" LastActivityDate="2022-08-17T18:44:33.047" Title="Conversion of FFT to PSD" Tags="|fft|power-spectral-density|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25457" PostTypeId="1" AcceptedAnswerId="25462" CreationDate="2015-08-27T08:45:13.067" Score="0" ViewCount="272" Body="&lt;p&gt;What is the name/family behind the following high-pass IIR filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;T = 1/f_s \\&#xA;f_c = 5 \\&#xA;c_1 = \displaystyle \frac{1}{1 + \tan(\pi f_cT)}\\&#xA;c_2 = \displaystyle \frac{1 - \tan(\pi f_cT)}{1 + \tan(\pi f_cT)} \\&#xA;b = \left[c_1, -c_1\right] \\&#xA;a = \left[1, -c_2\right]&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $f_s$ is the sampling rate and $f_c$ the cut-off frequency.&lt;/p&gt;&#xA;" OwnerUserId="390" LastEditorUserId="1629" LastEditDate="2015-08-27T21:32:58.400" LastActivityDate="2015-08-27T21:32:58.400" Title="What is the name of the following 1st order high-pass IIR filter?" Tags="|filter-design|infinite-impulse-response|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25459" PostTypeId="2" ParentId="25453" CreationDate="2015-08-27T12:24:05.183" Score="0" Body="&lt;p&gt;Hopefully you understand why and in what situations those methods are used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The integer 'K' in the Bartlett and Welch methods is not arbitrary.  The value of 'K' is a &quot;trade off&quot; that you must make. In both methods, the greater is 'K&quot; the lower is the variance in your final DFT results. That's a good thing. What the PSD's author doesn't tell you, though, is that the greater is 'K&quot; the larger is your final DFT result's frequency-domain sample-to-sample spacing (measured in Hz). And that's usually a bad thing. So you must decide what value of 'K' is acceptable to you. I'm not qualified to comment on the Blackman-Tukey method.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-08-27T12:24:05.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25460" PostTypeId="2" ParentId="25408" CreationDate="2015-08-27T12:29:21.750" Score="0" Body="&lt;p&gt;The answer to the question I think is the parameter &lt;em&gt;s&lt;/em&gt; in the definition of the wavelet analysis equation, i.e., the parameter that controls the resolution at which you apply the function. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The analysis equation points to the fact that the wavelet needs to be applied at different time-scales which is realized in discrete domain via decimation. So in order to transform a signal, you need to apply the wavelet at different decimation stages, depending on the value of &lt;em&gt;s&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now let us move to the filter banks. Filter bank approach is an efficient way of splitting a signal into various bands. To give a simple example, suppose you want to split a 1MHz signal into 4 bands, each with 0.25MHz bandwidth. Brute force, you design four filters, apply the 1MHz signal to each filter and you are done. If you apply multi-rate signal processing theory, you need to design only one filter (like one mother wavelet) and apply decimated copies of signal  to the filter (like the decimation you do in wavelet analysis) and get output at 1/4th the input rate (different time scale than the input). Now you can see there is a strong correlation between how wavelets are applied and how filter banks are applied. And you can actually use the multi-rate signal processing theory to do wavelet analysis. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;&#xA;I might have over simplified the theory to get the point through. The example attempts to provide the answer to you question but by now mean gives the complete picture of either wavelet or multi-rate signal processing theory. &lt;/p&gt;&#xA;" OwnerUserId="8832" LastActivityDate="2015-08-27T12:29:21.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25461" PostTypeId="2" ParentId="24927" CreationDate="2015-08-27T12:51:19.607" Score="1" Body="&lt;p&gt;The autocorrelation function should have positive and negative values and you could find the frequency by averaging the zero crossings over the observation time.&lt;/p&gt;&#xA;" OwnerUserId="17142" LastActivityDate="2015-08-27T12:51:19.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25462" PostTypeId="2" ParentId="25457" CreationDate="2015-08-27T13:32:47.830" Score="4" Body="&lt;p&gt;This is a first-order discrete-time Butterworth filter, which can be obtained via the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;nofollow&quot;&gt;bilinear transform&lt;/a&gt; from the following analog prototype filter (with normalized cut-off frequency):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s)=\frac{s}{1+s}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bilinear transform replaces $s$ by $k\frac{z-1}{z+1}$, where $k$ is chosen such that the discrete-time filter has the specified cut-off frequency $f_c$, resulting in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$k=\frac{1}{\tan(\pi f_c T)}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T=1/f_s$ is the sampling interval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you replace $s$ in $(1)$ by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s=\frac{1}{\tan(\pi f_c T)}\frac{z-1}{z+1}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you obtain the corresponding discrete-time filter with the coefficients given in your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, here is how you obtain your final coefficients. Let $a=\tan(\pi f_c T)$. Plugging $(3)$ into $(1)$ then gives for the transfer function of the discrete-time filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}G(z)=\frac{\frac{1}{a}\frac{z-1}{z+1}}{1+\frac{1}{a}\frac{z-1}{z+1}}&amp;amp;=\frac{z-1}{a(z+1)+z-1}\\&amp;amp;=\frac{z-1}{(1+a)z-(1-a)}\\&amp;amp;=\frac{1}{1+a}\frac{z-1}{z-\frac{1-a}{1+a}}\end{align}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is exactly in the given form with $c_1=1/(1+a)$ and $c_2=(1-a)/(1+a)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-08-27T15:22:30.513" LastActivityDate="2015-08-27T15:22:30.513" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25463" PostTypeId="1" CreationDate="2015-08-27T13:48:39.353" Score="3" ViewCount="124" Body="&lt;p&gt;Anybody know of a proof of the hard upper frequency limit of active noise cancellation using the ear canal volume as a boundary condition to solve for the upper frequency limit? I keep on encountering 1kHz as the upper limit in practice.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-08-27T23:39:52.667" Title="Proof from wave equation of upper limit of active noise cancellation" Tags="|dsp-core|acoustics|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25464" PostTypeId="2" ParentId="25456" CreationDate="2015-08-27T15:43:07.933" Score="2" Body="&lt;p&gt;If X is your fft data then you need to take &lt;code&gt;Y=abs(X).^2;&lt;/code&gt; to convert it. Your frequency axis is &lt;code&gt;f=4:399;&lt;/code&gt;. You can plot the result then using &lt;code&gt;plot(f,Y)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="17142" LastActivityDate="2015-08-27T15:43:07.933" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25465" PostTypeId="1" AcceptedAnswerId="25467" CreationDate="2015-08-27T15:51:52.053" Score="1" ViewCount="1470" Body="&lt;p&gt;I am a novice in signal processing. I am writing a code to apply the hamming window to a sinusoidal signal. So first I have digitized my sinusoidal signal by choosing a sampling rate more than twice its frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the values for the signal: F=500 Hz, T=2 ms, and sampling rate=2000 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I guess I have to multiply the function of the window to the signal so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (i=0; i&amp;lt;windowSize; i++)&#xA;     data(i)=signal(i)*window(i)&#xA;     i=i+0.5;  //sampling time&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is when we multiply the window to the signal, does the window function has to be digitized by the sampling rate of the signal or it can be digitized anyway we want? In the code I have digitized the window function according to the sampling rate. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="17157" LastEditorUserId="7338" LastEditDate="2015-08-28T07:32:35.540" LastActivityDate="2015-08-28T15:26:48.827" Title="Apply the Hamming window to a sinusoidal signal" Tags="|window-functions|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25466" PostTypeId="2" ParentId="25465" CreationDate="2015-08-27T16:07:42.817" Score="1" Body="&lt;p&gt;The window isn't &quot;sampled&quot; as it isn't a signal, really.  It's a vector that you construct, and it doesn't matter how you construct it.  The window vector just has to be the same length as your signal vector.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-08-27T16:07:42.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25467" PostTypeId="2" ParentId="25465" CreationDate="2015-08-27T16:12:11.270" Score="0" Body="&lt;p&gt;Generally, you're better of just indexing via integers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (i=0; i&amp;lt;windowsize; i++)&#xA;  data(i)=signal(i)*window(i)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and keeping track of actual times separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @CMDoolittle says, the window isn't really a signal so it's not really sampled.  And most window definitions just assume that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function#Hamming_window&quot; rel=&quot;nofollow noreferrer&quot;&gt;window is integer indexed&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dTLw9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dTLw9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-27T16:12:11.270" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="25468" PostTypeId="1" CreationDate="2015-08-24T13:05:32.763" Score="3" ViewCount="374" Body="&lt;p&gt;I'm trying to analyze the probability of detection (&lt;span class=&quot;math-container&quot;&gt;$P_d$&lt;/span&gt;) for a &lt;a href=&quot;https://en.wikipedia.org/wiki/Chi-squared_target_models#Swerling_II&quot; rel=&quot;nofollow noreferrer&quot;&gt;Swerling II&lt;/a&gt; target. I know that the Swerling II target assumes that the Radar Cross Section (RCS) is an exponential probability density function, and that the RCS fluctuates from pulse-to-pulse.&lt;/p&gt;&#xA;&lt;p&gt;My question is: Do the Swerling models assume perfect decorrelation from pulse-pulse? As in, do they assume that the RCS on each pulse is purely independent of other pulses, or do they account for some correlation?&lt;/p&gt;&#xA;&lt;p&gt;The target I'm trying to analyze does not perfectly decorrelate between pulses. So, the RCS on pulse #2 will be somewhat correlated to that on pulse #1.&lt;/p&gt;&#xA;" OwnerUserId="17128" OwnerDisplayName="Rob" LastEditorUserId="7092" LastEditDate="2022-01-17T01:44:46.163" LastActivityDate="2023-10-09T06:02:00.277" Title="Probability of Detection and pulse-pulse decorrelation time" Tags="|radar|detection|pulse|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="25471" PostTypeId="2" ParentId="25442" CreationDate="2015-08-27T17:55:56.277" Score="0" Body="&lt;p&gt;To 1.&#xA;From the channel impulse response you can build the channel matrix and then compute the ZF equalizer coefficients using the pseudo inverse of the channel matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the ZF coefficients you can convolve them with the received signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To 2.&#xA;I guess you are referring here to a PNC system. The best solution is to use OFDM to solve this problem. In this case, you can use Maximum Likelihood detection per subcarrier by checking which combination minimises the Euclidean distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To 3.&#xA;You can find the equations for ZF equalizer in the book by J. Kurzweil, An Introduction to Digital Communications, 1st Edition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, the performance of the time-domain ZF equalizer is not very good in frequency selective channels. You are better off with the decision feedback&#xA;equalizer. &lt;/p&gt;&#xA;" OwnerUserId="17142" LastActivityDate="2015-08-27T17:55:56.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25472" PostTypeId="1" CreationDate="2015-08-27T18:23:30.120" Score="0" ViewCount="30" Body="&lt;p&gt;What exactly hidden markov model does in speech recognition process? I read it is the representation of phonemes as states? What exactly is a state? Any detail article on HMM role in speech recognition process will be helpful.&lt;/p&gt;&#xA;" OwnerUserId="17129" LastActivityDate="2015-08-27T18:23:30.120" Title="Role of HMM in speech recognition" Tags="|speech-recognition|hmm|" AnswerCount="0" CommentCount="3" ClosedDate="2015-08-27T18:56:15.020" ContentLicense="CC BY-SA 3.0" />
  <row Id="25473" PostTypeId="2" ParentId="25463" CreationDate="2015-08-27T23:39:52.667" Score="2" Body="&lt;p&gt;I don't have a mathematical proof for you, but here are 2 issues to think about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impulse response from the actuator (speaker) to the error measurement (microphone) is non-minimum phase. This is unavoidable because it takes a non-zero amount of time for an acoustic wave to travel from the speaker to the microphone. In a digital system there is additional latency introduced because you cant instantaneously sample, process, and output a signal. This latency limits your cancellation bandwidth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other issue is that even if you had a super low latency system and could get cancellation up to 10kHz it would still only be cancelling noise at the error microphone. At 10kHz your wavelength is about 3.4cm. The distance from the error microphone to the eardrum is a sizable portion of this wavelength, which means that whatever cancellation you thought you had at 10kHz is gone, and you might even be boosting now. So your perceived cancellation is limited by how accurately your microphone measurement approximates the sound field at the eardrum.&lt;/p&gt;&#xA;" OwnerUserId="11618" LastActivityDate="2015-08-27T23:39:52.667" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25474" PostTypeId="1" CreationDate="2015-08-28T05:05:54.667" Score="0" ViewCount="296" Body="&lt;p&gt;I would like to design an FIR filter such that its Z-transform has a certain profile in certain regions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I'd like to have an FIR filter that nulls the decaying exponential $\left(\frac{1}{2} \right)^n$, I can simply put a zero at $z = \frac{1}{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is there a more systematic way of designing such filter for arbitrary Z-transform response? Something similar to the Remez algorithm or maybe using convex optimization? So far all the papers I've looked at online looks at responses on the unit circle only.&lt;/p&gt;&#xA;" OwnerUserId="17163" LastEditorUserId="8202" LastEditDate="2015-08-28T10:46:27.837" LastActivityDate="2015-08-28T11:37:58.117" Title="FIR filter design for response inside unit circle" Tags="|filters|discrete-signals|filter-design|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25475" PostTypeId="2" ParentId="25436" CreationDate="2015-08-28T10:13:02.700" Score="3" Body="&lt;p&gt;Starting from your $E_2$ and exchanging the finite sum with the integral we get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_2=\sum_{i=1}^N \int_\Omega f_i(x) u_i(x) dx = \int_\Omega \sum_{i=1}^N f_i(x) u_i(x) dx$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next we can use the disjoint cover $\{\Omega_i\}$ of $\Omega$ to split up the integral:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_2 = \sum_{k=1}^N \int_{\Omega_k} \sum_{i=1}^N f_i(x) u_i(x) dx$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $x$ in the integral are now from $\Omega_k$ and we can apply your identity for the sum over $f_i(x) u_i(x)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_2 = \sum_{k=1}^N \int_{\Omega_k} f_k(x) dx$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is almost your $E_1$, but not quite. We cannot exchange the integral with the sum because the integral depends on the summation index. Extending the integration region to $\Omega$ is also not possible without reintroducing a selection function. So your $E_1$ and $E_2$ are not equal. The closest thing to $E_1$ is what I have derived above.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-08-28T10:13:02.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25476" PostTypeId="2" ParentId="25474" CreationDate="2015-08-28T11:37:58.117" Score="1" Body="&lt;p&gt;Note that an FIR filter's transfer function is completely determined by its behavior on the unit circle (or any other closed contour). So if you were to define a desired $\mathcal{Z}$-transform (instead of a desired frequency response on the unit circle), you could just evaluate this desired transfer function on the unit circle and use one of the many standard design procedures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it were convenient for you to specify a desired response on a circle in the $z$-plane with radius $r$, you could also just use a standard frequency domain design procedure, and obtain your final coefficients by computing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=r^{n}\tilde{h}[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\tilde{h}[n]$ are the coefficients obtained from the standard design procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course you can also directly specify the desired zeros in the complex plane, as mentioned in Jason's comment. Note that you can't specify the poles because for a causal FIR filter they must lie in the origin of the $z$-plane.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-28T11:37:58.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25477" PostTypeId="2" ParentId="25446" CreationDate="2015-08-28T11:40:22.613" Score="2" Body="&lt;p&gt;For discarding events where the signal is not very different from the threshold (special case: oscillation), have you considered using a hysteresis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the signal rises above the threshold ($t_{on}$-event), temporarily &lt;em&gt;decrease&lt;/em&gt; the threshold (by either a factor (a few percent) or an absolute value, the best value will depend on the your system/model). This way, it is 'harder' for the signal to drop below the threshold again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever the signal drops below the decreased threshold (the $t_{off}$-event), immediately revert the threshold to its original value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very effective (and often used) way of preventing oscillation and bouncing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if a peak or dip is very short (shorter than the defined minimum duration), but also very high in amplitude, do you consider it &quot;irrelevant&quot;? This method solves that problem is well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; To clarify it a bit more, here is one of your pictures that I have added to, to show the hysteresis principle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dMpqc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dMpqc.png&quot; alt=&quot;principle of hysteresis with two separate threshold values for the on and off events&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The blue horizontal line is the secondary threshold. $t_{on}$ occurs at time $A$, as expected. Since the signal does not drop below the second threshold (although it &lt;em&gt;does&lt;/em&gt; drop below the original threshold), $t_{off}$ only occurs at time $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hard part is to find the proper values of both thresholds. It is perhaps good to even increase the original threshold a bit, to avoid too long 'on'-durations. This totally depends on the system of interest.&lt;/p&gt;&#xA;" OwnerUserId="17166" LastEditorUserId="17166" LastEditDate="2015-08-29T06:42:35.710" LastActivityDate="2015-08-29T06:42:35.710" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25478" PostTypeId="2" ParentId="25446" CreationDate="2015-08-28T12:22:35.927" Score="6" Body="&lt;p&gt;There is a book by &lt;a href=&quot;http://people.irisa.fr/Michele.Basseville/kniga/kniga.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Basseville and Nikiforov called &quot;Detection of Abrupt Changes : Theory and Application&quot;&lt;/a&gt; that they released to the public as a PDF several years ago (it's out of print, now, I believe).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That book looks at the basic &lt;a href=&quot;https://en.wikipedia.org/wiki/CUSUM&quot; rel=&quot;nofollow noreferrer&quot;&gt;CUSUM (cumulative sum) algorithm&lt;/a&gt; and how to choose appropriate thresholds for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GhvFn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GhvFn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="38837" LastEditDate="2018-11-14T10:54:10.987" LastActivityDate="2018-11-14T10:54:10.987" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25479" PostTypeId="1" AcceptedAnswerId="25486" CreationDate="2015-08-28T14:24:21.910" Score="3" ViewCount="1704" Body="&lt;p&gt;I want to learn the computational complexity of the 2D Discrete Haar (Wavelet) Transform (DHWT). The number of operations (divisions, summations etc.) is the main focus. I think there are many different ideas on that. There are even papers claiming that we do not need any multiplications for it. I am confused. Any help? Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I should have added the orthogonality requirement for the Haar transform.&lt;/p&gt;&#xA;" OwnerUserId="17168" LastEditorUserId="17168" LastEditDate="2015-08-29T09:19:33.233" LastActivityDate="2016-01-26T15:10:03.157" Title="2D Haar Transform Computational Complexity" Tags="|image-processing|transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25480" PostTypeId="2" ParentId="25465" CreationDate="2015-08-28T15:26:48.827" Score="1" Body="&lt;p&gt;You can also use a more efficient way to program this by vectorizing the for loop, e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T=2e-3;&#xA;F=500;&#xA;fs=2000;&#xA;N=round(T*fs);&#xA;n=0:N-1;&#xA;signal=sin(2*pi*F*n/fs);&#xA;a=0.54;&#xA;b=1-a;&#xA;w=a-b*cos(2*pi*n/(N-1));&#xA;data=w.*signal;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17142" LastActivityDate="2015-08-28T15:26:48.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25481" PostTypeId="2" ParentId="25479" CreationDate="2015-08-28T16:30:35.617" Score="2" Body="&lt;p&gt;This is just to address the lack of multiplications:  why would there be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nqFQk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nqFQk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients of the Haar wavelet (in 1D or 2D) are always +1 or -1.  There is no point in doing a multiplication to find the value or its negative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cs.toronto.edu/~kyros/courses/320/Lectures.2013s/lecture.2013s.10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Check out these notes,&lt;/a&gt; particularly this page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iYI9v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iYI9v.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-28T16:30:35.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25482" PostTypeId="1" AcceptedAnswerId="25493" CreationDate="2015-08-28T17:03:35.840" Score="1" ViewCount="371" Body="&lt;p&gt;Here is a sample image. &#xA;&lt;img src=&quot;https://i.stack.imgur.com/ge4HU.jpg&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am looking to do is compute the dominant &quot;wrinkle&quot; directions.&#xA;The dominant wrinkle directions can be seen in the following FFT, roughly, by drawing a line through the highest valued set of points in the spectrum.&#xA;&lt;img src=&quot;https://i.stack.imgur.com/TMIE5.png&quot; alt=&quot;fft&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been told that a potential way to find this direction would be to look at the auto-correlation &lt;code&gt;scipy.signal.correlate2d&lt;/code&gt;.&#xA;I have not worked with this tool before, so I want to make sure my idea is correct. &#xA;The way that I think this will work is by using the FFT data to find the largest components of the signal. &#xA;Say for example, I look at the largest two components. &#xA;I can construct two images, one for each of the largest components, lets call the images &lt;code&gt;dominant1&lt;/code&gt; and &lt;code&gt;dominant2&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each image, I could then look at:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;scipy.signal.correlate2d(image,dominant1) &#xA;scipy.signal.correlate2d(image,dominant2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe that this will return a matrix that shows where the features are in the &lt;code&gt;image&lt;/code&gt; that most agree with the signals &lt;code&gt;dominant1&lt;/code&gt; and &lt;code&gt;dominant2&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this interpretation is correct, I am still unsure of how to extract the &lt;code&gt;dominant_angle1&lt;/code&gt; and &lt;code&gt;dominant_angle2&lt;/code&gt; say. Suppose that the horizontal direction in the image as shown above is &lt;code&gt;x&lt;/code&gt; and the vertical is &lt;code&gt;y&lt;/code&gt;. I would like &lt;code&gt;dominant_angle1/2&lt;/code&gt; to be the angle off of the x-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any comments, suggestions for better approaches, will be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="15201" LastActivityDate="2016-04-25T09:59:28.797" Title="Extracting direction of dominant sinusoids from an image in terms of angles" Tags="|autocorrelation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25483" PostTypeId="1" AcceptedAnswerId="25484" CreationDate="2015-08-28T17:50:58.860" Score="0" ViewCount="3726" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dunDQ.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dunDQ.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;I have written a script to plot the frequency spectrum of a sinusoidal signal with c++. Here are the steps&#xA;1-Applying Hanning window&#xA;2-Apply FFT using fftw3 library&#xA;I have three graphs: Signal, Signal when is multiplied to Hanning function, and the frequency spectrum. The frequency spectrum looks wrong. It should have a pick at 50 Hz.Any suggestion would be appreciated. Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;time.h&amp;gt;&#xA;#include &amp;lt;fftw3.h&amp;gt;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;#include &amp;lt;cmath&amp;gt;&#xA;#include &amp;lt;fstream&amp;gt;&#xA;using namespace std;&#xA;&#xA;int main()&#xA;{&#xA;int i;&#xA;double y;&#xA;int N=50;&#xA;double Fs=1000;//sampling frequency&#xA;double  T=1/Fs;//sample time &#xA;double f=50;//frequency&#xA;double *in;&#xA;fftw_complex *out;&#xA;double t[N];//time vector &#xA;double ff[N];&#xA;fftw_plan plan_forward;&#xA;&#xA;in = (double*) fftw_malloc(sizeof(double) * N);&#xA;out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);&#xA;&#xA; for (int i=0; i&amp;lt; N;i++)&#xA; {&#xA;    t[i]=i*T;&#xA;    ff[i]=1/t[i];&#xA;    in[i] =0.7 *sin(2*M_PI*f*t[i]);// generate sine waveform&#xA;    double multiplier = 0.5 * (1 - cos(2*M_PI*i/(N-1)));//Hanning Window&#xA;    in[i] = multiplier * in[i];&#xA;  }&#xA;&#xA;  plan_forward = fftw_plan_dft_r2c_1d ( N, in, out, FFTW_ESTIMATE );&#xA;&#xA;  fftw_execute ( plan_forward );&#xA;&#xA;  double v[N];&#xA;&#xA;  for (int i = 0; i &amp;lt; N; i++)&#xA;    {&#xA;&#xA;    v[i]=20*log(sqrt(out[i][0]*out[i][0]+ out[i][1]*out[i][1])/N/2);//Here I have calculated the y axis of the spectrum in dB&#xA;&#xA;    }&#xA;&#xA;   fstream myfile;&#xA;&#xA;   myfile.open(&quot;example2.txt&quot;,fstream::out);&#xA;&#xA;   myfile &amp;lt;&amp;lt; &quot;plot '-' using 1:2&quot; &amp;lt;&amp;lt; std::endl;&#xA;&#xA;   for(i = 0; i &amp;lt; N; ++i)&#xA;&#xA;    { &#xA;&#xA;      myfile &amp;lt;&amp;lt; ff[i]&amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; v[i]&amp;lt;&amp;lt; std::endl;&#xA;&#xA;    }&#xA;&#xA; myfile.close();&#xA;&#xA; fftw_destroy_plan ( plan_forward );&#xA; fftw_free ( in );&#xA; fftw_free ( out );&#xA; return 0;&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have to add that I have plotted the graphs using gnuplot after inserting the results into example2.txt. So ff[i] vs v[i] should give me the frequency spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the plots: &lt;a href=&quot;https://i.stack.imgur.com/wPxFU.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wPxFU.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;  Frequency Spectrum and Sinusoidal time Window respectively:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/2Ei58.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2Ei58.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: After applying the changes to frequency sampling, this is the graph I got:&lt;a href=&quot;https://i.stack.imgur.com/aVfTr.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aVfTr.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Edit: The first graph is the plot for frequency spectrum vs time&lt;/p&gt;&#xA;" OwnerUserId="17157" LastEditorUserId="17157" LastEditDate="2015-08-28T18:48:10.283" LastActivityDate="2015-08-31T12:56:51.707" Title="Frequency Spectrum with c++" Tags="|frequency-spectrum|spectrogram|c++|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25484" PostTypeId="2" ParentId="25483" CreationDate="2015-08-28T18:13:17.050" Score="0" Body="&lt;p&gt;You seem to be doing something odd with your frequency axis. This:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t[i]=i*T;&#xA;ff[i]=1/t[i];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;should probably read:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t[i]=i*T;&#xA;ff[i]=Fs*i/N;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The frequency axis you have now is nonlinear. The FFT generally generates linearly spaced frequency samples.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-28T18:13:17.050" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="25485" PostTypeId="1" AcceptedAnswerId="25487" CreationDate="2015-08-28T20:46:46.803" Score="1" ViewCount="475" Body="&lt;p&gt;I'm trying to create a filterbank whose frequency response is generally flat when summed in parallel. Are there any tips to choosing center frequencies and bandwidths for a filterbank of overlapping bandpass filters? Does a gammatone filterbank sum up to a flat response?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-08-29T14:00:32.520" Title="Creating a flat spectrum filterbank" Tags="|filters|audio|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25486" PostTypeId="2" ParentId="25479" CreationDate="2015-08-28T23:38:27.160" Score="1" Body="&lt;p&gt;Roughly $N_{\mathrm{op}} = 8\times 4^N/3$ or  $N_{\mathrm{op}} = 16\times 4^N/3$. Let us first  focus on &quot;There are even papers claiming that we do not need any multiplications for it.&quot; and suppose you would like to avoid them. Finally, you can save a little if you abandon orthonormality, even linearity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most basic implementation of the Haar wavelet takes $p_0$ and $p_1$ and computes $d = p_0-p_1$ and $a=p_0+p_1$. Apply that horizontally and vertically on a block of four pixels, you need 8 $\pm$. So on a $2^N \times 2^N$ image, you have $2^{N-1} \times 2^{N-1}$ blocks you need $8\times 2^{N-1} \times 2^{N-1} \pm$. On the next level, you iterate on only one low-pass $ 2^{N-1} \times 2^{N-1} $ image, and get $8\times 2^{N-2} \times 2^{N-2} \pm$ more. Down to $J$ levels, you get roughly $$N_{\mathrm{op}\pm} = 8\times 4^N(1-4^{-J})/3 \quad \pm (\mathrm{plus}\;\mathrm{or}\;\mathrm{minus})$$ overall. This transform is not orthonormal, and the $\pm$  may yield too-high amplitude on limited arithmetic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another implementation is sometimes termed S+P transform (Sequential + Prediction or Said+Pearlman) or lifting Haar wavelet, and uses a different normalization on the low-pass coefficient. Take again $p_0$ and $p_1$ and computes $d = p_0-p_1$ and $a=p_1+d/2$. At first you add a divide, but it is a binary shift per two $\pm$, it does not cost much. What you gain here is that computations can be performed in place:  $p_0 = p_0-p_1$ and $p_1=p_1+p_0/2$. Which could be useful in application where memory costs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;None of them use multiplies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want orthonormality, using divisions by $\sqrt{2}$, then you can add as much multiplies/division as additions/subtractions. The reason is: you know compute $d = (p_0-p_1)/\sqrt{2}$ and $a=(p_0+p_1)/\sqrt{2}$, so for each add or substract, you have one more multiply/divide. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some other tricks may save you operations, but only quite few in comparison of the above numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, all of this should be balanced with material properties: acceleration, parallelization, CPU/GPU tricks, SIMD instructions can improve the above figures in practice.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-10-28T14:01:17.187" LastActivityDate="2015-10-28T14:01:17.187" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25487" PostTypeId="2" ParentId="25485" CreationDate="2015-08-29T00:07:15.437" Score="2" Body="&lt;p&gt;There exist &lt;a href=&quot;http://www.dsprelated.com/freebooks/sasp/Perfect_Reconstruction_Filter_Banks.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;perfect reconstruction filter banks&lt;/a&gt; that do what you suggest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4d1va.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4d1va.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example of the choice of $H_i(z)$ for $i= 0 \ldots N-1$ is the FFT filters (followed by the IFFT filters $F_i(z)$).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-29T00:07:15.437" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25489" PostTypeId="1" AcceptedAnswerId="25492" CreationDate="2015-08-29T02:40:26.140" Score="3" ViewCount="331" Body="&lt;p&gt;We all know that $a^nu(n)$ has unilateral $\mathcal Z$-transform. But what is the $\mathcal Z$-transform of $a^n$? (bilateral) When i tried to solve, i got answer as 'zero'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But bilateral Laplace transform of $e^t$ doesn't exist. Both are exponentials  in discrete and continuous  domain respectively. Considering the similarity between Laplace and $\mathcal Z$-transform, how to explain the above problem? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below, this is how I got 'zero'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a^n=a^nu(n) + a^nu(-n-1),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now taking $\mathcal Z$-transform on both sides we get &#xA;$$\frac{z}{z-a}\quad \text{and}\quad \frac{-z}{z-a}$$ respectively which add to 'zero'&lt;/p&gt;&#xA;" OwnerUserId="11809" LastEditorUserId="1629" LastEditDate="2016-07-26T20:08:48.040" LastActivityDate="2016-07-26T20:08:48.040" Title="Bilateral $\mathcal Z$-transform of exponential" Tags="|z-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25490" PostTypeId="1" AcceptedAnswerId="25494" CreationDate="2015-08-29T02:53:21.187" Score="-1" ViewCount="197" Body="&lt;p&gt;$c[m,n]$ is the spatially varying gain.&#xA;My prof says that its not shift invariant. However if we put $m=m-k$ and $n=n-l$ we get $c[m-k,n-l] f[m-k,n-l]$ which is how a shift invariant system should behave.&lt;/p&gt;&#xA;" OwnerUserId="17175" LastEditorUserId="4298" LastEditDate="2015-08-29T07:24:52.580" LastActivityDate="2015-08-29T07:25:24.317" Title="Is the system $L\{f[m,n]\}= c[m,n] f[m,n]$ shift invariant?" Tags="|image-processing|convolution|linear-systems|2d|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25491" PostTypeId="2" ParentId="25485" CreationDate="2015-08-29T04:02:42.877" Score="1" Body="&lt;p&gt;There are a few common approaches&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Filters sum to 1&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$\sum_i H_i(\omega) = 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H_i(\omega)$ is the feq. response of the $i$-th filter. For a signal $f(x)$ reconstruction is just adding up the spatial responses&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = \sum_i (f \ast h_i)(x) \overset{\mathcal{F}}{\longleftrightarrow} \sum_i F(\omega)H_i(\omega) = F(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Square of filters sum to 1&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$\sum_i |H_i(\omega)|^2 = 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These filters now form a tight wavelet frame. Basically you apply the wavelet transform (filtering via cross-correlation) once to get the wavelet coefficients (filter responses) then apply the reverse of the transform (filtering) to get back the original signal. Something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i(x) = (f \star h_i)(x) \overset{\mathcal{F}}{\longleftrightarrow} F(\omega)H^*(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = \sum_i (f_i \ast h_i)(x) \overset{\mathcal{F}}{\longleftrightarrow} \sum_i F(\omega)H^*(\omega)H(\omega) = F(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Two different filters&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Same as above except different filters for each transform forwards and backwards. The filters obey&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_i H^*_i(\omega)G_i(\omega) = 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then reconstruction is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_i(x) = (f \star h_i)(x) \overset{\mathcal{F}}{\longleftrightarrow} F(\omega)H^*(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = \sum_i (f_i \ast g_i)(x) \overset{\mathcal{F}}{\longleftrightarrow} \sum_i F(\omega)H^*(\omega)G(\omega) = F(\omega)$$&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2015-08-29T14:00:32.520" LastActivityDate="2015-08-29T14:00:32.520" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25492" PostTypeId="2" ParentId="25489" CreationDate="2015-08-29T06:29:40.903" Score="2" Body="&lt;p&gt;In complete analogy with the bilateral Laplace transform of $x(t)=e^{-at}$ (which doesn't exist), the bilateral $\mathcal{Z}$-transform of $a^n$ doesn't exist either. The series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}a^nz^{-n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;converges nowhere, simply because $a^n$ grows without bounds for $n\rightarrow -\infty$ if $|a|&amp;lt;1$, or for $n\rightarrow\infty$ if $|a|&amp;gt;1$. Of course, for $|a|=1$ there series doesn't converge either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your computation of the $\mathcal{Z}$-transform of $a^n$, the mistake lies in the fact that in addition to the algebraic expression of the transform you also need to consider the region of convergence. If you split $a^n$ (as you did) as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a^n=a^nu[n]+a^nu[-n-1]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can compute the $\mathcal{Z}$-transform of both right-hand side expressions separately:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{Z}\{a^nu[n]\}=\frac{z}{z-a},\quad |z|&amp;gt;|a|\\&#xA;\mathcal{Z}\{a^nu[-n-1]\}=-\frac{z}{z-a},\quad |z|&amp;lt;|a|\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the region of convergence (ROC) for the first part is outside the circle with radius $|a|$, whereas the ROC of the second part is inside the circle with radius $|a|$. The ROC of the total expression would be the overlap of the two ROCs, which is zero. Consequently, the sum doesn't converge anywhere and the $\mathcal{Z}$-transform of the total expression doesn't exist.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-08-29T10:38:15.903" LastActivityDate="2015-08-29T10:38:15.903" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25493" PostTypeId="2" ParentId="25482" CreationDate="2015-08-29T06:32:46.930" Score="0" Body="&lt;p&gt;The following should work&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Perform FFT&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$F(u,v) = \mathcal{F}[f](x,y)$$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Multiply magnitude by 2nd order circular harmonic and sum&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$c = \sum_u \sum_v |F(u,v)|  e^{i 2 \phi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi = \arg (u + iv)$ &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Angle is half of argument&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$\theta = \arg(c) / 2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = rgb2gray(imread('eNb2pye.jpg'));&#xA;F = fft2(I);&#xA;[~,~,r,th] = FFTMesh(size(I));&#xA;c = sum(sum(abs(F) .* exp(1i.*2.*th)));&#xA;direction = angle(c)/2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which uses the following function to general the spectrum u,v and radial coordinates&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ux,uy,r,th] = FFTMesh(sizeM)&#xA;rows = sizeM(1);&#xA;cols = sizeM(2);&#xA;[ux, uy] = meshgrid(([1:cols]-(fix(cols/2)+1))/(cols-mod(cols,2)), ...&#xA;    ([1:rows]-(fix(rows/2)+1))/(rows-mod(rows,2)));&#xA;ux = ifftshift(ux);   % Quadrant shift to put 0 frequency at the corners&#xA;uy = ifftshift(uy);&#xA;% Convert to polar coordinates&#xA;th = atan2(uy,ux);&#xA;r = sqrt(ux.^2 + uy.^2);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-08-29T06:32:46.930" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25494" PostTypeId="2" ParentId="25490" CreationDate="2015-08-29T06:34:54.433" Score="0" Body="&lt;p&gt;Your Professor is right. What you have to do to show shift invariance is to compare the system's response to the input $f[m,n]$ to the response to the shifted input $f[m-k,n-l]$. If the response to the latter is just a shifted version of the original response then the system is shift invariant. However, this is not the case for the system $L\{f[m,n]\}=c[m,n]f[m,n]$ because when you shift the input $f[m,n]$ the gain $c[m,n]$ doesn't shift, so the responses are not shifted versions of each other.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-08-29T07:25:24.317" LastActivityDate="2015-08-29T07:25:24.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25495" PostTypeId="1" AcceptedAnswerId="25500" CreationDate="2015-08-29T07:16:25.743" Score="0" ViewCount="1886" Body="&lt;p&gt;&lt;a href=&quot;http://hypermammut.sourceforge.net/paulstretch/&quot; rel=&quot;nofollow&quot;&gt;This tool (Paul's Extreme Sound Stretch)&lt;/a&gt; is able to produce extreme timestrech (50x, or even 100000x). Any song can become an interesting sound texture or ambient music (listen to &lt;a href=&quot;https://www.youtube.com/watch?v=QspuCt1FM9M&quot; rel=&quot;nofollow&quot;&gt;this example&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The technique used is mentionned as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;spectral smoothing&quot; the sounds.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How does an extreme time stretch algorithm work?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(it is opensource, I have studied it a bit, but I haven't been able to see a big picture of the algorithm yet)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sound input ====&amp;gt;  STFT ===&amp;gt; duplicate the frames 50x ===&amp;gt; ISTFT ===&amp;gt; output&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I'm really not sure about this.&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2015-08-29T22:36:20.660" Title="Extreme audio stretching" Tags="|fft|audio|frequency-spectrum|stft|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25497" PostTypeId="2" ParentId="25495" CreationDate="2015-08-29T10:23:35.413" Score="1" Body="&lt;p&gt;At such large stretching factors, you can generously ignore phase information of the source signal and also assume the signal to be stationary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is use a windowed short time FT to analyse a single frame, take the magnitude of the Fourier coefficients and smooth them to get an approximate spectral shape for the current frame. For synthesising a stretched signal you can just feed white noise through a convolution with the smoothed spectrum to get a stationary signal with the right spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The length of the noise signal for each frame determines the stretch factor, and fading between the resulting signals of adjacent blocks will give you the impression of an evolving sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that the noise is uncorrelated between frames, i.e. don't use a pre-calculated noise vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to process stereo signals, it is probably best to first decompose the stereo signal into its mid and side channels, stretch those independently and convert back to left/right.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-08-29T10:23:35.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25500" PostTypeId="2" ParentId="25495" CreationDate="2015-08-29T15:11:23.263" Score="2" Body="&lt;p&gt;Here is how the algorithm works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SUvFS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SUvFS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the steps are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input -&gt; apply some window (hann in the frame) -&gt; FFT -&gt; Get amplitude &gt; randomize the phase -&gt; IFFT -&gt; overlap and add -&gt; out&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do it in a loop based in the strech Factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Paul wrote a &lt;a href=&quot;https://github.com/paulnasca/paulstretch_python/blob/master/paulstretch_mono.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python code&lt;/a&gt; for all steps in this picture.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="5648" LastEditDate="2015-08-29T22:36:20.660" LastActivityDate="2015-08-29T22:36:20.660" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25501" PostTypeId="1" AcceptedAnswerId="25504" CreationDate="2015-08-29T15:12:36.313" Score="0" ViewCount="61" Body="&lt;p&gt;I have a a channel matrix &quot;H&quot; that is circulant. &#xA;I have data blocks.&#xA;I want to add the channel effects to the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When H was only a vector of channel coefficients I would say:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Going Through The Channel &#xA;After_channel= filter(H,1,Data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but now that H is a matrix the line above wouldn't work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what to do &lt;/p&gt;&#xA;" OwnerUserId="11988" LastActivityDate="2015-08-31T03:05:17.380" Title="Adding channel effects to a signal" Tags="|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25502" PostTypeId="1" AcceptedAnswerId="25509" CreationDate="2015-08-29T17:17:41.770" Score="0" ViewCount="2941" Body="&lt;p&gt;The given sequence&#xA;$$x[k]=\delta[k-1]-3 \delta[k] + \delta[k-2]$$&#xA;represents a period of some discrete periodic signal $e[k]$ with period N=3. Find the Fourier transform  of $e[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an exercise in my textbook and i don't get it. Is $x[k]$ the first period of $e[k]$? If so, does that mean that the DFT of $x[k]$ is the same as the DFT of $e[k]$?&lt;/p&gt;&#xA;" OwnerUserId="17184" LastEditorUserId="15743" LastEditDate="2015-08-29T19:49:09.987" LastActivityDate="2015-08-29T21:40:54.263" Title="Fourier transform of a discrete periodic signal" Tags="|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25504" PostTypeId="2" ParentId="25501" CreationDate="2015-08-29T17:40:41.677" Score="1" Body="&lt;p&gt;This is a small example of how to implement this in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h=[0.4070; 0.8150; 0.4070]; % Channel: Proakis A&#xA;d=[1; -1; 1; 1]; % Data&#xA;H=convmtx(h,4);  % Channel Matrix&#xA;&#xA;y1=H*d; % Matrix approach&#xA;&#xA;y2=conv(h,d); % Convolution&#xA;&#xA;y1-y2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17142" LastActivityDate="2015-08-29T17:40:41.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25505" PostTypeId="2" ParentId="25502" CreationDate="2015-08-29T17:47:05.257" Score="0" Body="&lt;p&gt;For a discrete periodic signal you normally compute the Fourier series coefficients. They can be obtained from the DFT by dividing the output of the DFT by N, where number of samples in a period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT assumes the signal is N-sample periodic anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab you will implement this as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=[-3 1 1];&#xA;ck=fft(x)/3;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17142" LastEditorUserId="17142" LastEditDate="2015-08-29T21:40:54.263" LastActivityDate="2015-08-29T21:40:54.263" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25507" PostTypeId="2" ParentId="25495" CreationDate="2015-08-29T19:42:13.980" Score="1" Body="&lt;p&gt;Another way to do extreme time stretching is to pay attention to FFT phase.  Use the relative phase difference between two close adjacent analysis frames to do (a better than bin quantized) phase-vocoder frequency estimation of local peaks in a &quot;smoothed spectrum&quot;, and then synthesize (continuously, not frame based) from those local peaks plus the addition of any non-peak noise floor.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-08-29T19:42:13.980" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25508" PostTypeId="2" ParentId="25125" CreationDate="2015-08-29T19:54:55.997" Score="3" Body="&lt;p&gt;The noise sounds very stationary, so I guess spectral subtraction should work well. Note however that most implementations usually have quite a few parameters to tweak, and spectral subtraction can sound either very good or completely useless depending on whether the parameters are chosen well for the given problem. If you search for Matlab implementations you find several ones, among which is &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/7675-boll-spectral-subtraction&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt; which you could try to get some idea of what spectral subtraction can do.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-29T19:54:55.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25509" PostTypeId="2" ParentId="25502" CreationDate="2015-08-29T20:54:35.497" Score="0" Body="&lt;p&gt;The question is to compute the Discrete-time Fourier transform (DTFT) of the $N$-periodic sequence $e[n]$, which I'll call $y[n]$ from now on in order to avoid confusion with Euler's number $e$. $y[n]$ is the periodic continuation of the length $N=3$ sequence $x[n]$, hence it can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\left(\sum_{k=-\infty}^{\infty}\delta[n-kN]\right)\star x[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes convolution. Since convolution corresponds to multiplication in the frequency domain, the DTFT of $(1)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}Y(\omega)&amp;amp;=\frac{1}{N}\sum_{k=0}^{N-1}\delta(\omega-2\pi k/N)\cdot X(\omega)\\&amp;amp;=\frac{1}{N}\sum_{k=0}^{N-1}X(2\pi k/N)\delta(\omega-2\pi k/N),\quad 0\le\omega&amp;lt;2\pi\tag{2}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I use $\delta[n]$ to denote the discrete-time unit impulse in $(1)$, and $\delta(\omega)$ to denote the Dirac delta impulse in $(2)$. Also note that $Y(\omega)$ is $2\pi$-periodic and $(2)$ specifies one period. $X(\omega)$ is the DTFT of the sequence $x[n]$. Since $x[n]$ is of finite length $N$, the sampled DTFT $X(2\pi k/N)$ equals the discrete Fourier transform (DFT) of $x[n]$, which I call $\tilde{X}[k]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(2\pi k/n)=\tilde{X}[k]=\sum_{n=0}^{N-1}x[n]e^{-jnk2\pi /N}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using $(3)$, the DTFT of $y[n]$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{N}\sum_{k=0}^{N-1}\tilde{X}[k]\delta(\omega-2\pi k/N),\quad 0\le\omega&amp;lt;2\pi\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It remains to find the DFT of $x[n]$, which is a straightforward exercise. The result is $\tilde{X}[k]=[-1,-4,-4]$. It can also be obtained by the Matlab/Octave command &lt;code&gt;fft([-3,1,1])&lt;/code&gt;. With this result and with $(4)$, the DTFT of $y[n]$ can finally be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(\omega)=-\frac13\left[\delta(\omega)+4\delta(\omega-2\pi/3)+4\delta(\omega-4\pi/3)\right],\quad 0\le\omega&amp;lt;2\pi\tag{5}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-29T20:54:35.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25510" PostTypeId="1" CreationDate="2015-08-29T21:37:58.470" Score="1" ViewCount="68" Body="&lt;p&gt;$X(z) = \displaystyle \frac{1}{z}{\left(1-\frac{z^2}{4}\right)\left(1+\frac{1}{z}\right)\left(1-z\right)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using partial fractions expansion i came up to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle \frac{1}{X(z)} = \frac{-\frac{z}{3}}{1-\frac{z}{2}} + \frac{\frac{z}{3}}{1+\frac{z}{2}} + \frac{\frac{2z}{3}}{1-z}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried but i can't go on any further.&lt;/p&gt;&#xA;" OwnerUserId="17184" LastEditorUserId="1629" LastEditDate="2015-08-30T18:27:03.777" LastActivityDate="2015-08-30T18:27:03.777" Title="What is the inverse Z transform of this:" Tags="|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25514" PostTypeId="2" ParentId="25510" CreationDate="2015-08-30T05:47:48.253" Score="1" Body="&lt;p&gt;You just need to multiply the terms and sort by powers of $z$. If you do so you should get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{z^2}{4}-\frac54+z^{-2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the work is in multiplying out the terms, not in actually figuring out the inverse $\mathcal{Z}$-transform, because from $(1)$ you can immediately write down $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac14\delta[n+2]-\frac54\delta[n]+\delta[n-2]\tag{2}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-08-30T05:47:48.253" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25515" PostTypeId="1" AcceptedAnswerId="25517" CreationDate="2015-08-30T07:37:45.987" Score="4" ViewCount="2024" Body="&lt;p&gt;I am trying to make a minimum phase filter (in wxMaxima) according to these steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;first create a &quot;normal&quot; FIR (a simple sinc, wc=0.4, random example, but in the pictures a remez with Octave)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;calculate the zeroes (allroots() function)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;delete the zeroes outside the unit circle (anything&gt;1/0.98, tolerances&amp;amp;co)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;delete half of the zeroes on the unit circle (the conjugate pairs, 0.98 &amp;lt; x &amp;lt; 1/0.98)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;reconstruct the polynomial =&gt; coefficients.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As I understand it, these are the correct steps to follow, but this is what I'm getting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NLKkt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NLKkt.png&quot; alt=&quot;impulse response&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/DAJsN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DAJsN.png&quot; alt=&quot;frequency response&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this &lt;em&gt;only&lt;/em&gt; if I don't delete half the zeroes. If I do, no matter how I sort, choose, etc, I get bogus results. Is this the right way to achieve a minimum phase? I can provide the wxMaxima approach if needed (I tested it first to see if I can reconstruct the original impulse and I could do it, so obtaining the coefficients is not the problem, but the how to).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I wanted to add this later that day but got busy. Here's a graph showing the frequency response of the four filters, ignore the blatant uglyness in attenuation, it's meant to be an example. The 2nd is by zero inversion (and doubling), the 3rd is by spectral factorization and the 4th is like the 3rd only done by geometric mean between adjacent zeroes, to avoid the manual tweaking of adding the DC offset to h[M/2]:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GCWoN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GCWoN.png&quot; alt=&quot;frequency responses of the 4 filters&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the zeroes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/auax6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/auax6.png&quot; alt=&quot;zeroes of the 4 types&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea with the geometric mean came after realizing that the response of the equiripple wasn't quite equiripple, so adding $\delta_2$ to h[M/2] was tricky (you can see the green zeroes aren't quite overlapping). This also gave me the idea that I can use it with non-equiripple, too (that pdf implies the method can only be applied there). Sure enough, here's the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3qlZq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3qlZq.png&quot; alt=&quot;non-equiripple&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, windowing with a Kaiser (Dolph-Chebyshev, or exponential, or cosh) window(s) should be necessary to compensate for the stop-band. Here's a quick example with a Hamming window:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1kSiS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1kSiS.png&quot; alt=&quot;non-equiripple, Hamming window&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the geometric mean ($\sqrt{z_1 \cdot z_2}$) comes as a good alternative, as long as the zeroes are fairly evenly-spaced, otherwise choosing between non-overlapping zeroes (see the green ones) results in going away from their center.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this I reached the conclusion that if you need a minimum-phase FIR then it's safe to go for an inverse Chebyshev IIR for the sake of less computation power. The half-order minimum phase might be worth it in terms of delay, but it's a pain matching the amplitude. Here are some results with LTspice, showing two FIRs with N=64, linear and nimimum phase, and an inverse Chebyshev IIR (not Cauer, chosen for flatness and similarity in response) with N=11 and matching attenuation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7SmiE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7SmiE.png&quot; alt=&quot;black - linear FIR, red - min. ph. FIR same N, blue - inv. Cheb. N=11 As=55&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, for the sake of comparison, here are the phases of the min.-ph. FIR and the inv. Cheb. IIR:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KS004.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KS004.png&quot; alt=&quot;red - min.-ph. FIR, blue - inv. Cheb. IIR&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...and the step responses of all three:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Jznn9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jznn9.png&quot; alt=&quot;black - lin.-ph. FIR, red - min.-ph. FIR, blue - inv. Cheb. IIR&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17189" LastEditorUserId="21075" LastEditDate="2020-04-30T13:16:39.567" LastActivityDate="2020-04-30T13:16:39.567" Title="Minimum phase FIR method" Tags="|filter-design|finite-impulse-response|phase|digital-filters|minimum-phase|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25517" PostTypeId="2" ParentId="25515" CreationDate="2015-08-30T09:38:58.270" Score="4" Body="&lt;p&gt;You made a minimum-phase filter but with a different magnitude response than the original linear phase filter. What you have to do to keep the magnitude the same is to reflect the zeros outside the unit circle into the circle. Since for linear phase filters the zeros are symmetrical with respect to the unit circle (or on the circle), you simply have to double each zero inside the unit circle and leave the zeros on the circle unchanged. Apart from doubling each zero inside the circle you also need to apply a scale factor &lt;span class=&quot;math-container&quot;&gt;$1/z_i$&lt;/span&gt; for each zero that gets reflected (where &lt;span class=&quot;math-container&quot;&gt;$z_i$&lt;/span&gt; is the location of the zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So each pair of zeros of the linear phase filter (assuming &lt;span class=&quot;math-container&quot;&gt;$|z_i|&amp;lt;1$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(1-z_iz^{-1})(1-z^{-1}/z_i^*)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;needs to be replaced by the following scaled double zero:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{|z_i|}(1-z_iz^{-1})^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will keep the magnitude unchanged while transforming the linear phase function to a minimum-phase function.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2019-06-18T12:05:20.790" LastActivityDate="2019-06-18T12:05:20.790" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="25518" PostTypeId="1" CreationDate="2015-08-30T11:27:50.860" Score="3" ViewCount="8740" Body="&lt;p&gt;I have experience with the design of FIR, IIR digital filters. I also know about the Kalman filter, but I am not skilled at using them. Consider the case of a low frequency signal from discrete samples and the signal is corrupted by high frequency noise. It seems a digital low pass filter and a Kalman filter are two ways of removing the high frequency noise. When is it best to use a digital low pass filter, and when is it best to use a Kalman filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;* EDIT *&lt;/strong&gt;&#xA;More specifically, it seems a FIR filter with linear phase or an IIR filter with nearly linear phase might be a better estimator than a Kalman filter in some cases. This might be true when the desired signal is low frequency and the noise is limited to the upper frequencies. A Kalman filter is designed for Gaussian noise, and I described a case where a linear phase digital low pass filter would work very well.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2015-08-31T00:21:19.147" LastActivityDate="2015-08-31T00:21:19.147" Title="Digital low pass filter vs Kalman filter" Tags="|lowpass-filter|estimation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25519" PostTypeId="1" AcceptedAnswerId="25527" CreationDate="2015-08-30T12:52:19.223" Score="0" ViewCount="122" Body="&lt;p&gt;When I apply differerent thresholding, wavelet denosing functions to non stationary time series which has been detrended via Loess regression and demean it. I expect that when this processed series are submited to denoising / thresholding will result in a clean series with smaller values than the submited signal and not to values at any point which are above those of the signal, Is my thinking correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On another hand could it be thought as per those values in a procesed signal which lie above the processed signal as if the procesed signal would ought  to be above those levels instead than below those levels. Of course the functions that described the signal is an aproximation so fiting erros should have to be expected. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2015-08-30T13:05:23.197" LastActivityDate="2016-01-28T02:31:08.590" Title="Denoising / thresholding via wavelets" Tags="|signal-analysis|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25520" PostTypeId="2" ParentId="15148" CreationDate="2015-08-30T13:15:58.343" Score="0" Body="&lt;p&gt;Now depending what type of signal you have wavelets may be convenient or not, as far as know if yours signal is irregular non stationary non periodic and do not want to go crazy into making your signal stationary which sometimes can be fairly difficult the best way to go is with wavelets, now the issues with wavelets for anayzing signals in a discrete manner instead than in a continuous manner is that the aproximation functions may be off sometimes significanly than the signal they want to model. This is an issue as in denosing or threholding or even modeling as the coefficients may not represent the signal with sufficient accuracy in the time domain and also in the frequency domain. &lt;/p&gt;&#xA;" OwnerUserId="7478" LastActivityDate="2015-08-30T13:15:58.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25524" PostTypeId="1" AcceptedAnswerId="25525" CreationDate="2015-08-30T17:36:22.980" Score="1" ViewCount="449" Body="&lt;p&gt;I measure noise in different systems by looking at voltage fluctuations. I wanted to use a Keithley SMU for that purpose, by storing the data in the buffer and then reading them out. However, I found that the data points are not measured at equally spaced points. While the difference is small, it is still visible. For example, the time intervals for a given trial where: 3.0 ms, 3.01 ms, 2.99 ms, etc, instead of a fixed 3 ms time interval. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering whether I can still overlook this error or not. If not, what is the main reason? Also, is there anything else I can do?&lt;/p&gt;&#xA;" OwnerUserId="8825" LastActivityDate="2021-07-29T19:14:13.247" Title="Sampling at non-uniform intervals" Tags="|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25525" PostTypeId="2" ParentId="25524" CreationDate="2015-08-30T18:20:28.357" Score="4" Body="&lt;p&gt;You still can do a lot. There is no perfect sampler, jitter always exists. Moreover, traditional systems include quantization which prevents (theoretically) the satisfaction of Shannon-Nyquist-Kotelnikov-Raabe... conditions.&#xA;If your system includes low-pass filtering, or/and the phenomenon you look at is very weak above 166 Hz, the variations are likely to be small enough for your purposes. I would propose to look at an harmonic behavior with the following three approaches:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Suppose the periods are even, then perform Fourier analysis,&lt;/li&gt;&#xA;&lt;li&gt;Resample in a simple fashion at even samples (linear interpolation), then perform Fourier analysis,&lt;/li&gt;&#xA;&lt;li&gt;Use a Fourier tool adapted to irregular sampling, like the Lomb-Scargle periodogram.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you detect no meaningful difference in the features you extract, then you are fine (for the time being). You even can, routinely, use these methods in parallel to detect a weird behavior when they differ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you see meaningful difference then you might want to invest into irregular sampling processing methods. Luckily, in theory, when you have irregular samples, and a sufficient precision in the timing, you can extract information beyond Nyquist, at the cost of more involved methods. There is a handful of methods for Fourier or time-frequency methods, FIR results, etc. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-08-30T18:20:28.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25526" PostTypeId="1" CreationDate="2015-08-30T18:31:29.107" Score="0" ViewCount="271" Body="&lt;p&gt;I've been developing a web app as a hobby over the past few months which is essentially a real-time Javascript clone of the audio visualizer used by &lt;a href=&quot;https://www.youtube.com/user/MonstercatMedia&quot; rel=&quot;nofollow&quot;&gt;Monstercat&lt;/a&gt;. While it looks kind of close to the original, I haven't been able to figure out how some aspects of the visualizer work and how to replicate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, higher (and, to a lesser extent, lower) frequencies are &lt;em&gt;far&lt;/em&gt; more emphasized on MC's spectrum than mine will permit. Furthermore, prolonged sounds at a particular frequency are much more static on the original, if that makes sense. Can anyone give insight as to the mechanics of the spectrum and how to more closely resemble it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, &lt;a href=&quot;https://www.youtube.com/watch?v=Ulz1ZG_-nsY&quot; rel=&quot;nofollow&quot;&gt;here's a demo&lt;/a&gt; of my spectrum.&lt;/p&gt;&#xA;" OwnerUserId="17198" LastActivityDate="2015-08-30T18:31:29.107" Title="Replicating a visual audio spectrum" Tags="|audio|frequency-spectrum|visualization|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25527" PostTypeId="2" ParentId="25519" CreationDate="2015-08-31T00:04:28.537" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I expect that when this processed series are submited to denoising / thresholding will result in a clean series with smaller values than the submited signal&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, you can get values that are greater. For example, consider the Fourier series of a signal. The Fourier series basis functions are wavelets. If we approximate the signal with only a few of the Fourier series coefficients you will get values that are above the original signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. from the (image from wikipedia)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u3YG1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u3YG1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-08-31T00:04:28.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25529" PostTypeId="2" ParentId="25501" CreationDate="2015-08-31T03:05:17.380" Score="2" Body="&lt;p&gt;When you use the channel matrix (it is probably a convolution matrix), you just need to multiply it by the signal. Note that the output from this operation will not be equal the output from the filter function. The filter function generates an output from the same size of the input signal, so if your signal has a length of N, just the first N samples obtained from the multiplication will be the same. See the code posted by @Harris.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-08-31T03:05:17.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25530" PostTypeId="2" ParentId="25419" CreationDate="2015-08-31T03:10:09.873" Score="2" Body="&lt;p&gt;Yes, you still need to add noise to the signal. When you have complex Gaussian coefficients, it says about the probability distribution of the filter coefficients. You still need to add the noise after the filtering process.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-08-31T03:10:09.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25533" PostTypeId="1" AcceptedAnswerId="25536" CreationDate="2015-08-31T08:52:43.187" Score="1" ViewCount="1007" Body="&lt;p&gt;The difference equation is written:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(k)-\frac{5}{12}y(k-1)+\frac{1}{24}y(k-2)=x(k)-\frac{1}{2}x(k-1) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system is linear, invariant and causal.&#xA;For $x(k)=δ(k)$, the equation will be:&#xA;$$g(k)-\frac{5}{12}g(k-1)+\frac{1}{24}g(k-2)=δ(k)-\frac{1}{2}δ(k-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculated $g(0)=1$, $g(1)= -\frac{1}{12}$, $g(2)= -\frac{11}{144}$ and $g(3)= -\frac{49}{1728}$ but i can't find any relation between them.&lt;/p&gt;&#xA;" OwnerUserId="17184" LastEditorUserId="1629" LastEditDate="2015-08-31T12:47:25.137" LastActivityDate="2015-08-31T12:55:28.643" Title="What is the impulse response of the system with this difference equation:" Tags="|discrete-signals|impulse-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25534" PostTypeId="1" CreationDate="2015-08-31T09:27:01.810" Score="1" ViewCount="559" Body="&lt;p&gt;I am doing simulation of FMCW radar. I am applying signal processing chain on raw radar data. Here in the code below, I am taking &lt;code&gt;fft&lt;/code&gt; of data and plotting it. Moreover, I am doing zero padding by multiplying the signal length by 1000. I should be getting beat frequency at 2.020 MHz instead I am getting at 2.019MHz. There is something little probelem but I do not know what. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it the correct way for Zero padding? Moreover, am I defining frequency axes correctly? Thanks everyone in advance&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% second-order butterworth&#xA;[b, a] = butter(2, [w1 w2], 'bandpass');&#xA;&#xA;&#xA;load('fb2030');                                   % loading the data&#xA;x = fb2030(30,:);&#xA;% filtering&#xA;y_filt = filter(b,a,x);                           % filtering the received signal&#xA;nfft = length(y_filt)*1000;                       %%%% Zero Padding&#xA;res = fft(y_filt,nfft)/ nfft;                     % normalizing the fft&#xA;&#xA;&#xA;f = fs/2*linspace(0,1,nfft/2+1);                  % choosing correct frequency axes&#xA;res = res(1:nfft/2+1);                            % amplitude of fft(taking the half length of nfft)&#xA;figure,plot(f,2*abs(res));&#xA;xlabel('Frequency in MHz');ylabel('amp')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16555" LastEditorUserId="16555" LastEditDate="2015-08-31T14:32:01.137" LastActivityDate="2016-06-26T20:08:48.487" Title="correct way for Zero padding" Tags="|matlab|fft|frequency-domain|zero-padding|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25535" PostTypeId="1" CreationDate="2015-08-31T10:07:40.863" Score="4" ViewCount="166" Body="&lt;p&gt;Suppose I have a discrete state space model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\theta[k+1] &amp;amp;= A \theta[k] + B u[k]\\&#xA;y[k] &amp;amp;= C \theta[k]&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the equivalent transfer function can be found by solving&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y(z) = C (zI-A)^{-1} B U(z)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is there a quick way to determine the order of the transfer function for each input? I.e., the degree of its numerator and denominators, assuming that the dimensions of $A$ will be $n\times n$, $B$'s will be $n \times m$ and $C$'s will be $1 \times n$? (Assuming here there is only one variable being observed.)&lt;/p&gt;&#xA;" OwnerUserId="8053" LastEditorUserId="1629" LastEditDate="2016-07-27T02:12:43.860" LastActivityDate="2017-07-23T00:41:31.713" Title="How can the order of a transfer function be derived from its equivalent state space representation?" Tags="|transfer-function|z-transform|state-space|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25536" PostTypeId="2" ParentId="25533" CreationDate="2015-08-31T10:59:03.397" Score="1" Body="&lt;p&gt;Starting from the difference equation&#xA;$$y(k)−\frac{5}{12}y(k−1)+\frac{1}{24}y(k−2)=x(k)−\frac{1}{2}x(k−1),$$&#xA;you can express the $Z$-transform on both sides ($X(Z)$ and $Y(Z)$ denote the $Z$-transforms of $x$ and $y$) and get:&#xA;$$Y(Z)\left(1−\frac{5}{12}Z^{-1}+\frac{1}{24}Z^{-2}\right)=X(Z)\left(1−\frac{1}{2}Z^{-1}\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Details on this procedure are quite well explained in &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Z_Transform_Difference_Equations.html&quot; rel=&quot;nofollow&quot;&gt;$Z$ Transform of Difference Equations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfert function $H(Z)$ is given by the ratio of the output by the input:&#xA;$$H(Z) = Y(Z)/X(Z) = \frac{1−\frac{1}{2}Z^{-1}}{1−\frac{5}{12}Z^{-1}+\frac{1}{24}Z^{-2}}.$$&#xA;As the denominator is (now) a simple polynomial of degree 2 in $Z^{-1}$, you can quite easily expand the rational fraction $H(Z)$ in $Z^{-1}$ to obtain a series $\sum_{k=0}^{+\infty} h(k)Z^{-k}$ by using formal expressions like:&#xA;$$\frac{1}{1-X} = 1+X^{-1}+X^{-2}\ldots$$&#xA;and&#xA;$$\frac{1}{1+aX+bX^2} = c/(X-r_0)+d/(X-r_1)$$&#xA;with $r_0$ and $r_1$ the roots of the degree-2 polynomial $1+aX+bX^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With some computations with the numerator, you should be able to retrieve the solution to your expression, with simple formulas for your $h(k)$, providing you with the impulse response you have looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find additional material in &lt;a href=&quot;https://en.wikipedia.org/wiki/Partial_fraction_decomposition&quot; rel=&quot;nofollow&quot;&gt;Partial fraction decomposition&lt;/a&gt;. If you prefer a more self-contained, note-like document, I would suggest the following &lt;a href=&quot;http://www.ece.utah.edu/eceCTools/DSP/CToolsDiscImpSoln.htm&quot; rel=&quot;nofollow&quot;&gt;Difference equation solutions from impulse response&lt;/a&gt;, which provides an alternative explanation.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-08-31T12:55:28.643" LastActivityDate="2015-08-31T12:55:28.643" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="25538" PostTypeId="2" ParentId="25535" CreationDate="2015-08-31T14:26:07.257" Score="1" Body="&lt;p&gt;One trick will be whether there are any pole-zero cancellations in the overall transfer function.  For that, you will probably need to check for the minimality of the system (i.e. &lt;a href=&quot;http://www.ece.rutgers.edu/~gajic/psfiles/chap5traCO.pdf&quot; rel=&quot;nofollow&quot;&gt;check whether the system is both controllable and observable&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question of &quot;determine the order of the transfer function for each input&quot; seems odd, to me.  If the system is minimal (it can't be represented by a smaller order system), then you need it as-is.  Pulling out one of the $m\times 1$ systems on its own may be of interest, but you can't reduce it without destroying the overall system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you give more information about why you want to examine just one of the $m$ transfer functions?&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-08-31T14:26:07.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25539" PostTypeId="2" ParentId="25534" CreationDate="2015-08-31T14:35:57.767" Score="1" Body="&lt;p&gt;This line seems suspicious to me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = fs/2*linspace(0,1,nfft/2+1);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Your frequency bins should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_k = \frac{f_s}{\tt nfft} k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{array}{rcl}&#xA;f_{{\tt nfft}/2 + 1} &amp;amp;=&amp;amp; \frac{f_s}{\tt nfft} ({\tt nfft}/2 + 1)\\&#xA;&amp;amp;=&amp;amp; \frac{f_s}{2} + \frac{f_s}{\tt nfft} &#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whereas your &lt;code&gt;linspace&lt;/code&gt; setting has it mapping to just $\frac{f_s}{2}$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-08-31T15:04:25.250" LastActivityDate="2015-08-31T15:04:25.250" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25540" PostTypeId="1" CreationDate="2015-08-31T16:22:41.683" Score="2" ViewCount="228" Body="&lt;p&gt;The project I'm working on allows a user to speak through a PA system with their iphone as the microphone. Unfortunately, the existing audio units in iOS don't eliminate the feedback between the PA speakers and the iphone microphone and there is instant and debilitating feedback. Is there a way to overcome this issue using existing algorithms? If software feedback elimination is not an option, would it be possible to tune the sensitivity of the iphone microphone to be more directional?&lt;/p&gt;&#xA;" OwnerUserId="17206" LastActivityDate="2015-08-31T16:57:12.737" Title="Is there an existing feedback elimination algorithm that can be implemented in iOS?" Tags="|audio|digital-communications|software-implementation|feedback|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25541" PostTypeId="2" ParentId="25540" CreationDate="2015-08-31T16:57:12.737" Score="1" Body="&lt;p&gt;I've never implemented this myself, but here are my (possibly incorrect) thoughts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general method of feedback elimination is to&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Detect the frequencies that are feeding back&lt;/li&gt;&#xA;&lt;li&gt;Tune a filter to eliminate those frequencies&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Step 2. is &lt;em&gt;relatively&lt;/em&gt; easy, especially if you are using iOS and have an audio unit that can do it for you. There are some things to watch out for -- because you need a fairly steep filter you need to make sure it is stable even at extreme settings -- but hopefully the folks at Apple have taken care of that stuff for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1. is trickier -- how do you know something is feedback and not a genuine part of the audio? There are some advanced techniques related to echo cancellation and adaptive filtering for doing this, but I'm not aware of anything widely available as code or libraries. There might be some shortcuts for your specific use-case, e.g. If you are dealing with speech only, you might be able to simply track pitch, and if a single pitch is strong enough assume that it's a result of feedback, but even doing that quickly enough may not be trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this entire process usually needs to be done continuously/adaptively, at least to some extent to make sure movements of the mike and speaker don't cause new feedback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several patents associated with this, mostly because it's an important aspect of designing hearing-aids. Perhaps some of them are expired and you use them:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://patents.google.com/patent/US4783818A/en?q=method&amp;amp;q=of&amp;amp;q=and&amp;amp;q=means&amp;amp;q=for&amp;amp;q=adaptively&amp;amp;q=filtering&amp;amp;q=screeching+noise&amp;amp;q=caused&amp;amp;q=by&amp;amp;q=acoustic+feedback&quot; rel=&quot;nofollow&quot;&gt;https://patents.google.com/patent/US4783818A/en?q=method&amp;amp;q=of&amp;amp;q=and&amp;amp;q=means&amp;amp;q=for&amp;amp;q=adaptively&amp;amp;q=filtering&amp;amp;q=screeching+noise&amp;amp;q=caused&amp;amp;q=by&amp;amp;q=acoustic+feedback&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://patents.google.com/patent/US4677677A/en?q=acoustic+feedback&amp;amp;q=cancelation&amp;amp;page=1&quot; rel=&quot;nofollow&quot;&gt;https://patents.google.com/patent/US4677677A/en?q=acoustic+feedback&amp;amp;q=cancelation&amp;amp;page=1&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(Note, &lt;a href=&quot;https://en.wikipedia.org/wiki/Audio_feedback#Frequency_response&quot; rel=&quot;nofollow&quot;&gt;wikipedia mentions another method&lt;/a&gt; based on pitch shifting. I'm not familiar with this, and it sounds pretty silly, but it might be worth investigating.)&lt;/p&gt;&#xA;" OwnerUserId="1543" LastActivityDate="2015-08-31T16:57:12.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25543" PostTypeId="1" CreationDate="2015-08-31T17:59:32.303" Score="1" ViewCount="2058" Body="&lt;p&gt;I'm using the Rayleigh Channel in Simulink but I can't calculate the BER. I always get values near to 0.5 which doesn't make sense (even using high EbNo values). [In this simulink model][1] I found a trick to calculate the BER but I also would like to use delays and attenuation vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea of how to calculate the BER? I have tried also with a Matlab script comparing bit to bit but I also get values near 0.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit1:&#xA;I can calculate the BER but it is always around 0.5, regardless EbNo values. I'm using this simulink model.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit2:&lt;/strong&gt;&#xA;I'm using delay and attenuation vector so I have problems with the array dimensions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Nj4Ea.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nj4Ea.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15606" LastEditorUserId="15606" LastEditDate="2015-09-01T15:03:42.710" LastActivityDate="2015-09-01T15:03:42.710" Title="Rayleigh BER in Simulink" Tags="|matlab|digital-communications|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25544" PostTypeId="1" CreationDate="2015-08-31T18:49:14.133" Score="1" ViewCount="264" Body="&lt;p&gt;CS is based on a choice of a sensing basis $\Phi$ relative to a representation basis $\Psi$. There are many well known pair matrices for $\Phi$ and $\Psi$ like random Gaussian and FFT, and also they should have low coherency which can be calculated with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mu(\Phi, \Psi) = \sqrt n\cdot \max\limits_{1\leq k, j \leq n} \left|\langle \varphi_k, \psi_j \rangle\right|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of these Coherency values which are calculated are as: between noiselets and Haar wavelets is $\sqrt 2$. Coherence between noiselets and Daubechies $\rm D4$ and $\rm D8$ are $2.2$ and $2.9$, respectively; random matrices are largely incoherent with any fixed basis $\Psi$.&#xA;My question is how can I calculate these values in matlab? can anyone provide a code example for me?&lt;/p&gt;&#xA;" OwnerUserId="15293" LastEditorUserId="1629" LastEditDate="2016-01-29T21:41:57.243" LastActivityDate="2016-01-29T21:41:57.243" Title="Calculating incoherency in compressive sensing" Tags="|matlab|compressive-sensing|coherence|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25545" PostTypeId="1" CreationDate="2015-08-31T19:47:58.263" Score="1" ViewCount="357" Body="&lt;p&gt;I am trying to create short seamless loops of continuous sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recorded myself making an &quot;Aaaaah&quot; sound at 44.1 KHz, and cut this recording to a section containing 4096 samples (giving me slightly under 1/10th of a second of audio).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I play this in a loop, the sound is very much recognizable but there is of  course an audible ticking noise at the point where it is cut.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I applied an FFT transform to this data. When I apply an inverse FFT to the Fourier tables to recreate the signal, the defect is of course still audible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I can do to the Fourier tables to eliminate the defect without changing the other audible properties of the recording? I'm very much uneducated in signal processing, but intuitively I feel that since the ticking sound repeats once per loop, it might be possible to work in the frequency domain to achieve my goal of cleaning it up to produce a seamless continuous sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: In case there are Javascript programmers here, I created a CodePen &lt;a href=&quot;http://codepen.io/Clafou/pen/xwxgQZ/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; with the &quot;Aaah&quot; loop and its conversion to and from Fourier tables, to facilitate experimentation in code.&lt;/p&gt;&#xA;" OwnerUserId="17208" LastActivityDate="2015-09-01T01:49:35.430" Title="Seamless audio loops via Fourier transforms?" Tags="|fft|audio|fourier|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="25548" PostTypeId="2" ParentId="25543" CreationDate="2015-08-31T21:56:02.963" Score="1" Body="&lt;p&gt;After the AWGN block you need to divide with the channel coefficient value before you apply the BPSK demodulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you click on the Rayleigh block it gives the option to enable a &quot;Complex Gain Path Port&quot;. You can use this output to accomplish the division mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of division you can also multiply the output of the AWGN block with the complex-conjugate of the channel gain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uH220.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uH220.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17142" LastEditorUserId="17142" LastEditDate="2015-08-31T22:10:01.820" LastActivityDate="2015-08-31T22:10:01.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25549" PostTypeId="2" ParentId="25544" CreationDate="2015-09-01T01:35:48.910" Score="1" Body="&lt;p&gt;As a starting-point, you might try something like this:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Step 1: create random (complex-valued) matrices&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rows = 32;   %number of output samples from compression matrix &#xA;cols = 2048;  %number of input samples supplied to compression matrix&#xA;matrixA = randn(rows, cols) + 1i*randn(rows, cols); &#xA;matrixB = randn(rows, cols)+ 1i*randn(rows, cols);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Step 2: Compute Maximum Dot-Product Magnitude&lt;/h2&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%compute all possible cross-correlations&#xA;xc = abs(matrixA * matrixB');&#xA;%find the maximum&#xA;result = max(max(abs(matrixA * matrixB')));&#xA;%todo:  scale by sqrt(n)&#xA;%...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Step 3: Beware of Amplitude Scaling Impacts&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Since the coherence equation that you provided depends upon dot-products, the amplitude scaling of your matrix will effect the result.  Most likely the equation you provided assumes the matrices are scaled in amplitude.  For example, each column in matrixA &amp;amp; matrixB might need to be scaled by it's &quot;Euclidean Norm&quot; or &quot;L2-Norm&quot;.  You might find it helpful to read about correlation coefficients which are scaled accordingly, or revisit your equation reference just to be safe.&lt;/p&gt;&#xA;" OwnerUserId="17210" LastEditorUserId="1464" LastEditDate="2015-09-01T18:12:43.550" LastActivityDate="2015-09-01T18:12:43.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25550" PostTypeId="2" ParentId="25545" CreationDate="2015-09-01T01:49:35.430" Score="1" Body="&lt;p&gt;Try using some sort of pitch estimator to determine the pitch of your sample.  Or hum in tune to a note of a known musical pitch (from a pitch pipe for instance).  Then overlap and cross-fade frames, not 4k apart, but a shorter distance apart that is an integer multiple of the period corresponding to that pitch.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-09-01T01:49:35.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25552" PostTypeId="1" AcceptedAnswerId="27261" CreationDate="2015-09-01T04:36:10.693" Score="4" ViewCount="1743" Body="&lt;p&gt;I've been experimenting with various methods to detect defects in printed images. Features that are qualified as defects may include scratches, discoloration, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not very experienced in image processing and not sure if my approach would be acceptable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several approaches that I've tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given two images (one good, the other one is defect)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Threshold and blur&lt;/li&gt;&#xA;&lt;li&gt;Run Canny edge detection&lt;/li&gt;&#xA;&lt;li&gt;Remove noises using &lt;code&gt;fastNlMeansDenoising&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;XOR the two images and use &lt;code&gt;SIFT&lt;/code&gt; to find outstanding features that may be classified as a defect.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It works very well - in very limited cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like this method is used/proposed in industry a bit (?) as seen &lt;a href=&quot;http://ijctjournal.org/Volume2/Issue2/IJCT-V2I2P27.pdf&quot; rel=&quot;nofollow&quot;&gt;in this paper&lt;/a&gt;. But the problem with it is that if you have two images that are misaligned to the slightest bit, then you would get a problem because all your XOR result in an XOR-ed image that is very wrong. So to me it doesn't seem like an acceptable solution, since it is impossible to perfectly align two images every time (or I could try to realign the images). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I approach this. Is there a method that is similar to XOR-ing that is more tolerant to subtle differences? Or perhaps, a totally different approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Possible alternative&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Break up both images into chunks of n by n pixels. Compute and compare the histogram of each chunk of pixels broken up from image A to image B. Even if one of the images is blurred a little, the histogram should be still be similar &lt;em&gt;(not sure if this is a sound assumption)&lt;/em&gt;. If any chunk contains dark or white spots, this should flag that chunk for further inspection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/ssabpisa/ubiquitous-woof/master/docs/diff1.PNG&quot; alt=&quot;diff 1&quot;&gt;&#xA;Detects darker font color &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/ssabpisa/ubiquitous-woof/master/docs/diff2.PNG&quot; alt=&quot;diff 2&quot;&gt;&#xA;Detects eyebrows that aren't supposed to be there&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/ssabpisa/ubiquitous-woof/master/docs/df3.PNG&quot; alt=&quot;diff 3&quot;&gt;&#xA;Detects faded/lighten area&lt;/p&gt;&#xA;" OwnerUserId="17192" LastEditorUserId="17192" LastEditDate="2015-09-01T09:37:21.547" LastActivityDate="2022-01-18T12:40:36.120" Title="Detecting defects/differences in printed images" Tags="|image-processing|opencv|" AnswerCount="1" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25554" PostTypeId="1" CreationDate="2015-09-01T06:48:36.983" Score="1" ViewCount="245" Body="&lt;p&gt;How does one average a group of frequencies? Frequencies taken for example using FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, given n frequencies over m time intervals (n $\leq$ m), how should one &quot;interpolate&quot; between those frequency values so that one gets a response that's &quot;average&quot;, rather than direct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't mean to calculate the average of all those frequencies and then assign every time interval the average value. Rather, how to take the response of those frequencies closer to &quot;following an average&quot;, i.e. a more slowly changing and more &quot;averaging&quot; response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pseudocode?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-09-01T06:53:43.617" LastActivityDate="2016-06-28T23:58:35.207" Title="Averaging different frequencies" Tags="|fft|audio|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25555" PostTypeId="1" AcceptedAnswerId="25556" CreationDate="2015-09-01T08:34:51.700" Score="0" ViewCount="1305" Body="&lt;p&gt;$\displaystyle y(t) = x(t), t \ge 0$ and $-x(t), t \lt 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can anticipate this system is time-varying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I cannot be sure it and prove it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;please help me.&lt;/p&gt;&#xA;" OwnerUserId="17105" LastEditorUserId="4298" LastEditDate="2015-09-01T09:53:45.547" LastActivityDate="2015-10-31T12:13:09.010" Title="How do I show if this system is time-varying?" Tags="|signal-analysis|linear-systems|" AnswerCount="1" CommentCount="2" ClosedDate="2015-10-31T19:54:39.137" ContentLicense="CC BY-SA 3.0" />
  <row Id="25556" PostTypeId="2" ParentId="25555" CreationDate="2015-09-01T09:47:38.563" Score="0" Body="&lt;p&gt;In order to show that a system is time-varying, it is sufficient to find one counter-example, where the response to a shifted input signal does not equal a shifted version of the original output signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case you might want to consider the signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\begin{cases}&amp;amp;1,&amp;amp; 0&amp;lt;t&amp;lt;1\\&#xA;&amp;amp;-1,&amp;amp; -1&amp;lt;t&amp;lt;0\\&#xA;&amp;amp;0,&amp;amp;\text{otherwise}\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now try to figure out the corresponding output signal $y(t)$. Next, take a shifted version of $x(t)$, e.g. $x(t-1)$, as the input signal and see what output signal you get. Is it equal to $y(t-1)$? If not, you've just shown that the system is indeed time-varying.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-09-01T09:54:46.333" LastActivityDate="2015-09-01T09:54:46.333" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25558" PostTypeId="1" CreationDate="2015-09-01T12:44:28.970" Score="0" ViewCount="131" Body="&lt;p&gt;As a project requirement, I am supposed to modulate a complex baseband signal to a carrier frequency of 2.4 GHz. These are the steps I followed for the baseband modulation and demodulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generate Data -&gt; OQPSK Modulation -&gt; Up Sample -&gt; Pulse shaping -&gt; AWGN Channel -&gt; Matched Filter -&gt; Down Sample -&gt; OQPSK Demodulation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling frequency at baseband is 12 MHz. Now if I were to modulate this baseband signal to a carrier at 2.4 GHz, I believe that these are the steps to be followed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Generate Carrier&#xA;t = (0 : 1/Fs : (length(baseband_Signal)-1)*1/Fs)&#xA;carrier = sqrt(2)*exp(1i*2*pi*Fc*t);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where sampling frequency $Fs=12MHz$ and carrier frequency $Fc=2.4GHz$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Frequency upconvert to passband.&#xA;xUp = real(baseband_Signal.*carrier);&#xA;&#xA;% Downconvert to baseband &#xA;yACI = rx_sgl.*conj(carrier);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I perform upconversion, I expect to have 2 peaks centered at +2.4GHz and -2.4 GHz when I plot the frequency spectrum. However I see that $xUp$ is centered at 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure about what I am missing. Should the complex baseband signal again be upsampled ? &lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2017-06-08T19:56:07.467" Title="Passband modulation at 2.4GHz" Tags="|modulation|dsp-core|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25559" PostTypeId="2" ParentId="25543" CreationDate="2015-09-01T13:01:07.030" Score="1" Body="&lt;p&gt;When you pass your signal into a Rayleigh Fading Channel, it distorts your signal, causing Intersymbol Interference (ISI). You need to Equalize your signal at the receiver in order to perform the detection correctly. You can do it in various ways. I suggest you to search about zero-forcing and MSE equalization.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-09-01T13:01:07.030" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25561" PostTypeId="1" AcceptedAnswerId="25564" CreationDate="2015-09-01T14:28:14.310" Score="1" ViewCount="681" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/hieU1.jpg&quot; alt=&quot;Applied Dsp by dimitris &quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Summation of all values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b)c)d) Failed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e) Parserval's theorem&lt;/p&gt;&#xA;" OwnerUserId="17216" LastActivityDate="2015-09-01T16:22:46.693" Title="Finding values of DTFT without explicitly computing" Tags="|dtft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25562" PostTypeId="1" AcceptedAnswerId="25569" CreationDate="2015-09-01T14:39:55.603" Score="0" ViewCount="124" Body="&lt;p&gt;I am new here and also am not very knowledgeable about DSP so this might be dumb and easy. I am aware of the fact that in order to reconstruct a signal, I need to sample it at a frequency that is more than twice its highest frquency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example below, I use &lt;code&gt;N=50&lt;/code&gt; samples and expect the reconstruction to fail if I use &lt;code&gt;freq = 25&lt;/code&gt; or so (perhaps due to numerical round-off). But I get that the reconstruction breaks around &lt;code&gt;freq = 12.5&lt;/code&gt;. I feel I am missing something fundamental.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are plots and the code to generate them:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nh0U2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nh0U2.png&quot; alt=&quot;Success&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qPu1O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qPu1O.png&quot; alt=&quot;Failure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from numpy.fft import rfft as rfft&#xA;from numpy.fft import irfft as irfft&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;import math&#xA;&#xA;def interpolant( f_hat, pts ):&#xA;    '''&#xA;    This is the trigonometric polynomial interpolating&#xA;    the signal that is encoded in the values of f_hat.&#xA;    it is evaluated at the points pts&#xA;&#xA;    The commented part is the true calculation to be done,&#xA;    the uncommented just does it more accurately.&#xA;    '''&#xA;    N = len( f_hat )&#xA;    f = f_hat[0]&#xA;    for k in range( 1, N/2 ):&#xA;        f = f + 2 * f_hat[k].real * np.cos( k * pts )&#xA;        f = f - 2 * f_hat[k].imag * np.sin( k * pts )&#xA;        #f = f + f_hat[k]             * np.exp( 1j * k * pts )&#xA;        #f = f + f_hat[k].conjugate() * np.exp(-1j * k * pts )&#xA;    f = f + f_hat[N/2] * np.cos( N/2 * pts )&#xA;    return f / N / 2&#xA;&#xA;def f( pts, freq ):&#xA;    '''&#xA;    this is &quot;the conitinuous&quot; signal, evaluated (sampled) &#xA;    at pts&#xA;    '''&#xA;    return  np.sin( freq * pts ) &#xA;&#xA;# Number of sampled points&#xA;N = 50&#xA;&#xA;# Where we sample the signal&#xA;pts = np.linspace(0, 2 * np.pi, num = N, endpoint = False )&#xA;&#xA;# A much finer grid, used solely to display results&#xA;oversampled = np.linspace( 0, 2 * np.pi, 20 * N, endpoint = False )&#xA;&#xA;# The grid we use for the plotting&#xA;grid = oversampled&#xA;&#xA;# The frequncy of the sine wave below&#xA;freq = 7&#xA;&#xA;# Do the FFT on the sampled signal&#xA;f_hat = rfft( f( pts, freq ) )&#xA;&#xA;plt.plot( grid, interpolant( f_hat, grid )  , color = &quot;g&quot; )&#xA;plt.plot( grid, f( grid, freq )      , color = &quot;r&quot; )&#xA;title1 = str(N) + &quot; samples. Signal frequency is &quot; + str(freq)+&quot; \n&quot;&#xA;title2 = &quot;Red is true, green is interpolant. Reconstruction succeeds&quot;&#xA;plt.title( title1 + title2 )&#xA;plt.show()&#xA;&#xA;# The frequncy of the sine wave below&#xA;freq = 12.9&#xA;&#xA;# Do the FFT on the sampled signal&#xA;f_hat = rfft( f( pts, freq ) )&#xA;&#xA;plt.plot( grid, interpolant( f_hat, grid )  , color = &quot;g&quot; )&#xA;plt.plot( grid, f( grid, freq )      , color = &quot;r&quot; )&#xA;title1 = str(N) + &quot; samples. Signal frequency is &quot; + str(freq)+&quot; \n&quot;&#xA;title2 = &quot;Red is true, green interpolant. Reconstruction fails&quot;&#xA;plt.title( title1 + title2 )&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17217" LastActivityDate="2015-09-01T18:32:18.243" Title="Nyquist Frquency isn't what it is supposed to be" Tags="|fourier-transform|sampling|python|nyquist|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25564" PostTypeId="2" ParentId="25561" CreationDate="2015-09-01T16:06:09.330" Score="1" Body="&lt;p&gt;You just need to know the formulas for the DTFT and its inverse:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\omega})=\sum_{n=-\infty}^{\infty}x[n]e^{-jn\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac{1}{2\pi}\int_{-\pi}^{\pi}X(e^{j\omega})e^{jn\omega}d\omega\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(1)$ you see that your answer for $(a)$ is correct. Also the answer for $(d)$ follows immediately, if you realize that $e^{-jn\pi}=(-1)^n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $(b)$ it's important to see that the coefficients are asymmetrical. Looking at $(1)$ you see that you can pair the terms for indices $\pm 1$, $\pm 2$, etc., which allows you to rewrite the sum $(1)$ as a sum of weighted sines time $j$ (imaginary unit), because $e^{jx}-e^{-jx}=2j\sin(x)$. So you'll have a purely imaginary expression. Computing the phase should then be easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(c)$ is easily solved using formula $(2)$ (which value of $n$ do you need to plug into $(2)$?). And finally, for $(e)$ you're right that you need Parseval's theorem.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-09-01T16:22:46.693" LastActivityDate="2015-09-01T16:22:46.693" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25565" PostTypeId="2" ParentId="25562" CreationDate="2015-09-01T16:19:50.610" Score="2" Body="&lt;p&gt;The closer the sampling frequency gets to half the (highest spectral) frequency of the signal, the longer one has to sample to get a sufficient bounded fit (for some bound) of a reconstruction using those finite number of samples.  This required sampling time extends to infinity as one approaches Fs/2.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you simply didn't sample for long enough in your experiment.  Try 5 thousand and 5 million samples for sampling a 12.9 Hz sinusoid at 26 sps, and you will see a closer fitting looking plot over most of an X axis of 5 thousand or better million reconstructed sample points.  Then try a sinusoid even closer to Fs/2 and you will find you need to sample even longer to get the same visual quality of fit.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-09-01T18:32:18.243" LastActivityDate="2015-09-01T18:32:18.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25566" PostTypeId="2" ParentId="17378" CreationDate="2015-09-01T16:56:59.673" Score="-1" Body="&lt;p&gt;You can take a look at this article &lt;a href=&quot;http://home.isr.uc.pt/~jpbar/Publication_Source/meloICCV2013.pdf&quot; rel=&quot;nofollow&quot;&gt;http://home.isr.uc.pt/~jpbar/Publication_Source/meloICCV2013.pdf&lt;/a&gt;. It calibrated the image from natural image lines. You can recover most of the calibration parameters and then apply them to the subsequent images.&lt;/p&gt;&#xA;" OwnerUserId="17219" LastActivityDate="2015-09-01T16:56:59.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25567" PostTypeId="1" AcceptedAnswerId="25570" CreationDate="2015-09-01T17:28:50.923" Score="0" ViewCount="1578" Body="&lt;p&gt;$$ x(k)=4[u(k-2)-u(k)*δ(k-3)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found that the $\mathcal{Z}$ transform of the signal is $X(z)=4/(z^2)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would the ROC be?&lt;/p&gt;&#xA;" OwnerUserId="17184" LastEditorUserId="80" LastEditDate="2015-09-01T18:14:25.357" LastActivityDate="2015-09-01T19:07:26.997" Title="What is the ROC for this discrete signal:" Tags="|discrete-signals|z-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25569" PostTypeId="2" ParentId="25562" CreationDate="2015-09-01T18:21:44.250" Score="2" Body="&lt;p&gt;While hotpaw2's answer is correct in general, in your case it is just a bug in your code. The &lt;code&gt;N&lt;/code&gt; in your &lt;code&gt;interpolant&lt;/code&gt; function is just 25 as far as I can tell, and then you divide it by 2 again.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2015-09-01T18:21:44.250" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25570" PostTypeId="2" ParentId="25567" CreationDate="2015-09-01T19:00:53.007" Score="1" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that the ROC is the region in the $z$-plane for which the series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\sum_{n=-\infty}^{\infty}x[n]z^{-n}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;converges. Since you've found $X(z)$ you also know that $x[n]=4\delta[n-2]$, i.e. there's only one value of $n$ for which $x[n]$ is not equal to zero. What does that mean for the convergence of $(1)$?&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-09-01T19:00:53.007" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25571" PostTypeId="2" ParentId="25567" CreationDate="2015-09-01T19:07:26.997" Score="0" Body="&lt;p&gt;So the $\mathcal{Z}$ transform is $4z^{-2}$ so that the actual signal is $4\delta[n-2]$.  &lt;a href=&quot;https://en.wikipedia.org/wiki/Z-transform#Table_of_common_Z-transform_pairs&quot; rel=&quot;nofollow&quot;&gt;From this table&lt;/a&gt;, that means that the ROC is all of $z$ except the origin.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-01T19:07:26.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25572" PostTypeId="2" ParentId="2010" CreationDate="2015-09-01T19:07:27.973" Score="2" Body="&lt;p&gt;Let me share the pattern that has a very flat spectrum (like the white noise). So this pattern is very hard to compress with JPG. The sample image below is enlarged 4 times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pattern itself is regular, but non-periodic, and could be easily generated by the deterministic algorithm. It also has a fractal property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u1F8W.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u1F8W.jpg&quot; alt=&quot;Non-periodic pattern with quasi white noise spectrum&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Viewed from far away: &lt;a href=&quot;https://i.stack.imgur.com/OqJ5Z.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OqJ5Z.jpg&quot; alt=&quot;original&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://i.stack.imgur.com/Blk4E.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Blk4E.jpg&quot; alt=&quot;far&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17221" LastEditorUserId="1220" LastEditDate="2015-09-02T12:28:01.607" LastActivityDate="2015-09-02T12:28:01.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25575" PostTypeId="1" AcceptedAnswerId="25578" CreationDate="2015-09-01T19:53:41.267" Score="3" ViewCount="8033" Body="&lt;p&gt;Is it possible to find the Fourier transform of a discrete signal if you know its &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform of?&lt;/p&gt;&#xA;" OwnerUserId="17184" LastEditorUserId="4298" LastEditDate="2019-05-19T18:41:32.080" LastActivityDate="2019-05-19T18:41:32.080" Title="Finding Fourier transform of a discrete signal from its Z-transform" Tags="|discrete-signals|z-transform|dtft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25576" PostTypeId="2" ParentId="25575" CreationDate="2015-09-01T19:59:17.667" Score="0" Body="&lt;p&gt;Compare the $z$ transform:&#xA;$$&#xA;H(z) = \sum_{k=-\infty}^{+\infty} h[k] z^{-k}&#xA;$$&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform#Definition&quot; rel=&quot;nofollow&quot;&gt;to the Fourier series:&lt;/a&gt;&#xA;$$&#xA;H_{2\pi}(\omega) = \sum_{k=-\infty}^{+\infty} h[k] e^{-j\omega k }&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-01T19:59:17.667" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25577" PostTypeId="1" AcceptedAnswerId="25589" CreationDate="2015-09-01T21:59:44.527" Score="0" ViewCount="97" Body="&lt;p&gt;$$G(z)=\displaystyle \frac{\frac{1}{z}}{1+\frac{5}{6z}+\frac{1}{6}z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found:&#xA;$$g(k)=\displaystyle \left(\frac{-1}{3}\right)^k - \left(\frac{-1}{2}\right)^k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how I can find the fourier transform of $g(k)$ from $G(z)$.&lt;/p&gt;&#xA;" OwnerUserId="17184" LastEditorUserId="1629" LastEditDate="2016-05-18T06:55:39.420" LastActivityDate="2016-05-18T06:55:39.420" Title="Find the Fourier transform of $g(k)$ from $G(z)$ for frequency $=1/2$" Tags="|discrete-signals|z-transform|dtft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25578" PostTypeId="2" ParentId="25575" CreationDate="2015-09-01T22:33:51.483" Score="3" Body="&lt;p&gt;DTFT is the Z-transform at the unit circle. So if &lt;span class=&quot;math-container&quot;&gt;$z=re^{j\omega}$&lt;/span&gt;&#xA;then for DTFT &lt;span class=&quot;math-container&quot;&gt;$r = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e If you have the Z-transform of a signal then plug-in &lt;span class=&quot;math-container&quot;&gt;$e^{j\omega}$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="17216" LastEditorUserId="4346" LastEditDate="2019-05-15T18:20:19.707" LastActivityDate="2019-05-15T18:20:19.707" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25579" PostTypeId="1" AcceptedAnswerId="25596" CreationDate="2015-09-01T23:09:08.690" Score="1" ViewCount="926" Body="&lt;p&gt;I'm looking at some code that matches audio templates in a longer audio file. The calculation correlates the &lt;em&gt;power spectra&lt;/em&gt; of the template and audio file, maximizing over the possible alignments. This seems sub-optimal to me, because by going over to the power spectrum we're throwing away phase information. Yet when I try doing a full correlation I get worse results. I'm not 100% sure yet my implementation is correct; I could have made a silly mistake.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any reason it could be better correlating the power spectra than doing a full correlation? E.g. is it more noise resistant? (I don't see why it would be. As it happens, I do have something resembling white noise in my test data.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only obvious thing I can think is that the power spectral correlation is probably better if the alignment error is &gt;= 1/highest frequencies in signal because then the template and signal will be out of phase. I don't think this should be the case for me: I'm optimizing to within more temporal precision than that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: in view of Peter K's comment, I should clarify that I'm using the short time Fourier transform, summing over windows of size around 0.01s. That's how the alignment dependence enters.&lt;/p&gt;&#xA;" OwnerUserId="17225" LastEditorUserId="17225" LastEditDate="2015-09-02T13:23:45.870" LastActivityDate="2015-09-02T18:27:11.270" Title="Audio template matching - power correlation?" Tags="|audio|cross-correlation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25580" PostTypeId="1" AcceptedAnswerId="25583" CreationDate="2015-09-01T23:48:15.663" Score="2" ViewCount="2557" Body="&lt;p&gt;I have a signal that has both AC and DC components and both a re varying with time. How can I extract the varying DC wave from the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;eg: A PPG (Photopletysmography) signal extracted from a healthy patient.&lt;/p&gt;&#xA;" OwnerUserId="17226" LastEditorUserId="128" LastEditDate="2020-06-05T11:56:03.800" LastActivityDate="2020-06-05T11:56:03.800" Title="Extracting a Varying DC from a Signal" Tags="|signal-analysis|signal-synthesis|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25581" PostTypeId="2" ParentId="25580" CreationDate="2015-09-02T01:46:47.967" Score="1" Body="&lt;p&gt;You can try to perform FFT on the signal and extract the first sample, or &lt;strong&gt;zero index&lt;/strong&gt; of the FFT array (assuming it is zero-based index array). This is a direct approach to observe DC signal in comparison to other method of curve fitting with smoothing algorithm. For example, Savitzky-Golay can smooth out high frequency and obtain the pedestal shape of the signal. &lt;/p&gt;&#xA;" OwnerUserId="600" LastEditorUserId="600" LastEditDate="2015-09-03T01:28:53.060" LastActivityDate="2015-09-03T01:28:53.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25582" PostTypeId="1" CreationDate="2015-09-02T02:29:53.957" Score="0" ViewCount="58" Body="&lt;p&gt;I have a line scanner output that is scanning the geometry of a surface. Typically the output looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vOsO2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vOsO2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the x and y axis refers to the coordinate system in mm. (ignore the red dots). This data is essentially a 2d point cloud.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what i am trying to achieve is to detect the corner points of this scan. I try to start using image processing techniques, for example using a harris corner detector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the issue with this is that this data has a resolution of up to 0.01um vs a possible area size of 140mm X 100mm of all possible data points. If i were to convert this to 2d image, it would be a very large file, with most of the pixels being empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is that is there a better way to go about processing this type of data; or is there an alternative way to apply techniques such as the harris corner without resorting to conversion into an image.&lt;/p&gt;&#xA;" OwnerUserId="17228" LastActivityDate="2015-09-04T07:40:18.540" Title="Processing line scanner data" Tags="|image-processing|point-cloud|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="25583" PostTypeId="2" ParentId="25580" CreationDate="2015-09-02T04:53:58.450" Score="4" Body="&lt;p&gt;DC, by definition, is the non-varying part of the signal. To find the DC component you simply average the entire signal.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I extract the varying DC wave from the signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This sounds more like you want to extract the &lt;em&gt;low frequency&lt;/em&gt; part of the signal. The most basic filter for this is a moving average filter. However, I would recommend a smoother filter, such as a Gaussian filter. Start with $\sigma$ about 1/6 the period of the low frequency oscillations you are interested in and modify to suit.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-02T04:53:58.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25584" PostTypeId="1" CreationDate="2015-09-02T05:13:11.023" Score="1" ViewCount="202" Body="&lt;p&gt;Firstly: I hope this isn't the wrong place to ask. I'm usually over in the coding forums. But this seemed like the appropriate forum for the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It occurred to me that if several of Google's self-driving cars were lined up together at each side of an intersection, there would be tons of untimed backscatter across anything between them, that would make it all but impossible to determine the exact location of an obstacle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way for them to put a unique signature on each radar signal so it isn't muddied up by others?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what would be the effect of someone painting one of these cars with a radar gun?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And lastly - and I know this is definitely outside the scope of this forum - is there any biological consequence to crossing an intersection where you're being painted by several dozen LIDAR beams?&lt;/p&gt;&#xA;" OwnerUserId="17229" LastActivityDate="2015-09-02T05:13:11.023" Title="Google's self-driving car and LIDAR interference" Tags="|discrete-signals|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25585" PostTypeId="2" ParentId="25125" CreationDate="2015-09-02T07:05:49.723" Score="2" Body="&lt;p&gt;On file: noisy_00_41_718_to_01_04_287.wav, I tried spectral subtraction and then some high-pass filtering to taste. You can download the &lt;a href=&quot;https://infotomb.com/o31c2&quot; rel=&quot;nofollow&quot;&gt;snippet here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are definite artifacts, but I fear the source audio is too degraded. Noise aside, the speaker is very muffled and it is hard (esp. not speaking Schwiizertüütsch) to make out anything clearly. High pass filtering, brought out some detail, but again, not enough to be useful.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-09-02T07:05:49.723" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25586" PostTypeId="2" ParentId="25125" CreationDate="2015-09-02T07:54:03.773" Score="4" Body="&lt;p&gt;I am afraid there's not much you can do.  The voice part seems to have gone through the equivalent of a low pass filter with a cut off of around 1000 Hz.  Basically, all of the speech components above 1000Hz are gone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filtering action may not have been an intentional filter, but may have been due to the improper biasing of the tape during recording.  If it is an old tape, it may simply have deteriorated over time.  Also, the playback head may have needed degaussing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running it through a high pass flattens the frequency response, but doing so pushes the level down so far it drowns the signal in the noise - no help there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best result I got was from using a very steep low pass with a cutoff of 1000Hz together with a very steep high pass with a cutoff of 160 Hz.  That gets rid of the noise by only passsing what is left of the actual speech, but obviously it can't recover what was lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your real problem is not the noise, it is the lost frequency range.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is the spectrum of the bad recording:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9u5RB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9u5RB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the spectrum of the good recording:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rD41t.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rD41t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there's a lot of stuff missing from the bad recording.  So, it isn't simply a problem of removing noise.  The problem is that there's stuff that's just GONE.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the range from 1000Hz to 7000Hz.  There's lots of stuff there in the good recording, but in the bad one it is just a flat spectrum a good 30dB below the voice peaks aroudn 400Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of what's missing might be buried in the noise, but recovering it would cause artifacts that are worse than the noise and muffled sound.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Looking at just the noise, it doesn't seem like there would be much to recover out of it.  It looks just like the portions with speech (except for between 160Hz to 1000Hz,) so anything that is in there is going to be buried really deep.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ND7eF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ND7eF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10650" LastEditorUserId="10650" LastEditDate="2015-09-02T09:06:21.387" LastActivityDate="2015-09-02T09:06:21.387" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="25587" PostTypeId="1" CreationDate="2015-09-02T10:03:10.250" Score="0" ViewCount="68" Body="&lt;p&gt;What is the fourier transform for finite aperiodic discrete signals and for infinite aperiodic discrete signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are they different?&lt;/p&gt;&#xA;" OwnerUserId="17184" LastActivityDate="2015-09-02T10:19:11.207" Title="Aperiodic discrete signals" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25588" PostTypeId="2" ParentId="25587" CreationDate="2015-09-02T10:19:11.207" Score="1" Body="&lt;p&gt;The discrete-time Fourier transform (DTFT) is just what it is, regardless of the length of the signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\sum_{n=-\infty}^{\infty}x[n]e^{-jn\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For finite length signals you just have to sum over finitely many elements in $(1)$, which means that the DTFT always exists. This is not necessarily the case when the signal's length is infinite, because then the sum in $(1)$ does not necessarily converge.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-09-02T10:19:11.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25589" PostTypeId="2" ParentId="25577" CreationDate="2015-09-02T11:17:28.440" Score="1" Body="&lt;p&gt;First of all it's very important to realize that without any further information it is not possible to uniquely identify the corresponding time-domain sequence from the given $G(z)$. The reason is that you need to know the associated region of convergence (ROC). If the ROC is not known then for the given $G(z)$ there are three possible time-domain sequences. One of them is causal, another one is anti-causal, and the third one is two-sided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the ROC is given as $|z|&amp;gt;\frac12$, or, equivalently, if you know that you're looking for a &lt;em&gt;causal&lt;/em&gt; sequence, then the inverse transform is uniquely defined. It is similar to the one you found, but there is an important difference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[k]=\left[\left(-\frac13\right)^k+\left(-\frac12\right)^k\right]u[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need the unit step $u[k]$, which makes the sequence causal. The sequence you found extends to infinity for positive as well as for  negative indices $k$, and does not even have a $\mathcal{Z}$-transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that you know that the ROC &lt;em&gt;includes the unit circle&lt;/em&gt;, you know from the answers to &lt;a href=&quot;https://dsp.stackexchange.com/questions/25575/finding-fourier-transform-of-a-discrete-signal-from-the-z-transform&quot;&gt;this question&lt;/a&gt; that in order to find the Fourier transform you can simply evaluate the $\mathcal{Z}$-transform on the unit circle, i.e. set $z=e^{j\omega}$. What they didn't tell you is that this is only possible because the unit circle is included in the ROC. Otherwise you can't do that because the Fourier transform wouldn't even exist.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-09-02T11:17:28.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25590" PostTypeId="1" CreationDate="2015-09-02T12:21:47.457" Score="2" ViewCount="586" Body="&lt;p&gt;I am reading the implementation of IIR Gaussian blur filter from &lt;a href=&quot;https://software.intel.com/en-us/articles/iir-gaussian-blur-filter-implementation-using-intel-advanced-vector-extensions&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the source code, the coefficients are generated by the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* Calcualte Gaussian Blur Filter Coefficiens&#xA; *  alpha -&amp;gt; smooting gradient depends on sigma&#xA; *  k = ((1-e^-alpha)^2)/(1+2*alpha*e^-alpha - e^-2alpha)&#xA; *  a0 = k; a1 = k*(alpha-1)*e^-alpha; a2 = k*(alpha+1)*e^-alpha; &#xA; *  a3 = -k*e^(-2*alpha)&#xA; *  b1 = -2*e^-alpha; b2 = e^(-2*alpha)&#xA; */&#xA; void calGaussianCoeff( float sigma,  float *a0, float *a1, float *a2, &#xA;   float *a3, float *b1, float *b2, float *cprev, float *cnext)&#xA;{&#xA;  float alpha, lamma,  k; &#xA;  // defensive check&#xA;  if (sigma &amp;lt; 0.5f)&#xA;     sigma = 0.5f;&#xA;&#xA;  alpha = (float) exp((0.726)*(0.726)) / sigma;&#xA;  lamma = (float)exp(-alpha);&#xA;  *b2 = (float)exp(-2*alpha);&#xA;  k = (1-lamma)*(1-lamma)/(1+2*alpha*lamma- (*b2));&#xA;  *a0 = k;&#xA;  *a1 = k*(alpha-1)*lamma;&#xA;  *a2 = k*(alpha+1)*lamma;&#xA;  *a3 = -k* (*b2);&#xA;  *b1 = -2*lamma;&#xA;  *cprev = (*a0 + *a1)/(1+ *b1 + *b2);&#xA;  *cnext = (*a2 + *a3)/(1+ *b1 + *b2);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know where the equation is from?&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="80" LastEditDate="2015-09-02T12:51:11.657" LastActivityDate="2016-03-30T19:42:27.500" Title="equations to calculate coefficients of recursive IIR Gaussian blur filter" Tags="|infinite-impulse-response|gaussian|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25591" PostTypeId="2" ParentId="25579" CreationDate="2015-09-02T12:47:49.717" Score="0" Body="&lt;p&gt;I'm confused by what you're doing so I thought I'd write it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're saying is that you have a power spectral template $|X_{T}(\omega)|^2$ that you use to find a signal $x(t)$ that is at some unknown delay, $\tau$, in a  time series corrupted by noise $n(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) =  x(t-{\tau}) + n(t)&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The technique you're using to find $\tau$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\tau_{\tt max} = \arg\max_{\tau} \rho(\tilde{\tau}) &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\rho$ is the &quot;correlation of power spectra&quot;:&#xA;$$&#xA;\rho = \int |X_T(\xi)|^2 |Y(\xi + \omega; \tilde{\tau})|^2 d\xi&#xA;$$&#xA;and $Y(\omega; \tilde{\tau})$ is the spectrum (not power spectrum) of $y(t)$ shifted by $\tilde{\tau}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is that $\rho$ is now a function of $\omega$.  And the power spectrum $|Y(\xi + \omega; \tilde{\tau})|^2$ should not depend on $\tilde{\tau}$ at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you shed some light on what I'm missing about the algorithm?&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-02T12:47:49.717" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25592" PostTypeId="1" CreationDate="2015-09-02T13:02:42.270" Score="1" ViewCount="206" Body="&lt;p&gt;My instrument performs measurements at non-equal time intervals, i.e. non-uniform sampling. Apart from this, I usually oversample (by a factor of $n$) for reasons related to filter design, and afterwards downsample by taking every $n^\text{th}$ sample. However, with non-uniform sampling, things seem to be non-obvious. I cannot simply take every $n^\text{th}$ sample since the samples themselves are non-uniform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can argue that, since they are non-uniform in the first place, then my downsampling will itself by non-uniform, yet at the end it does not really matter since I still have a non-uniformly sampled signal but now down-sampled. Am I correct?&lt;/p&gt;&#xA;" OwnerUserId="8825" LastEditorUserId="1629" LastEditDate="2015-09-02T14:58:37.660" LastActivityDate="2015-09-02T14:58:37.660" Title="Non-uniform sampling and over-sampling -- how to combine?" Tags="|sampling|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25594" PostTypeId="2" ParentId="25590" CreationDate="2015-09-02T13:18:30.683" Score="0" Body="&lt;p&gt;Did you try reading the references?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/75s0K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/75s0K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=95647FE5D2222D112236FA12D301F666?doi=10.1.1.35.5904&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The paper by Deriche is very well-known&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-02T13:18:30.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25595" PostTypeId="2" ParentId="24941" CreationDate="2015-09-02T13:52:13.843" Score="0" Body="&lt;pre&gt;&lt;code&gt;float phis=0;&#xA;void phdelim(short* dwData, short* dwData2, DWORD dwLength, float fphi,&#xA;             float fepsilon, BOOL* bOk, DWORD* dwLength2){&#xA;    if(bDebug){&#xA;        MessageBox(cvar.get_hwnd(),&#xA;&quot;compare the phase between dwData-dwData2 and then\&#xA;computes the difference between them.\&#xA;if the difference crosses zero or it is smaller than\&#xA;fepsilon bOK=TRUE. BOk=FALSE if the difference &amp;gt; fepsilon\&#xA;in every instance.\n&quot;, &quot;titlu phdelim&quot;, 0);&#xA;    };&#xA;&#xA;DWORD dwi=0;&#xA;DWORD dwk=0;&#xA;DWORD dwj=0;&#xA;BOOL bOKintern;&#xA;&#xA;    do{&#xA;        if (dwData2[dwi]!=0)&#xA;            if((1-fepsilon&amp;lt;dwData[dwi]/(float)dwData2[dwi])&amp;amp;&amp;amp;\&#xA;                (dwData[dwi]/(float)dwData2[dwi]&amp;lt;=1+fepsilon)){&#xA;                bOKintern=TRUE;&#xA;                dwk++;&#xA;            };&#xA;&#xA;        if (bOKintern==TRUE)&#xA;            if (dwData2[dwi+1]!=0)&#xA;                if((1-fepsilon&amp;lt;dwData[dwi+1]/(float)dwData2[dwi+1])&amp;amp;&amp;amp;\&#xA;                    (dwData[dwi+1]/(float)dwData2[dwi+1]&amp;lt;=1+fepsilon)){&#xA;//                  bOk[0]=TRUE;&#xA;                    if (dwk==dwi)&#xA;                        dwj=dwk;&#xA;                };&#xA;&#xA;        bOKintern=FALSE;&#xA;        dwi++;&#xA;    }while (dwi&amp;lt;dwLength&amp;amp;&amp;amp;bOKintern==FALSE);&#xA;&#xA;    if (bOKintern==TRUE&amp;amp;&amp;amp;dwk==dwi){&#xA;        bOk[0]=TRUE;&#xA;        dwLength2[0]=dwLength;&#xA;        phis=fphi;&#xA;    };&#xA;&#xA;    if ((float)dwj/(float)dwi&amp;lt;fepsilon){&#xA;        bOk[0]=TRUE;&#xA;        dwLength2[0]=dwj;&#xA;    }else{&#xA;        dwLength2[0]=dwi*fepsilon;&#xA;    };&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17231" LastEditorUserId="17231" LastEditDate="2015-09-23T05:22:30.867" LastActivityDate="2015-09-23T05:22:30.867" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25596" PostTypeId="2" ParentId="25579" CreationDate="2015-09-02T15:58:03.500" Score="1" Body="&lt;p&gt;If you're cross correlating short time power spectra and disregard phase, then you're not really disregarding phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase of the global Fourier transform encodes the temporal structure, including the position of the transients, evolution of tones or the local incoherence of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By capturing the time dependence in the moving window of the time-frequency power spectrum, the really important aspects of phase are represented in the temporal evolution of the frequency power density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you are discarding is merely &quot;local phase&quot;, which contains a lot of information that is however modified by even the most subtle processes like sound propagation, speaker reproduction, microphone recording, etc. These modifications don't affect the qualitative content of the sound a lot, and a robust sound recognition algorithm should be mostly insensitive to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means discarding the local phase will make your recognition or correlation algorithm more robust and avoid misclassifications due to small inaudible phase errors, while at the same time preserving the total temporal structure of the signal.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2015-09-02T18:27:11.270" LastActivityDate="2015-09-02T18:27:11.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25599" PostTypeId="1" AcceptedAnswerId="25601" CreationDate="2015-09-02T20:00:28.947" Score="0" ViewCount="914" Body="&lt;p&gt;In the literature, I see that a 2D signal can be transformed by first doing a 1D transformation on each row of the matrix followed by the same procedure on each column. It seems that $k^{th}$ level end up with $depth - k$ copies squished into the HL and LH bands when $depth&amp;gt;k$. Clearly I'm doing something wrong--any insight would be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using Haar filters, so the boundary thing isn't a problem (I'm not padding yet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that the transformation isn't normalized so that it's easier to see the issue. The LL band looks correct.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void dwt1D(Mat mat, Mat h, Mat g, int depth) {&#xA;    int numCoefficients = g.cols;&#xA;    int size = mat.cols;&#xA;    Mat t = mat.clone();&#xA;    Mat y = Mat::zeros(mat.rows, mat.cols, mat.type());&#xA;    for (int i = 0; i &amp;lt; depth; i++) {&#xA;        y(Rect(0,0,size,1)).setTo(Scalar(0));&#xA;        int halfSize = size &amp;gt;&amp;gt; 1;&#xA;        for (int j = 0; j &amp;lt; halfSize; j++) {&#xA;            for (int k = 0; k &amp;lt; numCoefficients; k++) {&#xA;                y.at&amp;lt;float&amp;gt;(j) += t.at&amp;lt;float&amp;gt;(2*j+k) * h.at&amp;lt;float&amp;gt;(k);&#xA;                y.at&amp;lt;float&amp;gt;(j+halfSize) += t.at&amp;lt;float&amp;gt;(2*j+k) * g.at&amp;lt;float&amp;gt;(k);&#xA;            }&#xA;        }&#xA;        size = halfSize;&#xA;        y(Rect(0,0,size,1)).copyTo(t(Rect(0,0,size,1)));&#xA;    }&#xA;    y.copyTo(mat);&#xA;}&#xA;&#xA;cv::Mat dwt(cv::Mat mat, Mat h, Mat g, int depth) {&#xA;    mat = mat.t();&#xA;    for(int i = 0; i &amp;lt; mat.rows; i++) {&#xA;        dwt1D(mat.row(i), h, g, depth);&#xA;    }&#xA;    mat = mat.t();&#xA;    for(int i = 0; i &amp;lt; mat.rows; i++) {&#xA;        dwt1D(mat.row(i), h, g, depth);&#xA;    }&#xA;    return mat;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/G8LuM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G8LuM.png&quot; alt=&quot;original&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/E2c2G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E2c2G.png&quot; alt=&quot;unnormalized transformed&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17235" LastEditorUserId="128" LastEditDate="2019-06-24T08:48:39.673" LastActivityDate="2019-07-10T13:27:05.920" Title="2D DWT Image Issue" Tags="|image-processing|wavelet|opencv|multi-scale-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25601" PostTypeId="2" ParentId="25599" CreationDate="2015-09-02T22:48:50.900" Score="1" Body="&lt;p&gt;Apparently, you are not doing wrong. You are doing a &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-level transform on the rows, then on the columns. Giving you rectangular subband. This is fine, and is one of the modes of DWT in 2D. It is called non-separable, standard, anisotropic, and there is a bibliography in &lt;a href=&quot;http://www.laurent-duval.eu/siva-wits-where-is-the-starlet.html#wavelet-anisotropic-square-rectangular&quot; rel=&quot;nofollow noreferrer&quot;&gt;A panorama on Multiscale Geometric Representations (2D wavelets)&lt;/a&gt;. The classic square decomposition applies one DWT level on the rows, one and the columns, and again...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rectangular version is more common in partial differential equations, more computationally demanding, and could be more efficient for anisotropic images. The square version is much more common for standard images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT: Added references to related questions]&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/25601/15892&quot;&gt;2D DWT Image Issue&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/58843/what-is-the-correct-order-of-operations-for-a-2d-haar-wavelet-decomposition/58864#58864&quot;&gt;What is the correct order of operations for a 2D Haar wavelet decomposition?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/37092/15892&quot;&gt;2D DWT computation order&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2019-07-10T13:27:05.920" LastActivityDate="2019-07-10T13:27:05.920" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="25602" PostTypeId="2" ParentId="25580" CreationDate="2015-09-03T05:43:03.367" Score="0" Body="&lt;p&gt;You could also solve an optimization problem.&lt;br&gt;&#xA;If the data is given by the vector $ y $ the following optimization problem would work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{x} = \arg \min_{x} \left \{ {\left \| x - y \right \|}_{2}^{2} + \lambda {\left \| Lx \right \|}_{1} \right \}  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the $ L $ matrix enforces smoothness.&lt;br&gt;&#xA;For instance is could be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{x} = \arg \min_{x} \left \{ {\left \| x - y \right \|}_{2}^{2} + \lambda \sum_{i = 1}^{N - 1} {\left \| {x}_{i} - {x}_{i - 1} \right \|}_{1} \right \}  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, by choosing large ennough $ \lambda $ the solution enforces the derivative to be zero -&gt; DC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would even work with $ {\ell}_{2} $ regularization.&lt;br&gt;&#xA;Though if the model is DC jumps, the $ {\ell}_{1} $ would be a much better choice.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2015-09-03T05:51:50.160" LastActivityDate="2015-09-03T05:51:50.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25604" PostTypeId="1" AcceptedAnswerId="25606" CreationDate="2015-09-03T09:36:02.707" Score="4" ViewCount="621" Body="&lt;p&gt;Is there any matlab (default) function for Discrete Hartley Transform? And is it applicable for audio signal? I want to apply it instead of DWT or FFT.&lt;/p&gt;&#xA;" OwnerUserId="17112" LastActivityDate="2017-10-22T19:49:33.223" Title="Audio Signal Processing &amp; DHT" Tags="|matlab|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25605" PostTypeId="1" CreationDate="2015-09-03T09:40:04.430" Score="2" ViewCount="797" Body="&lt;p&gt;How to evaluate performance of a model after estimating ARMA/MA/AR parameters for any process x(n)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to regenerate back a process after estimating average parameters?&#xA; what kind of performance measure can be used to evaluate the corresponding model?&lt;/p&gt;&#xA;" OwnerUserId="17241" LastActivityDate="2015-09-03T09:40:04.430" Title="How to evaluate performance of an ARMA, MA or AR model?" Tags="|linear-systems|autoregressive-model|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25606" PostTypeId="2" ParentId="25604" CreationDate="2015-09-03T09:50:47.290" Score="6" Body="&lt;p&gt;There is no in-build MATLAB function for DHT, but you can implement it very easily using the &lt;code&gt;fft&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function H=dht(x)&#xA;    X = fft(x);&#xA;    H = real(X) - imag(X);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-09-03T09:50:47.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25607" PostTypeId="2" ParentId="20353" CreationDate="2015-09-03T12:31:25.727" Score="0" Body="&lt;p&gt;The Stroke Width Transform seems to be an effective technique (you'll find links easily). Note that it will also find text present in the photos !&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-03T12:31:25.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25609" PostTypeId="1" CreationDate="2015-09-03T14:44:54.593" Score="0" ViewCount="70" Body="&lt;p&gt;I am working on signals to check how approximation can change the results. I am testing on example that can change frequency from 22kHz to 20 KHz. I prepare this script in MatLab&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;close all;&#xA;clear all;&#xA;Fs1 = 22000;&#xA;Fs2 = 20000;&#xA;TimeStep = 1/Fs1;&#xA;Length = 100000; &#xA;time = (0:Length-1)*TimeStep;&#xA;InputSignal = sin(2*pi*8000*time);&#xA;nGcd = gcd(Fs1, Fs2);&#xA;wstop = Fs2/(Fs2/nGcd*Fs1);&#xA;wpass = 0.9 * wstop;&#xA;A = [1 1 0 0];&#xA;F = [0 wpass wstop 1];&#xA;FilterOrder = 255;&#xA;firCoeff = fir2(FilterOrder,F,A);&#xA;FilterOrder = length(firCoeff);&#xA;BigStep1 =  1000000000/Fs1; %this is 45455,55&#xA;BigStep2 = 45455;&#xA;Buffer24 = Timestamps(Length, BigStep1); %buffers of timestamps&#xA;Buffer24wrong = Timestamps(Length, BigStep2);&#xA;SmallerStep = 50000;&#xA;Length2 = Length*BigStep2/SmallerStep;&#xA;Buffer20 = Timestamps(round(Length2), SmallerStep); %output timestamps&#xA;upY = upsample(InputSignal,Fs2/nGcd);&#xA;ApplySignal = applyFilter2(FilterOrder,firCoeff,upY,Buffer20,Buffer24);&#xA;FilteredSignal= downsample(ApplySignal,Fs1/nGcd);&#xA;Length = length(FilteredSignal);&#xA;NFFT = 2^nextpow2(Length);&#xA;Y = fft(FilteredSignal,NFFT)/Length;&#xA;f = Fs2/2*linspace(0,1,NFFT/2+1);&#xA;FilteredSignal2 = applyFilter2(FilterOrder,firCoeff,InputSignal,Buffer20,Buffer24wrong);&#xA;LengthW = length(FilteredSignal2);&#xA;NFFT2 = 2^nextpow2(LengthW);&#xA;Y2 = fft(FilteredSignal2,NFFT2)/Length;&#xA;f2 = Fs2/2*linspace(0,1,NFFT2/2+1);&#xA;figure&#xA;subplot(2,2,1)&#xA;plot(f,2*abs(Y(1:NFFT/2+1)))&#xA;hold on&#xA;title('Wrong Input with up&amp;amp;dw sampling')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|Y(f)|')&#xA;subplot(2,2,2)&#xA;plot(f2,2*abs(Y2(1:NFFT2/2+1)))&#xA;hold on&#xA;title('Good inpuit olny without anysampling')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|Y(f)|')&#xA;subplot(2,2,[3,4]);&#xA;Index1 = GetIndex(Buffer24,Buffer20(5530),1);&#xA;Index2 = GetIndex(Buffer24,Buffer20(5540),1);&#xA;plot(Buffer24wrong(Index1:Index2),InputSignal(Index1:Index2),'-o',Buffer24(Index1:Index2),InputSignal(Index1:Index2),'-o', Buffer20(5530:5540),FilteredSignal(5530:5540),'d');&#xA;hold on&#xA;set(gca,'XTick',Buffer20(5530):SmallerStep:Buffer20(5540))&#xA;grid on &#xA;legend('Wrong signal','Up/Dwsampled Signal', 'Output Timestamps')&#xA;title('Input Signals')&#xA;xlabel('Time')&#xA;ylabel('|Y(f)|')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An also function GetIndex:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function Index = GetIndex(EquidistancyBuffer, ReqTime, StartIndex)&#xA;LastIndex = length(EquidistancyBuffer);&#xA;&#xA;while((LastIndex-StartIndex)&amp;gt;1)&#xA;    Mid = round((StartIndex+LastIndex)/2);&#xA;    ActualTime = EquidistancyBuffer(Mid);&#xA;    if (ReqTime==ActualTime)&#xA;       LastIndex = StartIndex; &#xA;    elseif (ReqTime&amp;lt;ActualTime)&#xA;        LastIndex = Mid;&#xA;    else&#xA;        StartIndex = Mid;&#xA;    end&#xA;&#xA;end&#xA;Index = Mid;&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Function applyFilter2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function yOut = applyFilter2(FilterOrder, Coeff, Signal, ReqTimestmps,EquidistancyBuffer)&#xA;&#xA;StopIndex=length(ReqTimestmps);&#xA;for i = FilterOrder+1: StopIndex&#xA;    if(i == FilterOrder+1)&#xA;        startIndex = 1;&#xA;    else&#xA;        startIndex = i-1;&#xA;    end&#xA;    Index = GetIndex(EquidistancyBuffer,ReqTimestmps(i),startIndex);&#xA;    yOut(i-FilterOrder) = OutputCalculation(Index-255,FilterOrder,Coeff,Signal);&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and Timestamps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function Timestamps_Buffer = Timestamps(Size, Step)&#xA;&#xA;for i = 1: Size&#xA;    Timestamps_Buffer(i)=(i-1)*Step;&#xA;end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I expected on the left subplot only peak on almost 8kHz but I have one closer to 9KHz. When I change Bigstep2 to equal to BigStep1 the results are almost the same. Please explain me what I did wrong. I attached the result of calcultaion also.&lt;a href=&quot;https://i.stack.imgur.com/M9vtr.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M9vtr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16864" LastEditorUserId="80" LastEditDate="2015-09-03T15:35:12.733" LastActivityDate="2015-09-03T15:35:12.733" Title="Unexpected peak after up &amp; down sampling" Tags="|downsampling|resampling|finite-impulse-response|approximation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25610" PostTypeId="1" CreationDate="2015-09-03T15:38:47.443" Score="1" ViewCount="510" Body="&lt;p&gt;I'm writing code for a 3x polyphase interpolator using a total of 9 coefficients. This is organized as 3 parallel FIR branches with 3-taps each that are summed at the 3x sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I have is the impulse response looks correct (I get my 9 filter coefficients as output) but when I use a real signal that is a smooth Gaussian area near the peak has 'digital noise'. I have confirmed by debug printouts the code is calculating what I want it to. It seems the combination of the input signal &amp;amp; the coefficients really does generate a non-monotonic output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as reference I used the info at this site: [polyphase filter faq][1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing? How do I avoid this? My coefficients are:&#xA;[4066   6261    8133    9391    9834    9391    8133    6261    4066]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inputs sample rate is 100Mh and the output is 300Mh. I choose the filter coefficients to have a bandwidth &amp;lt; 50Mh.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GeAvm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GeAvm.jpg&quot; alt=&quot;debug output&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding followup information. I looked at the step response and it oscillated every 3 output samples. The output to a step should be the sum of the coefficients in a branch. I noticed the 3 coefficients of the 3 branches did not all add to the same value. By deduction, I changed the coefficient 6261 to 5878. Now the coefficients are:&#xA;coeff = [4066   5878    8133    9391    9834    9391    8133    5878    4066] and the response is much better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See new plot: &lt;a href=&quot;https://i.stack.imgur.com/wAPHn.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wAPHn.jpg&quot; alt=&quot;changed coefficient&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Brian&lt;/p&gt;&#xA;" OwnerUserId="17245" LastEditorUserId="17245" LastEditDate="2015-09-03T19:07:38.900" LastActivityDate="2015-09-04T23:07:14.727" Title="Chosing polyphase interpolation coefficients" Tags="|interpolation|finite-impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25611" PostTypeId="1" CreationDate="2015-09-03T17:07:24.367" Score="1" ViewCount="62" Body="&lt;p&gt;I suppose that an image is affected by a multiplicative noise (or additive noise and etc.). I want to quantify and measure the rate of noise (for exemple 1%, 2%, ...,25%) present in an image. I used the &lt;code&gt;snr&lt;/code&gt; and &lt;code&gt;psnr&lt;/code&gt; but they give me the values measured in dB ​​(decibel). Also, how can I implement this in MATLAB?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I use the &lt;code&gt;mse&lt;/code&gt; or the average between the noisy image and the original image &lt;code&gt;mean&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the answer of Mr. Tolga Birdal, I put the following code in matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I=rgb2gray(imread('lena.png'));&#xA;J=imnoise(I,'speckle', 0.1); % 0.1 is the variance of the noise &#xA;Sigma1 = estimate_noise(I) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Its give to me : &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Sigma1 = 6.9360&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sigma2= estimate_noise(J)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and   &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Sigma2= 10.1409&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;this mean that the level of noise present in the image &lt;code&gt;J&lt;/code&gt; equals to &lt;code&gt;10.14 %&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="16063" LastEditorUserId="16063" LastEditDate="2015-09-04T10:47:04.543" LastActivityDate="2015-09-04T13:15:19.573" Title="the rate of noise presented in images" Tags="|image-processing|filters|noise|denoising|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25612" PostTypeId="2" ParentId="25611" CreationDate="2015-09-03T17:38:21.437" Score="2" Body="&lt;p&gt;You could check out &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/36941-fast-noise-estimation-in-images&quot; rel=&quot;nofollow&quot;&gt;my MATLAB function&lt;/a&gt;, which estimates the variance of the noise. It is also mentioned in a &lt;a href=&quot;http://blogs.mathworks.com/pick/2014/11/21/how-noisy-are-your-images-revisited/&quot; rel=&quot;nofollow&quot;&gt;Mathworks blog post&lt;/a&gt;, in comparison with other methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding $\sigma$, you mention in the question, simple answer is yes, longer answer is no. It refers to the variance of the noise normalized with image dimensions as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma = \frac{\sigma_0\sqrt{0.5\pi}}{6(W-2)(H-2)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$-2$ is due to the convolution kernel, applied previously. However, this is not a final quantity, giving you the absolute noise level. Nevertheless, for the variance, you could use it as a percentage, just like you mentioned. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="80" LastEditDate="2015-09-04T13:15:19.573" LastActivityDate="2015-09-04T13:15:19.573" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25615" PostTypeId="1" AcceptedAnswerId="25616" CreationDate="2015-09-03T20:05:44.247" Score="4" ViewCount="3326" Body="&lt;p&gt;Consider we have an image like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/67pQu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/67pQu.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;After applying a Low Pass Filter (say Butterworth), the result is :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EXGLX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EXGLX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And after applying a High Pass Filter (Butterworth), the result is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/U0lMT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U0lMT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The text book (Gonzalez) explains everything clearly. But I still cannot catch the point why the background in LPF is white(gray) and in HPF is black. according to the book, it is because of convolution that averaging a neighbor pixel to calculate the center pixel. I know how convolution works, sliding a small kernel, but why the result from LP filtering has different background in comparison with HP filtering?&lt;/p&gt;&#xA;&lt;p&gt;I think for HPF, it is because of High Pass Filtering in frequency domain is analogous to differentiation in the spatial domain? so all constants become zero (black)? what about Low pass filtering?&lt;/p&gt;&#xA;&lt;p&gt;All pictures are from Gonzalez's Digital Image Processing,3rd Edtion,2008.&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-11-02T23:51:28.513" Title="effect of high pass filtering and low pass filtering on background color" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25616" PostTypeId="2" ParentId="25615" CreationDate="2015-09-03T20:21:42.217" Score="4" Body="&lt;p&gt;It's very simple.  White = 255, Black = 0.  After high pass filtering, the pixels that don't change relative to their neighbors (low spatial frequency) get filtered out--meaning the pixel value is reduced.  Thus, any solid color areas will be replaced by blackness, and only points of pixel value transition will be white.  &lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-09-03T20:21:42.217" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25617" PostTypeId="1" AcceptedAnswerId="25620" CreationDate="2015-09-03T20:31:17.283" Score="1" ViewCount="37" Body="&lt;p&gt;I am not a signal processing expert. I have data like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f1YMO.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f1YMO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the red is what I have and the black is what I want to have. Any idea how to reconstruct this? The code for generating the data is here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;close all&#xA;Ndata = 1000;&#xA;X = nan(Ndata,1);&#xA;sigma = 0.5;&#xA;Y(1) = 50;&#xA;offset = 0;&#xA;for i =2:Ndata&#xA;    % consumption&#xA;    X(i,1) = -0.8*rand;&#xA;    if rand&amp;lt;0.01 % supply&#xA;        X(i,2) = 50;&#xA;    end&#xA;    if rand&amp;lt;0.5 % offset change&#xA;        if abs(offset)==0&#xA;           offset = exprnd(50)*(randi(2)*2-3);&#xA;        else&#xA;           offset = 0;&#xA;        end&#xA;    end&#xA;    X(i,3) = offset ;&#xA;    % noise&#xA;    X(i,4) = sigma*randn;&#xA;    Y(i) = Y(i-1)+sum(X(i,1:2));&#xA;    Z(i) = Y(i)+sum(X(i,3:4));&#xA;end&#xA;plot(Z,'r')&#xA;hold on&#xA;plot(Y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The tricky thing is the fact that there is not only a small white noise, but there are also temporary excesses that are relatively large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any advice.&lt;/p&gt;&#xA;" OwnerUserId="17247" LastActivityDate="2015-09-04T02:16:19.630" Title="How to reconstruct the signal if there were some temporary offsets" Tags="|matlab|noise|filtering|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25618" PostTypeId="2" ParentId="2010" CreationDate="2015-09-03T21:27:18.880" Score="10" Body="&lt;p&gt;The composition below shows a fractal kind structure of the pattern. The every next picture is the result of averaging over each 2x2 pixels block of the previous one. The total character of the pattern remains the same but the image contrast is gradually decreasing. As it was said right earlier, the picture becomes grey when we zoom out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XFcyM.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XFcyM.png&quot; alt=&quot;Scaling behavior&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But using the fractal property, we could overlay together several patterns of different resolution to maintain the image contrast to be stable within the range desired.&#xA;Below is the example of 4-layer pattern (512x512 GIF). This result is more close to Brownian noise and also hardly JPEG compressible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0RkUs.gif&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0RkUs.gif&quot; alt=&quot;4 layer combination&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17221" LastEditorUserId="17221" LastEditDate="2015-10-15T21:19:59.210" LastActivityDate="2015-10-15T21:19:59.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25619" PostTypeId="1" AcceptedAnswerId="25681" CreationDate="2015-09-03T22:17:18.033" Score="3" ViewCount="653" Body="&lt;p&gt;This question stems from an article, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Entropy estimation of symbol sequences&quot;  &lt;a href=&quot;http://pil.phys.uniroma1.it/~labcalc/SC/schurmann.pdf&quot; rel=&quot;nofollow&quot;&gt;download link &lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the abstract mentions the need for using symbols in information theory.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Random chains of symbols (zeros and ones or characters) $s_1, s_2,\ldots,$ drawn&#xA;  from some finite alphabet&#xA;  appear in practically all&#xA;  sciences. Examples include spins in one-dimensional mag-&#xA;  nets, written texts, DNA sequences (here symbols are alphabets), geological records of&#xA;  the orientation of the magnetic field of the earth, and bits&#xA;  in the storage and transmission of digital data. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The paper presents technique for finding the entropy of symbols. My Question is that if entropy of symbols is important then what about the entropy of real valued numbers?&#xA;From the perspective of entropy, is there a proof or some information in text where it provides information that the entropy of random symbols is greater or lesser than the  entropy of real numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: In other words, what would be the entropy of random variables having binary values and entropy of real valued random variables?  A fair coin takes 2 values -0/1 with equal probability and its entropy is 1 bit. So, is 1 bit the maximum entropy? Would entropy of binary random variables be less or more than entropy of real valued random variables and how to show?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I would like to know if there is a proof or material from which it can be inferred if the entropy of characters is lesser/ greater or same with  the entropy of real numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: I want to know why symbols are used in coding and other applications such as storage from the viewpoint of entropy and information theory.&lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="80" LastEditDate="2015-09-04T17:17:58.533" LastActivityDate="2015-09-08T20:25:21.010" Title="What is the entropy for these cases?" Tags="|discrete-signals|reference-request|information-theory|random|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25620" PostTypeId="2" ParentId="25617" CreationDate="2015-09-04T02:16:19.630" Score="2" Body="&lt;p&gt;I just had a go at something stupidly simple: applying a median filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not ideal, but it might be a pointer to how to proceed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top plot is my instance of your plot.  The bottom plot shows the &quot;noiseless&quot; line from the top plot, with the median filtered version in black.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5pnt9.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5pnt9.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N2= 10;&#xA;for k=1:1000,&#xA;    idx1 = max(1,k-N2);&#xA;    idx2 = min(1000,k+N2)&#xA;    M(k) = median(Z(idx1:idx2));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-04T02:16:19.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25621" PostTypeId="2" ParentId="25582" CreationDate="2015-09-04T06:42:05.340" Score="1" Body="&lt;p&gt;A first suggestion (without being sure to understand the question).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After sorting on X, try a line fit in a short sliding window (say 4 units long) and observe the correlation coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In smooth areas, the fit will be excellent. It will degrade at corners. Looking at the plot of the correlation, you should be able to set a suitable detection threshold.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-09-04T07:40:18.540" LastActivityDate="2015-09-04T07:40:18.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25622" PostTypeId="2" ParentId="2010" CreationDate="2015-09-04T08:13:54.447" Score="2" Body="&lt;p&gt;Random noise indeed compresses very poorly. You can produce it in color by generating independent R, G, B values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking from a distance will indeed wipe away the noise (by lowpass filtering), and you can avoid that by generating noise images at different resolutions, i.e. using bigger and bigger pixels, and superposing them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When adding the images, you face the problem of the range of values, which grows as the number of images, let N. If you just average them, the noise amplitude will decrease as 1/N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you choose uncorrelated uniform noise, the superposition will result in a quasi-Gaussian distribution with √N standard deviation, so instead of dividing by N, you can divide by √N (with suitable re-centering) to limit the amplitude reduction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, I guess that it is better to let the values wraparound rather than saturating them, as saturated values will form large uniform areas.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-04T08:13:54.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25624" PostTypeId="1" AcceptedAnswerId="25629" CreationDate="2015-09-04T13:14:57.807" Score="1" ViewCount="1265" Body="&lt;p&gt;I am working with seismic waveforms and more specifically with a stack of years of daily seismograms, that I would call the reference waveform. I am trying to calculate the SNR for each daily waveforms by using the envelope of the reference, but I have doubts on how I should calculate the noise.&#xA;Concretely, I am trying to reproduce what was done in this paper (&lt;a href=&quot;https://hal-insu.archives-ouvertes.fr/file/index/docid/705526/filename/Clarke_etal_GJI.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;page 8&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe It should be simple, but I have poor basics in signal processing and struggle with notations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RgpCu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RgpCu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17254" LastEditorUserId="80" LastEditDate="2015-09-04T13:31:21.847" LastActivityDate="2015-09-04T19:05:14.200" Title="Calculate signal to noise ratio from the Hillbert envelope of a stacked signal" Tags="|noise|snr|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25625" PostTypeId="1" AcceptedAnswerId="25626" CreationDate="2015-09-04T13:31:44.620" Score="1" ViewCount="44" Body="&lt;p&gt;This is an experience-related question about cameras and image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a laboratory setup. Under some simplifications it looks like a red ball rolling on a white table (the real setup is shown &lt;a href=&quot;https://www.youtube.com/watch?v=kyvW5sOcZHU&quot; rel=&quot;nofollow&quot;&gt;on the video&lt;/a&gt;). A computer vision system should measure X and Y positions of the ball. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now I use a color camera (with Bayered output) and I find the ball by applying a simple color filter (InRange for R, G, and B components) to the frames. It works, but I would like to increase precision of the measurements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;Would accuracy of measurements be better in a case I used a grayscaled camera with the same parameters as bayer-camera? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it should be so in a perfect case, i.e. when the ball is definitely highlighted on the frames. But in reality brightness filter usually works worse than color filter. On the other side I can change the shooting conditions, because this is laboratory setup. I can change the color of the objects, I can change lighting.&lt;/p&gt;&#xA;" OwnerUserId="17255" LastEditorUserId="80" LastEditDate="2015-09-04T13:40:13.827" LastActivityDate="2015-09-04T14:37:38.207" Title="Accurate measurement of object's position on a bayer-filtered and grayscaled images" Tags="|video-processing|camera|measurement|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25626" PostTypeId="2" ParentId="25625" CreationDate="2015-09-04T13:39:38.433" Score="0" Body="&lt;p&gt;The key here is how well your acquisition system can differentiate the ball from everything else.  The other key is that the larger number of pixels on the object the better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a look at the video, and without seeing the grayscale version, I would think that a color camera (with the same pixel density as the greyscale camera) would do better.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One trick is:  greyscale cameras are often more sensitive to IR and, as a result, have an IR filter inserted just above the image sensor.  Your ball might be close enough to that so that, by removing the IR filter, the greyscale camera would do as well at seeing the ball as the color camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another trick is:  Try illuminating the field of view of either camera with a different colored light.  You may find that the ball shows up better with one light source over the others (in one camera or the other).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally: try zooming in on the ball.  That will get you more pixels and either the color or greyscale camera will benefit from the extra pixels.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-04T13:39:38.433" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25628" PostTypeId="1" CreationDate="2015-09-04T16:23:14.347" Score="1" ViewCount="73" Body="&lt;p&gt;I understand Gray codes have one bit change between them and how to convert between binary and gray. But given a bit length of &lt;strong&gt;n&lt;/strong&gt;, I want to generate a series of Gray codes (all possible) that have one bit change and have maximum &lt;strong&gt;k&lt;/strong&gt; ones.&lt;br/&gt;&#xA;Example: Given n = 3 and k = 2 &lt;br/&gt;&#xA;000 001 011 010 110 100 101&lt;/p&gt;&#xA;" OwnerUserId="16449" LastActivityDate="2015-09-04T16:23:14.347" Title="How to generate Gray codes of n bits that have at max k ones?" Tags="|algorithms|" AnswerCount="0" CommentCount="7" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25629" PostTypeId="2" ParentId="25624" CreationDate="2015-09-04T19:05:14.200" Score="0" Body="&lt;p&gt;Based on this section of the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FgsXH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FgsXH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my attempt at doing a calculation like that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/o3PMy.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o3PMy.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot above shows three plots:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The average of the dailies (in green) and all the daily data (in black).&lt;/li&gt;&#xA;&lt;li&gt;The function $\sigma$ calculated from the dailies.&lt;/li&gt;&#xA;&lt;li&gt;The SNR calculated from $\sigma$ and the dailies.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Scilab&lt;/code&gt; code for what I did is below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 25624&#xA;Tdata = 33;&#xA;stack_average = wfir(&quot;hp&quot;,Tdata,[.3 0],&quot;hm&quot;,[0 0]);&#xA;&#xA;Ndays = 30;&#xA;&#xA;ccs = zeros(Ndays,Tdata);&#xA;&#xA;for k=1:Ndays,&#xA;    ccs(k,:) =  stack_average + 0.05*rand(1,Tdata,'norm').*window('hm', Tdata);&#xA;end;&#xA;&#xA;clf&#xA;subplot(311)&#xA;plot(ccs','k')&#xA;plot(stack_average,'g')&#xA;xtitle('$\mbox{All } cc \mbox{ in black and } &amp;lt;cc&amp;gt; \mbox{ in green}$')&#xA;&#xA;sigma_N_t = sqrt((mean(ccs.^2,'r') - mean(ccs,'r').^2)/(Ndays-1));&#xA;s_N_t = abs(hilbert(mean(ccs,'r')));&#xA;SNR_N_t = s_N_t ./ sigma_N_t;&#xA;&#xA;subplot(312)&#xA;plot(sigma_N_t)&#xA;xtitle('$\mbox{\rm Level of noise,}\ \sigma$')&#xA;&#xA;subplot(313)&#xA;plot(s_N_t, 'r')&#xA;xtitle('$\mbox{\rm Signal to noise ratio,}\ SNR$')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-04T19:05:14.200" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25631" PostTypeId="1" AcceptedAnswerId="25633" CreationDate="2015-09-04T20:11:43.617" Score="1" ViewCount="5058" Body="&lt;p&gt;I am interested in how should a listing for a program look like that will generate a sine of f=50hz, using the next arguments for any moment in time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float phis=162*PI/180;//initial phase of signal&#xA;//////////////////////////////////////////////////////////////////////// &#xA;//  generates a sinusoid of dwLength in dwData &#xA;//      and maintains phis value updated&#xA;////////////////////////////////////////////////////////////////////////&#xA;void rc(short* dwDataOut, DWORD dwLength){&#xA;float omegaf=50/(float)dwLength/PI*90/100;&#xA;DWORD dwi;&#xA;//use phis&#xA;    for (dwi=0;dwi&amp;lt;dwLength;dwi++)&#xA;        dwDataOut[dwi]=4450*sin(dwi*omegaf+phis)+200;&#xA;&#xA;//update wave phase&#xA;    phis-=PI*(1-50/(float)dwLength)+PI/2;&#xA;    while(phis&amp;lt;0)&#xA;        phis+=2*PI;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The program I came up works correctly with a small marj of error only for f=50hz, because right from the start it appears with a small error in getting phis coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By applying this procedure in a program I'll make use of a cleaner signal from a sound wave, and obtain a signal that will be overlapped as antiphase signal to a more complex 50hz wave, for longer period of time, and so eliminating this harmonic. I’m interested in a more mathematical method to find the value for phis, and probably the arguments of sine function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(is this function resulting in a true output for f=50hz? what are the errors that can be adjusted?)&lt;/p&gt;&#xA;" OwnerUserId="17231" LastEditorUserId="17231" LastEditDate="2015-09-04T20:40:15.867" LastActivityDate="2015-09-04T21:22:36.913" Title="How to perform sine generation (in C)?" Tags="|c|wave|tone-generation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25632" PostTypeId="1" CreationDate="2015-09-04T20:42:43.020" Score="1" ViewCount="3007" Body="&lt;p&gt;I cannot find out what does &quot;notch&quot; means in image processing? &#xA;We have selective filters that one of the best of them is &lt;em&gt;Notch&lt;/em&gt; filters. but what does the concept of &quot;Notch&quot;? why they are called &quot;notch&quot; filters?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastActivityDate="2017-11-07T04:23:39.690" Title="What is a 'notch' in image processing?" Tags="|image-processing|filters|filter-design|filtering|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25633" PostTypeId="2" ParentId="25631" CreationDate="2015-09-04T20:57:05.310" Score="0" Body="&lt;p&gt;I think your recalculation of &lt;code&gt;phis&lt;/code&gt; in the function is not correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this in &lt;code&gt;scilab&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//25631&#xA;N = 100;&#xA;phis1=162*%pi/180;//initial phase of signal&#xA;&#xA;[data1,phis2] = rc(N,phis1);&#xA;[data2,phis3] = rc(N,phis2);&#xA;[data3,phis4] = rc(N,phis3);&#xA;&#xA;clf&#xA;plot([data1 data2 data3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where rc is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//////////////////////////////////////////////////////////////////////// &#xA;//  generates a sinusoid of dwLength in dwData &#xA;//      and maintains phis value updated&#xA;////////////////////////////////////////////////////////////////////////&#xA;function [dwDataOut,phis] = rc(dwLength, phis)&#xA;omegaf=50/dwLength/%pi*90/100;&#xA;&#xA;dwDataOut = zeros(1,dwLength);&#xA;&#xA;for dwi=1:dwLength,&#xA;    dwDataOut(dwi) = 4450*sin(dwi*omegaf+phis)+200;&#xA;end&#xA;&#xA;//update wave phase&#xA;//WAS: phis = phis - %pi*(1-50/dwLength)+%pi/2;&#xA;phis = dwLength*omegaf+phis;&#xA;while(phis&amp;lt;0)&#xA;    phis = phis + 2*%pi;&#xA;end&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note specifically the line &lt;code&gt;phis = dwLength*omegaf+phis;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the plot is as below, which seems to be what you're after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jRbPx.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jRbPx.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-09-04T21:22:36.913" LastActivityDate="2015-09-04T21:22:36.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25634" PostTypeId="2" ParentId="22012" CreationDate="2015-09-04T21:16:35.840" Score="0" Body="&lt;p&gt;The best source on this topic with C solutions for flanger and chorus is the DSP book by Orfanidis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/&quot; rel=&quot;nofollow&quot;&gt;Orfanidis&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Matlab code examples on audio effects (including flanger on page 48) see the file below &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.cs.cf.ac.uk/Dave/Multimedia/PDF/07_Audio_Effects.pdf&quot; rel=&quot;nofollow&quot;&gt;Marshall&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17142" LastEditorUserId="17142" LastEditDate="2015-09-08T15:40:10.783" LastActivityDate="2015-09-08T15:40:10.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25635" PostTypeId="2" ParentId="25632" CreationDate="2015-09-04T21:29:33.453" Score="1" Body="&lt;p&gt;In standard 1D signal processing, &lt;a href=&quot;http://www.dspguide.com/ch19/3.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;notch filters&lt;/a&gt; are filters that try to remove one specific frequency, and pass all others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I say &quot;try to&quot; because this is not usually achievable, but it comes close.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Steve W. Smiths's &lt;em&gt;DSP Guide&lt;/em&gt; has a nice plot (Figure 19.6b below) that shows the frequency response of such filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In image processing, it will be the same thing, but instead of a 1D filter it'll be a 2D filter probably comprised of two 1D notch filters --- one in each image direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rhD58.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rhD58.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-04T21:29:33.453" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25636" PostTypeId="2" ParentId="25610" CreationDate="2015-09-04T23:07:14.727" Score="1" Body="&lt;p&gt;At Peter K's suggestion I am submitting my solution as the answer. In the poly phase filter the 9 coefficients were all symmetric about the center but gave poor ripple performance. When arranged in the format of a poly-phase filter the 3 coefficients in the 3 branches did not add up to the same value for all three branches. By making a slight edit to the 1 coefficient at +/-3 positons from the center all the branches added up to the same value and the results are as shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get better performance then that shown I need to increase the # of coefficients to N=15 (wanting to keep N a multiple of L=3 and odd).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brian&lt;/p&gt;&#xA;" OwnerUserId="17245" LastActivityDate="2015-09-04T23:07:14.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25637" PostTypeId="1" AcceptedAnswerId="25710" CreationDate="2015-09-05T03:31:41.350" Score="1" ViewCount="109" Body="&lt;p&gt;I'm trying to work out the best way to zero centre an audio clip for a forward FFT.   I've been trying rotate my audio so that a peak exists mid way (N/2).   This seam a little naive and I thought I had read that you can zero pad the centre of the audio clip in order to achieve the same result.  Am I mad?  what is the best way to zero centre an audio clip for Forward FFT&lt;/p&gt;&#xA;" OwnerUserId="16389" LastActivityDate="2015-09-08T10:51:36.243" Title="Zero Centering Audio for Forward FFT" Tags="|fft|ifft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25639" PostTypeId="2" ParentId="25125" CreationDate="2015-09-05T10:21:07.583" Score="0" Body="&lt;p&gt;&lt;strong&gt;Thank you very much, to all who provided solutions.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Summary&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is a summary of what has been proposed, with an example of what&#xA;it does to the noisy soundfile when combined. If you like it, please do upvote the originals.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;(Kudos to @PeterK) The recording has a DC bias. You can see that most of the waves center below the 0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ytioy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ytioy.png&quot; alt=&quot;DC bias&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can for example be removed via Audacity's &quot;Normalize...&quot; with default settings.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(Kudos to @MattL) When this is normalised, spectral subtraction can be used. I got the same results as @ruohoruotsi when I tried it at first, leaving me to abandon that, but if you tweak (as suggested) for example the Sensitivity setting to 5dB, you get very little to no artifacts. The waveform looks different:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dJOQH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dJOQH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(Great Kudos to @JRE) This can be further filtered with a high pass as proposed to get some more of the noise out. Yet, as @JRE also said, there is very little information in the signal above 1000Hz. Thus, for example the section between 12 and 14 seconds remains very hard to hear.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can listen to &lt;a href=&quot;http://vocaroo.com/i/s1uBY3b0VLil&quot; rel=&quot;nofollow noreferrer&quot;&gt;the result of all three approaches combined&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="16927" LastActivityDate="2015-09-05T10:21:07.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25640" PostTypeId="1" CreationDate="2015-09-05T11:17:30.753" Score="4" ViewCount="10353" Body="&lt;p&gt;I have searched high and low for a practical guide to implement a simple 50Hz low pass filter on a signal. I understand the theory but its the practical but that's missing. If I was using MATLAB it would be trivial because there are so many examples but I am coding this by code.&lt;/p&gt;&#xA;&lt;p&gt;This is where I am at:&lt;/p&gt;&#xA;&lt;p&gt;1: I have a series of 8192 bytes sampled at 1000Hz in an array (0-256)&lt;/p&gt;&#xA;&lt;p&gt;2: I have generated the frequency domain representation of a simple step filter in a symmetric array (+/-F, Ire, Iim) :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0,1,0&#xA;0.1220703125,1,0&#xA;0.244140625,1,0&#xA;0.3662109375,1,0&#xA;0.48828125,1,0&#xA;0.6103515625,1,0&#xA;.....&#xA;-0.6103515625,1,0&#xA;-0.48828125,1,0&#xA;-0.3662109375,1,0&#xA;-0.244140625,1,0&#xA;-0.1220703125,1,0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;3: I have used Inverse FFT of the filter to obtain the time representations of the filter as (t, Ire, Iim) [as expected the imaginary parts are ~0 and the filter gives the expected decaying ringing]:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0.000,819,0&#xA;0.001,805.600848087199,4.11892742135933E-12&#xA;0.002,766.191083986647,7.80009390410896E-12&#xA;0.003,703.07869137741,1.07704956064936E-11&#xA;0.004,619.930866652693,1.26768595620774E-11&#xA;0.005,521.519198753447,1.32877042702262E-11&#xA;0.006,413.390428478234,1.26576527037514E-11&#xA;0.007,301.48763797423,1.08400510789863E-11&#xA;8,0.008,191.750273447113,7.79765141345479E-12&#xA;....&#xA;8.186,413.390428478235,7.79385628257856E-09&#xA;8.187,521.519198753448,9.84392145575441E-09&#xA;8.188,619.930866652693,1.17116023545805E-08&#xA;8.189,703.07869137741,1.32913150485692E-08&#xA;8.19,766.191083986645,1.44921696865197E-08&#xA;8.191,805.600848087196,1.52439926792702E-08&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;OK so what do I do with this data???&lt;/p&gt;&#xA;&lt;p&gt;From what I have read in the literature the theory is that in the freq domain you multiply the spectra but because this is the DFT the usual course is to convolve in the time domain but the question remains:&lt;/p&gt;&#xA;&lt;p&gt;1: Do I simply multiply the two time series together (doesn't feel right)?&lt;/p&gt;&#xA;&lt;p&gt;2: If not how is the weighting applied?&lt;/p&gt;&#xA;&lt;p&gt;3: How do I normalize any output back to 0-256 values?&lt;/p&gt;&#xA;&lt;p&gt;I realize this is a pretty basic question but there doesn't seem to be a really basic answer or example out there :-(&lt;/p&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&lt;p&gt;iced&lt;/p&gt;&#xA;" OwnerUserId="17267" LastEditorUserId="60971" LastEditDate="2022-07-13T19:33:08.507" LastActivityDate="2022-07-13T19:33:08.507" Title="How to Actually Use FFT to Implement Low Pass Filter" Tags="|fft|convolution|lowpass-filter|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25641" PostTypeId="1" CreationDate="2015-09-05T11:24:04.583" Score="5" ViewCount="2394" Body="&lt;p&gt;Can someone please explain the illustration (figure 1.19) at the bottom of this image? It looks like there are four sampling points but I don't understand what the different curves represent. Actually except from the dashed curve I can't even distinguish the different curves from each other. Can someone please clarify this so that the illustration makes sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8LQVN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8LQVN.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&#xA;&#xA;(Image source: Digital Signal Processing Principles Algorithms and Applications)&lt;/p&gt;&#xA;" OwnerUserId="17268" LastEditorUserId="26573" LastEditDate="2019-02-24T02:33:03.410" LastActivityDate="2019-02-24T02:33:03.410" Title="Sampling Theorem illustration" Tags="|sampling|interpolation|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25642" PostTypeId="1" CreationDate="2015-09-05T11:43:04.027" Score="1" ViewCount="1047" Body="&lt;p&gt;In this example, under &amp;quot;Discussion&amp;quot;, we can see that the Nyquist sample rate will result in samples with the value zero only. But why is this? I thought the sampling theorem said that if you sample with the Nyquist sample rate or higher, then the original signal can be exactly recovered? But in this case it can't? So does that mean the sample theorem is not actually valid?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kr0LL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kr0LL.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;" OwnerUserId="17269" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-02-24T20:11:59.317" Title="Why doesn't the sampling theorem work in this case?" Tags="|sampling|nyquist|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="25643" PostTypeId="2" ParentId="25642" CreationDate="2015-09-05T12:11:11.893" Score="2" Body="&lt;p&gt;The formula given is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ F_s &amp;gt; 2F_{\mathrm{max}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;not &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ F_s \ge 2F_{\mathrm{max}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;otherwise it is possible that you could be sampling exactly on the zero crossing points. In practice you would choose sometime a bit higher. For example, CD audio uses 44100 Hz to represent signals up to 20000 Hz.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-05T12:11:11.893" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25644" PostTypeId="2" ParentId="25641" CreationDate="2015-09-05T12:18:23.137" Score="1" Body="&lt;p&gt;It is difficult to make out but it looks like 4 copies of the interpolation function (sinc function from 1.4.22) weighted by the sample values, and drawn at each point from (n-2)T to (n+1)T.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sum of all these sinc functions weighted by the sample value (1.4.23) is the original signal. That is, if you add up all the solid black line functions, you get the dotted line.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-05T12:18:23.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25645" PostTypeId="2" ParentId="25640" CreationDate="2015-09-05T12:27:40.823" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;You &lt;em&gt;convolve&lt;/em&gt; the two time series together. Think of the filter as a kind of weighted moving average. Imagine how you would implement a moving average, as it is also a convolution operation. E.g. a five sample moving average is convolution with a filter with response [0.2 0.2 0.2 0.2 0.2]&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Or you can &lt;em&gt;multiply&lt;/em&gt; the Fourier transform of the signal and the Fourier transform of the filter together, then perform the inverse Fourier transform. It is (almost) the same as convolution, with the exception that the Fourier transform assumes the signal is periodic, therefore filtering at the start of the signal used values from the end as well, and vice versa. Convolution can do this as well, but usually it is implemented by padding the signal with zeros at the start and end.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;$$f'(x) = \frac{f(x) - \min(f)}{\max(f) - \min(f)} \times 255$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(bytes are 0 - 255)&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-05T12:27:40.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25648" PostTypeId="2" ParentId="25641" CreationDate="2015-09-05T13:37:31.323" Score="-1" Body="&lt;p&gt;The explanation given in your text is, unfortunately, quite dreadful&#xA;and confuses several issues. We have a low-pass function $x(t)$ whose sample values $$\cdots, x((n-2)T), x((n-1)T), x(nT), x((n+1)T), \cdots$$&#xA;are given to us. Note the complete absence of any subscript $a$ on $x$.&#xA;We write $x_n$ for the $n$-th sample value $x(nT)$. We wish to reconstruct $x(t)$ from its samples, and our reconstruction&#xA;is $x_a(t)$ as (incorrectly) defined in (1.4.23): the correct&#xA;definition is&#xA;$$x_a(t) = \sum_{n=-\infty}^\infty x(nT)g(t-nT)&#xA;= \sum_{n=-\infty}^\infty x_n g(t-nT).\tag{1.4.23.corrected}$$&#xA;Note again the complete absence of any subscript $a$ in&#xA;the middle sum, and the right-hand sum emphasizes that the reconstruction&#xA;is a &lt;em&gt;weighted&lt;/em&gt; sum of delayed versions of $g(t)$ with the weights&#xA;being the &lt;em&gt;given&lt;/em&gt; sample values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function $x_a(t)$ as&#xA;defined in $(1.4.23.\text{corrected})$ has the property that if $t=mT$,&#xA;then &#xA;$$x_a(mT) = \sum_{n=-\infty}^\infty x_ng(mT-nT)&#xA;= \sum_{n=-\infty}^\infty x_n g((m-n)T) = x_m \tag{1}$$&#xA;because $g(t)$ is a Nyquist pulse and enjoys the property&#xA;that $g(\ell T) = 0$ if $\ell$ is a nonzero integer while&#xA;$g(0) = 1$. Thus, the &lt;em&gt;reconstructed&lt;/em&gt; function $x_a(t)$ has&#xA;the property that at &lt;em&gt;each&lt;/em&gt; sampling instant $mT$, the value of&#xA;$x_a(t)$, &lt;em&gt;viz.&lt;/em&gt; $x_a(mT)$ &lt;em&gt;equals&lt;/em&gt; $x_m$, the $m$-th sample&#xA;value given to us.  Thus, as far as &lt;em&gt;samples&lt;/em&gt; are concerned&#xA;the two functions $x_a(t)$ and $x(t)$ have the same values&#xA;at the &lt;em&gt;sampling&lt;/em&gt; instants $mT$. In other words,&#xA;$$x_a(t) = x(t) \quad \text{for} \quad t = mT, m \in \mathbb Z.\tag{2}$$&#xA;Note that $(2)$ holds &lt;em&gt;regardless&lt;/em&gt; of what $T$ is and how it&#xA;relates to the maximum frequency in $x(t)$ etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What at time instants &lt;em&gt;other&lt;/em&gt; than multiples of $T$? Is it&#xA;true that $x_a(t)$ as defined in $(1.4.23.\text{corrected})$ equals&#xA;$x(t)$ for &lt;em&gt;all&lt;/em&gt; $t, -\infty &amp;lt; t &amp;lt; \infty$?&#xA;Well, that is where the fun statrts. If the Nyquist criterion is met, then $x_a(t)$ as given in $(1.4.23.\text{corrected})$ is &lt;em&gt;precisely&lt;/em&gt; &#xA;the $x(t)$ that we wish to recover. I will not prove this statement &#xA;(which is called the Nyquist theorem or the Shannon-Whittaker&#xA;sinc interpolation formula etc) but that $x_a(t)$ as defined&#xA;in $(1.4.23.\text{corrected})$ &lt;em&gt;is&lt;/em&gt; $x(t)$ is what the crux of&#xA;the matter is.  If the Nyquist criterion is&#xA;&lt;em&gt;not&lt;/em&gt; met, then $(1.4.23.\text{corrected})$ gives a function $x_a(t)$ &#xA;whose &lt;em&gt;sample values&lt;/em&gt;&#xA;$x(t)$ at the sampling instants $mT$ (&lt;em&gt;cf.&lt;/em&gt; the remarks surrounding&#xA;$(1)$ and $(2)$ above) but is not equal to $x(t)$&#xA;at other times. In fact, $x_a(t)$ is the result of &lt;em&gt;aliasing&lt;/em&gt;&#xA;of $x(t)$ with respect to the sampling frequency etc, but that&#xA;is a matter for a different question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that as preliminaries, let us turn to the illustration that&#xA;puzzles you. The dashed curve is the result of the interpolation: &#xA;the function &#xA;$x_a(t)$ as defined in $(1.4.23.\text{corrected})$ and it is&#xA;the sum of infinitely many weighted and delayed sinc functions.&#xA;The other curves are (four of the)&#xA;infinitely many sinc functions $x_m g(t-mT)$ on the right side&#xA;of $(1.4.23.\text{corrected})$. At $t=nT$, the term $x_ng(t-nT)$ &#xA;which occurs on the right side of $(1.4.23.\text{corrected})$ &#xA;has a peak value of $$x_ng(nT-nT) = x_ng(0) = x_n$$ &lt;strong&gt;and it has&#xA;value $0$ at &lt;em&gt;other&lt;/em&gt; sampling instants &#xA;$\cdots, (n-2)T, (n-1)T, (n+1)T, \cdots$&lt;/strong&gt; Similarly, the function&#xA;$x_{n-1}g(t-(n-1)T)$ has value $x_{n-1}$ at $t=(n-1)T$ and value&#xA;$0$ at all other sampling instants.  In short, if we evaluate the sum&#xA;$$\sum_{m=-\infty}^\infty x_m g(t-mT)$$&#xA;at $t=nT$, that sum of infinitely many terms simplifies &#xA;to $x(nT)$ because all&#xA;the other terms are $0$. No muss, no fuss, no worries about&#xA;convergence of an infinite series etc.  Remember that&#xA;all this holds without any&#xA;issues of Nyquist criteria etc. The hard part is the assertion&#xA;that $x_a(t)$ as defined in $(1.4.23.\text{corrected})$ equals&#xA;$x(t)$ for all $t$ if the Nyquist criterion is satisfied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why all this yelling and screaming about (1.4.23) being incorrect&#xA;and the explanation in the text being sheer nonsense?  Well,&#xA;(1.4.23) as shown in the OP's text has sample values of $x_a(t)$,&#xA;the &lt;em&gt;reconstructed&lt;/em&gt; signal, on the right side. So, the definition&#xA;is circular, to say the least, and even if we ignore that, it&#xA;is an assertion of the Nyquist theorem or the Shannon-Whittaker&#xA;interpolation formula without any proof. The equality&#xA;(1.4.23) as given in the text holds at $t=mT, m \in \mathbb Z$;&#xA;the assertion that it holds for all $t$ is a proof by intimidation.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-09-05T15:34:44.380" LastActivityDate="2015-09-05T15:34:44.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25649" PostTypeId="1" CreationDate="2015-09-05T13:42:37.300" Score="1" ViewCount="245" Body="&lt;p&gt;I am implementing a software to auralize a virtual scene but am kind of a newbie to DSP. The focus should be the calculation of the IR which is frequency dependant. But this means that the renderer of the sound should be able to convolute reverb in a frequency dependant way (in realtime possibly). A IR has a set of Reflections. A reflection is a tuple of delay (double) and decay for each frequency band to a decay in dB (hash_map from freqband to double).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to convolute this IR with my input signal in the most efficient manner. What I intend to do is using the FFT to get the frequency spectrum and then apply a reverb function to this signal. The two main conceptual problems for me here are: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I apply delay in the frequency spectrum? (Is it even necessary to do this in the frequency spectrum?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there a common method to apply such a reverb function to a signal? And if there is, do I need to have phase information modelled?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I was thinking about was splitting the IR into several frequency responses dependant on the frequency band and then apply it to the frequency spectrum of the input signal. But then again this involves problem 1 and somehow includes phases because I would not know otherwise if I need to add or subtract.&lt;/p&gt;&#xA;" OwnerUserId="17273" LastActivityDate="2015-11-05T00:25:14.953" Title="Convolution reverb using a frequently updated frequency dependant impulse response" Tags="|frequency-spectrum|convolution|frequency-response|impulse-response|real-time|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25650" PostTypeId="2" ParentId="25641" CreationDate="2015-09-05T13:52:05.970" Score="8" Body="&lt;p&gt;This plot depicts how to convert your digital signal back to the analog one, using $\mathrm{sinc}$ functions. The nice property of these functions used in this process, is that maximum of each function always occurs at minimums of the other, shifted function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LHgOQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LHgOQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the process of the D/A conversion that is depicted on your plot is basically taking a $\mathrm{sinc}$ function, and multiplying it by one sample that is at the maximum of $\mathrm{sinc}$. You do it for each and every sample of your digital signal, and then sum all of the outputs. For example, for the above plot, the outcome would be following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/P8QF0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/P8QF0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now maybe some more complicated example of D/A conversion. On the plot below, you can see the actual samples (in blue) and &quot;analog&quot; $\mathrm{sinc}$ interpolated signal (in red).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yx6Vr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yx6Vr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plotting each function separately you can observe what will become an analog signal later:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jjxqb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jjxqb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that it is more intuitive for you now. In order to complete this example, here is some MATLAB code I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc, clear all, close all&#xA;fs = 32;&#xA;dt = 1/fs;&#xA;&#xA;% Generate a samples of the signal&#xA;ts = linspace(0, 1, 10);&#xA;s = 2*sin(2*pi*ts) + sin(2*pi*3*ts);&#xA;&#xA;td = linspace(0, (length(s)-1)*dt,     length(s));&#xA;t  = linspace(0, (length(s)-1)*dt, 100*length(s));&#xA;&#xA;sincM = repmat( t, length(td), 1 ) - repmat( td', 1, length(t) );&#xA;SS =  s* sinc( sincM/dt );&#xA;&#xA;% Sampled signal&#xA;stem(td, s, 'b', 'linewidth', 2)&#xA;hold on&#xA;% Reconstructed signal&#xA;plot(t, SS, 'r', 'linewidth', 2)&#xA;grid on&#xA;&#xA;legend({'sampled signal', 'interpolated signal'})&#xA;&#xA;figure &#xA;stem(td, s, 'b', 'linewidth', 2)&#xA;hold on&#xA;grid on&#xA;% Each sinc function&#xA;basis = sinc(sincM/dt)';&#xA;sbasis = bsxfun(@times, basis, s);&#xA;plot(t, sbasis)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-09-29T16:10:37.940" LastActivityDate="2015-09-29T16:10:37.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25652" PostTypeId="1" AcceptedAnswerId="25656" CreationDate="2015-09-05T19:02:15.313" Score="-1" ViewCount="208" Body="&lt;p&gt;Probably a stupid question, but I'm slowly making my way through Julius Smiths' filter book.  The maths is slightly defeating me at points.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This function $H(e^{j\omega t})$, why is it a function of a formula?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All my functions at school a decade ago were of a single variable, and you took the thing in the brackets and substituted it in.. it was nice and easy.  Here I'm confused.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing here it's talking about complex frequency.  But why is it written like this?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Weblr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Weblr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10794" LastEditorUserId="8202" LastEditDate="2015-09-05T19:33:55.957" LastActivityDate="2015-09-05T20:52:54.800" Title="How to interpret the notation of a transfer function" Tags="|filters|math|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25653" PostTypeId="2" ParentId="25652" CreationDate="2015-09-05T19:31:32.273" Score="2" Body="&lt;p&gt;There is a very nice relation between trigonometric functions and exponential function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{i \theta} = \cos(\theta) + i \sin(\theta)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos(\theta) = \dfrac{e^{i\theta}+e^{-i\theta}}{2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(\theta) = \dfrac{e^{i\theta}-e^{-i\theta}}{2i} $$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If we use the expansion for $\cos$ function then it becomes trivial for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(e^{i\omega T}) = (1+e^{-i\omega T})$$&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Expand your equation in order to get $-i\omega T / 2$ factor in exponent. This will give you a sum of two exponents, multiplied by the other one:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;H(e^{i\omega T}) =  \left(e^{i\omega T/2}+e^{-i\omega T/2} \right)e^{-i\omega T/2} &amp;amp;= \\e^{i\omega T/2} e^{-i\omega T/2} + e^{-i\omega T/2} e^{-i\omega T/2} &amp;amp;=\\ e^0 + e^{-i\omega T}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Use the identity mentioned above in order to obtain $\cos$ term, where $\theta = \omega T/2$. Multiply both sides by $2$:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$2\cos(\omega T/2) = 2\dfrac{e^{i\omega T/2}+e^{-i\omega T/2}}{2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2\cos(\omega T/2) =e^{i\omega T/2}+e^{-i\omega T/2} $$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Substitute the result:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$ H(e^{i\omega T}) = \left(e^{i\omega T/2}+e^{-i\omega T/2} \right)e^{-i\omega T/2} = 2\cos(\omega T/2) e^{-i\omega T/2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;QED.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-09-05T19:36:59.053" LastActivityDate="2015-09-05T19:36:59.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25655" PostTypeId="2" ParentId="17682" CreationDate="2015-09-05T20:18:54.827" Score="1" Body="&lt;p&gt;So the problem is that you want to classify some audio samples but each sample has different sizes. AFAIK there is no special way for doing this with (simple) neural networks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For general classifiers I am sure there are lots of ways but these are some very simple ones so you can begin playing with the problem:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Divide your signal by frames/segments of equal size and use each frame as if it were a training example. At the end you will use a voting strategy. Since you are using a neural network, you can use the probabilistic outputs of the last layer instead of the hard classes to weight this voting.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CLuD4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CLuD4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Using the average across all frames/segments in your signal. This is a very light-weight approach but can have good results sometimes.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rTf82.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rTf82.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way in the &quot;feature extraction&quot; part you will want to use some spectral-based transformation. I recommend either the logarithm of the spectrum or computing MFCC vectors. You can also train your network from raw audio but this is a bit unusual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should note that these two methods completely spoil the dynamics of your system because of the granularity. Try playing with the frame sizes or aggregating neighbor frames to increase or decrease the granularity.&lt;/p&gt;&#xA;" OwnerUserId="15743" LastEditorUserId="15743" LastEditDate="2015-09-05T20:25:46.907" LastActivityDate="2015-09-05T20:25:46.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25656" PostTypeId="2" ParentId="25652" CreationDate="2015-09-05T20:37:47.690" Score="0" Body="&lt;p&gt;That is just a standard convention in the signal processing literature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is written that way because a DTFT is evaluating the z-transform on the unit circle in the complex z-plane:&#xA;$$H(z)|_{z=e^{i\omega n}} = H(e^{i\omega n})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same convention is followed for CTFT's because a CTFT is evaluating the Laplace transform on the imaginary axis in the complex s-plane:&#xA;$$H(s)|_{s=i\Omega t} = H(i\Omega t)$$&lt;/p&gt;&#xA;" OwnerUserId="5535" LastActivityDate="2015-09-05T20:37:47.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25657" PostTypeId="2" ParentId="25652" CreationDate="2015-09-05T20:52:54.800" Score="1" Body="&lt;p&gt;I interpret the question a little differently and I'm trying answer specically &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;This function H(ejωt), why is it a function of a formula?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is simply a convention and arguably a little sloppy. The main tool to analyze time discrete systems is the Z-Transform which is the equivalent of the Laplace Transform in the time continuous domain. Hence you'll see a lot $H(z)$ where z is a single (albeit complex) variable. $z$ describes a location in the Z-plane. The most interesting part of the Z-plane is the unit circle, that's where the actual frequencies are that can be observed and measured. The function $z = e^{j \omega}$ with $\omega$ being a real valued variable (normalized frequency) describes exactly the unit circle in the Z plane. So when someone uses $H(e^{j \omega})$ they are saying &quot;I'm mostly interested in what happens on the unit circle&quot;. This can be parameterized with a real variable  instead of the whole Z plane that's parameterized with a complex variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Arguably it would cleaner to write this simply as $H(\omega)$ but $H(e^{j \omega})$ has the advantage that equations stay the same since $z$ and  $e^{j \omega}$ are interchangeable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice $H(\omega)$, $H(j\omega)$, $H(e^{j \omega})$, and $H(z)$ all mean basically the same thing and it's more a question of convention and convenience and there is rarely an actual difference.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-09-05T20:52:54.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25658" PostTypeId="2" ParentId="22012" CreationDate="2015-09-05T21:10:09.787" Score="0" Body="&lt;p&gt;I'm no matlab expert.  But is this really what you want? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lfo = abs(sin(2*pi*lfo_rate*[0:length(output)]/fs));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's going to have some sharp discontinuities in it.  Try plotting it.  The abs() probably isn't helpful.  Certainly it is't the standard waveshape for these things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/naH2J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/naH2J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Broadly you'll want: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;An LFO (lfo_value)&lt;/li&gt;&#xA;&lt;li&gt;A base delay time (delay_time)&lt;/li&gt;&#xA;&lt;li&gt;To modulate the base delay time with the LFO  (delay_time + lfo_value)&lt;/li&gt;&#xA;&lt;li&gt;A delay (possibly one with interpolation when you read the buffer (see source below)). &lt;/li&gt;&#xA;&lt;li&gt;A mixer on the output (i.e. sig_out = effect * mix + original * (1.0 - mix))&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Presumably the delay is working correctly.  Test that first with the mixer before adding the modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a fast simple delay line as a C++ class in case it's useful (you'll probably need your own version of AudioSampleBuffer but it's basically an array of float[] taken from the JUCE framework (&lt;a href=&quot;http://www.juce.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.juce.com/&lt;/a&gt;)): &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class SingleDelay&#xA;{&#xA;public:&#xA;    SingleDelay (int bsize)&#xA;        :&#xA;        buf (1, nextPowerOfTwo (bsize)),&#xA;        mask (nextPowerOfTwo (bsize) - 1),&#xA;        ptr (mask)&#xA;    {&#xA;        buf.clear();&#xA;        data = buf.getWritePointer (0);&#xA;    }&#xA;&#xA;    ~SingleDelay()&#xA;    {}&#xA;&#xA;    /** Return the value for a fractional delay time in samples. */&#xA;&#xA;    float geti (float delayTime)&#xA;    {&#xA;        const int   dInt    = delayTime;&#xA;        const float dFrac   = delayTime - float (dInt);&#xA;&#xA;        const int dlyIndex  = (ptr + dInt) &amp;amp; mask;&#xA;&#xA;        const float a = data[dlyIndex];&#xA;        const float b = data[ (dlyIndex + 1) &amp;amp; mask];&#xA;&#xA;        return a * (1.0f - dFrac) + b * dFrac;&#xA;    }&#xA;    /** Store the sample. Do this before returning delay taps&#xA;     for an accurate timing. &#xA;&#xA;     @note ptr points to the sample just written. So if/when we read later&#xA;     with a delay time of zero we actually get a sample!&#xA;     */&#xA;    void put (float inSignal)&#xA;    {&#xA;        data[mask &amp;amp; --ptr] = inSignal;&#xA;    }&#xA;&#xA;private:&#xA;    float* data;&#xA;    AudioSampleBuffer buf;&#xA;    int mask;&#xA;    int ptr;&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10794" LastActivityDate="2015-09-05T21:10:09.787" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25659" PostTypeId="2" ParentId="25649" CreationDate="2015-09-05T22:38:52.000" Score="1" Body="&lt;p&gt;There are basically two different methods to create reverb: you can store (simulated or measured) room impulses and apply it by convolution. Reverb impulse response are very, typically thousands of tabs. This makes direct convolution impractical and the method choice is overlap add or related FFT-framed algorithms. This will induce latency and and is difficult to update.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative would be a parametric algorithm. Typical building blocks include tap-delay lines, schroeder allpass filters, comb filters and feedback delay networks. Most of these blocks can be tied to some meaningful room acoustical parameter: reverb time as a function of frequency, refection density, mean free path length, etc. They also can be updated quickly and continuously. However they have a tendency to sound metallic and artificial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building good sounding reverb is hard. Many a thesis has been written on the topic and commercial reverb algorithms and/or devices often take hundreds of hours of development + tuning. I recommend doing some research and then deciding how deep you want to go in.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-09-05T22:38:52.000" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25661" PostTypeId="1" CreationDate="2015-09-06T02:40:37.837" Score="0" ViewCount="215" Body="&lt;p&gt;I am studying wavelet theory by myself and hope to use wavelet to denoise images. I write one matlab program to watch denoised image.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Gray = ones(512, 512, 'uint8');&#xA;Gray = Gray.*128;&#xA;Gray = imnoise(Gray, 'gaussian', 0, 0.01);&#xA;[cA1, cH1, cV1, cD1] = dwt2(Gray,  'db1');&#xA;[cA2, cH2, cV2, cD2] = dwt2(cA1/2, 'db1');&#xA;[cA3, cH3, cV3, cD3] = dwt2(cA2/2, 'db1');&#xA;[cA4, cH4, cV4, cD4] = dwt2(cA3/2, 'db1');&#xA;[cA5, cH5, cV5, cD5] = dwt2(cA4/2, 'db1');&#xA;figure; imshow(cA1/2, [0, 255]);&#xA;figure; ismhow(cA2/2, [0, 255]);&#xA;figure; ismhow(cA3/2, [0, 255]);&#xA;figure; ismhow(cA4/2, [0, 255]);&#xA;figure; ismhow(cA5/2, [0, 255]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I find cA3 contains a lot of noise even if three decompositions have been performed. If I increase noise level, I need to perform more decomposition to obtain one smooth image in the approximation coefficients. If number of wavelet decomposition level is big, modifications of detail coefficients of high decomposition level will affect a lot of pixels and edges may be smoothed. I try to change wavelet family,but the problem still occurs. &#xA;By the way, the function dwt2 seems to magnify the values of approximation coefficients by 2. Why does dwt2 behave like that?&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2015-09-06T02:40:37.837" Title="relationship between number of wavelet decomposition level and noise level" Tags="|noise|wavelet|denoising|" AnswerCount="0" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="25662" PostTypeId="2" ParentId="25641" CreationDate="2015-09-06T02:49:35.677" Score="1" Body="&lt;p&gt;The sampling theorem says that you can reconstruct your signal, using a low pass filter. For an ideal low pass filter, in time domain we have sinc functions, that is the equation 1.4.22. So, in the time domain, you have the convolution between this sinc function and your samples. The samples are represented as kronecker deltas, so the convolution result is the sum of the sinc functions shifted in the samples time positions (Eq 1.4.24). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shifted sinc functions you can see as a solid line in the graph. The dashed curve are the reconstructed signal, the sum of the sinc functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's difficult to see the sinc functions in the graph, but use your imagination (I presume that you know what is a sinc function).&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-09-06T02:49:35.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25663" PostTypeId="1" AcceptedAnswerId="25669" CreationDate="2015-09-06T06:58:48.557" Score="0" ViewCount="3189" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/O3AMT.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O3AMT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;Hi all,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we interpret a power spectral density plot. I have used modified covariance and burg methods and plotted using MATLAB. What does the peaks at some frequencies suggest? and what is the difference between positive and negative power in the graph?  how do we know that which frequencies variations are strong and at which frequencies variations are weak.. can anyone help me please..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="17278" LastEditorUserId="17278" LastEditDate="2015-09-06T07:08:43.643" LastActivityDate="2015-09-06T15:10:39.547" Title="power spectral density plots" Tags="|power-spectral-density|covariance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25665" PostTypeId="1" CreationDate="2015-09-06T12:47:41.270" Score="4" ViewCount="1191" Body="&lt;p&gt;I have a stream of 250 samples per second arriving at a pipeline stage which looks something like this simplified example.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class PipeLineStage(...):&#xA;    historical_buffer = []&#xA;    def _process(self, sample):&#xA;        historical_buffer.append(sample)&#xA;        altered_sample = ...&#xA;        return altered_sample&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;_process&lt;/code&gt; gets called indirectly by the pipeline manager whenever a new sample arrived from the device and the returned value it passed to the next stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want the effect of the function to apply a 50hz notch filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: &lt;strong&gt;how should I ideally window/buffer the signal of the incoming samples?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, How should I:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;decide how many samples are optimal to filter out a 50hz signal when the sample rate is 250hz? (with minimal delay for live viewing)&lt;/li&gt;&#xA;&lt;li&gt;manage the windowing of a continuous signal; worth applying an lfilter over overlapping buffers e.g. samples 1-100, then 50-150, then 100-200 etc? or is it just as good to clear the buffer after each application of the lfilter and have separate/discrete windows, e.g. samples 0-100, 100-200 etc?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In other words, my concern it whether applying a butterfilter with lfilter to discrete windows will introduce discontinuities or other artefacts in the filtered signal significant enough to justify the performance cost of a rolling window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the way I'm thinking about this make sense?&lt;/p&gt;&#xA;" OwnerUserId="17281" LastEditorUserId="17281" LastEditDate="2015-09-06T13:14:46.270" LastActivityDate="2015-09-07T09:20:54.377" Title="Optimal windowing strategy for filtering live signal" Tags="|python|filtering|real-time|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25666" PostTypeId="1" AcceptedAnswerId="25668" CreationDate="2015-09-06T13:47:20.093" Score="2" ViewCount="1356" Body="&lt;p&gt;I am trying to resample a signal using the fourier method in python using &lt;code&gt;np.fft.rfft()&lt;/code&gt; and &lt;code&gt;np.fft.irfft()&lt;/code&gt;. (I'm not using &lt;code&gt;scipy.signal.resample()&lt;/code&gt; because in my final application I need to do more to my signal in the frequency domain than what can be accomplished by the &lt;code&gt;window&lt;/code&gt; argument of &lt;code&gt;scipy.signal.resample()&lt;/code&gt;.) I have reduced the problems I see to this simple test case (ipython notebook):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%pylab inline&#xA;&#xA;N = 16&#xA;P = 8&#xA;&#xA;S = [0.49, 1.68, 0.78, 0.05, 0.21, 0.29, 1.34, 1.17, 16.73,&#xA;     48.78, 16.90, 0.62, 0.40, 1.60, 0.86, 0.57]&#xA;assert len(S) == N&#xA;&#xA;figure(figsize=(14, 5))&#xA;plot(np.arange(N), S, '.')&#xA;&#xA;dft = np.fft.rfft(S)&#xA;plot(np.arange(N), np.fft.irfft(dft), '-')&#xA;&#xA;dft *= P&#xA;dft.resize(P*N/2+1)&#xA;plot(np.arange(P*N)/P, np.fft.irfft(dft), '-')&#xA;&#xA;xlim(6.5, 11.5)&#xA;ylim(-5, 55);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is what I get back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oZruL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oZruL.png&quot; alt=&quot;plot produced by ipython notebook&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the result looks almost correct, but is nevertheless a bit off. (The resampled red curve does not go through the original sample points, even though there are sample points at the same positions in time as in the original signal.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The greeen line shows that everything is still ok before extending and scaling the &lt;code&gt;dft&lt;/code&gt; array. So the problem seems to be in the actual resampling:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dft *= P&#xA;dft.resize(P*N/2+1)&#xA;plot(np.arange(P*N)/P, np.fft.irfft(dft), '-')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't see how this result is mathematically possible because other than scaling of time and amplitude axis, adding zeroes to the high-frequency end of the &lt;code&gt;dft&lt;/code&gt; array should only add zero terms to the fourier series expansion of the signal. So the signal should still pass through the original sample values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the small error I see does not seem to be related to scaling: sometimes the resampled waveform lags behind the original (t=8) and sometimes it is faster (t=10), sometimes it is larger in magnitude (t=7,9,11) and sometimes it is smaller (t=8,10).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm playing with this for hours now and can't find what is wrong with my code.. Maybe I just don't see it because I'm already staring at it for so long now..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(see &lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/routines.fft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;np.fft&lt;/code&gt; documentation&lt;/a&gt; for the definitions used by the python FFT implementations)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit (in response to comment): When I replace S with an impulse at t=9, or a fast impulse train, I get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6x7iy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6x7iy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MMa9M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MMa9M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4481" LastEditorUserId="4481" LastEditDate="2015-09-06T14:00:16.327" LastActivityDate="2015-09-06T14:56:18.773" Title="Unexpected results for fourier resampling (Python 3)" Tags="|fft|python|resampling|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25668" PostTypeId="2" ParentId="25666" CreationDate="2015-09-06T14:56:18.773" Score="5" Body="&lt;p&gt;If you perform the full DFT of a signal with &lt;em&gt;odd&lt;/em&gt; number of samples, the frequency values in the spectrum are a DC coefficient and (N-1)/2 conjugate pairs of sinusoid coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you perform the full DFT of a signal with &lt;em&gt;even&lt;/em&gt; number of samples, the frequency values in the spectrum are a DC coefficient, (N-1)/2 conjugate pairs of sinusoid coefficients, and a single coefficient corresponding to frequency 0.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;rfft&lt;/code&gt; only keeps the positive frequency part of the spectrum, and the inverse, &lt;code&gt;irfft&lt;/code&gt;, presumably recreates the negative part of the spectrum before performing an inverse-DFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, for an odd size signal with &lt;code&gt;rfft&lt;/code&gt; of &lt;code&gt;[0 1 2 3]&lt;/code&gt;, the full spectrum would be &lt;code&gt;[3 2 1 0 1 2 3]&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an even size signal with &lt;code&gt;rfft&lt;/code&gt; of &lt;code&gt;[0 1 2 3 4]&lt;/code&gt; it presumably has a flag set somewhere in the code that indicates an even sized signal, and so the full spectrum would be &lt;code&gt;[3 2 1 0 1 2 3 4]&lt;/code&gt;. Note the &lt;code&gt;4&lt;/code&gt; only appears once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you pad the &lt;code&gt;rfft&lt;/code&gt; result though, e.g. &lt;code&gt;[0 1 2 3 4 0 0 0 0]&lt;/code&gt;, it probably recreates the spectrum as &lt;code&gt;[0 0 0 4 3 2 1 0 1 2 3 4 0 0 0 0]&lt;/code&gt;. That is, the &lt;code&gt;4&lt;/code&gt; is now repeated twice, and therefore that frequency component is twice as strong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, before padding you must halve the last &lt;code&gt;rfft&lt;/code&gt; coefficient iff the signal has an even number of samples.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-06T14:56:18.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25669" PostTypeId="2" ParentId="25663" CreationDate="2015-09-06T15:10:39.547" Score="0" Body="&lt;p&gt;The plot is not of power.  The units of the $y$ axis are &lt;em&gt;dB/Hz&lt;/em&gt;. The &lt;em&gt;dB&lt;/em&gt; part means that a &lt;a href=&quot;https://en.wikipedia.org/wiki/Decibel&quot; rel=&quot;nofollow&quot;&gt;decibel scale&lt;/a&gt; is used, which means it is a scale &lt;em&gt;relative&lt;/em&gt; to a reference value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that negative values on a decibel scale mean is that the actual power is less than the reference power (because the ratio is less than one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The higher the decibel value, the more powerful the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your signal has a major peak at about 4Hz, and lesser peaks at 28Hz and 39Hz.  There might be something happening at about 12Hz, but it's hard to say without more information (or data).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-06T15:10:39.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25670" PostTypeId="1" CreationDate="2015-09-06T15:29:29.170" Score="0" ViewCount="294" Body="&lt;p&gt;I have a baseband, bandlimited signal of 100 Hz.  I sampled it at 2000 Hz.  Now for reconstruction if I pass them (the samples) through an analog filter of say 200 Hz, would the reconstructed signal be same as the original analog signal.  In books they pass it through a LPF with cutoff frequency of 1000 Hz.  I am questioning like what happens if I pass through various LPFs of cutoff frequencies above 200 Hz i.e. 300 Hz, 500 Hz, 1000 Hz.  Would there be differences or not? &lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="13320" LastEditDate="2015-09-07T13:06:07.360" LastActivityDate="2015-09-07T13:06:07.360" Title="Reconstruction of an oversampled signal with sub-nyquist analog filters" Tags="|sampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25671" PostTypeId="2" ParentId="25670" CreationDate="2015-09-06T15:53:26.507" Score="2" Body="&lt;p&gt;If you sample your signal at 2000 Hz, in frequency domain, you will have your signal shifted to 2000 Hz, and its multiples. As your signal has bandwidth of 100 Hz, the minor frequency that you don't want will be 1900 Hz. So in theory, thinking about an ideal low pass filter, you can filter in any frequency between 100 Hz and 1900 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if use a low pass filter with cutoff frequency in this range, you will be able to reconstruct your signal. Nothing different happens.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It is easier to answer your question when you think about what is happening in frequency domain when you samples your signal: the spectrum becomes periodic in the frequency of sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the figure bellow. In (a) you have the spectrum of your original signal. In (c), you have the sampled signal spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you sample at $ f_{S} $, a replica of the signal will appear there and in $ -f_{S} $, and in its multiples (not show in the figure). So, you need to eliminate this components using a low pass filter to reconstruct your original signal. So, you can use a low pass filter with cutoff frequency anywhere between $ f_{max} $ and $ f_{S} - f_{max} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I6MGC.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I6MGC.jpg&quot; alt=&quot;Effects of time sampling in frequency domain.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-09-06T15:53:26.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25672" PostTypeId="1" CreationDate="2015-09-06T15:59:32.087" Score="2" ViewCount="3208" Body="&lt;p&gt;The FIR low-pass filter was designed in MATLAB which characteristics are listed below. Coefficient of this filter was written in variable h. Basis on this filter design a band-pass filter with central frequency 1/5(normalized to fs) keeping the same gain and bandwidth. Give the listing in MATLAB(no using buitl-in function) which allow to set down coefficients of designing filter hx. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/njmyB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/njmyB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="17282" LastActivityDate="2015-09-06T21:07:49.130" Title="How to transform lowpass fir filter to bandpass fir filter without using a built in function in matlab" Tags="|filter-design|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25673" PostTypeId="1" CreationDate="2015-09-06T16:23:37.233" Score="0" ViewCount="1114" Body="&lt;p&gt;Write listing in MATLAB which design a low-pass IIR filter basis on Butterworth (Rp=2dB, Rr=40dB, fp=1000 Hz, fr=1300 Hz, fs=5000 Hz) as a prototype and using bilinear transform without built-in functions. Control the point(fr,Rr). Plot the response characteristic (linear scale, and dBs scale). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/o0Wlw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o0Wlw.png&quot; alt=&quot;formulas&quot;&gt;&lt;/a&gt;   &lt;/p&gt;&#xA;" OwnerUserId="17282" LastActivityDate="2015-09-06T16:23:37.233" Title="Design IIR Butterworth filter using bilinear transform" Tags="|filter-design|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25674" PostTypeId="1" AcceptedAnswerId="25964" CreationDate="2015-09-06T17:30:16.287" Score="1" ViewCount="304" Body="&lt;p&gt;I am working on speech synthesis with LPC and I originally implemented a pre-emphasis filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+(void)processBuffer:(Buffer *)buffer {&#xA;    float alpha = -0.9375f;&#xA;    for (int i = 1; i &amp;lt; buffer.size; i++) {&#xA;        buffer.samples[i] += buffer.samples[i - 1] * alpha;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And found that my output audio was distorting, so I adding some code to scale the values, and so now it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+(void)processBuffer:(Buffer *)buffer {&#xA;    float preEnergy = [self energyFor:buffer];&#xA;&#xA;    float alpha = -0.9375f;&#xA;    for (int i = 1; i &amp;lt; buffer.size; i++) {&#xA;        buffer.samples[i] += buffer.samples[i - 1] * alpha;&#xA;    }&#xA;&#xA;    [self scaleBuffer:buffer preEnergy:preEnergy postEnergy:[self energyFor:buffer]];&#xA;}&#xA;&#xA;+(void)scaleBuffer:(Buffer *)buffer preEnergy:(double)preEnergy postEnergy:(double)postEnergy {&#xA;    float scale = sqrt(preEnergy / postEnergy);&#xA;&#xA;    for (int i = 0; i &amp;lt; buffer.size; i++) {&#xA;        buffer.samples[i] *= scale;&#xA;    }&#xA;}&#xA;&#xA;+(float)energyFor:(Buffer *)buffer {&#xA;    double sum = 0.0;&#xA;&#xA;    for (int i = 0; i &amp;lt; buffer.size; i++) {&#xA;        sum += buffer.samples[i] * buffer.samples[i];&#xA;    }&#xA;    return sum; &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am finding that the speech I am generating still doesn't sound very good, and so I am just wondering if my implementation for this filter is ok?  Does anyone see anything I am doing wrong or does this look ok?&lt;/p&gt;&#xA;" OwnerUserId="11807" LastActivityDate="2015-09-21T22:26:01.487" Title="pre-emphasis with scaling?" Tags="|lpc|preprocessing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25675" PostTypeId="2" ParentId="25672" CreationDate="2015-09-06T20:51:28.260" Score="2" Body="&lt;p&gt;Mathematically, applying a FIR with impulse response $h_\mathrm{lpf}[n]$ to digital signal is convolution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y = x * h_\mathrm{lpf}$, or thanks to the properties of the (discrete) Fourier transform,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y = X\cdot H_\mathrm{lpf}$, as convolution becomes multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, making a bandpass out of a low pass can be modeled by shifting the Frequency response $H_\mathrm{lpf}$ in frequency domain. &quot;Shifting&quot; can be represented by a convolution of the low pass filter with a dirac impulse at the desired center frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_\mathrm{bpf}= H_\mathrm{lpf} * \delta_{f_\mathrm{center}} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, convolution becomes multiplication when transformed to time domain. The inverse (discrete) Fourier transform of a dirac at ${f_\mathrm{center}}$ is a complex oscillation $e^{2\pi{f_\mathrm{center}}n}$, so this becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = x * (h_\mathrm{lpf} \cdot e^{2\pi{f_\mathrm{center}}n})$&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-06T20:51:28.260" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25676" PostTypeId="2" ParentId="25674" CreationDate="2015-09-06T21:03:27.687" Score="2" Body="&lt;p&gt;The most glaring problem is that &lt;code&gt;buffer.samples[0]&lt;/code&gt; is never filtered because the &lt;code&gt;for&lt;/code&gt; loop goes from 1 to size-1.  This is an inherent problem in the implementation of FIR filters in software where you are dealing with buffers of data rather than an infinite stream. In the more general case, where your filter has N states you would need to store N-1 states so that they can be used on the next invocation of the filter. Since your filter only has two taps and the implementation is rather more simple than a general solution would be.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// state is a member variable of the class initialized to zero.&#xA;float alpha = -0.9375f;&#xA;buffer.samples[0] += state * alpha;&#xA;for (int i = 1; i &amp;lt; buffer.size; i++) {&#xA;    buffer.samples[i] += buffer.samples[i - 1] * alpha;&#xA;}&#xA;state = buffer.samples[buffer.size-1]; // store for the next time.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Scaling&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Your filter has close to 2x gain in the passband that might be causing you problems. I suspect samples need to stay in the range of -1 to 1. Imagine samples was a stream of [...,1,-1,1,-1,...] (this happens to be a sine wave at the sampleRate/2).  Your filter output is going to be [...,-1+1*-0.98,1+-1*-0.98,...] which is approximately [...,-2,2,-2,2,...]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The strategy of scaling each consecutive buffer by the filter gain for that buffer is a nice idea but it has the unfortunate property of producing a different scaling factor every time you call it. This would likely introduce a transient between each buffer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is better to analyze the filter and choose a constant at design time to scale by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case the would be 1/2.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// state is a member variable of the class initialized to zero.&#xA;float alpha = -0.9375f;&#xA;buffer.samples[0] += state * alpha;&#xA;buffer.samples[0] *= 0.5;&#xA;for (int i = 1; i &amp;lt; buffer.size; i++) {&#xA;    buffer.samples[i] += buffer.samples[i - 1] * alpha;&#xA;    buffer.samples[i] *= 0.5;&#xA;}&#xA;state = buffer.samples[buffer.size-1]; // store for the next time.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course if you wanted the gain then disregard this part.&lt;/p&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-09-06T21:03:27.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25678" PostTypeId="2" ParentId="25415" CreationDate="2015-09-06T21:53:49.377" Score="0" Body="&lt;p&gt;I'd recommend looking at &lt;a href=&quot;https://en.wikipedia.org/wiki/Image_stitching&quot; rel=&quot;nofollow&quot;&gt;image stitching&lt;/a&gt; algorithms. Even though you don't want to actually combine the images into one, that's still essentially what you're doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might even be able to use an off-the-shelf stitching algorithm to get a rough measure. e.g. If the stitched image is 100 pixels wide, and your two source images are 80 pixels wide, then horizontally you have a 60 pixel overlap.&lt;/p&gt;&#xA;" OwnerUserId="451" LastActivityDate="2015-09-06T21:53:49.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25679" PostTypeId="2" ParentId="25665" CreationDate="2015-09-07T09:20:54.377" Score="2" Body="&lt;p&gt;If possible, design your filter, and then do what must be done (buffering etc.) to implement that filter properly. When implementing a finite impulse response (FIR) filter such as: (pseudocode:)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;out[t] = 0.5*in[t] - 0.6*in[t-1] + 0.7*in[t-2] - 0.8*in[t-3]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;t&lt;/code&gt; is an integer time index, you could do it so that you store a few of the past &lt;code&gt;in&lt;/code&gt; values in a buffer, like this, stepping &lt;code&gt;t&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t buf[0] buf[1] buf[2]&#xA;----------------------&#xA;0 0      0      0&#xA;1 0      0      in[0]&#xA;2 0      in[0]  in[1]&#xA;3 in[0]  in[1]  in[2]&#xA;4 in[1]  in[2]  in[3]&#xA;5 in[2]  in[3]  in[4]&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That way you always have &lt;code&gt;in[t-1]&lt;/code&gt;, &lt;code&gt;in[t-2]&lt;/code&gt; and &lt;code&gt;in[t-3]&lt;/code&gt; available for calculation of &lt;code&gt;out[t]&lt;/code&gt;. Perhaps you were worried about the performance cost of moving data in a &quot;rolling&quot; buffer like this. But that extra work can be avoided by using a circular buffer, the length of which is usually rounded up to the nearest &lt;code&gt;2^n&lt;/code&gt; (integer &lt;code&gt;n&lt;/code&gt;) so that wrap-around can be done using binary &lt;code&gt;and (2^n-1)&lt;/code&gt;. The next write position is stored here in an extra state variable &lt;code&gt;i&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t i buf[0] buf[1] buf[2] buf[3]&#xA;-------------------------------&#xA;0 0 0      0      0      0&#xA;1 1 in[0]  0      0      0&#xA;2 2 in[0]  in[1]  0      0&#xA;3 3 in[0]  in[1]  in[2]  0&#xA;4 0 in[0]  in[1]  in[2]  in[3]&#xA;5 1 in[4]  in[1]  in[2]  in[3]&#xA;6 2 in[4]  in[5]  in[2]  in[3]&#xA;7 3 in[4]  in[5]  in[6]  in[3]&#xA;8 0 in[4]  in[5]  in[6]  in[7]&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are using single-instruction-multiple-data (SIMD) acceleration, it can be more straightforward to also write the current &lt;code&gt;in[t]&lt;/code&gt; into the buffer before calculation of &lt;code&gt;out[t]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an infinite impulse response (IIR) filter (like Butterworth) you can use another circular buffer for the past &lt;code&gt;out&lt;/code&gt; values. This would give an IIR implementation structure called direct form I. There are other structures that may or may not have better numerical stability, see &lt;a href=&quot;http://www.earlevel.com/main/2003/02/28/biquads/&quot; rel=&quot;nofollow&quot;&gt;http://www.earlevel.com/main/2003/02/28/biquads/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't care about the phase of the filter's frequency response, a simple two-pole, two-zero notch IIR filter will do the job of eliminating 50 Hz: (pseudocode:)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;params:&#xA;fs = sampling frequency&#xA;f = notch frequency&#xA;r = sharpness, 0..1 excluding 1&#xA;&#xA;init:&#xA;z1x = cos(2*pi*f/fs)&#xA;a0a2 = (1.0 - r)*(1.0 - r)/(2.0*(fabs(z1x) + 1.0)) + r&#xA;a1 = -2.0*z1x*a0a2&#xA;b1 = 2.0*z1x*r&#xA;b2 = -r*r&#xA;&#xA;loop:&#xA;out[t] = a0a2*(in[t] + in[t-2]) + a1*in[t-1]&#xA;         + b1*out[t-1] + b2*out[t-2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For such a simple filter you may want to skip implementing an elaborate indexed buffering scheme.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-09-07T09:20:54.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25681" PostTypeId="2" ParentId="25619" CreationDate="2015-09-07T10:52:09.687" Score="2" Body="&lt;p&gt;The entropy $H(X)$ of a continuous random variable $X$ is infinite. Proof is trivial (note that we can, without loss of generality, use the natural logarithm, since any other logarithm is the same but with a factor: $\log_b(x) = \frac 1{\ln(b)}\ln(x)$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}&#xA;\\H(X) &amp;amp;= E\{I(X)\}\\&#xA;&amp;amp;= \int\limits_{-\infty}^{\infty}{-\ln\left(P(X=x)\right) dx}&#xA;\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point here is that for any really continuously distributed random variable, the probability that a specific real value gets &quot;hit&quot; is $P(X=x)\equiv 0 \,\forall x$, and hence, the information contained in that event happening would be infinite. You hence cannot directly compare discrete alphabets with dense intervals (such as the whole $\mathbb R$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, people invented &lt;strong&gt;differential Entropy&lt;/strong&gt;. For your real-valued (=1-dimensional) case, this is nothing but the obvious:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(x) = \int\limits_{-\infty}^{\infty} f(x)\log_b\left(f(x)\right)dx \text{,}$$ with $f$ being the continuous probability density function of $X$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, all you need to compare your discrete case with the continuous is model the discrete PDF for the alphabet $\mathbb X$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_\text{discrete}(x) = \sum\limits_{x_i\in\mathbb X} \delta(x - x_i)P_\text{discrete}(x_i) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\delta$ is the dirac function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Caveat&lt;/strong&gt; not everything you know about the discrete entropy applies to differential entropy. &lt;a href=&quot;https://en.wikipedia.org/wiki/Differential_entropy&quot; rel=&quot;nofollow&quot;&gt;Read the Wikipedia Article&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2015-09-08T17:30:07.077" LastActivityDate="2015-09-08T17:30:07.077" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25682" PostTypeId="1" CreationDate="2015-09-07T12:05:45.980" Score="0" ViewCount="352" Body="&lt;p&gt;I need to recognize just one bird. I am trying to compare the syllables extracted from the sound samples. As a result of the spectrogram function, the power spectral density is taken from the sound. They are 2 dimensional values. I like to compare this test signal with a known signal which is another 2 dimensional value. Could you please suggest what would be the best function to use for comparison. Please keep in mind that the syllable of the test bird could be time shifted or they closely match the original bird. I am attaching the sample spectrogram and its syllable extracted here after filtering.. &lt;a href=&quot;https://i.stack.imgur.com/VOfij.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VOfij.png&quot; alt=&quot;First figure is the spectrogram before filtering. Second figure is the result of attempting to extract just the syllable.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="17284" LastActivityDate="2015-09-07T19:59:47.423" Title="How to compare the syllable extracted from the audio" Tags="|matlab|cross-correlation|spectrogram|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25684" PostTypeId="1" AcceptedAnswerId="25972" CreationDate="2015-09-07T14:05:36.567" Score="3" ViewCount="1290" Body="&lt;p&gt;Given a known signal $ x \left( t \right) $ and its delayed version $ y \left(t, \tau \right) = x \left( t - \tau \right) $.&lt;br&gt;&#xA;Both are sampled by Sampling Frequency $ {F}_{s} $ to generate the signals $ x \left[ n \right] $ and $ y \left[ n \right] $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume they are sampled on a time support much larger than their non zero time (Namely, the whole part of the signal where it is not vanished is sampled).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given those 2 sampled signals, using Cross Correlation (Matched Filter) the Delay Parameter $ \tau $ can be estimated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, its estimation is limited to the grid defined by the sampling Frequency which means if $ \tau &amp;lt; {T}_{s} = \frac{1}{{F}_{s}} $ the estimation isn't accurate (Actually, the part which is the modulo of the time interval can't be estimated).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an effective method to estimate the delay in Sub Sampling resolution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="17286" LastEditorUserId="128" LastEditDate="2015-09-22T11:26:31.847" LastActivityDate="2015-10-20T20:13:29.237" Title="Estimate Delay of a Known Signal Delayed by Sub Sample Resolution" Tags="|sampling|estimation|interpolation|matched-filter|" AnswerCount="4" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="25685" PostTypeId="2" ParentId="25684" CreationDate="2015-09-07T14:26:37.390" Score="4" Body="&lt;p&gt;Since the Matched Filter is used the Cross Correlation becomes &quot;Auto Correlation&quot; which is assured to be &quot;Symmetric&quot; relative to its maximum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence a good approximation would be to approximate the area around the sampled peak by a Symmetric Function as a parametric model of the function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most trivial and easiest model for such function would be the Parabolic Function which is illustrated in the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some &lt;code&gt;scilab&lt;/code&gt; code that does the cross-correlation and then finds the inter-sample peak by doing &lt;a href=&quot;https://stackoverflow.com/a/717791/12570&quot;&gt;a simple (ish) parabolic interpolation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot shows the absolute relative error between the truth and the estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/r4Gaf.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/r4Gaf.gif&quot; alt=&quot;Absolute relative error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 25684&#xA;vals= [];&#xA;taus = [-0.5:.005:0.5] + 10^-9; // Add a small amount to not have a zero.&#xA;&#xA;for tau = taus&#xA;&#xA;    N = 1000;&#xA;    t = 0:N-1;&#xA;    omega=0.1902834909;&#xA;    phi = 2*%pi*0.3823483924;&#xA;&#xA;    x = sin(omega*t + phi);&#xA;    x_tau = sin(omega*(t-tau) + phi);&#xA;&#xA;    xc = xcorr(x_tau,x);&#xA;&#xA;    [mx,ix] = max(xc);&#xA;&#xA;    x_vals = [-1 0 +1];&#xA;    y_vals = xc(ix + x_vals);&#xA;&#xA;    //https://stackoverflow.com/a/717791/12570&#xA;    den = (x_vals(1) - x_vals(2))*(x_vals(1) - x_vals(3))*(x_vals(2) - x_vals(3));&#xA;    A = x_vals(3)*(y_vals(2) - y_vals(1)) + x_vals(2)*(y_vals(1) - y_vals(3)) + x_vals(1)*(y_vals(3) - y_vals(2))&#xA;    A = A/den;&#xA;&#xA;    B = x_vals(3)^2*(y_vals(1) - y_vals(2)) + x_vals(2)^2*(y_vals(3) - y_vals(1)) + x_vals(1)^2*(y_vals(2) - y_vals(3));&#xA;    B = B/den;&#xA;&#xA;    C = x_vals(2) * x_vals(3) * (x_vals(2) - x_vals(3))* y_vals(1) + x_vals(3) * x_vals(1) * (x_vals(3) - x_vals(1))* y_vals(2) + x_vals(1) * x_vals(2) * (x_vals(1) - x_vals(2))* y_vals(3);&#xA;    C = C/den;&#xA;&#xA;    x_v = -B / (2*A);&#xA;    y_v = C - B*B / (4*A);&#xA;&#xA;    vals= [vals; tau x_v y_v];&#xA;&#xA;end &#xA;&#xA;clf&#xA;plot(taus,abs((vals(:,2)' - taus)./taus));&#xA;xlabel('True value of delay');&#xA;title('Error in using parabola peak as subsample delay estimate');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-09-22T12:44:59.297" CommentCount="22" CommunityOwnedDate="2015-09-22T12:47:59.400" ContentLicense="CC BY-SA 3.0" />
  <row Id="25686" PostTypeId="2" ParentId="25684" CreationDate="2015-09-07T15:11:37.843" Score="1" Body="&lt;p&gt;As the question as been focused, I edit the answer in a three-fold way: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One first approach consists in (somehow) compensating the unknow delay, by applying the initial algorithm for several delays, and in comparing results. This can be done brute force or with optimization loops. One frequent filter design for such a task is known as the &lt;a href=&quot;https://ccrma.stanford.edu/~jos/Interpolation/Thiran_Allpass_Interpolators.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Thiran Allpass Interpolators&lt;/a&gt;. A Matlab implementation is given at: &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Thiran_Allpass_Interpolation_Matlab.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Thiran Allpass Interpolation in Matlab&lt;/a&gt;. A reference paper is J.-P. Thiran, &lt;a href=&quot;http://dx.doi.org/10.1109/TCT.1971.1083363&quot; rel=&quot;nofollow noreferrer&quot;&gt;Recursive digital filters with maximally flat group delay&lt;/a&gt;, 1971, IEEE Transactions on Circuits Theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A second approach may consist in finding a more invariant transformation. The phase suggested by @Richard Lyons is a very good  option, since several Fourier transforms possess nice shift/time invariant properties. The two above methods can be extented with GCC or  &lt;a href=&quot;https://dsp.stackexchange.com/questions/8732/generalized-cross-correlation&quot;&gt;Generalized Cross Correlation&lt;/a&gt;, a link with nice background references (like &lt;a href=&quot;http://dx.doi.org/10.1109/TASSP.1979.1163269&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimum Estimation of Time Delay by a Generalized Correlator&lt;/a&gt;, IEEE Trans. Acoustics, Speech and Signal Processing, 1979). They can also be merged, for instance with &lt;a href=&quot;http://www.xavieranguera.com/phdthesis/node92.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;GCC-PHAT Cross-Correlation&lt;/a&gt;, including phase information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Invariance is indeed a neat concept, and may be used as well using other signal properties (or non-properties). If the process under consideration is quite stationary, you can get good results with the methods above, up to an integer number of periods if the signal is periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case the data is unstationary, has amplitude variations, gets noisy, other methods, or combinations, can be useful. Wavelets can deal with unstationarity. Some are quite shift-invariant. Some others are complex and provide local phase information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest a combination of continuous complex wavelets and correlation, such as the one proposed in &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/7503463&quot; rel=&quot;nofollow noreferrer&quot;&gt;Time Delay Estimation Using Wavelet Transform for Pulsed-Wave Ultrasound&lt;/a&gt;, Annals of Biomedical Engineering, 1995. Other reference? &lt;a href=&quot;http://dx.doi.org/10.1109/78.790670&quot; rel=&quot;nofollow noreferrer&quot;&gt;On Wavelet Denoising and its Applications to Time Delay Estimation&lt;/a&gt;, IEEE Transactions on Signal Processing, 1999.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A careful reference analysis or the above mentioned concepts may provide you with other useful  insights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My personal experience is not global. It is mostly based on image processing experience, and a work on &lt;a href=&quot;http://arxiv.org/abs/1108.4674&quot; rel=&quot;nofollow noreferrer&quot;&gt;local delay adaptation for adaptive pattern subtraction in seismic data&lt;/a&gt;, using complex wavelets and very short one-tap (unary) complex phase filters, which proved to work quite well.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-10-20T20:13:29.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25687" PostTypeId="1" CreationDate="2015-09-07T15:40:21.770" Score="2" ViewCount="605" Body="&lt;p&gt;I realize that this seems redundant, but I'm getting consistently better results when performing machine learning techniques that use spectral features extracted using the moving average process below, rather than using STFT results alone.  I'm a machine learning guy by trade, and I don't have a background in signal processing.  I'm hoping you guys might be able to guide me in the right direction here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;STFT process:&#xA;I use a 10 second STFT window with 9 second overlap. The result is 1 second spaced observations that contain 10 seconds of information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;STFT Moving Average process:&#xA;I use a 2.5 second STFT window with a 1/480 second increment (480Hz sample rate), then take a 10 second moving average with a 1 second increment.  The result is 1 second spaced observations that contain 12.5 seconds of information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My reasoning for using the moving average process was that I get a smoother signal to work with, but I'm not sure that it makes sense to signal processing folks. Is there anything fundamentally wrong with doing things this way besides having to deal with the additional computational cost?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: It seems like the reason for the improved results is related to the theory behind using Welch's method for power estimation. Maybe?&lt;/p&gt;&#xA;" OwnerUserId="17289" LastEditorUserId="-1" LastEditDate="2015-09-07T19:03:01.327" LastActivityDate="2018-05-25T12:29:05.807" Title="Taking the Moving Average of STFT Results" Tags="|stft|moving-average|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25688" PostTypeId="2" ParentId="25684" CreationDate="2015-09-07T15:54:34.167" Score="1" Body="&lt;p&gt;You can interpolate samples at fractional positions by using a high quality interpolation function or kernel, such as a wide enough windowed Sinc kernel.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-09-07T15:54:34.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25690" PostTypeId="2" ParentId="25687" CreationDate="2015-09-07T18:00:22.237" Score="1" Body="&lt;p&gt;As rb-j says in his comment, this is often how the (magnitude-squared) STFT is smoothed $-$ using a moving average window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only concern &lt;em&gt;might&lt;/em&gt; be that you're using too much smoothing. A 10 second moving average window (resulting in a 12.5 second &quot;effective&quot; window) may mean that some artifacts take a while to show or do not show up at all.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-07T18:00:22.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25692" PostTypeId="2" ParentId="25682" CreationDate="2015-09-07T19:59:47.423" Score="1" Body="&lt;p&gt;A quick google for &quot;bird voice recognition&quot; yielded&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://peerj.com/articles/488/&quot; rel=&quot;nofollow&quot;&gt;https://peerj.com/articles/488/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has an abstract describing that the authors refined the results they got using the old-school Mel-frequency cepstral coefficient comparison, as it has been common in (human) speech recognition for decades. I could start explaining what cepstrals and Mel-frequencies are, but there's so much literature out there that you literally just have to click read the first thing that hits you when you google for that. It's a relatively well-researched topic.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-07T19:59:47.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25693" PostTypeId="1" CreationDate="2015-09-07T20:02:22.057" Score="0" ViewCount="459" Body="&lt;p&gt;I am studying for a Digital Communications course in my university, and I am presented with the following example exercise.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You have a sound signal with spectral components in the 300-3000 Hz range. The signal is going to be digitised using Pulse Code Modulation.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;a. For SNRdb == 30dB, what is the number of uniform quantum levels needed?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;b. What is the minimum data transfer rate needed for the transmission of the digitized-with-PCM signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know that for both of those questions I need to use Shannon's law, C = B*log_2(1+SNR) with SNRdb = 10*log10(SNR).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For task a. I need to find M, for task b. I need to find C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; What do I use as B in both of the questions? How do I utilize the digitized-with-PCM info?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I take a median 1650Hz in &lt;em&gt;a&lt;/em&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;em&gt;b&lt;/em&gt;, do I write that PCM uses from 8 to 20something bits per sample, and use B = 20*3000Hz? Or do I just use the maximum B of the range, 3000?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="17296" LastActivityDate="2015-09-07T21:52:17.800" Title="Example exercise - Shannon's law on PCM-digitized signal" Tags="|digital-communications|modulation|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25694" PostTypeId="1" AcceptedAnswerId="25699" CreationDate="2015-09-07T18:03:49.023" Score="0" ViewCount="1542" Body="&lt;p&gt;I have a signal which clearly shows harmonics of 25 Hz (or 50 Hz?), this is actually my question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not think the 50Hz resonance comes from the power supply leakage, since my power supplies works at some tens of kHz. I also do not have an explanation for the 25 Hz peak, I rather think it could be a manifestation of the 50Hz which probably comes from the power line, however the 25Hz magnitude is dominating... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you ever faced a spectra like this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I am filtering my data with a notch digital filter, I would like to know the optimal way to reject the frequency with major influence. A 25Hz and 50Hz centered notch work, however I would like to understand what could be the cause of this noise resonances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eWKus.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eWKus.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7187" OwnerDisplayName="Nacu" LastEditorUserId="7187" LastEditDate="2015-09-08T17:03:02.313" LastActivityDate="2015-09-08T17:03:02.313" Title="Harmonics of 50 Hz" Tags="|filters|signal-detection|noise|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25695" PostTypeId="2" ParentId="25693" CreationDate="2015-09-07T21:44:10.660" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I know that for both of those questions I need to use Shannon's law, C = B*log_2(1+SNR) with SNRdb = 10*log10(SNR).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not quite sure that's true. For the first question,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For SNRdb == 30dB, what is the number of uniform quantum levels needed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;quantization theory is pretty sufficient: In every digitally represented signal, there's so called quantization noise; it's nothing but the power in the difference between analog and quantized signal. For example, every additional bit in the ADC halves the size of the quantization step, reducing the average voltage error by one half, leading to four times less noise power (or, equivalently, 6dB better quantization noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this question, if you ask me, is: &quot;When you need to achieve quantization noise better than 30dB, how large can your quantization levels be?&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution is relatively simple: Let $P_s$ be your signal power. Your Quantization-limited SNR is then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}&#xA;\mathrm{SNR}_Q &amp;amp;= \frac{P_s}{P_\text{quantization noise}}&#xA;\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without loss of generality, we set $P_s=1$. Hence, with $q$ the number of quantization steps and 1 the overall ADC range,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}\\&#xA;{\mathrm{SNR}_Q}^{-1} &amp;amp;= {P_\text{quantization noise}}\\&#xA;&amp;amp;= E\left[\left(x_\text{digital} - x_\text{real}\right)^2\right]\\&#xA;&amp;amp;= \text{var}({e_Q})\text{, }e_Q\text{ being the quantization noise Random Variable (RV),}\\&#xA;&amp;amp;= \int\limits_{-\frac1{2q}}^\frac1{2q}{\left({e_Q}^2q \right)d{e_Q}}\text{, since variance of a uniform RV over }[-\frac1{2q}; \frac1{2q}]\text{ is known,}\\&#xA;&amp;amp;= q \left[ \frac13 {e_Q}^3 \right]_{-\frac1{2q}}^\frac1{2q}+C\\&#xA;&amp;amp;= \frac q{3}\left(\left(\frac1{2q}\right)^3 -\left(-\frac1{2q}\right)^3  \right)+0\text{, }C\text{ being zero because of plausability}\\&#xA;&amp;amp;= \frac q3\left(\frac1{8q^3}+\frac1{8q^3}\right)\\&#xA;&amp;amp;= \frac q3\frac1{4q^3}\\&#xA;&amp;amp;= \frac1{12} q^{-2}\\&#xA;&amp;amp;\overset!\le {30\text{dB}}^{-1}\\&#xA;&amp;amp;=\frac1{1000}\\&#xA;&amp;amp;\iff\\&#xA;q^2&amp;amp;\ge \frac{1000}{12}\\&#xA;&amp;amp;\iff\\&#xA;q&amp;amp;\ge \sqrt{\frac{500}6}\\&#xA;q&amp;amp;\ge 9.1\text{something}\\&#xA;q&amp;amp;\ge \left\lceil{9.1}\right\rceil \\&#xA;&amp;amp;=10&#xA;\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assuming that the ADC is perfectly linear and thus has absolutely uniform quantization noise for a signal that has uniformly distributed power over the whole ADC range, and thus, the error is uniformly distributed over the quantization step of size $\frac1q$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That was fun.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;b. What is the minimum data transfer rate needed for the transmission of the digitized-with-PCM signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Ha, Shannon, here we come.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PCM means we can't trick around with undersampling. So, our signal's bandwidth is 3kHz, meaning we need to sample with 6kHz. Every sample has information $I=-\log_2(P(x))$, $P(x)$ being the probability that value x is represented in the sample. Still assuming the signal is uniformly distributed (the assignment did not say it was a sum of sinusoids or similar!), $P$ is constant, $P=\frac1q$, hence $H(X)[\text{bit}]= -\log_2{\frac1{10}}= \frac{-\log_{10}{\frac1{10}}}{\log_{10} 2}=\frac1{0.3\dots}\approx 3.32\text b$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the bandwidth (bitrate) we need to transport is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;r_b &amp;amp;= 3.32\text b \cdot 6 \text{kHz}\\&#xA;&amp;amp;= 19.93\frac{\text{kb}}{\text s}\text{ .}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So with approximately 20kb/s, you can do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr /&gt;&#xA;Those are very good questions. I'd like to ask you to post your own answer if you get an official solution, of course only after getting an O.K. from the professor/lecturer/TA to share his intellectual property (maybe pointing him to this would help). (I of course still like if you accept and upvote this one. It could also certainly use some improvement/corrections!)&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2015-09-07T21:52:17.800" LastActivityDate="2015-09-07T21:52:17.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25696" PostTypeId="1" CreationDate="2015-09-08T02:38:59.010" Score="4" ViewCount="837" Body="&lt;p&gt;I have a 2D image defined on a region &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$I: \Omega \to R$&lt;/span&gt; be a gray image. Assume that the region can be separated into &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; sub-regions &lt;span class=&quot;math-container&quot;&gt;$\Omega_i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$\forall i,j=1,\ldots ,N:\Omega_i \cap\Omega_j=\emptyset$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$\bigcup_{n=1}^{N}\Omega_n =\Omega$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To simplify, we assume &lt;span class=&quot;math-container&quot;&gt;$N=3$&lt;/span&gt; and it shows in below figure.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nwYf3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nwYf3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;We denotes &lt;span class=&quot;math-container&quot;&gt;$p(x \in \Omega_i|I(x))$&lt;/span&gt; is posteriori probability of region &lt;span class=&quot;math-container&quot;&gt;$\Omega_i$&lt;/span&gt; given &lt;span class=&quot;math-container&quot;&gt;$I(x)$&lt;/span&gt;. Based on the Bayesian rules, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p\left(x \in \Omega_i|I(x)\right)=\frac{p\left(I(x)|x\in \Omega_i\right)p(x\in \Omega_i)}{p(I(x))}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The segmentation try to assign pixel &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to each region based on posteriori probability. That goal is that finds maximum a posteriori probability (MAP) of pixel &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in each region. It can express by formula&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left\{ \Omega_{i,x} \right\}_{i=1}^{N}=\arg \max_{\Omega_i} \left\{\prod_{i=1}^{N} p(I(x)|x \in \Omega_i)p(x \in \Omega_i )\right\} \tag{*}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Assuming that the pixels within each region are independent , the MAP will be achieved over all image domain &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left\{ \Omega_i \right\}_{i=1}^{N}=\arg \max_{\Omega_i} \left\{\prod_{i=1}^{N}\prod_{x \in \Omega_i} p(I(x)|x \in \Omega_i)p(x \in \Omega_i )\right\} \tag{**}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are my formulas &lt;span class=&quot;math-container&quot;&gt;$(*)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(**)$&lt;/span&gt; correct?&lt;/li&gt;&#xA;&lt;li&gt;If not, Could you help me to correct them?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The reference is &lt;a href=&quot;http://vision.mas.ecp.fr/pub/ijcv02-01.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Geodesic Active Regions and Level Set Methods for Supervised Texture Segmentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="128" LastEditDate="2020-08-13T06:54:37.267" LastActivityDate="2020-08-13T06:54:37.267" Title="How to Use Maximum a Posteriori Probability (MAP) in Classification Task" Tags="|image-processing|computer-vision|image-segmentation|classification|maximum-a-posteriori-estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25698" PostTypeId="2" ParentId="25696" CreationDate="2015-09-08T07:00:58.673" Score="3" Body="&lt;p&gt;I will try to give you some intuition into it by a different example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think we have 3 machines which can generate the numbers 1, 2, 3.&lt;br&gt;&#xA;The first machine generates the number 1 with 80% and the numbers 2, 3 with 10% each.&lt;br&gt;&#xA;The second machine generates the number 2 with 80% and the numbers 1, 3 with 10% each.&lt;br&gt;&#xA;The third machine generates the number 3 with 80% and the numbers 1, 2 with 10% each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the machines is chosen, you don't know which and the generated number is 2.&lt;br&gt;&#xA;What machine would you bet it would?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question above is the likelihood with no prior knowledge.&lt;br&gt;&#xA;Hence, given the number 2 the most likely is the second machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet,&#xA;What happens if you are told that the chosen machine would be chosen following this rules - 98% the first machine, 1% the second and 1% the third.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what are the chances?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seeing 2 from machine 1 are 0.1 * 0.98 = 0.098.&lt;br&gt;&#xA;Seeing 2 from machine 2 are 0.8 * 0.01 = 0.008.&lt;br&gt;&#xA;Seeing 2 from machine 3 are 0.1 * 0.01 = 0.001.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a better choice would be machine 1.&lt;br&gt;&#xA;This is the MAP, because we took into account both the likelihood and the prior knowledge.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2015-09-09T12:49:55.723" LastActivityDate="2015-09-09T12:49:55.723" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25699" PostTypeId="2" ParentId="25694" CreationDate="2015-09-08T07:01:54.217" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;It is almost certainly from the mains power. Even if your power supply is switching at a high frequency you can still pick up interference on the probes or sensor or other circuitry. Get a long electrical lead and go outside and see if the problem persists. –  &lt;em&gt;geometrikal&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;what @geometrikal said. Even if you have a really good power supply, some -60dB of what happens on the grid side will leak to your internal supply power. Now, guessing from your diagram ($f_\text{max} \approx 2\,\text{kHz}$, $\Delta_f = 2\,\text{Hz}$) I'd say I'm looking at a signal sampled at 4kHz, which has been subjected to a 2048-point FFT, abs(), semilogx plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the plot contains half a second of information, and yet your highest peak is around $10^{-9}$. (By the way, I'm assuming that the base of this plot are processed samples, which don't directly represent the full ADC span as $[-1;+1]$. If it is, you should probably use an amplifier -- I don't think you have a ADC with a dynamic voltage range of 220dB -- that would be unusual.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, especially if the observed phenomena might be shorter than half a second, the relative strength of the power line harmonics might simply be caused by them being there throughout the whole measurement. This all comes down to you explaining (and maybe understanding) the nature of the signals you're visualizing. As a side note, I'd say the plot doesn't do a very good job at that -- you can barely see how the power in the highest frequencies seems to be higher than in the rest of the spectrum, and all I can say from this plot is &quot;over the 100Hz to 2kHz range, power varies&quot;, which is not really much information.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2015-09-08T13:37:15.843" LastActivityDate="2015-09-08T13:37:15.843" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="25700" PostTypeId="1" CreationDate="2015-09-08T07:05:26.200" Score="5" ViewCount="142" Body="&lt;p&gt;I am trying to find out which way the whale is moving. So I have an image of the whale swimming in the water and I want to find out where is it located and which direction does it swim (with respect to X/Y coordinates of the image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZfWoC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZfWoC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example here the angle is approximately &lt;strong&gt;30 degrees&lt;/strong&gt; in respect to X coordinate.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So my idea was to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Canny_edge_detector&quot; rel=&quot;noreferrer&quot;&gt;canny edge detection to extract edges&lt;/a&gt;, construct a matrix from the points of the edges, calculate &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;noreferrer&quot;&gt;SVD&lt;/a&gt; and use the &lt;code&gt;U&lt;/code&gt; matrix from SVD as a rotation matrix to get the angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have done something like this in python:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wOPTK.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wOPTK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0T9fo.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0T9fo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the first image is the starting image, the second one is the edges, and the third one is the scatterplot with points from the edges and the red arrow is a direction of the angle I got from the SVD. The angles I got&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Angle 146.73&#xA;Angle 135.08&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;are not even close to real angles (which are approximately 30 and 85 degrees).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I have tested that I get a correct angle when I SVD the gaussian matrix, which I rotated by some degree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my first post, so if you need some clarifications (code that I used, explanation why I think this approach will work or anything else), please let me know.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So am I on the right track to find where the whale is going (and just made some silly mistake) or should I use another idea?&lt;/p&gt;&#xA;" OwnerUserId="17299" LastEditorUserId="128" LastEditDate="2020-04-08T08:53:10.073" LastActivityDate="2020-04-08T09:03:59.637" Title="Visual Tracking / Object Tracking: Estimate the Direction the Whale Is Moving" Tags="|image-processing|computer-vision|estimation|visual-tracking|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="25701" PostTypeId="1" CreationDate="2015-09-08T07:19:23.183" Score="1" ViewCount="330" Body="&lt;p&gt;** originally I asked this question on stack exchange and was pointed to dsp.stackexchange **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to determine when the correct musical notes (from a piano) such as in a chord are being played. While detecting single notes is a no brainer, and full music transcription seems to still be considered a research problem, I'm hoping that since my program knows which combination of notes to expect and only needs to classify the played notes (maximum of six) as correct/incorrect that the task will fall somewhere in between.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me towards an efficient algorithm (I need to implement it in JavaScript) that should be able to achieve this with minimal false negatives (incorrectly telling the user they hit the wrong note)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current idea is to test that the signal has better correlation with the target frequency than the nearest semitone above and below for each expected note.&lt;/p&gt;&#xA;" OwnerUserId="17300" LastActivityDate="2016-08-06T11:59:10.313" Title="Algorithm for testing input sound for multiple expected notes?" Tags="|audio|algorithms|continuous-signals|music|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25702" PostTypeId="2" ParentId="25700" CreationDate="2015-09-08T07:21:01.120" Score="0" Body="&lt;p&gt;My approach: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Preprocess your image to maximize contrast: for a start, this might really just be the red channel for example, but my gut feeling is that you can transform the image to a different color model and e.g. use luminance instead, and get higher contrast. Low pass to suppress fotographic noise.&lt;/li&gt;&#xA;&lt;li&gt;Edge detection is a good approach, but I'd just go for the high-pass version of the image. Threshold if appropriate. Cut down if appropriate. &lt;/li&gt;&#xA;&lt;li&gt;Use Principal Component Analysis to find the main direction of that, i.e. the vector which points in the direction where the highest variance in values is.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-08T07:21:01.120" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25703" PostTypeId="1" CreationDate="2015-09-08T07:31:30.720" Score="0" ViewCount="87" Body="&lt;p&gt;Basically I'm talking about N-point moving average/difference filters and not one where $\delta[n]=k$. For example given say a two-point moving average filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n] = \dfrac{\delta[n]+\delta[n-1]}{2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and a defined input signal like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = \sin[2 \pi n]$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n)$ is discrete and the window size = the period size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you find $Y_k$ (the coefficients of the DFT of $y[n]$)?&lt;/p&gt;&#xA;" OwnerUserId="17301" LastEditorUserId="17301" LastEditDate="2015-09-08T17:25:20.717" LastActivityDate="2015-09-08T17:25:20.717" Title="For filters with impulse responses on a specific $x[n]$, how do you calculate DFT of $y[n]$?" Tags="|filters|discrete-signals|fourier-transform|linear-systems|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25704" PostTypeId="1" AcceptedAnswerId="25729" CreationDate="2015-09-08T07:36:32.793" Score="1" ViewCount="5500" Body="&lt;p&gt;So I'm used to DFT being on an equation like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(n) = cos(n), ∀n , with window n = 0,1,2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can clearly plot discrete values and take a DFT to find Xk&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I found this equation on a past exam that's like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(n) = δ(n+2) +δ(n+1)−δ(n−1) with window of length 5. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This appears to be an impulse response to me, and I don't understand how one would take a DFT of it?&lt;/p&gt;&#xA;" OwnerUserId="17301" LastActivityDate="2015-12-08T11:26:20.057" Title="Discrete Fourier Transform on Impulses?" Tags="|discrete-signals|fourier-transform|impulse-response|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25706" PostTypeId="2" ParentId="25703" CreationDate="2015-09-08T08:18:33.343" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How would you find Yk (the coefficients of the DFT of y(n))?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;By applying the DFT to Y.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, you filter something with a FIR by convolving the signal with the taps vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = x * h$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the DFT of $y$ becomes is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal F \{y\} = \mathcal F \left\{ x * h \right\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and thanks to the properties of the DFT, convolution in time domain becomes multiplication in frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal F \{y\} = \mathcal F \{ x\}  \mathcal F \{ h \}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you just apply the DFT to both your signal and your taps vector and multiply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seriously, this is very basic DFT theory, and you will learn that if you continue your studies of the discrete Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-08T08:18:33.343" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="25707" PostTypeId="2" ParentId="25701" CreationDate="2015-09-08T09:04:03.867" Score="1" Body="&lt;p&gt;I'd like to point out two things beforehand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;this is a complex question, and&lt;/li&gt;&#xA;&lt;li&gt;as soon as you have figured out how to do this algorithmically, you'll have to write a lot of signal processing functionality in JS that other languages would already have access to (e.g. python through scipy/numpy, C/C++/Fortran through LAPACK/BLAS/FFTW etc)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;so this will become a very complex project, and if you have the chance to influence the expectations for fast results, I'd recommend not promising a working prototype too soon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for a start, this looks like a linear algebra problem. That's because LA is kind of the sonic screw driver of DSP; give a man a sonic screwdriver, and everything looks like... wait, that metaphor doesn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, anyways, what you want to do is find a vector representation of your signal under test and map it to coordinates in a space spanned by the possible musical notes. Mathematically, you want to &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find a set of base vectors representing your notes,&lt;/li&gt;&#xA;&lt;li&gt;Find a suitable base in which you can represent both these vectors and your signal&lt;/li&gt;&#xA;&lt;li&gt;Project the signal vector onto your note vector; the magnitude of the coefficients gives you the &quot;amount&quot; of the respective notes being represented in the signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As an example, the discrete Fourier transform takes signals that are represented in a time sampling base (every base vector is $(0,\ldots,0,1,0,\ldots,0)$, with the 1 representing the the sample time) and transforms it to a base system of orthogonal oscillations (The nth base vector of that base is $( e^{j2\pi nt})_{t\in (0,\ldots, N)}$). That is such a base transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could simply record fixed lengths of your tones, normalize them in power (important!) and do a dot product with each of these, and find the ones that are above a certain threshold. Do that again with the piece of your signal starting one sample later, and find the notes that have been present with enough energy for enough time. What you end up with is a FIR filter bank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, with a proper language and libraries, that would be a few lines of code, and one could do everything in frequency domain rather than time domain, reducing the effort of the convolution above to a multiplication and two FFTs, but since there is (I don't think there can be, due to architectural restrictions) no FFT in JavaScript, this is probably not easy to optimize. It might be that for reliable results, your algorithm might become too slow to process the audio signal in real time.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-08T09:04:03.867" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25709" PostTypeId="1" AcceptedAnswerId="25716" CreationDate="2015-09-08T10:42:13.817" Score="0" ViewCount="853" Body="&lt;p&gt;I am trying to filter off two unwanted terms in this frequency spectrum (the spectrum on top).&#xA;First, I used a convolution between a rectangular window to make the unwanted terms equal to zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/U3AiT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U3AiT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the first problem is when I tried to centralize the remaining part and multiplying it by a cos ( 2 * pi * f *t) I didn't get any result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And my second question about hamming window is that in an article about a similar issue, a hamming and a blackman window were used. So, is it possible to use hamming window to filter off the unwanted terms? if yes, then how do I choose the starting and the final point of the hamming window to leave only the desired part! I really need help to understand how does it work and how to use it. &lt;/p&gt;&#xA;" OwnerUserId="17285" LastEditorUserId="13320" LastEditDate="2016-11-13T12:53:04.567" LastActivityDate="2016-11-13T12:53:04.567" Title="Hamming window for filtering unwanted terms" Tags="|matlab|frequency-spectrum|filter-design|window-functions|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25710" PostTypeId="2" ParentId="25637" CreationDate="2015-09-08T10:51:36.243" Score="1" Body="&lt;p&gt;Eureka! You can get a zero centered waveform of an audio clip by applying a window, i used hann (cosine) window and then inverting the left and right sides.&lt;/p&gt;&#xA;" OwnerUserId="16389" LastActivityDate="2015-09-08T10:51:36.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25711" PostTypeId="1" AcceptedAnswerId="25718" CreationDate="2015-09-08T11:36:52.403" Score="0" ViewCount="147" Body="&lt;p&gt;I'm a bit new into DSP and when performing the FFT of a step filtered with a Notch filter I realized the frequency components arround the design filter frequency were attenuated (as expected), BUT the minimum frecuency increases arround tha design filter frequency. ¿WHY does this happen?&#xA; These points are marked with an arrow and I believe it's just a matter of not fully understanding FFT. I would very much appreciate if someone could give me a hand with this.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ys8Gx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ys8Gx.png&quot; alt=&quot;FFT of a step and a Step filtered with a Notch filter and Zoomed&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also include the time domain response of the filter (blue is the input, and red the output), and for more details about the filter it is defined as:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;N(z) = \frac{z^2 - 1.939 z + 0.9469}{z^2 - 1.868 z + 0.8764}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(with a lot more decimals for better accuracy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a sampling period of 200 microseconds&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ilhvb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ilhvb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17305" LastEditorUserId="80" LastEditDate="2015-09-08T15:39:34.913" LastActivityDate="2015-09-08T17:06:40.527" Title="Why FFT of a filtered step increases the lower values of the transform with respect to the unfiltered signal?" Tags="|fft|filters|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25712" PostTypeId="1" AcceptedAnswerId="25733" CreationDate="2015-09-08T12:26:18.830" Score="1" ViewCount="1061" Body="&lt;p&gt;I have an image &lt;code&gt;A&lt;/code&gt; which I have divided into &lt;code&gt;4 x 4&lt;/code&gt; subband images. For a given patch &lt;code&gt;P1&lt;/code&gt; in image &lt;code&gt;A&lt;/code&gt;, I need to find another patch &lt;code&gt;P2&lt;/code&gt;  in the same image &lt;code&gt;A&lt;/code&gt; which is &lt;code&gt;most similar: have same texture.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Till now my appraoch is to create feature vectors &lt;code&gt;Fi&lt;/code&gt; for all &lt;code&gt;i&lt;/code&gt; patches and using Euclid's distance formula find out which patch's feature vector is closest to given patch P1's feature vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I have added following features:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Mean &amp;amp; Standard Deviation of brightness (using L channel of LAB colorspace)&lt;/li&gt;&#xA;  &lt;li&gt;Mean &amp;amp; Standard Deviation of color values in A channel of LAB colorspace&lt;/li&gt;&#xA;  &lt;li&gt;Mean &amp;amp; Standard Deviation of color values in B channel of LAB colorspace&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Although I am getting similar patches but I still think the matching can be improved if I incorporate more prominent features (which I'm unaware of). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following are my queries:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;I have a doubt whether this is a good way to compare color between two patches.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Please suggest some more good features which can be helpful to get a proper differentiation.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Although most of my images are proper but are there any restrictions/drawbacks with the approach if image is dark and/or noisy? If yes, is there a good alternative approach or&#xA;  feature(s)?&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Please help!&lt;/p&gt;&#xA;" OwnerUserId="15188" LastEditorUserId="15188" LastEditDate="2015-09-09T11:02:16.370" LastActivityDate="2015-09-09T16:40:27.390" Title="texture matching between patches of an image" Tags="|computer-vision|image-processing|opencv|local-features|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25713" PostTypeId="2" ParentId="25640" CreationDate="2015-09-08T13:19:35.860" Score="0" Body="&lt;p&gt;This is not really a question but is an answer to a question asked &lt;a href=&quot;https://dsp.stackexchange.com/a/25645?noredirect=1&quot;&gt;here&lt;/a&gt; and the answer is a little long winded so I thought I would post the answer here as a guide to others. I have done this because I found it demonically difficult to find a real &amp;quot;how to&amp;quot; for do basic filtering. I found a few guides to this helpful &lt;a href=&quot;http://paulbourke.net/miscellaneous/filter/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.acfr.usyd.edu.au/courses/amme4710/Lectures/AMME4710-Chap4-FrequencyFiltering.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; So here goes, I hope it helps some others:&lt;/p&gt;&#xA;&lt;p&gt;I had a data set of biometric data that was full of hum and noise, most of which was &amp;gt;30Hz and I had tried various &amp;quot;averaging&amp;quot; techniques to get rid of this with varying success so I turned to FFT to do the job. While I had studied transforms in general at uni and understood the basic theory and math I needed to code this for a small app for a tri club (no its not commercial!).&lt;/p&gt;&#xA;&lt;p&gt;So here is the pseudo code with comments:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SF: Sample Frequency&#xA;Samples: is array with samples 0..255&#xA;N: is number of samples (8192)&#xA;NP: is root of 2^NP = N (13)&#xA;CF: cutoff freq of filter (30)&#xA;W: number of coefficients in filter (40)&#xA;dare: real data input&#xA;daim: imaginary data input&#xA;    &#xA;for i = 0 To N – 1&#xA;{&#xA;// time axis for graphing results&#xA;time(i) = i / SF&#xA;&#xA;// freq axis for graphing, note symetric FFT so need -ve freq&#xA;if i &amp;lt;= N / 2 then // Positive frequencies&#xA;freq(i) = i * SF / N&#xA;else // Negative frequencies&#xA;freq(i) = i * SF / N - SF&#xA;    &#xA;// copy input data to local array &#xA;// and normalise to 127 = 0, centering the input/transform&#xA;    &#xA;dare(i) = Samples(i) – 127&#xA;daim(i) = 0&#xA;}&#xA;    &#xA;// fft the input data&#xA;FFT(NP, N, dare, daim)&#xA;    &#xA;// Create the impulse response of the filter in the frequency domain&#xA;// this could be any filter but I use a simple box here: 1 in the passband and 0 elsewhere. Could use any filter here:&#xA;    &#xA;// Note that I used symmetric complex FFT: it is necessary&#xA;// fill in the negative frequencies as well.&#xA;    &#xA;for i = 0 To N - 1&#xA;{&#xA;re(i) = 0&#xA;if i &amp;lt;= (CF * N / SF) or i &amp;gt;= (N - CF * N / SF) &#xA;re(i) = 1&#xA;im(i) = 0&#xA;}&#xA;    &#xA;// Inverse filter into the time domain &#xA;// Note: imaginary parts should be ~ 0 after iFFT&#xA;IFFT(NP, N, re, im)&#xA;    &#xA;// Hann window to truncate the filter series at say +/-20&#xA;// can use other window formulas (e.g. bartlett) if desired&#xA;for i = 0 To N – 1&#xA;{&#xA;window(i) = 0&#xA;if i &amp;lt;= Won2 then&#xA;window(i) = (0.5 + 0.5 * Cos(i * 2pi / (W + 1)))&#xA;else if i &amp;gt;= N - Won2 then&#xA;window(i) = (0.5 + 0.5 * Cos((N - i) * 2pi / (W + 1)))&#xA;}    &#xA; &#xA;// Apply the Hann window to the filter&#xA;for i = 0 To N – 1&#xA;{&#xA;//careful here if complex multiply required&#xA;re(i) = re(i) * window(i)&#xA;im(i) = 0&#xA;}&#xA;&#xA;// can IFFT and check for freq response and back again&#xA;&#xA;// Shift the filter to make it i.e. +ve times only&#xA;//shift lower coefs up&#xA;for i = Won2 To 0 Step -1&#xA;{&#xA;re(i + Won2) = re(i) // &#xA;}&#xA;//wrap -ve coeffs around&#xA;for i = 0 To Won2 – 1&#xA;{&#xA;re(i) = re(N - Won2 + i) //wrap N -&amp;gt; 0, N - 1 -&amp;gt; 1 etc&#xA;re(N - Won2 + i) = 0&#xA;}&#xA;&#xA;// Transform filter back into the frequency domain &#xA;FFT(NP, N, re, im)&#xA;    &#xA;//multiply input data by filter COMPLEX MULT REQUIRED!!&#xA;// may be able to shorten this step if desired&#xA;for i = 0 To N – 1&#xA;{&#xA;tmpre = dare(i) * re(i) - daim(i) * im(i)&#xA;tmpim = dare(i) * im(i) + daim(i) * re(i)&#xA;dare(i) = tmpre&#xA;daim(i) = tmpim&#xA;}&#xA;&#xA;//inverse back to time domain&#xA;IFFT(NP, N, dare, daim)&#xA;    &#xA;// copy back to input normalised and re centered&#xA;// may need to normalise/scale at this stage&#xA;for i = 0 To N – 1&#xA;{&#xA;Samples(i) = dare(i) + 127&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="128" LastEditorUserId="60971" LastEditDate="2022-07-13T18:48:44.657" LastActivityDate="2022-07-13T18:48:44.657" CommentCount="4" CommunityOwnedDate="2015-09-08T13:19:35.860" ContentLicense="CC BY-SA 4.0" />
  <row Id="25716" PostTypeId="2" ParentId="25709" CreationDate="2015-09-08T14:08:49.253" Score="0" Body="&lt;p&gt;Below is some code (in &lt;code&gt;scilab&lt;/code&gt; which is similar to but not the same as matlab) that attempts to do what you're saying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output is the following graph which has:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The original signal&lt;/li&gt;&#xA;&lt;li&gt;The signal multiplied by the window to leave just the left-hand peak.&lt;/li&gt;&#xA;&lt;li&gt;The signal modulated with a complex exponential to shift the remaining peak to the centre (DC).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OyBY4.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OyBY4.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 25709&#xA;N = 1024;&#xA;dc = 1 + rand(1,N,'norm');&#xA;fc = 0.388729874;&#xA;a = 1+0.5*rand(1,N,'norm');&#xA;t = [0:N-1];&#xA;phi = 0.187238947;&#xA;x = dc + a.*sin(2*%pi*fc*t + phi);&#xA;X= fft(x);&#xA;&#xA;f = fftshift((fftshift([0:N-1]) - N/2)/N);&#xA;&#xA;clf;&#xA;subplot(311);&#xA;plot(f, fftshift(abs(X)))&#xA;&#xA;subplot(312);&#xA;wind = [zeros(1,N-500) ones(1,500) ];&#xA;plot(f,fftshift(abs(X.*wind)));&#xA;&#xA;subplot(313);&#xA;y = ifft(X.*wind);&#xA;yy = y.*exp(%i*2*%pi*fc*t);&#xA;plot(f,fftshift(abs(fft(yy))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-08T14:08:49.253" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25717" PostTypeId="2" ParentId="25704" CreationDate="2015-09-08T14:50:33.027" Score="0" Body="&lt;p&gt;&lt;a href=&quot;http://www.coe.utah.edu/~cs4640/slides/Lecture14.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.coe.utah.edu/~cs4640/slides/Lecture14.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so basically if its a series of pulses then the fourier transform would be a series of another pulses, if its just these pulses then fourier transform will be a series of pulses, containing a lot of frequencies...&lt;/p&gt;&#xA;" OwnerUserId="17309" LastActivityDate="2015-09-08T14:50:33.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25718" PostTypeId="2" ParentId="25711" CreationDate="2015-09-08T16:07:45.017" Score="0" Body="&lt;p&gt;So taking your filter and looking at its magnitude response we see that the magnitude close to zero will increase but all other magnitudes (on the other side of the dip) should be approximately unity gain (no magnification / increase in amplitude).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that the DC gain of the filter is 0.94 means that the steady-state output for a step input will be 0.94, not 1.  That may be the effect that you're seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the notch is not very deep. You may want to redesign the filter to make it attenuate more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/euRsy.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/euRsy.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-09-08T17:06:40.527" LastActivityDate="2015-09-08T17:06:40.527" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25719" PostTypeId="1" AcceptedAnswerId="25720" CreationDate="2015-09-08T16:29:00.330" Score="5" ViewCount="1127" Body="&lt;p&gt;According to the literature, zero mean noises are those whose expected value is zero. But what does this mean in the context of images. Let us consider grayscale for now. The intensity values ranging from 0 to 255. The noise will also have values between 0 and 255. How can then the mean be zero?&lt;/p&gt;&#xA;" OwnerUserId="17311" LastActivityDate="2015-09-09T20:16:44.707" Title="Zero mean noise in images" Tags="|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25720" PostTypeId="2" ParentId="25719" CreationDate="2015-09-08T16:31:01.520" Score="2" Body="&lt;p&gt;The &lt;strong&gt;image pixel values&lt;/strong&gt; will be between 0 and 255 for 8 bit values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is nothing stopping the &lt;strong&gt;additive noise&lt;/strong&gt; from increasing or decreasing the pixel values.  Obviously you can't increase the pixel values above 255 or reduce them below 0, but it still allows the noise to be zero mean.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-08T16:31:01.520" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25721" PostTypeId="2" ParentId="25719" CreationDate="2015-09-08T17:38:23.610" Score="4" Body="&lt;p&gt;To get a nice visualisation lets consider a colour image with zero mean noise &amp;amp; standard deviation 20! Which means the values of each RGB component can randomly vary from +20 to -20. So pixels will be added with this noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code for generating noise to an Image using opencv c++&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mat mSource_Bgr,mNoise_Bgr;&#xA;mSource_Bgr= imread(FileName_S,1);&#xA;&#xA;// We need to work with signed images (as noise can be&#xA;// negative as well as positive). We use 16 bit signed&#xA;// images as otherwise we would lose precision.&#xA;Mat mGaussNoise_Bgr(mSource_Bgr.size(), CV_16SC3);&#xA;&#xA;double StdDev=10;&#xA;randn(mGaussNoise_Bgr, Scalar::all(0), Scalar::all(StdDev));&#xA;Mat mTemp;&#xA;mSource_Bgr.convertTo(mTemp,CV_16SC3);&#xA;addWeighted(mTemp, 1.0, mGaussNoise_Bgr, 1.0, 0.0, mTemp);&#xA;mTemp.convertTo(mNoise_Bgr,mSource_Bgr.type());&#xA;&#xA;mGaussNoise_Bgr.convertTo(mGaussNoise_Bgr,CV_8UC3);&#xA;imshow(&quot;Noise Image&quot;,mGaussNoise_Bgr);&#xA;imshow(&quot;Original Image&quot;,mSource_Bgr);&#xA;imshow(&quot;Original Image + Noise&quot;,mNoise_Bgr);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the &lt;strong&gt;Original Image&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NHnzr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NHnzr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Noise Image&lt;/strong&gt; with Mean : 0 &amp;amp; Std Deviation : 20&#xA;&lt;a href=&quot;https://i.stack.imgur.com/sKa5K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sKa5K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original Image + Noise&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/v1n3S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v1n3S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Same Image with Noise Mean:0 Std Deviation:10&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JSFtM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JSFtM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5912" LastActivityDate="2015-09-08T17:38:23.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25722" PostTypeId="2" ParentId="24607" CreationDate="2015-09-08T18:38:18.210" Score="1" Body="&lt;p&gt;A 1D signal that is only noise with no structured feature to be seen is of no interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 2D signal that is only noise or a superposition of uncorrelated 1D signal rows, with no 2D structured feature to be seen, is of no interest.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-08T18:38:18.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25723" PostTypeId="2" ParentId="25619" CreationDate="2015-09-08T20:25:21.010" Score="2" Body="&lt;p&gt;Adding a bit of detail to Marcus' answer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Your question is about the &quot;entropy of symbols&quot; and the &quot;entropy of real numbers&quot;. In information theory, only &lt;em&gt;sources&lt;/em&gt; have entropy. A source has an alphabet, and each &quot;letter&quot; or symbol from the alphabet has a certain probability, and carries a certain amount of information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Think of a source as a black box with a button. Every time you press the button, it produces a symbol. In many textbook problems the source is fully described, but in practice, you often don't know what the source alphabet is and what the symbol probabilities are. This is where &quot;entropy estimation&quot; comes in: basically you push the button many times, keep notes about the symbols that appear, and try to guess the entropy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Note that this problem is more common than you may think: nobody knows the entropy of a source that produces all possible written language, for example. This is why entropy compressors, such as the Huffman algorithm, do some form of entropy estimation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Shannon's formula for entropy assumes that the source alphabet is discrete. The case where it is continuous is covered in Marcus' answer. It doesn't matter if the symbols are real numbers, what matters is the continuity (or lack thereof) of the source alphabet.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your second question is too open-ended to give a simple answer, but the idea is that you want to come up with a binary encoding to the source symbols. A good encoding assigns less bits to the more probable symbols.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-09-08T20:25:21.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25724" PostTypeId="1" AcceptedAnswerId="25732" CreationDate="2015-09-09T05:01:41.953" Score="1" ViewCount="199" Body="&lt;p&gt;From &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_density&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, I taken a definition of power spectral density:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For continued signals that describe, for example, stationary physical processes, it makes more sense to define a power spectral density (PSD), which describes how the power of a signal or time series is distributed over the different frequencies, as in the simple example given previously. Here, power can be the actual physical power, or more often, for convenience with abstract signals, can be defined as the squared value of the signal. For example, statisticians study the variance of a set of data, but because of the analogy with electrical signals, it is customary to refer to it as the power spectrum even when it is not, physically speaking, power. The average power P of a signal x(t) is the following time average:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P = \lim_{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T x(t)^2\,dt.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I premise that I'm not an expert on the signal theory, therefore I do apologise if this question isn't much precise.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$x(t),y(t)$&lt;/span&gt; be two complex signals and denote with &lt;span class=&quot;math-container&quot;&gt;$\bar y$&lt;/span&gt; the complex conjugate of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. What represents the following formula?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lim_{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T x(t)\bar y(t)\,dt$$&lt;/span&gt;&#xA;Is it related to PSD?&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="17183" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-09-09T18:05:35.480" Title="PSD and $\lim_{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T x(t)\bar y(t)\,dt$" Tags="|autocorrelation|power-spectral-density|correlation|fourier|covariance|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25725" PostTypeId="2" ParentId="25724" CreationDate="2015-09-09T07:29:50.077" Score="3" Body="&lt;p&gt;Usually, for power signals, we define the inner product to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\left&amp;lt;x\,,\,y\right&amp;gt; &amp;amp;= \lim_\limits{T\rightarrow \infty} \frac 1 {2T} \int\limits_{-T}^T x(t)\bar y(t)\,dt&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which induces the vector norm &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;||x||^2 &amp;amp;= \left&amp;lt;x\,,\,x\right&amp;gt;\\&#xA;&amp;amp;=\lim_{T\rightarrow \infty} \frac 1 {2T} \int\limits_{-T}^T x(t)\bar x(t)\,dt&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, for real signals, is the same as the Wikipedia article claims is the &quot;average power&quot;; Wikipedia is a bit inexact here; for complex signals, the average power is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;P(x) &amp;amp;= \left&amp;lt;x\,,\,x\right&amp;gt;\\&#xA;&amp;amp;= \lim_\limits{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T {|x(t)|}^2\,dt\\&#xA;&amp;amp;=\lim_\limits{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T x(t)\bar x(t)\,dt\text .&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We might interpret the inner product $\left&amp;lt;x,y\right&amp;gt;$ as &quot;similarity&quot; between $x$ and $y$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to the corollaries of the Cauchy-Schwarz inequality ($\left&amp;lt;x,y\right&amp;gt;\le ||x||\,||y||$), we know that when varying $y$, $|\left&amp;lt;x(t),y(t)\right&amp;gt;|,\, t\in\mathbb K$ reaches a maximum iff $x = \lambda y,\, \lambda \in \mathbb K$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following above definition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\left&amp;lt;x\,,\,y\right&amp;gt; &amp;amp;= \left&amp;lt;x\,,\lambda x\right&amp;gt;\\&#xA;&amp;amp;= \lim_{T\rightarrow \infty} \frac 1 {2T} \int\limits_{-T}^T x(t)\overline{\lambda x(t)}\,dt&amp;amp;\lambda\in\mathbb R \Rightarrow \bar \lambda = \lambda\\&#xA;&amp;amp;= \lambda \lim_{T\rightarrow \infty} \frac 1 {2T} \int\limits_{-T}^T x(t)\bar x(t)\,dt \\&#xA;&amp;amp;= \lambda \left&amp;lt;x\,,\, x\right&amp;gt;\\&#xA;&amp;amp;= \lambda ||x||^2\text{ .}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't surprising, because inner products are bilinear. It's also application-wise not surprising, because no signal is more similar to $x$ than $x$ itself!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: &lt;strong&gt;No&lt;/strong&gt;, that formula is not directly related to PSD. However, this is &lt;em&gt;so-called&lt;/em&gt; math, and you can derive a lot of relations. Just go ahead and calculate &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left&amp;lt; \mathcal F (x)\,,\, \mathcal F (y) \right&amp;gt;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to find a few of these. It's not hard to prove &lt;em&gt;Parseval's Theorem&lt;/em&gt; this way.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2015-09-09T07:37:04.320" LastActivityDate="2015-09-09T07:37:04.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25727" PostTypeId="2" ParentId="23984" CreationDate="2015-09-09T07:47:37.663" Score="1" Body="&lt;p&gt;As the video says, they use the classical lowpass filtering for texture smoothing, then shading correction to lessen the effect of uneven illumination, followed by binarization for defect segmentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A completely different technique is used for the bearing: edge detection and (presumably) assessment of deviations from a smooth line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scratch detection on the heavily textured surface is much more challenging and I am not sure that a commercial system can handle it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the best of my knowledge, the technique in &quot;Fast Detection of Curved Edges at Low SNR, Nati Ofir, Meirav Galun, Boaz Nadler and Ronen Basri&quot; could do.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-09T07:47:37.663" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25728" PostTypeId="2" ParentId="19924" CreationDate="2015-09-09T08:16:38.930" Score="1" Body="&lt;p&gt;What about this: if your three signals are balanced (I mean with equal amplitudes and $2\pi/3$ shifts), you can find the amplitude by summing the squares (check that it doesn't pulse). And from there, the arguments of the three sinusoids ($\omega t+\phi+k2\pi/3$). Actually you solve this geometric problem, where the three projections are given:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9eqPm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9eqPm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, repeating the computation at two close instants, you get the frequency. It may be useful to maintain a linear fit on the last few $n$ phase values to improve accuracy and ease handling of phase wraparound.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-09-09T08:27:36.490" LastActivityDate="2015-09-09T08:27:36.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25729" PostTypeId="2" ParentId="25704" CreationDate="2015-09-09T09:56:06.650" Score="2" Body="&lt;p&gt;For digital signals, you represent the $s(n) = \delta(n)$ dirac impulse by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s[n] = \delta_\text{discrete}[n] = \begin{cases}&#xA;0&amp;amp; \forall n \ne 0\text,\\&#xA;1 &amp;amp; n = 0&#xA;\end{cases}\tag{*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is obvious if you think about the dirac impulse of having the function (in continuous math) to give you &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int\limits_{-\infty}^\infty f(x)\delta_\text{continuous}(x) dx = f(x) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and in the discrete case, your integral collapses to the sum of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum\limits_{-\infty}^\infty f[x]\delta_\text{discrete}[x] dx \overset!= f[x] \tag{$\dagger$}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only function that fulfills $(\dagger)$ is $\delta$ from $(\text *)$.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-09T09:56:06.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25730" PostTypeId="2" ParentId="25151" CreationDate="2015-09-09T10:21:07.947" Score="2" Body="&lt;p&gt;The exponent function is directly related to the sine and cosine via Euler equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{i \theta} = \cos(\theta) + i \sin(\theta)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example for function $z=e^{i \pi t}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z=\cos(\pi t) + i \sin(\pi t) $$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You could plot it in 3D, where &lt;code&gt;x&lt;/code&gt; axis is the time, and &lt;code&gt;y&lt;/code&gt; &amp;amp; &lt;code&gt;z&lt;/code&gt; axes are real and imaginary part of your complex signal, respectively. In 3D that is going to be a helix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M1jPj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M1jPj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you look at projections onto the &lt;code&gt;y=0&lt;/code&gt; and &lt;code&gt;z=0&lt;/code&gt; planes, then you will notice sine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9nWDa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9nWDa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and cosine waves:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ww7j9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ww7j9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if you look at the &lt;code&gt;x=0&lt;/code&gt; projection, then you will observe a (unit) circle:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hlxzK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hlxzK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the applet with this visualization in &lt;a href=&quot;http://demonstrations.wolfram.com/TheComplexExponential/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Wolfram Demonstration Project&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2016-03-21T09:40:55.780" LastActivityDate="2016-03-21T09:40:55.780" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25731" PostTypeId="1" AcceptedAnswerId="25751" CreationDate="2015-09-09T10:24:29.957" Score="1" ViewCount="709" Body="&lt;p&gt;Due to a limitation of the WebAudio specification the FFT available in JavaScript only makes available the real part (1st half) of the calculated frequency data. Is there any way of recreating the phase information (and subsequently improving interpolation of peak frequencies) using the fluctuations in bin amplitude between frames?&lt;/p&gt;&#xA;" OwnerUserId="17300" LastEditorUserId="17300" LastEditDate="2015-09-09T11:30:41.533" LastActivityDate="2015-09-10T23:15:09.010" Title="Is there any way of retrieving phase information with only access to real part of successive FFT frames?" Tags="|fft|fourier-transform|phase|" AnswerCount="1" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="25732" PostTypeId="2" ParentId="25724" CreationDate="2015-09-09T11:12:55.423" Score="5" Body="&lt;p&gt;For power signals $x(t)$ and $y(t)$, the function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{xy}(\tau)=\lim_{T\rightarrow\infty}\frac{1}{2T}\int_{-T}^{T}x(t)\bar{y}(t+\tau)dt\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is the cross-correlation of $x(t)$ and $y(t)$. So the expression you're asking about is the cross-correlation of $x(t)$ and $y(t)$ evaluated at lag $\tau=0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{xy}(0)=\lim_{T\rightarrow\infty}\frac{1}{2T}\int_{-T}^{T}x(t)\bar{y}(t)dt\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the Fourier transform of $(1)$ is the cross-power spectrum $S_{xy}(\omega)$ of $x(t)$ and $y(t)$, the expression in $(2)$ is related to $S_{xy}(\omega)$ by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{xy}(0)=\frac{1}{2\pi}\int_{-\infty}^{\infty}S_{xy}(\omega)d\omega\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the expression in your question is proportional to the integral of the cross-power spectrum of the power signals $x(t)$ and $y(t)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-09-09T11:12:55.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25733" PostTypeId="2" ParentId="25712" CreationDate="2015-09-09T11:30:33.273" Score="2" Body="&lt;p&gt;The mean and standard deviation are two measurements of a distribution. Others you could also use are higher order moments like 'skewness' (how skewed the distribution is) and 'kurtosis' (how 'peaky' the distribution is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what I would try is a &lt;em&gt;histogram&lt;/em&gt; of the values for each of the channels. For example, if you used a histogram with 16 bins, you would get a feature vector with 48 values. The histogram bin values can be thought of as a descriptor of the distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To account for changes in brightness, you need to introduce some illumination invariance. Already the LAB colour-space splits the image into luminance (L) and color (AB) channels. To achieve illumination invariance I would normalise the L channel histogram values using the norm of whatever measure you are using (in this case, euclidean distance, it would be the l2 norm). Normalising the A or B channels is probably not necessary. The normalisation accounts for any linear changes in luminance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the images, you could also add vectors like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;histogram of oriented gradients (HOG)&lt;/li&gt;&#xA;&lt;li&gt;histogram of connected components (make B/W then count how many pixels are white in the 8 connected neighbours)&lt;/li&gt;&#xA;&lt;li&gt;k-means clustering of LAB values to get k centre LAB values which you can compare to other images.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and so on.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-09T11:30:33.273" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="25735" PostTypeId="1" CreationDate="2015-09-09T11:33:57.783" Score="1" ViewCount="1368" Body="&lt;p&gt;I can only write .wav files to the current directory&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fname = 'bassswoon.wav'&#xA;wav = wave.open(fname,'w')&#xA;wav.writeframes(struct.pack('h', bassswoon))&#xA;wav.close()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adding a path to fname, i.e. fname = '/path/to/bassswoon.wav' does not work - the file is written neither in the intended directory ('/path/to/') nor in the working directory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see anything of use in the &lt;a href=&quot;https://docs.python.org/2/library/wave.html&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; - is it simply not possible with the wave object? Surely, there must be a way to hack it...&lt;/p&gt;&#xA;" OwnerUserId="16575" LastEditorUserId="16575" LastEditDate="2015-09-09T11:39:23.207" LastActivityDate="2015-09-09T11:39:23.207" Title="Python: write .wav to chosen directory" Tags="|python|wave|" AnswerCount="0" CommentCount="4" ClosedDate="2015-09-09T11:47:36.080" ContentLicense="CC BY-SA 3.0" />
  <row Id="25736" PostTypeId="1" CreationDate="2015-09-09T11:55:46.090" Score="3" ViewCount="970" Body="&lt;p&gt;I am struggling with the following problem for a while: If I have signal of duration N and I apply window (assume rectangular window) of size M &amp;lt; N how will this influence PSD of that signal after doing fft? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PSD of signal should be scaled (I assume) but by which amount and what is the mathematical explanation behind it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your answers in advance.&lt;/p&gt;&#xA;" OwnerUserId="16440" LastActivityDate="2015-09-09T12:16:37.327" Title="PSD scaling due to the windowing" Tags="|fft|window-functions|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25737" PostTypeId="2" ParentId="25736" CreationDate="2015-09-09T12:10:32.837" Score="4" Body="&lt;p&gt;The shortest answer to that question is to divide your PSD by the squared sum of window values $w_i$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$PSD(n) = \dfrac{2|X(n)|^2}{S^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$n=0\ldots N/2 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S = \sum_{i=0}^{N-1}w_i$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read more on that topic in the following article:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://holometer.fnal.gov/GH_FFT.pdf&quot; rel=&quot;nofollow&quot;&gt;Heinzel G., et al - &lt;em&gt;Spectrum and spectral density estimation by the&#xA;  DFT, including a comprehensive list of window functions and some new&#xA;  flat-top windows.&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2015-09-09T12:16:37.327" LastActivityDate="2015-09-09T12:16:37.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25738" PostTypeId="1" CreationDate="2015-09-09T13:09:17.873" Score="0" ViewCount="384" Body="&lt;p&gt;I am working on a project in which I am attempting to analyze a fish within a petri dish using ImageJ and an AVI clip of the fish under a microscope. My first hurdle is to locate the fish within the dish, which I assume I could do without even needing the entire stack (maybe even just a single frame). I am new to image processing, but with the libraries available in ImageJ, I am hoping to be able to locate the edge of the fish and either cut out that edge or cut out a smaller box containing just the fish. Any help would be greatly appreciated from those of you with experience in either ImageJ or image processing in general. Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nuHlX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nuHlX.jpg&quot; alt=&quot;Fish within the petri dish&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17321" LastActivityDate="2015-09-09T13:09:17.873" Title="ImageJ Object Detection within AVI Stack" Tags="|image-processing|object-recognition|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25741" PostTypeId="2" ParentId="25712" CreationDate="2015-09-09T16:40:27.390" Score="2" Body="&lt;p&gt;Regarding &lt;code&gt;LAB&lt;/code&gt;, it is a good way if you are interested in the differences as humans perceive them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About texture, I would suggest taking a look at some proprietary texture descriptors:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Gray level co-occurrence matrix. &lt;/li&gt;&#xA;&lt;li&gt;Response to wavelets&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-09-09T16:40:27.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25742" PostTypeId="2" ParentId="25719" CreationDate="2015-09-09T20:16:44.707" Score="1" Body="&lt;p&gt;I think it would be helpful to NOT think of images generally as having pixels with integer values between 0 and 255.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of images (and signals) as having floating point values of unlimited range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A particular representation of an image -- in memory, on disk, or dictated by a particular file format -- might be to store values as one byte per channel, interpreted as an unsigned integer (between 0 and 255). But by doing so, you are severely limiting the set of possible images that you can represent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, if you were storing images as OpenEXR files (16 or 32 bit floating point values), or TIFF with float pixels, or FITS with float pixels, or any number of other higher-fidelity formats, it would be obvious that you could have negative values and a 0-mean signal. It is only because of the limitation of ancient 8 bit integer image file formats that it appears to be a problem.&lt;/p&gt;&#xA;" OwnerUserId="3361" LastActivityDate="2015-09-09T20:16:44.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25743" PostTypeId="2" ParentId="395" CreationDate="2015-09-10T06:03:45.953" Score="1" Body="&lt;p&gt;It is annoying that I replied after 4 years, but this is helpful to others&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, ERLE has to be minimum of 40 dB for good echo cancellation. During the presence of only near end speech, you should not calculate ERLE as it will be near to 0dB, so ERLE has to be used only in presence of Far_end signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case I think you might be using low average filter length for calculation of ERLE. It mainly depends how you are calculating ERLE, ideally if you have ERLE 100 dB after convergence of your adaptive filter, then it is good enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards&lt;/p&gt;&#xA;" OwnerUserId="17327" LastActivityDate="2015-09-10T06:03:45.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25744" PostTypeId="2" ParentId="25701" CreationDate="2015-09-10T11:29:38.503" Score="1" Body="&lt;p&gt;The feature you should be looking for is chroma (&lt;a href=&quot;https://en.wikipedia.org/wiki/Harmonic_pitch_class_profiles&quot; rel=&quot;nofollow noreferrer&quot;&gt;Harmonic Pitch Class Profile&lt;/a&gt;). It maps the FFT to the 12 notes of music. It also wraps notes across octaves. Now, based on the peaks in these 12 notes, you'll need to train a classifier to identify different chords. You'll find quite a lot of matlab/python/cpp implementations online, not sure for JS. Also check answers in these posts&#xA;1) &lt;a href=&quot;https://stackoverflow.com/questions/4337487/chord-detection-algorithms&quot;&gt;https://stackoverflow.com/questions/4337487/chord-detection-algorithms&lt;/a&gt;&#xA;2) &lt;a href=&quot;https://stackoverflow.com/questions/4033083/guitar-chord-recognition-algorithm&quot;&gt;https://stackoverflow.com/questions/4033083/guitar-chord-recognition-algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11050" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-09-10T11:29:38.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25747" PostTypeId="1" CreationDate="2015-09-10T18:23:23.003" Score="0" ViewCount="432" Body="&lt;p&gt;I am working on a library for generating LPC for speech synthesis.  I am currently using a hamming window for the spectral analysis which goes in 200ms blocks over the signal, and does the a-to-k conversion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read some stuff online about a technique of overlapping these windows so it would process the signal in groups like [1-200, 150-350, 300-500, etc].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:  How exactly is this done, and more important-- is there a benefit to overlapping the windows?  Will I get better results with my analysis?&lt;/p&gt;&#xA;" OwnerUserId="11807" LastActivityDate="2015-09-10T18:23:23.003" Title="hamming window for LPC" Tags="|autocorrelation|window-functions|lpc|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25749" PostTypeId="1" AcceptedAnswerId="25752" CreationDate="2015-09-10T21:50:08.343" Score="0" ViewCount="191" Body="&lt;p&gt;Let's say I have a decimal like 0.9&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To convert to Q0.27 I just multiply by 2^(27)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But with Q5.27, with 1 bit representing sign, how would I use the full range of bits available to me, to say convert 0.9 to a number between 16 and -16?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-09-10T23:26:40.660" Title="Convert decimal to Q5.27" Tags="|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25750" PostTypeId="1" AcceptedAnswerId="25758" CreationDate="2015-09-10T22:54:12.737" Score="0" ViewCount="334" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RJpZP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RJpZP.png&quot; alt=&quot;Sawtooth Wave&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi all, I've been trying to zero centre a waveform prior to IFFT.   my recent attempts are based on the following code which is producing the waveform below.   I don't understand why this isn't working or why there are notches in the sawtooth wave.   Is my math incorrect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code snippet is used to center it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;zeroStartRadianValue = 2*PI*f0/fs*NFFT*0.50*-1.0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16389" LastEditorUserId="15735" LastEditDate="2015-09-11T01:59:03.503" LastActivityDate="2015-09-11T20:12:50.697" Title="Phase Issue in IFFT" Tags="|fft|ifft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25751" PostTypeId="2" ParentId="25731" CreationDate="2015-09-10T23:06:24.163" Score="2" Body="&lt;p&gt;webaudio isn't returning the real part of the complex FFT transform, but just the log magnitude of the FFT result.  From just this result alone, of the fluctuations between the results of multiple frames, you can't retrieve the phase information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you can get at the input data and decompose this input vector into a symmetric vector plus an anti-symmetric vector, the magnitude of the FFT of the symmetric vector will be equivalent to scaled real components of the FFT of the original input vector, and the magnitude of the FFT of the anti-symmetric vector will be equal scaled imaginary components of the FFT of the original input vector.  Thus, the decomposition plus 2 magnitude-only FFTs will allow you to determine both the magnitude and phase of the FFT components.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;v_even = v + v_reversed&#xA;v_odd  = v - v_reversed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-09-10T23:15:09.010" LastActivityDate="2015-09-10T23:15:09.010" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25752" PostTypeId="2" ParentId="25749" CreationDate="2015-09-10T23:26:40.660" Score="2" Body="&lt;p&gt;You can't really use Q5.27 in 32-bit storage. You need at least one bit for the sign, so I guess you'd call it Q4.27 since the sign bit is implicit.  The conversion from float is exactly the same as for Q0.27 except you can convert any numbers between -16 to just less than 16.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int(0.9 * 2^27)  = 0x07333333&#xA;int(-0.9 * 2^27) = 0xf8cccccd&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see you need the sign bit to represent a negative number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-16 and 16 arise from:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0x7fffffff / (2^27) = 15.9999999925  (biggest +ve number)&#xA;0x80000000 / (2^27) = -16            (biggest -ve number)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-09-10T23:26:40.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25753" PostTypeId="1" AcceptedAnswerId="25754" CreationDate="2015-09-11T00:12:57.310" Score="1" ViewCount="274" Body="&lt;p&gt;In MATLAB if I compute the cross-correlation of 2 arbitrary signals using the xcorr function I get exactly the answer I expect. If I then calculate the cross-correlation using element-wise fft multiplication, the resulting signal is incorrect (offset) by 1 element. Can anyone tell me what I'm missing? Here is my MATLAB script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0];&#xA;b = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0];&#xA;elems = length(a);&#xA;&#xA;% Calculate the cross-correlation coefficients using built-in function&#xA;[ac_coeffs, lags] = xcorr(a, b);&#xA;subplot(2, 1, 1);&#xA;plot(lags, ac_coeffs);&#xA;&#xA;% Now do it manually by fft multiplication&#xA;a = [a, zeros(1, elems - 1)];&#xA;b = [b, zeros(1, elems - 1)];&#xA;af = fft(a);&#xA;bf = fft(b);&#xA;mult = af.* conj(bf);&#xA;result = ifft(mult);&#xA;subplot(2,1,2);&#xA;plot(result);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15033" LastActivityDate="2015-09-11T02:06:42.900" Title="Mismatched offset when computing cross-correlation using FFT" Tags="|fft|cross-correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25754" PostTypeId="2" ParentId="25753" CreationDate="2015-09-11T02:06:42.900" Score="2" Body="&lt;p&gt;You're missing an &lt;code&gt;fftshift&lt;/code&gt; to get the correct alignment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(lags,fftshift(result));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-11T02:06:42.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25755" PostTypeId="1" CreationDate="2015-09-11T09:09:29.280" Score="0" ViewCount="1133" Body="&lt;p&gt;I use emgucv (an opencv wrapper) to find circles in image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To test it, I drew a circle on image in photoshop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used HoughCircles algorithm with a very small distance between circles' centers and big range of radiuses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It found a lot of circles where no one should be and didn't find the one I drew.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original Image:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ro5bt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ro5bt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Result of circles detection:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Jlb2C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jlb2C.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;static Image&amp;lt;Bgr, byte&amp;gt; detect_circles(Image&amp;lt;Bgr, byte&amp;gt; original)&#xA;{&#xA;    Image&amp;lt;Bgr, byte&amp;gt; res = original.Copy();&#xA;    CircleF[] circles =&#xA;        res&#xA;        .Convert&amp;lt;Gray, byte&amp;gt;()&#xA;        //.SmoothGaussian(9)&#xA;        .HoughCircles(new Gray(100), new Gray(100), 1, 0.1, 1, 150)[0];&#xA;    res = res&#xA;        .Convert&amp;lt;Gray, byte&amp;gt;()&#xA;        //.SmoothGaussian(9)&#xA;        .Convert&amp;lt;Bgr, byte&amp;gt;();&#xA;    foreach (CircleF circle in circles)&#xA;        res.Draw(circle, new Bgr(Color.Cyan), 2);&#xA;    return res;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Parameters of &lt;code&gt;HoughCircles&lt;/code&gt; are described here &lt;a href=&quot;http://www.emgu.com/wiki/files/1.4.0.0/html/6f78c3d8-fb1a-5983-2862-549c49019d49.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.emgu.com/wiki/files/1.4.0.0/html/6f78c3d8-fb1a-5983-2862-549c49019d49.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand why it detects circles many times - the minimal distance between centers is really small, but why isn't the yellow circle detected?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;Lowering radius to 75 or less eliminates all circles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I played with tresholds and set parameters to &lt;code&gt;HoughCircles(new Gray(200), new Gray(75), 1, 10, 5, 150)[0];&lt;/code&gt;, but results are still poor with house image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uPn2f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uPn2f.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;However, it detects black and white circle:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/gKFKZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gKFKZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I'm trying to detect circles without HoughTransform&lt;/p&gt;&#xA;" OwnerUserId="17338" LastEditorUserId="17338" LastEditDate="2015-09-12T10:23:05.807" LastActivityDate="2015-09-12T10:23:05.807" Title="HoughCircles finds anything but circles" Tags="|hough-transform|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25756" PostTypeId="2" ParentId="20148" CreationDate="2015-09-11T09:21:38.633" Score="1" Body="&lt;p&gt;Stay away from the stereo solution, it will be a mess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2D measurement using edge fitting is by far easier and more accurate. Make sure that the objects are contrasted wrt the background, and that only the top face is visible.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-11T09:21:38.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25757" PostTypeId="2" ParentId="23120" CreationDate="2015-09-11T10:33:25.447" Score="1" Body="&lt;p&gt;This is a fine idea and pretty standard. However, your problem will be the augmentation of the data. If you render the image from many viewpoints/rotations etc. and just use a plain background, the network would include that information into the training stage e.g. Like a shape cue. So, you have to use different backgrounds. This is of course scene specific. However, you might be able to narrow down your scenes so that you could randomly generate/perturb different background structures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that, you might be able to scale up to thousands of classes, but getting to millions could become a headache, since training this network would be very tough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might as well go with standard indexing / hashing approaches, which already perform pretty well. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-09-11T10:33:25.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25758" PostTypeId="2" ParentId="25750" CreationDate="2015-09-11T12:13:17.707" Score="3" Body="&lt;p&gt;As @jojek says, this looks precisely correct. It's like &lt;a href=&quot;https://en.wikipedia.org/wiki/Gibbs_phenomenon&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gibbs phenomenon&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Sawtooth_wave&quot; rel=&quot;nofollow noreferrer&quot;&gt;but for a sawtooth.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wikipedia page for the sawtooth has this way to write a sawtooth:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = \frac{A}{2} - \frac{A}{\pi} \sum_{k=1}^{\infty} \frac{\sin(2\pi k f t)}{k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which yields the image below, showing gradual convergence over summing the first 10 terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wqW3f.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wqW3f.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I just use 64 terms, then this is what I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aykEL.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aykEL.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Scilab&lt;/code&gt; code is below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 25750&#xA;// https://en.wikipedia.org/wiki/Sawtooth_wave&#xA;clf&#xA;f = 0.01;&#xA;N = 200;&#xA;t = [0:N-1];&#xA;A = 1;&#xA;graphs = [&quot;&quot;,&quot;r&quot;,&quot;g&quot;,&quot;k&quot;,&quot;:&quot;,&quot;r:&quot;,&quot;g:&quot;,&quot;k:&quot;,&quot;.&quot;,&quot;r.&quot;,&quot;g.&quot;,&quot;k.&quot;,]&#xA;idx = 1;&#xA;for h=1:10,&#xA;    x = A/2*ones(1,N);&#xA;    for k=1:h,&#xA;        x = x - A/%pi * sin(2*%pi*k*f*t)/k;&#xA;    end &#xA;    plot(t,x,graphs(idx))&#xA;    idx = idx + 1;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-09-11T20:12:50.697" LastActivityDate="2015-09-11T20:12:50.697" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25759" PostTypeId="1" CreationDate="2015-09-11T13:39:04.830" Score="0" ViewCount="586" Body="&lt;p&gt;My program needs to compute the angle of a pixel from a computer vision camera that has 120 degrees field of view, and resolution of 640 pixels wide and 480 pixels high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Program receives an X,Y array of pixels for each image frame from camera. For left-most pixel, X would be 0 and angle would be -60 degrees. For right-most pixel, X would be 639 and angle 60 degrees. For center pixel, X would be 320 and angle 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is angle computed when (X is &gt; 0 and &amp;lt; 320) and (&gt;320 and &amp;lt;640)?&lt;/p&gt;&#xA;" OwnerUserId="17341" LastActivityDate="2015-09-11T13:39:04.830" Title="how to compute horizontal angle of a pixel from a computer vision camera" Tags="|image-processing|computer-vision|opencv|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25761" PostTypeId="1" CreationDate="2015-09-11T19:02:35.377" Score="1" ViewCount="801" Body="&lt;p&gt;I have data recorded at 1000Hz and other physio data recorded, somehow, at 1960.8 Hz (510 microsecond samples). Ideally, I would like to be able to downsample the 1960.8 hz signal to line up with the 1000Hz signal.  Any suggestions? I am familiar with matlab or Python.&lt;/p&gt;&#xA;" OwnerUserId="17343" LastActivityDate="2015-09-11T19:43:40.470" Title="resampling from fractional to integer sampling rate" Tags="|sampling|downsampling|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25763" PostTypeId="2" ParentId="25761" CreationDate="2015-09-11T19:43:40.470" Score="1" Body="&lt;p&gt;You can use the &lt;code&gt;resample&lt;/code&gt; command mentioned as follows to accomplish this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=resample(x,1250,2541); % x is the input signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17142" LastActivityDate="2015-09-11T19:43:40.470" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25769" PostTypeId="2" ParentId="17328" CreationDate="2015-09-11T22:08:49.347" Score="1" Body="&lt;p&gt;Binarize the image and perform connected components analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will find 12 objects. Select those with a hole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid spurious tiny holes due to the texture, remove these with a 3x3 erosion (or opening) step before binarization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oSq6p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oSq6p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-11T22:08:49.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25770" PostTypeId="1" AcceptedAnswerId="25771" CreationDate="2015-09-11T23:57:35.217" Score="13" ViewCount="9868" Body="&lt;p&gt;Does anyone have a simple algorithm for computing a reasonably accurate arcsine?&lt;/p&gt;&#xA;&lt;p&gt;By &amp;quot;simple&amp;quot; I mean some sort of polynomial that requires &amp;lt;= 5 multiplications per output sample. And by &amp;quot;reasonably accurate&amp;quot; I mean an algorithm whose error is no more than 10% when the input argument is close to plus or minus one.&lt;/p&gt;&#xA;&lt;p&gt;I searched the web for a while but found nothing immediately useful.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="7092" LastEditDate="2022-09-28T23:14:35.217" LastActivityDate="2023-10-11T11:31:08.340" Title="Looking for an arcsin algorithm" Tags="|algorithms|math|" AnswerCount="5" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="25771" PostTypeId="2" ParentId="25770" CreationDate="2015-09-12T01:32:35.140" Score="10" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Infinite_series&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's just a polynomial version&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\arcsin(x) = x + \frac{1}{2} \frac{x^3}{3} + \frac{1 \cdot 3}{2 \cdot 4} \frac{x^5}{5} + \frac{1\cdot 3 \cdot 5}{2 \cdot 4 \cdot 6} \frac{x^7}{7}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;function y = arcsin_test3(x)&#xA;    y = x.*(1+x.*x.*(1/6+ x.*x.*(3/(2*4*5) + x.*x.*((1*3*5)/(2*4*6*7)))))&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which seems to have five multiplies (assuming you can save the result of &lt;code&gt;x.*x&lt;/code&gt;) and three additions.&lt;/p&gt;&#xA;&lt;p&gt;And the &lt;code&gt;scilab&lt;/code&gt; plot is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zmkMR.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zmkMR.gif&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Top is &lt;code&gt;scilab&lt;/code&gt;'s &lt;code&gt;asin&lt;/code&gt; vs this one, bottom is the error between the two.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Original Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The square root here might be a hassle, but I thought I'd write it up because it looks like fun. :-)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://web.archive.org/web/20180128165812/http://mathforum.org/library/drmath/view/54137.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;This page &lt;/a&gt; suggests:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;from page 81 of the&#xA;Handbook of Mathematical Functions, by Milton Abramowitz and Irene&#xA;Stegun:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;   \arcsin(x) = \pi/2 - \sqrt{1 - x}(a_0 + a_1*x + a_2*x^2 + a_3*x^3),&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;   a_0 = 1.5707288\\&#xA;   a_1 = -0.2121144\\&#xA;   a_2 = 0.0742610\\&#xA;   a_3 = -0.0187293&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've implemented this in &lt;code&gt;scilab&lt;/code&gt; and it works OK, except around &lt;span class=&quot;math-container&quot;&gt;$x= -1$&lt;/span&gt;.  Just reflecting the &lt;span class=&quot;math-container&quot;&gt;$0 \le x \le 1$&lt;/span&gt; over to &lt;span class=&quot;math-container&quot;&gt;$-1 \le x \le 0$&lt;/span&gt; makes for a much better approximation.&lt;/p&gt;&#xA;&lt;p&gt;The top plot shows &lt;code&gt;scilab&lt;/code&gt;'s &lt;code&gt;asin&lt;/code&gt; function against the above approximation (in dashed red) against my change in green.&lt;/p&gt;&#xA;&lt;p&gt;The bottom plot shows the error for my change (plotting that and the original on the same axes means the green looks zero everywhere).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uzxjB.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uzxjB.gif&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;// 25770&#xA;function y = arcsin_test(x)&#xA;    a0 = 1.5707288&#xA;    a1 = -0.2121144&#xA;    a2 = 0.0742610&#xA;    a3 = -0.0187293&#xA;    &#xA;    xx = abs(x)&#xA;    &#xA;    y = %pi/2 - sqrt(1-x).*(a0 + a1*x + a2.*x.*x + a3.*x.*x.*x)&#xA;    &#xA;endfunction&#xA;&#xA;function y = arcsin_test2(x)&#xA;    a0 = 1.5707288&#xA;    a1 = -0.2121144&#xA;    a2 = 0.0742610&#xA;    a3 = -0.0187293&#xA;    &#xA;    xx = abs(x)&#xA;    &#xA;    y = %pi/2 - sqrt(1-xx).*(a0 + a1*xx + a2.*xx.*xx + a3.*xx.*xx.*xx)&#xA;    &#xA;    y = y.*sign(x); &#xA;endfunction&#xA;&#xA;x = [-1: .0100001 : 1];&#xA;&#xA;clf&#xA;subplot(211)&#xA;plot(x,arcsin_test2(x),'g.');&#xA;plot(x,arcsin_test(x),'r:');&#xA;plot(x,asin(x))&#xA;subplot(212)&#xA;//plot(x,(arcsin_test(x) - asin(x)),'r:')&#xA;plot(x,(arcsin_test2(x) - asin(x)),'g.')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="26573" LastEditDate="2022-09-13T19:01:58.607" LastActivityDate="2022-09-13T19:01:58.607" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="25772" PostTypeId="1" AcceptedAnswerId="25777" CreationDate="2015-09-12T09:45:41.650" Score="2" ViewCount="158" Body="&lt;p&gt;I recently have encountered very short time signals (from three to 12 samples, typically). They appeared for instance in small time frames in engine simulation that should be extrapolated in a robust manner, or gaz measurements taken for instance at $t_0 = 0$ (seconds),  $t_1 = 5$,  $t_2 = 10$, $t_3 = 20$, $t_4 = 50$, $t_5 = 100$. The idea behind this time sampling is that the signal should rise or fall, and may reach some steady-state. Such data cumulates caveats:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Very short,&lt;/li&gt;&#xA;&lt;li&gt;Sometimes corrupted by one missing data, or one potential outlier,&lt;/li&gt;&#xA;&lt;li&gt;Uneven sampling.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Traditional tools (Fourier, correlation, fitting) appear of limited use, and are probably unusable. Yet I would like to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;describe those signals with few robust parameters,&lt;/li&gt;&#xA;&lt;li&gt;estimate offsets and delays between two signals,&lt;/li&gt;&#xA;&lt;li&gt;cluster them with shape similarity.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I for instance would like to detect &quot;V-shaped&quot; short signals that first go down then up,  obtain a location estimator for the wedge, and separate them from monotonous or down-then-flat signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I am performing tedious 3- or 4-point linear or parabolic fits, estimate residues and dispersion to select &quot;a best model&quot;, with standard quadratic or robust quantile estimation. My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there recommended literature on very-short signal processing?&lt;/li&gt;&#xA;&lt;li&gt;Would users share their best-practice experience on such signals, that ought to be processed?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-12-11T16:37:17.073" Title="Processing and feature extraction from very short signals" Tags="|discrete-signals|signal-analysis|delay|shape-analysis|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25773" PostTypeId="2" ParentId="25770" CreationDate="2015-09-12T09:53:17.517" Score="4" Body="&lt;p&gt;The central part of the curve isn't a real problem as it is fairly linear and the Taylor approximation to two or three terms is a good starting point (least squares polynomial fit slightly better).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sides are more problematic because of the infinite slope. A way to cope is via the transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\arcsin(x)=\frac\pi2-\arcsin(\sqrt{1-x^2}),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which involves a square root.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If your argument $z$ is represented with floating-point, a fast approximation of the square root is obtained by halving the exponent and applying a linear transform to the mantissa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $z=m2^e$, with $1\le m&amp;lt;2$, then &#xA;$\sqrt z=\sqrt m\,2^{e/2}$. You can approximate $\sqrt{m}$ by $(\sqrt2-1)(m+\sqrt2)$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;take the exponent $e$ apart (clearing it yields the representation of $m$);&lt;/li&gt;&#xA;&lt;li&gt;if $e$ is even, compute $(\sqrt2-1)(m+\sqrt2)$;&lt;/li&gt;&#xA;&lt;li&gt;if $e$ is odd, compute $\sqrt2(\sqrt2-1)(m+\sqrt2)$;&lt;/li&gt;&#xA;&lt;li&gt;set the exponent $\lfloor e/2\rfloor$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9dqjQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9dqjQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-09-13T08:42:07.213" LastActivityDate="2015-09-13T08:42:07.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25774" PostTypeId="1" CreationDate="2015-09-12T10:56:49.133" Score="0" ViewCount="2428" Body="&lt;p&gt;I have a PPG signal and I wanted to write a code that gives the maxima and minima value of signal by using frequency domain method. Any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="17352" LastEditorUserId="13320" LastEditDate="2016-11-13T13:32:39.253" LastActivityDate="2016-11-13T13:32:39.253" Title="Finding maxima and minima of a continuous time signal by using frequency method?" Tags="|frequency-domain|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25775" PostTypeId="2" ParentId="18670" CreationDate="2015-09-12T11:08:36.167" Score="1" Body="&lt;p&gt;The scaling property of the Fourier transform tells you that if  $\mathcal{F}(x(t)) = X(f)$, then  $\mathcal{F}(x(at)) = \frac{1}{|a|}X(\frac{f}{a})$, with $a\neq 0$. So when you dilate in time, you contract in frequency, and vice-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for continuous 1D signals, the Fourier transform of a uniform box will be a cardinal sine. If you dilate the box, the cardinal sine will be contracted. This could be coarsely observed from the location of its zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, you deal with a 2D discrete signal. So the result should be a discrete (or periodic) version of a cardinal sine. Its spread in one direction can be visually estimated by the horizontal and vertical black lines, since your 2D discrete Fourier transform is separable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now look at one horizontal line in your red boxes. The blackest dots that separate the horizontal gray/white bumps have the same location on both images. Now look at several lines. The black dots align vertically. So you see that the vertical lines are spaced in the same manner on the top and the bottom, which is exactly what you expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result in the vertical direction is the controverse. Horizontal black lines are closer to each other in the bottom row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is sometimes misleading in Fourier plots is that some features in the frequency domain look orthogonal to those in the spatial domain. You can see more of this effect in &lt;a href=&quot;http://cns-alumni.bu.edu/~slehar/fourier/fourier.html&quot; rel=&quot;nofollow&quot;&gt;An Intuitive Explanation of Fourier Theory&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to gain additional conviction, crop a line from each spatial image, and an horizontal line from the spectrum, and superimpose the plots.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-09-12T11:08:36.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25776" PostTypeId="2" ParentId="25774" CreationDate="2015-09-12T12:13:35.617" Score="2" Body="&lt;p&gt;&lt;strong&gt;Global maximum&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Representation of a signal from DFT components is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f[n] = \frac{1}{N} \sum_{k=0}^{N-1} F[k] e^{i 2\pi k n /N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\theta = 2\pi n /N$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f[N\theta/(2\pi)] = \frac{1}{N} \sum_{k=0}^{N-1} F[k] e^{i k \theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a trigonometric polynomial with coefficients $F[k]/N$. Finding the maximum is the same as for a normal polynomial, at the maximum the derivative is 0. Thus you calculate the derivative polynomial,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{N} \sum_{k=0}^{N-1} i k F[k] e^{i k \theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use root finding to obtain $N-1$ possible values of $\theta$ (the roots), substitute them back into the original polynomial and choose the one that corresponds to the maximum. Then $n$ can be found as $n = N\theta/(2\pi)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Global minimum&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same as the above except you choose the value of the original polynomial that is a minimum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Local maxima and minima&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the $N-1$ roots of the polynomial as before. Discard any points which do not correspond to derivative of zero. The remaining points are local maxima or minima. At the local maxima the second derivative is negative, at local minima it is positive.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2015-09-12T12:25:34.213" LastActivityDate="2015-09-12T12:25:34.213" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25777" PostTypeId="2" ParentId="25772" CreationDate="2015-09-12T14:49:05.073" Score="1" Body="&lt;p&gt;Though problem! However, signal processing might have a tool at hand: It's called &lt;em&gt;compressive sensing&lt;/em&gt;, and reduces the number of samples you need to sub-Nyquist-rate levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a bit nonsensical to derive the math behind compressive sensing for signals that are a sum of sinusoids (that being the only thing that I could do without literature) if that doesn't describe your signals overly well. However, the idea is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know about everything happening with less than a given frequency over a specific time, you'll need all of the samples at a constant rate (typically, twice the highest frequency for real-valued samples). Then you can, for example, do a base transform to get the samples from time domain to frequency domain using the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the following, assume that you could, if you had the &quot;full, long, evenly-sampled&quot; signal $\mathbf S \in \mathbb R^N$, define a base transform $\mathbf T$ to transform the time samples vector to a result vector giving you the information you want $\mathbf Y = \mathbb R^N$. That base transform would then simply be a matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathbf Y = \mathbf S^T \mathbf T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If what you want is sparse, ie. the dimensionality of the result vector would be much smaller than the observed samples vector, the transform matrix wouldn't be a square full-rank base transform, but a matrix that would have $N$ rows, but fewer columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point here is that most of the values in $\mathbf T$ would be pretty small -- setting those to zero &lt;strong&gt;will&lt;/strong&gt; incur an error, that &quot;feels&quot; like noise, but given a nonzero upper limit for allowable distortion, you can find a sparse matrix that still can allow for reliable conclusions about $\mathbf Y$.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-12T14:49:05.073" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25778" PostTypeId="2" ParentId="25774" CreationDate="2015-09-12T15:04:00.457" Score="1" Body="&lt;p&gt;After reading &lt;a href=&quot;https://dsp.stackexchange.com/a/25776/13320&quot;&gt;geometrikal's answer&lt;/a&gt;, I came to the conclusion (after only having the intuition) that the fastest, and easiest, method will just be transforming your vector back to time domain and simply search for the extrema in time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to extract something that is trivial to get in time domain but doesn't exist in frequency domain, using frequency domain, is simply nonsensical.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-09-12T15:04:00.457" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25779" PostTypeId="1" CreationDate="2015-09-12T15:36:27.903" Score="-1" ViewCount="42" Body="&lt;p&gt;I am planning to do a project on data hiding using codeword substitution in encrypted video.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as an enhancement I am planning to use this data hiding technique for tampering detection, for which I'll be extracting some information from the frames and will be hiding it in a selected frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am actually using the concept of digital signature. The thing is that I am in search of a data to hide. A data which has to be extracted from the frames  for verification on the receiver side.&lt;/p&gt;&#xA;" OwnerUserId="17354" LastEditorUserId="13320" LastEditDate="2015-09-12T21:00:37.737" LastActivityDate="2015-09-12T21:00:37.737" Title="Tampering detection using data hiding" Tags="|image-processing|video|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25780" PostTypeId="2" ParentId="25779" CreationDate="2015-09-12T16:24:27.333" Score="1" Body="&lt;p&gt;I hope I'm understanding you correctly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want to do is &lt;em&gt;hide&lt;/em&gt; data in the &lt;em&gt;encrypted&lt;/em&gt; version of a video?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That will break everything. Simple as that. A very important aspect to good encryption is that a small change in the cleartext data (your unencrypted video) will result in a completely changed encrypted video; the same applies in the other direction -- you change a bit in your encrypted video stream, you completely break at least one block of cleartext data. That's not hiding -- in fact, it's the opposite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, I think your approach is mathematically doomed; but maybe, I'm just misunderstanding.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-12T16:24:27.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25781" PostTypeId="1" CreationDate="2015-09-12T16:40:58.623" Score="2" ViewCount="434" Body="&lt;p&gt;I have a dataset of phone recordings that I'd like to do some characteristic-level analysis on.  The audio is sampled at 44khz stereo, with each channel containing the signal from one party in a conversation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to start by counting the number of time the call rings before the phone is picked up.  I believe this to be simple, but am a little lost, so any pointers in the right direction would be much appreciated.  I believe I need some sort of a matched filter, or maybe a bandwidth filter.  The signal is generally clean -- I have attached a couple of graphs of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;General solutions are appreciated, but I will be doing this in python so anything specific to that would be extra appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, if you have other ideas for extracting features using signal characteristics, I'm all ears (eyes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qbVlA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qbVlA.png&quot; alt=&quot;plot of the signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sAfmH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sAfmH.jpg&quot; alt=&quot;spectrogram of the same call&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16469" LastActivityDate="2017-11-02T07:48:24.140" Title="Count the number of times the phone rings before its answered" Tags="|filters|audio|spectrogram|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25782" PostTypeId="2" ParentId="7672" CreationDate="2015-09-12T17:43:41.497" Score="3" Body="&lt;p&gt;The denomination you propose (Continuous wavelet transform, Discrete wavelet transform, Redundant wavelet transform) might be not precise enough. Yet here are the major differences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Continuous wavelet transform:&lt;/strong&gt; per se, they are a pure mathematical tool. You can use almost any wavelet you wish, with very little requirements. There exist discretizations, and they could be very redundant (roughly $10-100\times$ the original signal per dimension). You mostly use it on 1D signals due to the redundancy, but it is sometimes used in 2D and 3D with limited scales. It is used when one looks as fine details of the signals: fractal aspects, measures of regularity, precise onset or rupture detection in the signal's shape (continuity, changes in derivatives), adaptive filtering. One can just observe (analysis) or detect on 2D scalograms, or select an inverse transform (synthesis,), for instance for adaptive filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Discrete wavelet transform:&lt;/strong&gt; one only have a limited number of wavelets available. Often used in orthogonal or biorthogonal fashion, edp' when critical sampling or orthogonality is important: compression, statistical analysis, or when memory or computation is too expensive. It may induce wavelet-related artifacts with low-amplitude signals. Requires some technical skills to be used in detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Redundant wavelet transform:&lt;/strong&gt; a mix between the two above. Limited choice in the wavelet, yet intermediate redundancy (roughly $1,5-10\times$ per dimension) and more important some invariance: translation, rotation, shear invariance, that is useful for detection, and often more robust to noises. Often used in restoration (deblurring, deconvolution, denoising),  feature analysis.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2018-04-07T21:05:59.793" LastActivityDate="2018-04-07T21:05:59.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25783" PostTypeId="2" ParentId="25781" CreationDate="2015-09-12T21:14:29.620" Score="1" Body="&lt;p&gt;If you can identify one phone ring, then you can extract it and use it to construct a &lt;a href=&quot;https://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow&quot;&gt;matched filter&lt;/a&gt;. The beginning of the wiki article is math heavy, but check out the example section. Additionally, Matlab has a &lt;a href=&quot;http://www.mathworks.com/help/phased/ug/matched-filtering.html&quot; rel=&quot;nofollow&quot;&gt;page&lt;/a&gt; describing the matched filter from one of their toolboxes. You should really give it a try; it works like magic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the time domain, the matched filter is a cross-correlation of the signal against a known pattern (which is in this case a recording of the ringing). As a cross correlation it can efficiently be implemented using a DFT. The output of the matched filter is a time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The time series output will have a series of peaks whose locations correspond to the beginning of each ring. All you need to do is count the number of peaks which exceed some threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the rings could be different but you are guaranteed that they're selected from a finite set of rings (imagine different phone carriers or something) then you could use a bank of matched filters. &lt;/p&gt;&#xA;" OwnerUserId="17325" LastActivityDate="2015-09-12T21:14:29.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25784" PostTypeId="1" CreationDate="2015-09-12T21:53:04.513" Score="1" ViewCount="520" Body="&lt;p&gt;Lets say I have a system that is trying to find a small image (assume all images are grayscale) within in an image by using &lt;a href=&quot;http://www.mathworks.com/help/images/examples/registering-an-image-using-normalized-cross-correlation.html&quot; rel=&quot;nofollow&quot;&gt;correlation&lt;/a&gt;. So this system has the baseline image, and I input 5 different images (the five input images are bigger or have more data points than the baseline image) and do correlation of my baseline images against the five input images. From this I would get 5 &quot;tables&quot; of correlation values, and from each tables I select the highest value as the metric to how similar the input image is to the baseline image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now lets say I want to upgrade my system to do the correlation in the fourier domain. I pad the smaller image with zeros, do the fft, multiply the data by the conjugate of the baseline to do correlation, and I get the power spectral density at each point through some PSD estimator method, like Bartlett, welch, blackman-tukey, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my understanding, the more spread out, or the less dense the power spectrum is over a set number of frequency bins, the less correlated the two signals are, and vice versa. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my question is, in the frequency domain, particularly for a two-dimensional signal, &lt;strong&gt;would the metric for measuring how spread the power is simply be the maximum value within the table I would attain after the correlation and PSD estimate, as in the spatial domain case?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if you could cite your answers whether it be a book or article, that would be much appreciated&lt;/p&gt;&#xA;" OwnerUserId="16673" LastEditorUserId="16673" LastEditDate="2015-09-13T00:18:15.480" LastActivityDate="2017-09-03T03:53:35.917" Title="Finding Correlation response in fourier domain" Tags="|image-processing|power-spectral-density|correlation|fourier-series|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="25785" PostTypeId="2" ParentId="25770" CreationDate="2015-09-12T22:39:56.180" Score="8" Body="&lt;p&gt;I have a pretty good implementation of &lt;span class=&quot;math-container&quot;&gt;$\arctan()$&lt;/span&gt; &lt;a href=&quot;/questions/20444/books-resources-for-implementing-various-mathematical-functions-in-fixed-point-a/20482#20482&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I think you can use the identity:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \arcsin(x) = \arctan\left( \frac{x}{\sqrt{1-x^2}} \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to get what you want.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="26573" LastEditDate="2022-09-28T22:48:42.290" LastActivityDate="2022-09-28T22:48:42.290" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25786" PostTypeId="1" AcceptedAnswerId="25802" CreationDate="2015-09-12T23:32:32.033" Score="4" ViewCount="5557" Body="&lt;p&gt;In my stereo-rectified camera pair (not physical, but two positions of the same camera), when I project some 3D points in both images to find a rough disparity range, I often get a range that goes from negative to positive (e.g. -11, 24). I have no problem with ranges like (-22, -10) or (10, 15).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that kind of range even possible? When I do stereo matching how should I treat negative values? And what about the depth calculated from that disparity that can have negative values (and possibly areas with lowest cost at 0 disparity)?&lt;/p&gt;&#xA;" OwnerUserId="9120" LastEditorUserId="9120" LastEditDate="2015-09-13T01:14:04.997" LastActivityDate="2015-09-13T22:30:13.440" Title="Can disparity range from negative to positive values for parallel cameras?" Tags="|computer-vision|stereo-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25787" PostTypeId="2" ParentId="25784" CreationDate="2015-09-13T00:54:17.930" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;From my understanding, the more spread out, or the less dense the power spectrum is over a set number of frequency bins, the less correlated the two signals are, and vice versa.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm afraid you have this backward. Narrow peaks in the original (spatial) domain correspond to strong cross-correlations. Narrow peaks in the spatial domain will be relatively spread out in the Fourier domain. The results of the cross-correlation are usually interpreted in the spatial domain (rather than the Fourier domain). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transform the image and the (zero-padded) template, multiply in the Fourier domain, and then transform back to the spatial domain. Peaks in the spatial domain correspond to (the possibility of) matches between the template and the image.&lt;/p&gt;&#xA;" OwnerUserId="17325" LastActivityDate="2015-09-13T00:54:17.930" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25788" PostTypeId="2" ParentId="24941" CreationDate="2015-09-13T03:55:42.333" Score="1" Body="&lt;p&gt;we've been over this before, somewhere (maybe &lt;em&gt;comp.dsp&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you think that $x_1[n]$ and $x_2[n]$ have the virtually the same frequency and you want to measure phase angle between them, the simplest noise-immune method is to beat one against the other and the Hilbert transform of the other.  so pick $x_1[n]$ to be the reference sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using the same notation of Rick's above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u[n] + j \, v[n]  =  x_2[n] \left( x_1[n] + j \, \hat{x}_1[n] \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \phi_2[n] - \phi_1[n] = \arg \{ u[n] + j \, v[n] \} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to denoise it, you gotta low-pass filter the phase difference $ \phi_2[n] - \phi_1[n]$ to the extent that you need and dare.  (too much LPFing will slow down or cover a fluctuation of phase that you might want to see.  too little LPF will leave the phase difference noisy.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-09-13T03:55:42.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25789" PostTypeId="2" ParentId="8354" CreationDate="2015-09-13T08:15:49.443" Score="0" Body="&lt;p&gt;Parameter extraction of a sinusoid, whose frequency is arbitrary, using the DFT is &lt;em&gt;NOT&lt;/em&gt; easy. [By the way, the initial phase of a sinusoid, your phi_0 variable, can only be in the range of –pi –to- +pi radians. How can your phi_0 be 100 million(!)?] Jan's comment, implying that time-domain processing should be considered, is a good comment. Time-domain averaging, for example, will give you the value of A/2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possibility is to apply your real-valued x(n) input sequence to a Hilbert transformer to generate a y(n) sequence. After properly delaying x(n) you'll then have an analytic (complex) sequence c(n) = x(n) + jy(n). Computing the magnitude sequence |c(n)| will give you the instantaneous magnitude of your original sinusoidal x(n) sequence. Computing the arctangent of the c(n) sequence will give you the instantaneous phase of your original x(n) sequence. Applying your instantaneous phase sequence to a digital differentiator give you the instantaneous frequency of your original x(n) sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've left out several implementation considerations here, but I just wanted to point out that you might want to explore time-domain processing in order to avoid DFT spectral leakage problems.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-13T08:15:49.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25790" PostTypeId="2" ParentId="24580" CreationDate="2015-09-13T09:20:17.647" Score="0" Body="&lt;p&gt;If I understand your original question, it seems that you want to multiply some given complex frequency response sequence and the FFT samples of a time-domain &quot;test&quot; sequence to produce a filtered-signal's spectral samples. Unless I'm missing something, if you have N complex frequency response samples then just multiply those samples by the complex spectral samples of a standard N-point FFT of your time-domain &quot;test&quot; sequence. (No need to worry about linear or log freq axes.) This will yield the complex spectral samples of the &quot;filtered-signal&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you then want to compute the corresponding time-domain filtered-signal sequence, just compute the inverse FFT of the filtered-signal's spectral samples. Warning: to compute an inverse FFT you must ensure that your filtered-signal's spectral samples cover the full freq range of zero Hz –to- fs Hz and have the appropriate conjugate symmetry.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-13T09:20:17.647" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25791" PostTypeId="1" CreationDate="2015-09-13T09:56:04.173" Score="-3" ViewCount="46" Body="&lt;p&gt;I got an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error using - &#xA;Matrix dimensions must agree.&#xA;Error in check dists = sqrt((cols - centroidX ).^2 + (rows - centroidY).^2); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I resolve that error?&lt;/p&gt;&#xA;" OwnerUserId="17345" LastEditorUserId="13320" LastEditDate="2015-09-13T19:38:06.753" LastActivityDate="2015-09-13T19:38:06.753" Title="Error in distance formula in matlab" Tags="|matlab|" AnswerCount="1" CommentCount="1" ClosedDate="2015-09-14T01:42:40.260" ContentLicense="CC BY-SA 3.0" />
  <row Id="25792" PostTypeId="2" ParentId="25791" CreationDate="2015-09-13T10:18:08.580" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I resolve that error?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Obviously, reading the error is the first and most important step:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error using - &#xA;Matrix dimensions must agree.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Matlab says it can't subtract to Matrices that don't have the same dimension. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So either &lt;code&gt;cols&lt;/code&gt; and &lt;code&gt;centroidX&lt;/code&gt; don't have the same size, or &lt;code&gt;rows&lt;/code&gt; and &lt;code&gt;centroidY&lt;/code&gt; don't have the same size, or both.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-13T10:18:08.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25793" PostTypeId="1" CreationDate="2015-09-13T12:36:45.303" Score="1" ViewCount="1316" Body="&lt;p&gt;I'm currently thinking about the design of a low-cost digital reverb guitar pedal, using a Teensy &lt;s&gt;or Arduino&lt;/s&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to achieve big 10-seconds long reverb.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I implement reverb with &lt;strong&gt;a mix of many delay lines&lt;/strong&gt;, this will require to store in RAM at least 10*44100*2bytes ~ 0.8 MB of audio data (44.1Khz, 16bits, mono), so it seems to be impossible to achieve with a 64KB RAM board (am I wrong?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: &lt;strong&gt;Is there a more clever way (using FFT ? overlap-add stuff, or anything else?) to implement 10 seconds reverb with very little RAM (64KB)?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2015-09-13T12:42:59.663" LastActivityDate="2015-09-13T19:39:25.020" Title="A 10-seconds digital reverb with very few memory (64KB)" Tags="|fft|audio|real-time|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25794" PostTypeId="2" ParentId="25786" CreationDate="2015-09-13T13:42:25.473" Score="1" Body="&lt;p&gt;Yes, it is possible. It often happens when you do &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/uncalibrated-stereo-image-rectification.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncalibrated stereo rectification&lt;/a&gt;.  To calculate the depth, you would have to add the minimum disparity value to you disparity map, to &lt;a href=&quot;https://stackoverflow.com/questions/5322031/negative-disparity-values&quot;&gt;shift the range so that it starts with 0&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-09-13T13:42:25.473" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25795" PostTypeId="1" CreationDate="2015-09-13T14:26:56.193" Score="0" ViewCount="5530" Body="&lt;p&gt;Referring to &lt;a href=&quot;https://dsp.stackexchange.com/questions/8287/deconvolution-in-python&quot;&gt;this topic&lt;/a&gt;, I am interested in a deconvolution using Python. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, unlike the linked topic above, I want to deconvolve a 2D image. The scipy.signal.deconvolve function unfortunately does not support 2D deconvolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This amounts to solving the following equation for &lt;em&gt;f&lt;/em&gt;, when &lt;em&gt;h&lt;/em&gt; is observed, &lt;em&gt;n&lt;/em&gt; is the added noise and &lt;em&gt;g&lt;/em&gt; is the convolution kernel, and all are 2d arrays:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;f&lt;/em&gt; * &lt;em&gt;g&lt;/em&gt; + &lt;em&gt;n&lt;/em&gt; = &lt;em&gt;h&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first question is therefore: &lt;strong&gt;How can I perform a 2D deconvolution in Python?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most obvious option would be, for a known function &lt;em&gt;g&lt;/em&gt;, to transform to Fourier space and divide &lt;em&gt;h&lt;/em&gt; by &lt;em&gt;g&lt;/em&gt;. I have read however that this is merely good for illustration purposes and fairly inaccurate for science purposes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So, what would be the cleanest, most accurate way of performing the deconvolution?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="17359" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-09-14T01:41:53.030" Title="Deconvolution in Python in 2D" Tags="|noise|python|fourier|deconvolution|2d|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25796" PostTypeId="1" CreationDate="2015-09-13T16:24:33.257" Score="4" ViewCount="184" Body="&lt;p&gt;I am struggling with a problem, and would be happy if you could assist me. I put an accelerometer sensor inside a spherical enclosure, and release it to the water. While it was translating in the flow, I recognized that the enclosure was also wobbling (like a kicked pendulum), which I think that it is likely caused by the inertia of the enclosure. I then added some weight inside the enclosure and observed that the peak was more pronounced. Left panel is the spectra of the acceleration magnitude for three different tests without additional weight (inertia is only described by the sensor + enclosure + battery). &lt;a href=&quot;https://i.stack.imgur.com/6OEWb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6OEWb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the sensor is like a black box (I do not know the mass distribution inside so that I can try to match it with the geometrical center of the enclosure), I would like to find a way to exclude the effect of the wobbling in the signal without disturbing it because the wobbling might also affect the lower frequency part of the signal, as seen in &lt;a href=&quot;https://tel.archives-ouvertes.fr/file/index/docid/743349/filename/these_Zimmermann_Robert_2012.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;green line in page 118&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6yYrh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6yYrh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the comment below, I have added the spectra after notch filter. Notch filter does its work very well, and attenuated the signal in the region (2 - 5 Hz), without affecting the rest. However, the oscillations (around 3.5 Hz) likely influences the lower frequency range of the spectra. Is there any quantity that I can derive to see the effect of these oscillations in the lower frequency range or any function that I can try to model the effect of inertia? Any ideas and suggestions would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="17361" LastEditorUserId="80" LastEditDate="2015-09-15T11:31:39.697" LastActivityDate="2016-06-11T16:12:38.167" Title="Eliminating inertia effect from the acceleration signal" Tags="|filters|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25797" PostTypeId="2" ParentId="25793" CreationDate="2015-09-13T17:25:52.210" Score="1" Body="&lt;p&gt;Take a look at this &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Freeverb.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/pasp/Freeverb.html&lt;/a&gt; or &lt;a href=&quot;https://github.com/highfidelity/gverb&quot; rel=&quot;nofollow&quot;&gt;https://github.com/highfidelity/gverb&lt;/a&gt;. Gverb is clearly the better sounding one but harder to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure if you can squeeze it into 64kB but it's worth a shot. The length of the delay lines is scalable to some extent. It roughly corresponds to room size with small delays being small room. 10s in a small room sounds more like bathroom and less like a concert hall or a cathedral. For really high reverb times I would recommend a floating point implementation to avoid instability and noise in the feedback loops.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-09-13T17:25:52.210" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25798" PostTypeId="2" ParentId="25795" CreationDate="2015-09-13T19:38:05.187" Score="1" Body="&lt;p&gt;Erik Hom has developped the &lt;a href=&quot;https://code.google.com/p/aida-deconvolution/&quot; rel=&quot;nofollow&quot;&gt;Adaptive Image Deconvolution Algorithm (AIDA)&lt;/a&gt; in Python. Looking at this code may help you a lot develop your own code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;High-quality deconvolution is still a quite open problem. Dividing $h$ by $g$ in the Fourier domain might cause noise explosion, if $g$ possesses a limited spectrum. The most accurate way depends:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;on the knowledge of the kernel: is it constant, perfectly known (&lt;a href=&quot;https://en.wikipedia.org/wiki/Wiener_deconvolution&quot; rel=&quot;nofollow&quot;&gt;standard Wiener deconvolution&lt;/a&gt;), approximately known (&lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/18285917&quot; rel=&quot;nofollow&quot;&gt;myopic deconvolution&lt;/a&gt;), unknown (&lt;a href=&quot;http://arxiv.org/abs/1407.5465&quot; rel=&quot;nofollow&quot;&gt;blind deconvolution&lt;/a&gt;),&lt;/li&gt;&#xA;&lt;li&gt;on the nature of the noise (Gaussian, Poisson, impulsive),&lt;/li&gt;&#xA;&lt;li&gt;on the properties of the class of images you are looking at (sparse, positive, bounded, compressible).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From my recent experience in signal deconvolution, transforming the image with a sparsifying transform, and constraining sparsity in the process may help a lot.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-09-13T19:38:05.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25799" PostTypeId="2" ParentId="25793" CreationDate="2015-09-13T19:39:25.020" Score="1" Body="&lt;p&gt;i would consider something like the &lt;a href=&quot;https://ccrma.stanford.edu/realsimple/Reverb/Jot_s_FDN_Late_Reverberators.html&quot; rel=&quot;nofollow&quot;&gt;Jot reverb model&lt;/a&gt; or the &lt;a href=&quot;https://ccrma.stanford.edu/~lukedahl/pdfs/Dahl,Jot-AbsorbentAllPassReverbs-Dafx2000.pdf&quot; rel=&quot;nofollow&quot;&gt;Dahl-Jot reverb model&lt;/a&gt;.  &lt;a href=&quot;http://users.utcluj.ro/~atn/papers/ATN_3_2012_3.pdf&quot; rel=&quot;nofollow&quot;&gt;here's an interesting recent paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;also there is the classic Schroeder reverb model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google and JOS are your friends here.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-09-13T19:39:25.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25801" PostTypeId="1" AcceptedAnswerId="25835" CreationDate="2015-09-13T22:20:10.827" Score="5" ViewCount="587" Body="&lt;p&gt;I have a question:&lt;p&gt;&#xA;What is the difference between &lt;p&gt;&#xA;$ I \cos(t) - Q \sin(t) $   &lt;p&gt; and  &lt;p&gt; $ I \cos(t) + Q \sin(t) $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;except that they are phase shifted 90 degrees ?&lt;p&gt;&#xA;On the internet I can find both modulators with adding quadrature data and substracting quadrature data.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ni.com/tutorial/4805/en/&quot; rel=&quot;noreferrer&quot;&gt;http://www.ni.com/tutorial/4805/en/&lt;/a&gt;  at the end&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/372058G-01/nirfsa/iq_modulation/&quot; rel=&quot;noreferrer&quot;&gt;http://zone.ni.com/reference/en-XX/help/372058G-01/nirfsa/iq_modulation/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;thank you&lt;/p&gt;&#xA;" OwnerUserId="17365" LastEditorUserId="4346" LastEditDate="2015-09-14T00:32:06.647" LastActivityDate="2015-09-15T03:40:28.900" Title="Quadrature modulation" Tags="|discrete-signals|digital-communications|quadrature|radio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25802" PostTypeId="2" ParentId="25786" CreationDate="2015-09-13T22:30:13.440" Score="2" Body="&lt;p&gt;It was the way I was setting principal points during rectification, to center the images back for the warping. If I have same principal points in both cameras I only get positive disparities, as expected. If cameras are parallel, it is &lt;strong&gt;not possible&lt;/strong&gt; to have both negative and positive disparities. That only happens with converging stereo cameras (negative disparities for objects in front of point of convergence and positive for objects in the back).&lt;/p&gt;&#xA;" OwnerUserId="9120" LastActivityDate="2015-09-13T22:30:13.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25803" PostTypeId="1" CreationDate="2015-09-13T23:55:33.387" Score="0" ViewCount="839" Body="&lt;p&gt;Lets say. I have an image of 100 samples, and I want to find the presence of smaller image of 24 sample using cross-correlation in the fourier domain. I use Bartlett's and Welch's method for PSD, where I split up the original 100 samples into 4 segments of 25 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to find the maximum or peak response, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Do I look at all 4 segments to find the maximum response?&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="16673" LastActivityDate="2015-12-13T02:52:57.750" Title="Bartlett's and Welch's Method for PSD" Tags="|power-spectral-density|cross-correlation|fourier-series|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25804" PostTypeId="2" ParentId="25803" CreationDate="2015-09-14T01:13:21.460" Score="1" Body="&lt;p&gt;This is just a 1D example that shows the idea (I can't seem to get &lt;code&gt;scilab&lt;/code&gt; to cooperate with real images; at least not yet).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top plot in blue shows the &quot;image&quot;.  The &quot;patch&quot; is indicated by the red dots.  I've selected the location of the &quot;patch&quot; randomly throughout the &quot;image&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom plot shows the cross-correlation between the patch and the image (in green), and the red dot indicates the actual location (start position) of the patch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below does no prewhitening because the &quot;image&quot; is generated using white noise.  Apart from the mean-correction, that is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BNfpq.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BNfpq.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 25803&#xA;clf;&#xA;NIM = 100;&#xA;IM = rand(1,NIM,&quot;uniform&quot;);&#xA;IM = (IM - min(IM))/(max(IM) - min(IM))*255;&#xA;subplot(211)&#xA;plot(IM)&#xA;&#xA;NPT = 24;&#xA;idx = ceil(rand(1,1,&quot;uniform&quot;)*75);&#xA;PT = IM(idx + [0:NPT-1]);&#xA;plot(idx+[0:NPT-1],PT,'r.')&#xA;title('Original and patch')&#xA;NFFT = NIM + NPT - 1;&#xA;&#xA;IMFFT = fft([IM-mean(IM),zeros(1,NPT-1)]);&#xA;PTFFT = fft([PT-mean(PT),zeros(1,NIM-1)]);&#xA;&#xA;subplot(212)&#xA;CORR = ifft(IMFFT.*conj(PTFFT));&#xA;plot(CORR,'g')&#xA;plot(idx,CORR(idx),'r.')&#xA;title('Cross correlation and actual patch position')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-14T01:13:21.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25805" PostTypeId="2" ParentId="25796" CreationDate="2015-09-14T01:22:01.010" Score="1" Body="&lt;p&gt;It sounds like you want to remove the frequency component at about 2.5Hz in the plot, but leave the rest of the plot as untouched as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual first approach to that problem is to just use a &lt;a href=&quot;http://facta.junis.ni.ac.rs/eae/fu2k13/fu01.pdf&quot; rel=&quot;nofollow&quot;&gt;notch filter&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = K \displaystyle\frac{1 - 2 \cos \omega_0 z^{-1} + z^{-2}}{1 - 2r \cos\omega_0 z^{-1} + r^2 z^{-2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_0$ is the (normalized) frequency you want to remove and $r \lt 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are more complex approaches that use, for example, Kalman filtering... but that might require more assumptions about the dynamics of your system that you are prepared to make given your &quot;black box&quot; comments.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-14T01:22:01.010" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25806" PostTypeId="2" ParentId="25801" CreationDate="2015-09-14T03:03:52.000" Score="4" Body="&lt;p&gt;The idea is that you can transmit two signals, $I(t)$ and $Q(t)$, over the same bandwidth and at the same time, and still recover each independently of the other. The math is pretty simple. If the transmitted signal is $s(t)=I(t)\cos(2\pi f_ct)-Q(t)\sin(2\pi f_ct)$, then (ignorning noise, ignoring a factor of 1/2 and assuming coherent reception) the receiver can calculate &#xA;\begin{align*}&#xA;r(t)\cos(2\pi f_ct) &amp;amp;= I(t)\cos^2(2\pi f_ct)-Q(t)\sin(2\pi f_ct)\cos(2\pi f_ct)\\&#xA;&amp;amp;=I(t)+I(t)\cos(2\pi 2f_ct)-Q(t)\sin(2\pi 2f_ct).&#xA;\end{align*}&#xA;After a low-pass filter, the receiver has recovered $I(t)$. Likewise,&#xA;\begin{align*}&#xA;r(t)\sin(2\pi f_ct) &amp;amp;= I(t)\cos(2\pi f_ct)\sin(2\pi f_ct)-Q(t)\sin^2(2\pi f_ct)\\&#xA;&amp;amp;=I(t)\sin(2\pi 2f_ct)-Q(t)+Q(t)\sin(2\pi 2f_ct).&#xA;\end{align*}&#xA;from which $Q(t)$ can be recovered by an low-pass filtering and multiplication by -1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The identities used here are: $\cos(A)\cos(B)=0.5(\cos(A+B)+\cos(A-B))$, $\cos(A)\sin(B)=0.5(\sin(A+B)-\sin(A-B))$ and $\sin(A)\sin(B)=0.5(\cos(A-B)-\cos(A+B))$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you can also define the transmitted signal as $v(t)=I(t)\cos(2\pi f_ct)+Q(t)\sin(2\pi f_ct)$ and avoid the sign inversion when estimating $Q(t)$. The main reason not to, though, is that the complex envelope of $s(t)$ is $I(t)+jQ(t)$. Since most of the time it is preferrable to work with the complex envelope, $s(t)$ is chosen to produce the most convenient expression for it.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-09-14T03:03:52.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25809" PostTypeId="1" AcceptedAnswerId="25817" CreationDate="2015-09-14T09:51:22.467" Score="1" ViewCount="141" Body="&lt;p&gt;I move a device by sending a sine wave proportional to the displacement. I would like to modify the amplitude and mean value dynamically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example at the beginning I would like to go from :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Signal(t) = 1 * sin(t) + 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Signal(t) = 0.95 *sin(t) + 0.95&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My issue is that I don't know how to do that without having a big step in my signal, which is unacceptable for my application.&#xA;For now, all I have is something that change the coefficient on a &quot;long&quot; time, by small step (1&gt;0.99&gt;0.98&gt;0.97&gt;0.96&gt;0.95) so that the &quot;steps&quot; in the output signal remain small, but it is not very clean.&lt;/p&gt;&#xA;" OwnerUserId="17371" LastActivityDate="2015-09-14T15:23:08.187" Title="How to smoothly adjust sine amplitude" Tags="|discrete-signals|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25813" PostTypeId="1" CreationDate="2015-09-14T12:13:32.673" Score="2" ViewCount="198" Body="&lt;p&gt;a &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function#Triangular_window&quot; rel=&quot;nofollow&quot;&gt;triangular (bartlett) window&lt;/a&gt; has a kink (discontinuity in first derivative).  thinking in the continuous (not discrete) case, my intuition is that the fourier transform of any window with a kink must asymptote to a non-zero value (rather than exponentially decay), since it should take infinitely high frequencies to be able to sum to a precisely sharp &quot;corner.&quot;  treated as the kernel (impulse response) of a filter, this would correspond to passing arbitrarily high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is this right?  in general, how do i calculate the asymptotic value, and why isn't this a standard quoted feature of a window?&lt;/p&gt;&#xA;" OwnerUserId="17376" LastActivityDate="2015-10-14T15:42:35.283" Title="is any filter whose impulse response has a discontinuity in the first derivative fundamentally high-pass?" Tags="|filters|fourier-transform|impulse-response|window-functions|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25814" PostTypeId="2" ParentId="25813" CreationDate="2015-09-14T12:59:05.403" Score="1" Body="&lt;p&gt;This actually isn't the case. Consider the continuous-time &lt;a href=&quot;https://en.wikipedia.org/wiki/Triangular_function&quot; rel=&quot;nofollow&quot;&gt;triangle function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{tri}(t) = \begin{cases}&#xA;1 - |t|, &amp;amp;&amp;amp; |t| &amp;lt; 1 \\&#xA;0, &amp;amp;&amp;amp;\text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This function has the Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{Tri}(f) = \text{sinc}^2(f)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This follows readily from the fact that the triangle function can be constructed by convolving a &lt;a href=&quot;https://en.wikipedia.org/wiki/Rectangular_function&quot; rel=&quot;nofollow&quot;&gt;rectangle function&lt;/a&gt;, which has a Fourier transform of $\text{sinc}(f)$, with itself. The $\text{sinc}$ function decays to zero as its argument approaches infinity (and its square decays even faster yet), so the triangle window does not have a highpass characteristic.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-09-14T12:59:05.403" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="25815" PostTypeId="2" ParentId="25809" CreationDate="2015-09-14T13:08:29.933" Score="0" Body="&lt;p&gt;One solution is to chose the changeover time as when&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; \sin(t) + 1 =  0.95 \sin(t) + 0.95 = 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. when $t \approx -\frac{\pi}{2} + 2\pi k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another solution is to change the phase of the second sinusoid so that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sin(t) + 1 = 0.95\sin(t + \phi) + 0.95&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;though you will want to make sure that the derivative of both signals is the same, rather than just their magnitude.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-09-14T14:08:11.190" LastActivityDate="2015-09-14T14:08:11.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25816" PostTypeId="1" AcceptedAnswerId="25832" CreationDate="2015-09-14T13:46:38.247" Score="1" ViewCount="622" Body="&lt;p&gt;A taper function decaying to zero at ends such as a cosine window is routinely applied to the signal before bandpass filtering to reduce end effects. Obviously the window alters the waveform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as for the filtered waveform, how is it reliable near the beginning and end? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;how does the the decay ratio of the window (e.g. 5%, 10% ...) influence? It's selected arbitrarily or by some criteria?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the filtering functions of matlab and scipy, some extrapolation is applied to the ends of the signal to match their slope. In such situations, is the windowing still necessary?&lt;/p&gt;&#xA;" OwnerUserId="8863" LastActivityDate="2016-05-12T08:42:34.700" Title="How is the ends of a bandpass filtered signal reliable after applying the cosine taper?" Tags="|filters|window-functions|filtering|bandpass|window|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="25817" PostTypeId="2" ParentId="25809" CreationDate="2015-09-14T15:06:35.483" Score="2" Body="&lt;p&gt;There's no problem letting the coefficients be a slowly varying function of time,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(t)=a(t)\sin(t)+b(t),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example a linear ramp &#xA;$$a(t)=(a_1-a_0)\frac{t-t_0}{t_1-t_0}+a_0$$ for $t\in[t_0,t_1]$ and similar for $b(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EoKTz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EoKTz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-09-14T15:23:08.187" LastActivityDate="2015-09-14T15:23:08.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25818" PostTypeId="2" ParentId="25809" CreationDate="2015-09-14T15:08:09.503" Score="1" Body="&lt;p&gt;The output is $c(t)\times\left(\sin\left(t\right) + 1\right)$, where $c(t)$ is the coefficient as function of time. That's multiplication by $c(t)$ in time domain, meaning that it will be convolution in frequency domain. Convolution effectively spreads the spectrum of $\left(\sin\left(t\right) + 1\right)$ which originally consists of three peaks (negative frequency of the sinusoid, 0 Hz, and positive frequency of the sinusoid). If this spread is a problem to you, you can control it by lowpass filtering $c(t)$ before doing the multiplication. Say you lowpass filter $c(t)$ at 10 Hz. The result is that the spectrum will not be spread to more than ±10 Hz away from the original peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your application you may not want a brick-wall filter like that, because its step response has an overshoot; its output goes past the original value range of $c(t)$. The easiest thing to do may be to use a number of identical one-pole lowpass filter stages in series. A one-pole lowpass filter has no overshoot. Neither has a cascade of overshoot-free filter stages. A single stage is simply $\text{out}(t) = a\ \text{in}(t) + (1-a)\ \text{out}(t)$, where $a$ is a coefficient between 0 and 1. Each stage increases the slope of the filter's frequency response by 6 dB/octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using an infinite impulse response (IIR) filter such as the above means that the output only asymptotically approaches the correct value. If you want the correct value to be reached within a predetermined time, then you might want to look into finite impulse response (FIR) filters. For that, one of the usual window functions could be used as the impulse response of the FIR filter. The length of the impulse response equals the reaching time.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-09-14T15:08:09.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25819" PostTypeId="1" AcceptedAnswerId="25833" CreationDate="2015-09-14T15:21:07.957" Score="1" ViewCount="459" Body="&lt;p&gt;I have a pre-designed in-series 14th-order IIR filter in second-order sections. Problem is, when I simulate and measure the behavior in my codec, there is a frequency shift downward (as compared to the MATLAB prediction). Is there a simple way to alter the coefficients in such a way to shift the center frequencies of each band? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-09-15T01:25:06.220" Title="How to shift the center frequency of an IIR filter" Tags="|filters|infinite-impulse-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25820" PostTypeId="2" ParentId="24721" CreationDate="2015-09-14T15:42:34.033" Score="1" Body="&lt;p&gt;It is indeed possible to detect the center of the circles by various image processing techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, convert to grayscale, apply dilation until the edges disappear, then connected components and compute the centroids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this only gives you points, in no specific order, and this might be of little help to you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to match the new map against the old one, match the circles, to transfer existing info, but you'll have to check the correct transfer &quot;by hand&quot;, anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tr67B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tr67B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder why this should be done in JavaScript, as I think that this is an offline operation.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-14T15:42:34.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25821" PostTypeId="2" ParentId="25238" CreationDate="2015-09-14T15:47:24.290" Score="0" Body="&lt;p&gt;It is not very clear from the figure but the main energy arrival seems to be a 100ns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you plan to use the CIR for comms simulations you will need to normalize the arrivals using the system bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="17142" LastActivityDate="2015-09-14T15:47:24.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25823" PostTypeId="2" ParentId="20061" CreationDate="2015-09-14T17:33:10.693" Score="2" Body="&lt;p&gt;Just eyeballing the first image tells me that you have a very simple band pattern. They're in fact mostly horizontal (in the spatial domain). You see a clear cross in the Fourier domain. That's because most of your spatial features in that hallway are oriented horizontally and vertically. Your horizontal band similarly show up as a &lt;strong&gt;pair of dots&lt;/strong&gt; above and below the origin. The bands are &lt;em&gt;slightly&lt;/em&gt; rotated to the right, and so will the pair of dots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll need to erase a &lt;em&gt;very&lt;/em&gt; small area around these dots. But how to locate them? The easiest solution may be to take your recorded image, open it in Paint or a similar program, and paint pure black and white bars over the actual bands. Now take the FFT of this bar pattern, and you get the exact location of the two points you're looking for. It in general won't be exactly a single FFT bin, so you could fit a gaussian curve to the neighborhood of those two points, and use the opposite &lt;code&gt;1-gauss(x-xc,y-yc)&lt;/code&gt; as the frequency domain filter. &lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2015-09-14T17:33:10.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25825" PostTypeId="2" ParentId="22726" CreationDate="2015-09-14T17:48:13.493" Score="1" Body="&lt;p&gt;Just wanted to supplement an excellent answer by &lt;a href=&quot;https://dsp.stackexchange.com/users/4298/matt-l&quot;&gt;Matt L.&lt;/a&gt;, since it was not very clear to me how he calculated the numerical value of $k$ in equation $(3)$. After reading the book &quot;Introduction to signal processing&quot; by Orfandis I have found the formula&#xA;$$k = \frac{1}{\tan\left(\frac{\omega_c}{2}\right)}$$&#xA;where $\omega_c$ is the so called digital cutoff frequency&#xA;$$\omega_c = \frac{2\pi f_c}{f_s}$$&#xA;where $f_c$ is the desired cutoff frequency of the filter and $f_s$ is the sampling frequency. Thus we arrive at the resulting expression&#xA;$$k = \frac{1}{\tan\left(\frac{\pi f_c}{f_s}\right)}$$&#xA;In my question I used sampling frequency $f_s = 30\ Hz$ and the desired cutoff frequency $f_c = 1\ Hz$, which gave&#xA;$$k = \frac{1}{\tan\left(\pi\frac{1Hz}{30Hz}\right)} = 9.5143646$$&#xA;and&#xA;$$-\frac{1-k}{1+k} = 0.80978403$$&lt;/p&gt;&#xA;" OwnerUserId="15439" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-09-14T17:48:13.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25826" PostTypeId="1" AcceptedAnswerId="25831" CreationDate="2015-09-14T18:14:25.283" Score="3" ViewCount="7752" Body="&lt;p&gt;My understanding of sampling frequency is when we have an analog signal x(t) we convert it to a digital signal. Assume the sampling frequency is denoted by $f_s$ then the sampling time $T_s$. In my understading this is denoted the number of samples per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB programs, I have come across generation of base band signal. The authors have upsampled the base band signal and the sampling rate was stated to be 3 samples per symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what does samples per symbol mean.Assuming we have QAM symbols are we repeating it three times? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15590" LastActivityDate="2015-09-14T21:23:25.617" Title="Confusion between samples per second and samples per symbol" Tags="|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25827" PostTypeId="2" ParentId="4677" CreationDate="2015-09-14T19:13:18.637" Score="0" Body="&lt;p&gt;In addition to &lt;strong&gt;@Jason R&lt;/strong&gt; answer, here are some helpful links to build color palettes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://blog.visual.ly/building-effective-color-scales/&quot; rel=&quot;nofollow&quot;&gt;http://blog.visual.ly/building-effective-color-scales/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;lots of color palettes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.idldev.com/mglib/vis/color/cptcity_catalog.html&quot; rel=&quot;nofollow&quot;&gt;http://docs.idldev.com/mglib/vis/color/cptcity_catalog.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3290" LastActivityDate="2015-09-14T19:13:18.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25828" PostTypeId="1" AcceptedAnswerId="25829" CreationDate="2015-09-14T20:00:06.003" Score="0" ViewCount="210" Body="&lt;p&gt;I have a signal (in blue) that I would like to smooth out (in red, moving average).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to get red peaks to look more round than triangular and at the same time their width would become closer to the original ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/imLVk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/imLVk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know / can you suggest a filter that would yield such result ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input is the zero-crossing rate from a song, for building a colored waveform as I've tried in this question : &lt;a href=&quot;https://dsp.stackexchange.com/questions/8997/coloring-a-waveform-with-spectral-centroid-or-by-other-means&quot;&gt;Coloring a waveform with spectral centroid or by other means&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the result of the new approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(unprocessed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0vgWr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0vgWr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(ideal result, cheated somehow here using a post, expensive gaussian blur)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JuiB8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JuiB8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the result, using &lt;strong&gt;@Laurent Duval&lt;/strong&gt; answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ejF6i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ejF6i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I still need to try all of your suggestions again as my input/initial take was buggy, surprisingly now the ZCR yields better output than using FFTW out of the box (pics on the right):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l9SSs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l9SSs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple moving average (green: 1-pass, gold: 2-passes)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y5Zqd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y5Zqd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3290" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-09-16T07:16:51.617" Title="How to obtain round peaks instead of triangular peaks when smoothing an input?" Tags="|smoothing|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25829" PostTypeId="2" ParentId="25828" CreationDate="2015-09-14T20:31:41.837" Score="2" Body="&lt;p&gt;I am not sure I understand &quot;round&quot; versus &quot;triangular&quot;. Yet in chemistry, least-squares polynomial fitting filters are used to keep the smooth shape of spectra peaks. The most famous are the &lt;a href=&quot;https://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter&quot; rel=&quot;nofollow&quot;&gt;Savitzky–Golay filters&lt;/a&gt;. They have been revived in signal processing by a recent overview paper by R. W. Shafer: &lt;a href=&quot;http://www-inst.eecs.berkeley.edu/~ee123/fa11/docs/SGFilter.pdf&quot; rel=&quot;nofollow&quot;&gt;What Is a Savitzky-Golay Filter?&lt;/a&gt; (2011).&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-09-14T20:31:41.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25830" PostTypeId="1" AcceptedAnswerId="25849" CreationDate="2015-09-14T20:38:12.567" Score="1" ViewCount="369" Body="&lt;p&gt;I'm trying to programmatically plot a sound wave that I have placed in a 2d array, however, I cannot consistently get the sound wave to reach the end of the window. For example, when you load a sound in audacity, you get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/79nN2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/79nN2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, when I load a sound into my program I will often get something like this (red is the play head that moves at speed of one blue tick mark every second. The Green line is the end of the song in seconds):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1ZBWp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1ZBWp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, I can plot the complete wave form, but it does not sync up with the end of the song. Oddly enough, there are times during this song that the wave form &lt;em&gt;is&lt;/em&gt; an accurate representation of what's being played. There are also a handful of songs that do not seem to have this issue (but more than a handful of others that do have this issue). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I'm drawing the wave form: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    float drawStep = songLengthInSeconds / numberOfSamples;&#xA;    for(int i = 0; i &amp;lt; waveForm.length ; i++){&#xA;      for(int j =0 ; j &amp;lt; waveForm.length - 1; j++){&#xA;         renderer.line(x, waveForm[i][j], x + drawStep, waveForm[i][j+1]);&#xA;&#xA;         x+= drawStep;    &#xA;}&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The renderer.line method signature is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;renderer.line(beginningX, beginningY, endingX, endingY);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I get the number of samples by just adding all of the waveForm[x].length together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the top and bottom wave forms in the picture below are being drawn differently which is why they don't match. The bottom wave form is the one that is represented by the code above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been fighting with this for a couple weeks now and would be very grateful if anyone has any suggestions that would push me in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="17378" LastActivityDate="2015-09-15T23:40:30.780" Title="How can I accurately represent an mp3's wave form in respects to time?" Tags="|frequency-spectrum|sound|time-frequency|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="25831" PostTypeId="2" ParentId="25826" CreationDate="2015-09-14T21:23:25.617" Score="4" Body="&lt;p&gt;A digital communications signal such as QAM can be generally written as $$s(t) = \sum_{n=0}^{N}a_n p(t-nT),$$ where $a_n$ are (possibly complex) amplitudes taken from a finite alphabet, and the symbol rate is $1/T$. The pulses $p(t-nT)$ are often called &quot;symbols&quot;. Matlab commands that ask you to specify &quot;samples per symbol&quot; are asking how many samples you want to use to define $p(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, since you know the pulse duration, specifying the samples per symbol is an indirect way of specifying the sampling rate.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-09-14T21:23:25.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25832" PostTypeId="2" ParentId="25816" CreationDate="2015-09-14T22:14:23.857" Score="2" Body="&lt;p&gt;A taper function is applied for spectral estimation if the artifacts from a non-tapered rectangular window provide less useful results that the artifacts due to the tapered window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not tapering a finite length sub-sample vector is equivalent to rectangular windowing, which convolves Sinc shaped artifacts onto the spectrum.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-09-14T22:14:23.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25833" PostTypeId="2" ParentId="25819" CreationDate="2015-09-14T23:48:51.737" Score="1" Body="&lt;p&gt;The problem was an incorrect sampling rate issue, as a lower sampling rate than the designed rate caused the center frequency shift downwards. Today I learned something about the relationship between sampling rate and IIR coefficients (there is a proportional relationship between sampling rate and center frequency).&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="80" LastEditDate="2015-09-15T01:25:06.220" LastActivityDate="2015-09-15T01:25:06.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25835" PostTypeId="2" ParentId="25801" CreationDate="2015-09-15T03:40:28.900" Score="5" Body="&lt;p&gt;If we take the complex baseband signal as $S(t) = I(t) + jQ(t)$&#xA;(which of course means that we have two separate wires on which the $I(t)$ and $Q(t)$ voltages appear), then we have a nice signal representation&#xA;for the transmitted signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t) = I(t) \cos(2\pi f_c t) - Q(t) \sin(2\pi f_ct) &#xA;= \operatorname{Re}\left(S(t)e^{j2\pi f_c t}\right).$$&#xA;If we continue to fool ourselves by thinking of $S(t)$ having been&#xA;modulated onto the complex carrier signal (complex sinusoid) &#xA;$e^{j2\pi f_c t}$, then demodulation is &quot;easy&quot;. Simply&#xA;multiply $S(t)e^{j2\pi f_c t}$ by $e^{-j2\pi f_c t}$ to &#xA;demodulate the signal and recover $S(t)$.&#xA;Of course, we don't really &lt;em&gt;have&lt;/em&gt; $S(t)e^{j2\pi f_c t}$&#xA;in all its complex glory: what we have as the received&#xA;signal is $\operatorname{Re}\left(S(t)e^{j2\pi f_c t}\right)$.&#xA;But let us not let that phase us. Let's just multiply&#xA;$\operatorname{Re}\left(S(t)e^{j2\pi f_c t}\right)$ by&#xA;$$e^{-j2\pi f_c t} = \cos(2\pi f_c t) - j\sin(2\pi f_c t)$$&#xA;which requires two separate multipliers and two separate&#xA;wires to output the real and imaginary parts.  On the&#xA;real part wire, we get (after ignoring noise, multiplicative factors&#xA;etc as in MBaz's answer)&#xA;\begin{align*}&#xA;s(t)\cos(2\pi f_ct) &amp;amp;= I(t)\cos^2(2\pi f_ct)-Q(t)\sin(2\pi f_ct)\cos(2\pi f_ct)\\&#xA;&amp;amp;=I(t)\quad +I(t)\cos(2\pi 2f_ct)-Q(t)\sin(2\pi 2f_ct).\tag{1}&#xA;\end{align*}&#xA;while on the imaginary part wire we get&#xA;\begin{align*}&#xA;s(t)\left[-\sin(2\pi f_ct)\right] &#xA;&amp;amp;= -I(t)\cos(2\pi f_ct)\sin(2\pi f_ct)+Q(t)\sin^2(2\pi f_ct)\\&#xA;&amp;amp;= Q(t) \quad -I(t)\sin(2\pi 2f_ct)- Q(t)\cos(2\pi 2f_ct).\tag{2}&#xA;\end{align*}&#xA;In both $(1)$ and $(2)$, &quot;low-pass&quot; filtering is used to remove&#xA;the double-frequency terms and leave us with just $I(t)$ and&#xA;$Q(t)$ on two separate wires, i.e. the complex baseband signal.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So at the transmitter, why multiply $I(t)$ by $\cos(2\pi f_c t)$&#xA;and $Q(t)$ by $-\sin(2\pi f_ct)$ and then &lt;em&gt;add&lt;/em&gt; to get the&#xA;transmitted signal&#xA;$$s(t) = I(t) \cos(2\pi f_c t) - Q(t) \sin(2\pi f_ct)?$$&#xA;Why not multiply $Q(t)$ by $+\sin(2\pi f_ct)$ and then add to get&#xA;$$s(t) = I(t) \cos(2\pi f_c t) + Q(t) \sin(2\pi f_ct)?\tag{3}$$&#xA;Sure we can, and now we have the nice representation&#xA;$\operatorname{Re}\left(S(t)e^{-j2\pi f_c t}\right)$&#xA;which works as well except that the company VP will ask &#xA;you during your presentation why&#xA;you are using negative frequencies in your carrier signal.&#xA;At the receiver, we demodulate by multiplying&#xA;$s(t)$ (as given in $(3)$) by $e^{+j2\pi f_c t}$ so as to get&#xA;(in the Q branch)&#xA;\begin{align*}&#xA;s(t)\sin(2\pi f_ct)&#xA;&amp;amp;= I(t)\cos(2\pi f_ct)\sin(2\pi f_ct)+Q(t)\sin^2(2\pi f_ct)\\&#xA;&amp;amp;= Q(t) \quad +I(t)\sin(2\pi 2f_ct)- Q(t)\cos(2\pi 2f_ct).\tag{4}&#xA;\end{align*}&#xA;Note that &lt;em&gt;no&lt;/em&gt; complementation/polarity reversal of $Q(t)$ is&#xA;necessary if we follow a consistent approach and think of&#xA;everything as complex signals.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-09-15T03:40:28.900" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25836" PostTypeId="1" CreationDate="2015-09-15T03:43:13.770" Score="2" ViewCount="274" Body="&lt;p&gt;I want to estimate time delay between two complex narrow band signals. I can use any correlation method. There are several methods in the literature about sub-sample time delay estimation. Generally this subs-sample delay estimation is done through phase estimation. My question is: are these sub-sampling methods using phase requires interpolation or not? I was expecting that we are interpolating in Fourier domain and using phase information to estimate time delay. Any comment would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15437" LastEditorUserId="15437" LastEditDate="2015-09-15T06:54:46.027" LastActivityDate="2015-09-15T23:05:56.807" Title="Is sub-sampling delay estimation possible without interpolation?" Tags="|signal-analysis|fourier-transform|time-frequency|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25837" PostTypeId="1" AcceptedAnswerId="25841" CreationDate="2015-09-15T07:17:43.423" Score="2" ViewCount="878" Body="&lt;p&gt;I was reading from Internet about FIR filter design using MATLAB, and I saw parameters like passband frequency, stopband frequency, passband attuenation, stopband attuenation, etc. What made me confused was the parameter sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand the significance of sampling frequency with respect to a filter. Is it the sampling frequency of input signal that this filter can work on or is it something else?&lt;/p&gt;&#xA;" OwnerUserId="16089" LastEditorUserId="207" LastEditDate="2015-09-15T17:23:39.197" LastActivityDate="2017-07-28T08:51:19.433" Title="A basic question in FIR filter design using MATLAB" Tags="|matlab|filters|filter-design|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25838" PostTypeId="2" ParentId="4677" CreationDate="2015-09-15T08:37:41.883" Score="0" Body="&lt;p&gt;A possibility is to map the grayscale range linearly to 0-360° (possibly with a shift), and transform from HLS to RGB, with maximum lightness and saturation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w3p2x.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w3p2x.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-15T08:37:41.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25839" PostTypeId="2" ParentId="25828" CreationDate="2015-09-15T08:48:50.520" Score="3" Body="&lt;p&gt;Use two or three passes of moving average (can be pipelined).&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-15T08:48:50.520" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="25840" PostTypeId="2" ParentId="25837" CreationDate="2015-09-15T09:22:49.160" Score="4" Body="&lt;p&gt;Signals that you can handle in the computer have to be sampled into discrete values.  You do this by measuring the voltage on the analog input many thousand times per second.  Exactly how often you make that measurement is the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typical rates for PC audio systems are 44100Hz, 22050 Hz, and 11025 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When designing a filter, you must know the rate at which the signal was sampled.  That is why you must specify the sampling rate for Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please do some basic reading about DSP and sampling rates.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-09-15T09:22:49.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25841" PostTypeId="2" ParentId="25837" CreationDate="2015-09-15T11:50:43.600" Score="12" Body="&lt;p&gt;All digital filter frequency parameters (passband begin frequency, passband end frequency, and stopband begin frequency) are stated in terms of an input signal sequence's Fs sampling frequency. For a lowpass filter example, if I said a lowpass filter's passband width (it's &quot;cutoff&quot; frequency) is 0.2, I'm saying that the cutoff frequency is 0.2 times Fs. So if an input signal's Fs was 1.0 kHz that lowpass filter's cutoff frequency is 200 Hz. However, if an input signal's Fs was 20 kHz then in this situation that same lowpass filter's cutoff frequency is 4 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a different scenario, if you said, “Rick, please use Matlab and design a digital lowpass filter whose cutoff frequency is 300 Hz.” It would be impossible for me to do that unless you told me what was the filter’s input sequence’s Fs sample rate. But if you then said “Fs = 1000 Hz”, then I’d know the filter’s ‘normalized’ cutoff freq was 300/1000 = 0.3 enabling me to design the lowpass digital filter.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-15T11:50:43.600" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25842" PostTypeId="2" ParentId="25828" CreationDate="2015-09-15T12:24:38.357" Score="0" Body="&lt;p&gt;In the question Aybe implied that the red curve is a moving average of the blue curve. That doesn't look correct to me. (It seems to me that a moving-averaged output would not have the sharp peaks seen in the red curve.) My first thought was to suggest, as Yves Daoust did, a moving average filter as a possible answer to the question. If Yves and I had access the the blue curve's sample values we could see if a true moving average filter will satisfy Aybe.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-15T12:24:38.357" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25845" PostTypeId="1" AcceptedAnswerId="25846" CreationDate="2015-09-15T14:33:06.950" Score="60" ViewCount="65481" Body="&lt;p&gt;I understand the Fourier Transform which is a mathematical operation that lets you see the frequency content of a given signal. But now, in my comm. course, the professor introduced the Hilbert Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that it is somewhat linked to the frequency content given the fact that the Hilbert Transform is multiplying a FFT by &lt;span class=&quot;math-container&quot;&gt;$-j\operatorname{sign}(W(f))$&lt;/span&gt; or convolving the time function with &lt;span class=&quot;math-container&quot;&gt;$1/\pi t$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the meaning of the Hilbert transform? What information do we get by applying that transform to a given signal?&lt;/p&gt;&#xA;" OwnerUserId="17386" LastEditorUserId="4298" LastEditDate="2019-08-14T07:45:52.507" LastActivityDate="2024-03-21T18:15:35.847" Title="Meaning of Hilbert Transform" Tags="|signal-analysis|hilbert-transform|" AnswerCount="10" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25846" PostTypeId="2" ParentId="25845" CreationDate="2015-09-15T14:58:27.320" Score="52" Body="&lt;p&gt;One application of the Hilbert Transform is to obtain a so-called Analytic Signal. For signal &lt;span class=&quot;math-container&quot;&gt;$s(t)$&lt;/span&gt;, its Hilbert Transform &lt;span class=&quot;math-container&quot;&gt;$\hat{s}(t)$&lt;/span&gt; is defined as a composition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$s_A(t)=s(t)+j\hat{s}(t) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Analytic Signal that we obtain is complex valued, therefore we can express it in exponential notation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$s_A(t)=A(t)e^{j\psi(t)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A(t)$&lt;/span&gt; is the instantaneous amplitude (envelope)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\psi(t)$&lt;/span&gt; is the instantaneous phase.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;So how are these helpful?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The instantaneous amplitude can be useful in many cases (it is widely used for finding the envelope of simple harmonic signals). Here is an example for an impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yKTDQ.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yKTDQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, based on the phase, we can calculate the instantaneous frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(t)=\dfrac{1}{2\pi}\dfrac{d\psi}{dt}(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is again helpful in many applications, such as frequency detection of a sweeping tone, rotating engines, etc.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Other examples of usage include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Sampling of narrowband signals in telecommunications (mostly using Hilbert filters).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Medical imaging.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Array processing for Direction of Arrival.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;System response analysis.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="11256" LastEditDate="2019-08-14T00:00:24.697" LastActivityDate="2019-08-14T00:00:24.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25849" PostTypeId="2" ParentId="25830" CreationDate="2015-09-15T18:32:39.343" Score="2" Body="&lt;p&gt;Storing the samples in a square array is weird. You can't represent all song lengths (in samples) as squares of integer array dimensions but yet the complete array is being plotted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your code seems to miss one x+=drawStep when transitioning between rows of the array. Neither does it &quot;connect the dots&quot; across the rows. If the last sample of each row is duplicated at the next row then it's fine as a row represents only waveForm.length - 1 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, it just might be that x and drawStep are not accurate enough. Try making both doubles instead of floats. If there is an improvement but not yet good enough, calculate x by multiplication before each j loop. You should typecast songLengthInSeconds to double too.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-09-15T18:32:39.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25850" PostTypeId="2" ParentId="22412" CreationDate="2015-09-15T18:34:23.737" Score="2" Body="&lt;p&gt;In 1D, you should remember that the median &lt;span class=&quot;math-container&quot;&gt;$\hat{m}$&lt;/span&gt; minimizes a sum of absolute values (&lt;span class=&quot;math-container&quot;&gt;$\ell_1$&lt;/span&gt; norm):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{m} = \arg \min \sum_{k=1}^k |x_k-m|.$$&lt;/span&gt;&#xA;You can find out that the answer (in 1D only) is the center value of the &lt;span class=&quot;math-container&quot;&gt;$x_k$&lt;/span&gt; for an odd number of samples, and any value between the two center values for an even number of samples (traditionally their average).&lt;/p&gt;&#xA;&lt;p&gt;The weighted median, to me, boils down to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{m}_w = \arg \min \sum_{k=1}^k w_i|x_k-m|,$$&lt;/span&gt;&#xA;just like the weighted mean &lt;span class=&quot;math-container&quot;&gt;$\hat{M}$&lt;/span&gt; minimizes (&lt;span class=&quot;math-container&quot;&gt;$\ell_2$&lt;/span&gt; norm):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{M} = \arg \min \sum_{k=1}^k w_i|x_k-M|^2.$$&lt;/span&gt;&#xA;In the definition I use, let &lt;span class=&quot;math-container&quot;&gt;$x=[1,2,3,2,4]$&lt;/span&gt;. The standard median is &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, uniquely based on the rank. You can then take integer weights, like &lt;span class=&quot;math-container&quot;&gt;$w=[1,2,5,2,1]$&lt;/span&gt;. They aim at limiting the pure ranking effect of the median, and at introducing some spatialisation or &amp;quot;refocused location&amp;quot;. A weighted median would consist in duplicating/triplicating/&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-plicating the initial values with respect to the weights and their respective location: &lt;span class=&quot;math-container&quot;&gt;$x_w=[1,2,2,3,3,3,3,3,2,2,4]$&lt;/span&gt; and take the median of the new data: &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;.&#xA;The definition extends to rational and real weights (perhaps complex).&lt;/p&gt;&#xA;&lt;p&gt;The advantages of the weighted median in images are mostly two-fold, since you can recover the median with &lt;span class=&quot;math-container&quot;&gt;$w_k=1$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Restore some spatialisation, absent in the traditional median, which generates &amp;quot;moving edges&amp;quot;, by better centering the median around the central pixel of the square window (if weights in the mask are shapes like a pyramid). That is evident from the example above: the median picks &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, but the weighting answer &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;, as a central edge, would be a better choice,&lt;/li&gt;&#xA;&lt;li&gt;Allow negative weights, to better mimic not only smoothing filters (positive weights) but also &amp;quot;median-derivative-like&amp;quot;  filters.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;One of my sources is &lt;a href=&quot;https://www.elsevier.com/books/nonlinear-image-processing/sicuranza/978-0-12-500451-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nonlinear Image Processing&lt;/a&gt;, by Mitra &amp;amp; Sicuranza.&lt;/p&gt;&#xA;&lt;p&gt;So the weighted median is always &amp;quot;better&amp;quot; as more generic, provided you can find a neat weighting. To recenter, a pyramidal shape (centered at the center pixel of the square) ought to be better than a flat mask. For instance, take a weighting based on Pascal triangle coefficients.&lt;/p&gt;&#xA;&lt;p&gt;The concept of a true median in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; dimensions is more complicated than the above procedure, since there is no &amp;quot;natural ordering&amp;quot; (compatible with some operations) in 2D, and requires optimization.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2020-07-29T07:25:28.973" LastActivityDate="2020-07-29T07:25:28.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25851" PostTypeId="2" ParentId="25231" CreationDate="2015-09-15T19:46:43.790" Score="-1" Body="&lt;p&gt;You want to find the transfer function of a microphone. This is a hard thing without some prerequisities. You'll need an anechoic or hemi-anechoic chamber. A flat spectrum excitation source. Don't know if your source is relatively flat? You are out of luck. You need to average also for a smoother response. The command you're looking for in MATLAB is &lt;code&gt;freqz()&lt;/code&gt;. Go with the published response when you don't have these things at hand.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-09-15T19:46:43.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25852" PostTypeId="2" ParentId="25836" CreationDate="2015-09-15T19:49:49.533" Score="2" Body="&lt;p&gt;For finite length signals, interpolation (both for frequency and phase) in the frequency domain is helpful if the frequency is not at a DFT/FFT bin center.  Relative phase estimation is required for delay estimation in the frequency domain.  This relative phase estimation can produce a sub-time-domain-sample delay estimation result.  This delay estimation can have an uncertainty related to an unknown integer multiple of the signal's period due to phase unwrapping errors, unless there is some other time domain envelope information available.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-09-15T23:05:56.807" LastActivityDate="2015-09-15T23:05:56.807" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25854" PostTypeId="2" ParentId="25845" CreationDate="2015-09-15T21:14:13.917" Score="19" Body="&lt;p&gt;In layman terms, the Hilbert transform, when used on real data, provides &quot;a true (instantaneous) amplitude&quot; (and some more) for stationary phenomena, by turning them into &quot;specific&quot; complex data. For instance, a cosine $\cos(t)$ is inherently of amplitude 1, which you do not see directly, since it visually wiggles between $-1$ and $1$, and periodically vanishes. THe Hilbert transform complements the cosine in &quot;the most consistent manner&quot; so that the resulting complex function $\cos(t)+i\sin(t)$ keeps all the initial information, plus its &quot;amplitude&quot; is directly a modulus of 1. All the above requires care, as the notion of band-limitedness and locality come into play.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform (and the Riesz transform in higher dimensions) might be a more fundamental tool. I do like the prologue of Chapter 2 in &lt;a href=&quot;http://www.math.wustl.edu/~sk/books/harmonic.pdf&quot; rel=&quot;noreferrer&quot;&gt;Explorations in Harmonic Analysis with Applications to Complex Function Theory and the Heisenberg Group&lt;/a&gt;, by Steven G. Krantz:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Prologue: The Hilbert transform is, without question, the most&#xA;  important operator in analysis. It arises in so many different&#xA;  contexts, and all these contexts are intertwined in profound and &#xA;  influential ways. What it all comes down to is that there is only one&#xA;  singular integral in dimension 1, and it is the Hilbert transform. The&#xA;  philosophy is that all significant analytic questions reduce to a&#xA;  singular integral; and in the first dimension there is just one&#xA;  choice.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The applications in signal/image processing are numerous, possibly due to its fundamental properties: instantaneous amplitude/frequency estimation, construction of causal filters for amplitude only (Kramers-Krönig relations), small-redundancy 2D directional wavelets, shift-invariant edge detection, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also suggest the two volumes by F. King, 2009, &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_transform#CITEREFKing2009&quot; rel=&quot;noreferrer&quot;&gt;Hilbert transforms&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2018-05-18T13:50:54.197" LastActivityDate="2018-05-18T13:50:54.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25855" PostTypeId="1" CreationDate="2015-09-15T22:23:41.557" Score="0" ViewCount="55" Body="&lt;p&gt;I have speech data that I can represent using matlab plot.&#xA;however, If i want to display it on log scale(like cooledit or Audition), I can take something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data = audioread(pth);&#xA;for j=1:length(data)&#xA;    if data(j) &amp;gt;0 &#xA;         data(j) = 20*log10(data(j));&#xA;    else&#xA;         data(j) = 20*log10(abs(data (j)));&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;problem with this is that zero values map to infinity and negative values map to positive side . I need representation where Y axis would run in db like [0 -3 ..-21..-inf.. -21 -3 0](like in Cooledit) and the data is plotted as per this axis.&lt;br&gt;&#xA;How do i do this?&lt;br&gt;&#xA;sedy&lt;/p&gt;&#xA;" OwnerUserId="11096" LastActivityDate="2015-10-16T04:01:06.407" Title="displaying speech data in log scale using Matlab" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25857" PostTypeId="2" ParentId="25830" CreationDate="2015-09-15T23:40:30.780" Score="0" Body="&lt;p&gt;mp3 is a block-based encoding format.  Thus a signal may have to be extended by zero padding to fill the last block of compressed data.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-09-15T23:40:30.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25858" PostTypeId="2" ParentId="25845" CreationDate="2015-09-16T01:27:16.630" Score="10" Body="&lt;p&gt;The analytic signal produced by the Hilbert transform is useful in many signal analysis applications. If you bandpass filter the signal first, the analytic signal representation gives you information about the local structure of the signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;phase indicates the local symmetry at the point, where 0 is positive symmetric (peak), $\pi$ is negative symmetric (trough), and $\pm \pi/2$ is anti-symmetric (rising / falling edge).&lt;/li&gt;&#xA;&lt;li&gt;amplitude indicates the strength of the structure at the point, independent of the symmetry (phase).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This representation has been used for &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;feature detection via local energy (amplitude)&lt;/li&gt;&#xA;&lt;li&gt;feature classification using phase&lt;/li&gt;&#xA;&lt;li&gt;feature detection via phase congruency&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It has also been extending to higher dimensions using the Riesz transform, for example the monogenic signal.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-16T01:27:16.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25859" PostTypeId="2" ParentId="25828" CreationDate="2015-09-16T01:33:24.310" Score="1" Body="&lt;p&gt;Try a small Gaussian filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An approximation to the Gaussian can be achieved by applying a moving average filter multiple times.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-16T01:33:24.310" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25860" PostTypeId="2" ParentId="24756" CreationDate="2015-09-16T02:17:52.850" Score="2" Body="&lt;p&gt;Note the symmetry in your 3rd plot. That tells me the MathNet.Numerics FFT is computing a full-frequency FFT (both positive and negative frequencies), and plotting the FFT results where zero Hz should be the center of the horizontal axis. However, Problem# 1, for some reason the labeling of the horizontal axis does NOT have zero Hz in the center. I can’t explain that. Problem# 2, there’s something very wrong with the ‘flat-top’ spectral shape in your 3rd plot. Problem# 3, it seems impossible to me that your 3rd plot should have spectral components whose magnitudes are 10 raised to the 15th power. (Looking at your 1st plot I’d expect your spectral magnitude results to be on the order of 10 raised to the 7th power.) Stated in technical terms, your 3rd plot is “truly FUBAR.”&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer, heltonbiker, is for you to determine precisely, in great detail, EXACTLY what processing is taking place in your MathNet.Numerics FFT and plotting routines. Good Luck.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-16T02:17:52.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25861" PostTypeId="2" ParentId="25845" CreationDate="2015-09-16T02:29:40.377" Score="9" Body="&lt;p&gt;Implementing a Hilbert transform enables us to create an analytic signal based on some original real-valued signal. And in the comms world we can use the analytic signal to easily and accurately compute the instantaneous magnitude of the original real-valued signal. That process is used in AM demodulation. Also from the analytic signal we can easily and accurately compute the instantaneous phase of the original real-valued signal. That process is used in both phase and FM demodulation. Your professor is correct in covering the Hilbert transform because it's so darned useful in comms systems.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15391" LastEditDate="2015-09-16T02:37:03.713" LastActivityDate="2015-09-16T02:37:03.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25862" PostTypeId="2" ParentId="25845" CreationDate="2015-09-16T03:38:46.230" Score="11" Body="&lt;p&gt;A transform (FT or Hilbert, etc.) doesn't create new information from nothing.  It only represents the information already present in a different way.  The &amp;quot;information we get&amp;quot;, or the added dimension in the resultant analytic complex signal provided by a Hilbert transform of a 1D/real signal, is a form of summarization of the local environment of each point in that signal, joined to that point.&lt;/p&gt;&#xA;&lt;p&gt;Information such as local phase and envelope amplitude is really information about some width or extent (up to an infinite extent) of the signal surrounding each local point.  The Hilbert transform, in generating one component of a complex analytic signal from a 1D real signal, compacts some information from the surrounding extent of a real signal onto each single (complex) point of the result, thus allowing one to make more decisions (such a demodulating a bit, graphing an envelope amplitude, etc.) at each local (now complex) point or sample, without having to re-scan and/or process a new (wavelet, windowed Goertzel, etc.) window of some width on the signal at each point.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2021-03-17T00:17:20.520" LastActivityDate="2021-03-17T00:17:20.520" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25863" PostTypeId="2" ParentId="25855" CreationDate="2015-09-16T04:00:16.400" Score="-1" Body="&lt;p&gt;It doesn't really make sense to display an instantaneous AC waveform on a log scale - as demonstrated by your results. I googled for cooledit screenshots and found this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tnuJS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tnuJS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To accomplish this you would want to keep your data linearly scaled and draw it normally. Then just label the axis at the desired dB points.&lt;/p&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-09-16T04:00:16.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25864" PostTypeId="1" AcceptedAnswerId="25953" CreationDate="2015-09-16T08:41:19.460" Score="3" ViewCount="4805" Body="&lt;p&gt;I try to remove from an image all stripes with slope between 110° and 120° (Fig. 1a) and my first idea was to filter my image in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I remembered, the spectrum of those stripes should occupy a pie segment between 20-30° (i.e. the original slope - 90°), but to be sure I prepared an artificial black-and-white image with similar pattern (Fig. 2a). It seemed my speculations were correct (Fig. 2b).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I tried to create a mask and simply &quot;cut off&quot; part of the spectrum to supress high frequencies associated with 10-120° stripes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only after several trials I came across a mask (Fig. 3a) which satisfies my needs to some degree (Fig. 4). However, I can't figure the relation between this empirically-obtained mask and the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone give me some advice where are flaws in my code or in my reasoning?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Pta3n.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pta3n.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the MATLAB code I've used for filtering:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f = imread('img/crystal-grain_sample.jpg');&#xA;figure, imshow(f); title('f');&#xA;&#xA;m = max(size(f));&#xA;P = 2^nextpow2(2*m);&#xA;PQ = [P, P];&#xA;&#xA;Fp = fft2(f, PQ(1), PQ(2));&#xA;&#xA;Fc = fftshift(Fp);&#xA;Fc_abs = abs(Fc);&#xA;Fs_log = log(1+Fc_abs);&#xA;&#xA;%figure; imshow(Fc_abs, []); title('Fc (abs)');&#xA;%figure; imshow(Fs_log, []); title('Fs (log)');&#xA;&#xA;Hp = im2double(imread('spec-mask.png'));&#xA;Gp = Hp .* Fp;&#xA;gp = real(ifft2(Gp));&#xA;gpc1 = gp(1:size(f,1), 1:size(f,2));&#xA;figure; imshow(gpc1, []); title('g');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's the original image:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nuFs5.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nuFs5.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17395" LastEditorUserId="17395" LastEditDate="2015-09-16T11:23:38.023" LastActivityDate="2015-09-21T11:08:21.560" Title="Remove stripes from image using FFT" Tags="|image-processing|fft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25865" PostTypeId="1" CreationDate="2015-09-16T11:12:56.157" Score="2" ViewCount="2477" Body="&lt;p&gt;The context of the problem is that I have several robots located remotely which give their position (x,y coordinates) every &lt;em&gt;x&lt;/em&gt; seconds and send it to a centralized remote server. The value of the seconds, &lt;em&gt;x&lt;/em&gt;, depends on the update frequency of the robot, so it can be 60, 70, 80 or whatever seconds.&lt;/p&gt;&#xA;&lt;p&gt;In this server, I take these measurements (x, y coordinates of each robot) and generate a Kalman filter to predict next steps, since the measurements are given each &amp;quot;too much&amp;quot; time and I need these predicted positions.&lt;/p&gt;&#xA;&lt;p&gt;The Kalman filter has the equations:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;x[k] = x[k-1] + v[k-1]*dt&lt;/p&gt;&#xA;&lt;p&gt;v[k] = v[k-1]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The robots are linked by pairs, and the filter of each robot (inside a pair) is updated when a measurement arrives from any of the two robots.&lt;/p&gt;&#xA;&lt;p&gt;Here comes &lt;strong&gt;the problem&lt;/strong&gt;. The frequency of update in the filters depends on the time of the robots' measurements. For instance:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Two robots giving measurements every 10s and every 25s. The filters will be initialized at t=0s and then updated at t=10s, t=20, t=25s, t=30s, etc.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Two robots giving measurements every 3s and every 5s. The filters will be initialized at t=0s and then updated at t=3s, t=5, t=6s, t=9s, t=10s, etc.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Because of this different updating times, the filters of some pairs of robots work very well, but others do not.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The matrixes Q and R stays constant at any moment. For the Q matrix, the values where given acording to the error produced by the maximum aceleration that can be reached (the problem should be here).&lt;/p&gt;&#xA;&lt;p&gt;How can I implement a filter (a class) that works for all of the pairs independently of the updating filter times and updated measurement times? Which is the dependence between the update time of the filter and the time when a measurement arrives? I mean, how does it affect quantitatively?&#xA;Should I modify the matrixes Q, R and/or P according to the time diference?&#xA;It is an open question since I am a bit lost. Any help would be highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="17396" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-09-30T05:36:03.397" Title="Q matrix and updating times in a Kalman filter" Tags="|algorithms|kalman-filters|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25867" PostTypeId="1" CreationDate="2015-09-16T12:24:31.860" Score="3" ViewCount="2630" Body="&lt;p&gt;I am trying to find the time lag between two time series over t = [0,1000] using MATLAB (not that it matters). The first time series is simply t^2. The second is (t-15)^2 which is, of course, shifted to the right 15 units (e.g., seconds). My approach has been to find the cross correlation (computed using FFT) and then use the maximum of these to determine the appropriate time shift. For some reason, the answer I keep getting is 0, which doesn't make any sense. Can anyone tell me what I'm doing wrong? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've calculated the cross correlation using FFT as shown (all code is in MATLAB; note fft is the Fast Fourier Transform function and ifft is the inverse Fast Fourier Transform function):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = [1:1000];&#xA;a = t.^2;&#xA;b = (t-15).^2;&#xA;&#xA;if (length(a) &amp;lt; length(b))&#xA;  c = [zeros(1,length(b)-1) a zeros(1,length(b)-length(a))]; &#xA;  d = [b zeros(1,length(b)-1)]; &#xA;else &#xA;  c = [zeros(1,length(a)-1) a]; &#xA;  d = [b zeros(1,length(a)-length(b)+length(a)-1)]; &#xA;end&#xA;&#xA;c_fft = fft(c); &#xA;d_fft = fft(d);&#xA;&#xA;cross_spectral_density = c_fft.*conj(d_fft);&#xA;cross_correlations = ifft(cross_spectral_density);&#xA;&#xA;[max_xcorr shift_idx] = max(abs(cross_correlations)); &#xA;shift = shift_idx - max(length(a),length(b));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17400" LastEditorUserId="80" LastEditDate="2015-09-16T14:19:02.457" LastActivityDate="2015-11-15T16:02:51.133" Title="Find time lag between two time series" Tags="|matlab|fourier-transform|time-frequency|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25868" PostTypeId="1" AcceptedAnswerId="25870" CreationDate="2015-09-16T12:25:26.170" Score="0" ViewCount="50" Body="&lt;p&gt;I appreciate this opportunity to submit a query on this forum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When studying the continuous-time &amp;amp; discrete-time distinction, specifically with reference to discrete signals being identical when separated by 2*pi, it has struck me that a basic premise, per google calc, doesn't hold:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;exp(&lt;strong&gt;2&lt;/strong&gt; * pi * sqrt(-1)) = 1 &lt;/li&gt;&#xA;&lt;li&gt;exp(&lt;strong&gt;4&lt;/strong&gt; * pi * sqrt(-1)) = 1 &lt;/li&gt;&#xA;&lt;li&gt;exp(&lt;strong&gt;6&lt;/strong&gt; * pi * sqrt(-1)) = 1&lt;/li&gt;&#xA;&lt;li&gt;exp(&lt;strong&gt;8&lt;/strong&gt; * pi * sqrt(-1)) = 1&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;but...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;exp(&lt;strong&gt;10&lt;/strong&gt; * pi * sqrt(-1)) = 1 - 1.2246468 × 10^-15 i&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on the above (discrepancy?) would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wirefree&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17398" LastEditorUserId="80" LastEditDate="2015-09-16T14:58:06.797" LastActivityDate="2015-09-16T14:58:06.797" Title="Basic question on numerical precision" Tags="|floating-point|" AnswerCount="1" CommentCount="3" ClosedDate="2015-10-05T12:19:44.803" ContentLicense="CC BY-SA 3.0" />
  <row Id="25869" PostTypeId="1" CreationDate="2015-09-16T12:31:24.173" Score="1" ViewCount="366" Body="&lt;p&gt;I am currently working on a simulation of a virtual scene. I calculate the IR of the direct path and the early reflections and want to convolute them with the input signal. My problem now is that implementing such a software for real-time purposes would exceed my time limit I got for my work. So I need a third party C++ library (my project is written in C++) for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already tried Freeverb3 but did not get it to run using MinGW and FFTW as an additional third party software for Visual Studio. Is there any other free software besides Freeverb3 that can more easily be compiled and used than Freeverb?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I searched on this site as well as google for further software; but without success. Alternatively: Is there any way to get a convoluted input signal in real-time using convolution reverb libraries that I am not seeing? It kind of is a necessity for my project and any way possible is appreciated. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="17273" LastActivityDate="2015-09-16T12:31:24.173" Title="Is there any library for convolution reverb software for Visual Studio besides Freeverb?" Tags="|convolution|software-implementation|c++|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25870" PostTypeId="2" ParentId="25868" CreationDate="2015-09-16T12:34:26.643" Score="2" Body="&lt;p&gt;Writing another way&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1 - 1.2246468 × 10^{-15} i = 1 - 0.0000000000000012246468i$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is just rounding errors adding up due to having a limited number of bits in whatever computer is doing the calculation.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-16T12:34:26.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25871" PostTypeId="2" ParentId="25867" CreationDate="2015-09-16T14:55:40.633" Score="2" Body="&lt;p&gt;I have no good explanation for &lt;em&gt;why&lt;/em&gt; this happens, except that perhaps quadratic signals are nonstationary in that their mean is changing (or unbounded).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do something to ensure the mean is bounded (and not changing) such as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = sin(t.^2);&#xA;b = sin((t-15).^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = rem(a,100);&#xA;b = rem(b,100);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I get the right answer: 15 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what happens when I use the first:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tQviV.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tQviV.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what happens when I use the second:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tjSSN.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tjSSN.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;both modified signals generate the same (correct) estimate of delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Scilab&lt;/code&gt; code to generate it below.  I also modified your zero padding etc. because it seems overly complicated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code Only Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 25867&#xA;t = [1:1000]; &#xA;a = (t.^2); &#xA;b = ((t-15).^2);&#xA;a = a - fix(a/200)*200; &#xA;b = b - fix(b/ 200)*200;&#xA;&#xA;c = [a zeros(1,length(b) - 1)];&#xA;d = [b zeros(1,length(a) - 1)];&#xA;&#xA;mu = mean([mean(c) mean(d)])&#xA;&#xA;c_fft = fft(c - mu); &#xA;d_fft = fft(d - mu);&#xA;&#xA;cross_spectral_density = c_fft.*conj(d_fft); &#xA;cross_correlations = fftshift(ifft(cross_spectral_density));&#xA;xc = xcorr(c- mu,d- mu,length(t)-1);&#xA;&#xA;[max_xcorr shift_idx] = max(abs(cross_correlations)); &#xA;shift = shift_idx - max(length(a),length(b));&#xA;&#xA;clf;&#xA;subplot(211);&#xA;plot(a);&#xA;plot(b,'r');&#xA;subplot(212)&#xA;plot(cross_correlations);&#xA;plot(xc,'g:')&#xA;plot(shift_idx,cross_correlations(shift_idx),'r.')&#xA;xtitle('Delay is ' + string(shift))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-09-16T15:02:35.633" LastActivityDate="2015-09-16T15:02:35.633" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25872" PostTypeId="1" CreationDate="2015-09-16T15:07:47.233" Score="0" ViewCount="39" Body="&lt;p&gt;Right now I'm working on a signal processing project, I'm not quite to the point where I'm implementing the DSP algorithms yet (still working on the low level hardware) although I'd like to get an idea of what I can do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd say the goal at best is to be able to distinguish between the &lt;a href=&quot;https://youtu.be/tu2mVP6xee0?t=2m33s&quot; rel=&quot;nofollow&quot;&gt;two vocal types in this song&lt;/a&gt;.  Basically at that point of the song, you can hear the main singers vocals and then a really sporadic background vocal.  The best case scenario would be to separate those two although I'm not quite sure how.  At this point I'll be doing a fast hartley transform implementation and a periodogram implementation, are there any other algorithms I could implement to achieve this goal of distinguishing between the to vocals?&lt;/p&gt;&#xA;" OwnerUserId="10871" LastActivityDate="2015-09-16T15:07:47.233" Title="Distinguish between two vocals by their timbre" Tags="|audio|frequency-spectrum|music|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25873" PostTypeId="1" CreationDate="2015-09-16T15:13:38.580" Score="0" ViewCount="3413" Body="&lt;p&gt;In Z-Transform, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a real signal,&#xA; $x(n)$ =$x^*(n)$ . &#xA;Taking Z-transform on both sides, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(z)$=$X^*(z^*)$ ,  which gives certain pole/zero condition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;similarly for a purely imaginary signal            ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n)$ =$-x^*(n)$ , if we take Z-Transform on both sides , $X(z)$=$-X^*(z^*)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives similar pole/zero condition as that of real signal(poles and zeros are not effected by negative sign).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But  My professor says if the poles/zeros are symmetric with respect to real axis, then it is a real signal. But i am getting same condition for both real and imaginary signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me? (examples might be helpful)&lt;/p&gt;&#xA;" OwnerUserId="11809" LastActivityDate="2016-02-13T20:27:43.233" Title="pole/zero locations for real and imaginary signal" Tags="|z-transform|poles-zeros|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25874" PostTypeId="2" ParentId="25873" CreationDate="2015-09-16T16:36:47.867" Score="2" Body="&lt;p&gt;You're right, for a real-valued signal as well as for a purely imaginary signal the zeros (and poles) are symmetrical with respect to the real axis, i.e. if $z_0$ is a zero, then also $z_0^*$ is a zero. This is obvious, because you can construct a purely imaginary signal simply by multiplying a real-valued signal by the imaginary unit $j$, which won't change the pole and zero locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What your professor probably meant is that for general complex signals where neither the real part nor the imaginary part equals zero, the poles and zeros are not symmetrical anymore.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-09-16T16:36:47.867" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25875" PostTypeId="1" CreationDate="2015-09-16T17:37:07.657" Score="2" ViewCount="1175" Body="&lt;p&gt;I am working on a project where I need to implement road edge detection. This research paper suits my requirement in the best way, so I am studying it: &lt;a href=&quot;http://imagine.enpc.fr/publications/papers/TIP10a.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imagine.enpc.fr/publications/papers/TIP10a.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v1JHF.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v1JHF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;But I cannot understand the Gabor Filter equation they have used and also the set of parameter values they have used. Almost everywhere the Gabor Filter equation is different then theirs. If someone can explain, it would be great.&lt;/p&gt;&#xA;" OwnerUserId="17404" LastActivityDate="2020-12-04T17:34:49.710" Title="Understanding this Gabor Filter equation" Tags="|image-processing|matlab|fourier-transform|opencv|gabor|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25876" PostTypeId="1" CreationDate="2015-09-16T19:31:27.207" Score="2" ViewCount="1166" Body="&lt;p&gt;Please refer to the paper &lt;a href=&quot;http://home.agh.edu.pl/%7Eturcza/sr/Splitting%20the%20Unit%20Delay.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Splitting the Unit Delay - Tools for fractional delay filter design&lt;/a&gt; by Laakso, Valimaki et.al.&lt;/p&gt;&#xA;&lt;p&gt;I am not able to visualize how the fractional delay is obtained by resampling the shifted version of the impulse response of the ideal filter as described in the following para.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When the desired delay D assumes an integer value, the impulse&#xA;response Eq. 12 reduces to a single impulse at n = D, but for&#xA;noninteger values of D the impulse response is an infinitely long,&#xA;shifted and sampled version of the sinc function (Fig. 3).&#xA;Unfortunately, the ideal impulse response is not only infinitely long&#xA;but also noncausal, which makes it impossible to implement it in&#xA;real-time applications.&lt;/p&gt;&#xA;&lt;p&gt;Equation 12 gives an answer to the original problem, i.e., where the&#xA;delayed signal value should be placed as it cannot be put &amp;quot;between the&#xA;samples.&amp;quot; In the ideal case, it is to be spread over all the&#xA;discrete-time signal values, weighted by appropriate values of the&#xA;sinc function.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iINtZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iINtZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also, suppose the minimum unit delay supported by a system is D, can we derive fractional delays lesser than D with this technique or only greater than D? Does this in any way overcome system limitation w.r.t minimum tap delay resolution(splitting the unit delay as the name suggests)? Or is it  only useful for implementing fractional or irrational rate conversions within bounds of the hardware?&lt;/p&gt;&#xA;" OwnerUserId="11242" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2018-07-08T15:12:22.860" Title="Splitting the Unit Delay" Tags="|filter-design|resampling|multirate|unit-delay|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25877" PostTypeId="2" ParentId="25876" CreationDate="2015-09-16T20:16:10.927" Score="3" Body="&lt;p&gt;The ideal delay has a frequency response of:&#xA;$$&#xA;H(e^{j\omega}) = e^{-j\omega D}&#xA;$$&#xA;this has impulse response&#xA;$$&#xA;h(n) = \mbox{sinc}(n - D) = \frac{\sin(\pi(n-D)}{\pi(n-D)}.&#xA;$$&#xA;For $D$ an integer, this just becomes:&#xA;$$&#xA;h(n) = \delta(n-D)&#xA;$$&#xA;where $\delta$ is the Kronecker delta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means there is no resampling, so I am not sure where you get that from (it's not in your quoted text).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not quite sure what you are trying to achieve with your last paragraph. Can you please expand on it a bit?  It sounds like you're wanting to make a non-causal system (one that overcomes a fundamental latency in your hardware system). But perhaps I am mistaken.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-16T20:16:10.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25878" PostTypeId="2" ParentId="25876" CreationDate="2015-09-16T20:24:29.707" Score="5" Body="&lt;p&gt;For example a delay of 0.75 sampling periods would have an impulse response like this (red squares sampled from the blue delayed sinc):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yHoxl.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yHoxl.png&quot; alt=&quot;Sinc delayed by 0.75 sampling periods&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time (horizontal axis) unit is sampling periods. That kind of a filter is not causal as there are non-zero samples at negative times. None of the samples is zero, no matter how far left or right you go. That's what they meant by spreading all over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About your second question, I have no access to the paper but I know that such all-pass fractional delay filters can be made arbitrarily good (approaching sinc), and the latency increases as you increase filter order. If you want very short latency, you then will also have a very low-order filter, which is of very poor quality as it is completely missing the left side of the sinc. It is a tradeoff between quality and latency, and you probably don't want to trade away all quality.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-09-16T20:24:29.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25880" PostTypeId="1" CreationDate="2015-09-16T22:29:36.077" Score="3" ViewCount="6755" Body="&lt;p&gt;I mean &lt;strong&gt;not&lt;/strong&gt; the time-domain signal being periodic, but the Fourier transform being periodic. &lt;/p&gt;&#xA;" OwnerUserId="17408" LastEditorUserId="80" LastEditDate="2015-09-17T12:17:12.603" LastActivityDate="2015-09-19T19:08:42.513" Title="When is the Fourier transform of a signal periodic?" Tags="|fourier-transform|fourier|fourier-series|" AnswerCount="6" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25881" PostTypeId="2" ParentId="25880" CreationDate="2015-09-16T22:47:29.227" Score="0" Body="&lt;p&gt;The &lt;em&gt;Discrete&lt;/em&gt; Fourier Transform is always periodic, but we usually focus only on what's inside the Nyquist window and ignore the periodic copies outside.  The regular Fourier Transform (function of continuous frequency) cannot be periodic, to my knowledge.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-09-16T22:47:29.227" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25882" PostTypeId="2" ParentId="25880" CreationDate="2015-09-16T22:48:55.520" Score="2" Body="&lt;p&gt;When you sample an analog signal to get a discrete-time signal with sampling frequency $f_s$, the spectrum of the latter will be periodic. To be more precise, the spectrum of your analog signal will be shifted by $n\cdot f_s$, for every integer $n$ and the sum of these shifted versions is the spectrum of the discrete-time signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason you need to have a sampling frequency high enough is to avoid overlapping between the shifted spectrum parts, thus cancelling the opportunity to recreate the original analog signal. Generally, if you choose an $f_s$ higher than twice the signal bandwidth, you are always good to go, but in some cases a lower sampling frequency might be sufficient as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/D9ny7.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/D9ny7.gif&quot; alt=&quot;source: http://flylib.com/books/2/729/1/html/2/images/0131089897/graphics/02fig04.gif&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;http://flylib.com/books/2/729/1/html/2/images/0131089897/graphics/02fig04.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;image source&lt;/a&gt;: R. G. Lyons: Understanding Digital Signal Processing (2nd Edition))&lt;/p&gt;&#xA;" OwnerUserId="16692" LastEditorUserId="16692" LastEditDate="2015-09-19T19:08:42.513" LastActivityDate="2015-09-19T19:08:42.513" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25883" PostTypeId="1" AcceptedAnswerId="25914" CreationDate="2015-09-17T07:56:39.207" Score="0" ViewCount="626" Body="&lt;p&gt;Suppose we have measured the frequency response of a system that is known to be all-pole; measuring impulse response is not possible. What are the methods available, if any, to estimate the coefficients of the underlying IIR filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Frequency response exists only as measured data, so closed mathematical expression is not available, nor is the phase information. &lt;/p&gt;&#xA;" OwnerUserId="17412" LastEditorUserId="17412" LastEditDate="2015-09-18T04:29:43.013" LastActivityDate="2015-09-18T13:41:18.457" Title="How to estimate filter coefficients of an all-pole system?" Tags="|filters|estimation|infinite-impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25885" PostTypeId="1" AcceptedAnswerId="25886" CreationDate="2015-09-17T10:43:01.007" Score="2" ViewCount="180" Body="&lt;p&gt;&lt;a href=&quot;http://www4.ncsu.edu/~wes/CSSSlides.pdf&quot; rel=&quot;nofollow&quot;&gt;PDF is here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read this PDF. But i don't know what the Invariance means in page 3 and 5. Calculation/estimation of κ is NOT invariant and Invariant to viewpoint. What's the meaning of these sayings? When i read &quot;Invariant to viewpoint&quot;, i think it means the k value is same when rotation and translation. But after i read &quot;Calculation/estimation of κ is NOT invariant&quot; ,i have no idea. Then i try the code what i got here,to caculate the k value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/royshil/CurveMatching&quot; rel=&quot;nofollow&quot;&gt;Code is here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And i have found that, the k value is different when shape have rotated which have the same sigma. Then i changed the sigma, k value is also different while the shape is same. When i set the sigma as 0.6667, the curvature of straight line is 1.6 not 0, why? The curvature of straight line should be zero,right? I don't why the value is 1.6. Then I tried to rotate the straight line, the curvature changed!!new value is -6.6. The papge said to find zero crossing to get concave-convex. But here curvature of straight line is not 0 is 1.6? Can somebody help me. Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="17413" LastActivityDate="2015-09-17T13:18:15.387" Title="Invariance of curvature in Curvature Scale Space" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25886" PostTypeId="2" ParentId="25885" CreationDate="2015-09-17T13:18:15.387" Score="2" Body="&lt;p&gt;OK, so let's look at the curvature of some standard objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, a circle:&#xA;$$&#xA;x(s) = \cos(s)\ ;\ \dot{x}(s) = -\sin(s)\ ;\ \ddot{x}(s) = -\cos(s)\\&#xA;y(s) = \sin(s)\ ;\ \dot{y}(s) = \cos(s)\ ;\ \ddot{y}(s) = -\sin(s)\\&#xA;$$&#xA;so the curvature is:&#xA;$$&#xA;\kappa(s) = \frac{\sin(s)\sin(s) + \cos(s)\cos(s)}{(\sin^2(s) + \cos^2(s))^{3/2}} = 1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rotating the circle gives:&#xA;$$&#xA;x'(s) = \cos(\theta) x(s) - \sin(\theta) y(s)\\&#xA;y'(s) = \sin(\theta) x(s) + \cos(\theta) y(s)\\&#xA;$$&#xA;so that&#xA;$$&#xA;\dot{x}'(s) = -\cos(\theta)\sin(s) -\sin(\theta)\cos(s) = -\sin(\theta + s)\\ \ddot{x}'(s) = -\cos(\theta)\cos(s) +\sin(\theta)\sin(s) = -\cos(\theta + s)\\&#xA;\dot{y}'(s) = \sin(\theta)\sin(s) +\cos(\theta)\cos(s) = \cos(\theta - s)\\ &#xA;\ddot{y}'(s) = \sin(\theta)\cos(s) - \cos(\theta)\sin(s) = \sin(\theta - s)\\&#xA;$$&#xA;Even thought it looks like I got a sign wrong somewhere, this will also evaluate to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, at least for a circle, the formula is rotationally invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trouble comes when you try to implement this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [kappa,xdot,ydot,xdotdot,ydotdot] = curvature(x,y,delta_s)&#xA;    xdot = diff([x x([1 2])])/delta_s;&#xA;    xdotdot = diff([xdot])/delta_s;&#xA;    ydot = diff([y y([1 2])])/delta_s;&#xA;    ydotdot = diff([ydot])/delta_s;&#xA;&#xA;    xdot = xdot(1:length(xdot)-1);&#xA;    ydot = ydot(1:length(ydot)-1);&#xA;&#xA;    kappa = (xdot.*ydotdot - xdotdot.*ydot)./sqrt(xdot.^2 + ydot.^2 + 10^9).^3;&#xA;&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only way to get the &quot;derivatives&quot; of your parameterized curves will be to take differences.  For the circle, this isn't too bad, but for more complex shapes, rotations might make these values a little different --- especially if the shapes are generated from two different sets of measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the plot below shows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The original curvature (note problem at end of range)&lt;/li&gt;&#xA;&lt;li&gt;The curvature of a circle rotated&lt;/li&gt;&#xA;&lt;li&gt;The curvature of a noisy circle&lt;/li&gt;&#xA;&lt;li&gt;The curvature of a rotated noisy circle&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZsQtH.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZsQtH.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// 25885&#xA;delta_s = .01;&#xA;s = -%pi:delta_s:(%pi-delta_s);&#xA;N = length(s);&#xA;&#xA;x = cos(s);&#xA;y = sin(s);&#xA;&#xA;xn = cos(s) + 0.001*rand(1,N,'norm');&#xA;yn = sin(s) + 0.001*rand(1,N,'norm');&#xA;&#xA;[k,xd,xdd,yd,ydd] = curvature(x,y,delta_s);&#xA;[kn,xdn,xddn,ydn,yddn] = curvature(xn,yn,delta_s);&#xA;&#xA;theta = %pi/4;&#xA;rot = [cos(theta), -sin(theta); sin(theta) cos(theta)];&#xA;&#xA;all = rot*[x;y];&#xA;xdash = all(1,:);&#xA;ydash = all(2,:);&#xA;&#xA;alln = rot*[xn;yn];&#xA;xdashn = alln(1,:);&#xA;ydashn = alln(2,:);&#xA;&#xA;[k2,xd2,xdd2,yd2,ydd2] = curvature(xdash,ydash,delta_s);&#xA;[k2n,xd2n,xdd2n,yd2n,ydd2n] = curvature(xdashn,ydashn,delta_s);&#xA;&#xA;clf&#xA;subplot(221)&#xA;plot(s,k)&#xA;title('Curvature of a noiseless circle')&#xA;subplot(222)&#xA;plot(s,k2)&#xA;title('Curvature of a ROTATED noiseless circle')&#xA;subplot(223)&#xA;plot(s,kn)&#xA;title('Curvature of a NOISY circle')&#xA;subplot(224)&#xA;plot(s,k2n)&#xA;title('Curvature of a ROTATED NOISY circle')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-17T13:18:15.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25887" PostTypeId="1" AcceptedAnswerId="25890" CreationDate="2015-09-17T14:37:49.167" Score="-1" ViewCount="11972" Body="&lt;p&gt;Can someone help me understand how did we get from the second line to the third one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;u(t-1)*u(t) &amp;amp;= \int_{-\infty}^{\infty}u(\tau-1)u(t-\tau)d\tau \\&#xA;&amp;amp;=\int_{1}^{t}u(t-\tau)d\tau \\&#xA;&amp;amp;=(t-1)u(t-1)&#xA;\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="13405" LastEditorUserId="8202" LastEditDate="2015-09-17T16:11:07.347" LastActivityDate="2015-09-17T16:37:41.967" Title="Integral of unit step function" Tags="|theory|" AnswerCount="1" CommentCount="2" ClosedDate="2015-09-17T20:22:06.700" ContentLicense="CC BY-SA 3.0" />
  <row Id="25889" PostTypeId="1" AcceptedAnswerId="25892" CreationDate="2015-09-17T16:11:01.703" Score="7" ViewCount="7326" Body="&lt;p&gt;When applying Gaussian filters close to the borders of an image, algorithms usually zero-pad or replicate/mirror/wrap the borders. This is not good enough for my case, so I wonder if there is something better out there.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the idea of smoothing is to absorb the information of surrounding points, I wonder if it would make sense to use a different kernel in the border cases. This kernel would only take values from available surrounding points, e.g. if my kernel is something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{bmatrix}&#xA;    0.0113 &amp;amp; 0.0838 &amp;amp; 0.0113 \\&#xA;    0.0838 &amp;amp; 0.6193 &amp;amp; 0.0838 \\&#xA;    0.0113 &amp;amp; 0.0838 &amp;amp; 0.0113&#xA;\end{bmatrix}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate a pixel on the top margin (but not close to the corner), I would use&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{bmatrix}&#xA;    0.0938 &amp;amp; 0.6933 &amp;amp; 0.0938 \\&#xA;    0.0126 &amp;amp; 0.0938 &amp;amp; 0.0126&#xA;\end{bmatrix}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The latter matrix was calculated by cropping out the part of the kernel that would be out of the image (the top row) and renormalizing. Is there something wrong with this approach, or an alternative?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some code to explain my idea better:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;kernel = [0.0113 0.0838 0.0113; 0.0838 0.6193 0.0838; 0.0113 0.0838 0.0113]&#xA;kernel2 = [0.0938 0.6933 0.0938; 0.0126 0.0938 0.0126];&#xA;M = [1 2 3; 4 5 6]; % my image&#xA;&#xA;% application of kernel to point 2 in M would provide the value:&#xA;res1 = sum(sum( kernel(2:3,:).*M )); % 0 padding, equals 2.1058&#xA;res2 = sum(sum( kernel.*[1 2 3; M] )); % row replication, equals 2.3186&#xA;&#xA;% application of kernel2 to the same point:&#xA;res3 = sum(sum( kernel2 .* M )); % equals 2.3568&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that in using &lt;code&gt;kernel2&lt;/code&gt; I don't extrapolate a row of &lt;code&gt;[0 0 0]&lt;/code&gt; or &lt;code&gt;[1 2 3]&lt;/code&gt;, which would underestimate the point.     &lt;/p&gt;&#xA;" OwnerUserId="17416" LastEditorUserId="128" LastEditDate="2019-03-15T13:27:56.557" LastActivityDate="2019-03-15T13:27:56.557" Title="Gaussian Filter Close to Image Border" Tags="|image-processing|convolution|gaussian|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="25890" PostTypeId="2" ParentId="25887" CreationDate="2015-09-17T16:37:41.967" Score="3" Body="&lt;p&gt;The integration variable is $\tau$ and the integration limits are determined by the range of $\tau$ over which both step functions under the integral are non-zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first step functions that's $\tau &amp;gt; 1$ and for the second one it's $\tau &amp;lt; t$ . This determines the integration interval. Within this interval the function to integrate is simply 1, i.e.  $u(t- \tau) = 1$ for $ \tau &amp;lt; t$ . Integral from a to b over one is simply a-b.  &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-09-17T16:37:41.967" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25891" PostTypeId="2" ParentId="25880" CreationDate="2015-09-17T17:11:07.087" Score="0" Body="&lt;p&gt;when the time-domain signal being Fourier Transformed is uniformly sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the continuous Fourier Transform of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) \sum\limits_{n=-\infty}^{+\infty} \delta\left(t - \frac{n}{f_\text{s}}\right) = \sum\limits_{n=-\infty}^{+\infty} x\left(\frac{n}{f_\text{s}}\right) \delta\left(t - \frac{n}{f_\text{s}}\right) = \sum\limits_{n=-\infty}^{+\infty} x[n] \delta\left(t - \frac{n}{f_\text{s}}\right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f_\text{s} \sum\limits_{k=-\infty}^{+\infty} X\left(f - k \, f_\text{s}  \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is periodic with period $f_\text{s}$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-09-17T17:11:07.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25892" PostTypeId="2" ParentId="25889" CreationDate="2015-09-17T18:41:25.973" Score="3" Body="&lt;p&gt;Pixels outside the image borders must be extrapolated.&lt;br&gt;&#xA;Now, you need to chose the model of your extrapolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if you're working within the Discrete Fourier model a periodic extrapolation is the native choice.&lt;br&gt;&#xA;Usually the most &quot;Eye Friendly&quot; solution is replication based on &quot;Nearest Neighbor&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your choice is as valid as any choice, you just need to figure which model it satisfies and if that model suits you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet it has 1 noticeable caveat, it makes your kernel Spatially Variant, which means, without a caring treatment it will hurt performance.&lt;br&gt;&#xA;The right thing to do is isolate the pixels which should be carefully treated because of the boundary condition and work very efficiently on the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tim Holy talks about it in the video &lt;a href=&quot;https://www.youtube.com/watch?v=FA-1B_amwt8&quot; rel=&quot;noreferrer&quot;&gt;Image Representation and Analysis&lt;/a&gt; (Go to 42:30).&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-09-17T18:41:25.973" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25893" PostTypeId="1" CreationDate="2015-09-17T19:10:41.100" Score="1" ViewCount="477" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/laOtm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/laOtm.png&quot; alt=&quot;The image displays techniques for construction of complex envelopes from bandpass signals and vice versa.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what little I've been able to gather, the complex envelope preserves all information required for the reconstruction of the original signal and that it basically sends a low pass version of a bandpass signal.(Correct me if I'm wrong).I need an explanation for how the complex envelope is being created as per this text book? And also of how the original signal is obtained at the end?&lt;/p&gt;&#xA;" OwnerUserId="17417" LastEditorUserId="11256" LastEditDate="2015-09-17T23:39:57.010" LastActivityDate="2015-09-19T11:58:30.190" Title="Reconstruction of BandPass Signal from Complex Envelope" Tags="|modulation|bandpass|quadrature|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25895" PostTypeId="2" ParentId="25875" CreationDate="2015-09-17T20:22:13.490" Score="2" Body="&lt;p&gt;I will describe the rationale behind the &quot;non-standard&quot; terms, with respect to more classical expressions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentialy, the &lt;span class=&quot;math-container&quot;&gt;$\omega e^{-\omega^2 }$&lt;/span&gt; term indicates a derivative of a Gaussian (with 0 average), similar to an antisymmetric wavelet, instead of the modulated Gaussian window in standard Gabor filters: a wavelet filter bank, versus a modulated filter banks. This wavelet &quot;smoothed derivative&quot; aspect might help detect edges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the &lt;span class=&quot;math-container&quot;&gt;$4a^2+b^2$&lt;/span&gt; induces an elliptic shape constraining anisotropy in the 2D wavelet, with a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-fold factor ratio.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last, the &lt;span class=&quot;math-container&quot;&gt;$e^{-c^2/2}$&lt;/span&gt; might serve an admissibility condition for this Morlet-Gabor like wavelet, to ensure easier inversion/reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is truly multiscale, as they specify they have 5 dyadic scales.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2020-04-13T13:21:04.220" LastActivityDate="2020-04-13T13:21:04.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25896" PostTypeId="1" AcceptedAnswerId="25915" CreationDate="2015-09-17T21:03:52.570" Score="1" ViewCount="226" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function#Higher-order_generalized_cosine_windows&quot; rel=&quot;nofollow&quot;&gt;Higher-order generalized cosine windows&lt;/a&gt; define a useful parametric family of windows functions, embedding Hamming, Hann, Blackman, Nutall, etc.:&#xA;$$w(n) = \sum_{k = 0}^{K} a_k\; \cos\left( \frac{2 \pi k n}{N} \right)$$&#xA;Are there non-separable 2D similar forms, i.e. not a tensor product of the 1D form, usable on the standard rectangular lattice (excluding designs such as in &lt;a href=&quot;http://dx.doi.org/10.1109/ICASSP.1996.547762&quot; rel=&quot;nofollow&quot;&gt;Multidimensional windows over arbitrary lattices and their application to FIR filter design&lt;/a&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-09-19T09:06:37.120" Title="Non-separable, higher-order generalized cosine windows in 2D for images" Tags="|window-functions|window|parametric-eq|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25897" PostTypeId="2" ParentId="25880" CreationDate="2015-09-17T21:07:54.347" Score="4" Body="&lt;p&gt;I'm new to this exchange and I'm not sure how mathy you all get. I think the answer below is cool because it shows that in some sense the continuous-time Fourier transform is never periodic but that in another sense there are lots of ways to get periodic transforms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the continuous-time Fourier transform on $\mathbb{R}$, both CMDoolittle's and Robert Bristow-Johnson's answers are correct, though for slightly-different definitions of &quot;Fourier Transform&quot;. In the usual way we talk about the continuous Fourier transform, transforms are never periodic. If we're willing to transform distributions (of which the Dirac delta is an example), we can have transforms which are periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, the theory of the continuous Fourier transform is developed on $L^2(\mathbb{R})$. The Fourier transform is a bijection of $L^2(\mathbb{R})$ back onto itself; this means that $L^2(\mathbb{R})$ is also the space of all possible Fourier transforms. However, the zero function is the only periodic function in $L^2(\mathbb{R})$, so we can conclude that continuous Fourier transforms of non-zero functions are never periodic. This is CMDoolittle's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we also have a Fourier theory for distributions. Specifically, we define &lt;em&gt;distributions&lt;/em&gt; to be the set of linear functionals on the space of so-called &lt;em&gt;test functions&lt;/em&gt;. Test functions, in turn, are $C^\infty$ functions which are required to decay rapidly (alternately, sometimes test functions are $C^\infty$ functions with compact support). Some of these distributions can be identified with periodic functions on $\mathbb{R}$. For example, if $f$ is a test function then the mapping &#xA;$$ S : f \mapsto \int_{-\infty}^\infty \sin(t) f(t)\ dt$$&#xA;is a distribution which can be identified with the sine function. As we can define the Fourier transform of a distribution, so we have a way of defining the Fourier transform of periodic functions. As it turns out, the Fourier transform is also a bijection of the space of distributions back onto itself. Going back to the distribution $S$, this means that we can write $S$ as the Fourier transform of some other distribution $T$: $S = \hat{T}$; in other words, we conclude that there has to be a distribution $T$ whose transform is the distribution $S$ which is identified with the periodic function sine. Clearly, we could pull this same trick with, say, any bounded periodic function. Ultimately then, we can extend Robert Bristow-Johnson's answer: if we're talking about the Fourier transform of distributions, there are lots of distributions whose Fourier tranforms are periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a discussion of the Fourier theory of distributions, see Chapter 7 of Rudin's &lt;em&gt;Functional Analysis&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="17325" LastActivityDate="2015-09-17T21:07:54.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25898" PostTypeId="2" ParentId="25845" CreationDate="2015-09-17T21:10:12.140" Score="6" Body="&lt;p&gt;Great answers already, but I wanted to add that converting a signal to its analytic version is easy in the digital domain (the half band filter required has half of its coefficients equal to zero), but once there, the sample rate can be cut in half, essentially splitting the processing into real and imaginary paths.  Obviously, there is a cost here, and some cross terms need to be handled, but generally it is helpful in hardware implementations when clock rate is a factor.&lt;/p&gt;&#xA;" OwnerUserId="14765" LastActivityDate="2015-09-17T21:10:12.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25900" PostTypeId="2" ParentId="25880" CreationDate="2015-09-18T02:03:01.003" Score="0" Body="&lt;p&gt;The effect of delaying a signal means that the Fourier transform gets multiplied by $e^{-Ts}$, which when using Euler's identity can be split up into a real valued cosine and a complex valued sine function, which are periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal whose Fourier transform is constant is the Dirac's delta function. You can combine multiple of such functions and still have a periodic Fourier transform, however the delays have to be integer multiples of each other, such that each they have a common period. This can be seen as constructing a Fourier series in the Fourier domain. And a Fourier series can represent any bounded periodic function. Thus any function, whose Fourier transform is periodic and bounded, has to be of this form.&lt;/p&gt;&#xA;" OwnerUserId="7579" LastActivityDate="2015-09-18T02:03:01.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25902" PostTypeId="1" AcceptedAnswerId="25912" CreationDate="2015-09-18T05:32:40.713" Score="1" ViewCount="128" Body="&lt;p&gt;We recently performed a work on signal filtering/component separation (sparse signal/trend/noise). The cost function contains:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A quadratic data fidelity term,&lt;/li&gt;&#xA;&lt;li&gt;Some smoothed $\ell_1$ terms for sparsity and positivity promotion.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This was initially designed for Gaussian noise, and performed satisfactorily. Reviewers asked to test the algorithm on the same signals with Poisson noise, and it performed well also. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many works concerned with Poisson-Gaussian noise mixtures, authors usually use more involved penalty functions and/or use variance stabilization transforms (such as Anscombe's).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presenting the work to different signal processing folks, several colleagues (signal and image persons equally) said they were &quot;not surprised&quot; that a simple quadratic term would work well with Poisson noise too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I am less a theoretician than a frequentist, and a bayesian (much) less than a frequentist, I do not understand the reason behind the relatively good behavior with both Gaussian and Poisson perturbations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;May a reader offer practical or theorical hints behind this &quot;non surprise&quot;?&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="80" LastEditDate="2015-09-18T14:21:12.173" LastActivityDate="2015-09-18T14:45:52.050" Title="Filtering performance on Poisson noise with quadratic data-fidelity" Tags="|noise|filtering|optimization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25904" PostTypeId="2" ParentId="25320" CreationDate="2015-09-18T08:42:06.863" Score="0" Body="&lt;p&gt;ok, so i didn't check the exacte numbers, because it seems that your filter w2 was different coefficients than w1. But imagine if w2 were to be exactly as w1 but with alternating signs, so w2 = -1^n*w1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have here is that, if w1 is a lowpass filter (the easy example), then w2 is the equivalent highpass filter, because when you take the Z transform, the -1^n transforms to multiplying the Z^-n in the equation to e^pi, which would shift the frequency response by pi, so what was low frequencies, now is high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have time know to do all the math in detail but hopefully it is understandable.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2015-09-18T08:42:06.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25906" PostTypeId="2" ParentId="25875" CreationDate="2015-09-18T10:26:06.907" Score="2" Body="&lt;p&gt;Indeed, the formula looks scary at first sight but is very intuitive. The basic idea is to design a filter that has the following properties:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it is localized, meaning that it's envelope has a specific size (or scale in the terminology of wavelets) and responds optimally to certain orientations - while controlling the sensitivity of the measure.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Remember  from the Heisenberg  principle that you cannot be infinitely be good at the same time to localization and to frequency estimation...&lt;/p&gt;&#xA;&lt;p&gt;Dually, you can think of it as :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it is localized in the 2D Fourier plane, meaning that it has a preferred orientation and spatial frequency and a corresponding bandwidth along these axis&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The formula above does this by multiplying the different components independently. Note that it's spitting out complex number such that you can consider symmetric and anti-symmetric features.&lt;/p&gt;&#xA;&lt;p&gt;Shameless plug: I have contributed to a library which implements such filters but with a few differences to better fit what is supposed to happen in the visual system:&#xA;&lt;a href=&quot;https://github.com/bicv/LogGabor/blob/master/LogGabor.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/bicv/LogGabor/blob/master/LogGabor.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ru8BN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ru8BN.png&quot; alt=&quot;log Gabor filter bank&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The page gives several examples of filters and filtered images.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastEditorUserId="1085" LastEditDate="2020-12-04T17:34:49.710" LastActivityDate="2020-12-04T17:34:49.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25907" PostTypeId="1" AcceptedAnswerId="25918" CreationDate="2015-09-18T10:36:43.880" Score="2" ViewCount="692" Body="&lt;p&gt;I have read the paper &quot;Shape similarity retrieval under affine transforms&quot;, and use c++ to implement it.The step as follow;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Calculate the first and second Gaussian Derivatives&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/B8Ucb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B8Ucb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Convolving each coordinate of the curve with a Gaussian function,and calculate the first and second Derivatives of x,y&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J1Kxb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J1Kxb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Compute curvature of the curve  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/83Hgy.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/83Hgy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper main method as follow&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v2DFr.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v2DFr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question:I compute the curvature of a rectangle as sigma is 0.66667. But the result what i got is strange. The curvature of four lines of rectangle are different and not zero? The curvature are 1.9, -6.3, -5.6, 1.5. Then, i roatate rectangle,the curvature of every point is different. Why? Can somebody help me ?Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="17413" LastActivityDate="2017-04-27T14:13:19.797" Title="Why the curvature of straight line in curvature scale space is not zero?" Tags="|image-processing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25908" PostTypeId="2" ParentId="25889" CreationDate="2015-09-18T10:42:17.157" Score="1" Body="&lt;p&gt;I don't like very much the idea of cropping the kernel and renormalizing it, as it will artificially emphasize pixels that needn't be (the weights increase &lt;em&gt;globally&lt;/em&gt; as the ratio of the normalization constants).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd prefer to extrapolate the values with a rule that has &quot;physical soundness&quot; and apply the full kernel. If the extrapolation rule is linear, you can indeed recompute a kernel that incorporates the interpolation rule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give a trivial example, assume the binomial kernel $\frac14\frac24\frac14$ over pixels a b c.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the pixel a is missing, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;cropping and renormalizing gives $\frac23\frac13$;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;simple extrapolation by pixel replication (the missing pixel is assumed b) is equivalent to $\frac34\frac14$;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;mirroring (c assumed) gives $\frac24\frac24$;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;linear extrapolation (2b-c assumed) gives $\frac44\frac04$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-09-18T10:49:20.210" LastActivityDate="2015-09-18T10:49:20.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25909" PostTypeId="1" CreationDate="2015-09-18T10:45:41.293" Score="0" ViewCount="865" Body="&lt;p&gt;I need to do FFT on an audio file(to be exact it is a real number array of audio samples). But the output of FFT should be complex numbers. I have a hard time understanding how to convert this.&#xA;For example: input is int input[N], and what to do next to get the output.re[] and output.imp[]? Should I treat input as a complex array only all the imaginary components equal to 0?&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="17426" LastActivityDate="2015-09-18T11:46:11.350" Title="Fast fourier transform for an audio file" Tags="|fft|fourier-transform|digital-communications|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25910" PostTypeId="2" ParentId="25909" CreationDate="2015-09-18T11:46:11.350" Score="1" Body="&lt;p&gt;Your question is so &quot;basic&quot;, so &quot;fundamental&quot;, that I may be misunderstanding its true meaning. In any case, hopefully you have some software routine available to you that performs FFTs and will accept your 'int input[N]' sequence as an input. I have no idea what software 'package', or software language, you're using but if variable 'x' is your input sequence then there should be some available command (or subroutine) like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Spec = fft(x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you can use to compute your FFT spectral results. And there should be no need for you be concerned about defining your input sequence as complex-valued. Of course the length of your input sequence (number of samples) must be an integer power of two. Your FFT results will automatically be in the form of a sequence of complex numbers, so there's no need to worry about that.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-18T11:46:11.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25911" PostTypeId="2" ParentId="25320" CreationDate="2015-09-18T13:09:11.963" Score="2" Body="&lt;p&gt;If you multiply the coefficients of a lowpass FIR filter by the sequence 1,-1,1,-1,1,-1, ..., (-1)^n, you end up with the coefficients of a highpass FIR filter. To demonstrate this, multiply your first set of coefficients by (-1)^n and compute the freq response of the new coefficient sequence. [‘n’ is a sequence of integers starting with zero.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, that is not the case with your two sets of coefficients. Both of your coefficient sequences produce lowpass filters.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-18T13:09:11.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25912" PostTypeId="2" ParentId="25902" CreationDate="2015-09-18T13:19:17.137" Score="3" Body="&lt;p&gt;For large intensities / large &quot;bins&quot;, i.e. &quot;areas for which events are counted and accumulated&quot;, Poisson processes lead to nearly Gaussian distributed individual values -- basically, without trying to derive this, I think that's  the application of the CLT on a lot of realization of a point process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: Shameless plug: I really really like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Relationships_among_probability_distributions&quot; rel=&quot;nofollow&quot;&gt;wikipedia page on &quot;Relationships among probability distributions&lt;/a&gt;; notice the arrow between the Poisson and the normal distribution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Relationships_among_probability_distributions&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Relationships_among_some_of_univariate_probability_distributions.jpg/1024px-Relationships_among_some_of_univariate_probability_distributions.jpg&quot; alt=&quot;Relationships among some univariate probability distributions&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2015-09-18T14:45:52.050" LastActivityDate="2015-09-18T14:45:52.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25913" PostTypeId="2" ParentId="25880" CreationDate="2015-09-18T13:31:31.673" Score="3" Body="&lt;p&gt;The question &quot;When is the Fourier Transform of a signal periodic?&quot; is best considered using the notion of &lt;em&gt;duality&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A (finite-power) &lt;em&gt;periodic&lt;/em&gt; time-domain signal $x(t)$ of period $T_0$&#xA;is uniquely represented in the frequency domain by its Fourier &lt;em&gt;series&lt;/em&gt;. We have that&#xA;$$x(t) = \sum_{n=-\infty}^\infty X_n \exp\left(&#xA;\frac{j2\pi n t}{T_0}\right)\tag{1}$$ &#xA;In the context of Fourier Transforms, the Fourier transform of $x(t)$&#xA;is &#xA;$$X(f) = \sum_{n=-\infty}^\infty X_n \delta\left(f - \frac{n}{T_0}\right)\tag{2}$$&#xA;which is a &lt;em&gt;sequence of impulses&lt;/em&gt; &lt;strong&gt;that are at multiples&#xA;of $\frac{1}{T_0}$ Hz&lt;/strong&gt; in the frequency domain. Note that mere &#xA;spacing $\frac 1T$ Hz apart (e.g. at $f=\sqrt{2}+ 100n$ Hz which&#xA;are spaced $100$ Hz apart) will not do; the impulses &lt;em&gt;must&lt;/em&gt; occur&#xA;at multiples of the spacing.  Applying the inverse Fourier Transform&#xA;integral to $(2)$, the &lt;em&gt;sifting&lt;/em&gt; property of impulses gives us that&#xA;\begin{align}&#xA;\int_{-\infty}^\infty X(f)\exp(j2\pi tf)\,\mathrm df&#xA;&amp;amp;= \int_{-\infty}^\infty &#xA;\sum_{n=-\infty}^\infty X_n \delta\left(f - \frac{n}{T_0}\right)&#xA;\exp(j2\pi tf)\,\mathrm df\\&#xA;&amp;amp;= \sum_{n=-\infty}^\infty X_n \int_{-\infty}^\infty &#xA;\delta\left(f - \frac{n}{T_0}\right)&#xA;\exp(j2\pi tf)\,\mathrm df\\&#xA;&amp;amp;= \sum_{n=-\infty}^\infty X_n \exp\left(&#xA;\frac{j2\pi n t}{T_0}\right)\\&#xA;&amp;amp;= x(t).&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;em&gt;duality&lt;/em&gt; tells us that what is sauce for the goose is&#xA;sauce for the gander and that one man's Mede is another man's&#xA;Persian and so&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A signal whose Fourier transform is periodic with period&#xA;  $f_0$ is represented in the time domain by a &lt;em&gt;sequence of&#xA;  impulses&lt;/em&gt; that occur at &lt;em&gt;multiples&lt;/em&gt; of $\frac{1}{f_0}$ seconds,&#xA;  that is,&#xA;  $$x(t) = \sum_{n=-\infty}^\infty x_n &#xA;\delta\left(t - \frac{n}{f_0}\right)$$&#xA;  and &#xA;  \begin{align}&#xA;X(f) &amp;amp;= \int_{-\infty}^\infty x(t) \exp(-j2\pi ft)\,\mathrm dt\\&#xA;&amp;amp;= \int_{-\infty}^\infty \sum_{n=-\infty}^\infty x_n &#xA;\delta\left(t - \frac{n}{f_0}\right) \exp(-j2\pi ft)\,\mathrm dt\\&#xA;&amp;amp;= \sum_{n=-\infty}^\infty x_n \int_{-\infty}^\infty  &#xA;\delta\left(t - \frac{n}{f_0}\right) \exp(-j2\pi ft)\,\mathrm dt\\&#xA;&amp;amp;= \sum_{n=-\infty}^\infty x_n \exp\left(-\frac{j2\pi nf}{f_0}\right).&#xA;\tag{3}&#xA;\end{align}&#xA;  As a &lt;em&gt;function of $f$&lt;/em&gt;, $\exp\left(-\frac{j2\pi nf}{f_0}\right)$ &#xA;  has period $\frac{n}{f_0}$, that is, a &lt;em&gt;multiple&lt;/em&gt; of $\frac{1}{f_0}$&#xA;  and so  $(3)$ is indeed a periodic function of period $\frac{1}{f_0}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-09-18T13:31:31.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25914" PostTypeId="2" ParentId="25883" CreationDate="2015-09-18T13:41:18.457" Score="2" Body="&lt;p&gt;Half of the information about a system is in the phase response, and half of it in the amplitude response. There's no way to reconstruct a filter if you know only either half, unless you strongly restrict the poles mathematically.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-09-18T13:41:18.457" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25915" PostTypeId="2" ParentId="25896" CreationDate="2015-09-18T14:33:01.103" Score="3" Body="&lt;p&gt;The form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w(x, y) = \sum_{j = -K}^{K}\sum_{k = -K}^{K} a_{|j|,|k|}\; \cos(\pi jx + \pi ky),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_{j,k} = a_{k,j},\\&#xA;\sum_{j = -K}^{K}\sum_{k = -K}^{K} a_{|j|,|k|} = 1,\\&#xA;x \in -1..1,\\&#xA;y \in -1..1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;yields window functions that are 2D similar. Window functions of that form are not generally separable, but some of them are, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w(x, y) = \frac{\cos(\pi x - \pi y)}{8} + \frac{\cos(\pi x + \pi y)}{8} + \frac{\cos(\pi x)}{4} + \frac{\cos(\pi y)}{4} + \frac{1}{4}\\&#xA;= \left(\frac{\cos\left(\pi x\right)}{2} + \frac{1}{2}\right)\left(\frac{\cos\left(\pi y\right)}{2} + \frac{1}{2}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yauAa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yauAa.png&quot; alt=&quot;Separable window function&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this window function, if the balance between the zero-frequency term and the higher terms is altered (as in going from Hann to Hamming), separability breaks.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-09-19T09:06:37.120" LastActivityDate="2015-09-19T09:06:37.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25916" PostTypeId="2" ParentId="23621" CreationDate="2015-09-18T14:44:30.323" Score="1" Body="&lt;p&gt;If you have enough sample measurement data, you could reconstruct a time series for each sensor pair that eliminates any time step where either one or both of the sensor pairs are &lt;em&gt;na&lt;/em&gt;.  Then you are left with a time series for that pair without any &lt;em&gt;na&lt;/em&gt;'s and can proceed with standard time series approaches for calculating correlation.  Then repeat those steps for each sensor pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X_1 = [2, 5, 1, na, na, 1, na, na, 89]&#xA;X_2 = [na, 4, 9, 8, na, na, na, 2, 9]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;after reconstruction becomes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X_1 = [5, 1, 89]&#xA;X_2 = [4, 9, 9]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17428" LastActivityDate="2015-09-18T14:44:30.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25917" PostTypeId="1" AcceptedAnswerId="25919" CreationDate="2015-09-18T15:19:37.043" Score="1" ViewCount="967" Body="&lt;p&gt;I am studying H264 video these days. I know video encoder will do frame reorder for GOP with B pictures.I am not sure if my understand is correct!&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;GOP input to encoder (it's raw data but I just map it as GOP for better understand).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I(1) B(2) B(3) P(4) B(5) B(6) P(7) B(8) B(9) P(10) B(11) B(12) I(13)&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;GOP output from encoder.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I(1) P(4) B(2) B(3) P(7) B(5) B(6) P(10) B(8) B(9) I(13) B(11) B(12)&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;GOP input to decoder.(the same as output from encoder)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I(1) P(4) B(2) B(3) P(7) B(5) B(6) P(10) B(8) B(9) I(13) B(11) B(12)&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;GOP output from decode. (the same as input to encoder)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I(1) B(2) B(3) P(4) B(5) B(6) P(7) B(8) B(9) P(10) B(11) B(12) I(13)&lt;/p&gt;&#xA;" OwnerUserId="17429" LastActivityDate="2015-09-18T15:43:26.997" Title="I B P video frame reordering" Tags="|video-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25918" PostTypeId="2" ParentId="25907" CreationDate="2015-09-18T15:40:11.653" Score="3" Body="&lt;p&gt;My guess is you're calculating the derivatives wrong, or you're applying the whole thing to the wrong input data. I can show you the expected output for each step graphically, so you can compare it to what you get. I've implemented this in Mathematica; I'll post the code at the end, but I don't know if it'll help you much - Mathematica has built in functions for e.g. convolutions, that you would have to write yourself in C++.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First the input data for a rectangle would look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w2h4Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w2h4Q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's 150 points along a rectangular path, using linear interpolation between the corner points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, the Gaussian and it's derivatives (using $\sigma=3$ for illustration):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J3Vbq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J3Vbq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you convolve these with the X and Y coordinates separately, you get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jftIr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jftIr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first row is just for illustration - you don't actually need the convolution with the Gaussian itself, only the two derivatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the sides of the rectangle, the first derivatives (second row) are constant and the second derivatives (third row) are 0. (You might want to write the results you get to a text file and look at them e.g. using Excel to check this.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, using the curvature formula you quoted, you get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/x2cpU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/x2cpU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Along the straight sides of the rectangle, the curvature is 0 as expected. At the corners, the curvature of a rectangle is infinite; however, what we're calculating here isn't the real curvature, but the curvature of a Gaussian-smoothed rectangle, with filter size $\sigma=3$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fbgAB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fbgAB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check this result, I'll draw a circle with radius $r=\frac{1}{\kappa }$ at each point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OYlF9.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OYlF9.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematica code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(* interpolate between corner points *)&#xA;corners = {{-2, -1}, {2, -1}, {2, 1}, {-2, 1}, {-2, -1}};&#xA;&#xA;dist = Rescale@Prepend[Accumulate[Norm /@ Differences[corners]], 0];&#xA;&#xA;int = Table[&#xA;   Interpolation[Transpose[{dist, corners[[All, i]]}], &#xA;    InterpolationOrder -&amp;gt; 1], {i, 1, 2}];&#xA;&#xA;pts = Outer[#1[#2] &amp;amp;, int, Range[0., 1 - 10^-9, 1/150]]\[Transpose];&#xA;&#xA;cornerIdx = Most[dist*Length[pts] + 1];&#xA;&#xA;Row[{&#xA;  ListLinePlot[pts, AspectRatio -&amp;gt; Automatic, Mesh -&amp;gt; All, &#xA;   ImageSize -&amp;gt; 400, PlotLabel -&amp;gt; &quot;Points&quot;, &#xA;   Epilog -&amp;gt; {Red, PointSize[Large], Point[pts[[cornerIdx]]]}],&#xA;  Spacer[50],&#xA;  ListLinePlot[Transpose[pts], PlotRange -&amp;gt; All, &#xA;   GridLines -&amp;gt; {cornerIdx, {}}, PlotLabel -&amp;gt; &quot;X/Y Coordinates&quot;, &#xA;   PlotLegends -&amp;gt; {&quot;X&quot;, &quot;Y&quot;}, ImageSize -&amp;gt; 400]&#xA;  }]&#xA;&#xA;(* Gaussian &amp;amp; derivatives *)&#xA;\[Sigma] = 2;&#xA;&#xA;g0 = Table[&#xA;   1/(Sqrt[2 \[Pi]] \[Sigma])*Exp[-x^2/(2 \[Sigma]^2)], {x, -10., 10}];&#xA;g1 = Table[-x/(Sqrt[2 \[Pi]] \[Sigma]^3)*&#xA;    Exp[-x^2/(2 \[Sigma]^2)], {x, -10., 10}];&#xA;g2 = Table[(-\[Sigma]^2 + x^2)/(Sqrt[2 \[Pi]] \[Sigma]^5)*&#xA;    Exp[-x^2/(2 \[Sigma]^2)], {x, -10., 10}];&#xA;&#xA;ListLinePlot[{g0, g1, g2}, PlotRange -&amp;gt; All, &#xA; PlotLegends -&amp;gt; {&quot;Gaussian&quot;, &quot;1st derivative of Gaussian&quot;, &#xA;   &quot;2st derivative of Gaussian&quot;}]&#xA;&#xA;(* Convolve x and y with gaussian&amp;amp;derivatives *)&#xA;derivatives = &#xA;  Outer[ListConvolve[#1, #2, Round[Length[g1]/2] + 1] &amp;amp;, {g0, g1, g2},&#xA;    Transpose[pts], 1];&#xA;&#xA;Grid[MapThread[&#xA;  ListLinePlot[#1, PlotRange -&amp;gt; All, PlotLabel -&amp;gt; #2, &#xA;    GridLines -&amp;gt; {cornerIdx, {}}] &amp;amp; , &#xA;     {derivatives,&#xA;    {&#xA;    {&quot;X (smoothed)&quot;, &quot;Y (smoothed)&quot;},&#xA;    {Overscript[X, \[Bullet]], &#xA;     Overscript[Y, \[Bullet]]}, {Overscript[X, \[Bullet]\[Bullet]], &#xA;     Overscript[Y, \[Bullet]\[Bullet]]}}}, 2]]&#xA;&#xA;&#xA;{{xs, ys}, {dx1, dy1}, {dx2, dy2}} = derivatives;&#xA;&#xA;(* calculate curvature *)&#xA;\[Kappa] = dx1*dy2 - dx2*dy1/((dx1^2 + dy1^2)^(3/2));&#xA;ListLinePlot[\[Kappa], PlotRange -&amp;gt; All, &#xA; PlotLabel -&amp;gt; &quot;Curvature \[Kappa]&quot;, GridLines -&amp;gt; {cornerIdx, {}}]&#xA;&#xA;ListLinePlot[Transpose[{xs, ys}], Mesh -&amp;gt; All]&#xA;&#xA;(* osculating circle animation *)&#xA;animationIdx = &#xA;  Select[Range[Length[xs]], &#xA;   Abs[\[Kappa][[#]]] &amp;gt; 10^-2 || (Mod[#, 5] == 0) &amp;amp;];&#xA;&#xA;Monitor[frames = Table[Rasterize@Row[&#xA;      {&#xA;       ListLinePlot[Transpose[{xs, ys}], Mesh -&amp;gt; All, &#xA;        ImageSize -&amp;gt; 400, &#xA;        PlotLabel -&amp;gt; &quot;Osculating circle r=1/\[Kappa]&quot;,&#xA;        Epilog -&amp;gt; Module[{r, pt, n},&#xA;          (&#xA;           pt = {xs[[i]], ys[[i]]};&#xA;           r = Clip[1/\[Kappa][[i]], {-1, 1}*10^4];&#xA;           n = Normalize[{dy1[[i]], -dx1[[i]]}];&#xA;           {Red, PointSize[Large], Point[pt], Circle[pt - n*r, r]}&#xA;           )]&#xA;        ],&#xA;       ListLinePlot[\[Kappa], PlotRange -&amp;gt; All, &#xA;        PlotLabel -&amp;gt; &quot;Curvature \[Kappa]&quot;, &#xA;        GridLines -&amp;gt; {cornerIdx, {}}, ImageSize -&amp;gt; 400, &#xA;        Epilog -&amp;gt; {Red, Line[{{i, 0}, {i, 10}}]}]&#xA;       }], {i, animationIdx}], i];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="291" LastEditorUserId="291" LastEditDate="2015-09-19T08:27:58.277" LastActivityDate="2015-09-19T08:27:58.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25919" PostTypeId="2" ParentId="25917" CreationDate="2015-09-18T15:43:26.997" Score="1" Body="&lt;p&gt;I think you have in general the correct idea. But you have to remember that the encode order (and therefore the order in which the pictures will appear in the bitstream and be decoded), depends on how the references are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you have: I(1) B(2) B(3) P(4) B(5) B(6) P(7). etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could have a structure where in the group [B(2) B(3) P(4)], the first B(2) has a reference to the past I frame, but a future reference to the following B(3) frame. In that case, the encode order start the same as having I(1) P(4), but the next cannot be B(2), because B(2) needs to wait for B(3) to be encoded. And this could change from repetition to repetition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in general the encode order of frames depends on how the referencing structure is. Since the standards do not specify this and allow freedom of choice when encoding, the GOP structure is in general totally arbitrary, so every specific case has to be analyzed.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2015-09-18T15:43:26.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25920" PostTypeId="1" CreationDate="2015-09-18T16:16:07.943" Score="1" ViewCount="106" Body="&lt;p&gt;I want to be able to measure an object using the camera on my phone. How would I go about getting an objects width and height from a video? My first thought was some type of 3D tracking of the video. But that's complicated and I would like to make sure i'm on the right track. Basically, what would be the easiest way to go about doing this? OpenCV?&lt;/p&gt;&#xA;" OwnerUserId="17430" LastActivityDate="2015-09-18T16:16:07.943" Title="How to get an objects dimensions from video" Tags="|image-processing|camera|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25921" PostTypeId="2" ParentId="25893" CreationDate="2015-09-18T22:28:17.190" Score="1" Body="&lt;p&gt;Let’s get one thing straight. You cannot recover the original real and imaginary parts of a complex signal based only on the magnitude values of the complex signal. That’s equivalent to saying, “I have the magnitude of a complex number. How do I compute that complex number’s real and imaginary parts?” There are an infinite number of possible correct answers to that question!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as MBaz rightly said, you don’t have any “envelope” signal in your block diagrams. And by the way, there are no such things as “complex envelope” signals. All “envelope” signals are real-only. Having said all of that, you can learn everything about your two block diagrams by writing down the algebraic equations for all their various signals. (Your textbook should have done that for you.) Then pay attention to all the various trigonometric identities in your math reference book. It’s a mild pain to do all of that, but it’s terrifically educational.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And another thing, your two block diagrams are not the normal “complex modulator” and “complex demodulator” used in modern digital communications systems. In a normal digital comms system the real-valued gI(t)/2 and gQ(t)/2 would be added (or subtracted, I forget) to produce a new real-valued signal that’s transmitted via an antenna. Have a look at Figure 1 of the following PDF file: &lt;a href=&quot;http://www.testequity.com/documents/pdf/keysight/complex-modulation-generation-wp.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.testequity.com/documents/pdf/keysight/complex-modulation-generation-wp.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15391" LastEditDate="2015-09-19T07:19:06.127" LastActivityDate="2015-09-19T07:19:06.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25924" PostTypeId="2" ParentId="25893" CreationDate="2015-09-19T11:58:30.190" Score="1" Body="&lt;p&gt;The complex envelope seems a not-so-well-defined concept to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some consider it an equivalent of the analytic signal (see &lt;a href=&quot;https://dsp.stackexchange.com/questions/10124/what-exactly-is-a-complex-envelope&quot;&gt;What exactly is complex envelope?&lt;/a&gt;), from a real input. In other words, a complex signal whose real part is the real signal $f(t)$, and the imaginary part the Hilbert transform $\mathcal{H}$: $g(t) = f(t) + \imath\mathcal{H}(f(t))$. What I understand from your diagram is that $g(t)$ is already analytic. For others (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Analytic_signal#Complex_envelope.2Fbaseband&quot; rel=&quot;nofollow noreferrer&quot;&gt;Analytic signal/Complex envelope/baseband&lt;/a&gt;), it  denotes a modulation of the analytic signal, generally to shift the center frequency: $g_c(t) = g(t)e^{-\imath \omega_c t}$. This definition is not unique, as it depends on $\omega_c$. If this center frequency is shifted toward $0$, then a low-pass filtering can extract the baseband low-frequency component of the &quot;complex signal&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forgetting the $\frac{1}{2}$ factor, this would correspond to the upper part and the lower part of your diagram. You can find a graphical explanation in Figure 2-1 from &lt;a href=&quot;http://www.dtic.mil/dtic/tr/fulltext/u2/a395963.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Complex band-bass filters for analytic signal generation and their application&lt;/a&gt;, where the left subfigure relates to your diagram, and the right one to the above formula for $g_c(t)$, with $w_c = 2\pi f_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me, an envelope can be complex if one defines it properly, althought this is counter-intuitive as the traditional envelope is usually real and non-negative, or somehow symmetric about the time-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this transform preserve all the information from the input? In some cases, possibly. This could be stated as &quot;In general, a real-valued bandpass signal/system has a complex-valued lowpass equivalent&quot; (Mikko Valkama, &lt;a href=&quot;http://www.cs.tut.fi/kurssit/TLT-9707/presentations/Complex-Signals-and-Radios-short-2pp.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Complex-valued signals and systems&lt;/a&gt;). This, of course, depends on the properties of the signal and an appropriate choice of  $\omega_c$ and the low-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not see where you talk about magnitude, so I do not think the question is about &quot;recovering a complex signal from magnitude only&quot;. However, this is an important topic in signal processing, and can be performed in some cases with additional conditions on signals.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-09-19T11:58:30.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25925" PostTypeId="2" ParentId="24783" CreationDate="2015-09-19T12:26:42.997" Score="1" Body="&lt;p&gt;I will talk about the Linear Spatially Invariant (LSI) Model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the Filter (System) is LSI it can be described in the domain of Fourier Transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y \left( \omega \right) = H \left( \omega \right) X \left( \omega \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ Y \left( \omega \right) $ is the Blurred (Output) Image, $ X \left( \omega \right) $ is the Input Image and $ H \left( \omega \right) $ is the filter model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assuming the filter doesn't vanish in the Fourier Domain, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H \left( \omega \right) = \frac{Y \left( \omega \right)}{X \left( \omega \right)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to practical issues with this model:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Noise.&lt;/li&gt;&#xA;&lt;li&gt;Vanishing Frequencies.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are many methods to deal with those issues (Pseudo Inverse, Wiener Filter, Lucy Richardson) all are having different assumptions (White Noise, Gaussian Noise, Linear Model, Poisson Noise, etc...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Till now I described the classic &quot;Signal Processing&quot; Model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do is build this model in the Spatial Domain.&lt;br&gt;&#xA;The Filtering Operator will be a very large Toeplitz Matrix which you can estimate using LS Model or any solver for any cost function you'd want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically in the world of Image Processing, the quality is in the regularization yo enforce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.&#xA;There is a new community proposal in the SE network:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://area51.stackexchange.com/proposals/86832&quot;&gt;http://area51.stackexchange.com/proposals/86832&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be great if you could follow, up vote question with less than 10 points and propose your own questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-09-19T12:26:42.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25926" PostTypeId="1" AcceptedAnswerId="42552" CreationDate="2015-09-19T16:35:38.373" Score="13" ViewCount="334" Body="&lt;p&gt;[Nota: I have validated the only answer so far, yet &lt;strong&gt;more explicit versions are still welcome&lt;/strong&gt;]&lt;/p&gt;&#xA;&lt;p&gt;The following question is detailed in 1D, with time as the ordinal variable. Similar questions could apply in other dimensions.&lt;/p&gt;&#xA;&lt;p&gt;In several signal processing techniques, such as blind source separation (BSS), filter banks, or deconvolution, one may wish to estimate a signal &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; and only recovers &lt;span class=&quot;math-container&quot;&gt;$s.x(t+d)$&lt;/span&gt;, a scaled and delayed estimate. Rotations and shears can be added in higher dimensions, and many other more.  &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is a scale factor, &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; a delay. One might even stumble with warped data (&lt;span class=&quot;math-container&quot;&gt;$x_{s,d,w} = s.x(t/w+d)$&lt;/span&gt;), as  in super-resolution for instance.&lt;/p&gt;&#xA;&lt;p&gt;In theory, one can estimate continuously &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; with local correlation or Fourier transforms (&lt;a href=&quot;https://dsp.stackexchange.com/questions/25170/how-to-match-2-signals-that-have-same-information-though-shifted-and-scaled&quot;&gt;How to match 2 signals that have same information, though shifted and scaled&lt;/a&gt;). The warping &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; might be estimated with the scale-transform or wavelet representations. I have read several BSS papers and books, asked people, been in conferences, and was not able to find a standard, or at least a usable metric.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YB0ZI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YB0ZI.png&quot; alt=&quot;Delayed, scaled- and warped waveforms&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In image (it works on signals as well), the &lt;a href=&quot;https://en.wikipedia.org/wiki/Structural_similarity&quot; rel=&quot;nofollow noreferrer&quot;&gt;Structural Similarity index&lt;/a&gt; somehow compensates offset and variance.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are there practical error metrics to compare the original &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; with the transformed &lt;span class=&quot;math-container&quot;&gt;$x_{s,d,w}(t)$&lt;/span&gt; in the context of sampled signals and noise conditions? Indeed, the discretization induced by sampling complicates the comparison task (imagine for instance a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-sample spike on the sampling grid that would be delayed by a non-integer time), as well as the noise.&lt;/li&gt;&#xA;&lt;li&gt;Should one resort to asymmetric quantities such as divergences?&lt;/li&gt;&#xA;&lt;li&gt;Can other signal properties help (bandpass, sparse, positive, etc.)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Forgetting about the warping, I have tried to minimize a standard &lt;span class=&quot;math-container&quot;&gt;$\ell_p$&lt;/span&gt; norm, with &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; as parameters, and to smooth both signals. I am not satisfied with the complexity and the outcomes, and this is a bit tedious.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2021-04-07T20:03:27.670" LastActivityDate="2021-04-07T20:03:27.670" Title="Looking for pratical quantitative comparison metrics for scaled, delayed and warped Signals" Tags="|discrete-signals|distance-metrics|scale-space|distortion|blind-deconvolution|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="25927" PostTypeId="1" AcceptedAnswerId="25929" CreationDate="2015-09-19T21:11:42.923" Score="9" ViewCount="4259" Body="&lt;p&gt;My starting point in what follows is a radially symmetric random field. Taking the Fourier transform of this (and plotting it in logarithm to highlight the patterns), I obtain the following image in Fourier space:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8Aswl.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8Aswl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there is a radially symmetric part of concentric circles, superimposed with a cross-pattern. Now, I do not understand this last part, but I highly suspect this to be an artifact that is not supposed to be there... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would not surprise me if this is a problem that more people have run into this problem, but I have not been able to find an answer yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So, bottom line: Why is there a cross-pattern in my image?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="17359" LastEditorUserId="15892" LastEditDate="2015-09-20T10:16:07.567" LastActivityDate="2021-06-05T19:31:27.170" Title="Fourier transform artifacts" Tags="|fourier-transform|window-functions|fourier|periodic|symmetry|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25929" PostTypeId="2" ParentId="25927" CreationDate="2015-09-19T23:15:37.723" Score="9" Body="&lt;p&gt;The cross pattern is typically a border effect, due to the periodicity induced by the standard implementation and hypotheses behind the Fast Fourier transform, when the image lacks periodicity from the right to the left, and the bottom to the top. In other words: if two opposite borders lacks continuity in values (when glued together), artifacts show.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The easiest way out is to multiply your image by an apodizing window, that goes smoothly to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; on the border (imagine for instance a &lt;a href=&quot;https://reference.wolfram.com/language/ref/HammingWindow.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;2D Hamming window&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;A mirror extension is a second option.&lt;/li&gt;&#xA;&lt;li&gt;More involved, you can try the &lt;a href=&quot;http://www.math-info.univ-paris5.fr/%7Emoisan/papers/2009-11r.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Periodic plus smooth image decomposition&lt;/a&gt;, that has been used in random texture synthesis. Some Python versions have been offered:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/jacobkimmel/ps_decomp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Periodic plus smooth image decomposition, as described by Moisan&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/sbrisard/moisan2011&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python implementation of Moisan's periodic-plus-smooth decomposition of an image&lt;/a&gt;, with an improvement described in a series of blog posts, like: &lt;a href=&quot;https://sbrisard.github.io/posts/20180326-on_the_periodic-plus-smooth_decomposition_of_an_image-07.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;On the periodic-plus-smooth decomposition of an image, part 7: improved implementation of Moisan’s algorithm&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="7092" LastEditDate="2021-06-05T19:31:27.170" LastActivityDate="2021-06-05T19:31:27.170" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="25931" PostTypeId="1" AcceptedAnswerId="25932" CreationDate="2015-09-20T06:49:11.367" Score="9" ViewCount="5255" Body="&lt;p&gt;Okay, so in Logic Pro I can load up a Space Designer plugin (convolution reverb) with an impulse that's 9.1 seconds long, turn my mic on, and get real-time convolution reverb as the mic records incoming audio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: How could this be possible? My I/O buffer size is 32 samples. Is my computer capable of performing the convolution of a 401,310 sample impulse with a 32 sample block of audio in under 0.0007 seconds? If so, what kind of black magic do I need to get my own convolution reverb to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should mention that I am trying to develop real time convolution in C with portaudio. It works great when it's not real-time, but it's way too slow in real-time (the convolution I mentioned above takes 0.8 seconds using frequency-domain convolution which is supposed to be faster for impulses of that size, no?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway any insight would be helpful, as I would really like to understand how this kind of real-time processing is possible.&lt;/p&gt;&#xA;" OwnerUserId="17448" LastEditorUserId="7338" LastEditDate="2015-09-20T15:47:29.247" LastActivityDate="2015-09-21T06:52:06.580" Title="How do real-time convolution plugins process audio so quickly" Tags="|convolution|impulse-response|frequency-domain|real-time|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25932" PostTypeId="2" ParentId="25931" CreationDate="2015-09-20T07:31:44.760" Score="14" Body="&lt;p&gt;Real-time low-latency partitioned convolution reverb with a long impulse response works by dividing the impulse response into unequally sized partitions. The shortest partitions (blocks) are at the beginning of the impulse response, and the partition length grows towards the end of the impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MkOQu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MkOQu.png&quot; alt=&quot;Partitioning&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each partition length can be processed separately, giving for each a latency that is for fast Fourier transform (FFT) -based convolution perhaps a couple of times the partition length. Convolution outputs for all partition lengths are summed forming the final composite output. When partitioning the impulse response, the partition of a particular length must not appear before the time that equals the latency of convolution of that partition length. A time-domain finite impulse response (FIR) filter can be used for the beginning of the impulse response because that may be more efficient than doing the low-length convolution by FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the optimal partitioning for a given impulse response length and the optimal split point between time-domain FIR and FFT convolution should be tested on the target platform. A challenging aspect of non-uniform partitioned convolution is scheduling of the work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Non-uniform partitioned convolution was popularized by William G. Gardner, &lt;i&gt;Efficient Convolution without Input-Output Delay&lt;/i&gt;, J. Audio Eng. Soc., Vol. 43, No. 3, 1995 March, available online at &lt;a href=&quot;http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF&quot; rel=&quot;noreferrer&quot;&gt;http://www.cs.ust.hk/mjg_lib/bibs/DPSu/DPSu.Files/Ga95.PDF&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-09-21T06:52:06.580" LastActivityDate="2015-09-21T06:52:06.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25934" PostTypeId="2" ParentId="25927" CreationDate="2015-09-20T08:16:44.343" Score="1" Body="&lt;p&gt;The 2D square rectangular window is not radially symmetric (because it has non-zero corners that stick out farther on the diagonals).  Try a round window of some sort before the 2D FFT.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-09-20T08:16:44.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25935" PostTypeId="2" ParentId="19584" CreationDate="2015-09-20T08:33:01.710" Score="5" Body="&lt;p&gt;@Kyungho Chu: To answer your first question: To obtain an $H(f)$ equation for the freq response of your FIR filter, substitute $e^{i*2*pi*f}$ for each z term in your z-domain $H(z)$ equation. So for example, the $0.74*z^{-3}$ term in $H(z)$ becomes $0.74*e^{-i*3*2*pi*f}$ in $H(f)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The freq response equation of a 41-tap FIR filter will be a constant term plus the sum of (41-3)/2 = 19 cosine terms, where each cosine term has a different frequency. So the general form of the H(f) equation you posted looks correct. (That inappropriate &quot;sigma&quot; notation had me confused at first.) However, the limits of the summation in your $H(f)$ equation should be n = 0 to n = (41-3)/2 = 19. (Was that $H(f)$ equation in the Symposium paper? I hope not.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your second question puzzles me. If the coefficients of the $H(z)$ equation are a(0) to a(n), then the coefficients of the $H(f)$ equation should also be a(0) to a(n). Keep in mind, that %@^*&amp;amp; Matlab software forces you to index your coefficients starting at n = 1 rather than n = 0 as is given in the equations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I plotted the freq magnitude response of the 41 'h' coefficients that you listed, and my plot doesn't look like your plot. Instead of your Matlab code, in Matlab define your 41 coefficient values as variable 'h' and try this line of code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;figure(1), freqz(h, 1), zoom on&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your FIR compensation filter has the appropriate inverse-sin(x)/x shape in the passband but incredibly &lt;em&gt;HUGE&lt;/em&gt; stopband ripples! So, ...that 41-tap FIR filter is about as useless as the warning label on a pack of cigarettes. (Were those 41 coefficient values, your h(n), listed in the Symposium paper? I hope not.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code in Example 1 at: &lt;a href=&quot;https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/an/an455.pdf&quot; rel=&quot;nofollow&quot;&gt;https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/an/an455.pdf&lt;/a&gt; may be useful to you.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="11064" LastEditDate="2015-12-04T02:12:55.183" LastActivityDate="2015-12-04T02:12:55.183" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25936" PostTypeId="1" CreationDate="2015-09-20T08:55:15.863" Score="5" ViewCount="2136" Body="&lt;p&gt;I have been reading several really good answers about how to obtain camera pose (rotation, translation, etc), such as &lt;a href=&quot;https://dsp.stackexchange.com/questions/2736/step-by-step-camera-pose-estimation-for-visual-tracking-and-planar-markers&quot;&gt;this one&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/8927771/computing-camera-pose-with-homography-matrix-based-on-4-coplanar-points/10781165#10781165&quot;&gt;this one&lt;/a&gt;, but I am not sure how this applies to my problem.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;My problem:&lt;/strong&gt; I have two images of a planar scene (terrain image from above), and I want find the motion that the camera has experienced between the two images $(dx, dy)$.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What I have done:&lt;/strong&gt; I have image1 and image2 of a terrain with their features matched, and obtained its homography via OpenCV's C++ function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;cv::Mat H = cv::findHomography(image1points, image2points, CV_RANSAC);&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which looks like it is indeed an affine transformation:&#xA;$$\pmatrix{a&amp;amp;b&amp;amp;c\\d&amp;amp;e&amp;amp;f\\0&amp;amp;0&amp;amp;1}$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What I need help with:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In this matrix, I don't know what is the reference frame of the $dx$, $dy$ parameters. $(dx, dy) = (c, f)$&lt;/li&gt;&#xA;&lt;li&gt;How can I extract the rotation angle and scaling factor between the 2D axes of the two images. (Right now I am using &lt;a href=&quot;https://math.stackexchange.com/questions/78137/decomposition-of-a-nonsquare-affine-matrix&quot;&gt;this suggestion&lt;/a&gt;, but results don't seem reliable).&lt;/li&gt;&#xA;&lt;li&gt;Once I have all the four parameters: $dx$, $dy$, rotation angle, scaling. How can I actually compute the motion of the camera (between the images) using the first image's axes as my reference frame.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="user17348" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2017-02-13T00:15:23.593" Title="Obtain motion between image features by means of the homography matrix" Tags="|computer-vision|opencv|camera-calibration|homography|camera-pose|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25939" PostTypeId="2" ParentId="25936" CreationDate="2015-09-20T16:07:01.417" Score="1" Body="&lt;p&gt;First, calibrate your intrinsics: The focal lengths and the principal point. Homography is not really a rigid transformation and rather a mapping of a plane onto another one. What you really need is a 6DOF parametrization, which is the camera pose. If you have the intrinsics, you could transfer your coordinates to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Camera_matrix#Normalized_camera_matrix_and_normalized_image_coordinates&quot; rel=&quot;nofollow&quot;&gt;normalized coordinates&lt;/a&gt; and estimate the essential matrix using &lt;a href=&quot;https://en.wikipedia.org/wiki/Eight-point_algorithm&quot; rel=&quot;nofollow&quot;&gt;8 point algorithm&lt;/a&gt; - or a better one would be five point algorithm (check &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.129.1518&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;http://users.cecs.anu.edu.au/~hongdong/new5pt_cameraREady_ver_1.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://vis.uky.edu/~stewe/FIVEPOINT/&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;). The operation is the same as solving for fundamental matrix in the uncalibrated setting. But, just because you have your $K$, you could recover essential matrix. Note that, such estimation doesn't assume planar scenes and can in fact operate on 3D structures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could then decompose your essential matrix as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E=R[t]_x$$&#xA;where $[t]_x$ is the skew symmetric form. To obtain the components, proceed as described in &lt;a href=&quot;https://en.wikipedia.org/wiki/Essential_matrix&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Note that, this problem has 4 possible solutions and identifying the best one is usually found via checking all solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your cameras are uncalibrated, you could maybe approximate the calibration using some known dimensions or a grid, within the scene.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using simulated images, then you know the FOV and image dimensions. If this is the case, you could get the camera matrix. Or even better, if you have your $K$ matrix (you could artificially make up one), then you could compute the OpenGL equivalent. Check &lt;a href=&quot;http://jamesgregson.blogspot.de/2011/11/matching-calibrated-cameras-with-opengl.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://ksimek.github.io/2013/06/03/calibrated_cameras_in_opengl/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for that.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To address your questions one by one: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;They are in pixel coordinates and denote the principal point (computed center of the image).&lt;/li&gt;&#xA;&lt;li&gt;Unfortunately, $E$ is defined up to a scale and you could only recover the scale, if you have a known object with size within the scene. You just need to know one distance to do this. It could be a marker, the length of some existing furniture, or the object you inspect and etc. &lt;/li&gt;&#xA;&lt;li&gt;Use the explanation I already provided (above).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And additionally, it is not an affine transformation, it's a projective mapping (perspective transformation). In fact homography is nothing more than the transformation of one plane to another. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2016-02-18T12:04:34.287" LastActivityDate="2016-02-18T12:04:34.287" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25941" PostTypeId="1" CreationDate="2015-09-20T21:36:03.933" Score="3" ViewCount="89" Body="&lt;p&gt;Okay, so I am trying to address a biological problem here. I have asked a variant of this question &lt;a href=&quot;https://dsp.stackexchange.com/questions/19896/pattern-recognition-in-a-time-series&quot;&gt;here&lt;/a&gt;, but I was not able to get to solving it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Four objects are vibrating constantly with some variable frequency and amplitude. I have the X-Y coordinates of the objects w.r.t time. Now, I want to find if there is any correlation between the objects movements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if there is any correlation between the movement of an object with itself w.r.t time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure what to do, I have absolutely no idea about the mathematics involved, but can try to understand what needs to be done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&#xA;A&lt;/p&gt;&#xA;" OwnerUserId="13301" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-09-20T22:34:48.093" Title="digital signal processing problem" Tags="|time-series|" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25942" PostTypeId="2" ParentId="25941" CreationDate="2015-09-20T22:34:48.093" Score="2" Body="&lt;p&gt;Since you have the x/y position for each object it should be fairly straightforward.  Call the position of each $p_1(t)$ through $p_4(t)$.  Subtract the mean from all of them since it sounds like you only care about their movement, not their position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have done that it should be a fairly simple matter of cross-correlating the position functions.  If the vibration frequencies don't change with time you will only get a strong cross-correlation if the vibration frequencies of the two objects are either the same or quite close to each other.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-09-20T22:34:48.093" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25944" PostTypeId="1" AcceptedAnswerId="25947" CreationDate="2015-09-20T23:09:26.967" Score="1" ViewCount="637" Body="&lt;p&gt;This question is about 1-d signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an array of size X with the signal on which I preform Fourier transformation using FFTW.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to use the frequency domain data from this transformation to get an array of size X * 2 that contains the time-domain signal resampled to twice the original sampling frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would that be the same as doing linear interpolation on the original array?&lt;/p&gt;&#xA;" OwnerDisplayName="user17462" LastEditorUserId="15347" LastEditDate="2015-09-22T19:32:30.420" LastActivityDate="2015-09-22T19:34:56.293" Title="Double size inverse fourier transform" Tags="|fft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25945" PostTypeId="1" CreationDate="2015-09-21T01:42:56.163" Score="-1" ViewCount="1200" Body="&lt;p&gt;I need the calibration matrix of my simulated camera, I am trying to fully comprehend and follow the steps from &lt;a href=&quot;https://dsp.stackexchange.com/questions/2736/step-by-step-camera-pose-estimation-for-visual-tracking-and-planar-markers&quot;&gt;Step by Step Camera Pose Estimation for Visual Tracking and Planar Markers&lt;/a&gt; as well as &lt;a href=&quot;https://dsp.stackexchange.com/questions/8901/estimating-plane-pose-without-knowledge-of-intrinsic-camera-parameters&quot;&gt;Estimating Plane Pose Without Knowledge of Intrinsic Camera Parameters&lt;/a&gt;, but I still don't &quot;get it&quot;. Ultimately, I want to use &lt;strong&gt;K&lt;/strong&gt; to find the essential matrix and compute the transformation between two images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The information available to me are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The images.&lt;/li&gt;&#xA;&lt;li&gt;Images are planar scenes, camera is perpendicular to the ground. Transformation between them includes rotation (around ground-perpendicular axes), scaling and translation.&lt;/li&gt;&#xA;&lt;li&gt;Known distance from image (altitude), FOV, pixel width.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Assuming square pixels and no skew, this is what I am after:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;K = \left[\begin{matrix} \alpha_u&amp;amp;0&amp;amp;u_0\\0&amp;amp;\alpha_v&amp;amp;v_0\\0&amp;amp;0&amp;amp;1 \end{matrix}\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\alpha_u$ and $\alpha_v$  are the scale factor in the $u$ and $v$ coordinate directions, and are proportional to the focal length $f$ of the camera: $\alpha_u = k_u f$ and $\alpha_v = k_v f$. $k_u$ and $k_v$ are the number of pixels per unit distance in $u$ and $v$ directions.&lt;/li&gt;&#xA;&lt;li&gt;$c=[u_0,v_0]^T$ is called the principal point, usually the coordinates of the image center.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there an &quot;easy&quot; approach to computing these variables, given the assumptions and the available info about the images? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going through dsp, I am overwhelmed by the amount of links and information on the matter, usually very technical papers that are hard to follow for beginners in the field, and I am unable to understand what corresponds to my case.&lt;/p&gt;&#xA;" OwnerDisplayName="user17348" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2022-04-19T18:08:25.840" Title="Calibration (intrinsic) parameters of a virtual camera with some known information" Tags="|computer-vision|visual-tracking|homography|camera-pose|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25946" PostTypeId="2" ParentId="22930" CreationDate="2015-09-21T04:19:21.550" Score="1" Body="&lt;p&gt;Depending on what you're tryinh to do, you may not have a problem at all. If you merely want to examine FFT spectral magnitude results, then just perform an FFT on each of your separate blocks of time samples. You might want to average the multiple FFT magnitude result sequences to obtain an &quot;averaged FFT magnitude&quot; display which will have a reduced noise variance. And that's often useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're implementing some sort of 2-dimensional, real-time, spectral analysis (a &quot;waterfall&quot; display) then I suggest you merely concatenate your multiple blocks of time samples and then perform your spectral analysis to see what happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, when you say 500,000 samples, do you really mean &#xA;2^19 = 524,288 samples (an integer power of two)?&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-21T04:19:21.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25947" PostTypeId="2" ParentId="25944" CreationDate="2015-09-21T05:49:29.260" Score="1" Body="&lt;p&gt;Copy the spectrum to an array that is long enough to contain the spectrum of the double-length array. Put all the frequencies in their right places so that the zero frequency bin, the negative frequency bins (do not exist if you used real-input-FFT), and the positive frequency bins fall in their correct places. Zero the remaining (high-frequency) bins. If your original array was of even length, depending on the flavor of FFT, you may need to split the Nyquist frequency (highest original frequency, sampling frequency / 2) bin to its identical negative and positive frequency component and divide their value by two. You may further need to scale all bins by a constant (2 in the example) to account for the way the particular FFT and IFFT implementations are normalized. Then at the end use IFFT to get back to time domain (example in Octave):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:1&amp;gt; x = [1 2 3 4]&#xA;x =&#xA;&#xA;   1   2   3   4&#xA;&#xA;octave:2&amp;gt; X = fft(x)&#xA;X =&#xA;&#xA;   10 +  0i   -2 +  2i   -2 +  0i   -2 -  2i&#xA;&#xA;octave:4&amp;gt; Y = [10 -2+2i -1 0 0 0 -1 -2-2i]*2&#xA;Y =&#xA;&#xA; Columns 1 through 6:&#xA;&#xA;   20 +  0i   -4 +  4i   -2 +  0i    0 +  0i    0 +  0i    0 +  0i&#xA;&#xA; Columns 7 and 8:&#xA;&#xA;   -2 +  0i   -4 -  4i&#xA;&#xA;octave:5&amp;gt; y = ifft(Y)&#xA;y =&#xA;&#xA;   1.0000   1.0858   2.0000   2.5000   3.0000   3.9142   4.0000   2.5000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The process is not equivalent to linear interpolation but to ideal sinc interpolation with wraparound of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow&quot;&gt;sinc function&lt;/a&gt; tails to account for the assumed periodicity of the sequence.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-09-21T05:49:29.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25948" PostTypeId="1" AcceptedAnswerId="25949" CreationDate="2015-09-21T06:48:51.253" Score="2" ViewCount="156" Body="&lt;p&gt;I have discrete signals whose values are between 0 and 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to post-process such a signal such that the mean of its values equals 0.5, yet keeping maximum and minimum values 0/1 intact.&#xA;Intuitively, I think an 'element-wise' exponential would be the right approach, yet I can't seem to come up with the method to determine the value of the appropriate exponential.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fictive matlab example to illustrate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; s=[0.2 0.7 1 0.5 0.4 0.2 0 0.3];&#xA;&amp;gt;&amp;gt; mu=mean(s)&#xA;mu =  0.41250&#xA;&amp;gt;&amp;gt; s_adjusted=s.^0.69998;&#xA;&amp;gt;&amp;gt; mu_adjusted=mean(s_adjusted)&#xA;mu_adjusted =  0.50000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the best method to determine the 0.69998 exponential ?&lt;/p&gt;&#xA;" OwnerUserId="7335" LastActivityDate="2015-09-21T19:20:55.550" Title="adjust mean of signal using exponential" Tags="|discrete-signals|signal-analysis|statistics|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25949" PostTypeId="2" ParentId="25948" CreationDate="2015-09-21T08:04:20.797" Score="4" Body="&lt;p&gt;You need to do it numerically, as a related toy problem $2^a + 3^a = 4$ appears to have no symbolic solution. &lt;a href=&quot;https://en.wikipedia.org/wiki/Bisection_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bisection method&lt;/a&gt; (binary search) is probably the easiest solver to implement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;minexponent = 0;&#xA;maxexponent = 2;&#xA;targetsum = 10;&#xA;precision = 32;&#xA;loop precision times {&#xA;  exponent = (minexponent + maxexponent)*0.5;&#xA;  if (sum(s.^exponent) &amp;lt; targetsum) {&#xA;    maxexponent = exponent;&#xA;  } else {&#xA;    minexponent = exponent;&#xA;  }&#xA;}&#xA;return exponent;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The smallest possible exponent value is 0 for your problem. If you are unsure about the largest possible exponent value, you can test the easy-to-check exponents 1, 2, 4, 8, 16 etc. (as many as needed before the sum goes below the target) before the above code, exponentiating into an auxiliary array by multiplying each element by itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if all of the elements are zero, or if all of the elements are one, then you cannot get any other mean than that by exponentiation.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The plot below shows 1000 runs of the algorithm, and the value of &lt;code&gt;exponent&lt;/code&gt; at each iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FzEyq.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FzEyq.gif&quot; alt=&quot;Plot of 1000 applications of the algorithm&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="80" LastEditDate="2015-09-21T19:20:55.550" LastActivityDate="2015-09-21T19:20:55.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25951" PostTypeId="2" ParentId="25945" CreationDate="2015-09-21T08:34:53.267" Score="0" Body="&lt;p&gt;Since your camera is simulated and the scenes are synthetic, you already have this information: Check out my updated answer to &lt;a href=&quot;https://dsp.stackexchange.com/questions/25936/obtain-motion-between-image-features-by-means-of-the-homography-matrix/25939?noredirect=1#comment48551_25939&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-09-21T08:34:53.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25953" PostTypeId="2" ParentId="25864" CreationDate="2015-09-21T11:08:21.560" Score="2" Body="&lt;p&gt;The problem was I've masked the shifted spectrum. After I've used &lt;code&gt;ifftshift&lt;/code&gt; on my mask, I obtained the desired effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. geometrikal - thanks for putting me on the right track!&lt;/p&gt;&#xA;" OwnerUserId="17395" LastActivityDate="2015-09-21T11:08:21.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25955" PostTypeId="1" CreationDate="2015-09-21T14:10:15.533" Score="0" ViewCount="274" Body="&lt;p&gt;I am searching for global purpose Dataset to test some image registration algorithm.. May you please give advice?&#xA;I am looking for color or gray-scale dataset. I prefer it not to be medical or binirized.&#xA;thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this dataset: &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/data/data-aff.html&quot; rel=&quot;nofollow&quot;&gt;http://www.robots.ox.ac.uk/~vgg/data/data-aff.html&lt;/a&gt;&#xA;it seems good but it contains just few images (6 in each set)&lt;/p&gt;&#xA;" OwnerUserId="15118" LastEditorUserId="15118" LastEditDate="2015-09-21T14:23:00.030" LastActivityDate="2015-09-21T14:23:00.030" Title="Image registration dataset" Tags="|image-registration|data-request|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25956" PostTypeId="1" AcceptedAnswerId="25959" CreationDate="2015-09-21T14:40:23.870" Score="0" ViewCount="6674" Body="&lt;p&gt;If the probability of bit error for a square M-ary QAM is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_M = (1-(1-P_\sqrt{M})^2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_\sqrt{M} = 2(1-\frac{1}{\sqrt{M}})Q(\sqrt{\frac{3E_s}{(M-1)N_0}})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $E_s$ is the average symbol energy, can I assume that $E_s=10A^2$?. $2A$ is the minimum distance between two adjacent symbols.&lt;/p&gt;&#xA;" OwnerUserId="17470" LastEditorUserId="13320" LastEditDate="2016-11-13T13:20:06.350" LastActivityDate="2016-11-13T13:20:06.350" Title="Determine minimum distance between two symbols in 16-QAM using the average symbol energy" Tags="|digital-communications|modulation|symbol-energy|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25957" PostTypeId="1" AcceptedAnswerId="25961" CreationDate="2015-09-21T14:50:51.353" Score="1" ViewCount="1042" Body="&lt;p&gt;Let's say I a perform convolution of an image with a Gaussian kernel of some size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to produce the exact same result from a downscaled version of the image? If so, what's its minimal size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not looking for an exact answer, some directions where I should start looking are enough. (I have some basic DSP and image processing knowledge but not much beyond that.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: A closely related question is - does Gaussian blur lose information, i.e. is it impossible to reconstruct the original from the blurred image?&lt;/p&gt;&#xA;" OwnerUserId="4908" LastEditorUserId="4908" LastEditDate="2015-09-24T20:29:06.263" LastActivityDate="2015-09-25T15:06:41.440" Title="Given a downscaled image, produce Gaussian blur of the original image" Tags="|image-processing|convolution|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25958" PostTypeId="2" ParentId="25339" CreationDate="2015-09-21T14:58:56.240" Score="1" Body="&lt;p&gt;The problem with the $l_0$ approach is it is non-smooth and it is non-convex. A convex approximation is to use the $l_1$ to promote sparsity. There are 3 common formulation that are essentially equivalent - if the parameters are chosen correctly (LASSO, Basis Pursuit De-Noising (BPDN) and Quadratic Problem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formulations are:&#xA;$$LASSO:\qquad    \min_x ||Ax-b||_2 \qquad s.t. \quad ||x||_1 \leq \tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$BPDN:\qquad \min_x ||x||_1 \qquad s.t. \quad ||Ax-b||_2 \leq \sigma $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$QP: \qquad \min_x ||Ax-b||^2_2 +\lambda ||x||_1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see the trade-off in sparsity vs fit examine the extreme choices in $\lambda$. In the case where the system $Ax=b$ is under-determined i.e. there are multiple solutions. If $\lambda = 0 $ then the solution is the normal least squares solution, which tends to have a lot of small components across all the vector components i.e. $x$ tends to be vary non-sparse, but the fit is exact. In the other case as $\lambda \rightarrow \infty $ then the fit becomes meaningless and the solution is just the sparsest vector possible which is $x=0$. So intuitively the choice of the value of $\lambda$ trades-off between the fit and the sparsity of the solution vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This relationship is a bit harder to see in the other formulations given above, but they are equivalent problems.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2016-07-18T11:43:36.963" LastActivityDate="2016-07-18T11:43:36.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25959" PostTypeId="2" ParentId="25956" CreationDate="2015-09-21T15:41:03.253" Score="1" Body="&lt;p&gt;A symbol with coordinates $(x,y)$ has energy $x^2+y^2$. In 16-QAM, minimum distance $2A$ implies that the values of $x$ and $y$ are restricted to the set $\lbrace\pm A,\pm3A\rbrace$, and in consequence the possible symbol energies are $2A^2$, $10A^2$ and $18A^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, there are 4 symbols with energy $2A^2$, 8 symbols with energy $10A^2$, and 4 symbols with energy $18A^2$. Calculating the averagey symbol energy, we conclude that $E_s=160A^2/16=10A^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a similar procedure can be used to calculate the average symbol energy of any quadrature modulation, even if they're not square (or even rectangular).&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-09-21T15:41:03.253" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25960" PostTypeId="2" ParentId="25957" CreationDate="2015-09-21T16:04:12.523" Score="1" Body="&lt;p&gt;For the purposes of the question, downscaling can be considered as a lowpass filter, which makes it easier to think about, also because then the order of blurring and downscaling has no effect on the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Gaussian blur convolution kernel has a 2-d Fourier transform that is also a 2-d Gaussian function. A Gaussian function has ever-decaying tails that never go all the way to zero value. In the original resolution, high spatial frequencies that would be permanently erased by (properly done) downscaling will therefore be attenuated but not wholly removed by Gaussian blur. That erasing of what is left after Gaussian blur is the source of quantifiable error due to downscaling, and you would need to formulate a metric to describe that error and to decide on an acceptable level of it.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-09-21T16:10:04.467" LastActivityDate="2015-09-21T16:10:04.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25961" PostTypeId="2" ParentId="25957" CreationDate="2015-09-21T16:21:49.783" Score="4" Body="&lt;p&gt;I don't think you can do that.&#xA;You can probably get a similar result, in that you won't be able to tell by eye that they are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I don't think you can do what you have in mind is this:&#xA;Imagine that you downscale (downsample, basically throw away pixels) an image, apply a blur, upscale the image.  Suppose now that you apply a blur to the original image.  If those two are the same, then you could deconvolve both images and from both of them recover the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be the best compression format ever.  Downscale by 16X, blur.  Small file, send by email.  Upscale by 16X, deblur, original image.  Hell, why stop at 16X?  You could compress all of your images to a single pixel each and be able to recover them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, things don't work that way.  Downscaling will (must) throw away data, and you can't recover it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the downscaled and blurred image will be different from the blurred original.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-09-21T16:21:49.783" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25962" PostTypeId="2" ParentId="25865" CreationDate="2015-09-21T20:33:23.400" Score="1" Body="&lt;p&gt;OK.  I've had a go at simulating what I suggested in the comment: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;run the KF every 1s then to account for the &quot;missing&quot; data, you can change the $R$ matrix by making it much larger when you don't have a measurement (effectively saying &quot;I don't know what this measurement is&quot;)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've used the code &lt;a href=&quot;https://dsp.stackexchange.com/questions/8860/more-on-kalman-filter-for-position-and-velocity/8869#8869&quot;&gt;in this question&lt;/a&gt; to start with (generating the signal model and doing the full-information Kalman filter).  When no measurement exists I've set the measurement to be zero and $R$ to be large (10000).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That yields the plot below.  It's a bit hard to see, but the three plots are: the truth (green), the full-information estimate (red), and the missing-information estimate (black).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some abrupt jumps in the black estimate, but that is the price for not having full information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether this resolves your issue regarding why different pairs of robots perform differently is anyone's guess.  I was expecting the [10,25] measurements to not do very well, but they appear to be doing OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JHobr.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JHobr.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;scilab&lt;/code&gt; CODE BELOW&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//25865&#xA;N = 1000;&#xA;&#xA;t1 = [1:10:N];&#xA;t2 = [1:25:N];&#xA;t3 = [1:3:N];&#xA;t4 = [1:5:N];&#xA;&#xA;&#xA;// Signal Model&#xA;DeltaT = 0.1;&#xA;F = [1 DeltaT; 0 1];&#xA;G = [DeltaT^2/2; DeltaT];&#xA;H = [1 0];&#xA;&#xA;x0 = [0;0];&#xA;sigma_a = 0.1;&#xA;&#xA;Q = sigma_a^2;&#xA;R = 0.1;&#xA;&#xA;a = rand(1,N,&quot;normal&quot;)*sigma_a;&#xA;&#xA;x_truth(:,1) = x0;&#xA;for t=1:N,&#xA;    x_truth(:,t+1) = F*x_truth(:,t) + G*a(t);&#xA;    y(t) = H*x_truth(:,t) + rand(1,1,&quot;normal&quot;)*sqrt(R);&#xA;end&#xA;&#xA;// Kalman Filter with all data&#xA;p0 = 100*eye(2,2);&#xA;&#xA;xx(:,1) = x0;&#xA;pp = p0;&#xA;pp_norm(1) = norm(pp);&#xA;for t=1:N,&#xA;    [x1,p1,x,p] = kalm(y(t),xx(:,t),pp,F,G,H,Q,R);&#xA;    xx(:,t+1) = x1;&#xA;    pp = p1;&#xA;    pp_norm(t+1) = norm(pp);&#xA;end&#xA;&#xA;clf&#xA;plot(xx(1,:),'r') &#xA;plot(H*x_truth,'g');&#xA;&#xA;&#xA;xx2(:,1) = x0;&#xA;pp = p0;&#xA;pp_norm(1) = norm(pp);&#xA;&#xA;y_fed = zeros(1,N);&#xA;&#xA;for t=1:N,&#xA;&#xA;    y_now = 0;&#xA;    R_now = 10000;&#xA;&#xA;    if (sum(find(t == t1)) &amp;gt; 0)&#xA;        y_now = y(t);&#xA;        R_now = R;&#xA;    end;&#xA;    if (sum(find(t == t2)) &amp;gt; 0)&#xA;        y_now = y(t);&#xA;        R_now = R;&#xA;    end;&#xA;&#xA;    y_fed(t) = y_now;&#xA;&#xA;    [x1,p1,x,p] = kalm(y_now,xx2(:,t),pp,F,G,H,Q,R_now);&#xA;    xx2(:,t+1) = x1;&#xA;    pp = p1;&#xA;    pp_norm(t+1) = norm(pp);&#xA;end&#xA;&#xA;plot(xx2(1,:),'k') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-09-21T20:33:23.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25964" PostTypeId="2" ParentId="25674" CreationDate="2015-09-21T22:26:01.487" Score="1" Body="&lt;p&gt;Turns out the problem I was having had to do with the fact that I had implemented an IIR filter rather than an FIR.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double unmodifiedPreviousSample = buffer.samples[0];&#xA;double tempSample;&#xA;for (int i = 1; i &amp;lt; buffer.size; i++) {&#xA;    tempSample = buffer.samples[i];&#xA;    buffer.samples[i] += (alpha * unmodifiedPreviousSample);&#xA;    unmodifiedPreviousSample = tempSample;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once I made this change this, all the low frequencies in the signal were removed and it sounds awesome.&lt;/p&gt;&#xA;" OwnerUserId="11807" LastActivityDate="2015-09-21T22:26:01.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25965" PostTypeId="2" ParentId="18251" CreationDate="2015-09-21T23:59:28.517" Score="0" Body="&lt;p&gt;I know this is an old question but I had a similar problem and figured I would share the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a typical fft image pipeline. Couple things to note:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When dealing with images use &lt;code&gt;ifft2()&lt;/code&gt; instead of &lt;code&gt;ifft()&lt;/code&gt; to perform a 2D transform.&lt;/li&gt;&#xA;&lt;li&gt;The frequency domain image is usually shifted to put low frequencies in the center. Use &lt;code&gt;ifftshift()&lt;/code&gt; to reverse this.&lt;/li&gt;&#xA;&lt;li&gt;Only the real part of the inverse transform is needed. The imaginary parts should be close to zero.&lt;/li&gt;&#xA;&lt;li&gt;The magnitudes of the frequency domain image are usually  scaled logarithmically for viewing purposes. If you already have the complex values then this probably isn't an issue.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DFT MATLAB pipeline:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Original Image&#xA;img = imread('lenna.png');&#xA;figure(1); imshow(img); % show image&#xA;&#xA;%% Frequency Domain (FFT)&#xA;freqDomain = fft2(img);&#xA;% swap quadrants&#xA;shifted = fftshift(freqDomain);&#xA;&#xA;%% Adjust scaling for viewing (not necessary)&#xA;% get magnitude&#xA;mag = abs(shifted);&#xA;% find the largest value&#xA;largest = max(mag(:));&#xA;% set the scale factor relative to the largest magnitude&#xA;c = (1.0 / log(1.0 + largest));&#xA;% scale magnitudes logarithmically&#xA;scaled = arrayfun(@(x) c * log(1.0 + x), mag);&#xA;% show scaled image&#xA;figure(2); imshow(scaled);&#xA;&#xA;%% Spectral Domain (IFFT)&#xA;% swap quadrants back&#xA;shifted = ifftshift(shifted);&#xA;% get real part of ifft&#xA;specDouble = real(ifft2(shifted));&#xA;% convert result and show image&#xA;specDomain = uint8(specDouble);&#xA;figure(3); imshow(specDomain);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Results:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you scale the magnitudes of your frequency image and get something resembling the left image you probably need to use &lt;code&gt;ifftshift()&lt;/code&gt; to get it looking like the right image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Mu32o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Mu32o.png&quot; alt=&quot;fft shift example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following are some potentially incorrect results (and a correct one) using the traditional Lenna image. The frequency domain is shown above.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Top&lt;/strong&gt;: original image&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Middle Left&lt;/strong&gt;: result of &lt;code&gt;ifft2()&lt;/code&gt; without using &lt;code&gt;ifftshift()&lt;/code&gt; first&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Middle Right&lt;/strong&gt;: result using &lt;code&gt;ifft()&lt;/code&gt; instead of &lt;code&gt;ifft2()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Bottom Left&lt;/strong&gt;: result using &lt;code&gt;ifft()&lt;/code&gt; without &lt;code&gt;ifftshift()&lt;/code&gt; first&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Bottom Right&lt;/strong&gt;: correct result using &lt;code&gt;ifftshift()&lt;/code&gt; then &lt;code&gt;ifft2()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KgIUO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KgIUO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17476" LastActivityDate="2015-09-21T23:59:28.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25966" PostTypeId="2" ParentId="25945" CreationDate="2015-09-22T03:34:07.623" Score="0" Body="&lt;p&gt;It is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alpha_u : image_width = focal_length : sensor_width.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the quantities on the left are measured in pixels, and those on the right in meters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In you case, as the sensor is simulated, you get to decide what its width is. The rest trivially follows. &lt;/p&gt;&#xA;" OwnerUserId="9110" LastActivityDate="2015-09-22T03:34:07.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25967" PostTypeId="1" AcceptedAnswerId="25977" CreationDate="2015-09-22T06:55:19.430" Score="4" ViewCount="101" Body="&lt;p&gt;Suppose I have the following image. I want to extend/expand the grey background behind the model. The extension should only be upward and sideward. I don't want to extend downward because it will be ugly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose is to make the image into size (w, h) where w is greater than or equal to current image width and h is greater than or equal to current image height.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way I could think is, to copy the pixel in the (0, 0) and fill the image extension using this pixel value. However, as you might notice, the grey background at bottom right is slightly different than the rest. This will make noticeable colour difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vq5Mq.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vq5Mq.jpg&quot; alt=&quot;Image example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are &lt;strong&gt;better&lt;/strong&gt; algorithms that is usually used to do that? The resulting image should not have noticeable colour difference and looks natural.&lt;/p&gt;&#xA;" OwnerUserId="17478" LastEditorUserId="128" LastEditDate="2019-03-18T16:15:26.647" LastActivityDate="2022-02-15T22:38:32.117" Title="Extending Background Image" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25971" PostTypeId="1" AcceptedAnswerId="25975" CreationDate="2015-09-22T12:00:46.950" Score="6" ViewCount="3338" Body="&lt;p&gt;An essential matrix relates corresponding points between two images assuming that a camera satisfies the pinhole camera model, and can be expressed as:&#xA;$$E=K'^TFK$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;strong&gt;&lt;em&gt;K&lt;/em&gt;&lt;/strong&gt; is the calibration and &lt;strong&gt;&lt;em&gt;F&lt;/em&gt;&lt;/strong&gt; is the fundamental matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many tools to compute the essential matrix, one of them using OpenCV's function &lt;em&gt;findEssentialMat&lt;/em&gt;. You are typically returned a 3x3 matrix which contains the transformation (or the $$E=R[t]_x$$ camera pose version). Typically, the translation is directly extracted from the &lt;strong&gt;&lt;em&gt;t&lt;/em&gt;&lt;/strong&gt; part, and the rotation matrix has more than one solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;strong&gt;how is scaling represented in the essential matrix?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case it is, how can one extract it? In case it isn't, how come it isn't&gt; And how should one include it to properly state the total motion between the images' points?&lt;/p&gt;&#xA;" OwnerDisplayName="user17348" LastActivityDate="2015-09-22T14:48:39.247" Title="How are the scaling parameters included (extracted from) an essential matrix?" Tags="|computer-vision|opencv|camera-calibration|homography|camera-pose|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25972" PostTypeId="2" ParentId="25684" CreationDate="2015-09-22T13:18:49.173" Score="3" Body="&lt;p&gt;Because a shift in time manifests itself as a phase angle shift in the frequency domain, perhaps comparing the spectral phase of the DFT of x(n) and the spectral phase of the DFT of y(n) would be useful. Just a thought.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-22T13:18:49.173" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25973" PostTypeId="1" AcceptedAnswerId="25981" CreationDate="2015-09-22T13:30:53.843" Score="2" ViewCount="590" Body="&lt;p&gt;I'm trying to understand impulse and unit step responses, but I'm not sure if my understanding is correct. In general, are the following statements true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) The impulse response for a system $x(t) \mapsto y(t)$ is $y(t)$ when $x(t) = \delta(t)$ where $\delta$ is the Dirac delta, and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) The unit step response for a system $x(t) \mapsto y(t)$ is $y(t)$ when $x(t) = u(t)$ where $u$ is the unit step (&lt;a href=&quot;https://en.wikipedia.org/wiki/Heaviside_step_function&quot; rel=&quot;nofollow&quot;&gt;Heaviside step function&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="10475" LastEditorUserId="80" LastEditDate="2015-09-22T15:07:55.383" LastActivityDate="2015-09-22T17:04:55.010" Title="Impulse and unit step response" Tags="|impulse-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25974" PostTypeId="1" CreationDate="2015-09-22T13:50:13.463" Score="1" ViewCount="98" Body="&lt;p&gt;As can be seen from the figure below, I have plotted a signal before it is pulse shaped and after performing half sine pulse shaping using the formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p(t) = \sin(\pi t/2T_c),\ 0&amp;lt;t&amp;lt;2T_c$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p(t) = 0, {\rm otherwise}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bTaEf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bTaEf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am confused about how to interpret the signal after pulse shaping. For example, between 0 and 0.002, the digital signal (the one before pulse shaping) has  5 peaks (including the peaks at 0 and 0.002). Shouldn't I expect the analog signal to also follow such pattern with 5 peaks or is this something special to the half sine pulse shaping?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it matters, I am using OQPSK modulation with DSSS to produce the digital signal and then performing half sine pulse shaping.&lt;/p&gt;&#xA;" OwnerUserId="15794" LastEditorUserId="80" LastEditDate="2015-09-22T15:54:11.360" LastActivityDate="2015-09-22T15:54:11.360" Title="Clarification regarding signal after pulse shaping" Tags="|signal-analysis|dsp-core|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25975" PostTypeId="2" ParentId="25971" CreationDate="2015-09-22T14:25:05.797" Score="1" Body="&lt;p&gt;The Essential matrix is defined only up to scale, so you cannot extract scale from it. In other words, if you multiply $t$ and all the 3D world points in your scene by a constant factor, the essential matrix will be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have to get the scale, then you need some additional information. Either you need to have an object of a known size in the scene, or you need some other sensor that tells you what the translation between the cameras is (e.g. GPS, odometer, or IMU). Here is an &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/structure-from-motion-from-two-views.html&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt; where you get scale from a sphere of a known radius that happens to be in the scene.&lt;/p&gt;&#xA;" OwnerUserId="53" LastEditorUserId="53" LastEditDate="2015-09-22T14:48:39.247" LastActivityDate="2015-09-22T14:48:39.247" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25976" PostTypeId="2" ParentId="24938" CreationDate="2015-09-22T14:30:48.610" Score="2" Body="&lt;p&gt;There is no matrix that maps a pixel in camera 1 to the corresponding pixel in camera 2. This is because the location of the corresponding pixel depends on the 3-D location of the corresponding point in the world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have instead is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fundamental_matrix_(computer_vision)&quot; rel=&quot;nofollow&quot;&gt;Fundamental matrix&lt;/a&gt;, which maps a pixel in camera 1 to a line in camera 2, called the epipolar line.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-09-22T14:30:48.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25977" PostTypeId="2" ParentId="25967" CreationDate="2015-09-22T14:37:00.203" Score="0" Body="&lt;p&gt;What you're looking for basically is &amp;quot;Inpainting&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;In Photoshop is called &amp;quot;&lt;a href=&quot;https://helpx.adobe.com/photoshop/how-to/fix-photo-content-aware.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Content Aware Fill&lt;/a&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;You should look for articles for Inpainting.&lt;/p&gt;&#xA;&lt;p&gt;Trivial option would be using &amp;quot;Replication&amp;quot; of the border and later enforce some smoothness (Either by Gaussian Blur or even &lt;a href=&quot;http://www.ctralie.com/Teaching/PoissonImageEditing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Poisson Image Editing&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="60971" LastEditDate="2022-02-15T22:38:32.117" LastActivityDate="2022-02-15T22:38:32.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25978" PostTypeId="2" ParentId="25974" CreationDate="2015-09-22T15:06:28.650" Score="2" Body="&lt;p&gt;I assume in the following that your digital signal is a sequence of width-1 spikes or, equivalently, a sequence of delta pulses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your half-sine pulse shaping function gives you a lagged peak for every spike. Consider just your first digital signal spike at $t = 0$. If that were all you have, then the shaped output signal would be &#xA;$$g(t) := f(t) \star p(t) = \sin(\pi t / 2T_c),$$&#xA;which has a peak at $t = T_c$. That is, the original signal had a peak at $t = 0$ and the shaped signal has a peak at $T_c$. Is this the behavior you intended?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only had your first two peaks, then the shaped signal would be the sum&#xA;$$ g(t) = \sin(\pi t / 2T_c) + \sin(\pi t / 2T_c - T_c).$$ We can use standard trig identities to rewrite this. Set $\theta = \pi t / 2T_c$ and $\phi = \theta - T_c$, we have $\theta + \phi = 2\theta - T_c$ and $\theta - \phi = T_c$, so we can write &#xA;$$\sin(\theta) + \sin(\phi) = 2\sin(\frac{\theta + \phi}{2}) \cos(\frac{\theta - \phi}{2}) = 2\sin(\theta - T_c/2)\cos(T_c/2).$$&#xA;This function has only one peak, at $\theta = \pi/2 + T_c/2$. In other words, two peaks in the digital signal correspond to only one peak in the shaped signal. I think this is the behavior which surprised you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, and without doing the math, I'd expect $N$ (&lt;em&gt;edit&lt;/em&gt;) &lt;em&gt;consecutive same-sign&lt;/em&gt; peaks in the digital signal to give rise to $N-1$ peaks in the shaped signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;edit: Without doing the math, I'm not very sure what I expect out of a positive peak followed by a negative peak. I expect you'll get a positive shaped peak followed by a negative shaped peak.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="17325" LastEditorUserId="17325" LastEditDate="2015-09-22T15:37:26.430" LastActivityDate="2015-09-22T15:37:26.430" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25979" PostTypeId="1" CreationDate="2015-09-22T15:16:56.477" Score="0" ViewCount="206" Body="&lt;p&gt;I have three data sets from same source. I know they are interdependent and stochastic also. The datasets are of very high frequency (see the graph, X axis is time and Y axis is value). I want to represent these three signals in a single mathematical function. Is it possible? &#xA;&lt;a href=&quot;https://i.stack.imgur.com/5YRxs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5YRxs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above graph, please see there is a pattern or seasonality. If we change one then other also changes. I have tried to google for it but did not find any model that can completely represent this type of data in a single expression. &lt;/p&gt;&#xA;" OwnerUserId="17483" LastEditorUserId="17483" LastEditDate="2015-09-22T17:07:50.463" LastActivityDate="2016-05-20T14:33:02.673" Title="How to represent multiple related signals via mathematical function?" Tags="|signal-analysis|stochastic|" AnswerCount="1" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="25980" PostTypeId="1" CreationDate="2015-09-22T15:18:11.947" Score="4" ViewCount="1350" Body="&lt;p&gt;I wish to determine the frequency, amplitude and phase of a sine wave with some noise and I can only have a fixed number of samples. Should I go for many cycles and a small sample rate or a few cycles and a large sample rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that if I choose to use a DFT to determine the frequency then the spectral resolution will be the sample rate divided by the number of points. I must avoid aliasing so this suggests I should choose a small sample rate giving for example 3 or 4 points per cycle and capture many cycles of data. It may be a separate issue but the actual frequency will probably not correspond to a line in the spectrum so there will still be the, I think, unresolved issue of finding the frequency amplitude and phase from the small cluster of points around the maximum in the spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could also choose an alternative method where I curve fit a sine wave to the data. This should give me best estimates in the least squares sense. However, for this method it is not clear which is best many cycles with a small sample rate or fewer with a large sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a known problem with a known solution? Thanks for any input.  &lt;/p&gt;&#xA;" OwnerUserId="17237" LastActivityDate="2015-09-22T21:59:12.713" Title="Large sample rate or large number of cycles when estimating frequency?" Tags="|signal-analysis|frequency-spectrum|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25981" PostTypeId="2" ParentId="25973" CreationDate="2015-09-22T16:04:36.570" Score="3" Body="&lt;p&gt;In response to MBaz's comment, if we define the impulse response (&lt;em&gt;edit&lt;/em&gt;) &lt;em&gt;for Linear Time Invariant systems&lt;/em&gt; as &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;the function $h(t)$ such that the mapping $x(t) \mapsto y(t)$ is computed as $y(t) = x(t) * h(t)$&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;then notice that if $x(t) = \delta(t)$ you get $y(t) = \delta(t) * h(t) = h(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus louism's statement a) and MBaz's comment agree.&lt;/p&gt;&#xA;" OwnerUserId="17325" LastEditorUserId="17325" LastEditDate="2015-09-22T17:04:55.010" LastActivityDate="2015-09-22T17:04:55.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25982" PostTypeId="1" AcceptedAnswerId="25994" CreationDate="2015-09-22T16:24:33.793" Score="2" ViewCount="1052" Body="&lt;p&gt;I have been using Fourier Transform Power Spectrum for estimating the dominant direction in some images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am now working on extremely small images of size 8X8 pixel and I have found that even at this level there is some result regarding the dominant orientation of the image. As the image size is 8X8, the total number of pixel will be 64 and as shown in the figure below, there will be less number of angles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have simply done polar conversion  of the Fourier Transform Power Spectrum of the image which will be of same size (8X8), then I have taken the summation of the intensity for each angle and plotted them against the angle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sueNW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sueNW.png&quot; alt=&quot;An image with coordinate and angular information.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, from the plot I can find the maximum angle but I want to increase the accuracy of my result. I will first find the dominant direction of an image (a medical image) and then I will find the changes in the diseased state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thank you so much for your help.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15755" LastEditorUserId="15755" LastEditDate="2015-09-22T21:25:38.960" LastActivityDate="2015-09-23T13:47:32.217" Title="Dominant Orientation using Fourier Power Spectrum" Tags="|image-processing|fourier-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25983" PostTypeId="2" ParentId="25967" CreationDate="2015-09-22T17:05:15.963" Score="1" Body="&lt;p&gt;This background is nearly flat (saturated at RGB(245, 245, 245)), and you'll get good results by replicating the left edge leftward, the top edge upward, and the right edge rightward; corners both ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a less uniform background, you could take values of the background pixels where there is no saturation, fit a smooth model such as quadratic (by least squares), and extrapolate out of the image, applying saturation.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-22T17:05:15.963" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25984" PostTypeId="2" ParentId="25980" CreationDate="2015-09-22T17:27:08.453" Score="0" Body="&lt;p&gt;I would choose low sample rate, many cycles for a few reasons.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Assuming the sine wave doesn't have harmonics, there is no information about the sine wave at the higher frequencies.&lt;/li&gt;&#xA;&lt;li&gt;If you do use a DFT to estimate the frequency, you will get the best frequency resolution from the low sample rate approach, because the Hz per &quot;bin&quot; is $\frac{f_s}{N}$, where $f_s$ is the sample frequency, and $N$ is the number of samples.&lt;/li&gt;&#xA;&lt;li&gt;You could do a simple zero-crossing approach that would be very accurate if you have a large number of cycles.  By zero-crossing I mean count how many times it crosses the zero point in $N$ samples, and use that to determine the frequency.  This assumes that the noise power is low enough that erroneous zero-crossings are very rare.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-09-22T17:27:08.453" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="25985" PostTypeId="1" AcceptedAnswerId="25989" CreationDate="2015-09-22T17:33:12.647" Score="2" ViewCount="617" Body="&lt;p&gt;So, my understanding of stereovision is that you essentially have two cameras. Then, &lt;em&gt;offline&lt;/em&gt;, you perform camera calibration with checkerboards to get intrinsic camera properties as well as the geometric transformation between cameras. Then, you can take a stereo pair of images, find the disparity map, and using some geometric constraints, can find the 3D positions of points in the scene.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read recently about &quot;bundle adjustment&quot; and that it should be performed at the very end? What's the purpose?&lt;/p&gt;&#xA;" OwnerUserId="5206" LastEditorUserId="128" LastEditDate="2019-03-19T17:24:59.423" LastActivityDate="2019-03-19T18:33:10.993" Title="What Is the Purpose of Bundle Adjustment?" Tags="|image-processing|stereo-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="25987" PostTypeId="2" ParentId="25980" CreationDate="2015-09-22T18:40:50.283" Score="2" Body="&lt;p&gt;For frequency estimation of a pure sine wave, the difference between 2 slightly different frequency sine waves increases over time.  So a longer time base (as long as the sample rate is well separated from the Nyquist rate, or any integer sub-multiple thereof) would provide a bigger difference in a fixed number of samples, thus making it more likely that two different frequency signals could be separated from the effects of noise on any one signal.  This bigger separation difference is a close equivalent to better frequency estimation accuracy.  Note that under-sampling is possible if the S/N ratio is good enough, and as long as you know, a-priori, the correct frequency range of your signal and stay away from integer multiples of Fs/2 being near to Festimated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A longer time base also corresponds to a narrower frequency bin spacing of a DFT result, thus decreasing the percentage errors in any interpolation between bins that may be performed or required.  But any frequency is a line in the spectrum after (high-quality/Sinc) interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you estimate the frequency, you can use two or more points (depending on the S/N ratio) to least squares fit a sine wave equation in two unknowns to estimate amplitude and phase.  Or windowed-Sinc interpolation, followed by successive approximation is another method to estimate amplitude.  Quadrature modulation of the signal against the estimated frequency can also be used to estimate phase (most accurately when referenced to the point or time at the center of the data window).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-09-22T21:59:12.713" LastActivityDate="2015-09-22T21:59:12.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25988" PostTypeId="2" ParentId="25980" CreationDate="2015-09-22T19:29:42.190" Score="2" Body="&lt;p&gt;Jim Clay's answer is good, but there is a caveat: you want the sampling frequency low, but not too low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have real-valued data (as opposed to complex-valued data), the you should try to avoid the DC (zero frequency) and $f_s/2$ (high frequency) bins.  Because the FFT of real-value signals tend to &quot;wrap&quot; at these frequencies, so a bias is induced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, this plot shows the FFT magnitudes of sinusoids with frequencies 0.5 bins and 2.5 bins.  You can see that the peaks in the top plot (corresponding to negative and positive frequency peaks) overlap a little in the top one but not in the bottom one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hlhvP.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hlhvP.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see the effect of the bias, the &lt;code&gt;scilab&lt;/code&gt; code below estimates the frequency from the FFT bin where the true frequency changes from 0 to 5 bins in steps of 0.01 bins. If there were no bias, you would expect a straight line (well, jagged because of the quantization that binning produces).  Below about 1.5 bins the line is not straight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/chRoy.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/chRoy.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still working on the amplitude and phase estimates. They're a little tricky in the real-valued sinusoid case.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;scilab&lt;/code&gt; Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//25980&#xA;//omega = 2*%pi/N*1.5;&#xA;bin_true = [0:.01:5];&#xA;bin_hat = [];&#xA;for omega = 2*%pi/N*bin_true;&#xA;N = 50;&#xA;Ninterp = 10;&#xA;A = 1.382489;&#xA;phi = 2*%pi*0.89823749;&#xA;t = [0:N-1]&#xA;x = A*sin(omega*t+phi);&#xA;&#xA;XX = abs(fft([x, zeros(1,(Ninterp-1)*N)]));&#xA;&#xA;f = ([0:Ninterp*N-1] - Ninterp/2*N)/(Ninterp*N) &#xA;&#xA;[mx,ix] = max(XX);&#xA;&#xA;bin_hat = [bin_hat (ix-1)/Ninterp];&#xA;end&#xA;&#xA;&#xA;plot(bin_true,bin_hat)&#xA;xlabel('True bin');&#xA;ylabel('Estimated bin');&#xA;title('Bias for very low frequency real sinusoid estimation')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-22T19:29:42.190" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25989" PostTypeId="2" ParentId="25985" CreationDate="2015-09-22T19:36:20.913" Score="2" Body="&lt;p&gt;If all you want is to reconstruct a scene from a pair of images from a pair of calibrated stereo cameras, and your calibration is sufficiently accurate, then you do not need bundle adjustment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You do need bundle adjustment if you want to reconstruct a scene from a sequence of images or for a sequence of stereo pairs, where the camera poses in each view are unknown. Search for &quot;structure from motion&quot; and &quot;visual odometry&quot;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-09-22T19:36:20.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25990" PostTypeId="2" ParentId="2010" CreationDate="2015-09-22T19:51:17.173" Score="2" Body="&lt;p&gt;Here is another approach gaining RGB Brownian noise (4096x4096 GIF).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/YbUvO.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YbUvO.gif&quot; alt=&quot;RGB Brownian noise&quot;&gt;&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="17221" LastEditorUserId="17221" LastEditDate="2015-09-22T22:01:19.113" LastActivityDate="2015-09-22T22:01:19.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25991" PostTypeId="1" CreationDate="2015-09-22T20:28:58.507" Score="0" ViewCount="434" Body="&lt;p&gt;I was told that this question is too broad. Maybe I don't understand what this forum is about. My question is basically the same. I am looking for references to range Doppler algorithms so I can learn how they work. I said monostatic radar because it is probably the most basic radar system. If someone can help, fine. Else, I'll keep looking on my own. Still very appreciative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for radar range-Doppler algorithms, especially for monostatic radars, used to create range-Doppler maps. I am looking into books and papers, and I checked the internet. There is much talk about RDA (Radar-Doppler algorithm) and RDM (Radar-Doppler map) but I cannot find any documents or code which are tutorial in nature.&lt;/p&gt;&#xA;" OwnerUserId="16612" LastEditorUserId="13320" LastEditDate="2016-11-21T13:14:27.093" LastActivityDate="2016-11-21T13:14:27.093" Title="Monostatic range-doppler algorithm" Tags="|radar|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="25992" PostTypeId="1" AcceptedAnswerId="25999" CreationDate="2015-09-22T20:48:42.413" Score="1" ViewCount="19049" Body="&lt;p&gt;I am trying to implement MFCC by following &lt;a href=&quot;http://mirlab.org/jang/books/audiosignalprocessing/speechFeatureMfcc.asp?title=12-2%20MFCC&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; and I found that there is a step in which signals are divided into frames and then passed on to Hamming windowing process. The reason given there is to correct the discontinuity at the start and last samples of the frame. OK that sounds good, then the output of the window is fed for FFT process. So I thought of doing this sample code separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My code:-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Creating a signal to perform hamming windowing on.&#xA;fs=8000;&#xA;ts=1/fs;&#xA;N=1000;&#xA;t=(0:ts:(N-1)*ts);&#xA;x=sin(2*pi*60*t);&#xA;&#xA;&#xA;figure,subplot(221),plot(t,x,'.-'),title('Original Speech'),xlabel('Time');grid on&#xA;f=(-fs/2:fs/(N-1):fs/2);&#xA;subplot(223),plot(f,fftshift(abs(fft(x)))),title('Frequency Spectrum'),xlabel('Freq (Hz)');grid on&#xA;windowed=x.*hamming(length(x))';&#xA;subplot(222),plot(t,windowed,'.-'),title('Hamming Window Applied'),xlabel('Time');grid on&#xA;subplot(224),plot(f,fftshift(abs(fft(windowed)))),title('Frequency Spectrum After Hamming'),xlabel('Freq (Hz)');grid on &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The plot generated is:-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OCidC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OCidC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Problem is:-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the advantage of Hamming Windowing. I am a noob, so according to me, firstly we are loosing the amplitude at the staring and ending of the signal in the time domain and secondly, in the frequency domain, there is very little difference. So what is the advantage of doing all this much computation.&#xA;Please explain with as much detail as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it would be nice if someone could point out to more detailed (according to them) tutorial then what I am referencing or what they read while learning MFCC themselves.&lt;/p&gt;&#xA;" OwnerUserId="17486" LastEditorUserId="80" LastEditDate="2015-09-23T11:42:27.210" LastActivityDate="2015-09-23T15:51:50.117" Title="What is the advantage of applying a Hamming window for MFCC calculations?" Tags="|matlab|mfcc|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="25994" PostTypeId="2" ParentId="25982" CreationDate="2015-09-23T05:42:32.633" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Subtract from the 8x8 image the mean value of its pixels, which should not affect the dominant orientation. This will remove artifacts due to windowing in the next step.&lt;/li&gt;&#xA;&lt;li&gt;Window the image with a circularly symmetric window function that eliminates artifacts aligned with the image axes. Make sure you have chosen a window function that is sufficiently smooth to be sampled with a 8x8 grid without frequency domain aliasing.&lt;/li&gt;&#xA;&lt;li&gt;Pad the image to 32x32 with zeros to increase the image size and thus the discrete Fourier transform (DFT) resolution. This makes the DFT result smoother and thus easier to interpolate.&lt;/li&gt;&#xA;&lt;li&gt;Calculate for each angle an integral of the squared magnitude of the DFT result over a line corresponding to the angle. All angles must be treated equally; use same length lines. 4x4 piece-wise bicubic polynomial interpolation should suffice if you approximate the integral by a sum of point samples at the axis-aligned resolution of the DFT.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you want to make the computation faster you can take advantage of that the integral will change quite smoothly as function of the angle, so you can first sample at the coarse resolution of at least $\text{atan}(1/8)\times 360\unicode{xb0}/(2\pi) \approx 7\unicode{xb0}$ to find where the highest peak might be, and then sample more finely around that angle.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-09-23T06:24:54.780" LastActivityDate="2015-09-23T06:24:54.780" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25995" PostTypeId="1" AcceptedAnswerId="26041" CreationDate="2015-09-23T06:13:01.687" Score="2" ViewCount="1086" Body="&lt;p&gt;As far as I know,&#xA;Image alignment just finds the best fit given two images of the same scene.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas Image rectification, with regards to stereo vision, warps the images so that the epipolar lines are all on the same level. Essentially all common pixels between the two images are warped to be on the same y axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, what is the difference between Image Alignment and Image Rectification, given a pair of images, when doing stereo correspondence?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were to find the disparity between two images, how is image alignment different to image rectification?&lt;/p&gt;&#xA;" OwnerUserId="11435" LastEditorUserId="3958" LastEditDate="2017-08-21T08:05:49.890" LastActivityDate="2017-08-21T08:05:49.890" Title="Is there a difference between Image Alignment and Stereo Rectification for stereo correspondence or matching?" Tags="|image-processing|image-registration|terminology|stereo-vision|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25996" PostTypeId="2" ParentId="18839" CreationDate="2015-09-23T07:35:16.637" Score="1" Body="&lt;p&gt;Like the 50 Hz mains hum and its harmonics, the easiest explanation for the 5 kHz harmonic interference is a nearby switching power supply, like a wall wart. Try disconnecting appliances from mains, turning off monitors, moving things around, and altering your grounding scheme or altering the capacitance of things by touching them to reduce interference.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-09-23T07:35:16.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="25997" PostTypeId="2" ParentId="25979" CreationDate="2015-09-23T07:51:24.067" Score="1" Body="&lt;p&gt;Try the &lt;a href=&quot;http://www.nutonian.com/products/eureqa/&quot; rel=&quot;nofollow&quot;&gt;Eureqa&lt;/a&gt; software. It tries to find the simplest mathematical relation between multiple data. If the relation truly has a simple symbolic form, I think it should find it. Otherwise it will produce some strangely formulated approximation.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-09-23T07:51:24.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="25998" PostTypeId="1" CreationDate="2015-09-23T09:11:47.033" Score="2" ViewCount="91" Body="&lt;p&gt;It differs from human tracking in random environment in that detail that we have fixed environment. And players move pretty fast and it is important to resolve collisions and occlusions, keep track of right person. So please tell me what you think about this problem. Or what paper can be used to implement state-of-the-art approach for human tracking that you are aware of?&lt;/p&gt;&#xA;" OwnerUserId="17497" LastActivityDate="2015-11-22T12:02:33.180" Title="What is an approach in computer vision that can be used for tracking players in hockey games?" Tags="|computer-vision|machine-learning|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="25999" PostTypeId="2" ParentId="25992" CreationDate="2015-09-23T10:13:33.877" Score="5" Body="&lt;p&gt;Ideally you would only see that frequency as a narrow peak but because of the finite-length window you also get that other artificial crud: Windowing equals time domain multiplication by the window function (here rectangular or Hamming). Time domain multiplication equals frequency domain convolution: All frequencies will be replaced by the Fourier transform of the window function. This is what those look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dnBL3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dnBL3.png&quot; alt=&quot;Rectangular window and its Fourier transform&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BA5sU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BA5sU.png&quot; alt=&quot;Hamming window and its Fourier transform&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convolution spreads the true frequency to frequency bins around it. By using a window function other than the rectangular one there is less of the sidelobes compared to the main lobe, so less artificial long-distance spread making the result cleaner and better suited for frequency-selective analysis. You seem to have by accident chosen a frequency where you don't see the sidelobes with the rectangular window because the dips between the sidelobes land between your frequency bins. So you just see slopes.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-09-23T15:51:50.117" LastActivityDate="2015-09-23T15:51:50.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26000" PostTypeId="2" ParentId="25998" CreationDate="2015-09-23T11:00:49.410" Score="1" Body="&lt;p&gt;Regarding speed and occlusions, I would suggest you to take a look at this work on basketball: &lt;a href=&quot;http://www.ivpe.com/detectppl.htm&quot; rel=&quot;nofollow&quot;&gt;Locate and Track People in a Network of Fixed Overlapping Cameras&lt;/a&gt;, and notably published in A. Alahi, Y. Boursier, L. Jacques, and P. Vandergheynst. &lt;a href=&quot;http://www.ivpe.com/papers/jmiv11.pdf&quot; rel=&quot;nofollow&quot;&gt;Sparsity Driven People Localization with a Heterogeneous Network of Cameras&lt;/a&gt;, in Journal of Mathematical Imaging and Vision, 2011. Then by looking at its &lt;a href=&quot;https://scholar.google.fr/scholar?oe=utf-8&amp;amp;rls=org.mozilla:fr:official&amp;amp;client=firefox-a&amp;amp;gfe_rd=cr&amp;amp;gws_rd=ssl&amp;amp;um=1&amp;amp;ie=UTF-8&amp;amp;lr&amp;amp;cites=16179636356775744338&quot; rel=&quot;nofollow&quot;&gt;citation network&lt;/a&gt;, you could find other relevant work.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-09-23T11:00:49.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26001" PostTypeId="1" CreationDate="2015-09-23T13:22:13.077" Score="0" ViewCount="499" Body="&lt;p&gt;I greatly appreciate the opportunity afforded by this forum to submit a query.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been suggested that for a sinusoidal input, represented as 2 phasors, into a Linear Shift-invariant system, the output...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v5f3V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v5f3V.png&quot; alt=&quot;1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...can also be written as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ohdWA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ohdWA.png&quot; alt=&quot;2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $$H(\Omega) = \int_{-\infty}^{\infty} h(\lambda) e^{-j\Omega\lambda} d\lambda$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accompanying brief comment suggests the above to be on account of &quot;polar form representation of H&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although I am cognizant of polar form representation of complex numbers i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z = |z|(\cos(\theta)+i \sin(\theta)) = |z|e^{i \theta}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...I am completely unable to fathom the alternative above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All advice would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;wirefree&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17398" LastEditorUserId="80" LastEditDate="2015-09-23T13:26:36.400" LastActivityDate="2015-09-28T11:56:11.803" Title="Polar form of eigenvalue" Tags="|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26002" PostTypeId="2" ParentId="26001" CreationDate="2015-09-23T13:33:37.360" Score="1" Body="&lt;p&gt;I think all it's saying is that we can write $H(\Omega)$ as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(\Omega) = \left| H(\Omega) \right | e^{j \angle H(\Omega) }&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also seems to be assuming that $h(t)$ is real-valued so that $H(-\Omega) = H^*(\Omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function $H(\Omega)$ is just a map from $\mathbf{R} \mapsto \mathbf{C}$ (from the reals to the complex numbers).  For any specific value of $\Omega$ this generates a single complex number $H(\Omega)$. And, as you say, any complex number resolves to its exponential notation.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-09-28T11:56:11.803" LastActivityDate="2015-09-28T11:56:11.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26003" PostTypeId="2" ParentId="25982" CreationDate="2015-09-23T13:47:32.217" Score="1" Body="&lt;p&gt;A few things you need to take care of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the borders: either window the images with a smooth function or try any transformation that removes discontinuity at the borders (e.g. periodic + smooth &lt;a href=&quot;http://www.math-info.univ-paris5.fr/~moisan/p+s/&quot; rel=&quot;nofollow&quot;&gt;http://www.math-info.univ-paris5.fr/~moisan/p+s/&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;the angles: you have much more points in some directions (e.g. 0° 45° etc.) than in others (like 10°). So for each direction, you need to renormalize your sums to make sure you don't favor directions where you have many points -- take the mean instead of the sum, or interpolate and always take the same number of samples.&lt;/li&gt;&#xA;&lt;li&gt;the norm: the Fourier transform is a unitary transform, i.e. its preserves the L_2 norm, not the L_1 norm. Although they are related, I'd advise you to sum the squares of the moduli of coefficients.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="16803" LastActivityDate="2015-09-23T13:47:32.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26004" PostTypeId="1" AcceptedAnswerId="26005" CreationDate="2015-09-23T16:04:52.137" Score="0" ViewCount="65" Body="&lt;p&gt;I am not specialist in DSP,I am dealing with geophysical time-series(electromagenteic sources).After converting to frequency domain,my friend is trying to filter with FIR(45-65Hz) to get rid of AC noise(50Hz).The questionis about the harmonics,how will FIR filtering influence harmonics?&lt;/p&gt;&#xA;" OwnerUserId="17502" LastEditorUserId="17502" LastEditDate="2015-09-23T16:13:52.803" LastActivityDate="2015-09-23T16:25:13.443" Title="finite impulse response filter" Tags="|filters|finite-impulse-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26005" PostTypeId="2" ParentId="26004" CreationDate="2015-09-23T16:25:13.443" Score="0" Body="&lt;p&gt;The best way to get rid of 50Hz AC noise is with an Adaptive filter (usually the LMS algorithm will work fine), but you need to be able to take a reference signal of only the AC noise source, normally this is usually possible because if your system is being contaminated with AC it means you have some electrical equipment nearby or an outlet where you can take a sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do not want adaptive filter, then you can try a notch filter at 50Hz. I believe what your friend was trying to do is put a lot of zeros in the Region of 45-65Hz. It depends on the frequency response of the filter but normally the Harmonics will not be attenuated to the same degre, and normally AC is not very clean especially if you have transformers in the middle and such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adaptive filter is the way :)&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2015-09-23T16:25:13.443" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26006" PostTypeId="1" CreationDate="2015-09-23T17:00:15.377" Score="0" ViewCount="11717" Body="&lt;p&gt;I generated a time history of 200 points using the equation &#xA;$$x(t) = A\cos(2\pi f t)+ B\sin(2\pi f t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $A = 1$, $B = 0.1$ and $f = 17.2 \mathrm{Hz}$ and a sample rate of 400 samples per second. The numerical Fourier transform of the time history has a modulus plot of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3s3P2.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is how to get the frequency, amplitude and phase from this plot? This is the typical case where the frequency falls between bins. As there are three unknowns I would imagine you could get the precise values from, say, the three largest points which I call premax, max and postmax. However, complex values are available for all the points so many methods are possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question arose as an output from a &lt;a href=&quot;https://dsp.stackexchange.com/questions/25980/large-sample-rate-or-large-number-of-cycles-when-estimating-frequency&quot;&gt;previous question&lt;/a&gt; where it was suggested I ask afresh and that several answers were available.  I have also asked this question on Mathematica Stackexchange &lt;a href=&quot;https://mathematica.stackexchange.com/questions/42783/how-do-you-find-the-frequency-and-amplitude-from-fourier&quot;&gt;here&lt;/a&gt; where it was suggested I ask on Signal Processing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many answers are available. Exact rather than approximate answers are preferable. Some, like using a Prony series or curve fitting a sine wave, do not use the Fourier transform. These are also interesting but I would like to use the Fourier data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is noise on the data then some sort of fitting is probably needed depending on the extent of the noise. All suggestions welcome. Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit more in response to the answers which I still have to fully investigate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an exact analytic formula for the Fourier transform of a sampled sine wave. For my data it plots as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ncssj.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plot could also be obtained by calculating in-between values for the original data. I also calculated the frequency at the maximum of the analytic curve. To 25 significant figures it is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;17.22726210702718945079653&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is significantly different to value of 17.2 used in the calculation of the  time history. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the answers suggest using parabolic interpolation. I show the results of this here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/vQXA2.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried parabolic interpolation using the complex values of the Fourier transform and the absolute values. The absolute values show a better maximum than the complex values but they are still well off. I still have other suggestions to try. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Methods based on time domain analysis look more promising than using Fourier which is disappointing. &lt;/p&gt;&#xA;" OwnerUserId="17237" LastEditorUserId="17237" LastEditDate="2015-09-24T10:09:31.287" LastActivityDate="2015-09-24T18:16:58.003" Title="How do you find the frequency and amplitude from a DFT?" Tags="|fourier-transform|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26007" PostTypeId="2" ParentId="26006" CreationDate="2015-09-23T17:12:54.603" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/users/51/eric-jacobsen&quot;&gt;Eric Jacobsen&lt;/a&gt; has done quite a bit of work on this topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out his &lt;a href=&quot;http://ericjacobsen.org/fe.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;first&lt;/a&gt; and &lt;a href=&quot;http://www.ericjacobsen.org/fe2/fe2.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;second&lt;/a&gt; frequency estimation pages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also some algorithms &lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; that may be of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if any of these are of any interest, and I can elaborate.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-09-23T17:12:54.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26008" PostTypeId="1" CreationDate="2015-09-23T17:59:02.957" Score="3" ViewCount="735" Body="&lt;p&gt;When sampling a signal, it is standard practice to use a sampling rate that is greater than two times the bandwidth of the signal in order to avoid aliasing. The result is then low-pass filtered (and sometimes upsampled prior to this) in order to get rid of the harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, in control systems applications preventing aliasing in not enough. The system also needs to respond quickly enough to the input (as determined by a spec), and a low sampling rate will limit this performance. Specifically, if the system samples a signal at time t, then any event that occurs immediately afterwards will be ignored until one sampling period later.  Thus, there are clear performance advantages to having a sampling rate much greater than two times the signal bandwidth. I'm looking to quantify this performance improvement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider an open-loop control system that attempts to cancel out an incoming signal by outputting an inverted version of this same signal. In other words, active compensation through destructive interference. If the system has infinite magnitude resolution (both the ADC and DAC have infinite bits) and an infinite sampling time, then the inverted output signal will be a perfect inverse of the original and the signals will cancel out completely. But if the system has a finite sampling rate, then the output signal will not be a perfect inverse of the original and the two will not cancel completely. The lower the sampling rate, the worse the cancellation will be (even if no aliasing occurs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; Assuming the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The input signal is a  sinusoid of frequency $f_0$ and magnitude $A$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The system has an ADC with a sampling rate of $f_s$ where $f_s &amp;gt; 2 f_0$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The system uses sample-and-hold (ZOH) interpolation to output an inverted sinusoid and add it to the original signal&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The system has zero time delay between an ADC sample and the corresponding DAC output (ADC settling time, DSP calculations, etc. are instantaneous)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How do I calculate the frequency and magnitude of the resulting frequency components?&lt;/p&gt;&#xA;" OwnerUserId="8450" LastEditorUserId="8450" LastEditDate="2015-09-23T20:46:32.360" LastActivityDate="2015-09-23T20:46:32.360" Title="Benefits of oversampling in a realtime noise-cancellation system" Tags="|sampling|control-systems|nyquist|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26009" PostTypeId="1" AcceptedAnswerId="26010" CreationDate="2015-09-23T18:01:13.497" Score="1" ViewCount="237" Body="&lt;p&gt;So we're doing a project where we've decided on QAM-n modulation. I've read up a little bit on synchronization and found Barker sequences, which supposedly has nice autocorrelation properties which makes them good for synchronization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So one option is to use BPSK modulation only in the synchronization phase and then move onto QAM for the data. But to me, it's very unintuitive that we couldn't construct even NICER synchronization sequences (wrt autocorrelation peakedness etc) if we utilize more of the signal space. Maybe something like simultaneous Barker BPSK for both I and Q? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a nice explanation for why it's generally best to use BPSK for the synchronization?&lt;/p&gt;&#xA;" OwnerUserId="9140" LastActivityDate="2015-09-23T18:18:02.660" Title="Generalized Barker sequences" Tags="|modulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26010" PostTypeId="2" ParentId="26009" CreationDate="2015-09-23T18:18:02.660" Score="3" Body="&lt;p&gt;Longer preambles make it easier for the demodulator to lock onto the signal well.  This is due to getting more preamble signal energy and because longer preambles make it easier to detect stuff like carrier offset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Barker sequences are nice for all the reasons you state, but they are also very limited.  The longest Barker sequence is 13 bits and there is only one of them.  The longest Barker sequence length that has two sequences is four, so you'd be limiting yourself to a four bit long preamble, which is not a very useful preamble.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may say to yourself, &quot;I could just use the same 13-bit Barker sequence for both the I and Q.&quot;  If you do that, though, you have made a BPSK constellation, only you've rotated it by $\frac{\pi}{4}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use a QPSK preamble, then I would use pseudo-random sequences from linear feedback shift registers (LFSR's).  You can find the polynomials for maximal length LFSR's &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_feedback_shift_register#Some_polynomials_for_maximal_LFSRs&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-09-23T18:18:02.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26011" PostTypeId="2" ParentId="26008" CreationDate="2015-09-23T19:29:28.587" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The system has zero time delay (sampling, calculations, etc. are instantaneous)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is an invalid assumption. Almost every digital system has at least one sample delay. DAC and ADC or clocked off the same master clock. So at sample time n, the ADC is acquiring sample n while at the same time the DAC is outputting sample n-1. The only way around this is using a much higher master clock, donwsampling that clock and clocking the A/D and D/A on different phases. However that's equivalent to running at a higher sample rate in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your ability to cancel is given by how much the amplitude of the sine wave changes during 1 sample. The residual signal is simply given by $$e(t) = \sin(f_0 \cdot t) - \sin(f_0 \cdot (t-T_s)) = 2 \cdot \cos(f_0 \cdot (t- T_s/2)) \cdot \sin(f_0 \cdot T_s/2)$$&#xA; where $T_s = 1/f_s$ is the sample time. The error is simply a function of the ratio of signal frequency and sample rate. For $f_0 &amp;lt;&amp;lt; f_s$ the error is very small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way to get around this is to crank up the sample rate or use some a priori knowledge of the signal to do some prediction and speculative cancellation.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="80" LastEditDate="2015-09-23T19:44:13.307" LastActivityDate="2015-09-23T19:44:13.307" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26012" PostTypeId="2" ParentId="8673" CreationDate="2015-09-23T20:29:56.377" Score="2" Body="&lt;p&gt;For the phase between 2 blocks of sinusoidal data, block1 and block2:&#xA;(using classical phase detector mapping)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase in degrees= 90- 90*mean(sign(block1-mean(block1))* sign(block2-mean(block2)))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the above is for phase angles between 0 and 180 degrees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For angles between 180 and 360 degrees:&#xA;Phase in degrees = 270 + 90*mean(sign(block1-mean(block1))* sign(block2-mean(block2)))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach converts the sine waves to normalized square waves (value of +/-1). If you multiple two square waves in the time domain, the time domain average will be linearly proportional to the phase between the square waves. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The plot shows truth vs an estimate generated from the &lt;code&gt;scilab&lt;/code&gt; code below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/16CNv.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/16CNv.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;scilab&lt;/code&gt; code for implementing this idea&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//8673&#xA;&#xA;T=1000;&#xA;t = [0:T-1];&#xA;&#xA;omega = 2*%pi*0.398374982349;&#xA;phi1 = 0;&#xA;x1 = sin(omega*t + phi1);&#xA;&#xA;phase_est = [];&#xA;phases = -180:180;&#xA;&#xA;for phase_in_degrees = phases,&#xA;&#xA;    phi2 = 2*%pi*phase_in_degrees/360;&#xA;    x2 = sin(omega*t + phi2); &#xA;&#xA;&#xA;    if (phase_in_degrees &amp;gt; 0)&#xA;        phase_est = [phase_est; phase_in_degrees (90 - 90*mean(sign(x1 - mean(x1)).*sign(x2 - mean(x2))))]&#xA;    else&#xA;        phase_est = [phase_est; phase_in_degrees (-90 + 90*mean(sign(x1 - mean(x1)).*sign(x2 - mean(x2))))]&#xA;    end    &#xA;end&#xA;&#xA;clf&#xA;subplot(211)&#xA;plot(phases, phase_est')&#xA;title('Plot of true phase and estimated phase')&#xA;subplot(212)&#xA;plot(phases, phase_est(:,1) - phase_est(:,2))&#xA;title('Plot of error between truth and estimate')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17504" LastEditorUserId="80" LastEditDate="2015-09-23T21:13:07.467" LastActivityDate="2015-09-23T21:13:07.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26013" PostTypeId="2" ParentId="26006" CreationDate="2015-09-23T20:40:05.620" Score="2" Body="&lt;p&gt;For a lower quality frequency estimate, but still more precise than just using the (center) frequency of the peak magnitude DFT result bin, try using parabolic interpolation (using 3 neighboring points) of the spectral peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't get the phase from a DFT magnitude-only plot.  For phase you will need an estimator that uses the complex DFT results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a higher quality estimate, including a phase estimate, try using windowed-Sinc interpolation of the complex DFT result components, perhaps followed by successive approximation to find a better estimate of the magnitude peak near the peak DFT bin.  The quality of the estimate will vary with the width of the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equivalent to Sinc interpolation would be to use a much longer zero-padded DFT or FFT to get more closely spaced frequency points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few added comments regarding the above frequency estimation methods on my &lt;a href=&quot;http://www.nicholson.com/rhn/dsp.html#1&quot; rel=&quot;nofollow&quot;&gt;blog&lt;/a&gt;:&#xA;&lt;a href=&quot;http://www.nicholson.com/rhn/dsp.html#1&quot; rel=&quot;nofollow&quot;&gt;http://www.nicholson.com/rhn/dsp.html#1&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that near DC or Fs/2 (closer than the width of your interpolation kernel), you may need to use a mirrored interpolation kernel.  Note that hybrid methods are possible: e.g. using Sinc interpolation to up the resolution by 4X or 10X, then using parabolic or higher-degree polynomial interpolation to estimate the peak location, then using Sinc interpolation to estimate the magnitude and phase at that estimated peak frequency.  etc. Note that sinusoidal phase estimation in noise will often be more accurate when the phase is referenced to the center of the DFT window (N/2), not to sample point 0.  Referencing phase to the center of a data vector can be done using some form of fftShift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question does not ask about frequency estimators that do not involve a DFT, but note that in zero noise, only 3 or 4 unaliased points are required to solve for 3 unknowns (frequency, magnitude and phase of a pure unmodulated sinusoid).  See: &lt;a href=&quot;http://www.claysturner.com/dsp/3pointfrequency.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.claysturner.com/dsp/3pointfrequency.pdf&lt;/a&gt; and &lt;a href=&quot;http://www.claysturner.com/dsp/4pointfrequency.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.claysturner.com/dsp/4pointfrequency.pdf&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-09-23T21:02:23.347" LastActivityDate="2015-09-23T21:02:23.347" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26014" PostTypeId="1" AcceptedAnswerId="26015" CreationDate="2015-09-23T21:09:25.017" Score="0" ViewCount="1353" Body="&lt;p&gt;I run bandpass filtering via the &lt;code&gt;butter()&lt;/code&gt; in matlab to apply butterworth bandpass filtering to find out the signals are centered at zero after the filter. Would this always happen for any kind of low/high-pass filtering and why?&lt;/p&gt;&#xA;" OwnerUserId="17506" LastActivityDate="2015-09-23T21:14:53.517" Title="why bandpass filtering (butterworth) centers the signal" Tags="|filters|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26015" PostTypeId="2" ParentId="26014" CreationDate="2015-09-23T21:14:53.517" Score="3" Body="&lt;p&gt;High pass filtering means that low-frequencies, including DC, are removed. So if your signal has a DC offset (is not zero mean), then this will be removed by a highpass filter or a bandpass filter that does not include 0 in the passband.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-23T21:14:53.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26017" PostTypeId="1" CreationDate="2015-09-23T22:11:49.587" Score="1" ViewCount="711" Body="&lt;p&gt;This question pertains to frequency domain filtering. I'd like to multiply an IIR filter's frequency response by a buffer of samples that have been FFT'd. I get how I'd evaluate an FIR, I'd FFT and zero-pad it (is this assumption correct?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an IIR would I just evaluate the impulse response of the IIR for a sequence 1 followed by N zeros where N is the length of the FFT, and then FFT that impulse response. Is this the right approach? Don't want to go too far down the rabbit hole without catching any caveats beforehand.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-09-23T22:11:49.587" Title="How to compute DFT of IIR" Tags="|fft|infinite-impulse-response|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26018" PostTypeId="2" ParentId="22586" CreationDate="2015-09-24T00:08:48.320" Score="1" Body="&lt;p&gt;You might be interested in &lt;a href=&quot;http://htk.eng.cam.ac.uk/&quot; rel=&quot;nofollow&quot;&gt;Hidden Markov Model Toolkit HTK&lt;/a&gt;. It is already developed and ready to use so you could compare your results with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The link to the tutorial in Nikolay's answer should really be everything you need to begin with. I've made my own MFCC function in MATLAB based on this tutorial and I was very close to HTK. There are some differences in terms of input parameters, filter banks, minimum and maximum frequency but idea is exactly the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, if you decided to use it, you could try &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/32849-htk-mfcc-matlab&quot; rel=&quot;nofollow&quot;&gt;HTK MFCC MATLAB&lt;/a&gt; or &lt;a href=&quot;https://www.ee.columbia.edu/~dpwe/resources/matlab/rastamat/&quot; rel=&quot;nofollow&quot;&gt;PLP and RASTA (and MFCC, and inversion) in Matlab&#xA;using melfcc.m and invmelfcc.m&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4721" LastActivityDate="2015-09-24T00:08:48.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26019" PostTypeId="1" AcceptedAnswerId="26054" CreationDate="2015-09-24T00:49:17.020" Score="6" ViewCount="3867" Body="&lt;p&gt;Some implementations of MFCC apply sinusoidal liftering as the final step in calculations of MFCC. It is claimed that speech recognition can be significantly improved. For instance, if $\text{MFCC}_i$ is a cepstral coefficient, and $w$ is a lifter, then&#xA;$$\widehat{\text{MFCC}_i}=w_i\text{MFCC}_i$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is a liftered cepstral coefficient, where $w_i$ for sinusoidal liftering is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w_i=1+\frac{D}{2}\sin\Big(\frac{\pi i}{D}\Big)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I look at the equation, I understand the sinusoidal function has a shape such that its maximum is in the middle and approaches to zero at edges. Therefore, cepstral vector's first and the last coefficients are is reduced to zero while the middle one is intact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is liftering applied and how does it improve the speech recognition?&lt;/p&gt;&#xA;" OwnerUserId="4721" LastEditorUserId="4721" LastEditDate="2017-01-03T18:11:27.403" LastActivityDate="2021-02-19T19:03:27.103" Title="Sinusoidal liftering in implementations of MFCC" Tags="|mfcc|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26020" PostTypeId="2" ParentId="26006" CreationDate="2015-09-24T03:52:43.513" Score="-2" Body="&lt;h1&gt;Finding the peak frequency&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Your frequency resolution $\Delta f$ is directly related to the amount of samples and the aquisition frequency like this: $\Delta f = \frac{f_A}{N}$ with $N$ being the amount of samples of your signal, and $f_A$ being the sample aquisition frequency.&lt;br&gt;&#xA;Thus, to increase your frequency resolution you can either decrease the aquisition frequency (Make sure to not drop below the nyquist frequency of your signal though), or increase the amount of samples.&lt;br&gt;&#xA;There are 2 ways to accomplish the latter:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Increase Aquisition Time&lt;br&gt;&#xA;This is pretty obvious. If you observe the signal for a longer period, you get more information about the signal, but aquiring more samples isn't always possible.&lt;/li&gt;&#xA;&lt;li&gt;Zero-Padding&lt;br&gt;&#xA;By adding zeros to your signal you can artifically elongate your aquisition time, thus generating more samples and lowering $\Delta f$. Zero-padding your signal doesn't change the information content, and is thus the most precise way to find the peak frequency.  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h1&gt;Phase and Amplitude&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Your image shows a magnitude plot of your DFT. This means that for each complex value $Y_k$ of the DFT only $\left|Y_k\right|$ is plotted. Assuming that you actually do get complex values in mathematica, and this is just the way the plotting method operates, here's what you do:&lt;br&gt;&#xA;You can obtain the amplitude of a given frequency-value $Y_k$ by taking the absolute $\left|Y_k\right|$. To get the phase, you get the complex argument $\arg{Y_k}$.&lt;/p&gt;&#xA;" OwnerUserId="17513" LastEditorUserId="17513" LastEditDate="2015-09-24T18:16:58.003" LastActivityDate="2015-09-24T18:16:58.003" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26021" PostTypeId="1" AcceptedAnswerId="26031" CreationDate="2015-09-24T10:28:06.773" Score="1" ViewCount="857" Body="&lt;p&gt;We usually talk about &quot;spectral analysis&quot; but some resources (&lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/016516849390090W&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; or &lt;a href=&quot;http://www.alma.inaf.it/images/Moments.pdf&quot; rel=&quot;nofollow&quot;&gt;this doc&lt;/a&gt;) talk about &quot;spectral line analysis&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this make sense to you, i.e. are the 2 fields actually different or the 2 names refer to the same thing?&lt;/p&gt;&#xA;" OwnerUserId="17516" LastActivityDate="2015-10-21T14:41:33.343" Title="Spectral Analysis vs. Spectral Line Analysis" Tags="|frequency-spectrum|power-spectral-density|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26022" PostTypeId="1" AcceptedAnswerId="26030" CreationDate="2015-09-24T10:34:56.330" Score="3" ViewCount="120" Body="&lt;p&gt;Any function $f \in PW_{\pi}$ (where $PW_{\pi}$ is the Paley-Wiener space), can be expanded in terms of the orthonormal basis $\{e^{i n x}\}_{n\in \mathbb Z}$ as&#xA;$$\hat{f}(x)=\sum_{n\in \mathbb Z}\left\langle\hat{f},e^{i n x}\right\rangle_{L^2(-\pi,\pi)} e^{i n x}$$&#xA;where $\langle g, h\rangle_{L^2(-\pi,\pi)}=\frac{1}{2\pi}\int_{-\pi}^\pi g(x) \overline{h(x)} dx$. Taking the inverse Fourier transform in previous equation, we obtain the Whittaker-Kotelnikov-Shannon (WKS) sampling theorem,&#xA;$$f(x)=\sum_{n\in \mathbb Z}f(n) \operatorname{sinc}(x-n), \ \ \ x\in \mathbb R$$&#xA;where $\operatorname{sinc}(x)$ is the normalized sinc function. My question is the following. Sampling theorem, at least in the version that I wrote above, is related to $L^2$ space and so, to scalar product:&#xA;$$\langle g, h\rangle_{L^2(-\pi,\pi)}=\frac{1}{2\pi}\int_{-\pi}^\pi g(x) \overline{h(x)} dx$$&#xA;Instead, usually, for power signals, we define the inner product to be&#xA;$$\left\langle g\,,\,h\right\rangle = \lim_{T\rightarrow \infty} \frac 1 {2T} \int_{-T}^T g(x)\overline{h(x)}\,dx \tag{1}$$&#xA;Is there a version of Sampling theorem related to scalar product (1)? Is it used in signal processing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References and answers are welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I premise that I'm not an expert on the signal theory, therefore I do apologise if this question isn't much precise.)&lt;/p&gt;&#xA;" OwnerUserId="17183" LastActivityDate="2015-09-24T14:53:09.000" Title="A Sampling theorem for power signals" Tags="|sampling|reference-request|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26024" PostTypeId="1" CreationDate="2015-09-24T11:25:54.373" Score="1" ViewCount="706" Body="&lt;p&gt;How can I perform the inverse z-transform on the following $H(z)$ to be able to calculate a &lt;strong&gt;real-valued impulse response&lt;/strong&gt; $h[n]$?&#xA;$$&#xA;H(z)=\frac{z^2}{z^2+0.8\sqrt{2}z+0.64}&#xA;$$&#xA;My idea was to find an inverse z-transform on my list of transformations, which basically does what I want with a similar transfer function (nothing too special about that idea). Well, I found the following:&#xA;$$&#xA;H(z)=\frac{p z \sin(\alpha)}{z^2-2p z \cos(\alpha)+p^2}&#xA;$$&#xA;I then tried to adjust the transfer function. First I did that for the denominator and found it had a pair of complex conjugate poles $0.8e^{+j\frac{3\pi}{4}}$, and $0.8e^{-j\frac{3\pi}{4}}$. That seems great, my desired form of the transfer function has similar poles $pe^{+j\alpha}$, and $pe^{-j\alpha}$. Therefore I would substitute $p=0.8$ and $\alpha=\frac{3\pi}{4}$. But now I don't know how to go further, what do I do with the numerator? Is this approach valid at all?&lt;/p&gt;&#xA;" OwnerUserId="14887" LastEditorUserId="14887" LastEditDate="2015-09-24T15:12:45.603" LastActivityDate="2015-09-24T15:12:45.603" Title="Inverse z transform - Pair of complex conjugate poles" Tags="|discrete-signals|impulse-response|z-transform|poles-zeros|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26025" PostTypeId="1" CreationDate="2015-09-24T11:51:37.733" Score="2" ViewCount="528" Body="&lt;p&gt;I have a PPG signal sampled at 50Hz and I want to filter the signal using Lynn's integer filter. I.e &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;  H(z)=\frac{(1-1/z^m)^2}{(1-1/z)^2}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cutoff frequency is 5Hz, so this gives value of $m \approx 3 $ (it's a 3db cutoff) and hence the difference equation is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;y[n]-2y[n-1]+y[n-2]=x[n]-2x[n-3]+x[n-6] &#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now applying this filter to the signal, my signal is filtered but there is some linear component that's making baseline to increase linearly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SPPGF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SPPGF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion where I am going wrong? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data is processed on cortex M0 based bluetooth module and transmitted to phone. I am plotting csv file in Matlab. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code of cortex M0:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float process_ppg_iir(uint16_t raw_data_ppg)&#xA;{&#xA;    int b0=1, b1=-2, b2=1, a1=-2; &#xA;    int a2 = 1;&#xA;&#xA;    if( global_sample_counter &amp;lt;= 7-1 )&#xA;    {&#xA;        ppg_raw[global_sample_counter] = raw_data_ppg;&#xA;        if(global_sample_counter &amp;lt;=3-1)&#xA;        ppg_processed[global_sample_counter] = raw_data_ppg;&#xA;        global_sample_counter++;&#xA;    }&#xA;    else&#xA;    {&#xA;        // sfit values to left&#xA;&#xA;        int i=0;&#xA;&#xA;        for(i=0 ;i &amp;lt;=5;i++)&#xA;        {&#xA;            ppg_raw[i] = ppg_raw[i+1];&#xA;        }&#xA;&#xA;        ppg_processed[0] = ppg_processed[1];&#xA;        ppg_processed[1] = ppg_processed[2];&#xA;&#xA;        ppg_raw[6] = raw_data_ppg;&#xA;        ppg_processed[2] = (b0*ppg_raw[6]+b1*ppg_raw[3]+b2*ppg_raw[0])- a1*ppg_processed[1]-a2*ppg_processed[0];&#xA;&#xA;    }&#xA;        return ppg_processed[2];    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16571" LastEditorDisplayName="user11906" LastEditDate="2015-11-25T07:36:11.733" LastActivityDate="2017-05-18T16:38:25.643" Title="Lynn's integer filter has a linearly increasing trend" Tags="|filters|infinite-impulse-response|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26026" PostTypeId="1" CreationDate="2015-09-24T12:08:34.847" Score="1" ViewCount="619" Body="&lt;p&gt;I am not sure if this is the right stackexchange community for this question, but here goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am generating a &lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_random_field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian Random Field&lt;/a&gt; (GRF) of a pre-defined power spectrum. In the image below, the input power spectrum is shown (in each panel) as the solid, smooth red line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a sanity check, I get the power spectrum of the resulting realised GRF. In the image below, I show this power spectrum for the &lt;em&gt;original&lt;/em&gt;, &lt;em&gt;high resolution&lt;/em&gt; random field realization in the &lt;strong&gt;upper right panel&lt;/strong&gt; in blue. As we can see, it follows the input spectrum closely, as required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for an application I want to downsample the original image (by a factor of 2; that is, every 2x2 block of pixels becomes one pixel in the new image). If I then take the power spectrum of this &lt;em&gt;downsampled&lt;/em&gt; (and thus lower-resolution) image, it does not follow the input power spectrum anymore; this is shown in the &lt;strong&gt;lower-left panel&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first instinct was that this might be a resolution effect. Therefore, I generated another realization of the GRF, but this time at a lower resolution (indeed the same resolution as the &lt;em&gt;downsampled&lt;/em&gt; image). If it was a resolution effect, this power spectrum should display the same discrepancy. It does not, however: in the &lt;strong&gt;lower right panel&lt;/strong&gt; you can see that this lower resoltuion spectrum also follows the input spectrum closely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which leads me to believe that the discrepancy is caused solely by the downsampling. This is puzzling to me however, since downsampling seems so straightforward (perhaps deceptively so). &#xA;Below, I also give the (python) code used to downsample the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, rephrasing my question for clarity: &lt;strong&gt;Why is the power spectrum of the downsampled image not in qualitative agreement with the original power spectrum?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rgKQZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rgKQZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;def downsample(self,im, fact=4):&#xA;    &quot;&quot;&quot;&#xA;    Downsample an image. Default with 2x2 blocks, but this can be adjusted if desired&#xA;    Needed because first we generate at high res, then apply lensing,&#xA;    then downsample to Planck resolution&#xA;    &quot;&quot;&quot;&#xA;    assert isinstance(fact, int), type(fact)&#xA;    sx, sy = im.shape&#xA;    X, Y = np.ogrid[0:sx, 0:sy]&#xA;    regions = sy/fact * (X/fact) + Y/fact&#xA;    res = ndimage.sum(im, labels=regions, index=np.arange(regions.max()+1))&#xA;    res.shape = (sx/fact, sy/fact)&#xA;    self.downsampled = res&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="17359" LastActivityDate="2018-08-10T15:02:42.943" Title="Power spectrum of downsampled image" Tags="|power-spectral-density|gaussian|downsampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26027" PostTypeId="1" CreationDate="2015-09-24T13:23:49.020" Score="2" ViewCount="1308" Body="&lt;p&gt;I am learning about control theory.&lt;br&gt;&#xA;Let's consider this system.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;m a(t) + b v(t) + k x(t) = f(t)  &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a$ is acceleration&lt;br&gt;&#xA;$v$ is velocity&lt;br&gt;&#xA;$x$ is displacement&lt;br&gt;&#xA;$f$ is external force &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my textbook, in chapter about &quot;state space model&quot; , two state variables ($x$ and $v$) are necessary&lt;br&gt;&#xA;to completely describe this system.&lt;br&gt;&#xA;However, I think $x$ can completely describe this mass's motion by itself.&lt;br&gt;&#xA;If we know $x$, $v$ can derived from $x$.&lt;br&gt;&#xA;So I have two questions.  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why two variables are needed.  &lt;/li&gt;&#xA;&lt;li&gt;Why &quot;$x$ and $v$&quot; ?  Can &quot;$v$ and $a$&quot; or &quot;$x$ and $a$&quot; also describe this system ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerDisplayName="user15151" LastEditorUserId="80" LastEditDate="2015-09-24T13:38:29.373" LastActivityDate="2022-09-24T12:20:36.273" Title="Why is it necessary to have two state variables" Tags="|linear-systems|control-systems|state-space|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26028" PostTypeId="2" ParentId="26027" CreationDate="2015-09-24T14:13:04.000" Score="3" Body="&lt;p&gt;Let's rewrite your system as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;m \ddot{x}(t) + b \dot{x}(t) + k x(t) = f(t)  &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then you can see what you're saying: &lt;strong&gt;Everything I need to know is in $x(t)$!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is it really?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;State space systems are predicated on having a single, first order differential equation to solve.  As you can see in the rewritten equation above, there is a double-derivative term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to write that equation as a first order equation, we need to have &lt;strong&gt;two&lt;/strong&gt; state variables:&#xA;$$&#xA;X(t) = \left[ \begin{array}{c} x\\ \dot{x} \end{array} \right]&#xA;$$&#xA;and so&#xA;$$&#xA;A\dot{X}(t) + B X(t) = f(t)&#xA;$$&#xA;where $A=[b\ m]$ and $B=[k\ 0]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's try to do the same thing using $x$ and $\ddot{x}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;X'(t) = \left[ \begin{array}{c} x\\ \ddot{x} \end{array} \right]&#xA;$$&#xA;and so&#xA;$$&#xA;A'\dot{X'}(t) + B' X'(t) = f(t)&#xA;$$&#xA;where $A'=[b\ 0]$ and $B'=[k\ m]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I suppose you &lt;em&gt;could&lt;/em&gt; chose the state variables to be $x$ and $\ddot{x}$... but it would mean an unused $\dddot{x}$ variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://web.mit.edu/2.151/www/Handouts/FirstSecondOrder.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Some examples of first order systems can be found in this document.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pbmla.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pbmla.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-09-24T15:15:33.117" LastActivityDate="2015-09-24T15:15:33.117" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26029" PostTypeId="2" ParentId="26025" CreationDate="2015-09-24T14:42:58.117" Score="1" Body="&lt;p&gt;This is a FIR filter implemented as a recursive filter (rather than a transversal filter with all 9 coefficients).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $H(z)$ can be written as the cascade of two backward differences and two accumulators:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = (1-z^{-3}) \cdot (1-z^{-3}) \cdot \frac{1}{1-z^{-1}} \cdot \frac{1}{1-z^{-1}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two zero-pole cancellations at $z=1$, which make the overall system stable (by removing the poles introduced by the accumulators).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, it is very important to start the filter with the correct initial conditions (for example, $y[n]=0 \; \forall n&amp;lt;0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are starting your filter with arbitrary values for the unit delays. This is inside the &lt;code&gt;if&lt;/code&gt; statement, where you fill initial conditions with the actual incoming data (e.g. &lt;code&gt;ppg_processed[] = raw_data_ppg&lt;/code&gt;). This is wrong.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-09-24T14:42:58.117" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26030" PostTypeId="2" ParentId="26022" CreationDate="2015-09-24T14:53:09.000" Score="1" Body="&lt;p&gt;Interesting question! The only example I could easily find is &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=6F95C74B0EA5F20A8B8D3309462E9F03?doi=10.1.1.325.5179&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Casinovi, G., &quot;Sampling and Ergodic Theorems for Weakly Almost Periodic Signals,&quot; in &lt;em&gt;Information Theory, IEEE Transactions on&lt;/em&gt;, vol.55, no.4, pp.1883-1897, April 2009&#xA;doi: 10.1109/TIT.2009.2013021&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-24T14:53:09.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26031" PostTypeId="2" ParentId="26021" CreationDate="2015-09-24T14:55:14.457" Score="1" Body="&lt;p&gt;Spectrum analysis is more general: it involves looking at the entire spectrum of a given signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectral line analysis assumes that the spectrum contains several peaks (lines) of interest at specific frequencies.  The aim then is to find the precise frequency, magnitude, and phase of those peaks (lines).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-24T14:55:14.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26032" PostTypeId="1" CreationDate="2015-09-24T16:25:25.933" Score="1" ViewCount="115" Body="&lt;p&gt;Lets say I receive the signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)\cos(\omega_c t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I want to change the the carrier frequency $x(t)\cos(1.001\omega_c t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be done? If I modulated it with a complex exponential, increasing or decreasing the modulation frequency would have been simple, however I could not figure out a simple way of doing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it even possible to do this without filtering?&lt;/p&gt;&#xA;" OwnerUserId="16852" LastActivityDate="2015-09-25T12:49:10.603" Title="Given a real signal, increase modulation frequency" Tags="|frequency|modulation|demodulation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26035" PostTypeId="2" ParentId="26032" CreationDate="2015-09-24T17:27:40.410" Score="4" Body="&lt;p&gt;You can simply multiply by another cosine: $x(t)\cos(2\pi f_ct)\cos(2\pi 0.001f_ct)=x(t)\cos(2\pi0.999f_ct)+x(t)\cos(2\pi1.001f_ct)$ (ignoring scale factors). If $x(t)$ is very narrow in frequency, so that the spectra of the two terms above don't overlap, you can use a high-pass filter to do what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $x(t)$ is not narrowband enough, you can shift $x(t)\cos(2\pi f_ct)$ two times. With adequate filtering, you will obtain the desired shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply multiplying by a complex exponential is not going to work, since it will shift the entire spectrum of $x(t)$ up or down, and the resulting signal will be complex. You want to shift the positive frequencies of $x(t)$ &quot;to the right&quot;, and its negative frequencies &quot;to the left&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can use the complex exponential in the following way: Filter out all the negative frequencies of the modulated signal (using for instance the Hilbert transform), and up-convert them using a complex exponential. Then, filter out all the positive frequencies, and down-convert the result. Then, add the down-converted and up-converted signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your options are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use one or two cosine signals and a few filters (all real).&lt;/li&gt;&#xA;&lt;li&gt;Use two complex filters and two complex exponentials.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-09-24T20:21:01.017" LastActivityDate="2015-09-24T20:21:01.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26036" PostTypeId="2" ParentId="26026" CreationDate="2015-09-24T17:46:45.547" Score="1" Body="&lt;p&gt;I have solved the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I was taking the sum of 4 pixels in downsampling, what I was doing in effect was convolving with a sum of delta functions (that is, one delta function for each pixel). In Fourier space this translates to multiplying with a cosine, which explains the increasingly strong (relative) discrepancy between input and observed power spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To mitigate this, &lt;a href=&quot;https://en.wikipedia.org/wiki/Decimation_%28signal_processing%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; helped me out. If we first implement a lowpass filter in Fourier space (filtering out high frequencies, to avoid aliasing later on), and then reduce the sampling rate (to 1 in 4 pixels), we get the desired result, and indeed: the observed power spectrum looks nice up until the cutoff:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lbX4i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lbX4i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17359" LastActivityDate="2015-09-24T17:46:45.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26037" PostTypeId="1" CreationDate="2015-09-24T18:01:40.060" Score="0" ViewCount="1222" Body="&lt;p&gt;For increasing the image size from 8X8 to 32X32, I tried to do zero padding. The simplest concept of zero padding in Java for me seems to be the code as shown below in Java such that I can shift each point by 4 points while rescaling.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int i = 0; i &amp;lt; imageWidth; i += 4) &#xA;        for (int j = 0; j &amp;lt; imageHeight; j += 4) &#xA;            pspectrum[i][j] = powerspectrum[(i + 1)/4][(j + 1)/4];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, what I am mainly concerned is that is there any more accurate method and how this helps with my calculation.&lt;/p&gt;&#xA;" OwnerUserId="15755" LastActivityDate="2015-09-25T06:25:13.930" Title="How can I increase image size by zero padding?" Tags="|image-processing|zero-padding|java|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26038" PostTypeId="2" ParentId="26027" CreationDate="2015-09-24T18:06:48.827" Score="1" Body="&lt;p&gt;$v$ cannot be derived from a single $x$ at $t_0$.  Once you use require more information than one $x$ at $t_0$ to compute $v$, and thus the momentum, you've added to what you need to describe the state of the system.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="80" LastEditDate="2015-10-24T20:29:11.187" LastActivityDate="2015-10-24T20:29:11.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26039" PostTypeId="1" CreationDate="2015-09-24T18:21:59.067" Score="-1" ViewCount="600" Body="&lt;p&gt;Let's say you have a system with 1 transmitter and 5 receivers. We'll use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Multiple_signal_classification&quot; rel=&quot;nofollow&quot;&gt;MUSIC&lt;/a&gt; algorithm to determine DOA of incoming signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have 1 signal (at 0° for example), it's easy to calculate RMSE vs SNR. Simply take the peak of the MUSIC spectrum (an angle) and find the difference between the actual target angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what if we have 2 signals? One at 0° and a second at 10° for example. You can no longer look at the MUSIC spectrum and simply pick the 2 greatest points, since the absolute greatest points may be at 0.0° and 0.1°, even if there's a clear (lower) peak at 10°.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the/an appropriate way to measure the error when multiple signals are present? Or perhaps another metric (besides RMSE) is needed, such as probability of observing 2 peaks, etc.&lt;/p&gt;&#xA;" OwnerUserId="17525" LastActivityDate="2022-03-30T18:03:00.223" Title="How do you calculate RMSE in degrees for a DOA estimator system with multiple incoming signals?" Tags="|music|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26040" PostTypeId="2" ParentId="25995" CreationDate="2015-09-24T18:41:20.023" Score="-1" Body="&lt;p&gt;Well image alignment is quite general, some techniques for get the disparity use image alignment in small regions, and they can estimate the disparity by using those methods. And depending on the technique of image alignment is what you are going to obtain, if you are using the borders of the image then the process is going to find the best match for the edges no matters if the images looks very similar or not. And you have to consider that in stereo pairs you are going to have occlusions in images that can be translated to missmatching issues.&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-09-24T18:41:20.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26041" PostTypeId="2" ParentId="25995" CreationDate="2015-09-24T19:56:20.803" Score="2" Body="&lt;p&gt;There two ways to look at this problem.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In simple terms, image rectification warps both images onto a common coordinate frame by typically estimating the transformation using the epipolar geometry.&lt;/p&gt;&#xA;&lt;p&gt;Image alignment finds the transformation from one image to the other. It doesn't guarantee any constrains on the epipolar geometry and only one single image is warped.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Image rectification might benefit from image alignment (of local patches) to obtain the correspondences. Once these are found, the epipolar lines can be forced to be parallel.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-09-24T19:56:20.803" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26043" PostTypeId="1" CreationDate="2015-09-24T20:35:14.300" Score="1" ViewCount="142" Body="&lt;p&gt;My initial image is a medical image and my main objective is finding directionality. The original size of my image was 8X8 and I have rescaled the image to 32X32 to increase my accuracy. My input image is Fourier Transform Power Spectrum and my main objective is finding directionality. I want to window my image of size 32X32 as an image pre-processing approach. I want to implement the circularly symmetric window in Java. My main concern is that which window should I use and how can I implement? I tried to use the Gaussian window for my image. But, as I apply the Gaussian window, the whole meaning of my image changes. Am I doing something wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gGOlM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gGOlM.png&quot; alt=&quot;Original Fourier Transform Power Spectrum and rescaled images&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have implemented my Gaussian Window in Java as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    double value = 0;&#xA;    double distance = 0;&#xA;    double x_center = (imageWidth - 1) * 0.5;&#xA;    double y_center = (imageHeight - 1) * 0.5;&#xA;    double cutoff = 2;&#xA;    double dc_level = 255;&#xA;    for (int i = 0; i &amp;lt; image.getWidth(); i++) {&#xA;        for (int j = 0; j &amp;lt; image.getHeight(); j++) {&#xA;            distance = Math.sqrt(Math.pow(Math.abs(i - x_center), 2)&#xA;                    + Math.pow(Math.abs(j - y_center), 2));&#xA;            value = dc_level * Math.exp(-1 * distance * distance)&#xA;                    / (1.442695 * cutoff * cutoff);&#xA;            powerspectrum[i][j] = (int) value;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thank you so much for your help.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15755" LastEditorUserId="15755" LastEditDate="2015-09-24T22:36:29.587" LastActivityDate="2016-04-28T10:42:59.627" Title="How can I implement image widowing in my image in Java?" Tags="|image-processing|gaussian|java|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26044" PostTypeId="2" ParentId="25957" CreationDate="2015-09-24T20:48:35.120" Score="0" Body="&lt;p&gt;To the first question, the answer is no. Take a Dirac-like image, i.e. zero everywhere except for one pixel. Its filtering by a Gaussian will be the same Gaussian. But any integer subsampling, starting with the appropriate shift, will be able to destroy the Dirac, and yield a zero image. Any subsequent filtering will not be capable of producing the above Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To the second question: does Gaussian blur lose information? No in theory, since the Gaussian kernel does not vanish in the frequency domain. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/Tn2ta.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tn2ta.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Theoretically, you could divide the blurred image (in the frequency domain) by the Fourier transform of your known Gaussian kernel and invert the Fourier transform. That is called the &quot;Division Bell &quot; (pun on you avatar picture) as the Gaussian is sometimes called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_curve&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell curve&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But yes in practice. You would be very lucky if you succeed: the image is of finite size, the kernel in generally approximately known, and you have noise. So due to the low amplitude spectrum of the Gaussian in high frequencies, noise is likely to blow up.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-09-24T21:00:52.983" LastActivityDate="2015-09-24T21:00:52.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26045" PostTypeId="1" AcceptedAnswerId="26294" CreationDate="2015-09-24T21:35:04.960" Score="0" ViewCount="56" Body="&lt;p&gt;I am not from an EE background, so I am looking for answers to some open-ended questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to calculate how fast water is flowing during a flood. With or maybe even without debris in it. I have footage video from which I can extract sec by sec images of changing landscape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be considered analogous to a car velocity estimation problem, except the &quot;object&quot; in the case of flood becomes much more complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I know about Optical Flow: &lt;a href=&quot;http://www.mathworks.com/discovery/optical-flow.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/discovery/optical-flow.html&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the latest advances in the field that might help me to accomplish my goal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips at all?&lt;/p&gt;&#xA;" OwnerUserId="17528" LastActivityDate="2015-10-08T09:27:54.880" Title="What would be the best way to estimate velocity from a video?" Tags="|image-processing|estimation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26048" PostTypeId="2" ParentId="26032" CreationDate="2015-09-25T02:38:57.617" Score="3" Body="&lt;p&gt;$$\cos(A\pm B) = \cos(A)\cos(B) \mp \sin(A)\sin(B)$$&#xA;and so $$2\cos(A)\cos(B) = \cos(A + B)+\cos(A - B).$$&#xA;It follows that &lt;em&gt;multiplying&lt;/em&gt; the received signal $x(t)\cos(\omega_c t)$&#xA;by $2\cos(1.001\omega_c t)$ will result in a signal&#xA;$x(t)\cos(1.001\omega_c t) + x(t)\cos(0.999\omega_c t)$.  The spectra of&#xA;the two components of the signal will overlap unless the bandwidth&#xA;of $x(t)$ is smaller than $0.0005\omega_c$ radians/second. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is no spectral overlap, passing the signal &#xA;$x(t)\cos(1.001\omega_c t) + x(t)\cos(0.999\omega_c t)$&#xA;through a bandstop or high-pass&#xA;filter that eliminates&#xA;$x(t)\cos(0.999\omega_c t)$ will work.  This is called &lt;em&gt;frequency&lt;/em&gt;&#xA;translation_ or mixing or heterodyning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there &lt;em&gt;is&lt;/em&gt; spectral overlap, then this simple method will not work. Instead, it is necessary to use it twice.&#xA;Multiply  $x(t)\cos(\omega_c t)$ by something like &#xA;$2\cos(\omega_c t)$ to get $x(t) + x(t)\cos(2\omega_c t)$,&#xA;filter out the baseband signal $x(t)$ to leave just the&#xA;double frequency component $x(t)\cos(2\omega_c t)$, and then &#xA;translate $x(t)\cos(2\omega_c t)$&#xA;down to $x(t)\cos(1.001\omega_c t)$ by multiplying it by&#xA;$2\cos(0.999\omega_c t)$ and then &lt;em&gt;low-pass&lt;/em&gt; filtering.  Note that&#xA;it is not really necessary to translate the signal to double the&#xA;carrier frequency. Any frequency large enough so that the two&#xA;signals resulting from the mixing can be separated by filtering&#xA;will do.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-09-25T12:49:10.603" LastActivityDate="2015-09-25T12:49:10.603" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26049" PostTypeId="2" ParentId="26037" CreationDate="2015-09-25T06:25:13.930" Score="2" Body="&lt;p&gt;I suppose the array names are not descriptive of the contents and you have simply repurposed them. To zero-pad from 8x8 to 32x32:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (int i = 0; i &amp;lt; 32; i++) &#xA;    for (int j = 0; j &amp;lt; 32; j++) &#xA;        pspectrum[i][j] = 0;&#xA;for (int i = 0; i &amp;lt; 8; i++) &#xA;    for (int j = 0; j &amp;lt; 8; j++) &#xA;        pspectrum[i][j] = powerspectrum[i][j];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The purpose of this is that the discrete Fourier transform (DFT) of a larger image has a higher frequency resolution, so you can resolve for example the dominant frequency more accurately. It is the same as really well done interpolation in the frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-09-25T06:25:13.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26050" PostTypeId="1" AcceptedAnswerId="26067" CreationDate="2015-09-25T09:49:14.463" Score="0" ViewCount="480" Body="&lt;p&gt;I was provided a report where the amplitudes of spectral harmonics have been extracted from several audio files. The amplitudes have been extracted using Audacity's spectrum visualizer, where the spectrum is provided in dB. I want to compute the ratio between the amplitude of the fundamental and the amplitude of each harmonic. Does it make sense to perform a ratio in dB or should I use the difference between amplitudes? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15543" LastActivityDate="2015-09-26T05:42:09.807" Title="How to represent ratio between harmonics in audio spectrum" Tags="|frequency-spectrum|fundamental-frequency|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26052" PostTypeId="2" ParentId="26050" CreationDate="2015-09-25T10:35:06.970" Score="2" Body="&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; what you are referring to is called the Total Harmonic Distortion (THD). THD is the level of the fundamental divided by the level of the harmonics.  You can express this as either as a ratio (X/Y), a percentage (X/Y * 100) or in dB (20*log10(X/Y)). A percentage is probably what most people are familiar with.&lt;/p&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-09-25T10:35:06.970" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26054" PostTypeId="2" ParentId="26019" CreationDate="2015-09-25T13:20:33.947" Score="5" Body="&lt;p&gt;&lt;a href=&quot;https://maxwell.ict.griffith.edu.au/spl/publications/papers/euro99_kkp_fbe.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt;&lt;/a&gt; suggests:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kCtST.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kCtST.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that the reason is because the filtered versions give less weight to the higher coefficients which provide less discrimination than the lower ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That paper references &lt;a href=&quot;https://www.ece.ucsb.edu/Faculty/Rabiner/ece259/Reprints/260_bandpass%20liftering.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;span class=&quot;math-container&quot;&gt;$^2$&lt;/span&gt;&lt;/a&gt; which shows the plot below indicating how the application of window reduces the variability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hmc8d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hmc8d.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;K.K. Paliwal &quot;DECORRELATED AND LIFTERED FILTER-BANK ENERGIES FOR ROBUST&#xA;SPEECH RECOGNITION&quot;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;B.H. Juang, L.R. Rabiner and J.G. Wilpon, &quot;On the use of bandpass liftering in speech recognition&quot;, &lt;em&gt;IEEE Trans. Acoust., Speech and Signal Processing&lt;/em&gt; Vol. ASSP-35, No. 7, pp. 947-954, July 1987.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="80" LastEditorUserId="39617" LastEditDate="2020-01-28T14:59:16.767" LastActivityDate="2020-01-28T14:59:16.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26055" PostTypeId="2" ParentId="25957" CreationDate="2015-09-25T14:55:34.170" Score="0" Body="&lt;p&gt;When you Gaussian blur an image, its spectrum sees its high frequencies decrease, following the Gaussian spectrum, so that their amplitude quickly falls under the quantization limit and can be considered zeroed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you subsampled over the Nyquist frequency, then perfect reconstruction of the blurred image is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, the allowed subsampling rate should be on the order of $\sigma/\sqrt{b}$, where $b$ is the number of significant bits.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And yes, Gaussian blur does lose information because of truncation (quantization) errors.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-09-25T15:06:41.440" LastActivityDate="2015-09-25T15:06:41.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26056" PostTypeId="1" AcceptedAnswerId="26057" CreationDate="2015-09-25T15:30:10.293" Score="0" ViewCount="176" Body="&lt;p&gt;I do Fourier Transform for an image, then consider line(slice) in FFT image. When that slice isn't parallel neither x- not y-axis, coordinates are not integer.&#xA;E.g. slice can hold indices &lt;code&gt;{(0,0), (0.25,1), (0.5,2), (0.75,3), (1,4)...}&lt;/code&gt;.&#xA;When using nearest-interpolation, quality of whatever I do is pure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What techniques can you suggest to improve interpolation in Fourier grid?    &lt;/p&gt;&#xA;" OwnerUserId="17028" LastActivityDate="2015-09-25T18:05:40.780" Title="How to interpolate complex array (FT)?" Tags="|image-processing|fft|interpolation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26057" PostTypeId="2" ParentId="26056" CreationDate="2015-09-25T18:05:40.780" Score="0" Body="&lt;p&gt;The usual way to do this is to interpolate using surrounding points.  There is a simple 6-point mechanism that uses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V4TPt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V4TPt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://math.stackexchange.com/questions/72155/how-to-interpolate-a-2d-function-with-6-points&quot;&gt;This question on the Mathematics SE site has some more details.&lt;/a&gt; Note the answer's correction to the equation in the question.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-09-25T18:05:40.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26058" PostTypeId="1" CreationDate="2015-09-25T18:22:17.500" Score="-1" ViewCount="228" Body="&lt;p&gt;The wireless encrypted communication works as sending the message signal (sinosoidal) along with 2 dummy signals(sinosoidal) of same frequencies same phase&#xA;but different amplitudes(assume no interference among 3 signals), it is known that the message signal has highest amplitude as compared to other 2 signals.&#xA;Now we have to recover the message signal.how to find it?&lt;/p&gt;&#xA;" OwnerUserId="17535" LastEditorUserId="13320" LastEditDate="2016-11-13T13:34:13.807" LastActivityDate="2016-11-13T13:34:13.807" Title="How to seperate 3 sinusoidal signal of same frequency and phase but different amplitude?" Tags="|continuous-signals|" AnswerCount="1" CommentCount="3" ClosedDate="2015-09-25T20:11:28.997" ContentLicense="CC BY-SA 3.0" />
  <row Id="26059" PostTypeId="2" ParentId="26058" CreationDate="2015-09-25T18:42:30.693" Score="4" Body="&lt;p&gt;Your question doesn't make any sense. What you're proposing is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;x(t) &amp;amp;= x_1(t) + x_2(t) + x_3(t) \\&#xA;&amp;amp;=A_1 \cos(\omega t + \phi) + A_2 \cos(\omega t + \phi) + A_3 \cos(\omega t + \phi) \\&#xA;&amp;amp;= (A_1 + A_2 + A_3) \cos(\omega t + \phi)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the other sinusoids are truly at the same frequency and phase, there's nothing to separate; the result is just a sinusoid with increased amplitude at the same frequency and phase.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-09-25T18:42:30.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26062" PostTypeId="1" AcceptedAnswerId="26066" CreationDate="2015-09-25T22:10:04.577" Score="7" ViewCount="7516" Body="&lt;p&gt;Perhaps a meta-question, but I'll post it here because some of you are bound to possess gold nuggets about continuing education. It might be closed for being subjective but I don't care because this community is small and this could be valuable info for visitors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from reading DSP.StackExchange questions and answers, I've been doing the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;MIT OCW Signals and Systems, but Oppenheim's lectures from the 80's and not the 2004 course, actually doing the problem sets, reviewing&#xA;the solutions, and really understanding where a process comes from&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Reviewing circuit analysis diagrams&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Taking the concepts from Signals and Systems and plotting / manipulating them in MATLAB&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course, there's no substitute for working on a project and having your *** on the line for not making it work, but things can only get better if your fundamentals are really solid, right?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="26573" LastEditDate="2018-09-04T20:47:54.457" LastActivityDate="2021-05-21T13:26:21.147" Title="What are your tips for DSP self-study?" Tags="|self-study|soft-question|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26063" PostTypeId="1" CreationDate="2015-09-26T01:33:14.453" Score="1" ViewCount="160" Body="&lt;p&gt;This is a simple image classification problem. I want to categorize jigsaw puzzle images to difficulty levels (e.g, easy, medium, hard).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to develop an simple algorithm for this classification, which is based on factors like large solid colored areas, repeating patterns on the image (&lt;a href=&quot;http://www.ulillillia.us/tipsntricks/jigsawpuzzledifficultytrick.shtml&quot; rel=&quot;nofollow&quot;&gt;more details&lt;/a&gt;). Such classification can be seen in following website.&#xA;&lt;a href=&quot;http://www.whitemountainpuzzles.com/Shop-by-Difficulty/departments/136/&quot; rel=&quot;nofollow&quot;&gt;example 1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to automate this without much human interventions. Is this possible and whats the best way to approach it. (not worried about performance, simple is good, does not need huge accuracy)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to generate the magnitude and phase plots of the 2d FFT. However, I am not clear how to come up with a classification by looking at magnitude plot. Any ideas. &lt;/p&gt;&#xA;" OwnerUserId="17539" LastEditorUserId="17539" LastEditDate="2015-09-26T09:28:52.210" LastActivityDate="2017-03-19T22:11:40.900" Title="Identify large solid color areas of image" Tags="|image-processing|image-segmentation|classification|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26064" PostTypeId="2" ParentId="24904" CreationDate="2015-09-26T02:27:27.850" Score="0" Body="&lt;p&gt;Take a signal defined on the real line, defined by the time location &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. Weight them locally at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; by the energy of the signal, or squared magnitude &lt;span class=&quot;math-container&quot;&gt;$s|(t)|^2$&lt;/span&gt;. A definition of &lt;strong&gt;some average time location of the signal&lt;/strong&gt; can then be set as its &lt;a href=&quot;https://en.wikipedia.org/wiki/Center_of_mass&quot; rel=&quot;nofollow noreferrer&quot;&gt;center of mass&lt;/a&gt;. You can either look at it as a balance point (the signal's energy would be balanced putting the time line at the tip of your finger), or at a summary: it would be somehow equivalent to concentrate all the signal's energy at this point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember the discrete version for the center of mass &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;for points &lt;span class=&quot;math-container&quot;&gt;$T_i$&lt;/span&gt; with weights &lt;span class=&quot;math-container&quot;&gt;$w_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sum_i w_i \neq 0$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_i w_i\vec{T_i M} = \vec{0}. $$&lt;/span&gt;&#xA;Now look at a continuous formula like:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$    \int \lvert s(t)\rvert^2 \left( m - t  \right) dt = 0$$&lt;/span&gt;&#xA;then the analogy is clear: &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; would be the center of mass of &quot;times&quot; taken with an infinite summation. Solving for &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; gives you:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$  m =  \langle t \rangle = \frac{\int t\lvert s(t)\rvert^2 dt}{\int \lvert s(t)\rvert^2 dt}= \int t \left(\frac{\lvert s(t)\rvert^2}{\int \lvert s(t)\rvert^2 dt}\right) dt.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2020-05-16T23:08:14.390" LastActivityDate="2020-05-16T23:08:14.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26065" PostTypeId="2" ParentId="26063" CreationDate="2015-09-26T03:20:26.323" Score="1" Body="&lt;p&gt;Perhaps you could classify the difficulty by assuming that higher spatial frequency implies higher difficulty.  Make sure all the images are the same size, do a 2D FFT, and look at the spatial bandwidth in x and y dimensions, would be my suggestion.  &lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-09-26T03:20:26.323" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26066" PostTypeId="2" ParentId="26062" CreationDate="2015-09-26T04:56:05.893" Score="21" Body="&lt;p&gt;Tips for DSP self-study huh. Well, ...studying 'signals and systems' is a great idea and having Matlab software means you have the tools to learn an awful lot. I think Dr. Steven Smith's book &quot;The Scientist and Engineer's Guide to Digital Signal Processing&quot;, which you can read online for free, is a terrific source of fundamental DSP information. Dr. Smith is a good writer. His book is at: &lt;a href=&quot;http://www.dspguide.com/pdfbook.htm&quot;&gt;http://www.dspguide.com/pdfbook.htm&lt;/a&gt;. Smith is a skilled working DSP engineer. That means he knows which end of the soldering iron is hot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regard to a free DSP textbook homework problems, I recently learned that Sophocles J. Orfanidis, the well-known professor with the ECE Department of Rutgers University, has made his signal processing textbook available for downloading on the Internet. The textbook is: &quot;Introduction to Signal Processing&quot; available at: &lt;a href=&quot;http://eceweb1.rutgers.edu/~orfanidi/intro2sp/&quot;&gt;http://eceweb1.rutgers.edu/~orfanidi/intro2sp/&lt;/a&gt;. Happily, also available at the above web site are:&#xA;(1) Errata for the Orfanidis textbook, (2) Orfanidis' Homework Solutions Manual, and (3) the errata for Orfanidis Solutions Manual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the risk of appearing tacky, you might consider my &quot;Understanding Digital Signal Processing&quot; textbook. It's been Amazon.com's top-selling DSP book for some years now. My book's been popular not because I'm any more DSP-skilled than other book authors---I can assure you that is not the case---but rather because I have some skill at explaining signal processing concepts from a working engineer's viewpoint rather than a university professor's strictly-mathematical viewpoint. My book costs money. However, I can assure you, I use the royalties from my book to buy milk and bread for my children.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So Anthony, learning the fundamentals of DSP through reading, performing lots and lots of Matlab modeling, and maintaining your enthusiasm, to quote Susan B. Anthony, &quot;Failure is impossible.&quot; Good Luck.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-26T04:56:05.893" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26067" PostTypeId="2" ParentId="26050" CreationDate="2015-09-26T05:42:09.807" Score="1" Body="&lt;p&gt;Based on your most recent comment, it sounds violins' like you're measuring harmonic levels from various violins. And you want to represent your measurements in the most appropriate way. The question is, &quot;What is the most appropriate way?&quot; To answer that question ask yourself, &quot;What information do I want to convey to my audience?&quot; Francesco, does your audience want to look at various violins' spectral plots, or maybe just look at bar charts of various violins' harmonic levels, or what?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can tell us exactly how you want to represent your measured harmonic dB results, I'll bet someone here can help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you're dealing with dB values, forget about any notion of computing ratios. Jaket is correct. If the measured dB value of the fundamental freq is 'x' dB and the measured dB value of the 1st harmonic freq is 'y' dB, then you can say that the 1st harmonic is x-y dB below the fundamental. That subtraction works fine for both positive and negative values of 'x' or 'y'.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-09-26T05:42:09.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26068" PostTypeId="1" CreationDate="2015-09-26T05:52:55.337" Score="4" ViewCount="5122" Body="&lt;p&gt;I've been looking at every tutorial and paper I can find, but I keep losing the intuition behind what's going on when they get into the matrix operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a step in which the signal vector is multiplied by its hermitian transpose and the correlation matrix of the product is computed. What do both of these steps accomplish from a high level?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is the 'e' term arising from in the steering vector?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also don't understand the last part about how the orthogonality of the signal and noise subspaces is used to disentangle signals. We use a function in which we have 1 divided by the product of vectors representing the signal and noise subspaces. If they equal 0, wouldn't this function be undefined since it would be equal to 1/0?&lt;/p&gt;&#xA;" OwnerUserId="17541" LastEditorUserId="13320" LastEditDate="2016-05-28T09:49:46.867" LastActivityDate="2016-08-26T11:45:31.820" Title="An explanation of parts of the MUSIC Algorithm for someone without a background in signal processing?" Tags="|signal-analysis|frequency-spectrum|estimation|spectrum-estimation|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26069" PostTypeId="1" AcceptedAnswerId="26073" CreationDate="2015-09-26T12:49:25.897" Score="5" ViewCount="238" Body="&lt;p&gt;I have been working on a practical implementation in Matlab of the algorithm Raanan Fattal suggested in the &lt;a href=&quot;http://www.cs.huji.ac.il/~raananf/projects/mlic/mlic.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;following paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't understand the meaning of eq. 11 on page 5:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\begin{array}{llllll}&#xA;U^{(i, j)}=g_{\sigma_{d}} * e^{\left(\left|D^{(i, j)}\right|-C^{(i, j)}\right)}.&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;(11)&#xA;\end{array}\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;g is a gaussian, 1D function (See section 4.1, page 3).&#xA;While in this equation no parameters are given.&#xA;&lt;span class=&quot;math-container&quot;&gt;$D(i,j)$&lt;/span&gt; is a matrix and &lt;span class=&quot;math-container&quot;&gt;$C(i,j)$&lt;/span&gt; is a number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone explain what it means in case it is just a writing method I don't recognize?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="17544" LastEditorUserId="20300" LastEditDate="2019-11-27T18:44:57.343" LastActivityDate="2019-11-27T18:44:57.343" Title="Multi Scale Shape and Detail Enhancement from Multi Light Image Collections" Tags="|image-processing|matlab|filters|gaussian|multi-scale-analysis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26070" PostTypeId="1" AcceptedAnswerId="26071" CreationDate="2015-09-26T13:07:49.403" Score="0" ViewCount="298" Body="&lt;p&gt;I know the power signal and energy signal's equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P=\displaystyle\lim_{T\to\infty}\frac{1}{T}\int_{-T/2}^{T/2}|x(t)|^2dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E=\displaystyle\lim_{T\to\infty}\int_{-T/2}^{T/2}|x(t)|^2dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering whether $(x(t))^2$, instead of $|x(t)|^2$, is fine or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think $(x(t))^2$ and $|x(t)|^2$ are same, aren't they?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, I'm just guessing because of imaginary number, but I didn't learn or study that part, so I cannot make sure. Please let me understand. Thank you very much for reading my post.&lt;/p&gt;&#xA;" OwnerUserId="17105" LastEditorUserId="13320" LastEditDate="2016-11-13T13:20:29.227" LastActivityDate="2016-11-13T13:20:29.227" Title="Can someone explain why absolute is needed in power or energy signal?" Tags="|continuous-signals|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26071" PostTypeId="2" ParentId="26070" CreationDate="2015-09-26T13:27:25.570" Score="2" Body="&lt;p&gt;Power and energy are real-valued quantities, so for a &lt;em&gt;complex-valued&lt;/em&gt; signal $x(t)$ you need to use $|x(t)|^2$. For real-valued signals, you don't need the magnitude because $x^2(t)=|x(t)|^2$ holds. Note that this equality is not satisfied for general complex-valued signals.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-09-26T13:28:50.663" LastActivityDate="2015-09-26T13:28:50.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26072" PostTypeId="2" ParentId="26062" CreationDate="2015-09-26T14:04:22.153" Score="4" Body="&lt;p&gt;I can recommend &lt;strong&gt;online&lt;/strong&gt; course - &lt;a href=&quot;https://www.coursera.org/course/dsp&quot; rel=&quot;nofollow&quot;&gt;Coursera DSP&lt;/a&gt;. There are very good introduction in mathematical basis of DSP and review of main DSP themes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Online courses are symbiose of self-study (study time freedom) and regular education (you will have feedback and you can discuss your problems in forum with another students).&lt;/p&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2015-09-26T14:04:22.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26073" PostTypeId="2" ParentId="26069" CreationDate="2015-09-26T14:34:55.670" Score="2" Body="&lt;p&gt;What the authors meant is to create a matrix of Weights, $ {U}^{\left( i, j \right)} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a matrix of the size of the image.&lt;br&gt;&#xA;The given calculation is by the exponent of two terms (Each of them is a matrix, the calculation is element wise).&lt;br&gt;&#xA;The final step is to blur it using a Gaussian Blue (2D Blur, like on an image).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In equation 10 you can see they take care of the normalization of the weights.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be nice if you come back and show us your results.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="80" LastEditDate="2015-09-26T16:25:20.067" LastActivityDate="2015-09-26T16:25:20.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26075" PostTypeId="1" AcceptedAnswerId="26076" CreationDate="2015-09-26T15:00:41.027" Score="1" ViewCount="161" Body="&lt;p&gt;I am using a Chirp-Z transform (aka. czt) to analyze a short length sample of a sinusoid. In scilab the code that I use to generate the signal is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sampleRate = 4000000&#xA;points = 2^8&#xA;t = (0:(points-1))/sampleRate&#xA;y1 = sin(2*%pi*t*510000)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I take the transform I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f0ppK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f0ppK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expected to see only one non-zero magnitude sample. Obviously this is not the case. Why the sinc(x) waveform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my scilab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear()&#xA;clc()&#xA;clf()&#xA;&#xA;function a = angle(c)&#xA;// return the argument a in rad of complex number c&#xA;   a = atan(imag(c), real(c))&#xA;endfunction&#xA;&#xA;function [Y, f] = chirpZ(y, sampleRate, f1, f2, m)&#xA;    w0 = 1&#xA;    phi = 2*%pi*(f2-f1)/(m*sampleRate)&#xA;    w = w0*exp(-%i*phi)&#xA;&#xA;    a0 = 1&#xA;    theta = 2*%pi*f1/sampleRate&#xA;    a = a0*exp(%i*theta)&#xA;&#xA;    Y = czt(y,m,w0,phi,a0,theta)&#xA;&#xA;    f = (((0:(m-1))*(f2-f1)/m) + f1)&#xA;endfunction&#xA;&#xA;sampleRate = 4000000&#xA;points = 2^8&#xA;t = (0:(points-1))/sampleRate&#xA;y1 = sin(2*%pi*t*510000)&#xA;&#xA;f1 = 300000&#xA;f2 = 700000&#xA;&#xA;m1 = points&#xA;&#xA;[y2, f2] = chirpZ(y1, sampleRate, f1, f2, m1)&#xA;y3 = y2/points&#xA;&#xA;subplot(211)&#xA;plot(f2,abs(y3),'g.')&#xA;subplot(212)&#xA;plot(f2,angle(y3),'b.')&#xA;&#xA;[mag1,ndx1] = max(abs(y3))&#xA;&#xA;subplot(211)&#xA;plot(f2(ndx1),abs(y3(ndx1)),'r.')&#xA;subplot(212)&#xA;plot(f2(ndx1),angle(y3(ndx1)),'r.')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17546" LastActivityDate="2015-09-26T21:53:11.330" Title="czt of a short sinusoid" Tags="|fft|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26076" PostTypeId="2" ParentId="26075" CreationDate="2015-09-26T16:00:22.777" Score="1" Body="&lt;p&gt;You are not analyzing a sine wave, you are analyzing a windowed sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y_1(t) = \sin(2\pi f_0t /f_s) w_{\rm rect}(n)&#xA;$$&#xA;where $f_0 = 510,000$, $f_s = 4,000,000$, and&#xA;$$&#xA;w_{\rm rect}(n) = \left\{  \begin{array}{cl}&#xA;1 &amp;amp; \mbox{where } 0 \le t \le (2^8 - 1)/fs\\&#xA;0 &amp;amp; \mbox{otherwise}&#xA; \end{array}\right.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to get closer to what you expect is to choose the duration so that your sine wave is &quot;continuous&quot; at each end.  That would mean setting&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;points = 40000; //2^8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do that, then I get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M9UWP.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M9UWP.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8604/fft-of-sine-wave-not-coming-as-expected-i-e-single-point&quot;&gt;See this question and its answers for addressing a similar problem.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I chose 40,000 points is to ensure that there is no discontinuity at the ends of the data. This is what happens when you plot &lt;code&gt;[y2 y2]&lt;/code&gt; for 40,000 points vs 256 points as in your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the discontinuity in the 256 case (second plot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4HBLF.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4HBLF.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9qkxM.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9qkxM.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree that choosing a larger number of points is &quot;interpolating the problem away&quot;.  There is no real way around that, however.  There will only be 255 zero points in the FFT of a signal of length 256, so if you're expecting to see zeroes everywhere except $f_0$, you're going to be disappointed.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let's look at the analytic expression for the DFT of a windowed sine wave:&#xA;$$&#xA;X(\omega) = \sum_{n=0}^{N-1}\sin(2\pi \hat{f}_0 n)e^{-j2\pi nk/N} \\&#xA;= \sum_{n=0}^{N-1} \frac{1}{2}\left[e^{+j2\pi \hat{f}_0 n} - e^{-j2\pi \hat{f}_0 n} \right]e^{-j2\pi n\omega/N}\\&#xA;= \sum_{n=0}^{N-1} \left [ e^{+j2\pi n ( \hat{f}_0 - \omega )}  - e^{-j2\pi n ( \hat{f}_0 + \omega )}  \right]\\&#xA;= \frac{1 - e^{+j2\pi ( \hat{f}_0 - \omega ) N} }{1 - e^{+j2\pi ( \hat{f}_0 - \omega ) } } + \frac{1 - e^{-j2\pi ( \hat{f}_0 + \omega ) N} }{1 - e^{-j2\pi ( \hat{f}_0 + \omega ) } }\\&#xA;= \frac{e^{+j\pi ( \hat{f}_0 - \omega ) N}}{e^{+j\pi ( \hat{f}_0 - \omega ) }}&#xA;\frac{(e^{-j\pi ( \hat{f}_0 - \omega ) N} - e^{+j\pi ( \hat{f}_0 - \omega ) N})}&#xA;{e^{-j\pi ( \hat{f}_0 - \omega )} - e^{+j\pi ( \hat{f}_0 - \omega )} }&#xA;+&#xA;\frac{e^{-j\pi ( \hat{f}_0 + \omega ) N}}{e^{-j\pi ( \hat{f}_0 + \omega ) }}&#xA;\frac{(e^{+j\pi ( \hat{f}_0 + \omega ) N} - e^{-j\pi ( \hat{f}_0 + \omega ) N})}&#xA;{e^{+j\pi ( \hat{f}_0 + \omega )} - e^{-j\pi ( \hat{f}_0 + \omega )} }\\&#xA;= e^{+j\pi ( \hat{f}_0 - \omega ) (N-1)} \frac{\sin(\pi ( \hat{f}_0 - \omega ) N/2)}{\sin(\pi ( \hat{f}_0 - \omega )/2)}&#xA;+&#xA;e^{-j\pi ( \hat{f}_0 + \omega ) (N-1)} \frac{\sin(\pi ( \hat{f}_0 + \omega ) N/2)}{\sin(\pi ( \hat{f}_0 + \omega )/2)}&#xA;$$&#xA;which is where the sinc-like shape comes from.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-09-26T21:53:11.330" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26077" PostTypeId="1" AcceptedAnswerId="26094" CreationDate="2015-09-01T09:42:43.233" Score="3" ViewCount="482" Body="&lt;p&gt;High-pass filtering is often used in neuroimaging data analysis. Commonly, whenever a general linear model is fitted to the data (as for instance in statistic parametric mapping) a number of columns of the design matrix are assigned to discrete cosines (DC). See the figure below for a graphical example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yQV4r.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yQV4r.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious why this is preferred to taking the fourier transform (FT) of the data, and applying a filter or cutoff. Arguments I think would speak for the FT alternative are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You would not have to re-do the high-pass filtering upon every application of a GLM&lt;/li&gt;&#xA;&lt;li&gt;Since DCT is &lt;em&gt;discrete&lt;/em&gt; I am guessing a FT would be more accurate in extracting all high frequeny components (looking at the figure above, I find it hard to believe that those few cosines cover all the low-frequency spectrum in between them)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Reasons I think DCT might be the preferred method:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Maybe it is faster than FFT.&lt;/li&gt;&#xA;&lt;li&gt;Maybe there is a reason why it is desirable to perform the filtering concomitantly with your GLM fitting.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Could you tell me what you think about this?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why is DCT preferred?&lt;/li&gt;&#xA;&lt;li&gt;Would FFT not be better? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7687" OwnerDisplayName="TheChymera" LastActivityDate="2015-09-27T23:57:39.277" Title="Why is discrete cosine preferred to FFT in neuroimaging GLM" Tags="|frequency|fourier-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26079" PostTypeId="1" AcceptedAnswerId="26081" CreationDate="2015-09-27T00:14:12.937" Score="3" ViewCount="7494" Body="&lt;p&gt;I've just finished covering convolutions in my signals class, and I've been playing around with the &lt;code&gt;conv&lt;/code&gt; function in MATLAB, but there's something I don't quite understand. Say I have two discrete signals, $a$ and $b$ sampled at $dt$. As $dt \rightarrow 0$, the amplitude of the result increases. Since the convolution integral is just&#xA;$$&#xA;y(t)=\int_{-\infty}^\infty f(\tau)h(t-\tau)d\tau,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;why does the resulting convolution seem to depend on what my value is for $dt$? By decreasing the sampling rate, shouldn't I just have a better approximation?&lt;/p&gt;&#xA;" OwnerUserId="17550" LastEditorUserId="11256" LastEditDate="2015-09-27T01:34:38.050" LastActivityDate="2015-09-27T01:34:38.050" Title="Why does the amplitude of a discrete convolution depend on the time step?" Tags="|matlab|discrete-signals|convolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26080" PostTypeId="2" ParentId="26079" CreationDate="2015-09-27T01:10:43.543" Score="3" Body="&lt;p&gt;Your computer doesn't compute the continuous integral, it does discrete convolution, which is just a sum of products at each time step.  When you increase dt, you get more points in each signal vector, which increases the sum at each time step. You must normalize the result of conv() according to the length of the vectors involved.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-09-27T01:10:43.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26081" PostTypeId="2" ParentId="26079" CreationDate="2015-09-27T01:32:43.890" Score="3" Body="&lt;p&gt;Very informally, you can think of the integrand as the product of $f(\tau)h(t-\tau)$ and the differential $dt$. In Matlab, you can approximate this by multiplying the discrete convolution by the sampling interval, as in this example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% sample rate is 0.01 seconds&#xA;dt = 0.01;&#xA;t = 0:dt:1;&#xA;f = exp(-t/2);&#xA;h = ones(1,length(t));&#xA;c = dt*conv(f,h);&#xA;% sample rate is now 0.001 seconds&#xA;dt2 = 0.001;&#xA;t2 = 0:dt2:1;&#xA;f2 = exp(-t2/2);&#xA;h2 = ones(1,length(t2));&#xA;c2 = dt2*conv(f2,h2);&#xA;% confirm that the two convolutions are the same&#xA;plot(t,c(1:length(t)),t2,c2(1:length(t2)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that what you're trying to do is approximate a result from continuous signal processing using discrete signal processing. Usually, and as this example shows, you have to be careful. Similar situations arise when trying to estimate a signal's energy or its Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final note, as CMDoolittle mentions, the correct discrete convolution is calculated by &lt;code&gt;conv(f,h)&lt;/code&gt;, without including &lt;code&gt;dt&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-09-27T01:32:43.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26082" PostTypeId="1" CreationDate="2015-09-27T03:30:37.497" Score="1" ViewCount="187" Body="&lt;p&gt;According to &lt;a href=&quot;http://arxiv.org/pdf/astro-ph/9808176.pdf&quot; rel=&quot;nofollow&quot;&gt;L. Eyer et al. (1999)&lt;/a&gt;, the &lt;em&gt;correct&lt;/em&gt; Nyquist frequency of irregularly sampled data is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{1}{2p}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $p$ is the largest value such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; \forall t_i,t_i = t_1 + n_ip \\&#xA;\text{where}~n_i \in \mathbb{N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the paper gives no information on how to calculate $n_i$, other than stating that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$p$ is a kind of greatest common divisor (gcd) for all $(t_i - t_1)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which doesn't really help. So, how does one calculate $p$ or $n_i$ for a given time series. Or, more importantly, is there a better way of calculating the Nyquist frequency of irregularly sampled data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;N.B.&lt;/strong&gt; That the common methods of taking $p = s$ (the shortest sampling rate in the time series) or $p = \delta s$ (the average sampling rate in the time series) or $p = S$ (the longest sampling rate in the time series) all result in explicable behaviour (as outlined in the paper) -- mainly that super-Nyquist frequencies can be resolved (not through aliasing trickery).&lt;/p&gt;&#xA;" OwnerUserId="17553" LastActivityDate="2024-03-14T03:57:20.767" Title="Finding the Nyquist Frequency of Irregularly Sampled Discrete Data" Tags="|discrete-signals|nyquist|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26083" PostTypeId="1" CreationDate="2015-09-27T07:50:23.020" Score="4" ViewCount="3424" Body="&lt;p&gt;I have created a Octave code for MFCC calculation for speech recognition, which takes a wav file as input and then gives the MFCC as the output. But the final results are a bit confusing, so I am unable to verify if they are correct or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My process:-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Read the file, extract the samples, frequency.&lt;/li&gt;&#xA;&lt;li&gt;Perform pre-emphasis, by passing the data to high pass filter of &lt;strong&gt;alpha=0.95&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Framing of the data. My &lt;strong&gt;frame  size is 256 and overlap of 128&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Creating a &lt;strong&gt;hamming window of size 256&lt;/strong&gt;, multiplying it with each frame.&lt;/li&gt;&#xA;&lt;li&gt;Calculating the FFT of each frame, then finding its absolute values. And only selecting the first half as it refers to positive frequencies.&lt;/li&gt;&#xA;&lt;li&gt;Created &lt;strong&gt;20 Mel Filters&lt;/strong&gt;, with &lt;strong&gt;lower freq=300Hz&lt;/strong&gt; and &lt;strong&gt;Upper Freq=8000Hz&lt;/strong&gt;. Now applying it to each frame, to get 20 arrays for each frame. Summing up each arrays to get just 20 values for each frame.&lt;/li&gt;&#xA;&lt;li&gt;Taking &lt;strong&gt;Log base 10&lt;/strong&gt; of each these 20 values per frame.&lt;/li&gt;&#xA;&lt;li&gt;Performing &lt;strong&gt;DCT&lt;/strong&gt; on these 20 values per frame. For this I am using &lt;code&gt;dct2&lt;/code&gt; method of octave.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My code:-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#{&#xA;Perform MFCC on helloworld wav file.&#xA;&#xA;#}&#xA;&#xA;&#xA;clear all;&#xA;close all;&#xA;#{Step 0: Reading the File &amp;amp; initializing the Time and Freq.&#xA;#}&#xA;    [x,fs,nbits]=wavread('helloworld.wav');&#xA;    ts=1/fs;&#xA;    N=length(x);&#xA;    Tmax=(N-1)*ts;&#xA;    fsu=fs/(N-1);&#xA;    t=(0:ts:Tmax);&#xA;    f=(-fs/2:fsu:fs/2);&#xA;    figure, subplot(411),plot(t,x),xlabel('Time'),title('Original Speech');&#xA;    subplot(412),plot(f,fftshift(abs(fft(x)))),xlabel('Freq (Hz)'),title('Frequency Spectrum');&#xA;&#xA;#{&#xA;Step 1: Pre-Emphasis&#xA;&#xA;#}&#xA;&#xA;    a=[1];&#xA;    b=[1 -0.95];&#xA;    y=filter(b,a,x);&#xA;    subplot(413),plot(t,y),xlabel('Time'),title('Signal After High Pass Filter - Time Domain');&#xA;    subplot(414),plot(f,fftshift(abs(fft(y)))),xlabel('Freq (Hz)'),title('Signal After High Pass Filter - Frequency Spectrum');&#xA;&#xA;#{&#xA;Step 2: Frame Blocking&#xA;&#xA;#}&#xA;    frameSize=256;&#xA;    frameOverlap=128;&#xA;    frames=enframe(y,frameSize,frameOverlap);&#xA;    NumFrames=size(frames,1);&#xA;&#xA;#{&#xA;Step 3: Hamming Windowing&#xA;&#xA;#}&#xA;    hamm=hamming(256)';&#xA;    for i=1:NumFrames&#xA;    windowed(i,:)=frames(i,:).*hamm;&#xA;    end&#xA;&#xA;&#xA;&#xA;#{&#xA;Step 4: FFT &#xA;Taking only the positive values in the FFT that is the first half of the frame after being computed. &#xA;#}&#xA;&#xA;    for i=1:NumFrames&#xA;    ft(i,:)=abs(fft(windowed(i,:))(1:frameSize/2));     &#xA;    end&#xA;&#xA;&#xA;#{&#xA;Step 5: Mel Filterbanks&#xA;Lower Frequency = 300Hz&#xA;Upper Frequency = fs/2&#xA;With a total of 22 points we can create 20 filters.&#xA;#}&#xA;    Nofilters=20;&#xA;    lowhigh=[300 fs/2];&#xA;    %Here logarithm is of base 'e'&#xA;    lh_mel=1125*(log(1+lowhigh/700));&#xA;    mel=linspace(lh_mel(1),lh_mel(2),Nofilters+2);&#xA;    melinhz=700*(exp(mel/1125)-1);&#xA;    %Converting to frequency resolution&#xA;    fres=floor(((frameSize)+1)*melinhz/fs); &#xA;    %Creating the filters&#xA;    for m =2:length(mel)-1&#xA;        for k=1:frameSize/2&#xA;     if k&amp;lt;fres(m-1)&#xA;        H(m-1,k) = 0;&#xA;    elseif (k&amp;gt;=fres(m-1)&amp;amp;&amp;amp;k&amp;lt;=fres(m))&#xA;        H(m-1,k)= (k-fres(m-1))/(fres(m)-fres(m-1));&#xA;    elseif (k&amp;gt;=fres(m)&amp;amp;&amp;amp;k&amp;lt;=fres(m+1))&#xA;       H(m-1,k)= (fres(m+1)-k)/(fres(m+1)-fres(m));&#xA;    elseif k&amp;gt;fres(m+1)&#xA;        H(m-1,k) = 0;    &#xA;    endif&#xA;        end&#xA;        end&#xA;    %H contains the 20 filterbanks, we now apply it to the&#xA;    %processed signal.&#xA;    for i=1:NumFrames&#xA;    for j=1:Nofilters&#xA;        bankans(i,j)=sum(ft(i,:).*H(j,:));&#xA;    end&#xA;    end&#xA;&#xA;&#xA;#{&#xA;Step 6: Nautral Log and DCT&#xA;#}&#xA;    pkg load signal&#xA;    %Here logarithm is of base '10'&#xA;    logged=log(bankans)/log(10);&#xA;    for i=1:NumFrames&#xA;&#xA;        lnd(i,:)=dct2(logged(i,:));&#xA;    end&#xA;&#xA;%plotting the MFCC&#xA;&#xA;    figure &#xA;    hold on&#xA;    for i=1:NumFrames&#xA;        plot(lnd(i,:));&#xA;    end&#xA;    hold off&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;MFCC PLOT:-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w95Uu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w95Uu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions:-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are all my steps efficient and correct for the MFCC calculations as per the speech recognition criterion?&lt;/li&gt;&#xA;&lt;li&gt;Some tutorials say to take Square of values after step 5, is it necessary here?&lt;/li&gt;&#xA;&lt;li&gt;My output MFCC's first frame's 20 values are -Infinity ,Nan,Nan.... Is it possible to happen if my first frame consist of just '0' values originally in time domain?&lt;/li&gt;&#xA;&lt;li&gt;Overall, is my code correct, of which I am unsure, as I have read the first element of each frame's MFCC has value much higher in magnitude then the rest, but for me for some case the first MFCC element is negative and the 2nd positive, which totally defies the preclaimed rule.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sorry if the question is amateur. I have just started to learn the DSP and Speech Processing Concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="17486" LastEditorUserId="17486" LastEditDate="2015-09-29T11:24:20.520" LastActivityDate="2018-05-10T11:14:30.157" Title="Verifying MFCC Final Result" Tags="|discrete-signals|audio|mfcc|octave|" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="26084" PostTypeId="1" CreationDate="2015-09-27T13:48:46.737" Score="0" ViewCount="78" Body="&lt;p&gt;If I have a signal represented by a Fourier series(like in the photo), which is sampled with $T_s$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=x(t=nT_s) = \sum_{m=-\infty}^{\infty}a[m]e^{j2\pi m(nT_s)/T_0} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I find its DFT? I can't understand that. &#xA;Sorry for the English mistakes.&lt;/p&gt;&#xA;" OwnerUserId="17554" LastEditorUserId="13320" LastEditDate="2016-11-13T12:53:50.570" LastActivityDate="2016-11-13T12:53:50.570" Title="the DFT of a periodic signal represented by a fourier series" Tags="|dft|fourier-series|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26086" PostTypeId="1" AcceptedAnswerId="26090" CreationDate="2015-09-27T15:53:59.977" Score="0" ViewCount="13153" Body="&lt;p&gt;I've got the frequency response $H(e^{j\omega}) = \frac{2 + 3.125e^{-2j\omega}}{1-0.9e^{-j\omega}+0.81e^{-2j\omega}}$, and I'm trying to figure out how to plot the magnitude response and the phase response in Matlab. Is there a simple way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance. This is my first post here, so please tell me if there's anything I forgot to add. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hal&lt;/p&gt;&#xA;" OwnerUserId="17451" LastActivityDate="2015-10-02T08:48:37.513" Title="Matlab: plotting magnitude and phase response" Tags="|matlab|frequency-response|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26088" PostTypeId="2" ParentId="26086" CreationDate="2015-09-27T20:11:27.910" Score="0" Body="&lt;p&gt;&lt;strong&gt;this is wrong, use freqz because bode() evaluates H(s), not H(z). s=jomega, while z = e^jomega&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have the system identification toolbox, it's very easy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/ident/ref/bode.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/ident/ref/bode.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;H = tf([2 0 3.125],[1 -0.9 0.81]);&#xA;bode(H);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why a zero in the numerator? because you don't have a first-order term in the numerator of H, so you assume it's zero.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-09-27T21:25:29.937" LastActivityDate="2015-09-27T21:25:29.937" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="26089" PostTypeId="2" ParentId="26086" CreationDate="2015-09-27T20:46:20.000" Score="2" Body="&lt;p&gt;@Hal: Unlike MBaz, I realize you weren't asking for information on the theory of signal processing. But, rather, you were asking a Matlab implementation question. I only have an old version of Matlab so I couldn't try Anthony's code. (Anthony was smart to insert that zero-valued coefficient.) But to plot the frequency mag. and phase responses of a discrete version of your filter, try these:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure(1), freqz([2,0,3.125],[1,-0.9,0.81]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz([2,0,3.125],[1,-0.9,0.81], 512, 'whole');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="8202" LastEditDate="2015-10-02T08:48:37.513" LastActivityDate="2015-10-02T08:48:37.513" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26090" PostTypeId="2" ParentId="26086" CreationDate="2015-09-27T21:19:37.147" Score="0" Body="&lt;p&gt;Write the frequency response in function of $ z = e^{j\omega} $, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ H(z) = \frac{2 + 3.125z^{-2}}{1-0.9z^{-1}+0.81z^{-2}} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the function freqz to plot the impulse response of this transfer function (both magnitude and phase). Here is the code I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = [2 0 3.125]; % numerator coefficients&#xA;a = [1 -0.9 0.81]; % Denominator coefficients&#xA;freqz(b, a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I strongly suggest you to read the freqz documentation to see why we put the parameters in such a way and to find other options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="17125" LastEditDate="2015-09-27T21:25:20.140" LastActivityDate="2015-09-27T21:25:20.140" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26091" PostTypeId="1" AcceptedAnswerId="26093" CreationDate="2015-09-27T21:49:32.270" Score="1" ViewCount="2201" Body="&lt;p&gt;Matlab and Simulink Communications Toolbox digital demodulators are defined to only work on the complex envelope representation of a baseband signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To obtain the time-domain representation of this signal, I believe one takes the real part of the complex envelope. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given just this real part, how does one convert the time-domain representation of modulated data back into a complex envelope such that a Matlab demodulator will demodulate it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Application: I'm trying to simulate a simple audio FSK system in Simulink.&lt;/p&gt;&#xA;" OwnerUserId="7624" LastEditorUserId="11256" LastEditDate="2015-09-28T13:47:40.017" LastActivityDate="2015-09-28T13:47:40.017" Title="How to convert time-domain signal to complex envelope?" Tags="|matlab|digital-communications|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26092" PostTypeId="2" ParentId="24954" CreationDate="2015-09-27T21:53:59.963" Score="1" Body="&lt;p&gt;The networks generally learn to discriminate without the information of a generative model. This is why, I would say, they tend to learn not to be invariant. This is also the reason why they perform very well at fine-grained classification tasks. Their level of invariance is largely influenced by the data, which is provided. So if the data is augmented so as to cover all rotations, then the network starts to be invariant against rotations. This is also similar for other types of non-trivial transformations. Such a property is desirable, as we do not want to be invariant against the transformations that are not shown to us.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, they do, intrinsically develop certain invariance. This is mostly due to the pooling mechanism. So if you were to design your pooling method (corresponding to certain norm), some more invariance can be achieved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, scattering transform of Mallat construct translation-invariant operators on $L^2(R^d)$, which are Lipschitz-continuous to the action of diffeomorphisms. They can be made to be theoretically invariant to actions of compact&#xA;Lie groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please check &lt;a href=&quot;http://ai.stanford.edu/~ang/papers/nips09-MeasuringInvariancesDeepNetworks.pdf&quot; rel=&quot;nofollow&quot;&gt;Goodfellow et. al.&lt;/a&gt; for the degree of invariance, the networks could develop.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2015-09-27T22:23:44.140" LastActivityDate="2015-09-27T22:23:44.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26093" PostTypeId="2" ParentId="26091" CreationDate="2015-09-27T23:17:03.170" Score="2" Body="&lt;p&gt;These are the main ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Consider a receiver that picks up a signal $r(t)$. This signal has bandwidth $W$ and is centered on carrier frequency $f_c$.&lt;/li&gt;&#xA;&lt;li&gt;Using the Hilbert transform, eliminate the negative frequencies of $r(t)$. The resulting signal, $r_+(t)$, is called an analytic signal.&lt;/li&gt;&#xA;&lt;li&gt;Now, downconvert the analytic signal using a complex exponential, so that the spectrum is centered around 0. This signal, called $\tilde r(t)$, is the complex envelope of $r(t)$. Its spectrum goes from $-W/2$ to $W/2$, and its bandwidth is $B=W/2$.&lt;/li&gt;&#xA;&lt;li&gt;The complex envelope is almost always complex, but if the spectrum of $r(t)$ is symmetrical around $f_c$, the CE is real. Examples of this are AM DSB and BPSK.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In the transmitter you would do the opposite:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start with a complex envelope $\tilde s(t)$ that represents the information you want to transmit. Its spectrum should go from $-W/2$ to $W/2$. An example would be a QAM signal with complex symbols.&lt;/li&gt;&#xA;&lt;li&gt;Upconvert the CE to frequency $f_c$, multiplying by a complex exponential. The result is an analytic signal with only positive frequencies. The signal will be centered around $f_c$ and cover the frequency range from $f_c-W/2$ to $f_c+W/2$.&lt;/li&gt;&#xA;&lt;li&gt;Take the real part of the analytic signal to convert it to a real signal that can be physically generated and transmitted.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All of these steps can be accomplished in Matlab. Be sure to read the documentation for the &lt;code&gt;hilbert&lt;/code&gt; command. I can't comment on the corresponding Simulink blocks, since I don't use them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that it is very likely that you don't have to do all this. If you can perform all your simulations using the complex envelope, you'll save a lot of computing time. The reason is that the transmitted and received signals need to be sampled at least at a rate $2(f_c+W/2)$, whereas the complex envelope can be sampled at $W$ real samples per second -- a huge difference for large $f_c$.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-09-27T23:17:03.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26094" PostTypeId="2" ParentId="26077" CreationDate="2015-09-27T23:57:39.277" Score="3" Body="&lt;p&gt;Say we have a signal,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sV0XJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sV0XJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT assumes the signal is periodic, e.g.,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3M0MA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3M0MA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the typical DCT assumes the signal is even at the boundaries, e.g.,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ac6lt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ac6lt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the DFT example you can see there is a big jump from one side of the signal to the other. Since it assumes a periodic signal, this big jump introduces a lot of high frequency components. Thus the energy of the signal is spread out over more frequencies. For example, the log of the absolute values of the DFT is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vRqxJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vRqxJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the DCT assumes the signal is even at the boundaries, generally there is no big jump and thus no extra high frequency components. If this assumption is correct, more of the energy is concentrated in the lower frequencies. For example, the log of the absolute values of the DCT is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GpPVj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GpPVj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, point at which the DCT assumes the signal is even can be moved. It doesn't have to be at the boundaries. However, if your signal generally has some large ramp component, then it makes sense to use the boundaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the edge condition the DCT is equivalent (with multiplication by a scalar) to the DFT of the mirrored signal,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qDFAd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qDFAd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The log of the absolute values of the &lt;strong&gt;DFT&lt;/strong&gt; of this signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GkrI5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GkrI5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the same as the DCT result above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DCT doesn't automatically reduce boundary effects. Consider the extreme example of a sine signal, its DFT and DCT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hbbMt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hbbMt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/G8J6b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G8J6b.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/NSAkY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NSAkY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the even assumption didn't hold, the DCT actually resulted in many more high frequency components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why use it&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm guessing because of drift in the nueroimaging signal, it is not periodic, and thus there would be a big jump from start to end. This would introduce lots of high frequency components with the DFT. Using the DCT assumes the signal is even and reduces the boundary effects.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-09-27T23:57:39.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26095" PostTypeId="1" AcceptedAnswerId="26102" CreationDate="2015-09-28T00:08:45.383" Score="0" ViewCount="1612" Body="&lt;p&gt;I am making a project where I  can identify leaves by taking a picture of them and a database. I will use their widths to determine their shape. So, I worked across the stem of the leaf each width and plotted them onto the following graphs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data of my graphs are located at: &lt;a href=&quot;https://docs.google.com/spreadsheets/d/1HnYYA9keX7jjkhp4tocd2gy-i8VtHzYaS28fax-Nofc/edit?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.google.com/spreadsheets/d/1HnYYA9keX7jjkhp4tocd2gy-i8VtHzYaS28fax-Nofc/edit?usp=sharing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compare two graphs, I take the minimum of two functions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The sum of the absolute difference between two graphs for every X-axis  point&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Reverse one graph, and then run another sum of absolute difference between the reversed and the other graph. &lt;strong&gt;This is in case if one of the two leaves is measured in an opposite direction from the other one.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;i.e. min( sum(abs(a-b)), sum(abs(a’-b)), where n’ is the reverse plot of n (In case a plot is reversed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UqugW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UqugW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the problem is, the difference between two very similar leaves is actually greater than two very distinct leaves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(On top) I have three graphs, two of which are similar-pos,pos2 (which should return a smaller difference), both of which are the &lt;strong&gt;acer ginnala leaf&lt;/strong&gt; and another is different-neg, the &lt;strong&gt;betula alleghaniensis&lt;/strong&gt; (which should return a greater difference than the &quot;similar&quot;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is not the case. On the 2nd layer, the two graphs are very distinct. &lt;strong&gt;(one is acer, other is betula)&lt;/strong&gt;. However, running the above algorithm, the sums are 70648 and 27362, returning a result of &lt;strong&gt;27362&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the last layer, when two very similar graphs are compared, &lt;strong&gt;(both acer)&lt;/strong&gt; they return a much higher difference, with 40084 (normal) and 85664 (reversed), and returns the minimum of &lt;strong&gt;40084&lt;/strong&gt;, which is a higher difference than the first comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve tried standard deviation of the differences, squaring differences, Intersection Correlation, but had no luck. So, since the current measurement metric doesn’t work on this, what is a concise, straightforward, and better way to measure the difference between two graphs?&lt;/p&gt;&#xA;" OwnerUserId="17561" LastEditorUserId="17561" LastEditDate="2015-09-28T23:02:43.983" LastActivityDate="2015-09-28T23:02:43.983" Title="Comparison/Difference between two distinct plots" Tags="|waveform-similarity|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26096" PostTypeId="1" AcceptedAnswerId="26097" CreationDate="2015-09-28T01:25:52.517" Score="0" ViewCount="1906" Body="&lt;p&gt;I am trying to find the minimum-phase system of the transfer function $H(z) = \frac{2 + 3.125z^{-2}}{1-0.9z^{-1}+0.81z^{-2}}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I need to find and remove the allpass (basically reflect the two zeroes on the imaginary axis inside the unit circle?), and I've gotten so far as this: $H(z) = 2\frac{1 + \frac{3.125}{2}z^{-2}}{1-0.9z^{-1}+0.81z^{-2}} = 2\frac{1 + \frac{3.125}{2}z^{-2}}{1-0.9z^{-1}+0.81z^{-2}} \frac{\frac{3.125}{2} + z^{-2}}{1 + \frac{3.125}{2}z^{-2}}=,$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then I'm not really sure where to go next. Is my thinking correct thus far? What step should I do next?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;This is the kind of thing I'm trying to do, as per the example in my book:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wkyRn.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wkyRn.jpg&quot; alt=&quot;allpass and minimum phase example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17451" LastEditorUserId="17451" LastEditDate="2015-09-28T08:16:56.970" LastActivityDate="2015-09-28T10:35:07.417" Title="Finding minimum-phase/allpass of transfer function" Tags="|transfer-function|allpass|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26097" PostTypeId="2" ParentId="26096" CreationDate="2015-09-28T10:35:07.417" Score="3" Body="&lt;p&gt;The allpass part must have its zeros outside the unit circle, so it gets the zeros of your system, with the corresponding poles inside the unit circle. You get the correct pole locations by simply swapping the coefficients of the numerator polynomial:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_a(z)=\frac{2+3.125z^{-2}}{3.125+2z^{-2}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The minimum phase part is obtained by taking the system's poles and cancelling the poles of the allpass part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_m(z)=\frac{3.125+2z^{-2}}{1-0.9z^{-1}+0.81z^{-2}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function of the original system is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=H_a(z)\cdot H_m(z)\tag{3}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-09-28T10:35:07.417" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26098" PostTypeId="1" AcceptedAnswerId="26103" CreationDate="2015-09-28T12:02:48.643" Score="-1" ViewCount="117" Body="&lt;p&gt;Currently, active contour convergence is checked visually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can we set a convergence criteria?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked into some unsupervised segmentation method for image segmentation but couldn't got a proper criteria.&lt;/p&gt;&#xA;" OwnerUserId="14851" LastActivityDate="2015-09-28T16:12:42.700" Title="Convergence criteria for Active contour model" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26099" PostTypeId="1" CreationDate="2015-09-28T14:19:38.953" Score="3" ViewCount="61" Body="&lt;p&gt;I have an understanding of how random forests can be used for regression. But, I am still unable to understand, how random forests can be used for regression. &#xA;I have already read the research work of Leo Brieman on random forests. But, I still fail to understand how random forests can be used for regression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be of great help, if this concept can be explained using any toy example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="10621" LastActivityDate="2016-02-25T20:26:46.773" Title="How Random Forests can be used for regression?" Tags="|machine-learning|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26100" PostTypeId="2" ParentId="26099" CreationDate="2015-09-28T15:35:06.113" Score="1" Body="&lt;p&gt;The key is in choosing the split function of the decision tree. In classification, the data is split according to a certain homogeneity metric. On the other hand, for a regression tree, a regression model is fit to the dependent variable, for each of the independent variables. Then, the data is split at multiple points and the SSD value is evaluated. The best split is chosen for the dimension (variable) giving the minimum error. The node is then split at this point. The splitting is again recursive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, each leaf stores a distribution for the continuous output variable/s. In the testing phase, the responses are averaged. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-09-28T15:35:06.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26101" PostTypeId="1" CreationDate="2015-09-28T15:51:07.793" Score="2" ViewCount="105" Body="&lt;p&gt;I have some tree canopy images that I would like to process, but not sure how to get started as image processing is a little outside my area of expertise. Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tree &lt;a href=&quot;https://drive.google.com/file/d/0B3zhe2C8Pgm6WkJCNFBIQmE2MENYUkJfTU1ERTFaZE1tMnBr/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;canopy images&lt;/a&gt; with a grid included in the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w5FjQ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w5FjQ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have converted the image to a five color &lt;a href=&quot;https://drive.google.com/file/d/0B3zhe2C8Pgm6Y2FiX1FtMWVpczc0ZjFrRl9INmFQMnM4Skt3/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;palette&lt;/a&gt; so that sky is easily distinguished from tree cover. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NSdpW.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NSdpW.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to overlay a series of boxes that line up with the grid (basically a small box under the numbers) and estimate the percentage of pixels within the box that are the &quot;sky&quot; color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not envisioning that this would be fully automated. The workflow would be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;classify image to five color palette, &lt;/li&gt;&#xA;&lt;li&gt;by hand overlay boxes from a separate file so that the boxes match up with grid in image, &lt;/li&gt;&#xA;&lt;li&gt;loop through boxes and estimate percentage of underlying colors. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I can code in Python and R, but haven't ever used them to process images.&lt;/p&gt;&#xA;" OwnerUserId="17526" LastEditorUserId="80" LastEditDate="2015-09-28T20:57:18.707" LastActivityDate="2015-09-28T20:57:18.707" Title="Classify areas of an image based on color" Tags="|image-processing|python|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26102" PostTypeId="2" ParentId="26095" CreationDate="2015-09-28T16:09:03.320" Score="0" Body="&lt;p&gt;One way to compare similarly-shaped data that is translated in time is to look at the correlation between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this in &lt;code&gt;scilab&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ddata = diff(data',1,'c');&#xA;&#xA;XC = xcorr(ddata(1,:),ddata(2,:));&#xA;CC1 = xcorr(ddata(1,:),ddata(1,:));&#xA;CC2 = xcorr(ddata(2,:),ddata(2,:));&#xA;&#xA;den = sqrt(max(CC1)*max(CC2))&#xA;&#xA;clf&#xA;plot(XC/den);&#xA;plot(CC1/max(CC1),'r')&#xA;plot(CC2/max(CC2),'m')&#xA;&#xA;disp(max(XC)/den)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then I get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YUnRL.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YUnRL.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the blue plot is the (normalized) cross-correlation of the time-differenced data and the red and magenta plots are the (normalized) auto-correlation of each individual time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is that the &quot;correlation&quot; between them is 0.8416782.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-28T16:09:03.320" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26103" PostTypeId="2" ParentId="26098" CreationDate="2015-09-28T16:12:42.700" Score="2" Body="&lt;p&gt;You could set a pre-defined maximum number of iterations. Moreover, you could limit the minimum update of the level-set. That is, the total evolution at a given time-step should exceed a threshold $\tau$. Otherwise you stop. It is also possible to interpret this as a norm in the update of the derivative (e.g. second derivative).&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-09-28T16:12:42.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26104" PostTypeId="1" AcceptedAnswerId="26108" CreationDate="2015-09-28T16:19:50.810" Score="1" ViewCount="2286" Body="&lt;p&gt;For example, there is a very long-term observation and I cut the signal at a sampling rate of &lt;code&gt;10&lt;/code&gt; into many segments of &lt;code&gt;1e6&lt;/code&gt;-point length. I wanna check the time-varying characteristics of the spectrum, so I fft each segment and compare their spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When doing the fft for each &lt;code&gt;1e6&lt;/code&gt;-point segment, in case of &lt;code&gt;y = fft(x, 2^nextpow2(1e6)=1048576)&lt;/code&gt;, we get the spectrum at freqs = 0 : 9.5367e-06 : 5 Hz. But it's time-consuming and I don't wanna store such big data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what if &lt;code&gt;y = fft(x, 1024)&lt;/code&gt;? Do I get the CORRECT spectrum for freqs = 0 : 0.0098 : 5 Hz?&lt;/p&gt;&#xA;" OwnerUserId="8863" LastEditorUserId="13320" LastEditDate="2016-11-13T12:49:32.250" LastActivityDate="2016-11-13T12:49:32.250" Title="If we FFT a signal with number of points far less than the length of the signal, the result is unreliable?" Tags="|fft|discrete-signals|fourier-transform|speech-processing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26106" PostTypeId="1" CreationDate="2015-09-28T17:40:52.570" Score="1" ViewCount="124" Body="&lt;p&gt;I am trying to segment very simple objects like boxes and bottles. I am using GrabCut and it works extremely well when there are no shadows or when the shadows are soft - but as soon as there is a harsh shadow, Grabcut includes that in the segment. The goal is very simple: determine the polygon that makes up the box. That's it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I am using Grabcut in the Rect mode. I cannot use a mask because I don't know where the shadows may fall.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some further details that I forgot to add: this is a video based system. The user places the a box inside the red rectangle on-screen. Currently, I am using Grabcut on 12.5% scaled images to speed up the process so that the video feels it is in 'real-time'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of the program is to compare the segmented object's simlarity using perpetual hash. As I mentioned, the system works extremely well as long as the shadows are minimised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/64YKL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/64YKL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most objects aren't as simple and can have multiple colours inside them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some solutions that I have thought about:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Lighting Based&lt;/strong&gt;&#xA;This is part of a system that will be used in various locations where the lighting may vary. However, the system will have lighting built into it to compensate for the environment - but will that be enough? Can I use light to 'fill' in the shadows so that Grabcut works?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Use a pattern or grid beneath the object&lt;/strong&gt;&#xA;What I have noticed is that if the shadows are even partially outside the Rect, Grabcut is able to segment the object very nicely. I have been wondering if I include a pattern like &lt;a href=&quot;https://i.stack.imgur.com/8frdd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; and then determine the dots the adjacent to the box, determine the contour/rectangle of the adjacent dots and then feed that Rectangle to Grabcut for segmentation. This assumes that the shadows are somewhat tall.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method works fairly well but then I run into issue: some dots are partially covered by the object and they are unfortunately still included by grabcut. Perhaps I can consider some other pattern here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Use some advanced shadow removal algorithm&lt;/strong&gt;&#xA;This seems like my best bet but it seems the majority of algorithms require a calibrated camera or professional camera. But I'm hoping there is some algorithm out there that can help me do this with a consumer grade webcam.&lt;/p&gt;&#xA;" OwnerUserId="12173" LastActivityDate="2015-09-28T17:40:52.570" Title="Segmenting simple objects without shadows" Tags="|image-processing|image-segmentation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26107" PostTypeId="2" ParentId="26104" CreationDate="2015-09-28T18:23:15.390" Score="0" Body="&lt;p&gt;The simple answer to your question, if I'm understanding you correctly, is yes. If you take an FFT of length 1024 with a sample rate of 10, you would get frequency bins spaced roughly 0.0098 Hz apart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now your question about whether this is reliable is a bit subjective; it depends on what kind of frequency resolution you need. The shorter your FFT size, the worse your frequency resolution gets. Basically, you should pick the shortest FFT size that allows you to extract the information you need from the spectral data.&lt;/p&gt;&#xA;" OwnerUserId="17448" LastActivityDate="2015-09-28T18:23:15.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26108" PostTypeId="2" ParentId="26104" CreationDate="2015-09-28T18:24:46.503" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/fft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;As per the Matlab help&lt;/a&gt;, &lt;code&gt;y = fft(x, 1024)&lt;/code&gt; where &lt;code&gt;length(x) &amp;gt; 1024&lt;/code&gt; will result in just taking the FFT of &lt;code&gt;x(1:1024)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hGkgT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hGkgT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if talking the FFT of just the first 1024 samples of your 1,000,000 point signal is OK, then sure, what you say is correct.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-28T18:24:46.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26111" PostTypeId="1" CreationDate="2015-09-28T22:30:45.623" Score="0" ViewCount="168" Body="&lt;p&gt;What are the main applications of Fourier Transform Power Spectrum? Can somebody clarify with some examples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what are the advantages of using Fourier Transform Power Spectrum over Fourier Transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the advantage of Fourier Transform Power Spectrum in case of Image Processing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thank you so much.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15755" LastEditorUserId="15755" LastEditDate="2015-09-30T14:59:19.197" LastActivityDate="2015-09-30T14:59:19.197" Title="What are the applications of Fourier Transform Power Spectrum?" Tags="|fourier-transform|power-spectral-density|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26112" PostTypeId="1" CreationDate="2015-09-28T22:44:58.723" Score="1" ViewCount="200" Body="&lt;p&gt;can anyone gives any link or explained to me on how sensor fusion works on GPS/IMU. as of now, i have gain learn few of the algorithms on Kalman Filter. Currently, im using an arduino Uno as my data acquisition card and MPU6050 as my IMU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="17572" LastActivityDate="2016-10-12T08:57:23.610" Title="sensor fusion on GPS/IMU" Tags="|filters|sensor|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26114" PostTypeId="1" AcceptedAnswerId="26118" CreationDate="2015-09-29T07:03:20.537" Score="3" ViewCount="1370" Body="&lt;p&gt;Suppose we have an unstable all-pole filter with transfer function $H(z) = A(z)^{-1}$. What is the best way to design a stable filter with frequency response as close to that of $H$ as possible. (I don't really know enough dsp to better define ''as close as possible'', but I am thinking in $L^2$ sense)&lt;/p&gt;&#xA;" OwnerUserId="17412" LastActivityDate="2015-09-29T13:07:29.573" Title="How to stabilize a filter" Tags="|filters|filter-design|frequency-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26115" PostTypeId="1" AcceptedAnswerId="26140" CreationDate="2015-09-29T12:05:47.470" Score="2" ViewCount="6079" Body="&lt;p&gt;Code given on this link works for 1D:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8860/more-on-kalman-filter-for-position-and-velocity/8869#8869&quot;&gt;Kalman filter for position and velocity: introducing speed estimates&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my problem I need to estimate 3D position.What is the criteria ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How F, G ,H,Q and R change in 3D case.&#xA;This problem is restricted to estimate position only  (No velocity,No acceleration).What measurement vector should contain.Only positions?&#xA;Please respond!I am sorry for any inconvenience&lt;/p&gt;&#xA;" OwnerUserId="17286" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-12-04T14:46:11.497" Title="Kalman Filter to estimate 3D position of a node" Tags="|filters|kalman-filters|non-linear|" AnswerCount="1" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="26116" PostTypeId="2" ParentId="19412" CreationDate="2015-09-29T12:48:35.067" Score="1" Body="&lt;p&gt;The frequency response tells you how a system reacts to a sinusoidal excitation of a given frequency, in terms of amplitude and phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As any signal, periodic or not, can be described as a sum of sinusoids, this allows you to deduce the response to any signal, by the superposition principle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interesting features of the frequency response are the continuous gain, the presence of resonances and the bandwidth. A flat curve reproduces the original excitation without deformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You get a feeling of a frequency response when looking at how a slowing spin-drier vibrates.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-09-29T12:48:35.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26117" PostTypeId="1" AcceptedAnswerId="26124" CreationDate="2015-09-29T13:02:10.347" Score="0" ViewCount="2739" Body="&lt;p&gt;I implemented an interpolation method in C++ based on this equation &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y(t) = x[n]*sinc((t-nT)/T)&#xA;&#xA;where:&#xA;n - index of input signal,&#xA;x - input signal buffer,&#xA;t - is an actual time, &#xA;nT - time of input samples,&#xA;T - period of input signal.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I calculated it on 33 samples:1+2*16. I tested it on Matlab and C++ on VS 2010. It works great on close frequencies (eg. 24kHz to 20kHz) but when I tested situation where the input signal is 24kHz and has a peak on 8kHz and then I wanted to interpolated it to 700Hz it gave me a peak at 300Hz so it is totally wrong. I expected that the main couse of this situation is that I did not use the cutoff frequency for low pass filter in this equation above. Seriously, I do not know how to add low pass filtration to my method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for all your suggestions or advise.&lt;/p&gt;&#xA;" OwnerUserId="16864" LastActivityDate="2015-09-29T17:57:49.910" Title="Interpolation based on sinc function" Tags="|lowpass-filter|interpolation|anti-aliasing-filter|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26118" PostTypeId="2" ParentId="26114" CreationDate="2015-09-29T13:07:29.573" Score="5" Body="&lt;p&gt;The magnitude of the frequency response will remain unchanged if you reflect any poles outside the unit circle - these are the ones causing instability - back inside the circle. I.e., a pole $p$ (with $|p|&amp;gt;1$) is replaced by the new pole $\tilde{p}=1/p^*$, where $*$ denotes complex conjugation. This will not change the magnitude of the frequency response (up to a scaling factor), but it will change the phase response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct scaling is obtained if each factor $(1-p_iz^{-1})$ with $|p_i|&amp;gt;1$ of the denominator polynomial $A(z)$ is replaced by $|p_i|(1-z^{-1}/p_i^*)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-09-29T13:07:29.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26120" PostTypeId="2" ParentId="26117" CreationDate="2015-09-29T15:29:26.903" Score="2" Body="&lt;p&gt;I'm still not quite sure I understand what you're trying to achieve, but here's an example I cooked up in &lt;code&gt;scilab&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input is 33 points of a sine wave:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 100; // 10kHz sampling rate&#xA;Tin = 1/fs; // Input sampling period&#xA;N = 16;&#xA;tin = [-N:N]; // Times of samples&#xA;f0 = 5;&#xA;&#xA;x = sin(2*%pi*f0/fs*tin + 1.123791823)&#xA;&#xA;clf&#xA;subplot(211)&#xA;plot(tin,x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The sampling frequency is 100Hz, the frequency of the sine wave is 5 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I try to interpolate this up to a sampling frequency of 700Hz using the &lt;code&gt;sinc&lt;/code&gt; formula:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Tout = 1/700;&#xA;tout = -N:Tout:N;&#xA;y = zeros(1,length(tout))&#xA;for n = 1:length(tin)&#xA;    y =  y + x(n)*sinc(%pi*(tout-tin(n)))&#xA;end&#xA;&#xA;plot(tout,y,'r:')&#xA;title('Input (blue line) and interpolated (red dotted line)')&#xA;&#xA;subplot(212)&#xA;dx = splin(tin,x);&#xA;x_interp = interp(tout,tin,x,dx);&#xA;plot(tout,y-x_interp)&#xA;title('Error')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results are as plotted below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mEBly.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mEBly.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-29T15:29:26.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26121" PostTypeId="1" AcceptedAnswerId="26123" CreationDate="2015-09-29T16:44:04.270" Score="4" ViewCount="2039" Body="&lt;p&gt;new here and probably pretty unexperienced compared to the rest of you. This should be simple enough but just wanted some clarification. I'm trying to model an analog square wave oscillator with C. With the oscillator I'm trying to mimic, the square wave isn't totally square and has curves with the starting edge of each pulse (on/off). It looks like in the analog device the capacitor is smoothing the square wave, so I believe I need to implement a low pass filter in my code to smooth out the square wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;tldr - Just wanted to confirm that I should implement a low pass filter on the raw square wave to make it sound similar to the analog oscillator of the picture below. If there's another way I should be approaching this I'm open to listen to suggestions as I might be approaching this wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top is my square wave&#xA;Bottom is device's square wave&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Vrs0q.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vrs0q.jpg&quot; alt=&quot;Square waves&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10572" LastActivityDate="2015-09-29T17:13:13.770" Title="Smoothed Square Wave" Tags="|filters|audio|lowpass-filter|c|tone-generation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26122" PostTypeId="1" CreationDate="2015-09-29T16:50:49.840" Score="1" ViewCount="331" Body="&lt;p&gt;Previously I asked &lt;a href=&quot;https://dsp.stackexchange.com/questions/25927/fourier-transform-artifacts&quot;&gt;this&lt;/a&gt; question about FFT artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution that is most easily implemented is using an apodizing mask on the original image, tapering the borders to zero making the image left-right and top-bottom continuous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest of the question is best illustrated with a series of pictures. First, we have the original image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dh3Rz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dh3Rz.png&quot; alt=&quot;Original image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we apply the cosine-tapered apodizing mask:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kGhzb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kGhzb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that we use this mask to do operations in Fourier Space on the second image; to get the power spectrum we will have to use a similar mask again but this is applied to both images so that is not the issue here. (i find it difficult to phrase this properly; please place a comment if you want me to elaborate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now we use a FFT on the second image. In Fourier space we may do things with the image, but to trace our steps and see if the machinery works, we leave it be and just use the inverse-FFT back to real space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back in real space, we take the part of the image that was &lt;strong&gt;not&lt;/strong&gt; tapered (so, the inner square) and obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JA90k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JA90k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for both the &lt;strong&gt;first&lt;/strong&gt; and the &lt;strong&gt;third&lt;/strong&gt; image I now want to find the power spectrum. In essence, this comes down to (1) using an apodizing mask again, (2) transforming to fourier space once more, and (3) taking the azimuthal average as a function of radius.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a last subtelty, the power spectrum of the third image is multiplied by a factor $(N_1 / N_3)^2$, where $N_1$ is the number of pixels per side of the first image and $N_3$ the number of pixels per side of the third image. This factor is there to correct for the normalization $1/N$ in the definition of the FFT in &lt;code&gt;numpy&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing all this, we obtain the following power spectra:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YKGbW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YKGbW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Clearly, the power spectrum of the third image (in red) has lost power with respect to the power spectrum of the original, first image (in blue). What is the cause of this and can it be compensated for? Or will I have to rely on more elaborate solutions than an apodizing mask (as given &lt;a href=&quot;https://dsp.stackexchange.com/questions/25927/fourier-transform-artifacts&quot;&gt;here&lt;/a&gt;) to not lose this power?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="17359" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-09-29T18:42:45.317" Title="Lost power while using FFT with apodizing mask" Tags="|fft|power-spectral-density|window-functions|ifft|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26123" PostTypeId="2" ParentId="26121" CreationDate="2015-09-29T17:13:13.770" Score="8" Body="&lt;p&gt;Yes. This looks like it's a typical first order low pass. The time constant can be determined by looking at the time it takes for the falling edge to drop to 37% of the max amplitude ($e^{-1}$). The cutoff frequency of the low pass filter is $1/(2 \cdot \pi \cdot t_c)$ where $t_c$ is the time constant&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-09-29T17:13:13.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26124" PostTypeId="2" ParentId="26117" CreationDate="2015-09-29T17:57:49.910" Score="1" Body="&lt;p&gt;When you use interpolation to decrease the sample rate, you need to first low pass filter the signal to a bandwidth below the new FsNew/2.  You can do this by using a wider Sinc kernel related to the new lower sample rate.  e.g. intead of T in the denominator on the Sinc parameter in your interpolation kernel, use 1/FsNew.  &lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-09-29T17:57:49.910" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26127" PostTypeId="2" ParentId="26068" CreationDate="2015-09-29T22:22:50.770" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The music algorithm decomposes the spatial space into a signal and noise sub spaces. Thus given number of sources one can perform a one dimensional angle search to obtain the DOA. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The denominator is never zero due to noise. Thus a simple peak detector is utilized in MUSIC. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="80" LastEditDate="2015-09-30T12:08:15.993" LastActivityDate="2015-09-30T12:08:15.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26128" PostTypeId="2" ParentId="7833" CreationDate="2015-09-30T00:51:59.517" Score="1" Body="&lt;p&gt;I am looking for the same thing, but it can't be done. There is a company in Scotland called CereProc which does voice modeling, but they need someone at their lab recording hours of audio and the cost to model a single voice is around USD $30K. &lt;/p&gt;&#xA;" OwnerUserId="17586" LastActivityDate="2015-09-30T00:51:59.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26129" PostTypeId="1" CreationDate="2015-09-30T01:51:47.937" Score="1" ViewCount="205" Body="&lt;p&gt;I am doing a fairly simple homework assignment in MATLAB that is to filter an image in the frequency domain. So my code looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output = ifft2(fft2(image, x, y).*fft2(filter, x, y));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After testing some images, this code filters properly, but has weird edge behavior. Out of curiosity, what exactly happens at the edges using this method? (0, symmetric, replicate, circular)? &lt;/p&gt;&#xA;" OwnerUserId="11749" LastEditorUserId="80" LastEditDate="2015-09-30T13:01:09.370" LastActivityDate="2015-09-30T13:01:09.370" Title="What happens at the edges in fft2 filtering?" Tags="|image-processing|filters|homework|frequency-domain|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26131" PostTypeId="2" ParentId="25865" CreationDate="2015-09-30T05:36:03.397" Score="2" Body="&lt;p&gt;Kalman filter works in a predictor-corrector or predict-update sequence. When no new measurement is available the only thing that you can do is to &lt;strong&gt;predict&lt;/strong&gt;(NOT update) the state with your assumed dynamic model. The prediction is done not only on the state vector itself but also on its covariance matrix ${\bf{P}}$ (Not the measurement covariance matrix $\bf{R}$). A popular model commonly used for model regularization (AKA model noise matrix, or the matrix $\bf{Q}$) is the Singer model from 1990 (see [1]).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case the transition matrix is given by $\Phi_k =  \begin{bmatrix}1 &amp;amp; dt \\0 &amp;amp; 1 \end{bmatrix}$ , so the state covariance matrix is predicted using &#xA;${\bf{P}}_{k|k-1}=\Phi_k {\bf{P}}_{k-1|k-1} \Phi_k^T + {\bf{Q}}_k$. That way the state matrix ${\bf{P}}$ &quot;inflates&quot; to account for the uncertainty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Singer, R. A., “Estimating Optimal Tracking Filter Performance for Manned Maneuvering Targets,” IEEE Transactions on Aerospace and Electronic Systems, vol. AES-6, no. 4, .pp. 473-483, July 1990.&lt;/p&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2015-09-30T05:36:03.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26133" PostTypeId="1" AcceptedAnswerId="26137" CreationDate="2015-09-30T09:30:59.037" Score="1" ViewCount="565" Body="&lt;p&gt;With &lt;strong&gt;stationary noise&lt;/strong&gt; we have constant mean and variance (let's assume it is Gaussian noise). My first question is, how is the noise power calculated and how it is related to the variance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I have a &lt;strong&gt;non-stationary noise&lt;/strong&gt; which its variance is not constant and changes periodically over time. My second question is, how can I calculate the noise power for this noise and how it is related to the time-variant variance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help and remark on the topic would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you all.&lt;/p&gt;&#xA;" OwnerUserId="17593" LastActivityDate="2015-09-30T12:19:47.660" Title="How to calculate the noise power for a non-stationary noise?" Tags="|noise|power-spectral-density|stationary|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26134" PostTypeId="1" CreationDate="2015-09-30T09:38:56.120" Score="1" ViewCount="374" Body="&lt;p&gt;I have data from many closely located sensors (geophones). These are often contaminated with coherent noise which I need to remove. Some of the most effective de-noising methodologies work if the noise signals are aligned. To do that I do cross correlation on neighbouring sensor data and find the delay and shift my data accordingly. The problem is the noise source is moving, but slowly. So I would need to recalculate the delay for every new data set. Knowing the initial delay (estimated from the first data set), is there a way, using some optimization methods to find the subsequent delays, i.e. at each step use the previous delay estimate as input (together with new data) to some optimization function and find the delay for the new data set (in Matlab) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="4036" LastActivityDate="2015-09-30T11:44:49.547" Title="find cross correlation lag by optimization" Tags="|matlab|cross-correlation|optimization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26135" PostTypeId="2" ParentId="26039" CreationDate="2015-09-30T11:26:39.457" Score="0" Body="&lt;p&gt;The way to do it is to find peaks and not maximum values. Like the function &lt;code&gt;findpeaks&lt;/code&gt; in MATLAB (local peaks) you can define resolution (distance between peaks and more...)&lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="80" LastEditDate="2017-05-23T11:50:48.063" LastActivityDate="2017-05-23T11:50:48.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26136" PostTypeId="2" ParentId="26134" CreationDate="2015-09-30T11:44:49.547" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://www.eurasip.org/Proceedings/Eusipco/Eusipco2008/papers/1569105156.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; has an algorithm that seems to try to do what you're reqeuesting.  I don't have time right now to look at implementing it, but may do in a few days.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper uses the signal model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bqZu2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bqZu2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the RLS algorithm to modify a filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HWk0I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HWk0I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure whether this qualifies as any different, as it seems to use the peak of the autocorrelation as its delay estimate.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-30T11:44:49.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26137" PostTypeId="2" ParentId="26133" CreationDate="2015-09-30T12:19:47.660" Score="0" Body="&lt;p&gt;If your signal is just $n(t)$ distributed as $N(\mu, \sigma^2)$, then the expected signal power is then:&#xA;$$&#xA;p_{\rm ensemble} = E\left [ \left| n(t) \right|^2 \right] = \mu^2 + \sigma^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the time-varying case, I'd suggest that the answer is:&#xA;$$&#xA;p_{\rm time\ varying} = \mu^2(t) + \sigma^2(t)&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-30T12:19:47.660" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26138" PostTypeId="2" ParentId="17462" CreationDate="2015-09-30T12:21:39.003" Score="1" Body="&lt;p&gt;DCS should NOT be transmitted as a square wave.&lt;br&gt;&#xA;The transmit side is supposed to have a low pass filter on the DCS signal before it gets mixed with the transmit audio.  A properly functioning DCS transmitter should therefore NEVER transmit harmonics of the DCS signal above 300Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Receive side, a (steep) high pass filter with a cutoff of 300Hz should be all you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are still getting harmonics from the DCS signal in your received audio then you should look at the transmit side.  It is either over modulating the DCS (level is too high) or the transmit side low pass filter is ineffective.  You may also have a little of both - DCS modulation level set too high and the filter not quite up to the job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that you have a recording that has the DCS in it, I would assume the recording was made from a line-level output from the radio's demodulator.  If the transmitter was working properly, all you need to do is to run your recording through a high pass filter with a 300 Hz cutoff.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2015-09-30T12:21:39.003" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26139" PostTypeId="2" ParentId="26129" CreationDate="2015-09-30T12:39:43.283" Score="1" Body="&lt;p&gt;Quick answer: FFT2 assumes periodic boundary conditions. This means that performing the FFT2 of an image is equivalent to have your original image periodically repeated in the horizontal and vertical directions, compute the DFT, and then only retain the central region. The weird artifacts you are seeing are probably the result of juxtaposing opposite edges that are not related to each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are ways to work around this by, e.g., smoothing these discontinuities by using MATLAB’s &lt;em&gt;edgetaper&lt;/em&gt; function before filtering.&lt;/p&gt;&#xA;" OwnerUserId="17594" LastActivityDate="2015-09-30T12:39:43.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26140" PostTypeId="2" ParentId="26115" CreationDate="2015-09-30T13:00:27.073" Score="2" Body="&lt;p&gt;As I said in the comments, just &lt;a href=&quot;https://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical&quot; rel=&quot;nofollow&quot;&gt;follow the 1D case from Wikipedia&lt;/a&gt; and augment it with the extra $y$ and $z$ dimensions (and velocities):&#xA;$$&#xA;\mathbf{x}_k = \left [ &#xA;\begin{array}{c}&#xA;x\\ \dot{x}\\ y\\ \dot{y}\\ z\\ \dot{z} &#xA;\end{array}&#xA;\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will also need to augment $\mathbf{F}$ and $\mathbf{G}$:&#xA;$$&#xA;\mathbf{F} = \left[ \begin{array}{cccccc}&#xA;1 &amp;amp; \Delta t &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp;        1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \Delta t &amp;amp; 0 &amp;amp;  0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp;        1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \Delta t \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;        1 \\&#xA;\end{array}&#xA;\right]&#xA;$$&#xA;$$&#xA;\mathbf{G} = \left[ \begin{array}{c}&#xA;\frac{\Delta t^2}{2}\\&#xA;\Delta t\\&#xA;\frac{\Delta t^2}{2}\\&#xA;\Delta t\\&#xA;\frac{\Delta t^2}{2}\\&#xA;\Delta t\\&#xA;\end{array}&#xA;\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then $\mathbf{H}$ is just&#xA;$$&#xA;\mathbf{H} = \left[ \begin{array}{cccccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;\end{array}&#xA;\right]&#xA;$$&#xA;so that $\mathbf{z}_k$ is&#xA;$$&#xA;\mathbf{z}_k =  \left[ \begin{array}{c}&#xA;x\\&#xA;y\\&#xA;z&#xA;\end{array}&#xA;\right]&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-09-30T13:00:27.073" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="26142" PostTypeId="1" AcceptedAnswerId="26149" CreationDate="2015-09-30T18:58:55.017" Score="0" ViewCount="145" Body="&lt;p&gt;I have a stream of signal, and I'm looking for the presence of a certain event (the signal), also I have a &quot;model&quot;(which is a an approximation of the original signal) for that signal, and I will adopt it as my matched filter. So I tried to choose the matched filter, without any mathematical calculation. When I was looking for the signal. I saw a pattern that appears repeatedly. And I expect that pattern is the signal.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Could I cross-correlate the matched filter every unit of time (for example, every 2 seconds) with the signal and see if the value of cross correlation approaches to 1, and based on that decide if that event is existing or not?&#xA;To make things more clearly, the following is an algorithm of my approach&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;while (Signal s is Streaming)&#xA;{&#xA;  S = epoch_the_signal(s)&#xA;  x = cross_correlation(S,M)&#xA;  if(x &amp;gt; Threshold)&#xA;  {&#xA;    print &quot;The signal appears&quot;}   &#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What if I choose the matched filter as what is given in the literature (taking the matched filter as to increase the SNR. So I take what I expect to be the signal, and I used the formula, which is shown below to build the matched filter). does that will increase the noise that my model is including it in addition to the signal? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I think the hardest work is how to get the signal, not how to find the matched filter. Especially if it's biomedical signal.&lt;/p&gt;&#xA;" OwnerUserId="17600" LastEditorUserId="80" LastEditDate="2015-10-01T00:50:29.333" LastActivityDate="2015-10-01T07:44:20.097" Title="Using Matched Filter To Predict the Existence of An Event" Tags="|filters|matched-filter|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26143" PostTypeId="1" AcceptedAnswerId="26155" CreationDate="2015-09-30T19:28:11.200" Score="0" ViewCount="995" Body="&lt;p&gt;I have around 10 wav audio files all containing same word spoken i.e. 'Hello' but all having different length. &#xA;So lets say 1st file when loaded consist of 20000 samples, 2nd of 15000, 3rd of 18000 and so on they vary. Now I want to create a average template made of averaging all these 10 files, so that I can have better speech recognition result. But the problem is all the files have different length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can you average 10 different length signals?&lt;/p&gt;&#xA;" OwnerUserId="17486" LastActivityDate="2015-10-01T13:58:22.250" Title="Averaging Different Length Speech Signal" Tags="|matlab|speech-recognition|speech|octave|averaging|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26144" PostTypeId="1" AcceptedAnswerId="26147" CreationDate="2015-09-30T19:48:30.443" Score="1" ViewCount="498" Body="&lt;p&gt;I have a discrete-time system &lt;code&gt;y[n] = x[n]*x[n-1]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to show that this system is non-linear by using a counter example rather than by disproving with algebra and the properties of additivity and homogeneity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that the system is homogeneous although not additive, but I can't think of an example to show this. Would someone help me out please?&lt;/p&gt;&#xA;" OwnerUserId="17602" LastActivityDate="2015-10-01T01:10:07.447" Title="Counter-example to show that this system is non-linear?" Tags="|discrete-signals|non-linear|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26145" PostTypeId="1" AcceptedAnswerId="26157" CreationDate="2015-09-30T22:50:28.433" Score="4" ViewCount="1853" Body="&lt;p&gt;I've been plotting BER curves and am wondering why FEC seems to make a BER curve worse at low Eb/N0 than the un-coded theoretical BER curve?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My example plot below is for Differential BPSK using a Rate 1/2 k=7 convolutional code on the AWGN channel.&lt;a href=&quot;https://i.stack.imgur.com/PKYoL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PKYoL.png&quot; alt=&quot;BER Curve&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16489" LastActivityDate="2019-07-15T09:09:35.987" Title="Why does FEC seem to make BER worse at low Eb/N0?" Tags="|digital-communications|bpsk|channelcoding|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26146" PostTypeId="1" CreationDate="2015-09-30T23:30:20.417" Score="25" ViewCount="2803" Body="&lt;p&gt;The Laplace transform is a generalization of the Fourier transform since the Fourier transform is the Laplace transform for $s = j\omega$ (i.e. $s$ is a pure imaginary number = zero real part of $s$).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Reminder:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Fourier transform: $X(\omega) = \int x(t) e^{-j\omega t} dt$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Laplace transform: $X(s) = \int x(t) e^{-s t} dt$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Besides, a signal can be exactly reconstructed from its Fourier transform as well as its Laplace transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since only a part of the Laplace transform is needed for the reconstruction (the part for which $\Re(s) = 0$), the rest of the Laplace transform ($\Re(s) \neq 0$) seems to be unuseful for the reconstruction...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, can the signal be reconstructed for another part of the Laplace transform (e.g. for $\Re(s)=5$ or $\Im(s)=9$)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what happens if we compute a Laplace transform of a signal, then changing only one point of the Laplace transform, and compute the inverse transform: do we come back to the original signal?&lt;/p&gt;&#xA;" OwnerUserId="17604" LastEditorUserId="-1" LastEditDate="2015-10-02T16:42:44.150" LastActivityDate="2015-10-02T17:06:43.630" Title="Is the Laplace transform redundant?" Tags="|fourier-transform|laplace-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26147" PostTypeId="2" ParentId="26144" CreationDate="2015-10-01T01:10:07.447" Score="1" Body="&lt;p&gt;OK. Let's try homogeneity again:&#xA;$$&#xA;y[n] = x[n]\cdot x[n-1]&#xA;$$&#xA;for input $x[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For input $a\cdot x[n]$ we get&#xA;$$&#xA;y'[n] = a\cdot x[n] \cdot a x[n-1] = a^2 \cdot x[n]\cdot x[n-1] \not = ay[n]&#xA;$$&#xA;so homogeneity doesn't apply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's try that with an example, as per MBaz's suggestion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's try:&#xA;$$&#xA;x[n] = 2&#xA;$$&#xA;so that&#xA;$$&#xA;y[n] = 4&#xA;$$&#xA;Then let's try twice that:&#xA;$$&#xA;x'[n] = 2\cdot x[n] = 4&#xA;$$&#xA;So that&#xA;$$&#xA;y'[n] = 16 \not= 2\cdot y[n]&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-01T01:10:07.447" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26148" PostTypeId="2" ParentId="26043" CreationDate="2015-10-01T06:38:18.307" Score="1" Body="&lt;p&gt;Consider the large image, and the region of interest (red):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BpIzi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BpIzi.png&quot; alt=&quot;Large image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you will simply take the Fourier transform of the 8x8 region, the transform is assuming that the image is periodic like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gYF2k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gYF2k.png&quot; alt=&quot;Periodic transform&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform will see artificial directional features across the replicates of the 8x8 region. But if you pad the 8x8 image with zeros to 32x32, these artifacts disappear and the frequency resolution of the discrete Fourier transform is enhanced as a welcome side effect as well:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Du6ap.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Du6ap.png&quot; alt=&quot;After zero-padding&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, now a new problem is revealed: There are artificial directional features along the boundary lines of the 8x8 region, like in the upper half of the left boundary and in the left half of the upper boundary. A solution is to multiply the 8x8 image with a circularly symmetric window function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yqi27.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yqi27.png&quot; alt=&quot;After windowing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The drawback is that the corners of the image are completely ignored. If you think it is useful, you could extend your region of interest so that you would not null the corners of that 8x8 region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To test the performance of your dominant direction finding algorithm starting with the 8x8 input image, you can use test images. Start with a flat white 8x8 image. This should not give a dominant direction stronger than some level of approximation error. If it does, make sure that your window function has circular symmetry and that you have normalized fairly the calculation of all direction-specific integrals over the squared magnitude of the Fourier transform. Then try 8x8 images with directionality generated by setting the pixels to values $\cos(ax + by + c)$, where $\text{atan2}(a, b)$ defines the directionality, $x$ and $y$ are the pixel coordinates and $c$ should not affect the analysis result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your algorithm passes these tests it should be fine!&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-10-01T06:38:18.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26149" PostTypeId="2" ParentId="26142" CreationDate="2015-10-01T07:44:20.097" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;Yes. However cross correlating is matching so you got a mix-up in terminology. You can detect the presence of the signal this way. &lt;/li&gt;&#xA;&lt;li&gt;Matched filter will always maximize the output SNR so it will not increase your noise. Given Gaussian noise it is also a Most Powerful test (I.e optimal). &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2015-10-01T07:44:20.097" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26150" PostTypeId="1" CreationDate="2015-10-01T10:04:45.590" Score="-1" ViewCount="100" Body="&lt;p&gt;In the given solution energy is given as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E=\dfrac{A^2}{2}\int_{-0.5T}^{0.5T}1+\cos\left(\dfrac{2\pi t}{T}\right)dt=\dfrac{1}{2}A^2T $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does the rect function disappear?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KN7uw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KN7uw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17610" LastEditorUserId="13320" LastEditDate="2016-11-13T13:20:51.497" LastActivityDate="2016-11-13T13:20:51.497" Title="Why does the given solution we dont have to integrate the rect function?" Tags="|signal-energy|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26151" PostTypeId="1" AcceptedAnswerId="26153" CreationDate="2015-10-01T10:23:26.083" Score="0" ViewCount="139" Body="&lt;p&gt;As per the convolution theorem, a convolution in time domain is equivalent to a&#xA;multiplication in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then say (MATLAB code),&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = x(1:256)&#xA;y = y(1:256)&#xA;conv(x,y) should be equal to ifft(fft(x).*fft(y))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it is not. Why is it so? What is that I am missing?&lt;/p&gt;&#xA;" OwnerUserId="17611" LastActivityDate="2015-10-01T13:14:20.670" Title="question regarding convolution theorem" Tags="|matlab|convolution|frequency-domain|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26152" PostTypeId="1" CreationDate="2015-10-01T10:25:34.623" Score="0" ViewCount="186" Body="&lt;p&gt;I have two signals $x$ (see below) and $k$ (obtained by giving circular shift of 106.5849 in $x$). Before I take FFT of both ($x$ and $k$) I want to do window analysis on them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kindly can some one please help, How I can choose the window?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying FFT I will find Cross power spectrum of both $f$ domain signals.   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=0*10^-9:4*10^-9:150*10^-9;&#xA;fc=5*10^6;&#xA;xi=sin(2*pi*fc*t);&#xA;yi=154*10^-9:4*10^-9:2000*10^-9;&#xA;y=yi*0; &#xA;x=[xi y];&#xA;k=fshift(x,106.5849);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My eventual aim is to implement the following diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0l3jj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0l3jj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17286" LastEditorUserId="13320" LastEditDate="2016-11-13T12:55:32.717" LastActivityDate="2016-11-13T12:55:32.717" Title="Analysis with Window before FFT" Tags="|fft|power-spectral-density|window-functions|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26153" PostTypeId="2" ParentId="26151" CreationDate="2015-10-01T11:02:31.410" Score="0" Body="&lt;p&gt;Please see &lt;strong&gt;help conv&lt;/strong&gt; (especially third parameter) and &lt;strong&gt;help fft&lt;/strong&gt;. Valid code sample:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = zeros(1,256); x(120:170)=1;&#xA;y = zeros(1,256); y(120:170)=1;&#xA;z = conv(x,y,'SAME'); size(z)&#xA;z1= ifft(fft(x).*fft(y));&#xA;z2 = real(fftshift(z1));&#xA;plot(z2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1849" LastActivityDate="2015-10-01T11:02:31.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26154" PostTypeId="2" ParentId="26150" CreationDate="2015-10-01T12:19:42.450" Score="1" Body="&lt;p&gt;It is implicit in the integral. You compute it just from $-0.5T$ to $+0.5T$, where the $\mbox{rect}$ is constant and equal to 1.&lt;/p&gt;&#xA;" OwnerUserId="824" LastEditorUserId="80" LastEditDate="2015-10-31T15:44:17.413" LastActivityDate="2015-10-31T15:44:17.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26155" PostTypeId="2" ParentId="26143" CreationDate="2015-10-01T12:21:16.400" Score="4" Body="&lt;p&gt;Dynamic &lt;a href=&quot;https://www.youtube.com/watch?v=tkplPbd2f60&quot; rel=&quot;nofollow noreferrer&quot;&gt;Time Warp&lt;/a&gt;ing is pretty well explained on &lt;a href=&quot;http://www.psb.ugent.be/cbd/papers/gentxwarper/DTWalgorithm.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;this site.&lt;/a&gt; I'll use some of the diagrams from the PPT on that site to explain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to divide the signals into segments (frames) and then compare frames sequentially through each signal.  As illustrated below, motion from a segment in one signal to the next segment depends on the similarity to the current segment in the other signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q9IYz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q9IYz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your example of audio files, you usually have features that you extract from them (LPCs or MFCCs for example).  Extract these from each frame.  Use these features as the comparison features used in the DTW algorithm.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Suppose I have 10-10 frames of my 2 signals and each frame has 13 MFCC coefficients so the 2 DTW signals will be all coefficients arranged sequentially?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, before DTW you'll have $MFCC_s^f$ for signal $s$ for each frame, $f$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal 1: $MFCC_1^1$,$MFCC_1^2$, $\ldots MFCC_1^{N_1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal 2: $MFCC_2^1,MFCC_2^2, \ldots MFCC_2^{N_2} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N_1 \not=N_2$ and $N_s$ is the number of frames for each signal, $s = 1,2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After DTW, you'll have the best matching path over $N_\mbox{min} = \min(N_1,N_2)$ frames:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal 1: $MFCC_1^1$,$MFCC_1^1$, $\ldots MFCC_1^{N_?}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal 2: $MFCC_2^1,MFCC_2^2, \ldots MFCC_2^{N_?} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the comparison will be done by running all $those$ MFCCs sequentially.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) How this shortest path can be used to decrease or increase the size of one signal so that they are of same size? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See above explanation: After DTW you'll only have the same number of MFCCs for each and every signal.  All other (unused) frames with MFCCs are discarded for comparison purposes.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-01T13:58:22.250" LastActivityDate="2015-10-01T13:58:22.250" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26157" PostTypeId="2" ParentId="26145" CreationDate="2015-10-01T13:06:14.643" Score="8" Body="&lt;p&gt;This is a behaviour that is commonly outlined in some textbooks and tutorials on FEC, but usually in the form of an observation. For instance, Turbo Codes are sometimes characterised by their &lt;em&gt;Threshold&lt;/em&gt; $E_b/N_o$, which can be considered as the minimum SNR per bit from where the BER starts to decrease. I have not seen a formal explanation for this property, but it can be deduced at least for some types of codes I assume. In this &lt;a href=&quot;https://en.wikipedia.org/wiki/Forward_error_correction#Averaging_noise_to_reduce_errors&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia article&lt;/a&gt;, for instance, it is explained as a consequence of the risk-polling effect that comes from the noise averaging capability of FEC. Let me complement this, also by an intuitive approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider for instance the use of a $(n,k)$ binary block code with hard decision decoding. The maximum number of correctable bit errors for this code is commonly denoted by $t$. &#xA;If the number of bit errors within each transmitted block is higher than $t$, then the receiver will not be able to recover the original codeword. Moreover, the received block will be at roughly the same distance of multiple codewords within the set of size $2^k$. The decoder then picks one of those codewords with high uncertainty, which results in a BER close to 0.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply put, a few bit errors - though above the error correction capability $t$ of the code - may result in a complete block error, which explains why FEC underperforms the uncoded system for a certain SNR range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why in systems that operate at low SNR or when errors appear in &lt;em&gt;bursts&lt;/em&gt;, it is a good idea to use interleaving in order to spread the bit errors along several blocks and keep the number of bit errors per block below $t$.&lt;/p&gt;&#xA;" OwnerUserId="17530" LastEditorUserId="17530" LastEditDate="2015-10-02T08:03:43.460" LastActivityDate="2015-10-02T08:03:43.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26158" PostTypeId="2" ParentId="26151" CreationDate="2015-10-01T13:14:20.670" Score="0" Body="&lt;p&gt;fft and ifft take finite length inputs and produce a same-length result, thus do circular convolution, not linear convolution.  Linear convolution produces a longer result.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-10-01T13:14:20.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26159" PostTypeId="1" CreationDate="2015-10-01T14:41:36.247" Score="2" ViewCount="85" Body="&lt;p&gt;If I have a two-dimensional discrete dataset (one space, one time), and I create subsets of this dataset by &quot;sampling&quot; (although the original dataset isn't continuous) it at different rates, should I expect that the same filter performed on different subsets would produce the same field (although sampled at different times)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To elaborate, I have a discrete dataset that contains a four-times daily sampled field. If I choose every fourth data point in time after the first, I can get a discrete sub-dataset of a once-daily sampled field, although the fields in the 4x and 1x datasets are still the same at the same time. The filtering method is then as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Choose the sampling rate of the discrete dataset&lt;/li&gt;&#xA;&lt;li&gt;Perform an FFT in space and time to get a wavenumber-frequency spectrum&lt;/li&gt;&#xA;&lt;li&gt;Filter the spectrum to retrieve signals propagating only in a certain direction&lt;/li&gt;&#xA;&lt;li&gt;Invert the time and space transforms to get the field propagating in that direction&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, the field I get with the 4x rate and that with the 1x rate are wildly different - not just a matter of magnitude or phase (that I can tell), they are almost entirely incomparable. However, my expectation is that signals propagating in one direction in the 4x dataset should still propagate in that direction in the 1x dataset given that they are actually the same dataset! All relevant signals are well below the Nyquist frequency, and I have accounted for scaling by the dataset length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have confirmed that the 1x (sampled from the 4x dataset) and a native 1x-daily sampled dataset produce similar results, as I would expect - and I have a physical reason for believing both 1x results are correct. The output is much different when I try to employ the entire 4x dataset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My only guess is that there is an extra need to account for the dimensional frequency spectrum being different between the 4x and 1x datasets, but I also thought that the FFT shouldn't care what the time step is. Is there any mathematical source of the difference, and if so, how can I correct it?&lt;/p&gt;&#xA;" OwnerUserId="17599" LastActivityDate="2015-10-01T14:41:36.247" Title="Why does filtering the same discrete dataset while choosing different sampling rates yield different results?" Tags="|discrete-signals|fourier-transform|sampling|dft|" AnswerCount="0" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="26160" PostTypeId="1" AcceptedAnswerId="26191" CreationDate="2015-10-01T14:53:58.543" Score="1" ViewCount="241" Body="&lt;p&gt;I went &lt;a href=&quot;http://arxiv.org/pdf/0902.0026.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;through a paper&lt;/a&gt; in random demodulator. It states that If the sampling rate is $R$ ($R$ is less then $W$, $W=$band limit of a signal in &lt;code&gt;Hz&lt;/code&gt;), and assume that $W$ is divided by $R$. Then each sample is the sum of $W/R$ consecutive entries of the demodulated signal. Does it mean that the signal is compressed by taking $W/R$ samples at a time? &lt;/p&gt;&#xA;" OwnerUserId="17587" LastEditorUserId="17089" LastEditDate="2017-05-08T19:46:06.853" LastActivityDate="2017-05-08T19:46:06.853" Title="Random demodulator in matrix form" Tags="|compressive-sensing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26161" PostTypeId="1" AcceptedAnswerId="26162" CreationDate="2015-10-01T15:13:14.880" Score="0" ViewCount="203" Body="&lt;p&gt;Have been trying to design IIR and FIR 60Hz notch filters but all have step response way above 10ms. &lt;/p&gt;&#xA;" OwnerUserId="17618" LastEditorUserId="17618" LastEditDate="2015-10-01T17:15:06.793" LastActivityDate="2015-10-01T17:15:06.793" Title="Is it possible to design a digital filter that rejects 60Hz noise while keeping step response in the time domain below one mili-second" Tags="|filter-design|" AnswerCount="1" CommentCount="2" ClosedDate="2015-10-01T16:47:57.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="26162" PostTypeId="2" ParentId="26161" CreationDate="2015-10-01T15:46:19.423" Score="0" Body="&lt;p&gt;You can trade off steepness of the notch against time domain ringing. That's a fundamental trade off and there is no way around it. When using an IIR notch you can simply adjust the &quot;Q&quot; (quality factor). A Q of 3 will give a step response that's roughly 10ms long. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-10-01T15:46:19.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26163" PostTypeId="1" AcceptedAnswerId="26167" CreationDate="2015-10-01T16:13:10.967" Score="0" ViewCount="1485" Body="&lt;p&gt;I noticed that for a low pass Butterworth filter, as the cut off frequency reduces, the poles get closer to the unit circle. Is it applicable to all filters and why is this so? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the normalized cut off frequency reduces from $\pi/2$ to $0$ (close to $0$- really low cut off frequency), the poles get closer to unit circle (the distance between the poles and unit circle reduces monotonically). Similar behavior is observed when we increase the cut off frequency from $\pi/2$ to $\pi$ (close to $\pi$- really high cut off frequency), the poles get closer to unit circle again- at $\pi/2$ they seem to be farthest away from the unit circle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate if anybody could help me understand why this is so intuitively and also the math behind this (if there is any). Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="13298" LastEditorUserId="1629" LastEditDate="2015-10-01T22:42:10.357" LastActivityDate="2015-10-01T22:42:10.357" Title="Relation between poles and cut off frequency of a filter" Tags="|filters|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26164" PostTypeId="2" ParentId="20280" CreationDate="2015-10-01T16:21:21.913" Score="0" Body="&lt;p&gt;You probably want to perform histogram stretching, i.e. remap the gray scale so that the lower 7% map to black and the upper 7% map to white, and values in between are spread over &lt;code&gt;0..255&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @Francesco explained, accumulate the histogram bins until you reach 7% of the total, starting from either end of the histogram. This will give you two indexes, &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;w&lt;/code&gt;, and use the linear law&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;g &amp;lt; b -&amp;gt; 0&#xA;b &amp;lt; g &amp;lt; w -&amp;gt; 255 * (g - b) / (w - b)&#xA;w &amp;lt; g -&amp;gt; 255&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you truly want histogram equalization, you can compute the remapping rule as usual but based on the &lt;code&gt;7%-93%&lt;/code&gt; portion of the histogram.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-10-01T16:21:21.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26165" PostTypeId="1" CreationDate="2015-10-01T16:52:04.747" Score="2" ViewCount="2175" Body="&lt;p&gt;I am generating a time-stream data set that needs to be filtered.  The data-set is pretty large (i.e. too large to be filtered in one go).  I'm trying to split the filtering operation up into chunks but I obviously get a spike at each chunk start.  Is there a correct way to split a large data set up into smaller ones and have a continuous result - i.e (pseudcode).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;timestream # variable with say 1e9 data points&#xA;b,a = sig.butter(1, 0.16, 'lowpass')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Split the timestream up in to say 1000 &quot;chunks&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f_t = []&#xA;for c in chunks:&#xA;   t_data = sig.lfilter(b,a,c)&#xA;   f_t.append(t_data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17620" LastEditorUserId="13320" LastEditDate="2016-11-21T12:52:02.180" LastActivityDate="2016-11-21T12:52:02.180" Title="filter long data streams with python" Tags="|filters|python|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26167" PostTypeId="2" ParentId="26163" CreationDate="2015-10-01T18:46:44.703" Score="1" Body="&lt;p&gt;The Butterworth filter is in fact a continuous-time filter, and what you are seeing is very probably a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;nofollow&quot;&gt;bilinear transformation&lt;/a&gt; applied to this filter in order to get a discrete-time filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Software such as Octave or Matlab do this when you ask for a digital Butterworth filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original Butterworth filter, in continuous time, $H(s)$ has all poles equally distributed around a semicircle in the left of the $s$ plane. The radius of this circle is the cutoff frequency (in $rad/s$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relationship between frequencies in discrete-time ($\theta$) and continuous-time ($\omega$) given by the bilinear transformation is: $\omega = \frac{2}{T} \tan (\theta/2)$ (where $T$ is an arbitrary sampling period used during design).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can imagine the left $s$ semiplane as mapped into the unit circle in $z$, or the imaginary axis mapped to the unit circumference.&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-10-01T18:46:44.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26168" PostTypeId="1" AcceptedAnswerId="26192" CreationDate="2015-10-01T19:45:08.867" Score="0" ViewCount="135" Body="&lt;p&gt;I have magnetometer time-series measurements in mV. I am trying to understand what is theory behind software that the company has provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x$ be your time series vector, which is an array of double, and $W$ your&#xA;window length. $x$ is sliced into $L$ windows, each window is detrended and&#xA;(if not rectangular window function is chosen) a Hanning window is&#xA;applied. Then the FFTW is used to obtain an array of complex numbers $X$.&#xA;From $W$ real input values we get $P = W/2$ complex numbers in $X$. $X$ is calibrated with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    X'= \frac{X}{\sqrt{f_s*P}}&#xA;$$&#xA;Transfer function is given by&#xA;$$&#xA;   H(\omega) =0.8V/nT*F_m(\omega)*F_t(\omega)*V&#xA;$$&#xA;where&#xA;$$&#xA;F_m(\omega)=\frac{j\omega}{j\omega+2\pi 4}\\&#xA;F_t(\omega)=\frac{2\pi 1591}{2 \pi 1591 + j\omega}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a transfer function $H$ is given we obtain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    X'' = X'/H&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally if you use a windowing function the result has to be multiplied with the inverse of the integral of that window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why do I need the inverse of the integral of that window?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are my units going to be $nT$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am giving part of the calibration file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; FREQUENCY    MAGNITUDE      PHASE       &#xA;    Hz                     deg          &#xA;Chopper Off                             &#xA;+4.0000E-01  +1.0714E-02  +1.4808E+02   &#xA;+5.5580E-01  +1.3325E-02  +1.3911E+02    &#xA;+7.7230E-01  +1.5775E-02  +1.2956E+02    &#xA;+1.0731E+00  +1.7732E-02  +1.2025E+02    &#xA;+1.4910E+00  +1.9094E-02  +1.1174E+02    &#xA;+2.0718E+00  +1.9931E-02  +1.0442E+02    &#xA;+2.8787E+00  +2.0392E-02  +9.8155E+01    &#xA;+4.0000E+00  +2.0603E-02  +9.2520E+01    &#xA;+5.5580E+00  +2.0611E-02  +8.7089E+01    &#xA;+7.7230E+00  +2.0408E-02  +8.1384E+01    &#xA;+1.0731E+01  +1.9949E-02  +7.4971E+01    &#xA;+1.4910E+01  +1.9006E-02  +6.7315E+01    &#xA;+2.0718E+01  +1.7761E-02  +5.8714E+01    &#xA;+2.8788E+01  +1.5629E-02  +4.9042E+01    &#xA;+4.0000E+01  +1.3116E-02  +3.9247E+01    &#xA;+5.5580E+01  +1.0350E-02  +3.0040E+01    &#xA;+7.7230E+01  +8.0188E-03  +2.2525E+01    &#xA;+1.0731E+02  +5.9868E-03  +1.6408E+01&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that people do not understand my questions.Manuel can dowloaded from here&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;https://geo-metronix.de/ocl/public.php?service=files&amp;amp;t=9b54b82730e4b8b869e083574923d99a&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can go to tsmp and download tsmp.pdf.Calibration is on page 40.&lt;/p&gt;&#xA;" OwnerUserId="17502" LastEditorUserId="17502" LastEditDate="2015-10-02T17:19:55.143" LastActivityDate="2015-10-02T17:48:10.450" Title="Why do I need inverse FFT?" Tags="|fft|" AnswerCount="1" CommentCount="3" ClosedDate="2015-10-16T12:00:28.293" ContentLicense="CC BY-SA 3.0" />
  <row Id="26169" PostTypeId="2" ParentId="24445" CreationDate="2015-10-01T20:39:56.087" Score="0" Body="&lt;p&gt;I believe that the calculation of the magnitude squared coherence is faster for computers (multiplication is faster than square root calculations). And that's pretty much it. :P&lt;/p&gt;&#xA;" OwnerUserId="17622" LastActivityDate="2015-10-01T20:39:56.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26170" PostTypeId="2" ParentId="26165" CreationDate="2015-10-01T21:31:04.590" Score="2" Body="&lt;p&gt;The key is to use the &quot;state&quot; argument of the filtering commands. The idea is that filter commands such as &lt;code&gt;lfilter&lt;/code&gt; can accept a vector specifying the inital state of the filter, and can also output their state at the end of the filter computation. In pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let state = vector of zeros&#xA;let filtered_data = 0&#xA;for c in chunks&#xA;    y, state_new = filter(b, a, c, state)&#xA;    append y to filtered_data&#xA;    let state = state_new&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lfilter.html&quot; rel=&quot;nofollow&quot;&gt;the docs&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-01T21:31:04.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26171" PostTypeId="1" CreationDate="2015-10-01T22:48:23.990" Score="0" ViewCount="512" Body="&lt;p&gt;I read that pole zero cancellation is a method to get rid of poles outside the unit circle. But I believe exact cancellation could be much harder because of finite precision effects. Are there any other reliable methods to cancel out poles? Also are there any methods to shift poles (and do some required compensation)such that the frequency response is unaffected? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="13298" LastActivityDate="2015-10-01T22:48:23.990" Title="Alternatives to pole-zero cancellation" Tags="|filters|filter-design|dsp-core|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26172" PostTypeId="1" CreationDate="2015-10-01T22:58:51.973" Score="1" ViewCount="2608" Body="&lt;p&gt;I am working on a radar simulation to calculate the range and the Doppler frequency of a target. I would like to build a range-Doppler map or range-Doppler matrix. I do not know the steps to develop the range-Doppler map or matrix. I hope there is someone out there kind enough to help me.&lt;/p&gt;&#xA;" OwnerUserId="16612" LastEditorUserId="13320" LastEditDate="2016-11-21T13:06:02.680" LastActivityDate="2016-11-21T13:06:02.680" Title="Range-Doppler matrix" Tags="|matlab|radar|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26173" PostTypeId="1" CreationDate="2015-10-02T01:48:02.217" Score="1" ViewCount="15" Body="&lt;p&gt;I have the following general problem,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presuppose an image is the addition of $K$ other images&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = \sum_{k=1}^{K} f_k(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I don't know what they are. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At each point in an image I obtain $K$ values that represent each of these images, but the order is unknown. In my particular case, these are orientation values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{g} = \{ g_j \mid j = 1 ... K\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At each point, I wish to uniquely assign each value $g_j$ to each of $K$ images, based on the similarity to their neighbours. For example, for a 3x3 image with $K=2$ and $\mathbf{g}$ given by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0,1]  [0,1]  [1,0]&#xA;[1,0]  [1,0]  [1,0]&#xA;[0,1]  [1,0]  [0,1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the two minimal energy sets would be, for some energy function that compares differences,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 0        1 1 1&#xA;0 0 0   and  1 1 1&#xA;0 0 0        1 1 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I imagine this would require some kind of iterative optimisation process, but before reinventing the wheel I wonder if any one has come across this problem before and knows a good solution?&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2015-10-02T03:13:08.743" LastActivityDate="2015-10-02T03:13:08.743" Title="Global partition of image sets using neighbourhood measures" Tags="|classification|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26174" PostTypeId="1" CreationDate="2015-10-02T02:38:24.607" Score="0" ViewCount="173" Body="&lt;p&gt;If I first convolve an image with a Gaussian filter with σ = 1, and then convolve&#xA;the output of that image with a Gaussian with σ = 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this give the same effect as convolving the original image with σ = 3?&lt;/p&gt;&#xA;" OwnerUserId="17624" LastActivityDate="2015-10-02T11:42:21.323" Title="How does gaussian convution stacking work?" Tags="|gaussian|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26175" PostTypeId="2" ParentId="26174" CreationDate="2015-10-02T02:43:22.307" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables&quot; rel=&quot;nofollow noreferrer&quot;&gt;From this Wikipedia page&lt;/a&gt;, you can get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ua0Fg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ua0Fg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for your example, $\sigma_X = 1$ and $\sigma_Y = 2$. The result has a standard deviation of $\sigma_Z = \sqrt{\sigma^2_X + \sigma^2_Y} = \sqrt{1 + 4} = \sqrt{5}$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-02T11:42:21.323" LastActivityDate="2015-10-02T11:42:21.323" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26176" PostTypeId="1" CreationDate="2015-10-02T02:52:39.127" Score="0" ViewCount="1227" Body="&lt;p&gt;Is it possible to write the full convolution between the image and the filter as a matrix multiplication operation? If so, can someone give a simple example of how that works?&lt;/p&gt;&#xA;" OwnerUserId="17624" LastActivityDate="2015-10-02T02:52:39.127" Title="Convolution equivalent to matrix multiplication?" Tags="|convolution|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26177" PostTypeId="1" AcceptedAnswerId="26187" CreationDate="2015-10-02T05:34:05.480" Score="1" ViewCount="1919" Body="&lt;p&gt;I am trying to apply the Constant Modulus Algorithm which is a blind equalization algorithm in CDMA communication. I am following the code for CMA and a great explanation given in link &lt;a href=&quot;https://dsp.stackexchange.com/questions/23540/matlab-proper-estimation-of-weights-and-how-to-calculate-mse-for-qpsk-signal-f&quot;&gt;MATLAB : Proper estimation of weights and how to calculate MSE for QPSK signal for Constant Modulus Algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For different signal-to-noise ratio, I want to see the performance of CMA. But I cannot understand where to plug in the CMA part in CDMA. CMA should be at the receiver, but it is not clear to  me exactly how to do so and if I need to apply the same FIR channel that is given in the CMA code. It will be very helpful is somebody can inform / show how to apply CMA. Thank you.&#xA;The code for CDMA is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;&#xA;clear all;&#xA;code_length = input('Enter Code Length = ');&#xA;data_stream = input('Enter Data Bit Stream = ');&#xA;%Generating Walsh Code&#xA;code = [-1 -1; -1 +1];   &#xA;[r1 c1] = size(code);&#xA;disp('Walsh code generated = ');&#xA;while r1&amp;lt;code_length&#xA;    code = [code,code;code,-1*code];&#xA;    [r1 c1] = size(code);&#xA;    disp(code);&#xA;end&#xA;code_length = length(code); %length (number of bits) of code&#xA;Y = size(data_stream);             &#xA;N = Y(1); %number of unique senders / bit streams&#xA;I = Y(2); %number of bits per stream&#xA;T = []; %sum of all transmitted and encoded data on channel&#xA;data_received = []; %vector of reconstructed bits at receiver&#xA;%show data bits and codes&#xA;disp('Data bit stream to be transmitted = '),disp(data_stream);&#xA;disp('Walsh codes used for transmission = '),disp(code);&#xA;%encode bits and transmit&#xA;G = zeros(I,code_length);&#xA;for n = 1:N&#xA;    Z = zeros(I,code_length);&#xA;    for i = 1:I&#xA;        for m = 1:code_length&#xA;            Z(i,m) = [data_stream(n,i)*code(n,m)];       &#xA;        end&#xA;    end&#xA;    G = G + Z;&#xA;end&#xA;%show channel traffic&#xA;for i = 1:I&#xA;    T = [ T G(i,:) ];&#xA;end&#xA;disp('Resulting traffic on the channel = '),disp(T);&#xA;%decode and reconstruct&#xA;for n = 1:N&#xA;    tot = zeros(1,I);&#xA;    R   = zeros(I,code_length);&#xA;    for i = 1:I&#xA;        for m = 1:code_length&#xA;            R(i,m) = G(i,m) * code (n,m);&#xA;            tot(i) = tot(i) + R (i,m);&#xA;         end&#xA;    end&#xA;    data_received = [data_received ; tot / code_length];&#xA;end&#xA;disp('Reconstructed data at the receiver = '),disp(data_received);&#xA;&#xA;Output:&#xA;&#xA;Enter Code Length = 4&#xA;Enter Data Bit Stream = [ 1 -1  1 -1  1  1 -1 -1 ;&#xA;        -1 -1  1  1  1 -1 -1  1 ;&#xA;         1  1 -1 -1 -1  1  1 -1 ;&#xA;         1  1  1  1 -1 -1 -1 -1 ];&#xA;&#xA;Walsh code generated =&#xA;    -1    -1    -1    -1&#xA;    -1     1    -1     1&#xA;    -1    -1     1     1&#xA;    -1     1     1    -1&#xA;&#xA;Data bit stream to be transmitted =&#xA;     1    -1     1    -1     1     1    -1    -1&#xA;    -1    -1     1     1     1    -1    -1     1&#xA;     1     1    -1    -1    -1     1     1    -1&#xA;     1     1     1     1    -1    -1    -1    -1&#xA;&#xA;Walsh codes used for transmission =&#xA;    -1    -1    -1    -1&#xA;    -1     1    -1     1&#xA;    -1    -1     1     1&#xA;    -1     1     1    -1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/23540/matlab-proper-estimation-of-weights-and-how-to-calculate-mse-for-qpsk-signal-f&quot;&gt;MATLAB : Proper estimation of weights and how to calculate MSE for QPSK signal for Constant Modulus Algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-10-02T13:10:12.107" Title="Matlab: How to apply constant modulus algorithm in wireless communication" Tags="|matlab|self-study|blind-deconvolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26178" PostTypeId="2" ParentId="26146" CreationDate="2015-10-02T07:02:01.393" Score="16" Body="&lt;p&gt;The Fourier and the Laplace transform obviously have many things in common. However, there are cases where only one of them can be used, or where it's more convenient to use one or the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, even though in the definitions you simply replace $s$ by $j\omega$ or vice versa to go from one transform to the other, this cannot generally be done when given the Laplace transform $X_L(s)$ or the Fourier transform $X_F(j\omega)$ of a function. (I use different indices because the two functions can be different for the same time domain function). There are functions for which only the Laplace transform exists, e.g., $f(t)=e^{at}u(t)$, $a&amp;gt;0$, where $u(t)$ is the Heaviside step function. The reason is that the integral in the definition of the Laplace transform only converges for $\Re\{s\}&amp;gt;a$, which implies that the corresponding integral in the definition of the Fourier transform does not converge, i.e. the Fourier transform doesn't exist in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are functions for which both transforms exist, but $X_F(j\omega)\neq X_L(j\omega)$. One example is the function $f(t)=\sin(\omega_0t)u(t)$, for which the Fourier transform contains Dirac delta impulses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, there are also functions for which only the Fourier transform exists, but not the Laplace transform. This means that the integral in the definition of the Laplace transform only converges (in a specific sense) for $s=j\omega$, but for no other values of $s$. The Laplace transform is only said to exist if the integral converges in a half-plane or in a vertical strip of finite size of the complex $s$-plane. Such functions for which only the Fourier transform exists include complex exponentials and sinusoids ($-\infty&amp;lt;t&amp;lt;\infty$), and impulse responses of ideal brick-wall filters, which are related to the sinc function. So, e.g., the functions $f(t)=\sin(\omega_0 t)$ or $f(t)=\sin(\omega_ct)/\pi t$ do not have a Laplace transform but they do have a Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Laplace transform can be a convenient tool for analyzing the behavior of linear time-invariant (LTI) systems by considering their transfer function, which is the Laplace transform of their impulse response. The poles and zeros of the transfer function in the complex $s$-plane conveniently characterize many system properties and are useful for an intuitive understanding of the system's behavior. Furthermore, the &lt;em&gt;unilateral&lt;/em&gt; Laplace transform is very useful for analyzing LTI systems with non-zero initial conditions. The Fourier transform is a useful tool for analyzing ideal (non-causal, unstable) systems, such as ideal low pass or band pass filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also have a look at &lt;a href=&quot;https://dsp.stackexchange.com/questions/15351/fourier-transform-of-exponent-delta-pulse-or-hyperbola/15356#15356&quot;&gt;this answer&lt;/a&gt; to a related question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-10-02T17:06:43.630" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26179" PostTypeId="2" ParentId="26174" CreationDate="2015-10-02T07:26:08.587" Score="0" Body="&lt;p&gt;The Fourier transform of a Gaussian $e^{-x^2/2\sigma^2}$ is another Gaussian with inverse scale, $e^{-\omega^2\sigma^2/2}$. And the product of two Gaussians is a Gaussian with the sum of the parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, two convolutions with $\sigma_1^2$ and $\sigma_2^2$ amount to a single convolution with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma^2=\sigma_1^2+\sigma_2^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, $\sigma=\sqrt5$.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-10-02T07:31:39.500" LastActivityDate="2015-10-02T07:31:39.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26182" PostTypeId="1" AcceptedAnswerId="26731" CreationDate="2015-10-02T10:34:40.497" Score="0" ViewCount="2551" Body="&lt;p&gt;We know how to create disparity map from stereo vision with OpenCV. My question is How can we find/estimate distance between cameras from two image taken from these cameras in OpenCV? &lt;/p&gt;&#xA;" OwnerUserId="15790" LastEditorUserId="15790" LastEditDate="2015-10-02T10:47:34.833" LastActivityDate="2015-10-29T09:06:36.663" Title="Finding Distance between Cameras in Stereo Vision" Tags="|opencv|stereo-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26183" PostTypeId="2" ParentId="25299" CreationDate="2015-10-02T11:56:38.247" Score="3" Body="&lt;p&gt;I don't understand the subscript $n$ notation, however, in the least squares problem that is given by:&#xA;\begin{equation}&#xA;{\bf{y}}={\bf{H}}{\theta}+\bf{n},&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where ${\bf{n}}\sim\mathcal{N}(\bf{0}, \sigma^2I_N)$ is a zero mean additive white Gaussian noise and $I_N$ is the $N \times N$ identity matrix, the maximum likelihood and the least squares estimators are equivalent and are efficient estimators (i.e. unbiased and attains the Cramer Rao bound) and are given by&#xA;\begin{equation}&#xA;\widehat \theta_{ML}=\left ( \bf{H^TH} \right )^{-1} \bf{H^Ty} .&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's calculate the first two moments of the estimator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;E\left \{ \widehat \theta_{ML} \right \} = E\left \{ \left ( \bf{H^TH} \right )^{-1} \bf{H^Ty} \right \} = \\&#xA;\left ( \bf{H^TH} \right )^{-1} \bf{H^T} \underset{=\bf{H}\theta}{\underbrace{E\left \{  \bf{y}\right \}}} = \theta,&#xA;\end{equation}&#xA;where $\theta$ is the true parameter value.&#xA;Thus, the estimator is unbiased and its Mean Square Error(MSE) will equal its covariance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the covariance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that if $\bf{z}=\bf{Ax}$ then $cov\left ( \bf{z} \right ) = \bf{A} cov\left ( x \right ) \bf{A^T}$.&#xA;Since the mean doesn't change the covariance in our problem $\bf{y} \sim \mathcal{N}\left ( \bf{H\theta}, \sigma^2I_N \right )$, thus, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;cov\left ( \widehat \theta_{ML} \right )=\left ( \bf{H^TH} \right )^{-1} \bf{H^T} cov\left ( \bf{n} \right ) \bf{H}\left ( \bf{H^TH} \right )^{-1} = \\&#xA;= \left ( \bf{H^TH} \right )^{-1} \bf{H^T} \sigma^2 \bf{I_N} \bf{H}\left ( \bf{H^TH} \right )^{-1} = \\&#xA;= \sigma^2 \left ( \bf{H^TH} \right )^{-1} \bf{H^T}  \bf{H}\left ( \bf{H^TH} \right )^{-1} = \sigma^2 \left ( \bf{H^TH} \right )^{-1}.&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $\bf{H^TH}$ is symmetric so it equals its transpose. Same is correct for its inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that this answers your question completely.&lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="15513" LastEditDate="2015-10-04T16:26:38.783" LastActivityDate="2015-10-04T16:26:38.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26184" PostTypeId="1" CreationDate="2015-10-02T11:56:42.770" Score="0" ViewCount="184" Body="&lt;p&gt;As the title suggests , I'm having problems working out the integration of some basic signal functions. Shown below are the questions and my workings. For some reason I'm just unable to get the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a) and c) , I know that for u(t) is basically 0 before t=0 , thus I changed the limits for the integration. I did the same thing for u(t-1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/G0mAH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G0mAH.jpg&quot; alt=&quot;Questions&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QZDt4.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QZDt4.jpg&quot; alt=&quot;Workings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17629" LastEditorUserId="80" LastEditDate="2015-10-02T12:00:35.993" LastActivityDate="2015-10-02T12:05:49.630" Title="Working out integration of basic signal functions" Tags="|discrete-signals|continuous-signals|homework|self-study|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26185" PostTypeId="2" ParentId="26172" CreationDate="2015-10-02T12:01:22.490" Score="3" Body="&lt;p&gt;Its very simple: The time domain signal per range gate should be windowed (e.g. hamming, blackman-harris, etc.) to avoid ringing, then a FFT per range gate should be calculated. All that is left is to arrange everything in a matrix where each row is a frequency bin and each column is a range bin. (or vice versa).&lt;/p&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2015-10-02T12:01:22.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26186" PostTypeId="2" ParentId="26184" CreationDate="2015-10-02T12:05:49.630" Score="1" Body="&lt;p&gt;So you've already figured out the $u(t-T)$ trick:  the unit step (delayed) just changes the limits of integration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other trick is that $\delta(t-T)$ just &quot;samples&quot; the value of the rest of the integral's argument. So, for example, $\int x(t) \delta(t-T) dt = x(T)$ where $T$ is somewhere within the integral's limits.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-02T12:05:49.630" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="26187" PostTypeId="2" ParentId="26177" CreationDate="2015-10-02T13:10:12.107" Score="2" Body="&lt;p&gt;Ok, your code is very difficult to understand, but I think that we can answer your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a group of processing blocks that every communication systems have. Normally, they appear in the following order in almost every simulation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bit Stream -&gt; Modulator -&gt; Channel -&gt; Equalization -&gt; Demodulator -&gt; Received Bit Stream&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I suppressed some blocks like pulse shapping, matched filter, FEC, and others. This is the most simple scheme. The transmitter modulate the signal, and sends it through a channel. In the receiver, the samples needs to be equalized in order to perform the detection and demodulation properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you can conclude that the CMA blind Equalization is somewhere between the channel and the detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your code I only saw the test for the Walsh Code. I am not seeing the complete system implemented (i didn't see any modulator, for example), but I assume that now you can figure out where to include the CMA equalizer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you need more help.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-10-02T13:10:12.107" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26188" PostTypeId="1" CreationDate="2015-10-02T13:12:59.810" Score="0" ViewCount="4305" Body="&lt;p&gt;I can't seem to understand the sketches of the amplitude spectrums provided in my tutorial solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cfFyJ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cfFyJ.jpg&quot; alt=&quot;Question 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this part , I understand that X(f) is basically sampling (T/Tp)sinc(Tf). But from what I understand , the amplitude spectrum is a plot of |X(f)| against f. With that being said, shouldn't the sketch in the solution of the sinc function have no portions that go below the x axis? Since |sinc| means that you flip the negative portions up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DIv6i.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DIv6i.jpg&quot; alt=&quot;Question 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same problem as question 1, why are there negative magnitudes for the frequency components 12pi and -12pi? Given x(t) , X(f) would just be a sum of dirac delta functions , and any negative signs can be changed to a phase. As such , there shouldn't be any negative magnitudes in the amplitude spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm suspecting that maybe there's a difference between a continuous-frequency spectrum and an amplitude spectrum, but question 2 tells me otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="17629" LastActivityDate="2015-10-02T13:25:42.880" Title="Question on sketching the amplitude spectrum of signals" Tags="|continuous-signals|homework|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26189" PostTypeId="2" ParentId="26188" CreationDate="2015-10-02T13:25:42.880" Score="1" Body="&lt;p&gt;It's really very simple, but should have been clarified in your tutorial. It may turn out that a signal's Fourier Transform is real (I'll let you figure out when that happens). In that case, the spectrum $X(f)$ can be drawn in a single plot using positive and negative numbers, without having to split it up into magnitude and phase spectrums.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, of course, represent a real number in polar form. If the number is positive, its phase is zero, and if it is negative, its phase is $\pi$. What this means is that, whether you plot the real Fourier transform using negative and positive numbers, or you split it into magnitude and phase plots, you're conveying the exact same information.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-02T13:25:42.880" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26190" PostTypeId="1" CreationDate="2015-10-02T13:52:36.253" Score="1" ViewCount="1788" Body="&lt;p&gt;In the Wikipedia article on &lt;a href=&quot;https://en.wikipedia.org/wiki/Brownian_noise&quot; rel=&quot;nofollow&quot;&gt;Brownian noise&lt;/a&gt;, the Fourier transform of Brownian noise is determined. How is that Fourier transform defined? It seems it is a non-random quantity there, so it is not simply a pathwise Fourier transform. Since in the same article, it is said that white noise has constant Fourier transform and I know that the dirac delta has a constant Fourier transform, I actually guess that &quot;Fourier transform of a (stationary) random process&quot; means &quot;Fourier transform of the covariance function of the random process&quot;. Is that true? Is there intuition behind this definition? Also, if this is the definition, how does the reasoning that $\mathcal{F}(dW(t)/dt)(\omega)=i\omega \mathcal{F}(W(t))(\omega)$ still go through? References?&lt;/p&gt;&#xA;" OwnerUserId="17632" LastActivityDate="2015-10-02T13:52:36.253" Title="Fourier transforms of random processes" Tags="|fourier-transform|reference-request|stochastic|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26191" PostTypeId="2" ParentId="26160" CreationDate="2015-10-02T14:54:31.837" Score="1" Body="&lt;p&gt;The random demodulator (in this definition) compresses the signal by taking samples that are each linear combinations of W/R Nyquist rate samples. So it does not take W/R samples at a time; it takes one sample at a time, each of which contain information corresponding to several (W/R) Nyquist rate samples. It is then up to a reconstruction algorithm to subsequently &quot;disentangle&quot; these into the original signal (approximately) at Nyquist rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The random demodulator works by &quot;smearing&quot; the content of the input signal all over the spectrum (by multiplication with the spreading sequence). Provided that the input signal is sufficiently sparse, we can now reconstruct it from just a small portion of the resulting spectrum (selected by the low-pass filter). &lt;/p&gt;&#xA;" OwnerUserId="1464" LastEditorUserId="1464" LastEditDate="2015-10-03T05:22:46.570" LastActivityDate="2015-10-03T05:22:46.570" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26192" PostTypeId="2" ParentId="26168" CreationDate="2015-10-02T16:40:00.467" Score="1" Body="&lt;p&gt;I'm still not sure that I understand what your question is, but this specific one is easy;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My question is why do I need the inverse of the integral of that window?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The issue is that you'll apply a window to the data $x$:&#xA;$$&#xA;x_2(t) = x(t) \cdot w(t)&#xA;$$&#xA;that means that the sum of $x_2$ is going to be different from the sum of the (rectangular windowed) $x$.  All the inverse of the integral is doing is rescaling things to attempt to make the sums equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as your other question goes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are my units going to be nT?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's all down to calibration. You have millvolts.  Your expression for $H(\omega)$ has a calibration factor $0.8V/nT$. To me, that means that 0.8V (or 800 mV) is 1 nT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tesla are one kilogram per second squared per ampere in base SI units.  Usually, with any measurements calibration is what equates the voltage (or current, usually) measured to the units of you're actually interested in.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All $H(\omega)$ seems to be doing is applying a bandpass filter to your data.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-02T17:48:10.450" LastActivityDate="2015-10-02T17:48:10.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26193" PostTypeId="2" ParentId="22721" CreationDate="2015-10-02T16:43:28.960" Score="1" Body="&lt;p&gt;For lower number of samples the preferred algorithm is the Akaike Information Criteria (AIC). Both are not optimal in any way, though MDL is a consistent estimator of model order.  The difference between them is the penalty term and not another estimator (other than ML)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I refer you to &lt;a href=&quot;http://www.sal.ufl.edu/eel6935/2008/01311138_ModelOrderSelection_Stoica.pdf&quot; rel=&quot;nofollow&quot;&gt;Petre Stoica paper on model order selection&lt;/a&gt; which gives a great summary of algorithms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also interested to hear more about your algorithm. &lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="80" LastEditDate="2015-10-02T17:00:08.233" LastActivityDate="2015-10-02T17:00:08.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26196" PostTypeId="1" CreationDate="2015-10-03T10:33:44.797" Score="4" ViewCount="390" Body="&lt;p&gt;I want to find the ETFE (Empirical Transfer Function Estimate) of the system $G(e^{j\omega})$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LO4pM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LO4pM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $H(e^{j\omega})$ is some filter that zero-mean white Gaussian noise $e(k)$ passes through. &lt;em&gt;Let's assume that the input $u(k)$ is periodic with period $M$&lt;/em&gt;. Taking the Discrete Fourier transform, I have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y_N(e^{j\omega_n})=\sum_{k=0}^{N-1}{y(k)e^{-j\omega_nk}}\quad\text{where }\omega_n=\frac{2\pi n}{N}\quad n=0,1,\ldots,N-1&#xA;\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;U_N(e^{j\omega_n})=\sum_{k=0}^{N-1}{u(k)e^{-j\omega_nk}}\quad\text{where }\omega_n=\frac{2\pi n}{N}\quad n=0,1,\ldots,N-1 &#xA;\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;V_N(e^{j\omega_n})=\sum_{k=0}^{N-1}{v(k)e^{-j\omega_nk}}\quad\text{where }\omega_n=\frac{2\pi n}{N}\quad n=0,1,\ldots,N-1 &#xA;\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y_N(e^{j\omega_n})=G(e^{kj\omega_n})U_N(e^{j\omega_n})+V_N(e^{j\omega_n})+R_N(e^{j\omega_n}) &#xA;\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $N=r\cdot M$ where $r\in \mathbb Z$ is an integer number of periods. I also added $R_N(e^{j\omega_n})$ as the transient part of the response (it would die out for example after the first period of the response). The ETFE is then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat G_N(e^{kj\omega_n})=\frac{Y_N(e^{j\omega_n})}{U_N(e^{j\omega_n})}=G(e^{kj\omega_n})+\frac{R_N(e^{j\omega_n})}{U_N(e^{j\omega_n})}+\frac{V_N(e^{j\omega_n})}{U_N(e^{j\omega_n})}&#xA;\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's define the error between the ETFE and the true transfer function as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E_N(e^{j\omega_n})=G(e^{kj\omega_n})-\hat G_N(e^{kj\omega_n})&#xA;\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my System Identification course, the professor presented two case scenarios. One where input $u(k)$ is zero-mean Gaussian non-periodic noise of length $N$, and one where $u(k)$ is some zero-mean Gaussian noise sequence of length $M$ repeated $r$ times - which makes a periodic signal of sorts. Here is the plot of the norm of $E_N(e^{j\omega_n})$ in the non-periodic case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/b0yGj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b0yGj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the plot of the norm of $E_N(e^{j\omega_n})$ in the periodic case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rdffz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rdffz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second picture, the period $M=128$ so for example for $N=128$ we have $r=1$ (only one period was considered) and for $N=512$ we have $r=4$ (four periods were considered).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also in both of the above figures, the professor took the &lt;em&gt;expectation&lt;/em&gt; of the error $E_N$, i.e. he actually ran the experiment 1000 times and took the average $E_N$ for each frequency, which is what helps to give the &quot;smooth&quot; error curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;: I do not understand what makes the error $E_N$ stay the same as we increase $N$ for the non-periodic input case, but makes $E_N$ decrease in the periodic case as we increase the number of periods that we collect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help!&lt;/p&gt;&#xA;" OwnerUserId="17640" LastEditorUserId="128" LastEditDate="2020-03-02T09:28:00.463" LastActivityDate="2020-03-02T09:28:00.463" Title="System Identification with Periodic Signal Input" Tags="|discrete-signals|fourier-transform|linear-systems|system-identification|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26198" PostTypeId="2" ParentId="23885" CreationDate="2015-10-03T11:59:39.997" Score="1" Body="&lt;p&gt;Take the first model and train your model noise matrix $\bf{Q}$ to account for the variable acceleration. A popular model is the Singer model from 1990 (see [1]).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Singer, R. A., “Estimating Optimal Tracking Filter Performance for Manned Maneuvering Targets,” IEEE Transactions on Aerospace and Electronic Systems, vol. AES-6, no. 4, .pp. 473-483, July 1990.&lt;/p&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2015-10-03T11:59:39.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26199" PostTypeId="1" AcceptedAnswerId="26202" CreationDate="2015-10-01T11:28:13.223" Score="9" ViewCount="7234" Body="&lt;p&gt;I know from wikipedia that auto correlation in done on the same signal while cross correlation is done on different signals.But what does this actually imply in terms of application.I can always apply cross correlation on same signals and get same output.&#xA;And in convolution one signal is reversed.Mathematically i understaand the formulas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what does these three mean in terms of applications?&lt;/p&gt;&#xA;" OwnerUserId="17648" OwnerDisplayName="Chirag Ahuja" LastActivityDate="2015-10-03T15:42:33.340" Title="Auto Correlation vs Cross Correlation vs Convolution and their applications" Tags="|correlation|autocorrelation|cross-correlation|convolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26200" PostTypeId="1" CreationDate="2015-10-03T13:34:57.640" Score="1" ViewCount="1168" Body="&lt;p&gt;I have accelerometer &lt;code&gt;[x,y,z]&lt;/code&gt; data recorded from various activities.  I am not looking at any filtering techniques (which I have seen within this forum) because I want to be able to measure the amplitude of the noise for each activity sample set using a global time-domain feature &lt;code&gt;average loudness&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious to know if I can center the signal around &lt;code&gt;0g&lt;/code&gt;, similarly to the &lt;code&gt;X Data Minus Mean&lt;/code&gt; vector plot, but without the &lt;code&gt;x-axis&lt;/code&gt; orientation i.e. the signal shifting up and down?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the &lt;code&gt;x-axis&lt;/code&gt; data from one of my activities below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/G9wwf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G9wwf.jpg&quot; alt=&quot;ACCEL&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping that by subtracting the mean from the &lt;code&gt;x-axis&lt;/code&gt; data would yield this, but all it has done is shifted the entire signal down to around &lt;code&gt;0g&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I ask is because I am unsure if computing a time-domain feature such as &lt;code&gt;average loudness&lt;/code&gt; will work with the signal shifting up and down?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Average Loudness/Energy:  &lt;a href=&quot;https://i.stack.imgur.com/JboDH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JboDH.png&quot; alt=&quot;AE&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15770" LastActivityDate="2015-10-03T17:48:21.623" Title="Modification of Accelerometer Data for Feature Extraction" Tags="|matlab|signal-analysis|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26201" PostTypeId="2" ParentId="26200" CreationDate="2015-10-03T15:10:54.343" Score="2" Body="&lt;p&gt;Your data is composed of a majoriy of low-activity regions, with higher-amplitiude  sparse/concentrated activities. The bad news is that most of the methods to achieve your goal are likely to somehow filter your data. The good news is that non-linear filtering could help you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not concerned with calculations and real-time yet, I would suggest first a centered median filter to extract a robust $0 g$ estimate, and remove it from the data. In other words: choose an appropriate left-right span of $K$. In each window around index $k$, computes the signal $\hat{s}(k) = s(k) - \textrm{median} [s_{k-K},\ldots,s_{k+K}]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A median is a non-linear filter minimizing the $ell_1$ norm (like the $ell_2$ norm minimization yields the standard mean). It is somewhat robust to outliers, and since yours are both above and below your thought $0 g$ estimate, a running median (computed around each sample) could extract this 0-level reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at your plots, start with $K=50,100,200$ to see if this starts to provides you with what you are looking for. Then, more involded techniques could be considered.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-10-03T15:43:47.480" LastActivityDate="2015-10-03T15:43:47.480" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26202" PostTypeId="2" ParentId="26199" CreationDate="2015-10-03T15:42:33.340" Score="7" Body="&lt;p&gt;I can tell you of at least three applications related to audio. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Auto-correlation can be used over a changing block (a collection of) many audio samples to find the pitch. Very useful for musical and speech related applications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cross-correlation is used all the time in hearing research as a model for what the left and ear and the right ear use to figure out a sound's location in space (this is called sound source localization). In the case of two microphones you would cross-correlate the left channel with the right channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Convolution is used in simulating reverberation. A room's impulse response can be determined from measurements and that impulse response can be convolved with any sound source to simulate the reverberant response (at the impulse response recording's exact location).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this answer isn't complete but maybe it can give you some idea that there is in fact a practical use for auto- and cross- correlation!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in general, auto-correlation can be used to extract properties of a signal, cross-correlation can exploit the information between two related signals, and convolution can be used to modify the properties of an incoming signal based on some time, frequency, and phase response specified by the impulse response you're convolving the source with.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-10-03T15:42:33.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26203" PostTypeId="2" ParentId="26200" CreationDate="2015-10-03T16:58:56.750" Score="0" Body="&lt;p&gt;Your AE(x) equation sure looks like what I'd call the &quot;average power&quot; of a time sequence. And non-zero DC levels will influence that AE(x) value. But I have the impression you're trying to measure the energy in just the transient spikes of your signal and ignore the DC levels upon which those spikes are riding. If I'm correct, perhaps a &quot;moving variance&quot; estimation process would be useful. (Computing a &quot;moving variance&quot; is similar in concept to computing a &quot;moving average&quot;.) If you e-mail me at R_dot_Lyons_@_ieee_dot_org I can send you some material on moving variance estimation. Then again, maybe just passing your signal through a digital differentiator will produce useful information. I'm just throwing out ideas here.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-03T16:58:56.750" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26204" PostTypeId="2" ParentId="26200" CreationDate="2015-10-03T17:48:21.623" Score="-1" Body="&lt;p&gt;The abrupt DC shifts appear like some trend. (Though off-topic, can I know what physical variation map to these DC shifts). As suggested previously, the problem can be circumvented, to certain extent, by using non-linear filtering. I can think about the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Carry out an Empirical Mode Decomposition (EMD, matlab code available here: &lt;a href=&quot;http://perso.ens-lyon.fr/patrick.flandrin/emd.html&quot; rel=&quot;nofollow&quot;&gt;http://perso.ens-lyon.fr/patrick.flandrin/emd.html&lt;/a&gt;). EMD decomposes the signal into few intrinsic mode functions (IMFs). When you add all the IMFs you get back the original signal. The key in the decomposition is the notion of data dependent filtering, and the last few IMFs capture the slow varying signal trend. Hence, I will suggest you do an EMD and discard the last few IMFs, and see the resulting summed up signal.&lt;/li&gt;&#xA;&lt;li&gt;Differentiation: As suggested above but take care to choose your finite difference operation appropriately, else it may blow up the noise transients as well.&lt;/li&gt;&#xA;&lt;li&gt;Though you are not willing to do this, I will still suggest, the average loudness here will refer to the high frequency spectrum energy content.This is implicitly what you will be obtaining from option 1 and 2.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2015-10-03T17:48:21.623" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26205" PostTypeId="2" ParentId="11331" CreationDate="2015-10-03T18:22:49.430" Score="3" Body="&lt;p&gt;Sensors provide analog or digital insights into a reality that is difficult to grasp. Just like your senses do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sensors are designed to seize a special portion of a measurable phenomenon: electrical, chemical, physical...  Just like your senses do. The usual five ones are sight, hearing, touch, smell and taste, but there are more to human skills.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Understanding a physical phenomenon via signal processing is like trying to tell the main ingredients from the  recipe of the meal you ordered in a restaurant last evening. You do not know what happened in the kitchen, yet you have chosen what to order, and have seen, tasted, smelled, even touched the plate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of your senses and understanding provided you with hints or knowledge, but you can never be sure, as some cooks master sense deception. What you see as an artifial green marmelade made of strawberries can taste like apple jelly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on you cooking expertise, the combination of all your senses can bring you closer to the the actual recipe, provided that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;you can use your senses often enough: if you take only one bite every 10 days, it is unlikely you get the menu. This is data sampling;&lt;/li&gt;&#xA;&lt;li&gt;each sense is sensitive enough. This is sensor sensitivity;&lt;/li&gt;&#xA;&lt;li&gt;your sense list is close to complete, and the coverage is sufficient for your purpose. If you cannot taste sugar anymore, you won't be able to cook some meals for people who still can taste it. This is measurement span;&lt;/li&gt;&#xA;&lt;li&gt;you are able infer, or model some of the processes you are unaware of. This is modeling.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sensor fusion is the art and science of combining sensory data, knowledge and models from disparate sources so that the resulting information has more validity or less uncertainty than individual  sources. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples: The act of averaging $N$ sensor data for the same deterministic signal, with different stochastic realizations of a noise term, is the most basic sensor fusion operation. With the model of independent Gaussian noises of deviation $\sigma$, the average theoretically yields a $\frac{\sigma}{\sqrt{N}}$ deviation(less uncertain). The combination of three channels (Red, Blue, Green) offers a color image (more valid than a monochannel gray-scale). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PisWI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PisWI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first example combines information from a single sensor model. The second one from sensors operating in the same domain (electromagnetic waves), yet in different portions of the spectrum. In general, fusion operates on different sensors with different rates, ranges, domains and mostly units.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is highly dependent on the phenomenon you are looking at, the available sensors, and the information you are looking for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physics tell you the potential information you can get from your sensors. The mathematics can model how they are related or complementary, or what is irrelevant information (noise). The algorithms will combine the previous knowledge as optimally as possible, in terms of precision, accuracy or speed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The topic is related to the realms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Sensor_fusion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sensor fusion&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_fusion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Data fusion&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Information_integration&quot; rel=&quot;nofollow noreferrer&quot;&gt;Information integration&lt;/a&gt;, with a short overview in &lt;a href=&quot;http://www-prima.imag.fr/jlc/papers/SigProc-Fusion.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Principles and Techniques for Sensor Data Fusion&lt;/a&gt;. Many more books are available, as in &lt;a href=&quot;https://mathoverflow.net/questions/93003/best-book-for-learning-sensor-fusion-specifically-regarding-imu-and-gps-integra&quot;&gt;Best book for learning sensor fusion, specifically regarding IMU and GPS integration&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your actual problem, a first step would consist in understanding &lt;a href=&quot;https://electronics.stackexchange.com/questions/36589/what-are-the-differences-between-a-gyroscope-accelerometer-and-magnetometer&quot;&gt;What are the differences between a gyroscope, accelerometer and magnetometer?&lt;/a&gt; which could help you push techniques a little further. And achieve the goal of fusion: &lt;strong&gt;using sensor differences, sum their data, in the most clever way&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:57:54.877" LastActivityDate="2015-10-03T19:54:18.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26206" PostTypeId="1" CreationDate="2015-10-03T19:02:54.907" Score="3" ViewCount="277" Body="&lt;p&gt;For the following code, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X=[2 2 3 100 4 0 98 100 90 2 3 67 98 0 6 6 89 9 21 78]&#xA;[C,L]=wavedec(X,N,'db1');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;N&lt;/code&gt; is the level , I get n(approximation and detail coefficients)&gt;n(X) &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What does this signify? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why does this increase happen? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="17642" LastEditorUserId="1629" LastEditDate="2016-06-09T14:37:56.090" LastActivityDate="2016-10-07T19:49:44.523" Title="Wavelet decomposition" Tags="|wavelet|approximation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26207" PostTypeId="2" ParentId="11331" CreationDate="2015-10-03T19:47:45.100" Score="3" Body="&lt;p&gt;Sensor fusion for 3D orientation is all about joining multiple sources of data (sensors) to extract more accurate information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically in the case of &lt;a href=&quot;https://en.wikipedia.org/wiki/Inertial_measurement_unit&quot; rel=&quot;nofollow&quot;&gt;IMU&lt;/a&gt;s, you can join many measurements (technically DoM, and not DoF) to get orientation and position data (this is the technically DoF).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you have a system with accelerometer, gyrometer, magnetometer, barometer and GPS (usual high-end cellphone capabilities, and some hardware boards features). Here is what you actually have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You have acceleration measurement, but if you are moving, you can't separate what is the gravity component of the acceleration and the actual movement acceleration (unless you are not really moving and only the gravity is left). You can assume your movement varies more rapidly than the gravity change and apply a filter to separate high-frequency components from the low-frequency ones, but you still won't get good results where the assumption doesn't apply (such as a long turn). You also can't simply subtract the gravity from where you &lt;em&gt;think&lt;/em&gt; it is, simply because that is part of the orientation result, not an input. Anyway, even if you knew where gravity is pointing, you will only know where &lt;em&gt;down&lt;/em&gt; is, but you won't know where you are around (your angle in the plane perpendicular to) the gravity vector.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have a girometer that registers turn ratio. It is &lt;strong&gt;not&lt;/strong&gt; a gyroscope. A gyroscope would actually result in an attitude information, whereas you have to integrate the gyrometer output to obtain that information. The problem with this kind of sensor is that, first, you don't have a starting orientation (unless you assume one, and assumptions have problems as above); and second and more important, you have bias and noise (from sensor, numerical, etc), which messes up any integrator.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have a magnetometer. The magnetic field of the Earth is very weak and thus subject to a lot of ambient noise. Think any RF emitters such as WiFi, cell phone, FM radio, walkie-talkies and even unlikelier ones such as HAM radios, airplane radios, pirate radios and TVs/monitors. If you think your flat-panel energy-saving TV doesn't mess with a compass, think again. So, it is noisy as hell. Magnet-and-oil analog compasses fix this by immersing the needle in a viscous fluid which acts like a mechanical low-pass filter, and because of this it isn't fast enough and even so you still will get wrong readings if you're near a power line.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have a barometer. You can estimate height from this information, but it is really just an estimate. As it is, beware of atmospheric effects (if there's wind, there's pressure difference somewhere) and you have to keep in mind that your data is relative to some reference, but not necessarily &lt;em&gt;ground&lt;/em&gt;. Remember that usually the reference is &lt;em&gt;ground at sea level&lt;/em&gt; and hey, sea levels change all the time with tides. So, it gives some insight into a single axis of position, and is usually only good for detecting variations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have GPS. However, GPS signal is obtained from satellites in space. Do you really expected to get millimeter position info from that? You can even get that if holding still for many minutes or even hours, by filtering, but one-meter accuracy is pretty standard for most civillian GPS receivers, and enough for most commercial applications. Anyway, even if you didn't have position noise, lack of signal in closed spaces or bad weather, you still would get only position information, nothing like attitude.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;With all that in mind, sensor fusion itself is the combining of all the data you get to try to get more accuracy. Comparing what movement is common to different sensors with different characteristics is key. But as it is, there are many ways to do it and each implementation usually differs from the other in implementation. Some ideas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Filtering_problem_%28stochastic_processes%29&quot; rel=&quot;nofollow&quot;&gt;Filter&lt;/a&gt; stuff. Low-pass and high-pass &lt;a href=&quot;https://en.wikipedia.org/wiki/Filter_%28signal_processing%29&quot; rel=&quot;nofollow&quot;&gt;filter&lt;/a&gt; may improve the data (by canceling some noise) and may separate what is one information into two.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Kalman_filter&quot; rel=&quot;nofollow&quot;&gt;Kalman filtering&lt;/a&gt; (in various forms) is quite common to clear some noise and join multiple sources, because it is computationally fast and can also be used as &lt;a href=&quot;https://en.wikipedia.org/wiki/Predictor_corrector&quot; rel=&quot;nofollow&quot;&gt;predictor/corrector&lt;/a&gt; and to compensate data delay differences between sensors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the knowledge of the problem to enhance comparison equations. Use current orientation plus future estimates to predict gravity; integrate the acceleration to obtain velocity; integrate again to get position, use GPS to correct it, filter and derivate back to get estimates; the GPS also has some velocity info from doppler effects, so use that; use GPS dilution of position to estimate how accurate is your GPS data; integrate the gyrometer to correct the next gravity vector; low-pass the magnetometer and use as a weak north reference, with magnetic declination corrected from GPS position; use barometer info from start to get approximate ground level, and derivate the pressure data to enhance Z position information. Create your own method.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Filter it all, but don't filter too much or you won't get useful information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Even if &quot;Sensor Fusion&quot; is sold as a done method, it is almost an open ended problem. Even using an established methods will still require quite a lot of tuning to get the best results, to exploit different sensor characteristics to get better data.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="17641" LastActivityDate="2015-10-03T19:47:45.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26208" PostTypeId="1" CreationDate="2015-10-03T22:52:34.897" Score="0" ViewCount="88" Body="&lt;p&gt;Is there a good book reference on the definition of &quot;subharmonic frequency&quot; as integer fractions of the highest available frequency?&lt;/p&gt;&#xA;" OwnerUserId="17645" LastActivityDate="2015-10-05T05:48:09.970" Title="What is a good book reference on the definition of &quot;subharmonic frequency&quot;?" Tags="|reference-request|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26209" PostTypeId="1" CreationDate="2015-10-04T00:16:42.537" Score="1" ViewCount="5151" Body="&lt;p&gt;Alright, to start out I am a mechanical engineer with very little circuits and digital signal processing background. So please excuse my ignorance as this is far out of my usual territory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When looking at the magnitude of an FFT of a signal, I understand that the magnitude is in the units of the time signal (in my case it is Volts). I also understand that you need to divide the FFT results by the transform length in order to normalize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't completely understand is how the magnitude of the FFT result relates back to the time signal. From what (I think) I understand it should be related to the amplitude of the time signal. From my MATLAB code that I made (posed below) it seems that it returns 1/4 of the amplitude of the signal. Is this correct? What is the physical meaning of it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then on a related note, if it is related to the amplitude of a time signal, what is the sampling rate needed to get a decent measure of the amplitude. I know the highest resolvable frequency for an FFT is the nyquist frequency, but I haven't been able to find anything about accurate measurements of a signal's amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any and all help on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f_s = 20;              % sampling (hz)&#xA;&#xA;f_w = 2;                % frequency of wave (hz)&#xA;A = 5;                  % amplitude&#xA;&#xA;&#xA;d_t = 1/f_s;&#xA;t = 0:d_t:2-d_t;&#xA;n = length(t);&#xA;&#xA;% Creating the time signal&#xA;time_signal = A*sin(f_w*2*pi*t);&#xA;&#xA;% Generating and applying a hanning window on the time signal&#xA;window = hann(n)';&#xA;windowed_time_signal = time_signal.*window;&#xA;&#xA;% Taking FFT of windowed time signal&#xA;raw_fft = fft(windowed_time_signal);&#xA;&#xA;% Frequency resolution of FFT&#xA;d_f = f_s/n;&#xA;&#xA;% Frequency spectrum for full FFT&#xA;f_spectrum_full = (0:n-1)*d_f;&#xA;&#xA;% Only first half of FFT contains useful information&#xA;half_fft = raw_fft(1:(n/2));&#xA;&#xA;% Frequency scale for half FFT&#xA;f_spectrum_half = (0:n/2-1)*d_f;&#xA;&#xA;% Magnitude of the half FFT&#xA;magnitude = abs(half_fft);&#xA;&#xA;% Normalized version of the magnitude&#xA;normalized = magnitude/(n); &#xA;&#xA;&#xA;figure (1)&#xA;&#xA;subplot(2,1,1)&#xA;plot(t,time_signal)&#xA;title('time wave')&#xA;&#xA;subplot(2,1,2)&#xA;plot(t,windowed_time_signal)&#xA;title('windowed time wave')&#xA;&#xA;&#xA;figure (2)&#xA;&#xA;subplot(3,1,1)&#xA;plot(f_spectrum_half,magnitude)&#xA;title('magnitude')&#xA;&#xA;subplot(3,1,2)&#xA;plot(f_spectrum_half,normalized)&#xA;title('magnitude')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17646" LastActivityDate="2016-05-02T10:52:04.067" Title="How does the Magnitude of an FFT relate back to the Time Series wave it was created from?" Tags="|fft|frequency-spectrum|time-frequency|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26213" PostTypeId="1" CreationDate="2015-10-04T18:15:54.880" Score="6" ViewCount="185" Body="&lt;p&gt;While going through the different types of reconstruction algorithm as mentioned in &lt;a href=&quot;https://www.scribd.com/document/412233846&quot; rel=&quot;noreferrer&quot;&gt;Richard G. Baraniuk - Compressive Sensing - Lecture Notes&lt;/a&gt; (Also on &lt;a href=&quot;https://docdro.id/DCMGrEb&quot; rel=&quot;noreferrer&quot;&gt;DocDroid&lt;/a&gt;), I came to know that minimum &lt;span class=&quot;math-container&quot;&gt;$ {L}_{1} $&lt;/span&gt; norm reconstruction is better than minimum &lt;span class=&quot;math-container&quot;&gt;$ {L}_{0} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ {L}_{2} $&lt;/span&gt; norm reconstruction.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone show me why &lt;span class=&quot;math-container&quot;&gt;$ {L}_{1} $&lt;/span&gt; norm is better by taking a simple signal vector of small length as an example?&lt;br&gt;&#xA;I would like to know what will be the final optimization results in each reconstruction method.&lt;/p&gt;&#xA;" OwnerUserId="17587" LastEditorUserId="128" LastEditDate="2019-06-03T04:39:22.087" LastActivityDate="2024-03-31T09:05:35.697" Title="Signal Reconstruction in Compressed Sensing with a Simple Vector Signal as an Example" Tags="|compressive-sensing|optimization|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26214" PostTypeId="1" CreationDate="2015-10-04T18:25:03.893" Score="4" ViewCount="5412" Body="&lt;p&gt;I am taking a graduate level course in Networking theory and applications and I am still a bit shaky on the difference between baseband and pass band scheming. The book I am using is Computer Networks 5th edition -- Andrew S Tanenbaum &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To my knowledge, passband scheming uses the changing of frequency, amplitude, and phase to modulate a analog signal. And base band uses encoding techniques like NRZ, NRZi, and Manchester encoding.&#xA;How does this work along side, frequency multiplexing and CDMA for multiple device access?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And can someone give me a layman explanation of carrier signals? And how I can maybe think of them as offsets like in assembly languages.&#xA;Thanks for helping!&lt;/p&gt;&#xA;" OwnerUserId="17662" LastEditorUserId="17662" LastEditDate="2015-10-04T18:37:37.367" LastActivityDate="2015-11-03T23:08:25.873" Title="Baseband vs Passband modulation" Tags="|modulation|theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26216" PostTypeId="1" AcceptedAnswerId="26217" CreationDate="2015-10-04T19:47:33.437" Score="0" ViewCount="159" Body="&lt;p&gt;I was looking at an example of a NN but I dont understand in the Answer i where the .68 come from or .6637 &lt;a href=&quot;https://i.stack.imgur.com/cGt8V.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cGt8V.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the &lt;a href=&quot;https://www4.rgu.ac.uk/files/chapter3%20-%20bp.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; of the tutorial&lt;/p&gt;&#xA;" OwnerUserId="10555" LastEditorUserId="80" LastEditDate="2015-10-04T19:57:42.740" LastActivityDate="2015-10-04T19:57:42.740" Title="Artificial Neural Network Example Problem" Tags="|algorithms|homework|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26217" PostTypeId="2" ParentId="26216" CreationDate="2015-10-04T19:57:10.657" Score="1" Body="&lt;p&gt;The tutorial states that each neuron uses the &lt;a href=&quot;https://en.wikipedia.org/wiki/Sigmoid_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;sigmoid activation function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NJDPR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NJDPR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That funciton is:&#xA;$$&#xA;\sigma(x) = \frac{1}{1+ e^{-x}}&#xA;$$&#xA;so j&lt;a href=&quot;https://www.google.com/search?q=exp(-0.755)&amp;amp;oq=exp(-0.755)&amp;amp;aqs=chrome..69i57.10343j0j4&amp;amp;sourceid=chrome&amp;amp;es_sm=119&amp;amp;ie=UTF-8#q=1%2F(1%2Bexp(-0.755))&quot; rel=&quot;nofollow noreferrer&quot;&gt;ust substitute $x = 0.755$ into that to get&lt;/a&gt; 0.68026719669.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-04T19:57:10.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26220" PostTypeId="1" CreationDate="2015-10-04T21:23:09.760" Score="1" ViewCount="609" Body="&lt;p&gt;I'm trying to extract / fill the walls in a floor plan, the walls are filled with a (cross-)hatch pattern at a more or less fixed angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've managed to remove most of the &quot;noise&quot; by masking the DFT so I have both the +45 deg lines and -45deg lines in separate images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The boundaries of the walls are quite obvious to the human observer but somehow I'm stuck at segementing those lines into groups, i.e connected components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I could think of is to apply a run-length encoding and then looking for subvectors of length 4 which fullfill a certain ratio of black and white. Or a cross-correlation of a pre-defined hatching pattern. The issue I have with these methods is that I'd have to introduce a parameter which has to be tuned for every floor plan, this is what I want to avoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm asking you guys whether you could give me some input how to approach this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H8Ak9.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H8Ak9.jpg&quot; alt=&quot;The problem&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17664" LastActivityDate="2018-05-28T08:56:43.627" Title="Filling hatched areas in image" Tags="|image-processing|matlab|image-segmentation|pattern|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26221" PostTypeId="1" CreationDate="2015-10-04T22:37:56.690" Score="1" ViewCount="995" Body="&lt;p&gt;I have seen both the formula of Fourier transform with positive and negative sign on exponential as  $$ X(\omega)=\int_{-\infty}^{\infty} x(t)e^{-j\omega t}dt$$ and $$ X(\omega)=\int_{-\infty}^{\infty} x(t)e^{j\omega t}dt$$ I am confused which one is the correct formula. I also solved for Fourier transform by taking the following example $$x(t)=\begin{cases} 1, \hspace{5mm} \text{for} \hspace{2mm} |t|&amp;lt;1 \\0, \hspace{5mm} \text{for} \hspace{2mm} |t|&amp;gt;1  \end{cases}$$ and got the same result as $$ X(\omega)=\begin{cases} 2\frac{\text{sin}\omega}{\omega}, \hspace{5mm} \text{when} \hspace{2mm} \omega \neq 0 \\2, \hspace{13mm} \text{when} \hspace{2mm} \omega = 0\end{cases}$$ Can anyone explain whether both the formula for Fourier transform are correct or not?&lt;/p&gt;&#xA;" OwnerUserId="17587" LastActivityDate="2015-10-04T22:54:42.373" Title="Positive or negative sign on Fourier transform formula" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ClosedDate="2015-10-05T20:11:43.057" ContentLicense="CC BY-SA 3.0" />
  <row Id="26222" PostTypeId="2" ParentId="26214" CreationDate="2015-10-04T22:51:56.223" Score="2" Body="&lt;p&gt;There is no unique definition, but in general baseband signals have a spectrum that starts close to DC. Most analog information sources that are considered in communications are baseband: audio, video, signals from sensors, images, etc. Also, any signal that is a sum of pulses of different shapes is a baseband signal; examples are NRZ and Manchester-encoded signals. Yet another definition is that a baseband signal has not been modulated, or its spectrum has not been shifted, for the purpose of matching it to a particular communication channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Passband signals were originally baseband, but were modulated, or frequency-shifted (or up-converted) for some purpose, usually to make them fit in a passband channel. Consider the case of AM radio. An audio signal is low-pass filtered to 10 kHz, resulting in a baseband signal with a spectrum from 0 Hz (or strictly, 20 Hz) to 10 kHz. Then, this signal is shifted up in frequency (upconverted) to make it fit into the 20 kHz channel assigned to the AM station. The receiver down-converts the signal back to baseband and plays it over the loudspeakers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you say, the upconversion process involves changing the amplitude, frequency and/or phase of a high-frequency carrier signal proportionally to the information-bearing baseband signal. The receiver uses the amplitude, frequency and/or phase of the carrier to reconstruct the baseband signal.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-04T22:51:56.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26223" PostTypeId="2" ParentId="26221" CreationDate="2015-10-04T22:54:42.373" Score="1" Body="&lt;p&gt;The definition with the negative in the exponent is the accepted definition of the Fourier transform... however, this is an arbitrary choice.  It could just as easily be defined with $e^{jw}$ and the inverse transform with $e^{-jw}$.  &lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2015-10-04T22:54:42.373" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26224" PostTypeId="2" ParentId="19855" CreationDate="2015-10-05T00:58:18.907" Score="0" Body="&lt;p&gt;A simple solution to this problem would be to fit the data to a decaying exponential taking all the data in the beginning and then less and less until the error is minimal. Then when you have the best decaying exponential parameters you can predict values where there's noise. &lt;/p&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2015-10-05T00:58:18.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26225" PostTypeId="2" ParentId="26209" CreationDate="2015-10-05T04:25:45.267" Score="0" Body="&lt;p&gt;If you ignore the energy in the negative frequencies, that cuts the FT energy of a real signal in half.  If you apply a typical Von Hann window, you cut the energy of a stationary signal roughly in (another) half.  Thus 1/4th.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the width of an FFT is not an exact integer multiple of the period of an exactly periodic signal then windowing artifacts will affect the magnitude estimate.  Thus, some interpolation may be required.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-10-05T04:25:45.267" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26226" PostTypeId="2" ParentId="26208" CreationDate="2015-10-05T05:48:09.970" Score="1" Body="&lt;p&gt;&quot;Highest available frequency&quot; sounds fishy but here's a reference from dynamics:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q21Se.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q21Se.png&quot; alt=&quot;Book clip&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cunningham, Walter Jack. &lt;i&gt;Introduction to Nonlinear Analysis&lt;/i&gt;. 1st ed. New York, USA: McGraw-Hill, 1958, pp. 191–192.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ISBN 10: 0070149178  ISBN 13: 9780070149175&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-10-05T05:48:09.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26227" PostTypeId="1" AcceptedAnswerId="26228" CreationDate="2015-10-05T07:25:10.440" Score="0" ViewCount="71" Body="&lt;p&gt;I want to ask Question about the Fourier series in continuous time domain.&#xA;I am following signal and systems 2nd Edition by Alan Oppenheim.&#xA;I have confusion in understanding the statement that &#xA;Specifically, suppose that $x(t)$ is real and can be represent in the form 3.25. then since $x^*(t) = x(t)$, we obtain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum^{+\infty}_{k\ =\ -\infty} a^*_k e^{-jk\omega_0t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it means the equation 3.25 is for both Real and imaginary?&lt;br&gt;&#xA;Equation 3.25 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum^{+\infty}_{k\ =\ -\infty} a_k e^{jk\omega_0t}$$&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="15347" LastEditDate="2015-10-05T07:41:22.883" LastActivityDate="2015-10-05T08:09:32.507" Title="Fourier series in continous time domain" Tags="|continuous-signals|fourier-series|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26228" PostTypeId="2" ParentId="26227" CreationDate="2015-10-05T07:57:46.363" Score="0" Body="&lt;p&gt;Under certain conditions, a $T$-periodic function can be represented by its Fourier series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{k=-\infty}^{\infty}a_ke^{jk\omega_0t}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\omega_0=2\pi/T$. The function $x(t)$ can be complex-valued, i.e. have non-zero real and imaginary parts. Note that generally the Fourier coefficients $a_k$ are also complex-valued (even for real-valued $x(t)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if $x(t)$ is real-valued, i.e., $x(t)=x^*(t)$, you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=x^*(t)=\sum_{k=-\infty}^{\infty}a^*_ke^{-jk\omega_0t}=&#xA;\sum_{k=-\infty}^{\infty}a^*_{-k}e^{jk\omega_0t}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing $(2)$ with $(1)$ you see that for real-valued $x(t)$ you get the condition $a_k=a^*_{-k}$, i.e. the Fourier coefficients show Hermitian symmetry. This condition is not satisfied for general complex-valued functions $x(t)$. However, the representation $(1)$ is valid no matter if $x(t)$ is real-valued or complex-valued.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-10-05T08:09:32.507" LastActivityDate="2015-10-05T08:09:32.507" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26230" PostTypeId="1" CreationDate="2015-10-05T09:29:25.970" Score="2" ViewCount="183" Body="&lt;p&gt;There are several method exist in the literature to calculate fractional Fourier transform. My interest is in chirp signals and want to find time delay estimation using fractional Fourier transform (Frft). Can anyone point me which algorithm I should use to obtain Frft. I think Frft canbe calculated several ways, by Eigen decomposition , Hermite polynomial, chirp convolution etc.Any comment would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15437" LastActivityDate="2015-10-05T09:29:25.970" Title="Optimal method to calculate Fractional Fourier for Chirp signals" Tags="|discrete-signals|fourier-transform|estimation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26231" PostTypeId="1" AcceptedAnswerId="26233" CreationDate="2015-10-05T12:20:54.750" Score="0" ViewCount="116" Body="&lt;p&gt;I want to ask Question about the Fourier series in continuous time domain while reading a book signals and systems Alan Oppenheim. I have confusion in understanding the statement on page 189 of its 2nd edition.&lt;br&gt;&#xA;To derive alternative form of Fourier series, we first rearrange the summation in Eq.3.25 as&#xA;$$x(t) = \sum^{+\infty}_{k\ =\ 1} [a_k e^{jk\omega_0t}+a_{-k} e^{-jk\omega_0t}]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where Eq. 3.25$$x(t) = \sum^{+\infty}_{k\ =\ -\infty} a_k e^{jk\omega_0t}$$&#xA;I want to know two things&lt;br&gt;&#xA;1) How summation from -infinity to +infinity changes to 1 to +infinity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) How we get this term $$a_{-k} e^{-jk\omega_0t}$$ in the equation. &lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="4298" LastEditDate="2015-10-05T12:27:38.327" LastActivityDate="2015-10-05T12:37:27.140" Title="Fourier Series Proof" Tags="|continuous-signals|fourier-series|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26232" PostTypeId="1" AcceptedAnswerId="26376" CreationDate="2015-10-05T12:24:59.063" Score="1" ViewCount="1481" Body="&lt;p&gt;Tried HDR Algorithms of OpenCV. Since the algorithm takes pretty much time. I tried few alternative steps as follows.&#xA;&lt;br&gt;&#xA;&lt;br&gt;Took sample images from: &lt;a href=&quot;http://www.easyhdr.com/examples/&quot; rel=&quot;nofollow noreferrer&quot;&gt;HDR Images&lt;/a&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;1. Divided the image into four equal regions as Top Left and Right, Bottom Left and Right&#xA;&lt;br&gt;2. Estimated the brighter region and the darker region from the Highly exposed image by taking average of the regions respectively&#xA;&lt;br&gt;3. Replaced the brighter region with the average of Low and Mid exposed image.&#xA;&lt;br&gt;4. Replaced the darker region with the average of High and Mid exposed image.&#xA;&lt;br&gt;5. Then merged the images back into a single image.&#xA;&lt;br&gt;  &#xA;&lt;br&gt; Can someone suggest how to compensate the difference in them&#xA;&lt;br&gt; Tried Exposure Compensator of OpenCV but does not get expected result.&#xA;&lt;br&gt; &#xA;&lt;br&gt; The result image looks like: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/wALIi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wALIi.jpg&quot; alt=&quot;HDR Image&quot;&gt;&lt;/a&gt;&#xA;&lt;br&gt; &lt;/p&gt;&#xA;" OwnerUserId="13454" LastEditorUserId="13454" LastEditDate="2015-10-12T05:37:50.657" LastActivityDate="2015-10-28T12:57:24.577" Title="HDR Imaging - Exposure Compensation" Tags="|image-processing|algorithms|opencv|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26233" PostTypeId="2" ParentId="26231" CreationDate="2015-10-05T12:37:27.140" Score="0" Body="&lt;p&gt;You just need to split the sum into the positive and the negative indices (without forgetting the index $k=0$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=a_0+\sum_{k=1}^{\infty}a_ke^{jk\omega_0 t}+\sum_{k=-\infty}^{-1}a_ke^{jk\omega_0 t}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By simply changing the sign of the index $k$ in the second sum in $(1)$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}x(t)&amp;amp;=a_0+\sum_{k=1}^{\infty}a_ke^{jk\omega_0 t}+\sum_{k=1}^{\infty}a_{-k}e^{-jk\omega_0 t}\\&amp;amp;=&#xA;a_0+\sum_{k=1}^{\infty}\left[a_ke^{jk\omega_0 t}+a_{-k}e^{-jk\omega_0 t}\right]\end{align}\tag{2}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-05T12:37:27.140" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26234" PostTypeId="1" AcceptedAnswerId="26237" CreationDate="2015-10-05T13:34:58.307" Score="0" ViewCount="144" Body="&lt;p&gt;Fourier series in continuous time domain while representing $a_k$ in rectangular form   $$ a_k = B_k + jC_k$$&#xA;But when using the value of $a_k$ in the main equation: $$ x(t) = a_0 + 2\sum^{+\infty}_{k\ =\ 1} [B_k\cos k\omega_0t - jC_k\sin k\omega_0t]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to ask from where $-$(minus) sign comes as there was no minus sign &#xA;main Equation&#xA;$$ x(t) = a_0 + 2\sum^{+\infty}_{k\ =\ 1} 2\mathrm{Re}\left[ e^j(k \omega_0t +\theta_k)\right]$$&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="8202" LastEditDate="2015-10-05T13:37:11.957" LastActivityDate="2015-10-05T16:11:27.203" Title="Value of $A_k$ in Fourier series" Tags="|continuous-signals|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26235" PostTypeId="1" CreationDate="2015-10-05T14:49:16.207" Score="0" ViewCount="147" Body="&lt;p&gt;I'm unsure how to sketch a tri signal with horizontal shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eg , let's say we want to sketch tri((t-4)/4). Can I reduce it to tri( (t/4) - 1 )? This would mean sketching a tri(t/4) signal and shifting it to the right by 1. Or should it be a tri(t/4) signal shifted to the right by 4?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found out on wikipedia that the rect signal is defined as rect((X-Y)/T) where you shift the center of the signal by varying Y. But I'm not sure if sketching tri applies the same concept.&lt;/p&gt;&#xA;" OwnerUserId="17629" LastEditorUserId="13320" LastEditDate="2016-11-13T13:21:28.163" LastActivityDate="2016-11-13T13:21:28.163" Title="Sketching a tri signal with horizontal shift" Tags="|discrete-signals|visualization|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26236" PostTypeId="1" CreationDate="2015-10-05T14:53:06.563" Score="1" ViewCount="559" Body="&lt;p&gt;I understand that discontinuities at the boundaries of a finite signal may introduce spectral leakage, that alter both the amplitude and phase spectra of the FFT, specially at low amplitudes. That is the explanation to several questions like (&lt;a href=&quot;https://dsp.stackexchange.com/questions/13844/baffled-by-fft-phase-spectrum&quot;&gt;baffled by fft phase spectrum!&lt;/a&gt;&quot;). In such questions, the examples are normally based on sine waves, where there is a dominant frequency, and the spectral leakage is noticeable in all the other frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signals are often more complex, with a more continuous amplitude spectrum, but even in that case - specially if they are low pass-filtered, there is a point where there is a noticeable discontinuity in the amplitude and phase diagrams.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example (in Octave):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 101;&#xA;x = exp(-linspace(-5,5,N).^2);&#xA;f = fftshift(fft(x));&#xA;subplot(211)&#xA;semilogy(abs(f))&#xA;subplot(212)&#xA;plot(unwrap(angle(f)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E194F.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E194F.png&quot; alt=&quot;FFT amplitude and phase of exponential signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the amplitude spectrum is bell-shaped as I expected at low frequencies. But when the amplitude goes below approximately &lt;code&gt;1e-11&lt;/code&gt;, the amplitude spectrum flattens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the frequencies where the amplitude spectrum is bell-shaped, the phase spectrum is a straight line with slope $\pi (N-1)/N$, which coincides with the effect of a time shift of $(N-1)/2$ from an even signal. At higher frequencies, it goes more or less linearly towards $\pi/2$ (although in this case the slope is not strictly constant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why there is such a harsh change in the spectra at that frequency? Is it a matter of numeric error in the computation of the FFT? The amplitude at the discontinuity is small (about &lt;code&gt;1e-11&lt;/code&gt;), but greater than machine error. And for other signals with narrower spectra, the amplitude at the discontinuity is higher. For instance, the same example but using a &quot;wider&quot; time signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = exp(-0.5*linspace(-5,5*(N-1)/N).^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17674" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-10-06T17:31:08.097" Title="At what amplitude does spectral leakage start to be noticeable in the phase spectrum?" Tags="|fft|discrete-signals|phase|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26237" PostTypeId="2" ParentId="26234" CreationDate="2015-10-05T16:11:27.203" Score="0" Body="&lt;p&gt;I'm afraid that all the formulas in your question are inaccurate. From what I understand, you're interested in the representation of &lt;em&gt;real-valued&lt;/em&gt; signals $x(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=a_0+2\Re\left\{\sum_{k=1}^{\infty}a_ke^{jk\omega_0t}\right\}=&#xA;a_0+2\sum_{k=1}^{\infty}\Re\left\{a_ke^{jk\omega_0t}\right\}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $a_k=B_k+jC_k$ and $e^{jk\omega_0t}=\cos(k\omega_0t)+j\sin(k\omega_0t)$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Re\left\{a_ke^{jk\omega_0t}\right\}=B_k\cos(k\omega_0t)-C_k\sin(k\omega_0t)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which you can substitute into Eq. $(1)$ to get the equation in your question (but without the $j$!). The minus sign in $(2)$ appears simply because $j\cdot j=-1$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-05T16:11:27.203" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26238" PostTypeId="2" ParentId="26236" CreationDate="2015-10-05T16:19:32.637" Score="1" Body="&lt;p&gt;The issue is that you are not taking a large enough piece of your original &lt;code&gt;x&lt;/code&gt; to get an accurate frequency domain representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try setting&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = exp(-linspace(-20,20,N).^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I do that, I get the bottom two plots below (the middle plots are for &lt;code&gt;-10,10&lt;/code&gt;).  The top plot is a replication of your values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the three pairs below, the left plot is the &lt;code&gt;semilogy&lt;/code&gt; plot of &lt;code&gt;x&lt;/code&gt; and the right plot is the &lt;code&gt;semilogy&lt;/code&gt; plot of its FFT &lt;code&gt;f&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PDyS6.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PDyS6.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Derivation of the FFT of a windowed Gaussian&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your question in the comments, we need to look at how a windowed version of:&#xA;$$&#xA;x(t) = e^{-t^2/2}&#xA;$$&#xA;can be analyzed in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The windowed version is:&#xA;$$&#xA;x_w(t) = w(t)e^{-t^2/2} &#xA;$$&#xA;where $w(t) = \mbox{rect(t/T)}$ if we use a rectangular window of width T (span from $-T/2$ to $+T/2$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform will be:&#xA;$$&#xA;X_w(\omega) = \int_{-T/2}^{T/2} e^{-t^2/2}  e^{j\omega t} dt\\&#xA;= 2 \int_{0}^{T/2} e^{-t^2/2} \cos(\omega t) dt\\&#xA;= \left . \sqrt{\frac{\pi}{2}} e^{-\omega^2/2} \left[&#xA;\mbox{erf}(\frac{t - j\omega}{\sqrt{2}}) + j \mbox{erfi}(\frac{ \omega - j t}{\sqrt{2}} )&#xA; \right] \right |^{T/2}_0\\&#xA;= \left . \sqrt{\frac{\pi}{2}} e^{-\omega^2/2} \left[&#xA;\mbox{erf}(\frac{t - j\omega}{\sqrt{2}}) + \mbox{erf}(\frac{ t + j\omega}{\sqrt{2}} )&#xA; \right] \right |^{T/2}_0&#xA;$$&#xA;&lt;a href=&quot;http://integrals.wolfram.com/index.jsp?expr=cos%28a%20x%29%20exp%28-x%5E2%2F2%29&amp;amp;random=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;where this integral is used&lt;/a&gt; and &lt;a href=&quot;http://reference.wolfram.com/language/ref/Erfi.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the identity&lt;/a&gt;&#xA;$$&#xA;\mbox{erfi}(\frac{ \omega - j t}{\sqrt{2}} ) = \mbox{erf}(j \frac{ \omega - j t}{\sqrt{2}} ) / j = -j \mbox{erf}(\frac{ t + j\omega}{\sqrt{2}})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I'm not sure where that gets us. I'll leave it for now and see if I can doodle more later.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;code&gt;scilab&lt;/code&gt; code below&lt;/strong&gt; (Sorry, I tend to use &lt;code&gt;scilab&lt;/code&gt; rather than Octave).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Q26236;&#xA;N = 101;&#xA;x1 = exp(-linspace(-5,5,N).^2);&#xA;f1 = fftshift(fft(x1));&#xA;x2 = exp(-linspace(-10,10,N).^2);&#xA;f2 = fftshift(fft(x2));&#xA;x3 = exp(-linspace(-20,20,N).^2);&#xA;f3 = fftshift(fft(x3));&#xA;&#xA;clf&#xA;subplot(321)&#xA;plot2d(&quot;nl&quot;,abs(x1))&#xA;title('x1')&#xA;subplot(323)&#xA;plot2d(&quot;nl&quot;,abs(x2))&#xA;title('x2')&#xA;subplot(325)&#xA;plot2d(&quot;nl&quot;,abs(x3))&#xA;title('x3')&#xA;&#xA;subplot(322)&#xA;plot2d(&quot;nl&quot;,abs(f1))&#xA;subplot(324)&#xA;plot2d(&quot;nl&quot;,abs(f2))&#xA;subplot(326)&#xA;plot2d(&quot;nl&quot;,abs(f3))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-06T15:53:27.920" LastActivityDate="2015-10-06T15:53:27.920" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26239" PostTypeId="1" CreationDate="2015-10-05T16:51:20.240" Score="1" ViewCount="3642" Body="&lt;p&gt;I have read &lt;a href=&quot;https://stackoverflow.com/questions/13810873/mfcc-13-coefficients&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;https://stackoverflow.com/questions/10103977/manipulating-mfcc-file&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;https://stackoverflow.com/questions/21645082/applying-neural-network-to-mfccs-for-variable-length-speech-segments&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;https://stackoverflow.com/questions/20027960/mfcc-in-speech-recognition&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; as a reference for computing the MFCC for a given wave file. Although, I am sure the values look wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short I followed the procedure in link 5.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Frame the signal into short frames.&#xA;For each frame calculate the periodogram estimate of the power spectrum.&#xA;Apply the mel filterbank to the power spectra, sum the energy in each filter.&#xA;Take the logarithm of all filterbank energies.&#xA;Take the DCT of the log filterbank energies.&#xA;Keep DCT coefficients 2-13, discard the rest.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For step 1&amp;amp;2: I compute the STFT (Complex STFT matrix (numFrames x NFFT)) and then abs(magnitude) square yields periodogram estimate of the power spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;for step 3: I used the numpy.fft.fftfreq which is where I am a little skeptical. &#xA;&lt;em&gt;The frequencies (Frequency axis values in Hz (NFFT) )to get the MEL scale were the ones which I got from the numpy.fft.fftfreq.&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Are these frequencies right?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I somehow feel the MFCC values are incorrect because they are in a cycle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the first five columns of the 12 rows (since I consider the 12 coefficients)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Row 1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-121.14120041896194,36.31415193982116,-14.643619564107524,-57.269690625660424,-234.4386822674871,32.84089116534659,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0,0.0,0.0,0.0,0.0,0.0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-121.22760208014765,36.066028260522074,-14.639033011310872,-57.2746737936947,-234.79568545601416,32.93127531287391&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row4:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0,0.0,0.0,0.0,0.0,0.0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row5:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;9.318848744263936e-14,-1.8994827565125353e-13,-4.1272764363905036e-14,-1.146561606635031e-14,-1.2768410873828004e-13,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row6:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0,0.0,0.0,0.0,0.0,0.0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row7:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-121.4016310115022,35.5644565194515,-14.62969158843071,-57.28437605058768,-235.51590947244588,33.11399608942877&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row8:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;3.511817254704773e-14,2.9096677134632476e-14,-5.78167494726597e-14,-1.169310279972752e-14,-2.271276447305103e-14&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row9:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-122.02396968016332,33.75128464855077,-14.595168239618843,-57.315447372114335,-238.1039561000439,33.77468522727183,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row10:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0,0.0,0.0,0.0,0.0,0.0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row11:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-122.48161817552142,32.39877413428054,-14.568682122506447,-57.334732903026804,-240.01937917255765,34.26769359167513&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Row12:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;3.6307708978933654e-14,2.0687378665389866e-13,3.2738059255324807e-14,-3.1731562727398686e-14,3.216220044843834e-13&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Since, I cannot post the entire code, I will post the important parts:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;part 1 of the code is with the wave file:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;self.samples, sampleRate= loadWAV(fileName, mono=True, startSec=None, endSec=None)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;part2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;self.X, self.freqHz, timeSec = stft(self.samples)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &#xA;X: (2D ndarray) Complex STFT matrix (numFrames x NFFT)&#xA;timeVec: (ndarray) Time axis values in seconds (numFrames)&#xA;freqHz: (ndarray) Frequency axis values in Hz (NFFT)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;part 3:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;self.mfccFeature2 = run(self.X, self.freqHz)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where run leads to this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; def run(self, mag, freq, nFilters=26, nCoeff=12):&#xA;     mag = mag**2&#xA;&#xA;     # create filterbank for given frequency axis&#xA;     filterBank = melFilterbankLinFreq(freq, nFilters=26)&#xA;&#xA;     &quot;&quot;&quot;change 1 : since there is a mismatch of operands, the * function is changed to dot &quot;&quot;&quot;&#xA;     # filter original magnitude spectrogram (original)&#xA;     magFilt = np.tile(mag, (nFilters, 1)) * filterBank.T&#xA;&#xA;     **New version where I think the problem exists:**&#xA;     magFilt_1 = np.tile(mag, (nFilters, 1))&#xA;     magFilt = np.dot(magFilt_1, filterBank.T)&#xA;&#xA;     # accumulate energy values over filterbanks&#xA;     fbEnergyLog = np.log(np.sum(magFilt, axis=1)+.0000001)&#xA;&#xA;     # perform DCT and keep only first nCoeff coefficients&#xA;     # DCT can work only on real values and the values are complex 128 instead of float&#xA;     return dct(fbEnergyLog.real)[1:nCoeff+1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17437" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-12-02T12:56:15.217" Title="MFCC coefficients" Tags="|audio|python|speech-recognition|mfcc|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26241" PostTypeId="2" ParentId="23941" CreationDate="2015-10-05T18:38:31.657" Score="2" Body="&lt;p&gt;Yes, &lt;strong&gt;most&lt;/strong&gt; of the known &lt;strong&gt;multiscale or multirate decompositions&lt;/strong&gt;, as long as they combine at one stage a non-ideal filter and a subsampling operator, &lt;strong&gt;induce some kind of aliasing&lt;/strong&gt; at the analysis stage. And &lt;strong&gt;the Laplacian pyramid does so&lt;/strong&gt;. But proper designs allow perfect reconstruction, so the aliasing can be reversed or cancelled, and kept reasonable in the case of processing between analysis and synthesis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest form of alias cancellation arises with Haar sum and difference filters. Consider $h_l = [1,1]$ and $h_h = [1,-1]$, the sum and difference filters, followed by a 2-fold downsampling. Both filters have very poor frequency responses, and cause aliasing with downsampling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vlbs0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vlbs0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take signal $X=[a,b]$. With the above scheme, you get two outputs $y_l = a+b$ and $y_h = b-a$, from which you can recover $X$ with $(y_l-y_h)/2 = a$ and  $(y_l+y_h)/2 = b $. The latter operations are filtering by an averaged difference filter, and an averaging filter, e.g. the same as above, with a different scaling factor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is the magic of &lt;a href=&quot;http://cas.ensmp.fr/~chaplais/wavetour_presentation/filtres/Perfect_Reconstruction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;perfect reconstruction filter-banks&lt;/a&gt;: from well-chosen imperfect analysis filter-banks (with some decimation), to be able to design a synthesis filter-bank, itself imperfect, that cancels aliasing and distorsion of the whole analysis-synthesis system. It may happen as long as you have two or more channels, and with a little oversampling in the system, you can even find optimized inverse filter-banks.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-12-29T09:32:32.100" LastActivityDate="2016-12-29T09:32:32.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26243" PostTypeId="1" AcceptedAnswerId="26247" CreationDate="2015-10-05T20:25:30.517" Score="2" ViewCount="65" Body="&lt;p&gt;I am trying to figure out why a 3D cube doesn't project in the right place in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I start with the camera at origin and the cube centered at &lt;code&gt;(0,0,1)&lt;/code&gt; world coordinates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3CH75.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3CH75.png&quot; alt=&quot;front&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I create a 3D rotation &lt;code&gt;R&lt;/code&gt; of 45 degrees around the Y axis:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(0.707106781, 0, 0.707106781,&#xA;0, 1, 0,&#xA;-0.707106781, 0, 0.707106781)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I set the camera to use rotation &lt;code&gt;R^-1&lt;/code&gt;, with a translation of &lt;code&gt;R * (0,0,1)&lt;/code&gt; (these are camera to world transformations). The camera should have rotated 45 degrees CCW around the cube (I can confirm I have &lt;code&gt;0.707106781&lt;/code&gt; translation on x and z).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, I would expect to see the cube with the same scale, still centered, and with one of the edges right in the middle of the image. But this is what I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vvg2i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vvg2i.png&quot; alt=&quot;side-45&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The procedure I use to project a 3d point &lt;code&gt;X&lt;/code&gt; is (pseudo code):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;bring into camera coordinates: &lt;code&gt;Xc = R^-1 * X - R^1 * translation&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;transform into image coordinates: &lt;code&gt;x = Xc * focal length / Xc.z + principal point&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have read the theory from various sources and it seems I am following the rules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just artificial data, so not sure if focal length and principal point can have any effect on it? What am I doing wrong? Why is the cube not centered?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I construct the cube like this (duplicate vertices are there because I need them to draw lines):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  cv::Matx31d center(0,0,1);&#xA;  double delta = 0.2;&#xA;&#xA;  std::vector&amp;lt;cv::Matx31d&amp;gt; volumeCorners = {&#xA;    // back&#xA;    (center + cv::Matx31d(-delta, delta, delta)),&#xA;    (center + cv::Matx31d(delta, delta, delta)),&#xA;&#xA;    (center + cv::Matx31d(delta, delta, delta)),&#xA;    (center + cv::Matx31d(delta, -delta, delta)),&#xA;&#xA;    (center + cv::Matx31d(delta, -delta, delta)),&#xA;    (center + cv::Matx31d(-delta, -delta, delta)),&#xA;&#xA;    (center + cv::Matx31d(-delta, -delta, delta)),&#xA;    (center + cv::Matx31d(-delta, delta, delta)),&#xA;&#xA;    // right&#xA;    (center + cv::Matx31d(delta, delta, delta)),&#xA;    (center + cv::Matx31d(delta, delta, -delta)),&#xA;&#xA;    (center + cv::Matx31d(delta, delta, -delta)),&#xA;    (center + cv::Matx31d(delta, -delta, -delta)),&#xA;&#xA;    (center + cv::Matx31d(delta, -delta, -delta)),&#xA;    (center + cv::Matx31d(delta, -delta, delta)),&#xA;&#xA;    // front&#xA;    (center + cv::Matx31d(delta, delta, -delta)),&#xA;    (center + cv::Matx31d(-delta, delta, -delta)),&#xA;&#xA;    (center + cv::Matx31d(-delta, -delta, -delta)),&#xA;    (center + cv::Matx31d(delta, -delta, -delta)),&#xA;&#xA;    (center + cv::Matx31d(-delta, -delta, -delta)),&#xA;    (center + cv::Matx31d(-delta, delta, -delta)),&#xA;&#xA;    // left&#xA;    (center + cv::Matx31d(-delta, delta, -delta)),&#xA;    (center + cv::Matx31d(-delta, delta, delta)),&#xA;&#xA;    (center + cv::Matx31d(-delta, -delta, delta)),&#xA;    (center + cv::Matx31d(-delta, -delta, -delta)),&#xA;  };&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use a right-handed coordinate system, with the y axis pointing down, for world and camera coordinates, while image has origin at top left.&lt;/p&gt;&#xA;" OwnerUserId="9120" LastActivityDate="2015-10-05T21:51:29.630" Title="Why is this projection wrong?" Tags="|computer-vision|projection|geometry|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26244" PostTypeId="2" ParentId="22860" CreationDate="2015-10-05T20:46:27.137" Score="1" Body="&lt;p&gt;It is not possible to do this trivially because any correction based on momentary values of the input signal will introduce unpleasant distortion. A first order filter have low-pass properties which is unacceptable. A higher order filter will introduce ringing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any solution based on signal analysis is moot because ultimately they will all be more complicated than the naive solution which is to do the bookkeeping mentioned in the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest implementation of the bookkeeping solution that I have been able to come up with is to have a list of sounds sorted on priority and two counters. One counter for the number playing voices and one for the number of queued voices. The list is traversed once forwards from [0, totalVoiceCount] and once backwards from [end, totalVoiceCount]. In the forwards step, sounds are played, faded in and queued. In the backwards step, sounds are faded out, and played.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other discontinuities (such as volume and pitch) are fixed by lowpass filtering the variables as mentioned in the answer by Olli.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopes this helps someone! :)&lt;/p&gt;&#xA;" OwnerUserId="15520" LastEditorUserId="15520" LastEditDate="2015-10-15T13:32:10.193" LastActivityDate="2015-10-15T13:32:10.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26245" PostTypeId="1" AcceptedAnswerId="26250" CreationDate="2015-10-05T20:58:08.850" Score="1" ViewCount="273" Body="&lt;p&gt;I am a bit confused if the following signal is baseband or passband:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(t) = x(t) \cos(2 \pi f_c t) - j \: y(t) \sin(2 \pi f_c t),$&#xA;where $j = \sqrt{-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is clearly not real, I cannot say it is passband. On the other hand, since it contains the frequency $f_c$, it should not be a baseband. Am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;" OwnerUserId="15078" LastActivityDate="2015-10-05T23:05:56.577" Title="Baseband vs. Passband" Tags="|modulation|theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26246" PostTypeId="2" ParentId="26235" CreationDate="2015-10-05T21:42:28.207" Score="1" Body="&lt;p&gt;The &lt;em&gt;peak&lt;/em&gt; of the &lt;code&gt;tri&lt;/code&gt; signal is at the point where the &lt;em&gt;argument&lt;/em&gt; of &lt;code&gt;tri&lt;/code&gt; (that thingy inside the parentheses following &lt;code&gt;tri&lt;/code&gt;) equals $0$. The&#xA;&lt;em&gt;base&lt;/em&gt; of the &lt;code&gt;tri&lt;/code&gt; signal extends from the point where the argument equals&#xA;$-\frac 12$ to the point where the argument equals $+\frac 12$ (or $-1$ to $+1$ depending on what you are calling &lt;code&gt;tri&lt;/code&gt;).  Thus, &#xA;&lt;code&gt;tri&lt;/code&gt;$\left(\frac{t-t_0}{T}\right)$ is an isoceles triangle whose &lt;em&gt;apex&lt;/em&gt;&#xA;is at the point $(t_0,1)$ and whose base extends from $t_0-\frac{T}{2}$&#xA;to $t_0+\frac{T}{2}$ (or from $t_0-T$ to $t_0+T$ for the other&#xA;interpretation of &lt;code&gt;tri&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-10-05T21:42:28.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26247" PostTypeId="2" ParentId="26243" CreationDate="2015-10-05T21:51:29.630" Score="1" Body="&lt;p&gt;My translation should have described a rotation around the center of the cube, but it was wrong. I changed it to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rotate45 * (translation - center) + center&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I get the cube in the middle with the right angle.&lt;/p&gt;&#xA;" OwnerUserId="9120" LastActivityDate="2015-10-05T21:51:29.630" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26248" PostTypeId="1" CreationDate="2015-10-05T21:59:39.933" Score="2" ViewCount="4076" Body="&lt;p&gt;I generate random spike data that represent the ouput from a rotary encoder. Here the output of my algorithm:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lJIYf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lJIYf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;The first plot is position, then velocity and then acceleration. Even though I downsample my position vector and pass it to a average filter of 20 points, the derivative are very sensitive as you can see. I check the following question: &#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/9498/have-position-want-to-calculate-velocity-and-acceleration&quot;&gt;have position, want to calculate velocity and acceleration&lt;/a&gt;. Few option seem to be available , but I don't get the answer , the Savitzky-Golay Filters  is just a smoothing function, I don't get how he get the velocity, also what are the orther alternatives. &lt;/p&gt;&#xA;" OwnerUserId="17386" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2016-12-30T22:37:58.813" Title="Derive velocity and acceleration from position" Tags="|filters|filtering|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26249" PostTypeId="2" ParentId="26248" CreationDate="2015-10-05T23:02:41.730" Score="3" Body="&lt;p&gt;There are several ways to calculate the derivative of a stochastic signal. I will show you two methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, adjust the output of a second order transfer function to your data: $${\omega_n^2}/({s^2+2\zeta\omega_n s+\omega_n^2})$$ Once you are satisfied with the fit, put an additional $s$ in the numerator and you will get the derivative of your signal: $${\omega_n^2\times s}/({s^2+2\zeta\omega_n s+\omega_n^2})$$ You can use a &lt;em&gt;bilinear transformation&lt;/em&gt; and convert this solution into a discrete one, to implement in a software easily, if you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another solution is to use the spectrum and calculate the &lt;em&gt;fft&lt;/em&gt; of your signal. Then filter it vanishing the small values in the higher frequencies. Now, take the result and multiply it by $j\omega$. This is taken from the Fourier Transform Properties Table to calculate the derivative of a signal. Finally, redo the signal with &lt;em&gt;ifft&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I added here a code to exemplify these aforementioned algorithms. The output picture is added as well at the end of the post. I hope it helps.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% \brief: this code exemplifies two techniques suitable for&#xA;%         calculating the first-order derivative of an&#xA;%         stochastic signal.&#xA;%&#xA;% \algorithm 1: LTI transfer function integrated with Tustin.&#xA;% \algorithm 2: FFT derivative property.&#xA;%&#xA;% \author:     Luciano Augusto Kruk&#xA;% \web:        www.kruk.eng.br&#xA;&#xA;% some constants:&#xA;fs = 1000; % [Hz] sample rate&#xA;T  = 1/fs;&#xA;t  = 0:T:0.5;&#xA;nT = length(t);&#xA;% signal + colored noise:&#xA;[B,A] = butter(10,250*T*2);&#xA;s     = sin(2*pi*20*t)+filter(B,A,0.1*randn(1,nT));&#xA;&#xA;figure(1); clf;&#xA;subplot(3,1,1);&#xA;plot(t,s);&#xA;title('signal s(t)');&#xA;grid on;&#xA;&#xA;% first technique: second order transfer function&#xA;qsi  = 0.7;&#xA;wn   = 2*pi*60;&#xA;wnT2 = (wn*T)^2;&#xA;b    = 2*T*wn*wn;&#xA;a1   = 4 + (4*qsi*wn*T) + wnT2;&#xA;a2   = (2*wnT2)-8;&#xA;a3   = wnT2 - (4*qsi*wn*T) + 4;&#xA;dsdt = zeros(size(s));&#xA;for i = 3:nT&#xA;    dsdt(i) = (1/a1) * ...&#xA;        ((-a2*dsdt(i-1)) - (a3*dsdt(i-2)) + (b * (s(i) - s(i-2))));&#xA;end&#xA;subplot(3,1,2);&#xA;plot(t,dsdt, t,2*pi*20*cos(2*pi*20*t))&#xA;title('algorithm 1');&#xA;ylabel('ds/dt');&#xA;grid on;&#xA;set(gca, 'ylim', 150*[-1 1])&#xA;legend('algorithm', 'real')&#xA;&#xA;% second technique: fft/ifft properties&#xA;s_fft = fft(s);&#xA;idx   = 1:(nT/2);&#xA;f_fft = (idx-1) * (fs/2) * (1/length(idx));&#xA;idx   = round((nT/2) + ((-nT/2.5):(nT/2.5)));&#xA;s_fft(idx) = 0;&#xA;w     = 2*pi*(((-nT/2):((nT/2)-1))/nT)*fs;&#xA;dsdt  = ifft(s_fft .* sqrt(-1) .* ifftshift(w));&#xA;&#xA;subplot(3,1,3);&#xA;plot(t,dsdt, t,2*pi*20*cos(2*pi*20*t))&#xA;title('algorithm 2');&#xA;ylabel('ds/dt');&#xA;grid on;&#xA;set(gca, 'ylim', 150*[-1 1])&#xA;legend('algorithm', 'real')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zqTOK.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zqTOK.jpg&quot; alt=&quot;derivative estimate of stochastic signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4869" LastEditorUserId="4869" LastEditDate="2016-12-30T22:37:58.813" LastActivityDate="2016-12-30T22:37:58.813" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26250" PostTypeId="2" ParentId="26245" CreationDate="2015-10-05T23:05:56.577" Score="3" Body="&lt;p&gt;Both real and complex signals can be passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming $x(t)$ and $y(t)$ are baseband signals with bandwidth much less than $f_c$, then $f(t)$ is a passband signal, even if it is complex.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-05T23:05:56.577" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="26252" PostTypeId="1" CreationDate="2015-10-06T05:56:39.630" Score="-1" ViewCount="183" Body="&lt;p&gt;I want to perform fair BER analysis between Two-hop Decode and Forward relay communication (S--&gt;R--&gt;D) and Direct Transmission from S--&gt;D. The links have Rayleigh fading. &#xA;Now for fair analysis 1) Total Transmit Power is kept same 2) Rayleigh Channels with  distance are considered for each link.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the literature,BER vs (Average SNR) is plotted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I calculate Average SNR for dual hop transmission?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and Can I plot BER vs Transmit power?&lt;/p&gt;&#xA;" OwnerUserId="17670" LastActivityDate="2022-08-07T18:01:50.180" Title="BER Analysis of Dual hop Decode and Forward Relay" Tags="|digital-communications|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26253" PostTypeId="1" AcceptedAnswerId="26254" CreationDate="2015-10-06T07:42:43.370" Score="1" ViewCount="138" Body="&lt;p&gt;While determining Fourier coefficients we have this equation&#xA;$$\int^{T}_{0} x(t) e^{-jn\omega_0t} dt = \sum^{+\infty}_{k\ =\ -\infty} a_k [\int^{T}_{0} e^{j(k-n)\omega_0t}dt]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to ask that how can we get final equation of $a_n$ as:&#xA;$$a_n= 1/T \int^{T}_{0} x(t)e^{-jn\omega_0t}dt$$  from the above equation.&#xA;please any one help to explain this&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="1629" LastEditDate="2015-10-06T09:41:40.983" LastActivityDate="2015-10-07T09:00:00.737" Title="Proof for determining Fourier coefficients" Tags="|continuous-signals|fourier-series|self-study|proof|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26254" PostTypeId="2" ParentId="26253" CreationDate="2015-10-06T08:41:46.903" Score="1" Body="&lt;p&gt;For the periodic signal $x(t)$ with fundamental period $T=1/F_0$, proceeding from where you are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Rightarrow \sum^{+\infty}_{k\ =\ -\infty} a_k \left[\int^{T}_{0} e^{j(k-n)\omega_0t}dt\right] = \sum^{+\infty}_{k\ =\ -\infty} a_k \left[\frac{e^{j(k-n)\omega_0t}}{j(k-n)\omega_0}\right]^{T}_{0}&#xA;$$  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For $k \neq n$ you got $0$ (you can prove that)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And for $k=n$ you see that $\int^{T}_{0}dt = T$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You therefore have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int^{T}_{0} x(t)e^{-jn\omega_0t} dt= a_kT = a_nT$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can proceed from there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We do not assume the existence of the two possible solutions. The right-hand side of the equation evaluates to that. It can be written in compact form using the unit impulse which has two distinct values depending on the index. (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_delta#Properties&quot; rel=&quot;nofollow&quot;&gt;the Kronecker delta&lt;/a&gt; in digital signal processing). Think $\delta_{kn}$.   &lt;/li&gt;&#xA;&lt;li&gt;We still need the summation, but we can start with the integral. It's only that the integral is zero for all values of $k$ except at $k=n$ where it is $T$. So you remain with one term in your summation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All in all, your initial equation equals: $\displaystyle \sum^{+\infty}_{k\ =\ -\infty} a_kT\delta_{kn}$&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2015-10-07T09:00:00.737" LastActivityDate="2015-10-07T09:00:00.737" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26256" PostTypeId="1" CreationDate="2015-10-06T11:47:01.030" Score="0" ViewCount="331" Body="&lt;p&gt;I have this binary image with some blobs of random sizes.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6uXDT.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6uXDT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to convert the blobs into circles of uniform diameter. it doesn't really matter what diameter but they need to be circles and uniform.&#xA;Here is what I am looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mFCzc.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mFCzc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working with tiff sequences in ImageJ. I tried erosion and dilation. I tried Ultimate point to reduce to a point and then dilate up but that creates a square. I tried distance map but didn't get very far. Although i am pretty sure distance map is the way to go. None of my current approaches are satisfactory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I could do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   #pseudo-code&#xA;   if area(blob) &amp;gt; x&#xA;   then make circle(diameter=y)&#xA;   else remove blob&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would be even better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has a solution using ImageJ or Python SciPy or even R, please let me know. I would very much appreciate that. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="17534" LastActivityDate="2015-10-06T13:27:16.407" Title="Converting blobs to circles" Tags="|computer-vision|image-processing|image-segmentation|python|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26258" PostTypeId="2" ParentId="26256" CreationDate="2015-10-06T13:27:16.407" Score="1" Body="&lt;p&gt;Here is the procedure to follow:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Threshold your image&lt;/li&gt;&#xA;&lt;li&gt;Obtain connected components - each distinct blob in the image gives you a component.&lt;/li&gt;&#xA;&lt;li&gt;For each component, find the boundary pixels. Each boundary is represented as a set of points.&lt;/li&gt;&#xA;&lt;li&gt;Fit one circle per each boundary point set. You could use a simple least squares fitting.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This should give you pretty good circles. You could do this in many languages, using the standard image processing libraries.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-10-06T13:27:16.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26260" PostTypeId="2" ParentId="26236" CreationDate="2015-10-06T17:31:08.097" Score="1" Body="&lt;p&gt;I think I have found an explanation of this phenomenon. Not a formal one, but perhaps someone else can make a smarter formulation out of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The situation is clearer with an even signal, like the following circular shift of the original example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 101;&#xA;x = exp(-linspace(-5,5,N).^2);&#xA;x_even = [x(51:end), x(1:50)];&#xA;f_even = fftshift(fft(x_even));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The imaginary part of &lt;code&gt;f_even&lt;/code&gt; should ideally be zero, although it is nonzero due to floating point errors. But the interesting thing is what happens to the real part, which is the one that determines the amplitude spectrum in this case. At high frequencies, exactly in the &quot;flat&quot; zone of the amplitude spectrum, &lt;code&gt;real(f_even)&lt;/code&gt; oscillates between positive and negative values. See the following detail:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(real(f_even(1:34)))&#xA;hold on&#xA;plot(abs(f_even(1:34)),':')&#xA;legend({'Real','Abs'})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rHnP8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rHnP8.png&quot; alt=&quot;Detail of the real part of the FFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source of such oscillation may be shown graphically by plotting the series that is summated in the computation of the DFT ($x_n \cdot e^{j2\pi\omega n/N}$):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Only the real part, for e.g. w = 25&#xA;plot( x_even .* cos(2*pi*25*(0:100)/N), '.-' );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8iGxC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8iGxC.png&quot; alt=&quot;Convoluted series&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each point in the &quot;convoluted&quot; series, at high frequencies there is another point in its vicinity of approximately opposite value, so the overall sum tends to zero as $\omega$ increases. But there is a finite number of samples, so that approximation is not smooth. The discontinuity occurs when the order of magnitude of the sum approaches the differences between consecutive samples in the original time series. (In this case the minimum nonzero value of &lt;code&gt;diff(x_even)&lt;/code&gt; is &lt;code&gt;2.35e-11&lt;/code&gt;, which is about the amplitude where the discontinuity in the FFT occurs.) At higher frequencies, those minimum differences in the time series dominate the amplitude of the DFT, instead of the spectrum that could be expected from a continuous signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To complete the explanation, the phase spectrum is conditioned by the aggregation of this sampling effect and the numerical error seen in the imaginary part of &lt;code&gt;f_even&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="17674" LastActivityDate="2015-10-06T17:31:08.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26261" PostTypeId="1" CreationDate="2015-10-06T17:37:58.523" Score="4" ViewCount="3160" Body="&lt;p&gt;I have two signals (time series) shown in the plot below. Just by looking at the figure, we can see that the two main peaks of both signals are very closely aligned (correlated), however the red signal has additional features elsewhere which don't match the blue curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for some function which can tell me how correlated these two signals are at a given time. IE: at t = -18 and t = +10 where the peaks are located, the correlation should be very close to -1, while at t = -40, the correlation is probably close to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I want a robust way to tell that if I see a peak in the blue curve, then there is a corresponding (negative) peak in the red curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked into &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cross correlation&lt;/a&gt;, however this seems suitable for time series which simply have a constant time lag with respect to each other. In my problem the correlation between my two signals is changing with time. I've thought about dividing up the signal into small bins and computing the correlation of each bin, but I was hoping there is a better way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gMCDu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gMCDu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17688" LastEditorUserId="80" LastEditDate="2016-11-21T08:42:42.693" LastActivityDate="2016-11-21T08:42:42.693" Title="How to measure the time dependent correlation of two signals" Tags="|correlation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26263" PostTypeId="1" CreationDate="2015-10-06T19:54:55.360" Score="2" ViewCount="179" Body="&lt;p&gt;Currently I am reading &lt;a href=&quot;http://arxiv.org/pdf/0902.0026.pdf&quot; rel=&quot;nofollow&quot;&gt;a paper&lt;/a&gt; on Compressive Sampling, and trying to understand each and every parts of it. When I came across the mathematical model of the signal in paper, I got confused.  I have mentioned the part of paper for your convenience &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following mathematical model for a class of discrete multitone signals. Let $W/2$ be a positive integer that exceeds the highest frequency present in the continuous-time signal $f$. Fix a number $K$ that represents the active tones. The model contain each signal of the form&#xA;$$ f(t)=\sum_{\omega \in \Omega} a_{\omega} e^{-2\pi i \omega t},\hspace{5mm} for \hspace{2mm} t \in [0,1)$$&#xA;Here, $\Omega$ is a set of $K$ integer-valued frequencies that satisfies&#xA;$$ \Omega \subset \left \lbrace  0, \pm 1 , \pm 2, \ldots , \pm (W/2-1),W/2\right \rbrace$$&#xA;and&#xA;$$ \left\lbrace a_{\omega}:\omega \in \Omega\right\rbrace$$&#xA;is a set of complex-valued amplitudes. We focus on the case where the number $K$ of active tones is much smaller than the available bandwidth $W$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I think there should be $\pm W/2$ in the set $\Omega$.&lt;/li&gt;&#xA;&lt;li&gt;Does the signal model consider both the positive and negative value of frequency in a single signal?&lt;/li&gt;&#xA;&lt;li&gt;What will be the signal $f(t)$ when $\Omega = \left\lbrace 0, \pm1, \pm2\right\rbrace$?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="17587" LastEditorUserId="1824" LastEditDate="2015-12-30T07:45:39.433" LastActivityDate="2015-12-30T07:45:39.433" Title="Mathematical model of a signal in Compressive Sampling" Tags="|signal-analysis|fourier-transform|continuous-signals|fourier-series|compressive-sensing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26264" PostTypeId="1" CreationDate="2015-10-06T20:12:48.920" Score="1" ViewCount="80" Body="&lt;p&gt;I just started to study information content of the source and there are some very fundamental topics I am not really clear on. These might be a long question or a series of questions. Please help me.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Relationship between uncertainty and information:&lt;/strong&gt;&#xA;Information is related to uncertainty or surprise. &lt;em&gt;What is the nature of this relationship? Is there any difference between uncertainty and information?&lt;/em&gt; Before the information reaches the destination, there is an uncertainty at the destination about which signal would appear. When the information reaches the destination, there is no uncertainty left, right? So, information is literally killing or eliminating the uncertainty. Is my concept about information correct?&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Information content of an improbable or unlikely message:&lt;/strong&gt;&#xA;The relationship between the probability of a message and information content is $I=\log_2(1/P)$, right? So If the probability of occurrence of a symbol is one, then the destination is always sure that that definite symbol will occur. So there is no uncertainty about the message. In other way, when the message reaches the server, there is no surprise. So the information content of that symbol is zero. Mathematically it is zero too. That is, the source didn't really need to transmit that message as the destination knew what message was coming beforehand, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what would be the information content of a message with probability zero? I know mathematically it is infinity. But what would be the physical interpretation? And the probability of the message to occur is zero, meaning that symbol is never going to be generated. So the destination is never waiting for that symbol to occur. So in that case, isn't the information content of that message supposed to be zero? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That is going to be my first question. I might need to post a few questions later. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="17687" LastEditorUserId="11256" LastEditDate="2015-10-06T20:43:22.100" LastActivityDate="2015-11-05T22:28:14.327" Title="Can somebody help me with some very basic questions about the fundamentals of information theory?" Tags="|information-theory|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26265" PostTypeId="2" ParentId="26264" CreationDate="2015-10-06T20:38:19.557" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;What is the nature of this relationship?&lt;/em&gt; There are many possibilities. Shannon used a logarithm because he wanted information to be additive, that is, $I(xy)=I(x)+I(y)$ for independent events $x$ and $y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're correct that the arrival of a message at the receiver decreases its uncertainty. It may not be decreased to zero, because there may be an error in the communication. Also, a given channel can only support a certain information rate, which is its capacity.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It does not make sense to ask about messages of probability zero. The source alphabet is defined so that all symbols have probability greater than zero.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-06T20:38:19.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26266" PostTypeId="1" CreationDate="2015-10-06T21:08:21.473" Score="1" ViewCount="188" Body="&lt;p&gt;The telecommunication operator in my country has coupons that used to recharge the balance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wNVZA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wNVZA.jpg&quot; alt=&quot;coupon&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to develop an Android application, that with the camera can take the scratched number and recognize and automatic recharge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think finding the number box, and latter preform an OCR or a pattern match in because are numbers only&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new in computer vision I set the environment and test some opencv ups, but I'm losing witch algorithms or sequence of algorithms may use to achieve that I want Exist segmentation, feature detection, blob detection, ... template match but the image maybe rotates scale because the use of the camera&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I'm lose I wonder if exist one algorithm to find the 4 extreme points of a coupon in one image from here I know how to proceed until the OCR part I don't want the code to do it of course&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want is a simple clue, answer like you may use X algorithm to have Y result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and sorry for my english&lt;/p&gt;&#xA;" OwnerUserId="17691" LastEditorUserId="8202" LastEditDate="2015-10-06T21:24:08.683" LastActivityDate="2016-02-07T18:19:00.150" Title="Computer vision, Coupon code detection, sugested algorithms" Tags="|computer-vision|opencv|detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26269" PostTypeId="2" ParentId="26263" CreationDate="2015-10-07T04:59:24.730" Score="3" Body="&lt;p&gt;The model is the Fourier series of a signal up to the W/2th component, with sparse coefficients. That is, most of the set $\{a_k\}_{k=-W/2}^{W/2}$ is zero.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It is because the signal is bandlimited, and thus for a real signal, $a_{W/2}$ will be real. However, if this constraint is not met it is better to use $\pm W/2$&lt;/li&gt;&#xA;&lt;li&gt;For a real valued signal, the coefficient of the negative frequency is just the conjugate of the positive frequency coefficient. It really just is a mathematical artifact. You could also write the model as &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = \sum_{\omega\in\Omega} b_w \cos(2\pi \omega + \phi_\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $b_\omega$ is real and $\phi_\omega \in [0,2\pi)$ is a real phase value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, the model represents the signal as the sum of sinusoids of different amplitudes and phases.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;It will be the Fourier series approximation of the signal using just the first two frequencies.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You should take a look at this paper and the example code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://statweb.stanford.edu/~candes/papers/super-res.pdf&quot; rel=&quot;nofollow&quot;&gt;Towards a mathematical theory of super-resolution&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-10-07T04:59:24.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26270" PostTypeId="1" CreationDate="2015-10-07T06:53:22.927" Score="-1" ViewCount="1703" Body="&lt;p&gt;I solved a differential equation numerically and I want to find the frequencies present in the solution but I am not able to figure out sample rate/frequency and no. of samples that I should take.can anyone help me? I am new in this field. I have done this in the following way,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Suppose N is no. of sampled data, then&#xA;sampling interval(t0)=period of function/N&#xA;sampling freq (f)=1/t0&#xA;and the highest freq that DFT will detect(Nyquist freq)=1/(2*t0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Correct me if I am wrong anywhere.&lt;/p&gt;&#xA;" OwnerUserId="17697" LastEditorUserId="13320" LastEditDate="2016-11-13T12:50:40.017" LastActivityDate="2016-11-13T12:50:40.017" Title="How we decide sample rate and number of samples while doing discrete Fourier transform" Tags="|discrete-signals|signal-analysis|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26272" PostTypeId="2" ParentId="26270" CreationDate="2015-10-07T07:32:58.070" Score="0" Body="&lt;p&gt;Okay. Here we go! You need not worry about the period of the data as DFT will retrieve reflect it in the result. Take the time series data (that is your solution vector, denoting it by $\mathbf{x}$). I assume the data points are uniformly spaced apart in time. Now, considering the whole data denotes $T$ secs and you have $N$ data points, then sampling interval is $T_s = T/N$, and sampling rate is $F_s=1/T_s$. Take a DFT of $\mathbf{x}$. Here you need to take care of NFFT, that is what point DFT to take? To begin, take $NFFT = 2^{\log_2(length(\mathbf{x}))}$. Let $\mathbf{X}$ denote the obtained DFT. Now, plot magnitude of $\mathbf{X}$, and the x-axis of the plot will be $f=[0:1:NFFT]/NFFT*F_s$. Remember there will be a symmetry around NFFT/2 for real signals.&#xA;Hope the above helps!&lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2015-10-07T07:32:58.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26273" PostTypeId="2" ParentId="26270" CreationDate="2015-10-07T07:41:23.943" Score="-1" Body="&lt;p&gt;Whenever I would search this exact questions, I find a lot of answers just giving the definition of the Fourier transform, but for me, I like a practical utility I can use that I can use.  You asked this over in the Mathematica SE, and I dug up my FFT functions that I use when I want to do this.  This function will display the time and frequency ranges, given the only two open parameters, the number of time points and the time interval: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fourierparameters[num_, dt_] := &#xA; Module[{makeTable, &#xA;   disp, δω, ωstep, ωrange},&#xA;  disp[x_?StringQ] := Style[x, FontFamily -&amp;gt; Times, 13];&#xA;  makeTable[m_?MatrixQ] := &#xA;   DisplayForm[&#xA;    GridBox[Map[ToBoxes, m, {2}], ColumnLines -&amp;gt; True, &#xA;     RowLines -&amp;gt; True, GridFrame -&amp;gt; True, &#xA;     ColumnAlignments -&amp;gt; {Center, &quot;.&quot;}]];&#xA;  δω := 2 π/(num dt);&#xA;  timevalues := &#xA;   RotateLeft[Table[t, {t, -dt num/2 + dt, num/2 dt, dt}], &#xA;    num/2 - 1];&#xA;  fftshift[flist_] := Chop[RotateRight[flist, num/2 - 1]];&#xA;  ωstep := δω(*/cf cm1*);&#xA;  ωrange := {-num/2 + 1, num/2} δω;&#xA;  freqvalues := &#xA;   Table[w, {w, ωrange[[1]], ωrange[[-1]], \&#xA;ωstep}];&#xA;&#xA;  makeTable[{{disp[&quot;Number of sample points&quot;], &#xA;     num}, {disp[&quot;δt &quot;], dt}, {disp[&quot;time range (fs)&quot;], &#xA;     PlusMinus[num dt/2]}, {disp[&#xA;      &quot;δω &quot;], ωstep}, {disp[&#xA;      &quot;frequency range &quot;], PlusMinus[num ωstep/2]}}]&#xA;  ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then call the function, supplying the number of sample points and the timestep:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fourierparameters[2^12, .2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wCHs0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wCHs0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This defines the list &lt;code&gt;timevalues&lt;/code&gt; and &lt;code&gt;freqvalues&lt;/code&gt;.  Next I like to check it by making sure that it plots the frequency exactly where I put it in a simple oscillating function.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ν = 4.7;&#xA;timelist = Table[UnitStep[t] Exp[-I ν t - .01 t], {t, timevalues}];&#xA;freqlist = Fourier[timelist];&#xA;ListLinePlot[Transpose[{freqvalues, Re@fftshift@freqlist}], &#xA; PlotRange -&amp;gt; {{ν - .5, ν + .5}, All}, &#xA; InterpolationOrder -&amp;gt; 2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SI4ed.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SI4ed.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17699" LastActivityDate="2015-10-07T07:41:23.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26275" PostTypeId="2" ParentId="26021" CreationDate="2015-10-07T12:53:12.177" Score="1" Body="&lt;p&gt;Just to enrich the previous answer, the line spectrum is defined in &lt;em&gt;Stoica, P., &amp;amp; Moses, R. (2005). Spectral analysis of signals. Prentice Hall. p.144&lt;/em&gt; as associated to signals of the form:&#xA;$$&#xA;y(t)=x(t)+e(t)&#xA;$$&#xA;where $x(t)$ is a sinusoidal noise-free signal defined as $x(t)=\sum_{k=1}^{n}\alpha_k e^{i(\omega _k t+\phi _k )} $ and $e(t)$ is circular white noise with power $\sigma^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a line spectrum equals $\sigma^2$ everywhere except for some specific frequencies, hence the name &lt;em&gt;line&lt;/em&gt; spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See e.g. the following picture from &lt;a href=&quot;http://spiff.rit.edu/classes/phys301/lectures/doppler/doppler.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Michael Richmond&lt;/a&gt;: &lt;a href=&quot;https://i.stack.imgur.com/F69cO.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F69cO.gif&quot; alt=&quot;Radial velocity of a galaxy&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE : an extra reference explaining the different types of spectra is p.142 in &lt;em&gt;Percival, D. B., &amp;amp; Walden, A. T. (1998). Spectral analysis for physical applications&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this reference, &lt;em&gt;line spectras&lt;/em&gt; are called &lt;em&gt;discrete&lt;/em&gt; or &lt;em&gt;purely discrete&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="17516" LastEditorUserId="17516" LastEditDate="2015-10-21T14:41:33.343" LastActivityDate="2015-10-21T14:41:33.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26276" PostTypeId="1" CreationDate="2015-10-07T13:52:56.200" Score="3" ViewCount="58" Body="&lt;p&gt;Is it possible to use NMF for a sort of &lt;strong&gt;&lt;em&gt;supervised&lt;/em&gt;&lt;/strong&gt; polyphonic instrument recognition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have training data for a timpani and training data for a bongo (or a bongo, snare and box drum). How can I detect and classify them when they are played simultaneously, given the prior information?&lt;/p&gt;&#xA;" OwnerUserId="14997" LastActivityDate="2015-10-07T13:52:56.200" Title="Supervised instrument recognition" Tags="|signal-detection|mfcc|classification|source-separation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26277" PostTypeId="2" ParentId="26270" CreationDate="2015-10-07T15:38:51.987" Score="0" Body="&lt;p&gt;The selection of duration and sample rate depends on the differential equation, and may require a finite error bound, in case the solution is some sort of bounded infinite series (harmonic, etc.), or not possible (if the solution enters a pole or an extreme chaotic regime).  Trial and error measured against total energy may be one possibility.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-10-07T15:38:51.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26280" PostTypeId="2" ParentId="13722" CreationDate="2015-10-07T23:00:22.400" Score="2" Body="&lt;p&gt;I know this is an old thread, but for reference for future enthusiasts in this field:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation for the full PCP algorithm as described by Fujishima is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ PCP(p)=\sum_{ls.t.M(l)=p}^{l}||X(l)||^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M(l)=\mathrm{round}\left[12\log_2 \left(\dfrac{f_\text{s} \ l}{N f_\text{ref}} \right) \right]\operatorname{mod} 12 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The confusion that OP has is in regards to the 2nd equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N$ is how many samples are used to calculate the FFT, or typically known as the FFT size.  Note that a larger $N$ (more samples, longer time) would mean higher resolution of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_\text{s}$ is the sampling frequency of the audio file you are processing.  Typically this is  44 100Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_\text{ref}$ is the reference frequency for the pitch class you are trying to match.  This is typically a set of 12 frequencies, representing the fundamental frequencies of the 12 semitones of a classical keyboard.  For your reference, they are&#xA;[16.35, 17.32, 18.35, 19.45, 20.60, 21.83, 23.12, 24.50, 25.96, 27.50, 29.14, 30.87], starting from C0 to B0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand this equation better, the collective term of $f_\text{s} l/N$ is equivalent to converting the FFT bins into the actual frequency that bin represents.  $l$ here is just the bin counts for the FFT output.  So for every bin of the FFT, the associate frequency can be calculated with this term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because every octave is effectively a double in frequency to the previous octave (if C0 is 16.35Hz, then C1 = 2*C0 = 32.70  C2 = 2*C1).  So to reverse this, we take the $\log_2$ of the calculated frequency from the previous step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to the first equation, note the summation if for all $l$, such that $M(l) = p$.  This means for all of the different pitch classes p (0-11), we must only use bins in the FFT such that $M(l) = \textrm{the pitch classes}$.  To find such conditions, we sweep the fref for all frequencies in the FFT so we find the frequencies that contributes the most to the individual pitch classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the $M(l)$ equation should not give you a negative number.  The reason for this is the FFT creates both positive and negative frequencies.  But for all real signals (such as audio signals), the negative frequencies is just a reflection of the positive frequencies.  You only really need to deal with the positive frequencies, which resides in the first half of the output from the FFT.  Or you can use a rFFT (such as the one in python - numpy) algorithm that specifically deals with real signals, and will only return to you the positive frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were to implement this algorithm, you would do the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Pick a pitch class profile (lets say you want to look at $PCP(0)$ to find all notes that falls under the musical C)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now, according to the 1st equation, you need to find all $l$ such that $M(l) = 0$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You go to the 2nd equation, going through all the bins of your FFT (which is l).  You also set your $f_\text{ref}$ to be the reference frequency for the PCP bin you're after (at this case, since we are looking for C, we can set the $f_\text{ref}$ to 16.35Hz).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find all values of $l$, such that $M(l) = 0$.  Go back to the 1st equation, now with the subset list of $l$, take the magnitude of the FFT at those specific bins ($l$), to find the final sum for pitch class 0.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="17704" LastEditorUserId="4346" LastEditDate="2015-10-10T20:57:47.360" LastActivityDate="2015-10-10T20:57:47.360" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26283" PostTypeId="1" AcceptedAnswerId="26298" CreationDate="2015-10-08T04:15:29.733" Score="-1" ViewCount="4203" Body="&lt;p&gt;While solving Fourier series coefficients in example, i found couple of things which confuse me. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How the minus sign changes to plus sign $a_1= 1-\frac{1}{2j} = 1+\frac{1}{2}j$?  &lt;/li&gt;&#xA;&lt;li&gt;After plotting the magnitude and phase part of all the Fourier coefficients, what kind of information we can get from magnitude and phase plot?  &lt;/li&gt;&#xA;&lt;li&gt;Also, how $4je^{j3(2\pi/8)t} - 4je^{-j3(2\pi/8)t} = 8\sin(6\pi/8)t$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="1629" LastEditDate="2015-10-08T14:10:26.813" LastActivityDate="2015-10-19T08:42:54.727" Title="magnitude and phase Fourier coefficients" Tags="|continuous-signals|fourier-series|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26284" PostTypeId="2" ParentId="26283" CreationDate="2015-10-08T05:42:36.217" Score="0" Body="&lt;p&gt;You can write a phase-shifted sinusoid as $A\cos(\omega t + \phi)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{A}{2} e^{i\phi}e^{i\omega t} + \frac{A}{2} e^{-i\phi}e^{-i\omega t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first part is the 'positive frequency' part, the second is the negative frequency part.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For a real valued signal, the coefficients come in a conjugate pair:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{A}{2} e^{i\phi} \text{   and  } \frac{A}{2} e^{-i\phi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why the minus sign changes to a plus sign; the imaginary parts have to cancel out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is just a mathematical convenience; when expressed this way we can do linear operations like addition and multiplication. We could instead have the transform spit out magnitude and phase values, but then when applying filters we would have to convert these to their components, add / multiply, then convert back.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;The magnitude tells you which frequencies are strongest. The phase contains most of the structural information about the signal, but the phase values by themselves aren't really useful to analyse.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-10-08T05:42:36.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26285" PostTypeId="2" ParentId="26283" CreationDate="2015-10-08T05:51:19.607" Score="0" Body="&lt;p&gt;1) What you've written is complex conjugate. In the Fourier case it could be interesting while &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;we are working with real input signal so it's Fourier domain image is Hermitian function, see &lt;a href=&quot;https://en.wikipedia.org/wiki/Hermitian_function&quot; rel=&quot;nofollow&quot;&gt;wiki&lt;/a&gt; for example&lt;/li&gt;&#xA;&lt;li&gt;In matrix form discrete Fourier transform could be written as a matrix $W$ so for inverse transform it will be $W^H$, where $()^H$ denotes Hermitian &lt;a href=&quot;https://en.wikipedia.org/wiki/Conjugate_transpose&quot; rel=&quot;nofollow&quot;&gt;transpose&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;2) Magnitude and phase of Fourier coefficients determine signal's spectrum in Fourier domain. The physical meaning of Fourier domain depends on which dimension are used for signal representation. The simplest examples are time and space. If we have signal represented as a time serie, after Fourier we will obtain frequency spectrum, while if we have signal represented as plane wave in space, Fourier domain will reflect spatial (or angular) spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually the most interest is in magnitude part of Fourier because it is used for estimating power spectrum. But sometimes phase is also important - filter analysis, frequency domain equalization, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-10-08T05:51:19.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26288" PostTypeId="1" CreationDate="2015-10-08T07:43:33.830" Score="0" ViewCount="120" Body="&lt;p&gt;how do people combine different information (e.g., RGB and depth image or RGB and thermal image) to make their object detection algorithms better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the single modality images A and B are perfectly registered, I can think of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Write one object detector working on A, write one working on B and then write one regressor that takes the outputs from A and B and learns a final output.&lt;/li&gt;&#xA;&lt;li&gt;Instead of working with feature vector &lt;code&gt;f&lt;/code&gt; to describe a certain region (e.g. a bounding box) in the image A one could learn a prediction model based on a feature vector &lt;code&gt;F = [f;g]&lt;/code&gt; where &lt;code&gt;g&lt;/code&gt; is the corresponding feature for image B.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These approaches do not make as much sense if the images are not nicely registered, but there is a certain amount of misalignment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So again: how do people combine different modalities for object detection and in particular deal with misregistration?&lt;/p&gt;&#xA;" OwnerUserId="16462" LastActivityDate="2016-01-06T12:40:49.863" Title="Object detection using several images" Tags="|image-processing|computer-vision|object-recognition|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26292" PostTypeId="2" ParentId="25700" CreationDate="2015-10-08T08:45:28.597" Score="1" Body="&lt;p&gt;I wouldn't rely on edges as they are not connected and foam/waves also generate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would rely on the contrast between the colors of skin, water and foam, to get a solid blob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly a two step process: discard the more saturated pixels (the sea), then among the achromatic keep the dark ones. After experimenting I saw that erosion can be useful to get rid of unwanted residues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end you should get a big blob, and determine its dominant orientation (equivalent ellipse of inertia, Feret diameter, most distant points...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unsaturated pixels:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NNYm4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NNYm4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dark pixels:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/o6puE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o6puE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combination:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2uFhO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2uFhO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eroded:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PWXRO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PWXRO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blobs and ellipse of inertia:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DgKDc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DgKDc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kn7WN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kn7WN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As there is a risk of blob fragmentation, you can consider merging the largest blobs.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-10-09T08:31:34.217" LastActivityDate="2015-10-09T08:31:34.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26293" PostTypeId="1" AcceptedAnswerId="26295" CreationDate="2015-10-08T09:11:17.723" Score="6" ViewCount="913" Body="&lt;p&gt;I am going through the following tutorial: &lt;a href=&quot;http://ctms.engin.umich.edu/CTMS/index.php?aux=Activities_RCcircuitA&quot;&gt;Time-Response Identification of a Resistor–Capacitor (RC) Circuit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we call the RC circuit a first order system? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the order of a system is based on the highest derivative involved in its governing equation. The input governing equation of an RC circuit is described by equation 1 in the tutorial:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e_i-iR-\frac{1}{C}\int i \;dt =0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the equation. But, I'm confused because there is no derivative term in it and yet it is called a first order system.&lt;/p&gt;&#xA;" OwnerUserId="11274" LastEditorUserId="8202" LastEditDate="2015-10-08T10:19:16.703" LastActivityDate="2016-08-02T09:19:37.413" Title="Why is an RC circuit a first order system?" Tags="|control-systems|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26294" PostTypeId="2" ParentId="26045" CreationDate="2015-10-08T09:27:54.880" Score="0" Body="&lt;p&gt;You can probably address that by tracking debris across frames, assuming that they move at the speed of water and aren't too far apart in successive frames.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe start with the old stuff: Shi, J.; Tomasi, C., &quot;Good features to track,&quot; in Computer Vision and Pattern Recognition, 1994. Proceedings CVPR '94., 1994 IEEE Computer Society Conference on , vol., no., pp.593-600, 21-23 Jun 1994.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-10-08T09:27:54.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26295" PostTypeId="2" ParentId="26293" CreationDate="2015-10-08T09:38:00.293" Score="13" Body="&lt;p&gt;The order of system gives the number of memory storing elements in the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have written above is a KVL equation of the circuit. But when you determine the order of the system you need to find the transfer function of the system. Laplace domain is normally used. The highest power of $s$ in  the denominator in a strictly proper transfer function gives the order of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the $s$-domain,say you take the output across the capacitor,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dfrac{V_o(s)}{V_i(s)} = \dfrac{\frac{1}{sC}}{R+\frac{1}{sC}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;simplifying we get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\dfrac{V_o(s)}{V_i(s)}= H(s)=\dfrac{\frac{1}{RC}}{s+\frac{1}{RC}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the highest power of $s$ is given by 1. So the order of the system is 1. &lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="80" LastEditDate="2015-10-08T11:51:08.597" LastActivityDate="2015-10-08T11:51:08.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26296" PostTypeId="2" ParentId="26288" CreationDate="2015-10-08T09:43:27.410" Score="1" Body="&lt;p&gt;Usually, people tend to go with the second option, since its a joint approach. In either case, the methods fusing these two data modalities (RGB+Depth etc) together are termed multi-modal methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, another 3rd option is not to fuse on the feature level but to jointly minimize an energy function or jointly voting for the correct hypothesis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One successful algorithm which works on RGB+Depth is LineMOD. The publications are &lt;a href=&quot;http://campar.in.tum.de/pub/hinterstoisser2012accv/hinterstoisser2012accv.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://campar.in.tum.de/pub/hinterstoisser2011linemod/hinterstoisser2011linemod.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. (Modified Line). LineMOD takes the second path, and fuses the depth and RGB features. It also has an OpenCV implementation (a basic one).&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-10-08T09:43:27.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26297" PostTypeId="2" ParentId="26293" CreationDate="2015-10-08T09:51:34.907" Score="5" Body="&lt;p&gt;$$R\frac{di}{dt}-\frac1Ci=\frac{de_i}{dt}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isn't that a nice first order differential equation ? &lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2016-08-02T09:19:37.413" LastActivityDate="2016-08-02T09:19:37.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26298" PostTypeId="2" ParentId="26283" CreationDate="2015-10-08T11:34:07.990" Score="1" Body="&lt;p&gt;Frankly I don't deserve to get any credit for this answer. That's the reason I was commenting on the question. What you are asking as a question is too trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_1=1-\frac{1}{2j}= 1-\frac{j}{2j^2}$$&#xA;We know that $j^2=-1$ from complex number arithmetic. So $a_1$ simplifies to $1+\frac{j}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$4je^{j3\frac{2\pi}{8}t} - 4je^{-j3\frac{2\pi}{8}t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiply and divide the above expression by $2j$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we get $$4j\left(e^{j3\frac{2\pi}{8}} - e^{-j3\frac{2\pi}{8})t}\right) \frac{2j}{2j}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It simplifies to $$8j^2\left(e^{j3\frac{2\pi}{8}t} - e^{-j3\frac{2\pi}{8}t}\right)\frac{1}{2j}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is equal to $$8j^2 \sin\left(\frac{6\pi}{8}t\right) = -8 \sin \left(\frac{6\pi}{8}t\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because from exponential form of definition of $\sin(x)$ &#xA;$$\sin(x) = \dfrac{e^{jx} + e^{-jx}}{2j}$$&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="8202" LastEditDate="2015-10-19T08:42:54.727" LastActivityDate="2015-10-19T08:42:54.727" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26299" PostTypeId="1" AcceptedAnswerId="26300" CreationDate="2015-10-08T11:40:28.280" Score="4" ViewCount="11414" Body="&lt;p&gt;Recently, I've read several papers where zero-lag Butterworth filters are used (both low-pass and high-pass).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a fair understanding of (Butterworth) filters, but how can we design one with zero lag? Can someone explain me how this works?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my understanding, any low-pass filter yields an intrinsic delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or does this involve bidirectional filtering?&lt;/p&gt;&#xA;" OwnerUserId="15934" LastActivityDate="2015-10-10T22:46:40.100" Title="Zero-lag butterworth filtering" Tags="|filters|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26300" PostTypeId="2" ParentId="26299" CreationDate="2015-10-08T11:50:18.110" Score="8" Body="&lt;p&gt;As you suspect, &lt;a href=&quot;http://www.health.uottawa.ca/biomech/lab/docs/ncb2_gr.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; says that zero-lag Butterworth filtering is obtained by passing the signal through the filter twice: once in the forwards direction and once in reverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MPlDW.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MPlDW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-08T11:50:18.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26301" PostTypeId="2" ParentId="26293" CreationDate="2015-10-08T13:52:24.573" Score="1" Body="&lt;p&gt;Another way to see it is rather than look for a 'derivative term' look for &lt;em&gt;relative&lt;/em&gt; levels of differentiation, which is what you've got with $i$ and  $\int i dt$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Differentiate those two wrt $t$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{di}{dt}$ and $i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exactly what you're looking for...  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But keep in mind the differential relationship defined in the ODE is the &lt;em&gt;same&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="17654" LastActivityDate="2015-10-08T13:52:24.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26302" PostTypeId="2" ParentId="26299" CreationDate="2015-10-08T13:55:35.023" Score="2" Body="&lt;p&gt;This issue is not often mentioned in text books. Within Matlab, it is implemented with the &lt;a href=&quot;http://fr.mathworks.com/help/signal/ref/filtfilt.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;filtfilt&lt;/a&gt; function. It is sometimes called &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Forward_Backward_Filtering.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;forward-backward filtering&lt;/a&gt;, and works with other filters than Butterworth's. One of the few references I am aware of is: F. Gustafsson, &lt;a href=&quot;http://dx.doi.org/10.1109/78.492552&quot; rel=&quot;nofollow noreferrer&quot;&gt;Determining the initial states in forward-backward filtering&lt;/a&gt;, IEEE Transactions on  Signal Processing, 1996. It bears some weak similarities with &lt;a href=&quot;https://en.wikipedia.org/wiki/Linkwitz%E2%80%93Riley_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linkwitz-Riley filters&lt;/a&gt;, by cascading two filters in a specific fashion to reduce limitations caused by a single filter. Moreover, I cannot take out of my mind that 20 years ago, when I discovered the filtfilt function, a skilled colleague told me it was called (phonetically) a L*n[q/k][w/v]i[z/st/tz] filter (I remember I heard Lunqvist back then), although I never found a reference. He was apparently wrong, additional historical connections would be welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole operation, interpreted in a frequency domain, amounts to multiplying the filter frequency response by its complex conjugate. Hence, the resulting &quot;squared-filter&quot; is real, and possesses a zero-phase, i.e. no delay, at the expense of non-causality. Its order is the double of the original filters, and may hit unstability problems when quantifying its coefficients. Its attenuation at cut-off frequency also doubles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related discussions can be found in &#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/9467/what-is-the-advantage-of-matlabs-filtfilt&quot;&gt;What is the advantage of MATLAB's filtfilt&lt;/a&gt; or &#xA;&lt;a href=&quot;https://stackoverflow.com/questions/12208174/real-time-digital-filter-with-zero-phase&quot;&gt;Real time digital filter with zero phase&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2015-10-10T22:46:40.100" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26303" PostTypeId="1" AcceptedAnswerId="26307" CreationDate="2015-10-08T15:34:38.893" Score="0" ViewCount="161" Body="&lt;p&gt;So it looks like MATLAB is applying the filter to the &quot;negative&quot; and &quot;positive&quot; frequencies separately and I end up with two band pass regions with a null around zero. I want the whole spectrum filtered once.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = butter(2,[.18 .3739],'bandpass');&#xA;hm = filter(b,a,Y);&#xA;figure;&#xA;plot(20*log10(abs((fftshift(fft(hm))))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="17711" LastEditorUserId="8202" LastEditDate="2015-10-08T15:50:29.197" LastActivityDate="2015-10-08T16:24:10.610" Title="MATLAB appears to be applying my filter to the spectrum twice, once on each side" Tags="|matlab|filters|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26304" PostTypeId="1" AcceptedAnswerId="26313" CreationDate="2015-10-08T16:06:08.683" Score="9" ViewCount="9014" Body="&lt;p&gt;In signals and systems subject we study about calculating energy and power of a signal, but what is their practical significance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also what is the significance of a signal which is neither energy nor power signal ?&lt;/p&gt;&#xA;" OwnerUserId="17713" LastEditorUserId="13320" LastEditDate="2016-11-21T12:50:36.233" LastActivityDate="2016-11-21T12:50:36.233" Title="Significance of energy and power signals in real world" Tags="|signal-power|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26306" PostTypeId="1" CreationDate="2015-10-08T16:23:26.147" Score="1" ViewCount="218" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Lq6pL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lq6pL.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to represent the signal in above image ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know a ramp signal can be represented by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = t\cdot u(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but here amplitude of that signal is not same with $t$&lt;/p&gt;&#xA;" OwnerUserId="17713" LastEditorUserId="13320" LastEditDate="2016-11-21T12:40:00.170" LastActivityDate="2016-11-21T12:40:00.170" Title="How to represent half of equilateral triangle signal?" Tags="|homework|signal-synthesis|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26307" PostTypeId="2" ParentId="26303" CreationDate="2015-10-08T16:24:10.610" Score="1" Body="&lt;p&gt;Your filter has a real-valued impulse response, which means it has a two-sided spectrum.  Your filter is only applied once, but that application changes both positive and negative frequencies: -0.3739 to -0.18 and from 0.18 to 0.3729 (modulo the transition region of the filter).  If the filter did not do this, you would have a low pass filter and not a bandpass filter.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-08T16:24:10.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26308" PostTypeId="2" ParentId="26306" CreationDate="2015-10-08T16:27:35.987" Score="2" Body="&lt;p&gt;Try:&#xA;$$&#xA;x(t) = \left[ u(t-T_{\rm on}) - u(t-T_{\rm off}) \right] \cdot \frac{T_{\rm off} - t}{T_{\rm off} - T_{\rm on} }&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to explain:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$T_{\rm on}$ is the time at which the ramp turns on.&lt;/li&gt;&#xA;&lt;li&gt;$T_{\rm off}$ is the time at which the ramp turns off.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The piece:&#xA;$$&#xA; \left[ u(t-T_{\rm on}) - u(t-T_{\rm off}) \right] &#xA;$$&#xA;will be zero before $T_{\rm on}$ and one afterwards, until $T_{\rm off}$ at which time it will be zero.  Note that this assumes that $T_{\rm off} &amp;gt; T_{\rm on}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That just looks like a pulse of duration $T_{\rm off} - T_{\rm on}$ with amplitude 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you said in the question, the function $-t$ has the right sign of the gradient, but (possibly) the wrong slope and (possibly) the wrong intercept. For the numbers given, $T_{\rm off} = 5$ and $T_{\rm on} = 4$, the gradient is correct but the intercept is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the rest of the equation just fixes that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We need our function to be one at $T_{\rm on}$.&lt;/li&gt;&#xA;&lt;li&gt;We need our function to be zero at $T_{\rm off}$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;1 = m T_{\rm on} + c  \tag{1}&#xA;$$&#xA;$$&#xA;0 = m T_{\rm off} + c \tag{2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that&#xA;$$&#xA;(1) - (2) \rightarrow 1 = m \left( T_{\rm on} - T_{\rm off} \right) \rightarrow m = \frac{1}{T_{\rm on} - T_{\rm off} } \\&#xA;$$&#xA;and substituting that into (2) gives&#xA;$$&#xA;0 = \frac{1}{T_{\rm on} - T_{\rm off} } T_{\rm off} + c \rightarrow c = \frac{ - T_{\rm off}}{T_{\rm on} - T_{\rm off} }&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-09T14:11:39.260" LastActivityDate="2015-10-09T14:11:39.260" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26310" PostTypeId="2" ParentId="18435" CreationDate="2015-10-08T19:04:19.630" Score="1" Body="&lt;p&gt;Why is the group delay constant and close to half of the number of taps in this symmetric tap filter ($h[N−1−n]=h[n]$)? The answer lies in it being symmetric. Note that the $n^{th}$ tap (coefficient) of an FIR filter can be seen as delay of $n$ &quot;sampling intervals&quot; (or $n$ samples). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if you pick a pair of &quot;symmetric&quot; taps/coefficients of this filter (say at $n_1$ and $N-n_1-1$), and pass a sinusoidal signal, $\sin(\omega t)$, through this pair, you would see that the output of this passing is a sinusoidal signal of the same frequency $\omega$ but with a delay which is an average of the two tap delays, i.e., $(N-n_1-1+n_1)/2 = (N-1)/2$. It is simple math, i.e., try adding $\sin(\omega t-t_0-t_1)$ and $\sin(\omega t-t_0+t_1)$, the sum is $K*\sin(\omega t-t_0)$. Do this for all $N/2$ pairs and you will find all will have a time delay of $t_0 = (N-1)/2$. &#xA;Please excuse my extreme brevity and delay in replying. I hope I got the point across.&lt;/p&gt;&#xA;" OwnerUserId="17717" LastEditorUserId="11256" LastEditDate="2018-03-12T17:48:52.287" LastActivityDate="2018-03-12T17:48:52.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26311" PostTypeId="2" ParentId="26304" CreationDate="2015-10-08T19:14:59.900" Score="10" Body="&lt;p&gt;An energy signal is defined as one with a finite energy:&#xA;$$&#xA;E = \int_{-\infty}^{\infty} \left|s(t)\right|^2 dt \lt \infty&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A power signal is defined as one with a finite power or energy per unit time:&#xA;$$&#xA;P = \lim_{T \rightarrow \infty} \frac{1}{T}\int_{-T/2}^{T/2} \left|s(t)\right|^2 dt \lt \infty&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://electronics.stackexchange.com/questions/77675/definition-of-power-signals-and-energy-signals&quot;&gt;This question over on Electronics.SE&lt;/a&gt; has a nice image which also includes the discrete-time versions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cVbZ1.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cVbZ1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what is their practical significance.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's no real practical significance: most real-world signals are finite duration (I'm still waiting to see an infinite duration one) and finite magnitude (my multimeter's scale doesn't reach to infinity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main significance is that it tells you what sort of mathematical tools you can use (or not).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also what is the significance of a signal which is neither energy nor power signal ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, such a signal would have infinite power (and also infinite energy).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest example I can think of is the exponential:&#xA;$$&#xA;x(t) = e^t&#xA;$$&#xA;which is easy to express, but has infinite power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, non-Energy, non-Power signals will be those that are infinite in extent (they don't drop to zero) and that continue increasing with time.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2015-10-08T19:14:59.900" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26312" PostTypeId="1" AcceptedAnswerId="26324" CreationDate="2015-10-08T20:55:44.647" Score="1" ViewCount="1456" Body="&lt;p&gt;Related to another problem I'm having, I was looking into the workings of &lt;code&gt;numpy&lt;/code&gt;'s &lt;code&gt;rfft2&lt;/code&gt; and &lt;code&gt;irfft2&lt;/code&gt;. These are special versions of the FFT routine, in so far that it needs less input; because you require the real-space image to be real you only need to 'fill' half of Fourier space - due to symmetry, that's all the information you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;a href=&quot;http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.irfftn.html#numpy.fft.irfftn&quot; rel=&quot;nofollow&quot;&gt;in the docs&lt;/a&gt; it is mentioned that performing the inverse transform right after the forward transform should return the original array - &lt;em&gt;to within numerical precision&lt;/em&gt;. Time to put this to the test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;fourier_image = np.random.uniform(-1,1,(100,51))&#xA;fourier_recovered = np.fft.rfft2(np.fft.irfft2(fourier_image))&#xA;&#xA;print 'Original power: ', sum(sum(abs(fourier_image)**2.))&#xA;print 'Recovered power: ', sum(sum(abs(fourier_recovered)**2.))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;... I find the original power and the recovered power differ at the percent level. That seems a rather big difference to me. Am I doing something wrong, or is this just the best we can do?&lt;/p&gt;&#xA;" OwnerUserId="17359" LastEditorUserId="1629" LastEditDate="2015-10-09T06:37:08.397" LastActivityDate="2015-10-09T09:19:37.687" Title="Numpy's real fft (rfft) - losing power" Tags="|fft|python|power-spectral-density|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26313" PostTypeId="2" ParentId="26304" CreationDate="2015-10-08T21:08:41.850" Score="12" Body="&lt;p&gt;I mostly agree with @PeterK.'s answer; in practical terms, all signals are energy signals. However, a signal's energy does have important practical significance. Producing a signal of a given energy consumes at least that same amount of energy, for which you have to pay. In a battery-operated device, this becomes very important, because batteries store energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using a signal to communicate, then the more energy it has, the farther it will reach (I'm oversimplifying a bit, but in general this is true). The more energy a signal has when it is received, the easier it is for the receiver to recover the information in the signal without (or with few) errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many devices are also limited in the amount of energy they can produce per unit of time, which limits the kinds of signals they can produce.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-08T21:08:41.850" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26314" PostTypeId="1" AcceptedAnswerId="26329" CreationDate="2015-10-09T02:39:25.797" Score="3" ViewCount="1724" Body="&lt;p&gt;This is not a homework question (I'm out of school now 2 years). I'm thinking, let's say you have 2 systems, one at 32khz and the other at 48khz and you want to go between the two. Is there a way to accomplish this with a single filter? I have a feeling that if you make an FIR where every other coefficient is zero and exploit the fact that if fs = 32khz and 48-32=16=fs/2, then zeroing out every other coefficient of an FIR (but how many taps) would do both the zero-padding and the anti-aliasing simultaneously. Am I on the right track or is there some other trickery involved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I think about it, to go from 32khz to 48khz you interpolate 3x and decimate 2x (32*3=96khz...96/2=48). So in effect you would pad two zeros first but then take out one in the decimation, but just inserting one zero would yield 64khz decimation (with a 32khz lowpass decimation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, wikipedia interpolation:&#xA;&quot;Upsampling requires a lowpass filter after increasing the data rate, and downsampling requires a lowpass filter before decimation. Therefore, both operations can be accomplished by a single filter with the lower of the two cutoff frequencies. For the L &gt; M case, the interpolation filter cutoff,  \tfrac{0.5}{L} cycles per intermediate sample, is the lower frequency.&quot;&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-10-09T13:22:21.820" LastActivityDate="2015-10-09T13:22:21.820" Title="Interpolate/Decimate with a single filter?" Tags="|interpolation|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26315" PostTypeId="2" ParentId="26261" CreationDate="2015-10-09T03:44:31.217" Score="0" Body="&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt; sorry, troughs in red, peaks in blue. I'm on my phone and couldn't see the graphs as I wrote. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you want to correlate features of the time series, not the time series themselves. In particular, it looks like you want to detect peaks in the red curve and troughs in the blue graph. Then you want to correlate the presence and position of those features. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you guaranteed that peaks are always the interesting things in the red curve? Are troughs always what you want to find in the blue curve? If you can characterize what you're looking for, then do feature detection on each time series. What you want as output is another pair of time series which indicate the times at which your features of interest appear. Once you have these feature time series, correlate them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck! &lt;/p&gt;&#xA;" OwnerUserId="17325" LastActivityDate="2015-10-09T03:44:31.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26316" PostTypeId="1" AcceptedAnswerId="26323" CreationDate="2015-10-09T05:28:14.003" Score="3" ViewCount="1128" Body="&lt;p&gt;I have a real time series sampled at 32 MHz. So, when I channelized it and plot it against time, I get a Frequency vs. Time image plot where the frequency domain spans 16 MHz. To elaborate, this basically entails taking, say, 2048-sample chunks of data and doing a Fourier Transform on each to get a 1024-channel '16 MHz'-wide Fourier Transform over time (because we only care about positive frequencies). It looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Av90d.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Av90d.jpg&quot; alt=&quot;A frequency vs. time plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every vertical line in that plot is a Fourier Transform of 1024 channels. Which means that the time step between adjacent vertical lines is 2048 samples wide or 64 microseconds wide.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what I want to do is convert this time series so that it looks like it was sampled at 48000 Hz, but not actually. Basically, I want the 16 Mhz frequency channel to correspond to a 24 kHz channel. So, I still want to preserve the structure of the data. So, a naive low-pass filter doesn't work, because I don't actually want to remove the higher frequencies, I just want to &quot;redshift&quot; it all. I want to go from a &lt;code&gt;0 - 16 MHz&lt;/code&gt; band to a &lt;code&gt;0 - 48 kHz&lt;/code&gt; band. But those pulses that pulse at 4 Hz, I still want them to pulse at 4 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I would try to do this, is by binning the channels. So, if I have 1024 channels (as from above) - I'd try to bin them into, say, 32 channels (and compress the spectrum by 32 times) - which basically means that I would take blocks of 32 channels and sum them or average them somehow to get one channel. Now, I really want to compress this spectrum 666 times but it doesn't matter. I really just need to understand how to meaningfully combine multiple Fourier Transforms into one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the only way I know how to do this is by taking the amplitude of the Fourier Transforms and then summing up adjacent channels to bin the channels. But this LOSES phase information - and I lose the pulses that I want to survive. So, how do I those these channels into a bin meaningful without losing both phase or amplitude information?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More concisely, my question is the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given N Fourier Transforms of N real functions, is there a meaningful&#xA;  way to get a sum of them without losing phase and amplitude&#xA;  information?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Of course, this doesn't have to be the question if someone knows a better way to handle my overall problem without binning channels.&lt;/p&gt;&#xA;" OwnerUserId="17721" LastActivityDate="2015-10-09T09:09:55.257" Title="How do I convert a timeseries to a different frequency band?" Tags="|fourier-transform|time-series|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26317" PostTypeId="1" AcceptedAnswerId="26412" CreationDate="2015-10-09T06:19:01.147" Score="4" ViewCount="926" Body="&lt;p&gt;I need help in plotting the Bit error curve or the symbol error curve for BPSK modulation scheme for varying Signal to Noise ratios or Eb/N0. The plot should show the simulated versus the theoretical curve, but I cannot figure out how to mitigate the problems when using the Constant Modulus Algorithm as an Equalizer which are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) I want to use the &lt;code&gt;filter&lt;/code&gt; function instead of &lt;code&gt;conv&lt;/code&gt; in order to model a moving average channel model, &lt;code&gt;chanOut = filter(ht,1,s)&lt;/code&gt;. But, when I use &lt;code&gt;filter&lt;/code&gt;, I am getting an error. How can I use &lt;code&gt;filter&lt;/code&gt; function here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) Bit error rate calculation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am still unable to use &lt;code&gt;filter&lt;/code&gt; and unsure if BER curve is proper or not. &#xA;Below is the code I wrote:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE after the answer posted, I have included all the suggestions. The error has been mitigated but now the curve for CMA is coming out to be flat instead of the one shown in the answer. Would like to know what I should do to get similar curve.&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="780" LastEditDate="2015-11-11T07:35:52.043" LastActivityDate="2015-11-11T07:35:52.043" Title="Matlab: What should be the BER performance for BPSK using Constant Modulus Algorithm equalizer" Tags="|matlab|demodulation|equalization|bpsk|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26319" PostTypeId="2" ParentId="18168" CreationDate="2015-10-09T07:36:34.640" Score="0" Body="&lt;p&gt;&lt;strong&gt;An empirical approach&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Smooth the signal with a standard lowpass (Gaussian), to get $G_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On another hand, compute a sliding difference over $n$ values ($D_k=S_{k+n}-S_{k-n}$). This derived signal will be maximum at a rising edge. (You can also try the smoothed difference, $D_k=G_{k+n}-G_{k-n}$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then mix the original signal with the smoothed one, using an adaptive weighting like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_k=w(D_k)S_k+(1-w(D_k))G_k,$$&#xA;where the function $w$ is close to $1$ for values of $D_k$ close to the expected step height, and decreasing to $0$ for lower values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this approach will rather preserve the edge than the &quot;peak&quot;.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-10-09T07:36:34.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26320" PostTypeId="1" AcceptedAnswerId="26327" CreationDate="2015-10-09T07:47:02.907" Score="3" ViewCount="3965" Body="&lt;p&gt;I'm using a very simple 1st order Butterworth Filter shown in Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;order = 1;&#xA;cutOff = 0.1;&#xA;[b, a] = butter(order, (2*cutOff)/SampleRate, 'high');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So from the Matlab documentation of &lt;code&gt;butter&lt;/code&gt;, it is not hard to know the transfer function is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{b_1 + b_2z^{-1}}{a_1 + a_2z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, if I have a signal $x$ with variance $v$, after the signal $x$ is filtered by the above high-pass filter, what is the variance of the output signal? Will it change? How can I calculate it? And is the filter linear?&lt;/p&gt;&#xA;" OwnerUserId="17723" LastEditorUserId="1629" LastEditDate="2015-10-09T11:13:52.133" LastActivityDate="2015-10-09T13:44:13.477" Title="Variance of a filtered signal" Tags="|matlab|filters|discrete-signals|covariance|" AnswerCount="3" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="26321" PostTypeId="2" ParentId="26316" CreationDate="2015-10-09T07:51:43.107" Score="1" Body="&lt;p&gt;If I am reading you correctly, you want to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Scale frequencies by a factor of 0.003&lt;/li&gt;&#xA;&lt;li&gt;Not scale time&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In a musical context this is called &lt;i&gt;pitch shifting&lt;/i&gt;, because musical notes follow a logarithmic frequency scale and addition (shifting) in that scale corresponds to multiplication in linear frequency scale. Alternatively, you can do frequency-preserving &lt;i&gt;time stretching&lt;/i&gt;, followed by resampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is quite difficult to do pitch shifting / time stretching well, and there is no one perfect way to do it as the optimal algorithm depends on what time-frequency structures you want to preserve. Most known algorithms do not approach it as a pure optimization problem but use heuristics to recognize frequencies in the Fourier transform, following them across analysis frames, and then try to resynthesize the scaled frequencies preserving amplitudes, and phase relationships at transients. Some algorithms are listed in &lt;a href=&quot;https://en.wikipedia.org/wiki/Audio_time-scale/pitch_modification&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Audio_time-scale/pitch_modification&lt;/a&gt;.&#xA;It is common to try to counter the &quot;chipmunk effect&quot; of shifting formant frequencies, by preserving the overall spectral envelope, but in your case no such remedies are needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try &lt;a href=&quot;http://breakfastquay.com/rubberband/&quot; rel=&quot;nofollow&quot;&gt;Rubber Band&lt;/a&gt;, of which there are executable and library versions available. I have found it to give decent results for general audio. The 0.003 ratio is quite extreme, so it may be that you need to factor it into smaller partial ratios. &lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-09T07:57:11.160" LastActivityDate="2015-10-09T07:57:11.160" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26322" PostTypeId="1" AcceptedAnswerId="26340" CreationDate="2015-10-09T08:08:27.883" Score="0" ViewCount="471" Body="&lt;p&gt;Here is two similar images. I did 2D Fourier Transform for both of them. But for the first image, the result shows as a ring and for the second image the 2D FFT shows as a-two-ring. Examples R listed in the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input image 1 : (For this figure the FFT is a ring.)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FaFcT.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FaFcT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input image 2: (For this figure the FFT is a two-ring.)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EwfH4.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EwfH4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone explain the results in the view of Fourier Transform quantitatively? Maybe from the basic theory and calculation of Fourier Transform? Maybe introduction of the auto-correlation function? Any other suggestions are welcomed.&lt;/p&gt;&#xA;" OwnerUserId="15070" LastEditorUserId="15070" LastEditDate="2015-10-10T04:51:19.817" LastActivityDate="2015-10-10T06:38:46.687" Title="Why the difference come of 2D Fourier Transforms from two similar image?" Tags="|image-processing|fft|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="26323" PostTypeId="2" ParentId="26316" CreationDate="2015-10-09T09:09:55.257" Score="3" Body="&lt;p&gt;Mathematically, shifting the frequency of a signal is pretty easy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following @OlliNiemitalo's &lt;a href=&quot;https://dsp.stackexchange.com/a/26321/13320&quot;&gt;answer&lt;/a&gt;, the 0.003 frequency shift can either be done in &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;time domain, or&lt;/li&gt;&#xA;&lt;li&gt;frequency domain.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I recommend doing it in time domain, by multiplying the signal with a complex sinusoid, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{j 2 \pi f_\text{shift} n},\, n \in\{1,2,\ldots\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that way you can get arbitrary frequency shifts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, you're &lt;strong&gt;not&lt;/strong&gt; right about needing to add up the amplitudes -- what you're doing is probably coherent sampling (i.e., the sampling clock doesn't stop after each 2048 sample chunk and starts with a random delay for the next, but continously runs at a stable frequency), so adding up multiple FFTs without reducing them to their amplitude works -- that's the beauty of the DFT being a linear operation, and the bases of the base transform it is being orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of it like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume you add up many ($k$) consecutive FFTs. Because the DFT is linear, it'd be the same as adding up many consecutive 2048-vectors of time samples. What happens then is that things that repeat every 2048 samples get multiplied by $k$, whereas things that don't get attenuated or cancel themselves out. That sounds like a &lt;em&gt;bad thing&lt;/em&gt;™, however, you have to realize one thing about the frequencies that the DFT can represent in each bin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every bin in the 2048-FFT represents one frequency that is an &lt;em&gt;integer multiple&lt;/em&gt; of the fundamental frequency (ie. $\frac{f_\text{sample}}{N_\text{FFT}}$). So things that perfectly fall into each bin already inherently repeat every $N_\text{FFT} = 2048$. Hence, doing that will usually (assuming sufficiently stable sampling clock!) simply improve your SNR by $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concluding, just add up 2048-vectors of your time signal, and transform the result. You will get a 2048-DFT with an increased SNR, which definitely is meaningful.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-10-09T09:09:55.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26324" PostTypeId="2" ParentId="26312" CreationDate="2015-10-09T09:19:37.687" Score="2" Body="&lt;p&gt;I naively assumed any (N,N/2+1) Fourier image had the right symmetry, but this goes wrong at the 0- and Nyquist frequency because they don't have a symmetric counterpart. Here, you have to impose the symmetry explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if we generate an image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 100&#xA;fourier_image = np.random.uniform(-1,1,(N,1+N/2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we impose the required symmetry as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fourier_image[1:N/2,0] = np.conj(fourier_image[N:N/2:-1,0])&#xA;fourier_image[1:N/2,-1] = np.conj(fourier_image[N:N/2:-1,-1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And doing the same as in the question above, we find the input - and recovered power:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print 'Original power: ', sum(sum(abs(fourier_image)**2.))&#xA;print 'Recovered power: ', sum(sum(abs(fourier_recovered)**2.))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which are indeed the same:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Original power: 1664.3177945&#xA;Recovered power: 1664.3177945&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For an odd-shaped image this will be slightly different but the idea is the same.&lt;/p&gt;&#xA;" OwnerUserId="17359" LastActivityDate="2015-10-09T09:19:37.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26325" PostTypeId="2" ParentId="26306" CreationDate="2015-10-09T09:23:53.640" Score="1" Body="&lt;p&gt;You can represent this figure using a combination of step function and ramp function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First check where there is a bump or step input. In your example, the step function is at t=4. you can represent it as u(t-4).Now there is a ramp function at t=4 starting at amplitude 1 which unit step u(t-4) gives. It has a slope of -1. you can find that out by finding the slope  between points (4,1) and (5,0). So this ramp function  is normally written as r(t). so the ramp at t=4 can be written as -r(t-4). Note that the negative sign before r is due to slope being -1. Then at t=5, the curve ends.But the ramp -r(t-4) we have considered has a slope of -1 and it keeps going on to the negative y axis after t=5.So to make it end at 5, you add a ramp with the exact slope that cancels with the slope of ramp already present. So the slope of the ramp from t=4 to t=5 is -1 . So now add a positive ramp function with a slope of +1 at t=5.i.e. r(t-5).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the total function is y(t) = u(t-4)-r(t-4)+r(t-5)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to express entire function in terms of step function, you can write &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y(t)= u(t-4)-(t-4)u(t-4)+(t-5)u(t-5).&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="4375" LastEditDate="2015-10-09T09:49:00.147" LastActivityDate="2015-10-09T09:49:00.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26326" PostTypeId="1" CreationDate="2015-10-09T09:40:28.313" Score="1" ViewCount="1765" Body="&lt;p&gt;I have a beamformed output, say&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = weights * signal,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the signal is gaussian,i.e &lt;code&gt;signal = randn( 1 , 1e5 )&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to visualise the output in angular domain, i.e I want to plot the gain of the resulting signal y as a function of elevation angles. I am considering the mainlobe of 'signal' to be pointing in (0 azimuth,0elevation). The weights are combination of amplitude weights and phase weights(exp(phase terms)). I am computing the antenna pattern in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pattern = abs(arrayFactor.* y).^2;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it correct to plot the antenna pattern of such a signal y by multiplying it by the array factor and then plotting its squared magnitude?(in case of isotopic element pattern.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would highly appreciate any input.&lt;/p&gt;&#xA;" OwnerUserId="17633" LastEditorUserId="8202" LastEditDate="2015-10-09T09:52:04.453" LastActivityDate="2015-10-12T19:15:51.063" Title="Plotting antenna pattern in MATLAB" Tags="|beamforming|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26327" PostTypeId="2" ParentId="26320" CreationDate="2015-10-09T12:14:50.457" Score="2" Body="&lt;p&gt;Your question (as expanded in the comments) is asking if we start with&#xA;$$&#xA;x(t)  = x_{\rm true}(t) + n_1(t)&#xA;$$&#xA;and filtering it using a filter $H(\omega)$ to get&#xA;$$&#xA;x_{\rm hp}(t) = h(t) * x(t) = x_{\rm true}(t) + n_2(t)&#xA;$$&#xA;where the variance of $n_1$ is $v_1$, then what is $v_2$, the variance of $n_2$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That seems ill-posed because the filter $H$ will change $x_{\rm true}$ as well as the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/freebooks/sasp/Filtered_White_Noise.html&quot; rel=&quot;nofollow&quot;&gt;This page&lt;/a&gt; looks at the problem when $x_{\rm true}(t) = 0,\ \forall t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here it is assumed that $n_1$ is white noise.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where they get it is that&#xA;$$&#xA;r_{x_{\rm hp}}(l) = v_1 \cdot (h * h)(l)&#xA;$$&#xA;and $v_2$ is just this evaluated at $l=0$ i.e.&#xA;$$&#xA;v_2 = r_{x_{\rm hp}}(0)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you need to find the impulse response of your filter, convolve it with itself and find the zero-lag value of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I said above, this doesn't quite answer your question but it might be a start.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-09T13:21:02.510" LastActivityDate="2015-10-09T13:21:02.510" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26328" PostTypeId="2" ParentId="26320" CreationDate="2015-10-09T13:14:28.957" Score="1" Body="&lt;p&gt;I think in general you have to consider your signal as a stochastic process, so you not only have a variance $\sigma_x^2$ , but you have an entire autocorrelation sequence for $x(n)$, $r_x(t) = E[x(n)x(n-t)]$. So what you need to think about is to obtain the autocorrelation sequence of the output of your signal passed through the filter. This is not hard to obtain, I'll leave it for you to search how to do it, but you might find it useful to search for the the &quot;Wiener–Khinchin theorem&quot;. Basically it holds that if you transform your autocorrelation function with the Fourier transform, you obtain the power spectral density in the frequency domain, this power spectrum gets filtered by the frequency response of the filter, and the result is the power spectrum of the output, which you can then inverse transform and obtain the autocorrelation of the output. $r_x(0)$ will be the variance at the output. It will probably change depending on the form of the filter, and if it is a passive filter (no gain greater than unity at any frequency) your variance will reduce, because the variance is the integral of the power spectrum from $-\pi$ to $\pi$ and if you are attenuating some part of the spectrum you are reducing the energy in that part.&#xA;Anyway, hope it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2015-10-09T13:14:28.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26329" PostTypeId="2" ParentId="26314" CreationDate="2015-10-09T13:20:43.060" Score="5" Body="&lt;p&gt;Yes, you can interpolate and decimate at the same time.  This is called &quot;resampling&quot;.  If you google resampling you will find lots of information about it.  And yes, your reasoning about resampling is mostly correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When thinking about resampling theoretically you usually put the interpolation first to avoid Nyquist issues.  An interpolator is upsampling followed by a low-pass filter to get rid of the aliases.  A decimator is a low-pass filter followed by dropping samples.  You can combine the two by combining the two low-pass filters into one filter.  If the overall rate change is greater than one, the low-pass filter has the same pass-band/cutoff as the interpolation filter.  If the overall rate change is less than one then it has the same pass-band/cutoff as the decimation filter.  The filter operates at the interpolation sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can make the filter more efficient by not actually upsampling the data or dropping filter outputs.  Instead, you use a polyphase filter for the interpolation and simply not calculate the results that will be dropped, but that is a topic for another day and another question.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-10-09T13:20:43.060" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26330" PostTypeId="2" ParentId="26320" CreationDate="2015-10-09T13:44:13.477" Score="2" Body="&lt;p&gt;This answer is not fundamentally different from the others; it's more of a complement and addendum. If $n(t)$ is zero-mean white Gaussian noise, then its variance is actually infinite; its power spectral density is constant and often denoted $\mathcal P_n(f)=N_0/2$. If this noise is input into a filter with impulse response $h(t)$, then the power spectral density of the filter's output $y(t)$ is $\mathcal P_y(f)=\mathcal P_n(f)|H(f)|^2=\frac{N_0}{2}|H(f)|^2$,  where $H(f)$ is the Fourier transform of $h(t)$. Since the noise has zero mean, the output of the filter has variance given by $$\sigma^2=\frac{N_0}{2}\int_{-\infty}^\infty |H(f)|^2\,df.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, if the filter is ideal with bandwidth $B$, the variance of the noise at its output is $N_0B$.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-09T13:44:13.477" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26331" PostTypeId="2" ParentId="26252" CreationDate="2015-10-09T14:02:02.367" Score="0" Body="&lt;p&gt;I am working with a similar kind of network. I don't know if it is correct, but I think the most proper way is to consider the SNR from the first transmitter, not considering what the relay do to the signal. This because you want to analyze the performance of the end-to-end communication. SO you send the signal with some energy, and you want to know the performance of your signal once you have sent it with that energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the way I am doing, and comparing it to the direct transmission, I am getting a very similar performance: a difference of less than 1dB for the same BER.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not amplifying the signal in the relay, so I am just doing the decode and forward (DF). I think it is reasonable to get this &quot;worst&quot; performance in the DF relay compared to the direct transmission because you have two channels, therefore you have two components of noise. You perform the DF in the relay, but it can decode wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if this answer was useful, and if you have any more questions. I am not an expert in this area, but I am working on it.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-10-09T14:02:02.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26332" PostTypeId="1" AcceptedAnswerId="26333" CreationDate="2015-10-09T18:26:45.120" Score="0" ViewCount="1452" Body="&lt;p&gt;I know if we have a continuous-time bandlimited signal $x_{ct}(t)$ that is sampled frequently enough we get a signal that we can call $x_s(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take the Fourier transform of $x_s(t)$ to get $X_s(j\Omega)$, we end up with a Fourier transform of the sampled input that resembles $X_{ct}(j\Omega)$ at $\Omega = 0$ and repeating at $2\pi/T$ and $-2\pi/T$. If we want to get $X_c(j\Omega)$, we can multiply by a $\mbox{rect}()$ function.  It seems to me that we could then reconstruct the original signal by taking the inverse Fourier transform to get $x_{ct}(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when reading on signal processing theory, we instead use a $\mbox{sinc}()$ function to perform reconstruction in the time domain since it is the &quot;ideal interpolator&quot;. Why can't we instead use the method described in the frequency domain? It seems like it would be easier? &lt;/p&gt;&#xA;" OwnerUserId="7605" LastEditorUserId="80" LastEditDate="2015-10-09T19:50:15.917" LastActivityDate="2015-10-09T19:52:21.320" Title="Why do we use sinc interpolation rather than just multiply the frequency domain signal by rect?" Tags="|fft|filters|discrete-signals|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26333" PostTypeId="2" ParentId="26332" CreationDate="2015-10-09T19:52:21.320" Score="3" Body="&lt;p&gt;The &quot;two&quot; operations you talk about are one and the same:  low pass filtering using the $\mbox{rect}()$ function in the frequency domain and $\mbox{sinc}()$ interpolation in the time domain are the same.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-09T19:52:21.320" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26335" PostTypeId="1" CreationDate="2015-10-09T21:57:18.223" Score="-1" ViewCount="64" Body="&lt;p&gt;I have built something that reads in audio files and processes the information for features. Sometimes the audio is rather long, and obviously I cannot keep all of this information in RAM.&#xA;How can I process audio as efficiently as possible without keeping it all in RAM but still being able to refer back to slices when I need them?&lt;/p&gt;&#xA;" OwnerUserId="17728" LastActivityDate="2015-10-10T04:50:31.663" Title="How do I efficiently process 20+ minute audio tracks?" Tags="|audio|speech-processing|" AnswerCount="1" CommentCount="5" ClosedDate="2015-10-10T21:19:13.417" ContentLicense="CC BY-SA 3.0" />
  <row Id="26336" PostTypeId="2" ParentId="24012" CreationDate="2015-10-10T00:12:25.573" Score="0" Body="&lt;p&gt;Source separation can be attributed several adjectives. The reason is the structure of the sources, and the way they are mixed, linear or not, instantaneous or convolutive, etc. With convolutive mixtures, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Blind_signal_separation&quot; rel=&quot;nofollow&quot;&gt;blindness&lt;/a&gt; arises from the absence or very reduced level of knowledge on the sources and the convolution filters. Some used myopic, or informed source spearation, to qualify the degree of information one knows about either the sources or the filtering system.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-10-10T01:33:01.600" LastActivityDate="2015-10-10T01:33:01.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26339" PostTypeId="2" ParentId="26335" CreationDate="2015-10-10T04:50:31.663" Score="2" Body="&lt;p&gt;If you use &lt;a href=&quot;http://www.mega-nerd.com/libsndfile&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;libsndfile&lt;/code&gt;&lt;/a&gt;, you can jump to a wanted position in the audio data using &lt;code&gt;sf_seek&lt;/code&gt;, which accepts as an argument the number of sample frames to seek. If your processing is local in the sense that each output sample only depends on input samples close in time, then you can seek to the first input sample that affects your first output sample, and read from there until the last sample that affects your last output sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you could preprocess the audio piece-wise and write the output to a file as you go, and then seek in the processed audio when the output is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some file formats such as MP3 are difficult to seek, and might not be seekable by &lt;code&gt;libsndfile&lt;/code&gt;. WAV should be easy.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-10-10T04:50:31.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26340" PostTypeId="2" ParentId="26322" CreationDate="2015-10-10T06:38:46.687" Score="0" Body="&lt;p&gt;Here is some code that will let you interactively make a mask and see the difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first image the dark edges and the bright centres are about the same width, so there is only one ring. For the second image, the dark edges are half the size of the bright centres, hence two rings.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I1 = imread('sefft1.jpg');&#xA;I2 = imread('sefft2.jpg');&#xA;&#xA;I1g = rgb2gray(I1);&#xA;I2g = rgb2gray(I2);&#xA;&#xA;I1gFFT = fft2(I1g);&#xA;I2gFFT = fft2(I2g);&#xA;&#xA;imagesc(log(abs(fftshift(I1gFFT))))&#xA;imagesc(log(abs(fftshift(I2gFFT))))&#xA;&#xA;% FFT coordinates&#xA;[rows,cols] = size(I1gFFT);&#xA;&#xA;[ux, uy] = meshgrid(([1:cols]-(fix(cols/2)+1))/(cols-mod(cols,2)), ...&#xA;    ([1:rows]-(fix(rows/2)+1))/(rows-mod(rows,2)));&#xA;ux = ifftshift(ux);   % Quadrant shift to put 0 frequency at the corners&#xA;uy = ifftshift(uy);&#xA;&#xA;% Convert to polar coordinates&#xA;th = atan2(uy,ux);&#xA;r = sqrt(ux.^2 + uy.^2);&#xA;&#xA;% Centred versions&#xA;rc = fftshift(r);&#xA;thc = fftshift(th);&#xA;&#xA;% Interactive selection of filter&#xA;imagesc(log(abs(fftshift(I1gFFT))));&#xA;title('Image 1: Press enter to select max and min freq');&#xA;pause;&#xA;title('select max and min freq');&#xA;[x,y] = ginput(2);&#xA;y = round(y)&#xA;x = round(x)&#xA;r1 = rc(y(1),x(1));&#xA;r2 = rc(y(2),x(2));&#xA;rmin = min(r1,r2);&#xA;rmax = max(r1,r2);&#xA;mask = (r &amp;gt; rmin) &amp;amp; (r &amp;lt; rmax);&#xA;maskc = (rc &amp;gt; rmin) &amp;amp; (rc &amp;lt; rmax);&#xA;&#xA;imagesc(log(abs(fftshift(I1gFFT).*maskc))); title('Masked area'); pause;&#xA;imagesc(ifft2(I1gFFT.*mask)); title('Result of ifft of masked area'); pause;&#xA;imagesc(ifft2(I1gFFT.*(1-mask))); title('Result of ifft of non-masked area'); pause;&#xA;&#xA;% Interactive selection of filter&#xA;imagesc(log(abs(fftshift(I2gFFT))));&#xA;title('Image 2: Press enter to select max and min freq');&#xA;pause;&#xA;title('select max and min freq')&#xA;[x,y] = ginput(2);&#xA;y = round(y)&#xA;x = round(x)&#xA;r1 = rc(y(1),x(1));&#xA;r2 = rc(y(2),x(2));&#xA;rmin = min(r1,r2);&#xA;rmax = max(r1,r2);&#xA;mask = (r &amp;gt; rmin) &amp;amp; (r &amp;lt; rmax);&#xA;maskc = (rc &amp;gt; rmin) &amp;amp; (rc &amp;lt; rmax);&#xA;&#xA;imagesc(log(abs(fftshift(I2gFFT).*maskc))); title('Masked area'); pause;&#xA;imagesc(ifft2(I2gFFT.*mask)); title('Result of ifft of masked area'); pause;&#xA;imagesc(ifft2(I2gFFT.*(1-mask))); title('Result of ifft of non-masked area'); pause;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2015-10-10T06:38:46.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26341" PostTypeId="1" CreationDate="2015-10-10T08:26:32.373" Score="2" ViewCount="1055" Body="&lt;p&gt;In the lovely image below we see the addition of sine waves making a square wave. I am coding a wave table synthesiser and thought it would be great to get the user to be able to fiddle with the values of the sine partials and then run an inverse FFT on them to produce the wave form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GfyoT.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GfyoT.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some code for an FFT and you specify the number of buckets, real and imaginary arrays and the array length. The way it is used in the example is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Imaginary array has all it's values set to 0&lt;/li&gt;&#xA;&lt;li&gt;The real array has its 0th element set to 0&lt;/li&gt;&#xA;&lt;li&gt;The real array has its arrayLength/2 element set to 0&lt;/li&gt;&#xA;&lt;li&gt;Other values are set in the real array. Every time a value is set in the first half of the array one is set at the opposite end of the array, mirroring whatever is happening in the first half of the real array.&lt;/li&gt;&#xA;&lt;li&gt;This spits out a single cycle of the waveform constructed using these sine partials&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What are some common patterns for filling these partials to generate waveforms. How do you generate a square wave, a triangle wave, a sawtooth? Can you create noise or is that impossible if it is non periodic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extra: What are some tricks for producing 'good' waveforms? This is an opinion question, just a bonus if you have something to share about producing waveforms that sound good. (Good in your opinion :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those who would find it interesting there is a &lt;a href=&quot;http://toxicdump.org/stuff/FourierToy.swf&quot; rel=&quot;nofollow noreferrer&quot;&gt;flash app here&lt;/a&gt; that lets you set the levels of the partials in order to construct waveforms, it's fun.&lt;/p&gt;&#xA;" OwnerUserId="17724" LastEditorUserId="17724" LastEditDate="2015-10-10T08:48:42.097" LastActivityDate="2017-09-25T07:17:33.207" Title="How do you construct common waveforms (square, sawtooth, triangle, noise) from sine wave partials using an IFFT?" Tags="|ifft|wave|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26342" PostTypeId="1" AcceptedAnswerId="26345" CreationDate="2015-10-10T19:16:28.380" Score="3" ViewCount="117" Body="&lt;p&gt;I got my MS in EE way back in 1994 and have not presented at a conference, or published in a journal before, but I had and still have an intense interest in the applied math that I learned. I have been working my own research project for a few years, and I want to publish a paper on my work. What I did is develop an algorithm similar to a discrete Kalman fiter, and it gives better estimates under certain conditions. I am looking for advice on what journal would a good choice. It would take to long for me to learn LaTeX (is that what it's called), and I don't have the education needed to develop the sophisticated math that I see in many journals. &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="128" LastEditDate="2020-03-14T09:05:19.647" LastActivityDate="2020-03-14T09:05:19.647" Title="How to Pick a Journal for Publishing a Research Work?" Tags="|estimation|self-study|research|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26343" PostTypeId="1" AcceptedAnswerId="26344" CreationDate="2015-10-10T20:09:02.973" Score="1" ViewCount="163" Body="&lt;p&gt;That simple. What is a note in digital signal processing? Is it a single value of &lt;code&gt;y[n]&lt;/code&gt; in a system with a difference equation e.g. &lt;code&gt;y[n] = a1 * x[n] + ...&lt;/code&gt; or a combination of samples?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen DSP programs that output single values to e.g. a sound card and others that output blocks at a time with anywhere from 64-1024 frames per block... both referring to their output as a series of notes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a &quot;note&quot; what is heard at a given time, i.e. composed of a single sample in the former case and of many in the latter? Or just the latest chunk whose samples have a single frequency?&lt;/p&gt;&#xA;" OwnerUserId="11916" LastEditorUserId="11916" LastEditDate="2015-10-10T21:12:30.897" LastActivityDate="2016-07-05T02:05:58.490" Title="What is a note?" Tags="|audio|frequency|music|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26344" PostTypeId="2" ParentId="26343" CreationDate="2015-10-10T20:48:37.123" Score="3" Body="&lt;p&gt;the etymology of the word &quot;note&quot; as it applies to music is simply the notation, the &lt;em&gt;note&lt;/em&gt; that a composer would make to paper to represent a particular action taken by the musician performing the music.  like &quot;taking notes&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;normally in audio-to-MIDI conversion, a musical note is something that can be represented with a pair of MIDI Note-On and Note-Off messages.  it has a beginning and an end, in time, and likely has other properties like pitch and loudness/intensity, which are also part of the MIDI Note-On message.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-10-10T20:48:37.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26345" PostTypeId="2" ParentId="26342" CreationDate="2015-10-10T21:14:20.797" Score="1" Body="&lt;p&gt;Getting work published in a high impact factor journal is quite a slog. If you're starting from not having presented at a conference etc. before, that's going to be an even bigger ask.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it's not impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For IEEE journals, short notes about signal processing topics &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/RecentIssue.jsp?punumber=97&quot; rel=&quot;nofollow&quot;&gt;can be sent to the &lt;em&gt;IEEE Signal Processing Letters&lt;/em&gt; journal&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, starting there might be too much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'd suggest is to look at starting with an online journal such as &lt;a href=&quot;http://arxiv.org/&quot; rel=&quot;nofollow&quot;&gt;arxiv&lt;/a&gt; or &lt;a href=&quot;http://www.plosone.org/&quot; rel=&quot;nofollow&quot;&gt;PLOSone&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even before submitting there, I'd suggest posting a question here that might be relevant to the situations where the algorithm might be better than others, and also posting an answer with your algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aim with any of these submissions is to get feedback about your work and improve it or its presentation.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-10T21:14:20.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26346" PostTypeId="2" ParentId="26342" CreationDate="2015-10-10T23:09:07.773" Score="1" Body="&lt;p&gt;Could you please elaborate on why you would like to publish in a journal? One reason is that your work will be checked (hopefully) by competent reviewers and could be strengthened. @Peter K &lt;a href=&quot;http://www.signalprocessingsociety.org/publications/periodicals/letters/&quot; rel=&quot;nofollow&quot;&gt;IEEE Signal Processing Letters&lt;/a&gt; suggestion is excellent, as per publication you can as well apply with the same paper to conferences like ICASSP or GlobalSIP (see section Scope in the above link). &lt;a href=&quot;http://digital-library.theiet.org/content/journals/iet-spr&quot; rel=&quot;nofollow&quot;&gt;IET Signal Processing&lt;/a&gt; is another option, possibly less selective. There are many other choices, depending on your goal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can as well find a neat application, and publish in an applied journal instead of a pure signal processing that may require proofs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A well written technical note with clean code is a final option, and can be cited as well.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-10-10T23:09:07.773" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26347" PostTypeId="2" ParentId="25186" CreationDate="2015-10-11T02:17:15.200" Score="2" Body="&lt;p&gt;Behold the power of shortest path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution roughly follows what I did here: &lt;a href=&quot;https://dsp.stackexchange.com/questions/16786/detecting-and-isolating-part-of-an-image/16809#16809&quot;&gt;Detecting and isolating part of an image&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case we first treat the image by limiting every pixel value above the water-level grey to that same intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wkNwF.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wkNwF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then performing shortest path on the inverse edge image created with a difference of Gaussian filter we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MNlYH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MNlYH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resulting in the following segmentation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KVyWN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KVyWN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My MATLAB functions that are needed for this solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://imageprocessing.com.au/research/code/polarTransform.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imageprocessing.com.au/research/code/polarTransform.m&lt;/a&gt; &lt;a href=&quot;http://imageprocessing.com.au/research/code/circularShortestPath.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imageprocessing.com.au/research/code/circularShortestPath.m&lt;/a&gt; &lt;a href=&quot;http://imageprocessing.com.au/research/code/linearShortestPath.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://imageprocessing.com.au/research/code/linearShortestPath.m&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;close all&#xA;&#xA;%% Load image&#xA;I = imread('CabQx.jpg');&#xA;I = double(rgb2gray(I));&#xA;figure&#xA;imagesc(I);&#xA;colormap gray(256); &#xA;title('Image');&#xA;&#xA;%% Adjust intensity&#xA;Ia = I;&#xA;Ia(Ia &amp;gt; 49) = 49;&#xA;figure&#xA;imagesc(Ia);&#xA;colormap gray(256); &#xA;title('Adjusted Image');&#xA;&#xA;%% Bandpass Kernel&#xA;H1 = fspecial('gaussian',[100,100],8); % *** Changed filter size&#xA;H2 = fspecial('gaussian',[100,100],2);  % *** &#xA;H = H2-H1;&#xA;H = mat2gray(H);&#xA;figure;&#xA;imagesc(H);&#xA;colorbar;&#xA;colormap gray(256); &#xA;title('Bandpass kernel');&#xA;&#xA;%% Edge Kernel&#xA;Hedge = imag(hilbert(H));&#xA;figure;&#xA;imagesc(Hedge);&#xA;colormap gray(256); &#xA;title('Edge Kernel');&#xA;&#xA;%% Edge filtered image&#xA;G = sqrt(imfilter(Ia,Hedge,'replicate').^2 + imfilter(Ia,Hedge.','replicate').^2);&#xA;G = max(G(:)) - G;&#xA;imagesc(G);&#xA;colormap gray(256); &#xA;title('Inverse edge filtered image');&#xA;&#xA;%% Shortest path&#xA;% Mid point&#xA;[r,c] = size(G);&#xA;r = floor(r/2);&#xA;c = floor(c/2);&#xA;% Min radius and max radius&#xA;min_radius = 100;&#xA;max_radius = 1000;&#xA;% Shortest path&#xA;[ path, energy, lastIndex, pathImage ] = ...&#xA;    circularShortestPath(G, 100, [c,r], [min_radius,max_radius], [400,720*2]);&#xA;figure;&#xA;imagesc(I);&#xA;hold on;&#xA;plot(path(:,1),path(:,2),'r','LineWidth',2);&#xA;hold off;&#xA;colormap gray(256); &#xA;title('Shortest path');&#xA;&#xA;%% Segment&#xA;figure&#xA;imagesc(I);&#xA;hold on;&#xA;fill(path(:,1),path(:,2),'r');&#xA;hold off;&#xA;colormap gray(256); &#xA;title('Mask')&#xA;&#xA;%%&#xA;J = zeros(size(I));&#xA;mask = roipoly(J,path(:,1),path(:,2));&#xA;segmentedI = I .* mask;&#xA;figure;&#xA;imagesc(segmentedI);&#xA;colormap gray(256); &#xA;title('Segmented image');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-10-11T02:17:15.200" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26348" PostTypeId="2" ParentId="26341" CreationDate="2015-10-11T06:10:52.507" Score="1" Body="&lt;p&gt;You can find the formulas for a rectangular, square, triangle, sawtooth and rectified sinusoidal waveform in &lt;a href=&quot;http://www.dspguide.com/CH13.PDF&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chapter 13&lt;/a&gt; section The Fourier Series, of the Scientist and Engineer's Guide to Digital Signal Processing by Steven W. Smith. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you IFFT a vector of random numbers, you get out another vector of random numbers that approximately follow a Gaussian distribution, due to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;central limit theorem&lt;/a&gt; and that each time domain number was formed as a linear combination of multiple frequency domain numbers. But it will be periodic so it won't sound like pure noise unless the vector length is huge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to construct your own arbitrary waveform from line segments you can use:&#xA;$$f(x) = \left\{\begin{array}{ll}a + b\ x &amp;amp; \text{if}\ x_0 &amp;lt;= x &amp;lt; x_1\\ 0 &amp;amp; \text{otherwise}\end{array}\right.\\&#xA;\hat f(\omega) = \int^{+\infty}_{-\infty} e^{-i\omega\ x} f(x) = \int^{x_1}_{x_0} e^{-i\omega\ x}(a + b\ x) = -\frac{b\ \cos(\omega\ x_0)}{\omega^2} - \frac{(a + b\ x_0)\ \sin(\omega\ x_0)}{\omega} + \frac{b\ \cos(\omega\ x_1)}{\omega^2} + \frac{(a + b\ x_1)\ \sin(\omega\ x_1)}{\omega} + i\ \left(-\frac{(a + b\ x_0)\ \cos(\omega\ x_0)}{\omega} + \frac{b\ \sin(\omega\ x_0)}{\omega^2} + \frac{(a + b\ x_1)\ \cos(\omega\ x_1)}{\omega} - \frac{b\ \sin(\omega\ x_1)}{\omega^2}\right),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a = \frac{x_0\ y_1 - x_1\ y_0}{x_0 - x_1}$ and $b =\frac{y_0 - y_1}{x_0 - x_1}$ for a line segment starting at $(x_0, y_0)$ and ending at $(x_1, y_1)$ and  $\hat f(\omega)$ is the Fourier transform of $f(x)$. Discretely sampling $\hat f(\omega)$ at multiples of $2\pi$ will make $f(x)$ periodic by 1. If you have more than one segment you can sum their Fourier transforms.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2017-09-25T07:17:33.207" LastActivityDate="2017-09-25T07:17:33.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26349" PostTypeId="2" ParentId="26326" CreationDate="2015-10-11T07:02:30.680" Score="1" Body="&lt;p&gt;Denote the array manifold (what you call array pattern) by a $N \times 1$ vector ${\bf{a}}\left ( \theta \right )$ where $\theta$ is the DOA and $N$ is the number of array elements. Further denote by the $N \times 1$ vector $\bf{x}_k$ the $k$-th snapshot of the array, then you are measuring the following signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;{\bf{x}_k}= {\bf{a}}\left ( \theta \right ) s_k + {\bf{n}}_k&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $s_k$ is the signal reflecting from the target and $n$ is a random noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denote the beamformer by a $N \times 1 $ vector of weights ${\bf{w}}$, then the array response after beamforming would be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;r(\theta) = {\bf{w}}^H {\bf{x_k}},&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $r$ is a scalar for a given DOA $\theta$ and $\bf{w}$ is a function of $\theta$. Now, to get the array response for a variety of DOAs just change $\theta$.&lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="15513" LastEditDate="2015-10-12T19:15:51.063" LastActivityDate="2015-10-12T19:15:51.063" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26350" PostTypeId="1" CreationDate="2015-10-11T08:02:01.360" Score="4" ViewCount="2243" Body="&lt;p&gt;I'm reading Digital Image Processing by R. Woods and R. Gonzalez. In it, a section on &lt;strong&gt;edge linking using local processing&lt;/strong&gt; in an image details a simplified algorithm, that imposes a criterion on the gradient direction of edge pixels. I don't understand this. The algorithm is at the end of the first image, and an example is shown on the next page which shows the results of applying the algorithm. Can someone explain why this algorithm works? Specifically, I want to know why the such a criterion is imposed on the gradient direction, and what the author means by T&lt;sub&gt;A&lt;/sub&gt; being a &lt;strong&gt;&quot;band&quot; of acceptable directions&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've understood that the algorithm is a simplification of the method discussed above it. I've also understood the two criteria imposed on the gradient magnitude and directions in that discussion. But I don't understand why T&lt;sub&gt;A&lt;/sub&gt; has to be a band, why the criterion for the direction is an equation and not an inequality, and why the algorithm worked for the example image, where the equation works out to be alpha(x, y) = 90 + 45 = 135 (since A = 90 and T&lt;sub&gt;A&lt;/sub&gt; = 45).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p5YHh.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p5YHh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ILs2c.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ILs2c.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have enough rep to post the last image, so I'll write the last part : &quot;A=90, T&lt;sub&gt;A&lt;/sub&gt; and filling in all gaps of 25 or fewer pixels (approx 5% of the image width. &lt;strong&gt;Use of a large range of allowable directions was required to detect the rounded corners of the license plate enclosure, as well as the rear windows of the vehicle.&lt;/strong&gt; Fig E is the result of forming the logical OR of the preceding two images, and fig F was obtained by thinning dig E by a thinning procedure. As fig F shows, the rectangle corresponding to the license plate was clearly detected.&quot;&lt;/p&gt;&#xA;" OwnerUserId="17736" LastEditorUserId="17736" LastEditDate="2015-10-11T15:51:43.243" LastActivityDate="2023-07-08T16:19:26.793" Title="Edge linking using local processing - why is this criterion imposed" Tags="|image-processing|edge-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26351" PostTypeId="1" AcceptedAnswerId="26356" CreationDate="2015-10-11T08:31:17.253" Score="3" ViewCount="2557" Body="&lt;p&gt;On &lt;a href=&quot;https://en.wikipedia.org/wiki/Multiple_signal_classification#cite_note-1&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;, is written that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;MUltiple SIgnal Classification (MUSIC) is an algorithm used for frequency estimation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;One purpose of estimating the spectral density is to detect any periodicities in the data, by observing peaks at the frequencies corresponding to these periodicities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I premise that I'm not an expert on the signal theory, therefore I do apologize if this question it will not be much precise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since MUSIC is an algorithm used for frequency estimation, and since purpose of estimating the spectral density is to detect any periodicities in the data, by observing peaks at the frequencies corresponding to these periodicities,&#xA;my question is the following. Is MUSIC a method to detect &lt;em&gt;the number of peaks&lt;/em&gt; in a power spectrum? Is it used for this purpose?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References and answers are welcome. Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="17183" LastActivityDate="2015-10-11T11:54:00.157" Title="MUSIC algorithm for peak detection" Tags="|estimation|reference-request|peak-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26352" PostTypeId="1" AcceptedAnswerId="26365" CreationDate="2015-10-11T10:27:20.907" Score="1" ViewCount="6740" Body="&lt;p&gt;I have the following standard transfer function for a damped linear oscillator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(s) = \dfrac{\omega_0^2}{s^2 + 2\zeta\omega_0s + \omega_0^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have two eigen values at locations $-100 \pm 100i$. &#xA;I want to calculate the damping coefficient, $\zeta$, and natural frequency $\omega_0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that the characteristic polynomial of matrix $A$ from the linear system in state space form is the denominator of $G(s)$. However, when solving $s^2 + 2\zeta\omega_0s + \omega_0^2=0$ for $s = -100 - 100i$, I get an equation with two unknowns right? What theoretical point am I missing here? how should I go about this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="17738" LastEditorUserId="8202" LastEditDate="2015-10-11T15:39:04.023" LastActivityDate="2020-10-01T09:45:40.660" Title="Calculating frequency and damping ratio from transfer function given eigenvalues" Tags="|linear-systems|transfer-function|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26353" PostTypeId="1" CreationDate="2015-10-11T10:31:01.473" Score="1" ViewCount="38" Body="&lt;p&gt;The Welch estimate [1] of PSD (power spectral density) is determined as:&#xA;$$\hat{\phi}_W(\omega)=\frac{1}{S}\sum_{j=1}^S \hat{\phi}_j(\omega)$$&#xA;where&#xA;$$\hat{\phi}_j(\omega)=\frac{1}{MP}\left|\sum_{t=1}^M v(t) y_j(t) e^{-i\omega t}\right|^2$$&#xA;is a 'windowed periodogram' corresponding to $y_j(t)$ and&#xA;$$P=\frac{1}{M} \sum_{t=1}^M |v(t)|^2$$&#xA;denotes the 'power' of the temporal window $\{v(t)\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is, for the Welch estimator, a common choice of temporal window $\{v(t)\}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Welch, Peter D. &quot;The use of fast Fourier transform for the estimation of power spectra: A method based on time averaging over short, modiﬁed periodograms.&quot; IEEE Transactions on audio and electroacoustics 15.2 (1967): 70-73.&lt;/p&gt;&#xA;" OwnerUserId="17183" LastActivityDate="2015-10-11T10:31:01.473" Title="Temporal window $\{v(t)\}$ of Welch estimator" Tags="|estimation|power-spectral-density|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26354" PostTypeId="1" AcceptedAnswerId="26367" CreationDate="2015-10-11T10:56:36.583" Score="1" ViewCount="183" Body="&lt;p&gt;Can someone write down steps an totally beginner in EE and DSP needs to pass to become a audio engineer? From which subject to start with (math, electronics), and with which subjects to continue this road? My goal is to get a good knowledge in audio signal processing, things like creating sounds (sound synthesis), sound transformation, mixdown audio, understand fundamental things. I will be very grateful if someone give me instruction from where to start and what path to follow, and on what to mostly pay attention, I have a great desire to learn all of that, I have 6 years experience in electronic music production. Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="15569" LastEditorUserId="13320" LastEditDate="2016-11-21T13:07:23.840" LastActivityDate="2016-11-21T13:07:23.840" Title="Path to becoming an audio engineer" Tags="|audio|" AnswerCount="1" CommentCount="4" ClosedDate="2015-10-12T19:29:24.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="26356" PostTypeId="2" ParentId="26351" CreationDate="2015-10-11T11:54:00.157" Score="3" Body="&lt;p&gt;We could say MUSIC is optimal algorithm for spectrum estimation if the number of spectral peaks is a priory known and is less than estimator order, $M$. In MUSIC we need to estimate $R_{xx}$ autocovariance matrix of input random process first. The matrix dimension is limited to estimator's order, $M$. Second step is to perform SVD: $R_{xx} = U\cdot\Sigma\cdot V^{H}$ and $\Sigma$ is diagonal matrix with mimension also $M$. This matrix contains singular values of $R_{xx}$, the largest $K$ values correspond to signal's subspace while other - to noise one. For obvious reason $K &amp;lt; M$, so the limitation of the number of spectral peaks (in the other words - harmonic signal sources) becomes clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you use MUSIC in practice to estimate PSD you need either to know actual number of not noise signals in the mixture or to estimate this number after SVD by some kind of threshold or ML search. If your a priory information or estimation isn't valid, it can strongly violate algorithm performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you're searching is number of sources estimation or source enumeration. You can look through &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.332.5929&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt; for example. In the case of MUSIC source enumeration problem can be viwed as signal's subspace estimation problem. You can find simple approach for the problem's solving in &lt;a href=&quot;http://electronix.ru/forum/index.php?act=attach&amp;amp;type=post&amp;amp;id=90841&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;. It is called MDL, I checked it once while modeling the described SNR estimation algorithm in MATLAB. It seems to work well for pretty low SNR values. But remember you can't overcome limitation of $K &amp;lt; M$ for subspace based methods as I've described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps.&lt;/p&gt;&#xA;" OwnerUserId="10374" LastActivityDate="2015-10-11T11:54:00.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26357" PostTypeId="1" CreationDate="2015-10-11T12:16:56.063" Score="1" ViewCount="34" Body="&lt;p&gt;At the moment, I am using the Welch's averaged modified periogram method for spectral estimation, which has the frequency resolution $f_s/N$ where $f_s$ is the sampling frequency and $N$ the window length. I get a a resolution that is about $0.1$ Hz. I would like to spectral lines from a set of noisy data and it appears that the resolution provided by this method is not enough in all cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be a better way to estimate the line components?&lt;/p&gt;&#xA;" OwnerUserId="17741" LastActivityDate="2015-10-11T12:16:56.063" Title="What spectral estimation technique to use for finding sharp spectral lines?" Tags="|frequency-spectrum|power-spectral-density|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26358" PostTypeId="1" CreationDate="2015-10-11T12:24:17.490" Score="4" ViewCount="1036" Body="&lt;p&gt;I have to kinds of signals. The first type of signals are such that their histograms are unimodal (one-peaked). The second type of signals are such that their histograms are bimodal (two-peaked). How I can best detect whether a signal is unimodal or bimodal? In some signals there is a lot of noise so the detection is going to be difficult I guess. Any ideas on how to measure &quot;bimodalism&quot;?&lt;/p&gt;&#xA;" OwnerUserId="17743" LastActivityDate="2015-11-12T03:09:29.970" Title="How to detect whether a signal is unimodal or bimodal?" Tags="|histogram|time-series|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26359" PostTypeId="1" CreationDate="2015-10-11T12:29:41.333" Score="7" ViewCount="133" Body="&lt;p&gt;This is perhaps a bit soft question but when did signal processing become a field of its own? It would appear to have first been a branch of mathematics and statistics but then emerged as an independent field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is any book that would cover this, or perhaps some special issue article, I would love to read it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS. Please help to add relevant tags; I could not find any&lt;/p&gt;&#xA;" OwnerUserId="17744" LastEditorUserId="35" LastEditDate="2015-10-11T17:07:35.873" LastActivityDate="2015-10-14T11:43:44.963" Title="When did signal processing become a field of its own?" Tags="|reference-request|signals-history|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26360" PostTypeId="1" CreationDate="2015-10-11T12:34:42.640" Score="4" ViewCount="1599" Body="&lt;p&gt;Suppose I have a binary classification problem with 10 features and about 1000 samples. In the training set, most of my data is unlabeled (75%). The rest of the data is labeled but contains only positive labels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the test set, I have both negative and positive labels. How should I approach this classification problem?&lt;/p&gt;&#xA;" OwnerUserId="17745" LastActivityDate="2016-09-07T08:52:39.017" Title="Machine learning with only positive labels" Tags="|machine-learning|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26361" PostTypeId="2" ParentId="26304" CreationDate="2015-10-11T12:35:18.627" Score="4" Body="&lt;p&gt;Energy can be a genuine motivation for real systems, when actual power is used. As said before by @Peter K. and @MBaz, in signal processing, most practical signals are time-limited, and thus energy-signals. But we use energy because this is almost the only quantity for which we can solve stuff efficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In signal processing (and other domains as well), several tools will be implemented as computer algorithms, and the energetic motivation is often gently fraudulent. It masks a question of theory and computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us take a classical case. I compute an average (mean, $\hat{m}$) of grades for my students. This indicator is so standard and convenient: easy to compute, linear, sum-preserving. Yet, mean arises from the optimal energetic solution to the minimum point between a sum of squared differences (based on the $\ell_2$ norm):&#xA;$$ \hat{m} =  \arg \min \sum_k (x_k-m)^2$$&#xA;In practice, should we care about the energy of a grade difference? Is it related related to the energy a student invests in learning?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To judge a student with one single measurement, we could as well wish students to have regularity in their work, and low variations between their grades. A midrange estimator ($\ell_\infty$ norm) would be fine for that: $m_\mathrm{mr} = \frac{1}{2}(x_\min +x_\max)$. Or allow the student a minority of failures, for which the median ($\ell_1$ norm) could be convenient: $m_\mathrm{md} = \mathrm{median} x_k$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, to summarize a series of observations we can find many &quot;central tendencies&quot; that could highlight the observations' behavior. This takes one real choice: put in equations what you really want to see, to compare, thus to measure. In many cases we do not know. In few cases we know, but it is intractable. I like student with open eyes, asking good questions, able to do brain work. In the end, I grade them from average answers to questions, which I do in the most subjective way to promote the above behaviors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me, in most cases in signal processing, we minimize energies, since the function $x\to x^2$ is convex, admits a single extremum that we can compute efficiently through derivation and linear system solving. We know how to solve the latter since decades (&lt;a href=&quot;https://en.wikipedia.org/wiki/Gauss%E2%80%93Seidel_method&quot; rel=&quot;nofollow&quot;&gt;Gauss-Seidel or Liebmann method&lt;/a&gt;). Just like the average, linear time-invariant systems are derived from energy, and yield Fourier methods (orthogonal, thus energy preserving) as invariants. Optimal quantization, filter design, Wiener filtering, second-order stationary properties, Heisenberg-Pauli inequality and Gaussians, most standard SP tools are energy minimizers, because these were the only ones, with common sense, that we could get painlessly for a long time in any dimension. Median and midrange in 1D require sorting. Think about what would be the median of a 2D signal? Of course, there exists designs to compute optima with other penalties, but they are uncommon, as long as they are complicated to compute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily, since about 10-15 years, people have proposed novel toolboxes of tools to account for more involved penalties:  other norms or distance, quasi-norms, non-convex terms, sums of the above (lasso, ridge, total variation). They are now solved with iterative algorithms. Penalized least-squares, &lt;a href=&quot;https://www.ljll.math.upmc.fr/~plc/prox.pdf&quot; rel=&quot;nofollow&quot;&gt;proximal algorithms&lt;/a&gt;, to give a few. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Uncle_Ben#.22With_great_power_comes_great_responsibility.22&quot; rel=&quot;nofollow&quot;&gt;With great power (of two) comes great responsibility&lt;/a&gt;. We still have to weight these penalties with hyper-parameters, sometimes difficult to infer, we still have to ensure convergence, we should implement them cleverly to get solutions in practical time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So non power- or non-energy signals might soon become more important, as we now have tools to deal with them. We do not have to pretend using energy, as long as these tools provide sensibly better results. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-10-11T14:45:19.443" LastActivityDate="2015-10-11T14:45:19.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26362" PostTypeId="1" CreationDate="2015-10-11T12:43:14.937" Score="2" ViewCount="75" Body="&lt;p&gt;In the Welch's method, a signal is divided into overlapping segments, multiplied with a window function, and transformed to frequency domain via fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does the method use only one window function? Suppose I would use (say) ten window functions to produce ten spectral estimates. By averaging the estimates, my SNR would be higher than by using just one of the windows?&lt;/p&gt;&#xA;" OwnerUserId="17746" LastActivityDate="2015-10-12T06:16:52.550" Title="Has there been any research on time-windowed spectral estimation using more than one window function at the same time?" Tags="|discrete-signals|signal-analysis|fourier-transform|frequency-spectrum|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26364" PostTypeId="1" CreationDate="2015-10-11T13:44:03.600" Score="2" ViewCount="5392" Body="&lt;p&gt;To my understanding, pole-zero plots are used to analyze or visualize transfer functions. Suppose there is some very simple system, for example a simple low-pass filter (so it is linear and time-invariant). How does one calculate the pole-zero plot of such system?&lt;/p&gt;&#xA;" OwnerUserId="17747" LastActivityDate="2015-10-15T02:27:30.107" Title="How does one calculate a pole-zero plot?" Tags="|discrete-signals|fourier-transform|linear-systems|time-series|poles-zeros|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26365" PostTypeId="2" ParentId="26352" CreationDate="2015-10-11T14:30:17.437" Score="1" Body="&lt;p&gt;If I understand you correctly your system has two complex conjugate poles at &lt;span class=&quot;math-container&quot;&gt;$p=-100+100i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p^*=-100-100i$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$^*$&lt;/span&gt; denotes complex conjugation). Consequently, your denominator polynomial can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}(s-p)(s-p^*)&amp;amp;=s^2-(p+p^*)s+|p|^2\\&amp;amp;=s^2-2\text{Re}\{p\}s+|p|^2\\&amp;amp;=s^2-2|p|\cos(\phi)s+|p|^2\end{align}\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is the pole angle: &lt;span class=&quot;math-container&quot;&gt;$p=|p|e^{i\phi}$&lt;/span&gt;. For the given poles you have &lt;span class=&quot;math-container&quot;&gt;$\phi=3\pi/4$&lt;/span&gt;. Comparing &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; with the denominator in your question immediately gives &lt;span class=&quot;math-container&quot;&gt;$\omega_0=|p|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\zeta=-\cos\phi$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2020-10-01T09:45:40.660" LastActivityDate="2020-10-01T09:45:40.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26366" PostTypeId="1" CreationDate="2015-10-11T14:46:51.373" Score="6" ViewCount="5123" Body="&lt;p&gt;If I have understood correctly, averaging $N$ noisy independent segments or signals increases the signal-to-noise $\sqrt{N}$-fold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does one derive this result?&lt;/p&gt;&#xA;" OwnerUserId="17748" LastEditorUserId="13320" LastEditDate="2016-11-13T13:48:08.730" LastActivityDate="2016-11-13T13:48:08.730" Title="How to derive the results that averaging $N$ signals yields a $\sqrt{N}$-fold increase in signal-to-noise ratio?" Tags="|signal-analysis|noise|snr|denoising|averaging|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26367" PostTypeId="2" ParentId="26354" CreationDate="2015-10-11T14:58:18.673" Score="0" Body="&lt;p&gt;&lt;em&gt;(TLDR: if you want to dive in I might recommend Will Pirkle's books Designing Audio Effect Plug-Ins in C++ and Designing Software Synthesizer Plug-Ins in C++ but you might be completely overwhelmed depending on your background)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First off, if you want to create new sounds, I love Max/MSP and that will get you creating new sounds quickly but it will not teach you DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before a mod closes this as off-topic or too open-ended, I will say this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;There is no recipe, no set list of steps. Period.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or as Umberto Eco wrote in his famous thriller &quot;Foucault's Pendulum&quot;....there is no map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take that for what you will. I'm sure everybody's story who works with audio is different. I grew up messing around with 4-track tape recorders, and since I grew up with computers, started playing with digital audio workstations like Audacity and ProTools (Ardour during my hardcore linux purist phase), making demos and playing in bands. During this time I also tried my hand at BASIC and later scripting languages. I got interested in theoretical physics in high school, and majored in physics in college (where I made a lot of demo recordings with bands and learned how to solve problems, but not a lot of domain specific knowledge (which I think is a good thing)). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't want to be a particle physicist and had met a professor who worked in architectural acoustics. I found a grad program that was able to pay me to think about sound and space (mostly psychoacoustics) for 4 years and earn my MS and PhD. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of my PhD I met (through a random LinkedIn message I initiated) the CTO of a startup who was willing to transfer my skills in psychoacoustics to programming microcontrollers to do effects and equalization. My job got me started down the path of really doing synthesis and processing. &lt;strong&gt;I had (almost) no idea what I was doing, and that's when I really learned&lt;/strong&gt;. I'm just starting on this journey of being able to digitally manipulate sound, and I find that there's just so much out there and it is totally fascinating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every day I realize I know so little, but take in what I can each day (and try not to get frustrated that I don't move faster). &lt;strong&gt;Understanding is a slow process that cannot be expedited.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, if I had to do it all over again knowing what I know now (and how could I have really?), I would have taken as much math and programming as I could have in high school (which wasn't offered in Catholic school) and majored in electrical engineering (which wasn't offered at the liberal arts college I attended). EE is really where all this stuff stems from. I'm biased but I would say it doesn't hurt to study something about hearing science and psychoacoustics too. Music appreciation can fuel your enthusiasm. &lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-10-11T14:58:18.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26368" PostTypeId="2" ParentId="26366" CreationDate="2015-10-11T16:38:44.053" Score="6" Body="&lt;p&gt;I will show how to calculate the SNR for the case of $N=2$ measurements; it is easy to extend the result to general $N$. Assume a signal $s(t)$ has power $S$, and the noise $n(t)$ has variance $\sigma^2$ and zero mean. Then, the signal $s(t)+n(t)$ has SNR equal to $S/\sigma^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assume you observe $s(t)$ twice, each time with different, uncorrelated noise, $n_1(t)$ and $n_2(t)$, each with zero mean and variance $\sigma^2$. You average the two observations to get $$\frac{2s(t)+n_1(t)+n_2(t)}2 = s(t)+\frac{n_1(t)}2+\frac{n_2(t)}2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The variance of both $n_1(t)/2$ and $n_2(t)/2$ is $\sigma^2/4$, so the total noise variance is $\sigma^2/2$ and the SNR is $2S/\sigma^2$, for an improvement of 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason I don't understand, the wikipedia page on signal averaging defines the SNR as $S/\sigma$. Under that definition, the improvement will indeed be $\sqrt{N}$.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-10-11T21:07:14.547" LastActivityDate="2015-10-11T21:07:14.547" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="26369" PostTypeId="2" ParentId="26359" CreationDate="2015-10-11T17:03:15.930" Score="4" Body="&lt;p&gt;There's a nice &lt;a href=&quot;http://www.signalprocessingsociety.org/about-sps/society-history/&quot; rel=&quot;nofollow&quot;&gt;historical account&lt;/a&gt; given by the IEEE Signal Processing Society, that references 1948 as the year the field began. I'm not sure if that's necessarily accepted as &quot;official&quot; by other sources, but their reasoning is pretty convincing (at least as a ballpark):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The year 1948 may be regarded as the &lt;em&gt;annus mirabilis&lt;/em&gt; in the emergence&#xA;  of the discipline of signal processing. For in that year Claude&#xA;  Shannon published the epoch-making &quot;A mathematical theory of&#xA;  communication&quot;; Bernard Oliver, John Pierce, and Claude Shannon&#xA;  published the classic argument for the use of pulse-code modulation;&#xA;  modern digital methods of spectrum estimation were introduced;&#xA;  error-correcting codes were introduced; audio engineering achieved a&#xA;  new prominence; and the IEEE Signal Processing Society, albeit under a&#xA;  different name, was established.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That quote is from the beginning of the second chapter, &lt;em&gt;Annus Mirabilis: 1948&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2015-10-11T17:03:15.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26370" PostTypeId="1" CreationDate="2015-10-11T17:45:30.973" Score="-1" ViewCount="403" Body="&lt;p&gt;Is there an algo that uses fft to compute the frequency response of an FIR?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I follow the textbook method of evaluating the $z$ transform at $e^{-j\omega}$ for $\omega$ running from $0$ to $\pi$, but this is a numerically intense process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If such a method does exist, can it also be used to compute the gradient of the frequency response? (for use in cost functions)&lt;/p&gt;&#xA;" OwnerUserId="17750" LastEditorUserId="80" LastEditDate="2015-10-11T20:31:02.543" LastActivityDate="2015-10-14T11:15:02.663" Title="Use of FFT to compute frequency response" Tags="|fft|filters|dft|" AnswerCount="1" CommentCount="3" ClosedDate="2015-10-14T11:45:35.120" ContentLicense="CC BY-SA 3.0" />
  <row Id="26371" PostTypeId="1" CreationDate="2015-10-11T22:56:19.097" Score="0" ViewCount="241" Body="&lt;p&gt;How can I remove the lowest n frequencies of an image? Are the lower frequencies around the centre of the FFT result?   &lt;/p&gt;&#xA;" OwnerUserId="17752" LastActivityDate="2015-10-11T22:56:19.097" Title="Image processing: High pass filter to remove lowest 16 frequencies" Tags="|image-processing|fft|filters|fourier-transform|python|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26372" PostTypeId="1" AcceptedAnswerId="26400" CreationDate="2015-10-12T02:52:36.807" Score="1" ViewCount="1229" Body="&lt;p&gt;I'm trying to use the FFT to plot the phase spectrum of the DTFT of a sampled rect impulse function.&#xA;Here's the Matlab code I've written.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=10; % sampling frequency Hz&#xA;Ts=1/fs;&#xA;T=4; % length of time vector in seconds&#xA;t=-T/2:Ts:T/2-Ts; %vector of 40 time samples -2:0.1:1.9&#xA;y=rectpuls(t); %unit length rect impulse&#xA;z=fft(y,10000).*Ts; &#xA;%fft multiplied by Ts to get rid of the 1/Ts factor in the spectral replicas&#xA;%of the DTFT of the signal&#xA;f=linspace(0, (length(z)-1)/length(z),length(z));&#xA;figure&#xA;plot(f,abs(z));&#xA;grid on&#xA;&#xA;%plot of the phase of z as it is, so with the time sequence&#xA;%considered to be shifted by length(y)/2 samples by fft.&#xA;figure&#xA;plot(f,unwrap(angle(z)),'r');&#xA;grid on&#xA;&#xA;%I try to get rid of the linear phase delay component to get the phase&#xA;%spectrum of the DTFT of the signal in its frequency period.&#xA;%I divide each fft sample by its own exponential delay factor.&#xA;delay=length(y)/(2*length(z));&#xA;expd=zeros(1,length(z));&#xA;for index=1:1:length(z)&#xA;expd(index)=exp(-1i*2*pi*(index-1)*delay);&#xA;end&#xA;z2=z./expd;&#xA;figure&#xA;plot(f,unwrap(angle(z2))./pi,'r');&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jR72a.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jR72a.jpg&quot; alt=&quot;Phase spectrum of non time delayed sequence&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the problem is that this phase plot is wrong, the DTFT is the sum of real sinc functions so its phase spectrum con only assume k*pi values.&#xA;There's still a linear component in the phase plot and the slope is positive so the exponentials that I'm using are over compensanting the delay.&#xA;I have found out that the problem is that the fft function introduces a linear phase delay as if the sequence was shifted by 19.5 samples instead of 20 samples as it should be in my example.&#xA;Infact if I set in my code delay=19.5/10000 I get the correct phase plot (or at least one that makes sense :D):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rN9rd.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rN9rd.jpg&quot; alt=&quot;Supposedly correct phase plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's going on here, is it a precision problem?&#xA;Are there mistakes in my Matlab code and/or my dsp theory formulas?&#xA;Thank you!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I can't link more than two images in the post :/&lt;/p&gt;&#xA;" OwnerUserId="17754" LastEditorUserId="17754" LastEditDate="2015-10-12T03:04:08.677" LastActivityDate="2015-10-14T01:40:25.807" Title="Phase spectrum of the DTFT of a rect pulse using FFT" Tags="|discrete-signals|frequency-spectrum|phase|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26373" PostTypeId="1" CreationDate="2015-10-12T05:41:36.607" Score="1" ViewCount="7267" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Depth_map&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Depth_map&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Range_imaging&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Range_imaging&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me, it sounds like they are the same thing, except depth map implies only having the z coordinate info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then again, if you have a range image vs depth image, is this something one can tell the difference by examining the data or is the term mostly contextual?&lt;/p&gt;&#xA;" OwnerUserId="17757" LastActivityDate="2022-05-18T15:00:45.130" Title="What is the difference between a range image and a depth map?" Tags="|computer-vision|stereo-vision|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26374" PostTypeId="2" ParentId="26362" CreationDate="2015-10-12T06:16:52.550" Score="3" Body="&lt;p&gt;Congratulations! Sounds like you are about to reinvent the &lt;a href=&quot;https://en.wikipedia.org/wiki/Multitaper&quot; rel=&quot;nofollow noreferrer&quot;&gt;multitaper method&lt;/a&gt;, in which a number of orthogonal window functions are used to get independent spectral estimates that are then averaged (with weights). A suitable window function family are the Slepian sequences:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/i3PZv.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i3PZv.jpg&quot; alt=&quot;Slepian window functions&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-10-12T06:16:52.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26375" PostTypeId="1" CreationDate="2015-10-12T07:07:52.417" Score="0" ViewCount="7034" Body="&lt;p&gt;I feel problem in understanding the proof of Fourier series properties  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Time scaling&lt;/strong&gt;&lt;br&gt;&#xA;\begin{align}&#xA;b_k &amp;amp;= \frac{1}{T}\int_{T}x(t)e^{jk\omega_0t}dt\\&#xA;&amp;amp; = \frac{a}{T}\int_{T/a}x(at)e^{jk(\omega_0a)t}dt\tag{$\scriptstyle{a - \text{scaling factor}}$}\\&#xA;&amp;amp; = \frac{a}{T}\int_{T}x(L)e^{jk\omega_0L}\frac{dL}{a}\tag{$\scriptstyle{L=at}$}\\&#xA;&amp;amp;= \frac{1}{T}\int_{T}x(L)e^{jk\omega_0L}dL = a_k\\&#xA;\end{align}&#xA;For this I want to ask that how $T/a$ term in the integral changes to $T$, and $dt$ changes to $dL/a$?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multiplication&lt;/strong&gt;&#xA;\begin{align}&#xA;x(t)y(t)&amp;amp;= \sum^{+\infty}_{k\ =\ -\infty} a_k  e^{jk\omega_0t}\sum^{+\infty}_{k\ =\ -\infty} b_k  e^{jl\omega_0t}\\ &amp;amp;=\sum^{+\infty}_{k\ =\ -\infty} \sum^{+\infty}_{l\ =\ -\infty} a_k b_le^{j(k+l)\omega_0t}\\&#xA;&amp;amp;=\sum^{+\infty}_{m\ =\ -\infty} \left[\sum^{+\infty}_{l\ =\ -\infty} a_{m-l} b_l\right]e^{jm\omega_0t}\tag{$\scriptstyle{m=k+l}$}&#xA;\end{align}&#xA;I couldn't understand this last step, why the summation changes from $k$ to only  $m$? Shouldn't it be $m-l$ and also is it done here to prove the multiplication property? or there are more steps?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="1629" LastEditDate="2016-08-26T09:32:43.653" LastActivityDate="2016-08-26T13:39:54.533" Title="Proof of properties of Fourier series in CT" Tags="|continuous-signals|fourier-series|proof|" AnswerCount="1" CommentCount="11" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26376" PostTypeId="2" ParentId="26232" CreationDate="2015-10-12T09:07:44.493" Score="1" Body="&lt;p&gt;Here is one idea:&#xA;Merge the HDR images per-pixel using known thresholds for saturation etc. The final image will have &lt;code&gt;pixel&lt;/code&gt; values above 256. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply a CLAHE (Contrast Limited Adaptive Histogram Equalization, its in OpenCV) to get the final image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often just doing the later will make your images look good.&lt;/p&gt;&#xA;" OwnerUserId="941" LastActivityDate="2015-10-12T09:07:44.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26377" PostTypeId="1" CreationDate="2015-10-12T09:26:08.147" Score="2" ViewCount="436" Body="&lt;p&gt;In order to make a signal positive-only, I have the choice between taking the absolute value and multiplying the signal by itself (i.e. taking the signal to the power of two). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, multiplying the signal by itself requires more circuitry (a multiplier) and the result has a larger dynamic range. Are there other aspects that I need to consider when chosing between the two methods?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: the application is to detect negative and/or positive signal peaks just above the noise level.&lt;/p&gt;&#xA;" OwnerUserId="3980" LastEditorUserId="13320" LastEditDate="2016-11-21T12:39:03.143" LastActivityDate="2016-11-21T12:39:03.143" Title="Absolute value vs. power (to make a signal positive-only)" Tags="|peak-detection|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26378" PostTypeId="2" ParentId="26232" CreationDate="2015-10-12T10:35:23.197" Score="0" Body="&lt;p&gt;The effect is similar to having a gain which is different in the top-left quarter, and you need to somehow smoothen the discontinuity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can estimate the relative gain on both sides of the discontinuity by measuring the average luminance in small regions facing each other. [Where luminance values are saturated (&gt;255), you can't measure the relative gain, ignore those areas.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you probably want to keep parts of the image far from the discontinuity to look like they do now, meaning with a unit gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to define the gain correction, you can consider a smooth function that equals one in the top-left corner and interpolates the measured function √G along the discontinuity. This looks like a diffusion equation problem. √G is chosen to distribute the discontinuity equally on both sides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the rest of the image, the gain correction will be 1/√G along the discontinuity and tend to 1 elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, the gain correction field will look like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XopEu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XopEu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-10-12T10:40:25.360" LastActivityDate="2015-10-12T10:40:25.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26379" PostTypeId="1" AcceptedAnswerId="26386" CreationDate="2015-10-12T11:40:49.580" Score="1" ViewCount="564" Body="&lt;p&gt;Say we have a function of time ($S(t)$) of the length $T$, and then a customized impulse response (say $I(t)$) of the length $T+N$. The question is, when $S(t)$ is convolved with $I(t$), what are the possible frequency domain (or alternately time domain) representation of all of the possible resulting functions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the case when the convolution is performed circularly, the solution appears immediately clear. If $S(t)$ has zero magnitude components in the frequency domain, they will stay zero no matter how the impulse response is configured. Thus, it's impossible to for example, convert a sinusoidal waveform into any non-sinusoidal waveform using circular convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the result is a lot less clear for the case when linear convolution is performed. If we limit our horizon to the period of $T$, and completely disregard the tail that the impulse response will generate (for cases where $T&amp;gt;1$, and length of the impulse response $ &amp;gt; 1$ ), what will the answer be then? Are there any limits, or can you transform any function into any other function (provided the tail is thrown away), using linear convolution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(EDIT: for non-casual impulse responses the &quot;pre-echo&quot; is also thrown away, time shifting is allowed also for such cases).&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="80" LastEditDate="2015-10-12T12:16:35.917" LastActivityDate="2015-10-13T10:54:48.613" Title="Limits of convolution" Tags="|convolution|frequency-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26380" PostTypeId="1" AcceptedAnswerId="26381" CreationDate="2015-10-12T14:45:20.357" Score="0" ViewCount="4519" Body="&lt;p&gt;&lt;strong&gt;QUESTION&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compute the Z-transform of $y[n] = x[n] + 2x[n-1]$. and find the poles and zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just bombed an interview where I couldn't do this (because I have no grounding in fundamentals and have worked all from cookbooks). I'm not too bummed because I would have been working at something I wasn't prepared for. You get one guess who would ask this kind of question in a first phone interview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ANSWER (30 minutes post interview):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n-1] = z^{-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$1 + 2z^{-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the z-transform of an FIR is the coefficients of the impulse response multiplied by the delays.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-10-12T15:07:50.463" LastActivityDate="2015-10-12T15:12:40.853" Title="Z-transform of an FIR filter" Tags="|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26381" PostTypeId="2" ParentId="26380" CreationDate="2015-10-12T15:12:40.853" Score="3" Body="&lt;p&gt;If you know (or better: understand) the basic $\mathcal{Z}$-transform relation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n-k]\Longleftrightarrow z^{-k}X(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then from the given time domain equation you immediately get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=X(z)+2X(z)z^{-1}=X(z)(1+2z^{-1})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the transfer function $H(z)$ is the ratio of $Y(z)$ and $X(z)$, you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=1+2z^{-1}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-12T15:12:40.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26383" PostTypeId="1" AcceptedAnswerId="26387" CreationDate="2015-10-12T18:17:10.947" Score="0" ViewCount="184" Body="&lt;p&gt;edit: clarifying question. ...&lt;/p&gt;&#xA;" OwnerUserId="17764" LastEditorUserId="17764" LastEditDate="2015-10-13T05:10:09.713" LastActivityDate="2015-10-13T05:10:09.713" Title="Fourier Transform of image convoluting with kernel" Tags="|fft|transform|fourier|" AnswerCount="1" CommentCount="0" ClosedDate="2015-10-13T13:40:40.047" ContentLicense="CC BY-SA 3.0" />
  <row Id="26384" PostTypeId="2" ParentId="26206" CreationDate="2015-10-12T18:21:08.830" Score="1" Body="&lt;p&gt;This may be caused by &quot;border effects&quot; related to subsampling and signal length with perfect reconstruction filter banks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 2-band wavelets, there are standard  non-expansive solutions (for instance with periodic border extension) when $2^N$ divides the length $L$ of your signal. In your case, one or two levels work without length increase, becauses $20=20/2+20/2 = (10/2+10/2)+10$. Then, starting at level $3$, you cannot divide $5$ into equal parts, since $2^3 = 8$ does not divide 20.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It signifies that you have decomposed too deep to keep the number of samples constant.&lt;/li&gt;&#xA;&lt;li&gt;The increase happens because of your signal length, your decomposition  level and your border extention.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For some applications (outside compression) this is not really an issue.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-06-09T14:18:24.573" LastActivityDate="2016-06-09T14:18:24.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26386" PostTypeId="2" ParentId="26379" CreationDate="2015-10-12T19:40:50.863" Score="0" Body="&lt;p&gt;If the function is zero-valued throughout then so will be the output. But if you exclude this trivial homogeneous case, then your question can be reformulated as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given any function $f$ of compact support and any list $l$ of frequency domain zeros, does a function $g$ always exist that equals $f$ within the support of $f$ and has a Fourier transform that has the zeros given in $l$, with other zeros allowed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting at $g_0 = f$, it would be enough to demonstrate a procedure $p$ such that $g_{i+1} = p(g_i, l_i)$ that adds a single given frequency domain zero $l_i$ to function $g_i$ without modifying it within or to the left of the support of $f$ and without altering the existing frequency domain zeros. We choose a causal filter as that procedure. The procedure being a filter guarantees that existing frequency domain zeros are preserved. To not change the function within or to the left of the support of $f$, the filter must have an impulse response that has a Dirac delta function followed by a zero-valued segment of the same length as the support of $f$. A comb filter consisting of two Dirac delta functions, the second one inverted and located after the zero-valued segment, matches this description. The comb filter can be made to have a zero at any wanted frequency by placing the inverted Dirac delta to an integer multiple of the period of that frequency. Choosing a large enough multiplier moves the inverted Dirac delta to outside the zero-valued segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the functions are discretely sampled sequences rather than functions of a real argument, a Dirac delta function that lands between the sample points gives a sampled sinc function that has no compact support. To circumvent this problem, instead of a sinc impulse, a fractional, unity gain delay at any given frequency can be created by setting to certain values the two samples surrounding a multiple of the period of that frequency. The delay and gain at other frequencies will be off but this matters not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So (unless I missed something), the answer to your question is: No, there are no limitations if the (allowed to be long enough) tail is thrown away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that successive application of the above procedure does not generate the impulse response of your original question but an output (one of many possible) that enables a realizable impulse response.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-13T10:54:48.613" LastActivityDate="2015-10-13T10:54:48.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26387" PostTypeId="2" ParentId="26383" CreationDate="2015-10-12T20:44:05.427" Score="1" Body="&lt;p&gt;The function&#xA;$$&#xA;\frac{\sin(x)}{x}&#xA;$$&#xA;has a well-known Fourier transform:&#xA;$$&#xA;\int_{-\infty}^{\infty}  \: \frac{\sin{x}}{x} e^{-j 2 \pi f x} dx = \begin{cases} \pi &amp;amp; |f| &amp;lt; \frac{1}{2 \pi} \\ 0 &amp;amp; |f| &amp;gt; \frac{1}{2 \pi} \\ \end{cases} &#xA;$$&#xA;which is &lt;a href=&quot;https://math.stackexchange.com/a/281957/5965&quot;&gt;derived here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{\sin(x)\sin(y)}{xy}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is a simple separable two dimensional version of it. The 2D Fourier transform will just be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}  \: \frac{\sin{x}}{x} \frac{\sin{y}}{y} e^{-j 2 \pi f_1 x} e^{-j 2 \pi f_2 y} dx dy = &#xA;\int_{-\infty}^{\infty} \: \frac{\sin{x}}{x} e^{-j 2 \pi f_1 x}  dx \int_{-\infty}^{\infty}  \:\frac{\sin{y}}{y} e^{-j 2 \pi f_2 y}  dy =\begin{cases} \pi &amp;amp; |f_1| \mbox{ and } |f_2|  &amp;lt; \frac{1}{2 \pi} \\ 0 &amp;amp; |f_1| \mbox{ or }  |f_2| &amp;gt; \frac{1}{2 \pi} \\ \end{cases} &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Below is a plot that takes a random image with a white square in the middle (top left), FFTs it, multiplies the FFT by a brick filter (top right), inverse FFTs it and plots the result (bottom right).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/13G0k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/13G0k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 26383&#xA;&#xA;img &amp;lt;- runif(128*128, 0, 1)&#xA;dim(img) &amp;lt;- c(128, 128)&#xA;&#xA;img[32:96,32:96] &amp;lt;- 1&#xA;&#xA;N &amp;lt;- 50&#xA;&#xA;imgFFT &amp;lt;- fft(img)&#xA;imgFFT[N:(128-N+2),] &amp;lt;- 0.0000000000000&#xA;imgFFT[,N:(128-N+2)] &amp;lt;- 0.0000000000000&#xA;img2 &amp;lt;- fft(imgFFT, inverse = TRUE) / 128 / 128&#xA;&#xA;img2[Mod(img2) &amp;gt; 1] &amp;lt;- 1&#xA;&#xA;mx &amp;lt;- max(log(Mod(imgFFT + 0.00001)))&#xA;mn &amp;lt;- min(log(Mod(imgFFT + 0.00001)))&#xA;&#xA;scaled_log_imgFFT &amp;lt;- (log(Mod(imgFFT + 0.00001)) - mn)/(mx - mn)&#xA;&#xA;par(pty=&quot;s&quot;) # make the plit square&#xA;plot(0:256, type='n')&#xA;rasterImage(as.raster(img),0,128,128,256)&#xA;rasterImage(as.raster(scaled_log_imgFFT),128,128,256,256)&#xA;rasterImage(as.raster(Mod(img2)),128,0,256,128)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-10-12T22:19:36.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26388" PostTypeId="2" ParentId="26360" CreationDate="2015-10-12T20:50:52.580" Score="1" Body="&lt;p&gt;I usually train on those positive labels and find the minimum threshold that accepts it as positive and then consider every sample less than this threshold as negative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method should work only if your data is big enough.&lt;/p&gt;&#xA;" OwnerUserId="15118" LastEditorUserId="80" LastEditDate="2015-10-12T21:08:35.190" LastActivityDate="2015-10-12T21:08:35.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26390" PostTypeId="1" CreationDate="2015-10-12T22:55:48.277" Score="0" ViewCount="246" Body="&lt;p&gt;I have a sinusoidal signal which has  a period of 2 and I want to find the frequencies that are present.I assumed sampling interval as 0.01 and based on this I sampled the signal.The Nyquist frequency i got from this is suppose 'x'.Now if I change my sampling interval to 0.001, Nyquist frequency in this case is '10*x'&#xA;So my question is,which frequency spectrum will represent the signal correctly, the one with Nyquist frequency 'x' or the one one with Nyquist frequency '10*x'&lt;/p&gt;&#xA;" OwnerUserId="17698" LastEditorUserId="13320" LastEditDate="2016-11-13T12:55:43.007" LastActivityDate="2016-12-13T21:07:45.913" Title="How could one can say that frequency spectrum having Nyquist frequency 'x' is the most appropriate representation of a given signal?" Tags="|discrete-signals|signal-analysis|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26391" PostTypeId="2" ParentId="26390" CreationDate="2015-10-12T23:14:52.080" Score="1" Body="&lt;p&gt;The most important thing is to sample at more than twice your signal's &lt;em&gt;bandwidth&lt;/em&gt;; the period is largely irrelevant. Say your signal with period 2 is a square wave -- its bandwidth is infinite and you'll never be able to sample it correctly (at least in theory). If your signal is a sine wave, then a period of 2 means its bandwidth is 0.5 and you'll easily sample it adequately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, whenever possible, I'd sample:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a bit above Nyquist (say, at $2.2B$, where $B$ is the signal bandwidth), to maximize the number of useful frequency bins, and&lt;/li&gt;&#xA;&lt;li&gt;for as long as possible, to increase the spectral resolution.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-12T23:14:52.080" CommentCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="26393" PostTypeId="2" ParentId="25781" CreationDate="2015-10-13T00:24:20.967" Score="0" Body="&lt;p&gt;There are a lot of applicable solutions. The simplest one in my mind is 'template matching'. All you need for this solution are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Manually create one template / several templates. This requires you to segment a number of ringing signal. If you have multiple of them, you may take the average of these signals. Anyway, let us say this template signal is $T=[T_0,T_1,\cdots,T_K]$.&lt;/li&gt;&#xA;&lt;li&gt;For a given testing signal $S=[S_0,S_1,\cdots,S_N]$, you can compute $R=S\star T'$, which is the convolution between this signal and your template, and $T'=[T_K,\cdots,T_1,T_0]$ is the reversed version of $T$. &lt;/li&gt;&#xA;&lt;li&gt;Select a reasonable threshold to decide a segment of single is indeed `ringing', and finally apply non-maximum suppression. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note, this is just one way of doing template matching w.r.t. the cross-correlation (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Cross-correlation&lt;/a&gt;). You can definitely use other criteria, e.g. normalized cross-correlation (see &lt;a href=&quot;http://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=matchtemplate#matchtemplate&quot; rel=&quot;nofollow&quot;&gt;http://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=matchtemplate#matchtemplate&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more complicated solution could be a 'ring' classifier, which assumes you have a number of 'ring' samples, and all of them are of the same length. Once you have these training samples, you can train a classifier (any kind, ranging from simple logistic regression to more complicated  deep neuron network classifier). However, this solution may require a lot of labeled data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, a better solution could be 'hidden Markov model' and 'recurrent deep neuron network', which are too complicated to discussed in several lines. I say this is a better solution, because these are general models that can handle much more complicate scenario in speech recognition: in the context of speech recognition, 'ring' is nothing but a 'machine word', which is not fundamentally different a 'English word'. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2015-10-13T00:24:20.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26394" PostTypeId="2" ParentId="26358" CreationDate="2015-10-13T02:13:04.263" Score="1" Body="&lt;p&gt;There are a few answers to a similar question over on &lt;a href=&quot;https://stats.stackexchange.com/a/51085/161&quot;&gt;Cross Validated.SE&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One suggested answer is to use Hartigan's dip test. &lt;a href=&quot;http://www.r-bloggers.com/fitting-mixture-distributions-with-the-r-package-mixtools/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Another is to use the &lt;code&gt;mixtools&lt;/code&gt; package.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've simulated some example data in &lt;strong&gt;R&lt;/strong&gt; and used &lt;a href=&quot;https://cran.r-project.org/web/packages/diptest/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;diptest&lt;/code&gt; package&lt;/a&gt; and the &lt;code&gt;mixtools&lt;/code&gt; package.  The diagram below shows the raw data in the top to graphs, and the estimated underlying distributions according to &lt;code&gt;mixtools&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/smFeI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/smFeI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;diptest&lt;/code&gt; results are:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;data:  one_mode&#xA;  D = 0.0219, p-value = 0.9915&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;data:  two_mode&#xA;  D = 0.0628, p-value = 0.004434&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So &lt;code&gt;diptest&lt;/code&gt; is saying the first (unimodal) data set has a 99.15% chance of being unimodal and the second (bimodal) data set has a 0.44% chance of being unimodal.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&#xA;    # Q26358&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;one_mode &amp;lt;- rnorm(100, 0, 1)&#xA;two_mode &amp;lt;- c(rnorm(50, -2, 1), rnorm(50, +2, 1))&#xA;&#xA;plot(1:100,one_mode,pch=16, col=&quot;green&quot;)&#xA;lines(1:100,two_mode, pch=16, col=&quot;red&quot;)&#xA;&#xA;library(mixtools)&#xA;&#xA;par(mfrow=c(2,2))&#xA;plot(1:100,one_mode,pch=16, col=&quot;green&quot;)&#xA;plot(1:100,two_mode, pch=16, col=&quot;red&quot;)&#xA;&#xA;&#xA;mixmdl = normalmixEM(one_mode)&#xA;plot(mixmdl,which=2)&#xA;lines(density(one_mode), lty=2, lwd=2)&#xA;&#xA;mixmdl_two = normalmixEM(two_mode)&#xA;plot(mixmdl_two,which=2)&#xA;lines(density(two_mode), lty=2, lwd=2)&#xA;&#xA;library(diptest)&#xA;dip.test(one_mode)&#xA;dip.test(two_mode)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2015-10-13T02:13:04.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26395" PostTypeId="1" CreationDate="2015-10-13T03:25:00.557" Score="1" ViewCount="484" Body="&lt;p&gt;Does the signal reconstruction error in compressed sensing using $l_1$ norm minimization depends on the amplitude of non-zero coefficients and their location ?&lt;/p&gt;&#xA;" OwnerUserId="17587" LastActivityDate="2016-10-04T11:27:48.473" Title="signal reconstruction error in compressed sensing" Tags="|compressive-sensing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26396" PostTypeId="1" AcceptedAnswerId="26398" CreationDate="2015-10-13T08:07:45.510" Score="4" ViewCount="20087" Body="&lt;p&gt;I have a signal in MATLAB&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = randn(1,1e6);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;that is normalized in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = s/sqrt(sum(abs(s .^2)) / 1e6);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would be thankful if anyone could explain me why is the signal normalized in this way!&lt;/p&gt;&#xA;" OwnerUserId="17633" LastEditorUserId="80" LastEditDate="2016-11-21T08:42:28.687" LastActivityDate="2016-11-21T08:42:28.687" Title="Normalization of a signal in MATLAB" Tags="|normalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26397" PostTypeId="1" CreationDate="2015-10-13T08:16:59.373" Score="1" ViewCount="266" Body="&lt;p&gt;Although,this question may not be very much related to the topic of discussion, but i just wanted to know how much of DSP (digital signal processing) is used in VLSI. Like in the industry or for the sake of knowledge, which all topics share common between the two Domains?&#xA;PS:I know this may be off topic, but still thought that I could get answers from knowledegeable people on this platform.  &lt;/p&gt;&#xA;" OwnerUserId="16360" LastEditorUserId="13320" LastEditDate="2016-11-13T13:21:44.963" LastActivityDate="2016-11-13T13:21:44.963" Title="how much of DSP (digital signal processing) is related VLSI?" Tags="|dsp-core|digital|hardware-implementation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26398" PostTypeId="2" ParentId="26396" CreationDate="2015-10-13T08:18:41.490" Score="5" Body="&lt;p&gt;Assuming that $N$ is the length of your signal $s$, the normalized signal $s_n$ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_n = \dfrac{s}{\sqrt{\dfrac{\sum_{i=1}^{N}\left|s_i^2\right|}{N}}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The denominator is nothing else than &lt;a href=&quot;https://en.wikipedia.org/wiki/Root_mean_square&quot; rel=&quot;noreferrer&quot;&gt;Root Mean Square&lt;/a&gt; value of your signal. Thus the code is doing a simple RMS normalization. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of it as a method of normalizing the average of your signal and still allowing for some peaks to clip it (instead of being set to 1). In other words the standard division by the maximum absolute value of your signal will always guarantee that the sample values will be within the range of $[-1;1]$, whereas RMS normalization doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method is widely used for audio processing and speech processing. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-10-13T08:18:41.490" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26399" PostTypeId="1" CreationDate="2015-10-13T08:57:35.613" Score="0" ViewCount="323" Body="&lt;p&gt;I am looking for an efficient head pose estimation algorithm from facial features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I already have: I already have implemented the code for stable facial landmarks(68 landmarks on the face).&#xA;I also have the intrinsic camera parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The task is to efficiently determine the head pose from webcam video i.e,&#xA;(roll, yaw and pitch).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which are the viable algorithms for the purpose? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on python by the way, any working code for the same would be welcome.&lt;/p&gt;&#xA;" OwnerUserId="16735" LastActivityDate="2015-10-13T08:57:35.613" Title="Head pose estimation" Tags="|image-processing|python|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26400" PostTypeId="2" ParentId="26372" CreationDate="2015-10-13T09:27:19.940" Score="1" Body="&lt;p&gt;In order for the result of an even number N length FFT to be strictly real, the input vector data vector has to be exactly symmetric around sample N/2, which is the sample point before t=0, given your sample window, which is offset slightly to the left.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-10-13T09:27:19.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26403" PostTypeId="1" CreationDate="2015-10-13T13:10:16.340" Score="3" ViewCount="4871" Body="&lt;p&gt;I am simulating a QPSK modulation in GNU radio. Here is the flowgraph:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CQunc.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CQunc.jpg&quot; alt=&quot;flowgraph&quot;&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source is a binary stream coming from the Random Source block. There are 4 PSK Mod blocks configured identically (4 constellation points - a QPSK modulation, Grey coding and Differential encoding turned on, excess bandwidth set to 0,35). The modulators differ in the parameter samples/symbol (sps), which is set to 2, 4, 8, and 16. The constellation sinks are configured identically. What is expected to be shown on the constellation diagram is a plot with 4 constellation points that could be the tips of a square or 4 clusters of points that are concentrated around those 4 points as a certain amount of noise or imperfection of the system is added. Instead, we have the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Constellation diagram when sps is set to 16:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rjMGX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rjMGX.jpg&quot; alt=&quot;constellation diagram when sps is 16&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Constellation diagrams for sps 2, 4 and 8 look the same but with less points on the sides of the rhombus and less points around tips of the rhombus that look like the extensions of the rhombus sides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is why constellation diagrams look like this - why additional points are added and there are more and more of them as we increase the samples per symbol parameter so the diagram with sps 16 looks more like a rhombus than a 4 clusters of points? Why significant number of points appear around 4 tips of the rhombus looking like extensions of rhombus sides?&lt;/p&gt;&#xA;" OwnerUserId="17770" LastEditorUserId="13320" LastEditDate="2016-04-08T14:55:30.410" LastActivityDate="2016-04-08T14:55:30.410" Title="GNU Radio - PSK Mod block - unexpected constellation diagram" Tags="|modulation|qpsk|gnuradio|constellation-diagram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26404" PostTypeId="2" ParentId="26403" CreationDate="2015-10-13T14:18:28.790" Score="3" Body="&lt;p&gt;What you are seeing is the transitions from one constellation point to another.  In order to reduce the signal bandwidth, the baseband signal is low-pass filtered.  This causes the transitions to not be instantaneous (i.e. the I and Q are not square waves), so they take some time.  You are simply seeing those transitions.  The low-pass filtering also causes the overshoot that you see at the constellation points.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Just to see, I tried putting this into R. This is not going to get quite the same result because I am not sure of the parameters GNURadio uses, but it illustrates Jim's point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you increase the samples per symbol, the number of &quot;transition&quot; samples increases, making the edges of the constellation clearer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y3v1a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y3v1a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="80" LastEditDate="2015-10-13T16:28:06.133" LastActivityDate="2015-10-13T16:28:06.133" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26405" PostTypeId="1" CreationDate="2015-10-13T14:47:52.350" Score="4" ViewCount="2042" Body="&lt;p&gt;I have a problem with phase measuring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm acquiring two signal with a USRP (complex signals) with a coherent  generator and I want to measure the phase different between them.. One is at 150Mhz and the other one at 400MHz. When I plot the signals I see they are 150Mhz + 8Hz and 400Mhz + 50 hz, because of the way the daugtherboard works not tunning the correct frequency, which is the error I'm trying to measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like these are two different frequencies I have take them to same frequency so I multiply by 8 and by 3 to measure the phase at 1.2GHz. Also, like these are different frequencies, I expect the phase to be a rect line with a slope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm doing it by two ways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First way is to get the DFT and extract the phase of the bin with the maximum power and plot it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;2\pi t(f_1+\Delta f_1) + \phi_1= \mbox{phase}(\text{150MHz})&#xA;$$&#xA;$$&#xA;2\pi t(f_2+\Delta f_2) + \phi_2 = \mbox{phase}(400\text{MHz})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as $$ 8f_1 = 3f_2 $$the phase difference should be $$ \mbox{unwrap}(2\pi (8\Delta f_1 - 3\Delta f_2) t + 8\phi_1-3\phi_2) $$ So it should be $$(540.08 t + \phi_1-\phi_2)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way gives me this plot. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(time,phase)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F6rMG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F6rMG.png&quot; alt=&quot;Phase difference with DFT phase&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second way is I get the DFT, identify the maximum power bin and I set all the others bins to zero, then I get the IDFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ifft gives me the two complex signals $$ x=e^{(2\pi t(f_1+\Delta f_1)+\phi_1)j} $$ and $$ y=e^{(2\pi t(f_2+\Delta f_2)+\phi_2)j} $$ then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mbox{unwrap}(\mbox{angle}(x^8/y^3))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way gives me this plot. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(time,phase)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XZYub.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XZYub.png&quot; alt=&quot;Phase difference with IDFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is that I get two really different results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So which method is correct and why? The second way seems more accurate but why the expected values are so different?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--Edit--&#xA;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i in range(0,(nsfft)): &#xA;    #nsfft contains the numbers of fft availables (17)&#xA;    #nfft contains the number of point for fft (8192)&#xA;    #noffset = nfft&#xA;    #_fft400,_fft150,P400,P150,_ifft150,_ifft400 are 2d array&#xA;    ser = buf400[noffset*i:noffset*i+nfft] #reading data&#xA;    _fft400[i] = fftshift(fft(ser))/nfft #fourier of 400Mhz&#xA;    ser = buf150[noffset*i:noffset*i+nfft] #reading data&#xA;    _fft150[i] = fftshift(fft(ser))/nfft #fourier of 150MHz&#xA;    P400[i] = Px(_fft400[i]).real #power &#xA;    P150[i] = Px(_fft150[i]).real #power&#xA;&#xA;    #narrow filtering for second way&#xA;    _fft150[i,argmax(P150[i])+2:] = 0j &#xA;    _fft150[i,:argmax(P150[i])-2] = 0j&#xA;&#xA;    _fft400[i,argmax(P400[i])+2:] = 0j&#xA;    _fft400[i,:argmax(P400[i])-2] = 0j&#xA;    ######&#xA;&#xA;    _ifft400[i] = (ifft(ifftshift(_fft400[i]))) #IFFT for secondway &#xA;    _ifft150[i] = (ifft(ifftshift(_fft150[i]))) &#xA;&#xA;    phase400[i] = angle(_fft400[i][argmax(P400[i])])*3 #first way&#xA;    phase150[i] = angle(_fft150[i][argmax(P150[i])])*8 #first way&#xA;&#xA;phase_difference2 = zeros(nsfft*nfft)&#xA;for i in range(nsfft):&#xA;    phase_difference2[i*nfft:i*nfft+nfft] = angle((_ifft400[i] ** 3)/(_ifft150[i] ** 8))&#xA;&#xA;phase_difference = phase400 - phase150&#xA;phase_difference = unwrap(phase_difference)&#xA;&#xA;time = np.linspace(0,read_sec,nsfft)&#xA;time2 = arange(0,nsfft*nfft)/sample_f&#xA;&#xA;plt.plot(time,phase_difference)    &#xA;plt.plot(time2,unwrap(phase_difference2)) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also the data has been decimated from 400Ksps to 5Ksps&lt;/p&gt;&#xA;" OwnerUserId="17774" LastEditorUserId="17774" LastEditDate="2015-10-13T18:18:02.580" LastActivityDate="2017-04-09T20:50:39.353" Title="Phase measurement" Tags="|fft|dft|python|phase|ifft|" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26406" PostTypeId="1" CreationDate="2015-10-13T15:53:46.173" Score="2" ViewCount="10563" Body="&lt;p&gt;I read in a standard textbook that the Fourier transform of unit impulse function is calculated with the help of approximations and signum function as the integration of unit impulse does not converge. What's so special about signum function that it is used to calculate Fourier transform? I tried to find out an approximation as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\lim_{ a \rightarrow 0 }&#xA;\int_{-\infty}^{+\infty} e^{-at} u(t) e^{-j\omega t} dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am getting wrong result. Why is this so?&lt;/p&gt;&#xA;" OwnerUserId="5661" LastEditorUserId="80" LastEditDate="2015-10-13T16:09:03.000" LastActivityDate="2015-10-14T07:17:42.613" Title="Why is signum function used to calculate Fourier transform of unit step function" Tags="|fourier-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26407" PostTypeId="2" ParentId="26405" CreationDate="2015-10-13T18:02:12.450" Score="1" Body="&lt;p&gt;The phase of the maximum power FFT bin only makes sense for signals that are exactly integer periods periodic in the FFT length.  For any other frequencies, you first should do an FFT shift so that phase as a measure of oddness and eveness around the center of the FFT aperture is the same at all frequencies. Then one can interpolate phase at the frequency of the interpolated magnitude peak.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-10-13T18:02:12.450" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26409" PostTypeId="2" ParentId="26406" CreationDate="2015-10-13T20:59:24.353" Score="5" Body="&lt;p&gt;If somebody you trust told you that the Fourier transform of the sign function is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}\{\text{sgn}(t)\}=\frac{2}{j\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you could of course use this information to compute the Fourier transform of the unit step $u(t)$. Using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u(t)=\frac12(1+\text{sgn}(t))\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(as pointed out by Peter K. in a comment), you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}\{u(t)\}=\frac12\left(\mathcal{F}\{1\}+\mathcal{F}\{\text{sgn}(t)\}\right)=\pi\delta(\omega)+\frac{1}{j\omega}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you don't &lt;em&gt;need&lt;/em&gt; the sign function to compute the Fourier transform of the step function. As suggested in your question, using the function $e^{-at}u(t)$ and taking the limit $a\rightarrow 0^+$ will also result in the expression given in $(3)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see this as follows. The Fourier transform of $e^{-at}u(t)$, $a&amp;gt;0$, is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_0^{\infty}e^{-at}e^{-j\omega t}dt=\frac{1}{a+j\omega}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the limit $a\rightarrow 0^+$ appears to give $1/j\omega$, but this is only valid for $\omega\neq 0$. Splitting the result $(4)$ in its real and imaginary part gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{a+j\omega}=\frac{a}{a^2+\omega^2}+\frac{\omega}{j(a^2+\omega^2)}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real part of $(5)$ is known as ($\pi$ times) a &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_delta_function#Representations_of_the_delta_function&quot; rel=&quot;noreferrer&quot;&gt;nascent delta function&lt;/a&gt;. It has the same form as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_delta_function#Semigroups&quot; rel=&quot;noreferrer&quot;&gt;Poisson kernel&lt;/a&gt;, which in the limit becomes a Dirac delta impulse. So for $a\rightarrow 0^+$ the limit of $(5)$, and hence of $(4)$, is actually given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lim_{a\rightarrow 0^+}\frac{1}{a+j\omega}=\pi\delta(\omega)+\frac{1}{j\omega}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which equals the expression in $(3)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-10-14T07:17:42.613" LastActivityDate="2015-10-14T07:17:42.613" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26411" PostTypeId="1" AcceptedAnswerId="26415" CreationDate="2015-10-14T00:00:44.030" Score="2" ViewCount="1974" Body="&lt;p&gt;When talking about harmonic distortion, or more specifically waveshaping, we say the order of distortion, can be solved from the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x^n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where n is the order of distortion. To my knowledge the complete result of any waveshaping function can be had by summing all of the different orders of harmonic distortion, multiplied with an appropriate index $a_n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=1}^{\infty} a_nx^n = WaveshaperFunction$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware that by feeding the equation with $x=sin(\omega t)$, the highest frequency any $x^n$ can produce is $sin(n*\omega t) $. However, higher orders can still produce multiple different frequencies for a sinusoidal input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chebyshev polynomials addresses the issue, removing any other frequencies limiting the harmonic distortion to only $sin(n*\omega t)$, producing an orthogonal result. The polynomials are defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T_0(x) = 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T_1(x) = 2x-1$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T_{n+1}(x)=2xT_n-T_{n-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since the result of putting any $sin(\omega t)$ through the chebyshev waveshaper is a sine with a frequency multiple of N, it is easy to say that any harmonic signal with the original signal's phase (or inverted phase) can be produced by summing over all the chebyshev polynomials. That is to say, summing over all the polynomials, any waveshaping function can be generated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=1}^{\infty} b_nT_n(x) = WaveshaperFunction$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $b_n$ represents the amplitude of nth generated harmonic, given a sine input. $T_n$ represents the cheyshev polynomial producing nth harmonic given sine input. I think there could be many advantages for thinking about time-invariant harmonic distortion or intermodulation distortion through this framework rather than through the before-mentioned orders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the question, did I make a mistake somewhere? Particularly I am not so certain that any function can be generated through summing the chebyshev polynomials. Chebyshev polynomials seem to not care about the amplitude of the input sine wave (apart from some DC offset differences), yet I can easily generate a waveshaper function that dose so (any function that is linear near 0 and then changes). Re-framed, can the polynomials generate any possible function?&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="16605" LastEditDate="2015-10-14T06:01:25.547" LastActivityDate="2021-01-01T01:02:11.880" Title="Possibilties of chebyshev polynomial waveshaping" Tags="|non-linear|shape-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26412" PostTypeId="2" ParentId="26317" CreationDate="2015-10-14T01:30:17.773" Score="4" Body="&lt;p&gt;Well, I took a look at your code, and spent a lot of time on it, and I have discovered some mistakes, some practicals and some theoretics. Here are my answers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) You can use the function filter. Just remember that it returns a vector of the same length of the input, while conv returns the $ N_x + N_h - 1 $, where $ N_x $ is the length of your input and $ N_h $ is the length of your channel. This difference needs to be take in consideration when you create your noise vector. You won't be able to add the noise vector to your signal if you don't pay attention to this. Read the documentation to get more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) As I said, there is a lot of mistakes at your code:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First I changed the vector noise to only add a real number to the signal, and not a complex number.&lt;/li&gt;&#xA;&lt;li&gt;Second, I changed the equation &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;w = w - mu * e(i) * yy * x;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;w = w - mu * x * e(i) * yy.'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that I took from &lt;a href=&quot;http://ens.ewi.tudelft.nl/Education/courses/et4147/sheets/cma_leus.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is some mistakes in your CMA algorithm. Here are some lines and the coments:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;yy = w(:,i).'*x;&lt;/code&gt; Remeber to conjugate w in this. In BPSK we only have real numbers so this is not a problem, but if you had complex numbers, you must conjugate w.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;e(i) = abs(yy)^2 - 1;&lt;/code&gt; In your original code, you didn't use abs(y) to calculate the error. Again, it is not a problem if you are only working with real numbers, but it will become a problem with complex numbers.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The way that you are getting the vector x inside the CMA loop is not getting all the samples since the beginning. So I iniciated the vector x before the loop as:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x = zeros(Le, 1);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and inside the loop I used:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x = [r(i); x(1:end-1)];&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will start CMA from the beginning of the receiving symbols.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This line doesn't make sense:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sb=w'*x;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This only equalizes &lt;strong&gt;ONE&lt;/strong&gt; sample. The correct way to perform the equalization once you have the filter coefficients is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sb = filter(w(:,N+1), 1, y);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember what I said about the function filter and the function conv. Read the documentation.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The next problem is in your number of errors computing. This is a very trick, but you need to remember (or learn) that every equalizer generates a delay in your signal. So you cant do &lt;code&gt;ip- ipHat&lt;/code&gt; directly. You need to compensate this delay. I used: &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;nErr_CMA(ii) = size(find([ip(1:end-Le+1) - ipHat(Le:end)]),2);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't know about this delay, you need to study a litle bit more.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the plot part, I used the following:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;figure&#xA;semilogy(Eb_N0_dB,theoryBer,'b'),grid;&#xA;hold on;&#xA;semilogy(Eb_N0_dB,simBer_CMA,'r-','Linewidth',2);&#xA;%axis([0 14 10^-5 0.5])&#xA;grid on&#xA;legend('Theoretical BER','sim-CMA');&#xA;xlabel('Eb/No, dB');&#xA;ylabel('Bit Error Rate');&#xA;title('Bit error probability curve for BPSK in ISI with CMA equalizer');&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I also increased N to N = 1e5, so as to perform a Monte Carlo simulation properly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I changed Le to Le = 5;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I changed the w initializations for w = ones(Le, 1); to avoid that the update part of the CMA equation results in zero.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, change your channel. I didn't have time to verify that, but I strongly suspect that the channel [0.2 0.9 0.3] has some properties that makes it difficult for the CMA to equalize. I used ht = [1 0.5 0.2]. Try using this channel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Ok, I gave you a lot of answers. I don't know if there is any more mistakes, but here I was able to get a BER curve that looks right. If it is right or not, it is up to you. I suggest you to look for articles about communications systems using CMA algorithm and compare your results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CUhe3.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CUhe3.jpg&quot; alt=&quot;BER for BPSK with CMA Equalization&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if I need to let anything I said more clear. Good luck on your research.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="17125" LastEditDate="2015-10-17T01:25:38.193" LastActivityDate="2015-10-17T01:25:38.193" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="26413" PostTypeId="2" ParentId="26372" CreationDate="2015-10-14T01:40:25.807" Score="1" Body="&lt;p&gt;I've found out the reason of the problem.&#xA;The problem is that to get a real FFT (as it should be in my case) the sequence must be symmetric relatively to x[N/2] which in my case would be x[20].&#xA;This doesn't happen (notwithstading the fact that the rect signal is even so its countinous Fourier Transform is real) because of how the rectpuls function I used is defined.&#xA;Rectpuls(-0.5)=1 and rectpuls(0.5)=0&#xA;If instead I create a symmetric sequence using the value 1/2 at times t=-0.5s and t=0.5s (also according to the Dirichlet conditions), I get a real FFT and the results I wanted to obtain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)Phase spectrum of real DTFT with linear delay factor introduced by fft shifting&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)Phase spectrum of real DTFT I wanted to plot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VX5Wh.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VX5Wh.jpg&quot; alt=&quot;Phase spectrum of real DTFT with linear delay factor&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1PTt8.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1PTt8.jpg&quot; alt=&quot;Phase spectrum of real DTFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17754" LastActivityDate="2015-10-14T01:40:25.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26415" PostTypeId="2" ParentId="26411" CreationDate="2015-10-14T07:13:09.960" Score="4" Body="&lt;p&gt;For $-1 &amp;lt;= x &amp;lt;= 1$, let's compare Chebyshev polynomials of the first kind, $T_n(x)$, and the basis functions of the Fourier cosine series, $F_n(x)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8qCWR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8qCWR.png&quot; alt=&quot;Fourier cosine series polynomials&quot;&gt;&lt;/a&gt; $F_n(x)=\cos(n \pi x)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UGml6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UGml6.png&quot; alt=&quot;Chebyshev polynomials&quot;&gt;&lt;/a&gt; $T_n(x)=\cos(n\ \text{acos}\ x)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing $T_n(x_T) = F_n(x_F)$ and solving for $x_F$ gives $x_F = (\text{acos}\ x_T) / pi$, revealing that the Chebyshev polynomial series is simply an argument-warped version of the Fourier cosine series that maps the range $0 &amp;lt;= x_F &amp;lt;= 1$ to $-1 &amp;lt;= x_T &amp;lt;= 1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VVvj7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VVvj7.png&quot; alt=&quot;x_T versus x_F&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This exclusion of $x_F &amp;lt; 0$ makes irrelevant the constraint that the Fourier cosine series is only applicable to even functions, functions symmetric around $x_F = 0$, meaning that $f(x_F) = f(-x_F)$. The mapping function is well-behaved in the range of interest, so if the Fourier cosine series can represent any even function, then the Chebyshev polynomial series can represent any function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not knowing the amplitude of the input sinusoid, it is not possible to control the proportional amplitudes of the generated harmonics by the choice of the waveshaper. For example if the waveshaper is $f(x) = x^2 + x$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(\cos x) = \frac{1}{2} + \cos x + \frac{1}{2} \cos 2x\\&#xA;f(\frac{1}{2} \cos x) = \frac{1}{8} + \frac{1}{2} \cos x + \frac{1}{8} \cos 2x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first one has the amplitude of the second harmonic at -6 dB compared to the fundamental, and the second one at -12 dB. Chebyshev polynomials are no miracle cure. The above polynomial $x^2 + x$ was a weighted sum of the first three Chebyshev polynomials. Any polynomial can be written as a weighted sum of Chebyshev polynomials, and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem persists for pure Chebyshev polynomials, for example $f(x) = 4 x^3 - 3x$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(\cos x) = \cos 3x\\&#xA;f(\frac{1}{2} \cos x) = \frac{1}{8} \cos 3x - \frac{9}{8} \cos x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Chebyshev polynomial series does have the advantage of better numerical stability than a simple power series, and if the amplitude of the input sinusoid is controlled somehow, it can be used to control the level of harmonics in the way you describe.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-15T05:24:12.537" LastActivityDate="2015-10-15T05:24:12.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26416" PostTypeId="1" CreationDate="2015-10-14T09:38:07.107" Score="0" ViewCount="58" Body="&lt;p&gt;I have several circle detectors. I want to evaluate their performance in finding the spherical steel markers in X-ray images. The radii of the circles are distributed in a narrow range around 8 px.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important that all markers are detected, it is not so important that there are no false positives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the first thing that comes to mind is AUC of precision-recall curves as a measure of goodness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is however a problem: some detectors return a probability map of some point being a center of the circle and have up to two parameters, while others operate on edge images and return circle center coordinates. Moreover one of the latter ones has many parameters to tweak. In order to have many points on the precision-recall curve for this detector I would have to sample the multidimensional parameter space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although technically it is not a problem I have reservations as of conceptual validity of this, since there is some a priori knowledge of reasonable values of those parameters and also they could be optimized by using a training set of images. This renders irrelevant the precision-recall curve points that were obtained with nonsense parameter, but these points nevertheless influence the AUC. Continuing this line of thought leads to a cross-validation approach, which I've never seen being used in articles on circle detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the correct way of evaluating circle detectors for a given task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. Also asked this on cross-validated stack exchange, since the question fits somewhere in between that an this community.&lt;/p&gt;&#xA;" OwnerUserId="11685" LastActivityDate="2023-08-14T00:03:35.670" Title="Evaluation of circle detectors" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26417" PostTypeId="2" ParentId="26370" CreationDate="2015-10-14T11:15:02.663" Score="0" Body="&lt;p&gt;To compute the freq response of a tapped-delay line FIR filter, zero-pad your filter's coefficients with a string of zero-valued samples so that the new sequence is N samples in length (N must be an integer power of two). Then perform an N-point FFT on the zero-padded sequence. The FFT results will be your desired freq response. The larger N, the finer will be the frequency granularity of your freq response results.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-14T11:15:02.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26418" PostTypeId="2" ParentId="26359" CreationDate="2015-10-14T11:43:44.963" Score="1" Body="&lt;p&gt;Here's another web page giving some DSP history: &lt;a href=&quot;http://ethw.org/Oral-History:Alan_Oppenheim&quot; rel=&quot;nofollow&quot;&gt;http://ethw.org/Oral-History:Alan_Oppenheim&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-14T11:43:44.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26419" PostTypeId="2" ParentId="23723" CreationDate="2015-10-14T14:11:53.217" Score="0" Body="&lt;p&gt;In the work called &lt;strong&gt;From Wide-baseline Point and Line Correspondences to 3D&lt;/strong&gt;, Herbert Bay says that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Gaussians are optimal for scale-space analysis [Koenderink 1984, Lindeberg 1990]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So explanation supposed to be found somewhere in the articles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;[Lindeberg 1990] T. Lindeberg. Scale-space for discrete signals. PAMI, 12(3):234–254, 1990. 2.3&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;[Koenderink 1984] J.J. Koenderink. The structure of images. Biological Cy- bernetics, 50:363 – 370, 1984. 2.3, 2.4&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you can implement mixed algorithm using DoG feature detector and SURF descriptors, if you will.&lt;/p&gt;&#xA;" OwnerUserId="17785" LastActivityDate="2015-10-14T14:11:53.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26420" PostTypeId="1" CreationDate="2015-10-14T14:40:34.723" Score="0" ViewCount="286" Body="&lt;p&gt;An image $I$ is computed by performing convolution and summation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{k=0}^{K-1} z_k * f_k = I&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given only the feature maps $z_k$ and the resulting image $I$, how do I compute the filters $f_k$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a linear system, therefore it must be possible to solve it with conjugate gradient. How to formulate it as $\mathbf{Ax} = \mathbf{b}$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z_k$ and $I$ have both the same quadratic size $N \times N$.&lt;/p&gt;&#xA;" OwnerUserId="17787" LastEditorUserId="80" LastEditDate="2015-10-14T15:15:04.947" LastActivityDate="2018-07-23T04:46:41.963" Title="How to estimate filters using conjugate gradient?" Tags="|filters|convolution|linear-systems|gradient|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26421" PostTypeId="2" ParentId="26366" CreationDate="2015-10-14T16:20:49.797" Score="0" Body="&lt;p&gt;A slightly different calculation is:&#xA;$\frac{S}{N}=\frac{s+s}{\sqrt{\sigma^{2}+\sigma^{2}}}=\sqrt{2}\cdot\frac{s}{\sigma}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\frac{s}{\sigma}$ is the signal/noise for each reading&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two signals add: $s_{1}+s_{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two noises add and normalize: $\sqrt{\sigma_{1}^{2}+\sigma_{2}^{2}}$&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2015-10-14T16:20:49.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26423" PostTypeId="2" ParentId="26420" CreationDate="2015-10-14T19:36:27.943" Score="1" Body="&lt;p&gt;This is a typical deconvolution problem that you can solve either by transforming to the frequency domain where convolution is a simple multiplication:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;F\left \{ {\bf{I}} \right \}= F\left \{ {\bf{z}} \right \} F\left \{ {\bf{f}} \right \},&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where ${\mathcal{F}}$ denotes the Fourier transform (or DFT) so $f$ will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;{\bf{f}}={\mathcal{F}}^{-1}\left \{ \frac{{\mathcal{F}}\left \{ {\bf{I}} \right \}}{{\mathcal{F}}\left \{ {\bf{z}} \right \}} \right \}&#xA;\end{equation},&#xA;where ${\mathcal{F}}^{-1}$ is the inverse Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, you can also represent in a matrix form, using a Circulant (kind of Toeplitz)  for the convolution operation. The frequency domain calculation though does not involve inverting (or pseudo inverting) a matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's additive noise in your problem, please see Wiener deconvolution (both time and frequency domain implementation)&lt;/p&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2015-10-14T19:36:27.943" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26424" PostTypeId="2" ParentId="26366" CreationDate="2015-10-14T19:54:03.487" Score="2" Body="&lt;p&gt;First, let's properly define the problem. Given $N$ observations $\left \{ x_i \right \}^{N}_{i=1}$ whereas $x_i \overset{i.i.d.}{\sim} {\mathcal{N}}(0, \sigma^2), \forall i \in \left [ 1,2,\dots, N \right ]$ we wish to find the variance of the sample mean estimator compared to a single sample variance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, a single sample variance is $\sigma^2$, now let's see how averaging the samples will decrease this variance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;{\mathrm{Var}}\left [ \frac{1}{N} \sum_{i=1}^{N} x_i\right ]\overset{i.i.d}{=} \frac{1}{N^2} \sum_{i=1}^{N}   {\mathrm{Var}}\left ( x_i \right ) = \frac{1}{N^2}N\sigma^2 = \frac{\sigma^2}{N}.&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the error is inversely proportional to the sample size $N$. In fact, just by adding one more sample you increase your SNR by 3dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $\sigma^2/N$ is also the Cramer Rao (lower) Bound (CRB) for the sample mean in a linear Gaussian problem, so this is in fact the best unbiased estimator for this problem.&lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="15513" LastEditDate="2015-10-15T05:41:39.417" LastActivityDate="2015-10-15T05:41:39.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26425" PostTypeId="2" ParentId="24710" CreationDate="2015-10-14T20:21:22.857" Score="0" Body="&lt;p&gt;If the number of frequencies you are looking at is reasonably small the best way is probably a heterodyne detector. You basically multiply the input signal with frequency of interest (complex or just cosine) and then run the result through a low pass filter followed by an some detector (RMS, peak, threshold, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bandwidth of the detection is equal to the bandwidth of the lowpass filter so can easily adjust it to whatever bandwidth you need. However, the smaller the bandwidth, the slower the response of the contraption will be. That's a fundamental constraint: narrow band means slow and fast means wide band.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-10-14T20:21:22.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26426" PostTypeId="1" AcceptedAnswerId="26427" CreationDate="2015-10-14T21:21:54.080" Score="10" ViewCount="1012" Body="&lt;p&gt;until today I knew that one bit is a variable, or a space in memory that can hold a value of either One (high) or Zero (low). This is the concept I learned from studying computer programming, microprocessor or DATA bus etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But after starting the course on information theory, I found out that bit is expressed as the information content of a symbol in message. This is calculated taking the logarithm (base 2) of the inverse of the probability of occurrence of the symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are these two concepts same ? On one hand one bit is a variable that can store either zero or one. On the other hand, one bit is the uncertainty associated with one of two symbols with probability of occurrence of 0.5. So, &lt;strong&gt;does 1 bit in computer programming or ASCII code mean 1 bit in information content of source or information theory?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A little edit:&#xA;here is one thing I am finding trouble understanding this topic. See, in data transfer of English alphabets, if we use ASCII code, we basically represent each symbol with 8 bits. Suppose that's 00000000 for a, 00000001 for b etc. So we are essentially allocating 8 quantization levels for each symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when the information theory comes into play, we take the probability of each symbol into account. 'E' has the highest frequency, where 'Z' has the lowest. So average information content comes down to 3 or 4 bits, right ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My book says, 'Entropy or average information content is the minimum average number of bits required to represent each sample without distortion'.So, in this case, for efficient data transfer, are we creating maximum four quantization levels for each symbols? Because, on an average they carry information worth 4 bits. If that's so, isn't bit in information theory the same as the one in computer programming, data transfer or ASCII code etc ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You probably get that I am clearly a noob here :p&lt;/p&gt;&#xA;" OwnerUserId="17687" LastEditorUserId="17687" LastEditDate="2015-10-15T00:22:52.703" LastActivityDate="2015-10-16T08:00:03.140" Title="Is concept of &quot;bit&quot; in computer programming similar to the concept of &quot;bit&quot; in information theory?" Tags="|information-theory|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26427" PostTypeId="2" ParentId="26426" CreationDate="2015-10-14T21:47:02.390" Score="10" Body="&lt;p&gt;They are not the same, but they're related. In particular, if you look at a computer memory holding $M$ &quot;computer&quot; bits, where each bit can be considered random and independent of all other bits, and there are roughly 50% of zeros, then the memory also holds roughly $M$ &quot;information theory&quot; bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this is often not the case: computer bits are usually correlated, and not uniformly random. This is why they can be compressed. Compressor programs such as LZW (&quot;source coders&quot; in information theory parlance) work, in a sense, by making each computer bit hold one information bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edited to add: This example may make the distinction clearer. Consider a memoryless source with two outputs, $m_1=000$ and $m_2=001$, with probability 0.5 for each. Clearly, the information in each message is one (information) bit, but its length is three (computer) bits. A source coder, such as the Huffman algorithm, will readily code the messages to $c_1=0$ and $c_2=1$, compressing the source output. You can easily extrapolate this example to a source that produces ASCII-encoded text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, in the case of written languages in general and English in particular, nobody knows what the actual source entropy is, because there is no model for it. That is why there are contests for the best compression of large bodies of text; nobody is really sure what the optimum compression algorithm for English is.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-10-14T23:53:11.290" LastActivityDate="2015-10-14T23:53:11.290" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26428" PostTypeId="2" ParentId="8787" CreationDate="2015-10-14T21:48:02.853" Score="0" Body="&lt;p&gt;Spatial domain in image looks like time domain in signals. Any signal (image,data...everything) can be composed of sine signals of varying frequencies (cosine signals are sine signals too, with just some lag or lead). So a definite signal can be decomposed to the sum of lots of sine signals with different frequencies. In more easy terms, any signal has a lot of components having multiple frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the basic underlying principle of fourier transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what it basically tells is what is the strength of the signal at a definite frequency. &quot;What frequency, What strength&quot;. So fourier transform mainly converts the signal from spatial domain to frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in spatial domain, you are concerned about finding the value of the pixel at a definite location, right? Like if I go this location, what value of pixel would I find there, what color would I see there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in frequency domain, you can find the strength of the signal occurring at a definite frequency. Remember, any signal contains of components of multiple frequencies. So any signal can be thought of having a lot of frequencies. So in frequency domain, you get to know how strong the signal would be at this particular frequency. &lt;/p&gt;&#xA;" OwnerUserId="17687" LastActivityDate="2015-10-14T21:48:02.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26429" PostTypeId="2" ParentId="22829" CreationDate="2015-10-14T22:35:43.140" Score="1" Body="&lt;p&gt;I don't know if I get your question, but here is something you can look into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier transform is basically converting a time domain function to frequency domain. That being said, Fourier transform basic formula gives you the amplitudes of various components of a given signal in frequency domain. Note the word amplitude. That's what Fourier transform provides you, amplitudes. These amplitudes are functions of, of course, frequency. By exponential Fourier transform formula, we get these amplitudes as complex quantities. That might be your $g(t) \iff G(f)$, where $g(t)$ gives the amplitudes of the signal vs. time, and $G(f)$ gives the amplitudes of the different components of the signal vs. their individual frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you are interested in PSD. That's power. So now you don't want amplitudes vs. frequency, you want power vs. frequency, right? Power is proportional to the square of amplitude. So how do you convert amplitude to power? You square the amplitudes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, amplitudes occur as complex quantities in exponential formula, remember? So if you multiply one complex quantity with its conjugate, you get the square of its amplitude. That's why you might use &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_g(f)=\lvert G(f)\rvert^2=G(f)G(-f)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $G(-f)$ is the conjugate of the complex quantity $G(f)$. At $f = 0$, you of course get a real quantity. In that case, you have, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(f)G(-f)=G(f)G(f)=\lvert G(f)\rvert^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps. &lt;/p&gt;&#xA;" OwnerUserId="17687" LastEditorUserId="1629" LastEditDate="2016-05-12T09:33:13.583" LastActivityDate="2016-05-12T09:33:13.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26431" PostTypeId="2" ParentId="26364" CreationDate="2015-10-14T23:29:34.793" Score="3" Body="&lt;p&gt;Suppose you are given a system with transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{(1-3z^{-1})(1-7z^{-1})}{(1-4z^{-1})(1-6z^{-1})} $$&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Poles&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Poles are the values of $z$ for which the entire function will be infinity or undefined. So, they will be the roots of the denominators, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look here, what values of $z$ will turn the transfer function tend to infinity? Obviously it's $z= 4$ and $z=6$, because if you let $z$ equal 4 or 6, the denominator will be zero, which means the transfer function will tend to infinity.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Zeros&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Zeros are the values of z for which the transfer function will be zero. As you have guessed correctly, zeros come from numerator. In this case, zeros are $z= 3$ and $z=7$, cause if you put $z= 3$ or $z=7$, the numerator will be zero, that means the whole transfer function will be zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here poles are $z=4$ and $z=6$, and zeros are $z=3$ and $z=7$.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Pole-Zero Plot&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;About finding the Pole zero plot, you draw a complex plane. Then you put the values of poles as 'X' marks and zeros as 'O' marks. Here I took the liberty of drawing the pole zero plot of the system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lcDA6.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lcDA6.jpg&quot; alt=&quot;Pole zero plot of the above system&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for low pass filter, you find out the transfer function, then the poles and zeros. &lt;/p&gt;&#xA;" OwnerUserId="17687" LastEditorUserId="90" LastEditDate="2015-10-15T02:27:30.107" LastActivityDate="2015-10-15T02:27:30.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26433" PostTypeId="1" AcceptedAnswerId="26510" CreationDate="2015-10-15T01:31:43.617" Score="6" ViewCount="2419" Body="&lt;p&gt;Anyone could share how to develop an application in MATLAB to restore the signal from a given degraded signal using Tikhonov regularization i.e restoring the signal $f$ via solving &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\min  || g - f \circ h ||^2  + \lambda ||\sigma \circ f ||^2 &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\sigma = [1,-1]$. and $\circ$ denotes the circulant convolution operator. The setting of the value epsilon is dependent on the signal to noise ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given an audio file with noisy convoluted measurement,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following routine are expected&#xA;Tikdeconv.m&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tikdeconv De-convolue a signal using Tikhonov regularisation &lt;code&gt;J=deblurw(I,PSF,LAMBDA)&lt;/code&gt; de-convolute input signal $I$ by PSF using Tikhonov regularisation with regularisation parameter LAMBDA returning de-convoluted signal J. The assumption is that the signal $I$ was created by convolving a signal $J$ with kernel PSF and possible by adding /guassian white noise. You may not call or use any code from the following built-in function in MATLAB:deconvwr,deconv,deconv2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any feedback on how to solve this would be appreciated. Thank you&lt;/p&gt;&#xA;" OwnerUserId="17792" LastEditorUserId="128" LastEditDate="2018-05-15T03:51:55.500" LastActivityDate="2023-04-14T14:51:24.297" Title="Use MATLAB to Restore a Signal from a Given Degraded Signal Using Tikhonov Regularization" Tags="|matlab|audio|deconvolution|least-squares|inverse-problem|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="26434" PostTypeId="2" ParentId="26426" CreationDate="2015-10-15T01:34:29.380" Score="0" Body="&lt;p&gt;On the data bus, we can in theory do better than information theory says. I know how to construct a circuit that will let me send 8 bits in parallel down 6 wires. This involves a trick using diodes and pull up/down resistors that allows using all three non-burning states of a digital wire for conveying information. With 3 states of 6 lines, I get 729 possible states, which allows me to carry EOF, INT, CLK, and disconnected in the main channel and still have plenty of room (this only uses 518 of the 729 states).&lt;/p&gt;&#xA;" OwnerUserId="17793" LastActivityDate="2015-10-15T01:34:29.380" CommentCount="2" CommunityOwnedDate="2015-10-15T01:34:29.380" ContentLicense="CC BY-SA 3.0" />
  <row Id="26435" PostTypeId="1" CreationDate="2015-10-15T05:17:52.767" Score="1" ViewCount="345" Body="&lt;p&gt;I'm not an engineer and have essentially taught myself all I know - this present problem is giving me some problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an all-pole filter (a gammatone filter - impulse response is essentially a damped cosine) implemented as a cascade of identical 2nd-order pole pair sections. The poles are located in the z-domain at $\exp(-\beta + i\theta)$: $\beta$ is the bandwidth in radians/sample and $\theta$ is the 'ringing' frequency in radians/sample. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a value for $\theta$, this pole pair does not produce a filter with peak gain at the frequency $\theta$ - I'm trying to find out exactly what the offset is (i.e. at what frequency a filter with a given $\theta$ actually has peak magnitude), so that I can produce filters that peak at precisely a given arbitrary frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found an equation for calculating what this offset is given poles located in the s-domain at $-\beta + i\theta$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathrm{f_{c,actual}} = \theta  \sqrt{1 - \dfrac{\beta^2}{\theta^2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This formula provides results consistent with observations up to a certain frequency, though I believe it needs to be modified to produce results that work for arbitrary discrete spectrums.. I've tried a number of things and just can't quite figure it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="17796" LastEditorUserId="8202" LastEditDate="2015-10-15T05:45:54.953" LastActivityDate="2018-12-09T19:50:05.447" Title="Precise Centre frequency of an All-pole digital filter" Tags="|audio|filter-design|digital-filters|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26436" PostTypeId="2" ParentId="26435" CreationDate="2015-10-15T06:50:54.697" Score="8" Body="&lt;p&gt;For a filter consisting of a complex conjugate pair of poles, the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-domain transfer function is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H(z) = \frac{a}{\left(1-r(\cos{\theta}-i\sin{\theta})z^{-1}\right)\left(1-r(\cos{\theta}+i\sin{\theta})z^{-1}\right)}\\&#xA;= \frac{a}{1 - 2r\cos(\theta)z^{-1} + r^2z^{-2}},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is a constant by which the magnitude frequency response can be normalized, &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the pole radius, and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the pole angle. The peak of the magnitude frequency response will not be exactly at frequency &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, but at a nearby frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; at which the derivative &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{|a|2r\sin(\omega)\left(2r\cos\omega - (r^2 + 1)\cos\theta\right)}{\left(4r^2\cos^2\theta - 4r(r^2 + 1)\cos(\theta)\cos(\omega) + 4r^2\cos^2\omega + r^4 - 2r^2 + 1\right)^{3/2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;of the magnitude frequency response &lt;span class=&quot;math-container&quot;&gt;$|H(e^{i\omega})|$&lt;/span&gt; with respect to &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; equals 0. That frequency is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ω_0 = \operatorname{acos}\left(\frac{(r^2 + 1)\cos\theta}{2r}\right)\text{ if }-1 &amp;lt; (r^2 + 1)\cos(\theta)/(2r) &amp;lt; 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eE7sf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eE7sf.png&quot; alt=&quot;No-go droplets&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;&lt;em&gt;Figure 1. The condition for that the magnitude frequency response peaks elsewhere than at &lt;span class=&quot;math-container&quot;&gt;$w_0=0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$w_0=\pi$&lt;/span&gt; is that poles stay outside these droplets.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following it is assumed that the condition is satisfied as otherwise the peak would be trivially at frequency &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; (if &lt;span class=&quot;math-container&quot;&gt;$\theta &amp;lt; \frac{\pi}{2}$&lt;/span&gt;) or &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, whichever is closer to the pole. The normalized magnitude frequency response with &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; chosen so that &lt;span class=&quot;math-container&quot;&gt;$|H(e^{i\omega_0})| = 1$&lt;/span&gt; reads:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|H(e^{i\omega})| = \sqrt{\frac{(r^4 - 2r^2 + 1)\sin^2\theta}{4r^2\cos^2\theta - 4r(r^2 + 1)\cos(\theta)\cos(\omega) + 4r^2\cos^2\omega + r^4 - 2r^2 + 1}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\theta = \operatorname{acos}\left(\frac{2r\cos\omega_0}{r^2 + 1}\right)\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is something you can use directly to keep the peak of your all-pole bandpass filter where you want it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qtu7d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qtu7d.png&quot; alt=&quot;Constant &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; pole loci&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;&lt;em&gt;Figure 2. Pole loci for a selection of constant &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; traced over &lt;span class=&quot;math-container&quot;&gt;$0 &amp;lt; r &amp;lt; 1$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the substitution given by equation (1) gives: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(z) = \frac{a}{1 - \frac{4r^2\cos(\omega_0)}{r^2 + 1}z^{-1} + r^2z^{-2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just like &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; does not exactly give the peak frequency, &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; does not give the exact bandwidth. The exact -3 dB to -3 dB bandwidth &lt;span class=&quot;math-container&quot;&gt;$B_\text{-3 dB}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EMU3o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EMU3o.png&quot; alt=&quot;Exact bandwidth&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;&lt;em&gt;Figure 3. -3 dB bandwidth of the filter, with &lt;span class=&quot;math-container&quot;&gt;$\omega_0 = \frac{\pi}{4}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r=0.9$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$B_\text{-3 dB} = \operatorname{acos}\left(\frac{(r + 1/r)\cos\theta + (r - 1/r)\sin\theta}{2}\right)\\- \operatorname{acos}\left(\frac{(r + 1/r)\cos\theta + (1/r - r)\sin\theta}{2}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was found by solving the values of &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$|H(e^{i\omega})| = \sqrt{2}/2$&lt;/span&gt;. The first &lt;span class=&quot;math-container&quot;&gt;$\operatorname{acos}$&lt;/span&gt; gives the solution found to the right from the peak and the latter &lt;span class=&quot;math-container&quot;&gt;$\operatorname{acos}$&lt;/span&gt; the one to the left. More generally, for a bandwidth from magnitude frequency response value &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$B_g = \operatorname{acos}\left(\frac{(r + 1/r)\cos\theta + \sqrt{1/g^2 - 1}(r - 1/r)\sin\theta}{2}\right)\\-\operatorname{acos}\left(\frac{(r + 1/r)\cos\theta + \sqrt{1/g^2 - 1}(1/r - r)\sin\theta}{2}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is needed when designing a composite filter, for example a gammatone filter, that is a cascade of identical two-pole filters. Usually we want to design the filter to have a given bandwidth, but it is very difficult to solve &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; from the above. So we resort to approximation. Using the value &lt;span class=&quot;math-container&quot;&gt;$D_2$&lt;/span&gt; of the second derivative of the magnitude frequency response at &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_2 = \frac{(r^2 + 1)^2\cos^2\theta - 4r^2}{(r^2 - 1)^2(1 - \cos^2\theta)},\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can approximate the magnitude frequency response with that of a complex one-pole filter that has at &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; the magnitude frequency response and its first two derivatives matched to those of the two-pole filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/C1xWL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/C1xWL.png&quot; alt=&quot;One-pole approximation&quot;&gt;&lt;/a&gt;&#xA;&lt;em&gt;Figure 4. One-pole approximation with pole angle &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magnitude frequency response of the one-pole filter is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\hat H(e^{i\omega})| = \frac{\sqrt{2}\left(\sqrt{1 - 4D_2} - 1\right)}{2\sqrt{\left(2D_2\cos(\omega - \omega_0) - 2D_2 + 1\right)\left(1 - \sqrt{1 - 4D_2} - 2D_2\right)}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is symmetrical around &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; and has &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; bandwidth:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat B_g = 2\operatorname{acos}\left(\frac{1/g^2 - 1}{2D_2} + 1\right),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or inversely and more usefully:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_2 = \frac{1 - g}{2g^2\left(\cos(\hat B_g/2) - 1\right)}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equations &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; when combined give:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_2 = \frac{2r^2(r^2 + 1)^2\left(1 - \cos(2\omega_0)\right)}{(r^2 - 1)^2(2r^2\cos(2\omega_0) - r^4 - 1)}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solving that for &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; gives a cumbersome equation with &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D_2$&lt;/span&gt; as arguments that can be used to set the approximate bandwidth of the two-pole filter (c language compatible plaintext with &lt;code&gt;w_0&lt;/code&gt; = &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; and &lt;code&gt;d_2&lt;/code&gt; = &lt;span class=&quot;math-container&quot;&gt;$D_2$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r=sqrt(-sqrt(2)*sqrt(sin(w_0))*sqrt((-sin(w_0)*(pow(d_2+1,2)*pow(cos(w_0),2)&#xA;+d_2-1)*sqrt(-pow(d_2+1,2)*pow(cos(w_0),2)+pow(d_2,2)-2*d_2+1)+pow(d_2+1,3)&#xA;*pow(cos(w_0),4)-(d_2+1)*(pow(d_2,2)-d_2+2)*pow(cos(w_0),2)+pow(d_2,2)-2*d_2&#xA;+1)/sqrt(-pow(d_2+1,2)*pow(cos(w_0),2)+pow(d_2,2)-2*d_2+1))+sin(w_0)*sqrt(-&#xA;pow(d_2+1,2)*pow(cos(w_0),2)+pow(d_2,2)-2*d_2+1)-(d_2+1)*pow(cos(w_0),2)+1)&#xA;/sqrt(-d_2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or with alternative symbols:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r = √(- √2·√(SIN(ω_0))·√((- SIN(ω_0)·((d_2 + 1)^2·COS(ω_0)^2 + d_2 - 1)·√(-&#xA;(d_2 + 1)^2·COS(ω_0)^2 + d_2^2 - 2·d_2 + 1) + (d_2 + 1)^3·COS(ω_0)^4 - (d_2&#xA;+ 1)·(d_2^2 - d_2 + 2)·COS(ω_0)^2 + d_2^2 - 2·d_2 + 1)/√(- (d_2 + 1)^2&#xA;·COS(ω_0)^2 + d_2^2 - 2·d_2 + 1)) + SIN(ω_0)·√(- (d_2 + 1)^2·COS(ω_0)^2 +&#xA;d_2^2 - 2·d_2 + 1) - (d_2 + 1)·COS(ω_0)^2 + 1)/√(-d_2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$\hat B_\text{-3 dB} = \hat B_{\sqrt{2}/2}$&lt;/span&gt; is set proportional to &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt; by a constant &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; stepped from 0.1 to 1.0, the upper half-plane pole resides on tracks like these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OimnU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OimnU.png&quot; alt=&quot;Pole loci for bandwidth proportional to peak frequency&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;&lt;em&gt;Figure 5. Pole loci for bandwidth proportional to peak frequency with proportionality constant &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2018-12-09T19:50:05.447" LastActivityDate="2018-12-09T19:50:05.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26438" PostTypeId="1" AcceptedAnswerId="26446" CreationDate="2015-10-15T07:44:25.020" Score="1" ViewCount="70" Body="&lt;p&gt;I have a set of $n$ low frequency time-varying signals $y(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to express the variability within this set of signals using a single number. My current idea is to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the average signal $\bar y(t)$ for the set using&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\bar y(t) = \dfrac{y_1(t) + y_2(t) + \ldots + y_n(t)}{n}  $$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the 'standard deviation' of each individual signal with respect to the mean signal $\bar y$ using the Pearson correlation $r$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\bar r = \dfrac{ r(y_1(t), \bar y(t)) + r(y_2(t), \bar y(t)) + \ldots + r(y_n(t), \bar y(t))}{n}$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This would then give me a sense of the variability within the set of signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is whether there are better, different, or more established ways of doing this? &lt;/p&gt;&#xA;" OwnerUserId="17798" LastEditorUserId="80" LastEditDate="2015-10-15T12:44:05.283" LastActivityDate="2015-10-16T20:57:32.413" Title="variability among signals" Tags="|signal-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26439" PostTypeId="2" ParentId="26426" CreationDate="2015-10-15T09:18:46.747" Score="2" Body="&lt;p&gt;Bit is a unit of measurement and multiple quantities are measured in bits. It's not that bit in programming and information theory mean different things. It's that memory and information content represent conceptually different quantities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example we can take the password ''123456''. If encoded in UTF-8, it requires 6 * 8 = 48 bits of memory. For real world purposes, its information content is about 10 bits.&#xA;Bit means the same in both cases, the quantity that is measured is what is different. If you compress the password, the amount of memory it takes decreases, but the information content won't change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One analogy: Physical quantities like gravity and electromagnetic force are both measured in Newtons but represent different types of interactions. You can empirically see that the unit Newton represents the same idea in both cases - gravity and electromagnetic force can balance each other (magnetic levitation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps :)&lt;/p&gt;&#xA;" OwnerUserId="17799" LastEditorUserId="17799" LastEditDate="2015-10-16T08:00:03.140" LastActivityDate="2015-10-16T08:00:03.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26440" PostTypeId="1" CreationDate="2015-10-15T09:19:27.437" Score="0" ViewCount="48" Body="&lt;p&gt;I am using a wavelet transform and am testing the following approach to thresholding:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;All coeffients (whatever their value) after the first N are set to 0&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So if my timeseries window is 128 elements, I will zero all after the first 8 (N).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to smooth nicely but is NOT proper Hard Thresholding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts on this?&lt;/p&gt;&#xA;" OwnerUserId="17802" LastEditorUserId="8202" LastEditDate="2015-10-15T09:46:16.647" LastActivityDate="2015-10-15T09:46:16.647" Title="Is this a valid thresholding approach?" Tags="|wavelet|thresholding|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26441" PostTypeId="1" AcceptedAnswerId="26460" CreationDate="2015-10-15T10:32:12.403" Score="1" ViewCount="1120" Body="&lt;p&gt;I am trying to solve the proof for determining the Fourier series representation of a periodic signal. &#xA;I understand fourier series equation for Discrete time which is $$x[n] = \sum^{}_{k=&amp;lt;N&amp;gt;} a_k  e^{jk\omega_0n}$$&#xA;In order to find the Fourier series coefficient we multiply both side by $e^{-jr(2\pi/N)n}$ and summation over N terms, That is:&#xA;$$\sum^{}_{n=&amp;lt;N&amp;gt;} x[n] e^{-jr(2\pi/N)n} = \sum^{}_{n=&amp;lt;N&amp;gt;} \sum^{}_{k=&amp;lt;N&amp;gt;} a_k  e^{j(k-r)(2\pi/N)n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that i couldn't understand how can we get the final term:&#xA;$$ a_r = \frac{1}{N} \sum^{}_{n=&amp;lt;N&amp;gt;} x[n]e^{jr(2\pi/N)n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, anyone, help me to understand this&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="16293" LastEditDate="2015-10-16T08:58:18.360" LastActivityDate="2015-10-16T08:58:18.360" Title="Determining Fourier Series coefficient for Discrete time" Tags="|discrete-signals|fourier-series|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26442" PostTypeId="1" AcceptedAnswerId="26451" CreationDate="2015-10-15T11:38:25.013" Score="1" ViewCount="347" Body="&lt;p&gt;Ex. &#xA;I have an image, let's say 100x100 pixels with some shape on it. And a set of straight lines that are passing through origin located at some point of image, for example origin located at point (50, 50). Number of lines determined by step - angle. If step = 15 degrees, then we have 180 / 15 lines. I want to determine points of interesection in efficient way, but all that I came up for now is printing a line on matrix and check for non-zero elements if they overlap non-zero elements of a shape(and check for diagonal connectivity).  &lt;/p&gt;&#xA;" OwnerUserId="17497" LastActivityDate="2015-10-15T20:38:23.497" Title="How to efficiently calculate points of intersection of a straight line and a contour?" Tags="|image-processing|math|shape-analysis|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26443" PostTypeId="2" ParentId="26397" CreationDate="2015-10-15T12:05:36.523" Score="2" Body="&lt;p&gt;First, an example: designing FIR filters pops to mind, or for that matter any signal processing module. The FIR filter is a nice example, since it can easily be implemented in VLSI even at the lowest abstraction level - physical mask level (in Cadence for example). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we recall an example of the FIR filter design:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CnymV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CnymV.png&quot; alt=&quot;fir&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see that we only need to design:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Delay&lt;/li&gt;&#xA;&lt;li&gt;Multiplier&lt;/li&gt;&#xA;&lt;li&gt;Adder&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;elements, which are quite easy to implement in VLSI, either at the high level (VHDL, Verilog), or lower level (Cadence, Magic IC, etc.). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now we have a mixed problem - the DSP part is designing the FIR filter, which can be designed in various ways, and dealing with the transfer function/frequency response. The VLSI part is actually implementing the filter - creating the layout which can be printed on a real integrated circuit. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In general, the two fields are connected, but in industry usually one deals in only a single layer of abstraction. Either one deals with circuits/elements as black boxes, without caring so much about the physical implementation, or conversely focuses on the optimal design of a component, which would later be produced and used in projects where DSP is employed.&lt;/p&gt;&#xA;" OwnerUserId="4710" LastActivityDate="2015-10-15T12:05:36.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26445" PostTypeId="1" CreationDate="2015-10-15T14:07:15.600" Score="1" ViewCount="1459" Body="&lt;p&gt;I am new to signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the envelope of a given speech signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I searched about it, I found about Mean Hilbert envelope function. I want to know what other functions/methods can do the same and why Mean Hilbert envelope is considered the best? &lt;/p&gt;&#xA;" OwnerUserId="17808" LastEditorUserId="13320" LastEditDate="2016-11-21T12:37:57.753" LastActivityDate="2016-11-21T12:37:57.753" Title="What are the different ways to find the envelope of a speech signal?" Tags="|signal-analysis|envelope|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26446" PostTypeId="2" ParentId="26438" CreationDate="2015-10-15T15:25:34.977" Score="0" Body="&lt;p&gt;As an example of what I mean, let's have a look at a simple sinusoid (though I see you're actually assuming double gamma functions; I may rework this later to use those).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This models the signals as:&#xA;$$&#xA;y_p(t) = \sin(\omega t + \phi_p)&#xA;$$&#xA;so the only difference between them is the phase $\phi_p = (p-1)\pi/6$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top plot is the mean signal $\bar{y}(t)$ and the bottom plot shows the Pearson coefficient between $\bar{y}$ and $y_p$ for $p=1\ldots 6$ (so $n=6$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OMS1j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OMS1j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the Pearson coefficient varies quite widely even in this simple example.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 26438&#xA;&#xA;Nsigs &amp;lt;- 6&#xA;T&amp;lt;- 1024&#xA;omega &amp;lt;- 2*pi*0.00982734982&#xA;t &amp;lt;- 0:(T-1)&#xA;&#xA;y &amp;lt;- matrix(,nrow = T, ncol = Nsigs)&#xA;phi &amp;lt;- c(0, 1*pi/6, 2*pi/6, 3*pi/6, 4*pi/6, 5*pi/6 )&#xA;&#xA;for (idx in 1:Nsigs)&#xA;{&#xA;  #phi[idx] &amp;lt;- runif(1)*2*pi&#xA;  y[,idx] &amp;lt;- sin(omega*t + phi[idx])  &#xA;}&#xA;&#xA;mean &amp;lt;- rowSums(y) / Nsigs&#xA;&#xA;total &amp;lt;- matrix(,nrow = T, ncol = Nsigs+1)&#xA;total[,1] &amp;lt;- mean&#xA;total[,2:(Nsigs+1)] = y&#xA;&#xA;pearson &amp;lt;- cor(total,use=&quot;complete.obs&quot;, method=&quot;pearson&quot;)&#xA;&#xA;par(mfrow=c(2,1),pty=&quot;m&quot;)&#xA;plot(t,mean, type=&quot;l&quot;)&#xA;title(&quot;Mean value&quot;)&#xA;&#xA;plot(1:6, pearson[1,2:7], pch=19, col=&quot;blue&quot;)&#xA;title(&quot;Pearson coefficient&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-15T15:54:13.970" LastActivityDate="2015-10-15T15:54:13.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26447" PostTypeId="2" ParentId="26445" CreationDate="2015-10-15T18:44:36.620" Score="2" Body="&lt;p&gt;The notion of envelope is an ill-defined concept that describes the smooth upper and lower boundaries of more or less oscillating signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CplAh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CplAh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most classical technique rectifies the signal (take the absolute value) and low-pass filters the result. Of course, results are not unique. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other techniques identify local extrema and fit them with low-order functions like polynomials or splines. This is used for instance in some implementations of the &lt;a href=&quot;http://dx.doi.org/10.1007/s10444-004-7614-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Empirical Mode Decomposition&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform sometimes offers a more solid alternative. Roughly speaking, suppose the signal can be written as the product of an envelope times an oscillation: $s(t) = e(t).o(t)$. Then, with other technical conditions, if the spectra of $e$ and $o$ are well separated, $H(s(t)) =e(t).H(o(t))$, where $H$ is the Hilbert transform. This is a loose transcription of the &lt;a href=&quot;https://projecteuclid.org/euclid.jiea/1237900766&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bedrosian identity&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $o(t)$ is a fine pass-band oscillations (the purest being a sine or a cosine), and $e(t)$ is lower in frequency, the Hilbert transform can separate them. This is why for speech, the signal is often decomposed first through a multirate filter bank. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All these techniques are often post-filtered in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More recent approaches try to better define the regularity or smoothness of the envelope, &lt;a href=&quot;http://perso.ens-lyon.fr/nelly.pustelnik/pdf/eusipco2012a.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;using optimization techniques&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-10-15T18:44:36.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26448" PostTypeId="2" ParentId="23397" CreationDate="2015-10-15T19:17:50.260" Score="1" Body="&lt;p&gt;This generating (check if it's a primitive polynomial - those are usually used) polynomial representing a simple Linear Feedback Shift Register (LFSR). The circuit is given below, the gate is a XOR gate (an addition over GF(2) ). You can follow the output of this shift register very easily&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6deoX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6deoX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="15513" LastEditDate="2015-10-15T19:33:12.653" LastActivityDate="2015-10-15T19:33:12.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26449" PostTypeId="2" ParentId="16540" CreationDate="2015-10-15T19:49:08.440" Score="6" Body="&lt;p&gt;2 point discrete differentiation is bound to produce highly noisy results.&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Five-point_stencil&quot; rel=&quot;noreferrer&quot;&gt;try the 5-points stencil&lt;/a&gt;. you can also generate coefficients (i.e. more points) yourself using derivation of Lagrange polynomials.&lt;/p&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2015-10-15T19:49:08.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26450" PostTypeId="2" ParentId="10319" CreationDate="2015-10-15T20:09:21.220" Score="1" Body="&lt;p&gt;First, the Nyquist Criterion is a sufficient condition for a subclass of signals. If a continuous signal is band limited, with appropriate sampling, the discretized version possesses all the information (analysis) and the continuous can be recover perfectly from discrete samples (synthesis). So, it is NOT a necessary condition, and can be overcome in some cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In compressive sensing, or sparse sampling in general, there is often a probabilistic interpretation. Under some conditions, the sensed signals are recovered with high probability, potentialy not perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One line of theory not mentioned here provides some interesting insights: FRI for Finite Rate of Innovation. It deals with signals which, in a unit of time, can be represented by a parametric model with $K$ parameters, i.e. a form of sparse representation. They can be Diracs or piecewise polynomials, and also include data represented as a sum of sines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I like in this setting is two-fold:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It deals with continuous signals,&lt;/li&gt;&#xA;&lt;li&gt;It generalizes Nyquist sampling by providing reconstruction from $N=2K$ measurements.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It basically says that the number of required samples can be related to (twice) the number of degrees of freedom in the description of a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A recent account is given in &lt;a href=&quot;http://dx.doi.org/10.1109/TSP.2015.2461513&quot; rel=&quot;nofollow&quot;&gt;Reconstruction of Finite Rate of Innovation Signals with Model-Fitting Approach&lt;/a&gt;, 2015.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-10-15T20:09:21.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26451" PostTypeId="2" ParentId="26442" CreationDate="2015-10-15T20:38:23.497" Score="0" Body="&lt;p&gt;Calculate the straight lines angles with respect to the x-axis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the angles of each and every point on the contour&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Search for points on the contour with same angles as the lines with respect to the origin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the points of line-contour crossing. &lt;/p&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2015-10-15T20:38:23.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26454" PostTypeId="1" AcceptedAnswerId="26461" CreationDate="2015-10-15T22:51:59.717" Score="0" ViewCount="75" Body="&lt;p&gt;I'm new to to DSP in general and have been trying my hand at making some very simple VST's just for practice purposes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to convert the stereo channels into Mid (in the left channel) and Side (in the right) without using a placeholder to store output. Here is a very basic version of the code I am currently trying:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    *LeftSample = (*LeftSample + *RightSample) * 0.5;&#xA;    *RightSample = (((*LeftSample * 2) - *RightSample) - *RightSample) * 0.5;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first line assigns the mid output to the left channel, but in the second line I am trying to reverse the mid conversion so that I can use the left channel's original output when performing the L-R operation to create the side channel in the right output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something in thinking that this should be achievable? Is there some reason that&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    (*LeftSample * 2) - *RightSample&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;does not reverse the mid conversion, (L+R) * 0.5? Is it not possible to derive the original left channel using the mid signal and the right signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, I'm new to this, so I apologize for any errors in terminology I have made, and for anything that has been poorly communicated. I appreciate all feedback and criticism (please, tear any errors I've made to pieces). I've looked around quite a bit, and haven't had any luck; if anyone has any resources or directions to point me in, I would greatly, greatly appreciate it!&lt;/p&gt;&#xA;" OwnerUserId="17726" LastEditorUserId="1849" LastEditDate="2015-10-16T11:58:48.257" LastActivityDate="2015-10-16T11:58:48.257" Title="Attempting to reverse mid conversion" Tags="|audio|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26459" PostTypeId="2" ParentId="16540" CreationDate="2015-10-16T03:45:07.497" Score="0" Body="&lt;p&gt;You can apply the concept of &quot;scale&quot; to your original data. The original data can be considered at the &quot;finest&quot; or &quot;smallest&quot; scale in the sense that all details are available to you. But you might not be interested in this level of detail since it might have noise that is affecting you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you convolve your original data with a Gaussian (normalized) of a given size, then you are effectively smoothing your signal and looking at a &quot;larger scale&quot;. By choosing different &quot;sigma&quot; (width) of your gaussian, you can smooth your signal, hence its derivative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could start with a small sigma of 5-10 and see if the smoothing is sufficient for you.&lt;/p&gt;&#xA;" OwnerUserId="17820" LastActivityDate="2015-10-16T03:45:07.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26460" PostTypeId="2" ParentId="26441" CreationDate="2015-10-16T06:12:37.013" Score="2" Body="&lt;p&gt;In the formula displayed for $x[n]$, the exponentials $e^{jk\omega_0 n}$ should be $e^{-jk\omega_0 n}$. I'm assuming that the sum $\sum\limits_{n = \langle N\rangle}$ is extended over all integers $n$ from $0$ to $N-1$. Fix $r\in \{0,\ldots, N-1\}$. Then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n = \langle N\rangle}x[n]e^{jr\omega_0 n} = \sum_{n = \langle N\rangle}\sum_{k = \langle N\rangle}a_ke^{-jk\omega_0 n}e^{jr\omega_0 n} = \sum_{k = \langle N\rangle} a_k \sum_{n = \langle N\rangle} e^{j(r-k)\omega_0 n}.\tag{*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $k = r$, then each of the terms $e^{j(r-k)\omega_0 n}$ equals $1$, in which case &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n = \langle N\rangle} e^{j(r-k)\omega_0 n} = N.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $k \neq r$, let $z = e^{j(r-k)\omega_0}$. Then $z\neq 1$ and $z^N = e^{2\pi j(r-k)n} = 1$. Thus&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n = \langle N\rangle} e^{j(r-k)\omega_0 n} = \sum_{n = \langle N\rangle} z^n = \frac{1 - z^N}{1 - z} = 0.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n = \langle N\rangle} e^{j(r-k)\omega_0 n} = N\delta_{k,r}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{k = \langle N\rangle} a_k \sum_{n = \langle N\rangle} e^{j(r-k)\omega_0 n} = \sum_{k = \langle N \rangle} a_k (N\delta_{k,r}) = N\sum_{k = \langle N\rangle} a_k \delta_{k,r} = Na_r.\tag{**}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining (*) and (**), &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Na_r = \sum_{n = \langle N\rangle} x[n]e^{jr\omega_0 n} = \sum_{n = \langle N\rangle}x[n]e^{jr(2\pi/N)n}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_r = \frac{1}{N}\sum_{n = \langle N\rangle} x[n]e^{jr(2\pi/N)n}.$$&lt;/p&gt;&#xA;" OwnerUserId="17822" LastActivityDate="2015-10-16T06:12:37.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26461" PostTypeId="2" ParentId="26454" CreationDate="2015-10-16T07:25:47.937" Score="2" Body="&lt;p&gt;You can fully reconstruct L and R from M and S, as you suspect. In your case: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ M = {{L + R} \over 2} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ L = 2M - R $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ S = {{L - R} \over 2} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ S = {{2M - R - R} \over 2} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the math checks out. Are you not getting the results you expect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I've worked with M&amp;amp;S in the past, I've alyways just done the scaling by 1/2 when returning to L&amp;amp;R. I guess it depends on what you're intending on doing with the M&amp;amp;S signals though. If you want the sum of M and S to have equal energy to the sum of L and R, you should scale by $ 1 \over \sqrt 2 $ when converting both to and from M&amp;amp;S.&lt;/p&gt;&#xA;" OwnerUserId="16404" LastActivityDate="2015-10-16T07:25:47.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26462" PostTypeId="1" AcceptedAnswerId="26464" CreationDate="2015-10-16T07:47:59.070" Score="0" ViewCount="162" Body="&lt;p&gt;I am sorry if I say any thing silly .Please forgive me.I want to apply a window to input signals.I have two signals each of which contains zeros (462 samples) and non zeros data (38 samples).I want my window to take only the non zeros data (or data above certain threshold).My ultimate goal is to reduce the processing time and resources by taking only non zero data .I will use this data in finding cross correlation and finally the delay between those signals.Can any one comment How I can do that (some hints about matlab code).&#xA;Thanks in advance and I am sorry for any inconvenience!&lt;/p&gt;&#xA;" OwnerUserId="17286" LastActivityDate="2015-10-16T11:37:20.873" Title="Applying a window to input signal" Tags="|matlab|discrete-signals|cross-correlation|window-functions|delay|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26463" PostTypeId="1" CreationDate="2015-10-16T09:01:13.783" Score="2" ViewCount="460" Body="&lt;p&gt;I have a 128MHz-wide down converted signal that gets processed in a FPGA via a polyphase filter bank to give 8x16 MHz baseband analytic signals. How do I convert this analytic signal to a real-valued signal? The Wikipedia article on analytic signal mentions that interpolation/up sampling will be required if the original signal was down converted. Here is how I plan to proceed:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Extract the real part of the analytic signal&lt;/li&gt;&#xA;&lt;li&gt;interpolate (up-sample by a factor of 2, followed by a low pass filter)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Would the above give me a real-valued signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 1: I believe, I have to up-sample (i.e add zeros to every alternate point) and then use a low pass filter, e.g. a FIR to interpolate.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2015-10-19T14:48:09.133" LastActivityDate="2015-10-20T07:28:47.797" Title="Compute real signal from a discrete analytic signal" Tags="|interpolation|analytic-signal|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26464" PostTypeId="2" ParentId="26462" CreationDate="2015-10-16T10:45:59.360" Score="1" Body="&lt;pre&gt;&lt;code&gt;% copy and paste into matlab command line&#xA;&#xA;% say you vector is this:&#xA;&#xA;a = randn(100, 1);&#xA;&#xA;% you take out these small values:&#xA;threshold = 0.3;&#xA;a = a(abs(a) &amp;gt; threshold); % or try a(abs(a)&amp;lt;threshold) = [];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="15513" LastEditDate="2015-10-16T11:37:20.873" LastActivityDate="2015-10-16T11:37:20.873" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26465" PostTypeId="1" AcceptedAnswerId="26466" CreationDate="2015-10-16T14:09:21.090" Score="1" ViewCount="1551" Body="&lt;p&gt;Does audioread(); function work with matlab R2009a? Every time I try to execute it, it produces this message!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**??? Undefined function or method 'audioread' for input arguments of type 'char'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Error in ==&gt; mnm at 4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[d,sr] = audioread('road.wav');**&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[arr,fs]=audioread('road.wav');&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="17112" LastActivityDate="2015-10-16T14:14:27.207" Title="Audio read function" Tags="|matlab|" AnswerCount="1" CommentCount="0" ClosedDate="2015-10-17T16:33:48.577" ContentLicense="CC BY-SA 3.0" />
  <row Id="26466" PostTypeId="2" ParentId="26465" CreationDate="2015-10-16T14:14:27.207" Score="2" Body="&lt;p&gt;audioread() got introduced in R2012b. Use wavread() instead&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-10-16T14:14:27.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26467" PostTypeId="1" CreationDate="2015-10-16T16:32:19.920" Score="1" ViewCount="2107" Body="&lt;p&gt;I found many definitions for this quantity, PSD. In a document on signal analysis by National Instruments say that it is the amount of power in a unit bandwidth. Let's say P(f) is the power of the signal contained in a given frequency 'f', then the PSD at frequency $f_n$ is given by $\frac{\Sigma_{i-3}^{i+3}P(f_n)}{f_{i+3}-f_{i-3}}$ where $n \epsilon Z$ and has the units W/Hz or dB/Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came to know that Power spectrum gives the power contained in a particular frequency (W vs Hz) whereas PSD gives power contained in a unit bandwidth of the signal (W/Hz vs Hz). I realize that they are different but I am unable to figure out how to calculate it. One more thing to add, Gaussian white noise has its power equally spread over all the frequencies and so we expect it to have a constant value in the power spectrum. But we see that it has spikes at some particular values and it varies very much from the constant we expect while in a source I found online PSD remains constant over all frequencies for Gaussian white noise. This is shown in figure below.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KJx1T.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KJx1T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also found that PSD is mostly used to study all types of noise like white noise, 1/f noise etc. My interest mainly lies in the difference of units between Powerspectrum and PSD which are given by W and W/Hz respectively. Please help me understand this concept if anybody comes across it.&lt;/p&gt;&#xA;" OwnerUserId="17830" LastActivityDate="2015-10-16T16:32:19.920" Title="How do we calculate Power Spectrum Density (PSD) which is given in dB/Hz and not just dB?" Tags="|matlab|signal-analysis|fourier-transform|power-spectral-density|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26468" PostTypeId="2" ParentId="16016" CreationDate="2015-10-16T17:39:14.770" Score="-1" Body="&lt;p&gt;The correlation you are seeing looks right - the correlation you are seeing is the superposition of two 'peaks' that are too wide to resolve. Take a look at this example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%pulses&#xA;fs = 10e3;&#xA;t1 = -0.1:1/fs:0.1;&#xA;t2 = t1 + 100/fs;&#xA;w = 40e-3;&#xA;&#xA;%generate two triangular pulses&#xA;x = tripuls([t1', t2'],w);&#xA;&#xA;% compute cross correlation&#xA;y = [xcorr(x(:,1),x(:,1)) xcorr(x(:,2),x(:,1))];&#xA;&#xA;% plot cross correlation&#xA;figure; subplot(3,1,1);&#xA;plot(y);&#xA;subplot(3,1,2);&#xA;plot(sum(y,2));&#xA;subplot(3,1,3);&#xA;plot(xcorr(sum(x,2),x(:,1)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17832" LastActivityDate="2015-10-16T17:39:14.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26469" PostTypeId="1" CreationDate="2015-10-16T18:28:36.763" Score="0" ViewCount="66" Body="&lt;p&gt;I was reading about Matching Pursuit and it struck me that you might use a dictionary simply consisting of uniformly distributed bipolar pseudo random vectors, instead of, say, Gabor atoms or windowed sinusoids.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I thought about orthogonality. Given a set of vectors, what would be one way to measure their orthogonality? We would ideally like to see the inner products [ V_i V_j ] vanishing for i != j. How do we quantify departure from this ideal? Furthermore, what level of orthogonality would we expect given a set of N uniformly distributed pseudo random vectors?&lt;/p&gt;&#xA;" OwnerUserId="12235" LastActivityDate="2015-10-16T18:28:36.763" Title="Orthogonality of pseudo random basis functions" Tags="|signal-analysis|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26470" PostTypeId="2" ParentId="26438" CreationDate="2015-10-16T20:57:32.413" Score="0" Body="&lt;p&gt;Compute the matrix Mij = [ y_i(t) y_j(t) ], where 0 &amp;lt;= i &amp;lt; n and 0 &amp;lt;= j &amp;lt; n. This matrix Mij will approximate a gain times the identity matrix when the signals are perfectly uncorrelated. So I suppose you could use sum of squares of the deviation from the gain times the identity matrix as a norm.&lt;/p&gt;&#xA;" OwnerUserId="12235" LastActivityDate="2015-10-16T20:57:32.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26471" PostTypeId="2" ParentId="23971" CreationDate="2015-10-16T21:32:12.240" Score="1" Body="&lt;p&gt;Your question is quite central to the development of wavelet theory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the word wavelet has an early history. It is coined in &quot;&lt;a href=&quot;http://dx.doi.org/10.1190/1.1441816&quot; rel=&quot;nofollow&quot;&gt;The form and nature of seismic waves and the structure of seismograms&lt;/a&gt;&quot;, Norman Ricker, 1940, Geophysics. Here, the wavelet is quite close to your problem, and the scale factor is not an issue. Later, following Jean Morlet, wavelets have become scale-related transformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resultingly, following @Batman advices, I would relate your question to matched filtering, basis pursuit or deconvolution/source separation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, you can perform matched filtering of basis signal templates in a wavelet domain, which can help in the case of noise, and may simplify the local estimation of adapted matched filters. An example in seismic signal processing is given in &lt;a href=&quot;http://arxiv.org/abs/1108.4674&quot; rel=&quot;nofollow&quot;&gt;Adaptive multiple subtraction with wavelet-based complex unary Wiener filters, 2012&lt;/a&gt; with continuous complex wavelet frames, or in a more complete optimization paradigm with bounds on sparsity in &lt;a href=&quot;http://arxiv.org/abs/1405.1081&quot; rel=&quot;nofollow&quot;&gt;A Primal-Dual Proximal Algorithm for Sparse Template-Based Adaptive Filtering: Application to Seismic Multiple Removal, 2014&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you should made clearer is you really want to do with your signal.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-04-14T08:21:06.823" LastActivityDate="2016-04-14T08:21:06.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26472" PostTypeId="1" CreationDate="2015-10-16T21:57:10.547" Score="5" ViewCount="1084" Body="&lt;p&gt;I'm working on hand gesture recognition using C#. I'm using OPENCV for skin detection but its performance is not optimal. So I decided to do some filtering based on color space, but I do not know what color space is the most suitable for this purpose? &lt;/p&gt;&#xA;" OwnerUserId="17836" LastEditorUserId="37293" LastEditDate="2019-11-26T13:59:07.893" LastActivityDate="2022-07-15T13:31:03.983" Title="What Is the Best Color Space to Work with for Hand Detection: RGB, HSV, or YCrCb?" Tags="|image-processing|opencv|color|detection|c#|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26473" PostTypeId="2" ParentId="6081" CreationDate="2015-10-17T00:48:44.350" Score="3" Body="&lt;p&gt;Here is a picture of me whistling into the FFT Spectrum Analyzer app on my android.  Center-line is 1.2k Hz.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the overwhelming strength of the first harmonic.&#xA;Also note that while there is a second harmonic, it is about 20 to 40 times weaker than the first harmonic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uYHl3.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uYHl3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17838" LastActivityDate="2015-10-17T00:48:44.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26477" PostTypeId="1" AcceptedAnswerId="26482" CreationDate="2015-10-17T10:45:25.353" Score="1" ViewCount="992" Body="&lt;p&gt;While learning about Fourier Transform after Fourier Series, That we can calculate Fourier transform of periodic signals too. If we can take the Fourier transform of periodic signal too then my question is why we Fourier series if Fourier transform can be calculated for both periodic and aperiodic? &lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="29" LastEditDate="2015-10-20T17:53:39.343" LastActivityDate="2015-10-20T17:53:39.343" Title="Why Fourier series if Fourier transform can be calculated for both periodic and aperiodic?" Tags="|fourier-transform|fourier-series|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26478" PostTypeId="2" ParentId="26477" CreationDate="2015-10-17T11:31:32.027" Score="2" Body="&lt;p&gt;The difference between a series and a function is, algebraically speaking, the field over which you define the mapping, and important concepts like convergence and differentiability. Your choice of whether you're after the Fourier Series representation or the Fourier Transform doesn't depend on what you want to analyze, but what you want to do -- these are two separate concepts, and you shouldn't confuse them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in Physics you'll need the Fourier transform to convert a crystal grid from spatial domain to impulse domain -- although crystals are assumed to be perfectly periodic, having but a series won't cut it as soon as you want to do functional analysis on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, in digital signal processing, you typically neither have infinite nor perfectly periodic signals, so your Discrete Fourier Transform (DFT) gives you a finite series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point here is that you write yourself:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;While learning about Fourier Transform after Fourier Series&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Keep learning. Sooner than later, you'll understand the significance of both concepts.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-10-17T11:31:32.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26479" PostTypeId="2" ParentId="26472" CreationDate="2015-10-17T11:51:09.437" Score="1" Body="&lt;p&gt;Intuitively, HSV is the place to easily define Skin Color Hues.&lt;/p&gt;&#xA;&lt;p&gt;Yet there is a broad work on that and even articles about the optimal Color Space for Skin Detection.&lt;/p&gt;&#xA;&lt;p&gt;Yet, you should have a look at &lt;a href=&quot;http://www.inf.pucrs.br/%7Epinho/CG/Trabalhos/DetectaPele/Artigos/OPTIMUM%20COLOR%20SPACES%20FOR%20SKIN%20DETECTION.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;OPTIMUM COLOR SPACES FOR SKIN DETECTION&lt;/a&gt; (Alternative at IEEE - &lt;a href=&quot;https://ieeexplore.ieee.org/document/958968&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimum color spaces for skin detection&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;According to them there is no difference in the performance as long as you create the Optimal Detector.&lt;br /&gt;&#xA;This actually makes sense, since all Color Spaces in the article are One to One functions it means the real thing here is to develop the correct classifier.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="26573" LastEditDate="2022-07-15T13:31:03.983" LastActivityDate="2022-07-15T13:31:03.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26480" PostTypeId="2" ParentId="26477" CreationDate="2015-10-17T14:02:21.537" Score="1" Body="&lt;p&gt;It's all the same thing. They are just different flavors based on signal properties to make the math work properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a signal is periodic than its transform is discrete and vice versa. If the signal is aperiodic the transform is continuous and vice versa. So there are a total of four flavors&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   time                frequency           name&#xA;cont. aperiodic      cont. aperiodic     Fourier Transform&#xA;cont. periodic       discrete aperiodic  Fourier Series&#xA;discrete aperiodic   cont. periodic      Discrete Fourier Transform&#xA;discrete periodic    discrete periodic   Discrete Fourier Series or Discrete Time Fourier Transform&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The difference in the formulas is simply due to the fact that you need summation for discrete signals and integration for continuous signals. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-10-17T14:02:21.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26481" PostTypeId="1" CreationDate="2015-10-17T15:10:17.603" Score="7" ViewCount="2856" Body="&lt;p&gt;I have some clarifications required in this topic&#xA;So initially I know that to shift a signal $X(f)$ by $f_0$ we need to take its inverse fourier transform and multiply it with a factor of $\exp(−j2\pi f_0)$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Now as I understand it, in the frequency domain the spectrum is shifted by the value of $f_0$  from its original frequency, correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;So therefore, is the frequency of my original signal $x(t)$ actually increasing/decreasing?(depending again on the value specified by $f_0$)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now coming to my problem at hand, I'm trying to design a receiver which compensates for doppler effect.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;And as I've read up a doppler shift is nothing but an increase in frequency so am I on the right track in considering a frequency shift or should I actually consider a frequency scaling approach?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Or can someone tell me what exactly does a Doppler shift in frequency have an effect in the time domain?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="17844" LastEditorUserId="1629" LastEditDate="2016-09-06T20:53:42.780" LastActivityDate="2017-12-12T21:33:48.623" Title="Doppler shift in time domain?" Tags="|frequency|frequency-domain|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26482" PostTypeId="2" ParentId="26477" CreationDate="2015-10-17T15:45:19.350" Score="4" Body="&lt;p&gt;You can't take the Fourier transform of a periodic signal, the integral diverges for all multiples of the period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be handled by the theory of distributions, but the Fourier series is a better fit.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-10-17T15:45:19.350" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26483" PostTypeId="2" ParentId="26472" CreationDate="2015-10-17T16:01:40.770" Score="1" Body="&lt;p&gt;If you classify by hand sufficiently many pixels as skin/non-skin, you get a point cloud in color space that tells you about the statistical distribution of these.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, automated classification amounts to defining a sharp boundary inside which pixels are deemed skin. The standard color spaces are 3D and are mappings of each other through nonlinear transforms. In all spaces, you essentially get more or less compact &quot;potato shapes&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you base your classifier on an empirical/simple function, such as a sphere, you need to find the space where the shape is the most spherical. Otherwise, if you use a general purpose classifier, it will learn the cloud shape on its own.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, my best advice is to normalize for lightness, as the apparent lightness of a skin depends on the amount of ambient light, which is an uncontrolled parameter. Then you reduce to 2D information, such as H-S.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very dark or very light skins are and will remain problematic, as they convey little color information and are not discriminant.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-10-17T16:08:13.077" LastActivityDate="2015-10-17T16:08:13.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26485" PostTypeId="2" ParentId="26481" CreationDate="2015-10-17T16:38:40.707" Score="9" Body="&lt;p&gt;The term Doppler Shift is actually a bit of a misnomer. The frequencies are not actually shifted but they are scaled (see &lt;a href=&quot;http://fourier.eng.hmc.edu/e101/lectures/handout3/node2.html&quot; rel=&quot;noreferrer&quot;&gt;http://fourier.eng.hmc.edu/e101/lectures/handout3/node2.html&lt;/a&gt; for definition of shifting vs. scaling). It's a relative change not an absolute one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both time and frequency domains are scaled: when the source is moving towards you, the time axis compresses and the frequency axis expands. If the source is moving a away from you the time axis expands and the frequency axis compresses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at a simple example. A car is 100m away from you and moves at a speed of 20m/s towards you. We assume speed of sound to 100 m/s (it's actually 344 m/s but I'm too lazy to do the math that way). Let's now assume that the car honks its horn for 1 second at a frequency of 1 kHz. So the honk consists of 1000 wiggles of air molecules. Let's call the start of the honk time t = 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the beginning of the honk, the car is 100m away so the beginning of the honk arrives at your ear at time t = 1s. It takes one second for the sound to travel 100m. By the end of the honk the car has traveled 20m so it's only 80m away. The end of the honk arrives at time t = 1.8s. The sound only takes 0.8s to travel 80m.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The honk at the listening location is only 0.8s long, so the time has been compressed. It's still 1000 wiggles but they happen in less time. So the frequency is now 1000 wiggles/0.8s = 1250 Hz. The frequency is higher so the frequency axis has expanded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to note the frequency doesn't go up by a constant shift frequency but by a multiplicative factor. If the honk would have been 2 kHz the resulting Doppler frequency would be 2500 Hz and NOT 2250 Hz.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-10-17T16:38:40.707" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26487" PostTypeId="1" CreationDate="2015-10-17T17:51:56.190" Score="0" ViewCount="477" Body="&lt;p&gt;Im simulating a karaoke system. I m giving a mono channel audio as input and i should get instrumental component of audio as output(all vocal component should be removed from audio).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i tried two approaches but none of them worked&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,fs]=wavread('bb.wav');&#xA;left=y(:,1);&#xA;right=y(:,2);&#xA;wavplay(left-right,fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2nd&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y, fs] = wavread('Song.wav');&#xA;left = y(:,1);&#xA;right = y(:,2);&#xA;fftL = fft(left);&#xA;fftR = fft(right);&#xA;&#xA;for i = 1:683550 %in my example 683550&#xA;dif = fftL(i,1) / fftR(i,1);&#xA;dif = abs(dif);&#xA;if (dif &amp;gt; 0.7 &amp;amp; dif &amp;lt; 1.5)&#xA;fftL(i,1) = 0;&#xA;fftR(i,1) = 0;&#xA; end;&#xA;end;&#xA;&#xA;leftOut = ifft(fftL);&#xA;rightOut = ifft(fftR);&#xA;yOut(:,1) = leftOut;&#xA;yOut(:,2) = rightOut;&#xA;&#xA;wavwrite(yOut, fs, 'tmp.wav');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17037" LastEditorUserId="80" LastEditDate="2015-10-18T01:44:29.647" LastActivityDate="2015-10-18T01:44:29.647" Title="I m assigned a project to create karaoke system on matlab. But im a noob in Audio processing and i don't know to approach this problem. Please help" Tags="|matlab|fft|audio|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26489" PostTypeId="1" AcceptedAnswerId="26522" CreationDate="2015-10-18T00:55:33.550" Score="3" ViewCount="875" Body="&lt;p&gt;This is a follow up to the question &lt;a href=&quot;https://dsp.stackexchange.com/questions/26342/novice-researcher-aims-to-get-published-how-to-pick-a-journal&quot;&gt;How to Pick a Journal for Publishing a Research Work?&lt;/a&gt; question. Suppose we take discrete samples of a low frequency signal corrupted by high frequency noise. We know the signal has no frequencies higher than  20%  of the Nyquist rate. We also know all the noise is at or above 50% of the Nyquist rate, and below the Nyquist rate. I will use the following as a specific example to experiment with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&amp;amp;\textrm{measurement}(t) = \textrm{signal}(t) + \textrm{noise}(t)\\&#xA;&amp;amp;\textrm{signal}(t) = 4.4+\sin(0.06\pi t-0.1) + \sin(0.14\pi t+0.07) + \sin(0.2\pi t+0.4)\\&#xA;&amp;amp;\textrm{noise}(t) = \sin(0.06+0.5\pi t) + \sin(0.1-0.68\pi t) - \sin(0.04-0.74\pi t) + \sin(0.03-0.93\pi t)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The measurement is sampled at integer values of (&lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;). A plot of the measurement samples and the continuous signal is below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YIw9p.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YIw9p.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How well can we estimate &lt;span class=&quot;math-container&quot;&gt;$\textrm{signal}(t)$&lt;/span&gt; at integer values of (&lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;) using the current and past measurements? I was able to filter it using the Kalman filter below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lahie.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lahie.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A plot of the signal and Kalman filter output is in the next plot. The final plot shows the error in the Kalman filter output which has a maximum magnitude of 1.865 and the RMS error is 0.7895. Can we make a Kalman filter that does better than the Kalman filter above? What known filter method would give the best estimates, and how good would the estimates be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1Grwy.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Grwy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eexQg.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eexQg.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I learned about discrete lowpass filters 25 years ago, and I always assumed a problem such as the one above was a common application for them. At that time I didn't know this problem is called estimation, and I didn't know about the Kalman filter. Then I recently took &lt;a href=&quot;https://pe.gatech.edu/courses/multi-sensor-data-fusion&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; course, and another course Georgia Tech provided that goes into the details of estimation algorithms. However, the Georgia Tech courses mention nothing about using a discrete lowpass filter for estimation. I check several books on estimation, and found nothing about discrete lowpass filters. I work with a computer scientist who has been doing research in data fusion for 20 years, and he knows nothing about z-transforms, transfer functions, etc. Why is it that the estimation community ignores the use of a discrete lowpass filter for estimation? As far as I can tell it's the best approach to estimate the signal above. &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="128" LastEditDate="2020-03-14T09:06:14.573" LastActivityDate="2020-03-14T09:06:14.573" Title="Estimating a Low Frequency Signal Corrupted by High Frequency Noise" Tags="|discrete-signals|noise|estimation|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26491" PostTypeId="1" CreationDate="2015-10-18T08:02:19.547" Score="1" ViewCount="56" Body="&lt;p&gt;I need a reference for the fact that each LFSR with &lt;strong&gt;XOR&lt;/strong&gt; operation has a period of $2^m-1$ excluding &lt;strong&gt;zero state&lt;/strong&gt; and every LFSR with &lt;strong&gt;XNOR&lt;/strong&gt; operations has the same period excluding &lt;strong&gt;all ones state&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to cite it when I'm writing about the usage of LFSR in a paper, I've found some references but they avoid a proof and all of them include only the case of XOR operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since LFSRs are mostly used in signal processing I ask it here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;I know that the feedback polynomial should be primitive.&lt;/p&gt;&#xA;" OwnerUserId="16719" LastEditorUserId="16719" LastEditDate="2015-10-18T18:11:49.743" LastActivityDate="2015-10-21T05:17:34.040" Title="Need a reference on period of LFSRs" Tags="|reference-request|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26493" PostTypeId="1" CreationDate="2015-10-18T09:53:24.493" Score="0" ViewCount="198" Body="&lt;p&gt;I am confused trying to understand the Proof of Fourier Transform from Oppenheim book &lt;em&gt;Signals and Systems&lt;/em&gt;. I am pasting the equations directly from the book:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$\widetilde{x}(t)=\sum_{k=-\infty}^{+\infty}a_ke^{jk\omega_0t} \tag{4.3} $$&#xA;  $$a_k=\frac{1}{T}\int_{-T/2}^{T/2}\widetilde{x}(t)e^{-jk\omega_0t}dt \tag{4.4} $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where $\omega_0=2\pi/T$. Since $\widetilde{x}(t)=x(t)$ for $|t| &amp;lt; T/2$, and also, since $x(t)=0$ outside this interval, eq. $(4.4)$ can be&#xA;  rewritten as&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$a_k=\frac{1}{T}\int_{-T/2}^{T/2}x(t)e^{-jk\omega_0t}dt=\frac{1}{T}\int_{-\infty}^{+\infty}x(t)e^{-jk\omega_0t}dt$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;My question is In the last equation on the L.H.S, there is no&#xA;$\widetilde{x}(t)$ but it was mentioned in the eq. $(4.4)$&lt;/li&gt;&#xA;&lt;li&gt;And then we have: $$Ta_k= \left.\frac{2 \sin(\omega T_1)}{\omega}\right\rvert_{\omega =&#xA;k\omega_0}$$ That is, with $\omega$ thought of as a continuous variable, the function ($2\sin\omega T_1/ \omega$) represents envelope of $Ta_k$.&#xA;Here I want to know what is meant by envelope?I want to add more details from the book exactly &quot; Specifically we have plot $T_0a_k$ rather than $a_k$ and we have also modified the horizontal spacing in each plot. here is the plot &quot;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6yhd7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6yhd7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;c) I want to know that how $T_0a_k$ will be drawn in continuous?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="16293" LastEditDate="2015-10-19T08:49:33.613" LastActivityDate="2015-10-20T23:39:38.407" Title="Confusion in CT Fourier Transform Proof" Tags="|fourier-transform|continuous-signals|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26494" PostTypeId="2" ParentId="25312" CreationDate="2015-10-18T10:30:07.530" Score="2" Body="&lt;p&gt;Forgive me for not having a numerical answer to the question. But here are a few things to think about. The answer depends on how the Hilbert transform (HT) is implemented. If the HT is implemented using an $N$-point tapped-delay line filter-like block diagram the first and last $N$-1 output samples are incorrect. So in this situation four input times samples is definitely not enough samples to produce useful results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If HT is implemented by way of a forward FFT, zero the neg-frequency spectral components, and inverse FFT (as is done in Matlab) you have a better chance of computing meaning results. However, in this second implementation the input time sequence must be long enough to contain at least one cycle of all the spectral components of your input signal in order to compute somewhat meaningful results. It seems to me that four times samples is too short to reliably estimate any signal parameters of most real-world (information-carrying) signals.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-18T10:30:07.530" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26497" PostTypeId="2" ParentId="26491" CreationDate="2015-10-18T16:46:37.963" Score="3" Body="&lt;p&gt;Not all LFSRs have the property of maximum cycle length. In fact, those who do have this property are based on a &lt;strong&gt;primitive&lt;/strong&gt; polynomial of order n. It is a basic property of the extension field $GF(2^n)$ which is &quot;spanned&quot; by this primitive polynomial. The LFSR merely iterates through all of the powers of the polynomial primitive root. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Open a book on algebraic structures and cite the relevant part. &lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="15513" LastEditDate="2015-10-21T05:17:34.040" LastActivityDate="2015-10-21T05:17:34.040" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26499" PostTypeId="1" CreationDate="2015-10-18T17:39:08.670" Score="1" ViewCount="333" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zzkzg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zzkzg.png&quot; alt=&quot;Antenna Array Background&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the image above, there is a formula for the delay of a signal at a given sensor 'i' in an antenna array. I don't understand how they arrived at that formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each antenna array element is separated by a distance of 'd' and we know the signal hits the array at an angle 'theta'. Dividing by 'c' gives us the time taken for light to travel the additional distance, but I don't see how the quantity 'dsin(theta)' represents the extra distance. Would appreciate any clarification.&lt;/p&gt;&#xA;" OwnerUserId="17541" LastActivityDate="2015-10-19T00:23:59.243" Title="Making sense of the delay formula between two sensors in an antenna array?" Tags="|signal-analysis|continuous-signals|estimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26500" PostTypeId="1" AcceptedAnswerId="26511" CreationDate="2015-10-18T18:02:05.817" Score="0" ViewCount="2917" Body="&lt;p&gt;My question is about the meaning of power spectrum derived from the Fourier series coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier series is shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=a_0+\sum_{n=1}^{\infty}a_n\sin(\omega_n t)+\sum_{n=1}^{\infty}b_n\cos(\omega_n t) $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&#xA;$\omega_n = 2\pi n f $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the Fourier-series above is summing sines and cosines for all the harmonic frequencies to obtain a periodic signal $f(t)$, at a particular frequency the the sine and cosine sum together with offset can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_0 + a_n\sin(\omega_n t) + b_n \cos(\omega_n t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can show the Fourier-series coefficient for each harmonic as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rYt2A.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rYt2A.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But textbooks shows the power spectrum instead as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EIIfe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EIIfe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the power magnitude equal to the square root of the sum of squares of the sine and cosine components? How can I derive this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{Magnitude} = \sqrt{a_n^2 + b_n^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_0 + a_n\sin(\omega_n t) + b_n \cos(\omega_n t) $$&lt;/p&gt;&#xA;" OwnerUserId="7555" LastEditorUserId="8202" LastEditDate="2015-10-19T08:27:41.563" LastActivityDate="2015-10-19T08:33:40.087" Title="Relation between a Fourier series harmonic component and its power" Tags="|fourier-series|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26501" PostTypeId="2" ParentId="26493" CreationDate="2015-10-18T18:18:23.127" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;@robertbristow-johnson can you please explain exactly the answer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;oh dear.  it's a lot of work and it should be in &lt;em&gt;some&lt;/em&gt; textbook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;okay, using your O&amp;amp;S notation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tilde{x}(t) = \sum\limits_{k=-\infty}^{+\infty} a_k \ e^{j k \omega_0 t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tilde{x}(t) = \tilde{x}(t+T) \quad \forall t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega_0 \triangleq \frac{2 \pi}{T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_k = \frac{1}{T} \int\limits_{t_0}^{t_0 + T} \tilde{x}(t) \ e^{-j k \omega_0 t} \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and where $t_0$ can be any real value:  $-\infty &amp;lt; t_0 &amp;lt; +\infty$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we choose $t_0$ to be $t_0 = -\frac{T}{2}$ so that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_k = \frac{1}{T} \int\limits_{-\frac{T}{2}}^{+\frac{T}{2}} \tilde{x}(t) \ e^{-j k \omega_0 t} \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow&quot;&gt;Fourier Series&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Riemann_sum&quot; rel=&quot;nofollow&quot;&gt;Riemann sum&lt;/a&gt; is a sum of areas of rectangles that, for decently well-behaved functions, converges to the area of an integral in the limit that the rectangles get thinner and thinner:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \int\limits_{t_1}^{t_2} f(t) \ dt  =  \lim_{N \to +\infty} \sum\limits_{n=0}^{N-1} f\left(t_1 + n\frac{t_2 - t_1}{N} \right) \ \frac{t_2 - t_1}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $t_1 &amp;lt; t_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this (&lt;a href=&quot;https://en.wikipedia.org/wiki/Riemann_integral&quot; rel=&quot;nofollow&quot;&gt;Riemann integration&lt;/a&gt;) works for most ordinary functions that are decently well-behaved.  for nastier functions, &lt;a href=&quot;https://en.wikipedia.org/wiki/Lebesgue_integration&quot; rel=&quot;nofollow&quot;&gt;another method of defining integration&lt;/a&gt; may have to be used, but we're not dealing with that here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so do you understand Fourier series and Riemann integration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, define&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tilde{x}(t) =&#xA;\begin{cases}&#xA;x(t), &amp;amp; \text{if } |t| &amp;lt; \frac{T}{2}  \\&#xA;x(t - mT), &amp;amp; \text{if } |t| &amp;gt; \frac{T}{2} \text{ and where } m \triangleq \left\lfloor \frac{t}{T} + \frac{1}{2} \right\rfloor&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lfloor u \rfloor$ is the $\operatorname{floor}(u)$ function that is equal to the largest integer no larger the argument $u$.  (it's always rounding down.)  $\left\lfloor u + \frac{1}{2} \right\rfloor$ is always rounding to nearest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see that $\tilde{x}(t)$ satisfies periodicity:  $ \tilde{x}(t) = \tilde{x}(t+T) \quad \forall t $.  and you can also see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \lim_{T\to +\infty} \tilde{x}(t) \quad \forall t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we're taking a finite section of $x(t)$ and periodically extending that to get $\tilde{x}(t)$.  but as the period gets longer and longer and goes to $\infty$ the periodic extension becomes the same as $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now if you plug in $a_k$ into the Fourier sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tilde{x}(t) = \sum\limits_{k=-\infty}^{+\infty} \frac{1}{T} \int\limits_{-\frac{T}{2}}^{+\frac{T}{2}} \tilde{x}(u) \ e^{-j k \omega_0 u} \ du \ e^{j k \omega_0 t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and let $T \to +\infty$ ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;okay, i got back to this.  (sorry for the delay.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we've been saying&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x(t) &amp;amp; = \lim_{T \to \infty} \tilde{x}(t) \\&#xA;&amp;amp; = \lim_{T \to \infty} \sum\limits_{k=-\infty}^{+\infty} \frac{1}{T} \int\limits_{-\frac{T}{2}}^{+\frac{T}{2}} \tilde{x}(u) \ e^{-j k \omega_0 u} \ du \ e^{j k \omega_0 t}  \\&#xA;&amp;amp; = \lim_{T \to \infty} \sum\limits_{k=-\infty}^{+\infty} \frac{1}{T} \int\limits_{-\frac{T}{2}}^{+\frac{T}{2}} x(u) \ e^{-j k \omega_0 u} \ du \ e^{j k \omega_0 t}  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(note the subtle difference between the last two lines.  why can we do that?) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we're saying&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;\int\limits_{-\frac{T}{2}}^{+\frac{T}{2}} x(u) \ e^{-j k \omega_0 u} \ du &amp;amp; = \lim_{N \to +\infty} \sum\limits_{n=0}^{N-1} x\left(-\frac{T}{2} + n\frac{+\frac{T}{2} - (-\frac{T}{2})}{N} \right) \ e^{-j k \omega_0 \left(-\frac{T}{2} + n\frac{+\frac{T}{2} - (-\frac{T}{2})}{N} \right)} \   \frac{+\frac{T}{2} - (-\frac{T}{2})}{N} \\&#xA;&amp;amp; = \lim_{N \to +\infty} \sum\limits_{n=0}^{N-1} x\left(-\frac{T}{2} + n\frac{T}{N} \right) \ e^{-j k \omega_0 \left(-\frac{T}{2} + n\frac{T}{N} \right)} \   \frac{T}{N} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;putting the two limits together:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x(t) &amp;amp; = \lim_{T \to \infty} \sum\limits_{k=-\infty}^{+\infty} \frac{1}{T} \int\limits_{-\frac{T}{2}}^{+\frac{T}{2}} x(u) \ e^{-j k \omega_0 u} \ du \ e^{j k \omega_0 t}  \\&#xA;&amp;amp; = \lim_{T \to \infty} \sum\limits_{k=-\infty}^{+\infty} \frac{1}{T} \lim_{N \to +\infty} \sum\limits_{n=0}^{N-1} x\left(-\frac{T}{2} + n\frac{T}{N} \right) \ e^{-j k \omega_0 \left(-\frac{T}{2} + n\frac{T}{N} \right)} \   \frac{T}{N} \ e^{j k \omega_0 t}  \\&#xA;&amp;amp; = \lim_{T \to \infty} \lim_{N \to +\infty} \sum\limits_{k=-\infty}^{+\infty}   \sum\limits_{n=0}^{N-1} x\left(-\frac{T}{2} + n\frac{T}{N} \right) \ e^{-j k \omega_0 \left(-\frac{T}{2} + n\frac{T}{N} \right)} \   \frac{T}{N} \ e^{j k \omega_0 t} \frac{1}{T}  \\&#xA;&amp;amp; = \lim_{N \to +\infty} \sum\limits_{n=0}^{N-1} \lim_{T \to \infty}  \sum\limits_{k=-\infty}^{+\infty}    x\left(-\frac{T}{2} + n\frac{T}{N} \right) \ e^{-j k \omega_0 \left(-\frac{T}{2} + n\frac{T}{N} \right)} \   \frac{1}{N} \ e^{j k \omega_0 t}  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(answer not done yet, still being developed.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-10-20T23:39:38.407" LastActivityDate="2015-10-20T23:39:38.407" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26504" PostTypeId="2" ParentId="26499" CreationDate="2015-10-18T21:29:09.813" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;but I don't see how the quantity 'dsin(theta)' represents the extra distance&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let analyse just sensors &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;2&lt;/code&gt; also put $\theta$ 90 and 0 degrees and see what happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\theta$ = 0 degrees, which means that transmitter of the signal is situated in front and both sensors should receive the signal at the same time (isn't it?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Delta_i = { {d \cdot \sin {\theta} } \over {c} } = { {d \cdot 0 } \over {c} } = 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $\theta$ = 90 degrees, which means that transmitter of the signal is situated at the right hand and first sensors should receive the signal later. And delay should be time which need for signal travel the distance &lt;code&gt;d&lt;/code&gt; with velocity &lt;code&gt;c&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Delta_i = { {d \cdot \sin {\theta} } \over {c} } = { {d \cdot 1 } \over {c} } = {d \over c}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But anyway in my opinion the indexes of sensors should be in the opposite direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it helps you.&lt;/p&gt;&#xA;" OwnerUserId="10169" LastEditorUserId="80" LastEditDate="2015-10-19T00:23:59.243" LastActivityDate="2015-10-19T00:23:59.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26505" PostTypeId="2" ParentId="24782" CreationDate="2015-10-18T21:54:33.880" Score="2" Body="&lt;p&gt;A notch filter is a good approach in general for removing an unwanted frequency. But if you are certain of the &lt;strong&gt;exact&lt;/strong&gt; frequency, phase and amplitude of the unwanted sine wave, then you may also consider adding the noisy signal to a sine wave of the same frequency and amplitude but 180 degrees out of phase with the unwanted sine wave.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To illustrate the notch filter example, the plot below shows an attempt to generate a sine wave with some odd impulses (black), and then filter it with a notch filter knowing the exact frequency (red).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DHzKw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DHzKw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;R code for implementing it below.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 24782&#xA;# install.packages('signal')&#xA;&#xA;T &amp;lt;- 1024&#xA;t &amp;lt;- 0:(T-1)&#xA;&#xA;fs &amp;lt;- 1000&#xA;omega &amp;lt;- 2*pi*30/1000&#xA;phi &amp;lt;- 0.9279835&#xA;&#xA;x &amp;lt;- sin(omega*t + phi)&#xA;&#xA;changed &amp;lt;- sample(1:T, 10)&#xA;&#xA;y &amp;lt;- x&#xA;y[changed] &amp;lt;- y[changed] + 3&#xA;&#xA;alpha &amp;lt;- 0.9&#xA;num &amp;lt;- c(1, -2*cos(omega), 1)&#xA;den &amp;lt;- c(1, -2*alpha*cos(omega), alpha*alpha)&#xA;&#xA;yf &amp;lt;- signal::filter(num, den, y)&#xA;&#xA;plot(t,y, type=&quot;l&quot;, lwd=10)&#xA;lines(t,yf, col=&quot;red&quot;, lwd=4)&#xA;&#xA;legend(850, 4, c(&quot;Original&quot;, &quot;Filtered&quot;), lwd=c(2.5,2.5),col=c(&quot;black&quot;,&quot;red&quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15033" LastEditorUserId="80" LastEditDate="2015-10-20T13:20:43.313" LastActivityDate="2015-10-20T13:20:43.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26510" PostTypeId="2" ParentId="26433" CreationDate="2015-10-19T07:04:43.283" Score="2" Body="&lt;p&gt;The idea is to represent all operation sing Matrices.&lt;br /&gt;&#xA;Once it is done, it is easy to solve the problems as a Least Squares problems.&lt;/p&gt;&#xA;&lt;p&gt;The way to represent &lt;a href=&quot;https://en.wikipedia.org/wiki/Convolution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Convolution&lt;/a&gt; Operation using a Matrix is by &lt;a href=&quot;https://en.wikipedia.org/wiki/Toeplitz_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toeplitz Matrix&lt;/a&gt;.&lt;br /&gt;&#xA;For 1D it is pretty straight forward to do (Just pay attention to boundary).&lt;/p&gt;&#xA;&lt;p&gt;So let's take the simple model in the comment:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ g = f \circ h + n \rightarrow g = H f + n $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, the LS solution is easy:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \arg \min_{f} {\left \| H f - g \right \|}^{2}_{2} = { \left( {H}^{T} H \right) }^{-1} {H}^{T} g $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The matrix form for the regularized model is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \arg \min_{f} {\left \| H f - g \right \|}^{2}_{2} + \lambda {\left \| \Sigma f \right \|}^{2}_{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$ H $&lt;/span&gt; is the matrix Toeplitz Matrix generated from the Blur Kernel and &lt;span class=&quot;math-container&quot;&gt;$ \Sigma $&lt;/span&gt; is the Toeplitz matrix generated form of the derivative operator (In this case, keeps the signal smooth to regulate the High Pass property of the first term).&lt;/p&gt;&#xA;&lt;p&gt;This is actually &lt;a href=&quot;https://en.wikipedia.org/wiki/Tikhonov_regularization&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tikhonov Regularization&lt;/a&gt; and it is easily solved.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \arg \min_{f} {\left \| H f - g \right \|}^{2}_{2} + \lambda {\left \| \Sigma f \right \|}^{2}_{2}  = { \left( {H}^{T} H + \lambda {\Sigma}^{T} \Sigma \right) }^{-1} {H}^{T} g $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;All the above is pretty straight forward to calculate in MATLAB once the the &lt;span class=&quot;math-container&quot;&gt;$ H $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \Sigma $&lt;/span&gt; matrices are formed (Given the Convolution Kernel, the function &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/convmtx.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;convmtx&lt;/code&gt;&lt;/a&gt; can assist you generate the matrix).&lt;/p&gt;&#xA;&lt;p&gt;The way to create those matrices is pretty simple.&#xA;Given a signal of the length &lt;span class=&quot;math-container&quot;&gt;$ N $&lt;/span&gt; (Samples) implies those matrices are &lt;span class=&quot;math-container&quot;&gt;$ N \times N $&lt;/span&gt; (Assuming the output has the same number of samples).&lt;br /&gt;&#xA;Where the &lt;span class=&quot;math-container&quot;&gt;$ i $&lt;/span&gt; row of the matrix applies the linear combination for the &lt;span class=&quot;math-container&quot;&gt;$ i $&lt;/span&gt; output sample.&lt;/p&gt;&#xA;&lt;p&gt;For instance, given the Gradient Kernel and a signal of length 5 the matrix becomes:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{bmatrix}&#xA;1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1 \\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{bmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;One must pay attention to the rows on the beginning and the end to apply the required boundary conditions.&lt;br /&gt;&#xA;In the case above I chose zero boundary conditions (Last row).&lt;/p&gt;&#xA;&lt;p&gt;One should note, that in practice, the convolution matrix is not feasible due to memory limitations.&lt;br /&gt;&#xA;Hence it must be represented by a Sparse Matrix (Since it is mostly zeros) or the problem should be solved using a solver which doesn't require the matrix explicitly (Like &lt;a href=&quot;https://en.wikipedia.org/wiki/Conjugate_gradient_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;Conjugate Gradient&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Another note would be that if Circular Convolution is after (Imitating DFT Based Convolution) the matrices should not only be Toeplitz but &lt;a href=&quot;https://en.wikipedia.org/wiki/Circulant_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Circulant Matrices&lt;/a&gt; which means they enforce periodic boundary conditions (See the &lt;code&gt;circular&lt;/code&gt; property in MATLAB &lt;a href=&quot;http://www.mathworks.com/help/images/ref/padarray.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;padarray&lt;/code&gt;&lt;/a&gt; function).&lt;/p&gt;&#xA;&lt;p&gt;Here is a MATLAB Code for the exercise.&lt;br /&gt;&#xA;I only used 800 samples due to memory constraints.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;% Audio Deconvolution&#xA;% See http://dsp.stackexchange.com/questions/26433&#xA;&#xA;%% General Parameters and Initialization&#xA;&#xA;% The follwoing code must be executed before any of the following cells.&#xA;% The cells must be executed one after one in the order they are written.&#xA;clear();&#xA;close('all');&#xA;&#xA;set(0, 'DefaultFigureWindowStyle', 'docked');&#xA;defaultLooseInset = get(0, 'DefaultAxesLooseInset');&#xA;set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);&#xA;&#xA;titleFontSize   = 14;&#xA;axisFotnSize    = 12;&#xA;stringFontSize  = 12;&#xA;&#xA;thinLineWidth   = 2;&#xA;normalLineWidth = 3;&#xA;thickLineWidth  = 4;&#xA;&#xA;smallSizeData   = 36;&#xA;mediumSizeData  = 48;&#xA;bigSizeData     = 60;&#xA;&#xA;randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');&#xA;subStreamNumber = 57162;&#xA;set(randomNumberStream, 'Substream', subStreamNumber);&#xA;RandStream.setGlobalStream(randomNumberStream);&#xA;&#xA;addpath(genpath('RawData'));&#xA;addpath(genpath('AuxiliaryFunctions'));&#xA;&#xA;%% Loading Data&#xA;&#xA;load('input.mat');&#xA;load('handel.mat');&#xA;&#xA;vInputSignal    = input;&#xA;vRefSignal      = handel;&#xA;&#xA;vBlurKernel     = [0.0545; 0.2442; 0.4026; 0.2442; 0.0545];&#xA;vGradientKernel = [-1; 1]; % Forward Finite Differences&#xA;% vGradientKernel = [1; -1]; % Backward Finite Differences&#xA;&#xA;%% Parameters&#xA;% Limiting the Number of Samples due to Memory Constraints&#xA;numSamplesToProcess = 800;&#xA;&#xA;numSamples = size(vInputSignal, 1);&#xA;&#xA;numSamples = min([numSamplesToProcess, numSamples]);&#xA;&#xA;vInputSignal    = vInputSignal(1:numSamples);&#xA;vRefSignal      = vRefSignal(1:numSamples);&#xA;&#xA;% Creating the Operators in Matrix Form&#xA;mBlurKernel     = convmtx(vBlurKernel, numSamples);&#xA;mGradientKernel = convmtx(vGradientKernel, numSamples);&#xA;&#xA;% Enforcing size to match Convolution using 'same' property&#xA;mBlurKernel     = mBlurKernel(1:numSamples, :);&#xA;mGradientKernel = mGradientKernel(1:numSamples, :);&#xA;&#xA;% Enforcing Circulant Matrix (Like DFT Based Convolution)&#xA;mBlurKernel(1, (end - 3):end) = vBlurKernel(1:4);&#xA;mBlurKernel(2, (end - 2):end) = vBlurKernel(1:3);&#xA;mBlurKernel(3, (end - 1):end) = vBlurKernel(1:2);&#xA;mBlurKernel(4, (end - 0):end) = vBlurKernel(1:1);&#xA;&#xA;mGradientKernel(1, end:end) = vGradientKernel(1);&#xA;&#xA;regFactor = 0.02; % Regularization Factor - Lambda&#xA;&#xA;%% Least Squares Solution&#xA;&#xA;vLsRestoredSignal = (mBlurKernel.' * mBlurKernel) \ (mBlurKernel.' * vInputSignal);&#xA;&#xA;%% Regularized (Tikhonov) Least Squares Solution&#xA;&#xA;vRegLsRestoredSignal = ((mBlurKernel.' * mBlurKernel) + (regFactor * (mGradientKernel.' * mGradientKernel))) \ (mBlurKernel.' * vInputSignal);&#xA;&#xA;%% Display Results&#xA;&#xA;hFigure = figure();&#xA;hAxes   = axes();&#xA;hLineSeries = plot(1:numSamples, [vRefSignal, vInputSignal]);&#xA;set(hLineSeries, 'LineWidth', normalLineWidth);&#xA;set(get(hAxes, 'Title'), 'String', ['Reference and Input Signal'], ...&#xA;    'FontSize', titleFontSize);&#xA;set(get(hAxes, 'XLabel'), 'String', 'Samples Index', ...&#xA;    'FontSize', axisFotnSize);&#xA;set(get(hAxes, 'YLabel'), 'String', 'Samples Value', ...&#xA;    'FontSize', axisFotnSize);&#xA;hLegend = legend({['Reference Signal'], ['Input Signal']});&#xA;&#xA;&#xA;hFigure = figure();&#xA;hAxes   = axes();&#xA;hLineSeries = plot(1:numSamples, [vRefSignal, vLsRestoredSignal, vRegLsRestoredSignal]);&#xA;set(hLineSeries, 'LineWidth', normalLineWidth);&#xA;set(get(hAxes, 'Title'), 'String', ['Restored Signals and the Reference Signal'], ...&#xA;    'FontSize', titleFontSize);&#xA;set(get(hAxes, 'XLabel'), 'String', 'Samples Index', ...&#xA;    'FontSize', axisFotnSize);&#xA;set(get(hAxes, 'YLabel'), 'String', 'Samples Value', ...&#xA;    'FontSize', axisFotnSize);&#xA;hLegend = legend({['Reference Signal'], ['Least Squares Restored Signal'], ['Regularized Least Squares Restored Signal']});&#xA;&#xA;hFigure = figure();&#xA;hAxes   = axes();&#xA;hLineSeries = plot(1:numSamples, [vInputSignal, vLsRestoredSignal, vRegLsRestoredSignal]);&#xA;set(hLineSeries, 'LineWidth', normalLineWidth);&#xA;set(get(hAxes, 'Title'), 'String', ['Restored Signals and the Input Signal'], ...&#xA;    'FontSize', titleFontSize);&#xA;set(get(hAxes, 'XLabel'), 'String', 'Samples Index', ...&#xA;    'FontSize', axisFotnSize);&#xA;set(get(hAxes, 'YLabel'), 'String', 'Samples Value', ...&#xA;    'FontSize', axisFotnSize);&#xA;hLegend = legend({['Input Signal'], ['Least Squares Restored Signal'], ['Regularized Least Squares Restored Signal']});&#xA;&#xA;&#xA;&#xA;%% Restore Defaults&#xA;set(0, 'DefaultFigureWindowStyle', 'normal');&#xA;set(0, 'DefaultAxesLooseInset', defaultLooseInset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The code is available at GitHub - &lt;a href=&quot;https://github.com/RoyiAvital/StackExchangeCodes&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub StackExchangeCodes&lt;/a&gt; (Look at the &lt;code&gt;SignalProcessing\26433&lt;/code&gt; folder).&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2023-04-14T14:51:24.297" LastActivityDate="2023-04-14T14:51:24.297" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26511" PostTypeId="2" ParentId="26500" CreationDate="2015-10-19T08:09:56.053" Score="1" Body="&lt;p&gt;See first of all, you have confused magnitude spectrum to power spectrum. The figure you have shown in green is not power but amplitude spectrum hence y axis is represented as &quot;Magnitude&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is happening in the figure you have shown is the periodic signal is expressed as a trigonometric series where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)= a_0 +\sum_{k=1}^{\infty} [a_k\cos(k\omega_0t) +b_k\sin(k\omega_0t)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a_k$ and $b_k$ are trigonometric Fourier series coefficients and $\omega_0$ is fundamental period of signal x(t).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to express the amplitude and phase of the periodic signal in terms of Fourier series coefficients, trigonometric series representation is inconvenient as determining phase and magnitude of spectrum cannot be done directly from the above mentioned equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we generally express periodic signal in terms of polar form of Fourier series where the polar form is given by&#xA;$$x(t) = M_0 + \sum_{k=1}^{\infty} M_k \cos(k\omega_0t - \phi_k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where from the above expression you can see that $M_k$ denotes amplitude at kth harmonic and $\phi_k$ represents the phase of the kth harmonic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &#xA;$$M_0 =a_0$$ &#xA;To find the remaining terms $a_k$ and $b_k$ in terms of $M_k$ and $\phi_k$, let's expand the summation of both the expressions of $x(t)$ and equate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e.  $$a_k\cos(k\omega_0t) +b_k\sin(k\omega_0t) = M_k\cos(k\omega_0t-\phi_k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now expand the right hand side equation which is of form $\cos(A-B)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $$a_k \cos(k\omega_0t)+b_k \sin(k\omega_0t) = M_k\cos(k\omega_0t)\cos(\phi_k) +M_k \sin(k\omega_0t)\sin(\phi_k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so equating coefficients on both sides we get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_k = M_k \cos(\phi_k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $$b_k = M_k \sin(\phi_k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now to find magnitude $M_k$, square and add both the above terms, then we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M_k =\sqrt{a_k^2 +b_k^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and phase is obtained by dividing the expressions for $a_k$ and $b_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi_k = \arctan(b_k/a_k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the graph you have shown in green is the plotted $M_k$ values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you can also find magnitude and phase using exponential Fourier series coefficients, but then you will have both positive and negative harmonics in exponential Fourier series unlike trigonometric Fourier series which has only positive harmonics. So polar form can be seen as a direct equivalence with the trigonometric Fourier series coefficients.&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="8202" LastEditDate="2015-10-19T08:33:40.087" LastActivityDate="2015-10-19T08:33:40.087" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26513" PostTypeId="1" AcceptedAnswerId="26515" CreationDate="2015-10-19T12:20:05.470" Score="0" ViewCount="513" Body="&lt;p&gt;what is endpoint? I have a sample code to &lt;a href=&quot;http://de.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/4251/versions/1/download/zip/find_skel_ends.zip&quot; rel=&quot;nofollow&quot;&gt;detect endpoints&lt;/a&gt; . it finds endpoint with sample, but when i run for my sample tif image, it does not well. so I want know the exactly meaning of endpoint in image processing.&lt;/p&gt;&#xA;" OwnerUserId="17875" LastActivityDate="2015-10-19T14:28:06.557" Title="what is endpoint in image processing?" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26515" PostTypeId="2" ParentId="26513" CreationDate="2015-10-19T14:28:06.557" Score="1" Body="&lt;p&gt;This concept is related to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Topological_skeleton&quot; rel=&quot;nofollow&quot;&gt;topological skeletonization&lt;/a&gt; of an object in shape analysis. It produces a thin sert of lines equidistant to the boundaries, preserving  geometrical and topological properties of the object. Some use the term &lt;a href=&quot;https://en.wikipedia.org/wiki/Medial_axis&quot; rel=&quot;nofollow&quot;&gt;medial axis&lt;/a&gt;. Some points possess a specific interest: branch or junction points (where sereval lines meet, i.e. a point with more than two neighbors) and termination, terminating or end points (a point with less than two neighbors), located at extremities.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-10-19T14:28:06.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26516" PostTypeId="1" CreationDate="2015-10-19T15:46:15.870" Score="2" ViewCount="699" Body="&lt;p&gt;I'm using a cell-averaging constant false-alarm rate (CA-CFAR) detector to detect peaks like the first one in the following plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2jQZS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2jQZS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magenta line is the adaptive threshold, which is the local standard deviation multiplied by a contrast factor. What other peak-detection techniques could I try in this context?&lt;/p&gt;&#xA;" OwnerUserId="3980" LastActivityDate="2015-10-19T15:46:15.870" Title="Peak detection techniques" Tags="|signal-analysis|signal-detection|peak-detection|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26517" PostTypeId="2" ParentId="17462" CreationDate="2015-10-19T16:12:07.673" Score="1" Body="&lt;p&gt;I have written software which will remove a set of frequencies from an audio stream, in c++, which I use to remove 60 Hz power line contamination (essentially a 60 Hz square wave) from other signals, which might be useful. &#xA;the source code is included below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The included code was cut out of larger stuff with a text editor. Maybe a line or two is missing?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I run it on Ubuntu 15.04. This particular program sucks in the audio from either the line-in or mic input. The right channel is copied to the right channel output un altered. The left channel has the first 50 even harmonics&#xA;subtracted and copied and copied to the left channel output.That is, the frequencies 600, 180, 300, ..., 3060 Hz are removed. The width of the notch filter at each frequency is about 1 Hz. If you run a signal generator through the left channel, you will notice some distortion within a few Hz of each notch. For fun, I put the output of an FM radio into the line-in and plugged the headphones in, and distortion on the left channel was not that&#xA;bad at all, given the amount of processing going on.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;jackd and the development library are needed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sudo apt-get install jackd&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sudo apt-get install libjack-dev&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For some bizarre reason, you must do two crazy things...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Edit (via sudo gedit or whatever) /etc/security/limits.conf to contain&#xA;the line&#xA;    @audio    -    rtprio    99&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the username that runs the program is XXXX, you have to do&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;sudo usermod -a G audio XXXX&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The main program has the constants 4096 used, as the sample size of a block of data sucked in at a time. If the sound card on the machine cannot&#xA;handle this, or the machine is otherwise is slow, use 1024. This should always work.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There. I hope this is sufficiently self contained.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;File &lt;code&gt;freqs.h&lt;/code&gt;&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#ifndef FREQS_H_INCLUDED&#xA;#define FREQS_H_INCLUDED&#xA;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;memory.h&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;&#xA;class freq_info&#xA;{public:&#xA;double      Hz;     // The frequency of interest&#xA;double      w;      // 2 * pi * Hz&#xA;double      dt;     // delta time; time between samples&#xA;int         npts;       // number of points&#xA;double      tot_time;   // total time of all points&#xA;int         npts_1_cycle;&#xA;int         npts_max_cycles;&#xA;double      *cos_vals;&#xA;double      *sin_vals;&#xA;double      projection_sin;&#xA;double      projection_cos;&#xA;&#xA;double      data_X_sin;&#xA;double      data_X_cos;&#xA;int         npts_in_product;&#xA;&#xA;inline void zero() { memset( (void*)this, 0, sizeof(*this)); }&#xA;inline freq_info() { zero(); }&#xA;inline ~freq_info()&#xA;{&#xA;    if(cos_vals!=0) delete [] cos_vals;&#xA;    if(sin_vals!=0) delete [] sin_vals;&#xA;}&#xA;&#xA;int init( double frequency, double time_between_samples, int number_of_points);&#xA;&#xA;void projection_init();&#xA;&#xA;void data_X_trigs_range( float *data, int data_idx_beg, int data_idx_end);&#xA;&#xA;void projection_fini();&#xA;int  produce_projection ( float *data, unsigned int npts_in);&#xA;};&#xA;&#xA;class freq_group&#xA;{public:&#xA;&#xA;// Following 3 should be same for all frequencies of interest&#xA;double      dt;     // delta time; time between samples&#xA;int     npts;       // number of points&#xA;double      tot_time;   // total time of all points&#xA;&#xA;int     min_npts_max_cycles;  // minimum of npts_max_cycles for all&#xA;                              //    FI[i] entries&#xA;&#xA;double      info_freq_min;&#xA;double      info_freq_max;&#xA;&#xA;int     n_freqs;    // # frequencies&#xA;freq_info   *FI;        // Info for all frequencies of interest.&#xA;&#xA;inline void zero() { memset( (void*)this, 0, sizeof(*this)); }&#xA;inline freq_group() { zero(); }&#xA;&#xA;inline ~freq_group()&#xA;{&#xA;   if(FI!=0) delete [] FI;&#xA;}&#xA;&#xA;void set_time_and_points(double time_between_samples, int number_of_points);&#xA;&#xA;int setup_freqs( double * freqs_of_interest, int n_freqs_of_interest);&#xA;&#xA;int remove_projections1(float *data_in, float *data_out, unsigned int npts_in);&#xA;&#xA;};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;File &lt;code&gt;jack_interface.h&lt;/code&gt;&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#ifndef JACK_INTERFACE_H_INCLUDED&#xA;#define JACK_INTERFACE_H_INCLUDED&#xA;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;errno.h&amp;gt;&#xA;#include &amp;lt;unistd.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;string.h&amp;gt;&#xA;#include &amp;lt;jack/jack.h&amp;gt;&#xA;&#xA;//When we are finally running, this holds a bunch of info...&#xA;class jack_interface&#xA;{public:&#xA;    enum {max_channels=4};&#xA;    char            jack_interface_name[32];&#xA;    unsigned int    sample_size;&#xA;    unsigned int    samps_per_sec;&#xA;    jack_client_t   *jclient;&#xA;    int     n_channels;             // or, number of ports&#xA;    jack_port_t*    in_ports [max_channels];&#xA;    jack_port_t*    out_ports[max_channels];&#xA;&#xA;inline void zero() { memset( (void*)this, 0, sizeof(*this) ); }&#xA;inline jack_interface() { zero(); }&#xA;&#xA;int create( char*       interface_name,&#xA;        unsigned int    requested_sample_size,&#xA;        int     n_channels,&#xA;        int         (*process) (jack_nframes_t sample_size, void *arg) );&#xA;};&#xA;#endif JACK_INTERFACE_H_INCLUDED&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;File &lt;code&gt;freqs.cpp&lt;/code&gt;&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;freqs.h&quot;&#xA;inline void ZAP(char *msg=0)&#xA;{&#xA;    if(msg!=0) printf(&quot;%s\n&quot;, msg);&#xA;    printf(&quot;Fatal error.\n&quot;);&#xA;    exit(1);&#xA;}&#xA;&#xA;void freq_info::projection_init()&#xA;{&#xA;    projection_sin  = 0.0;&#xA;    projection_cos  = 0.0;&#xA;    data_X_sin  = 0.0;&#xA;    data_X_cos  = 0.0;&#xA;    npts_in_product = 0;&#xA;    return;&#xA;}&#xA;void freq_info::data_X_trigs_range(float *data, int data_idx_beg, int data_idx_end)&#xA;{&#xA;    static  char    name[]  =   &quot;freq_info::data_X_trigs_range(...)&quot;;&#xA;    int     i;&#xA;&#xA;    if( data_idx_beg&amp;lt;0  || data_idx_end&amp;lt;0   || data_idx_end&amp;lt;data_idx_beg    ||  data_idx_end&amp;gt;=npts)&#xA;&#xA;    {&#xA;        printf(&quot;%s\nInput ranges out of range.\n&quot;, name);&#xA;        ZAP();&#xA;    }&#xA;    for(i=data_idx_beg; i&amp;lt;=data_idx_end; i++)&#xA;    {&#xA;        data_X_sin += double( data[i] ) * sin_vals[i];&#xA;        data_X_cos += double( data[i] ) * cos_vals[i];&#xA;    }&#xA;    npts_in_product += data_idx_end - data_idx_beg + 1;&#xA;    return;&#xA;}&#xA;&#xA;void freq_info::projection_fini()&#xA;{&#xA;    projection_sin = (2.0 * data_X_sin * dt) / ( double(npts_in_product-1) * dt );&#xA;&#xA;    projection_cos = (2.0 * data_X_cos * dt) / ( double(npts_in_product-1) * dt );&#xA;&#xA;    return;&#xA;}&#xA;&#xA;void freq_group::set_time_and_points(double time_between_samples, int number_of_points)&#xA;{&#xA;    static  char    name[]  = &quot;freq_group::set_time_and_points(...)&quot;;&#xA;&#xA;    if(FI!=0) delete [] FI;&#xA;    zero();&#xA;&#xA;    if(time_between_samples&amp;lt;=0.0 || number_of_points&amp;lt;8)&#xA;    {&#xA;        printf(&quot;%s\nInput parameters too small.\n&quot;, name);&#xA;        ZAP();&#xA;    }&#xA;&#xA;    dt      = time_between_samples;&#xA;    npts        = number_of_points;&#xA;    tot_time    = double(npts-1) * dt;&#xA;   return;&#xA;} &#xA;&#xA;int freq_group::setup_freqs(double *freq_list, int n_freqs_in)&#xA;{&#xA;    static  char    name[]  = &quot;freq_group::setup_freqs(...)&quot;;&#xA;    int     rval=0;&#xA;    int     i;&#xA;    double  freq_min, freq_max;&#xA;&#xA;    n_freqs = n_freqs_in;&#xA;&#xA;    if(freq_list==0 || n_freqs&amp;lt;1)&#xA;    {&#xA;        printf(&quot;%s\nInput args null, zero, or invalid.\n&quot;, name);&#xA;        rval = 10;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;    if( dt&amp;lt;=0.0 || npts&amp;lt;8 || tot_time&amp;lt;=0.0 )&#xA;    {&#xA;        printf(&quot;%s\nfreq_group::set_time_and_points NOT called!\n&quot;, name);&#xA;        rval = 20;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;&#xA;    freq_min = 1.0e300;&#xA;    freq_max = 1.0e-300;&#xA;    for(i=0; i&amp;lt;n_freqs; i++)&#xA;    {&#xA;        if( freq_min &amp;gt; freq_list[i] )&#xA;            freq_min = freq_list[i];&#xA;&#xA;        if( freq_max &amp;lt; freq_list[i] )&#xA;            freq_max = freq_list[i];&#xA;    }&#xA;&#xA;    if(freq_min&amp;lt;=0.0 || freq_max&amp;lt;=0.0)&#xA;    {&#xA;        printf(&quot;%s\nSpecified frequency zero or negative.\n&quot;, name);&#xA;        rval = 30;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;    if( 1.0/freq_min &amp;gt; tot_time)&#xA;    {&#xA;        printf(&quot;%s\nSpecified frequency, %20.10e Hz, too low for time length of sample.\n&quot;, name, freq_min);&#xA;        rval = 40;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;    info_freq_min = freq_min;&#xA;    info_freq_max = freq_max;&#xA;&#xA;    if( dt &amp;gt; 2.0 * (1.0 / freq_max) )&#xA;    {&#xA;        printf(&quot;%s\nSpecified frequence, %20.10e Hz, too high for sample rate.\n&quot;, name, freq_max);&#xA;        rval = 50;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;    if(FI != 0)&#xA;    {&#xA;        delete [] FI;&#xA;    }&#xA;&#xA;    FI = new freq_info[ n_freqs ];&#xA;    min_npts_max_cycles = npts+2;&#xA;    for(i=0; i&amp;lt;n_freqs; i++)&#xA;    {&#xA;        rval = FI[i].init( freq_list[i], dt, npts);&#xA;        if(rval!=0)&#xA;        {&#xA;            printf(&quot;%s\nError from freq_info::init(...)\n&quot;, name);&#xA;            goto EXIT_SEQ;&#xA;        }&#xA;        if(min_npts_max_cycles &amp;gt; FI[i].npts_max_cycles)&#xA;        {&#xA;          min_npts_max_cycles = FI[i].npts_max_cycles;&#xA;        }&#xA;   }&#xA;&#xA;   EXIT_SEQ:;&#xA;  return rval;&#xA;}&#xA;&#xA;int freq_info::init( double frequency, double time_between_samples, int number_of_points)&#xA;{&#xA;    static  char    name[]  = &quot;freq_info::init(...)&quot;;&#xA;    int     rval=0;&#xA;    static double two_pi = 0.0;&#xA;&#xA;    int     i, max_cycles;&#xA;    double  arg;&#xA;&#xA;    if(frequency&amp;lt;=0 || time_between_samples&amp;lt;0.0 || number_of_points&amp;lt;8)&#xA;    {&#xA;        printf(&quot;%s\nInput parameters too small.\n&quot;, name);&#xA;        rval = 10;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;    if(two_pi == 0.0)&#xA;    {&#xA;        two_pi = 8.0 * atan( 1.0 );&#xA;    }&#xA;&#xA;    if(cos_vals!=0)&#xA;         delete [] cos_vals;&#xA;&#xA;    if(sin_vals!=0)&#xA;         delete [] sin_vals;&#xA;&#xA;    zero();&#xA;&#xA;    Hz      = frequency;&#xA;    w       = frequency * two_pi;&#xA;    dt      = time_between_samples;&#xA;    npts        = number_of_points;&#xA;    tot_time    = dt * double(npts - 1);&#xA;&#xA;    npts_1_cycle    = int(  (1.0/Hz) / time_between_samples  ) + 1;&#xA;    max_cycles = int( tot_time * Hz );&#xA; // Total # full cycles of Hz in the time period&#xA;    if(max_cycles&amp;lt;1)&#xA;    {&#xA;        printf(&quot;%s\nSpecified frequency too low for the time span.\n&quot;, name);&#xA;        rval = 30;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;&#xA;    npts_max_cycles = int(  (double(max_cycles)/Hz) / time_between_samples  ) + 1;&#xA;&#xA;    cos_vals = new double[npts+1];&#xA;    sin_vals = new double[npts+1];&#xA;&#xA;    for(i=0; i&amp;lt;npts; i++)&#xA;    {&#xA;        arg = w * double(i) * dt;&#xA;        sin_vals[i] = sin( arg );&#xA;        cos_vals[i] = cos( arg );&#xA;    }&#xA;&#xA;&#xA;EXIT_SEQ:;&#xA;return rval;&#xA;}&#xA;&#xA;int  freq_info::produce_projection ( float *data_in, unsigned int npts_in)&#xA;{&#xA;    static  char    name[]  = &quot;freq_group::produce_projection (...)&quot;;&#xA;    int     rval=0;&#xA;    if( int(npts_in) != npts)&#xA;    {&#xA;        printf(&quot;%s\nMismatch in # of data points.\n&quot;, name);&#xA;        rval = 10;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;&#xA;   projection_init();&#xA;   data_X_trigs_range(data_in, 0, this-&amp;gt;npts_max_cycles);&#xA;   projection_fini();&#xA;&#xA;EXIT_SEQ:;&#xA;    return rval;&#xA;}&#xA;&#xA;int freq_group::remove_projections1(float *data_in, float *data_out, unsigned int npts_in)&#xA;{&#xA;    static  char    name[]  = &quot;freq_group::remove_projections1(...)&quot;;&#xA;    int     rval=0;&#xA;    int     i,j,beg,end;&#xA;    double  accum;&#xA;&#xA;    if( int(npts_in) != npts)&#xA;    {&#xA;        printf(&quot;%s\nMismatch in # of data points.\n&quot;, name);&#xA;        rval = 10;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;    memset( (void*)data_out, 0, sizeof(*data_out) * npts_in);&#xA;&#xA;    for(i=0; i&amp;lt;this-&amp;gt;n_freqs; i++)&#xA;    {&#xA;        FI[i].projection_init();&#xA;    }&#xA;    for(i=0; i&amp;lt;this-&amp;gt;n_freqs; i++)&#xA;    {&#xA;        FI[i].data_X_trigs_range(data_in, 0, this-&amp;gt;min_npts_max_cycles);&#xA;    }&#xA;    for(i=0; i&amp;lt;this-&amp;gt;n_freqs; i++)&#xA;    {&#xA;        if(FI[i].npts_max_cycles==min_npts_max_cycles)&#xA;            continue;&#xA;    // have not quite finished a full cycle at this frequency yet...&#xA;        beg = min_npts_max_cycles + 1;&#xA;        end = FI[i].npts_max_cycles;&#xA;        FI[i].data_X_trigs_range(data_in, beg, end);&#xA;    }&#xA;&#xA;    for(i=0; i&amp;lt;this-&amp;gt;n_freqs; i++)&#xA;   {&#xA;        FI[i].projection_fini();&#xA;   }&#xA;&#xA;    // OK, have the projection of the data onto the various frequencies.&#xA;    // Remove it!&#xA;    for(i=0; i&amp;lt;npts; i++)&#xA;    {&#xA;        accum = 0.0;&#xA;        for(j=0; j&amp;lt;this-&amp;gt;n_freqs; j++)&#xA;        {&#xA;            accum +=    FI[j].projection_sin * FI[j].sin_vals[i] +&#xA;                    FI[j].projection_cos * FI[j].cos_vals[i];&#xA;        }&#xA;        data_out[i] = float( double(data_in[i]) - accum );&#xA;    }&#xA;&#xA;EXIT_SEQ:;&#xA;    return rval;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;File &lt;code&gt;jack_interface.cpp&lt;/code&gt;&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;jack_interface.h&quot;&#xA;&#xA;void jack_interface_shutdown (void *arg)&#xA;&#xA;{&#xA;// Do nothing&#xA;   return;&#xA;}&#xA;&#xA;int jack_interface::create( char*       interface_name,&#xA;                unsigned int    requested_sample_size,&#xA;                int     n_channels,&#xA;                int         (*process) (jack_nframes_t sample_size, void *arg) )&#xA;{&#xA;    static  char    name[]  = &quot;jack_interface::create(...)&quot;;&#xA;    int     rval=0;&#xA;    const  char     **ports;&#xA;    static char     default_interface_name[] = &quot;simple&quot;;&#xA;    const  char     *server_name = NULL;&#xA;    jack_options_t  options = JackNullOption;&#xA;    jack_status_t   status;&#xA;    char            *use_interface_name;&#xA;    unsigned int     use_sample_size;&#xA;    static  char    IN1[]   = &quot;in1&quot;;&#xA;    static  char    IN2[]   = &quot;in2&quot;;&#xA;    static  char    IN3[]   = &quot;in3&quot;;&#xA;    static  char    IN4[]   = &quot;in4&quot;;&#xA;    static  char    OUT1[]  = &quot;out1&quot;;&#xA;    static  char    OUT2[]  = &quot;out2&quot;;&#xA;    static  char    OUT3[]  = &quot;out3&quot;;&#xA;    static  char    OUT4[]  = &quot;out4&quot;;&#xA;    char*           names_in[max_channels];&#xA;    char*           names_out[max_channels];&#xA;    int     i;&#xA;&#xA;    // Validate (somewhat) args, etc.&#xA;    if(interface_name==0 || interface_name[0]==0)&#xA;        use_interface_name = default_interface_name;&#xA;    else&#xA;        use_interface_name = interface_name;&#xA;&#xA;    if(requested_sample_size==0)&#xA;        use_sample_size=1024;&#xA;    else&#xA;        use_sample_size = requested_sample_size;&#xA;&#xA;    if(n_channels&amp;lt;1 || n_channels&amp;gt;max_channels)&#xA;    {&#xA;        printf(&quot;%s\nn_channels must be between 1 and %d.\n&quot;, name, max_channels);&#xA;        rval = 10;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;    if(process==0)&#xA;    {&#xA;        printf(&quot;%s\nprocess function is null.\n&quot;, name);&#xA;        rval = 20;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;//--------------------------------------------------------&#xA;// open a client connection to the JACK server&#xA;    jclient = jack_client_open (use_interface_name, options, &amp;amp;status, server_name);&#xA;    if (jclient == NULL)&#xA;    {&#xA;        printf(&quot;%s\njack_client_open() failed, status = 0x%2.0x\n&quot;, name, status);&#xA;        if (status &amp;amp; JackServerFailed)&#xA;        {&#xA;            printf (&quot;Unable to connect to JACK server\n&quot;);&#xA;        }&#xA;        rval = 50;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;    jack_set_buffer_size(jclient, use_sample_size);&#xA;    sample_size = jack_get_buffer_size(jclient);&#xA;    samps_per_sec = jack_get_sample_rate (jclient);&#xA;    jack_set_process_callback (jclient, process, 0);&#xA;    jack_on_shutdown (jclient, jack_interface_shutdown, 0);&#xA;    names_in [0] = IN1;&#xA;    names_in [1] = IN2;&#xA;    names_in [2] = IN3;&#xA;    names_in [3] = IN4;&#xA;    names_out[0] = OUT1;&#xA;    names_out[1] = OUT2;&#xA;    names_out[2] = OUT3;&#xA;    names_out[3] = OUT4;&#xA;&#xA;for(i=0; i&amp;lt;n_channels; i++)&#xA;{&#xA;&#xA;    in_ports[i] = jack_port_register (jclient, names_in[i],&#xA;      JACK_DEFAULT_AUDIO_TYPE,&#xA;      JackPortIsInput, 0);&#xA;&#xA;    if(in_ports[i] == NULL)&#xA;    {&#xA;        printf(&quot;%s\nCannot create jack input port.\n&quot;, name);&#xA;        rval = 100;&#xA;        goto EXIT_SEQ;&#xA;&#xA;    }&#xA;}&#xA;for(i=0; i&amp;lt;n_channels; i++)&#xA;{&#xA;    out_ports[i] = jack_port_register (jclient, names_out[i],&#xA;       JACK_DEFAULT_AUDIO_TYPE,&#xA;        JackPortIsOutput, 0);&#xA;&#xA;    if(out_ports[i] == NULL)&#xA;    {&#xA;        printf(&quot;%s\nCannot create jack output port.\n&quot;, name);&#xA;        rval = 110;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;}&#xA;// Tell the JACK server to start.  Our&#xA;// process() callback will start running now.&#xA;&#xA;if (jack_activate (jclient))&#xA;{&#xA;    printf (&quot;%s\ncannot activate jack client\n&quot;, name);&#xA;    rval = 120;&#xA;    goto EXIT_SEQ;&#xA;}&#xA;&#xA;//  Connect the ports.  You can't do this before the client is&#xA;//  activated, because we can't make connections to clients&#xA;//  that aren't running.  Note the confusing (but necessary)&#xA;//  orientation of the driver backend ports: playback ports are&#xA;//  &quot;input&quot; to the backend, and capture ports are &quot;output&quot; from&#xA;//  it.&#xA;&#xA;ports = jack_get_ports (jclient, NULL, NULL,   JackPortIsPhysical|JackPortIsOutput);&#xA;&#xA;if (ports == NULL)&#xA;{&#xA;    printf(&quot;%s\nno physical capture ports #1\n&quot;, name);&#xA;    rval = 130;&#xA;    goto EXIT_SEQ;&#xA;}&#xA;for(i=0; i&amp;lt;n_channels; i++)&#xA;{&#xA;    if( jack_connect(jclient, ports[i], jack_port_name(in_ports[i]) ) )&#xA;    {&#xA;        printf(&quot;%s\nCannot connect input port # %d\n&quot;, name, i);&#xA;        rval = 140;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;}&#xA;free (ports);&#xA;&#xA;ports = jack_get_ports (jclient, NULL, NULL, JackPortIsPhysical|JackPortIsInput);&#xA;&#xA;if (ports == NULL)&#xA;{&#xA;    printf( &quot;%s\nno physical playback ports\n&quot;, name);&#xA;    rval = 150;&#xA;    goto EXIT_SEQ;&#xA;}&#xA;&#xA;for(i=0; i&amp;lt;n_channels; i++)&#xA;{&#xA;    if( jack_connect(jclient, jack_port_name(out_ports[i]), ports[i]) )&#xA;    {&#xA;        printf(&quot;%s\nCannot connect output port # %d\n&quot;, name, i);&#xA;        rval = 160;&#xA;        goto EXIT_SEQ;&#xA;    }&#xA;}&#xA;free (ports);&#xA;&#xA;EXIT_SEQ:;&#xA;return rval;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;File &lt;code&gt;main.cpp&lt;/code&gt;&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;errno.h&amp;gt;&#xA;#include &amp;lt;unistd.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;#include &amp;lt;jack/jack.h&amp;gt;&#xA;#include &quot;jack_interface.h&quot;&#xA;#include &quot;freqs.h&quot;&#xA;&#xA;enum { nports = 2 };  &#xA;static  jack_port_t     *in_ports [ nports ];       &#xA;static  jack_port_t *out_ports[ nports ];&#xA;static  jack_interface  JI;&#xA;static  jack_port_t     *input_portl;&#xA;static  jack_port_t     *input_portr;&#xA;static  jack_port_t     *output_portl;&#xA;static  jack_port_t     *output_portr;&#xA;static  unsigned int    samples_per_sec;&#xA;static  unsigned int    last_size = 0;&#xA;static  unsigned int    sample_size_out;&#xA;static freq_group FG;  &#xA;&#xA;int process (jack_nframes_t nframes, void *arg)&#xA;{&#xA;    jack_default_audio_sample_t *inl, *inr, *outl, *outr;&#xA;    input_portl = JI.in_ports[0];&#xA;    input_portr = JI.in_ports[1];&#xA;    output_portl= JI.out_ports[0];&#xA;    output_portr= JI.out_ports[1];&#xA;    inl     = (float*)  jack_port_get_buffer (input_portl,  nframes);&#xA;    inr     = (float*)  jack_port_get_buffer (input_portr,  nframes);&#xA;    outl    = (float*)  jack_port_get_buffer (output_portl, nframes);&#xA;    outr    = (float*)  jack_port_get_buffer (output_portr, nframes);&#xA;&#xA;    FG.remove_projections1(last_l_data, outl, nframes);&#xA;    memcpy (outr, last_r_data, sizeof (jack_default_audio_sample_t)*nframes);&#xA;&#xA;    return 0;&#xA;   }&#xA;&#xA;int main()&#xA;{&#xA;    static  char client_name[] = &quot;filter5&quot;;&#xA;    int     rval=0;&#xA;    int     i;&#xA;    enum { nfreqs = 50 };   // Will be filtering out 50 frequencies&#xA;    double Freqs[nfreqs];   // The list of frequencies to eleminate&#xA;    double  freq_base = 60.0;&#xA;    double  this_freq;&#xA;&#xA;    FG.set_time_and_points(1.0/48000.0, 4096);&#xA;&#xA;    for(i=0; i&amp;lt;nfreqs; i++)&#xA;    {&#xA;       this_freq = double(2*i + 1) * freq_base;&#xA;       Freqs[i] = this_freq;&#xA;    }&#xA;    FG.setup_freqs(Freqs, nfreqs);&#xA;    rval = JI.create(client_name, 4096, 2, process);&#xA;    sample_size_out = JI.sample_size;&#xA;    samples_per_sec = JI.samps_per_sec;&#xA;    sleep(-1);&#xA;   return rval;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17853" LastEditorUserId="8202" LastEditDate="2015-10-19T19:40:36.610" LastActivityDate="2015-10-19T19:40:36.610" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26518" PostTypeId="1" AcceptedAnswerId="26606" CreationDate="2015-10-19T18:16:42.300" Score="3" ViewCount="1000" Body="&lt;p&gt;I have a large image of a microscopic die of an integrated circuit. The pixel dimensions are something like 15000 x 10000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example image: &#xA;&lt;a href=&quot;http://tinytransistors.net/images/chips/Amiga_A500/Paula_total.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Commodore Amiga Paula Image http://tinytransistors.net/images/chips/Amiga_A500/Paula_total.jpg&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image contains a number of repeated structured subimages. Some large blocks might even repeat 3 or 4 times because there was a need for duplicated functionality. (See good candidates on the left of the example image)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to identify the largest(in pixel dimensions) repeating subimage block, and then highlight the locations of those subimages. I would repeat this process looking for the next largest repeating subimage block, highlight those, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, I don't have the subimages in advance. The problem isn't only to find the location of certain subimages within an image. That's Step two. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the image is in fact a color image, it could be easily turned into a gray-scale image without loss of content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is obviously some &quot;noise&quot; to an image like this, and there'd have to be some adjustable &quot;fudge factor&quot; on what to consider a match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I'm not entirely sure where to start on this&lt;/strong&gt;, or if this is even the correct SE. Would FFT be a potential solution? Using MatLab? Specific one-off image analysis tools?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could write some simple image analysis software that breaks an image up into smaller blocks, and then searches the image for those blocks. But this sounds &lt;strong&gt;incredibly&lt;/strong&gt; slow to me, and there's got to be a more efficient way to do this.&lt;/p&gt;&#xA;" OwnerUserId="17881" LastEditorUserId="17881" LastEditDate="2015-10-19T18:21:53.987" LastActivityDate="2015-10-28T22:13:34.647" Title="How do I identify repeated subimages within a larger image?" Tags="|image-processing|fft|algorithms|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26519" PostTypeId="1" AcceptedAnswerId="26523" CreationDate="2015-10-19T19:00:36.633" Score="4" ViewCount="3889" Body="&lt;p&gt;I am having difficulty in trying to understand the working mechanism of an equalizer. Please correct me where wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Mechanism of an Equalizer -&lt;/strong&gt; The purpose of an equalizer is to reduce intersymbol interference due to noise and fading effect. A linear equalizer is a filter that can undo these channel effects. When the channel coefficients $w$ are unknown, we perform blind equalization. In this scenario, we first estimate $w$ and then apply an equalizer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of an equalizer is a delayed version of the transmitted signal. This is what I do not understand. We need to find what is the input to the system, but the transmitted signal is not the input. What I mean to say, &#xA;let the channel model be a single input, single output moving average of order 2, MA(2): $y(n) = a_1*x(n-1) + a_2*x(n-2) + x(n) + \eta(n)$ where $x$ is the input data (unknown) and $\eta$ is an additive zero mean white Gaussian measurement noise; $n$ is the sample, $*$ is multiplication of the coefficient with the data.&#xA; If I do, &lt;code&gt;out_eq = conv(w,y)&lt;/code&gt; (In Matlab) where $w$ are the estimates and $y$ is the received signal that is transmitted, then how come the input $x$ is obtained through this operation? Another way is not to use &lt;code&gt;conv()&lt;/code&gt; and use an FIR &lt;code&gt;filter&lt;/code&gt; because I read that linear equalizers are FIR filter. I can understand the part where we do $out_eq = y./w' = x$ but how is this similar to the convolution or using FIR filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why Equalizers are linear filter?&lt;/strong&gt; - posted as a new Question&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Suggestion on what equalizer I should use for my case&lt;/strong&gt;- I have a Rayleigh fading channel that is modeled as FIR filter. Let the impulse response / channel be $h$. Then the transmitted signal $tx(n) = h.*x(n) + AWGN$. I wish to apply Expectation Maximization and Kalman filter to estimate the $h$. Then, how do I equalize and which equalizer to apply and why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE :&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; -&lt;br&gt;&#xA;Part (1) - Mechanism of equalizer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference - Book Blind Equalization &amp;amp; System Identification, batch processing Algorithm, performance &amp;amp; applications, by Chong-Yung Chi, Springer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chapter 4 defines blind linear equalization for Single input single output (SISO). Suppose that $u[n]$ is the source signal of interest and is distroted by SIS LTI system $h[n]$ via the data model:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = x[n] + w[n]$ where $x[n] = h[n]*u[n]$ is the noise free signal and $w[n]$ is the additive measurement noise.&#xA; The goal of designing an equalizer $v[n]$ is such that the output of the equalizer given by $e[n] = v[n]*y[n]$ approximates $u[n]$ as well as possible. $e[n]$ is called the equalized signal.  The book says that we can do blind equalization through the following steps&#xA;(a) estimation of $h[n]$ by means of blind system identification algorithm (b) design of a non-blind equalizer with these estimated parameters for the retreival of $u[n]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Confusion on Terminology problem and mechanism&lt;/em&gt;&lt;/strong&gt;&#xA; : I was under the impression that the output of the equalizer is the source input to the system, as in case of an ideal equalizer we perform the operation &lt;code&gt;out_equalizer = received_signal./channel_coefficients =  h[n]*u[n] = y./h&lt;/code&gt;and looking at this equation,  &lt;code&gt;out_equalizer = u&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other cases when we Constant Modulus ALgorithm, we use convolution or the FIR filter as &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter(estimates_channel_coefficients,1,received_signal)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, according to the book, the output of the equalizer  is not = received_signal./channel_coefficients. How will the operation $e[n]$ give me the input $u[n]$? Can you please explain how the equation for $e[n]$ is the output of the equalizer that gives the input $u[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Confusion - What is the output of the Equalizer-&lt;/em&gt;&lt;/strong&gt; is it the transmitted signal (noise-free) or the input to the system?Your answer says that the output of the equalizer is the transmitted signal but the book says it should be the input to the system. But the transmitted signal is a noise free signal which is the convolution of the channel coefficients and the input source. &lt;em&gt;The received signal is the input of your equalizer&lt;/em&gt; - Understood&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;you need to find the transmitted signal. It could be considered the input of your channel (the channel can be modeled as a FIR filter).&lt;/em&gt; - Can you elaborate on this a bit more? My understanding is say if the impulse response of the channel is modeled as a FIR filter, then how is the transmitted signal = input of this channel? Considering the MA(2) that I have put in the question, the transmitted signal is $\mathbf{y}$ but it is not the input to the channel. The input to the channel is $x[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PART (2) - Choosing an equalizer for my case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the Rayleigh fading channel is a one tap FIR filter, then the ideal equalizer (dividing the recieved signal by estimated $h$) would work fine, based on your answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But , if it is an $m$ tap filter, then I should resort to some other techniques as you have said. Would another FIR filter as an equalizer be applicable? I know of Zero-forcing, MMSE techniques but was thinking of using the linear filter as most books say that equalizers are mostly FIR filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="5119" LastEditDate="2015-10-20T07:56:27.677" LastActivityDate="2015-10-20T20:17:42.640" Title="Design of equalizer for wireless communication" Tags="|equalization|self-study|equalizer|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26520" PostTypeId="1" CreationDate="2015-10-19T19:34:08.417" Score="0" ViewCount="64" Body="&lt;p&gt;I feel like it is a very silly question so I feel ashamed to ask my professor. So i would appreciate it if anybody would help me understand this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that $x(n-a)$ shifts the function $x(n)$ to the right side of $x$ axis by $a$ units.&#xA;In aliasing , $x(n+rN)$ is the representation of $x(n)$ shifted to the right by multiples of $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aren't these two contracting because acc to time shifting $x(n+N)$ should shift the signal by $N$ to the left.&lt;/p&gt;&#xA;" OwnerUserId="17882" LastEditorUserId="1629" LastEditDate="2015-10-20T11:44:52.993" LastActivityDate="2015-10-20T11:44:52.993" Title="aliasing and time shifting" Tags="|dsp-core|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26522" PostTypeId="2" ParentId="26489" CreationDate="2015-10-19T19:56:41.663" Score="5" Body="&lt;p&gt;To answer your final question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is it that the estimation community ignores the use of a discrete lowpass filter for estimation? As far as I can tell it's the best approach to estimate the signal above.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's because you're feeding them the wrong signal model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR: Use the right tool for the job!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Gory Details&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any time you start in with the Kalman Filter, you are assuming that the signal (&lt;code&gt;measurement&lt;/code&gt; in your equations above) was generated as:&#xA;$$&#xA;x[k+1] = \mathbf{A} x[k] + u[k]\\&#xA;\mbox{measurement}[k] = \mathbf{H} x[k] + v[k]&#xA;$$&#xA;where&#xA;$$&#xA;\mathbf{A} = \left [ \begin{array}{cc}&#xA;1 &amp;amp; 1 \\&#xA;0 &amp;amp; 1&#xA;\end{array} \right]\\&#xA;\mathbf{H} = \left [ \begin{array}{cc}&#xA;1 &amp;amp; 0 &#xA;\end{array} \right]\\&#xA;$$&#xA;and $u$ and $v$ are zero mean, Gaussian distributed, independent random variables with covariances&#xA;$$&#xA;\mathbf{Q} = \left [ \begin{array}{cc}&#xA;1.6 &amp;amp; 2.4 \\&#xA;2.4 &amp;amp; 4.8&#xA;\end{array} \right] \times 10^{-9}\\&#xA;\mathbf{R} = 2.35 \times 10^{-6}\\&#xA;$$&#xA;At least for the equations you cite. More general application of the KF is possible, but usually not done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, one thing that might be done to improve your estimates is to ensure that $\mathbf{Q}$ and $\mathbf{R}$ are closer to reality.  From the look of things, your process noise ($u[k]$) has about the same variance as your measurement noise ($v[k]$).  Make them closer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More importantly, your signal is correlated with your noise because, rather than stochastic noise, you have harmonic noise. Even worse: you have &lt;em&gt;synchronized&lt;/em&gt; harmonic noise (meaning the noise moves in lockstep with your signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: the problem is that by using the Kalman Filter your signal model is all wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A better model for the signal is in the frequency domain:  the signal is low frequency. The noise is high frequency.  So, a low pass filter will do a much better job of improving things that the Kalman Filter can hope to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I apply the Kalman filter to your problem (with some modifications to your equations to take account of the difference between $\mathbf{X}[k|k-1]$ and  $\mathbf{X}[k|k]$) then I get the picture below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The black curve with dots is the &lt;code&gt;measurement&lt;/code&gt;.  The red curve is &lt;code&gt;signal&lt;/code&gt;.  The blue curve is the output of the Kalman filter.  The green curve is the output of a 5 point moving average filter (a simple low pass filter). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VNn0I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VNn0I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sum of squared errors for the Kalman filter is &lt;code&gt;118.63722&lt;/code&gt;. The same figure for the low pass filter is &lt;code&gt;14.18046&lt;/code&gt;.  Clearly, the signal model of a low pass filter fits better because the error is smaller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;R code to implement this is below.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 26489&#xA;T &amp;lt;- 128;&#xA;t &amp;lt;- 0:(T-1)/T*70&#xA;&#xA;signal &amp;lt;- 4.4 + sin(0.06*pi*t - 0.1) + sin(0.14*pi*t + 0.07) + sin(0.2*pi*t + 0.4)&#xA;noise &amp;lt;- sin(0.06 + 0.5*pi*t) + sin(0.1 - 0.68*pi*t) - sin(0.04 - 0.74*pi*t) + sin(0.03 - 0.93*pi*t)&#xA;&#xA;measurement &amp;lt;- signal + noise&#xA;&#xA;&#xA;xkm1km1 &amp;lt;- matrix(c(4.4, 0),2,1)&#xA;Pkm1km1 &amp;lt;- matrix(c(1,0,0,1),2,2)&#xA;H &amp;lt;- matrix(c(1,0),1,2) &#xA;A &amp;lt;- matrix(c(1,1,0,1),2,2)&#xA;Q &amp;lt;- 10^-6 * matrix(c(1.6,2.4,2.4,4.8),2,2)&#xA;R &amp;lt;- 10^-6 * matrix(c(2.35),1,1)&#xA;&#xA;library(&quot;MASS&quot;) # For pseudo inverse ginv()&#xA;&#xA;zhat &amp;lt;- t*0&#xA;&#xA;for (k in 1:T)&#xA;{&#xA;  xkkm1 &amp;lt;- A %*% xkm1km1&#xA;  Pkkm1 &amp;lt;- A %*% Pkm1km1 %*% t(A) + Q&#xA;  K &amp;lt;- Pkkm1 %*% t(H) %*% ginv( H %*% Pkkm1 %*% t(H) + R)&#xA;  z &amp;lt;- matrix(c(measurement[k]), 1, 1)&#xA;  xkm1km1 &amp;lt;- xkkm1 + K %*% (z - H %*% xkkm1)&#xA;  Pkm1km1 &amp;lt;- (matrix(c(1,0,0,1),2,2) - K %*% H) %*% Pkkm1  &#xA;  zhat[k] &amp;lt;- as.numeric(H %*% xkkm1)&#xA;}&#xA;&#xA;plot(t, measurement, type=&quot;b&quot;, pch=19)&#xA;lines(t, signal, col=&quot;red&quot;,  lwd=10)&#xA;lines(t, zhat, col=&quot;blue&quot;, lwd=5)&#xA;&#xA;lpf &amp;lt;-  filter(measurement, c(0.2,0.2,0.2,0.2,0.2), circular = TRUE)&#xA;lines(t,lpf, col=&quot;green&quot;, lwd=4)&#xA;&#xA;errs &amp;lt;- c(sum((signal - zhat)^2), sum((signal - lpf)^2))&#xA;print(errs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-20T00:22:38.310" LastActivityDate="2015-10-20T00:22:38.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26523" PostTypeId="2" ParentId="26519" CreationDate="2015-10-19T21:53:12.700" Score="4" Body="&lt;p&gt;Ok, there is some misconceptions in your question. I strongly recommend you to read a little more about the topics, but I will try to help you a little. My answers and some comments: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...linear equalizer is a filter that can undo these channel effects. When&#xA;  the channel coefficients w are unknown, we perform blind equalization.&#xA;  In this scenario, we first estimate w and then apply an equalizer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, the linear equalizer is a filter that can undo the effects caused by the channel. When you don't know the channel coefficients, you can perform blind equalization, but it is not estimate the channel coefficients and them apply equalization. Those are things completely different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you perform blind equalization, you don't necessary need to know the channel coefficients. There are equalizers that need the channel information and equalizer that don't. and this has nothing to do with blind equalization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The act of estimate the channel coefficients is called Channel Estimation, and there are a lot of techniques on how to do that. It is used when you have an equalizer that need the information of the channel coefficients, but it is unknown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To perform an equalization without knowing the channel coefficients, or even to perform channel estimation, you need something called training sequence. It is a sequence previous defined, that both transmitter and receiver know, and the receiver use this information to estimate the channel or to perform equalization. If you have an equalizer that doesn't need a training sequence to perform the equalization, you have a blind equalizer. The linear equalizer is not a blind equalizer because you need the channel estimation, and the channel estimator uses training sequence to estimate the channel.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The output of an equalizer is a delayed version of the transmitted signal. &gt; This is what I do not understand. We need to find what is the input to&#xA;  the system, but the transmitted signal is not the input.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are right when you say that the output equalizer is a delayed version of the transmitted signal. What you didn'1t understand yet is that the transmitted signal is different from the received signal. The transmitted signal doesn't have the channel effects yet, and the received signal do. The received signal is the input of your equalizer. and no, you don't need to find the input of your equalizer, you need to find the transmitted signal. It could be considered the input of your channel (the channel can be modeled as a FIR filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can only use the equation outeq = y./w′ if you have a flat channel. If your channel is not flat, this equation will not work. A flat channel is a channel that only has a multiplicative effect in the transmitted signal. Imagine that you will perform a convolution, but the filter that represents your channel has only one coefficient. That's why you can just divide things in the receiver to perform equalization. But be careful, if you are not using OFDM (a robust technique against frequency selective channels) or if your channel has more than one coefficient, your channel will not be flat (it is more complex than this, but it is the main idea).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Then, how do I equalize and which equalizer to apply and why?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are a lot of ways of doing that. I suggest you to start from the basic. Read a little about Zero Forcing equalizers, MSE equalizers and Maximum Likelihood Sequence Estimation. without more details, it is difficult to tell you which one to use. What you want to achieve? What is your goal? Each one has its advantages and disadvantages. Read a little bit about them and you will be able to determine which one you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the figure to understand better:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DfeYD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DfeYD.png&quot; alt=&quot;Channel equalization scheme&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this figure, you can see that the transmitted signal is the input of the channel filter (a FIR filter). The output of this filter is the received signal, which is the input of the equalizer. I have just drawn the main blocks to show the concept of equalization. Of course you can add the channel estimation block and other things inside the receiver block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients of your equalizer are not the same coefficients of your channel filter. The impulse response of your equalizer must be in such a way that it corrects the effects imposed by the channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you project an equalizer, you want the output of you equalizer to be an estimation of the input of your channel, that in the figure I called the transmitted signal.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But , if it is an m tap filter, then I should resort to some other&#xA;  techniques as you have said. Would another FIR filter as an equalizer&#xA;  be applicable? I know of Zero-forcing, MMSE techniques but was&#xA;  thinking of using the linear filter as most books say that equalizers&#xA;  are mostly FIR filters.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But ZF and MMSE equalization are techniques to find the taps of a linear FIR filter with as many taps as you want. Once you have found the taps through one of this techniques, you can just use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filter(equalizer_coefficients, 1, received_signal)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You use the ZF and MMSE to find the equalizer_coefficients. Once you have it, you just need to perform the filtering. The only problem is that these techniques are not blind techniques because they use training sequences to find the taps. If you want a blind technique, you can search for CMA equalization, for example, but the technique that you should use will depend directly of the nature of your signal. Is a modulated signal? What kind of modulation you have?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You said that you are using Kalman Filter and expectation to estimate your channel impulse response. Once you have it, you can easily use the ZF technique to find the equalizer coefficients, for example. And your equalizer surely will be a linear FIR filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if I could make it more clear.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="17125" LastEditDate="2015-10-20T20:17:42.640" LastActivityDate="2015-10-20T20:17:42.640" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26528" PostTypeId="2" ParentId="26463" CreationDate="2015-10-20T07:28:47.797" Score="1" Body="&lt;p&gt;@user85858302: If designing a complex-valued bandpass filter is the solution to your problem, you can design such a filter without using the Hilbert transform. Start by using your favorite method for designing a real-valued N-tap FIR lowpass filter whose one-sided bandwidth is B Hz. That will give you N real-valued coefficients. Next, multiply those coefficients by a complex exponential whose frequency is Fc Hz. (Fc must be sufficiently less than half your data’s Fs sample rate.) That will produce N complex-valued coefficients that can be used in a tapped-delay line FIR filter block diagram. The complex-valued bandpass filter will have frequency response whose center frequency is Fc Hz and a bandwidth of 2B Hz.  Model this whole process in software to demonstrate what I'm sayin' here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those readers interested in both real-valued and complex-valued FIR filters, I suggest you have look at the following blog. You may well learn something new about FIR filters. &lt;a href=&quot;http://www.dsprelated.com/showarticle/808.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showarticle/808.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-20T07:28:47.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26531" PostTypeId="1" CreationDate="2015-10-20T10:19:48.380" Score="2" ViewCount="1913" Body="&lt;p&gt;I have a quick question about the number of samples in one period of a sub carrier in OFDM systems. The IFFT process generates N-parallel sub carriers in discrete time domain which are sent simultaneously over the sub carrier frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the number of samples in one period of a sub carrier after IFFT?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Thanks for your reply. Let me give you more details about my query with an illustration as below. The picture shows the sub carriers as analog but lets take them as discrete before DAC and CP addition. The system has 4 sub carriers and hence they have different frequencies. My questions is here at this point; again assuming they are just the output of the IFFT and digital- &#xA;Does each sub carrier has 4 samples in every cycle? So lets say the duration of OFDM symbol is T seconds. The subcarrier1 has 1 cycle and I am visualizing that the sub carrier has 4 samples during the T seconds.&#xA;Subcarrier2 has 2 cycles (period) and hence it has 2x4=8 samples during the OFDM T seonds.&#xA;And for subcarrier3 it has 3x4=12 samples.&#xA;For subcarrier4, there are 4x4=16 samples during the OFDM symbol (T seconds length).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in total, the OFDM symbol has 36 samples in the symbol length T seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct interpreting this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GEtIA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GEtIA.jpg&quot; alt=&quot;IFFT Output&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9014" LastEditorUserId="80" LastEditDate="2015-10-20T12:09:55.467" LastActivityDate="2015-10-22T08:38:02.883" Title="Number of samples in one period of subcarrier after IFFT" Tags="|ofdm|ifft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26533" PostTypeId="1" AcceptedAnswerId="26546" CreationDate="2015-10-20T13:26:05.653" Score="3" ViewCount="3243" Body="&lt;p&gt;I would like to know if the following method of 2x oversampling is correct:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interpolate:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take an original signal sampled at 44100Hz as input&lt;/li&gt;&#xA;&lt;li&gt;Upsample by adding a zero after each original sample to get a signal twice as long&lt;/li&gt;&#xA;&lt;li&gt;Filter the new signal using a low pass filter (cutoff of 44100Hz based on new sample rate of 88200Hz)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Use new signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do some additional filtering of the the new signal at 88200Hz&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Decimate:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take the final signal at 88200Hz as input&lt;/li&gt;&#xA;&lt;li&gt;Filter using a low pass filter (cutoff of 44100Hz based on sample rate of 88200Hz)&lt;/li&gt;&#xA;&lt;li&gt;Downsample by removing every other (odd) sample&lt;/li&gt;&#xA;&lt;li&gt;Now have a signal that is 44100Hz again&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I would like to check is if the method is correct and my cut off frequencies for my low pass filters are right.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastActivityDate="2017-06-22T04:28:28.923" Title="Basic method for 2x oversampling?" Tags="|interpolation|resampling|decimation|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26534" PostTypeId="2" ParentId="26533" CreationDate="2015-10-20T13:31:20.240" Score="3" Body="&lt;p&gt;Yes, your method is correct, and will work just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can reduce the computational load by combining the upsampling (insertion of zeros) and low-pass filter into a single interpolating filter, and combining the low-pass filter and removal of samples into a single decimating filter, but that is not necessary to get correct results.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-10-20T13:31:20.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26535" PostTypeId="2" ParentId="26531" CreationDate="2015-10-20T13:34:03.170" Score="4" Body="&lt;p&gt;You need as many samples as you have subcarriers.  If you have 64 carriers, then you need 64 samples.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2015-10-20T13:34:03.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26536" PostTypeId="1" AcceptedAnswerId="26538" CreationDate="2015-10-20T14:12:41.030" Score="2" ViewCount="2655" Body="&lt;p&gt;In my thesis I try to explain what kernel based methods are, especially the meaning for object detection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know kernel based methods like &lt;a href=&quot;http://docs.opencv.org/master/db/df8/tutorial_py_meanshift.html&quot; rel=&quot;nofollow&quot;&gt;Mean- and CamShift&lt;/a&gt; and I know how to use them. I understand how the shift work. But: What does the kernel do, what does he describe? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know, wikipedia have articles about kernels but I still don´t get it. :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: What could be an subset for an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: How does the kernel project the points in an image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q3: Could you give me an simple example to understand kernels?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="10904" LastActivityDate="2015-10-20T16:36:47.130" Title="What does &quot;kernel based&quot; mean?" Tags="|image-processing|algorithms|matrix|tracking|visual-tracking|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26537" PostTypeId="1" CreationDate="2015-10-20T14:42:01.497" Score="1" ViewCount="192" Body="&lt;p&gt;In cepstral speech analysis, it is relatively easy to understand why subtracting the mean removes any &quot;channel&quot; effects (including that of recording equipment and the vocal tract). There is a good explanation of that &lt;a href=&quot;https://dsp.stackexchange.com/a/19567/16944&quot;&gt;here&lt;/a&gt;. But why does dividing by the variance (after the mean has been subtracted) also give a similar (additional) improvement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtraction in the quefrency-domain corresponds to de-multiplication in the frequency domain, which corresponds to de-convolution in the time domain. Can a similar analogy or explanation be given for division in the quefrency-domain?&lt;/p&gt;&#xA;" OwnerUserId="16944" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-10-21T09:35:26.117" Title="Cepstrum: subtracting the mean vs. dividing by the variance" Tags="|normalization|cepstral-analysis|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26538" PostTypeId="2" ParentId="26536" CreationDate="2015-10-20T14:43:52.993" Score="3" Body="&lt;p&gt;In general, a kernel is a function that acts as a parameter to some algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Filtering:&lt;/strong&gt; For example, it's possible to call the impulse response of a filter $h[n]$ a kernel, so that it is the parameter that defines the filter operation:&#xA;$$&#xA;y[n] = h[n] * x[n].&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The use of the term kernel in the filtering context is &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/kernel.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;much more common in 2D filtering or image processing.&lt;/a&gt;  The link talks about the kernel being a matrix, but really it's just a sampling of the function that is the &quot;true&quot; kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PDF Estimation:&lt;/strong&gt; Kernel-based methods are often used in other contexts, too.  For example, when estimating the probability density function of a random variable, &lt;a href=&quot;https://en.wikipedia.org/wiki/Kernel_density_estimation&quot; rel=&quot;nofollow noreferrer&quot;&gt;kernel-based estimators&lt;/a&gt; are often preferable to simple histogramming.  &lt;a href=&quot;https://en.wikipedia.org/wiki/Kernel_(statistics)#Kernel_functions_in_common_use&quot; rel=&quot;nofollow noreferrer&quot;&gt;In that context, there are many different possible kernels.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f6pZm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f6pZm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Machine Learning:&lt;/strong&gt; Finally, another context for kernel based algorithms is in &lt;a href=&quot;https://en.wikipedia.org/wiki/Kernel_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;machine learning&lt;/a&gt;.  Here, we are interested in classification of an input into one of (possibly) many classes.  Again, the kernel is a function $k(\mathbf{x}_i,\mathbf{x}')$ that parametrizes the algorithm and &lt;a href=&quot;https://en.wikipedia.org/wiki/Kernel_method#Popular_kernels&quot; rel=&quot;nofollow noreferrer&quot;&gt;there are many possible selections.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-20T16:36:47.130" LastActivityDate="2015-10-20T16:36:47.130" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26539" PostTypeId="1" CreationDate="2015-10-20T15:47:54.697" Score="1" ViewCount="371" Body="&lt;p&gt;I'm hoping someone can sanity check this idea as I am admittedly a bit of a noob when it comes to working with FFT's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have two (registered) images of two of the same object and want to use one as a baseline to check for differences in quality control.  My initial naive approach is to just subtract the two images directly and then whatever remains can be treated as defects.  However, this method is subject to error in the presence of illumination differences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking that I would be better served if I take the FFT of the images, and subtract only the phase information, and then use the IFFT of that result as the defect map, and that this should hopefully eliminate false positives due to lighting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this seem like a reasonable assumption or is there some kind of detail that I'm overlooking?  Thanks for any advice you can offer!&lt;/p&gt;&#xA;" OwnerUserId="17418" LastActivityDate="2015-10-21T23:47:12.493" Title="Would subtracting the phases of two images be a superior difference metric than subtracting the images directly?" Tags="|fft|phase|ifft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26541" PostTypeId="2" ParentId="26533" CreationDate="2015-10-20T16:26:14.657" Score="1" Body="&lt;p&gt;When downsampling, the cut-off of the low-pass filter, needed to prevent aliasing, should be at or (more realistically) below half the new target sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you start with a signal that is already band-limited below 22kHz, and only perform noiseless linear filtering on it, this additional anti-alias filtering might be redundant (for a target rate of 44.1k).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2017-06-22T04:28:28.923" LastActivityDate="2017-06-22T04:28:28.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26542" PostTypeId="1" CreationDate="2015-10-20T16:44:40.097" Score="4" ViewCount="1626" Body="&lt;p&gt;From link: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Black-to-White transition is taken as Positive slope (it has a&#xA;  positive value) while White-to-Black transition is taken as a Negative&#xA;  slope (It has negative value). So when you convert data to np.uint8,&#xA;  all negative slopes are made zero. In simple words, you miss that&#xA;  edge.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So all i want is to write a function so i can keep negative gradient values.&#xA;I know how to use Sobel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_gradients/py_gradients.html&quot; rel=&quot;noreferrer&quot;&gt;Here is the sobel link &lt;/a&gt;where I got to know light-to-dark, dark-to-light are gradient directions, which are also referred as $+\text ve$ and $-\text ve$ directions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;IMPROVED Question:&lt;/strong&gt;&#xA;Please Suggest me a logic of the function to retain only $-\text ve$ values and clip $+\text ve$ values to zero?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;My code:&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sobel(grayImg, grad, CV_16S, 0, 1, -1, BORDER_DEFAULT);&#xA;         gradCpy = grad.clone();&#xA;         for(uint64_t i=0; i &amp;lt;(gradCpy.rows); i++)&#xA;    {&#xA;        for(uint64_t j=0; j&amp;lt;(gradCpy.cols); j++)&#xA;        {&#xA;            if ((gradCpy.data[((gradCpy.step/gradCpy.elemSize()))*i+j]) &amp;gt; 0) {(gradCpy.data[(gradCpy.step/gradCpy.elemSize())*i+j]) = (int32_t)-0.0;} ///nega gradient img&#xA;            //if ((gradCpy.data[((gradCpy.step/gradCpy.elemSize()))*i+j]) &amp;lt; 0.0) {gradCpy.data[((gradCpy.step/gradCpy.elemSize()))*i+j] = (int16_t)+0.0;}   ///pos gradient img&#xA;        } &#xA;    }&#xA;    convertScaleAbs(gradCpy, opImg2);&#xA;    imshow(&quot;negative grad&quot;, opImg2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But i am not getting expected results. As per Sobel link, I want to get edge at black-to-white that is $+\text ve$ gradient and another one at white-to-black that is $-\text ve$ gradient&lt;/p&gt;&#xA;" OwnerUserId="17896" LastEditorUserId="128" LastEditDate="2019-10-03T23:48:42.173" LastActivityDate="2020-01-04T10:13:16.677" Title="Image Gradient: Light to Dark, Dark to Light" Tags="|image-processing|opencv|c++|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26543" PostTypeId="2" ParentId="26533" CreationDate="2015-10-20T17:00:46.543" Score="3" Body="&lt;p&gt;You have the right idea about Interpolation/Decimation and the steps involved.  Two points:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Interpolation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you insert zeros between samples, the spectrum is now the new sampling frequency wide (88.2kHz in your case) with copies of the original spectrum showing up at multiples of the original frequency (44.1kHz in your case).  When you lowpass filter, your cutoff should be [original sampling frequency - 1/2 bandwidth of original signal] (44.1kHz - 1/2*BW) since you want to eliminate the new copy. The copy centered at 44.1kHz will have a bandwidth that is the same as the original signal so you need to filter lower than the edge of your copy's bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Decimation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you decimate, the higher frequencies of the spectrum fold in on top of your new sampling frequency spectrum. If your lowpass filter has a (3dB) cutoff of 44.1kHz, you'll end up having some spectral content beyond 44.1kHz (unless you were to use an ideal rectangle/brickwall filter which is not practical).  In practice you should design the filter to cutoff enough of the spectral content beyond 44.1kHz to satisfy your requirements.  This would involve setting the cutoff a little below 44.1kHz and starting the stopband at 44.1kHz.  (MATLAB's filter functions let you choose both 3dB cutoff and stopband frequencies.)  Make sure to choose enough attenuation in the stopband to satisfy your requirements.&lt;/p&gt;&#xA;" OwnerUserId="11064" LastActivityDate="2015-10-20T17:00:46.543" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26544" PostTypeId="2" ParentId="26542" CreationDate="2015-10-20T17:39:25.820" Score="1" Body="&lt;p&gt;The UINT8 type is limited to integer numbers on the range [0, 1, 2, ..., 255].&lt;br&gt;&#xA;Hence negative values are clipped into 0.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A solution could be wither use other types (Floating Points) or scale and shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, given a Floating Point image with values &lt;code&gt;imageMax&lt;/code&gt; and &lt;code&gt;imageMean&lt;/code&gt; you can scale it into the &lt;code&gt;[0, 1, 2, ..., 255]&lt;/code&gt; by doing:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create only positive numbers: &lt;code&gt;image - imageMin&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Scale it into the range: &lt;code&gt;round(255 * (image - imageMin) / (imageMax - imageMin))&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now the conversion won't loose data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Others have different approach, set 128 to be zero.&lt;br&gt;&#xA;Namely, add 128 to the image, clip it into &lt;code&gt;[0, 255]&lt;/code&gt; and then convert to &lt;code&gt;UINT8&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enjoy.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="37293" LastEditDate="2020-01-04T10:13:16.677" LastActivityDate="2020-01-04T10:13:16.677" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="26545" PostTypeId="2" ParentId="26477" CreationDate="2015-10-20T17:40:01.690" Score="1" Body="&lt;p&gt;Fourier series and Fourier transform basically involve the decomposition of the signals in terms of sinusoidal (or complex exponential) components. With such decomposition, a signal is said to be represented in the frequency domain.&#xA;Most signals of practical interest can be decomposed into a sum of sinusoidal components. For the class of periodic signals, such a decomposition is called the Fourier Series. For the class of finite energy signals the decomposition is called a Fourier Transform. &lt;/p&gt;&#xA;" OwnerUserId="17897" LastActivityDate="2015-10-20T17:40:01.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26546" PostTypeId="2" ParentId="26533" CreationDate="2015-10-20T19:49:46.250" Score="6" Body="&lt;p&gt;&lt;strong&gt;Interpolation (sampling frequency 44.1 kHz ➔ 88.2 kHz)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your original 44.1 kHz sampled signal has frequencies up to 22.05 kHz, so you should lowpass filter at 22.05 kHz after dilution with zeros. Your filter should have a gain of 2. Otherwise the signal amplitude drops to half because you set half of the samples to zero. Like Jim Clay says, you can combine these things; there will be plenty of opportunity for optimization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Downsampling (sampling frequency 88.2 kHz ➔ 44.1 kHz)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your 88.2 kHz sampled signal is the one you lowpass filtered at 22.05 kHz, you can simply decimate by throwing away every second sample. Otherwise, first lowpass filter at 22.05 kHz to prevent aliasing, and then decimate. If you combine lowpass filtering and decimation, you can optimize again.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-21T05:14:14.650" LastActivityDate="2015-10-21T05:14:14.650" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26547" PostTypeId="1" AcceptedAnswerId="26572" CreationDate="2015-10-20T20:20:17.153" Score="1" ViewCount="4461" Body="&lt;p&gt;I have already posted this question on MATLAB's question forum.  However, I haven't received any responses, and am hoping to find some folks who may be a bit more signal processing savvy on here.  Here goes... I'm wondering if someone could help clear up some confusion I am having surrounding the &lt;code&gt;xcorr()&lt;/code&gt; function since I am struggling to parse how it works exactly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/ref/xcorr.html&quot; rel=&quot;nofollow&quot;&gt;Here is the matlab description&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;r = xcorr(x) returns the autocorrelation sequence of x.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am trying to make an autocorrelogram out of spike train data. Thus, I am inputting timestamps into &lt;code&gt;xcorr()&lt;/code&gt; like so... &lt;code&gt;xcorr(spiketimes)&lt;/code&gt;. I am operating under the assumption that autocorrelating time-stamps for events (spikes) should lead to an autocorrelogram representative of the the autocorrelation between interspike intervals. This autocorrelogram, I believe, should provide the same info as an autocorrelogram of 0's and 1's (0 = no spike, 1 = spike) inputted into a vector who's length is the size of the recording (in milliseconds).  When I run that line of code, however, I find that there's a peak towards the length of the timestamps vector. This doesn't make sense. The peak should be at lag zero (where the vector is 100% correlated with itself). What am I doing wrong here? Or is my understanding of an autocorrelogram incorrect? Does anyone here have any experience using &lt;code&gt;xcorr()&lt;/code&gt;, and have any advice?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this is less important and a bit technical, but for fellow matlab users, I'm not totally sure how to adjust bin width. If anyone has some pointers, I'd appreciate it. Finally, the fact that I can't center the plot that's created from &lt;code&gt;xcorr()&lt;/code&gt; at zero is driving me crazy. How can I fix this?&lt;/p&gt;&#xA;" OwnerUserId="17898" LastEditorUserId="17898" LastEditDate="2015-10-21T15:28:12.383" LastActivityDate="2021-05-20T02:56:17.327" Title="Matlab - How to create an autocorrelogram using a spike-train" Tags="|matlab|discrete-signals|autocorrelation|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26548" PostTypeId="1" AcceptedAnswerId="26573" CreationDate="2015-10-20T21:46:17.447" Score="2" ViewCount="204" Body="&lt;p&gt;This refers to Wikipedia's page on &lt;a href=&quot;https://en.wikipedia.org/wiki/Fractional_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fractional Fourier Transform&lt;/a&gt;.&lt;br /&gt;&#xA;In the definition section it clearly writes that:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The FrFT argument &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; is neither a spatial one &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; nor a frequency&#xA;&lt;span class=&quot;math-container&quot;&gt;$\xi$&lt;/span&gt;. We will see why it can be interpreted as linear combination of&#xA;both coordinates &lt;span class=&quot;math-container&quot;&gt;$(x,\xi)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;But I did not see the relation between the domain of Fractional Fourier transform (&lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;) and space and frequency &lt;span class=&quot;math-container&quot;&gt;$(x,\xi)$&lt;/span&gt;. I can understand that domain '&lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;' is a linear combination of '&lt;span class=&quot;math-container&quot;&gt;$(x,\xi)$&lt;/span&gt;' but my question what is the relation? Can anyone point out the exact relation?&lt;/p&gt;&#xA;" OwnerUserId="15437" LastEditorUserId="128" LastEditDate="2022-04-29T21:02:20.147" LastActivityDate="2022-04-29T21:02:20.147" Title="What is the relation between the domain of Fractional Fourier transform and time and frequency?" Tags="|fourier-transform|frequency-spectrum|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26549" PostTypeId="1" CreationDate="2015-10-20T23:59:30.437" Score="2" ViewCount="498" Body="&lt;p&gt;Suppose $x_c(t)$ is a periodic continuous time signal with period 1 ms and for which the Fourier series is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  x_c(t) &amp;amp;= \sum\limits_{k=-9}^9 a_k e^{j(2000 \pi k t)} \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier series coefficients $a_k$ are zero for $|k| &amp;gt; 9$. $x_c(t)$ is discretely sampled such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  x[n] &amp;amp;= x_c\left(\frac{n}{6000}\right) \\&#xA;  &amp;amp;= \sum\limits_{k=-9}^9 a_k e^{j(\pi k n/3)} \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x[n]$ is periodic with $N=6$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: Find the DFS coefficients of $x[n]$ in terms of $a_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Work&lt;/strong&gt;: The DFS coefficients of a periodic signal are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  W_N &amp;amp;= e^{-j(2\pi/N)} \\&#xA;  X[k] &amp;amp;= \sum\limits_{n=0}^{N-1} x[n] W_N^{kn} \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the variable $k$ in $x[n]$ to $m$ to avoid conflict and combining yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  X[k] &amp;amp;= \sum\limits_{n=0}^{N-1}&#xA;    \sum\limits_{m=-9}^9 a_m e^{j(\pi m n/3)}&#xA; W_N^{kn} \\&#xA;  X[k] &amp;amp;= \sum\limits_{n=0}^{N-1}&#xA;  \sum\limits_{m=-9}^9 a_m e^{j(\pi n/3 (m - k))} \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stumped on how to simplify or process this further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect this is the wrong approach. The problem gives Fourier series coefficients of the continuous function, there should be a direct way to convert them to the discrete Fourier series coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Textbook Answer&lt;/strong&gt;: The answer given by the textbook is as follows. I am trying to figure out how to get to this answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  X[k] &amp;amp;= 2\pi \begin{cases}&#xA;    a_0 + a_6 + a_{-6} &amp;amp; k = 0 \\&#xA;    a_1 + a_7 + a_{-5} &amp;amp; k = 1 \\&#xA;    a_2 + a_8 + a_{-4} &amp;amp; k = 2 \\&#xA;    a_3 + a_9 + a_{-3} + a_{-9} &amp;amp; k = 3 \\&#xA;    a_4 + a_{-2} + a_{-8} &amp;amp; k = 4 \\&#xA;    a_5 + a_{-1} + a_{-7} &amp;amp; k = 5 \\&#xA;  \end{cases}&#xA;\end{align*}&lt;/p&gt;&#xA;" OwnerUserId="17901" LastEditorUserId="17901" LastEditDate="2015-10-21T02:54:08.037" LastActivityDate="2016-04-19T22:38:02.013" Title="Fourier Transform/Series DFT/DFS textbook problem (simple?)" Tags="|fourier-transform|fourier|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26550" PostTypeId="1" CreationDate="2015-10-21T01:55:36.913" Score="0" ViewCount="1234" Body="&lt;p&gt;I'm working on adding MFCCs to my kNN classifier.&#xA;Originally my kNN classifier was using the zero-crossing-rate, centroid, bandwidth, skew, kurtosis.  This was about 80% accurate for drum tracks using identical instrumental to the data it was trained with (there were at least 10+ training tracks for each part of my musical piece, ie. bass kick, snare, hihat, one of each were used in a 10 second clip repeating each 3 times).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I added 12 MFCCs (dropping the 0th) to this list of 5 features, and my kNN classifier has broke.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong?  Below is the part of my code, I have edited out the repetitive parts for extracting features, they are identical to the first one.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;snareDirectory = ['/Snares/'];&#xA;snareFileList = getFileNames(snareDirectory ,'wav');&#xA;&#xA;kickDirectory = ['/Kicks/'];&#xA;kickFileList = getFileNames(kickDirectory ,'wav');&#xA;&#xA;HiHatDirectory = ['/Hihats/'];&#xA;HiHatFileList = getFileNames(HiHatDirectory ,'wav');&#xA;&#xA;currentFrameIndex=1;&#xA;for i=1:size(snareFileList,2)&#xA;    [x,fs]=wavread([snareDirectory snareFileList{i}]);&#xA;    frameSize=.1*fs;&#xA;    currentFrame=x(1:frameSize);&#xA;    featuresSnare(i,1)=zcr(currentFrame);&#xA;    [centroid,bandwidth,skew,kurtosis]=spectralMoments(currentFrame,fs,8192);&#xA;    featuresSnare(i,2:5)=[centroid,bandwidth,skew,kurtosis];&#xA;&#xA;    [mfceps] = mfcc(currentFrame ,fs)' ; %note the transpose operator!&#xA;    delta_mfceps = mfceps - [zeros(1,size(mfceps,2)); mfceps(1:end-1,:)]; %first delta&#xA;    % Calculate the mean and std of the MFCCs, MFCC-deltas.&#xA;    MFCC_mean(currentFrameIndex,:) = mean(mfceps);&#xA;    MFCC_std(currentFrameIndex,:) = std(mfceps);&#xA;    MFCC_delta_mean (currentFrameIndex,:)= mean(delta_mfceps);&#xA;    featuresSnare(i,6:17)=MFCC_mean(currentFrameIndex,2:13);&#xA;end&#xA;&#xA;for i=1:size(kickFileList,2)&#xA;    {...}&#xA;end&#xA;&#xA;for i=1:size(HiHatFileList,2)&#xA;   {...}&#xA;end&#xA;&#xA;[trainingFeatures(:,1:5),mf,sf]=scale([featuresSnare(:,1:5); featuresKick(:,1:5); featuresHiHat(:,1:5)]);&#xA;[trainingFeatures(:,6:17),mf,sf]=scale([featuresSnare(:,6:17); featuresKick(:,6:17); featuresHiHat(:,6:17)]);&#xA;labels=[[ones(size(featuresSnare,1),1) zeros(size(featuresSnare,1),1), zeros(size(featuresSnare,1),1)]; [zeros(size(featuresKick,1),1) ones(size(featuresKick,1),1) zeros(size(featuresKick,1),1)]; [zeros(size(featuresHiHat,1),1) zeros(size(featuresHiHat,1),1) ones(size(featuresHiHat,1),1)]];&#xA;model_snare = knn(17,3,1,trainingFeatures,labels);  &#xA;&#xA;[y,fs]=wavread('together.wav');&#xA;framesize=.1*round(fs); %.1 second&#xA;features=zeros(floor(size(y,1)/framesize),5);&#xA;&#xA;for i=1:floor(size(y,1)/framesize);&#xA;    currentFrame=y(i*framesize:i*framesize+frameSize-1);&#xA;    features(i,1)=zcr(currentFrame);&#xA;    [centroid,bandwidth,skew,kurtosis]=spectralMoments(currentFrame,fs,8192);&#xA;    features(i,2:5)=[centroid,bandwidth,skew,kurtosis];&#xA;&#xA;    currentFrameIndex=i;&#xA;    [mfceps] = mfcc(currentFrame ,fs)' ; %note the transpose operator!&#xA;    delta_mfceps = mfceps - [zeros(1,size(mfceps,2)); mfceps(1:end-1,:)]; %first delta&#xA;    % Calculate the mean and std of the MFCCs, MFCC-deltas.&#xA;    MFCC_mean(currentFrameIndex,:) = mean(mfceps);&#xA;    MFCC_std(currentFrameIndex,:) = std(mfceps);&#xA;    MFCC_delta_mean (currentFrameIndex,:)= mean(delta_mfceps);&#xA;    MFCC_delta_std(currentFrameIndex,:)= std(delta_mfceps);&#xA;    features(i,6:17)=MFCC_mean(currentFrameIndex,2:13);&#xA;end&#xA;&#xA;soundsc(y,fs)&#xA;featuresScaled(1:5) = rescale(features(1:5),mf,sf); &#xA;featuresScaled(6:17)=rescale(features(6:17),mf,sf);&#xA;&#xA;[voting,model_output]=knnfwd(model_snare , featuresScaled );&#xA;output = zeros(size(model_output,1),3);&#xA;output(find(model_output==1),1)=1;&#xA;output(find(model_output==2),2)=1;&#xA;output(find(model_output==3),3)=1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have read this post&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/16546524/how-to-use-mfcc-vectors-for-classifying-a-single-audio-file&quot;&gt;https://stackoverflow.com/questions/16546524/how-to-use-mfcc-vectors-for-classifying-a-single-audio-file&lt;/a&gt;&#xA;which is close to what I am trying to figure out but in my eyes I am already doing what the answer is saying.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated, I have spent several days trying to figure this out and have only resulted in creating a model that is 50% less accurate than without the MFCCs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-scarlson&lt;/p&gt;&#xA;" OwnerUserId="17903" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-10-21T01:55:36.913" Title="Using MFCCs in kNN classification" Tags="|matlab|audio|mfcc|classification|knn|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26552" PostTypeId="1" AcceptedAnswerId="26555" CreationDate="2015-10-21T04:46:06.763" Score="9" ViewCount="11022" Body="&lt;p&gt;One of the &lt;a href=&quot;http://au.mathworks.com/help/signal/release-notes.html&quot; rel=&quot;noreferrer&quot;&gt;new functions&lt;/a&gt; in the MATLAB Signal Processing toolbox for R2015b is the &lt;a href=&quot;http://au.mathworks.com/help/signal/ref/hampel.html&quot; rel=&quot;noreferrer&quot;&gt;Hampel Filter&lt;/a&gt;.  It appears to be used for outlier removal and from the examples, it looks like it might do a better job than a &lt;a href=&quot;https://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;noreferrer&quot;&gt;median filter&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, as of yet there appears to be no &lt;a href=&quot;http://www.google.com.au/search?q=hampel+filter&quot; rel=&quot;noreferrer&quot;&gt;readily available&lt;/a&gt; digestible description of the filter (such as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Hampel_filter&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia page&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what is a Hampel Filter?  How does it work?  How computationally expensive is it?  When does it work well? When does it not work so well?&lt;/p&gt;&#xA;" OwnerUserId="1904" LastActivityDate="2015-10-21T08:00:38.550" Title="What is a &quot;Hampel Filter&quot; and how does it work?" Tags="|reference-request|median-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26553" PostTypeId="2" ParentId="21675" CreationDate="2015-10-21T07:07:54.590" Score="2" Body="&lt;p&gt;I agree with you, this looks like a flawed description of an inverse transform generator.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The $p[i]$ shouldn't be like described, but should be the prefix sum of these, corresponding to the cumulative distribution.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The $\arg\min$ should indeed be taken on the absolute value (or allow positive values only).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As the pdf is computed on the positive $i$ only, the range of the uniform drawing should be $[0,\frac12]$ (or the $p[i]$ scaled by $2$.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(When the $p[i]$ are not cumulated, they are in $[0,\frac1{\sigma\sqrt2\pi}]$, and the range $[0,1]$ doesn't make sense.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For better efficiency, you can precompute a lookup-table of the $i$ indexes for sufficiently dense $q_1$.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-10-21T07:26:18.910" LastActivityDate="2015-10-21T07:26:18.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26555" PostTypeId="2" ParentId="26552" CreationDate="2015-10-21T07:35:50.473" Score="8" Body="&lt;p&gt;The documentation clearly describes its function: &quot;For each sample of x, the function computes the median of a window composed of the sample and its six surrounding samples, three per side. It also estimates the standard deviation of each sample about its window median using the median absolute deviation. If a sample differs from the median by more than three standard deviations, it is replaced with the median.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $3\sigma$ rule is enforced via the estimator $\sigma \approx 1.4826\ \operatorname{MAD}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most costly operation must be the median of seven elements, possibly achieved by sorting, which can be performed efficiently in a sliding window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly relevant reference: &quot;Hampel F. R., ”The influence curve and its role in robust estimation,” Journal&#xA;of the American Statistical Association, 69, 382–393, 1974.&quot;&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-10-21T08:00:38.550" LastActivityDate="2015-10-21T08:00:38.550" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26556" PostTypeId="1" CreationDate="2015-10-21T08:13:48.897" Score="2" ViewCount="689" Body="&lt;p&gt;Recently, I'm working on modeling a sensor's system model using system identification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subject to the experiment condition, I only have the sine input signal. In addition, the frequency can not continuous change. In other words, I only have some specific frequencies experiment data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm new about system identification, but clearly this kind of signal can not let the system show all of the feature. So, is there any algorithm can get the system model only using sine input signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="17905" LastActivityDate="2015-10-21T09:36:39.673" Title="System identification only using sine input?" Tags="|system-identification|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26557" PostTypeId="2" ParentId="26556" CreationDate="2015-10-21T08:24:45.770" Score="3" Body="&lt;p&gt;Knowing the amplitude (and phase) for several frequencies allows you to fit a model with as many parameters, hoping the system is linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With little information you cannot observe the whole system behavior accurately, but just a simplified model. This might be enough for your purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing the internal system structure should help you select an empirical model.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-10-21T08:24:45.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26559" PostTypeId="2" ParentId="26556" CreationDate="2015-10-21T09:36:39.673" Score="3" Body="&lt;p&gt;If the sensor is linear and invariant in time (an LTI system for linear and time-invariant), the output to a sine should be a sine with the same frequency, and a different phase and amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming  that you will only probe the sensorin its linearity range (e.g. outside saturation), and that you only have access to the magnitude of the output sine, you can add a causality assumption, and reconstruct the complex spectrum from its magnitude only by &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Creating_Minimum_Phase_Filters.html&quot; rel=&quot;nofollow&quot;&gt;Creating Minimum Phase Filters and Signals&lt;/a&gt; (Matlab code &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Matlab_listing_mps_m.html&quot; rel=&quot;nofollow&quot;&gt;mps.m&lt;/a&gt; for instance). Since you only have assess to a limited amout of frequencies, you might need to interpolate the spectrum on a finer grid (splines could do the job if the spectrum is smooth), and to set the unknown spectrum to a low-value outise for frequency span.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-10-21T09:36:39.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26560" PostTypeId="1" AcceptedAnswerId="26569" CreationDate="2015-10-21T10:49:05.557" Score="0" ViewCount="156" Body="&lt;p&gt;So given some analogue system function in the complex s-domain. Can we perform a stability analysis in the $s$-domain, before actually transfer it into the $z$-domain? So in other words analysis in the $z$-domain is not necessary anymore?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why I am unsure is that we have a sample and hold element which needs to be added to our system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1-e^{-sT}}{s}$ which changes to $\frac{z-1}{z}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I did use partial fraction decomposition/method of residues and did not use any approx. like bilinear transform, impulse variance method.)&lt;/p&gt;&#xA;" OwnerUserId="11606" LastEditorUserId="11606" LastEditDate="2015-10-21T22:01:55.537" LastActivityDate="2015-10-21T23:28:17.697" Title="System Stability: Can we derive stability of a discrete system (Frequency domain, Z-transform) by applying analogous methods?" Tags="|z-transform|laplace-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26561" PostTypeId="1" AcceptedAnswerId="26563" CreationDate="2015-10-21T12:05:48.153" Score="1" ViewCount="1287" Body="&lt;p&gt;I was reading DIP by &lt;em&gt;Gonzalez et al&lt;/em&gt;, and came across the concept of getting output image pixel values by calculating nearest neighbour in input image by inverse mapping of output pixel coordinates $(x,y)$ to input coordinates $(v,w)$ and applying its value. Something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;(v,w) = T^{-1} (x,y)&#xA;$$&#xA;where $T$ is the image transform matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if the matrix T is singular. How will we define the nearest neighbour pixels then?&#xA;For eg. for &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T = \left [&#xA;\begin{array}{ccc}&#xA;1 &amp;amp;1 &amp;amp;0\\&#xA;1 &amp;amp;1 &amp;amp;0\\&#xA;0 &amp;amp;0 &amp;amp;1 \end{array}&#xA;\right],&#xA;$$ whose inverse doesn't exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I am guessing that the transform matrix is changed by adding or subtracting some values)&lt;/p&gt;&#xA;" OwnerUserId="13542" LastEditorUserId="80" LastEditDate="2015-10-21T12:17:49.943" LastActivityDate="2015-10-21T12:23:19.120" Title="Inverse mapping (affine transformation) for singular transform matrix" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26562" PostTypeId="2" ParentId="21675" CreationDate="2015-10-21T12:13:19.307" Score="1" Body="&lt;p&gt;Yes, the algorithm is distinctly poor.  I've made a quick attempt to implement it (as stated) in R, and this is the histogram of the resulting values.  Please let me know if there's a problem with it (as the algorithm is stated, not trying to fix the algorithm).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks no different from a uniformly distributed random variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/csych.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/csych.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#21675&#xA;&#xA;&#xA;q_21675 &amp;lt;- function()&#xA;{&#xA;  #1 &#xA;  sigma_i &amp;lt;- 3&#xA;  #2&#xA;  G &amp;lt;- 256&#xA;  p &amp;lt;- rep(0,G)&#xA;  for (i in 1:G)&#xA;  {&#xA;    p[i] &amp;lt;- 1/(sigma_i*sqrt(2*pi))*exp(-i*i/(2*sigma_i*sigma_i))&#xA;  }&#xA;  #3 &#xA;  q1 &amp;lt;- runif(1,0,1)&#xA;  diff &amp;lt;- rep(0,G)&#xA;  for (j in 1:G)&#xA;  {&#xA;    diff[j] &amp;lt;- q1-p[j]&#xA;  }&#xA;  j &amp;lt;- which.min(diff)&#xA;  #4&#xA;  q2 &amp;lt;- runif(1,-1,1)&#xA;  addition &amp;lt;- q2*j&#xA;  return(addition)&#xA;}&#xA;&#xA;&#xA;x &amp;lt;- rep(0,1000)&#xA;for (t in 1:1000)&#xA;{&#xA;  x[t] &amp;lt;- q_21675()&#xA;}&#xA;&#xA;hist(x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-21T13:47:32.610" LastActivityDate="2015-10-21T13:47:32.610" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26563" PostTypeId="2" ParentId="26561" CreationDate="2015-10-21T12:23:19.120" Score="1" Body="&lt;p&gt;Usually, when an inverse is required but the matrix you are taking the inverse of is not guaranteed to be invertible, then the (&lt;a href=&quot;https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse&quot; rel=&quot;nofollow&quot;&gt;Moore-Penrose&lt;/a&gt;) &lt;a href=&quot;http://mathworld.wolfram.com/Pseudoinverse.html&quot; rel=&quot;nofollow&quot;&gt;pseudoinverse&lt;/a&gt; is used:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In R, if $T$ is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T&#xA;        [,1] [,2] [,3]&#xA;[1,]    1    1    0&#xA;[2,]    1    1    0&#xA;[3,]    0    0    1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then the pseudoinverse calculated using &lt;code&gt;ginv&lt;/code&gt; is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ginv(T)&#xA;     [,1] [,2] [,3]&#xA;[1,] 0.25 0.25    0&#xA;[2,] 0.25 0.25    0&#xA;[3,] 0.00 0.00    1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Clearly, this won't give the identity matrix when multiplying $T$, but it's as close as you can get with $T$ singular.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T*ginv(T)&#xA;     [,1] [,2] [,3]&#xA;[1,] 0.25 0.25    0&#xA;[2,] 0.25 0.25    0&#xA;[3,] 0.00 0.00    1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-21T12:23:19.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26565" PostTypeId="1" AcceptedAnswerId="26567" CreationDate="2015-10-21T16:39:47.587" Score="1" ViewCount="289" Body="&lt;p&gt;I am trying to create a discrete-time filter with a Fourier transform as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(\omega) = &#xA;\begin{cases}&#xA;1, &amp;amp; T - W \leq \omega \leq T + W\\&#xA;0, &amp;amp; \text{all other values of } \omega&#xA;\end{cases}, $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the provided solution, I have understood that the idea is to create a low-pass filter and then translate it in the frequency domain by $T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the low-pass filter I've got the following time-domain function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(n) = \frac{1}{\pi}\frac{\sin(Wn)}{n}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To translate a function in frequency, it can be multiplied in the time domain by $e^{jTn}$. In the solution, they have first stated that this is correct, but in the final answer they have instead multiplied it by $2\cos(Tn)$. They also wrote that $2\cos(Tn) = e^{jTn}+e^{-jTn}$, which I have no problem with, but I don't understand why they went for this instead of $e^{jTn}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to be clear, my question is:  why did they multiply the low-pass filter by $2\cos(Tn)$ instead of $e^{jTn}$ to translate it in the frequency domain?&lt;/p&gt;&#xA;" OwnerUserId="17908" LastEditorUserId="17908" LastEditDate="2015-10-21T21:11:07.067" LastActivityDate="2015-10-21T21:11:07.067" Title="Frequency translation of an ideal low pass filter" Tags="|filters|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26566" PostTypeId="2" ParentId="24040" CreationDate="2015-10-21T17:00:23.750" Score="0" Body="&lt;p&gt;I changed your code a little and I could estimate the channel.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;channel = [1 0.2]';&#xA;Ga = [+1, +1, +1, -1, +1, +1, -1, +1]';&#xA;Gb = [+1, +1, +1, -1, -1, -1, +1, -1]';&#xA;&#xA;correlation_Ga = xcorr(Ga, Ga);&#xA;correlation_Gb = xcorr(Gb, Gb);&#xA;&#xA;temp = correlation_Ga + correlation_Gb;&#xA;y = conv(temp(length(Ga):end), channel);&#xA;y = y/length(Ga);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;First I calculated the autocorrelation of both Ga and Gb. It is this sum that results in the impulse response. I think that you made a mistake writing the equation in your question. I think the right is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ (h(t)*Ga)*Ga + (h(t)*Gb)*Gb =h(t)*(R_a+R_b)= h(t) * \delta(t) = h(t) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;temp&lt;/code&gt; variable is $ R_a + R_b $, the sum of the autocorrelations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now is necessary to remember that Matlab starts counting from 1. Then, the autocorrelation of these sequences will result in a vector of length 15, where the first element will correspond to the element of index -7 of your autocorrelation. So, to perform the convolution right, you need to bring the element that is in the position eight to the first position. That's why the line &lt;code&gt;temp(length(Ga):end)&lt;/code&gt; inside the conv function. Doing this, you can guarantee the equality $ h(t) * \delta(t) = h(t) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you just need to normalize the output from the convolution, and you will have your channel response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't use noise, but I think that it is easy to implement this now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if it helps and if you have any more doubts.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-10-21T17:00:23.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26567" PostTypeId="2" ParentId="26565" CreationDate="2015-10-21T17:10:15.270" Score="2" Body="&lt;p&gt;Multiplying the impulse response by $e^{jTn}$ would give a complex impulse response and a complex-valued filter output. Seems that they were aiming for a real-valued output. They did this by summing two filters, one with the pass band at $T - W \le \omega \le T + W$ and the other with the pass band at $-T - W \le \omega \le -T + W$. If there is overlap between the two pass bands then the frequency response of the composite filter will have a weird shape like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AT0iM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AT0iM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems that they did not intend there to be overlap, but that $T \gt W$.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-21T18:09:30.300" LastActivityDate="2015-10-21T18:09:30.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26568" PostTypeId="1" AcceptedAnswerId="91559" CreationDate="2015-10-21T18:04:11.723" Score="5" ViewCount="2664" Body="&lt;p&gt;As far as I know, precision and recall are two single values. How we can plot a curve from these two single values? I think I should calculate a set of values for each of them but how?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;afterwards, the curve can be depicted by using the fact that they are inversely related. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{Precision}=\frac{tp}{tp+fp} &#xA;$$&#xA;$$&#xA;\text{Recall}=\frac{tp}{tp+fn}&#xA;$$&#xA;Where $tp = \text{True Positives}$, $fp = \text{False Positives}$ and $fn = \text{False Negatives}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anybody can explain how we can plot a curve from two single values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One answer can be found &lt;a href=&quot;https://www.quora.com/How-do-you-compute-precision-recall-curves&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; but I do not believe that I have caught the point well.&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="80" LastEditDate="2015-11-21T15:56:59.057" LastActivityDate="2024-03-28T14:09:42.313" Title="How we calculate Precision-Recall Curve?" Tags="|image-segmentation|classification|machine-learning|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26569" PostTypeId="2" ParentId="26560" CreationDate="2015-10-21T18:08:01.940" Score="0" Body="&lt;p&gt;If you use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;nofollow&quot;&gt;bilinear transform&lt;/a&gt; to map from s-plane poles and zeros to z-plane poles and zeros, the left-hand half-plane of the s-plane will be mapped to the inside of the unit circle on the z-plane. This preserves stability because on s-plane the requirement for stability is that poles are on the left-hand half-plane and on the z-plane it is that they are inside the unit circle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not examine too carefully your s and z-domain formulas, but indefinite integration is marginally stable with a pole at the origin of the s-plane, or on the unit circle of the z-plane. Implemented as a nonrecursive filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{out}[i] = \text{in}[i-N + 1] + \text{in}[i-N + 2] + \dots + \text{in}[i-1] + \text{in}[i],$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;integration over $N$ samples is stable. Implemented as a recursive filter: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{out}[i] = \text{out}[i-1] + \text{in}[i] - \text{in}[i-N],$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it is stable in fixed-point arithmetic, but can drift if implemented in floating point arithmetic due to accumulation of numerical error. Even then it can be stabilized by moving the pole slightly inside the unit circle, or by periodically resetting the filter state by calculating it using the nonrecursive filter. But sample and hold is about taking an input sample and keeping the output at that value for some time. That can be programmed directly and gives no stability problems.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-21T23:28:17.697" LastActivityDate="2015-10-21T23:28:17.697" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26571" PostTypeId="2" ParentId="26568" CreationDate="2015-10-21T19:37:21.807" Score="1" Body="&lt;p&gt;Obviously, you can't plot a curve from a single pair of values, so you have to find a parameter to vary that changes your problem in a way that makes sense to what you're trying to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose your binary classification problem has a choosable threshold.  If you vary the threshold up and down, then it will change the precision and recall.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you might get a plot like the one below.  R code below that generated it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cb3Mu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cb3Mu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#26568&#xA;&#xA;Ndata &amp;lt;- 1000&#xA;&#xA;c1 &amp;lt;- runif(Ndata,1.5,3)&#xA;c2 &amp;lt;- runif(Ndata,1,2.5)&#xA;&#xA;data &amp;lt;- c(c1, c2)&#xA;&#xA;thresholds &amp;lt;- seq(1,2.99,0.01)&#xA;&#xA;precision &amp;lt;- thresholds*0&#xA;recall &amp;lt;- thresholds*0&#xA;&#xA;for (k in 1:length(thresholds))&#xA;{&#xA;  threshold &amp;lt;- thresholds[k]&#xA;  cl &amp;lt;- data*0&#xA;  tp &amp;lt;- 0&#xA;  tn &amp;lt;- 0&#xA;  fp &amp;lt;- 0&#xA;  fn &amp;lt;- 0&#xA;&#xA;  for (i in 1:length(data))&#xA;  {&#xA;    if ( (data[i] &amp;gt; threshold) &amp;amp;&amp;amp; (i &amp;lt;= Ndata))&#xA;    {&#xA;      tp &amp;lt;- tp + 1  &#xA;    }&#xA;    if ( (data[i] &amp;gt; threshold) &amp;amp;&amp;amp; (i &amp;gt; Ndata))&#xA;    {&#xA;      fp &amp;lt;- fp + 1  &#xA;    }&#xA;    if ( (data[i] &amp;lt;= threshold) &amp;amp;&amp;amp; (i &amp;lt;= Ndata))&#xA;    {&#xA;      fn &amp;lt;- fn + 1  &#xA;    }&#xA;    if ( (data[i] &amp;lt;= threshold) &amp;amp;&amp;amp; (i &amp;gt; Ndata))&#xA;    {&#xA;      tn &amp;lt;- tn + 1  &#xA;    }&#xA;  }&#xA;&#xA;  precision[k] &amp;lt;- tp / (tp + fp)&#xA;  recall[k] &amp;lt;- tp / (tp  + fn)&#xA;}&#xA;&#xA;plot(precision,recall)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-21T19:37:21.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26572" PostTypeId="2" ParentId="26547" CreationDate="2015-10-21T21:16:25.057" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;When I run that line of code, however, I find that there's a peak towards the length of the timestamps vector.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I'm assuming you're running:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r = xcorr(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you're perplexed by the peak at &lt;code&gt;r(length(x))&lt;/code&gt; ?  That's because &lt;code&gt;xcorr&lt;/code&gt; returns a vector that is the autocorrelation from a lag of &lt;code&gt;-length(x)&lt;/code&gt; to a lag of &lt;code&gt;+length(x)&lt;/code&gt; (unless told otherwise) so that the middle value is the zero lag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However you seem interested in finding correlations between the pulse times.  That's a whole other kettle of fish... especially when there are pulse trains of different periods or there are missing data. To see the complexity that can happen, &lt;a href=&quot;https://www.itr.unisa.edu.au/itrusers/mckillrg/public_html/papers/ICASSP_SNPE.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;check out this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are you trying to achieve?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To see that there's a big difference between the autocorrelation function of the pulse arrival times and the actual pulses themselves, I've generated an example in R.  The resulting autocorrelation functions are plotted below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I5eqN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I5eqN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so you have a periodic(ish) pulse train and you want to figure out what the pulse period is.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The autocorrelation of the pulse times will not help. This is because the times are just a sorted array, so you'll just get a straight line as the autocorrelation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The autocorrelation of the pulses themselves should help.  However, you'll get a peak at 0 lag, and at lags of $nP$ where $P$ is your pulse period and $n$ is an integer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://stats.stackexchange.com/questions/148865/how-to-interpret-this-autocorrelogram-graph&quot;&gt;The post you reference&lt;/a&gt; is looking at the histogram of the inter-pulse times (time differences between successive pulses).  Depending on how varied your pulse train is, this might be the best approach.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If I change my simulation to use a pulse that is periodic (with zero noise on the pulse times!), then I get the second lot of code below, and the results are graphed here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KU993.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KU993.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this particular run, the &lt;code&gt;Tperiod = 9.350267&lt;/code&gt;.  As you can see, both the ACF of the pulses and the histogram method get a peak close to where we want it (though quantization effects mean we don't get exactly at &lt;code&gt;9.350267&lt;/code&gt;; better selection of &quot;bins&quot; might improve that).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#26547&#xA;&#xA;Npulses &amp;lt;- 100&#xA;Tmax &amp;lt;- 1000&#xA;&#xA;pulseTimes &amp;lt;- sort(runif(Npulses,0,Tmax))&#xA;&#xA;# install.packages(&quot;Hmisc&quot;)&#xA;library(Hmisc)&#xA;&#xA;xc_times = acf(pulseTimes, plot = FALSE)&#xA;&#xA;times &amp;lt;- 0:.1:Tmax&#xA;&#xA;pulses &amp;lt;- times*0&#xA;&#xA;for (pulseNo in 1:length(pulseTimes))&#xA;{&#xA;  idx &amp;lt;- which.min(abs(pulseTimes[pulseNo] - times))&#xA;  pulses[idx] = 1&#xA;}&#xA;&#xA;xc_pulses = acf(pulses, plot = FALSE)&#xA;&#xA;plot(xc_times$lag,xc_times$acf, type=&quot;l&quot;, ylim=c(-0.1,1))&#xA;lines(xc_pulses$lag, xc_pulses$acf, col=&quot;red&quot;)&#xA;legend(15, 0.9, c(&quot;ACF of times&quot;, &quot;ACF of pulses&quot;), lwd=c(2.5,2.5),col=c(&quot;black&quot;,&quot;red&quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second version of R code below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#26547&#xA;&#xA;Npulses &amp;lt;- 100&#xA;Tmax &amp;lt;- 1000&#xA;&#xA;Tperiod &amp;lt;- runif(1,9,10)&#xA;Tstart &amp;lt;- runif(1,0,1)&#xA;&#xA;#pulseTimes &amp;lt;- sort(runif(Npulses,0,Tmax))&#xA;pulseTimes &amp;lt;- Tstart + (0:Npulses)*Tperiod&#xA;&#xA;# install.packages(&quot;Hmisc&quot;)&#xA;library(Hmisc)&#xA;&#xA;xc_times = acf(pulseTimes, plot = FALSE)&#xA;&#xA;times &amp;lt;- 0:.1:Tmax&#xA;&#xA;pulses &amp;lt;- times*0&#xA;&#xA;for (pulseNo in 1:length(pulseTimes))&#xA;{&#xA;  idx &amp;lt;- which.min(abs(pulseTimes[pulseNo] - times))&#xA;  pulses[idx] = 1&#xA;}&#xA;&#xA;xc_pulses &amp;lt;- acf(pulses, plot = FALSE)&#xA;&#xA;histogram &amp;lt;-  hist(diff(pulseTimes), breaks=xc_pulses$lag, plot=FALSE)&#xA;&#xA;plot(xc_times$lag,xc_times$acf, type=&quot;l&quot;, ylim=c(-0.1,1))&#xA;lines(xc_pulses$lag, xc_pulses$acf, col=&quot;red&quot;)&#xA;lines(histogram$mids, histogram$counts / max(histogram$counts), col=&quot;green&quot;)&#xA;&#xA;legend(12, 1.0, c(&quot;ACF of times&quot;, &quot;ACF of pulses&quot;, &quot;Histogram of inter-pulse times&quot;), lwd=c(2.5,2.5, 2.5),col=c(&quot;black&quot;,&quot;red&quot;, &quot;green&quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2015-10-21T22:43:06.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26573" PostTypeId="2" ParentId="26548" CreationDate="2015-10-21T22:59:18.587" Score="2" Body="&lt;p&gt;It think it is more correct to say that the $u$ axis is a linear combination of the $x$ and $\xi$ axes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(x, \xi) = (1, 0)x + (0, 1)\xi = \left((1, 0)\cos(\alpha) + (0, 1)\sin(\alpha)\right)u,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x = u\cos(\alpha)\\&#xA;\xi = u\sin(\alpha).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of the fractional Fourier transform from &lt;a href=&quot;https://en.wikipedia.org/wiki/Fractional_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;that Wikipedia page&lt;/a&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$\mathcal{F}_\alpha[f](u) =  \sqrt{1-i\cot(\alpha)} e^{i \pi&#xA;\cot(\alpha) u^2}  \int_{-\infty}^\infty  e^{-i2\pi (\csc(\alpha) u x&#xA;- \frac{\cot(\alpha)}{2} x^2)} f(x)\, \mathrm{d}x.$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you use another variable, $y$, for the integral, and substitute $u = \sqrt{x^2 + \xi^2}$ and $\alpha = \text{atan}(\xi, x)$, then the fractional Fourier transform can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}[f](x, \xi) = e^{i \pi \frac{\xi}{x} (x^2+\xi^2)} \sqrt{1-\frac{i \xi}{x}}\int^\infty_{-\infty}e^{i \pi \frac{y}{x} \left(\xi y-2 x^{\frac{1}{\xi}} \sqrt{\xi^2+x^2}\right)} f(y)\, \text{d}y.$$&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-22T06:47:26.527" LastActivityDate="2015-10-22T06:47:26.527" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26574" PostTypeId="2" ParentId="26547" CreationDate="2015-10-21T23:34:19.750" Score="0" Body="&lt;p&gt;Chris, since you say you are not from signal processing the definition of a spike for this link might not make sense, but the spike train by definition is a series of impulses time shifted by each spike time so its like $[1 \, 0\,  0\,  1\,  0\,  1\,  0\,  0]$ and not $[t_{1}\,  0 \, 0 \, t_{2} \, 0 t_{3} \, 0]$ etc. see &lt;a href=&quot;http://icwww.epfl.ch/~gerstner/SPNM/node34.html#SECTION02424200000000000000&quot; rel=&quot;nofollow&quot;&gt;http://icwww.epfl.ch/~gerstner/SPNM/node34.html#SECTION02424200000000000000&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say you are interested in finding the degree of randomness of your spike train, a time-series process. Autocorrelation is part of that but will not alone tell you with statistical exactness the odds that a give correlation would be spuriously generated (i.e. greater than an expected value of the ACF).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as a quick check, you can look at the first lag of your spike train and see how close to 1 it is in the normalized autocorrelation. Values closer to 1 will tell you there is a stronger (or weaker) predictability to the time-series process used as your input. At lag zero in normalized autocorrelation the value will always be 1.&lt;/p&gt;&#xA;" OwnerUserId="8764" LastActivityDate="2015-10-21T23:34:19.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26575" PostTypeId="2" ParentId="26539" CreationDate="2015-10-21T23:47:12.493" Score="1" Body="&lt;p&gt;You don't have to work with FFT's and their complex phases, it is far simpler to work directly with the data.  It is particularly simple if the two images are registered.  At the simplest level you find the edges in both of the images and take the difference between the edge maps.  All structure that is common to both images is then zero and all that is left is the pixels that have changed.  This is robust against changes in illumination provided you match the histograms of the edge images prior to subtraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inevitably there are complications, all of which in any case are present when working in the Fourier domain.  I have already touched on the effect of illumination, you can make that slightly more effective by renormalising the histograms of the images before applying the edge filter.  As for which edge filter to use, Roberts, Sobel, or whatever, I would suggest taking the 3x3 Laplacian (this is equivalent to finding the trace of the Hessian of the image density field).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One serious complication is noise: it is essential to remove the noise in the images before starting out.  A simple 3x3 2D smoothing filter passed over the image is fine.  (In the Fourier domain you kill the highest frequencies).  This is important because differentiating random data, which is what edge filters are about, is generally a bad thing to do, and taking second derivatives (the Laplacian) is even worse.  Any noise filter applied in the spatial domain will require a threshold filtering to eliminate noise.  Choosing the threshold visually is effective, but not practical if there is a lot of data.  Then there are auto threshold mechanisms available, and some of those are adaptive to the local noise.  It can get as complicated as you like!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A further complication arises from knowing a priori what is the scale on which you expect to find the difference: how many pixels?  Simple 3x3 filters are inadequate if the features delineated by edges on a scale of &gt;10 pixels.  If you are searching for a particular scale it's worth smoothly shrinking the images so as to make the edges of interest conform to the sought after features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have no idea what the scale is, then my advice would be to use a simple wavelet transform (like the 5-3 wavelet) which automatically locates edges on all scales. I don't have a ready reference to that, but I'll find one if that is of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can get quite involved depending on how difficult it is to define what you are looking for.  The Multi-scale Morphology Filter was introduced in my field in the paper &lt;a href=&quot;http://arxiv.org/abs/0705.2072&quot; rel=&quot;nofollow&quot;&gt;http://arxiv.org/abs/0705.2072&lt;/a&gt; and refined in a later astronomy paper, &lt;a href=&quot;http://arxiv.org/abs/1209.2043&quot; rel=&quot;nofollow&quot;&gt;http://arxiv.org/abs/1209.2043&lt;/a&gt; .  These dealt with the problem of finding and classifying structure on a point set distribution (galaxies) and, in terms of the question, describe the scale free analysis used to find edges (filaments of galaxies) of arbitrary scale.  The work was also focussed on making the search for structures parameter free, i.e. &quot;objective&quot; and since then has progressed to being able to handle data in N-dimensions of billions of data points (not finished and so not published as yet).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also use this in industrial process control using thermal imaging cameras, which have weird noise characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom line is to assess the complexity of your data by doing the very simplest thing contained in the first paragraph.  If that works then don't go any further.&lt;/p&gt;&#xA;" OwnerUserId="17243" LastActivityDate="2015-10-21T23:47:12.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26576" PostTypeId="1" AcceptedAnswerId="26587" CreationDate="2015-10-22T01:11:51.543" Score="6" ViewCount="12293" Body="&lt;p&gt;I want to walk through the derivation of the frequency representation of an impulse train.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of the impulse train function with period $T$ and the frequency representation with sampling frequency $\Omega_s = 2\pi/T$ that I would like to derive is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  s(t) &amp;amp;= \sum\limits_{n=-\infty}^{\infty} \delta(t - nT) \\&#xA;  S(j\Omega) &amp;amp;= \frac{2\pi}{T} \sum\limits_{k=-\infty}^{\infty} \delta(\Omega - k\Omega_s) \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the exponential Fourier series representation of the impulse function and applying the Fourier transform from there results in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  s(t) &amp;amp;= \frac{1}{T} \sum\limits_{n=-\infty}^{\infty} e^{-jn\Omega_s t} \\&#xA;  S(j\Omega) &amp;amp;= \int_{-\infty}^\infty s(t) e^{-j\Omega t} dt \\&#xA;  S(j\Omega) &amp;amp;= \int_{-\infty}^\infty \frac{1}{T} \sum\limits_{n=-\infty}^{\infty} e^{-jn\Omega_s t} e^{-j\Omega t} dt \\&#xA;  S(j\Omega) &amp;amp;= \frac{1}{T} \int_{-\infty}^\infty \sum\limits_{k=-\infty}^{\infty} e^{-j(k\Omega_s + \Omega) t} dt \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get from there to the end result, it would seem that the integration would need to be over a period of $2\pi$. Where $\Omega = -k\Omega_s$, the exponent would be $e^0$ and integrate to $2\pi$ and for other values of $\Omega$, there would be a full sine wave that would integrate to zero. However, the limits of integration are negative infinity to positive infinity. Can someone explain this? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="17901" LastActivityDate="2015-10-22T17:00:38.093" Title="Derive Frequency Representation of Impulse Train Function" Tags="|fourier-transform|fourier-series|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26577" PostTypeId="1" AcceptedAnswerId="26585" CreationDate="2015-10-22T01:28:45.023" Score="4" ViewCount="4310" Body="&lt;p&gt;If the DTFT of discrete sequence $x[n]$ is $X(e^{j\omega})$, what is the DTFT of $g[n] = x[2n]$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see the textbook answer is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  G(e^{j\omega}) &amp;amp;= \frac{1}{2} \left( X(e^{j\omega/2}) + X(e^{j(\omega-2\pi)/2}) \right)&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My start of the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  X(e^{j\omega}) &amp;amp;= \sum\limits_{n=-\infty}^\infty x[n] e^{-j\omega n} \\&#xA;  G(e^{j\omega}) &amp;amp;= \sum\limits_{n=-\infty}^\infty g[n] e^{-j\omega n} \\&#xA;  G(e^{j\omega}) &amp;amp;= \sum\limits_{n=-\infty}^\infty x[2n] e^{-j\omega n} \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I derive the given textbook answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try the obvious $m=2n$ substitution, however I don't see how you can change the variable on the summation so that it counts by 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  G(e^{j\omega}) &amp;amp;= \sum\limits_{n=-\infty}^\infty x[m] e^{-j\omega m/2} \\&#xA;\end{align*}&lt;/p&gt;&#xA;" OwnerUserId="17901" LastEditorUserId="4298" LastEditDate="2021-02-09T11:27:52.853" LastActivityDate="2021-02-09T11:27:52.853" Title="Derive DTFT of $x[2n]$" Tags="|fourier-transform|dtft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26578" PostTypeId="5" CreationDate="2015-10-22T04:52:55.433" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2015-10-22T04:52:55.433" LastActivityDate="2015-10-22T04:52:55.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26579" PostTypeId="4" CreationDate="2015-10-22T04:52:55.433" Score="0" Body="Quadrature Phase Shift Keying" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-10-22T12:09:14.630" LastActivityDate="2015-10-22T12:09:14.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26580" PostTypeId="2" ParentId="21866" CreationDate="2015-10-22T05:22:48.883" Score="1" Body="&lt;p&gt;I confess I have never worked with OQPSK (or QPSK) and have only read a little bit about it.  But it seems to me that a valid model for it might be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;s(t) &amp;amp;= \Re\Big\{ (i[n] + j q[n]) \, e^{j 2 \pi f_\text{c} t} \Big\} \\&#xA;     &amp;amp; = i[n] \cos(2 \pi f_\text{c} t)  -  q[n] \sin(2 \pi f_\text{c} t) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$f_\text{c}$&lt;/span&gt; is the carrier frequency and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ n = \Big\lfloor \tfrac{t}{T} \Big\rfloor = \operatorname{floor}\Big(\tfrac{t}{T} \Big) \ .$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the bit period (&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{T}$&lt;/span&gt; is the baud rate or bps).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete-time bipolar binary signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA; x[n] &amp;amp;\triangleq  -1  +  2 a[n] \quad \in \{-1, 1 \} \\&#xA;  &amp;amp;=  -(-1)^{a[n]} \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a[n] \in \{$&lt;/span&gt;&lt;code&gt;0, 1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$\}$&lt;/span&gt; is our serial bit stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's the negative of the other bipolar binary convention of &lt;span class=&quot;math-container&quot;&gt;$x[n] \triangleq (-1)^{a[n]} $&lt;/span&gt; which some folks like to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete-time (and discrete amplitude) in-phase and quadrature modulation signals are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;i[n] \ &amp;amp;= \ g[n] x[n] \ + \ (1-g[n]) x[n-1] \\&#xA;q[n] \ &amp;amp;= \ (1-g[n]) x[n] \ + \ g[n] x[n-1] \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$g[n]$&lt;/span&gt; is an even/odd gating signal defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ g[n]  \triangleq  \tfrac{1}{2}\left( 1 + (-1)^n \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 1-g[n]  =  \tfrac{1}{2}\left( 1 - (-1)^n \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; even, &lt;span class=&quot;math-container&quot;&gt;$g[n]=1$&lt;/span&gt; and only &lt;span class=&quot;math-container&quot;&gt;$i[n]$&lt;/span&gt; can change, while for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; odd, &lt;span class=&quot;math-container&quot;&gt;$1-g[n]=1$&lt;/span&gt; and only &lt;span class=&quot;math-container&quot;&gt;$q[n]$&lt;/span&gt; can change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Defining&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;n_\text{even} &amp;amp; \triangleq 2\Big\lfloor \tfrac{n}{2} \Big\rfloor \\&#xA;n_\text{odd}  &amp;amp; \triangleq 2\Big\lfloor \tfrac{n-1}{2} \Big\rfloor + 1 \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ \big\lfloor u \big\rfloor \triangleq\operatorname{floor}(u) $&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then, for a given pair of bits &lt;span class=&quot;math-container&quot;&gt;$( a[n_\text{even}], a[n_\text{odd}] )$&lt;/span&gt;, the IQ constellation looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/Pi-by-O-QPSK_Gray_Coded.svg/461px-Pi-by-O-QPSK_Gray_Coded.svg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/Pi-by-O-QPSK_Gray_Coded.svg/461px-Pi-by-O-QPSK_Gray_Coded.svg.png&quot; alt=&quot;OQPSK&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But only one bit can change at any time, so you cannot go from &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; directly to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; or from &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; directly to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt;.  You can go from &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; directly to  &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt;, but not to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; (in a single bit time).  The amplitude of the OQPSK signal remains about constant, staying in the perimeter, never passing through the origin. This is what I presume is the advantage of using Offset QPSK instead of regular QPSK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gating functions can be expressed slightly differently:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA; g[n]  &amp;amp;=  \tfrac{1}{2}\left( 1 + (-1)^n \right) \\&#xA;       &amp;amp;=  \tfrac{1}{2}\left( 1 + e^{j \pi n} \right) \\&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA; 1-g[n]  &amp;amp;=  \tfrac{1}{2}\left( 1 - (-1)^n \right) \\&#xA;         &amp;amp;=  \tfrac{1}{2}\left( 1 - e^{j \pi n} \right) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which makes the IQ signals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;i[n] \ &amp;amp;= \ g[n] x[n] \ + \ (1-g[n]) x[n-1] \\&#xA;       &amp;amp;= \ \tfrac{1}{2}\left( (1 + e^{j \pi n}) x[n] \ + \ (1 - e^{j \pi n}) x[n-1] \right) \\&#xA;       &amp;amp;= \ \tfrac{1}{2}\left( (x[n] + x[n-1]) + e^{j \pi n}(x[n] - x[n-1]) \right) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA; q[n] \ &amp;amp;= \ (1-g[n]) x[n] \ + \ g[n] x[n-1] \\&#xA;        &amp;amp;= \ \tfrac{1}{2}\left( (1 - e^{j \pi n}) x[n] \ + \ (1 + e^{j \pi n}) x[n-1] \right) \\&#xA;       &amp;amp;= \ \tfrac{1}{2}\left( (x[n] + x[n-1]) - e^{j \pi n}(x[n] - x[n-1]) \right) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expressing in terms of the DTFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;I(e^{j\omega}) \ &amp;amp;= \ \tfrac{1}{2}\left( (1 + e^{-j\omega}) X(e^{j\omega}) + (1 - e^{-j(\pi+\omega)})X(e^{j(\pi+\omega)}) \right) \\&#xA;  &amp;amp;= \ \tfrac{1}{2}\left( (1 + e^{-j\omega}) X(e^{j\omega}) + (1 + e^{-j\omega}) X(e^{j(\pi+\omega)}) \right) \\&#xA;  &amp;amp;= \ \tfrac{1}{2}(1 + e^{-j\omega}) \left( X(e^{j\omega}) + X(e^{j(\pi+\omega)}) \right) \\&#xA;  &amp;amp;= \ e^{-j\omega/2} \cos(\omega/2) \left( X(e^{j\omega}) + X(e^{j(\pi+\omega)}) \right) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;Q(e^{j\omega}) \ &amp;amp;= \ \tfrac{1}{2}\left( (1 + e^{-j\omega}) X(e^{j\omega}) - (1 - e^{-j(\pi+\omega)})X(e^{j(\pi+\omega)}) \right) \\&#xA;  &amp;amp;= \ \tfrac{1}{2}\left( (1 + e^{-j\omega}) X(e^{j\omega}) - (1 + e^{-j\omega}) X(e^{j(\pi+\omega)}) \right) \\&#xA;  &amp;amp;= \ \tfrac{1}{2} (1 + e^{-j\omega}) \left( X(e^{j\omega}) - X(e^{j(\pi+\omega)}) \right) \\&#xA;  &amp;amp;= \ e^{-j\omega/2} \cos(\omega/2) \left( X(e^{j\omega}) - X(e^{j(\pi+\omega)}) \right) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DTFT of the composite IQ baseband signal, &lt;span class=&quot;math-container&quot;&gt;$i[n] + j q[n]$&lt;/span&gt;, is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA; I(e^{j\omega}) + j Q(e^{j\omega}) &amp;amp;= \ e^{-j\omega/2} \cos(\omega/2) \left( (1+j) X(e^{j\omega}) + (1-j)X(e^{j(\pi+\omega)}) \right) \\&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; has spectrum &lt;span class=&quot;math-container&quot;&gt;$X(e^{j\omega})$&lt;/span&gt;.  The term &lt;span class=&quot;math-container&quot;&gt;$X(e^{j(\pi+\omega)})$&lt;/span&gt; is the spectrum, flipped left-to-right of the same data signal.  The DC component of &lt;span class=&quot;math-container&quot;&gt;$X(e^{j\omega})$&lt;/span&gt; becomes the Nyquist component of &lt;span class=&quot;math-container&quot;&gt;$X(e^{j(\pi+\omega)})$&lt;/span&gt; and vice-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also the simple first-order FIR low-pass filter &lt;span class=&quot;math-container&quot;&gt;$\tfrac{1}{2} (1 + e^{-j\omega})$&lt;/span&gt;, which has gain of 1 at DC and a gain of 0 at Nyquist.  This is what reduces the bandwidth of the OQPSK modulated signal and is the natural advantage gained from it.  There is &lt;strong&gt;no&lt;/strong&gt; Nyquist component that gets through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, it seems to me that one can, without the use of logic (like XOR, etc.) define a reasonably linear mathematical signal-processing model of OQPSK directly from the serial bit stream &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt;, and use that to get an idea of the spectrum for cases like &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; = &lt;code&gt;01010101...&lt;/code&gt;  or &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; = &lt;code&gt;00110011...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first case where the bits values toggle every bit time, such as &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; = &lt;code&gt;01010101...&lt;/code&gt; or &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; = &lt;code&gt;10101010...&lt;/code&gt;, then &lt;span class=&quot;math-container&quot;&gt;$X(e^{j\omega})$&lt;/span&gt; has only a Nyquist component and that is filtered out by the simple LPF.  But that Nyquist component in &lt;span class=&quot;math-container&quot;&gt;$X(e^{j\omega})$&lt;/span&gt; becomes a DC component in &lt;span class=&quot;math-container&quot;&gt;$X(e^{j(\pi+\omega)})$&lt;/span&gt; and only that component gets through the LPF.  So when the bits are toggling &lt;code&gt;01010101...&lt;/code&gt; or &lt;code&gt;10101010...&lt;/code&gt;, the signal &lt;span class=&quot;math-container&quot;&gt;$i[n] + j q[n]$&lt;/span&gt; is solely DC and we're stuck on either the &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; points in the IQ constellation above.  After bumping up to the carrier frequency, the output would be at solely at frequency &lt;span class=&quot;math-container&quot;&gt;$f_\text{c}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So also would an unchanging bit stream of &lt;code&gt;00000000...&lt;/code&gt; or &lt;code&gt;11111111...&lt;/code&gt; result in only DC in the data and only &lt;span class=&quot;math-container&quot;&gt;$f_\text{c}$&lt;/span&gt; in the modulated carrier out.  We would be stuck on only the &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; points of the constellation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the bits are &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; = &lt;code&gt;01100110...&lt;/code&gt;, that would move &lt;span class=&quot;math-container&quot;&gt;$( a[n_\text{even}], a[n_\text{odd}] )$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; and back to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; in four bit times.  That moves around the constellation diagram in the &lt;strong&gt;clockwise&lt;/strong&gt; sense (which is decreasing angle in the complex IQ plane) and is detuning the carrier down by &lt;span class=&quot;math-container&quot;&gt;$-\tfrac12$&lt;/span&gt; Nyquist &lt;span class=&quot;math-container&quot;&gt;$= -\tfrac{1}{4T}$&lt;/span&gt;.  And this is the lowest modulated frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when the bits are paired and toggling between each pair, as with &lt;span class=&quot;math-container&quot;&gt;$a[n]$&lt;/span&gt; = &lt;code&gt;00110011...&lt;/code&gt;, then the &lt;span class=&quot;math-container&quot;&gt;$( a[n_\text{even}], a[n_\text{odd}] )$&lt;/span&gt; pair moves from &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;1,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; and back to &lt;span class=&quot;math-container&quot;&gt;$($&lt;/span&gt;&lt;code&gt;0,0&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; in four bit times.  That moves around the constellation diagram in the &lt;strong&gt;counterclockwise&lt;/strong&gt; sense (which is increasing angle in the complex IQ plane) and is detuning the carrier up by &lt;span class=&quot;math-container&quot;&gt;$+\tfrac12$&lt;/span&gt; Nyquist &lt;span class=&quot;math-container&quot;&gt;$= +\tfrac{1}{4T}$&lt;/span&gt;.  That is the highest modulated frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It just seems to me to be logical to use the 16-bit sequences &lt;code&gt;0011001100110011&lt;/code&gt; and &lt;code&gt;0110011001100110&lt;/code&gt; as bookends for a packet of data.  To delimit one packet from the next and also as unique signals to reset the receiver into a &lt;code&gt;begin packet&lt;/code&gt; state and an &lt;code&gt;end packet&lt;/code&gt; state and also to derive a bit sync clock from it.  What if the data happens to have a run of &lt;code&gt;0011001100110011&lt;/code&gt; or &lt;code&gt;0110011001100110&lt;/code&gt;?  You don't want a 16-bit run of either of those two patterns to trigger a &lt;code&gt;begin packet&lt;/code&gt; state and an &lt;code&gt;end packet&lt;/code&gt; state in the receiver. They both have a 15-bit run of &lt;code&gt;011001100110011&lt;/code&gt;, so we need to prohibit that run in the data and reserve it for use as a bookmark.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way they dealt with this in the old SDLC protocol adapted here would be whenever the 14-bits of &lt;code&gt;01100110011001&lt;/code&gt; occur in the data stream to always insert a bogus &lt;code&gt;0&lt;/code&gt; following that last &lt;code&gt;1&lt;/code&gt; no matter what the next data bit turns out to be.  And at the receiver, upon recognizing the 15-bits &lt;code&gt;011001100110010&lt;/code&gt;, to always remove that trailing &lt;code&gt;0&lt;/code&gt; from the stream.  That may, for some data packets, increase the length by a bit or two, but the bookend symbols could be counted on to appear &lt;strong&gt;only&lt;/strong&gt; when a bookend occurs and the bookends would delimit the highest and lowest modulated frequencies for a sustained time of 16 bits.  And I believe a decent packet sync and bit sync clock could be derived from the bookends and used to place your IQ vector in the correct spot at the beginning of a packet.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2019-04-14T07:57:06.480" LastActivityDate="2019-04-14T07:57:06.480" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26581" PostTypeId="1" AcceptedAnswerId="26584" CreationDate="2015-10-22T07:13:35.597" Score="1" ViewCount="228" Body="&lt;p&gt;Is there any way I could utilise &lt;code&gt;findpeaks&lt;/code&gt; in conjunction with &lt;code&gt;fvtool&lt;/code&gt;? I would like to know where on the frequency axis the maximum and minimum of my frequency response happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kzlrd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kzlrd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17915" LastActivityDate="2015-10-22T08:18:47.947" Title="Matlab - Using findpeaks with fvtool" Tags="|matlab|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26582" PostTypeId="1" AcceptedAnswerId="26592" CreationDate="2015-10-22T07:29:54.280" Score="9" ViewCount="1276" Body="&lt;p&gt;I want learn digital filter design. My knowledge of math is at high school level. I can learn math through the Internet. Then, what fields of math do I have to learn? &lt;/p&gt;&#xA;" OwnerUserId="17893" LastEditorDisplayName="user4944" LastEditDate="2015-10-22T18:36:35.753" LastActivityDate="2015-11-03T09:58:20.357" Title="Fields of math needed for digital filter design" Tags="|filter-design|reference-request|" AnswerCount="5" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26583" PostTypeId="2" ParentId="26582" CreationDate="2015-10-22T08:03:55.867" Score="10" Body="&lt;p&gt;To get started:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Complex numbers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response of a filter is easier to understand complex-valued, describing both the magnitude frequency response and the phase frequency response. You will be able to understand poles and zeros, which can be complex. Complex numbers enable you to have negative frequencies, which will make math simpler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Trigonometry&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sin$, $\cos$ and their relation to the complex exponential $e^{i\alpha} = \cos(\alpha) + i\sin(\alpha)$ are important. Sinusoidal functions will be passed through filters with only their amplitude and phase affected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Differentiation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find at what frequency a simple filter peaks or dips, you can solve at what frequency the derivative of its magnitude frequency response is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Integration&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integration is needed for the Fourier transform and the inverse Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Fourier transform&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier transform enables you to go from an impulse response to a frequency response and back. Also things you do in the time domain often have a simple counterpart in the frequency domain, and vice versa.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-22T13:19:53.740" LastActivityDate="2015-10-22T13:19:53.740" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26584" PostTypeId="2" ParentId="26581" CreationDate="2015-10-22T08:18:47.947" Score="1" Body="&lt;p&gt;&lt;code&gt;fvtool&lt;/code&gt; is interactive so it doesn't let you recover an data in a script. Fortunately you can use the &lt;code&gt;freqz&lt;/code&gt; function to get the same frequency response. Something like this might work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[h,w] = freqz(b,a);  % h is frequency response, w normalized frequency&#xA;mag = 20*log10(abs(h));&#xA;[minval,minidx] = min(mag);&#xA;minfreq = w(minidx); &#xA;[maxval,maxidx] = max(mag);&#xA;maxfreq = w(mcxidx);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-10-22T08:18:47.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26585" PostTypeId="2" ParentId="26577" CreationDate="2015-10-22T08:33:20.240" Score="6" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a sequence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{x}[n]=\begin{cases}x[n],&amp;amp;n\text{ even}\\0,&amp;amp;n\text{ odd}\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the DTFT of $x[2n]$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}x[2n]e^{-jn\omega}=\sum_{n=-\infty}^{\infty}\hat{x}[n]e^{-jn\omega/2}=\hat{X}(e^{j\omega/2})\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can obtain $\hat{x}[n]$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{x}[n]=\frac12\left(x[n]+(-1)^nx[n]\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the DTFT of $(2)$ to express $\hat{X}(e^{j\omega})$ in terms of $X(e^{j\omega})$, and using $(1)$ will give the desired result.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-22T08:33:20.240" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26586" PostTypeId="2" ParentId="26531" CreationDate="2015-10-22T08:38:02.883" Score="5" Body="&lt;p&gt;If you'd like to think analog, an OFDM signal can be written as a sum of weighted complex sinusoidals:&#xA;$$&#xA;x(t)=\sum_{k=0}^{N-1}X_k \exp{\left( \mathrm j 2\pi\frac{kf_\mathrm{s}}{N}t \tag{1}\right)},&#xA;$$&#xA;where $N$ is the number of subcarriers, $f_\mathrm{s}$ is the sampling frequency and $X_k$ denotes the subcarrier values. For a digital implementation, (1) is sampled at $t=n/f_\mathrm{s}$:&#xA;$$&#xA;x(n/f_\mathrm{s})=\sum_{k=0}^{N-1}X_k \exp{\left( \mathrm j 2\pi\frac{kn}{N} \tag{2}\right)},&#xA;$$&#xA;which corresponds to the inverse discrete Fourier transform (IDFT), implemented by an IFFT. The IFFT has $N$ input values and $N$ output values. That's ok, because the IDFT is N-periodic and thus any additional sample would be redundant. Consequently, every subcarrier in (1) is represented by $N$ samples, regardless of its number of periods during the OFDM symbol length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you try to imagine the digital OFDM time domain signal as a superposition of $N$ sampled sinusoidals, the figure you posted has two problems, in my opinion: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The first subcarrier in the image obviously has frequency $f_\mathrm{s}/N$ and the fourth subcarrier has frequency $f_\mathrm{s}$. That's wrong. From (1) you can see that the first subcarrier should have frequency 0 and the fourth should have frequency $(N-1)f_\mathrm{s}/N$. You can reorder the subcarriers (e.g. from negative to positive) but the DC subcarrier must be included and there must not exist a subcarrier with frequency $f_\mathrm{s}$. (One could argue that subcarriers with frequency 0 and $f_\mathrm{s}$ are actually the same but I think it's a poor choice for an illustration)&lt;/li&gt;&#xA;&lt;li&gt;The image only shows the real (or imaginary) part of the sinusoidals. That could give you the impression that some aliasing is going on when sampling. I will explain in a second what I mean.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Please consider the following figure that I have created instead&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JUJZH.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JUJZH.png&quot; alt=&quot;Subcarriers of an OFDM signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It contains the subcarriers from $k=0$ to $k=3$ (lines) and their samples (dots). It also shows the real part (blue) and imaginary part (red). Now consider the red line in the first and the third subfigure: their samples are exactly the same. However, the blue (imaginary) part is different. That is, $N=4$ samples are sufficient here to represent all subcarriers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the Matlab code I used to create the above figure:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 4; % num subcarriers&#xA;os = 128; % oversampling&#xA;t = linspace(0, 1-1/(N*os), N*os); % time&#xA;n = 0:N-1; % discrete time&#xA;&#xA;figure;&#xA;cnt = 1; % helper&#xA;for k = 0:N-1;&#xA;    subcarrier = exp(1i * 2*pi*k*t);&#xA;&#xA;    subplot(N,1,cnt);&#xA;    plot( t, real(subcarrier), 'b-');&#xA;    hold on;&#xA;    plot( t(n*os+1), real(subcarrier(n*os+1)), 'b.', 'MarkerSize', 20);&#xA;&#xA;    plot( t, imag(subcarrier), 'r--');&#xA;    hold on;&#xA;    plot( t(n*os+1), imag(subcarrier(n*os+1)), 'r.', 'MarkerSize', 20);&#xA;&#xA;    if(k ~= N-1)&#xA;        set(gca, 'XTick', []);&#xA;    else&#xA;        xlabel('t/T');&#xA;    end&#xA;    ylim([-1 1]);&#xA;    title( sprintf('k=%d', k));&#xA;&#xA;    cnt = cnt + 1;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-10-22T08:38:02.883" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26587" PostTypeId="2" ParentId="26576" CreationDate="2015-10-22T08:45:10.880" Score="4" Body="&lt;p&gt;You correctly figured out that the occurring integrals don't converge in the conventional sense. The easiest (and definitely non-rigorous) way to see the result is by noting the Fourier transform relation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1\Longleftrightarrow 2\pi\delta(\Omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the shifting/modulation property we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{j\Omega_0t}\Longleftrightarrow 2\pi\delta(\Omega-\Omega_0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So each term $e^{jn\Omega_s t}$ in the Fourier series transforms to $2\pi\delta(\Omega-n\Omega_s)$, and the result follows.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-22T08:45:10.880" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26588" PostTypeId="1" CreationDate="2015-10-22T09:30:43.287" Score="3" ViewCount="648" Body="&lt;p&gt;I have detected corner points of images using Harris corner detector in GLSL and now, I intend on using Fast Retina Keypoint(FREAK) as keypoint descriptor to later match the keypoints between images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FREAK uses circular sampling pattern, where each circles represent Gaussian kernels applied to the corresponding sampling points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rRDV4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rRDV4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, the size of Gaussian kernel increase exponentially for points farther away from central keypoint. I previously used nine hit Gaussian blur as mentioned &lt;a href=&quot;http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. So, what is the most efficient way to perform Gaussian blurs for a number of Gaussian kernels with varying sizes, which also overlap themselves, in an image?&lt;/p&gt;&#xA;" OwnerUserId="17869" LastActivityDate="2016-05-06T06:49:06.523" Title="What is the most efficient way to perform Gaussian blurs for varying sizes of Gaussian kernels in an image?" Tags="|image-processing|gaussian|blur|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26589" PostTypeId="2" ParentId="26576" CreationDate="2015-10-22T11:35:18.860" Score="5" Body="&lt;p&gt;@MattL suggested a nice, simple way to see the above result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you want to see the result in the normal analysis equations you mentioned, you can do like below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say S(t) is a periodic train of impulses.So S(t) can be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\ S(t)= \sum_{n=-\infty}^{\infty} \delta(t-nT)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you take the fourier series of S(t),you can write S(t) as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(t) =\sum_{n=-\infty}^{\infty} C_ke^{jnw_ot} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $C_n$ are exponential fourier series coefficients and $w_o$ is the fundamental frequency .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So from exponential fourier series we know that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C_n= (1/T)\int_{-T/2}^{T/2} S(t)e^{-jnw_ot} dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in the above expression substitute the value of S(t) from the first expression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $$C_n = (1/T)\sum_{n=-\infty}^{\infty}\int_{-T/2}^{T/2} \delta(t-nT)e^{-jnw_ot} dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you have to make an observation, if you observe the integral, it's from -T/2 to +T/2. During this integral period, observe that only a single impulse $\delta(t)$ exists.All the other impulse functions in the summation occur after T/2 or before -T/2. So in total the above equation for $C_n$ can be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C_n = (1/T)\sum_{n=-\infty}^{\infty} \delta(t)e^{-jnw_ot}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From sifting property we can write the above as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C_n = (1/T)e^{-jw_on(0)} = (1/T)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now put this value of $C_n$ in the first S(t) equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(t) = (1/T)\sum_{n=-\infty}^{\infty} e^{jnw_ot}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now find the fourier transform of above equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1\Longleftrightarrow 2\pi\delta(w)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{jw_ot}\Longleftrightarrow 2\pi\delta(w-w_o)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the fourier transform is &#xA;$$S(jw) = (2\pi/T)\sum_{n=-\infty}^{\infty} \delta(w-nw_o)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should help.&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="4375" LastEditDate="2015-10-22T17:00:38.093" LastActivityDate="2015-10-22T17:00:38.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26591" PostTypeId="2" ParentId="24245" CreationDate="2015-10-22T11:55:38.860" Score="1" Body="&lt;p&gt;Phase of raised-cosine filter is calculated by taking Hilbert transform of magnitude as defined in this question: &lt;a href=&quot;https://dsp.stackexchange.com/questions/24503/hilbert-transform-filters-two-different-phase-graphs&quot;&gt;Hilbert Transform, filters - two different phase graphs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15718" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-10-22T11:55:38.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26592" PostTypeId="2" ParentId="26582" CreationDate="2015-10-22T13:40:04.360" Score="7" Body="&lt;p&gt;If you have the balls to learn math by yourself. The two fields of Mathematics that you need to dominate in order to do filter design are: Functional Analysis and convex optimization.&#xA;Pretty much every filter design is the result of an optimization problem, like:&#xA;Find these set of $N$ numbers such that the absolute value of the fourier transform in these frequency region has the following shape (between these two limits when frequency is 0Hz to 320Hz, and between these other two when frequency is greater than 340Hz).&#xA;Or, what is the set of $N$ numbers such that when applying the discrete convolution of the sequence of the numbers to this signal $x(n)$, the result is this signal $y(n)$.&#xA;And there are many other ways of defining them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you will need functional analysis in order to understand how to model a signal, how to model a system, and how to model the interactions and operations between signals (transforms, convolutions, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it Helps.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2015-10-22T13:40:04.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26593" PostTypeId="1" AcceptedAnswerId="26597" CreationDate="2015-10-22T14:52:23.407" Score="1" ViewCount="92" Body="&lt;p&gt;I have images with lines/bands, the bands/lines are parallel but can be of different gray levels, I want to extract or trace the lines/bands as single line, all lines/bands are parallel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source:&lt;a href=&quot;https://i.stack.imgur.com/Z1OIl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z1OIl.png&quot; alt=&quot;source image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Output Plot:&lt;a href=&quot;https://i.stack.imgur.com/7L2IT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7L2IT.png&quot; alt=&quot;plot of the solution&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source image contain sine wave lines (10 pixels in amplitude) that are stacked on top on of each other forming what looks like bands. I used the location of the max of the cross-correlation of the first column with other columns of the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for other approaches as cross correlation is too expensive and very sensitive to noise.&lt;/p&gt;&#xA;" OwnerUserId="17922" LastActivityDate="2015-11-25T18:18:49.747" Title="Find tracing/plotting stacked bands/lines in an image" Tags="|image-processing|signal-detection|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26594" PostTypeId="1" AcceptedAnswerId="26602" CreationDate="2015-10-22T16:37:52.727" Score="1" ViewCount="1495" Body="&lt;p&gt;I'm trying to solve the following question, but I've been told I'm doing it incorrectly. Could anyone here give me a hint as to where I'm tripping up? Below follows my current solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hY4PY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hY4PY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do the following to solve it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) &#xA;$ y[n] = 3 ( x[n] + \frac{1}{3}x[n-1] + 2x[n]) + 6x[n-1] = 3x[n] + x[n-1] +6x[n] + 6x[n-1] = 9x[n] + 7x[n-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) I find the system function: $H(z) = \frac{Y(z)}{X(z)} = \frac{9X(z)+7z^{-1}X(z)}{X(z)} = 9 + 7 z^{-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I apply the inverse z-transform and find the impulse response:&#xA;$h[n] = 9\delta[n] + 7\delta[n-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="17451" LastActivityDate="2015-12-22T00:32:25.463" Title="Discrete time system signal flow graph problem" Tags="|discrete-signals|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26595" PostTypeId="2" ParentId="26549" CreationDate="2015-10-22T17:12:41.860" Score="1" Body="&lt;p&gt;Your result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\sum_{k=-9}^9a_ke^{j2\pi kn/N}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $N=6$ is correct. If you compare $(1)$ to the IDFT (or DFS)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi kn/N}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you'll notice that in $(2)$ each term $e^{j2\pi kn/N}$ occurs only once for each value of $k$ (for fixed $n$), whereas in $(1)$, due to the periodicity of the complex exponential, each term $e^{j2\pi kn/N}$ occurs several times. E.g., for $k=0$ in $(2)$, in $(1)$ you get contributions for $k=0$, for $k=6$, and for $k=-6$ (because $N=6$). Consequently, comparing $(1)$ and $(2)$ gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[0]=N(a_0+a_6+a_{-6})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For all other values of $k$, the procedure is completely analogous: search for indices $k$ in $(1)$ which have the same complex exponential term $e^{j2\pi kn/N}$. You basically have to keep adding and subtracting the number $N=6$ to the indices, as long you remain in the range $|k|\le 9$, so e.g. for $X[2]$ you get contributions for $k=2$, $k=2+6=8$, and $k=2-6=-4$, because they all have the same exponential term $e^{j4\pi n/N}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: The term $2\pi$ in your textbook result doesn't make sense to me, it should be $N$, as already pointed out in a comment.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-22T17:12:41.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26597" PostTypeId="2" ParentId="26593" CreationDate="2015-10-22T18:34:29.707" Score="0" Body="&lt;p&gt;Why not try just summing the columns of the image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/A9pkW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A9pkW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, you could try smoothing the image first, but that will have the same effect as just smoothing the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ktKrq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ktKrq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;R code for this is below the first lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the extra image, processed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/W38Xx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/W38Xx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 26593&#xA;# install.packages(&quot;png&quot;)&#xA;&#xA;file &amp;lt;- &quot;Q26593_original.png&quot;&#xA;&#xA;library(png)&#xA;&#xA;img &amp;lt;- readPNG(file)&#xA;&#xA;d &amp;lt;- dim(img)&#xA;&#xA;par(mfrow=c(2,1))&#xA;plot(1:2, type='n', main=&quot;Plotting Over an Image&quot;, xlab=&quot;x&quot;, ylab=&quot;y&quot;)&#xA;lim &amp;lt;- par()&#xA;rasterImage(img, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4])&#xA;&#xA;plot(colSums(img[,,1]), type=&quot;l&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code #2 Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 26593&#xA;# install.packages(&quot;png&quot;)&#xA;# install.packages(&quot;EBImage&quot;) --- Didn't work.&#xA;# ## try http if https is not available&#xA;# source(&quot;http://bioconductor.org/biocLite.R&quot;)&#xA;# biocLite(&quot;EBImage&quot;)&#xA;&#xA;file &amp;lt;- &quot;Q26593_original.png&quot;&#xA;&#xA;library(png)&#xA;library(EBImage)&#xA;&#xA;img &amp;lt;- readPNG(file)&#xA;&#xA;d &amp;lt;- dim(img)&#xA;&#xA;#xx &amp;lt;- (0:(d[2]-1) - d[2]/2)/d[2]&#xA;#yy &amp;lt;- (0:(d[1]-1) - d[1]/2)/d[1]&#xA;#sigma &amp;lt;- 0.2&#xA;&#xA;#w &amp;lt;-  exp(-yy*yy/sigma) %*%  t(exp(-xx*xx/sigma)) &#xA;#w1 &amp;lt;- exp(-yy*yy/sigma) %*% t(rep(1,d[2]))&#xA;&#xA;f &amp;lt;- makeBrush(11, shape='disc', step=FALSE)&#xA;imgf &amp;lt;- filter2(img, f)&#xA;imgf &amp;lt;- imgf/max(imgf)&#xA;&#xA;par(mfrow=c(3,1))&#xA;plot(1:2, type='n', main=&quot;Filtered Image&quot;, xlab=&quot;x&quot;, ylab=&quot;y&quot;)&#xA;lim &amp;lt;- par()&#xA;rasterImage(imgf, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4])&#xA;&#xA;#plot(1:2, type='n', main=&quot;Window Function&quot;, xlab=&quot;x&quot;, ylab=&quot;y&quot;)&#xA;#lim &amp;lt;- par()&#xA;#rasterImage(w1, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4])&#xA;&#xA;plot(colSums(imgf[,,1]), type=&quot;l&quot;, main=&quot;Column sum of filtered image&quot;)&#xA;&#xA;plot(filter(colSums(img[,,1]), rep(1,11)), type=&quot;l&quot;, main=&quot;Column sum of unfiltered image, filtered&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-24T00:30:56.647" LastActivityDate="2015-10-24T00:30:56.647" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26598" PostTypeId="1" CreationDate="2015-10-22T18:39:51.407" Score="2" ViewCount="41" Body="&lt;p&gt;I have two equations of images &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g_1=f_1+h_2*f_2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g_2=f_2+h_1*f_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $*$ is convolution and $g_1,g_2,h_1,h_2$ are known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I find $f_1$ and $f_2$?&lt;/p&gt;&#xA;" OwnerUserId="17927" LastEditorUserId="80" LastEditDate="2015-10-22T18:51:10.493" LastActivityDate="2015-10-23T20:00:44.843" Title="How to solve a two variable equation of images?" Tags="|image-processing|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26599" PostTypeId="1" CreationDate="2015-10-22T18:44:51.220" Score="1" ViewCount="496" Body="&lt;p&gt;What does exactly and precisely the term &quot;fine-grained&quot; mean in image segmentation? &#xA;For example, undeniably, the picture below is a fine-grained image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/61YV1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/61YV1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is it correct to call below picture as a fine-grained image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Z61Ao.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z61Ao.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OAARb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OAARb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it means a picture with details. In my idea, by accepting this definition, every picture out there can be called &quot;fine-grained&quot;.&#xA;Could anybody explain as precisely as possible what exactly a &quot;fine-grained&quot; image is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="8202" LastEditDate="2015-10-22T20:04:16.930" LastActivityDate="2015-10-23T16:29:34.657" Title="What is &quot;find-grained&quot; image?" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26600" PostTypeId="2" ParentId="26594" CreationDate="2015-10-22T18:46:05.823" Score="1" Body="&lt;p&gt;Have a look at the cycle around the indicated node. Your equations don't appear to take that into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Pu46S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pu46S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-22T18:46:05.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26602" PostTypeId="2" ParentId="26594" CreationDate="2015-10-22T20:16:44.890" Score="2" Body="&lt;p&gt;There is clearly recursion in there and your solution does not reflect it since its purely FIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend doing this as a coupled difference equation: Define a new variable $v[n]$ at the point where Peter drew the circle and than derive the transfer function from (1) X-&gt;V and then (2) X and V -&gt; Y. Then you can eliminate V in eq (2) by using equation (1).&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-10-22T20:16:44.890" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26603" PostTypeId="1" CreationDate="2015-10-22T20:49:10.410" Score="1" ViewCount="75" Body="&lt;p&gt;I'm working with a special chip that allows me to record current draw on phones. This chip logs data with its internal timestamps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now need to generate a unique signal that will allow me to map the chip's timestamps with the phone's. Given how phone components are usually complex with low-power states, I've decided to use the flashlight to generate this signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming I can rapidly turn on and turn off the flashlight over a period of &lt;em&gt;n&lt;/em&gt; seconds, this will generate corresponding spikes in current draw.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What signal processing algorithms can I use to later identify the start/end of this flashlight (current-draw) pattern?&lt;/p&gt;&#xA;" OwnerUserId="17929" LastEditorUserId="17929" LastEditDate="2015-10-22T20:57:46.943" LastActivityDate="2015-10-22T20:57:46.943" Title="Algorithm to identify periodic signal spikes" Tags="|filters|algorithms|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26604" PostTypeId="2" ParentId="26599" CreationDate="2015-10-22T20:51:24.690" Score="1" Body="&lt;p&gt;Just looking at the Google results I find:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://sites.google.com/site/fgcomp2013/&quot; rel=&quot;nofollow&quot;&gt;FGComp2013&lt;/a&gt; which states: &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This challenge will target fine-grained classification, i.e. classification among categories which are are both visually and semantically very similar. This is a very difficult regime which is even challenging for humans without careful training, and is critical for establishing a more detailed understanding of the visual world.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://vision.stanford.edu/aditya86/ImageNetDogs/&quot; rel=&quot;nofollow&quot;&gt;The Stanford Dogs Dataset&lt;/a&gt; has its primary reference which states:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;First, being a fine-grained categorization problem,&#xA;  there is little inter-class variation. For example the basset&#xA;  hound and bloodhound share very similar facial characteristics&#xA;  but differ significantly in their color, while the&#xA;  Japanese spaniel and papillion share very similar color but&#xA;  greatly differ in their facial characteristics. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So the upshot is that &quot;fine-grained&quot; means that the classes that are trying to be distinguished between are visually very similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of a single image, it means that it is hard to see the differences across the entire image.  In that case, your top image is fine-grained. The dog and bird images are not.  Though if you zoomed into the hair of the dog or the feathers of the bird, I expect they would be.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-23T16:29:34.657" LastActivityDate="2015-10-23T16:29:34.657" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26606" PostTypeId="2" ParentId="26518" CreationDate="2015-10-22T22:52:45.733" Score="1" Body="&lt;p&gt;A naive approach would be to set a maximum size, .25 image width, and compare every possible square with every other possible square, in a &quot;sliding window&quot; fashion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So take a 5000 by 5000 square as your reference (eg 0,0 to 4999,4999).&#xA;now grab all the other possible &quot;windows&quot;. Start by comparing your reference square to the square at (5000,0 to 9999,4999), then compare your reference square to the square at (5001,0 to 10000,4999) then to (5002,0 to 10001,4999) etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your compare function could subtract the (greyscale) difference between each pixel of your reference frame and your target frame and give a score.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next (after comparing your reference to all other possible squares), you select a new reference, the square at (1,0 to 5000,4999) and compare that reference square to all other possible squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the whole process was done at the 5000,5000 size, you would know if any structure of size 5000x5000 matches any other part of the image (to a threshold).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you would make your reference square smaller, eg 4999x4999  and repeat the whole process at size 4999x4999 to see if any structure of size 4999x4999 is &quot;duplicated&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would proceed until your minimum size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then...you would want to try instead of squares...rectangles of different proportions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, this is computationally prohibitive, so you have to make compromises:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;make the source image smaller&lt;/strong&gt;. Only when you have a near match, check the high res map at that location&lt;/li&gt;&#xA;&lt;li&gt;slide by 10 pixel increments&lt;/li&gt;&#xA;&lt;li&gt;identify some basic reference structures yourself, and only use those as reference&lt;/li&gt;&#xA;&lt;li&gt;try a &quot;monte-carlo&quot; approach by trying random locations and getting statistics of promising locations for pixel by pixel checks&lt;/li&gt;&#xA;&lt;li&gt;implement on gpu &lt;/li&gt;&#xA;&lt;li&gt;limit the structures to only a few rectangle shapes rather than all&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;preprocess the image to have higher contrast&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;start by using small sizes (20x20 pixels) and once you find small matches, grow your &quot;square&quot; there to look for larger matches that might be the &quot;real&quot; duplicated structure&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So there's no magic. What there is is domain heuristics.  You tell your script what you think are the likely sizes/shapes/locations/orientations of structures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the question of &quot;why&quot; you need to identify duplicate structures is actually fundamental to how you will optimize the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &#xA;an entirely different approach would be to use some algorithm that's pre-tuned for &quot;object segmentation&quot; to go through and find anything that seems to have a defined boundary, then run a clustering algorithm on all the &quot;objects&quot;, and it should group the most similar ones together. Then you can manually select the matches or do a final threshold step. This is likely much more similar to how the &quot;human&quot; brain does it as is likely to be much faster&lt;/p&gt;&#xA;" OwnerUserId="17930" LastEditorUserId="17930" LastEditDate="2015-10-28T22:13:34.647" LastActivityDate="2015-10-28T22:13:34.647" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="26607" PostTypeId="1" CreationDate="2015-10-23T02:18:10.870" Score="-1" ViewCount="1264" Body="&lt;p&gt;Is there any kind of built-in function or formula that I can use to conveniently compute the (effective) bandwidth and (effective) duration of a given digital signal with known sampling frequency?&lt;/p&gt;&#xA;" OwnerUserId="16503" LastActivityDate="2015-10-23T06:27:28.820" Title="Given a discrete signal, how to get bandwidth and duration under MATLAB?" Tags="|matlab|discrete-signals|fourier-transform|bandwidth|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26608" PostTypeId="1" AcceptedAnswerId="26661" CreationDate="2015-10-23T03:47:29.593" Score="0" ViewCount="921" Body="&lt;p&gt;I am stuck in the part where I need to apply the MLSE Equalizer with Viterbi  code. The equalizer is an optimal. I am using the Communication Toolbox  &lt;a href=&quot;http://www.mathworks.com/help/comm/ref/comm.mlseequalizer-class.html#properties&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/comm/ref/comm.mlseequalizer-class.html#properties&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and cannot understand pretty much if the simulation is working properly or not. Basically, the equalizer is an FIR model and the channel is a multipath (not Rayleigh).  Following the example in the documentation, I cannot understand&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) What this statement does? Why is it calling the ML Equalizer here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  modSignal = step(hMod, data);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(2) In the example code, there is no statement for additive Additive White Gaussian noise. The example given in the documentation does not clearly mention if the additive white Gaussian noise has been incorporated into the transmitted signal. It only says &lt;code&gt;Introduce channel distortion&lt;/code&gt; . What kind of distortion is unclear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) Is the example properly functioning because the simulation BER = 0 for all SNR levels. I am sceptical if I am doing it properly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I shall be really obliged if some help is provided in how I should properly use the MLSE equalizer. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; : The code throws error : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error using comm.MLSEEqualizer/step&#xA;Complexity mismatch with input 1; expected complex, got real.&#xA;&#xA;Error in MLSEEqualization_test (line 47)&#xA;      eqSignal = step(hMLSEE,chanOutput);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wanted to see if I can apply MLSE for real signal also such as BPSK and to minimize the use of built-in functions for data generation, modulation and demodulation. This would help me to understand how the theoretical concepts can be put together in the code. That is why I am not using the communication toolbox for data generation and other steps; I am using only the MLSE EQualizer module provided in the toolbox. How can I go about this error message? The channel coefficients are real, noise is real and the data is also real. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 10^3 % number of bits or symbols&#xA;rand('state',100); % initializing the rand() function&#xA;randn('state',200); % initializing the randn() function&#xA;&#xA;&#xA;n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise, 0dB variance &#xA;Eb_N0_dB = [0:10]; % multiple Eb/N0 values&#xA;h=[1 0.6 0.3]';&#xA;&#xA;L = length(h);&#xA;for aa = 1:length(Eb_N0_dB)&#xA;&#xA;    % Transmitter&#xA;ip = rand(1,N)&amp;gt;0.0; % generating 0,1 with equal probability&#xA;data = 2*ip-1; % BPSK modulation 0 -&amp;gt; -1; 1 -&amp;gt; 1 &#xA;&#xA;   chanOutput = filter(h,1,data');&#xA;&#xA;&#xA;&#xA;    %% ----- ADDED&#xA;    EbN0 = Eb_N0_dB(aa);&#xA;    SNR_linear  = 10^(EbN0/10)*log2(M);&#xA;    SigPWR      = 1; %unit circle symbols&#xA;    NoisePWR    = SigPWR/SNR_linear;&#xA;    NoiseFactor = sqrt(NoisePWR/2); %half power complex half imaginary&#xA;&#xA;    hMod = comm.QPSKModulator(0,'SymbolMapping','Binary');&#xA;  %  hDemod = comm.QPSKDemodulator(0,'SymbolMapping','Binary');&#xA;    const = step(hMod,(0:M-1)'); % BPSK constellation&#xA;&#xA;            %% ----- ADD NOISE !!      &#xA;  %    noiseVec   = NoiseFactor*randn(N,1)+1j*NoiseFactor*randn(N,1);&#xA;   noiseVec   = NoiseFactor*randn(N,1);&#xA;      chanOutput = chanOutput+noiseVec;&#xA;&#xA;    hMLSEE = comm.MLSEEqualizer('TracebackDepth',10,...&#xA;                      'Channel',h, 'Constellation',const);&#xA;&#xA;    hError = comm.ErrorRate;&#xA;&#xA; % Equalize the channel output and demodulate&#xA;      eqSignal = step(hMLSEE,chanOutput);&#xA;      demodData = real(eqSignal) &amp;gt; 0;&#xA;   %   demodData = step(hDemod,eqSignal);&#xA; % Compute BER&#xA;      errorStats = step(hError, data, demodData);&#xA;&#xA;    fprintf('Error rate = %f\nNumber of errors = %d\n', ...&#xA;      errorStats(1), errorStats(2))&#xA;&#xA;    %assume 1 symbol error = 1 bit error (needs Gray coding in real system for this to be true)&#xA;    BER(aa) = errorStats(1); % SER ~= BER with undelrying Gray coding&#xA;end&#xA;&#xA;%% changed, this is already divided by N*N2&#xA;simBer = BER; % simulated ber&#xA;&#xA;&#xA;theoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber&#xA;close all&#xA;figure&#xA;semilogy(Eb_N0_dB,theoryBer,'b.-');&#xA;hold on&#xA;semilogy(Eb_N0_dB,simBer,'mx-');&#xA;axis([0 10 10^-5 0.5])&#xA;grid on&#xA;legend('theory', 'simulation');&#xA;xlabel('Eb/No, dB');&#xA;ylabel('Bit Error Rate');&#xA;title('Bit error probability curve for BPSK modulation');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="780" LastEditorUserId="128" LastEditDate="2017-09-27T10:26:21.087" LastActivityDate="2017-11-13T12:11:49.050" Title="Matlab: Help in understanding if the example for Maximum Likelihood Equalizer is properly functioning" Tags="|matlab|self-study|equalizer|maximum-likelihood-estimation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26609" PostTypeId="2" ParentId="26607" CreationDate="2015-10-23T06:27:28.820" Score="1" Body="&lt;p&gt;The answer is no. The bandwidth of a digital signal is half of the sample rate. The seconds of duration is the total number of samples divided by the sample rate. The sample rate is whatever you say it is - there is no way of decoding it from a signal. Analogously, it's a bit like determining the weight of an object without a scale. However, if you happen to know something about the frequency content of the signal then you could derive it's sample rate through analysis. For example, if you know the signal was a 1kHz sine wave, and you looked at the file and saw a sine wave that had a 48 sample period then you could assume the sample rate was 48000 since 48 samples is 1ms. In the weight analogy this would be akin to knowing the density and volume and then computing the weight from that.  &lt;/p&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-10-23T06:27:28.820" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26610" PostTypeId="1" AcceptedAnswerId="26622" CreationDate="2015-10-23T06:43:01.937" Score="5" ViewCount="585" Body="&lt;p&gt;This is something that bothers me from time to time and has always been hand-waved away with some plausible but non-rigorous explanation. For clarity, consider the QPSK case where we have the constellation points $(0,1), (1,0),(-1,0),(0,-1)$. What is the fundamental flaw in using the origin, and then three equidistant points separated by $\frac{2\pi}{3}$ radians? We would have the same minimum distance but with smaller average energy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the added annoyance in synchronization and differentiating between &quot;no message&quot; and &quot;the zero message&quot;. But these should be solvable with preambles and whatnot. I'm curious about the flaws that are more than just annoyances, the ones that makes this constellation a fundamentally bad idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I spoke without thinking, clearly the minimum distance would not be the same, it would be one in the zero-signal case and $\sqrt{2}$ in the standard case. The number of pairs at min. distance would be... uh... six...? &lt;/p&gt;&#xA;" OwnerUserId="9140" LastEditorUserId="9140" LastEditDate="2015-10-23T12:54:13.647" LastActivityDate="2015-10-23T16:57:11.517" Title="Why not use zero-signal in digital transmission?" Tags="|digital-communications|modulation|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26611" PostTypeId="1" CreationDate="2015-10-23T07:13:39.557" Score="0" ViewCount="2179" Body="&lt;p&gt;I'm a newbie on use of MATLAB and also in signals and systems. I need clarification and guide (with fundamental explanations please) on above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to generate a sampled square wave in MATLAB with following criteria; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal duration $T=5\mathrm{s}$, Sample frequency $f_s=40\mathrm{Hz}$. there are supposed to be $f_sT$ signal points (what does this mean please).&#xA;$\tau=1/100$. the square wave signals are zeros for the first $\frac{f_sT(1-\tau)}{2}$ points and also for the last $\frac{f_sT(1-\tau)}{2}$ points. they are one otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have done so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;&#xA;fs = 40;&#xA;t = [0:1/fs:5];&#xA;dc = 50;&#xA;x = square(2*pi*t);&#xA;%f=1 for a square wave&#xA;&#xA;plot (t,x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I right? I have no idea how to use tau, and what signal points imply here. Kindly assist. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="17932" LastEditorUserId="8202" LastEditDate="2015-10-23T08:07:01.700" LastActivityDate="2015-12-22T19:10:40.687" Title="Generating a Sampled Square Wave in Matlab" Tags="|matlab|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26613" PostTypeId="1" AcceptedAnswerId="26615" CreationDate="2015-10-23T09:07:19.013" Score="5" ViewCount="13217" Body="&lt;p&gt;if we have LTI system and we know unit step response of this system(we haven't original signal)&#xA;how we can calculate impulse response?&lt;/p&gt;&#xA;" OwnerUserId="17937" LastEditorUserId="4298" LastEditDate="2015-10-23T09:58:20.010" LastActivityDate="2022-02-27T19:18:25.150" Title="find impulse response from step response" Tags="|linear-systems|impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26615" PostTypeId="2" ParentId="26613" CreationDate="2015-10-23T09:51:56.893" Score="9" Body="&lt;p&gt;You can find the impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take the case of  a discrete system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $s[n]$ is the unit step response of the system, we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s[n]= u[n]\ast h[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h[n]$ is the impulse response of the system and $u[n]$ is the unit step function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now using commutative property you can write $$s[n]=h[n]\ast u[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expanding convolution we get $$s[n] = \sum_{k=-\infty}^{\infty}h[k]u[n-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can also be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s[n]=\sum_{k =-\infty}^{n} h[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we can see that unit step response is like an accumulator of all value of impulse response from $-\infty$ to $n$. So now impulse response can be written as the first difference of step response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=s[n] - s[n-1]$$&lt;/p&gt;&#xA;" OwnerUserId="4375" LastEditorUserId="8202" LastEditDate="2015-10-23T10:27:06.010" LastActivityDate="2015-10-23T10:27:06.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26616" PostTypeId="2" ParentId="26610" CreationDate="2015-10-23T11:16:37.057" Score="8" Body="&lt;p&gt;All implementation aspects aside, the constellation you propose performs worse than QPSK in an additve white gaussian noise (AWGN) channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I claim this based on simulations that I have run with Matlab calculating the symbol error rate (SER) as a function of signal-to-noise ratio (SNR). Here is the result:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vbDhm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vbDhm.png&quot; alt=&quot;SER vs SNR&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, for a given SNR, the proposed constellation has an higher SER than a QPSK constellation. Additionally, I expect the proposed scheme to perform even worse in terms of bit error rate (BER) as -- in contrast to QPSK -- &lt;a href=&quot;https://en.wikipedia.org/wiki/Gray_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gray labelling&lt;/a&gt; is not possible. Some details concerning the simulation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1 million bits per SNR value&lt;/li&gt;&#xA;&lt;li&gt;maximum likelihood decision&lt;/li&gt;&#xA;&lt;li&gt;additive, Gaussian distributed noise&lt;/li&gt;&#xA;&lt;li&gt;memoryless channel (no inter-symbol interference)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It might well be that I made a mistake writing the simulation script, so I &lt;a href=&quot;http://pastebin.com/ttaAXSpi&quot; rel=&quot;nofollow noreferrer&quot;&gt;uploaded it&lt;/a&gt; in case you would like to check my implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might not be the mathematically rigorous explanation that you have been hoping for. To answer your question theoretically, one would have to calculate the SER analytically. For that, one should first find the decision thresholds, which is the main problem (for me, at least). It's far from obvious, what the optimal decision thresholds would be. They are not straight lines as with QAM constellations but probably a kind of zero-centered disc with three &quot;rays&quot; emerging from its center. Calculation of the SER should probably involve a transformation of the problem to polar coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that kind of irregular constellation it also doesn't help much to compare the minimum distance, i.e. the length of a straight line between two given constellation points. It's true, that for a given mean signal energy, the outer points of the proposed contellation have greater distance to the inner point than any two points of the QPSK constellation. However, the inner point of the proposed contellation is surrounded by three other points which  decreases its decision area and consequently increases the symbol error probability for that point. It's not obvious what is better. According to the simulation, QPSK is better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The areas of the maximum likelihood decision can also be simulated. In the following image, each color corresponds to a distinct, decided symbol. The input to the decision device is a very noisy (0 dB SNR) signal with the proposed constellation.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xjy4a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xjy4a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can clearly see how the inner point is &quot;squeezed&quot; between the outer points. In my opinion, that is the reason why the proposed constellation performs worse than QPSK. Now that I see this plot, I find the SER calculation not so difficult anymore. With a little time it could be done.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2015-10-23T11:47:08.517" LastActivityDate="2015-10-23T11:47:08.517" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="26617" PostTypeId="1" AcceptedAnswerId="26623" CreationDate="2015-10-23T11:41:14.303" Score="5" ViewCount="1099" Body="&lt;p&gt;I was given a problem, but I couldn't solve. I did some researches but I still didn't figure it out. Here is the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An audio signal $ s(t) $ is generated by a speaker reflects in a wall with reflection coefficient $ \mu (\mu &amp;lt; 1) $. The signal $ x(t) $ is recorded by a microphone close to the speaker and far from the wall, after sampled, is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ x(t) = s(t) + \mu s(t - k) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ k $ is the delay given in samples due to the echo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my goal here is to estimate $ \mu $ and $ k $, observing the autocorrelation function of $ x(t) $, $ r_{xx}(l) $, that can be writen in function of the autocorrelation function of $ s(t) $, $ r_{ss}(l) $. I was able to compute this autocorrelation function and I got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ r_{xx}(l) = (1 + \mu^{2})r_{ss}(l) + \mu r_{ss}(l-k) + \mu r_{ss}(l+k) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it obvious has three peaks: when $ l = 0 $, when $ l = k $ and when $ l = -k $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that $ r_{ss}(l) = 0 $ for $ |l| &amp;gt; k/10 $, I think that I can obtain the value of k observing the side peaks, and the value of $ \mu $ observing the central peak, but i wasn't able to formalize it mathematically. Could anyone help me to do so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-10-23T18:34:53.553" Title="Echo cancelling using autocorrelation function" Tags="|discrete-signals|autocorrelation|correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26618" PostTypeId="1" AcceptedAnswerId="26619" CreationDate="2015-10-23T11:41:43.153" Score="3" ViewCount="963" Body="&lt;p&gt;My apology if following question is too simplistic to be asked but I have the following code which generates a nice &lt;code&gt;sine&lt;/code&gt; wave for me:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=64;&#xA;X=zeros(N,1);&#xA;X(2)=-32j;&#xA;X(N)=32j;&#xA;x=ifft(X);&#xA;stem(real(x));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/U4Hur.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U4Hur.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I was thinking I should be able to construct a &lt;code&gt;cosine&lt;/code&gt; wave in the similar way by changing the &lt;code&gt;X(2)&lt;/code&gt; and &lt;code&gt;X(N)&lt;/code&gt; values into some real mirrored values say &lt;code&gt;X(2)=-32&lt;/code&gt; and &lt;code&gt;X(N)=32&lt;/code&gt;. However, the output is not what I want i.e. a &lt;code&gt;cosine&lt;/code&gt; wave&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z5J9K.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z5J9K.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17915" LastActivityDate="2016-02-25T22:43:08.850" Title="Matlab - Constructing a Cosine wave with IFFT" Tags="|matlab|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26619" PostTypeId="2" ParentId="26618" CreationDate="2015-10-23T12:15:17.210" Score="4" Body="&lt;p&gt;You must keep in mind that for a real-valued signal, second half of your spectrum is a &lt;strong&gt;complex conjugate&lt;/strong&gt; of all values below the Nyquist frequency. In your case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X(2) = -32&#xA;X(N) = 32&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as you can see the coefficients are not the complex conjugate of each other. Because of that you are ending up with round-off errors, since two frequency components are cancelling each other out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is some modification to your code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc, clear all, close all&#xA;fs = 32;&#xA;dt = 1/fs;&#xA;&#xA;N=64;&#xA;X=zeros(N,1);&#xA;X(2)=32;&#xA;X(N)=conj(X(2));&#xA;s=ifft(X)';&#xA;&#xA;td = linspace(0, (length(s)-1)*dt,     length(s));&#xA;&#xA;stem(td, s, 'b', 'linewidth', 2)&#xA;grid on&#xA;legend({'reconstructed signal'})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which gives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TBBrb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TBBrb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2016-02-25T22:43:08.850" LastActivityDate="2016-02-25T22:43:08.850" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26620" PostTypeId="1" AcceptedAnswerId="26684" CreationDate="2015-10-23T15:25:55.023" Score="1" ViewCount="1644" Body="&lt;p&gt;I want to perform 2x interpolation on an audio signal sampled at 44.1KHz by upsampling the signal by adding a zero after each original sample and then using a lowpass filter to interpolate the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming an analogue elliptical filter (of order 10 or lower) as the basis for the design. What design specification would constitute a high quality audio interpolator that minimises aliasing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance a passband and stopband at 0.45 * Nyquist and 0.55 * Nyquist respectively (Nyquist = 22.05KHz) with a stopband attenuation of -50dB and passband ripple of -0.1dB would be common for a low cost commercial DAC (I appreciate that digital to analogue conversion is a slightly different scenario). Would there be better values for doing high quality audio interpolation that minimises aliasing and doesn't truncate too many of the high frequencies before 22.05KHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, is it a good idea to have the stop band above 22.05KHz for interpolation or does it not matter if the lowpass rolls off a little after 22.05KHz and what is acceptable?&lt;/p&gt;&#xA;" OwnerUserId="15030" LastActivityDate="2015-10-27T08:24:01.790" Title="Designing a 2x interpolation filter for audio" Tags="|filter-design|interpolation|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26621" PostTypeId="1" CreationDate="2015-10-23T15:47:22.877" Score="0" ViewCount="54" Body="&lt;p&gt;I have to find $E\{s_m\cdot s_n^*\}$, where $E$ denotes mean or expected value; $s$ is a signal at $m \in [1\ldots M]$ elements and $^*$ denotes its conjugate. I am doing it by dividing it into two parts, i.e first finding $E\{s_m\cdot s_n^*\}$ for say $m=n$ and then finding $E\{s_m\cdot s_n^*\}$ for $m\ne n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is do I need to simply add the values obtained by computing $E\{s_m\cdot s_n^*\}$ for say $m=n$ and $E\{s_m\cdot s_n^*\}$ for $m \ne n$ in order to get the value of $E\{s_m\cdot s_n^*\}$? Would it be correct to add in this way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any input.&lt;/p&gt;&#xA;" OwnerUserId="17940" LastEditorUserId="80" LastEditDate="2015-10-23T16:11:34.370" LastActivityDate="2015-10-23T16:11:34.370" Title="Mean of the product of a signal with its conjugate" Tags="|signal-analysis|beamforming|" AnswerCount="0" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="26622" PostTypeId="2" ParentId="26610" CreationDate="2015-10-23T16:00:08.710" Score="5" Body="&lt;p&gt;As a complement to Deve's nice answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In regular QPSK, with symbol energy $E_s=1$, the distance between neighboring symbols is $d_{min}=\sqrt2$. For the same (average) symbol energy, the distance between neighbors in the proposed constellation is $d_{0,min}\approx1.15$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If two symbols are at distance $d$, then the probability of the receiver making an error, if the noise variance is $\sigma_n^2$, is $$P(e)=Q\left(\sqrt{\frac{(d/2)^2}{\sigma_n^2}}\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In QPSK each symbol has two neighbors, while in the proposed constellation each symbol has only one neighbor. However, the quasi-exponential nature of the $Q$ function means that the distance is the most important consideration to evaluate the probability of error. This means that, as Deve shows, the proposed constellation will perform worse than QPSK.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-10-23T16:57:11.517" LastActivityDate="2015-10-23T16:57:11.517" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26623" PostTypeId="2" ParentId="26617" CreationDate="2015-10-23T16:02:14.147" Score="3" Body="&lt;p&gt;Haven't you already got it there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{k} = \arg \max_{l &amp;gt; \frac{k}{10}} r_{xx}(l)&#xA;$$&#xA;and&#xA;$$&#xA;\hat{\mu} = \sqrt{\frac{r_{xx}(0) }{ r_{ss}(0) } - 1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The R code below outputs the figure and:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;k Estimate: 613  vs  613  mu Estimate :  0.747619585689531  vs  0.768768&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h9Rtb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h9Rtb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 26617&#xA;&#xA;T &amp;lt;- 10000&#xA;mu &amp;lt;- 0.768768&#xA;k &amp;lt;- 613&#xA;&#xA;s &amp;lt;- filter(runif(T,-1,1), rep(10/k,k/10), circular = TRUE)&#xA;&#xA;&#xA;x &amp;lt;- s + mu*c(rep(0,k),s[1:(T-k)])&#xA;&#xA;&#xA;par(mfrow=c(2,1))&#xA;r_xx = acf(x, lag.max=1000, type=&quot;covariance&quot;)&#xA;&#xA;min_idx &amp;lt;- floor(k/10)&#xA;mx &amp;lt;- which.max(r_xx$acf[(min_idx+1):10000])&#xA;&#xA;khat &amp;lt;- min_idx+mx-1 # R indices start from 1, not 0&#xA;&#xA;points(min_idx+mx,r_xx$acf[khat], col=&quot;red&quot;, pch=19)&#xA;&#xA;r_ss = acf(s, lag.max=1000, type=&quot;covariance&quot;)&#xA;&#xA;muhat &amp;lt;- sqrt( r_xx$acf[1] / r_ss$acf[1] - 1 )&#xA;print(paste(&quot;k Estimate:&quot; , khat, &quot; vs &quot; , k, &quot; mu Estimate : &quot;, muhat, &quot; vs &quot;, mu ))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-23T18:34:53.553" LastActivityDate="2015-10-23T18:34:53.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26624" PostTypeId="1" CreationDate="2015-10-23T17:02:05.747" Score="1" ViewCount="510" Body="&lt;p&gt;I need to detect a short (10ms) VHF pulse that occurs every 1.5s at a specific frequency (e.g., 150.20 MHz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an SDR that support IQ sample rates up to 10MSPS but due to computing constraints 2.5MSPS is probably the max I can handle (currently working with 1 MSPS with 150 MHz as the central frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am new to DSP and started simple: Collect 500ms of samples, do a standard DFT using python's &lt;code&gt;mlab.magnitude_spectrum()&lt;/code&gt;, throw away everything under an empirically defined threshold, followed by a simple peak finding routine. Then repeat with the next 500ms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That works quite well but as the pulse strength drops (move away from the pulse source) this fails to find anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have searched around a bit on how to tackle this and come across suggestions around measuring kurtosis, averaging spectra, autocorrelation, etc. If anything averaging seemed to make things worse but given I'm new to the area some guidance would be appreciated as to how to best tackle this as well as a good way to set the threshold. Is there something in the time domain I can do? Python (pseudo) code would be a plus.&lt;/p&gt;&#xA;" OwnerUserId="17941" LastEditorUserId="80" LastEditDate="2015-10-24T19:14:22.137" LastActivityDate="2015-10-24T19:14:22.137" Title="Short VHF pulse detection from SDR" Tags="|fft|frequency-spectrum|dft|python|software-defined-radio|" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="26625" PostTypeId="2" ParentId="26598" CreationDate="2015-10-23T17:41:08.080" Score="4" Body="&lt;p&gt;If we add hats to denote the Fourier transforms of those functions, convolution turns into multiplication, and addition stays as addition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat g_1=\hat f_1+\hat h_2\times\hat f_2$$&#xA;$$\hat g_2=\hat f_2+\hat h_1\times\hat f_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we &lt;a href=&quot;http://www.wolframalpha.com/input/?i=solve%28%7Bg_1%3Df_1%2Bh_2*f_2%2C+g_2%3Df_2%2Bh_1*f_1%7D%2C+%7Bf_1%2C+f_2%7D%29&quot; rel=&quot;nofollow&quot;&gt;feed that to Wolfram alpha&lt;/a&gt;, sans hats:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;solve({g_1=f_1+h_2*f_2, g_2=f_2+h_1*f_1}, {f_1, f_2})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the output is, with hats added back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat f_1 = \frac{\hat g_2 \hat h_2-\hat g_1}{\hat h_1 \hat h_2-1} \text{ and } \hat f_2 = \frac{\hat g_1 \hat h_1-\hat g_2}{\hat h_1 \hat h_2-1} \text{ and } \hat h_1 \hat h_2-1\ne0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Frequency domain division equals time domain deconvolution. The frequency domain $1$ represents a time domain identity convolution kernel of a single 1 at $(0, 0)$ and all other values zero. Reading from the above, the solution is valid only if $h_2$ convolved by $h_2$ minus the identity kernel gives an invertible filter, in other words one without frequency domain zeros.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-10-23T20:00:44.843" LastActivityDate="2015-10-23T20:00:44.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26626" PostTypeId="1" CreationDate="2015-10-23T17:44:52.100" Score="0" ViewCount="62" Body="&lt;p&gt;I need to process a stack of ultrasonic images, where there is mostly a lot of noise to see, but I need to extract specific objects that look for example like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s3nlx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s3nlx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example from Wikipedia of  pretty nice formed object &lt;a href=&quot;https://i.stack.imgur.com/ACvtI.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ACvtI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure how to get the whole region. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I did:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already tried with &lt;em&gt;mean&lt;/em&gt; &amp;amp; &lt;em&gt;median&lt;/em&gt; filters to achieve a binary image in the end, which then is processed with the &lt;em&gt;union-find&lt;/em&gt;-method to create regions. Unfortunately this leads to vague results. And it seems like the difference of the edge pixels aren't high enough to get a clean &lt;em&gt;sobel&lt;/em&gt;-image (for trying to define the margins).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I believe could work&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a different project I was working with the hough-algorithm to detect a (very clean shaped) ball in a picture. I heard this method can be applied for lines and thus for curves too. But would I be able to detect a region like this ? And if so, how would it be? is it multiple hough-detection for just one area? Since I need to process in real time I'm afraid this would exceed the processing frame (or wouldn't it?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone an idea how to easily detect such objects ? Would it be possible to apply hough under real-time conditions, on an &lt;em&gt;ordinary&lt;/em&gt; (not an high end) computer too?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any advises!&#xA;Kind Regards&lt;/p&gt;&#xA;" OwnerUserId="17942" LastEditorUserId="17942" LastEditDate="2015-10-23T20:37:58.823" LastActivityDate="2015-10-23T20:37:58.823" Title="How to detect malformed-ellipse-alike objects?" Tags="|image-processing|filters|noise|hough-transform|visual-tracking|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26627" PostTypeId="1" CreationDate="2015-10-23T18:14:06.520" Score="-1" ViewCount="261" Body="&lt;p&gt;I want to create uniform and Gaussian (normal) random variables in MATLAB via &lt;code&gt;rand&lt;/code&gt; and &lt;code&gt;randn&lt;/code&gt; syntax. And I would like to plot the PDF and CDF of aforementioned random variables with two methods. &#xA;The first one, &lt;em&gt;determining Relative Frequency&lt;/em&gt;, the second one, &lt;em&gt;Histogram&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, how can I prove that &lt;code&gt;rand&lt;/code&gt; syntax corresponds to Uniform RV and &lt;code&gt;randn&lt;/code&gt; syntax corresponds to Normal RV?&lt;/p&gt;&#xA;" OwnerUserId="17861" LastEditorDisplayName="user11906" LastEditDate="2015-11-25T07:35:26.487" LastActivityDate="2020-05-19T06:03:45.333" Title="Plotting uniform and Gaussian random variables" Tags="|matlab|gaussian|random|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26628" PostTypeId="2" ParentId="26611" CreationDate="2015-10-23T18:19:17.147" Score="1" Body="&lt;p&gt;The word &quot;points&quot; means &quot;samples.&quot; Product fs*T is fs samples/second times T seconds. That's a signal duration of 40*5 = 200 samples (or points). This means your Matlab code for vector t should have been:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;t = [0:1/fs:T-1/fs];&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You wrote tau = 1/100, so (1–tau) = 0.99. Ratio fs&lt;em&gt;T&lt;/em&gt;(1-tau)/2 = 40*5*0.99/2 = 99 samples (points). You cannot have a square wave sequence of length 200 samples (points) if the first &lt;em&gt;and&lt;/em&gt; last 99 samples (points) are zero-valued. Your fs, T, and tau variables are incompatible with each other!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Your x = square(2*pi*t); Matlab command is equivalent to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x = square(2*pi*1*t); % Note the &quot;1&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which produces square wave that repeats every one second. If you want just one cycle of a square wave over 200 samples use the commend:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x = square(2*pi*t/5);&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-23T18:19:17.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26629" PostTypeId="1" AcceptedAnswerId="26643" CreationDate="2015-10-23T18:30:23.823" Score="2" ViewCount="2977" Body="&lt;p&gt;I need to design a filter  able to  take a measurement of alternate current and shift the phase of the input by 90°. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter should work between 40 and 60Hz and at this range should have unity gain. Outside this range I don`t care about the gain or phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I research about Hilbert filter and sounds that this kind of filter is what I need, but I don`t know how to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me paste my matlab code (fixed afther Matt recomendation):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%     close all&#xA;clear all&#xA;clc&#xA;&#xA;%Period&#xA;Fs = 1000; %sample frequency&#xA;&#xA;fl = 40;   %lower frequency &#xA;&#xA;f_min=fl/(Fs/2);&#xA;&#xA;b = firpm(40,[f_min (1-f_min)],[1 1],'h');   % Bandpass Hilbert&#xA;%     fvtool(b)&#xA;&#xA;t = 0:1/Fs:1.2;&#xA;t_window=0.2;&#xA;&#xA;%input signal Frequency&#xA;&#xA;f=40;&#xA;%Generate AC signal (input)- at 40hz (lower limit)&#xA;y1 = sin(2*pi*f*t);&#xA;&#xA;%Generate filtered signal-40hz&#xA;y1f=filter(b,1,y1);&#xA;y1 = [zeros(1,(length(b)-1)/2), y1(1:end-(length(b)-1)/2)];&#xA;&#xA;f=60;&#xA;%Generate AC signal (input)- at 60Hz (upper limit)&#xA;y2 = sin(2*pi*f*t);&#xA;&#xA;%Generate filtered signal-60hz&#xA;y2f=filter(b,1,y2);&#xA;y2 = [zeros(1,(length(b)-1)/2), y2(1:end-(length(b)-1)/2)];&#xA;&#xA;figure&#xA;hold on&#xA;&#xA;plot(t,y1,'*-')&#xA;plot(t,y1f)&#xA;plot(t,y2,'*-')&#xA;plot(t,y2f)&#xA;&#xA;hold off&#xA;grid&#xA;&#xA;legend('input','filtered')&#xA;axis([max(t)-t_window max(t) -1.1 1.1])&#xA;&#xA;range(y1f(end-(length(t)/10):end))/range(y2f(end-(length(t)/10):end))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was expecting that my signal &lt;code&gt;yf&lt;/code&gt; is 90° shifted, but this doesn`t work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone have some idea about how to solve this issue and what is wrong at my code?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Part 2 - Thanks Hilmar and Richard.&#xA;Let me fix my code and use your code and show what is happening. Done. But this don`t work yet...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Objective 1- 90 phase shift -ok! (thanks guys!)&lt;/li&gt;&#xA;&lt;li&gt;Objective 2- Magnitude without change- Not OK. The signal was atenuate by 5% if I change the input frequency from 60 to 40Hz.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Could you help me to explain why this is happen at magnitude?and What I should do to fix this?.... I need magnitude as flat as possible between this frequencies. &#xA;I tried to increase the order of the filter(40-&gt;60) but don`t solve my issue yet.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Part 3 - Thanks Matt.&#xA;Let me fix my code and use your suggestion. Now work!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my filtered signal is shifted properly and with low attenuation between 40 to 60hz. The attenuation is less than 0.4% at this range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank again guys(Matt, Richard and Hilmar)&lt;/p&gt;&#xA;" OwnerUserId="17944" LastEditorUserId="17944" LastEditDate="2015-10-26T16:48:25.977" LastActivityDate="2015-10-27T07:05:57.650" Title="Design Hilbert filter at matlab (pure 90 phase and magnitude 0db)" Tags="|matlab|filter-design|phase|hilbert-transform|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26630" PostTypeId="1" CreationDate="2015-10-23T19:04:07.187" Score="6" ViewCount="1249" Body="&lt;p&gt;How does one take a decision of whether noise is additive or multiplicative?&lt;/p&gt;&#xA;" OwnerUserId="17946" LastActivityDate="2016-04-21T13:21:10.660" Title="When modelling noise,how do they decide whether additive or multiplicative?" Tags="|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26631" PostTypeId="2" ParentId="26629" CreationDate="2015-10-23T19:53:06.213" Score="2" Body="&lt;p&gt;Hilbert Transformers are non-causal, i.e. they need to be delayed to be implementable. So you get the 90 degree phase-shift plus a bulk delay of 20 samples (half the filter length). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see the 90 degree phase shift if you delay the original signal by 20 samples as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT for Part 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your lower bandpass cutoff is too high. It currently sits at 50 Hz. It needs to go down to 40 Hz or potentially a little lower. You may also have to crank up the number of points to get less amplitude ripple in the pass band. Something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = firpm(60,[38 950]*2/2000,[1 1],'h');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gets you about 0.1 dB ripple. Cranking the number of tabs up to 96 will reduce the pass band ripple to 0.01dB. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2015-10-26T16:41:35.783" LastActivityDate="2015-10-26T16:41:35.783" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26632" PostTypeId="1" CreationDate="2015-10-23T21:02:14.490" Score="1" ViewCount="161" Body="&lt;p&gt;In my DSP class at my university I have to create a simple word recognition system using the MSP430. Basically the board just needs to turn on and off an led at the commands &quot;On&quot; and &quot;Off&quot;. My question is more along the lines of finding a good tutorial which I can learn the general steps to perform this. I am learning about MFCCs, would this be a good starting point? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&#xA;Micah&lt;/p&gt;&#xA;" OwnerUserId="17948" LastActivityDate="2015-10-23T21:02:14.490" Title="Word recognition with MSP430" Tags="|speech-recognition|voice|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26633" PostTypeId="2" ParentId="26630" CreationDate="2015-10-23T21:44:20.150" Score="0" Body="&lt;p&gt;It really will depend on the application.  One way to think about it is: what is the relationship between what you can measure and what you want to know?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If what you want to know is almost the same as what you can measure, but there are spurious peaks or troughs around &quot;the truth&quot;, then additive noise is probably what you should select.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, additive noise is likely if there is a linear (or affine) relationship between the value and the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If what you want to know is related to what you can measure by the energy in the measurements, then you may want to choose multiplicative noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, multiplicative noise is likely if there is a (highly) nonlinear relationship between the value and the measurement.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-23T21:44:20.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26634" PostTypeId="1" CreationDate="2015-10-24T04:15:16.290" Score="0" ViewCount="1113" Body="&lt;p&gt;How can I calculate a triple correlation between 3 signals A,B,C (each has 2 million samples)?&#xA;I know xcorr do it for 2 signals by FFT each signal, multiplication and iFFT back. Since xcorr cannot do it for three signals, I try to do it &quot;manually&quot; by the above algorithm.&#xA;What I do is FFT each of the 3 signals, multiplicate A.B, which gives a row vector. Then I convert C row vector to C column vector by C' and multiplicate each column of A.B by C. Then iFFT2 back. Unfortunatelly I get a wrong result.&#xA;The reason I convert C to a column vector is to get a matrix, since triple correlation is calculated according to 2 time delays, and obviously the result should be a matrix rather than a vector as in correlation of the 2 signals, where only a one time delay is present.&#xA;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will rephrase what I mean.&#xA;I know xcorr does cross-correlation for 2 signals by FFT each signal, multiplication and iFFT back. Since xcorr cannot do it for three signals, I try to do it &quot;manually&quot; by the above algorithm.&#xA;So, the &quot;regular&quot; cross-correlation:&#xA;$$F\left(s_1 \right) = \int_{-\infty}^{\infty}f^* \left(t\right)g\left(t+s_1 \right)dt$$&#xA;is a function of 1 variable s1 and therefore is a vector. After FFT on each of the two signals I get 2 vectors in Fourier domain, multiply them element by element, get another vector and by inverse FFT get the cross-correlation, which is a vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to do the same to three signals. Triple correlation is:&#xA;$$F\left(s_1, s_2 \right) = \int_{-\infty}^{\infty}f^* \left(t\right)g\left(t+s_1 \right)h\left(t+s_2 \right)dt$$&#xA;which is a function of s1 and s2 and therefore should be a matrix.&#xA;After FFT on each of the three signals I get 3 vectors in the Fourier domain. Now, in order to get a matrix as a triple correlation, I need a matrix in Fourier domain as well. But I have 3 row vectors and how exactly can I get a matrix from them? I tried to multiply the first vector by a second one, element by element and then convert the third vector from row to column and multiply between them to get a matrix, but after inverse Fourier transform I get a wrong answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT2:&lt;/strong&gt;&#xA;I somehow cannot reply to the people that answer below, so I will update my question once again.&#xA;To Dilip Sarwate:&#xA;I do a research in quantum optics field (in particular, intensity interferometry) and need to acquire an image of a star from correlations between photons. The information about star's size can be deduced from the cross-correlations of the signals in 2 telescopes (detectors), but in this case the phase information is lost. To get the phase, I perform the measurements in 3 telescopes (detectors) and need to get a triple cross-correlation in order to obtain the information about phase. Finally, when I have the amplitude information (cross-correlation) and phase information (triple correlation) I can, by inverse Fourier transform, get an image (intensity distribution) of the source (star). What I need from cross-correlation measurements is the peak HEIGHT, and not the time delay (since detectors are equidistant from the source and therefore time delay for which photons arrive is 0, more or less).&#xA;For cross-correlation I get the following kind of graphs:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NeblP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NeblP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Left graph consists of 2 features: background &quot;triangle&quot; (from non correlating photons) and a &quot;peak&quot; on top of it (from photons that correlate between them). By dividing the maximum of the &quot;peak&quot; and maximum of the &quot;triangle&quot; I get a correlation value, which is between 1 and 2 in my case. The graph on the right represents the case where no photons are correlated, and &quot;peak&quot; does not show up. I have already done with the cross-correlations and now need to calculate correlation value in triple cross-correlations (correlation between signals in three detectors).&#xA;My signals consist of 2,000,000 points each. Performing correlation by &quot;multiplication and sum, add delay, multiplication and sum, ...&quot; method is taking a long time for such long signals. Therefore, I used an xcorr function in MATLAB, which as I wrote above is much faster, since it workes with Fourier domain. Now I need to get the triple cross correlation, but there is no function (as xcorr) that does it in MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="17950" LastEditorUserId="17958" LastEditDate="2015-10-25T00:59:32.957" LastActivityDate="2015-10-25T00:59:32.957" Title="Triple correlation in MATLAB" Tags="|correlation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26635" PostTypeId="1" AcceptedAnswerId="26636" CreationDate="2015-10-24T10:09:29.830" Score="1" ViewCount="90" Body="&lt;p&gt;The passband signal $\ u_p(t) =&#xA;I_{[−1,1]}(t) \cos 400πt $ is passed through an LPF as $\ u_p(t) \cos(401\pi t).$ The question is to find the output. The example does the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we let $\ u_1 = u_{c1} +ju_{s1}  $ denote the complex envelope with respect to the reference $\ e^{j401t} $,  the output of the LPF is $\ u_{c1}/2.$ Why is it half?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The passband signal can be rewritten as,&#xA;$\ u_p(t) = \Re(I_{[−1,1]}(t)e^{−jt}e^{j401t})$ to find $\ u_{c1}$&#xA;but how is this justified if we want to find the output of $\ u_p(t) \cos(401\pi t) $ and not just $\ u_p $ that is just rearranged.  Shouldn't the translation induced by the cosine be taken into account. I'd appreciate any help.&lt;/p&gt;&#xA;" OwnerUserId="9061" LastEditorUserId="13320" LastEditDate="2016-11-21T12:37:30.707" LastActivityDate="2016-11-21T12:37:30.707" Title="Why is the output of the LPF half that of the real/imaginary part of the complex envelope?" Tags="|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26636" PostTypeId="2" ParentId="26635" CreationDate="2015-10-24T10:41:59.010" Score="2" Body="&lt;p&gt;The idea of this exercise is to show what happens if you have a frequency offset at the receiver, i.e. if the actual carrier frequency is different from what the receiver thinks it should be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can write the passband signal as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u_p(t)=\text{Re}\left(I_{[-1,1]}e^{j400\pi t}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're demodulating with a frequency of $\omega_0=401\pi$, it is advantageous to rewrite the passband signal with that reference frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u_p(t)=\text{Re}\left(I_{[-1,1]}e^{-j\pi t}e^{j401\pi t}\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(2)$ you can read off the new complex envelop with respect to the actual demodulation frequency $\omega_0=401\pi$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u(t)=u_c(t)+ju_s(t)=I_{[-1,1]}e^{-j\pi t}=I_{[-1,1]}\cos(\pi t)-jI_{[-1,1]}\sin(\pi t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Demodulation with $\cos(401\pi t)$ will give you the I component $u_c(t)$. The factor $1/2$ simply occurs because by multiplying with a cosine you get $u_c(t)\cos^2(\omega_0t)=u_c(t)(\frac12+\frac12\cos(2\omega_0t))$, and the LPF removes the component at $2\omega_0$, which leaves you with $\frac12 u_c(t)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-24T10:41:59.010" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26638" PostTypeId="2" ParentId="26627" CreationDate="2015-10-24T14:29:21.683" Score="0" Body="&lt;p&gt;cumsum command of MATLAB can be used to plot CDF while as histogram command can be used to plot PDF of RVs. Check out the following links for detailed description:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://de.mathworks.com/help/matlab/ref/cumsum.html?refresh=true&quot; rel=&quot;nofollow&quot;&gt;http://de.mathworks.com/help/matlab/ref/cumsum.html?refresh=true&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://de.mathworks.com/help/matlab/ref/histogram.html&quot; rel=&quot;nofollow&quot;&gt;http://de.mathworks.com/help/matlab/ref/histogram.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17633" LastActivityDate="2015-10-24T14:29:21.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26642" PostTypeId="2" ParentId="24086" CreationDate="2015-10-24T18:02:49.840" Score="1" Body="&lt;p&gt;In &lt;a href=&quot;http://dx.doi.org/10.1109/TIT.2009.2027527&quot; rel=&quot;nofollow noreferrer&quot;&gt;Comparing Measures of Sparsity&lt;/a&gt;, 2009, IEEE Trans. Information Theory, an axiomatic characterization of sparsity for random sources, and a comparison of different measures is provided. Two measures emerged (in my reading): the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gini_coefficient&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gini index or coefficient&lt;/a&gt;, as proposed above, and the $\ell_1/\ell_2$ norm ratio, illustrated below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XBXdc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XBXdc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It stems from a &lt;a href=&quot;https://math.stackexchange.com/questions/218046/relations-between-p-norms&quot;&gt;standard norm inequality&lt;/a&gt; between $\ell_1$ and  $\ell_2$ ($\ell_2 \le \ell_1 \le \sqrt{n}\ell_2$, with $n$ the length of the signal,  through Cauchy-Schwarz or Hölder inequality), that saturates on both ends for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the nonzero-constant signal,&lt;/li&gt;&#xA;&lt;li&gt;the all-zero-but-one signal,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and being scale-invariant, zero-homogeneous (as the Gini index or the $\ell_0$ counting index).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the Gini index seems the more natural, the second one can  be  used more easily in subsequent processing, for instance restoration, as it provides a computable non-convex penalty. For a recent paper with an historical account for the norm ratio: &lt;a href=&quot;http://dx.doi.org/10.1109/LSP.2014.2362861&quot; rel=&quot;nofollow noreferrer&quot;&gt;Euclid in a Taxicab: Sparse Blind Deconvolution with Smoothed $\ell _1/\ell _2$ Regularization&lt;/a&gt;, 2015, IEEE Signal Processing Letters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;code&gt;Matlab&lt;/code&gt; code is given below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function mos_l1_l2 = MoS_Hoyer_ratio_l1_l2(data)&#xA;&#xA;if isequal(data,0)&#xA;  mos_l1_l2 = 0;&#xA;else&#xA;  mos_l1_l2 = sum(abs(data))./sqrt(sum((data).^2));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-10-24T19:19:31.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26643" PostTypeId="2" ParentId="26629" CreationDate="2015-10-24T18:21:08.860" Score="1" Body="&lt;p&gt;@Rodrigo PG: Your Matlab Hilbert transformer is causal. This means, in order to synchronize-in-time your $y$ sequence with your $yf$ sequence, you need to delay your $y$ sequence by (length of $b$ minus 1)/2 samples when the length of $b$ is odd. This will delay your input $y$ by the same amount as the Hilbert transformer's inherent time delay. Insert the following line of code &lt;em&gt;after&lt;/em&gt; your &lt;code&gt;yf = filter(b,1,y);&lt;/code&gt; command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = [zeros(1,(length(b)-1)/2), y];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to see the desired 90-deg phase shift.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15391" LastEditDate="2015-10-27T07:03:41.560" LastActivityDate="2015-10-27T07:03:41.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26645" PostTypeId="2" ParentId="26620" CreationDate="2015-10-24T20:20:47.800" Score="2" Body="&lt;p&gt;I don' think there is easy &quot;one size fits all&quot; answer. You need to make a trade off between&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the highest frequency where you still want to be &quot;flat&quot;&lt;/li&gt;&#xA;&lt;li&gt;How much aliasing are you willing to tolerate (which is actually a function content, to make it even more complicated)&lt;/li&gt;&#xA;&lt;li&gt;How much and what type of time smearing and/or phase distortion to can allow&lt;/li&gt;&#xA;&lt;li&gt;How much computation do you want to spend on it.&lt;/li&gt;&#xA;&lt;li&gt;Latency constraints&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Most high grade digital mastering would probably require a linear phase FIR filter that's really flat in the pass band. I don't think an elliptic filter would qualify. Something like the following filter may work&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = firls(63,[0 18000*2/44100 20000*2/44100 1],[1 1 0 0],[1 10000])';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-10-24T20:20:47.800" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26647" PostTypeId="1" CreationDate="2015-10-24T23:02:28.277" Score="0" ViewCount="918" Body="&lt;p&gt;I am trying to find out the transfer function of a real life continuous-time black box.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First thought is of course to input a delta and get the impulse response as the books have taught us but I think it is not feasible as you can't have a proper delta (infinite at one point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q1.&lt;/strong&gt; How can I simulate a Dirac input in a way that I don't break my system and in a way that it is going to give me a pretty accurate result? Accurate meaning something that will look a lot like the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second thought is to do a frequency response analysis where I will input a few sinusoids at different frequencies and store the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q2.&lt;/strong&gt; How many periods should I gather for each sinusoidal so that I get an accurate output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q3.&lt;/strong&gt; What effect would a few leading zeros on my input have on my output spectrum? Is it going to be the same as zero-padding?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;A3.&lt;/em&gt;&lt;/strong&gt; Yes, because zero-padding the input will lead to zero-padding the output which I will then FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q4.&lt;/strong&gt; If the input signal stops abruptly and went to zero after a sufficient signal length time, would that discontinuity affect my output spectrum as well?&lt;/p&gt;&#xA;" OwnerUserId="16175" LastEditorUserId="16175" LastEditDate="2015-10-25T11:34:51.533" LastActivityDate="2015-10-25T11:34:51.533" Title="Frequency response and impulse response of black box" Tags="|frequency-spectrum|frequency-response|zero-padding|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26648" PostTypeId="1" AcceptedAnswerId="26649" CreationDate="2015-10-24T23:27:55.187" Score="4" ViewCount="2239" Body="&lt;p&gt;The information that I put down are from the site &lt;a href=&quot;http://www.gaussianwaves.com/2011/05/ebn0-vs-ber-for-bpsk-over-rayleigh-channel-and-awgn-channel-2/&quot; rel=&quot;nofollow&quot;&gt;http://www.gaussianwaves.com/2011/05/ebn0-vs-ber-for-bpsk-over-rayleigh-channel-and-awgn-channel-2/&lt;/a&gt; . My QUestions are due to some misconception and will really appreciate if some help is provided to clear the concepts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;AWGN channel:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $y$ is the received data and $n$ is the input, then signal is received  as $y = x + n$. This is an FIR model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Rayleigh channel&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The received signal here is $y = hx +n$ where $h$ can be $h_1$ or $h_2$. This is also an FIR model.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Case1: When $h = h_1$: &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;h_1 = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]&lt;/code&gt;; % Rayleigh channel creates the coefficients $h$ of length $N$ representing the channel, where $N$ is the number of data samples. This is a flat fading Rayleigh channel because the number of taps = 1. Please correct me if I am wrong in saying that the number of taps =1, so it is a flat fading. In general, number of taps = number of delays.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Case2: When $h=h_2$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If $h_2 = [1, 0, 0.5, -0.2]$ then also we call it Rayleigh but now it is also called multi-path. So, number of multipaths = length(h_2) = 4 ? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How is $h_2$ a Rayleigh random variable? What is the proper way to represent $h_2$ as rayleigh channel and the output $y$? Explanation with the help of code statement will be useful.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Theory says that there is Clarke's and Young's model for channel representation. Clarke's model uses FIR representation using sinusoids and cosines. Why do we need this model when we can simply apply the technique used to generate $h_1$ ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="780" LastActivityDate="2015-10-25T01:23:49.483" Title="Matlab: Difference between flat fading and Rayleigh multipath fading, terminologies and concept" Tags="|self-study|fading-channel|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26649" PostTypeId="2" ParentId="26648" CreationDate="2015-10-25T00:59:19.253" Score="4" Body="&lt;p&gt;The fundamental idea to keep in mind is that in a wireless channels with reflections, if you transmit $s(t),$ you'll receive $$r(t)=\sum_{i=1}^Na_is(t-\tau_i).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another important idea is that whether the channel is flat or not depends only on $s(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, let's say that the symbol time is $T_s$. Let's call the longest delay in the channel $\tau_{L}$. If $\tau_L &amp;gt; T_s$, then one symbol will appear at the receiver &quot;on top&quot; of other symbols. This is called &quot;intersymbol interference&quot; and the channel is called a &quot;wideband&quot; channel or a &quot;frequency-selective&quot; channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if $\tau_L &amp;lt;&amp;lt; T_s$ (that is, if the longest delay is much shorter than the symbol time), then there is no intersymbol interference. However, each symbol is still &quot;interfering with itself&quot;: many replicas of the same symbol, each with different amplitude $a_i$, are received at the same time. If $N$ is large, then you can invoke the central limit theorem and claim that the &lt;em&gt;overall effect&lt;/em&gt; of all these replicas is equivalent to multiplication by a single Gaussian random number. This channel is called &quot;flat&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: the same channel can behave as a &quot;wideband&quot; channel or as a &quot;flat&quot; channel to two signals with different symbol rates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to the question about how to simulate this. It all depends on the sampling frequency used to sample the channel impulse response. When you say that a channel model consists of a single random number, what you're saying is that you're sampling the channel impulse response at the symbol rate. In other words, the channel gain $h_1$ is the aggregate effect of all the $a_i$ and $\tau_i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even for a flat channel, if you sample fast enough, you'll be able to resolve all the $a_i$ and $\tau_i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your question, vector $h_2$ can only be interpreted properly if you know the sampling rate. If the sampling rate is the symbol rate, then the channel's longest delay is of the order of 4 symbol times, and you'll have quite severe intersymbol interference. If the sampling rate is much faster than the symbol rate, the channel is flat.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-10-25T01:23:49.483" LastActivityDate="2015-10-25T01:23:49.483" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26650" PostTypeId="1" AcceptedAnswerId="26657" CreationDate="2015-10-25T01:09:05.033" Score="0" ViewCount="199" Body="&lt;p&gt;I have in my course notes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{k=0}^{N-1}y(k)e^{-j\omega_nk}\approx\sum_{k=-\infty}^{\infty}y(k)e^{-j\omega_nk}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the $\approx$ for some reason becomes $=$ when $y(k)$ is periodic. Could you please explain why this is the case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much!&lt;/p&gt;&#xA;" OwnerUserId="17640" LastActivityDate="2015-10-25T09:53:12.480" Title="Why DFT exact for periodic signals?" Tags="|discrete-signals|fourier-transform|dft|periodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26651" PostTypeId="2" ParentId="26647" CreationDate="2015-10-25T01:55:36.430" Score="1" Body="&lt;p&gt;If the system is continuous-time then you can't simulate an impulse (Dirac delta).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally people take a number of approaches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Instead of using an impulse, find the step response of the system of interest.  This can be related to the integral of the impulse response as the unit step is the integral of the unit impulse.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate a set of spaced sinusoids and measure the output phase and amplitude of each.  The transfer function is found by interpolating these discrete frequency points.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate a swept sine wave (chirp) signal over a known frequency range and deconvolve the output to find the transfer function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate a pseudorandom noise sequence, measure the response, and use it to estimate the transfer function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-25T01:55:36.430" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26653" PostTypeId="1" CreationDate="2015-10-25T02:22:15.187" Score="4" ViewCount="3405" Body="&lt;p&gt;I have multiple, real, audio signals which I am taking the FFTs. Although they don't come from the same recording, those signals represent the same thing (biologically). I was told that I could combine those ffts and average them together to get a good representation of the averaged signal. I am thinking of using the matlab function 'pwelch' for this purpose but I have lots of questions and I could not find answers by googling.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have already averaged the ffts themselves with the matlab function 'pwelch' to decrease the noise. When combining them together, should I just use the output of a normal FFT rather than the output of pwelch (P)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My signals are not exactly of the same length, which will make them not usable to combine in a matrix. Should I cut them all to the same length before averaging? Or is there a way round that?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I actually combine them? I was thinking something like this:  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;avg = (abs(P1) + abs(P2) + abs(P3)) / 3;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then use the function pwelch like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Pavg, Favg] = welch(avg,ones(SegmentLength,1),0,NFFTavg,fs,'power');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any insights or help would be really appreciated. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="17397" LastActivityDate="2015-10-25T10:52:21.537" Title="Averaging multiple FFTs in matlab" Tags="|matlab|fft|power-spectral-density|averaging|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26655" PostTypeId="1" AcceptedAnswerId="26656" CreationDate="2015-10-25T07:27:16.810" Score="2" ViewCount="334" Body="&lt;p&gt;I am confusing reading book by Chaparro (Signal System with Matlab) in example 2.7. He gives a question, a RL circuit with unit-step source $ v(t) = u(t) $ will result a response,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ i(t) = (1- e^{-t}) u(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input changed $ v(t) = u(t) - u(t-2) $, we are asked to the new response of RL system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the given solution (see the figure), he only use superposition and time invariance principle to bring the following,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ i(t) − i(t − 2) = 2(1 − e ^ {−t} ) u(t) − 2(1 − e ^ {(t−2)} ) u(t − 2) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on my understanding on superposition and time invariance, it should be,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ i(t) − i(t − 2) = (1 − e ^ {−t} )u(t) − (1 − e ^ {(-t+2)} ) u(t − 2) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I've checked it with graphical method (convolution) and Matlab script, the given answer (plot of $i(t)$, $-i(t-2)$ and $ i(t)-i(t-2)$) is true. Here is how,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First I obtain $h(t)$ from $i(t)$ by derrivation,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$i(t) = v(t) * h(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got $h(t)=e^{-t}u(t)$. By convolving $h(t)$ with $i(t)-i(t-2)$ I got the same plot on the book (Using matlab conv).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone can explain, how superposition and time-invariant principle can bring the answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot of the book (from Google Book)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8itM4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8itM4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot of $i(t)$, $-i(t-2)$ and $ i(t)-i(t-2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6fq08.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6fq08.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11684" LastEditorUserId="11684" LastEditDate="2018-05-31T15:53:13.113" LastActivityDate="2018-05-31T15:53:13.113" Title="Using superposition and time invariance to find RL circuit response" Tags="|convolution|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26656" PostTypeId="2" ParentId="26655" CreationDate="2015-10-25T09:32:31.267" Score="3" Body="&lt;p&gt;The answer to your last question is no. Nobody can explain how that answer was obtained because it's wrong. The fact that it is wrong is obvious, because due the term $e^{(t-2)}$ (with a positive power of $t$!), the output will keep increasing indefinitely, which is impossible for a stable system (such as the given RL-circuit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your answer is the correct one, and you must have made a mistake while checking the book's answer.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-25T09:32:31.267" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26657" PostTypeId="2" ParentId="26650" CreationDate="2015-10-25T09:53:12.480" Score="1" Body="&lt;p&gt;It's not correct to say that both expressions become equal when the signal is periodic. What is correct is that - obviously - everything one can know about an $N$-periodic signal is represented by the expression on the left of your equation, and consequently, both expressions are equivalent in the sense that one can be obtained from the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that that the infinite sum on the right-hand side does not converge in the conventional sense if the signal is periodic. The Discrete-Time Fourier Transform (DTFT) - that is what the right-hand side represents - of an $N$-periodic signal can be expressed by using Dirac delta impulses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\frac{2\pi}{N}\sum_{k=-\infty}^{\infty}X[k]\delta\left(\omega-\frac{2\pi k}{N}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients $X[k]$ can be obtained from the expression on the left-hand side of your equation be setting $\omega_k=2\pi k/N$. In that sense, both expressions convey the same information.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-25T09:53:12.480" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26658" PostTypeId="2" ParentId="23005" CreationDate="2015-10-25T10:37:24.190" Score="1" Body="&lt;p&gt;I agree that this topic is somewhat confusing, it also confused me at times, like this morning when i looked around for an answer, and resorted to answer to it for myself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the root cause of this halving of the spectral efficiency when going from baseband to passband is that when we modulate the signal onto a real carrier, the negative frequency spectrum is unavoidable, thereby halving the efficiency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether we consider baseband signals or bandpass signals, spectral efficiency is always only concerned with positive frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, whereas in baseband you have a spectrum from [-B,B], in band-pass you have two spectra in the intervals [-fc-B, -fc+B] and [fc-B, fc+B]. In the case of SSB (Single Side Band) modulation the baseband bandwidth will be [0,B] and the bandpass ones [-fc-B,fc] and [fc,fc+B].&#xA;Assuming your shaped pulses are sent at a symbol rate 1/T, for an M-ary modulation we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\rho_{Nyq,BB} = \frac{R}{B} = \frac{\log_2(M)/T}{1/2T} = 2\log_2(M)  [b/s/Hz], or [b/2D]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\rho_{Nyq,BP} = \frac{R}{2B} = \frac{\log_2(M)/T}{1/T} = \log_2(M)  [b/s/Hz], or [b/2D]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the receiving side a coherent demodulator can reconstruct the complex envelope by analytic extension, thereby removing the negative frequencies, but the resulting signal becomes 2-dimensional.&lt;/p&gt;&#xA;" OwnerUserId="8043" LastEditorUserId="8202" LastEditDate="2015-10-25T11:34:40.060" LastActivityDate="2015-10-25T11:34:40.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26659" PostTypeId="2" ParentId="26653" CreationDate="2015-10-25T10:52:21.537" Score="5" Body="&lt;p&gt;Welch’s method is a scheme to reduce the fluctuations (noise) in spectral power estimations when you have only a single time sequence with which to work. Because you have multiple time sequences, I’m not convinced that Welch’s method is what you want. If you have time sequences $x1(n)$, $x2(n)$, and $x3(n)$ of different lengths, I suggest you zero-pad the shorter sequences so they’re equal in length to the longest of the original $x1(n)$, $x2(n)$, and $x3(n)$ sequences. (It’s my guess that no time-domain Hanning or Hamming windowing is necessary.) Perform three FFTs and compute the three corresponding spectral power sequences $P1(m)$, $P2(m)$, and $P3(m)$. Finally, average the three spectral power sequences, element-by-element, as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spec_Pwr_Ave = P1 + P2 + P3;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then plot your ‘Spec_Pwr_Ave’ power-spectral sequence.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-25T10:52:21.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26661" PostTypeId="2" ParentId="26608" CreationDate="2015-10-25T12:09:56.860" Score="1" Body="&lt;p&gt;I had a look at your code, and I know why you get 0 BER.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing is that you do not add any noise, you should use Eb/N0 to calculate the noise variance, and add a complex noise on your channel output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The distortion added by &quot;chanOutput = filter(chCoeffs,1,modSignal);&quot; merely adds linear ISI, by convolving the channel impulse response with the input signal. This linear distortion is exactly known to the equalizer since you pass it the exact channel coefficients. This is never the case in real applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even assuming you do know the channel coefficients, you still need to add noise immediately after the channel distortion and before the equalizer, to get a meaningful result of BER over Eb/N0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise can be generated with randn having unit variance, then you need to multiply this noise by a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not spend too much time understanding what you want to verify, but i did correct the script to include noise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear&#xA;N = 10^4; % number of symbols&#xA;N2= 10;   %repeat with same Eb/N0&#xA;&#xA;% Eb_N0_dB = [0:25]; % multiple Eb/N0 values&#xA;Eb_N0_dB = (0:10); % multiple Eb/N0 values&#xA;nTx = 1;  %SISO &#xA;nRx = 1;&#xA;&#xA;M = 4; %QPSK&#xA;&#xA;for ii = 1:length(Eb_N0_dB)&#xA;&#xA;    %% ----- ADDED&#xA;    EbN0 = Eb_N0_dB(ii);&#xA;    SNR_linear  = 10^(EbN0/10)*log2(M);&#xA;    SigPWR      = 1; %unit circle symbols&#xA;    NoisePWR    = SigPWR/SNR_linear;&#xA;    NoiseFactor = sqrt(NoisePWR/2); %half power complex half imaginary&#xA;&#xA;    hMod = comm.QPSKModulator(0,'SymbolMapping','Binary');&#xA;    hDemod = comm.QPSKDemodulator(0,'SymbolMapping','Binary');&#xA; % Channel coefficients&#xA;    chCoeffs = [.986; .845; .237; .12345+.31i]; &#xA;    hMLSEE = comm.MLSEEqualizer('TracebackDepth',10,...&#xA;                      'Channel',chCoeffs, 'Constellation',[1 1i -1 -1i]);&#xA; % Create an error rate calculator&#xA;    hError = comm.ErrorRate;&#xA;    for n = 1:N2&#xA;      data= randi([0 3],N,1);&#xA;      modSignal = step(hMod, data);&#xA;&#xA; % Introduce channel distortion.&#xA;      chanOutput = filter(chCoeffs,1,modSignal); &#xA;&#xA;      %% ----- ADD NOISE !!      &#xA;      noiseVec   = NoiseFactor*randn(N,1)+1j*NoiseFactor*randn(N,1);&#xA;      chanOutput = chanOutput+noiseVec;&#xA;&#xA;&#xA; % Equalize the channel output and demodulate&#xA;      eqSignal = step(hMLSEE,chanOutput);&#xA;      demodData = step(hDemod,eqSignal);&#xA; % Compute BER&#xA;      errorStats = step(hError, data, demodData);&#xA;%       nErr=errorStats(1) ;&#xA;    end&#xA;    fprintf('Error rate = %f\nNumber of errors = %d\n', ...&#xA;      errorStats(1), errorStats(2))&#xA;&#xA;    %assume 1 symbol error = 1 bit error (needs Gray coding in real system for this to be true)&#xA;    SER(ii) = errorStats(1); % SER ~= BER with undelrying Gray coding&#xA;end&#xA;&#xA;%% changed, this is already divided by N*N2&#xA;simBer = SER; % simulated ber&#xA;&#xA;&#xA;EbN0Lin = 10.^(Eb_N0_dB/10);&#xA;theoryBer_nRx1 = 0.5.*(1-1*(1+1./EbN0Lin).^(-0.5)); &#xA;p = 1/2 - 1/2*(1+1./EbN0Lin).^(-1/2);&#xA;theoryBerMRC_nRx2 = p.^2.*(1+2*(1-p)); &#xA;&#xA;close all&#xA;figure&#xA;semilogy(Eb_N0_dB,theoryBer_nRx1,'bp-','LineWidth',2);&#xA;hold on&#xA;semilogy(Eb_N0_dB,theoryBerMRC_nRx2,'kd-','LineWidth',2);&#xA;semilogy(Eb_N0_dB,simBer,'mo-','LineWidth',2);&#xA;axis([0 25 10^-5 0.5])&#xA;grid on&#xA;legend('theory (nTx=1,nRx=1)', 'theory (nTx=1,nRx=2, MRC)', 'sim (nTx=2, nRx=2, ML)');&#xA;xlabel('Average Eb/No,dB');&#xA;ylabel('Bit Error Rate');&#xA;title('BER for BPSK modulation with ML equalizer');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8043" LastActivityDate="2015-10-25T12:09:56.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26662" PostTypeId="2" ParentId="26620" CreationDate="2015-10-25T12:58:51.790" Score="1" Body="&lt;p&gt;Interpolation by way of zero-stuffing cannot generate aliased spectral components. What that upsampling process generates is spectral images. And those images must be eliminated (i.e., greatly attenuated) by lowpass filtering. If I understand your situation, after your zero-stuffing your new data sample rate will be 88.2 kHz, and your stuffed time sequence will have an unwanted spectral image centered at 44.1 kHz. So you need to implement a digital filter whose passband cutoff freq is 0.45*22.05 kHz and whose stopband begins at 0.55*22.05 kHz. But keep in mind now, the filter’s Nyquist rate is 44.1 kHz (88.2/2 kHz) and &lt;em&gt;not&lt;/em&gt; 22.05 kHz.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-25T12:58:51.790" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26664" PostTypeId="1" AcceptedAnswerId="26665" CreationDate="2015-10-25T14:13:35.377" Score="1" ViewCount="640" Body="&lt;p&gt;I'm using two microcontrollers to implement an adaptive LMS filter to filter out the noise from the signal. One is recording the noise and streaming the data to the other microcontroller which is recording the (noised) signal and using the noise reference, filtering it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does the delay between those signal affect the filtering quality? Say the noise reference input is delayed for 100us/1ms/10ms/100ms/1s, how does that affect the filtering process?&lt;/p&gt;&#xA;" OwnerUserId="17964" LastActivityDate="2015-10-25T14:45:01.580" Title="LMS adaptive filter relatively delayed signal and reference inputs" Tags="|noise|adaptive-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26665" PostTypeId="2" ParentId="26664" CreationDate="2015-10-25T14:45:01.580" Score="5" Body="&lt;p&gt;The adaptive filter tries to emulate the assumed filtering process between the noise reference signal and the actual noise in the noisy signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $n(t)$ is the actual noise in the noisy signal, and $n_r(t)$ is the noise reference, it is assumed that there's a linear filtering relationship between the two:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$n(t)=(n_r*h)(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $*$ denotes convolution (filtering), and $h(t)$ is some unknown impulse response, which should be approximated by the adaptive filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The practical effect of a delay of the noise reference depends on the impulse response $h(t)$. A delay of $\tau$ in the noise reference means that the adaptive filter needs to model $h(t+\tau)$ instead of $h(t)$. This can be a good thing if $h(t)$ is almost zero in the interval $0&amp;lt;t&amp;lt;\tau$, because then optimal use is made of the length of the adaptive filter. However, if there is significant energy in $h(t)$ in that interval, then, after delaying the noise reference, the adaptive filter must approximate a non-causal filter, which it will have a very hard time to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in general, a delay of the reference signal results in a shifting of the impulse response that needs to be approximated by the adaptive filter. If this shifting is helpful or not depends on the amount of shift and the properties of the impulse response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-25T14:45:01.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26667" PostTypeId="1" CreationDate="2015-10-25T22:04:36.797" Score="1" ViewCount="149" Body="&lt;p&gt;I have a 2-D signal collected in the frequency vs time domain. There is a feature of interest in this signal (a chirp) appearing at some arbitrary times which I have successfully extracted using a properly orientated 2-D Gabor filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is exploit the detection of this feature to represent the data in a sparse domain, so that Compressed Sensing can be used to capture the data regions which contain the chirp trait without sampling the entire data set a-la Nyquist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have searched for a way to do this online but haven't found very much. The literature I've read says that the basis must be orthogonal for perfect reconstruction, and that Gabor domain is most times not, but given that I'm only interested in a faster detection (yes contains/no, does not contain chirp) and not really a perfect reconstruction, is such a thing possible? If the approach above is not the best way to go about doing this, recommendations would be welcome as well.&lt;/p&gt;&#xA;" OwnerUserId="17969" LastActivityDate="2015-10-27T08:00:13.217" Title="Imposing sparse structure in Gabor space" Tags="|compressive-sensing|gabor|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26668" PostTypeId="1" CreationDate="2015-10-26T00:18:22.050" Score="0" ViewCount="51" Body="&lt;p&gt;I'm smoothing a signal with an little algorithme and I can control the amount of smoothing dynamically. Now it could be interesting to drive that amount with a measure depending of the frequency content. in other words if my signal is containing quick frequency it is interesting to have less of smoothing especially is the main signal is stationary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could I use for that? I tried mobile variance but I'm not sure this is the best method. I'm trying to avoid FFT methods or other that could dephase the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;second question, does kurtosis can be something relevant for that ? I think no but I would like to be sure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank in advance : ) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: this isn't in real time, just sayin'&lt;/p&gt;&#xA;" OwnerUserId="30167" LastActivityDate="2015-10-26T16:53:34.827" Title="Estimate High Frequency" Tags="|estimation|estimators|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26669" PostTypeId="2" ParentId="26668" CreationDate="2015-10-26T12:10:55.403" Score="1" Body="&lt;p&gt;You could simply run your signal through some sort of high pass filter or shelf and compare the energy before and after the filter. If the ratio is high, you have a lot of high frequencies in your signal and should probably do less smoothing. If the ratio is low, there are not a lot of high frequencies and you can do more aggressive smoothing.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency selectivity can be dialed in by the shape of the filter&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As a simple example, the R code below runs two filters: a high pass one with unity gain at $f_s/2$ and a low pass one with unity gain at $0$.  Two test signals are used: one with more low pass content, one with more high pass content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1] &quot;X: 344.6108  LPF1: 32.1535  HPF1: 15.1717  LPF2: 17.4986  HPF2: 27.7821&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The low pass filtered test signal &lt;code&gt;x_test_lpf&lt;/code&gt; retains more energy from the low pass filter than the high pass one (&lt;code&gt;32.1535&lt;/code&gt; vs &lt;code&gt;15.1717&lt;/code&gt;).  The high pass filtered test signal &lt;code&gt;x_test_hpf&lt;/code&gt; retains more energy in the high pass output than the low pass one (&lt;code&gt;17.4986&lt;/code&gt; vs &lt;code&gt;27.7821&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#26668&#xA;&#xA;x &amp;lt;- runif(1000,-1,1)&#xA;&#xA;Nfilt &amp;lt;- 20&#xA;&#xA;x_test_lpf &amp;lt;- c(x, filter(x,rep(1/5,5), circular = TRUE))&#xA;x_test_hpf &amp;lt;- c(x, filter(x,(-1)^(0:4)/5, circular = TRUE))&#xA;&#xA;&#xA;&#xA;x_hpf_1 &amp;lt;- filter(x_test_lpf,(-1)^(0:(Nfilt-1))/Nfilt, circular = TRUE) # Unity gain at fs/2&#xA;x_lpf_1 &amp;lt;- filter(x_test_lpf,rep(1/Nfilt,Nfilt), circular = TRUE) # Unity gain at 0&#xA;&#xA;&#xA;x_hpf_2 &amp;lt;- filter(x_test_hpf,(-1)^(0:(Nfilt-1))/Nfilt, circular = TRUE) # Unity gain at fs/2&#xA;x_lpf_2 &amp;lt;- filter(x_test_hpf,rep(1/Nfilt,Nfilt), circular = TRUE) # Unity gain at 0&#xA;&#xA;&#xA;print(paste(&quot;X:&quot;, sum(x^2), &quot; LPF1:&quot;, sum(x_lpf_1^2), &quot; HPF1:&quot;, sum(x_hpf_1^2), &quot; LPF2:&quot;, sum(x_lpf_2^2), &quot; HPF2:&quot;, sum(x_hpf_2^2)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="80" LastEditDate="2015-10-26T16:53:34.827" LastActivityDate="2015-10-26T16:53:34.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26670" PostTypeId="1" CreationDate="2015-10-26T12:19:59.250" Score="3" ViewCount="344" Body="&lt;p&gt;Flanging is defined as a mix of two identical signals where one signal is delayed in time by a small and gradually changing period, around 10-20 milliseconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since delay in the time domain is equivalent to a phase shift in the frequency domain, could then a Flanging sound effect be done in frequency domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could we do a DFT transform, make a copy of amplitudes and phases, shift phases (and gradually change the shift between -180 and +180 degrees), and add the result to original amplitudes and phases?  &lt;/p&gt;&#xA;" OwnerUserId="1585" LastEditorUserId="1585" LastEditDate="2015-10-26T12:25:08.863" LastActivityDate="2015-10-27T15:09:24.817" Title="&quot;Flanging&quot; in frequency domain?" Tags="|fft|audio|fourier-transform|dft|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26672" PostTypeId="2" ParentId="26629" CreationDate="2015-10-26T14:24:45.703" Score="2" Body="&lt;p&gt;Regarding the magnitude response of the FIR Hilbert transformer, it is never ideally flat. The passband magnitude ripple can be reduced by increasing the filter order. However, in your case the frequency $40$ (whatever units) at a sampling frequency of $2000$ is &lt;em&gt;outside&lt;/em&gt; the passband of the designed filter, because your lower band edge is $0.05$ (which corresponds to a frequency of $50$ for the given sampling rate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you want the Hilbert transformer to work well at a frequency of $40$, this frequency must be inside the passband, i.e. you must lower the lower band edge to say $0.035$. If the resulting passband ripple is too high, then you also must increase the filter order.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-26T14:24:45.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26673" PostTypeId="1" AcceptedAnswerId="26674" CreationDate="2015-10-26T15:22:58.210" Score="1" ViewCount="140" Body="&lt;p&gt;I am studying Signals and Systems. Anyone, please help me to answer the problems.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$y(t)=dx(t)/dt$ is time invariant:  True or False ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$h(t)$ is the impulse response of an LTI system. If $h(t)$ is periodic and non-zero, the system is unstable:  True or False?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="80" LastEditDate="2015-10-26T15:47:39.737" LastActivityDate="2015-10-26T16:32:27.873" Title="properties of System" Tags="|signal-analysis|continuous-signals|homework|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26674" PostTypeId="2" ParentId="26673" CreationDate="2015-10-26T15:54:03.623" Score="3" Body="&lt;p&gt;For question 1: &lt;a href=&quot;https://en.wikipedia.org/wiki/Time-invariant_system&quot; rel=&quot;nofollow&quot;&gt;apply the definition of time invariant&lt;/a&gt;: find the output as normal; find the output with the same input but delayed by $T$ &#xA;$$&#xA;y_1(t) = \frac{dx(t)}{dt}\\&#xA;y_2(t) = \frac{dx(t-T)}{dt}\\&#xA;$$&#xA;Does $y_2(t) = y_1(t-T)$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For question 2: Find a definition of stability and apply it. For example, for a system to be &lt;a href=&quot;https://en.wikipedia.org/wiki/BIBO_stability&quot; rel=&quot;nofollow&quot;&gt;BIBO stable&lt;/a&gt; it needs to have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int_{-\infty}^{+\infty} \left|h(t)\right| dt &amp;lt; \infty&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $h(t)$ is periodic and non-trivial (zero), can that be true?&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-10-26T16:32:27.873" LastActivityDate="2015-10-26T16:32:27.873" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26675" PostTypeId="1" AcceptedAnswerId="26678" CreationDate="2015-10-26T19:21:23.860" Score="0" ViewCount="99" Body="&lt;p&gt;Is there a way to plot PSD of a signal which show true frequency amounts ( not normalized one) without having knowledge about frequency bandwidth or sampling frequency of the signal in matlab ?&lt;/p&gt;&#xA;" OwnerUserId="17979" LastActivityDate="2015-10-27T15:26:10.263" Title="Obtaining power spectral density without having knowledge about frequency bandwidth or sampling frequency of the signal in Matlab?" Tags="|signal-analysis|frequency-spectrum|frequency|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26676" PostTypeId="1" AcceptedAnswerId="28053" CreationDate="2015-10-26T21:12:54.767" Score="3" ViewCount="220" Body="&lt;p&gt;Using a &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_quantization&quot; rel=&quot;nofollow&quot;&gt;vector quantizer&lt;/a&gt; (VQ), groups of image samples (or motion compensated and/or transformed data) can be quantized as vectors. I'm curious about why VQs are not preferred in the modern, highly popular video codecs such as &lt;a href=&quot;https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC&quot; rel=&quot;nofollow&quot;&gt;H.264/AVC&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding&quot; rel=&quot;nofollow&quot;&gt;H.265/HEVC&lt;/a&gt;. A quick Wikipedia search showed that there are some codecs (such as &lt;a href=&quot;https://xiph.org/daala/&quot; rel=&quot;nofollow&quot;&gt;Daala&lt;/a&gt;) using VQs. However, the &lt;em&gt;best&lt;/em&gt; codecs, in terms of compression efficiency, do not use them. Is that because of the difficulty of designing a good codebook and efficient searching of the codebook?&lt;/p&gt;&#xA;" OwnerUserId="8751" LastActivityDate="2016-01-05T01:22:32.560" Title="Why are vector quantizers not used in video codecs?" Tags="|video-compression|quantization|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26677" PostTypeId="1" AcceptedAnswerId="26680" CreationDate="2015-10-26T21:25:07.407" Score="2" ViewCount="3015" Body="&lt;p&gt;trying to program an integrator. My input is a square wave and my expected output should be a triangle wave. However, whenever I pass it through my low pass filter algorithm (just a 2nd order butterworth low pass filter with a Q of 0.707), I never seem to get a triangle wave. Instead, I get a a smooth square wave (I guess that's similar to a capacitor smoothing it out?). I am not sure how to tackle this problem as I'm a little new to signal processing + algorithms. Any help would be greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a picture of an example test I did through Xcode. I was sending a F3 note (around 349 hz) through a low pass with a cutoff of 200 hz and the output is shown below. This is probably the sharpest/closest I've gotten to the triangle wave. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/1RiBh.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1RiBh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: to clarify, I am trying to convert a square wave to a triangle wave (preferably through a low pass filter if that is totally doable).&lt;/p&gt;&#xA;" OwnerUserId="10572" LastEditorUserId="10572" LastEditDate="2015-10-26T23:11:02.913" LastActivityDate="2015-10-27T07:53:27.363" Title="Integration of square wave" Tags="|audio|lowpass-filter|music|signal-synthesis|integration|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26678" PostTypeId="2" ParentId="26675" CreationDate="2015-10-26T21:43:52.570" Score="1" Body="&lt;p&gt;Without more information about the signal, it is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The set of samples is just a set of numbers with no further information associated with them. If you know the frequency at which the samples were taken, then you can associate &quot;real-world&quot; frequencies to their FFT bins. Otherwise, it may be impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give an example, consider the samples of $\cos(2\pi 100t)$ taken at $f_s=500\,\text{Hz}$, and the samples of $\cos(2\pi 200t)$ taken at $f_s=1000\,\text{Hz}$. They are exactly the same! There is no way to tell the two signals apart just from their samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may be, however, that you have some extra piece of information that may help deduce $f_s$. For example, you may know that the signal's spectrum has a peak, or a particular phase, or some other property at a certain frequency. If you find the normalized FFT of the samples and identify this property, you can extrapolate from there to estimate the actual signal frequencies.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-10-27T15:26:10.263" LastActivityDate="2015-10-27T15:26:10.263" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26680" PostTypeId="2" ParentId="26677" CreationDate="2015-10-27T00:10:57.620" Score="2" Body="&lt;p&gt;The Fourier series of the square wave tells us that the input signal has harmonics at odd multiples of the fundamental frequency $f_1=349\,\text{Hz}$: $$f_k=kf_1,\,\text{$k$ odd}$$ with amplitudes $$A_k=\frac{4A}{k\pi}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The triangular wave, on the other hand, has harmonics at the same frequencies, but their amplitudes are $$B_k=\frac{4A}{k^2\pi^2}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In consequence, your filter needs to have gain $\frac{B_k}{A_k}$ at frequency $f_k$. Any other set of gains will result in an output different from a triangular wave. Note that I haven't mentioned the phase, but you need to make sure your filter has linear phase. Otherwise the triangular wave will be distorted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that an ideal integrator will do the trick. A practical integrator may do it too, but its bandwidth needs to be large enough to not introduce additional attenuation to the higher frequency harmonics.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-27T00:10:57.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26681" PostTypeId="2" ParentId="26629" CreationDate="2015-10-27T07:05:57.650" Score="2" Body="&lt;p&gt;@Rodrigo PG: Now that your Hilbert filter is working, you can start experimenting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Window your Hilb filter’s coefficients with a Hanning (Hann) or Hamming window to reduce the passband ripple. But make sure your signal of interest is still within the Hilb filter’s passband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Decimate your input signal by a factor of two using a halfband filter. That will allow you to use a simpler (fewer coefficients) Hilb filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] Insert a zero-valued coefficient in between each of your original Hilb filter’s coefficients. That will enable you to perform a Hilbert transform on lower-frequency signals.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-27T07:05:57.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26682" PostTypeId="2" ParentId="26677" CreationDate="2015-10-27T07:38:27.327" Score="4" Body="&lt;p&gt;If your square wave has a mean of zero (this is important!), then a simple accumulator can do the job. Its operation is described by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]+y[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is the input (square wave) and $y[n]$ is the output (triangular wave).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a simple Matlab/Octave script showing how it works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;sq = [1,-1,1,-1,1,-1,1,-1]'*ones(1,5);&#xA;sq = sq'(:);                 % a few periods of a square wave&#xA;tr = filter(1,[1,-1],sq);    % filtered by accumulator&#xA;% plot&#xA;subplot(2,1,1),stem(sq)&#xA;subplot(2,1,2),stem(tr)&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KdeUL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KdeUL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-10-27T07:53:27.363" LastActivityDate="2015-10-27T07:53:27.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26683" PostTypeId="2" ParentId="26667" CreationDate="2015-10-27T08:00:13.217" Score="1" Body="&lt;p&gt;In my experience, you do not necessarily need an orthogonal dictionary, see for example &lt;a href=&quot;http://arxiv.org/pdf/1005.2613.pdf&quot; rel=&quot;nofollow&quot;&gt;Compressed Sensing with Coherent and Redundant Dictionaries&lt;/a&gt; (DOI: &lt;a href=&quot;http://dx.doi.org/10.1016/j.acha.2010.10.002&quot; rel=&quot;nofollow&quot;&gt;10.1016/j.acha.2010.10.002&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper &lt;a href=&quot;https://spiral.imperial.ac.uk/bitstream/10044/1/6106/1/paper.pdf&quot; rel=&quot;nofollow&quot;&gt;Quantifying the performance of compressive&#xA;sensing on scalp EEG signals&lt;/a&gt; (DOI: &lt;a href=&quot;http://dx.doi.org/10.1109/ISABEL.2010.5702814&quot; rel=&quot;nofollow&quot;&gt;10.1109/ISABEL.2010.5702814&lt;/a&gt;) seems to be an example of the use of Gabor dictionaries (in EEG) in compressed sensing. I would just go ahead and try it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the chirp you are looking for can have a fairly fixed location in the Gabor domain, it might be possible to use compressive detection or classification instead of actual reconstruction. This is explained in &lt;a href=&quot;http://users.ece.gatech.edu/~mdavenport/publications/dbwb-jstsp-2010.pdf&quot; rel=&quot;nofollow&quot;&gt;Signal Processing With Compressive Measurements&lt;/a&gt; (&lt;a href=&quot;http://dx.doi.org/10.1109/JSTSP.2009.2039178&quot; rel=&quot;nofollow&quot;&gt;10.1109/JSTSP.2009.2039178&lt;/a&gt;. You can see an example of &lt;a href=&quot;http://www.eurasip.org/Proceedings/Eusipco/Eusipco2012/Conference/papers/1569577097.pdf&quot; rel=&quot;nofollow&quot;&gt;how we have used it for symbol detection in IEEE 802.15.4 communication&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2015-10-27T08:00:13.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26684" PostTypeId="2" ParentId="26620" CreationDate="2015-10-27T08:24:01.790" Score="3" Body="&lt;p&gt;@Keith: Here's the situation as I see it. Your original signal's spectrum is shown in panel (a) below. The solid lines are spectral energy and the dotted lines are spectral replications. After the zero-stuffing (upsampling by two), the stuffed sequence's spectrum is shown in panel (b). Notice the spectral image centered at 44.1 kHz that needs to be removed (attenuated). So after zero-stuffing you need to implement a digital filter whose passband cutoff freq is 0.45*22.05 kHz and whose stopband begins at 0.55*22.05 kHz. (I show that filter as the dashed line in panel (b).) But keep in mind, the filter’s Nyquist rate is 44.1 kHz (88.2/2 kHz) and not 22.05 kHz. The final spectrum you want is shown in panel (c).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uwaVp.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uwaVp.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-10-27T08:24:01.790" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26685" PostTypeId="2" ParentId="26670" CreationDate="2015-10-27T09:00:57.397" Score="1" Body="&lt;p&gt;A time shift $\tau$ of the signal $\tilde x(t)$ can be implemented exploiting the time shift property of the discrete Fourier transform (DFT). So what you propose is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x(n) = \tilde x(nT)$ be the sampled version of $\tilde x$ with sampling interval $T$. The flanged signal $y$ can be obtained by &#xA;$$&#xA;y(n) = \operatorname*{IDFT}_N\left[\operatorname*{DFT}_N( x ) + \operatorname*{DFT}_N( x )\exp\left(-\mathrm j \frac{2\pi}{N}k\eta\right) \right]\\&#xA;= x(n)+ \operatorname*{IDFT}_N\left[\operatorname*{DFT}_N( x )\exp\left(-\mathrm j \frac{2\pi}{N}k\eta\right) \right],&#xA;$$&#xA;where $\eta = \tau/T$, $k\in[0,N-1]$, and $N$ is the length of the I/DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The time shifted version of $x$ is just an interpolation if $\eta \notin \mathbb N$ and the precision of this interpolation grows with $N$. On the other hand, $\tau$ can only be changed every $N$ values and therefore the greater $N$, the lower the update speed. The value of $N$ is thus a tradeoff between time resolution and update speed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For every block of $N$ samples an I/DFT pair is required which is computationally expensive. &lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-10-27T09:00:57.397" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26688" PostTypeId="1" AcceptedAnswerId="26690" CreationDate="2015-10-27T11:15:28.570" Score="5" ViewCount="5606" Body="&lt;p&gt;I tried to &lt;strong&gt;analytically&lt;/strong&gt; construct a causal notch filter that stops frequencies at 50Hz and I thought if zeros are more than poles it will be non-causal so I chose equal amount of poles and zeros resulting in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dfrac{\left(z-e^{100\pi i} \right)\left(z-e^{-100\pi i} \right)}{z^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correctly designed and causal?&lt;/p&gt;&#xA;" OwnerUserId="17986" LastEditorUserId="4298" LastEditDate="2020-11-08T16:11:21.243" LastActivityDate="2020-11-08T16:11:21.243" Title="Analytically designing a notch-filter for specified frequency 50 Hz" Tags="|filters|discrete-signals|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26689" PostTypeId="1" CreationDate="2015-10-27T11:30:03.777" Score="4" ViewCount="427" Body="&lt;p&gt;AEC algorithms mostly rely on LMS adaptive filtering, i.e. you update FIR filter coefficients then perform the filtering. Theoretically, the FIR must be as long as the maximum echo length you want to cancel. For instance to cancel delays up to 500ms on a 48kHz signal, you'll need a 24000 point FIR.&#xA;When your memory and processing power limitations make it so you can neither afford to perform 24000 MACs per processed sample, nor to use FFT-based fast convolution algorithms, is there a way around for cancelling such potentially high length echoes in a more affordable way, given delay is unknown and potentially variable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering maybe about some other algorithm running in parallel that could assess the approximate delay, then use an adaptive length delay line + a shorter adaptive FIR filter (up to a few hundreds taps is OK)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this make sense? Any other neat approach to suggest?&lt;/p&gt;&#xA;" OwnerUserId="17990" LastActivityDate="2016-05-25T10:00:42.483" Title="Echo cancellation supporting long delays and without frequency domain processing" Tags="|adaptive-filters|finite-impulse-response|adaptive-algorithms|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26690" PostTypeId="2" ParentId="26688" CreationDate="2015-10-27T11:46:08.403" Score="8" Body="&lt;p&gt;You've designed a causal filter with a notch at $\omega_0=100\pi$. But the result is probably not what you want. Note that you've designed an FIR (finite impulse response) filter. Its frequency response has a large overshoot towards high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you actually want is an IIR filter, with poles away from the origin of the complex $z$-plane. A simple way to design a notch filter is to place the zeros at the desired notch frequency (as you did), and place poles at the same angle but slightly inside the unit circle. If $0&amp;lt;r&amp;lt;1$ is the pole radius, your transfer function looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{(z-e^{j\omega_0})(z-e^{-j\omega_0})}{(z-re^{j\omega_0})(z-re^{-j\omega_0})}=\frac{z^2-2z\cos(\omega_0)+1}{z^2-2zr\cos(\omega_0)+r^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can apply scaling to the transfer function $(1)$ such that its gain at DC equals 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, note that you have to take the sampling frequency into account. The notch frequency $\omega_0$ in $(1)$ is normalized. If $f_0$ is the desired notch frequency in Hertz, and if $f_s$ is the sampling frequency in Hertz, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_0=2\pi\frac{f_0}{f_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, take $f_0=50\text{ Hz}$, $f_s=1000\text{ Hz}$, and $r=0.98$. The figure below shows the transfer function of the FIR notch filter you proposed (top), and the IIR transfer function according to Equation $(1)$ (bottom):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JcIHg.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JcIHg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-27T11:46:08.403" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26691" PostTypeId="1" AcceptedAnswerId="26692" CreationDate="2015-10-27T14:01:43.577" Score="2" ViewCount="633" Body="&lt;p&gt;Consider a signal with a sample rate $f_s = 44.1$ kHz. Let us upsample the signal by a factor of $L = 2$ and interpolate the zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ideal lowpass interpolator would have a gain of $L$ and a cutoff frequency of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_c = \frac{f_s}{L}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ideal lowpass filter has an infinitesimally small transition band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice I see real lowpass interpolators have a small transition band centred around $f_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transition band can be quite large, say, $0.45 f_s$ to $0.55 f_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: why do we centre the transition band of a practical lowpass interpolator around the ideal cutoff frequency? By doing that the practical lowpass stopband is above the ideal cutoff which does not make sense to me as that will allow a small unwanted spectral image from the $0.45 f_s$ to $0.50 f_s$ region to creep into the new signal. The obvious alternative is to make the stopband of the practical lowpass $0.5 f_s$ and put up with a passband starting at $0.4 f_s$ assuming we can't make the transition band steeper. There must be some reason this isn't the way it's done.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="15030" LastEditDate="2015-10-27T14:07:00.923" LastActivityDate="2015-10-27T15:00:04.237" Title="Practical vs ideal lowpass interpolator" Tags="|filter-design|interpolation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26692" PostTypeId="2" ParentId="26691" CreationDate="2015-10-27T15:00:04.237" Score="2" Body="&lt;p&gt;When designing a filter, you really care about its behavior in two regions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Passband&lt;/strong&gt;: You want little attenuation in this region, and maybe other properties as well, like linear phase, depending upon your application.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stopband&lt;/strong&gt;: You want as much attenuation as needed in this region.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Between these two is the transition region. This is treated as somewhat of a &quot;don't-care&quot; band. You don't typically constrain the response too tightly in this area, so you can't really count it being usable. In your example, the passband lies below $0.45 f_s$; after the interpolator, you only plan on using frequency content below this threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that you can allow some aliasing in order to simplify your filter design. Your transition region starts at $0.45 f_s$; everything above that frequency in your filter's output will either have a response that is unpredictable given your filter specs (if it lies in the transition band) or one that is highly attenuated (if it lies in the stopband). The takeaway: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;You can't rely upon any frequency content past the passband edge in your filter output anyway.&lt;/strong&gt; So if it makes the filter design cheaper, why not allow the frequencies above the passband edge in the filter output to contain aliased garbage? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This technique is commonly used in multirate filters as you've noticed, as it allows savings in the required filter order in order to meet a given set of passband/stopband specifications.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-10-27T15:00:04.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26693" PostTypeId="2" ParentId="26670" CreationDate="2015-10-27T15:09:24.817" Score="2" Body="&lt;p&gt;Frequency domain does not really work here. A flanger is NOT a linear time invariant system. You could try to implement this is &quot;piece-wise&quot; LTI and change the delay only at a frame boundary but this will mostly likely result in unacceptable artifacts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A flanger will require a time variant fractional delay. Rounding the delay the nearest integer delay results in unacceptable &quot;zipper&quot; noise. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-10-27T15:09:24.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26696" PostTypeId="1" AcceptedAnswerId="26700" CreationDate="2015-10-27T16:53:30.187" Score="-2" ViewCount="204" Body="&lt;p&gt;As z tranform is the transformation of discrete time signals into complex frequency domian. What do you get out of complex Stuff. As wikipedia calls it complex frequency domain. Why do you need it ? &#xA;How to look at it, In order to understand it from the text?&lt;/p&gt;&#xA;" OwnerUserId="17828" LastEditorUserId="17828" LastEditDate="2015-10-31T02:33:27.513" LastActivityDate="2015-10-31T02:33:27.513" Title="What does z-transform imply?" Tags="|dsp-core|z-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26697" PostTypeId="1" AcceptedAnswerId="26698" CreationDate="2015-10-27T17:33:03.827" Score="70" ViewCount="21783" Body="&lt;p&gt;I'm looking forward to enroll in an MSc in Signal and Image processing, or maybe Computer Vision (I have not decided yet), and this question emerged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My concern is, since deep learning doesn't need feature extraction and almost no input pre-processing, is it killing image processing (or signal processing in general)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not an expert in deep learning, but it seems to work very well in recognition and classification tasks taking images directly instead of a feature vector like other techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any case in which a traditional feature extraction + classification approach would be better, making use of image processing techniques, or is this dying because of deep learning?&lt;/p&gt;&#xA;" OwnerUserId="17997" LastEditorUserId="11256" LastEditDate="2017-08-25T13:46:56.200" LastActivityDate="2022-05-18T21:43:21.130" Title="Is deep learning killing image processing/computer vision?" Tags="|image-processing|signal-analysis|computer-vision|machine-learning|deep-learning|" AnswerCount="12" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26698" PostTypeId="2" ParentId="26697" CreationDate="2015-10-27T18:06:07.453" Score="56" Body="&lt;p&gt;On the top of this answer, you can see a section of updated links, where artificial intelligence, machine intelligence, deep learning or and database machine learning progressively step of the grounds of traditional signal processing/image analysis/computer vision. Below, variations on the original answer.&lt;/p&gt;&#xA;&lt;p&gt;For a short version: successes of convolutional neural networks and deep learning have been looked like as a sort of Galilean revolution. For a practical point of view, classical signal processing or computer vision were dead... provided that you have enough or good-enough labeled data, that you care little about evident classification failures (aka &lt;strong&gt;&lt;a href=&quot;https://www.kdnuggets.com/2014/06/deep-learning-deep-flaws.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;deep flaws&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Deepfake&quot; rel=&quot;nofollow noreferrer&quot;&gt;deep fakes&lt;/a&gt;&lt;/strong&gt;), that &lt;a href=&quot;https://techxplore.com/news/2019-06-glare-energy-consumption-deep.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;you have infinite energy to run tests without thinking about the carbon footprint&lt;/a&gt;, and don't bother causal or rational explanations. For the others, this made us rethink about all what we did before: preprocessing, standard analysis, feature extraction, optimization (cf. my colleague J.-C. Pesquet work on &lt;a href=&quot;https://arxiv.org/abs/1808.07526&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep Neural Network Structures Solving Variational Inequalities&lt;/a&gt;), invariance, quantification, etc. And really interesting research is emerging from that, hopefully catching up with firmly grounded principles and similar performance.&lt;/p&gt;&#xA;&lt;p&gt;Updated links:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;2021/04/10: &lt;a href=&quot;https://arxiv.org/abs/2104.01534&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hierarchical Image Peeling: A Flexible Scale-space Filtering Framework&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;2019/07/19: &lt;a href=&quot;https://www.theverge.com/2019/7/19/20700481/ai-machine-learning-vision-system-naturally-occuring-adversarial-examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Verge: If you can identify what’s in these images, you’re smarter than AI&lt;/a&gt;, or do you see a ship wreck, or insects on a dead leaf?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/e2KFv.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/e2KFv.jpg&quot; alt=&quot;Shipwreck&quot; /&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;2019/07/16: Preprint: &lt;a href=&quot;https://arxiv.org/abs/1907.07174&quot; rel=&quot;nofollow noreferrer&quot;&gt;Natural Adversarial Examples&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We introduce natural adversarial examples -- real-world, unmodified,&#xA;and naturally occurring examples that cause classifier accuracy to&#xA;significantly degrade. We curate 7,500 natural adversarial examples&#xA;and release them in an ImageNet classifier test set that we call&#xA;ImageNet-A. This dataset serves as a new way to measure classifier&#xA;robustness. Like l_p adversarial examples, ImageNet-A examples&#xA;successfully transfer to unseen or black-box classifiers. For example,&#xA;on ImageNet-A a DenseNet-121 obtains around 2% accuracy, an accuracy&#xA;drop of approximately 90%. Recovering this accuracy is not simple&#xA;because ImageNet-A examples exploit deep flaws in current classifiers&#xA;including their over-reliance on color, texture, and background cues.&#xA;We observe that popular training techniques for improving robustness&#xA;have little effect, but we show that some architectural changes can&#xA;enhance robustness to natural adversarial examples. Future research is&#xA;required to enable robust generalization to this hard ImageNet test&#xA;set.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;2019/05/03: &lt;a href=&quot;https://medium.com/@alexrachnog/deep-learning-the-final-frontier-for-signal-processing-and-time-series-analysis-734307167ad6&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep learning: the final frontier for signal processing and time series analysis?&lt;/a&gt; &amp;quot;In this article, I want to show several areas where signals or time series are vital&amp;quot;&lt;/li&gt;&#xA;&lt;li&gt;2018/04/23: I just come back from the yearly international conference on acoustics, speech and signal processing, &lt;a href=&quot;https://2018.ieeeicassp.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ICASSP 2018&lt;/a&gt;. I was amazed by the quantity of papers somewhat relying on deep Learning, Deep Networks, etc. Two pleanaries out of four (by Alex Acero and Yann LeCun) were devoted to such topic. At the same time, most of the researchers I have met were kind of joking about that (&amp;quot;Sorry, my poster is on filter banks, not on Deep Learning&amp;quot;, &amp;quot;I am not into that, I have small datasets&amp;quot;), or were wondering about gaining 0.5% on grand challenges, and losing the interested in modeling the physics or statistical priors.&lt;/li&gt;&#xA;&lt;li&gt;2018/01/14: &lt;a href=&quot;https://blog.piekniewski.info/2016/12/29/can-a-deep-net-see-a-cat/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Can A Deep Net See A Cat?&lt;/a&gt;, from &amp;quot;abstract cat&amp;quot;, to &amp;quot;best cat&amp;quot; inverted, drawn, etc. and somehow surprizing results on sketches&lt;/li&gt;&#xA;&lt;li&gt;2017/11/02: added references to scattering transforms/networks&lt;/li&gt;&#xA;&lt;li&gt;2017/10/21: &lt;a href=&quot;https://arxiv.org/abs/1710.04011&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Review of Convolutional Neural Networks for Inverse Problems in&#xA;Imaging&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://habla.dc.uba.ar/gravano/ith-2014/presentaciones/Yu_and_Deng_2011.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep Learning and Its Applications to Signal and Information Processing&lt;/a&gt;, IEEE Signal Processing Magazine, January 2011&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Deep learning references &amp;quot;stepping&amp;quot; on standard  signal/image processing can be found at the bottom. Michael Elad just wrote  &lt;a href=&quot;https://sinews.siam.org/Details-Page/deep-deep-trouble&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep, Deep Trouble: Deep Learning’s Impact on Image Processing, Mathematics, and Humanity&lt;/a&gt; (SIAM News, 2017/05), excerpt:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Then neural networks suddenly came back, and with a vengeance.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This tribune is of interest, as it shows a shift from traditional &amp;quot;image processing&amp;quot;, trying to model/understand the data, to a realm of correctness, without so much insight.&lt;/p&gt;&#xA;&lt;p&gt;This domain is evolving quite fast. This does not mean it evolves in some intentional or constant direction. Neither right nor wrong. But this morning, I heard the following saying (or is it a joke?):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a bad algorithm with a huge set of data can do better than a smart  algorithm with &lt;a href=&quot;https://en.wiktionary.org/wiki/pauce&quot; rel=&quot;nofollow noreferrer&quot;&gt;pauce&lt;/a&gt; data.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here was my very short try: &lt;strong&gt;deep learning may provide state-of-the-art results, but one does not always understand why&lt;/strong&gt;, and part of our scientist job remains on explaining why things work, what is the content of a piece of data, etc.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Deep_learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep learning&lt;/a&gt; used too require (huge) well-tagged databases. Any time you do craftwork on single or singular images (i. e. without a huge database behind), especially in places unlikely to yield &amp;quot;free user-based tagged images&amp;quot; (in the complementary set of the set &amp;quot;&lt;a href=&quot;https://www.youtube.com/watch?v=xEhaVhta7sI&quot; rel=&quot;nofollow noreferrer&quot;&gt;funny cats playing games and faces&lt;/a&gt;&amp;quot;), you can stick to traditional image processing for a while, and for profit. A &lt;a href=&quot;https://twitter.com/ncroc2004/status/734399832438255617&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent tweet&lt;/a&gt; summarizes that:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(lots of) labeled data (with no missing vars) requirement is a deal&#xA;breaker (&amp;amp; unnecessary) for many domains&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If they are being killed (which I doubt at a short term notice), they are not dead yet. So any skill you acquire in signal processing, image analysis, computer vision will help you in the future. This is for instance discussed in the blog post:  &lt;a href=&quot;http://alexgkendall.com/computer_vision/have_we_forgotten_about_geometry_in_computer_vision/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Have We Forgotten about Geometry in Computer Vision?&lt;/a&gt; by Alex Kendall:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Deep learning has revolutionised computer vision. Today, there are not&#xA;many problems where the best performing solution is not based on an&#xA;end-to-end deep learning model. In particular, convolutional neural&#xA;networks are popular as they tend to work fairly well out of the box.&#xA;However, these models are largely big black-boxes. There are a lot of&#xA;things we don’t understand about them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;A concrete example can be the following: a couple of very dark (eg surveillance) images from the same location, needing to evaluate if one of them contains a specific change that should be detected, is potentially a matter of traditional image processing, more than Deep Learning (as of today).&lt;/p&gt;&#xA;&lt;p&gt;On the other side, as successful as Deep Learning  is on a large scale, it can lead to misclassification of a small sets of data, which might be harmless &amp;quot;in average&amp;quot; for some applications. Two images that just slightly differ to the human eye could be classified differently via DL. Or random images could be set to a specific class. See for instance &lt;a href=&quot;http://www.evolvingai.org/fooling&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep neural networks are easily fooled: High confidence predictions for unrecognizable images&lt;/a&gt; (Nguyen A, Yosinski J, Clune J. Proc. Computer Vision and Pattern Recognition 2015), or &lt;a href=&quot;http://www.kdnuggets.com/2014/06/deep-learning-deep-flaws.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Does Deep Learning Have Deep Flaws?&lt;/a&gt;, on adversarial negatives:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The network may misclassify an image after the researchers applied a&#xA;certain imperceptible perturbation. The perturbations are found by&#xA;adjusting the pixel values to maximize the prediction error.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;With all due respect to &amp;quot;Deep Learning&amp;quot;, think about &amp;quot;mass production responding to a registered, known, mass-validable  or expected behaviour&amp;quot; versus &amp;quot;singular piece of craft&amp;quot;. None is better (yet) in a single index scale. Both may have to coexist for a while.&lt;/p&gt;&#xA;&lt;p&gt;However, deep learning pervades many  novel areas, as described in references below. Many not-linear, complex features might be revealed by deep learning, that had not been seen before by traditional processing.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Deep learning for image compression&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.wave.one/icml2017/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Real-Time Adaptive Image Compression&lt;/a&gt;, ICML 2017&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://research.google.com/pubs/pub45534.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Full Resolution Image Compression with Recurrent Neural Networks&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.iclr.cc/lib/exe/fetch.php?media=iclr2017:balle_iclr2017.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;End-to-end optimized image compression&lt;/a&gt;, ICRL 2017&lt;/li&gt;&#xA;&lt;li&gt;Deep learning for video compression&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/38054/15892&quot;&gt;Can deep learning be applied to video compression?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1611.07233.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deep learning for denoising, restoration, artifact removal&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;CAS-CNN: A Deep Convolutional Neural Network for Image Compression Artifact Suppression&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1511.05666&quot; rel=&quot;nofollow noreferrer&quot;&gt;Super-Resolution with Deep Convolutional Sufficient Statistics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Luckily, some folks are trying to find mathematical rationale behind deep learning, an example of which are scattering networks or transforms proposed by &lt;a href=&quot;https://www.di.ens.fr/%7Emallat/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stéphane Mallat&lt;/a&gt; and co-authors, see &lt;a href=&quot;http://www.di.ens.fr/data/scattering/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ENS site for scattering&lt;/a&gt;. Harmonic analysis and non-linear operators, Lipschitz functions, translation/rotation invariance, better for the average signal processing person. See for instance &lt;a href=&quot;https://arxiv.org/abs/1601.04920&quot; rel=&quot;nofollow noreferrer&quot;&gt;Understanding Deep Convolutional Networks&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2021-04-10T10:44:35.493" LastActivityDate="2021-04-10T10:44:35.493" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26699" PostTypeId="2" ParentId="26697" CreationDate="2015-10-27T18:24:37.420" Score="22" Body="&lt;p&gt;First, there is nothing wrong with doing grad work in image processing or computer vision &lt;em&gt;and&lt;/em&gt; using deep learning. Deep learning is not killing image processing and computer vision, it is merely the current hot research topic in those fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, deep learning is primarily used in object category recognition. But that is only one of many areas of computer vision. There are other areas, like object detection, tracking, 3D reconstruction, etc., many of which still rely on &quot;hand-crafted&quot; features.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-10-27T18:24:37.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26700" PostTypeId="2" ParentId="26696" CreationDate="2015-10-27T20:07:35.960" Score="0" Body="&lt;p&gt;it's in the textbooks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here's a short synopsis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in continuous-time LTI systems, you have 3 fundamental classes of building blocks:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;scaler (multiply signal by a constant)&lt;/li&gt;&#xA;&lt;li&gt;adder (add signals)&lt;/li&gt;&#xA;&lt;li&gt;integrator (integrate signal w.r.t. time)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;the first two do not discriminate w.r.t. frequency.  so you can't build a &quot;filter&quot; out of just the first two because there is nothing in that filter that responds differently for different frequencies.  so you need the third class which we commonly use the label &quot;$s^{-1}$&quot; for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for discrete-time LTI systems, the first two classes are the same as for continuous time.  you have scalers and adders.  but the third class of fundamental processing block is different.  the third class is a unit delay, a delay of one unit of discrete time and we call that &quot;$z^{-1}$&quot;.  that's how digital filters know the difference between one frequency and another.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-10-27T20:07:35.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26702" PostTypeId="1" AcceptedAnswerId="26710" CreationDate="2015-10-27T22:43:53.467" Score="9" ViewCount="4328" Body="&lt;p&gt;I would like to find the exact replica of signal A in time series B. I am working with the simple toy example below, in which A is located starting at the 4th position in B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that using &lt;code&gt;xcorr&lt;/code&gt; would achieve this but I am clearly failing somewhere. &lt;code&gt;xcorr&lt;/code&gt; doesn't seem to be the right function despite the MATLAB help notes on &lt;code&gt;xcorr&lt;/code&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/15371577/finding-the-difference-between-two-signals&quot;&gt;comments such as&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Cross-correlation is usually the simplest way to determine the time lag between two signals. The position of peak value indicates the time offset at which the two signals are the most similar.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = [1 2 1];&#xA;B = [0 9 8 1 2 1 7 3 1 0];  &#xA;[c, lags] = xcorr(A,B)&#xA;lags(c==max(c))&#xA;c =&#xA;Columns 1 through 12&#xA;  0.0000    1.0000    5.0000   14.0000   18.0000   11.0000    6.0000   12.0000   26.0000   26.0000    9.0000    0.0000&#xA;Columns 13 through 19&#xA;  0.0000    0.0000    0.0000   -0.0000   -0.0000   -0.0000   -0.0000&#xA;lags =&#xA;  -9    -8    -7    -6    -5    -4    -3    -2    -1     0     1     2     3     4     5     6     7     8     9&#xA;ans =&#xA;  -1     0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The max correlation values are located at lags of -1 and 0, which doesn't match the offset required to get A to match B. This leads me to ask: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When is &lt;code&gt;xcorr&lt;/code&gt; useful for finding the exact signal in another signal? 2. And what function should I be using to find the location of A in B? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Ideally I would like to test this method on more complicated signals as well as look for methods of detecting &quot;similar&quot; signals inside other (longer) signals.&lt;/p&gt;&#xA;" OwnerUserId="4038" LastEditorUserId="128" LastEditDate="2019-11-28T10:56:59.303" LastActivityDate="2019-11-28T10:56:59.303" Title="Detecting a Signal Inside a Time Series Using MATLAB's $ \tt xcorr() $" Tags="|matlab|signal-detection|cross-correlation|matched-filter|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26703" PostTypeId="1" AcceptedAnswerId="26705" CreationDate="2015-10-28T00:26:22.387" Score="2" ViewCount="3450" Body="&lt;p&gt;The BER is the average number of errors that would occur in a sequence of &#xA;$n$ bits.  When $n = 1$, we can &#xA;think of the BER as the probability that any given bit will be received in error. Basically, it lies between 0 and 1 -- &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;when BER = 0, we can say no error in the received bits. &lt;/li&gt;&#xA;&lt;li&gt;If at least one error is seen, we can say with 100 &#xA;percent certainty that the BER is definitely not zero.&lt;/li&gt;&#xA;&lt;li&gt;as long as at least one bit was successfully received, we can state that the BER is most definitely less than 1. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When we measure the performance of a digital communication system with and without equalization, with that of the theoretical BER for a particular kind of modulation, we prefer the simulation to be exact match with the theoretical. &#xA;My Questions are :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Is theoretical BER the upper or lower performance bound?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) Is it desired that the BER tends to zero? Is it reasonable to say that  since this may not happen in real communication, so there is always a quest to come up with an equalizer designed with an objective that the BER tends to zero?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) What if the simulation curve with and without equalizer falls below the theoretical? What can be said about the equalization method playing a role and if it is desired that the simulation curve - with and without equalizer is below the theoretical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4) What can be said about performance of the system with and without equalizer if the simulated BER is above the theoretical?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(5) Does an equalizer essentially help to improve the BER? By improving -how much improvement is desired? Tradeoff? Do we wish the simulated curve to be an exact match to the theoretical and then say that the equalizer is functioning properly in removing intersymbol interference and noise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sYikV.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sYikV.jpg&quot; alt=&quot;ber&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the interpretation for the bit error performance?&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="780" LastEditDate="2015-10-29T20:00:22.927" LastActivityDate="2015-10-29T20:00:22.927" Title="Bit error rate curves, theoretical and simulation" Tags="|modulation|self-study|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26705" PostTypeId="2" ParentId="26703" CreationDate="2015-10-28T02:07:08.643" Score="1" Body="&lt;p&gt;Note: usually, the &quot;theoretical BER&quot; is called $P(e)$, the &lt;em&gt;probability&lt;/em&gt; of bit error (sometimes with other symbols, like $P_b$). A &lt;em&gt;rate&lt;/em&gt; implies experiment; the probability implies theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) $P(e)$ is a lower bound for the BER: since practice is messier than theory, the BER will be higher than $P(e)$ (assuming the theory is correct; that is, that it models reality properly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I'm not sure I understand the question. We always want $P(e)$ to be as low as possible, but it is ultimately bounded by the channel capacity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) If by &quot;below the theoretical&quot; you mean &quot;better than $P(e)$&quot;, I'd say something is wrong with your simulation or your assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 and 5) You use an equalizer when you have a wideband channel with intersymbol interference. Such a system will always have worse BER than a narrowband channel. The equalizer tries to eliminate the ISI; if the equalizer is perfect, the BER of the wideband system will be the same as that of a narrowband channel, assuming equal $E_b/N_0$. In practice, the equalizer will not be perfect. In this case, theory can help predict the equalizer's performance, and how much BER improvement to expect.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-28T02:07:08.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26706" PostTypeId="1" AcceptedAnswerId="26838" CreationDate="2015-10-28T02:58:41.130" Score="0" ViewCount="319" Body="&lt;p&gt;I have two small radar sensors that use 25 MHz. From each sensor I get the sent signal and received signal (Doppler effect). I know that I can use the FFT, use a window, or FIR filter, take the inverse, and get the frequency within that window. Thus I can analyze the signals separately. I'll have two plots. The radars can be positioned in 3D space at different points, but they can be pointed at the same point in space or at different points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to combine the two signals to analyze motion? For example if one sensor is pointed at the cheek and the second sensor is pointed at the chin, can I somehow average the signals to get one signal that represents the observation of the cheek and the chin? Can I average the two separate plots together?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or say we had a spinning top. One sensor is on the right and another on the left. If the top leans right the sensor on the right gets less of a time delay and the sensor on the left gets a longer time delay for the received signal. Thus using the information from both I can tell at what angle the top is spinning hypothetically because speed is distance over time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help, math equations or references would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="18003" LastEditorUserId="11256" LastEditDate="2015-10-28T12:39:34.887" LastActivityDate="2015-12-03T14:25:41.220" Title="Combining two separate radar signals?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26707" PostTypeId="1" CreationDate="2015-10-28T04:15:26.767" Score="4" ViewCount="184" Body="&lt;p&gt;I understand that mathematical motivation  behind Bayesian Information Criterion (BIC), Minimum description length (MDL), Akaike information criterion (AIC) are different but I am assuming that there are several applications where all three are equally applicable. I am interested to know the applications of  these algorithm in as many areas as possible. I can only guess that it is used in estimation of number of targets in radar. But I can also imagine that such a general concepts can be applied in many other problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;May I request to users of these algorithms to write a few lines on how they are using and are they using it in some products?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any comments would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="15437" LastEditorUserId="15437" LastEditDate="2015-10-29T20:48:31.430" LastActivityDate="2024-01-07T08:07:35.927" Title="Application of BIC, MDL, AIC" Tags="|image-processing|computer-vision|signal-detection|machine-learning|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26709" PostTypeId="2" ParentId="26689" CreationDate="2015-10-28T06:34:24.587" Score="-1" Body="&lt;p&gt;I believe you logic is reasonable. The fact that there are companies offering algorithms for long echo tail (even above 1 second) with reasonable performance indicates that an algorithm similar to your suggested logic can work.&lt;/p&gt;&#xA;" OwnerUserId="18008" LastActivityDate="2015-10-28T06:34:24.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26710" PostTypeId="2" ParentId="26702" CreationDate="2015-10-28T06:39:12.533" Score="1" Body="&lt;p&gt;The function &lt;code&gt;xcorr&lt;/code&gt; calculates the correlation of 2 signals.&lt;br&gt;&#xA;The correlation is known to be a good (The MLE) for delay estimation under Gaussian Noise.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, as can be seen in your data you're not using it in the cases it meant to be used.&lt;br&gt;&#xA;If we assume you have a model of a known signal with Additive White Gaussian Noise (AWGN or any other Additive White Noise), than the SNR is so terrible you can not expect it perform well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal model is additive deterministic signal (The signal [0 9 8 0 0 0 7 3 1 0] in that example) then you should look for a different approach (Though &lt;code&gt;xcorr&lt;/code&gt; can be part of it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tool you use, you must be aware for the model it was designed for.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-10-28T06:39:12.533" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26712" PostTypeId="2" ParentId="26702" CreationDate="2015-10-28T09:04:43.267" Score="4" Body="&lt;p&gt;It is usually useful to use normalized cross-correlation for finding position of small template on other longer signal. The value of normalized cross-correlation coefficient is invariant to change of amplitude and bias of signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;xcorr&lt;/strong&gt; function does not calculate normalized cross-correlation coefficient for vectors with unequal length. I prepare code snippet, which calculate normalized cross-correlation coefficient:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%prepare template Y and signal X&#xA;Y = [1 2 1];&#xA;X = [0 9 8 1 2 1 7 3 1 0];&#xA;&#xA;% calculation normalized cross-correlation&#xA;lngX = length(X);&#xA;lngY = length(Y);&#xA;assert(lngX &amp;gt;= lngY);&#xA;lags = 0:(lngX-lngY);&#xA;for i = lags&#xA;   c(i+1) = xcorr(X(i+1:i+lngY) - mean(X(i+1:i+lngY)), Y - mean(Y),0,'coeff');&#xA;end&#xA;[m,i]=max(c);&#xA;printf('max=%f, lag=%d\n',c(i),lags(i));&#xA;plot(lags,c,'-',lags(i),c(i),'*r');&#xA;text(lags(im)+4,c(im)-0.05,'max correlation', 'color','red');&#xA;xlabel('lags'); title('normalized cross-correlation'); grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; max=1.000000, lag=3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9tgAQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9tgAQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab's &lt;strong&gt;xcorr&lt;/strong&gt; does not calculate true normalized cross-correlation, so I add subtraction of mean value from signals before call to &lt;strong&gt;xcorr&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2&lt;/strong&gt;&#xA;I modify my code to demonstrate more interesting example of template and signal. Part of code for calculation normalized cross-correlation is the same.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%prepare template Y and signal X&#xA;Y = exp(-((1:40)-20).^2/20.).*cos(((1:40)-20)*2*pi/10);&#xA;Y2 = exp(-((1:100)-50).^2/100.);&#xA;X = [zeros(1,40) 2*Y zeros(1,10) 3*Y2 zeros(1,10)];&#xA;noise=1.;&#xA;X=X+noise*(rand(1,length(X))-0.5);&#xA;&#xA;% calculation normalized cross-correlation&#xA;lngX = length(X);&#xA;lngY = length(Y);&#xA;assert(lngX &amp;gt;= lngY);&#xA;lags = 0:(lngX-lngY);&#xA;for i = lags&#xA;   c(i+1) = xcorr(X(i+1:i+lngY) - mean(X(i+1:i+lngY)), Y -     mean(Y),0,'coeff');&#xA;end&#xA;[m,im]=max(c);&#xA;printf('max=%f, lag=%d\n',c(im),lags(im));&#xA;&#xA;%plotting&#xA;subplot(2,1,2);&#xA;plot(lags(im)+1:(lngY+lags(im)),Y,'r','linewidth',2,1:lngX,X,'b');&#xA;legend('template','signal'); grid on;&#xA;subplot(2,1,1);&#xA;plot(lags,c,'-',lags(im),c(im),'*r');&#xA;text(lags(im)+4,c(im)-0.05,'max correlation', 'color','red');&#xA;xlabel('lags'); title('normalized cross-correlation'); grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max=0.905503, lag=40&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GS7eq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GS7eq.png&quot; alt=&quot;normalized cross-correlation&quot;&gt;&lt;/a&gt;   &lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2017-03-06T09:18:38.700" LastActivityDate="2017-03-06T09:18:38.700" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26713" PostTypeId="2" ParentId="26232" CreationDate="2015-10-28T11:40:50.137" Score="0" Body="&lt;p&gt;I think the way to go is to rethink your approach in merging these images. I believe you already tried &lt;a href=&quot;https://en.wikipedia.org/wiki/Tone_mapping&quot; rel=&quot;nofollow&quot;&gt;tonemapping&lt;/a&gt; and/or exposure fusion in opencv.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need is a some type of mapping function. Ex. for each pixel location Vout = Vin / ((n * 255)+1) where n is the number images and 255 is the max possible value that a pixel can get in an image. Vin is the total pixel value for the specific pixel location (sum of all the values of a pixel location in each image). Vout is the value for the specific pixel location for the resulting image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find a nice list of tonemapping approaches in &lt;a href=&quot;http://cadik.posvete.cz/tmo/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to continue with your old approach, there is not much answer where you should write your own normalization function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One idea that comes to my mind is to get small kernels inside the regions and find their average illumination relationships and try to preserve them after you merge them.&lt;/p&gt;&#xA;" OwnerUserId="10237" LastEditorUserId="10237" LastEditDate="2015-10-28T12:57:24.577" LastActivityDate="2015-10-28T12:57:24.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26717" PostTypeId="1" CreationDate="2015-10-28T16:27:11.460" Score="0" ViewCount="39" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/btqFm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/btqFm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;I am trying to perform analysis of DICOM ultrasound images that have vascular flow rates.  I am a new user to MATLAB, and I am trying to generate a line to fit the flow curve and calculate an area under the curve.  Any resources would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="18027" LastEditorUserId="18027" LastEditDate="2015-10-28T19:51:37.570" LastActivityDate="2015-10-28T19:51:37.570" Title="DICOM Processing" Tags="|image-processing|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26718" PostTypeId="2" ParentId="8001" CreationDate="2015-10-28T16:35:40.460" Score="-1" Body="&lt;p&gt;A system is said to be unstable if its output is infinite for an applied finite input signal.&lt;/p&gt;&#xA;" OwnerUserId="18028" LastEditorUserId="11256" LastEditDate="2015-10-28T17:33:20.333" LastActivityDate="2015-10-28T17:33:20.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26719" PostTypeId="1" CreationDate="2015-10-28T22:04:07.363" Score="4" ViewCount="777" Body="&lt;p&gt;Considering simple 1st order exponentially weighed moving average (EWMA) filters of form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = \alpha x[n] + (1-\alpha) y[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is the effective alpha of 2 cascaded EWMA IIR filters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe I'm asking the wrong question, but not having a lot of luck Googling for the answer&lt;/p&gt;&#xA;" OwnerUserId="18030" LastEditorUserId="8202" LastEditDate="2015-10-28T22:23:35.693" LastActivityDate="2017-07-02T15:41:58.603" Title="What is the effective alpha of 2 cascaded EWMA IIR filters?" Tags="|filters|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26721" PostTypeId="1" CreationDate="2015-10-29T00:41:09.723" Score="10" ViewCount="42815" Body="&lt;p&gt;So I've been searched online and can't seem to find a clear cut answer to this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my understanding, the Nyquist rate is double of the maximum frequency of a signal which Nyquist frequency is half of the Nyquist rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which would conclude that Nyquist rate is the lower bound of sampling and Nyquist frequency would be the upper bound where Nyquist rate is where you can preserve the original signal and anything in between the Nyquist rate to Nyquist frequency would cause some aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="18032" LastEditorUserId="13320" LastEditDate="2016-11-21T12:37:21.250" LastActivityDate="2017-09-03T21:47:41.743" Title="Difference between Nyquist rate and Nyquist frequency?" Tags="|sampling|nyquist|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26722" PostTypeId="1" AcceptedAnswerId="26781" CreationDate="2015-10-29T00:52:31.730" Score="0" ViewCount="490" Body="&lt;p&gt;Hello signal processing wizards.  I am young and feeble, and would like some help interpreting my spike-train autocorrelograms of six isolated neurons.  These histograms were created using the code pasted below (hist(k)).  Rather than creating an autocorrelation of the actual spike trains, this code correlates interspike intervals (see the following post for another example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stats.stackexchange.com/questions/148865/how-to-interpret-this-autocorrelogram-graph&quot;&gt;https://stats.stackexchange.com/questions/148865/how-to-interpret-this-autocorrelogram-graph&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am glad to have gotten the code working, but now I am struggling to interpret what the histogram actually means.  I am aware that the Y-axis shows how strongly the signal is correlated with itself at a particular lag (the X-axis).  However, I am not certain how I can relate these findings to the firing pattern of the neuron.  For instance, if I see a peak at say, ~ 750 ms, does this mean that with a lag time of 750 ms, the firing pattern is more constant/predictable, or does it simply mean that I have more inter-spike intervals of 750 ms?  If someone could clear up my confusion, that would be much appreciated.  On a related note, if anyone has any tips on how to choose an appropriate bin size and window, that would be awesome.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. The X axis ranges from -1000 ms to 1000 ms.  Bin size is currently set to 50 ms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gRIXP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gRIXP.png&quot; alt=&quot;Autocorrelograms of spike-trains&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time_of_spike= sparse([],[],[],1,tmax/dt);&#xA;&#xA;clus_ms_Mult_10 = round((clusterTimes*10));%cluster time-stamps were in ms&#xA;&#xA;while index &amp;lt; length(clusterTimes);&#xA;    time_of_spike(clus_ms_Mult_10(index))=1;&#xA;    index=index+1;&#xA;end&#xA;&#xA;% % %finding the interspike intervals matrix&#xA;I=find(time_of_spike)/10;&#xA;i=size(I,2);&#xA;for m=1:i&#xA;    for n=1:i&#xA;        ISI(m,n)=(I(m)-I(n));&#xA;    end&#xA;end&#xA;&#xA;%calculating the autocorrelation&#xA;b=1;&#xA;clear k;&#xA;for i= MIN:1:MAX&#xA;    k(b)=size(find(ISI(:,:)&amp;gt;=i &amp;amp; ISI(:,:)&amp;lt;=i+50),1);%if i want to change &quot;bin&#xA;                                                    %size&quot;, I can change i+1 to i+largerInt&#xA;    b=b+1;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17898" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2015-10-31T15:37:47.250" Title="How do I interpret these autocorrelograms?" Tags="|autocorrelation|statistics|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26723" PostTypeId="2" ParentId="26721" CreationDate="2015-10-29T01:12:31.153" Score="18" Body="&lt;p&gt;Harry Nyquist invented/discovered/proved a lot of things; it can be hard to keep track of them all. The three most important for signal processing and communications are probably these:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you sample a (real) signal $s(t)$ at $f_s&amp;gt;2B$ samples per second, then $s(t)$ can be reconstructed from its samples, where $B$ is the bandwidth of $s(t)$. The lower bound $2B$ is often called the Nyquist rate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you sample a signal $s(t)$ at $f_s$ samples per second, then $f_N=f_s/2$ is frequently called the Nyquist frequency (also folding frequency). All frequencies in $s(t)$ higher than $f_N$ will be aliased back to a frequency between 0 and $f_N$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assume you have a baseband channel of bandwidth $B$ (that is, signals with bandwidth $B$ or less are not distorted by the channel). This channel allows transmission of a maximum of $2B$ orthogonal pulses per second. $2B$ in this context is also called the Nyquist rate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-10-29T01:12:31.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26724" PostTypeId="1" CreationDate="2015-10-29T01:29:28.040" Score="0" ViewCount="90" Body="&lt;p&gt;The original problem was from this &lt;a href=&quot;https://dsp.stackexchange.com/questions/26433/use-matlab-to-restore-the-signal-from-a-given-degraded-signal-using-tikhonov-reg&quot;&gt;link&lt;/a&gt; about coding de-noising an audio signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because my reputation points disabled me to comment, I have to ask a separate question here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't quite understand the codes about formulating a circulant matrix. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Enforcing size to match Convolution using 'same' property&#xA;mBlurKernel     = mBlurKernel(1:numSamples, :);&#xA;mGradientKernel = mGradientKernel(1:numSamples, :);&#xA;% Enforcing Circulant Matrix (Like DFT Based Convolution)&#xA;mBlurKernel(1, (end - 3):end) = vBlurKernel(1:4);&#xA;mBlurKernel(2, (end - 2):end) = vBlurKernel(1:3);&#xA;mBlurKernel(3, (end - 1):end) = vBlurKernel(1:2);&#xA;mBlurKernel(4, (end - 0):end) = vBlurKernel(1:1);&#xA;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What's the meaningfulness of doing the following steps? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mBlurKernel     = mBlurKernel(1:numSamples, :);&#xA;mGradientKernel = mGradientKernel(1:numSamples, :);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Originally, I thought it was to match the matrix dimension of both mBlurKernel and mGradientKernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I tried the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h = 10;&#xA;a = [1 2 3 4 5];&#xA;b = [1 2];&#xA;A1 = convmtx(a, h);&#xA;A2 = convmtx(b, h);&#xA;size(A1) = 10 14&#xA;size(A2) = 10 11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next, I tried to imitate the following steps:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A3 = A1(1:h, :);&#xA;A4 = A2(1:h, :);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It turned out that nothing happen to A3 and A4. It seems that A3 and A4 are the same as A1 and A2 respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, I don't understand the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Enforcing size to match Convolution using 'same' property&#xA;mBlurKernel     = mBlurKernel(1:numSamples, :);&#xA;mGradientKernel = mGradientKernel(1:numSamples, :);&#xA;% Enforcing Circulant Matrix (Like DFT Based Convolution)&#xA;mBlurKernel(1, (end - 3):end) = vBlurKernel(1:4);&#xA;mBlurKernel(2, (end - 2):end) = vBlurKernel(1:3);&#xA;mBlurKernel(3, (end - 1):end) = vBlurKernel(1:2);&#xA;mBlurKernel(4, (end - 0):end) = vBlurKernel(1:1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why must I do so in order to enforce a circulant matrix? Is there another way for me to enforce a circulant matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll appreciate if someone could clarify my doubts.&lt;/p&gt;&#xA;" OwnerUserId="17914" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-11-13T12:56:00.557" Title="Enforcing size to match Convolution using 'same' property &amp; Enforcing Circulant Matrix (Like DFT Based Convolution)" Tags="|matlab|audio|convolution|deconvolution|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26725" PostTypeId="1" AcceptedAnswerId="26748" CreationDate="2015-10-29T04:15:40.207" Score="0" ViewCount="3470" Body="&lt;p&gt;I have read a lot about ICA. I think I could not find the answer that why non-Gaussian Variables are independent.  What I understand, Central Limit Theorem states that  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;distribution of sum of independent variable tends toward more Gaussian than its original random variables.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$&#xA;s_i &#xA;$ are the number of original independent sources in ICA; whereas ICA model is $x=As$. So we can define $y=w^Ts$. The main goal is to find the unmixing matrix $w$ that maximize the non-Gausaanity. So my question is what is non-Gaussanity here and why its necessary to maximize it to extract the original sources.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Enlightenment Please!&lt;/p&gt;&#xA;" OwnerUserId="18033" LastEditorUserId="18033" LastEditDate="2015-10-29T13:14:37.207" LastActivityDate="2018-08-20T21:06:00.170" Title="Why non gaussian variables are independent" Tags="|ica|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26726" PostTypeId="1" AcceptedAnswerId="26753" CreationDate="2015-10-29T05:11:26.567" Score="1" ViewCount="312" Body="&lt;p&gt;I have an image of bricks of different sizes. What I want to do is when I click on the corner of the brick it should mark the lines around the brick. Can anyone please help me how can I do that...&#xA;here is the image&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1UA1m.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1UA1m.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16293" LastActivityDate="2015-10-29T23:33:11.217" Title="selecting bricks from image" Tags="|image-processing|matlab|image-segmentation|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26727" PostTypeId="1" CreationDate="2015-10-29T05:28:41.220" Score="0" ViewCount="2170" Body="&lt;p&gt;Let $x(t) = 0.4 + 0.5 \cos (2 \pi f_1 t) + 2 \cos (2\pi f_2 t) + \sin(2 \pi f_2 t) + 1.5 \cos(2\pi f_3 t)$ where $f_1 = 3 kHz, f_2 = 5 kHz, f_3 = 8 kHz$. If $x[n]$ is obtained by sampling $x(t)$ with a sampling frequency of $f_s = 16 kHz$ what is the minimum number of data points needed for a DFT in order to resolve all the frequencies without spectrum leakage?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me in the right direction on this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;UPDATE&lt;/em&gt; work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $f_s = 16000, T_s = \frac{1}{16000}$, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  x(t) &amp;amp;= 0.4 + 0.5 \cos (2 \pi f_1 t) + 2 \cos (2\pi f_2 t) + \sin(2 \pi f_2 t) + 1.5 \cos(2\pi f_3 t) \\&#xA;  x[n] &amp;amp;= 0.4 + 0.5 \cos (2 \pi \frac{3}{16} n) + 2 \cos (2\pi \frac{5}{16} n) + \sin(2 \pi \frac{5}{16} n) + 1.5 \cos(2\pi \frac{1}{2} n) \\&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete periods would be $\frac{16}{3}, \frac{16}{5}, 2$, right?&lt;/p&gt;&#xA;" OwnerUserId="17901" LastEditorUserId="17901" LastEditDate="2015-10-29T15:46:35.697" LastActivityDate="2015-10-29T15:46:35.697" Title="Minimum number of data points needed for a DFT to avoid spectrum leakage?" Tags="|sampling|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26728" PostTypeId="2" ParentId="25358" CreationDate="2015-10-29T06:38:40.933" Score="1" Body="&lt;p&gt;I think your workflow should be something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Detect the rectangle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Find the rectangle's orientation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Rotate the rectangle and place it in a new image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Feed the rectangle twice to an OCR &#xA;(one time with the calculated orientation, and the other with the rectangle rotated 180 degrees, because you are not sure if it's oriented correctly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Find which OCR output makes more sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) Voila!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More Details:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Check this OpenCV tutorial to detect simple shapes (in your case the rectangle)&#xA;&lt;a href=&quot;http://opencv-code.com/tutorials/detecting-simple-shapes-in-an-image/&quot; rel=&quot;nofollow&quot;&gt;http://opencv-code.com/tutorials/detecting-simple-shapes-in-an-image/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) if you use the previous tutorial, you have the four edges of the rectangle.&#xA;calculate the angle between the longest edge and the x-axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) I don't know the level of your image processing skills, but rotating a rectangle's pixels and putting it in another image should be straight forward (I suggest using linear interpolation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) I don't have much experience in OCR, but according to many answers here on the exchange, I guess you can use an off-the-shelf OCR.&lt;/p&gt;&#xA;" OwnerUserId="18025" LastActivityDate="2015-10-29T06:38:40.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26730" PostTypeId="1" CreationDate="2015-10-29T08:22:41.047" Score="0" ViewCount="2080" Body="&lt;p&gt;I have three information about a low-pass FIR filter. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;pass-band edge frequency &lt;/li&gt;&#xA;&lt;li&gt;pass-band ripple  &lt;/li&gt;&#xA;&lt;li&gt;stop-band ripple &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I want to get the &lt;strong&gt;stop-band edge frequency&lt;/strong&gt; I've been googling for the last hour to find a formula to get, but without success . &#xA;can any tell me how can I calculate it if have those 3 values ? &#xA;thanks in advance &lt;/p&gt;&#xA;" OwnerUserId="1785" LastEditorUserId="80" LastEditDate="2016-04-28T17:57:31.290" LastActivityDate="2016-04-28T17:57:31.290" Title="calculating the stop-band edge frequency of a low-pass FIR" Tags="|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26731" PostTypeId="2" ParentId="26182" CreationDate="2015-10-29T09:06:36.663" Score="1" Body="&lt;p&gt;Calibrate your cameras with the same world coordinate system. Use the same checkerboard and take images at the same time with both cameras.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After you have your extrinsic matrices for each camera, you can use this answer &lt;a href=&quot;https://math.stackexchange.com/a/83578&quot;&gt;here&lt;/a&gt; where you need to solve the equation for the position of each camera center in world coordinate system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can calculate the distance between two coordinates.&lt;/p&gt;&#xA;" OwnerUserId="10237" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-10-29T09:06:36.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26732" PostTypeId="1" CreationDate="2015-10-29T09:10:12.940" Score="1" ViewCount="827" Body="&lt;p&gt;In my project, there is a possibility of either buying one expensive IMU or 5 cheaper IMUs. They have to be cheaper due to budget limitations, and the idea is to use them in order to be able to do &quot;voting&quot; - i.e. vote out outlier measurements of one IMU if 4 other IMUs show a different reading - and also for redundancy. &lt;strong&gt;Question&lt;/strong&gt;: does anybody know if 5 cheaper IMUs (on the order to 300 dollars each) can create a signal at least as smooth, via sensor fusion, as one expensive IMU (on the order of 1500 dollars)? &lt;/p&gt;&#xA;" OwnerUserId="17640" LastActivityDate="2016-06-05T14:50:06.577" Title="Multiple cheap IMUs vs one expensive IMUs" Tags="|filters|filter-design|sensor|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26733" PostTypeId="2" ParentId="26730" CreationDate="2015-10-29T09:14:26.640" Score="1" Body="&lt;p&gt;The question is what you really want to do. Because the answer to your question is that there is no way to exactly compute the stopband edge from the three values you have. Looking at your specs I guess you're talking about a Parks-McClellan equiripple FIR filter, for which there are heuristic formulas relating the width of the transition band and the maximum ripple to the filter order (see &lt;a href=&quot;https://dsp.stackexchange.com/questions/20514/what-is-the-relation-of-the-transition-bands-width-and-the-filter-order-for-the/20515#20515&quot;&gt;this&lt;/a&gt; answer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually in a design problem the passband and stopband edges would be given, and the maximally allowable error (ripple) would be given also, and you would need to figure out (by trial and error and/or by some heuristic formulas) what the required filter order would need to be. The problem you asked about doesn't occur in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a last comment, &lt;em&gt;if&lt;/em&gt; you were given the actual filter coefficients then, by definition, the stopband edge is of course the lowest frequency for which the filter's magnitude response equals the given stopband ripple value (for a low pass filter, that is).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-10-31T09:41:42.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26734" PostTypeId="2" ParentId="26727" CreationDate="2015-10-29T09:28:52.910" Score="3" Body="&lt;p&gt;What you're actually asked to do is find the periods of the discrete-time sinusoids, and choose a DFT-length, such that all sinusoids occur an integer number of periods inside that window, hence no spectral leakage will occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I leave it as an exercise for you to determine the periods of the sampled sinusoids, but the end result of the DFT looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qmpjb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qmpjb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that all frequencies are clearly resolved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem (mentioned in the comments) of one sinusoid being located at exactly the Nyquist frequency (half the sampling rate) is not relevant for this toy example, even though in practice it is. What it means is that that sinusoid cannot generally be reconstructed uniquely. However, in your DFT you can see that there's a component at that frequency, and that's all they asked for.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-29T09:28:52.910" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26736" PostTypeId="2" ParentId="26732" CreationDate="2015-10-29T09:42:07.217" Score="2" Body="&lt;p&gt;That really will depend on the variance (standard deviation) of the measurements you get from the five vs the one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose your expensive IMU gives a measurement distributed as:&#xA;$$&#xA;x_\mbox{expensive}  \sim  N\left(x_\mbox{truth}, \sigma^2_\mbox{expensive}\right)&#xA;$$&#xA;and suppose your cheaper ones give measurements distributed as:&#xA;$$&#xA;x_\mbox{cheap}^i  \sim  N\left(x_\mbox{truth}, \sigma^2_\mbox{cheap}\right)&#xA;$$&#xA;for $i=1\ldots 5$ and that you form the average of these cheaper measurements to get the &quot;real&quot; measurement:&#xA;$$&#xA;\hat{x} = \frac{1}{5} \sum_{i=1}^5 x_\mbox{cheap}^i&#xA;$$&#xA;then $\hat{x}$ is distributed as:&#xA;$$&#xA;\hat{x} \sim  N\left(x_\mbox{truth}, \frac{\sigma^2_\mbox{cheap}}{5}\right)&#xA;$$&#xA;So if &#xA;$$&#xA;\frac{\sigma^2_\mbox{cheap}}{5} \le \sigma^2_\mbox{expensive}&#xA;$$&#xA;you should be OK with the cheaper sensors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, there may be other problems with your cheaper sensors: they may be biassed (so that the mean of their distributions will all be different from $x_\mbox{truth}$ ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I'm not quite sure what you mean by &quot;voting&quot;? Do you vote off the one furthest from the mean of the 5?  What if the mean changes for the remaining four?  I'll do a bit more digging to see if there's a viable algorithm there, but the direct mean of all five might be the easiest.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-29T09:42:07.217" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26738" PostTypeId="1" CreationDate="2015-10-29T10:32:25.113" Score="0" ViewCount="540" Body="&lt;p&gt;Does anyone know if there is a limitation in the KissFFT library with regards to the relationship between FFT size and the frame size used(number of samples as input/output)? I'm trying to implement 75% overlap add and it works only if the segment size is half of the FFT size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards,&#xA;Naveen &lt;/p&gt;&#xA;" OwnerUserId="18014" LastActivityDate="2016-04-27T09:33:02.553" Title="KissFFT library" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26740" PostTypeId="2" ParentId="26726" CreationDate="2015-10-29T12:10:25.027" Score="0" Body="&lt;p&gt;I think you don't need to find the edges in this specific case. I order to select a brick you need to have some kind of representation such as, making whole brick'white or 1' and the gaps between two brick 'black/ 0'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I processed the given image by first converting to RGB to BW and then adjust the contrast. After then I tried to  make the new image as I mentioned above by viewing the pixel values. example code is attached ; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope other people in this group may help you better than me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BR&#xA;FF&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PbjYc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PbjYc.png&quot; alt=&quot;Image contrast&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18041" LastActivityDate="2015-10-29T12:10:25.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26741" PostTypeId="2" ParentId="26726" CreationDate="2015-10-29T12:20:46.540" Score="0" Body="&lt;p&gt;&lt;strong&gt;Code for the above figure;&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i=1:2112  % (image rows)&#xA;    for j=1:2816  % (image cols)&#xA;        if contrastAdjusted(i,j) &amp;lt; 110&#xA;            ff(i,j) = 1;&#xA;        else&#xA;            ff(i,j) = 0;&#xA;        end&#xA;    end&#xA;end&#xA;imshow(ff);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="18041" LastEditorUserId="1849" LastEditDate="2015-10-29T13:59:53.557" LastActivityDate="2015-10-29T13:59:53.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26742" PostTypeId="1" CreationDate="2015-10-29T13:24:00.890" Score="1" ViewCount="656" Body="&lt;p&gt;I am rather new to the polyphase structure and thought I had understood, but apparently I havent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is I guess very simple: what is the commutator at the input of a polyphase decimator? Is it a memory-less switch or doe it have memory at each phase output of the commutator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More explicitly: assuming I have a polyphase decomposition of 2 phases. So that I have the P0(z) and P1(z). Assume we are at time t=0 so that the commutator is at position 0 and at this time the input of P0(z) is some value x[0]. Between t=0 and t=1, P0(z) should  be computed. at time t=1 the commutator switched and P1(z) (x[1] as input) should compute between t=1 and t=2. So here is where I am not understanding. Between t=1 and t=2 what happens to the INPUT to P0(z)? Is it 0 (as in the commutator is a simple switch without memory) or is the the previous value seen at t=0 (i.e. x[0]).&lt;/p&gt;&#xA;" OwnerUserId="18043" LastActivityDate="2016-01-05T02:22:10.123" Title="Polyphase Commutator" Tags="|multirate|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26743" PostTypeId="1" CreationDate="2015-10-29T14:37:15.767" Score="1" ViewCount="640" Body="&lt;p&gt;I collected high magnification images on cell nuclei and I need to segment them (red circle in the image). The edges of the nuclei are visible but inside each nuclear object there are bright spots of positive signal (Not an imaging artefact, if I will retake the images it will be the same).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vxqqu.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vxqqu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested different way to segment the image (using python scripts based on scikit-image, scipy.ndimage and opencv):&#xA;- Threshold-&gt;morphology (close/opening)-&gt; watershed (after gaussian filtering or median filtering to try to remove the dots)&#xA;- Graph-cuts (Al-Kofahi algorithm implemented in the Farsight package: &lt;a href=&quot;https://github.com/gbkedar/farsight&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/gbkedar/farsight&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the methods lead to oversegmentation because of the internal bright spots.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve that I thought was a good idea to isolate the dots with a laplacian of gaussian and used the opencv function cv.inpaint to fill the dots with the intensity of the surrounded pixel values. The result was not good either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The questions are:&#xA;- Do you think that the best strategy is to isolate the bright dots and then try to replace them with the surrounding signal?&#xA;- Any strategy that will lead to a better result? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be greatly appreciated&lt;/p&gt;&#xA;" OwnerUserId="18042" LastActivityDate="2022-08-06T09:02:25.217" Title="Segment highly packed nuclei with dotted high intensity signal inside each object" Tags="|image-processing|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26744" PostTypeId="1" CreationDate="2015-10-29T14:53:05.797" Score="0" ViewCount="350" Body="&lt;p&gt;I am using MATLAB to evaluate power spectral density estimates of half second EEG signals, using modified covariance method. Can anyone suggest me how to select the AR model order for this process? Is there any function in MATLAB which can be used for selecting the best order using any model order selection techniques?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot for your help.&lt;/p&gt;&#xA;" OwnerUserId="17278" LastActivityDate="2016-04-26T18:19:46.160" Title="AR model order selection for half second EEG fragments" Tags="|dsp-core|control-systems|eeg|autoregressive-model|stochastic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26745" PostTypeId="2" ParentId="26744" CreationDate="2015-10-29T15:15:43.383" Score="1" Body="&lt;p&gt;Do you want to select the model order adaptively based on the content of the input EEG, or choose the AR order as a design parameter for a system that will always be the same?. In the second case (not adaptive), maybe if you have some sample EEGs you could try a a lot of models from order = 0, to some number N (large enough but not so that running all the models takes forever). And Graph the Error between the EEG signal and white noise filtered by the model. You should arribe at a graph or Error vs order. At some value of N the error only marginally decreases. That is your model order.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/ident/ref/aic.html&quot; rel=&quot;nofollow&quot;&gt;Matlab offers AIC and others.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="80" LastEditDate="2016-04-26T18:19:46.160" LastActivityDate="2016-04-26T18:19:46.160" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26747" PostTypeId="1" CreationDate="2015-10-29T15:32:13.370" Score="9" ViewCount="298" Body="&lt;p&gt;I would like to understand how far the assumption of having i.i.d. is accurate/valid (from the practical point of view) when an OFDM system is working in Rayleigh channels. Is this means the channel has to encounter flat and slow fading? If not, under what conditions, the assumption of i.i.d. can be considered practically acceptable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints?&lt;/p&gt;&#xA;" OwnerUserId="15078" LastEditorUserId="1606" LastEditDate="2015-10-29T18:01:44.713" LastActivityDate="2017-04-28T13:55:17.563" Title="Practicality of the assumption of i.i.d. for Rayleigh channels" Tags="|digital-communications|ofdm|fading-channel|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26748" PostTypeId="2" ParentId="26725" CreationDate="2015-10-29T15:41:25.857" Score="4" Body="&lt;p&gt;The model ICA uses says that there exist some unknown, statistically independent sources, $s_i$ that are non-normally distributed (their distributions are something other than Gaussian):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s_i \sim S(\mu_{s_i}, \sigma^2_{s_i})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $S$ is some (possibly) known but non-Gaussian distribution with mean $\mu_{s_i}$ and variance $\sigma^2_{s_i}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it is assumed that what you can actually measure is the addition of these:&#xA;$$&#xA;\mathbf{x} = \mathbf{A}\mathbf{s}&#xA;$$&#xA;where $\mathbf{s}$ is the vector of the $s_i, i=1,\ldots,N$, $\mathbf{A}$ is an $N\times N$ matrix (usually assumed to be invertible) and $\mathbf{x}$ is the vector of the actual measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the $x_i$ will just be weighted sums of the $s_i$:&#xA;$$&#xA;x_i = a_{i1} s_1 + a_{i2} s_2 + \cdots + a_{iN} s_N&#xA;$$&#xA;the central limit theorem says that the distribution of $x_i$ will be closer to Gaussian than the distribution of the $s_i$ (provided certain non-restrictive conditions on the true distribution of the $s_i$ are  met).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then all ICA really tries to do is to find a $\mathbf{W} = \mathbf{A}^{-1}$ the inverse of $\mathbf{A}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are any number of measures for &quot;non-Gaussianity&quot;.  &lt;a href=&quot;https://en.wikipedia.org/wiki/Independent_component_analysis#Projection_Pursuit_.5B6.5D&quot; rel=&quot;nofollow&quot;&gt;One of the simplest&lt;/a&gt; (?) is to use kurtosis as the measure of how far the sample of a random variable is from Gaussianity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to attempt to answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So my question is what is non-Gaussianity here and why its necessary to maximize it to extract the original sources.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are several different ways one could measure non-Gaussianity. For example, kurtosis can be used as it is known that the kurtosis of a Gaussian is 3. Any distribution with a kurtosis different from 3 is therefore &quot;non-Gaussian&quot; to some extent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason we want non-Gaussianity is because &lt;a href=&quot;https://en.wikipedia.org/wiki/Independent_component_analysis#Introduction&quot; rel=&quot;nofollow&quot;&gt;we assumed that the original sources are non-Gaussian.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-29T15:41:25.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26749" PostTypeId="2" ParentId="6260" CreationDate="2015-10-29T15:45:14.130" Score="2" Body="&lt;p&gt;My answer is based on this answer &lt;a href=&quot;https://dsp.stackexchange.com/a/15117/3573&quot;&gt;https://dsp.stackexchange.com/a/15117/3573&lt;/a&gt; by &lt;a href=&quot;https://dsp.stackexchange.com/users/80/peter-k&quot;&gt;https://dsp.stackexchange.com/users/80/peter-k&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is Octave code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.529411764705882 0.945098039215686 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.415686274509804 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.556862745098039 0.890196078431372 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.72156862745098 0.749019607843137 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.862745098039216 0.611764705882353 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.933333333333333 0.470588235294118 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];&#xA;plot(y);&#xA;title(&quot;Signal&quot;)&#xA;print -dpng signal.png&#xA;&#xA;autocorrelation=xcorr(y);&#xA;figure&#xA;plot(autocorrelation)&#xA;&#xA;[pks loc] = findpeaks(autocorrelation,'DoubleSided');&#xA;hold on&#xA;plot(loc,pks,'or')&#xA;title(&quot;Autocorrelation&quot;)&#xA;print -dpng autocor.png&#xA;&#xA;distance_between_peaks = diff(loc);&#xA;printf(&quot;Mean distance between peaks: %d\n&quot;,mean(diff(loc)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following figure is the plot of your signal &lt;code&gt;y&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LOVWJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LOVWJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following figure is the plot of the auto-correlation &lt;code&gt;xcorr(y)&lt;/code&gt; of your signal, the peaks are marked in red:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3Rw6a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Rw6a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then take the distances between the peaks locations (with &lt;code&gt;diff&lt;/code&gt;) and compute the mean distance, the script gives this output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Mean distance between peaks: 55.6667&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3573" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-10-29T15:45:14.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26750" PostTypeId="2" ParentId="24459" CreationDate="2015-10-29T17:55:10.393" Score="1" Body="&lt;p&gt;So here are the answers to the questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It's a good question. First, your calibration grid should somehow be &quot;coded&quot;. For example, the OpenCV checkerboard pattern is a rectangle and the points are sorted from upper left to lower right. This way, you find the exact correspondences between your 3D model and 2D points. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For multiple views, the origin doesn't matter. Think of it as taking multiple shots of a static calibration pattern and looking for best intrinsic matrix to project all. The poses (homographies) can vary, but the intrinsics stay the same. You would optimize for the intrinsics and later on for extrinsics. Use the relation:&#xA;$$H=A \left[ \begin{matrix} r_1 &amp;amp; r_2 &amp;amp; t \end{matrix}\right] \left[ \begin{matrix}  r_1 \\ r_2 \\ r_3 \end{matrix} \right]$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using the fact that the plane defuse it is still planar. You need 3D variations in your setup so that the linined by $r_3$ intersects the plane at infinity at a line, we can see that the other rotational components are two particular points on that line. If you compute the intersection of the first line with the absolute conic, you get rid of the pose parameters in the optimization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/zhang/Papers/TR98-71.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;check section 2.4, here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;You cannot simply use a big chessboard. You should have 3D variations in your setup so that the system is well conditioned and degeneracies do not occur. However, you could simply use a 3D calibration rig, and capture a single image (like Tsai does).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2018-03-20T13:00:12.913" LastActivityDate="2018-03-20T13:00:12.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26751" PostTypeId="1" CreationDate="2015-10-29T20:37:00.373" Score="1" ViewCount="331" Body="&lt;p&gt;Is a &quot;one unit shock&quot; in an impulse function of variable &quot;temperature&quot; a 1% increase or 1 more &quot;unit&quot; (1 degree)?&lt;/p&gt;&#xA;" OwnerUserId="18047" LastActivityDate="2015-10-29T20:37:00.373" Title="What is a &quot;Unit Shock&quot; in an Impulse Response Function?" Tags="|impulse-response|autoregressive-model|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26753" PostTypeId="2" ParentId="26726" CreationDate="2015-10-29T23:33:11.217" Score="1" Body="&lt;p&gt;Let me suggest a simple solution , however if you want to go for a more robust solution let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So first I would look for a way to enhance the signal. In my experience red objects appear even stronger if you look at red-green&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;diff = im(:,:,1) - im(:,:,2);&#xA;figure;imshow(diff,[]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MkJga.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MkJga.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Than I would use simple thresholding (choose threshold value manually ) to get a blackwhite image.&#xA;To make it more robust I would use some morphology operations like opening and filling. (If you dont know what that is I would look at  &lt;a href=&quot;http://www.mathworks.com/help/images/morphology-fundamentals-dilation-and-erosion.html#f18-24720&quot; rel=&quot;nofollow noreferrer&quot;&gt;matlab help&lt;/a&gt;.&#xA;Than finally you can select the brick with bwselect and take its perimeter with bwpeim.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Viola:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;diff = im(:,:,1) - im(:,:,2) ;&#xA;bw = diff &amp;gt; 35;&#xA;bw = imopen( bw , ones(1,5) );&#xA;bw = imopen( bw , ones(5,1) );&#xA;bw = imfill(bw , 'holes');&#xA;brick = bwselect(bw);&#xA;brick = bwperim(brick);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you can see a simple output here:&#xA;Please note that this is quite specific for this image but that's a good simple way to get you started.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jsX9K.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jsX9K.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2015-10-29T23:33:11.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26754" PostTypeId="1" CreationDate="2015-10-30T00:07:26.537" Score="0" ViewCount="857" Body="&lt;p&gt;I'm just beginning to learn about Fourier series and I'm trying to figure out how to find the Fourier series coefficients for $$x(t) = e^{j100\pi t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that $$x(t) = \sum_{-\infty}^{\infty} a_{k} e^{jk(2\pi/T)t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I go about finding the coefficient(s)? I know that I can get &lt;code&gt;T = 1/50&lt;/code&gt;, but beyond that I don't even know where to begin. I think I'm supposed to be able to do this just by looking at it without having to solve the integral equation for $a_k$, but I don't know what I'm supposed to be looking for. &lt;/p&gt;&#xA;" OwnerUserId="17602" LastActivityDate="2015-10-30T13:28:00.623" Title="Finding Fourier Series Coefficients" Tags="|fourier-series|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26756" PostTypeId="2" ParentId="26754" CreationDate="2015-10-30T05:13:09.293" Score="1" Body="&lt;p&gt;The answer is right there in the question. You have expressed the signal as linear sum of scaled complex exponentials. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the question is fourier series coefficients of a complex exponential$$e^{j100\pi t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can see from the summation of x(t) that you have mentioned in the question that there is only one fourier series coefficient $a_1$ with a fundamental frequency $\omega_0$ because there is only one complex exponential in the input.The value of $\omega_0$ is $$ 100\pi$$. So $f_0$ = $(100\pi)/(2\pi)$ = 50&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of $a_1$ is 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words you can express $$x(t)=(1).\ e^{(100 \pi)(1)t}$$ to see that  k=1 and $a_1$=1.&lt;/p&gt;&#xA;" OwnerUserId="4375" LastActivityDate="2015-10-30T05:13:09.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26757" PostTypeId="2" ParentId="26738" CreationDate="2015-10-30T06:19:26.717" Score="1" Body="&lt;p&gt;FFT takes in as many numbers as it churns out. What you are trying to do is in conflict with this so it's not KissFFT's fault. I've found KissFFT to work just as good as any other FFT library.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-10-30T06:19:26.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26758" PostTypeId="1" AcceptedAnswerId="26771" CreationDate="2015-10-30T10:08:33.140" Score="1" ViewCount="1023" Body="&lt;p&gt;I have been given a OFDM signal of crest factor of 12dB. The crest factor is the ratio of peak power to the average power of the signal. Does anyone have any idea how crest factor of 12dB is derived for an OFDM signal?(assumptions on peak power,average or RMS power etc). I would highly appreciate any input on this.&lt;/p&gt;&#xA;" OwnerUserId="17633" LastEditorUserId="1606" LastEditDate="2015-10-30T12:34:09.813" LastActivityDate="2015-10-30T20:54:32.483" Title="Crest Factor of OFDM signal" Tags="|signal-analysis|digital-communications|ofdm|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="26759" PostTypeId="2" ParentId="26719" CreationDate="2015-10-30T12:28:53.543" Score="3" Body="&lt;p&gt;It is important to define in what sense two cascaded EWMA filters should be &quot;equivalent&quot; to a single EWMA filter. One possibility would be to define an &quot;effective memory&quot; or &quot;effective averaging window size&quot; and say that the two filters are equivalent if they have that same effective memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second question to be answered is how to define the effective memory length of such a filter. Again we have to make a reasonable choice, and one possibility is to look at the filter's impulse response $h[n]$ and choose the length $N$ such that the sum over the first $N$ coefficients equals a certain percentage of the sum over all coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\sum_{n=0}^{N-1}h[n]}{\sum_{n=0}^{\infty}h[n]}=r,\quad 0\ll r&amp;lt;1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, we consider the coefficients with indices greater than $N$ negligible. The impulse response coefficients $h[n]$ are the weights to compute the output signal from the input signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=0}^{\infty}h[k]x[n-k]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the filter given in your question it can be shown that the impulse response is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=\alpha(1-\alpha)^n,\quad n\ge 0\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{\infty}h[n]=1\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}h[n]=1-(1-\alpha)^N\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $(4)$ and $(5)$, Eq. $(1)$ reduces to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1-(1-\alpha)^N=r\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, for a given percentage $r$, can be solved for either $\alpha$ or $N$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\alpha&amp;amp;=1-(1-r)^{1/N}\\&#xA;N&amp;amp;=\frac{\log(1-r)}{\log(1-\alpha)}\end{align}\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, e.g., with $r=0.9$ and $\alpha=0.1$, the effective averaging length is $N\approx 22$. Alternatively, for a desired length $N=100$, $\alpha$ must be chosen as $\alpha=0.023$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same calculations can be done for the cascade of two such filters, the only problem being that it is not possible to give analytical expressions analogous to Eq. $(7)$. However, the finite sum given in $(5)$ can be easily computed using the filter itself. If you cascade two EWMA filters and use a constant input $x[n]=1$, $n\ge 0$, the output will be the sum $(5)$. The first output sample is the sum for $N=1$, the next one for $N=2$, etc. So by this computation one can figure out the value of $N$ for a given percentage $r$. This value is given by the number of output samples necessary for the output to exceed the given value $r$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's time for an example. Let's again choose $r=0.9$, i.e. the effective memory size is define by the number of coefficients which add up to $90\%$ of the total sum of all coefficients. Let the two $\alpha$-values of the cascaded filters be $\alpha_1=0.1$ and $\alpha_2=0.2$. To find out its effective averaging length (at least according to our definition), we feed the filter with a constant input $x[n]=1$ until the output exceeds the value of $r=0.9$. The output is shown in the figure below. The output values are blue, and $r$ is shown by the red line.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lcUpZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lcUpZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effective averaging length $N$ turns out to be $N=27$. In order to find out which first order averaging filter has the same effective length, we need to compute $\alpha$ from Eq. $(7)$ for $N=27$ and $r=0.9$, which gives $\alpha=0.082$. Hence, in the above defined sense, we can say that two cascaded EWMA filters with $\alpha_1=0.1$ and $\alpha_2=0.2$ are equivalent to a single EWMA filter with $\alpha=0.082$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-30T12:28:53.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26760" PostTypeId="1" CreationDate="2015-10-30T12:55:34.887" Score="1" ViewCount="74" Body="&lt;p&gt;Consider a digital signal processing algorithm that operates over a block of $L$ [samples], with a real-time constraint $\tau$ [s] (i.e. its throughput must be $L/\tau$ [samples/s]). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The theoretical complexity of the algorithm is known, both in terms of arithmetic operations (additions, multiplications and comparisons) and memory accesses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any rule of thumb to get a (rough) estimate of the power consumption of this algorithm for typical hardware implementations (e.g FPGA, ASIC, General Purpose Processor, etc.)?&lt;/p&gt;&#xA;" OwnerUserId="17530" LastActivityDate="2015-10-30T12:55:34.887" Title="Estimating the power consumption of an arbitrary, real-time DSP algorithm" Tags="|discrete-signals|algorithms|dsp-core|real-time|hardware-implementation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26761" PostTypeId="2" ParentId="26754" CreationDate="2015-10-30T13:28:00.623" Score="1" Body="&lt;p&gt;The answer depends on what period you assume / assign the signal to have (i.e. what sampling rate you use ). As long as the ground frequency is divisible by $50$ you will get exactly one non-zero Fourier coefficient, the position being dependent on the quotient between 50 and the ground frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The special case Karan brings up above is the Fourier series with highest possible ground frequency still able to represent the function.&lt;/p&gt;&#xA;" OwnerUserId="18051" LastActivityDate="2015-10-30T13:28:00.623" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26762" PostTypeId="2" ParentId="26697" CreationDate="2015-10-30T13:59:25.677" Score="13" Body="&lt;p&gt;No Deep Learning isn't killing Image Processing. You need huge datasets and lots of computational resources to do deep learning. There are plenty of applications where it is desirable to be able to do image processing with less computational load and smaller memory footprints and without having access to huge databases. Some examples are mobile phones, tablets, mobile cameras, automobiles, quadcopters. Deep learning is very hyped right now as there exist some very impressive results to classification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classification is one problem out of many which Image Processing deals with so even if it were true that deep learning would solve all classification problems, there would be plenty of other types of Image Processing left to do. Noise reduction, image registration, motion calculations, morphing / blending, sharpening, optical corrections and transformations, calculating geometries, 3D estimation, 3D+time motion models, stereo vision, data compression and coding, segmentation, deblurring, motion stabilisation, computer graphics, all kinds of rendering.&lt;/p&gt;&#xA;" OwnerUserId="18051" LastEditorUserId="18051" LastEditDate="2015-10-30T14:14:19.877" LastActivityDate="2015-10-30T14:14:19.877" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="26763" PostTypeId="1" AcceptedAnswerId="26792" CreationDate="2015-10-30T15:04:46.517" Score="0" ViewCount="241" Body="&lt;p&gt;I have a line with known starting and ending 'x' and 'y' coordinates. I want to extrapolate three more between x and y points in MATLAB. I tried to find a lot but I couldn't get any help regarding extrapolate. Anyone please help me in this.&lt;/p&gt;&#xA;" OwnerUserId="16293" LastActivityDate="2016-08-20T20:42:15.640" Title="extrapolate three points between line" Tags="|image-processing|matlab|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26764" PostTypeId="1" AcceptedAnswerId="54596" CreationDate="2015-10-30T15:45:10.187" Score="3" ViewCount="150" Body="&lt;p&gt;I want to solve k-means-like problem. But at first, I wonder that we can apply subgradient method to k-means problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to find the optimal clustering $S = (S_1,S_2,...,S_k)$ such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ {\operatorname{arg\,min}}_S  \sum_{i=1}^{k} \sum_{\mathbf x \in S_i} \left\| \mathbf x - \boldsymbol\mu_i \right\|^2 $$&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="128" LastEditDate="2018-07-07T22:02:10.237" LastActivityDate="2022-03-13T11:30:54.177" Title="Subgradient Method for K-Means Like Problem" Tags="|classification|optimization|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26765" PostTypeId="1" CreationDate="2015-10-30T16:11:13.720" Score="2" ViewCount="1669" Body="&lt;p&gt;I have been designing and using IIR filters to process audio for a while now but want to design some FIR filters for delay equalization. I have done some preliminary work using the following approach:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I start with a desired &quot;group delay EQ&quot; curve. This starts at zero, and then has increasing delay at higher (audio) frequencies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I calculate the corresponding phase lag by integrating, using the definition of group delay. This is still on the audio log-frequency grid.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the next step, I interpolate the phase onto the equal-linear-spacing frequency grid that will be used for the discrete transform processing. I use 32768 samples for this step.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I then generate the real and imaginary components of the complex number that results for this phase angle, with the magnitude of the response equal to 1.0. I make sure that H(k) = H*(N-k). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I take the inverse DFT of the real and imaginary components to transform the response to the time domain. Although the output produces both a real and an imaginary component the imaginary component is essentially zero. The impulse is present in both short positive and negative times (at the beginning and end of the data set) but only spans about 20% of the full data set.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I set the imaginary component values all to zero. I manipulate the real component of the time domain response (the impulse), shifting it &quot;to the right&quot; to move the part of the impulse that is at small negative times (at the &quot;end&quot;) to positive time. I then apply a rectangular window to the data, setting everything outside the window to zero. From what I understand, the remaining non-zero values are the FIR filter coefficients.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To find out what the filter response will look like I perform the forward DFT on the shifted, windowed impulse to bring the data back into the frequency domain. I then calculate and plot the filter magnitude (SPL), the phase, and finally the group delay. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The above procedure seems to give me the FIR filter response that I want to achieve. I can see the tradeoffs in the frequency domain when I set fewer or more taps to zero. So my approach seems to be working. Now on to the implementation and questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I am new to FIR filtering, I am confused about the data sample rate and number of coefficients calculated above and how that factors in when I want to implement the FIR filter. I may either write my own code or use some existing code or package to perform the correlation between filter and audio data stream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A.&lt;/strong&gt; How will the number of bins that I use in the inverse DFT (step 5 above) influence the resulting filter? Will using more bins help to fit sharper features and vice versa? Is the number of bins usually optimized when designing a filter to keep the calculation overhead low when the filter is implemented?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;B.&lt;/strong&gt; I performed all the steps above assuming a sample rate of 48kHz. The only time that the sample rate came into play was when I calculated the frequencies of each bin (e.g., df) for the iDFT and DFT calculations. Given my final set of non-zero filter coefficients (obtained in step 6 above) is the filter simply (naively) calculated as &lt;code&gt;y(n) = SUM_over_m[h(m)*x(n-m)&lt;/code&gt;] where 'x' is a sample in my audio data stream at the same 48kHz sample rate? That seems too easy/simple... (I understand that a practical FIR filter implementation would not carry out the calculations in this way, but would use FFT, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What really puzzles me is this: any number of coefficients can be set to zero to approximate the filter, yet you may vary the number of bins in the iDFT/DFT operations (change resolution) and then truncate the resulting filters to the same number of taps. Is it correct that the coefficients would be different even if they are the same in number, and that the coefficient values are the only thing that is &quot;encoding&quot; the sample rate used in the filter design and the resolution that was chosen??? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me understand these concepts a little more clearly. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="18053" LastEditorUserId="80" LastEditDate="2015-10-31T20:03:29.610" LastActivityDate="2017-08-24T09:54:07.510" Title="FIR filter design and implementation - sample rate and number of taps" Tags="|filters|dft|dsp-core|finite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26766" PostTypeId="1" CreationDate="2015-10-30T17:42:03.440" Score="1" ViewCount="299" Body="&lt;p&gt;I have a total of 4 highly identical grayscale images, where image1 is taken as the reference image, the rest of the images are to be used to enhance image1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My objective is to enlarge the image to 2 times the original size. Instead of taking average values from neighbouring pixels to fill the upsampled pixels, is it possible to do inverse distance weighting interpolation, so that my image remains sharp?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My other concern is that I need to fill the upsampled pixels with the pixel values from the 3 other images. Is it possible to do interpolation with 4 input images?&lt;/p&gt;&#xA;" OwnerUserId="18055" LastActivityDate="2016-04-27T22:38:47.933" Title="Perform inverse distance weighting interpolation using multiple images matlab" Tags="|image-processing|matlab|interpolation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26767" PostTypeId="2" ParentId="26766" CreationDate="2015-10-30T18:16:59.003" Score="1" Body="&lt;p&gt;&lt;code&gt;imresize&lt;/code&gt; will enlarge your image, and it gives you a choice of nearest neighbor, bi-linear, or bi-cubic interpolation. As to using the other images for interpolation, you would have to write that yourself.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-10-30T18:16:59.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26768" PostTypeId="1" AcceptedAnswerId="26770" CreationDate="2015-10-30T20:03:11.950" Score="6" ViewCount="115" Body="&lt;p&gt;When we want to use classifiers like SVM, we first should extract descriptors using algorithms like SIFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have a question which might call a silly one: &#xA;Let's assume&#xA;$$&#xA;\begin {equation}&#xA;D_a=\{d_{a,1},d_{a,2},d_{a,3},...,d_{a,M}\}&#xA;\end {equation}&#xA;$$&#xA;where M is total number of descriptors and $d_{a,?}$ denotes the description vector of mth descriptors. &#xA;My question is: what the sentence &quot;$d_{a,?}$ denotes the description vector of m-th descriptors&quot; means? Does it mean that we have 1000 interest point in the image that each of them has ,let's say, a 128-dimension SIFT descriptors? Do we have 128000 values?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="128" LastEditDate="2019-10-03T23:48:12.527" LastActivityDate="2019-10-03T23:48:12.527" Title="What Is &quot;Description Vector&quot; in Image Processing?" Tags="|image-processing|image-segmentation|machine-learning|sift|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26769" PostTypeId="1" AcceptedAnswerId="26772" CreationDate="2015-10-30T20:09:46.093" Score="2" ViewCount="700" Body="&lt;p&gt;I am following the book: Blind equalization and Identification by Zhi Ding and Ye Li. In Chapter 2, the concept of T spaced equalizers is presented. It is mentioned that the output of the channel is $x[k] = \sum_{i=-\infty}^\infty h[i]s[k-i] + w[k]$ where $h$ is the impulse response, $s$ are the symbols / source input and $w[k]$ is iid noise. Then it is defined that *&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;When the channel is non-deal, its impulse response $h[k]$ has more&#xA;  than one nonzero component. Consequently, undesirable signal&#xA;  distrotion as the channel output $x[k]$ depends on multiple symbols in&#xA;  $\{s[k]\}$. This phenomenon is known as inter-symbol interference&#xA;  (ISI).&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;*&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand why the impulse response has to be zero when it is ideal channel - no ISI. If $h$ is zero then $h[i].s[k-i] = 0$ where $dot$ is the multiplication operator. Or am I mistaken and in the equation $h$ is convolved with $s$ and not multiplied and essentially impulse response will be zero for ideal channel. What is the concept and reason? I do know that convolution in time domain is equivalent to multiplication in frequency domain. But the above representation is in time domain. A brief explanation will work and then I can follow on from the key points mentioned in the answer. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="128" LastEditDate="2018-07-25T04:02:43.680" LastActivityDate="2018-07-25T04:02:43.680" Title="Concepts: Ideal and Non Ideal Channel Resulting in Inter Symbol Interference" Tags="|filters|convolution|digital-communications|self-study|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26770" PostTypeId="2" ParentId="26768" CreationDate="2015-10-30T20:36:07.313" Score="1" Body="&lt;p&gt;I think you have a matrix.&lt;br&gt;&#xA;Each Row / Column is a descriptor vector of a point in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just like having features, let's say M features, and each point has M values corresponding to M features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So each element in the descriptor vector is a value of specific feature for this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yes, if you have M = 128 Features and 1000 points you'll get a matrix with 128,000 entries.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-10-30T20:36:07.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26771" PostTypeId="2" ParentId="26758" CreationDate="2015-10-30T20:45:17.390" Score="1" Body="&lt;p&gt;In statistical case OFDM (without specific PAPR reduction precoding and with most of subcarriers used) signal could be modelled as white Gaussian process. So PDF of OFDM signal is well-known one for normal distribution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(x) = 1/(\sigma\cdot\sqrt{2\cdot\pi}) \cdot \exp(-(x-\mu)^2/(2\sigma^2))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For OFDM $\mu=0$. When we calculate crest factor we need to define the number of samples to be used for measurement. We say measurement for $1e+6$ samples is valid since crest factor doesn't increase significantly, when we take more values. In another words if we have e.g. $1e+2...1e+4$ samples, crest factor will vary from one measurement to another. But if we have a million of samples or more, crest factor of white noise or OFDM will converge to one specific value, it is about 13.5 dB. You can check it easily with MATLAB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be derived analitically with aid of PDF of normal distribution. Look, we need to estimate how much peak value exceeds $\sigma$ to estimate crest factor. If for example $1e+6$ samples are used the probability of peak value is $1e-6$. It is rought approximation. For normal distribution large peaks have low probabilty and it decreases with peak amplitude increase (see plot of normal distr. PDF). We need to estimate maximum peak for million samples, so it is one peak for million and its probabilty is $1e-6$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation to be solved is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P(x)=\int_x^\infty f(x)dx = 1e-6$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f(x)$ is presented above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid infinite integration we can roughtly simplify (forgive me, mathematicians!) this equation to something like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f(x) \le P(x) = 1e-6$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By usign $f(x)$ instead of $P(x)$ and solving this equation for different $\sigma$ we can find out that $4.5\sigma \le x \le 5\sigma$ in general. The creast factor could be find as $20\cdot\log_{10}(x/\sigma)\approx 13...14$. The result is very similar to what we can observe in practice. It can be more accurate if someone suggest the way to approximate $\int_x^\infty f(x)dx$ term in the original equation (I believe it could be done since $f(x)$ is decreasing in the interval from $x$ to $\infty$).&lt;/p&gt;&#xA;" OwnerUserId="10374" LastEditorUserId="10374" LastEditDate="2015-10-30T20:54:32.483" LastActivityDate="2015-10-30T20:54:32.483" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26772" PostTypeId="2" ParentId="26769" CreationDate="2015-10-30T20:46:58.383" Score="4" Body="&lt;p&gt;The book doesn't say that the impulse response must be zero for an ideal channel. It says that an ideal channel has exactly one, and not more than one, non-zero component, i.e. the ideal channel's impulse response is an impulse, which means that the signal is only delayed but not distorted.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-30T20:46:58.383" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26773" PostTypeId="1" AcceptedAnswerId="26806" CreationDate="2015-10-30T22:09:19.737" Score="8" ViewCount="3734" Body="&lt;p&gt;I have been trying to determine why is PSNR used instead of SNR for image quality metrics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read through several books and most just say that PSNR is used instead of SNR, but don't give a reason as to why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also read these posts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/10725/signal-quality-metric&quot;&gt;Signal quality metric&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/11326/difference-between-snr-and-psnr&quot;&gt;Difference between SNR and PSNR&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I still feel like they don't explain clearly why PSNR is used instead of SNR. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that PSNR measures how the peak signal intensity compares to the mean squared error whereas SNR measures signal power compared to noise, but this doesn't help me reach an intuitive conclusion as to why to use PSNR instead of SNR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please explain this?&lt;/p&gt;&#xA;" OwnerUserId="7605" LastEditorUserId="11256" LastEditDate="2019-11-28T14:25:15.413" LastActivityDate="2019-11-28T14:25:15.413" Title="Why is PSNR used for image quality metrics instead of SNR?" Tags="|image-processing|snr|perceived-quality|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="26774" PostTypeId="1" AcceptedAnswerId="26786" CreationDate="2015-10-31T02:41:02.917" Score="0" ViewCount="987" Body="&lt;p&gt;I am a student learning dsp. I like the subject. I could understand the discrete time signals. When I move into z transform. I could not understand it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Z transform is the mapping from discrete signal to zplane to make frequency analysis easy. It would be great if users give some tips that could help me to clarify various views on z-tranform on discrete signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Text is here to explain about broad answers on z-tranform. I am just looking forward in some tips that can help me understand and approach z-transform in text. Just some lines about what you think about z-tranform will surely help. Thank you mate. &lt;/p&gt;&#xA;" OwnerUserId="17828" LastActivityDate="2015-11-02T01:54:30.057" Title="The right way to approach z transform?" Tags="|discrete-signals|z-transform|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26775" PostTypeId="1" CreationDate="2015-10-31T08:05:43.170" Score="0" ViewCount="254" Body="&lt;p&gt;I don't study electrical engineering or something related but I was assigned a problem on transfer functions, impulse responses, and in general, everything related to &lt;a href=&quot;https://dsp.stackexchange.com/questions/536/what-is-meant-by-a-systems-impulse-response-and-frequency-response&quot;&gt;this post&lt;/a&gt;. (Specifically, I'm analyzing an RC circuit)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do know the details of the Laplace transform but I prefer the Fourier transform. I wanted to know if there is any problem in substituting the Laplace transform for the Fourier transform in the analysis of LTI systems, impulse responses and transfer functions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important thing these transforms share is a Convolution theorem, which is highly relevant to the analysis of the things I've already mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think? What am I sacrificing by substituting transforms? Why is the Laplace transform favored over the Fourier transform?&lt;/p&gt;&#xA;" OwnerUserId="17581" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-10-31T09:01:55.243" Title="Can I use Fourier transforms instead of Laplace transforms (analyzing RC circuit)?" Tags="|fourier-transform|linear-systems|transfer-function|laplace-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26776" PostTypeId="2" ParentId="26775" CreationDate="2015-10-31T09:01:55.243" Score="3" Body="&lt;p&gt;Both transforms have a large overlap in their applications. So you can use both to analyze an RC circuit. However, with the unilateral Laplace transform it's much more straightforward to take initial conditions into account, such as an initially charged capacitor. This has to do with the unilateral Laplace transform of the derivative of a function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{L}\{x'(t)\}=s\mathcal{L}\{x(t)\}-x(0^-)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the initial condition $x(0^-)$ occurring explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if you're interested in the behavior of the circuit when exposed to periodic input signals, then it's most natural to use the Fourier transform. Note that periodic signals (extending from $-\infty$ to $+\infty)$ don't have a Laplace transform.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-10-31T09:01:55.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26781" PostTypeId="2" ParentId="26722" CreationDate="2015-10-31T15:37:47.250" Score="0" Body="&lt;p&gt;To answer your specific question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For instance, if I see a peak at say, ~ 750 ms, does this mean that with a lag time of 750 ms, the firing pattern is more constant/predictable, or does it simply mean that I have more inter-spike intervals of 750 ms?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are calculating a histogram of inter-spike distances, binned at 50 (in the code as written). Obviously the spikes are only zero time instants away from themselves which is why the high peak at zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a peak in the histogram at 750ms, it does not say anything about &lt;em&gt;repeated&lt;/em&gt; inter-spike intervals of 750ms. That is, just because there is a second spike 750ms after the first spike, it doesn't necessarily mean there will be a third spike 750ms after the second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It just says that, over time, there is more likely to be a spike 750ms after any given spike. &lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-31T15:37:47.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26782" PostTypeId="1" CreationDate="2015-10-31T18:57:22.247" Score="0" ViewCount="1081" Body="&lt;p&gt;What does &quot;feature indexing&quot; mean in image processing? does it mean that we assign a number to each row/column of our feature vectors? any precise explain would appreciate.&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="80" LastEditDate="2015-10-31T19:40:34.020" LastActivityDate="2016-01-30T22:52:30.290" Title="What is &quot;feature indexing&quot; in image processing?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26783" PostTypeId="1" AcceptedAnswerId="26785" CreationDate="2015-10-31T19:24:25.503" Score="5" ViewCount="511" Body="&lt;p&gt;I am working on classification and several times I encountered with this term.&#xA;What is &lt;strong&gt;hard quantization&lt;/strong&gt; strategy?&#xA;What does it differ from &lt;strong&gt;soft&lt;/strong&gt; approach?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="80" LastEditDate="2015-10-31T19:40:16.760" LastActivityDate="2015-11-02T14:42:55.693" Title="What is &quot;hard quantization&quot; strategy?" Tags="|quantization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26784" PostTypeId="2" ParentId="26782" CreationDate="2015-10-31T19:32:20.490" Score="1" Body="&lt;p&gt;The idea is that each image generates a series of features, and you want to be able to search all images based on these features.  That way, features in one image can be quickly associated with close features in another image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &lt;a href=&quot;https://www.dcc.fc.up.pt/~mcoimbra/lectures/VC_1112/VC_1112_T19_KGrauman_IndexingLocalFeatures.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this slide deck&lt;/a&gt; has decided to use four &quot;visual words&quot; to say that each block of images in the figure are &quot;the same&quot; in some sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5Ttp7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5Ttp7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not quite sure what you mean by:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;we assign a number to each row/column of our feature vectors&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Each figure vector is a series of numbers.  What that slide deck does is assigns an identifier (visual word) to each block of similar images (features).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What indexing then does is finds the &quot;middle&quot; of each visual word (group of similar figures) so that other images can be indexed against these words. The green dots in the left-hand of the diagram are the middles for three of the words.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-01-30T22:52:30.290" LastActivityDate="2016-01-30T22:52:30.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26785" PostTypeId="2" ParentId="26783" CreationDate="2015-10-31T19:40:02.473" Score="4" Body="&lt;p&gt;Suppose you are given a data point $D$ and want to classify it into one of $N$ possible classes, $C_i$ for $i=1,2,\ldots, N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hard&lt;/strong&gt; classification chooses &lt;em&gt;one&lt;/em&gt; of the $C_i$ to represent the classification of $D$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Soft&lt;/strong&gt; classification can be done in a number of ways, but the usual (for me) is to generate a weight $w_i$ for each of the $C_i$ which indicates the probability that the data point $D$ is part of the class $C_i$. This means that &#xA;$$\sum_{i=1}^N w_i = 1$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't heard the idea associated with &lt;em&gt;quantization&lt;/em&gt; of one dimensional signals, but I've seen it used in relation to &lt;em&gt;vector quantization&lt;/em&gt; which can be thought of as a simple classification technique.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.researchgate.net/publication/278618965_Visual_search_for_objects_in_a_complex_visual_context_what_we_wish_to_see&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; seems to have an example that matches what you say in your comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is that, instead of each code word in the dictionary having the same weight, each code word has a weight dependent on some criterion or criteria: how far it is from other code words; how frequently it is likely to appear, etc. etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture below gives two examples (green and light blue) of data points that are better coded using a soft technique than a hard one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wQNDt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wQNDt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-02T14:42:55.693" LastActivityDate="2015-11-02T14:42:55.693" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26786" PostTypeId="2" ParentId="26774" CreationDate="2015-10-31T19:50:52.777" Score="4" Body="&lt;p&gt;Discrete-time signals are generally written in the time domain as $x[n]$ where $n$ is an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to be able to see how discrete-time systems can be used to modify these signals:&#xA;$$&#xA;y[n] = \sum_{m=1}^M a_k y[n-m] + \sum_{p=0}^P b_p x[n-p]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above equation is a linear, constant coefficient difference equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such equations can be hard to manipulate for a specific $x$ to figure out what $y$ is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $z$ operator is used to attempt to simplify the analysis of such systems. $z$ is the forward-shift operator: it shifts a signal forward by one time instant. $z^{-1}$ is the backward-shift operator: it shifts a signal backward in time by one time instant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this operator, we can rewrite the equation as:&#xA;$$&#xA;Y(z) = Y(z) \sum_{m=1}^M a_k z^{-m}  + X(z) \sum_{p=0}^P b_p z^{-p}&#xA;$$&#xA;which, upon rearrangement, we can get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y(z)/X(z) = \frac{\displaystyle\sum_{p=0}^P b_p z^{-p}}{\displaystyle1 -  \sum_{m=1}^M a_k z^{-m}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is now a &lt;strong&gt;discrete-time system&lt;/strong&gt; that we can analyze in the $z$ domain, rather than the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing this buys us is the ability to figure out what happens when many discrete-time systems are put together: we just multiply the discrete-time system descriptions (transfer functions).  Doing the same thing in the time domain is doable, but very tedious.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-10-31T19:50:52.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26788" PostTypeId="1" AcceptedAnswerId="26793" CreationDate="2015-11-01T02:09:25.317" Score="3" ViewCount="11341" Body="&lt;p&gt;I have to filter an audio signal through a cascade of two equal low-pass FIR filters. They are half-band filters so each one has a cut-off at $\pi/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I have to multiply the resulting signal (obtained through the cascade of the two filters) for $z^{-q}$, where $q$ is a scalar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, I thought to convolve the impulse responses of the two low-pass filters in this way  (where &lt;code&gt;hlp1=hlp2&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hconv=conv(hlp1, hlp2),&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then filter the audio signal (called &lt;code&gt;x&lt;/code&gt;) in this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x_filtered=filter(hconv,1,x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expect that the frequency response &lt;code&gt;hconv&lt;/code&gt; is a low-pass filter with cutoff at $\pi/4$, but the command &lt;code&gt;fvtool(hconv)&lt;/code&gt; shows that &lt;code&gt;hconv&lt;/code&gt; has a cutoff at $\pi/2$, and not at $\pi/4$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, how can I implement the multiplication of the filtered signal &lt;code&gt;x_filtered&lt;/code&gt; for $z^{-q}$?&lt;/p&gt;&#xA;" OwnerUserId="18063" LastEditorUserId="1629" LastEditDate="2016-04-01T00:33:33.390" LastActivityDate="2016-04-01T00:33:33.390" Title="How to cascade two filters?" Tags="|matlab|audio|convolution|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26791" PostTypeId="2" ParentId="26774" CreationDate="2015-11-01T06:34:10.060" Score="0" Body="&lt;p&gt;Z is a complex exponential, a complex exponential is a compact form of representing a sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What essentially happens in z transform is we take a discrete signal and try to project it on various sinusoids - various frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We multiply our samples with exp(z,-n).&#xA;Sum up the values., essentially that's a measure of finding if our sampled data has a frequency that corresponds to that sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will stop here and let your thought process flow on z as a delay operator., transfer function - the compact notation of sampled data's periodic characteristics.&lt;/p&gt;&#xA;" OwnerUserId="18067" LastEditorUserId="18067" LastEditDate="2015-11-01T16:26:24.000" LastActivityDate="2015-11-01T16:26:24.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26792" PostTypeId="2" ParentId="26763" CreationDate="2015-11-01T08:30:49.620" Score="3" Body="&lt;p&gt;As you interpolate a line, I assume it is a linear interpolation. The solution reduces to a linear combination of the intial starting and ending coordinates. For instance, $i_1 = \frac{1}{3}s + \frac{2}{3}e $ and $i_2 = \frac{2}{3}s + \frac{1}{3}e $ provide the coordinates of two interpolation points $i_1$ and $i_2$ between start point $s$ and end point $e$.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear&#xA;%% Initialization&#xA;pStart =[1 3]';&#xA;pEnd = [4 2]';&#xA;nPointInter = 3;&#xA;&#xA;%% Interpolation weights (including pStart and pEnd)&#xA;lInterval = linspace(0,1,nPointInter+2);&#xA;&#xA;%% Interpolation coordinates&#xA;pInterp = pStart*lInterval+pEnd*(1-lInterval);&#xA;&#xA;%% Display&#xA;figure(1);clf&#xA;hold  on&#xA;plot(pInterp(1,:),pInterp(2,:),'xb')&#xA;plot([pStart(1) pEnd(1)]',[pStart(2) pEnd(2)]','or')&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PulJT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PulJT.png&quot; alt=&quot;Interpolation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-08-20T20:42:15.640" LastActivityDate="2016-08-20T20:42:15.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26793" PostTypeId="2" ParentId="26788" CreationDate="2015-11-01T11:21:40.700" Score="6" Body="&lt;p&gt;You can easily verify yourself that the following two ways of cascading two filters are equivalent (up to numerical inaccuracies):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;% method 1&#xA;y1 = filter(h1,1,x);&#xA;y = filter(h2,1,y1);&#xA;&#xA;% method 2&#xA;h = conv(h1,h2);&#xA;y = filter(h,1,x);&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you were on the right track when you convolved the two impulse responses. Note that &lt;em&gt;linear&lt;/em&gt; convolution is what you need, not circular/cyclic convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the multiplication with $z^{-q}$, where I hope that $q$ is an integer, you need to understand that it is not the (time-domain) signal that is being multiplied, but that this multiplication refers to the Z-transform of the signal. In the Z-transform domain, a multiplication with $z^{-q}$ corresponds to a delay of $q$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, regarding your expectation that the cut-off frequency of the cascaded system is $\pi/4$, note that the frequency response of the cascaded system is simply the multiplication of the two individual frequency responses, so the cut-off frequency does not change significantly (it may change a bit depending on how you define it). The transition from pass band to stop band will be steeper, and the stop band attenuation increases, but the start of the transition band remains unchanged. If both filters are identical you will basically get a better low pass filter with the same pass band and stop band edges.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-01T11:21:40.700" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="26794" PostTypeId="1" CreationDate="2015-11-01T12:14:20.403" Score="0" ViewCount="79" Body="&lt;p&gt;I have a image $U_{m \times n}:\Omega \to \mathbb R^2$, the output $P$ can be define as&#xA; $$P=\mu J_{m \times n} - U$$&#xA;where $\mu = \max \{ u_{ij} : 1 \leq i \leq m, 1 \leq j \leq n\}$, $J_{m \times n}$ be the $m \times n$ matrix whose $i, j$th component is $1$: that is, the all-ones matrix. (This notation isn't quite standard, but it's as close to standard as I know. $J$ is often the all-ones matrix)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is so many sentences for expression the above equation. Do we have more short and standard way to represent it? As my found, the $J_{m \times n}$ can be expressed by indicator function such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P=\max (U)\times 1_{\Omega}-U$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $1_{\Omega}$ is &lt;a href=&quot;https://en.wikipedia.org/wiki/Indicator_function&quot; rel=&quot;nofollow&quot;&gt;Indicator function&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it equivalent with original meaning? If not, please give me a standard and common expression in image processing. Thanks&lt;/p&gt;&#xA;" OwnerUserId="8430" LastEditorUserId="8430" LastEditDate="2015-11-01T12:35:39.260" LastActivityDate="2015-11-01T16:50:59.510" Title="How to represent a given equation more clear, profressional and short form?" Tags="|computer-vision|image-processing|image-segmentation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26795" PostTypeId="1" AcceptedAnswerId="26798" CreationDate="2015-11-01T12:21:32.713" Score="0" ViewCount="840" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/egZHs.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have got two different answers for the ROC of the signal.&#xA;In that PIC, I have solved it in 2 methods, but I'm getting different answer.&#xA;Which one is correct?&#xA;Also please explain how to find the ROC of shifted signal?&lt;/p&gt;&#xA;" OwnerUserId="17974" LastActivityDate="2015-11-01T19:59:19.613" Title="the ROC of a Z-transform for shifted signal" Tags="|z-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26796" PostTypeId="2" ParentId="26794" CreationDate="2015-11-01T12:24:09.673" Score="1" Body="&lt;p&gt;I think the notation $J_{m,n}$ is pretty standard for an &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_of_ones&quot; rel=&quot;nofollow&quot;&gt;all-ones matrix&lt;/a&gt;. So the only possible clarification would be to dispense with $\mu$ and directly specify what it actually is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P=||U||_{\max}J_{m,n}-U$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $||.||_{\max}$ denotes the &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_norm#Max_norm&quot; rel=&quot;nofollow&quot;&gt;max norm&lt;/a&gt; of a matrix.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-01T12:40:58.037" LastActivityDate="2015-11-01T12:40:58.037" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="26797" PostTypeId="2" ParentId="26795" CreationDate="2015-11-01T12:27:52.587" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Your first answer does not include the 0.5 coefficient on the $z^{-1}$ term.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your second answer needs to look at both together, not separately.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-01T12:27:52.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26798" PostTypeId="2" ParentId="26795" CreationDate="2015-11-01T13:33:47.853" Score="2" Body="&lt;p&gt;The $\mathcal{Z}$-transform of your signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=1+\frac12 z^{-1}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(as you figured out by yourself).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ROC is obviously the whole $z$-plane except for $z=0$, because there's a pole at $z=0$. Note that the ROC of the $\mathcal{Z}$-transform of any finite length sequence must be the whole $z$-plane, possibly except for $z=0$ (for sequences with non-zero values for $n&amp;gt;0$), and $z=\infty$ (for sequences with non-zero values for $n&amp;lt;0$). So by merely looking at the sequence you could determine its ROC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why your second method of determining the ROC doesn't work is because when you add the two $\mathcal{Z}$-transforms you get a pole/zero cancellation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{1}{1-\frac12 z^{-1}}-\frac{\frac14 z^{-2}}{1-\frac12 z^{-1}}=\frac{(1-\frac12 z^{-1})(1+\frac12 z^{-1})}{1-\frac12 z^{-1}}=1+\frac12 z^{-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the restricted ROCs of both functions caused by the pole don't show up in the final result due to this pole/zero cancellation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you could express the unit impulse by $\delta[n]=a^nu[n]-a^nu[n-1]$ and obtain arbitrary ROCs of the separate $\mathcal{Z}$-transforms of the two terms on the right-hand side, depending on the choice of $a$. However, the ROC of the $\mathcal{Z}$-transform of $\delta[n]$ (which is $1$) is obviously the whole $z$-plane, including $z=0$ and $z=\infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, if you have a $\mathcal{Z}$-transform $X(z)$ and you shift the corresponding sequence to the right by $k$ samples, $X(z)$ gets multiplied by $z^{-k}$. So all poles and zeros of $X(z)$ remain unchanged, and a pole at $z=0$ and a zero at $z=\infty$ are added, both with multiplicity $k$. Of course they can cancel with already existing poles or zeros. Analogously, if you shift the sequence to the left by $k$ samples, $X(z)$ gets multiplied by $z^k$, which adds a $k$-fold pole at $z=\infty$ and a $k$-fold zero at $z=0$. As an example, take the sequence $a^nu[n]$ with $|a|&amp;lt;0$. Its $\mathcal{Z}$-transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{z}{z-a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with a pole at $z=a$ and a zero at $z=0$. If you shift the corresponding sequence to the right by one sample, the resulting $\mathcal{Z}$-transform is $z^{-1}X(z)$. The original zero at $z=0$ gets cancelled by the new pole at $z=0$, and you're left with the original pole at $z=a$ and a new zero at $z=\infty$. If you shift the sequence to the left by one sample you get $zX(z)$, which gives a double zero at $z=0$, the original pole at $z=a$, and an additional pole at $z=\infty$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-01T19:59:19.613" LastActivityDate="2015-11-01T19:59:19.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26799" PostTypeId="2" ParentId="26794" CreationDate="2015-11-01T14:48:02.490" Score="1" Body="&lt;p&gt;I would propose &lt;code&gt;\mathbb{1}&lt;/code&gt; from the &lt;code&gt;\usepackage{bbold}&lt;/code&gt; (or &lt;code&gt;\mathds{1}&lt;/code&gt;, see &lt;a href=&quot;https://tex.stackexchange.com/questions/26637/how-do-you-get-mathbb1-to-work-characteristic-function-of-a-set&quot;&gt;details and options here&lt;/a&gt;), with outputs a $1$ with a double bar, like for $\mathbb{R}$ (I cannot have it displayed on SE). I would stick to a simple $\max $ or $\sup$, as it is not a norm without the absolute value. Plus, image values are taken in $\mathbb{R}^2$, as in  some &lt;a href=&quot;http://adsabs.harvard.edu/full/1999ASPC..172..125W&quot; rel=&quot;nofollow noreferrer&quot;&gt;astronomical&lt;/a&gt;, seismic or processed images. So, something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\documentclass{article}&#xA;\usepackage{bbold}&#xA;\begin{document}&#xA;$\max_{i,j} \{ A_{i,j}\} . \mathbb{1}-A$&#xA;\end{document}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IZrrs.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IZrrs.jpg&quot; alt=&quot;double-bar indicator notation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:34:29.880" LastActivityDate="2015-11-01T16:50:59.510" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26801" PostTypeId="2" ParentId="26239" CreationDate="2015-11-02T00:19:50.927" Score="1" Body="&lt;p&gt;Your code should look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; filterEnergies = numpy.dot(power, filters) // power is 1-d array, filters are 2-d arrays. Result is 1-d array of energies&#xA;&#xA; logFilterEnergies = np.log(magFilt) // take a lot from them&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can find complete numpy-based implementation here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/cmusphinx/sphinxtrain/blob/master/python/cmusphinx/mfcc.py&quot; rel=&quot;nofollow&quot;&gt;https://github.com/cmusphinx/sphinxtrain/blob/master/python/cmusphinx/mfcc.py&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2015-11-02T00:19:50.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26802" PostTypeId="2" ParentId="26774" CreationDate="2015-11-02T01:54:30.057" Score="0" Body="&lt;p&gt;To add my two cents to Peter K's good answer: Continuous (analog) signal processing systems are described by their time-domain &quot;differential equations.&quot; For all but the simplest systems those equations are &lt;em&gt;very&lt;/em&gt; difficult to solve in order to predict a system's behavior as a function of input signal frequency. Then unsung hero Oliver Heaviside proposed the &quot;Laplace transform&quot; that converted those differential equations into simpler algebra equations that were much easier to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, discrete systems are described by their time-domain &quot;difference equations&quot; such as Peter K's $y[n]$ expression. But as he said, such time-domain expressions are difficult to solve in order to predict a discrete system's behavior as a function of input signal frequency. Lucky for us, in the early 1950s Lofti Zadeh and John Ragazzini (in their efforts to analyze discrete-time control systems) developed the discrete-time equivalent to the Laplace transform, called the &quot;z-transform.&quot; The z-transform converted those discrete-time difference equations into algebra equations that were much easier to solve in order to predict a discrete-time system's behavior as a function of input signal frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon learning of this z-transform, DSP guru James Kaiser (Bell Labs) realized it could be used simplify the analysis of discrete-time signal processing systems, such as digital filters. Kaiser then went on a campaign to convince DSP practitioners to use the z-transform. He knew that the z-transform would produce $Y(z)/X(z)$ algebra expressions enabling regular guys like us to, by way of algebra manipulation, determine both the frequency-domain behavior &lt;em&gt;and&lt;/em&gt; stability of discrete-time signal processing systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it important for you to learn the z-transform? The answer is, the z-transform will not allow you &quot;to see things people wouldn't believe. Attack ships on fire off the shoulder of Orion. Or watch C-beams glitter in the dark near the Tannhauser gate. All those moments are lost in time... like tears in rain.&quot; But the z-transform &lt;em&gt;will&lt;/em&gt; enable you to completely analyze digital filters.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-11-02T01:54:30.057" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26803" PostTypeId="2" ParentId="26765" CreationDate="2015-11-02T03:49:01.663" Score="1" Body="&lt;p&gt;I'm unable to visualize the real-valued inverse-DFT FIR filter coefficients you describe in your Step 5. But no matter. My answer for A: When you use a large number of DFT bins to yield fine granularity of your frequency-domain representation of your desired frequency response, the greater will be the number of nonzero coefficients remaining after you window the output of your inverse DFT. And the larger the number of nonzero coefficients, the greater will be the number of filter computations needed per filter input sample. Only you can decide how many multiplications and additions you're willing to perform per filter input sample. By the way, I'm wondering how many nonzero coefficients you're contemplating at this time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My answer for B: I'm not sure what the asterisk symbol means in your y(n) = SUM_over_m[h(m)*x(n-m)] expression. In any case, you typically implement your FIR filter by convolving your filter's input sequence with your filter's nonzero coefficients. If your have 100 nonzero coefficients then you must perform 100 multiplies and 99 additions per filter input sample. (Depending on your computing hardware, there may be a way to reduce the number of multiplies per input sample to 50. Ask me how.) Now if you have many hundreds of nonzero coefficients then in that case, yes, you'll use what's called the &quot;fast convolution&quot; filtering method which involves both forward- and inverse-DFTs. But CA Charlie, all of this discussion depends on whether your filtering is &quot;real-time&quot; of &quot;offline.&quot; As for the 48 kHz data rate, it affects two things: (1) it means your input signal's spectrum can contain no spectral components greater than 48/2 = 24 kHz; and (2) in a real-time implementation you must perform all your &quot;per sample&quot; filtering computations in less than 1/48,000th of a second. (Sorry CA Charlie, I don't understand the question in your final paragraph.) &lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-11-02T03:49:01.663" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26804" PostTypeId="2" ParentId="26773" CreationDate="2015-11-02T07:02:58.807" Score="1" Body="&lt;p&gt;While for most 1D signal people use RMSE / SNR images are different.&lt;br&gt;&#xA;While people can't have a feeling about RADAR or Ultra Sound signal they can clearly see whether image quality is good or is it similar to a reference image.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In images it is clear that optimizing image towards RMSE (Or the Squared Error) gives the &quot;Blurred&quot; signal advantage.&lt;br&gt;&#xA;Which means edges are blurred.&lt;br&gt;&#xA;Our Visual System is very sensitive to edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence a different metric had to be created.&lt;br&gt;&#xA;Someone suggested the PSNR and it became the standard because it matched the visual system better then the RMSE / SNR (It's not good by itself, only better).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, today the topic of a metric for image restoration quality is very hot.&lt;br&gt;&#xA;Usually the most accepted metric today is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Structural_similarity&quot; rel=&quot;noreferrer&quot;&gt;SSIM&lt;/a&gt; (Structural Similarity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summarizing it, it is all about being more consistent with the quality our Visual System sees and the RMSE doesn't match it well.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-11-02T07:02:58.807" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26806" PostTypeId="2" ParentId="26773" CreationDate="2015-11-02T07:23:16.667" Score="3" Body="&lt;p&gt;Consider 8-bit quantization. This gives a mean squared error of about 0.577 least significant bit (LSB). Quantizing two images of different average intensities gives two different SNR, because that metric is normalized against the average intensity of the input image, but identical PSNR, because it is normalized against the maximum pixel value of 255. When describing the quality of something like a compression method, it is better to use a metric that is (to an extent) independent of the source material, because it carries meaning even when communicated without providing the input image. &lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-02T07:31:41.893" LastActivityDate="2015-11-02T07:31:41.893" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26807" PostTypeId="2" ParentId="26582" CreationDate="2015-11-02T10:06:20.017" Score="1" Body="&lt;p&gt;Many thanks to those answered, commented and viewed my question. My answer is that I have to begun from Functional Analysis as Mr Bone suggests. I remember from high school that when a polynomial of x is equated with y, yields function of x with y. Also I remember the fundamental theorem of algebra for real coefficients. Then I can begun from this knowledge. &lt;/p&gt;&#xA;" OwnerUserId="17893" LastActivityDate="2015-11-02T10:06:20.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26808" PostTypeId="1" AcceptedAnswerId="26810" CreationDate="2015-11-02T10:30:53.040" Score="2" ViewCount="1957" Body="&lt;p&gt;I have to subtract, from a signal x[n], its version filtered thorugh an LPF FIR filter, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;xf=filter(h_lpf,1,x);&#xA;y=x-xf;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I remove the group delay introduced by the filter h_lpf into the signal xf?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it is equal to $\tau_{grp}=\frac{N-1}{2}$, where N is the number of taps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case N is odd, so $\tau_{grp}$ is an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this page:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;http://it.mathworks.com/help/signal/examples/practical-introduction-to-digital-filtering.html#zmw57dd0e2544&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in the section (Compensating for Delay Introduced by Filtering) there's a method, which I here adapt for my case: (note: &quot;x&quot; is the input signal, and D is the group delay):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;pre&gt;xf = filter(h_lpf,1,[x zeros(1,D)]);      % Append D zeros to the input data&#xA;xf = xf(D+1:end);                         % Shift data to compensate for delay&#xA;y=x-xf;&lt;br&gt;&#xA;&lt;/pre&gt;&#xA;Could anyone explain it to me? Could I use it for my problem?&lt;/p&gt;&#xA;" OwnerUserId="18063" LastEditorUserId="18063" LastEditDate="2015-11-02T13:06:31.083" LastActivityDate="2018-10-19T14:35:01.300" Title="How to remove a costant group delay?" Tags="|matlab|finite-impulse-response|group-delay|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26809" PostTypeId="1" AcceptedAnswerId="27515" CreationDate="2015-11-02T11:02:06.200" Score="1" ViewCount="1383" Body="&lt;p&gt;I read from material that coherent integration can be provided by DFT. But it doesn't give further explanation on this remark. As far as I know, coherent integration is the summation of discrete samples with phase considered and it is usually used in time domain. How to understand that DFT's capability of providing coherent integration?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15284" LastActivityDate="2015-12-04T18:24:06.827" Title="DFT provides coherent integration?" Tags="|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26810" PostTypeId="2" ParentId="26808" CreationDate="2015-11-02T12:25:43.967" Score="3" Body="&lt;p&gt;If the low pass filter has a linear phase response, then the group delay it introduces is indeed constant, and it equals $\tau_g=(N-1)/2$ samples, with $N$ being the number of taps. If $N$ is odd, then the group delay is an integer number of samples, and in this case you just have to shift the output signal $\tau_g$ samples to the left as compared to the original signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]-x_f[n+\tau],\quad \tau\in\mathbb{N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is exactly what the Matlab code in your question does. Don't forget to make sure that the number of filter taps $N$ is odd!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could delay the original signal $x[n]$ by the filter's group delay before subtracting from it the filtered signal.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-02T12:25:43.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26812" PostTypeId="1" AcceptedAnswerId="26864" CreationDate="2015-11-02T13:42:03.450" Score="2" ViewCount="404" Body="&lt;p&gt;I wish to design an all-pole formant filter by specifying frequency θ (between 0 and π radians for Nyquist) and bandwidth Φ such that the response of the filter at θ-Φ and at θ+Φ should be roughly 50% of the response at θ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I start by specifying a pole at $p=[r,θ]=re^{jθ}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is this: How to estimate $r$ as a function of $Φ$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: A fairly crude estimate will suffice for my purposes (vowel synthesis).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my approach so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding a conjugate pole, I construct a transfer function $H(z) = \frac{1}{p-z}\frac{1}{p^*-z}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{H(z)} = (p-z)(p^*-z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$= pp^* -z(p+p^*) + z^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = r^2 -z(2r cos θ) + z^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gain at frequency α will be $\text{Gain}(α) = |H(e^{jα})|$, so the gain at θ is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1}{H(e^{jθ})} = r^2 -e^{jθ}(2 rcos θ) + (e^{jθ})^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = r^2 -re^{jθ}(e^{jθ} + e^{-jθ}) + e^{j\cdot2θ} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = r^2 -r(e^{j\cdot2θ} - 1) + e^{j\cdot2θ} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = r(r-1) - e^{j2θ}(r-1) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = (r-1)(r - e^{j2θ}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So $\text{Gain}(θ) = |H(e^{jθ})| = \frac{1}{(r-1)(r - e^{j2θ})} $ as $0&amp;lt;r&amp;lt;1$. So far so good, nice and tidy!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now it gets tricky. I require Φ such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \text{Gain}(θ) = 2 \text{Gain}(Φ)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1}{|(r-1)(r - e^{j2θ})|} = \frac{2}{|r^2 -z(2r cos θ) + z^2|} \text{where} z=e^{jΦ} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 2|(r-1)(r - e^{j2θ})| = |r^2 -e^{jΦ}(2r cos θ) + e^{j2Φ}| $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I should be able to split out real and imaginary components inside each modulus: $2|A+jB| = |C+jD| =&amp;gt; 4(A^2+B^2) = C^2+D^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this is starting to look very heavy. How would an engineer approach this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way I can do it using iPython/numpy/scipy?&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2015-11-02T17:57:40.613" LastActivityDate="2022-06-01T16:15:15.857" Title="Estimating pole radius of formant filter from bandwidth" Tags="|filters|bandwidth|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26813" PostTypeId="1" AcceptedAnswerId="26814" CreationDate="2015-11-02T14:23:04.603" Score="1" ViewCount="702" Body="&lt;p&gt;I have to do two frequency shifts:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;the first: to transform a lowpass filter into a highpass filter&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've implemented it in this way:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;pre&gt;h_hpf=h_lpf.*exp(j*pi*(0:N))&lt;/pre&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;the second: to transform a lowpass filter into a bandpass filter centered at &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've implemented it in this way:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;pre&gt;h_bpf=h_lpf.*exp(j*pi/2*(0:N))&lt;/pre&gt;&#xA;&lt;p&gt;I used the fvtool() command to show frequency responses, and I've observed that the frequency response of h_hpf is also replicated in the negative frequency axis, while it doesn't happen for the frequency response of h_bpf.&lt;/p&gt;&#xA;&lt;p&gt;Indeed, the frequency response of h_bpf appears only in the positive frequency axis, and the replica in the negative axis doesn't appear.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, its impulse response h_hbf has complex values, so I think that the correct shift is:&lt;/p&gt;&#xA;&lt;pre&gt;h_bpf=h_lpf.*(exp(j*pi/2*(0:N))+exp(-j*pi/2*(0:N)))&lt;/pre&gt;&#xA;&lt;p&gt;Which is the correct shift?&lt;/p&gt;&#xA;" OwnerUserId="18063" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-11-02T16:03:47.500" Title="From lowpass to bandpass" Tags="|matlab|frequency-response|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26814" PostTypeId="2" ParentId="26813" CreationDate="2015-11-02T14:54:38.260" Score="4" Body="&lt;p&gt;You just shifted the low pass filter to the right, so you generated a complex-valued filter, as you've observed. Multiplying a real-valued impulse response with a complex exponential naturally results in a complex-valued impulse response. What you actually have to do is shift the spectrum to the right and to the left:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_{BP}[n]=h_{LP}[n]e^{jn\omega_0}+h_{LP}[n]e^{-jn\omega_0}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_0$ is the desired center frequency. Eq. $(1)$ is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_{BP}[n]=2h_{LP}[n]\cos(n\omega_0)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which it is obvious that the resulting band pass impulse response is real-valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why it works with the high pass filter is that $e^{jn\pi}=\cos(n\pi)=(-1)^n$, so for this special case ($\omega_0=\pi$) it makes no difference.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-02T16:03:47.500" LastActivityDate="2015-11-02T16:03:47.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26815" PostTypeId="1" CreationDate="2015-11-02T15:07:55.577" Score="0" ViewCount="429" Body="&lt;p&gt;I have an circularly symmetric image in Fourier space:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/i9CeA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i9CeA.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the 0-frequency is in the center. Now, I want to take the FFT of this image. Having numpy's FFT conventions in mind (i.e. 0 frequency at (0,0)), I first apply the the inverse-fftshift, and then apply the inverse-fourier transform. As follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;image = np.fft.ifft2(np.fft.ifftshift(FT_image))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This results in the following real space image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sOttb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sOttb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I can't really wrap my head around this result. It looks as if another fftshift would be in order, but in real space this shouldn't be necessary. &#xA;I would expect a radially symmetric transform, centered in the center of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this expectation wrong, or is my computation wrong? And either way: can you explain why?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="17359" LastActivityDate="2015-11-02T17:43:27.363" Title="FFT on circularly symmetric function" Tags="|fft|fourier-transform|ifft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26817" PostTypeId="1" AcceptedAnswerId="26819" CreationDate="2015-11-02T16:44:33.910" Score="1" ViewCount="603" Body="&lt;p&gt;I am not quite sure whether the question I am stating is right, or if I am trying to combine two not related topics but here it comes.. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying implement and apply a contra harmonic mean filter, but do not know how the kernel should look like, and why it should like that, or even if should do it with a convolutional kernel.... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The contra harmonic mean filter is described here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.blackice.com/Help/Tools/Document%20Imaging%20SDK%20webhelp/WebHelp/Contra-Harmonic_Mean_Filter.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.blackice.com/Help/Tools/Document%20Imaging%20SDK%20webhelp/WebHelp/Contra-Harmonic_Mean_Filter.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for being a noob within this area, but seems like this information isn't stated anywhere, and I kinda get the feeling that it is some form of knowledge everybody should have, but not me...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using filter2D to create my filter.. &lt;/p&gt;&#xA;" OwnerUserId="18084" LastEditorUserId="18084" LastEditDate="2015-11-02T20:26:05.913" LastActivityDate="2015-11-02T20:26:05.913" Title="Creating a convolution kernel from filter description" Tags="|image-processing|filters|convolution|opencv|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26818" PostTypeId="1" AcceptedAnswerId="26844" CreationDate="2015-11-02T16:55:06.317" Score="1" ViewCount="4420" Body="&lt;p&gt;I have a quite typical Kalman filter to design. I really read a lot of articles about the design of this filter but the performances of my filter are still quite bad. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my situation. I have a quite good measurement signal of my position (let's say a very small white noise) and a pretty noisy measurement signal of my velocity (big white noise). I want to estimate a new position (which will be I guess not very different from my measurements) and my velocity as well (which will be more different)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my Matlab code: (I don't want to use the Matlab Kalman function ;) )&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Kalman Filter Design&#xA;dt = 0.01;&#xA;&#xA;%% Define coefficient matrices&#xA;% x = [position;velocity;acceleration]&#xA;&#xA;% True State equation &#xA;% x = F * x(t-1) + B * u + w&#xA;F = [ 1 dt dt^2/2&#xA;      0  1 dt&#xA;      0  0 1];&#xA;&#xA;B = [0&#xA;     0&#xA;     0];&#xA;% Measurement of the true state equation&#xA;% z = H * x(t) + v&#xA;H = [1 0 0&#xA;     0 1 0];&#xA;&#xA;%% Define noise&#xA;&#xA;%Process noise(white noise)&#xA;% w = Gw * a &#xA;a = [0 ; 0 ; wgn(1,1,100)]; &#xA;Gw = [0 0 0&#xA;     0 0 0&#xA;     0 0 1];&#xA;&#xA;%Process noise covariance matrix&#xA;Q = Gw * Gw' * cov(a);&#xA;&#xA;%Measurement noise (white noise)&#xA;v = [wgn(1,1,0.001) ; wgn(1,1,20)]; &#xA;&#xA;%Measurement noise covariance matrix&#xA;R = cov(v)* [0.5 0&#xA;              0  1];&#xA;&#xA;%% Kalman Filter &#xA;x_estimate = [0;0;0];&#xA;P = Q;&#xA;&#xA;position_estimate = [];&#xA;velocity_estimate = [];&#xA;acc_estimate = [];&#xA;P_mag_estimate = [];&#xA;&#xA;predic_state =[];&#xA;predic_var = [];&#xA;&#xA;z = [position_meas,velocity_meas];&#xA;&#xA;&#xA;for t = 1:length (z)&#xA;&#xA;%Predicted state estimate&#xA;x_estimate = F * x_estimate;&#xA;predic_state = [predic_state; x_estimate(1)];&#xA;&#xA;%Predicted estimate covariance&#xA;P = F * P * F' + Q;&#xA;predic_var = [predic_var; P];&#xA;&#xA;%Innovation covariance&#xA;S = H * P * H' + R ;&#xA;&#xA;%Kalman Gain Predict measurement covariance&#xA;K = P * H' * inv(S);&#xA;&#xA;% Updated  state estimate&#xA;x_estimate = x_estimate + K * (z(t) - H * x_estimate);&#xA;&#xA;%Update covariance estimation&#xA;P = (eye(size(P,2)) - K * H) * P;&#xA;&#xA;%Store for plotting&#xA;position_estimate = [position_estimate; x_estimate(1)];&#xA;velocity_estimate = [velocity_estimate; x_estimate(2)];&#xA;P_mag_estimate = [P_mag_estimate; P(1)];&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is: how can I find Q and R? Does it depend of what I want to do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot for your help&lt;/p&gt;&#xA;" OwnerUserId="18085" LastActivityDate="2016-01-02T20:55:06.267" Title="Kalman Filter - Velocity [Matlab]" Tags="|kalman-filters|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26819" PostTypeId="2" ParentId="26817" CreationDate="2015-11-02T17:01:48.527" Score="0" Body="&lt;p&gt;The key point in the description on the linked-to page is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This function will filter the image by the &lt;strong&gt;nonlinear&lt;/strong&gt; contra-harmonic mean method.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;that the method in question is nonlinear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means convolution kernels are not really applicable, because they are generally only useful for &lt;strong&gt;linear,&lt;/strong&gt; time-invariant systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, you may be able to use a simple linear convolution kernel in the process of calculating this mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to calculate:&#xA;$$&#xA;\sum_{(i,j) \in M} A(x+i,y+j)^Q&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Q$ is either $P$ or $P+1$ and $M$ is an $N\times N$ square mask ($\square$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to do this would be to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Calculate the image to the power $P+1 = I_1 =   A(x,y)^{P+1}$.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the image to the power $P =  I_2 =  A(x,y)^{P}$.&lt;/li&gt;&#xA;&lt;li&gt;Form&#xA;$$&#xA;I_\mbox{NUM} = \square * I_1\\&#xA;I_\mbox{DEN} = \square * I_2\\&#xA;\mbox{Contra-harmonic mean} = \frac{I_\mbox{NUM}}{I_\mbox{DEN}}&#xA;$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here, the convolution kernel, $\square$ is just:&#xA;$$&#xA;\square(x,y) = \left\{ &#xA;\begin{array}{cl}&#xA;1 &amp;amp; |x|,|y| &amp;lt; N/2\\&#xA;0 &amp;amp; \mbox{otherwise}&#xA;\end{array}&#xA;\right .&#xA;$$&#xA;i.e. it's just a square $N \times N$ kernel of all ones.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-02T17:01:48.527" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26821" PostTypeId="2" ParentId="26815" CreationDate="2015-11-02T17:43:27.363" Score="1" Body="&lt;p&gt;Your Fourier space image is purely real, so the inverse Fourier is going to be radially symmetric about the origin. Because the origin is at (0,0), it takes a shift to put the inverse image in the center of your matrix.&lt;/p&gt;&#xA;" OwnerUserId="7883" LastActivityDate="2015-11-02T17:43:27.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26823" PostTypeId="2" ParentId="26697" CreationDate="2015-11-02T19:59:04.953" Score="8" Body="&lt;p&gt;The short answer is, No. DL can recognize a mug in a photo, but this doesn't kill signal processing in anyway. That said,  your question is quite relevant in these troubled days. There is a nice panel discussion on the subject, featuring Stephane Mallat, etc., &lt;a href=&quot;https://www.youtube.com/watch?v=LZnAFO5gkOQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;Is Deep Learning the Final Frontier and the End of Signal Processing - Panel Discussion at Technion&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15159" LastEditorUserId="60971" LastEditDate="2022-05-18T21:43:21.130" LastActivityDate="2022-05-18T21:43:21.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26824" PostTypeId="1" AcceptedAnswerId="26983" CreationDate="2015-11-02T20:00:37.047" Score="1" ViewCount="293" Body="&lt;p&gt;Here is a &lt;a href=&quot;http://gget.it/dddsze63/recurrent+evolving.wav&quot; rel=&quot;nofollow&quot;&gt;sound example&lt;/a&gt; for what follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume we have a signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t) = r(t) + e(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$r(t)$ is a signal which is recurrent with a given period, i.e. in my example $r(t) = $ &lt;strong&gt;the exact same snare sample&lt;/strong&gt;, which is played every 1 second, starting at 00:00:00,500&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$e(t)$ is an evolving sound (in my example it's the synth pad soft sound)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I assume the signal is mono, and that no compression or other master effect has been applied.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;br&gt;&#xA;How to recover $r(t)$ from the mix $s(t)$, by analyzing which &quot;pattern&quot; is recurrent in $s(t)$? (the period 1 second is considered as given) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;In one word, how to isolate the snare sound from the mix?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to do it by slicing the signal each 1 second:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://gget.it/pg1gq31v/slice1.wav&quot; rel=&quot;nofollow&quot;&gt;slice1.wav&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://gget.it/pu5nlrs2/slice2.wav&quot; rel=&quot;nofollow&quot;&gt;slice2.wav&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://gget.it/2aa0x1px/slice3.wav&quot; rel=&quot;nofollow&quot;&gt;slice3.wav&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://gget.it/flp395m6/slice4.wav&quot; rel=&quot;nofollow&quot;&gt;slice4.wav&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://gget.it/2jy1i2yl/slice5.wav&quot; rel=&quot;nofollow&quot;&gt;slice5.wav&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://gget.it/2jy1i2yl/slice5.wav&quot; rel=&quot;nofollow&quot;&gt;slice6.wav&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://gget.it/2jy1i2yl/slice5.wav&quot; rel=&quot;nofollow&quot;&gt;slice7.wav&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;and analyze what part of signal is recurrent (= the snare) and which is not (= the synth)  among all slices&lt;/strong&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a separation algorithm based on analyzing recurrent parts / non-recurrent parts?&lt;/strong&gt; Using FFT or something else?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2015-11-05T15:39:38.517" LastActivityDate="2015-11-19T21:57:40.860" Title="Isolate recurrent pattern vs. evolving background sound" Tags="|fft|signal-analysis|autocorrelation|source-separation|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26827" PostTypeId="2" ParentId="26809" CreationDate="2015-11-02T23:42:43.587" Score="1" Body="&lt;p&gt;@ecook: Your time-domain notion of coherent integration is correct. (Where multiple periodic sequences must be time-synchronized before the averaging operation.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I could justify the remark that &quot;coherent integration can be provided by DFT&quot; is in the following scenario: let's say your DFT's input is an $x1(n)$ sinusoidal sequence and your DFT result is the complex valued $X1(m)$ sequence. Then some moments later you collect a new $x2(n)$ time sequence of the same sinusoidal signal and produce a new complex-valued DFT result of $X2(m)$. To average (integrate) those $X1(m)$ and $X2(m)$ sequences you would add their magnitudes. That's a form of incoherent averaging (incoherent integration), also called &quot;scalar averaging.&quot; (Averaging $X1(m)$'s and $X2(m)$'s real and imaginary parts individually may lead to spectral energy cancellation and you don't want that to happen.)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, on the other hand, your $x2(n)$ time sequence was time-synchronized with the previous $x1(n)$ time sequence you can add $X1(m)$'s and $X2(m)$'s real and imaginary parts individually. That's a form of coherent averaging (coherent integration), also called &quot;time-synchronous averaging.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Know this however, as Peter Kootsookos points out, averaging phase angles is tricky. Have a look at Peter's explanation at:&#xA;&lt;a href=&quot;http://www.dsprelated.com/showarticle/57.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showarticle/57.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15391" LastEditDate="2015-11-03T09:55:14.163" LastActivityDate="2015-11-03T09:55:14.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26828" PostTypeId="2" ParentId="26812" CreationDate="2015-11-03T00:06:51.567" Score="1" Body="&lt;p&gt;I have here a very pretty answer supplied by @Jazzmaniac, which I will transcribe from our conversation (on IRC Freenode ##dsp).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BimmZ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BimmZ.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The key insight is that the gain is inversely proportional to the distance from the pole.&lt;/p&gt;&#xA;&lt;p&gt;So, double the distance, halve the gain.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;(This can be seen by imagining a single pole on the origin with the transfer function &lt;span class=&quot;math-container&quot;&gt;$H(z) = 1/z$&lt;/span&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;The small circle represents the peak gain (at frequency &lt;span class=&quot;math-container&quot;&gt;$e^{jθ}$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The bigger circle represents a locus of half that gain.&lt;/p&gt;&#xA;&lt;p&gt;Hence, it is clear that &lt;span class=&quot;math-container&quot;&gt;$Φ$&lt;/span&gt; = bandwidth/2&lt;/p&gt;&#xA;&lt;p&gt;It is worth observing that we now have &lt;span class=&quot;math-container&quot;&gt;$r(Φ)$&lt;/span&gt; (i.e. &lt;code&gt;r&lt;/code&gt; is independent of &lt;span class=&quot;math-container&quot;&gt;$θ$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="595" LastEditorUserId="595" LastEditDate="2022-06-01T16:15:15.857" LastActivityDate="2022-06-01T16:15:15.857" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="26829" PostTypeId="1" CreationDate="2015-11-03T02:09:34.970" Score="1" ViewCount="307" Body="&lt;p&gt;Consider I have a dynamical system $\dot{x} = Ax + w(t)$, $x \in \mathbb{R^2}$  where $w(t)$ is a Gaussian random variable with mean $E(w(t)) = C\|x\|^2$ where $C \in R^2$ is a constant and covariance matrix $Q(t) \leq \begin{bmatrix} f_{1}(\|x\|^2) &amp;amp; 0 \\ 0 &amp;amp; f_{2}(\|x\|^2) \end{bmatrix} $ where $f_{1}$ and $f_{2}$ decrease as $\|x\|^2$ decreases. Also $A$ is a stable system matrix. Assume noisy measurements $y = Hx + v(t)$ ( $v$ is standard white noise with zero mean and known fixed covariance). The aim is to generate estimates of $x(t)$ using a Kalman Filter.How do I begin to analyze the theoretical implications of process noise of this nature ? Will the standard Kalman Filter &quot;work&quot; in this case ? &lt;/p&gt;&#xA;" OwnerUserId="18090" LastEditorUserId="18090" LastEditDate="2015-11-03T14:42:21.780" LastActivityDate="2015-11-03T14:42:21.780" Title="Optimality of Kalman Filter for Process Noise dependent on magnitude of state" Tags="|filters|estimation|kalman-filters|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26830" PostTypeId="1" AcceptedAnswerId="26837" CreationDate="2015-11-03T04:47:55.043" Score="5" ViewCount="18822" Body="&lt;p&gt;I have a signal that I have acquired from an experimental instrument, that I wish to examine in the frequency domain.  I don't care about phase for this exercise, I only care about magnitude.  I deliberately planned my experiment so that the dominant frequency would fall completely within a single fft bin.  when I use the scipy fft function on an unfiltered window, the fft shows a clean spike as expected.  However, when I first apply a numpy.hanning window, the spikes become smeared.&#xA;Note the mean of the signal (the zero bin) also shows the same smearing effect.&#xA;My code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;eta=[instrument data series of length 2048]&#xA;etaHann=np.hanning(nfft)*eta&#xA;EtaSpectrum=abs(sp.fft(eta))&#xA;EtaSpectrum=EtaSpectrum*2/nfft # convert to amplitude&#xA;EtaSpectrumHann=abs(sp.fft(etaHann))&#xA;EtaSpectrumHann=EtaSpectrumHann*2*2/nfft # also correct for Hann filter&#xA;frequencies=np.linspace(0,samplingFrequency,nfft)&#xA;plt.plot(frequencies[0:200],EtaSpectrumHann[0:200],'b.-',label='Hann filtered')&#xA;plt.plot(frequencies[0:200],EtaSpectrum[0:200],'c.-',label='rectangular')&#xA;plt.xlim(-0.01,2)&#xA;plt.xlabel('frequency')&#xA;plt.ylabel('amplitude')&#xA;plt.grid()&#xA;plt.legend(loc=0)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Plotted outputs below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vNfxO.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vNfxO.png&quot; alt=&quot;output full size&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/2R09m.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2R09m.png&quot; alt=&quot;output zoomed in&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this meant to happen?  Does anyone else get this problem?  For my data, it seems a rectangular window is fine, but to me it seems that the Hanning window must be wrong here, as the integral of the entire spectrum should be the same (after I multiplied by 2 to correct amplitude), but in this case it seems to be different.&lt;/p&gt;&#xA;" OwnerUserId="18035" LastActivityDate="2020-05-04T15:53:46.947" Title="python scipy fft on numpy hanning window smears peaks" Tags="|fft|python|window-functions|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26831" PostTypeId="1" AcceptedAnswerId="26834" CreationDate="2015-11-03T07:35:05.937" Score="-1" ViewCount="79" Body="&lt;p&gt;How should one choose between the words &quot;source&quot; and &quot;target&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This video processing plugin from Sony Vegas tries to match the color of one video to the color of another. It got me confused because I thought source would be the material that gets processed, and target is something ideal you aim for, but the opposite is the case here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adobe Photoshop uses the same convention as Sony Vegas, so it seems wide-spread.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NBgQQ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NBgQQ.jpg&quot; alt=&quot;Sony Color Match&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-05T08:25:01.073" LastActivityDate="2015-11-05T08:25:01.073" Title="Terminology: source and target" Tags="|terminology|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26832" PostTypeId="1" CreationDate="2015-11-03T08:06:39.933" Score="0" ViewCount="860" Body="&lt;p&gt;We have a feedback system F(s) as in this figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oCHKV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oCHKV.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UKHJY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UKHJY.png&quot; alt=&quot;G(s)&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this is the step response of G(s):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3KoAH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3KoAH.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and H=10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;F(s):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ARxLh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ARxLh.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We got the root locus of the system F(s) as this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QaoyM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QaoyM.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then we determined the gain at marginal stability:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9wCST.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9wCST.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is equal to 2.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, we made H = 2.57 (slightly larger than 2.5) and we obtained the step response of the new system Fh(s). Here is it with the step response of the original system F(s):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Cf4tb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cf4tb.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, we made H = 2.43 (slightly lower than 2.5) and we obtained the step response of the new system Fl(s). Here is it with the step response of the original system F(s):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f8Eea.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f8Eea.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What can we know from the step response plot of G(s)?&lt;/li&gt;&#xA;&lt;li&gt;What can we know from the step response plot of F(s)?&lt;/li&gt;&#xA;&lt;li&gt;When we changed the gain to 2.57, how did the system F(s) change? What can we conclude by comparing the step responses of F(s) and Fh(s)?&lt;/li&gt;&#xA;&lt;li&gt;When we changed the gain to 2.43, how did the system F(s) change? What can we conclude by comparing the step responses of F(s) and Fl(s)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11628" LastActivityDate="2022-03-17T06:01:35.103" Title="Step response of feedback system" Tags="|matlab|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26833" PostTypeId="2" ParentId="26582" CreationDate="2015-11-03T09:04:18.053" Score="6" Body="&lt;p&gt;@George Theodosiou:Instead of diving into all sorts of high-powered mathematical subjects (only a portion of which will be useful to you), I suggest you begin by reading a decent book for DSP beginners. Such as the popular books &quot;Understanding Digital Signal Processing&quot; or &quot;The Scientist and Engineer's Guide to Digital Signal Processing.&quot; Those books spoon feed the reader, slowly and gently, the mathematics needed to begin studying DSP. Then when you encounter some equation in those books that puzzles you, you can go on the web and learn the mathematics of that particular equation in more depth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;George, if your desire to learn digital filtering is sincere, and you retain your enthusiasm, then you will succeed. To quote Susan B. Anthony, &quot;Failure is impossible.&quot; Good Luck.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-11-03T09:04:18.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26834" PostTypeId="2" ParentId="26831" CreationDate="2015-11-03T09:16:00.117" Score="1" Body="&lt;p&gt;@Olli Niemitalo: I think your notions of the meanings of the words &quot;source&quot; and &quot;target&quot; are compatible with Matt L.'s viewpoint. I agree with you, the video processing plugin's terminology seems backwards. &lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-11-03T09:16:00.117" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26835" PostTypeId="2" ParentId="26582" CreationDate="2015-11-03T09:58:20.357" Score="1" Body="&lt;p&gt;For digital filter design, I appreciate above answers, and would like to add some fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, let us restrict to linear filering. Linearity, along with time-invariance, are root assumptions. With them, vector spaces, convolution (integrals and series) and Fourier transforms (part of functional analysis, with complex adn trigonometry) become natural tools. I insist these tools are natural consequences of linearity/time-invariance, if you get that, you will gently be driven to the tools you need. Optimization is quite pervasive in filter design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the side, you can keep in mind additionnal fields. You may be interested in designing complementary filters, with different rates, and multirate filter design may lead you to matrix factorization, which is useful as well in filter structures (lattice, ladder) and spectral factorization. If you go to real-system implementation (FPGA, microcontroller), you can have to dive into fixed-point or integer arithmetic. Of course, sampling theory is a first-order requirement, especially if you go multidimensional (image processing). One can even touch higher mahematics, with &lt;a href=&quot;http://dx.doi.org/10.1016/j.laa.2004.01.008&quot; rel=&quot;nofollow&quot;&gt;polynomial systems and Gröbner bases&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like a lot, for a basic mathematical and clean introduction to many topics, Gasquet &amp;amp;  Witomski &lt;a href=&quot;http://vivo.cornell.edu/display/AI-22114113537&quot; rel=&quot;nofollow&quot;&gt;Fourier Analysis and Applications: Filtering, Numerical Computation, Wavelets&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me add a lesser mentioned issue: one big question is often the number of taps, and the precision (number of bits per coefficient) required to satisfy a certain filter design. Two sources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ichige &lt;em&gt;et al.&lt;/em&gt; &lt;a href=&quot;http://dx.doi.org/10.1109/82.877143&quot; rel=&quot;nofollow&quot;&gt;Accurate estimation of minimum filter length for optimum {FIR} digital filters&lt;/a&gt;, IEEE Transactions on Circuits and Systems II: Analog and Digital Signal Processing, &#xA;2000&lt;/li&gt;&#xA;&lt;li&gt;Bellanger, &lt;a href=&quot;http://dx.doi.org/10.1049/iet-cds.2010.0010&quot; rel=&quot;nofollow&quot;&gt;On computational complexity in digital filters&lt;/a&gt;, 1981&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-11-03T09:58:20.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26836" PostTypeId="1" CreationDate="2015-11-03T12:32:33.953" Score="4" ViewCount="1006" Body="&lt;p&gt;The input/output system is&#xA;$$&#xA;\frac{dy(t)}{dt}+2y(t)=2x^2(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I want to know this is linear? causal? time-invariant? memoryless?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to solution, the answer is 'Linear if zero initial conditions, causal, time-invariant, with memory'.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My trial:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=x^2(t)-\frac{1}{2}\frac{dy(t)}{dt}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ucKId.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ucKId.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for my poor drawing.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;for input value: $x_1(t)=2x(t)$,&#xA;\begin{align}&#xA;y_1(t)&amp;amp;=\left(2x(t)\right)^2+\left(-\frac12\right)\frac{d}{dt}\left(y(t)\right)\\&#xA;&amp;amp;=4x^2(t)-\frac12\frac{dy(t)}{dt}\\&#xA;2y(t)&amp;amp;=2x^2(t)-\frac{dy(t)}{dt}\\&#xA;\therefore y_1(t) &amp;amp;\ne 2y(t)&#xA;\end{align}&#xA;&#xA;&lt;h2&gt;$\because$ not satisfying Homogeneity, Non-Linear.&lt;/h2&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;The system doesn't have $x(t+k)$. (It means $y(t)$ is not made by $x(t+k)$)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;$\therefore$ The system is causal because&lt;/h2&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;for input value: $x_1(t)=x(t-t_0)$,&#xA;\begin{align}&#xA;y_1(t)&amp;amp;=x^2(t-t_0)-\frac{1}{2}\frac{dy(t)}{dt}\\&#xA;y(t-t_0)&amp;amp;=x^2(t-t_0)-\frac{1}{2}\frac{dy(t-t_0)}{dt}\\&#xA;\therefore y_1(t) &amp;amp;\ne y(t-t_0)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;$\therefore$ time-varying.&lt;/h2&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The system doesn't have any $\displaystyle\int$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e.) $\displaystyle\int x(\tau) d\tau$.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;$\therefore$ memoryless&lt;/h2&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What is the real solution?&lt;/p&gt;&#xA;" OwnerUserId="17105" LastEditorUserId="4346" LastEditDate="2015-11-05T01:13:41.203" LastActivityDate="2016-11-29T23:29:54.450" Title="Can someone let me know linearity, time-invariance, causality, memory characteristic of the system?" Tags="|signal-analysis|linear-systems|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26837" PostTypeId="2" ParentId="26830" CreationDate="2015-11-03T12:35:00.537" Score="8" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this meant to happen?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, that is absolutely a well known effect of using &lt;em&gt;any&lt;/em&gt; window function.&#xA;Taking a look through the &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function&quot;&gt;Wikipedia article on window functions&lt;/a&gt;, we find that the rectangular window has the sharpest peak.&#xA;This is quite simply due to the fact that the rectangular window acquires the most data, meaning that it can distinguish between slightly different frequencies the best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;problem&lt;/em&gt; with the rectangular window is that it has large side lobes.&#xA;In other words, if you measure a signal which doesn't exactly match one of the discrete Fourier transform (DFT) frequencies (a.k.a. bins), then with the rectangular window you get a lot of leakage into neighboring bins.&#xA;The formula for this is actually rather simple.&#xA;Suppose your sampling interval is $\delta t$ and you measure $N$ points.&#xA;Then the DFT frequencies are&#xA;$$f_n = n / N \delta t, \quad n\in[0,1,\ldots,N-1] \, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose you measure a sinusoid with frequency $\xi$ so that the sampled values are $x_n = \cos(2 \pi \xi n \delta t)$.&#xA;The mod squared of the DFT values are then&#xA;$$ |X_k|^2 = \left( \frac{\sin(\pi(\xi - k))}{\sin(\pi(\xi-k)/N} \right)^2 \, . \tag{$*$}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We plot this function in Figure 1 for $\xi=24.4$.&#xA;Note that when $\xi$ is not an integer the DFT values are nonzero for &lt;em&gt;all&lt;/em&gt; bins, and you can see from equation $(*)$ that the values of $|X_k|^2$ only fall off as one over the square of frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zApUX.png&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zApUX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;strong&gt;Figure 1:&lt;/strong&gt; DFT values for a cosine of frequency 24.4.&#xA;The blue line indicates the underlying function given in equation $(*)$ and the black dots are the values of that function evaluated at the integers.&#xA;In other words, the black dots are the DFT bin values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point of a window function is to make the leakage of power into bins near the real frequency (in this case 24.4) fall off faster, &lt;em&gt;but this comes at the cost that the main peak is broadened&lt;/em&gt;.$^{[a]}$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does anyone else get this problem?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's not a problem.&#xA;It's how windows are supposed to work.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For my data, it seems a rectangular window is fine, but to me it seems that the Hanning window must be wrong here, as the integral of the entire spectrum should be the same (after I multiplied by 2 to correct amplitude), but in this case it seems to be different.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Applying a window &lt;em&gt;changes the total power in your signal&lt;/em&gt;, as you have observed.&#xA;This is not a mistake at all.&#xA;It's pretty obvious that this has to happen because the integral (sum) of the power in the frequency domain has to equal the power you would have computed in the time doman (&lt;a href=&quot;https://en.wikipedia.org/wiki/Parseval%27s_theorem&quot;&gt;Parseval's theorem&lt;/a&gt;).&#xA;It's clear that multiplying e.g. a cosine by a window function changes the integral of the time domain signal.&#xA;This is called &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function#Processing_gain_and_losses&quot;&gt;loss&lt;/a&gt;&quot; and must be taken into account when using windows!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[a]$: I'm not actually showing this because I didn't bother to compute the points with the window, but the Wikipedia article shows many examples.&lt;/p&gt;&#xA;" OwnerUserId="7361" LastActivityDate="2015-11-03T12:35:00.537" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26838" PostTypeId="2" ParentId="26706" CreationDate="2015-11-03T14:04:59.473" Score="0" Body="&lt;p&gt;Yes, there is a way to combine radar sensor data.  There are instances where you can correlate the two signals with each other, but it depends on what you are trying to do.  A couple of points about your examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chin/cheek.  At 25 MHz, any reasonable aperture (antenna) will likely have a large enough beamwidth that both sensors would see the same thing: both cheek and chin.  That said, you may see a Doppler shift from both objects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Top.  Conjugate one of them, provided that all other parameters are exactly the same.  That said, one sensor is already measuring the exact event that you describe.  If you need higher SNR, there are other things you can do.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And don't forget that each radar can pollute each other's data&lt;/p&gt;&#xA;" OwnerUserId="18099" LastActivityDate="2015-11-03T14:04:59.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26839" PostTypeId="1" AcceptedAnswerId="26841" CreationDate="2015-11-03T14:26:18.000" Score="2" ViewCount="1530" Body="&lt;p&gt;I have a gaussian signal $x$ with zero mean and unit variance. I am quantizing it by using a uniform quantizer of step size $q$ calculated by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$q = \frac{x_\mathrm{max} - x_\mathrm{min}}{2^{M_\mathrm{ENOB}}},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $M_\mathrm{ENOB}$ is the effective number of bits. Is this the correct way of quantizing a Gaussian signal?&lt;/p&gt;&#xA;" OwnerUserId="17940" LastEditorUserId="1606" LastEditDate="2015-11-03T15:31:01.067" LastActivityDate="2021-08-02T08:28:45.663" Title="Uniform quantizer for gaussian input signal" Tags="|digital-communications|gaussian|random|quantization|analog-to-digital|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26840" PostTypeId="1" AcceptedAnswerId="26855" CreationDate="2015-11-03T14:49:03.507" Score="6" ViewCount="6820" Body="&lt;p&gt;What does 'canonical' mean? &#xA;e.g. 'write IIR or FIR in canonical form'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the gist of it but maybe someone here has a precise definition. In a non-DSP context it would mean something like 'strictly by the book', and perhaps in a DSP context this would mean 'without considering implementation issues'. Is this true?&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="15892" LastEditDate="2015-11-03T21:52:08.853" LastActivityDate="2021-05-29T12:18:00.230" Title="What does 'canonical' mean?" Tags="|filter-design|dsp-core|terminology|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26841" PostTypeId="2" ParentId="26839" CreationDate="2015-11-03T15:27:33.283" Score="2" Body="&lt;p&gt;The problem with quantizing Gaussian distributed signals (like the real/imaginary part of an OFDM signal) is that they can take any value in theory. It is thus necessary to clip such signals at threshold $C$ prior to quantization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low $C$ increases the distortion noise in this process, while large $C$ will lead to strong quantization noise. It can be shown, that there is an optimum value for $C$ that depends on the variance $\sigma^2$ of the signal and the quantizer resolution $M$. For details see [1,2]. After $C$ has been determined, the step size $q$ is calculated by&#xA;$$&#xA;q=\frac{2C}{2^M}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, I don't think it makes sense to use the ENOB (of a DAC) for calculating the step size. The ENOB is a kind of signal-to-noise ratio combining quantization noise and other effects like frequency selectivity and spurious frequencies of the DAC device. The number of input bits is still the nominal number of bits $M$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: let $\sigma^2=1$ and $M=8$. Then with eq. (7) from [2] we can calculate the SNR $\gamma$ after clipping and quantization as a function of the clipping ratio $\zeta=C^2/\sigma^2$. The SNR should be maximized. I don't know a closed-form expression for the optimum $\zeta_\mathrm{opt}$ yielding $\gamma_\mathrm{max}$ but we can determine it numerically. For $M=8$ and with Fig. 2 from [2] we have $\zeta_\mathrm{opt} \approx 11.87\,\text{dB} \approx 15.38$. Furthermore, $C_\mathrm{opt}=\sqrt{\zeta_\mathrm{opt}\sigma^2}$ and with $\sigma^2=1$ we finally get $C_\mathrm{opt}\approx3.92$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Remark&lt;/strong&gt;: as you tagged this question &lt;a href=&quot;/questions/tagged/digital-communictions&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;digital-communictions&amp;#39;&quot; rel=&quot;tag&quot;&gt;digital-communictions&lt;/a&gt; you might be dealing with complex signals. In that case be careful with the definition of $\sigma^2$. In my answer it is the variance of a real-valued, Gaussian distributed signal. If the signal in question is complex-valued with independent and identically Gaussian distributed real and imaginary part, it has variance $2\sigma^2$, where $\sigma^2$ is the variance of the real or imaginary part.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;References&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] D. J. G. Mestdagh, P. Spruyt, and B. Biran, “Analysis of clipping effect in DMT-based ADSL systems,” in Communications, 1994. ICC’94, SUPERCOMM/ICC'94, Conference Record,'Serving Humanity Through Communications.'IEEE International Conference on, 1994, pp. 293–300.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] M. Bernhard, D. Rörich, T. Handte, and J. Speidel, “Analytical and numerical studies of quantization effects in coherent optical OFDM transmission with 100 Gbit/s and beyond,” in ITG Symposium on Photonic Networks, 2012, pp. 34–40. &lt;a href=&quot;https://www.researchgate.net/publication/259829414_Analytical_and_numerical_studies_of_quantization_effects_in_coherent_optical_OFDM_transmission_with_100_Gbits_and_beyond&quot; rel=&quot;nofollow&quot;&gt;Online&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1606" LastEditorUserId="1606" LastEditDate="2015-11-04T09:51:53.967" LastActivityDate="2015-11-04T09:51:53.967" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26842" PostTypeId="2" ParentId="26840" CreationDate="2015-11-03T15:30:20.963" Score="6" Body="&lt;p&gt;A &lt;em&gt;canonical implementation&lt;/em&gt; of a digital filter has the minimum number of delay elements. The same filter cannot be implemented with less memory. Since memory is often not the only concern, a canonical implementation is not necessarily always the best implementation on a given platform.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-03T15:30:20.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26843" PostTypeId="2" ParentId="26832" CreationDate="2015-11-03T15:50:30.197" Score="1" Body="&lt;ul&gt;&#xA;&lt;li&gt;G(s) is unstable because the step-response doesn't have a steady-state value. It goes to infinity.&lt;/li&gt;&#xA;&lt;li&gt;F(s) is stable since its step response has a steady-state value near 0.1. It's underdamped response.&lt;/li&gt;&#xA;&lt;li&gt;Fh(s) is stable since its step response has a steady-state value near 0.2. It's underdamped response with more oscillations than F(s).&lt;/li&gt;&#xA;&lt;li&gt;Fl(s) is unstable because it doesn't have a steady-state value. It has a very large oscillations that start after some time.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11628" LastActivityDate="2015-11-03T15:50:30.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26844" PostTypeId="2" ParentId="26818" CreationDate="2015-11-03T16:29:09.793" Score="1" Body="&lt;p&gt;I think I've managed to implement your system, but in &lt;code&gt;R&lt;/code&gt; rather than matlab (sorry, I have no access to matlab and &lt;code&gt;scilab&lt;/code&gt; stopped working for me on OSX).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The implementation gives the following estimates of the position and velocity, and seems to work even with the large velocity noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top plot is the true (red), noisy (black), and estimated (blue) position. The bottom plot is the true (red), noisy (black), and estimated (blue) velocity.  I've zoomed in on the bottom plot to see the true and estimated values because the noise is so large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MJSJZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MJSJZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To your questions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My question is: how can I find Q and R?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, from my code Q is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  Q &amp;lt;- matrix(c(0,0,0,0,0,0,0,0,1),3,3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which would be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  Q = [0,0,0; 0,0,0 ; 0,0,1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in matlab, I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And R is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  R &amp;lt;- matrix(c(0.001,0,0,20),2,2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  R = [0.001 0; 0 20];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've generated my acceleration as a vector that is &lt;code&gt;T&lt;/code&gt; long with a variance of 1; you seem to have generated just one value for it with a variance of 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the second part of your question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does it depend of what I want to do?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally, the better the values the Kalman filter use match the &quot;true&quot; values, the better the Kalman filter estimates the state.  I say &quot;true&quot; instead of true because sometimes we can't know what the truth is, so we have to guess it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only leeway I see in what you've presented is what the value if &lt;code&gt;Q&lt;/code&gt; is. It's not clear to me what variance you assumed the acceleration to have.  If it is a constant, then the variance will be zero; if it's a Gaussian random variable, then you'll need to set the Q matrix using the variance of that random variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this all assumes that the process noise and the measurement noise are uncorrelated (or independent). If there is correlation, then you'll somehow need to take that into account.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  # 26818&#xA;  T &amp;lt;- 128;&#xA;  dt &amp;lt;- 0.01&#xA;&#xA;  t &amp;lt;- seq(0,T-1)*dt&#xA;&#xA;  xkm1km1 &amp;lt;- matrix(c(0, 0, 0),3,1)&#xA;  Pkm1km1 &amp;lt;- matrix(c(1000,0,0 ,0,1000,0, 0,0,1000),3,3)&#xA;  #H = [1 0 0&#xA;  #     0 1 0];&#xA;  H &amp;lt;- matrix(c(1,0,0,1,0,0),c(2,3)) &#xA;&#xA;  #F = [ 1 dt dt^2/2&#xA;  #      0  1 dt&#xA;  #      0  0 1];&#xA;  A &amp;lt;- t(matrix(c(1,dt,dt^2/2,0,1,dt,0,0,0),3,3))&#xA;  B &amp;lt;- matrix(c(0,0,1),c(3,1))&#xA;&#xA;  true_acceleration &amp;lt;- rnorm(T,0,1)&#xA;  measurement &amp;lt;- t(matrix(rep(0,T*2),c(2,T)))&#xA;  x &amp;lt;- t(matrix(rep(0,T*3),c(3,T)))&#xA;&#xA;  position_noise &amp;lt;- rnorm(T,0,0.001)&#xA;  velocity_noise &amp;lt;- rnorm(T,0,20)&#xA;&#xA;  v &amp;lt;- t(array(c(position_noise, velocity_noise),c(T,2)))&#xA;&#xA;  Q &amp;lt;- matrix(c(0,0,0,0,0,0,0,0,1),3,3)&#xA;  R &amp;lt;- matrix(c(0.001,0,0,20),2,2)&#xA;&#xA;&#xA;  # Generate the data using the signal model&#xA;  for (k in 2:T)&#xA;  {&#xA;    x[k,] = A %*% x[k-1,] + B * true_acceleration[k-1]&#xA;    measurement[k,] = H %*% x[k,] + v[,k]&#xA;  }&#xA;&#xA;  library(&quot;MASS&quot;) # For pseudo inverse ginv()&#xA;&#xA;  zhat &amp;lt;- matrix(rep(0,2*T),c(T,2))&#xA;&#xA;  for (k in 1:T)&#xA;  {&#xA;    xkkm1 &amp;lt;- A %*% xkm1km1&#xA;    Pkkm1 &amp;lt;- A %*% Pkm1km1 %*% t(A) + Q&#xA;    K &amp;lt;- Pkkm1 %*% t(H) %*% ginv( H %*% Pkkm1 %*% t(H) + R)&#xA;    z &amp;lt;- matrix(c(measurement[k,]), 2, 1)&#xA;    xkm1km1 &amp;lt;- xkkm1 + K %*% (z - H %*% xkkm1)&#xA;    Pkm1km1 &amp;lt;- (matrix(c(1,0,0,0,1,0,0,0,1),3,3) - K %*% H) %*% Pkkm1  &#xA;    zhat[k,] &amp;lt;- as.numeric(H %*% xkkm1)&#xA;  }&#xA;&#xA;  par(mfrow=c(2,1))&#xA;  plot(t, measurement[,1], type=&quot;b&quot;, pch=19)&#xA;  lines(t, x[,1], col=&quot;red&quot;,  lwd=10)&#xA;  lines(t, zhat[,1], col=&quot;blue&quot;, lwd=5)&#xA;&#xA;  plot(t, measurement[,2], type=&quot;b&quot;, pch=19, ylim=c(-1,1))&#xA;  lines(t, x[,2], col=&quot;red&quot;,  lwd=10)&#xA;  lines(t, zhat[,2], col=&quot;blue&quot;, lwd=5)&#xA;&#xA;&#xA;  errs &amp;lt;- c(sum((signal - zhat)^2), sum((signal - lpf)^2))&#xA;  print(errs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-03T17:09:47.793" LastActivityDate="2015-11-03T17:09:47.793" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26851" PostTypeId="1" AcceptedAnswerId="26853" CreationDate="2015-11-03T20:19:10.697" Score="0" ViewCount="832" Body="&lt;p&gt;I have a periodic signal like this one with period $T=120$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CsThP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CsThP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to apply a bandstop filter to the signal, the stop band should go from 90% of $\frac{1}{T}$ to 110% of $\frac{1}{T}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I run this code in Octave&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A=-ones(1,35);&#xA;B=ones(1,45);&#xA;C=-ones(1,20);&#xA;D=ones(1,20);&#xA;E=[A B C D];&#xA;x=repmat(E,[1 6]);&#xA;&#xA;figure&#xA;plot(x,'b');&#xA;axis([1 numel(x) -1.5 1.5]);&#xA;title('Input signal');&#xA;print -dpng input.png&#xA;&#xA;&#xA;figure&#xA;plot(x,'b');&#xA;axis([1 numel(x) -1.5 1.5]);&#xA;&#xA;&#xA;signal_period=numel(E);&#xA;signal_frequency=1/signal_period;&#xA;&#xA;sampling_period=1;&#xA;sampling_frequency=1/sampling_period;&#xA;&#xA;% &quot;The Nyquist frequency is half the sample rate&quot;,&#xA;% from http://it.mathworks.com/help/signal/ref/fir1.html#inputarg_Wn&#xA;Nyquist_frequency=sampling_frequency/2;&#xA;&#xA;signal_normalized_frequency = signal_frequency/Nyquist_frequency;&#xA;&#xA;b = fir1(40,[0.9*signal_normalized_frequency 1.1*signal_normalized_frequency],'stop');&#xA;y = filter(b,1,x);&#xA;&#xA;hold on&#xA;plot(y,'r');&#xA;title('Input (blue), output (red)');&#xA;&#xA;print -dpng filter_response.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I get this filtered signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/juWNO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/juWNO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would expect an attenuation of the signal but I only get a slightly &quot;delayed&quot; signal with some &quot;ringing&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I made a mistake in &lt;code&gt;fir1&lt;/code&gt; with the definition of the lower and&#xA;upper cutoff frequencies, perhaps I do not understand the normalized&#xA;frequency concept?&lt;/li&gt;&#xA;&lt;li&gt;Maybe the cutoff frequencies are too low? The frequency response of the filter is the following:&lt;a href=&quot;https://i.stack.imgur.com/Kvw0V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kvw0V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; and I cannot see the classical &quot;deep&quot; stop band of a notch filter in the magnitude graph.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3573" LastActivityDate="2015-11-03T20:51:55.053" Title="I do not understand this simple bandstop filter example" Tags="|matlab|filters|bandwidth|digital-filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26852" PostTypeId="2" ParentId="26851" CreationDate="2015-11-03T20:45:51.907" Score="2" Body="&lt;p&gt;fir1 designs your filter using a Hamming window one bin larger than the degree you specify. 41 bins is too small to give you the frequency resolution you want. Try a much larger degree, say 300-600.&lt;/p&gt;&#xA;" OwnerUserId="7883" LastActivityDate="2015-11-03T20:45:51.907" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26853" PostTypeId="2" ParentId="26851" CreationDate="2015-11-03T20:51:55.053" Score="1" Body="&lt;p&gt;The problem is that you need the stopband to be very close to 0, which is hard to do; this is why your filter looks like a high-pass. There are two possibilities: reduce the sampling rate, so that &lt;code&gt;1/T&lt;/code&gt; is not so close to 0, or increase the filter order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried increasing the filter order with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T = 120;&#xA;fN = 0.5;&#xA;s1 = 0.9/T;&#xA;s2 = 1.1/T;&#xA;b = fir1(400, [s1, s2]/fN, 'stop');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I don't use Octave any more, but on Matlab I got this filter response with &lt;code&gt;freqz(b)&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u8TYu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u8TYu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To try downsampling the signal, you can try commands such as &lt;code&gt;downsample&lt;/code&gt; and &lt;code&gt;resample&lt;/code&gt; (again, from Matlab, but I seem to recall Octave has equivalents to these). Note that, even in this case, you may need to increase the order to obtain the kind of rejection you require.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-11-03T20:51:55.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26855" PostTypeId="2" ParentId="26840" CreationDate="2015-11-03T21:44:03.263" Score="7" Body="&lt;p&gt;The etymology refers to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Canon_%28basic_principle%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;canon&lt;/a&gt;, as &lt;strong&gt;a rule&lt;/strong&gt; or &lt;strong&gt;a body of rules&lt;/strong&gt;, or &lt;strong&gt;axiomatic or universal standards&lt;/strong&gt;. It exists in arts: sculpture, music, script writing, etc. The notion of &lt;a href=&quot;https://en.wikipedia.org/wiki/Canon_law&quot; rel=&quot;nofollow noreferrer&quot;&gt;canon law&lt;/a&gt; is also used in the domain of religion: a &amp;quot;set of ordinances and regulations [...] for the government of a Christian organization or church and its members&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;In mathematics  and engineering, a &lt;a href=&quot;https://en.wikipedia.org/wiki/Canonical_form&quot; rel=&quot;nofollow noreferrer&quot;&gt;canonical form&lt;/a&gt; is, similarly, a preferred notation, or a somehow unique and natural form, or representation, of an object or a formula. For instance, a canonical basis is one of the many bases of a vector space (or an algebraic structure in general), but a basis that is unique by its simplicity, like &lt;a href=&quot;https://en.wikipedia.org/wiki/Canonical_basis&quot; rel=&quot;nofollow noreferrer&quot;&gt;the standard basis defined by the Kronecker delta&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \left\{&#xA;                \begin{array}{ccccc}&#xA;                  1 &amp;amp;0 &amp;amp; 0 &amp;amp; 0&amp;amp; \ldots\\&#xA;                  0 &amp;amp;1 &amp;amp; 0 &amp;amp; 0&amp;amp; \ldots\\&#xA;                  0 &amp;amp;0 &amp;amp; 1 &amp;amp; 0&amp;amp; \ldots\\&#xA;                \end{array}&#xA;              \right\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;http://fr.mathworks.com/help/fixedpoint/ug/canonical-forms.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;some sources&lt;/a&gt;, &lt;strong&gt;for linear digital filters, canonical forms refer to sets of structures that are optimal in some sense&lt;/strong&gt;, with respect to some basic operations (available to a processor, for instance). The most common is the reduction of the number of delays, it is often associated with the name &amp;quot;&lt;a href=&quot;https://ccrma.stanford.edu/%7Ejos/fp/Direct_Form_II.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Direct Form II&lt;/a&gt;&amp;quot; (excellent online tutorial by J. O. Smith):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In summary, the DF-II structure has the following properties [...] It&#xA;is canonical with respect to delay&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In theory, one could look for canonical forms with respect to others quantities. In practice, the delay minimization is the most standard, thus the most canonical of the canonical forms. By &lt;a href=&quot;https://en.wikipedia.org/wiki/Metonymy&quot; rel=&quot;nofollow noreferrer&quot;&gt;metonymy&lt;/a&gt;, the delay canonical form is thus called &amp;quot;the canonical form&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Other occurences of canonical forms may appear with state-space formulations for filters. In control theory, one may find for instance &lt;a href=&quot;https://en.wikibooks.org/wiki/Control_Systems/Standard_Forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Observable Canonical Forms and Controllable Canonical Forms&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2021-05-29T12:18:00.230" LastActivityDate="2021-05-29T12:18:00.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26856" PostTypeId="2" ParentId="13119" CreationDate="2015-11-03T22:26:58.140" Score="0" Body="&lt;p&gt;The signal does not look very noisy in the common sense (not so many &quot;hairs&quot; on the peaks). Meanwhile, I seem to see an oscillating trend, and peaks of different widths. Sounds like the stationarity of the signal is not evident at first look. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you might find useful to first look at a time-frequency representation. For instance, perform a FFT on small windows, and slide them for each new sample in time. Cutting such windows stationarizes your signal, and help you spot other properties. With for instance &lt;code&gt;specgram&lt;/code&gt;in Matlab, or the &lt;a href=&quot;http://tftb.nongnu.org/&quot; rel=&quot;nofollow&quot;&gt;Time-Frequency toolbox&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-11-03T22:26:58.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26857" PostTypeId="1" CreationDate="2015-11-04T00:17:12.260" Score="2" ViewCount="531" Body="&lt;p&gt;I am a little confused about how resampling works with one filter. I get why you choose the lower nyquist cutoff when you combine both interpolation and decimation for resampling by a rational fraction (you don't want to alias and you only get one shot to take care of it when you combine interpolation+decimation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will use a practical example: $44.1 \, \textrm{kHz}$ to $48\, \textrm{kHz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(44100 / 48000) = (441 / 480) = (147 / 160)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining $147$ decimation factor by $160$ interpolation, you can use one anti-alias:&#xA;at $44.1/2= 22050\,\textrm{Hz} $ cutoff for a lowpass FIR. However, you still need to zero stuff, right? But how much? 160 zeroes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going the other way around $48 \, \textrm{kHz}$ to $44.1\, \textrm{kHz}$, how many samples do you downsample? Certainly not 147 zeroes? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is $160 - 147 = 13$ zeroes the answer?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the multi-stage solution, here's how this would work (I think): Stuff $160$ zeroes, anti-alias lowpass at $24\, \textrm{kHz}$. Downsample the output by $147$, antialias lowpass at $22050 \, \textrm{Hz}$. But wait, you're not computing outputs for a lot of those zeroes, so why not just combine the two? Does this leave me with $13$ zeroes for resampling up and $13$ samples to skip over when resampling down before applying the lower of the two cutoffs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next thing to wrap my head around: polyphase filterbanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; source of confusion is in last comment to answer, interpolate is upsampling followed by anti-image filter while decimation is anti-alias followed by downsampling. cascading these two obviates the need for two separate filters. if this is the case then would this mean that resampling by a rational factor &amp;lt; 1 entails 2 filters always by the nature of the decimation/interpolation process, while a resample factor &gt; 1 entails that 1 filter may be used instead?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;DOUBLE EDIT:&lt;/strong&gt; thinking about it, you can still use 1 filter, but you must interpolate first, then anti-alias, then decimate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;sorry (definitely not sorry) this is how my brain debugs its malformed thoughts on DSP (:&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-11-04T02:38:00.437" LastActivityDate="2015-11-04T02:38:00.437" Title="Resampling: how many samples to zero-stuff or down sample?" Tags="|interpolation|resampling|decimation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26858" PostTypeId="2" ParentId="26857" CreationDate="2015-11-04T00:38:15.710" Score="2" Body="&lt;p&gt;When you up sample by 160, if you wanted to filter twice, you would actually be applying an &quot;anti-image&quot; filter.  The next filter for decimation would be the &quot;anti-alias&quot; filter.  But in you case, you could just use the anti alias filter once and accomplish the same.  I think perhaps you need to consider what zero stuffing means, to put so many zeros between samples and decimate is to throw away so many samples inbetween. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Btw, you do compute samples for the zeros when you filter.  If you want to understand better, try plotting the spectrum of each stage, and what would happen if only using the 13.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand your question properly, you would effective just upsampling by 13, filter, then downsample.  You'd be back where you started&lt;/p&gt;&#xA;" OwnerUserId="18099" LastEditorUserId="18099" LastEditDate="2015-11-04T01:02:35.037" LastActivityDate="2015-11-04T01:02:35.037" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="26859" PostTypeId="1" CreationDate="2015-11-04T02:35:06.653" Score="4" ViewCount="2490" Body="&lt;p&gt;I am trying to find a way to analytically estimate how the noise (or variance in pixel values) will be affected for a zero-frequency image of random noise &lt;strong&gt;after&lt;/strong&gt; applying a Gaussian blur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more detail, say I have an image of pixels with an average $ μ $ and random noise of variance $ σ_{0}^{2} $. The image has no features in it, but is simply that normal noise. I now apply a Gaussian blur (or Gaussian filter) with a kernel of standard deviation $ σ_{G} $. I would like a way to analytically estimate (and I know it will have to be an approximation) what the variance of the pixel values in the &lt;strong&gt;filtered&lt;/strong&gt; image will be ($ σ_{f}^{2} $).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_blur#Variance_reduction&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt; has an equation that clearly states what I need. However, they do not have any references and I will like to have a stronger reference for it. I have been unable to find this anywhere else. Any ideas where I'll be able to find this? Does anyone know if that is the correct equation? And maybe how to derive it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for your help! Every little contribution helps!&lt;/p&gt;&#xA;" OwnerUserId="18108" LastEditorUserId="128" LastEditDate="2018-07-16T19:33:56.423" LastActivityDate="2018-07-16T19:33:56.423" Title="How Does Gaussian Blur Affect Image Variance" Tags="|image-processing|noise|gaussian|blur|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26860" PostTypeId="1" AcceptedAnswerId="26871" CreationDate="2015-11-04T02:51:55.763" Score="0" ViewCount="277" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Considering non-linear filtering technique like Extended Kalman filtering with Expectation Maximization (EM). EM is an iterative technique but what is Kalman filtering? Is Kalman Filtering called iterative approach? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Adaptive signal processing algorithms like Least Mean Square and Recursive Least square (RLS) estimate weights at each time instant and then update them. Since, RLS has a recursive nature and it falls under adaptive technique, then does this mean that adaptive is another name for recursive? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the difference between adaptive and iterative terminologies? Are Kalman filtering and its nonlinear versions adaptive?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Q1: In short, is adaptive=recursive=iterative? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: Where is EM and Kalman Filtering approaches categorized under and why?&lt;/p&gt;&#xA;" OwnerUserId="780" LastActivityDate="2015-11-04T15:40:00.433" Title="Terminologies: Adaptive, recursive and iterative" Tags="|adaptive-filters|self-study|terminology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26861" PostTypeId="1" AcceptedAnswerId="26863" CreationDate="2015-11-04T03:09:44.140" Score="6" ViewCount="1202" Body="&lt;p&gt;Let the equalizer coefficients obtained, say $w$ and the input to the equalizer is $y$ that is a noise corrupted received signal, $rx$ then the equalized signal, which is the output of the FIR based equalizer, should be equal to the transmitted signal / source signal. This is the working principle. But, we often perform the operation : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;equalizer_output = filter(w,1,rx).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 1&lt;/strong&gt;: Most equalizers are modeled as FIR filter. My Question is why? I  do not understand how this operation gives the input or how is this performing deconvolution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2&lt;/strong&gt;:  For example considering a single input single output channel, $x$ is a BPSK modulated source signal and there is multipath fading with 3 taps (not Rayleigh), then the transmitted signal is &#xA;$$y(t) = h(1).x(t-1) + h(2).x(t-2) + h(3).x(t-3) + x(t)+ w(t)$$ where $w$ is the Additive White Gaussian measurement / channel noise. The above model is FIR model and not any filter. This is not the equalizer. In order to devise an equalizer inorder to get the input $x$, do we again devise a FIR filter as an equalizer whose input would be $y$? $h$ is the channel impulse response but it is not any model as such.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 3&lt;/strong&gt;: When do we model a channel as an IIR model and then the equalizer would be an IIR or FIR filter?&lt;/p&gt;&#xA;" OwnerUserId="780" LastEditorUserId="4298" LastEditDate="2020-11-01T15:36:18.903" LastActivityDate="2022-07-18T12:47:56.920" Title="Why are equalizers moving average model (FIR)" Tags="|filters|finite-impulse-response|equalization|self-study|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26862" PostTypeId="1" CreationDate="2015-11-04T06:06:09.303" Score="0" ViewCount="771" Body="&lt;p&gt;I have a question about image gradient magnitude, given an image $I$. The horizontal and vertical derivatives resulting from Sobel filters are defined as:&#xA;$$K_x=&#xA;        \begin{bmatrix}&#xA;        -1 &amp;amp; 0 &amp;amp; 1 \\&#xA;        -2 &amp;amp; 0 &amp;amp; 2 \\&#xA;        -1 &amp;amp; 0 &amp;amp; 1 \\&#xA;        \end{bmatrix}*I;&#xA;K_y=&#xA;        \begin{bmatrix}&#xA;        -1 &amp;amp; -2 &amp;amp; -1 \\&#xA;         0 &amp;amp; 0 &amp;amp; 0 \\&#xA;         1 &amp;amp; 2 &amp;amp; 1 \\&#xA;        \end{bmatrix}*I&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $*$ denotes the convolution operator. The gradient magnitudes can be computed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I_{\delta}=\sqrt{(K_x^2+K_y^2)}$$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I want to &quot;invert&quot; the result of $I_{\delta}$, so that maximum magnitude gradient values become zero. Then the &quot;inverting&quot; function $g$ is&#xA;$$g(I_{\delta})=\max (I_{\delta}) - I_{\delta}\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: is $I_{\delta}$ scalar or vector? &#xA;What do you think? If it is possible, could you correct help me.&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="15892" LastEditDate="2015-11-15T11:04:35.220" LastActivityDate="2015-11-15T11:04:35.220" Title="Magnitude of Sobel filter result, vector or scalar?" Tags="|filters|computer-vision|image-processing|image-segmentation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26863" PostTypeId="2" ParentId="26861" CreationDate="2015-11-04T08:36:17.257" Score="6" Body="&lt;p&gt;The reason why almost all linear adaptive equalizers are implemented as FIR filters is that FIR filters are always stable and that there exist relatively simple and effective adaptation algorithms. Note that much work has been done on adaptive IIR filters (e.g., &lt;a href=&quot;https://books.google.nl/books/about/Adaptive_IIR_Filtering_in_Signal_Process.html?id=B6XvNqWjUrAC&amp;amp;redir_esc=y&quot;&gt;this book&lt;/a&gt; by Phillip Regalia), but in practice FIR filters are still the preferred option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that no real-world channel can be ideally equalized by an FIR filter, but that's not as bad as it may seem because an FIR filter can &lt;em&gt;approximate&lt;/em&gt; the ideal equalizer reasonably well if its filter length is chosen appropriately and if the adaptation algorithm is tuned to the application. Also, perfect equalization of the channel is not always desired if the channel is not only dispersive (i.e., acts a filter) but if it also introduces noise. In this case a combined criterion is used that takes into account the ISI due to the dispersive channel as well as the degradation due to the noise.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-04T08:36:17.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26864" PostTypeId="2" ParentId="26812" CreationDate="2015-11-04T10:28:21.533" Score="2" Body="&lt;p&gt;This is an exact solution to the problem. First, a few remarks on what can be achieved and what can't. Unless the pole angle is $\theta=\pi/2$ the response will by asymmetrical, so it's not possible to have the same magnitude response at $\omega_0+\Delta$ and $\omega_0-\Delta$, where $\omega_0$ is the frequency where the amplitude has its peak. Also note that in general $\omega_0\neq\theta$, so the pole angle does not coincide with the location of the maximum. For a large pole radius $r$ and a pole angle $\theta$ not too close to $\omega=0$ and $\omega=\pi$, the pole angle approximates $\omega_0$ reasonably well, but in general it doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The derivations are a bit tedious, so I will present a cookbook solution, proving its correctness by examples. We're talking about a second order all-pole filter with two complex conjugate poles at $z=re^{j\theta}$ and $z=re^{-j\theta}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1}{(1-re^{j\theta}z^{-1})(1-re^{-j\theta}z^{-1})}=\frac{1}{1-2r\cos(\theta)z^{-1}+r^2z^{-2}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to find $r$ and $\theta$ such that the maximum of $|H(e^{j\omega})|$ occurs at a given value $\omega_0$, and such that its value at $\omega_0\pm\Delta$ is half the maximum value. Since in general not both values at $\omega_0+\Delta$ and $\omega_0-\Delta$ can be identical, we choose to specify the value at $\omega_0+\Delta$ if $\omega_0&amp;lt;\pi/2$, and at $\omega_0-\Delta$ if $\omega_0\ge\pi/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the steps for computing the required values of $r$ and $\theta$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Choose the desired peak frequency $\omega_0$ such that $0&amp;lt;\omega_0&amp;lt;\pi$, and the desired width $\Delta$ such that the magnitude assumes half of its peak value at $\omega_0+\Delta$ or at $\omega_0-\Delta$, depending on the value of $\omega_0$ (see below).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Define constants&#xA;$$\begin{align}B&amp;amp;=2\cos(\omega_0)\cos(\omega_x)-\cos^2(\omega_x)\\&#xA;C&amp;amp;=4\cos^2(\omega_0)\\a&amp;amp;=\frac43(B-C)\\b&amp;amp;=\frac23(4B+2C-3)\end{align}$$&#xA;where $\omega_x=\omega_0+\Delta$ if $\omega_0&amp;lt;\pi/2$, and $\omega_x=\omega_0-\Delta$ otherwise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Solve the following quartic equation for $R$:&#xA;$$R^4+aR^3+bR^2+aR+1=0$$&#xA;Of the four solutions, choose the one which is real-valued and which satisfies $0&amp;lt;R&amp;lt;1$. This solution is given by&#xA;$$R=\frac{x}{2}-\sqrt{\frac{x^2}{4}-1}\qquad\text{with}\quad x=-\frac{a}{2}+\sqrt{\frac{a^2}{4}-b+2}\tag{2}$$&#xA;The pole radius is then obtained as $r=\sqrt{R}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute the pole angle from $r$ and $\omega_0$:&#xA;$$\cos(\theta)=\frac{2r}{1+r^2}\cos(\omega_0)$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The figure below illustrates some designs. $(a)$: $\omega_0=\pi/2$, d=$0.1\pi$, $(b)$: $\omega_0=0.2\pi$, $d=0.05\pi$, $(c)$: $\omega_0=0.8\pi$, $d=0.2\pi$, $(d)$ $\omega_0=0.6\pi$, $d=0.02\pi$.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/tGrN5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tGrN5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-07T15:47:31.103" LastActivityDate="2015-11-07T15:47:31.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26866" PostTypeId="1" AcceptedAnswerId="26869" CreationDate="2015-11-04T11:37:19.410" Score="1" ViewCount="3158" Body="&lt;p&gt;How do you remove a specific frequency from a signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a signal which is basically a sine wave at 20hz with some randomness added to it. After the real fft I can clearly identify the peak in the 20th bin, but when zeroing this bin and those sorrounding it and converting back to time domain the whole signal is gone for good, where I would expect to see the &quot;random&quot; part of the signal more or less intact.&lt;/p&gt;&#xA;" OwnerUserId="18112" LastEditorUserId="13320" LastEditDate="2016-11-21T12:36:50.767" LastActivityDate="2016-11-21T12:36:50.767" Title="Removing specific frequency from a signal" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26867" PostTypeId="1" CreationDate="2015-11-04T12:47:50.967" Score="3" ViewCount="9401" Body="&lt;p&gt;I am truly new to computer vision field, but it is fascinating me! I have now a challenge in my hands and I am seeking for mentors/advisers to give me some follow up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My project is: From a picture of a video-game cover, search that pic through a video-game cover database, and if there is a very good match the app will return a string with the name of the videogame and the platform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem example:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take a photo of a cover similar to this:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nP5ir.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nP5ir.jpg&quot; alt=&quot;query image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Cover match to this in the database:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GfI7t.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GfI7t.png&quot; alt=&quot;database image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;App gives string: &quot;Fifa 12 Playstation 2&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In my preliminary research I found that I should save in my cover database, the name of the game, the platform, the URL for the cover, and the image features (keypoints and descriptors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using SURF features detector/extractor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some concepts that I am still confused about... I am not looking for similarity right? I just need to observe if there are some sort of good keypoints-paired/matched, right? Because in the examples images mentioned before I get &quot;img1 - 1087 features (query image), img2 - 1755 features - 30 % - SIMILARITY - 321/333 inliers/matched&quot; What are the inliers? My calculation of similarity seems wrong to me... I would say that these two images are like 70 % look alike...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps: I am using Python so...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Results so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qpomo.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qpomo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time and help. Sorry If I could not explain any better my problems/concerns.&lt;/p&gt;&#xA;" OwnerUserId="18114" LastEditorUserId="80" LastEditDate="2015-11-04T15:14:13.873" LastActivityDate="2017-02-06T17:03:25.440" Title="How to verify if two images have the same object/content?" Tags="|image-processing|opencv|python|object-recognition|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26868" PostTypeId="2" ParentId="26861" CreationDate="2015-11-04T14:25:38.920" Score="2" Body="&lt;p&gt;Most of the books/articles on adaptive filters use the squared error as the optimization criterion. For FIR filters, the solution for the filter coefficients can be found using traditional least squares and can be made recursive via Recursive Least Squares (RLS). You can also get into order recursive schemes with lattice filter structure, but that is kind of out of scope for your question. Solution to the least squares is a global optimum and the filters are always stable.&lt;/p&gt;&#xA;&lt;p&gt;In the case of recursive or IIR adaptive filters, using the squared error objective function leads to non-linear least squares, so the solutions/algorithms often involve approximations. There is also the risk that that the algorithm gets stuck in a local minimum. As Matt mentioned in his answer - with adaptive IIR filters there is often the risk that the filter may be unstable. The instability may be due to the explicit placement of a pole(s), or it may result from coefficient quantization.&lt;/p&gt;&#xA;&lt;p&gt;As an example there is a notch filter developed by Nehorai (&lt;a href=&quot;https://ieeexplore.ieee.org/document/1164643&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;A minimal parameter adaptive notch filter with constrained poles and zeros,&amp;quot; Acoustics, Speech and Signal Processing, IEEE Transactions on  (Volume:33 ,  Issue: 4 )&lt;/a&gt;) which explicitly places the poles inside the unit circle, but these types of filters tend to have a small number of poles and have a very specific objective.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7092" LastEditDate="2022-07-18T12:47:56.920" LastActivityDate="2022-07-18T12:47:56.920" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="26869" PostTypeId="2" ParentId="26866" CreationDate="2015-11-04T15:09:40.873" Score="2" Body="&lt;p&gt;Below is a picture that has:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Top graph has the noiseless 20Hz sine wave sampled at 100Hz (blue) and the noisy sine wave (red).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bottom graph has the actual noise signal added (red) and the noisy signal filtered with an IIR notch filter with a notch centred at 20Hz (blue).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Apart from the group delay between the original noise and the output of the notch filter, the two are very similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;R code to implement this is below the graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UWBLF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UWBLF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response of the notch filter is as below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uuaQo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uuaQo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#26866&#xA;&#xA;f &amp;lt;- 20&#xA;fs &amp;lt;- 100&#xA;phi &amp;lt;- 2*pi*0.12987892374&#xA;&#xA;T &amp;lt;- 100&#xA;t &amp;lt;- 0:(T-1)&#xA;&#xA;signal &amp;lt;- sin(2*pi*f/fs*t+phi)&#xA;noise &amp;lt;-  rnorm(T,0,1)&#xA;noisy_signal &amp;lt;- signal + noise&#xA;&#xA;alpha &amp;lt;- 0.9&#xA;&#xA;num &amp;lt;- c(1, -2*cos(2*pi*f/fs), 1)&#xA;den &amp;lt;- c(1, -2*alpha*cos(2*pi*f/fs), alpha*alpha)&#xA;&#xA;filtered &amp;lt;- signal::filter(num,den,noisy_signal)&#xA;&#xA;par(mfrow=c(2,1))&#xA;plot(noisy_signal, type=&quot;l&quot;, col=&quot;red&quot;,  lwd=10)&#xA;lines(signal, type=&quot;l&quot;, col=&quot;blue&quot;, lwd = 3)&#xA;title(&quot;Noiseless signal (blue) and noisy signal (red)&quot;)&#xA;&#xA;plot(filtered, col=&quot;blue&quot;, lwd = 4)&#xA;lines(noise, col=&quot;red&quot;,  lwd=3)&#xA;title(&quot;Filtered signal (blue) and original noise signal (red)&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-04T15:09:40.873" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26870" PostTypeId="2" ParentId="26862" CreationDate="2015-11-04T15:29:08.623" Score="1" Body="&lt;p&gt;Pretty much by definition, the magnitude of anything is a scalar value.  Though, since you are working on an image, the result is a 2D array of scalar values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given Kx and Ky, it's also possible to work out the directions of the edges, as well as the magnitudes, but that's a whole different bit of maths.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-11-04T15:29:08.623" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26871" PostTypeId="2" ParentId="26860" CreationDate="2015-11-04T15:40:00.433" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Q1: In short, is adaptive=recursive=iterative?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Filtering is applying a filter $f$ to an input signal $x$ to get an output signal $y$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(t) = f(x(t), t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter $f$ is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Iteration&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;iterative&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; if its next value can be calculated from other time-dependent values of either $x$ or $y$ or both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter $f$ is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Recursion&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;recursive&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; if it depends on $y$ for some time $s \le t$ (where $t$ is the current time). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the way $f$ uses past values of $y$ to filter $x$ changes, then the filter $f$ is also &lt;a href=&quot;https://en.wikipedia.org/wiki/Adaptive_filter&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;em&gt;adaptive&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the filter:&#xA;$$&#xA;y(t) = x(t) &#xA;$$&#xA;is iterative, but &lt;strong&gt;not&lt;/strong&gt; recursive &lt;strong&gt;nor&lt;/strong&gt; adaptive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the filter:&#xA;$$&#xA;y(t) = x(t) + \alpha y(t-1)&#xA;$$&#xA;is both iterative and recursive, but &lt;strong&gt;not&lt;/strong&gt; adaptive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the filter:&#xA;$$&#xA;y(t) = x(t) + \alpha(y,x) y(t-1)&#xA;$$&#xA;is &lt;strong&gt;both&lt;/strong&gt; recursive and adaptive (the filter coefficient $\alpha$ depends on some function of past inputs $x$ and past outputs $y$).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Q2: Where is EM and Kalman Filtering approaches categorized under and why?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Kalman filtering is definitely &lt;strong&gt;iterative&lt;/strong&gt; and &lt;strong&gt;recursive&lt;/strong&gt; as the new updates will depend on past values of the input and output (well state estimates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard implementation of the Kalman filter is &lt;strong&gt;not adaptive&lt;/strong&gt;.  However, there are simple extensions that make it adaptive.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-04T15:40:00.433" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26872" PostTypeId="1" AcceptedAnswerId="26874" CreationDate="2015-11-04T16:00:11.367" Score="2" ViewCount="83" Body="&lt;p&gt;I was wondering is there a way(some code or functions) to convert an image with specific number of pixels into a picture with more pixels in matlab(enlarging the size or the number of the picture)?&lt;/p&gt;&#xA;" OwnerUserId="17979" LastEditorUserId="17979" LastEditDate="2015-11-05T16:36:48.270" LastActivityDate="2015-11-05T16:36:48.270" Title="Enlarging a picture by adding pixels in matlab" Tags="|image-processing|matlab|" AnswerCount="2" CommentCount="1" ClosedDate="2015-11-04T17:08:02.860" ContentLicense="CC BY-SA 3.0" />
  <row Id="26873" PostTypeId="2" ParentId="26872" CreationDate="2015-11-04T16:13:05.793" Score="0" Body="&lt;p&gt;Yes, you can use imread to get the image values, interp2 for the interpolation, and imwrite to make a new file.  Pay attention to data format and scaling.  Read the docs for these 3 functions and you should be ok&lt;/p&gt;&#xA;" OwnerUserId="18099" LastActivityDate="2015-11-04T16:13:05.793" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26874" PostTypeId="2" ParentId="26872" CreationDate="2015-11-04T16:58:17.363" Score="0" Body="&lt;p&gt;If you have the Image Processing Toolbox then you might want to use the &lt;a href=&quot;http://uk.mathworks.com/help/images/ref/imresize.html&quot; rel=&quot;nofollow&quot;&gt;imresize&lt;/a&gt; function. It allows you to choose various interpolation algorithms. Help is very clear on that.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-11-04T16:58:17.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26875" PostTypeId="1" AcceptedAnswerId="26879" CreationDate="2015-11-04T18:54:35.370" Score="0" ViewCount="272" Body="&lt;p&gt;I am studying a Notch filter. I found its Transfer Function (in Z) and its poles. How can I find the frequency of theses poles (which corresponds to the cut-off frequency)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help&lt;/p&gt;&#xA;" OwnerUserId="18087" LastEditorUserId="18085" LastEditDate="2015-11-05T14:25:18.493" LastActivityDate="2015-11-05T14:25:18.493" Title="Find the frequency of a pole (Discrete Form)" Tags="|frequency|" AnswerCount="1" CommentCount="1" ClosedDate="2015-11-06T14:20:20.830" ContentLicense="CC BY-SA 3.0" />
  <row Id="26876" PostTypeId="1" CreationDate="2015-11-04T19:39:43.247" Score="2" ViewCount="294" Body="&lt;p&gt;Recently I was reading a paper about the pink noise generation. But I don't have any background of this field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused with some part in the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the Voss's algorithm generated a sequence of numbers, how do they use this sequence of number generated figure 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TgQHd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TgQHd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second,in section 5.2, how do they get the melody shown in figure 11, figure 12 and figure 13?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SEWBP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SEWBP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/38oCB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/38oCB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tW038.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tW038.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ijcai.org/papers15/Papers/IJCAI15-352.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here is link of the paper: Generating 1/f Noise Sequences as Constraint Satisfaction: The Voss Constraint.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18120" LastEditorUserId="80" LastEditDate="2015-11-04T20:24:52.953" LastActivityDate="2015-11-04T20:24:52.953" Title="1/f noise generation" Tags="|discrete-signals|audio|frequency-spectrum|noise|sound|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26877" PostTypeId="2" ParentId="26867" CreationDate="2015-11-04T19:51:50.303" Score="2" Body="&lt;p&gt;I am no expert, but I would like to give some pointers which could help you to solve. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Regarding the method you have mentioned/used, is for image registering/stitching. You are interpreting the results wrong. Calculating the percentage of feature match is not the intention of inliers, rather computing corresponding feature points in both images which could be used for image registering/stitching. Inlier is the feature point for which the algorithm has found a corresponding feature point in the other image. Feature points for which the algorithm has not founda match are called outliers. More inliers, better the match. Keep in mind, the algorithm can sometimes match some feature points of completely unrelated images(try running your method on two unrelated images) &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can you use the method you have mentioned to solve your problem ?. &#xA;Yes,You can use number of inliers for each image in the database and decide the one that has the highest number of inliers as the match. You can have a minimum count of inliers to be present, in case the picture of a video-game doesnt exist in your database. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Other ways/methods which you could explore to solve this. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Explore more on the &lt;strong&gt;features&lt;/strong&gt; you can use. SURF does well for some applications, for some it doesnt work well. You have to choose based on your data (image database). You can check with SIFT, and also color histogram as features. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You can check bag of words for image search. (&lt;a href=&quot;https://www.google.de/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=3&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0CC8QFjACahUKEwjp___WwPfIAhVCvhQKHQy9APw&amp;amp;url=http%3A%2F%2Fjialu.cs.illinois.edu%2Ftechnical_notes%2FCBIR_BoW.pdf&amp;amp;usg=AFQjCNHe5lBICTgd7PuXSKKHHEJVEnHgnQ&amp;amp;sig2=8dJsIDzzGdX3U9iyUsBMEw&quot; rel=&quot;nofollow&quot;&gt;check this&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Whenever you add a new game to database, some algorithm(eg - bag of words) need the code book to be recomputed everytime you add a new image to database, so choose the algorithm wisely , coz as the image database gets bigger, the cost of computing  increases. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also think in lines where scale of the images differ(i.e image is database and search query image) Some features like SURF/SIFT are scale invariant, if you choose to use any other, keep this in mind. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These points might help you in deciding and I hope I did not complicate your life :) &lt;/p&gt;&#xA;" OwnerUserId="18121" LastEditorUserId="18121" LastEditDate="2015-11-04T20:10:07.197" LastActivityDate="2015-11-04T20:10:07.197" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26878" PostTypeId="2" ParentId="23616" CreationDate="2015-11-04T20:04:53.100" Score="1" Body="&lt;p&gt;The standard approach would be to&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Choose your feature vectors.&lt;/li&gt;&#xA;&lt;li&gt;Partition your data set into training and testing.&lt;/li&gt;&#xA;&lt;li&gt;Calculate the feature vectors for all your data (both training and test).&lt;/li&gt;&#xA;&lt;li&gt;Use the training data set to train your classification algorithm.&lt;/li&gt;&#xA;&lt;li&gt;Apply the trained classification algorithm to the test data set and calculate your correct classifications and incorrect classifications to get your precision / recall.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The trick will be step 1: choosing your feature vectors, given that you've only got Fourier coefficients (and values derived from them).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-04T20:04:53.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26879" PostTypeId="2" ParentId="26875" CreationDate="2015-11-04T20:42:00.303" Score="1" Body="&lt;p&gt;Usually a discrete-time notch filter is implemented by an IIR (infinite impulse response) filter, which has a numerator as well as a denominator polynomial. The notch frequency - the frequency where the input signal should be completely suppressed - is determined by the numerator polynomial, i.e. by the &lt;em&gt;zeros&lt;/em&gt; of the filter's transfer function, not (directly) by its poles. Of course, a practical design will also place the poles close to the notch-frequency, but the actual notch is implemented by a zero on the unit circle of the complex plane, i.e. by the numerator polynomial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The numerator of a second order notch filter looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$N(z)=z^2-2\cos(\omega_0)z+1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can verify that this polynomial has two complex conjugate zeros at $z=e^{j\omega_0}$ and at $z=e^{-j\omega_0}$, so the notch frequency is given by the normalized angular frequency $\omega_0$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-04T21:17:23.953" LastActivityDate="2015-11-04T21:17:23.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26880" PostTypeId="1" CreationDate="2015-11-04T21:56:54.773" Score="1" ViewCount="729" Body="&lt;p&gt;the voss' algorithm generated a 1/f series. What does the series mean?&#xA;For example, we use three dice and the result sequence length is 8. Let's set the sequence is 8,15,6,9,14,10,9,7. Then what does this sequence mean? does it mean the sequence of frequency or something else? &lt;/p&gt;&#xA;" OwnerUserId="18120" LastActivityDate="2015-12-04T23:04:23.443" Title="Voss algorithm and pink noise" Tags="|signal-analysis|frequency-spectrum|algorithms|power-spectral-density|spectrogram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26881" PostTypeId="2" ParentId="26880" CreationDate="2015-11-04T22:34:13.683" Score="1" Body="&lt;p&gt;The sequence produced by the Voss algorithm is a sequence of random numbers whose power spectral density decays with frequency as $1/f$. In other words, if you find the magnitude spectrum of the sequence (in other words, the magnitude of the DFT of the sequence), you'll see that it decays roughtly as $1/f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to the meaning of the sequence: it doesn't have any intrisic meaning. One way to think about it is as noise with a particular frequency spectrum. In other words, if you normalize the sequence and feed it to your sound card, you'll hear a certain kind of noise. This noise can be added to other signals, such as audio, to give it specific properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all you need is $1/$ noise, there are other methods to generate it; see &lt;a href=&quot;https://dsp.stackexchange.com/questions/322/pink-1-f-pseudo-random-noise-generation&quot;&gt;Pink ($1/f$) pseudo-random noise generation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-11-04T22:54:13.863" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26882" PostTypeId="1" AcceptedAnswerId="59158" CreationDate="2015-11-05T00:01:00.620" Score="3" ViewCount="152" Body="&lt;p&gt;In estimating parameters in a discrete time model I've often seen the use of filters applied to the input data, before its applied to least squares processing. I've been told that the filters are useful if one wishes to remove bias or high frequency noise that's not considered a part of the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm currently working with a problem where I'm using the Moore Penrose pseudoinverse to calculate the least squares. I'm filtering the input data with a lowpass filter to remove high frequency noise well beyond the model dynamics, but the choice of the filter pole seems to have a significant affect on the outcome of the estimate. And in any case the residues are near zero (they don't seem to be better or worse according to pole selection).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should one chose to filter input data, and should it affect the estimate?&lt;/p&gt;&#xA;" OwnerUserId="8809" LastEditorUserId="128" LastEditDate="2019-06-28T22:18:26.990" LastActivityDate="2019-07-03T09:16:26.837" Title="Why Would Pre Filtering Measurement Data Affect the Least Squares Estimate?" Tags="|estimation|filtering|least-squares|estimators|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="26884" PostTypeId="1" CreationDate="2015-11-05T05:53:28.963" Score="9" ViewCount="32183" Body="&lt;p&gt;In Fourier transform for periodic signal, I checked different books and I found a different explanation in each book. Let's take the explanation in Signals and Systems by Rajeshwari &amp;amp; Rao:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The resulting Fourier transform for a periodic signal consist of a train of impulses in frequency, with areas of impulses proportional to the Fourier series coefficients. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;To suggest the general result, let us consider $x(t)$ with Fourier transform $X(\omega)$ which is a single impulse of area $2\pi$ at $\omega=\omega_0$, that is,  $$X(\omega)=2\pi\delta(\omega-\omega_0)$$&#xA;  To determine $x(t)$ for which this is Fourier transform we can apply  the inverse Fourier transform to obtain &#xA;  $$ x(t) = \frac{1}{2\pi} \int_{-\infty}^{+\infty} 2\pi \delta(\omega-\omega_0)e^{j\omega t}d\omega$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The things I want to ask is:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If we have Fourier series of a periodic signal which will be one impulse, then the Fourier transform of that impulse will be the same single impulse? That's what it is explained above? &lt;/li&gt;&#xA;&lt;li&gt;Why we used shifted impulse? Why we can't take $\delta(\omega)$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="1629" LastEditDate="2016-03-05T17:17:46.473" LastActivityDate="2016-09-03T00:49:48.523" Title="About Fourier transform of periodic signal" Tags="|fourier-transform|continuous-signals|fourier|fourier-series|" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26887" PostTypeId="2" ParentId="26884" CreationDate="2015-11-05T07:35:37.223" Score="0" Body="&lt;ul&gt;&#xA;&lt;li&gt;The Fourier transform of the time domain impulse $\delta(t)$ is constant $1$, not another impulse. Analogously, the Fourier series coefficient of a periodic impulse train is a constant.&lt;/li&gt;&#xA;&lt;li&gt;Fourier transform applies to finite (non-periodic) signals. Fourier series representations with coefficients apply to infinitely periodic signals. In your first question you are mixing these up.&lt;/li&gt;&#xA;&lt;li&gt;The book is using a shifted impulse to demonstrate the frequency shift property.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="17901" LastActivityDate="2015-11-05T07:35:37.223" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26888" PostTypeId="1" CreationDate="2015-11-05T07:38:44.757" Score="0" ViewCount="3525" Body="&lt;p&gt;I cannot find any reliable or reasonable differences between the two even after searching for it! Please tell me the possible differences with reasons and reference links!&lt;/p&gt;&#xA;" OwnerUserId="18126" LastEditorUserId="13320" LastEditDate="2016-11-21T12:35:18.177" LastActivityDate="2016-11-21T12:35:18.177" Title="Baseband vs Bandpass Signal" Tags="|bandpass|baseband|" AnswerCount="1" CommentCount="2" ClosedDate="2016-11-21T16:05:13.783" ContentLicense="CC BY-SA 3.0" />
  <row Id="26889" PostTypeId="1" CreationDate="2015-11-05T08:52:10.233" Score="0" ViewCount="1226" Body="&lt;p&gt;I got an assignment which require building a bandpass filter without using any inbuilt functions. I wanted to create a third order Butterworth bandpass filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%for ecg&#xA;f1=5; %cuttoff low frequency to get rid of left over baseline wander&#xA;f2=15; %cuttoff frequency to discard high frequency noise&#xA;Wn=[f1 f2]*2/fs; % cut off based on fs&#xA;N = 3; % order of 3 less processing&#xA;[a,b] = butter(N,Wn); %bandpass filtering&#xA;f = filtfilt(a,b,ecg);&#xA;s1= f/ max( abs(f)); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I wanted to get the coefficient without using &lt;code&gt;butter&lt;/code&gt; function in MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="18127" LastEditorUserId="8202" LastEditDate="2015-11-05T12:53:14.773" LastActivityDate="2015-11-05T12:53:14.773" Title="buidling a bandpass filter without using inbuilt functions" Tags="|matlab|algorithms|dsp-core|bandpass|digital-filters|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26890" PostTypeId="2" ParentId="26884" CreationDate="2015-11-05T10:05:27.340" Score="2" Body="&lt;p&gt;I have found this proof, i am not sure it is correct or not. So correct if I am wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GQRYs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GQRYs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Proof:&lt;br&gt;&#xA;$$x(t) = \delta(t)$$&#xA;$$ X(\omega) = \int _{-\infty}^{+\infty}\delta(t) e^{-j \omega t}dt$$&#xA;$$ X(\omega) = \int _{-\infty}^{+\infty}\delta(0) e^{0} dt=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What If $x(t) = 1$  then $X(\omega) = \delta(\omega)$. Since all the energy is concentrated at 0. Validate by inverse fourier transform.&lt;br&gt;&#xA;lets take $$X(\omega)=\alpha \delta(\omega)$$&#xA;$$ x(t) = \frac {1}{2\pi} \int _{-\infty}^{+\infty} \alpha \delta(\omega) e^{j \omega t}$$&#xA;$$ 1= \frac {\alpha}{2\pi} \int _{-\infty}^{+\infty}  \delta(\omega) e^{j \omega t} $$&#xA;$$ 1= \frac {\alpha}{2\pi} \int _{-\infty}^{+\infty}  \delta(0) e^{0} $$&#xA;$$ 1= \frac {\alpha}{2\pi} . 1 $$&#xA;$$ \alpha=2\pi $$&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fHG4i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fHG4i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16293" LastActivityDate="2015-11-05T10:05:27.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26891" PostTypeId="2" ParentId="26859" CreationDate="2015-11-05T13:30:49.223" Score="5" Body="&lt;p&gt;In Gaussian blur the value of each output pixel is calculated as a weighted sum of all input pixels:&#xA;$$\text{out}(x, y) = \sum^\infty_{j = -\infty} \sum^\infty_{i = -\infty} \frac{1}{{2\pi \sigma_G^2}} e^{-\frac{i^2 + j^2}{2 \sigma_G^2}}\text{in}(x+i,y+j).$$&#xA;We want to calculate the variance $\text{Var}[\text{out}(x, y)] = \sigma^2_f$ based on the variances $\text{Var}[\text{in}(x + i, y + i)] = \sigma^2_0$. We require that $\text{in}(x + i, y + i)$ are independent, which you should mention in your question. Based on the identity (&lt;a href=&quot;https://en.wikipedia.org/wiki/Variance#Properties&quot; rel=&quot;noreferrer&quot;&gt;variance of linear combination&lt;/a&gt;):&#xA;$$Var\left[\sum_i c_i X_i\right] = \sum_i c^2_i Var[X_i],$$&#xA;where $c_i$ are constants and $X_i$ are independent random variables,&#xA;$$\sigma^2_f = \sigma^2_0\sum^\infty_{j = -\infty} \sum^\infty_{i = -\infty} \left(\frac{1}{{2\pi \sigma_G^2}} e^{-\frac{i^2 + j^2}{2 \sigma_G^2}}\right)^2.$$&#xA;For a large $\sigma_G$, the squared Gaussian is rather smooth and the sum can be approximated by an integral as:&#xA;$$\sigma^2_f \approx \sigma^2_0\int^\infty_{-\infty} \int^\infty_{-\infty} \left(\frac{1}{{2\pi \sigma_G^2}} e^{-\frac{i^2 + j^2}{2 \sigma_G^2}}\right)^2\,\text{d}i\,\text{d}j&#xA;= \frac{\sigma^2_0}{4\pi \sigma_G^2}\\&#xA;\implies \sigma_f \approx \frac{\sigma_0}{2\sigma_G\sqrt{\pi}},$$&#xA;which is the same result as in Wikipedia. You can calculate the integral &lt;a href=&quot;http://www.wolframalpha.com/input/?i=int%28int%28%281%2F%282*pi*sigma%5E2%29*exp%28-%28i%5E2%20%2B%20j%5E2%29%2F%282*sigma%5E2%29%29%29%5E2%2C%20i%20%3D%20-inf..inf%29%2C%20j%3D-inf..inf%29&quot; rel=&quot;noreferrer&quot;&gt;using Wolfram Alpha&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the noise needs not be Gaussian for the above to apply.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-05T13:38:00.863" LastActivityDate="2015-11-05T13:38:00.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26892" PostTypeId="2" ParentId="26836" CreationDate="2015-11-05T13:57:42.380" Score="1" Body="&lt;p&gt;There's an error in your 3rd section (linearity) - you replace $y(t)$ with $y_1(t)$ on the left side of the equation but not on the right side. You should have&#xA;$$y_1(t)=x^2(t-t_0)-\frac{1}{2}\frac{dy_1(t)}{dt}$$.&#xA;Now you see that $y_1(t)=y(t-t_0)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for memoryless - start with your initial equation and integrate both sides. Now you have&#xA;$$&#xA;\int y(t)dt=\int x^2(t)dt-\frac{1}{2} y(t)dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and rearranging gives&#xA;$$&#xA;y(t) = 2 \int x^2(t)dt-2 \int y(t)dt&#xA;$$&#xA;Does that help?&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-11-05T13:57:42.380" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26894" PostTypeId="2" ParentId="26888" CreationDate="2015-11-05T14:23:04.363" Score="1" Body="&lt;p&gt;Starting with a Bandpass signal - this is a signal that has a bandwidth $BW$ about a center frequency $f_c$, so the signal content goes from $f_c-1/2BW$ to $f_c+1/2BW$. For a real signal (i.e. not complex) the their is also the corresponding negative frequency component i.e. the signal also exists at $-f_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basebanding often refers to shifting this signal down to DC. This is done by mixing the signal (modulating) it with $\exp(-j2\pi f_c t)$ and low pass filtering to remove the component that was originally at $-f_c$ and gets moved to $-2f_c$ due to the shifting. The component that was at $f_c$ and gets moved to DC is kept by the low pass filter. This signal is now complex due to the loss of conjugate symmetry. This resulting signal is referred to as the Baseband signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the mixing signal $\exp(-j2\pi f_c t) = \cos(j2\pi f_c t)-j\sin(j2\pi f_c t)$, which is often how you see it implemented in communication systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can achieve the same result by using the Hilbert transform which essentially removes the negative frequency component and then shifts the signal down to baseband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&#xA;Haykin - Communication Systems (but almost any communications textbook), also Crochiere - Multirate Digital Signal Processing (somewhere in the first couple of chapters they explain this).&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-11-05T14:23:04.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26895" PostTypeId="1" CreationDate="2015-11-05T15:30:47.227" Score="2" ViewCount="596" Body="&lt;p&gt;I am a noob to signal processing, but I need to create some audio files for IVR for Asterisk VOIP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my lady friend with a nice voice records her message on a Windows machine and sends me a 44KHz, stereo 32bit wav file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently squash it into a 8KHz, mono, 16bit signed wav file for Linux, and then convert the wav to alaw or ulaw PCM format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One source of info for this process is &lt;a href=&quot;http://www.dslreports.com/forum/r27290291-IVR-sounds-bad-over-phone&quot; rel=&quot;nofollow&quot; title=&quot;recording to IVR conversion&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do some magic with Audacity:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Stereo to mono&lt;/li&gt;&#xA;&lt;li&gt;Equalize, using a &quot;voip&quot; or &quot;telephone&quot; filter: discard anything over 3KHz and under 300Hz.&lt;/li&gt;&#xA;&lt;li&gt;compress volume/levels to -12 to -15 dB&lt;/li&gt;&#xA;&lt;li&gt;Resample 44 -&gt; 8KHz&lt;/li&gt;&#xA;&lt;li&gt;Export as 16bit signed PCM wav&lt;/li&gt;&#xA;&lt;li&gt;Move it to Linux and &lt;a href=&quot;http://sox.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;sox&lt;/a&gt; it to alaw or ulaw&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The result is acceptable, but I feel it could be improved.&#xA;In particular, after resampling, the voice sounds muffled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this order correct? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have suggestions to get better results?&lt;/p&gt;&#xA;" OwnerUserId="18132" LastActivityDate="2020-05-22T18:53:06.477" Title="audio for VOIP - filter and resample or viceversa?" Tags="|filters|audio|sound|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26898" PostTypeId="1" AcceptedAnswerId="26916" CreationDate="2015-11-05T18:22:50.307" Score="1" ViewCount="1884" Body="&lt;p&gt;Suppose that I have the green curve (image attached for visualization), values stored in a vector and I want to transform the image such that the curve becomes a &lt;em&gt;straight horizontal&lt;/em&gt; line. So if the curve becomes a straight line all normals of the curve has to be parallel to the vertical axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I achieve such a transformation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kXhfA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kXhfA.png&quot; alt=&quot;Picture drawn for visualzation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18128" LastActivityDate="2015-11-06T14:22:07.857" Title="Image transformation where a curve becomes a straight line" Tags="|image-processing|matlab|transform|" AnswerCount="2" CommentCount="5" ClosedDate="2015-11-06T17:23:16.877" ContentLicense="CC BY-SA 3.0" />
  <row Id="26899" PostTypeId="1" AcceptedAnswerId="26913" CreationDate="2015-11-05T19:48:22.317" Score="0" ViewCount="32" Body="&lt;p&gt;I studied how to draw 'Direct-form I' and 'Direct-form II' from differential equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book taught me like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mbox{Give equation: }{a_0}{y(t)}+{a_1}{y'(t)}+{a_2}{y''(t)} = {b_0}{x(t)}+{b_1}{x'(t)}+{b_2}{x''(t)}$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;step 1. change from differentiator into integrator, because integrator is cheaper than differentiator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}{}&#xA;{a_0}{y^{(2)}(t)}+{a_1}{y^{(1)}(t)}+{a_2}{y(t)} = {b_0}{x^{(2)}(t)}+{b_1}{x^{(1)}(t)}+{b_2}{x(t)} &amp;amp;&#xA;\begin{cases}&#xA;x^{(i)} \mbox{ is i-times integral of x}\\&#xA;y^{(i)} \mbox{ is i-times integral of y}&#xA;\end{cases}&#xA;\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;step 2. change form like this: $y(t)=...$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}{}&#xA;\displaystyle y(t)=\frac{1}{a_2}\left( {b_0}{x^{(2)}(t)}+{b_1}{x^{(1)}(t)}+{b_2}{x(t)}-{a_0}{y^{(2)}(t)}-{a_1}{y^{(1)}(t)}\right)&#xA;\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;step 3. draw&#xA;&lt;a href=&quot;https://i.stack.imgur.com/axCr7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/axCr7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My question is why doesn't consider constant value in step 1?&lt;/p&gt;&#xA;" OwnerUserId="17105" LastActivityDate="2015-11-06T09:48:11.830" Title="Why ignores constant when applying integral into differential-equation.?" Tags="|filter-design|continuous-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26901" PostTypeId="2" ParentId="26824" CreationDate="2015-11-05T21:06:18.120" Score="3" Body="&lt;p&gt;So, assuming the linear superposition you suggest, the sound you want to exctract lives in a periodic subspace of your signal space. This subspace is uniquely characterised by the exact spacing between the sound instances, which I assume you know in the following. If you don't know it, you can find it from calculating the autocorrelation sequence of your composed signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without further knowledge, the only &lt;em&gt;linear&lt;/em&gt; method for finding your sample is to project the composed signal onto the periodic subspace it lives in. There are two obvious ways you can do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is taking the Fourier series of the composed signal and nulling all coefficients that do not belong to an integer multiple of the frequency corresponding to the period length of the repetition. Summing the modified series will give you the desired signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second is to just accurately cut the sample into segments that align perfectly with respect to the repetition period and just sum all those segments up into a single sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of these two operations will give you a representation of the composed signal the same periodic subspace. However, since the subspace is relatively large compared to the total signal, there will be components of the composed signal that are contained in this subspace by mere chance. So the separation will be far from perfect. You can improve the separation by taking more repetitions, make the full signal space much larger than the periodic subspace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need a better method you won't get around characterising the nature of the signal you want to extract. That's where perception models, source models, statistical signal models, etc come in. I cannot really go into this in this answer. It's a topic that fills many books and is in general very difficult. &lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-11-05T21:06:18.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26902" PostTypeId="1" CreationDate="2015-11-05T21:56:41.023" Score="1" ViewCount="1955" Body="&lt;p&gt;In my project I need to detect rotated and non-rotated faces in real time. I read original articles and try to use common implementation in matlab and openCV. And as I understood Haar features are not rotation invariant. What should I do for successes detection of rotated faces ? I have some ideas about it. Which is more 'real'?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Try to rotate original image with some angle step&lt;/li&gt;&#xA;&lt;li&gt;Train own classifier on rotated examples&lt;/li&gt;&#xA;&lt;li&gt;Use any modified Viola Jones Algorithm from research articles &lt;/li&gt;&#xA;&lt;li&gt;Use another algorithm (like SURF, KLT, Skin based face detection)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="18137" LastEditorUserId="53" LastEditDate="2015-11-05T23:14:47.960" LastActivityDate="2015-12-05T23:33:44.830" Title="Rotated object detection by Viola jones Algorithm" Tags="|matlab|computer-vision|opencv|face-detection|matlab-cvst|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26903" PostTypeId="1" AcceptedAnswerId="26904" CreationDate="2015-11-05T22:10:00.223" Score="2" ViewCount="219" Body="&lt;p&gt;Consider I am modelling the dynamics of a robot and using a Kalman filter to obtain estimates of some state. I have certain terms in my equation which correspond to data not accessible to this robot ( states of other robots etc).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is it fair to model these as process noise by assuming these terms to evolve based on some random process and act &quot;Gaussian like&quot; ? This also raises another important question:&lt;br&gt;&#xA;2) Why does the Kalman Filter require us to have a positive definite covariance associated with the process noise. How do I interpret this in the real world when I am writing down process noise as some unmodeled physical terms ? &lt;/p&gt;&#xA;" OwnerUserId="18090" LastActivityDate="2015-11-05T22:26:46.870" Title="Can I model process noise as a known &quot;error&quot; in my dynamics while designing a Kalman Filter?" Tags="|filters|noise|kalman-filters|covariance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26904" PostTypeId="2" ParentId="26903" CreationDate="2015-11-05T22:26:46.870" Score="0" Body="&lt;p&gt;The Extended Kalman filter (EKF) effectively does that: Unmodelled nonlinearities are taken account of by assuming higher process or measurement noise, depending on where the nonlinearity appears. &lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-05T22:26:46.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26905" PostTypeId="2" ParentId="26902" CreationDate="2015-11-05T23:14:35.117" Score="1" Body="&lt;p&gt;You are correct, Haar features, as well as LBP and HOG are not rotation invariant. I have experimented with &lt;code&gt;vision.CascadeObjectDetector&lt;/code&gt; in MATLAB's Computer Vision System Toolbox, and found that the face detector model it comes with can tolerate about 15 degrees of in-plane rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to handle in-plane rotation, the easiest thing is to rotate the image by 15 degree increments and run the detector each time.  If you are talking about out-of-plane rotation, then you would need multiple detectors, such as the frontal and profile detectors that come with MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is another possibility. If you need to detect the faces in video, then you can handle rotations and even partial occlusions by tracking them using KLT.  See &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/47105-detect-and-track-multiple-faces&quot; rel=&quot;nofollow&quot;&gt;this example&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-11-05T23:14:35.117" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26906" PostTypeId="1" AcceptedAnswerId="26908" CreationDate="2015-11-05T23:39:11.150" Score="2" ViewCount="1283" Body="&lt;p&gt;Is there a way to understand visually the complex coefficient of Fourier series (shown as $C_n$ in many sources)? I mean something similar to  this which represents $e^{j\omega_0 t}$: .&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eCpbp.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eCpbp.gif&quot; alt=&quot;phasor&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\omega_0 \triangleq 2 \pi f_0 .$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I read $C_n  e^{jn\omega_0 t}$ my mind shuts down. Here is complex Fourier series: &lt;a href=&quot;http://www.thefouriertransform.com/series/complexFourier.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.thefouriertransform.com/series/complexFourier.jpg&lt;/a&gt;.&#xA;And its one element is $C_n e^{j n \omega_0 t}$. How can I visualize this element? And does $C_n$ have a meaning besides being a coefficient?&lt;/p&gt;&#xA;" OwnerUserId="7555" LastEditorUserId="4346" LastEditDate="2015-11-06T01:08:45.457" LastActivityDate="2015-11-13T10:26:48.160" Title="How can I comprehend the complex coefficient of complex Fourier series?" Tags="|fourier-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26907" PostTypeId="2" ParentId="26906" CreationDate="2015-11-06T00:28:06.640" Score="1" Body="&lt;p&gt;An FFT complex coefficient is just a 2 dimensional vector that has a magnitude (length) and a phase angle (direction).  Omega (w) is a frequency.  So, roughly, the magnitude of each complex coefficient corresponds to the height or amount of energy of a sine wave at that frequency, and the phase angle suggests where the sine wave (zero crossing) at that frequency starts.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-11-06T00:28:06.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26908" PostTypeId="2" ParentId="26906" CreationDate="2015-11-06T01:03:51.883" Score="5" Body="&lt;p&gt;if you think of $e^{j n \omega_0 t}$ as a &quot;vector&quot; (complex numbers are not quite the same as 2-dimensional vectors, but they look the same, and are both describable with two real numbers) with length 1 and starting out with an angle of 0 (pointing straight to the right, along the positive real axis, and this vector is rotating counter-clockwise at a rate of $n \omega_0$ radians per unit time.  this vector is what you see looking down the spiral in the graphic referred to in the question, looking along the time axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then multiplying by $C_n$ changes the length of the vector to $|C_n|$ and the initial angle of the vector is the angle of $C_n$ or $\arg\{C_n\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that's how i would visualize it.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-11-06T01:10:42.953" LastActivityDate="2015-11-06T01:10:42.953" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="26909" PostTypeId="2" ParentId="26742" CreationDate="2015-11-06T01:25:01.107" Score="2" Body="&lt;p&gt;I think you are referring to the symbol shown at the left of the structure: the arm that moves between different phases?  See slide 4 of &lt;a href=&quot;http://www.ws.binghamton.edu/fowler/fowler%20personal%20page/EE521_files/IV-05%20Polyphase%20FIlters%20Revised.pdf&quot; rel=&quot;nofollow&quot;&gt;this PDF&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point the Polyphase representation is trying to get across is that we give different samples of the input to different Phases of the Polyphase filter.  Polyphase Filtering is a Digital Signal Processing approach, so your input would only be defined at discrete locations.  Between the samples, we do not know where the signal was (unless it is bandlimited...).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can think of it as a memoryless switch.&lt;/p&gt;&#xA;" OwnerUserId="11064" LastActivityDate="2015-11-06T01:25:01.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26910" PostTypeId="2" ParentId="26906" CreationDate="2015-11-06T02:38:28.230" Score="1" Body="&lt;p&gt;The simple way I tend to think about it is to remember that what you are doing is approximating the signal with a series of sinusoids. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Technically you are treating your signal as a vector (function) and expressing it in terms of an orthonormal basis of complex exponential functions. That is to say the coefficients are the inner product of the signal with the basis vectors of the space. This is much the same process  as you would use to get the coefficients of a vector in $\mathbb{R}^3$ . $$\vec{v}=v_i\vec{i}+v_j\vec{j}+v_k\vec{k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a &lt;strong&gt;practical&lt;/strong&gt; perspective what you are doing for each term in your fourier expansion is taking a sinusoid and expanding it and sliding it along the axis until you have the best fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you remember that any complex number can be written as $Re^{i\theta}$ where $R$ is the amplitude and $e^{i\theta}$ the phase. This means that your coefficient is really  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                           &quot;Amplitude x Phase&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or in simpler terms &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;              &quot;the make it bigger bit&quot; x &quot;the slide it along bit&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Easy huh? &lt;/p&gt;&#xA;" OwnerUserId="18140" LastEditorUserId="18140" LastEditDate="2015-11-13T10:26:48.160" LastActivityDate="2015-11-13T10:26:48.160" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26912" PostTypeId="2" ParentId="26824" CreationDate="2015-11-06T09:28:36.983" Score="3" Body="&lt;p&gt;This can be approached as a general blind source separation problem with an excitation-filter model for both the snare and the synthesizer. For the snare the excitation would be an impulse train, and the filter would have the snare sample as its impulse response. You can try if &lt;a href=&quot;http://bass-db.gforge.inria.fr/fasst/&quot; rel=&quot;nofollow&quot;&gt;Flexible Audio Source Separation Toolbox (FASST)&lt;/a&gt; finds good enough models to allow separation. FASST is described in these articles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y. Salaün, E. Vincent, N. Bertin, N. Souviraà-Labastie, X. Jaureguiberry, D. T. Tran, and F. Bimbot, &lt;a href=&quot;https://hal.inria.fr/hal-00957412/&quot; rel=&quot;nofollow&quot;&gt;The Flexible Audio Source Separation Toolbox Version 2.0&lt;/a&gt;, in Show &amp;amp; Tell, IEEE International Conference on Acoustics, Speech and Signal Processing, 2014.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A. Ozerov, E. Vincent, and F. Bimbot, &lt;a href=&quot;http://hal.inria.fr/hal-00626962/&quot; rel=&quot;nofollow&quot;&gt;A general flexible framework for the handling of prior information in audio source separation&lt;/a&gt;, IEEE Transactions on Audio, Speech and Signal Processing 20(4), pp. 1118-1133 (2012).&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-11-06T09:28:36.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26913" PostTypeId="2" ParentId="26899" CreationDate="2015-11-06T09:48:11.830" Score="1" Body="&lt;p&gt;The constants would be the initial conditions, such as an initially charged capacitor or an inductor with an initial current. If all constants are set to zero it means that you have zero initial conditions, which is usually the standard assumption unless stated otherwise.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-06T09:48:11.830" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26914" PostTypeId="1" AcceptedAnswerId="26930" CreationDate="2015-11-06T11:50:52.080" Score="0" ViewCount="2150" Body="&lt;p&gt;I am at the moment trying to implement a contra harmonic filter,to remove the pepper noise from an image. But the implementation of it seems a bit incorrect, and I am not sure what is wrong. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void ContraHarmonic(Mat src, Mat dst, int kernel, double P)&#xA;{&#xA;  cout &amp;lt;&amp;lt; &quot;got it&quot; &amp;lt;&amp;lt; endl;&#xA;    Mat temp = src.clone();&#xA;    //copyMakeBorder(temp,temp,kernel-1,kernel-1,kernel-1,kernel-1,BORDER_CONSTANT,Scalar(0,0,0));&#xA;&#xA;    for(int row = kernel/2; row &amp;lt; temp.rows - kernel/2-1; row++)&#xA;    {&#xA;        for(int col = kernel/2; col &amp;lt; temp.cols - kernel/2-1; col++)&#xA;        {&#xA;&#xA;        double den=0,num=0;&#xA;          for(int i = -(kernel/2); i &amp;lt;= (kernel/2) ; i++)&#xA;          {&#xA;            for(int j = -(kernel/2) ; j &amp;lt;= (kernel/2); j++)&#xA;            {&#xA;                den += pow(temp.at&amp;lt;float&amp;gt;(row+i,col+j),P);&#xA;                num += pow(temp.at&amp;lt;float&amp;gt;(row+i,col+j),P+1);&#xA;            }&#xA;          }&#xA;&#xA;        dst.at&amp;lt;float&amp;gt;(row,col) = num/den;&#xA;      }&#xA;    }&#xA;    dst.convertTo(dst,CV_8U);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output i receive from it point at something being wrong with it.. I am not sure whether the implementation is incorrect, or the programming isn't done correctly.  This is the output i receive.. Which point at something being wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GwF7j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GwF7j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--Updated--&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Updated with the answer provided and the image looks like this &#xA;&lt;a href=&quot;https://i.stack.imgur.com/mXfFO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mXfFO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18084" LastEditorUserId="18084" LastEditDate="2015-11-06T13:57:01.780" LastActivityDate="2015-11-07T18:24:42.667" Title="Implementing contraharmonic filter" Tags="|image-processing|filters|opencv|c++|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26915" PostTypeId="2" ParentId="26914" CreationDate="2015-11-06T13:25:31.150" Score="0" Body="&lt;p&gt;If &lt;code&gt;P&lt;/code&gt; is large, you may be getting overflow. &lt;code&gt;num&lt;/code&gt; and &lt;code&gt;den&lt;/code&gt; are only declared as &lt;code&gt;float&lt;/code&gt;, but the calculation may exceed the range of a float. Change them to &lt;code&gt;double&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-06T13:25:31.150" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26916" PostTypeId="2" ParentId="26898" CreationDate="2015-11-06T14:10:51.303" Score="0" Body="&lt;p&gt;Shift each pixel column so that the slice of the green line in that column is centered at a certain vertical coordinate. Like Mack says there are plenty of other transforms but perhaps this one satisfies the constraints you try to describe.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-11-06T14:10:51.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26917" PostTypeId="2" ParentId="26898" CreationDate="2015-11-06T14:22:07.857" Score="1" Body="&lt;p&gt;I would recommend a grid transform. Each point of the grid has a $(dx,dy)$ offset, and a point in the middle of a square is interpolated according to the control points. Specifically in your case, you can keep most of the points in place, except those which are near the curve you want to straighten.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PEmYc.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PEmYc.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="698" LastActivityDate="2015-11-06T14:22:07.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26918" PostTypeId="1" CreationDate="2015-11-06T15:34:43.157" Score="10" ViewCount="2675" Body="&lt;p&gt;According to the Gauss-Markov Theorem, a ordinary least squares estimator is BLUE if the noise entering a system is uncorrelated with zero mean and is homoscedastic (has a constant finite variance). I am aware that a Kalman Filter applied to a system with additive noise of known mean and variance but non-gaussian distribution is  BLUE. Does this imply that the noise has to be homoscedastic ? Or does the KF have a trick up its sleeve ?&lt;/p&gt;&#xA;" OwnerUserId="18090" LastActivityDate="2018-04-23T14:47:19.147" Title="Is the Kalman Filter a Best Linear Unbiased Estimator (BLUE) for Heteroscedastic Noise?" Tags="|noise|kalman-filters|least-squares|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26919" PostTypeId="2" ParentId="26918" CreationDate="2015-11-06T15:52:41.523" Score="3" Body="&lt;p&gt;If you look at the statement of the discrete-time Kalman filtering problem in &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0486439380&quot; rel=&quot;nofollow noreferrer&quot;&gt;Anderson &amp;amp; Moore (RIP)&lt;/a&gt;, you'll notice something:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X8Ze8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X8Ze8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The covariances $R_k$ and $Q_k$ are time-varying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, later in Chapter 3, they go on to prove the best linear estimator property for the Kalman filter in Theorem 2.1, and the proof does not appear to require the noise to be stationary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now: the question will be whether the Gaussianity assumption can be dropped... but I've not read through it. Most of the standard KF equations state assume Gaussianity; as does this one. &lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-06T16:08:34.370" LastActivityDate="2015-11-06T16:08:34.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26923" PostTypeId="1" CreationDate="2015-11-07T00:19:43.143" Score="2" ViewCount="2242" Body="&lt;p&gt;I am at the moment trying to implement a bandpass butter worth filter which i then can use to apply on my original image. Problem is though My implementation of it using OpenCV doesn't seem to be correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have written some code which is capable of displaying the DFT of an image, and based from that i able see what i want to filter out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The freq spectrum of the image looks like this &#xA;&lt;a href=&quot;https://i.stack.imgur.com/U4GKy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U4GKy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea was to implement a butterworth notch  band reject filter, but something seems wrong my implementation, or I am just applying incorrectly. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cv::Mat bandpass(double d0, double n, int wy, int wx, int cx, int cy)&#xA;{&#xA;    cv::Mat_&amp;lt;cv::Vec2f&amp;gt; pf(wy, wx);&#xA;    for(int y = 0; y &amp;lt; wy; ++y) {&#xA;        for(int x = 0; x &amp;lt; wx; ++x) {&#xA;            // Real part&#xA;            for(int i = 0; i &amp;lt; 3 ; i++)&#xA;            {&#xA;                const double d = std::sqrt( double((x-cx)*(x-cx)) + double((y-cy)*(y-cy)) );&#xA;                const double d_k = std::sqrt(pow(x-cx-(cx+100),2.0) + pow(y-cy-(cy+100),2.0));&#xA;                const double d_mk = std::sqrt(pow(x-cx+(cx+0),2.0) + pow(y-cy+(cy+0),2.0));&#xA;                if(d==0) // Avoid division by zero&#xA;                    pf(y,x)[0] = 0;&#xA;                else&#xA;                    //  pf(y,x)[0] = 1.0 / (1.0 + std::pow(d0/d, 2.0*n));&#xA;                    pf(y,x)[0] *= (1.0/(1+pow((d0/d_k),2.0*n)))*(1.0/(1+pow((d0/d_mk),2.0*n)));&#xA;                    // Imaginary part&#xA;                    pf(y,x)[1] = 0;&#xA;            }&#xA;        }&#xA;    }&#xA;    return pf;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and i use mulspectrum to apply it. But the output image from an inverse dft is a black image, which in some way tells me that is not the right filter type i am using..&lt;/p&gt;&#xA;" OwnerUserId="18084" LastActivityDate="2015-11-07T00:19:43.143" Title="Implementing a 2d butterworth filter for image processing?" Tags="|frequency-spectrum|opencv|filtering|software-implementation|c++|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26924" PostTypeId="1" CreationDate="2015-11-07T04:25:00.517" Score="0" ViewCount="123" Body="&lt;p&gt;Some textbooks like (Numerical recipes the art of scientific computing) derive the DFT as a Riemann sum of the CTFT. With this in mind it would be natural then to approximate the identity $$y(t)=x*h=\mathcal{F}^{-1}\big\{XH\big\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the mathlab code y=ifft(fft(x).*fft(h)) which roughly means that my response is the inverse DFT of the product of the DFTs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been reading recently that this approach isn't really valid in the case of the DFT. The relevant identity in the discrete realm is $$\mathcal{F}^{-1}(XH)_{n}=\sum_{l=0}^{N-1} x_l (y_N)_{n-l}$$ which is called a circular convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But so far, my ifft(fft...) approach yields results that are completely compatible with the analytical results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also want to mention that I have checked for the well-known result that convolving with a shifted impulse, shifts your response along the domain; and the result that scaling an impulse, scales the response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented impulses by inputting the coefficient in the dirac-delta function in some position on a vector, without really justifying why this works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So therefore I have two questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the y=ifft(fft(x).*fft(h)) approach valid and compatible with the theory? Is this the way its supposed to be? How can I justify such a thing? Why aren't the step factors $dt$ involved in this approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why are impulses correctly modeled by only inputting the coefficient that would correspond to the dirac-delta function? (This seems intuitive to me, but I wouldn't like to say my opinion as I would prefer to listen to you mostly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &lt;strong&gt;This is the problem I am working on&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using MATLAB, I've been told to use the convolution theorem to find the response of an RC circuit given a signal $x(t)=\displaystyle \sum_i \delta(t-t_i)$ and $x(t) = \cos(t)$ (and other similar ones like $x(t)=e^{-t}\cos(t)$, but this isn't important). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of this exercise is not to solve things analytically, but to use MATLAB. I specifically want to do this with the fft and ifft functions in MATLAB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I'm proceeding is by writing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; t=(-5:.01:5);&#xA;&#xA;x=[zeros(1,500) 1 zeros(1,500)];&#xA;&#xA;h=heaviside(t).*exp(-t);&#xA;&#xA;plot(t,ifft(fft(h).*fft(x)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works perfectly fine. If I want to analyse $x(t)=\cos(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just modify my code the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t=(-5:.01:5);&#xA;&#xA;x=cos(t);&#xA;&#xA;h=heaviside(t).*exp(-t);&#xA;&#xA;plot(t,.01*ifft(fft(h).*fft(x)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which again, works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I'll repeat my questions for the purpose of clarity:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this valid? This convolution identity isnt valid in the discrete case. Also, the interval $(-5,5)$ is not at all similar to $(-\infty,\infty)$ so my Riemann approximation should suck (for the cosine case), but it doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain why using the step only in front of the&lt;code&gt;ifft&lt;/code&gt; is what works here? Namely why shouldn't I be doing &lt;code&gt;01*ifft(.01*fft(h).*fft(x)*.01)&lt;/code&gt; which seems more in line with the expression of the CTFT.&lt;/p&gt;&#xA;" OwnerUserId="17581" LastEditorUserId="17581" LastEditDate="2015-11-07T18:15:07.013" LastActivityDate="2015-11-07T18:15:07.013" Title="Approaching the response of an RC circuit via y=ifft(fft(x)fft(h)). Why is this valid?" Tags="|discrete-signals|convolution|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="26927" PostTypeId="1" CreationDate="2015-11-07T12:54:01.557" Score="25" ViewCount="99431" Body="&lt;p&gt;I'm doing a research on the FFT method, and a term that always comes up is &quot;frequency bin&quot;. From what I understand, this has something to do with the band created around the frequency of a given sinusoid, but I can't really figure out how. I also figured out how to go from a given bin to its related frequency, but still no intuition on what a frequency bin is.&lt;/p&gt;&#xA;" OwnerUserId="18160" LastActivityDate="2022-11-09T12:12:40.473" Title="What is a frequency bin?" Tags="|fft|" AnswerCount="6" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26928" PostTypeId="1" AcceptedAnswerId="26929" CreationDate="2015-11-07T14:04:09.770" Score="2" ViewCount="1349" Body="&lt;p&gt;I have an N-tap direct form complex FIR filter with known coefficients &lt;code&gt;[c0 c1 .. cn]&lt;/code&gt;. I want to find the coefficients of its equalizer filter which when cascaded with the original filter gives constant magnitude response for all frequencies. How can I do that? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4037" LastActivityDate="2015-11-07T16:18:32.130" Title="Given an FIR filter coefficients, how can I find coefficients of its equalizer filter?" Tags="|filters|filter-design|finite-impulse-response|equalization|equalizer|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26929" PostTypeId="2" ParentId="26928" CreationDate="2015-11-07T14:22:06.597" Score="5" Body="&lt;p&gt;Assuming that you also want to equalize the filter's phase response (not only its magnitude response), you need an equalizer with a transfer function $E(z)$ that is the inverse of the FIR filter's transfer function $H(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E(z)=\frac{1}{H(z)}=\frac{1}{c_0+c_1z^{-1}+\ldots+c_{N-1}z^{-(N-1)}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an all-pole filter which can be implemented by the following recursion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac{1}{c_0}\left(x[n]-c_1y[n-1]-\ldots-c_{N-1}y[n-N+1]\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is the input sequence, and $y[n]$ is the output sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with implementing Eq. $(2)$ is that the corresponding filter can be unstable. This depends on the locations of the zeros of the FIR filter's transfer function $H(z)$. If $H(z)$ has zeros on or outside the unit circle of the complex plane (i.e., zeros with magnitudes equal to or greater than $1$), then $E(z)$ has poles at those locations, and poles on or outside the unit circle cause instability of the equalizer. This means that if $H(z)$ has zeros with magnitude equal to or greater than $1$ (i.e. if $H(z)$ is not strictly minimum phase), then there exists no causal and stable equalizer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice you can design an approximate equalization filter by choosing the filter coefficients of the equalizer such that the error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\epsilon=\sum_i\left|H(e^{j\omega_i})E(e^{j\omega_i})-e^{-j\omega_i D}\right|^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is minimized, where $D$ is some appropriately chosen delay, and the sum is computed on a dense frequency grid. If the equalizer $E(e^{j\omega})$ is chosen to be an FIR filter, then the resulting optimization problem can be solved by solving a set of linear equations.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-07T16:18:32.130" LastActivityDate="2015-11-07T16:18:32.130" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26930" PostTypeId="2" ParentId="26914" CreationDate="2015-11-07T14:49:10.683" Score="1" Body="&lt;p&gt;The problem occurred due to the pixel values of temp had the type uchar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution to my problem was to output the pixel values as uchar, manipulate them as double, and store them as uchar. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double den=0,num=0;&#xA;      for(int i = -(kernel/2); i &amp;lt;= (kernel/2) ; i++)&#xA;      {&#xA;        for(int j = -(kernel/2) ; j &amp;lt;= (kernel/2); j++)&#xA;        {&#xA;            den += pow(temp.at&amp;lt;uchar&amp;gt;(row+i,col+j),P);&#xA;            num += pow(temp.at&amp;lt;uchar&amp;gt;(row+i,col+j),P+1);&#xA;        }&#xA;      }&#xA;&#xA;    dst.at&amp;lt;uchar&amp;gt;(row,col) = num/den;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="18084" LastEditorUserId="18084" LastEditDate="2015-11-07T18:24:42.667" LastActivityDate="2015-11-07T18:24:42.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26931" PostTypeId="2" ParentId="26927" CreationDate="2015-11-07T15:04:32.717" Score="15" Body="&lt;p&gt;A frequency bin in 1D generally denotes a segment &lt;span class=&quot;math-container&quot;&gt;$[f_l,f_h]$&lt;/span&gt; of the frequency axis, containing some information. It is defined  between a low and a high  frequency bound &lt;span class=&quot;math-container&quot;&gt;$f_l$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f_h$&lt;/span&gt;. It is related to the series of ranges of numerical value used to sort data  in statistical analysis. In higher dimension, it is a volume defined by bounds on  each frequency dimension, like an hyper rectangle.&lt;/p&gt;&#xA;&lt;p&gt;This chunk of the frequency space is often assigned, or &amp;quot;collects&amp;quot;, periodicity information like the amplitude, magnitude or energy from a small range of frequencies, often resulting from a Fourier analysis.&lt;/p&gt;&#xA;&lt;p&gt;Due to data discretization (possibly due to sampling), it is generally not possible to assign a precise amplitude to every frequency location on a real axis. The frequency bin can be derived for instance from the sampling frequency and the resolution of the Fourier transform. However, a portion of the computed amplitude may be attributed to frequencies of the actual signal that are not contained in the bin range. Terms associated to this phenomenon can be leakage, smearing, aliasing, windowing, and depend on the tools used to obtain these amplitudes. An instance is demonstrated on the following figure: a pure sine is sampled, and analyzed through a rectangular window. Although one might expect a single peak, as one would obtain  on the full continuous-time signal with a continuous Fourier transform, the peak is not precisely localized with an FFT, and leaks in the neighboring bins.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M3NJW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M3NJW.png&quot; alt=&quot;FFT of a pure sine&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Very often, the segment &lt;span class=&quot;math-container&quot;&gt;$[f_l,f_h]$&lt;/span&gt; is referred to as a single frequency, like the mid-frequency &lt;span class=&quot;math-container&quot;&gt;$\frac{f_l+f_h}{2}$&lt;/span&gt; or the lowest frequency &lt;span class=&quot;math-container&quot;&gt;$f_l$&lt;/span&gt;, yet one should not forget it is an interval, not a single number. Classically, the frequency bins are even in size, non-overlapping, and cover the whole spectrum. On occasion, they can somehow overlap, be non-uniform, for instance when this term is used (rarely) for multirate filter banks.&lt;/p&gt;&#xA;&lt;p&gt;Similar concepts can be found in probability bins.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2021-07-19T19:47:27.540" LastActivityDate="2021-07-19T19:47:27.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="26933" PostTypeId="2" ParentId="26927" CreationDate="2015-11-07T18:28:34.013" Score="6" Body="&lt;p&gt;An FFT is a method of computing a DFT.  And a DFT is a transform of a finite length vector which produces the same finite number of results.  However the range of frequencies of a sinusoid that can be windowed to a finite length in order be fed to an FFT is infinite.  Thus, each result vector element of an FFT is predominately associated with a small segment of this frequency continuum, rather than a point (the FFT bin center frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes the bins are idealized as fixed width rectangular filters.  But the actual shape of each FFT result bin is not a rectangular bucket, but either Sinc shaped, or shaped like the transform of any non-rectangular window function that has optionally been applied.  Note that these result bins can be wider in bulk than the distance between FFT bins, with tails (the stopband) that trail off around the full width of the result.  These tails are sometimes referred to as &quot;leakage&quot;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-11-10T00:32:20.347" LastActivityDate="2015-11-10T00:32:20.347" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26937" PostTypeId="1" AcceptedAnswerId="26952" CreationDate="2015-11-07T20:31:26.373" Score="3" ViewCount="1890" Body="&lt;p&gt;Simple math question. The convolution theorem states that multiplication in time domain is equal to convolution in frequency domain and vice versa. There is a condition that the signal has to be properly zero padded as to not cause aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question concerns convolution in the frequency domain. The difficulty arises from the fact that we are dealing with a complex signal which has a positive and a negative side. Let's consider two frequency domain signals, with negative frequencies included, presented in polar coordinates []:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a=[0,1(3π/4),0,1(π/2),0)]&#xA;b=[1,1,1,1,1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So we have a sine wave and a zero-phase dirac delta. It's apparent that the time domain product is zero. But coming to this conclusion via using convolution in frequency domain doesn't seem to be so simple. I get (rectangular):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[-j,-j,-j,-j, 0,j,j,j,j,j]&#xA;=&amp;gt; [-2j,-2j,0,2j,2j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which is not correct. Even for a cosine I get a row of twos, which is not correct either (should be row of ones). Where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="4298" LastEditDate="2015-11-20T13:18:40.483" LastActivityDate="2015-11-20T13:18:40.483" Title="Convolution in frequency domain" Tags="|fourier-transform|convolution|fourier-series|self-study|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26938" PostTypeId="1" AcceptedAnswerId="26951" CreationDate="2015-11-07T21:26:01.557" Score="0" ViewCount="362" Body="&lt;p&gt;There is quadrature detector which receive radio signal and return its amplitude and instantaneous phase after performing &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_transform#Analytic_representation&quot; rel=&quot;nofollow noreferrer&quot;&gt;hilbert transformation&lt;/a&gt; and transferring the signal to zero frequency. The main purpose of this device is save information about phase of received signal after digitizing (&lt;a href=&quot;http://www.radartutorial.eu/10.processing/sp06.en.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here is&lt;/a&gt; example of such receiver). Simplified structure of such detector shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YFHT3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YFHT3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following octave code try emulating the detector (I'm not sure that is correct):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Prepare to work.&#xA;close all;&#xA;clear all;&#xA;clc;&#xA;&#xA;% Main constant.&#xA;frequency_local_oscillator = 30e6;&#xA;frequency_intermediate     = frequency_local_oscillator;&#xA;frequency_sampling         = frequency_intermediate * 4;&#xA;time_begin                 = 0;&#xA;time_end                   = 10e-4;&#xA;time                       = linspace (time_begin, time_end, frequency_sampling * (time_end - time_begin) );&#xA;size                       = length (time);&#xA;&#xA;% Pulse.&#xA;magnitude_pulse            = 1.0;&#xA;phase_pulse                = 0;&#xA;carrier_pulse              = magnitude_pulse * cos (2 * pi * frequency_intermediate .* time + phase_pulse);&#xA;timeshift_pulse            = time_begin + (time_end - time_begin) / 4;&#xA;duration_pulse             = (time_end - time_begin) / 2;&#xA;envelope_pulse = zeros (1, size);&#xA;envelope_pulse = envelope_pulse + heaviside (time - timeshift_pulse) .* heaviside (duration_pulse - time + timeshift_pulse);&#xA;signal_pulse   = carrier_pulse .* envelope_pulse;&#xA;if 0 % Make signal more realistic.&#xA;% Noise.&#xA;magnitude_noise            = 0.01;&#xA;carrier_noise              = magnitude_noise * randn (1, size);&#xA;signal                     = signal_pulse + carrier_noise;&#xA;else&#xA;signal                     = signal_pulse;&#xA;end&#xA;&#xA;% Moving to zero frequency and and quadrature detection.&#xA;signal_i =  signal .* cos (2 * pi * frequency_local_oscillator * time);&#xA;signal_q = -signal .* sin (2 * pi * frequency_local_oscillator * time);&#xA;&#xA;% LPF.&#xA;[b a] = ellip (4, 0.1, 60, 0.1);&#xA;signal_i_filtered = filter (b, a, signal_i);&#xA;signal_q_filtered = filter (b, a, signal_q);&#xA;&#xA;% Decimation (performed at two stages with common ratio: 15 х 16 = 240).&#xA;signal_i_decimated = decimate (signal_i_filtered,  15);&#xA;signal_q_decimated = decimate (signal_q_filtered,  15);&#xA;signal_i_decimated = decimate (signal_i_decimated, 16);&#xA;signal_q_decimated = decimate (signal_q_decimated, 16);&#xA;% Time scale after decimation.&#xA;time_decimated = linspace (time_begin, time_end, length (signal_i_decimated) );&#xA;&#xA;% Magnitude and instantaneous phase.&#xA;signal_magnitude = sqrt  (signal_i_decimated .^ 2 + signal_q_decimated .^ 2);&#xA;signal_phase     = atan2 (signal_q_decimated, signal_i_decimated);&#xA;&#xA;% Display signal.&#xA;figure;&#xA;grid on;&#xA;subplot (2, 1, 1);&#xA;plot (time, signal, 'b');&#xA;hold on;&#xA;plot (time, envelope_pulse, 'r');&#xA;title (&quot;Input signal.&quot;);&#xA;xlabel (&quot;Time [s].&quot;);&#xA;ylabel (&quot;Magnitude [V].&quot;);&#xA;subplot (2, 2, 3);&#xA;plot (signal_magnitude, 'b');&#xA;title (&quot;Magnitude of the signal.&quot;);&#xA;xlabel (&quot;Sample number.&quot;);&#xA;ylabel (&quot;Magnitude [V].&quot;);&#xA;subplot (2, 2, 4);&#xA;plot (signal_phase, 'g');&#xA;title (&quot;Phase of the signal.&quot;);&#xA;set (gca, 'YTick',     -pi: pi / 2: pi)&#xA;set (gca, 'YTickLabel',{'-pi', '-pi / 2', '0', 'pi / 2','pi'})&#xA;xlabel (&quot;Sample number.&quot;);&#xA;ylabel (&quot;Phase [rad].&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is result of the code which looks in my opinion more or less real:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mBrcy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mBrcy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;:&lt;br&gt;&#xA;I have records of two different signals from output of the detector (desired signal and noise). And now I'd like to adding those signals (combine as if they was received simultaneously). Is it possible to do it and how can I do this?&lt;br&gt;&#xA;The main purpose of this task is performing measurements of the the once recorded signal with different calibrated noises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My attempts&lt;/strong&gt;:&lt;br&gt;&#xA;About possibility I think it's possible if all stages of the detector are linear. If it is true this allows swap processing stages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion add together magnitudes and phases of signals is wrong. I think that this task can be solved with the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;revert conversion at I and Q;&lt;/li&gt;&#xA;&lt;li&gt;get sum of components of two signals;&lt;/li&gt;&#xA;&lt;li&gt;convert I and Q to magnitude and phase again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Am I right?&lt;/p&gt;&#xA;" OwnerUserId="10169" LastEditorUserId="10169" LastEditDate="2015-11-09T18:31:23.440" LastActivityDate="2015-11-09T18:31:23.440" Title="Addition of two signals in polar coordinates" Tags="|discrete-signals|hilbert-transform|polar|quadrature|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="26940" PostTypeId="1" AcceptedAnswerId="26950" CreationDate="2015-11-07T22:31:31.647" Score="6" ViewCount="4014" Body="&lt;p&gt;Let's say I have an impulse response $h[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I analyze the power spectrum of that impulse response similar to fourier transformed $h[n]$ corresponding to roughly $H[f]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I compare $H[f]$ with some target $H_{0}[f]$ by subtracting $H_{0}[f]-H[f]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I create a compensation filter based on this via inverse fourier transform: $\mathrm{ifft}(H_{0}[f]-H[f])$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this is inadequate because time-domain aliasing is observed: &lt;strong&gt;Why?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to understand is, just as sampling in the time-domain cause aliasing in the frequency domain, is this operation of creating a filter via ifft akin to sampling in the frequency domain and likewise causing aliasing in the time domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is this because the $H[f]$ was not sufficiently padded and the result is a circular convolution that causes ringing (but is this time-domain aliasing?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a direct result of the duality of the DFT? In that, just as a sinusoid of a given frequency will show up as a frequency-axis shifted impulse in the frequency domain, an envelope of some frequency will show up as a time-axis shifted impulse in the time domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Confusedly yours,&#xA;@panthyon&lt;/p&gt;&#xA;" OwnerUserId="8764" LastEditorUserId="8764" LastEditDate="2015-11-08T01:21:34.527" LastActivityDate="2015-11-08T20:30:30.803" Title="Does sampling in the frequency domain cause time-domain aliasing?" Tags="|fourier-transform|dsp-core|aliasing|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26941" PostTypeId="1" AcceptedAnswerId="26964" CreationDate="2015-11-07T22:45:32.700" Score="3" ViewCount="9348" Body="&lt;p&gt;Can anyone explain how frequency response related to a transfer function?&lt;/p&gt;&#xA;" OwnerUserId="17129" LastActivityDate="2015-11-09T16:25:54.940" Title="How frequency response related to a transfer function" Tags="|frequency-response|transfer-function|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26942" PostTypeId="2" ParentId="26941" CreationDate="2015-11-08T00:55:50.147" Score="5" Body="&lt;p&gt;An LTI system's &quot;frequency response&quot; tells you how the system acts on the amplitude and phase of a sinusoidal input. If the frequency response is $H(f)$, then an input $x(t)=e^{j2\pi f_0t}$ produces an output $y(t)=|H(f_0)|e^{j(2\pi f_0t+\angle H(f_0))}$. It is common to divide the frequency response in two, the &lt;em&gt;gain&lt;/em&gt; $|H(f)|$ and the &lt;em&gt;phase&lt;/em&gt; $\angle H(f)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same system's &quot;transfer function&quot; is defined as follows: if an input $x(t)$ produces an output $y(t)$, then the system's transfer function is $H(s)=\frac{Y(s)}{X(s)}$, where $X(s)$ and $Y(s)$ are the Laplace transforms of $x(t)$ and $y(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the transfer function is evaluated at $s=j\omega$, it is also known as the systems's frequency response. Note that the transfer function is more general than the frequency response, and can provide more insight into a system's behavior, for example about transient response or stability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These definitions can also be extended to non-linear systems but that is beyond my experience.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2015-11-09T16:25:54.940" LastActivityDate="2015-11-09T16:25:54.940" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26943" PostTypeId="2" ParentId="26588" CreationDate="2015-11-08T02:14:03.533" Score="1" Body="&lt;p&gt;I'm not really used to thinking in texture fetches as I usually code high level non-hardware-specific signal processing, but low pass filtering also removes information you can couple it with sub-sampling which can give further gains. It is not clear to me if you have already done this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice this means that after the first low-pass filtering, you can disregard $k$ out of $N$ of the samples in the subsequent low-pass filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple example is the $2^n \times 2^n$ averaging-filter, first we can do 2x2 mean values and store. Then for the next pass, we only need to use the output of one of each $2 \times 2$ blocks. So we only need consider $1$ in $4^k$ data points at step $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 8x8 block this would mean:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$I_1 = \left[\begin{array}{cccccccc}&#xA;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1\\&#xA;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1\\&#xA;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1\\&#xA;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1\\&#xA;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1\\&#xA;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1\\&#xA;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1\\&#xA;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1&#xA;\end{array}\right]$$&#xA;First iteration, all are involved in 2x2 filtering. But they are only stored at the pixels which are ones here (so we only need to calculate 1/4 of them):&#xA;$$I_2 = \left[\begin{array}{cccccccc}&#xA;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&#xA;\end{array}\right]$$&#xA;Next step only involves the ones in the previous one, now our image is 4x4 instead of 8x8, so calculations are reduced a factor of 4. But we only need to store the results at pixels:&#xA;$$I_3 = \left[\begin{array}{cccccccc}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&#xA;\end{array}\right]$$&#xA;We will end up with only one out-value, in this case upper left. And here's where the interpolations come into play. We can interpolate between these upper left results of neighboring &quot;blocks&quot;. The interpolation kernel can be dependent on the low-pass filter, but I assume that this is where the hardware shines with it's strengths, having really fast ways to do this for us?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in theory &lt;em&gt;filter-banks&lt;/em&gt;, &lt;em&gt;sub-band coding&lt;/em&gt; and maybe &lt;em&gt;wavelets&lt;/em&gt; are interesting to read up on. The example I brought up here is the implementation low-pass filter of the basic but popular discrete Haar-wavelet. &lt;em&gt;Gaussian pyramids&lt;/em&gt; in computer vision may be even more relevant. There's much to read about it so it's difficult to cram it all into just one answer.&lt;/p&gt;&#xA;" OwnerUserId="18051" LastActivityDate="2015-11-08T02:14:03.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26946" PostTypeId="2" ParentId="26937" CreationDate="2015-11-08T07:15:34.510" Score="2" Body="&lt;p&gt;(EDIT: Never mind, I misinterpreted the question being about length 4 FFT specifically.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have made the mistake of having both a positive and a negative Nyquist frequency (sampling frequency / 2) bin. Only one is needed because they are equal in the discrete time sense:&#xA;$$e^{i\pi k} = e^{i-\pi k} \text{, for } k\in\text{integer}.$$&#xA;Remove the negative Nyquist frequency bin, making your data of length 4 instead of length 5.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-08T20:35:08.777" LastActivityDate="2015-11-08T20:35:08.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26950" PostTypeId="2" ParentId="26940" CreationDate="2015-11-08T17:51:58.457" Score="10" Body="&lt;p&gt;The answer is: yes, sampling in the frequency domain causes aliasing in the time domain, exactly like the dual case: sampling in the time domain causes aliasing in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many ways to see this. One standard way is to sample the discrete-time Fourier transform (DTFT) of a discrete-time signal by multiplying it with a Dirac comb and see what this does to the time domain signal. Here, however, I would like to show it in another way, namely by taking samples of the DTFT and asking which periodic signal has these samples as its discrete Fourier transform (DFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $Y(e^{j\omega})$ be the DTFT of the sequence $y[n]$ (note that $y[n]$ is not necessarily of finite length):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(e^{j\omega})=\sum_{n=-\infty}^{\infty}y[n]e^{-jn\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we take samples of $Y(e^{j\omega})$ at $\omega_k=2\pi k/N$, $k=0,1,\ldots,N-1$, and derive the time domain sequence with a DFT equal to these samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}Y_k\doteq Y(e^{j2\pi k/N})&amp;amp;=\sum_{n=-\infty}^{\infty}y[n]e^{-j2\pi nk/N}\\&amp;amp;=\sum_{l=-\infty}^{\infty}\sum_{n=0}^{N-1}y[n+lN]e^{-j2\pi nk/N}\\&amp;amp;=&#xA;\sum_{n=0}^{N-1}\sum_{l=-\infty}^{\infty}y[n+lN]e^{-j2\pi nk/N}\\&amp;amp;=\sum_{n=0}^{N-1}\tilde{y}[n]e^{-j2\pi nk/N}\tag{2}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\tilde{y}[n]$ is an aliased version of the original sequence $y[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{y}[n]=\sum_{l=-\infty}^{\infty}y[n+lN]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the right-hand side of $(2)$ is the DFT of $\tilde{y}[n]$.&#xA;Eq. $(2)$ shows that the samples $Y_k$ of the DTFT $Y(e^{j\omega})$ are the DFT coefficients of $\tilde{y}[n]$, which is an aliased version of $y[n]$. Consequently, sampling in the frequency domain causes time-domain aliasing, which is obviously the dual of the well-known aliasing in the frequency domain caused by sampling in the time domain.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-08T19:06:59.643" LastActivityDate="2015-11-08T19:06:59.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26951" PostTypeId="2" ParentId="26938" CreationDate="2015-11-08T17:57:07.557" Score="1" Body="&lt;p&gt;Mixing is not the correct terminology for what you want to do.  Mixing is multiplication and you want additive noise.  Convert back to I/Q, add complex noise, then convert back to mag/phase!&lt;/p&gt;&#xA;" OwnerUserId="18099" LastActivityDate="2015-11-08T17:57:07.557" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26952" PostTypeId="2" ParentId="26937" CreationDate="2015-11-08T19:00:09.237" Score="5" Body="&lt;p&gt;If you have two DFTs $A[k]$ and $B[k]$ (note the correct representation of a sinusoid at DFT bin number $1$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;A = [0,-j,0,0,j]; B = [1,1,1,1,1];&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the corresponding time-domain sequences $a[n]$ and $b[n]$&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;a = ifft(A);    % [0, 0.38042, 0.23511, -0.23511, -0.38042];&#xA;b = ifft(B);    % [1,0,0,0,0];&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then the multiplication of the time-domain sequences $c[n]=a[n]b[n]$ corresponds to the &lt;em&gt;cyclic&lt;/em&gt; (or &lt;em&gt;circular&lt;/em&gt;) convolution of the DFTs $A[k]$ and $B[k]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{DFT}\{c[n]\}=C[k]=\frac{1}{N}\sum_{n=0}^{N-1}A[n]B[k-n]_{\text{mod} N},\quad k=0,1,\ldots,N-1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the indices are taken modulo $N$ ($N=5$ in this case), such that they remain in the range $[0,N-1]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}C[0]&amp;amp;=\left(A[0]B[0]+A[1]B[N-1]+\ldots+A[N-1]B[1]\right)\cdot\frac{1}{N}\\&#xA;C[1]&amp;amp;=\left(A[0]B[1]+A[1]B[0]+\ldots+A[N-1]B[2]\right)\cdot\frac{1}{N}\\&amp;amp;\vdots\\&#xA;C[N-1]&amp;amp;=\left(A[0]B[N-1]+A[1]B[N-2]+\ldots+A[N-1]B[0]\right)\cdot\frac{1}{N}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's easy to see that the cyclic convolution of $A[k]$ and $B[k]$ as given above results in the zero vector, because due to $B[k]=1$ for all values of $k$, each element of the result is the sum of all elements of $A[k]$, which is always zero.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-20T13:17:09.530" LastActivityDate="2015-11-20T13:17:09.530" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26953" PostTypeId="2" ParentId="26940" CreationDate="2015-11-08T20:30:30.803" Score="2" Body="&lt;p&gt;There is also a duality between resampling band-limited signals in the time-domain and resampling zero-padded (time-limited) signals in the frequency domain.  Sufficient band-limiting or zero-padding for the given resampling rate prevents aliasing.  This is because the circular convolution will just add a lot of zero values around the circle, which can leave the circular result identical to the linear convolution result. e.g. the portion of the spectrum or time domain data that would have been aliased will be zero.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-11-08T20:30:30.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26954" PostTypeId="1" AcceptedAnswerId="30161" CreationDate="2015-11-08T21:32:26.477" Score="0" ViewCount="93" Body="&lt;p&gt;How do you retrieve the values of the frequency component occurring in a 2D freq spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ILGfb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ILGfb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this, and if I wanted to know the values of the white dots.  what should i do ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apolgize beforehand for asking this question. &lt;/p&gt;&#xA;" OwnerUserId="18084" LastActivityDate="2016-04-16T12:30:40.977" Title="Retrieve frequency value of an 2D frequency spectrum" Tags="|image-processing|frequency|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26955" PostTypeId="1" AcceptedAnswerId="26961" CreationDate="2015-11-09T05:10:48.727" Score="0" ViewCount="188" Body="&lt;p&gt;If a second order system has 2 poles/zeros that are conjugate symmetric, how does this affect the phase response? I know that if there are 4 zeros/poles that are conjugate reciprocals, then it is a zero phase system. &lt;/p&gt;&#xA;" OwnerUserId="17009" LastActivityDate="2015-11-10T10:56:07.930" Title="Phase response for conjugate zeros" Tags="|linear-systems|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26956" PostTypeId="1" AcceptedAnswerId="26959" CreationDate="2015-11-09T05:42:15.360" Score="1" ViewCount="1096" Body="&lt;p&gt;There are lots of representations of discrete time signals. You represent it in block diagram or as difference equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We call it block diagrams as there are elementary structures in the diagrams. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we call the equation part as difference equation of a signal?&#xA;$y[n] = x[n] + x[n-1]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is nothing getting subtracted in the above example representation, Then why call it difference equation??&lt;/p&gt;&#xA;" OwnerUserId="17828" LastEditorUserId="4346" LastEditDate="2015-11-10T02:47:52.353" LastActivityDate="2017-07-11T19:25:03.300" Title="Why call it discrete time signals as difference equations?" Tags="|discrete-signals|dsp-core|linear-systems|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26957" PostTypeId="1" CreationDate="2015-11-09T06:45:36.090" Score="0" ViewCount="58" Body="&lt;p&gt;I am from ECE background and trying to solve channel allocation problem. Let's assume I have three users and three available channels. I would like to allocate channel among them in such a way that average BER would be minimum.&#xA;For example, consider BER matrix for each user for each frequency allocation &#xA;\begin{bmatrix} User/frequency &amp;amp; User1 &amp;amp; User2 &amp;amp;  User3 \\ f1 &amp;amp;0.01 &amp;amp; 0.05 &amp;amp; 0.3\\f2 &amp;amp; 0.12 &amp;amp; 0.045 &amp;amp; 0.02 \\ f3 &amp;amp;0.02 &amp;amp; 0.01 &amp;amp; 0.01 \end{bmatrix}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I would like to allocate channels f1--&gt; User1, f2--&gt; User3 and f3--&gt;User2, which gives least average BER (Sum of each users BER/no of users). (Note: Same frequency can't allocated to different users.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Brute force is obliviously one solution, but I am trying to find optimized solution.&lt;/p&gt;&#xA;" OwnerUserId="17670" LastActivityDate="2015-12-10T07:55:05.023" Title="Optimized resource allocation problem" Tags="|digital-communications|optimization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26959" PostTypeId="2" ParentId="26956" CreationDate="2015-11-09T08:17:02.897" Score="2" Body="&lt;p&gt;A difference equation is a recurrence relation where the current element $y[n]$ of a sequence is related to its past values $y[n-k]$, $k&amp;gt;0$ (if we interpret the index $n$ as &lt;em&gt;time&lt;/em&gt; index, which is not necessary). The equation you gave in your question is a special case, because there are no past terms $y[n-k]$ involved, so you could call it a zeroth order difference equation, but you're right that from a common sense point of view it is no difference equation at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what counts here is the fact that no past (or future) elements $y[n-k]$ are involved, and not that &quot;nothing is getting subtracted&quot;. E.g., the following equation is a standard example of a difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=ay[n-1]+bx[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The subtraction takes place in the index $n$ ($y[n-1]$). But obviously you can substitute $n+1$ for $n$ yielding&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n+1]=ay[n]+bx[n+1]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is completely equivalent to $(1)$ with no subtraction taking place, but it's still a difference equation, because the difference between the indices remains unchanged.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-09T08:17:02.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26960" PostTypeId="2" ParentId="26956" CreationDate="2015-11-09T08:29:34.060" Score="2" Body="&lt;p&gt;It is called an &lt;strong&gt;&quot;input-output&quot; difference equation&lt;/strong&gt; (sometimes &lt;a href=&quot;https://en.wikipedia.org/wiki/Z-transform#Linear_constant-coefficient_difference_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear constant coefficient difference equation&lt;/a&gt;) because it relates inputs and outputs (of a linear time-invariant system here) as the difference equation  $$y[n] - (x[n]+x[n-1]) = 0 \,.$$&#xA;A more general form includes generic linear combinations, over appropriate sets of integer indices $N_x$ and $N_y$ (depending on whether the linear system or filter is causal, anticausal,  acausal, finite or infinite impulse response, etc.):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{i \in N_y} a_i y[n-i] - \sum_{j \in N_x} b_j x[n-j] = 0\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is common, for instance in &lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/Difference_Equation_I.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Difference Equation&lt;/a&gt;, to resort to the past only:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The difference equation is a formula for computing an output sample at&#xA;  time $n$ based on past and present input samples and past output&#xA;  samples in the time domain.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In image processing, recursive approximate Gaussian and exponential filters commonly use both causal and anticausal terms, hence my use of &quot;appropriate&quot;, not mentioning the past only.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2017-07-11T06:32:14.580" LastActivityDate="2017-07-11T06:32:14.580" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26961" PostTypeId="2" ParentId="26955" CreationDate="2015-11-09T08:29:52.243" Score="0" Body="&lt;p&gt;If you have conjugate symmetric poles and zeros then the coefficients of the system (i.e., the filter coefficients, or, equivalently, the coefficients of the corresponding difference equation) are real-valued. E.g., if the zeros are $z_0$ and $z_0^*$ then the numerator polynomial of the transfer function $H(z)$ is (up to a scaling factor)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$N(z)=(z-z_0)(z-z_0^*)=z^2-(z_0+z_0^*)z+|z_0|^2=z^2-2\text{Re}(z_0)z+|z_0|^2\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the coefficients in $(1)$ are all real-valued. The same is true for the denominator polynomial. So the frequency response (i.e., the transfer function evaluated at $z=e^{j\omega}$) can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\frac{b_0e^{2j\omega}+b_1e^{j\omega}+b_2}{e^{2j\omega}+a_1e^{j\omega}+a_2}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with all coefficients $a_i$ and $b_i$ being real-valued. Consequently, the following equation must hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=H^*(e^{-j\omega})\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you write $H(e^{j\omega})$ in polar form $H(e^{j\omega})$=$M(\omega)e^{j\phi(\omega)}$ with magnitude $M(\omega)$ and phase $\phi(\omega)$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M(\omega)e^{j\phi(\omega)}=M(-\omega)e^{-j\phi(-\omega)}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(4)$ it follows that for conjugate symmetric poles and zeros the magnitude of the frequency response must be an even function of frequency, and the phase must be an odd function of frequency, i.e., $M(\omega)=M(-\omega)$ and $\phi(\omega)=-\phi(-\omega)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-10T10:56:07.930" LastActivityDate="2015-11-10T10:56:07.930" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26962" PostTypeId="1" CreationDate="2015-11-09T09:08:23.867" Score="2" ViewCount="484" Body="&lt;p&gt;I'm doing a research about image processing, I would like to access common feature detection methods online, ex:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Blob detection&lt;/strong&gt;: Laplacian of Gaussian (LoG), Difference of Gaussians (DoG), Determinant of Hessian (DoH), Hough transform.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Edge detection&lt;/strong&gt;: Canny, Deriche, Differential, Sobel, Prewitt, Roberts cross.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Corner detection&lt;/strong&gt;: Harris operator, Shi and Tomasi, Level curve curvature, SUSAN, FAST.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Feature description&lt;/strong&gt;: SIFT, SURF, GLOH, HOG.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there any online tools on the web which provide some of them ?&lt;/p&gt;&#xA;" OwnerUserId="18185" LastActivityDate="2015-11-09T09:08:23.867" Title="Web Online tools for feature detection methods in image processing" Tags="|image-processing|online-processing|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26963" PostTypeId="2" ParentId="26743" CreationDate="2015-11-09T09:10:25.030" Score="1" Body="&lt;p&gt;I wouldn't bother with correct bright pixel segmentation.&#xA;I think such a strategy would add complexity and another stage in the algorithm which might add errors at the eventual product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would use some form of scaling function for the pixel value so that the bright pixels would blend-in better while maintaining contrast in the darker pixels. One such function could be the log function:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;im = log(double(im));&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BNpUe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BNpUe.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another one might be the square root.&#xA;You might even get away with using a max value for the image , e.g. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;thr = 150; im(im&gt; thr) = thr;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;or a combination of both, for instance a capped transform function&#xA;thr = 100; &#xA;tform_im = img.^0.5;&#xA;tform_im_scaled = tform_im - min(tform_im(img&gt;thr)) + thr;&#xA;img(img&gt;thr) = tform_im_scaled(img&gt;thr);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z3UUV.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z3UUV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way good luck!&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2015-11-09T09:10:25.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26964" PostTypeId="2" ParentId="26941" CreationDate="2015-11-09T09:13:06.767" Score="3" Body="&lt;p&gt;A discrete-time linear time-invariant (LTI) system is defined by its impulse response, which can be expressed as a list of non-zero coefficients $c_n$ occuring at integer time indices $t_n$. To form its output $y[k]$ all the system can do is sum time-shifted and constant-multiplied copies of its input $x[k]$. An important class of input functions are complex exponentials that look for example like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9PpZ7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9PpZ7.png&quot; alt=&quot;Complex exponential function with $a = 1$, $z = -0.6 - 0.6i$&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input is a complex exponential:&#xA;$$x[k] = az^k,$$&#xA;where $a$ and $z$ are complex constants and $k$ is the integer time index, then summation results in an output that is the same as the input multiplied by a constant $H(z)$:&#xA;$$y[k] = \sum_n c_n x[k-t_n] = \sum_n c_n a z^{k-t_n} = \left(\sum_n c_n z^{-t_n} \right)a z^k = H(z)\,x[k].$$&#xA;In other words, complex exponentials are eigenfunctions of LTI systems. The constant $H(z)$ is called the transfer function. It is a function of the base $z$ of the complex exponential. If $|z|$ = 1, then the base is of form:&#xA;$$z = e^{i\omega} = \cos(\omega) + i \sin(\omega),$$&#xA;where $i$ is the imaginary unit, and the system's input is a complex sinusoid of real frequency $\omega$ (with magnitude and phase embedded in the constant $a$):&#xA;$$x[k] = a (e^{i\omega})^k = a e^{i\omega k} = a\left(\cos(\omega k) + i \sin(\omega k)\right)$$&#xA;Compared to other complex exponentials, complex sinusoids don't decay or increase in magnitude by time. Frequency response at frequency $\omega$ is simply the constant $H(e^{i\omega})$ by which the system multiplies a complex sinusoid input of frequency $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the inverse Fourier transform, one can go from the frequency response to the impulse response, and from the impulse response one can obtain the transfer function as shown above. So the transfer function of a discrete-time LTI system is fully defined by its frequency response.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-09T11:26:56.300" LastActivityDate="2015-11-09T11:26:56.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26965" PostTypeId="1" CreationDate="2015-11-09T10:04:50.570" Score="0" ViewCount="119" Body="&lt;p&gt;While understanding the proof of DTFT from Signals and Systems by Oppenheim, I have confusion in understanding few steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x'[n]=\sum_ {k=&amp;lt;N&amp;gt;} a_ke^{jk(2\pi/N)n}$$&#xA;$$ a_k= \frac{1}{N} \sum_ {n=&amp;lt;N&amp;gt;} x'[n]e^{-jk(2\pi/N)n}$$&#xA;Since $x[n]=x'[n]$ over a perid that includes the interval $-N_1 &amp;lt;= n &amp;lt;= N_2$, it is convinent to choose the interval of summation to include this inteval, so that $x'[n]$ can replaced by $x[n]$ in the summation. Therefore,&#xA;$$ a_k= \frac{1}{N} \sum_ {n=N_1}^{N_2} x[n]e^{-jk(2\pi/N)n} = \frac{1}{N} \sum_ {n=-\infty} ^{+\infty} x[n]e^{-jk(2\pi/N)n}$$&#xA;While in the second equality we have used the fact that $x[n]$ is zero outside the interval $-N_1 &amp;lt;= n &amp;lt;= N_2$&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nr1EQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nr1EQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;I have confusion in understanding that how summation from $-N_1  N_2$ changes to $-\infty  +\infty$. The statement they mentioned above is so confusioning for me.&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="16293" LastEditDate="2015-11-09T10:14:31.080" LastActivityDate="2015-11-09T10:14:31.080" Title="Confusion in understanding the Proof of DTFT" Tags="|discrete-signals|fourier-transform|fourier|dtft|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="26966" PostTypeId="1" AcceptedAnswerId="26979" CreationDate="2015-11-09T11:39:01.240" Score="5" ViewCount="4775" Body="&lt;p&gt;I am trying to extract the decay properties of an oscillating time history. The obvious method for doing this is to use a Hilbert transform. The figure shows an example of a theoretical decay and the envelope calculated using the Hilbert transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hum13.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that the envelope has oscillations (Gibbs oscillations) due to the fact that there is a discontinuity in the sudden start of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The extracted decay rate, below, which should be a constant in this theoretical case, is unacceptably corrupted by the oscillations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/z4heG.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have considered filtering the envelope with a low pass filter but as the oscillations are the same order as the original frequency I will spoil the decay data. Alternatively I could create a mirror image of the data and thus remove the starting step. However, this requires finding the starting phase of the time history. Could these methods work or can you suggest another method? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&#xA;As suggested by Olli Niemitalo I have had another look at filtering the envelope signal. The filtered envelope is added here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/j7r2h.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filtered envelope signal now has no oscillations but has dropped down from the peaks. This is fine for my application were I need the rate of decay. The next figure compares the decay calculated from the filtered envelope to the unfiltered envelope&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wwWFc.png&quot; alt=&quot;Mathematica graphics&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is success! Thanks to Olli.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks &lt;/p&gt;&#xA;" OwnerUserId="17237" LastEditorUserId="17237" LastEditDate="2015-11-11T21:56:00.983" LastActivityDate="2015-11-14T21:59:02.097" Title="Oscillations on Hilbert envelope" Tags="|filters|signal-analysis|" AnswerCount="4" CommentCount="20" ContentLicense="CC BY-SA 3.0" />
  <row Id="26968" PostTypeId="1" AcceptedAnswerId="27763" CreationDate="2015-11-09T19:15:35.543" Score="1" ViewCount="518" Body="&lt;p&gt;I am studying the image denoising problem. The paper I studied uses Gaussian Noise to model the noise appearing on the image. E.e., If we say $u_g$ is a clean image, then we model the noisy image $u_0$ so that $u_0 = u_g+n$ where $n$ has Gaussian distribution with mean $0$ and variance $c$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: I am wondering why are we using Gaussian distribution to model the noise? Any theory behind it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: Can we use stochastic processes to model the noise? If so, is there any existing literature?&lt;/p&gt;&#xA;" OwnerUserId="18193" LastEditorUserId="80" LastEditDate="2015-11-16T17:23:31.527" LastActivityDate="2016-09-08T01:00:31.297" Title="The model of noise in Image denoising problem" Tags="|image-processing|image-segmentation|denoising|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26970" PostTypeId="2" ParentId="26966" CreationDate="2015-11-10T00:50:42.220" Score="0" Body="&lt;p&gt;The Hilbert transform, as applied to finite (rectangularly windowed) segments of data, is only useful if your ignore startup (and/or end) transients (until the transform's impulse response drops below your desired noise floor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either cut off, or smooth (or perhaps apply machine learning?) both end transients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your data is integer periodic in aperture width, then you can use an FFT for the transform and assume the length is infinite (no start transient).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-11-10T00:56:17.760" LastActivityDate="2015-11-10T00:56:17.760" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="26971" PostTypeId="1" CreationDate="2015-11-10T06:09:22.233" Score="1" ViewCount="256" Body="&lt;p&gt;I need a filter at 1/32 my sampling rate. Because it's 1/2&lt;sup&gt;n&lt;/sup&gt;, I was thinking there might be a special case filter for this case. Anything like this?&lt;/p&gt;&#xA;" OwnerUserId="18198" LastActivityDate="2015-11-12T18:10:03.397" Title="Special case peak/notch filter for exactly 1/32 sampling rate?" Tags="|discrete-signals|filter-design|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26972" PostTypeId="1" AcceptedAnswerId="26976" CreationDate="2015-11-10T06:18:41.307" Score="3" ViewCount="458" Body="&lt;p&gt;On page 5 of &lt;a href=&quot;http://complextoreal.com/wp-content/uploads/2012/12/Chapter-5.pdf&quot; rel=&quot;nofollow&quot;&gt;this document&lt;/a&gt; I read that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathrm{sinc}[k] = \delta[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please explain why this is true?&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="4298" LastEditDate="2015-11-10T12:01:26.327" LastActivityDate="2015-11-10T12:01:26.327" Title="Why does $\mathrm{sinc}[k]= \delta[k]$ hold?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="26973" PostTypeId="2" ParentId="26957" CreationDate="2015-11-10T07:12:42.510" Score="2" Body="&lt;p&gt;Your problem is called an &lt;a href=&quot;https://en.wikipedia.org/wiki/Assignment_problem&quot; rel=&quot;nofollow&quot;&gt;assignment problem&lt;/a&gt;. Check out the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hungarian_algorithm#cite_note-4&quot; rel=&quot;nofollow&quot;&gt;Hungarian algorithm&lt;/a&gt;. Instead of average BER cost you can minimize total cost as it gives the same optimal solution.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-11-10T07:12:42.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26974" PostTypeId="1" CreationDate="2015-11-10T08:23:14.087" Score="0" ViewCount="112" Body="&lt;p&gt;How can I implement comb filter in reducing noise in wireless communication?&#xA;I am new in signal processing and right now I am still learning about the comb filter. Can I use it to reduce/filter noise in wireless communication?&lt;/p&gt;&#xA;" OwnerUserId="18199" LastEditorUserId="8202" LastEditDate="2015-11-10T09:34:12.927" LastActivityDate="2015-11-10T09:34:12.927" Title="comb filter design in wireless communication" Tags="|filters|filter-design|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26975" PostTypeId="2" ParentId="26971" CreationDate="2015-11-10T08:28:43.520" Score="1" Body="&lt;p&gt;The period, half-period, and quarter-period of the peak or notch frequency are integer multiples (32, 16, and 8) of the sampling period. If you want a linear-phase filter then compared to an arbitrary frequency this enables savings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using a windowed &lt;i&gt;finite impulse response&lt;/i&gt; (FIR) filter, every 16th coefficient will be zero. Small savings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using a &lt;i&gt;truncated infinite impulse response&lt;/i&gt; (truncated IIR, TIIR) and &lt;i&gt;Goertzel algorithm&lt;/i&gt; based filter, if the phase of the frequency is required to be zero at the center of the impulse response then the length of the impulse response can be chosen such that the phase of the frequency will be an integer multiple of $\frac{\pi}{2}$ at the ends of the impulse response. Such phase shifts of a TIIR marginally stable resonator can be implemented without multiplication that would be needed in case of an arbitrary frequency requiring an arbitrary phase shift to obtain a symmetrical impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following band-pass composite TIIR filter has an impulse response that is a raised cosine window function of integer length $N+1$ (counting also the zero-valued endpoints) normalized to unit area and multiplied by a cosine at $1/M$ sampling frequency. $N$ must be even and an integer multiple of $M$ (which needs not be integer). The impulse response is symmetrical around time $N/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{mid}_0[t] = \text{in}[t] - \text{in}[t-2] - \text{in}[t-N] + \text{in}[t-N-2]\\&#xA;\text{mid}_1[t] = \text{mid}_0[t] + 2\cos(\frac{2\pi}{M})\text{mid}_1[t-1]-\text{mid}_1[t-2]\\&#xA;\text{mid}_2[t] = \text{mid}_0[t] + 2\cos(\frac{2\pi}{M} + \frac{2\pi}{N})\text{mid}_2[t-1]-\text{mid}_2[t-2]\\&#xA;\text{mid}_3[t] = \text{mid}_0[t] + 2\cos(\frac{2\pi}{M} - \frac{2\pi}{N})\text{mid}_3[t-1]-\text{mid}_3[t-2]\\&#xA;\text{out}_\text{band}[t] = \frac{-1^\frac{N}{M}}{N}\left(\text{mid}_1[t] - \frac{1}{2}(\text{mid}_2[t] + \text{mid}_3[t])\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter takes advantage of that multiplication by a window function is frequency domain convolution and a raised cosine has a 3-term frequency domain representation. The filter can be easily modified to implement other generalized cosine windows. The three middle filter stages are marginally stable and require periodical refreshing for numerical stability. For example for $M = 32$ and $N = 256$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZRWwx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZRWwx.png&quot; alt=&quot;Impulse response&quot;&gt;&lt;/a&gt;&#xA;Figure 1. Impulse response (horizontal axis: time in samples)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ir8Ey.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ir8Ey.png&quot; alt=&quot;Magnitude frequency response&quot;&gt;&lt;/a&gt;&#xA;Figure 2. Magnitude frequency response (dB, horizontal axis: frequency in radians)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the filter is linear-phase, it is easy to convert it to a notch filter or a peaking equalizer filter:&#xA;$$\text{out}_\text{notch}[t] = \text{in}[t-\frac{N}{2}] - \text{out}_\text{band}[t]\\&#xA;\text{out}_\text{peaking}[t] = \text{in}[t-\frac{N}{2}] + a\,\text{out}_\text{band}[t],\ a \ge -1.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following slightly faster reacting version of the filter has no zero as the first or last sample of the impulse response of length $N-1$ and requires that $N$ is an even integer that is an integer-plus-half multiple of $M$. The impulse response is now symmetrical around time $\frac{N}{2}-1$, so conversions to $\text{out}_\text{notch}$ and $\text{out}_\text{peaking}$ must be modified accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{mid}_0[t] = \text{in}[t] + \text{in}[t-N]\\&#xA;\text{mid}_1[t] = \text{mid}_0[t] + 2\cos(\frac{2\pi}{M})\text{mid}_1[t-1]-\text{mid}_1[t-2]\\&#xA;\text{mid}_2[t] = \text{mid}_0[t] + 2\cos(\frac{2\pi}{M} + \frac{2\pi}{N})\text{mid}_2[t-1]-\text{mid}_2[t-2]\\&#xA;\text{mid}_3[t] = \text{mid}_0[t] + 2\cos(\frac{2\pi}{M} - \frac{2\pi}{N})\text{mid}_3[t-1]-\text{mid}_3[t-2]\\&#xA;\text{out}_\text{band}[t] = -1^{\frac{N}{M}-\frac{1}{2}}\left(\frac{2\sin(\frac{2\pi}{M})}{N}\text{mid}_1[t] - \frac{\sin(\frac{2\pi}{M} + \frac{2\pi}{N})}{N}\text{mid}_2[t] - \frac{\sin(\frac{2\pi}{M} - \frac{2\pi}{N})}{N}\text{mid}_3[t]\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example with $M = 32$, $N = 272$, and $\frac{N}{M} = 8.5$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9GBHE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9GBHE.png&quot; alt=&quot;Impulse response&quot;&gt;&lt;/a&gt;&#xA;Figure 3. Impulse response (horizontal axis: time in samples) with a time span from 0 to 270 inclusive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response looks pretty much the same as that of the previous filter, except for that the first zero is not at frequency 0. So I did not bother to plot it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very similar filters are presented in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eric Jacobsen &amp;amp; Richard Lyons. &lt;b&gt;DSP Tips &amp;amp; Tricks: &lt;a href=&quot;http://www.cmlab.csie.ntu.edu.tw/DSPCourse/reference/Sliding%20DFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Sliding DFT&lt;/a&gt;&lt;/b&gt;. &lt;i&gt;IEEE Signal Processing Magazine&lt;/i&gt;, March 2003, pp 74–80.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eric Jacobsen &amp;amp; Richard Lyons. &lt;b&gt;DSP Tips &amp;amp; Tricks: &lt;a href=&quot;http://www.cmlab.csie.ntu.edu.tw/DSPCourse/reference/Sliding%20DFT%20update.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Update to the Sliding DFT&lt;/a&gt;&lt;/b&gt;. &lt;i&gt;IEEE Signal Processing Magazine&lt;/i&gt;, January 2004, pp 110–111.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-12T18:10:03.397" LastActivityDate="2015-11-12T18:10:03.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26976" PostTypeId="2" ParentId="26972" CreationDate="2015-11-10T10:38:07.007" Score="5" Body="&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; After editing according to the comments, the real question is if and why the following equality holds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{sinc}[k]\doteq\frac{\sin(k\pi)}{k\pi}=\delta[k],\quad k\in\mathbb{Z}\tag{a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is, yes, of course it holds. Since $\sin(k\pi)=0$ for any integer $k$, the value of the left-hand side of the above equation must be zero for any integer $k\neq 0$. The case $k=0$ is different because here also the denominator is zero. It can be shown by a limit argument that for $k=0$, the function $\sin(k\pi)/(k\pi)$ equals $1$. Another way to see it is to use the equation that you quoted in your comment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{j\omega k}d\omega=\ldots=\text{sinc}[k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you evaluate this equation separately for $k=0$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi}\int_{-\pi}^{\pi}d\omega=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we get a sequence which is $1$ for $k=0$ and zero for all other (integer) values of $k$. Consequently, this sequence can be rewritten using the discrete-time unit impulse $\delta[k]$, as shown in Equation (a).&#xA;&lt;hr&gt;&#xA;(Below is the original answer explaining that $\delta[k]$ can't be the DTFT of any sequence.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned in the comments, this can't be true. Be careful to distinguish between the Discrete-Time Fourier Transform (DTFT) and the Discrete Fourier Transform (DFT). The first is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\text{DTFT:}\quad X(e^{j\omega})&amp;amp;=\sum_{n=-\infty}^{\infty}x[n]e^{-jn\omega}\\x[n]&amp;amp;=\frac{1}{2\pi}\int_{-\pi}^{\pi}X(e^{j\omega})e^{j\omega n}d\omega\end{align}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DTFT $X(e^{j\omega})$ of a sequence $x[n]$ is a $2\pi$-periodic function that is continuous in $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The (length $N$) DFT is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\text{DFT:}\quad X[k]&amp;amp;=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}\\x[n]&amp;amp;=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}\end{align}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $X[k]$ is also a discrete sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete unit impulse $\delta[k]$ can be the DFT of some time domain sequence, but it cannot be the DTFT of any sequence (because it is itself a sequence, not a continuous function). To see which sequence $x[n]$ corresponds to the DFT $X[k]=\delta[k]$, simply use the formula given in $(2)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}\delta[k]e^{j2\pi nk/N}=\frac{1}{N}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(3)$, it is the constant sequence $x[n]=1/N$ that corresponds to the unit impulse $X[k]=\delta[k]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-10T11:55:43.817" LastActivityDate="2015-11-10T11:55:43.817" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="26978" PostTypeId="1" CreationDate="2015-11-10T11:40:06.633" Score="0" ViewCount="753" Body="&lt;p&gt;I'm trying to convert a transfer function (tf) in s-domain (&lt;code&gt;num: b17*s**18 + b16*s**17 + ... + b0, den= s**20 + a18*s**19 + ... a0&lt;/code&gt;) to cascade of the biquad transfer functions, also in s-domain. That is my flow:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert s-domain tf with numerator (num) and denominator (den) to the &#xA;z-domain tf mit numd and dend: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[numd dend] = bilinear(num, den, f);  // f= resonance frequency of plant&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert z-domain tf to the cascaded biquad filters: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[sos] = tf2sos (numd, dend);`&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally Convert biquad filters from z-domain to s-domain, e.g. for the first&#xA;biquad: However before running d2c I generate H:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H = tf([0.2046 0.4251 0.2014], [1.0000 2.6487 1.7591], 1/fs) &#xA;                                      // fs = sample frequency&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following error:&#xA;    &lt;code&gt;'Subscript indices must either be real positive integers or logicals.'&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What is wrong? Is there any other way which is superior to my flow? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance!&lt;/p&gt;&#xA;" OwnerUserId="18202" LastEditorUserId="8202" LastEditDate="2015-11-10T12:46:08.393" LastActivityDate="2015-11-10T12:46:08.393" Title="converting higher order transfer function in s-domanin to the cascaded biquad transfer functions, also in s-domain" Tags="|matlab|continuous-signals|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="26979" PostTypeId="2" ParentId="26966" CreationDate="2015-11-10T13:20:55.467" Score="2" Body="&lt;p&gt;A close alternative to a Hilbert transformer is using two infinite impulse response (IIR) all-pass filters that have a phase difference of approximately 90° over the frequency range of interest. For envelope detection, the two all-pass outputs are used in place of the original signal and its Hilbert transform. Here is one such filter pair with quadrature outputs $\text{out}_0$ and $\text{out}_1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{mid}_0[t] = 0.4794008656\,(\text{in}[t-1] + \text{mid}_0[t-2]) - \text{in}[t-3]\\&#xA;\text{mid}_1[t] = 0.8762184935\,(\text{mid}_0[t] + \text{mid}_1[t-2]) - \text{mid}_0[t-2]\\&#xA;\text{mid}_2[t] = 0.9765975895\,(\text{mid}_1[t] + \text{mid}_2[t-2]) - \text{mid}_1[t-2]\\&#xA;\text{out}_0[t] = 0.9974992559\,(\text{mid}_2[t] + \text{out}_0[t-2]) - \text{mid}_2[t-2]$$&#xA;$$\text{mid}_3[t] = 0.1617584983\,(\text{in}[t] + \text{mid}_3[t-2]) - \text{in}[t-2]\\&#xA;\text{mid}_4[t] = 0.7330289323\,(\text{mid}_3[t] + \text{mid}_4[t-2]) - \text{mid}_3[t-2]\\&#xA;\text{mid}_5[t] = 0.9453497003\,(\text{mid}_4[t] + \text{mid}_5[t-2]) - \text{mid}_4[t-2]\\&#xA;\text{out}_1[t] = 0.9905991567\,(\text{mid}_5[t] + \text{out}_1[t-2]) - \text{mid}_5[t-2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients were optimized for minimum largest error over a 20 Hz to 22.03 kHz pass band at a sampling frequency of 44.1 kHz. For a sinusoidal input the largest possible residual error in the envelope is -44 dB or ±0.6%. The following envelope is detected for a unit impulse at time 0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oXWFC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oXWFC.png&quot; alt=&quot;Impulse envelope&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The vertical axis is magnitude and the horizontal axis is time in samples. Because the all-pass filters are causal, the envelope will not be disturbed until after any transient. Reversing the exponentially decaying input signal gives quite a nice envelope all the way to the transient:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cBK21.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cBK21.png&quot; alt=&quot;Truncated exponential envelope sine and its detected envelope&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a bit of a time lag, which is why the input signal peaks are higher than the envelope. The time lag will be worse for a frequency close to the design band limits of the all-pass filter pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your bandwidth and error requirements are different, you can optimize your own polyphase allpass filters using the &lt;a href=&quot;http://ldesoras.free.fr/prod.html#src_hiir&quot; rel=&quot;nofollow noreferrer&quot;&gt;HIIR library&lt;/a&gt; by Laurent de Soras.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About filtering the envelope: A basic property of linear time invariant (LTI) systems is that if you filter an exponential function then the filter's output is the same exponential function multiplied by a constant. That does not affect the calculated decay rate. The same applies to your truncated exponential envelope if you only use smoothing filter outputs that are not affected by the end effects, by discarding part of the output or by using an anti-causal smoothing filter. The perspective is that you would use smoothing to reduce noise in general, not to reduce end effects. But if you do use it to reduce end effects, I don't think there is an equivalence between envelope filtering and generating the envelope using an all-pass filter pair, because the first does not preserve signal power.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-11T11:03:49.107" LastActivityDate="2015-11-11T11:03:49.107" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26980" PostTypeId="2" ParentId="26927" CreationDate="2015-11-10T13:43:53.903" Score="22" Body="&lt;p&gt;It's simpler than you think. When we discretize frequencies, we get frequency bins. So, when you discretize your Fourier Transform: &lt;span class=&quot;math-container&quot;&gt;$$e^{-j\omega} \rightarrow e^{-j{2\pi k}/{N}}$$&lt;/span&gt; Our continuous frequencies become &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; discrete bins.&lt;/p&gt;&#xA;&lt;p&gt;This is exactly why the following is true: &lt;span class=&quot;math-container&quot;&gt;$$n^{th}\,\text{bin} = n*\dfrac{\text{sampleFreq}}{\text{Nfft}}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\text{Nfft}$&lt;/span&gt; is the length of the DFT. Note that the FFT represents frequencies &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\text{sampleFreq}$&lt;/span&gt; Hz.&lt;/p&gt;&#xA;&lt;p&gt;(RAB - actually, if &lt;span class=&quot;math-container&quot;&gt;$\text{Nfft} = N$&lt;/span&gt;, then your bin index will span from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; through &lt;span class=&quot;math-container&quot;&gt;$N - 1$&lt;/span&gt;. Therefore, the frequencies generated will be &lt;code&gt;(0:N-1) * sampleFreq/Nfft&lt;/code&gt;, and you won't get the &lt;span class=&quot;math-container&quot;&gt;$N\cdot\text{sampleFreq}/N = \text{sampleFreq}$&lt;/span&gt; bin.  That unrepresented bin will alias onto and be summed with&#xA;the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; bin.  Instead, you will get bins &lt;code&gt;(0:9) * sampleFreq/10&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;In other words, if sampling 10 times per second, and sampling for 1 second, our frequency bins will be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Hz. Notice that the 10 Hz bin is not there.&lt;/p&gt;&#xA;" OwnerUserId="17009" LastEditorUserId="7092" LastEditDate="2022-11-07T18:14:49.700" LastActivityDate="2022-11-07T18:14:49.700" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="26981" PostTypeId="1" AcceptedAnswerId="26985" CreationDate="2015-11-10T19:39:38.683" Score="3" ViewCount="184" Body="&lt;p&gt;I am trying to build a resonance filter with real-time control of both center frequency and &lt;em&gt;Q&lt;/em&gt;. I've come across what looks to me like a suitable &quot;recipe&quot; for a second-order IIR filter that might do the job, at &lt;a href=&quot;http://www.music.mcgill.ca/~gary/307/week2/filters.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.music.mcgill.ca/~gary/307/week2/filters.html&lt;/a&gt; (toward the bottom of the page, quoted here with some loss of formatting):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = x[n] - a_1 y[n-1] - a_2 y[n-2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a_1 = -2r \cos(2 \pi f_0 T) \\ &#xA;      a_2 = r^2 \\&#xA;      f_0 = \text{resonant frequency} \\&#xA;      T = \text{sampling period} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or more &quot;refined:&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = b_0 x[n] + b_1 x[n-1] + b_2 x[n-2] - a_1 y[n-1] - a_2 y[n-2]$$&#xA;where $ b_0 = \frac{1 - r^2}{2} \\&#xA;    b_1 = 0 \\&#xA;    b_2 = -b_0 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The text says of the parameter $r$ that &quot;the closer $r$ is to 1.0, the narrower the bandwidth of the resonance peak.&quot; This sounds to me like the definition of $Q$, but I suspect that it's not identical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; What is the relationship between $r$ above and the more usual filter parameter $Q$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am just beginning to learn (self-teach) how to build filters, and I am still unclear on some of the concepts. Thanks in advance for any help.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/q/27014/80&quot;&gt;See also this question and its answer.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18207" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-11-27T06:50:39.937" Title="How to derive Q from r in this filter definition?" Tags="|filters|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="26983" PostTypeId="2" ParentId="26824" CreationDate="2015-11-11T00:42:33.643" Score="1" Body="&lt;p&gt;You should try &quot;Harmonic Percussive Source Separation&quot; ... quickly testable on your WAVs using librosa's &lt;a href=&quot;https://bmcfee.github.io/librosa/generated/librosa.decompose.hpss.html&quot; rel=&quot;nofollow&quot;&gt;librosa.decompose.hpss(spectrogram)&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Median-filtering harmonic percussive source separation (HPSS).&#xA;  Decomposes an input spectrogram S = H + P where H contains the&#xA;  harmonic components, and P contains the percussive components.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here are some citations and papers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fitzgerald, Derry. &quot;Harmonic/percussive separation using median filtering.&quot; (2010). (&lt;a href=&quot;http://www.researchgate.net/profile/Derry_Fitzgerald/publication/254583990_HarmonicPercussive_Separation_using_Median_Filtering/links/00b495396ef03235af000000.pdf&quot; rel=&quot;nofollow&quot;&gt;PDF&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeongsoo Park, Kyogu Lee, &quot;Harmonic-Percussive Source Separation Using Harmonicity and Sparsity Constraints&quot;, Proceedings of International Society for Music Information Retrieval Conference (ISMIR), pp. 148-154, Malaga, Spain, 2015 (&lt;a href=&quot;http://ismir2015.uma.es/articles/219_Paper.pdf&quot; rel=&quot;nofollow&quot;&gt;PDF&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Code example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import librosa&#xA;&#xA;y, sr = librosa.load('input.wav')&#xA;y_harmonic, y_percussive = librosa.effects.hpss(y)&#xA;librosa.output.write_wav('output_harmonic.wav', y_harmonic, sr)&#xA;librosa.output.write_wav('output_percussive.wav', y_percussive, sr)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="5648" LastEditDate="2015-11-19T21:57:40.860" LastActivityDate="2015-11-19T21:57:40.860" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26985" PostTypeId="2" ParentId="26981" CreationDate="2015-11-11T06:13:27.343" Score="1" Body="&lt;p&gt;I'll give you one quick answer (without proofs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your mapping from $s$ to $z$ is the Bilinear Transform, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Q = \frac{\sin(2 \pi f_0 T)}{2} \frac{1 + r^2}{1 - r^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's Impulse Invariant, I think it's&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Q = -\frac{\pi f_0 T}{\ln(r)} = -\frac{2 \pi f_0 T}{\ln(r^2)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For high $Q$ and reasonably low $f_0 T$, the two expressions come out nearly equal. &lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorDisplayName="user11906" LastEditDate="2015-11-27T06:50:39.937" LastActivityDate="2015-11-27T06:50:39.937" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26987" PostTypeId="1" CreationDate="2015-11-11T09:41:48.080" Score="0" ViewCount="3428" Body="&lt;p&gt;Suppose I have the following equation, where $x[n]$ is the input and $y[n]$ is the output: $$x[n]-x[n-1]=-10y[n-1]+2y[n]+2y[n+1].$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question asks me to compute the impulse response from this equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempts:&lt;/strong&gt; $x[n]=1$ when $n=0$; $0$ otherwise. I need to find $h[n]=y[n]$, but, from the equation, it always depends on the future value $y[n+1]$, which is unknown.&lt;/p&gt;&#xA;" OwnerUserId="17989" LastEditorUserId="11256" LastEditDate="2015-11-11T14:00:50.403" LastActivityDate="2015-12-11T14:37:14.420" Title="Impulse response of non-causal system" Tags="|impulse-response|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26988" PostTypeId="2" ParentId="26987" CreationDate="2015-11-11T10:04:35.510" Score="1" Body="&lt;p&gt;One way to solve such a difference equation is to use the $\mathcal{Z}$-transform. Transforming the given difference equation yields&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)\left(1-z^{-1}\right)=Y(z)\left(-10z^{-1}+2+2z\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which results in the following transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y(z)}{X(z)}=\frac{1-z^{-1}}{2z+2-10z^{-1}}=\frac12\frac{z^{-1}-z^{-2}}{1+z^{-1}-5z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The poles of $H(z)$, i.e. the zeros of the denominator polynomial in $(1)$, are both real-valued:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1+z^{-1}-5z^{-2}=(1-az^{-1})(1-bz^{-1})\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $a=\frac{-1+\sqrt{21}}{2}\approx 1.79$ and $b=\frac{-1-\sqrt{21}}{2}\approx -2.79$. Note that $1&amp;lt;|a|&amp;lt;|b|$ is satisfied, so both real-valued poles are outside the unit circle of the complex plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $(2)$, $H(z)$ can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac12\frac{z^{-1}-z^{-2}}{(1-az^{-1})(1-bz^{-1})}=\frac{1}{2(b-a)}\left[\frac{(1-a)z^{-1}}{1-az^{-1}}-\frac{(1-b)z^{-1}}{1-bz^{-1}}\right]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This transfer function can have three possible regions of convergence (ROCs), each of them corresponding to a different impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}(1)\quad &amp;amp;|z|&amp;gt;|b|&amp;gt;|a|\\&#xA;(2)\quad &amp;amp; |b|&amp;gt;|z|&amp;gt;|a|\\&#xA;(3)\quad &amp;amp; |b|&amp;gt;|a|&amp;gt;|z|\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ROC $(1)$ corresponds to a right-sided impulse response, ROC $(2)$ corresponds to a two-sided impulse response, and ROC $(3)$ corresponds to a left-sided sequence. Only ROC $(3)$ includes the unit circle $|z|=1$, so only the impulse response corresponding to this ROC results in a stable, yet anti-causal, system. The three impulse responses corresponding to the three ROCs given above are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}(1)\quad &amp;amp; h_1[n]=\frac{1}{2(b-a)}\left((1-a)a^{n-1}-(1-b)b^{n-1}\right)u[n-1]\\&#xA;(2)\quad &amp;amp; h_2[n]=\frac{1}{2(b-a)}\left((1-a)a^{n-1}u[n-1]+(1-b)b^{n-1}u[-n]\right)\\&#xA;(3)\quad &amp;amp; h_3[n]=\frac{1}{2(b-a)}\left(-(1-a)a^{n-1}+(1-b)b^{n-1}\right)u[-n]\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These impulse responses describe three different systems, all of them characterized by the same transfer function given by Eq. $(3)$. $h_1[n]$ corresponds to a causal unstable system, $h_2[n]$ to a non-causal unstable system, and $h_3[n]$ to an anti-causal stable system.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-11T14:08:15.927" LastActivityDate="2015-11-11T14:08:15.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26989" PostTypeId="1" CreationDate="2015-11-11T11:45:27.540" Score="3" ViewCount="506" Body="&lt;p&gt;I'm relatively new to DSP and I'm currently investigating FIR filter and IIR filters. From what I've found FIR filters can be implemented efficiently using the overlap-save method, but I was wondering if it might be possible to do the same using a IIR zero-phase filter? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example say I have a fairly long signal if I divided the signal into overlapping chunks similarly to how overlap-save does it, and I zero-phase filter each of these chunks to prevent phase distortions then discard the overlapping samples as per the algorithm, is there any way I would be able to end up with a consistent end result? I've been looking around the web and in books but I haven't been able to find any sources that says it's possible except for this site:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/freebooks/sasp/Overlap_Add_OLA_STFT_Processing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dsprelated.com/freebooks/sasp/Overlap_Add_OLA_STFT_Processing.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where it says for Zero-phase to overlap the segment with two of it's neighbors. I've tried experimenting with the instructions and attempted to implemented and used an overlapping low-pass zero-phase filter on a signal as seen below, with the overlap length being 150 on each end of the segments. I've also padded the borders of each segment with 0s to prevent border distortions. From the looks of the result I got it doesn't seem like that it'll be smooth however when I combine them compared to if I filtered it all in one go. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CnNaf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CnNaf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone could give me some pointers on what I might be doing wrong and where I need to look further it'd be great thanks!&lt;/p&gt;&#xA;" OwnerUserId="18214" LastActivityDate="2018-09-28T12:00:48.347" Title="Overlap/Chunk processing possible with Zero-phase?" Tags="|convolution|phase|infinite-impulse-response|filtering|finite-impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="26990" PostTypeId="1" AcceptedAnswerId="27000" CreationDate="2015-11-11T15:10:09.543" Score="0" ViewCount="464" Body="&lt;p&gt;I have implemented a typical one-pole lowpass filter to smooth out some control signals.&lt;br&gt;&#xA;The form of the filter is:&#xA;$$&#xA;y1 = x0 + b1\centerdot(y1 - x0)&#xA;$$&#xA;x0 is the current input sample.&lt;br&gt;&#xA;y1 is the past output sample.&lt;br&gt;&#xA;b1 is a smoothing coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I specify the b1 coefficient in terms of how much time it will take for the filter to converge to a certain percentage of the final value.&lt;br&gt;&#xA;For example, the following equation makes sure that it will take 300 ms for the signal level to converge to 1% (0.01) of the final value. SR is the sampling rate of the system.&#xA;$$&#xA;\large {b1 = e^{\frac{ln(0.01)}{300 * SR * 0.001}}}&#xA;$$&#xA;…or in a more computationally expensive form:&#xA;$$&#xA;\large {b1 = 10^{\frac{log_{10}(0.01)}{300 * SR * 0.001}}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's see an example:&#xA;$$&#xA;\large {b1 = e^{\frac{ln(0.01)}{5}}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This causes the one pole filter to converge to 1% of the final value in 5 samples.&lt;br&gt;&#xA;Let's initialize y1 with 1 and y0 with 0.&lt;br&gt;&#xA;Now let's see the first 5 samples of the impulse response of the filter:&#xA;$$&#xA;[1]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.3981072\\&#xA;[2]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.1584893\\&#xA;[3]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.0630957\\&#xA;[4]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.0251189\\&#xA;[5]\quad y1 = y0 + b1\centerdot(y1 - y0)\rightarrow y1 = 0.0100000\\&#xA;$$&#xA;This is what we wanted, the signal is now 0.01 compared to the &#xA;original 1.&lt;br&gt;&#xA;The impulse response of the filter will be exactly x after n samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, so good…&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I would like to make the transition even smoother so I started cascading more one-pole sections.&#xA;$$&#xA;y1_a = x0_a + b1\centerdot(y1_a - x0_a)\\   &#xA;y1_b = y1_a + b1\centerdot(y1_b - y1_a)\\    &#xA;y1_c = y1_b + b1\centerdot(y1_c - y1_b)\\  &#xA;…&#xA;$$&#xA;This certainly works well and gives the wanted effect, however it also messes up my time constant.&lt;br&gt;&#xA;For the same b1 coefficient the more cascaded one-pole sections the longer the filter takes to converge.&lt;br&gt;&#xA;So I would like to know what value the b1 coefficient has to take in order to make the filter converge in the same amount of time for more cascaded sections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically I would like to find an equation that takes:&lt;br&gt;&#xA;- time in ms&lt;br&gt;&#xA;- sample rate&lt;br&gt;&#xA;- number of cascaded one-pole sections&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and gives:&lt;br&gt;&#xA;- value of the b1 coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is anybody so kind to take my hand and lead me through the math?&lt;br&gt;&#xA;Thank you so much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luigi&lt;/p&gt;&#xA;" OwnerUserId="18220" LastActivityDate="2015-11-11T21:51:10.007" Title="Cascaded one-pole sections and relationship to time constant" Tags="|filters|discrete-signals|lowpass-filter|smoothing|real-time|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26991" PostTypeId="2" ParentId="26918" CreationDate="2015-11-11T15:39:58.160" Score="5" Body="&lt;p&gt;Kalman filter is the best linear estimator regardless of stationarity or Gaussianity. Also in the Gaussian case it does not require stationarity (unlike Wiener filter). In the linear Gaussian case Kalman filter is also a MMSE estimator or the conditional mean. &lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="15513" LastEditDate="2015-11-11T20:23:53.610" LastActivityDate="2015-11-11T20:23:53.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26992" PostTypeId="1" AcceptedAnswerId="26993" CreationDate="2015-11-11T16:28:17.443" Score="0" ViewCount="2323" Body="&lt;p&gt;I have learned the Butterworth filter, normally it is used for low pass design. And the amplitude response is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(jw)|=\frac{1}{\sqrt{1+(\frac{w}{w_{c}})^{2n}}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;mentioned in this &lt;a href=&quot;https://www.youtube.com/watch?v=dmzikG1jZpU&quot; rel=&quot;nofollow&quot;&gt;Butterworth Introduction&lt;/a&gt;. &#xA;But as I know, the Butterworth can be designed as a high pass as well. Then what is the amplitude response for high pass? Is it simply like this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H_{hp}| = \frac{1}{|H(jw)|}$$ &lt;/p&gt;&#xA;" OwnerUserId="17723" LastEditorUserId="4298" LastEditDate="2018-08-07T22:18:28.420" LastActivityDate="2018-08-07T22:18:28.420" Title="Butterworth High Pass Filter Amplitude Response" Tags="|filter-design|frequency-response|highpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26993" PostTypeId="2" ParentId="26992" CreationDate="2015-11-11T16:47:09.103" Score="2" Body="&lt;p&gt;If $H_{LP}(j\omega)$ is the frequency response of a Butterworth low-pass filter, then its inverse would go to infinity for $\omega\rightarrow\infty$ (because $H_{LP}(j\omega)$ goes to zero for high frequencies). So that's not what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct high-pass frequency response is obtained by replacing $\omega/\omega_c$ by $-\omega_c/\omega$, resulting in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H_{HP}(j\omega)|=\frac{\left|\frac{\omega}{\omega_c}\right|^n}{\sqrt{1+\left(\frac{\omega}{\omega_c}\right)^{2n}}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which approaches unity with increasing frequency, as should be the case for a high-pass filter.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-11T20:38:11.170" LastActivityDate="2015-11-11T20:38:11.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26994" PostTypeId="2" ParentId="26989" CreationDate="2015-11-11T16:48:37.590" Score="1" Body="&lt;p&gt;If you apply a zero-phase IIR (for instance, by filtering both forwards and backwards) to a segment of a signal that has been zero-padded on both sides, and the two zero-padding lengths are equal or greater than the length of the IIR filter's impulse response (until that response drops below your desired noise floor), then you can sum non-overlapping segments, but you have to keep and include the zero-padded tails in the sum (similar to overlap add).  The error will be related to the (infinite length) ends of the IIR tails that have been cut off by finite length zero-padding.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-11-11T16:48:37.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26996" PostTypeId="1" AcceptedAnswerId="29695" CreationDate="2015-11-11T19:47:00.563" Score="2" ViewCount="7065" Body="&lt;p&gt;I am seeing this term in every image processing object recognition tutorial, but no one explains what this is. They only explain how to find convexity defects but what is a convexity defect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="14842" LastActivityDate="2017-09-22T12:52:16.010" Title="What is the deffinition of convexity defect in image processing?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="26997" PostTypeId="1" CreationDate="2015-11-11T20:49:38.647" Score="1" ViewCount="369" Body="&lt;p&gt;I'm studying a project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My signal is audio 8KHz Mono, 8 bits in Low frequencies 70Hz until 1200Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I perform the calculus with the transition band is &lt;strong&gt;very narrow&lt;/strong&gt; (Transition Frequency) my Order results are (according to proposed window):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this Example the worst case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DeltaFrequency = 1.060180596543088 Hz&#xA;dNormalizedDeltaFreq= 1.060180596543088/8000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How is calculated the Order? My Answer is below, check the PD!&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rectangular: 6793 &lt;/li&gt;&#xA;&lt;li&gt;Hamming:24903&lt;/li&gt;&#xA;&lt;li&gt;Hanning:23393&lt;/li&gt;&#xA;&lt;li&gt;Kaiser:27353&lt;/li&gt;&#xA;&lt;li&gt;Blackman:41503&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If I try to use 16KHz, before orders will be doubled!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I want to use Hardware only to perform the filtering FIR process, and I'm worry about of Time needed to perform this functionalities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;COMMENT1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reduce Sampling Frequency is not optional, I need to deal with 1200Hz signals too!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PD&lt;/strong&gt;:  (This is not question!)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    if (windowType.toLowerCase().equals(&quot;rectangular&quot;)) {&#xA;      Size = (int)Math.ceil(0.9/dNormalizedDeltaFreq);&#xA;    }&#xA;    if (windowType.toLowerCase().equals(&quot;hamming&quot;)) {&#xA;      Size = (int)Math.ceil(3.3/dNormalizedDeltaFreq);&#xA;    }&#xA;    if (windowType.toLowerCase().equals(&quot;hanning&quot;)) {&#xA;      Size = (int)Math.ceil(3.1/dNormalizedDeltaFreq);&#xA;    }&#xA;    if (windowType.toLowerCase().equals(&quot;kaiser&quot;)) {&#xA;//      Mitra's book Handbook for Digital Signal Processing quotes Kaiser with a &#xA;//      simple estimate: N = [-20*log10(sqrt(dp*ds)) - 13]/[14.6(ws - wp)/2pi]&#xA;       double Att = 60.0;&#xA;      Size = (int)Math.ceil((Att - 7.95)/(14.36*dNormalizedDeltaFreq));&#xA;    }&#xA;    if (windowType.toLowerCase().equals(&quot;blackman&quot;)) {&#xA;      Size = (int)Math.ceil(5.5/dNormalizedDeltaFreq);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;QUESTION 1:&lt;/strong&gt; it is feasible to use a FIR filter of this Order?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;QUESTION 2:&lt;/strong&gt; Which single device (hardware) help me perform this function?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;QUESTION 3:&lt;/strong&gt; How could be calculated the delay time?&lt;/p&gt;&#xA;" OwnerUserId="12165" LastActivityDate="2015-11-27T06:50:19.397" Title="dealing with Huge Length (Order) FIR filters" Tags="|filter-design|finite-impulse-response|digital-filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="26998" PostTypeId="2" ParentId="26997" CreationDate="2015-11-11T21:05:11.670" Score="2" Body="&lt;p&gt;There are three different implementations of FIR filters that I am aware of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is the basic &quot;transversal&quot; FIR in which you sum up the terms of the summation directly. It gets very expensive if $L$, the FIR length, gets long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second is the so-called &quot;fast convolution&quot; in which the FIR impulse response is zero-padded to a longer length and the DFT is applied to it once. Then there are two slightly different procedures, &quot;overlap-add&quot; (OLA) or &quot;overlap-save&quot; (OLS, sometimes called &quot;overlap-scrap&quot; which I think is more descriptive) to process blocks of the input into blocks of the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of these methods are well covered in textbooks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third method, &lt;strong&gt;not&lt;/strong&gt; really covered in textbooks at all, is the &quot;Truncated IIR&quot; filters (TIIR) and this might apply in your case.  The simplest example of a TIIR filter is the moving-sum or moving-average that you might find in cascade-integrate-comb (CIC) filters. They have recursion in them, but they are not, mathematically, IIR. Their IIR impulse response gets cancelled or truncated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're trying to implement a long FIR that is a sliding rectangular window (that's a moving sum) or a sliding Hann window or sliding Hamming window, you can do that &lt;strong&gt;very&lt;/strong&gt; efficiently with a TIIR.  A sliding Blackman is a little harder and I don't think TIIR will work for a sliding Kaiser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to go now, but I will return with some references. Or send me an email (it's easy to find) and I will send you copies of the references I have including a &quot;how-to&quot; paper I wrote about how to do biquad TIIR filters in general.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorDisplayName="user11906" LastEditDate="2015-11-27T06:50:19.397" LastActivityDate="2015-11-27T06:50:19.397" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27000" PostTypeId="2" ParentId="26990" CreationDate="2015-11-11T21:51:10.007" Score="1" Body="&lt;p&gt;The difference equation of your single pole filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]+b(y[n-1]-x[n])\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n$ is the time (sample) index, $x[n]$ is the input, and $y[n]$ is the output. Its transfer function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1-b}{1-bz^{-1}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you cascade $N$ identical single pole filters, the total transfer function is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(z)=H^N(z)=\frac{(1-b)^N}{(1-bz^{-1})^N}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse $\mathcal{Z}$-transform of $(3)$ is the impulse response of the total system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[n]=(1-b)^N\frac{(n+1)(n+2)\ldots (n+N-1)}{(N-1)!}b^n,\quad n\ge 0,\quad N&amp;gt;1\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(4)$ it's straightforward to compute the desired value of $b$ for $g[n]$ to decay to $0.01$ of its initial value in a given time $T$. The number of sample values corresponding to time $T$ is $K=\text{round}(Tf_s)$, where $f_s$ is the sampling frequency. We now need to solve&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g[K]=0.01\cdot g[0]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $b$, which results in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$b=\left(\frac{0.01\cdot (N-1)!}{(K+1)(K+2)\ldots (K+N-1)}\right)^{1/K}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $K=5$, as in your example, and for $N=2$ cascaded filters you get from $(5)$ a value of $b=0.27821$. For $N=5$ you would need to decrease this value to $b=0.15133$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-11T21:51:10.007" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27001" PostTypeId="1" AcceptedAnswerId="27016" CreationDate="2015-11-11T22:14:24.203" Score="0" ViewCount="869" Body="&lt;p&gt;I am unable to understand why the Constant Modulus ALgorithm is not functioning properly for QAM modulation in Rayleigh multipath fading. The same code worked  for BPSK in AWGN (previous Question asked &lt;a href=&quot;https://dsp.stackexchange.com/questions/26317/matlab-what-should-be-the-ber-performance-for-bpsk-using-constant-modulus-algor/26412#26412_&quot;&gt;Matlab: What should be the BER performance for BPSK using Constant Modulus Algorithm equalizer&lt;/a&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is in the equalization step, the variable &lt;code&gt;yy&lt;/code&gt; is containing NaN values and so the weights are not getting calculated. What should I do to make it work? Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 1 : I have updated the code with the new algorithm explained in the answer but still the problem persists which is the algorithm does not converge. I am unsure if I am calculating the symbol error rate properly or not. Would need help in whether to calculate SER or BER&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2 :&lt;/strong&gt; I am confused regarding the analytical expression for symbol error rate and bit error rate. When I used the analytical formula given in Book : Andrea Goldsmith and the function berawgn() in Matlab-- both give different results. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; % Script for computing the BER for QAM modulation in Rayleigh &#xA;% channel&#xA;&#xA;    clear all&#xA;    %N = 1e5; % number of bits or symbols&#xA;    % Script for computing the BER for QAM modulation in Rayleigh &#xA;% channel&#xA;&#xA;clear all&#xA;%N = 1e5; % number of bits or symbols&#xA;Eb_N0_dB = [0:15]; % multiple Eb/N0 values&#xA;&#xA;nTaps = 3;&#xA;mu = 0.001;&#xA;&#xA;j = sqrt(-1);&#xA;ht = 1/sqrt(2)*[randn(1,nTaps) + j*randn(1,nTaps)]; &#xA;&#xA;L = length(ht);&#xA;&#xA;M=64;&#xA;N = 10^5;&#xA;% Convert Eb/No values to channel SNR&#xA;% modulation &#xA;k = sqrt(1/((2/3)*(M-1))); % normalizing factor&#xA;m = [1:sqrt(M)/2]; % alphabets&#xA;alphaMqam = [-(2*m-1) 2*m-1]; &#xA;&#xA;j = sqrt(-1);&#xA;Eb_N0_dB = Eb_N0_dB + 10*log10(k);&#xA;&#xA;for ii = 1:length(Eb_N0_dB)&#xA;&#xA;&#xA;        uncoded_bits  = round(rand(1,N));&#xA;&#xA;        data=ceil(M.*rand(N,1))-1;&#xA;        tx=((randi(8,1,N)*2-9)+j*(randi(8,1,N)*2-9))/sqrt(42);  %64 QAM&#xA;&#xA;        ht = 1/sqrt(2)*[randn(1,nTaps) + j*randn(1,nTaps)]; &#xA;&#xA;        % Include The Fading&#xA;        %rx = tx.*ray;&#xA;        rx = filter(ht,1,tx);  %multi path Rayleigh fading&#xA;        % Noise variance&#xA;        N0 = 1/10^(Eb_N0_dB(ii)/10);&#xA;&#xA;        % Send over Gaussian Link to the receiver&#xA;        rx = rx + sqrt(N0/2)*(randn(1,length(tx))+1i*randn(1,length(tx)));&#xA;&#xA;        %CMA&#xA;        Le = 5; %Equalizer length&#xA;        e = zeros(length(rx),1); % error&#xA;        w = ones(Le,1); % equalizer coefficients&#xA;        %w(Le)=1; % actual filter taps are flipud(w)!&#xA;        yd = zeros(length(rx),1);&#xA;        received_sig = rx';&#xA;        xx = zeros(Le, 1);&#xA;        R2 = 1.380953; %64 QAM ; 1.32 for 16 QAM&#xA;        for i = 1:length(received_sig)&#xA;            xx = [received_sig(i); xx(1:end-1)];&#xA;            yy = w(:,i).'*xx;&#xA;            yd(i)= yy;&#xA;            e(i) = (yy)*(R2-abs(yy)^2);  %MODIFIED ALGORITHM ERROR FUNCTION&#xA;            w(:,i+1) = w(:,i) + mu*e(i)*conj(yy); %MODIFIED &#xA;            %e(i) = abs(yy)^2 - R2;&#xA;            %w(:,i+1) = w(:,i) - mu * xx * e(i) * yy.';&#xA;        end&#xA;        sb = filter(w(:,length(received_sig)+1), 1,  received_sig); % estimate symbols (perform equalization)&#xA;        sb = sb';&#xA;% M-QAM demodulator at the Receiver&#xA;&#xA;&#xA;% demodulation&#xA;   y_re = real(sb)/k;&#xA;   y_im = imag(sb)/k;&#xA;   % rounding to the nearest alphabet&#xA;   % 0 to 2 --&amp;gt; 1&#xA;   % 2 to 4 --&amp;gt; 3&#xA;   % 4 to 6 --&amp;gt; 5 etc&#xA;   ipHat_re = 2*floor(y_re/2)+1;&#xA;   ipHat_re(find(ipHat_re&amp;gt;max(alphaMqam))) = max(alphaMqam);&#xA;   ipHat_re(find(ipHat_re&amp;lt;min(alphaMqam))) = min(alphaMqam);&#xA;&#xA;   % rounding to the nearest alphabet&#xA;   % 0 to 2 --&amp;gt; 1&#xA;   % 2 to 4 --&amp;gt; 3&#xA;   % 4 to 6 --&amp;gt; 5 etc&#xA;   ipHat_im = 2*floor(y_im/2)+1;&#xA;   ipHat_im(find(ipHat_im&amp;gt;max(alphaMqam))) = max(alphaMqam);&#xA;   ipHat_im(find(ipHat_im&amp;lt;min(alphaMqam))) = min(alphaMqam);&#xA;&#xA;   ipHat = ipHat_re + j*ipHat_im; &#xA;&#xA;   BER(ii) = size(find(data - ipHat'),2);&#xA;&#xA;&#xA;&#xA;end&#xA;&#xA;&#xA;&#xA;AWGNtheoryBer = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber&#xA;&#xA;EbN0Lin = 10.^(Eb_N0_dB/10);&#xA;&#xA;&#xA;Pe_sim=[];&#xA;for i = 1:length(Eb_N0_dB),&#xA;    Pe_sim=[Pe_sim BER(i)];&#xA;end&#xA;&#xA;% plotting the simulated data&#xA;&#xA;% comparing with theoretical results&#xA;&#xA;if(M==4)&#xA;    a=1;&#xA;else&#xA;    a=4/log2(M);&#xA;end&#xA;b=3*log2(M)/(M-1);&#xA; RaytheoryBer=[];&#xA;for i = 1:length(Eb_N0_dB),&#xA;    RaytheoryBer= [RaytheoryBer 0.5*a*(1-sqrt(0.5*b*EbN0Lin(i)/(1+0.5*b*EbN0Lin(i))))];&#xA;end                      % Ref: Wireless Communication, A. Goldsmith&#xA;&#xA;&#xA;    [BERRaytheorymatlab SERTheoryMatlab] = berfading(Eb_N0_dB,'qam',64,1);&#xA;&#xA;figure;&#xA;semilogy(Eb_N0_dB,Pe_sim,'r-','Linewidth',2);&#xA;hold on;&#xA;semilogy(Eb_N0_dB, AWGNtheoryBer,'bs-');&#xA;hold on;&#xA;semilogy(Eb_N0_dB, RaytheoryBer,'g-');&#xA;hold on;&#xA;&#xA;semilogy(Eb_N0_dB, SERTheoryMatlab,'k-');&#xA;axis([Eb_N0_dB(1) Eb_N0_dB(end) 10^-5 0.5])&#xA;grid on&#xA;legend('sim-CMA','Theoretical-BER-AWGN channel','Raytheory-Goldsmith','Raytheory-Matlab');&#xA;xlabel('Eb/No, dB');&#xA;ylabel('Bit Error Rate');&#xA;title('Bit error probability curve for QAM in ISI with Rayleigh Channel');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="780" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2015-11-15T03:52:03.820" Title="Matlab: Help in applying equalizer and proper calculation of symbol error rate for QAM modulation in Rayleigh channel" Tags="|matlab|self-study|equalizer|fading-channel|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27005" PostTypeId="1" CreationDate="2015-11-12T06:51:17.233" Score="0" ViewCount="69" Body="&lt;p&gt;The signal of interest to me is the ocean wave height as a function of time at a particular location. Its power or variance spectrum is estimated by buoys at regular time intervals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, the spectral data is discrete in both time and frequency. The spectral data spans 0.02 and 0.485 Hz, in approximately 0.02 Hz intervals. This spectrum is reported every hour (3600 seconds).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to estimate the spectrum at finer time intervals (every 10 minutes, say). If have the spectrum at 1 am, 2 am, ... 11 am, what is the best way to estimate the spectrum at 5:30 am? I'm considering a linear interpolator, or a conventional decimator, but I'm wondering if there is an optimal way to do this.&lt;/p&gt;&#xA;" OwnerUserId="18229" LastActivityDate="2015-11-12T06:51:17.233" Title="Temporal Interpolation of Spectra" Tags="|frequency-spectrum|power-spectral-density|interpolation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27006" PostTypeId="1" AcceptedAnswerId="27017" CreationDate="2015-11-12T06:54:41.587" Score="0" ViewCount="16683" Body="&lt;p&gt;A Rayleigh flat fading channel has 1 tap and so there will be no intersymbol interference. &#xA;if&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N= 1000;&#xA; Then, &#xA;h=(1/sqrt(2))*(randn(N,1)+1i*randn(N,1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will generate 1000 coefficients which are complex Gaussian of zero mean. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 1: Is this a multi-path Rayleigh channel of number of taps = 1000?(Example taken from : &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/30477-ber-curve-for-bpsk-in-rayleigh-channel/content/BER_BPSK_Rayleigh.m&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/30477-ber-curve-for-bpsk-in-rayleigh-channel/content/BER_BPSK_Rayleigh.m&lt;/a&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, there are models such as Clarke's method of sinusoid and Jake's algorithm for modeling the Rayleigh channel as FIR. If the method in Question 1 and these algorithm create multi-path Rayleigh, then when do we use the Algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2: In the code and explanation therein for Rayleigh flat fading &lt;a href=&quot;http://www.dsplog.com/2008/08/10/ber-bpsk-rayleigh-channel/&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt; , a channel of length N is created but it is called flat. I am really confused as to what is the proper way to create multi-path Rayleigh fading and only flat Rayleigh fading (1 tap).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help.&lt;/p&gt;&#xA;" OwnerUserId="780" LastActivityDate="2021-12-12T17:04:32.740" Title="Matlab: Correct method of generating Rayleigh fading channel" Tags="|matlab|self-study|fading-channel|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27008" PostTypeId="1" AcceptedAnswerId="27010" CreationDate="2015-11-12T08:28:03.940" Score="1" ViewCount="1428" Body="&lt;p&gt;I understand how shifting and scaling work separately, but I'm unsure how to put them together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is to say, I understand if &lt;span class=&quot;math-container&quot;&gt;$$x(t) = X(\omega)$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$x(at) = \frac{1}{|a|}X\left(\frac{\omega}{a}\right)$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$x(t-t_0) = e^{-j\omega{t_0}}X(\omega)$$&lt;/span&gt; But if &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is both scaled and shifted, as in &lt;span class=&quot;math-container&quot;&gt;$x(at-t_0)$&lt;/span&gt;, how would the Fourier Transform be determined using properties of the Fourier Transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I tried was along the lines of:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x(at-t_0) = x\left(a\left(t-\frac{t_0}{a}\right)\right) \\&#xA;\text{let } v(at) = x\left(a\left(t-\frac{t_0}{a}\right)\right) \\&#xA;\text{and if } v(at) \leftrightarrow \frac{1}{|a|}V\left(\frac{\omega}{a}\right) \\&#xA;\text{then } x\left(a\left(t-\frac{t_0}{a}\right)\right) = \frac{1}{|a|}V(\omega)e^{-jw\frac{t_0}{a}} \\&#xA;\therefore x(at-t_0) = \frac{1}{|a|}X\left(\frac{\omega}{a}\right)e^{-jw\frac{t_0}{a}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I feel as though my logic rewriting &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$v(t)$&lt;/span&gt; isn't quite right and would appreciate if someone could either validate my logic or explain where my mistake is.&lt;/p&gt;&#xA;" OwnerUserId="18231" LastEditorUserId="47251" LastEditDate="2020-02-10T18:55:21.100" LastActivityDate="2020-02-10T18:55:21.100" Title="How does both shifting and scaling a function affect the Fourier Transform?" Tags="|fourier-transform|homework|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27010" PostTypeId="2" ParentId="27008" CreationDate="2015-11-12T08:41:00.883" Score="1" Body="&lt;p&gt;Your logic is correct. There are two ways to determine the answer. Yours is one of them:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}v(t)=x(at)&amp;amp;\Longleftrightarrow \frac{1}{|a|}X(\omega/a)\\v(t-t_0/a)=x(at-t_0)&amp;amp;\Longleftrightarrow\frac{1}{|a|}X(\omega/a)e^{-j\omega t_0/a}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}w(t)=x(t-t_0)&amp;amp;\Longleftrightarrow X(\omega)e^{-j\omega t_0}\\w(at)=x(at-t_0)&amp;amp;\Longleftrightarrow \frac{1}{|a|}X(\omega/a)e^{-j(\omega/a) t_0}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, both options lead to the same result.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-12T08:41:00.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27011" PostTypeId="1" AcceptedAnswerId="27012" CreationDate="2015-11-12T08:56:53.730" Score="2" ViewCount="24895" Body="&lt;p&gt;The unit step signal defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; u[n]= \lbrace 1; n&amp;gt;=0; \\&#xA;               \qquad0; n&amp;lt;0 \rbrace&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has three possible solutions for its Fourier domain representation depending on the type of approach. These are as follows -&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The widely followed approach (Oppenheim Textbook)- calculating the Fourier transform of the unit step function from the Fourier transform of the signum function.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;     F(u[n])=U(j\omega) = \pi\delta(\omega)+\frac{1}{j\omega}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Fourier Transform calculated from the Z transform of the unit step function (Refer Proakis Textbook, &lt;em&gt;Digital Signal Processing Algorithms and applications&lt;/em&gt;,  pages 267,268 section 4.2.8 )&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;     U(j\omega) = \frac {e^{\frac{j\omega}{2}}}{2j\sin \frac{\omega}{2}};   \omega \neq 2\pi k; k=0,1,2,3...&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Fourier transform calculated by splitting into even and odd functions - followed in Proakis Textbook (Refer Proakis Textbook, &lt;em&gt;Digital Signal Processing Algorithms and applications&lt;/em&gt;, page 618 section 8.1 )&#xA;$$&#xA;      U(j\omega) = \pi\delta(\omega)+\frac{1}{1-e^{-j\omega}}&#xA;$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The 2nd representation can be ignored since it is not a &lt;em&gt;well-behaved&lt;/em&gt; function. But the approaches followed by Proakis and Oppenheim are equally valid (they extend the Fourier transform to include impulses in the frequency domain)&#xA;But the confusion is that they provide different solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any mistake in my understanding? or am I missing any crucial point?? Kindly help me understand this and the correct form that can be used in all applications. (I found that the Oppenheim approach is used in deriving the Kramers-Kronig Relations and the Proakis approach used in the derivation of the Hilbert transform)    &lt;/p&gt;&#xA;" OwnerUserId="17556" LastEditorUserId="13320" LastEditDate="2016-11-13T13:22:05.600" LastActivityDate="2021-02-26T06:13:52.590" Title="What is the correct solution for Fourier transform of unit step signal?" Tags="|fourier-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27012" PostTypeId="2" ParentId="27011" CreationDate="2015-11-12T09:26:19.813" Score="1" Body="&lt;p&gt;Note that the first expression is the Fourier transform of the &lt;em&gt;continuous&lt;/em&gt; unit step $u(t)$, so it's not applicable to the discrete-time step sequence $u[n]$. Furthermore, the second and the third expressions are both correct, and they are identical if you take into account that the second expression does not claim validity at integer multiples of $2\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we leave out angular frequencies at multiples of $2\pi$, the third expression becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$U(j\omega)=\frac{1}{1-e^{-j\omega}}=\frac{1}{e^{-j\omega /2}(e^{j\omega /2}-e^{-j\omega /2})}=\frac{e^{j\omega /2}}{2j\sin(\omega/2)},\quad \omega\neq 2k\pi$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is identical to the second expression.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-12T09:26:19.813" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27014" PostTypeId="1" AcceptedAnswerId="27015" CreationDate="2015-11-12T12:04:56.517" Score="4" ViewCount="890" Body="&lt;p&gt;This question arose from a discussion in the comments to &lt;a href=&quot;https://dsp.stackexchange.com/questions/26981/how-to-derive-q-from-r-in-this-filter-definition&quot;&gt;this question&lt;/a&gt; and its answer. The author of that question discussed a discrete-time second order filter described by the following difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=b_0x[n]+b_1x[n-1]+b_2x[n-2]-a_1y[n-1]-a_2y[n-2]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $b_0=b_2=(1-r^2)/2$, $b_1=0$, $a_1=-2r\cos(2\pi f_0 T)$, and $a_2=r^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function corresponding to the difference equation $(1)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1-r^2}{2}\frac{1-z^{-2}}{1-2r\cos(\omega_p)z^{-1}+r^2z^{-2}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I use the abbreviation $\omega_p=2\pi f_0 T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the original question quoted above, $f_0$ was called &quot;resonant frequency&quot;, and the discussion inspired by that question was about whether or not $f_0$ equals the peak frequency of the filter's frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the &lt;strong&gt;questions&lt;/strong&gt; I pose are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the meaning of $r$ and $f_0$ as used in the coefficients of Eqs. $(1)$ and $(2)$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does $f_0$ equal the filter's peak frequency (i.e., the frequency where the magnitude of the filter's frequency response attains its maximum)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-11-13T12:32:10.720" Title="Discrete-time Biquad filter: Relation between peak frequency and pole frequency" Tags="|filters|filter-design|infinite-impulse-response|frequency-response|biquad|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27015" PostTypeId="2" ParentId="27014" CreationDate="2015-11-12T12:04:56.517" Score="3" Body="&lt;p&gt;According to the &lt;a href=&quot;http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;Audio EQ Cookbook&lt;/a&gt; the transfer function of a second-order band-pass filter with 0dB peak gain is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{\alpha-\alpha z^{-2}}{(1+\alpha)-2\cos(\omega_0)z^{-1}+(1-\alpha)z^{-2}}\\=\frac{\alpha}{1+\alpha}\cdot\frac{1-z^{-2}}{1-\frac{2}{1+\alpha}\cos(\omega_0)z^{-1}+\frac{1-\alpha}{1+\alpha}z^{-2}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_0$ is the angular frequency where the peak occurs (&quot;peak frequency&quot;), and $\alpha=\sin(\omega_0)/(2Q)$ is a parameter determined by $\omega_0$ and the desired quality factor $Q$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we express the same transfer function $H(z)$ in terms of its poles we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=k\frac{1-z^{-2}}{\left(1-re^{j\omega_p}z^{-1}\right)\left(1-re^{-j\omega_p}z^{-1}\right)}=&#xA;k\frac{1-z^{-2}}{1-2r\cos(\omega_p)z^{-1}+r^2z^{-2}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k$ is some gain constant to be determined, $0&amp;lt;r&amp;lt;1$ is the pole radius, and $\omega_p=2\pi f_p$ is the pole angle, corresponding to the pole frequency $f_p$. Comparing the denominator of $(2)$ to the filter coefficients given in &lt;a href=&quot;https://dsp.stackexchange.com/questions/26981/how-to-derive-q-from-r-in-this-filter-definition&quot;&gt;this question&lt;/a&gt; (and shown under Eq. $(1)$ in the question above), it is clear that the frequency $f_0$ in that question equals the pole frequency $f_p$ in our formulation. And $r$ in the question above is obviously the pole radius.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing $(1)$ and $(2)$ we can express $\alpha$ and $\omega_0$ of Eq. $(1)$ in terms of the pole radius $r$ and the pole angle $\omega_p$ used in Eq. $(2)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&amp;amp;\frac{1-\alpha}{1+\alpha}=r^2  \Longrightarrow \alpha=\frac{1-r^2}{1+r^2},\qquad&#xA;k=\frac{\alpha}{1+\alpha}=\frac{1-r^2}{2}\\&#xA;&amp;amp;\frac{2}{1+\alpha}\cos(\omega_0)=(1+r^2)\cos(\omega_0)=2r\cos(\omega_p)\end{align}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second line of Eq. $(3)$ shows that the pole angle $\omega_p$ and the peak frequency $\omega_0$ are not equal, and that the following relationship holds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1+r^2}{2r}\cos(\omega_0)=\cos(\omega_p)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following Matlab/Octave example illustrates the above. We choose $\omega_0=0.2\pi$ and $Q=1$ and design the corresponding biquad band-pass filter according to Eq. $(1)$. The figure below shows the magnitude of the resulting frequency response, and the locations of the peak frequency $\omega_0$ (red line) and of the pole angle $\omega_p$ (green line), both normalized by $\pi$.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;w0 = .2*pi;&#xA;Q = 1;&#xA;al = sin(w0)/(2*Q);&#xA;b = [al,0,-al]/(1+al);                % numerator coeffs&#xA;a = [1+al,-2*cos(w0),1-al]/(1+al);    % denominator coeffs&#xA;p = roots(a);                         % poles&#xA;r = abs(p(1));                        % pole radius&#xA;r2 = sqrt((1-al)/(1+al));             % pole radius according to formula&#xA;abs(r-r2)                             % ans = 0&#xA;wp = abs(angle(p(1)));                % pole angle: wp = 0.17877*pi&#xA;wp2 = acos((1+r^2)/(2*r)*cos(w0));    % pole angle according to formula&#xA;abs(wp-wp2)                           % ans = 0&#xA;[H,w]=freqz(b,a,1024);&#xA;plot(w/pi,abs(H))&#xA;hold on, plot([w0,w0]/pi,[0,1],'r',[wp,wp]/pi,[0,1],'g'), hold off&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CQo0O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CQo0O.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Eq. $(2)$ I assumed that there are two complex conjugate poles, because in the &lt;a href=&quot;https://dsp.stackexchange.com/questions/26981/how-to-derive-q-from-r-in-this-filter-definition&quot;&gt;original question&lt;/a&gt;, which triggered this question and answer, the filter coefficients were chosen in such a way that only complex conjugate poles were possible (cf. the coefficients under Eq. $(1)$ of the question above).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the general transfer function in Eq. $(1)$ can also have a double real-valued pole or two different real-valued poles. It can be shown that a double real-valued pole occurs when the quality factor $Q$ is chosen as $Q=\frac12$. This case is still covered by Eq. $(2)$ with $\omega_p=0$ (i.e., a positive real-valued pole) or $\omega_p=\pi$ (a negative real-valued pole). For $Q&amp;lt;\frac12$ we get two different real-valued poles, and Eq. $(2)$ is not valid anymore. Instead, the transfer function becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=k\frac{1-z^{-2}}{(1-\beta_1z^{-1})(1-\beta_2z^{-1})}=&#xA;k\frac{1-z^{-2}}{1-(\beta_1+\beta_2)z^{-1}+\beta_1\beta_2z^{-2}}\tag{a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\beta_1$ and $\beta_2$ are the two real-valued poles. Comparing this transfer function to the transfer function given in Eq. $(1)$, we get the following relationships between $\alpha$, $\omega_0$, $k$ and $\beta_1$ and $\beta_2$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\alpha&amp;amp;=\frac{1-\beta_1\beta_2}{1+\beta_1\beta_2}\\&#xA;\cos(\omega_0)&amp;amp;=\frac{\beta_1+\beta_2}{1+\beta_1\beta_2}\\&#xA;k&amp;amp;=\frac{1-\beta_1\beta_2}{2}\end{align}\tag{b}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the pole angles are now either zero or $\pi$, because both poles are real-valued. Note that the peak frequency $\omega_0$ is not  necessarily $0$ or $\pi$. The peak frequency $\omega_0$ can in fact take any value, and the two pole angles will always be either $0$ or $\pi$ as long as the quality factor $Q$ satisfies $Q&amp;lt;\frac12$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-11-13T12:32:10.720" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27016" PostTypeId="2" ParentId="27001" CreationDate="2015-11-12T12:17:34.267" Score="2" Body="&lt;p&gt;Let's take a look at the cost function of CMA:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ J(\mathbf{w}) = E[|y_{k}^{2} - 1|^{2}] $,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;onde $ y_{k} = \mathbf{w}^{H} \mathbf{x}_{k} $ and $ \mathbf{x}_{k} $ is the filter input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It says that the update function will converge to coefficients that approximate the output of the filter to something whose squared value is $ 1 $. So, it is appropriate to use CMA when you have in the input a BPSK signal, because the symbols in BPSK are $ {-1,1} $, and its squared values are $ 1 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, it will not work if your equalizer input are not signals whose squared values could be 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know the problem with your code, but in the foirst moment, CMA will not work for QAM modulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have never worked with &lt;a href=&quot;http://www.ijcaonline.org/journal/number3/pxc387184.pdf&quot; rel=&quot;nofollow&quot;&gt;Multi Modulus Algorithm (MMA)&lt;/a&gt;, but I think that this would be an appropriate algorithm to apply insted of CMA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the paper you posted in the comments, he is apllying a variation of the CMA, that have the following cost function (equation (5) in the paper):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ J(\mathbf{w}) = E[(|x_{k}|^{2} - \Delta_{2})^{2}] $,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ \Delta_{2} = E[|x(k)|^{4}]/E[|x(k)|^{2}] $. That leads to the following error function (equation (6) in the paper):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ e(k) = x(k)(\Delta_{2} - |x_{k}|^{2}) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then, the update function becomes (equation (7) in the paper):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ w(i+1) = w(i) + \mu e(k) v^{*}(k - i) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in your code you are implementing the CMA that has the first cost function I wrote, and not the second one. You need to implement the second one in your code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read this paper again, carefully, and you will be able to implement by yourself.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="17125" LastEditDate="2015-11-13T00:31:23.853" LastActivityDate="2015-11-13T00:31:23.853" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="27017" PostTypeId="2" ParentId="27006" CreationDate="2015-11-12T12:39:22.140" Score="3" Body="&lt;p&gt;&lt;strong&gt;Question 1:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, it is a multipath Rayleigh Channel with $ 1000 $ taps. You need to know that when you generate complex coefficients, and the real part and the imaginary part of this coefficients are randomly chosen according to a Gaussian distribution, the magnitude will have a Rayleigh distribution and the phase will have a uniform distribution between $ 0 $ and $ 2 \pi $. The problem with this method, is that you don't have control on how the channel varies: the channel in a given instant of time will have no correlation with the channel in the previous instant. To add this correlation, we use the others methods as Clark's and Jake's models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look what he wrote in his website, in the assumptions section:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;The channel is flat fading – In simple terms, it means that the multipath channel has only one tap. So, the convolution operation reduces to a simple multiplication.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In his code, he is performing a multiplication, not a convolution, when applying the Rayleigh Channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He generates $ N $ coefficients, but what he is trying to do is simulate the channel variation in time, so each symbols is multiplied by an attenuation (inside the vector h). The vector h is not a vector of a filter coefficients, but a vector that stores the channel attenuation for each symbol.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-11-12T12:39:22.140" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27019" PostTypeId="1" CreationDate="2015-11-12T15:36:36.003" Score="2" ViewCount="140" Body="&lt;p&gt;&lt;strong&gt;Doubt1:&lt;/strong&gt; What is the Lowest Sampling Frequency used by majorities sound applications. Is there limited frequency sampling lower than 8KHz In C/C++?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Comment&lt;/strong&gt; In Java I haven't detected any problem, but using VCL program into one wav sound file (with lower Freq to 8K) was not played, producing Error!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Doubt2:&lt;/strong&gt; Can I to capture sound using arbitrary Frequency Sampling in C/C++? This process/function/method depends on specific Library? Can I to do this using pure C/C++ Code (without specialized Libraries), where?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe this is a foolish question. I have sound with the 100Hz-500Hz Spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Doubt3:&lt;/strong&gt; What is the recommended lowest Nyquist Sampling Frequency (I Know that teorical is two), but is there another practical Criterion? Example: Is recommended to use 2.5, 3 or 4.&#xA;In my sound the TEORICAL Nyquist sampling Frequency must be 1KHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="12165" LastActivityDate="2015-11-12T21:03:02.423" Title="Sample Frequency - Recommended Practical Nyquist, Lower Used by majorities appications" Tags="|frequency|sampling|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27020" PostTypeId="1" AcceptedAnswerId="27021" CreationDate="2015-11-12T16:36:09.967" Score="3" ViewCount="4884" Body="&lt;p&gt;I'm having DSP for the first time, and after some classes I got confused about the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a signal which its fourier transform in a frequency band $[ \omega_1,\omega_2] $ is just a &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_delta_function&quot; rel=&quot;nofollow&quot;&gt;delta function&lt;/a&gt; with a peak somewhere in that band . What is the energy of the signal in that specific frequency band?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that the answer depends on the integral &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \int_{\omega_1}^{\omega_2}|\delta (\omega-\omega^*)|^2.d\omega $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\omega_1 &amp;lt; \omega^* &amp;lt; \omega_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd guess this is 1 (maybe 0...), but I don't know how to compute it. &lt;/p&gt;&#xA;" OwnerUserId="11264" LastEditorUserId="11264" LastEditDate="2015-11-12T16:43:55.040" LastActivityDate="2015-11-13T00:36:28.417" Title="How to calculate the energy in the dirac delta function signal?" Tags="|fourier-transform|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27021" PostTypeId="2" ParentId="27020" CreationDate="2015-11-12T16:46:31.887" Score="0" Body="&lt;p&gt;\begin{align}&#xA;&amp;amp;\int_{\omega_1}^{\omega_2}|\delta (\omega-\omega^*)|^2.d\omega \\&#xA;&amp;amp;= \int_{\omega_1}^{\omega_2}|\delta (\omega-\omega^*)|.|\delta (\omega-\omega^*)|.d\omega \\&#xA;&amp;amp;= \int_{\omega_1}^{\omega_2}\delta (\omega-\omega^*).\delta (\omega-\omega^*).d\omega \\&#xA;&amp;amp;= \int_{\omega_1}^{\omega_2}\delta (\omega^*-\omega^*).d\omega \\&#xA;&amp;amp;= \int_{\omega_1}^{\omega_2}\delta (0).d\omega \\&#xA;&amp;amp;= \delta (0).\Delta \omega &#xA;\end{align}&#xA;Which is undefined! See this for better clarification: &lt;a href=&quot;https://en.wikipedia.org/wiki/Distribution_(mathematics)#Adding_and_multiplying_distributions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Distribution_(mathematics)#Adding_and_multiplying_distributions&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have to understand is that $\delta$ is not a function, it is a distribution. What you learn in introductory DSP courses is just an &quot;engineering trick&quot; so that things will work the way they should (you will understand what that means once you study sampling and analog to digital conversion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Sorry I misinterpretation the question. (Thanks &lt;a href=&quot;https://dsp.stackexchange.com/users/3369/jazzmaniac&quot;&gt;Jazzmaniac&lt;/a&gt; for pointing that out)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know the $\delta$ &quot;function&quot; in the continuous domain is not in $L^2$, it isn't a square-integrable function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about your question in the time domain. If you have 2 symmetric $\delta$'s in the frequency domain, you will have a INFINITLY lasting sinusoid. It's energy is infinite, i.e, you can't associate a value to it (undefined, remember that $\infty$ is not a number). If you have a single $\delta(f)$, centered at zero, you will have a complex exponential in the time domain, and it's energy is also undefined (unbounded since $|e^x|^2=1$.)&lt;/p&gt;&#xA;" OwnerUserId="18167" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-11-13T00:36:28.417" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27022" PostTypeId="1" CreationDate="2015-11-12T17:49:16.647" Score="0" ViewCount="58" Body="&lt;p&gt;Mathematically, suppose I have a function $f(t)=\sum_k c_k e^{-i \omega_kt}$, where $\omega_k$ may not fall in $[0,2\pi]$. With an analytical Fourier transform, I can get a sum of delta functions centered at those frequencies. Now, I only have $N$ evenly-spaced points of $f(t_j)$ in the time domain $[0,T]$, albeit $N$ and $T$ can be freely chosen. How do I use a numerical Fourier transform to get the frequencies $\omega_k$ (e.g. for $\omega_1=1,\omega_2=10,\omega_3=-30$), not confined in $[0,2\pi]$ and with no prior knowledge of the frequency upper/lower limit?&lt;/p&gt;&#xA;" OwnerUserId="15076" LastActivityDate="2015-11-12T17:49:16.647" Title="Numerical Fourier transform for exact frequency" Tags="|fourier-transform|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27025" PostTypeId="2" ParentId="27019" CreationDate="2015-11-12T21:03:02.423" Score="1" Body="&lt;p&gt;44.1 kHz and 48 kHz are sampling frequencies that are almost always supported by software and drivers but if you need to go lower than that then stop at 8 kHz, as it is commonly supported.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-11-12T21:03:02.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27026" PostTypeId="1" AcceptedAnswerId="27043" CreationDate="2015-11-13T01:50:24.377" Score="0" ViewCount="210" Body="&lt;p&gt;I am working on Active Noise Cancellation Project. I came across this strange problem, where the signal is getting attenuated as the audio bit depth changes and I cannot understand it!&lt;br&gt;&#xA;My circutit :I connected Audio Output( Head phone terminal) of PC to Audio IN of NI myRIO 1900 device using AUX cable (two way 3.5mm jack cable). I have a pre-recorded signal(.wav) of sinusoidal waveform with Amplitude 1, Frequency 2kHz, 40000 Sample Rate, 80 Number of Samples, Bit depth( bits per sample) = 16.&lt;br&gt;&#xA;Now, I just played .wav file using windows media player and tried to record the waveform on NI myRIO module. Surprisingly, I am getting an attenuation of the signal corresponding to the volume reduction in PC(not linear!!). Only I could see the waveform close to amplitude 1, when I increased the volume of the system to 100%. Please explain this !!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ADC of NI myRIO has its Resolution as 12 bits but the audio Output(.wav file) is 16 bit data. I am expecting it does not have to matter except in quantization errors, as at the PC Audio Out, the audio data should be converted to analog and and again at the 'NI myRIO Audio In', this analog signal will be sampled! (please correct me if I am wrong !)&lt;br&gt;&#xA;Another question is, I have tried the same with sinusoidal sound of Amplitude 2.5 and all other specifications are same as given above, now the audio signal is clipped off at 1V above and below -1V.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/i4xLy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i4xLy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA; ADC(NI myRIO) nominal range is 2.499V to -2.5V! Is it bacause of the bit depth conversion?&lt;br&gt;&#xA;Please explain these things !TQ &lt;/p&gt;&#xA;" OwnerUserId="17708" LastActivityDate="2015-11-13T20:57:25.650" Title="Cannot understand the attenuation in signal as the audio bit depth of adc changes" Tags="|audio|sampling|quantization|analog-to-digital|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27027" PostTypeId="1" CreationDate="2015-11-13T03:48:16.453" Score="5" ViewCount="297" Body="&lt;p&gt;I've got an input signal that while sloping up, approximately bounces off an imaginary line.  I'm looking for the equation to that imaginary line.  I have a method, but is very brute force and it takes too long.  I'm looking for ways to optimize my approach or hopefully learn about a completely different more efficient method.&#xA;I've written a script in Octave that will do what I want, but it takes 3-10 seconds (with an input signal of 1800 samples) depending on how many iterations I run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My brute force algorithm in Octave:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  x = 0:1:1800;&#xA;  for i = 1:200&#xA;    p = polyfit(x, input, 1);  % p gives the slope and offset&#xA;    output= polyval(p, x);&#xA;    input = clip(input, output);&#xA;  endfor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the clip function clamps the input to the output.  Clamps the input signal to the linear approximation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  for i = 1:length(input)&#xA;    if(input(i) &amp;gt; output(i))&#xA;      input(i) = output(i);&#xA;    end&#xA;  endfor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To better explain what I'm looking for, I've included the rough image below.  Of course, the red signal is the input and I'm looking for the equation of the blue line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lWgRQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lWgRQ.png&quot; alt=&quot;Signal example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for taking a look.&lt;/p&gt;&#xA;" OwnerUserId="18247" LastEditorUserId="18247" LastEditDate="2015-11-13T15:45:41.897" LastActivityDate="2015-12-14T14:23:19.063" Title="Looking for a better algorithm for finding the slope of an input signal" Tags="|matlab|discrete-signals|algorithms|octave|approximation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27029" PostTypeId="1" CreationDate="2015-11-13T07:34:47.843" Score="9" ViewCount="2430" Body="&lt;p&gt;I need to detect pitch (measure signal frequency) while the musicians play music, giving a warning if they are out of tune, but music happens to be a bit too fast for FFT (Fast Fourier Transform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below I try to give a technical description of the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Musicians play music at 90-140 bpm. This means that there are 90-140 groups of notes each minute, up to 8 (more frequently, up to 4) notes in each group (60/140/8 = 0.0536 sec, 60/90/4 = 0.167 sec), that is, notes may change at the rate of 6-19 notes per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The music uses a logarithmic scale (see the attached image): the range between, say, 440Hz and 880Hz is divided into 12 notes, only 7 of which are used for melody. (Basically, they use only the white keys on the piano; when they want to shift the starting frequency, they use some of the black keys and don't use some white keys.) &#xA;That is, the frequency of each next note is multiplied by 2^(1/12) = 1.05946.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make things more complicated, &lt;a href=&quot;https://en.wikipedia.org/wiki/A440_(pitch_standard)&quot; rel=&quot;nofollow noreferrer&quot;&gt;the A (La) frequency&lt;/a&gt; may vary from 438 to 446 Hz.  The string instruments in theory can be tuned, while the wind instruments depend on the air temperature and humidity, so the frequency happens to be re-negotiated by the musicians during the sound check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes musicians and vocalists make errors in frequency, they call it &quot;out of tune&quot;. They want a device that would inform them of such &quot;out of tune errors&quot;. They have tuners, but the tuners require playing the same sound for about 1 sec before they start showing anything. This works for tuning, but does not work while the music is played.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most likely, the tuner is doing FFT, and due to the formula $df = 1/T$ waits for 1 second to get the 1Hz resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For A=440Hz, the difference in frequency between two notes is 440*0.05946 = 26.16 Hz, to get that frequency resolution, one has to use acquisition time of 0.038 sec, that is, at tempo=196bpm FFT is able to just distinguish two notes, at 98 bpm it is able to tell a 50% out-of-tune error provided that it starts acquisition at the very moment that the pitch changes. If we allow the pitch change in the course of an acquisition period, we get 49 bpm, which is just too slow. In addition, it is very desirable to be more precise about the frequency, say, detect a 25% or 12% out-of-tune error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Is there a way to measure frequency (detect pitch) better than FFT, that is, with better resolution in less acquisition time?&lt;/em&gt;&lt;/strong&gt; (At least 2 times better, ideally, 8-16 times better.)&#xA;In exchange, I do not need to distinguish between notes of different octaves, e.g. both 440 and 880 may be recognized as A. I do not need the linearity of FFT output, a logarithmic scale would be better. (Probably, more trade-offs are possible, just nothing else comes to my mind right now.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a really good drawing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7Nl0C.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7Nl0C.gif&quot; alt=&quot;Note frequencies linked from Wikipedia&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18250" LastEditorUserId="1629" LastEditDate="2016-07-05T21:43:23.183" LastActivityDate="2023-04-14T00:24:24.297" Title="Fast pitch recognition" Tags="|audio|signal-detection|pitch|parameter-estimation|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27030" PostTypeId="2" ParentId="27029" CreationDate="2015-11-13T09:08:53.107" Score="11" Body="&lt;p&gt;&amp;quot;&lt;strong&gt;Is there a way to measure frequency (detect pitch) better than FFT, that is, with better resolution in less acquisition time?&lt;/strong&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;yes there is.  or are.  there are multiple better ways to do musical pitch detection in real time that are far, far better than running an FFT.&lt;/p&gt;&#xA;&lt;p&gt;consider &lt;strong&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Average Magnitude Difference Function (AMDF)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Q_x[k] = \sum_n |x[n] - x[n-k]| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Average Squared Difference Function (ASDF)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Q_x[k] = \sum_n (x[n] - x[n-k])^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Autocorrelation Function (AF)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ R_x[k] = \sum_n x[n] x[n-k] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;note that i am playing fast-and-loose with the limits to the summation.&lt;/p&gt;&#xA;&lt;p&gt;note also there there are no assumptions made about waveform shape or zero-crossings or other threshold crossings.  the only assumption is that when the lag &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is approximately a period (or two periods or some other integer multiple of the period length), &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; looks a lot like &lt;span class=&quot;math-container&quot;&gt;$x[n-k]$&lt;/span&gt;.  so the only assumption is that pitch is related to fundamental frequency of a periodic or nearly periodic (what i like to call &amp;quot;quasi-periodic&amp;quot;) function.&lt;/p&gt;&#xA;&lt;p&gt;my favorite is ASDF (and that is a thinly-veiled trade secret i just announced to everyone, but folks on &lt;em&gt;comp.dsp&lt;/em&gt; knew that already).  these are all time domain, AMDF and ASDF look very similar and ASDF looks like an upside-down version of AF.  you are looking for nulls in AMDF or ASDF or peaks in AF which would correspond to potential period lengths of the quasi-periodic input.&lt;/p&gt;&#xA;&lt;p&gt;here are a couple other tricks:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;you can always correlate the &lt;em&gt;most current&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples against some &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; samples delayed by &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.  that way you are dealing with the most current data possible in the real-time application.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;you need not calculate the correlation for every integer lag &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.  in fact, since you like log-frequency, the spacing for larger &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; might be bigger than the spacing for smaller &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;when a potential null (A_DF) or peak (AF) is found, you can compute the correlation for adjacent integer values of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;between adjacent integer values of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, you can do quadratic interpolation to determine the peak location to a fractional-sample precision.  i won't tell you how.  use your imagination.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the whole trick (and this is the secret sauce where trade secrets and IVL patents apply) is to choose the &lt;strong&gt;correct&lt;/strong&gt; peak or null when there are multiple candidates.  choosing the incorrect peak or null will result in an &amp;quot;octave error&amp;quot;.  i'm not gonna tell you how to do that.  use your imagination.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;send me an email and we can discuss contracting terms if you want me to design you a kick-ass pitch detector.  much better than YIN, which, in my opinion, works like shit.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2023-04-14T00:24:24.297" LastActivityDate="2023-04-14T00:24:24.297" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27031" PostTypeId="1" CreationDate="2015-11-13T10:17:18.150" Score="2" ViewCount="3615" Body="&lt;p&gt;I have a scenario where I have two OQPSK modulated signals and I need to increase the power of one signal by 3 dBm while keeping the other signal at the same power level. Could someone guide me on how to achieve this in Matlab.&lt;/p&gt;&#xA;" OwnerUserId="15794" LastActivityDate="2018-05-31T15:49:55.607" Title="Increase power of signal in Matlab" Tags="|matlab|power-spectral-density|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27032" PostTypeId="2" ParentId="27031" CreationDate="2015-11-13T10:35:15.270" Score="2" Body="&lt;p&gt;To increase the power of x by 3 dB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x .*= 10^(3/20)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-11-13T10:35:15.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27033" PostTypeId="2" ParentId="22124" CreationDate="2015-11-13T12:15:41.840" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://ml.cs.yamanashi.ac.jp/world/english/index.html&quot; rel=&quot;nofollow&quot;&gt;WORLD&lt;/a&gt; splits a signal into an f0 array, a spectral envelope matrix, and a non-harmonic components matrix. You can then recombine these to recover the original signal.&lt;/p&gt;&#xA;" OwnerUserId="595" LastActivityDate="2015-11-13T12:15:41.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27034" PostTypeId="1" CreationDate="2015-11-13T12:43:26.023" Score="2" ViewCount="117" Body="&lt;p&gt;I'm working on a problem where I'm trying to use background averaging to see what the frame looks like in a beehive behind the bees. I've been trying to use standard averaging (I take an image every 1 or 4 seconds over the course of my 3 hour video) as well as other techniques like mog and mog2. The problem is that there is an extremely high density of bees in the centre that is tightly packed and barely moving, so while I end up with a great view of the background around the middle, the centre turns into a bit of a smear like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6f8sN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6f8sN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any advice on what I could do to improve things? I spoke to a researcher who suggested something called &quot;sparse coding&quot; as one possible options and I'm curious if OpenCV has anything like that or if anyone knows of any other techniques I could try.&lt;/p&gt;&#xA;" OwnerUserId="8615" LastActivityDate="2016-04-12T14:48:52.377" Title="Background averaging not working" Tags="|computer-vision|opencv|machine-learning|background-subtraction|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27035" PostTypeId="1" AcceptedAnswerId="27158" CreationDate="2015-11-13T13:40:24.970" Score="4" ViewCount="469" Body="&lt;p&gt;I am not a signal processing expert and my feeble attempts at solving this problem have come up short.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a C++ application which is being fed regularly-spaced (in time) 3D position samples.  The samples are generally accurate and, if plotted, appear to be quite smooth.  However, when the second derivative is computed (to look at accelerations), there are occasional/rare spikes in the data which are unreasonable.  (I know the general range of possible accelerations.  And by &quot;rare&quot;, I mean that over about two ours of data, I generally see less than a dozen spikes which are out of the realm of possibility.)  I want to do as little to the data as possible, but smooth it enough to remove the spikes.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first attempt was to use a Kalman filter in our math library.  This removed the spikes, but changed the data far more than what I would really want and seems heavy-handed for what I need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seem to be a lot of options out there for 2D data, but I don't have enough signal processing background to understand the trade-offs or necessarily what might translate well to 3D data.  Any education or suggestions would be appreciated!&lt;/p&gt;&#xA;" OwnerUserId="18256" LastActivityDate="2015-11-18T15:08:19.667" Title="Smoothing 3D Data for the Second Derivative" Tags="|filters|sampling|smoothing|3d|c++|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27036" PostTypeId="1" CreationDate="2015-11-13T13:49:47.123" Score="0" ViewCount="142" Body="&lt;p&gt;I need to play thousands of simple sounds (generated tones) at the same time. If I am understand correctly there should be a way to add them together in complex wave but i really can't see the light in the end of the tunnel. Is there any good advice reads or formulas for beginners? &lt;/p&gt;&#xA;" OwnerUserId="17638" LastActivityDate="2015-11-13T14:14:07.363" Title="Adding sine waves" Tags="|sound|wave|signal-synthesis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27037" PostTypeId="2" ParentId="27036" CreationDate="2015-11-13T14:14:07.363" Score="-1" Body="&lt;p&gt;You can add each sample of each sound in time.  Say something like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Y[0] = X0[0] + X1 [0] + ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may need to check the maximum value when you are done and scale signal back down so the media will play in whatever format you are using&lt;/p&gt;&#xA;" OwnerUserId="18099" LastActivityDate="2015-11-13T14:14:07.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27038" PostTypeId="1" AcceptedAnswerId="27039" CreationDate="2015-11-13T14:28:21.287" Score="1" ViewCount="118" Body="&lt;p&gt;Suppose there is an image which is to be smoothed by convolving it with a Gaussian kernel with standard deviation $\sigma$. If the image is then smoothed with this kernel 8 consecutive times, is the total smoothing still Gaussian with some calculable standard deviation $\hat{\sigma}$? Or is it some other distribution instead?&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2015-11-13T14:56:18.083" Title="What is the equivalent smoothing function to running the same Gaussian 8 times?" Tags="|gaussian|smoothing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27039" PostTypeId="2" ParentId="27038" CreationDate="2015-11-13T14:56:18.083" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_blur#Mechanics&quot; rel=&quot;nofollow&quot;&gt;From Wikipedia:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Applying multiple, successive gaussian blurs to an image has the same effect as applying a single, larger gaussian blur, whose radius is the square root of the sum of the squares of the blur radii that were actually applied. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So in your case, that would be equivalent to blurring the image with a single Gaussian with $\hat{\sigma}$:&#xA;$$&#xA;\hat{\sigma} = \sqrt{8\sigma^2} = 2\sqrt{2} \sigma&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-13T14:56:18.083" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27040" PostTypeId="2" ParentId="27031" CreationDate="2015-11-13T15:55:10.887" Score="2" Body="&lt;p&gt;For example both signal $x_1$ and $x_2$ has the same value (amplitude), then we want to amplify the second signal to be 3 dB more than $x_1$ (I call it SNR, signal to noise ratio, the noise is signal itself).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;% demoDB: add 3 dB to  signal&#xA;Fs=2000;                        % Sampling Frequency&#xA;Fc=10;                          % Carrier Frequency&#xA;t=0:1/Fs:1;                     % define evaluation time&#xA;signal=sin(2*pi*Fc*t);          % Sample signal waveform&#xA;SNR=3;                         % SNR 3 dB will be added to signal &#xA;&#xA;scaledSignal = std(signal)/std(signal)*(sqrt(10^(SNR/10)))*signal;&#xA;&#xA;figure(1)&#xA;subplot(211); plot (signal)&#xA;subplot(212); plot(scaledSignal)&#xA;&#xA;% alternatively you can what Olli want to suggest&#xA;x2= signal.* 10^(3/20);&#xA;figure(2)&#xA;plot(x2)&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both plot and method give the same result&lt;/p&gt;&#xA;" OwnerUserId="11684" LastEditorUserId="11684" LastEditDate="2018-05-31T15:49:55.607" LastActivityDate="2018-05-31T15:49:55.607" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27041" PostTypeId="1" AcceptedAnswerId="27059" CreationDate="2015-11-13T16:05:33.820" Score="4" ViewCount="4134" Body="&lt;p&gt;Problem 6.1-6 of &lt;em&gt;Probability, Random Variables, and Random Signal Principles, 4th Edition&lt;/em&gt; by Peebles asks&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If a  process is defined by $X(t) = A$, where $A$ is a continuous random variable uniformly distributed on  $(0,1)$,   is &#xA;  the process deterministic or non-deterministic?      &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The textbook says that  &quot;a process is called deterministic if its value as a function of time can be pre-determined&quot; and the answer to the&#xA;question above is the process is &lt;em&gt;deterministic.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If $A$ is a random variable, then how can we determine time functions (or ensemble members) before specific $A$ is given?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What are examples of &lt;em&gt;non-deterministic processes?&lt;/em&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11809" LastEditorUserId="235" LastEditDate="2015-11-14T17:32:57.293" LastActivityDate="2023-04-03T00:49:37.980" Title="Deterministic / Non-deterministic Stochastic Process" Tags="|stochastic|random-process|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27043" PostTypeId="2" ParentId="27026" CreationDate="2015-11-13T20:57:25.650" Score="0" Body="&lt;p&gt;From &lt;a href=&quot;http://www.ni.com/pdf/manuals/376047a.pdf&quot; rel=&quot;nofollow&quot;&gt;NI myRIO-1900 User Guide and Specifications:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The audio inputs are left and right stereo line-level inputs with a&#xA;  ±2.5 V full-scale range&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;• For Audio In/Out, &lt;br&gt;&#xA;  LSB Weight = 5 V ÷ 212 = 1.221 mV &lt;br&gt;&#xA;  Maximum Positive Reading = +2047 * 1.221 mV = 2.499 V &lt;br&gt;&#xA;  Maximum Negative Reading = -2048 * 1.221 mV = -2.500 V&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your computer's head phone output probably has another constant of proportionality between voltage and numerical value. Perhaps you can find manufacturer's data, but it is probably safer to simply measure with the help of your NI device.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-11-13T20:57:25.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27044" PostTypeId="1" CreationDate="2015-11-13T22:29:21.847" Score="1" ViewCount="161" Body="&lt;p&gt;I've been fooling around with some audio transformations and it's useful for me to listen to them when debugging.  Is it possible to create/play a wav file that will damage my speakers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on a macbook pro and using the python module scikits.audiolab to play the sounds.&lt;/p&gt;&#xA;" OwnerUserId="18264" LastActivityDate="2015-11-13T22:41:06.833" Title="Can playing a wav file theoretically damage my speakers?" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27045" PostTypeId="2" ParentId="27044" CreationDate="2015-11-13T22:41:06.833" Score="3" Body="&lt;p&gt;Generally yes, but only if the amplifier is oversized for the speaker or there are other design faults. Active speakers where the amplifier needs to be generously sized to deliver the expected momentary performance are usually protected by peak limiters and filter circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For laptop speakers the probability of damage is extremely low.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-11-13T22:41:06.833" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27048" PostTypeId="2" ParentId="27034" CreationDate="2015-11-14T04:17:53.380" Score="0" Body="&lt;p&gt;Why not high pass filter each image before averaging, cutting out the lower frequency (bigger bee than comb)?  Then you should mostly be integrating comb when you average/sum the images&lt;/p&gt;&#xA;" OwnerUserId="18099" LastActivityDate="2015-11-14T04:17:53.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27050" PostTypeId="2" ParentId="27029" CreationDate="2015-11-14T09:48:24.217" Score="4" Body="&lt;p&gt;I already answered your question here: &lt;a href=&quot;https://stackoverflow.com/questions/33667275/fast-frequency-measurement/33678202#33678202&quot;&gt;https://stackoverflow.com/questions/33667275/fast-frequency-measurement/33678202#33678202&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, in summary, in certain circumstances, you can interpolate an FFT result to finer resolution that FFT bin spacing, thus allowing you to use a shorter data window for better time resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But FFT frequency is not pitch frequency.  And for some music instruments (those that produce slightly inharmonic overtones), neither is the auto-correlation function (or its relatives such as AMDF) frequency.  That's because pitch is a psychoacoustic phenomena.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-11-14T10:20:42.417" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27052" PostTypeId="2" ParentId="27027" CreationDate="2015-11-14T10:53:56.580" Score="1" Body="&lt;p&gt;I hope I understand what your'e asking correctly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the minimum slope of the image I would run an calculate the slope at each point (should be fast enough) and than take the minimal one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = 1:.05:3000;&#xA;y = 100+x + 300*sin(2*pi*x/1000);&#xA;origin = [0 0] ; % or origin = [ x(1) y(1) ];&#xA;slope = (y - origin(2)) ./ (x - origin(1));&#xA;[ minslope , minidx ] = min( slope ) ;&#xA;angle = atand( minslope );&#xA;figure;plot( x,y ,'-');&#xA;hold on;&#xA;plot([ origin(1) x(minidx)] , [origin(2) y(minidx)] ,'-r');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will give you this slope:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kbniR.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kbniR.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best of luck!,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Elad&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2015-11-14T10:53:56.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27053" PostTypeId="2" ParentId="27034" CreationDate="2015-11-14T11:03:43.567" Score="0" Body="&lt;p&gt;Hey It seems that average really isnt the solution here as at most time a bee captures the background,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you say that mixture of Gaussians doesnt work , I would have tried &#xA;1. To use visualization to understand a bit more about what I'm trying to find. &#xA;Ill plot the time value of a background pixel and look at a bunch of them&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. if your image is built like a [ rows&lt;em&gt;column&lt;/em&gt;times ]  matrix called timeSeries&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot ( timeSeries(i,j,:) ,'.');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;One very simple idea I used is median filtering which works great to remove bright outliers. However in your case you might need to use a smaller percentile on each pixel&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bg_img(i,j) = prctile ( timeSerties(i,j,:) , 30 ) ;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps,&#xA;Cheers,&#xA;  Elad&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2015-11-14T11:03:43.567" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27054" PostTypeId="2" ParentId="11467" CreationDate="2015-11-14T12:52:15.443" Score="1" Body="&lt;p&gt;Your code is correct and the results are consistent. You may be surprised by them due to some 'hidden features'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First,  &lt;code&gt;conv2&lt;/code&gt; returns by default the full convolution, such that the result is the size of the image plus a border of half the size of the kernel (that is, the total size if the size of the image plus that of the kernel). When you interpret your results, be aware of it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the results represent coefficients that are stronger for a higher correlation between your kernel and your local image patch: as expected you also extract the borders of the image. See in particular your leftmost result showing strong vertical line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last, &lt;code&gt;imagesc&lt;/code&gt; scales by default the scale between the highest to the lowest coefficient. That's why in the leftmost result, you mainly see the border.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are different options to &lt;code&gt;conv2&lt;/code&gt;described in &lt;code&gt;help conv2&lt;/code&gt; which allow to control this behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware also that there many different definitions of kernels for detecting edges, such as log-Gabors &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TM0hD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TM0hD.png&quot; alt=&quot;different types of filters&quot;&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in a full implementation (in python) you may have a look at:  &lt;a href=&quot;https://pythonhosted.org/LogGabor/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pythonhosted.org/LogGabor/&lt;/a&gt; (shameless self-plug ).&lt;/p&gt;&#xA;" OwnerUserId="1085" LastEditorUserId="15549" LastEditDate="2017-12-07T16:18:07.707" LastActivityDate="2017-12-07T16:18:07.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27056" PostTypeId="2" ParentId="26966" CreationDate="2015-11-14T13:06:34.663" Score="0" Body="&lt;p&gt;The Hilbert transform is certainly the best option to extract the envelope of an oscillating signal, but as you pointed out, it may be giving oscillations when your signal deviates from the hypothesis that led to the formulation of the transform (here smoothness).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aren't you hammering a needle with a sledgehammer? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are interested in the decay rate (and that you certainly assume that it is stationary), I would recommend using a simpler method by fitting your signal with a model of it. For instance, you can write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def model(decay, start, amp, freq, phase):&#xA;    t = np.linspace(0, N)&#xA;    signal =  (t &amp;gt; start) &#xA;    signal *= np.exp(-(t-start)/decay ) &#xA;    signal *= np.sin(2*np.pi * (freq * t -phase))&#xA;    return signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then use one of the zillions implementations of a least-square optimizer. In python, &lt;a href=&quot;https://pypi.python.org/pypi/lmfit&quot; rel=&quot;nofollow&quot;&gt;lmfit&lt;/a&gt; is my favorite. Instead of getting a result as a function of time, you'll directly get what you are looking at.&lt;/p&gt;&#xA;" OwnerUserId="1085" LastActivityDate="2015-11-14T13:06:34.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27057" PostTypeId="1" AcceptedAnswerId="27061" CreationDate="2015-11-14T14:02:20.073" Score="3" ViewCount="340" Body="&lt;p&gt;Taylor series can create harmonics of the frequencies in an input signal. I'm wondering if it is likewise possible to use Volterra series to create sub-harmonics of the frequencies in that signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some degree of finesse is required in posing the question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taylor series don't &lt;em&gt;only&lt;/em&gt; create harmonics; there's intermodulation distortion as well. Likewise, it's ok with me if a suitable Volterra series doesn't &lt;em&gt;only&lt;/em&gt; create sub-harmonics, but also creates something similar to intermodulation distortion, or even some degree of harmonic distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to exclude trivial cases where the input signal gets so wrecked that it ends up looking like white noise, which would obviously create sub-harmonics (along with every other frequency you can imagine!). I'm not sure how to formalize this requirement precisely, other than to say that I hope it's clear what I'm driving at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's one way to formalize the behaviour I want:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Given an input $\cos(\omega t)$, yields an output containing $\cos(\frac{\omega}{n} t)$ for &#xA;some fixed $n$, ideally a natural number&lt;/li&gt;&#xA;&lt;li&gt;Given a general input, a sub-harmonic is generated corresponding to every frequency in the input&lt;/li&gt;&#xA;&lt;li&gt;Other &quot;intermodulation distortion&quot;-type artifacts are allowed, &quot;within reason&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The answer can be expressed for either discrete or continuous signals.&lt;/p&gt;&#xA;" OwnerUserId="18276" LastEditorUserId="8202" LastEditDate="2015-11-14T14:07:01.427" LastActivityDate="2022-07-21T12:38:36.960" Title="Is it possible to use a Volterra series to generate subharmonics?" Tags="|discrete-signals|signal-analysis|audio|non-linear|taylor-expansion|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27058" PostTypeId="1" CreationDate="2015-11-14T15:39:09.577" Score="0" ViewCount="37" Body="&lt;p&gt;I have written software to detect the transmission of frequency sequences.&#xA;I'm using Geortzel's Algorithm to filter desired frequencies from a data array. The data array is generated from audio capture. I am transmitting a sequence of bits encoded in two frequencies, &lt;code&gt;F-mark&lt;/code&gt; and &lt;code&gt;F-space&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, my signal-to-noise ratio is not satisfactory and even with scaling and thresholding of the signals, I am getting too many false positives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've had the idea to use two independent frequencies to represent each the mark and the space (4 frequencies in total) and only register a valid signal if both are detected simultaneously. This seems like it would only approximately double the computation time which is acceptable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would this improve improve the accuracy of my detection, or would it have no effect on my signal-to-noise ratio? Would it also increase the likelihood of false negatives and missed detections?&lt;/p&gt;&#xA;" OwnerDisplayName="user18279" LastActivityDate="2015-11-14T15:39:09.577" Title="Improving accuracy of Geortzel using simultaneous frequencies" Tags="|audio|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27059" PostTypeId="2" ParentId="27041" CreationDate="2015-11-14T15:54:07.597" Score="5" Body="&lt;p&gt;Regardless of what your book might say, a random process is a &lt;em&gt;collection&lt;/em&gt; of random variables that is described in mathematical notation as&#xA;$\{X(t) \colon t \in \mathbb T\}$ or $\{X_t\colon t \in \mathbb T\}$ where&#xA;$\mathbb T$ is called the index set (typically, $\mathbb T$ is &#xA;$(-\infty,\infty)$ or $\{\cdots, -2, -1, 0, 1, 2, \cdots\}$ or subsets&#xA;thereof) and we have one random variable for each $t \in \mathbb T$.&#xA;Each random variable is, of course, a mapping from the sample space&#xA;$\Omega\to \mathbb R$, and when the experiment is performed and&#xA;the outcome $\omega \in \Omega$ is known, the random variable&#xA;$X_t$ maps that $\omega$ onto some real number that is, of&#xA;course, usually denoted by $X_t(\omega)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we have this (typically infinite) collection of random variables,&#xA;a &lt;em&gt;sample path&lt;/em&gt; or &lt;em&gt;realization&lt;/em&gt; of the random process is the &quot;waveform&quot;&#xA;that you see when the experiment is performed (with outcome&#xA;$\omega_{11809}$, say) &#xA;and each of the random&#xA;variables $X_t$ maps this outcome onto $X_t(\omega_{11809})$.&#xA;That's the &quot;waveform&quot;: its value at $t = 0$ is $X_0(\omega_{11809})$,&#xA;and when $t = 12$, its value is $X_{12}(\omega_{11809})$ and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we come to the crux of the matter. A &lt;em&gt;deterministic&lt;/em&gt; random process&#xA;is one for which if we know the value(s) of one or more of the&#xA;$X_t(\omega)$, say $X_{0}(\omega)$ and $X_2(\omega)$,&#xA;then we know the value of &lt;em&gt;all&lt;/em&gt; the $X_t(\omega)$: knowing the&#xA;value taken on by a few of the random variables in the set tells&#xA;us the values that &lt;em&gt;all&lt;/em&gt; the random variables took on. That is,&#xA;there is &quot;no more randomness left&quot; in the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this in mind, consider a random process for which &lt;em&gt;all&lt;/em&gt; the&#xA;random variables $X_t$ are in fact the &lt;em&gt;same&lt;/em&gt; random variable&#xA;$A$. (Whether $A$ is uniformly distributed on $(0,1)$ or not is&#xA;totally irrelevant to the issue being considered). Then, if we&#xA;know that $X_0(\omega) = A(\omega) = 0.13$, then&#xA;we know that $X_t(\omega) = 0.13$ &lt;strong&gt;for all $t \in \mathbb T$&lt;/strong&gt;.&#xA;That is why your book is claiming that the random process&#xA;is deterministic. Note that if $X_t$ were to equal&#xA;$A \cos(2\pi f_0 t)$ where$f_0$ is some known constant instead of just $A$,&#xA;the process would still be deterministic since knowledge of the&#xA;value of $X_0$ would give away knowledge of everything.&#xA;If instead $X_t = A \sin(2\pi f_0 t)$, then knowing the value&#xA;of $X_0$ would not be useful but knowing the value of&#xA;$X_{(4f_0)^{-1}}$ (or any other $X_t$ where $\sin(2\pi f_0 t) \neq 0$)&#xA;would again be a telltale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a harder question that you can use to test whether you understand&#xA;the above explanation, consider whether a random process in which&#xA;by $$X_t = A \cos(2\pi f_0 t + \Theta), -\infty &amp;lt; t &amp;lt; \infty$$ where $A$ and $\Theta$&#xA;are independent random variables is a deterministic process or not.&#xA;Does knowing the values of just a few of the random variables $X_t$&#xA;tell you the value of all of them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, that is the basic idea behind the notion of deterministic&#xA;random processes: observation of &lt;em&gt;some&lt;/em&gt; part of a sample path&#xA;allows us to determine the &lt;em&gt;entire&lt;/em&gt; sample path with perfect&#xA;accuracy. How about nondeterministic random processes? Consider&#xA;$$X_n = A_n, \quad n = \cdots, -2, -1, 0, 1, 2, \cdots$$&#xA;where the $A_n$ are &lt;em&gt;independent&lt;/em&gt; random variables with some&#xA;specific distribution, e.g. each $A_n \sim \mathcal N(0,\sigma^2)$.&#xA;In this case, the process is often referred to as a&#xA;(discrete-time) &lt;em&gt;white noise process&lt;/em&gt; which might give you a&#xA;hint as to whether it should qualify as a deterministic or&#xA;a nondeterministic process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exercise: what is the significance of the number 11809 in the second&#xA;paragraph above?&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-11-14T19:53:02.763" LastActivityDate="2015-11-14T19:53:02.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27060" PostTypeId="2" ParentId="14143" CreationDate="2015-11-14T17:16:41.473" Score="-1" Body="&lt;p&gt;If I understand correctly your IW should be [1*10] as it takes 1-dim input to 10-dim hidden layer&#xA;than &#xA;LW should be [10*1] as it takes 10-dim hidden to 1-dim output,&#xA;b should be 10 for the hidden layer and 1 for the output layer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do you think your'e missing something?&lt;/p&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2015-11-14T17:16:41.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27061" PostTypeId="2" ParentId="27057" CreationDate="2015-11-14T17:31:56.573" Score="3" Body="&lt;p&gt;Check out this paper.  I would have made a comment but not high enough rep.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/1211087&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Looks like you need multiple in to get subharmonics in Volterra series&lt;/p&gt;&#xA;&lt;p&gt;The abstract states &amp;quot;Subharmonic generation is a complex nonlinear phenomenon which can arise from nonlinear oscillations, bifurcation and chaos. It is well known that single-input-single-output Volterra series cannot currently be applied to model systems which exhibit subharmonics.&lt;/p&gt;&#xA;&lt;p&gt;A new modeling alternative is introduced in this paper which overcomes these restrictions by using local multiple input single output Volterra models. The generalized frequency-response functions can then be applied to interpret systems with subharmonics in the frequency domain.&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="18099" LastEditorUserId="7092" LastEditDate="2022-07-21T12:38:36.960" LastActivityDate="2022-07-21T12:38:36.960" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27063" PostTypeId="2" ParentId="26966" CreationDate="2015-11-14T21:59:02.097" Score="0" Body="&lt;p&gt;The solution given by @Olli Niemitalo taught me a lot (and I have not understood it completely yet). Let me try a trick without filtering (the latter may have parameters). I reduce the transient effect by mirroring the signal around its first and last &quot;true maxima&quot;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7LLED.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7LLED.png&quot; alt=&quot;Modulated signal mirror extension&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and computing the Hilbert envelope on the resulting extension. The same can be done around the first and last minima. Here are the obtained envelopes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9UfQM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9UfQM.png&quot; alt=&quot;Upper and lower estimated envelopes&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, one could average the bottom and the top envelopes to further reduce oscillations (they could be post-filtered as well). This is neither very systematic, nor grounded on a solid body of work, but quite reduced in parameters. Feedback appreciated on the given Matlab code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Design a decaying sine&#xA;nSample = 1024;&#xA;time = linspace(0,1,nSample)';&#xA;timeCorr = linspace(-1,1,2*nSample-1)';&#xA;frequency = 22;&#xA;decay = 1.34;&#xA;dataSin = sin(2*pi*frequency*time);&#xA;dataEnv = (exp(-decay*time)).^1.2;&#xA;data = dataSin.*dataEnv;&#xA;&#xA;% Compute local maxima&#xA;% Uses http://www.mathworks.com/matlabcentral/fileexchange/12275-extrema-m--extrema2-m&#xA;[xmax,imax,xmin,imin] = extrema(data);&#xA;imax = sort(imax);&#xA;imin = sort(imin);&#xA;&#xA;% Crop data between the first maximum and the ultimate&#xA;iMax1 = imax(1); if isequal(iMax1,1), iMax1 = imax(2);end&#xA;iMax2 = imax(end); if isequal(iMax2,nSample), iMax2 = imax(end-1);end&#xA;dataMod = data(iMax1:iMax2);&#xA;lDataMod = length(dataMod);&#xA;&#xA;% Half-sample mirror symmetry at both ends&#xA;dataMod3 = [flipud(dataMod(2:end));dataMod;flipud(dataMod(1:end-1))];&#xA;timeMod3 = (iMax1-lDataMod+1:iMax2+lDataMod-1)';&#xA;figure(1);clf&#xA;hold on&#xA;plot(timeMod3,dataMod3)&#xA;plot(iMax1:iMax2,dataMod,'r')&#xA;hold off&#xA;&#xA;% Hilbert enveloppe on the mirror symmetrized signal&#xA;dataHMod3 = abs(hilbert(dataMod3));&#xA;dataHTop = NaN*ones(size(data));&#xA;dataHTop(iMax1:iMax2) = dataHMod3(lDataMod:end-lDataMod+1);&#xA;&#xA;%% Do the same on the lower envelope&#xA;iMin1 = imin(1); if isequal(iMin1,1), iMin1 = imin(2);end&#xA;iMin2 = imin(end); if isequal(iMin2,nSample), iMin2 = imin(end-1);end&#xA;dataMod = -data(iMin1:iMin2);&#xA;lDataMod = length(dataMod);&#xA;&#xA;% Half-sample mirror symmetry at both ends&#xA;dataMod3 = [flipud(dataMod(2:end));dataMod;flipud(dataMod(1:end-1))];&#xA;timeMod3 = (iMin1-lDataMod+1:iMin2+lDataMod-1)';&#xA;figure(2);clf&#xA;hold on&#xA;plot(timeMod3,dataMod3)&#xA;plot(iMin1:iMin2,dataMod,'r')&#xA;hold off&#xA;&#xA;% Hilbert enveloppe on the mirror symmetrized signal&#xA;dataHMod3 = abs(hilbert(dataMod3));&#xA;dataHBot = NaN*ones(size(data));&#xA;dataHBot(iMin1:iMin2) = dataHMod3(lDataMod:end-lDataMod+1);&#xA;&#xA;figure(3);clf;hold on&#xA;plot(time,[data],'k')&#xA;plot(time,[dataEnv,-dataEnv],'kx')&#xA;plot(time,[dataHTop,-dataHBot],'r')&#xA;axis tight&#xA;legend('Data','Env. True Top','Env. True Bottom','Est. Top','Est. Bottom')&#xA;hold off&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-11-14T21:59:02.097" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27064" PostTypeId="1" CreationDate="2015-11-14T22:24:12.873" Score="0" ViewCount="845" Body="&lt;p&gt;I am developing a medical algorithm working on large amounts of data. However, as in many medical scenarios I have a lot of negative example and only a few positive ones. So any neural network I train is clearly biased towards negative classification. In fact it misclassifies most positive examples and although overall accuracy is OK, false negative rate is sky high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to know what is the best way to make the network achieve lower false negative rate, I thought about duplicating the positive examples several times or maybe reducing the negative examples randomly,&#xA;What do you think?&lt;/p&gt;&#xA;" OwnerUserId="4727" LastEditorUserId="7338" LastEditDate="2017-04-11T08:05:04.903" LastActivityDate="2017-04-11T08:05:47.303" Title="Neural network with much less positive examples" Tags="|matlab|machine-learning|neural-network|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27067" PostTypeId="2" ParentId="26862" CreationDate="2015-11-15T11:03:26.187" Score="1" Body="&lt;p&gt;Your question is strongly related to the discussion in &lt;a href=&quot;https://dsp.stackexchange.com/questions/26794/how-to-represent-a-given-equation-more-clear-profressional-and-short-form/26799&quot;&gt;How to represent a given equation more clear, profressional and short form?&lt;/a&gt;, and a matter of speaking formally or loosely. First, an image convolved by a filter remains an image, which can be interpreted as a matrix or a vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet the resulting image might not be of the same size, depending on filter size and border management. So scalar additions and subtractions could be ill-defined. Luckily here, the two gradient Sobel filters have the same size, hence $K_x$ and $K_y$ as well. Powers and square-roots should be understood as scalar too in that case, hence pixel by pixel. So assuming only scalar operations, $I_\delta$ is an image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\max$ is hardly a matrix, unless &quot;very lossely&quot; speaking. The subtraction, that might work in Matlab, is only understandable if you allow a scalar to be a constant matrix with the same size as the others matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your notation $x$ does not seem much clearer to me. So apart from notations suggested in &lt;a href=&quot;https://dsp.stackexchange.com/questions/26794/how-to-represent-a-given-equation-more-clear-profressional-and-short-form/26799&quot;&gt;How to represent a given equation more clear, profressional and short form?&lt;/a&gt;, you can defined an &quot;inverted gradient image&quot; $I_g$ as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\forall (i,j)\in [1,\ldots,M]\times [1,\ldots,N],\; I_g(i,j) = \max_{ (i,j)\in [1,\ldots,M]\times [1,\ldots,N]} I_\delta (i,j) - I_\delta(i,j)\,. $$&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-11-15T11:03:26.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27068" PostTypeId="1" CreationDate="2015-11-15T12:38:36.247" Score="2" ViewCount="8606" Body="&lt;p&gt;Given a signal&#xA;$s(t) = e^{j(t+\pi)}$,&#xA;I conclude that the signal is periodic with period $T=2\pi$, so its power should be&#xA;$$P = \frac{1}{T}\int_{-T/2}^{T/2}|s(t)|^2dt= \frac{1}{2\pi}\int_{-\pi}^{\pi}|1|^2dt = \frac{1}{2\pi}t|^{\pi}_{-\pi}=\frac{\pi-(-\pi)}{2\pi}=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the formula for the power of a periodic signal correct?&lt;/p&gt;&#xA;" OwnerUserId="18287" LastEditorUserId="13320" LastEditDate="2016-11-13T12:49:55.340" LastActivityDate="2018-10-13T15:00:20.570" Title="Power of periodic signal" Tags="|signal-analysis|continuous-signals|periodic|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27069" PostTypeId="2" ParentId="27068" CreationDate="2015-11-15T13:02:28.267" Score="3" Body="&lt;p&gt;The &lt;em&gt;average power&lt;/em&gt; of a signal $s(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\overline{s^2(t)}=\lim_{T\rightarrow\infty}\frac{1}{T}\int_{-T/2}^{T/2}|s(t)|^2dt\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $s(t)$ is periodic, $(1)$ is equivalent to the average power in one period:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\overline{s^2(t)}=\frac{1}{T}\int_{-T/2}^{T/2}|s(t)|^2dt\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ now denotes the period of $s(t)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-15T18:09:54.863" LastActivityDate="2015-11-15T18:09:54.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27070" PostTypeId="1" CreationDate="2015-11-15T13:57:29.167" Score="1" ViewCount="908" Body="&lt;p&gt;Here I'm talking about the less-than-ideal situations, in other words, the audio &#xA;sample data may have &lt;strong&gt;burrs&lt;/strong&gt; or error bits in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Encode and decode theory&lt;/strong&gt;:&#xA;I am using &lt;strong&gt;FSK&lt;/strong&gt; to encode my original binary data (&lt;code&gt;0&lt;/code&gt;,&lt;code&gt;1&lt;/code&gt; and &lt;code&gt;lead-byte&lt;/code&gt;), and transform the square wave it generated to &lt;strong&gt;sine wave&lt;/strong&gt;. Then I generate a stream of audio samples through mic (for example, a stream of 44100 16-bit integers for every second etc.).&#xA;When I decode (&lt;code&gt;c language&lt;/code&gt;), the key factor is, &lt;code&gt;0:1:lead-byte = 1:2:4&lt;/code&gt;(or other ratio).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;original binary data: &lt;code&gt;0|1...0|1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;encoded wave data: &lt;code&gt;lead-byte...lead-byte 0|1...0|1 lead-byte&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The typical ideal samples and bad samples waveform are as below.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wBQsL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wBQsL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;good wave&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/A99Kg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A99Kg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;bad wave 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my decode method is simple (&lt;strong&gt;just count the samples up and below zero, and get stable lead-byte width first, then use &lt;code&gt;1:2:4&lt;/code&gt; to calculate 0 and 1's width&lt;/strong&gt;). Should I use more complex mathematical analysis in decoding? If so, what theory can I use, Fourier? Gaussian Noise? Rayleigh Fading? Goertzel algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to point out that I am totally new in audio stuff.&#xA;Any help would be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="18255" LastEditorUserId="8202" LastEditDate="2015-11-15T20:19:02.087" LastActivityDate="2015-11-15T20:19:02.087" Title="How do I decode(demodulation) and get original data from audio sample data" Tags="|audio|modulation|c|waveform-similarity|fsk|" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27072" PostTypeId="1" CreationDate="2015-11-15T18:24:33.620" Score="1" ViewCount="689" Body="&lt;p&gt;I am trying to understand the concept of frequency modulation. As written in Wikipedia, if I have a signal containing information $x_m(t)$ and I want to transmit it using frequency modulation, I need to determine a center frequency $f_c$ of the carrier wave, which has a constant amplitude. To do so, I define &#xA;$$&#xA;f(\tau) = f_c + f_{\Delta}x_m(\tau)&#xA;$$&#xA;And then, I modulate my carrier signal&#xA;$$&#xA;y(t) = \cos\left(2\pi f_ct + \int\limits_0^tf_{\Delta}x_m d\tau\right)&#xA;$$&#xA;Where $f_{\Delta}$ is the the peak frequency deviation, i.e the maximum shift away from $f_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the roll that $f_{\Delta}$ takes, but I am having troubles understanding how to calculate it. For example, I want to transmit the signal&#xA;$$&#xA;x_m(t) = H(t-t_1) - H(t-(t_1+\Delta t)) + H(t-t_2) - H(t-(t_2 + \Delta t))&#xA;$$&#xA;i.e transmit a binary code in some sort. How can I find the frequency deviation? How do I calculate the carrier signal?&lt;/p&gt;&#xA;" OwnerUserId="18290" LastActivityDate="2015-11-15T18:24:33.620" Title="Determining frequency deviation FM" Tags="|frequency|modulation|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27074" PostTypeId="1" CreationDate="2015-11-15T19:12:46.627" Score="0" ViewCount="2781" Body="&lt;p&gt;Why is a combination of R, L, C linear time-invariant system? But not diode, or transistor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked over V-I equation for R, L, C, but still don't know how to prove it.&lt;/p&gt;&#xA;" OwnerUserId="3802" LastEditorUserId="4346" LastEditDate="2016-03-15T00:23:31.427" LastActivityDate="2019-09-30T00:17:42.940" Title="Linear time invariance RLC" Tags="|linear-systems|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27075" PostTypeId="2" ParentId="27074" CreationDate="2015-11-15T19:27:26.770" Score="0" Body="&lt;p&gt;Probably an &lt;a href=&quot;https://en.wikipedia.org/wiki/RLC_circuit&quot; rel=&quot;nofollow&quot;&gt;RLC circuit&lt;/a&gt;,  with a resistor (R), an inductor (L), and a capacitor (C), with parameters that do not vary over time. In the &lt;a href=&quot;https://en.wikipedia.org/wiki/RLC_circuit#Series_RLC_circuit&quot; rel=&quot;nofollow&quot;&gt;series circuit&lt;/a&gt; for instance, with constant voltage, you are led to a linear differential equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the circuit, with inputs and outputs,  is a system. With constant parameters, it is time-invariant. It is linear, governed by a linear equation. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-11-15T19:27:26.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27076" PostTypeId="1" CreationDate="2015-11-15T19:35:20.870" Score="0" ViewCount="3830" Body="&lt;p&gt;what are the differences  between Fourier transform and cosine transform..... &#xA;i try to find the typical answer &#xA;the difference ,from where ,the size of input and output form,in time complexity,the domain ,the effect on image itself .&lt;/p&gt;&#xA;" OwnerUserId="18292" LastActivityDate="2015-11-16T02:11:37.773" Title="What are the differences between fft and dct?" Tags="|image-processing|" AnswerCount="1" CommentCount="2" ClosedDate="2015-11-16T17:06:50.147" ContentLicense="CC BY-SA 3.0" />
  <row Id="27077" PostTypeId="1" CreationDate="2015-11-15T20:04:51.747" Score="1" ViewCount="339" Body="&lt;p&gt;I'm interested in creating a series of odd only harmonics, without the fundamental, for audio use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example the input could be a sine wave at specific frequency $f$ and output is $3f$, $5f$, $7f$, etc. - but without the original $1f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the $1f$ (in a real audio system) is unknown and the input is multi-tone, just filtering the $1f$ out is not an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea for replacing an input of $1f$ with an output of $3f$, $5f$, $7f$, etc. ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit: Additional information from the deleted post&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: Let's assume the fundamental to be anything possible between 100 and 4000 Hz. Whats more, what if the input is multitone (as most music is...). 50 and 425 Hz input simulatenously ??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im looking for a mathematical function which can recreate any fundamentals odd harmonics, in a multitone input...&lt;/p&gt;&#xA;" OwnerUserId="18260" LastEditorUserId="3369" LastEditDate="2015-11-16T18:58:32.807" LastActivityDate="2015-11-17T08:16:10.723" Title="Creating odd harmonics without the fundamental" Tags="|audio|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27078" PostTypeId="2" ParentId="27077" CreationDate="2015-11-15T20:30:22.360" Score="1" Body="&lt;p&gt;(Note that this answer was written before the question was edited in a way which made clear that the input is not sinusoidal, and that filtering out the fundamental frequency is also no option. Anyway, for the time being I'll leave it as is.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;One easy way to achieve this is to symmetrically clip the sinusoid, which will create all odd multiples of the fundamental frequency, and then use a high-pass filter to filter out the fundamental frequency.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-16T20:31:17.790" LastActivityDate="2015-11-16T20:31:17.790" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27081" PostTypeId="2" ParentId="27074" CreationDate="2015-11-15T21:41:16.413" Score="1" Body="&lt;p&gt;actually, the diode and transistor are also time-invariant components.  the transistor is even reasonably linear in a range of operation between cutoff and saturation.  even, for very small displacements, a diode can be sorta linear, but a diode in normal use is clearly not linear.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-11-15T21:41:16.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27082" PostTypeId="2" ParentId="27074" CreationDate="2015-11-15T21:56:19.607" Score="1" Body="&lt;p&gt;&lt;strong&gt;Linear&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The voltage-current equation of a diode and a transistor is related by an &lt;a href=&quot;https://en.wikipedia.org/wiki/Diode#Shockley_diode_equation&quot; rel=&quot;nofollow&quot;&gt;exponential function&lt;/a&gt;, while for RLC components they are linear operators (derivatives, integrals and multiplication by constants)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Time-invariant&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will depend on the pre-defined voltages and currents, i.e., initial conditions. For example, take an RLC with a capacitor fully charged. As the circuit starts, the capacitor and the inductor will keep throwing energy back and forth (oscillation) and the resistor will eat some of that energy away (decay). Depending on when you apply an input, the response will be different. Hence, by definition, the system is time-variant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A circuit with a diode/transistor CAN be time-invariant, but it can't be linear (unless you look at it with the small-signal model, but that's a whole other story).&lt;/p&gt;&#xA;" OwnerUserId="18167" LastActivityDate="2015-11-15T21:56:19.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27084" PostTypeId="1" AcceptedAnswerId="27102" CreationDate="2015-11-15T22:13:12.177" Score="1" ViewCount="170" Body="&lt;p&gt;I have two cascaded one-pole sections with the same coefficient &lt;em&gt;b&lt;/em&gt; for both sections.&#xA;$$&#xA;y_A[n]=x_A[n]+b\cdot(y_A[n−1]−x_A[n])\\&#xA;y_B[n]=y_A[n]+b\cdot(y_B[n−1]−y_A[n])&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final output of the system is $y_B[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to re-implement the system as one biquad section of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n]=a_0x[n]+a_1x[n-1]+a_2x[n-2]-b_1y[n-1]-b_2y[n-2]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final output of the system is $y[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know what calculations I have to perform in order to make the output of the biquad exactly match the output of the one-pole cascaded system.&#xA;$$&#xA;y_B[n] = y[n]&#xA;$$&#xA;Obviously the 5 biquad coefficients $a_0\; a_1\; a_2\; b_1\; b_2$ will have to be determined as a function of the $b$ coefficient as found in the cascaded system above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone lead me through the math?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="18220" LastActivityDate="2015-11-16T11:53:53.373" Title="Transform one-pole cascaded system into a biquadratic section" Tags="|filters|lowpass-filter|biquad|poles-zeros|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27085" PostTypeId="1" AcceptedAnswerId="27097" CreationDate="2015-11-15T22:23:24.150" Score="10" ViewCount="6807" Body="&lt;p&gt;Is there a way to convert a &lt;code&gt;FIR&lt;/code&gt; to an &lt;code&gt;IIR&lt;/code&gt; filter with the most similar behavior?&lt;/p&gt;&#xA;" OwnerUserId="18294" LastEditorUserId="4298" LastEditDate="2018-07-18T20:30:56.827" LastActivityDate="2022-07-24T12:01:36.897" Title="Convert a FIR to an equivalent IIR" Tags="|filters|filter-design|infinite-impulse-response|finite-impulse-response|" AnswerCount="6" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27086" PostTypeId="2" ParentId="17868" CreationDate="2015-11-16T00:54:02.060" Score="1" Body="&lt;p&gt;You should know the orientation of the phone because the axis signum must be the same  of the car  motion. Assuming the axis signum is correct you can &lt;code&gt;filter&lt;/code&gt; the accelerometer signal in &lt;code&gt;lowpass&lt;/code&gt;, to clean the high frequency &lt;code&gt;noise&lt;/code&gt; and then see  the signal signum to detect if it is a break $a(t_i)&amp;lt;0$ or an acceleration $a(t_i)&amp;gt;0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should try to filter with a &lt;code&gt;butterworth&lt;/code&gt; low pass of the second or third order with a low frequency for example $10Hz$ or also less, you should try some cut frequencies looking the graphic.&lt;/p&gt;&#xA;" OwnerUserId="18294" LastEditorUserId="18294" LastEditDate="2015-11-16T11:11:01.843" LastActivityDate="2015-11-16T11:11:01.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27087" PostTypeId="1" AcceptedAnswerId="27100" CreationDate="2015-11-16T01:06:37.180" Score="0" ViewCount="1990" Body="&lt;p&gt;For example, let's assume a system given as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[n]-9y[n+2]=x[n]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I convert the difference equation to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y[n]=(y[n-2]-x[n-2])/9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and say that &quot;the system is causal&quot; and &quot;not-memoryless&quot; since it depends on past values of its output. But could it be possible to define a system to be &quot;not-causal&quot; and depend on any future value of its own output at the same time (no input term other than any present value of x[n] will be possible for this system and)?&lt;/p&gt;&#xA;" OwnerUserId="16989" LastEditorUserId="4298" LastEditDate="2015-11-16T21:23:58.937" LastActivityDate="2015-11-16T21:23:58.937" Title="May a causal system depend on future values of its own output" Tags="|signal-analysis|infinite-impulse-response|linear-systems|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27088" PostTypeId="2" ParentId="22207" CreationDate="2015-11-16T01:36:48.157" Score="0" Body="&lt;p&gt;If you really want to do that, study the Laplace transform because:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Z-Transform can be viewed as a mapping with $z = e^{s/f_s}$, where $f_s$ is the sample frequency.&lt;/li&gt;&#xA;&lt;li&gt;Fourier transform (and sequence) is the a special case when $s = j\omega$ (although you can't calculate the transform by just substituting UNLESS the ROC of the Laplace Transform encompasses the imaginary axis.)&lt;/li&gt;&#xA;&lt;li&gt;DTFT has an analogous relation to the Z-Transform that the Fourier Transform has to the Laplace Transform  (evaluated on $ z = e^{j\omega}$)&lt;/li&gt;&#xA;&lt;li&gt;DFT is a &quot;frequency domain sampled version&quot; of the DTFT&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But I don't recommend it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you really want to understand everything in a general framework, study Linear Algebra. Since all of this is nothing more than projections on to vector spaces (or function spaces, if you will).&lt;/p&gt;&#xA;" OwnerUserId="18167" LastActivityDate="2015-11-16T01:36:48.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27090" PostTypeId="2" ParentId="27087" CreationDate="2015-11-16T01:47:01.297" Score="0" Body="&lt;p&gt;Every time you have something like $y(n) = y(n+1) + x(n)$, you can convert it to something like $y(n) = y(n-1) - x(n-1)$, by substituting $n \rightarrow n-1$. So, depending on future values of the output is equivalent to depending on past values.&lt;/p&gt;&#xA;" OwnerUserId="18167" LastActivityDate="2015-11-16T01:47:01.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27092" PostTypeId="2" ParentId="27084" CreationDate="2015-11-16T01:56:27.433" Score="0" Body="&lt;p&gt;You must take the Z-Transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z) = a_0 X(z) + a_1 z^{-1} X(z) + a_2 z^{-2} X(z) - b_1 z^{-1} Y(z) - b_2 z^{-2} Y(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the transfer function $H(z) = Y(z)/X(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{a_0 + a_1 z^{-1} + a_2 z^{-2}}{b_1 z^{-1} + b_2 z^{-2}+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now factor it out into a product of two biquads (just find the poles and zeros). Then you will have both your sections. Something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \left (\frac{z+z_0}{z+p_0} \right).\left(\frac{z+z_1}{z+p_1}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember to group poles and zeros that are close-by!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do the actual implementation (going back to the time-domain), you can look here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.iowahills.com/A7ExampleCodePage.html&quot; rel=&quot;nofollow&quot;&gt;http://www.iowahills.com/A7ExampleCodePage.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.engr.colostate.edu/ECE423/lab05/Lab_Notes/Lab_Notes_5.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.engr.colostate.edu/ECE423/lab05/Lab_Notes/Lab_Notes_5.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.disca.upv.es/aperles/arm_cortex_m3/curset/CMSIS/Documentation/DSP/html/group___biquad_cascade_d_f2_t.html&quot; rel=&quot;nofollow&quot;&gt;http://www.disca.upv.es/aperles/arm_cortex_m3/curset/CMSIS/Documentation/DSP/html/group___biquad_cascade_d_f2_t.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="18167" LastEditorUserId="18167" LastEditDate="2015-11-16T02:02:59.020" LastActivityDate="2015-11-16T02:02:59.020" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27093" PostTypeId="2" ParentId="27076" CreationDate="2015-11-16T02:11:37.773" Score="3" Body="&lt;p&gt;First, you should compare the DCT to the DFT, not the FFT. FFT is just a family of algorithms to approximate the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[...] &#xA;  In particular, a DCT is a Fourier-related transform similar to the discrete Fourier transform (DFT), &lt;strong&gt;but using only real numbers.&lt;/strong&gt; DCTs are &lt;strong&gt;equivalent to DFTs of roughly twice the length&lt;/strong&gt;, operating on real data with even symmetry (since the Fourier transform of a real and even function is real and even), where in some variants the input and/or output data are shifted by half a sample. There are eight standard DCT variants, of which four are common.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_cosine_transform&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Discrete_cosine_transform&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18167" LastActivityDate="2015-11-16T02:11:37.773" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27094" PostTypeId="1" AcceptedAnswerId="27150" CreationDate="2015-11-16T05:45:37.190" Score="0" ViewCount="935" Body="&lt;p&gt;FIR filter coefficients are known. Then what is the matlab code or function that is used to determine the corresponding farrow structure coefficients? &lt;/p&gt;&#xA;" OwnerUserId="18296" LastActivityDate="2015-11-20T10:14:33.017" Title="How to find out the farrow coefficients if FIR coefficients are given?" Tags="|filter-design|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27095" PostTypeId="2" ParentId="27085" CreationDate="2015-11-16T06:19:32.613" Score="3" Body="&lt;p&gt;If you're trying to match the impulse response of the IIR to a given impulse response, however it's mathematically defined (I guess the FIR is as good of a definition as any), I've always thought that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Prony%27s_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;Prony method&lt;/a&gt; was the first stab at the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're trying to match the frequency response of the IIR to a given frequency response, however it's mathematically defined (I guess the frequency response of the FIR is as good of a definition as any), I've recently thought that &lt;a href=&quot;http://www2.units.it/ramponi/teaching/DSP/materiale/ES_5_2.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;Greg Berchin's FDLS&lt;/a&gt; might be the way to go.  Richard Lyons (who commented to your question), published a monograph where Greg had a chapter describing the method. &lt;a href=&quot;https://dsp.stackexchange.com/users/4298/matt-l?tab=topactivity&quot;&gt;Matt L&lt;/a&gt; also has researched and published on the problem.   &lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-11-27T06:29:14.053" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27097" PostTypeId="2" ParentId="27085" CreationDate="2015-11-16T08:46:25.210" Score="7" Body="&lt;p&gt;I would say that the answer to your question - if taken literally - is 'no', there is no general way to simply convert an FIR filter to an IIR filter.&lt;/p&gt;&#xA;&lt;p&gt;I agree with RBJ that one way to approach the problem is to look at the FIR filter's impulse response and use a time domain method (such as Prony's method) to approximate that impulse response by an IIR filter.&lt;/p&gt;&#xA;&lt;p&gt;If you start from the frequency response then you have lots of methods for designing IIR filters. Even though it was published about 25 years ago, I believe that the &lt;a href=&quot;https://ieeexplore.ieee.org/document/56052&quot; rel=&quot;nofollow noreferrer&quot;&gt;method by Chen and Parks&lt;/a&gt; is still one of the better ways to approach the design problem. Another very simple method for the frequency domain design of IIR filters is the equation error method, which is described in the book &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0471828963&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital Filter Design&lt;/a&gt; by Parks and Burrus. I've explained it in &lt;a href=&quot;https://dsp.stackexchange.com/questions/15007/design-l-2-norm-optimal-infinite-impulse-response-iir-filters/15016#15016&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If the phase response is of importance to you, then one problem you will be facing when designing IIR filters in the frequency domain is the exact choice of the desired phase response. If the overall shape of the desired phase is given you still have one degree of freedom, which is the delay. E.g., if the desired phase is &lt;span class=&quot;math-container&quot;&gt;$\phi_D(\omega)$&lt;/span&gt;, and the desired magnitude is &lt;span class=&quot;math-container&quot;&gt;$M_D(\omega)$&lt;/span&gt; then your desired frequency response can be chosen as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_D(\omega)=M_D(\omega)e^{j(\phi(\omega)-\omega\tau)}\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; is an unknown delay parameter. Of course you can say that if &lt;span class=&quot;math-container&quot;&gt;$\phi_D(\omega)$&lt;/span&gt; is given then you don't want to modify it with an additional (positive or negative) delay. But it turns out that in practice the average delay is not always important, and - more importantly - for certain values of &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; your approximation will be &lt;em&gt;much&lt;/em&gt; better for a given filter order than for others. So the delay &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; can become an additional design parameter and should be chosen optimally or at least reasonably.&lt;/p&gt;&#xA;&lt;p&gt;I've written a &lt;a href=&quot;https://mattsdsp.blogspot.com/p/phd-thesis.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;thesis&lt;/a&gt; on the design of digital filters with prescribed magnitude and phase responses. One chapter deals with the frequency domain design of IIR filters. That method can be used to design IIR filters with approximately linear phase in the pass-bands, or to approximate any other desired phase (and magnitude) response. The filters are not only guaranteed to be stable, but you can also prescribe a maximum pole radius, i.e., you can define a certain stability margin. You can also find this method in a &lt;a href=&quot;https://ieeexplore.ieee.org/document/875468&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; published in the IEEE Transactions on Signal Processing.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="7092" LastEditDate="2022-07-24T12:01:36.897" LastActivityDate="2022-07-24T12:01:36.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27098" PostTypeId="2" ParentId="26968" CreationDate="2015-11-16T10:38:14.507" Score="0" Body="&lt;p&gt;A1: This is a &lt;code&gt;noise&lt;/code&gt; composed by a lot of indipendet factors. For example an old camera made with an old technology makes an high noise on the photo caused by the imprecision of the various components. For the &lt;a href=&quot;https://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;central limit theorem&lt;/code&gt; &lt;/a&gt; the probability density function of infinite indipendent events is a &lt;code&gt;gaussian&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A2: A gaussian noise is already a &lt;code&gt;stochastic process&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18294" LastEditorUserId="18294" LastEditDate="2015-11-16T15:39:52.627" LastActivityDate="2015-11-16T15:39:52.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27099" PostTypeId="2" ParentId="27064" CreationDate="2015-11-16T11:16:17.923" Score="0" Body="&lt;p&gt;I found out that I can give a different weight vector for positive and negative examples&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;weights = ones(1,size(outputs,2));&#xA;weights(outputs(2,:) ==1) = weights(outputs(2,:) ==1)*factor;&#xA;train(net,input,output,[],[],weights);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4727" LastActivityDate="2015-11-16T11:16:17.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27100" PostTypeId="2" ParentId="27087" CreationDate="2015-11-16T11:26:34.837" Score="2" Body="&lt;p&gt;By definition, the output of a causal system cannot depend on any future input or output values. However, I think there is a misunderstanding in your question. Suppose you are given the following difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_0y[n+1]+a_1y[n]+a_2y[n-1]=b_0x[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important point is that it is not possible to say if the system described by Eq. $(1)$ is causal or not, simply because Eq. $(1)$ does not uniquely describe one system, but in general there are three systems described by $(1)$. One of them is causal and its output can be computed from&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_0y[n+1]=b_0x[n]-a_1y[n]-a_2y[n-1]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for any $n$ the output in $(2)$ only depends on past output (and input) values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second system described by Eq. $(1)$ is non-causal. The current output sample depends on past and on future output values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_1y[n]=b_0x[n]-a_0y[n+1]-a_2y[n-1]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, finally, Eq. $(1)$ can also describe an anti-causal system, the output of which only depends on future output and input values:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_2y[n-1]=b_0x[n]-a_0y[n+1]-a_1y[n]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ambiguity of Eq. $(1)$ is also reflected in the $\mathcal{Z}$-transform domain, where $(1)$ corresponds to the following transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{b_0}{a_0z+a_1+a_2z^{-1}}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This transfer function, just like the difference equation $(1)$, does not uniquely define a system. Only if you specify the region of convergence (ROC) of $(5)$ will the system be uniquely characterized. Each of the three possible interpretations of Eq. $(1)$ discussed above correspond to a different ROC of $H(z)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-16T11:26:34.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27101" PostTypeId="1" AcceptedAnswerId="27103" CreationDate="2015-11-16T11:40:29.690" Score="-1" ViewCount="254" Body="&lt;p&gt;In discrete time Fourier transform, The DTFT of constant 1 is &#xA;$$\sum_{l=-\infty}^{+\infty} \delta(\omega-2\pi l) $$. I have confusion that why there is $-$ sign, why it can't be $$\sum_{l=-\infty}^{+\infty} \delta(\omega+2\pi l) $$&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="80" LastEditDate="2015-11-16T14:19:37.200" LastActivityDate="2015-11-16T14:19:37.200" Title="why $-$ sign in DTFT pair for constant" Tags="|discrete-signals|fourier-transform|dtft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27102" PostTypeId="2" ParentId="27084" CreationDate="2015-11-16T11:53:53.373" Score="1" Body="&lt;p&gt;A single one-pole filter satisfies the following difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]+b\left(y[n-1]-x[n]\right)=(1-b)x[n]+by[n-1]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which corresponds to this transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{1-b}{1-bz^{-1}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you cascade two of these systems, the transfer functions are multiplied:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H^2(z)=\frac{(1-b)^2}{(1-bz^{-1})^2}=\frac{(1-b)^2}{1-2bz^{-1}+b^2z^{-2}}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function in $(3)$ corresponds to the following difference equation for the cascaded system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=(1-b)^2x[n]+2by[n-1]-b^2y[n-2]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, implementing $(4)$ is equivalent to implementing $(1)$ twice.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-16T11:53:53.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27103" PostTypeId="2" ParentId="27101" CreationDate="2015-11-16T11:58:41.900" Score="5" Body="&lt;p&gt;It can also have a $+$ sign, there's no difference. Write down a part of the sum (around index $l=0$) and try to see that in both cases you're summing the same terms, just in a different order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More formally, take one of the two sums, transform the index by changing its sign ($k=-l$) and see what you get.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-16T11:58:41.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27104" PostTypeId="2" ParentId="27077" CreationDate="2015-11-16T12:31:15.763" Score="1" Body="&lt;p&gt;The function should be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SR=sampling rate&#xA;T=duration in second of the output&#xA;t=0:(1/SR):T&#xA;x=your sin wave input&#xA;X=fft(x)&#xA;freq=index of max(mod(X)) from 0 to SR/2 (in [Hz])&#xA;ai=[1 1 0.5 ... ] %harmonics amplitude&#xA;y=zeros(length(t))&#xA;for i=1:n %n harmonics, n=floor(SR/2/(freq*2))-1 if you want all the harmonics&#xA;   y=y+ai(i)*sin(2*pi*(2*i+1)*freq*t)&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;x&lt;/code&gt; is a sin and you don't want to use &lt;code&gt;FFT&lt;/code&gt; you can find the &lt;code&gt;freq&lt;/code&gt; quite well in this way $O(n)$:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sgn=sign(x);&#xA;i=1;&#xA;periods=0;&#xA;Psmp=0;&#xA;while i&amp;lt;length(t)&#xA;    if (sgn(i)~=sgn(i+1) &amp;amp;&amp;amp; sgn(i+1)~=0) || sgn(i)==0&#xA;       for j=(i+1):length(t)-1&#xA;          if (sgn(j)~=sgn(j+1) &amp;amp;&amp;amp; sgn(j+1)~=0) || sgn(j)==0&#xA;            Psmp=Psmp+(j+j+(sgn(j)~=0))/2-(i+i+(sgn(i)~=0))/2;&#xA;            periods=periods+1;&#xA;            break;&#xA;          end&#xA;       end&#xA;       i=j;&#xA;    end&#xA;    i=i+1;&#xA;end&#xA;&#xA;if periods&amp;gt;0&#xA;    Psmp=Psmp/periods/2;&#xA;    P=Psmp/SR;&#xA;    freq=1/P;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It makes a linear interpolation of each couples of samples about 0 and finds the average of the periods.&lt;/p&gt;&#xA;" OwnerUserId="18294" LastEditorUserId="18294" LastEditDate="2015-11-17T08:16:10.723" LastActivityDate="2015-11-17T08:16:10.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27106" PostTypeId="2" ParentId="27077" CreationDate="2015-11-16T15:13:23.127" Score="1" Body="&lt;ul&gt;&#xA;&lt;li&gt;$y(t) = x(t)^3 - \frac 3 4 x(t)$ (3rd harmonic)&lt;/li&gt;&#xA;&lt;li&gt;$y(t) = x(t)^5 - \frac {10} {16} x(t)$ (harmonics 3, 5)&lt;/li&gt;&#xA;&lt;li&gt;$y(t) = x(t)^7 - \frac {35} {64} x(t)$ (harmonics 3, 5, 7)&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Presumably this is a sampled system, so you could choose N based on your Nyquist frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a pattern to the coefficients that cancel out the fundamental but I don't know what it is.  :)&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2015-11-16T15:13:23.127" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27107" PostTypeId="1" AcceptedAnswerId="27110" CreationDate="2015-11-16T15:56:42.437" Score="1" ViewCount="120" Body="&lt;p&gt;I'm trying to find an object in a picture, my solution is to take the picture and a photo of the object and find the maximum of the &lt;code&gt;mutual covariance&lt;/code&gt;, this is my project on &lt;code&gt;GitHub&lt;/code&gt;: &lt;a href=&quot;https://github.com/andrea993/ImageFinder&quot; rel=&quot;nofollow&quot;&gt;ImageFinder&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works but if the object is rotated or transformed it doesn't work well. Which other method should I use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that a good way can be to look for the object through the colors and then try to rotate the image or to resize it while does not match, but this idea need an improvement. &lt;/p&gt;&#xA;" OwnerUserId="18294" LastEditorUserId="18294" LastEditDate="2015-11-16T21:38:28.270" LastActivityDate="2015-11-16T21:38:28.270" Title="Best way to find an object in a picture" Tags="|image-processing|covariance|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27109" PostTypeId="1" CreationDate="2015-11-16T18:49:31.820" Score="0" ViewCount="383" Body="&lt;p&gt;Assume we have communication system between transmit and receive over wireless channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Friis path loss model is given by the following equation &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_r = P_t G_t G_r (\frac{\lambda}{4\pi D})^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $P_{r(t)}$ is the received (transmit) power, $G_{t(r)}$ is the gain of the antennas at transmitter (receive) and $\lambda $ is the signal wavelength while $D$ is the distance between transmit receive ends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theoretical (academia) and simulation scenarios (for example MATLAB)I have come across examples wireless channel where a power delay profile is defined, that is time of arrival (TOA) of rays versus amplitude of those rays. For example, assume I have five rays arriving and delay spread $40 ns$ with amplitude &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$channel= [ 0.5+i0.5, 0.3+i0.3, 0.2+i0.2, 0.1+i 0.1, 0.3 ] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$TOA= [0, 10*10^{-9} , 20*10^{-9}, 30*10^{-9} , 40*10^{-9}]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My simple question is: How are the two concepts related??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="15590" LastEditDate="2015-11-16T19:24:19.933" LastActivityDate="2016-04-18T17:17:40.493" Title="Friis law and the power delay profile" Tags="|digital-communications|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27110" PostTypeId="2" ParentId="27107" CreationDate="2015-11-16T18:58:59.237" Score="1" Body="&lt;p&gt;There is no &quot;best method&quot;, it will vary according to application. There are many trains of thought regarding this subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done something in that area using Cepstral Analysis. Take a look at this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://8b14d84720d60d831e70ec440417feb774595227-www.googledrive.com/host/0B4-fFSwiy1mGdS00SHB2Nlo3bkU/imreg_translation/imreg_translation.html&quot; rel=&quot;nofollow&quot;&gt;https://8b14d84720d60d831e70ec440417feb774595227-www.googledrive.com/host/0B4-fFSwiy1mGdS00SHB2Nlo3bkU/imreg_translation/imreg_translation.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I am the author of the above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, you do the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sum the target image and the object&lt;/li&gt;&#xA;&lt;li&gt;Calculate the &lt;a href=&quot;https://en.wikipedia.org/wiki/Cepstrum&quot; rel=&quot;nofollow&quot;&gt;Cepstrum&lt;/a&gt; of said sum.&lt;/li&gt;&#xA;&lt;li&gt;Find the peaks (there will be 2, you have to resolve the ambiguity using something like &lt;a href=&quot;https://en.wikipedia.org/wiki/Sum_of_absolute_differences&quot; rel=&quot;nofollow&quot;&gt;SAD&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;The location of the peak will tell you the translation you must apply to the image.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I based it off this article: &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6128658&amp;amp;tag=1&quot; rel=&quot;nofollow&quot;&gt;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6128658&amp;amp;tag=1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm actually in the middle of creating a barcode (1D and 2D) open-source program using this kind of processing. The link to my bitbucket acount is here: &lt;a href=&quot;https://bitbucket.org/DSevero/&quot; rel=&quot;nofollow&quot;&gt;https://bitbucket.org/DSevero/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the repo is private for now, I should be releasing a first version around January&lt;/p&gt;&#xA;&#xA;&lt;p&gt;:)&lt;/p&gt;&#xA;" OwnerUserId="18167" LastEditorUserId="18167" LastEditDate="2015-11-16T19:11:29.027" LastActivityDate="2015-11-16T19:11:29.027" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27111" PostTypeId="2" ParentId="27085" CreationDate="2015-11-16T19:24:32.877" Score="2" Body="&lt;p&gt;Yet another method that might be able approximate (not exactly match) a given arbitrary frequency response (such as one described by some given FIR filter) by an IIR filter, is Differential Evolution.  Differential Evolution is a type of genetic algorithm that, for this use, iteratively selects and adapts a set of poles and zeros in an attempt to minimize a computed difference error.  There seem to be a few IEEE papers on the topic, as well as a chapter in one of Rick Lyons books (&quot;Streamlining DSP&quot;).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-11-16T20:21:04.777" LastActivityDate="2015-11-16T20:21:04.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27112" PostTypeId="2" ParentId="27109" CreationDate="2015-11-16T19:44:04.980" Score="0" Body="&lt;p&gt;So your channel is (rephrasing your numbers) :&#xA;$$&#xA;h(t) = (0.5 + i0.5)\delta(t) + (0.3+i0.3)\delta(t-10) + (0.2+i0.2) \delta(t-20) + (0.1+i0.1) \delta(t-30) + 0.3\delta(t-40)&#xA;$$&#xA;where $t$ is the time in nanoseconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This says that there are five ways to get from the transmitter to the receiver: a direct path (I'm assuming the $t=0$ version is direct), and four longer paths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Friis path loss model says that, given the transmit power, the Tx and Rx antenna gains, the wavelength, and the distance then the attenuation due to just the transmission path will be given by the equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this relate to your channel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All it means is that each coefficient of the various delay elements comprises partly of an attenuation due to the path loss.  Each coefficient will have a different attenuation because each coefficient corresponds to a different path distance --- so the value of $D$ for each coefficient will be different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficient with the smallest path loss component will be the $0.5 + i0.5$ first one (&quot;zero&quot; delay), and the coefficient with the largest path loss component will be the $0.3$ one (delay of 40ns).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-16T19:44:04.980" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27113" PostTypeId="2" ParentId="27077" CreationDate="2015-11-16T19:47:47.167" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Im looking for a mathematical function which can recreate any &lt;strong&gt;fundamentals&lt;/strong&gt; odd harmonics, in a multitone input...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(emphasis by me)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you ask for is not possible. If you demand multiple tones and complex tones as they appear in music, then your problem leads to a conflict. A complex tone comes with overtones. Even if you have a process that adds odd harmonics to each sinusoidal component, then the even overtones of the fundamental frequency will contribute even harmonics. That is because an odd number multiplied with an even number is again even.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So circumvent that, you would have to identify the fundamental frequency of complex tones first, leading you directly to the problem of polyphonic pitch detection which remains mostly unsolved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you should explain what you're &lt;em&gt;really&lt;/em&gt; trying to accomplish, as in what the application is that you have in mind. With that information it's quite likely that we can come up with a relaxed set of requirements that can actually be implemented.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-11-16T19:47:47.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27114" PostTypeId="2" ParentId="27085" CreationDate="2015-11-16T19:54:50.950" Score="4" Body="&lt;p&gt;Matt L's answer is the best from a DSP perspective.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There exist a whole array of techniques from the control literature that might also do what you're asking. While this is not explicitly turning an FIR filter into an IIR, the techniques will generally find an IIR solution unless some other constraints are applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the techniques are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=1102568&quot; rel=&quot;nofollow&quot;&gt;Balanced Truncation is, in effect, a principal component analysis approach to reducing the order of a filter.&lt;/a&gt; &lt;a href=&quot;http://www.mathworks.com/help/robust/ref/bstmr.html&quot; rel=&quot;nofollow&quot;&gt;There is a matlab implementation of it in the Robust Control Toolbox.&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.tandfonline.com/doi/abs/10.1080/00207170500110988#.Vkozxt-rRNA&quot; rel=&quot;nofollow&quot;&gt;Optimal Hankel Norm Approximation uses the infinity-like Hankel norm to approximate a high order system with one of a lower order.&lt;/a&gt; &lt;a href=&quot;http://www.mathworks.com/help/robust/ref/hankelmr.html&quot; rel=&quot;nofollow&quot;&gt;There is a matlab implementation of it in the Robust Control Toolbox.&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-16T19:54:50.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27116" PostTypeId="2" ParentId="1804" CreationDate="2015-11-16T23:41:30.353" Score="2" Body="&lt;p&gt;This article deals exactly with the same type of supervised classification based on labelled &lt;code&gt;GLCM&lt;/code&gt; classes: &lt;a href=&quot;http://www.ijcsi.org/papers/IJCSI-9-3-3-354-359.pdf&quot; rel=&quot;nofollow&quot;&gt;GLCM Textural Features for Brain Tumor Classification &lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="17444" LastActivityDate="2015-11-16T23:41:30.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27117" PostTypeId="1" CreationDate="2015-11-16T23:53:45.430" Score="-2" ViewCount="1504" Body="&lt;p&gt;I am trying to calculate autocorrelation using fft and xcorr and plot the grafhic with both cases.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;autocorr_a=xcorr(signal_1,signal_1);&#xA;N1=length(signal_1);&#xA;autocorr_b=ifft( fft(signal_1,N1) .* conj(fft(signal_1,N1))); &#xA;x1=[0:(2*length(signal_1)-2)]'/(2*length(signal_1)-1);&#xA;plot(x1, autocorr_a, x1, autocorr_b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is wrong?&lt;/p&gt;&#xA;" OwnerUserId="18305" LastActivityDate="2015-11-17T07:47:13.613" Title="Correlation using fft and xcorr and plot both answers (Matlab)" Tags="|matlab|autocorrelation|correlation|" AnswerCount="1" CommentCount="1" ClosedDate="2015-11-17T13:15:19.023" ContentLicense="CC BY-SA 3.0" />
  <row Id="27121" PostTypeId="2" ParentId="27117" CreationDate="2015-11-17T07:47:13.613" Score="2" Body="&lt;p&gt;Matlabs xcorr() command performs linear correlation, whereas the FFT method you employ performs circular correlation, so there is time-aliasing in the same way as with frequency domain convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can simulate linear convolution in the frequency domain by sufficiently zero-padding your signal with N-1 zeros, where N is the length of your signal vector, before performing the FFT.&lt;/p&gt;&#xA;" OwnerUserId="16404" LastActivityDate="2015-11-17T07:47:13.613" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27122" PostTypeId="2" ParentId="26954" CreationDate="2015-11-17T07:59:28.483" Score="0" Body="&lt;p&gt;In the following paper, there is an implementation of the ML estimator for this problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Selva, J., &quot;Efficient maximum likelihood estimation of a 2-D complex sinusoidal based on barycentric interpolation,&quot; in Acoustics, Speech and Signal Processing (ICASSP), 2011 IEEE International Conference on , vol., no., pp.4212-4215, 22-27 May 2011&#xA;doi: 10.1109/ICASSP.2011.5947282&#xA;URL: &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=5947282&amp;amp;isnumber=5946226&quot; rel=&quot;nofollow&quot;&gt;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=5947282&amp;amp;isnumber=5946226&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, there is one implementation for the 1-D case in &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/showcode/164.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showcode/164.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18310" LastActivityDate="2015-11-17T07:59:28.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27123" PostTypeId="2" ParentId="9664" CreationDate="2015-11-17T09:05:15.770" Score="0" Body="&lt;p&gt;So if I want to calculate for example the &lt;code&gt;fifth_harmonic&lt;/code&gt; (phase + amplitude) for every point in the time domain, I have to write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fifth_harmonic[k] = ampl_5th * cos((5 * PI * k)/N-1 + phase_5th) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fifth_harmonic[k] = ampl_5th * sin((5 * PI * k)/N-1 + phase_5th)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;K=0,......,N-1&lt;/code&gt; are the sampling point in time domain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;fifth_harmonic&lt;/code&gt; - amplitude for the fifth harmonic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;phase_5th&lt;/code&gt;  - phase for the fifth harmonic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which one I have to use: the sin or cos?&lt;/p&gt;&#xA;" OwnerUserId="18311" LastEditorUserId="8202" LastEditDate="2015-11-17T10:11:07.530" LastActivityDate="2015-11-17T10:11:07.530" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27124" PostTypeId="1" AcceptedAnswerId="27127" CreationDate="2015-11-17T10:55:15.207" Score="1" ViewCount="1809" Body="&lt;p&gt;Why the lattice-structured all-pole IIR filter becomes stable,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the k-coefficients satisfies $|k_i| &amp;lt; 1$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone who can tell me the way how to prove it, would be so thankful for me :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps. If anyone who has other suggestion solving differently with the proof below using Rouché's Theorem, it's welcome too!&lt;/p&gt;&#xA;" OwnerUserId="18314" LastEditorUserId="4298" LastEditDate="2015-11-19T13:53:35.753" LastActivityDate="2015-11-19T13:53:35.753" Title="Why lattice-structured all-pole IIR filter becomes stable, if the k-coefficients satisfies $|k_i| &lt; 1$?" Tags="|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="3" ClosedDate="2015-11-19T21:56:22.660" ContentLicense="CC BY-SA 3.0" />
  <row Id="27125" PostTypeId="1" CreationDate="2015-11-17T11:16:58.497" Score="2" ViewCount="616" Body="&lt;p&gt;How to make sure the discrete domain's SNR equals to the corresponding SNR of continuous domain?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the definition of SNR in continuous domain is:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$SNR=\frac{\int_T|s(t)|^2dt}{noiseVariance} $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;if we sampled $s(t)$ ($T_s$ is the sample period) then what is the&#xA;  corresponding SNR of the discrete domain? Is&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$SNR=\frac{\sum_{n=1}^{N}|s(nT_s)|^2dt}{noiseVariance} $$ &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="18307" LastEditorUserId="8202" LastEditDate="2015-11-17T12:15:24.957" LastActivityDate="2016-04-15T17:40:08.067" Title="Question about SNR in continuous and discrete domain" Tags="|snr|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27126" PostTypeId="2" ParentId="27125" CreationDate="2015-11-17T11:53:21.633" Score="2" Body="&lt;p&gt;In your $snr$ expression, if you put a $1/N$ ratio in front of the numerator summation you'll have the standard expression for SNR with regard to sampled data (digital data).&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-11-17T11:53:21.633" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27127" PostTypeId="2" ParentId="27124" CreationDate="2015-11-17T13:30:29.303" Score="3" Body="&lt;p&gt;I'm referring to the formulas on page 9 of &lt;a href=&quot;http://web.eecs.utk.edu/~roberts/ECE506/PresentationSlides/LatticeLadder.pdf&quot; rel=&quot;nofollow&quot;&gt;this document&lt;/a&gt;. The denominator polynomial of the transfer function at lattice stage number $m$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}A_m(z)&amp;amp;=A_{m-1}(z)+k_mz^{-1}B_{m-1}(z)\\&#xA;\text{with}\quad B_m(z)&amp;amp;=z^{-m}A_m(1/z)\\&#xA;\text{and}\quad A_0(z)&amp;amp;=B_0(z)=1\end{align}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k_m$ is the $m^{th}$ reflection coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can prove that $A_m(z)$ has all its zeros inside the unit circle if this is the case for $A_{m-1}(z)$ and if $|k_m|&amp;lt;1$. This follows from &lt;a href=&quot;https://en.wikipedia.org/wiki/Rouch%C3%A9&amp;#39;s_theorem&quot; rel=&quot;nofollow&quot;&gt;Rouché's Theorem&lt;/a&gt;, which says that if $F(z)$ and $G(z)$ are two complex-valued functions that are analytic in and on some closed contour $C$ (which in our case is the unit circle), then $F(z)$ and $F(z)+G(z)$ have the same number of zeros inside $C$ if $|G(z)|&amp;lt;|F(z)|$ is satisfied on $C$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proof goes as follows. Define $F(z)=z^mA_{m-1}(z)$ and $G(z)=k_mz^{m-1}B_{m-1}(z)$, which, according to $(1)$, means that $F(z)+G(z)=z^mA_{m}(z)$. The zeros of $F(z)$ are the $m-1$ zeros of $A_{m-1}(z)$ plus one zero at $z=0$. Consequently, if all zeros of $A_{m-1}(z)$ are inside the unit circle, then also all zeros of $F(z)$ are inside the unit circle. From the definition of $B_m(z)$ in $(1)$ it follows that $B_{m-1}(z)$ has the same magnitude as $A_{m-1}(z)$ &lt;em&gt;on the unit circle&lt;/em&gt; (i.e., for $|z|=1$). This means that $|F(z)|&amp;lt;|G(z)|$ is satisfied on the unit circle if $|k_m|&amp;lt;1$. In this case $F(z)+G(z)$ and, consequently, $A_m(z)$ have all their zeros inside the unit circle. This is the case because $F(z)$ has all its $m$ zeros inside the unit circle, and according to Rouché's theorem $F(z)+G(z)$, which has exactly $m$ zeros, has the same number of zeros inside the unit circle as $F(z)$. So $F(z)+G(z)$ must have all its $m$ zeros inside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This proves that all denominator polynomials $A_m(z)$ in the iteration given by $(1)$ correspond to stable transfer functions if the iteration is started with $A_0(z)=B_0(z)=1$ and if $|k_m|&amp;lt;1$ is satisfied for all $m$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've learned the above proof based on Rouché's theorem from Jackson's excellent book &lt;a href=&quot;https://books.google.nl/books?id=qtDkBwAAQBAJ&amp;amp;lpg=PA335&amp;amp;vq=rouche&amp;amp;pg=PA335#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;Digital Filters and Signal Processing&lt;/a&gt;.&#xA;Another good explanation of lattice structures can be found in &lt;a href=&quot;https://books.google.nl/books?id=e5dsEW_93ykC&amp;amp;lpg=PA298&amp;amp;ots=tXEoAEA-9l&amp;amp;dq=all%20pole%20iir%20lattice%20filter&amp;amp;pg=PA291#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;this book&lt;/a&gt; by Zelniker and Taylor.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-17T16:12:22.950" LastActivityDate="2015-11-17T16:12:22.950" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27128" PostTypeId="1" AcceptedAnswerId="27130" CreationDate="2015-11-17T14:02:06.613" Score="1" ViewCount="7413" Body="&lt;p&gt;As, we can determine the response of the system by its 'impulse response' then why we use 'step response' and 'ramp response'. Is there any difference between all these response?&lt;/p&gt;&#xA;" OwnerUserId="18318" LastEditorUserId="18318" LastEditDate="2015-11-17T14:07:40.267" LastActivityDate="2018-11-17T11:02:13.873" Title="Difference between step,ramp and Impulse response" Tags="|signal-analysis|impulse-response|control-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27130" PostTypeId="2" ParentId="27128" CreationDate="2015-11-17T15:05:08.517" Score="2" Body="&lt;p&gt;Like the impulse response, the step and ramp responses describe an LTI-system. There are situations when the step response or the ramp response describe what we want to know about the system more directly than the impulse response. When the input to a system is a piece-wise constant function of time, the transitions are well described by the step response. It gives quite directly information about overshoot and settling time.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-11-17T15:05:08.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27132" PostTypeId="1" CreationDate="2015-11-17T16:55:39.097" Score="1" ViewCount="1217" Body="&lt;p&gt;I am using this template in OpenCv's match template function by converting all images to grayscale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jgCYf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jgCYf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my result using sum of square differences,cross correlation and correlation coefficient.Both SSD and Cros Correlation method fails matching but correlation coefficient performs well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not in this case but in my prior experience I always find cross correlation method the most robust one.I didn't understand why here correlation coefficient method works better than others ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fGNdb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fGNdb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ao7WY.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ao7WY.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jwCUj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jwCUj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12059" LastEditorUserId="80" LastEditDate="2015-11-17T20:42:08.433" LastActivityDate="2015-11-17T20:42:08.433" Title="Why correlation coefficient template matching perfoms better than cross-correlation and square-differences method" Tags="|image-processing|opencv|cross-correlation|template-matching|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27133" PostTypeId="1" AcceptedAnswerId="27135" CreationDate="2015-11-17T17:25:24.430" Score="1" ViewCount="534" Body="&lt;p&gt;I'm trying to implement a simple digital delay line. I want it so that when the user changes the delay amount, it sounds smooth and not glitchy. Currently I'm implementing a fractional delay line but I'm still getting a very glitchy sound when I change the delay amount.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else do I need to implement besides a fractional implementation? &#xA;I can post code if need be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Here's some code-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;- (void)setDelay:(Float32)dly {&#xA;    // get delay amount&#xA;    delay = dly*srate;&#xA;    if (delay != 0) delay -= 1;&#xA;&#xA;    // Get Delay difference&#xA;    Float32 outPointer = w - delay;&#xA;    // wrap write&#xA;    while (outPointer &amp;lt; 0) outPointer += DELAY_MAX;&#xA;&#xA;    // Integer conversion&#xA;    r = (int)outPointer;&#xA;    // Wrap read&#xA;    if (r == DELAY_MAX) r = 0;&#xA;    // Fractional Calculation&#xA;    alpha = outPointer - r;&#xA;    // Get interpolation values&#xA;    omAlpha = 1.f-alpha;&#xA;}&#xA;&#xA;// interpolation method&#xA;- (Float32)nextOut {&#xA;    // If we can get the next output&#xA;    if (doNextOut) {&#xA;        // First 1/2 of interpolation&#xA;        nextOutput = cBuf[r]*omAlpha;&#xA;        // Second 1/2 of interpolation&#xA;        if (r+1 &amp;lt; DELAY_MAX) {&#xA;            nextOutput += (cBuf[r+1]*alpha);&#xA;        }&#xA;        else {&#xA;            nextOutput += (cBuf[0]*alpha);&#xA;        }&#xA;        // set false&#xA;        doNextOut = false;&#xA;     }&#xA;     // return interpolation&#xA;     return nextOutput;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10572" LastEditorUserId="10572" LastEditDate="2015-11-18T17:09:38.693" LastActivityDate="2015-11-18T17:09:38.693" Title="Fractional/Interpolating Delay Line still sounding glitchy" Tags="|audio|interpolation|c|delay|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27134" PostTypeId="1" AcceptedAnswerId="27136" CreationDate="2015-11-17T17:56:58.223" Score="1" ViewCount="282" Body="&lt;p&gt;I have the following transfer function that I am trying to model in MATLAB with some additional unity white noise:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$G(s)=\frac{1}{s^3 + \beta s^2}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I used the following to obtain the continuous state space equation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;beta = 0.2;&#xA;b = [0 0 0 1];&#xA;a = [1 beta 0 0];&#xA;[A,B,C,D] = tf2ss(b,a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My understanding is that the &lt;code&gt;tf2ss()&lt;/code&gt; function provides me with the values A and B which can be used in the following equation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;dxdt = Ax + Bu, where x is the initial condition and u is the unity white noise.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Upon running the above code snippet, I obtain the following values for A and B:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A = [-0.2,0,0; 1,0,0; 0,1,0]&lt;br&gt;&#xA;B = [1; 0; 0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is where I am running into trouble (although I may have run into an issue before with my assumptions regarding &lt;code&gt;tf2ss()&lt;/code&gt;).  I do not understand how to write the differential equation function required to use &lt;code&gt;ode45()&lt;/code&gt;.  I have tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function dx = mydiffeq(t,x)&#xA;    A = [-0.2,0,0;1,0,0;0,1,0];&#xA;    B = [1;0;0];&#xA;&#xA;    dx = A*x + B*randn(1);&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I call it as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;tspan = [0 10];&#xA;xnot = 100;&#xA;&#xA;[t,y] = ode45(@mydiffeq, tspan, xnot);&#xA;plot(t,y);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Obviously, I have a problem due to the size of my A and B matrices.  I know that I am doing this wrong, but I do not know how to fix it.&lt;/p&gt;&#xA;" OwnerUserId="18325" LastEditorUserId="18325" LastEditDate="2015-11-17T19:27:53.537" LastActivityDate="2015-11-17T19:27:53.537" Title="How do I use MATLAB to obtain a continuous state equation from a transfer function and ode45 to solve it?" Tags="|matlab|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27135" PostTypeId="2" ParentId="27133" CreationDate="2015-11-17T18:08:36.350" Score="2" Body="&lt;p&gt;If you change the delay parameter suddenly, there will be a jump to another point in time in the data, resulting in a glitch. The easiest is to filter the delay parameter with a one-pole low-pass filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{out}[k] = \text{out}[k-1] + a(\text{in}[k] - \text{out}[k-1]),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ is a constant between 0 and 1, $\text{in}[k]$ is the delay parameter controlled by the user and $\text{out}[k]$ is the delay parameter actually used in the delay line, for integer time index $k$. ($\text{out}[k-1]$ is the previous filtered value.) You can cascade these stages in series to get further smoothing. Two stages should sound good because it will get rid of discontinuities in the pitch shift due to a kind of doppler effect that changing the delay length creates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constant $a$ can be tuned manually. A good value might be the highest value that does not produce disturbing glitches. For a better explanation of $a$, useful if you need to adapt to a different sampling frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a \approx (1-p)^{\frac{f_s}{t_p}},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $p$ between 0 and 1 represents the percentage that the filtered delay parameter has come towards a new value of the input delay parameter in time $t_p$, and $f_s$ is the sampling frequency. The formula is for a single filtering stage. If you have multiple stages the meaning of $t_p$ changes but you can still use it to go from one sampling frequency to another. The -3 dB cutoff frequency $f_\text{cutoff}$ for a stage will be approximated by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_\text{cutoff} \approx \frac{-f_s\ln a}{2\pi} $$&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-17T22:20:15.360" LastActivityDate="2015-11-17T22:20:15.360" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27136" PostTypeId="2" ParentId="27134" CreationDate="2015-11-17T18:18:35.260" Score="2" Body="&lt;p&gt;You're doing pretty much everything right. The only problem is that your system is a third order system (s^3) and hence, the state x in&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dx = A*x + B*u&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is 3x1 but your initial condition xnot is a scalar. Replace&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xnot = 100&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xnot = [0 0 0].';&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(or whatever initial condition you have) and it should work.&lt;/p&gt;&#xA;" OwnerUserId="18212" LastActivityDate="2015-11-17T18:18:35.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27138" PostTypeId="1" CreationDate="2015-11-17T20:53:43.600" Score="0" ViewCount="221" Body="&lt;p&gt;Thank in advance for the help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have several GB's of raw audio data that I have collected as part of a research study.  This audio is divided up into individual samples approximately 30 seconds in length.  Many samples, I would say approximately 20%, contain mild to significant noise in the form of microphone rustle (caused by an object moving across or touching the microphone)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is remove this noise.  I do not care about recovering any audio covered by the noise; I just want to remove it via &quot;cutting it out&quot; (however, if i was able to recover the audio that would be ideal).  I would like to remove as much of the noise as possible in a manner that doesn't lead to the audio skipping.  In other words if I have noise at time 3 and time 20, it is sufficient to remove audio from time 3 to time 20 (obviously the time between noise occurances cannot be too large otherwise I'll end up removing all of my audio).  It is thus okay to remove some good audio in order to maintain the playability of the sample.  If I end up removing a certain percentage of audio due to noise, say more than 50%, I will just throw the sample out.  I have many samples, I just need to make sure that the samples I analyze are clean.  Obviously I cannot manually go through GB's worth of audio (well I could, but I don't have months).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What might be the best approach to take to identify such noise?  I'm aware that I could use a representative noise sample and try to find matches in my samples, but I see two issues.  First, I don't think there is a global representative sample of this noise.  I want to make sure that I remove every instance of this noise, but I can't be too aggressive otherwise I'll end up with no audio.  Second, I doubt this is the best approach.  One can imagine the quality of audio of news reports given during a live broadcast in a storm; there is no microphone rustle from wind.  There likely then is a standardized way to remove this kind of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Computation is not an issue.  I have access to a cluster and can code in just about any language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit2: Spectrogram of a whole audio file with the microphone rustle.  I would not say that this is representative though of one of my samples (in the terms of the noise it is very roughly representative)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kS9Dw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kS9Dw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just the microphone rustle&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1JTmS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1JTmS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a clipping of of the same audio sample with no microphone rustle&#xA;&lt;a href=&quot;https://i.stack.imgur.com/l5FNj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l5FNj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18326" LastEditorUserId="18326" LastEditDate="2015-11-17T21:45:33.487" LastActivityDate="2015-11-17T21:45:33.487" Title="Remove microphone rustle / clothing rustle from raw audio data" Tags="|audio|noise|continuous-signals|denoising|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27139" PostTypeId="1" AcceptedAnswerId="27141" CreationDate="2015-11-17T21:38:31.313" Score="3" ViewCount="736" Body="&lt;p&gt;I have some doubts about correlation in &lt;code&gt;stationary stochastic processes&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the expectation of a random variable is &#xA;$$E(x)=\int_{-\infty}^{+\infty} a f_x(a)da$$&#xA;and the &lt;code&gt;mutual correlation&lt;/code&gt; of two variables is $E(x_1 x_2)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In two stationary stochastic processes the mutual correlation should be $E(x_1(t+\tau)x_2(t))$ now when and why I can translate this formula in:&#xA;$$&#xA;\int_{-\infty}^{+\infty} x_1(t+\tau)x_2(\tau)d\tau&#xA;$$&#xA;I have not understand where this last formula comes from.&lt;/p&gt;&#xA;" OwnerUserId="18294" LastEditorUserId="80" LastEditDate="2015-11-18T01:39:45.430" LastActivityDate="2015-11-18T01:39:45.430" Title="explanation of correlation of stationary stochastic processes" Tags="|correlation|stochastic|random-process|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27141" PostTypeId="2" ParentId="27139" CreationDate="2015-11-17T23:19:02.210" Score="5" Body="&lt;p&gt;You are mixing up two different notions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your random process is a &lt;em&gt;collection&lt;/em&gt; of random variables $\{X(t)\colon -\infty &amp;lt; t &amp;lt; \infty\}$, one random variable for each time instant. The autocorrelation function of the process is&#xA;$$R_X(t, \hat{t}) = E[X(t)X(\hat{t})], -\infty &amp;lt; t, \hat{t} &amp;lt; \infty$$&#xA;and is a &lt;em&gt;two-dimensional&lt;/em&gt; function (meaning it has two arguments,&#xA;and if you try to visualize it, you should imagine a &lt;em&gt;surface&lt;/em&gt; above &#xA;(and possibly&#xA;below) the plane with coordinate axes $t$ and $\hat{t}$. Definitely above&#xA;because $R_X(t,t) = E[(X(t))^2]\geq 0$ for all $t$ (and processes for&#xA;which $R_X(t,t) = 0$ for all $t$ are kinda boring).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a &lt;em&gt;stationary&lt;/em&gt; process, $R(t,\hat{t})$ depends only on the&#xA;&lt;em&gt;difference&lt;/em&gt; $\hat{t}-t$ of the two arguments, and it is common&#xA;practice to write it as a function of one variable $\tau = \hat{t}-t$.&#xA;Thus,&#xA;$$\mathcal R(\tau) = R(t,\hat{t}) = E[X(t)X(t+\tau)].$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;other&lt;/em&gt; notion is that if the experiment is performed, then&#xA;each random variable takes on a numerical value. Thus, $X(t)$ takes&#xA;on a specific numerical value that we name as $x(t)$ while&#xA;$X(\hat{t})$ takes on some other numerical value that we name&#xA;as $x(\hat{t})$ and so on. Thus, we have a &lt;em&gt;real-valued&lt;/em&gt; function&#xA;(or signal) $x(t)$ (nothing random about that!) for which the&#xA;autocorrelation function is defined as&#xA;$$R_x(\tau) = \int_{-\infty}^\infty x(t)x(t+\tau)\,\mathrm dt.$$&#xA;Note that $x(t)$ is called a &lt;em&gt;sample path&lt;/em&gt; or &lt;em&gt;realization&lt;/em&gt;&#xA;of the random process: it is what you observe on your oscilloscope&#xA;if you lift up your head from the math a little bit&#xA;and look at the real world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is every DSPer's fondest hope that $R_x(\tau)$ is the same function&#xA;as $\mathcal R(\tau)$. Unfortunately, &lt;em&gt;nothing&lt;/em&gt; in what has been&#xA;said above justifies this hope. But, since people like to assume&#xA;that it is indeed true that $R_x(\tau) = \mathcal R_X(\tau)$, mathematicians have come&#xA;up with a notion called &lt;em&gt;ergodicity&lt;/em&gt; which (for our purposes) says that&#xA;for an &lt;em&gt;ergodic&lt;/em&gt; process, the &lt;em&gt;ensemble&lt;/em&gt; means (expectations)&#xA;equal the corresponding time-averages.  As a &lt;em&gt;practical&lt;/em&gt; matter,&#xA;all model-builders &lt;em&gt;assume&lt;/em&gt; that the processes that they want&#xA;to model are indeed both stationary and ergodic,&#xA;and decide on what the mean and&#xA;the autocorrelation function etc should be by making observations of&#xA;actual sample paths etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more than what you probably want to know about random processes,&#xA;see &lt;a href=&quot;https://dsp.stackexchange.com/a/488/235&quot;&gt;this answer&lt;/a&gt; of mine, and&#xA;for an example of a (boring) stationary random process that is &#xA;&lt;em&gt;not&lt;/em&gt; ergodic, see &lt;a href=&quot;https://dsp.stackexchange.com/a/1169/235&quot;&gt;this other answer&lt;/a&gt; of mine.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-11-17T23:33:31.277" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27142" PostTypeId="1" AcceptedAnswerId="27148" CreationDate="2015-11-18T01:23:45.933" Score="0" ViewCount="2155" Body="&lt;p&gt;First of all, thank you all for your answers. I know the z transform for&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(n)=3^n \space ; \space  n\geqslant  3 $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;or rather &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(n)= 3^n u(n-3) $$$$\begin{align}X(z)&amp;amp;=\sum_{n=-\infty}^{\infty}x[n]z^{-n}\\&amp;amp;=\sum_{n=-\infty}^\infty3^nu(n-3)z^{-n}\\&amp;amp; \text{change of variables: } n'=n-3 \\&amp;amp; =\sum_{n=-\infty}^\infty 3^{(n'+3)} u(n') z^{(-n'-3)}\\&amp;amp; \text{recall:  } n'-&amp;gt; n \\&amp;amp;=3^3z^{-3}\sum_{n=0}^{\infty}(3 z^{-1})^{n}\\&amp;amp; X(z) =3^3 z^{-3}\frac{1}{1-3{z^{-1}}},\quad |z|&amp;gt;3  \tag{1}\end{align} $$\begin{align} \\&amp;amp;  \text{instead, for the sequence: } x(n)=3^{n} \ ; n\leqslant -3  \\&amp;amp;=\sum_{n=-\infty}^\infty3^nu(-n-3)z^{-n}\\&amp;amp; \text{change of variables: } n'=-n-3 \\&amp;amp; =\sum_{n=-\infty}^\infty 3^{(-n'-3)} u(n') z^{-(-n'-3)}\\&amp;amp; \text{recall:  } n'-&amp;gt; n \\&amp;amp;=3^{-3} z^{3}\sum_{n=0}^{\infty}(3^{-1} z)^{n}\\&amp;amp;  X(Z)= 3^{-3}z^{3}\frac{1}{1- \frac{z}{3}} \quad |z|&amp;lt;3\tag{2}\end{align}&#xA;Is it correct?&#xA;And for @Matt L. I don't understand your mathematical step initial when you write: &#xA;$$\begin {align} \sum_{n=-\infty}^3 3^nz^{-n}  =\sum_{n=-\infty}^0 3^{(n+3)} u(n') z^{-(n+3)} \end {align} $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you write me the generic formula?&lt;/p&gt;&#xA;" OwnerUserId="18327" LastEditorUserId="8202" LastEditDate="2015-11-18T14:56:23.380" LastActivityDate="2019-10-22T10:27:09.510" Title="Z-Transform of $x(n) = 3^n$" Tags="|z-transform|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27143" PostTypeId="1" AcceptedAnswerId="27152" CreationDate="2015-11-18T03:12:02.573" Score="3" ViewCount="24494" Body="&lt;p&gt;I'm using Digital Signal Processing Principles, Algorithm and Applications 4th Edition written by Proakis and Manolakis. In Chapter 3, subtopic 3.3.2 it mentions the term &quot;causal signal&quot; which I can't find any definition. I know what a causal system means: a system that output depend entirely on past and present input, not future input but here it's causal signal, not system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what does causal signal definition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to look at the Index and it says that the term &quot;Causal Signal&quot; is mentioned in page 85 but in fact, I find nothing in page 85 mentioning it&lt;/p&gt;&#xA;" OwnerUserId="18328" LastActivityDate="2021-01-15T14:12:09.417" Title="What is causal signal?" Tags="|discrete-signals|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27145" PostTypeId="2" ParentId="27143" CreationDate="2015-11-18T03:35:34.287" Score="1" Body="&lt;p&gt;same property that the impulse response of a causal, linear and time-invariant (LTI) system has.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-11-18T03:35:34.287" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27146" PostTypeId="1" CreationDate="2015-11-18T04:04:50.590" Score="1" ViewCount="8240" Body="&lt;p&gt;In a paper about radar, the transmitted signal expressed in low-pass equivalent form is given by $\sqrt{E}s(t)$, where $E$ is the transmitted energy, $s(t)$ satisfies &#xA;$$&#xA;\int_T | s(t) |^2 dt = 1,&#xA;$$&#xA;and $T$ is the pulse duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &#xA;$$&#xA;s(t) = \sqrt{\frac{1}{T}} \exp(j2\pi f_c t)&#xA;$$&#xA;and the received signal is&#xA;$$&#xA;r(t) = \alpha s(t) + n(t)&#xA;$$&#xA;and the SNR in this paper is &#xA;$$&#xA;\frac{E |\alpha|^2}{\sigma^2}&#xA;$$&#xA;where $\alpha$ is the reflectivity, and $\sigma^2$ is the variance of the zero-mean Gaussian noise process $n(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I want to generate $r(t)$ in &lt;code&gt;Matlab&lt;/code&gt; with SNR = 10, I sample $s(t)$ with a sample period $T_S$ so I get &#xA;$$&#xA;s(nT_s) = \sqrt{\frac{1}{T}} \exp(j2\pi f_c nT_S)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:  how do I calculate the noise variance, $\sigma^2$ from the above so that I can calculate:&#xA;$$&#xA;r(nT_S) = \alpha s(nT_s) + \sigma {\tt randn(size(}s{\tt ))}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;??&lt;/p&gt;&#xA;" OwnerUserId="18307" LastEditorUserId="80" LastEditDate="2015-11-18T13:26:37.943" LastActivityDate="2019-09-25T06:33:30.070" Title="How do I calculate the noise variance in this problem?" Tags="|snr|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27147" PostTypeId="1" CreationDate="2015-11-18T07:30:50.450" Score="1" ViewCount="6617" Body="&lt;p&gt;Why median filter is considered as good for removal of salt and pepper noise? What are the other filters used for the same?&lt;/p&gt;&#xA;" OwnerUserId="17137" LastEditorUserId="17137" LastEditDate="2015-11-18T16:13:41.993" LastActivityDate="2019-10-13T14:42:58.827" Title="Median Filter for salt and pepper noise removal" Tags="|noise|filtering|median-filter|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27148" PostTypeId="2" ParentId="27142" CreationDate="2015-11-18T08:17:42.020" Score="4" Body="&lt;p&gt;The signal $x[n]=3^n$ for $n\le -3$ (and zero otherwise, I assume) can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=3^nu[-n-3]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compute its $\mathcal{Z}$-transform you simply need to use the formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X(z)&amp;amp;=\sum_{n=-\infty}^{\infty}x[n]z^{-n}\\&amp;amp;=\sum_{n=-\infty}^{-3}3^nz^{-n}\\&amp;amp;=\sum_{n=-\infty}^03^{(n-3)}z^{-(n-3)}\\&amp;amp;=3^{-3}z^{3}\sum_{n=0}^{\infty}\left(\frac{z}{3}\right)^n\\&amp;amp;=3^{-3}z^{3}\frac{1}{1-\frac13 z},\quad |z|&amp;lt;3\tag{2}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to specify the region of convergence ($|z|&amp;lt;3$), otherwise the $\mathcal{Z}$-transform does not uniquely identify the corresponding sequence $x[n]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-18T16:54:28.673" LastActivityDate="2015-11-18T16:54:28.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27149" PostTypeId="1" CreationDate="2015-11-18T08:57:40.087" Score="1" ViewCount="169" Body="&lt;p&gt;I am doing a research about image-based User Interface (UI) Analysis, and while UI image-based analysis is not more complicated than normal image analysis, I was able to do a segmentation process to separate text, icon and picture in the UI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, my next step is to perform content classification on the segmented groups.  The segmentation contains:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;text&lt;/li&gt;&#xA;&lt;li&gt;image or icon&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So: what could be the best approach to classify an image containing either text or image?&lt;/p&gt;&#xA;" OwnerUserId="18185" LastEditorUserId="15892" LastEditDate="2016-02-16T22:39:13.593" LastActivityDate="2017-04-12T06:39:28.853" Title="What is the best approach to classify an image containing either text or image?" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27150" PostTypeId="2" ParentId="27094" CreationDate="2015-11-18T11:17:14.320" Score="1" Body="&lt;p&gt;There is no standard way to determine the coefficients of the Farrow structure for a given FIR filter. The Farrow structure is an implementation of a whole class of FIR filters with transfer function(s) $H_{\mu}(z)$ with a continuous control parameter $\mu$. Often this parameter $\mu$ determines a fractional delay, but it could as well be any other adjustable filter property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function $H_{\mu}(z)$ of the Farrow structure is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{\mu}(z)=\sum_{k=0}^{K-1}C_k(z)\mu^k\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $C_k(z)$ are FIR transfer functions. From $(1)$, the impulse response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_{\mu}[n]=\sum_{k=0}^{K-1}c_k[n]\mu^k\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So each filter coefficient (of the corresponding transversal filter structure) $h_{\mu}[n]$ is implemented as a weighted sum of coefficients $c_k[n]$. This is why there is no one-to-one mapping from given FIR filter coefficients to the coefficients of the Farrow structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to specify which filter property the parameter $\mu$ is supposed to control, and then you need to design the coefficients $c_k[n]$ of the Farrow structure accordingly.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-20T10:14:33.017" LastActivityDate="2015-11-20T10:14:33.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27152" PostTypeId="2" ParentId="27143" CreationDate="2015-11-18T12:59:29.997" Score="6" Body="&lt;p&gt;A &lt;em&gt;system&lt;/em&gt; is causal if its output depends only on the current input and past inputs (and not on future inputs).  As a consequence, if the system is a &lt;em&gt;linear, time-invariant&lt;/em&gt; (LTI) system (which input/output relationship can be completely characterized by an &lt;em&gt;impulse response&lt;/em&gt;), that impulse response, $h(t)$ must be zero for all time $t \lt 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/freebooks/mdft/Causal_Periodic_Signals.html&quot; rel=&quot;noreferrer&quot;&gt;Some people define&lt;/a&gt; a causal &lt;em&gt;signal&lt;/em&gt;, $x(t)$, to be one that can be the impulse response of a causal system: it is zero for all time $t \lt 0$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="4346" LastEditDate="2015-11-18T18:43:39.227" LastActivityDate="2015-11-18T18:43:39.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27154" PostTypeId="1" AcceptedAnswerId="27156" CreationDate="2015-11-18T13:29:58.207" Score="1" ViewCount="111" Body="&lt;p&gt;Ladies, Gentlemen, &#xA;Because I am homeless (in France), and get internet access only in public libraries with many restrictions in timing etc, I can not write down even a simple convolution. So I ask you post here the convolution of  some sinusoidal function with itshelf. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: 0.951056516295, 0.587785252292, -0.587785252292, -0.951056516295, 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards &lt;/p&gt;&#xA;" OwnerUserId="17893" LastActivityDate="2015-11-19T13:35:39.297" Title="Can you present the convolution of sinusoidal with itself?" Tags="|convolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27155" PostTypeId="1" CreationDate="2015-11-18T13:46:11.277" Score="1" ViewCount="86" Body="&lt;p&gt;say the signal $x(n)$ has the z transform $X(z)$ and there is signal $x_1(n)$ that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X_1(z)=zX(z^{-1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried 2 different approach to get the relationship between $x(n)$ and $x_1(n)$ and the result is different without any error being noticed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approach 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_i(n)=x(-n) \rightarrow X_i(z) = X(z^{-1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_1(n)=x_i(n+1) = x(-n-1) \rightarrow X_1(z) = zX_i(z)=zX(z^{-1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approach 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_i(n)=x(n-1) \rightarrow X_i(z) = z^{-1}X(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_1(n)=x_i(-n)=x(1-n) \rightarrow X_1(z) = X_i(z^{-1}) = zX(z^{-1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence in the end, I don't know $x_1(n) = x(-n-1)$ or $x_1(n) =x(1-n)$ and I can't find any mistake. I know that different function can have same z-transform but different ROC but in this case, no any info of ROC is given&lt;/p&gt;&#xA;" OwnerUserId="18328" LastEditorUserId="4298" LastEditDate="2015-11-18T14:25:37.117" LastActivityDate="2015-11-18T20:24:13.807" Title="What is the right way to calculate the inverse Z-transform of $zX(z^{-1})$" Tags="|discrete-signals|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27156" PostTypeId="2" ParentId="27154" CreationDate="2015-11-18T13:48:20.977" Score="1" Body="&lt;p&gt;For your data points I get:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;-2.467162e-16 -9.045085e-01 -1.118034e+00  7.725425e-01  2.500000e+00  7.725425e-01 -1.118034e+00 -9.045085e-01 -1.480297e-16&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;from&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#27154    &#xA;data &amp;lt;- c(0.951056516295, 0.587785252292, -0.587785252292, -0.951056516295, 0.) &#xA;output &amp;lt;- convolve(data,data, type =&quot;open&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-18T13:48:20.977" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27157" PostTypeId="2" ParentId="27155" CreationDate="2015-11-18T14:24:14.780" Score="4" Body="&lt;p&gt;The first result is correct, the second is wrong. You're right that $x_i[n]=x[n-1]$ corresponds to $z^{-1}X(z)$. And if you replace $z$ by $1/z$ you need to replace $n$ by $-n$. But $x_i[-n]$ is simply $x[-n-1]$,  and not $x[-n+1]$. Note that you don't replace the whole argument of $x[n-1]$ by its negative value, but you just replace $n$ by $-n$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-18T20:24:13.807" LastActivityDate="2015-11-18T20:24:13.807" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27158" PostTypeId="2" ParentId="27035" CreationDate="2015-11-18T15:08:19.667" Score="1" Body="&lt;p&gt;I have always found that a &quot;Median Filter&quot;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Median_filter&lt;/a&gt;   to be effective on streaming data.&lt;br&gt;&#xA;A brief intuitive description is below; but you must take steps to insure you restrict the bandwidth to the real data source you expect.  While you might not know the sources/spectrum/timing of noise and spikes (in which case the median filter is actually pretty good) you hopefully know the signals and characteristics of the signals you are looking for.  For extensive analysis, still iffy IMHO, along the lines of PDF (probability distribution function) and spectral analysis: there are some IEEE articles; but my analysis of most of the articles were that they weren't really useful in the face of unknown interference.  Aside from accommodating only the real signal bandwidth I wouldn't try z-s domain filtering without a really good reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;------------------------ Median filter abbreviated description&#xA;Basically you pass the data into a shift register and pick the middle value.  Examples always show a sort process; but since you lose only one value and gain only one value during a shift, you can bypass doing full sorts each step&#xA;Having said that: if the spikes are in the input data then that is where this should be applied; but if the spikes are real &quot;jerks&quot; (i.e. occurring in the second derivative) then that is where it should be applied.&#xA;Since the derivative process amplifies higher order noises one has to careful.  If I was doing what you describe I would impose the median filter on the source data, first differences, and then on second differences (acceleration).  And then examine the results; look inside the algorithm and understand what data is tossed! &#xA;There is an alternate form: you examine a shift register of the data for min's and max's and just toss the extremes.&lt;br&gt;&#xA;Both techniques incur some data loss that has to be taken into account.  You can interpolate, which is a little expensive, or just accommodate a lower sampling rate; say one in ten samples will always be tossed.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2015-11-18T15:08:19.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27159" PostTypeId="2" ParentId="27154" CreationDate="2015-11-18T15:25:39.207" Score="1" Body="&lt;p&gt;I sent my question from municipal library of saint Claude, France where they offered me just one hour. ow I am in CCAS of the same town where they offer more time, so I will try answer my question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) 0.951056516295x0=0 + 0.587785252292x0=0 + -0.587785252292x0=0 + -0.951056516295x0=0 + 0x0.951056516295=0   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;total = 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) 0.951056516295x0=0 + 0.587785252292x0=0 + -0.587785252292x0=0 + -0.951056516295x0.951056516295=-0.9045084971871816 + 0x0.587785252292=0     total = -0.9045 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) 0.951056516295x0=0 + 0.587785252292x0=0 + -0.587785252292x0.951056516295=-0.559 + -0.951056516295x0.587785252292=-0.559 + &#xA;0x-0.587785252292=0   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;total = -1.118 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) 0.951056516295x0=0 + &#xA;0.587785252292x0.951056516295=0.559 + &#xA;-0.587785252292x0.587785252292=-0.3454915 + &#xA;-0.951056516295x-0.587785252292=0.559 + &#xA;0x-0.951056516295=0   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;total = 0.7725&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) 0.951056516295x0.951056516295=0.9045 + &#xA;0.587785252292x0.587785252292=0.3454915 + &#xA;-0.587785252292x-0.587785252292=0.3454915 + &#xA;-0.951056516295x-0.951056516295=0.9045 + &#xA;0x0=0   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;total = 2.5 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) 0x0.951056516295=0 &#xA;+ 0.951056516295x0.587785252292=0.559 &#xA;+ 0.587785252292x-0.587785252292=-0.3454915 &#xA;+ -0.587785252292x-0.951056516295=0.559 &#xA;+ -0.951056516295x0=0   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;total = 0.7725 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;7) 0x0.951056516295=0 + 0x0.587785252292=0 + 0.951056516295x-0.587785252292=-0.559 + 0.587785252292x-0.951056516295=-0.559 + -0.587785252292x0=0   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;total = -1.118&lt;/p&gt;&#xA;&#xA;&lt;p&gt;8) 0x0.951056516295=0 &#xA;+ 0x0.587785252292=0 &#xA;+ 0x-0.587785252292=0 &#xA;+ 0.951056516295x-0.951056516295=-0.9045 &#xA;+ 0.587785252292x0=0 &#xA;+ -0.587785252292x0=0 &#xA;+ -0.951056516295x0=0 &#xA;+ 0x0=0   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;total = -0.9045 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;9) 0x0.951056516295=0 &#xA;+ 0x0.587785252292=0 &#xA;+ 0x-0.587785252292=0 &#xA;+ 0x-0.951056516295=0 &#xA;+ 0x0=0   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;total = 0 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;output: 0, -0.9045, -1.118, 0.7725, 2.5, 0.7725, -1.118, -0.9045, 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards  &lt;/p&gt;&#xA;" OwnerUserId="17893" LastEditorUserId="17893" LastEditDate="2015-11-19T13:35:39.297" LastActivityDate="2015-11-19T13:35:39.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27160" PostTypeId="2" ParentId="27146" CreationDate="2015-11-18T15:28:35.577" Score="3" Body="&lt;p&gt;Since the signal $r(t)$ is expressed as the low-pass equivalent of a bandpass signal, in general it will be complex. That means that the noise is also complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;White Gaussian noise has a power spectral density commonly denoted by $N_0/2$. This means that if you filter the noise with an ideal filter of bandwidth $B$, the noise at the filter's output is $\sigma^2=BN_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is the power &quot;per dimension&quot;. That is, the in-phase and the quadrature components of the low-pass signal $r(t)$ each suffer from noise of power $\sigma^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You define the SNR as $E|\alpha|/\sigma^2$ and you need it to be equal to 10. One way to do this is to configure your simulation so that $E|\alpha|=1$, and then choose $\sigma=\sqrt{0.1}$. If you later need a different SNR, you can just change one value ($\sigma$) in your simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can generate the complex noise as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = length(s);&#xA;noise = sqrt(0.1)*(randn(1,N)+1i*randn(1,N));&#xA;r = alpha*s + noise;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that in this setup, the &lt;em&gt;total&lt;/em&gt; noise power is $2\sigma^2$. The in-phase noise and the quadrature noise each have power $\sigma^2$.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-11-18T15:28:35.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27161" PostTypeId="1" CreationDate="2015-11-18T16:06:43.140" Score="2" ViewCount="46" Body="&lt;p&gt;Ladies, Gentlemen, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my last question I asked you present the convolution of sinusoidal with itself. I accept Mr Peter K.'s answer. Now my question is much more important. Is output of convolution of sinusoidal with itself, also sinusoidal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards &lt;/p&gt;&#xA;" OwnerUserId="17893" LastActivityDate="2015-11-18T16:06:43.140" Title="Is output of convolution of sinusoidal with itself, also sinusoidal?" Tags="|convolution|" AnswerCount="0" CommentCount="1" ClosedDate="2015-11-18T17:10:42.203" ContentLicense="CC BY-SA 3.0" />
  <row Id="27162" PostTypeId="2" ParentId="17460" CreationDate="2015-11-18T17:51:08.377" Score="0" Body="&lt;p&gt;Approximate rotational invariance is obtained by weighting the features with a 2D Gaussian of appropriate $\sigma$ in a square window, so that the influence of the corners vanishes. [You can make it as accurate as you want by reducing $\sigma$, at the expense of a smaller scale.]&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-11-18T18:00:57.170" LastActivityDate="2015-11-18T18:00:57.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27163" PostTypeId="2" ParentId="27149" CreationDate="2015-11-18T18:03:50.300" Score="1" Body="&lt;p&gt;The segment with text (I assume with a background) should contains text clearly visible from the background, then the text segment should have a lot of peaks in the transitions from text to background. The segment icon normally shouldn't have many peaks because in general there are few variations in an image. So if you make a &lt;code&gt;stft&lt;/code&gt; of a part of a segment the text should have more harmonics than the icon.&#xA;However if the icon is similar to the text or if it has many peaks this idea can't works. You can also find the color density, a single color text on a single color background has the color density concentrated in two points. This is only an idea and it must to be improved.&lt;/p&gt;&#xA;" OwnerUserId="18294" LastEditorUserId="18294" LastEditDate="2015-11-18T18:08:55.350" LastActivityDate="2015-11-18T18:08:55.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27165" PostTypeId="1" CreationDate="2015-11-18T19:27:01.070" Score="0" ViewCount="1305" Body="&lt;p&gt;One can achieve better resolution results by taking FFT of different sizes of the input signal. FFT size decreases as frequency increases, i.e. longer FFT length for lower frequencies and shorter FFT length for higher frequencies. I have tried to find papers on this topic but did not find any so far. Rational Acoustics has few brochures where it mentions MTW - Multi-Time Window FFT, but there is no mathematics behind it. Anyone can help me with the answer about underlying mathematics or some code implementation (C++, C, or Java)? In other words, how I can apply longer FFT, in my software, for lower frequencies and shorter FFT for higher frequencies to get uniform resolution as a result?&lt;/p&gt;&#xA;" OwnerUserId="15718" LastActivityDate="2017-06-14T20:27:31.567" Title="Multi-Time Window FFT" Tags="|fourier-transform|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27166" PostTypeId="1" CreationDate="2015-11-18T20:34:25.233" Score="1" ViewCount="660" Body="&lt;p&gt;How to calculate step response for $y''(t) - y(t) = x'(t) - x(t)$ in time domain? So, without Laplace or Fourier Transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Homogeneous solution of the differential equation would be: $ y_\text{homogeneous} = A*e^t + B*e^{-t}  $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u(t)$ is the unit step function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u(t) \triangleq &#xA;\begin{cases}&#xA;1, &amp;amp; \text{if }t&amp;gt;0 \\&#xA;0, &amp;amp; \text{if }t&amp;lt;0&#xA;\end{cases} $$&#xA;When I try to fill in the stepfunction for $x: x(t)=u(t)$. So $x'(t) = u'(t) = \delta(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I try a step response $y(t) = y_\text{homogeneous}(T)*u(t) =  (A*e^t + B*e^{-t})*u(t) $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial ^2 (  \left(A e^t+B e^{-t} \right)u(t) )}{\partial t^2}-\left(A e^t+B e^{-t}\right) u(t)=\delta(t)-u(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I will get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$2 (A-B) \delta(t)-A \delta(t)+A \left( \delta ' (t) \right )+B \delta(t)+B \left( \delta ' (t) \right)=\delta(t)-u(t)$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there's no $u(t)$ at the left hand side.&lt;/p&gt;&#xA;" OwnerUserId="18341" LastEditorUserId="4346" LastEditDate="2015-11-18T21:05:57.703" LastActivityDate="2015-11-19T11:32:32.637" Title="How to calculate step response for $y''(t) - y(t) = x'(t) - x(t)$ in time domain?" Tags="|impulse-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27168" PostTypeId="2" ParentId="27165" CreationDate="2015-11-18T22:04:50.700" Score="1" Body="&lt;p&gt;If your goal is to plot a magnitude spectrum with the frequency axis on a log scale, but with a roughly even visual resolution along that axis, then a single FFT might provide too low a density of plot points (without interpolation) at low frequencies, and more plot points than can be plotted on a line (without averaging) at high frequencies for a given print or pixel display resolution or smoothness.  If you use different FFT lengths for different octaves or sub-octaves in frequency, and select subsets of the results from each FFT, then you can maintain a lower delta in density of FFT result points when plotted on such a log scale.  How many FFTs you might want to use depends on the maximum variance you want in log frequency resolution of the final joined plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since the FFTs are of different lengths, then they are for different sets of data.  A sequence of longer FFT windows can be done with larger offsets if more time resolution isn't needed at low frequencies.  You will have the problem of how to join or blend all these different FFT results (usually subset segments of the results) so that the magnitude response might be uniform across FFT boundaries.  In total, you also end up with an overdetermined set of FFT results (but so will highly overlapped windows).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even better results (in terms of even log frequency plot resolution) might be obtained by using some form of wavelet transform (a Morlet or Gabor wavelet or constant-Q transform, for example) instead of a bunch of semi-redundant FFTs.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But libraries for optimized FFTs might be more available on some platforms.  Each basis vector of a windowed FFT in a &quot;multi-time&quot; set can be considered a non-optimally-sized wavelet.  So, in some ways, using these so-called &quot;multi-time window&quot; FFTs is a &quot;poor man's&quot; wavelet transform.  But some of the many FFT results might be useful for other forms of more traditional DFT analysis of the signal input (in conjunction with the log plot), thus serving a dual purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A partial psycho acoustic justification for increasing FFT size at lower frequencies (or using wavelets) is that, over a certain mid-frequency range, the human ear/brain takes a length of time to determine frequency or pitch of a sound roughly proportional to the period of the frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-11-18T23:14:38.157" LastActivityDate="2015-11-18T23:14:38.157" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27169" PostTypeId="1" CreationDate="2015-11-18T23:37:26.713" Score="0" ViewCount="455" Body="&lt;p&gt;I have an audio signals from two microphones, and I have to make them equal for equal input.&#xA;I.e. calibrate the output of microphones to give the same resulting signal on both of them.&#xA;The problem is with amplitudes. Both sensors aren't equaly sensitive (logically. But I need the output to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The naive solution of this problem would be to find a constant difference between signal from mic A and mic B. And simply add it to the signal that requires that boost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, well, I am introducing deviation to signal. I am pushing it up along Y axces. This increases the top amplitude, but I am increasing the silence too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, signal will not really change, on speaker will be heard the same, as silence line continues to be the line,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I don't see what other implications I may have if I do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would this affect the frequency spectrum for instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I cannot do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(x/max(x)*constant&lt;/p&gt;&#xA;&#xA;&lt;p&gt;normalization because I loose the info about initial amplitude of the signal. My measurement uses amplitudes and they must stay as they are, except that microphones should be calibrated.&lt;/p&gt;&#xA;" OwnerUserId="18346" LastActivityDate="2015-11-18T23:37:26.713" Title="How would addition with a constant in time domain affect my signal in frequency domain?" Tags="|audio|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27170" PostTypeId="1" AcceptedAnswerId="27172" CreationDate="2015-11-19T00:07:44.053" Score="5" ViewCount="4456" Body="&lt;p&gt;Today I was talking to my collegue about clipping and he said that clipping produces harmonics in frequency domain as he showed me the clipped signal frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I asked him why does that happen, he couldn't answer. I did some googling and still not able to see why it is so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Clipping_(audio)&quot; rel=&quot;noreferrer&quot;&gt;This Link&lt;/a&gt; does mention about what we observed but didn't explain as to the reason why does it create harmonics? Does anyone know why it is so?&lt;/p&gt;&#xA;" OwnerUserId="18347" LastActivityDate="2020-09-07T21:17:50.637" Title="Why audio clipping produces harmonics?" Tags="|audio|frequency-spectrum|frequency-domain|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27171" PostTypeId="2" ParentId="27170" CreationDate="2015-11-19T01:05:35.490" Score="5" Body="&lt;p&gt;assuming there were no harmonics (frequency components other than the fundamental that are at integer multiples of the fundamental frequency) in the first place, that means the input to the clipping operation is a pure sine wave.  a Fourier series analysis of that periodic sinusoid will show non-zero amplitude at only one frequency, the frequency of the sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the output of the clipping operation is something &lt;strong&gt;other&lt;/strong&gt; than a sine wave (like a sine wave with either top or bottom peaks &lt;em&gt;&quot;clipped&quot;&lt;/em&gt;), then it's a periodic waveform that is not a sine wave.  then the Fourier series analysis will have to have other components than only that which was the original sinusoid.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-11-19T01:05:35.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27172" PostTypeId="2" ParentId="27170" CreationDate="2015-11-19T01:08:59.637" Score="7" Body="&lt;p&gt;Clipping is a non-linear operation. Consider a system that clips all input whose absolute value is larger than 1: $$ y(t) = \begin{cases}x(t)\text{ if }|x(t)|\leq 1 \\ 1 \text{ if } x(t) &amp;gt; 1 \\ -1 \text{ if } x(t) &amp;lt; -1 \end{cases}$$ While this system is linear for small inputs, it becomes non-linear as soon as the input becomes large enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Non-linear systems with no memory can be modeled by a power series: \begin{align}y(t) &amp;amp;= \sum_{n=0}^\infty a_n x^n \\ &amp;amp;= a_0 + a_1x(t) + a_2x^2(t) + a_3 x^3(t) + \cdots \end{align} Usually the coefficients $a_n$ become small as $n$ increases. Let's focus on $n=2$. If the input is a sine wave, then the clipped output contains the square of the sine wave, which has a DC term plus a term of twice the frequency of the input. It is the first distortion-causing harmonic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you play a bit with the equations you'll see that the terms for $n=3,4,\ldots$ each introduces new harmonics. When the input is more complex, such as a sum of sine waves of different frequencies, the harmonics will be more interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another, maybe more intuitive way to see it is as follows. A clipped sine wave looks a bit like a square wave -- the more clipping there is, the more similar it is. It is natural, then, that its Fourier series will resemble that of a square wave, which has plenty of harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have access to a spectrum analyzer, you can easily experiment with this by producing clipped sound in your computer, and seeing the output in the spectrum analyzer.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-11-19T01:08:59.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27173" PostTypeId="2" ParentId="17501" CreationDate="2015-11-19T08:29:23.450" Score="1" Body="&lt;p&gt;The farrow structure effectively interpolates between different sets of filter coefficients, so if you need an adjustable delay ($\delta$) of, say, 0 to 1 samples, you need to create a number (K) of FIR filters covering that delay interval. The matlab command then creates a $ K-1^{th} $ order polynomial in $ \delta $ to represent each filter coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Matt L said, if you don't need an adjustable delay, or to interpolate between filter coefficients based on some other parameter, there's no need for the farrow structure. If, however, you're just interested in how to get from FIR coefficients to farrow structure coefficients in general, I can post some rough code as I was messing about with this the other day. (hint: it's just simple least squares fitting).&lt;/p&gt;&#xA;" OwnerUserId="16404" LastActivityDate="2015-11-19T08:29:23.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27174" PostTypeId="1" CreationDate="2015-11-19T09:33:19.713" Score="1" ViewCount="53" Body="&lt;p&gt;I'm not yet well educated on the DSP subject, but I've initiated a project where I will do some audio filtering.&#xA;My intuition tells me that there is a link between the coefficients of a FIR filter and the response of the audio indicated by values of a fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question; is there a way to go from FFT data to FIR coefficients?&#xA;What about the other way around?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apologize that I probably do not use the correct terms.&#xA;Thank you for any response :)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT: I got a request to make this clearer, so here is some pseudo code of what I want to do given a stream of audio data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fftdata = fft(stream)&#xA;soSomethingTo(fftdata) //for instance increase bass response&#xA;FIRcoef = translate(fftdata)&#xA;stream = fir(stream, FIRcoef)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, this would analyze the stream and create a FIR that slightly modifies the fft response.&lt;/p&gt;&#xA;" OwnerUserId="18219" LastEditorUserId="18219" LastEditDate="2015-11-19T09:58:38.977" LastActivityDate="2015-11-19T09:58:38.977" Title="Is there a way to go from a set of (F/D)FT values to FIR coefficients?" Tags="|fft|audio|fourier|real-time|finite-impulse-response|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="27175" PostTypeId="1" CreationDate="2015-11-19T09:50:21.353" Score="0" ViewCount="48" Body="&lt;p&gt;I have a time series consisting of [time, value] pairs. The series is ordered by time but the difference between two consequent times is not constant. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time, value&#xA;[0.1,  5.2]&#xA;[0.23, 6.9]&#xA;[0.3,  7.2]&#xA;[0.31, 4.8]&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What are the methods to convert such time series to a vector with a constant sampling frequency? This will probably involve some interpolation of values that were nonexistent before, but that is ok for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any matlab function for doing so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final goal is to be able to apply filters and FFT on the original timeseries.&lt;/p&gt;&#xA;" OwnerUserId="18356" LastActivityDate="2015-11-19T09:50:21.353" Title="How can I convert time-value pairs to a signal with a constant sampling frequency?" Tags="|matlab|time-series|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27177" PostTypeId="2" ParentId="27166" CreationDate="2015-11-19T10:34:16.817" Score="3" Body="&lt;p&gt;It is indeed possible to convert the system to an equivalent first order system, but let's first directly solve the given problem. The system's step response satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y''(t)-y(t)=\delta(t)-u(t)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This implies that we can compute the step response of the given system by considering another system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y''(t)-y(t)=x(t)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and compute its impulse response ($x(t)=\delta(t)$) and its step response ($x(t)=u(t)$), and obtain the step response $(1)$ as the difference of the impulse response and the step response of the new system $(2)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the step response we need to solve&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y''(t)-y(t)=u(t)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the system is initially at rest, we get initial conditions $y(0)=y'(0)=0$. The homogeneous solution of $(3)$ is $y_h(t)=Ae^{t}+Be^{-t}$, $t&amp;gt;0$, whereas a particular solution is $y_p(t)=-1$, $t&amp;gt;0$. The complete solution is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=y_h(t)+y_p(t)=Ae^{t}+Be^{-t}-1,\quad t&amp;gt;0\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constants $A$ and $B$ are determined by the initial conditions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left.\begin{align}y(0)&amp;amp;=A+B-1=0\\y'(0)&amp;amp;=A-B=0\end{align}\right\}\Rightarrow A=B=\frac12\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, the step response of system $(2)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\frac12\left(e^t+e^{-t}\right)-1,\quad t&amp;gt;0\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its impulse response satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y''(t)-y(t)=\delta(t)\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and it can be obtained by differentiating the step response $(6)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\frac12\left(e^t-e^{-t}\right),\quad t&amp;gt;0\tag{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, according to $(1)$ and $(2)$, the step response of the original system is the difference between the impulse response and the step response given in $(8)$ and $(6)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\frac12\left(e^t-e^{-t}\right)-\frac12\left(e^t+e^{-t}\right)+1=1-e^{-t},\quad t&amp;gt;0\tag{9}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;Another approach would be to see that the original system can also be represented by a first-order system. Note that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y''(t)-y(t)=(y(t)+y'(t))'-(y(t)+y'(t))\tag{10}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if $y''(t)-y(t)=x'(t)-x(t)$, it follows from $(10)$ that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)+y'(t)=x(t)\tag{11}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $x(t)=u(t)$ you obtain from $(11)$ the same step response as in $(9)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}y_h(t)&amp;amp;=Ce^{-t}, &amp;amp;t&amp;gt;0\\&#xA;y_p(t)&amp;amp;=1, &amp;amp;t&amp;gt;0&#xA;\end{align}\\y(t)=y_h(t)+y_p(t)=Ce^{-t}+1,\quad t&amp;gt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $y(0)=0$ we get $C=-1$, and the step response becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=1-e^{-t},\quad t&amp;gt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;just like in $(9)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;As a final check it is useful to see what happens when you solve the problem using the Laplace transform. The original difference equation transforms to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(s)(s^2-1)=X(s)(s-1)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives for the transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s)=\frac{s-1}{s^2-1}=\frac{1}{s+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows that you have a pole-zero cancellation, and the system is actually a first-order system, just as described by Eq. $(11)$. For $x(t)=u(t)$ you get $X(s)=1/s$, and, consequently, for the Laplace transform of the step response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(s)=\frac{1}{s}\frac{1}{s+1}=\frac{1}{s}-\frac{1}{s+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which corresponds to the time domain function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=u(t)-e^{-t}u(t)=(1-e^{-t})u(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the same as $(9)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-19T11:32:32.637" LastActivityDate="2015-11-19T11:32:32.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27178" PostTypeId="1" CreationDate="2015-11-19T10:38:29.200" Score="3" ViewCount="1986" Body="&lt;p&gt;I'm puzzled about the LTE FFT size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming an LTE base station works at 20M mode, the FFT size is 2048. Then, many users can be served by this base station. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do all these users work at 20M mode (i.e., the FFT size of all these users are also 2048)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This 20M base station can serve users working at various modes (e.g., 1.4M, 5M, 10M, 15M, 20M modes)? For example, one user works at 1.4M mode with 128-point FFT and one user works at 10M mode with 512-point FFT can be served simultaneously by this 20M mode base station?&lt;/p&gt;&#xA;" OwnerUserId="18357" LastEditorUserId="24461" LastEditDate="2019-12-18T14:17:21.247" LastActivityDate="2019-12-18T14:17:21.247" Title="How to determine the FFT size of LTE downlink receiver?" Tags="|fft|communication-standard|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27179" PostTypeId="1" AcceptedAnswerId="27181" CreationDate="2015-11-19T11:09:58.607" Score="1" ViewCount="345" Body="&lt;p&gt;I have few confusions while starting Laplace Transform. So far I have studied, Fourier series and Fourier Transform. The basic difference which I found from different books is Fourier Transform is only considered the imaginary part whereas the Laplace transform considers both real and imaginary for general values.&lt;br&gt;&#xA;i) I want to ask that, is it only difference we have in Laplace and Fourier Transform? &#xA;Then i saw the two different equations of Laplace transform which is bilateral Laplace Transform $$ X(s) = \int _{-\infty}^{+\infty} x(t) e^{-st} dt$$&#xA;Whereas in the second equation of Laplace Transform is called unilateral Laplace Transform and it defined as:&#xA;$$ X(s) = \int _{0}^{+\infty} x(t) e^{-st}dt $$&#xA;It omit the negative part and only have for $t&amp;gt;0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ii) Here I want to ask that what is the reason of omitting the $t&amp;lt;0$ part?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And Lastly, there was an example  $$ x(t)=e^{-at}u(t)$$&#xA;After applying Laplace transform it was written The transform exists only if $Re(s+a)$ is possitive.&lt;br&gt;&#xA;iii) Now here is am confuse that why it took for possitive?&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="4298" LastEditDate="2015-11-19T11:44:41.127" LastActivityDate="2015-11-19T13:31:35.813" Title="Confusion in basics of Laplace Transform" Tags="|transform|laplace-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27180" PostTypeId="1" AcceptedAnswerId="27188" CreationDate="2015-11-19T11:43:17.137" Score="0" ViewCount="617" Body="&lt;p&gt;While solving Example 4.1 of Signals and Systems by Alan Oppenheim. Example 4.1 is:&#xA;$$ x(t)=e^{-at}u(t), a&amp;gt;0$$&#xA;and the transform I get is:&#xA;$$ X(j\omega)\frac{1}{a+j\omega}, a&amp;gt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is understanding the sketch: &#xA;The sketch is drawn for both the values $+a$ and $-a$&gt; i dont understand why it $-a$ when $a&amp;gt;0$ is defined.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/D2QHZ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/D2QHZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16293" LastActivityDate="2015-11-19T18:23:53.143" Title="Fourier Transform of exponential" Tags="|fourier-transform|transform|fourier|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27181" PostTypeId="2" ParentId="27179" CreationDate="2015-11-19T11:44:10.583" Score="3" Body="&lt;p&gt;The unilateral Laplace transform is used for analyzing causal linear time-invariant systems, which have an impulse response $h(t)$ that is zero for $t&amp;lt;0$. The unilateral Laplace transform can be used to solve initial value problems, due to the correspondence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x'(t)\Longleftrightarrow sX(s)-x(0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x(0)$ is a given initial value for the function $x(t)$. Note that for the bilateral Laplace transform the equivalent correspondence is simply $x'(t)\Longleftrightarrow sX(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the signal $x(t)=e^{-at}u(t)$, note that its Laplace transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(s)=\int_0^{\infty}e^{-(a+s)t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This integral only converges if the exponential decays, which results in the condition $\text{Re}(a+s)&amp;gt;0$. This condition defines the region of convergence (ROC) of the Laplace transform. $X(s)$ only exists for values of the complex variable $s$ satisfying $\text{Re}(s)&amp;gt;-\text{Re}(a)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-19T11:44:10.583" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27182" PostTypeId="1" AcceptedAnswerId="27186" CreationDate="2015-11-19T11:47:41.247" Score="1" ViewCount="48" Body="&lt;p&gt;I'm writing a Code for STFT in matlab and I am in the initial stage. Right now I have managed to do the FFT of a small chunk of a time signal. I used zero padding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I am facing is that after FFT there are 3500 bin frequencies. (In total there were 7000, I took half of them). My sampling frequency was 1000. So that equates 1 Bin = 10/35 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I plot the data, I have the bin values in the X-Axis. In this was my Signal seems to have amplitudes in the 421st Bin or 60Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make my X-Axis such that it progresses by 10/35 and shows the spike in the correct place at 60 instead of 421. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="18057" LastActivityDate="2015-11-19T13:30:53.177" Title="Changing Units of Axis" Tags="|fft|sampling|scale-space|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27183" PostTypeId="1" CreationDate="2015-11-19T12:11:42.810" Score="0" ViewCount="1508" Body="&lt;p&gt;I have a school project to be able to move a wheelchair according to user instruction. I am currently starting my project by using MATLAB and I have acquire several data for the training purpose. I am stuck at applying the butterworth filter to the signal, here is a sample of my training data &lt;a href=&quot;https://drive.google.com/file/d/0B4Y0BvHzLaILaUpqeFpjWFV3eFE/view?usp=sharing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;$\tt go10.wav$&lt;/a&gt;. And here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x,Fs] = audioread('go10.wav'); % to read the data&#xA;plot(x) ; % plot the data before aprplying the filter&#xA;n = 3; % the number of order&#xA;beginFreq = 800 / (Fs/2);&#xA;endFreq = 2000 / (Fs/2);&#xA;[b,a] = butter(n, [beginFreq, endFreq], 'bandpass');&#xA;y = filter(b, a, x);&#xA;figure;&#xA;plot(y) ; % plot the data after applying the filter&#xA;p = audioplayer(y,Fs);&#xA;play(p) ; % play the record after applying the filter&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here the plotting result,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mqOVN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mqOVN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Did I do it right? about the begin and end frequency? and is my &lt;code&gt;n&lt;/code&gt; correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And what can you tell me about this butterworth filter? I know that it's trying to focus on the human voice, but what exactly it does?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="18170" LastEditorUserId="13320" LastEditDate="2016-11-13T13:22:26.773" LastActivityDate="2016-11-13T13:22:26.773" Title="Butterworth filter for signal processing" Tags="|filters|speech-recognition|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27184" PostTypeId="1" CreationDate="2015-11-19T12:43:35.687" Score="1" ViewCount="668" Body="&lt;p&gt;Let's say I have the below random signal:&#xA;$ Y[n] = [y(n), y(n-1), y(n-2), \ldots, y(1)] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two random variables now: The first one $X_1 $ which express the maximum eigenvalue of the covariance matrix of $Y$. The second one $X_2$ which express the energy of the random signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question is: Are the two random variables independent or dependent, when whether signal samples $y(n),y(n-1)\ldots$ are IID or correlated with each other?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By intuition the two random variables should be correlated!? Isn't it right!?&lt;/p&gt;&#xA;" OwnerUserId="17951" LastEditorUserId="11256" LastEditDate="2015-11-19T13:51:14.573" LastActivityDate="2015-11-19T15:25:31.307" Title="Relation between Covariance matrix &amp; Energy of a random signal" Tags="|random|covariance|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27186" PostTypeId="2" ParentId="27182" CreationDate="2015-11-19T13:30:53.177" Score="1" Body="&lt;p&gt;Thanks for the clarification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're currently doing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then you should do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(x,y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = linspace(0,1000,length(y));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-19T13:30:53.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27188" PostTypeId="2" ParentId="27180" CreationDate="2015-11-19T13:34:38.280" Score="4" Body="&lt;p&gt;The plot is of $$\mid X\left(i\omega\right) \mid = \sqrt{\left(\frac{1}{a+j\omega}\right)\left(\frac{1}{a-j\omega}\right)} = \frac{1}{\sqrt{a^2 + \omega^2}}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;against $\omega$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular $\omega$ can be equal to $-a$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This checks out with &lt;a href=&quot;http://www.wolframalpha.com/input/?i=%28sqrt%284%2Bx%5E2%29%29%5E-1&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;Wolfram alpha&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="805" LastEditorUserId="8202" LastEditDate="2015-11-19T18:23:53.143" LastActivityDate="2015-11-19T18:23:53.143" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27189" PostTypeId="1" CreationDate="2015-11-19T14:52:32.897" Score="1" ViewCount="670" Body="&lt;p&gt;While studying Laplace transform, I also some questions which I want to understand:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) We used to say that Laplace transform include both real and imaginary part whereas in Fourier transform we only have imaginary part. But when we have to say about convergence we also choose Real part to be either &gt;0  or &amp;lt;0 . I want to know why we ignore imaginary part?   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) If we have any function x(t)  how do we determine that we have to take bilateral integral or unilateral integral. In the above case we have u(t)  with the function so our limits are changed. But if we don't have $u(t)$ function with the exponential like $$ x(t)=e^{at}$$ than how can we select bilateral or unilateral &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: what will be the Laplace Transform of $$f(t) = e^{at}$$ &lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="16293" LastEditDate="2015-11-19T16:48:07.143" LastActivityDate="2022-05-05T13:00:45.190" Title="Questions related to Laplace Transform" Tags="|transform|laplace-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27190" PostTypeId="1" CreationDate="2015-11-19T14:53:25.917" Score="2" ViewCount="802" Body="&lt;p&gt;The spectrogram if generally defined with the squared magnitude of the fft. However, in lots of implementation, it seems that people just use the magnitude without square.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover an audio signal is by convention scale between -1 and 1. This scaling often needs a supplementary step in implementations, in python language for example, which is not always do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, what are best practices to compute an audio spectrogram?&#xA;- square magnitude of the fft / magnitude of the fft ?&#xA;- Integer audio values / scaling (-1 to 1) audio values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the comments tell, these are questions without consequences if the aim is to plot an image of the spectrogram. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to use the matrix of the spectrogram as an entry point for sound analysis and recognition. In this case, the computation process matters and I find curious that the implementations differ so often.&lt;/p&gt;&#xA;" OwnerUserId="18044" LastEditorUserId="18044" LastEditDate="2015-11-20T10:07:54.177" LastActivityDate="2017-12-01T12:31:15.247" Title="What are best practices to compute an audio spectrogram?" Tags="|fft|audio|python|spectrogram|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27191" PostTypeId="2" ParentId="27184" CreationDate="2015-11-19T15:25:31.307" Score="1" Body="&lt;p&gt;I'm not totally sure I understand your question: could you give a concrete example? For instance, what's the randomness? Anyway, here are some relations between the quantities you're interested in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The energy of the signal is $$\mid \mid Y \mid \mid_2^2 = \sum_{i=0}^n y_i^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Auto-correllation matrix $R$ is formed as $YY^T$ (outer product between the signal and it's transpose). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this matrix is symmetric, it's matrix 2-norm is the spectral radius: $$||YY^T||_2^2 = \mathrm{max}|\lambda_j|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to write the 2-norm would be as $$||YY^T||_F^2 = Tr(YY^T)$$ It's fairly stragtforward to prove that $$||* ||_F^2 \geq ||*||_2^2$$ for any matrix, and they co-incide when $YY^T$ has rank 1. It's also true that $$|| * ||_F^2 \leq r|| *|| _2^2 $$ &lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2015-11-19T15:25:31.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27192" PostTypeId="2" ParentId="27189" CreationDate="2015-11-19T15:37:24.047" Score="1" Body="&lt;p&gt;The Fourier transform is the Laplace transform along the imaginary axis in the complex plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convergence of the Laplace transform ignores the complex part, as the imaginary part breaks down the signal into sinusoids: which are bounded, and so have no effect on the convergence.&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2015-11-19T15:37:24.047" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="27193" PostTypeId="2" ParentId="27183" CreationDate="2015-11-19T16:31:13.903" Score="1" Body="&lt;p&gt;First of all when you work with &lt;em&gt;MATLAB&lt;/em&gt; I suggest you to use a time axis &lt;code&gt;t&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x,Fs] = audioread('go10.wav'); % to read the data&#xA;t=(0:length(x)-1)/Fs;&#xA;plot(t,x) ; % Now when you plot you can see the time in seconds&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code seems to be correct. A &lt;code&gt;butterworth&lt;/code&gt; bandpass filter, like others bandpass filter keep only the frequencies in the interval from &lt;code&gt;beginFreq&lt;/code&gt; and &lt;code&gt;endFreq&lt;/code&gt;. It is impossible to make a perfect filter, so there are a lot of filters like &lt;code&gt;bessel&lt;/code&gt;, &lt;code&gt;cebicev&lt;/code&gt;, &lt;code&gt;butterworth&lt;/code&gt;,... each one have some particular properties and the choice of the better filter depends on the application. In &lt;em&gt;sound processing&lt;/em&gt; butterworth filter is quite good. The human voice goes from 100Hz to 1100Hz, if you want to keep the voice in your signal you should change your values to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;beginFreq = 100/ (Fs/2);&#xA;endFreq = 1100/ (Fs/2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A passband filter, like this butterworth, keep only the frequencies in the range you have chosen, so if you have noises in your signal that can't are human voices this filter will remove them. However this filter keeps all noises that have frequency in the vocal range. &lt;/p&gt;&#xA;" OwnerUserId="18294" LastActivityDate="2015-11-19T16:31:13.903" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27194" PostTypeId="1" AcceptedAnswerId="27320" CreationDate="2015-11-19T17:03:10.820" Score="2" ViewCount="748" Body="&lt;p&gt;Reversing spectrum of an audio signal &lt;a href=&quot;https://stackoverflow.com/a/3662378/556876&quot;&gt;is said&lt;/a&gt; to be often used in DSP – i.e. applying a low-pass filter is quite a simple operation, compared to a high-pass. So they shift the specrtum by multiplying each other sample by -1, apply the Low-pass filter and then reverse again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if the same processing technique could be applied to images: reverse frequencies, apply edits/processing, reverse again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Please advice how can a spectrum of a 2D signal be reversed?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it something as simple as each other sample inversion as for a 1D audio signal? I'd prefer some code snippets / visual examples to math equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also wonder if FFT of an image, reversing the frequencies, IFFT, FFT, another reversing, IFFT can be considered lossless to the source image?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Upd.&lt;/strong&gt; I found an amazing github repo &lt;a href=&quot;https://github.com/wellflat/javascript-labs&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;javascript-labs&quot;&lt;/a&gt; containing &lt;a href=&quot;https://github.com/wellflat/javascript-labs/tree/master/cv/fft&quot; rel=&quot;nofollow noreferrer&quot;&gt;FFT / IFFT implementations&lt;/a&gt; in JavaScript. It helped me understand the spectrum inversion better. They just swap quadrants of the FFT image to reverse the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I discovered to myself that a 2D FT can be parallelized into 1D FT's for vertical and horizontal pixel sets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My research goal is to find a reversible transform of a source image &quot;S&quot; to another image &quot;T&quot;, such as that &lt;em&gt;T&lt;/em&gt; carries no visual clues to the content of the original image &lt;em&gt;S&lt;/em&gt;. A transformation that is reversible, and also not dependent on precise pixel-to-pixel correspondence. I.e. it should be possible to recover original image &lt;em&gt;S&lt;/em&gt; after taking a photo of a printed poster with transformed image &lt;em&gt;T&lt;/em&gt; – of course with adequate losses / distortions / color regression. Hypothesis that reversing spectrum of an image would scramble it original content has failed.&lt;/p&gt;&#xA;" OwnerUserId="18361" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-11-26T17:30:07.877" Title="How to reverse frequency spectrum of a 2D image?" Tags="|image-processing|frequency-spectrum|spatial|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27195" PostTypeId="2" ParentId="27178" CreationDate="2015-11-20T01:37:14.507" Score="1" Body="&lt;p&gt;As noted in the following links:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.eetimes.com/document.asp?doc_id=1278096&amp;amp;page_number=2&quot; rel=&quot;nofollow&quot;&gt;http://www.eetimes.com/document.asp?doc_id=1278096&amp;amp;page_number=2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.informit.com/articles/article.aspx?p=1627062&amp;amp;seqNum=3&quot; rel=&quot;nofollow&quot;&gt;http://www.informit.com/articles/article.aspx?p=1627062&amp;amp;seqNum=3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The uplink is a single frequency where the bandwidth depends on the needs of the user (see first link, third paragraph: &quot;The bandwidth of the single carrier is determined based on the required data rate by the user&quot;).&#xA;So in answer to your first question - No, not all users use the same bandwidth.  Different bandwidths for multiple users are part of the specification (see first link: &quot;In the frequency domain, the number of sub-carriers N ranges from 128 to 2048, depending on channel bandwidth with 512 and 1024 for 5 and 10 MHz, respectively, being most commonly used in practice.&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your second question - yes, the base station can serve users of various modes (ie: different FFT sizes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT regarding comment: I'm not sure how resource blocks are assigned, but I'm sure the user is told which ones belong to them - and yes, I believe the sample rates are different depending on the users bandwidth.  As for the clock (from first link): &quot;This results in a sampling rate that's multiple or sub-multiple of the WCDMA chip rate of 3.84 Mcps: LTE parameters have been chosen such that FFT lengths and sampling rates are easily obtained for all operation modes while at the same time ensuring the easy implementation of dual-mode devices with a common clock reference.&quot;&lt;/p&gt;&#xA;" OwnerUserId="14819" LastEditorUserId="14819" LastEditDate="2015-11-20T03:21:00.313" LastActivityDate="2015-11-20T03:21:00.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27197" PostTypeId="2" ParentId="27109" CreationDate="2015-11-20T02:22:44.163" Score="1" Body="&lt;p&gt;Basically, multipath propagation causes time dispersion (hence causing a delay spread ($\sigma_{\tau}$)) and that dispersion influences the fading characteristics of the wireless channel.So delay spread is related to the fading characteristics of a channel and not really to the path loss. Particularly, if $\sigma_{\tau}$ is greater than the symbol period ($T_s$) then the wireless channel is said to be &lt;a href=&quot;https://en.wikipedia.org/wiki/Fading#Selective_fading&quot; rel=&quot;nofollow&quot;&gt;frequency selective&lt;/a&gt;, meaning that a signal will interfere with itself causing additional fading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should also note that the rms delay spread is not the maximum delay that your signal experiences as I think you may asssume, $\sigma_{\tau}$ can be calculated as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sigma_{\tau} = \sqrt{\overline{\tau ^2} - \overline{\tau} ^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\overline{\tau} =  \frac{\Sigma P(\tau _i) \tau _i}{\Sigma P(\tau _i)},$$&#xA;$$\overline{\tau ^2} =  \frac{\Sigma P(\tau _i) \tau _i ^2}{\Sigma P(\tau _i)}$$&#xA;and $P(\tau _i)$ is the power of the component with delay $\tau _i$&lt;/p&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="80" LastEditDate="2015-11-20T12:43:22.367" LastActivityDate="2015-11-20T12:43:22.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27199" PostTypeId="1" CreationDate="2015-11-20T11:15:08.990" Score="1" ViewCount="167" Body="&lt;p&gt;for some reasons I'd like to minimize the secondary lobes of the FFT transform of a rectangular signal (shwon in the upper-left side of picture below)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tkupW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tkupW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;so I've used window function to do that (bottom-left). However, if I want to do it directly on the complex transform of the signal (bottom-right), the values of attenuation of secondary lobe aren't the same as the temporal case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having the test code below, I'd like to know what is wrong with it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;pass to the EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     Fs = 1000; L = 2000; t = (0:L-1)*1/Fs;  &#xA;% the signal&#xA;y = zeros(1,L);  y(500:1500) = 1;     % rectangle signal&#xA;&#xA;figure; &#xA;subplot(2,2,1);&#xA;plot(Fs*t,y); title('Temporal signal'); xlabel('time (milliseconds)')&#xA;&#xA;NFFT = 6*2^nextpow2(L);&#xA;Y1 = 2*abs(fft(y,NFFT)); Y1 = Y1/max(Y1);&#xA;f = 0:Fs/NFFT:Fs/2;&#xA;&#xA;% the FFT of the signal&#xA;subplot(2,2,2);&#xA;semilogy(f, Y1(1:NFFT/2+1), '.-'); axis tight; grid on;&#xA;title('Signal''s spectrum'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|');&#xA;&#xA;w = window(@blackman, L);&#xA;y1 = y.*w';&#xA;Y2 = 2*abs(fft(y1,NFFT)); Y2 = Y2/max(Y2);&#xA;&#xA;% the FFT of the windowed signal, in time&#xA;subplot(2,2,3);&#xA;semilogy(f, Y2(1:NFFT/2+1), '.-'); axis tight; grid on;&#xA;title('FFT windowing - temporal product'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|')&#xA;&#xA;% the FFT of the windowed signal, in complex&#xA;Y3 = 2*abs(fftshift(conv(Y1, fft(w,NFFT), 'same'))); Y3 = Y3/max(Y3);&#xA;subplot(2,2,4);&#xA;semilogy(f, Y3(1:NFFT/2+1), '.-');  axis tight; grid on;&#xA;title('FFT windowing - spectral convolution'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&lt;br&gt;&#xA;I've changed the code according to @Matt's remarks, but still there is a problem to the last graph (the noise on the convolutions of the FFTs)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NFFT = 6*2^nextpow2(L);&#xA;Y1 = fft(y,NFFT);&#xA;YY1 = 2*abs(Y1); YY1 = YY1/max(YY1);&#xA;f = 0:Fs/NFFT:Fs/2;&#xA;&#xA;% the FFT of the signal&#xA;subplot(2,2,2);&#xA;semilogy(f, YY1(1:NFFT/2+1), '.-'); axis tight; grid on;&#xA;title('Signal''s spectrum'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|');&#xA;&#xA;w = window(@blackman, L);&#xA;y1 = y.*w';&#xA;YY2 = 2*abs(fft(y1,NFFT)); YY2 = YY2/max(YY2);&#xA;&#xA;% the FFT of the windowed signal, in time&#xA;subplot(2,2,3);&#xA;semilogy(f, YY2(1:NFFT/2+1), '.-'); axis tight; grid on;&#xA;title('FFT windowing - temporal product'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|')&#xA;&#xA;% the FFT of the windowed signal, in complex&#xA;YY3 = 2*abs(cconv(Y1, fft(w,NFFT)', NFFT)); YY3 = YY3/max(YY3);&#xA;subplot(2,2,4);&#xA;semilogy(f, YY3(1:NFFT/2+1), '.-');  axis tight; grid on;&#xA;title('FFT windowing - spectral convolution'); xlabel('Frequency (Hz)'); ylabel('|Y(f)|')'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q1xQc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q1xQc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18376" LastEditorUserId="18376" LastEditDate="2015-11-20T17:14:35.830" LastActivityDate="2015-11-20T17:14:35.830" Title="Minimizing sinc spectral lobes" Tags="|fft|discrete-signals|convolution|window-functions|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27200" PostTypeId="2" ParentId="27199" CreationDate="2015-11-20T11:35:20.017" Score="3" Body="&lt;p&gt;Multiplication of two time domain sequences corresponds to cyclic (circular) convolution of the DFTs of the two sequences, not to linear convolution as implemented in your code. So if $x[n]$ and $y[n]$ are two length $N$ time domain sequences, and $X[k]$ and $Y[k]$ are their respective DFTs, the following correspondence holds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{DFT}_N\left\{x[n]\cdot y[n]\right\}[k]= \frac{1}{N}\sum_{m=0}^{N-1}X[m]Y[(k-m)_N],\quad 0\le k \le N-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(k-m)_N=k-m+lN$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the integer $l$ chosen such that the result is in the range $[0,N-1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also take a look at &lt;a href=&quot;https://dsp.stackexchange.com/questions/26937/sampling-thorem-convolution-in-frequency-domain-complex-math-question/26952#26952&quot;&gt;this answer&lt;/a&gt; to a related question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; You also can't use &lt;code&gt;Y1&lt;/code&gt; in the convolution because it is not the DFT but the &lt;em&gt;magnitude&lt;/em&gt; of the DFT. You should circularly convolve &lt;code&gt;fft(y)&lt;/code&gt; with &lt;code&gt;fft(w)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-11-20T13:11:15.063" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27201" PostTypeId="1" CreationDate="2015-11-20T14:06:52.560" Score="0" ViewCount="729" Body="&lt;p&gt;I'm tring to code a STFT program in Matlab. I got results but I'm confused a bit.&#xA;I have a audio signal of 900000 pts sampled at 1000Hz (15 min signal). &#xA;I've taken fft with following parameters =&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;hop size of H = 1400 pts            &lt;/li&gt;&#xA;&lt;li&gt;the window length M = H * 6&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, 5/6 of the window overlaps with the next one. &#xA;The program runs for 637 iterations, as (637*1400 + M = 900200)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I get a 637 pt vector with frequency in them. I should get a frequency vs time plot. But it only has 637 frequency bins, for a signal of 900000 time sample. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How, can I find the change of frequency with Time (900000 sample) or&#xA;15 min?&lt;/li&gt;&#xA;&lt;li&gt;Moreover, how does changing the window length and overlap affect the outcome of STFT? The code is below.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%hop size&#xA;L = 1400;&#xA;&#xA;%window length &amp;amp; Formation&#xA;D = 6;                        %User Defined Parameter in Cooper's paper &#xA;M = L*D;                             &#xA;w = hanning(M, 'periodic');    %window formation&#xA;&#xA;k = 1; % k =index&#xA;j = 1; % j =result vector index  &#xA;while k + M &amp;lt;= xlen&#xA;&#xA;  %data chunk&#xA;  %x = x(k:1400);&#xA;&#xA;  %window length &amp;amp; Window&#xA;  xw = x(k+1:k+M) .*w;                  %windowed signal&#xA;&#xA;  %zero padding&#xA;  b = 5;                           %Zero Padding Factor 'b'&#xA;  xw = [xw; zeros(M*5,1)];&#xA;  [nft,c] = size(xw);&#xA;&#xA;  %plot(abs(fft(xw)))&#xA;  X = abs(fft(xw));&#xA;  XF = X(1:length(X)/2);&#xA;  [q,ind] = max(XF);&#xA;  v(j) = ((fs/2)/(nft/2)) * (ind-1);  %convert Bin to frequency &#xA;  k = k+L;&#xA;  j = j+1;&#xA;end&#xA;&#xA;figure(1);&#xA;plot(v)&#xA;axis([0 1400 0 100])&#xA;&#xA;figure(2);   %zoom version&#xA;plot(v)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="18057" LastEditorUserId="4346" LastEditDate="2016-07-19T02:12:13.450" LastActivityDate="2016-08-18T02:56:37.797" Title="How do I get the Time information after STFT?" Tags="|fft|frequency-spectrum|stft|resolution|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27203" PostTypeId="2" ParentId="27201" CreationDate="2015-11-20T17:22:46.363" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How, can I find the change of frequency with Time (900000 sample) or 15 min?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;OK, so you need 900000 frequencies.  Well, one way to do that is to take each element of your 637 length vector and expand it to (up to) $H$ samples.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Moreover, how does changing the window length and overlap affect the outcome of STFT? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The longer the window length, the better the frequency resolution is. The shorter the length, the worse the frequency resolution will be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before we can answer your question, we will need to know what form your signal takes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's a single tone in noise, then you may be able to use &lt;a href=&quot;https://sites.google.com/site/kootsoop/frequency-algorithms&quot; rel=&quot;nofollow&quot;&gt;one of these&lt;/a&gt; or &lt;a href=&quot;http://www.ericjacobsen.org/fe.htm&quot; rel=&quot;nofollow&quot;&gt;one of these&lt;/a&gt; or &lt;a href=&quot;http://www.ericjacobsen.org/fe2/fe2.htm&quot; rel=&quot;nofollow&quot;&gt;this approach&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-20T17:22:46.363" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27204" PostTypeId="1" AcceptedAnswerId="27319" CreationDate="2015-11-20T18:04:19.557" Score="3" ViewCount="741" Body="&lt;p&gt;I'm trying to implement image downscaling using a triangle filter (it's narrow therefore fast, and goes hand in hand with linear interpolation when upscaling), and the triangle function used for filtering has a span proportional to the downscaling ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2RMEO.png&quot; alt=&quot;artifacts&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alas when the ratio is non-integer, grid artifacts appear (as shown above) on the downscaled image. The following plot shows what happens with the way triangles for each pixel of the input image overlap and add up in those cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wSG4X.gif&quot; alt=&quot;plot&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what I should do to fix/work around this, but I'm sure this problem must have been encountered by others before (Google was no help).&lt;/p&gt;&#xA;" OwnerUserId="18381" LastActivityDate="2015-11-26T12:54:12.403" Title="Triangle-kernel filtering problems at non-integer ratios" Tags="|image-processing|filters|downsampling|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27205" PostTypeId="1" AcceptedAnswerId="27211" CreationDate="2015-11-20T18:29:43.307" Score="0" ViewCount="1608" Body="&lt;p&gt;I would like to see the constellation diagram after equalization as shown in the website &lt;a href=&quot;http://www.raymaps.com/index.php/m-qam-bit-error-rate-in-rayleigh-fading/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Correct constellation for QAM&lt;/a&gt;. But I am getting a different plot. Can somebody please tell me where I am going wrong? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FrJjj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FrJjj.jpg&quot; alt=&quot;after equalization&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="750" LastEditorUserId="750" LastEditDate="2015-11-23T04:03:47.003" LastActivityDate="2015-11-23T04:03:47.003" Title="Matlab : Help in getting the correct constellation diagram for QAM modulation" Tags="|matlab|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27206" PostTypeId="1" CreationDate="2015-11-20T18:51:08.610" Score="3" ViewCount="5474" Body="&lt;p&gt;my question is about the Z- transform. My first question is what the title says. &lt;strong&gt;What does 'Z' in Z-transform represent ?&lt;/strong&gt; Say in Fourier transform, 'w' (omega) represents frequency ? From Fourier transform, I can know what is the strength of the signal at a certain frequency component, right? Then &lt;strong&gt;what idea do I get from Z-transform ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, in Fourier transform, we can draw a graph with x-axis as the frequency and y-axis as the amplitude of a certain frequency component. &lt;strong&gt;Can we do the same for Z-transform, with x-axis as the different 'Z' values and y axis as the Z-transform for a particular Z ?&lt;/strong&gt;  My textbook says only about equations, but I don't get the significance of 'Z' in  Z-transform. And about the graph thing, I haven't encountered any such graph in any textbook, only the Z-plane.&lt;/p&gt;&#xA;" OwnerUserId="17687" LastEditorUserId="17687" LastEditDate="2015-11-20T20:18:01.510" LastActivityDate="2015-11-22T10:54:49.087" Title="What does 'z' in Z-transform represent ? Is it frequency or something else?" Tags="|z-transform|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27208" PostTypeId="2" ParentId="27201" CreationDate="2015-11-20T18:57:57.517" Score="0" Body="&lt;p&gt;You could interpolate your low sample rate of STFT results (1/1.4 Hz) to the higher sample rate (1 kHz).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-11-20T18:57:57.517" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27209" PostTypeId="2" ParentId="27206" CreationDate="2015-11-20T20:41:46.530" Score="2" Body="&lt;p&gt;the Z transform is the Laplace transform applied to an ideally and uniformly sampled signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \mathcal{Z} \left\{ x[n] \right\} \Bigg|_{z=e^{sT}} = \mathcal{L} \left\{ x_\text{s}(t) \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$   \begin{align}&#xA;x_\text{s}(t) &amp;amp; \triangleq x(t) \sum_n \ \delta(t - nT) \\&#xA;&amp;amp; = \sum_n x(t) \ \delta(t - nT) \\&#xA;&amp;amp; = \sum_n x(nT) \ \delta(t - nT) \\&#xA;&amp;amp; =  \sum_n x[n] \ \delta(t - nT) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T$, of course, is the sampling period in the same units as continuous-time $t$.  and $T = \frac{1}{f_\text{s}}$ where $f_\text{s}$ is the sample rate.  and, by definition, $x[n] \triangleq x(nT)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you evaluate $z$ at $e^{j \omega}$, you will get information relevant to frequency just as in the Laplace transform if you evaluate $s$ at $j\Omega$.  the significance of &quot;$z$&quot; to the Z transform is the same as the significance of &quot;$s$&quot; is to the Laplace transform.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2015-11-20T20:49:32.653" LastActivityDate="2015-11-20T20:49:32.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27210" PostTypeId="1" AcceptedAnswerId="27215" CreationDate="2015-11-20T21:32:38.790" Score="0" ViewCount="1427" Body="&lt;p&gt;I have a time series of acceleration sampled at 1000Hz to capture random impacts on a structure. The ringing of the structure (not of interest) produces noise which a 50Hz filter seems to eliminate while preserving the impulses' amplitude and width. I'd like to downsample the filtered data to reduce data volume. What is the minimum sample rate I could choose? Based on &lt;a href=&quot;http://www.wescottdesign.com/articles/Sampling/sampling.pdf&quot; rel=&quot;nofollow&quot;&gt;this article&lt;/a&gt;, I should choose a sample frequency higher than 2*50Hz (Nyquist) since 50Hz is just the filter cutoff and there is still energy at higher frequencies that I don't want to alias. Is 10*50Hz = 500Hz reasonable?&lt;/p&gt;&#xA;" OwnerUserId="18384" LastActivityDate="2015-11-20T22:14:31.660" Title="Choosing minimum sampling frequency of a filtered signal" Tags="|sampling|lowpass-filter|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27211" PostTypeId="2" ParentId="27205" CreationDate="2015-11-20T21:39:35.080" Score="2" Body="&lt;p&gt;You are getting the correct constellation. You need to remember that you added noise to your symbols in the channel, So, you won't get a perfect constellation as you have in the first figure. Try increasing SNR (EbNo) and you will see better the constellation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bva7g.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bva7g.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2015-11-20T21:39:35.080" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27212" PostTypeId="1" AcceptedAnswerId="27444" CreationDate="2015-11-20T22:11:07.247" Score="1" ViewCount="93" Body="&lt;p&gt;Are there any statistical concerns with using a running-window maximum to capture peak values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background: We are measuring acceleration during random impacts on a structure. The impacts need ~500Hz sampling to resolve, but due to data volume I can only permanently save a 10Hz data vector. One workaround is to record a running window maximum since I am most interested in peak accelerations during impacts, and how often impacts occur. Are there any statistical concerns (bias, accuracy) about using a running-window maximum?&lt;/p&gt;&#xA;" OwnerUserId="18384" LastEditorUserId="18384" LastEditDate="2015-12-01T22:26:21.927" LastActivityDate="2015-12-02T02:23:51.717" Title="Running window maximum: Any cautions?" Tags="|window-functions|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27213" PostTypeId="1" AcceptedAnswerId="27218" CreationDate="2015-11-20T22:13:04.927" Score="3" ViewCount="6014" Body="&lt;p&gt;I'm plotting the FFT power-spectrum of a signal in MATLAB.&#xA;I uploaded the 8000 samples time-series signal in a text file here:&#xA;&lt;a href=&quot;http://wikisend.com/download/896484/signal.txt&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://wikisend.com/download/896484/signal.txt&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 500; % sampling frequency&#xA;L = length(y); %number of samples&#xA;&#xA;complex = fft(y)/L; % complex signals&#xA;f = 0 : Fs/L : Fs/2; % frequency bins&#xA;amplitude = 2*abs(complex(1:L/2+1)); % amplitudes&#xA;pow = (amplitude).^2/2; % power&#xA;&#xA;semilogy(f,pow,'-ro');&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I'm having the following plot:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Qlb0S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qlb0S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The confusion is, where I work they are using their own modified FFT function and if I run that code I obtain the following plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vcp8x.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vcp8x.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you check the power in above figures the linear power ratio is 16 between my code and their's. And for other measurement I'm getting the ratio 60, 120 or even 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused and need help if one can plot FFT for me and see if my code and plot correct. &lt;/p&gt;&#xA;" OwnerUserId="7555" LastEditorUserId="4298" LastEditDate="2015-11-21T21:36:22.600" LastActivityDate="2022-08-12T13:17:37.680" Title="Power spectrum estimate from FFT" Tags="|fft|dft|power-spectral-density|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27214" PostTypeId="2" ParentId="27206" CreationDate="2015-11-20T22:13:16.390" Score="3" Body="&lt;p&gt;The Fourier transform doesn't exist for every signal. For example, there is not a Fourier Transform of the signal $ (2)^{n} u(n) $. So, in order to get an useful toll for this signals, you can multiply the signal for a sequence $ r^{-n} $ in order to make it decay fast enough to converge:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(\omega) = \sum_{n=-\infty}^{\infty}{[x(n)r^{-n}]e^{-j \omega n}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(\omega) = \sum_{n=-\infty}^{\infty}{x(n)(re^{j \omega})^{-n}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, we can make $ z = re^{j \omega} $. So, in this case, z is a complex value that can be understood as a complex frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important to verify each values of $ r $ the sum above converges. These values are called the Region of Convergence (ROC) of the Z transform. The z transform is equal to the Fourier transform when $ r = 1 $, but the Fourier transform will only exist if $ r = 1 $ is inside the ROC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As $ z $ is a complex variable, you can't plot it in a Cartesian graph as you said. You will need to plot an 3D graph where x-axis and y-axis contain the real and imaginary values of $ z $, and the z-axis the values of the z-transform. I don't know if there is a real utility for a graph like that in any application, and that's why it is not common to see this graph. Normally, the z-plane is enough.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="4298" LastEditDate="2015-11-22T10:54:49.087" LastActivityDate="2015-11-22T10:54:49.087" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27215" PostTypeId="2" ParentId="27210" CreationDate="2015-11-20T22:14:31.660" Score="1" Body="&lt;p&gt;As you say, you should select a sampling frequency at least at twice the largest frequency you wish to keep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you'll do is called &lt;em&gt;downsampling&lt;/em&gt;: going from a higher to a lower sampling frequency. This process usually starts by filtering, so there is no energy above the new Nyquist frequency, and any aliasing is negligible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many numerical programs, such as Matlab, include the filtering step in commands such as &lt;code&gt;downsample&lt;/code&gt; and &lt;code&gt;resample&lt;/code&gt;. In any case, you should always look at the spectrum before and after downsampling, and make sure the process meets your requirements.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-11-20T22:14:31.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27216" PostTypeId="1" CreationDate="2015-11-21T10:57:13.840" Score="1" ViewCount="16" Body="&lt;p&gt;I am looking for any kind of information about the acoustic characteristics of the thoracic diaphragm. In particular, I'm looking for characteristics which will allow to differentiate it from other muscles using ultrasound, MRI, CT, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References to the literature are especially welcome.&lt;/p&gt;&#xA;" OwnerUserId="18390" LastActivityDate="2015-11-21T10:57:13.840" Title="Acoustic characteristics of thoracic diaphragm" Tags="|image-processing|acoustics|ultrasound|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27218" PostTypeId="2" ParentId="27213" CreationDate="2015-11-21T13:54:28.807" Score="5" Body="&lt;p&gt;The difference is in the scaling of the power spectrum. I suppose you will find that the difference in scaling always equals &lt;span class=&quot;math-container&quot;&gt;$L/F_s$&lt;/span&gt;, which for the numbers in your question is indeed &lt;span class=&quot;math-container&quot;&gt;$8000/500=16$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Take a look at &lt;a href=&quot;https://mathworks.com/help/signal/ug/power-spectral-density-estimates-using-fft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Power Spectral Density Estimates Using FFT&lt;/a&gt; for the correct scaling. If you normalize the FFT result by the FFT length, you need to scale the squared magnitude of the normalized FFT by &lt;span class=&quot;math-container&quot;&gt;$L/F_s$&lt;/span&gt;. Furthermore, you need a factor of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; if you throw away the negative frequencies (I see you did that). Note, however, that you shouldn't apply a factor of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; for the bins at DC and at Nyquist, because they are not mirrored at negative frequencies.&lt;/p&gt;&#xA;&lt;p&gt;Here is a simple Matlab code from the above quoted Mathworks page for computing a periodogram-based one-sided power spectrum estimate using the FFT (my comments):&lt;/p&gt;&#xA;&lt;pre&gt;&#xA;Fs = 1000;                          % sampling frequency (Hz)&#xA;N = length(x);                      % even! (=&gt; bin N/2+1 is Nyquist)&#xA;xdft = fft(x);&#xA;xdft = xdft(1:N/2+1);               % DC to Nyquist (one-sided)&#xA;psdx = (1/(Fs*N)) * abs(xdft).^2;   % periodogram scaling&#xA;psdx(2:end-1) = 2*psdx(2:end-1);    % scaling for one-sided PSD&#xA;                                    % note: no factor 2 at DC and Nyquist&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="7092" LastEditDate="2022-08-12T13:17:37.680" LastActivityDate="2022-08-12T13:17:37.680" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="27219" PostTypeId="1" CreationDate="2015-11-21T14:28:33.607" Score="2" ViewCount="111" Body="&lt;p&gt;I have very general system. I don't know whether it is electrical or mechanical or whatever. This system can be modeled by the following differential equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dot q = \frac{Tf_1-f_2}{T+1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$\dot q$ would be equivalent to current in an electrical system&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$f_1$ and $f_2$ would be equivalent to current sources &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$T$ is a given constant&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From what I see, if $f_1$ and $f_2$ are constant, there is no way for $\dot q$ to change. How is it possible that this system has a state space representation? And how do I get this state space representation?&lt;/p&gt;&#xA;" OwnerUserId="4158" LastEditorUserId="21075" LastEditDate="2018-01-16T13:00:52.043" LastActivityDate="2018-06-15T16:50:35.997" Title="State space equation from differential equation" Tags="|state-space|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27221" PostTypeId="1" AcceptedAnswerId="27223" CreationDate="2015-11-21T21:45:04.250" Score="0" ViewCount="4970" Body="&lt;p&gt;I'm doing some MIR related work with stereo audio and am a little unsure on how to proceed with some basic tasks.  All my academic work prior to this has involved forcing audio to &quot;mono&quot; to perform analysis, and I'm trying to avoid that as much as possible here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for example, I have a crest factor function in python that looks like this for an array of audio data (either mono, left, or right channel):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def get_cf(data, win_size):&#xA;    &quot;&quot;&quot;&#xA;    data: audio array in mono, left, or right channel only&#xA;    win_size: size in samples for the block analysis (created in calc_crest_factor)&#xA;&#xA;    calc_crest_factor passes mono style data to this function to get the crest factor.&#xA;&#xA;    returns: the crest factor for each window&quot;&quot;&quot;&#xA;    # Buffer the signal matrix-style (input, block-size, hop-size)&#xA;    data_matrix = librosa.util.frame(data, win_size, win_size)&#xA;&#xA;    peaks = np.amax(np.absolute(data_matrix), axis=0)&#xA;&#xA;    # Get the mean-square over each window&#xA;    RMS = np.sqrt(np.mean(np.square(data_matrix), axis=0))&#xA;&#xA;    # Get crest factor for each window&#xA;    return np.divide(peaks, RMS)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In another function, I call the function above like so for stereo audio:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; if len(data) == 2:&#xA;    crest_factor_l = get_cf(data[0,:], win_size)&#xA;    crest_factor_r = get_cf(data[1,:], win_size)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here I now have a crest factor for the right channel and one for the left channel, but am unsure on how to proceed on getting a final &quot;crest factor&quot; value for the audio.  Do I just choose the greater of the two values for each window?  Or is it more correct to keep both values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This same question goes for RMS too.  I know in my pro audio applications, stereo audio gets passed to some RMS calculator and a single value gets pumped out.  How do the two separate channels with two separate values for either Crest Factor or RMS become 1 value while honoring the &quot;stereoness&quot; of the data?&lt;/p&gt;&#xA;" OwnerUserId="14863" LastEditorUserId="4298" LastEditDate="2015-11-23T12:12:20.973" LastActivityDate="2023-10-20T23:27:35.833" Title="Calculating RMS/Crest Factor for a Stereo Signal" Tags="|signal-analysis|audio|python|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27222" PostTypeId="1" CreationDate="2015-11-22T00:23:22.207" Score="1" ViewCount="459" Body="&lt;p&gt;I would like to implement a filter in the time domain based on a desired frequency response that changes over time. The initial goal is a bandpass filter with a time-varying center frequency, where the bandpass filter has a shape that is defined in the frequency domain. I will illustrate with a simple example.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KcbJW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KcbJW.png&quot; alt=&quot;starting and ending bandpass filters&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here we have 2 gaussians, one centered at 1000Hz and the second centered at 8000Hz. I would like to design a filter in the time domain that can perform a linear sweep between these 2 center frequencies for some fixed duration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way of stating this is that I would like to be able to do the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Define a shape for a bandpass filter in the frequency domain for timepoints 1 and 2&lt;/li&gt;&#xA;&lt;li&gt;Define the morph between the filter shapes at the 2 timepoints (in the example the shape is constant and it is only center frequency that varies)&lt;/li&gt;&#xA;&lt;li&gt;Given that desired frequency domain information and a duration, I want to design a time-varying time domain filter.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I understand that the resulting filter will have time-varying coefficients. It is okay if the frequency response does not exactly match what I have outlined in the frequency domain as long as it is close. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for strategies to approach this type of problem, although if the solutions are highly dependent on the shape of the filter in the frequency domain, then a strategy to solve the provided example would be a helpful starting point. &lt;/p&gt;&#xA;" OwnerUserId="18399" LastEditorUserId="18399" LastEditDate="2015-11-22T02:13:28.257" LastActivityDate="2015-11-22T02:13:28.257" Title="Time-domain filtering to match a target time-varying frequency response" Tags="|filters|filter-design|digital-filters|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27223" PostTypeId="2" ParentId="27221" CreationDate="2015-11-22T14:41:13.923" Score="2" Body="&lt;p&gt;Conceptually you can think of it as creating one mono signal by concatenating the left and the right channel signals, and then computing the RMS and the Crest factor of that mono signal. With $N$ the number of samples in the current frame, and $x_l[n]$ and $x_r[n]$ the left and right channel signals, respectively, you get the following formulas:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}x_{\text{rms}}&amp;amp;=\sqrt{\frac{1}{2N}\left[\sum_{n=0}^{N-1}x^2_l[n]+\sum_{n=0}^{N-1}x^2_r[n]\right]}=\sqrt{\frac12\left(x^2_{l,\text{rms}}+x^2_{r,\text{rms}}\right)}\\&#xA;C&amp;amp;=\frac{\max\{|x_l[n]|,|x_r[n]|\}}{x_{\text{rms}}}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x_{l,\text{rms}}$ and $x_{r,\text{rms}}$ are the RMS values of the left and right channel, respectively.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-22T14:41:13.923" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27225" PostTypeId="1" CreationDate="2015-11-22T18:10:54.387" Score="1" ViewCount="85" Body="&lt;p&gt;Consider $g(x)=\sum_{k=0}^{p}a_kx^{k}$, and let $\{\tau_1,\tau_2,\cdots,\tau_p\}\in\mathbb{C}$ be the roots of $g(x)$. What is the relation between how $\{a_0,a_1,\cdots,a_p\}$ are distributed (in amplitude values) and the magnitude of roots of $g(x)$?&#xA;Is there a condition on amplitude distribution of $a_k$s and degree $p$ which can aid in making all the roots to lie inside the unit circle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example: Below plot shows roots of 1000 polynomials each for degree $p = 5,10,20,50,100$ in $g(x)$ above {depicted in 'r.','g.','b.','k.' colours, respectively}. In each trial p+1 random numbers are drawn from Normal distribution $\mathcal{N}(0,1)$. [Right sub-plot]: The random numbers are assigned as $a_k$s. [Left sub-plot]: The random numbers are sorted in descending order and assigned as $a_k$s such that $a_{k-1}&amp;lt;a_k$. In the Left sub-plot, roots tend to move towards unit circle specifically for higher degrees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/A9Y5Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A9Y5Y.png&quot; alt=&quot;Plot showing the roots of the 1000 polynomials. In each trial the d+1 random numbers are drawn from Normal distribution N(0,1). [Right]: The random numbers are assigned as $a_k$s. [Left]: The random numbers are sorted in descending order and assigned as $a_k$s such that $a_{k-1}&amp;lt;a_k$&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4342" LastEditorUserId="4342" LastEditDate="2015-11-22T18:18:40.007" LastActivityDate="2015-11-22T18:18:40.007" Title="Relation of roots of a polynomial to amplitude distribution of its coefficients" Tags="|discrete-signals|filter-design|poles-zeros|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="27229" PostTypeId="1" AcceptedAnswerId="27238" CreationDate="2015-11-23T06:46:20.537" Score="0" ViewCount="118" Body="&lt;p&gt;I am trying to learn various learning algorithms used in training of neural network. When plotting the Mean Square Error in dB with respect to the number of iterations, if the points are around 0 dB then can we say that the curve converges or does the points need to go to minus dB? If the curve goes towards minus dB with the increase in iterations, then what can be inferred? How good or bad is the technique?&lt;/p&gt;&#xA;" OwnerUserId="780" LastActivityDate="2015-11-23T20:01:01.990" Title="Interpretation of Convergence plot in terms of mean square error" Tags="|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27230" PostTypeId="1" AcceptedAnswerId="27235" CreationDate="2015-11-23T07:18:17.437" Score="2" ViewCount="102" Body="&lt;p&gt;There are several functions for which we know that Fourier Transform will exist but still we calculate its Laplace Transform. Can I know the reason why we need to take Laplace transform for which we know its convergence?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="18359" LastEditorUserId="4298" LastEditDate="2018-07-20T20:46:46.640" LastActivityDate="2018-07-20T20:46:46.640" Title="Why we take Laplace Transform of functions which converged using Fourier Transform" Tags="|fourier-transform|transform|laplace-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27231" PostTypeId="1" AcceptedAnswerId="27240" CreationDate="2015-11-23T08:54:44.773" Score="0" ViewCount="409" Body="&lt;p&gt;I am sorry if I say any thing silly. I have a vector x below and trying to implement correlation with itself (lets say &lt;code&gt;x2&lt;/code&gt;) in Simulink, but getting error. I am getting all zeros in result of my output vector. Kindly can some one please help me out in it. Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ts=1*10^-9;&#xA;t=0*10^-9:ts:150*10^-9;&#xA;fc=1*10^6;&#xA;yi=154*10^-9:ts:2000*10^-9;&#xA;y=yi*0;&#xA;xi=2*sin(2*pi*fc*t);&#xA;x=[xi y];&#xA;x2=x;&#xA;z=xcorr(x2,x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17286" LastEditorUserId="13320" LastEditDate="2016-11-13T13:25:21.837" LastActivityDate="2016-11-13T13:25:21.837" Title="Can anyone help with cross correlation error in Simulink?" Tags="|matlab|cross-correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27233" PostTypeId="1" CreationDate="2015-11-23T09:40:26.867" Score="0" ViewCount="47" Body="&lt;p&gt;I have two colored lines, which can be thought of as functions I1,I2:[0,1]-&gt;R. I want to check whether I1 and I2 'topologically' represent the same object. In other words, if I stretch some parts of I1 and squeeze some other parts, I want to get I2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously they have to have the same colors and 'in the same order'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a metric that measures this kind of similarity?&lt;/p&gt;&#xA;" OwnerUserId="18412" LastActivityDate="2016-07-12T09:31:32.507" Title="Comparing two colored lines" Tags="|image-processing|distance-metrics|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27234" PostTypeId="2" ParentId="27230" CreationDate="2015-11-23T10:19:57.873" Score="0" Body="&lt;p&gt;As I understand (I'm newb in the spectral analysis), using of Laplace Transform is a good idea if you are going to analyze transient signals, because it uses damped exponents as basis. &lt;/p&gt;&#xA;" OwnerUserId="16154" LastActivityDate="2015-11-23T10:19:57.873" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27235" PostTypeId="2" ParentId="27230" CreationDate="2015-11-23T12:05:53.193" Score="1" Body="&lt;p&gt;There is a large class of functions for which both the Fourier transform and the Laplace transform exist, and for which one can be obtained from the other by setting $s=j\omega$. (Note that even when both exist, the latter need not be the case). So for this class of functions, obtaining the Laplace transform from the Fourier transform (or vice versa) does not require any additional work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: $$\begin{align}x(t)&amp;amp;=e^{-at}u(t),\quad a&amp;gt;0\\&#xA;\text{Fourier transform:}\quad X(j\omega)&amp;amp;=\frac{1}{j\omega +a}\\&#xA;\text{Laplace transform:}\quad X(s)&amp;amp;=\frac{1}{s +a},\quad |s|&amp;gt; -a\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the Laplace transform offers is a description in the complex $s$-plane, such as poles and zeros of transfer functions, from which many system properties can be easily deduced. The Fourier transform only shows the behavior on the frequency axis (i.e., the spectrum).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-23T12:05:53.193" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27237" PostTypeId="1" CreationDate="2015-11-23T13:36:47.970" Score="0" ViewCount="152" Body="&lt;p&gt;&lt;em&gt;Not sure this is the right place to ask, but I hope so.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Context&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;A GPS receptor is installed in a moving vehicle, and saves the measured positions with a resolution of at most $r_0$ to a small (a few dozen positions) buffer. The buffer is small due to memory limitations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The buffer is kept as empty as possible while the vehicle is connected to a network. However, the network coverage has several gaps large enough to allow the buffer to be filled. As a result, positions measured after the buffer is filled are currently thrown away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This causes our main use case, which is to display and analyse routes, to present large jumps between the edges of a network shadow zone. It would be better if the positions in or close to the shadow zone are saved in a smaller resolution than not at all.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Specifics&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;So the current approach is to downsample the buffer when it's full, in ordere to make more room for new positions. Since the sampling rate across the buffer is not constant, we just find the chunk which has the highest resolution and cut an element of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this happens in real-time, the downsampling is causal (we only know the past points), and thus selecting the best point in this buffer is not looking trivial (to me at least).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; are there general methods for this problem or should I continue via the ad hoc approach?&lt;/p&gt;&#xA;" OwnerUserId="13433" LastActivityDate="2015-11-23T13:36:47.970" Title="Causal downsampling of a small buffer of GPS positions" Tags="|downsampling|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27238" PostTypeId="2" ParentId="27229" CreationDate="2015-11-23T14:12:25.180" Score="2" Body="&lt;p&gt;0 dB corresponds to a MSE of 1. So, if your method gives MSE that approaches 0 dB as the number of iterations increases, then your method has an &lt;em&gt;error floor;&lt;/em&gt; it cannot drive the MSE to any value smaller than 1 no matter how many iterations it takes (or how many data points you have) etc. A &lt;em&gt;good&lt;/em&gt; method should drive the MSE to 0 (corresponding to $-\infty$ dB), that is, the MSE should decrease continually as the number of iterations increases, and not saturate at a value of 1 (0 dB). We can then argue as to whether the approach to 0 MSE ($-\infty$ dB) is &lt;em&gt;exponential&lt;/em&gt; (MSE $= O(e^{-n})$) or &lt;em&gt;polynomial&lt;/em&gt; (MSE $= O(n^{-k})$) including as special cases &lt;em&gt;quadratic&lt;/em&gt; (MSE $=O(n^{-2})$) and&#xA;&lt;em&gt;linear&lt;/em&gt; (MSE $= O(n^{-1})$), or &lt;em&gt;sublinear&lt;/em&gt; &#xA;(e.g., MSE $= O(n^{-1/2})$ or MSE $= O((\ln n)^{-1})$ or similar)&#xA;where $n$ is the number of iterations (or number of data points).&#xA;Naturally, the faster the decrease, the better (and usually&#xA;more expensive) the method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if the MSE of the best currently&#xA;known method is approaching&#xA;an error floor of 0 dB, there is a fantastic research opportunity (and&#xA;possibly a get-rich-quick opportunity too): devise a method that&#xA;drives the MSE to 0 instead of 1 and gain instant fame &#xA;(and if you patent the method and found a start-up company&#xA;to further develop it, possibly fortune RSN as well).&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2015-11-23T20:01:01.990" LastActivityDate="2015-11-23T20:01:01.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27240" PostTypeId="2" ParentId="27231" CreationDate="2015-11-23T17:07:57.400" Score="2" Body="&lt;p&gt;The edited code in your question should not result in an all-zero vector. Of course, since &lt;code&gt;x&lt;/code&gt; contains many zeros, the autocorrelation also has many zeros, but it's non-zero in its center portion (i.e., around index $2000$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that you don't need to define a second identical vector to compute the autocorrelation. You can use the command &lt;code&gt;z = xcorr(x);&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-23T17:07:57.400" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27243" PostTypeId="1" AcceptedAnswerId="27245" CreationDate="2015-11-23T19:31:40.690" Score="1" ViewCount="5656" Body="&lt;p&gt;The first step  in MFCC is to split the signal into frames and  referring to this discussion on MFCC at this link (&lt;a href=&quot;https://dsp.stackexchange.com/questions/6499/help-calculating-understanding-the-mfccs-mel-frequency-cepstrum-coefficients?rq=1&amp;amp;newreg=a42fe20e4ea446a2bd62ca8239b2eee4&quot;&gt;Help calculating / understanding the MFCCs: Mel-Frequency Cepstrum Coefficients&lt;/a&gt;) @pichenettles said that  the frames are usually  overlapping.&#xA;my question is why they are overlapping ?. And if they don't , for example&#xA;&quot;frame 0 is from 0-&gt;440 and frame1 is from 440 -&gt;880 &quot; does this affect the process of feature extraction using MFCC method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also why a widowing function must be applied to the frame ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="18416" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-11-24T13:32:07.870" Title="Framing an audio signal" Tags="|mfcc|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27244" PostTypeId="2" ParentId="27170" CreationDate="2015-11-23T20:18:17.097" Score="0" Body="&lt;p&gt;A practical simple way to see the appearance of harmonics is reproduced in the MATLAB code below. A simple sine/cosine wave, &lt;strong&gt;x&lt;/strong&gt;, can be represented by a single harmonic, see &lt;strong&gt;X&lt;/strong&gt; in the figure. If this wave is amplified and clipped, &lt;strong&gt;y&lt;/strong&gt;, more harmonics will be needed to represent the clipped version, see &lt;strong&gt;Y&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% MATLAB&#xA;N = 32; n = 0:N-1;&#xA;x = cos(2*pi*n/N);&#xA;y = 2*x;&#xA;ind = find(y&amp;gt;1);  y(ind) = 1;&#xA;ind = find(y&amp;lt;-1); y(ind) = -1;&#xA;subplot(221),stem(n,x); title('x');&#xA;subplot(223),stem(n,y); title('y');&#xA;X=abs(fft(x));&#xA;subplot(222),stem(n,X);&#xA;title('X = abs(fft(x))');&#xA;Y=abs(fft(y));&#xA;subplot(224),stem(n,Y);&#xA;title('Y = abs(fft(y))');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z2STM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z2STM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18419" LastActivityDate="2015-11-23T20:18:17.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27245" PostTypeId="2" ParentId="27243" CreationDate="2015-11-23T20:51:18.310" Score="3" Body="&lt;p&gt;The MFCC summary you link seems to leave out the typical windowing function applied before each FFT.  Segmenting longer data into shorter finite length FFT inputs does an implicit rectangular windowing, which causes the energy of the frequency of any signal not exactly integer periodic in the FFT length to be &quot;spattered&quot; into other distant frequencies of the FFT result.  A non-rectangular window function is applied to help reduce these rectangular window artifacts (sometimes called spectral &quot;leakage&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical window function, such as Von Hann or Hamming, can be quite lossy at both edges of each window.  Overlapping windows adds a window (or more) centered closer to where other windows are lossy, thus helping preserve information about the original signal that would otherwise be lost or degraded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another reason is for time resolution.  The length of each FFT window might be chosen to give sufficient frequency resolution, however, due to the time-space resolution trade-off of FFT analysis, the resulting time resolution may not be adequate, and thus miss fast audio transients not being centered or isolated in one window.  Shorter FFT windows may not provide sufficient frequency resolution.  A greater density of FFT windows (using overlap instead of shorter windows) improves the capture and isolation of these shorter time domain events.  This greater density (more windows per unit time) can be accomplished by overlapping the windows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't overlap, then events near or at the boundaries will be severely degraded, and the probability of transients (such a consonants) being between windows, or not being isolated in a single window, is increased, thus reducing how well the MFCC can categorize different inputs.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-11-23T21:09:00.090" LastActivityDate="2015-11-23T21:09:00.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27246" PostTypeId="2" ParentId="27233" CreationDate="2015-11-23T22:40:33.810" Score="1" Body="&lt;p&gt;If I consider that your colored lines are multivariate signals (in Red, Green, Blue), that might be related through local offsets and scalings (stretch and squeeze), I would suggest the method in &lt;a href=&quot;http://dx.doi.org/10.1016/j.eswa.2012.05.012&quot; rel=&quot;nofollow&quot;&gt;Correlation based dynamic time warping of multivariate time series&lt;/a&gt;, Expert Systems with Applications, 2012. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It combines Dynamic Time Warping (DTW), a widely used technique for comparison of time series data, and Principal Component Analysis (PCA)  to address the correlation between the variables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;yet, you have to balance, in your metric, the 'shape' part and the 'color' part of the data. The associated quantities do not live in the same space.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-11-23T22:40:33.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27247" PostTypeId="1" CreationDate="2015-11-23T23:27:17.367" Score="1" ViewCount="950" Body="&lt;p&gt;How can I create a bar based spectrogram that updates as a .wav file is playing. This is commonly found in music players. Here is an example below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/82mJn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/82mJn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to display a amplitude/frequency graph that updates as the .wav file is being played using this code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function syncPlayerDemo()&#xA;%some example music&#xA;%set up audio player&#xA;%player = audioread('test.wav');&#xA;[y,Fs] = audioread('test.wav');&#xA;player = audioplayer(y, Fs);&#xA;[samples,channels]=size(y);&#xA;%calculate timeline&#xA;t=linspace(0,1/Fs*(samples-1),samples);&#xA;%initialize full plot, update will only move the visible area using xlim&#xA;h=plot(t,y);&#xA;%set up callback to update every &amp;lt;TimerPeriod&amp;gt; s&#xA;player.TimerFcn=@timerFcn;&#xA;player.TimerPeriod=0.1;&#xA;player.playblocking()&#xA;end&#xA;function timerFcn(source,data)&#xA;%an area of length &amp;lt;area&amp;gt; s will be visible&#xA;area=1;&#xA;position=(source.CurrentSample-1)/source.SampleRate;&#xA;%move visible area, current position is in the center&#xA;set(gca,'XLim',[position-area/2,position+area/2]);&#xA;%used a waitbar for testing, might be commented in&#xA;%waitbar(source.CurrentSample/source.TotalSamples);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which results in an updating graph:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nZT59.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nZT59.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get the bars like above, any suggestions?&lt;/p&gt;&#xA;" OwnerUserId="18423" LastActivityDate="2020-12-29T07:08:36.537" Title="How can create a .wav bar based spectrogram on matlab?" Tags="|matlab|spectrogram|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27248" PostTypeId="1" AcceptedAnswerId="27253" CreationDate="2015-11-24T01:35:30.367" Score="3" ViewCount="859" Body="&lt;p&gt;I am using &lt;code&gt;numpy&lt;/code&gt; to do FFTs of real-valued data. And I don't understand why the Nyquist frequency is always real (or has zero phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, say &lt;code&gt;A = rfft(data)&lt;/code&gt; then &lt;code&gt;A[-1]&lt;/code&gt; is always a real value, and not complex. Is this the correct value for that frequency? Or is this a computational artifact that can be fixed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The explanation given in the documentation is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;A[-1]&lt;/code&gt; contains the term representing both positive and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely real.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a way to extract only the positive frequency and get rid of the degeneracy in the imaginary component caused by the Hermitian nature of the real FFT?&lt;/p&gt;&#xA;" OwnerUserId="17721" LastEditorUserId="154" LastEditDate="2015-11-24T04:45:08.137" LastActivityDate="2015-11-27T13:50:11.913" Title="Why is the last value of an RFFT always real?" Tags="|fourier-transform|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27249" PostTypeId="2" ParentId="27248" CreationDate="2015-11-24T01:59:03.460" Score="2" Body="&lt;p&gt;Think about it: the FFT at the end will be taken using the &quot;complex&quot; exponential with values &lt;code&gt;[1 -1 1 -1 1 -1 ...]&lt;/code&gt; which will always be real valued. If the signal is also real valued, then that coefficient &lt;strong&gt;cannot&lt;/strong&gt; be complex.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-24T01:59:03.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27253" PostTypeId="2" ParentId="27248" CreationDate="2015-11-24T04:25:08.577" Score="2" Body="&lt;p&gt;The real component of an FFT or DFT represents cosine or even sinusoids (symmetric around the middle), and the imaginary component represents sine, or odd sinusoids (anti-symmetric around the center).  An anti-symmetric waveform has to be zero at the center of an even length window.  If a sinusoid of frequency Fs/2 is zero at any sample, it is zero at all samples taken at a sample rate of Fs.  The imaginary component of the basis vector at N/2 for a DFT transform is also all zeros for the same reason. Thus the imaginary bin at Fs/2 is the sum of zero times zero, and has to be zero.  Leaving the result in bin N/2 strictly real for even length DFTs.  Perhaps this is the bin your RFFT implementation reports for A(-1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The is also the reason why Nyquist sampling has to be at a rate ABOVE the_highest_frequency / 2, not equal to.  Sampling will leave out part of any anti-symmetric waveform or waveform component (in any even length set of samples) if that component is of exactly frequency F when sampled at F/2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are different rules for odd length FFTs.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-11-24T04:46:20.133" LastActivityDate="2015-11-24T04:46:20.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27255" PostTypeId="1" AcceptedAnswerId="27265" CreationDate="2015-11-24T09:13:20.440" Score="0" ViewCount="723" Body="&lt;p&gt;I am studying computer vision and have some trouble with difference of Gaussian filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We apply Gaussian filters with different values of sigma on original image then subtracting from them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Gaussian filter blurs image, so some edge might not be identified. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why could we use DoG?&lt;/li&gt;&#xA;&lt;li&gt;How effective is DoG?&lt;/li&gt;&#xA;&lt;li&gt;Which type of images work best for this filter?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="18431" LastEditorUserId="13320" LastEditDate="2016-11-21T13:13:58.853" LastActivityDate="2016-11-21T13:13:58.853" Title="Which image for DoG filter?" Tags="|image-processing|difference-of-gaussians|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27257" PostTypeId="1" CreationDate="2015-11-24T10:36:58.180" Score="0" ViewCount="234" Body="&lt;p&gt;My system is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A step by step wheel returns its position each 150ms. I want to pilot an horizontal infinite scroll bar with the wheel. The scroll bar needs velocity as input to move.&#xA;Moreover the faster the wheel rotates the farthest the scroll must move. That means that if I turn the wheel one turn quickly, the bar must go further if I had turned the wheel one turn slowly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I compute the right velocity to give as input to the scroll bar with sampled position of the wheel ?&lt;/p&gt;&#xA;" OwnerUserId="18433" LastActivityDate="2016-05-22T23:10:04.790" Title="Computes velocity from sampled position" Tags="|filters|discrete-signals|real-time|c#|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27258" PostTypeId="1" CreationDate="2015-11-24T10:59:16.620" Score="3" ViewCount="1003" Body="&lt;p&gt;I'm reading 'The Scientist and Engineer's Guide to Digital Signal Processing'. It says for a noisy signal, the important parameter is not the deviation from the mean, but the power represented by the deviation from the mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if I were to consider Amplitude it would just be voltage deviations from the mean, but for power it becomes Voltage^2 deviations. Then an average is taken and a square root to give the standard deviation [It would just be an average deviation in the case of the Amplitude].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to understand why considering just the Amplitude is not good enough?&#xA;Why is it that when I'm dealing with noisy signals, I need to consider power calculations to try and reduce the noise?&lt;/p&gt;&#xA;" OwnerUserId="11274" LastActivityDate="2015-11-25T01:35:18.183" Title="Why power and not amplitude?" Tags="|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27259" PostTypeId="2" ParentId="27258" CreationDate="2015-11-24T11:17:09.967" Score="3" Body="&lt;p&gt;It's generally not true that the average deviation from the mean is not important or much less important than the power of the deviation. For sampled data, the mean deviation would be defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\epsilon=\frac{1}{N}\sum_{n=0}^{N-1}|x_n-\mu_x|\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mu_x$ is the mean of the data. This quantity is definitely relevant. However, the absolute value in $(1)$ makes it much less convenient to use than the equally relevant standard deviation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma=\sqrt{\frac{1}{N}\sum_{n=0}^{N-1}|x_n-\mu_x|^2}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is differentiable, and, consequently, easier to handle analytically (such as in least squares fitting, etc.). (Note that in Eq. $(2)$ you might as well use a factor $1/(N-1)$ instead of $1/N$, but that is not relevant here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from the above argument based on mathematical convenience, it is true that in the case of uncorrelated noise sources, it is the noise variances (i.e., the squared standard deviations) that add up, and not the mean deviations.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4346" LastEditDate="2015-11-25T01:35:18.183" LastActivityDate="2015-11-25T01:35:18.183" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27260" PostTypeId="2" ParentId="27170" CreationDate="2015-11-24T11:48:25.620" Score="1" Body="&lt;p&gt;It can be shown by the Stone-Weierstrass theorem that a power series representation approximates a non-linear system response to any desired precision if N is made sufficiently large. That is, consider a clipped signal $y(t)$ for input signal $x(t)$, then:&#xA;$y(t) = \sum_{k=0}^{N}a_kx^{k}(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if $x(t) = a\sin\omega_0 t$, then $y(t)=\sum_{k=0}^{N}a_k(\sin\omega_0t)^{k}$. This will result in $y(t)$ to have harmonics of $\omega_0$. For instance, $\sin^2\omega_0t=0.5(1-\cos2\omega_0t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For more complicated signal variations, such as speech,&lt;/strong&gt;: The spectral content varies with time. However, assuming slow temporal variation in spectral content, the above reasoning of harmonic introduction due to clipping will still hold. Further, the harmonic spacing will be time-varying and will be dependent on the short-term signal spectrum.&#xA;Example see the plot below for a speech signal (normalized to lie between +1 and -1, and corresponding clipped signal at amplitude value of 0.3 and re-normalized to same dynamic range as $x(t)$). Below the time domain signal, the corresponding signal spectrograms are represented. As speech is composed of harmonics in voiced regions (such as vowels), the harmonics strength gets further boosted in the clipped signal in these regions. Also, the lower harmonics have more amplitude strength (more darker in the plot). In the unvoiced regions, the temporal variations are very fast and clipping does not introduce very strong harmonics. &lt;strong&gt;In other words, in general, introduction of harmonics is dependent on the spectral content of&lt;/strong&gt; $x(t)$. The harmonics are introduced for sure if $x(t)$ is a periodic signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GaRcg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GaRcg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2015-11-24T11:48:25.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27261" PostTypeId="2" ParentId="25552" CreationDate="2015-11-24T12:12:09.850" Score="2" Body="&lt;p&gt;All the comments in the comment section were very constructive, thank you.&lt;/p&gt;&#xA;&lt;p&gt;In the end, I ended up using the solution: &lt;a href=&quot;http://www.learnopencv.com/image-alignment-ecc-in-opencv-c-python/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Alignment (ECC) in OpenCV ( C++ / Python )&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For my case, most of my images are not expected to tilt more than a few degree, lighting and depths are strictly controlled. So a Euclidean Motion model (&lt;code&gt;MOTION_EUCLIDEAN&lt;/code&gt;) should suffice for &lt;code&gt;findTransformECC&lt;/code&gt; which computed the transformation matrix that is required to correct the misalignment.&lt;/p&gt;&#xA;" OwnerUserId="17192" LastEditorUserId="7092" LastEditDate="2022-01-18T12:40:36.120" LastActivityDate="2022-01-18T12:40:36.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27262" PostTypeId="2" ParentId="27247" CreationDate="2015-11-24T12:21:40.653" Score="0" Body="&lt;p&gt;I guess you can simply change the command &quot;plot(t,y)&quot; to &quot;bar(t,y)&quot; and customize the plot more!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the visual to look good, try dspSystemToolbox. This is much easier and allows frame based processing (it will process particular number of samples each time) with more smoother response.Especially &quot;the time scope&quot; looks much better and allows &quot;stair plotting&quot;(check doc dsp.TimeScope). I feel it suits more for your need, although there is no problem with the present code.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not familiar with this and If you have already installed dspSystemToolbox, you can type on command line &quot;testbenchGeneratorExampleApp&quot;, the GUI there after appears will allow you to configure sources and sinks and generate the respected MATLAB code directly for you. You can modify this code little to appear the data in bars and you can customize this bar plot also. I suggest customizing the Timescope.&lt;br&gt;&#xA;Hope this helps :)&lt;/p&gt;&#xA;" OwnerUserId="17708" LastEditorUserId="17708" LastEditDate="2015-11-24T12:40:05.673" LastActivityDate="2015-11-24T12:40:05.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27263" PostTypeId="2" ParentId="27243" CreationDate="2015-11-24T13:32:07.870" Score="1" Body="&lt;p&gt;MFCC is a spectral domain feature. Hence, it is important that a MFCC feature vector carries information solely derived from the sound signal under analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sound is a non-stationary signal. A spectral domain analysis technique, such as Fourier analysis, is designed to give meaningful interpretation for only stationary signals. Hence, to apply spectral domain analysis techniques to sound, we work with frames. The frame duration is chosen depending on an idea on how fast the spectral content in the signal is varying. In a frame we assume the signal is stationary, and we hence can apply spectral analysis to it. Such a frame analysis is also referred as ``quasi-stationary analysis''. So, framing is a must to use tool when we deal with natural sound signal analysis with methods such as Fourier analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Framing has two aspects: (i) duration, and (ii) window function. The former aspect we already discussed above. On the second aspect, use of window function is a necessary evil. Evil because the frame signal now is multiplied with the window function and hence its Fourier transform will have distortions due to this multiplication. Now, which window function to use? By default, the window used when you just frame the speech is the rectangular window. But rectangular window introduces maximum spectral leakage in the resulting Fourier transform. Alternatives are Hanning window and Hamming window. These have ``less'' spectral leakage because of tapering in time domain. Obviously, as MFCCs are feature of the signal and not of the window, hence you will likely use a tapering window which leads to less spectral distortions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, why overlap? There are at least to reasons for this.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Equal weightage to each sample in the sound signal&lt;/strong&gt;. Owing to the windowing, the end samples in the frame get attenuated. Hence, the MFCC vector for this frame is less affected by these samples. These samples can be encoded in next frame's MFCCs if the next frame has an overlap of at least 50%.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Encode redundancy in MFCCs&lt;/strong&gt;: By overlapping frames (at &gt; 50 %) we have increased redundancy in the MFCCs. However, this redundancy can be exploited in improved delta-MFCCs and delta-delta-MFCCs computation as we will have a more smooth difference function approximation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4342" LastActivityDate="2015-11-24T13:32:07.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27264" PostTypeId="1" AcceptedAnswerId="27269" CreationDate="2015-11-24T13:36:50.063" Score="2" ViewCount="67" Body="&lt;p&gt;I am designing a function $A(x)$ that map $x\to \{0,1\}$. The function $A$ can be expressed as&#xA;$$A(x)=\begin{cases}&#xA;1 \text{  if $p_1(x) \ge p_2(x)$}\\ &#xA;0 \text{  otherwises}&#xA;\end{cases}&#xA;$$&#xA;where $p_1$ and $p_2$ are Gaussian distribution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_1(x)=\frac{1}{\sqrt{2\pi}\sigma_1}\exp\left( {-\frac{(x-\mu_1)^2}{2\sigma_1^2}} \right)$;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_2(x)=\frac{1}{\sqrt{2\pi}\sigma_2}\exp\left( {-\frac{(x-\mu_2)^2}{2\sigma_2^2}} \right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you help me to derive a short form of $A(x)$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my solution. However, it maybe wrong&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I derived the bellow eq.&#xA;$$A(x)=\begin{cases}&#xA;1 \text{  if $\log \frac{p_1(x)}{p_2(x)}&amp;gt;0$}\\ &#xA;0 \text{  otherwises}&#xA;\end{cases}&#xA;$$&#xA;where $\log(e)=1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have&#xA;$$\log \frac{p_1(x)}{p_2(x)}=\log \frac{\sigma_2}{\sigma_1}+\left( {\frac{x-\mu_2}{\sqrt{2}\sigma_2}} \right)^2-\left( {\frac{x-\mu_1}{\sqrt{2}\sigma_1}} \right)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, my final solution is&#xA;$$A(x)=\begin{cases}&#xA;1 \text{  if $\left (\log \frac{\sigma_2}{\sigma_1}+\left( {\frac{x-\mu_2}{\sqrt{2}\sigma_2}} \right)^2-\left( {\frac{x-\mu_1}{\sqrt{2}\sigma_1}} \right)^2 \right) \ge 0$}\\ &#xA;0 \text{  otherwises}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8430" LastEditorUserId="8430" LastEditDate="2015-11-24T15:03:50.443" LastActivityDate="2015-11-24T20:48:01.493" Title="How to derive the $\log$ of fraction of two Gaussian distribution" Tags="|image-processing|gaussian|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27265" PostTypeId="2" ParentId="27255" CreationDate="2015-11-24T14:22:49.080" Score="0" Body="&lt;p&gt;&lt;strong&gt;Why could we use DoG?&lt;/strong&gt; An old and low-cost edge-enhancement technique consists in subtracting a blurred image from the original image. Its filter interpretation  is an impulse filter (the neutral filter for the original image) minus the blur filter. The resulting filter is positive at its center, and negative around, a sort of coarse Laplacian filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above impulse filter can be seen as the limit of a Gaussian filter whose $\sigma$ tends to $0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DoG filter somehow generalizes the described old edge-enhancement technique, with a pair of blurring filters. Perhaps surprisingly, two blurs, when subtracted, can sharpen edges. The resulting filter acts as a pass-band with appropriate $\sigma_k$ kernel ratios.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How effective is DoG?&lt;/strong&gt; its effectiveness is close to that of the Laplacian of Gaussians, which it mimics, see below in 1D.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ro8Wr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ro8Wr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Which type of images work best for this filter?&lt;/strong&gt; It is believed to work well for large images, since it has very fast implementations. Due to the &quot;double filtering effect&quot; in high frequencies, it is somewhat robust to noise. Depending on the kernel size choice, it enhances features that possess a certain scale extend.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-11-24T14:22:49.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27267" PostTypeId="2" ParentId="27257" CreationDate="2015-11-24T15:22:26.977" Score="0" Body="&lt;p&gt;Take the difference between successive measurements; this difference is proportional to the velocity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if $x[i]$ is the i-th measurement in degrees, then $(x[i]-x[i-1]/0.15$ will give you the rotation speed in degrees per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to take care of the origin position (where the measurement will jump between 359 and 0 assuming measurement in degrees).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the difference is a big positive value, then subtract 360. Likewise, if the difference is a big negative value, add 360.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if $x[i-1] = 350$ and $x[i]=5$, the difference $x[i]-x[i-1]$ will give -345. Add 360 to get the correct value of +15 degrees. Only after this correction you divide by 0.15s to give the value in degrees per second (if you need that).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This procedure assumes you never rotate more than 180 degrees in one sample time (about 3.5 turns per second).&lt;/p&gt;&#xA;" OwnerUserId="330" LastEditorUserId="330" LastEditDate="2015-11-24T15:57:57.823" LastActivityDate="2015-11-24T15:57:57.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27268" PostTypeId="1" CreationDate="2015-11-24T16:54:43.123" Score="-1" ViewCount="413" Body="&lt;p&gt;I fail to understand the evaluation parameters like true positive, false positive and false negative in detection and classification tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can anyone help me to figure out what does each of these parameters mean? Can anyone please give an example?&lt;/p&gt;&#xA;" OwnerUserId="18441" LastActivityDate="2015-11-24T18:32:21.570" Title="How does the PASCAL VOC challenge evaluate the task of object detection?" Tags="|computer-vision|classification|object-recognition|detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27269" PostTypeId="2" ParentId="27264" CreationDate="2015-11-24T17:02:58.860" Score="3" Body="&lt;p&gt;Your final condition is correct, but it doesn't show explicitly for which values of $x$ it is satisfied. This can be worked out as follows. From what you have it follows that $p_1(x)\ge p_2(x)$ is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$0\ge x^2(\sigma_2^2-\sigma_1^2)-2x(\mu_1\sigma_2^2-\mu_2\sigma_1^2)+\mu_1^2\sigma_2^2-\mu_2^2\sigma_1^2-2\sigma_1^2\sigma_2^2\log\left(\frac{\sigma_2}{\sigma_1}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's first consider the case $\sigma_1=\sigma_2$. From $(1)$ it follows that in this case the condition on $x$ becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x\ge \frac{\mu_1^2-\mu_2^2}{2(\mu_1-\mu_2)}&#xA;= \frac{\mu_1+\mu_2}{2}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we assume $\mu_1\neq\mu_2$ because otherwise $p_1(x)=p_2(x)$, which makes no sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case $\sigma_1\neq\sigma_2$, we have to consider $(1)$ as a quadratic inequality in $x$, which is satisfied with equality for the following values of $x$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}x_1&amp;amp;=\frac{a}{2}-\sqrt{\frac{a^2}{4}-b}\\&#xA;x_2&amp;amp;=\frac{a}{2}+\sqrt{\frac{a^2}{4}-b}\end{align}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}a&amp;amp;=\frac{2(\mu_1\sigma_2^2-\mu_2\sigma_1^2)}{\sigma_2^2-\sigma_1^2}\\&#xA;b&amp;amp;=\frac{\mu_1^2\sigma_2^2-\mu_2^2\sigma_1^2-2\sigma_1^2\sigma_2^2\log\left(\frac{\sigma_2}{\sigma_1}\right)}{\sigma_2^2-\sigma_1^2}\end{align}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the sign of $\sigma_2-\sigma_1$ we have two conditions equivalent to $p_1(x)\ge p_2(x)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\sigma_2&amp;gt;\sigma_1:\quad &amp;amp; x_1\le x\le x_2\\&#xA;\sigma_2&amp;lt;\sigma_1:\quad &amp;amp; x\le x_1\text{ or }x\ge x_2\end{align}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inequalities in $(5)$ state explicit conditions on the variable $x$ that can be easily evaluated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; As suggested by Dilip Sarwate in a comment it can be instructive to distinguish another special case: $\sigma_1\neq\sigma_2$ and $\mu_1=\mu_2=\mu$. In that case the limits $x_1$ and $x_2$ of the decision regions given by $(3)$ lie symmetrical to the common mean $\mu$, and $(3)$ simplifies to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_{1,2}=\mu\pm\sqrt{\frac{2\sigma_1^2\sigma_2^2\log\left(\frac{\sigma_2}{\sigma_1}\right)}{\sigma_2^2-\sigma_1^2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the conditions $(5)$ remain valid.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-24T20:48:01.493" LastActivityDate="2015-11-24T20:48:01.493" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27270" PostTypeId="2" ParentId="27268" CreationDate="2015-11-24T17:13:13.460" Score="2" Body="&lt;p&gt;The detection task is: Given an image $I$, does it contain a sub-image $S$ (or an object $S$)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several things that can happen:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$I$ contains $S$ and the detector says $I$ contains $S$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This is a &lt;strong&gt;True Positive&lt;/strong&gt;: the statement is true, and the statement is positive ($S$ is there)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$I$ contains $S$ and the detector says $I$ DOES NOT contain $S$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This is a &lt;strong&gt;False Negative&lt;/strong&gt;: the statement is false, and the statement is negative ($S$ is NOT there)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$I$ DOES NOT contain $S$ and the detector says $I$ DOES NOT contain $S$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This is a &lt;strong&gt;True Negative&lt;/strong&gt;: the statement is true, and the statement is negative ($S$ is NOT there)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$I$ DOES NOT contain $S$ and the detector says $I$ contains $S$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This is a &lt;strong&gt;False Positive&lt;/strong&gt;: the statement is false, and the statement is positive ($S$ is there)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-24T18:32:21.570" LastActivityDate="2015-11-24T18:32:21.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27272" PostTypeId="1" CreationDate="2015-11-24T20:50:53.277" Score="5" ViewCount="1490" Body="&lt;p&gt;Suppose I have two timeseries $x_1(t)$ and $x_2(t)$, shown in the image that I drew below. They look almost identical in general form, except some features are shifted slightly in time from one series to the other by an about $\delta t$. Sometimes they are measured first in $x_1$, and sometimes in $x_2$, so sometimes $\delta t$ is positive and sometimes negative. The change in lag between features is random, but constrained to be of a small range so that shifts never overlap and cancel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know, what is the mean time lag between the two signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even better, would be to know the distribution of time lags so I could estimate the mean, variance and range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have ideas or suggestions for how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gJgus.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gJgus.jpg&quot; alt=&quot;Two time series where the time lag between features is changing.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My own thoughts so far are: I can imagine calculating the cross correlation between signals $x_1$ and $x_2$. However, I would expect the result to be strong correlation at zero time lag, because the time lags can be both positive and negative, so that the average lag is zero. However, the width/stretching of the zero peak, must be related to the average time lag, however, I can't figure out how exactly at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thought I have had is to create a moving correlation estimator. In a similar way to how wavelet analysis can be used to estimate how the power of certain frequency components changes as a function of time. I could develop a function that measures the lag correlation as a function of time by breaking one of the signals into smaller chunks and convolving it across the second signal while stepping along.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All suggestions appreciated. &lt;/p&gt;&#xA;" OwnerUserId="18445" LastEditorUserId="18445" LastEditDate="2015-11-26T16:07:07.077" LastActivityDate="2015-11-27T17:39:48.053" Title="Estimate changing time lag between signals" Tags="|signal-analysis|cross-correlation|random|time-series|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27273" PostTypeId="1" AcceptedAnswerId="27282" CreationDate="2015-11-24T21:35:09.357" Score="4" ViewCount="1032" Body="&lt;p&gt;Suppose an image has noise, but it is exclusively salt noise. What effect will dilation have?&#xA;I am looking for a reference so I can answer this question. anyone has any idea? &lt;/p&gt;&#xA;" OwnerUserId="18438" LastActivityDate="2015-11-27T02:21:03.413" Title="salt noise in an image" Tags="|image-processing|noise|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27274" PostTypeId="2" ParentId="9118" CreationDate="2015-11-24T22:07:34.793" Score="0" Body="&lt;p&gt;There are window functions you could apply that would not be a lowpass filter, such as finding the maximum value in the window like the example &lt;a href=&quot;http://www.graphicsmill.com/docs/gm/minimum-maximum-median-filters.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. (If anyone has reasons why a running window max is still a lowpass filter, I'd be curious to know!)&lt;/p&gt;&#xA;" OwnerUserId="18384" LastActivityDate="2015-11-24T22:07:34.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27275" PostTypeId="2" ParentId="25204" CreationDate="2015-11-24T22:13:53.193" Score="1" Body="&lt;p&gt;&lt;code&gt;mne.EpochsArray&lt;/code&gt; is for 3-D data (epochs * channels * times). &lt;code&gt;mne.RawArray&lt;/code&gt; is for 2-D data. Use &lt;a href=&quot;http://martinos.org/mne/stable/generated/mne.EpochsArray.html&quot; rel=&quot;nofollow&quot;&gt;EpochsArray&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;events&lt;/code&gt; is an n * 3 integer array. The 3 columns are: time (in sampling points), length (you can put a dummy here - it is almost never checked - but you still need 3 columns), value (e.g. condition). You fed it a 1 * 2 array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from mne import create_info, EpochsArray&#xA;n_epochs = 100&#xA;channels = [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;]&#xA;n_channels = len(channels)&#xA;events = np.array([np.arange(n_epochs), np.ones(n_epochs), np.ones(n_epochs)]).T.astype(int)&#xA;d = np.random.random((n_epochs, n_channels, 256))&#xA;&#xA;info = create_info(channels, 256, &quot;eeg&quot;)&#xA;epochs = EpochsArray(d, info, events)&#xA;&#xA;epochs.plot(show=True, block=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="18447" LastActivityDate="2015-11-24T22:13:53.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27276" PostTypeId="2" ParentId="9118" CreationDate="2015-11-24T22:20:51.553" Score="5" Body="&lt;p&gt;I do interpret the question &amp;quot;why is windowing function a low-pass filter?&amp;quot; in another direction:  &lt;em&gt;why can a (typical) window function  be interpreted as the series of coefficients of a low-pass filter&lt;/em&gt;? Because of the duality between the time and the frequency domains, so:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Mostly because the coefficients of a normalized window sum to one (which could not be said, for instance, about most wavelets, which are zero-sum)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Most classical windows are positive, symmetric, and can be normalized so that their samples &lt;span class=&quot;math-container&quot;&gt;$h_i $&lt;/span&gt;  sum to one (since &lt;span class=&quot;math-container&quot;&gt;$\sum_i h_i \neq 0$&lt;/span&gt;). Their coefficients can be interpreted as weights, and you can replace a signal sample by a weighted sum of other samples and the window weights: each weighted one is replaced by a center of mass. It suffices to divide the result by the sum of weights to get an averaging filter (center of gravity). Since most standard windows are symmetric and often unimodal with maxima at their center, they look like regular smoothing filters: a rectangular window convolves like a moving average filter, a Bartlett filter, a Gaussian window ... like a Gaussian filter.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jZRjf.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jZRjf.gif&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, &lt;a href=&quot;http://sepwww.stanford.edu/sep/prof/pvi/zp/paper_html/node7.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;smoothing with a box or a triangle&lt;/a&gt; somehow boils down to interpreting  a windowing function as a low-pass filter.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, a repeated (or parallel) use of box rectangular windows of different sizes is used to approximate more complex filters, in a very fast fashion, see for instance &lt;a href=&quot;https://www.mia.uni-saarland.de/Publications/gwosdek-ssvm11.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Theoretical Foundations of Gaussian. Convolution by Extended Box Filtering&lt;/a&gt;, 2011.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2023-01-28T22:04:44.200" LastActivityDate="2023-01-28T22:04:44.200" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27277" PostTypeId="1" CreationDate="2015-11-25T00:15:07.957" Score="0" ViewCount="1233" Body="&lt;p&gt;I am working on a very simple voice recognition system using the msp430. In my research I've read that for real life audio signals its necessary to apply a window to the FFT data because the audio signals won't be periodic. In my code, I've applied the hamming window and plotted it against the non-windowed FFT spectrum. It appears that the hamming attenuates the signal in the lower valued N data points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/G6ZBz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G6ZBz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this makes sense based upon the equation of the hamming window, but why would I want this attenuate for my signal? It seems that identifying the spectral characteristics would be more difficult after the window. Any thoughts? &lt;/p&gt;&#xA;" OwnerUserId="18448" LastEditorUserId="11256" LastEditDate="2015-11-25T01:02:26.890" LastActivityDate="2016-01-24T17:39:53.673" Title="Why does the Hamming window attenuate the FFT?" Tags="|fft|window|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27278" PostTypeId="2" ParentId="27258" CreationDate="2015-11-25T01:17:15.097" Score="0" Body="&lt;p&gt;Independent noise sources add in power domain; whereas in the voltage domain they are incoherent.  &quot;Signals&quot; add in the voltage domain.  You might think on Parsevel's theorem as well.  BTW: a good analogy is in linear algebra where straight lines add but vectors in different directions add in some form of Pythagoras theorem&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2015-11-25T01:17:15.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27279" PostTypeId="2" ParentId="27277" CreationDate="2015-11-25T01:42:50.080" Score="2" Body="&lt;p&gt;You can figure the change in energy applied to your signal by analyzing the energy in your window.  The Hamming window's energy (or scaling) is well known and Google will tell you what it is.  You are doing something different. Can you post your code for further help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your code, ans your image, it really appears that you applied the window to your transformed data.  The window (in this case) is applied to the time data &lt;em&gt;before&lt;/em&gt; the transform.  The window will reduce sidelobes from strong frequency components.  Take note that taper windows cause the so-called &quot;spectral leakage&quot; where energy leaks into other frequency bins&lt;/p&gt;&#xA;" OwnerUserId="18099" LastEditorUserId="18099" LastEditDate="2015-11-25T15:27:24.840" LastActivityDate="2015-11-25T15:27:24.840" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27280" PostTypeId="1" CreationDate="2015-11-25T02:15:36.003" Score="0" ViewCount="112" Body="&lt;p&gt;This question is in the context of digital communication . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many text books (wireless communication), when people derive the capacity of point to point communication system (one transmit one receive end) with multiple transmit and multiple receive antennas, people consider the narrow band flat fading channel. Below I write down the output equation of system with $N$ transmit antennas and $M$ receive antennas&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\bf Y_{M\times 1} = H_{M\times N}X_{ N\times 1}+ Z_{M\times 1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution to find the maximum capacity is to do Singular Value Decomposition (SVD) of the channel as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\bf  H = U D V^H}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transmitter uses matrix ${\bf V}$ that is the transmit signal is &#xA;$${\bf X'= VX}$$ while the receiver uses matrix ${\bf U}$ as follows &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\bf Y'= U^HY}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what about wideband channels, time varying frequency selective channels that is systems with channel such as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\bf H_{M\times N}(t)} \,\,\,\,\,\, t =0... T_{Delay}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we find the  MIMO capacity of such channels. &#xA;In one case, I think once can assume multicarrier (OFDM) system and divide the wideband channel into smaller narrow band and apply the algorithm I mentioned above. But what if its not multicarrier system? What is the optimal scheme, what should the transmitter and receiver do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance&lt;/p&gt;&#xA;" OwnerUserId="15590" LastEditorUserId="15590" LastEditDate="2015-11-25T02:30:24.220" LastActivityDate="2015-11-25T02:30:24.220" Title="How do we find the capacity of MIMO wideband point to point system?" Tags="|digital-communications|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27282" PostTypeId="2" ParentId="27273" CreationDate="2015-11-25T05:38:37.493" Score="5" Body="&lt;p&gt;To answer your 1st question, dilation will enlargen the white spots in your image over the darker spots, which may be useful if you only have tiny dark salting you would like to remove in your image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you are referring to &lt;em&gt;salt noise&lt;/em&gt;, so if the spots were also white crumbs in a dark image, then all you are doing is only making the crumbs bigger, which is what you &lt;strong&gt;don't&lt;/strong&gt; want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would recommend is to use either Opening or Closing, (or both) depending on your application. These are a combination of dilations and erosions so that the minor parts of the image are removed while keeping the original portions of the image intact. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here is an image for a penguin (with salting): &#xA;&lt;a href=&quot;https://i.stack.imgur.com/4wCcW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4wCcW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how the image has both black and white salting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running both an opening and closing algorithm (OpenCV) on this penguin, we remove the black and white salts, and get a nice, smoother image without the spots:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pPMhG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pPMhG.png&quot; alt=&quot;Un-salted Penguin&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, here is my OpenCV code that does this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;opencv2/highgui/highgui.hpp&quot;&#xA;#include &quot;opencv2/imgproc/imgproc.hpp&quot;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;&#xA;using namespace cv;&#xA;using namespace std;&#xA;&#xA;int main( )&#xA;{&#xA;     Mat image,dst;&#xA;     image = imread(&quot;saltnoise.png&quot;, CV_LOAD_IMAGE_GRAYSCALE);&#xA;&#xA;&#xA;     // Create a structuring element&#xA;     int erosion_size;&#xA;     cout &amp;lt;&amp;lt; &quot;What element size?&quot; &amp;lt;&amp;lt; '\n';&#xA;     cin &amp;gt;&amp;gt; erosion_size;&#xA;&#xA;&#xA;     imshow(&quot;Salted&quot;, image);&#xA;&#xA;     Mat element = getStructuringElement(cv::MORPH_ELLIPSE,&#xA;            cv::Size(2 * erosion_size + 1, 2 * erosion_size + 1),&#xA;            cv::Point(erosion_size, erosion_size) );&#xA;&#xA;    //Opening and Closing&#xA;    erode(image,image,element);&#xA;    dilate(image,image,element);&#xA;&#xA;    dilate(image,image,element);&#xA;    erode(image,image,element);&#xA;&#xA;&#xA;     imshow(&quot;Unsalted&quot;, image);&#xA;&#xA;     waitKey(0);&#xA;     return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17561" LastEditorUserId="17561" LastEditDate="2015-11-27T02:21:03.413" LastActivityDate="2015-11-27T02:21:03.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27283" PostTypeId="2" ParentId="23121" CreationDate="2015-11-25T06:10:44.000" Score="2" Body="&lt;p&gt;Try dilation, a technique used to enlargen light spots over darker spots in an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start by dilating the image such that many of the enlargened white blobs will overlap and form a complete connected contour, as such:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Wm4Go.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wm4Go.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when OpenCV finds contours from this large figure to make convex hulls, it will find a complete circle rather than loose seperate blobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xer2p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xer2p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here, you can find the largest contour, which is the (outer) largest light-purple contour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code for this (which currently computes the contours, but not the largest area - this is just to demonstrate the dilation):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &quot;opencv2/highgui/highgui.hpp&quot;&#xA;#include &quot;opencv2/imgproc/imgproc.hpp&quot;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;&#xA;using namespace cv;&#xA;using namespace std;&#xA;&#xA;int main( int argc, char** argv )&#xA;{&#xA; Mat src; Mat src_gray;&#xA; src = imread( &quot;convex.jpg&quot;, 1 );&#xA; //resize(src, src, Size(640,480), 0, 0, INTER_CUBIC);&#xA; cvtColor( src, src_gray, CV_BGR2GRAY );&#xA;&#xA; namedWindow( &quot;Source&quot;, CV_WINDOW_AUTOSIZE );&#xA;&#xA;&#xA;&#xA; //Dilate&#xA; int erosion_size =10;&#xA;  Mat element = getStructuringElement(cv::MORPH_ELLIPSE,&#xA;        cv::Size(2 * erosion_size + 1, 2 * erosion_size + 1),&#xA;        cv::Point(erosion_size, erosion_size) );&#xA;&#xA; dilate(src_gray,src_gray,element);&#xA;&#xA; imshow( &quot;Source&quot;, src_gray );&#xA;&#xA; // Convex Hull implementation&#xA; Mat src_copy = src_gray.clone();&#xA; Mat threshold_output;&#xA; vector&amp;lt;vector&amp;lt;Point&amp;gt; &amp;gt; contours;&#xA; vector&amp;lt;Vec4i&amp;gt; hierarchy;&#xA;&#xA; // Find contours&#xA; threshold( src_gray, threshold_output, 200, 255, THRESH_BINARY );&#xA; findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );&#xA;&#xA; // Find the convex hull object for each contour&#xA; vector&amp;lt;vector&amp;lt;Point&amp;gt; &amp;gt;hull( contours.size() );&#xA; for( int i = 0; i &amp;lt; contours.size(); i++ )&#xA; {  convexHull( Mat(contours[i]), hull[i], false ); }&#xA;&#xA; // Draw contours + hull results&#xA; RNG rng;&#xA; Mat drawing = Mat::zeros( threshold_output.size(), CV_8UC3 );&#xA; for( int i = 0; i&amp;lt; contours.size(); i++ )&#xA; {&#xA;  Scalar color = Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );&#xA;  //drawContours( drawing, contours, i, color, 1, 8, vector&amp;lt;Vec4i&amp;gt;(), 0, Point() );&#xA;  drawContours( drawing, hull, i, color, 1, 8, vector&amp;lt;Vec4i&amp;gt;(), 0, Point() );&#xA; }&#xA;&#xA; // Show in a window&#xA; namedWindow( &quot;Hull demo&quot;, CV_WINDOW_AUTOSIZE );&#xA; imshow( &quot;Hull demo&quot;, drawing );&#xA;&#xA; waitKey(0);&#xA; return(0);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17561" LastEditorUserId="17561" LastEditDate="2015-11-27T08:42:09.847" LastActivityDate="2015-11-27T08:42:09.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27285" PostTypeId="1" AcceptedAnswerId="27297" CreationDate="2015-11-25T06:44:03.693" Score="1" ViewCount="2614" Body="&lt;p&gt;I am using JM reference software for encoding and decoding of video. What I want to do is to add Redundant bits using RS codes to the encoded video so that if some bits get lost during transmission we recover it on decoder side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I am getting is to detect end of frame when reading H.264 file.&#xA;So my questions are as follows&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How to detect end of frame when reading h.264 file?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, how to detect end of GOP in h.264 stream?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="18454" LastEditorUserId="18454" LastEditDate="2015-11-26T16:59:36.630" LastActivityDate="2015-12-14T11:55:31.277" Title="Detect ending of frame in H.264 video stream" Tags="|matlab|video-processing|reed-solomon|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27286" PostTypeId="1" AcceptedAnswerId="27290" CreationDate="2015-11-25T08:24:58.557" Score="1" ViewCount="105" Body="&lt;p&gt;&lt;a href=&quot;https://www.cis.rit.edu/%7Ecnspci/references/dip/feature_extraction/harris1988.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Harris and Stephens&lt;/a&gt; writes about the interest window of Moravec:&#xA;&amp;quot;&lt;em&gt;The response is noisy because the window is binary and rectangular&lt;/em&gt;&amp;quot;, and suggests applying a Gaussian window.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My Question:&lt;/strong&gt; Why is the response not noisy after applying a Gaussian window? Is it because a Gaussian filter removes noise from a picture, or because a circular window is better for sampling somehow?&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="17789" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-11-25T13:27:16.227" Title="Moravec, Harris noisy window" Tags="|local-features|detection|corners|harris|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27287" PostTypeId="1" CreationDate="2015-11-25T10:12:09.863" Score="2" ViewCount="412" Body="&lt;p&gt;I have found a problem in applying Laplace Transform to $-e^{-at}u(-t)$&#xA;I am doing these steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = - \int_{-\infty}^{+\infty} e^{-at}u(-t)  e^{-st}dt$$&#xA;$$ = - \int_{-\infty}^{0} e^{-at}  e^{-st}dt$$&#xA;$$ = - \int_{-\infty}^{0} e^{-(a+s)t}dt$$&#xA;$$ = - [-\frac{1}{a+s} e^{-(a+s)t}]|_{-\infty}^{0}$$&#xA;$$ = - [-\frac{1}{a+s} (e^{-(a+s)0}-e^{-(a+s)-\infty})]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = - [-\frac{1}{a+s} (1- \infty)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = \infty$$&#xA;Can anyone help me why it is showing like that.I check it on internet and all the books are showing the answer is $\frac{1}{s+a}$&lt;/p&gt;&#xA;" OwnerUserId="18359" LastActivityDate="2015-11-25T10:12:09.863" Title="Laplace Transform of $-e^{-at}u(-t)$" Tags="|transform|math|laplace-transform|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27288" PostTypeId="1" AcceptedAnswerId="27293" CreationDate="2015-11-25T11:39:50.343" Score="2" ViewCount="730" Body="&lt;p&gt;For the proof of inverse Laplace transform, we change the integral from $\omega$ to $s$. I want to know the reason why we need to change the integral?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qjRzE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qjRzE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="16293" LastEditDate="2015-11-25T12:44:20.230" LastActivityDate="2015-11-25T14:56:50.863" Title="Confusion in proof of Inverse Laplace Transform" Tags="|transform|laplace-transform|" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="27290" PostTypeId="2" ParentId="27286" CreationDate="2015-11-25T13:20:55.443" Score="0" Body="&lt;p&gt;I've added a link to the paper you're quoting in the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that both the Moravec corner detector, and the change to it suggested first in that paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dS1MS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dS1MS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;use the derivative of the image. ANY difference operation will tend to enhance higher frequency noise in the image.  The idea with the Gaussian smoother is to reduce this effect.  The two operations (Gaussian smoothing and difference operation) are often combined into a single operation: &lt;a href=&quot;https://en.wikipedia.org/wiki/Difference_of_Gaussians&quot; rel=&quot;nofollow noreferrer&quot;&gt;the difference of Gaussians.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the paper suggests, the anisotropy of the Moravec detector is why the differential is used, rather than the up, down, and diagonal differences in the Moravec algorithm. The smoothing is introduced to counter the noise issue.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-25T13:27:16.227" LastActivityDate="2015-11-25T13:27:16.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27292" PostTypeId="1" AcceptedAnswerId="27294" CreationDate="2015-11-25T14:49:52.127" Score="-1" ViewCount="225" Body="&lt;p&gt;&lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/25605504&quot; rel=&quot;nofollow&quot;&gt;I have come across with the term 'concurrent signal'&lt;/a&gt;. What does this type of signal means?  What are it's importance?&lt;/p&gt;&#xA;" OwnerUserId="17137" LastEditorUserId="13320" LastEditDate="2016-11-13T13:22:36.440" LastActivityDate="2016-11-13T13:22:36.440" Title="What is concurrent Signal?" Tags="|continuous-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27293" PostTypeId="2" ParentId="27288" CreationDate="2015-11-25T14:56:50.863" Score="1" Body="&lt;p&gt;To summarize the discussion:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The usual substitution is $s = \sigma + j \omega$ where $\sigma$ is the real part of the $s$ variable and $\omega$ is the imaginary part.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The equation in the image is for the &lt;strong&gt;Fourier&lt;/strong&gt; transform, not the &lt;strong&gt;Laplace&lt;/strong&gt; transform. The Fourier transform can be thought of as the Laplace transform evaluated on the imaginary axis ($\sigma = 0$).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The differential $ds$, when looking at real and imaginary parts distinctly, becomes $d\sigma + j d\omega$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Any &lt;strong&gt;differential&lt;/strong&gt; is an infinitesimal (very small) change in that variable. $dx$ is a small change in $x$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-25T14:56:50.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27294" PostTypeId="2" ParentId="27292" CreationDate="2015-11-25T15:35:17.150" Score="1" Body="&lt;p&gt;Concurrent signal is not a particular kind of signal, in the paper is written that ECG signal of fetus is weaker than concurrent signals, for example mother's ECG, that is one of the concurrent signals. Basically concurrent signals are called in this way because they are occuring simultaneously.&lt;/p&gt;&#xA;" OwnerUserId="18459" LastActivityDate="2015-11-25T15:35:17.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27295" PostTypeId="1" AcceptedAnswerId="27301" CreationDate="2015-11-25T15:36:49.693" Score="3" ViewCount="2294" Body="&lt;p&gt;In many papers I see the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;First we have to convert image from &lt;code&gt;RGB&lt;/code&gt; to &lt;a href=&quot;https://en.wikipedia.org/wiki/CIELAB_color_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;LAB&lt;/code&gt;&lt;/a&gt; color space to reduce colors then algorithm can run faster.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can't understand this. How can this happen? What I read is that &lt;code&gt;Lab&lt;/code&gt; color space has support for more colors than the other. But I see people says converting to &lt;code&gt;Lab&lt;/code&gt; reduces the colors to better calculation. Why and how does this happen? &lt;/p&gt;&#xA;" OwnerUserId="18461" LastEditorUserId="128" LastEditorDisplayName="user11906" LastEditDate="2019-12-27T17:45:27.250" LastActivityDate="2019-12-27T17:45:27.250" Title="Converting from RGB to LAB Color Space to Reduce Colors" Tags="|image-processing|computer-vision|color|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27297" PostTypeId="2" ParentId="27285" CreationDate="2015-11-25T16:45:05.777" Score="2" Body="&lt;p&gt;I think Technically speaking the only way to detect when a frame ends is to see where the next one begins. That means, you should search for the next start prefix code 0x000001. If you go to the previous data before this (which in the general case is the byte alignment syntax elements) and add your RS codes, a compliant decoder should ignore all that until the prefix code is seen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the end of GOP, I'm afraid that the GOP concept does not exist in the Video standard, in theory you could start receiving frames which use previous frames as reference, but there is never a repeating structure. You can detect the end of a coded video sequence, but that does not necessarily coincide with what we know in the video community as &quot;the GOP&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;In reply to the comment:&#xA;Lets suppose the bit stream is this (I am going to invent, it will be all garbage):&#xA;0x 00 00 01 e5 d8 31 04 ab 80 00 00 01 8e 56 04 94 cd 80 10 00 00 01 ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You know for example that 00 00 01 e5 d8 31 04 ab 80 is the first frame, so you take all those bits and generate a CRC for them (or any other error correcting technique that you want), lets suppose you insert one byte of CRC ( that hypothetically will allow you to detect up to 5 bits in error and correct 3 for example), then your new bit stream would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0x 00 00 01 e5 d8 31 04 ab 80 &lt;strong&gt;fc&lt;/strong&gt; 00 00 01 8e 56 04 94 cd 80 &lt;strong&gt;53&lt;/strong&gt; 10 00 00 01&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here the CRC would be the bytes in boldface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the GOP. Remember that even though when you decode you can see a repeating structure of frames &quot;it is not required&quot; to be like that forever. IF you want you could count the number of frames between I frames and in the practical cases it will work. Most H.264 encoders use a structure like I  {[B] (xN) P} (xM) I ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I B B P B B P B B I B B P B B P B B I B B P B B P B B ... etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I B B B P B B B P B B B I B B B P B B B P B B B I B B B P B B B P B B B ... etc&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you start counting and see in first example that the number of frames between two I frames is 8, nothing guarantees that in the next cycle it would be the same. Usually it will be, but there is nothing in the standard saying that you have to do it like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="7599" LastEditDate="2015-12-14T11:55:31.277" LastActivityDate="2015-12-14T11:55:31.277" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27298" PostTypeId="1" AcceptedAnswerId="27300" CreationDate="2015-11-25T16:48:07.030" Score="3" ViewCount="614" Body="&lt;p&gt;For an image with pepper noise, presuming it is desirable to reduce the pepper noise, which operations, in which sequence, would you apply? Find an image, add pepper noise, and demonstrate your results.&lt;/p&gt;&#xA;" OwnerUserId="18438" LastEditorUserId="128" LastEditDate="2018-08-22T20:44:21.610" LastActivityDate="2022-03-28T06:17:52.087" Title="Reducing Pepper Noise from an Image" Tags="|image-processing|noise|denoising|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27300" PostTypeId="2" ParentId="27298" CreationDate="2015-11-25T19:14:54.630" Score="4" Body="&lt;p&gt;Salt and Paper noise are better dealt and reduced using &lt;a href=&quot;https://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Median Filter&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The properties of the Salt and Pepper noise make it an outlier in almost any patch of the image.&lt;br /&gt;&#xA;Hence the best way to remove it is using a method robust to outliers.&lt;br /&gt;&#xA;Linear filters (Low Pass Filters) are basically weighted mean an hence very sensitive to Outliers which makes them less efficient in this case.&lt;/p&gt;&#xA;&lt;p&gt;The Median is known and simple robust estimator and hence perform very well in this case.&lt;/p&gt;&#xA;&lt;p&gt;The way to use it is simple, working by patches / windows.&#xA;Iterate through the pixels of the image, for each pixel open a Window of its neighborhood controlled by the parameter which is the Window Radius.&lt;br /&gt;&#xA;For each window replace the value of the center pixel by the median of the window.&lt;/p&gt;&#xA;&lt;p&gt;MATLAB Code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;% Image Salt and Pepper Noise Filtering&#xA;% See http://dsp.stackexchange.com/questions/27298&#xA;&#xA;%% General Parameters and Initialization&#xA;&#xA;clear();&#xA;close('all');&#xA;&#xA;% set(0, 'DefaultFigureWindowStyle', 'docked');&#xA;defaultLooseInset = get(0, 'DefaultAxesLooseInset');&#xA;set(0, 'DefaultAxesLooseInset', [0.05, 0.05, 0.05, 0.05]);&#xA;&#xA;titleFontSize   = 14;&#xA;axisFotnSize    = 12;&#xA;stringFontSize  = 12;&#xA;&#xA;thinLineWidth   = 2;&#xA;normalLineWidth = 3;&#xA;thickLineWidth  = 4;&#xA;&#xA;smallSizeData   = 36;&#xA;mediumSizeData  = 48;&#xA;bigSizeData     = 60;&#xA;&#xA;randomNumberStream = RandStream('mlfg6331_64', 'NormalTransform', 'Ziggurat');&#xA;subStreamNumber = 57162;&#xA;set(randomNumberStream, 'Substream', subStreamNumber);&#xA;RandStream.setGlobalStream(randomNumberStream);&#xA;&#xA;%% Constants&#xA;UNIT8_MIN_VALUE = 0;&#xA;UNIT8_MAX_VALUE = 255;&#xA;&#xA;&#xA;%% Loading Data&#xA;&#xA;mInputImage = imread('../RawData/Image0001.png');&#xA;mInputImage = mInputImage(:, :, 1); %&amp;lt;! Assuring Single Channel Image&#xA;&#xA;numRows = size(mInputImage, 1);&#xA;numCols = size(mInputImage, 2);&#xA;numPixels = numRows * numCols;&#xA;&#xA;&#xA;%% Parameters&#xA;winRadius           = 1; %&amp;lt;! Loacl Window Radius&#xA;noiseProbability    = 0.05; %&amp;lt;! Probability of a Pixel to be affected by noise&#xA;&#xA;&#xA;%% Generating Noisy Image&#xA;&#xA;numNoisyPixels  = round(noiseProbability * numPixels);&#xA;&#xA;vNoisyPixelsIdx         = randperm(numPixels, numNoisyPixels);&#xA;vPepperNoisyPixelsIdx   = vNoisyPixelsIdx(1:floor(numNoisyPixels / 2));&#xA;vSaltNoisyPixelsIdx     = vNoisyPixelsIdx((floor(numNoisyPixels / 2) + 1):numNoisyPixels);&#xA;&#xA;mNoisyImage                         = mInputImage;&#xA;mNoisyImage(vPepperNoisyPixelsIdx)  = UNIT8_MAX_VALUE;&#xA;mNoisyImage(vSaltNoisyPixelsIdx)    = UNIT8_MIN_VALUE;&#xA;&#xA;&#xA;%% Image Median Filtering&#xA;&#xA;mFilteredImage = mNoisyImage;&#xA;&#xA;for iCol = 1:numCols&#xA;    for jRow = 1:numRows&#xA;        winFirstRowIdx  = max(1, (jRow - winRadius));&#xA;        winLastRowIdx   = min(numRows, (jRow + winRadius));&#xA;        winFirstColIdx  = max(1, (iCol - winRadius));&#xA;        winLastColIdx   = min(numCols, (iCol + winRadius));&#xA;        &#xA;        vRowsIdx = [winFirstRowIdx:winLastRowIdx];&#xA;        vColsIdx = [winFirstColIdx:winLastColIdx];&#xA;        &#xA;        mLocalWin = mFilteredImage(vRowsIdx, vColsIdx);&#xA;        &#xA;        mFilteredImage(jRow, iCol) = median(mLocalWin(:));&#xA;    end&#xA;end&#xA;&#xA;&#xA;%% Display Results&#xA;&#xA;hFigure = figure('Position', [100, 100, 900, 550], 'Units', 'pixels');&#xA;set(hFigure, 'Colormap', gray(256));&#xA;hAxes   = axes();&#xA;set(hAxes, 'Units', 'pixels')&#xA;set(hAxes, 'Position', [50, 50, numCols, numRows]);&#xA;hImageObject = image(mInputImage);&#xA;set(get(hAxes, 'Title'), 'String', ['Input Image'], ...&#xA;    'FontSize', titleFontSize);&#xA;&#xA;hFigure = figure('Position', [100, 100, 900, 550], 'Units', 'pixels');&#xA;set(hFigure, 'Colormap', gray(256));&#xA;hAxes   = axes();&#xA;set(hAxes, 'Units', 'pixels')&#xA;set(hAxes, 'Position', [50, 50, numCols, numRows]);&#xA;hImageObject = image(mNoisyImage);&#xA;set(get(hAxes, 'Title'), 'String', ['Noisy Image'], ...&#xA;    'FontSize', titleFontSize);&#xA;&#xA;hFigure = figure('Position', [100, 100, 900, 550], 'Units', 'pixels');&#xA;set(hFigure, 'Colormap', gray(256));&#xA;hAxes   = axes();&#xA;set(hAxes, 'Units', 'pixels')&#xA;set(hAxes, 'Position', [50, 50, numCols, numRows]);&#xA;hImageObject = image(mFilteredImage);&#xA;set(get(hAxes, 'Title'), 'String', ['Filtered Image'], ...&#xA;    'FontSize', titleFontSize);&#xA;&#xA;&#xA;&#xA;%% Restore Defaults&#xA;set(0, 'DefaultFigureWindowStyle', 'normal');&#xA;set(0, 'DefaultAxesLooseInset', defaultLooseInset);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The full MATLAB code which implements the solution is at my &lt;a href=&quot;https://github.com/RoyiAvital/StackExchangeCodes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Signal Processing StackExchange Q27298 - GitHub Repository&lt;/a&gt; (Look at the &lt;code&gt;SignalProcessing\Q27298&lt;/code&gt; folder).&lt;/p&gt;&#xA;&lt;p&gt;Enjoy...&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-03-28T06:17:52.087" LastActivityDate="2022-03-28T06:17:52.087" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="27301" PostTypeId="2" ParentId="27295" CreationDate="2015-11-25T19:17:53.937" Score="2" Body="&lt;p&gt;You should read about &lt;a href=&quot;https://en.wikipedia.org/wiki/Lab_color_space&quot; rel=&quot;noreferrer&quot;&gt;LAB Color Space&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its main advantage on RGB is by having 1 channel dedicated to the Luminosity of the Image and 2 others dedicated to the color information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means if you need to process only Luminosity / Color you can do that using LAB without having any effect on Color / Luminosity.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-11-25T19:17:53.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27303" PostTypeId="1" CreationDate="2015-11-25T20:55:00.960" Score="1" ViewCount="351" Body="&lt;p&gt;I am designing an IIR Filter with the following designs constraints:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Passband $(0.75\pi,\pi)$&lt;/li&gt;&#xA;&lt;li&gt;Stopband $(0,0.70\pi)$&lt;/li&gt;&#xA;&lt;li&gt;No more than $0.5$ % ripple in the passband&lt;/li&gt;&#xA;&lt;li&gt;No less than $40$ dB attenuation in the stopband&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;code&gt;designfilt&lt;/code&gt; command I am able to design the filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However when I am using the following code for the &quot;Butteworth&quot; filter I do not get any Phase response. The magnitude response is fine, but the Phase values have NaN values - &quot;Not a Number&quot;. The same codes are able to design for &quot;Chebyshev&quot; and &quot;Elliptic&quot; filters.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Wp = 0.75;&#xA;Ws = 0.7;&#xA;Rp = 20*log10(1.005);&#xA;Rs = 40;&#xA;&#xA;[Nb, Wnb] = buttord(Wp, Ws, Rp, Rs); % Nb: minimum order; Wnb: cutoff frequency&#xA;[Zb, Pb, Kb] = butter(Nb, Wnb,'high'); % Zb : zeros ; Pb : Poles , Kb : gain&#xA;&#xA;SOSb = zp2sos(Zb, Pb, Kb);&#xA;&#xA;freqz(SOSb)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Response for Butterworth Filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1UN7H.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1UN7H.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Response for Chebyshev I filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BYZJO.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BYZJO.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18089" LastEditorUserId="8202" LastEditDate="2015-11-26T08:09:38.287" LastActivityDate="2016-01-25T08:48:46.983" Title="IIR Filter Design Issues : MATLAB" Tags="|matlab|filter-design|" AnswerCount="1" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27306" PostTypeId="1" CreationDate="2015-11-26T01:24:15.147" Score="0" ViewCount="72" Body="&lt;p&gt;I just recognized that the bit rate of an audio file compressed in FLAC is changing during play. On the other hand, MP3 file has a fixed bit rate such as 128, 192, 320kbsp etc. But why FLAC is not? Thank you for your time.&lt;/p&gt;&#xA;" OwnerUserId="18469" LastActivityDate="2015-11-26T01:24:15.147" Title="Why is an audio compressed in FLAC(Free Lossless Audio Codec) changing its bit rate?" Tags="|audio|sampling|mp3|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27307" PostTypeId="1" CreationDate="2015-11-26T01:42:32.807" Score="1" ViewCount="4464" Body="&lt;p&gt;How can I obtain a Zero Phase Moving Average Filter? I read for example in Matlab that filtfilt give you zero phase doing forward and backward filter, I dont understand well how that work, I think taking the same number of values in the past and future can give me that, but it isnt causal right?&lt;/p&gt;&#xA;" OwnerUserId="10555" LastActivityDate="2015-11-26T10:10:32.693" Title="Zero Phase - Moving Average Filter" Tags="|filters|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27308" PostTypeId="1" AcceptedAnswerId="27311" CreationDate="2015-11-26T04:21:03.763" Score="0" ViewCount="52" Body="&lt;p&gt;I did the following things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Generated a 2 Hz sine wave (s1) with sampling frequency 1000 hz&lt;/li&gt;&#xA;&lt;li&gt;Generated a 8 Hz sine wave (s2) with sampling frequency 1000 hz&lt;/li&gt;&#xA;&lt;li&gt;combined both of them to get a new waveform (s3)&lt;/li&gt;&#xA;&lt;li&gt;created a filter with cutoff 4 Hz and gave s3 as input.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;filter used is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = fir1(7,4/fs); &#xA;&#xA;filter_out = filter(b,a,s3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where fs is sampling frequency .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expected that the filter will remove the 8 Hz component from the composite waveform (s3) and the filter output will be a 2 Hz sinewave.  ie both filter output and s1 will look alike.&#xA;But this is what i got.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BJmon.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BJmon.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is wrong with my understanding/expectation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="16089" LastEditorUserId="16089" LastEditDate="2015-11-26T04:39:46.170" LastActivityDate="2015-11-26T05:08:19.420" Title="Expected plot didn't come out!" Tags="|filters|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27310" PostTypeId="2" ParentId="27303" CreationDate="2015-11-26T04:43:02.343" Score="1" Body="&lt;p&gt;This would appear to be a bug in the &lt;code&gt;freqz&lt;/code&gt; implementation. I didn't dig enough to figure out why but even this doesn't work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz(SOSb(1:2,:));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even though &lt;code&gt;angle(freqz(SOSb(1:2,:)))&lt;/code&gt; returns a legitimate result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I found this as a workaround:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[h,f,s]=freqz(SOSb);&#xA;freqzplot(h,f,s);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately &lt;code&gt;freqzplot&lt;/code&gt; is being obsoleted so you might have to resort to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(angle(freqz(SOSb)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-11-26T04:43:02.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27311" PostTypeId="2" ParentId="27308" CreationDate="2015-11-26T05:08:19.420" Score="1" Body="&lt;p&gt;7 is a very small number of taps and you're expecting very sharp cutoff. Also, the cutoff frequency needs to be normalized such that 1.0 is half of the sample rate. Try a &lt;em&gt;much&lt;/em&gt; larger order. e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = fir1(300,4/fs/2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also beware that the beginning of the filtered output is going to have a big transient so you might try a longer waveform.&lt;/p&gt;&#xA;" OwnerUserId="15735" LastActivityDate="2015-11-26T05:08:19.420" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27312" PostTypeId="1" AcceptedAnswerId="27352" CreationDate="2015-11-26T05:47:27.017" Score="1" ViewCount="1390" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gB7rX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gB7rX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;I cannot understand how to simulate Solid State Power Amplifier (SSPA). When I directly write the Rap's SSPA model in Matlab, it does not produce BER of OFDM like published papers by other researchers'. Even no change is observed between BER with and without SSPA. But theoretically there should be significant changes between these (for low nonlinear parameter r, Asat). I have seen several matlab code in Matlab fileexchange, but those could not produce BER like published papers.  What is the wrong in my code given below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me out. &lt;a href=&quot;https://i.stack.imgur.com/lJOkW.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lJOkW.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18473" LastEditorUserId="18473" LastEditDate="2015-12-01T09:12:20.603" LastActivityDate="2017-05-10T07:34:12.020" Title="How to simulate High Power Amplifier(HPA), like Solid State Power Amplifier (SSPA)" Tags="|matlab|ofdm|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27315" PostTypeId="1" CreationDate="2015-11-26T08:03:36.777" Score="1" ViewCount="90" Body="&lt;p&gt;Is the following equation established?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$\int_{-\infty}^{\infty}s(t)r^*(t)dt=\int_W S(f)R^*(f)df $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$s(t)\xrightarrow{\text{Fourier Transform}}S(f) $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$r(t)\xrightarrow{\text{Fourier Transform}}R(f) $$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="18307" LastEditorUserId="8202" LastEditDate="2015-11-26T08:16:43.690" LastActivityDate="2015-12-27T09:26:58.207" Title="Is the following equation established?" Tags="|fourier-transform|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27316" PostTypeId="2" ParentId="27315" CreationDate="2015-11-26T09:22:36.947" Score="1" Body="&lt;p&gt;It's a version of &lt;a href=&quot;https://en.wikipedia.org/wiki/Parseval&amp;#39;s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's Theorem&lt;/a&gt;, which can be easily proved by noting that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^{\infty}s(t)r^*(t)dt=\mathcal{F}\{s(t)r^*(t)\}\big|_{f=0}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathcal{F}$ denotes the Fourier transform. Note that in general the integration limits should be $-\infty$ and $\infty$ for both integrals. I assume your notation refers to band-limited functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(1)$, the proof is quite short:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}\{s(t)r^*(t)\}=S(f)\star R^*(-f)=\int_{-\infty}^{\infty}S(\nu)R^*(\nu -f)d\nu\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes convolution. So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}\{s(t)r^*(t)\}\big|_{f=0}=\int_{-\infty}^{\infty}S(\nu)R^*(\nu)d\nu\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which establishes the equation in your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-27T09:26:58.207" LastActivityDate="2015-12-27T09:26:58.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27317" PostTypeId="2" ParentId="27307" CreationDate="2015-11-26T10:10:32.693" Score="3" Body="&lt;p&gt;A zero phase moving average filter is an odd length FIR filter with coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=\begin{cases}\frac{1}{N},&amp;amp;\quad -(N-1)/2\le n\le (N-1)/2\\0,&amp;amp;\quad\text{otherwise}\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the (odd) filter length. Since $h[n]$ has non-zero values for $n&amp;lt;0$, it is not causal, and consequently, it can only be implemented by adding a delay, i.e. by making it causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you can't simply use Matlab's &lt;code&gt;filtfilt&lt;/code&gt; function with that filter because even though you would get zero phase (with a delay), the magnitude of the filter's transfer function gets squared, corresponding to a triangular impulse response (i.e., input samples further away from the current sample receive less weight).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/9467/what-is-the-advantage-of-matlabs-filtfilt/9468#9468&quot;&gt;This answer&lt;/a&gt; explains in more detail what &lt;code&gt;filtfilt&lt;/code&gt; does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://dsp.stackexchange.com/questions/13970/can-a-causal-filter-without-phase-shifts-exist?rq=1&quot;&gt;this related question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-11-26T10:10:32.693" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27319" PostTypeId="2" ParentId="27204" CreationDate="2015-11-26T12:54:12.403" Score="1" Body="&lt;p&gt;I went with &lt;a href=&quot;https://dsp.stackexchange.com/users/90/jason-r&quot;&gt;Jason R&lt;/a&gt;'s idea of adjusting the linear filtering, except I didn't like the idea of doing a division on every output pixel, using more than just a simple kernel or how normalising that way would ruin the smooth borders. So instead I modified the kernel itself, which it turns out is done by flattening the peak of the triangle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nl9OW.gif&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like a pretty good solution, and you can see how the sum of the triangles progresses into something resembling a Gaussian function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how it's done, first of all there's a 'knee' joining the flat top with the rest of the triangle. It ping-pongs on the horizontal axis between 0 and 0.5 like so. Note: $n$ is the scale multiplier for the width of the kernel and the size of the downscaling, it's always 1 or lower, it's the reciprocal of the number displayed at the top of the animation. The smaller $n$, the smaller the output image, the wider the kernel over the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$knee = 0.5 - |(n^{-1} \mod 1) - 0.5|$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next we need to calculate the height of the top of the flattened triangle, which is done like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$m = \lfloor n^{-1} + 0.5\rfloor$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$top = \frac{1 - knee \cdot n}{2m - nm^2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally we turn it into an affine function which we can use directly when calculating weights:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c_1 = \frac{-top}{n^{-1}-knee}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c_0 = \frac{-c_1}{n}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is calculated only once and $knee$, $top$, $c_1$ and $c_0$ are stored and used when computing weights like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) =&#xA;  \begin{cases} &#xA;      \hfill top   \hfill &amp;amp; \text{ if $|x| \leq knee$ } \\&#xA;      \hfill c_1 x + c_0 \hfill &amp;amp; \text{ if $knee &amp;lt; |x| \leq n^{-1}$ } \\&#xA;      \hfill 0   \hfill &amp;amp; \text{ otherwise } \\&#xA;  \end{cases}$$&lt;/p&gt;&#xA;" OwnerUserId="18381" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-11-26T12:54:12.403" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27320" PostTypeId="2" ParentId="27194" CreationDate="2015-11-26T13:37:59.587" Score="0" Body="&lt;p&gt;I think that you should see it as doing it in one dimension and then the other, meaning you'd invert the values of every other pixel in every row, then once it's done do it again for every column, which I suppose means you can do it directly in 2D by inverting pixels in a checkered pattern like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1 -1&#xA;-1 1&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your FFT/IFFT question yes it should be lossless, save for small computation errors, and I'm not sure but it might only work with even sizes so the Nyquist and DC components can switch places. However in both cases you'll have to deal with negative pixel values, so that kind of limits you to your own algorithms, unless you do $f(v) = 0.5+0.5v$ on all your values and then undo it.&lt;/p&gt;&#xA;" OwnerUserId="18381" LastActivityDate="2015-11-26T13:37:59.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27323" PostTypeId="1" CreationDate="2015-11-26T18:24:25.880" Score="1" ViewCount="62" Body="&lt;p&gt;I have a signal with some high frequency noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first was just adding a low pass filter which removes the noise very well but has two drawbacks: First there is a delay (which I try to avoid in my application) and second, if the input signal changes suddenly (from 10% to e.g. 50% of the maximum input level), the filter removes the high frequency part too and the transition is smoothed out and/or overshoots. This is both expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A second idea I implemented is just a kind of bit reduction (in my case a fraction of a few bits). It seems that currently this is exactly what I need. Noise is perfectly removed, there is zero delay, and high frequencies are still preserved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My only question is, is there a name for this kind of filter (to investigate some further ideas)?&lt;/p&gt;&#xA;" OwnerUserId="18460" LastActivityDate="2015-11-26T18:24:25.880" Title="Is there a general name for this kind of filter?" Tags="|filters|noise|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27324" PostTypeId="2" ParentId="27272" CreationDate="2015-11-26T18:49:15.443" Score="0" Body="&lt;p&gt;May be if you substract both signals and take the absolute value you will have the segments that lag, then you can take an average  &lt;/p&gt;&#xA;" OwnerUserId="18482" LastActivityDate="2015-11-26T18:49:15.443" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27328" PostTypeId="1" CreationDate="2015-11-26T22:23:37.900" Score="0" ViewCount="770" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;This is a homework problem so please do not give a full solution. I intend to keep this at discussion-level.&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem Statement&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am given the &lt;em&gt;Power Spectral Density&lt;/em&gt; (PSD) of a DSB-Amplitude modulated signal and am told that it is corrupted with additive noise with PSD = N/2 &quot;within the passband of the signal&quot;. That signal (with noise) is demodulated and passed through a Low-Pass Filter (LPF) whose frequency spectrum is unity between -W and W. I am tasked to find the SNR at the output of the LPF. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;SNR is defined to be the ratio of (1) the power of the message component of the demodulated received signal to (2) the power of the noise component of the same demodulated received signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We just need to take the ratio: (1)/(2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the answer to question 2 (below) is yes. The power of the white noise component between -W and W is $2W*N/2 = WN$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I'm given the (plot of the) PSD of the modulated signal. Is this (1)?&lt;/li&gt;&#xA;&lt;li&gt;How does LPF affect the PSD of a signal? (Suppose we're given the plot of both the LPF (unity gain) passband and the PSD of the signal. Do we just point-wise multiply the PSD by the LPF function?). &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="18485" LastActivityDate="2016-07-24T03:18:04.787" Title="How to find SNR of received DSB:AM signal with white noise after demodulation &amp; LPF'ed?" Tags="|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27329" PostTypeId="2" ParentId="27328" CreationDate="2015-11-26T22:51:28.903" Score="1" Body="&lt;p&gt;Since you don't want a full answer, I'll just provide a couple of hints. Your calculation for the noise power is correct. Regarding your questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The power of a signal is the integral of its PSD.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You're looking for the Wiener-Khinchin theorem, and especially its application to LTI systems.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-11-26T22:51:28.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27330" PostTypeId="2" ParentId="27272" CreationDate="2015-11-27T00:20:32.017" Score="1" Body="&lt;p&gt;cross-correlation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_{x_1 x_2}(\tau) = \int x_1(t) \cdot x_2(t+\tau) \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you'll have to figure out what the appropriate limits for $t$ are in the integral.  evaluate $ R_{x_1 x_2}(\tau) $ for a variety of lags, $\tau$, both positive and negative.  see which lag gives you a maximum.  (assuming there is no polarity reversal on one of the signals.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-11-27T00:20:32.017" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27333" PostTypeId="1" AcceptedAnswerId="27334" CreationDate="2015-11-27T08:29:47.310" Score="3" ViewCount="2738" Body="&lt;p&gt;We're doing a project in which we're sending an OFDM frame, modulated to some appropriate carrier, over a channel. Before modulating, we are instructed to upsample and low-pass it. Is there a good explanation this should be done? We have full control over sample rates at both Tx and Rx. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it has something to do with an interpolated signal resembling a smooth signal more, which makes it somehow more appropriate for multiplying by a modulating function. But this is very imprecise and hand-wavy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain why one would want to upsample, given that there are no differences in sample rate between transmitter/receiver?&lt;/p&gt;&#xA;" OwnerUserId="9140" LastActivityDate="2021-10-28T18:45:14.560" Title="Why upsample before modulation?" Tags="|modulation|interpolation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27334" PostTypeId="2" ParentId="27333" CreationDate="2015-11-27T08:50:43.080" Score="6" Body="&lt;p&gt;The reason is aliasing. Because the modulation is digital, on the discrete signal, the sampling frequency should be high enough that the channel's frequency band does not extend beyond the Nyquist frequency = sampling frequency / 2. If the sampling frequency is too low, the frequencies beyond the Nyquist frequency will alias to other frequencies, meaning that you would be transmitting at the wrong frequency. By lowpass filtering before modulation, you are removing spectral images of the baseband. If those are not removed the signal has frequencies outside the baseband and similarly the modulated signal won't be contained in the channel's band.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-27T13:09:51.563" LastActivityDate="2015-11-27T13:09:51.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27337" PostTypeId="1" AcceptedAnswerId="27339" CreationDate="2015-11-27T13:49:40.177" Score="0" ViewCount="1424" Body="&lt;p&gt;I have simulation data in the time domain and I need to represent them in the frequency domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The data have been obtained time integrating the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$m \ddot{x} + c\dot{x} + kx = A \sin{(\phi(t))}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\sin{(\phi(t))}$ represents a logarithmic chirp. Therefore, since also the integrated time histories are chirps, I cannot use the FFT to transform them in the frequency-domain, but I have to do something like it was done in this answer: &lt;a href=&quot;https://dsp.stackexchange.com/questions/19779/system-response-time-vs-frequency-why-do-i-get-different-magnitudes/19851#19851&quot;&gt;system response: time vs frequency. Why do I get different magnitudes?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I used the spectrogram in this way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Resample at a constant sampling frequency&#xA;dt = 0.0001;&#xA;t0 = time(1);&#xA;tend = time(end);&#xA;new_t = t0:dt:tend;&#xA;Fs = 1/dt;&#xA;&#xA;acce_TS = timeseries(acce_cog,time);&#xA;acce_res = resample(acce_TS,new_t);&#xA;&#xA;% Spectrogram&#xA;win = hamming(256);&#xA;noverlap = 0;&#xA;nfft = 512;&#xA;X = abs(spectrogram(acce_res.data, win, noverlap, nfft,Fs));&#xA;X = 2*X/sum(win);&#xA;surf(X)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here come the problems:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) On the time axis I have wrong values: the time history lasts $49.5 \ s$ whereas in the spectrogram plot I see values from 0 to 2000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The peak response should be at nearly $30 Hz$ (which is the resonance frequency of the system, given as $f_n = \sqrt{k/m}$), whereas from the spectrogarm I see it at nearly $5 Hz$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) The amplitude of the peak of the spectrogram is a bit higher than in the time history&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) I actually need to see only the frequency-amplitude plot, not the 3D representation, so how can I do that? At the moment I am using &lt;code&gt;view([90 0])&lt;/code&gt;, but is there a way to plot directly the 2D plot?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: Here the plots&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/EmTEB.jpg&quot; width=&quot;300&quot; height=&quot;250&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sHpIZ.jpg&quot; width=&quot;300&quot; height=&quot;250&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2020-04-02T18:51:23.620" Title="Obtain the frequency response of a time domain chirp signal" Tags="|frequency-response|time-frequency|spectrogram|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27338" PostTypeId="2" ParentId="27248" CreationDate="2015-11-27T13:50:11.913" Score="0" Body="&lt;p&gt;The quadrature (or imaginary) part gives information on the phase of the component, but with a real input, both the first component (zero frequency or DC) and the last component have no such phase information available.  As described in other answers, the coefficients for this component are +-1 (just as the coefficients of the zero frequency component is all +1) so it can only measure an amplitude.  The phase of this last component will be reflected in the amplitude; a phase of zero will be full amplitude (it will also be +-1 at each sample instant), a phase of 90 degrees will zero at all sample instants.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the component could have a negative value, so &quot;no phase information&quot; may not be the perfect description.&lt;/p&gt;&#xA;" OwnerUserId="14765" LastActivityDate="2015-11-27T13:50:11.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27339" PostTypeId="2" ParentId="27337" CreationDate="2015-11-27T15:06:05.567" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;1) On the time axis I have wrong values: the time history lasts 45 s whereas in the spectrogram plot I see values from 0 to 2000&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/surf.html&quot; rel=&quot;nofollow&quot;&gt;RTFM on &lt;code&gt;surf&lt;/code&gt;.&lt;/a&gt;  You'll need to do something like &lt;code&gt;surf(new_t,new_f,X)&lt;/code&gt; instead of just &lt;code&gt;surf(X)&lt;/code&gt;.  Your &lt;code&gt;new_f&lt;/code&gt; should be something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;new_f = linspace(0,Fs/2,256);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;NOTE: I don't have access to matlab, and am not sure of the orientation of &lt;code&gt;X&lt;/code&gt;. You may have to swap the parameter locations of &lt;code&gt;new_t&lt;/code&gt; and &lt;code&gt;new_f&lt;/code&gt; on &lt;code&gt;surf&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;4) I actually need to see only the frequency-amplitude plot, not the 3D representation, so how can I do that? At the moment I am using view([90 0]), but is there a way to plot directly the 2D plot?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(new_t, max(X));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may have to do &lt;code&gt;max(X')&lt;/code&gt; instead, depending on the orientation of &lt;code&gt;X&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll need to think about answers to 2 &amp;amp; 3. Watch this space.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-27T15:13:17.737" LastActivityDate="2015-11-27T15:13:17.737" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27340" PostTypeId="1" CreationDate="2015-11-27T15:10:52.983" Score="2" ViewCount="178" Body="&lt;p&gt;I recently heard about this interesting math tool:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;With a matrix $A$, compute the &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVD&lt;/a&gt; ($ A = U \Sigma ^tV$ factorization, where $\Sigma$ is a diagonal matrix containing the &quot;singular values&quot;)&lt;/li&gt;&#xA;&lt;li&gt;Keep the $k$ biggest singular values only and discard the lowest ones (set them to $0$); this gives $\tilde{\Sigma}$.&lt;/li&gt;&#xA;&lt;li&gt;Then $ \tilde{A} = U \tilde{\Sigma} ^tV$ will be the &lt;strong&gt;best rank-$k$&lt;/strong&gt; approximation of A. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Step #2 allows to save a lot of storage size, and thus this can be thought as a compression technique. See &lt;a href=&quot;https://docs.google.com/viewer?a=v&amp;amp;pid=sites&amp;amp;srcid=ZGVmYXVsdGRvbWFpbnxuYXNsdW5kZXJpY3xneDpkMTI4OTI1NTc4YjRlOGE&quot; rel=&quot;nofollow noreferrer&quot;&gt;this example&lt;/a&gt; on image processing.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Then I wanted to try this on STFT. I did :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Audio sound ---&amp;gt; STFT ---&amp;gt; low-rank-approximation of the STFT matrix thanks to SVD ---&amp;gt; iSTFT&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The good thing is that it helps to save storage size, compression! &#xA;The bad thing is that it only resulted in &lt;strong&gt;loosing the high frequencies&lt;/strong&gt; :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original STFT (listen to the &lt;a href=&quot;http://gget.it/9echa12m/imagine.wav&quot; rel=&quot;nofollow noreferrer&quot;&gt;audio file&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WWh3L.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WWh3L.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After low-rank-approximation STFT (high frequencies more or less lost) (listen to the &lt;a href=&quot;http://gget.it/n7a0ggre/imagine(stft_svd).wav&quot; rel=&quot;nofollow noreferrer&quot;&gt;audio file&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kUXvx.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kUXvx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a way to turn this &quot;low-rank approximation of STFT&quot; into something better?&lt;/strong&gt; And if not, why?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="5648" LastEditDate="2015-11-27T17:06:44.803" LastActivityDate="2015-11-27T17:06:44.803" Title="Low-rank approximation of the STFT matrix : good audio compression technique?" Tags="|fft|audio|stft|compression|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27341" PostTypeId="1" CreationDate="2015-11-27T15:17:43.480" Score="1" ViewCount="72" Body="&lt;p&gt;There is a analog signal in the form as below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f(t)=A \sin(\omega(t) t+\phi)+B \sin(\omega(t-t_1) t+\phi_1) $$&#xA;Where $$B&amp;lt;&amp;lt;A$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are going to calculate $\phi, \phi_1, t_1 $,using dsp. But since $B&amp;lt;&amp;lt;A$ and due to quantization level limitation, we can not extract data precisely. Is there any suggetion how to deal with that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your kind replies&lt;/p&gt;&#xA;" OwnerUserId="18491" LastEditorUserId="18491" LastEditDate="2015-12-02T18:05:16.717" LastActivityDate="2015-12-02T18:05:16.717" Title="Dealing with quantization level limiting dsp" Tags="|analog|quantization|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27342" PostTypeId="1" CreationDate="2015-11-27T15:23:32.463" Score="2" ViewCount="81" Body="&lt;p&gt;Okay so I have this question for my homework which I am asked to find the fourier transform of a signal. However I am unable to obtain the correct answer, the question and my working is shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question( The answer is the equation of Xp(f) ):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uUEig.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uUEig.jpg&quot; alt=&quot;Picture of Question&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My working(Look from b) onwards):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m30js.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m30js.jpg&quot; alt=&quot;Working&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As can be seen, I am unable to get the answer. But I don't feel that I am wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="17629" LastEditorUserId="80" LastEditDate="2015-11-27T16:01:48.240" LastActivityDate="2015-11-28T21:42:36.033" Title="Unable to obtain correct correct fourier transform for homework" Tags="|fourier-transform|homework|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27344" PostTypeId="2" ParentId="27342" CreationDate="2015-11-27T16:01:27.667" Score="0" Body="&lt;p&gt;OK. Re-looking at it... $X_p(f)$ in the screenshot doesn't depend on $f$ except in the argument of the $\delta$ function... so something is missing!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh. Does your equation start with $\sin^2$ ?  That's going to be different from $|\sin|$ which is what the question says the signal is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To write that out as equation I'd try something like:&#xA;$$&#xA;\cos(0.5\pi t)\mbox{rect}(t/2)&#xA;$$&#xA;and then move it by $+1$ and $-1$&#xA;$$&#xA;\cos(0.5\pi (t-1))\mbox{rect}((t-1)/2) + \cos(0.5\pi (t+1))\mbox{rect}((t+1)/2)&#xA;$$&#xA;though I probably have the scalings wrong; please check!&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-27T16:36:59.630" LastActivityDate="2015-11-27T16:36:59.630" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27345" PostTypeId="2" ParentId="27298" CreationDate="2015-11-27T16:37:53.730" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4nUnQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4nUnQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;If the noise is really pepper (blacker dots), and not salt and pepper noise (whiter and blacker dots), a &lt;a href=&quot;http://scikit-image.org/docs/dev/auto_examples/applications/plot_rank_filters.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;rank filter&lt;/a&gt; with low rank, could be a solution. Assume you have a $3\times 3$ window, with $9$ pixel values $p_{k \in [1,\ldots,9]}$. It is likely that if a black pixel falls into the window, it will have the smallest value. So if you sort the pixel values, you get a new set of indexed pixels $p_{\sigma(k) \in [1,\ldots,9]}$, with $p_{\sigma(1)}$ the lowest, and $p_{\sigma(9)}$ the highest. Then you can replace the central pixel of the window by the second, third or fourth  lowest value $p_{\sigma(2)}$, $p_{\sigma(3)}$, or $p_{\sigma(4)}$ for instance. Would you choose the fifth lowest, you would get the median filter suggested by @Drazick, which is a special case of rank filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With pure pepper noise, rank filters with appropriate size and rank are likely to overestimate the image background a little less, depending on the level of pepper noise.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-11-29T10:33:52.973" LastActivityDate="2015-11-29T10:33:52.973" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27346" PostTypeId="1" CreationDate="2015-11-27T16:48:35.427" Score="1" ViewCount="273" Body="&lt;p&gt;I have a 6 state Kalman Filter (Unscented).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use a diagonal matrix only for Q (i.e only the diagonal has covariances), I get a &quot;smooth&quot; plot of estimate against actual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use the entire Q matrix (i.e include all covariances) I get an estimate that oscillates around actual wildly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it incorrect to just use diagonal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ADDITIONAL:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using 6 correlated Equity Stocks Price timeseries. In constructing the covariance matrix I use the difference between consecutive prices. I do NOT log the data.&lt;/p&gt;&#xA;" OwnerUserId="17802" LastEditorUserId="17802" LastEditDate="2015-11-27T17:25:11.293" LastActivityDate="2015-11-27T17:25:11.293" Title="Kalman Filter initial Q values" Tags="|kalman-filters|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27347" PostTypeId="2" ParentId="27272" CreationDate="2015-11-27T17:39:48.053" Score="2" Body="&lt;p&gt;If the signals are as you've drawn them (flat, with abrupt changes), then perhaps this approach might work:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take the absolute value of the differences between successive time samples.&lt;/li&gt;&#xA;&lt;li&gt;The non-zero entries are the transition times.&lt;/li&gt;&#xA;&lt;li&gt;Find these times for both signals.&lt;/li&gt;&#xA;&lt;li&gt;Subtract the two.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've made an attempt to do this in the R code below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &amp;gt; print(differences_in_delay)&#xA;  [1]  2 -5  2 -4 -1  5 -4  3 -3  0&#xA; &amp;gt; print(t[which(abs(diff(x2))&amp;gt;0)] - t[which(abs(diff(x1))&amp;gt;0)])&#xA;  [1]  2 -5  2 -4 -1  5 -4  3 -3  0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It breaks down when the transitions are within a sample or two of each other, but otherwise seems to work OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will also probably break down if there's noise on your signals.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;T &amp;lt;- 1024    &#xA;t &amp;lt;- seq(1,T,1)    &#xA;Nchanges &amp;lt;- 10    &#xA;times_for_changes_for_x1 &amp;lt;- sort(runif(Nchanges,T/10,9*T/10))&#xA;differences_in_delay &amp;lt;- round(runif(Nchanges,-5,5))&#xA;times_for_changes_for_x2 &amp;lt;- times_for_changes_for_x1 + differences_in_delay&#xA;changes_for_x1 &amp;lt;- runif(Nchanges,-5,5)&#xA;&#xA;x1 &amp;lt;- 0*t&#xA;x2 &amp;lt;- 0*t&#xA;change_no_x1 &amp;lt;- 1&#xA;change_no_x2 &amp;lt;- 1&#xA;&#xA;for (tm in t)&#xA;{&#xA;  if ( (change_no_x1 &amp;lt;= Nchanges) &amp;amp;&amp;amp; (tm &amp;gt; times_for_changes_for_x1[change_no_x1]))&#xA;  {&#xA;    x1[tm] &amp;lt;- x1[tm] + changes_for_x1[change_no_x1]&#xA;    change_no_x1 &amp;lt;- change_no_x1 + 1&#xA;  }&#xA;  else&#xA;  {&#xA;    if (tm &amp;gt; 1)&#xA;    {&#xA;      x1[tm] = x1[tm-1]&#xA;    }&#xA;  }&#xA;  if ( (change_no_x2 &amp;lt;= Nchanges) &amp;amp;&amp;amp; (tm &amp;gt; times_for_changes_for_x2[change_no_x2]))&#xA;  {&#xA;    x2[tm] &amp;lt;- x2[tm] + changes_for_x1[change_no_x2]&#xA;    change_no_x2 &amp;lt;- change_no_x2 + 1&#xA;  }&#xA;  else&#xA;  {&#xA;    if (tm &amp;gt; 1)&#xA;    {&#xA;      x2[tm] = x2[tm-1]&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;plot(x1,type='l')&#xA;lines(x2,col=&quot;red&quot;)&#xA;&#xA;plot(abs(diff(x1)&amp;gt;0)*1, type='l')&#xA;lines(abs(diff(x2)&amp;gt;0)*1, col=&quot;red&quot;)&#xA;&#xA;&#xA;print(differences_in_delay)&#xA;print(t[which(abs(diff(x2))&amp;gt;0)] - t[which(abs(diff(x1))&amp;gt;0)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-27T17:39:48.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27349" PostTypeId="1" CreationDate="2015-11-27T23:38:39.177" Score="12" ViewCount="31571" Body="&lt;p&gt;I have read in many places that &lt;em&gt;Moving median&lt;/em&gt; is a bit better than &lt;em&gt;Moving average&lt;/em&gt; for some applications, because it is &lt;strong&gt;less sensitive to outliers&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I wanted to test this assertion on real data, but I am unable to see this effect (green: median, red: average). See here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m3yvP.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m3yvP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Here's the &lt;a href=&quot;http://gget.it/zh9jwvh0/test.wav&quot; rel=&quot;noreferrer&quot;&gt;sample audio data test.wav&lt;/a&gt;. Here's the Python code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.io.wavfile import read&#xA;import matplotlib.pyplot as plt&#xA;&#xA;def median(lst): return np.median(np.array(lst))&#xA;def mean(lst): return sum(lst)/len(lst)&#xA;&#xA;(fs, x) = read('test.wav')&#xA;&#xA;x = abs(x)&#xA;env = np.zeros_like(x)&#xA;env2 = np.zeros_like(x)&#xA;&#xA;for i in range(len(x)):&#xA;    env[i] = median(x[max(i-1000,0):i+1])&#xA;    env2[i] = mean(x[max(i-1000,0):i+1])&#xA; &#xA;plt.plot(range(len(x)), env, color = 'green')&#xA;plt.plot(range(len(x)), env2, color = 'red')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I have tried with various values for &lt;strong&gt;Window width&lt;/strong&gt; (here in the code : 1000), and it was always the same: the moving median is not better than moving average (i.e. not less sensitive to outliers).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The same with &lt;strong&gt;Window width = 10000&lt;/strong&gt; (10000 &amp;gt;&amp;gt; the spike width) :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/e7ggG.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/e7ggG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h1&gt;Question:&lt;/h1&gt;&#xA;&lt;p&gt;&lt;strong&gt;Can you provide an example showing that moving median is less sensitive to outliers than moving average?&lt;/strong&gt; And if possible using the sample .WAV file data-set (&lt;a href=&quot;http://gget.it/zh9jwvh0/test.wav&quot; rel=&quot;noreferrer&quot;&gt;download link&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;i.e. &lt;strong&gt;is it possible to do a moving median on this data such that the result is like this yellow curve? (i.e. no more spike!)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Exdvt.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Exdvt.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2017-04-04T12:43:06.750" Title="Moving average vs. Moving median" Tags="|moving-average|window|median-filter|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27351" PostTypeId="2" ParentId="27349" CreationDate="2015-11-28T06:37:22.317" Score="5" Body="&lt;p&gt;Is moving median &lt;em&gt;always&lt;/em&gt; less sensitive to outliers? Sometimes. It will work if you have a very short spike (preferrably shorter than the median/average sample size). However, if you have a &lt;em&gt;large&lt;/em&gt; spike, then taking the median &lt;em&gt;won't&lt;/em&gt; help eliminate the spikes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long spike&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have illustrated this using a dataset (with sample size = 5, taking into account 2 left entries and 2 right entries):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Orig. Median Avg.&#xA;Data  Filter Filter&#xA;-----------------&#xA;1       &#xA;2       &#xA;3      3    3&#xA;4      4    4&#xA;5      5    11.6&#xA;6      6    19&#xA;40     40   26.2&#xA;40     40   33.2&#xA;40     40   33.4&#xA;40     40   27&#xA;7      9    20.8&#xA;8      9    14.8&#xA;9      9    9&#xA;10     10   10&#xA;11      &#xA;12&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qivC6.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qivC6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how the the median of the all the 40s is 40. For example, take the 1st 40. The left values are 5,6 and the right values are 40,40, so we get a sorted dataset of 5,6,&lt;strong&gt;40&lt;/strong&gt;,40,40 (the bolded 40 becomes our median filter result).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Short spike&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also wanted an example for the median filter to &lt;em&gt;work&lt;/em&gt;. So, we will have a short spike. Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Orig. Median Average&#xA;Data  Filter Filter&#xA;-----------------&#xA;1       &#xA;2       &#xA;3      3    3&#xA;4      4    10.8&#xA;5      5    11.6&#xA;40     6    12.4&#xA;6      7    13.2&#xA;7      8    14&#xA;8      8    8&#xA;9       &#xA;10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c0o9S.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c0o9S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that the median filter &lt;strong&gt;did&lt;/strong&gt; filter out the single large spike, while the spike skewed the average filter's results for entries &lt;code&gt;4,5,40,and,6&lt;/code&gt;.       &lt;/p&gt;&#xA;" OwnerUserId="17561" LastEditorUserId="17561" LastEditDate="2015-11-28T19:39:48.033" LastActivityDate="2015-11-28T19:39:48.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27352" PostTypeId="2" ParentId="27312" CreationDate="2015-11-28T06:45:51.293" Score="2" Body="&lt;p&gt;The model works fine.  You need to slow down and check your (or someone else's? ) steps.  I just worked through one pass of this, without pskmod, and only one value was high enough voltage to push the model into a nonlinear region.  Work through it step by step, you'll see that your x values are too low in magnitude to really get out of the linear region.  The x values have to approach A to get distortion.  &lt;/p&gt;&#xA;" OwnerUserId="18099" LastActivityDate="2015-11-28T06:45:51.293" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27354" PostTypeId="1" AcceptedAnswerId="27364" CreationDate="2015-11-28T08:58:20.670" Score="1" ViewCount="502" Body="&lt;p&gt;Here is the exercise I am working on.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Use the window design method with the Kaiser window to design a linear phase high pass FIR filter of minimum order that meets the following specification:&#xA;  $\omega_P=0.8\pi$,$\omega_S=0.7\pi$, maximum pass band error=0.1dB, minimum stopband attenuation = 75dB ( you can use Matlab but you need to ensure that the final filter meets the spec. Recall that for window design methods, the errors in pass and stopband will be equal. Be sure to take it into account in your answer)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know how to design a FIR filter using window method. What I do not understand is the last two sentences. What is &quot;the errors in pass and stopband&quot;? What it mean by &quot;take it into account&quot;?&lt;/p&gt;&#xA;" OwnerUserId="15686" LastEditorUserId="29" LastEditDate="2016-08-17T18:23:55.437" LastActivityDate="2016-08-17T18:23:55.437" Title="Design a FIR filter with a Kaiser window" Tags="|discrete-signals|filter-design|window|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27356" PostTypeId="1" AcceptedAnswerId="27359" CreationDate="2015-11-28T15:24:38.203" Score="4" ViewCount="322" Body="&lt;p&gt;I was given the original image and I need to produce Image &lt;strong&gt;1&lt;/strong&gt;. Does anybody know how I would go about this? I am on &lt;code&gt;MATLAB&lt;/code&gt;, but I am more interested in the theory behind this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original Image&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2vE0G.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2vE0G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**Processed Image **&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8ynFP.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8ynFP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt; How would you achieve this through convolution of the &lt;code&gt;fft&lt;/code&gt;s of the image and a sine wave along the vertical axis? &lt;/p&gt;&#xA;" OwnerUserId="18501" LastEditorUserId="128" LastEditDate="2018-09-20T14:44:28.590" LastActivityDate="2018-09-20T14:44:28.590" Title="How to Generate the Following Image Effect (Modulation)?" Tags="|image-processing|matlab|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27358" PostTypeId="1" AcceptedAnswerId="27362" CreationDate="2015-11-28T17:48:53.127" Score="0" ViewCount="152" Body="&lt;p&gt;Suppose you take a photo of a beautiful scene of mountains and a lake. The representation devotes half of the scale between black and white to the bright surface of the lake, and the other half to the subtle shadings of the mountains. Is it possible to change the mapping so that only ¼ of the scale is devoted to the lake's colors, and ¾ to the mountains shades? If so, how would you do it?&lt;/p&gt;&#xA;" OwnerUserId="18438" LastEditorUserId="128" LastEditDate="2020-01-24T08:34:29.927" LastActivityDate="2020-01-24T08:34:29.927" Title="Non Linear Remapping of the Pixel Values" Tags="|image-processing|pixel-wise-operation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27359" PostTypeId="2" ParentId="27356" CreationDate="2015-11-28T17:53:13.847" Score="4" Body="&lt;p&gt;The image seems to be modulated, namely multiplied by Harmonic Signal along its columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the MATLAB Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mInputImage = im2double(imread('2vE0G.png'));&#xA;numRows = size(mInputImage, 1);&#xA;numCols = size(mInputImage, 2);&#xA;&#xA;signalFreq = floor(numRows / 1.25);&#xA;&#xA;vModulationSignal = 1 + (0.5 * cos(2 * pi * (signalFreq / numRows) * [0:(numRows - 1)].'));&#xA;&#xA;mOutputImage = bsxfun(@times, mInputImage, vModulationSignal);&#xA;&#xA;figure();&#xA;imshow(mOutputImage);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/k1gkW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can play with the parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enjoy...&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2015-11-29T19:36:02.603" LastActivityDate="2015-11-29T19:36:02.603" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="27360" PostTypeId="1" AcceptedAnswerId="30549" CreationDate="2015-11-28T18:55:54.067" Score="3" ViewCount="1318" Body="&lt;p&gt;I have a task of developing an application to measure the intensity of a color in an image. I am researching about how to go about it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Intensity refers to the purity of a hue. Intensity is also known as&#xA;  Chroma or Saturation. The highest intensity or purity of a hue is the&#xA;  hue as it appears in the spectrum or on the color wheel.&#xA;  &lt;a href=&quot;http://www.uwgb.edu/heuerc/2d/colorterms.html&quot; rel=&quot;nofollow&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The image will be RGB but I can convert it HSV or any other color space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not asking for code, but just high level steps on how to do it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking of using OpenCV library for Java. &lt;/p&gt;&#xA;" OwnerUserId="18503" LastEditorUserId="128" LastEditDate="2021-09-09T08:14:45.013" LastActivityDate="2021-09-09T08:14:45.013" Title="How to Measure the Intensity / Saturation of a Color in an Image?" Tags="|image-processing|color|java|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27361" PostTypeId="1" AcceptedAnswerId="27725" CreationDate="2015-11-28T19:07:49.750" Score="0" ViewCount="518" Body="&lt;p&gt;I'm currently working on Person Identification, and using MFCC as the feature to my classifier. I have a database full of tagged(with labels) voices, and I use a CSV file to access the respective voice files. I generate the coefficients by dividing each voice file into equal frames of 1024 bytes &amp;amp; then, I find the coefficients of each frame. My problem is that all the training data isn't of the same size. Thus, the total number of coefficients vary from file to file. This dramatically affects the performance of my system. Is there any way around it? I've tried treating the whole file as a single frame, but the efficiency hasn't been very good. Any help would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="18505" LastActivityDate="2015-12-14T23:16:45.303" Title="Non Uniformity in MFCC Training Data" Tags="|mfcc|machine-learning|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27362" PostTypeId="2" ParentId="27358" CreationDate="2015-11-28T19:11:34.893" Score="3" Body="&lt;p&gt;Yes, using a non-linear mapping function on the intensity. Let us for the moment suppose you have a grayscale image (because of the words &quot;black and white&quot;, &quot;shadings&quot;), with luminance $0\leq p_{i,j} &amp;lt;1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The piecewise linear mapping: $f( p_{i,j}) = \frac{p_{i,j}}{2}$ if $p_{i,j}&amp;lt;\frac{1}{2}$, and  $f( p_{i,j}) = \frac{3}{2} (p_{i,j}-\frac{1}{2})+\frac{1}{4}$ if $p_{i,j}\geq\frac{1}{2}$ can do the job. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a simple example of &quot;Non-linear Contrast Enhancement&quot;. If that works for you, you can try with smoother functions. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-11-28T19:11:34.893" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27363" PostTypeId="2" ParentId="27360" CreationDate="2015-11-28T20:37:23.043" Score="1" Body="&lt;p&gt;You can find mapping from RGB space to HSV here:&#xA;&lt;a href=&quot;https://math.stackexchange.com/questions/556341/rgb-to-hsv-color-conversion-algorithm&quot;&gt;https://math.stackexchange.com/questions/556341/rgb-to-hsv-color-conversion-algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For other spaces, you can refer to vision modelling textbooks, i.e: Digital video quality, Stefan Winkler&lt;/p&gt;&#xA;" OwnerUserId="18491" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-11-28T20:37:23.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27364" PostTypeId="2" ParentId="27354" CreationDate="2015-11-28T21:09:44.420" Score="4" Body="&lt;p&gt;The Kaiser window has a parameter, usually called $\beta$, which is determined by the specified peak error $\delta$. For your specification, you need to determine which of the two requirements (maximum pass band error or minimum stop band attenuation) is more stringent, and choose the allowable peak error $\delta$, and hence the parameter $\beta$, accordingly.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-28T21:09:44.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27365" PostTypeId="2" ParentId="27342" CreationDate="2015-11-28T21:42:36.033" Score="2" Body="&lt;p&gt;If $x(t)$ is the (non-periodic) function in the interval $[-2,2]$, then the periodic function $x_p(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_p(t)=x(t)\star \sum_{n=-\infty}^{\infty}\delta(t-6n)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes convolution, and, consequently, its Fourier transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_p(f)=X(f)\cdot\frac16\sum_{k=-\infty}^{\infty}\delta\left(f-\frac{k}{6}\right)=&#xA;\frac16\sum_{k=-\infty}^{\infty}X\left(\frac{k}{6}\right)\delta\left(f-\frac{k}{6}\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $X(f)$ is the Fourier transform of $x(t)$. It remains to find $X(f)$. The function $x(t)$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sin\left(\frac{\pi t}{2}\right)\cdot\left[\text{rect}\left(\frac{t-1}{2}\right)-\text{rect}\left(\frac{t+1}{2}\right)\right]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the Fourier transform pairs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\sin\left(\frac{\pi t}{2}\right)&amp;amp;\Longleftrightarrow \frac{1}{2j}\left[\delta\left(f-\frac14\right)-\delta\left(f+\frac14\right)\right]\\\text{rect}\left(\frac{t\pm 1}{2}\right)&amp;amp;\Longleftrightarrow 2e^{\pm j2\pi f}\text{sinc}(2f)\end{align}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we obtain from $(3)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X(f)&amp;amp;=\frac{1}{2j}\left[\delta\left(f-\frac14\right)-\delta\left(f+\frac14\right)\right]\star 2\;\text{sinc}(2f)(e^{-j2\pi f}-e^{j2\pi f})\\&amp;amp;=2\left[\delta\left(f+\frac14\right)-\delta\left(f-\frac14\right)\right]\star\text{sinc}(2f)\sin(2\pi f)\\&#xA;&amp;amp;=2\left[\text{sinc}\left(2f+\frac12\right)\sin\left(2\pi f+\frac{\pi}{2}\right)-\text{sinc}\left(2f-\frac12\right)\sin\left(2\pi f-\frac{\pi}{2}\right)\right]\end{align}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final expression for $X_p(f)$ results from combining $(5)$ and $(2)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-28T21:42:36.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27367" PostTypeId="2" ParentId="27349" CreationDate="2015-11-29T00:21:24.487" Score="6" Body="&lt;p&gt;This isn't really an answer, but I thought I'd report what I'm seeing and ask for more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've loaded your &lt;code&gt;test.wav&lt;/code&gt; file and I can see the signal plotted below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m1Wn0.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m1Wn0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you're getting in the plots you show is not so much the median value, but is more like an envelope of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second issue is that the signal actually seems to be part of the signal. If I zoom into the blip then this is what I see:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1jqgK.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1jqgK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are you really trying to achieve?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Thanks for the feedback.  Below is some &lt;code&gt;R&lt;/code&gt; code that does the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Loads the wav file.&lt;/li&gt;&#xA;&lt;li&gt;Takes the absolute value of the signal (it's loaded into the left channel by the &lt;code&gt;waveR&lt;/code&gt; library).&lt;/li&gt;&#xA;&lt;li&gt;Performs a 100-length moving average filter on the data to get something closer to the &quot;envelope&quot; (red signal).&lt;/li&gt;&#xA;&lt;li&gt;Then applies a median filter of lengths 201, 2001, and 4001 to the result (blue signal).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From the plot below, the best performing is the 4001 length one. Otherwise the effect of the glitch is still present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/giOKX.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/giOKX.png&quot; alt=&quot;Median filtered versions for different window lengths&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I can see wrong now is that the &quot;envelope&quot; doesn't match the true envelope as well as I'd like.  A better envelope detector might improve this (e.g. the analytic signal or such).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a plot of the calculated median-filtered envelope overlaid on the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/brv9G.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/brv9G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#27349&#xA;#install.packages(&quot;tuneR&quot;)&#xA;library(tuneR)&#xA;x &amp;lt;- readWave(&quot;Q27349/test.wav&quot;)    &#xA;sig &amp;lt;- x@left    &#xA;abssig &amp;lt;- abs(sig)    &#xA;N &amp;lt;- 100&#xA;filtabssig &amp;lt;- filter(abssig, rep(1/N,N))    &#xA;plot(abs(filtabssig))    &#xA;med &amp;lt;- 0*filtabssig    &#xA;&#xA;N2median &amp;lt;- 1000 # Window length is 2 * N2median + 1&#xA;for (k in 1:length(filtabssig))&#xA;{&#xA;  idxs = seq(max(1,k-N2median), min(length(filtabssig), k+N2median),1)&#xA;  med[k] = median(filtabssig[idxs])&#xA;}&#xA;&#xA;par(mfrow=c(3,1))&#xA;plot(filtabssig, col=&quot;red&quot;)&#xA;lines(med200,col=&quot;blue&quot;)&#xA;title(&quot;Median filter length of 201&quot;)&#xA;&#xA;plot(filtabssig, col=&quot;red&quot;)&#xA;lines(med1000,col=&quot;blue&quot;)&#xA;title(&quot;Median filter length of 2001&quot;)&#xA;&#xA;plot(filtabssig, col=&quot;red&quot;)&#xA;lines(med2000,col=&quot;blue&quot;)&#xA;title(&quot;Median filter length of 4001&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-30T15:15:51.733" LastActivityDate="2015-11-30T15:15:51.733" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="27369" PostTypeId="1" CreationDate="2015-11-29T07:05:07.663" Score="2" ViewCount="259" Body="&lt;p&gt;While studying Laplace Transform i found that region of convergence (ROC) is important because for some problems we have same Laplace Transform but different ROC helps us to take correct inverse Laplace Transform.&#xA;So, Now i am practicing inverse Laplace Transform problem i found almost every probelm to find $x(t)$ is without ROC.&#xA;So i want to ask that without have ROC how can we solve inverse Laplace Transform?&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="16293" LastEditDate="2015-11-29T08:02:22.527" LastActivityDate="2015-11-29T09:09:21.877" Title="Finding Laplace Transform without ROC" Tags="|transform|laplace-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27370" PostTypeId="1" AcceptedAnswerId="27402" CreationDate="2015-11-29T07:19:26.820" Score="2" ViewCount="2528" Body="&lt;p&gt;I have a manipulator that provides the position and the velocity of its end-effector. The velocity is noisy. I've implemented a filter in C++ to determine the derivative of the position. In the below picture, the result of the filter in comparison with the velocity that the device generates is shown. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/vJ9Th.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vJ9Th.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is not that bad. If I zoom in more, there are spikes in the estimated velocity (i.e. the red curve). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nOXWi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nOXWi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These spikes cause troubles in my controller. I would like to smooth this data more. What is an efficient approach for this problem and easily to be implemented in C++ on online process? I've included the actual data &lt;code&gt;time actualVelocity estimatedVelocity&lt;/code&gt; below &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2.994 69.2363 70.7967&#xA;2.995 71.4746 68.9335&#xA;2.996 63.9789 67.7268&#xA;2.997 64.0197 68.6057&#xA;2.998 64.0499 68.9376&#xA;2.999 65.7443 69.9974&#xA;3 69.4333 70.2711&#xA;3.001 64.3986 67.7975&#xA;3.002 60.766 67.6402&#xA;3.003 63.541 67.8703&#xA;3.004 63.5812 68.9996&#xA;3.005 63.6111 69.3538&#xA;3.006 66.7847 70.4161&#xA;3.007 61.8865 67.2241&#xA;3.008 57.6895 66.992&#xA;3.009 57.7268 68.1139&#xA;3.01 57.7552 68.5353&#xA;3.011 63.9853 69.6728&#xA;3.012 60.5065 66.5398&#xA;3.013 56.1019 66.3731&#xA;3.014 56.1383 67.5572&#xA;3.015 56.1662 68.0364&#xA;3.016 56.1942 68.3706&#xA;3.017 52.5134 64.9745&#xA;3.018 49.3672 64.8698&#xA;3.019 55.5575 65.3146&#xA;3.02 55.583 65.8208&#xA;3.021 55.6029 63.6971&#xA;3.022 60.6736 63.8866&#xA;3.023 65.7919 65.3106&#xA;3.024 69.5424 65.983&#xA;3.025 62.819 63.0193&#xA;3.026 59.7945 63.9903&#xA;3.027 65.0101 64.6784&#xA;3.028 57.005 60.7158&#xA;3.029 57.0417 61.8959&#xA;3.03 51.2515 62.5295&#xA;3.031 51.2623 59.7834&#xA;3.032 57.0193 60.1369&#xA;3.033 61.3603 60.9797&#xA;3.034 58.779 59.2283&#xA;3.035 56.9265 59.7853&#xA;3.036 62.9212 61.5528&#xA;3.037 59.6156 59.0593&#xA;3.038 55.9486 59.5122&#xA;3.039 58.4439 59.3206&#xA;3.04 54.2936 57.5178&#xA;3.041 53.5189 58.1867&#xA;3.042 60.7797 60.0858&#xA;3.043 58.6784 57.7062&#xA;3.044 54.9992 58.2692&#xA;3.045 52.2677 55.7862&#xA;3.046 52.3881 57.3353&#xA;3.047 52.458 55.0719&#xA;3.048 52.6318 56.7019&#xA;3.049 60.2032 57.9943&#xA;3.05 60.213 55.6475&#xA;3.051 64.2043 56.3645&#xA;3.052 61.5772 54.9023&#xA;3.053 61.6064 55.8104&#xA;3.054 61.6064 52.4424&#xA;3.055 62.615 54.2973&#xA;3.056 63.3712 53.1572&#xA;3.057 63.405 54.234&#xA;3.058 63.4131 52.0953&#xA;3.059 60.4648 53.0826&#xA;3.06 65.9428 55.3929&#xA;3.061 62.2013 53.3822&#xA;3.062 49.7257 50.7939&#xA;3.063 49.7583 52.6719&#xA;3.064 49.7855 54.2839&#xA;3.065 40.7383 52.2356&#xA;3.066 42.5316 53.235&#xA;3.067 45.7656 52.0349&#xA;3.068 47.6251 53.1916&#xA;3.069 47.0313 51.1316&#xA;3.07 50.7313 54.2021&#xA;3.071 61.0434 55.9184&#xA;3.072 56.8516 53.7904&#xA;3.073 53.7284 54.6915&#xA;3.074 53.3688 53.3836&#xA;3.075 53.1414 54.4504&#xA;3.076 52.9485 53.191&#xA;3.077 52.8159 54.2778&#xA;3.078 58.6185 55.6848&#xA;3.079 57.2021 54.4031&#xA;3.08 56.0068 55.4162&#xA;3.081 55.089 54.0935&#xA;3.082 54.4169 55.1257&#xA;3.083 52.0654 52.9362&#xA;3.084 44.5892 51.2414&#xA;3.085 48.9719 53.2872&#xA;3.086 57.9513 54.9256&#xA;3.087 57.965 53.7357&#xA;3.088 57.9948 54.8184&#xA;3.089 54.6816 52.6628&#xA;3.09 54.2564 54.5502&#xA;3.091 53.9216 52.5363&#xA;3.092 45.9505 50.908&#xA;3.093 49.9106 52.9982&#xA;3.094 58.5814 54.6747&#xA;3.095 56.9995 53.5131&#xA;3.096 55.7105 54.6334&#xA;3.097 54.6014 53.3838&#xA;3.098 53.4868 54.4978&#xA;3.099 53.4933 52.3674&#xA;3.1 60.7252 54.3028&#xA;3.101 66.0402 55.6513&#xA;3.102 62.5392 54.6142&#xA;3.103 52.2202 51.8927&#xA;3.104 49.6543 52.8734&#xA;3.105 50.375 51.7245&#xA;3.106 51.251 52.9721&#xA;3.107 49.7411 50.9596&#xA;3.108 42.6241 49.4434&#xA;3.109 45.3093 50.7812&#xA;3.11 47.3085 49.816&#xA;3.111 47.334 51.2264&#xA;3.112 42.8512 50.2513&#xA;3.113 42.8538 48.0479&#xA;3.114 47.727 50.2688&#xA;3.115 49.3037 48.5915&#xA;3.116 48.561 49.9693&#xA;3.117 49.9082 49.0681&#xA;3.118 43.0426 46.9576&#xA;3.119 37.7041 45.6776&#xA;3.12 37.7286 47.3099&#xA;3.121 43.0863 50.2151&#xA;3.122 43.0887 48.6465&#xA;3.123 47.3152 47.3547&#xA;3.124 49.1506 48.8857&#xA;3.125 48.5832 47.1832&#xA;3.126 42.137 45.9618&#xA;3.127 47.2956 48.493&#xA;3.128 49.074 46.9782&#xA;3.129 40.5245 44.9057&#xA;3.13 43.6667 47.371&#xA;3.131 45.9253 45.9162&#xA;3.132 47.7511 48.4248&#xA;3.133 49.326 46.9107&#xA;3.134 40.9789 44.8425&#xA;3.135 44.583 47.3251&#xA;3.136 49.0912 46.7769&#xA;3.137 42.4347 44.8683&#xA;3.138 43.8255 46.4807&#xA;3.139 46.838 45.8501&#xA;3.14 40.9128 43.9865&#xA;3.141 34.5963 42.0455&#xA;3.142 40.152 44.7314&#xA;3.143 44.1766 43.4851&#xA;3.144 36.9593 41.6701&#xA;3.145 41.7885 44.4128&#xA;3.146 47.2533 44.0904&#xA;3.147 41.1964 42.3942&#xA;3.148 42.8078 44.2096&#xA;3.149 45.9244 43.7553&#xA;3.15 40.223 42.0586&#xA;3.151 36.0195 41.1673&#xA;3.152 40.9794 43.1975&#xA;3.153 42.7042 41.941&#xA;3.154 42.7103 41.1225&#xA;3.155 42.7164 40.4333&#xA;3.156 35.7873 38.9077&#xA;3.157 38.6424 40.9832&#xA;3.158 38.6486 40.7745&#xA;3.159 48.8273 42.9534&#xA;3.16 48.84 42.6373&#xA;3.161 48.3349 41.0337&#xA;3.162 37.5838 38.1872&#xA;3.163 37.5927 37.3523&#xA;3.164 37.615 40.5582&#xA;3.165 29.7713 39.6596&#xA;3.166 26.4404 38.1423&#xA;3.167 25.8594 37.5332&#xA;3.168 25.7574 36.2033&#xA;3.169 25.8087 35.7406&#xA;3.17 25.8283 38.2079&#xA;3.171 25.8276 37.1038&#xA;3.172 25.6308 35.7203&#xA;3.173 25.5471 35.2793&#xA;3.174 25.4776 34.1189&#xA;3.175 25.4314 33.8151&#xA;3.176 33.263 36.4421&#xA;3.177 36.702 35.7085&#xA;3.178 33.7323 35.3742&#xA;3.179 39.4528 37.898&#xA;3.18 43.4629 37.963&#xA;3.181 38.7537 36.7159&#xA;3.182 32.608 35.1005&#xA;3.183 28.0916 33.7598&#xA;3.184 27.279 33.4493&#xA;3.185 34.7325 36.1109&#xA;3.186 40.0501 36.3047&#xA;3.187 40.0553 37.2179&#xA;3.188 40.0572 36.1561&#xA;3.189 37.7629 35.7401&#xA;3.19 42.6337 38.2464&#xA;3.191 46.285 38.2866&#xA;3.192 40.5306 37.0151&#xA;3.193 36.3534 36.5108&#xA;3.194 33.2923 35.2624&#xA;3.195 31.0574 34.8723&#xA;3.196 31.4203 34.6467&#xA;3.197 39.4899 38.1665&#xA;3.198 43.3703 37.4697&#xA;3.199 43.3716 37.0304&#xA;3.2 42.4843 38.3303&#xA;3.201 44.1344 38.1623&#xA;3.202 41.2195 37.7719&#xA;3.203 38.6457 37.3635&#xA;3.204 36.4503 36.9779&#xA;3.205 36.4497 35.7195&#xA;3.206 42.9335 39.0159&#xA;3.207 48.0171 39.1301&#xA;3.208 48.0189 38.7185&#xA;3.209 43.855 38.247&#xA;3.21 38.7256 36.8946&#xA;3.211 43.2132 40.108&#xA;3.212 48.7904 40.1399&#xA;3.213 42.0778 38.5172&#xA;3.214 39.4119 38.995&#xA;3.215 37.462 37.5171&#xA;3.216 33.5367 36.9475&#xA;3.217 41.4155 40.2978&#xA;3.218 45.1633 39.4391&#xA;3.219 48.073 42.5853&#xA;3.22 48.0766 42.4501&#xA;3.221 48.0802 41.7886&#xA;3.222 52.2611 41.083&#xA;3.223 45.0587 39.5138&#xA;3.224 48.6285 42.552&#xA;3.225 52.9948 42.4014&#xA;3.226 47.3224 41.7404&#xA;3.227 43.2446 41.0317&#xA;3.228 38.267 39.4651&#xA;3.229 43.0282 42.5195&#xA;3.23 48.4121 42.3672&#xA;3.231 43.9171 41.7082&#xA;3.232 38.7986 40.1071&#xA;3.233 35.0193 39.3543&#xA;3.234 34.1795 38.7809&#xA;3.235 31.7445 37.3782&#xA;3.236 31.7387 36.8297&#xA;3.237 31.7329 36.4486&#xA;3.238 36.8617 38.9979&#xA;3.239 42.5141 38.9852&#xA;3.24 42.1992 39.6896&#xA;3.241 39.9799 38.438&#xA;3.242 35.8144 37.841&#xA;3.243 32.8308 36.4937&#xA;3.244 38.3231 39.7899&#xA;3.245 42.139 38.9544&#xA;3.246 37.7755 38.3927&#xA;3.247 38.5058 39.045&#xA;3.248 38.5038 37.8255&#xA;3.249 38.5001 37.2723&#xA;3.25 38.5836 36.8626&#xA;3.251 38.5807 35.6011&#xA;3.252 36.7759 35.1813&#xA;3.253 36.7727 34.0241&#xA;3.254 36.7658 33.7206&#xA;3.255 33.7419 32.6744&#xA;3.256 34.0696 33.6017&#xA;3.257 34.0621 33.6645&#xA;3.258 34.0546 33.5762&#xA;3.259 34.0715 32.5742&#xA;3.26 39.9283 36.1988&#xA;3.261 44.1935 35.6368&#xA;3.262 38.8896 35.3224&#xA;3.263 39.4722 36.2021&#xA;3.264 38.0505 35.1925&#xA;3.265 34.4752 34.8331&#xA;3.266 33.8126 34.6023&#xA;3.267 31.4175 33.5124&#xA;3.268 29.6603 33.2395&#xA;3.269 30.3045 33.1232&#xA;3.27 30.3006 32.1452&#xA;3.271 30.2928 31.983&#xA;3.272 30.7481 31.9576&#xA;3.273 29.1597 31.0678&#xA;3.274 30.4138 32.1092&#xA;3.275 30.8251 31.1444&#xA;3.276 31.1717 32.1687&#xA;3.277 40.2902 35.2798&#xA;3.278 44.357 35.5802&#xA;3.279 40.7408 35.4037&#xA;3.28 38.1993 35.1667&#xA;3.281 34.7164 34.034&#xA;3.282 32.1725 33.7212&#xA;3.283 32.1316 33.5618&#xA;3.284 30.1586 32.5428&#xA;3.285 30.6353 33.2308&#xA;3.286 30.9279 32.3771&#xA;3.287 30.9194 32.2079&#xA;3.288 30.9109 32.161&#xA;3.289 27.4029 31.2549&#xA;3.29 28.7391 32.0361&#xA;3.291 29.5937 31.2666&#xA;3.292 28.3039 31.181&#xA;3.293 29.2334 31.2124&#xA;3.294 27.9665 30.3725&#xA;3.295 27.1646 30.3319&#xA;3.296 28.5329 30.424&#xA;3.297 29.4332 30.5257&#xA;3.298 28.1585 29.7406&#xA;3.299 29.5844 30.8701&#xA;3.3 30.6576 30.2244&#xA;3.301 29.0064 30.2248&#xA;3.302 29.6929 30.3241&#xA;3.303 29.6883 29.5449&#xA;3.304 30.6179 29.56&#xA;3.305 30.6086 29.7036&#xA;3.306 30.6041 28.9771&#xA;3.307 31.2414 29.0365&#xA;3.308 33.6999 30.3354&#xA;3.309 35.5425 30.6331&#xA;3.31 34.4629 30.7551&#xA;3.311 31.7389 29.9525&#xA;3.312 29.512 29.9318&#xA;3.313 30.083 30.0461&#xA;3.314 30.9187 30.1689&#xA;3.315 31.2723 30.2854&#xA;3.316 29.4941 29.5115&#xA;3.317 28.2067 29.5232&#xA;3.318 29.1683 29.656&#xA;3.319 32.0831 30.9215&#xA;3.32 32.0732 31.1768&#xA;3.321 32.0685 30.3631&#xA;3.322 36.091 31.1904&#xA;3.323 34.8395 30.4753&#xA;3.324 32.0626 30.4296&#xA;3.325 31.9643 30.4959&#xA;3.326 31.8491 30.5763&#xA;3.327 34.1554 31.769&#xA;3.328 33.8997 31.0707&#xA;3.329 31.4239 30.9903&#xA;3.33 31.5502 31.0093&#xA;3.331 29.6005 30.1739&#xA;3.332 28.2382 30.1213&#xA;3.333 31.5653 31.3146&#xA;3.334 33.9333 31.5208&#xA;3.335 31.3705 30.6774&#xA;3.336 29.5183 30.5918&#xA;3.337 29.6373 30.635&#xA;3.338 29.6236 31.8054&#xA;3.339 27.7966 31.1012&#xA;3.34 26.8949 31.0116&#xA;3.341 28.1334 31.0214&#xA;3.342 29.5415 31.2863&#xA;3.343 30.5435 31.3366&#xA;3.344 30.7985 31.3488&#xA;3.345 30.907 31.3603&#xA;3.346 33.287 32.4672&#xA;3.347 33.2855 31.711&#xA;3.348 30.9188 31.5681&#xA;3.349 31.0431 31.528&#xA;3.35 31.123 31.5133&#xA;3.351 31.1132 31.4975&#xA;3.352 29.2816 30.6194&#xA;3.353 31.7528 32.4973&#xA;3.354 31.7478 31.8586&#xA;3.355 31.7379 31.7193&#xA;3.356 35.4215 31.6702&#xA;3.357 42.9547 35.6394&#xA;3.358 48.3931 36.013&#xA;3.359 41.8272 34.9075&#xA;3.36 39.3452 35.6026&#xA;3.361 39.4619 35.4448&#xA;3.362 37.1994 35.158&#xA;3.363 35.6164 34.8682&#xA;3.364 34.5392 34.5898&#xA;3.365 33.6621 34.3372&#xA;3.366 32.9767 34.0984&#xA;3.367 32.477 33.8769&#xA;3.368 30.2655 32.809&#xA;3.369 28.4052 32.5336&#xA;3.37 28.3878 34.3703&#xA;3.371 28.9757 34.4636&#xA;3.372 32.2261 35.3757&#xA;3.373 34.3072 35.255&#xA;3.374 31.5054 34.1168&#xA;3.375 29.6265 33.7412&#xA;3.376 30.0189 33.5136&#xA;3.377 30.8475 33.5638&#xA;3.378 31.3479 33.4168&#xA;3.379 31.2482 33.2469&#xA;3.38 29.3832 32.2208&#xA;3.381 27.9818 31.983&#xA;3.382 28.7749 31.8823&#xA;3.383 29.9162 32.0497&#xA;3.384 30.78 32.0171&#xA;3.385 28.9811 31.0909&#xA;3.386 28.9723 30.9342&#xA;3.387 28.9618 31.1522&#xA;3.388 27.4742 31.1782&#xA;3.389 27.9696 31.1712&#xA;3.39 27.9648 30.3025&#xA;3.391 30.9126 31.2947&#xA;3.392 30.9027 31.4379&#xA;3.393 30.8975 30.5705&#xA;3.394 31.452 29.5994&#xA;3.395 31.8467 30.6193&#xA;3.396 33.9053 30.8032&#xA;3.397 33.8947 30.8393&#xA;3.398 33.8886 29.9985&#xA;3.399 33.878 29.9182&#xA;3.4 33.8613 31.0569&#xA;3.401 31.1088 30.3758&#xA;3.402 31.0991 30.2978&#xA;3.403 31.0893 30.3167&#xA;3.404 31.0795 30.3566&#xA;3.405 27.3451 29.5405&#xA;3.406 26.4465 29.4868&#xA;3.407 29.8489 30.6507&#xA;3.408 32.4103 30.8561&#xA;3.409 31.8433 30.8861&#xA;3.41 29.5489 30.0287&#xA;3.411 28.1946 29.9376&#xA;3.412 29.044 29.977&#xA;3.413 27.6852 29.1848&#xA;3.414 29.0797 30.2411&#xA;3.415 31.9247 30.4421&#xA;3.416 29.677 29.647&#xA;3.417 27.8449 29.5837&#xA;3.418 28.7112 29.6437&#xA;3.419 28.7018 29.7263&#xA;3.42 28.6924 29.8011&#xA;3.421 20.9902 25.9766&#xA;3.422 15.105 25.6444&#xA;3.423 19.3495 25.9088&#xA;3.424 20.5645 25.4032&#xA;3.425 21.3979 25.6482&#xA;3.426 23.9181 26.0001&#xA;3.427 25.7664 26.3473&#xA;3.428 26.6897 26.6718&#xA;3.429 27.3415 26.9721&#xA;3.43 27.3315 27.4828&#xA;3.431 25.8452 26.6788&#xA;3.432 27.0944 27.8721&#xA;3.433 28.0074 27.1548&#xA;3.434 28.6786 28.3323&#xA;3.435 29.0908 27.5835&#xA;3.436 29.0758 28.7224&#xA;3.437 29.0652 29.0264&#xA;3.438 25.1852 28.3246&#xA;3.439 24.7808 28.3409&#xA;3.44 24.7721 28.4796&#xA;3.441 24.7633 28.6295&#xA;3.442 26.3398 28.7655&#xA;3.443 25.1244 27.8196&#xA;3.444 26.4862 28.9053&#xA;3.445 26.4862 27.2612&#xA;3.446 26.4497 23.0204&#xA;3.447 26.4401 22.7941&#xA;3.448 26.4305 23.2363&#xA;3.449 30.0122 23.7534&#xA;3.45 30.0075 23.4186&#xA;3.451 30.3645 23.7975&#xA;3.452 30.3648 24.2752&#xA;3.453 30.354 24.7327&#xA;3.454 30.3432 25.158&#xA;3.455 19.5337 20.5238&#xA;3.456 11.387 20.3844&#xA;3.457 16.4682 20.98&#xA;3.458 20.5531 21.6643&#xA;3.459 21.5333 21.482&#xA;3.46 22.1549 22.0015&#xA;3.461 24.3399 22.6027&#xA;3.462 16.7547 18.9772&#xA;3.463 9.47419 18.2617&#xA;3.464 13.2386 18.8909&#xA;3.465 17.7914 19.7059&#xA;3.466 10.3148 15.4536&#xA;3.467 4.6049 15.6832&#xA;3.468 11.5815 16.6289&#xA;3.469 17.0648 17.6317&#xA;3.47 20.5341 18.5806&#xA;3.471 21.2433 18.6231&#xA;3.472 21.9569 19.3531&#xA;3.473 14.9474 15.9219&#xA;3.474 9.90412 16.2495&#xA;3.475 15.3613 17.1692&#xA;3.476 17.5237 17.3021&#xA;3.477 17.5098 18.1175&#xA;3.478 19.378 18.999&#xA;3.479 12.8961 15.6021&#xA;3.48 7.89487 15.9492&#xA;3.481 12.0819 16.0594&#xA;3.482 15.1797 16.9493&#xA;3.483 19.2204 17.9102&#xA;3.484 19.8431 17.7638&#xA;3.485 11.0944 14.2583&#xA;3.486 11.0875 13.8408&#xA;3.487 11.0641 15.6034&#xA;3.488 5.3763 15.9661&#xA;3.489 5.33111 12.6443&#xA;3.49 10.4194 13.1836&#xA;3.491 13.4801 13.26&#xA;3.492 15.6255 14.3081&#xA;3.493 15.6204 14.6297&#xA;3.494 15.6085 15.6378&#xA;3.495 19.0612 16.6881&#xA;3.496 19.0497 17.679&#xA;3.497 19.0124 14.3328&#xA;3.498 21.5575 14.7492&#xA;3.499 23.7683 15.7589&#xA;3.5 21.3014 14.9307&#xA;3.501 21.2623 16.5389&#xA;3.502 23.495 16.8049&#xA;3.503 23.4598 13.3829&#xA;3.504 23.45 13.8405&#xA;3.505 20.944 13.8558&#xA;3.506 21.1613 14.8502&#xA;3.507 23.6943 15.9352&#xA;3.508 16.0547 12.689&#xA;3.509 8.28118 12.1668&#xA;3.51 11.8256 13.1737&#xA;3.511 16.6549 14.3664&#xA;3.512 10.7997 11.2176&#xA;3.513 4.65265 11.0435&#xA;3.514 9.47028 12.1715&#xA;3.515 12.6956 12.395&#xA;3.516 14.8339 13.5027&#xA;3.517 18.7494 14.6848&#xA;3.518 10.3646 10.6953&#xA;3.519 4.07502 11.2171&#xA;3.52 10.7807 12.4476&#xA;3.521 15.8423 13.7099&#xA;3.522 6.27385 8.74275&#xA;3.523 -0.846183 9.22821&#xA;3.524 7.31312 10.5656&#xA;3.525 11.5158 11.1574&#xA;3.526 14.6694 12.3969&#xA;3.527 9.32565 9.342&#xA;3.528 3.69836 9.28871&#xA;3.529 8.91277 10.5344&#xA;3.53 14.4524 11.9134&#xA;3.531 9.12814 8.89915&#xA;3.532 3.51611 8.88668&#xA;3.533 8.71653 10.1581&#xA;3.534 14.2435 11.5587&#xA;3.535 16.5916 12.092&#xA;3.536 18.2532 13.2504&#xA;3.537 18.2218 9.07015&#xA;3.538 18.2095 9.88375&#xA;3.539 18.2043 10.1875&#xA;3.54 23.4054 12.4554&#xA;3.541 23.4054 12.0404&#xA;3.542 17.6419 8.70047&#xA;3.543 11.1472 9.43494&#xA;3.544 11.1279 10.7873&#xA;3.545 14.2248 11.355&#xA;3.546 7.54525 8.20586&#xA;3.547 7.52779 8.99629&#xA;3.548 4.41513 10.3791&#xA;3.549 9.39163 10.9775&#xA;3.55 1.32068 6.81763&#xA;3.551 -2.80646 7.53077&#xA;3.552 4.133 8.19947&#xA;3.553 4.11697 9.6063&#xA;3.554 4.10095 11.0448&#xA;3.555 -2.19462 7.24447&#xA;3.556 -5.01679 7.98301&#xA;3.557 1.95484 8.38797&#xA;3.558 5.31162 8.94613&#xA;3.559 0.319966 5.91571&#xA;3.56 -1.63891 6.85716&#xA;3.561 6.65355 8.38671&#xA;3.562 10.9951 9.12827&#xA;3.563 11.9055 9.46156&#xA;3.564 3.06599 5.56191&#xA;3.565 -1.19867 6.37767&#xA;3.566 -1.21525 7.91064&#xA;3.567 -1.24861 4.29795&#xA;3.568 4.65486 4.21951&#xA;3.569 9.00043 5.74269&#xA;3.57 12.586 6.64978&#xA;3.571 5.67142 3.7831&#xA;3.572 2.56228 4.873&#xA;3.573 8.11363 5.76425&#xA;3.574 2.41265 2.94448&#xA;3.575 -3.91337 2.29935&#xA;3.576 0.998685 3.83854&#xA;3.577 6.69427 4.8619&#xA;3.578 1.75105 2.1142&#xA;3.579 0.281967 3.32234&#xA;3.58 -5.59206 -1.09375&#xA;3.581 -10.1899 0.0382389&#xA;3.582 0.390079 2.00954&#xA;3.583 0.355428 -1.19774&#xA;3.584 0.338276 0.137836&#xA;3.585 8.0142 2.12975&#xA;3.586 0.373597 -2.09604&#xA;3.587 0.356872 -0.869896&#xA;3.588 0.340146 1.16767&#xA;3.589 0.306535 -1.98837&#xA;3.59 -16.6841 -6.03154&#xA;3.591 -15.6592 -4.53399&#xA;3.592 -15.6806 -2.23394&#xA;3.593 -5.16985 -0.7103&#xA;3.594 -5.2027 -4.0775&#xA;3.595 -5.22049 -2.59917&#xA;3.596 -7.44088 -4.85935&#xA;3.597 -11.199 -4.92162&#xA;3.598 -4.29835 -2.85141&#xA;3.599 -5.197 -5.00553&#xA;3.6 -8.04643 -4.2727&#xA;3.601 -10.1369 -6.56157&#xA;3.602 -11.1013 -5.52588&#xA;3.603 -11.1228 -3.25123&#xA;3.604 -11.1603 -6.35483&#xA;3.605 -2.04365 -4.70267&#xA;3.606 6.27009 -2.37939&#xA;3.607 -1.26788 -6.2986&#xA;3.608 -6.85029 -4.78922&#xA;3.609 2.55966 -2.48377&#xA;3.61 -2.25953 -5.6496&#xA;3.611 -5.75823 -4.05831&#xA;3.612 -6.43697 -6.25225&#xA;3.613 -9.05772 -5.45368&#xA;3.614 -2.78693 -3.99083&#xA;3.615 -4.17667 -5.46656&#xA;3.616 -7.29433 -5.36271&#xA;3.617 -11.323 -7.72953&#xA;3.618 -10.4604 -5.88326&#xA;3.619 -2.22119 -4.46198&#xA;3.62 -2.26587 -6.6771&#xA;3.621 -2.27567 -5.86781&#xA;3.622 -6.99636 -8.85642&#xA;3.623 -7.01489 -7.04681&#xA;3.624 -8.17829 -4.5754&#xA;3.625 -10.2785 -7.61391&#xA;3.626 -13.5282 -6.64671&#xA;3.627 -3.9324 -4.33781&#xA;3.628 -7.1399 -7.42408&#xA;3.629 -9.4788 -5.73322&#xA;3.63 -8.81602 -7.85582&#xA;3.631 -10.0973 -6.73039&#xA;3.632 -10.135 -9.86513&#xA;3.633 -1.64492 -8.03469&#xA;3.634 4.65996 -6.25364&#xA;3.635 -2.68593 -9.31785&#xA;3.636 -2.70229 -7.51039&#xA;3.637 -2.71102 -5.76612&#xA;3.638 -2.75129 -7.90314&#xA;3.639 -6.45626 -6.03998&#xA;3.64 -6.46526 -4.61236&#xA;3.641 -6.49919 -7.62338&#xA;3.642 2.69985 -5.92031&#xA;3.643 -2.55867 -9.03712&#xA;3.644 -7.96961 -8.00563&#xA;3.645 -0.0749639 -5.62584&#xA;3.646 -2.53574 -7.68701&#xA;3.647 -6.3796 -6.80159&#xA;3.648 -11.3161 -9.77567&#xA;3.649 -12.8048 -7.94358&#xA;3.65 -3.54146 -6.1743&#xA;3.651 -6.55737 -8.31933&#xA;3.652 -10.8498 -8.14485&#xA;3.653 -13.8498 -10.4257&#xA;3.654 -13.8602 -9.17674&#xA;3.655 -13.8794 -6.70033&#xA;3.656 -23.083 -9.44035&#xA;3.657 -20.1565 -7.59754&#xA;3.658 -10.9859 -6.81851&#xA;3.659 -11.0269 -9.10326&#xA;3.66 -5.92705 -7.93827&#xA;3.661 -0.164666 -6.29067&#xA;3.662 -4.43565 -8.4734&#xA;3.663 -7.51559 -7.33776&#xA;3.664 -9.55375 -9.54427&#xA;3.665 -13.0669 -9.30264&#xA;3.666 -7.37936 -7.71959&#xA;3.667 -10.8035 -10.5599&#xA;3.668 -11.6553 -8.67552&#xA;3.669 -12.5859 -11.4128&#xA;3.67 -12.6046 -9.46417&#xA;3.671 -12.6158 -7.5927&#xA;3.672 -25.1555 -10.4129&#xA;3.673 -34.2201 -13.8202&#xA;3.674 -31.1251 -12.7804&#xA;3.675 -18.9966 -10.8545&#xA;3.676 -18.0085 -12.7421&#xA;3.677 -17.2536 -11.2957&#xA;3.678 -18.2518 -13.9645&#xA;3.679 -17.4329 -11.8503&#xA;3.68 -16.8929 -14.3753&#xA;3.681 -16.5205 -12.218&#xA;3.682 -16.5472 -15.6642&#xA;3.683 -6.37407 -14.294&#xA;3.684 -6.39188 -11.507&#xA;3.685 -6.42808 -13.9566&#xA;3.686 0.899313 -11.8197&#xA;3.687 0.874505 -15.3005&#xA;3.688 0.859468 -13.2471&#xA;3.689 -3.81297 -15.7129&#xA;3.69 -17.0914 -18.0544&#xA;3.691 -18.7707 -17.2986&#xA;3.692 -10.0336 -14.4287&#xA;3.693 -9.95477 -15.9877&#xA;3.694 -13.4828 -15.2346&#xA;3.695 -15.9165 -17.0942&#xA;3.696 -16.1297 -15.6085&#xA;3.697 -18.1549 -18.037&#xA;3.698 -19.5038 -16.5846&#xA;3.699 -18.9659 -18.2577&#xA;3.7 -16.638 -15.7359&#xA;3.701 -16.9755 -18.2206&#xA;3.702 -20.7505 -17.4777&#xA;3.703 -19.9003 -18.5109&#xA;3.704 -19.9003 -17.5131&#xA;3.705 -19.9449 -19.2145&#xA;3.706 -17.7008 -17.582&#xA;3.707 -17.8069 -19.1818&#xA;3.708 -17.9302 -17.5285&#xA;3.709 -19.464 -19.8402&#xA;3.71 -20.5583 -18.2615&#xA;3.711 -19.9418 -19.8399&#xA;3.712 -19.5126 -18.148&#xA;3.713 -19.2982 -19.7214&#xA;3.714 -20.5919 -18.7354&#xA;3.715 -21.7552 -20.3868&#xA;3.716 -20.994 -18.6787&#xA;3.717 -20.2462 -20.2223&#xA;3.718 -19.7761 -18.5069&#xA;3.719 -21.0871 -20.7657&#xA;3.72 -21.0982 -19.1264&#xA;3.721 -21.1438 -20.6719&#xA;3.722 -22.0126 -18.9285&#xA;3.723 -21.0774 -20.4695&#xA;3.724 -21.9093 -19.4311&#xA;3.725 -22.1681 -21.0617&#xA;3.726 -20.7368 -19.3139&#xA;3.727 -21.3232 -21.5292&#xA;3.728 -19.7558 -18.9338&#xA;3.729 -19.3918 -21.268&#xA;3.73 -30.8336 -24.0382&#xA;3.731 -30.8455 -22.2886&#xA;3.732 -30.8706 -18.9991&#xA;3.733 -40.6658 -21.909&#xA;3.734 -40.6925 -19.4092&#xA;3.735 -48.7079 -21.7416&#xA;3.736 -42.5385 -19.8449&#xA;3.737 -42.572 -22.2482&#xA;3.738 -42.6072 -24.9868&#xA;3.739 -42.6194 -23.1723&#xA;3.74 -42.6334 -20.5158&#xA;3.741 -37.6847 -22.7593&#xA;3.742 -44.1844 -25.446&#xA;3.743 -36.926 -22.6995&#xA;3.744 -33.4697 -25.4774&#xA;3.745 -32.977 -23.6511&#xA;3.746 -29.5297 -24.9441&#xA;3.747 -26.3531 -22.6824&#xA;3.748 -27.3204 -25.5468&#xA;3.749 -28.5807 -23.7301&#xA;3.75 -26.1096 -25.0323&#xA;3.751 -23.8229 -22.7666&#xA;3.752 -25.5193 -25.6313&#xA;3.753 -35.3322 -27.5894&#xA;3.754 -35.3428 -25.4963&#xA;3.755 -35.3774 -27.3289&#xA;3.756 -32.3421 -25.9059&#xA;3.757 -30.2204 -27.1541&#xA;3.758 -37.4154 -29.6536&#xA;3.759 -44.2055 -31.9792&#xA;3.76 -40.3681 -30.3435&#xA;3.761 -36.1069 -31.2901&#xA;3.762 -31.5328 -28.8053&#xA;3.763 -29.4992 -30.3844&#xA;3.764 -29.45 -28.7276&#xA;3.765 -29.4897 -29.7788&#xA;3.766 -31.1972 -32.7613&#xA;3.767 -29.2047 -29.6337&#xA;3.768 -29.0717 -31.9505&#xA;3.769 -28.8567 -28.7654&#xA;3.77 -25.8782 -30.2455&#xA;3.771 -25.6618 -27.9198&#xA;3.772 -25.8482 -29.5933&#xA;3.773 -37.3438 -32.7015&#xA;3.774 -33.7643 -29.6107&#xA;3.775 -29.5944 -31.0593&#xA;3.776 -28.4697 -28.6834&#xA;3.777 -27.5353 -30.3132&#xA;3.778 -26.8437 -28.0076&#xA;3.779 -26.3871 -29.6978&#xA;3.78 -36.3567 -32.1532&#xA;3.781 -33.4235 -29.6521&#xA;3.782 -33.4446 -32.0887&#xA;3.783 -19.1214 -28.9334&#xA;3.784 -19.1512 -30.6535&#xA;3.785 -18.2835 -32.8457&#xA;3.786 -20.9474 -31.1337&#xA;3.787 -20.9932 -31.4385&#xA;3.788 -23.7802 -33.3568&#xA;3.789 -36.0725 -36.2867&#xA;3.79 -35.1042 -33.8293&#xA;3.791 -31.2273 -34.5042&#xA;3.792 -40.0694 -37.1592&#xA;3.793 -36.194 -33.7452&#xA;3.794 -33.4102 -35.7878&#xA;3.795 -41.6268 -37.0854&#xA;3.796 -37.2414 -34.9605&#xA;3.797 -35.9189 -36.494&#xA;3.798 -42.0064 -37.6705&#xA;3.799 -37.5538 -35.489&#xA;3.8 -36.2566 -36.9926&#xA;3.801 -42.2019 -38.1454&#xA;3.802 -37.5354 -35.9301&#xA;3.803 -37.5683 -37.4004&#xA;3.804 -37.6136 -38.5284&#xA;3.805 -37.6136 -36.2849&#xA;3.806 -36.3193 -37.7346&#xA;3.807 -36.3601 -38.8507&#xA;3.808 -35.3926 -36.585&#xA;3.809 -34.6307 -38.0185&#xA;3.81 -42.4337 -39.7504&#xA;3.811 -48.3081 -41.6486&#xA;3.812 -44.1971 -39.3341&#xA;3.813 -40.4538 -40.5927&#xA;3.814 -46.0743 -42.1465&#xA;3.815 -50.6449 -43.8648&#xA;3.816 -50.6593 -40.5372&#xA;3.817 -54.6782 -41.5674&#xA;3.818 -46.9664 -38.2724&#xA;3.819 -41.4656 -39.4507&#xA;3.82 -41.4984 -41.0759&#xA;3.821 -41.5183 -43.5159&#xA;3.822 -37.9514 -40.5421&#xA;3.823 -33.3991 -40.8044&#xA;3.824 -41.6162 -43.0393&#xA;3.825 -41.6162 -40.6921&#xA;3.826 -41.6641 -41.0471&#xA;3.827 -49.7329 -42.6707&#xA;3.828 -45.3811 -40.2471&#xA;3.829 -43.3169 -42.0793&#xA;3.83 -43.3533 -43.047&#xA;3.831 -43.3679 -45.2619&#xA;3.832 -43.3897 -41.3224&#xA;3.833 -52.2654 -42.8524&#xA;3.834 -57.4693 -44.5601&#xA;3.835 -49.1798 -41.1995&#xA;3.836 -49.2348 -46.1706&#xA;3.837 -49.2503 -48.8475&#xA;3.838 -34.1132 -46.2065&#xA;3.839 -32.1 -46.2103&#xA;3.84 -30.6146 -43.2997&#xA;3.841 -29.5215 -43.4426&#xA;3.842 -39.1638 -45.5171&#xA;3.843 -49.0485 -47.7756&#xA;3.844 -42.8753 -43.6975&#xA;3.845 -39.1936 -45.0741&#xA;3.846 -47.9236 -46.6357&#xA;3.847 -41.3962 -43.1332&#xA;3.848 -37.617 -44.0344&#xA;3.849 -47.19 -46.2015&#xA;3.85 -51.9724 -47.0145&#xA;3.851 -55.425 -48.9794&#xA;3.852 -55.425 -46.214&#xA;3.853 -55.4746 -46.2348&#xA;3.854 -60.9937 -48.126&#xA;3.855 -64.0274 -49.5982&#xA;3.856 -54.2503 -45.9007&#xA;3.857 -46.8713 -46.6147&#xA;3.858 -51.9922 -47.7886&#xA;3.859 -55.8512 -49.1776&#xA;3.86 -49.8557 -46.3058&#xA;3.861 -44.9528 -46.921&#xA;3.862 -50.5194 -48.2736&#xA;3.863 -56.3158 -50.2661&#xA;3.864 -58.6885 -50.8324&#xA;3.865 -60.3881 -52.5417&#xA;3.866 -53.1371 -48.9117&#xA;3.867 -46.9074 -49.2517&#xA;3.868 -53.8973 -51.0238&#xA;3.869 -53.9429 -51.5253&#xA;3.87 -53.9429 -48.361&#xA;3.871 -53.9617 -49.6179&#xA;3.872 -57.0498 -50.1304&#xA;3.873 -57.0701 -51.8815&#xA;3.874 -57.1189 -52.3382&#xA;3.875 -59.4392 -53.9411&#xA;3.876 -51.9111 -50.0103&#xA;3.877 -51.9414 -50.4589&#xA;3.878 -47.2321 -52.1852&#xA;3.879 -47.2733 -52.6376&#xA;3.88 -47.2908 -54.2273&#xA;3.881 -54.6567 -55.3163&#xA;3.882 -57.6976 -56.0597&#xA;3.883 -60.0996 -56.9017&#xA;3.884 -63.4895 -58.2925&#xA;3.885 -55.4757 -54.2672&#xA;3.886 -55.5068 -54.2494&#xA;3.887 -55.5358 -55.0939&#xA;3.888 -48.1755 -55.8178&#xA;3.889 -54.3942 -57.264&#xA;3.89 -59.6054 -57.9556&#xA;3.891 -51.7652 -53.8438&#xA;3.892 -45.3839 -53.8513&#xA;3.893 -52.4326 -55.3045&#xA;3.894 -56.2648 -55.56&#xA;3.895 -57.3917 -56.1775&#xA;3.896 -50.5138 -52.739&#xA;3.897 -44.3999 -52.3713&#xA;3.898 -50.0124 -53.863&#xA;3.899 -56.3171 -55.0031&#xA;3.9 -61.4033 -56.581&#xA;3.901 -62.8616 -56.7953&#xA;3.902 -62.8818 -58.1094&#xA;3.903 -62.9156 -58.9594&#xA;3.904 -64.9519 -60.2471&#xA;3.905 -66.3237 -60.202&#xA;3.906 -65.2614 -60.7048&#xA;3.907 -66.8219 -61.826&#xA;3.908 -56.6842 -57.3514&#xA;3.909 -49.1042 -57.3181&#xA;3.91 -52.9914 -57.2548&#xA;3.911 -56.8542 -58.5074&#xA;3.912 -62.5185 -59.9018&#xA;3.913 -63.7326 -59.9147&#xA;3.914 -64.4597 -61.0184&#xA;3.915 -65.0646 -60.92&#xA;3.916 -55.0875 -57.066&#xA;3.917 -49.0233 -56.9691&#xA;3.918 -54.2407 -57.6924&#xA;3.919 -54.256 -53.4259&#xA;3.92 -54.3085 -58.5816&#xA;3.921 -47.4811 -54.9816&#xA;3.922 -43.6833 -55.8135&#xA;3.923 -51.4882 -56.5719&#xA;3.924 -51.4986 -52.5834&#xA;3.925 -51.531 -52.7659&#xA;3.926 -51.5593 -53.8184&#xA;3.927 -51.5917 -54.7448&#xA;3.928 -56.3892 -56.342&#xA;3.929 -56.4046 -52.3094&#xA;3.93 -56.4507 -57.605&#xA;3.931 -49.7932 -54.2973&#xA;3.932 -44.0856 -54.4954&#xA;3.933 -51.7198 -55.9895&#xA;3.934 -45.4249 -51.4332&#xA;3.935 -51.405 -57.253&#xA;3.936 -51.4161 -54.0529&#xA;3.937 -51.4496 -54.2965&#xA;3.938 -68.1287 -55.2815&#xA;3.939 -68.3577 -56.1362&#xA;3.94 -68.1634 -57.1111&#xA;3.941 -57.1605 -52.9412&#xA;3.942 -50.997 -53.8402&#xA;3.943 -57.4681 -54.967&#xA;3.944 -60.3365 -55.8773&#xA;3.945 -62.5316 -56.8839&#xA;3.946 -53.3468 -52.7398&#xA;3.947 -47.671 -53.6557&#xA;3.948 -53.1801 -54.0913&#xA;3.949 -56.9378 -55.6748&#xA;3.95 -60.9245 -56.8165&#xA;3.951 -51.9313 -52.705&#xA;3.952 -47.1659 -53.6347&#xA;3.953 -52.6942 -54.0864&#xA;3.954 -52.7128 -55.6729&#xA;3.955 -54.6726 -56.6325&#xA;3.956 -58.4406 -57.6248&#xA;3.957 -52.1512 -54.1562&#xA;3.958 -46.933 -54.3937&#xA;3.959 -52.8111 -55.4156&#xA;3.96 -57.0295 -56.312&#xA;3.961 -59.7208 -57.3204&#xA;3.962 -64.1218 -58.8128&#xA;3.963 -56.5829 -54.639&#xA;3.964 -56.6115 -54.9327&#xA;3.965 -56.6435 -55.7534&#xA;3.966 -49.2743 -56.7973&#xA;3.967 -49.2918 -58.3284&#xA;3.968 -49.3052 -54.1977&#xA;3.969 -49.3402 -59.9946&#xA;3.97 -49.3506 -56.6433&#xA;3.971 -55.1224 -56.7747&#xA;3.972 -55.1532 -57.6482&#xA;3.973 -55.1532 -54.1587&#xA;3.974 -58.1829 -54.4305&#xA;3.975 -58.2036 -55.9911&#xA;3.976 -58.7004 -56.4603&#xA;3.977 -58.7236 -57.9316&#xA;3.978 -50.6595 -54.5217&#xA;3.979 -44.9799 -54.2795&#xA;3.98 -51.5474 -55.7785&#xA;3.981 -58.775 -57.4606&#xA;3.982 -50.7011 -52.9178&#xA;3.983 -44.816 -53.8016&#xA;3.984 -51.8811 -54.8212&#xA;3.985 -56.4461 -55.9878&#xA;3.986 -56.4652 -57.6151&#xA;3.987 -56.4993 -58.522&#xA;3.988 -56.5108 -54.4853&#xA;3.989 -72.7637 -60.3172&#xA;3.99 -73.1132 -56.7874&#xA;3.991 -61.9088 -57.1012&#xA;3.992 -64.4975 -57.8389&#xA;3.993 -66.7656 -59.2797&#xA;3.994 -69.9238 -60.7507&#xA;3.995 -59.12 -55.985&#xA;3.996 -51.054 -56.6519&#xA;3.997 -55.9705 -56.9967&#xA;3.998 -59.97 -58.4328&#xA;3.999 -65.6491 -59.9626&#xA;4 -66.9753 -60.2395&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5788" LastActivityDate="2015-11-30T19:37:24.163" Title="how to smooth estimated velocity" Tags="|smoothing|c++|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27371" PostTypeId="2" ParentId="27369" CreationDate="2015-11-29T09:09:21.877" Score="4" Body="&lt;p&gt;Strictly speaking you can't because without specifying the ROC, the inverse Laplace transform is generally not unique. However, in many contexts there is the implicit assumption of causality of the corresponding time function (i.e., $x(t)=0$ for $t&amp;lt;0$), which is equivalent to stating that the ROC is a right half-plane.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-29T09:09:21.877" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27373" PostTypeId="1" CreationDate="2015-11-29T16:03:17.540" Score="3" ViewCount="76" Body="&lt;p&gt;If you printed bar codes on tracing paper/acetate etc. and then positioned several in front of one another, could you extract the individual codes from the aggregate overlaid image? I feel intuitively like there would be a limit on this, as given enough bar codes, the aggregate image would be plain black. It would be good to understand if this is possible in any circumstances and if so, what are the mathematical limits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks as though I wouldn't be able to tell the difference between black on white and white on black. However, if all the items are at slightly different positions, unlike the picture, i.e. different x,y positions and different angles, then can I distinguish each one, from a single &quot;Scan&quot;? &#xA;&lt;a href=&quot;https://i.stack.imgur.com/vKla2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vKla2.png&quot; alt=&quot;Super Imposed Bar codes&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="18513" LastActivityDate="2015-11-29T16:03:17.540" Title="Can you use Fourier transformations (or other) to read multiple superimposed barcodes?" Tags="|filters|fourier-transform|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27374" PostTypeId="1" CreationDate="2015-11-29T16:08:46.047" Score="-1" ViewCount="2765" Body="&lt;p&gt;I have figured out how to get the audio sample to be read by Matlab. I have tried to use the documentation to plot the fft, but it is giving me a plot who's frequency spike is hard to read. Am i doing this correctly? Thanks for your help.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[y,Fs] = audioread('Grand Piano - Fazioli - minor chords - Dm lower.wav');&#xA;%sound(y,Fs); &#xA;fftFs = Fs*2;&#xA;&#xA;T = 1/Fs;                     % Sample time&#xA;L= 2000;&#xA;t = (0:L-1)*T;                % Time vector&#xA;% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid&#xA;plot(Fs*t(1:50),y(1:50))&#xA;title('Signal Corrupted with Zero-Mean Random Noise')&#xA;xlabel('time (milliseconds)')&#xA;&#xA;&#xA;NFFT = 2^nextpow2(L); % Next power of 2 from length of y&#xA;Y = fft(y,NFFT)/L;&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);&#xA;&#xA;% Plot single-sided amplitude spectrum.&#xA;plot(f,2*abs(Y(1:NFFT/2+1))) &#xA;title('Single-Sided Amplitude Spectrum of y(t)')&#xA;xlabel('Frequency (Hz)')&#xA;ylabel('|Y(f)|')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lzUkb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lzUkb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18508" LastEditorUserId="18508" LastEditDate="2015-11-29T16:55:46.777" LastActivityDate="2015-11-30T06:31:15.373" Title="How do you plot the fft of an audio signal in matlab?" Tags="|matlab|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27375" PostTypeId="1" CreationDate="2015-11-29T16:43:31.597" Score="0" ViewCount="459" Body="&lt;p&gt;Let's say I have a set of data over time, &lt;code&gt;t&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0, 4, 6, 7, 7, 6, 4, 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems likely that this data would peak at &lt;code&gt;t=3.5&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a well-known algorithm for calculating this sort of peak?&lt;/p&gt;&#xA;" OwnerUserId="18514" LastActivityDate="2015-11-29T17:49:33.693" Title="Is there a relatively easy way to detect likely real-time peaks in discrete-time data?" Tags="|interpolation|peak-detection|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27376" PostTypeId="2" ParentId="27375" CreationDate="2015-11-29T17:49:33.693" Score="2" Body="&lt;p&gt;The most straight-forward solution would be to interpolate the discrete values around the maximum you're interested in, and compute the location of the maximum of the interpolating function. I'd start by using a quadratic or cubic polynomial. &lt;a href=&quot;http://www.cs.cornell.edu/~bindel/class/cs3220-s12/notes/lec21.pdf&quot; rel=&quot;nofollow&quot;&gt;This&lt;/a&gt; is a simple example of using an interpolating quadratic polynomial.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-29T17:49:33.693" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27378" PostTypeId="1" CreationDate="2015-11-30T03:52:22.993" Score="2" ViewCount="511" Body="&lt;p&gt;I'm interested in how does &quot;image synthesis&quot; in audio synthesisers such as Metasynth work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image synthesis is when a picture is read into a program and &quot;interpreted&quot; into sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how does it work?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2015-11-30T15:14:12.030" Title="How does &quot;image synthesis&quot; work?" Tags="|image-processing|fft|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27379" PostTypeId="2" ParentId="27361" CreationDate="2015-11-30T04:19:32.680" Score="-1" Body="&lt;p&gt;MFCC computation is based on spectral analysis, so you cannot feed an arbitrary signal to it in whole. The signal must be &lt;a href=&quot;https://en.wikipedia.org/wiki/Stationary_process&quot; rel=&quot;nofollow&quot;&gt;stationary&lt;/a&gt;. It's a common practice to assume that the speech signal is stationary within 25ms frame. Also it's a common practice to overlap frames by 10ms to detect transient events. Next, you cannot compare those MFCC directly. You rather should choose a pattern recognition method, such as DTW or HMM, where MFCC act as features.&lt;/p&gt;&#xA;" OwnerUserId="18297" LastEditorUserId="18297" LastEditDate="2015-11-30T05:59:27.000" LastActivityDate="2015-11-30T05:59:27.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27380" PostTypeId="1" AcceptedAnswerId="27387" CreationDate="2015-11-30T05:43:36.757" Score="0" ViewCount="656" Body="&lt;p&gt;I am attempting to apply multiple IIR filters (one band-pass, one high-pass, and one low-pass;each with &lt;code&gt;Fs&lt;/code&gt; of 44.1 kHz ) to a signal in MATLAB by using the &lt;code&gt;filter&lt;/code&gt; function.  When I apply one signal and &lt;code&gt;sound&lt;/code&gt; it, I can hear it. But as I start to apply the others, I can no longer hear the signal. I have the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; audio = handles.filename;&#xA; [x,Fs] = audioread(audio);&#xA; lowpass = IIR_Lowpass_Butterworth_CFL1000;&#xA; highpass = IIR_Highpass_Butterworth_CFH10000;&#xA; bandpass = IIR_Bandpass_Butterworth_CFL1000_CFH10000;&#xA;&#xA; y = filter(lowpass,x);&#xA; z = filter(highpass,y);&#xA; q = filter(bandpass,z);&#xA;&#xA; sound(q);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I applying the filters incorrectly?&lt;/p&gt;&#xA;" OwnerUserId="18517" LastActivityDate="2015-11-30T14:21:01.393" Title="What is the correct way to apply multiple IIR filters to a signal in MATLAB" Tags="|matlab|filters|infinite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27381" PostTypeId="2" ParentId="19329" CreationDate="2015-11-30T05:46:07.077" Score="2" Body="&lt;p&gt;If you interested in computational efficiency then performing FFTs is not the best solution. Here's something you might try: apply the samples of your .wav file to a parallel bank of 8 Goertzel filters. (One filter for each of the 8 possible tone frequencies.) For example, below is the Goertzel filter for detecting the 770 Hz tone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Monitor (measure) the output powers of the 8 filters every, say, 25 milliseconds. If the sample rate is 8000 Hz, then 25 msec means measure the 8 filter output power values every 200 input samples. So, in the figure below, apply the first 200 input samples to the filter and compute a single v(n) value. Then, and only then, compute a single complex-valued y(m) sample and single real-valued P770(m) sample. For the first 200 input samples do the same for the other 7 filters. At the end of the first 200 input samples see if two the eight Pxxx(m) power sample values exceeded some threshold value. If so, then you know a phone button key was pressed. Using some sort of logic, decode the two high-level Pxxx(m) power values to determine which key was pressed and store that single 'key number'. If no key was pushed during those first 200 input samples set the stored 'key number' value to Nan in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Repeat the above processing for every block of 200 samples in your .wav file. If your .wav file had 16,000 samples then you should end up with a sequence of 80 'key number' values. Plot those 'key number' values versus the time index m.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HDFUY.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HDFUY.jpg&quot; alt=&quot;770 Hz filter&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15347" LastEditDate="2015-11-30T08:04:03.477" LastActivityDate="2015-11-30T08:04:03.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27383" PostTypeId="1" AcceptedAnswerId="27386" CreationDate="2015-11-30T06:12:58.963" Score="0" ViewCount="18783" Body="&lt;p&gt;Which one of the following is actually a definition of frequency shift property&#xA;$$e^{j\omega_0 t}x(t)\leftrightarrow X(j\omega - \omega_0) \tag{1}$$&#xA;$$e^{j\omega_0 t}x(t)\leftrightarrow X(j(\omega - \omega_0)) \tag{2}$$&lt;hr&gt;&#xA;&lt;strong&gt;Is frequency shift applicaple in all the situations?&lt;/strong&gt;&lt;hr&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Case I&lt;br&gt;&#xA;$$1 \leftrightarrow 2\pi \delta(\omega)$$&#xA;if we apply frequency shift property we may obtain  $$e^{j\omega_0 t} \leftrightarrow 2\pi \delta(\omega -\omega_0)$$&#xA;which works according to result &lt;strong&gt;2&lt;/strong&gt;&lt;hr&gt;&#xA;Case II&#xA;$$u(t) \leftrightarrow \frac{1}{j\omega} +\pi \delta(\omega)$$&#xA;$$e^{-at} u(t)\leftrightarrow \frac{1}{a+j\omega}$$&#xA;which exactly isn't &lt;strong&gt;1&lt;/strong&gt; or &lt;strong&gt;2&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="7724" LastEditorUserId="7724" LastEditDate="2015-11-30T09:07:15.383" LastActivityDate="2015-11-30T09:07:15.383" Title="Frequency shift property of Fourier transform" Tags="|fourier-transform|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27384" PostTypeId="2" ParentId="27374" CreationDate="2015-11-30T06:31:15.373" Score="1" Body="&lt;p&gt;Try this; after your&lt;/p&gt;&#xA;&#xA;&lt;p&gt;plot(f,2*abs(Y(1:NFFT/2+1))) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;command. Insert the following command&lt;/p&gt;&#xA;&#xA;&lt;p&gt;axis([0,1,0,0.03]);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the resultant plot.  Next, change that axis() command to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;axis([0,0.5,0,0.03]);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the resultant plot.  Then in your Matlab control window type&lt;/p&gt;&#xA;&#xA;&lt;p&gt;help axis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to learn how to use Matlab's axis() command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's nitpick, &quot;if I may be so bold.&quot; (Quote borrowed from Mr. Grady in the movie The Shining.) Your y-axis label is correct but your plot title should be changed from &quot;Amplitude&quot; to &quot;Magnitude&quot;. It makes a difference. In signal processing amplitude values can be positive or negative. Magnitude values are &lt;em&gt;always&lt;/em&gt; positive and Matlab's abs() command always produces magnitude values. (In some special situations it's possible to produce spectral amplitude plots, that contain spectral phase information, but that's not what you are plotting.)&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-11-30T06:31:15.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27385" PostTypeId="1" AcceptedAnswerId="27543" CreationDate="2015-11-30T07:26:18.023" Score="3" ViewCount="968" Body="&lt;p&gt;After studying z transform from different books and literature on internet I want to ask few which makes me confuse. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) From the Discrete Time Fourier Transform we have drive equation for z transform. $$ X(z)= \sum _ {n=-\infty}^{+\infty} x[n]z^{-n}$$ where $z$ is represented in polar form $z=re^{j\omega}$&#xA;I want to know that why we represent $z$ in polar coordinates? as in some books it is written than $z$ is complex $z=\sigma + j \omega$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) ROC for $z$ transform is same as Laplace Transform? In laplace transform we check that direction of $t$ (i.e. if we have $u(t)$ than the $Re[s]  &amp;gt; a$)?&lt;/p&gt;&#xA;" OwnerUserId="18359" LastEditorUserId="80" LastEditDate="2015-11-30T13:18:36.227" LastActivityDate="2019-03-21T19:18:19.370" Title="Question about z transform" Tags="|z-transform|transform|dtft|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27386" PostTypeId="2" ParentId="27383" CreationDate="2015-11-30T08:28:32.360" Score="3" Body="&lt;p&gt;Your Eq. $(2)$ is the frequency shift property; Eq. $(1)$ is wrong. This is easy to show:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\mathcal{F}\left\{e^{j\omega_0t}x(t)\right\}=&amp;amp;\int_{-\infty}^{\infty}x(t)e^{j\omega_0t}e^{-j\omega t}dt\\&amp;amp;=\int_{-\infty}^{\infty}x(t)e^{-j(\omega-\omega_0)t}dt\\&amp;amp;=X(j(\omega-\omega_0))&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your 'Case II' has nothing to do with the frequency shift property, because it is no frequency shift. For a frequency shift you need to multiply by a &lt;em&gt;complex&lt;/em&gt; exponential $e^{j\omega_0t}$, and not by a real-valued exponential $e^{at}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You &lt;em&gt;can&lt;/em&gt; come up with a rule for the Fourier transform of $x(t)e^{-at}$, $a\in\mathbb{R}$, but this is more tricky than the frequency shift property. For the frequency shift property, if you know that $X(j\omega)$ exists, then you know for sure that also the Fourier transform of $x(t)e^{j\omega_0t}$ exists. On the other hand, if $X(j\omega)$ exists, it is not certain that also the Fourier transform of $x(t)e^{-at}$ exists. This has everything to do with the Laplace transform and its region of convergence:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\mathcal{F}\left\{x(t)e^{-at}\right\}&amp;amp;=\int_{-\infty}^{\infty}x(t)e^{-at}e^{-j\omega t}dt\\&amp;amp;=\int_{-\infty}^{\infty}x(t)e^{-(a+j\omega)t}dt\stackrel{?}{=}X(a+j\omega)\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last equality only holds if the integral converges, i.e. if $s=a$ is inside the region of convergence of the Laplace transform of $x(t)$, and if the Laplace transform of $x(t)$ has no singularities on the imaginary axis, i.e. if its Fourier transform has no Dirac delta impulses. The latter explains why the above 'rule' doesn't work for $x(t)=u(t)$ (as in your example).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-30T08:45:32.940" LastActivityDate="2015-11-30T08:45:32.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27387" PostTypeId="2" ParentId="27380" CreationDate="2015-11-30T08:48:50.877" Score="0" Body="&lt;p&gt;If you filter out all frequencies above a certain cut-off frequency by a low pass filter, and if the filter is good, then there's hardly anything left above that cut-off frequency. If you then filter out everything below a certain cut-off frequency using a high pass filter, and if that cut-off frequency is greater than the cut-off of the low pass, then you eliminate the rest. There's not much left to do for the band pass filter afterwards, because you've basically suppressed your whole signal. That's why you don't hear anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you probably wanted to do was apply the filters separately, i.e. create one low pass output, one high pass output, and one band pass output. In this case you have to filter the original signal &lt;code&gt;x&lt;/code&gt; with the three different filters to generate three different output signals.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;yl = filter(lowpass,x);&#xA;yh = filter(highpass,x);&#xA;yb = filter(bandpass,x);&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-11-30T14:21:01.393" LastActivityDate="2015-11-30T14:21:01.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27388" PostTypeId="2" ParentId="27378" CreationDate="2015-11-30T09:11:05.137" Score="4" Body="&lt;p&gt;There was something like that in Aphex Twin – Windowlicker (1999 single), visible in the spectrogram with a logarithmic frequency axis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8bHCA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8bHCA.png&quot; alt=&quot;spectrogram of Aphex Twin - Window Licker&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Windowlicker&quot; rel=&quot;nofollow noreferrer&quot;&gt;album's Wikipedia page&lt;/a&gt;, the image-to-audio conversion was made with Metasynth. I don't know the specifics of Metasynth, but a similar effect can be achieved by calculating the inverse discrete Fourier transform (IDFT) of each pixel column and concatenating the resulting time-domain frames. To make it sound smoother, the time-domain frames can be cross-faded and the phases of the frequency bins can be randomized to disperse the times when the phases of the frequencies match. The image can be distorted so that the vertical coordinate corresponds to a logarithmic frequency scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem could be stated as: How can I create an audio signal that produces a spectrogram that looks like the input image. To make a really good conversion, similar methods could be used as in &lt;a href=&quot;https://en.wikipedia.org/wiki/Audio_time-scale/pitch_modification&quot; rel=&quot;nofollow noreferrer&quot;&gt;time-scale/pitch modification&lt;/a&gt;. Some of those try to maintain phase coherence of frequencies (particularly of those that fall between frequency bins), across time-domain frames. Some of those try to maintain the time coherence of transients – things that are more concentrated in time domain than in frequency domain.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-11-30T15:14:12.030" LastActivityDate="2015-11-30T15:14:12.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27389" PostTypeId="2" ParentId="27385" CreationDate="2015-11-30T10:32:17.110" Score="1" Body="&lt;p&gt;The variable $z$ is complex, and it can be represented either in polar form $z=re^{j\phi}$ or in terms of its real and imaginary parts. The polar form is preferred because the region of convergence (ROC) is determined by $r$, the magnitude of $z$. This becomes clear if you write the term inside the sum of the definition of the $\mathcal{Z}$-transform as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]z^{-n}=x[n]r^{-n}e^{-jn\phi}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(1)$ it is clear that the value of $r$ determines the convergence of the series. This is why the ROC of the $\mathcal{Z}$-transform is specified in terms of $r=|z|$. For the bilateral $\mathcal{Z}$-transform the ROC is a ring ($a&amp;lt;|z|&amp;lt;b$, with $b&amp;gt;a\ge 0$), whereas for the unilateral $\mathcal{Z}$-transform, the ROC is outside a circle centered in the origin of the complex plane ($|z|&amp;gt;a$, $a&amp;gt;0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for the Laplace transform the complex variable $s$ occurs in the exponent, so it's the real part of $s$ that determines the ROC of the Laplace transform. These are the correspondences between the Laplace transform and the $\mathcal{Z}$-transform in terms of ROCs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&amp;amp;s\text{-plane }&amp;amp;&amp;amp;z\text{-plane}\\\\&#xA;&amp;amp;\text{right half-plane} &amp;amp;&amp;amp; \text{region outside a circle (centered at the origin)}\\&#xA;&amp;amp;\text{vertical strip} &amp;amp;&amp;amp; \text{ring (centered at the origin)}\\&#xA;&amp;amp;\text{left half-plane} &amp;amp;&amp;amp; \text{region inside a circle (centered at the origin)}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $j\omega$-axis in the $s$-plane corresponds to the unit circle in the $z$-plane, i.e. if the unit circle is part of the ROC, then the DTFT exists, and if the corresponding sequence is the impulse response of an LTI system, then the system is stable.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-11-30T10:32:17.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27390" PostTypeId="1" CreationDate="2015-11-30T11:04:37.990" Score="1" ViewCount="128" Body="&lt;p&gt;I am assuming that GAIN is the matrix P?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/18217-learning-the-unscented-kalman-filter/content/ukf.m&quot; rel=&quot;nofollow&quot;&gt;From this example:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [x,P]=ukf(fstate,x,P,hmeas,z,Q,R)&#xA;% UKF   Unscented Kalman Filter for nonlinear dynamic systems&#xA;% [x, P] = ukf(f,x,P,h,z,Q,R) returns state estimate, x and state covariance, P &#xA;% for nonlinear dynamic system (for simplicity, noises are assumed as additive):&#xA;%           x_k+1 = f(x_k) + w_k&#xA;%           z_k   = h(x_k) + v_k&#xA;% where w ~ N(0,Q) meaning w is gaussian noise with covariance Q&#xA;%       v ~ N(0,R) meaning v is gaussian noise with covariance R&#xA;% Inputs:   f: function handle for f(x)&#xA;%           x: &quot;a priori&quot; state estimate&#xA;%           P: &quot;a priori&quot; estimated state covariance&#xA;%           h: fanction handle for h(x)&#xA;%           z: current measurement&#xA;%           Q: process noise covariance &#xA;%           R: measurement noise covariance&#xA;% Output:   x: &quot;a posteriori&quot; state estimate&#xA;%           P: &quot;a posteriori&quot; state covariance&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I plot P[0,0] is that correct?&lt;/p&gt;&#xA;" OwnerUserId="17802" LastEditorUserId="80" LastEditDate="2015-11-30T13:11:54.657" LastActivityDate="2016-03-29T15:38:37.313" Title="Why does my GAIN remain constant after a few cycles?" Tags="|matlab|kalman-filters|" AnswerCount="1" CommentCount="0" ClosedDate="2016-03-29T17:45:49.187" ContentLicense="CC BY-SA 3.0" />
  <row Id="27392" PostTypeId="2" ParentId="27390" CreationDate="2015-11-30T13:09:54.463" Score="0" Body="&lt;p&gt;$P$ is the state covariance matrix, not the Kalman gain, though the Kalman gain $K$ is usually calculated using it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is normal in simple Kalman filters (ones that do not vary with time) for the state covariance matrix to stabilize after a while so that it is constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See, for example, &lt;a href=&quot;http://www.robots.ox.ac.uk/~ian/Teaching/Estimation/LectureNotes2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the plots in Figure 3(b) and 3(c) in this PDF&lt;/a&gt; which show how both the Kalman gain $K$ and the state covariance $P$ go to a constant value after a relatively short space of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because this happens, the Kalman filter evolution is often ignored in practice and the steady state version is what is implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ugPaU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ugPaU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-11-30T13:27:11.130" LastActivityDate="2015-11-30T13:27:11.130" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27394" PostTypeId="1" AcceptedAnswerId="27398" CreationDate="2015-11-30T14:26:17.023" Score="1" ViewCount="242" Body="&lt;p&gt;This is a problem from the book Discrete-Time Speech Signal Processing by Thomas Quatieri, Chapter 6 Problem 13:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose $h[n]$ is all-pole (minimum-phase) of order $p$. Show that the all-pole (predictor) coefficients can be obtained recursively from the first $p$ complex cepstral coefficients of $h[n]$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was only able to solve for the opposite. i.e. complex cepstral coefficients from the pole coefficients.&lt;/p&gt;&#xA;" OwnerUserId="18522" LastActivityDate="2015-11-30T18:58:40.557" Title="Recursively obtaining all-pole coefficients from complex cepstral coefficients?" Tags="|speech-processing|cepstral-analysis|poles-zeros|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27395" PostTypeId="1" CreationDate="2015-11-30T16:32:42.723" Score="0" ViewCount="401" Body="&lt;p&gt;I am trying to estimate to &quot;next&quot; price of a stock, based on a group of 5 other correlated stocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe this is a 6 state unscented Kalman problem. However, I do not know how to describe &lt;code&gt;f()&lt;/code&gt;. I am measuring the &quot;price&quot; of the stock at end of day. i.e. I get one price per stock per day, and I have a set of 6 stocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;code&gt;f()&lt;/code&gt; is the deterministic part of the state update equation in the unscented Kalman filter :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x_k+1 = f(x_k) + w_k&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/18217-learning-the-unscented-kalman-filter/content/ukf.m&quot; rel=&quot;nofollow&quot;&gt;which is implemented here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to estimate tomorrow's EOD price for stock A, based on an UKF that considers stocks B-F as well. But I don't not need to estimate stocks B-F.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What might &lt;code&gt;f()&lt;/code&gt; look like? &lt;/p&gt;&#xA;" OwnerUserId="17802" LastEditorUserId="80" LastEditDate="2015-11-30T16:45:54.850" LastActivityDate="2015-11-30T16:45:54.850" Title="What f() for unscented kalman filter for stock trading?" Tags="|matlab|kalman-filters|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27396" PostTypeId="1" AcceptedAnswerId="31067" CreationDate="2015-11-30T16:47:22.303" Score="0" ViewCount="147" Body="&lt;p&gt;I have a system that is controlled by a PID controller. I tune the controller to track a reference signal that is a unit step function.&#xA;Is there a way to extend the obtained results to be able to track any step function with arbitrary start end end value that occurs at an arbitrary time instant?&lt;/p&gt;&#xA;" OwnerUserId="13475" LastActivityDate="2016-05-26T06:49:19.180" Title="How to tune PID parameters to track a family of reference signals?" Tags="|control-systems|tracking|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27397" PostTypeId="1" AcceptedAnswerId="27399" CreationDate="2015-11-30T17:39:17.520" Score="1" ViewCount="11089" Body="&lt;p&gt;I was computing an inverse z-transform here, and I am facing some problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the z-transform is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(z) = \frac{2+3z^{-1}}{1 - z^{-1} + 0.81z^{-2}} , |z| &amp;gt; 0.9 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the following poles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ p_1 = 0,5 + j0,7483 $$&#xA;$$ p_2 = 0,5 - j0,7483 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then, the following residues:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ R_1 = 1 - j2,6727 $$&#xA;$$ R_2 = 1 + j2,6727 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rewriting $ X(z) $ with the poles in polar coordinates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(z) = \frac{1 - j2,6727}{1 - 0,9 \angle 56,25^{\circ}} + \frac{1 + j2,6727}{1 - 0,9 \angle -56,25^{\circ}}  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Through the magnitude of the poles, I can see that they are both inside the ROC, then, I can write $ x(n) $ as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(n) = (1 - j2,6727)(0,9 \angle 56,25^{\circ})^{n}u(n) + (1 + j2,6727)(0,9 \angle -56,25^{\circ})^{n}u(n) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that it is possible to write $ x(n) $ in a form without complex numbers. I know this, because it was asked and I was able to plot the figure in Matlab using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;delta = zeros(30, 1);&#xA;delta(1) = 1;&#xA;&#xA;a = [1 -1 0.81];&#xA;b = [2 3];&#xA;&#xA;x = filter(b, a, delta);&#xA;n = 0:29;&#xA;&#xA;figure&#xA;stem(n, x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is, what I did up to now is right? If it is, How can I compute $ x(n) $ without complex numbers? Is there any tips that you can give me to follow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="4298" LastEditDate="2015-11-30T20:14:55.927" LastActivityDate="2015-12-01T12:58:42.500" Title="Inverse Z-transform with complex conjugate poles" Tags="|z-transform|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27398" PostTypeId="2" ParentId="27394" CreationDate="2015-11-30T17:41:17.453" Score="1" Body="&lt;p&gt;If $h[n]$ is the impulse response of an all-pole minimum-phase filter of order $p$, then we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{Z}\{h[n]\}=H(z)=\frac{G}{1-\displaystyle\sum_{k=1}^pa_kz^{-k}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $G$ is some gain value, and $a_k$ are the predictor coefficients. Let $\hat{h}[n]$ be the complex cepstral coefficients of $h[n]$. If you know how to compute $\hat{h}[n]$ from $a_k$, then you're probably familiar with the following recursion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{h}[n]=a_n+\frac{1}{n}\sum_{k=1}^{n-1}ka_{n-k}\hat{h}[k],\quad 0&amp;lt;n\le p\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(2)$ you can formulate a recursion for $a_k$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_n=\hat{h}[n]-\frac{1}{n}\sum_{k=1}^{n-1}ka_{n-k}\hat{h}[k],\quad 1&amp;lt;n\le p\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the initial value $a_1=\hat{h}[1]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="80" LastEditDate="2015-11-30T18:58:40.557" LastActivityDate="2015-11-30T18:58:40.557" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27399" PostTypeId="2" ParentId="27397" CreationDate="2015-11-30T17:58:08.550" Score="2" Body="&lt;p&gt;Since the given $\mathcal{Z}$-transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{2+3z^{-1}}{1-z^{-1}+0.81z^{-2}},\quad |z|&amp;gt;0.9\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has real-valued coefficients, its poles and zeros must be either real-valued or they must occur in complex conjugate pairs. The poles of $(1)$ are a complex conjugate pair:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p_1=0.5 + 0.74833j=re^{j\phi}=p\\&#xA;p_2=0.5 - 0.74833j=re^{-j\phi}=p^*$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $r=0.9$ and $\phi=0.98177$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can proceed from the partial fraction expansion of $X(z)$, which you correctly obtained:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\frac{A}{1-pz^{-1}}+\frac{A^*}{1-p^*z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the given region of convergence (ROC) $|z|&amp;gt;0.9$, we know that we're looking for a causal sequence $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\left(Ap^n+A^*(p^*)^n\right) u[n]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $p=re^{j\phi}$ and $A=|A|e^{j\phi_A}$, $(3)$ can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=|A|r^n\left(e^{j(n\phi+\phi_A)}+e^{-j(n\phi+\phi_A)}\right)u[n]=&#xA;2|A|r^n\cos(n\phi+\phi_A)u[n]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is of course real-valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the given values of $p$ and $A$ the impulse response looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/otHtA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/otHtA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-01T12:58:42.500" LastActivityDate="2015-12-01T12:58:42.500" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27400" PostTypeId="1" CreationDate="2015-11-30T19:17:19.627" Score="1" ViewCount="7047" Body="&lt;p&gt;The sampling frequency for band pass signal which is having frequency from 4 kHz to 6 kHz(rectangular shape from 4 to 6 kHz), can I prefer the sampling frequency of 12 kHz(2*the highest frequency present is message signal) or 6 kHz  (2*bandwidth of message signal(6-4)kHz), can u please suggest which one to prefer?&lt;/p&gt;&#xA;" OwnerUserId="18528" LastActivityDate="2015-12-02T18:08:00.290" Title="sampling rate for band pass signal" Tags="|frequency|sampling|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27402" PostTypeId="2" ParentId="27370" CreationDate="2015-11-30T19:37:24.163" Score="2" Body="&lt;p&gt;As a first step, try just a simple first order smoother on your already-smoothed (but still too spiky) data:&#xA;$$&#xA;v_f[n] = (1-\alpha) v_f[n-1] + \alpha v[n]&#xA;$$&#xA;where $v_f$ is the velocity with extra filtering, $v$ is your current filtered velocity, and $0 \lt \alpha \lt 1$, and usually close to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I do this in the &lt;code&gt;R&lt;/code&gt; code below, then I get the green line in the plot below (overlaying your noisy and smoothed data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4TokI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4TokI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alpha &amp;lt;- 0.9&#xA;num &amp;lt;- c(1-alpha)&#xA;den &amp;lt;- c(1, -alpha)&#xA;vfilt &amp;lt;- signal::filter(num, den, data2[,3], data2[1,3])&#xA;plot(data2[,2])&#xA;lines(data2[,3],co=&quot;red&quot;)&#xA;lines(vfilt,col=&quot;green&quot;, lwd=5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-11-30T19:37:24.163" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27403" PostTypeId="2" ParentId="27400" CreationDate="2015-11-30T21:36:02.117" Score="3" Body="&lt;p&gt;Sampling is frequency domain convolution by a frequency domain impulse train with the impulses spaced apart by the sampling frequency. If there is overlap between the images thus created, then there will be information loss. As you can see in the illustration below, all of the sampling frequencies $f_s$ = 12 kHz, $f_s$ = 6 kHz, and $f_s$ = 4 kHz will work fine. I tilted the band tops to indicate positive and negative frequencies. The first curve is the signal's spectrum before sampling. The unit is kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/G2gXN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G2gXN.png&quot; alt=&quot;Sampling at different frequencies&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a small sampling frequency has the benefit that any processing will have less samples that need to be computed per time unit. For example filters designed to a performance specification can be lower-order than with a higher sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes it is useful if the signal is oversampled though. Things like polynomial interpolation work better because of the more dense sampling. A Hilbert transformer would have more room for the transition band. If processing is non-linear, it may be possible to avoid aliasing of harmonics by filtering after the non-linear processing; with critical sampling the harmonics might alias and contaminate the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a low sampling frequency (6 kHz or 4 kHz) that aliases the bands may require more work later if you need to have the band back at the original frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the optimal sampling frequency depends on what you are going to do with the signal.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-12-01T09:42:30.883" LastActivityDate="2015-12-01T09:42:30.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27404" PostTypeId="2" ParentId="27400" CreationDate="2015-11-30T21:43:13.793" Score="2" Body="&lt;p&gt;You don't specify what you intend to do with the samples, but I woudn't sample at either of the two frequencies you're contemplating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The well-known (bandpass) sampling formulas indicate that, if your purpose is to reconstruct the original signal from its samples, you may sample at either 4 kHz, anywhere between 6 and 8 kHz, or above 12 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, these calculations are only valid if there is no signal at the very ends of the spectrum, which is not true in your case. That means you shouldn't sample at exactly 4, 6, 8 or 12 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Recall that a continuous signal sampled at rate $f_s$ will keep its original spectrum, and in addition its spectrum will be replicated and shifted up and down to all integer multiples of $f_s$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sample at 12 kHz, the rectangular spectrum at 4-6 kHz will be adjacent to a rectangular replica at 6-8 kHz. I would sample higher than 12 kHz to avoid this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sample at 6 kHz, you'll get two adjacent rectangles, one at -2 to 0 kHz and another at 0 to 2 kHz. This is also undesirable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to demodulate the signal using bandpass sampling, you may sample at 5 kHz. That gives you a spectrum replica centered at 0 Hz, and with some care you may be able to low-pass filter it appropriately.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-11-30T21:43:13.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27406" PostTypeId="1" CreationDate="2015-11-30T22:59:40.827" Score="0" ViewCount="288" Body="&lt;p&gt;I am trying to calculate the original equation using a DFT. I start with a equation, generate values from this equation and then get the dft of these values. The aim is to generate the original equation using the dft values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following equation&#xA;$$f(t) = 1 + 0.75\cos(2\pi t/4) + 0.2\cos(4\pi t/4) + 0.5\cos(6\pi t/4)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;original signal for $t=[0,1,2,3]\Rightarrow [2.45,0.80,-0.05,0.80]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DFT: $[4,2.5,0.8,2.5]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From DFT (i.e $[4,2.5,0.8,2.5]$) how do I retrieve the coefficient $0.75, 0.2$ and $0.5$ present in the original equation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Ambi.&lt;/p&gt;&#xA;" OwnerUserId="18529" LastEditorUserId="18529" LastEditDate="2015-12-01T00:57:05.140" LastActivityDate="2015-12-01T12:14:53.310" Title="Calculating original signal from Discerete Fourier Transform" Tags="|fourier-transform|dft|fourier|fourier-series|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27408" PostTypeId="1" AcceptedAnswerId="27596" CreationDate="2015-12-01T00:03:24.043" Score="3" ViewCount="411" Body="&lt;p&gt;I'm trying to compute using matlab the mutual information for an $ \infty $-PAM input (the limit of a very dense PAM constellation) for a range of snr and I got stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working with a real-valued scalar Gaussian channel with input power constrained to unity and standard Gaussian noise $ N \sim (0, 1) $. The output of the channel is given by, &#xA;$$ y = \sqrt{ \gamma } x + n $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that under the power input constraint the input is uniformly distributed on $ \left[ -\sqrt{ 3 }, \sqrt{ 3 } \right] $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found that in HIGH-SNR regime, there exists a gap between the Shannon capacity and the capacity achieved with $ \infty $-PAM around 0.254 bits. I know this is called the shaping loss and represents the loss of using an uniform input rather than a Gaussian input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to compute that. But, I got stuck trying to compute the capacity for a range of snr or $ \gamma $. I tried using the formula,&#xA;$$ I(x;y) = h(y) - h(n) $$&#xA;with $ f_{y}(y) = \int f_{x}(x)f_{y|x}(y|x) dx $ and I got&#xA;$$ f_{y} (y) = \frac{ 1 }{ 2 \sqrt{ 3 \gamma } } \frac{ 1 }{ 2 } \int_{ \frac{ y - \sqrt{3} }{ \sqrt{2} } }^{ \frac{ y + \sqrt{3} }{ \sqrt{2} } } \frac{ 2 }{ \sqrt{ \pi } } e^{ -t^{2} } dt \\&#xA;= \frac{ 1 }{ 2 \sqrt{ 3 \gamma } } \frac{ 1 }{ 2 } \left[ \text{erf} \left( \frac{ y + \sqrt{ 3 \gamma } }{ \sqrt{ 2 } } \right) - \text{erf} \left( \frac{ y - \sqrt{ 3 \gamma } }{ \sqrt{ 2 } } \right) \right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to compute $ h(y) = \int_{-\infty}^{\infty} f_{y} (y) \log_{2} f_{y} (y) $ and the integral does not converge. I tried with int$(\cdot)$ and integral$(\cdot)$ methods in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried approximating the $ \text{erf}(\cdot) $ function with Taylor series expansion&#xA;$$ erf(x) = \frac{ 2 }{ \sqrt{ \pi } } \sum_{ n = 0 }^{ \infty } \frac{ (-1)^{n} x^{ 2n + 1 } }{ n!(2n + 1) } $$&#xA;but it didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I obtain a more manageable integral? Is my approach correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate any help!! Thanks.&lt;/p&gt;&#xA;" OwnerUserId="18045" LastEditorUserId="18045" LastEditDate="2015-12-01T11:14:54.327" LastActivityDate="2016-11-10T00:15:42.487" Title="Mutual information of $ \infty $-PAM" Tags="|matlab|digital-communications|gaussian|information-theory|integration|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27411" PostTypeId="1" AcceptedAnswerId="27435" CreationDate="2015-12-01T08:04:17.100" Score="0" ViewCount="649" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose we have a DSBSC signal given by :&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$s(t) = 10 \cos (2\pi f t + \phi ) \cdot m(t) $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where carrier is random signal with phase ($\phi$) uniformly&#xA;  distributed in $[0,2\pi]$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If the power spectral density of the message signal $m(t)$ is :&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8BOMx.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8BOMx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Q.How can I express the power spectral density of $s(t)$ in terms of given PSD of $m(t)$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My attempt:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By Wiener–Khinchin relations,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Autocorrelation of $m(t) = 3 \mathrm{sinc}^2(3000t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to get the autocorrelation of $s(t)$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{ss} (T) = E[ x(t)x^*(t+T)\cdot m(t) m^*(t+T) ]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x(t)$ is the carrier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I assume they are independent, then : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{ss}(T) = R_{mm}(T) R_{xx}(T)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives me     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_{ss}(T) = 150\cos(2\pi T)\cdot\mathrm{sinc}^2(3000T)$$&lt;/p&gt;&#xA;" OwnerUserId="18535" LastEditorUserId="8202" LastEditDate="2015-12-01T09:20:43.343" LastActivityDate="2015-12-01T20:34:22.217" Title="Correlation in DSBSC modulation" Tags="|modulation|autocorrelation|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27414" PostTypeId="2" ParentId="27400" CreationDate="2015-12-01T10:58:23.783" Score="1" Body="&lt;p&gt;The lowest acceptable values for the $f_s$ sample rate, to avoid spectral replication overlap (what many people call &quot;aliasing&quot;), are described by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3ecOZ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3ecOZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_c$ and $B$ are the center freq and bandwidth of your analog bandpass signal. Variable $m$ is an integer. Set $f_c$ = 5 kHz, $B$ = 2 kHz, and $m$ = 1. The above expression's two ratios will be 8 kHz and 6 kHz.  So your $f_s$ can be anywhere in the range of 6 -to- 8 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you then set $m$ = 2, then the two ratios will be 4 kHz and 4 kHz. So your $f_s$ can be 4 kHz. If you next set $m$ = 3 the two ratios will be 2.667 kHz and 3 kHz.  Values in that freq range are less than $2B$, violate Nyquist, and cannot be used. Stop at this point because there's no reason to set $m$ to a value larger than 3.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-01T10:58:23.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27415" PostTypeId="2" ParentId="27406" CreationDate="2015-12-01T12:14:53.310" Score="1" Body="&lt;p&gt;At first glance your first paragraph seemed wildly confusing to me. (The notion of &quot;calculating&quot; an equation makes no sense.) But now I see what your professor is asking of you. He wants you to determine the &lt;em&gt;coefficients&lt;/em&gt; of an equation. He gave you a continuous $f(t)$ equation of a signal containing a DC component (1cos(0$\pi$$t$/4) and three sinusoids. And the 2nd and 3rd sinusoids have frequencies that are integer multiples of the 1st sinusoid. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your prof wants you to select the values and length ($N$) of a $t$ time sequence that will make those sinusoids reside exactly at an $N$-point DFT's bin centers. When that happens the bin centers' frequencies will give you the frequencies of the three sinusoids in your $f(t)$ equation. The peak values of the non-zero DFT spectral components (DC plus the three sinusoids) will enable you to establish the [1, 0.75, 0.2, 0.5] peak amplitude coefficients in your $f(t)$ equation.  Your prof wants you to learn how a sinewave whose peak amplitude is $A$ produces a DFT spectral component magnitude value of $M$ given the $N$ length of your DFT.  Your job is to see how $A$, $M$, and $N$ are related to each other. This is a good homework problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your $t$ = [0,1,2,3] sequence's period is one which means your sample rate is 1 sample/second. And as Ollie said, that's too slow. Set your $t$ sequence to [0, 0.5, 1, 1.5, 2, ..., 6.5, 7, 7.5], compute a 16-point DFT, compute the spectral magnitudes, and see what happens&#xA;.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-01T12:14:53.310" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27416" PostTypeId="1" CreationDate="2015-12-01T13:01:25.610" Score="1" ViewCount="2049" Body="&lt;p&gt;How does the PSOLA pitch-shifting algorithm manage to remove or add audio frames in real-time without creating gaps?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wouldn't extending the &quot;windows&quot; (it's like in FFT windowing) to longer than the audio buffer create asynchronity in the buffering? Similarly compressing the windows would lead to the need to &quot;read new audio in advance&quot; in order to not leave silence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or what's the idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess there's some clever math (ratios?) in order to know how to fill and remove windows so that they still match up reasonably in the overlap-add process.&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2016-06-29T05:02:03.753" Title="How does PSOLA pitch-shift work in real-time?" Tags="|audio|pitch|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27417" PostTypeId="1" CreationDate="2015-12-01T13:59:42.257" Score="1" ViewCount="4284" Body="&lt;p&gt;I know that MFCC features are the spectral envelope of the input signal but &#xA;I can't understand what do they mean and what do they represent  . and if I have two people saying the same word how can I compare the resulting features. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I have Mel Frequency Cepstral Coefficient  for the word &quot;please&quot;:&#xA;first person: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nfDAc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nfDAc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;second person:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JdlHe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JdlHe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see these signals seem different but thay are representing the same word which is 'please' .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done these steps to extract the features:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;framing with overlapping percentage equals to 50%.&lt;/li&gt;&#xA;&lt;li&gt;Windowing : hamming window was used&lt;/li&gt;&#xA;&lt;li&gt;perform  fft(signal);&lt;/li&gt;&#xA;&lt;li&gt;take the squared magnitude of the ff(signal);&lt;/li&gt;&#xA;&lt;li&gt;apply mel filter bank :number of filters = 26;&lt;/li&gt;&#xA;&lt;li&gt;take the logarithm of  squared sum for each filter&lt;/li&gt;&#xA;&lt;li&gt;perform dct .&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="18416" LastEditorUserId="18416" LastEditDate="2015-12-01T16:04:15.773" LastActivityDate="2018-01-22T15:43:38.043" Title="Comparing MFCC Features ,What do they represent?" Tags="|mfcc|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27418" PostTypeId="1" CreationDate="2015-12-01T14:11:41.873" Score="2" ViewCount="103" Body="&lt;p&gt;I am using Digital Signal Processing Principles, Algorithm and Applications,  4th edition written by Proakis and Manolakis. Here is s a part that I don't understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h(n)={\frac13,\frac13,\frac13}$. The zero position is at the 2nd element.&#xA;Hence, its Discrete-Time Fourier Transform (DTFT) is: $$H(\omega)= \frac13(e^{j\omega}+1+e^{-j\omega}) = \frac13(1+2\cos{\omega})\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since only the real part exists, I assume that the phase $\tan^{-1}\frac{H_I(\omega)}{H_R(\omega)} = 0$, where $H_I(\omega)$ and $H_R(\omega)$ are the imaginary and real part, respectively. However the book says that the phase is $0$ for $0\leq\omega\leq\frac{2\pi}{3}$ and $\pi$ for $\frac{2\pi}{3}\leq\omega\leq\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry that I'm not good at Latex.&lt;/p&gt;&#xA;" OwnerUserId="18328" LastEditorUserId="15892" LastEditDate="2015-12-01T15:50:15.520" LastActivityDate="2015-12-01T19:06:17.213" Title="What is the phase of the Fourier Transform of $h(n)={\frac13,\frac13,\frac13}$ (zero position is at 2nd element)" Tags="|discrete-signals|fourier-transform|homework|self-study|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27419" PostTypeId="1" CreationDate="2015-12-01T14:46:34.013" Score="1" ViewCount="29" Body="&lt;p&gt;I have a program that reads 16 bit two's complement format data to plot/analyze graphs. I have a database text file with various decimals which represent real analogue data, ie. let's say they are voltage readings: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;-0.002948&#xA;0.08594&#xA;0.01&#xA;0.00777&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I convert to the 16 bit form with the toolbox's inbuilt function, I have to manually choose the 'gain'. If I choose 1, all these small numbers will be rounded to the nearest integer, ie 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So then my question is, what is the protocol for choosing this gain/normalization?&lt;/strong&gt; Do I multiply everything by the maximum absolute voltage range divided by the largest absolute number? I want to retain as much information/reduce round off errors as possible.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie. Multiply all numbers by (2^16/2-1)/0.08594 in this specific example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks very much. &lt;/p&gt;&#xA;" OwnerUserId="18540" LastActivityDate="2015-12-01T14:46:34.013" Title="'ADC' sort of conversion method to retain information" Tags="|discrete-signals|analog-to-digital|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27420" PostTypeId="1" CreationDate="2015-12-01T15:02:43.023" Score="0" ViewCount="4887" Body="&lt;p&gt;The issue is that my signal is very noisy. I need extract its time derivative as accurate as possible.  P.S. I do not have any prior knowledge on the signal (black box).&lt;/p&gt;&#xA;&lt;p&gt;On forums some suggested Savitzky-Golay filter.&lt;/p&gt;&#xA;&lt;p&gt;Any idea please? If so, is there any c++ library for the purpose?&lt;/p&gt;&#xA;&lt;p&gt;In fact, for my application I need to compute optical-flow like information for control purpose. I compute an estimate using image information. Then I need to compute the time derivative of this estimate.&lt;/p&gt;&#xA;&lt;p&gt;4th order Savitzky Golay filter introduces delay, yet I need the output in real-time (real time control). For info:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The signal is regularly sampled;&lt;/li&gt;&#xA;&lt;li&gt;The noise is not defined but bounded;&lt;/li&gt;&#xA;&lt;li&gt;The output needs to be real-time: delay-minimal;&lt;/li&gt;&#xA;&lt;li&gt;The signal is black box: I only get a measure each iteration.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XzCaf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XzCaf.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10309" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-12-08T22:28:06.497" Title="Compute the time derivative of a noisy digital signal?" Tags="|filters|noise|smoothing|derivative|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27421" PostTypeId="2" ParentId="27418" CreationDate="2015-12-01T15:40:50.473" Score="1" Body="&lt;p&gt;The result on the phase comes from writing $H(\omega)$ as a modulus/phase product: $H(\omega) = |H(\omega)|e^{-\imath\phi(\omega)}$. The value of $\phi(\omega)$ is consistent with the sign of $(1+2\cos \omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OkHF5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OkHF5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a little inconsistency is your notation (maybe from the book!): the phase seems to takes both values $0$ and $\pi$ at $w=\frac{2\pi}{3}$. This is not vital as the modulus vanishes at this point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you might have forgotten in your reasoning is the fact that $t\to \tan t$ is $\pi$-periodic, and that $\tan \pi  =0$ too.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-12-01T15:52:45.067" LastActivityDate="2015-12-01T15:52:45.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27422" PostTypeId="1" CreationDate="2015-12-01T15:49:16.347" Score="1" ViewCount="866" Body="&lt;p&gt;For computing Mel Frequency Cepstral Coefficients you can use already calculated STFTs as a basis and perform the Mel frequency mapping on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; Does it make a significant difference if I calculate the STFTs, perform a PCA-transform on them and then calculate the MFCC compared to computing the PCA-transform at the very end on the MFCCs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases we have two dimensionality reductions (PCA and MFCC) and I'm not sure weather the order makes a difference.&lt;/p&gt;&#xA;" OwnerUserId="18542" LastActivityDate="2016-01-30T18:26:04.787" Title="Principal Component Analysis as a step between STFT and MFCC" Tags="|fourier-transform|spectrogram|mfcc|stft|music|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27423" PostTypeId="5" CreationDate="2015-12-01T16:08:37.410" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2015-12-01T16:08:37.410" LastActivityDate="2015-12-01T16:08:37.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27424" PostTypeId="4" CreationDate="2015-12-01T16:08:37.410" Score="0" Body="K Nearest Neighbor is a classification algorithm used to classify data based on set of already classified examples." OwnerUserId="14948" LastEditorUserId="80" LastEditDate="2015-12-01T20:05:36.117" LastActivityDate="2015-12-01T20:05:36.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27425" PostTypeId="2" ParentId="27417" CreationDate="2015-12-01T16:18:06.283" Score="1" Body="&lt;p&gt;Like already said, an eye inspection in this case is not possible since the data is just to high-dimensional. Thus what you want to do is to inspect the difference magnitudes of the frequencies per time frame. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest that you have a look at the &lt;strong&gt;cosine distance&lt;/strong&gt; in this case. It's not the only way but a good possibility to compare MFCCs without distortion due to the different overall loudness of the word. The cosine distance is &lt;strong&gt;1 - cosine similarity&lt;/strong&gt; and is frequently used in text mining. In this area it might be important to be independent of the document length (document A with 100 words, 10 * &quot;Hello&quot; and 90 * &quot;Bye&quot; should be similar to document B with 200 words, 20 * &quot;Hello&quot; and 180 &quot;Bye&quot;). Another way of explaining this distance is perform a normalization step (project each data point on the unit sphere) and then measure the euclidian distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cosine distance looks at the angle between two vectors (in your case you have one vector per time/frequency-bin) and therefore gets rid of the overall magnitude. This would by one way of comparing your MFCCs. &lt;/p&gt;&#xA;" OwnerUserId="18542" LastEditorUserId="18542" LastEditDate="2015-12-11T14:47:57.647" LastActivityDate="2015-12-11T14:47:57.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27427" PostTypeId="1" AcceptedAnswerId="27449" CreationDate="2015-12-01T16:36:12.803" Score="1" ViewCount="105" Body="&lt;p&gt;I have a series of images in which the pixels take integer values corresponding to a classification. I'd like to try some morphological transformations (e.g. erosion, dilation) to remove noise and smooth across pixels that are classified differently than its neighbors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the only morphological transformation functions I know in Python operate on continuous values. This is obviously a problem for discrete values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure other people have wanted to apply the techniques to images with classification values. Does anyone know of functions that exist for this sort of thing?&lt;/p&gt;&#xA;" OwnerUserId="14948" LastActivityDate="2015-12-02T11:45:38.837" Title="Morphological transformations for images with discrete values" Tags="|image-processing|morphological-operations|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27428" PostTypeId="2" ParentId="27422" CreationDate="2015-12-01T16:40:32.927" Score="-2" Body="&lt;p&gt;One dimensionality reduction method (PCA) is linear, the other (&lt;a href=&quot;https://en.wikipedia.org/wiki/Mel-frequency_cepstrum&quot; rel=&quot;nofollow&quot;&gt;MFCC&lt;/a&gt;) is  not. It  is thus unlikely that there is no difference at all since they probably do not commute. One serves more decorrelation, the other feature extraction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The importance of the order thus depends a lot on your signal class, and what your purpose is.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-12-01T16:40:32.927" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27429" PostTypeId="2" ParentId="27416" CreationDate="2015-12-01T17:00:30.937" Score="2" Body="&lt;p&gt;In PSOLA, pitch estimation is used to space out or overlap segments by integer multiples of the estimated pitch period in time.  Previous frames (or pitch period length sub-segments thereof) can be duplicated (as needed) in order to not leave any gaps between frames.  Segments can then be concatenated or cross-faded.  This can lengthen or shorted the composited result, and thus change the time duration.  Then this intermediate result can resampled to change the pitch (and possibly undo some or all of the time duration change), and to provide the proper number of samples needed for the output sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There will be some jitter, as frames are usually only shifted by a minimum of one whole pitch period, not by fractions thereof.  Buffering may be required to cover this time jitter, the amount related to the longest period (lowest pitch) expected to be handled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;clever math&quot; might be in the choice and implementation of an accurate enough but low latency pitch estimation algorithm.  If the pitch cannot be estimated (due to consonants or polyphony, etc.), apparent quality may suffer.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-01T17:36:16.963" LastActivityDate="2015-12-01T17:36:16.963" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27430" PostTypeId="2" ParentId="27420" CreationDate="2015-12-01T18:10:02.603" Score="2" Body="&lt;p&gt;If computational efficiency is important to you, and your signal's bandwidth is not to large relative to the $f_s$ sample rate, three simple causal differentiators that tend to attenuate high-frequency noise are described at &lt;a href=&quot;http://www.dsprelated.com/showarticle/814.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;DSPRelated&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A plot of the results of that article is below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I5e59.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I5e59.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying these three filters to your example signal (or an attempt to mimic it) yields the following plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YHOwA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YHOwA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Q27420&#xA;h_ref &amp;lt;- c(-1/16, 0, 1, 0, -1, 0, 1/16)&#xA;d2 &amp;lt;- c(0.5,0,-0.5)&#xA;d3 &amp;lt;- c(-3/16, 31/32,0, -31/32, 3/16)&#xA;&#xA;&#xA;H_ref &amp;lt;- abs(fft(c(h_ref,rep(0,1000))))&#xA;f2 &amp;lt;- abs(fft(c(d2,rep(0,1000))))&#xA;f3 &amp;lt;- abs(fft(c(d3,rep(0,1000))))&#xA;&#xA;w1 &amp;lt;- seq(0,length(H_ref)-1,1)/(length(H_ref)-1)&#xA;w2 &amp;lt;- seq(0,length(f2)-1,1)/(length(f2)-1)&#xA;w3 &amp;lt;- seq(0,length(f3)-1,1)/(length(f3)-1)&#xA;&#xA;n1 &amp;lt;- length(w1)/2&#xA;n2 &amp;lt;- length(w2)/2&#xA;n3 &amp;lt;- length(w3)/2&#xA;&#xA;plot(w3[1:n3],f3[1:n3]/1.2, col=&quot;blue&quot;, lwd=5,type=&quot;l&quot;, lty=2)&#xA;lines(w1[1:n1],H_ref[1:n1]/1.63,col=&quot;black&quot;, lwd=5)&#xA;lines(w2[1:n2],f2[1:n2], col=&quot;green&quot;, lwd=5)&#xA;&#xA;legend(0.0, 1.5, c(&quot;Proposed&quot;,&quot;Reference&quot;, &quot;Difference&quot;),&#xA;       col=c(&quot;blue&quot;,&quot;black&quot;,&quot;green&quot;), lty=c(2,1,1), lwd=c(5,5,5));&#xA;&#xA;x &amp;lt;- c(seq(-1.6,-0.4,0.01), seq(-0.4,-0.2,0.001)) &#xA;xn &amp;lt;- x + rnorm(length(x))/10&#xA;&#xA;&#xA;f &amp;lt;- seq(0,1,0.1)&#xA;m &amp;lt;- f&#xA;d4 &amp;lt;- signal::fir2(100,f,m)&#xA;&#xA;y1 &amp;lt;- filter(xn,h_ref, circular=TRUE)&#xA;y2 &amp;lt;- filter(xn,d2, circular=TRUE)&#xA;y3 &amp;lt;- filter(xn,d3, circular=TRUE)&#xA;y4 &amp;lt;- filter(xn,d4, circular=TRUE)&#xA;&#xA;par(mfrow=c(4,1))&#xA;plot(xn)&#xA;title(&quot;Original signal&quot;)&#xA;plot(y4,lwd=4,col=&quot;grey&quot;)&#xA;lines(y1,col=&quot;blue&quot;)&#xA;title(&quot;Deriviative calcualted using the reference technique&quot;)&#xA;plot(y4,lwd=4,col=&quot;grey&quot;)&#xA;lines(y2,col=&quot;black&quot;, lty=2, lwd=3)&#xA;title(&quot;Deriviative calcualted using the proposed technique&quot;)&#xA;plot(y4,lwd=4,col=&quot;grey&quot;)&#xA;lines(y3,col=&quot;green&quot;, lwd=5)&#xA;title(&quot;Deriviative calcualted using simple difference&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="80" LastEditDate="2015-12-02T14:12:38.327" LastActivityDate="2015-12-02T14:12:38.327" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27432" PostTypeId="1" AcceptedAnswerId="27434" CreationDate="2015-12-01T18:34:06.800" Score="1" ViewCount="501" Body="&lt;p&gt;So, I have a noisy signal in time domain, $f(t) = t \eta(t)$ where $\eta(t)$ is white noise with variance $\sigma$ and mean zero, and that it has the property $\langle \eta(t)\eta(t') \rangle = \sigma^2 \delta(t-t')$ ($\langle \ldots \rangle$ denotes ensemble averaging). What I want to do is that I want to calculate the square magnitude of the spectrum in frequency domain upon ensemble averaging, $\langle |z(\omega)|^2 \rangle$. To do this, I follow Dave's answer in &lt;a href=&quot;https://physics.stackexchange.com/questions/53739/magnitude-of-the-fourier-transform-of-white-noise&quot;&gt;https://physics.stackexchange.com/questions/53739/magnitude-of-the-fourier-transform-of-white-noise&lt;/a&gt;. So, it will be&#xA;$$&#xA;\langle |z(\omega)|^2 \rangle = \iint e^{i\omega t} e^{-i\omega t'}t't \langle \eta(t)\eta(t') \rangle dt dt'&#xA;$$&#xA;Using the property stated above, $\langle \eta(t)\eta(t') \rangle = \sigma^2 \delta(t-t')$, I can obtain&#xA;$$&#xA;\langle |z(\omega)|^2 \rangle = \sigma^2 \int t^2 dt&#xA;$$.&#xA;Thus, the ensemble averaged square magnitude of my function is independent of $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I perform the same calculation using MATLAB and I obtained the following pictures.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pVqN7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pVqN7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like when I take ensemble average of the lower curve, it will be dependent on $\omega$, which contradicts my calculation. Can someone please point out my mistake(s)?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;&#xA;clc;&#xA;&#xA;n = 2048;&#xA;ft = rand(1,n)*(2+2)-2 + 0;&#xA;t = linspace(-10,10,n);&#xA;Dt = 1/(t(3)-t(1));&#xA;&#xA;fw = ifft(fft(t.*ft));&#xA;w = (-length(t)/2:length(t)/2-1)*2*pi*Dt/length(t);&#xA;subplot(211)&#xA;plot(t,t.*ft)&#xA;xlabel('t')&#xA;ylabel('f(t)')&#xA;&#xA;subplot(212)&#xA;plot(w,abs(fw).^2)&#xA;xlabel('\omega')&#xA;ylabel('|z(\omega)|^2')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's my code. By the way I think you are using normal distribution for the noise, I used white noise type.&lt;/p&gt;&#xA;" OwnerUserId="18551" OwnerDisplayName="nougako" LastEditorUserId="-1" LastEditDate="2017-04-13T12:40:13.060" LastActivityDate="2015-12-03T15:16:24.990" Title="Fourier transform of certain noisy function" Tags="|fourier-transform|noise|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27433" PostTypeId="2" ParentId="27418" CreationDate="2015-12-01T19:06:17.213" Score="1" Body="&lt;p&gt;Both the book's moving average (MA) example and Laurent's Answer# 1 are correct. The phase value of $\pi$ above the frequency of $\omega$ = $2\pi/3$ radians/sample corresponds to a phase shift of $\pm$180 degrees. This means if a filter's impulse response is the anti-causal $h(n)$ sequence then filter output tones whose frequencies are greater than $2\pi/3$ radians/sample will be 180 degrees out of phase relative to output tones whose frequencies are less than $2\pi/3$ radians/sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author's decision to make the $n$ = 0 index value be at the 2nd element of $h(n)$ was done to keep the final $H(\omega)$ equation simple. However, it's worth knowing that if the $h(n)$ samples are used as coefficients of a tapped-delay line, causal MA filter, the filter's frequency-domain phase response will look like the following (where the x-axis value of 0.5 corresponds to a frequency of $\pi$ radians/sample or $f_s$ Hz):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YxFBn.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YxFBn.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-01T19:06:17.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27434" PostTypeId="2" ParentId="27432" CreationDate="2015-12-01T20:25:10.483" Score="0" Body="&lt;p&gt;Looking at your code, this line looks odd:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fw = ifft(fft(t.*ft));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why are you immediately taking the inverse FFT?  Surely you just want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fw = abs(fft(t.*ft));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;???&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is not really an answer, more a request for more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to repeat your example in &lt;code&gt;R&lt;/code&gt; and I cannot get the FFT you get.  What I get is plotted below.  Can you share your matlab code? I'm wondering what it's doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6Tg8a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6Tg8a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#27432&#xA;&#xA;T2 &amp;lt;- 1000&#xA;&#xA;f &amp;lt;- rnorm(2*T2+1) * seq(-T,T,1)&#xA;&#xA;par(mfrow=c(2,1))&#xA;plot(f, type=&quot;l&quot;, col=&quot;blue&quot;)&#xA;plot(abs(fft(f)), type=&quot;l&quot;, col=&quot;blue&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-12-01T21:01:29.017" LastActivityDate="2015-12-01T21:01:29.017" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27435" PostTypeId="2" ParentId="27411" CreationDate="2015-12-01T20:34:22.217" Score="1" Body="&lt;p&gt;The random phase $\phi$ makes the carrier signal $c(t)=A\cos(2\pi f_0+\phi)$ wide-sense stationary with the autocorrelation function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_c(\tau)=\frac{A^2}{2}\cos(2\pi f_0\tau)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of $(1)$ is the power spectrum of the carrier:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_c(f)=\frac{A^2}{4}\left[\delta(f-f_0)+\delta(f+f_0)\right]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta(f)$ is the Dirac impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the carrier signal $c(t)$ and the message signal $m(t)$ are assumed to be uncorrelated, the autocorrelation function of the modulated signal $s(t)=c(t)m(t)$ equals the product of the autocorrelation functions of $c(t)$ and $m(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_s(\tau)=R_c(\tau)R_m(\tau)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(3)$ it follows that the power spectrum $S_s(f)$ of $s(t)$ is the convolution of the power spectra of $c(t)$ and $m(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_s(f)=S_c(f)\star S_m(f)=\frac{A^2}{4}\left[S_m(f-f_0)+S_m(f+f_0)\right]\tag{4}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-01T20:34:22.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27437" PostTypeId="1" AcceptedAnswerId="27463" CreationDate="2015-12-01T20:49:10.663" Score="4" ViewCount="1520" Body="&lt;p&gt;What is the difference (if any) between PSOLA (Pitch Synchronous Overlap and Add) and TDHS (time domain harmonic scaling) time-pitch modification algorithms?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="4346" LastEditDate="2015-12-01T23:31:41.403" LastActivityDate="2015-12-06T04:00:11.910" Title="What is the difference between PSOLA and TDHS time-scaling or pitch-shifting?" Tags="|audio|pitch|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27438" PostTypeId="1" AcceptedAnswerId="27441" CreationDate="2015-12-01T21:46:30.030" Score="3" ViewCount="144" Body="&lt;p&gt;I'm working on a project involving synthesizing audio, which led me to a promising Stanford CCRMA paper on band-limited synthesis. However, this double-arrow notation keeps popping up throughout some pretty critical portions of the document, and I've been unable to find any mention of it in the paper itself (you can imagine running a Google search for this might be tricky). It seems as though it has something to do with sampling/resampling (as in sampling the continuous variable $t$ at a rate of $nT_s$. But this doesn't seem to explain it's use in $(\leftrightarrow 1)^n$ (for lack of a better symbol). I'm hoping someone here might be able to shed some insight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TjtfZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TjtfZ.png&quot; alt=&quot;Example of mysterious arrow notation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a link to the paper for further examples: &#xA;&lt;a href=&quot;https://ccrma.stanford.edu/~stilti/papers/blit.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ccrma.stanford.edu/~stilti/papers/blit.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15185" LastActivityDate="2015-12-01T22:23:30.327" Title="Mysterious notation used in &quot;BLIT&quot; CCRMA paper" Tags="|signal-synthesis|notation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27439" PostTypeId="1" CreationDate="2015-12-01T21:48:32.337" Score="2" ViewCount="117" Body="&lt;p&gt;I am working on an extremely simple voice recognition project which I plan on implementing DTW for the template matching. Basically, I'll have stored FFT values of a template of some word that I'm trying to match, store incoming data, do FFT, and run the DTW algorithm to see if it matches the template. My question is, and I can't seem to find the answer on any paper I read about DTW, is how do I determine the maximum cost the algorithm can compute and still be labeled as a match? In other words, if the dtw algorithm computes a cost of value X, what criteria do I need to come up with to determine if that is small enough to be a match? &lt;/p&gt;&#xA;" OwnerUserId="18453" LastActivityDate="2015-12-01T21:48:32.337" Title="Dynamic Time warping for voice recognition" Tags="|voice|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27441" PostTypeId="2" ParentId="27438" CreationDate="2015-12-01T22:23:30.327" Score="4" Body="&lt;p&gt;What a weird typographical error. It's a minus. Get a working copy of the PDF from &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.44.87&quot; rel=&quot;nofollow&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.44.87&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-01T22:23:30.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27442" PostTypeId="2" ParentId="15466" CreationDate="2015-12-01T22:36:19.543" Score="3" Body="&lt;p&gt;One way to check for similarity between time series is to use the cross-correlation:&#xA;$$&#xA;\rho_{xy}(\tau) = \frac{1}{\sigma_x \sigma_y} E[ (x[n] - \mu_x)(y[n] - \mu_y) ] &#xA;$$&#xA;where $\mu_{x,y}$ is the mean of $x$ or $y$ and $\sigma_{x,y}$ is the standard deviation of $x$ or $y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives us a value between -1 (completely anti-correlated) and +1 (completely correlated).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes, this doesn't work as well as we'd like because there is some filtering operation relating the two time series, so while there is a strong relationship between the two time series, the cross-correlation is not very close to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, the spectral coherence is sometimes used:&#xA;$$&#xA;C_{xy}(f) = \frac{|G_{xy}(f)|^2}{G_{xx}(f)G_{yy}(f)}&#xA;$$&#xA;where $G_{km}$ is the cross-spectral density between $k$ and $m$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is now a function of frequency, and the closer it is to 1 at a given frequency, the closer the two signals are related.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've put together a simple example in &lt;code&gt;R&lt;/code&gt; which illustrates the difference between cross-correlation and (spectral) coherence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The top graph shows the two time series.  The middle graph shows the cross-correlation is less than 1.  The bottom graph shows the spectral coherence as a function of frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V3JDN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V3JDN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that the time series are not as similar in the higher frequencies as they are at low frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes, the integral of these values is used over a limited bandwidth so that a single figure of similarity is arrived at.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  #15466&#xA;&#xA;  x1 &amp;lt;- rnorm(1000)&#xA;&#xA;  h &amp;lt;- c(1,3,2,1)/7&#xA;  x2 &amp;lt;- filter(x1,h, circular=TRUE) + rnorm(1000)/10&#xA;&#xA;  par(mfrow=c(3,1))&#xA;&#xA;  plot(x1,type=&quot;l&quot;,col=&quot;blue&quot;)&#xA;  lines(x2, col=&quot;green&quot;,lwd=5)&#xA;  title(&quot;Original and filtered noise signals&quot;)&#xA;&#xA;  ccf(x1,x2)&#xA;&#xA;  Ixy &amp;lt;- spectrum(cbind(x1,x2), plot=FALSE,spans=c(5,7))&#xA;&#xA;  plot(Ixy$coh)h)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-12-01T22:48:30.290" LastActivityDate="2015-12-01T22:48:30.290" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27444" PostTypeId="2" ParentId="27212" CreationDate="2015-12-02T02:23:51.717" Score="1" Body="&lt;p&gt;There's a few possible problems with taking a running maximum of all the accelerometer samples within your window.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You'll miss large negative excursions. This may not be a problem; the absolute value of excursions might be enough for your application.&lt;/li&gt;&#xA;&lt;li&gt;You'll miss two large excursions in the one time window.&lt;/li&gt;&#xA;&lt;li&gt;The actual times the peaks occur at will be lost, or at least be inaccurate. For example, if adjacent windows have peaks at the beginning and then at the  end,  the actual time between them will be nearly two window lengths, but the reported time will be one window length&lt;/li&gt;&#xA;&lt;li&gt;All values will tend to be positive, which will bias the &quot;background&quot; acceleration.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've written some &lt;code&gt;R&lt;/code&gt; code to simulate discarding 49 out of every 50 values, and only keeping the maximum one in a window. The raw data are the black circles in the plot. The maximum values are the green circles; the minimum values are the red circles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9t6Ty.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9t6Ty.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#27212&#xA;&#xA;N &amp;lt;- 1000&#xA;acc &amp;lt;- rnorm(N)/5&#xA;&#xA;Nspikes &amp;lt;- 10&#xA;spike_indices &amp;lt;- runif(Nspikes,1,N)&#xA;spike_values &amp;lt;- runif(Nspikes,-10,10)&#xA;&#xA;acc[spike_indices] &amp;lt;- spike_values&#xA;&#xA;decimationFactor &amp;lt;- 50&#xA;idx &amp;lt;- 1&#xA;mx &amp;lt;- rep(0,length(seq(1,length(acc),decimationFactor)))&#xA;mn &amp;lt;- rep(0,length(seq(1,length(acc),decimationFactor)))&#xA;&#xA;for (k in seq(1,length(acc),decimationFactor))&#xA;{&#xA;  idxs = seq(max(1,k), min(length(acc), k+decimationFactor-1),1)&#xA;  mx[idx] = max(acc[idxs])&#xA;  mn[idx] = min(acc[idxs])&#xA;  idx &amp;lt;- idx + 1&#xA;}&#xA;&#xA;par(mfrow=c(1,1))&#xA;plot(acc)&#xA;points(seq(1,length(acc),decimationFactor),mx,lwd=5,col=&quot;green&quot;)&#xA;points(seq(1,length(acc),decimationFactor),mn,lwd=5,col=&quot;red&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-02T02:23:51.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27445" PostTypeId="1" CreationDate="2015-12-02T04:07:02.977" Score="0" ViewCount="159" Body="&lt;p&gt;I have the Fourier Transform or FFT of a signal, call it $F(f)$. I would like to apply a &quot;frequency-dependent frequency shift&quot; to it. Specifically, frequency $f$ should be shifted to $3f^2$, for all $f$. Physically, this signal is undergoing dispersion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have a signal of a one-dimensional wave (sound amplitude, water height, or voltage, etc.) as a function of time at a specific location, and I'm trying to estimate the spatial signal at a single instant in time. Let the dispersion relation be $k=3f^2$, where k is the wavenumber. This procedure will change the temporal signal to the spatial signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like a linear system to me, so how would I find the frequency response $H(f)$ of the system? Knowing the frequency response, I can simply multiply $F(f)$ by the $H(f)$ to find the resulting signal.&lt;/p&gt;&#xA;" OwnerUserId="18229" LastEditorUserId="3369" LastEditDate="2015-12-04T12:15:30.573" LastActivityDate="2016-02-02T18:07:52.647" Title="Frequency dependent frequency shift" Tags="|frequency-response|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27446" PostTypeId="1" CreationDate="2015-12-02T06:07:21.783" Score="1" ViewCount="5954" Body="&lt;p&gt;I'm trying to doing an analysis using IQ demodulation. I'm doing this by taking a noisy signal which has a desired signal in it. The desired signal has a frequency that is almost stable, which I'm simulating to be 5 hz + a small amount of random fluctuations in instantaneous frequency. I'm then mixing it with a cosine and sine function of 5 hz, then applying a lowpass filter. Then I'm taking the square root of these two filtered signals squared to retrieve the amplitude, which I simulate to be decaying exponentially. I'm not sure where my problem is, but the amplitude I extract is not stable. I'm not sure if it is a misunderstanding of something fundamentally or a code problem, but I don't think it is a code problem. I am self-teaching some DSP, and would not consider myself an expert at all. Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.signal import butter, lfilter, freqz&#xA;import matplotlib.pyplot as plt&#xA;&#xA;pi = np.pi&#xA;&#xA;def butter_lowpass(cutoff, fs, order=5):&#xA;    nyq = 0.5 * fs&#xA;    normal_cutoff = cutoff / nyq&#xA;    b, a = butter(order, normal_cutoff, btype='low', analog=False)&#xA;    return b, a&#xA;&#xA;def butter_lowpass_filter(data, cutoff, fs, order=5):&#xA;    b, a = butter_lowpass(cutoff, fs, order=order)&#xA;    y = lfilter(b, a, data)&#xA;    return y&#xA;&#xA;t = np.linspace(0,20,20001)&#xA;sample_freq = 1/(t[1] - t[0])&#xA;&#xA;f1 = [3 + .2*np.random.rand() for x in t]&#xA;Amp1 = np.exp(-2*t)&#xA;cos1 = Amp1*np.array([np.cos(2*pi*y*x) for y,x in zip(f1,t)])&#xA;&#xA;f2 = [5 + 0.1*np.random.rand() for x in t]&#xA;Amp2 = 5*np.exp(-t)&#xA;cos2 = Amp2*np.array([np.cos(2*pi*y*x) for y,x in zip(f2,t)])&#xA;&#xA;f3 = [8 + .2*np.random.rand() for x in t]&#xA;Amp3 = np.exp(-t/2)&#xA;cos3 = Amp3*np.array([np.cos(2*pi*y*x) for y,x in zip(f3,t)])&#xA;&#xA;f4 = [.2 + .05*np.random.rand() for x in t]&#xA;Amp4 = 0.1&#xA;cos4 = Amp4*np.array([np.cos(2*pi*y*x) for y,x in zip(f4,t)])&#xA;&#xA;noisy = (cos1+cos2+cos3+cos4)&#xA;&#xA;cos_mix = np.cos(5*t)&#xA;sin_mix = np.sin(5*t)&#xA;&#xA;X = noisy * cos_mix&#xA;&#xA;Y = noisy * sin_mix&#xA;&#xA;cutoff = .5&#xA;&#xA;X_low = butter_lowpass_filter(X, cutoff, sample_freq)&#xA;Y_low = butter_lowpass_filter(Y, cutoff, sample_freq)&#xA;&#xA;Amplitude = 2* np.sqrt(X_low**2 + Y_low**2)&#xA;&#xA;plt.plot(t, Amplitude)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which plots an image like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SxFBi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SxFBi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16054" LastEditorUserId="16054" LastEditDate="2015-12-02T16:11:38.577" LastActivityDate="2015-12-02T16:11:38.577" Title="Doing analysis using IQ demodulation in Python" Tags="|python|demodulation|quadrature|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27447" PostTypeId="2" ParentId="26239" CreationDate="2015-12-02T07:58:54.267" Score="1" Body="&lt;p&gt;I don't think that those frequencies look right. Here is a running example I also use from another Stackoverflow thread. You could it to calculate the filter bank again and then calculate the dot-product on this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://stackoverflow.com/questions/5835568/how-to-get-mfcc-from-an-fft-on-a-signal/&quot; title=&quot;How to get MFCC from FFT&quot;&gt;How to get MFCC from FFT&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;from scipy.fftpack import dct&#xA;from scipy.io import wavfile&#xA;&#xA;sampleRate, signal = wavfile.read(&quot;file.wav&quot;)&#xA;numCoefficients = 13 # choose the sive of mfcc array&#xA;minHz = 0&#xA;maxHz = 22.000  &#xA;&#xA;complexSpectrum = numpy.fft(signal)&#xA;powerSpectrum = abs(complexSpectrum) ** 2&#xA;filteredSpectrum = numpy.dot(powerSpectrum, melFilterBank())&#xA;logSpectrum = numpy.log(filteredSpectrum)&#xA;dctSpectrum = dct(logSpectrum, type=2)  # MFCC :)&#xA;&#xA;def melFilterBank(blockSize):&#xA;    numBands = int(numCoefficients)&#xA;    maxMel = int(freqToMel(maxHz))&#xA;    minMel = int(freqToMel(minHz))&#xA;&#xA;    # Create a matrix for triangular filters, one row per filter&#xA;    filterMatrix = numpy.zeros((numBands, blockSize))&#xA;&#xA;    melRange = numpy.array(xrange(numBands + 2))&#xA;&#xA;    melCenterFilters = melRange * (maxMel - minMel) / (numBands + 1) + minMel&#xA;&#xA;    # each array index represent the center of each triangular filter&#xA;    aux = numpy.log(1 + 1000.0 / 700.0) / 1000.0&#xA;    aux = (numpy.exp(melCenterFilters * aux) - 1) / 22050&#xA;    aux = 0.5 + 700 * blockSize * aux&#xA;    aux = numpy.floor(aux)  # Arredonda pra baixo&#xA;    centerIndex = numpy.array(aux, int)  # Get int values&#xA;&#xA;    for i in xrange(numBands):&#xA;        start, centre, end = centerIndex[i:i + 3]&#xA;        k1 = numpy.float32(centre - start)&#xA;        k2 = numpy.float32(end - centre)&#xA;        up = (numpy.array(xrange(start, centre)) - start) / k1&#xA;        down = (end - numpy.array(xrange(centre, end))) / k2&#xA;&#xA;        filterMatrix[i][start:centre] = up&#xA;        filterMatrix[i][centre:end] = down&#xA;&#xA;    return filterMatrix.transpose()&#xA;&#xA;def freqToMel(freq):&#xA;    return 1127.01048 * math.log(1 + freq / 700.0)&#xA;&#xA;def melToFreq(mel):&#xA;    return 700 * (math.exp(freq / 1127.01048 - 1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Having every second row/ coefficient zeroed would suppose that your input signal (which seems to be a wav-file here) is already scaled based on your mel-filter bank. By using real signals it seems quite unrealistic to me. Furthermore row 1 and 3 for example look quite similar which of course can happen but (if he is using real-world audio files) might not hold true&lt;/p&gt;&#xA;" OwnerUserId="18542" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-12-02T12:56:15.217" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27448" PostTypeId="1" CreationDate="2015-12-02T09:20:18.790" Score="1" ViewCount="29" Body="&lt;p&gt;I have a matrix 64x64 where each cell represents the pixel of a pixellated detector.&#xA;The  spacial response of this detector decreases by going further from its center (that is, coordinates &quot;31,31&quot; or &quot;32,32&quot;). I have experimental data (10 samples equally distant in the x axis and 10 samples in the y axes) showing that the loss depends on the distance from the center. I have for example the value 100 at the center, the value 70 at coordinates (37, 37), the value 58 at coordinates (43, 43), etc. By plotting this data, it looks like a Gaussian Function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For post-processing purposes, I would like to compensate each pixel of the matrix by a factor, where the factor is estimated by using the experimental data (20 samples in total) mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if at coordinates (16,16) the response resulted to be half compared to the center, I would double the values of that cell&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if at coordinates (10,10) the response is 1/3 compared to the center, I would triplicate the values etc...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there a way to do this in Python pixels with scipy.signal or similar or in Matlab?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="18556" LastActivityDate="2015-12-02T09:20:18.790" Title="Emulate signal loss of a pixellated detector in Python?" Tags="|discrete-signals|python|matrix|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27449" PostTypeId="2" ParentId="27427" CreationDate="2015-12-02T11:37:06.337" Score="1" Body="&lt;p&gt;Morphological operators are primarily defined over binary images where values 0,1 could correspond to areas identified as foreground and background respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you can create a binary image of the region you want to apply the operator on by assigning the &quot;islands&quot; of noisy classified regions to the &quot;foreground&quot; (e.g 4  now becomes the value 1) and the broad area around them that is consistently classified in a stable way to the &quot;foreground&quot; (e.g value 3). Apply erosion to this image and then substitute the pixels back from the new binary image to the segmentation mask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you want to eliminate spurious classifications so that you end up with consistent areas, you could apply nonlinear filters such as median, max and min over some sliding m by n window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, please see &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/erode.htm&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt; and &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/median.htm&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as Python is concerned please see &lt;a href=&quot;http://pillow.readthedocs.org/en/3.0.x/reference/ImageMorph.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; or &lt;a href=&quot;http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://pillow.readthedocs.org/en/3.0.x/reference/ImageFilter.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.  Another excellent python module for this job is &lt;a href=&quot;http://mahotas.readthedocs.org/en/latest/morphology.html&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Also, please note that you could apply any kind of filter that could even produce a Real type output (e.g 2.43, 1.76, etc) but either round or truncate its final output to make it to an integer. Not sure these operators would be very helpful though in this specific case.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2015-12-02T11:45:38.837" LastActivityDate="2015-12-02T11:45:38.837" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27450" PostTypeId="2" ParentId="27445" CreationDate="2015-12-02T12:18:55.353" Score="0" Body="&lt;p&gt;The system is non-linear on $f$(requency) which can also be seen as &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Frequency#Related_types_of_frequency&quot; rel=&quot;nofollow&quot;&gt;rate of phase&lt;/a&gt;&quot; for a sinusoidal component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it was 3*f, it would fall under @Peter.K's comment (above) and it would be realisable directly from &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform#Basic_properties&quot; rel=&quot;nofollow&quot;&gt;the shifting property of the Fourier Transform&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But due to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quadratic_function&quot; rel=&quot;nofollow&quot;&gt;quadratic term&lt;/a&gt; in $3 \cdot f^2$ this cannot be done with a Linear Time Invariant (&lt;a href=&quot;https://en.wikipedia.org/wiki/LTI_system_theory&quot; rel=&quot;nofollow&quot;&gt;LTI&lt;/a&gt;) System (i.e. Oli's comment, above). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could however work with linear segments (of the $3 \cdot f^2$) over sliding-window techniques (&lt;a href=&quot;https://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;nofollow&quot;&gt;that&lt;/a&gt;) to produce something like &lt;a href=&quot;http://www.guitarpitchshifter.com/algorithm.html&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-12-02T12:18:55.353" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27451" PostTypeId="1" AcceptedAnswerId="27453" CreationDate="2015-12-02T13:45:37.383" Score="53" ViewCount="102656" Body="&lt;p&gt;I am trying to understand the difference between convolution to cross-correlation. I have read an understood &lt;a href=&quot;https://math.stackexchange.com/questions/353272/whats-the-difference-between-convolution-and-crosscorrelation&quot;&gt;This&lt;/a&gt; answer. I also understand the picture below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, in terms of signal processing, (a field which I know little about..), Given two signals (or maybe a signal and a filter?), When will we use convolution and when will we prefer to use cross correlation, I mean, When in real life analysing will we prefer convolution, and when, cross-correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like these two terms has a lot of use, so, what is that use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nGZQ1.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nGZQ1.png&quot; alt=&quot;Covolution&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*The cross-correlation here should read &lt;code&gt;g*f&lt;/code&gt; instead of &lt;code&gt;f*g&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="18562" LastEditorUserId="44686" LastEditDate="2019-08-26T20:05:28.500" LastActivityDate="2019-08-26T20:05:28.500" Title="The difference between convolution and cross-correlation from a signal-analysis point of view" Tags="|discrete-signals|continuous-signals|signal-detection|" AnswerCount="6" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27452" PostTypeId="2" ParentId="27451" CreationDate="2015-12-02T14:11:40.110" Score="21" Body="&lt;p&gt;The two terms &lt;strong&gt;convolution&lt;/strong&gt; and &lt;strong&gt;cross-correlation&lt;/strong&gt; are implemented in a very similar way in DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one you use depends on the application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are performing a linear, time-invariant filtering operation, you &lt;em&gt;convolve&lt;/em&gt; the signal with the system's impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are &quot;measuring the similarity&quot; between two signals, then you &lt;em&gt;cross-correlate&lt;/em&gt; them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two terms come together when you try to produce a &lt;a href=&quot;https://en.wikipedia.org/wiki/Matched_filter&quot;&gt;&lt;strong&gt;matched filter&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, you are trying to decide whether a given signal, $s[n]$ contains a known &quot;pulse&quot; (signal), $p[n]$.  One way to do that is to convolve the given signal, $s$ with the time-reversal of the known pulse, $p$ : you are now using convolution to perform the cross-correlation of the given signal with the known pulse.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A Side Note&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term &quot;cross-correlation&quot; is (for some) misused in the field of DSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For statisticians, a correlation is a value that measures how close two variables are and should be between $-1$ and $+1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot;&gt;As you can see from the Wikipedia entry on cross-correlation&lt;/a&gt;, the DSP version is used and they state:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;cross-correlation is a measure of similarity of two series as a function of the lag of one relative to the other.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The problem with the DSP definition:&#xA;$$&#xA;\sum_{\forall m} x[n] y[n+m]&#xA;$$&#xA;is that this &quot;similarity&quot; measure depends upon the energy in each signal.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-02T14:11:40.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27453" PostTypeId="2" ParentId="27451" CreationDate="2015-12-02T14:13:01.463" Score="45" Body="&lt;p&gt;In signal processing, two problems are common:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the output of this filter when its input is $x(t)$? The answer is given by $x(t)\ast h(t)$, where $h(t)$ is a signal called the &quot;impulse response&quot; of the filter, and $\ast$ is the convolution operation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given a noisy signal $y(t)$, is the signal $x(t)$ somehow present in $y(t)$? In other words, is $y(t)$ of the form $x(t)+n(t)$, where $n(t)$ is noise? The answer can be found by the correlation of $y(t)$ and $x(t)$. If the correlation is large for a given time delay $\tau$, then we may be confident in saying that the answer is yes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that when the signals involved are symmetric, convolution and cross-correlation become the same operation; this case is also very common in some areas of DSP.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-12-02T14:13:01.463" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27454" PostTypeId="1" CreationDate="2015-12-02T14:53:08.707" Score="-1" ViewCount="300" Body="&lt;p&gt;I am using the discrete meyer wavelet in MATLAB for time series decomposition. I would like to change the central frequency of this wavelet but I do not know if this is possible or if I would need to design a new wavelet.&#xA;Thank you very much in advance.&lt;/p&gt;&#xA;" OwnerUserId="18564" LastActivityDate="2022-04-01T22:04:00.360" Title="change the central frequency of a wavelet" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27455" PostTypeId="2" ParentId="27451" CreationDate="2015-12-02T14:56:14.400" Score="3" Body="&lt;p&gt;In signal processing, the convolution is performed to obtain the output of an LTI system. The correlation (auto, or cross correlation) usually is calculated to be used later to do some other calculations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to be careful not to confuse correlation, covariance, and correlation coefficient. The correlation does not necessarily have to be between -1 and 1. The correlation coefficient (&lt;a href=&quot;https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient&lt;/a&gt;) falls between -1 and 1 because it is scaled by the two random variables variances. The thing we have to remember is that the real operation to be done in statistical signal processing to analize how related are two random variables is the &quot;Covariance&quot;, not the correlation. But for most applications where a signal is captured by a sensor and transformed into a voltage and the digitized with an ADC, you can assume that the signal is zero mean, hence the correlation is equal to the covariance.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2015-12-02T14:56:14.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27456" PostTypeId="1" CreationDate="2015-12-02T14:56:49.100" Score="0" ViewCount="1522" Body="&lt;p&gt;I'm using gist.github.com/sixtenbe/1178136#file-peakdetect-py to find maximum peaks in my spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;_max, _min = peakdetect.peakdetect(array, lookahead=300, delta=0.3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following peaks. x_axis = time, y_axis = frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5cRMH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5cRMH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in the image, the peaks are not evenly spread out. All the points are skewed towards frequency axis. My array is in this format: [1, 2, 3 , 0 , 1, 3, 4]. It's 2D time+frequency array flattened into 1D array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What can I do to show the image like this where the peaks are spread out evenly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mFbNT.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mFbNT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18563" LastEditorUserId="154" LastEditDate="2015-12-02T19:12:56.277" LastActivityDate="2015-12-02T19:16:44.293" Title="Finding peaks in an Audio spectrogram" Tags="|audio|dsp-core|peak-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27457" PostTypeId="2" ParentId="27454" CreationDate="2015-12-02T16:35:29.820" Score="0" Body="&lt;p&gt;MATLAB documentation indicates that discretization of the continuous and infinite-support Meyer wavelet is done simply by regular sampling. I doubt that there are any unwanted consequences if you sample it over a longer interval than the nominal -8 to 8 effective support, to have a different central frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard values for the first two parameters to &lt;code&gt;meyer(LB,UB,N)&lt;/code&gt; are &lt;code&gt;LB&lt;/code&gt; = -8, &lt;code&gt;UB&lt;/code&gt; = 8, defining the interval to be covered by sampling. Multiply those parameters by the same factor by which you want to multiply the central frequency. If factor &amp;lt; 1, you should double &lt;code&gt;LB&lt;/code&gt; and &lt;code&gt;UB&lt;/code&gt; to ensure that you sample the whole effective support of the Meyer wavelet and scaling functions. Then you will find your wanted frequency on the next scale level.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-12-02T18:08:57.970" LastActivityDate="2015-12-02T18:08:57.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27458" PostTypeId="1" CreationDate="2015-12-02T17:26:46.400" Score="0" ViewCount="59" Body="&lt;p&gt;In my recent study of signal processing I came to know that we can compress images/signal using DFT/DCT. If we consider the lossy compression of audio or any image then it follows the same steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply DCT/DFT on N samples of data.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Collect coefficients which contains most of the signal energy i.e., a signal's DCT representation tends to have more of its energy concentrated in a small number of &lt;strong&gt;coefficients&lt;/strong&gt; when compared to other transforms like the DFT.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But I have doubt that how to get these coefficients. In DFT we have &#xA;$$ {\tt ORIGINAL:}\ X(e^{jw})=\sum_{n=0}^{N-1} x[n]e^{-j2{\pi}/Nn}\\&#xA;{\tt CORRECTED:}\ X[k]=\sum_{n=0}^{N-1} x[n]e^{-j2{\pi}/Nnk}&#xA;  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $ \omega $ is a continuous variable. Then how to extract coefficients when $ \omega $ is a continuous variable?  &lt;/p&gt;&#xA;" OwnerUserId="18567" LastEditorUserId="80" LastEditDate="2015-12-02T17:51:28.153" LastActivityDate="2015-12-02T17:51:28.153" Title="How to get cofficients in DFT?" Tags="|fft|discrete-signals|dft|dct|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27460" PostTypeId="1" CreationDate="2015-12-02T18:52:19.137" Score="1" ViewCount="1248" Body="&lt;p&gt;I have an audio signal , and I want to remove noise from it. I have applied a bandpass filter in order to remove frequencies that are not part of mi signal. But if there is background noise (some people talking) , it is not removed , because it has the same frequency range that my signal. &#xA;How can I filter my signal , to eliminate the noise that has the same frequency as my signal?&lt;/p&gt;&#xA;" OwnerUserId="18569" LastActivityDate="2015-12-03T15:05:39.480" Title="How to eliminate noise that has the same frequency of my signal" Tags="|matlab|signal-analysis|audio|filter-design|noise|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27462" PostTypeId="1" AcceptedAnswerId="27467" CreationDate="2015-12-02T18:57:41.303" Score="0" ViewCount="5943" Body="&lt;p&gt;I have a temporal signal which looks like $f(t) = t\eta(t)$, where $\eta(t)$ is a white noise with the mean $\eta_m$ and STD $\sigma$. I want to calculate the corresponding spectrum, $F(\omega)$, take its magnitude, $|F(\omega)|$, and finally compute the STD of $|F(\omega)|$ in terms of the given parameters. I have searched some literatures but I couldn't find anything which helps me directly tackle the problem. So, anyone know how to do this, or know which resources you would refer me to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following pictures display $f(t)$ and $|F(\omega)|$.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/E1zR1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E1zR1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one below is the histogram of $|F(\omega)|$ excluding some values around the central peak.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/5CeDh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5CeDh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to derive a mathematical analysis which can compute the standard deviation of the above histogram.&lt;/p&gt;&#xA;" OwnerUserId="18551" LastEditorUserId="18551" LastEditDate="2015-12-02T21:20:46.340" LastActivityDate="2015-12-02T22:04:50.010" Title="Standard deviation of the spectrum of white noise" Tags="|fourier-transform|noise|" AnswerCount="2" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="27463" PostTypeId="2" ParentId="27437" CreationDate="2015-12-02T19:13:48.257" Score="4" Body="&lt;p&gt;OK I did the two some time ago, TDHS in principle just apply time scale modification and to change the pitch do you need apply interpolation (resample) and it will shift the spectral envelope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For TDHS is hard to find some paper that teach how its really works,  I learned the math and how it works in the &lt;a href=&quot;http://alexandria.tue.nl/extra2/afstversl/E/550325.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Burazerovic Dzevdet&lt;/a&gt; paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N_p$ is defined as the &lt;em&gt;local&lt;/em&gt; Pitch Period&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\alpha$ is the time stretch factor&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N_c$ is the cross-fade length, here half the length of the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compress the time $\alpha &amp;lt; 1$ the equation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;N_c &amp;amp; = \operatorname{round}\left(N_p\frac{\alpha}{1-\alpha}\right) \\&#xA;&amp;amp; = \left\lfloor N_p\frac{\alpha}{1-\alpha} + \frac12 \right\rfloor \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &quot;$\lfloor \cdot \rfloor $&quot; is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Floor_and_ceiling_functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;floor()&lt;/code&gt; function&lt;/a&gt; returning the most positive integer not exceeding the argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The illustration from Dzevdet paper show how the algorithm works using a &lt;a href=&quot;https://en.wikipedia.org/wiki/Triangular_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;triangular window&lt;/a&gt; (n. b. 4 cycles become 3 and the period and fundamental frequency (pitch) of the waveform is not changed):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nktHW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nktHW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to expansion $\alpha &amp;gt; 1$ (note 3 cycles become 4 and the period and fundamental frequency (pitch) of the waveform is not changed):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;N_c &amp;amp; = \operatorname{round}\left(N_p\frac{\alpha}{\alpha-1}\right) \\&#xA;&amp;amp; = \left\lfloor N_p\frac{\alpha}{\alpha-1} + \frac12 \right\rfloor \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6QrnF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6QrnF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK here my simple demo how TDHS works to compress:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alpha=0.5;&#xA;f=735;&#xA;Fs=44100;&#xA;signal= 0.9*sin(2*pi*f/Fs*(1:1000)); &#xA;signal = signal';&#xA;period= 60;&#xA;out2=[];&#xA;&#xA;Nc=round((period*alpha)/(1-alpha));&#xA;nsamples = length(signal);&#xA;&#xA;ii=1;&#xA;out2=[];&#xA;while ( ii &amp;lt;= nsamples )&#xA;&#xA;    if ii+Nc+period-1 &amp;gt; nsamples&#xA;        %OK I'm lost some samples in the end of out2 output signal, no problem just tests &#xA;        HI=000 %debug &#xA;&#xA;    else&#xA;&#xA;        frame = signal(ii:ii+Nc+period-1);&#xA;        frame1=frame(1:Nc) .* (1-linspace(0,1,Nc))';&#xA;        frame2=frame(period:Nc+period-1) .* linspace(0,1,Nc)';&#xA;        OUT = frame1+frame2;&#xA;        out2 = [out2' OUT']';&#xA;&#xA;&#xA;    end&#xA;&#xA;    ii = ii + Nc+period-1&#xA;&#xA;end&#xA;&#xA;plot(out2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Course this is just to show for you the concept, I used fixed integer period $N_p = 60 (44100/735)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now To &lt;code&gt;PSOLA&lt;/code&gt; things will  different, Usually you need to use the Pitch information to mark the sign to the glottal instants you can change the Pitch and the time (no formants change here) .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look in my answer about PSOLA &lt;a href=&quot;https://dsp.stackexchange.com/questions/22209/how-to-add-pitch-shifted-version-of-signal-to-itself/22817#22817&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-12-06T04:00:11.910" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27464" PostTypeId="2" ParentId="27456" CreationDate="2015-12-02T19:16:44.293" Score="1" Body="&lt;p&gt;Try flattening your 2D array along the Y or frequency axis instead of along the X or time axis before doing the peak detect.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-02T19:16:44.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27465" PostTypeId="2" ParentId="27462" CreationDate="2015-12-02T19:18:13.437" Score="2" Body="&lt;p&gt;true white noise has infinite power (because the power spectrum with height $ \frac{\eta}{2}$  has infinite area) which means infinite variance $\sigma^2$ which means infinite standard deviation.  white noise is a conceptual instrument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to do any analysis of a system with white noise in it, you must somehow determine the (single-sided) bandwidth of the system, $B$, and then the power or variance is $\eta B$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-12-02T19:18:13.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27466" PostTypeId="1" CreationDate="2015-12-02T21:09:40.637" Score="3" ViewCount="1175" Body="&lt;p&gt;I have a project I'm working on where I'm trying to efficiently compare sequences of binary data to determine how similar they are. Basically, a sequence might look like this:&#xA;1001010010100011110...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I spent a while on my own trying to come up with a way to do it because it's fun for me to work through problems like this on my own, and actually made some progress. Unfortunately, everything I came up with never quite worked; a solution that accounts for substitutions (bits that flip) is easy, but what keeps getting me is handling bits that are inserted or deleted, i.e.:&#xA;100101 -&gt; 1000101&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trying to find a solution online keeps leading me here, and I keep coming across the term cross-correlation. I also see lots of interesting links on the wikipedia page for Time Series for calculating similarities. Unfortunately, at the moment, a lot of the math is unclear to me, and I can't efficiently go through and distinguish what the appropriate technique might be for my situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have two different approaches to my problem that I'm interested in learning about:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) What method would you recommend for calculating the similarity between two bit sequences (typically 50 to 150 bits in length) that is robust to substitutions, insertions, and deletions? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I'm not sure this is possible, but is there some kind of distance metric(s) I can calculate independently for each signal that will allow me to group them together with actually doing direct pairwise comparisons?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 1, I feel like cross-correlation might be the right approach, but I haven't gotten past just plugging sequences in R and seeing how it works for identifying lag. I know edit distance will work, but ultimately will want something more efficient. Eventually, I will be trying to group billions of these together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="18570" LastActivityDate="2015-12-03T08:30:27.133" Title="Calculating similarity between bit strings/signal" Tags="|discrete-signals|signal-analysis|cross-correlation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27467" PostTypeId="2" ParentId="27462" CreationDate="2015-12-02T21:52:00.323" Score="0" Body="&lt;p&gt;There are a few misconceptions here and confusion in what you've plotted versus what you've asked.  This is an attempt to clarify things.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;${\tt CORRECTED}$ : OK, so your noise $\eta(t)$ is non-zero mean, which is why the $t\eta(t)$ term increases.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As &lt;a href=&quot;https://dsp.stackexchange.com/users/4346/robert-bristow-johnson&quot;&gt;robert&lt;/a&gt; says, &quot;white noise&quot; is a useful construct in continuous time. Only &quot;bandlimited white noise&quot; exists in discrete time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your question's title &lt;em&gt;Standard deviation of the spectrum of white noise&lt;/em&gt; needs interpretation to make any sense.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The power spectral density of &lt;strong&gt;bandlimited&lt;/strong&gt; white noise is known, and is constant. If the variance of the noise is $\sigma^2$ then the value of the power spectral density is $\sigma^2$ for all $\omega$.&lt;/li&gt;&#xA;&lt;li&gt;This means that the power spectral density &lt;strong&gt;does not have a standard deviation&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;It's possible to take the DFT of one &lt;em&gt;realization&lt;/em&gt; of the bandlimited white noise.  The DFT of bandlimited white noise is... bandlimited white noise.&lt;/li&gt;&#xA;&lt;li&gt;One interpretation of your question is then: what is the variance of one realization of the DFT of bandlimited white noise? Does that get you the answer you need?&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-12-02T22:04:50.010" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27468" PostTypeId="1" AcceptedAnswerId="27471" CreationDate="2015-12-02T22:24:29.630" Score="5" ViewCount="7770" Body="&lt;p&gt;I have the strain signal of a lateral beam of a car measured at sampling rate 1,200Hz from data acquiring system. Even after using temperature compensation in strain gage, we are getting drift. So I wanted to remove drift in post processing of the strain signal. I have tried using High pass filter (HPF) of order 10th with cutoff freq = 200Hz, but I am losing peaks of the strain signal. So HPF is not useful. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Which filter is suitable to remove drift for strain signals? considering the fact that I want to retain peaks&lt;/strong&gt;  and &lt;strong&gt;what other methods I can use to remove the drifts?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what are the exact factors to consider in choosing the cutoff frequency for HPF? and how to check it is correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have attached the strain signal and HPF filtered signal of 10th order.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sq9zC.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sq9zC.jpg&quot; alt=&quot;strain signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rfQG3.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rfQG3.jpg&quot; alt=&quot;HPF filtered signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17074" LastEditorDisplayName="user11906" LastEditDate="2015-12-06T10:58:13.310" LastActivityDate="2018-08-07T19:52:25.913" Title="How to remove or filter the drift problem in measured Strain signal?" Tags="|filters|discrete-signals|filter-design|noise|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27469" PostTypeId="2" ParentId="27451" CreationDate="2015-12-02T22:54:18.007" Score="10" Body="&lt;p&gt;@MathBgu I have read all above given answers, all are very informative one thing I want to add for your better understanding, by considering the formula of convolution as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(x)*g(x)=\int\limits_{-\infty}^{\infty}f(\tau)g(x-\tau)\,d\tau$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and for the cross correlation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(f\star g)(t)\stackrel{\text{def}}{=}\int\limits_{-\infty}^{\infty}f^*(\tau)g(t+\tau)\,d\tau,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we come to know that equation-wise the only difference is that, in convolution, before doing sliding dot product we flip the signal across y-axis i.e we change &lt;span class=&quot;math-container&quot;&gt;$(t)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(-t)$&lt;/span&gt;, while the cross correlation is just the sliding dot product of two signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use the convolution to get output/result of a system which have two blocks/signals and they are directly next to each other (in series) in the time domain.&lt;/p&gt;&#xA;" OwnerUserId="18571" LastEditorUserId="7654" LastEditDate="2019-05-29T21:15:03.580" LastActivityDate="2019-05-29T21:15:03.580" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27471" PostTypeId="2" ParentId="27468" CreationDate="2015-12-03T01:01:20.163" Score="6" Body="&lt;p&gt;The usual first approach to this is to use a &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/DC_Blocker.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DC Blocker&lt;/a&gt;:&#xA;$$&#xA;y[n] = \alpha y[n-1] + x[n] - x[n-1]&#xA;$$&#xA;where $0 &amp;lt; \alpha &amp;lt; 1$, $y$ is the DC blocked signal and $x$ is your original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I simulate your signal and apply the DC Blocker to it, the results are in the figure below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should preserve the peaks well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;R&lt;/code&gt; code to implement it below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hhPEf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hhPEf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to choose $\alpha$ ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This really depends on what you are going to use the data for later.  If it's a control application, then phase is probably important to you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, you want to JUST remove the DC component and not much else.  In that case, just look at the magnitude frequency response of the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from the plots below, low values of $\alpha$ (less than $0.9$ tend to have a bigger impact on the lower frequencies.  Hence, I tend to use values of $\alpha$ between $0.9$ and $1.0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7rsXX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7rsXX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/egMmQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/egMmQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#27468&#xA;&#xA;T &amp;lt;- 1000&#xA;Npeaks &amp;lt;- 10&#xA;&#xA;idx_peaks &amp;lt;- runif(Npeaks,1,T)&#xA;&#xA;strain &amp;lt;- rnorm(T) + c(seq(1,2*T/3,1) ,seq(2*T/3+1,0,-2))/100&#xA;&#xA;strain[idx_peaks] &amp;lt;- strain[idx_peaks] + 10&#xA;&#xA;detrended &amp;lt;- 0*strain&#xA;alpha &amp;lt;- 0.9&#xA;&#xA;for (k in 1:length(strain))&#xA;{&#xA;  if (k&amp;gt;1)&#xA;  {&#xA;    detrended[k] &amp;lt;- alpha*detrended[k-1] + strain[k] - strain[k-1]&#xA;  }&#xA;  else&#xA;  {&#xA;    detrended[k] &amp;lt;- 0&#xA;  }&#xA;}&#xA;&#xA;par(mfrow=c(2,1))&#xA;plot(strain,col=&quot;blue&quot;, type=&quot;l&quot;)&#xA;plot(detrended,col=&quot;blue&quot;, type=&quot;l&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2018-08-07T19:52:25.913" LastActivityDate="2018-08-07T19:52:25.913" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="27473" PostTypeId="1" CreationDate="2015-12-03T03:57:44.267" Score="3" ViewCount="952" Body="&lt;p&gt;I'm currently trying to remove some noise from a &quot;contaminated&quot; audio file. From what's given, I know that the noise is isolated to a specific frequency band - that is, from ~1400 Hz - ~1800 Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most straightforward approach is to obviously implement a stop-band filter - which I've done successfully. However, I wanted to explore alternative options being that a band-pass filter also eliminates the desired signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've done thus far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB, I explored some aspects of the signal, such as it's power spectrum, autocorrelation, etc:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EGw1E.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EGw1E.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YyXwx.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YyXwx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's clear that the noise is concentrated in the band I mentioned above, and it appears that the noise is Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial thought was to apply a spectral subtraction method, such as the Ephraim-Malah Algorithm, but one of the assumptions made by this method is that the underlying noise is Gaussian White Noise. In the file I have, the noise is limited to only a particular band, not the entire signal. My concern is that if I were to apply the algorithm, I would unintentionally introduce minor distortions to potentially good portions of the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, I'm considering splitting the signal into two portions: use a stop-band filter to extract the unaffected frequencies, and use a band-pass filter to capture the noisy region, apply the algorithm to the latter band, and recombine the signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this an appropriate approach, or is there a simpler and/or better method that I could use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being that I have an idea of what the noise is, I could potentially use a Weiner Filter.&lt;/p&gt;&#xA;" OwnerUserId="16914" LastActivityDate="2016-10-01T15:06:18.733" Title="Removing Bounded Noise from an Audio Signal" Tags="|audio|noise|filtering|denoising|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27474" PostTypeId="1" AcceptedAnswerId="27493" CreationDate="2015-12-03T06:57:38.620" Score="3" ViewCount="70" Body="&lt;p&gt;I wanted to validate a thought on blending of colours digitally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine I have two colours, $C_1$ $(R_1,G_1,B_1)$ and $C_2$ $(R_2,G_2,B_2)$. Now, I create colour $C3$ as follows:&#xA;$C_3 = \alpha C_1 + (1-\alpha) C_2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\alpha$ is a value between $0$ and $1$.&#xA;So, yes, basically, I am trying to put one object over another with a transparency associated with it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to understand is that, if I have $C_3$, $\alpha$ and $C_1$ in the above equation, will I get an accurate value of $C_2$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Math suggests that I should, but I just want to confirm that I am not missing anything. &#xA;Also, can I keep a really high but $&amp;lt; 1$ value for $\alpha$ and still accurately get $C_2$?&lt;/p&gt;&#xA;" OwnerUserId="18576" LastEditorUserId="128" LastEditDate="2019-12-27T17:44:19.650" LastActivityDate="2019-12-27T17:44:19.650" Title="Getting Composition of a Mixture of Colors" Tags="|image-processing|computer-vision|opencv|color|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27475" PostTypeId="2" ParentId="27473" CreationDate="2015-12-03T07:17:55.670" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;http://www.reaper.fm/&quot; rel=&quot;nofollow&quot;&gt;Reaper&lt;/a&gt; digital audio workstation (DAW) software has a &lt;a href=&quot;http://wiki.cockos.com/wiki/index.php/ReaFIR&quot; rel=&quot;nofollow&quot;&gt;ReaFIR&lt;/a&gt; plugin that can be taught the spectral profile of the noise from a sample of it, and it can do spectral &quot;subtraction&quot;. The last time I checked you can try it out for free.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-03T07:17:55.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27476" PostTypeId="1" AcceptedAnswerId="27490" CreationDate="2015-12-03T08:01:01.017" Score="2" ViewCount="1337" Body="&lt;p&gt;Is it safe to assume that if the index of discrete signal is not an integer, then the value of it is 0? For example is the following true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have $x[n] = 1 + (−1)^n$ does $x[3/4]=0$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The TA in my Digital Signals class is saying that this notion is correct, however the general consensus from what I've seen from Google is that $x[3/4]$ should be undefined, not zero.&lt;/p&gt;&#xA;" OwnerUserId="18464" LastEditorUserId="8202" LastEditDate="2015-12-03T10:32:39.093" LastActivityDate="2015-12-04T10:31:45.887" Title="Is the value of a discrete time signal 0 when the index is a non integer value?" Tags="|discrete-signals|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27477" PostTypeId="2" ParentId="27466" CreationDate="2015-12-03T08:30:27.133" Score="2" Body="&lt;p&gt;You should indeed look into &lt;a href=&quot;https://en.wikipedia.org/wiki/Sequence_alignment&quot; rel=&quot;nofollow&quot;&gt;sequence alignment&lt;/a&gt; methods used in bioinformatics. Those can penalize both for insertions/deletions and mismatches. The binary alphabet having a size of 2 and that of DNA having a size of 4 does not require the use of different algorithms if the element-wise comparison results in either &quot;match&quot; or &quot;mismatch&quot;, and a mismatch is penalized for. Check out the &lt;a href=&quot;https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm&quot; rel=&quot;nofollow&quot;&gt;Needleman–Wunsch algorithm&lt;/a&gt;, which is based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Dynamic_programming&quot; rel=&quot;nofollow&quot;&gt;dynamic programming&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some DNA/protein sequence alignment algorithms such as &lt;a href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/12136088&quot; rel=&quot;nofollow&quot;&gt;MAFFT&lt;/a&gt; use Fast Fourier Transform (FFT) for accelerated cross-correlation of residue properties to approximate match calculations.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-03T08:30:27.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27478" PostTypeId="2" ParentId="27476" CreationDate="2015-12-03T08:39:48.737" Score="6" Body="&lt;p&gt;Discrete-time signals are, unsurprisingly, only defined for discrete times, i.e. for integer values of their argument. The value of $x[n]$ for $n$ not an integer is undefined, and $x[3/4]$ or $x[\pi]$ is meaningless.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-03T08:39:48.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27479" PostTypeId="1" AcceptedAnswerId="27482" CreationDate="2015-12-03T09:14:02.283" Score="1" ViewCount="3707" Body="&lt;p&gt;At which stage of digital receiver, the bits are considered as soft bits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to find the exact definition. I have rough idea how soft bits are different from hard bits but in terms of signal processing, I am confused. The signal after demodulation, phase/frequency/timing offset correction before the hard bits should be considered as soft bits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe adding the samples amplitude of a single bit and averaging it over the number of samples to normalize the amplitude of single bit can be referred as soft bit right before converting it into hard bit?  &lt;/p&gt;&#xA;" OwnerUserId="16465" LastActivityDate="2020-04-21T10:26:40.703" Title="Exact definition of soft bits in digital receiver" Tags="|signal-analysis|digital-communications|signal-detection|digital|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27482" PostTypeId="2" ParentId="27479" CreationDate="2015-12-03T09:58:03.197" Score="3" Body="&lt;p&gt;Soft bits or more generally speaking, soft metrics, are usually taken at the output of the demodulator (e.g. the output of a matched filter sampled at $T_b$). A soft bit can be therefore a real value, but it is usually quantified (which is required if a DSP comes after).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A hard bit is obtained by performing a hard decision on a soft metric. So for instance, if $x[kT_b]$ is the output of the matched filter when a BPSK signal is applied, then a hard-bit can be obtained by simply comparing $x[kTb]&amp;gt;0$, which is $0$ or $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This figure from &lt;a href=&quot;https://en.wikipedia.org/wiki/Matched_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt; is self-explanatory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tRJU8.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tRJU8.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you see, the output of the matched filter is actually a continuous signal. Some part of your receiver (which is not included in the figure) must perform also &lt;em&gt;timing estimation&lt;/em&gt; in order to determine at which instant the output of the matched filter must be sampled. Those samples are the red points in the figure, and might be considered as soft bits. So the higher the magnitude of those samples, the more information they provide about what the original transmitted symbol was. That is the advantage of having soft-bits: they don't only tell you what symbol has been probably sent, they also give an idea about that probability.&lt;/p&gt;&#xA;" OwnerUserId="17530" LastEditorUserId="17530" LastEditDate="2015-12-03T11:28:01.817" LastActivityDate="2015-12-03T11:28:01.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27483" PostTypeId="2" ParentId="27473" CreationDate="2015-12-03T10:51:25.937" Score="0" Body="&lt;p&gt;You &lt;em&gt;can&lt;/em&gt; definitely use spectral subtraction methods. The basic assumption that needs to be met is that the noise is approximately stationary or only slowly varying. Note that spectral subtraction is performed in the frequency domain by modifying the magnitude of each frequency bin. If you know in advance that the noise is only present in a certain frequency band, you can apply spectral subtraction just in that band, and leave all other frequency bins unmodified.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-03T10:51:25.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27484" PostTypeId="1" CreationDate="2015-12-03T11:03:39.460" Score="6" ViewCount="10799" Body="&lt;p&gt;I've been trying to understand the concept of the Kalman Filter. I came across &lt;a href=&quot;http://www.bzarg.com/p/how-a-kalman-filter-works-in-pictures/&quot; rel=&quot;noreferrer&quot;&gt;this great article&lt;/a&gt; which makes the concept sufficiently clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I could not understand the concept of the matrix $\mathbf{H}$ which I think is the observation matrix. In Equation 8 in the article, the sensors are modeled using this matrix. I've been through a few posts in this site, where I found that the $\mathbf{H}$ matrix is always a combination of 1's and 0's. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this always true for any system where I am trying to estimate the value of a parameter like velocity or position?&lt;/p&gt;&#xA;" OwnerUserId="11938" LastEditorUserId="80" LastEditDate="2015-12-03T12:44:06.973" LastActivityDate="2018-11-27T09:58:01.240" Title="Observation Matrix in Kalman Filter" Tags="|signal-analysis|kalman-filters|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27485" PostTypeId="2" ParentId="27484" CreationDate="2015-12-03T12:42:51.647" Score="2" Body="&lt;p&gt;Precisely the form that the $\mathbf{H}$ matrix takes depends on your signal model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nice thing about positional models is that we have a very clear relationship between acceleration, velocity, and position --- and the instruments we use to measure those quantities measure them directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means we can write down the state update equations and the measurement equations in terms of those quantities --- and those quantities are good selections for the state of the system (sometimes without acceleration).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this instance, when the &lt;strong&gt;state&lt;/strong&gt; of a system that we are applying a Kalman filter to is directly measurable (through some noisy sensor) then the $\mathbf{H}$ matrix is just 1's and 0's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is sometimes not the case. For example, an equivalent state space system could be defined with a different selection of states. The system still models our positional problem, but the states don't map directly to position and velocity.  &lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-12-03T13:05:21.383" LastActivityDate="2015-12-03T13:05:21.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27486" PostTypeId="2" ParentId="27460" CreationDate="2015-12-03T14:38:49.527" Score="1" Body="&lt;p&gt;Whenever the desired signals and undesired signals are at the same &#xA;frequency band, you can't use the bandpass filter because it will remove both the desired and undesired signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In such cases statistical characterization for filter design is needed. Means you need to find out those statistical characteristics of background voice (noise) which differs your required signal from the noise. Examples include variance, expectation / mean or there can be others depending upon background noise, you might need to design adaptive filter if the noise characteristics changes with time.&lt;/p&gt;&#xA;" OwnerUserId="18571" LastEditorUserId="80" LastEditDate="2015-12-03T15:05:39.480" LastActivityDate="2015-12-03T15:05:39.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27487" PostTypeId="2" ParentId="27432" CreationDate="2015-12-03T15:16:24.990" Score="1" Body="&lt;p&gt;After thinking more about this, I am pretty sure that what you really want to do, and what your MATLAB probably in fact is doing, is study the a function like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\displaystyle f(t)=\int^tdt^\prime (t-t^\prime)\eta(t^\prime)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $\eta(t)$ having the correlation property you've already mentioned.  This will give an FT that is definitely frequency dependent and, I think, looking like your MATLAB results.&lt;/p&gt;&#xA;" OwnerUserId="18550" LastActivityDate="2015-12-03T15:16:24.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27488" PostTypeId="2" ParentId="27484" CreationDate="2015-12-03T15:27:42.233" Score="9" Body="&lt;p&gt;If you can do it that way, it makes it straight forward to implement the Kalman filter. As an example - consider a constant velocity model in Cartesian coordinates, but the only thing you are measuring is the position (not velocity) and you are measuring the position in a Cartesian coordinate system. Then your $\mathbf{H}$ matrix will only pick off the position value as you've described.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a Sonar or Radar system - which measure range and bearing rather than x, y, z. Now the measurements take place in a Polar/Spherical coordinate system but it is easier to keep the model for your targets as having constant velocities in the cartesian coordinate system. Now your state propagation matrix is the same as in the previous case, but now your $\mathbf{H}$ matrix needs to convert your Cartesion state coordinates to Polar/Speherical coordinates for your measurements. e,g, $R =\sqrt{x^2+y^2+z^2}$. So now your $\mathbf{H}$ matrix is not simply extracting one of the state variables. In fact your $\mathbf{H}$ is not even a constant value - it varies with the values of the state vector. Thus the transformation in the measurement matrix $\mathbf{H}$ is non-linear, so the Kalman filter is not even optimal anymore. In this case you now get into the Extended Kalman Filter to try and handle the non-linearity in the transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was meant to give you one specific example. Also, note that there are other ways of handling the Cartesian to Spherical conversion issue.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-12-03T15:27:42.233" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27489" PostTypeId="1" CreationDate="2015-12-03T17:07:17.483" Score="1" ViewCount="155" Body="&lt;p&gt;Suppose there is a two-deimensional image which consists of pixels. In every pixel, there are 0 to n apples with different colors， which can be digitalized(e.g.[0,10000]).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we can plot a histogram for the color distribution of apples in every pixel. Some color may be more significant in this histogram. Let's call them color bumps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image below is for one pixel. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/T6jOD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T6jOD.png&quot; alt=&quot;histogram&quot;&gt;&lt;/a&gt;&#xA;How to detect areas (they also consist of pixels ) with a particular color bump? In this kind of areas, apples in color channel, say [0.2,0.5] are more significant than apples in other channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The shape of an area is irregular generally. We can set color channel we are interested in and the lower limit of significane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to find a pixel as a seed, let it grow, and set criteria to find the boundary where a growth stops.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or we find pixels one by one, then connect pixels to from a continuous area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which kind of algorithm is good at this? You have ever met this kind of example in practise?&lt;/p&gt;&#xA;" OwnerUserId="5690" LastEditorUserId="128" LastEditDate="2019-06-24T08:50:49.243" LastActivityDate="2019-06-24T08:50:49.243" Title="Detection Algorithm in 2D Images" Tags="|image-processing|" AnswerCount="1" CommentCount="17" ContentLicense="CC BY-SA 4.0" />
  <row Id="27490" PostTypeId="2" ParentId="27476" CreationDate="2015-12-03T17:30:59.613" Score="2" Body="&lt;p&gt;While I agree with Matt L.'s answer, there is a case that needs to  be thought of: upsampling with no interpolation step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a signal, $x[n]$ that we want to resample at three times the sampling rate.  The new signal, $x_{\times 3}[m]$ will be:&#xA;$$&#xA;x_{\times 3}[m] = \left\{  \begin{array}{l,l}&#xA;x[m/3], &amp;amp; \mbox{ if $m \mod 3 = 0$ }\\&#xA;?? &amp;amp; \mbox{otherwise}&#xA;\end{array}&#xA;\right .&#xA;$$&#xA;In this case, we need to set $??$ to be 0 in order to fully define the upsampled signal, $x_{\times 3}[m]$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-03T17:30:59.613" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27492" PostTypeId="2" ParentId="27476" CreationDate="2015-12-03T20:01:20.770" Score="2" Body="&lt;p&gt;your TA is, strictly speaking, incorrect and Matt is, strictly speaking, correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;however&lt;/em&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can take any discrete-time signal and associate that with a &lt;em&gt;uniformly-sampled continuous-time signal&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_\text{s}(t) \triangleq \sum\limits_{n=-\infty}^{+\infty} x[n] \delta(t - n)  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, in that case, the value of $x_\text{s}(t)$ &lt;strong&gt;is&lt;/strong&gt; defined in between samples, when $t$ is not an integer, and that value &lt;strong&gt;is&lt;/strong&gt; zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW, hardcore strict mathematicians would be unhappy seeing naked dirac impulses $\delta(t - n)$ without being surrounded by an integral.  just FYI.  (but being an EE, i don't have a problem with it.)&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-12-03T20:01:20.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27493" PostTypeId="2" ParentId="27474" CreationDate="2015-12-03T20:31:57.607" Score="0" Body="&lt;p&gt;You actually have 3 independent equations.&lt;br&gt;&#xA;If one of them is solvable, all three are.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the equation is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ z = \alpha x + \left( 1 - \alpha \right) y $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume $ \alpha, x, z $ are known, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y = \frac{z - \alpha x}{1 - \alpha} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any value of $ \alpha \neq 1 $ the solution is valid.&lt;br&gt;&#xA;Moreover, if $ alpha = 1 $ then $ z = x $ and $ y $ is irrelevant.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the other case, restoring $ x $, yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x = \frac{z - \left( 1- \alpha \right) y}{\alpha} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any value of $ \alpha \neq 0 $ the solution is valid.&lt;br&gt;&#xA;Moreover, if $ alpha = 0 $ then $ z = y $ and $ x $ is irrelevant.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you wrote, in order to have a Linear Interpolation the parameter $ \alpha $ must be in the range $ \left[ 0, 1 \right] $.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-12-03T20:31:57.607" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27494" PostTypeId="1" AcceptedAnswerId="27546" CreationDate="2015-12-03T22:28:34.447" Score="2" ViewCount="7701" Body="&lt;p&gt;I have a random signal &lt;code&gt;x&lt;/code&gt; of 1000 samples and I've to generate &lt;code&gt;y1&lt;/code&gt; by filtering &lt;code&gt;x&lt;/code&gt; using an autoregressive (AR) filter of order n (let say 4). I've tried the following code to implement the autoregressive definition (As in Autoregressive model only the past values of the model output, and the present value of the model input are used)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1,1000);&#xA;a=0.1&#xA;M=4; &#xA;for i = 1:length(x)&#xA;sum=0;&#xA;y1(i)=0;&#xA;for j = 1:M+1&#xA;    if (i-j&amp;gt;0)&#xA;     sum = sum + a*y1(i-j);&#xA;    end&#xA;end&#xA;y1(i)=sum +a*x(i);&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that, I need to multiply the previous output &lt;code&gt;y1&lt;/code&gt; and current input &lt;code&gt;x&lt;/code&gt; with a=0.1, otherwise it gives an unstable filter which leads to infinity. Please clarify which mistake I'm making while filtering &lt;code&gt;x&lt;/code&gt; using AR filter or I'm doing it the wrong way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore after doing this step, I need to find &lt;code&gt;y2&lt;/code&gt; by adding some amount of additive white gaussian noise (AWGN) in &lt;code&gt;y1&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y2 = awgn(y1,25);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then using &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y2&lt;/code&gt;, I have to find the coefficients of my autoregressive filter using Yule Walker equation for order 4. I've tried this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;r = autocorr(y2,4)';&#xA;R = toeplitz(r);&#xA;&#xA;w = inv(R)*r;   % as Yule Walker eq: w=R^-1*r&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it's not giving correct coefficients (or filter taps).&#xA;Please somebody help me if there's something I'm missing in understanding the question fully or making some mistake somewhere in the code?&lt;/p&gt;&#xA;" OwnerUserId="18571" LastEditorUserId="8952" LastEditDate="2015-12-06T10:58:53.873" LastActivityDate="2017-09-05T19:48:24.747" Title="Filtering a signal using Autoregressive (AR) filter and finding the coeff of AR filter using Yule Walker equation in MATLAB" Tags="|matlab|filters|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27495" PostTypeId="2" ParentId="27476" CreationDate="2015-12-03T23:12:35.820" Score="0" Body="&lt;p&gt;It is not safe, unless you make conventions or  assumptions. The wikipedia entry for &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete-time_signal&quot; rel=&quot;nofollow&quot;&gt;Discrete-time signal&lt;/a&gt; says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A discrete signal or discrete-time signal is a time series consisting&#xA;  of a sequence of quantities. In other words, it is a time series that&#xA;  is a function over a domain of integers[...] the sampling rate is not&#xA;  apparent in the data sequence&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So first, integer indices do not imply your signal is regularly sampled. Indeed, one can distinguish two main origins:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the sampling (possibly irregular, lacunary) of a continuous time signal&lt;/li&gt;&#xA;&lt;li&gt;the capture of a discrete-time process.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In the  first case, without a signal model, or a sampling pattern, there a possibly infinitely many continuous signals passing through your discrete points.  More precisely, you can get $s(t) = \sum_n s[n]\psi(t-t_n)$ with specific assumptions, where $t_n$ is the sampling time, and $\psi$ a specific kernel (for instance, a cardinal sine). In the second case, there are zero solutions, as nothing makes sense in the interval. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when the set of options is either infinite or void, one can define a convention, as long as it is  useful and is not contradictory  with your  system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to other answers, let me mention a practical cases where fractional indices are indeed useful, at the  border of the  two above origins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Construct the downsampled signal $x[n]$ (by a factor of 4 here) of a regularly sampled signal $y[n]$. For instance, one writes $x[n] = y[4n]$, somehow reindexing $x$.  I would not be offended to see $x[3/4] = y[3]$ as a shorthand with obvious meaning (such improper notations sometimes appear in the  filter bank literature). This is a case of two sampling systems, one being the  &quot;multiple&quot; of the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have encountered a similar situation in real-time system modeling. Some models communicate at a base rate $r$, while submodels update at a faster rate, e.g. $4r$. Here, some people index data at the communication rate $x[n]$, because it is the most natural, and index the submodel signal at rationals $y[n/4]$ without  ambiguity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last question is: why do you want or need to define your $x[3/4]$ sample?&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-12-04T10:31:45.887" LastActivityDate="2015-12-04T10:31:45.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27497" PostTypeId="1" AcceptedAnswerId="27502" CreationDate="2015-12-04T01:15:43.817" Score="1" ViewCount="216" Body="&lt;p&gt;Currently our software is detecting tones using FFT and checking if there is only a single peak in frequency spectrum. Our software needs to know what kind of input it is before taking action. So we differentiate the case when tone is fed as input or if the input is music.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However we are trying to reduce the &lt;a href=&quot;https://en.wikipedia.org/wiki/Instructions_per_second&quot; rel=&quot;nofollow&quot;&gt;MIPS&lt;/a&gt; and wondering if there is any other better ways to detect tones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found correlation with previous data can be used but again don't know the right method to do it. Is there any better method?&lt;/p&gt;&#xA;" OwnerUserId="18347" LastEditorUserId="18347" LastEditDate="2015-12-04T01:18:54.873" LastActivityDate="2015-12-04T09:41:45.560" Title="reducing MIPS in detecting tones" Tags="|fft|continuous-signals|signal-detection|peak-detection|tone-generation|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27498" PostTypeId="1" AcceptedAnswerId="27500" CreationDate="2015-12-04T05:46:41.103" Score="0" ViewCount="2746" Body="&lt;p&gt;This &lt;em&gt;may&lt;/em&gt; or &lt;em&gt;may not&lt;/em&gt; be an image processing problem. &#xA;I am developing a simple system that captures images of a part as they are being manufactured and sent out along the conveyor belt. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've solved the alignment problems, and background subtraction problem that this application requires. Everything is working in my prototype setup where I manually place parts with and without defect under the camera in different lighting conditions, position and other realistic variables. My setup uses Logitech C920 web cam, the software is able to process each frame in less than 1 second on average. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem arises when I start simulating the parts on the moving conveyor belt, it is unable to capture frame fast enough resulting in motion blur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is the issue approached in this industry? &#xA;If I switch to use a DSLR and use the correct f-stop (etc.) will that solve the blur problem? If so, wouldn't DSLR overheat since it has to capture so many frames for hours and hours and hours? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;PS&lt;/strong&gt;: speed of conveyor belt is fast but slow enough to easily track with human eyes. I don't have the information about the exact speed at this time.&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="17192" LastActivityDate="2015-12-04T09:33:28.240" Title="Capturing images on fast moving conveyor belt" Tags="|image-processing|camera|motion|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27499" PostTypeId="1" AcceptedAnswerId="27533" CreationDate="2015-12-04T08:18:13.040" Score="2" ViewCount="1036" Body="&lt;p&gt;I am comparing the spectral contents of some sound signals with MATLAB. I have quite a few measures but wanted one that represents the centre of gravity of the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used &lt;a href=&quot;https://de.mathworks.com/matlabcentral/fileexchange/11345-speccentroid?requestedDomain=www.mathworks.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;SpecCentroid()&lt;/code&gt; found in File Exchange&lt;/a&gt; to calculate the linear mean spectrum centroid. Then I also used the function &lt;code&gt;meanfreq()&lt;/code&gt; and &lt;code&gt;medianfreq()&lt;/code&gt; from MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am struggling to understand (mathematically and perceptually) the differences of these measures and so I am not too sure which one to choose to best compare signals between each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 2 types of sounds from different sources and try to compare their spectral 'signatures' to predict if they both would be relevant to some animal species. At this point, I am only interested in the frequency domain (although ultimately the time domain will be as equally important). I have so far compared the peak frequencies. However, as the signals are quite noisy, I was wondering if other measures could be more appropriate. That is why I was exploring the centroid, mean, median options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the same plot as before in the linear scale:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wicgJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wicgJ.png&quot; alt=&quot;PSD linear example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Laurent Duval's answer and suggestions, I tested the estimated peak location, with different weights. For the signal example given above, I got:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}{|c|c|c|}&#xA;\hline\text{$p$} &amp;amp; \text{$f$} &amp;amp; \text{dispersion $d$} \\&#xA;\hline&#xA;1 &amp;amp; 979.6 &amp;amp; 979 \\&#xA;2 &amp;amp; 493.12 &amp;amp; 627\\&#xA;3 &amp;amp; 327 &amp;amp; 295\\&#xA;4 &amp;amp; 296 &amp;amp; 135\\&#xA;5 &amp;amp; 291.14 &amp;amp; 65\\&#xA;6 &amp;amp; 285 &amp;amp; 35\\\hline&#xA;\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The peak frequency as found with &lt;code&gt;findpeaks()&lt;/code&gt; was $285$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take one of my more noisy signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{array}{|c|c|c|}&#xA;\hline\text{$p$} &amp;amp; \text{$f$} &amp;amp; \text{dispersion $d$} \\&#xA;\hline&#xA;1 &amp;amp; 1460 &amp;amp; 826\\&#xA;2 &amp;amp; 1295 &amp;amp; 768\\&#xA;3 &amp;amp; 1122 &amp;amp; 719\\&#xA;4 &amp;amp; 955 &amp;amp; 648\\&#xA;5 &amp;amp; 811 &amp;amp; 562\\&#xA;6 &amp;amp; 698 &amp;amp; 470\\\hline&#xA;\end{array}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The peak frequency as found with &lt;code&gt;findpeaks()&lt;/code&gt; was $427$.&#xA;Example at $p=4$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4iWuZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4iWuZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is quite clear that the dispersion is much higher than for the last (less noisy) signal.&lt;/p&gt;&#xA;" OwnerUserId="17397" LastEditorUserId="1629" LastEditDate="2017-11-18T04:27:06.607" LastActivityDate="2017-11-18T04:27:06.607" Title="Finding the right measure to compare sound signals in the frequency domain" Tags="|matlab|signal-analysis|power-spectral-density|sound|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27500" PostTypeId="2" ParentId="27498" CreationDate="2015-12-04T08:26:43.280" Score="2" Body="&lt;p&gt;Try reducing exposure time if your camera allows that. With the short exposure time the conveyor belt should be well-lit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is not enough, a common solution is to use a flash which is synchronized to the camera. If a sync signal is not readily available from the camera and you can't trigger the camera with your own sync signal, you probably could find a pin on your prototype camera's circuit board that carries a signal you can sync the strobe light to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without synchronization, setting the strobe rate to about 2/3 of the frame rate may be a reliable solution that gives good frames separated by at most one bad frame. Whether that works depends on whether there is a rolling or a progressive shutter and on the exposure time. Other ratios closer to 1 might work better in case of a rolling shutter and/or a short exposure time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About DSLR cameras, you should use a camera that uses an electronic shutter in the mode (still/video) you would use. Cameras do not normally overheat but a mechanical shutter is only specified for that many cycles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also line scanners are a possibility, but I have no idea if those are commonly used. Think of a flatbed scanner where instead of moving the scanner head the target is moving. Those never blur the image but require bright illumination along the line being imaged. That may be easier to arrange than illumination over a large area, but it's a more exotic solution than a normal area camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More of an anecdote: A synchronously rotating prism with parallel opposite sides, located in front of the camera, can approximately compensate for linear motion.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-04T08:26:43.280" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27501" PostTypeId="2" ParentId="27498" CreationDate="2015-12-04T09:33:28.240" Score="1" Body="&lt;p&gt;You usually don't use webcams for machine vision applications, but an industrial-grade camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need a shorter exposure time. You need to make sure that during exposure the part moves by less than one pixel or so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reducing exposure time will reduce the amount of light, which you will need to compensate by&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;increasing the aperture, as long as possible and as depth-of-field allows it,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;or adding illumination, preferably LED lighting, be it continuous or strobed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These pieces of equipment are designed for long-term usage, but they belong to another range of pricing.&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastActivityDate="2015-12-04T09:33:28.240" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27502" PostTypeId="2" ParentId="27497" CreationDate="2015-12-04T09:41:45.560" Score="1" Body="&lt;p&gt;Assuming that the tones are sufficiently sinusoidal, here's a possible scheme, with a bandpass filter being controlled by a frequency estimator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4u5lG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4u5lG.png&quot; alt=&quot;Scheme&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the tunable bandpass filter's output is at about the same power as the input signal, then the input consists mainly of a sinusoidal tone. It is perfectly fine if the frequency estimator is a simple one that only gives a meaningful output for the tone to be detected.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-04T09:41:45.560" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27503" PostTypeId="2" ParentId="26266" CreationDate="2015-12-04T10:21:16.707" Score="1" Body="&lt;p&gt;You may try an OCR detector like Teseract with OpenCV:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/tesseract-ocr&quot; rel=&quot;nofollow&quot;&gt;https://github.com/tesseract-ocr&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Train the Teseract algorithm with text samples obtained from the numbers you want to detect and it will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: If you want a similar implementation of what you want you may check this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://answers.opencv.org/question/10985/how-can-i-determine-the-location-of-lcdled-display-in-an-image-with-opencv-and-perl/&quot; rel=&quot;nofollow&quot;&gt;http://answers.opencv.org/question/10985/how-can-i-determine-the-location-of-lcdled-display-in-an-image-with-opencv-and-perl/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18589" LastEditorUserId="18589" LastEditDate="2015-12-09T17:00:57.960" LastActivityDate="2015-12-09T17:00:57.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27506" PostTypeId="1" CreationDate="2015-12-04T11:57:23.727" Score="1" ViewCount="22" Body="&lt;p&gt;I've recently read the following&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For our pixel labeling, consistent with [20], we report the&#xA;  number of pixels correctly classified (per-pixel rate) and the&#xA;  average of per-class rates. The per-pixel rate indicates how&#xA;  well the system is doing on the large common classes, while&#xA;  the average per-class rate is more affected by the smaller,&#xA;  less common classes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://slazebni.cs.illinois.edu/publications/jtighe-cvpr14.pdf&quot; rel=&quot;nofollow&quot;&gt;Scene Parsing with Object Instances and Occlusion Ordering&lt;/a&gt; by Joseph Tighe, Marc Niethammerm, Svetlana Lazebnik.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know per-pixel rate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ppr(image) = \frac{\text{pixels which were assigned the correct class}}{\text{total number of pixels of image}} \cdot 100$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure how per-class rate is defined. I can imagine two ways. Let $C$ be the set of all classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$pcr_A(image) = \frac{1}{|C|} \sum_{\text{class }c \in C}\frac{\text{pixels of class $c$ classified correctly}}{\text{total number of pixels of class } c} \cdot 100$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$pcr_B(image) = \frac{1}{|C|} \sum_{\text{class }c \in C}\frac{\text{Pixels classified as class }c}{|\{\text{Pixels classified as class }c\} \cup \{\text{Pixels of class }c\}|} \cdot 100$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one is the one used in the work I've cited above? Is the other one used? Where? Is there a definition in literature?&lt;/p&gt;&#xA;" OwnerUserId="9101" LastActivityDate="2015-12-04T11:57:23.727" Title="How is per-class rate defined?" Tags="|computer-vision|image-segmentation|terminology|measurement|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27507" PostTypeId="1" CreationDate="2015-12-04T14:16:00.173" Score="1" ViewCount="238" Body="&lt;p&gt;From other posts I understood that it is normally no problem to simulate a communication system in the baseband though it is carrier modulated in reality. It just speeds up the simulation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if I want to add noise to the signal and the noise shape is depending on the frequency? Of course I want to superpose my signal with the noise around my carrier frequency and not the baseband noise. I guess that simply adding noise and baseband signal would falsify the simulation...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a solution so that I can still simulate in the in the baseband? Maybe to transfer the noise to baseband somehow?&lt;/p&gt;&#xA;" OwnerUserId="18594" LastActivityDate="2015-12-04T14:33:15.173" Title="Baseband vs Passband simulation in terms of noise impact" Tags="|noise|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27508" PostTypeId="2" ParentId="27507" CreationDate="2015-12-04T14:33:15.173" Score="1" Body="&lt;p&gt;In fact, bandpass noise (or any kind of noise process) can be modelled as a system $h(t)$. As so, there is a lowpass equivalent $h_l(t)$ such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;h(t) = Re[h_l(t)\exp(j2\pi f_0t)]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can work with $h_l(t)$ in the baseband.&lt;/p&gt;&#xA;" OwnerUserId="17530" LastActivityDate="2015-12-04T14:33:15.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27509" PostTypeId="1" CreationDate="2015-12-04T15:24:57.397" Score="0" ViewCount="2761" Body="&lt;p&gt;I am talking about a DSB- Suppressed Carrier amplitude modulation.&lt;br&gt;&#xA;Let message signal be $m(t)=A_m \cos{\omega_c t}$ and carrier signal be $c(t)=A_c \cos{\omega_m t}$&lt;br&gt;&#xA;Then the amplitude modulated signal is &#xA;$$s(t)=m(t)c(t)$$&#xA;$$s(t)=A_c A_m \cos{\omega_c t} \cos{\omega_m t}$$&#xA;$$s(t)=\frac{A_c A_m}{2} \{\cos{(\omega_c+\omega_m) t} + \cos{(\omega_c-\omega_m) t}\} \tag3$$&#xA;In frequency domain $s(t)$ is&lt;a href=&quot;https://i.stack.imgur.com/NURvo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NURvo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From eq &lt;strong&gt;3&lt;/strong&gt; it is visible that two frequency components $\omega_c+\omega_m$ , $\omega_c-\omega_m$ are present.&#xA;&lt;strong&gt;Then in frequency domain $S(\omega)$ why isn't there an impulse at these locations ?&lt;/strong&gt; (and at their negative frequencies, of course)&lt;/p&gt;&#xA;" OwnerUserId="7724" LastEditorUserId="7724" LastEditDate="2015-12-04T17:05:56.760" LastActivityDate="2015-12-04T17:05:56.760" Title="Frequency spectrum of an amplitude modulated signal" Tags="|frequency-spectrum|modulation|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27510" PostTypeId="1" CreationDate="2015-12-04T15:25:41.233" Score="1" ViewCount="343" Body="&lt;p&gt;Steganography can hide one image inside another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have a compression algorithm that allows us to fit the bits for two images into the size of one, can we think of a way to modify a run-length encoding algorithm to take two images and produce one, in such a way that the first is retrieved in a lossy way, and the second is retrieved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please explain this with full description of your thinking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you know a good reference, please let me know.&lt;/p&gt;&#xA;" OwnerUserId="18438" LastEditorUserId="18438" LastEditDate="2015-12-05T14:07:29.093" LastActivityDate="2020-01-25T02:01:20.387" Title="compression algorithm" Tags="|image-processing|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27511" PostTypeId="2" ParentId="27509" CreationDate="2015-12-04T15:38:14.540" Score="1" Body="&lt;p&gt;With $s$, $m$, and $c$ as you display, then the diagram of $S(\omega)$ is incorrect.  If it were, the spectrum of $m$ would be a triangle centered at zero frequency, which it is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;S(\omega) = \frac{A_cA_m}{4} \left[\\&#xA;\delta\left(\omega - (\omega_c + \omega_m)\right)\\&#xA;+ \delta\left(\omega - (\omega_c - \omega_m)\right)\\&#xA;+ \delta\left(\omega - (-\omega_c - \omega_m)\right)\\&#xA;+ \delta\left(\omega - (-\omega_c + \omega_m)\right)\\&#xA;\right]$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-04T15:38:14.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27513" PostTypeId="1" CreationDate="2015-12-04T16:16:04.857" Score="2" ViewCount="214" Body="&lt;p&gt;I'm using scipy &lt;code&gt;maximum_filter&lt;/code&gt; together with &lt;code&gt;binary_erosion&lt;/code&gt; to find peaks in my spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just wondering if there are any other better alternatives?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at &lt;a href=&quot;https://gist.github.com/endolith/250860&quot; rel=&quot;nofollow&quot;&gt;endolith's project&lt;/a&gt;. But the peaks from it are not spread out evenly in $x$ and $y$ axis.&lt;/p&gt;&#xA;" OwnerUserId="18563" LastEditorUserId="80" LastEditDate="2015-12-04T16:24:39.057" LastActivityDate="2015-12-04T16:24:39.057" Title="Alternative to scipy maximum_filter to find peaks?" Tags="|audio|dsp-core|scipy|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27515" PostTypeId="2" ParentId="26809" CreationDate="2015-12-04T16:57:37.207" Score="1" Body="&lt;p&gt;Rick's answer concerns trying to combine the results of two (or more) DFT's coherently. I'm interpreting your question differently - does a single DFT provide coherent integration? If you are trying to detect a sinusoid then yes the DFT provides Coherent Integration. Consider a signal consisting of a complex sinusoid of amplitude 1 and zero mean white Gaussian Noise with a variance of 1. The input signal is given by&#xA;$$x(n) = \exp(j2\pi mn/N) +w(n),$$&#xA;where $w(n)$ is the noise and $m$ is an integer and therefore the frequency will correspond exactly with one of the basis vectors of the FFT or equivalently this means the frequency is exactly on one of the FFT frequency bins. Looking at the SNR of the input signal, the signal power is equal to 1 and the noise power is equal to 1 (by the given conditions). There for the SNR = 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the definition of the FFT as&#xA;$$X(k)= \sum_{n=0}^{N-1}x(n)e^{-j2\pi kn/N}$$&#xA;we can examine the resulting SNR in a single FFT bin. For the signal only case $X(k)=0$ except when $m=k$ then we have&#xA;$$ X(m)=\sum_{n=0}^{N-1}e^{j2\pi mn/N}e^{-j2\pi mn/N}=\sum_{n=0}^{N-1}1=N$$ &#xA;then the signal power is $|(X(m))|^2=N^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the noise power in a FFT bin we use the expected value or variance i.e. then letting $W(k)$ denote the FFT of the noise only signal - then since W(k) is a linear combination of zero mean Gaussian variables then $W(k)$ is also a zero mean Gaussian variable and the variance is the sum of the individual variances in each term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$var[W(K)] = \sum_{n=0}^{N-1} var \left[w(n)e^{-j2\pi kn/N} \right] =var[w(n)] \sum_{n=0}^{N-1} |e^{-j2\pi kn/N}|^2= N \cdot var [w(n)] = N$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we have used the scaling properties of the variance and the fact that the noise is zero mean. The SNR in the FFT bin is $N^2/N=N$. This is the coherent gain of the FFT when the sinusoid lies exactly on an FFT bin. You can also view FFT as a bank of Matched Filters for a sinusoidal input and look at the theory of Matched Filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note - the analysis can be generalized for any zero mean and independent noise process, since the scaling property still holds for the variance. It's just a bit quicker and easier to do for a Gaussian noise process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case when the signal is not exactly on a FFT bin there is a processing loss, this is commonly referred to as Scalloping Loss. You can read more about this in the classic paper on Windows by Fred Harris.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that if you average the magnitude of sequential FFTs there is no coherent gain, instead you are reducing the variance of the estimate caused by the noise. For white noise if you look at the magnitude of a single FFT then there is quite a variation across all the frequency bins. Once you start averaging the magnitude or magnitude squared then the amplitude will show reduced variation and will approach a constant value. This is referred to as non-coherent processing because by using the Amplitude you are losing the phase information required for coherent processing.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2015-12-04T18:24:06.827" LastActivityDate="2015-12-04T18:24:06.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27516" PostTypeId="2" ParentId="27445" CreationDate="2015-12-04T17:00:37.723" Score="1" Body="&lt;p&gt;Before I try to answer the question, let's see how the question relates to dispersion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution space of a dispersive (linear) wave equation in $n$ dimensions is spanned by the basis functions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_{\mathbf{k}}(\mathbf{x},t) = \exp( i\, \omega(\mathbf{k}) t )\exp( i\, \mathbf{k}\cdot \mathbf{x} )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{k} \in \mathbb{R}^n$ is the spatial frequency vector or wave vector. The temporal frequency $\omega$ depends on the  wave vector, or just on its magnitude $|\mathbf{k}|$ if the dispersion is isotropic. If $\omega \propto |\mathbf{k}|$ we have the special case of no dispersion. We can also assume in general that $\omega\geq 0$ to simplify calculations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basis functions are orthonormal in the Dirac sense with respect to their spatial coordinate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\langle f_{\mathbf{k}},f_{\mathbf{k'}}\rangle := \int_{\mathbb{R}^n} f_{\mathbf{k}}(\mathbf{x},t)\, f_{\mathbf{k'}}(\mathbf{x},t)\, d\mathbf{x} = \delta(\mathbf{k}-\mathbf{k'})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the general solution of the wave equation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(\mathbf{x},t) = \int_{\mathbb{R}^n} c(\mathbf{k})\, f_{\mathbf{k}}(\mathbf{x},t)\, d\mathbf{k} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we now observe that general solution at $\mathbf{x}=0$, we get the relationship&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(0,t) = \Re\left(\int_{\mathbb{R}^n} c(\mathbf{k})\,\exp( i\, \omega(\mathbf{k}) t )\, d\mathbf{k}^n \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which looks similar to a Fourier transform of $c(\mathbf{k})$. If we can turn this into a proper Fourier transform, the inverse Fourier transform of the observation will give us the expansion coefficients $c(\mathbf{k})$ required for the reconstruction of the full spatial solution of the wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, we need to make a few additional assumptions. The first one is that $n$ equals 1 so that the coefficients are also a function on $\mathbb{R}$. We also have to assume that the dispersion is isotropic and $\omega(|\mathbf{k}|)$ is differentiable and strictly monotonic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not enough however. We also need to assume a direction of travel so that $\omega(|\mathbf{k}|)$ becomes an invertible function on a restriction of $k&amp;gt;0$ or $k&amp;lt;0$ respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We pick a &quot;right&quot; travelling wave, so $k&amp;gt;0$. With this, we can change the integration variable with $dk=\frac{\partial k}{\partial\omega}\,d\omega$ to get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(0,t) = \Re\left(\int_\mathbb{R_{\geq 0}} c(k(\omega)) \frac{\partial k(\omega)}{\partial\omega} \exp(i\,\omega t)\, d\omega \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k(\omega)$ is the inverse function of $\omega(k)$. Identifying &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(\omega) := c(k(\omega)) \frac{\partial k(\omega)}{\partial\omega}$$ for $\omega\geq 0$ and the complex conjugate for $\omega&amp;lt;0$, we can see that $f(0,t)$ is the Fourier transform of $C(\omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the inverse Fourier transform we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(\omega) = \int_\mathbb{R}f(0,t) \exp(-i\,\omega t) dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and consequentially&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c(k(\omega)) = \frac{1}{k'(\omega)} \int_\mathbb{R}f(0,t) \exp(-i\,\omega t) dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or simply&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c(k) = \omega'(k) \int_\mathbb{R}f(0,t) \exp(-i\,\omega(k) t) dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which we can express in terms of the inverse Fourier transform as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c(k) = \omega'(k)\,\mathcal{F_t}^{-1} \left\{ f(0,t) \right\}\left( \omega(k) \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this theoretical background we can now reconstruct the spatial wave function of a &lt;em&gt;free one-dimensional right travelling wave with open boundary conditions&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the expansion of the general wave solution from above we can substitute the $c(k)$ to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x,t)=\int_\mathbb{R} \omega'(k)\,\mathcal{F_t}^{-1} \left\{ f(0,t) \right\}\left( \omega(k) \right)\, \exp( i\, \omega(k) t )\exp( i\, k x ) dk $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can also be written as a Fourier transform in $k$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x,t)= \mathcal{F_k}\left\{ \mathcal{F_t}^{-1} \left\{ f(0,t) \right\}\left( \omega(k) \right)\,\omega'(k)\,\exp(i\,\omega(k)\,t)\, \right\}(x)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This translates to the following algorithm for the reconstruction of the spatial wave function at time $t$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take the inverse Fourier transform of $f(0,t)$&lt;/li&gt;&#xA;&lt;li&gt;Evaluate the result at $\omega(k)$&lt;/li&gt;&#xA;&lt;li&gt;Multiply the result with $\omega'(k)$&lt;/li&gt;&#xA;&lt;li&gt;Evolve the result in time by multiplying with $\exp(i\,\omega(k)\,t)$&lt;/li&gt;&#xA;&lt;li&gt;Take the forward Fourier transform with respect to k&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can implement this in the discrete domain by taking regular grids for the variables $\omega$ and $k$ and use the discrete Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, it's a little more complicated than what you described, but your idea was going in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-12-04T17:00:37.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27517" PostTypeId="1" CreationDate="2015-12-04T17:17:07.690" Score="1" ViewCount="99" Body="&lt;p&gt;I have to measure the distance between two pulse trains, each of which looks like a slightly long tailed Gaussian distribution. Is there a relatively easy curve fitting method for this? I can do it with the required accuracy if the distribution does not have a prominent tail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[As an aside, autocorrelation using FFTs is not good enough]&lt;/p&gt;&#xA;" OwnerUserId="7233" LastActivityDate="2015-12-04T17:17:07.690" Title="Curve fitting to distorted Gaussian" Tags="|gaussian|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27520" PostTypeId="1" CreationDate="2015-12-04T19:17:51.743" Score="0" ViewCount="1519" Body="&lt;p&gt;If I want to add 3dB per octave to signal (e.g. to flatten out the power spectrum of an exponential sine sweep), is it really just as simple as...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take the Fourier transform of the time-domain signal, let's call this A(f).&lt;/li&gt;&#xA;&lt;li&gt;Multiply this by the square root of the frequency  (square root because power goes like amplitude squared)?&lt;/li&gt;&#xA;&lt;li&gt;Maybe normalize by the lowest frequency, so that there's unity gain for that frequency.&lt;/li&gt;&#xA;&lt;li&gt;Take the inverse Fourier transform to get back to the time domain.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Mathematically, the filter would be, simply,...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A'(f) := A(f) * sqrt ( f / f_low )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this right, and/or is there a better way?&lt;br&gt;&#xA;(I've searched around and...it seems this is such a simple matter that people don't post how to do this.)&lt;/p&gt;&#xA;" OwnerUserId="11869" LastActivityDate="2015-12-05T09:38:55.053" Title="Filter to add 3dB per octave?" Tags="|filters|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27521" PostTypeId="2" ParentId="27520" CreationDate="2015-12-04T20:43:08.433" Score="1" Body="&lt;p&gt;take any of the &lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/&quot; rel=&quot;nofollow&quot;&gt;pinking filters&lt;/a&gt; you can find and swap the zeros with the poles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. here's my pinking filter with 3 real poles and 3 real zeros (all inside the unit circle):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = A \frac{(z-q_1)(z-q_2)(z-q_3)}{(z-p_1)(z-p_2)(z-p_3)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_1$ = 0.99572754,     $q_1$ = 0.98443604 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_2$ = 0.94790649,     $q_2$ = 0.83392334 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_3$ = 0.53567505,     $q_3$ = 0.07568359&lt;/p&gt;&#xA;&#xA;&lt;p&gt;just swap the poles with the zeros.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-12-04T20:43:08.433" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="27522" PostTypeId="1" CreationDate="2015-12-04T21:22:09.143" Score="2" ViewCount="187" Body="&lt;p&gt;Are there any Open source implementations of GPS+IMU sensor fusion (loosely coupled; i.e. using GPS module output and 9 degree of freedom IMU sensors)? -- kalman filtering based or otherwise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see a few open source implementations of IMU sensor fusion that merge accel/gyro/magneto to provide the raw-pitch-yaw, but haven't found anything that includes GPS data to provide filtered location and speed info.&lt;/p&gt;&#xA;" OwnerUserId="13422" LastActivityDate="2015-12-04T21:22:09.143" Title="Open source GPS+IMU sensor fusion?" Tags="|filters|kalman-filters|filtering|sensor|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27523" PostTypeId="1" CreationDate="2015-12-04T21:40:10.503" Score="1" ViewCount="352" Body="&lt;p&gt;whenever we start working on Discrete Cosine Transform(DCT), &lt;a href=&quot;https://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0ahUKEwi2wuvJk8PJAhWH1I4KHfVVB88QFggcMAA&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D266596&amp;amp;usg=AFQjCNHj7qiDu3BndUcq-4cFpb88B3cVSw&amp;amp;sig2=e3elxgwU7kJbYAb7Vcn3eA&quot; rel=&quot;nofollow&quot;&gt;Loeffler algorithm&lt;/a&gt; a key role. Furthur if we approach hardware implementation of this algorithm, we find methods based on &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=954513&quot; rel=&quot;nofollow&quot;&gt;Distributed Arithmetic&lt;/a&gt; and &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4437863&quot; rel=&quot;nofollow&quot;&gt;Shift-and-Add&lt;/a&gt;. Both of these method stress on &lt;strong&gt;multiplierless&lt;/strong&gt; circuits. In both cases multiplication is either performed by shift and adding or using a ROM which stores the look-up tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point I am asking here is why everyone is neglecting multipliers replacing them by adders,shift registers in circuits. We can make a N-bit multiplier using adders and registers. Can someone highlight the negative impact of using multipliers?&lt;/p&gt;&#xA;" OwnerUserId="18567" LastActivityDate="2015-12-05T03:17:12.877" Title="Multiplier in digital signal processing?" Tags="|fourier-transform|dsp-core|transform|dct|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27525" PostTypeId="1" CreationDate="2015-12-05T02:05:29.777" Score="3" ViewCount="2144" Body="&lt;p&gt;I have a numerical solution to a problem in mechanics.  I am computing the force applied to an object as a function of its deformation and in the problem, there is an instability, due to which the force abruptly jumps from one behaviour to another as the displacement is increased (loading).  Likewise, when the displacement is decreased (unloading), the force again jumps, but due to friction, the force curve during loading is not the same as unloading.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The numerical technique I use to compute the force introduces noise into the output.  I am interested in smoothing the output so that I can have a meaningful comparison with experiment. Since I have little to no background in DSP, I am just hacking my way through this.  I found a &lt;a href=&quot;https://stackoverflow.com/questions/25191620/creating-lowpass-filter-in-scipy-understanding-methods-and-units&quot;&gt;similar question on StackOverflow&lt;/a&gt; and I used the code I found there.  Since I wanted to avoid lag in the filtered output, I used &lt;code&gt;filtfilt&lt;/code&gt; instead of &lt;code&gt;lfilter&lt;/code&gt; as used in that answer.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://drive.google.com/folderview?id=0B99pU2VARGhOcEpzS3Zmd2lYNDQ&amp;amp;usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; contains four files:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;pauchard_F_u.png&lt;/code&gt; shows an experimentally obtained force-displacement curve which shows the features I describe in the first paragraph; the solid dots in this figure correspond to increasing displacement or the loading portion, while the hollow circles correspond to the unloading portion.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0VfWn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0VfWn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;code&gt;force_displacement.rpt&lt;/code&gt; contains the raw displacement and force data as functions of time. Data is available at 1001 equally spaced time points corresponding to a total time duration of 0.1 seconds. &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;mwe_filtering.py&lt;/code&gt; contains a MWE that does the filtering and plots the raw and filtered outputs. This is also included below.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;trial_force_disp_smoothing.png&lt;/code&gt; contains the plot of the raw and smoothed data. In these plots, black represents the loading portion and blue the unloading portion; symbols represent the raw data while curves represent smoothed output.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/A2s3i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A2s3i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution looks okay, but, there are a still a couple of artifacts here   that I don't really like.  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The smoothed force dips at the end of the loading section (i.e. black curve near maximum displacement) whereas in the raw data (and the experiment), this is not so.  This second dip is not physically meaningful.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The unloading curve deviates significantly from zero at zero displacement (blue curve near zero displacement).  Again, this is not physically meaningful, at zero displacement, we should have zero force. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The first dip in force in the loading curve is indeed observed in the experiment and is captured in the smoothed data, but the filter smooths the abrupt load drop (black line compared to black symbols) a bit too much.  It would be better if we can capture the raw curve all the way up to the point at which the load drops.  The situation is not so pronounced for the unloading (blue) curve.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Question: Can someone suggest a way to that avoids these artifacts in the smoothed data and achieves a better qualitative agreement with the experimental data?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;mwe_filtering.py&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;&quot;&quot; Created: 11/6/2015&#xA;&#xA;    Butterworth filtering and filtfilt modeled after these two sources&#xA;&#xA;https://stackoverflow.com/questions/25191620/creating-lowpass-filter-in-scipy-understanding-methods-and-units&#xA;http://dsp.stackexchange.com/questions/19084/applying-filter-in-scipy-signal-use-lfilter-or-filtfilt&#xA;&#xA;Note that use of filtfilt removes the lag that lfilter introduces&#xA;&quot;&quot;&quot;&#xA;&#xA;def butter_lowpass(cutoff, fs, order=5):&#xA;  nyq = 0.5 * fs&#xA;normal_cutoff = cutoff / nyq&#xA;b, a = butter(order, normal_cutoff, btype='low', analog=False)&#xA;return b, a&#xA;&#xA;def butter_lowpass_filtfilt(data, cutoff, fs, order=5):&#xA;  b, a = butter_lowpass(cutoff, fs, order=order)&#xA;y = filtfilt(b, a, data)&#xA;return y&#xA;&#xA;if __name__ == &quot;__main__&quot;:&#xA;&#xA;  import copy&#xA;import glob&#xA;from matplotlib import pyplot as plt&#xA;import pandas&#xA;from scipy.signal import argrelmax, butter, filtfilt, freqz, lfilter&#xA;import sys&#xA;&#xA;# MAGIC NUMBERS&#xA;RADIUS = 25.0&#xA;THICKNESS = 0.790569415042095&#xA;ORDER = 6&#xA;FS = 10000&#xA;CUTOFF = 70&#xA;&#xA;radius = RADIUS&#xA;thickness = THICKNESS&#xA;thickness_normalized = np.array(thickness) / radius&#xA;legend_string =  r&quot;$t/R = &quot; + str(np.round(thickness_normalized)) + &quot;$&quot; &#xA;&#xA;# For the Butterworth filter&#xA;order = ORDER&#xA;fs = FS&#xA;cutoff = CUTOFF&#xA;b, a = butter_lowpass(cutoff, fs, order)&#xA;&#xA;rpt_file = 'force_disp.rpt'&#xA;&#xA;my_df = pandas.read_csv(rpt_file, delim_whitespace = True)&#xA;disp = my_df.iloc[:,1]&#xA;forc = my_df.iloc[:,2]&#xA;forc_filtered = butter_lowpass_filtfilt(forc, cutoff, fs, order)&#xA;&#xA;plt.figure()&#xA;plt.hold(True)&#xA;plt.plot(disp[:500:3], forc[:500:3], &#xA;         marker = &quot;o&quot;,&#xA;         ms = 5,&#xA;         ls = ':',&#xA;         color = 'black',&#xA;         label = legend_strings[count],)&#xA;plt.plot(disp[500::3], forc[500::3], &#xA;         marker = &quot;o&quot;,&#xA;         ms = 5,&#xA;         ls = ':',&#xA;         mec = &quot;blue&quot;,&#xA;         mfc = &quot;white&quot;,&#xA;         label = legend_strings[count],)&#xA;plt.plot(disp[:500:3], forc_filtered[:500:3], &#xA;         ls = '-',&#xA;         color = 'black',&#xA;         label = legend_strings[count],)&#xA;plt.plot(disp[500::3], forc_filtered[500::3], &#xA;         ls = '-',&#xA;         color = &quot;blue&quot;,&#xA;         label = legend_strings[count],)&#xA;&#xA;&#xA;#    plt.legend(loc = 2, frameon = False, fontsize = 'xx-large')&#xA;plt.xlabel(r'$u/h$', fontsize = 20)&#xA;plt.ylabel(r'$F R/ E h^3$', fontsize = 20)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="18600" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2015-12-07T18:44:06.083" Title="How do I smooth this noisy signal?" Tags="|lowpass-filter|smoothing|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27526" PostTypeId="2" ParentId="27523" CreationDate="2015-12-05T03:00:24.267" Score="2" Body="&lt;p&gt;Once upon a time, chips (processor ICs) did not have anywhere close to millions (now billions) of transistors on them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical fast multiplier, say made out of a tree of layers of carry-save-adder cells, requires a lot more logic gates (thus transistors) than a simple adder, thus also requiring a lot more power, and with less of them fitting on a particular silicon die area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Repeated conditional-add-and-shift is slower (in the same transistor technology) but requires a lot less logic gates (thus less transistors) when done sequentially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an (ancient) FPGA has tons of small memories (but no multipliers), the memories might be useful as look-up tables that are faster than the equivalent logic equations implemented in fabric connected LUT cells.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-05T03:17:12.877" LastActivityDate="2015-12-05T03:17:12.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27527" PostTypeId="1" CreationDate="2015-12-05T06:31:05.850" Score="1" ViewCount="286" Body="&lt;p&gt;As we know, if we want to get the time domain response of the channel $h[n]$, we can first get the frequency domain response of the channel $H[k]=Y[k]/X[k]$. And then we do IFFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now one OFDM symbol includes some null subcarriers. So we don't need to get the $H[K]$ on these null subcarriers. But under this circumstance, how do we get the time response of the channel $h[n]$? &lt;/p&gt;&#xA;" OwnerUserId="18601" LastEditorUserId="13320" LastEditDate="2016-11-21T12:35:05.490" LastActivityDate="2016-11-21T12:35:05.490" Title="OFDM channel estimation" Tags="|signal-analysis|digital-communications|ofdm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27528" PostTypeId="2" ParentId="27520" CreationDate="2015-12-05T09:38:55.053" Score="0" Body="&lt;p&gt;If you are trying to convert the sweep response to an impulse response, you can do this directly by dividing the discrete Fourier transform (DFT) of the sweep response by the DFT of the sweep, and by taking the inverse DFT of the result. The division automatically compensates for the &quot;pink&quot; spectrum of the exponential sweep. Avoid division by zero and near-zero values at the very lowest and at the very highest frequencies; ramp the ends of the DFT of the sweep to magnitude of 1.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-05T09:38:55.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27529" PostTypeId="2" ParentId="13864" CreationDate="2015-12-05T09:48:02.527" Score="1" Body="&lt;p&gt;A Matlab code and illustration is given below, with the  discrete cosine transform (DCT):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nSample = 512;&#xA;pDataThreshold = 90/100 ; % percentage, as a float in [0 1]&#xA;&#xA;time = linspace(0,1,nSample)';&#xA;data = sin(2*pi*4*sqrt(time));&#xA;dataTrans = dct(data);&#xA;dataThreshold = quantile(abs(dataTrans),pDataThreshold);&#xA;dataTransThreshold = dataTrans;&#xA;dataTransThreshold(abs(dataTrans) &amp;lt; dataThreshold) = 0;&#xA;dataCompact = idct(dataTransThreshold);&#xA;&#xA;plot(time,[data,dataCompact]);&#xA;xlabel('Time')&#xA;ylabel('Amplitude')&#xA;legend('Data',['DataCompact (',num2str(100*pDataThreshold),'%)'])&#xA;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5HSpl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5HSpl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-12-05T16:23:17.713" LastActivityDate="2015-12-05T16:23:17.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27530" PostTypeId="2" ParentId="27527" CreationDate="2015-12-05T11:39:04.697" Score="1" Body="&lt;p&gt;If some values in $X[k]$ are zero, you cannot determine the impulse response of the complete channel bandwidth ($-f_\mathrm s / 2 \ldots f_\mathrm s / 2$, with sampling frequency $f_\mathrm s$). The IFFT of the estimated $\hat H[k]$ is rather a low pass filtered version of the channel. This might or might not be what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reality, you can never measure the complete bandwidth of a channel, as it is virtually infinitely large. For a communication system it is usually sufficient to know the channel transfer function of the band in which you intend to transmit a signal. If you transmit only on a fraction of subcarriers of an OFDM system you're effectively narrowing the transmission band and you might be satisfied with knowing the impulse response of this narrower band.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-12-05T11:39:04.697" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27532" PostTypeId="2" ParentId="27525" CreationDate="2015-12-05T12:11:07.780" Score="2" Body="&lt;p&gt;I think that a non-linear filter will give you a result that comes closer to what you expect. One of the simplest non-linear filters is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;median filter&lt;/a&gt;, which can remove noise while preserving jumps. The figure below shows your data and the outputs of a median filter with a window length of $20$ samples. The window length can be increased to get more smoothing, and of course you can use different window lengths for both curves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PEQtG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PEQtG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-05T18:58:58.643" LastActivityDate="2015-12-05T18:58:58.643" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27533" PostTypeId="2" ParentId="27499" CreationDate="2015-12-05T12:19:03.337" Score="2" Body="&lt;p&gt;[EDIT: a related discussion on (power) spectrum centroids can be found in &lt;a href=&quot;https://dsp.stackexchange.com/questions/38643/how-to-calculate-the-mean-center-frequency-of-the-spectrum&quot;&gt;How to calculate the mean/center frequency of the spectrum?]&#xA;&lt;/a&gt;&#xA;Let us assume you have a relatively concentrated peak, with noise. I assume your maximum frequency is ok. If too high, you can trim the spectrum to lower frequency, which could help. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below gives a simple model, estimates a peak location, and a gross measure of dispersion (or uncertainty). It is based on a weighted average or center of mass. If the peak is narrow, the center of mass (and the median) will be drifted away toward the center of the frequency axis ($f_i$'s). Because even if low, the noise spreads. This is an illustration of &lt;a href=&quot;https://www.math.nyu.edu/~crorres/Archimedes/Lever/LeverIntro.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Archimedes' lever principle&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Give me a place to stand on, and I can move the earth.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sZIe6.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sZIe6.gif&quot; alt=&quot;Archimedes&amp;#39; lever principle&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To achieve your goal, you can give more weight to your spectrum of amplitude $a_i$, and compute an estimated peak location $\bar{f}$:&#xA;$$\bar{f} = \frac{\sum_i w_i f_i}{\sum_i w_i}\,. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you choose $w_i = a_i$, you get the standard average. This is not enough. You can increase the peak weight with a power: $w_i = a_i^p$. This is the aim of &lt;code&gt;weightPower = 4&lt;/code&gt; in the code. The location is given by the red &lt;code&gt;o&lt;/code&gt;, and the &lt;code&gt;x&lt;/code&gt; are the left and right bounds derived from a weighted standard deviation. The higher the $p$, the sharper the estimation, with a risk of major errors if the data differs from the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please report your tests, to adjust the answer. And the result follows. With $p=1$, you get $360$, with $p=2$, you get $243$, with  $p=4$, $\bar{f}=201$, quite close to $200$ in my model. If you need much higher robustness, you can go for weighed medians instead of weighed means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Tm08Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tm08Y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqAxis = linspace(0,1000,1000)';&#xA;freqPeak = 200;&#xA;freqPeakAmplitude = 1;&#xA;freqGGDExponent = 2;&#xA;freqGGDWidth = 50;&#xA;freqNoise = 0.2;&#xA;&#xA;dataSpectrum = exp(-((freqAxis-freqPeak)/freqGGDWidth).^freqGGDExponent)+freqNoise*rand(size(freqAxis));&#xA;&#xA;weightPower = 4; &#xA;freqEstLocation = sum((dataSpectrum.^weightPower).*freqAxis)/sum(dataSpectrum.^weightPower);&#xA;freqEstDispersion = sqrt(sum((dataSpectrum.^weightPower).*(freqAxis-freqEstLocation).^2)/sum(dataSpectrum.^weightPower));&#xA;&#xA;freqEstAmplitude = interp1(freqAxis,dataSpectrum,freqEstLocation);&#xA;clf;hold on&#xA;plot(freqAxis,dataSpectrum);&#xA;plot(freqEstLocation,freqEstAmplitude,'or');&#xA;plot([freqEstLocation-freqEstDispersion freqEstLocation+freqEstDispersion],freqEstAmplitude,'xr');&#xA;axis tight;grid on&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2017-03-29T14:10:09.303" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27537" PostTypeId="1" CreationDate="2015-12-05T16:45:18.070" Score="1" ViewCount="77" Body="&lt;p&gt;I'm pretty new to digital signal processing, my degree touched on it briefly, but it's interested me since.&#xA;I am trying to determine the fundamental frequency of a guitar note played into a mbed LPC1768.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently reading the analog signal in and storing it as an array of floats, the data is currently sampled at 1000Hz for 1 second. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By plotting the values against 1-1000 (milliseconds) I can create this graph. This is a ~1 second snippet of an E String being played.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0taEX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0taEX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping someone could give me a few pointers on the best library to use to convert my 1D array into a form which would give me the frequencies involved in this converting this data from time-domain to frequency-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen some libraries but I can't figure out how to actually implement them due to a lack of examples.&lt;/p&gt;&#xA;" OwnerUserId="18605" LastEditorUserId="3453" LastEditDate="2015-12-05T20:39:40.337" LastActivityDate="2015-12-05T20:39:40.337" Title="Using FFT to determine frequency" Tags="|fft|fundamental-frequency|" AnswerCount="0" CommentCount="3" ClosedDate="2015-12-05T20:57:25.457" ContentLicense="CC BY-SA 3.0" />
  <row Id="27538" PostTypeId="2" ParentId="15101" CreationDate="2015-12-05T19:14:44.723" Score="0" Body="&lt;p&gt;Simple neural networks do not have input lenght invariance and do not allow to analyze time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For classification of time series like a series of MFCC frames you can use a classifier with time invariance. For example you can use neural networks combined with hidden Markov models (ANN-HMM), gaussian mixture model with hidden markov models (GMM-HMM) or recurrent neural networks (RNN). Matlab implementation for RNN is &lt;a href=&quot;http://de.mathworks.com/help/nnet/ref/layrecnet.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Theano implementation is also &lt;a href=&quot;https://github.com/gwtaylor/theano-rnn&quot; rel=&quot;nofollow&quot;&gt;available&lt;/a&gt;. You can find a detailed description of those structures in Google.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speech recognition is not a simple thing to implement, it is better to use existing software like &lt;a href=&quot;http://cmusphinx.sourceforge.net&quot; rel=&quot;nofollow&quot;&gt;CMUSphinx&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2015-12-05T19:14:44.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27539" PostTypeId="1" AcceptedAnswerId="27545" CreationDate="2015-12-05T21:11:10.357" Score="0" ViewCount="196" Body="&lt;p&gt;Assume that I have two signals with finite energy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first, $x_s$&#xA;\begin{equation}&#xA;E_s = \sum_{i=0}^{N} |x_s(i)|^2&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the second, $w$&#xA;\begin{equation}&#xA;E_w = \sum_{i=0}^{N} |w(i)|^2.&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, which is the enrgy of the follwoing signal that combine the two ones as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;E_s'=\sum_{i=0}^N |x_s(i) \cdot (1+K w(i))|^2&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular assuming $x_s$ and $w$ uncorrelated, is there a way to express $E_s'$ as fucntion of $E_s$ and $E_w$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in adavance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I have already posted a smiliar question here&#xA;&lt;a href=&quot;https://math.stackexchange.com/questions/1560821/which-is-the-total-energy-of-the-product-of-two-discrete-energy-signals&quot;&gt;https://math.stackexchange.com/questions/1560821/which-is-the-total-energy-of-the-product-of-two-discrete-energy-signals&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18610" LastActivityDate="2016-05-04T14:19:08.857" Title="Which is the total energy of the product of two discrete energy signals" Tags="|discrete-signals|signal-analysis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27540" PostTypeId="1" AcceptedAnswerId="27553" CreationDate="2015-12-05T21:12:50.697" Score="5" ViewCount="862" Body="&lt;p&gt;I'm trying to follow the steps from Oppenheim for the derivation of the frequency representation of a signal which is to be down sampled by a factor of M. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It makes sense to me that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pVb6k.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pVb6k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then the book says to make a change of variables from $r$ to $i$ and $k$ where $i$ = $0, 1, ... M-1$, and $k$ = (-$\infty,\infty$). However, I don't really understand how this change of variables comes logically. After making this change of variables it is then easy to see how the downsampled frequency representation is just a sum of scaled and shifted representations of the original sampled sequence. But I would like to be able to make the bridge better between steps and how such a change of variable was concluded. &lt;/p&gt;&#xA;" OwnerUserId="18609" LastEditorUserId="13320" LastEditDate="2016-11-13T13:25:43.223" LastActivityDate="2016-11-13T13:25:43.223" Title="Frequency Representation of Downsampled Signal" Tags="|downsampling|resampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27541" PostTypeId="2" ParentId="27489" CreationDate="2015-12-05T21:21:16.703" Score="2" Body="&lt;p&gt;Well, what I get from your question is that what you want to do is segmentation. First you need to consider how many bumps you want to detect, because in every pixel exist a set of probabilities for every bump. I am going to try to explain it in an exaple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine that you are working with a MRI image like this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VYwz5.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VYwz5.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you want to classify the different tissues that appear in it, due to the tissues in MRI look to have a gray tone deppending on what kind of tissue are (gray matter, white matter, skull, skin, not-a-tissue, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going to work with assuming that in the image exists 6 types of tissues (including the not-a-tissue region or black zone). [In terms of apples I am going to have a combination of apples in each pixel of 6 different colors and I am goig to find what color is predominant in each pixel]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To classify and labeling each tissue I am going to resort to GMMF ( Gaussian Marcov Fields). And this will be my results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nr8Yw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nr8Yw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the set of binarized imges, each pixel shows the principal bump in it. But in the upper set, the probability of each bump in the pixel is shown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally this is the algorithm to perform the GMMF:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% A Gaussian Kernel that will be needed&#xA;%Kernel Gaussiano&#xA;kmu=   [0 0]'&#xA;ko=    [2 2]'&#xA;kSize= 15&#xA;vi= [1/ko(1) 0; 0 1/ko(2)].^2&#xA;kS=floor(kSize/2);&#xA;for i=-kS:1:kS&#xA;    for j=-kS:1:kS&#xA;       d=[i,j]'-kmu;&#xA;       g(1+i+kS,1+j+kS)=(1/((sqrt(2*pi))*(sqrt(det(vi)))))*exp(-0.5*d'*vi*d)&#xA;    end&#xA;end&#xA;&#xA;% 1: Assum some initial conditions (umbrals, means, variances)&#xA;&#xA;mu=[10 50 90 130 170 210] //My initial hypotesis of which color is each&#xA;                          //tissue&#xA;o= [ 5  5  5   5   5   5] //My initial hypotesis of how much varies each &#xA;                          //tissue&#xA;E=[mu o] // My vector of results to stablish a stop criterion for the &#xA;         // algorithm&#xA;e=sqrt(E*E') // My tolerance criterion (The squared root of the sum of each    &#xA;             //squared element of the vector sqrt(E1^2 + E2^2 + ... + En^2)&#xA;&#xA;while e&amp;gt;0.5 % e&amp;lt;3&#xA;    Ei=E //To compare how much imporve my results&#xA;&#xA;    t=0:255  // A vector for the possible gray tones in the image&#xA;    T=zeros(1,256) // A vector of zeros&#xA;&#xA;    for h=1:length(mu) //length(mu) =6 in this case&#xA;        T=(1/(sqrt(2*pi)*o(h)))*exp(-(0.5*(t-mu(h)).^2)/(o(h)*o(h)))&#xA;    end&#xA;&#xA;% 2: Computing some likely hoods&#xA;    for h=1:length(mu)&#xA;        l(:,:,h)=(1/(sqrt(2*pi)*o(h)))*exp(-(0.5*(I-mu(h)).^2)/(o(h)*o(h)))&#xA;    end&#xA;&#xA;% 3: Normalizing&#xA;    L=zeros(size(I))&#xA;    for h=1:length(mu)&#xA;        L=L+l(:,:,h)&#xA;    end&#xA;    for h=1:length(mu)&#xA;        p(:,:,h)=l(:,:,h)./L&#xA;    end&#xA;&#xA;% 4: Smoothing ussing gaussian kerbell&#xA;&#xA;    for h=1:length(mu)&#xA;       ps(:,:,h)=conv2(p(:,:,h),g,'same')&#xA;    end&#xA;&#xA;&#xA;    B=max(ps,[],3)&#xA;    for h=1:length(mu)&#xA;        b(:,:,h)=ps(:,:,h)==B&#xA;    end&#xA;&#xA;% 5: Expectations&#xA;&#xA;    for h=1:length(mu)&#xA;        aP(h)= 1/sum(sum(b(:,:,h)))&#xA;        mu(h)=aP(h)*sum(sum(I.*b(:,:,h)))&#xA;        o(h)=sqrt(aP(h)*sum(sum(((I-mu(h)).^2).*b(:,:,h))))&#xA;    end&#xA;    E=[mu o]&#xA;    e=sqrt((E-Ei)*(E-Ei)')&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The algorithm is written in matlab type, I add some comentaries in c style, I hope you can run it. I would like to explain it better, good luck.&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-12-05T21:21:16.703" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="27542" PostTypeId="1" CreationDate="2015-12-05T21:33:05.627" Score="0" ViewCount="196" Body="&lt;p&gt;I've been working on 3-axis accelerometer data to predict the gesture of an user. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lot of literature pointed me to consider Frequency domain features for my problem and i'm using &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Mean of the signal on each axis  first &lt;/li&gt;&#xA;&lt;li&gt;'k' coefficients of DFT of the signal. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Since &lt;strong&gt;X(0)&lt;/strong&gt; is essentially the &lt;strong&gt;DC component&lt;/strong&gt; of the signal, &lt;strong&gt;&lt;em&gt;i tried checking the DC component with the Mean of the signal&lt;/em&gt;&lt;/strong&gt; and observed they differ in sign because of the &lt;code&gt;sqrt(X(0)*conj(X(0)))/N&lt;/code&gt; gives only positive value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Will it affect my problem in any means?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="18611" LastActivityDate="2015-12-05T21:33:05.627" Title="Sign of DC Component obtained from FFT differs with the sign of Mean of the signal, Does the sign really matter?" Tags="|fft|dft|power-spectral-density|machine-learning|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27543" PostTypeId="2" ParentId="27385" CreationDate="2015-12-05T21:34:05.873" Score="1" Body="&lt;p&gt;I think it is common (in signal processing books) to write the z transform in polar form, to make clear its relationship with the fourier transform, that is&#xA;z-transform equal to fourier transform on the unit circle, that is when r=1,   then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ztransf-&gt; $z=r*e^{jw}=e^{jw}$&amp;lt;- fourier transform or just&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z=e^{jw}$&lt;/p&gt;&#xA;" OwnerUserId="18612" LastActivityDate="2015-12-05T21:34:05.873" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27544" PostTypeId="2" ParentId="27525" CreationDate="2015-12-05T21:47:22.493" Score="1" Body="&lt;p&gt;The problem with filtfilt is that this process is assuming potentially very incorrect data (zeros?) past the two ends of your actual data.  You can deal with this problem a number of different ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use a different filter at the ends than in the middle of your data vector (perhaps median?), then cross-fade the results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, if you like your current filter, you can make up &quot;perhaps less incorrect&quot; data past each end for the linear phase filter process to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mirror the data at each end (for at least the length of the transient response of your linear phase filter), and then cut off those added ends after filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or use over-determined polynomial regression to fit a curve (say use 8 or so points to fit a cubic) at each end.  Then make up points by extrapolating using that fitted curve past the ends (by the length of the filter).  Then filter including the added ends and afterwards throw away these ends.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-07T18:44:06.083" LastActivityDate="2015-12-07T18:44:06.083" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27545" PostTypeId="2" ParentId="27539" CreationDate="2015-12-05T22:16:03.523" Score="1" Body="&lt;p&gt;You don't give enough information for an expression of the combined energy in your expression.&#xA;$$\begin{eqnarray}&#xA;&amp;amp; &amp;amp;\sum_{i=0}^N \left| x_s(i)\cdot\left( 1+K\,w(i) \right) \right|^2 \\&#xA;&amp;amp;=&amp;amp;\sum_{i=0}^N \left( x_s(i)\cdot\left( 1+K\,w(i) \right) \right)^\star \times\left( x_s(i) \cdot\left( 1+K\,w(i) \right) \right)\\&#xA;&amp;amp;=&amp;amp;\sum_{i=0}^N \left( x_s(i)^\star\,x_s(i) + x_s(i)^\star\,K^\star\,w(i)^\star x_s(i)\,K\,w(i) + x_s(i)^\star x_s(i)\,K\,w(i)+x_s(i)\,x_s(i)^\star\,K^\star w(i)^\star\right)\\&#xA;&amp;amp;=&amp;amp;\sum_{i=0}^N \left( |x_s(i)|^2 \times \left(1+2\,\Re(K\,w(i))+|K|^2\,|w(i)|^2 \right) \right)\\&#xA;&amp;amp;=&amp;amp;E_s+\sum_{i=0}^N|x_s(i)|^2\left(2\,\Re(K\,w(i))+|K|^2\,|w(i)|^2 \right)&#xA;\end{eqnarray}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means you need to know the correlation of the square magnitude of $x_s$ with the real part of $w$ and the square magnitude of $w$. The correlation of just $x_s$ and $w$ does not play any role.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2015-12-06T09:42:13.633" LastActivityDate="2015-12-06T09:42:13.633" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27546" PostTypeId="2" ParentId="27494" CreationDate="2015-12-06T00:28:53.417" Score="6" Body="&lt;p&gt;Before I go into the specific issues, I'd like to note that there is a minor confusion with respect to &lt;code&gt;M&lt;/code&gt; not representing the AR process order. More specifically an AR process of order &lt;code&gt;M=4&lt;/code&gt; would use the &lt;code&gt;M&lt;/code&gt; previous values of &lt;code&gt;y1&lt;/code&gt; rather than &lt;code&gt;M+1&lt;/code&gt; values (in the loop with index &lt;code&gt;j&lt;/code&gt;). So, with &lt;code&gt;M=4&lt;/code&gt; your implementation is really that of an AR process of order $p = 5$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Coefficients and stability&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The problem is that I need to multiply the previous output &lt;code&gt;y1&lt;/code&gt; and current input &lt;code&gt;x&lt;/code&gt; with a=0.1, otherwise it gives an unstable filter which leads to infinity. Please clarify which mistake I'm making while filtering &lt;code&gt;x&lt;/code&gt; using AR filter or I'm doing it the wrong way?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The stability of the AR process can be determined from the location of the poles of the transfer function. To find those poles, we start off with the recurrence equation of the AR(p) process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  y[n] = a x[n] + a \sum_{j=1}^{p} y[n-j]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From which the transfer function in the $z$-plane is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;  H(z) &amp;amp;= \frac{a}{1-a\sum_{j=1}^{p} z^{-j}} \\&#xA;       &amp;amp;= \frac{az^{p}}{z^{p}-a\sum_{j=0}^{p-1} z^j}&#xA;\end{align}&#xA;$$&#xA;Hence the poles are given as the roots of the $z^{p}-a\sum_{j=0}^{p-1} z^j$ polynomial. In your specific case of $p = 5$, the pole location are given by the following plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2hkzk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2hkzk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you may notice, there is a pole near $z=2$ (more precisely at approximately 1.96595) when $a=1$ which indicates that the system is not stable. On the other hand, when $a=0.1$, all the poles are located inside the unit circle and the system is stable. Beware that even with $a=0.1$, starting with $p=11$, the system also has a pole outside the unit-circle and starts to be unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, there are no specific mistaking in your filtering code (ie. it correctly implements an unstable filter when &lt;code&gt;a=1&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Yule-Walker equation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But its not giving correct coefficients (or filter taps). Please somebody help me if there's something I'm missing in understanding the question fully or making some mistake somewhere in the code?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are indeed a few issues with that part of the code. Perhaps the most significant issue is that the solution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;    \vec{a} &amp;amp;= \mathbf R^{-1} \vec r \\&#xA;      &amp;amp;= \begin{bmatrix}&#xA;           r_0 &amp;amp; r_1 &amp;amp;\cdots &amp;amp; r_{p-1} \\&#xA;           r_1 &amp;amp; r_0 &amp;amp;\cdots &amp;amp; r_{p-2} \\&#xA;           \vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \vdots \\&#xA;           r_{p-1} &amp;amp; r_{p-2} &amp;amp;\cdots &amp;amp; r_0 \\&#xA;         \end{bmatrix}^{-1}&#xA;         \begin{bmatrix}&#xA;           r_1 \\&#xA;           r_2 \\&#xA;           \vdots \\&#xA;           r_p&#xA;         \end{bmatrix} \tag{1}&#xA;\end{align}&#xA;$$&#xA;where&#xA;$$&#xA;\begin{align}&#xA;  r_j &amp;amp;= \frac{c_j}{c_0} \\&#xA;      &amp;amp;= \frac{E\left\{y_n y_{n-j}\right\}}{E\left\{y^2_n\right\}}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;applies to an AR process of the form&#xA;$$&#xA;  y[n] = x[n] + \sum_{j=1}^p a_j y[n-j]&#xA;$$&#xA;where $x[n]$ is a &lt;strong&gt;zero-mean&lt;/strong&gt; random variable. Unfortunately, the line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1,1000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Generates a uniformly distributed random variable in the range &lt;code&gt;[0,1]&lt;/code&gt; with a mean of $\frac{1}{2}$. An example of random variable with zero-mean could be a uniformly distributed random variable in the range &lt;code&gt;[-1,1]&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = 2*rand(1,1000)-1;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For an input which does not have a mean of zero, or equivalently for an AR process of the form:&#xA;$$&#xA;  y[n] = K + x'[n] + \sum_{j=1}^p a_j y[n-j]&#xA;$$&#xA;where $x'[n] = x[n] - K$ is zero-mean, the equations can be updated to:&#xA;$$&#xA;\begin{align}&#xA;  \begin{bmatrix}&#xA;\mu \\&#xA;c_1 \\&#xA;c_2 \\&#xA;\vdots \\&#xA;c_p&#xA;  \end{bmatrix} &amp;amp;=&#xA;\begin{bmatrix}&#xA;  1   &amp;amp; \mu &amp;amp; \mu &amp;amp;\cdots &amp;amp; \mu \\&#xA;  \mu &amp;amp; c_0 &amp;amp; c_1 &amp;amp;\cdots &amp;amp; c_{p-1} \\&#xA;  \mu &amp;amp; c_1 &amp;amp; c_0 &amp;amp;\cdots &amp;amp; c_{p-2} \\&#xA;  \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \vdots \\&#xA;  \mu &amp;amp; c_{p-1} &amp;amp; c_{p-2} &amp;amp;\cdots &amp;amp; c_0 \\&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;  K \\&#xA;  a_1 \\&#xA;  a_2 \\&#xA;  \vdots \\&#xA;  a_p&#xA;\end{bmatrix} \tag{2}&#xA;\end{align}&#xA;$$&#xA;where $\mu = E\left\{y_n\right\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Implementation for zero-mean AR process&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally there are a few small issues in the implementation of the equation. For one thing, the vector returned by &lt;code&gt;autocorr(y2,p)&lt;/code&gt; contains &lt;code&gt;p+1&lt;/code&gt; values: from 0 to &lt;code&gt;p&lt;/code&gt; lags. You need the first &lt;code&gt;p&lt;/code&gt; values for the $\mathbf R$ matrix (leaving out lag &lt;code&gt;p&lt;/code&gt;), and the last &lt;code&gt;p&lt;/code&gt; values for the $\vec r$ vector (leaving out the zero lag value since $\vec r$ starts at $r_1$, not $r_0$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can construct the Yule Walker equation with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;R = toeplitz(r(1:end-1)); % r(0), ..., r(p-1)&#xA;w = inv(R)*r(2:end);      % as Yule Walker eq: w=R^-1*r&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So putting it all together, you should get something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = 2*rand(1,1000)-1; % uniformly distributed over [-1,1]&#xA;a=0.1&#xA;p=5;&#xA;M=p-1; &#xA;for i = 1:length(x)&#xA;  sum=0;&#xA;  y1(i)=0;&#xA;  for j = 1:M+1&#xA;    if (i-j&amp;gt;0)&#xA;      sum = sum + a*y1(i-j);&#xA;    end&#xA;  end&#xA;  y1(i)=sum +a*x(i);&#xA;end&#xA;&#xA;y2 = awgn(y1,25);&#xA;&#xA;r = autocorr(y2,p)';&#xA;% Or if you don't have autocorr, replace with the following 2 lines:&#xA;% r = xcorr(y2,p)';&#xA;% r = r(p+1:end);           % keep only non-negative lags&#xA;&#xA;R = toeplitz(r(1:end-1)); % r(0), ..., r(p-1)&#xA;&#xA;w = inv(R)*r(2:end);      % as Yule Walker eq: w=R^-1*r&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Implementation for non-zero-mean AR process&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution of equation (2) can be constructed in a similar fashion as for equation (1). The main thing to note is that in this case the $\mathbf R$ matrix elements $c_0, \dots, c_{p-1}$ are not normalized by $c_0$ (which would have yielded $r_0, \dots, r_{p-1}$). In this case you may replace &lt;code&gt;autocorr&lt;/code&gt; with &lt;code&gt;xcorr&lt;/code&gt;, which returns a sum of product without normalization (you would then need some adjustment since is &lt;code&gt;xcorr&lt;/code&gt; is double sided, meaning it contains &lt;code&gt;2*p-1&lt;/code&gt; values, including the values for positive, zero and negative lags). This would give you the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = rand(1,1000);&#xA;...&#xA;&#xA;mu = mean(y2);&#xA;r = xcorr(y2,p)';&#xA;r = r(p+1:end);           % keep only non-negative lags&#xA;R = toeplitz(r(1:end-1)); % r(0), ..., r(p-1)&#xA;&#xA;A  = [1 mu*ones(1,p);mu*ones(p,1) R];&#xA;b  = [mu;r(2:end)];&#xA;w  = inv(A)*b;&#xA;&#xA;% separate the bias term K from the AR process weights:&#xA;K  = w(1);&#xA;w  = w(2:end);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="8952" LastEditDate="2016-01-10T17:23:17.257" LastActivityDate="2016-01-10T17:23:17.257" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27547" PostTypeId="1" CreationDate="2015-12-06T00:38:10.640" Score="0" ViewCount="2152" Body="&lt;p&gt;Is real-time resampling pitch-shifting impossible (without corrective time-stretching, such as WSOLA)? I've been told that it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Real-time resampling pitch-shifting would mean applying resampling in real-time, but it's claimed that it's impossible to overlap differently resampled segments in real-time (since the total length of the &quot;window&quot; varies in every window and in connection to every frequency of resampling).&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-12-06T03:05:12.593" LastActivityDate="2015-12-06T03:43:45.843" Title="Real-time resampling pitch-shifting (without corrective time-stretching)?" Tags="|audio|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27548" PostTypeId="2" ParentId="27547" CreationDate="2015-12-06T03:43:45.843" Score="2" Body="&lt;p&gt;okay, the answer to the question is &quot;no&quot;, from my understanding of what &lt;a href=&quot;https://en.wikipedia.org/wiki/Real-time_computing#Real-time_in_digital_signal_processing&quot; rel=&quot;nofollow&quot;&gt;&quot;real-time&quot; in DSP&lt;/a&gt; means.  a real-time DSP process is one that can run forever without either starvation of input samples or overflow of input samples.  for every second of sound input, there is a second of sound output.  just speeding up the sound or slowing it down, to change the pitch, is an operation you can do on a segment of sound or a sound file.  but it is not a continuous operation that runs real time.  this is not because the CPU or DSP cannot handle the number of operations, it's because, either the input or the output will have no time when the other still has time remaining.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, there are DAW functions that play back sound files faster or slower that recorded without changing pitch.  what they are really doing is playing back the sound file faster or slower (with an increased or decreased number of input samples) and the DSP algorithm is doing real-time and complementary resampling and time-scaling to get to the output.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-12-06T03:43:45.843" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27549" PostTypeId="1" CreationDate="2015-12-06T05:15:56.403" Score="3" ViewCount="4326" Body="&lt;p&gt;I was truing to solve an example of DTFT which is following multiplication property. The problem is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ a^n \sin(\omega_0 n) u[n]$$&lt;/span&gt; we know that the definition of DTFT is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ X(j \omega) = \sum _ {n=-\infty} ^ {{+\infty}} x[n]e^{-j \omega n}$$&lt;/span&gt;&#xA;Multiplication in Time domain will be convolution in DTFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take the DTFT of &lt;span class=&quot;math-container&quot;&gt;$a^n u[n]$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$$\frac {1}{1-ae^{-j \omega}}$$&lt;/span&gt; and DTFT of &lt;span class=&quot;math-container&quot;&gt;$\sin(\omega_0 n)\,u[n]$&lt;/span&gt; will be  &lt;span class=&quot;math-container&quot;&gt;$$\frac{\pi}{j}\sum _ {l=-\infty} ^ {{+\infty}}  \delta(\omega + \omega_0 - 2\pi l) - \delta(\omega - \omega_0 - 2\pi l)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have confusion how can I write it in the form of multiplication property.&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="47251" LastEditDate="2020-02-10T18:55:07.910" LastActivityDate="2020-02-10T18:55:07.910" Title="Multiplication property DTFT" Tags="|fourier-transform|transform|dtft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27551" PostTypeId="1" AcceptedAnswerId="27552" CreationDate="2015-12-06T08:44:53.090" Score="6" ViewCount="5043" Body="&lt;p&gt;In standard JPEG format of an image, Discrete Cosine transform is used. But instead of applying the transform on whole image, we first divide the image in &lt;span class=&quot;math-container&quot;&gt;$8 \times 8$&lt;/span&gt; block and apply transform on each of them. Thus during quantization we remove small coefficients in higher frequency. These steps are explained in details &lt;a href=&quot;https://en.wikipedia.org/wiki/JPEG&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But as we know that in &lt;span class=&quot;math-container&quot;&gt;$N-samples$&lt;/span&gt; DCT we can have only N frequency coefficients. If we apply the DCT on the whole image we will be able to get much higher frequency coefficients.&lt;/p&gt;&#xA;&lt;p&gt;Can someone highlight any disadvantage of applying DCT over the whole image at a time?&lt;/p&gt;&#xA;" OwnerUserId="18567" LastEditorUserId="7092" LastEditDate="2021-11-26T15:10:22.500" LastActivityDate="2021-11-26T15:10:51.243" Title="$8 \times 8$ block matrix in JPEG image compression?" Tags="|image-processing|compression|image-compression|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27552" PostTypeId="2" ParentId="27551" CreationDate="2015-12-06T10:26:11.350" Score="14" Body="&lt;p&gt;The lossy JPEG compression does not merely remove small coefficients in higher frequencies. It encodes them with a precision relative to a (relatively crude) visual perception model; most notably, horizontal and vertical frequencies are not quantized with the same precision. And as in many compression formats, it essentially assumes that the data is locally stationary.&lt;/p&gt;&#xA;&lt;p&gt;If you apply the DCT over the whole image, and you quantify DCT coefficients, this quantization will affect the whole image. Imagine an image with a background checkerboard pattern, and a small zebra in foreground. With a whole-DCT compression, the zebra is likely to lose its stripes, because their energy is negligible with respect to that of the checkerboard. Even more, as JPEG applies DCT on chrominances as well, with down-sampling, color coefficient quantization is likely to produce false colors at places where they do not belong. With   block size larger than about &lt;span class=&quot;math-container&quot;&gt;$8 \times 8$&lt;/span&gt;, several meaningful image gradients (parts of object edges) are more likely to happen simultaneously in the same patch.&lt;/p&gt;&#xA;&lt;p&gt;Meanwhile, one can get slightly better results with &lt;span class=&quot;math-container&quot;&gt;$16\times 16$&lt;/span&gt; blocks. That is for the perceptual part.&lt;/p&gt;&#xA;&lt;p&gt;There is a computational part too. Small non overlapping blocks are easier to process, and require less memory, a still expensive part of electronic devices. Early JPEG 2000, applying wavelets on the whole image, have failed adoption despite better results, partly because of their memory footprint.&#xA;Now, with the advent of GPUs, processing blocks is becoming quite attractive. Last, a power of two (&lt;span class=&quot;math-container&quot;&gt;$8=2^3$&lt;/span&gt;) and clever tricks make the block DCT very efficient. In modern coders, standard often use different &lt;span class=&quot;math-container&quot;&gt;$2\times 4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt;... block sizes.&lt;/p&gt;&#xA;&lt;p&gt;Last, but not least, it is not modular, as you need DCT implementations for each image size. Although it is possible with software, chip makers are unlikely to like the hardware part.&lt;/p&gt;&#xA;&lt;p&gt;So, applying DCT over the whole image:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is detrimental to non-stationary images, and waste some local orientation,&lt;/li&gt;&#xA;&lt;li&gt;Can be costly in terms of memory, and hardware,&lt;/li&gt;&#xA;&lt;li&gt;Is not quite modular nor computationally efficient.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Thus being said, very stationary images would be better compressed with whole-size DCT.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="7092" LastEditDate="2021-11-26T15:10:51.243" LastActivityDate="2021-11-26T15:10:51.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27553" PostTypeId="2" ParentId="27540" CreationDate="2015-12-06T11:54:07.647" Score="5" Body="&lt;p&gt;In the final result, you want to express the spectrum $X_d(e^{j\omega})$ in terms of $X(e^{j\omega})$, the spectrum of $x[n]=x_c(nT)$. Since $X(e^{j\omega})$ is already periodic, it must be possible to represent $X_d(e^{j\omega})$ as a sum of a &lt;em&gt;finite&lt;/em&gt; number ($M$) of shifted versions of $X(e^{j\omega})$. This is why the original infinite sum is split up into a finite sum of infinite sums, the latter being shifted versions of $X(e^{j\omega})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you shouldn't worry if you think you wouldn't have come up with that change of variables yourself. What is important is that you understand what's going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, I think it's instructive to understand the derivation of the expression for $X_d(e^{j\omega})$ &lt;em&gt;without&lt;/em&gt; introducing an auxiliary continuous-time signal $x_c(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X_d(e^{j\omega})&amp;amp;=\sum_{n=-\infty}^{\infty}x[Mn]e^{-jn\omega}\\&amp;amp;=\sum_{n=kM}x[n]e^{-jn\omega /M}\end{align}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where in the second sum we only sum over indices $n$ that are integer multiples of $M$. If we introduce a sequence $d[n]$ which equals $1$ for $n=kM$ ($k\in\mathbb{Z}$), and zero otherwise, we can rewrite $(1)$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_d(e^{j\omega})=\sum_{n=-\infty}^{\infty}x[n]d[n]e^{-jn\omega /M}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An expression for the sequence $d[n]$ satisfying our requirements is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d[n]=\frac{1}{M}\sum_{l=0}^{M-1}e^{j2\pi ln/M}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inserting $(3)$ into $(2)$ gives the final result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X_d(e^{j\omega})&amp;amp;=\frac{1}{M}\sum_{n=-\infty}^{\infty}x[n]\sum_{l=0}^{M-1}e^{j2\pi ln/M}e^{-jn\omega /M}\\&#xA;&amp;amp;=\frac{1}{M}\sum_{l=0}^{M-1}\sum_{n=-\infty}^{\infty}x[n]e^{-jn(\omega-2\pi l)/M}\\&#xA;&amp;amp;=\frac{1}{M}\sum_{l=0}^{M-1}X\left(e^{j(\omega-2\pi l)/M}\right)\tag{4}\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-06T13:50:51.133" LastActivityDate="2015-12-06T13:50:51.133" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27554" PostTypeId="2" ParentId="27549" CreationDate="2015-12-06T14:05:28.713" Score="0" Body="&lt;p&gt;Yes, I have tried to convolve and i am getting this. &#xA;Please let me know if there is any mistake&#xA;Lets suppose &#xA;$$ X_1(\omega)= \frac {1}{1-ae^{-j \omega}} $$&#xA;$$ X_2(\omega)=\frac {\pi}{j}[   \delta(\omega + \omega_0) - \delta(\omega - \omega_0)]$$&#xA;Then,&#xA;$$ \frac {1}{2\pi}X_1(\omega) * X_2(\omega)$$&#xA;$$ \frac {1}{2\pi} [X_2(-\omega_0)X_1(\omega + \omega_0) + X_2(\omega_0)X_1(\omega - \omega_0)]$$&#xA;$$ \frac {1}{2\pi} [\frac {\pi}{j}X_1 (\omega + \omega_0) - \frac {\pi}{j} X_1(\omega - \omega_0)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac {1}{2\pi} [\frac {\pi}{j}\frac {1}{1-ae^{-j (\omega +  \omega_0)}}  - \frac {\pi}{j} \frac {1}{1-ae^{-j (\omega - \omega_0)}}] $$&#xA;$$ \frac {1}{2j}[\frac {1}{1-ae^{-j (\omega +  \omega_0)}}  -  \frac {1}{1-ae^{-j (\omega - \omega_0)}}] $$&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="16293" LastEditDate="2015-12-07T01:06:05.510" LastActivityDate="2015-12-07T01:06:05.510" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27556" PostTypeId="2" ParentId="27549" CreationDate="2015-12-06T16:41:17.870" Score="1" Body="&lt;p&gt;Your sequence is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=a^n\sin(n\omega_0)u[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, note that the Discrete-Time Fourier Transform (DTFT) of $(1)$ only exists if $|a|&amp;lt;1$. (The case $|a|=1$ can be handled by using Delta impulses). Anyway, for $|a|&amp;gt;1$ the DTFT of $(1)$ does not exist. Second, you can write $x[n]$ as the multiplication of $x_1[n]=a^nu[n]$ and $x_2[n]=\sin(n\omega_0)$. The DTFTs of these two sequences are given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X_1(e^{j\omega})&amp;amp;=\frac{1}{1-ae^{-j\omega}},\quad |a|&amp;lt;1\\&#xA;X_2(e^{j\omega})&amp;amp;=\frac{\pi}{j}\left[\delta(\omega-\omega_0)-\delta(\omega+\omega_0)\right],\quad -\pi &amp;lt;\omega &amp;lt;\pi\end{align}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, $X_2(e^{j\omega})$ is also $2\pi$-periodic, but in $(2)$ only the interval $-\pi&amp;lt;\omega&amp;lt;\pi$ is considered (assuming $0&amp;lt;\omega_0&amp;lt;\pi$).&#xA;Note that in your expression for $X_2(e^{j\omega})$ you have a sign error. Furthermore, note that $X_2(e^{j\omega})$ is the DTFT of $x_2[n]=\sin(n\omega_0)$, and not of $x_2[n]=\sin(n\omega_0)u[n]$, as claimed in your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\omega})=\frac{1}{2\pi}X_1(e^{j\omega})\star X_2(e^{j\omega})=\frac{1}{2\pi}\int_{-\pi}^{\pi}X_1(e^{j\theta})X_2(e^{j(\omega-\theta)})d\theta\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing you need to know to compute $(3)$ is the property&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)\star \delta(\omega-\omega_0)=F(\omega-\omega_0)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for any function $F(\omega)$. With $(4)$, evaluating $(3)$ with the DTFTs in $(2)$ results in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X(e^{j\omega})&amp;amp;=\frac{1}{2\pi}\frac{\pi}{j}\left[X_1\left(e^{j(\omega-\omega_0)}\right)-X_1\left(e^{j(\omega+\omega_0)}\right)\right]\\&amp;amp;=\frac{1}{2j}\left[\frac{1}{1-ae^{-j(\omega-\omega_0)}}-\frac{1}{1-ae^{-j(\omega+\omega_0)}}\right]\tag{5}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two terms in $(5)$ can be combined resulting in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\omega})=\frac{ae^{-j\omega}\sin(\omega_0)}{1-2a\cos(\omega_0)e^{-j\omega}+a^2e^{-2j\omega}}\tag{6}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-06T19:57:33.603" LastActivityDate="2015-12-06T19:57:33.603" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27560" PostTypeId="1" AcceptedAnswerId="29262" CreationDate="2015-12-06T21:14:34.927" Score="2" ViewCount="1318" Body="&lt;p&gt;Reading &lt;a href=&quot;https://www.google.fi/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=2&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0ahUKEwi35_aEk8jJAhUDvHIKHSKvBdIQFggnMAE&amp;amp;url=http%3A%2F%2Fwww.esat.kuleuven.be%2Fpsi%2Fspraak%2Fcgi-bin%2Fget_file.cgi%3F%2Fwverhels%2Ficassp93%2FWSOLA.ps%26ps&amp;amp;usg=AFQjCNHYDhTCfzDzCoScSNHm4fGs_2HU4Q&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper about WSOLA (Verhelst, Roelands)&lt;/a&gt; (&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.202.5460&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;PDF&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At page 2 there's a &quot;time-warped STFT's synthesis function&quot; involving $v(n)=w^2(n)$ which is a windowing function. A windowing function &lt;strong&gt;squared&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the interpretation/meaning of windowing function squared? &lt;br&gt;What does it mean visually?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="29" LastEditDate="2017-07-17T14:58:50.000" LastActivityDate="2017-07-17T15:11:45.840" Title="Windowing function squared?" Tags="|audio|window-functions|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27561" PostTypeId="2" ParentId="27560" CreationDate="2015-12-06T21:38:54.597" Score="4" Body="&lt;p&gt;it's just another window.  usually this happens when a window is applied on the time-domain data going &lt;em&gt;into&lt;/em&gt; the STFT (which is a DFT), some &lt;em&gt;process&lt;/em&gt; happens to the frequency-domain data after the STFT, then there is an inverse DFT bringing it back to the time domain, and the window is applied &lt;strong&gt;again&lt;/strong&gt; to that output time-domain data.  if that &lt;em&gt;process&lt;/em&gt; done to the data in the frequency domain happens to be the &lt;strong&gt;null&lt;/strong&gt; process, then what comes out of the iDFT is exactly what went into the DFT.  so then, in that case, the window is applied twice and that is the same as applying the square of the window once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i have been having a little argument with someone on &lt;em&gt;comp.dsp&lt;/em&gt; about this.  there is a term i hadn't seen before (&quot;Princen-Bradley condition&quot;) which i think means the same as a &quot;complementary-power&quot; window.  if the square of a complementary-power window is applied to an STFT system above with a &lt;em&gt;null&lt;/em&gt; process, the output will be exactly the input when 50% overlap is used.  but if the square of a complementary window (such as the Hann) is used, then, with 50% overlap you do &lt;strong&gt;not&lt;/strong&gt; get perfect reconstruction.  so the square-root of a Hann window would be a good candidate for a complementary-power window.  and you would have to apply that window &lt;strong&gt;twice&lt;/strong&gt; to the time-domain data to get perfect reconstruction.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-12-06T21:38:54.597" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27563" PostTypeId="1" AcceptedAnswerId="27564" CreationDate="2015-12-06T22:12:53.597" Score="1" ViewCount="328" Body="&lt;p&gt;Old test problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;em&gt;You have been asked to design a real-time digital filtering system that eliminates a band of frequencies between 20 and 30 MHz but preserves everything else.  The system uses an analog-to-digital converter (ADC) to digitize the analog input, a digital signal processing chip (DSP) to filter the digitized signal, and a digital-to-analog (DAC) converter to convert the signal back to analog.  Assume that ideal sampling is used as well as ideal anti-aliasing and reconstruction filters.  The maximum frequency that needs to be preserved in the reconstructed analog signal is 90 MHz.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What is the lowest sampling rate allowable in this system given the above constraints and giving that the anti-aliasing and reconstruction filters are not quite ideal:  they have 6 MHz transition bands?&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it was non-ideal it would be the Nyquist equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fs &gt; 2*fmax&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where fmax = 90 MHz, so,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fs &gt; 2*90MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fs &gt; 180 MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the non-ideal situation, my thought would be to add the 6 MHz transition bands to fmax.  Since it is a notch filter there are two transition bands.  Meaning it would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;90 MHz + 6 MHz + 6 MHz = 102 MHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was told that the correct set-up to solve this problem is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fs &gt; 2*(90MHz + (6MHz/2))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fs &gt; 2*(93)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fs &gt; 186&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He mentioned something about not caring whether the transition bands overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why is the 6 MHz transition band divided by 2?  Is it because there are two transition bands?  And if it were a highpass or lowpass filter, where there is only one transition band, would it not be necessary to divide by two?&lt;/p&gt;&#xA;" OwnerUserId="18622" LastActivityDate="2015-12-06T22:26:16.207" Title="Find minimum sampling rate of non-ideal notch filter" Tags="|filters|frequency|sampling|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27564" PostTypeId="2" ParentId="27563" CreationDate="2015-12-06T22:26:16.207" Score="1" Body="&lt;p&gt;If you sample at 2*93 = 186 MHz, then the frequencies from 93 to 96 MHz will alias into the range from 90 to 93 MHz. However, since the problem requires that only frequencies from 0 to 90 MHz are preserved, you are not concerned with aliasing occuring after 90 MHz.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-12-06T22:26:16.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27565" PostTypeId="1" CreationDate="2015-12-07T00:47:03.357" Score="1" ViewCount="618" Body="&lt;p&gt;I've read that phase vocoder is the STFT, but done in windows (i.e. using windowing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it called &quot;phase vocoder&quot;?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2018-01-08T23:10:35.270" Title="Why is the name &quot;Phase vocoder&quot;?" Tags="|audio|phase|stft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27566" PostTypeId="1" AcceptedAnswerId="27581" CreationDate="2015-12-07T01:18:37.537" Score="0" ViewCount="6240" Body="&lt;p&gt;E.g. the constant Q-transform is built by adding so called &quot;Fourier filters&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's a &quot;Fourier filter&quot;?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2015-12-08T01:42:51.197" Title="What's a &quot;Fourier filter&quot;?" Tags="|fourier-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27568" PostTypeId="2" ParentId="27565" CreationDate="2015-12-07T01:59:08.117" Score="4" Body="&lt;p&gt;A vocoder is a type of synthesizer originally developed for speech (or the human voice, thus the &quot;vo&quot; prefix), even before the use of digital processors.  The Bell Labs Voder was demonstrated in 1939, and VoCoders were reportedly used for encrypted voice communication during WW2 (according to Wikipedia).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DFTs can be used to analyze which audio spectrum peaks are to be used to &quot;code&quot; the speech, and short STFT windows are used to get a fine enough time resolution to isolate typical phonic atoms over reasonably stationary time periods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the frequency bin centers of a short FFT are not spaced with sufficient frequency resolution to capture pitch, overtones, and modulations thereof, accurately enough to sound human. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, by taking into account the FFT phase information, the difference in the phase of FFT result bins between adjacent offset windows can be used to adjust (or interpolate) the apparent or actual frequency of the voice codec synthesizers to more accurately model narrow-band frequency peaks than by just using the magnitude alone of the STFT FFT results.  Thus the &quot;phase&quot; prefix to the analysis-resynthesis vocoder process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you slide two Windows apart, the amount of phase change of stationary spectrum should be linear with frequency.  If analysis shows a little more phase change, the frequency is higher, a little less phase change, lower.  And this phase difference will be measurable even for differences in frequency much less than the Fs/N bin spacing of each FFT.  Thus there is information gain in using succesive frames and phase, rather than single frames and magnitude only, for the frequency estimation of narrow-band spectral peaks.  Phase can either be stretched or compressed across frames during FFT resynthesis, or the frequency of higher resolution oscillators can be adjusted to match the estimated frequency during synthesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With increases in DSP performance, phase vocoders are now used for music as well as speech, but the &quot;vo&quot; prefix remains.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-07T02:33:58.933" LastActivityDate="2015-12-07T02:33:58.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27571" PostTypeId="1" CreationDate="2015-12-07T04:32:06.103" Score="1" ViewCount="2127" Body="&lt;p&gt;I am confused with regard to how bandwidth increases with increase in number of bits transmitted for given duration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Usually say in PCM system, when we increase the number of bits (n) for a given sampling frequency (fs), the bitrate increases and minimum transmission bandwidth thus increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rb = nFs  and Bandwidth = Rb/2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)While in M-ary schemes,when the number of bits is increased the bandwidth decreases because in time domain  the signal is expanding,so obviously in frequency domain the overall width should reduce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not able to understand the context in which either is true!&lt;/p&gt;&#xA;" OwnerUserId="18535" LastEditorUserId="4298" LastEditDate="2017-12-11T09:22:26.490" LastActivityDate="2017-12-11T09:22:26.490" Title="Bandwidth of M-ary modulation schemes" Tags="|digital-communications|modulation|bandpass|bandwidth|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27572" PostTypeId="1" AcceptedAnswerId="27597" CreationDate="2015-12-07T05:52:28.543" Score="0" ViewCount="467" Body="&lt;p&gt;In &lt;a href=&quot;http://www.cs.tut.fi/sgn/arg/klap/schoerkhuber-JAES-2013.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (Schörkhuber, Klapuri, Sontacchi), it's shown that the constant Q-transform evaluated &quot;octave-wise&quot; produces the following looking graph:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xw81I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xw81I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why the octaves are &quot;disappearing&quot; in some time intervals. &lt;br&gt;Isn't this then a lossy&quot; process somehow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the paper it says that this is achieved because&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the atom hop sizes $H_k$ are set according to the highest frequency bin within each octave, that is, for each octave down $H_k$ is multiplied by 2&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-12-07T06:10:05.117" LastActivityDate="2015-12-07T23:04:47.423" Title="Why does this constant-Q transform &quot;lose octaves&quot;?" Tags="|fft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27574" PostTypeId="1" CreationDate="2015-12-07T06:37:40.127" Score="0" ViewCount="120" Body="&lt;p&gt;Right now, i am doing a research on how the Butterworth filter can reduce the noise in images captured by digital camera. For start, what i need is images which contain noise in it. My question is;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there is a way to add artificial noise such as gaussian noise into images?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After i have an images with noise in it, what are the parameters that i should have to create butterworth lowpass filter?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is my block diagram of my research. any help will do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/JCO7N.png&quot; alt=&quot;this is my block diagram of my research. any help will do.&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="18199" LastEditorUserId="1212" LastEditDate="2015-12-07T09:48:08.423" LastActivityDate="2015-12-07T09:48:08.423" Title="Denoising of Images capture by digital camera using Butterworth Filter" Tags="|filter-design|noise|denoising|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27575" PostTypeId="1" AcceptedAnswerId="27577" CreationDate="2015-12-07T07:51:28.200" Score="0" ViewCount="5981" Body="&lt;p&gt;In BPSK,&#xA;the constellation consists of 2 points (equiprobable) spaced at distance of $\sqrt{E_b}$ each from the origin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the average power from the constellation can be obtained by:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For BPSK, $P = \frac{E_b+E_b}{2} = E_b.$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For QPSK, 4 points which are equiprobable are spaced at distance of $\sqrt{2E_b}$ from origin each, that is they are placed on vertices of a square of side $2\sqrt{E_b}$. So, for QPSK, $P = \frac{2\cdot4\cdot E_b}{4}=2E_b.$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, does this mean that the power required for QPSK is more than BPSK when the probability of error is same for both?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: $E_b$ is the energy per bit and $P$ is the power which is assumed as proportional to the distance of the signal point from origin in the constellation.&lt;/p&gt;&#xA;" OwnerUserId="18535" LastEditorUserId="11256" LastEditDate="2015-12-07T16:26:46.763" LastActivityDate="2015-12-07T16:26:46.763" Title="High Transmission Power : BPSK or QPSK?" Tags="|qpsk|bpsk|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27576" PostTypeId="2" ParentId="27575" CreationDate="2015-12-07T08:18:31.733" Score="1" Body="&lt;p&gt;That's right. When we compare BPSK and QPSK at &lt;em&gt;equal energy per bit&lt;/em&gt;, we find that QPSK requires twice the power of BPSK. From &lt;a href=&quot;https://en.wikipedia.org/wiki/Phase-shift_keying&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Although QPSK can be viewed as a quaternary modulation, it is easier&#xA;  to see it as two independently modulated quadrature carriers. With&#xA;  this interpretation, the even (or odd) bits are used to modulate the&#xA;  in-phase component of the carrier, while the odd (or even) bits are&#xA;  used to modulate the quadrature-phase component of the carrier. BPSK&#xA;  is used on both carriers and they can be independently demodulated.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;As a result, the probability of bit-error for QPSK is the same as for&#xA;  BPSK:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$P_b = Q\left(\sqrt{\frac{2E_b}{N_0}}\right).$ &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;However, in order to achieve the same bit-error probability as BPSK, QPSK uses twice the&#xA;  power (since two bits are transmitted simultaneously).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="17530" LastActivityDate="2015-12-07T08:18:31.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27577" PostTypeId="2" ParentId="27575" CreationDate="2015-12-07T08:19:39.173" Score="1" Body="&lt;p&gt;Since for QPSK each symbol carries two bits, it is not surprising that the average energy &lt;em&gt;per symbol&lt;/em&gt; must be greater for QPSK than for BPSK to achieve the same error probability. What counts is the &lt;em&gt;energy per bit&lt;/em&gt; that is necessary to achieve a certain error probability, and this energy per bit is the same for BPSK and QPSK.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-07T10:26:22.150" LastActivityDate="2015-12-07T10:26:22.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27578" PostTypeId="2" ParentId="27571" CreationDate="2015-12-07T08:33:37.400" Score="3" Body="&lt;p&gt;The required bandwidth depends on the &lt;em&gt;symbol&lt;/em&gt; rate (or baud rate). If you have a binary system (i.e. two symbols) then the bit rate and the symbol rate are equal. If you use $M&amp;gt;2$ symbols, you can transmit more than 1 bit per symbol and your symbol rate, hence also the required bandwidth, is decreased. The problem with increasing the number of symbols is that you need more energy to keep the average distance between the symbols (i.e., the robustness against noise) the same. As pointed out by @vaz in a comment, the latter is only true for passband PAM systems, such as QAM or PSK.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-07T09:02:14.620" LastActivityDate="2015-12-07T09:02:14.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27579" PostTypeId="1" CreationDate="2015-12-07T10:50:45.370" Score="1" ViewCount="139" Body="&lt;p&gt;Is it possible to construct an array &lt;code&gt;A&lt;/code&gt;, without looping, where &lt;code&gt;A(i,j) = max(B(i),C(j))&lt;/code&gt; and &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; are column vectors?&lt;/p&gt;&#xA;" OwnerUserId="18629" LastEditorUserId="1629" LastEditDate="2015-12-07T13:55:28.337" LastActivityDate="2015-12-07T22:33:39.637" Title="Maximising each element in a matlab array" Tags="|matlab|matrix|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27580" PostTypeId="2" ParentId="27579" CreationDate="2015-12-07T11:11:01.310" Score="2" Body="&lt;p&gt;If the matrices are not too big, &lt;code&gt;repmat&lt;/code&gt; could work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B = [2 3];&#xA;C = [0 1 2 3];&#xA;% Vectorize the vectors for a simplication&#xA;B = B(:);&#xA;C = C(:);&#xA;&#xA;A = max(repmat(B,1,length(C)),repmat(C',length(B),1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For those interested, &lt;a href=&quot;https://stackoverflow.com/questions/29719674/comparing-bsxfun-and-repmat&quot;&gt;Comparing BSXFUN and REPMAT&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/28722723/matlab-bsxfun-no-longer-faster-than-repmat&quot;&gt;Matlab - bsxfun no longer faster than repmat?&lt;/a&gt; address its relative efficiency with respect to &lt;code&gt;repmat&lt;/code&gt;. Apparently,  &lt;code&gt;bsxfun&lt;/code&gt; used to be much faster, sometime ago. The difference seems shallower with the recent Matlab versions.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-12-07T22:33:39.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27581" PostTypeId="2" ParentId="27566" CreationDate="2015-12-07T11:31:21.587" Score="2" Body="&lt;p&gt;People (usually from fields outside signal processing) sometimes use the term &lt;a href=&quot;http://terpconnect.umd.edu/~toh/spectrum/FourierFilter.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fourier filter&lt;/a&gt; for a filtering operation in the FFT domain, which simply works by multiplying the FFT bins of a signal with a given filter function (often just ones and zeros, corresponding to pass bands and stop bands, respectively). Why this is generally not such a good idea is explained &lt;a href=&quot;https://dsp.stackexchange.com/questions/6220/why-is-it-a-bad-idea-to-filter-by-zeroing-out-fft-bins&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also in Computer Vision, the term &lt;a href=&quot;https://books.google.nl/books?id=ZCu8BAAAQBAJ&amp;amp;lpg=PA422&amp;amp;ots=sPE4rKyiWs&amp;amp;dq=%22fourier%20filter%22%20formula&amp;amp;pg=PA15#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fourier filter&lt;/a&gt; is used as explained above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;a href=&quot;http://doc.ml.tu-berlin.de/bbci/material/publications/Bla_constQ.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;document&lt;/a&gt; you linked to in a comment, the term is used to describe the computation of the Discrete-Time Fourier Transform (DTFT) at a given frequency from a finite length portion of a signal. This computation can be interpreted as a filtering operation, because it is a sum of products. The corresponding filter is a band pass filter with center frequency equal to the given DTFT frequency. More more information on the filter interpretation of the D(T)FT have a look at &lt;a href=&quot;http://www.dsprelated.com/freebooks/sasp/DFT_Filter_Bank.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2015-12-07T12:34:20.090" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27584" PostTypeId="1" AcceptedAnswerId="27606" CreationDate="2015-12-07T12:21:50.090" Score="1" ViewCount="85" Body="&lt;p&gt;I am calculating the sum of the signal energy in different frequency bands for music in Matlab. At the moment I have calculated the FFT for a music signal and then split this frequency vector in N partitions. This gives me the sum of the energy for N parts which is all good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with this is that music most often is concentrated around some frequencies and since my partitions are of uniform length this does not give a good representation of the original signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to do is to be able to give a frequency value f0 and the number of partitions N. This should then give me N partitions but where the partition lengths are shorther around f0 and increasingly longer when farther away from f0. How could one do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is that the end result would be a normalized length vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="18560" LastActivityDate="2015-12-08T12:36:32.960" Title="Partitioning the frequency axis with shifting resolution" Tags="|matlab|frequency-spectrum|" AnswerCount="1" CommentCount="8" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27586" PostTypeId="1" CreationDate="2015-12-07T14:11:41.007" Score="0" ViewCount="2323" Body="&lt;p&gt;I want to compute acoustic features on a set of audio files. These features can be classical audio features as spectral flux, but also acoustic indices as proposed in the &lt;a href=&quot;http://rug.mnhn.fr/seewave/&quot; rel=&quot;nofollow&quot;&gt;seewave&lt;/a&gt; R package ). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need, in a pre-processing step, to remove low frequency noise (approximatively inferior at 200 Hz), that could be caused for example by wind or a distant road, and are not appropriated for the analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As my features can be computed both from temporal and spectral values extracted from the audio signal, I am considering the use of a temporal high pass filter. This approach seem to me more adequate than a filtering on the spectral domain (with a reconstruction of the signal by an inverse Fourier transform). Am I right?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I am looking for an high-pass digital filtering method that will remove low frequencies, but preserve as much as possible the high frequencies. If it is possible, I would like that the amplitudes of the fft bins above the cutoff frequency could stay the same after the filtering. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best method for this application? Is it relevant to use a temporal filter rather than a filtering on the fft bins? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concretely, I will use a python implementation (with scipy). I am now considering the use of a butterworth filter with the filtfilt function. Is this method appropriate? Is there a better solution for this issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ant help or suggestion will be appreciate.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sampling rate of the audio files: 48 kHz &lt;/li&gt;&#xA;&lt;li&gt;Low frequency band to remove: around 0-300 Hz&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="18044" LastEditorUserId="18044" LastEditDate="2015-12-15T12:07:30.843" LastActivityDate="2015-12-15T13:39:34.120" Title="High-pass filtering pre-processing before computing audio features" Tags="|filters|filter-design|python|highpass-filter|" AnswerCount="2" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27587" PostTypeId="2" ParentId="27579" CreationDate="2015-12-07T14:18:22.967" Score="2" Body="&lt;p&gt;Try using &lt;code&gt;bsxfun&lt;/code&gt; if your version has it. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = bsxfun(@max, B, C.')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As per their &lt;a href=&quot;https://uk.mathworks.com/help/matlab/ref/bsxfun.html&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt;, &lt;code&gt;bsxfun&lt;/code&gt; expands the dimensions of the argument matrices  on-the-fly, so does not use as much memory as &lt;code&gt;repmat&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18632" LastActivityDate="2015-12-07T14:18:22.967" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27590" PostTypeId="1" CreationDate="2015-12-07T17:10:36.590" Score="0" ViewCount="743" Body="&lt;p&gt;what is the best algorithm for time_scaling of a speech signal in which I've seen two of them and I don't know which one to use :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Psola:Pitch synchronous overlap and add.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;time scaling modification using modified short Fourier transform magnitude .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what is the difference between them and which one is good for speech signal ?&#xA;In other words which one in more accurate and close  to the original signal.&#xA;If there are other good ones please tell me&lt;/p&gt;&#xA;" OwnerUserId="18416" LastActivityDate="2020-02-20T08:41:59.307" Title="Best algorithm for time-scaling" Tags="|audio|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27592" PostTypeId="2" ParentId="27590" CreationDate="2015-12-07T18:45:28.737" Score="2" Body="&lt;p&gt;The best depends exclusively on the type of signal you want to modify, if you just need apply time scale in monophonic (Speech), PSOLA and TDHS can give to you very nice results, but It is not as easy as you read in books, find Pitch Marks (Glottal Closure Instant) in PSOLA is really a big problem, in TDHS if your pitch track are consistent you can scale the signal to the hell, for Time scaling unsig FFT (commonly known as phase vocoder) this works better in polyphonic signals and to get best results here do you need use a locked phase vocoder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the length is a easy step, for stretch factor between 0.5 and 2.0 you can use some time domain technics: ola, sola, wsola, psola, tdhs, you can try &lt;a href=&quot;http://www.jstor.org/stable/3679554?seq=1#page_scan_tab_contents&quot; rel=&quot;nofollow noreferrer&quot;&gt;keith lent&lt;/a&gt; (I consider a bit different of PSOLA) in the Lent code you can try 50% of crossfade hann window that works nice for my ears.&lt;/p&gt;&#xA;" OwnerUserId="1081" LastEditorUserId="1081" LastEditDate="2019-09-22T21:11:41.523" LastActivityDate="2019-09-22T21:11:41.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27593" PostTypeId="1" CreationDate="2015-12-07T20:09:03.267" Score="1" ViewCount="4453" Body="&lt;p&gt;I know that FSK occupies a larger bandwidth compared other keying schemes,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;BW= f_1 -f_2 +2R_b&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_1$ and $f_2$ are carrier frequencies and $R_b$ is the bit rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For achieving a particular bit rate say 8 Kbps, how can I find the minimum bandwidth if I am free to choose the carrier frequencies?&lt;/p&gt;&#xA;" OwnerUserId="18535" LastEditorUserId="1629" LastEditDate="2016-05-18T15:19:20.697" LastActivityDate="2016-05-18T15:19:20.697" Title="Minimum bandwidth condition in FSK" Tags="|digital-communications|bandwidth|fsk|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27594" PostTypeId="1" AcceptedAnswerId="27607" CreationDate="2015-12-07T20:45:50.990" Score="2" ViewCount="429" Body="&lt;p&gt;A discrete signal x is generated by the recursive process&#xA;$$&#xA;x_n = x_{n-1} - 0.2 x_{n-2} + w_n&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w_n$ is white noise with zero mean and unit variance. What is the optimum order of a linear predictor for this signal? What are the values of the prediction coefficients? What is the average power of the residual?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate if someone could help me with this question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a past paper question not homework.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="18635" LastEditorUserId="4298" LastEditDate="2015-12-08T14:46:34.933" LastActivityDate="2015-12-08T14:51:19.157" Title="Linear Prediction of AR Process" Tags="|discrete-signals|self-study|autoregressive-model|linear-prediction|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27596" PostTypeId="2" ParentId="27408" CreationDate="2015-12-07T22:40:04.603" Score="2" Body="&lt;p&gt;I got an answer here, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://math.stackexchange.com/questions/1554659/mutual-information-for-a-continuous-uniform-distribution&quot;&gt;https://math.stackexchange.com/questions/1554659/mutual-information-for-a-continuous-uniform-distribution&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $ \text{erf}(x) $ function approximates to 1 with an error less than 0.0001 for $ x \geq 3 $. I plotted $ f_{y} (y) $ and I saw that the most of probability is within a band denpending on $ \sqrt{ 3 \gamma } $. Moreover, taking the limit $ \lim_{ y\to\infty } g(y,\gamma) \log g(y,\gamma) = 0 $. Then, I computed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h(y) = \frac{1}{2} \log \left( 24 \gamma \right) - \frac{ 1 }{ 2 \sqrt{ 3\gamma} } \frac{1}{2} \int_{ - \sqrt{ 3\gamma } - a }^{ \sqrt{ 3\gamma } + a } g(y,\gamma) \log_{2}( g(y,\gamma) ) dy $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ g (y,\gamma) = \text{erf} \left( \frac{ y + \sqrt{3\gamma} }{ \sqrt{2} } \right) - \text{erf} \left( \frac{ y - \sqrt{3\gamma} }{ \sqrt{2} } \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using $ quadgk(\cdot) $ function in matlab. &lt;/p&gt;&#xA;" OwnerUserId="18045" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2015-12-07T22:40:04.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27597" PostTypeId="2" ParentId="27572" CreationDate="2015-12-07T22:59:01.083" Score="1" Body="&lt;p&gt;The lower frequency atoms are longer in time (or of a length roughly proportional to the period of the frequency, give or take 2X).  So less of these lower frequency atoms are needed per second to cover that time period.  And more of the shorter atoms (for shorter wavelength frequencies) are required for about the same coverage (or with roughly the same percentage overlap).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to maintain a nearly constant Q, the length of a bandpass FIR filter ends up roughly proportional to some constant multiple of the wavelength of the center bandpass frequency of that filter.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-07T23:04:47.423" LastActivityDate="2015-12-07T23:04:47.423" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27598" PostTypeId="2" ParentId="27566" CreationDate="2015-12-08T01:42:51.197" Score="0" Body="&lt;p&gt;Each bin of a DFT or FFT result can be considered to be the result of a filter operation.   Each filter's frequency response is either Sinc shaped, or if a non-rectangular window is applied before the FFT, the response will be shaped like the transform of that window, with a passband width roughly proportional to from Fs/N to twice that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computing a single unwindowed DFT bin is nearly identical to a Goertzel filter.  So that's yet another potential synonym for the same thing.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-08T01:42:51.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27599" PostTypeId="1" CreationDate="2015-12-08T03:50:09.537" Score="1" ViewCount="426" Body="&lt;p&gt;In the article &quot;&lt;a href=&quot;http://graficaobscura.com/matrix/index.html&quot; rel=&quot;nofollow&quot;&gt;Matrix Operations for Image Processing&lt;/a&gt;&quot; by Paul Haeberli there is an example described using a matrix to alter the saturation of an image. In the example given the author first converts the image to greyscale using custom values rather than ITU-R Recommendation BT.601 luminance vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone shed some light as to how he calculates those numbers? &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Where rwgt is 0.3086, gwgt is 0.6094, and bwgt is 0.0820. This is the&#xA;  luminance vector. Notice here that we do not use the standard NTSC&#xA;  weights of 0.299, 0.587, and 0.114. The NTSC weights are only&#xA;  applicable to RGB colors in a gamma 2.2 color space. For linear RGB&#xA;  colors the values above are better.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="12008" LastActivityDate="2015-12-08T03:50:09.537" Title="How is the luminance vector calculated for these linear matrix transforms" Tags="|image-processing|transform|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27600" PostTypeId="1" CreationDate="2015-12-08T07:57:01.120" Score="0" ViewCount="2008" Body="&lt;p&gt;I got the result of findHomorgraphy in OpenCv. As below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Homography transform matrix: &#xA;[-1.1534205416542787    0.7834287271121142      527.9064589440736&lt;br&gt;&#xA;-0.2415444621693116     0.16412191792642924     110.54458949396778&lt;br&gt;&#xA;-0.002184845612886825   0.0014838718631386306   1.0 ]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I dont know how to calculate the rotation angle, scale, translation betwwen 2 iamges?&#xA;Could you please show me how to calculate these parameters?&lt;/p&gt;&#xA;" OwnerUserId="18644" LastActivityDate="2015-12-08T08:00:39.883" Title="How to calculate the scale, rotation angle and translation between 2 images if we know the homography result matrix?result" Tags="|image-processing|opencv|matrix|homography|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27603" PostTypeId="1" CreationDate="2015-12-08T10:36:06.793" Score="2" ViewCount="252" Body="&lt;p&gt;I'm looking for some library with a function to compute an essential matrix from line correspondences in multiple images. All the computer vision libraries I know use point correspondences to compute the essential matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen some papers about how to calculate E from line correspondences but implementing it myself would be a project on itself, so I prefer to try some existing implementation first. Does anybody know of a library with such an implementation available somewhere? &lt;/p&gt;&#xA;" OwnerUserId="3276" LastEditorUserId="53" LastEditDate="2015-12-08T14:33:21.137" LastActivityDate="2016-08-29T16:07:00.110" Title="Essential Matrix from line correspondences" Tags="|computer-vision|3d|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27605" PostTypeId="2" ParentId="22387" CreationDate="2015-12-08T10:45:34.233" Score="1" Body="&lt;p&gt;I think you are looking for the information rate,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ I(x_{1},x_{2},\cdots,x_{n}; y_{1}, y_{2}, \cdots, y_{n}) = \frac{1}{n} \sum_{i=1}^{n} I( x_{i};y_{i} ) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when input achieves the capacity of the channel $ x \sim N(0,P) $. Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ C = \frac{1}{2n} \sum_{i=1}^{n} \log \left( 1 + \text{SNR}_{i} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think every time we use the channel we have a new random variable $ y $ since we have a memoryless channel and $ w $ changes. Then, we have a sequence of related random variables $ \left\lbrace x_{i} \right\rbrace $ and $ \left\lbrace y_{i} \right\rbrace $. With the information rate we compute the mutual information between this two sequences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good reference about this Elements of Information Theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this could help you. &lt;/p&gt;&#xA;" OwnerUserId="18045" LastActivityDate="2015-12-08T10:45:34.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27606" PostTypeId="2" ParentId="27584" CreationDate="2015-12-08T12:36:32.960" Score="1" Body="&lt;p&gt;After some thinking I managed to create an answer that works for my problem. It does not center around the frequency f0 automatically but there is 4 design parameters that you can tinker with. My plan is to run the design parameters through an optimizer. So I can find the parameters that minimize the difference between the sum of the energy in each partition.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N_partition = 20;                                   % number of partitions&#xA;N_switch = -2;                                      % switches how how many partitions there are in&#xA;                                                    % the lower vs the upper part of the signal&#xA;N_lower = N_partition/2 + N_switch;                 % number of partitions in the lower part of the signal&#xA;N_upper = N_partition/2 - N_switch;                 % number of partitions in the upper part of the signal&#xA;diff_lower_upper = 0.05;                            % design value that decides how big the first partition in the signal is&#xA;a_upper = 25;                                       % design value that decides the slope appearance for the lower part of the signal&#xA;a_lower = 2;                                        % design value that decides the slope appearance for the upper part of the signal&#xA;vec_u = 0:1/N_upper:1;                              % vector for the lower part&#xA;vec_l = 0:1/N_lower:1;                              % vector for the upper part&#xA;&#xA;part_upper = ((a_upper.^vec_u-1)/(a_upper-1));      % the change vector for the upper part of the vector, exponential&#xA;part_lower = ((a_lower.^vec_l-1)/(a_lower-1));      % the change vector for the lower part of the vector, exponential&#xA;part_lower = fliplr(part_lower).*diff_lower_upper;  % the change vector but corrected for the diff_lower_upper design value&#xA;&#xA;change_vec = [part_lower(1:end-1) part_upper(2:end)]; % the change vector, removes the zero value from part_upper and part_lower&#xA;&#xA;nl = change_vec./sum(change_vec);                   % normalize the change vector, this is our normalized length vector&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For my case, this creates the following accumulated frequency/partition. I wanted high &quot;resolution&quot; around my f0 that is 1000Hz and then the partitions should grow in size the farther away they come from f0 which they do. Thanks to everyone that commented! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dSBb5.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dSBb5.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18560" LastActivityDate="2015-12-08T12:36:32.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27607" PostTypeId="2" ParentId="27594" CreationDate="2015-12-08T14:51:19.157" Score="3" Body="&lt;p&gt;From the definition of the process you know that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_{n+1}=x_n-0.2x_{n-1}+w_{n+1}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $w_n$ is white you can't predict it, so the best linear predictor for the given process is the filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P(z)=1-0.2z^{-1}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a first order filter. It estimates the future sample $x_{n+1}$ by computing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{x}_{n+1}=x_n-0.2x_{n-1}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The residual error is equal to $w_n$, which has an average power of $1$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-08T14:51:19.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27609" PostTypeId="1" CreationDate="2015-12-08T18:58:04.693" Score="2" ViewCount="300" Body="&lt;p&gt;I'm writing an audio analysis program and need to do some FFT to frames of the data. I've got some code (rather verbose so I'll leave out the details) that successfully performs the shuffling of the data according to the &lt;a href=&quot;http://mathworld.wolfram.com/Danielson-LanczosLemma.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Danielson-Lanczos Lemma&lt;/a&gt; through bit reversal of indices. For example the sequence of data &lt;code&gt;0,1,2,3,4,5,6,7&lt;/code&gt; becomes &lt;code&gt;0,2,4,6,1,3,5,7&lt;/code&gt; (though I'm working with a larger window than 8 samples!)&lt;/p&gt;&#xA;&lt;p&gt;The problem is that I'm a little confused on what to do with the resultant vector. I'm just completely lost. I've read something about doing the transform on pairs of data points and then combining them. So would I apply the DFT to &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;2&lt;/code&gt;, then add the resulting vector with that of the DFT of &lt;code&gt;4&lt;/code&gt; and &lt;code&gt;6&lt;/code&gt; (using the above example data points) and add that to &lt;code&gt;(DFT(1,3) + DFT(5,7))&lt;/code&gt;?&lt;/p&gt;&#xA;&lt;p&gt;If it matters, I'm dealing with just the right channel of a wav file, so the signal has no imaginary part.&lt;/p&gt;&#xA;&lt;p&gt;(I'm developing in Unity with C# and the only libraries j could find are .Net 4.0, and Unity only supports 3.5 right now. Plus I think it's interesting, if not confusing!)&lt;/p&gt;&#xA;" OwnerUserId="18653" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-12-10T11:54:40.293" Title="Performed the Danielson-Lanczos shuffling for FFT, but I don't know what to do next" Tags="|fft|dft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27610" PostTypeId="2" ParentId="27420" CreationDate="2015-12-08T19:28:20.747" Score="1" Body="&lt;p&gt;In &lt;a href=&quot;https://dsp.stackexchange.com/questions/27370/how-to-smooth-estimated-velocity&quot;&gt;here&lt;/a&gt;, @&lt;strong&gt;Peter K&lt;/strong&gt; suggests me with a first order smoother known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Exponential_smoothing&quot; rel=&quot;nofollow noreferrer&quot;&gt;the exponential moving average&lt;/a&gt;. In my case, it seems the filter is doing a good job. This filter for smoothing. You should not take the derivative of noisy data. You need first to smooth them otherwise, the derivative will be very noisy. See the below picture of using the suggested filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lWjbK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lWjbK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented a class in C++ regarding this filter. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Smoother&#xA;{&#xA;public:&#xA;    Smoother(const double&amp;amp; a) : alpha(a)&#xA;    {&#xA;        preSmoothData = 0.0;&#xA;    }&#xA;&#xA;    double smoothedData(const double&amp;amp; raw_data)&#xA;    {&#xA;       smoothData = (1.0 - alpha)*preSmoothData + alpha*raw_data;&#xA;       preSmoothData = smoothData;&#xA;&#xA;       return smoothData;&#xA;    }&#xA;&#xA;private:&#xA;    double alpha;&#xA;    double preSmoothData, smoothData;&#xA;};&#xA;&#xA;&#xA;int main()&#xA;{&#xA;     double raw_data;&#xA;     Smoother filter(0.1);&#xA;&#xA;     filter.smoothedData(raw_data);&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also test it with noisy generated data. For example, in the below picture, the cos function has been corrupted with Gaussian noise with zero mean and 0.4 for the variance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PAIOV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PAIOV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this the Matlab script. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = -pi:0.01:2*pi;&#xA;perfectY = cos(x);&#xA;noisyY = perfectY + .4 * randn(1, length(perfectY));&#xA;&#xA;a = 0.1;&#xA;preSmoothY = 0;&#xA;&#xA;&#xA;for i = 1:length(noisyY)&#xA;    Smooth = (1-a)*preSmoothY + a*noisyY(i);&#xA;    preSmoothY = Smooth;&#xA;    expY(i) = Smooth;&#xA;end&#xA;&#xA;plot( x,noisyY,'g', x, expY,'r', 'LineWidth', 2)&#xA;hold on&#xA;plot(x, perfectY, 'b','LineWidth', 2)&#xA;grid on&#xA;legend('noisy  data', 'filtered  data', 'data')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5788" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-12-08T22:28:06.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27612" PostTypeId="1" AcceptedAnswerId="27650" CreationDate="2015-12-08T21:02:21.533" Score="5" ViewCount="265" Body="&lt;p&gt;For an auditory psychological experiment, I need to create a sine wave, such that at a given point the frequency of the wave will rise smoothly, and descend back to base frequency. I need it to return in phase with a second sine wave which is a continuous sine wave of the base frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie: one ear will get a continuous 300 Hz sine wave,&#xA;    the other will get a 300 Hz sine wave, that rises to 305 for a short while, and descends back to 300 Hz &lt;em&gt;in phase&lt;/em&gt; with the second ear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I generated the frequency modulation with a complex phasor recursion, as suggested here: &lt;a href=&quot;https://dsp.stackexchange.com/a/1087/18658&quot;&gt;https://dsp.stackexchange.com/a/1087/18658&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ie, each point in the sine wave is given by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z(n+1) = z(n) * exp(j* 2pi* frequency).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The parameter I can play with is the length of modulation. Any ideas about how to find the nearest length that gives me the in-phase return?&lt;/p&gt;&#xA;" OwnerUserId="18658" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-12-12T13:51:58.317" Title="How to create a sine wave that transitions through frequencies and returns to phase" Tags="|audio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27613" PostTypeId="1" CreationDate="2015-12-08T23:38:22.573" Score="2" ViewCount="2174" Body="&lt;p&gt;I have signal that looks like this: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/gfwyA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gfwyA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see there are some almost periodic pulses at the background with amplitude about 1000. I am saying almost, because, if you zoom in, you may see that they slightly differ from each other, plus there may be intervals without them, something like between 35000 and 40000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get rid of these pulses?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://drive.google.com/file/d/0ByATqxQWgjs9dEpMTXdzR1F1RnM/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;csv with data&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18660" LastActivityDate="2016-04-30T04:57:26.813" Title="How to filter almost periodic noise?" Tags="|matlab|noise|python|filtering|periodic|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27614" PostTypeId="1" CreationDate="2015-12-09T04:29:49.183" Score="2" ViewCount="11501" Body="&lt;p&gt;The impulse response of the LTI system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t)=e^{-4t} u(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expression for the step response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac14 \left(1-e^{-4t}\right)u(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how $u(t)$ appears in the answer.&lt;/p&gt;&#xA;" OwnerUserId="18661" LastEditorUserId="4298" LastEditDate="2015-12-09T08:18:26.453" LastActivityDate="2015-12-09T17:07:36.057" Title="Compute step response from impulse response of continuous-time LTI system" Tags="|linear-systems|impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27615" PostTypeId="2" ParentId="27614" CreationDate="2015-12-09T08:30:15.667" Score="3" Body="&lt;p&gt;Since your question is not about how to obtain the answer, but specifically about the reason why the unit step $u(t)$ appears in it, I assume that you know that the response to a step input is computed by convolving the impulse response with a step:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\int_{-\infty}^{\infty}h(\tau)u(t-\tau)d\tau=\int_{-\infty}^{t}h(\tau)d\tau\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $h(t)$ is causal, i.e., $h(t)=0$ for $t&amp;lt;0$, the lower integration limit can be changed to $0$. This implies that if in $(1)$ the upper integration limit $t$ is less than $0$, the result must be zero. Consequently, the response to a step input can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=u(t)\cdot\int_0^{t}h(\tau)d\tau\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluating $(2)$ gives you the final answer, which includes the step function $u(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Triggered by Dilip Sarwate's comment I add some extra explanation. Note that the step function in $(2)$ is actually redundant because for $t&amp;lt;0$ the integral in $(2)$ is zero because for $t&amp;lt;0$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_0^{t}h(\tau)d\tau=-\int_{-|t|}^0h(\tau)d\tau=0,\quad t&amp;lt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $h(t)=0$ for $t&amp;lt;0$. However, if $h(t)=f(t)u(t)$ with some function $f(t)$ that is not zero for $t&amp;lt;0$ (in the given example we have $f(t)=e^{-4t}$), we cannot just replace the lower integration limit in $(1)$ by $0$ and leave out the step function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^th(\tau)d\tau=\int_{-\infty}^tf(\tau)u(\tau)d\tau=\int_{0}^tf(\tau)u(\tau)d\tau\neq \int_{0}^tf(\tau)d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because now we generally have for $t&amp;lt;0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{0}^tf(\tau)d\tau=-\int_{-|t|}^0f(\tau)d\tau\neq 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct way to evaluate the integral for $h(t)=f(t)u(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{-\infty}^th(\tau)d\tau=u(t)\cdot\int_0^tf(\tau)d\tau$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-09T17:07:36.057" LastActivityDate="2015-12-09T17:07:36.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27617" PostTypeId="1" CreationDate="2015-12-09T09:42:52.567" Score="2" ViewCount="1399" Body="&lt;p&gt;I've been working on a small system that transmits a linear chirp over the 35Hz-20kHz frequency range in a room and simultaneously records the transmitted signal with echoes (from the floor, walls, etc.), using two microcontrollers.&#xA;Using the received data $y[n]$ and reconstructing the transmitted chirp $x[n]$ in the receiver, I obtain the channel frequency response by $H[k]=Y[k]/X[k]$, $X$ and $Y$ being the FFTs of $x$ and $y$ respectively. I then attempt to compute the channel impulse response by computing $h[n]={\tt IFFT}(H[k])$. I then try to use time-gating to get rid of the echoes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that I am not using external memory limits my computational ability to using float arrays of length N=2048 at most, so the signals I'm dealing with are in the single milliseconds regions (this of course limits my resolution, but that's a problem I have to come to terms with).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem that's bothering me is, when I look at the calculated impulse response I get something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3Zm3p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Zm3p.png&quot; alt=&quot;Calculated Impulse Response&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that the main response is seemingly moved cyclicly a bit to the left, so that its beginning is at the end of the array and there is a large &quot;spike&quot; there (either that or the response has a big delay, which doesn't fit the physical system as the speaker and the microphone are just a few centimeters apart for the tests I'm performing).&#xA;What might be the reason for this?&#xA;I've read some posts around here which looked similar and there was talk about pre-ringing; could this be the case here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to compute the FFT of the time-gated (and ideally, &quot;fixed&quot;) impulse response to get some data out of it, and a part of it is obtaining the delay of the main response- can this be done in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Insight would be greatly appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Avner&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Attempting to bump this along with a follow-up question I had to Peter's response.&#xA;If I should attempt to ask this in a separate question instead- please let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Thank you very much! So far I've been transmitting a chirp that lasts 25ms, and the reception goes on for 32ms (so there's an underlying assumption that the channel is 7ms long due to short distances between speaker and mic). I've padded the chirp samples with zeroes to match the reception length (in samples) and using this scheme gave me the graph attached in the question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read that using a sine-sweep and performing a deconvolution results in separating nonlinear harmonics to &quot;behind&quot; the channel response in time, so that might be what's moved cyclicly and runs over the channel. Do you think there is a solution to this problem, given the limitations? I'm pretty much filling up the 32kB memory on the microcontroller I'm using with two 2048-float arrays that constitute a general array I'm working on and take up 16kB (doing things in-place) and two more int-arrays that take up 12kB more, so there's not a lot of memory left to use.&quot;&lt;/p&gt;&#xA;" OwnerUserId="18664" LastEditorUserId="18664" LastEditDate="2015-12-16T16:54:07.297" LastActivityDate="2015-12-16T16:54:07.297" Title="Determining channel frequency response from measured data via IFFT" Tags="|estimation|ifft|deconvolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27618" PostTypeId="2" ParentId="27613" CreationDate="2015-12-09T10:03:21.377" Score="1" Body="&lt;p&gt;I think you have a difficult problem here. Smoothing you signal (for example, with a moving average) probably won't help you. I guess you could try passing your signal through a narrowband notch filter whose notch center frequency is the frequency of your unwanted pulses. MBaz is correct. To think about an appropriate filter means you'd have to know what your signal looks like if it were not contaminated by those unwanted pulses. For example, does your uncontaminated signal look like the following?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/T7lOz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T7lOz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize I'm not answering your question in any meaningful way, but I was thinking: I assume your noisy signal is the output of an A/D converter sampling an analog voltage signal that's badly contaminated by some sort of electrical noise, some electrical interference. Instead of eliminating the noise in the digital samples I think you should do &lt;em&gt;everything&lt;/em&gt; you possibly can to eliminate the electrical noise in your original analog signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Dec. 12, 2015 Update based on Vlad's Comment&lt;/strong&gt;:&#xA;@Vladimir: Ah, interesting! What you wrote makes much sense. Those pulses are not noise contamination, they &lt;em&gt;are&lt;/em&gt; part of your signal. To attenuate those pulses, three things off the top of my head:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[&lt;a href=&quot;https://i.stack.imgur.com/T7lOz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;] I'd like to see the result of applying your signal to a moving average process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Although I have no meaningful experience with such a filter, I wonder what would be the result of applying your signal to a median filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] There's a scheme in the &quot;DSP Tricks&quot; chapter of my DSP book describing how to attenuate very narrow impulsive noise in a signal. I don't know if that scheme would be useful with regard to your pulses but who knows? If you'd like me to send you information on this scheme, send me a private e-mail at: R_dot_Lyons_@_ieee_dot_org.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15391" LastEditDate="2015-12-10T19:35:55.713" LastActivityDate="2015-12-10T19:35:55.713" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27619" PostTypeId="1" AcceptedAnswerId="27621" CreationDate="2015-12-09T10:30:30.747" Score="0" ViewCount="149" Body="&lt;p&gt;I have audio files with silence on 1.0 (max amplitude). I attach an example of audio waveform. I don't know why it is on 1.0? How can I convert it to have silence on 0 (as usual)? I noted that at the beginning of the waveform it is starting from 0 and goes to 1.0 - any ideas why? The files are telephone recordings, they are sampled with 8kHz and coded with GSM. I don't have more information about recording procedure. &lt;a href=&quot;https://i.stack.imgur.com/ObpcV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ObpcV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18667" LastEditorUserId="18667" LastEditDate="2015-12-09T10:51:24.920" LastActivityDate="2015-12-09T12:01:19.763" Title="Audio silence on 1.0" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27620" PostTypeId="2" ParentId="27619" CreationDate="2015-12-09T11:09:47.853" Score="1" Body="&lt;p&gt;For transmission of audio by amplitude modulation of for example light, the audio can be made unipolar in order to make silence correspond to no transmission which for some receivers means no noise during silence. Just a guess but your audio may have gone through such processing. From the look of the waveform it may have worked like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start with &lt;code&gt;bias = 0&lt;/code&gt;. For each time step:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;bias = bias + constant&lt;/code&gt;, where &lt;code&gt;constant&lt;/code&gt; determines the slope seen during silent segments in your graph&lt;/li&gt;&#xA;&lt;li&gt;If &lt;code&gt;bias + input &amp;gt; 1&lt;/code&gt;, then set &lt;code&gt;bias = 1 - input&lt;/code&gt; to avoid clipping.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is not possible to exactly recover the original audio from the output of such processing, but you could use a similar method that keeps shifting the bias towards the direction that centers the audio, and changes the bias appropriately any time the audio would be clipped.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-09T11:09:47.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27621" PostTypeId="2" ParentId="27619" CreationDate="2015-12-09T12:01:19.763" Score="0" Body="&lt;p&gt;In addition to Olli's suggestion, it might also be a by-product of the encoder's processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Removing this offset would ammount to a simple removal of the DC component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is practically done with a high pass filter with a cut-off (or rather pass-through) near zero Hertz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are working in Audacity, guessing by your screeshot, this is done by Effect-&gt;Normalise and from the window that pops up, make sure that you check &quot;Remove DC Offset&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of digital signal processing, you can calculate the arithmetic mean of the whole sample and then subtract it from all values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please note: This is assuming a constant DC offset across the recording. If you also happen to have DC drift, it would be better to perform a &quot;best line fit&quot; to the whole sample and then subtract that estimation from the whole sample to &quot;align&quot; it back to zero.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-12-09T12:01:19.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27622" PostTypeId="1" AcceptedAnswerId="27649" CreationDate="2015-12-09T13:53:54.107" Score="0" ViewCount="975" Body="&lt;p&gt;I want to make a 2D gaussian Blur coeffients.&#xA;Now I am making 1D gaussian Blur term as following.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double Cmfc_test5Dlg::Guassian(int x, double sigma)&#xA;{&#xA;        double c = 2.0 * sigma * sigma;&#xA;        return exp(-x * x / c) / sqrt(c * 3.141592f);&#xA;}&#xA;double Cmfc_test5Dlg::GuassianTerms(int kernalSize, double sigma, int *terms)&#xA;{&#xA;        for (int i = 0; i &amp;lt; kernalSize; ++i) {&#xA;                terms[i] = Guassian(i - kernalSize / 2, sigma)*1024;&#xA;        }&#xA;        return 1;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I want to make 2D instead of 1D. What should I do ?&lt;/p&gt;&#xA;" OwnerUserId="18670" LastActivityDate="2015-12-20T10:26:46.510" Title="How to make a 2D gaussian Blur terms?" Tags="|gaussian|c++|blur|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27623" PostTypeId="1" CreationDate="2015-12-09T13:54:31.807" Score="1" ViewCount="167" Body="&lt;p&gt;&lt;strong&gt;My question in short:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under which scenarios minimising transmission power is beneficial in terms of transmitter energy-efficiency? is there any fundamental reason to keep a low-power oriented design strategy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, small, low-cost transceivers (such as those used for M2M/IoT communications) are designed according to this strategy. I'd like to understand why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is quite natural to think that energy efficiency in radio link design is directly linked to a low transmission power. This, however, cannot be concluded from a simple analysis (see baseline model below). For instance, we may feel tempted to decrease the data rate in order to reduce the required transmission power. This in turn increases the transmission time, and the total energy consumed does not change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naturally, this question requires a look to the whole transmitter circuitry (which is a little outside my field). After some research, I noted that there must be a trade off regarding clock rate (high-precision and high-rate is payed with extra power) and amplifier efficiency (lower input powers are usually less efficient). But this suggests that minimising power is not always the best option. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The baseline model (optional)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a wireless radio system where a transmitter $A$ wants to communicate with a receiver $B$, at distance $d$. The total attenuation (due to to signal propagation) can be simply modelled as $L=d^\alpha$, where typically $2 \leq \alpha \leq 4$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The carrier-to-noise density ratio $\frac{C}{N_0}$ at $B$'s receiver input is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;	\frac{C}{N_0} = \frac{P_t G_A G_B}{d^{\alpha}N_0},&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $P_t$ is the power at the output of $A$. When designing these systems, there is usually a performance constraint expressed as a maximum tolerated bit error rate, which turns into a minimum $E_b/N_0 = \gamma_0$ requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in order to achieve this $\gamma_0$, it seems that there are only two system design parameters to play with (assuming all other parameters are fixed): transmission power and data rate, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;	\gamma_0 \propto \Big( \frac{P_t}{R_b} \Big).&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, we observe that increasing the transmission power has the same effect that decreasing the data rate,  in terms of $E_b/N_0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider that the total amount of data to be delivered is $L_b$. The total energy consumed by $A$ to deliver $L_b$ bits is therefore&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;	E_t \propto  P_t\frac{L}{R_b}=\gamma_0 N_0 L,&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which does not depend on the operating power neither on the data rate.&lt;/p&gt;&#xA;" OwnerUserId="17530" LastEditorUserId="17530" LastEditDate="2015-12-09T15:08:08.817" LastActivityDate="2016-09-05T13:20:27.660" Title="What are the fundamental reasons that suggest us to minimise transmission power for energy-efficient radio link design?" Tags="|digital-communications|information-theory|radio|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27624" PostTypeId="1" CreationDate="2015-12-09T13:58:52.160" Score="4" ViewCount="94" Body="&lt;p&gt;There is already a succesful question &lt;a href=&quot;https://dsp.stackexchange.com/questions/2625/how-did-they-color-old-black-and-white-movies&quot;&gt;How did they color old black and white movies?&lt;/a&gt; on this site. Very general and correspondingly in general answered. Let me please narrow it down to just the photograpy (i.e. no time dimension) and more specified starting point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the algorithm to color the greyscale HD picture given the colors at various points on greyscale original?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Yes, I am aware that the original colors can't be restored any more.&lt;/p&gt;&#xA;" OwnerUserId="18651" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-05-31T19:46:30.247" Title="Old photographies coloring" Tags="|image-processing|matlab|color|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27625" PostTypeId="2" ParentId="27617" CreationDate="2015-12-09T14:02:34.657" Score="2" Body="&lt;p&gt;Without seeing your code directly, my guess is that you're doing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = length(x);&#xA;X = fft(x,N);&#xA;Y = fft(y,N);&#xA;H = Y./X;&#xA;h = ifft(H);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem with doing that is this operation performs circular convolution over a length of &lt;code&gt;N&lt;/code&gt;.  The trouble is, the &quot;true&quot; length of the convolution of &lt;code&gt;y&lt;/code&gt; with &lt;code&gt;1/X&lt;/code&gt;'s impulse response will be of length &lt;code&gt;2N - 1&lt;/code&gt; (assuming &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; are both of length &lt;code&gt;N&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you are getting &lt;a href=&quot;http://www.dspguide.com/ch10/3.htm&quot; rel=&quot;nofollow&quot;&gt;time domain aliasing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is probably to set&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = length(x) + length(y) - 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or greater.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-12-09T14:14:04.887" LastActivityDate="2015-12-09T14:14:04.887" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27626" PostTypeId="1" CreationDate="2015-12-09T15:42:19.557" Score="4" ViewCount="2382" Body="&lt;p&gt;I am looking help for my project for which I need C++ (or any other language) libraries useful for extraction of sound wave features like &lt;strong&gt;frequency, loudness, pitch and orientation&lt;/strong&gt;. Using these features I want to make &lt;strong&gt;attention&lt;/strong&gt; in a humanoid robot simulator .&lt;/p&gt;&#xA;" OwnerUserId="18671" LastEditorUserId="11256" LastEditDate="2015-12-09T16:26:31.103" LastActivityDate="2017-08-27T06:30:45.103" Title="Are there libraries for extraction of sound wave features?" Tags="|audio|frequency|sound|pitch|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27627" PostTypeId="2" ParentId="27626" CreationDate="2015-12-09T15:45:52.930" Score="0" Body="&lt;p&gt;MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.jyu.fi/hum/laitokset/musiikki/en/research/coe/materials/mirtoolbox&quot; rel=&quot;nofollow&quot;&gt;MIR toolbox&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://engineering.purdue.edu/~malcolm/interval/1998-010/&quot; rel=&quot;nofollow&quot;&gt;Auditory toolbox&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10503" LastEditorUserId="10503" LastEditDate="2015-12-09T17:05:06.547" LastActivityDate="2015-12-09T17:05:06.547" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27628" PostTypeId="2" ParentId="26743" CreationDate="2015-12-09T15:48:08.707" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Do you think that the best strategy is to isolate the bright dots and then try to replace them with the surrounding signal? &lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you are trying to diminish the effect of the bright spots on the segmentation algorithm's output then you can try a simple &lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_blur&quot; rel=&quot;nofollow&quot;&gt;gaussian low pass filter&lt;/a&gt; or a &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/median.htm&quot; rel=&quot;nofollow&quot;&gt;median filter&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the Gaussian low pass will effectively &quot;blend&quot; the bright spots with their background (due to the averaging). The controlling parameter of the filter is the width of the gaussian (or its &quot;standard deviation&quot;). A key observation in choosing this technique is that the size of the spots is much smaller than the size of the nuclei. That is, the biggest nucleus is 7-9 pixels in diameter when the delineated nuclei are at least 20 pixels wide. Therefore, the bright spots occupy higher spatial frequencies and the low pass filter will reduce their contrast. You can try two gaussians at 5 and 9 px widths and see the result on the high resolution images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bad news are that the boundaries of the nuclei will get blured as well. A boundary is a relatively sharp transition of grey values and it occupies high frequencies too, therefore any lowpass filtering will blur it too. This will have an effect on detecting the shape and actual size of the nuclei. But if you all you are interested in is counting nuclei, then you can just get the centroids of the segmented areas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative is the median, which substitutes the values at a given pixel with the median of the $m \times n$ pixels surrounding it. You can set $m=n=5$ or $m=n=8$ and see the output. The median will also distort the detected contour and this time unpredictably.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step to consider is selective application of these filters over $m \times n$ patches depending on a threshold of their variance. That might give you a bit more control over the smoothing action because the material inside the nucleus has different &quot;texture&quot; (i.e. variance) than the material outside of the nucleus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-12-09T15:48:08.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27629" PostTypeId="2" ParentId="27626" CreationDate="2015-12-09T16:00:56.930" Score="7" Body="&lt;p&gt;From the ones I've been using I can recommend:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://yaafe.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;YAAFE&lt;/a&gt; - very pleasant to work with in Python&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://essentia.upf.edu/&quot; rel=&quot;nofollow&quot;&gt;ESSENTIA&lt;/a&gt; - another one I like particularly due to Python integration&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://aubio.org/&quot; rel=&quot;nofollow&quot;&gt;aubio&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://feapi.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;FEAPI&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://aquila-dsp.org/features/&quot; rel=&quot;nofollow&quot;&gt;Aquila&lt;/a&gt; - friend of mine used it extensively and he likes it a lot&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Recently I came across this paper and I believe that this should perfectly answer your question. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.ntnu.edu/documents/1001201110/1266017954/DAFx-15_submission_43_v2.pdf/06508f48-9272-41c8-9381-7639a0240770&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Moffat D. et al&lt;/em&gt; - &lt;strong&gt;An Evaluation of Audio Feature Extraction&#xA;  Toolboxes&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They do provide a detailed comparison based on:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Amount of features available&lt;/li&gt;&#xA;&lt;li&gt;Ease of usage&lt;/li&gt;&#xA;&lt;li&gt;Output format of the features&lt;/li&gt;&#xA;&lt;li&gt;Computational efficiency&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;They tested following libraries:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Aubio&lt;/li&gt;&#xA;&lt;li&gt;Essentia&lt;/li&gt;&#xA;&lt;li&gt;jAudio&lt;/li&gt;&#xA;&lt;li&gt;Librosa&lt;/li&gt;&#xA;&lt;li&gt;LibXtract&lt;/li&gt;&#xA;&lt;li&gt;Marsyas&lt;/li&gt;&#xA;&lt;li&gt;Meyda&lt;/li&gt;&#xA;&lt;li&gt;MIR Toolbox&lt;/li&gt;&#xA;&lt;li&gt;Timbre Toolbox&lt;/li&gt;&#xA;&lt;li&gt;YAAFE&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2016-07-15T13:38:44.210" LastActivityDate="2016-07-15T13:38:44.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27630" PostTypeId="2" ParentId="27626" CreationDate="2015-12-09T18:11:50.980" Score="2" Body="&lt;p&gt;I can highly recommend &lt;a href=&quot;https://librosa.github.io/librosa/&quot; rel=&quot;nofollow noreferrer&quot;&gt;librosa&lt;/a&gt; (python), for its intuitive API and excellent &lt;a href=&quot;http://scikit-learn.org/stable/&quot; rel=&quot;nofollow noreferrer&quot;&gt;scikit-learn&lt;/a&gt; integration, which is useful for quickly using extracted features in a machine learning pipeline). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out some examples: &lt;a href=&quot;http://nbviewer.ipython.org/github/bmcfee/librosa/blob/master/examples/LibROSA%20demo.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;introduction&lt;/a&gt;, scikit-learn &lt;a href=&quot;http://nbviewer.ipython.org/github/bmcfee/librosa/blob/master/examples/LibROSA%20sklearn%20feature%20pipeline.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;integration demo&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="11372" LastEditDate="2017-08-27T06:30:45.103" LastActivityDate="2017-08-27T06:30:45.103" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27631" PostTypeId="2" ParentId="27586" CreationDate="2015-12-09T18:48:39.883" Score="3" Body="&lt;p&gt;I agree that a large-order (12 taps+) high-pass &lt;a href=&quot;https://en.wikipedia.org/wiki/Butterworth_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Butterworth&lt;/a&gt; filter will be sufficient. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why?  Well, &lt;a href=&quot;https://en.wikipedia.org/wiki/Butterworth_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Butterworth&lt;/a&gt; filters are commonly used in professional audio-editing applications to do filtering, because their frequency response is designed to be as flat as possible in the passband. This means that the filtered audio is of higher quality/fidelity, as there are less frequency &quot;ripples&quot; or &quot;artifacts&quot; in the passband than other comparable filter types (Chebyshev, elliptic). In other words, &lt;a href=&quot;https://en.wikipedia.org/wiki/Butterworth_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Butterworth&lt;/a&gt; has a more linear phase response in the pass-band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The downside is that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Butterworth_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Butterworth&lt;/a&gt; filter has a slower roll-off, and will require a higher-order to implement a particular stopband specification. But this shouldn't be an issue for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LGA98.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LGA98.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your second question, this is why the above solution is preferable to using an FFT and zeroing out the bins: &lt;a href=&quot;https://dsp.stackexchange.com/questions/6220/why-is-it-a-bad-idea-to-filter-by-zeroing-out-fft-bins&quot;&gt;Why is it a bad idea to filter by zeroing out FFT bins?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-12-09T18:48:39.883" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27632" PostTypeId="1" CreationDate="2015-12-09T19:05:39.263" Score="0" ViewCount="44" Body="&lt;p&gt;This is a question about how to determine if two different output signals represent the same process with different random inputs.  This is related to validating ship motion modeling. When ship motion is modeled, using inertia and hydrodynamic equations, the resulting motion can be evaluated for a specified time history of a wave field. The question is how to determine if the ship model motion represents an actual ship where the ocean wave motion is not known and only the ship motion is measured? There are two sets of motion data, one set is output from ship model simulation, and the second set is measurements of the ship motion at sea. Is there a way to determine if these two sets of motion represent the same ship response, just driven by different forcing?  Let's assume that the ship motion is a linear operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not a navigation problem about the change in speed or heading due to propeller or rudder inputs.  The question is for the case of fixed speed and heading, what is the ship motion that results primarily due to ocean waves.  The model has fixed propeller speed with rudder feedback to maintain course.  The model also has an ocean wave spectrum with a prescribed wave heading.  The measurements on the ship are the inertia measurements of pitch, roll, heave, and heave velocity, and long/lat.  Previously significant motion values were used to compare two different models, but the significant motion (mean top 1/3) don't compare very well.  I was thinking of comparing the histogram of motion and/or the frequency content, for a fixed time period, like five minutes.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given two linear processes, L1, and L2, with measured outputs X1 and X2, to unknown random inputs Y1, Y2.  Can the similarity of L1 and L2 be determined from the outputs X1 and X2?&lt;/p&gt;&#xA;" OwnerUserId="18674" LastEditorUserId="18674" LastEditDate="2015-12-10T08:57:13.523" LastActivityDate="2015-12-10T08:57:13.523" Title="How to determine if output signals represent the same process with different unknown random inputs" Tags="|random|random-process|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27633" PostTypeId="2" ParentId="27623" CreationDate="2015-12-09T19:41:17.703" Score="1" Body="&lt;p&gt;Note that there are a host of practical secondary effects of increasing transmission power that do not scale with potentially less required transmission time, such as: battery impedance, voltage converter startup time, oscillator stabilization and carrier synchronization time, leakage or resistive losses due to larger required transistor sizes and/or higher voltage capacitors, more EMI shielding due to any higher digital edge rates required for processing, antenna shielding/spacing to limit human RF exposure, larger required heat spreaders/sinks, and etc.  The goal is often to minimize, not transmission power, but all these secondary power losses or inefficiencies, and/or their associated device costs, assuming some lower bandwidth or latency of delivering messages meets design goal targets.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-09T19:46:39.257" LastActivityDate="2015-12-09T19:46:39.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27634" PostTypeId="1" CreationDate="2015-12-09T19:48:14.113" Score="0" ViewCount="215" Body="&lt;p&gt;Original post from yesterday &lt;a href=&quot;https://dsp.stackexchange.com/questions/27609/performed-the-danielson-lanczos-shuffling-for-fft-but-i-dont-know-what-to-do-n&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I did the FFT and I have my transformed data (which is a bunch of values for each frame of data. I'm unsure what the transformed data actually represents. What information do I need, and what math do I need to perform to turn the $k$ values into the appropriate frequency values and the $X[k]$ values into $\textrm{dB}$ values? With $X[k]$ being equal to the sum of $x[n]$ from $n$ to $N-1$ times [...]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand how the FFT algorithm works now, I'm just not real clear on what the actual results represent.&lt;/p&gt;&#xA;" OwnerUserId="18653" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-12-09T23:17:38.090" Title="Performed FFT on an audio signal, but what does the output actually mean?" Tags="|fft|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27635" PostTypeId="2" ParentId="16558" CreationDate="2015-12-10T00:25:57.717" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;In the first resource, there is a parameter n (it is the sample size as I could interpret). &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, n is the averaging being done - either n separate pairs of spectra are being averaged, or the averaging is being done across n adjacent frequency bins. As long as the averaging is independent of the frequency, the coherence limit is independent of the frequency as well. Of course, the larger the sample size, the more averaging you can usefully do, but the limit c  is formally independent of the sample size (the number of points being FFTed) as well.&lt;/p&gt;&#xA;" OwnerUserId="18679" LastActivityDate="2015-12-10T00:25:57.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27637" PostTypeId="2" ParentId="27617" CreationDate="2015-12-10T11:51:06.487" Score="-1" Body="&lt;p&gt;You should use cross-correlation between the received signal and chirp. Your approach won't work in real time. &lt;/p&gt;&#xA;" OwnerUserId="18689" LastActivityDate="2015-12-10T11:51:06.487" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27638" PostTypeId="2" ParentId="27609" CreationDate="2015-12-10T11:54:40.293" Score="1" Body="&lt;p&gt;I am not so sure about what you're asking for, but I will try to tell you something about this point of your question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The problem is that I'm a little confused on what to do with the resultant vector.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You have not a resultant vector, you have two vectors [0,2,4,6], [1,3,5,7] and by the D-L lemma you can compute the  DFT of the original vector as a linear combination of the DFTs of these two vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking into account that the two shorter DFTs are periodic and that the combination coefficients for the second half are the negative of the coefficients used for the first half, we are lead either to a very simple recursive implementation of the FFT algorithm or to more complicated implementations that don't use recursion. Let's stay simple...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a pythonesque pseudocode, the recursive implementation can be written as simply as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def fft(x,n,e):&#xA;    if n==1:&#xA;        X = x # the DFT of a scalar is the scalar itself&#xA;        return X&#xA;    else:&#xA;        X0, X1 = fft(x[0::2],n/2,e[0::2]), fft(x[1::2],n/2,e[0::2])&#xA;        X0, X1 = X0 + e*X1, X0-e*X1&#xA;        X = concatenate(X0,X1)&#xA;        return X&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;x&lt;/code&gt; is the vector of which we want to compute the DFT&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;n&lt;/code&gt; is its length&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;e&lt;/code&gt; is a vector with the so called _twiddle_factors_, that is one half of the &lt;code&gt;n&lt;/code&gt;-th roots of unity (from the lower part of the unit circle for forward DFT, from the upper otherwise)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and the &lt;code&gt;[start:stop:step]&lt;/code&gt; notation stands for a selection of the elements of a vector, with a missing &lt;code&gt;stop&lt;/code&gt; meaning &lt;em&gt;to the end&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To call &lt;code&gt;fft&lt;/code&gt; you have to provide the initial vector of twiddle factors&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = fft( x,  n, exp(-2*pi*1j*(0..n/2-1)/n)) # forward&#xA;x = fft(X/n, n, exp(+2*pi*1j*(0..n/2-1)/n)) # inverse&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;1j&lt;/code&gt; id the imaginary unit and &lt;code&gt;(0..n/2-1)&lt;/code&gt; indicates an aritmetic progression from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;n/2-1&lt;/code&gt;, extremes included.&lt;/p&gt;&#xA;" OwnerUserId="18690" LastActivityDate="2015-12-10T11:54:40.293" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27639" PostTypeId="1" AcceptedAnswerId="27640" CreationDate="2015-12-10T14:57:54.063" Score="0" ViewCount="517" Body="&lt;p&gt;I have altered a MATLAB code that simulates the BPSK modulation using a raised cosine filter at the transmitter and  a matched filter at the receiver to study how the signal changes in each step. But, the final plot of the BER versus SNR is not decreasing as the SNR increases. I have no clue how to fix this. I would appreciate any help. The image and code is below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aH952.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aH952.jpg&quot; alt=&quot;BER vs SNR &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BER vs SNR&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear&#xA;N  = 10^6; % number of bits or symbols&#xA;T  = 1; % symbol duration of 1us &#xA;os = 5; % oversampling factor&#xA;fs = 5/T; % sampling frequency in MHz&#xA;rolloff = 0.05;&#xA;&#xA;Eb_N0_dB = [0:10]; % multiple Eb/N0 values&#xA;&#xA;for ii = 1:length(Eb_N0_dB)&#xA;    filter = rcosine(1/T,os,'sqrt',rolloff);&#xA;   % Transmitter&#xA;   ip = rand(1,N)&amp;gt;0.5; % generating 0,1 with equal probability&#xA;   s = 2*ip-1; % BPSK modulation 0 -&amp;gt; -1; 1 -&amp;gt; 1 &#xA;&#xA;   % up sampling the signal for transmission&#xA;   sU = [s;zeros(os-1,length(s))];&#xA;   sU = sU(:).';&#xA;   sFilt = 1/sqrt(os)*conv(sU,filter);&#xA;   sFilt = sFilt(1:N*os);&#xA;&#xA;&#xA;   % Noise addition&#xA;   y= awgn(sFilt,ii,0); &#xA;&#xA;   % mathched filter&#xA;   yFilt = conv(y,fliplr(filter)); % convolution&#xA;   ySamp = yFilt(os:os:N*os);  % sampling at time T&#xA;&#xA;   % receiver - hard decision decoding&#xA;   ipHat = real(ySamp)&amp;gt;0;&#xA;&#xA;   % counting the errors&#xA;   nErr(ii) = size(find([ip- ipHat]),2);&#xA;&#xA;end&#xA;&#xA;simBer = nErr/N; % simulated ber&#xA;semilogy(Eb_N0_dB,simBer,'mx-');&#xA;grid on&#xA;xlabel('Eb/No, dB');&#xA;ylabel('Bit Error Rate');&#xA;title('Bit error probability curve for BPSK modulation');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9061" LastEditorUserId="9061" LastEditDate="2015-12-10T15:59:46.803" LastActivityDate="2015-12-10T17:09:19.910" Title="Why does the BER rate change randomly versus the SNR?" Tags="|matlab|modulation|snr|bpsk|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27640" PostTypeId="2" ParentId="27639" CreationDate="2015-12-10T15:14:20.627" Score="2" Body="&lt;p&gt;There are a few problems with your code:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You are using the index &lt;code&gt;ii&lt;/code&gt; not the actual SNR in DB in this line: &lt;code&gt;y= awgn(sFilt,ii,0);&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You are not taking into account the filter delay in &lt;code&gt;ySamp = yFilt(os:os:N*os);&lt;/code&gt;.  Your filter is &lt;code&gt;filter = rcosine(1/T,os,'sqrt',rolloff);&lt;/code&gt; which will design a root-raised cosine FIR filter.  Your filter delay will be &lt;code&gt;(length(filter)-1)/2&lt;/code&gt;.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2015-12-10T17:09:19.910" LastActivityDate="2015-12-10T17:09:19.910" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27642" PostTypeId="1" AcceptedAnswerId="27647" CreationDate="2015-12-10T16:26:25.910" Score="1" ViewCount="228" Body="&lt;p&gt;I try to use the butter worth pandpass filter to retrive the OSC from signal y showing in Fig3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output signal is as in Fig4. We can see from Fig4 that I have retrived the OSC successfully. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the output signal(Fig4), there is noise signal from sample number 0 to sample number 100. I want to know which caused the problem? How can I remove the noise signal or where can I start?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Q7DBo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q7DBo.png&quot; alt=&quot;Plot from the octave code&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Octave code is as following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%###################################################&#xA;&#xA;% freq:the sample rate&#xA;&#xA;% sinNum:Ignore it, not used.&#xA;&#xA;%###################################################&#xA;&#xA;function [y] = DigitalFilterAppliedProb(freq, sinNum)&#xA;    close all;&#xA;&#xA;    x1 = (0:1/freq:1);&#xA;    x1 = x1(1:end-1);&#xA;    i = 0;&#xA;&#xA;    lenOfX1 = length(x1); &#xA;    y1 = zeros(1, lenOfX1);&#xA;&#xA;    %for i=1:sinNum&#xA;    %   y1 = y1 + sin(i*2*pi*x1);&#xA;    %endfor&#xA;&#xA;    y1 = y1 + sin(20*2*pi*x1);&#xA;&#xA;    y2 = [zeros(1, freq) y1 zeros(1, freq)];&#xA;&#xA;    lengthOfY2 = length(y2);&#xA;&#xA;    x0 = (0:1/freq:lengthOfY2/freq);&#xA;    x0 = x0(1:end-1);&#xA;    %y0 = 2*ones(1, lengthOfY2);&#xA;    y0 = -10*x0+10;&#xA;&#xA;    y = y0 + y2;&#xA;&#xA;    %Plot   &#xA;    figure 1&#xA;    subplot(2, 2, 1)&#xA;    plot(y0);&#xA;    title(&quot;Fig1.Source signal(y0 = -10*x + 10)&quot;)    &#xA;&#xA;    %figure 2;&#xA;    subplot(2, 2, 2)&#xA;    plot(y2);&#xA;    title(&quot;Fig2.Source Signal(y2=sin(20*2*pi*x))&quot;)&#xA;&#xA;    %figure 3;&#xA;    subplot(2, 2, 3)&#xA;    plot(y);&#xA;    title(&quot;Fig3.Source Signal(y=y0+y2)&quot;)&#xA;&#xA;    %Low pass filter&#xA;    [b, a] = butter(8, [5/(freq/2) 45/(freq/2)]);&#xA;    yf = filter(b, a, y);&#xA;&#xA;    %figure 4&#xA;    subplot(2, 2, 4)&#xA;    plot(yf);&#xA;    title(&quot;Fig4.Filtered Signal&quot;)&#xA;&#xA;    figure 2&#xA;    freqz(b, a);&#xA;&#xA;endfunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="18695" LastEditorUserId="8202" LastEditDate="2015-12-10T16:45:22.470" LastActivityDate="2015-12-10T18:29:37.110" Title="About output signal digital band pass filter" Tags="|filters|digital|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27643" PostTypeId="1" AcceptedAnswerId="27653" CreationDate="2015-12-10T17:01:40.293" Score="1" ViewCount="2791" Body="&lt;p&gt;I guess this is a pretty basic question, but I am kinda stuck... So if I am remembering the DSP theory correctly, spectral leakage can occur when we take &quot;inappropriate&quot; combinations of the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) FFT length&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) sampling frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) fundamental frequency of input signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a MATLAB script for demonstrating this, in a case of a sinusoid input: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F0=10; %Frequency of the sinusoid&#xA;Fs=100; %Sampling Frequency&#xA;observationTime = 1; %observation time in seconds&#xA;t=0:1/Fs:observationTime-1/Fs; %time base&#xA;&#xA;x=sin(2*pi*F0*t);%sampled sine wave&#xA;&#xA;N1=100; %DFT length same as signal length&#xA;X1 = 1/N1*fftshift(fft(x,N1));%N-point complex DFT of x&#xA;f1=(-N1/2:1:N1/2-1)*Fs/N1; %frequencies on x-axis&#xA;stem(f1,abs(X1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;MY thought was that if the fundamental frequency is a multiple of the frequency resolution, then there will be no spectral leakage, since there is a bin that corresponds to the exact value of the fundamental frequency F0. However, it seems like I am wrong here...&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jXHk1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jXHk1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone please explain to me what's the flaw in my rationale? Why is there leakage in the 3rd plot? Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="13391" LastActivityDate="2015-12-10T21:57:21.243" Title="Studying spectral leakage due to DFT length and frequency resolution" Tags="|matlab|dft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27644" PostTypeId="1" CreationDate="2015-12-10T17:08:23.817" Score="1" ViewCount="257" Body="&lt;p&gt;I am working in a phoneme recognition project, the language that I am using is &quot;English&quot;. I have a tool that converts each written phrase in phonemes. Also I have an estimation of the time length of each word. I would like to know also the duration of every single phoneme. Does any one know if there is a good source where I can resort to know the duration of the phonemes in the English language?&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-12-10T20:56:03.220" Title="What are good estimates for phonemes length?" Tags="|speech-recognition|speech-processing|speech|voice|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27645" PostTypeId="2" ParentId="27624" CreationDate="2015-12-10T17:15:06.940" Score="1" Body="&lt;p&gt;This can be useful to you: &lt;em&gt;Oscar Dalmau Cedeño, Mariano Rivera, Teresa Alarcón: &lt;a href=&quot;http://www.cimat.mx/~mrivera/journals/dalmau_color_cgf11.pdf&quot; rel=&quot;nofollow&quot;&gt;Bayesian Scheme for Interactive Colourization, Recolourization and Image/Video Editing&lt;/a&gt;. Comput. Graph. Forum 29(8): 2372-2386, 2010.  ISSN: 0167-7055&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="16620" LastActivityDate="2015-12-10T17:15:06.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27646" PostTypeId="1" CreationDate="2015-12-10T17:28:13.223" Score="10" ViewCount="2276" Body="&lt;p&gt;I'm trying to do image registration using phase correlation as described in the &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.185.4387&amp;amp;rep=rep1&amp;amp;type=pdf&quot;&gt;Reddy Chatterji paper&lt;/a&gt;. In my case, the images may be scaled and translated relative to each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm for finding the relative scale, as I understand it, is (see: &lt;a href=&quot;https://i.stack.imgur.com/hDCHu.png&quot;&gt;the flowchart from the paper&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F1 = DFT(I1)&#xA;F2 = DFT(I2)&#xA;H1 = Highpass(F1)&#xA;H2 = Highpass(F2)&#xA;L1 = LogPolar(Magnitude(H1))&#xA;L2 = LogPolar(Magnitude(H2))&#xA;PC = PhaseCorrelate(L1,L2)&#xA;PM = norm(PC)&#xA;R = IDFT(PhaseCorr/PM)&#xA;P = Peak(R)&#xA;Scale = LogBase^P[1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Scale gives me seemingly nonsensical values (wildly different from image to image and never correct).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But ignoring scale, the same phase correlation approach works fine for translation; and so I suspect I have a problem with my log-polar transform. Here's an example, where I've solved for translation--the left image is the original and the right has been cropped and translated--the solution is shown on top of the orignal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gswwd.jpg&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gswwd.jpg&quot; alt=&quot;Translation alone works&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the log-polar transform, I first transform into polar space:&#xA;$$&#xA;\hat{I}(\rho,\theta) = I\left(r+\rho\cos\left(\frac{2\pi\theta}{N_{\theta}}\right),r-\rho\sin\left(\frac{2\pi\theta}{N_{\theta}}\right) \right)&#xA;$$&#xA;where $I$ is the original image, $r$ is the image radius (half-width) and $N_{\theta}$ is the number of samples in the $\theta$ direction. I then sample from this to transform into log polar space: &#xA;$$&#xA;\hat{I}_{log}(\rho,\theta) = \hat{I}\left(\log_{b}(\rho),\theta\right)&#xA;$$&#xA;where $b = (2r)^{-N_{\rho}}$ as described in &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.185.4387&amp;amp;rep=rep1&amp;amp;type=pdf&quot;&gt;1&lt;/a&gt; so that it spans the whole polar space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here're the example images in log-polar space with $\rho=\theta=256$ (in case there's something glaringly wrong):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2dQQ2.jpg&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2dQQ2.jpg&quot; alt=&quot;Log Polar&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, this shows the actual transformation the images go through before the phase correlation step (top is DFT magnitude post highpass filter, bottom is that in log polar space):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jRt2B.jpg&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jRt2B.jpg&quot; alt=&quot;Log Polar of DFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using OpenCV, which has LogPolar and PhaseCorrelate methods. While the PhaseCorrelate, like my manual implementation, gives me the correct answer for translation, it's incorrect on scale. Since using the OpenCV LogPolar or my own doesn't affect the correctness, I must be missing something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="17235" LastEditorUserId="17235" LastEditDate="2015-12-10T17:53:53.413" LastActivityDate="2018-07-31T17:14:49.837" Title="Log-Polar DFT Based Scale-Invariant Image Registration" Tags="|image-processing|dft|opencv|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27647" PostTypeId="2" ParentId="27642" CreationDate="2015-12-10T18:29:37.110" Score="1" Body="&lt;p&gt;What you are seeing is not &quot;noise&quot;, but the step response of your filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the filter is started with a null state (unless you explicitly call &lt;code&gt;filter&lt;/code&gt; with state variables).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your signal starts at value 10, so you will get something very similar to 10 times the filter's step response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to eliminate this transient, then you can either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Subtract 10 from your input signal, so that it starts at 0.&lt;/li&gt;&#xA;&lt;li&gt;Prepend your signal with enough samples so that the transient does not overlap with your signal of interest. These samples can be all 10 in value, for example.&lt;/li&gt;&#xA;&lt;li&gt;Multiply your whole signal by a window function; something like &lt;code&gt;yw = &#xA;y .* hann(length(y))'&lt;/code&gt;. This way the whole signal is smoothed at the edges and you minimize the transient.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="330" LastActivityDate="2015-12-10T18:29:37.110" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27648" PostTypeId="2" ParentId="27643" CreationDate="2015-12-10T20:03:15.067" Score="0" Body="&lt;p&gt;It's not just the FFT length that causes the so-called &quot;leakage&quot;.  It's the window type and window's length.  In the 3rd plot, you show the effects of a rectangular window half the length of the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if a signal has any existence for greater than the length of a finite FFT, it gets rectangularly windowed by default. That's why certain frequencies (non-integer-periodic-in-aperture) show windowing artifacts (oft called &quot;leakage&quot;).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-10T20:03:15.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27649" PostTypeId="2" ParentId="27622" CreationDate="2015-12-10T20:37:43.450" Score="0" Body="&lt;p&gt;It's real easy. Multi-dimensional Gaussian functions are &lt;a href=&quot;https://en.wikipedia.org/wiki/Separable_filter&quot; rel=&quot;nofollow&quot;&gt;separable&lt;/a&gt;, that is they can be calculated as the product of the Gaussian function along all axes. For the 2-d case it means: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;terms[x, y] = terms[x]*terms[y]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that separability also means that you obtain the same result as by using the 2-d filter, by first 1-d filtering along one axis and then 1-d filtering the output along the other axis.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-12-20T10:26:46.510" LastActivityDate="2015-12-20T10:26:46.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27650" PostTypeId="2" ParentId="27612" CreationDate="2015-12-10T20:50:10.153" Score="3" Body="&lt;p&gt;For the first continuous $f_0=300\mbox{Hz}$ signal, after $2N$ samples (for a duration of $2N/f_s$ at a sampling rate $f_s$) the phase will have changed by:&#xA;$$&#xA;\begin{align}&#xA; \Delta \phi_1&#xA;   &amp;amp;= 2\pi \frac{f_0}{f_s} (2N-1)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, as the second signal ramps up linearly (in small quantized steps as per your phasor implementation) from $f_0=300\mbox{Hz}$ to $f_1=305\mbox{Hz}$ then down from 305Hz to 300Hz over the same $2N$ samples, the phase will have changed by:&#xA;$$&#xA;\begin{align}&#xA; \Delta \phi_2&#xA;   &amp;amp;= \sum_{n=1}^{N} 2\pi \left(\frac{f_0}{f_s} + \left(\frac{f_1}{f_s}-\frac{f_0}{f_s}\right)\frac{n}{N}\right)&#xA;      + \sum_{n=1}^{N-1} 2\pi \left(\frac{f_1}{f_s} + \left(\frac{f_0}{f_s}-\frac{f_1}{f_s}\right)\frac{n}{N}\right) \\&#xA;%   &amp;amp;= 2\pi \frac{f_1}{f_s} &#xA;%      + 2\pi \sum_{n=1}^{N-1} \left(\frac{f_0}{f_s} + \left(\frac{f_1}{f_s}-\frac{f_0}{f_s}\right)\frac{n}{N} + \frac{f_1}{f_s} + \left(\frac{f_0}{f_s}-\frac{f_1}{f_s}\right)\frac{n}{N}\right) \\&#xA;%   &amp;amp;= 2\pi \frac{f_1}{f_s} &#xA;%      + 2\pi \sum_{n=1}^{N-1} \left(\frac{f_0}{f_s} + \frac{f_1}{f_s}\right) \\&#xA;   &amp;amp;= 2\pi \frac{f_1}{f_s} + 2\pi \left(\frac{f_0}{f_s}+\frac{f_1}{f_s}\right) \left(N - 1\right)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those two signals to be in phase after $2N$ samples, their phase difference must be a multiple of $2\pi$. Thus the constraint is that&#xA;$$&#xA;\begin{align}&#xA;  \Delta \phi_2 &#xA;    &amp;amp;= \Delta \phi_1 + 2\pi k \\&#xA;  2\pi \frac{f_1}{f_s} + 2\pi \left(\frac{f_0}{f_s}+\frac{f_1}{f_s}\right) \left(N - 1\right)&#xA;    &amp;amp;= 2\pi \frac{f_0}{f_s} \left(2N-1\right) + 2\pi k&#xA;\end{align}&#xA;$$&#xA;for some arbitrary integer $k$, or equivalently:&#xA;$$&#xA;\begin{align}&#xA;  N &amp;amp;= k \frac{f_s}{f_1-f_0} &#xA;\end{align}&#xA;$$&#xA;Which, provided that $kf_s/(f_1-f_0)$ is an integer greater than 0, yields a signal duration of&#xA;\begin{align}&#xA;  \frac{2k}{f_1-f_0}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your specific case for a frequency excursion of $5\mbox{Hz}$, the signals will return in phase for modulation durations of 0.4, 0.8, 1.2, ... seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you need to sustain the signal for some $M$ samples at $f_1$ (instead of immediately going back down after the rise), then the constraint becomes:&#xA;$$&#xA;\begin{align}&#xA;  N+M &amp;amp;= k \frac{f_s}{f_1-f_0} &#xA;\end{align}&#xA;$$&#xA;In other words the duration of the rise and plateau together would, in your case, need to be a multiple of 0.2 seconds. So for example if you want to have a plateau of 1 second at 305Hz, you might choose a rise + plateau of 1.2 seconds, giving 0.2 seconds for the ramp up and another 0.2 seconds for the ramp down (for a total signal duration of 1.4 seconds)&lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="8952" LastEditDate="2015-12-12T13:51:58.317" LastActivityDate="2015-12-12T13:51:58.317" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27651" PostTypeId="2" ParentId="27644" CreationDate="2015-12-10T20:56:03.220" Score="1" Body="&lt;p&gt;NLTK has an interface/downloader for a sample of the TIMIT phoneme corpus (&lt;a href=&quot;http://nltk.sourceforge.net/doc/api/nltk.corpus.reader.timit-module.html&quot; rel=&quot;nofollow&quot;&gt;http://nltk.sourceforge.net/doc/api/nltk.corpus.reader.timit-module.html&lt;/a&gt;), and it should be straightforward to get the lengths of the phoneme recordings in that corpus.&lt;/p&gt;&#xA;" OwnerUserId="18697" LastActivityDate="2015-12-10T20:56:03.220" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27653" PostTypeId="2" ParentId="27643" CreationDate="2015-12-10T21:57:21.243" Score="1" Body="&lt;p&gt;It looks like what you are doing is only changing the DFT size (using &lt;code&gt;N1&lt;/code&gt; variable), this is equivalent to padding your signals with zeros up to a given length. Your signal (for &lt;code&gt;N1=200&lt;/code&gt;) looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NTeeq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NTeeq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be immediately seen that the periodic extension is not really a continuous waveform. This discontinuity is introducing the leakage effect that you are observing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below a quick and dirty code that demonstrates that. I did both padding of input signal in time domain, as well as calling the &lt;code&gt;fft&lt;/code&gt; function with twice the signal size. Plots are in dB scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MVQa6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MVQa6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;F0=10; %Frequency of the sinusoid&#xA;Fs=100; %Sampling Frequency&#xA;observationTime = 1; %observation time in seconds&#xA;t=0:1/Fs:observationTime-1/Fs; %time base&#xA;&#xA;%% Ideal case&#xA;x=sin(2*pi*F0*t);%sampled sine wave&#xA;&#xA;N1=100; %DFT length same as signal length&#xA;X1 = abs(1/N1*fftshift(fft(x,N1)));%N-point complex DFT of x&#xA;f1=(-N1/2:1:N1/2-1)*Fs/N1; %frequencies on x-axis&#xA;X1 = 10*log10(X1/max(X1));&#xA;subplot(2,1,1)&#xA;plot(f1,X1, 'o-');&#xA;title('Ideal case')&#xA;grid on&#xA;&#xA;%% Padding signal with zeros&#xA;x2 = [x zeros(1, length(x))];&#xA;&#xA;N2=200; %DFT length same as signal length&#xA;X2 = abs(1/N2*fftshift(fft(x, N2)));%N-point complex DFT of x&#xA;f2=(-N2/2:1:N2/2-1)*Fs/N2; %frequencies on x-axis&#xA;X2 = 10*log10(X2/max(X2));&#xA;subplot(2,1,2)&#xA;plot(f2,X2, 'o-');&#xA;hold on&#xA;grid on&#xA;&#xA;%% Padding with zeros implicitly&#xA;N2=200; %DFT length same as signal length&#xA;X3 = abs(1/N2*fftshift(fft(x, N2)));%N-point complex DFT of x&#xA;f3=(-N2/2:1:N2/2-1)*Fs/N2; %frequencies on x-axis&#xA;X3 = 10*log10(X3/max(X3));&#xA;plot(f3,X3, 'r-');&#xA;title('Padding with zeros')&#xA;legend({'Padded vector', 'Twice the FFT size'})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-12-10T21:57:21.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27654" PostTypeId="1" AcceptedAnswerId="27655" CreationDate="2015-12-11T04:45:28.763" Score="0" ViewCount="182" Body="&lt;p&gt;I have a microphone which produces unexpected results when exposed to very loud input. The mic is a cheap electret headset mic and I am recording into a DAW. For very loud, noisy signals (eg. blowing on the mic) I get an unexpected waveform. In the MATLAB plot below, you can see a snippet of about 0.5 seconds of audio which demonstrate what I'm talking about. The signal is clearly clipping at -1.0, but is not getting near the other end of its range at 1.0.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CgJPR.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CgJPR.jpg&quot; alt=&quot;DC Offset? Or something else...&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same signal, the clipping behaviour can then reverse and start clipping almost constantly at 1.0 and not reaching -1.0. It's as though there has been some sort of wandering, fluctuating DC offset introduced. Can anyone shed some light on what is happening? &#xA;&lt;a href=&quot;https://i.stack.imgur.com/IlkBw.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IlkBw.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15033" LastEditorUserId="13320" LastEditDate="2016-11-13T13:33:10.490" LastActivityDate="2016-11-13T13:33:10.490" Title="Behaviour of microphone with high volume input" Tags="|audio|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27655" PostTypeId="2" ParentId="27654" CreationDate="2015-12-11T09:07:39.637" Score="3" Body="&lt;p&gt;An overview of the analog signal path in a system such as yours:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Hu2OD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hu2OD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clipping can take place:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In the microphone as mechanical soft clipping, distorting the waveform rather than clipping exactly at some value.&lt;/li&gt;&#xA;&lt;li&gt;In the built-in impedance converter field effect transistor (FET) of the electret microphone capsule. (I think this is very much like hard clipping)&lt;/li&gt;&#xA;&lt;li&gt;In a separate preamplifier as analog hard clipping.&lt;/li&gt;&#xA;&lt;li&gt;At the analog-to-digital converter of the audio interface, as hard digital clipping.&lt;/li&gt;&#xA;&lt;li&gt;On the digital signal if any digital processing is done on integer data, as hard digital clipping.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Because the clipping is hard at numerical values -1 and +1, digital clipping must be taking place. Because it looks like there is hard clipping also at other numerical values than -1 and +1, there is probably hard clipping taking place at more than one stages separated by an alternating current (AC) coupling. Blowing directly into the microphone is quite an extreme disturbance, so there is probably also the 1st and the 2nd kind of clipping going on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few places in your system where there can be an AC coupling or equivalent: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In the microphone, as the pressure in the back of the omnidirectional closed-back capsule slowly equalizes with that of the outside world due to a (by design) leaky seal.&lt;/li&gt;&#xA;&lt;li&gt;On the analog signal. AC coupling may be built in into the plug-in power supply to the microphone, into the preamp and into the audio interface.&lt;/li&gt;&#xA;&lt;li&gt;Digitally in the audio interface or in the digital audio workstation (DAW). Check the settings!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you blow into the microphone long enough then the AC coupling begins to see the average pressure level of that as direct current (DC), centering the signal to zero during the disturbance. When you stop blowing it takes some time for the coupling to adapt to the normal atmospheric pressure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the electronics to recover faster after a disturbance, try adding a capacitor in series with the signal output of the plug-in power supply as yet another stage of AC coupling. The capacitor should be small enough to make the time constant of the resulting &lt;a href=&quot;https://en.wikipedia.org/wiki/RC_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;resistor–capacitor (RC) filter&lt;/a&gt; short enough.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-12-11T10:04:59.347" LastActivityDate="2015-12-11T10:04:59.347" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27656" PostTypeId="1" CreationDate="2015-12-11T09:47:04.913" Score="0" ViewCount="566" Body="&lt;p&gt;Sorry for any thing silly!&#xA;              Matlab uses the built in function called 'xcorr' to find correlation of two signals.In VHDL xcorr is not defined then correlation can be written using for loop the code for which available on below link.But the problem is this code is not easy to implement in VHDL.Does any one know any other way to define cross correlation without using xcorr. Any response will be much appreciated please. Really interested to know the simplest way to find correlation please.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/7396814/cross-correlation-in-matlab-without-using-the-inbuilt-function&quot;&gt;Cross correlation without xcorr&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17286" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-12-11T09:47:04.913" Title="Problem in hardware implementation of cross correlation without xcorr" Tags="|matlab|cross-correlation|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27657" PostTypeId="1" CreationDate="2015-12-11T10:12:36.297" Score="7" ViewCount="1749" Body="&lt;p&gt;Is $x(t) = \cos t + \sin\left(\frac{1}{2}t\right)$ a periodic signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer provided by the book is different from my answer. Book says its not a periodic signal. Can you guys tell me why is it not a periodic signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\cos(t)$ is periodic as $2\pi f_1 = 1 \Rightarrow f_1=\frac{1}{2\pi} \Rightarrow T_1=2\pi$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$\sin\left(\frac{1}{2}t\right)$ is also periodic as $2\pi f_2 = \frac{1}{2} \Rightarrow f_2=\frac{1}{4\pi} \Rightarrow T_2=4\pi$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Therefore $\frac{T_1}{T_2} =  \frac{2\pi}{4\pi} = \frac{1}{2}$  is rational number&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Therefore the given $x(t)$ is a periodic signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="18701" LastEditorUserId="80" LastEditDate="2016-11-13T18:31:47.223" LastActivityDate="2017-02-28T12:02:34.053" Title="Is $x(t) = \cos t + \sin\left(\frac{1}{2}t\right)$ a periodic signal?" Tags="|periodic|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27658" PostTypeId="2" ParentId="27657" CreationDate="2015-12-11T10:46:00.933" Score="8" Body="&lt;p&gt;As for every $t_0\in\mathbb{R}$ and $k\in\mathbb{Z}$&#xA;$$&#xA;\begin{eqnarray}&#xA;  &amp;amp;x(t_0+4k\pi)  &amp;amp;=\cos(t_0+4k\pi)+\sin(t_0/2+2k\pi)\\&#xA;  &amp;amp;              &amp;amp;=\cos(t_0)+\sin(t_0/2)\\&#xA;  &amp;amp;              &amp;amp;=x(t_0)&#xA;\end{eqnarray}&#xA;$$&#xA;you answer is correct: $x(t)$ is periodic.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-12-11T10:46:00.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27659" PostTypeId="2" ParentId="27657" CreationDate="2015-12-11T13:39:03.170" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Double-angle_formulae&quot; rel=&quot;nofollow noreferrer&quot;&gt;double-angle formulae for trigonometric identities&lt;/a&gt; tell you that $\cos \left(\frac{2t}{t}\right) = 1 - 2\sin^2(\frac{t}{2})$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You thus ave $x(t) =1 +\sin(\frac{t}{2}) - 2\sin^2(\frac{t}{2}) $. Hence, your signal is composed of functions (as adds and multiplies) that all admit $4\pi$ as a period (yes, the constant function $x\to 1$ is $4\pi$ periodic as well). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus your function looks very periodic.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2017-02-28T12:02:34.053" LastActivityDate="2017-02-28T12:02:34.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27660" PostTypeId="2" ParentId="27657" CreationDate="2015-12-11T13:45:55.933" Score="5" Body="&lt;p&gt;To add a contrarian answer:  If your time index, $t$, is an integer, then your signal is not periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of periodic is: $x[t]$, $t\in\mathbb{Z}$ is periodic with period $P\in \mathbb{Z}$ iff&#xA;$$&#xA;x[t] = x[t+P]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we need&#xA;$$&#xA;\cos(t) = \cos(t+P)&#xA;$$&#xA;so for periodicity we require&#xA;$$&#xA;P = 2\pi k&#xA;$$&#xA;with $k\in \mathbb{Z}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $\pi$ is irrational, that cannot be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the first component of your signal cannot be periodic, so the entire signal cannot be periodic.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-11T13:45:55.933" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27661" PostTypeId="1" CreationDate="2015-12-11T14:31:42.783" Score="0" ViewCount="251" Body="&lt;p&gt;How does delta modulation work in practice? And where is it used? I find it confusing that, in 1-bit quantization we use only 2 level; if we apply this quantization, there will be loss in information. So, why do we use this technique?&lt;/p&gt;&#xA;" OwnerUserId="18702" LastEditorUserId="11256" LastEditDate="2015-12-11T23:17:33.990" LastActivityDate="2018-04-19T01:34:11.760" Title="How does delta modulation work practically?" Tags="|quantization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27662" PostTypeId="1" CreationDate="2015-12-11T17:20:02.297" Score="0" ViewCount="46" Body="&lt;p&gt;I am completely new to image processing and python. I hope I can find some help here. I am trying out a project on detecting fouling% on a ship hull using raspberry pi. I am trying to learn how this going to be done and how can i pre-process these images. Images will be captured underwater using Picam module and purpose of stitching is to generate an overview of overall fouling and to calculate the percentage of fouling. Below are ways I will approach this problem, but am I right to say haarcascade will not be able to use in this project because it is not possible to use it to calculate percentage of fouling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To classify type of fouling and percentage of fouling&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Macro fouling and microfouling pictures added and trained using Haarcascade or PCA algorithm to identify them OR Colour Segmentation/blob detection. The final result can be then obtain accurately in comparison to manual image segmentation like Grabcut algorithm.&lt;/p&gt;&#xA;" OwnerUserId="18704" LastEditorUserId="18704" LastEditDate="2015-12-11T18:07:16.113" LastActivityDate="2015-12-11T18:07:16.113" Title="Counting percentage of fouling on a surface" Tags="|image-processing|image-segmentation|sift|homography|stitching|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27663" PostTypeId="2" ParentId="27661" CreationDate="2015-12-11T17:30:16.470" Score="1" Body="&lt;p&gt;One key point to note about &lt;a href=&quot;https://en.wikipedia.org/wiki/Delta_modulation#Principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;delta modulation schemes&lt;/a&gt; is that they quantize the change between the current value &lt;strong&gt;and the previously quantized value.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BnGKH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BnGKH.png&quot; alt=&quot;Image taken from Wikipedia, image by Wdwd wikipedia user; license is: http://creativecommons.org/licenses/by/2.5/&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other key point to note is that, in general, delta modulation schemes are run at &lt;a href=&quot;https://en.wikipedia.org/wiki/Delta-sigma_modulation#Oversampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;sampling rates MUCH higher than the Nyquist rate would suggest.&lt;/a&gt; Early portable CD players used a scheme called MASH (multi-stage noise shaping) on their DACs to allow cheaper, more accurate reproduction of sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't find a reference quickly, but I seem to recall that for the 44.1kHz CD sampling rate, MASH 1-bit DACs ran at sampling rates in the order of 5-6 MHz.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-11T17:30:16.470" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27664" PostTypeId="2" ParentId="27661" CreationDate="2015-12-11T18:24:07.517" Score="0" Body="&lt;p&gt;There won't be any loss of information if all the information desired to be transmitted is already quantized and band-limited well below the cut-off of the low-pass filter network that removes anything near the (delta) modulation rate (or its noise-shaped side-bands).  The high frequency 1-bit quantization gets &quot;averaged out&quot; by a low pass filter over a long enough period of time to transmit lots of bits (or signal levels) of information at a much lower rate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2018-04-19T01:34:11.760" LastActivityDate="2018-04-19T01:34:11.760" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27665" PostTypeId="1" CreationDate="2015-12-11T18:54:29.617" Score="1" ViewCount="1268" Body="&lt;p&gt;I have a question on the multiplication of  two noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have two noise $n_1[n]$ and $n_2[n]$. I only know their power spectral density $N_1[k]$ and $N_2[k]$. How can I get  $N_3[k]$, where $N_3[k]$ is the power spectral density of $n_3[n] = n_1[n] n_2[n]$. Let's first assume $n_1[n]$ and $n_1[n]$ are independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking to first calculate the auto-correlation $R(n_1[n] n_2[n])$. Then $$N_3[k] = F(R(n_1[n] n_2[n]))=F(R(n_1[n])R(n_2[n]))=F(R(n_1[n]))*F(R(n_1[n])),$$ where $F()$ represents Fourier transform. But we only know the amplitude of information of $F(R(n_1[n]))$ and $F(R(n_2[n]))$ through $N_1[k]$ and $N_2[k]$. That is, we do not have the phase information. How can we calculate $N_3[k]$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could somebody help on this?&lt;/p&gt;&#xA;" OwnerUserId="18708" LastEditorUserId="80" LastEditDate="2015-12-11T20:00:08.640" LastActivityDate="2015-12-11T20:00:08.640" Title="Multiplication of two noise" Tags="|noise|power-spectral-density|autocorrelation|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27668" PostTypeId="1" CreationDate="2015-12-11T20:42:11.817" Score="4" ViewCount="3610" Body="&lt;p&gt;I am trying to estimate the position &amp;amp; head direction of a rodent going through a 2D environment (a circular surface of 1m radius). Above his head is an overhead camera which records 4 LEDs mounted on his head. The position is calculated as the centroid of the LEDs positions and the head direction as the angle of the LEDs (see images).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is that wires attached to his head occasionally occlude 1-4 of the LEDs and thus prevent/complicate measurement. Furthermore, the head direction estimation is particularly subject to lots of noise due to nonhorizontal head movements which add a 3rd dimension to the LED movements which are assumed to be parrelel to the surface (thus introducing a sort of parallax). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought a kalman filter would be a great way too smooth this data. However, in Matlab it seems that to implement this I would need to assume either constant acceleration or velocity which is not the case since the rodent is freely moving. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a standard Kalman filter still possible? Maybe a nonlinear (extended) KF? Are there any other better solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;Roman&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rodent in a square environment. I included this image since here the overhead wires and LEDs are more easily visible&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MhezH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MhezH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rodent in the circular environment. Notice that 1 of the LEDs (green) is occluded by the wire:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9zQ9e.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9zQ9e.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4550" LastEditorUserId="4550" LastEditDate="2015-12-14T22:11:50.327" LastActivityDate="2016-05-06T15:30:42.073" Title="Kalman Filter for estimating position with nonconstant velocity &amp; acceleration" Tags="|estimation|kalman-filters|tracking|visual-tracking|position|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27669" PostTypeId="1" AcceptedAnswerId="27675" CreationDate="2015-12-12T06:05:12.493" Score="2" ViewCount="935" Body="&lt;p&gt;From paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://quod.lib.umich.edu/cgi/p/pod/dod-idx/sliding-is-smoother-than-jumping.pdf?c=icmc;idno=bbp2372.2005.086&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Bradford R., Dobson R., ffitch J.&lt;/em&gt; - &lt;strong&gt;Sliding is Smoother than&#xA;  jumping&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In chapter 6 - Signal Reconstruction, the inverse of the sliding DFT can be achieved by this formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_0=\frac{1}{N}\sum_{k=0}^{N-1}F_0(k)e^{-2\pi i k (0/N)} = \frac{1}{N}\sum_{k-=0}^{N-1}F_0(k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the average of all the frequency bins is equal to the first sample of the window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I wonder, if the input signal is a single sine wave, then the DFT of the signal will be the same throughout the whole signal. And then using the above formula, the resynthesized samples are all going to be the same number, when in reality it has to vary from -1 to 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I understanding this wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made a picture describing my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F46Li.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F46Li.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17782" LastEditorUserId="8202" LastEditDate="2015-12-12T14:34:54.023" LastActivityDate="2019-05-06T12:37:26.457" Title="Inverse Sliding DFT" Tags="|fourier-transform|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27670" PostTypeId="2" ParentId="27669" CreationDate="2015-12-12T07:24:15.617" Score="1" Body="&lt;p&gt;The DFT won't be the same as it is slid along a real-valued sine wave.  The magnitude of an FFT result bin might be the same, but its phase will change (rotate) as the DFT is slid.  Thus the sum of a rotating phasor and its complex conjugate mirror will vary (sinusoidally in fact).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-12T07:24:15.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27671" PostTypeId="1" CreationDate="2015-12-12T08:04:24.327" Score="-1" ViewCount="1118" Body="&lt;p&gt;After being away from DSP for a long time, I am trying to familiarize myself with wavelet transform. Here is what I (think) have understood so far:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Wavelet transform provides you high time resolution at higher frequencies and high frequency resolution at lower frequencies.&lt;/li&gt;&#xA;&lt;li&gt;DWT can be calculated by using QMF pair and subsampling. When used recursively, filter pair increases frequency resolution and subsampling decreases time resolution.&lt;/li&gt;&#xA;&lt;li&gt;Result of level 1 DWT &lt;code&gt;[cA, cD] = dwt(signal, Lo_D, Hi_D)&lt;/code&gt; essentially gives low frequency and high frequency splits of the signal called approximation and details.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If my understanding is correct, in this algorithm, the end result is essentially in time domain. If I want to know what frequencies are present, I have to take an fft of the coefficients. Is that correct? If so, is there a way I can get the frequency domain representation without extra step of taking fft?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2: If scalogram is the answer to question 1, how is it generated using results of repeated use of &lt;code&gt;dwt&lt;/code&gt;?&#xA;I want to avoid using ready MATLAB functions for better understanding except maybe &lt;code&gt;dwt&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="18714" LastActivityDate="2022-04-14T09:05:10.500" Title="Getting frequency content at different times from discrete wavelet transform coeffs" Tags="|wavelet|transform|time-frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27672" PostTypeId="2" ParentId="24687" CreationDate="2015-12-12T11:25:15.060" Score="3" Body="&lt;p&gt;There is a lot of variability because distortion can be compensated for optically and lens designs differ. Some lenses are marketed as rectilinear, most not. You would be making the distortion worse for some lenses by doing any correction advised by focal length alone. For focal lengths shorter than about 30 mm, the distortion seems dominantly barrel, according to the data of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neale, W., Hessel, D., and Terpstra, T., &quot;&lt;a href=&quot;http://www.kineticorp.com/publications/2011-01-0286-photogrammetry-error-from-lens-distortion.pdf&quot; rel=&quot;nofollow&quot;&gt;Photogrammetric Measurement Error Associated with Lens Distortion&lt;/a&gt;,&quot; SAE Technical Paper 2011-01-0286, 2011, doi:10.4271/2011-01-0286.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They only tested zoom lengths though.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-12T11:25:15.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27673" PostTypeId="1" AcceptedAnswerId="27678" CreationDate="2015-12-12T11:41:28.570" Score="0" ViewCount="641" Body="&lt;p&gt;I have trouble understanding the following from wikipedia - Bandwidth (Signal Processing)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A key characteristic of bandwidth is that any band of a given width can carry the same amount of information, regardless of where that band is located in the frequency spectrum&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The higher the frequency the more the cycles and therefore shouldn't there be more information passing in a second?&lt;/p&gt;&#xA;" OwnerUserId="18716" LastActivityDate="2015-12-12T18:33:39.483" Title="Relation between bandwidth and data rate" Tags="|frequency|nyquist|bandwidth|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27675" PostTypeId="2" ParentId="27669" CreationDate="2015-12-12T16:00:31.897" Score="3" Body="&lt;p&gt;Possible roots for this misinterpretation are three-fold, based on  a confusion in  Fourier transforms' properties.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;if the input signal is a single sine wave, then the DFT of the signal will be the same throughout the whole signal&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, because only the Fourier magnitude might be invariant to shifts, on whole signals (infinite, with a  sine). As said by @hotpaw2 before, there is a phase term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No as well because you have a rectangular window on your sine (or finite length), and the shift property won't apply unless you have exactly an integer number of full periods in you rectangular time frame (check out &lt;a href=&quot;https://dsp.stackexchange.com/a/27660/15892&quot;&gt;this answer by @Peter K. on periodicity and discrete signals&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if you look at chapter 4 for the same paper, you will see that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But that only gives the contribution to the sample from a single point&#xA;  in the collection of windows that contain the required sample point.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Additional information might be found in &lt;a href=&quot;http://dx.doi.org/10.1109/MSP.2003.1184347&quot; rel=&quot;nofollow noreferrer&quot;&gt;The sliding DFT&lt;/a&gt; by Jacobsen and Lyons, and &#xA;&lt;a href=&quot;http://www.dsprelated.com/showarticle/776.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Understanding and Implementing the Sliding DFT&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="26573" LastEditDate="2019-05-06T12:37:26.457" LastActivityDate="2019-05-06T12:37:26.457" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="27676" PostTypeId="1" CreationDate="2015-12-12T16:07:10.787" Score="1" ViewCount="694" Body="&lt;p&gt;I have time series like this one, and I am trying to get the phase information from it. If it matters why, because I need to compute the precision of the cycles and amplitude variability is introducing a lot of &quot;noise&quot; to the signal that I want to get rid of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time series:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NtJPN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NtJPN.jpg&quot; alt=&quot;original time series&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt;&#xA;At the end of the day I want to make an autocorrelation of the signal to compute the Quality Factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The problem is that since the signal has a very sharp edge at the beginning of every cycle, any approach I try to do give me a noisy phase information that I can't use.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Computing the Fourier Transform of the original series also contains the amplitude variability, which I don't want to use.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I tired to approaches, using a Wavelet transform and a Hilbert transform. From any of these to approaches I get a Complex time series from which I can compute the phase, in principle with out amplitude variability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that because of the sharp edges of the times series both approaches are failing to get a smooth phase profile of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hilbert Transform:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using the Hilbert transform of Matlab, which uses FFT. The thing is that since the edges are sharp, FFT is failing the get the correct profile of the signal.&#xA;I have the same problem if I make a FFT and then the inverse transform, I get this type of profiles, in which there are maximums where there are not supposed to be, and of course the phase profile, or the cosine, it's not smooth at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Wavelet:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a Complex Gaussian Kernel, &quot;cgau1&quot; that is the one that work best.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the figure: Wavelet return and some cuts of the angles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the figure: making some cuts for different scales of the angle I get the followings cosine of the phase profile. Which again they are not smooth or they loose cycles, depending on the scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get a smooth phase profile, or the cosine of the phase, from a time series with high amplitude variability and with sharp edges?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;python or matlab approaches are useful&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v94Zj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v94Zj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18719" LastActivityDate="2017-03-08T09:50:40.920" Title="Get phase information from bursty time series with amplitude variability and sharp edges" Tags="|matlab|signal-analysis|python|phase|smoothing|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="27678" PostTypeId="2" ParentId="27673" CreationDate="2015-12-12T18:26:19.633" Score="1" Body="&lt;p&gt;A pure never changing sinusoidal carrier of a given frequency carries no information.  Changes or modulations to that carrier over time (as in: per second) can carry information.  The maximum rate of information is related to the bandwidth and S/N ratio, not the number of unmodulated carrier cycles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, it may be easier to implement certain modulation schemes with a higher carrier to bandwidth ratio.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-12T18:33:39.483" LastActivityDate="2015-12-12T18:33:39.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27680" PostTypeId="1" AcceptedAnswerId="27684" CreationDate="2015-12-12T18:49:07.683" Score="4" ViewCount="581" Body="&lt;p&gt;Lets assume that a signal $x(n)$ is up-sampled by adding 1 zero between two adjacent samples to form a signal $y(n)$. How does a digital LPF give an oversampled version $z(n)$, with more data points? (As show in the image below) I know that the question might seem stupid but the books that I am using don't really explain that part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/556kl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/556kl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9061" LastEditorUserId="154" LastEditDate="2015-12-14T08:23:14.480" LastActivityDate="2022-08-20T23:07:53.833" Title="What is the role of a LPF in oversampling?" Tags="|sampling|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27681" PostTypeId="2" ParentId="27680" CreationDate="2015-12-12T20:01:47.977" Score="3" Body="&lt;p&gt;A digital low pass FIR filter might change each added (with value zero) sample to become a weighted average of nearby original points.  A suitably weighted average is a close approximation to interpolating along a reconstructed &quot;smooth&quot; (or bandlimited) curve that would pass thru all the original points.  So you end up with more data points along that hypothetical curve.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-12T20:01:47.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27683" PostTypeId="1" AcceptedAnswerId="27685" CreationDate="2015-12-12T20:43:55.197" Score="1" ViewCount="3286" Body="&lt;p&gt;I am trying to implement AM demodulation in Matlab by taking advantage of the fact that in the frequency domain, the spectrum of the modulated signal is shifted by the frequency of the carrier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote code in Matlab that shifts the componenets back and does an inverse Fourier Transform to reconstruct the signal. The code seems to work well enough for a cosine with a cosine envelope, but if I try using a cosine to modulate a sine, I do not get the correct signal, and my Fourier specturm seems to have  both real and imaginary components, which has me buffled: If the Fourier transform should be the spectrum of the envelope just shifted, and the envelope is a sine, shouldn't the transform be pure imaginary?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I attach my code along with a graph that shows my resultsAny help is appericiated in getting to the bottom of this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;&#xA;f = 50; % Message Frequency&#xA;fc = 1000; % Carrier Frequency&#xA;Fs = 5000; % Sample Frequency&#xA;t = (0:(1/Fs):1); &#xA;&#xA;L = length(t);&#xA;&#xA;s = sin(2*pi*f*t); % Message Signal&#xA;&#xA;mod = s.*cos(2*pi*fc*t); % Modulated Signal&#xA;&#xA;% Fourier Transform&#xA;a = fftshift(fft(mod));&#xA;w = Fs*(-(L/2):(L/2-1))/Fs; % Frequency axis&#xA;&#xA;%% Perform complex demodulation:&#xA;&#xA;% Zero all components less than the carrier frequency&#xA;a_zeroes = a;&#xA;a_zeroes(w&amp;lt;fc) = 0;&#xA;&#xA;% Move the spectrum back by the carrier circularly to effectivly shift&#xA;% back:&#xA;a_shifted = circshift(a_zeroes,[0,-fc]);&#xA;% Reflect &#xA;a_reflected = fliplr(a_shifted);&#xA;&#xA;a_demoded = a_shifted;&#xA;a_demoded(1:floor(length(a_demoded)/2)) = a_reflected(1:floor(length(a_demoded)/2));&#xA;&#xA;% Take inverse fft&#xA;demoded = ifft(ifftshift(((a_demoded))));&#xA;&#xA;%% Plot fft and demodulated vs. modulated&#xA;figure;&#xA;subplot(3,1,1); plot(w,real(a),'r','linewidth',4); hold on; plot(w,imag(a),'g','linewidth',2); title('Original FFT'); &#xA;subplot(3,1,2); plot(w,real(a_demoded),'r','linewidth',4); hold on; plot(w,imag(a_demoded),'g','linewidth',2); title('Shifted FFT');&#xA;subplot(3,1,3); plot(t,s); hold on; plot(t, (sqrt(2*pi)).*(demoded)); title('Original Vs. Demodulated');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here you can see the original FFT. I reconstructed the envelope's spectrum, then did an inverse FFT, but the result has less amplitude and is out of phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Red is the real part, Green is the imaginary part.&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/cP6vB.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cP6vB.jpg&quot; alt=&quot;The signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18549" LastActivityDate="2015-12-15T03:01:41.373" Title="Using FFT to demodulated a sine wave envelope with a cosine carrier" Tags="|matlab|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27684" PostTypeId="2" ParentId="27680" CreationDate="2015-12-12T21:57:09.280" Score="3" Body="&lt;p&gt;Effect of an ideal lowpass filter (LPF) on the output of an expander (interpolator) can be described in either of the time or frequency domains.&lt;/p&gt;&#xA;&lt;p&gt;For the frequency-domain approach, the key observation is that the DTFT of the expanded sequence &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; of the middle figure, includes frequency-scaled and shifted copies (a.k.a &lt;strong&gt;images&lt;/strong&gt;) of the original DTFT of the input &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;. The images are centered at &lt;span class=&quot;math-container&quot;&gt;$\omega = 2\pi k/M$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the oversampling factor and &lt;span class=&quot;math-container&quot;&gt;$k=0,1,...,M-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The LPF, whose passband includes only the base copy of the expanded spectrum, removes all the remaining surplus images, and retains only the baseband. This is accomplished in the time-domain by convolving filter's impulse reponse and signal &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt;, to produce &lt;span class=&quot;math-container&quot;&gt;$z[n]$&lt;/span&gt;. The cutoff frequency of the ideal LPF is given by &lt;span class=&quot;math-container&quot;&gt;$\omega_c = \pi/M$&lt;/span&gt;. In your case &lt;span class=&quot;math-container&quot;&gt;$w_c = \pi/2$&lt;/span&gt; radians per sample, and the filter also must have a passpand gain of &lt;span class=&quot;math-container&quot;&gt;$M=2$&lt;/span&gt; if it's to be used as an interpolation filter.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2022-08-20T23:07:53.833" LastActivityDate="2022-08-20T23:07:53.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27685" PostTypeId="2" ParentId="27683" CreationDate="2015-12-12T22:05:03.373" Score="0" Body="&lt;p&gt;As you can see from your &quot;Original FFT&quot; plot, the real part of the FFT has even symmetry and the imaginary part has odd symmetry. When you zero out the lower sidebands, shift, and re-create the negative frequencies, you're forcing the FFT to have even symmetry (look at your &quot;shifted FFT&quot;) plot. The signal you re-created corresponds to a cosine; this is what you get in the &quot;Original vs Demodulated&quot; plot, where the recovered signal is 90 degrees out of phase with the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more common approach to demodulating in the frequency domain is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Zero out the negative frequencies. This is usually accomplished with the Hilbert transform. A signal $s(t)+j\hat s(t)$, where $\hat s(t)$ is the Hilbert transform of $s(t)$, is called an &quot;analytic signal&quot; and its spectrum only exists for positive frequencies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Shift the spectrum back to baseband by multiplying the analytic signal with a complex exponential of frequency equal to $-f_c$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The result of this process is the &quot;complex envelope&quot; which, despite its name, is real in the case of DSB-SC modulation of a single sinusoid.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-12-12T22:05:03.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27686" PostTypeId="1" CreationDate="2015-12-13T04:26:47.560" Score="-1" ViewCount="99" Body="&lt;p&gt;In the paper &lt;a href=&quot;https://www.ee.columbia.edu/~dpwe/papers/Brown91-cqt.pdf&quot; rel=&quot;nofollow&quot;&gt;Calculation of a constant Q spectral transform - J.C.Brown&lt;/a&gt; it is mentioned &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The conventional linear frequency representation given by the discrete Fourier transform gives rise to a constant separation between components for musical sounds consisting of harmonic components&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Since DFT requires the samples to be &lt;a href=&quot;http://www.robots.ox.ac.uk/~sjrob/Teaching/SP/l7.pdf&quot; rel=&quot;nofollow&quot;&gt;equally separated&lt;/a&gt; how would we always get constant separation between the frequencies ?&lt;/p&gt;&#xA;" OwnerUserId="18716" LastActivityDate="2015-12-13T15:59:48.337" Title="Trouble understanding discrete Fourier Transform" Tags="|fourier-transform|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27687" PostTypeId="1" AcceptedAnswerId="27689" CreationDate="2015-12-13T09:14:49.377" Score="1" ViewCount="566" Body="&lt;p&gt;Are those functions only available in Matlab 2015b version or they are included in 2015a version also? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="11432" LastActivityDate="2017-08-09T20:22:02.713" Title="Matlab version rpmordermap and rpmfreqmap" Tags="|matlab|" AnswerCount="2" CommentCount="0" ClosedDate="2015-12-13T18:30:31.640" ContentLicense="CC BY-SA 3.0" />
  <row Id="27688" PostTypeId="1" AcceptedAnswerId="27694" CreationDate="2015-12-13T09:14:58.463" Score="1" ViewCount="122" Body="&lt;p&gt;How to find the percentage of a certain colour in a image accurately? For example  I am actually trying to find the percentage of barnacles in this image over the red part of the hull.&#xA;&lt;a href=&quot;http://thumb1.shutterstock.com/display_pic_with_logo/1498544/150482510/stock-photo-barnacles-barnacles-perched-on-the-red-buoy-150482510.jpg&quot; rel=&quot;nofollow&quot;&gt;http://thumb1.shutterstock.com/display_pic_with_logo/1498544/150482510/stock-photo-barnacles-barnacles-perched-on-the-red-buoy-150482510.jpg&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18704" LastEditorUserId="18704" LastEditDate="2015-12-13T17:04:40.570" LastActivityDate="2015-12-13T17:55:12.823" Title="How to quantify area of interest in an image?" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27689" PostTypeId="2" ParentId="27687" CreationDate="2015-12-13T11:15:27.073" Score="1" Body="&lt;p&gt;At the very bottom of MATLAB manual pages there is always an info about the time when given function was first introduced. For both of &lt;code&gt;rpm*map&lt;/code&gt; functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1IxWS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1IxWS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2015-12-13T11:15:27.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27690" PostTypeId="2" ParentId="27687" CreationDate="2015-12-13T11:57:13.647" Score="-2" Body="&lt;p&gt;No, they are available from R2015b, as answered by @jojek. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meanwhile, especially for older versions, you can find useful alternatives for Order-RPM function, for instance at &lt;a href=&quot;http://fr.mathworks.com/matlabcentral/fileexchange&quot; rel=&quot;nofollow noreferrer&quot;&gt;MatlabCentral&lt;/a&gt; with &lt;a href=&quot;http://fr.mathworks.com/matlabcentral/fileexchange/2251-campbell&quot; rel=&quot;nofollow noreferrer&quot;&gt;Campbell diagrams&lt;/a&gt;, or &lt;a href=&quot;http://fr.mathworks.com/matlabcentral/fileexchange/32639-vold-kalman-order-tracking-code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vold-Kalman order tracking code&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2017-08-09T20:22:02.713" LastActivityDate="2017-08-09T20:22:02.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27691" PostTypeId="1" CreationDate="2015-12-13T13:54:32.950" Score="4" ViewCount="546" Body="&lt;p&gt;I'm recently learning image splicing detection. I've already known image splicing can bring some abrupt changes to an image,which generate the sharp edges.And sharp edges correspond to high frequency. And I want to extract features from images for splicing detection.&#xA;In my opinion,I should use a high-pass filter to enhance the edges,but I've read some papers which mentioned using a low-pass filter for gradient detection techniques applied in discontinuity detection.&#xA;Now I am very bothered with this.Which kind of filters should I use?I would really appreciate if someone can help me!&lt;/p&gt;&#xA;" OwnerUserId="18732" LastEditorUserId="128" LastEditDate="2019-11-17T17:47:24.173" LastActivityDate="2019-11-17T17:47:24.173" Title="Should I Use a High Pass Filter (HPF) or Low Pass Filter (LPF) to Enhance the Features for Image Splicing Detection?" Tags="|image-processing|highpass-filter|detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27693" PostTypeId="2" ParentId="27686" CreationDate="2015-12-13T15:59:48.337" Score="0" Body="&lt;p&gt;My guess is that Ms. Brown is referring to the notion shown in the figure below.  The top panel shows the spectral magnitude of a sawtooth sequence, that repeats five times per second (fundamental freq = 5 Hz), with a linear DFT freq axis. Notice the &quot;constant separation between harmonic components.&quot;  The figure's bottom panel shows the same spec magnitude with a logarithmic freq axis. There the frequency separation between harmonic components is &lt;em&gt;not&lt;/em&gt; constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/r1o1n.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/r1o1n.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-13T15:59:48.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27694" PostTypeId="2" ParentId="27688" CreationDate="2015-12-13T17:43:13.160" Score="3" Body="&lt;p&gt;Given that the size of the barnacles is not expected to be considerably larger than the area of the hull being imaged at a certain shot, you can simply deduce the actual barnacle coverage area by counting how many pixels belong to the hull and then multiplying by a &quot;pixel size&quot; that you can derive by including an item of known length in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key assumption behind this (simple) technique is that the barnacles and the hull exist on the same plane (As if the barnacle layer was a &quot;sticker&quot; on the hull). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, this is not the case because the barnacles are three dimensional and &quot;stick out&quot; of the hull. For the same reason, the angle at which a certain part of the hull is imaged might also introduce an additional error factor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can control for all this by imaging relatively large areas of the hull (i.e. the camera is at a relatively long distance from the hull), taking care for the camera to be pointing vertically to as much of the hull as it is possible (this of course conflicts with the &quot;take a picture at a long distance&quot; and some experimentation will be required). Finally, you will also need to have good control of the lighting of the shot and for this reason, you might have to use a flash bulb (even in day-light) to flood the scene uniformly with light and avoid shadows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having taken the image, you can then convert its colour space from Red, Green, Blue (RGB) to &lt;a href=&quot;https://en.wikipedia.org/wiki/HSL_and_HSV&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hue, Saturation, Brightness (HSB)&lt;/a&gt; and examine the Hue component's histogram for the uniform colour of the hull (here, Red and because of this, relatively easy to pick out). Again, this assumes that the hull is painted using just one colour.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the process in &lt;a href=&quot;https://www.gimp.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gimp&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nzFLz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nzFLz.png&quot; alt=&quot;Barnacle image and pre-processing in Gimp&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The three small B&amp;amp;W images at the botoom of the screenshot are the HSB components respectively. The histogram at the top right is derived from the H component (the first B&amp;amp;W image at the bottom left-hand side of the screenshot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there is a clear peak towards the beginning of the H spectrum corresponding to the red colour (Please see the H band in &lt;a href=&quot;https://en.wikipedia.org/wiki/HSL_and_HSV#/media/File:Hsl-hsv_models.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;this image&lt;/a&gt; to understand how the horizontal axis of the histogram now &quot;corresponds&quot; to hue value).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there was an object of known length on the hull (an iron waterline marking relief for exaple or a pen or a coin) we could derive the pixel size and through this, the actual surface of the whole image. By then counting how many pixels &quot;belong&quot; to the peak we could deduce the actual surface occupied by the barnacles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Image Dimensions: $450 \cdot 229 = 103050$ pixels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pixels corresponding to red: $8494$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Please note:You probably cannot see this because of the size of the image but once you have your histogram in GIMP (Colours-&gt;Info-&gt;Histogram) you can mark an area on the histogram and read how many pixels it describes. This is how this number was derived.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Barnacle coverage area (%): $\frac{103050-8494}{103050} * 100 \approx 91.7\% $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need now is an object of known size to convert this to $cm^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of automating this process, it can be done using a number of techniques and platforms (e.g. Python, Octave, etc) but for a more accurate answer reagrding those, a little bit more detail would be required regarding the application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2015-12-13T17:55:12.823" LastActivityDate="2015-12-13T17:55:12.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27695" PostTypeId="2" ParentId="27691" CreationDate="2015-12-13T18:21:37.927" Score="2" Body="&lt;p&gt;Since you're after a filter which emphasizes abrupt changes you should use High Pass Filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue is you'd be also sensitive to noise.&lt;br&gt;&#xA;Hence one way to do it is to apply High Pass Filter on slightly blurred image (Which actually results in a Band Pass Filter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One easy choice would be using the Gradient of The Gaussian Filter.&lt;br&gt;&#xA;Why is it?&lt;br&gt;&#xA;Because it is easy to calculate (Analytically) and efficient to implement because of its separability property of the filter.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2015-12-13T18:21:37.927" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27697" PostTypeId="1" CreationDate="2015-12-13T21:13:10.713" Score="0" ViewCount="176" Body="&lt;p&gt;I am using Digital Signal Processing Principles, Algorithms, and Applications 4th edition and by Proakis. Here is what I don't understand&lt;/p&gt;&#xA;&#xA;&lt;p&gt;say the signal &lt;span class=&quot;math-container&quot;&gt;$x_a(t)$&lt;/span&gt; has its Fourier Transform &lt;span class=&quot;math-container&quot;&gt;$X_a(F)$&lt;/span&gt; and digital signal &lt;span class=&quot;math-container&quot;&gt;$x(n)=x_a(nT)$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$x_a(t)$&lt;/span&gt; after sampling with sampling frequency &lt;span class=&quot;math-container&quot;&gt;$F_s$&lt;/span&gt;  has its DTFT &lt;span class=&quot;math-container&quot;&gt;$X(f)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x_a(t)=\int^{\infty}_{-\infty}X_a(F)\,e^{j2\pi Ft}dF\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$x(n)=x_a(nT)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$nT=\dfrac{n}{F_s}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x(n)=x_a(nT)=\int^{\infty}_{-\infty}X_a(F)e^{j2\pi nF/F_s}dF\tag{2}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using inverse DTFT for &lt;span class=&quot;math-container&quot;&gt;$x(n)$&lt;/span&gt; then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\int^{\frac12}_{-\frac12}X(f)e^{j2\pi nf}df=\int^{\infty}_{-\infty}X_a(F)e^{j2\pi nF/F_s}dF\tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$f=\dfrac{F}{F_s}$&lt;/span&gt; then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\int^{\frac12}_{-\frac12}X(f)e^{j2\pi nf}df=\frac{1}{F_s}\int^{\frac {F_s}{2}}_{-{\frac {F_s}{2}}}X(F)e^{j2\pi nF/F_s}dF\tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is what the book says and it use that to explain the reconstruction process in theory. However isn't it will be like this according to substitution in integral&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\int^{\frac12}_{-\frac12}X(f)e^{j2\pi nf}df = \frac{1}{F_s} \int^{\frac {F_s}{2}}_{-{\frac {F_s}{2}}}X\left(\frac{F}{F_s}\right)e^{j2\pi nF/F_s}dF\tag{5}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this should be in Math Section but since it is about Digital Signal so I post it here.&lt;/p&gt;&#xA;" OwnerUserId="18328" LastEditorUserId="47251" LastEditDate="2020-02-10T18:55:14.297" LastActivityDate="2020-02-10T18:55:14.297" Title="$\int^{\frac12}_{-\frac12}X(f)e^{j2\pi nf}df=\frac{1}{F_s}\int^{\frac {F_s}{2}}_{-{\frac {F_s}{2}}}X(F)e^{j2\pi nF/F_s}dF$ for $f=\frac{F}{F_s}$?" Tags="|discrete-signals|fourier-transform|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27699" PostTypeId="2" ParentId="27680" CreationDate="2015-12-13T23:36:14.507" Score="5" Body="&lt;p&gt;@user29568: Your question is &lt;em&gt;very&lt;/em&gt; far from stupid. It's a darned good question. To see why time-domain &quot;zero stuffing&quot; generates the additional spectral images, that must be filtered out as described by Fat32, you're welcome to see my explanation of this effect at: &lt;a href=&quot;http://www.dsprelated.com/showarticle/761.php&quot; rel=&quot;noreferrer&quot;&gt;http://www.dsprelated.com/showarticle/761.php&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-13T23:36:14.507" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27701" PostTypeId="2" ParentId="27676" CreationDate="2015-12-14T00:13:07.157" Score="1" Body="&lt;p&gt;I recently responded to &lt;a href=&quot;https://stackoverflow.com/questions/34235530/python-how-to-get-high-and-low-envelope-of-a-signal/&quot;&gt;a question elsewhere&lt;/a&gt; that shared some similarity with this one, so parts of that are re-used here but you can refer to it for the general idea anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since most of the information you are trying to capture exists in the phase spectra, you don't really &quot;care&quot; about the amplitude information as long as it doesn't produce any distortions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I would like to clarify that my response at this point is focusing on removing the amplitude modulation...carefully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main idea is rather simple: Detect the local maxima and reshape each pulse proportionally so that the amplitude modulation vanishes but the timing (and shape) of the pulses is preserved. The following code snippet contains a lot of inline comments on how this is done. It is in Python but it's not incredibly hard to port it to another language (e.g. MATLAB (?)).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pandas import DataFrame&#xA;from scipy.interpolate import interp1d&#xA;import pylab&#xA;import numpy&#xA;&#xA;def getEnvelopeModels(aTimeSeries):   &#xA;    '''Detects peaks and returns a suitable interpolation model&#xA;    Parameters:&#xA;        aTimeSeries: An Nx2 DataFrame that contains the timings and the actual samples in respective columns (col 0, col 1)&#xA;    '''        &#xA;    #Detect peaks and mark their location&#xA;    #Get the derivative of pulse train to get rid of &quot;flat tops&quot;&#xA;    df = numpy.diff(aTimeSeries[1])    &#xA;    #Append first data point&#xA;    res = [(aTimeSeries[0].iloc[0],aTimeSeries[1].iloc[0])]&#xA;    #Simple threshold detector on the derivative to recover peaks and their location&#xA;    for k in xrange(0,len(df)):&#xA;        if df[k]&amp;gt;10:&#xA;            res.append((Q[0].iloc[k+1],Q[1].iloc[k+1]))&#xA;    #Append last data point&#xA;    res.append((aTimeSeries[0].iloc[-1],aTimeSeries[1].iloc[-1]))&#xA;    #Convert to array&#xA;    res = numpy.array(res)               &#xA;    #Fit a model, here it is a 'zero' model which basically maintains&#xA;    #the y value until the next (x,y) interval. This is how the pulse width is preserved.&#xA;    u_p = interp1d(res[:,0],res[:,1], kind = 'zero',bounds_error = False, fill_value=0.0)&#xA;    #Return the model and the peak data&#xA;    return (u_p,res)&#xA;&#xA;&#xA;#This &quot;if&quot; is required here so that Python doesn't execute&#xA;#the whole script even one attempts to &quot;borrow&quot; the getEnvelopeModels&#xA;#from another script with a simple 'from myFile import getEnvelopeModels'&#xA;if __name__ == &quot;__main__&quot;:&#xA;    #Load the dataset&#xA;    #This is the one that was uploaded earlier to pastebin&#xA;    Q = DataFrame.from_csv(&quot;file.csv&quot;, index_col=False, header=None)&#xA;&#xA;    #Clamp min to zero&#xA;    #Q[1] = Q[1]-min(Q[1]);&#xA;&#xA;    #Grab the peaks' model&#xA;    F = getEnvelopeModels(Q)&#xA;&#xA;    #Evaluate model to get vector&#xA;    u = numpy.array(map(F[0],Q[0]))&#xA;&#xA;    #Workout the scaling coefficient by finding the &#xA;    # 'weakest' pulse and scaling everything to that one&#xA;    # The weakest pulse was chosen to avoid distorting the limited&#xA;    # range of the weak pulses by &quot;stretching&quot; them to higher amplitudes.&#xA;    coef = numpy.min(F[1][1:,1]) / numpy.max(F[1][1:,1])&#xA;&#xA;    #Modify the evaluated model to workout a scaling vector&#xA;    u = coef/(u/numpy.max(u));&#xA;&#xA;    #Plot everything&#xA;    #Original signal&#xA;    pylab.plot(Q[0],Q[1]);&#xA;    pylab.xlabel('x');&#xA;    pylab.xlabel('y');&#xA;    pylab.title('Original');    &#xA;    pylab.grid(True)    &#xA;    pylab.figure();&#xA;    #Scaled signal&#xA;    pylab.plot(Q[0],Q[1]*u);&#xA;    pylab.xlabel('x');&#xA;    pylab.xlabel('y');&#xA;    pylab.title('Scaled');        &#xA;    pylab.grid(True)&#xA;    pylab.figure();&#xA;    #Scaling coefficient&#xA;    pylab.plot(Q[0],u,'r');&#xA;    pylab.xlabel('x');&#xA;    pylab.xlabel('y');&#xA;    pylab.title('Scaling Vector');        &#xA;    pylab.grid(True)&#xA;    pylab.show()&#xA;&#xA;    #Apply scaling to the original DataFrame&#xA;    Q[1]=Q[1]*u;&#xA;    #Save the DataFrame&#xA;    Q.to_csv('processed.csv',sep=' ',index=False,header=None)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The plots are as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original Signal&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EnJh5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EnJh5.png&quot; alt=&quot;Original&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Scaling Vector&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ZQdEi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZQdEi.png&quot; alt=&quot;Scaling Coeficient&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Processed Signal&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zuJxd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zuJxd.png&quot; alt=&quot;Without Amplitude&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, &lt;code&gt;processed.csv&lt;/code&gt; can be downloaded &lt;a href=&quot;http://pastebin.com/mycPRfMW&quot; rel=&quot;nofollow noreferrer&quot;&gt;from here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a tiny little problem here with the signal having a floating minimum. I tried to clamp it to zero by subtracting the &lt;code&gt;min&lt;/code&gt; from the vector (it is commented in the code at the moment) but it requires more work than this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, although the local maxima envelope effect was diminished there is still the local minima which might still carry some effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not want to do anything more drastic to clamp the minima to zero before checking that this would be alright (?). It would basically take the same &quot;scaling&quot; idea but now applied to the &quot;lower part&quot; of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-12-14T00:13:07.157" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27703" PostTypeId="1" CreationDate="2015-12-14T01:33:38.133" Score="5" ViewCount="2230" Body="&lt;p&gt;I'm trying to replicate the &quot;audio spectrum&quot; effect from Adobe After Effects. An example can be seen &lt;a href=&quot;https://www.youtube.com/watch?v=Os2F-atqkJk&quot; rel=&quot;nofollow noreferrer&quot;&gt;in this video&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NZeH0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NZeH0.png&quot; alt=&quot;(screenshot of video)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, it has to be some variant of a fourier transform, but I've tried taking the fft of an audio sample in realtime and my implementation looks more like a big block of bars:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SUoU5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SUoU5.png&quot; alt=&quot;(big block of bars)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine some kind of intermediate function is being applied to the fft, but I can't really figure out what it might be.&lt;/p&gt;&#xA;" OwnerUserId="18737" LastEditorUserId="4655" LastEditDate="2015-12-14T03:31:55.477" LastActivityDate="2023-05-29T12:38:00.240" Title="How does Adobe After Effects generate its &quot;audio spectrum&quot; effect?" Tags="|audio|fourier-transform|music|visualization|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27704" PostTypeId="1" CreationDate="2015-12-14T01:56:27.277" Score="1" ViewCount="131" Body="&lt;p&gt;$$h(t) = \frac{1}{1 + t^2}$$ and is it IIR or FIR filter. I tried finding the Laplace transform of this filter to get the data flow diagram with 5 taps and T=2s, however, I am unable to solve this. Probably the solution is simpler than I tried, however, being novice in DSP, I am unable to solve the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank You.&lt;/p&gt;&#xA;" OwnerUserId="18738" LastEditorUserId="8202" LastEditDate="2015-12-14T08:50:46.163" LastActivityDate="2015-12-14T20:49:17.280" Title="Is the below filter linear phase" Tags="|discrete-signals|filter-design|infinite-impulse-response|z-transform|finite-impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27705" PostTypeId="1" CreationDate="2015-12-14T02:16:10.907" Score="5" ViewCount="1302" Body="&lt;p&gt;Say I want to use Kalman filters for predicting the price of items at a supermarket. I have a Kalman filter for each item (apple/beef/brooms/etc). I notice that some items are sort of related, like apple with orange, beef with pork. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how can I make these Kalman filters interact with each other? For example let's say I get observations about the price of beef and they show that they are going up. I want to tell the Kalman filter for pork somehow that it should also update. How can I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any literature or examples of this usage will be greatly appreciated, thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am actually trying to ask this question in the general sense, but I wanted to frame the problem in a way that would be simpler for others to understand. So I understand that the Kalman filter uses observations to update its state. Suppose I want to incorporate observations for some Kalman filter into another, is there an accepted way of 'transforming' these observations? Or is it more of an art?&lt;/p&gt;&#xA;" OwnerUserId="18739" LastEditorUserId="18739" LastEditDate="2015-12-14T21:19:43.130" LastActivityDate="2020-10-11T17:45:30.013" Title="Combining Kalman Filters" Tags="|kalman-filters|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27706" PostTypeId="2" ParentId="27703" CreationDate="2015-12-14T02:48:48.800" Score="6" Body="&lt;p&gt;I've had a try at reproducing the effect, and I think these are some of the key elements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You need a &lt;strong&gt;high-resolution FFT&lt;/strong&gt; (large size; windows overlapping in time so that this doesn't come at the expense of frame rate) and to &lt;strong&gt;discard all but the lowest-frequency bins&lt;/strong&gt;. You can tell this from the video because there are only rarely any harmonics visible and then only a second harmonic. The music you're hearing contains many more harmonics, so the display must be showing only the lower frequencies, not all the way up to $f_s/2$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You need to &lt;strong&gt;dynamically adjust the vertical offset&lt;/strong&gt; so that only the significant peaks are shown, hiding the broad-spectrum sounds whether they are continuous 'noise' or sharp drumbeats. What I did was take the &lt;em&gt;median&lt;/em&gt; of the current frame's data and subtract it (as well as a manually set additional term), but there may be better strategies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If still needed once you've discarded the high-frequency components, &lt;strong&gt;apply a frequency-varying offset&lt;/strong&gt; so that the levels are even across the spectrum (rather than decreasing with frequency as your picture does). Whether this is actually needed depends on the frequency content of your input signal — thus the frequency response of the microphone it was recorded with, and so on.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The nice rounded rather than spiky peaks should be apparent once you've zoomed in on the low frequencies, but they are also dependent on your choice of window function. &lt;strong&gt;Use a window function with a large &lt;em&gt;main lobe&lt;/em&gt;.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fft_length = 32768&#xA;display_length = 1024&#xA;freq_varying_offset = fft_length * 0.000005&#xA;for frame from 1 to ...:&#xA;    let start = frame / video_frame_rate * audio_sample_rate&#xA;    let samples = audio_data.subarray(start, start + fft_length)&#xA;&#xA;    let buf = log_fft(window(samples), fft_length).subarray(0, display_length)&#xA;    let offset = fixed_offset - median(buf)&#xA;    for i from 0 to buf.length:&#xA;        buf[i] = buf[i] - offset + i * freq_varying_offset&#xA;&#xA;    // now draw the bars on the video frame using the contents of buf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4655" LastEditorUserId="4655" LastEditDate="2015-12-14T03:10:18.433" LastActivityDate="2015-12-14T03:10:18.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27708" PostTypeId="1" CreationDate="2015-12-14T04:54:03.197" Score="2" ViewCount="399" Body="&lt;p&gt;I am working on CS. I know that as coherence decreases (or incoherence increases) compressed sensing results improve. I know how to calculate the coherence, but I can't find an exact equation between incoherence and compressed sensing. I would like to know the equation relating coherence and CS with lower and higher limits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="17018" LastEditorUserId="128" LastEditDate="2019-06-03T04:31:17.323" LastActivityDate="2019-06-03T04:31:17.323" Title="Relation Between Compressed Sensing and Incoherence" Tags="|discrete-signals|compressive-sensing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27709" PostTypeId="1" CreationDate="2015-12-14T05:18:59.473" Score="2" ViewCount="604" Body="&lt;p&gt;I've already know the low frequency represents a smooth area,and most part of an image doesn't have abrupt change which can explain natural image has more low frequency. But I just can't understand what does the term 'energy' mean.I would really appreciate if some can help me!&lt;/p&gt;&#xA;" OwnerUserId="18732" LastActivityDate="2016-05-16T12:20:48.867" Title="How to understand the energy centralizes at low frequency after making DCT on an image?What does energy mean?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27711" PostTypeId="2" ParentId="27704" CreationDate="2015-12-14T08:24:57.660" Score="1" Body="&lt;p&gt;If&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t)=\frac{1}{1+t^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;denotes the filter's impulse response, then the filter is an infinite impulse response filter, simply because $h(t)$ has infinite support, i.e. it doesn't vanish anywhere (other than for $t\rightarrow \infty$). Note that if the definition $(1)$ of $h(t)$ is valid for all $t$, then the filter is not causal because $h(t)=0$ for $t&amp;lt;0$ doesn't hold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the impulse response is real-valued and it satisfies $h(t)=h(-t)$, its Fourier transform must be real-valued (and symmetrical). Since the Fourier transform is real-valued, the filter's phase is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sample that impulse response using $5$ taps at times $t_{-2}=-2T$, $t_{-1}=-T$, $t_0=0$, $t_1=T$, $t_2=2T$, you get an FIR filter, but the zero-phase property remains unchanged due to the symmetry of the filter coefficients. For implementation, the filter impulse response needs to be shifted by two samples to make it causal. This causes a delay of two samples, which changes the filter's phase $\phi(\omega)$ from zero to a linear phase $\phi(\omega)=-2\omega$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-14T11:08:17.517" LastActivityDate="2015-12-14T11:08:17.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27712" PostTypeId="2" ParentId="27709" CreationDate="2015-12-14T12:16:10.353" Score="1" Body="&lt;p&gt;It's just a fancy way of saying &quot;amplitude&quot; or &quot;signal strength&quot;.  The DCT splits the original signal into a bunch of outputs, each of which gives the amplitude for a particular frequency.  Add them all back together again, through an inverse DCT, and you get the original signal back.&lt;/p&gt;&#xA;" OwnerUserId="11040" LastActivityDate="2015-12-14T12:16:10.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27713" PostTypeId="2" ParentId="27709" CreationDate="2015-12-14T15:42:24.913" Score="1" Body="&lt;p&gt;For a real discrete time signal x[n], its energy is defined as $E_x = \sum{x^2[n]} $. And for a given individual sample $x[n_0]$, its contribution to the total signal energy is therefore $x^2[n_0]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1D-DCT takes in a signal x[n] of length N and produces a same sized frequency domain signal Q[k] (Spectral Coefficients) with a set of N frequencies in the range of 0 to $\pi$ (discrete time frequencies) represented by the sequence samples Q[0] to Q[N-1]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the total energy contained in the spectral coefficients Q[k]: $Eq = {\sum}_{n=0}^{n=N-1}{Q^2[n]}$ and its distribution among spectral coefficients of Q[n]. It can be shown that for typical natural images the total energy is mostly concentrated in those inital samples of q[n] which correspond to low frequency components of the input signal x[n], the remaining spectral coefficients that indicate high frequencies have much smaller amplitudes and hence their contribution to signal energy is insignificant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inherent reason why most of the signal x[n] energy is contained in those low freqency spectral components of a typical image is understood from the observation that a typical small 8x8 block of an image will mostly contain very little change from its beginning to end unless it includes a sharp edge or high frequency noise. Hence a slowly varying signal means low frequency signal.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-05-16T12:20:48.867" LastActivityDate="2016-05-16T12:20:48.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27714" PostTypeId="2" ParentId="26395" CreationDate="2015-12-14T16:29:37.983" Score="1" Body="&lt;p&gt;The short answer is no. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically in Compressive Sensing, the reconstruction error is defined in terms of mean squared error (MSE):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ MSE = \frac{|| \hat{x} - x ||_2^2}{||x||_2^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $$ || y  ||_2^2 = \sum_{i=0}^{n-1} y_i^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a sparse signal this will simply be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$||y_{sparse}||_2^2 = \sum_{j \in S_{sparse}} y_i^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $S_{sparse}$ is the set of non-zero coefficients in the vector $y$. Note that this is independent of the indices $j$ - a permutation will give the same MSE.&lt;/p&gt;&#xA;" OwnerUserId="805" LastActivityDate="2015-12-14T16:29:37.983" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27715" PostTypeId="1" AcceptedAnswerId="27716" CreationDate="2015-12-14T17:08:58.330" Score="4" ViewCount="675" Body="&lt;p&gt;I have a rtlsdr dongle which apparently has a max sample rate of about 2.4 MHz.  I'm wondering how it's possible to capture signals at say 900 MHz with this device.  Doesn't the sample rate need to be 2x900 or 1.8 GHz to capture without aliasing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry, I'm so new to this stuff!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="18745" LastActivityDate="2015-12-14T17:46:52.337" Title="rtlsdr sample rates and nyquist rate" Tags="|signal-analysis|sampling|downsampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27716" PostTypeId="2" ParentId="27715" CreationDate="2015-12-14T17:46:52.337" Score="5" Body="&lt;p&gt;The RTL-SDR, as most software-defined radios, has an analog front-end that includes a tunable mixer. This mixer can down-convert the frequency band you're interested in to baseband, where it is sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's say that you want to receive a signal centered around 900 MHz and with bandwidth $2B$ -- that is, the band covers the range from $900-B$ to $900+B$ MHz. You tune the mixer to 900 MHz and (after filtering) you end up with a signal centered around DC, covering the band from $-B$ to $B$ MHz. In general, this is a quadrature signal, that can be sampled at rate $2B$ complex samples per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you see, with this setup, the sampling rate of the device only limits the &lt;em&gt;bandwidth&lt;/em&gt; it can capture, without regard for the value of the carrier frequency (within the limits of the filters and mixers, of course).&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-12-14T17:46:52.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27717" PostTypeId="1" AcceptedAnswerId="27719" CreationDate="2015-12-14T17:58:48.963" Score="0" ViewCount="538" Body="&lt;p&gt;I studying DSP and trying to find the limitation of 'teaching' a software to emulate a musical instrument by sampling its notes at different velocities and building an LTI system for simulating it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that feasible? is that even LTI? is that limited to certain instruments only? what are the problems I'm about to encounter trying to do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="13426" LastActivityDate="2015-12-14T18:29:34.730" Title="Simulating musical instruments using their impulse response" Tags="|sound|impulse-response|music|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27718" PostTypeId="1" CreationDate="2015-12-14T18:17:12.060" Score="1" ViewCount="57" Body="&lt;p&gt;I'm very new to this stuff, so please excuse the dumb sounding terminology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to capture the data from my elster smart hydro meter. How can I find its frequency (I know its between 902 and 928 MHz and I think there is frequency hopping)?  I have an rtlsdr dongle (2 MHz sample rate) and gnuradio and a raspberrypi.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One idea I had was to listen for an hour on bands:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Listen on 902 for an hour&#xA;Listen on 904 for an hour &#xA;...&#xA;Listen on 928 for an hour&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, I would have to record only when a &quot;blip&quot; in frequency or amplitude happens.  This way, I would have a few blips and I could then try to analyze them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this sound sensible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps there is a device that helps with this?&lt;/p&gt;&#xA;" OwnerUserId="18745" LastActivityDate="2015-12-14T18:17:12.060" Title="Find unknown broadcast frequency" Tags="|frequency-spectrum|frequency|sampling|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27719" PostTypeId="2" ParentId="27717" CreationDate="2015-12-14T18:29:34.730" Score="3" Body="&lt;p&gt;there are a lotta people doing research regarding music synthesis and DSP.  yes you can sample notes and different key velocities and play them back with different MIDI velocity parameters.  if you wanted to somehow interpolate between a note played at $mf$ to $f$ and on to $ff$ and $fff$urther, you would need to find a way to phase align the waveforms.  IMO the only decent analytical way to do that in the time domain is &lt;a href=&quot;http://www.musicdsp.org/files/Wavetable-101.pdf&quot; rel=&quot;nofollow&quot;&gt;wavetable synthesis&lt;/a&gt; where the wavetables can be lined up (or it's frequency domain, it's called &lt;a href=&quot;https://en.wikipedia.org/wiki/Additive_synthesis&quot; rel=&quot;nofollow&quot;&gt;additive synthesis&lt;/a&gt;) - additive synthesis is more general, wavetable requires the overtones of the note to be mostly harmonic.  doing this stuff right is not particularly easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on the other hand, since you brought up &quot;impulse response&quot;, there are folks who do &lt;a href=&quot;https://en.wikipedia.org/wiki/Digital_waveguide_synthesis&quot; rel=&quot;nofollow&quot;&gt;physical modeling of musical instruments&lt;/a&gt;, where they model the instrument as a form of resonant LTI filter and they separate the impulse response of the LTI filter from the driving function, which is not an impulse but something more.  then, for different key velocity hits, they have different driving functions but the same LTI impulse response.  sometimes it's called &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/Commuted_Synthesis.html&quot; rel=&quot;nofollow&quot;&gt;commutated synthesis&lt;/a&gt; or &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pdf/svd95.pdf&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/pdf/svd95.pdf&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-12-14T18:29:34.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27720" PostTypeId="2" ParentId="27708" CreationDate="2015-12-14T20:26:06.080" Score="3" Body="&lt;p&gt;The coherence can be used to bound the number of measurements $m$ required for successful reconstruction as seen for example in equation (6) in &lt;a href=&quot;http://dsp.rice.edu/files/cs/CSintro.pdf&quot; rel=&quot;nofollow&quot;&gt;Candès &amp;amp; Wakin 2008&lt;/a&gt;:&#xA;$$m ≥ C \cdot \mu^2(\Phi, \Psi)\cdot S  \cdot \log n$$&#xA;where $C$ is some positive constant, $S$ is the sparsity, and $n$ is the size of the sparse signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One problem, however, is that this is not a very sharp bound. &lt;a href=&quot;https://people.maths.ox.ac.uk/tanner/papers/DoTa_PUT.pdf#page=8&quot; rel=&quot;nofollow&quot;&gt;Donoho &amp;amp; Tanner 2010&lt;/a&gt;, for example, describe some brief history of this in Section X of the linked paper. I have not followed the development on this aspect of compressed sensing for a long time, so I do not know if there are newer or better explanations. So, in my opinion, the best you can use the coherence for in practice is as a rule of thumb: the less coherence, the better.&lt;/p&gt;&#xA;" OwnerUserId="1464" LastEditorUserId="1464" LastEditDate="2015-12-14T21:37:25.027" LastActivityDate="2015-12-14T21:37:25.027" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27721" PostTypeId="2" ParentId="27704" CreationDate="2015-12-14T20:49:17.280" Score="0" Body="&lt;p&gt;We can't answer your question definitively because we don't know the nature of your $t$ variable. In the world of signal processing the symbol $t$ typically represents &lt;em&gt;continuous time&lt;/em&gt; (measured in seconds). So if your $t$ represents continuous time, and $h(t)$ is a filter's impulse response, then your filter is a continuous (analog) filter. In this case the question of &quot;IIR or FIR?&quot; has no meaning. (You mentioned the Laplace transform and that also implies your filter may be a continuous filter.) Did the person who gave you this problem describe the nature of your filter (analog or digital) and variable $t$? If so, please share that information with us.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if your $t$ variable is a sequence of numbers representing instants in time then that changes the whole scenario here. In that case we're now talking about a digital filter. If $t$ comprises discrete values and you can tell us the range of all possible values of $t$ then we can answer you question. You have what looks like variables $T$ and $s$ but, sadly, you expect us to read your mind to figure out what they represent. If you help us by defining your variables then we can help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The full story on how and why digital FIR filters can have linear phase can be found at: &lt;a href=&quot;http://www.dsprelated.com/showarticle/808.php&quot; rel=&quot;nofollow&quot;&gt;http://www.dsprelated.com/showarticle/808.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-14T20:49:17.280" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27722" PostTypeId="2" ParentId="27697" CreationDate="2015-12-14T21:37:55.940" Score="1" Body="&lt;p&gt;You are absolutely right. With $f=F/F_s$ you obtain the equality&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int_{\frac12}^{\frac12}X(f)e^{j2\pi nf}df=\frac{1}{F_s}\int_{-F_s/2}^{F_s/2}X\left(\frac{F}{F_s}\right)e^{j2\pi nF/F_s}dF\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is also what I find in my third edition of the book (the right-hand side of $(1)$ equals the left-hand side of Eq. $(4.2.81)$ in my edition).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-14T21:37:55.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27723" PostTypeId="1" CreationDate="2015-12-14T21:40:14.320" Score="2" ViewCount="104" Body="&lt;p&gt;Some time ago, I seem to recall hearing or reading of an audio experiment where the very short initial transients of one musical instrument (A) were spliced in front of the much longer steady state or sustain sounds of another instrument (B).  Human listeners in this experiment, upon hearing these composite sounds, were reported to recognize or hear the first instrument (A) with some reliability even though the initial transient or attack was only a very short portion of the entire note played.  (Anyone have a reference to this research?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the above is correct, what type of signal processing analysis of just the initial transient of a note from a musical instrument, &lt;strong&gt;before&lt;/strong&gt; steady-state periodicity or stationarity, might be used to try to do musical instrument recognition or separation?&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-14T21:40:14.320" Title="Audio transient characterization of instrumental music" Tags="|signal-analysis|music|waveform-similarity|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27724" PostTypeId="2" ParentId="27671" CreationDate="2015-12-14T22:29:27.553" Score="0" Body="&lt;p&gt;&lt;strong&gt;Question 1&lt;/strong&gt;: I think you want to investigate &lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/centfrq.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;centfreq&lt;/a&gt; &amp;amp;  &lt;a href=&quot;http://www.mathworks.com/help/wavelet/ref/scal2frq.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;scal2freq&lt;/a&gt; (Scale to frequency):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;FREQ = &lt;strong&gt;centfrq&lt;/strong&gt;('wname') returns the center frequency in hertz of the&#xA;  wavelet function&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;F = &lt;strong&gt;scal2frq&lt;/strong&gt;(A,'wname',DELTA) returns the pseudo-frequencies&#xA;  corresponding to the scales given by A and the wavelet function&#xA;  'wname' (see wavefun for more information) and the sampling period&#xA;  DELTA.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The intuition that I use is to think about your question is: The wavelet transform is a hierarchical (tree-like) decomposition of an input signal. I would not say it is in the &quot;time-domain&quot; as is commonly understood. I think of the DWT output via the duality: &lt;strong&gt;&lt;em&gt;Wavelets &amp;lt;---&gt; Filterbanks&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine a set of 8 bandpass filters tuned to filter different ranges from low to high on the frequency spectrum. You know which frequency ranges correspond to which filters, so you know how much signal lives in each of the 8 frequency ranges based on the bandpass filter output. That's a basic frequency analysis. You wouldn't need to compute an FFT at this point. And with the successive QMF filtering, then decimation of your signal at each level, your DWT coefficients may only be one-sample (or have a very coarse resolution), so an FFT wouldn't make any sense.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a good explanation @ &lt;a href=&quot;https://math.stackexchange.com/questions/28581/which-time-frequency-coefficients-does-the-wavelet-transform-compute&quot;&gt;https://math.stackexchange.com/questions/28581/which-time-frequency-coefficients-does-the-wavelet-transform-compute&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2&lt;/strong&gt;: A scalogram (&lt;a href=&quot;https://dsp.stackexchange.com/questions/7626/scalogram-and-related-nomenclatures-for-dwt&quot;&gt;Scalogram (and related nomenclatures) for DWT?&lt;/a&gt; ) is good for visualizing your transformed signal, but I think it would be overkill just to compute which frequency range your wavelet coefficients correspond to. &lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2015-12-14T22:35:38.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27725" PostTypeId="2" ParentId="27361" CreationDate="2015-12-14T23:16:45.303" Score="0" Body="&lt;ul&gt;&#xA;&lt;li&gt;Definitely don't use the whole file as a single frame. &lt;/li&gt;&#xA;&lt;li&gt;As Alexander says, you want to use 25 millisecond frames with a 10 second overlap/hop (the vocal tract is stationary over this duration, so this is a common choice in speech recognition).&lt;/li&gt;&#xA;&lt;li&gt;Each frame of audio makes a certain number of MFCCs (say 20). This number is constant for each frame of audio. But a file of different duration will, of course, have a different number of frames (and thus MFCCs). &lt;strong&gt;&lt;em&gt;The size of your features (20) should always be uniform, but the number of observations (how many frames) you get from each file usually will not be, and that is okay.&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Once you have extracted these acoustic-features, you need a machine learning algorithm that can &quot;learn&quot; what MFCC features are characteristic to a particular speaker. This is a very broad topic, but I can point to you this project: &lt;a href=&quot;https://github.com/ppwwyyxx/speaker-recognition&quot; rel=&quot;nofollow&quot;&gt;https://github.com/ppwwyyxx/speaker-recognition&lt;/a&gt; where you can see some of the machine learning algorithms used.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-12-14T23:16:45.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27726" PostTypeId="1" CreationDate="2015-12-14T23:30:00.967" Score="0" ViewCount="2079" Body="&lt;p&gt;It is well-known that convolution in real space corresponds to multiplication in the reciprocal space. Yet, I obtain different results using both methods in the case that I'm going to present. I am sure that I made a mistake, but I really can't see where.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Python code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;import numpy as np&#xA;from matplotlib import pyplot as plt&#xA;&#xA;# Create a signal: a gaussian&#xA;sig = np.exp(-(np.linspace(-10, 10, 1024))**2)&#xA;# Calculate its FFT transform&#xA;F_SIG = np.fft.fft(sig)&#xA;&#xA;# Create an FIR filter from its transform&#xA;F_KER = np.empty_like(sig, dtype=np.complex128)&#xA;F_KER[:len(F_KER)//2] = np.exp(-1j*np.pi/3)&#xA;F_KER[len(F_KER)//2:] = np.exp(1j*np.pi/3)&#xA;F_KER[[0, len(F_KER)//2]] = np.cos(np.pi/3)&#xA;# Get its inverse FFT transform&#xA;kern = np.fft.ifft(F_KER) # is actually pure real value&#xA;print(&quot;Max real value:\t&quot;, np.abs(kern.real).max())&#xA;print(&quot;Max imaginary value:\t&quot;, np.abs(kern.imag).max())&#xA;print(&quot;Therefore 'kern' can be considered pure real.&quot;)&#xA;kern = kern.real&#xA;&#xA;# From math books, &#xA;# multiplication in Fourier/Frequency space &amp;lt;-&amp;gt; convolution in real space&#xA;multFFT_sig = np.fft.ifft(F_SIG*F_KER).real # Again, pure real, can be checked&#xA;conv_sig = np.convolve(sig, kern, &quot;full&quot;)&#xA;&#xA;&#xA;# Plot both of them&#xA;plt.figure()&#xA;plt.xlim([0,1024])&#xA;plt.title(&quot;Convolution vs. FFT multiply&quot;)&#xA;plt.plot(multFFT_sig)&#xA;plt.plot(conv_sig)&#xA;&#xA;&#xA;# Padding problem? Circular convolution problem?&#xA;plt.figure()&#xA;plt.xlim([0,1024])&#xA;plt.title(&quot;Original signals&quot;)&#xA;plt.plot(sig)&#xA;plt.plot(kern)&#xA;plt.legend([&quot;Orig. signal&quot;, &quot;Conv. kernel&quot;])&#xA;&#xA;plt.figure()&#xA;plt.xlim([0,2048])&#xA;plt.title(&quot;Zero-padded signals&quot;)&#xA;p_sig = np.append([0]*512, np.append(sig, [0]*512))&#xA;p_kern = np.append(kern[:512], np.append([0]*1024, kern[512:]))&#xA;plt.plot(p_sig)&#xA;plt.plot(p_kern)&#xA;plt.legend([&quot;pad. signal&quot;, &quot;pad. conv. kernel&quot;])&#xA;&#xA;# Calculate convolution padded terms&#xA;plt.figure()&#xA;plt.xlim([0,2048])&#xA;plt.title(&quot;Padded convolution vs. FFT multiply&quot;)&#xA;p_F_SIG = np.fft.fft(p_sig)&#xA;p_F_KER = np.fft.fft(p_kern)&#xA;p_multFFT_sig = np.fft.ifft(p_F_SIG*p_F_KER).real # Again, pure real, can be checked&#xA;p_conv_sig = np.convolve(p_sig, p_kern, &quot;full&quot;)&#xA;plt.plot(p_multFFT_sig)&#xA;plt.plot(p_conv_sig)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Max real value:  0.551327165647&#xA;Max imaginary value:     2.55232033425e-15&#xA;Therefore 'kern' can be considered pure real.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CtI1b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CtI1b.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tested with &lt;code&gt;scipy.signal.fftconvolve&lt;/code&gt; and compared with the analytical answer: the FFT multiplication gives the right answer (clearly asymmetrical peak in blue) while the convolution (in real space or using FFT) is wrong.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is convolution not working as intended?&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="18750" LastActivityDate="2015-12-15T13:04:33.540" Title="Why is convolution or FFT breaking in this case?" Tags="|fft|convolution|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27729" PostTypeId="2" ParentId="27683" CreationDate="2015-12-15T03:01:41.373" Score="0" Body="&lt;p&gt;To add my two cents to Maz's useful answer, once you've shifted the &lt;em&gt;positive-frequency-only&lt;/em&gt; complex-valued time signal down to be centered at zero Hz you have what is often called a &quot;complex baseband&quot; signal. If the oscillator you used for the freq down-conversion is &lt;em&gt;exactly&lt;/em&gt; in phase with the received signal's carrier sine wave then you can merely take the real part of the complex baseband signal samples as your desired demodulated AM result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if the oscillator used for the freq down-conversion is not &lt;em&gt;exactly&lt;/em&gt; in phase with the received signal's carrier (which is the normal situation) then your desired AM demodulated signal will be the magnitude of the complex-valued &lt;em&gt;complex baseband&lt;/em&gt; signal's samples. If the original transmitted signal was a commercial AM broadcast RF signal, the computed magnitude samples will be riding on a DC bias which you may, or may not, want to pass through a DC blocking filter to make that sequence's average value close to zero amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative, you could perform AM demodulation the way the radio in your bedroom does it.  Compute the absolute values of your received RF AM signal and pass those always-positive samples through a digital lowpass filter (whose passband is the roughly zero to 4 or 5 kHz) to obtain your desired AM demodulated signal. This scheme won't work as well as Mbaz's method but it may work well enough for your purposes.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-15T03:01:41.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27731" PostTypeId="1" CreationDate="2015-12-15T08:49:50.130" Score="5" ViewCount="110" Body="&lt;p&gt;Feature detection is an essential task in low-level vision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good features are those that resist to different perturbations such as&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;noise addition,&lt;/li&gt;&#xA;&lt;li&gt;blur,&lt;/li&gt;&#xA;&lt;li&gt;geometric transforms (3D rotation with perspective, scaling),&lt;/li&gt;&#xA;&lt;li&gt;radiometric transforms (monotonic or non-monotonic grayscale remapping).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;By resistance, I mean that despite those alterations, the same features will continue to be detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how can we mathematically express these types of resistance in general terms ? What would be the form of the equations, assuming grayscale images and features defined from the pixel values in a region of arbitrary shape ? (I am not asking for an assessment of the stability of known features described in the literature.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answering the question for a 1D signal would already be a good start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help ?&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2016-08-02T14:18:30.777" LastActivityDate="2016-12-30T20:52:50.880" Title="What makes an image feature stable?" Tags="|local-features|interest-points|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27732" PostTypeId="2" ParentId="27726" CreationDate="2015-12-15T08:55:17.470" Score="0" Body="&lt;p&gt;When zero-padding you should insert zeros after the signal that you wish to pad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p_sig = np.append([0]*512, np.append(sig, [0]*512))&#xA;p_kern = np.append(kern[:512], np.append([0]*1024, kern[512:]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p_sig = np.append(sig,np.zeros(1024))&#xA;p_kern = np.append(kern,np.zeros(1024))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you'll get a correct result.&lt;/p&gt;&#xA;" OwnerUserId="18758" LastActivityDate="2015-12-15T08:55:17.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27733" PostTypeId="2" ParentId="27668" CreationDate="2015-12-15T09:25:39.497" Score="6" Body="&lt;p&gt;So this is just the start of an answer. I'll have to keep updating it as I go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first attempt is to say that the quantities you are interested in are the location of the center of the four LEDs, and the roll, pitch, and yaw (rotation angles) of the LEDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means your Kalman FIlter state will be:&#xA;$$&#xA;\mathbf{x}_k = \left[x_k\ y_k\ \alpha_k\ \beta_k\ \gamma_k  \right]^T&#xA;$$&#xA;where $\mathbf{x}$ is the state vector, $x_k$ is the $x$ location, $y_k$ is the $y$ location, $\alpha_k$ is the roll, $\beta_k$ is the pitch, and $\gamma_k$ is the yaw.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now, I'm assuming that we are not interested in estimating velocity, $v_k$., or acceleration, $a_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume that the state update equation is then:&#xA;$$&#xA;\mathbf{x}_{k+1} = f(\mathbf{x}_{k}) + v_k = \mathbf{x}_{k} + v_k&#xA;$$&#xA;where $f$ is the state update function, here $f(\mathbf{x}_{k}) = \mathbf{x}_{k}$ so $f$ is just multiplication by the identity, $\mathbf{I}$, $v_k$ is a $5 \times 1$ Gaussian noise vector with covariance matrix&#xA;$$&#xA;R = \left[ &#xA;\begin{array}{ccccc}&#xA;\sigma^2_x &amp;amp; 0 &amp;amp; 0  &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; \sigma^2_y &amp;amp; 0 &amp;amp; 0  &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \sigma^2_\alpha &amp;amp; 0 &amp;amp; 0\\&#xA;0  &amp;amp; 0 &amp;amp; 0 &amp;amp; \sigma^2_\beta &amp;amp; 0 \\&#xA;0 &amp;amp; 0  &amp;amp; 0 &amp;amp; 0 &amp;amp; \sigma^2_\gamma\\&#xA;\end{array}&#xA;\right]&#xA;$$&#xA;i.e. the changes in all variables are just Gaussian (bandlimited) white noise. Note that this may not give the best results, but let's start there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the noise measurements will be the $(x,y)$ locations of the four LEDs:&#xA;$$&#xA;\mathbf{z}_k = \left[x^1_k\ y^1_k\ x^2_k\ y^2_k\ x^3_k\ y^3_k\ x^4_k\ y^4_k  \right]^T&#xA;$$&#xA;where $x^i_k$ for $i=1,2,3,4$ is the $x$ location of the $i^\mbox{th}$ LED at time $k$ and $y^i_k$ is the $y$ location of the $i^\mbox{th}$ LED at time $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the output equation would be:&#xA;$$&#xA;\mathbf{z}_{k} = h(\mathbf{x}_k, r) + w_k&#xA;$$&#xA;where $h$ is a function of the state and the radius of the circle that the LEDs sit on $r$.  I have to go offline for a bit, so will fill in $h$ &lt;a href=&quot;http://planning.cs.uiuc.edu/node102.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;based on these equations later&lt;/a&gt;. Here, $w_k$ is an $8 \times 1$ noise vector with diagonal covariance matrix $Q_k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea where would be to make $Q_k$ time varying so that, when an LED disappears, the entries in the $Q_k$ matrix associated with those measurements have extremely large variances (meaning we are very unsure where the LED is). That should make the update just (effectively) keep the previous value with a minor update based on the new state estimate from the locations of the LEDs we CAN see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any event, it looks like your filter is going to be an &lt;em&gt;extended&lt;/em&gt; Kalman filter (EKF) rather than a straight Kalman filter if we pursue this route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option would be to use $(x^i_k,y^i_k)$ as the state variables so there's a more direct relationship between them and the measurements. However, then I'm not sure how to apply the fact that the four LEDs are in a set relationship to each other.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is taking way longer than I expected, so I thought I'd just let you know I &lt;strong&gt;am&lt;/strong&gt; trying to work on it...this week (and last weekend) were a dead loss for non-critical stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code below mainly just attempts to model the original measurements. No real attempt is made to use the EKF to do the estimation. Just using the mean location of the LEDs is currently all that it does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Picture of an example track is below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try and get the EKF version going, but we'll see how this weekend goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iZELu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iZELu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&#xA;    #27668&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Plot the data generated&#xA;plot_track &amp;lt;- function (xx,zz)&#xA;{&#xA;  plot(xx[,1],xx[,2], type=&quot;l&quot;)&#xA;&#xA;  for (t in 1:T)&#xA;  {&#xA;    points(zz[t,1], zz[t,2], col=&quot;red&quot;, pch=18)&#xA;    points(zz[t,3], zz[t,4], col=&quot;green&quot;, pch=18)&#xA;    points(zz[t,5], zz[t,6], col=&quot;yellow&quot;, pch=18)&#xA;    points(zz[t,7], zz[t,8], col=&quot;blue&quot;, pch=18)&#xA;  }&#xA;&#xA;  points(xx[1,1],xx[1,2],col=&quot;magenta&quot;,lwd=20, pch=5)&#xA;  points(xx[T,1],xx[T,2],col=&quot;orange&quot;,lwd=20)&#xA;}&#xA;&#xA;# From a single x-y track, create all the locations for all the LED location measurements.&#xA;# Note that this just takes account of YAW, not pitch and roll.&#xA;create_measurements &amp;lt;- function(x,y,radius,yaw)&#xA;{&#xA;  measurements &amp;lt;- c(x,y+radius,x,y-radius,x+radius,y,x-radius,y)&#xA;  dim(measurements) &amp;lt;- c(2,4)&#xA;&#xA;  yaw &amp;lt;- c(cos(yaw), -sin(yaw), sin(yaw), cos(yaw))&#xA;  dim(yaw) &amp;lt;- c(2,2)&#xA;&#xA;  measurements &amp;lt;- yaw %*% measurements&#xA;&#xA;  # Reshape for later use in rbind&#xA;  dim(measurements) &amp;lt;- c(1,8)&#xA;&#xA;  return(measurements)&#xA;}&#xA;&#xA;# GIven the true (x,y) tracks in x, create the locations of the four LEDs&#xA;create_all_tracks &amp;lt;- function(tracks, radius)&#xA;{&#xA;   led_tracks &amp;lt;- data.frame(x1 = numeric(0), y1 = numeric(0), x2 = numeric(0), y2 = numeric(0), x3 = numeric(0), y3 = numeric(0), x4 = numeric(0), y4 = numeric(0))&#xA;  for (t in 1:T)&#xA;  {&#xA;    led_tracks[t,] &amp;lt;- create_measurements(tracks[t,1], tracks[t,2], radius, tracks[t,3]);&#xA;  }&#xA;&#xA;  return(led_tracks)&#xA;}&#xA;&#xA;# Generation of the original data, Don't do it if z exists.&#xA;#if (FALSE == exists(&quot;led_tracks_true&quot;))&#xA;{&#xA;  radius &amp;lt;- 0.1 # Radius of each LED ring&#xA;&#xA;  Nstate &amp;lt;- 3 # States are X,Y, RYaw Angle&#xA;  x0 &amp;lt;- rep(0,Nstate) #The state vector starts at all zeros&#xA;&#xA;  sigmas &amp;lt;- c(0.1,0.1,0.001)&#xA;  Q &amp;lt;- diag(sigmas)&#xA;&#xA;  T &amp;lt;- 1000&#xA;  x_true &amp;lt;- rep(0,Nstate*T) # The true states&#xA;  dim(x_true) &amp;lt;- c(T,Nstate)&#xA;&#xA;  #A = [ 1 dt dt^2/2 0 &#xA;  #      0  1     dt 0 &#xA;  #      0  0      1 0&#xA;  #      0  0      0 1];&#xA;  dt &amp;lt;- 0.1&#xA;  A &amp;lt;- matrix(c(1,0,0,0,dt,1,0,0,dt^2/2,dt,1,0,0,0,0,1),4,4)&#xA;  B &amp;lt;- matrix(c(0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1),4,4)&#xA;&#xA;  true_acceleration &amp;lt;- rnorm(T,0,1)  &#xA;&#xA;  for (t in 1:(T-1))&#xA;  {&#xA;    for (n in 1:Nstate)&#xA;    {&#xA;      x_true[t+1,n] &amp;lt;- x_true[t,n] + rnorm(1,0, sigmas[n])&#xA;    }&#xA;  }&#xA;&#xA;  led_tracks_true &amp;lt;- create_all_tracks(x_true,radius)&#xA;&#xA;  plot_track(x_true,led_tracks_true)&#xA;}&#xA;&#xA;# Generate the measurements by adding some noise to the true led tracks&#xA;n_measurements &amp;lt;- 8&#xA;measurement_sigmas &amp;lt;- rep(0.1,n_measurements)&#xA;R &amp;lt;- diag(measurement_sigmas)&#xA;&#xA;led_tracks_measured &amp;lt;-  rep(0,n_measurements*T) &#xA;dim(led_tracks_measured) &amp;lt;- c(T,n_measurements)&#xA;&#xA;for (t in 1:(T-1))&#xA;{&#xA;  for (n in 1:n_measurements)&#xA;  {&#xA;    led_tracks_measured[t+1,n] &amp;lt;- led_tracks_true[t,n] + rnorm(1,0, measurement_sigmas[n])&#xA;  }&#xA;}&#xA;&#xA;# Pick some times where we have an occluded LED&#xA;n_occlusions &amp;lt;- 50&#xA;occlusion_times &amp;lt;- sample(1:T, n_occlusions)&#xA;occlusion_leds &amp;lt;-  sample(1:4,T, replace = TRUE)&#xA;&#xA;led_tracks_measured[occlusion_times, occlusion_leds] &amp;lt;- NA&#xA;&#xA;# Attempt #1 : Just average the locations of the four LED tracks.&#xA;# When an LED is occluded, just ignore that measurement and average&#xA;# the remaining three LED locations.&#xA;est_avg &amp;lt;- rep(0,2*T) &#xA;dim(est_avg) &amp;lt;- c(T,2)&#xA;&#xA;for (t in 1:T)&#xA;{&#xA;  est_avg[t,1] &amp;lt;- mean(led_tracks_measured[t,c(1,3,5,7)], na.rm = TRUE)&#xA;  est_avg[t,2] &amp;lt;- mean(led_tracks_measured[t,c(2,4,6,8)], na.rm = TRUE)&#xA;}&#xA;&#xA;plot(est_avg - x_true[,1:2])&#xA;&#xA;# Attempt #2 : An EKF approach?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-01-29T20:45:43.137" LastActivityDate="2016-01-29T20:45:43.137" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="27734" PostTypeId="2" ParentId="27731" CreationDate="2015-12-15T10:44:39.607" Score="1" Body="&lt;p&gt;Without being an expert in the image processing field there is something that comes to mind that maybe could point you in the right direction. Usually we express a feature as a number, to which we assign an estimator, which is a random variable, with some probability distribution (for which we normally care about mean value and variance). If we take the noise example which i think is the easier. You could try to express this resistance in term of the variation of the probability distribution of the feature estimator given the perturbing noise source. Let the output of your estimator for the feature be the random variable $\mathbf{X}$, and let the noise be characterized by $\mathbf{Y}$. Some measure of the resistance could be $\frac{P(\mathbf{X})}{P(\mathbf{X}|\mathbf{Y})}$. If this value is close to one, then the feature would be resistent to perturbations by noise, if it is not then it won't be. Maybe you could define a function of this to adjust the values to be more significant. For the other transformations such as rotation, scaling etc, you could use the same but do $\frac{P(\mathbf{X})}{P(\mathbf{f(X)})}$, where $f(\mathbf{X})$ denotes the transformation of the random variable that characterizes the estimator when you apply the rotation to the image. Of course, I think this $f()$ would be very hard to find in general but perhaps if the feature is not hard to estimate you can do some math and some change of variable and arrive at closed expressions for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2015-12-15T10:44:39.607" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27735" PostTypeId="2" ParentId="27731" CreationDate="2015-12-15T11:51:13.737" Score="1" Body="&lt;p&gt;Based on the interesting suggestion of @bone, I made further investigations, too long for a comment. They are based on a very simple model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let an 1D signal with a step edge, i.e. values 0 followed by values 1. We want to try a linear decision criterion of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$av_0+bv_1\ge1,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $v_0$ and $v_1$ are the values of two neighboring pixels, and $a,b$ are two coefficients to be determined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the edge we have $v_0=0, v_1=1$ in the absence of noise, and the edge is detected when $b\ge1$. False detections occur when $v_0=v_1=1$ and $a+b\ge1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Gaussian noise added we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$av_0+N(0;a\sigma)+bv_1+N(0;b\sigma)=av_0+bv_1+N(0;\sqrt{a^2+b^2}\sigma)\ge1.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we should ensure&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$N(b;\sqrt{a^2+b^2}\sigma)\ge1,\\&#xA;N(a+b;\sqrt{a^2+b^2}\sigma)\le1$$ as often as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, if there are $N=N_0+N_1$ samples, the probability of being on an edge is $\frac1N$ and that of being on the step is $\frac{N_1}{N}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we want to maximize the probability of correct detection&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac1NP(N(b;\sqrt{a^2+b^2}\sigma)\ge1)+\frac{N_1}NP(N(a+b;\sqrt{a^2+b^2}\sigma)\le1),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac1N\text{erf}(\frac b{\sqrt{a^2+b^2}\sigma})+&#xA;\frac{N_1}{N}\text{erfc}(\frac{a+b}{\sqrt{a^2+b^2}\sigma}).$$&lt;/p&gt;&#xA;" OwnerDisplayName="user7657" LastEditorDisplayName="user7657" LastEditDate="2015-12-15T12:16:22.287" LastActivityDate="2015-12-15T12:16:22.287" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27736" PostTypeId="2" ParentId="27705" CreationDate="2015-12-15T12:56:41.510" Score="1" Body="&lt;p&gt;I know of no &quot;standard&quot; way of incorporating the output of a set of Kalman filters into another. The reason is that each application will have a different &quot;signal model&quot; (way of combining the multiple outputs into different measurements).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose you have two Kalman filters that give you state estimates:&#xA;$$&#xA;\mathbf{x}_k^1 = \mbox{state of first Kalman filter}\\&#xA;\mathbf{x}_k^2 = \mbox{state of second Kalman filter}\\&#xA;$$&#xA;then you'll need to decide the parameters in your new model:&#xA;$$&#xA;\mathbf{x}^{\tt tot}_k = [ {\mathbf{x}^1_k}^T {\mathbf{x}^2_k}^T ]^T\\&#xA;\mathbf{x}^{\tt tot}_{k+1} = \mathbf{A} \mathbf{x}^{\tt tot}_k + v_k\\&#xA;\mathbf{z}^{\tt tot}_k = \mathbf{C} \mathbf{x}^{\tt tot}_k + w_k&#xA;$$&#xA;where $\mathbf{A}$ is the state update matrix, and $\mathbf{C}$ is the output matrix, $v_k$ is the process noise driving the interactions between the different states and $w_k$ is the measurement noise.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-15T12:56:41.510" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27737" PostTypeId="2" ParentId="27726" CreationDate="2015-12-15T13:04:33.540" Score="2" Body="&lt;p&gt;Yes, zero-padding is the issue, however not as you would except...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Soren is only partially right: you can add zeros at the beginning, middle or end of the signal just as you did, but absolutely not as you wish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the general rule?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Look at how the signal repeats with and without zeros and choose the&#xA;  place that distorts the signal the least.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does it mean? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the case of a real, discrete and &lt;strong&gt;aperiodic&lt;/strong&gt; time-space signal, there is a causal relationship between the value at n and the value at n+1. So all these values should be considered as a bloc, adding zeros in the middle would distort it. Here is an obvious reason from your code, you had a proper Gaussian, not something like this:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qgPjP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qgPjP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the case of your convolution kernel, it's a bit more complicated. What do the last taps (second half) mean? &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the aperiodic DTFT (i.e. linear convolution, as opposed to circular), these mean that the convolved values depends of both &lt;code&gt;[n, n+1, n+2, ...]&lt;/code&gt; (as expected) but also &lt;code&gt;[len - 1, len - 2, len - 3, ...]&lt;/code&gt; (where &lt;code&gt;len&lt;/code&gt; corresponds to the end of the array without padding). This &quot;classical&quot; linear convolution can be simulated by padding the end/beginning of the signal.&lt;/li&gt;&#xA;&lt;li&gt;In the periodic DFT (circular convolution), the taps of the second half actually correspond to the values &lt;code&gt;[n-1, n-2, n-3, ...]&lt;/code&gt; (&lt;strong&gt;not&lt;/strong&gt; the values by the end of the signal).&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;np.convolve&lt;/code&gt; and bunch try to do a &quot;classical&quot; linear convolution while you seem to want a non-classical one (zeros added in the middle). Here is a comparison: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/n6wtK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n6wtK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understood, the actual kernel you want is the one described in &quot;your kernel&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can easily get the right kernel by fftshifting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;kern = np.fft.fftshift(kern)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This has the effect of centering your DC (using linear phase shifting) and then you can just pad zeros at the beginning/end as much as you wish and use the standard convolution/filtering tools.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the end, this was an interesting question: people usually just pad blindly using convolution functions or options from the FFT transform without ever wondering what they are doing. Some even put &lt;code&gt;fftshift&lt;/code&gt;s out of habit every time they deal with anything resembling a kernel.&lt;/p&gt;&#xA;" OwnerUserId="18759" LastActivityDate="2015-12-15T13:04:33.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27738" PostTypeId="2" ParentId="27586" CreationDate="2015-12-15T13:39:34.120" Score="1" Body="&lt;p&gt;OK, a few things.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Zeroing bins in frequency space is equivalent to applying a rectangular window. That means that you actually convolve your audio signal with a sinc function. In practice, because you don't have an infinite sampling, that eventually means audio artifacts.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;http://www.dspguide.com/ch21.htm&quot; rel=&quot;nofollow&quot;&gt;Bessel/Butterworth/Chebychev/Elliptic filters&lt;/a&gt; are optimal &quot;physical&quot; filters (though they are not optimal for the same thing). As a group, their main advantages are:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;they have electronic counterparts, so they are familiar;&lt;/li&gt;&#xA;&lt;li&gt;they can be implemented as IIR filters so they can work on streams of data without fancy blocking algorithm and they can be very versatile and insanely fast.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Nowadays, especially for audio and analysis, people tend to use a &lt;a href=&quot;http://www.dspguide.com/ch16.htm&quot; rel=&quot;nofollow&quot;&gt;windowed-sinc&lt;/a&gt; filter instead of these because it is clearly better in most of the situations. If you can afford that one (i.e. if you are not streaming anything with high delay constrains and you have a computer that is not 20 y/o), this is most likely the best solution for you.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="18760" LastActivityDate="2015-12-15T13:39:34.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27739" PostTypeId="2" ParentId="25394" CreationDate="2015-12-15T14:23:20.843" Score="2" Body="&lt;p&gt;If your oscillator is steadily accumulating DC over time, adding a DC blocker at the output may not be an elegant solution since your oscillator will keep getting more and more DC.  For floating point this may or may not be a huge problem (I wouldn't do it), but for fixed point you will eventually start clipping or wrapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the oscillator has a frequency dependent DC offset that doesn't creep up over time, a DC blocker is probably a good solution.  If you've implemented the BLEPs correctly, this should be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original reason given for BLEPs to be minimum phase was to implement oscillator sync.  To implement this correctly with linear phase BLEPs, you should use lookahead so you can start the BLEP before the aliased reset occurs.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, apparently this author would rather not have any lookahead for some reason and therefore designed minBLEPs so that you would have to lookahead less far into the future.  If I remember correctly, in the paper they say that it's okay to just forget about lookahead if you use minimum phase, but obviously this isn't perfectly true as minimum phase filters still have some delay.  You should experiment yourself to see if the approximation works for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion, it's probably a good idea to use linear phase BLEPs and lookahead appropriately for sync.  We're talking a few samples of latency here for reasonable BLEPs.&lt;/p&gt;&#xA;" OwnerUserId="11413" LastEditorUserId="11413" LastEditDate="2015-12-15T14:36:41.030" LastActivityDate="2015-12-15T14:36:41.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27740" PostTypeId="1" CreationDate="2015-12-15T14:28:31.060" Score="-1" ViewCount="158" Body="&lt;p&gt;I want to solve for the extrinsics by using direct linear transformation on corresponding 3D LIDAR points and 2D camera points. I already have the intrinsics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Problem is, points behind the camera gets re-projected as well (see picture below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YS7TJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YS7TJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I constrain to only points &quot;in front of the camera&quot;, i.e z &gt; 0. The problem is, on different trials where different sets of points are used, the produced extrinsic matrix produces differing axes. Sometimes, constraining z &gt; 0 gives the right results (centre part of image), whereas other times I need z &amp;lt; 0. So the question is, how do I constrain the Z axes of the camera to be sticking out of the camera?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def with_intrinsic(points2d, points3d, intrinsic):&#xA;    cam1_K_inverse = np.linalg.inv(intrinsic)&#xA;&#xA;    #direct linear transformation calibration, assumes no intrinsic matrix&#xA;    assert points2d.shape[0] &amp;gt;= 3&#xA;    assert points3d.shape[0] == points2d.shape[0]&#xA;&#xA;    A = []&#xA;&#xA;    points2d_homo = []&#xA;    for u,v in points2d:&#xA;        points2d_homo.append([u, v, 1])&#xA;&#xA;    points2d_homo = np.array(points2d_homo).T #columns to be data points&#xA;&#xA;&#xA;    points2d_inv = np.dot(cam1_K_inverse, points2d_homo).T&#xA;    assert points2d_inv.shape == (points2d.shape[0], 3)&#xA;    assert points2d_inv[0, 2] == 1&#xA;&#xA;    for idx in range(points2d.shape[0]):&#xA;        x3d, y3d, z3d = points3d[idx]&#xA;        u, v, _ = points2d_inv[idx]&#xA;&#xA;        A.append([x3d, y3d, z3d, 1, 0, 0, 0, 0, -u * x3d, -u * y3d, -u * z3d, -u])&#xA;        A.append([0, 0, 0, 0, x3d, y3d, z3d, 1, -v * x3d, -v * y3d, -v * z3d, -v])&#xA;&#xA;    A = np.array(A)&#xA;&#xA;    U, D, VT = np.linalg.svd(A)&#xA;    M = VT.T[:, -1].reshape((3, 4))&#xA;&#xA;    error = get_reprojection_error(points2d, points3d, intrinsic, M)&#xA;    logging.debug(&quot;error with_intrinsic: %s&quot;, error)&#xA;&#xA;    return M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="18762" LastActivityDate="2022-04-17T19:01:10.100" Title="camera calibration change orientation of axis" Tags="|computer-vision|camera-calibration|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27741" PostTypeId="1" CreationDate="2015-12-15T15:00:03.723" Score="2" ViewCount="906" Body="&lt;p&gt;I would like to apply a Kalman filter to remove noise from my measured acceleration data. The idea is then to compare the results obtained in this way whit the results obtained by applying a low-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the Kalman filter equations are the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_k = Ax_{k-1}+q_{k-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$z_k = Hx_k+r_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x$ is the state vector, $A$ is the transition matrix, $z$ is the vector of measurements and $H$ the observation matrix. $q$ and $r$ represent the process and measurement noise respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I am working with one signal only (acceleration), the state vector $x$ is actually a scalar entity and so are all the other terms in the previous equations. In my case I had $A = 1$ and $H = 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of the Kalman filter is that it computes an estimate of the input signal, therefore it is not a proper filter. So what I have to tune to smoothen the measured data is the $Q$ value (process noise covariance) in order to change the way in which the signal is estimated. The idea is to have a &quot;worse&quot; estimate in such a way that the peaks introduced by the noise are removed from the signal (which means the filter follows the original signal less accurately).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the correct way to procede?&lt;/p&gt;&#xA;" OwnerUserId="11580" LastActivityDate="2015-12-15T15:00:03.723" Title="Kalman filter to filter noise from acceleration data" Tags="|noise|kalman-filters|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27742" PostTypeId="1" CreationDate="2015-12-15T15:49:20.660" Score="0" ViewCount="1467" Body="&lt;p&gt;I am using a kalman filter (constant velocity model) to track postion and velocity of an object. I measure x,y of the object and track x,y,vx,vy . Which works but if a add gausian noise of +- 20 mm to the sensor readings x,y,vx,vy fluctuates even though the point is not moving just noise. For location that is good enough for my needs but velocity changes when the point is stationary and that is causing problems with my object speed calculations. Is there a way around this problem? also if switching to constant acceleration model improve on this? I am tracking a robot via a camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using opencv implementation and my kalman model is same as [1]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] &lt;a href=&quot;http://www.morethantechnical.com/2011/06/17/simple-kalman-filter-for-tracking-using-opencv-2-2-w-code/&quot; rel=&quot;nofollow&quot;&gt;http://www.morethantechnical.com/2011/06/17/simple-kalman-filter-for-tracking-using-opencv-2-2-w-code/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18763" LastActivityDate="2015-12-15T15:49:20.660" Title="Tracking position and velocity using a kalman filter" Tags="|kalman-filters|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27743" PostTypeId="1" CreationDate="2015-12-15T19:23:00.610" Score="1" ViewCount="277" Body="&lt;p&gt;I have an exam in my signals and systems class in a couple of days, and I'm unsure how to go about solving this practice problem. The question is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a discrete time system whose input and output are related by the following difference equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$  y[n] =&#xA;\begin{cases}&#xA;(1/4)y[n-1] + x[n],  &amp;amp; \text{if $n&amp;gt;=0$} \\&#xA;(1/4)y[n-1] + x[n] + x[n+1]*\cos(n*u[n] + \pi/2), &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use recursion to find an expression for the zero-state output, y[n], when the input is given by&#xA;$$x[n] = δ[n + m]$$&#xA;where m is an integer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having a bit of trouble with the fact that the equation extends to before 0; usually to solve one of these by recursion we'd have something like y[-1] = 0, which would allow us to go ahead and compute more ys ... but in this case that seems to be impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing I managed to notice was that cos expression is irrelevant because of the unit step function; it's all 0 before 0, and that whole term goes away.Also recursively the y[n-1] term seems to divide by infinity ... but I don't know where to take it from there.&lt;/p&gt;&#xA;" OwnerUserId="18767" LastEditorUserId="80" LastEditDate="2015-12-16T13:26:42.687" LastActivityDate="2015-12-16T13:26:42.687" Title="Help Solving a Difference Equation" Tags="|discrete-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27744" PostTypeId="2" ParentId="25873" CreationDate="2015-12-15T19:46:00.940" Score="3" Body="&lt;p&gt;I think there is a confusion between signals and systems here. A signal doesn't have any poles and zeros. Only systems have poles and zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A system is a thing that turns one signal into another one. For example a loudspeaker turns a voltage signal into a sound signal. The voltage going in is a signal, the sound coming out is a signal, but the loudspeaker itself is a system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linear Time Invariant Systems can be characterized by their transfer function or their impulse response. The transfer function in the Z domain can be written as a rationale function, which in turn can be characterized through poles and zeros. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the system has only a real valued input and only a real valued output, the impulse response must be real as well and that in turn will require the poles and zeros to be either real or be conjugate complex pairs. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-12-15T19:46:00.940" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27745" PostTypeId="1" CreationDate="2015-12-15T20:03:05.477" Score="1" ViewCount="3421" Body="&lt;p&gt;Technology: C++, CodeBlocks IDE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've just read sample wav file (source - &lt;a href=&quot;http://www.wavsource.com/snds_2015-12-13_4694675918641206/movies/2001/daisy.wav&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.wavsource.com/snds_2015-12-13_4694675918641206/movies/2001/daisy.wav&lt;/a&gt; ) with an txt output (&lt;a href=&quot;https://paste.ee/p/pXGvm&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://paste.ee/p/pXGvm&lt;/a&gt;), which i get from using this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    WavAnalysis wav_analyse;&#xA;    static const uint16_t BUFFER_SIZE = 1024;&#xA;    uint8_t* buffer = new uint8_t[BUFFER_SIZE];&#xA;    std::cout &amp;lt;&amp;lt; &quot;Buffering data... &quot; &amp;lt;&amp;lt; std::endl;&#xA;    fseek(wavFile, 44, SEEK_SET); // skip header data&#xA;    while ((bytesRead = fread(buffer, sizeof buffer[0], BUFFER_SIZE / (sizeof buffer[0]), wavFile)) &amp;gt; 0)&#xA;    {&#xA;        //do sth with buffer data&#xA;        wav_analyse.FFT(buffer); // currently shows data only&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Wav file header informations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;1 channel PCM,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;8 bits per sample,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;sampling rate is 11025Hz.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In next step I'm normalising values to the range of [-1;1) with function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float WavAnalysis::normaliseValuetoFloat(uint8_t value){&#xA;    float normalisedValue = (float)value;&#xA;    normalisedValue -= 128;&#xA;    normalisedValue /= 128;&#xA;    return normalisedValue;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My goal is to create my own library for voice activity detection, now I'm working on FFT module. I need this data to calculate signal energy and its entropy in chosen signal parts.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;updates:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading commented sources, I've learned that average and sufficient length of data for feeding FFT algorythm is 1024 (or any other that is equal to power of two).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question now:&lt;/strong&gt; FFT changes signal domain from time (real values) to frequency (which contains complex numbers). Why does available sources populates the FFT algorithm with complex array? Ex.: &lt;a href=&quot;https://stackoverflow.com/questions/10121574/safe-and-fast-fft&quot;&gt;https://stackoverflow.com/questions/10121574/safe-and-fast-fft&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18768" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-04-14T23:17:17.453" Title="Aplying FFT to Wav file data" Tags="|fft|c++|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27746" PostTypeId="1" CreationDate="2015-12-15T23:02:32.767" Score="0" ViewCount="60" Body="&lt;p&gt;The discrete function for correlation over 2 dimensions is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ C(x,y) = \sum\limits_{p=1}^{x_{res}} \sum\limits_{q=1}^{y_{res}} f(p,q)h(p+x, q+y)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where x,y is a coordinate in the image, f is the image, and h is the template. $x_{res}$ and $y_{res}$ are the dimensions of the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand how this works, because of adding x and y to p and q respectively. This will translate the template out of the bounds of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $h(p+x, q+y)$ is replaced with $h(p-x, q-y)$, then the template with be translated to the coordinate x,y in the image. However I'm told this is convolution not correlation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to implement it in code to try and understand: &lt;a href=&quot;https://jsfiddle.net/ua5d1uo2/&quot; rel=&quot;nofollow&quot;&gt;https://jsfiddle.net/ua5d1uo2/&lt;/a&gt; as you can see, using + just gives a matrix of zeros. but using - the highest number in the matrix is where you'd expect it to be (where the template is matched in the image).&lt;/p&gt;&#xA;" OwnerUserId="18772" LastActivityDate="2015-12-15T23:02:32.767" Title="How does correlation work in an image?" Tags="|image-processing|correlation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27747" PostTypeId="1" CreationDate="2015-12-16T03:22:55.370" Score="3" ViewCount="415" Body="&lt;p&gt;The Signal Processing SE post linked below shows how the Fourier Transform applied 4 times to a 1D function returns the original function, i.e. F{ F{ F{ F{ g(x) } } } } = g(x)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link to 1D case:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/24880/fourier-transform-4-times-original-function-from-bracewell-book&quot;&gt;Fourier transform 4 times = original function (from Bracewell book)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone prove that this does or doesn't apply to 2D or higher functions?&#xA;In particular, if I use this method on a grayscale image, will I get back the original image? I know edge effects could be problematic, so lets say the image is a simple repeating pattern so that it is periodic. And yes, numerical/computational FFT issues might mean the image is not exactly like the original, but even if they are similar that would be pretty cool to see....&lt;/p&gt;&#xA;" OwnerUserId="13407" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-12-16T12:45:39.793" Title="Fourier transform 4 times = original function (2D and higher)" Tags="|image-processing|fft|fourier-transform|transform|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27748" PostTypeId="1" CreationDate="2015-12-16T09:00:41.770" Score="1" ViewCount="741" Body="&lt;p&gt;When I see MRI explained, two types of 2D k-space images seem to be described as if they were the same.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Axes are the two spatial frequencies. This images is directly fourier-transformed into the final image.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Axes are phase and frequency (temporal, I assume). The data read through the RF coil is put directly into this matrix.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What is the relation between 1 and 2? Are they the same?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example with spatial frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pvXAi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pvXAi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example with phase and frequency, which seems to be the &quot;raw data&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Jhm0d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jhm0d.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;k-phase&quot; and &quot;k-readout&quot;, which I think is identical to phase and frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OyoI1.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OyoI1.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1440" LastEditorUserId="1440" LastEditDate="2015-12-16T09:14:19.857" LastActivityDate="2022-04-21T17:06:30.643" Title="Relation between two k-spaces phase-frequency and spatial frequencies in" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27750" PostTypeId="1" AcceptedAnswerId="27774" CreationDate="2015-12-16T10:20:43.410" Score="0" ViewCount="116" Body="&lt;p&gt;I am working in compressed sensing, basically in ECG reconstruction&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally we were using biorthogonal wavelets for reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone advised me to use exponential spline basis instead of biorthogonal wavelets and I tried it and the results were better compared to wavelets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though I got better results I still don't know why it worked. I am going for presentation and I am expecting this question.&lt;/p&gt;&#xA;" OwnerUserId="17018" LastEditorUserId="13320" LastEditDate="2015-12-17T11:06:49.177" LastActivityDate="2015-12-17T11:43:00.247" Title="Advantages of Splines in Compressed sensing" Tags="|image-processing|signal-analysis|continuous-signals|signal-detection|math|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27751" PostTypeId="1" CreationDate="2015-12-16T12:08:28.030" Score="4" ViewCount="1638" Body="&lt;p&gt;Hello can someone explain the semantical meaning of the structure tensor and the Hessian matrix. I am aware of how it is calculated, but i find it difficult to comprehend what they describe in the image and how they can be used to detect corners (Harris) and detect Blobs (SURF).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated, thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="17789" LastActivityDate="2016-01-15T21:15:15.593" Title="Structure Tensor vs. Hessian Matrix" Tags="|image-processing|local-features|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27752" PostTypeId="1" AcceptedAnswerId="27761" CreationDate="2015-12-16T12:36:59.720" Score="2" ViewCount="4224" Body="&lt;p&gt;As I know, in general, the DCT is lossless. But I'm not exactly sure about Type-2 of DCT.&#xA;Is it lossless or lossy?&lt;/p&gt;&#xA;" OwnerUserId="18670" LastEditorUserId="15892" LastEditDate="2015-12-18T09:05:39.340" LastActivityDate="2015-12-18T09:05:39.340" Title="Is DCT (Discrete Cosine Transform) of Type-2 lossless or lossy?" Tags="|transform|dct|compression|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27753" PostTypeId="2" ParentId="27747" CreationDate="2015-12-16T12:45:39.793" Score="3" Body="&lt;p&gt;The n-dimensional (discrete) Fourier transform is separable, that means the dimensions can be treated independently. So the property that the FT is a fourth root of the identity applies to n-dimensional transforms too. And the property is exact, so apart from a tiny numerical round off error you won't see any deviations.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2015-12-16T12:45:39.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27754" PostTypeId="2" ParentId="27743" CreationDate="2015-12-16T13:00:32.150" Score="2" Body="&lt;p&gt;You seem to have figured out that the system is actually given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\frac14 y[n-1]+x[n],\quad \forall n\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you're looking for the zero-state output, you can simply compute the system's impulse response $h[n]$ by applying $x[n]=\delta[n]$ as an input signal (with $y[n-1]=0$), and compute the response to any other input signal using this impulse response. For $x[n]=\delta[n+m]$, the response is simply $h[n+m]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The recursion for the impulse response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}h[0]&amp;amp;=1\\&#xA;h[1]&amp;amp;=\frac14\\&#xA;h[2]&amp;amp;=\left(\frac14\right)^2\\&#xA;&amp;amp;\vdots\end{align}\\$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure you can take it from here and derive a general expression for $h[n]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-16T13:00:32.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27755" PostTypeId="2" ParentId="24157" CreationDate="2015-12-16T13:51:32.527" Score="0" Body="&lt;p&gt;Not true. If you calculate the inverse FFT for each frequency sequence and the resulting peak to average power ratio in the time domain, you will find that they are the same,  $\sqrt 2$ in either case.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="13320" LastEditDate="2016-02-14T21:35:00.137" LastActivityDate="2016-02-14T21:35:00.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27756" PostTypeId="2" ParentId="27740" CreationDate="2015-12-16T15:15:45.443" Score="0" Body="&lt;p&gt;The question is a bit unclear (and am sorry to say, the code even more so). Assuming your 3d-2d point correspondences are correct, all you'd need to do after solving the DLT is to rearrange the orientation of the axes while leaving their directions and the parity of the frame unchanged (i.e. ensure that the determinant of the rotation matrix is +1). &lt;/p&gt;&#xA;" OwnerUserId="9110" LastActivityDate="2015-12-16T15:15:45.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27757" PostTypeId="1" AcceptedAnswerId="27758" CreationDate="2015-12-16T15:19:03.673" Score="0" ViewCount="365" Body="&lt;p&gt;Say the analog signal $x(t)$ and its spectrum $X_a(\Omega)$. After sampling with frequency $F_s$ or sampling period $T$ we get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] \triangleq x(nT) = x\left(\frac{n}{F_s}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its spectrum $X_d(\omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relationship between the two spectrums is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_d(\omega) =\frac1T \sum ^{\infty}_{n=-\infty}X_a\left(\frac{\omega + 2\pi n}{T}\right)$$&#xA;$$\omega=T\Omega$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For band-limited analog signal having spectrum in range $[-B,B]$. $X_a(\Omega)=0$ for $|\Omega| \geq B$ if $F_s$ is above Nyquist rate then&#xA;$$X_d(\omega) =\frac1T X_a(\Omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For digital signal, its frequency is restrict in $[-\pi,\pi]$ but not the case of analog signal. The equation above means that $X_d(\omega)$ is not restricted in $[-\pi,\pi]$&lt;/p&gt;&#xA;" OwnerUserId="18328" LastEditorUserId="18328" LastEditDate="2015-12-18T02:54:08.010" LastActivityDate="2015-12-18T02:54:08.010" Title="How can spectrum of DTFT of sampled band-limited analog signal be in $[-\pi,\pi]$" Tags="|discrete-signals|fourier-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27758" PostTypeId="2" ParentId="27757" CreationDate="2015-12-16T15:50:30.010" Score="1" Body="&lt;p&gt;The DTFT $X_d(\omega)$ of a discrete-time signal is periodic with period $2\pi$, so it's sufficient to consider the interval $[-\pi,\pi]$. &quot;Restricted&quot; to this interval means that due to the inherent periodicity there can be no new frequency components outside the interval $[-\pi,\pi]$. Of course, $\pi$ corresponds to half the sampling frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $X_a(\Omega)$ is the spectrum of a band-limited continuous-time signal, and if the sampling frequency is greater than twice the band-width, then the equality&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_d(\omega)=\frac{1}{T}X_a\left(\frac{\omega}{T}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;holds in the interval $[-\pi,\pi]$. Outside that interval, $X_a(\Omega)$ is zero, and $X_d(\omega)$ is continued periodically.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-16T20:10:10.857" LastActivityDate="2015-12-16T20:10:10.857" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27759" PostTypeId="2" ParentId="27745" CreationDate="2015-12-16T15:58:40.477" Score="1" Body="&lt;p&gt;Your FFT code initializes a complex array because that is what the Fourier Transform produces. You should understand the &lt;a href=&quot;https://dsp.stackexchange.com/questions/8482/what-is-the-role-of-complex-exponential/8483#8483&quot;&gt;complex exponential&lt;/a&gt;, and the nature of the transform as a change of basis (i.e. a projection onto a basis of sines &amp;amp; cosines). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a big topic that is well travelled, start here:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/10304532/why-does-fft-produce-complex-numbers-instead-of-real-numbers&quot;&gt;https://stackoverflow.com/questions/10304532/why-does-fft-produce-complex-numbers-instead-of-real-numbers&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2015-12-16T15:58:40.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27760" PostTypeId="1" AcceptedAnswerId="27766" CreationDate="2015-12-16T16:38:50.907" Score="0" ViewCount="155" Body="&lt;p&gt;I currently have a complex base-band simulator for non-coherent detection of M-ary orthogonal waveforms (such as M-FSK).  I run the noisy signal through M correlators at lag=0, compute the magnitude squared of the results and pick the largest.  Everything is perfectly synchronized.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is just: modulate -&gt; add AWGN -&gt; demod.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, my non-coherent simulation BER performance matches the theoretical equations derived in Proakis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I have to tweak in order to simulate coherent detection given that my received signal is perfectly synchronized?&lt;/p&gt;&#xA;" OwnerUserId="16489" LastActivityDate="2015-12-16T23:11:40.257" Title="How to do base-band simulation of coherent detection of M-ary orthogonal signals?" Tags="|digital-communications|demodulation|fsk|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27761" PostTypeId="2" ParentId="27752" CreationDate="2015-12-16T19:29:15.140" Score="4" Body="&lt;p&gt;Mostly yes, but it depends on the context. Let us elaborate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_cosine_transform#Formal_definition&quot; rel=&quot;nofollow&quot;&gt;DCT-II is one of the many forms&lt;/a&gt; of Discrete Cosine Transforms, and probably the  most widely used one, as it is (somehow) present in JPEG or MP3 formats. &quot;Lossy&quot; often refer to the compression standard which uses it, because the  main loss results from quantization (and generally not the transform by  itself). By itself, the transform is invertible, even more orthogonal or orthonormal, so in theory you have no loss (it is bijective). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @Fat32 points out, its coefficients sometimes involve cosines, hence irrational numbers (except at specific values) that are not easily  represented in finite arithmetic (float or int), and can induce round-off errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;DCT-II of size $1$ is $1$, DCT-II of size 2 (unnormalized) is: \begin{smallmatrix} 1 &amp;amp; 1 \\1 &amp;amp; -1\end{smallmatrix} so DCT-II can be lossless (in special cases though),&lt;/li&gt;&#xA;&lt;li&gt;For integer data (like images), it seems possible, with enough bit-depth computations (related to the initial integer range and the DCT size), to remain practically lossless, as you know that the  transform/inverse transform result should be integer,&lt;/li&gt;&#xA;&lt;li&gt;Very  accurate integer, or dyadic approximations exist, meant for integer hardware: for instance the &lt;a href=&quot;http://thanglong.ece.jhu.edu/Tran/Pub/binDCT.pdf&quot; rel=&quot;nofollow&quot;&gt;binDCT&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My final answer is thus: DCT-II is mostly lossless, if you take care of it.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-12-17T23:59:23.757" LastActivityDate="2015-12-17T23:59:23.757" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27762" PostTypeId="2" ParentId="27751" CreationDate="2015-12-16T19:32:24.020" Score="1" Body="&lt;p&gt;The structure tensor consists of first derivatives of the image. If the first derivative is high in one particular direction (one large eigenvalue of the structure tensor), then you have an edge. It the first derivative is high in two directions (two large eigenvalues), then you have a corner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hessian matrix consists of second derivatives. Think of the Laplacian. It is the trace of the Hessian, and it is a center-surround filter, which gives you a high absolute value for a bright blob surrounded by dark background or vice versa. That's why it is blob detector.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2015-12-16T19:32:24.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27763" PostTypeId="2" ParentId="26968" CreationDate="2015-12-16T20:05:01.080" Score="1" Body="&lt;p&gt;&lt;strong&gt;Theory behind it:&lt;/strong&gt; the additive Gaussian noise  can be related to &lt;a href=&quot;https://en.wikipedia.org/wiki/Image_noise#Types&quot; rel=&quot;nofollow&quot;&gt;(Johnson–Nyquist) thermal noise&lt;/a&gt; in standard images. For the  &lt;a href=&quot;http://www.laurent-duval.eu/Articles/Chaux_C_2010_inbook_wav_tdmi.pdf&quot; rel=&quot;nofollow&quot;&gt;denoising of more generic multivariate images&lt;/a&gt;, chapter 2.2.2 provides some references on why global noise present in acquired data can be realistically modelled by an additive zero-mean spatially white Gaussian noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Shot_noise&quot; rel=&quot;nofollow&quot;&gt;shot noise&lt;/a&gt; can be modeled as a Poisson process, that behaves, for large numbers, like a Gaussian noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other types of noises are observable in images: salt-and-pepper, quantization (more uniform), grain. In some image modalities, noise can be not stationary, multiplicative. &lt;strong&gt;They can be modeled by stochastic  processes in general&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gaussian noise is also widely used because it enjoys relatively tractable theories, related to least-square estimation. A very practical reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, however, that most images have 8-bit channells, with integer values in $[0,\ldots,255]$. hence, adding a Gaussian noise yields non-integer negative or values above 255, which is not  fully realistic: natural sampled  noise is  likely to be quantized in the  admissible values.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-12-17T07:57:52.440" LastActivityDate="2015-12-17T07:57:52.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27764" PostTypeId="1" CreationDate="2015-12-16T21:24:15.910" Score="3" ViewCount="283" Body="&lt;p&gt;I want to use FFTs to do seriously accurate interpolation on band-limited data.  To do that, I need to get a handle on the fundamental accuracy of the FFT() and IFFT() algorithms available.  My idea is to look at IFFT(FFT(X)) which should be a unit transformation.  I want to get the maximum difference between the input and output data down below the region of 1 part in 10^8 or even 10^9.  Currently I'm achieving ~1 part in 10^6 using 64-bit float, but I don't know if that is in line with what is to be expected.  I'm thinking that surely someone has done all this before.  Does anybody know the answers?  What can expect if I try using higher-precision data types?  With 64-bit float speed is not a concern.&lt;/p&gt;&#xA;" OwnerUserId="16190" LastActivityDate="2016-03-17T04:24:34.823" Title="Accuracy of IFFT(FFT(X)) unit transformation" Tags="|fft|audio|dft|ifft|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27766" PostTypeId="2" ParentId="27760" CreationDate="2015-12-16T23:11:40.257" Score="0" Body="&lt;p&gt;Since the answer was given by vaz in the comments I figured I would just post it as an actual answer...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To perform coherent detection for M-ary orthogonal signals in a complex base-band simulation simply take the &lt;strong&gt;real&lt;/strong&gt; part of each matched filter (correlator) output and select the symbol with the largest value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, don't make my mistake and use the absolute value of the real part.  I made those changes and verified against the theoretical coherent equations MATLAB uses.&lt;/p&gt;&#xA;" OwnerUserId="16489" LastActivityDate="2015-12-16T23:11:40.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27767" PostTypeId="1" AcceptedAnswerId="27769" CreationDate="2015-12-16T23:37:44.200" Score="1" ViewCount="347" Body="&lt;p&gt;dear friends of StackExchange. &#xA;I have a doubt of the intersection of two ROC. &#xA;I have H(Z), X(Z) and and i have to determine:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} Y(Z)= H(Z)X(Z)\end{align}$$&#xA;$$&#xA;\displaystyle&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ ROC $ H(Z)  $ \cap $ $ ROC $ X(Z)&lt;br&gt;&#xA;$$&#xA;\displaystyle&#xA;$$&#xA;poles of $H(Z): p1=  \left |  -\frac{1}{4}  \right | $ ; $p2= \left |  \frac{3}{2}  \right |$ &#xA;$$&#xA;\displaystyle&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system is supposed stable. Ops, sorry i forgot to write it in the initial post, under this assumption &#xA;the corresponding $ROC$ of $H(Z)$ is : &#xA;$$\begin{align} \quad&amp;amp;\ \left | \frac{1}{4} \right | &amp;lt;z&amp;lt;  \left | \frac{3}{2} \right | \end{align}$$&#xA;$$&#xA;\displaystyle&#xA;$$&#xA;  pole of $X(Z): p3=  \left |  2 \right |  $ $$ \displaystyle&#xA; $$&#xA;For stability condition:&#xA; $$\begin{align} \quad&amp;amp;\ z&amp;lt;  \left |2 \right | \end{align}$$&#xA;The intersection area is:&#xA;$$ \displaystyle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(Z):  ROC $ H(Z)  $ \cap $ $ ROC $ Y(Z) = $$\begin{align} \quad&amp;amp;\ \left | \frac{1}{4} \right | &amp;lt; \left |  z \right | &amp;lt; \left | \frac{3}{2} \right | \end{align}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i see it drawing the circumference and tracing the circumferences related to the poles and their corresponding ROC&#xA; .&lt;/p&gt;&#xA;" OwnerUserId="18327" LastEditorUserId="18327" LastEditDate="2015-12-18T08:50:43.680" LastActivityDate="2015-12-18T08:50:43.680" Title="doubt of intersection of ROC Z Transform" Tags="|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27768" PostTypeId="1" CreationDate="2015-12-17T00:44:56.657" Score="1" ViewCount="184" Body="&lt;p&gt;For a piece of software I've been working on lately I need to implement FFT convolution for performance reasons.&lt;/p&gt;&#xA;&lt;p&gt;Doing so has been mildly succesfull but there is still a error somewhere causing lots of small spikes to show up on the waveform. Also when looking at the spectrum of the signal, lots of distortion can be seen which is filtered out mostly at 15 KHz.&lt;/p&gt;&#xA;&lt;p&gt;What I do in the filter is the following with overlap - add:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create the filter kernel of 101 points and FFT it&lt;/li&gt;&#xA;&lt;li&gt;Create a buffer holding 200 samples of audio&lt;/li&gt;&#xA;&lt;li&gt;When there are 200 samples ready, FFT the signal and multiply with the filter kernel FFT.&lt;/li&gt;&#xA;&lt;li&gt;IFFT the filtered signal again&lt;/li&gt;&#xA;&lt;li&gt;Add last 100 samples from the previous run to the first 100 samples of the current output&lt;/li&gt;&#xA;&lt;li&gt;Save the last 100 samples for the next run.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The small spikes and distortion when looking at the spectrum seems to come from a missing sample somewhere, but I can't track down exactly where it happens.&lt;/p&gt;&#xA;&lt;p&gt;The following code is what I use to do the filtering:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;function TFFTAnalyzer.doAnalyzer(Sample: Single) : Single;&#xA;var&#xA;  I: Integer;&#xA;&#xA;  Temp : Single;&#xA;begin&#xA;  Result := X[BufferPos];&#xA;  X[BufferPos] := Sample;&#xA;&#xA;  BufferPos := BufferPos + 1;&#xA;  if BufferPos &amp;gt; 200 then&#xA;    BufferPos := 1;&#xA;&#xA;  if BufferPos = 200 then&#xA;  begin&#xA;    //Add 100 zeros&#xA;    for I := 0 to 512 do&#xA;    begin&#xA;      if I &amp;gt; 200 then&#xA;        X[I] := 0;&#xA;    end;&#xA;&#xA;    //Calculate the FFT of the sample buffer&#xA;    FFT_transform(1024, X);&#xA;&#xA;    I := 0;&#xA;&#xA;    while I &amp;lt;= 1024 do&#xA;    begin&#xA;      Temp := X[I] * FilterX[I] - X[I + 1] * FilterX[I + 1];&#xA;      X[I + 1] := X[I] * FilterX[I + 1] + X[I + 1] * FilterX[I]; // imaginary part&#xA;      X[I] := Temp; // real part&#xA;&#xA;      I := I + 2;&#xA;    end;&#xA;&#xA;    //Inverse FFT the signal&#xA;    FFT_inverse(1024, X);&#xA;&#xA;    //Overlap the first 100 samples&#xA;    for I := 0 to 100 do&#xA;    begin&#xA;      X[I] := (X[I] + Overlap[I]);// / 2;&#xA;    end;&#xA;&#xA;    //Save last 100 samples for next overlap&#xA;    for I := 200 to 300 do&#xA;    begin&#xA;      Overlap[I - 200] := X[I];&#xA;    end;&#xA;  end;&#xA;end;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QIjsi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QIjsi.png&quot; alt=&quot;This is the picture showing the problem&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the picture showing the problem with the spikes and distortion.&lt;/p&gt;&#xA;" OwnerUserId="18783" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-12-21T00:58:50.207" Title="FFT Convolution: missing sample somewhere" Tags="|fft|filters|convolution|finite-impulse-response|distortion|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27769" PostTypeId="2" ParentId="27767" CreationDate="2015-12-17T08:23:06.753" Score="1" Body="&lt;p&gt;In order to answer this question we would need to know the ROCs of $H(z)$ and $Y(z)$. The pole radii only determine the limits of the possible ROCs. E.g., for $H(z)$ there are three different possible ROCs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}1.\quad&amp;amp;|z|&amp;gt;\frac{3}{2}\\&#xA;2.\quad&amp;amp;\frac32&amp;gt;|z|&amp;gt;\frac14\\&#xA;3.\quad&amp;amp;|z|&amp;lt;\frac14\end{align}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $Y(z)$, there are two possible ROCs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}1.\quad&amp;amp;|z|&amp;lt;2\\&#xA;2.\quad&amp;amp;|z|&amp;gt;2\end{align}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that each of these ROCs corresponds to a different time domain sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Certain combinations of the ROCs in $(1)$ and $(2)$ overlap, others don't. Below are shown the combinations that result in an overlap of ROCs, and the resulting combined ROC. The first number is the number of the ROC of $H(z)$ given in $(1)$, the second number is the ROC of $Y(z)$ given in $(2)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}1+2:\quad&amp;amp;|z|&amp;gt;2\\&#xA;1+1:\quad&amp;amp;2&amp;gt;|z|&amp;gt; \frac32\\&#xA;2+1:\quad&amp;amp;\frac32&amp;gt;|z|&amp;gt;\frac14\\&#xA;3+1:\quad&amp;amp;|z|&amp;lt;\frac14\end{align}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other combinations of ROCs result in no overlap.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-17T08:23:06.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27770" PostTypeId="1" CreationDate="2015-12-17T09:22:53.080" Score="2" ViewCount="1011" Body="&lt;p&gt;The picture below is drawn by the DCT coefficients after making DCT to an image :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/x9wvf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/x9wvf.png&quot; alt=&quot;the DCT coefficients distribution if an image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get an image like the picture above. Here are some problems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Should I do the DCT to the whole image instead of using the block DCT? And what MATLAB function should I use?&lt;/li&gt;&#xA;&lt;li&gt;How to deal with the coefficients? Make it in the range of $[0, 255]$? Or make the coefficients matrix to be a Binary Image?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate if someone can help me!&lt;/p&gt;&#xA;" OwnerUserId="18732" LastEditorUserId="1629" LastEditDate="2016-03-16T11:54:23.190" LastActivityDate="2016-08-13T20:44:16.837" Title="How to get the DCT energy distribution image in MATLAB,or we may call it the DCT coefficients distribution image?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27771" PostTypeId="1" CreationDate="2015-12-17T09:39:46.140" Score="4" ViewCount="91" Body="&lt;p&gt;From &lt;a href=&quot;https://en.wikipedia.org/wiki/Gold_code&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;, I know that Gold codes have length $2^n-1$, where $n$ is number of LFSR elements and that there are $2^n-1$ different Gold sequences for this case. E.g. assuming that $n=6$, I have a Gold sequence with a length of $63$ bits. But how many users can I differentiate with this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the one hand I would have said that I can differentiate $2^{2^n-1}$, i.e. in this case $2^{63}$ users because there are $63$ bits that can either be $0$ or $1$. But on the other hand, wikipedia says there are only $2^n-1$ Gold sequences with that length which would imply that I can also serve $2^n-1$ users. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or the question asked the other way around: If I have to address $K$ users, each by means of an unique code, how many bits for the Gold codes do I need?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Moreover, I found this &lt;a href=&quot;http://www.wirelesscommunication.nl/reference/chaptr05/cdma/codes/gold.htm&quot; rel=&quot;nofollow&quot;&gt;page&lt;/a&gt; that says that there are only $6$ different Gold sequences with a length of $63$ bits.&lt;/p&gt;&#xA;" OwnerUserId="4518" LastEditorUserId="235" LastEditDate="2015-12-17T16:12:38.663" LastActivityDate="2015-12-17T16:12:38.663" Title="DSSS/CDMA: Number of distinguishable users with gold codes" Tags="|digital-communications|" AnswerCount="0" CommentCount="5" ClosedDate="2015-12-17T14:22:12.207" ContentLicense="CC BY-SA 3.0" />
  <row Id="27772" PostTypeId="2" ParentId="27770" CreationDate="2015-12-17T09:46:52.910" Score="2" Body="&lt;p&gt;The general shape of this  image can (probably) be obtained with Matlab function &lt;a href=&quot;http://fr.mathworks.com/help/images/ref/dct2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DCT2&lt;/a&gt; applied on the whole image (problem 1). I suspect this  image comes from the absolute of the  actual DCT matrix which generally has positive and negative values (problem 2). The absolute value was probably modified by a non-linear mapping, such as a logarithm or a power. The reason is you almost mostly black values on the bottom-right, probably zeroes at high frequencies. Would you have positive and negative values, this area could appear in mid-gray colors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The PNG file has 251 colors, so the  absolute DCT matrix  with real values was somehow rounded to 8 bits, possibly scaled, and not binarized. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On your question: How to deal with the coefficients? you should tell us what you would like to do apart from displaying  a grayscale absolute 2D DCT image. You can compute energy concentration in the DCT domain, or identify the two bright lines as two main orientations with high gradients on the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following code produces a similar image, depicted below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;parBoxCox = 0.15;&#xA;data = imread('gantrycrane.png');&#xA;dataTrans = (1+(abs(dct2(rgb2gray(data))))).^parBoxCox;&#xA;dataTrans = floor(dataTrans*255/max(dataTrans(:)));&#xA;imagesc(dataTrans);colormap gray&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xF4rH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xF4rH.png&quot; alt=&quot;DCT image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-08-13T20:44:16.837" LastActivityDate="2016-08-13T20:44:16.837" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27774" PostTypeId="2" ParentId="27750" CreationDate="2015-12-17T11:43:00.247" Score="3" Body="&lt;p&gt;That's the old question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say it's better, and wonder why, and everyone can only ask you to &lt;strong&gt;mathematically&lt;/strong&gt; define &lt;em&gt;better&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As soon as you &lt;em&gt;define&lt;/em&gt; a measure for processing quality, you will be able, typically with not too much linear algebra, derive based on the properties of your signal, your measure and your basis, why one is better than the other.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2015-12-17T11:43:00.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27775" PostTypeId="1" AcceptedAnswerId="27776" CreationDate="2015-12-17T11:56:30.310" Score="4" ViewCount="1340" Body="&lt;p&gt;As answered in &lt;a href=&quot;https://dsp.stackexchange.com/questions/21959/relationship-of-fourier-transform-and-spatial-directivity-pattern&quot;&gt;Relationship of Fourier Transform and Spatial Directivity Pattern&lt;/a&gt; the relation between directivity pattern and weights is given.  But I am bit confused, I have Beamformer weights (complex valued, for each frequency bin) for a particular steering vector. The relationship mentioned in the above link needs the values to be calculated for each theta, but the beamformer weights are for a particular steering angle theta.&#xA;Do I need to calculate beamformer weights for each of the theta, or I have a wrong understanding of the directivity pattern.&#xA;Suggest methods for calculating directivity using beamformer weights.&#xA;Thanks &lt;/p&gt;&#xA;" OwnerUserId="15911" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-05-20T09:36:07.277" Title="Calculating Beam pattern, Directivity of microphone array" Tags="|fft|audio|beamforming|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27776" PostTypeId="2" ParentId="27775" CreationDate="2015-12-17T14:09:55.877" Score="2" Body="&lt;p&gt;You choose the weights the steer the main beam of the antenna in the particular direction you want - let's call this $\theta_s$ i.e. steering angle. Now, given that you are steering the antenna in a given direction you are also interested in the array's response to incoming signals from other directions. This is the directivity pattern and is a function of the angle $\theta$ of the source signal. For conventional beamforming (non-adaptive) the magnitude of the directivity pattern will reach a maximum when $\theta_s=\theta$.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2015-12-17T14:09:55.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27778" PostTypeId="2" ParentId="25320" CreationDate="2015-12-17T15:26:47.657" Score="1" Body="&lt;p&gt;A quick rule-of-thumb to quickly assess short FIR  filters: if the sum of your coefficients is close to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, then the  filter preserves the constant signals (because  it will gives you the  gain at frequency 0 or  DC). And possibly preserves some other low-frequencies too. So it &lt;em&gt;may&lt;/em&gt; have a low-pass behavior.&lt;/p&gt;&#xA;&lt;p&gt;If the sum of the  odd coefficients minus the even coefficients is close to zero, the filter tends to attenuate high frequencies. So it &lt;em&gt;may&lt;/em&gt; have a high-cut behavior.&lt;/p&gt;&#xA;&lt;p&gt;What is in between is not known but this provides you with a first approximation. Other computations tell yoou if it  is somehow low-cut and high-pass.&lt;/p&gt;&#xA;&lt;p&gt;This is the  case for your first filter: sum &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, odd-even &lt;span class=&quot;math-container&quot;&gt;$ -0.0119$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Adding that it is symmetric, with triangular shape (up/down), the low-pass is likely, like a weighted average with decaying weights away from the center. And this can be checked (see Figure below).&lt;/p&gt;&#xA;&lt;p&gt;For the second one, this is more difficult: coefficients sum to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and the odd/even difference is quite high (&lt;span class=&quot;math-container&quot;&gt;$0.77$&lt;/span&gt;). But  if you look carefully, only one coefficient is big, the others are very small. So it looks like a unit pulse (&amp;quot;discrete dirac&amp;quot;), hence an all-pass behavior is possible, with a tiny little smoothing at high frequencies, as shown below..&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GoF20.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GoF20.png&quot; alt=&quot;Impulse and frequency responses&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But these are only rules of  thumbs, which turn out correct. I  can see no high-pass in your filters. If you combine then in 2D (left in Figure below), you are likely to smooth mostly in the direction of the first filter, like a &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}[1\,2\,1]^T$&lt;/span&gt; 3-tap Gaussian filter (right in Figure below):&lt;a href=&quot;https://i.stack.imgur.com/pH7xB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pH7xB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;.added&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2022-02-10T00:44:00.607" LastActivityDate="2022-02-10T00:44:00.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27779" PostTypeId="1" AcceptedAnswerId="27802" CreationDate="2015-12-17T18:24:01.133" Score="0" ViewCount="958" Body="&lt;p&gt;How can I design an all pass filter to have a constant phase shift over a bandwidth centered around a carrier? &#xA;I don't care about phase shift outside the band. &#xA;I would like to have the filter in time domain. This is not a straightforward job right?&#xA;Any keywords, design methods, external links are appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: i need it to be causal. Data comes in real time in time frames.&#xA;thanks &lt;/p&gt;&#xA;" OwnerUserId="14939" LastEditorUserId="14939" LastEditDate="2015-12-17T20:00:26.597" LastActivityDate="2015-12-18T20:12:45.177" Title="Filter Design for Phase Response" Tags="|filter-design|phase|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27784" PostTypeId="1" CreationDate="2015-12-17T19:04:13.193" Score="0" ViewCount="673" Body="&lt;p&gt;Using Matlab's FFT function, I am getting different Amplitude values in a particular frequeny, when I use different range of Bandpass filters centering around that particular frequency. What's wrong here? How can a particular Amplitude scale be selected? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following code, I calculated two FFTs of the same signal over the frequency range of (59Hz to 61Hz) and (59.98Hz to 60.02Hz) after bandpassing them in the said range. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[x_noise,fs] = audioread(h);&#xA;x_noise = x_noise(1:length(x_noise)/360); &#xA;xlen = length(x_noise);&#xA;x_main=x_noise;&#xA;&#xA;i=1;&#xA;%%&#xA;%Noise&#xA;f1=59;&#xA;f2=61;&#xA;fn=fs/2;&#xA;w1=f1/fn; &#xA;w2=f2/fn;&#xA;&#xA;[b,a]=butter(5,[w1 w2],'bandpass');&#xA;xn_har = filter(b,a,x_noise);&#xA;&#xA;%FFT of Noise&#xA;X_Noise = abs(fft(xn_har));&#xA; p = linspace(0,1000,length(X_Noise));&#xA; figure(1)&#xA; plot(p,X_Noise)&#xA;&#xA;%% &#xA;%Signal&#xA;f1_sig=59.98; &#xA;f2_sig=60.02;&#xA;w1_sig=f1_sig/fn;&#xA;w2_sig =f2_sig/fn;&#xA;&#xA;[b,a]=butter(5,[w1_sig w2_sig],'bandpass');&#xA;x_sig_har = filter(b,a,x_main);&#xA;&#xA;%FFT of Signal&#xA;X_sig = abs(fft(x_sig_har));&#xA;q = linspace(0,1000,length(X_sig));&#xA;figure(2)&#xA;plot(q,X_sig)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But after doing FFT, the Amplitude in 60Hz seems to vary a lot. As seen in the image, one has a value of around 1600, while the other has around 1.2. Why is this happening, they are at the same frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WgQyg.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WgQyg.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/6cQvA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6cQvA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18057" LastEditorUserId="11256" LastEditDate="2015-12-17T23:01:12.840" LastActivityDate="2015-12-17T23:18:06.660" Title="Scale of Amplitude in FFT (Matlab)" Tags="|matlab|fft|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27786" PostTypeId="1" CreationDate="2015-12-17T20:18:08.837" Score="2" ViewCount="2804" Body="&lt;p&gt;I am working with a signal that describes energy consumption in some house as a function of time and I am trying to find time intervals that correspond to some particular type of dish washer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do we know about this dish washer:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It has 4 heating pulses.&lt;/li&gt;&#xA;&lt;li&gt;Each pulse has amplitude around 2000 and lasts for at least 120 seconds.&lt;/li&gt;&#xA;&lt;li&gt;Heating pulses are not periodic.&lt;/li&gt;&#xA;&lt;li&gt;If there is such a dish washer it was used at least twice in a given period of time.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Question that I am trying to answer:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Was such a dish washer used in this house during given time interval?&lt;/li&gt;&#xA;&lt;li&gt;If yes, I would like to identify all time intervals when this happened.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Example:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kMHrg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kMHrg.png&quot; alt=&quot;Dish washer&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://drive.google.com/file/d/0ByATqxQWgjs9TENJZHpnc05NdlE/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;csv with whole signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I identified one occurrence of this dish washer, like on this figure and trying to find if there are other similar intervals. At the moment I am doing convolution of the whole signal with this dish washer signal and pick time intervals that give high convolution score. Problem is that signal is additive and if person is using other appliances at the same time I may get high score when there is no dish washer there and low score when it is.&lt;/p&gt;&#xA;" OwnerUserId="18660" LastEditorUserId="1629" LastEditDate="2016-06-16T00:13:42.637" LastActivityDate="2016-06-16T00:13:42.637" Title="Find reappearing pattern in the signal" Tags="|matlab|convolution|python|signal-detection|template-matching|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27787" PostTypeId="1" CreationDate="2015-12-17T20:24:39.520" Score="0" ViewCount="601" Body="&lt;p&gt;I know that If we are trying to sample frequencies above the Nyquist frequency, aliasing will occur, and the apparent frequency we get is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{alias}(N) = |f-Nf_{s}|$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f$ is the frequency of the signal we are trying to sample, $N$ is an integer and $f_s$ is the sampling frequency. However, does anyone have a link to a proof for this? I am sure there is something very intuitive behind this that I probably overlook, but if someone can either present a proof or link one to me, then I would really appreciate it!&lt;/p&gt;&#xA;" OwnerUserId="4637" LastActivityDate="2015-12-17T21:12:48.863" Title="Apparent frequency due to aliasing - proof" Tags="|sampling|aliasing|proof|" AnswerCount="0" CommentCount="3" ClosedDate="2015-12-18T11:48:25.683" ContentLicense="CC BY-SA 3.0" />
  <row Id="27789" PostTypeId="2" ParentId="27784" CreationDate="2015-12-17T23:18:06.660" Score="1" Body="&lt;p&gt;The problem is likely to be your filter. Designing a very narrow filter is very hard; a very large order is required and even then, some responses may simply be unrealizable. Note that &quot;narrow&quot; here is relative to the Nyquist frequency. I don't know what your sampling frequency is, but let's assume 8000 Hz. Run this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fn=4000;f1=59;f2=61;w1=f1/fn;w2=f2/fn;&#xA;b=butter(5,[w1 w2],'bandpass');&#xA;freqz(b);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The command &lt;code&gt;freqz&lt;/code&gt; plots the actual frequency response of the filter that was returned by &lt;code&gt;butter&lt;/code&gt;. It is very important &lt;em&gt;always&lt;/em&gt; to verify that your filters' response resemble what you had in mind -- that is, that they meet your requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got slightly better results using &lt;code&gt;fir1&lt;/code&gt; instead of &lt;code&gt;butter&lt;/code&gt;. However, in your case, what I would try to do is to downsample the signal so that, relative to the Nyquist frequency, the filter is not too narrow. To see the effect, run this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fn=120;&#xA;f1=59;f2=61;w1=f1/fn;w2=f2/fn;&#xA;b=fir1(200,[w1 w2],'bandpass');&#xA;freqz(b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You'll see a nice, narrow response with 0 dB gain at the center frequency and around -70 dB rejection out of band.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2015-12-17T23:18:06.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27790" PostTypeId="1" AcceptedAnswerId="27814" CreationDate="2015-12-18T02:04:20.420" Score="1" ViewCount="1103" Body="&lt;p&gt;I have a pulse train of a fixed period, but a random amplitude following a Gaussian distribution $(\mu=0,\sigma=1)$. I know how to work with a random period or delay, but how do I proceed to calculate the autocorrelation with a random amplitude?&lt;/p&gt;&#xA;" OwnerUserId="18794" LastEditorUserId="80" LastEditDate="2016-01-19T19:55:05.887" LastActivityDate="2016-01-19T19:55:05.887" Title="How do I calculate the autocorrelation of a train pulse having only the pdf?" Tags="|autocorrelation|gaussian|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27791" PostTypeId="1" AcceptedAnswerId="27800" CreationDate="2015-12-18T03:15:58.770" Score="0" ViewCount="406" Body="&lt;p&gt;I and my friend have different answer for this block diagram&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/didS5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/didS5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mine:&#xA;$$y[n] = -\frac23x[n] + x[n-1] -\frac12[n-2]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{1}{-\frac23 + z^{-1} -\frac12z^{-2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My friend:&#xA;$$q[n]=x[n]-\frac12q[n-1]$$&#xA;$$y[n] = -\frac23x[n]+q[n-1]$$&#xA;$$Y(z) = \frac23X(z)+z^{-1}Q(z)=\frac23X(z)+z^{-1}\frac{X(z)}{1+\frac12z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y(z)}{X(z)}=\frac23+\frac{z^{-1}}{1+\frac12z^{-1}} = \frac{4z^{-1}+2}{3+\frac32z^{-1}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how can he come to that result but I'm not sure about mine either &lt;/p&gt;&#xA;" OwnerUserId="18328" LastEditorUserId="4298" LastEditDate="2021-03-07T11:14:49.473" LastActivityDate="2021-03-07T11:14:49.473" Title="What is the transfer function of this block diagram" Tags="|discrete-signals|z-transform|transfer-function|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27792" PostTypeId="2" ParentId="25332" CreationDate="2015-12-18T12:02:19.047" Score="1" Body="&lt;p&gt;You can also use Automatic Gain Control(AGC), for such kind of scenarios where there is huge difference in magnitude.I think this matlab script might be usefull - &lt;a href=&quot;http://in.mathworks.com/matlabcentral/fileexchange/11202-automatic-gain-control&quot; rel=&quot;nofollow&quot;&gt;http://in.mathworks.com/matlabcentral/fileexchange/11202-automatic-gain-control&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2015-12-18T12:02:19.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27793" PostTypeId="2" ParentId="27791" CreationDate="2015-12-18T12:45:32.047" Score="1" Body="&lt;p&gt;Your friend is correct. You have a feedback loop inside the block diagram so you need to introduce another state variable q[n], which in this case is the signal right after the first summing mode. You could also choose the one after the delay block but the result would be the same.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-12-18T12:45:32.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27794" PostTypeId="2" ParentId="27791" CreationDate="2015-12-18T12:45:58.010" Score="1" Body="&lt;p&gt;Aukxn: Your friend represented the output of the first adder as $q[n]$ and then he wrote his $q[n]$ and $y[n]$ equations. The center part of his $Y(z)$ equation is the z-transform of his $y[n]$ equation. In that center part he has a $Q(z)$ term. He replaced that $Q(z)$ term with the z-transform of his $q[n]$ equation in order to produce the right side of his $Y(z)$ equation. Next he wrote $H(z)=\frac{Y(z)}{X(z)}$ as the sum of two ratios. Finally he put the numerators of the two ratios over a common denominator to produce the right side of his $H(z)$ equation. I'm willing to bet a pint of pale ale that your friend's $H(z)$ expression is correct.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-18T12:45:58.010" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27795" PostTypeId="1" AcceptedAnswerId="27798" CreationDate="2015-12-18T13:13:05.223" Score="0" ViewCount="162" Body="&lt;p&gt;Do we need minus or not?&#xA;I need to extract phase spectrum from that thing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x) = \frac{1}{2\pi}\int_{-\infty}^{\infty} e^{i\omega x}d\omega\int_{-\infty}^{\infty}f(t)e^{-i\omega t}dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can do it by taking Fourier Transform of $f(x)$, right? And phase spectrum will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S(\xi)=\int_{-\infty}^{\infty}f(x)e^{-i\xi x}dx $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Phi (\xi)=-\mathrm{arg}\,S(\xi)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found that in book, but don't understand do we need minus&#xA; before arg or not? I'm looking on different plots and some sources plotting with minus and some without. Help me please&lt;/p&gt;&#xA;" OwnerUserId="18799" LastEditorUserId="8202" LastEditDate="2015-12-18T13:38:51.763" LastActivityDate="2015-12-18T13:50:51.900" Title="Phase spectrum: $\mathrm{arg}\mathcal{F}(\omega)$ or $\mathrm{-arg}\mathcal{F}(\omega)$?" Tags="|fourier-transform|frequency-spectrum|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27796" PostTypeId="2" ParentId="27786" CreationDate="2015-12-18T13:23:32.160" Score="2" Body="&lt;p&gt;Vladimir: You're trying to detect a certain sample pattern (a certain sequence of sample values) within a longer discrete sequence of input samples. This sounds liked a &quot;matched filter&quot; problem to me. If the pattern of samples you're trying to detect is the samples in the red shaded region of your diagram then performing convolution seems like a smart thing to try first before you explore more exotic signal detection algorithms. By convolution I mean an implementation where you pass your long input sequence of values through a tapped-delay line FIR filter. But be &lt;em&gt;careful&lt;/em&gt;! You must make sure that the coefficients of the tapped-delay line filter are a &quot;flipped in time&quot; (reversed in time order) version of the sequence you're trying to detect. &lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-18T13:23:32.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27798" PostTypeId="2" ParentId="27795" CreationDate="2015-12-18T13:50:51.900" Score="0" Body="&lt;p&gt;Both definitions are common. However, if you talk about the &lt;em&gt;phase&lt;/em&gt;, then what is usually meant is the (frequency dependent) phase angle $\phi(\omega)$ of the Fourier transform $F(\omega)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=|F(\omega)|e^{j\phi(\omega)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The negative phase $\beta(\omega)=-\phi(\omega)$ is often called the &lt;em&gt;phase shift&lt;/em&gt; or &lt;em&gt;phase lag&lt;/em&gt;. It is commonly used together with the &lt;em&gt;attenuation&lt;/em&gt; $\alpha(\omega)$, which is the negative natural logarithm of $|F(\omega)|$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha(\omega)=-\log (|F(\omega)|)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=e^{-(\alpha(\omega)+j\beta(\omega))}\tag{3}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-18T13:50:51.900" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27800" PostTypeId="2" ParentId="27791" CreationDate="2015-12-18T16:44:44.083" Score="2" Body="&lt;p&gt;As pointed out in the other answers, your friend's approach is correct. However, his end result for $H(z)$ isn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $q[n]$ the input signal of the delay element, you get $q[n-1]$ at its output, and the given difference equation for $q[n]$ follows easily. The output $y[n]$ can then be written in terms of $x[n]$ and $q[n-1]$. In the $\mathcal{Z}$-transform domain you get algebraic equations in terms of $X(z)$, $Q(z)$, and $Y(z)$, from which you can eliminate $Q(z)$, leaving you with an expression for $H(z)=Y(z)/X(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y(z)}{X(z)}=-\frac23+\frac{z^{-1}}{1+\frac12 z^{-1}}=-\frac23\frac{1-z^{-1}}{1+\frac12 z^{-1}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it was basically just a sign error that messed up the end result.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-18T16:44:44.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27802" PostTypeId="2" ParentId="27779" CreationDate="2015-12-18T17:30:40.710" Score="0" Body="&lt;p&gt;It's instructive to see what an ideal filter adding a constant phase shift would look like. If $\theta$ is the desired phase shift, the corresponding ideal frequency response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\begin{cases}e^{-j\theta}&amp;amp;,\quad 0&amp;lt;\omega&amp;lt;\pi\\&#xA;e^{j\theta}&amp;amp;,\quad-\pi&amp;lt;\omega&amp;lt;0\end{cases}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the sign function $\text{sign}(\omega)$, the frequency response $(1)$ can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\cos\theta-j\,\text{sign}(\omega)\sin\theta,\quad -\pi&amp;lt;\omega &amp;lt;\pi\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the DTFT correspondence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-j\,\text{sign}(\omega)\Longleftrightarrow g[n]=\begin{cases}\frac{2}{\pi n},&amp;amp;\quad n\text{ odd}\\&#xA;0,&amp;amp;\quad n\text{ even}\end{cases}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the impulse response corresponding to $H(e^{j\omega})$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=\cos\theta\cdot\delta[n]+\sin\theta\cdot g[n]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $g[n]$ is the sequence on the right-hand side of Eq. $(3)$, which is the impulse response of an ideal discrete-time Hilbert transformer. Eq. $(4)$ shows that an ideal phase shifter can be implemented as a weighted parallel connection of a wire ($\cos\theta\cdot\delta[n]$) and a Hilbert transformer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your problem can be solved by using any of the many available designs of discrete-time Hilbert transformers. Note that you can get much better performance for a given filter order by taking into account that the approximation needs only be accurate in the given frequency band. For a frequency-domain design method this just means that in the formulation of the desired response given in $(1)$ you replace the positive frequencies by the frequency interval of interest and leave the rest as a &quot;don't care&quot; region. The same is done for the negative frequencies.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-18T20:12:45.177" LastActivityDate="2015-12-18T20:12:45.177" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27803" PostTypeId="1" AcceptedAnswerId="27805" CreationDate="2015-12-18T17:45:41.400" Score="0" ViewCount="41" Body="&lt;p&gt;everyone&#xA;i m trying write higher order butterworth algorithm in c++.I can compute nominator and denominator second order. So i tell myself , i can cascade struct for higher order. But there is between factor two cascade and fourth order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;second order nominator a = [0,0976307608403291 0,195261521680658   0,0976307608403291]&lt;/code&gt; , &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;denominator b = [1 -0,942806027702107   0,333329071063423]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when i do conv(a,a) in matlab result is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;new_a  = [0,00953176546226155   0,0381270618490462  0,0571905927735693  0,0381270618490462  0,00953176546226155]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but i get this coeffs when i do butter func in matlab&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;butter_a = [0,0102094807912031    0,0408379231648125  0,0612568847472187  0,0408379231648125  0,0102094807912031]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;maybe you see that between constant factor butter_a and new_a and it is 1.071 like that. I wonder what is that and how can i compute this variable for more than one cascading struct ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;sorry for my bad language&lt;/p&gt;&#xA;" OwnerUserId="17615" LastActivityDate="2015-12-18T18:28:52.120" Title="There is a mysterious factor when compute coeffiencts" Tags="|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27804" PostTypeId="2" ParentId="19755" CreationDate="2015-12-18T18:00:18.097" Score="1" Body="&lt;p&gt;I did some experiments. Equalizing, then compressing, resulted in a nearly 50% larger file.  Normalizing increased the filesize but not so much.  Normalizing, then equalizing, also increased the filesize by nearly 50%. All are JPEG quality 50, created with ImageMagick:&#xA;&lt;hr&gt;&#xA; - left: original (4540 bytes); right normalized (5467 bytes):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l9uhi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l9uhi.jpg&quot; alt=&quot;original.JPG&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/82D5h.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/82D5h.jpg&quot; alt=&quot;normalized.JPG&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;- left: equalized (7444 bytes); right: normalized, then equalized (7251 bytes)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yJoIU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yJoIU.jpg&quot; alt=&quot;equalized.JPG&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ce3B9.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ce3B9.jpg&quot; alt=&quot;normalized+equalized.JPG&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8330" LastActivityDate="2015-12-18T18:00:18.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27805" PostTypeId="2" ParentId="27803" CreationDate="2015-12-18T18:28:52.120" Score="0" Body="&lt;p&gt;It sounds like you're comparing the coefficients for two different filters:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A fourth-order Butterworth filter designed for cutoff frequency $f_c$&lt;/li&gt;&#xA;&lt;li&gt;A cascade of two second-order Butterworth filters, each designed for cutoff frequency $f_c$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The two are not equivalent to one another, although in the passband and stopband you will see similar magnitude responses. Specifically, at the cutoff frequency $f_c$, you'll see 6 dB of attenuation from filter #1, while filter #2 would give you 12 dB. Therefore, it's not unexpected that you would get slightly different coefficients for the two implementations.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2015-12-18T18:28:52.120" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27806" PostTypeId="2" ParentId="19755" CreationDate="2015-12-18T18:41:55.220" Score="1" Body="&lt;p&gt;Equalization of an image tends to increase its sharpness, high frequency content, dynamic range and level utilization which are fundamentally against the compression algorithm that seeks longer zero valued quantized samples to group under a given huffman code... Hence as less number of samples fit into a group (inside a block) more bits are necessary to define that block resulting in increase of size of the file for example.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-12-18T18:41:55.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27807" PostTypeId="1" CreationDate="2015-12-18T18:43:23.957" Score="1" ViewCount="588" Body="&lt;p&gt;If I have a length $N$ signal and ask Matlab for an $M$-point FFT, $M \gg N$, of course the computer has to allocate memory for $M$ output samples, but my question is if it ever has to allocate memory for $M$ &lt;em&gt;input&lt;/em&gt; and fill it with the input vector along with zeros? Or are FFT algorithms capable of generating the $M$-point result without having to explicitly store the $M$-length padded input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;Motivation&lt;/strong&gt; I have a library that can automatically give me zero-padded data (or unpadded data), which I then perform FFTs on. Assume everything before the result of this library call has already happened, and we only care about what we do once those results (padded or unpadded) are available. If Matlab or FFTW don't need to explicitly allocate $M$-long zero-padded inputs to the FFT, then I'd be wasting memory by asking the library to zero-pad for me, and should just ask it for unpadded data.)&lt;/p&gt;&#xA;" OwnerUserId="4621" LastActivityDate="2022-08-05T07:13:35.737" Title="When I ask Matlab for a zero-padded FFT, does it (or FFTW) ever explicitly create a zero-padded input vector?" Tags="|matlab|fft|zero-padding|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27808" PostTypeId="2" ParentId="19755" CreationDate="2015-12-18T22:31:33.613" Score="1" Body="&lt;p&gt;&quot;I also know the jpeg reduces the size of the image by removing the high frequencies from the frequency domain&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not exactly, it often reduces accuracy in the frequency domain, even more in the highest frequencies (due to the quantization tables), but not only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are trying to  do makes sense in one context: you have a fixed quality JPEG system, and you want to acquire images with low contrast, or tiny details, that would be lost with standard JPEG. Then you can amplify the  data first, then compress, because this would preserve some details that  would have been lost otherwise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there is not free lunch in general: you will loose quality on other aspects. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-02-17T03:24:03.103" LastActivityDate="2016-02-17T03:24:03.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27809" PostTypeId="2" ParentId="27807" CreationDate="2015-12-19T07:26:03.353" Score="1" Body="&lt;p&gt;There is an FFT trick to perform a $2N$-point FFT on $2N$ real-only input samples using a single complex $N$-point FFT operation. But I've never heard of performing an $M$-point FFT on $N$ input samples &lt;em&gt;without&lt;/em&gt; zero padding the input sequence out to length $M$. Ahmed, if you can develop a way to do that you would become famous and someone would write a song about you.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-19T07:26:03.353" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27810" PostTypeId="1" CreationDate="2015-12-19T07:50:23.000" Score="4" ViewCount="3644" Body="&lt;p&gt;Here are three problems that I can't understand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Usually what does de-correlation mean in image-processing?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What's the benefit of de-correlation when it comes to image splicing?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there some relationship among neighbouring coefficients? And I read a paper which says coefficients difference matrix(got by coefficients subtracting its neighbor) can eliminate the relationship of the coefficients，How to understand this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate if someone can help me!&lt;/p&gt;&#xA;" OwnerUserId="18732" LastEditorUserId="18732" LastEditDate="2015-12-19T13:31:14.427" LastActivityDate="2020-07-02T14:10:13.783" Title="How to understand the de-correlation property of DCT? What does de-correlation mean?" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27811" PostTypeId="2" ParentId="27810" CreationDate="2015-12-19T09:39:54.723" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The term &amp;quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Decorrelation&quot; rel=&quot;nofollow noreferrer&quot;&gt;decorrelation&lt;/a&gt;&amp;quot; generally accounts for processing that reduce autocorrelation within single, or cross-correlation within a group of  signals or  images. Doing that, it should preserve important features in the  data.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In other terms, images often contains simpler &amp;quot;objects&amp;quot; (in terms of  morphology: bumps, edges, textures) that are mixed, or distorted. Generally, unmixing them via decorrelation somehow simplify further processing.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generally yes, unless you have uncorrelated noise in your images. A classical and simple model is an &lt;a href=&quot;http://www.gaussianprocess.org/gpml/chapters/RWB.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;order-one Markov or autoregressive process&lt;/a&gt;. Basically a pixel somehow  depends (with a parameter &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;) on the past pixel, with uncertainty. If &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is close to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, you are already decorrelated. If &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is close to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (typically &lt;span class=&quot;math-container&quot;&gt;$0.90-0.95$&lt;/span&gt;), the  data is quite correlated.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The DCT was meant for diagonalizing the  resulting autocovariance matrices with  &lt;a href=&quot;https://en.wikipedia.org/wiki/Toeplitz_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toeplitz&lt;/a&gt; structure, to give fast estimates of their eigenvectors. Transforming a fat autocovariance matrix into a thin, close to a diagonal, matrix is an instance of decorrelation.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="32876" LastEditDate="2020-07-02T14:10:13.783" LastActivityDate="2020-07-02T14:10:13.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27814" PostTypeId="2" ParentId="27790" CreationDate="2015-12-19T14:40:22.543" Score="2" Body="&lt;p&gt;Suppose that your pulse train is denoted $X(t) = Y\cdot g(t)$ where&#xA;where $g(t)$ is the basic pulse train and $Y$ is the random&#xA;amplitude of the pulse train.  Then, $X(t)$ is not a &#xA;wide-sense-stationary process and its autocorrelation function is&#xA;$$R_X(t_1,t_2) = E[X(t_1)X(t_2)] = E[Y^2]\cdot g(t_1)g(t_2).$$&#xA;If $Y$ has mean $\mu$ and variance $\sigma_2$, then &#xA;$E[Y^2] = \mu^2+\sigma^2$.  If $g(t)$ is a function of period $T$,&#xA;that is, $g(t) = g(t+T)$ for all $t$, then $R_X(t_1,t_2)$ is&#xA;periodic in both arguments:&#xA;\begin{align}&#xA;R_X(t_1+T,t_2) &amp;amp;= (\mu^2+\sigma^2)g(t_1+T)g(t_2) &#xA;= (\mu^2+\sigma^2)g(t_1)g(t_2) = R_X(t_1,t_2)\\&#xA;R_X(t_1,t_2+T) &amp;amp;= (\mu^2+\sigma^2)g(t_1)g(t_2+T) &#xA;= (\mu^2+\sigma^2)g(t_1)g(t_2) = R_X(t_1,t_2)&#xA;\end{align}&#xA;I am quite sure that this is not what you hoped to hear and so you&#xA;must revise your question appropriately, giving more details and&#xA;describing more clearly what it is you want to find out.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-12-19T14:40:22.543" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27816" PostTypeId="1" CreationDate="2015-12-19T16:15:28.247" Score="1" ViewCount="277" Body="&lt;p&gt;I'm asked to find the phasor of this signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_1[n] = 3\sin\left(\frac \pi7 n\right) + 4j\cos\left(\frac \pi7 n\right),\quad (0\le  n \le 20) \,.$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phasor is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ G z_{0}^{n}= Ae^{j\varphi}\cdot r^{n}\cdot e^{j\theta*n} = Ar^{n}[\cos(\theta n+\varphi)+ j\sin(\theta n+\varphi)] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I really don't know how to make the conversion! I mean, one of them has a radius of 3, the other is 4. How can I do this? &lt;/p&gt;&#xA;" OwnerUserId="18812" LastEditorUserId="13309" LastEditDate="2016-02-18T13:30:00.767" LastActivityDate="2016-04-18T14:13:47.427" Title="Phasor notation of a complex number with apparently non-constant radius" Tags="|matlab|phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27817" PostTypeId="1" CreationDate="2015-12-19T16:31:36.613" Score="1" ViewCount="132" Body="&lt;p&gt;I have an $n \times n$ matrix and I would like its columns and rows to have $\ell_2$ norm equal to $\sqrt{n}$. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="17018" LastEditorUserId="21075" LastEditDate="2017-10-14T21:47:07.850" LastActivityDate="2017-10-15T11:18:45.860" Title="How to make the $\ell_2$ norm of all columns and rows of an $n \times n$ matrix equal to $\sqrt{n}$?" Tags="|matrix|math|linear-algebra|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27818" PostTypeId="1" AcceptedAnswerId="27821" CreationDate="2015-12-19T17:02:20.463" Score="2" ViewCount="431" Body="&lt;p&gt;This question is directly related to digital signal processing, so I am asking here.&lt;/p&gt;&#xA;&lt;p&gt;How to sketch frequency response obtained from &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I'm adding an example and its solution below. I did not understand some of the things for question 7.4, part D.&lt;/p&gt;&#xA;&lt;p&gt;Any help is appreciated!&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There are three points in graph. How and why the second from left is placed there? What's its purpose?&lt;/li&gt;&#xA;&lt;li&gt;I have no idea how phase graph is created. What is the relation between x and y axis? What do they actually represent?&lt;/li&gt;&#xA;&lt;li&gt;Why the book says &amp;quot;give me function of frequency&amp;quot; but the solution has &lt;span class=&quot;math-container&quot;&gt;$\omega/2\pi$&lt;/span&gt; in x-axis?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Question 7.4:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;An LTI system is described by the difference equation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = \frac{1}{3}(x[n]+x[n-1]+x[n-2]) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;a. Determine the system function &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt; for this system.&lt;/p&gt;&#xA;&lt;p&gt;b. Plot&#xA;the poles and zeros of &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt; in the z-plane.&lt;/p&gt;&#xA;&lt;p&gt;c. From &lt;span class=&quot;math-container&quot;&gt;$H(z)$&lt;/span&gt; obtain&#xA;an expression for &lt;span class=&quot;math-container&quot;&gt;$H(e^{j\hat{\omega}})$&lt;/span&gt;, the frequency response of&#xA;this system&lt;/p&gt;&#xA;&lt;p&gt;d. Sketch the frequency response (magnitude and phase)&#xA;as function of frequency for &lt;span class=&quot;math-container&quot;&gt;$-\pi \le \hat{\omega} \le\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;e.&#xA;What is the output if the input is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x[n]=4+\cos[0.25\pi(n-1)]-3\cos[(2\pi/3)n] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Solution:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gWtmU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gWtmU.png&quot; alt=&quot;http://i.imgur.com/51gJPUy.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18813" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-12-19T23:44:23.270" Title="Is the book wrong? -- How to sketch frequency response obtained from H(z)?" Tags="|discrete-signals|frequency|continuous-signals|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27819" PostTypeId="1" CreationDate="2015-12-19T17:53:03.870" Score="0" ViewCount="110" Body="&lt;p&gt;GOAL:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to approximate some positive, scalar function, $f(x,y) &amp;gt; 0$, on a 2D field of finite size i.e. $x=[a,b],y=[c,d]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OBSTACLE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am familiar with the set of basis functions used in the Fourier series but using the Fourier series requires too many terms. Infinitely many:)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, I desire to find a collection of functions that can be used to approximate $f(x,y)$ with a &quot;finite&quot; number of terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;QUESTION:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I approximate $f(x,y)$ with a collection of functions $G(x)$ and $H(y)$ (see definition of $G$ and $H$ below), such that the number of elements in $G$ or $H$ is finite?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(x) = [g_1(x)\ldots g_n(x)]\\&#xA;H(y) = [h_1(y)\ldots h_n(y)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The elements in $G$ and $H$ do not have to be of the same form ($g_1(x)=\sin(nx),g_2(x)=\sin(mx)$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance:)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should clarify that $G(x)$ and $H(y)$ need to be combined in an inner product fashion i.e. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x,y) = &amp;lt; G(x),H(y) &amp;gt; = g_1(x)h_1(y) + g_2(x)h_2(y) + ... g_n(x)h_n(y)$$&lt;/p&gt;&#xA;" OwnerUserId="18815" LastEditorUserId="1629" LastEditDate="2016-01-20T19:47:13.170" LastActivityDate="2018-02-21T10:21:18.187" Title="How to choose basis functions that contribute most efficiently per term to an approximation of an image f(x,y)?" Tags="|image-processing|image-compression|approximation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27821" PostTypeId="2" ParentId="27818" CreationDate="2015-12-19T21:30:27.363" Score="4" Body="&lt;p&gt;As far as I can tell, the book is not wrong. (By the way, you're studying a &lt;em&gt;3-point moving average&lt;/em&gt; filter here, and it's useful to know about such filters.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your 1st question: That center dot on the Mag. and Phase curves serves no purpose that I can see. I suggest you not worry about that center dot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your 2nd question: The Phase curve is generated by evaluating the angle of the  $e^{-j\hat{\omega}}$ &lt;em&gt;phase term&lt;/em&gt;, in the last line of the $H(\hat{\omega})$ expression in Part (c) of the Solution, as $\hat{\omega}$ goes from $-\pi$ to +$\pi$. As $\hat{\omega}$ goes from $-\pi$ to +$\pi$, the Solution's $\hat{\omega}/2\pi$ Phase curve freq axis label goes from -0.5 to +0.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note: as you study the Solution know that the $H(z)$ in Part (c) is &lt;em&gt;not&lt;/em&gt; the $H(z)$ in Part (b). The $H(z)$ in Part (c) is the $H(z)$ from the Solution's Part (a).) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your 3rd question: It's a good question. In the literature of DSP there are a number of different notations (different symbols with different dimensions) used to represent frequency. And those various notations certainly can be confusing at first. mmswe, have a look at the following web page, it might help you with your 3rd question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/showarticle/199.php&quot; rel=&quot;noreferrer&quot;&gt;http://www.dsprelated.com/showarticle/199.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-19T21:30:27.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27822" PostTypeId="2" ParentId="27816" CreationDate="2015-12-19T22:14:42.257" Score="1" Body="&lt;p&gt;&lt;strong&gt;Hint&lt;/strong&gt;: a phasor is defined by its magnitude and phase. The magnitude can be obtained by computing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ &#xA;    \sqrt{\left(\mathcal{Re}\left\{x_1[n]\right\}\right)^2 &#xA;      + \left(\mathcal{Im}\left\{x_1[n]\right\}\right)^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the phase can be obtained with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;    \tan^{-1}{\frac{\mathcal{Im}\left\{x_1[n]\right\}}{\mathcal{Re}\left\{x_1[n]\right\}}}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="1629" LastEditDate="2016-02-18T11:50:37.870" LastActivityDate="2016-02-18T11:50:37.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27824" PostTypeId="1" CreationDate="2015-12-19T23:14:42.220" Score="1" ViewCount="533" Body="&lt;p&gt;I had some success with feature-based methods for image registration, but these methods are sometimes unsuitable (e.g. images containing repetitive patterns, very low contrast, low texture, no edges/corners).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am therefore looking for a direct (pixel-based) global alignment alternative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I looked on algorithms like Horn-Schunck, Lucas-Kanade, ECC but all the examples show only images with very small displacement (few pixels at most).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any direct (pixel-based) method for registering images with a displacement of 200 pixels or more (in any direction)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I am using &lt;strong&gt;simple template matching with exhaustive search over possible image shifts&lt;/strong&gt; and Normalised Cross-Correlation error metric, which works, but it is extremely slow (basically $O(n^4)$) and does not allow for rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any faster methods allowing large image shifts/rotations?&lt;/p&gt;&#xA;" OwnerUserId="1031" LastActivityDate="2015-12-20T00:11:00.510" Title="Are there any template matching / optical flow algorithms for large image displacement?" Tags="|image-registration|template-matching|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27825" PostTypeId="2" ParentId="27824" CreationDate="2015-12-20T00:11:00.510" Score="2" Body="&lt;p&gt;I personally like &lt;a href=&quot;http://cs.brown.edu/~dqsun/pubs/cvpr_2010_flow.pdf&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;. It is nicely designed for occlusions and large displacements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, recent trends in deep learning lead to better results in optical flow such as &lt;a href=&quot;https://www.google.de/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0ahUKEwiGyKKPk-nJAhXovXIKHYeLCasQFggoMAA&amp;amp;url=https%3A%2F%2Fvision.in.tum.de%2F_media%2Fspezial%2Fbib%2Fflownet-iccv-15.pdf&amp;amp;usg=AFQjCNEZblXnPFSiSZVYpCmXBdY0Usk6KQ&amp;amp;sig2=6O8iU-xlHTcGqJrP-qgX3w&amp;amp;cad=rja&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://www.robots.ox.ac.uk/~vgg/rg/papers/DeepFlow_iccv2013.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2015-12-20T00:11:00.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27827" PostTypeId="1" AcceptedAnswerId="27847" CreationDate="2015-12-20T01:06:59.243" Score="3" ViewCount="208" Body="&lt;p&gt;I have taken a basic course or two in signal processing and I've seen the Nyquist sampling theorem - an interesting and surprising result giving sufficient conditions for reconstruction of a reasonably regular signal in terms of spectral support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was told there are many much deeper results in this field than this canonical theorem. Unfortunately, I find the literature rather inaccessible. Hence, I'm asking here for examples of deep results in sampling theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am most interested in results which rely on other branches of mathematics, namely topology and algebraic geometry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the question is vague but also think that it is clear enough to give answers to. I don't mind making this a community wiki since it has no single correct answer.&lt;/p&gt;&#xA;" OwnerUserId="18390" LastActivityDate="2022-08-24T06:43:02.260" Title="What are some deep results in sampling theory?" Tags="|sampling|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27829" PostTypeId="2" ParentId="27807" CreationDate="2015-12-20T05:20:26.773" Score="1" Body="&lt;p&gt;After reviewing the butterfly structure employed in FFT, it looks like explicit zero-padding or increasing the memory allocation at the input is required. For example, in zero-padding a N-point FFT to a M-point FFT, say N=6 and M=8. As shown in the FFT algorithm with the basic butterfly computation below. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/gL3pw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gL3pw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We will need to explicitly zero-padded the sequence as shown in the figure. Despite x(6) and x(7) are just zeros (the zero-padded coefficients), their memory locations will eventually be used to hold X(3) and X(7) respectively, and they will become non-zero quickly after the first stage (assuming x(2) &amp;amp; x(3) are both non-zero). My assumption is, the output of the FFT overwrites the input though.&lt;/p&gt;&#xA;" OwnerUserId="18820" LastActivityDate="2015-12-20T05:20:26.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27830" PostTypeId="1" CreationDate="2015-12-20T07:21:54.927" Score="1" ViewCount="254" Body="&lt;p&gt;I have a signal as the below figure. I am looking for some schemes to approximate the signal. I have found some ways for that task: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using basis function (polynomial) to approximate the signal &lt;/li&gt;&#xA;&lt;li&gt;Divide the signal to many subrange, and assume that the signal in the range is constant.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Could you suggest to me the other way to approximate the signal? Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ydBUQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ydBUQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10792" LastActivityDate="2015-12-21T07:52:23.007" Title="How can I approximate a signal" Tags="|image-processing|signal-analysis|computer-vision|continuous-signals|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27831" PostTypeId="1" CreationDate="2015-12-20T08:43:58.490" Score="1" ViewCount="165" Body="&lt;p&gt;Here are some problems:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does it mean these is some relationship among neighboring pixels?&lt;/li&gt;&#xA;&lt;li&gt;I've read about DCT has a property of de-correlation, I have a doubt whether it means DCT neighbor coefficients have no relationship?&lt;/li&gt;&#xA;&lt;li&gt;I've read some paper which says difference 2D-array(DCT coefficient subtracting by its neighbor) can weaken the relation of coefficients. How to understand this?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I would really appreciate if someone can help me!&lt;/p&gt;&#xA;" OwnerUserId="18732" LastEditorUserId="128" LastEditDate="2023-07-16T09:15:56.010" LastActivityDate="2023-07-16T09:15:56.010" Title="What does 'correlation' and 'de-correlation' mean in image-processing?" Tags="|image-processing|statistics|dct|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="27833" PostTypeId="1" AcceptedAnswerId="27834" CreationDate="2015-12-20T16:01:56.420" Score="7" ViewCount="7472" Body="&lt;p&gt;I have some doubts.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the difference between quality parameters MSE and PSNR?&lt;/li&gt;&#xA;&lt;li&gt;Which is used when?&lt;/li&gt;&#xA;&lt;li&gt;Is there any advantage of PSNR over MSE or vice versa?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Also I have heard people saying that MSE and PSNR should never be used to check image quality. Instead one should use UQI and SSIM. I read about UQI and SSIM and came to know they are close to human visual system but I read a technical report which says that SSIM is sometimes better than MSE and sometimes MSE is better. Here is the link&#xA;&lt;a href=&quot;http://www.cs.uregina.ca/Research/Techreports/2008-02.pdf&quot;&gt;http://www.cs.uregina.ca/Research/Techreports/2008-02.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am confused which one to use(among MSE and SSIM) and why? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also it is said that SSIM is upgraded version of UQI. Then what's the difference between these two?&#xA;Why do people still use UQI irrespective of the fact that SSIM is there?&lt;/p&gt;&#xA;" OwnerUserId="11189" LastEditorUserId="11189" LastEditDate="2015-12-20T16:26:12.727" LastActivityDate="2021-04-12T10:29:03.077" Title="What is the difference between MSE and PSNR of images?" Tags="|filters|noise|image-processing|denoising|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27834" PostTypeId="2" ParentId="27833" CreationDate="2015-12-20T20:13:37.873" Score="2" Body="&lt;p&gt;These metrics are used to compute certain signal properties. They are roughly divided into 2 categories as 1-objective, 2-subjective. Objective criteria are too mechanical and do not take any human perception weighting. Subjective criteria are either model based computations or directly opinion based measurements. Which is to use when is a matter of application.  &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-12-21T01:12:14.427" LastActivityDate="2015-12-21T01:12:14.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27836" PostTypeId="1" AcceptedAnswerId="27934" CreationDate="2015-12-21T02:22:14.663" Score="0" ViewCount="1594" Body="&lt;p&gt;I have a little bit confused on the difference between stationary wavelet transform and un-decimated wavelet transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, can anyone tell me, if there is a difference between them?&lt;/p&gt;&#xA;" OwnerUserId="16855" LastActivityDate="2016-03-14T03:18:29.307" Title="stationary vs. undecimated wavelet transform" Tags="|wavelet|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27837" PostTypeId="1" AcceptedAnswerId="27874" CreationDate="2015-12-21T05:24:55.363" Score="2" ViewCount="1697" Body="&lt;p&gt;I'm working on a focus stacking program, I wrote one a few years ago which used a very simple method, basically taking a DoG approach, but only operating on the single full resolution image. The resulting images had a soft focus look, kind of dreamy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time I researched further and found papers describing image pyramids, essentially doing the same thing as before except on multiple spatial frequencies, then recombining them with the maximum components which I imagine will solve the soft focus look. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But learning about pyramid based approaches led me to scale-space representation and multi-resolution analysis, and I can't tell if I should pursue one of those methods for possibly better results? (And MRA led me to wavelet transforms which I also don't see how I would implement.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, I don't really understand how either would even be implemented for focus stacking, but my impression of scale-space is that in practice I would just end up building a pyramid anyway, but that doesn't seem right. So am I missing something about that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And does it seem like there is anything to be gained by using a newer or more sophisticated approach than image pyramids for focus stacking?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I used Python last time but am using Apple's CoreImage framework this time, so I might be a bit more limited now, maybe MRA isn't even an option.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="17953" LastActivityDate="2015-12-23T10:33:59.360" Title="Pyramid vs Scale-space in Focus Stacking" Tags="|image-processing|algorithms|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27838" PostTypeId="2" ParentId="27836" CreationDate="2015-12-21T07:23:55.550" Score="0" Body="&lt;p&gt;From what I understand un-decimated wavelet transform (UDWT) involves the elimination of the decimation step to enable DWT to have translational invariance property. The stationary wavelet transform is one such &lt;em&gt;algorithm&lt;/em&gt; which is also known as &lt;em&gt;algorithme à trous&lt;/em&gt;. There are a number of other algorithms of UDWT a quick google scholar search can you show that but they all use similar ideas to the stationary wavelet transform.&lt;/p&gt;&#xA;" OwnerUserId="16449" LastActivityDate="2015-12-21T07:23:55.550" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27839" PostTypeId="2" ParentId="27830" CreationDate="2015-12-21T07:52:23.007" Score="2" Body="&lt;p&gt;Assuming you want to remove the DC bias from your signal, a few thoughts come to mind. Your signal sequence looks like a noisy periodic wave riding on a DC bias. And the bias is &lt;em&gt;trending&lt;/em&gt; upward in value from the beginning to the end of your sequence. Computing the average value of your signal sequence, a single value, and subtracting that value from your sequence will produce a sequence whose average value is very close to zero. But the upward bias trend will remain in your new sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A process called &quot;DC blocking&quot; will remove both the average bias &lt;em&gt;and&lt;/em&gt; the upward bias trend from your signal. If you have Matlab software, then use Matlab's &lt;em&gt;detrend()&lt;/em&gt; command to implement DC blocking. If you don't have Matlab available then have a look at the following DC blocking networks (copied from Chapter 13 of my DSP book).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LrMW1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LrMW1.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than different DC gains those above networks have the same frequency response. (Variable $\alpha$ is in the range of just greater than zero -to- one.) Note, those networks have &lt;em&gt;very&lt;/em&gt; nonlinear phase response near zero Hz. If linear phase DC blocking is what you want then have a look at:&#xA;&lt;a href=&quot;http://www.dsprelated.com/showarticle/58.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.dsprelated.com/showarticle/58.php&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-21T07:52:23.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27840" PostTypeId="1" AcceptedAnswerId="27857" CreationDate="2015-12-21T08:37:11.407" Score="1" ViewCount="72" Body="&lt;p&gt;Why are the observation features (namely MFCCs) of an HMM-based recognition/synthesis system modeled by a Gaussian distribution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even the state duration is modeled by a Gaussian in this paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;K. Tokuda et al., &quot;Speech synthesis based on hidden Markov models&quot;, Proceedings of the IEEE, May 2013&lt;/p&gt;&#xA;" OwnerUserId="18522" LastActivityDate="2015-12-22T07:48:47.793" Title="Why are the observation features of an HMM-based recognition/synthesis system modeled by a Gaussian distribution?" Tags="|speech-recognition|statistics|speech|hmm|speech-synthesis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27841" PostTypeId="1" AcceptedAnswerId="27842" CreationDate="2015-12-21T09:24:44.450" Score="0" ViewCount="392" Body="&lt;p&gt;In an algorithm, &lt;code&gt;voxel classification&lt;/code&gt; approach is used to perform &lt;code&gt;image segmentation&lt;/code&gt;. The aim was classifying voxels either as cartilage or background in MRI image. The project has to be completed in &lt;code&gt;matlab&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MRI images has &lt;code&gt;.dcm&lt;/code&gt; extension, it may have &lt;code&gt;.avi&lt;/code&gt; and other types too, I am not sure.  &lt;strong&gt;Is it possible to perform &lt;code&gt;voxel classification&lt;/code&gt; on &lt;code&gt;.dcm&lt;/code&gt; images or it require another type of images?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="18615" LastActivityDate="2015-12-21T10:14:27.517" Title="What type of images are required for voxel classification?" Tags="|matlab|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27842" PostTypeId="2" ParentId="27841" CreationDate="2015-12-21T10:14:27.517" Score="1" Body="&lt;p&gt;In general it doesn't matter what the format is, because you will load it as array/matrix anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, I never saw preprocessing being done on DICOM images, usually they are transformed to nifty or something else before anything is being done to it. However, ignorance is not an argument.&lt;/p&gt;&#xA;" OwnerUserId="18830" LastActivityDate="2015-12-21T10:14:27.517" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27844" PostTypeId="1" AcceptedAnswerId="27856" CreationDate="2015-12-21T14:46:11.713" Score="1" ViewCount="1826" Body="&lt;p&gt;I wanted to add Additive White Gaussian Noise (AWGN) and involve effect of slow flat fading on my transmitted signal in Matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created noise with zero mean and variance of one by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;awgn_noise = random('norm',0,1,1,NoOfSamples);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I created Rayleigh fading by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rayleigh = sqrt( (random('norm',0,1))^2 + (random('norm',0,1))^2 );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as I understand, the rayleigh values will attenuate the whole signal while gaussian noise values will be added to each sample of transmitted signal as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;received_signal = (transmitted_signal*rayleigh) + awgn_noise;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I doing it in a right way?&lt;/p&gt;&#xA;" OwnerUserId="16465" LastActivityDate="2015-12-22T00:54:52.613" Title="AWGN and Rayleigh fading in slow flat fading channels in MATLAB" Tags="|matlab|noise|fading-channel|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27847" PostTypeId="2" ParentId="27827" CreationDate="2015-12-21T15:58:02.923" Score="2" Body="&lt;p&gt;As you  are looking for some deep results, let me mention only two:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the Kadec's-&lt;span class=&quot;math-container&quot;&gt;$1/4$&lt;/span&gt; theorem that gives a stability bound under which  perturbed exponential Riesz bases remain Riesz bases (M. I. Kadec, The exact value of the Paley-Wiener constant, Dokl. Akad. Nauk SSSR, 1964, see for instance  R. Young, &lt;a href=&quot;http://www.caam.rice.edu/%7Eyad1/miscellaneous/References/Math/An%20introduction%20to%20nonharmonic%20Fourier%20series.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;An introduction to non-harmonic Fourier series&lt;/a&gt;, p. 42)&lt;/li&gt;&#xA;&lt;li&gt;the theory called &amp;quot;finite rate of innovation&amp;quot; (&lt;a href=&quot;http://bigwww.epfl.ch/publications/vetterli0201.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sampling Signals With Finite Rate of Innovation&lt;/a&gt;, IEEE Trans. Signal Proc., 2012, M. Vetterli &lt;em&gt;et al.&lt;/em&gt;) which essentially generalizes Nyquist-Shannon theory to non band-limited signals, requiring &amp;quot;&lt;strong&gt;twice the number of degrees-of-freedom&lt;/strong&gt;&amp;quot; per unit interval, like the two-points per period in the classical cases, for some parametric signals (finite number of spikes, piece-wise polynomials, etc.).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I like the genericity and the simple bounds for both examples.&lt;/p&gt;&#xA;&lt;p&gt;You can probably  find more ideas in &lt;a href=&quot;http://dx.doi.org/10.1016/j.jat.2005.07.011&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical and approximate sampling theorems; studies in the &lt;span class=&quot;math-container&quot;&gt;$L^p(R)$&lt;/span&gt; source and the uniform norm&lt;/a&gt;, J. Approx. Theor., 2005, P. L. Butzer &lt;em&gt;et al.&lt;/em&gt; and &lt;a href=&quot;http://www.springer.com/gp/book/9783319197487&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sampling Theory, a Renaissance: Compressive Sensing and Other Developments&lt;/a&gt;, 2015, G. E. Pfander editor. In the latter, you might like Chapter 9 - Sampling in Euclidean and non-Euclidean Domains: A Unified Approach (sphere, Hyperbolic Space), and Chapter 10 - A Sheaf-Theoretic Perspective on Sampling, where you get some topology.&lt;/p&gt;&#xA;&lt;p&gt;There are all sorts of exiting developments in zero- or level-crossing, single-bit sampling, which I do not know enough to be more precise: round-off, jitter, truncation, saturation and aliasing errors are real problems.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2022-08-24T06:43:02.260" LastActivityDate="2022-08-24T06:43:02.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27848" PostTypeId="2" ParentId="27819" CreationDate="2015-12-21T16:35:39.293" Score="1" Body="&lt;p&gt;I do not  understand why you need an infinite number of  terms for a Fourier approxiimation. Yet, if you are looking for tools on non-discretized 2D data,  I would suggest you to start with the concept of &lt;a href=&quot;http://www.cmap.polytechnique.fr/~mallat/papiers/image-poursuite.pdf&quot; rel=&quot;nofollow&quot;&gt;Matching pursuit of images&lt;/a&gt;. You take a dictionary of 2D atoms that is complete (could be complex exponentials, gaussian bumps). Then, you find the  atom that best matches you  data, subtract it with the necessary scale factor, and repeat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also resort to &lt;a href=&quot;http://arxiv.org/pdf/1101.1512.pdf&quot; rel=&quot;nofollow&quot;&gt;anisotropic  triangulations&lt;/a&gt;, but  this would not suit your &quot;need to be combined in an inner product fashion&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The  quality of approximation could be evaluated over some classes for regular functions ($C^p$ smooth inside $C^q$ curves), and are related to properties of  your  dictionary. You might find some references in section &lt;em&gt;4.1.1. Matching pursuits&lt;/em&gt; from &lt;a href=&quot;http://perso.uclouvain.be/laurent.jacques/uploads/Main/pano_ms_geom.pdf&quot; rel=&quot;nofollow&quot;&gt;A panorama on multiscale geometric representations&lt;/a&gt;, Signal Processing, 2011, L. Jacques &lt;em&gt;et al.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do suspect that the inner-product  constraint will limit the efficiency: optimal approximations in 1D do not extend generically  in 2D.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-12-21T16:35:39.293" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27849" PostTypeId="1" CreationDate="2015-12-21T17:24:51.683" Score="3" ViewCount="81" Body="&lt;p&gt;Anyone know what references might have information about the history of any particular filter design?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since seeing just the equation or implementation hinders the process by which the filter (such as the biquad filter) was actually discovered.&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2015-12-23T08:05:26.713" Title="Historical notes of filter designs?" Tags="|filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27850" PostTypeId="1" AcceptedAnswerId="27852" CreationDate="2015-12-21T18:15:51.730" Score="3" ViewCount="288" Body="&lt;p&gt;I'm thinking of the typical &lt;strong&gt;stereo widener&lt;/strong&gt; (haas, binaural) effects here, those that extend from the typical pan knob to create &quot;out of the headphones&quot; -experience. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These processors can be automated to move sounds around, but I was wondering whether there was mathematics that described how to set the delays in order to move the sound into a certain spot in an &lt;strong&gt;angle -like&lt;/strong&gt; fashion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such as in this plug-in:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0Gb0y.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0Gb0y.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about modelling the &quot;distance&quot; from the listener?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-12-22T05:11:57.467" LastActivityDate="2017-09-25T07:10:08.207" Title="Are there equations for placing sounds in the stereo field using delays?" Tags="|audio|delay|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27851" PostTypeId="2" ParentId="27849" CreationDate="2015-12-21T19:45:33.003" Score="1" Body="&lt;p&gt;If you are only looking for digital filter design, then R.Hamming's classical book &quot;Digital Filters&quot; might help for further references... You should better consult IEEE papers to track down the invention of many types then...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2015-12-21T19:45:33.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27852" PostTypeId="2" ParentId="27850" CreationDate="2015-12-21T22:41:49.733" Score="7" Body="&lt;p&gt;&lt;strong&gt;Spherical head, distant source&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a spherical head with the ears at opposite points on its surface, a planar wave from a distant sound source reaches an ear on a straight line through air or if blocked by the head then partially through the shortest path along the surface of the sphere. If the sound source is at the same vertical coordinate $z$ as the ears, we can think of the head as a circle on the $x, y$ plane:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/axfiO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/axfiO.png&quot; alt=&quot;Unit circle head, distant source&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity, the head is a unit circle centered at $x = 0, y = 1$, turned so that the nose moves by an angle $\alpha$ counterclockwise from the origin. We are looking for the distances the sound still has to travel after the planar wavefront first reaches the head. There is a shortest straight line path (red dashed) of length $1-\sin(\alpha)$ to the right (red) ear. The shortest path (white dashed) to the left (white) ear consists of a straight line segment of length $1$ plus a curved path of length $\alpha$. The difference between the lengths to the two ears is $\alpha + 1 - (1 - \sin(\alpha)) = \sin(\alpha) + \alpha$. This holds for $0 \le \alpha \le \frac{\pi}{2}$, but because the function is antisymmetrical, it applies also to $-\frac{\pi}{2} \le \alpha \le 0$ giving a negative value for that range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4rpS2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4rpS2.png&quot; alt=&quot;$\sin(\alpha) + \alpha$&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Modifying the equation to include the speed of sound $c$ and the head radius $r$, the inter-aural time difference (ITD) turns out as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{ITD}(\alpha) = \frac{r}{c} (\sin(\alpha) + \alpha)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula is applicable for angles $-\frac{\pi}{2} \le \alpha \le \frac{\pi}{2}$, where $\alpha = 0$ means the source is straight ahead and $\alpha = \frac{\pi}{2}$ means it is 90° to the right, if the left channel is delayed for positive ITD. The plotted $\sin(\alpha) + \alpha$ part swings from $-\frac{\pi}{2} - 1$ to $\frac{\pi}{2} + 1$, so for a realistic maximum ITD of 0.6 ms (for distant sources) one can use simply:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{ITD}(\alpha) = \frac{0.6\ \text{ms}}{\frac{\pi}{2} + 1} (\sin(\alpha) + \alpha) \approx 0.23\ \text{ms}\ (\sin(\alpha) + \alpha)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For sources that are behind, before using the formula, add or subtract $\pi$ to/from $\alpha$ to bring it to $-\frac{\pi}{2}\ldots\frac{\pi}{2}$ and flip its sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Spherical head, nearby source&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one wants to take into account the distance to the source, the wavefront becomes spherical, or circular on the $x, y$ plane. Let's look at a head with just one ear considered:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CxBVS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CxBVS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The head is again a unit circle, but this time centered at the origin. The source (blue) is on the negative $y$ axis at a distance $d$ from the center of the head. The ear (red) is rotated by an angle $\alpha$ counterclockwise from the positive $x$ axis, or clockwise if $\alpha$ is negative. We shall constrain $-\frac{\pi}{2} \le \alpha \le \frac{\pi}{2}$ so that the shortest air path to the ear is always via the right side of the head as pictured. At the time the sound first reaches the head, the wavefront (blue) is cicular with radius $d-1$. We don't need that for the calculations, because we can use the time the sound leaves the source as the starting point. There is some negative angle $\beta$ such that if $\alpha \le \beta$, there is a direct air path of length $\sqrt{\cos(\alpha)^2 + \left(d + \sin(\alpha)\right)^2}$ to the ear located at $x = \cos(\alpha)$, $y = \sin(\alpha)$. Otherwise the sound travels a distance $D = \sqrt{\cos(\beta)^2 + \left(d + \sin(\beta)\right)^2}$ to the point $x = \cos(\beta)$, $y = \sin(\beta)$ where the straight path and the circle meet tangentially, and transitions to a further curved path of length $\alpha-\beta$. There is a right triangle (pink) that enables to solve $\beta$ using the pythagorean theorem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d^2 = D^2 + 1^2\\&#xA;\Rightarrow \beta = - \text{asin}(\frac{1}{d}),\ D = \sqrt{d^2-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To recap, modifying the equations to include head radius $r$ and speed of sound $c$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-\frac{\pi}{2} \le \alpha \le \frac{\pi}{2},\\&#xA;T_l = \left\{\begin{array}{ll}\frac{r}{c}\sqrt{\cos(\alpha)^2 + \left(\frac{d}{r} + \sin(\alpha)\right)^2}&amp;amp;\text{if } \alpha \le - \text{asin}(\frac{r}{d}),\\&#xA;\frac{r}{c}\left(\sqrt{(\frac{d}{r})^2-1} + \alpha + \text{asin}(\frac{r}{d})\right)&amp;amp;\text{otherwise,}\end{array}\right.\\&#xA;T_r = \left\{\begin{array}{ll}\frac{r}{c}\sqrt{\cos(\alpha)^2 + \left(\frac{d}{r} - \sin(\alpha)\right)^2}&amp;amp;\text{if } \alpha \geq \text{asin}(\frac{r}{d}),\\&#xA;\frac{r}{c}\left(\sqrt{(\frac{d}{r})^2-1} - \alpha + \text{asin}(\frac{r}{d})\right)&amp;amp;\text{otherwise,}\end{array}\right.\\&#xA;\text{ITD}(\alpha) = T_l(\alpha) - T_r(\alpha)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, for sources that are behind, before using the formula, add or subtract $\pi$ to/from $\alpha$ to bring it to $-\frac{\pi}{2}\ldots\frac{\pi}{2}$ and flip its sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For increasing distances, this definition of ITD approaches the previous one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nhoA5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nhoA5.png&quot; alt=&quot;ITD with distance&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2017-09-25T07:10:08.207" LastActivityDate="2017-09-25T07:10:08.207" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27853" PostTypeId="1" CreationDate="2015-12-21T23:47:15.470" Score="0" ViewCount="216" Body="&lt;p&gt;Hyper-spectral images are images with many bands $(\ge 100)$ while the normal color images have only three bands $\rm (r,g,b)$.  It is not difficult to simulate an artificial gray-scale image with the following Matlab codes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;width = 200;&#xA;height = 200;&#xA;img = ones(height,width)*10;&#xA;img(floor(height/4):floor(height*3/4),floor(width/4):floor(width*3/4))= 200;&#xA;noise = 5+10*randn(height,width);&#xA;img = img+noise;&#xA;img(img&amp;lt;0)=0;&#xA;img(img&amp;gt;255)=255;&#xA;figure; imshow(img,[]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The following simulation image can be obtained:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mQ0Lk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mQ0Lk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the simulation image, the object is a square in the center and the rest is the background. The object is of gray-value 200, and both object and background are contaminated by Gaussian noise. It is also possible to perform blurring before adding noise. The blurring is used to simulate the system point spread function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then comes to my question: how can we simulate a hyper-spectral image? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the time being, my solution is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find a hyper-spectral profile from the hyperspectral database for a certain object (this kind of database exists?)&lt;/li&gt;&#xA;&lt;li&gt;For each band get the object's gray-value from the profile, and treat this band as if it is gray-scale image when creating simulation image. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am not sure whether this is the right way of generating simulation images. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="1674" LastEditorUserId="1629" LastEditDate="2016-04-20T08:05:51.413" LastActivityDate="2016-08-19T01:47:25.270" Title="How to simulate hyper-spectral images" Tags="|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27855" PostTypeId="2" ParentId="27853" CreationDate="2015-12-22T00:53:45.120" Score="2" Body="&lt;p&gt;The spectrum of an object is typically a product of the spectrum of the light coming from a light source and the reflectance spectrum of the object. For visible light, I have an old collection of both of those, in the &lt;code&gt;data.txt&lt;/code&gt; file in &lt;a href=&quot;http://yehar.com/blog/wp-content/uploads/2009/09/DyeMixer.jar&quot; rel=&quot;nofollow&quot;&gt;this jar archive&lt;/a&gt;. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;canvas;&#xA;number=1067;&#xA;category=&quot;food&quot;;&#xA;name=&quot;wheat bread crust&quot;;&#xA;reference=&quot;Eastman Kodak (Ron Gershon)&quot;;&#xA;start=390;&#xA;step=2;&#xA;evendata=0.0465, 0.0470, 0.0446, 0.0444, 0.0443, 0.0440, 0.0435, 0.0433,&#xA;0.0435, 0.0433, 0.0432, 0.0431, 0.0442, 0.0435, 0.0438, 0.0444,&#xA;0.0446, 0.0449, 0.0454, 0.0459, 0.0464, 0.0467, 0.0467, 0.0469,&#xA;0.0476, 0.0479, 0.0487, 0.0490, 0.0496, 0.0502, 0.0507, 0.0511,&#xA;0.0515, 0.0521, 0.0527, 0.0532, 0.0542, 0.0550, 0.0557, 0.0567,&#xA;0.0576, 0.0584, 0.0592, 0.0603, 0.0612, 0.0622, 0.0631, 0.0637,&#xA;0.0657, 0.0666, 0.0677, 0.0690, 0.0703, 0.0719, 0.0730, 0.0744,&#xA;0.0763, 0.0778, 0.0802, 0.0813, 0.0823, 0.0845, 0.0861, 0.0874,&#xA;0.0906, 0.0921, 0.0940, 0.0961, 0.0979, 0.1001, 0.1026, 0.1047,&#xA;0.1071, 0.1094, 0.1116, 0.1140, 0.1165, 0.1192, 0.1222, 0.1248,&#xA;0.1272, 0.1302, 0.1327, 0.1357, 0.1387, 0.1413, 0.1443, 0.1478,&#xA;0.1507, 0.1540, 0.1573, 0.1600, 0.1632, 0.1667, 0.1699, 0.1735,&#xA;0.1768, 0.1799, 0.1834, 0.1872, 0.1906, 0.1949, 0.1983, 0.2021,&#xA;0.2062, 0.2104, 0.2143, 0.2184, 0.2228, 0.2266, 0.2306, 0.2343,&#xA;0.2391, 0.2432, 0.2472, 0.2518, 0.2557, 0.2597, 0.2646, 0.2688,&#xA;0.2732, 0.2779, 0.2818, 0.2861, 0.2909, 0.2952, 0.2997, 0.3045,&#xA;0.3086, 0.3124, 0.3171, 0.3220, 0.3259, 0.3306, 0.3349, 0.3390,&#xA;0.3441, 0.3483, 0.3528, 0.3574, 0.3624, 0.3667, 0.3716, 0.3766,&#xA;0.3811, 0.3863, 0.3908, 0.3954, 0.4011, 0.4058, 0.4105, 0.4162,&#xA;0.4204, 0.4249, 0.4299, 0.4350, 0.4404, 0.4455, 0.4495, 0.4543,&#xA;0.4589, 0.4631, 0.4684, 0.4724, 0.4764, 0.4818, 0.4864, 0.4906,&#xA;0.4958, 0.4989, 0.5037;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The spectrum is evenly sampled at 2 nm ascending steps starting at 390 nm. It is actually absorbance data which you need to convert to reflectance by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{reflectance}(\text{wavelength}) = 10^{\text{-absorbance}(\text{wavelength})}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a light source, a common choice is CIE D65. Its power spectrum in 10 nm bands starting at 300 nm is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.0341, 3.2945, 20.236, 37.0535, 39.9488, 44.9117, 46.6383, 52.0891,&#xA;49.9755, 54.6482, 82.7549, 91.486, 93.4318, 86.6823, 104.865,&#xA;117.008, 117.812, 114.861, 115.923, 108.811, 109.354, 107.802,&#xA;104.79, 107.689, 104.405, 104.046, 100, 96.3342, 95.788, 88.6856,&#xA;90.0062, 89.5991, 87.6987, 83.2886, 83.6992, 80.0268, 80.2146,&#xA;82.2778, 78.2842, 69.7213, 71.6091, 74.349, 61.604, 69.8856, 75.087,&#xA;63.5927, 46.4182, 66.8054, 63.3828, 64.304, 59.4519, 51.959, 57.4406,&#xA;60.3125&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-22T00:53:45.120" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27856" PostTypeId="2" ParentId="27844" CreationDate="2015-12-22T00:54:52.613" Score="0" Body="&lt;p&gt;As I described in &lt;a href=&quot;https://dsp.stackexchange.com/a/16385/8952&quot;&gt;this answer&lt;/a&gt;, it is generally assumed in the Rayleigh fading model that the energy is conserved on average (i.e. that the fading coefficient $R$ is such that $E\left\{R^2\right\} = 1$). As a result you would need to generate the Rayleigh distribution from two normal distribution with standard deviation of $1/\sqrt{2}$ (instead of with unit standard deviation). This can be achieved with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rayleigh = sqrt( (random('norm',0,1/sqrt(2)))^2 + (random('norm',0,1/sqrt(2)))^2 );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or alternatively, since you are already using &lt;a href=&quot;http://www.mathworks.com/help/stats/random.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;random&lt;/code&gt;&lt;/a&gt; from the statistics toolbox, with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rayleigh = random('Rayleigh',1/sqrt(2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Other than that, the expressions you have properly represent a slow flat Rayleigh fading channel for the transmission of a one-dimensional signal (such as BPSK, M-PAM, ...)&lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-12-22T00:54:52.613" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27857" PostTypeId="2" ParentId="27840" CreationDate="2015-12-22T07:48:47.793" Score="1" Body="&lt;p&gt;For observations people usually use a mixture of gaussians, not a simple gaussian. They have few advantages - EM algorithm is fast to converge and GMM approximates wide variety of distributions pretty well. Probability of the model can be computed efficiently with gaussian selection. Last, GMMs are easy to cluster for context-dependent tree for phonetic context, which is important for LVCSR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are disadvantages as well, for example, GMM estimation is not very robust to the noise in features, also it does not account for some hidden parameters, for example &quot;speaker&quot; identity is not properly modeled with GMM. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are extensions developed here, for example, &lt;a href=&quot;http://govivace.com/Image/icassp10_ubm.pdf&quot; rel=&quot;nofollow&quot;&gt;subspace GMM&lt;/a&gt; is proposed to model speaker variability. In this model GMM parameters are computed as a projection of the GMM supervector thus allowing to model linear combinations of speakers and each speaker has individual GMMs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall focus in state-of-art implementation has been shifted to DNNs for classification and they are better classifiers of course. Context-dependent tree to classify phonetic context is still constructed with GMMs though.&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2015-12-22T07:48:47.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27858" PostTypeId="1" CreationDate="2015-12-22T08:05:48.490" Score="1" ViewCount="568" Body="&lt;p&gt;Different smartphone devices have accelerometers manufactured by different manufacturers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I want to categorize vibrations recieved from various devices into one of the following scales : &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;LOW_MOVEMENT&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;MEDIUM_MOVEMENT&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;HIGH_MOVEMENT&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How can I devise a scale such that -  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;LOW_MOVEMENT&lt;/code&gt; of one device is &lt;code&gt;LOW_MOVEMENT&lt;/code&gt; of every other device when subjected to the same vibrations. And so on for &lt;code&gt;MEDIUM_MOVEMENT&lt;/code&gt; and &lt;code&gt;HIGH_MOVEMENT&lt;/code&gt;? (with a certain degree of possibility ofcourse)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only data I know about the make of the accelerometer is &lt;strong&gt;accelerometer resolution&lt;/strong&gt; and &lt;strong&gt;maximum range of accelerometer&lt;/strong&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I plan on normalizing &lt;code&gt;x^2 + y^2 + z^2&lt;/code&gt; under root.&lt;/p&gt;&#xA;" OwnerUserId="18838" LastEditorUserId="44583" LastEditDate="2019-09-04T12:35:02.000" LastActivityDate="2020-05-31T13:05:20.593" Title="How do I normalize accelerometer signals values to a relative scale?" Tags="|analog|normalization|sensor|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27860" PostTypeId="2" ParentId="27850" CreationDate="2015-12-22T13:02:08.487" Score="3" Body="&lt;p&gt;Typically simplistic models for don't work very well and don't result in externalization (out of head localization). The diffraction effects are quite complicated and at higher frequencies the details pinna (ear lobes) and shoulder reflections are quite relevant. Interaural time and level differences are also highly frequency dependent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's much more effective to use measured HRTFs (Head Related Transfer Function). Some sets are available in the public domain for non-commercial use. Even better work individualized HRTFs, i.e. HRTFs measured with your own head and ears. It's actually not that hard to do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using real HRTFs will easily allow for externalization on the sides but it's still not great for median plane (up/down, front/back) and people often report in-head localization for frontal sources. The best way around this is head tracking, i.e. measuring the listeners head movements and updating the HRTF's in real time accordingly. That's pretty complicated though.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-12-22T13:02:08.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27861" PostTypeId="1" CreationDate="2015-12-22T13:15:49.213" Score="1" ViewCount="1752" Body="&lt;p&gt;What are Leslie speaker / &quot;rotary&quot; style of digital audio processors doing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think a simple one would model:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Delay between speaker and a pair (stereo) of microphones.&lt;/li&gt;&#xA;&lt;li&gt;The tonal change when the speaker rotates (LFO modulated filter and amplitude modulation).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But what (more) is there really?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="1629" LastEditDate="2016-01-22T13:15:12.773" LastActivityDate="2016-01-22T16:29:31.813" Title="How is the Leslie speaker simulated?" Tags="|audio|phase|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27862" PostTypeId="1" CreationDate="2015-12-22T14:22:59.660" Score="2" ViewCount="293" Body="&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/showthread/comp.dsp/111418-1.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;I've read that modifying the bin values in the frequency domain&lt;/a&gt; after a FFT poses problems that lead to glitches when one takes the signal back to time domain using iFFT. This is caused iirc because the modified data does not align &quot;continuously&quot; anymore to the bins (and discontinuities $\implies$ artefacts). Because of this it's e.g. not recommended to perform (&quot;ideal filter&quot;) equalisation in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since there are e.g. interpolation methods,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there ways for doing processing such as shuffling or removing bins in the frequency domain such that one can retain sound quality? E.g. by &quot;synthesising&quot; new data using interpolation methods.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the context of audio something seems to be feasible, since there exists plug-ins such as this that seem to do filtering in the frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Q17bn.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q17bn.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2017-10-17T08:32:22.017" LastActivityDate="2017-10-17T08:32:22.017" Title="Can the FFT representation of a signal be modified w/o creating glitches?" Tags="|fft|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27863" PostTypeId="1" AcceptedAnswerId="28417" CreationDate="2015-12-22T14:23:37.827" Score="1" ViewCount="371" Body="&lt;p&gt;OTSU is a very popular image binarization method, and Matlab provides a function to implement this method, see &lt;a href=&quot;http://nl.mathworks.com/help/images/ref/graythresh.html&quot; rel=&quot;nofollow&quot;&gt;graythresh&lt;/a&gt; for details. In this function, it has two outputs, one is the threshold calculated with OTSU algorithm, the other is called effectiveness metric EM, and it claims:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    The effectiveness metric is a value in the range [0 1] that indicates the &#xA;effectiveness of the thresholding of the input image. The lower bound is &#xA;attainable only by images having a single gray level, and the upper bound is &#xA;attainable only by two-valued images.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I think it would be nice if we can use effectiveness metric EM to tell whether binarization is fine or not. If EM value is slow, then we will use different binarization method. It would be very useful in the context of document image binarization. Then, a natural question is how can we set this threshold reasonablly. Any ideas on how EM is calculated? &lt;/p&gt;&#xA;" OwnerUserId="1674" LastActivityDate="2016-01-22T20:53:26.923" Title="how can we tell that OTSU binarization is feasible or not." Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27864" PostTypeId="2" ParentId="27862" CreationDate="2015-12-22T15:47:53.050" Score="-1" Body="&lt;p&gt;I think as long as bin modifications represent a continuum in time you'll be OK. In other words, bin modifications (scale, offset, etc.) should be close to that of the same bin for the previous window.&lt;/p&gt;&#xA;" OwnerUserId="18821" LastActivityDate="2015-12-22T15:47:53.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27866" PostTypeId="2" ParentId="27862" CreationDate="2015-12-22T16:16:40.897" Score="1" Body="&lt;p&gt;The way you do it is you use a window that tapers to 0 at the ends, both before and after the FFT (analysis and re-synthesis windows), &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/Overlap_Add_Decomposition.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;along with 50% overlap&lt;/a&gt; (needs to be a &lt;a href=&quot;https://ccrma.stanford.edu/~jos/sasp/COLA_Examples.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;COLA&lt;/a&gt; &lt;a href=&quot;http://www.dsprelated.com/freebooks/sasp/COLA_Examples.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;window&lt;/a&gt;), to fade out the glitches and keep the signal continuous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GUqts.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GUqts.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2015-12-22T16:22:00.370" LastActivityDate="2015-12-22T16:22:00.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27867" PostTypeId="2" ParentId="27862" CreationDate="2015-12-22T16:23:31.187" Score="1" Body="&lt;p&gt;If the bin modifications to the FFT representation can be approximated closely enough for your purposes by the transform of a finite length impulse response, then modification of a series of zero padded FFTs in conjunction with overlap add or overlap save processing can be done without glitches.  The zero-padding plus overlap is to prevent circular convolution artifacts in bin modifications from causing discontinuities.  Making the impulse response of your modification short enough to do this will also help smooth out ripples in your modification's frequency response between FFT bins; and these ripples can be another cause of nasty artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For bin &quot;shuffling&quot; that falls under the category of analysis/resynthesis music processing, phase vocoder methods in conjunction with cross-fading sufficiently overlapped IFFT result frames is another possibility for glitchless modification.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-22T16:28:35.257" LastActivityDate="2015-12-22T16:28:35.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27868" PostTypeId="1" CreationDate="2015-12-22T21:45:38.167" Score="1" ViewCount="86" Body="&lt;p&gt;I'm trying to learn more about voice recognition, and I was looking &lt;a href=&quot;https://github.com/jsawruk/pymir/blob/bb4fa09f15bf593033754f2f8d01658cdb862fff/pymir/MFCC.py&quot; rel=&quot;nofollow&quot;&gt;this library here&lt;/a&gt; and noticed there were two implementations of MFCC (one called mfcc and another called mfcc2). I ran both of these on the same data and got different results, and was wondering why there are two different version of MFCC that give two different results. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="18841" LastActivityDate="2015-12-22T23:43:59.530" Title="Quick question about difference between two implementations of MFCC" Tags="|speech-recognition|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27869" PostTypeId="2" ParentId="27868" CreationDate="2015-12-22T23:43:59.530" Score="1" Body="&lt;p&gt;At a glance - the number of filters is different, the first algorithm has it equal to 48, while the second one - to 32. But even these small things aside, MFCC computation is basically a pipeline of algorithms with 4 or 5 stages. And each stage has some input parameters varying which you can get slightly different output. Given that each stage is implemented properly these differences have negligible effect on the recognition result.&lt;/p&gt;&#xA;" OwnerUserId="18297" LastActivityDate="2015-12-22T23:43:59.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27871" PostTypeId="2" ParentId="27849" CreationDate="2015-12-23T08:05:26.713" Score="2" Body="&lt;p&gt;Along the line as Fat32's suggestion to consult IEEE papers, you might try to obtain a copy of &quot;Digital Signal Processing&quot; (IEEE Press Selected Reprint Series), Edited by: Lawrence R. Rabiner and Charles M. Rader, published by: IEEE press (1972).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gPmA5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gPmA5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That book contains reprints of many early (starting around the middle 1960s), and influential, scholarly papers on digital filtering. And of course those early papers contain references to even earlier papers.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-23T08:05:26.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27872" PostTypeId="2" ParentId="27858" CreationDate="2015-12-23T08:47:33.377" Score="0" Body="&lt;p&gt;Next to its resolution and maximum range, you should also consider other effects such as offset. A possibility would be to subject the different smartphones to a known acceleration and check whether they display different values.&lt;/p&gt;&#xA;" OwnerUserId="13475" LastActivityDate="2015-12-23T08:47:33.377" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27873" PostTypeId="2" ParentId="27861" CreationDate="2015-12-23T09:58:52.067" Score="1" Body="&lt;p&gt;The main idea of the Leslie is the addition of rotation to the sound projector, the speaker. Therefore, from the point of view or rather, the point of audition of a listener, the sound source is being modulated both in phase as well as amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to simply achieve &lt;em&gt;something that sounds like the Leslie speaker&lt;/em&gt;, you can combine a &lt;a href=&quot;https://en.wikipedia.org/wiki/Phaser_%28effect%29&quot; rel=&quot;nofollow&quot;&gt;phaser&lt;/a&gt; and a &lt;a href=&quot;https://en.wikipedia.org/wiki/Tremolo_%28electronic_effect%29&quot; rel=&quot;nofollow&quot;&gt;tremolo&lt;/a&gt; that are driven by a sinusoidal LFO that &quot;simulates&quot; the rotary motion and try to tune their parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, that is not all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Leslie speaker is supposed to reproduce a wide spectrum of frequencies and it therefore has woofer and tweeter speakers. Consequently, it also has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Audio_crossover&quot; rel=&quot;nofollow&quot;&gt;crossover filter&lt;/a&gt;. An accurate simulator would have to include the effect of this filter on the sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The woofer and tweeters are projecting the sound on rotating waveguides (or the speaker itself is rotated) that operate inside a padded cabin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, there is a varying geometry between the actual source of the sound and the ear of a listener that needs to be modeled. There are a number of parameters here: Rotating mass has inertia, therefore doesn't start and stop instantly, so there is a transient interval as the effect &quot;comes in&quot; and &quot;goes out&quot;. The fact that the speakers rotate inside a cabinet means that the modulation profile is not exactly sinusoidal. The dimensions of the cabinet's openings, the waveguides, the padding of the cabinet and the rotational speed of the motor all contribute to the final result and would need to be modeled to a certain extent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is &lt;a href=&quot;https://www.youtube.com/watch?v=9GdqkdwqYJA&quot; rel=&quot;nofollow&quot;&gt;a Leslie &quot;coming in&quot; and &quot;going out&quot;&lt;/a&gt;. &lt;a href=&quot;https://www.youtube.com/watch?v=quE0ElIAwZE&quot; rel=&quot;nofollow&quot;&gt;This video&lt;/a&gt; is great overall as well but also you can see many different Leslie designs, different choices would have to be modeled in a &quot;simulator&quot;. Finally, one of the most accurately simulated Leslies comes as &lt;a href=&quot;https://www.youtube.com/watch?v=Lvwvt4JStSw&quot; rel=&quot;nofollow&quot;&gt;part of the B4&lt;/a&gt;. The amount of detail in that instrument overall is impressive, clicks, distortions, transients are all there (from &lt;a href=&quot;https://www.youtube.com/watch?v=DcCqGboS8II&quot; rel=&quot;nofollow&quot;&gt;the original&lt;/a&gt;) and of course, the Leslie speaker. Notice at the bottom left the &quot;Rotator&quot; switch as it is turned on and turned off and compare that with the effect it has on the sound.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2015-12-23T09:58:52.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27874" PostTypeId="2" ParentId="27837" CreationDate="2015-12-23T10:33:59.360" Score="2" Body="&lt;p&gt;Your question relates to techniques with different names. The  first one is related to micrographs taken at different (aligned) focal positions combined  into a focus image. This &lt;a href=&quot;http://bigwww.epfl.ch/demo/edf/&quot; rel=&quot;nofollow&quot;&gt;Extended Depth of Field&lt;/a&gt; is based on complex wavelet-based methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your second question on difference between MRA, pyramids, etc.: most pyramids and wavelet-based methods for 2D image processing are instance of multiscale/multirate//multiorientations  decompositions based on certain scale-space discretizations (a review paper on these issues is &lt;a href=&quot;http://arxiv.org/pdf/1101.5320v2&quot; rel=&quot;nofollow&quot;&gt;A Panorama on Multiscale Geometric Representations&lt;/a&gt;, Signal Processing, 2011). With scale-space in general, you do not need to downsample, and end up with a stack, not a pyramid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since one selects maximum coefficients across scale, band, or orientation, my opinion is that a complex pyramid, a complex (or dual-tree) wavelet transformation, with a little redundancy and some shift or rotation invariance could be useful, at the cost of more painful implementation. Standard real MRA wavelets are limited in orientations, full scale-space might be quite involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maximum coefficient selection is probably  a poor's man saliency detection, which is another track to follow based on the specificity of your images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More general terms for your search are multifocus image fusion, multiscale or multi-resolution images fusion, even multichannel. A few references:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Performance comparison of different multi-resolution transforms for image fusion, Information Fusion, 2011&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/TIM.2009.2026612&quot; rel=&quot;nofollow&quot;&gt;Multifocus image fusion and restoration with sparse representation&lt;/a&gt;, IEEE Transactions onInstrumentation and Measurement, 2010&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1016/j.inffus.2008.08.006&quot; rel=&quot;nofollow&quot;&gt;Multifocus image fusion using the log-Gabor transform and a Multisize Windows technique&lt;/a&gt;, Information Fusion, 2009&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can as well find inspiration in multiscale versions of &lt;a href=&quot;https://en.wikipedia.org/wiki/High-dynamic-range_imaging&quot; rel=&quot;nofollow&quot;&gt;High-dynamic-range (HDR) imaging&lt;/a&gt;, for instance:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/TIP.2012.2214047&quot; rel=&quot;nofollow&quot;&gt;Local Edge-Preserving Multiscale Decomposition for High Dynamic Range Image Tone Mapping&lt;/a&gt;, IEEE Transactions on Image Processing, 2012&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://pixinsight.com/examples/HDRWT/M101/#Messier_101&quot; rel=&quot;nofollow&quot;&gt;Multiscale Processing with HDRWaveletTransform&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-12-23T10:33:59.360" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27875" PostTypeId="1" AcceptedAnswerId="27876" CreationDate="2015-12-23T12:42:41.037" Score="0" ViewCount="36" Body="&lt;p&gt;I do not know how to create sturct variable in Maltab from column vectors. I have three column vectors, Voltage1 (32768x1 double), Voltage2 (32768x1 double) and Voltage3 (32768x1 double). I would like to create 1x1 struct variable with 3 fields (Voltage1-32768x1 double, Voltage2-32768x1 double and Voltage3-32768x1 double). Please help. &lt;/p&gt;&#xA;" OwnerUserId="11432" LastActivityDate="2015-12-23T12:54:43.200" Title="Create struct from column vectors" Tags="|matlab|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27876" PostTypeId="2" ParentId="27875" CreationDate="2015-12-23T12:54:43.200" Score="1" Body="&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; a1 = ones(100,1);&#xA;&amp;gt;&amp;gt; a2 = ones(100,1);&#xA;&amp;gt;&amp;gt; a3 = ones(100,1);&#xA;&amp;gt;&amp;gt; b.a1 = a1;&#xA;&amp;gt;&amp;gt; b.a2 = a2;&#xA;&amp;gt;&amp;gt; b.a3 = a3;&#xA;&amp;gt;&amp;gt; b&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;b = &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a1: [100x1 double]&#xA;a2: [100x1 double]&#xA;a3: [100x1 double]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14939" LastActivityDate="2015-12-23T12:54:43.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27877" PostTypeId="1" CreationDate="2015-12-23T13:55:51.253" Score="5" ViewCount="1889" Body="&lt;p&gt;Anyone know if the Bode frequency shifter has been studied somewhere. I just used an audio plug-in called &lt;a href=&quot;https://soniccharge.com/echobode&quot; rel=&quot;nofollow&quot;&gt;EchoBode from SonicCharge&lt;/a&gt; and this is claimed to use a frequency (pitch) shifting algorithm inspired by the Bode frequency shifter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pitch shifting quality on this is pretty darn good I think, thus why I'm asking about it.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.pcjv.de/vst-plugins/effect-plugins/modulation/&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; it's claimed to involve a ring modulator and a Hilbert transform.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Frequency shifting is linear and thus produces inharmonicity, but for small (max. 1-2 semitones) the quality is possibly better than with &quot;granular&quot; pitch shifting approaches. The inharmonicity is also not necessarily distortion or &quot;ring-modulated&quot;, but may be even musical for some sounds such as percussive instruments.&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-12-25T09:15:18.120" LastActivityDate="2016-01-05T14:27:45.287" Title="The Bode frequency shifter" Tags="|audio|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27878" PostTypeId="1" CreationDate="2015-12-23T14:22:13.363" Score="1" ViewCount="1019" Body="&lt;p&gt;I was trialing &lt;a href=&quot;https://soniccharge.com/permut8&quot; rel=&quot;nofollow&quot;&gt;this audio plug-in from SonicCharge&lt;/a&gt; (there's a program demo in the site).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It claims to be based on a delay line and uses some logic to modify it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;At its core is a 12-bit digital delay with variable sample rate from $0$ to $352\textrm{ kHz}$. The delay is controlled by a programmable processor that allows you to change and modulate the delay time with various &quot;operators&quot;. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know from previous readings that delay lines can be used to construct a pitch shifter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the properties in the delay line that allow for such numerous applications? &lt;br&gt;I.e. what is it based on that the delay line can create such a varied amount of effects?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="1629" LastEditDate="2016-08-20T07:24:23.193" LastActivityDate="2017-07-16T13:27:04.263" Title="How do delay lines create so many effects?" Tags="|audio|delay|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27879" PostTypeId="1" AcceptedAnswerId="27886" CreationDate="2015-12-23T15:09:56.127" Score="1" ViewCount="1409" Body="&lt;p&gt;I am implementing the &lt;strong&gt;1D Kalman Filter&lt;/strong&gt; in Python on a fundamentally noisy set of measurement data, and I should be observing a large amount of smoothing...but, instead, my &lt;strong&gt;Kalman Filter&lt;/strong&gt; is doing the exact opposite of smoothing, so that my filtered results look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WZhT1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WZhT1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since my &quot;model&quot; is just the simple trend formula, $$x_{k} = 3*(x_{k-1} - x_{k-2}) + x_{k-3} $$&#xA;the model comes up with outrageous predictions when the expected smoothing doesn't happen:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lz6XT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lz6XT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working off an incompletely specified &lt;strong&gt;1D Kalman Filter&lt;/strong&gt; implementation, so I am having to fill in the gaps...but I should be seeing much softer filtered values, with the peaks and valleys being outliers, with my naive model.  Also, my predictions should actually be more modest than the actual data (which would follow from a smoothed filtered collection).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to figure out what I am missing.  Here is the pseudo code for what I have implemented so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; Step 1: Minimize T = -log(Q/R) in order to discover Q&#xA;         Here I basically run the kalman filter with given T values, &#xA;         calculating Q from the Residual std&#xA;&#xA; Step 2: Run Kalman Filter with T held constant&#xA;&#xA; xprior = [x1,x2,x3] (calculated from the first three values of data)&#xA;&#xA; #prediction&#xA; x_{k|k-1} = model_estimate(xprior)&#xA;&#xA; #add measurement&#xA; innovation = data[k] - x_{k|k-1}&#xA; K = R / (R + Q)&#xA;&#xA; #filtered value&#xA; x_{k|k} = x_{k|k-1} + K*(innovation)&#xA;&#xA;&#xA; xprior &amp;lt;- update_xprior(x_{k|k})&#xA;&#xA; residuals &amp;lt;- update_residuals(measurement,x_{k|k})&#xA;&#xA; R = variance(residuals)&#xA; Q = e^(-T)*R&#xA;&#xA; ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I must be missing something...Also, I am not confident that what I am doing with T and the way I am calculating Q is correct...but I should be seeing smoothing regardless, since that is what they did in the document I am working off of. &lt;/p&gt;&#xA;" OwnerUserId="18847" LastActivityDate="2015-12-24T02:49:39.620" Title="Implementing a 1-D Kalman Filter Regression, Missing the smoothing action (getting the opposite)" Tags="|signal-analysis|algorithms|kalman-filters|gaussian|smoothing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27881" PostTypeId="1" CreationDate="2015-12-23T16:57:52.453" Score="3" ViewCount="358" Body="&lt;p&gt;The Hilbert transform is a procedure that can be used to perform a 90° phase shift on a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the computation of (a discretized) Hilbert transform a &quot;lossless&quot; process? I.e. it merely phase shifts the signal, but does not alter it in any other way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for asking is that the following picture here looks like it introduces slight variation in the Hilbert transformed signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xmy1o.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xmy1o.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;http://www.originlab.com/doc/Origin-Help/Hilbert-Transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.originlab.com/doc/Origin-Help/Hilbert-Transform&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2016-04-22T12:21:16.817" Title="Is the Hilbert transform computable &quot;losslessly&quot;?" Tags="|hilbert-transform|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27882" PostTypeId="2" ParentId="27878" CreationDate="2015-12-23T19:07:06.130" Score="0" Body="&lt;p&gt;&quot;Delay Effect&quot; refers to more than just a simple delay. Typically there is a feedback parameter that allows running the output back into the input so multiple echos are created. This feedback path often has a filter that allows shaping the frequency content of the echos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fancier delays have multiple &quot;taps&quot; that can be combined or fed back to create specific temporal patterns. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the delay amount varies with time, the frequencies of input signal will indeed be changed. However, that's not a actually pitch shifter (which changes frequency while maintaining the signal timing) but it's more a modulation effect like a Chorus, phaser, of flanger. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-12-23T19:07:06.130" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27883" PostTypeId="1" AcceptedAnswerId="27885" CreationDate="2015-12-23T19:38:48.057" Score="2" ViewCount="821" Body="&lt;p&gt;I know what a delay is, but&#xA;what's a delay &lt;strong&gt;line&lt;/strong&gt;? &lt;br&gt;What's the reason for calling it a &quot;delay line&quot;?&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2015-12-25T12:02:19.140" Title="What's a &quot;delay line&quot;?" Tags="|delay|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27884" PostTypeId="2" ParentId="27881" CreationDate="2015-12-23T19:42:20.367" Score="1" Body="&lt;p&gt;The loss you are seeing is due to the use of a finite length rectangular window.  If your signal is long enough that you can ignore the Hilbert filter transients at the both ends of the window (e.g. if it is infinite in length or so long that you don't care about the ends below some noise floor), then the process won't have the particular visible losses that your example points out.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-23T19:42:20.367" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27885" PostTypeId="2" ParentId="27883" CreationDate="2015-12-23T21:10:57.300" Score="5" Body="&lt;p&gt;The term &lt;strong&gt;delay line&lt;/strong&gt; comes from (analog) telecommunications where timing between different signals needed to be adjusted by delaying one of them. For example, &lt;a href=&quot;http://www.hawestv.com/mtv_color%5Cdelayline.htm&quot; rel=&quot;noreferrer&quot;&gt;the chrominance and luminance channels in a cathode-ray-tube colour television.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason it's called a &lt;strong&gt;line&lt;/strong&gt; is because that's all it really is: a wire. The website linked to above has the following diagram of one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UruXU.gif&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UruXU.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the discrete (digital) domain, I've more usually heard delay lines called &lt;a href=&quot;http://www.dsprelated.com/freebooks/pasp/Tapped_Delay_Line_TDL.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;tapped&lt;/em&gt; delay lines&lt;/strong&gt;&lt;/a&gt;.  That's because each sample is a delay, and to form an FIR filter, we need access (to &lt;em&gt;tap&lt;/em&gt; into) the signal at different delays.  The line of $z^{-1}$ boxes in the diagram below is what I would call a tapped delay line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/imBk7.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/imBk7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-23T21:10:57.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27886" PostTypeId="2" ParentId="27879" CreationDate="2015-12-24T02:49:39.620" Score="2" Body="&lt;p&gt;So let's try to piece the signal model together first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state vector, $\mathbf{x}_k$ is just&#xA;$$&#xA;\mathbf{x}_k = [ x_{k-1}\ x_{k-2}\ x_{k-3} ]^T&#xA;$$&#xA;and the state update equation is just&#xA;$$&#xA;\mathbf{x}_k = \left[&#xA;\begin{array}{ccc}&#xA;3 &amp;amp; -3 &amp;amp; 1 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{array}&#xA;\right] \mathbf{x}_{k-1} + &#xA;\left[&#xA;\begin{array}{c}&#xA;1 \\&#xA;0 \\&#xA;0 \\&#xA;\end{array}&#xA;\right] v_k&#xA;$$&#xA;where $v_k$ is some driving noise which is Gaussian, zero mean, with variance $\sigma_v^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the output equation is just&#xA;$$&#xA;x_k = \left[\begin{array}{ccc}&#xA;1 &amp;amp; 0 &amp;amp; 0&#xA;\end{array}&#xA;\right] \mathbf{x}_k + w_k&#xA;$$&#xA;where $w_k$ is Gaussian, zero mean, with variance $\sigma_w^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I set $\sigma_v$ to be $1$ and $\sigma_w$ to be 0.01 and generate one realization of the signal then I get the plot below (blue line)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4PZEk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4PZEk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to be similar to the measurements you're graphing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the red line is what happens when I try to apply the Kalman filter to the signal model above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bottom line: I seem to get similar results to what you are seeing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect part of the problem is that the signal model is not stable, as the state transition matrix has eigenvalues:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1.0000055+0.0000000i 0.9999973+0.0000048i 0.9999973-0.0000048i&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;the first of which is definitely outside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#27879&#xA;&#xA;T &amp;lt;- 100&#xA;&#xA;#H = [3 -3 1]&#xA;H &amp;lt;- matrix(c(1,0,0),c(1,3)) &#xA;&#xA;#F is just a tapped delay line&#xA;alpha &amp;lt;- matrix(c(0.9,0,0,0,0.9,0,0,0,0.9),3,3)&#xA;A &amp;lt;- matrix(c(3,1,0,-3,0,1,1,0,0),3,3)&#xA;B &amp;lt;- matrix(c(1,0,0),c(3,1))&#xA;&#xA;sigma_v &amp;lt;- 1&#xA;v &amp;lt;- rnorm(T,0,sigma_v)&#xA;sigma_w &amp;lt;- 0.01&#xA;w &amp;lt;- rnorm(T,0,sigma_w)&#xA;&#xA;x &amp;lt;- matrix(c(0,0,0),c(3,1))&#xA;z &amp;lt;- rep(0,T)&#xA;&#xA;for (t in 1:T)&#xA;{&#xA;  z[t] &amp;lt;- H %*% x + w[t]&#xA;  x &amp;lt;- A %*% x +v[t]&#xA;}&#xA;par(mfrow=c(1,1))&#xA;plot(z,type=&quot;l&quot;, col=&quot;blue&quot;, lwd=5)&#xA;&#xA;Q &amp;lt;- matrix(c(0,0,0,0,0,0,0,0,sigma_v^2),3,3)&#xA;R &amp;lt;- sigma_w^2&#xA;&#xA;&#xA;library(&quot;MASS&quot;) # For pseudo inverse ginv()&#xA;&#xA;xkm1km1 &amp;lt;- matrix(rep(0,3*T+3),3,T+1)&#xA;xkkm1 &amp;lt;- matrix(rep(0,3*T),3,T)&#xA;K &amp;lt;- matrix(rep(0,3*T),3,T)&#xA;Pkm1km1 &amp;lt;- matrix(c(1000,0,0 ,0,1000,0, 0,0,1000),3,3)&#xA;zhat &amp;lt;- matrix(rep(0,T),c(T,1))&#xA;&#xA;for (k in 1:T)&#xA;{&#xA;  xkkm1[,k] &amp;lt;- A %*% xkm1km1[,k]&#xA;  Pkkm1 &amp;lt;- A %*% Pkm1km1 %*% t(A) + Q&#xA;  K[,k] &amp;lt;- Pkkm1 %*% t(H) %*% ginv( H %*% Pkkm1 %*% t(H) + R)&#xA;  xkm1km1[,k+1] &amp;lt;- xkkm1[,k] + K[,k] %*% (z[k] - H %*% xkkm1[,k])&#xA;  Pkm1km1 &amp;lt;- (matrix(c(1,0,0,0,1,0,0,0,1),3,3) - K[,k] %*% H) %*% Pkkm1  &#xA;  zhat[k] &amp;lt;- as.numeric(H %*% xkkm1[,k])&#xA;}&#xA;lines(zhat, col=&quot;red&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2015-12-24T02:49:39.620" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27890" PostTypeId="1" CreationDate="2015-12-24T08:23:03.557" Score="0" ViewCount="5600" Body="&lt;p&gt;I am learning Wiener filtering for 2D images by myself. From one book, it reads&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;It should be noted that the study of the more general problem of signal denoising dates&#xA;back to at least Norbert Wiener in the 1940s. The celebrated Wiener filter provides the optimal solution to the recovery of Gaussian signals contaminated by AWGN. The derivation&#xA;of Wiener filtering, based on the so-called orthogonality principle, represents an elegant solution and the only known situation where constraining to linear solutions does not render&#xA;any sacrifice on the performance.&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It mentions Gaussian signals. I know Gaussian noise. What is Gaussian signal? I cannot find the definition of Gaussian signal via google. Does it mean one signal is contaminated by Gaussian noise? &lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2015-12-24T12:33:06.477" Title="what is a Gaussian signal?" Tags="|image-processing|noise|gaussian|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27892" PostTypeId="2" ParentId="27890" CreationDate="2015-12-24T09:57:21.700" Score="1" Body="&lt;p&gt;The goal of the Wiener filter is to compute a statistical estimation of an unknown signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic theoretical model is that at every time point a Gaussian random number is produced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My answer was copied from:&#xA;&lt;a href=&quot;https://en.m.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow&quot;&gt;https://en.m.wikipedia.org/wiki/Wiener_filter&lt;/a&gt;&#xA;&lt;a href=&quot;http://sepwww.stanford.edu/sep/prof/pvi/tsa/paper_html/node6.html&quot; rel=&quot;nofollow&quot;&gt;http://sepwww.stanford.edu/sep/prof/pvi/tsa/paper_html/node6.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18854" LastActivityDate="2015-12-24T09:57:21.700" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27893" PostTypeId="2" ParentId="27881" CreationDate="2015-12-24T10:55:12.860" Score="1" Body="&lt;p&gt;Theoretically, the Hilbert operator $\mathcal{H}$ is lossless in the sense that $\mathcal{H}^4 = \mathcal{I}$ (it is an anti-involution). Numerically, this can be verified on the following zero-mean odd-sized signal: four applications (using &lt;code&gt;Matlab&lt;/code&gt;'s &lt;code&gt;hilbert.m&lt;/code&gt; function) on the original signal yield the  same signal, up to minimal numerical errors (bottom plot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X61ig.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X61ig.png&quot; alt=&quot;Lossless Hilbert computations&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Honestly, I could not verify that for even-sized data. I can leave that for after xmas, or somebody clever on SE.DSP can help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you observe is an loss in interpretability: the  $\pi/2$ shift property that turns cosines into sines works in the continuous  case, on &quot;infinite size&quot; functions. The  interpretation differs on sampled (rectangular) windowed data.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-12-24T10:55:12.860" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27894" PostTypeId="2" ParentId="25037" CreationDate="2015-12-24T10:59:05.567" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html#void%20subtract(InputArray%20src1,%20InputArray%20src2,%20OutputArray%20dst,%20InputArray%20mask,%20int%20dtype&quot; rel=&quot;nofollow noreferrer&quot;&gt;Check this link&lt;/a&gt;, both are same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ovWKb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ovWKb.png&quot; alt=&quot;subtract operation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18855" LastEditorUserId="80" LastEditDate="2015-12-24T16:03:39.243" LastActivityDate="2015-12-24T16:03:39.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27895" PostTypeId="1" AcceptedAnswerId="27931" CreationDate="2015-12-24T11:09:08.003" Score="0" ViewCount="128" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oC4GI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oC4GI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't understand what the subscript '4x' or the parameter (0,0) stand for. Could anyone explain ? &lt;/p&gt;&#xA;" OwnerUserId="17642" LastActivityDate="2016-02-24T16:12:06.540" Title="This is an expression for the computation of kurtosis." Tags="|wavelet|statistics|random-process|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27896" PostTypeId="1" AcceptedAnswerId="27903" CreationDate="2015-12-24T11:15:44.327" Score="4" ViewCount="1282" Body="&lt;p&gt;I'd like to compute the response to a step function of a electrical/thermal system. Generally I can &quot;easily&quot; compute the transfer function $H$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega) = \frac{V_{out}(\omega)}{V_{in}(\omega)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the Fourier transform ($\mathcal{F}$) of the Heaviside function is (computed with WA):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{F}(\theta(t)) = V_{in}(\omega) = \sqrt{\frac{\pi}{2}}\delta(\omega)+\frac{i}{\sqrt{2\pi}\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, noting $\mathcal{IF}$ the Inverse Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$V_{out}(t) = \mathcal{IF} \left\{ \left( \sqrt{\frac{\pi}{2}}\delta(\omega)+\frac{i}{\sqrt{2\pi}\omega} \right) H(\omega) \right\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check my math I tried to compute the response for a simple RC system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6H6lP.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6H6lP.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should get the well known charge of the capacitor. The transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega) = \frac{1}{1+i\omega R C}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computing the Inverse Fourier transform ($\mathcal{IF}$) with WA ($R=C=1$) I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CKnbV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CKnbV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be correct if we were going backward in time :/. So the question is... What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did the same using Laplace Transforms and everything works fine... But I don't understand why.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I don't want another method, I just want to understand what's wrong in my approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. the reason why I am using WA is that for my more complicated system I need to compute the Fourier transforms using WA.&lt;/p&gt;&#xA;" OwnerUserId="18856" LastActivityDate="2015-12-25T11:54:42.413" Title="Response of a system to a step function (heaviside)" Tags="|filters|signal-analysis|fourier-transform|transfer-function|laplace-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27897" PostTypeId="2" ParentId="27890" CreationDate="2015-12-24T12:33:06.477" Score="2" Body="&lt;p&gt;The stochastic description of signals is realized by random processes. The book you cite actually speaks of a Gaussian random process. By definition, every random variable drawn from that process has a Gaussian probabilty density function. Mathematically speaking: let $\mathbf X(n)$ be the random process representing the signal, then for every $n_1$ the random variable&#xA;$$&#xA;X=\mathbf X(n_1)&#xA;$$&#xA;is Gaussian distributed. This in turn means, that $X$ has the probability density function&#xA;$$&#xA;p_\mathrm X (x) = \frac{1}{\sqrt{2\pi\sigma^2}}\mathrm e^{-\frac{(x-\mu)^2}{2\sigma^2}},&#xA;$$&#xA;where $\mu$ and $\sigma$ are the mean and standard deviation of $X$, respectively.&lt;/p&gt;&#xA;" OwnerUserId="1606" LastActivityDate="2015-12-24T12:33:06.477" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27899" PostTypeId="1" CreationDate="2015-12-24T13:35:53.757" Score="1" ViewCount="684" Body="&lt;p&gt;i want to create a Saliency Map based on &lt;a href=&quot;http://ilab.usc.edu/bu/theory/index.html&quot; rel=&quot;nofollow&quot;&gt;itti&lt;/a&gt; model via OpenCV(Python). what i'm doing is that:&#xA;1- first i change image color space from RGB to LAB color space&#xA;2- for each color channel, i create a Pyramid with 6 level&#xA;3- from bigger image to smaller, first i make them a fixed size, then differ them via cv2.subtract command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What i expect is that, in each step of differencing, i should lose details and focus on salient regions but what a get is a black screen. in fact, subtracting removes all image data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cv2&#xA;import numpy as np&#xA;&#xA;sign =  cv2.imread(&quot;sign.jpg&quot;)&#xA;&#xA;#size of image&#xA;height = np.size(sign, 0)&#xA;width = np.size(sign, 1)&#xA;&#xA;#converting LAB color space&#xA;lab = cv2.cvtColor(sign, cv2.COLOR_BGR2LAB)&#xA;&#xA;#extracting color channels&#xA;l= lab[:,:,0]&#xA;a= lab[:,:,1]&#xA;b= lab[:,:,2]&#xA;&#xA;a_channel = a.copy()&#xA;b_channel = b.copy()&#xA;&#xA;a_prm = [a_channel]&#xA;b_prm = [b_channel]&#xA;&#xA;&#xA;for i in xrange(6):&#xA;    a_channel = cv2.pyrDown(a_channel)&#xA;    b_channel = cv2.pyrDown(b_channel)&#xA;&#xA;    a_prm.append(cv2.resize(a_channel, dsize=(width,height)))&#xA;    b_prm.append(cv2.resize(b_channel, dsize=(width,height)))&#xA;&#xA;a_map = a_prm[0]&#xA;for i in range(1,6):&#xA;        print(i)&#xA;        a_map = cv2.subtract(a_map,a_prm[i])&#xA;&#xA;cv2.imshow('a_map',a_map)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="18461" LastActivityDate="2018-01-26T01:18:33.070" Title="Saliency Map based on itti model" Tags="|image-processing|opencv|image-segmentation|dsp-core|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27900" PostTypeId="2" ParentId="27896" CreationDate="2015-12-24T16:16:13.267" Score="1" Body="&lt;p&gt;You are doing a mistake while converting $V_{out}(\omega)$ back in time.&#xA;For your conveninence let me solve the problem. I will use a slightly different notation in which 'j' will represent imaginary numbers instead of 'i' and a factor of $\sqrt{2\pi}$ won't appear around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you've already provided; given an input as a step signal $ v_{in}(t) = u(t)$ whose Continuous-Time Fourier Transform is $ V_{in}(j\omega) = U(j\omega) = 1/j\omega + \pi\delta(\omega)$ and a system Transfer Function $H(j\omega) = 1 / (1+j\omega RC)$ of the linear RC network provided in your example, CT Fourier Transform of the output is given by $V_{out}(j\omega) = V_{in}(j\omega)H(j\omega) $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply carry out the algebra to get the result as:&#xA;$$ V_{out}(j\omega) = ({1\over j\omega} + \pi\delta(\omega)) ( {1 \over 1+j\omega RC}) $$&#xA;$$ = {1\over j\omega}{1 \over 1+j\omega RC} + \pi\delta(\omega) ({1 \over 1+j\omega RC}|_{w=0}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = {1\over j\omega}{1 \over 1+j\omega RC} + \pi\delta(\omega) $$&#xA;$$ = {A\over j\omega} + {B \over 1+j\omega RC} + \pi\delta(\omega) $$&#xA;$$ = {1\over j\omega} + {-RC \over 1+j\omega RC} + \pi\delta(\omega) $$&#xA;$$V_{out}(j\omega) = ({1\over j\omega}+ {\pi\delta(\omega)}) + {-RC \over 1+j\omega RC} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, convert this final form back into time by recognising the first 2 terms as the CTFT of a unit-step u(t) signal and the 3rd term as the CTFT of an right sided exponential signal, and utilizing the linearity property of Fourier Transforms...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$v_{out}(t) = ICTFT( ({1\over j\omega}+ {\pi\delta(\omega)}) ) + ICTFT( {-RC \over 1+j\omega RC} ) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = ICTFT( ({1\over j\omega}+ {\pi\delta(\omega)}) ) + ICTFT( {-1 \over 1/RC + j\omega} ) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ = u(t) - e^{-t/{RC}}u(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$v_{out}(t) = ( 1 - e^{-t/{RC}} ) u(t) $$... As Expected...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2015-12-24T17:23:30.390" LastActivityDate="2015-12-24T17:23:30.390" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27902" PostTypeId="1" AcceptedAnswerId="27952" CreationDate="2015-12-24T20:29:25.377" Score="1" ViewCount="3152" Body="&lt;p&gt;I'm currently designing a knock sensor for my FSAE team's car and I'd like to be able to test various software strategies with a fairly realistic signal (at least more realistic than a couple sine waves added together with some white noise). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From some reading, the frequencies I'll be getting will all be related to a fundamental frequency directly related to engine speed. As engine speed varies continuously, I'd like to be able to take a vector of times and transform it into a vector of frequencies that smoothly and randomly transition within the range 20-170 Hz, ideally with a uniform distribution. I can then create a couple sine waves based on these frequencies and a couple multiples, add them, add some white noise, add a knock at random points, then feed that into my knock detection code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's generating a smooth, uniformly distributed frequency vector that is my current issue, but I'm also open to other solutions to the problem.&lt;/p&gt;&#xA;" OwnerUserId="18862" LastActivityDate="2016-11-08T11:19:44.293" Title="how to generate a smooth sine wave with time varying frequency in matlab" Tags="|matlab|signal-analysis|continuous-signals|signal-detection|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27903" PostTypeId="2" ParentId="27896" CreationDate="2015-12-24T22:12:42.713" Score="2" Body="&lt;p&gt;Fat32's derivation of the result via the Fourier transform is correct, but I think that your original question hasn't really been answered (&quot;what am I doing wrong?&quot;). The real reason why WolframAlpha gives you a wrong result is the different definitions of the Fourier transform used by WolframAlpha and the one used by you to derive $H(\omega)$. By default, WolframAlpha uses &lt;a href=&quot;https://reference.wolfram.com/language/ref/FourierTransform.html&quot; rel=&quot;nofollow&quot;&gt;this definition&lt;/a&gt; of the Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}f(t)e^{j\omega t}dt\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from the factor $1/\sqrt{2\pi}$ (which makes the transform unitary), the actual problem lies in the sign of the exponent. You implicitly assume a negative sign, whereas WolramAlpha uses a positive sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways to solve the problem. Either you change Wolfram Alpha's default parameters using &lt;code&gt;FourierParameters -&amp;gt; {1, -1}&lt;/code&gt; as explained &lt;a href=&quot;https://reference.wolfram.com/language/ref/FourierTransform.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, or you change $H(\omega)$ accordingly, which means that you would need to use&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=\frac{1}{1-j\omega RC}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example I tried the second method, and WolframAlpha indeed provides the &lt;a href=&quot;http://wolfr.am/9dKVAX6y&quot; rel=&quot;nofollow&quot;&gt;correct result&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more thing, for this kind of problems it's usually more convenient to use the Laplace transform because this avoids the use of generalized functions, such as the Dirac delta.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-25T11:54:42.413" LastActivityDate="2015-12-25T11:54:42.413" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27904" PostTypeId="1" CreationDate="2015-12-25T06:46:56.930" Score="2" ViewCount="464" Body="&lt;p&gt;I have two finite signals $x[n]$ and $h[n]$, I want to convolve these signals&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EEypK.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EEypK.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using the method defined in Example 2.2 of Signals and Systems by Oppenheim. I am getting this answer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[-3]=4, y[-2]=11, y[-1]=12, y[0]=8, y[1]=0, y[2]=-2, y[3]=-2, y[4]=-1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and when I tried to solve this question using the method defined in example 2.1 of Signals and Systems by Oppenheim, I am getting different answer. Shouldn't  it be the same?&#xA;$$ y[-5]=4, y[-4]=11, y[-3]=12, y[-2]=8, y[-1]=0, y[0]=-2, y[1]=-2, y[2]=-1 $$&#xA;its 2 unit shifted right side&lt;/p&gt;&#xA;" OwnerUserId="18359" LastEditorUserId="80" LastEditDate="2016-04-24T16:21:28.523" LastActivityDate="2019-07-26T23:36:52.430" Title="Question related to Discrete signal convolution" Tags="|discrete-signals|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27905" PostTypeId="2" ParentId="26025" CreationDate="2015-12-25T09:09:13.483" Score="2" Body="&lt;p&gt;Your lowpass filter is the cascade of two 3-point moving average filters each implemented as &lt;em&gt;recursive running sum&lt;/em&gt; filters. (It's gain at 5 Hz is -2.4 dB.) I can't interpret your code but I'm guessing your feedback operations are incorrect. To test your code, make sure all accumulator variables are set to zero. Then apply a unit impulse to your filter and see if its impulse response is [1, 2, 3, 2, 1, 0, 0, 0, ...] as it should be.  If you change your $H(z)$ exponents from $2$ to $1$, then your filter's impulse response should be [1, 1, 1, 0, 0,0,  ...]. If your impulse responses do not agree with the above, then finding out why they don't will solve your problem.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-25T09:09:13.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27906" PostTypeId="2" ParentId="27904" CreationDate="2015-12-25T09:21:26.697" Score="1" Body="&lt;p&gt;Your solution based on Example 2.2 of A.Oppenheim's Signals &amp;amp; Systems is wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that example, the output &#xA;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = \sum_{k=-\infty}^{\infty} {x[k]h[n-k]}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;is computed by the graphical method (a.k.a. flip-and-drag method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the nonzero range of input &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, this becomes: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$y[n] = \sum_{k=-2}^{2} { x[k]h[n-k] }$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also based on the nonzero range of &lt;span class=&quot;math-container&quot;&gt;$h[n]$&lt;/span&gt;, it can be seen that &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; has nonzero samples in the range from &lt;span class=&quot;math-container&quot;&gt;$n=-5$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the flip &amp;amp; drag method, it's best to draw the shifted functions &lt;span class=&quot;math-container&quot;&gt;$h[n-k]$&lt;/span&gt;, to guide the computation process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key is to recognise the nonzero range for the flipped &amp;amp; dragged function &lt;span class=&quot;math-container&quot;&gt;$h[n-k]$&lt;/span&gt; ; time reversed &lt;span class=&quot;math-container&quot;&gt;$h[-k]$&lt;/span&gt; shifted by &quot;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&quot;, drawn on an axis of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; and thus considered as a function of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that the overlap between the functions &lt;span class=&quot;math-container&quot;&gt;$x[k]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$h[n-k]$&lt;/span&gt; begins at the shift of &lt;span class=&quot;math-container&quot;&gt;$n = - 5$&lt;/span&gt;, from the left side of &lt;span class=&quot;math-container&quot;&gt;$x[k]$&lt;/span&gt; (the sample &lt;span class=&quot;math-container&quot;&gt;$x[-2]$&lt;/span&gt;) and continues until the shift for &lt;span class=&quot;math-container&quot;&gt;$n = 2$&lt;/span&gt; at the right side of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; (sample &lt;span class=&quot;math-container&quot;&gt;$x[2]$&lt;/span&gt;). For any other &quot;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&quot; value, there is no overlap between &lt;span class=&quot;math-container&quot;&gt;$x[k]$&lt;/span&gt; and shifted &lt;span class=&quot;math-container&quot;&gt;$h[n-k]$&lt;/span&gt; and output &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; becomes zero. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2019-07-26T23:36:52.430" LastActivityDate="2019-07-26T23:36:52.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="27908" PostTypeId="1" CreationDate="2015-12-25T09:30:22.670" Score="1" ViewCount="1246" Body="&lt;p&gt;eg. z=conv(u,v) where u is the input signal encoded in 24KHz sampling rate and v ,the impulse response encoded in 44kHz .&#xA;z is played at 24KHz rate .&#xA;In the convolution function ,we basically perform a convolution of input and impulse response samples.But reading across the net, I found that for convolution the input and impulse signals must be signals encoded at the same rate.&#xA;How true is this?&lt;/p&gt;&#xA;" OwnerUserId="18865" LastEditorUserId="18865" LastEditDate="2015-12-25T11:42:33.580" LastActivityDate="2015-12-25T21:29:43.177" Title="In MATLAB ,do the input signals need to be of the same sampling rate for the conv function to work correctly?" Tags="|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27910" PostTypeId="2" ParentId="27902" CreationDate="2015-12-25T09:49:56.817" Score="0" Body="&lt;p&gt;The wording of your question (your terminology) makes it difficult to understand exactly what you desire. Is your question, &quot;Using Matlab, how do I generate a time-domain sequence representing a sinusoidal wave whose instantaneous frequency increases as a linear function of time so that its spectrum contains a broad band of spectral energy?&quot; If so, then try the following example Matlab code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;       % Signal sample rate in Hz&#xA;&#xA;Dur = 1;         % Signal's 1-second time duration&#xA;&#xA;Time = 0:1/Fs:Dur;  &#xA;&#xA;Fstart = 100;    % Start freq is 100 Hz&#xA;&#xA;Fstop = 400;     % Final freq is 400 Hz&#xA;&#xA;Sig = chirp(Time,Fstart,Dur,Fstop);   % Generate a &quot;chirp&quot; sequence&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;rpatel, generate the above 'Sig' signal, compute its DFT samples, and plot the DFT's spectral magnitude values. Maybe that's what you want.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="21252" LastEditDate="2016-11-08T11:19:44.293" LastActivityDate="2016-11-08T11:19:44.293" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27911" PostTypeId="2" ParentId="27908" CreationDate="2015-12-25T11:15:34.967" Score="2" Body="&lt;p&gt;What an interesting question! An impulse response sequence, taken on its own, does not have a specific numerical sample rate (measured in Hz) associated with it. If I applied a [1, 0, 0, 0, ...] unit impulse sequence to a 3-point moving average lowpass filter then the filter's impulse response would be the sequence [1/3, 1/3, 1/3, 0, 0, 0, ...].  There's no specific numerical sample rate (measured in Hz) associated with either the input unit sample sequence or the filter's impulse response sequence. If you insist on talking about the somewhat unusual notion of the &lt;em&gt;sample rate of a filter's impulse response&lt;/em&gt; I suppose you can say, &quot;The sample rate of a filter's impulse response is always equal to the filter's input data sample rate.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if to my 3-point lowpass moving average filter I apply an input sequence whose sample rate is 1000 samples/second (1 kHz), then the filter's output sequence has a sample rate of 1000 samples/second. On the other hand, if I apply an input sequence whose sample rate is 24000 samples/second (24 kHz) to the &lt;em&gt;same&lt;/em&gt; lowpass filter, then the filter's output sequence will have a sample rate of 24000 samples/second. (WARNING: I suggest you never discuss &lt;em&gt;the sample rate of a filter's impulse response&lt;/em&gt; during a job interview.)&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-25T11:15:34.967" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27912" PostTypeId="2" ParentId="27883" CreationDate="2015-12-25T12:02:19.140" Score="1" Body="&lt;p&gt;To substantiate hotpaw2's comment, I once worked a commercial radio station and they had a rack-mounted device containing a stainless steel spring about 5&quot; in length. By way of electronics they would apply a back-n-forth rotational torque, at audio frequencies, to one end of the spring. The vibrating wave traveled down the spring and was sensed by a piezoelectric sensor at the far end. Adding the sensor output voltage to the original audio signal produced a desirable echo. The disc jockeys referred to that device &quot;the delay line.&quot;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-25T12:02:19.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27913" PostTypeId="1" AcceptedAnswerId="27916" CreationDate="2015-12-25T12:57:03.323" Score="0" ViewCount="60" Body="&lt;p&gt;everyone&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fs=30 000 , fc=3000;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3kXlp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3kXlp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when i code apply this in matlab result is very difference&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a]=butter(2,3000/30000,'low');&#xA;b=[0.020083365564211 0.040166731128423 0.020083365564211],&#xA;a=[1 -1.561018075800718 0.641351538057563]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but when i suddenly remember in matlab use nyquist sampling so , when i do apply fs/2 , result is still difference&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a]=butter(2,3000/15000,'low');&#xA;b=[0.067455273889072 0.134910547778144 0.067455273889072]&#xA;a=[1 -1.142980502539901 0.412801598096189]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;thank you for helping sorry my bad language&lt;/p&gt;&#xA;" OwnerUserId="17615" LastEditorUserId="4298" LastEditDate="2020-11-08T17:00:13.573" LastActivityDate="2020-11-08T17:00:13.573" Title="why difference between this example and matlab result" Tags="|matlab|filters|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27914" PostTypeId="1" CreationDate="2015-12-25T16:28:08.260" Score="0" ViewCount="177" Body="&lt;p&gt;In finance, many &quot;indicators&quot; are used in order to make prediction about if a price has an increasing or decreasing &lt;em&gt;trend&lt;/em&gt; over time.&lt;br&gt;&#xA;Among them, &lt;a href=&quot;https://en.wikipedia.org/wiki/MACD&quot; rel=&quot;nofollow&quot;&gt;MACD&lt;/a&gt; is a popular one. There are many slighlty different definitions (standard rolling mean vs. exponential rolling mean, etc.), but one of them is :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the price is $x[n]$   (let's say the sampling rate is 1 second, but we could also use 1 day...)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$y_1[n]$ is the 12-period rolling mean, $y_2[n]$ is the 26-period rolling mean, i.e. :&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$y_1[n] = \frac{1}{12} x[n] + \frac{1}{12} x[n-1] + ... + \frac{1}{12} x[n-11]$$ and the same for $y_2$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the MACD is defined by $y_1 - y2$, i.e. :&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$macd[n] = \frac{7}{156} x[n] + \frac{7}{156} x[n-1] + ... + \frac{7}{156} x[n-11] - \frac{1}{26} x[n-12] - \frac{1}{26} x[n-13] + ... - \frac{1}{26} x[n-25]$$&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Question:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to have a signal processing interpretation of what's going on with $macd[n]$? I can see it's a linear filter, but how to know what it is doing? Can we draw a frequency response?&lt;/strong&gt;&#xA;It also seems that, because of rolling mean, some lag / delay is introduced.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Remark: When people use MACD, they don't stop with $macd[n]$: they define $signal[n]$ as the 9-period rolling mean of $macd[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$signal[n] = \frac{1}{9} macd[n] + \frac{1}{9} macd[n-1] + ... + \frac{1}{9} macd[n-8]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the &lt;strong&gt;indicator which is finally used is&lt;/strong&gt;  (this sounds like a magic trick! why these choices?):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n] = macd[n] - signal[n] = &#xA;-\frac{14}{351}x[n]-\frac{49}{1404} x[n-1]-\frac{7}{234} x[n-2]-\frac{35}{1404} x[n-3]-\frac{7}{351} x[n-4]-\frac{7}{468} x[n-5]-\frac{7}{702} x[n-6]-\frac{7}{1404} x[n-7]+\frac{2}{27} x[n-12]+\frac{7}{108} x[n-13]+\frac{1}{18} x[n-14]+\frac{5}{108} x[n-15]+\frac{1}{27}x[n-16]+\frac{1}{36}x[n-17]+\frac{1}{54}x[n-18]+\frac{1}{108}x[n-19]-\frac{4}{117}x[n-26]-\frac{7}{234}x[n-27]-\frac{1}{39}x[n-28]-\frac{5}{234}x[n-29]-\frac{2}{117}x[n-30]-\frac{1}{78}x[n-31]-\frac{1}{117}x[n-32]-\frac{1}{234}x[n-33]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When $h[n]$ is positive the trend of $x[n]$ is more or less increasing, and when $h[n]$ is negative, the trend of $x[n]$ is more or less decreasing.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Question:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What does $h[n]$ do, with a DSP point of view?&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2015-12-25T19:12:18.090" Title="What does this signal filter do? (coming from finance)" Tags="|filters|filter-design|frequency-response|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27916" PostTypeId="2" ParentId="27913" CreationDate="2015-12-25T17:33:44.807" Score="1" Body="&lt;p&gt;When you use Matlab's function &lt;code&gt;butter&lt;/code&gt;, all frequencies need to be normalized by $f_s/2$, so your second call to the function &lt;code&gt;butter&lt;/code&gt; is the correct one, the first one is wrong. And, as usually, Matlab is correct. The difference between the solution in your book and Matlab's solution is that the function &lt;code&gt;butter&lt;/code&gt; uses prewarping to guarantee that after the bilinear transformation, the resulting cut-off frequency of the digital filters equals the specified cut-off frequency. For whatever reason, the solution in your book doesn't take the frequency warping of the bilinear transform into account, so the resulting cut-off frequency of the digital filter does &lt;em&gt;not&lt;/em&gt; exactly equal the desired $\omega_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency warping caused by the bilinear transform used in your book maps the cut-off frequency $\omega_c$ of the analog filter to the following cut-off frequency of the resulting digital filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{\omega}_c=\frac{2}{T}\arctan\left(\frac{\omega_cT}{2}\right)=2\pi\cdot 2906.8\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;instead of $\omega_c=2\pi\cdot 3000$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check the actual cut-off frequencies of the digital filters using the following Matlab commands:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;wc = pi/5;                          % normalized cut-off frequency&#xA;wc2 = 2*atan((2*pi*3000)/30000/2);  % normalized warped cut-off frequency&#xA;[b,a] = butter(2,wc/pi,'low');      % Matlab's solution&#xA;b0 = 0.063964*[1,2,1];              % solution from book&#xA;a0 = [1,-1.168261,0.424118]&#xA;abs(freqz(b,a,[0,wc])).^2           % check |H|^2 at DC and at wc;&#xA;                                    % (should be [1,0.5])&#xA;abs(freqz(b0,a0,[0,wc])).^2         % [0.99999   0.46637]&#xA;abs(freqz(b0,a0,[0,wc2])).^2        % [0.99999   0.49999]&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This shows that the filter in the book indeed has cut-off frequency $\tilde{\omega}_c$ given in $(1)$ instead of $\omega_c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't understand the frequency warping of the bilinear transform, I'd suggest you study chapter 11 of &lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/orfanidis-i2sp.pdf&quot; rel=&quot;nofollow&quot;&gt;this excellent and free book&lt;/a&gt; by S.J. Orfanidis.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-25T17:33:44.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27917" PostTypeId="2" ParentId="27914" CreationDate="2015-12-25T19:12:18.090" Score="3" Body="&lt;p&gt;I thought you stock market tech analysts always used moving averages (rolling means) or &quot;exponential moving averagers&quot; for your smoothing operations. Anyway, your $macd[n]$ process is neither of those. As far as I can tell the frequency magnitude response of your $macd[n]$ process looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/txKrv.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/txKrv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your $macd[n]$ process does not smooth its input data in the normal sense. It amplifies input data that has a periodicity (repetition rate) of 33.3 days per cycle. In the above plot you can clearly see the &quot;mainlobe&quot; that Fat32 was referring to. If your closing price data contains a periodicity of roughly 33 days then the output of your $macd[n]$ process will be a large value. Otherwise, the output of your $macd[n]$ process will be a small value. I don't know if such a frequency response makes stock market &lt;em&gt;technical analysis&lt;/em&gt; sense, or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your $h[n]$ process, I believe its frequency magnitude response looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nDYH3.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nDYH3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your $h[n]$ process appears to be a process that amplifies input data that has a periodicity (repetition rate) of 21.9 days per cycle. In DSP we use processes like your $macd[n]$ and $h[n]$ for filtering when we want to detect the presence of components in our input signal that have periodicities of 33.3 or 21.9 time units per repetition. We call such processes &quot;resonators&quot; or &quot;bandpass filters.&quot;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-25T19:12:18.090" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="27918" PostTypeId="1" AcceptedAnswerId="27938" CreationDate="2015-12-25T19:47:25.920" Score="0" ViewCount="676" Body="&lt;p&gt;There're 4 type of FIR to chose from&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;symetry ,even &lt;/li&gt;&#xA;&lt;li&gt;symetry ,odd&lt;/li&gt;&#xA;&lt;li&gt;antisymetry, even&lt;/li&gt;&#xA;&lt;li&gt;antysymetry, odd&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Also, there are many type of window like rectangular, Hanning, Kaiser,etc So how to use a window function to design the N-length filter and what's the point of doing it? That's what my teacher ask me to do but I don't understand the reason&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I confuse here is that for example I want the ideal filter $H(\omega)$ that have passband in $\omega_a &amp;lt;\omega&amp;lt;\omega_b$ then what I need to do is just use the inverse Fourier transform to the frequency response of the ideal filter to find $h[n]$ that is infinite then use the window function to make it finite. Then what's the point of make it look like the form of one of those 4 type? Moreover, what I need to do after doing inverse Fourier Transform and window function to make it in the form of FIR digital filter with N-length? &lt;/p&gt;&#xA;" OwnerUserId="18328" LastActivityDate="2015-12-26T23:34:10.240" Title="Design one of 4 type of FIR filter by window function?" Tags="|filters|filter-design|digital|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27920" PostTypeId="2" ParentId="27908" CreationDate="2015-12-25T21:23:53.330" Score="2" Body="&lt;p&gt;A sample rate, in Hz (or samples per second), will determine a relationship between a FIR filter's impulse response, encoded as as vector of elements, and its frequency response with respect to Hz.  If you apply a FIR filter to a signal at a different sample rate then the sample rate at which the filter's frequency response was measured, described or determined, then the filter's effect will be different from one in the frequency response's description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the impulse response's described frequency response (at a different sample rate) to apply, then you may need to resample either the signal or the impulse response before convolution.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2015-12-25T21:29:43.177" LastActivityDate="2015-12-25T21:29:43.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27921" PostTypeId="1" AcceptedAnswerId="27923" CreationDate="2015-12-26T04:12:31.580" Score="1" ViewCount="1642" Body="&lt;p&gt;DSP is more kindred with electrical engineering than with computer science, how ever there are topics of DSP like MP3 encoding, JPEG compression and sound analysis can be understood by a computer engineer (with a previous strong math background in Z transform and Fourier series).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a BS in computer science that only have very basic knowledge in electronic, is there a way to name that kind of specialization in DSP? I.e. someone who is looking to create DSP algorithms that can be run from a computer but not looking to implement them in a custom piece of hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is mostly related for a computer science student who wants to apply for a master degree in an international university (no knowledge in analogic circuits, hardware description languages or microprocessors)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would applied math, be a better approach??&lt;/p&gt;&#xA;" OwnerUserId="7316" LastEditorUserId="7316" LastEditDate="2015-12-26T04:36:23.653" LastActivityDate="2015-12-30T01:44:29.480" Title="DSP for computer engineers" Tags="|audio|algorithms|" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27922" PostTypeId="1" CreationDate="2015-12-26T07:39:34.407" Score="1" ViewCount="214" Body="&lt;p&gt;I've been learning about the FFT and about the usefulness of windowing functions. A problem I'm running into is the affect of windowing functions on the amplitude of signals in the FFT. For example, lets say I have a signal that is equal to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = 5.0 * sin(50.0 * 2.0 * pi * x) + 1.0 * sin(80.0 * 2.0 * pi * x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then I want to perform an FFT and receive the following plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SnwYY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SnwYY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then if I perform a kaiser windowing function of the 14th degree, I receive the following FFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1JAZq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1JAZq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm wanting to do is the following: Given a signal, I want to extract a wave out of it of a frequency I approximately know. To do this, I'd like to apply a windowing function to make it clearer what the frequency is I'm trying to extract but not lose information about the amplitude of wave I'm trying to extract. Is this possible? Like a way to reverse the amplitude decrease from the windowing function.&lt;/p&gt;&#xA;" OwnerUserId="16054" LastActivityDate="2022-04-28T14:16:39.120" Title="Fixing for windowing function in FFT" Tags="|fft|signal-analysis|window-functions|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27923" PostTypeId="2" ParentId="27921" CreationDate="2015-12-26T08:43:35.413" Score="0" Body="&lt;p&gt;DSP is a domain mixed between EE/CE and Math/CS. &lt;br&gt;Hardware must be built, but also software written.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some CS programs do touch DSP at the software level. An applied math program would touch even more the algorithmic side, since pretty much all DSP techniques are based on certain mathematical areas such as Fourier analysis, Complex analysis and Numerical analysis. An EE program might have a specialisation on DSP, covering both the hardware and software sides but at a more &quot;applied&quot;, less &quot;proof mathematical&quot; level, than what mathematics programs do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field is that wide though that it might also be better to focus on only one thing and do it well, rather than think in a &quot;jack of all trades&quot; way, i.e. too broadly. That is, if your interest is in software and mathematics, then focus on those. If your interest is in hardware, then focus on that. Applied math is sort of a middle ground. It's both theoretical, but it will lack practice such as electronics design, even if it'd give you conceptual tools for understanding electromagnetism and digital logic.&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2015-12-26T11:11:11.760" LastActivityDate="2015-12-26T11:11:11.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27925" PostTypeId="2" ParentId="812" CreationDate="2015-12-26T11:26:19.013" Score="0" Body="&lt;p&gt;There is another algorithm which uses second order statistics: AMUSE. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dspandmath.blogspot.com.br/2015/12/blind-source-separation-with-python.html&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; you can find an implementation in Python. &lt;/p&gt;&#xA;" OwnerUserId="18867" LastEditorUserId="4298" LastEditDate="2015-12-27T09:16:43.713" LastActivityDate="2015-12-27T09:16:43.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27926" PostTypeId="2" ParentId="27918" CreationDate="2015-12-26T11:50:17.473" Score="0" Body="&lt;p&gt;The topic your referring to goes by various names such as &quot;FIR Filter Design Using Windows&quot;, &quot;Windowing Method of FIR Filter Design&quot;, &quot;Window Designed FIR Filters&quot;, etc. I'll bet your class textbook covers this topic (most DSP books do). Meaningful answers to your questions require more space than is available here. I suggest you have a look at the following web page (and its following three pages) for a decent introductory discussion of that topic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.bores.com/courses/intro/filters/4_fir.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.bores.com/courses/intro/filters/4_fir.htm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then have a look at Section 2.2 of the following web page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mikroe.com/chapters/view/72/chapter-2-fir-filters/&quot; rel=&quot;nofollow&quot;&gt;http://www.mikroe.com/chapters/view/72/chapter-2-fir-filters/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-26T11:50:17.473" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27927" PostTypeId="2" ParentId="27922" CreationDate="2015-12-26T12:08:23.423" Score="2" Body="&lt;p&gt;Perhaps the information at the following web page will be of some use to you:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dsprelated.com/showarticle/155.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Accurate Measurement of a Sinusoid's Peak Amplitude Based on FFT Data&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="7092" LastEditDate="2022-04-28T14:16:39.120" LastActivityDate="2022-04-28T14:16:39.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27928" PostTypeId="1" CreationDate="2015-12-26T14:11:23.360" Score="0" ViewCount="119" Body="&lt;p&gt;I know that when I have a discrete time signal, let's say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(t_n),\;t_n=\dfrac{n}{F_s}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of the DTFT is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F_n(\omega)=\sum_{n=0}^{N-1}f(t_n)\cdot e^{-i\omega_nt_n}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my question is regarding &lt;span class=&quot;math-container&quot;&gt;$\omega_n$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the frequencies will be discret because we can't measure lower frequencies than the difference between &lt;span class=&quot;math-container&quot;&gt;$t(n+1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t(n)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am not clear how exactly this works, and how can one determine the &quot;frequency vector&quot;. I am not sure I got the expression for &lt;span class=&quot;math-container&quot;&gt;$t(n)$&lt;/span&gt; correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sorry this question isn't 100% clear, it's because I'm trying to make heads and tails from this definition and articles online are not very clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="18549" LastEditorUserId="47251" LastEditDate="2020-02-10T18:54:26.317" LastActivityDate="2020-02-10T18:54:26.317" Title="Given a discrete time signal, what is the sequence of possible frequencies I can get from DTFT?" Tags="|fourier-transform|dtft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="27929" PostTypeId="1" CreationDate="2015-12-26T14:45:32.537" Score="0" ViewCount="1546" Body="&lt;p&gt;I want to get the fundamental frequency of a signal. I used a time domain approach first. It just sums up the differences between the signal (lets say 2048 samples) and the delayed version of the same signal. I think it's not quite what autocorrelation does because I don't pad the signal with zeros or do circular convolution. Instead, I just accessed older samples. So when compairing the signals with 1 sample delay, I check samples 1 to 2048, for a 5 sample delay I check samples 5 to 2053 and so on. For the full 2048 sample delay, I check 2048 to 4096. &#xA;This works our really well because I just need the delay where the difference is the lowest. That might not be the fundamental but haveing a closer match is more important for my actual usecase. (writing an oscilloscope)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran into performance issues, so I wanted to use FFT instead of the time domain approach. However, I've noticed that because of the zero padding of the signa, I get some kind of triangle window. I guess what would be the equivalent in the time domain approach is using zeros instead of older samples in the delayed signal. (I've attached a screen from Matlab) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is if there is some way to use FFT for processing but to get rid of this &quot;triangle window&quot; effect. Or in other words: Is there a way to implement my time domain approach using FFT?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pGIHp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pGIHp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="11623" LastActivityDate="2015-12-27T00:21:13.220" Title="finding the fundamental frequency in frequency domain" Tags="|fft|autocorrelation|window|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27930" PostTypeId="2" ParentId="27928" CreationDate="2015-12-26T15:31:35.203" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform#Definition&quot; rel=&quot;nofollow&quot;&gt;discrete-time Fourier transform (DTFT)&lt;/a&gt; is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=\sum_{n=-\infty}^{\infty}f[n]e^{-jn\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is the common definition, and it is different from the one in your question. First of all, the sequence $f[n]$ doesn't need to be of finite length. Second, the frequency variable $\omega$ is a &lt;em&gt;continuous&lt;/em&gt; variable. Your formula can be derived from $(1)$ by assuming that $f[n]$ has a finite length, and by computing the DTFT on a finite set of discrete (angular) frequencies. (Note that the frequency variable $\omega$ in $(1)$ is normalized by the sampling frequency, unlike the discrete frequencies $\omega_n$ in your question.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another related transform is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete Fourier transform (DFT)&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{F}[k]=\sum_{n=0}^{N-1}f[n]e^{-j2\pi kn/N},\qquad 0\le k&amp;lt;N\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, for finite length sequences of length $N$, is just a sampled version of the DTFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{F}[k]=F\left(\omega_k\right),\qquad \omega_k=\frac{2\pi k}{N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike the DTFT, the DFT can be computed efficiently. Efficient algorithms for computing the DFT are referred to as &lt;a href=&quot;https://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Fast Fourier transform (FFT) algorithms&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this doesn't clear up your confusion, leave a comment below.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-26T15:37:02.183" LastActivityDate="2015-12-26T15:37:02.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27931" PostTypeId="2" ParentId="27895" CreationDate="2015-12-26T15:50:13.917" Score="1" Body="&lt;p&gt;For a stationary process $x$, moments and cumulants, when they exist, depend on relative time lags, hence $n-1$ variables when the moment or cumulant is of order $n$ (see for instance &lt;a href=&quot;http://download.springer.com/static/pdf/663/bbm%253A978-1-4471-4546-2%252F1.pdf&quot; rel=&quot;nofollow&quot;&gt;Basic Signal Processing and Statistics&lt;/a&gt;, p. 446 sq.):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \mathcal{M} \{ x(k),x(k+\tau_1),x(k+\tau_2),x(k+\tau_3) \} = \mathrm{E} \{ x(k)x(k+\tau_1)x(k+\tau_2)x(k+\tau_3) \}\,. $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A standard notation is $m_{4x}(\tau_1,\tau_2,\tau_3)$, where $x$ denotes the  process, $4$ the $n$-th order, $\tau_1,\tau_2,\tau_3$ the lags, with a triple $0$ for the $0$-lag cumulants. The first $0$-lag cumulants are classicaly named variance, skewness and kurtosis. Your version seems a normalized kurtosis, which could be written, with the above notations:&#xA;$$ \kappa_{4x}(0,0,0) = \frac{m_{4x}(0,0,0)}{m_{2x}^2(0)}\,. $$ &#xA;I am quite surprised thant you only have two zeroes in your parenthesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the  origin side, &lt;a href=&quot;https://en.wikipedia.org/wiki/Kurtosis&quot; rel=&quot;nofollow&quot;&gt;kurtosis&lt;/a&gt; comes for a greek word meaning arched, curved, measuring the tailedness of a distribution.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-12-26T15:50:13.917" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="27934" PostTypeId="2" ParentId="27836" CreationDate="2015-12-26T19:13:54.470" Score="0" Body="&lt;p&gt;The translation invariant version of the DWT is known by a variety of names, including stationary wavelet transform (SWT), redundant wavelet transform, algorithm à trous, quasi-continuous wavelet transform, translation-invariant wavelet transform, shift invariant wavelet transform, cycle spinning, maximal overlap wavelet transform and undecimated wavelet transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Ebadi, Ladan, and Helmi ZM Shafri. &quot;A stable and accurate wavelet-based method for noise reduction from hyperspectral vegetation spectrum.&quot; Earth Science Informatics (2014): 1-15.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="18866" LastActivityDate="2015-12-26T19:13:54.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27935" PostTypeId="2" ParentId="27929" CreationDate="2015-12-26T21:36:10.057" Score="0" Body="&lt;p&gt;You are on the right track. To get the fundamental, you do have to zero-pad and then auto-correlate. The main peak in the above graph (looks like its at 1024) is the in-phase correlation. The second strongest peaks (looks like they are about 100 bins away from that main peak) will be at one wavelength away from the main peak, and that is the wavelength of the fundamental (I estimate about 100 bins). The reason you get the triangle effect is not so much from the zero padding (which is necessary, though), its from the fact that your window size is finite. That is, the further away from phase zero you get in an auto-correlation, the less energy matches from one data set because the more of it lies on top of the zero padding of the other data set. You can picture it by picturing the time-domain (with zero padding) auto-correlation.&lt;/p&gt;&#xA;" OwnerUserId="18821" LastActivityDate="2015-12-26T21:36:10.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27936" PostTypeId="2" ParentId="27929" CreationDate="2015-12-26T21:49:02.650" Score="1" Body="&lt;p&gt;A triangle is the convolution of a rectangle against itself.  Zero padding creates a rectangular window of data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To remove the triangle (or other windowing) artifact, you can compensate the autocorrelation of your data by using the inverse of this window overlap versus lag function.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-26T21:49:02.650" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27937" PostTypeId="2" ParentId="27315" CreationDate="2015-12-26T23:03:38.947" Score="0" Body="&lt;p&gt;If by &quot;Is the following equation established?&quot; you mean, is the equation valid, the answer is &lt;strong&gt;Yes, it has been proved.&lt;/strong&gt;  If you want to know a proof of it, here is one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\int_{-\infty}^\infty s(t)r^*(t)\,\mathrm dt&#xA;&amp;amp;= \int_{-\infty}^\infty &#xA;\left[ \int_{-\infty}^\infty S(f)e^{j2\pi ft}\,\mathrm df&#xA;\right] r^*(t)\,\mathrm dt &amp;amp;\scriptstyle{\text{replace}~s(t)~&#xA;\text{with its Fourier integral representation}}\\&#xA;&amp;amp;= \int_{-\infty}^\infty S(f)\left[ \int_{-\infty}^\infty &#xA;r^*(t)e^{j2\pi ft}\,\mathrm dt&#xA;\right] \,\mathrm df &amp;amp;\scriptstyle{\text{check that interchange of &#xA;order of integration is valid}}\\&#xA;&amp;amp;= \int_{-\infty}^\infty S(f)\left[ \int_{-\infty}^\infty &#xA;r(t)e^{-j2\pi ft}\,\mathrm dt\right]^* \,\mathrm df&#xA;&amp;amp;\scriptstyle{\text{integral of conjugate is conjugate of integral}}\\&#xA;&amp;amp;= \int_{-\infty}^\infty S(f)[R(f)]^* \,\mathrm df&#xA;&amp;amp;\scriptstyle{\text{identify integral in square brackets as Fourier&#xA;transform}}&#xA;\end{align}&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2015-12-26T23:03:38.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27938" PostTypeId="2" ParentId="27918" CreationDate="2015-12-26T23:34:10.240" Score="0" Body="&lt;p&gt;Aukxn: Whole book chapters have been written to answer your questions. Briefly, in the &lt;em&gt;window design method&lt;/em&gt; of designing FIR filters we define our desired freq response using $N+1$ freq-domain samples. Next, we inverse DFT those freq-domain samples to obtain the time-domain impulse samples. But dead DSP pioneers plowed through the algebra to develop equations (for simple filters like lowpass, highpass, bandpass, etc.) that define our impulse response samples &lt;em&gt;without&lt;/em&gt; needing to perform inverse DFTs. Those equations are the $h_d[n]$ expressions in mikroe's Table 2-2-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using mikroe's definition that a FIR filter has $N+1$ taps, &lt;em&gt;you&lt;/em&gt; decide the value of $N+1$ and then use his appropriate equation to compute a finite-length $h_d[n]$ imp response sequence. Now, performing the DFT on the finite-length $h_d[n]$ sequence will show that its freq response now has potentially undesirable ripples in its passband and the stopband attenuation may not be as high as you'd like. If you cannot tolerate the passband ripples and possibly poor stopband attenuation what can you do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you do is &lt;em&gt;window&lt;/em&gt; the $h_d[n]$ samples, by multiplying them by some window sequence. The freq response of the windowed $h_d[n]$ imp response samples, $h[n]$, will have drastically reduced passband ripples. But the problem now is, the new filter's freq-domain transition region's sharpness will be degraded by the windowing operation. You can solve that problem by increasing the value of $N+1$. That is, use more taps. So &lt;em&gt;YOU&lt;/em&gt; have to decide which is more important to you, reduced passband ripple and improved stopband attenuation or reduced number of taps. That's your decision. And filter designers experiment with various window sequences to help themselves make that decision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, using a &lt;em&gt;rectangular&lt;/em&gt; window means &lt;em&gt;not&lt;/em&gt; modifying the $h_d[n]$ samples, produced by mikroe's equations, in any way. Rectangular windows have the worst passband ripple and poorest stopband attenuation but have the sharpest freq-domain transition region. mikroe used a rectangular window in his '2.4.1.4 Example 4' because that's what the voices in his head told him to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the $M$ in mikroe's equations: the dead DSP pioneers developed two forms for their $h_d[n]$ equations depending on whether they; (1) wanted their $n$ time index to go from a negative integer value to a positive integer value, or (2) wanted their $n$ time index to go from zero to a positive integer value.  In the first case there is no $M$ variable in the $h_d[n]$ equations. In the second case there is an $M$ variable in the $h_d[n]$ equations. It's a matter of preference and mikroe, as well as I, preferred the second case. All that I've written here is in the standard DSP textbooks.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-26T23:34:10.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27939" PostTypeId="1" CreationDate="2015-12-27T00:14:28.040" Score="4" ViewCount="2182" Body="&lt;p&gt;I am following the &lt;a href=&quot;https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_colorspaces/py_colorspaces.html#object-tracking&quot; rel=&quot;nofollow&quot;&gt;open-cv tutorial&lt;/a&gt; and they claim that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In HSV, it is more easier to represent a color than RGB color-space.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;after which they convert the image from BGR color model to HSV, claim some color region as blue and bitmask based on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: why is it easier to represent color in HSV model?&lt;/p&gt;&#xA;" OwnerUserId="17299" LastActivityDate="2015-12-29T10:46:07.347" Title="Why is it easier to extract color in HSV model than in RGB?" Tags="|image-processing|color|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27941" PostTypeId="1" AcceptedAnswerId="27944" CreationDate="2015-12-27T08:37:22.387" Score="2" ViewCount="144" Body="&lt;p&gt;There is variety of loudspeakers on the market that have built-in microphone so that they can produce sound and perceive it at the same time (and do it surprisingly well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How they managed to overcome audio feedback problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DY9sr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DY9sr.png&quot; alt=&quot;example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18873" LastActivityDate="2016-01-14T23:23:29.113" Title="How does mic combined with loudspeaker work?" Tags="|audio|acoustics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27942" PostTypeId="1" CreationDate="2015-12-27T12:16:06.853" Score="1" ViewCount="66" Body="&lt;p&gt;This posting describes two methods of edge detection for wave analysis in a water pipe. I am not sure about advantaged and disadvantages. Therefore I want to evaluate the best method for this application. So please suggest new ones or judge the suggested.&lt;p&gt;&#xA;&lt;strong&gt;Situation:&lt;/strong&gt; There is a constant water flow through a pipe (horizontal - with constant diameter). Suddenly the pump stops and the resulting pressure drop travels along the pipe. There are several measurement points, which take a sample triggered by the sufficient value-change. Therefore the datapoints are not equally distributed in time.&lt;p&gt;&#xA;&lt;strong&gt;Aim:&lt;/strong&gt; I want to calculate the sound speed in the fluid from the velocity of this pressure wave. For this I need a method to detect the edges.&lt;p&gt;&#xA;&lt;strong&gt;Approach 1:&lt;/strong&gt; My first approach was to take the middle of this step which has a differential quotient above a certain treshold:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;      if ( sign(treshold)*(y(count+1) - y(count))/(t(count+1) - t(count))   &amp;gt; sign(treshold)*treshold) then&#xA;&#xA;            tCutOff(j) =  0.5*(tCut1(count+1) + tCut1(count));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/84oAX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/84oAX.png&quot; alt=&quot;Edge Detection 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Approach 2:&lt;/strong&gt; During some experiments, an advanced method came to my mind. It was motivated by the variation of the steepness in the first step of the edge. I alternatively tool the last few points before the detected step and some followers.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; precursor = [ t(count-5: count-1) ; y(count-5: count-1)]&#xA; follower  = [ t(count+1 : count+2); y(count+1: count+2)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I build the regression with the line parameters a and b each. The cutoff point is defined as the crossing of both regression lines:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    tCutOff(j)  = -(follow_b - pre_b)/(follow_a - pre_a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the second approach I got the following results.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BB1XX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BB1XX.png&quot; alt=&quot;Edge Detection 3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18874" LastEditorUserId="18874" LastEditDate="2015-12-30T23:38:53.927" LastActivityDate="2015-12-30T23:38:53.927" Title="Methods for edge detection with non-equidistant samples" Tags="|discrete-signals|edge-detection|time-series|nonuniform|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27943" PostTypeId="1" CreationDate="2015-12-27T12:43:51.000" Score="1" ViewCount="55" Body="&lt;p&gt;How are redundant training data handled during the training stage?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, assume we have one observation for phone $\theta$ in the training set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the training (for a monophone) is done with: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lambda_{max}^\theta = \text{arg} \max_\lambda p(\bf{O}|\lambda) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\bf{O}$ is the observation sequence and $\lambda$ is the HMM model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is straightforward when only a single observation is available from the training set. But what happens when there are multiple observations for phone $\theta$ in the training set? How is $\bf{O}$ adjusted?&lt;/p&gt;&#xA;" OwnerUserId="18522" LastEditorUserId="80" LastEditDate="2016-04-26T19:06:03.020" LastActivityDate="2016-12-22T23:30:23.163" Title="Effect of redundant training data in HMM-based speech recognizer/synthesizer?" Tags="|speech-recognition|hmm|speech-synthesis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27944" PostTypeId="2" ParentId="27941" CreationDate="2015-12-27T14:02:22.180" Score="2" Body="&lt;p&gt;By using Acoustic Echo Cancellation. Since the signal that goes to the speaker is known you can subtract it out at the microphone, provided you know the exact transfer function from speaker to microphone. The determination of the transfer function is typically done through an adaptive filter. Similar techniques can be used to reduce reflections, reverberation and echoes from the room.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, there are often multiple microphones using beam forming. The beams can be steered so that the pickup from the speaker is minimized (basically steering a null in the polar pattern to the speaker) and it can also be used to maximize pickup of the desired sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these things are really difficult, complicated and hard to get right. Cancellation and adaption often create artifacts that significantly reduce speech intelligibility. The quality of commercial implementation varies all over the place. In my name brand laptop, it's so bad that it's worse than useless and I simply turned it off. I have tried multiple USB speakerphones and also found a huge variability in quality. Finally I found one that actually works :-) but product recommendation are out of scope of this site. Let's just say that the one pictured is fairly decent.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-12-27T14:02:22.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27945" PostTypeId="2" ParentId="27941" CreationDate="2015-12-27T16:00:43.757" Score="1" Body="&lt;p&gt;I agree with Hilmar's answer as far as signal processing is concerned. The problem is that bad acoustic design can hardly be compensated for by signal processing. My point is that it is very important to have a very good acoustic design that makes sure that the speaker and the microphone are vibrationally insulated as far as possible. Mechanical vibrations caused by the speaker and fed into the microphone are often non-linearly related to the source signal, and consequently, their cancellation by signal processing methods is very difficult. This is one important reason why they must be avoided as far as possible by a good design. Any residual echoes must be suppressed by signal processing methods as described in Hilmar's answer.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-14T23:23:29.113" LastActivityDate="2016-01-14T23:23:29.113" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27946" PostTypeId="1" AcceptedAnswerId="27950" CreationDate="2015-12-27T16:39:59.127" Score="0" ViewCount="1406" Body="&lt;p&gt;The transfer function of a system is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\large H(s) = \huge \frac{V_{out}(s)}{V_{in}(s)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In digital domain the principle is of course the same, just replace laplace transform with z-transform and voltages with amplitudes. The transfer function, when converted to time domain, solves the impulse response of the system when conditions are met.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is about the prerequisites for finding the real impulse response using this method (other than LTI properties). Obviously, if a signal with a shorter length than the impulse response is used for the analysis, the real impulse response can't be solved for. However, is it enough to have a signal the length of the impulse response, regardless of what the input is? (Using dirac delta as input will of course solve the impulse, but what about other cases such as $sin(t)$?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can at least answer the question when it comes to fourier transform and related frequency response $H(w)$. In that scenario the signal indeed needs to be zero padded properly or we will have circular convolution. I am assuming the case is then the same for laplace transform. Thus, is it correct to say that for the $H(s)$ to yield the correct transfer function, the time signal representing the input needs to be zero padded by the length of the impulse (-1)?&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="16605" LastEditDate="2015-12-28T10:59:23.667" LastActivityDate="2015-12-28T10:59:23.667" Title="Question regarding transfer functions and prerequsities for finding the real impulse response" Tags="|fourier-transform|impulse-response|transfer-function|laplace-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27947" PostTypeId="1" AcceptedAnswerId="27948" CreationDate="2015-12-27T16:51:33.100" Score="0" ViewCount="2766" Body="&lt;p&gt;I have been working on Active Noise Cancellation in real time for Air vent in kitchen.&lt;br&gt;&#xA;Initially for the demonstration purpose, I am using sinusoidal sound ( 40k Hz Fs,1000 samples, 2 kHz frequency, 1 Amplitude). I am using simple LMS Algorithm initially to test this, I could produce the anti noise with the same frequency and amplitude but because it is a real time application, I could be able to produce the sine wave with 30-31 samples per each cycle of sine wave.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is the sound coming through the noise cancelling speakers is not good compared to the source noise, there is some buzz noise coming in addition (kind of background noise). This could mainly be because of distortions in speaker, I don't have any idea how to control this !!&lt;br&gt;&#xA;But I am thinking this may be could be because of very less number of samples that I am using for Cancelling speaker.May be the reproduction of the noise is not so good because of less number of samples.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is how many samples per cycle are ideally required for good reproduction of sine wave sound??&lt;/p&gt;&#xA;" OwnerUserId="17708" LastActivityDate="2015-12-27T17:15:01.253" Title="How many samples per cycle(time period) is actually enough to reproduce the sine wave sound properly?" Tags="|audio|adaptive-filters|acoustics|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27948" PostTypeId="2" ParentId="27947" CreationDate="2015-12-27T17:07:39.690" Score="3" Body="&lt;p&gt;It depends on how good your interpolation between samples is.  If you have really good interpolation, anything more than 2 samples per cycle will suffice.  This is not just a theoretical fact, it is my experience in practice using polyphase interpolation that combines 64 adjacent table-lookup samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using linear interpolation (which combines 2 adjacent table-lookup samples in the interpolation), I would use no less than 1024 samples per cycle for a high-quality sine wave (about 120 dB S/N).&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-12-27T17:07:39.690" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="27949" PostTypeId="2" ParentId="27947" CreationDate="2015-12-27T17:15:01.253" Score="1" Body="&lt;p&gt;You could analyse if the disturbing frequencies are higher than your main signal. That occours, if your signal is not smooth enough. If so, you can use a simple lowpass filter - analog or digital.&#xA;Regarding the threory about reconstruction of sine waves (as elements of signals in frquency domain) check &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow&quot;&gt;Nyquist Frequency&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18874" LastActivityDate="2015-12-27T17:15:01.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27950" PostTypeId="2" ParentId="27946" CreationDate="2015-12-28T07:01:34.913" Score="1" Body="&lt;p&gt;If I understand your question correctly, it is about &lt;em&gt;measuring&lt;/em&gt; the impulse response or frequency response of an actual system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of your questions appears to be &quot;can I use any input signal to measure the system's frequency response (or impulse response)?&quot; The answer is clearly no. As an extreme example, take a sinusoidal input signal $x(t)=\sin(\omega_0t)$. An LTI system with frequency response $H(\omega)=|H(\omega)|e^{j\phi(\omega)}$ will have a response $y(t)=|H(\omega_0)|\sin(\omega_0t+\phi(\omega_0))$, where $\phi(\omega)$ is the system's phase response. Consequently, with a sinusoidal input signal you can just measure $H(\omega)$ at a &lt;em&gt;single frequency&lt;/em&gt; (namely the frequency of the input signal). That's why an impulse is a good input signal for measuring the properties of a system: it contains all frequencies, not just a few.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One common practical method to measure a system's impulse response (or frequency response) is the sine sweep method, where the frequency of the input signal is swept over the whole frequency range of interest. This method and a few others are compared in &lt;a href=&quot;http://www.montefiore.ulg.ac.be/~stan/ArticleJAES.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-28T07:07:25.053" LastActivityDate="2015-12-28T07:07:25.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27951" PostTypeId="2" ParentId="9337" CreationDate="2015-12-28T07:31:17.287" Score="1" Body="&lt;p&gt;The example sounds like pitch tracking combined with comb filtering. Using method like this could be implemented by &quot;drawing&quot; as well, as in SPEAR analysis and re-synthesis program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the vocal is in the middle and other instruments are not, then you can also try center channel isolation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.virtualdub.org/blog/pivot/entry.php?id=102&quot; rel=&quot;nofollow&quot;&gt;http://www.virtualdub.org/blog/pivot/entry.php?id=102&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The methods however, sound horrible in addition to being inaccurate and full of artifacts. Better solution to the problem would be a program that could effectively guess which part of the signal belongs to the voice and which doesn't. Much more difficult for sure though.&lt;/p&gt;&#xA;" OwnerUserId="16605" LastActivityDate="2015-12-28T07:31:17.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27952" PostTypeId="2" ParentId="27902" CreationDate="2015-12-28T08:08:04.047" Score="0" Body="&lt;p&gt;rpatel: That's an interesting Tex. Instruments Application Note. On pages 8 &amp;amp; 9 they mention the sliding-mode DFT (known as the &quot;sliding DFT&quot;) and the Goertzel algorithm. They wrote:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The disadvantages of these techniques are that the computational overhead is slightly higher and the data memory requirements increase, because a sample-block-length number of samples (N) must be retained for the calculations.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't believe that statement is true. The sliding DFT computes updated spectral results upon the arrival of each new input sample, and past input samples need NOT be saved (retained). The Goertzel algorithm computes updated temporary results upon the arrival of each new input sample, and past input samples need NOT be saved (retained). Upon the arrival of the Nth input sample the Goertzel algorithm computes its final spectral result. (I'm merely telling you this for your information.) Maybe the sliding DFT or the Goertzel algorithm would be useful to you. But if the Tex. Instr. Application Note's method does what you want then stick with its method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start, try the following code to generate an increasing-freq chirp signal plus its first harmonic, followed by a decreasing-freq chirp signal plus its first harmonic:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1000;  % Sample rate in Hz&#xA;&#xA;Dur = 1;    % One second time duration&#xA;&#xA;Time = 0:1/Fs:Dur;  &#xA;&#xA;% Generate the fundamental increasing-freq chirp&#xA;&#xA;Fstart = 100;   % Start at 100 Hz&#xA;&#xA;Fstop = 150;    % Final freq of chirp&#xA;&#xA;Sig_1 = chirp(Time,Fstart,Dur,Fstop); % Sweep from 100 –to- 150 Hz &#xA;&#xA;% Generate 1st harmonic of the increasing-freq fundamental chirp&#xA;&#xA;Fstart = 200;    % Start at 200 Hz&#xA;&#xA;Fstop = 300;     % Final freq of chirp&#xA;&#xA;Sig_2 = chirp(Time,Fstart,Dur,Fstop); % Sweep from 200 –to- 300 Hz&#xA;&#xA;Sig = Sig_1 + Sig_2;     % Increasing-freq chirp plus 1st harmonic&#xA;&#xA;Sig = [Sig, fliplr(Sig)]; % Increasing-freq chirp followed by decreasing-freq chirp&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Change the above variables to suit your needs, add your noise and ping signal, and start experimenting with your 'ping detection' method. (Add higher-freq harmonics if necessary.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you need a fundamental sine wave signal that randomly changes in frequency (plus its harmonics) then that's a whole different ballgame. To satisfy that need I'd have to think about ways of using 'continuous multitone FSK (freq shift keying) signal generation' techniques. Let's keep in touch on this.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="23529" LastEditDate="2016-08-31T16:20:32.973" LastActivityDate="2016-08-31T16:20:32.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27953" PostTypeId="1" AcceptedAnswerId="27959" CreationDate="2015-12-28T08:49:37.567" Score="0" ViewCount="76" Body="&lt;p&gt;A sinusoidal signal of 600hz is sampled with 1khz, If the sampled signal is applied to an ideal low pass filter of 500 hz, what is the output?&lt;/p&gt;&#xA;" OwnerUserId="18884" LastActivityDate="2015-12-28T15:33:24.240" Title="signal sampling for 2nd time of sampled signal" Tags="|filters|sampling|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27954" PostTypeId="1" CreationDate="2015-12-28T08:56:34.153" Score="1" ViewCount="74" Body="&lt;p&gt;I measured a signal coming from a LED using a sensor. The signal is Amplitude Modulated, so I expect its spectrum to be moved by the carrier frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to explain the symmetric harmonics that appear in both sides of the peaks. I believe they might originate from the Fluorescent lights of the lab. I made a model where I added a square wave to the envelope and that seems to reproduce the effect in Matlab, but I am having a hard time finding the frequency of the noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could people let me know if I am on the right track? If so, how can I go about finding the frequency of the interference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I real online that Fluorescent lights produce electromagnetic radiation that can interfere with measurements. Could that, rather than the actually light be the culprit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal is given by:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;S(t)=cos(f*2*pi*t)*cos(fc*2*pi*t) &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When fc = 1000Hz and f=30Hz.&#xA;Here is the signal's spectrum. Note the added Harmonics:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hmny1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hmny1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Bigger picture:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LKjlX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LKjlX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; I came back and measured again after covering the system to hide it from the light. The noise is still there, so it is probably not due Flurescent. My latest theory is that the noise is due to AC currents inside the system, maybe due to over sampling. I will open a new question for descussing this as it is not related to this question.&lt;/p&gt;&#xA;" OwnerUserId="18549" LastEditorUserId="18549" LastEditDate="2015-12-30T17:44:20.453" LastActivityDate="2015-12-30T17:44:20.453" Title="Noise due to Fluorescent light in a signal from a LED" Tags="|noise|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27955" PostTypeId="1" CreationDate="2015-12-28T09:00:35.577" Score="0" ViewCount="84" Body="&lt;p&gt;i try to calculate the $\mathcal z$-transform of $x[a-n]$ (where $n$ is my variable)&#xA;i can't find any transform. the best suited transform is $x[-n] \longleftrightarrow X(z^{-1})$&#xA;i took the sum definition of the $\mathcal z$-transform but i couldnt find.&lt;/p&gt;&#xA;" OwnerUserId="18692" LastEditorUserId="1629" LastEditDate="2015-12-28T18:11:21.437" LastActivityDate="2015-12-29T13:08:34.757" Title="Z-transform of x[a -n]...where a is int" Tags="|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27957" PostTypeId="2" ParentId="27946" CreationDate="2015-12-28T09:43:46.673" Score="0" Body="&lt;p&gt;You seem to be bound and determined to compute your desired impulse response by multiplication in the freq domain followed by an inverse DFT, rather than use simpler time-domain convolution. Matt L. answered your first question and described a tried-n-true &lt;em&gt;sine sweep&lt;/em&gt; scheme that uses a Fourier transform for measuring a system's frequency response. Your last question, in your last paragraph, is a bit strange. Dole, you don't use $H(s)$ to &quot;yield&quot; a transfer function. $H(s)$ &lt;em&gt;is&lt;/em&gt; a transfer function (a Laplace transfer function). You seem to be incorrectly mixing continuous Laplace concepts with zero-padding which is a discrete-time notion. In most civilized countries, including Germany, Das ist verboten.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears you want multiply the DFT of an input sequence by some mysterious frequency-domain sequence. But if that frequency-domain sequence is the frequency response of a system, then no multiplication is necessary. Merely compute the inverse DFT of the frequency response sequence and take the real part of the result to obtain your time-domain impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assuming that all you have is an $H(s)$ equation, you can do the following: Convert a continuous $H(s)$ function to a discrete z-domain $H(z)$ equation, and then convert $H(z)$ to a discrete $H(\omega)$ frequency response equation. Evaluate the $H(\omega)$ equation as $\omega$ goes from $-\pi$ to $+\pi$ to produce an $N$-sample complex-valued $H[m]$ frequency response sequence. Then compute the inverse DFT of $H[m]$ and take the real part of the result. That's your discrete-time impulse response.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-28T09:43:46.673" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27959" PostTypeId="2" ParentId="27953" CreationDate="2015-12-28T11:24:40.493" Score="0" Body="&lt;p&gt;This is basic sample theory. when you want more of the background you can find this at &lt;a href=&quot;https://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow&quot;&gt;wikipedia&lt;/a&gt;. Check also there pages about sampling and Nyquist&#xA;The output frequency will be:&#xA;    $$&#xA;    F_{out} = \frac{Fs}{2} - f_0 \text{ so } 500-600 = -100&#xA;    $$&#xA;The result of this will me that you measure the signal at $400 Hz$&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2015-12-28T11:24:40.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27961" PostTypeId="2" ParentId="27953" CreationDate="2015-12-28T12:17:46.260" Score="1" Body="&lt;p&gt;thirI believe it is a nonsensical question, or at least a tricky, meant  to detect students who have  a shaky knowledge, and whose anwser deserves a lot of care.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First trick: if the $600$ Hz signal is sampled at  $1000$ Hz, it will endure aliasing (a proper sampling frequency would be above  $2 \times 600$ Hz). If the sampling process is perfect, it will appear as a sine at the mirror frequency $2*\frac{1000}{2}-600 = 400$ Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The  signal (that is assume real)) is now  in the $[0,500] $ Hz band. An ideal-low pass cutting at $500$ Hz would thus be an all-pass, second trick, and would be utterly  hard to design, numerically, in that case (third trick). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in theory, the  output signal would be the same (aliased) signal as the one from the first stage, fourth trick in a way. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2015-12-28T15:33:24.240" LastActivityDate="2015-12-28T15:33:24.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27962" PostTypeId="2" ParentId="7651" CreationDate="2015-12-28T13:58:54.553" Score="0" Body="&lt;p&gt;Here is a way to do this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First analyze the audio, hone in on the frequencies that are prelevant in one of the signals, but not the other. Use a steep FIR filter to isolate roughly those frequencies. Also, you might want to use some averaging (moving average) to even out the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, use a side chained gate triggered by the filtered audio. The gate should remove the silent parts. If it turns out that the silent parts are what you want, simply combine the audio stream with polarity inverted original.&lt;/p&gt;&#xA;" OwnerUserId="16605" LastActivityDate="2015-12-28T13:58:54.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27963" PostTypeId="1" AcceptedAnswerId="27969" CreationDate="2015-12-28T14:06:01.460" Score="1" ViewCount="4968" Body="&lt;p&gt;I want play and record a sine sweep. &#xA;When i have both signals the recorded one and the send one i can create a Transferfunction.&#xA;That is what i know so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H_0 = \frac{OUT}{IN} = \frac{Y}{X}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where i'm stuck is that when i read about the Transfer function it is all about the $Laplace \, transform$ (and sometimes the $Z-Transform$)&#xA;While i use the $FFT/DFT$. I tried some GNU Octave code to tried an Transfer function and i think that looks what i suspected.&lt;br&gt;&#xA;But now i curious  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;if the $FFT/DFT$ can be used for/ as a transferfunction and &lt;/li&gt;&#xA;&lt;li&gt;what is the relation between an $FFT/DFT$, $Laplace \, Transform$ and the $Z-Transform$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2015-12-28T17:28:22.030" Title="DFT/FFT Transfer function" Tags="|fft|z-transform|transfer-function|laplace-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27964" PostTypeId="2" ParentId="6000" CreationDate="2015-12-28T14:55:28.603" Score="0" Body="&lt;p&gt;The paper from the broken link provided by isrish might be found &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.301.7242&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;Combining image and text features: a hybrid approach to mobile book spine recognition&#xA;&lt;/a&gt;, Proc. 19th ACM international conference on Multimedia, 2011. One can also check out other papers from David Chen &lt;em&gt;et al.&lt;/em&gt;, for example &lt;a href=&quot;http://web.stanford.edu/~bgirod/pdfs/ChenSPIESanDiego2010.pdf&quot; rel=&quot;nofollow&quot;&gt;Low-Cost Asset Tracking using Location-Aware Camera Phones&#xA;&lt;/a&gt;, Proc. SPIE 2010.&lt;/p&gt;&#xA;" OwnerUserId="10194" LastEditorUserId="15892" LastEditDate="2015-12-28T18:25:56.860" LastActivityDate="2015-12-28T18:25:56.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27965" PostTypeId="2" ParentId="27963" CreationDate="2015-12-28T15:07:03.827" Score="0" Body="&lt;p&gt;The &lt;strong&gt;Fourier&lt;/strong&gt; transformation and the &lt;strong&gt;Laplace&lt;/strong&gt; transformation defined for continous signals. Fourier is a special case of Laplace for &lt;strong&gt;non-negative frequencies&lt;/strong&gt;. Both are not applicable for dicrete signals directly. &lt;a href=&quot;https://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;FFT&lt;/strong&gt;&lt;/a&gt; name an algorithm which approximates the Fourier transformation in it's discrete form, called &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;DFT&lt;/strong&gt;&lt;/a&gt;.&#xA;The question about the relation between Fourier and Laplace is further answered &lt;a href=&quot;https://math.stackexchange.com/questions/361229/compare-fourier-and-laplace-transform&quot;&gt;&lt;strong&gt;in this math-stackexchange topic&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Z transform is essentially a discrete version of the Laplace transform and, thus, can be useful in solving difference equations, the discrete version of differential equations. The Z transform maps a sequence $f[n]$ to a continuous function $F(z)$ of the complex variable $z=r\cdot e^{jΩ}$ &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This quote is from &lt;a href=&quot;https://electronics.stackexchange.com/questions/86489/relation-and-difference-between-fourier-laplace-and-z-transforms&quot;&gt;this posting&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18874" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2015-12-28T16:40:01.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27966" PostTypeId="1" AcceptedAnswerId="27973" CreationDate="2015-12-28T15:14:14.957" Score="1" ViewCount="290" Body="&lt;p&gt;I want to estimate the SNR of a bipolar signal. I know that each bit increases the SNR at 6 dB. Do i have to subtract one bit for sign, so that for bipolar signals the SNR is (n-1) x 6 dB ?&lt;/p&gt;&#xA;" OwnerUserId="15774" LastEditorUserId="4298" LastEditDate="2015-12-28T22:55:27.517" LastActivityDate="2015-12-29T10:17:44.237" Title="Quantization SNR of bipolar signal" Tags="|signal-analysis|noise|snr|quantization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27967" PostTypeId="1" AcceptedAnswerId="27972" CreationDate="2015-12-28T15:26:17.293" Score="0" ViewCount="9351" Body="&lt;p&gt;I have many audio files @ 22kHz. I want to convert it to 44.1kHz. Since I have many files to convert, I am looking for an easy solution. I came across ffmpegwrapper for python. I installed the package for python. But I couldnt find out the command to resample. Can anyone please help me ? This is the link for the wrapper. &lt;a href=&quot;https://pypi.python.org/pypi/ffmpegwrapper&quot; rel=&quot;nofollow&quot;&gt;https://pypi.python.org/pypi/ffmpegwrapper&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="17284" LastActivityDate="2022-09-29T07:16:29.433" Title="Sampling rate conversion for audio using ffmpegwrapper in python" Tags="|audio|python|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27969" PostTypeId="2" ParentId="27963" CreationDate="2015-12-28T17:12:18.723" Score="1" Body="&lt;p&gt;Your question is fairly broad, let me answer it step by step. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all $H(s)$ is indeed called the transfer function, and is the laplace transform of the impulse response. It's useful for finding the poles and zeroes, which is what the fourier transform can't do alone. $H(\omega)$ is the frequency response of the impulse response, not really the &quot;transfer function&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the frequency response is what you want to attain, then you can use the frequency response (fourier transform). It does not exist for unstable signals though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relation between Fourier Transform, discrete Fourier transform and Laplace transform/z-transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier transform and DFT are in principle the same. One is for discrete signals, and the other for continuous signals. Because of that there are some different properties like frequency domain aliasing. What both of these transforms do is decompose the signal into complex exponentials (easily converted into sines and cosines (or sinusoids with magnitude and phase), which is the original idea).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Laplace and z-transform are again in principle the same, z-transform is the discrete equivalent to Laplace. It's simply the Fourier transform/DFT with the signal multiplied by a varying exponential $e^{\sigma t}$, or in discrete case just $r^t$. Then you have multiple fourier transforms/DFTs relating to each different value of the exponential ($r$ or $\sigma$). Point of interests are the poles and zeroes, IE. the points where the impulse response in question  multiplied by an exponential has integral that is exactly infinite or exactly zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that when $r=1$, or $\sigma = 0$, the Laplace/Z-transform is equal to the Fourier transform. In other words, the Laplace/Z-transform contains the Fourier transform in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I wrote this fairly quickly so please point out any errors.&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="16605" LastEditDate="2015-12-28T17:28:22.030" LastActivityDate="2015-12-28T17:28:22.030" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="27970" PostTypeId="2" ParentId="27943" CreationDate="2015-12-28T17:18:21.570" Score="1" Body="&lt;p&gt;I guess you confuse GMM and HMM trainings. Although in both cases &lt;a href=&quot;https://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;EM algorithm&lt;/a&gt; is employed, &lt;a href=&quot;https://dsp.stackexchange.com/a/22280/18297&quot;&gt;Baum-Welch&lt;/a&gt; is used for HMM training.&lt;/p&gt;&#xA;" OwnerUserId="18297" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2015-12-28T17:18:21.570" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="27971" PostTypeId="2" ParentId="27955" CreationDate="2015-12-28T18:30:08.753" Score="2" Body="&lt;p&gt;There are several ways to derive the result:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Just use the definition of the $\mathcal{Z}$-transform:&#xA;$$\begin{align}\mathcal{x[a-n]}&amp;amp;=\sum_{n=-\infty}^{\infty}x[a-n]z^{-n}{\Big|}_{k=a-n}\\&#xA;&amp;amp;=\sum_{k=-\infty}^{\infty}x[k]z^{k-a}\\&#xA;&amp;amp;=z^{-a}\sum_{k=-\infty}^{\infty}x[k]z^{k}=z^{-a}X\left(\frac{1}{z}\right)\end{align}$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the well-known properties of the $\mathcal{Z}$-transform (version 1):&#xA;$$x[n+a]\longleftrightarrow z^aX(z)\\ [n\rightarrow -n\Rightarrow z\rightarrow 1/z]\\&#xA;x[-n+a]\longleftrightarrow z^{-a}X\left(\frac{1}{z}\right)$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the well-known properties of the $\mathcal{Z}$-transform (version 2):&#xA;$$x[-n]\longleftrightarrow X\left(\frac{1}{z}\right)\\ [n\rightarrow n-a \Rightarrow \times\; z^{-a}] \\&#xA;x[-(n-a)]\longleftrightarrow z^{-a}X\left(\frac{1}{z}\right)$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-28T18:30:08.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27972" PostTypeId="2" ParentId="27967" CreationDate="2015-12-28T19:15:26.393" Score="1" Body="&lt;p&gt;Use &lt;a href=&quot;http://sox.sourceforge.net/sox.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;SoX&lt;/a&gt; to easily convert your files in one go. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some examples: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/27264156/sox-batch-process-under-debian&quot;&gt;https://stackoverflow.com/questions/27264156/sox-batch-process-under-debian&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://pwnetics.wordpress.com/2011/07/12/bash-one-liner-using-sox-to-batch-convert-the-sampling-frequency-of-audio-files/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pwnetics.wordpress.com/2011/07/12/bash-one-liner-using-sox-to-batch-convert-the-sampling-frequency-of-audio-files/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you want to do this from Python, use &lt;a href=&quot;https://github.com/bmcfee/librosa&quot; rel=&quot;nofollow noreferrer&quot;&gt;librosa&lt;/a&gt;. An example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;By default, librosa will resample the signal to 22050Hz.&#xA;&#xA;You can change this behavior by saying:&#xA;&#xA;librosa.load(audio_path, sr=44100)&#xA;to resample at 44.1KHz, or&#xA;&#xA;librosa.load(audio_path, sr=None)&#xA;to disable resampling.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2015-12-28T19:30:19.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27973" PostTypeId="2" ParentId="27966" CreationDate="2015-12-28T23:08:04.513" Score="2" Body="&lt;p&gt;Your question appears to be about the signal to quantization noise ratio for uniform quantization. You have to count each bit, but that generally doesn't mean that the SNR is $6N$ dB, where $N$ is the number of bits. You normally have a constant offset:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{SNR}_{\text{dB}}\approx c+6N\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the constant $c$ depends on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Crest_factor&quot; rel=&quot;nofollow&quot;&gt;Crest factor&lt;/a&gt; of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give you an example, assume that the signal is in the range $[-x_p,x_p]$, and assume uniform quantization with $N$ bits. Then the quantization step size is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$q=\frac{2x_p}{2^N}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we further assume that the quantization error is uniformly distributed in the interval $[-q/2,q/2]$, the quantization noise power is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_n=\frac{1}{q}\int_{-q/2}^{q/2}\xi^2d\xi=\frac{q^2}{12}=\frac13\frac{x_p^2}{2^{2N}}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $x_{\text{RMS}}$ the RMS value of the signal, the signal to quantization noise ratio is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{SNR}=\frac{x^2_{\text{RMS}}}{P_n}=3\frac{x^2_{\text{RMS}}}{x^2_p}\cdot2^{2N}=\frac{3}{C^2_x}\cdot2^{2N}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $C_x$ is the signal's &lt;a href=&quot;https://en.wikipedia.org/wiki/Crest_factor&quot; rel=&quot;nofollow&quot;&gt;Crest factor&lt;/a&gt;. From $(4)$, the SNR in dB is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{SNR}_{\text{dB}}=10\log_{10}\left(\frac{3}{C^2_x}\right)+20N\log_{10}2=10\log_{10}\left(\frac{3}{C^2_x}\right)+6.02\cdot N\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has the form of Eq. $(1)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-29T10:17:44.237" LastActivityDate="2015-12-29T10:17:44.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27974" PostTypeId="2" ParentId="19412" CreationDate="2015-12-28T23:24:35.243" Score="1" Body="&lt;p&gt;Frequency response is the Fourier transform (or DFT in discrete case) of the impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you may be confusing frequency response with frequency domain representation of a signal. Frequency domain representation is simply any time domain signal converted into frequency domain. This representation will tell you the amplitudes of the complex exponentials (or perhaps more simply sinusoids with phase), which the signal consists of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the intuition of pairs... well in some cases there might be a lot of intuition to them, at least when considering all of the Fourier transform's properties. In others cases it may be more of a mathematical exercise. Just plug a function to the formulas and see if both the Fourier transform and it's inverse return similar functions (remember to convert the rectangular format to polar format in frequency domain, as you are primarily concerned with the magnitudes).&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="16605" LastEditDate="2015-12-28T23:34:31.577" LastActivityDate="2015-12-28T23:34:31.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27975" PostTypeId="1" AcceptedAnswerId="27996" CreationDate="2015-12-29T00:32:35.430" Score="0" ViewCount="249" Body="&lt;p&gt;In literature, a monophone is represented with 3 states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When doing context dependent clustering, 3 states are used to represent a triphone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the triphone represented with 3 states and not 5? Doesn't modeling with 3 states reduce the information?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current understanding is that each of the phones in a triphone corresponds to each of the states. For example, given a triphone 'k-a+b', then the first state corresponds to 'k', etc.&lt;/p&gt;&#xA;" OwnerUserId="18522" LastEditorUserId="18522" LastEditDate="2015-12-29T02:39:51.823" LastActivityDate="2015-12-30T02:46:07.873" Title="HMM-based speech recognition/synthesis: state representation of monophones and triphones" Tags="|speech-recognition|hmm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27977" PostTypeId="1" CreationDate="2015-12-29T07:43:49.537" Score="0" ViewCount="53" Body="&lt;p&gt;As i am using open Al library for generating a tune. I was able to generate a tone for single frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I was trying to generate tone for multiple frequncies, it suffered from the problem of clipping and noise. So please sugest me how to rectify the problem.&lt;/p&gt;&#xA;" OwnerUserId="18892" LastEditorUserId="8202" LastEditDate="2015-12-30T08:06:01.563" LastActivityDate="2016-04-28T09:42:59.187" Title="what should be the min number of samples and sampling frequency while playing sound" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27978" PostTypeId="2" ParentId="27977" CreationDate="2015-12-29T08:27:31.497" Score="1" Body="&lt;p&gt;Your sampling frequency should be at least two times higher than the highest frequency in your signal. (Read about &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow&quot;&gt;Nyquist frequency&lt;/a&gt;).&#xA;This has nothing to do with clipping.&#xA;I can imagine that your clipping occurs because you are adding multiple signals without scaling (normalizing) the amplitudes.&lt;/p&gt;&#xA;" OwnerUserId="10194" LastActivityDate="2015-12-29T08:27:31.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27980" PostTypeId="1" CreationDate="2015-12-29T09:40:23.773" Score="0" ViewCount="178" Body="&lt;p&gt;I have a single channel audio recording. I want to simulate the stereo recording when it is (hypothetically) played on a speaker in front of stereo mics (distance between them - say 10 cm). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any tools which can do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit- I am looking for something more precise - as in for specific distance between speaker and mics and also for given room dimensions. I tried Audacity 'Reverb tool' which sort of does stereofication but there is no way to specify certain distances (speaker-mic, mic-mic etc.)&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="4206" LastEditDate="2016-01-12T01:42:28.857" LastActivityDate="2016-01-12T01:42:28.857" Title="How to simulate a stereo recording?" Tags="|audio|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27981" PostTypeId="2" ParentId="27939" CreationDate="2015-12-29T09:45:05.650" Score="2" Body="&lt;p&gt;Say you have an object that is blue, and you adjust the brightness of a lamp in the room, or you move the object so that it does not get as much light. In RGB, all the three components (red, green, blue) will change but in HSV mostly the V (value) component changes. So to recognize pixels belonging to the object by its color, you only need the H (hue) and S(saturation) components of HSV, in contrast to needing all three components of RGB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well actually for almost black pixels the H and S components can be anything due to noise, so you will need to see that V is high enough. An equivalent check needs to be done with RGB too.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2015-12-29T09:45:05.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27982" PostTypeId="2" ParentId="27939" CreationDate="2015-12-29T10:46:07.347" Score="4" Body="&lt;p&gt;HSV decomposes colors into hue, saturation and value components. This representation allows us to select color ranges in more natural way. For example, you can select wider range for the value component, making your application less sensitive to the light conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the example from your link they define &lt;code&gt;lover_blue&lt;/code&gt; and &lt;code&gt;upper_blue&lt;/code&gt; as the bounds and use &lt;code&gt;inRange&lt;/code&gt; function to create the mask. To visualize it a little bit more take a look at this picure:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/UCjTo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UCjTo.png&quot; alt=&quot;hsv range&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the picture above the saturation is 255 for the lower and upper bounds. But I hope it makes it a little bit clearer.&lt;/p&gt;&#xA;" OwnerUserId="10194" LastActivityDate="2015-12-29T10:46:07.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27983" PostTypeId="1" CreationDate="2015-12-29T11:07:00.773" Score="1" ViewCount="1510" Body="&lt;p&gt;The question is, how to attain the frequency domain representation of any signal (which is finite, non-unit length) convolved with an IIR filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct answer in my opinion is that there is in fact no answer, which might seem very strange at first. But if we work through the math and use the property of circular convolution we of course will still get an answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say our signal is simple discrete step function of the length N-1, starting at t=0, the frequency domain representation is then: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=\large e^{j \omega\frac {N-1}{2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the point clearer let's say the IIR filter is of the form. $h(n) = \cos(\omega_0 n)$, which converter to frequency domain is equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(\omega)=&#xA;\begin{cases} &#xA;1, &amp;amp; \omega = \omega_0&#xA;\\ 0, &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculating the frequency representation of the convolution can be done using the formula $$Y(\omega)=F(\omega) H(\omega)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $Y(\omega)$ is the frequency domain representation of the convolution. However, there is a problem, convolving these functions necessarily results in time domain aliasing, as there is no possible way of having zeroes near the edges. And so, the aliasing occurs, thus the result is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F(\omega)  G(\omega)=&#xA;\begin{cases} &#xA;\large e^{j \omega\frac {N-1}{2}}, &amp;amp; \omega = \omega_0&#xA;\\ 0, &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In time domain the result is either sinusoidal wave or nothingness, depending on the frequency of the sine wave and width of the pulse we started with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So continuing this line of thought, sine waves in LTI systems have linear response because of circular convolution (as without the fold back the sine wave would distort). This means that LTI systems properties are a completely theoretical construct, which we of course already knew since infinite sine waves with no end or beginning don't exist in real world. Either way, my line of thought is that you can't convolve an infinite signal using the equation, as no amount of infinities makes a signal fold back onto itself, as using the math will do (admittedly, I may be completely wrong on this). I will be trying to solve the equation for a case where the sine wave is casual next...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A frequency representation of a particular interval can of course be attained (which conviniently cuts the impulse response to a FIR, removing the funny things caused by infinities). The problem also disappears if the filter settles to zero after infinite time, which probably satisfies the definition of IIR, but is of no interest for the purpose of the discussion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct on this or does letting the aliasing occur lead to the correct answer for the convolution functions in cases of infinite time functions? If that is the case, what is the rationale behind it? &lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="16605" LastEditDate="2015-12-30T08:24:48.247" LastActivityDate="2015-12-30T14:16:51.590" Title="Convolution by IIR filter, a case where circular convolution is allowed?" Tags="|convolution|infinite-impulse-response|frequency-response|math|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="27984" PostTypeId="2" ParentId="27980" CreationDate="2015-12-29T11:56:46.877" Score="1" Body="&lt;p&gt;Check a music production software (commercial: Logic/ Ableton/ Pro Tools. Open Source: Ardour, Mu Lab) or otherwise audacity. Add a stereo widening tool plugin.&#xA;For that check KVR Audio&lt;br&gt;&#xA;&lt;a href=&quot;http://www.kvraudio.com/q.php?search=1&amp;amp;q=&amp;amp;tg[]=64&amp;amp;pr[]=f&quot; rel=&quot;nofollow&quot;&gt;stereo/ imaging/ widening&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;http://www.kvraudio.com/q.php?search=1&amp;amp;q=&amp;amp;tg[]=2586&amp;amp;pr[]=f&quot; rel=&quot;nofollow&quot;&gt;stereo imaging&lt;/a&gt; more close search&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2015-12-29T11:56:46.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27985" PostTypeId="2" ParentId="27983" CreationDate="2015-12-29T12:08:31.420" Score="3" Body="&lt;p&gt;To answer your first question formulated in the first sentence: if $X(\omega)$ is the Fourier transform of the input signal, and $H(\omega)$ is the frequency response of the IIR filter, the Fourier transform (&quot;frequency domain representation&quot; as you call it) of the output signal is simply $Y(\omega)=X(\omega)H(\omega)$. This is valid in continuous time as well as in discrete time if you use the discrete-time Fourier transform (DTFT) (and not the DFT/FFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the (discrete) time domain, you generally have an infinite convolution sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=-\infty}^{\infty}x[k]h[n-k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[n]$ is the input sequence, and $h[n]$ is the impulse response of the filter. If either $x[n]$ or $h[n]$ (or both) are of finite length, the sum in $(1)$ becomes a finite sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you manage to clarify the rest of your question, I might be able to add more relevant information to this answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I may guess what confuses you, it may be that you think in terms of the DFT, which can only handle sequences of finite length (and may cause circular convolution artefacts). However, you can implement an IIR filter directly (and exactly, if we ignore quantization effects for the moment) in the time domain. In the general case, the DTFT of the output signal can only be computed approximately. However, for finite length input signals fed into an IIR filter, we can obtain an exact expression for the DTFT of the input signal as well as for the frequency response of the IIR filter. The Fourier transform of the output signal is then simply the multiplication of the two.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2015-12-29T12:22:07.187" LastActivityDate="2015-12-29T12:22:07.187" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27987" PostTypeId="1" CreationDate="2015-12-29T13:59:39.817" Score="2" ViewCount="192" Body="&lt;p&gt;Ladies, Gentlemen, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider following set of moving average filters:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) - 100 coefficients equal to 1/100&lt;br&gt;&#xA;(2) --- 95 coefficients equal to 1/95&lt;br&gt;&#xA;(3) --- 90 coefficients equal to 1/90&lt;br&gt;&#xA;(4) --- 85 coefficients equal to 1/85&lt;br&gt;&#xA;(5) --- 80 coefficients equal to 1/80&lt;br&gt;&#xA;(6) --- 75 coefficients equal to 1/75&lt;br&gt;&#xA;(7) --- 70 coefficients equal to 1/70&lt;br&gt;&#xA;(8) --- 65 coefficients equal to 1/65&lt;br&gt;&#xA;(9) --- 60 coefficients equal to 1/60&lt;br&gt;&#xA;(10) -  55 coefficients equal to 1/55 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose filters are implemented in sequence. What are ripple and attenuation of the whole set of filters? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Responding to Mr Commentator I define ripple 1 dB, cut off band 1 tone (1/6 of octave) and attenuation as little as possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regards &lt;/p&gt;&#xA;" OwnerUserId="17893" LastEditorUserId="17893" LastEditDate="2015-12-30T09:14:57.460" LastActivityDate="2015-12-30T13:23:41.487" Title="What are the ripple and attenuation in a set of moving average filters?" Tags="|moving-average|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="27989" PostTypeId="1" CreationDate="2015-12-30T00:22:40.103" Score="1" ViewCount="152" Body="&lt;p&gt;I listen to a podcast with interesting talk separated with horrible music.&#xA;I'd like to rewrite the podcast automatically to delete this &quot;noise&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: the talk and music is not simultaneously, it's talk for a couple of minutes, then a horrible song, then talk etc.&#xA;Erring on the side of caution is OK, some seconds of the beginning and end of music is OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideas?&lt;/p&gt;&#xA;" OwnerUserId="18901" LastEditorUserId="18901" LastEditDate="2015-12-30T00:29:42.113" LastActivityDate="2019-02-26T00:05:32.690" Title="Select talk not music from podcast" Tags="|audio|signal-analysis|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27990" PostTypeId="2" ParentId="27989" CreationDate="2015-12-30T00:26:08.793" Score="0" Body="&lt;p&gt;If you had a file of the music they are playing, you could use an adaptive filter to get rid of the the music. But as a fair warning, this will not be an easy venture. &lt;/p&gt;&#xA;" OwnerUserId="11102" LastActivityDate="2015-12-30T00:26:08.793" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="27991" PostTypeId="2" ParentId="19463" CreationDate="2015-12-30T01:01:54.277" Score="2" Body="&lt;p&gt;In order to understand this question better, please see the question &lt;a href=&quot;https://dsp.stackexchange.com/questions/27994/what-are-characteristics-of-different-mr-images&quot;&gt;What are characteristics of different MR images?&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h1&gt;&lt;strong&gt;Summary about MR images in medicine&lt;/strong&gt;&lt;/h1&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://graphics.stanford.edu/data/voldata/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Standford volume data archieve&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://physionet.org/physiobank/database/images/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Physionet&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.healthcare.siemens.com/magnetic-resonance-imaging/magnetom-world/clinical-corner/protocols/dicom-images&quot; rel=&quot;nofollow noreferrer&quot;&gt;DICOM&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;and &lt;a href=&quot;http://www.dataanalyticslifesciences.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Data analytics in life sciences&lt;/a&gt; discusses the usage of bigdata in medicine and profiting from it (restricted access).&lt;/p&gt;&#xA;&lt;h1&gt;&lt;strong&gt;More on Medical data: Bigdata, Personal data, ...&lt;/strong&gt;&lt;/h1&gt;&#xA;&lt;p&gt;Similar questions, perhaps similar goals&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.quora.com/Why-is-machine-learning-not-more-widely-used-for-medical-diagnosis?&quot; rel=&quot;nofollow noreferrer&quot;&gt;Why is machine learning not more widely used for medical diagnosis&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.quora.com/Where-do-medical-researchers-get-their-data-from&quot; rel=&quot;nofollow noreferrer&quot;&gt;Where do medical researchers get their data from?&lt;/a&gt; and &lt;a href=&quot;https://www.quora.com/Like-PhysioNet-is-there-any-other-website-which-provides-other-medical-data-like-CT-MRI-and-ultrasound&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.quora.com/Where-is-medical-voxel-data-available-for-research&quot; rel=&quot;nofollow noreferrer&quot;&gt;Medical voxel data?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://data.medicare.gov&quot; rel=&quot;nofollow noreferrer&quot;&gt;Data.Medicare.gov&lt;/a&gt; on nursing data, physician data, ...&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Other medical data, general, perhaps relevant&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://segem.brain.mpg.de/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image analysis on brain&lt;/a&gt; such as neuron detection&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.rcsb.org/pdb/home/home.do&quot; rel=&quot;nofollow noreferrer&quot;&gt;RCSB&lt;/a&gt; about structural view on proteins and &lt;a href=&quot;http://www.bioblender.eu/&quot; rel=&quot;nofollow noreferrer&quot;&gt;BioBlender&lt;/a&gt; on its visualisation&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://physionet.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Physiological signals&lt;/a&gt; and &lt;a href=&quot;http://physionet.org/physiobank/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h1&gt;More curiosity, data, future research&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;There may be some medical dataset used for salient object segmentation  &lt;a href=&quot;https://dsp.stackexchange.com/questions/27992/image-datasets-used-for-salient-objects&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Quora has a label on &lt;a href=&quot;https://www.quora.com/topic/Medical-Information-and-Data&quot; rel=&quot;nofollow noreferrer&quot;&gt;Medical Information and Data&lt;/a&gt; but it is relatively hard to find MR images by it.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.quora.com/Where-can-I-find-large-datasets-open-to-the-public&quot; rel=&quot;nofollow noreferrer&quot;&gt;Large datasets open to public?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1824" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-12-30T20:23:59.023" CommentCount="0" CommunityOwnedDate="2015-12-30T01:01:54.277" ContentLicense="CC BY-SA 3.0" />
  <row Id="27992" PostTypeId="1" CreationDate="2015-12-30T01:06:24.753" Score="1" ViewCount="73" Body="&lt;p&gt;I would like to understand reasons for different image datasets used for salient object detection: their difficulties, their origins and likely future datasets. Does there exist any work explaining them such their progression and characteristics over time?&lt;/p&gt;&#xA;" OwnerUserId="1824" LastActivityDate="2022-04-13T13:07:10.647" Title="Image datasets used for salient objects?" Tags="|data-request|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27993" PostTypeId="2" ParentId="27992" CreationDate="2015-12-30T01:06:24.753" Score="1" Body="&lt;p&gt;&lt;strong&gt;Datasets explicitly mentioning saliency&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://research.microsoft.com/en-us/um/people/jiansun/SalientObject/salient_object.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;MSRA&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://elderlab.yorku.ca/SOD/&quot; rel=&quot;nofollow noreferrer&quot;&gt;SOD&lt;/a&gt; based on &lt;a href=&quot;http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/resources.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;BSD Berkeley segmentation dataset&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Apparently more general datasets (not researched in detail)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://202.118.75.4/lu/DUT-OMRON/index.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;DUT-Omron Image dataset&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;THUS&lt;/li&gt;&#xA;&lt;li&gt;ECSD&lt;/li&gt;&#xA;&lt;li&gt;PASCAL&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More challenging situations with more noise&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Detection on magnetism such as MR: &lt;a href=&quot;https://dsp.stackexchange.com/questions/19463/medical-image-dataset&quot;&gt;Medical image dataset&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/questions/25125/extract-voice-from-magnetic-tape/25586#25586&quot;&gt;Extract voice from magnetic tape&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1824" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2015-12-30T01:06:24.753" CommentCount="0" CommunityOwnedDate="2015-12-30T01:06:24.753" ContentLicense="CC BY-SA 3.0" />
  <row Id="27994" PostTypeId="1" CreationDate="2015-12-30T01:22:55.663" Score="2" ViewCount="85" Body="&lt;p&gt;MR tools are used in many sectors such as medicine and mining. MR stands for magnetic resonance and MRI for magnetic resonance imaging. What are characteristics of different MR images? What are typical noise to signal ratios and other important decision factors?&lt;/p&gt;&#xA;" OwnerUserId="1824" LastActivityDate="2016-01-03T23:10:36.400" Title="What are characteristics of different MR images?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27995" PostTypeId="2" ParentId="27921" CreationDate="2015-12-30T01:44:29.480" Score="0" Body="&lt;p&gt;I'm not sure how much math or dsp you already know but I can give my 2 cents. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think there are many of us interested in signal processing but find the initial entry barrier quite difficult. Most books or information on the topic dive straight into complex mathematics and makes it difficult to focus on a starting point. I'm interested in audio dsp and am preparing for a Msc on the subject. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This book is the best I (and many others) have found who try to access dsp with a computer science or software engineering degree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.dspguide.com/&quot; rel=&quot;nofollow&quot;&gt;The Scientist and Engineer's Guide to&#xA;Digital Signal Processing&#xA;By Steven W. Smith, Ph.D.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get the print book on amazon, but the whole book is online as a PDF, with downloadable chapters. It explains things practically with an applied approach. The topic is still complex, but without the mysterious mathematics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Along with that you will need to learn Trignometry, Calculus and Complex Analysis. This is a great resource to get a quick overview of the math and core concepts of dsp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://store.elsevier.com/Digital-Signal-Processing-Instant-Access/James-D_-Broesch/isbn-9780750689762/&quot; rel=&quot;nofollow&quot;&gt;Digital Signal Processing: Instant Access&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I have experiened from audio coding and audio dsp, is that the dsp is tough, but it's also tricky to get the underlying system working. Deploying C code to custom hardware isn't that difficult, unless you want to add chip specific assembly code.&lt;/p&gt;&#xA;" OwnerUserId="4602" LastActivityDate="2015-12-30T01:44:29.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="27996" PostTypeId="2" ParentId="27975" CreationDate="2015-12-30T02:46:07.873" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;My current understanding is that each of the phones in a triphone corresponds to each of the states. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's not correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each phone, regardless of the context dependency, has three states: &quot;start&quot;, &quot;in-between&quot;, and &quot;end&quot;. There are always transitions from the previous state to the next one and to itself. This defines the structure of HMM. Now context-dependency means that for each triphone we know its left and right context (context-independent phone). Let's take a look at what phone &lt;em&gt;AX&lt;/em&gt; could look like in both CI and CD HMMs for the word &quot;one &lt;em&gt;[W AX N]&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When &lt;strong&gt;context-independent&lt;/strong&gt; phones are used &lt;em&gt;AX&lt;/em&gt; is begin split it into three states - _AX_B_, _AX_I, _AX_E - to construct the corresponding HMM:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/quysb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/quysb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of &lt;strong&gt;context-dependent&lt;/strong&gt; phones &lt;em&gt;AX&lt;/em&gt; actually doesn't exist any more. Instead we have many new phones that store information of phones to the left of it and to the right of it. Thus in the given word the neighbours of &lt;em&gt;AX&lt;/em&gt; are &lt;em&gt;W&lt;/em&gt;(left) and &lt;em&gt;N&lt;/em&gt;(right), so HMM for phone &lt;em&gt;W-AX-N&lt;/em&gt; is constructed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mzDk4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mzDk4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18297" LastActivityDate="2015-12-30T02:46:07.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28001" PostTypeId="1" AcceptedAnswerId="28008" CreationDate="2015-12-30T12:32:14.870" Score="0" ViewCount="3830" Body="&lt;p&gt;I'm trying to reconstruct an audio signal, and below is what i got after rescaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Nd6fN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nd6fN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can i obtain centered audio signal such as below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/x3mF3.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/x3mF3.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;SOLVED:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ruoho ruotsi's answer addresses my problem :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i found someone asked the similar question before &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/27468/how-to-remove-or-filter-the-drift-problem-in-measured-strain-signal&quot;&gt;How to remove or filter the drift problem in measured Strain signal?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18911" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2015-12-31T04:56:23.957" Title="how can i center an audio signal?" Tags="|audio|speech|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28002" PostTypeId="2" ParentId="28001" CreationDate="2015-12-30T12:47:45.687" Score="0" Body="&lt;p&gt;Remove DC offset. Either convert to frequency domain and remove bin 0 or just use a very low frequency high pass filter.&lt;/p&gt;&#xA;" OwnerUserId="16605" LastActivityDate="2015-12-30T12:47:45.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28003" PostTypeId="1" AcceptedAnswerId="28023" CreationDate="2015-12-30T13:23:17.863" Score="1" ViewCount="116" Body="&lt;p&gt;This morning i was experimenting with GNU Octave.&#xA;I created several signals(Sine, Saw tooth, square wave and noise). After this i used the periodogram. in the periodogram the square wave weren't showed.&lt;br&gt;&#xA;I tried a test file from where the square wave is broken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uG0VM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uG0VM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A = 1;&#xA;f = 2;&#xA;T = 2;&#xA;fs = 512;&#xA;&#xA;if isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0;&#xA;    pkg load signal&#xA;    clear isOctave;&#xA;end&#xA;&#xA;t = 0:1/fs:T-1/fs ;&#xA;sine = A * sin(2*pi*f*t);&#xA;sq =  A * square(2*pi*f*t);&#xA;F = 0:(fs/(T*fs)):fs/2;&#xA;SINE = fft(sine);SINE = abs(SINE(1,1:(T*fs)/2+1));&#xA;SQ = fft(sq); SQ = abs(SQ(1,1:(T*fs)/2+1));&#xA;&#xA;&#xA;figure;&#xA;subplot(2,1,1); plot(t,sine, t,sq); &#xA;legend('Sine', 'Square','Location','northoutside','Orientation','horizontal')&#xA;subplot(2,1,2); plot( F, 20*log10(1/(length(SINE))*SINE), F,20*log10(1/(length(SQ))* SQ));&#xA;&#xA;figure&#xA;periodogram(sine,[],length(sine),fs,'power'); hold all&#xA;periodogram(sq,[],length(sq),fs,'power')&#xA;legend('sine','square')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What i found out is that till the fft everything works as suspected.&lt;br&gt;&#xA;But when i take the log of the square wave. the result disappears.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why does this happening?    &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;what cause this problem. &lt;/li&gt;&#xA;&lt;li&gt;Happens this also in Matlab or python. &lt;/li&gt;&#xA;&lt;li&gt;What solution fix this problem?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13541" LastEditorUserId="13541" LastEditDate="2015-12-30T14:15:46.123" LastActivityDate="2016-02-29T10:29:25.777" Title="Logaritmic amplitude squarewave" Tags="|matlab|frequency-spectrum|power-spectral-density|amplitude|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28004" PostTypeId="2" ParentId="27987" CreationDate="2015-12-30T13:23:41.487" Score="1" Body="&lt;p&gt;George Theodosiou: As Matt L. said, your final filter is not a standard filter having, say, a visible passband with some measureable passband ripple. For example, the combined frequency magnitude response of just your first three moving average filters implemented one after the other (what we call &quot;cascaded filters&quot;) is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/g3iLu.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/g3iLu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of 0.1 on the horizontal axis is equivalent to 0.1 times the filter's input data sample rate measured in Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we can say is: The combined frequency response of multiple filters implemented one after the other is the product of all the filters' complex-valued frequency responses.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2015-12-30T13:23:41.487" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28005" PostTypeId="2" ParentId="28003" CreationDate="2015-12-30T14:04:40.550" Score="0" Body="&lt;p&gt;I don't know what you mean by &quot;disappears&quot;. Your only '&lt;code&gt;log&lt;/code&gt;' command has been commented out, so no 'log' operation is executed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to run your code in Matlab. Everything was fine until the '&lt;code&gt;periodogram()&lt;/code&gt;' commands. Matlab did not recognize those commands as you have typed them. Taking a wild guess here, I wonder if your Octave '&lt;code&gt;periodogram()&lt;/code&gt;' command merely computes a frequency-domain sequence of numbers, but it does &lt;em&gt;not&lt;/em&gt; perform any plotting.   Your:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subplot(2,1,2); plot( F, 20*log10(1/(length(SINE))*SINE), F,20*log10(1/(length(SQ))* SQ),F,1/(length(SQ))* SQ);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;command is strange. You seem to be plotting two logarithmic curves and one linear curve in the same window.  Is that what you want?  Try the following log plotting (it worked for me in Matlab):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subplot(2,1,2); plot(F,20*log10(1/(length(SQ))* SQ), '-bo');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="1629" LastEditDate="2015-12-30T23:03:10.360" LastActivityDate="2015-12-30T23:03:10.360" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28006" PostTypeId="2" ParentId="27983" CreationDate="2015-12-30T14:16:51.590" Score="0" Body="&lt;p&gt;Based on the comments, I would suggest we distinguish between theoretical analysis and practical implementation. For example: theory uses the concept of a sine wave. &lt;strong&gt;However, true sine waves in the mathematical sense do not exist !&lt;/strong&gt; In order for it to be an ideal sine wave (with a true delta function in the frequency domain) it would have to have infinite time extent. Since the universe has a finite life time, that can't be achieved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same is true for the digital representation of the transfer function of a system. It needs to be band limited to avoid aliasing and it needs to have finite impulse response length to avoid wrap around and/or truncation. However, these requirements are mutually exclusive: a signal can not be finite in both time and frequency simultaneously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All these mismatches between theory assumptions and practical limitations will create errors which are an unavoidable a part of any real implementation. However you can control the parameters of your implementation to make the error arbitrarily small and the trick is to understand the requirements of the implementation and choosing the parameters accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's pick a simple example to illustrate how this works: I want to measure the transfer function of a loudspeaker in a room, which is an LTI system. Since it's an exponential energy decay process, the impulse response is infinite. And since it's infinite, it's theoretically impossible to represent it exactly (at least not numerically). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The decay is typically described by the reverberation time, which is the time over which the energy decays by 60 dB. For a typical residential space that's maybe 0.3s. If we want to sample this at 48 kHz, we would need 14400 samples to cover 60 dB of dynamic range in the impulse response. If you want 120 dB of dynamic range you'd need 28800 samples. with 240,000 samples you get 1000 dB of dynamic range. You can pick any target dynamic range and calculate the required number of samples, you just can't make the dynamic range &quot;infinite&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this particular example you could look at other sources of error and make sure that your sampling error doesn't get in the way. For example the typical signal to noise ratio in a room is about 40 dB, so 60 dB of dynamic range for the impulse response is plenty. The sampling error will be simply be masked by the noise error and adding more sampling precision will not make the measurement any better. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2015-12-30T14:16:51.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28007" PostTypeId="1" AcceptedAnswerId="28043" CreationDate="2015-12-30T15:48:30.277" Score="0" ViewCount="1240" Body="&lt;p&gt;i have encoded H.264 video using ffmpeg . I want to apply packet loss model like Gilbert Eliot model to depict  video transmission over unreliable network. Like &lt;a href=&quot;https://stackoverflow.com/questions/15792105/simulating-tv-noise/15795112#15795112&quot;&gt;in this thread&lt;/a&gt; TV noise is simulated. But noise in internet is different. So is there a way to simulate packet loss/ noise for video streaming using ffmpeg or matlab?&lt;/p&gt;&#xA;" OwnerUserId="18454" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-01-02T00:09:38.160" Title="Simulate packet loss in internet video streaming" Tags="|matlab|noise|video-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28008" PostTypeId="2" ParentId="28001" CreationDate="2015-12-30T17:11:51.670" Score="1" Body="&lt;p&gt;&quot;Center&quot; isn't the word that I'd use to describe what you want to do. Your signal does not have a zero-mean, so like @Dole suggested you should use a DC-Blocker (DC-Offset removing) filter to get the job done:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are your references:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/DC_Blocker.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/DC_Blocker.html&lt;/a&gt;&#xA;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/DC_Blocker_Frequency_Response.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/DC_Blocker_Frequency_Response.html&lt;/a&gt;&#xA;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/filters/DC_Blocker_Software_Implementations.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/filters/DC_Blocker_Software_Implementations.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the code (from the above links) can be as simple as this, where x is the current sample and y is the filtered sample, while xm1 and ym1 are the x,y from the previous step (i.e. x[i-1], y[i-1]):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  y = x - xm1 + 0.995 * ym1;&#xA;  xm1 = x;&#xA;  ym1 = y;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11372" LastActivityDate="2015-12-30T17:11:51.670" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28009" PostTypeId="2" ParentId="15518" CreationDate="2015-12-30T17:59:06.270" Score="0" Body="&lt;p&gt;If I understand the question correctly, this result may be of help. Keeping in mind that amplitude modulation is convolution in frequency domain. All you need to do then is convolve the unit impulse in frequency domain by the step function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H({\omega}) = e^{j \omega\frac{N-1}{2}}\frac{\sin\omega\frac{N}{2}}{\sin\frac{\omega}{2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation for the cosine wave is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f[n] = \cos(\omega_0 n) \overset{DTFT}{\leftrightarrow} F(\omega)=1, \omega =\omega_0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And likewise for the negative side of the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convolution is just a frequency shifted version of the window:&#xA;$$F(\omega) * H(\omega) = &#xA;\frac{1}{2}\left (e^{j (\omega-\omega_0)\frac{N-1}{2}}\frac{\sin\{(\omega-\omega_0)\frac{N}{2}\}}{\sin\frac{(\omega-\omega_0)}{2}} + e^{j (\omega+\omega_0)\frac{N-1}{2}}\frac{\sin\{(\omega+\omega_0)\frac{N}{2}\}}{\sin\frac{(\omega+\omega_0)}{2}} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Converting this to the DFT representation should not be too difficult. As was hinted in the comments, the rectangular window is not a sinc function in discrete time, I think that's one of your errors. Also I think you have one extra minus sign on the 2nd exponential.&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="80" LastEditDate="2016-04-29T14:09:42.170" LastActivityDate="2016-04-29T14:09:42.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28010" PostTypeId="1" AcceptedAnswerId="28014" CreationDate="2015-12-30T19:45:54.067" Score="4" ViewCount="9931" Body="&lt;p&gt;I know this question has been asked here numerous times. But I am still unclear here :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My book says, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A linear time-invariant system is stable if its impulse response is absolutely summable.  (G. Proakis)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So that should mean that, &lt;strong&gt;for a stable system, the impulse response h[n] goes to zero as n approaches infinity, right?&lt;/strong&gt; But that filter is FIR filter. So &lt;strong&gt;FIR filters are always stable.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for unstable filters, the impulse response is not absolutely summable. In another way, the impulse response never approaches zero. Again, for IIR filter, h[h] continues to go on with n i.e. never goes to zero. So, IIR filters are supposed to be unstable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But from Z-transform, &lt;strong&gt;IIR filters have poles and FIR filters don't, correct?&lt;/strong&gt; And &lt;strong&gt;if the poles are inside unit circle, i.e. if their value is below one, then that filter is stable&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what's happening here? If IIR filters have impulse response which is not absolutely summable, how come they are stable when their poles are within unit circle? Their impulse response goes on like forever, right? Their output gets feedback. So why they can be stable depending on pole's location or value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance :)&lt;/p&gt;&#xA;" OwnerUserId="17687" LastEditorUserId="4298" LastEditDate="2021-02-10T18:44:30.933" LastActivityDate="2021-02-10T18:44:30.933" Title="Are all IIR filters unstable in nature?" Tags="|filters|filter-design|finite-impulse-response|infinite-impulse-response|poles-zeros|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28011" PostTypeId="5" CreationDate="2015-12-30T19:47:51.760" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2015-12-30T19:47:51.760" LastActivityDate="2015-12-30T19:47:51.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28012" PostTypeId="4" CreationDate="2015-12-30T19:47:51.760" Score="0" Body="FIR filters are filters with a finite duration impulse response." OwnerUserId="17687" LastEditorUserId="80" LastEditDate="2015-12-31T16:04:01.363" LastActivityDate="2015-12-31T16:04:01.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28013" PostTypeId="2" ParentId="28010" CreationDate="2015-12-30T20:19:44.207" Score="2" Body="&lt;p&gt;IIR filters are stable when the poles are inside the unit circle. The fact the that impulse response is infinite in time doesn't mean it's not absolute summable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a simple filter like $y[n]= x[n] + \frac{1}{2} \cdot y[n-1]$. The impulse response is 1, 0.5, 0.25 ..., i.e. $h[n] = 2^{-n}$. The absolute sum of the impulse response is simply 2, even though it's an infinite series it has a finite absolute sum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FIR filters have poles too, there just all at z = 0. Poles are fine, as long as they are inside the  unit circle.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="3997" LastEditDate="2015-12-31T18:00:15.360" LastActivityDate="2015-12-31T18:00:15.360" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28014" PostTypeId="2" ParentId="28010" CreationDate="2015-12-30T21:12:04.687" Score="14" Body="&lt;p&gt;Note that for stable IIR filters, the impulse response does approach zero as $n$ goes to infinity. It just never becomes exactly zero. However, the sum of the absolute values is finite. Just as an example, take the exponential impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=a^nu[n],\qquad |a|&amp;lt;1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u[n]$ is the unit step function. The sum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}|h[n]|=\sum_{n=0}^{\infty}|a|^n=\frac{1}{1-|a|}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is obviously finite (for $|a|&amp;lt;1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree with Hilmar's answer, but I would like to add that everything he said about poles is only valid for &lt;em&gt;causal&lt;/em&gt; filters. In the general case it is not necessary for a stable filter to have all its poles inside the unit circle. For stability it is necessary and sufficient that the unit circle is inside the region of convergence (ROC) of the filter's $\mathcal{Z}$-transform (transfer function). So a stable filter can have poles inside as well as outside the unit circle, but in that case it can't be causal. So it's only the additional requirement of causality that forces the poles of a stable IIR filter inside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar thing holds for FIR filters. Causal FIR filters indeed have all their poles at the origin, but non-causal FIR filters also have poles at infinity. A simple example is this non-causal moving average filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac15\left(z^{-2}+z^{-1}+1+z+z^2\right)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has poles at $z=0$ as well as poles at $z=\infty$, but being an FIR filter, it is obviously stable.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-30T19:03:43.023" LastActivityDate="2016-01-30T19:03:43.023" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28015" PostTypeId="1" CreationDate="2015-12-30T21:58:00.393" Score="1" ViewCount="803" Body="&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Forward_Backward_Filtering.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;From this document&lt;/a&gt; it's says&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.Filter the Data&#xA;2.Flip that&#xA;3.Filter again&#xA;4.and Flip that again&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for zero-phase filter. but when i do this in matlab , i'm compare between filtfilt method and what i did , it isnt equal. what is the problem ?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB CODE&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc;clear all;&#xA;emg_healthy=load('emg_healthy.txt');&#xA;x= 10;&#xA;fs= 4000;&#xA;my_counter = 1000;&#xA;myRawData = emg_healthy(:,2);&#xA;myRawData = myRawData(1:my_counter);&#xA;myDataRecti = abs(myRawData);&#xA;[b,a]= butter(6,x/(fs/2),'low');&#xA;filter_y=filtfilt(b,a,myDataRecti);&#xA;firstFilter = filter(b,a,myDataRecti);&#xA;flip_firstFilter = fliplr(firstFilter);&#xA;secondFilter = filter(b,a,flip_firstFilter);&#xA;flip_secondFilter = fliplr(secondFilter);&#xA;xlabel('Sample Number');ylabel('Genliği');plot(flip_secondFilter,'b');&#xA;hold on ;&#xA;xlabel('Sample Number');ylabel('Rect Genliği');plot(filter_y,'r');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;RESULT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/S2HVC.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S2HVC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;-----------------------------------EDIT-----------------------------------&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks to robert bristow-johnson, i tried zero-padding to myData , end and begin.&#xA;This is i try&lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB CODE&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% % EMG Soleus &#xA;clc;clear all;&#xA;emg_healthy=load('emg_healthy.txt');&#xA;x= 10;&#xA;fs= 4000;&#xA;my_counter = 1000;&#xA;myRawData = emg_healthy(:,2);&#xA;myRawData = myRawData(1:my_counter);&#xA;myDataRecti = abs(myRawData);&#xA;[b,a]= butter(6,x/(fs/2),'low');&#xA;for i = 1:1:(my_counter/4)&#xA;myZeroDataRecti(i) = 0;    &#xA;end&#xA;for i = (my_counter/4+1):1:(my_counter+my_counter/4)&#xA;myZeroDataRecti(i) = myDataRecti(i-my_counter/4);&#xA;end&#xA;for i=(my_counter+my_counter/4+1):1:(my_counter+my_counter/4+my_counter/4)&#xA;    myZeroDataRecti(i) = 0;&#xA;end&#xA;filter_y=filtfilt(b,a,myZeroDataRecti);&#xA;firstFilter = filter(b,a,myZeroDataRecti);&#xA;flip_firstFilter = fliplr(firstFilter);&#xA;secondFilter = filter(b,a,flip_firstFilter);&#xA;flip_secondFilter = fliplr(secondFilter);&#xA;xlabel('Sample Number');ylabel('Amplitude');plot(myZeroDataRecti,'g');&#xA;hold on ;&#xA;xlabel('Sample Number');ylabel('Amplitude');plot(flip_secondFilter,'b');&#xA;xlabel('Sample Number');ylabel('Amplitude');plot(filter_y,'r');&#xA;% &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;RESULT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pQUzA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pQUzA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another i try , i again add zero-padding begin and end but i used filtfit method to apply without zero-padding data &lt;/p&gt;&#xA;&#xA;&lt;p&gt;MATLAB CODE &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% % EMG Soleus &#xA;clc;clear all;&#xA;emg_healthy=load('emg_healthy.txt');&#xA;x= 10;&#xA;fs= 4000;&#xA;my_counter = 1000;&#xA;myRawData = emg_healthy(:,2);&#xA;myRawData = myRawData(1:my_counter);&#xA;myDataRecti = abs(myRawData);&#xA;&#xA;[b,a]= butter(6,x/(fs/2),'low');&#xA;filter_y=filtfilt(b,a,myDataRecti);&#xA;for i = 1:1:(my_counter/4)&#xA;myZeroDataRecti(i) = 0;    &#xA;end&#xA;for i = (my_counter/4+1):1:(my_counter+my_counter/4)&#xA;myZeroDataRecti(i) = myDataRecti(i-my_counter/4);&#xA;end&#xA;for i=(my_counter+my_counter/4+1):1:(my_counter+my_counter/4+my_counter/4)&#xA;    myZeroDataRecti(i) = 0;&#xA;end&#xA;firstFilter = filter(b,a,myZeroDataRecti);&#xA;flip_firstFilter = fliplr(firstFilter);&#xA;secondFilter = filter(b,a,flip_firstFilter);&#xA;flip_secondFilter = fliplr(secondFilter);&#xA;xlabel('Sample Number');ylabel('Amplitude');plot(flip_secondFilter,'b');&#xA;hold on ;&#xA;xlabel('Sample Number');ylabel('Amplitude');plot(myDataRecti,'g');&#xA;xlabel('Sample Number');ylabel('Amplitude');plot(myZeroDataRecti,'c');&#xA;xlabel('Sample Number');ylabel('Amplitude');plot(filter_y,'r');&#xA;% &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;RESULT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yDaRx.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yDaRx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in my opion, there are two things we have to think about that,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.First picture in the edit part,my signal (myCode-LEGEND) amortize itself , but matlab function (filtfilt) keep continiues , why is that ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.Second picture in the edit part, my signal(myCode-LEGEND) different from filtfilt function signal. And between myCode and 250Zero+originalData+250Zero i think it doesnt any phase shift. If we say that it's true what should i do ? Will i remove 250 zero from begin and end ?   &lt;/p&gt;&#xA;" OwnerUserId="17615" LastEditorUserId="4298" LastEditDate="2020-11-08T16:57:52.047" LastActivityDate="2020-11-08T16:57:52.047" Title="Zero-Phase Algorithm in Matlab" Tags="|matlab|filters|infinite-impulse-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28016" PostTypeId="2" ParentId="28015" CreationDate="2015-12-30T22:51:49.480" Score="2" Body="&lt;p&gt;As far as I can see you're doing the basic filtering right. The difference with Matlab's &lt;code&gt;filtfilt&lt;/code&gt; function is that the latter uses certain initial conditions in the calls to &lt;code&gt;filter&lt;/code&gt; to minimize transients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://nl.mathworks.com/help/signal/ref/filtfilt.html&quot; rel=&quot;nofollow&quot;&gt;Matlab documentation&lt;/a&gt; says the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;filtfilt&lt;/code&gt; minimizes start-up and ending transients by matching initial conditions, and you can use it for both real and complex inputs&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The appropriate reference is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Gustafsson, F. &quot;Determining the initial states in forward-backward filtering.&quot; IEEE® Transactions on Signal Processing. Vol. 44, April 1996, pp. 988–992&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2015-12-30T22:51:49.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28017" PostTypeId="2" ParentId="28003" CreationDate="2015-12-30T22:59:08.943" Score="1" Body="&lt;p&gt;The library function log of zero results in a NaN (not a real number, -inf).  So the log of a square with a base of zero can't be plotted.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2015-12-30T22:59:08.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28018" PostTypeId="1" AcceptedAnswerId="28259" CreationDate="2015-12-31T04:52:01.910" Score="1" ViewCount="177" Body="&lt;p&gt;I am new to the concept of wavelet transforms. Can somebody please help me in understanding this ? and also how to implement it in c. Is Short term Fourier transform more efficient than Wavelet Transform for finding Transients ?&lt;/p&gt;&#xA;" OwnerUserId="18914" LastEditorUserId="18914" LastEditDate="2016-01-28T06:20:27.537" LastActivityDate="2016-01-29T15:45:54.850" Title="Implementing wavelet transform for finding transients in the power supply" Tags="|wavelet|transform|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28019" PostTypeId="2" ParentId="28001" CreationDate="2015-12-31T04:56:23.957" Score="1" Body="&lt;p&gt;Use small High Pass filter. Usually it is suggested to remove the frequencies in the range of 0-200 Hz for speech signals.&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2015-12-31T04:56:23.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28020" PostTypeId="1" CreationDate="2015-12-31T07:52:12.223" Score="1" ViewCount="1784" Body="&lt;p&gt;It has annoyed me that there doesn't seem to be a source online where the complete complex Fourier transform family is presented with every variable defined. The lack of definitions can be a nuisance when the transforms often use same symbols to denote different variables. So, what are the relevant transforms and the equations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note: I will post the answers myself, but feel free to edit the answer to be as clear and concise as possible).&lt;/p&gt;&#xA;" OwnerUserId="16605" LastActivityDate="2019-01-25T22:31:06.040" Title="Formulas of the Fourier transform family" Tags="|fourier-transform|dft|fourier-series|dtft|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28021" PostTypeId="2" ParentId="28020" CreationDate="2015-12-31T07:52:12.223" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\large \text{FOURIER TRANSFORMS}$$&lt;/span&gt;&#xA;&lt;br/&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Fourier series &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;:&lt;/h2&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\large X[k] = \int_{0}^{T}x(t)e^{\huge \frac{-j2\pi kt}{T}}dt$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; = Length of the window or fundamental oscillation, &lt;span class=&quot;math-container&quot;&gt;$\large \frac{1}{T} =$&lt;/span&gt; fundamental frequency , &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; can also be denoted as &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; = time&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; = Index of the harmonic frequency, 1= fundamental etc...&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\large \frac{k}{T}$&lt;/span&gt; = oscillation frequency. The multiples of k are the frequencies and corresponding negative frequencies the transform consists of.&lt;/p&gt;&#xA;&lt;br/&gt;&#xA;&lt;h2&gt;Fourier transform &lt;span class=&quot;math-container&quot;&gt;$X(\omega)$&lt;/span&gt;:&lt;/h2&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X(\omega) =\large  \int_{-\infty}^{\infty}x(t)e^{\large -j\omega t} d\omega$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\omega = \large \frac{2\pi}T$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; = Length of the oscillation, &lt;span class=&quot;math-container&quot;&gt;$1/T$&lt;/span&gt; frequency of the oscillation. As can be seen, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is a different variable than in the Fourier series. Oscillation frequency was &lt;span class=&quot;math-container&quot;&gt;$\large \frac{k}{T_{series}}$&lt;/span&gt; in the series representation.&lt;/p&gt;&#xA;&lt;p&gt;Note: Fourier transform can be derived from Fourier series by considering a case where T &lt;span class=&quot;math-container&quot;&gt;$\rightarrow \infty$&lt;/span&gt;, which makes the frequency domain continuous. Fourier transform is often given as a function of the oscillation frequency &lt;span class=&quot;math-container&quot;&gt;$f=\large \frac{1}{T}$&lt;/span&gt;, there is nothing preventing doing the same to Fourier series.&lt;/p&gt;&#xA;&lt;br/&gt;&#xA;&lt;h2&gt;Discrete Fourier transform &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;:&lt;/h2&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\large X[k]=\sum_{n=0}^{N-1}x[n]e^{\huge \frac{-j2\pi kn}{N}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; = Length of the window in samples&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; = Number of the sample&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; = Index&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\large \frac{N}{f_{s}}$&lt;/span&gt; = Length of the window in time(sec), &lt;span class=&quot;math-container&quot;&gt;$\large \frac{kN}{f_{s}}$&lt;/span&gt; = oscillation frequency for each of k. &lt;span class=&quot;math-container&quot;&gt;$f_s$&lt;/span&gt; = sampling frequency.&lt;/p&gt;&#xA;&lt;p&gt;DFT can be derived from Fourier series, by simply considering a case where the signal is discrete and evaluated in terms of samples instead of time. Thus the signal is discrete in time and frequency, which gives rise to the name.&lt;/p&gt;&#xA;&lt;p&gt;DTFT representation and inverse transforms to be added.&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2015-12-31T23:14:41.107" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28022" PostTypeId="2" ParentId="28020" CreationDate="2015-12-31T08:54:54.270" Score="1" Body="&lt;p&gt;Periodic function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{x}(t) = \hat{x}(t+T) \quad \text{for all } t $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier series:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{x}(t) = \sum\limits_{k=-\infty}^{+\infty} \hat{X}_k \ e^{+j k (2\pi/T) t} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{X}_k = \frac{1}{T} \int\limits_{t_0}^{t_0+T} \hat{x}(t) \ e^{-j k (2\pi/T) t} \ dt \quad \text{for all } t_0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier Transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(f) = \int\limits_{-\infty}^{+\infty} x(t) e^{-j 2 \pi f t} \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \int\limits_{-\infty}^{+\infty} X(f) e^{+j 2 \pi f t} \ df $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2015-12-31T08:54:54.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28023" PostTypeId="2" ParentId="28003" CreationDate="2015-12-31T09:48:16.457" Score="1" Body="&lt;p&gt;Your array &lt;code&gt;SQ&lt;/code&gt; has many zero-valued elements:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SQ =&#xA; Columns 1 through 6:&#xA;     0.00000     0.00000     0.00000     0.00000   651.91501     0.00000&#xA; Columns 7 through 12:&#xA;     0.00000     0.00000     0.00000     0.00000     0.00000     0.00000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Taking the logarithm gives a minus infinity for the zeros:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave&amp;gt; 20*log10(1/(length(SQ))*SQ)&#xA;ans =&#xA; Columns 1 through 8:&#xA;      -Inf      -Inf      -Inf      -Inf    2.0815      -Inf      -Inf      -Inf&#xA; Columns 9 through 16:&#xA;      -Inf      -Inf      -Inf      -Inf   -7.4592      -Inf      -Inf      -Inf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can clamp those values to some more reasonable limit using &lt;code&gt;max&lt;/code&gt;, which does the right thing handling minus infinities (unlike &lt;code&gt;plot&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave&amp;gt; max(20*log10(1/(length(SQ))*SQ), -120)&#xA;ans =&#xA; Columns 1 through 7:&#xA;  -120.0000  -120.0000  -120.0000  -120.0000     2.0815  -120.0000  -120.0000&#xA; Columns 8 through 14:&#xA;  -120.0000  -120.0000  -120.0000  -120.0000  -120.0000    -7.4592  -120.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Plotting:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot( F, 20*log10(1/(length(SINE))*SINE), F, max(20*log10(1/(length(SQ))*SQ), -120));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sWtoS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sWtoS.png&quot; alt=&quot;Spectrum of sine and square wave&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do the same thing with the sine wave, which by luck had a spectral floor of numerical error. With audio, you rarely care about things more quiet than -120 dB.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-12-31T09:59:06.193" LastActivityDate="2015-12-31T09:59:06.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28024" PostTypeId="2" ParentId="28020" CreationDate="2015-12-31T10:42:09.727" Score="1" Body="&lt;p&gt;Let us assume we are in one dimension, and we are not concerned about existence. There are two ordinal variables: time $t$ in the  primal space (could be space), frequency  $f$ in the dual Fourier space. Both can be either discrete or continuous.  For the sake of simplicity, let us assume that the discrete is periodic. One transform, four ($2\times 2$) possiblities, summarized in the following table:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VAqMc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VAqMc.png&quot; alt=&quot;4 types of Fourier transforms and series&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can draw the different options (in time domain) as:&lt;a href=&quot;https://i.stack.imgur.com/qhEtd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qhEtd.png&quot; alt=&quot;discrete and continuous Fourier transforms and series&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The duality is much more profound that than, if you are interested, have a look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Pontryagin_duality&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pontryagin duality&lt;/a&gt;, with  &lt;a href=&quot;https://terrytao.wordpress.com/tag/pontryagin-duality/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fourier transform notes from Terry Tao&lt;/a&gt; blog.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2015-12-31T10:42:09.727" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28025" PostTypeId="2" ParentId="27994" CreationDate="2015-12-31T11:18:35.163" Score="2" Body="&lt;p&gt;The origin of MR signal is vastly complicated; you'll need to read a few books to go to the bottom of it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that in a simple way, the signal from an MR image usually starts with the proton density of what is imaged, with SNR going typically going from below one to several tens, all modulated by the contrast techniques applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I think you'll need to be more specific about your aim if you want to get anything useful. For instance, I'm not sure what you mean by &quot;characteristics&quot; and &quot;decision factor&quot;.&lt;/p&gt;&#xA;" OwnerUserId="18916" LastActivityDate="2015-12-31T11:18:35.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28026" PostTypeId="1" AcceptedAnswerId="28027" CreationDate="2015-12-31T11:43:35.723" Score="0" ViewCount="410" Body="&lt;p&gt;Im currently working on VAD (voice activity detection) topic. Since I'm beginner in digital signal processing, I've started to wonder if calculating single frame energy (after aplying FFT to it) and looking for values around 4Hz and bandwith (for example) from 200Hz to 600Hz would be as effective as checking for 4Hz modulation energy after finding MFCC coefficients? &lt;/p&gt;&#xA;" OwnerUserId="18770" LastActivityDate="2015-12-31T12:24:07.527" Title="Obtaining signal energy modulation for voice activity detection" Tags="|fft|signal-analysis|mfcc|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28027" PostTypeId="2" ParentId="28026" CreationDate="2015-12-31T12:24:07.527" Score="0" Body="&lt;p&gt;From my understanding of your question, you want to ask whether one should look for energy(of FFT coefficients) of bands directly, or one should use MFCC's (energy) for  making VAD decisions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As MFCC based approach is to mimic the human auditory systems response, it will be better to use MFCC coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if one uses same bands as MEL Filterbank for calculating band-wise energy (after taking FFT), than the results will be similar to using MFCC'S, as MFCC's are just the transformation from FFT coefficients.  &lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2015-12-31T12:24:07.527" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28028" PostTypeId="2" ParentId="20225" CreationDate="2015-12-31T14:15:33.897" Score="0" Body="&lt;p&gt;Usually we assume that noise is additive. That is, the combined signal that you observe is the sum of a pure signal, and noise. The same applies to their Fourier transforms. Looking at a frequency bin, if the magnitude of the noise is less than the magnitude of the pure signal, then the magnitude of the sum cannot exceed the magnitude of the pure signal by more than 6 dB. You mention a large number, 15 dB (unclear what you compare), which makes me think that the observed frequency-dependency is due to something else than noise. For instance, pure rectangular signals natively have a 6 dB/octave (20 dB/decade) decaying spectral envelope.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2015-12-31T14:20:38.127" LastActivityDate="2015-12-31T14:20:38.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28029" PostTypeId="1" AcceptedAnswerId="28039" CreationDate="2015-12-31T14:23:22.503" Score="0" ViewCount="152" Body="&lt;p&gt;I got a question regarding to modulation entropy of audio signal. There is some literature I found about this topic, &lt;a href=&quot;http://www.irit.fr/recherches/SAMOVA/FeaturesExtraction.html#me&quot; rel=&quot;nofollow&quot;&gt;http://www.irit.fr/recherches/SAMOVA/FeaturesExtraction.html#me&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read sample .wav file. How do I calculate entropy of this sampled signal of lenght N samples? How should I understand, in this case (in paper equation from above), propability of event?&lt;/p&gt;&#xA;" OwnerUserId="18770" LastActivityDate="2016-01-01T15:30:09.890" Title="Computing of speech signals modulation entropy" Tags="|speech-processing|wave|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28030" PostTypeId="2" ParentId="24969" CreationDate="2015-12-31T16:18:36.300" Score="-1" Body="&lt;p&gt;Level set is for continuous segmentation, multiphase. But Graph cut is for discrete segmentation, only two phase&lt;/p&gt;&#xA;" OwnerUserId="8430" LastActivityDate="2015-12-31T16:18:36.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28032" PostTypeId="2" ParentId="27994" CreationDate="2015-12-31T21:07:42.173" Score="4" Body="&lt;p&gt;Speaking from a medical imaging perspective, the SNR of MR images mainly depends on signal acquisition schemes, image reconstruction parameters, and the MR scanner hardware, such as, number of receive coils. To know about more about other parameters go here: &lt;a href=&quot;http://wiki.ci.uchicago.edu/pub/HNL/DifficultQuestion/howdoesmriwork.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://wiki.ci.uchicago.edu/pub/HNL/DifficultQuestion/howdoesmriwork.pdf&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parallel MR imaging is one of the acquisition technique which improves SNR. For example, I'm sharing with you the results from a paper published in journal of magnetic resonance imaging on &quot;Measurement of Signal-to-Noise Ratios in MR&#xA;Images&quot; by Olaf Dietrich and others below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w9M8e.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w9M8e.png&quot; alt=&quot;SNR with various acquisition schemes and filters&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: Take the reciprocal to get noise to signal ratio.&lt;/p&gt;&#xA;" OwnerUserId="11977" LastEditorUserId="11977" LastEditDate="2016-01-03T23:10:36.400" LastActivityDate="2016-01-03T23:10:36.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28033" PostTypeId="1" AcceptedAnswerId="28035" CreationDate="2015-12-31T22:30:16.520" Score="2" ViewCount="1455" Body="&lt;p&gt;I want a complex FIR or IIR filter whose response is approximately a sawtooth in the frequency domain. How should this be formally described, and what formula or algorithm can I use to calculate taps for one?&lt;/p&gt;&#xA;&lt;p&gt;Here is a sketch of the magnitude response I want (not analysis of an actual filter). I think the phase response doesn't matter.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/S3qpD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S3qpD.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8jkVZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8jkVZ.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;" OwnerUserId="4655" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2022-10-22T18:16:15.153" Title="What kind of filter would have a sawtooth frequency response?" Tags="|filters|filter-design|" AnswerCount="5" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="28035" PostTypeId="2" ParentId="28033" CreationDate="2016-01-01T10:29:24.590" Score="3" Body="&lt;p&gt;A windowed design is easy. Starting with an ideal zero-phase frequency response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\omega}{2\pi} + \frac{1}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse Fourier transform of that gives the ideal impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\int^\pi_{-\pi}\left(\frac{\omega}{2\pi}+\frac{1}{2}\right)e^{i\omega k}d\omega = \frac{\sin(\pi k)}{k} + i\left(\frac{\sin(\pi k)}{\pi k^2} - \frac{\cos(\pi k)}{k}\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow&quot;&gt;$\text{sinc}$ function&lt;/a&gt;, the real part $\frac{\sin(\pi k)}{k}$ has an illegal division by zero at $k=0$ where the limiting value $\pi$ should be used instead. For other integer $k$, the real part is zero. The imaginary part has similar problems at $k=0$, where its limit is 0. Drawing from Rick's answer, at integer $k$, $\sin(\pi k)$ is zero and $\cos(\pi k)$ is +1 or -1. This simplifies the ideal impulse response at integer $k$ to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{cases}\pi&amp;amp;\text{if }k=0,&#xA;\\i\frac{-(-1)^k}{k}&amp;amp;\text{otherwise.}\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the filter is implemented as a sum of a purely real and a purely imaginary filter, the purely real filter requires no work other than to multiply the input by a constant. The imaginary part of the impulse response is antisymmetrical, which may enable savings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To continue with the windowed design, choose a window function and its length (equals the number of filter taps) and multiply the ideal impulse response by it. &#xA;That gives the impulse response of the filter. The window function should be centered at $k = 0$.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-01-02T09:24:01.057" LastActivityDate="2016-01-02T09:24:01.057" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28036" PostTypeId="2" ParentId="28033" CreationDate="2016-01-01T11:52:43.740" Score="-1" Body="&lt;p&gt;I plugged a frequency response of &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; into the inverse discrete-time Fourier transform (inverse DTFT) equation and ended up with:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h[k] = \frac{\sin(k\omega_c)}{k^2\pi}-\frac{(\omega_c)\cos(k\omega_c)}{k\pi}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\omega_c$&lt;/span&gt; is the cutoff freq measured in radians.  Index &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is ...-3,-2,-1,0,1,2,3....  When &lt;span class=&quot;math-container&quot;&gt;$k = 0$&lt;/span&gt; set &lt;span class=&quot;math-container&quot;&gt;$h[0] = 0$&lt;/span&gt;. (You may want to multiply &lt;span class=&quot;math-container&quot;&gt;$h[k]$&lt;/span&gt; by a window sequence to reduce the frequency magnitude response ripples.) If we set &lt;span class=&quot;math-container&quot;&gt;$\omega_c = \pi$&lt;/span&gt; we end up with:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h[k] = \frac{-(-1)^k}{k}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Try out the above &lt;span class=&quot;math-container&quot;&gt;$h[k]$&lt;/span&gt;'s.  Who knows, they might work for you. (The &lt;span class=&quot;math-container&quot;&gt;$h[k]$&lt;/span&gt; equations are supplied &amp;quot;as is.&amp;quot; No warranty of any kind, either expressed or implied.)&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="13320" LastEditDate="2022-10-22T18:16:15.153" LastActivityDate="2022-10-22T18:16:15.153" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28037" PostTypeId="2" ParentId="28033" CreationDate="2016-01-01T12:29:02.820" Score="2" Body="&lt;p&gt;For general filter designs, a least squares method is usually a good start. The window method suggested by Olli Niemitalo is also useful, but it is a bit less flexible because you can't define &quot;don't care regions&quot; (which is important for dealing with discontinuities in the desired response). Furthermore, with least squares you can add a weighting function which marks certain frequency regions as more important than others, resulting in a smaller approximation error in those regions. And finally, with least squares you don't need to analytically compute an inverse DTFT, which is not always possible in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple Matlab/Octave script for a least squares design (without weighting) looks like this (note that I assume a linear desired phase response):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;N = 101;                                 % choose some filter length&#xA;w = 2*pi*linspace(-.45,.45,200);         % frequency grid with don't care regions&#xA;d = (.5+w/(2*pi)).*exp(-1i*w*(N-1)/2);   % desired response (linear phase)&#xA;A = exp(-1i*w(:)*(0:N-1));               % matrix of overdetermined system A*h=d&#xA;h = A\d(:);                              % least squares solution&#xA;% plot designed frequency response&#xA;wp = linspace(-pi,pi,512);&#xA;H = freqz(h,1,wp);&#xA;plot(wp/2/pi, abs(H)); axis([-.5,.5,0,1])&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ntrsy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ntrsy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-01T17:56:19.343" LastActivityDate="2016-01-01T17:56:19.343" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28039" PostTypeId="2" ParentId="28029" CreationDate="2016-01-01T15:30:09.890" Score="0" Body="&lt;p&gt;Ok, I've found what i was looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper describes how to measure entropy in signals: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entropy Based Voice Activity Detection in Very Noisy Conditions, by Philippe Renevey and Andrzej Drygajlo. &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.123.6098&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.123.6098&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this question covers the part of coding side of question:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/18962990/calculate-entropy-of-a-file&quot;&gt;https://stackoverflow.com/questions/18962990/calculate-entropy-of-a-file&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18770" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-01-01T15:30:09.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28040" PostTypeId="1" CreationDate="2016-01-01T16:29:02.050" Score="0" ViewCount="50" Body="&lt;p&gt;I have the following MATLAB code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=[1 2 3; 4 5 6; 7 8 9;];&#xA;u=(0:255)/(255-1).^1.05;&#xA;x2=u(x+1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;when I run this code I get the following as a result in &lt;code&gt;x2&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x2 =&#xA;&#xA;0.0030    0.0060    0.0090&#xA;0.0119    0.0149    0.0179&#xA;0.0209    0.0239    0.0269&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;what is happening when I call this &lt;code&gt;line x2=u(x+1)&lt;/code&gt;? and how to write it mathematically? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance&lt;/p&gt;&#xA;" OwnerUserId="18926" LastEditorUserId="8202" LastEditDate="2016-01-01T19:58:54.443" LastActivityDate="2016-01-01T21:11:27.960" Title="what is happening when i run this code line?" Tags="|matlab|filters|image-processing|matrix|" AnswerCount="1" CommentCount="1" ClosedDate="2016-01-01T23:31:08.440" ContentLicense="CC BY-SA 3.0" />
  <row Id="28041" PostTypeId="2" ParentId="28040" CreationDate="2016-01-01T21:11:27.960" Score="1" Body="&lt;p&gt;You are putting the values of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u(2),...,u(10)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in a $3\times 3$ matrix with the shape of the index matrix $x$. This could be written simply as $$x2_{(i,j)}= u (x_{(i,j)}+1),\;(i,j)\in[1,2,3]\times[1,2,3]\,. $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further matrix shape conversions, you can have a look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Vectorization_(mathematics)&quot; rel=&quot;nofollow&quot;&gt;vectorization&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Matricization&quot; rel=&quot;nofollow&quot;&gt;matricization&lt;/a&gt;, and you can find notations in chapter 3.4 Matricization of a tensor of &lt;a href=&quot;http://www.sandia.gov/~tgkolda/pubs/pubfiles/SAND2006-2081.pdf&quot; rel=&quot;nofollow&quot;&gt;Multilinear operators for higher-order decompositions&lt;/a&gt;, T. Kolda, 2006.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-01T21:11:27.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28042" PostTypeId="2" ParentId="28033" CreationDate="2016-01-01T21:11:40.980" Score="0" Body="&lt;p&gt;Figuring out the Fourier series for a sawtooth wave in the time domain is a common exercise.  That same series will be the time domain impulse response for a sawtooth in the frequency domain.  Since you want odd symmetry, all imaginary (but conjugate symmetric if you want a real result).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-01T21:11:40.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28043" PostTypeId="2" ParentId="28007" CreationDate="2016-01-02T00:09:38.160" Score="1" Body="&lt;p&gt;For me your question is not clear enough. This questions come to my mind:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;what exactly do you want to transmit?&#xA;Do you want to transmit raw H.264 bitstream (NAL units) or maybe MPEG2-TS, or RTP packets? Most video transmission applications would use either MPEG2-TS or RTP. I suppose that you are not interested in HTTP or other TCP based streaming solutions.&lt;/li&gt;&#xA;&lt;li&gt;you are talking about the noise in the internet. Are you interested in simulation of some specific network topology?&lt;/li&gt;&#xA;&lt;li&gt;what network protocols do you want to use and how does the transmission channel looks like?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You might take a look at &lt;a href=&quot;https://www.nsnam.org/&quot; rel=&quot;nofollow&quot;&gt;NS-3&lt;/a&gt; network simulator. With it you can simulate quite everything and it's also quite easy to use if you are familiar with C++ and network programming. But it is probably not the easiest way to solve your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure that you can also stream the video with FFMPEG but I don't think that FFMPEG allows you to drop packets based on some error model. But you could use &lt;a href=&quot;http://man7.org/linux/man-pages/man8/tc-netem.8.html&quot; rel=&quot;nofollow&quot;&gt;NetEm&lt;/a&gt; to generate packet loss, delay or duplication of packets on your Linux system.&lt;/p&gt;&#xA;" OwnerUserId="10194" LastActivityDate="2016-01-02T00:09:38.160" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28044" PostTypeId="1" CreationDate="2016-01-02T03:51:47.923" Score="1" ViewCount="2858" Body="&lt;p&gt;I performed an FFT with some zero padding and would like to transform it back to time domain. When I plot the signal it looks wrong. Is it because of the padding used in the FFT? How can I make it right? here is my code for doing the IFFT:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NFFT=4301;&#xA;AvIFFT = ifft(FFTavg.dat,NFFT);&#xA;plot(real(AvIFFT))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I get this plot:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mpyB0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mpyB0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be greatly appreciated! Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps: I have asked this question on matworks but no success as yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As suggested in the comment and answer below, I tried fftshift:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NFFT = 4301;&#xA;FFTshifted = fftshift(FFTavg.dat);&#xA;AvIFFT  = ifftshift(FFTshifted,NFFT);   &#xA;plot(real(AvIFFT))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IVZ4K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IVZ4K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17397" LastEditorUserId="17397" LastEditDate="2016-01-03T04:15:14.850" LastActivityDate="2016-11-30T00:29:57.663" Title="FFT, padding, IFFT and plot in time domain" Tags="|matlab|fft|signal-analysis|ifft|zero-padding|" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="28045" PostTypeId="2" ParentId="28044" CreationDate="2016-01-02T05:52:45.687" Score="1" Body="&lt;p&gt;user3406207: I'm not sure what you're trying to do because I don't know the meaning of your words &quot;wrong&quot; and &quot;right.&quot;  But we &lt;em&gt;can&lt;/em&gt; say, if you perform time-domain zero padding on an original unpadded $x1[n]$ input sequence you'll produce some longer-length $x2[n]$ sequence. The $X2[m]$ fft of your $x2[n]$ sequence will be an &lt;em&gt;interpolated&lt;/em&gt; version of (more freq-domain samples than) the $X1[m]$ fft of your $x1[n]$ sequence.  And, of course, the inverse fft of $X2[m]$ will be $x2[n]$ and the inverse FFT of $X1[m]$ will be $x1[n]$. I hope that helps. (By the way, you were smart to plot just the real part of your inverse fft.)&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2016-01-02T05:52:45.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28046" PostTypeId="1" CreationDate="2016-01-02T09:54:04.327" Score="1" ViewCount="284" Body="&lt;p&gt;I am trying to segment my characters on this image with using column sum vector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method actually works on the paper I've read about license plate recognition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;it looks useful for my images too but since my threshold values are not very good I am not really sure if I can use CSV for character segmentation  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E6XZG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E6XZG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/S6Hxs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S6Hxs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so my question is; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is CSV proper method for my application ?&#xA;2) if so what kind of techniques I can try to segment characters ?&#xA;3) if not what can be more efficient and robust way to segment characters from some kind of images ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank you &lt;/p&gt;&#xA;" OwnerUserId="12210" LastActivityDate="2022-04-02T13:04:55.503" Title="Can I segment characters from this image with CSV?" Tags="|computer-vision|opencv|machine-learning|ocr|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28047" PostTypeId="2" ParentId="28033" CreationDate="2016-01-02T10:19:41.010" Score="1" Body="&lt;p&gt;What you have is basically the magnitude response of a sampled differentiator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t|t=nT) = \frac {d}{dt} x(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a basic first order high pass filter with a +6dB/octave slope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest possible approximation would be a one zero filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y[n] = a_0 * (x[n] - x[n-1])$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could add a pole to that for a better low frequency match, or you could go all in with a windowed FIR design like Olli Niemitalo (what is the markdown syntax for proper @-attribution?) mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/One_Zero.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/fp/One_Zero.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12235" LastEditorUserId="12235" LastEditDate="2016-01-02T12:32:16.400" LastActivityDate="2016-01-02T12:32:16.400" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28048" PostTypeId="2" ParentId="28046" CreationDate="2016-01-02T12:42:59.817" Score="1" Body="&lt;p&gt;Your results (above) looks well for character segmentation. But if you have some problems with calculation of thresholds for total image, you can try slightly different approach. &quot;Column sum vector&quot; method works well for grey images too, but not only for black/white images. So there is no need to calculate threshold for total image, but you must choose some value for segmentation in vector. May be it will slightly simpler to do segmentation in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use &quot;line sum vector&quot; for vertical segmentation   too.&lt;/p&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2016-01-02T14:59:19.590" LastActivityDate="2016-01-02T14:59:19.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28050" PostTypeId="2" ParentId="28044" CreationDate="2016-01-02T15:08:50.397" Score="1" Body="&lt;p&gt;The plot is correct. You have to remember that with the DFT the time domain is also periodic, so the left side of the plot represents time $t=0$ and the far right side represents time $t&amp;lt;0$. If you use fftshift the plot will look as you'd expect except that the middle of your plot will reresent time $t=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saw the edits you made to your code - I think you be skipping the first fftshift. I always use fftshift - I can't recall the difference between fftshift and ifftshift. See example below. Actually I think there is an error in your new code - it should be ifft rather than ifftshift.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NFFT = 4301;&#xA;AvIFFT  = ifft(FFTavg.dat,NFFT);   &#xA;plot(real(fftshift(AvIFFT)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2016-01-04T14:23:09.483" LastActivityDate="2016-01-04T14:23:09.483" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28051" PostTypeId="1" AcceptedAnswerId="28062" CreationDate="2016-01-02T17:58:27.893" Score="2" ViewCount="455" Body="&lt;p&gt;I'm currenty aiming to optimize my fast wavelet transform (FWT) algorithm for 2D signals (images). It works as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;one iteration of 1D FWT does convolution of 1D input data with a selected 1D filter (lengths from 2 to approx. 60) and downsamples the result&lt;/li&gt;&#xA;&lt;li&gt;algorithm for 2D transform does 1D FWT across all rows and then all columns of the input image&lt;/li&gt;&#xA;&lt;li&gt;it iterates if more levels are desired&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The transform is a part of interactive application that demonstrates wavelets and their use. It works fairly fast and usually responds in real time to user's interactions. But if the filter is very long some performance issues occur. I've read that using Fast Fourier Transorm (FFT) instead of convolution is effective for long enough filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already implemented the 1D FFT, but the question is how to use it for maximum efficiency? Should I transform the input data before single 1D FWT, then perform convolution (which corresponds to multiplication in frequency domain), and then transform the data back using inverse FFT? &lt;strike&gt;Also, how is the multiplication done exactly? For example, the input data of length 256 and filter of length 4 are both transformed using FFT and then only the first 4 values of input data are multiplied before transforming the data back?&lt;/strike&gt; I'm struggling a little bit on the details and would very much appreciate any insight into this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;I've figured out that in my case I'm after circular convolution, therefore the filter should be zero padded so that its length is the same as length of the input data. But my question about efficiency still holds. How should I use FFT for FWT computation in order to be beneficial?&lt;/p&gt;&#xA;" OwnerUserId="18932" LastEditorUserId="18932" LastEditDate="2016-01-03T21:52:47.950" LastActivityDate="2016-01-03T22:24:09.987" Title="Optimized 2D wavelet transform using FFT" Tags="|image-processing|fft|wavelet|optimization|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28053" PostTypeId="2" ParentId="26676" CreationDate="2016-01-03T05:44:29.993" Score="2" Body="&lt;p&gt;Theoretically, VQ is always better than scalar quantization (SQ). However, as you already mentioned, the complexity of VQ is higher than the complexity of SQ. It increases exponentially together with the dimensionality of vectors. Therefore, the question is how to design a practical coding system which can provide a best rate-distortion performance under a given complexity constraint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A designing of a codebook is another very important issue in VQ. The main practical concerns about using a codebook in VQ are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How to generate a universal codebook for a large number of images.&lt;/li&gt;&#xA;&lt;li&gt;How to scale the codebook for various rate-distortion requirements.&lt;/li&gt;&#xA;&lt;li&gt;How much storage space is reasonable for storing the codebook in memory.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All this practical constraints make it difficult for VQ to force through standardization process. &lt;/p&gt;&#xA;" OwnerUserId="10194" LastActivityDate="2016-01-03T05:44:29.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28054" PostTypeId="1" CreationDate="2016-01-03T06:54:12.147" Score="-1" ViewCount="224" Body="&lt;p&gt;I have designed an adaptive filter for noise cancellation. Is there any standard way of testing adaptive filters?&lt;/p&gt;&#xA;" OwnerUserId="18939" LastEditorUserId="39" LastEditDate="2016-01-04T22:41:02.960" LastActivityDate="2016-01-05T02:05:25.940" Title="Performance of adaptive filter" Tags="|filters|adaptive-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28055" PostTypeId="2" ParentId="26209" CreationDate="2016-01-03T07:59:18.017" Score="1" Body="&lt;p&gt;You can calculate the coherent or DC gain of a window with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;coherent_gain = sum(window)/n;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with a Hann window, and &lt;code&gt;n = 40&lt;/code&gt;, this comes to &lt;code&gt;0.4875&lt;/code&gt;, as hotpaw2 mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can therefore eliminate the effect of the coherent gain of the window on your spectral estimate by replacing &lt;code&gt;windowed_time_signal = time_signal.*window;&lt;/code&gt; with &lt;code&gt;windowed_time_signal = time_signal.*window/coherent_gain;&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your main priority is very accurate amplitude - and you're unconcerned with spectral leakage as Sebastian mentioned, then the &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function#Flat_top_window&quot; rel=&quot;nofollow&quot;&gt;flattop window&lt;/a&gt;&#xA;is the way to go. Here's the &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/flattopwin.html&quot; rel=&quot;nofollow&quot;&gt;matlab docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just replace &lt;code&gt;window = hann(n)';&lt;/code&gt; with &lt;code&gt;window = flattopwin(n)';&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you have the ability to collect more samples, that will likely improve the spectral estimate from your FFT (assuming the underlying process in your application is somewhat stationary/ergodic). You can also take FFTs of successive (possibly overlapping) slices and average them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, as hotpaw2 mentioned, selecting a sample rate depends very strongly on your application, and how many samples you intend to collect. That said, I've often used &lt;code&gt;fs = 2.56 * bw&lt;/code&gt;, with good results when it comes to spectral analysis or digital filtering.&lt;/p&gt;&#xA;" OwnerUserId="15786" LastEditorUserId="15786" LastEditDate="2016-01-03T08:22:56.437" LastActivityDate="2016-01-03T08:22:56.437" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28057" PostTypeId="1" CreationDate="2016-01-03T17:07:14.007" Score="1" ViewCount="707" Body="&lt;p&gt;i have a doubt about DFT filter banks. For example I have $M=4$ channels and a filter with cut-off frequency of $0.25$ right.&#xA;The prototype filter $H_0$ is a low-pass centered around $0$ ok. The second filter $H_1$ is centered around $0.5\pi$, the third around $\pi$ and the last $H_3$ (cyan colored) is centered around $3\pi/2$. My doubt is what do i do with $H_3$ such that the bandwidth is from $0$ to $\pi$ (0 20MHz)??? &lt;a href=&quot;https://i.stack.imgur.com/RwT7z.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RwT7z.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;S.&lt;/p&gt;&#xA;" OwnerUserId="18931" LastEditorUserId="1629" LastEditDate="2016-01-04T19:16:00.520" LastActivityDate="2017-06-28T12:43:00.763" Title="DFT Filter Banks" Tags="|fft|filters|sampling|ifft|filter-bank|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28058" PostTypeId="1" CreationDate="2016-01-03T19:59:17.270" Score="3" ViewCount="673" Body="&lt;p&gt;I'm tinkering in Matlab with a problem that's very similar to active noise cancellation.  In the literature, the secondary path is described as the transfer function from the output of the adaptive filter to the error input sensor.  The algorithm needs to model this path to obtain good results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is also the transfer function from the noise source to the adaptive filter.  The ADC will always have some transition band below the Nyquist rate.  When I simulate the ADC in Matlab, the adaptive filter tries to invert the ADC response as well as model the system I'm trying to cancel.  In fact, if the system is purely a delay, this is exactly the inverse system identification problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some applications, the ADC can be ignored because the signal may already be digital, but I don't think that is ever the case with ANC.  Why is this not mentioned as being a problem?  Is it because, in practice, the impulse response of the ADC is short compared to the system response?&lt;/p&gt;&#xA;" OwnerUserId="18941" LastActivityDate="2022-07-27T12:39:52.113" Title="Modeling ADC in Active Noise Cancellation" Tags="|adaptive-algorithms|analog-to-digital|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28059" PostTypeId="1" CreationDate="2016-01-03T20:02:56.363" Score="3" ViewCount="6688" Body="&lt;p&gt;While asking a &lt;a href=&quot;https://stackoverflow.com/questions/34526911/best-practices-for-analyzing-large-time-traces-with-high-sampling-frequency-m&quot;&gt;question about representing large time series in R&lt;/a&gt; I was discouraged from using R for digital signal processing. I understand that R is geared towards statistics. However, a signal is just a set of measurements. R also deals with time series, but they are usually at different time scales. Nevertheless, e.g. when predicting price evolution it is a matter of understanding the model behind it and possibly predicting it. That's quite close to what I usually want in physics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &quot;traditional&quot; digital signal processing (DSP), it is more common to analyze the signal in terms of its frequency components and their interplay or coherence (which is something like frequency dependent covariance of the amplitudes of frequency components) between signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in R mostly because of some packages on CRAN with advanced scientific routines (which aren't as developed in Python) like &lt;a href=&quot;https://cran.r-project.org/web/packages/signal/signal.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;signal for general DSP&lt;/a&gt;, &lt;a href=&quot;https://cran.r-project.org/web/packages/wavelets/wavelets.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;wavelets&lt;/a&gt; and &lt;a href=&quot;https://cran.r-project.org/web/packages/biwavelet/biwavelet.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;biwavelet&lt;/a&gt; for wavelet transforms and &lt;a href=&quot;https://cran.r-project.org/web/packages/timsac/timsac.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;timsac for bispectrum&lt;/a&gt;. These packages should make this more &quot;traditional&quot; approach possible. However, I get the feeling that time series are generally analyzed in a different way in R as is apparent from the &lt;a href=&quot;https://cran.r-project.org/web/views/TimeSeries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;time series task view on CRAN&lt;/a&gt;. Are these more statistical models perhaps unsuitable for analyzing non-stationary time series?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I ask whether there is something that makes R worse for DSP than e.g. Python+SciPy (which I currently use the most) or MATLAB. Is it perhaps some underlying implementation that makes operations slower? Or is it just that it would be necessary to change one's approach to analyzing signals to a more statistical one when using R? And would such an approach be perhaps limited in some way in comparison to the &quot;traditional&quot; DSP approach?&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Note:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I &lt;a href=&quot;https://stackoverflow.com/posts/34543844&quot;&gt;tried asking this question on SO&lt;/a&gt;, but I was directed to rather ask here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in objective answers with sources, not just opinions. E.g. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;which internal representations makes it slower&lt;/li&gt;&#xA;&lt;li&gt;what are the limitations of the statistical models used for time series analysis, e.g. how they cope with non-stationary signals, n-wave interaction, etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15679" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2016-04-11T01:33:46.327" Title="Is R suitable for digital signal processing" Tags="|filters|frequency-spectrum|wavelet|time-series|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28060" PostTypeId="2" ParentId="28057" CreationDate="2016-01-03T21:40:15.340" Score="3" Body="&lt;p&gt;It looks like you're doing everything correctly. For an $M$-channel DFT filter bank, the impulse response of the $m^{th}$ filter is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_m[n]=h_0[n]e^{j\frac{2\pi m}{M}},\qquad 0&amp;lt;m&amp;lt;M\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h_0[n]$ is the prototype filter. For $M=4$, $h_3[n]$ is indeed centered at $\omega=3\pi /2$. Note that due to the $2\pi$-periodicity of discrete-time Fourier transforms, this is equivalent to a center frequency of $\omega=-\pi/2$. So the right half of your plot just shows the negative frequencies, and if your input signal is real-valued, your actual bandwidth is indeed just $[0,\pi]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if the prototype filter $h_0[n]$ is real-valued, the filters $h_1[n]$ and $h_3[n]$ are just complex conjugates of each other:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_3[n]=h_0[n]e^{j3\pi/2}=h_0[n]e^{-j\pi/2}=h_1^*[n]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input signal is real-valued, the outputs of these two filters can be obtained from each other by complex conjugation. So in this case the filter $h_3[n]$ is redundant. This is the same as with a standard DFT of a real-valued signal, where (approximately) half the points are redundant due to symmetry. Nevertheless, depending on the implementation it is often cheaper to compute all output values, even the redundant ones.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-04T10:48:50.327" LastActivityDate="2016-01-04T10:48:50.327" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28062" PostTypeId="2" ParentId="28051" CreationDate="2016-01-03T22:24:09.987" Score="1" Body="&lt;p&gt;I'm still not convinced you are spending your time optimally. Probably you would get better gains doing other optimizations. Already 10-15 taps are considered very long wavelet filters for most applications that I have seen. But nevermind that I will try and answer your question.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You can do two different approaches&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You could do it one level at a time.&lt;/li&gt;&#xA;&lt;li&gt;Everything at once.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are drawbacks and gains from either of them. I will start with the first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you go for &lt;strong&gt;one level at a time&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You zero pad filters to be equal lenght as the rows and columns. Also make sure you pad so the filter gets in the middle.&lt;/li&gt;&#xA;&lt;li&gt;FFT the padded filters and corresponding image dimension. If width $\neq$ height you would need to do 2 FFTs per filter one of each dimension length.&lt;/li&gt;&#xA;&lt;li&gt;Pointwise multiplication of the FFTs of filter and image.&lt;/li&gt;&#xA;&lt;li&gt;Inverse FFT of the product image.&lt;/li&gt;&#xA;&lt;li&gt;Downsample product image in the dimension you transformed.&lt;/li&gt;&#xA;&lt;li&gt;Repeat for the next dimension.&lt;/li&gt;&#xA;&lt;li&gt;Repeat for all levels.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Notice that this approach will involve a set of iFFTs and FFTs at &lt;em&gt;each&lt;/em&gt; level. That would be double-bad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;everything-at-once&lt;/strong&gt; approach: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Same as above but instead of iFFT and decimating each level to just FFT back again on the decimated signal you just multiply several times with the filter and do iFFT and decimate 2,4,8 times et-cetera. Then you only need to do one set of FFTs (at the start) but still a full set of iFFTs for each level.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also the multiplications while in the Fourier domain will be more computationally expensive than ordinary multiplications as the fourier components will be $\in \mathbb{C}$ but filter and image coefficients $\in \mathbb{R}$ ( I guess ) and you would also likely need higher numerical precision to get the same error.&lt;/p&gt;&#xA;" OwnerUserId="18051" LastActivityDate="2016-01-03T22:24:09.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28063" PostTypeId="1" AcceptedAnswerId="28065" CreationDate="2016-01-03T22:33:51.347" Score="3" ViewCount="1272" Body="&lt;p&gt;I have come across a peculiarity of FFTs which has got me somewhat baffled.&#xA;I've simply summed up 101 sine waves and taken the FFT using this matlab script :  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all&#xA;f=1e9;                                 % Centre Frequency 1GHz&#xA;df=2.5e6;                                % Carrier Frequency 2.5MHz&#xA;Time=linspace(-100e-9,100e-9,1000);      % Region of time to simulate over&#xA;delay=0;&#xA;Voltage=Time.*0;                        % Initialise Voltages to zero &#xA;for loop=-50:50                         % Sum 101 carrier Frequencies&#xA;    Voltage=Voltage+sin(2.*pi().*(f+df.*loop).*(Time-delay));&#xA;end  &#xA;figure(1)                               %Plot Time dependent response&#xA;subplot(2,1,1)&#xA;plot(Time,Voltage)&#xA;subplot(2,1,2)                               %Plot Frequency Content &#xA;dt=Time(2)-Time(1);&#xA;frequency=linspace(-0.5/dt,0.5/dt,1000);&#xA;spectrum=fftshift(fft(Voltage));&#xA;plot(frequency,abs(spectrum))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is as I had expected, with the correct frequency content : &#xA;&lt;a href=&quot;https://i.stack.imgur.com/Th1fA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Th1fA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;However, if I simply add a significant time delay (by re-running the script with &lt;code&gt;delay=150e-9;&lt;/code&gt;, such that the main constructive interference lobe disappears outside the calculation window) the frequency content of the resulting time trace collapses to two peaks. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/HGLnt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HGLnt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;However the time trace is still the summation of 101 sin waves albeit now out of phase because of the introduced delay ?? Intuitively I would have expected the absolute frequency content of the trace to be preserved and only the phases modified by the delay. Upon reflection I can perhaps understand that the frequency content must be modified on energy conservation grounds, but can anybody rationalise what is going on here ?&lt;/p&gt;&#xA;" OwnerUserId="18940" LastEditorUserId="18940" LastEditDate="2016-01-03T23:23:05.417" LastActivityDate="2016-01-16T11:29:08.580" Title="FFT of SIN waves with different phase delays" Tags="|fft|signal-analysis|fourier-transform|fourier-series|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28065" PostTypeId="2" ParentId="28063" CreationDate="2016-01-04T00:54:24.610" Score="3" Body="&lt;p&gt;You aren't looking at the frequency content of your sum of sinewave.  You are looking at the frequency content of a rectangular window on your sinewaves, and the window (FFT length) is shorter than the least common multiple of all the sinewave periods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signals that are not orthogonal within a window can cancel each other out partially or completely within that window.  What has happened is that you've chosen a window of a length such that each sinewave can get nearly completely cancelled out by the next higher and lower frequency pair of sinusoids of the &quot;right&quot; phase.  The ones on the ends are the only ones that aren't sandwiched, and thus aren't cancelled.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-04T20:41:40.263" LastActivityDate="2016-01-04T20:41:40.263" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28066" PostTypeId="1" AcceptedAnswerId="28076" CreationDate="2016-01-04T08:49:16.890" Score="3" ViewCount="274" Body="&lt;p&gt;I've got this unusual spectrogram and I am really curious what these circles could mean. Has anyone ever seen anything like this? What could be the source of the signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9t3tg.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9t3tg.jpg&quot; alt=&quot;spectrogram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18731" LastActivityDate="2016-01-04T20:54:04.827" Title="Meaning of concentric circles on the spectrogram" Tags="|spectrogram|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28067" PostTypeId="2" ParentId="28066" CreationDate="2016-01-04T14:17:32.020" Score="2" Body="&lt;p&gt;I'm not able to comment yet but could it be some kind of FM Synthesis?&#xA;Like Olli Niemitalo wrote, it looks like Moiré pattern. I found a &lt;a href=&quot;https://freesound.org/people/metamorphmuses/sounds/39370/&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectrogram&lt;/a&gt; which looks a little bit similar:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eQ3Hj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eQ3Hj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10194" LastActivityDate="2016-01-04T14:17:32.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28070" PostTypeId="1" CreationDate="2016-01-04T18:50:12.153" Score="0" ViewCount="37" Body="&lt;p&gt;How does the n index for a window with $0 \le |n| \le N/2$ e.g the Bohman window function, get implemented when having a specific window size?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RCt15.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RCt15.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (n &amp;gt;= 0 &amp;amp;&amp;amp; n &amp;lt;= N/2) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;what happens with the passed in index e.g. 1000 of a 1024 window size ?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="80" LastEditDate="2016-01-04T19:11:46.327" LastActivityDate="2016-01-04T19:38:05.877" Title="Window functions and indexes larger than N/2" Tags="|window-functions|c|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28071" PostTypeId="2" ParentId="28070" CreationDate="2016-01-04T19:13:19.580" Score="1" Body="&lt;p&gt;The window is defined as $-N/2 \le n \le N/2$ i.e. symmetric about $n=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for a 1024 window size, $n=-512$ to $n=+511$ should give you the appropriate coefficients.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-04T19:13:19.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28073" PostTypeId="2" ParentId="28070" CreationDate="2016-01-04T19:38:05.877" Score="1" Body="&lt;p&gt;If you subtract N/2 from n in the equation, then your window will be centered at N/2, and n can range from 0 to N (e.g. larger than N/2).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-04T19:38:05.877" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28075" PostTypeId="2" ParentId="28059" CreationDate="2016-01-04T20:48:56.067" Score="5" Body="&lt;p&gt;Since the bulk of &lt;a href=&quot;http://blog.revolutionanalytics.com/2013/10/r-and-signal-processing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;R’s DSP capability&lt;/a&gt; comes from the signal package which was ported over from the open source project Octave (itself influenced by MATLAB), there's no intrinsic limitation of R.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have picked up on, are ecosystem preferences. We learned MATLAB in university, picked up &lt;a href=&quot;http://www.numpy.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;numpy&lt;/a&gt;/scipy/sklearn at work, so R isn't the first weapon of choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, there are some interesting &quot;bridge&quot; projects that you may be interested in exploring: &lt;a href=&quot;https://stackoverflow.com/questions/5630441/how-do-rpy2-pyrserve-and-pyper-compare&quot;&gt;https://stackoverflow.com/questions/5630441/how-do-rpy2-pyrserve-and-pyper-compare&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the excellent interactive python (&lt;a href=&quot;http://ipython.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;iPython&lt;/a&gt;) project, now called Jupyter, that recently introducing support for &lt;a href=&quot;http://irkernel.github.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;R notebooks&lt;/a&gt;: &lt;a href=&quot;https://www.continuum.io/blog/developer/jupyter-and-conda-r&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.continuum.io/blog/developer/jupyter-and-conda-r&lt;/a&gt;. So tools &amp;amp; their inter-operability are converging!&lt;/p&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-01-04T20:48:56.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28076" PostTypeId="2" ParentId="28066" CreationDate="2016-01-04T20:54:04.827" Score="3" Body="&lt;p&gt;In Understanding &lt;a href=&quot;http://materias.fi.uba.ar/6644/info/anespec/avanzado/real%20time/understanding%20FFT%20Overlap%20Processing.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;FFT Overlap Processing&lt;/a&gt;, p. 10, it is suggested that uniform of constant windows, for certain hop patterns, with repeated pulses, could generate such artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vZLHj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vZLHj.png&quot; alt=&quot;Spectrogram with Moiré&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-04T20:54:04.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28077" PostTypeId="2" ParentId="28054" CreationDate="2016-01-04T22:26:16.173" Score="1" Body="&lt;p&gt;It is usually evaluated using the Mean Square Error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ e(n) = \frac{\displaystyle\sum_{i=1}^{N}(d_{i}(n) - y_{i}(n))^2}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ d(n) $ are the values of the samples used to train your filter, and $ y(n) $ are the samples of the filter output. So, you train your filter a number of times $ N $, so as to, for each iteration $ n $ of the training, you have $ N $ values. Than you just compute the equation above, the mean of the $ i $ realizations of training, and plot the error $ e $ by the iteration $ n $.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="17125" LastEditDate="2016-01-05T02:05:25.940" LastActivityDate="2016-01-05T02:05:25.940" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28079" PostTypeId="2" ParentId="26676" CreationDate="2016-01-05T01:22:32.560" Score="1" Body="&lt;p&gt;&lt;em&gt;Sparse dictionaries&lt;/em&gt;, &lt;em&gt;dictionary learning&lt;/em&gt; or &lt;em&gt;dictionary coding&lt;/em&gt; has been popular (and also shown to be quite high-performing) for noise reduction (denoising) and it is basically a kind of vector quantizer. Building the code-book (dictionary) takes time and I don't know exactly how large it typically becomes for denoising applications, but if it is calculated off-line once-and-for-all and was known to both coder and decoder then it would not need to be sent as part of the video stream and then codebook size would not impact stream size or bit rate. If codebook is too large then decoding on RAM-constrainted devices would maybe be infeasible. Also if too large we could start getting cache misses which could impact performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also almost all of todays high performing video coders are hybrid coders combining transform coding and motion coding. One would probably need to find a good way to combine the vector quantization with hybrid coding concept. It is not obvious to me how to do that. Should the VQ only be used for I frame image coding or also in some way to code the motion fields?&lt;/p&gt;&#xA;" OwnerUserId="18051" LastActivityDate="2016-01-05T01:22:32.560" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28080" PostTypeId="2" ParentId="27877" CreationDate="2016-01-05T01:29:33.803" Score="5" Body="&lt;p&gt;They may be referring to &lt;a href=&quot;https://docs.google.com/viewer?url=patentimages.storage.googleapis.com/pdfs/US3800088.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;patent US3800088&lt;/a&gt; by Harald Bode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a bunch of images from 15 years ago to explain a way to do frequency shifting so that it has the best chance of sounding good. I would call it single-sideband frequency shifting. Here the range of possible frequencies in the signal are drawn as two arrows each spanning half the circumference of the z-plane unit circle:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4u5pX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4u5pX.png&quot; alt=&quot;Fig. 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;T is integer and represents time. The frequency shift $-\frac{\pi}{4}$ is an example. Modulation here is by a complex exponential (the signal is multiplied by the complex exponential).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting signal is complex, but we want a real signal, which we get by throwing away the imaginary part. This creates negative frequencies (green) that are mirror images of the positive frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jmnAu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jmnAu.png&quot; alt=&quot;Fig. 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's pretty ugly as some frequencies got shifted so that they alias and thus have a positive frequency shift. Also the spectrum of what we want got mixed with wrong-way-going frequencies (reversed spectrum). We can fix these problems using the following procedure: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PKwhr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PKwhr.png&quot; alt=&quot;Fig. 3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We filter away negative frequencies with a filter that has a do-nothing real part and a Hilbert transformer as the imaginary part. Then we modulate with a complex exponential and use another positive frequency pass filter to remove anything that might alias. Finally, discarding the imaginary component creates a nice-looking signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I excluded details about gain, but it suffices to know that if at the end the gain is wrong, the output needs to be multiplied by some factor $2^N$, $N$ integer.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-01-05T14:27:45.287" LastActivityDate="2016-01-05T14:27:45.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28084" PostTypeId="1" AcceptedAnswerId="28102" CreationDate="2016-01-05T03:12:34.953" Score="7" ViewCount="36653" Body="&lt;p&gt;This year I'm having trouble with my Signals and Systems class. My major subject is Software Engineering and Electric and Electrical Engineering is my Minor. This question was my previous exam question but I coudn't write anything about it as a solution. If somebody could at least show a way to solve this problem it would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;Question:&lt;/b&gt;&lt;br&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d^2y(t)}{dt^2}+\frac{6dy(t)}{d(t)}+8y(t)=2x(t)$$&lt;/span&gt;&#xA;a) Find impulse response &lt;span class=&quot;math-container&quot;&gt;$h(t)$&lt;/span&gt; &lt;br&gt;&#xA;b) Find output &lt;span class=&quot;math-container&quot;&gt;$y(t)$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x(t)=te^{-2t}u(t)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that &lt;span class=&quot;math-container&quot;&gt;$h(t) = \frac {y(t)}{x(t)}$&lt;/span&gt;, and i m guessing that i can get that using z-transform but I don't know how to and if it is the correct way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;EDIT: &lt;/b&gt;&lt;br&gt;&#xA;Here is what I have done so far.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bqs7S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bqs7S.png&quot; alt=&quot;Photo of my Work Done&quot;&gt;&lt;/a&gt;&#xA;&lt;br&gt;&lt;br&gt;&#xA;From here, to find the output I think I will use convolution.? y(t) = h(t)*x(t)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used Laplace transform to find the inverse fourier transform of the function H(jw). What was I going to do if Laplace transform would not be suitable to situation?&lt;/p&gt;&#xA;" OwnerUserId="18955" LastEditorUserId="31371" LastEditDate="2020-01-26T23:57:07.633" LastActivityDate="2020-01-26T23:57:07.633" Title="How to obtain impulse response from the differential equation of a system?" Tags="|linear-systems|impulse-response|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="28085" PostTypeId="1" AcceptedAnswerId="28088" CreationDate="2016-01-05T03:53:53.703" Score="1" ViewCount="5040" Body="&lt;p&gt;I saw many solved examples about this topic but again I coudn't come up with any solutions about this question. How can I find the Fourier Series coefficients of the following signal ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t)=2 \cos(3\pi t) + \sin(100\pi t+\frac{\pi }{3})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that;&lt;br&gt; $\cos(θ)=\frac12 (e^{jθ} + e^{−jθ})$  and,&lt;br&gt;&#xA;$\sin(θ)=\frac{1}{2j} (e^{jθ} - e^{−jθ})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also know that I should use&#xA;$$x(t) = \sum_{-\infty}^{\infty} a_{k} e^{jk(2\pi/T)t}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm having trouble to define the fundamental period $T$ and the relation between sinusoidal terms and coefficients $a_k$, to sum all things together. Thanks to everyone...&lt;/p&gt;&#xA;" OwnerUserId="18958" LastEditorUserId="15892" LastEditDate="2016-01-05T14:37:48.573" LastActivityDate="2016-01-06T14:42:29.903" Title="How to find Fourier Series Coefficients" Tags="|homework|fourier-series|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28086" PostTypeId="2" ParentId="11390" CreationDate="2016-01-05T06:52:37.007" Score="0" Body="&lt;p&gt;Better idea would be to use LP(Linear Prediction) residual for determining the presence of overlap speech.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrum might give confusing results, but LP residual has peaks at Glottal Closure Instance(GCI's) and every speaker have different/unique GCI period. So, if peaks in LP residual are at uniform interval it means only single speaker is present, and if there is non-uniformity in LP residual peaks it means the speech is overlapped. &lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-01-05T06:52:37.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28087" PostTypeId="1" AcceptedAnswerId="28089" CreationDate="2016-01-05T11:41:13.220" Score="0" ViewCount="260" Body="&lt;p&gt;I'm slightly confused about baseband pulse shaping.&#xA;Let's assume I have a complex data vector in an arbitrary complex constellation (QAM for example). I would like to pass this complex vector through a pulse shaping filter (RRC or RC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know RC/RRC filters have a real impulse response, thus I can generate a sampled version of the filter.&#xA;Am I correct to assume the filter is real ? Do I have to represent the filter as an analytic function (ie: $h_{RC}(t)=h_{RC}+j\hat{h}_{RC}$ ) before convolving my vector with it ?&lt;/p&gt;&#xA;" OwnerUserId="11323" LastActivityDate="2016-01-05T11:56:59.930" Title="Pulse shaping and Baseband filtering" Tags="|filtering|hilbert-transform|analytic-signal|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28088" PostTypeId="2" ParentId="28085" CreationDate="2016-01-05T11:48:10.253" Score="0" Body="&lt;p&gt;First, recognise that the fundamental period of the signal x(t) (sum of two sinusoidals with periods 2/3 s and 1/50 s) is 2s. And the fundamental frequency, $f_0$, is 0.5 hz.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then considering the CT Fourier Series expansion of the periodic signal x(t) wrt its fundamental frequency $f_0$ given as $\sum_{-\infty}^{\infty}{a_k e^{jk2\pi f_0t}}$ you can  therefore find the coefficients corresponding to $2\cos(3\pi t)$ and $\sin(100\pi t + \pi/3)$ with k=3 and k=100 respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, by expressing the sinusoidals in terms of complex exponentials using the Euler's identity this becomes $a_3=1 ,~ a_{-3}= 1 , ~~a_{100} = e^{j\pi/3}/2j, ~~a_{-100} = -e^{-j\pi/3}/2j $  which can be further manipulated if you want a rectengular representation of the complex coefficient instead of the above mixed-polar one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming no errors made during the arithmetic.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-01-05T12:47:56.373" LastActivityDate="2016-01-05T12:47:56.373" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28089" PostTypeId="2" ParentId="28087" CreationDate="2016-01-05T11:56:59.930" Score="2" Body="&lt;p&gt;Your complex baseband signal before modulation is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=\sum_{m=-\infty}^{\infty}a_mh(t-mT)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a_m$ are the complex symbols, $h(t)$ is the impulse response of the transmit filter, and $T$ is the symbol period. As you correctly assumed, $h(t)$ is usually real-valued, so you need to filter the real and imaginary parts of your symbols with the same filter $h(t)$ to get the complex baseband signal $(1)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t)=\sum_{m=-\infty}^{\infty}\text{Re}\{a_m\}h(t-mT)+j\sum_{m=-\infty}^{\infty}\text{Im}\{a_m\}h(t-mT)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no need to modify the real-valued impulse response $h(t)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-05T11:56:59.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28090" PostTypeId="1" AcceptedAnswerId="28091" CreationDate="2016-01-05T12:28:44.717" Score="1" ViewCount="411" Body="&lt;p&gt;I came across the FWGN model for multipath channel simulation in the book: &quot;MIMO-OFDM Wireless Comuunications with MATLAB&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an explanation about Clarke/Gans model:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/gsaYe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gsaYe.png&quot; alt=&quot;Book&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some code to generate a Chanel using this model is also in the book:&#xA;here is some of it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [h,Nfft,Nifft,doppler_coeff]=FWGN_model(fm,fs,N)&#xA;% FWGN (Clarke/Gan) Model&#xA;% Input: fm= Maximum Doppler frquency&#xA;% fs= Sampling frequency, N = Number of samples&#xA;% Output: h = Complex fading channel&#xA;Nfft = 2^max(3,nextpow2(2*fm/fs*N)); % Nfft=2^n&#xA;Nifft = ceil(Nfft*fs/(2*fm));&#xA;% Generate the independent complex Gaussian random process&#xA;GI = randn(1,Nfft); GQ = randn(1,Nfft);&#xA;% Take FFT of real signal in order to make hermitian symmetric&#xA;CGI = fft(GI); CGQ = fft(GQ);&#xA;% Nfft sample Doppler spectrum generation&#xA;doppler_coeff = Doppler_spectrum(fm,Nfft);&#xA;% Do the filtering of the Gaussian random variables here&#xA;f_CGI = CGI.*sqrt(doppler_coeff); f_CGQ = CGQ.*sqrt(doppler_coeff);  % &amp;lt;--- Why sqrt ?&#xA;% Adjust sample size to take IFFT by (Nifft-Nfft) sample zero-padding&#xA;Filtered_CGI=[f_CGI(1:Nfft/2) zeros(1,Nifft-Nfft) f_CGI(Nfft/2+1:Nfft)];&#xA;Filtered_CGQ=[f_CGQ(1:Nfft/2) zeros(1,Nifft-Nfft) f_CGQ(Nfft/2+1:Nfft)];&#xA;hI = ifft(Filtered_CGI); hQ= ifft(Filtered_CGQ);&#xA;% Take the magnitude squared of the I and Q components and add them&#xA;rayEnvelope = sqrt(abs(hI).^2 + abs(hQ).^2);&#xA;% Compute the root mean squared value and normalize the envelope&#xA;rayRMS = sqrt(mean(rayEnvelope(1:N).*rayEnvelope(1:N)));&#xA;h = complex(real(hI(1:N)),-real(hQ(1:N)))/rayRMS;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have noticed that this implementation multiplies the noise with a square root of the filter response in the frequency domain, why did the writer use the square root of the doppler spectrum ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar representation is also present &lt;a href=&quot;http://www.ni.com/white-paper/14913/en/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;Another thing, the text doesn't mention the $-\pi/2$ phase shift nor does it implement it in the code. Why is that ?&#xA;Is that just multiplication by -j ? If so, why negative ?&lt;/p&gt;&#xA;" OwnerUserId="11323" LastEditorUserId="11323" LastEditDate="2016-01-05T13:56:43.680" LastActivityDate="2016-01-05T13:56:43.680" Title="FWGN model implementation vs explaination (textbook pages attached)" Tags="|digital-communications|fading-channel|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28091" PostTypeId="2" ParentId="28090" CreationDate="2016-01-05T12:48:18.377" Score="1" Body="&lt;p&gt;I assume that the function &lt;code&gt;Doppler_spectrum&lt;/code&gt; computes the desired &lt;em&gt;power spectrum&lt;/em&gt; of the noise. Since the power spectrum of a filtered noise process gets multiplied with the squared magnitude of the filter's frequency response, the filter's frequency response needs to be square root of the desired power spectrum (assuming white noise at the filter's input).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In formulas, if a random process $X(t)$ with power spectrum $S_X(\omega)$ is filtered by an LTI system with frequency response $H(\omega)$, the power spectrum $S_Y(\omega)$ of the output signal $Y(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_Y(\omega)=S_X(\omega)|H(\omega)|^2$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-05T12:48:18.377" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28092" PostTypeId="2" ParentId="28085" CreationDate="2016-01-05T12:53:32.350" Score="0" Body="&lt;p&gt;Just wanted to add that one way to find the fundamental frequency is to calculate the greatest common divisor (gcd). In this case we have $\gcd(3,100) = 1$, as $100 = 2^2\cdot 5^2$ and $3$ don't share any prime factors.&lt;/p&gt;&#xA;" OwnerUserId="18051" LastEditorUserId="18051" LastEditDate="2016-01-05T13:06:50.210" LastActivityDate="2016-01-05T13:06:50.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28093" PostTypeId="2" ParentId="28058" CreationDate="2016-01-05T13:15:36.723" Score="0" Body="&lt;p&gt;I am also working on ANC, with my understanding may be I could provide some clarity for you.&lt;/p&gt;&#xA;&lt;p&gt;I could not see your point exactly on ADC modeling, but as far as I know this ADC transfer function will be covered in secondary path modeling.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;However, there is also the transfer function from the noise source to&#xA;the adaptive filter.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Do you mean modeling of the reference input microphone, as far as I can see only transfer function involved between noise source to adaptive filter is reference input microphone function.&lt;/p&gt;&#xA;&lt;p&gt;The way you are using secondary path description is also a bit confusing to me.&lt;/p&gt;&#xA;&lt;p&gt;But here is what I know from &lt;a href=&quot;https://ieeexplore.ieee.org/document/763310&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper page 945&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xANCn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xANCn.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here P(z) is the unknown primary acoustic path between reference input sensor and error sensor.&lt;/p&gt;&#xA;&lt;p&gt;Below text directly quoted from the reference provided&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Summing junction represents the acoustical superposition in the space from cancelling loudspeaker to error microphone, where the primary&#xA;noise is combined with the output of the adaptive filter.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, it is necessary to compensate for the secondary-path&#xA;transfer function from y(n) to e(n) which includes the digital-to-analog (D/A)&#xA;converter, reconstruction filter, power amplifier, loudspeaker,&#xA;acoustic path from loudspeaker to error microphone, error microphone,&#xA;pre-amplifier, anti-aliasing filter, and analog-to digital (A/D)&#xA;converter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The compensation as you might have already known is done by offline or online modeling techniques.&lt;/p&gt;&#xA;&lt;p&gt;If you want to include your primary path modeling as well i.e reference microphone TF, you can do that or if you are considering feedback effect, then again in the feedback compensation this reference microphone transfer function is included.&lt;/p&gt;&#xA;&lt;p&gt;Please correct me if I am wrong.&lt;br /&gt;&#xA;Thanks for bringing this up!&lt;/p&gt;&#xA;" OwnerUserId="17708" LastEditorUserId="7092" LastEditDate="2022-07-27T12:39:52.113" LastActivityDate="2022-07-27T12:39:52.113" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28094" PostTypeId="2" ParentId="27817" CreationDate="2016-01-05T15:20:22.650" Score="3" Body="&lt;p&gt;&lt;strong&gt;HINT&lt;/strong&gt; If we have the diagonal matrix: $$ D = \left[\begin{array}{cccc}&#xA;d_1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;d_2&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;\ddots&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;d_n&#xA;\end{array}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplying another matrix $$M_r = \left[\begin{array}{c}&#xA;r_1\\&#xA;r_2\\&#xA;\vdots\\&#xA;r_n&#xA;\end{array}\right]$$to the left with it multiplies each row like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$DM_r = \left[\begin{array}{c}&#xA;d_1r_1\\&#xA;d_2r_2\\&#xA;\vdots\\&#xA;d_nr_n&#xA;\end{array}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the matrix has the columns $$M_c = \left[\begin{array}{cccc}&#xA;c_1&amp;amp;&#xA;c_2&amp;amp;&#xA;\dots&amp;amp;&#xA;c_n&#xA;\end{array}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then multiplying from the right with D will give:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M_cD = \left[\begin{array}{cccc}d_1c_1&amp;amp;d_2c_2&amp;amp;\dots&amp;amp;d_nc_n&#xA;\end{array}\right]$$&lt;/p&gt;&#xA;" OwnerUserId="18051" LastActivityDate="2016-01-05T15:20:22.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28095" PostTypeId="1" CreationDate="2016-01-05T17:09:32.617" Score="1" ViewCount="1232" Body="&lt;p&gt;I have position of objects from recording sampled at 30 fps. I wish to remove high frequencies from position with the help of low-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused as to how to choose the filter parameters in this respect-&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = butter(n,Wn) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;that is , &lt;code&gt;n&lt;/code&gt; and &lt;code&gt;Wn&lt;/code&gt; in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;K&amp;gt;&amp;gt; [xcor_i,ycor_i ]&#xA;&#xA;ans =&#xA;&#xA; -101.7000  -77.4040&#xA; -102.4200  -77.4040&#xA; -103.6600  -77.4040&#xA; -103.9300  -76.6720&#xA; -103.9900  -76.5130&#xA; -104.0000  -76.4780&#xA; -105.0800  -76.4710&#xA; -106.0400  -77.5660&#xA; -106.2500  -77.8050&#xA; -106.2900  -77.8570&#xA; -106.3000  -77.8680&#xA; -106.3000  -77.8710&#xA; -107.7500  -78.9680&#xA; -108.0600  -79.2070&#xA; -108.1200  -79.2590&#xA; -109.9500  -80.3680&#xA; -111.4200  -80.6090&#xA; -112.8200  -81.7590&#xA; -113.8500  -82.3750&#xA; -115.1500  -83.2410&#xA; -116.1500  -83.4290&#xA; -116.3700  -83.8360&#xA; -117.5000  -84.2910&#xA; -117.7400  -84.3890&#xA; -118.8800  -84.7770&#xA; -119.8400  -85.2270&#xA; -121.1400  -85.3250&#xA; -123.2200  -84.9800&#xA; -125.4700  -85.2710&#xA; -127.0400  -85.7000&#xA; -128.8200  -85.7930&#xA; -130.6500  -85.8130&#xA; -132.4900  -85.8180&#xA; -134.3300  -86.5500&#xA; -136.1700  -87.0760&#xA; -137.6500  -86.0920&#xA; -138.6900  -86.9760&#xA; -140.3600  -87.9000&#xA; -142.1600  -88.4660&#xA; -144.7200  -89.3210&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a] = butter(6,0.6,'low');&#xA;dataOut_x = filter(b,a,xcor_i);&#xA;dataOut_y = filter(b,a,ycor_i);&#xA;&#xA;K&amp;gt;&amp;gt; plot(xcor_i,ycor_i,'Linewidth',2 );&#xA;K&amp;gt;&amp;gt; hold on&#xA;K&amp;gt;&amp;gt; plot(dataOut_x,dataOut_y,'Linewidth',2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f0WRF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f0WRF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, my parameters aren't correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moe info:&#xA;I have tried a simple moving average, doesn't work that well. I am recording people from an overheard camera. I have tracks of each's head using some software. I want to periodicity from tracks due to head wobbling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link to same question on stackoverflow: &#xA;&lt;a href=&quot;https://stackoverflow.com/questions/34616131/choosing-low-pass-filter-parameters?noredirect=1#comment56979276_34616131&quot;&gt;https://stackoverflow.com/questions/34616131/choosing-low-pass-filter-parameters?noredirect=1#comment56979276_34616131&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18962" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-01-05T18:29:20.880" Title="Choosing low-pass filter parameters" Tags="|matlab|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28096" PostTypeId="2" ParentId="28095" CreationDate="2016-01-05T18:29:20.880" Score="2" Body="&lt;p&gt;The main issue is that the filters start with an initial position of &lt;code&gt;(0,0)&lt;/code&gt;. Then when you filter your actual data, the filter output has to ramp up to the actual position. In doing so, you can also observe some overshoot since your filter has a very short time response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would help if you were to start with a better estimate of the initial position by using for example the first position with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dataOut_x = xcor_i(1)+filter(b,a,xcor_i-xcor_i(1));&#xA;dataOut_y = ycor_i(1)+filter(b,a,ycor_i-ycor_i(1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting plot would then look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/C4HBj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/C4HBj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2016-01-05T18:29:20.880" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="28097" PostTypeId="1" AcceptedAnswerId="28098" CreationDate="2016-01-05T18:39:14.117" Score="-1" ViewCount="126" Body="&lt;p&gt;Alpha is used in many window functions e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cYFAi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cYFAi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the range that alpha can take and is it the same across all uses of alpha in the equations? e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sNyiD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sNyiD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will any alpha still result in a stable result, e.g. between 0 and 1&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2016-01-05T19:00:34.637" LastActivityDate="2016-01-05T19:38:11.407" Title="What is the range for alpha in window equations" Tags="|window-functions|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28098" PostTypeId="2" ParentId="28097" CreationDate="2016-01-05T19:38:11.407" Score="1" Body="&lt;p&gt;Since the window is of limited support, and the denominator can not vanish for any real $\alpha$, it yields a potentially valid window (finite area, finite power). Since is does not vanish on the interval, it can be inverted. It interpolates between a constant or uniform for $\alpha = 0$ and a discrete Dirac-like (or better Kronecker) window (for $\alpha = \pm \infty$). The $\alpha$ parameter drives the weights applied to the samples away from  the central sample. It  can be estimated from your sample-to-sample stationnary, or the resolution property you aim at. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QcyOI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QcyOI.png&quot; alt=&quot;Family of Poisson windows&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-05T19:38:11.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28099" PostTypeId="1" CreationDate="2016-01-05T21:11:44.207" Score="1" ViewCount="1478" Body="&lt;p&gt;i would a confirm of this: with polyphase structure is possible only design a filter bank with a INTEGER oversampling ratio? For non-integer i've seen the weighted overlap-add metod, is right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&#xA;S.&lt;/p&gt;&#xA;" OwnerUserId="18931" LastActivityDate="2016-01-06T21:40:24.223" Title="Oversampled polyphase filter banks" Tags="|filters|sampling|dft|filter-bank|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28100" PostTypeId="1" AcceptedAnswerId="28101" CreationDate="2016-01-05T21:11:50.373" Score="7" ViewCount="33720" Body="&lt;p&gt;I know that  &lt;span class=&quot;math-container&quot;&gt;$$X_L(s) \Big|_{s=j\omega}=X_F(\omega)$$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is one sided and absolutely integrable and hence the imaginary axis of the Laplace transform is the Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;But Fourier transform also has imaginary and real parts. So how could this be right?&lt;/p&gt;&#xA;" OwnerUserId="17597" LastEditorUserId="4346" LastEditDate="2023-01-18T23:15:42.033" LastActivityDate="2023-01-18T23:15:42.033" Title="Relation between Laplace and Fourier transforms" Tags="|fourier-transform|laplace-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28101" PostTypeId="2" ParentId="28100" CreationDate="2016-01-05T21:52:36.620" Score="8" Body="&lt;p&gt;The Laplace transform evaluated at $s=j\omega$ is equal to the Fourier transform if its region of convergence (ROC) contains the imaginary axis. This is also true for the bilateral (two-sided) Laplace transform, so the function need not be one-sided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for real and imaginary parts, since $s$ is a &lt;em&gt;complex&lt;/em&gt; variable, both the Laplace and the Fourier transform generally have real and imaginary parts. Take as a simple example the function $x(t)=e^{-at}u(t)$, with $a&amp;gt;0$, where $u(t)$ is the unit step function. The Laplace transform is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_L(s)=\frac{1}{s+a}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $a&amp;gt;0$, the ROC of $X_L(s)$ contains the imaginary axis, and the Fourier transform of $x(t)$ is simply obtained by evaluating $X_L(s)$ on the imaginary axis $s=j\omega$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_F(\omega)=X_L(j\omega)=\frac{1}{j\omega+a}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $s=\sigma+j\omega$ is generally complex, not only the Fourier transform but also the Laplace transform $(1)$ has a real and an imaginary part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_L(\sigma+j\omega)=\frac{1}{\sigma+j\omega+a}=\frac{\sigma+a}{(\sigma+a)^2+\omega^2}-j\frac{\omega}{(\sigma+a)^2+\omega^2}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only when evaluated on the real axis $s=\sigma$ ($\omega=0$) does the imaginary part vanish.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-05T21:52:36.620" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28102" PostTypeId="2" ParentId="28084" CreationDate="2016-01-05T22:09:22.187" Score="7" Body="&lt;p&gt;It looks like your transfer function is correct, but there's a small mistake in your partial fraction expansion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s)=\frac{2}{(s+4)(s+2)}=\frac{1}{s+2}-\frac{1}{s+4}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding impulse response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t)=(e^{-2t}-e^{-4t})u(t)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response to $x(t)=te^{-2t}u(t)$ is indeed most easily computed by solving the convolution integral:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=u(t)\int_0^tx(\tau)h(t-\tau)d\tau\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I leave the exercise of solving $(3)$ up to you, but if I'm not mistaken the result should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=\frac{1}{4}e^{-2t}\left[2t^2-2t+1-e^{-2t}\right]u(t)\tag{4}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-05T22:09:22.187" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28103" PostTypeId="2" ParentId="28099" CreationDate="2016-01-05T22:16:06.170" Score="2" Body="&lt;p&gt;If you have a 1D uniform $M$-channel &lt;a href=&quot;https://en.wikipedia.org/wiki/Filter_bank#Multirate_Filter_Bank&quot; rel=&quot;nofollow&quot;&gt;multirate filter bank (FB)&lt;/a&gt;, and $N$ is the decimation ($M \ge N$),  &lt;a href=&quot;http://image.unb.br/queiroz/papers/icassp01rvb.pdf&quot; rel=&quot;nofollow&quot;&gt;rational oversampling ratios&lt;/a&gt;  ($M/N$) are indeed possible (see Fig. 2), or from Figure 1 in &lt;a href=&quot;http://arxiv.org/pdf/0907.3654.pdf&quot; rel=&quot;nofollow&quot;&gt;Optimization of Synthesis Oversampled Complex Filter Banks&lt;/a&gt;, J. Gautier &lt;em&gt;et al.&lt;/em&gt;, IEEE Trans. Signal Processing, 2009 (&lt;a href=&quot;http://dx.doi.org/10.1109/TSP.2009.2023947&quot; rel=&quot;nofollow&quot;&gt;doi&lt;/a&gt;), which provides optimized synthesis FB with any ratio (like $7/4$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely: for an analysis filter bank, you can choose any decimation you want. But you may loose information, and the invertibility of the analysis/synthesis system. In a  lot of practical applications (for instance in speech processing), integer oversampling ratios are quite common, by choosing $N = M/k$, for instance $k=M/2$ or $k=M/4$. Such choices make the  computations and some calculations much simpler: for instance, an inverse synthesis filter bank may take a closed form, related to the  analysis window for DFT FBs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However with redundancy, there are an infinity of inverses, and polyphase formulations help finding synthesis FBs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A set of useful books (to me):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.elsevier.com/books/subband-compression-of-images-principles-and-examples/ramstad/978-0-444-89431-1&quot; rel=&quot;nofollow&quot;&gt;Subband compression of images: principles and examples&lt;/a&gt;, T. Ramstad et al., 1995&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://waveletsandsubbandcoding.org/Repository/VetterliKovacevic95_Manuscript.pdf&quot; rel=&quot;nofollow&quot;&gt;Wavelets and Subband Coding&lt;/a&gt;, M. Vetterli et al., 1995&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www-math.mit.edu/~gs/books/wfb.html&quot; rel=&quot;nofollow&quot;&gt;Wavelets and filte banks&lt;/a&gt;, G. Strang et al., 1996&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-01-06T21:40:24.223" LastActivityDate="2016-01-06T21:40:24.223" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28104" PostTypeId="1" AcceptedAnswerId="28105" CreationDate="2016-01-05T23:55:28.203" Score="0" ViewCount="255" Body="&lt;p&gt;I have a question about the hessian matrix / determinant of the hessian matrix. For the Hessian matrix, one is able to determine the local curvature around a point. And with the Second partial derivative test one can test, using the determinant of the hessian, if that point is located on an extrema, or saddle point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Second_partial_derivative_test&quot; rel=&quot;nofollow&quot;&gt;Wikipedia states&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the Hessian approximates the function at a critical point with a&#xA;  second degree polynomial.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;By 'hessian' does this mean that the hessian matrix approximates the function or the determinant? (i am confused as determinant of hessian and hessian matrix are sometimes used intertwined)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thank you in advance&lt;/p&gt;&#xA;" OwnerUserId="17789" LastEditorUserId="1629" LastEditDate="2016-01-06T14:36:44.857" LastActivityDate="2016-01-06T14:36:44.857" Title="Hessian Matrix. Second partial derivative test" Tags="|discrete-signals|signal-analysis|matrix|sift|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28105" PostTypeId="2" ParentId="28104" CreationDate="2016-01-06T00:17:43.260" Score="1" Body="&lt;p&gt;The function is fully approximated if one uses all the derivatives (see Taylor expansion). With using the Hessian only, we can only make a second degree approximation (because it is second derivative matrix), which is geometrically the same as using the second order polynomial.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2016-01-06T00:17:43.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28106" PostTypeId="2" ParentId="28084" CreationDate="2016-01-06T00:37:44.820" Score="5" Body="&lt;p&gt;Let me provide a method, for part a, applied only for finding the impulse response $h(t)$ of an LTI system characterised by an LCCDE of the form $ \sum_{k=0}^{N}{ a_k  {{d^k y(t)}\over {dt^k}}} = \sum_{k=0}^{M}{ b_k  {{d^k x(t)}\over {dt^k}}}$ by using the classical time domain approach. A method which is generally ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the input $x(t) = \delta(t)$ is formally a problematic signal (function) and therefore mathematically oriented classical books on ODEs, do generally avoid any discussion of such functions and their solutions, unless the scope of the book specifically includes generalised functions (distributions), usually to be used in some engineering or physical fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The procedure: Consider an LTI system which is causal with initial rest conditions. We say that when the input to this system is $x(t)=\delta(t)$ an impulse, then its output $y(t)=h(t)$ is the impulse-response of the system. We find this solution $h(t)$ in two steps, by breaking the LCCDE into two parts as inspired by a serial (cascade) implementation of two LTI systems corresponding to the right and left sides of the LCCDE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I/O relationship of Part-I is given by the LCCDE: $$\sum_{k=0}^{N}{ a_k  {{d^k y(t)}\over {dt^k}}} = x(t)$$ which represents the first stage with its input $x(t)=\delta(t)$ and we denote its solution (stage1-output) as $h_0(t)$ which is actually the impulse response of Part-I.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the I/O relationship of the Part-II is given by the equation: $$ y(t) = \sum_{k=0}^{M}{b_k{{d^k x(t)}\over {dt^k}}} $$ which requires nothing but simple summation of its input, $x(t) = h_0(t)$ ,and its derivatives to compute the output as $$h(t) = \sum_{k=0}^{M}{b_k {{d^k h_0(t)}\over {dt^k}}}$$ Therefore we need to find $h_0(t)$ of the Part-I to simply compute the impulse response $h(t)$ of the complete system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the solution of part-I: $\sum_{k=0}^{N}{ a_k  {{d^k y(t)}\over {dt^k}}} = x(t)$ whose solution $y(t)$ is what we call $h_0(t)$ , we we make the following observation that $y(t)$ is composed of two parts as $$y(t) = y_{h}(t) + y_{p}(t)$$ where $y_{h}(t)$ is the homogeneous solution corresponding to $x(t)=0$ for all t, and $y_{p}(t)$ is the particular solution corresponding to input $x(t)$ for $ t &amp;gt; 0$, in particular as what remains as input when time goes to infinity.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we can see that for the input $x(t)=\delta(t)$ the particular solution $y_p(t)$ for $t&amp;gt;0$ is zero as the input is zero for $t &amp;gt; 0$. Then the output simplifies to $h_0(t) = y(t) = y_h(t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we have to find the homogeneous part of $y(t)$ as the solution of the equation $$\sum_{k=0}^{N}{ a_k {{d^k y(t)}\over {dt^k}}} = 0$$ &#xA;following the usual procedure by finding the roots of its characteristic polynomial in complex-s: $$p(s) = \sum_{k=0}^{N}{a_k s^k}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is obtained when we simply insert $y_h(t) = Ke^{st}$ as a solution canditade to the homogeneous differential equation $\sum_{k=0}^{N}{ a_k {{d^k y(t)}\over {dt^k}}} = 0$. The solution is then hypothesised to be $$y_h(t) = \sum_{k=0}^{N}{ A_k e^{st}}$$ for the case when all the roots are distinct. If they are not, you know what to do right ;) &#xA;The solution therefore now requires to determine the N unknown coefficients $A_k$ from N-inital conditions, at time t=0 for the framework of this method, possesed by the output $y(t)$ and its derivates up to order N-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that this system was defined to be under inital rest with complete zero inital conditions prior to the application of any excitation. Hence if we were to solve the homogeneous solution $y_h(t)$ for an ordinary (formally valid) input signal $x(t)$ to the system, the homogeneous solution will be identically zero, as the initial conditions would all be. (all the coefficients $A_k$ of the exponential terms turn out to be zero). But the magic of the generalised input $\delta(t)$ is that it will set one of those inital conditions to non-zero, thereby, enabling a non-zero homogeneous response to exist, which will become the solution of the part-I as well.     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be shown that the inital conditions of the part-I due to the excitation $\delta(t)$ will be set as $y(t)=0 ~,~ y(t)' = 0 ~,~ y(t)''=0 ~,~... ~,~ y(t)^{N-1}=1/a_N$ all at $t=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this information you can proceed to solve the algebraic equaitons as usual and find $h_0(t)$ from which you can compute the impulse response $h(t)$ for all $t &amp;gt; 0$. What happens for all $t &amp;lt;0 $? As we stated, this system was LTI and causal with initial rest condition. For such a system if the input $x(t)$ is zero for all $t&amp;lt;0$ then that output is also zero for all $t&amp;lt;0$ which is achieved by multiplying $h_0(t)$ via $u(t)$ to represent the solution of Part-I for all t.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is instructive to apply this procedure to your example:&#xA;$$y'' + 6 y' + 8y = 2x$$&#xA;Lets first solve Part-I:  $$y'' + 6 y' + 8y = x$$ &#xA;to find $h_0(t)$ when the input $x(t)$ = $\delta(t)$. solve the characteristic equation: $s^2 + 6s + 8 = 0$ which yields $s=-4$ and $s=-2$ as solutions. A stable system, isn't it? The proposed homogeneous solution is therefore $$y_h(t) = A_1 e^{-2t} + A_2 e^{-4t}$$ &#xA;For which we need 2 inital conditions to find $A_1$ and $A_2$.&#xA;These initial conditions are set by the impulse $\delta(t)$ to be: $y(0)=0$ and $y(0)'=1$. Using these we find them to be $A_1=1/2$ and $A_2=-1/2$ and this yields $$ h_0(t) = {1 \over 2} [ e^{-2t} - e^{-4t}] $$ for all $t &amp;gt; 0$. Also note that this system was LTI and causal with initial rest and input $x(t)=\delta(t)$ is zero for all $t&amp;lt;0$ implies that output is also zero for all $t&amp;lt;0$ which is simplified by using a unit step $u(t)$ function to format the output as: $$ h_0(t) = {1 \over 2} [ e^{-2t} - e^{-4t}]u(t)$$ for all t.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally apply this $h_0(t)$ as an input to Part-II whose output is simply $$y(t)= 2x(t)$$ to get the impulse response of the overall system as:&#xA;$$h(t) = [ e^{-2t} - e^{-4t}]u(t)$$  &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-01-06T01:24:02.263" LastActivityDate="2016-01-06T01:24:02.263" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28107" PostTypeId="1" CreationDate="2016-01-06T01:47:24.253" Score="-1" ViewCount="67" Body="&lt;p&gt;Let $x[n] = u[n] - u[n-4]$ (a discrete pulse of length 4), and $X(\omega)$ is its DTFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x_1[n] = x[n]*x[n]$. I expect DTFT of $x_1[n]$ to be same as $X(\omega)$, because $x_1[n]$ has the same sample values. But it is actually a convolution: $X(\omega)*X(\omega)$. &#xA;This is puzzling. Please explain.&lt;/p&gt;&#xA;" OwnerUserId="18965" LastEditorUserId="8202" LastEditDate="2016-01-06T12:17:16.763" LastActivityDate="2016-02-05T12:47:53.017" Title="DTFT inconsistency" Tags="|dtft|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28108" PostTypeId="2" ParentId="28107" CreationDate="2016-01-06T06:28:28.677" Score="0" Body="&lt;p&gt;There is a confusion: the convolution of $x$ by $x$, denoted $x*x$, yields a product in the Fourier domain: $X(\omega)\times X(\omega)$ (sometimes denoted $X(\omega). X(\omega)$ or simply $X(\omega) X(\omega)$, or $X^2(\omega)$).&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-06T06:28:28.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28109" PostTypeId="2" ParentId="28107" CreationDate="2016-01-06T08:05:48.900" Score="0" Body="&lt;p&gt;As you probably already guessed, there is no inconsistency. Since you can trust in the correctness of the correspondence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_1[n]\cdot x_2[n]\longleftrightarrow \frac{1}{2\pi}(X_1\star X_2)(\omega)=\frac{1}{2\pi}\int_0^{2\pi}X_1(\theta)X_2(\omega-\theta)d\theta\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes convolution, you know that if $x[n]=x^2[n]$ (as in your example) the following equation must hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\frac{1}{2\pi}(X\star X)(\omega)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the given sequence you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=e^{-j3\omega /2}\frac{\sin(2\omega)}{\sin(\omega/2)}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So from $(2)$ we have the equality&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{-j3\omega /2}\frac{\sin(2\omega)}{\sin(\omega/2)}=\frac{1}{2\pi}\int_0^{2\pi}e^{-j3\theta /2}\frac{\sin(2\theta)}{\sin(\theta/2)}e^{-j3(\omega-\theta) /2}\frac{\sin(2(\omega-\theta))}{\sin((\omega-\theta)/2)}d\theta\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\sin(2\omega)}{\sin(\omega/2)}=\frac{1}{2\pi}\int_0^{2\pi}\frac{\sin(2\theta)}{\sin(\theta/2)}\frac{\sin(2(\omega-\theta))}{\sin((\omega-\theta)/2)}d\theta\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;follows. So you have actually proved that awfully looking equation given by $(5)$!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that with a bit of effort you could actually prove $(5)$ directly, but your method is of course much more elegant.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-06T08:05:48.900" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28110" PostTypeId="1" AcceptedAnswerId="28111" CreationDate="2016-01-06T10:31:19.917" Score="0" ViewCount="131" Body="&lt;p&gt;Suppose we denote the frequency of the note $\textbf{C}_{0}$ by $f$ then we know that $f,2f,3f,...$ are all resonating frequencies. However the frequencies $2f,4f,...,2^{m}f$ belong to the same pitch class $\textbf{C}$ having the &quot;same&quot; sound(higher pitch) whereas the frequency $3f$ is the note $\textbf{G}_{1}$ and belongs to the pitch class $\textbf{G}$. What is the reason(physical) for this ?&lt;/p&gt;&#xA;" OwnerUserId="18716" LastActivityDate="2016-01-06T19:33:08.427" Title="Resonance and Pitch classes" Tags="|frequency|pitch|music|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28111" PostTypeId="2" ParentId="28110" CreationDate="2016-01-06T10:46:44.187" Score="1" Body="&lt;p&gt;I think you gave the reason in your question. A periodic function can be written as a Fourier series, i.e. as a weighted sum of phase shifted sinusoids, where the frequencies of the individual sinusoids are integer multiples of the fundamental frequency. And the odd multiples obviously give you other pitches than the pitch corresponding to the fundamental frequency. This is what causes the same note to sound different when played on different instruments. It's called &lt;a href=&quot;https://en.wikipedia.org/wiki/Timbre&quot; rel=&quot;nofollow&quot;&gt;timbre&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Harmonic_series_%28music%29#/media/File:Harmonics_to_32.png&quot; rel=&quot;nofollow&quot;&gt;harmonics of the note C&lt;/a&gt; consist of all possible notes (and also in-between notes). The strongest harmonics with pitches different from C are G (the perfect fifth at $3f$), and E (the major third at $5f$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Your comment clarified your question for me. The phenomenon you're addressing is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Octave#Theory&quot; rel=&quot;nofollow&quot;&gt;octave equivalence&lt;/a&gt;. The most common argument for explaining octave equivalence is that the perfect octave is the most basic interval after the perfect unison, due to the simple relation between the harmonics of two notes an octave apart. But the assumption of octave equivalence is by no means universally accepted. As an example, every musician knows from experience that certain chord voicings which sound good in some range sound different (usually not as good) in a lower range. For some interesting thoughts on octave equivalence have a look at &lt;a href=&quot;http://blog.wolftune.com/2010/10/octave-equivalence-not-so-fast.html&quot; rel=&quot;nofollow&quot;&gt;this page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-06T13:12:54.357" LastActivityDate="2016-01-06T13:12:54.357" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28112" PostTypeId="1" AcceptedAnswerId="28114" CreationDate="2016-01-06T11:47:00.270" Score="0" ViewCount="53" Body="&lt;p&gt;I'm currently working on voice activity detection (VAD) theme and I just started to wonder - if computer generated speech (as when using voice generators) can be discriminated from human speech with classic VAD approaches (ex. 4Hz energy modulation, zero-crossing ratio, modulation entropy, short time energy, MFCC coefficients).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or - from mathematical point of view - are they just the same signals (or with very similar characteristics)?&lt;/p&gt;&#xA;" OwnerUserId="18770" LastEditorUserId="18051" LastEditDate="2016-01-07T20:14:21.833" LastActivityDate="2016-01-07T20:14:21.833" Title="Discrimiation between human speech and computer generated one" Tags="|speech-recognition|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28113" PostTypeId="2" ParentId="28110" CreationDate="2016-01-06T13:14:33.040" Score="0" Body="&lt;p&gt;Pitch is a psychoacoustic phenomena that is different from pure spectral frequency.  Under certain conditions, a human ear-brain will combine (fuse) multiples spectral frequencies into what sounds like a single pitch.  This likely helps simplify recognizing an single source producing an overtone rich audio periodicity (e.g. a single very large critter in the wild is very different from a bunch of little ones.)  Thus pure 1f plus 3f (etc.) sinusoids of the right volumes and timing will sound like one pitch to human listeners, while a 3f sinusoid alone will sound like a different pitch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g. pitch and pitch class are &lt;em&gt;not&lt;/em&gt; purely physical, but perceptual.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-06T13:24:00.340" LastActivityDate="2016-01-06T13:24:00.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28114" PostTypeId="2" ParentId="28112" CreationDate="2016-01-06T13:40:31.587" Score="1" Body="&lt;p&gt;Many current computer speech synthesizers seem to produce less jitter or variability in inter glottal closure periodicity timing than most typical human speech.  (e.g. humans often produce subtle vibrato as well as tremolo, but synthesizers could change to do this as well.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-06T13:40:31.587" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28115" PostTypeId="1" CreationDate="2016-01-06T13:59:09.317" Score="4" ViewCount="2338" Body="&lt;p&gt;I have this image: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Sg4wa.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Sg4wa.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What methods should I use to extract the veins from this image.&#xA;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="18779" LastEditorUserId="7338" LastEditDate="2016-08-29T09:31:08.377" LastActivityDate="2016-08-29T09:31:08.377" Title="Vein extraction from this image" Tags="|image-processing|matlab|opencv|image-segmentation|c++|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28116" PostTypeId="2" ParentId="28110" CreationDate="2016-01-06T19:33:08.427" Score="0" Body="&lt;p&gt;Neat question! If you took any note's frequency, twice its value is the same note in a higher octave:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A4 --&gt; 440 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A5 --&gt; A4*2 == 880 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A6 --&gt; A5*2 == 1760 Hz... and so on&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is simply how nature works. Any fundamental waveform and a multiple which is an exponent of 2 is perceived as the same note, which it is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you take any note which is just an integer multiple, it is one of the harmonics of the note. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A major scale has the notes: A, C# and E&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3*A4 = 1320 Hz $\approx$ E6  = 1318.51 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5*A4 = 2200 Hz $\approx$ C#7 = 2217.46 Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a crude example to differentiate harmonics from the same note in a different octave. &lt;/p&gt;&#xA;" OwnerUserId="17009" LastActivityDate="2016-01-06T19:33:08.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28117" PostTypeId="1" AcceptedAnswerId="28118" CreationDate="2016-01-06T19:53:43.750" Score="5" ViewCount="4517" Body="&lt;p&gt;I feel like I am having a brainfart over here and can't seem to remember what's going on with STFT outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider these two lines of code from the Python library Librosa:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Window the time series.&#xA;y_frames = util.frame(y, frame_length=n_fft, hop_length=hop_length)&#xA;&#xA;# Pre-allocate the STFT matrix&#xA;stft_matrix = np.empty((int(1 + n_fft // 2), y_frames.shape[1]),&#xA;                       dtype=dtype,&#xA;                       order='F')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the first line, we have a function that creates a matrix with a window length of n_fft (2048).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the next line, we pre-allocate our STFT, but our window length is now 1025 instead of 1024 as dictated by the 1+n_fft // 2?  Where does this extra frequency bin come from?  Why is not just 1024?&lt;/p&gt;&#xA;" OwnerUserId="14863" LastActivityDate="2023-01-08T08:56:59.103" Title="STFT Window Size is 2048, Why is the output 1025?" Tags="|fft|python|stft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28118" PostTypeId="2" ParentId="28117" CreationDate="2016-01-06T20:03:10.513" Score="4" Body="&lt;p&gt;The continuous Fourier transform possesses symmetries  when computed on real signals (Hermitian symmetry). The discrete version, an FFT (of even length) possesses a slighty twisted symmetry.&lt;/p&gt;&#xA;&lt;p&gt;The DC coefficient (&lt;span class=&quot;math-container&quot;&gt;$F(0)$&lt;/span&gt;) is real, as well as the Nyquist one (&lt;span class=&quot;math-container&quot;&gt;$F(N/2)$&lt;/span&gt;). In between, you get &lt;span class=&quot;math-container&quot;&gt;$\frac{2048-2}{2}=1023$&lt;/span&gt; &amp;quot;complex&amp;quot; coefficients, &amp;quot;duplicated&amp;quot; in positive and negative frequencies.&lt;/p&gt;&#xA;&lt;p&gt;So for real signal, each STFT frame can be represented by &lt;span class=&quot;math-container&quot;&gt;$1023+2$&lt;/span&gt; frequency bins, the remaining   1023 being recovered by Hermitian symmetry.&lt;/p&gt;&#xA;&lt;p&gt;You can get complementary information at &lt;a href=&quot;https://web.archive.org/web/20180202152348/http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM&quot; rel=&quot;nofollow noreferrer&quot;&gt;waybackmachine version of Pure Real Sequences&lt;/a&gt; &lt;a href=&quot;http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM&quot; rel=&quot;nofollow noreferrer&quot;&gt;broken FFT of &lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;As a result, we can see that if N is even, both &lt;span class=&quot;math-container&quot;&gt;$F(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$F(N/2)$&lt;/span&gt; must&#xA;be real. Given these two values and the complex values &lt;span class=&quot;math-container&quot;&gt;$F(1)...F(N/2-1)$&lt;/span&gt;,&#xA;(I.E. N numbers in total) the sequence is completely characterized.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2023-01-08T08:56:59.103" LastActivityDate="2023-01-08T08:56:59.103" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28120" PostTypeId="1" AcceptedAnswerId="28125" CreationDate="2016-01-06T22:44:51.147" Score="1" ViewCount="6554" Body="&lt;p&gt;If the received signal strength for a 5.2 dBi dipole was measured at -46 dBm and the noise level was -96 dBm, what would the signal/noise ratio be in dB, the received power in µW, and the noise level in nW?&lt;/p&gt;&#xA;" OwnerUserId="18972" LastEditorUserId="11256" LastEditDate="2016-01-07T01:37:17.180" LastActivityDate="2016-01-07T02:04:41.013" Title="Calculating signal/noise ratio and the noise level" Tags="|signal-analysis|" AnswerCount="1" CommentCount="4" ClosedDate="2016-01-07T12:45:23.767" ContentLicense="CC BY-SA 3.0" />
  <row Id="28121" PostTypeId="1" CreationDate="2016-01-06T23:20:44.873" Score="3" ViewCount="4872" Body="&lt;p&gt;I'm facing a gap in my understanding of when a signal is a &quot;voltage&quot; signal and when it is a &quot;power&quot; signal that I've always managed to avoid resolving until now...  First what I think I understand, then my question after the horizontal rule:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand SNR to be the ratio of average signal power to RMS noise power: &#xA;$$&#xA;SNR=\frac{S_P}{N_P}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or in dB:&#xA;$$&#xA;SNR_{dB}=10\cdot\log(S_P)-10\cdot\log(N_P)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When calculating SNR based on voltages, power is proportional to voltage squared ($P=V^2/R$) and the Rs drop out in the ratio so we get:&#xA;$$&#xA;SNR=\frac{{S_V}^2/R}{{N_V}^2/R}=\left(\frac{{S_V}}{{N_V}}\right)^2&#xA;$$$$&#xA;SNR_{dB}=20\cdot\log(S_V)-20\cdot\log(N_V)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the familiar 10log for power, 20log for voltage relation doing the squaring for voltage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a radio signal that I receive at an antenna.  For simplicity, I assume I have a perfect receiver and noiseless amplifier so that my received signal power is $P_{Rx}$ and noise is only Johnson thermal AWGN: $N_T=k_B\cdot T\cdot B$, where $k_B$ is Boltzman's constant, T is temperature and B is bandwidth-- none of which really figure in after this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe my SNR at this point to be:&#xA;$$&#xA;SNR_{RF}=\frac{P_{Rx}}{N_T}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now I sample, and this is where I start to have questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ignoring quantization noise and such, I believe the analog-digital conversion process results in voltage signals-- that is, the sample values are measurements of the voltage across a resistor ladder or some such meaning the SNR of the sampled signal follows the voltage law:&#xA;$$&#xA;SNR_{ADC}=\left(\frac{S_{ADC}}{N_{ADC}}\right)^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting aside practical implementation losses, I believe $SNR_{ADC}=SNR_{RF}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I start to be less sure is when I start operating on the sampled signals.  Let's say I multiply the sampled signal by a delayed version of itself.  Ok, the noise terms get more complicated because I'm taking the product of two independent random variables with non-zero mean but, more fundamentally, is the result a &quot;voltage&quot; or a &quot;power&quot;?  Is there a physical explanation that will help me understand this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is: in order to maintain consistency among my SNR estimates, is this a 10log or 20log calculation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By a pure units analysis, I should have voltage-squared which implies power-- but these are still ADC levels.  It would also seem odd to say that my signal is voltage-cubed if I multiply by two delayed copies...&lt;/p&gt;&#xA;" OwnerUserId="18971" LastActivityDate="2016-01-07T01:35:23.233" Title="Understanding &quot;voltage&quot; and &quot;power&quot; in SNR of a sampled signal" Tags="|sampling|snr|digital|analog|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28122" PostTypeId="2" ParentId="28121" CreationDate="2016-01-07T01:35:23.233" Score="1" Body="&lt;p&gt;Handling units in signal processing is tricky (what are the units of $e^{s(t)}$?). I find it useful to think about operations on signals physically, instead of trying to make sense of them mathematically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, a mixer multiplies two signals. Let's assume the signals are measured in volts. The mixer output is, obviously, also a voltage. This is true even when one of the mixer inputs is its own delayed output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When calculating an SNR, you square the signal sample (which is a voltage value). In this case, you get a result in watts, because it turns out that the signal power is equal to its square. Physically, you could connect a watt-meter to get a reading of the signal power; you would find that, at every instant, the power turns out to be equal (or proportional) to the square of each sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why, when multiplying two voltages, you get a voltage in one case (mixer) and a power in another (SNR)? I think the reason is that you interpret the result differently in each case. In the case of SNR calculation, the square of a sample physically matches its instantaneous power, so you can assign that meaning to the mathematical operation.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-01-07T01:35:23.233" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28123" PostTypeId="1" CreationDate="2016-01-07T01:56:44.767" Score="2" ViewCount="357" Body="&lt;p&gt;Consider a continuous channel, band-limited to the $[f_{\text{min}},\,f_{\text{max}}]$ frequency window. A well-known statement says that, &lt;em&gt;as far as the dependence on the frequencies&lt;/em&gt;, the information-carrying capacity of such a channel depends only on the bandwidth $B=f_{\text{max}}-f_{\text{min}}$, and &lt;em&gt;not&lt;/em&gt; on the magnitudes of $f_{\text{min}}$ and $f_{\text{max}}$ separately. There are also dependencies on other, non-frequency-related variables (in particular, on the signal-to-noise ratio), but this question is about how the carrying capacity depends on the frequencies, while any and all other relevant variables are held fixed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rigorous underpinning of all statements connecting the information-carrying capacity and the bandwidth seems to be the &lt;a href=&quot;https://en.wikipedia.org/wiki/Shannon%E2%80%93Hartley_theorem&quot; rel=&quot;nofollow&quot;&gt;Shannon–Hartley  theorem&lt;/a&gt;: $C =  B \log_2 \left( 1+\frac{S}{N} \right),$ where $C$ is the information-carrying capacity and $S/N$ is the signal-to-noise ratio. However, in every (at least somewhat) careful statement and proof of the Shannon–Hartley I've seen (e.g., &lt;a href=&quot;https://goo.gl/g0Vo8u&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;; go one page up for the definition of $W$), the bandwidth always refers to the case when $f_{\text{min}}=0$. The reason seems to be that the proof relies on the Nyquist–Shannon sampling theorem; and in the latter, the relevant bandwidth indeed always starts from zero, since that theorem is all about the rate of sampling. (This was what I had thought originally, but it turned out to be wrong. See &lt;strong&gt;Update 1&lt;/strong&gt; below.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in order to be able to use a variety of frequencies for transmitting information, one typically (always?) resorts to some kind of a modulation scheme, say of the amplitude, or of the frequency, or of the phase, or something more complicated (QAM, ASK, PSK, OFDM...). And for each &lt;em&gt;known&lt;/em&gt; modulation scheme, it can (presumably) be shown that, indeed, what matters (as far as the relation between the information-carrying capacity and the frequencies used) is the bandwidth around the carrier signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But perhaps this is just because we are not sufficiently clever. Perhaps there is a scheme, as yet undiscovered, that would manage to pack, within the same bandwidth, more information in a frequency band with $f_{\text{min}}&amp;gt;0$ than the Shannon–Hartley allows to be packed in a band with  $f_{\text{min}}=0$ (assuming the same signal-to-noise ratio in all cases).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a proof that there could not be such a scheme? (As it turns out, probably yes. See &lt;strong&gt;Update 2&lt;/strong&gt; below.) In other words, is there a proof that the bandwidth that enters the Shannon–Hartley can indeed be $f_{\text{max}}-f_{\text{min}}$ with $f_{\text{min}}$ any arbitrary positive number? Equivalently: is there some generalization of the Shannon–Hartley that allows $f_{\text{min}}$ to be any positive number? (Almost certainly yes. See &lt;strong&gt;Update 1&lt;/strong&gt; below.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 1:&lt;/strong&gt; As pointed out by Omegaman and Peter K., the Nyquist–Shannon sampling theorem in fact deals with the case of $f_{\text{min}}&amp;gt;0$ as well. As explained on the Wikipedia entry for that theorem,  &quot;For example, in order to sample the FM radio signals in the frequency range of 100-102 MHz, it is not necessary to sample at 204 MHz (twice the upper frequency), but rather it is sufficient to sample at 4 MHz (twice the width of the frequency interval).&quot; It would seem that this is the key to at least one way of answering this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt; Jim Clay and especially Jason R. suggest the following line of reasoning: the theorem on reversibility states that &quot;a reversible operation, transforming a signal into one or more waveforms, may be inserted between the channel output and the receiver without affecting the minimum attainable probability of error&quot; (Wozencraft and Jacobs, p. 488, 1965). Now, for the purposes of the (sought-after generalized version of the) Shannon-Hartley, any sort of transformation of the signal to a channel with $f_{\text{min}}&amp;gt;0$ would have to be lossless, i.e. reversible. We would than need to prove the following theorem: &quot;a reversible transformation from one channel, band-limited to $[f^{(1)}_{\text{min}},\,f^{(1)}_{\text{max}}]$, to another channel, band-limited to $[f^{(2)}_{\text{min}},\,f^{(2)}_{\text{max}}]$, preserves the signal-to-noise ratio if and only if the bandwidths of the two channels are the same, i.e. $f^{(1)}_{\text{max}}-f^{(1)}_{\text{min}}=f^{(2)}_{\text{max}}-f^{(2)}_{\text{min}}$.&quot; The required generalization of the Shannon-Hartley then follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;At least in W&amp;amp;J, the theorem on reversibility, at least superficially, seems to be given in somewhat different terms than those usually used to state the Shannon-Hartley. Is the theorem on reversibility really applicable to our attempt to generalize the Shannon-Hartley?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does anyone know a proof (that does &lt;em&gt;not&lt;/em&gt; invoke the generalized Shannon-Hartley) of the required theorem, i.e. that a reversible transformation preserves the signal-to-noise ratio if and only if it is between channels whose bandwidths are equal? In fact, one should be able to prove that, under a reversible transformation, $\big(1+\frac{S^{(1)}}{N^{(1)}}\big)^{f^{(1)}_{\text{max}}-f^{(1)}_{\text{min}}}=\big(1+\frac{S^{(2)}}{N^{(2)}}\big)^{f^{(2)}_{\text{max}}-f^{(2)}_{\text{min}}}$. It certainly &lt;em&gt;seems&lt;/em&gt; that a statement like this should be provable directly, i.e. without invoking the Shannon-Hartley, but I don't have a proof yet.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It also occurs to me that a direct proof of the statement $\big(1+\frac{S^{(1)}}{N^{(1)}}\big)^{f^{(1)}_{\text{max}}-f^{(1)}_{\text{min}}}=\big(1+\frac{S^{(2)}}{N^{(2)}}\big)^{f^{(2)}_{\text{max}}-f^{(2)}_{\text{min}}}$ could be a key part of a nice complement to the usual information-theoretic treatment of the information-carrying capacity. For example, you could say that, since there is a strong intuition that a reversible transformation should not affect information content, the statement above suggests that the information-carrying capacity $C$ must be a function of $\big(1+\frac{S}{N}\big)^{f_{\text{max}}-f_{\text{min}}}$. Then we demand that the capacity of two channels combined must be the sum of the capacities of the individual channels, from which, by usual arguments, it then follows that the function must be a log.&lt;/p&gt;&#xA;" OwnerUserId="18973" LastEditorUserId="18973" LastEditDate="2016-01-15T16:48:01.770" LastActivityDate="2016-01-15T16:48:01.770" Title="Is there a proof that equal bandwidths have equal information-carrying capacity?" Tags="|bandwidth|information-theory|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28124" PostTypeId="1" AcceptedAnswerId="28133" CreationDate="2016-01-07T02:03:32.673" Score="0" ViewCount="3730" Body="&lt;p&gt;I previously asked this question in the maths community not realising that this stack exchange community existed. I have searched online extensively and haven't been able to find an explanation to how this works and would really appreciate some input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm studying this signals and systems text book and I can't figure out the logic behind how $u(t)$ and $r(t)$ can be added together to form some signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u(t) \triangleq&#xA;\begin{cases}&#xA;0, &amp;amp; \text{if }t&amp;lt;0 \\&#xA;1, &amp;amp; \text{if }t\ge0&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;r(t) &amp;amp;  \triangleq&#xA;\begin{cases}&#xA;0, &amp;amp; \text{if }t&amp;lt;0 \\&#xA;t, &amp;amp; \text{if }t\ge0&#xA;\end{cases} \\&#xA;&amp;amp; = t \ u(t) \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, an example in the book gives this signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/1tFgE.png&quot; alt=&quot;signal example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the book says that it can be described by this equation: &#xA;$$&#xA;x(t) = u(t)-r(t-1)+2r(t-2)-r(t-3)+u(t-4)-2u(t-5)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It states that the sum of the ramps $-r(t-1)+2r(t-2)$ goes upward with the slope equal to one starting at $t=2$. I can't understand how this works geometrically and haven't been able to find anything that has helped. Does anyone know how this type of modelling is done?&lt;/p&gt;&#xA;" OwnerUserId="18974" LastEditorUserId="13320" LastEditDate="2016-11-13T13:28:05.207" LastActivityDate="2016-11-13T13:28:05.207" Title="adding u(t) and r(t) to create a signal" Tags="|signal-synthesis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28125" PostTypeId="2" ParentId="28120" CreationDate="2016-01-07T02:04:41.013" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Decibel&quot; rel=&quot;nofollow&quot;&gt;decibels&lt;/a&gt; (dB) provides a logarithmic scale for the ratio of two power values. Mathematically it is defined as:&#xA;$$&#xA;  R = 10 \log_{10} \left(\frac{P}{P_0}\right)&#xA;$$&#xA;where $P$ and $P_0$ are power values in linear scale (such as Watts) and $R$ is the ratio expressed in logarithmic scale. Often a fixed reference power level (such as 1 Watt) is chosen for $P_0$. When that reference power level $P_0$ is 1 milliwatt (mW), the resulting unit for the $R$ quantity is called a dBm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a known reference level, you can conversely obtain the power in linear scale from the power ratio value expressed in logarithmic scale by using the inverse formula:&#xA;$$&#xA;  P = 10^{R/10}\cdot  P_0 &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for a measurement of -46dBm (remember that the dBm units means that the reference power level is 1mW), the resulting power is:&#xA;$$&#xA;\begin{align}&#xA;  P_s &amp;amp;= 10^{-46/10} \cdot 1 \mbox{mW} \\&#xA;      &amp;amp;\approx 2.5 \times 10^{-5} \cdot 1 \mbox{mW} \\&#xA;      &amp;amp;\approx 2.5 \times 10^{-8} \, \mbox{W} \\&#xA;      &amp;amp;\approx 2.5 \times 10^{-2} \, \mbox{µW}&#xA;\end{align}&#xA;$$&#xA;Similarly for a measurement of -96dBm, the resulting power is:&#xA;$$&#xA;\begin{align}&#xA;  P_n &amp;amp;= 10^{-96/10} \cdot 1 \mbox{mW} \\&#xA;      &amp;amp;\approx 2.5 \times 10^{-10} \cdot 1 \mbox{mW} \\&#xA;      &amp;amp;\approx 2.5 \times 10^{-13} \, \mbox{W} \\&#xA;      &amp;amp;\approx 2.5 \times 10^{-4}  \, \mbox{nW}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the signal-to-noise ratio (SNR), it is simply defined as the ratio of the signal power to the noise power. So in linear scale, that would be:&#xA;$$&#xA;\begin{align}&#xA;  \mbox{SNR} &amp;amp;= \frac{P_s}{P_n} \\&#xA;             &amp;amp;\approx \frac{2.5 \times 10^{-8}}{2.5 \times 10^{-13}} \\&#xA;             &amp;amp;\approx 10^{5}&#xA;\end{align}&#xA;$$&#xA;which when expressed in decibels would give us:&#xA;$$&#xA;\begin{align}&#xA;  \mbox{SNR}_{\mbox{dB}} &amp;amp;= 10\log_{10} \left(\frac{P_s}{P_n}\right) \, \mbox{dB} \\&#xA;             &amp;amp;= 10\log_{10} \left(10^{5}\right) \, \mbox{dB} \\&#xA;             &amp;amp;= 50\mbox{dB}&#xA;\end{align}&#xA;$$&#xA;We could of course also have taken a bit of a shortcut to compute that SNR directly from the power measurements in dBm by using &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_logarithmic_identities&quot; rel=&quot;nofollow&quot;&gt;logarithmic identities&lt;/a&gt; to get:&#xA;$$&#xA;\begin{align}&#xA;  \mbox{SNR}_{\mbox{dB}} &amp;amp;= 10\log_{10} \left(\frac{P_s}{P_n}\right) \, \mbox{dB} \\&#xA;             &amp;amp;= 10\log_{10} \left(\frac{\frac{P_s}{P_0}}{\frac{P_n}{P_0}}\right) \, \mbox{dB} \\&#xA;             &amp;amp;= 10\log_{10} \left(\frac{P_s}{P_0}\right) - 10\log_{10}\left(\frac{P_n}{P_0}\right) \, \mbox{dB} \\&#xA;             &amp;amp;= \left(-46\,\mbox{dBm}\right) - \left(-96\,\mbox{dBm}\right) \\&#xA;             &amp;amp;= 50\mbox{dB}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2016-01-07T02:04:41.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28126" PostTypeId="2" ParentId="28123" CreationDate="2016-01-07T02:04:58.623" Score="3" Body="&lt;p&gt;I'm not a mathematician so I won't pretend to claim that this is anything like a proof, but at an intuitive level I think that the fact that you can deterministically transform baseband to passband and back again by multiplying with complex sinusoids implies that the two are equivalent.&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2016-01-07T02:04:58.623" CommentCount="24" ContentLicense="CC BY-SA 3.0" />
  <row Id="28128" PostTypeId="1" CreationDate="2016-01-07T03:47:48.150" Score="1" ViewCount="923" Body="&lt;p&gt;I want to implement a high pass filter (order 4) in MATLAB using cascade form.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b,a]=butter(4,0.0083,'high');% I am using butterworth filter&#xA;[sos,gain]=tf2sos(b,a);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should I use [sos,gain] for implementing the same in cascade form or just [sos]. I read a post related to same and it says just [sos] should be used, however, I am not sure if that is the correct way.&#xA;P.S. I want to create a MATLAB function for IIR filter(don't want to use the standard filter function in MATLAB) which would get the coefficients b,a &amp;amp; input. &lt;/p&gt;&#xA;" OwnerUserId="18738" LastActivityDate="2021-04-11T17:03:15.250" Title="Regarding BIQUAD IIR implementation in MATLAB" Tags="|matlab|filters|infinite-impulse-response|biquad|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28129" PostTypeId="1" AcceptedAnswerId="28136" CreationDate="2016-01-07T04:21:22.303" Score="0" ViewCount="83" Body="&lt;p&gt;This might be a solved problem (or a known unsolved problem) because it is related with finding a causal signal that has a desired magnitude response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(f)=R(f)+iI(f)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(f)=R(f)+i \int^\infty_{-\infty}\frac{R(u)}{f-u}du$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(f)F^*(f)=R^2(f)+\bigg(\int^\infty_{-\infty}\frac{R(u)}{f-u}du\bigg)^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We only know $F(f)F^*(f)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to solve this, is the solution unique?&lt;/p&gt;&#xA;" OwnerUserId="16852" LastActivityDate="2016-01-07T12:20:45.363" Title="Given the absolute value of a function, find hilbert pairs that make it up" Tags="|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28130" PostTypeId="1" CreationDate="2016-01-07T04:40:34.533" Score="0" ViewCount="59" Body="&lt;p&gt;All common tests for testing if a time series is white noise are based on common distribution assumptions from which inference is made that a process is white noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in the case for most time series the underlying distributions do not follow traditional distributions (gausian etc). For this reason I would like to know if any white noise tests exist which do not use preconcived distributions and observes main white noise assumptions (finite variance, serially uncorrelated ( independent / statinonary) and zero mean).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using density spectrum as to see if the density plot produces a flat line through FFT is not possible as the series is non stationary.&lt;/p&gt;&#xA;" OwnerUserId="7478" LastEditorUserId="7478" LastEditDate="2016-01-07T06:28:48.897" LastActivityDate="2016-01-07T06:28:48.897" Title="Empirical Distribution White Noise Tests" Tags="|filters|noise|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28132" PostTypeId="1" AcceptedAnswerId="28145" CreationDate="2016-01-07T05:54:35.037" Score="1" ViewCount="1277" Body="&lt;p&gt;I wanted to use Curvelet thresholding for edge detection, that is first take discrete curvelet transform then choose coefficient which are for curve and then reconstruct back to get an edge map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me on how to do Curvelet thresholding.&lt;/p&gt;&#xA;" OwnerUserId="14851" LastActivityDate="2017-02-01T07:08:19.650" Title="How to do edge detection using Curvelet transform?" Tags="|wavelet|edge-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28133" PostTypeId="2" ParentId="28124" CreationDate="2016-01-07T07:02:04.547" Score="1" Body="&lt;p&gt;I'm not sure I understand the delta-equals notation, but I'll assume it means definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's important to understand that you're doing a variable substitution here.  In the strictest sense, the $t$ in $u(t-1)$ is not the same $t$ as in $u(t)$.  It may be easier for you to understand if you write your definitions as functions of $z$ instead of $t$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u(z) \triangleq&#xA;\begin{cases}&#xA;0, &amp;amp; \text{if }z&amp;lt;0 \\&#xA;1, &amp;amp; \text{if }z\ge0&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;r(z) &amp;amp;  \triangleq&#xA;\begin{cases}&#xA;0, &amp;amp; \text{if }z&amp;lt;0 \\&#xA;z, &amp;amp; \text{if }z\ge0&#xA;\end{cases} \\&#xA;&amp;amp; = z \ u(z) \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, $z=t$ in $u(t)$ and $z=t-1$ in $r(t-1)$, etc.  You're changing a function of $z$ into a function of $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two functions you're dealing with have a breakpoint in them where the function changes behavior.  In both cases it happens when $z=0$.  So, looking at $u(z)$ for example, $u(z)=0$ for all values of $z$ less than zero and $u(z)=1$ for $z=0$ and all values greater than zero-- just saying what the function says, but in words.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use $u(t)$, I am substituting $z=t$ so $u(t)=0$ for all times before $t=0$, and $u(t)=1$ from time $t=0$ onward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now think about what's happening in the function argument with all the $(t-1)$, $(t-2)$ values...  If you were to look at $u(t-4)$, then, it has the effect of shifting the entire function to the right in time.  In this case:&#xA;$$ u(t-4) =&#xA;\begin{cases}&#xA;0, &amp;amp; \text{if }t-4&amp;lt;0 \\&#xA;1, &amp;amp; \text{if }t-4\ge0&#xA;\end{cases} $$&#xA;or, rearranging the conditions a bit:&#xA;$$ u(t-4) =&#xA;\begin{cases}&#xA;0, &amp;amp; \text{if }t&amp;lt;4 \\&#xA;1, &amp;amp; \text{if }t\ge4&#xA;\end{cases} $$&#xA;so you have a step function that is zero for all times before $t=4$, and one for times $t=4$ onward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the $r(z)$ function, with $z=t-2$ you substitute for $z$ in all places, so you have:&#xA;$$ \begin{align}&#xA;r(t-2) &amp;amp;  =&#xA;\begin{cases}&#xA;0, &amp;amp; \text{if }t&amp;lt;2 \\&#xA;t-2, &amp;amp; \text{if }t\ge 2&#xA;\end{cases} \\&#xA;&amp;amp; = (t-2) \cdot u(t-2) \\&#xA;\end{align}$$&#xA;which is zero for all times before $t=2$ and then a line starting at $(t=2,x(t)=0)$ with a slope of positive 1 and a y-intercept of -2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients have the effect of changing the slope and corresponding y-intercept but the t-intercept remains the same.  $2\cdot r(t-2)$ has a slope of 2 and a y-intercept of -4 but still crosses the $t$ axis at $t=2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The x(t) function is a linear combination of such functions, so you must add up the values at each point.  The easiest way to see this on graph paper would be to draw each term separately one above the other and then add them vertically.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the two components you you've highlighted, $−r(t−1)+2\cdot r(t−2)$:  There is a slope of zero before $t=1$ because $u(t)$ is zero slope.  The first term starts a ramp of slope of -1 starting at $t=1$ and the second term adds to that a ramp of slope +2 starting at $t=2$.  Where those two terms overlap (everywhere from $t=2$ and to the right) the combined slope of those terms is +1.&lt;/p&gt;&#xA;" OwnerUserId="18971" LastActivityDate="2016-01-07T07:02:04.547" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28134" PostTypeId="2" ParentId="28128" CreationDate="2016-01-07T08:13:33.927" Score="1" Body="&lt;p&gt;EDIT: the answer below assumes that you called &lt;code&gt;tf2sos&lt;/code&gt; with &lt;code&gt;[sos,gain]&lt;/code&gt; as output arguments, and that your question is about the necessity of making use of the output variable &lt;code&gt;gain&lt;/code&gt;. Thanks to Hilmar for pointing out this potential misunderstanding. &lt;a href=&quot;https://dsp.stackexchange.com/questions/28128/regarding-biquad-iir-implementation-in-matlab/28138#28138&quot;&gt;His answer&lt;/a&gt; is about the equivalence of two different calls to &lt;code&gt;tf2sos&lt;/code&gt;, one with two output arguments, and the other with just one. Note that when called with just one output argument, the resulting &lt;code&gt;sos&lt;/code&gt; is different from the one obtained from a call with two output arguments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;If you want the correct scaling, in the sense that high frequency signals are passed through the filter with a gain of $1$, then you need to use the variable &lt;code&gt;gain&lt;/code&gt;. If you don't use it you'll get the same high pass filter, but with some scaling. For fixed-point implementations, appropriate scaling is very important to minimize overflow and other quantization artefacts. For a Matlab implementation I wouldn't worry too much about scaling and just implement the filter with the correct gain.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-01-07T14:13:17.687" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28135" PostTypeId="1" AcceptedAnswerId="29170" CreationDate="2016-01-07T10:42:57.263" Score="2" ViewCount="1283" Body="&lt;p&gt;I searched for hit or miss on the internet and Gonzalez's book but there is just a formula and example. In that example the hit or miss just finds a pixel and no more answers. I want to know by concept what is use and purpose of hit or miss transform.&lt;/p&gt;&#xA;" OwnerUserId="18142" LastEditorUserId="80" LastEditDate="2016-04-01T20:28:43.823" LastActivityDate="2016-04-01T20:36:52.683" Title="what doest &quot;hit or miss&quot; in morphology do?" Tags="|image-processing|morphology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28136" PostTypeId="2" ParentId="28129" CreationDate="2016-01-07T12:20:45.363" Score="2" Body="&lt;p&gt;This problem is known as &lt;em&gt;spectral factorization&lt;/em&gt;. For convenience, let me use $j\omega$ as the function argument. Assuming that $F(j\omega)$ is rational, i.e. realizable by lumped elements (R,C,L), the squared magnitude $F(j\omega)F^*(j\omega)$ is a non-negative real rational function. In the Laplace transform domain, this function is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(s)=F(s)F^*(-s^*)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $F^*(j\omega)$ corresponds to the time domain function $f^*(-t)$, the Laplace transform of which is $F^*(-s^*)$. From $(1)$ it is clear that for every pole $s_{\infty}$ of $G(s)$ there must be a pole at $-s_{\infty}^*$, i.e. mirrored across the imaginary axis. The same is of course true for the zeros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can factor $G(s)$ in such a way that you assign all poles to the left of the imaginary axis (i.e. with negative real parts) to $F(s)$. If causality is your only requirement, you are free in assigning the zeros, apart from the need to always take complex conjugate pairs, which guarantees that the impulse response $f(t)$ corresponding to $F(s)$ is a real-valued function. By assigning all poles with negative real parts to $F(s)$, you make sure that $F(s)$ is a causal and stable system. If $G(s)$ has poles &lt;em&gt;on&lt;/em&gt; the imaginary axis, there exists no stable and causal system $F(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the answer to your question is: yes, it is a known problem and it can be solved; no, the solution is not unique (because you can freely choose which zeros you assign to $F(s)$).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-07T12:20:45.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28138" PostTypeId="2" ParentId="28128" CreationDate="2016-01-07T13:46:09.127" Score="0" Body="&lt;p&gt;Both will work if used correctly&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b,a]=butter(4,0.0083,'high');% I am using butterworth filter&#xA;% version 1&#xA;[sos,gain]=tf2sos(b,a);&#xA;y1 = gain*sosfilt(sos,x);&#xA;% version 2&#xA;[sos]=tf2sos(b,a);&#xA;y2 = sosfilt(sos,x);&#xA;% y1 will be equal to y2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-01-07T13:46:09.127" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28139" PostTypeId="1" CreationDate="2016-01-07T14:54:01.567" Score="1" ViewCount="213" Body="&lt;p&gt;The timbre of an harmonic sound (e.g. the steady part of a violin note) is defined by the amplitude of each harmonic (including the fundamental). In order to compare the timbre of two instruments (e.g. two violins playing the G string), I could compare those amplitudes. If the instrument are similar, I suppose that there will be a little difference in the harmonic distribution. Now, is the FFT a reliable tool for this kind of analysis? Should I take into account the noise that it introduces, or is it negligible? &lt;/p&gt;&#xA;" OwnerUserId="15543" LastActivityDate="2017-01-24T23:08:07.343" Title="How much can the FFT noise affect the timbre analysis of a harmonic sound?" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28141" PostTypeId="2" ParentId="9639" CreationDate="2016-01-07T18:13:51.203" Score="2" Body="&lt;p&gt;You could weigh together the images Discrete Wavelet Transforms (DWT), where one image has declining weights with increasing scale and vice versa. The DWT filters are designed to have the perfect reconstruction property so you don't need to worry about cut-off frequencies. This algorithm could have complexity $\mathcal{O}(n)$ where $n$ is the number of pixels.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; clarification: With $\mathcal{O}(n)$ I mean that the numbers of computations required by the algorithm will be proportional to the number of pixels $n$. So it is a measure of computational complexity. Other algorithms can have for instance $\mathcal{O}(n^2)$ if the computational complexity is proportional to the square of the number of data points. In this sense $\mathcal{O}(n)$ is very low complexity, it is far more common with higher complexities such as $\mathcal{O}(n\log(n))$ or $\mathcal{O}(n^2)$ or $\mathcal{O}(n^3)$&lt;/p&gt;&#xA;" OwnerUserId="18051" LastEditorUserId="18051" LastEditDate="2016-01-07T22:26:14.470" LastActivityDate="2016-01-07T22:26:14.470" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28142" PostTypeId="2" ParentId="28139" CreationDate="2016-01-07T18:37:05.680" Score="2" Body="&lt;p&gt;An FFT is a finite length transform.  Therefore one &lt;strong&gt;does&lt;/strong&gt; need to take into account any artifacts introduced by the window (implied rectangular, or optional Von Hann, et.al.).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is some controversy, but you might consider sampling using a greater ADC bit depth than 16 bits at a rate higher than 44.1 ksps to feed you FFTs, and use one of the typical double precision FFT libraries to reduce any numerical noise.  (...and how you mic the violin may make a far greater difference than any of the above.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2017-01-24T23:08:07.343" LastActivityDate="2017-01-24T23:08:07.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28143" PostTypeId="2" ParentId="28123" CreationDate="2016-01-07T19:47:53.373" Score="1" Body="&lt;p&gt;You can probably find the proof you need looking at Nyquist's &lt;a href=&quot;http://monoskop.org/images/2/2e/Nyquist_Harry_1928_Certain_Topics_in_Telegraph_Transmission_Theory.pdf&quot; rel=&quot;nofollow&quot;&gt;original paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, the analysis comes down to converting the information signal into a series of Fourier components, each a sinusoid of a given frequency and phase.  Equal bandwidths, by definition, accommodate an equal number of sinusoids of different frequencies regardless of their offset in the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shannon's contribution was to essentially figure out the limit on how many levels of those sinusoids can be distinguished in the presence of noise.&lt;/p&gt;&#xA;" OwnerUserId="18971" LastEditorUserId="18971" LastEditDate="2016-01-07T21:06:29.683" LastActivityDate="2016-01-07T21:06:29.683" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28144" PostTypeId="2" ParentId="28123" CreationDate="2016-01-07T20:12:59.917" Score="0" Body="&lt;p&gt;Your statement&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The reason seems to be that the proof relies on the Nyquist–Shannon sampling theorem; and in the latter, the relevant bandwidth indeed always starts from zero,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem#Sampling_of_non-baseband_signals&quot; rel=&quot;nofollow&quot;&gt;is incorrect.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A similar result is true if the band does not start at zero frequency but at some higher value, and can be proved by a linear translation (corresponding physically to single-sideband modulation) of the zero-frequency case. In this case the elementary pulse is obtained from sin(x)/x by single-side-band modulation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-07T20:12:59.917" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28145" PostTypeId="2" ParentId="28132" CreationDate="2016-01-07T21:00:19.593" Score="0" Body="&lt;p&gt;If you decide to stick to curvelets, you can find a precise description of an edge dectection algorithm is  &lt;a href=&quot;http://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-10-75&quot; rel=&quot;nofollow&quot;&gt;Edge detection in microscopy images using curvelets&lt;/a&gt;, Tobias Gebäck and Petros Koumoutsakos, BMC Bioinformatics, 2009. The pdf is &lt;a href=&quot;http://download.springer.com/static/pdf/372/art%253A10.1186%252F1471-2105-10-75.pdf&quot; rel=&quot;nofollow&quot;&gt;there&lt;/a&gt;. And you are very lucky: you can get, for free, an  implementation, &lt;a href=&quot;http://www.biomedcentral.com/content/supplementary/1471-2105-10-75-S1.zip&quot; rel=&quot;nofollow&quot;&gt;CurveletUtils&lt;/a&gt;. It provides a Matlab source code for a GUI implementing the edge detection method. I hope you can get started with that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you care of other multiscale transforms providing different oriented  edges at different scales, you can take a look at &lt;a href=&quot;http://www.laurent-duval.eu/Articles/Jacques_L_2011_j-sp_panorama-panorama-wavelet-multiscale-geometric-representations.pdf&quot; rel=&quot;nofollow&quot;&gt;a review paper  on 2D directional wavelets&lt;/a&gt; (including curvelets, shearlets, contourlets, etc.). It includes morphological and non-linear wavelets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, I do not understand why you call Canny and Sobel &quot;morphological edge detectors&quot;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-07T21:00:19.593" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28146" PostTypeId="1" CreationDate="2016-01-07T21:02:38.027" Score="1" ViewCount="1996" Body="&lt;p&gt;I'm trying to find some mathematical docs about the complex (analytic signal) band pass filtering in discrete time. I've read some text already but most of them describes the problem in real time only. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really appreciate some equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT:]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this coefficients' computation equation for real signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;w_{bp}(n) =&#xA;\begin{cases}&#xA;\displaystyle\frac{\sin\left[2\pi f_{t2}\left(n-\frac M2\right)\right]}{\pi\left(n-\frac M2\right)}-\frac{\sin\left[2\pi f_{t1}\left(n-\frac M2\right)\right]}{\pi\left(n-\frac M2\right)},  &amp;amp; \text{if } n \ne \frac M2 \\[2ex]&#xA;2\left(f_{t2} - f_{t1}\right), &amp;amp; \text{if } n = \frac M2&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I have to specify the FIR filter order ($M$) which is approximately 4 / Normalised width of transition band. The application of the filer is a simple convolution of the coefficients computed by the equation above and real signal samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what I need to know is how to achieve this in complex plain. I also found a similar thread &lt;a href=&quot;https://dsp.stackexchange.com/questions/25444/complex-low-pass-filters&quot;&gt;here&lt;/a&gt;, which describes the low pass filter design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I already have my complex $f_c = 5 \textrm{ kHz}$ signal sampled at $f_s = 32\textrm{ kHz}$ and I'm familiar with the complex plain problematics.&lt;/p&gt;&#xA;" OwnerUserId="16270" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-09-04T15:53:31.407" Title="Complex band pass filter" Tags="|filters|filter-design|bandpass|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28147" PostTypeId="2" ParentId="28139" CreationDate="2016-01-07T21:22:18.373" Score="1" Body="&lt;p&gt;The windowing artifacts mentioned by hotpaw2 could be considered part of a larger issue: The relationship between harmonics and peaks in the spectrum is not entirely straightforward. Since peaks are always spread out to some extent (&quot;spectral leakage&quot;), estimating the amplitude of a harmonic is not trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if by &quot;noise&quot; you mean numerical errors, I'd say there is no need to worry. People do FFT and inverse FFT transforms all the time without causing any significant audible artifacts. In this sense, there is also no real loss of information due to windowing; the FFT just doesn't give you exactly what you want, at least not without any significant post-processing.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2016-01-07T21:22:18.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28148" PostTypeId="2" ParentId="28063" CreationDate="2016-01-07T21:55:04.183" Score="0" Body="&lt;p&gt;I have marked @hotpaw2 answer as correct, but after further thought I post a simple visual explanation of what is going on here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of taking the FFT of a complex pulse, consider instead a simple pulse as shown in the figure below. By applying a fourier series expansion, this pulse (or any pulse) can also be created from the weighted summation of an infinite set of orthognal sinwaves as defined in the original question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wa2Ro.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wa2Ro.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is now fairly obvious that the FFT of the pulse within the red window will contain all the spectral content of the pulse (as shown in the first figure of the original question), where as the FFT of the green window will contain no spectral content at all (as shown in the second figure of the original question). This is true even though the trace within each window can still be constructed from the summation of a orthogonal set of sinwaves by the same fourier series expansion. The FFT window transforms the trace within the window onto a different orthogonal set of sinwaves, as described in @hotpaw2 answer. The original fourier series expansion used to construct the pulse and its corresponding frequency components are no longer relevant.&lt;/p&gt;&#xA;" OwnerUserId="18940" LastEditorUserId="18940" LastEditDate="2016-01-16T11:29:08.580" LastActivityDate="2016-01-16T11:29:08.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28149" PostTypeId="2" ParentId="28146" CreationDate="2016-01-07T22:26:35.180" Score="2" Body="&lt;p&gt;Take a (real-valued) low pass filter with impulse response $h_{LP}[n]$ and with cut-off frequency $(f_2-f_1)/2$, where $f_1$ and $f_2$ are the lower and upper band edges of the desired band pass filter. Define a center frequency $f_0=(f_1+f_2)/2$. Then a real-valued band pass filter is obtained by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_{BP}[n]=2h_{LP}[n]\cos(2\pi f_0n)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on the design of the low pass filter, the filter in $(1)$ can be identical to the one in your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a complex-valued band pass filter with a pass band at positive frequencies (but not at negative frequencies), you simply have to modulate the low pass impulse response $h_{LP}[n]$ by a complex exponential instead of by a cosine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h^c_{BP}=h_{LP}[n]e^{j2\pi f_0n}\tag{2}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-07T22:26:35.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28150" PostTypeId="2" ParentId="28146" CreationDate="2016-01-07T22:57:14.287" Score="1" Body="&lt;p&gt;perhaps the equation you need is the real-valued impulse response of, what is in the frequency domain, a one-sided BPF that is pushed up to $f_c$ (i think what Matt is calling &quot;$f_0$&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i think more generally it is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h[n] = h_\text{re}[n] \cos(\omega_c n) - h_\text{im}[n] \sin(\omega_c n) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h_\text{im}[n] = \mathcal{H} \left\{ h_\text{re}[n] \right\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so whatever is the frequency response of $h_\text{re}[n]$, the positive-frequency half of that frequency response is slide up from its left edge being at 0 (or $\omega=0$) to its left edge being at $\omega_c$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-01-07T22:57:14.287" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28151" PostTypeId="1" CreationDate="2016-01-07T23:41:12.957" Score="3" ViewCount="77" Body="&lt;p&gt;I need to represent my signal as a set of transitions from one level to another, and I am interested in transitions that have relatively big amplitude 2000+.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I applied median filter to get rid of the high frequency part of the signal and result looks like this. Now I can take gradient and get set of transitions, and based on the magnitude of these transitions, keep only big one. So, I will get transition, corresponding to the left side of this peak, I will filter out transitions from the top. But I would like to have right side of this peak also to be represented as one nice 2000+ transition. But as you can see on the picture, there is small kink in the middle of the right side that will break my transition into 2 parts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some kind of a filter that will transform my signal and remove this kink?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZSFoL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZSFoL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18660" LastActivityDate="2016-09-04T13:31:31.230" Title="How to merge transitions?" Tags="|matlab|filters|python|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28152" PostTypeId="2" ParentId="28151" CreationDate="2016-01-07T23:52:27.450" Score="1" Body="&lt;p&gt;One of many possible algorithms to provide such edge sensitive information to its users are classified under change-detectors. The one that best fits to your kind of data uses thresholds, accumulators, memory, leakage and smoothing factors as well as variance and mean normalizers to decide on which changes belong to meaningful edges and which are just local variations.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2016-01-07T23:52:27.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28153" PostTypeId="1" AcceptedAnswerId="28160" CreationDate="2016-01-08T00:14:16.667" Score="0" ViewCount="124" Body="&lt;p&gt;What are the best ways to mask a &lt;code&gt;voice tone&lt;/code&gt;, like what they do during news shows on  television sometimes? Is there a way that is not reversibile? I think that a simple modulation is not the best solution.&lt;/p&gt;&#xA;" OwnerUserId="18294" LastEditorUserId="13541" LastEditDate="2016-01-08T16:27:40.590" LastActivityDate="2016-10-08T14:32:30.007" Title="Mask a voice tone" Tags="|speech|voice|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28154" PostTypeId="1" AcceptedAnswerId="28156" CreationDate="2016-01-08T00:14:46.163" Score="5" ViewCount="9130" Body="&lt;p&gt;I understand an ideal analog square wave contains sine-wave-components above Nyquist frequency (and towards infinity) and is thus subject to aliasing. So obviously we need an anti-aliasing-filter. Or do we? Why do we need one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuition tells us that a square wave can hardly be aliased. It is so simple and there's no chance for a cycle or half cycle to be &quot;skipped&quot; unless the base frequency was above Nyquist... yet listening to a non low-passed-square-wave after sampling tells us otherwise. Many low pitches are heard, because of aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each successive sine wave seems to counteract the previous one, reducing the ringing at the nulls of the square-wave&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does superposition hold on such a simple construct?&lt;/p&gt;&#xA;" OwnerUserId="13486" LastActivityDate="2016-01-09T12:08:53.897" Title="Why is a square wave aliased?" Tags="|sampling|nyquist|aliasing|anti-aliasing-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28155" PostTypeId="2" ParentId="19099" CreationDate="2016-01-08T00:31:55.840" Score="0" Body="&lt;p&gt;1) It is done prior to ADC conversion, but not necessarily with the (1st order) RC circuit. If insufficient filtering is performed to remove content above Nyquist then the entire integrity of your signal cannot be trusted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) MBaz sufficiently answered this.&lt;/p&gt;&#xA;" OwnerUserId="13486" LastActivityDate="2016-01-08T00:31:55.840" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28156" PostTypeId="2" ParentId="28154" CreationDate="2016-01-08T02:57:59.063" Score="4" Body="&lt;p&gt;Possibly intuitive answer, skipping the math:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is at least one problem with sampling a non-antialiased square wave at a sampling frequency not a strict multiple of the square wave's frequency.  Because a fixed number of samples don't fit into 1 period of the square wave at these ratios, and a non anti-aliased square wave quantizes to just 2 levels, there will be jitter in the number of samples between edges and thus the position of the 2 sample values representing the rising and falling edges relative to the square wave's frequency.  This jitter in position results in the sound of aliasing after reconstruction (cycle to cycle phase and amplitude modulation, depending on the ratio between the two frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anti-aliasing a square wave &quot;rounds off&quot; the rising and falling edges so that a &quot;just missed&quot; edge results in an interpolated value during sampling, thus reducing the effects of jitter modulation during reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another problem is that an ideal reconstruction filter has overshoot on step inputs.  A &quot;rounded off&quot; input to this filter will result in less or no overshoot.  Anti-aliasing supplies the at least the theoretically minimum amount of signal &quot;rounding&quot; to do this.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-08T03:20:24.340" LastActivityDate="2016-01-08T03:20:24.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28157" PostTypeId="1" CreationDate="2016-01-08T09:41:23.703" Score="1" ViewCount="397" Body="&lt;p&gt;I have estimated AR coefficients of a time series using &quot;aryule&quot; function in MATLAB. Now I want to obtain the error of the estimated model. I think at first I must reconstruct it. so How can I reconstruct a Time series using it AR coefficients in MATLAB? &lt;/p&gt;&#xA;" OwnerUserId="17979" LastActivityDate="2017-11-24T14:29:15.603" Title="How can I reconstruct a Time series using it AR coefficients in MATLAB?" Tags="|matlab|signal-analysis|autoregressive-model|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28158" PostTypeId="1" CreationDate="2016-01-08T10:47:04.257" Score="1" ViewCount="520" Body="&lt;p&gt;I am trying to create a simple recognition system. i have recordings of several speakers saying the same word, let's say &quot;west&quot;. I compute the MFCC feature vectors of word &quot;west&quot; from each speaker. If i have 10 speakers, i then have 10 matrices, each of them of dimensions N_frames * 13 (13 coeff and N_frames varies from speaker to speaker). I would now like to store a final matrix of dimension &#xA;M * 13 which will serve as a reference pattern for word &quot;west&quot;. My question is, how to &quot;average&quot; or combine MFCCs from different speakers? (i call this process some kind of training)&lt;/p&gt;&#xA;" OwnerUserId="18993" LastActivityDate="2016-01-08T11:18:57.283" Title="How to average MFCCs from different speakers saying the same word?" Tags="|speech-recognition|mfcc|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28159" PostTypeId="2" ParentId="28158" CreationDate="2016-01-08T11:18:57.283" Score="-1" Body="&lt;p&gt;What you can try is the DTW (Dynamic Time Warping) distance (&lt;a href=&quot;https://en.wikipedia.org/wiki/Dynamic_time_warping&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Dynamic_time_warping&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for each instance of the spoken word &quot;west&quot;, you compute MFCC's per frame and then calculate the DTW distance between each of the pre-recorded instances of word. this gives the rough estimate of the valid DTW distance. now when a new instance of the word comes we again calculate DTW with one of the earlier instance and if the DTW distance lies roughly in the range calculated before, it is the same word.   &lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-01-08T11:18:57.283" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28160" PostTypeId="2" ParentId="28153" CreationDate="2016-01-08T14:10:01.327" Score="1" Body="&lt;p&gt;I think voice masking is basicly a (phase-)vocoder. it uses ans external sound source as sound and use the formants as modulator. So the voice it self isn't used. In this way the voice can't be reconstruced to the original one.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://en.wikipedia.org/wiki/Vocoder&quot; rel=&quot;nofollow&quot;&gt;vocoder wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13541" LastEditorUserId="13541" LastEditDate="2016-01-12T10:09:54.480" LastActivityDate="2016-01-12T10:09:54.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28161" PostTypeId="2" ParentId="1369" CreationDate="2016-01-08T15:28:29.580" Score="1" Body="&lt;p&gt;Images quantized to some bit depth have error due to the quantization. Your filter also introduces error, compared to using an infinitely large ideal filter. Using larger and larger filters, eventually you will arrive at a knee in the total error vs filter size diagram where those two errors are equal. After that the quantization error dominates so it doesn't pay off much to improve the filter further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A commonly used error metric is &lt;a href=&quot;https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;peak signal-to-noise ratio&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-01-08T15:28:29.580" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28163" PostTypeId="2" ParentId="28154" CreationDate="2016-01-08T15:53:57.663" Score="7" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://dsp.stackexchange.com/a/28156/15892&quot;&gt;@hotpaw2 explanation&lt;/a&gt;, a graphic. There are two analog square waves (red and green), with different lengths. They are depicted with a fine sampling, denoted by crosses. Their actual sampling is denoted by circles. The  red one is shorter than the green one, as can be seen in the interval $]0.7\;0.8[$. Yet, the  sample points are the same. Thus, from the circled samples, you cannot tell one from the other. This  would happen for any square wave whose end falls inside the  blue segment. You can see here the loss of information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rSquA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rSquA.png&quot; alt=&quot;Two analog square waves&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the  most simple schemes  (using cardinal sines), these different sampled squares would be reconstructed as a single analog signal (as their  discrete samples are the same.) Depending on the  precision on the sampling, several analog-digital-analog signals can be theoretically recovered,  possessing a certain amount of ripples, or overshoot, or Gibbs phenomena.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RZUoL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RZUoL.png&quot; alt=&quot;Overshoot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can reduce the  ripples in the interior of the square wave (as seen going from blue to red to green), but the amplitude of the overshoot will remain constant  at the  vicinity of the  edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As commented by @robert bristow-johnson, there are a number of alternative techniques. The document &lt;a href=&quot;https://ccrma.stanford.edu/~stilti/papers/blit.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Alias-Free Digital Synthesis of Classic Analog Waveforms&lt;/a&gt; (Stilson and Smith) provides some of them. I add a recent technique, based on Finite-Rate-Innovation: &lt;a href=&quot;http://dx.doi.org/10.1109/ICASSP.2015.7179114&quot; rel=&quot;nofollow noreferrer&quot;&gt;Feasibility of {FRI}-based square-wave reconstruction with quantization error and integrator noise&lt;/a&gt;, B. He &lt;em&gt;et al.&lt;/em&gt;, ICASSP 2015.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, for your last question &quot;Why does superposition hold on such a simple construct?&quot; This can be regarded as a problem of approximating a non-continuous function on a basis on continuous ones: you can get pointwise convergence (all samples converge), but no uniform convergence (not all converge at the same rate).&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-01-09T12:08:53.897" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28164" PostTypeId="1" AcceptedAnswerId="28165" CreationDate="2016-01-08T18:05:57.953" Score="0" ViewCount="167" Body="&lt;p&gt;I have two signals: $x(n)$ is a white-noise signal with a given variance, $y(n)$ is the sum of white noise plus a sum of sinusoids.&#xA;$$&#xA;x(n) = v_1(n)&#xA;$$&#xA;$$&#xA;y(n) = \sum_{i=1}^{q} [ a_i \cos(\omega_i n) + b_i \sin(\omega_i n)  ] + v_2(n)&#xA;$$&#xA;$$&#xA;v_{1,2}(n) \sim W.N.(0,\sigma^2)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that is how I generate the two signals on Matlab. Now I'd like to normalise $y(n)$ so that its power is the same as $x(n)$, how can I do that?&lt;/p&gt;&#xA;" OwnerUserId="18997" LastEditorUserId="1629" LastEditDate="2016-01-08T22:33:17.583" LastActivityDate="2016-01-08T22:33:17.583" Title="Adjust the power of a digital signal to a given value" Tags="|discrete-signals|normalization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28165" PostTypeId="2" ParentId="28164" CreationDate="2016-01-08T18:22:17.003" Score="0" Body="&lt;p&gt;Multiply y(n) by std(x)/std(y)&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2016-01-08T18:22:17.003" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28166" PostTypeId="2" ParentId="28157" CreationDate="2016-01-08T18:32:42.480" Score="1" Body="&lt;p&gt;If you drive your AR model with white noise, you can generate a time series that has the same power spectral density as the original time series.  But it won't be the same time series.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2016-01-08T18:32:42.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28168" PostTypeId="1" CreationDate="2016-01-09T07:26:25.437" Score="3" ViewCount="659" Body="&lt;p&gt;TWO PART QUESTION - We've all seen the movies/TV shows where the police/feds/spies use computer software to take a grainy photo and do a &quot;clean-up&quot; to see a better picture and more details. I assume the concept is executed by some sort of &lt;strong&gt;uber-power&lt;/strong&gt; pixel-smoothing or anti-aliasing type of algorithms to fill in the blanks based on deductive processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PART 1: How &lt;em&gt;real&lt;/em&gt; is this technology in the public/commercial software world? I'm not asking about any &lt;em&gt;speculation&lt;/em&gt; on alleged secret gov software or such, I just want to know where we actually are with this concept today? How much is fully automated vs human-assisted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PART 2: Assuming there actually is &lt;em&gt;some&lt;/em&gt; reality with this technology for photographs the second part of this question is how (if at all) has this been applied to videos? Again the issue of fully automated vs human assisted is of interest here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the heart of this post is the ultimate question of how viable is today's software for being able to take an old VHS or DVD recording and process the frames to create a new HD-resolution remaster. Considering that doing this would mean cleaning up tens-of-thousands of frames for even a simple wedding video I am &lt;strong&gt;not&lt;/strong&gt; expecting this technology to be fast of course.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;NOTE: Per in-topic and meta discussions I went ahead and cross-posted this in two other suggested SE forums to acquire their viewpoints and expertise on this matter. So far (it is still a little &quot;early in the day&quot; so to speak) I have received some pretty interesting information in 2 of the 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this is all done (when good answers have been selected) I would appreciate a way to merge these &lt;strong&gt;for the benefit of all three SE communities&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Computer Graphics: &lt;a href=&quot;https://computergraphics.stackexchange.com/questions/1880&quot;&gt;https://computergraphics.stackexchange.com/questions/1880&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Signal Processing: &lt;a href=&quot;https://dsp.stackexchange.com/questions/28168&quot;&gt;What is the state-of-the-art of using signal-processing for &amp;quot;cleaning-up&amp;quot; videos?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Video Production: &lt;a href=&quot;https://video.stackexchange.com/questions/17363&quot;&gt;https://video.stackexchange.com/questions/17363&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19002" LastEditorUserId="60971" LastEditDate="2022-01-24T19:11:37.763" LastActivityDate="2022-01-31T06:30:24.437" Title="What is the state-of-the-art of using signal-processing for &quot;cleaning-up&quot; videos?" Tags="|image-processing|video-processing|superresolution|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28169" PostTypeId="1" AcceptedAnswerId="28186" CreationDate="2016-01-09T10:15:59.630" Score="7" ViewCount="7267" Body="&lt;p&gt;I've read the thread: &lt;a href=&quot;https://dsp.stackexchange.com/questions/9966/what-is-the-cut-off-frequency-of-a-moving-average-filter&quot;&gt;Cut off frequency of moving average&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I use the second answer in my algorithm to calculate the 3dB cut off frequency of my filter, which works great, as my filter length is usually above 300. I verified it with the step response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I would like to have a source or derivation for this formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried by hand with taylor series stopping after the second and third term. I come close but not exactly to the formula and mapple gives me a valid but extremly complicated result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope you guys can help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;kind regards&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Slev1n&lt;/p&gt;&#xA;" OwnerUserId="19003" LastEditorUserId="36718" LastEditDate="2020-10-20T19:47:38.713" LastActivityDate="2020-10-20T19:47:38.713" Title="3dB-Cut off frequency of moving average" Tags="|filter-design|finite-impulse-response|moving-average|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28170" PostTypeId="1" AcceptedAnswerId="28175" CreationDate="2016-01-09T10:51:53.300" Score="2" ViewCount="1068" Body="&lt;p&gt;I know about &lt;a href=&quot;https://en.wikipedia.org/wiki/Complementary_colors&quot; rel=&quot;nofollow noreferrer&quot;&gt;complimentary colors&lt;/a&gt; and how to get them, since colors are basically frequency / wavelengths.  &lt;strong&gt;Is it possible to find a signals complimentary, additive or subtractive frequencies in an audio file / from a signal.&lt;/strong&gt;  I know how to use FFT to get the phase, amplitude, and frequency of a signal.  I'm just looking for a general idea of how I would go about creating similar color charts but for sound, we have a color charts of complimentary, additive or subtractive colors do we have one for the sound / audio range of humans?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TDWxD.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TDWxD.gif&quot; alt=&quot;complimentary color chart&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QhIT7.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QhIT7.gif&quot; alt=&quot;additive or subtractive color charts&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1894" LastActivityDate="2016-04-10T21:39:47.593" Title="Finding a signals complimentary sound / frequency" Tags="|fft|audio|ifft|color|theory|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28171" PostTypeId="2" ParentId="28168" CreationDate="2016-01-09T11:15:12.670" Score="3" Body="&lt;p&gt;Entertainment industry greatly exaggerates what video enhancement can do.&lt;/p&gt;&#xA;&lt;h4&gt;2016 answer:&lt;/h4&gt;&#xA;&lt;h5&gt;Spatial and temporal noise reduction&lt;/h5&gt;&#xA;&lt;p&gt;Noise reduction by &lt;a href=&quot;https://www.neatvideo.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neat Video&lt;/a&gt; and &lt;a href=&quot;http://compression.ru/video/denoising/index_en.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MSU Denoiser Filter&lt;/a&gt;, which are somewhere at (according to &lt;a href=&quot;http://yuvsoft.com/pdf/video_denoiser_comparison.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;a comparison from 2007&lt;/a&gt;) or near state-of-the-art for hard noise, takes advantage of that adjacent frames usually are of the same scene but with independent noise. So noise can be filtered both spatially and temporally. But that kind of processing is in my experience just cosmetic. It does not really reveal things that a human would not already see through the noise, it just makes the video look nicer. Both filters have an option to adjust settings automatically, but because noise reduction seems always a compromise between noise reduction and introduction of artifacts, the final &amp;quot;strength&amp;quot; of noise reduction should be adjusted to taste manually.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Motion estimation and superresolution&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://compression.ru/video/super_resolution/super_resolution_en.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MSU Super-Resolution Filter&lt;/a&gt; reconstructs a new video at 2x horizontal and vertical resolution. It follows a similar paradigm as the above two filters, but also estimates motion between frames. The original pixelization (and other artifacts that do not follow the motion such as blocking and sensor Moiré) can be reduced by compensating for motion and then filtering temporally. This improves resolution and makes detailed things like pixel-deprived text and faces more clear. Resolution can be increased only if the pixelization is not properly anti-aliased. Artificial pixelization of faces, if not done carefully, could be reduced by the same or similar processing. This is a kind of enhancement that the human visual system is not accustomed to do natively, and can actually reveal hidden useful information.&lt;/p&gt;&#xA;&lt;h4&gt;2022 update:&lt;/h4&gt;&#xA;&lt;h5&gt;Deep learning-based methods&lt;/h5&gt;&#xA;&lt;p&gt;As is happening in many fields, these days the highest-quality results are obtained using deep learning-based methods. See for example Liang, Jingyun and Cao, Jiezhang and Fan, Yuchen and Zhang, Kai and Ranjan, Rakesh and Li, Yawei and Timofte, Radu and Van Gool, Luc. 2022. &lt;em&gt;VRT: A Video Restoration Transformer&lt;/em&gt;. &lt;a href=&quot;https://arxiv.org/abs/2201.12288&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv preprint arXiv:2108.10257&lt;/a&gt;, &lt;a href=&quot;https://github.com/JingyunLiang/VRT&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2022-01-31T06:30:24.437" LastActivityDate="2022-01-31T06:30:24.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28172" PostTypeId="1" AcceptedAnswerId="28180" CreationDate="2016-01-09T12:22:00.337" Score="1" ViewCount="338" Body="&lt;p&gt;I'm trying to calculate (with Matlab) the minimal and maximal Eigenvalues $\lambda_{min}$ and $\lambda_{max}$ of the autocorrelationmatrix $R$ to adjust the stepsize of an adaptive filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My input signal $x$ is a vector of colored noise.&#xA;And my plan is to do something like&#xA;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lmin = min(eig(xcorr(x)));&#xA;lmax = max(eig(xcorr(x)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it fails becaus 'For standard eigenproblem EIG(A), A must be square.'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is a little bit strange, because in my opinion the output of the autocorrelation is always just a vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help me to find the point, whether I need to use something else than Matlabs 'eig' function or if it's mathematically not possible to calculate the eigenvalues of a single vector.&lt;/p&gt;&#xA;" OwnerUserId="19005" LastActivityDate="2016-01-10T17:42:31.747" Title="Eigenvalues of a vector" Tags="|matlab|adaptive-filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28175" PostTypeId="2" ParentId="28170" CreationDate="2016-01-09T13:29:21.647" Score="1" Body="&lt;p&gt;Yes and no. Only monochromatic colors consist of a single wavelength, and those do not really &quot;wrap around&quot; in the form you describe. Color addition and subtraction have more to do with the three types of cone cells in our eyes than with wavelengths. Since there is no audio analogue to these cone cells, the concept of complimentary colors doesn't exist in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you consider &lt;em&gt;notes&lt;/em&gt; instead of frequencies, in the sense that two frequencies that are one or more octaves apart constitute the same note, then you can say that two notes are complimentary if they are a tritone apart.&lt;/p&gt;&#xA;" OwnerUserId="443" LastActivityDate="2016-01-09T13:29:21.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28176" PostTypeId="2" ParentId="28172" CreationDate="2016-01-09T13:38:03.643" Score="1" Body="&lt;p&gt;[Edited after a rank 1 mistake diagonalized by @Jazzmaniac]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;xcorr&lt;/code&gt; of a vector only yields a vector, on which you should build an  autocovariance matrix &lt;a href=&quot;https://dsp.stackexchange.com/a/28180/15892&quot;&gt;as proposed by @Peter K&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I remember well, the largest eigenvalue roughly grows as the dimension $n$.  The theory for these matrices is beyond my knowledge. You can get more information in &lt;a href=&quot;http://www.cl.cam.ac.uk/~aib29/MScdssrtnWrwck.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Largest eigenvalues and sample covariance matrices&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is common practice to normalize the covariance matrix, to get either biased  (&lt;code&gt;xcorr(x,'biased')&lt;/code&gt;) or unbiased (&lt;code&gt;xcorr(x,'unbiased')&lt;/code&gt;) estimators of the covariance matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my memory for  adaptive filtering, with the symmetry, one takes only half of the autocorrelation to generate the Toepliz matrix: for instance &lt;code&gt;xc = xcorr(x,'biased')&lt;/code&gt;, then &lt;code&gt;Rxx = toeplitz(xc(length(x):end))&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can follow with profit the derivation and Matlab codes in:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Hayes, Monson H., &lt;a href=&quot;http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0471594318.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Statistical Digital Signal Processing and Modeling&lt;/a&gt;, John Wiley &amp;amp; Sons, Inc., 1996, Chapter 9: Adaptive filtering (&lt;a href=&quot;http://fr.mathworks.com/matlabcentral/fileexchange/2183-statistical-digital-signal-processing-and-modeling&quot; rel=&quot;nofollow noreferrer&quot;&gt;with Matlab code&lt;/a&gt;),&lt;/li&gt;&#xA;&lt;li&gt;Poularikas, Alexander D. and Ramadan, Zayed M., &lt;a href=&quot;https://www.crcpress.com/Adaptive-Filtering-Primer-with-MATLAB/Poularikas-Ramadan/9780849370434&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adaptive Filtering Primer with MATLAB&lt;/a&gt; &lt;a href=&quot;https://www.crcpress.com/downloads/7043/&quot; rel=&quot;nofollow noreferrer&quot;&gt;(with Matlab code&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-01-10T17:42:31.747" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28177" PostTypeId="2" ParentId="28170" CreationDate="2016-01-09T13:51:27.593" Score="-1" Body="&lt;p&gt;A couple of ideas:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bass, mid, treble&lt;/li&gt;&#xA;&lt;li&gt;Transients, noise, sinusoids&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-01-09T13:51:27.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28180" PostTypeId="2" ParentId="28172" CreationDate="2016-01-09T18:21:08.610" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Autocorrelation_matrix&quot; rel=&quot;nofollow&quot;&gt;The autocorrelation matrix&lt;/a&gt; is a &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/toeplitz.html&quot; rel=&quot;nofollow&quot;&gt;Toeplitz symmetric matrix&lt;/a&gt; that can be formed as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Rxx = toeplitz(xcorr(x));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and that should give you a sensible (square) matrix that can be passed to &lt;code&gt;eig&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-09T18:21:08.610" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28182" PostTypeId="1" AcceptedAnswerId="28183" CreationDate="2016-01-09T19:21:32.113" Score="0" ViewCount="270" Body="&lt;p&gt;Recently I found my old code to transform sine wave from time domain to frequency domain. Below I post simplified version of it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from math import sin, pi&#xA;from matplotlib.pyplot import *&#xA;from pylab import zeros, fft&#xA;&#xA;fs = 500&#xA;duration = 2 * pi&#xA;amplitude = 2&#xA;frequency = 25&#xA;values_in_time_domain = []&#xA;&#xA;for t in range(int(duration * fs)):&#xA;    values_in_time_domain.append(amplitude * sin(frequency * t / fs))&#xA;&#xA;subplot(2, 1, 1)&#xA;title('Sinus from 0 to 2 pi in time domain; A = 2, f = 25, fs = 500')&#xA;plot(values_in_time_domain)&#xA;&#xA;transform = fft(values_in_time_domain)&#xA;transform_abs = [abs(x) for x in transform]&#xA;values_in_freq_domain = [transform_abs[f] / fs / pi for f in range(int(fs / 2)+1)]&#xA;&#xA;subplot(2, 1, 2)&#xA;title('Above sinus in frequency domain')&#xA;plot(values_in_freq_domain)&#xA;&#xA;show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why do I have to divide every element from &lt;code&gt;transform_abs&lt;/code&gt; by &lt;code&gt;pi&lt;/code&gt; in the following: &lt;code&gt;transform_abs[f] / fs / pi&lt;/code&gt;?&#xA;I noticed I need to do it in order to have properly scaled $O_y$ axis.&lt;/p&gt;&#xA;" OwnerUserId="19007" LastEditorUserId="8202" LastEditDate="2016-01-09T19:22:59.260" LastActivityDate="2016-01-09T20:01:37.667" Title="Why do I have to divide by $\pi$ in order to scale amplitude of sine frequency spectrum?" Tags="|fft|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28183" PostTypeId="2" ParentId="28182" CreationDate="2016-01-09T19:44:02.160" Score="1" Body="&lt;p&gt;The FFT should be divided by the number of elements in the vector.  You specified the vector length to be &lt;code&gt;duration = int(2*pi*fs)&lt;/code&gt; which is a really weird way to defining the length, btw.  Thus, you need to divide by &lt;code&gt;int(2*pi*fs)&lt;/code&gt;.  Yes, you need to divide by a 2 as well, because the signal energy is distributed evenly between positive and negative frequencies.  &lt;/p&gt;&#xA;" OwnerUserId="16238" LastEditorUserId="8202" LastEditDate="2016-01-09T20:01:37.667" LastActivityDate="2016-01-09T20:01:37.667" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28186" PostTypeId="2" ParentId="28169" CreationDate="2016-01-09T23:53:07.603" Score="12" Body="&lt;p&gt;Consider a zero-phase moving average of length $N$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{y}[n] = \begin{cases} \displaystyle\frac{\text{x}[n] + \displaystyle\sum_{k=1}^{\frac{N-1}{2}}\left(\text{x}[n+k] + \text{x}[n-k]\right)}{N},&amp;amp;n\in\mathbb{Z}&amp;amp;\text{for }N\text{ odd}\\&#xA;\displaystyle\frac{\displaystyle\sum_{k=1}^{\frac{N}{2}}\left(\text{x}[n+(k-\frac{1}{2})] + \text{x}[n-(k-\frac{1}{2})]\right)}{N},&amp;amp;n+\frac{1}{2}\in\mathbb{Z}&amp;amp;\text{for }N\text{ even}&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even-length filters operating on discrete sequences with integer time indices cannot be zero-phase. We have circumvented this by enabling the output time indices to always have a fractional part of $\frac{1}{2}$, in case of $N$ even. As a real-world example, if the input was sampled every midnight, the zero-phase moving average of even length would be calculated for every noon. This unusual indexing conveniently gives the same zero-phase form of frequency response $F_N(\omega)$ for both $N$ odd and $N$ even:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_N(\omega) = \begin{cases}&#xA;\displaystyle\frac{\displaystyle1 + \displaystyle\sum_{k=1}^{\frac{N-1}{2}}\left(e^{ik\omega}+e^{-ik\omega}\right)}{N}&amp;amp;\text{for }N\text{ odd}\\&#xA;\displaystyle\frac{\displaystyle\sum_{k=1}^{\frac{N}{2}}\left(e^{i(k-\frac{1}{2})\omega}+e^{-i(k-\frac{1}{2})\omega}\right)}{N}&amp;amp;\text{for }N\text{ even}&#xA;\end{cases}\\&#xA;= \frac{\sin(\frac{N\omega}{2})}{N\sin(\frac{\omega}{2})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the frequency response has no symbolic solution for the -3 dB cutoff frequency $\omega_c$, such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_N(\omega_c)=\sqrt{\frac{1}{2}}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strictly speaking $\sqrt{\frac{1}{2}}$ is about -3.01 dB, but I think that's what people mean when they say -3 dB, because otherwise it is just an arbitrary number. An approximate frequency response $\hat{F}_N(\omega)$ uses an integral instead of a sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{F}_N(\omega)=\frac{1}{N}\int_{-\frac{N}{2}}^\frac{N}{2}e^{ik\omega} = \frac{2\sin(\frac{N\omega}{2})}{N\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main lobes of the true (sum) and the approximate (integral) frequency responses converge at large $N$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/81VGp.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/81VGp.png&quot; alt=&quot;Comparison of frequency response and its approximation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can prove the convergence by introducing functions $G_N(\chi) = F_N(\omega)$ and $\hat{G}_N(\chi) = \hat{F}_N(\omega)$ with the argument normalized such that $\omega = \frac{2\pi\chi}{N}$, bringing the first zero of both functions to $\chi = 1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_N(\chi) = \frac{\sin(\pi\chi)}{N\sin\left(\frac{\pi\chi}{N}\right)}\\&#xA;\hat{G}_N(\chi) = \frac{\sin(\pi\chi)}{\pi\chi}\\&#xA;\lim_{N\rightarrow \infty}G_N(\chi) = \frac{\sin(\pi\chi)}{\pi\chi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$G_N(\chi)$ is known as the &lt;a href=&quot;https://ccrma.stanford.edu/~stilti/papers/blit.pdf&quot; rel=&quot;noreferrer&quot;&gt;$N$-periodic band-limited impulse train&lt;/a&gt;. Its limit at large $N$ and the function $\hat{G}_N(\chi)$ are both the &lt;a href=&quot;https://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;noreferrer&quot;&gt;$\text{sinc}$ function&lt;/a&gt;. Unfortunately the -3 dB cutoff frequency has no symbolic solution in the approximation $\hat{F}_N(\omega)$ either. For different $N$, the approximation only differs from the $N = 1$ approximation by a mapping $\omega \rightarrow \omega N$, so it suffices to solve the approximate -3 dB cutoff frequency $\hat\omega_c(N)$ numerically for $N = 1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{2\sin(\frac{\hat\omega_c(1)}{2})}{\hat\omega_c(1)} = \sqrt{\frac{1}{2}}\\&#xA;\Rightarrow\hat\omega_c(1) = 2.78311475650302030063992,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;giving the approximate cutoff frequency for arbitrary $N$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat\omega_c(N) = \frac{\hat\omega_c(1)}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That appears to be another, simpler approximation than Massimo's. For your $N &amp;gt; 300$ there should be no problem using it. Massimo's and this answer's constants are related by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\hat\omega_c(1)}{2\pi} = 0.442946470689452340308369.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked a bit further and found that Massimo approximates $F_N(\omega)$ with $\hat{F}_M(\omega)$, choosing $M$ such that the (limits of the) second derivatives of the frequency response and the approximation match at $\omega = 0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F''_N(\omega)=\frac{\sin(\frac{N \omega}{2}) \left(2 \sin(\omega) \cos(\frac{\omega}{2}) + (N^2 - 1) \sin(\frac{\omega}{2}) (\cos(\omega) - 1)\right)}{2 N (\cos(\omega) - 1)^2}  - \frac{2 N \sin(\omega) \sin(\omega/2) \cos(\frac{N \omega}{2})}{2 N (\cos(\omega) - 1)^2}\\&#xA;\hat{F}''_M(\omega)=\left(\frac{4}{M \omega^3} - \frac{M}{2 \omega}\right) \sin\left(\frac{M \omega}{2}\right) - \frac{2 \cos(\frac{M \omega}{2})}{\omega^2}\\&#xA;\lim_{\omega\rightarrow 0}F''_N(\omega) = \frac{1-N^2}{12}\\\lim_{\omega\rightarrow 0}\hat{F}''_M(\omega) = -\frac{M}{12}\\&#xA;\lim_{\omega\rightarrow 0}F''_N(\omega) = \lim_{\omega\rightarrow 0}\hat{F}''_M(\omega)\\&#xA;\Rightarrow M = \sqrt{N^2 - 1}\\&#xA;\Rightarrow \hat\omega_c(M) = \frac{\hat\omega_c(1)}{\sqrt{N^2 - 1}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This improves the approximation at small $\omega$ which includes the -3dB cutoff point, especially at small $N$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qPlNy.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qPlNy.png&quot; alt=&quot;Massimo&amp;#39;s approximation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Massimo's approximation always overestimates the cutoff frequency (see the &lt;a href=&quot;https://dsp.stackexchange.com/a/28263/15347&quot;&gt;error comparison&lt;/a&gt;), leaving room to improve it by altering the constant $1$. The error is the largest for $N = 2$. If its error is constrained equal to the (currently second largest) error at $N = 3$, we get an even better but just as cheap approximation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat\omega_c(N) = \frac{2.78311475650302030063992}{\sqrt{N^2 - 0.8603235992780290790596}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This and other tweaks of the constant, like &lt;a href=&quot;https://dsp.stackexchange.com/a/28267/15347&quot;&gt;Matt's constant $0.863031932778066$&lt;/a&gt;, work surprisingly well for large $N$ (see the &lt;a href=&quot;https://dsp.stackexchange.com/a/28263/15347&quot;&gt;error comparison&lt;/a&gt;). For large $N$ the error falls by a factor of 1000 for every increase of $N$ by a factor of 10. The explanation for these things is that the true cutoff frequency as a function of $N$ has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Laurent_series&quot; rel=&quot;noreferrer&quot;&gt;Laurent series&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_c(N) = \displaystyle\sum_{k=0}^{\infty}\frac{a_k}{N^k},\ a_k = 0\text{ if }k\text{ even},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the approximation and its Laurent series are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat\omega_c(N) = \frac{a}{\sqrt{N^2+c}}\\= \frac{a}{N} - \frac{ac}{2N^3} + \frac{3ac^2}{8N^5} - \frac{5ac^3}{16N^7} + \frac{35ac^4}{128N^9} - \ldots,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;such that:&#xA;$$a_1 = a = 2.78311475650302030063992\\&#xA;a_3 \approx -\frac{ac}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the approximate match in the $N^{-3}$-term was made exact, the approximation error should decrease by a factor of $10^5$ for an increase of large $N$ by a factor of $10$. The coefficients $a_k$ of the Laurent series $f(x) = \sum_{k=0}^{\infty}\frac{a_k}{x^k}$ of a function $f(x)$ as $x\rightarrow\infty$ can be found iteratively by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_0(x) = f(x)\\&#xA;a_k = \lim_{x\rightarrow\infty}f_k(x)\\&#xA;f_{k+1}(x) = \left(f_{k}(x)-a_k\right)x$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we do not have $f(x)$ in symbolic form, but can solve it numerically to any precision for very large $x$, we can do the equivalent of the above procedure numerically. The following Python script that uses &lt;code&gt;SymPy&lt;/code&gt; and &lt;code&gt;mpmath&lt;/code&gt; will calculate a given number (here 10) of the first coefficients $a_k$ in the desired precision for the Laurent series of the true cutoff frequency:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from sympy import *&#xA;from mpmath import *&#xA;num_terms = 10&#xA;num_decimals = 24&#xA;num_use_decimals = num_decimals + 5 #Ad hoc headroom&#xA;def y(omega):&#xA;    return sin(N*omega/2)/(N*sin(omega/2))-sqrt(0.5)&#xA;&#xA;a = []&#xA;h = mpf('1e'+str(num_decimals))&#xA;for i in range(0, num_terms):&#xA;    mp.dps = 2*2**(num_terms - i)*num_use_decimals*(i + 1) #Ad hoc headroom&#xA;    N = mpf('1e'+str(2**(num_terms - i)*num_use_decimals))&#xA;    r = findroot(y, [2.7/N, pi/N]) #Safe search range&#xA;    for j in range(0, i):&#xA;        r = (r - a[j])*N&#xA;    a.append(r)&#xA;    mp.dps = num_decimals&#xA;    print 'a_'+str(i)+' = '+str(nint(r*h)/h)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;On my computer the program runs for about 7 minutes. It prints the following, showing that the Laurent series consists only of odd negative powers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a_0 = 0.0&#xA;a_1 = 2.78311475650302030063992&#xA;a_2 = 0.0&#xA;a_3 = 1.20103120331802052770586&#xA;a_4 = 0.0&#xA;a_5 = 0.767601805674195789947052&#xA;a_6 = 0.0&#xA;a_7 = 0.537174869947196574599614&#xA;a_8 = 0.0&#xA;a_9 = 0.387986305863698148870773&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These numbers, shown to 24 decimal places, are not from an approximation in the sense that the Laurent series is unique; there is no other Laurent series that equals $\omega_c(N)$. Using only $a_1$ and $a_3$, a simple two-term truncated Laurent series approximation can be constructed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat\omega_c(N) = \frac{2.78311475650302030063992}{N} + \frac{1.20103120331802052770586}{N^3},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and by $c=-\frac{2a_3}{a_1}$ the approximation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat\omega_c(N) = \frac{2.78311475650302030063992}{\sqrt{N^2-0.863084212040982824494534}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both have $1/N^5$ error decay at large $N$, see &lt;a href=&quot;https://dsp.stackexchange.com/a/28263/15347&quot;&gt;error comparison&lt;/a&gt;, columns h) and i) respectively. A longer truncated Laurent series with more terms from the script's output decays even faster, $1/N^{11}$ for the 5-term approximation at column j) in the error comparison.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2016-01-25T15:59:01.470" CommentCount="23" ContentLicense="CC BY-SA 3.0" />
  <row Id="28187" PostTypeId="1" AcceptedAnswerId="28198" CreationDate="2016-01-10T02:16:02.233" Score="3" ViewCount="5870" Body="&lt;p&gt;I am trying to filter my force signal using Butterworth low pass filter.&lt;a href=&quot;https://i.stack.imgur.com/nes1G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nes1G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so this is the signal, I  have to filter (noise frequency is around 33 Hz). So when I use Butterworth filter with following command in MATLAB (with sixth order):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[B,A]=butter(6,5/100,'low');&#xA;forceS=filter(B,A,forceS);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the result I get is &#xA;&lt;a href=&quot;https://i.stack.imgur.com/beYhm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/beYhm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the problem is the filtered signal start from zero mark instead of around 1.5. How can i start the filtered signal from the same value as unfiltered signal has?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="19011" LastEditorUserId="80" LastEditDate="2016-11-21T08:39:28.217" LastActivityDate="2016-11-21T08:39:28.217" Title="Why Butterworth filter always starts my signal from from zero mark (amplitude)?" Tags="|matlab|filters|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28188" PostTypeId="1" AcceptedAnswerId="28192" CreationDate="2016-01-10T09:49:47.940" Score="6" ViewCount="3374" Body="&lt;p&gt;I am a bit confused with the concept of band limited wavetables and the methods such as BLET, BLIP, MinBLEP, polyBLEP etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I understand certain waveforms contain infinite harmonics, which alias back into the signal, even if they were generated at a certain frequency below the Nyquist rate. According to this paper &lt;a href=&quot;https://ccrma.stanford.edu/~stilti/papers/blit.pdf&quot; rel=&quot;noreferrer&quot;&gt;Alias-Free Digital Synthesis of Classic Analog Waveforms&lt;/a&gt;, these basic waveforms have aliasing &quot;due to having to round off the discontinuity time to the nearest available sampling instant&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What and were is the discontinuity of the waveform if the wavetable contains e.g. a full cycle of a sawtooth wave at a certain frequency? (where looping the table will restart the new cycle from the last point of the old one)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading through some code on how &lt;a href=&quot;http://www.experimentalscene.com/articles/minbleps.php&quot; rel=&quot;noreferrer&quot;&gt;MinBLEPs&lt;/a&gt; work, Im confused with how all these steps are linked. E.g. the signal is windowed and FFT'd and I assume the cepstrum function is used to look for the discontinuity inside the FFT bins. I dont get what the minimum phase is used for. The signal is then run through the iFFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I please need help in understanding how all these techniques are combined and what exactly is done in the practical sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After all of this, is the minBLEP a kind of wavelet that is stored in a buffer and then applied to the signal being generated, so that it smooths the discontinuities? At first I thought this was all done inside an oscillator which needs some level of look ahead to constantly detect discontinuities and apply the minBLEP wavelet at the correct time, but now I don't get how this is done inside the wavetable generator function itself (offline), that an oscillator can just scan in real time.&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2016-01-10T10:45:07.200" LastActivityDate="2022-02-21T18:45:37.030" Title="Band limited wavetables" Tags="|audio|oscillator|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28189" PostTypeId="1" CreationDate="2016-01-10T10:25:19.473" Score="1" ViewCount="854" Body="&lt;p&gt;From my understanding PSD tries to give a good estimation on the power each frequency attributes to the overall signal power. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am only interested in a frequency range $(\omega_0 \leq \omega \leq \omega_1)$, could I put the signal through a band pass filter for that same frequency range then calculate the signal power using this formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_x = \frac{1}{N_1 - N_0 + 1}\sum_{n = N_0}^{n=N_1} \left|x(n)\right|^2  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would this technique give me what I am looking for, (the power of the signal from $N_0$ to $N_1$ for the specific frequency range)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this compare to PSD estimation using any of the popular techniques?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pros, Cons?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="18999" LastEditorUserId="1629" LastEditDate="2016-01-10T19:26:30.060" LastActivityDate="2019-12-22T17:03:20.523" Title="Apply band pass filter (BPF) before calculating the power of a signal (PSD)?" Tags="|discrete-signals|signal-analysis|bandpass|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28190" PostTypeId="1" AcceptedAnswerId="28193" CreationDate="2016-01-10T10:56:08.627" Score="0" ViewCount="1790" Body="&lt;p&gt;I read lots of things about Kalman filtering, but in order to fully understand it, I would probably need to see it working on some data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would you have a &lt;strong&gt;minimal example&lt;/strong&gt; (Python code or any other language) showing what it does on some real data $x[n]$, where $n$ is the time?&lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2016-01-11T09:47:04.807" Title="Kalman filter : simple code example" Tags="|filters|kalman-filters|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28191" PostTypeId="1" AcceptedAnswerId="28200" CreationDate="2016-01-10T11:07:14.397" Score="0" ViewCount="1095" Body="&lt;p&gt;I'm having some trouble with understanding the DFT of a sawtooth single period signal and its relation with sawtooth Fourier coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have a signal&#xA;$$&#xA;s(t) = \frac{At}{T} - \frac{A}{2} \qquad t\in[0,T)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I plot its DFT real and imaginary components I have something like this&#xA;&lt;a href=&quot;https://i.stack.imgur.com/2Uy9i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2Uy9i.png&quot; alt=&quot;sawtooth dft&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $A=10$, $T=1$, $N=50$ (number of samples) and the DFT is normalized by $\tau = T/N$ and $1/N/\tau$ for the inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the imaginary part as far as I can understand comes from the Fourier coefficients&#xA;$$&#xA;c_n = \frac{iA}{2\pi N}&#xA;$$&#xA;These coefficients (see e.g. Brigham, section 5.2) equal the fourier transform $S(t)$ scaled by $\frac{1}{T}$ and sampled at $n/T$. Given we have a discrete signal, we need to account for aliasing in the frequency space, which can be represented by repeating $c_n$ at $N$ intervals and summing with themselves, something like the following? &lt;em&gt;probably missing a constant&lt;/em&gt;&#xA;$$&#xA;Im(S_n) = \sum_{m=-\infty}^{\infty} c_n\delta(n-mN) \qquad n \in [0,N-1]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about the non zero real part? As an afterthought I can rationalize it because the sawtooth is non zero at $t=0$, so it must have a non zero mean DFT. But if I take a sawtooth centered in $-T/2,T/2$ it's still there even if the signal crosses the origin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to find a better relation that gets me from the Fourier series to the DFT, accounting both for the imaginary and the real part. Any pointer to good resources to help understand the whole thing would be more than welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just looking at the DFT, the real part, with my normalization should be:&#xA;$$&#xA;-\frac{A}{2}\tau\sum_{n=-\infty}^{\infty}\delta\left(f-\frac{n}{T}\right)&#xA;$$&#xA;How do I justify this result? especially the multiplication factor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(sorry if the math is a bit flaky, I'm still trying to understand everything about DFT, Dirac combs and most of all normalization constants, every single source has them different...)&lt;/p&gt;&#xA;" OwnerUserId="18984" LastEditorUserId="18984" LastEditDate="2016-01-11T04:12:40.410" LastActivityDate="2016-01-11T18:27:51.303" Title="Relation between sawtooth Fourier coefficients and its DFT" Tags="|dft|fourier-series|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28192" PostTypeId="2" ParentId="28188" CreationDate="2016-01-10T13:16:55.707" Score="13" Body="&lt;p&gt;It looks like you are mixing up two techniques: MinBLEP and band-limited wavetables.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Band-limited wavetables&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Let's assume you have a 256 sample long array with a waveform of interest - for example a naive sawtooth, with the first sample in your array at -1 and the last sample at 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To replay this data at a variable pitch, two techniques are possible:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you can control the rate at which the data is played. For example, to get a 440 Hz pitch, you replay the 256 samples verbatim, at a rate of 112640 Hz. This is possible with custom hardware, and is the technique used in early wavetable synthesizers (PPG Wave, Prophet VS). This requires one clock/DAC per oscillator, and is rather expensive!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you use a fixed sample-rate, and you modify the pitch by interpolation through the wavetable. Let's say the sample rate is 48kHz. Playing the data one sample after the other yields a tone with a frequency of $48000 / 256 = 187.5$ Hz. To play a tone at 440Hz, you would need to play the data at $440 / (48000 / 256)=2.35$ its original rate, and that's where you get into trouble. Two ways of understanding why:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You can consider the discontinuity. You'll reach the end of the table and &quot;wrap around&quot; between the 109th and 110th sample. So the discontinuity should actually be located between these samples.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Or you can think in terms of frequency content: by playing the data at 2.35 its original rate, any harmonic it contains at a frequency above nyquist / 2.35 will be aliased.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are two ways of dealing with the problem. A first approach is to use &lt;a href=&quot;https://ccrma.stanford.edu/~jos/resample/What_Bandlimited_Interpolation.html&quot; rel=&quot;noreferrer&quot;&gt;band-limited interpolation&lt;/a&gt;, which is a way of replaying the data in such a way that aliased components are filtered. Another solution is to pre-compute several variants of your waveform in which the highest harmonics are progressively filtered. For example, when you have to playback the data at twice its original rate, you use a different sawtooth wavetable in which all harmonics above nyquist/4 are filtered-out. Obviously, you can't have a table ready for every possible playback rate, so a common solution is to pre-compute a dozen of such tables (for example one per octave), and interpolate between them. Korg did that on their DW series, I used it on my DIY AVR-based synths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are different ways of building such a band-limited table. You can work by additive synthesis (adding the right number of harmonics), or try to derive the band-limited waveforms by operations on a band-limited impulse (sinc waveform).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;minBlep&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This technique is completely unrelated to wavetable synthesis. The idea is to precompute a table containing a band-limited and causal step waveform. This computation is done once and for all, and involves an FFT/IFFT - that's probably where you encountered these operations, which are used only at this offline step. The code you link to in your question only covers this step!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in real-time, you generate the naive waveform, and whenever there is a discontinuity in the waveform, you add, over the next 40 samples or so, samples from the band-limited step table to smooth the edge. Which samples you need to add from the minBlep table are determined by the fractional sample at which the discontinuity occurs. No look-ahead is involved: the point of &lt;strong&gt;min&lt;/strong&gt;BLEP is that the correction is causal, so you don't have to start adding it before the discontinuity occurs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the computational cost of this method will increase as the frequency goes up, since the discontinuities will be more frequent - you'll have to keep track of an increasing number of overlapping corrections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wouldn't recommend minBLEP by the way. PolyBLEP uses a polynomial approximation of the band-limited step function and yields very good results. No lookup data is required and the code is easier to write because the correction only lasts for a handful of samples.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The two together?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;It would be a strange idea to mix the two techniques together, but someone could use minBLEP offline to precompute a band-limited sawtooth for various band-limiting ratios. For example, a 256 sample-long naive sawtooth, then a 256 sample-long sawtooth with no harmonic above 0.25, then a 256 sample-long sawtooth with no harmonic above 0.125... And then one could use wavetable playback to replay them - selecting/crossfading one of these tables depending on the required playback rate. This would be a bit odd, there are simpler ways of building wavetables!&lt;/p&gt;&#xA;" OwnerUserId="943" LastActivityDate="2016-01-10T13:16:55.707" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28193" PostTypeId="2" ParentId="28190" CreationDate="2016-01-10T13:59:53.600" Score="1" Body="&lt;p&gt;I created a simple example with Scilab/XCOS. It is a simulation of lowpass filter with noise. It is observed by a kalman filter. You can also insert some uncertainties in the system model. With XCOS you can simulate the system. The results will be plotted automatically.&#xA;Here is the &lt;a href=&quot;https://tubcloud.tu-berlin.de/index.php/s/Aovm5lp0dF19f2O&quot; rel=&quot;nofollow&quot;&gt;Downloadlink&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Little help with scilab:&#xA;Go to the directory with standard unix command &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cd /home/workingdir/Kalman_Example&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There you should execute &lt;code&gt;getd()&lt;/code&gt; to load all functions (.sci-files) in the directory.&#xA;Then you can execute the modeling.sce  file, which is just an initializing script: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;exec('modelling.sce')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then type&lt;code&gt;xcos simulation_kalm1.zcos&lt;/code&gt; into the console. A graphic window will open. Press the play button and the simulation will start.&lt;/p&gt;&#xA;" OwnerUserId="18874" LastEditorUserId="5648" LastEditDate="2016-01-11T09:47:04.807" LastActivityDate="2016-01-11T09:47:04.807" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28194" PostTypeId="1" AcceptedAnswerId="28195" CreationDate="2016-01-10T14:31:49.620" Score="0" ViewCount="4549" Body="&lt;p&gt;If I have a time series defined by a series like&lt;br&gt;&#xA;$$&#xA;x = [a_1, a_2, a_3, ..., a_n]  &#xA;$$&#xA;for time from $t = 1$ to $t = n$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I get to the power of the signal in this form:&#xA;$$&#xA;P_x = [p_1, p_2, p_3, ..., p_n]&#xA;$$&#xA;Can I use this formula and make it so $N_0 = N_1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P_x=\frac{1}{N_1-N_0+1}\sum_{n=N_0}^{n=N_1}\left|x(n)\right|^2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then calculate the $P$ value for every instance in $X(t)$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="18999" LastEditorUserId="10194" LastEditDate="2016-01-10T21:50:27.780" LastActivityDate="2016-01-10T21:50:27.780" Title="How to calculate the discrete power of a discrete signal?" Tags="|discrete-signals|signal-analysis|power-spectral-density|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28195" PostTypeId="2" ParentId="28194" CreationDate="2016-01-10T14:44:08.613" Score="1" Body="&lt;p&gt;The instantaneous power is simply $p(k) = x^2(k)$. The signal energy is given by $W_x = \sum_{k=0}^{k=N} x^2(k) $.&lt;/p&gt;&#xA;" OwnerUserId="18874" LastActivityDate="2016-01-10T14:44:08.613" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28196" PostTypeId="1" AcceptedAnswerId="28225" CreationDate="2016-01-10T14:58:39.780" Score="1" ViewCount="1573" Body="&lt;p&gt;For a lock-in amplifier I am downsampling the demodulated baseband signal  prior to the final low pass filtering. This lock-in amplifier is implemented on an FPGA (myRIO of National Instruments).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore I use CIC filters. I've reading a lot in Hogenauers paper and in &quot;Understanding digial signal processing&quot;, by Richard Lyons. My downsampling rates are between 512 and 2048 (always powers of 2) as I want to decimate my input signal down to less than 100 Hz (e.g. 48kHz sampling will be decimated to 93Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gain of the CIC output is scaled to the CICs input by a simple bitshift afterwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any disadvantage using even higher decimation rates?&lt;/p&gt;&#xA;" OwnerUserId="19003" LastEditorUserId="13320" LastEditDate="2016-01-11T19:48:13.313" LastActivityDate="2016-01-11T19:48:13.313" Title="Disadvantage of high downsampling rates with CIC filters" Tags="|decimation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28197" PostTypeId="2" ParentId="28189" CreationDate="2016-01-10T15:10:05.347" Score="-1" Body="&lt;p&gt;You can switch to the frequency domain with regards to &lt;a href=&quot;https://en.wikipedia.org/wiki/Parseval&amp;#39;s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's theorem&lt;/a&gt;. I guess you can transform your problem via &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete-time fourier transformation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18874" LastEditorUserId="18874" LastEditDate="2016-01-10T16:11:47.850" LastActivityDate="2016-01-10T16:11:47.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28198" PostTypeId="2" ParentId="28187" CreationDate="2016-01-10T16:27:15.937" Score="6" Body="&lt;p&gt;Filters do have a delay (a lag) since they do not act immediately on your signal. Also all samples before the time 0 are zeros, thus in general you will start from the &quot;zero mark&quot;, as you said (just imagine your filter equation with all zeros).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are ways to make a filter to have a zero lag. It is done by so called zero-phase filtering, also known as forward-backward filtering. The way you do it is by filtering your signal twice - in forward and in backward direction. Obviously this can work only for offline applications. In MATLAB you can do it very easily using the &lt;a href=&quot;http://uk.mathworks.com/help/signal/ref/filtfilt.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;filtfilt&lt;/strong&gt;&lt;/a&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please find below a code corresponding to your case.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs = 100;&#xA;T = 2;&#xA;t = 0:1/fs:T;&#xA;f = 2;&#xA;s = 1.5*cos(2*pi*f*t) + 0.7*sin(2*pi*33*t);&#xA;&#xA;[B,A]=butter(6, 5/fs,'low');&#xA;S=filter(B, A, s);&#xA;Sff=filtfilt(B, A, s);&#xA;&#xA;plot(t, s)&#xA;hold on&#xA;plot(t, S)&#xA;plot(t, Sff)&#xA;grid on&#xA;legend({'Original signal', 'Signal filtered using filter', 'Signal filtered using filtfilt'})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That yields what I suspect you want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oEdB2.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oEdB2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-01-10T16:27:15.937" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28199" PostTypeId="1" CreationDate="2016-01-10T16:27:29.773" Score="0" ViewCount="1366" Body="&lt;p&gt;Consider a DSBSC signal &lt;code&gt;s(t) = m(t).cos(2.pi.20k.t)&lt;/code&gt; where say &lt;code&gt;m(t)&lt;/code&gt; is multi-tone signal with frequencies less than 5 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectrum gives a typical bandpass say triangle centred around 20k and -20k.&#xA;Now, when I calculate the minimum sampling rate;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the highest frequency is not an integer multiple of bandwidth of the bandpass signal; I end up getting the sampling rate as 25 KHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I draw the spectrum for the sampling rate of 10 kHz, the message signal centred at origin was doubled in amplitude and there was no aliasing as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that mean the minimum sampling rate is indeed 10 kHz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the typical bandpass sampling rate procedure many times, this was the first time it failed in giving me the minimum sampling rate!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit: &lt;strong&gt;I doubt that the 10 kHz would be the minimum sampling rate to recover the message signal while the bandpass sampling rate of 25 kHz is the one which recovers the bandpass spectrum!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if the above conclusion is correct, is it independent of the carrier frequency (Fc&gt;&gt;Fm)?&lt;/p&gt;&#xA;" OwnerUserId="18535" LastEditorUserId="39" LastEditDate="2016-01-11T08:21:35.860" LastActivityDate="2016-01-11T08:21:35.860" Title="Minimum Sampling Rate of Bandpass signal" Tags="|filters|frequency-spectrum|sampling|demodulation|bandpass|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28200" PostTypeId="2" ParentId="28191" CreationDate="2016-01-10T18:31:25.090" Score="1" Body="&lt;p&gt;Let me use the definitions of the Fourier series and the DFT as they are commonly used in signal processing. The Fourier series of a $T$-periodic function $f(t)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\sum_{k=-\infty}^{\infty}c_ke^{j2\pi kt/T}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $c_k$ are the complex Fourier coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_k=\frac{1}{T}\int_0^Tf(t)e^{-j2\pi kt/T}dt\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The length-$N$ DFT of a sequence $x[n]$ is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the inverse DFT is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you sample $f(t)$ at $t=n\tau$ with $\tau=T/N$ you can approximate the integral $(2)$ by the following sum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_k\approx\frac{1}{T}\sum_{n=0}^{N-1}f(n\tau)e^{-j2\pi kn\tau /T}\tau\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $x[n]=f(n\tau)$ and $\tau=T/N$, Eq. $(5)$ can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_k\approx\frac{1}{N}\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}=\frac{1}{N}X[k],\qquad |k|\le\left\lfloor \frac{N}{2}\right\rfloor\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation $(6)$ says that the Fourier series coefficients $c_k$ of the $T$-periodic function $f(t)$ are approximated by the (scaled) DFT coefficients of the sequence $x[n]=f(n\tau)$, with $\tau=T/N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this is also the case for your function. With&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=A\left(\frac{t}{T}-\frac12\right),\qquad 0\le t&amp;lt; T\tag{7} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $f(t)=f(t+T)$, we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=f(nT/N)=A\left(\frac{n}{N}-\frac12\right),\qquad 0\le n&amp;lt; N \tag{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier coefficients of $f(t)$ are &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_k=\frac{jA}{2\pi k}\tag{9}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFT of $x[n]$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\begin{cases}-\frac{A}{2},&amp;amp;\quad k=0\\&#xA;\frac{A}{e^{-j2\pi k/N}-1} = e^{j\pi k/N} \frac{jA/2}{\sin(\pi k/N)}=\frac{A}{2}(-1+j\cot(\pi k/N)),&amp;amp;\quad 0&amp;lt;k&amp;lt;N&#xA;\end{cases}\tag{10}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing to notice is that $f(t)$ is an odd function (with a discontinuity at $t=0$), and, consequently, its Fourier coefficients are purely imaginary. On the other other hand, the sampled version of $f(t)$ is not odd because $x[0]\neq 0$; that's why we get a (relatively small) non-zero real part in the DFT coefficients. However, as predicted by Eq. $(6)$, the scaled DFT coefficients $X[k]/N$ still approximate the Fourier coefficients quite well. The zero real part of $c_k$ is &quot;approximated&quot; by the value $-A/2N$, which is small for large $N$. The figure below shows the imaginary part of $X[k]/N$ (red) and the (imaginary part of the) Fourier coefficients $c_k$ (blue):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Otnhh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Otnhh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The increasing difference between $c_k$ and $X[k]/N$ with increasing $k$ is due to aliasing caused by sampling $f(t)$. Note that $f(t)$ is not band-limited, so you will always have some amount of aliasing, no matter how fast you sample. The difference in the real part ($-A/2N$ vs $0$) is caused by the fact that $f(t)$ is odd, but $x[n]$ isn't because $x[0]=f(0^+)=A/2\neq 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;&lt;strong&gt;EDIT:&lt;/strong&gt; Here comes the derivation of the DFT of $x[n]$ defined by $(8)$. From $(3)$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\frac{A}{N}\sum_{n=0}^{N-1}ne^{-j2\pi nk/N}-\frac{A}{2}\sum_{n=0}^{N-1}e^{-j2\pi nk/N}\tag{a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's first consider the case $k=0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X[0]&amp;amp;=\frac{A}{N}\sum_{n=0}^{N-1}n-\frac{A}{2}\sum_{n=0}^{N-1}1\\&amp;amp;=&#xA;\frac{A}{N}\frac{(N-1)N}{2}-\frac{AN}{2}\\&amp;amp;=-\frac{A}{2}\end{align}\tag{b}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $k\neq 0$, the second term in Eq. (a) equals zero. From the formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N-1}nq^n=\frac{(N-1)q^{N+1}-Nq^N+q}{(1-q)^2},\qquad q\neq 1\tag{c}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(which can be obtained by taking the derivative of the standard formula for a geometric series), and by noting that $e^{-j2\pi k}=1$, we get after some manipulations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X[k]&amp;amp;=\frac{A}{N}\sum_{n=0}^{N-1}ne^{-j2\pi nk/N}\\&amp;amp;=\ldots\\&amp;amp;=\frac{A}{e^{-j2\pi k/N}-1},\qquad k\neq 0\end{align}\tag{d}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which all other representations shown in Eq. $(10)$ can be derived quite easily.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-11T18:27:51.303" LastActivityDate="2016-01-11T18:27:51.303" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="28201" PostTypeId="2" ParentId="28168" CreationDate="2016-01-10T19:25:56.057" Score="2" Body="&lt;p&gt;I have recently discussed image restoration with a team of one of the French forensics police departments. They have issues related to dirty/spider web nested lens, wrong illumation, occlusions related to poor camera location, very low frame rates in MPEG compression, shaking with low-res smartphone lens, proprietary video file formats. Problems are different  from some idealized models used on academic papers (known psf, contraints), generally more complex, so movies/TV shows performance are overrated, as said  in the following cartoon:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aUwnt.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aUwnt.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This team was using Amped Five solutions, but I understood that they would have been interesed in having muuch better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lecture notes in passing: &lt;a href=&quot;https://www.ri.cmu.edu/pub_files/pub3/baker_simon_2002_4/baker_simon_2002_4.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Limits on Super-Resolution and How to Break Them&lt;/a&gt;, Bakker and Kanade, 2002.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-10T19:25:56.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28202" PostTypeId="1" AcceptedAnswerId="28206" CreationDate="2016-01-10T20:33:43.840" Score="2" ViewCount="1392" Body="&lt;p&gt;As a non maths-pro, I'm looking for some pointers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am rewriting the audio core in my emulator to improve accuracy, and am getting a bit stuck on the specifics of the technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to resample a sample buffer of 4,466 samples, at a sample rate of 223,807.5 Hz (from a simulated Yamaha SN76489), to a sample buffer of 880 samples at a sample rate of 44,100 Hz, which can then be output to a sound card.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now from what I understand, as the ratio between 44,100 and 223,807.5 Hz is 5.075, I need to turn this into a fraction, which works out as 203/40, and then interpolate by the denominator (leaving 0 samples inbetween), run a low-pass filter, and then decimate by the numerator, giving me my 880 samples of 44,100 Hz output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) Am I along the right lines here? Before I was just downsampling by a straight 5 (i.e. missing out 4 of every 5 samples) and whilst it worked well enough, some notes are slightly out of key in some games, and there is aliasing. Is this new approach correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) Also, I am not sure what would do the trick in terms of a low-pass filter. I found the following pseudocode on wikipedia that seems to fit the bill:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // Return RC low-pass filter output samples, given input samples,&#xA;    // time interval dt, and time constant RC&#xA;    function lowpass(real[0..n] x, real dt, real RC)&#xA;       var real[0..n] y&#xA;       var real α := dt / (RC + dt)&#xA;       y[0] := x[0]&#xA;       for i from 1 to n&#xA;           y[i] := α * x[i] + (1-α) * y[i-1]&#xA;       return y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I have no idea how to get RC and dt - what are these in relation to the filter I wish to achieve? As I don't know how to select suitable values here, the output signal is heavily garbled at the moment. If a better/more understandable formula is available then by all means suggest it. Sorry for the newbish question and I hope this is the right place for it. Thanks :-)&lt;/p&gt;&#xA;" OwnerUserId="19017" OwnerDisplayName="PhilPotter1987" LastEditorUserId="19017" LastEditDate="2016-01-10T22:09:55.167" LastActivityDate="2016-01-11T06:45:17.467" Title="Resampling a digital sound signal" Tags="|resampling|digital-filters|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28203" PostTypeId="2" ParentId="28190" CreationDate="2016-01-10T21:57:18.420" Score="1" Body="&lt;p&gt;If &lt;code&gt;R&lt;/code&gt; is OK to use, then try the various answers I've made here.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/26489/estimating-a-low-frequency-signal-corrupted-by-high-frequency-noise&quot;&gt;&lt;em&gt;Estimating a low frequency signal corrupted by high frequency noise&lt;/em&gt;&lt;/a&gt; has a solution &lt;a href=&quot;https://github.com/kootsoop/DSP.SE/blob/master/Q26489/Q26489.R&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/26818/kalman-filter-velocity-matlab&quot;&gt;&lt;em&gt;Kalman Filter - Velocity [Matlab]&lt;/em&gt;&lt;/a&gt; has a solution &lt;a href=&quot;https://github.com/kootsoop/DSP.SE/blob/master/Q26818/Q26818.R&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/27370/how-to-smooth-estimated-velocity&quot;&gt;&lt;em&gt;how to smooth estimated velocity&lt;/em&gt;&lt;/a&gt; has a solution &lt;a href=&quot;https://github.com/kootsoop/DSP.SE/blob/master/Q27370/Q27370.R&quot; rel=&quot;nofollow noreferrer&quot;&gt;here.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-01-10T21:57:18.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28204" PostTypeId="2" ParentId="28190" CreationDate="2016-01-10T22:17:02.730" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/README.md&quot; rel=&quot;nofollow&quot;&gt;Kalman and Bayesian Filters in Python&lt;/a&gt; is interactive book about Kalman filter. It contain a lot of code on Pyhton from simple snippets to whole classes and modules. For simplest example see &lt;a href=&quot;http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/04-One-Dimensional-Kalman-Filters.ipynb&quot; rel=&quot;nofollow&quot;&gt;chapter&lt;/a&gt; about one dimentional Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;but in order to fully understand it, I would probably need to see it working on some data&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;P.S. Also in my opinion there is not enought to see Kalman filter example to understand it. You also need understand a problem domain (process model).&lt;/p&gt;&#xA;" OwnerUserId="10169" LastEditorUserId="10169" LastEditDate="2016-01-10T22:47:20.263" LastActivityDate="2016-01-10T22:47:20.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28205" PostTypeId="2" ParentId="28199" CreationDate="2016-01-10T23:03:17.827" Score="1" Body="&lt;p&gt;Your rule does not take advantage of the double sideband symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The positive peaks of the cosine have a value of 1 and occur at a rate of 20 kHz. Sampling at the positive peaks of the cosine gives you directly samples of $m(t)$. The obtained 20 kHz sampling frequency is sufficient because even 2 × 5 kHz = 10 kHz is enough to sample $m(t)$. Throw away every second sample to arrive at the critical sampling frequency 10 kHz, still not losing information about $m(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The catch is that you must be able to synchronize to the cosine carrier. Otherwise you might even sample where its value is zero, losing all information. You also need the synchronization if you want to reconstruct the carrier which is lost by the sampling.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-01-10T23:03:17.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28206" PostTypeId="2" ParentId="28202" CreationDate="2016-01-11T01:33:01.957" Score="2" Body="&lt;p&gt;you can use this approach provided it does not yield efficiency burdens.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Note that matlab arrays start from index 1, not 0.&#xA;F1 = 223807.5;     % Sampling rate of Yamaha chip&#xA;F2 = 44100;        % New sampling rate of standard Audio-CD&#xA;M = 203;           % Necessary Decimation ratio&#xA;N = 40;            % necessary Expansion ratio&#xA;Lx = 4466;         % Length of Audio Input Buffer at F1 rate&#xA;Ly = Lx*N/M;       % Length of Resampled Output Buffer at F2 rate&#xA;&#xA;&#xA;x = sin(2*pi*1234*[0:Lx-1]/F1);  % Just a test sine wave&#xA;y = zeros(1,Ly);                 % allocate output signal memory&#xA;&#xA;for i=0:Ly-1              % run per each output sample&#xA;   n = i*(M/N);          % compute exact sampling position inside the long buffer &#xA;   ind = floor(n);       % convert it into largest integer smaller than itself for array indexing&#xA;   d = n-ind;            % take the difference for proportional weighting&#xA;   y(i+1) = (1-d)*x(ind+1) + d*x(ind+2); % sum the weighted mixture.&#xA;end&#xA;&#xA;figure,plot(x);            %plot each waveforms...&#xA;figure,plot(y);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-01-11T01:45:24.423" LastActivityDate="2016-01-11T01:45:24.423" CommentCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="28207" PostTypeId="2" ParentId="28199" CreationDate="2016-01-11T03:24:28.797" Score="2" Body="&lt;p&gt;The problem is that the general criterion for bandpass sampling (which results in $25\text{ kHz}\leq f_s\leq 30\text{ kHz}$) applies for general signals, whose spectrum may not be symmetric around $f_c$. In your example, sampling at 10 kHz would fail because spectrums of different shapes overlap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most complete resource I know on bandpass sampling is &quot;The theory of bandpass sampling&quot;, by Vaughan et al, IEEE Trans. on Signal Processing, 1991, Vol. 39, Issue 9 (&lt;a href=&quot;http://dx.doi.org/10.1109%2F78.134430&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1109%2F78.134430&lt;/a&gt;). At the start of page 4, it specifies that in the special case of DSB signals, the minimum sampling interval is $1/B$, where $B$ is the bandwidth (for both sidebands). This corresponds to your case, where the minimum sampling rate is 10 kHz, equal to the signal's bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-01-11T03:24:28.797" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28208" PostTypeId="1" AcceptedAnswerId="28242" CreationDate="2016-01-11T03:31:16.597" Score="2" ViewCount="2620" Body="&lt;p&gt;So I'm writing an app that blurs and downscales large quantities of images, but all the image processing libraries I've come across define gaussian blurs in terms of sigma and kernel size rather than pixel radius (like an image editing app would do). Does radius relate to sigma and kernel size in some way, or is it an entirely different thing?&lt;/p&gt;&#xA;" OwnerUserId="19022" LastActivityDate="2016-01-12T15:25:16.580" Title="Gaussian filter in terms of pixel radius" Tags="|gaussian|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28209" PostTypeId="1" AcceptedAnswerId="50223" CreationDate="2016-01-11T04:55:38.317" Score="10" ViewCount="3183" Body="&lt;p&gt;I'm having trouble figuring out how to follow the fast 8x8 DCT algorithm diagrams found in the following two papers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) &lt;a href=&quot;http://www.cin.ufpe.br/~vak/tg/papers/Chen-dct.pdf&quot; rel=&quot;noreferrer&quot;&gt;A Fast Computational Algorithm for the Discrete Cosine Transform&lt;/a&gt; by Chen et al.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.463.3353&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;noreferrer&quot;&gt;Practical Fast 1-D DCT Algorithms With 11 Multiplications&lt;/a&gt; by Loeffler et al.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, the second diagram that shows the algorithm in (2) looks like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rDLp4.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rDLp4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The description of the operations in this algorithm are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2DlUX.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2DlUX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few questions I have about this formulation, and I'm not sure where to find the answers:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;(2) suggests that this algorithm generates a DCT that is scaled by some value $C = \sqrt{2}$. It mentions that this $C$ was chosen arbitrarily to avoid any multiplications in computing the DC coefficient. Really the only requirement is that $C_{DCT} * C_{IDCT} = \frac{4}{N^2}$. So my question is this: What is the scaling factor of the output coefficients using this algorithm? It seems like they are different than the original definition of the DCT, but I don't know by how much (mostly because I don't actually see any relationship between this diagram and the original formulation of the DCT):&#xA;$$ F(k) = \frac{2c(k)}{N}\sum_{n = 0}^{N - 1}f(n)\cos\left(\frac{\left(2n + 1\right)\pi k}{2N}\right)$$&#xA;where $c(k) = \frac{1}{\sqrt{2}}$ for $k = 0$ and $c(k) = 1$ for $k \neq 0$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The paper states that performing the IDCT can be done using the exact same algorithm but transforming outputs to inputs and vice versa. First, should the DCT coefficients be ordered in bit-reverse order prior to running them through the IDCT? Second, for the rotation blocks (the squares in the diagram), shouldn't the inverse operation be:&#xA;$$ \begin{align}&#xA;O_0 = I_0 \cdot k \cdot \cos\frac{n\pi}{2N} - I_1 \cdot k \cdot \sin\frac{n\pi}{2N} \\&#xA;O_1 = I_1 \cdot k \cdot \sin\frac{n\pi}{2N} + I_1 \cdot k \cdot \cos\frac{n\pi}{2N} \\&#xA;\end{align}&#xA;$$&#xA;My reasoning is this: The inverse of a rotation by $\theta$ is a rotation by $-\theta$. Hence, we just replace the angle by its inverse and use the identities $\cos(-\theta) = \cos(\theta)$ and $\sin(-\theta) = -\sin(\theta)$. Third, what is the scaling factor of the transformed values after the IDCT? (2) says $\frac{2}{N^2}$, but empirically, this hasn't produced correct results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose after I run the algorithm, I have the result of each lane stored in the values &lt;code&gt;d0 ... d7&lt;/code&gt;. Which of the following is correct: &lt;pre&gt;&#xA;output[0] = d0               or               output[0] = d0&#xA;output[4] = d1                                output[1] = d4&#xA;output[2] = d2                                output[2] = d2&#xA;output[6] = d3                                output[3] = d6&#xA;output[7] = d4                                output[4] = d7&#xA;output[3] = d5                                output[5] = d3&#xA;output[5] = d6                                output[6] = d5&#xA;output[1] = d7                                output[7] = d1 &lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If there are any ways to improve this question, or if I should ask elsewhere, please let me know.&lt;/p&gt;&#xA;" OwnerUserId="13516" LastActivityDate="2021-11-30T14:19:50.413" Title="Fast DCT implementation" Tags="|dct|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28210" PostTypeId="2" ParentId="28202" CreationDate="2016-01-11T06:45:17.467" Score="1" Body="&lt;p&gt;For a ratio of such large integers, you might be better off directly interpolating values at the sample points for the new sample rate using a high quality interpolator, rather than upsampling followed by downsampling.  A windowed Sinc interpolation kernel of suitable width can include it's own anti-alas low-pass filter.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-11T06:45:17.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28211" PostTypeId="1" CreationDate="2016-01-11T08:59:12.193" Score="2" ViewCount="8369" Body="&lt;p&gt;If one signal is transmitting form transmitter $TX_1$ with some frequency $X$ and some other transmitter $TX_2$ is sending some other signal with same frequency $X$ will there be any clash or interference between these two signals since these two transmitters $TX_1$ and $TX_2$ are located in the same area?&lt;/p&gt;&#xA;" OwnerUserId="18316" LastEditorUserId="10194" LastEditDate="2016-01-11T10:09:52.123" LastActivityDate="2016-01-12T02:29:44.033" Title="Two signals with the same frequency in the same area can interfere?" Tags="|signal-analysis|digital-communications|analog|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28212" PostTypeId="2" ParentId="28211" CreationDate="2016-01-11T09:17:59.143" Score="2" Body="&lt;p&gt;I would say yes almost certainly - it would depend on transmit power but if they are simultaneously broadcasting on the same frequency then there will be interference as they are in the same area. This is the reason valuable parts of the spectrum must be licensed by government agencies, to prevent multiple people using them at the same time without multiplexing etc.&lt;/p&gt;&#xA;" OwnerUserId="19017" LastActivityDate="2016-01-11T09:17:59.143" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28217" PostTypeId="1" CreationDate="2016-01-11T14:25:43.047" Score="0" ViewCount="437" Body="&lt;p&gt;I have read that $ce^{-\frac{\phi_i-\phi_j}{\rho}}$ is a harmonic function of the form $e^{-in\phi_i}$, and therefore it's eigenvalues are one of the Fourier components of $(|\phi_i-\phi_j|)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How come $ce^{-\frac{\phi_i-\phi_j}{\rho}}$ has the form of $e^{-in\phi_i}$ if it is a real function?&lt;/li&gt;&#xA;&lt;li&gt;How do I calculate the eigenvalues of such a function, or, if it is a difficult calculation, is there a known theorem(s) I can base this result on?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am not an expert in harmonic analysis, but I would like to know more about this subject (without getting into too much details). I need it to my research in neurosciences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a link to the article I am reffering to: &lt;a href=&quot;http://journals.aps.org/pre/pdf/10.1103/PhysRevE.64.051904&quot; rel=&quot;nofollow noreferrer&quot;&gt;Population coding&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6aRnY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6aRnY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16077" LastEditorUserId="-1" LastEditDate="2016-01-11T17:27:52.410" LastActivityDate="2016-01-11T17:40:12.107" Title="How do I calculate the eigenvalues of a covariance matrix which contains harmonic functions" Tags="|fourier-transform|fourier-series|correlation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28218" PostTypeId="1" CreationDate="2016-01-11T14:32:55.830" Score="1" ViewCount="395" Body="&lt;p&gt;I have this picture and would like to extract the bones. &#xA;First I thought of contour-Tracking, but as you can see in some bones there are holes (Like for example at the left finger, in the bone in the middle). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;b&gt;What algorithm would you recommend me? To find the contour of the bones? How could I fill them?&lt;/b&gt; Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im also grateful for code examples.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Nac45.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nac45.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="19034" LastActivityDate="2017-09-03T14:54:58.110" Title="Algorithm to extract polygones with holes" Tags="|image-processing|algorithms|edge-detection|" AnswerCount="1" CommentCount="0" ClosedDate="2017-09-04T11:43:53.890" ContentLicense="CC BY-SA 3.0" />
  <row Id="28219" PostTypeId="1" CreationDate="2016-01-11T14:42:24.473" Score="0" ViewCount="1751" Body="&lt;p&gt;I recorded the same piece of music from different instruments and I want to compare their timbre by means of feature extraction. As you can see from the image, the recording is composed of different sections with very different amplitude values. Furthermore, the recordings present a slightly different RMS energy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going to divide the recording into short frames and extract the features from each frame. I want the instruments to be comparable. For this reason I performed a RMS normalization on the whole recording before windowing and feature extraction, in such a way that each recording has a RMS value equal to 1. Am I right, or is there a better approach?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fuK6Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fuK6Q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15543" LastActivityDate="2016-01-11T14:42:24.473" Title="How to normalize audio data for feature extraction" Tags="|audio|normalization|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28220" PostTypeId="2" ParentId="28211" CreationDate="2016-01-11T16:00:19.387" Score="4" Body="&lt;p&gt;The signals won't necessarily interfere with each other. It depends on the properties of the signals and what you're trying to achieve.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Time-division multiplexing can be used to transmit multiple signals over the same frequency. In TDM each transmitter uses the channel for just a fraction of the time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Quadrature modulation essentially means transmitting two signals over the same frequency at the same time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Code-division multiple access allows multiple transmitters to share the same frequency; each transmitter multiplies its signal with a sequence that is orthogonal to those used by the remaining transmitters.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Space-time coding: by using multiple antennas in the receiver, it is possible to recover signals transmitted over the same frequency and at the same time, while also fighting the effects of multipath fading.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Much recent research on efficient spectrum utilization is based on ways to &quot;pack&quot; signals both in time and frequency, to achieve the highest data rate over the smallest possible bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that, unless the transmitter, receiver and signaling are designed with this purpose, the signals will interfere as @PhilPotter1987 suggests. For example, if a TV broadcaster experiences a malfunction and starts transmitting over another TV channel's bandwidth, there is nothing your TV set can do to fix it.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-01-11T16:00:19.387" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28221" PostTypeId="1" AcceptedAnswerId="28222" CreationDate="2016-01-11T16:15:29.277" Score="2" ViewCount="5864" Body="&lt;p&gt;I understand the need for phase unwrapping and the complexity behind it. But, I'm struggling to understand why the phase information gets wrapped between $-\pi$ to $\pi$ in the first place?&lt;/p&gt;&#xA;" OwnerUserId="11274" LastEditorUserId="1629" LastEditDate="2016-01-11T17:04:57.427" LastActivityDate="2016-01-11T17:36:05.927" Title="The need for phase wrapping?" Tags="|phase|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28222" PostTypeId="2" ParentId="28221" CreationDate="2016-01-11T17:04:55.663" Score="5" Body="&lt;p&gt;I'm not sure if I understand your problem, but I'll give it a try. If you have a complex frequency response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=|H(\omega)|e^{j\phi(\omega)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\phi(\omega)$ is the phase, then you probably know that for a given frequency $\omega_0$, the frequency response might as well be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega_0)=|H(\omega_0)|e^{j(\phi(\omega_0)+2k\pi)}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k$ is some integer. The question is, when you compute the complex value $H(\omega_0)$, which of the infinitely many possible phases do you choose? The convention is to choose the &lt;a href=&quot;https://en.wikipedia.org/wiki/Argument_%28complex_analysis%29#Principal_value&quot; rel=&quot;noreferrer&quot;&gt;principal value&lt;/a&gt; which is in the interval $(-\pi,\pi]$. The consequence is that whenever you compute the &lt;em&gt;function&lt;/em&gt; $\phi(\omega)$ for continuous $\omega$, you'll get jumps as soon as the phase hits $-\pi$ or $\pi$, but no matter how you define the phase, you will not be able to avoid jumps. So if you want a continuous function you need to do phase unwrapping.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-11T17:23:21.060" LastActivityDate="2016-01-11T17:23:21.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28223" PostTypeId="2" ParentId="28221" CreationDate="2016-01-11T17:36:05.927" Score="4" Body="&lt;p&gt;The math.h library atan2() function only has 2 scalar inputs, not the prior history required to know which way the input vector was rotating (assuming the input was a vector and a continuous function of something else, such as time).   Without history information, a small turn in one direction looks exactly the same as a big turn in the other.  So atan2() wraps.  And computer programs use atan2() to calculate angles and phase from 2D vectors.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-11T17:36:05.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28224" PostTypeId="2" ParentId="28217" CreationDate="2016-01-11T17:40:12.107" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;The included document does not say $ce^{-\frac{\phi_i-\phi_j}{\rho}}$ has the form of $e^{-in\phi_i}$. The included document uses $C$ for three completely different things: &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$C_{ij}$ is the correlations between $i$ and $j$ items.&lt;/li&gt;&#xA;&lt;li&gt;$C(\phi_i-\phi_j)$ a component of that correlation, dependent on the angles between the two items $i$ and $j$.&lt;/li&gt;&#xA;&lt;li&gt;$C_n$ the eigenvalues of the covariance matrix made up of the $C_{ij}$.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The term $e^{-in\phi_i}$ is a component of $C_n$ the eigenvalues / Fourier components expression in (31).&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;The idea would be to form the matrix $C_{ij}$ and then take the eigensystem decomposition of that matrix.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-11T17:40:12.107" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28225" PostTypeId="2" ParentId="28196" CreationDate="2016-01-11T19:32:34.900" Score="2" Body="&lt;p&gt;CIC filters don't have very steep roll-off, or a very flat passband. That's the downside of using this very special class of filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than that, you should be fine. However, as with every filter design, you will have to design, and verify, yourself to ensure the filter matches your requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, CICs are very often used as runtime-adjustable filters; and that works pretty well if you have e.g. high-quality Nyquist-M (especially halfband) FIRs. An example of this is the Ettus &lt;a href=&quot;https://github.com/EttusResearch/fpga/blob/master/usrp2/sdr_lib/ddc_chain.v&quot; rel=&quot;nofollow&quot;&gt;USRP signal processing DDC&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   // CIC decimator  24 bit I/O&#xA;   cic_strober cic_strober(.clock(clk),.reset(rst),.enable(ddc_enb),.rate(cic_decim_rate),&#xA;               .strobe_fast(1),.strobe_slow(strobe_cic) );&#xA;&#xA;   cic_decim #(.bw(WIDTH))&#xA;     decim_i (.clock(clk),.reset(rst),.enable(ddc_enb),&#xA;          .rate(cic_decim_rate),.strobe_in(1'b1),.strobe_out(strobe_cic),&#xA;          .signal_in(i_cordic_clip),.signal_out(i_cic));&#xA;&#xA;   cic_decim #(.bw(WIDTH))&#xA;     decim_q (.clock(clk),.reset(rst),.enable(ddc_enb),&#xA;          .rate(cic_decim_rate),.strobe_in(1'b1),.strobe_out(strobe_cic),&#xA;          .signal_in(q_cordic_clip),.signal_out(q_cic));&#xA;&#xA;   // First (small) halfband  24 bit I/O&#xA;   small_hb_dec #(.WIDTH(WIDTH)) small_hb_i&#xA;     (.clk(clk),.rst(rst),.bypass(~enable_hb1),.run(ddc_enb),&#xA;      .stb_in(strobe_cic),.data_in(i_cic),.stb_out(strobe_hb1),.data_out(i_hb1));&#xA;&#xA;   small_hb_dec #(.WIDTH(WIDTH)) small_hb_q&#xA;     (.clk(clk),.rst(rst),.bypass(~enable_hb1),.run(ddc_enb),&#xA;      .stb_in(strobe_cic),.data_in(q_cic),.stb_out(),.data_out(q_hb1));&#xA;&#xA;   // Second (large) halfband  24 bit I/O&#xA;   wire [8:0]  cpi_hb = enable_hb1 ? {cic_decim_rate,1'b0} : {1'b0,cic_decim_rate};&#xA;   hb_dec #(.WIDTH(WIDTH)) hb_i&#xA;     (.clk(clk),.rst(rst),.bypass(~enable_hb2),.run(ddc_enb),.cpi(cpi_hb),&#xA;      .stb_in(strobe_hb1),.data_in(i_hb1),.stb_out(strobe_hb2),.data_out(i_hb2));&#xA;&#xA;   hb_dec #(.WIDTH(WIDTH)) hb_q&#xA;     (.clk(clk),.rst(rst),.bypass(~enable_hb2),.run(ddc_enb),.cpi(cpi_hb),&#xA;      .stb_in(strobe_hb1),.data_in(q_hb1),.stb_out(),.data_out(q_hb2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The job of this chain is to decimate a 100MS/s signal down, adjustably, down to rates of 1/512.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, if you just want to use powers of two, you can just use the same halfband filter multiple times; if you're doing it elegantly, you can probably even multiplex the same hardware for multiple iterations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, coming from a background where sample rates are in the MS/s, I wonder why you need such a low-rate decimation in hardware – every CPU can do that, nowadays, without breaking a sweat.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-11T19:32:34.900" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="28226" PostTypeId="1" CreationDate="2016-01-11T23:11:04.570" Score="1" ViewCount="50" Body="&lt;p&gt;Let $x[n]$ be a time-series, and two filters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$A[n] = a_0 x[n] + a_1 x[n-1] + ... a_q x[n-q]$&lt;/li&gt;&#xA;&lt;li&gt;$B[n] = b_0 x[n] + b_1 x[n-1] + ... b_r x[n-r]$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think the answer is No, but is there a way to have this problem (sign of 2 filters should be both positive):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A[n] &amp;gt; 0 \quad AND \quad  B[n] &amp;gt; 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;expressed in terms of the study of the sign of a &lt;strong&gt;single linear filter&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C[n] = c_0 x[n] + c_1 x[n-1] + ... c_s x[n-s]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not possible, is there a way to have nearly equivalence (that holds for most values of $n$)?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Application: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A[n] = x[n] - x[n-1]                 # derivative  (or a smoothed version with moving average)&#xA;B[n] = x[n] - 2 * x[n-1] + x[n-2]    # acceleration (idem)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd like to find when &lt;strong&gt;both&lt;/strong&gt; derivative and acceleration of $x[n]$ are positive by studying the sign of &lt;strong&gt;only 1 linear filter&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Or said in another way: is it possible to create a linear filter $C[n] = c_0 x[n] + c_1 x[n-1] + ... c_s x[n-s]$ such that $C[n] &amp;gt; 0$ &lt;strong&gt;if and only if&lt;/strong&gt; derivative and acceleration of $x[n]$ are both positive?&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="5648" LastActivityDate="2016-01-11T23:11:04.570" Title="Turn a decision problem into a linear filter problem" Tags="|filters|filter-design|linear-systems|linear-prediction|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28227" PostTypeId="2" ParentId="28211" CreationDate="2016-01-12T02:29:44.033" Score="2" Body="&lt;p&gt;If the two signals are just sine waves generated from point sources, with no modulation scheme, then yes they will interfere with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To visualize this, suppose there are two such sources, one at $(10,10)$ and the other at $(90,90)$. The images below show 1) The waves just from the first source, 2) the waves from the second source, and 3) the overall effect when both sources are active.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, there is quite a bit of interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J95pc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J95pc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#28211&#xA;&#xA;x1 &amp;lt;- 10&#xA;y1 &amp;lt;- 10&#xA;&#xA;&#xA;x2 &amp;lt;- 90&#xA;y2 &amp;lt;- 90&#xA;&#xA;z1 &amp;lt;- matrix(0,100,100)&#xA;z2 &amp;lt;- z1&#xA;ztot &amp;lt;- z1&#xA;&#xA;for (x in 1:100)&#xA;{&#xA;  for (y in 1:100)&#xA;  {&#xA;    z1[x,y] &amp;lt;- sin(sqrt(((x-x1)^2 + (y-y1)^2))) &#xA;    z2[x,y] &amp;lt;- sin(sqrt(((x-x2)^2 + (y-y2)^2)))&#xA;    ztot[x,y] &amp;lt;- z1[x,y] + z2[x,y]&#xA;  }&#xA;}&#xA;&#xA;par(pty=&quot;s&quot;, mfrow=c(3,1))&#xA;image(1:100,1:100,z1)&#xA;points(x1,y1,lwd=10,col=&quot;green&quot;)&#xA;points(x2,y2,lwd=10,col=&quot;blue&quot;)&#xA;image(1:100,1:100,z2)&#xA;points(x1,y1,lwd=10,col=&quot;green&quot;)&#xA;points(x2,y2,lwd=10,col=&quot;blue&quot;)&#xA;image(1:100,1:100,ztot)&#xA;points(x1,y1,lwd=10,col=&quot;green&quot;)&#xA;points(x2,y2,lwd=10,col=&quot;blue&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-12T02:29:44.033" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28228" PostTypeId="2" ParentId="28218" CreationDate="2016-01-12T02:31:43.930" Score="0" Body="&lt;p&gt;You need to apply some image segmentation algorithms. You may read about A &lt;a href=&quot;http://riweb-backend.ri.cmu.edu/pub_files/pub4/pantofaru_caroline_2005_1/pantofaru_caroline_2005_1.pdf&quot; rel=&quot;nofollow&quot;&gt;Comparison of Image Segmentation Algorithms&lt;/a&gt; and apply the ones that satisfies your needs better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're developing with &lt;a href=&quot;http://opencv.org/&quot; rel=&quot;nofollow&quot;&gt;OpenCV&lt;/a&gt;, you can find some ready to use &lt;a href=&quot;http://docs.opencv.org/master/d2/d96/tutorial_py_table_of_contents_imgproc.html#gsc.tab=0&quot; rel=&quot;nofollow&quot;&gt;(implemented) algorithms&lt;/a&gt; that can save you lot of work as it is the case with the &lt;a href=&quot;http://docs.opencv.org/master/d3/db4/tutorial_py_watershed.html#gsc.tab=0&quot; rel=&quot;nofollow&quot;&gt;watershed algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you can use OpenCV with the &lt;em&gt;traditional&lt;/em&gt; programming language C/C++ but also many others such as &lt;a href=&quot;https://opencv-python-tutroals.readthedocs.org/en/latest/&quot; rel=&quot;nofollow&quot;&gt;Python&lt;/a&gt; and &lt;a href=&quot;http://docs.opencv.org/2.4/doc/tutorials/introduction/desktop_java/java_dev_intro.html&quot; rel=&quot;nofollow&quot;&gt;Java&lt;/a&gt;. Personally I experienced it with C/C++ and Python though.&lt;/p&gt;&#xA;" OwnerDisplayName="user15248" LastActivityDate="2016-01-12T02:31:43.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28229" PostTypeId="1" AcceptedAnswerId="28232" CreationDate="2016-01-12T04:19:15.633" Score="1" ViewCount="4905" Body="&lt;p&gt;i have 2 questions:&#xA;1-If zeros on the unite circle that will be min or max phase?and this system has low-pass frequency response or not ?&#xA;2-Is the min phase has the shortest impulse response?&lt;/p&gt;&#xA;" OwnerUserId="19041" LastActivityDate="2016-01-12T08:15:48.490" Title="Minimum Phase &amp; maximum phase" Tags="|phase|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28230" PostTypeId="1" CreationDate="2016-01-12T05:42:36.720" Score="2" ViewCount="924" Body="&lt;p&gt;I have an input sequence $x=\{x_1, x_2 , ... x_n\}$ of reals, where $n=2^m$ for some $m$. I wish to calculate FFT of $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X=FFT(x)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, before  I calculate the FFT, the signal $x$ gets corrupted with noise $\eta$, so $\hat{x}=x+\eta$, and calculated FFT, $\hat{X}$ is FFT of $\hat{x}$, rather than $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{X}=FFT(\hat{x})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish to  recover actual or approximate FFT $X$ from $\hat{X}$ under following assumption:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$x$ is band limited signal; FFT spectrum dies down quickly.&lt;/li&gt;&#xA;&lt;li&gt;The noise $\eta$ is a shifted delta function, with unknown shift and magnitude, i.e. $\eta(n)= R\delta (n-l)$, where $R,\ l$ are real and integer respectively.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How will I do it in a compute efficient way?&lt;/p&gt;&#xA;" OwnerUserId="19043" LastActivityDate="2016-01-15T04:35:57.500" Title="Filtering noise from FFT, where noise is known to be shifted delta function" Tags="|fft|noise|filtering|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28232" PostTypeId="2" ParentId="28229" CreationDate="2016-01-12T08:15:48.490" Score="8" Body="&lt;p&gt;Let me first state the commonly used definitions of minimum-phase and maximum-phase for discrete-time systems:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A causal and stable discrete-time system is said to be &lt;em&gt;strictly minimum-phase&lt;/em&gt; when all its zeros are inside the unit circle.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Of course, all its poles are inside the circle as well, otherwise it wouldn't be causal and stable.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A causal and stable discrete-time system is said to be &lt;em&gt;strictly maximum-phase&lt;/em&gt; when all its zeros are outside the unit circle.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again, causality and stability requires that all the poles are inside the unit circle as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have zeros on the unit circle (and all others either inside or outside the circle), the system is usually referred to as &lt;em&gt;loosely minimum-phase&lt;/em&gt; or &lt;em&gt;loosely maximum-phase&lt;/em&gt;. A system with all its zeros on the unit circle is a degenerate case of that definition, in the sense that it is loosely minimum-phase and loosely maximum-phase at the same time. But in that case these definitions do not make much sense. These definitions are meant for systems that have some zeros inside (or outside) the circle &lt;em&gt;and&lt;/em&gt; some on the circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question about the low pass frequency response can't be answered, because the concepts of minimum-phase and maximum-phase have absolutely nothing to do with the magnitude response of the filter. You can have a minimum-phase low pass filter, and a maximum-phase low pass filter with exactly the same magnitude response. The same is true for all other frequency selective filter characteristics (high pass, band pass, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning your last question, it depends what you mean by shortest. If you mean the number of samples of the impulse response, then the answer is no. As an example, take a length $N$ FIR minimum-phase impulse response. If you flip the coefficients (i.e., time reverse them) you obtain a maximum-phase filter of the same length with the same magnitude response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The minimum-phase property means that of all filters with the same magnitude response, the impulse response of the minimum-phase filter is maximally concentrated near time index $n=0$ in a mean square sense. I.e., if $h[n]$ is a minimum-phase impulse response, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=0}^{N}|h[n]|^2\ge \sum_{n=0}^{N}|g[n]|^2\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for all $N\ge 0$, and for any $g[n]$ with the same magnitude response as $h[n]$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-12T08:15:48.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28234" PostTypeId="1" AcceptedAnswerId="28235" CreationDate="2016-01-12T09:37:20.763" Score="1" ViewCount="514" Body="&lt;p&gt;In cross correlation we use the below command to calculate the sum after elementary multiplication of the vectors. But when we try to convert this Matlab code to vhdl using HDL coder, this command is not defined by &lt;code&gt;HDL&lt;/code&gt; coder. Is it possible to write code for below line without using '&lt;code&gt;sum' builtin&lt;/code&gt; function please.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xc(i)=sum((y1(j1:k1)).*y2(j2:k2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;j1&lt;/code&gt;, &lt;code&gt;j2&lt;/code&gt;, &lt;code&gt;k1&lt;/code&gt; and &lt;code&gt;k2&lt;/code&gt; are the starting and ending limits.&#xA;&lt;code&gt;y1&lt;/code&gt; and &lt;code&gt;y2&lt;/code&gt; are two vectors and are being multiplied element wise and the result is being added.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="17286" LastEditorUserId="8202" LastEditDate="2016-01-12T11:56:37.750" LastActivityDate="2016-01-12T11:56:37.750" Title="Code generation for `sum` function in MATLAB" Tags="|matlab|cross-correlation|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="28235" PostTypeId="2" ParentId="28234" CreationDate="2016-01-12T10:14:24.910" Score="2" Body="&lt;p&gt;Because the size of &lt;code&gt;y1(j1:k1)&lt;/code&gt; and &lt;code&gt;y2(j2:k2)&lt;/code&gt; must be the same then:&#xA;$$&#xA;k_1-j_1 = k_2-j_2&#xA;$$&#xA;and you will also have something like: $j_1+N=j_2$ then you could write a for loop like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xc(i) = 0&#xA;for n=j1:k1&#xA;  xc(i) = xc(i) + y1(n)*y2(n+N)&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10194" LastActivityDate="2016-01-12T10:14:24.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28236" PostTypeId="1" CreationDate="2016-01-12T10:38:18.617" Score="0" ViewCount="480" Body="&lt;p&gt;In order to know if my signal is increasing or decreasing, I'm using the discrete derivative &lt;span class=&quot;math-container&quot;&gt;$y[n] = x[n] - x[n-1]$&lt;/span&gt;&#xA;or a smoothed version of it (for example Exponential Weight Moving Average of &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; that gives a &amp;quot;smooth&amp;quot; version of the derivative).&lt;/p&gt;&#xA;&lt;p&gt;Now to make further analysis, I also want to consider the discrete acceleration:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$z[n] = x[n] - 2 x[n-1] + x[n-2]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But as the signal is sometimes a bit noisy, I wanted to study a &lt;strong&gt;smoothed&lt;/strong&gt; version of this acceleration. I thought about :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Standard Moving average of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; : &lt;span class=&quot;math-container&quot;&gt;$SMA(z[n], 10)$&lt;/span&gt;. Easy computation shows that &lt;span class=&quot;math-container&quot;&gt;$SMA(z[n], 10) = \frac{1}{10} (x[n]-x[n-1]-x[n-10]+x[n-11])$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;It's not so good because it uses too few values of x[k]...&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Exponential Moving average of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; : &lt;span class=&quot;math-container&quot;&gt;$EMA(z[n], 10)$&lt;/span&gt;. Computations shows that: &lt;span class=&quot;math-container&quot;&gt;$EMA(z[n], 10) \approx 0.09 (x[n] - x[n-1])$&lt;/span&gt; and this is proportionnal to ... derivative !&lt;/p&gt;&#xA;&lt;p&gt;Indeed, all the next coefficients are negligible &lt;span class=&quot;math-container&quot;&gt;$\ll 10^{-3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;This is strange: I expected the the Exponential Moving Average of the acceleration to be smoother but it turns out that it nearly uses only 2 values : &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x[n-1]$&lt;/span&gt;. (See below the impulse reponse of EMA of acceleration)&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;Question:&lt;/h1&gt;&#xA;&lt;p&gt;&lt;strong&gt;How to get a &amp;quot;smoothed&amp;quot; version of discrete acceleration, as &lt;span class=&quot;math-container&quot;&gt;$A[n] = a_0 x[n] + a_1 x[n-1] + ... + a_k x[n-k]$&lt;/span&gt; ?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Remark: Impulse reponse of EMA of discrete acceleration:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/d1XB8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/d1XB8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5648" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-01-12T10:38:18.617" Title="Smoothing the discrete acceleration" Tags="|filters|filter-design|impulse-response|moving-average|derivative|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28238" PostTypeId="1" AcceptedAnswerId="28239" CreationDate="2016-01-12T12:25:05.093" Score="1" ViewCount="276" Body="&lt;p&gt;I am trying to understand low pass filters for image processing, I came across an &lt;a href=&quot;http://www.cyanogen.com/help/maximdl/Low-Pass_Filtering.htm&quot; rel=&quot;nofollow&quot;&gt;article&lt;/a&gt; that stated that low pass filters effect noise more than the real data due to that the image &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Noise always changes rapidly from pixel to pixel because each pixel&#xA;  generates its own independent noise. The image from the telescope&#xA;  isn't &quot;uncorrelated&quot; in this fashion because real images are spread&#xA;  over many pixels.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does this mean that the filter effects noise more due to the noise being correlated from pixel to pixel?&lt;/p&gt;&#xA;" OwnerUserId="16094" LastEditorUserId="1629" LastEditDate="2016-01-12T16:02:37.787" LastActivityDate="2016-01-12T16:02:37.787" Title="Low Pass Filter - pixel correlation" Tags="|image-processing|computer-vision|noise|lowpass-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28239" PostTypeId="2" ParentId="28238" CreationDate="2016-01-12T12:44:51.557" Score="2" Body="&lt;p&gt;Most images are inherently low-pass: the object that is displayed in the image generally doesn't change from pixel to pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most image pixel &lt;em&gt;noise&lt;/em&gt; is generated by each individual pixel capturing the image. As a result this noise is generally assumed to be uncorrelated from pixel to pixel.  That means the noise is  (bandlimited) white noise, which has uniform components across all frequencies low to high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, when you apply a low pass filter to an image, most of the information about the objects imaged will pass straight through because they are in the low pass filter's pass band.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conversely, noise will have its high frequency components attenuated by the low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is why the statement &lt;code&gt;low pass filters effect noise more than the real data&lt;/code&gt; is generally true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your explicit question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does this mean that the filter effects noise more due to the noise being correlated from pixel to pixel?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The filter affects the noise more due to the noise being &lt;strong&gt;un&lt;/strong&gt;correlated from pixel to pixel.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-12T12:44:51.557" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28240" PostTypeId="1" CreationDate="2016-01-12T13:53:27.940" Score="2" ViewCount="291" Body="&lt;p&gt;I have some images of butterflies. I've downloaded them from &lt;a href=&quot;http://www.ifoundbutterflies.org/home&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. A sample is below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Nyoop.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nyoop.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In each image, the most prominent object is the butterfly (with flowers, leaf etc in background). I usually go for contour/edge detection to locate features in image, but in this case these algorithms are not working as I expected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to locate butterfly and bound it with a box, or better, compute its contour. Is there a way to do this automatically using python-opencv or some other tool?&lt;/p&gt;&#xA;" OwnerUserId="1905" LastActivityDate="2016-03-01T08:47:58.150" Title="What is a good way to locate butterfly in an image" Tags="|image-processing|opencv|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28241" PostTypeId="2" ParentId="24064" CreationDate="2016-01-12T14:38:45.880" Score="0" Body="&lt;p&gt;I don't know where it was first mentioned, but what you are looking is essentially covered in Robust Statistics. Robust Statistics covers methods which reduce the effect of outliers. If you consider the mean, if you have one extreme value in your data (either due to error or even if it's correct) the mean will be severely affected. The median, on the other hand, will not affected as much. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given, that - the distributions like Exponential and Rayleigh are heavy tailed distributions which means you are more likely to have extreme values which leads to the poorer performance of traditional estimates like mean and covariance. Use of Trimmed-Means, Winsorized Means, and Medians reduce the effect of these heavy tailed distributions on the estimates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll probably find the books on Robust Statistics go into much more detail and analysis than you are looking for. Here are some references&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Introduction to Robust Estimation and Hypothesis Testing by Rand Wilcox&lt;/li&gt;&#xA;&lt;li&gt;Robust Statistics Theory and Methods by Maronna, Martin, Yohai&lt;/li&gt;&#xA;&lt;li&gt;Robust Statistics by Hampel&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2016-01-12T14:38:45.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28242" PostTypeId="2" ParentId="28208" CreationDate="2016-01-12T15:25:16.580" Score="2" Body="&lt;p&gt;After a bit more digging I found a &lt;a href=&quot;http://dev.theomader.com/gaussian-kernel-calculator/&quot; rel=&quot;nofollow&quot;&gt;gaussian kernel calculator&lt;/a&gt; that seems to suggest sigma is roughly half the blur radius, and kernel size should be somewhere around (sigma*4)+1 for a full blur.&lt;/p&gt;&#xA;" OwnerUserId="19022" LastActivityDate="2016-01-12T15:25:16.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28243" PostTypeId="2" ParentId="28230" CreationDate="2016-01-12T18:49:47.767" Score="1" Body="&lt;p&gt;High-pass filter the input with a zero-phase filter to eliminate the signal of interest, leaving only the high-passed noise. If the signal is periodic, you can do this in the frequency domain and convert back to time domain by IFFT. Find the time of the peak and deduce the magnitude of the unfiltered delta function from the magnitude of the filtered delta function (the peak value or &lt;a href=&quot;https://en.wikipedia.org/wiki/Root_mean_square&quot; rel=&quot;nofollow&quot;&gt;root mean square&lt;/a&gt;). Knowing the delay and magnitude, subtract the noise from the original input signal. Do FFT.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-01-12T18:49:47.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28244" PostTypeId="1" CreationDate="2016-01-12T19:34:28.423" Score="1" ViewCount="6305" Body="&lt;p&gt;Given a general filter equation, how can one tell the type of filter that the same equation represents? Meaning how can I know if the filter is Low/High/Band Pass etc...?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ y_{n} = x_{n} + x_{n-2} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Represents a &quot;Band Stop&quot; filter, but why?&lt;/p&gt;&#xA;" OwnerUserId="19052" LastActivityDate="2016-05-11T23:33:37.610" Title="Determining type of filter given its equation" Tags="|filters|transfer-function|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28245" PostTypeId="2" ParentId="28244" CreationDate="2016-01-12T20:11:02.397" Score="2" Body="&lt;p&gt;The $\mathcal Z$-transform of the given difference equation is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = 1 + z^{-2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put $z= \exp(j\omega)$ and remember that in discrete time systems the low frequencies are at $2n\pi$ $(n=0,1,2, \ldots)$ and the high frequencies occur at $(2n+1)\pi$; this is just a consequence of the periodic behavior of the discrete time complex exponentials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, $H(z) = 1 + \exp(-2j\omega)$ at $z = \exp(j\omega)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When $\omega=0; H(z) = 2$ and $w = \pi$ gives $H(z)= 2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, both at high and low frequencies the the system function provides same &#xA;gain and hence the filter with the given $H(z)$ is a &lt;strong&gt;BAND REJECT/ NOTCH FILTER&lt;/strong&gt; with $H(z) = 0$ at $\omega = \pi/2$.&lt;/p&gt;&#xA;" OwnerUserId="18535" LastEditorUserId="1629" LastEditDate="2016-01-12T20:56:52.093" LastActivityDate="2016-01-12T20:56:52.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28246" PostTypeId="2" ParentId="24064" CreationDate="2016-01-12T20:17:49.167" Score="0" Body="&lt;p&gt;It is generally quite useful to start from the filters we know. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\alpha$-trimmed filters exist with two types: the outer (average in the inner interval) and the inner-trimmed (average of the outer intervals). The latter is sometimes called $\alpha$-trimmed complementary mean. The $0.5$-trimmed inner filter is the median filter. The $0$-trimmed inner filter is the standard mean. The $0$-trimmed outer filter is the midpoint or midrange filter.  You can learn a great deal on them with &lt;a href=&quot;http://dx.doi.org/10.1109/TASSP.1984.1164279&quot; rel=&quot;nofollow&quot;&gt;Alpha-trimmed means and their relationship to median filters&lt;/a&gt;, Bednar &lt;em&gt;et al&lt;/em&gt;., 1984.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The efficiency can be probed in many ways, for instance with maximum likelihood estimators. The mean is a quite efficient central tendency estimator for mesokurtic noises, like the Gaussian. The median can be better (more robust to outliers) for leptokurtic (heavy-tailed) distributions, like the Laplacian. The midrange, seldom used, is optimal for uniform distributions. It is not robust at all, but the $\alpha$-trimmed midrange addresses robustness. The median is alright for impulse noises, such as salt, pepper, or salt-and-pepper. You can read &lt;a href=&quot;http://www.math.cuhk.edu.hk/~rchan/paper/impulse/impulse.pdf&quot; rel=&quot;nofollow&quot;&gt;Salt-and-Pepper Noise Removal by Median-type Noise Detectors and Detail-preserving Regularization&lt;/a&gt;, Raymond H. Chan, Chung-Wa Ho, and Mila Nikolova. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The contraharmonic mean (discovered by the Greek mathematician Eudoxos in the 4th century BCE) is, strictly speaking, of the form: $\frac{a^2_i}{a_i}$ (using a tensor-like notation). Its generalized version is the  generalized contraharmonic mean: $\frac{a^{p+1}_i}{a^p_i}$ (as written by @Dipan Mehta).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like the paper &lt;a href=&quot;http://dx.doi.org/10.1109/TASSP.1986.1164857&quot; rel=&quot;nofollow&quot;&gt;Nonlinear mean filters in image processing&lt;/a&gt;, I. Pitas, A. N. Venetsanopoulos, 1984, or their book &lt;a href=&quot;http://www.springer.com/fr/book/9780792390497&quot; rel=&quot;nofollow&quot;&gt;Nonlinear digital filters: principles and applications&lt;/a&gt;. They explain that while the median has been extensively used for impulse noise removal, it deteriorates rapidly by increasing the probability of spike occurrence. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other side, contraharmonic filters tend to distribute positive (resp. negative) spikes to their surrounding pixels (depending on the sign of $p$), and do not handle nicely enough two-sided impulse noise removal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also read &lt;a href=&quot;https://books.google.fr/books?isbn=0125004516&quot; rel=&quot;nofollow&quot;&gt;Nonlinear Image Processing&lt;/a&gt;, Sanjit Kumar Mitra and Giovanni L. Sicuranza, 2001.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-12T20:17:49.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28247" PostTypeId="2" ParentId="28169" CreationDate="2016-01-12T22:34:43.237" Score="4" Body="&lt;p&gt;up arrow from me, Olli.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but for some reason, i think the answer is much simpler.  normally i like to design acausal symmetric FIR filters, because they are zero phase, but usually i limit myself to an odd number of non-zero taps.  to do this more generally, i might stick to the causal FIR moving average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let's say the number of taps is $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = \frac{1}{N} \sum\limits_{k=0}^{N-1} x[n-k] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;applying $\mathcal{Z}$-transform (and the geometric summation formula):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; Y(z) &amp;amp; = \frac{1}{N} \sum\limits_{k=0}^{N-1} X(z) z^{-k} \\&#xA;      &amp;amp; = X(z) \frac{1}{N} \sum\limits_{k=0}^{N-1} z^{-k} \\&#xA;      &amp;amp; = X(z) \frac{1}{N} \frac{1 - z^{-N}}{1 - z^{-1}} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;substituting $z \ \leftarrow \ e^{j \omega}$ to get the DTFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; Y(e^{j \omega}) &amp;amp; = X(e^{j \omega}) \ \frac{1}{N} \frac{1 - (e^{j \omega})^{-N}}{1 - (e^{j \omega})^{-1}} \\&#xA;                 &amp;amp; = X(e^{j \omega}) \ \frac{1}{N} \frac{1 - e^{-j \omega N}}{1 - e^{-j \omega}} \\&#xA;                 &amp;amp; = X(e^{j \omega}) \ \frac{e^{-j \omega N/2}}{N \ e^{-j \omega/2}} \  \frac{e^{j \omega N/2} - e^{-j \omega N/2}}{e^{j \omega/2} - e^{-j \omega/2}} \\&#xA;                 &amp;amp; = X(e^{j \omega}) \ \frac{e^{-j \omega (N-1)/2}}{N} \  \frac{e^{j \omega N/2} - e^{-j \omega N/2}}{e^{j \omega/2} - e^{-j \omega/2}} \\&#xA;                 &amp;amp; = X(e^{j \omega}) \ \frac{e^{-j \omega (N-1)/2}}{N} \  \frac{ \sin(\omega N/2)}{ \sin(\omega/2) } \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;normally we call the thing that multiplies $X(z)$ the &quot;transfer function&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = \frac{1}{N} \frac{1 - z^{-N}}{1 - z^{-1}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the thing that multiplies $X(e^{j \omega})$, the &quot;frequency response&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(e^{j \omega}) =  e^{-j \omega (N-1)/2} \ \frac{\sin(\omega N/2)}{N \ \sin(\omega/2)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the $e^{-j \omega (N-1)/2}$ factor means a linear-phase, constant delay of $\frac{N-1}{2}$ samples.  it does not change the gain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the $\frac{\sin(\omega N/2)}{N \ \sin(\omega/2)}$ factor is the gain factor.  the &quot;-3 dB frequency&quot;, $\omega_c$, (normally we mean the -3.0103 dB frequency because that corresponds to the &quot;half power&quot; frequency) is such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \left| H(e^{j \omega_c}) \right|^2 = \frac{1}{2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \left( \frac{\sin(\omega_c N/2)}{N \ \sin(\omega_c/2)} \right)^2 = \frac{1}{2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ 2 \ \sin^2(\omega_c N/2) = N^2 \ \sin^2(\omega_c/2) \ .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so given the number of taps $N$, you have to solve for $\omega_c$.  that might not be so easy to do for a closed form, but you can dig out your calculator and plug and chug until you get an answer that has sufficient precision.  or you can get MATLAB to do it.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;a decent approximation for $\omega_c$ can be had for large $N$ by using a trig identity (one i commonly use when i'm fiddling with the bilinear transform) and the first &lt;strong&gt;three&lt;/strong&gt; terms for the Maclaurin series for $\cos()$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} &#xA;\sin^2(\theta) &amp;amp; = \frac{1}{2}(1 \ - \ \cos(2 \theta)) \\&#xA;               &amp;amp; \approx \frac{1}{2}\left(1 \ - \ \left(1 - \frac{(2\theta)^2}{2!} + \frac{(2\theta)^4}{4!} \right) \right) \\&#xA;               &amp;amp; = \frac{1}{2}\left( \frac{(2\theta)^2}{2!} - \frac{(2\theta)^4}{4!} \right) \\&#xA;               &amp;amp; = \theta^2 \left(1 - \frac{\theta^2}{3} \right)  \\&#xA; \end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you plug in that approximation for $\sin^2()$ in the previous equation and solve...  (skipping a lotta steps because i am too lazy to $\LaTeX$ it out...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega_c \approx \sqrt{\frac{12}{2 N^2 - 1}} \xrightarrow{ \quad N \to \infty \quad} \frac{\sqrt{6}}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Olli, how well does that compare to your results?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;doing this one better with another term for the approximation of $\sin^2()$, is doable, requires only a quadratic solution for $\omega_0^2$.  the approximation to use (keeping the first &lt;strong&gt;four&lt;/strong&gt; terms of the $\cos()$ expansion) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} &#xA;\sin^2(\theta) &amp;amp; = \frac{1}{2}(1 \ - \ \cos(2 \theta)) \\&#xA;               &amp;amp; \approx \frac{1}{2}\left(1 \ - \ \left(1 - \frac{(2\theta)^2}{2!} + \frac{(2\theta)^4}{4!} - \frac{(2\theta)^6}{6!} \right) \right) \\&#xA;               &amp;amp; = \frac{1}{2}\left( \frac{(2\theta)^2}{2!} - \frac{(2\theta)^4}{4!} + \frac{(2\theta)^6}{6!} \right) \\&#xA;               &amp;amp; = \theta^2 \left(1 - \frac{1}{3}\theta^2 + \frac{2}{45}\theta^4  \right)  \\&#xA; \end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;try that approximation and solve for $\omega_c^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the most consistent answer i get is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;\omega_c^2 &amp;amp; = (15)\frac{2N^2-1}{2N^4-1} \pm \sqrt{ \left((15)\frac{2N^2-1}{2N^4-1} \right)^2 - \frac{360}{2N^4-1} } \\&#xA;   &amp;amp; = \frac{15(2N^2-1) \pm 6\sqrt{5 \left(N^4 - 5N^2 - \tfrac{13}{4} \right)}}{2N^4 - 1} \\&#xA;           \\&#xA; \omega_c^2 &amp;amp; \xrightarrow{ \quad N \to \infty \quad} \frac{15 \pm 3\sqrt{5}}{N^2}&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the &quot;$+$&quot; option it looks like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega_c  \xrightarrow{ \quad N \to \infty \quad} \frac{\sqrt{21.7}}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and with the &quot;$-$&quot; option it looks like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega_c  \xrightarrow{ \quad N \to \infty \quad} \frac{\sqrt{8.3}}{N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is much closer to the &lt;em&gt;&quot;first-order&quot;&lt;/em&gt; approximation i did above.  so i guess i would take the &quot;$-$&quot; option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, even though i cannot say analytically why the &quot;$+$&quot; option should be rejected, i guess my most accurate answer would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \omega_c = \sqrt{ \frac{15(2N^2-1) - 6\sqrt{5 \left(N^4 - 5N^2 - \tfrac{13}{4} \right)}}{2N^4 - 1} } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has the limit, for large $N$, shown above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;does anyone else have a better way to look at a good approximate closed-form solution to this?&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-01-13T20:20:09.563" LastActivityDate="2016-01-13T20:20:09.563" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="28248" PostTypeId="1" CreationDate="2016-01-13T02:11:48.047" Score="1" ViewCount="574" Body="&lt;p&gt;What is the difference between power and energy of OFDM signal. How to calculate energy of an OFDM signal, if we consider OFDM symbol size is 64, and QPSK is used as modulation scheme?&lt;/p&gt;&#xA;" OwnerUserId="18473" LastActivityDate="2016-01-13T02:11:48.047" Title="How to calculate energy of an OFDM signal?" Tags="|fft|ofdm|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28249" PostTypeId="2" ParentId="28230" CreationDate="2016-01-13T06:05:09.730" Score="1" Body="&lt;p&gt;There is more effective method for decision of  your problem. Try to use some non-linear filter in &lt;strong&gt;time domain&lt;/strong&gt; before calculating of FFT. Median filter is simple and effective filter for reducing impulse noise (&lt;a href=&quot;https://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;Median_filter&lt;/a&gt;). You can use simplest version with size of 3.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is answer to comment of zimbra314.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strange constraint. It is easy to reduce impulse noise in time-domain, but not in frequency-domain. But, is it your homework? If so I can give you a hint. Please do FFT of delta function. See to amplitude and phase of this spectrum. The amplitude spectrum of delta function has very simple form and there are a lot of high-frequency components. Your signal is band-limited, so there are not any high-frequency components. So you can easy estimate a amplitude spectrum of your noise . As you know, FFT of sum of 2 function ($x+\eta$) is sum of FFT of this signals. So you can calculate amplitude of $X$ very easy by subtraction amplitude spectrum of noise from $\hat{X}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to estimate phase spectrum of delta function. See phase for different values of shift of delta function... I think you will find method of estimation of phase spectrum yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectrum of delta function ($\eta(n)= R\delta (n-l)$) is quite simple and well known. Spectrum of your band limiting signal $x$ does not have any high-frequency components. So high frequency components of spectrum of ($x+\eta$) equals to high frequency components spectrum of $\eta$. Algorithm is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;calculate $\hat{X}=FFT(\hat{x})$&lt;/li&gt;&#xA;&lt;li&gt;estimate parameters of spectrum delta function $\eta$ from high-frequency part of  $\hat{X}$ &lt;/li&gt;&#xA;&lt;li&gt;calculate estimating spectrum $\Theta$ by using parameters from step 2&lt;/li&gt;&#xA;&lt;li&gt;calculate estimation of ${X}=\hat{X} - \Theta$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1849" LastEditorUserId="1849" LastEditDate="2016-01-15T04:35:57.500" LastActivityDate="2016-01-15T04:35:57.500" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="28250" PostTypeId="1" AcceptedAnswerId="28342" CreationDate="2016-01-13T08:54:59.903" Score="3" ViewCount="873" Body="&lt;p&gt;We have a signal sampled att 22 kHz that we want to interpolate to 40 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we can do this by upsampling by a factor 20, then downsampling by a factor 11. My question regards the choice of cut-off frequencies after the upsampling and the downsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The old Nyquist frequency was at $11$ kHz so it would make sense to me to low-pass frequencies above $11$ kHz after upsampling - we're basically replicating our signal 20 times across the new spectra, right? The correct cut-off is apparently 20 kHz, but I can't quite wrap my head around that fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then downsample by a factor 11 to 40 kHz. Now the correct LP cut-off is 11 kHz. I am seriously confused. Can anyone shed some wisdom here?&lt;/p&gt;&#xA;" OwnerUserId="9140" LastActivityDate="2016-01-19T10:37:13.987" Title="Cut-off frequencies for fractional sample rate adjustment" Tags="|sampling|interpolation|downsampling|decimation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28251" PostTypeId="1" AcceptedAnswerId="28413" CreationDate="2016-01-13T09:08:17.837" Score="1" ViewCount="284" Body="&lt;p&gt;The energy of a continuous signal $x(t)$ recorded between $t=0$ and $t=T$ (namely $x(t \notin [0, T]) = 0$) is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E = \int_0^T |x(t)|^2\, dt.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most signal processing texts I met, the formula for the energy of the same signal sampled at $N$ regular steps separated by $\Delta t$ is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_N = \sum_{n=0}^{N-1} |x_n|^2,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which implies an implicit normalisation of the signal.&#xA;As I would like to keep track of the physical units, I am inclined to use &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_N = \sum_{n=0}^{N-1} |x_n|^2 \Delta t.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, Parseval's identity gives, in the continuous case,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E = \int_0^T |x(t)|^2\, dt = \int_{-\infty}^\infty |\hat{x}(f)|^2\, df,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\hat{x}$ is the Fourier transform of $x$.&#xA;This leads to define the /energy density/ as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e(f) = |\hat{x}(t)|^2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would translate this in the discrete case as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_N = \sum_{n=0}^{N-1} |x_n|^2 \Delta t = \Delta t^2 \sum_{k=0}^{N-1} a_k^2 \Delta f,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\Delta f = 1/T$, and the $(a_k)$ are the Fourier amplitudes and such that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\forall \; k \in \{0, N-1\}, \, \sum_{n=0}^{N-1} x_n e^{-2i\pi k \frac{n t}{T}}&#xA;                                      = a_k e^{i \phi_k},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I would define the discrete energy density as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e_N(f) = \Delta t^2 |a_k|^2 \text{ for } k \Delta f \leq f &amp;lt; (k+1) \Delta f.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this sounds sane to practitioners of the field?&lt;/p&gt;&#xA;" OwnerUserId="16514" LastEditorUserId="16514" LastEditDate="2016-01-15T16:00:53.893" LastActivityDate="2016-01-22T13:33:08.810" Title="Keeping track of units for spectral energy of discrete signals" Tags="|fourier-transform|power-spectral-density|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28252" PostTypeId="1" CreationDate="2016-01-13T09:14:17.277" Score="1" ViewCount="1025" Body="&lt;p&gt;I am implementing a fractional delay for resampling purposes, using the Farrow structure to enable continuously variable delays. For now I am simply using windowed sinc functions as my low-pass filters. My method was originally as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a series of $K$ $N$-sample windowed sinc functions covering the delay range: $N/2-1$ to $N/2$, and all the fractional delay values ($d$) in between.&lt;/li&gt;&#xA;&lt;li&gt;For each sample across all the filters, create a $K-1^{th}$ order polynomial in d to replace the coefficients.&lt;/li&gt;&#xA;&lt;li&gt;Stick the poynomial coefficients into a Farrow structure filter, and Bob's your uncle.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, on reading some papers &lt;a href=&quot;https://fedcsis.org/proceedings/2012/pliks/295.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this for example&lt;/a&gt;, it became apparent that I need to consider the &quot;overall filter&quot;; all the separate polyphase branch filters from the farrow structure lumped together. Now, taking this into account, if I crate my individual filters as above, ranging from $N/2-1$ to $N/2$, then I have a problem, as shown in the image. The &quot;overall filter&quot; is not a nice lowpass function anymore. Essentially it the two filters at $N/2-1$ and $N/2$ are the same, just delayed 1 sample, so we get the reptition of values shown in the plot. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E2EGH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E2EGH.png&quot; alt=&quot;Bad sinc&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt at solving this is instead to create my initial filters over the range &lt;code&gt;N/2-1+0.5/K : N/2-0.5/K&lt;/code&gt;. This way, they are still evenly distributed in terms of delay and now the &quot;overall filter&quot; looks great:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hxNFg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hxNFg.png&quot; alt=&quot;Good sinc (yes I know it&amp;#39;s not windowed :) &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT... now my delays do not cover a full sample of fractional delay, but instead $1-1/K$ samples. The only way to approach a full 1-sample range is to increase $K$, the number of filters created at the start, and this is not ideal as it just increases computation and I am VERY restricted in that sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried a second approach, creating $K$ original filters, then approximating with an $L^{th}$ order polynomial, where $L &amp;lt; K$. This allows me to create a large ($K$) number of filters to start with, so I can get very close to the full &lt;code&gt;N/2-1 : N/2&lt;/code&gt; range, then approximate with a low order polynomial. This is OK, but it does introduce some unwanted artefacts into the &quot;overall filter&quot; response.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, my questions is this: Is there a way to have it all; a low-order farrow fractional delay filter, that covers the full range of a sample delay, without introducing any nasties into the frequency response of the &quot;overall filter&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts welcome :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I know the sinc functions in the plots are rectangular windowed and thus have a high sidelobes, but this is not my problem.&lt;/p&gt;&#xA;" OwnerUserId="16404" LastEditorUserId="8202" LastEditDate="2016-01-13T09:31:18.733" LastActivityDate="2017-12-04T20:19:53.827" Title="Farrow fractional delay filter - Range of delay?" Tags="|delay|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28253" PostTypeId="1" CreationDate="2016-01-13T11:46:05.703" Score="2" ViewCount="65" Body="&lt;p&gt;As a continuation to &lt;a href=&quot;https://dsp.stackexchange.com/questions/28217/how-do-i-calculate-the-eigenvalues-of-a-covariance-matrix-which-contains-harmoni&quot;&gt;this question&lt;/a&gt;, I took the matrix $C_{2 \times 2}$ which is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C=\left[&#xA;    \begin{array}{}&#xA;      a&amp;amp; ace^{-\frac{|\phi_1-\phi_2|}{2}}\\&#xA;      ace^{-\frac{|\phi_1-\phi_2|}{2}} &amp;amp; a    &#xA;    \end{array}&#xA;\right] $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I found its eigenvector and eigenvalues which are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$v_1 = \left[&#xA;    \begin{array}{}&#xA;      1 \\&#xA;      1    &#xA;    \end{array}&#xA;\right]&#xA;,v_2 = \left[&#xA;    \begin{array}{}&#xA;      -1 \\&#xA;      1    &#xA;    \end{array}&#xA;\right] \\ \lambda_1 = a+ace^{-\frac{|\phi_1-\phi_2|}{\rho}},\lambda_2 = a-ace^{-\frac{|\phi_1-\phi_2|}{\rho}} &#xA; $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it is still not clear to me why the author says that the eigenvectors have the form $e^{in\phi_i}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This form doesn't even have the shape of a vector, and I specifically found the eigenvectors, and there isn't any complex component in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/G0ZSi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G0ZSi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16077" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-01-19T11:39:32.310" Title="Eigenvalues of correlation matrix which have the form of an harmonic function" Tags="|fourier-transform|linear-systems|correlation|statistics|linear-algebra|" AnswerCount="0" CommentCount="4" ClosedDate="2016-01-19T14:14:39.317" ContentLicense="CC BY-SA 3.0" />
  <row Id="28256" PostTypeId="1" AcceptedAnswerId="28257" CreationDate="2016-01-13T14:06:30.300" Score="0" ViewCount="236" Body="&lt;p&gt;&lt;strong&gt;Intro:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a signal source &lt;code&gt;S&lt;/code&gt; which emits a PAM modulated signal, bits encoded as &lt;code&gt;+g(t)&lt;/code&gt; and &lt;code&gt;-g(t)&lt;/code&gt; pulses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matched filter for &lt;code&gt;S&lt;/code&gt; is &lt;code&gt;f&lt;/code&gt; - &lt;code&gt;f&lt;/code&gt; is a function of &lt;code&gt;g&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;code&gt;S&lt;/code&gt; is fed to an FM modulator and yields a modulated signal, &lt;code&gt;S'&lt;/code&gt;, let's call the corresponding matched filter of the modulated signal &lt;code&gt;f'&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;code&gt;f&lt;/code&gt; is known how can &lt;code&gt;f'&lt;/code&gt; be computed ?&lt;/p&gt;&#xA;" OwnerUserId="19066" LastActivityDate="2016-01-13T14:31:12.747" Title="How Matched filter is transformed due to frequency modulation?" Tags="|filters|filter-design|modulation|matched-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28257" PostTypeId="2" ParentId="28256" CreationDate="2016-01-13T14:31:12.747" Score="2" Body="&lt;p&gt;Normally you wouldn't try to do the match filter directly on the received FM signal.  Typically the receiver path would look something like this-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Received Signal -&gt; Noise/Interference Filter -&gt; FM Demod -&gt; Matched Filter&lt;/p&gt;&#xA;" OwnerUserId="923" LastActivityDate="2016-01-13T14:31:12.747" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28258" PostTypeId="2" ParentId="28252" CreationDate="2016-01-13T15:52:51.467" Score="0" Body="&lt;p&gt;Use a lower order polynomial than K-1 and feed the polynomial fitter more sample points than K from your windowed Sinc, including below and above +-N/2.  Otherwise the lobe interpolators within the Farrow structure won't splice together nicely without larger discontinuities at the splice points.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-13T16:02:24.890" LastActivityDate="2016-01-13T16:02:24.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28259" PostTypeId="2" ParentId="28018" CreationDate="2016-01-13T15:56:22.963" Score="0" Body="&lt;p&gt;I would say that a matching Mother wavelet could be the best for detecting a transient; but both the selection and implementation would be much slower. The old adage: do you want quantity or quality :) or Bandwidth vs. noise.  Life doesn't come in our neat intellectual packets.&#xA;BTW: the simplest technique is an isolation capacitor and a threshold detector (sad to say I know a lot of ways to &quot;cheat&quot;  ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluation process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would look to octave or scilab for a simulator to use.&lt;br&gt;&#xA;Construct a model of transients you think are likely or that you are looking for.&lt;br&gt;&#xA;Pass the transients through various canned analysis routines and then&#xA;Find the transients in the output; the crisper the &quot;find&quot; the more applicable the analysis is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reconstruct the input and see how good the reconstruction is; i.e. apply an error criterion to achieve a faithfulness measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this seems tedious it's because it can be: but at each point in the process you get an idea about the effort involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Selection time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Design time and complexity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Execution time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And most importantly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowledge!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like the wavelet theory: start coarsely/crudely and refine the evaluation process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked on google and found:&#xA;----&lt;a href=&quot;http://www.soest.hawaii.edu/MET/Faculty/bwang/bw/paper/wang45.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.soest.hawaii.edu/MET/Faculty/bwang/bw/paper/wang45.pdf&lt;/a&gt;&#xA;A real application of Waveform/Wavelet analysis of El nino and such; with all the hair:&#xA;--&lt;a href=&quot;https://inst.eecs.berkeley.edu/~ee225b/sp14/lectures/shorterm.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://inst.eecs.berkeley.edu/~ee225b/sp14/lectures/shorterm.pdf&lt;/a&gt;&#xA;Which has a description of the process and history.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.506.6298&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.506.6298&amp;amp;rep=rep1&amp;amp;type=pdf&lt;/a&gt;&#xA;Which discusses real usage ambiguity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;a href=&quot;https://dsp.stackexchange.com/questions/8079&quot;&gt;Why Wavelet developed when we already had Short-time Fourier transform&lt;/a&gt;&#xA;Which links to another discussion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--&lt;a href=&quot;https://en.wikipedia.org/wiki/Wavelet&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Wavelet&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back to question:&#xA;Most of the techniques are &quot;complete&quot; in the sense that the transforms are invertable and can recover the original input.  In that sense all invertable transforms are equivalent.  But like I said they isolate different features.  Wavelet transforming is a mathematical process for utilizing Mother wavelets to isolate information in time and space. STFT is very specific whereas there are innumerable of &quot;wavelet transforms&quot; each having different sampling Mother wavelet shapes that are applied recursively to give many (time, freq) graphs; two dimensional pictures.&#xA;STFT and Gabor and such are (as far as I know) specific but closely correspond to normal fourier/z-transform analysis.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;There are a lot of c wavelet programs in the open source domain.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;An effort to clarify &quot;disturbance&quot; analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First you have to  be able to define what a disturbance is and then the allowable type one/type two results; i.e. false positives/negatives and then do the system design around this.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me list a few &quot;disturbances&quot;; not necessarily related to power supplies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a nuclear containment vessel we tried to &quot;listen&quot; for what amounts to tearing at 100khz-1Mhz with transducers.  A time exponential increase in the power of the signal was taken as (and experimentally verified) an indication of a problem.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as power supplies go:&#xA;There are safety related issues such as over-voltage causing downstream failures.  For these I always put in absolute hardware; zeners, surge suppressors.  That I think will limit damage and fail-safe; shut things down.  Do the thermal calculations with respect to the calories produced by hardware shunts.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under-voltage is also a problem in some cases, as I found out by almost smashing a co-workers hand.  Dropping the field voltage to a DC shunt drive motor causes it to speed up :)  So &quot;pulling the plug&quot; at random is not a great idea; and a drop in field voltage should probably be acted on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other expected cases are parasitic resonances/oscillations occurring in the output power stage of supplies.  These are typically produced by altered frequency response characteristics of bipolar output transistors during transitions.  Typically these are real transients and not worrisome unless some downstream equipment is sensitive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have specification errors where for some reason, say a passing cyclotron, the system is substantially normal but some specified tolerance is breached.  This can also happen slowly when equipment ages and drifts out of spec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course in motor-generator situations transient signals might indicate mechanical wear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you have fast raw supply transients that find their way through the regulators and occur at the output.  That's the reason I use hardware suppresors/zeners that can absorb some over-voltage attempts without allow ing the disturbance through and recover easily.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-01-29T15:45:54.850" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28260" PostTypeId="1" AcceptedAnswerId="28264" CreationDate="2016-01-13T15:59:33.830" Score="0" ViewCount="39" Body="&lt;p&gt;While reading the book DSP by Proakis and Manolakis i came across the concept of digitization of signals. The Author states that Digitization(rounding  it off to nearest integer) of signal is necessary in order for it to be processed by computer. If i write the following code :-&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float signal[5]={ 1.5 , 1 , 4.4 , 3 , 2 , 3 };&#xA;for(int i=0;i&amp;lt;5;i++){&#xA;    signal[i]*=2;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, In this above code I am able to process the signal without rounding it off to the nearest integer. Please help me clear my doubt.&lt;/p&gt;&#xA;" OwnerUserId="18386" LastEditorUserId="18386" LastEditDate="2016-01-13T16:26:06.690" LastActivityDate="2016-01-13T19:48:36.307" Title="Is digitization of discrete valued signal necessary for it to be processed?" Tags="|dsp-core|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28261" PostTypeId="2" ParentId="16821" CreationDate="2016-01-13T16:27:44.517" Score="5" Body="&lt;p&gt;All bounded periodic signals are power signals, because they do not converge to a finite value so their energy is infinite and their power is finite.&#xA;So we say that a signal is a power signal if its power is finite and its energy is infinite.&#xA;And the signal is an energy signal if its energy is finite and power is zero.&lt;/p&gt;&#xA;" OwnerUserId="19070" LastEditorUserId="80" LastEditDate="2019-07-02T17:47:16.153" LastActivityDate="2019-07-02T17:47:16.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28262" PostTypeId="1" CreationDate="2016-01-13T18:27:15.410" Score="6" ViewCount="1915" Body="&lt;p&gt;I have been reading about &quot;all-digital&quot; or &quot;software-defined radars&quot;. Lately, I was trying to simulate an FMCW short range radar in Matlab. One thing that struck me during the simulation is that to achieve a range resolution of around a 100 cm or less, the signal bandwidth is quite large -- in multiple GHz. This means, if one wishes to realise a digital implementation, one needs a &lt;em&gt;really&lt;/em&gt; high speed ADC - multiple GigaSamples/second. Such ADCs are either not available and if you find something towards the top end of the high speed ADCs out there, the processing requirements are going to be ridiculously high. And of course, if you are clocking your baseband processor in GigaHertz, the power requirements of the device (typically an FPGA) are again going to be impractical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How, if at all, high-resolution, high-bandwidth digital radars are realised in practice?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;what would make sense in case of FMCW radar is to mix the transmitted signal and the target return signal and digitize only the beat frequency for Inverse FFT and further analysis. In that case, could you still call it a digital or software defined radar?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4673" LastActivityDate="2016-05-23T15:46:52.117" Title="fmcw radar sampling requirements" Tags="|sampling|software-implementation|radio|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28263" PostTypeId="2" ParentId="28169" CreationDate="2016-01-13T19:16:40.093" Score="6" Body="&lt;p&gt;Let's compare the actual numerical errors for different approximations of the cutoff frequency. The error given in the table is calculated by subtracting the true (numerically solved) -3 dB cutoff frequency $\omega_c$ from the approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{rl}&#xA;\text{a})&amp;amp;\frac{2.78311475650302030063992}{N}\\&#xA;\text{b})&amp;amp;\frac{2.78311475650302030063992}{\sqrt{N^2-1}}\\&#xA;\text{c})&amp;amp;\frac{2.78311475650302030063992}{\sqrt{N^2 - 0.8603235992780290790596}}\\&#xA;\text{d})&amp;amp;\sqrt{\frac{12}{2 N^2 - 1}}\\&#xA;\text{e})&amp;amp;\sqrt{ \frac{15(2N^2-1) - 6\sqrt{5 \left(N^4 - 5N^2 - \tfrac{13}{4} \right)}}{2N^4 - 1} }\\&#xA;\text{f})&amp;amp;\frac{2.78311475650302030063992}{\sqrt{N^2 - 0.863031932778066}}\\&#xA;\text{g})&amp;amp;\sum_{i=1}^{5}\frac{a_{2i-1}}{N^{2i-1}}\\&#xA;\text{h})&amp;amp;\frac{2.78311475650302030063992}{N} + \frac{1.20103120331802052770586}{N^3}\\&#xA;\text{i})&amp;amp;\frac{2.78311475650302030063992}{\sqrt{N^2-0.863084212040982824494534}}\\&#xA;\text{j})&amp;amp;\sum_{i=1}^{5}\frac{a_{2i-1}}{N^{2i-1}}\\&#xA;\end{array}$$&#xA;The coefficients $a_{2i-1}$ of approximation g) can be found in &lt;a href=&quot;https://dsp.stackexchange.com/questions/28169/3db-cut-off-frequency-of-moving-average/28297#28297&quot;&gt;this answer&lt;/a&gt; by Matt L.&#xA;The coefficients $a_{2i-1}$ of approximation j) are from the Laurent series of $\omega_c(N)$ and can be found in &lt;a href=&quot;https://dsp.stackexchange.com/a/28186/15347&quot;&gt;this answer&lt;/a&gt; by Olli.&#xA;$$\small\begin{array}{l}&#xA;\begin{array}{r|r|l}&#xA;N&amp;amp;\omega_c&amp;amp;\text{a)}&amp;amp;\text{b)}&amp;amp;\text{c)}&amp;amp;\text{d)}&amp;amp;\text{e)}\\&#xA;\hline&#xA;2 &amp;amp; 1.57079632679491894158970 &amp;amp; \text{-1.8E-01} &amp;amp; \text{3.6E-02} &amp;amp; \text{-1.1E-04&#xA;} &amp;amp; \text{-2.6E-01} &amp;amp; \text{n/a}\\&#xA;3 &amp;amp; 0.97561347715844261315892 &amp;amp; \text{-4.8E-02} &amp;amp; \text{8.4E-03} &amp;amp; \text{-1.1E-04&#xA;} &amp;amp; \text{-1.4E-01} &amp;amp; \text{7.7E-02}\\&#xA;4 &amp;amp; 0.71532874990708873792278 &amp;amp; \text{-2.0E-02} &amp;amp; \text{3.3E-03} &amp;amp; \text{-5.4E-05&#xA;} &amp;amp; \text{-9.3E-02} &amp;amp; \text{3.6E-02}\\&#xA;5 &amp;amp; 0.56648391394608301620215 &amp;amp; \text{-9.9E-03} &amp;amp; \text{1.6E-03} &amp;amp; \text{-2.9E-05&#xA;} &amp;amp; \text{-7.2E-02} &amp;amp; \text{2.4E-02}\\&#xA;6 &amp;amp; 0.46951346150003474555592 &amp;amp; \text{-5.7E-03} &amp;amp; \text{9.2E-04} &amp;amp; \text{-1.7E-05&#xA;} &amp;amp; \text{-5.8E-02} &amp;amp; \text{1.9E-02}\\&#xA;7 &amp;amp; 0.40113570464173577524525 &amp;amp; \text{-3.5E-03} &amp;amp; \text{5.7E-04} &amp;amp; \text{-1.1E-05&#xA;} &amp;amp; \text{-4.9E-02} &amp;amp; \text{1.5E-02}\\&#xA;8 &amp;amp; 0.35025879304883467987190 &amp;amp; \text{-2.4E-03} &amp;amp; \text{3.8E-04} &amp;amp; \text{-7.3E-06&#xA;} &amp;amp; \text{-4.3E-02} &amp;amp; \text{1.3E-02}\\&#xA;9 &amp;amp; 0.31089559074921709971474 &amp;amp; \text{-1.7E-03} &amp;amp; \text{2.7E-04} &amp;amp; \text{-5.2E-06&#xA;} &amp;amp; \text{-3.8E-02} &amp;amp; \text{1.1E-02}\\&#xA;10 &amp;amp; 0.27952023697999382800338 &amp;amp; \text{-1.2E-03} &amp;amp; \text{1.9E-04} &amp;amp; \text{-3.8E-06} &amp;amp; \text{-3.4E-02} &amp;amp; \text{1.0E-02}\\&#xA;100 &amp;amp; 0.02783234867299907373106 &amp;amp; \text{-1.2E-06} &amp;amp; \text{1.9E-07} &amp;amp; \text{-3.8E-09} &amp;amp; \text{-3.3E-03} &amp;amp; \text{9.6E-04}\\&#xA;1000 &amp;amp; 0.00278311595753499122100 &amp;amp; \text{-1.2E-09} &amp;amp; \text{1.9E-10} &amp;amp; \text{-3.8E-12} &amp;amp; \text{-3.3E-04} &amp;amp; \text{9.6E-05}\\&#xA;10000 &amp;amp; 0.00027831147685133324106 &amp;amp; \text{-1.2E-12} &amp;amp; \text{1.9E-13} &amp;amp; \text{-3.8E-15} &amp;amp; \text{-3.3E-05} &amp;amp; \text{9.6E-06}\\ &#xA;\end{array}\\&#xA;\begin{array}{r|l}&#xA;N&amp;amp;\text{f)}&amp;amp;\text{g)}&amp;amp;\text{h)}&amp;amp;\text{i)}&amp;amp;\text{j)}\\&#xA;\hline&#xA;2 &amp;amp; \text{-5.7E-04} &amp;amp; \text{-6.7E-12} &amp;amp; \text{-2.9E-02} &amp;amp; \text{5.8E-04} &amp;amp; \text{-1.7E-04}\\&#xA;3 &amp;amp; \text{-4.9E-05} &amp;amp; \text{6.2E-10} &amp;amp; \text{-3.4E-03} &amp;amp; \text{5.3E-05} &amp;amp; \text{-1.7E-06}\\&#xA;4 &amp;amp; \text{-9.9E-06} &amp;amp; \text{-6.8E-09} &amp;amp; \text{-7.8E-04} &amp;amp; \text{1.1E-05} &amp;amp; \text{-7.0E-08}\\&#xA;5 &amp;amp; \text{-2.8E-06} &amp;amp; \text{1.4E-08} &amp;amp; \text{-2.5E-04} &amp;amp; \text{3.4E-06} &amp;amp; \text{-6.0E-09}\\&#xA;6 &amp;amp; \text{-9.9E-07} &amp;amp; \text{3.1E-09} &amp;amp; \text{-1.0E-04} &amp;amp; \text{1.3E-06} &amp;amp; \text{-7.9E-10}\\&#xA;7 &amp;amp; \text{-3.9E-07} &amp;amp; \text{-4.4E-09} &amp;amp; \text{-4.6E-05} &amp;amp; \text{6.1E-07} &amp;amp; \text{-1.4E-10}\\&#xA;8 &amp;amp; \text{-1.7E-07} &amp;amp; \text{-7.2E-09} &amp;amp; \text{-2.4E-05} &amp;amp; \text{3.1E-07} &amp;amp; \text{-3.3E-11}\\&#xA;9 &amp;amp; \text{-7.0E-08} &amp;amp; \text{-7.7E-09} &amp;amp; \text{-1.3E-05} &amp;amp; \text{1.7E-07} &amp;amp; \text{-9.1E-12}\\&#xA;10 &amp;amp; \text{-2.7E-08} &amp;amp; \text{-7.2E-09} &amp;amp; \text{-7.7E-06} &amp;amp; \text{1.0E-07} &amp;amp; \text{-2.8E-12}\\&#xA;100 &amp;amp; \text{7.2E-11} &amp;amp; \text{-1.6E-11} &amp;amp; \text{-7.7E-11} &amp;amp; \text{9.8E-13} &amp;amp; \text{0}\\&#xA;1000 &amp;amp; \text{7.3E-14} &amp;amp; \text{-1.6E-14} &amp;amp; \text{-7.7E-16} &amp;amp; \text{1.1E-17} &amp;amp; \text{0}\\&#xA;10000 &amp;amp; \text{7.3E-17} &amp;amp; \text{-1.6E-17} &amp;amp; \text{0} &amp;amp; \text{0} &amp;amp; \text{0}\\ &#xA;\end{array}\\&#xA;\end{array}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notes: The approximation e) does not permit $N=2$. Some of the errors are listed as 0, but it only means their magnitude is less than about 1E-17. That and other possible inaccuracies are from use of double-precision floating point arithmetic in calculation of the approximation and the error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Feel free to edit/add another approximation.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2016-01-20T20:49:51.403" CommentCount="12" CommunityOwnedDate="2018-02-04T09:41:49.693" ContentLicense="CC BY-SA 3.0" />
  <row Id="28264" PostTypeId="2" ParentId="28260" CreationDate="2016-01-13T19:42:41.780" Score="0" Body="&lt;p&gt;Your 1.5 and 4.4 are scaled integers (scaled to the nearest 10th).  C float variables are also a form of scaled integer (exponent indicating the scale factor).  So your data is still rounded to the nearest of smaller scaled integers.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In binary digital computers everything gets converted and broken down into 1-bit integers (or sets of them) before processing by digital logic gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Analog computers work differently.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-13T19:48:36.307" LastActivityDate="2016-01-13T19:48:36.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28265" PostTypeId="1" CreationDate="2016-01-13T20:22:47.187" Score="3" ViewCount="209" Body="&lt;p&gt;I am working on ''Active noise cancellation for air vent'' project. I am&#xA;using NI myRIO1900, Audio Technica ATR 3350 omni directional microphones&#xA;and Tevion Loudspeakers. I have done the programming using LabVIEW and I&#xA;have used FPGA module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using sinusoidal noise source of (200-500 Hz) as test noise signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have implemented LMS on LabVIEW, as a preliminary results I am getting&#xA;around 8dB noise reduction but these results are pretty random in a sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only at certain volume levels( if I adjust very carefully), the noise&#xA;cancellation is happening and the variation in step size is not giving any&#xA;decent change ( again I have to make volume level changes to see some&#xA;results).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Over all, I am getting some results but I don't have control over the&#xA;results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my set up&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Vrv1S.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vrv1S.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;[the pipe length is 1 meter]  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I have to consider secondary path modelling and feedback modelling.&#xA;I have actually completed the coding of FBFxLMS also but I don't have any reasonable results with this also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my question is how to improve the acoustical design of my setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the problems using just cardboard material to simulate the environment of air vent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read in 2-3 places (&lt;a href=&quot;https://dsp.stackexchange.com/questions/27941/how-does-mic-combined-with-loudspeaker-work&quot;&gt;here in 2nd answer&lt;/a&gt;) that without proper acoustical design it is not possible to reduce the noise effectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quoting from a paper&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the acoustical design of the system is not optimized,the digital controller may not be able to attenuate the undesired noise adequately.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The only point I am aware of is using low frequency noises (&amp;lt;= 500Hz) to&#xA;consider the sound wave propagation as plane acoustic wave. I am&#xA;completely unaware of any other details on how to better my acoustical&#xA;design. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering how to find the limitations of how much a DSP will affect and how much the actual acoustic design. If anyone can provide some reasonable resources to go through, it will be highly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="17708" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-04-17T08:57:27.460" Title="Acoustical Design considerations for Active Noise Cancellation Project for Air vent" Tags="|audio|sound|acoustics|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28267" PostTypeId="2" ParentId="28169" CreationDate="2016-01-13T21:24:50.160" Score="4" Body="&lt;p&gt;OK, this is fun. I'm going to add my own thoughts and approximations, the first of which turns out to be identical to the one given by Massimo in &lt;a href=&quot;https://dsp.stackexchange.com/questions/9966/what-is-the-cut-off-frequency-of-a-moving-average-filter/14648#14648&quot;&gt;this answer&lt;/a&gt;, and the one derived by Olli in this thread. I still include it here because its derivation is different. Then I'll show a better approximation, which has a maximum relative error of $0.002$ for $N=2$ (for which case we of course have an analytic solution for the exact cut-off frequency: $\omega_c=\pi/2$), and for which the relative error is smaller than $1.2\cdot 10^{-4}$ for $N\ge 10$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is well known, and was shown by Olli and Robert in their answers, that the real-valued amplitude function of a length $N$ moving average filter is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_N(\omega)=\frac{\sin\left(\frac{N\omega}{2}\right)}{N\sin\left(\frac{\omega}{2}\right)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $3$ dB cut-off frequency $\omega_c$ satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_N(\omega_c)=\frac{1}{\sqrt{2}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know there is no reasonably simple analytic solution to Eq. $(2)$. The key to the approximations presented here is - not surprisingly - a Taylor approximation. The difference between the Taylor series used in Robert's answer is that I do not separately approximate the sine functions (or their squared values as in Robert's answers), but I directly approximate the complete amplitude function given in $(1)$. Approximating $\sin(N\omega/2)$ (or its squared value) will result in larger errors than when the complete function is approximated, because the argument $N\omega/2$ never approaches zero, even for large values of $N$. Approximating only the denominator $\sin(\omega/2)$ (or its squared value) is OK, because its argument $\omega=\omega_c$ does approach zero for large $N$. Anyway, I will use neither of the two approximations, but I will use the Taylor series of $H_N(\omega)$. For simpler notation I'll use $x=\omega/2$ and $F_N(x)=H_N(\omega)$. The Taylor series of $F_N(x)$ around $x_0=0$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_N(x)\approx 1-\frac{N^2-1}{6}x^2+\frac{3N^4-10N^2+7}{360}x^4\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For large values of $N$, this approximation is legitimate because the cut-off frequency $\omega_c$ tends to small values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first approximation I only use the first two terms in $(3)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1-\frac{N^2-1}{6}x_c^2=\frac{1}{\sqrt{2}}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solving $(4)$ gives a first approximate solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_{c1}=2x_c=\frac{2\sqrt{6(1-\frac{1}{\sqrt{2}})}}{\sqrt{N^2-1}}=\frac{2.65130859228473}{\sqrt{N^2-1}}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with this solution is that it is biased, which means that its error doesn't converge to zero for large $N$. However, it turns out that by a simple scaling of $(5)$, this biased can be removed. For zero bias we require&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lim_{N\rightarrow \infty}H_N(\omega_{c1}(N))=\frac{1}{\sqrt{2}}\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I used the notation $\omega_{c1}(N)$ to emphasize its dependence on $N$. Solving $(6)$ with the general expression&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_{c1}=\frac{a}{\sqrt{N^2-1}}\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;leads us to the equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\sin(a/2)}{a/2}=\frac{1}{\sqrt{2}}\tag{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which must be solved numerically for the by-now-famous solution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a=2.78311475650302\tag{9}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The approximation $(7)$ with $a$ given by $(9)$ is identical to Massimo's formula (you have to divide by $2\pi$ to get his magic constant), and it's also the same as the one derived by Olli in a different way in this thread. We see that a Taylor approximation gave us the correct form of the equation, but the constant had to be determined by a limit process in order to get a formula with zero bias. For most practical purposes, this formula is sufficiently accurate with a maximum relative error of $6.9\cdot 10^{-4}$ for $N\ge 10$.&#xA;&lt;hr&gt;&#xA;Using all terms in the approximation $(3)$ will give us an even better approximation. The process is exactly the same as before: we set the Taylor approximation of $F_N(x)$ equal to $1/\sqrt{2}$ and solve for $x_c$ (there are only even powers of $x$, so we only need to solve a quadratic equation). This gives us the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_{c2}(N)=2\sqrt{6}\sqrt{\frac{5(N^2-1)-\sqrt{5}\sqrt{(3\sqrt{2}-1)N^4+10(1-\sqrt{2})N^2+7\sqrt{2}-9}}{3N^4-10N^2+7}}\tag{10}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that of the four solutions of the quartic equation, we need to choose the smaller of the two positive ones, because that's the value where the Taylor series closely approximates $F_N(x)$. The other positive solution is an artefact in a range where the Taylor series diverges from $F_N(x)$. The approximation $(10)$ has the same small problem as the first version of the previous approximation given by $(5)$ in that it has a small bias. This bias can be removed in exactly the same way as before by considering the limit $(6)$, this time with $\omega_{c2}(N)$. My final approximation based on $(10)$ but with zero bias is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_{c3}(N)=b\omega_{c2}(N)\tag{11}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $b$ can also be obtained by solving an equation similar to $(8)$. It can actually be written in terms of $a$ given by $(9)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$b=\frac{a}{2\sqrt{2}\sqrt{5-\sqrt{5(3\sqrt{2}-1)}}}=0.997314251642175\tag{12}$$&#xA;&lt;hr&gt;&#xA;I computed the exact values of $\omega_c$ numerically for $N$ in the range $[2,100]$, so I could compute the relative error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\epsilon_i=\frac{\omega_c-\omega_{ci}}{\omega_c}\tag{13}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which allows the comparison of different approximations $\omega_{ci}$. I'll only discuss the approximations with zero bias: $\omega_{c1}$ given by $(7)$ with $a$ given by $(9)$, and $\omega_{c3}$ given by $(11)$ (and $(10)$), with $b$ given by $(12)$. The figure below shows the relative errors as defined by $(13)$ as a function of $N$. The red curve is the relative error of approximation $(7)$, and the green curve is the error of approximation $(11)$. Both approximation have zero bias (they converge to the exact values for large $N$), but the green curve converges significantly faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9ABu7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9ABu7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The zero-bias formulas shown above are decent approximations to the actual cut-off frequencies, but the better one (formulas $(10,11,12)$) is very awkward. Olli had the great idea to tweak the denominator constant in the simple formula $(7)$. As long as we use the optimal value of $a$ given by $(9)$, we can change the denominator constant without losing the zero-bias property. So we get a new formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_{c4}(N)=\frac{a}{\sqrt{N^2-c}}\tag{14}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with a constant $c$ to be optimized. If I understood correctly, Olli based his optimization of $c$ on the error value for $N=2$. However, I think that the value $N=2$ is not very relevant because for $N=2$, $\omega_c$ can be computed analytically: $\omega_c(2)=\pi/2$. So we don't necessarily need to optimize formula $(14)$ for the case $N=2$ if it comes at the expense of the approximation at larger values of $N$. I optimized the constant $c$ in $(14)$ in the following way. If $\omega_c(N)$ are the exact cut-off frequencies for a given set of filter lengths $N$, we have an overdetermined system of equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_c(N)\stackrel{!}{=}\frac{a}{\sqrt{N^2-c}},\qquad N=2,3,\ldots\tag{15}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we can choose any reasonable set of values for $N$. Rearranging $(15)$ gives another set of equations, this time linear in the unknown $c$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$N^2-c\stackrel{!}{=}\frac{a^2}{\omega_c^2(N)}\tag{16}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The optimal least squares solution of $(16)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_0=\frac{1}{L}\sum_N\left(N^2-\frac{a^2}{\omega_c(N)}\right)\tag{17}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $L$ is the number of different values for $N$ used in the sum. If you use all integer values of $N$ in the range $[2,100]$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_0=0.863031932778066\tag{18}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is close to Olli's value, but which gives an even better approximation for all $N\ge 3$. I added the error values to &lt;a href=&quot;https://dsp.stackexchange.com/questions/28169/3db-cut-off-frequency-of-moving-average/28263#28263&quot;&gt;this table&lt;/a&gt;, column f).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&lt;hr&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In his answer, Robert was wondering why he must discard the second (larger) positive solution for $\omega_c$ when using a fourth order Taylor series for $\sin^2(x)$. The figure below shows the reason. The original squared amplitude function is shown in blue (for $N=10$). The 3dB line is in red. The green function is the Taylor approximation, which crosses the red line twice. These are the two positive solutions for $\omega_c$. Since the function is even, we also get the same two solutions with negative signs, which makes it four, as should be the case for a fourth order polynomial. However, it is obvious that the larger of the two positive solutions is an artefact due to the divergence of the Taylor approximation for larger arguments. So it is only the smaller solution which makes sense, the other one doesn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j5ikx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j5ikx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-01-14T08:05:56.553" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28268" PostTypeId="1" AcceptedAnswerId="28269" CreationDate="2016-01-13T21:53:46.983" Score="0" ViewCount="308" Body="&lt;p&gt;I must strengthen my knowledge in the mathematical properties of signals, and would like to know the following thing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if I have a complex signal, written in magnitude and phase, it's like if I have 1 signal that holds 2 signal himself? I have this question because I have to do the inverse transformation of a signal in the frequency domain , that is complex and I have the magnitude and phase plot. Is it right that my phase, when I do the inverse- transform retards my signal ( the inverse transform of the magnitude) in the time domain? &#xA;Thank you so much.. I have not on focus how the phase works yet&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thank you for the answer, I know what you have written... my question is: &#xA;If I have one complex signal in the magnitude and phase form, do I have to consider magnitude and phase as two different signals? Look&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nvh2u.jpg&quot; alt=&quot;text&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal is written in  magnitude with a complex exponential with the phase... when I do the inverse transform the exponential is in the time domain a delay ... and this it feels strange that one signal bring with him a delay ... it's like if phase is another signal , that retards the inverse transform of the magnitude.&#xA;I hope I have explained my question in the right way&lt;/p&gt;&#xA;" OwnerUserId="19073" LastEditorUserId="80" LastEditDate="2016-01-14T12:38:26.883" LastActivityDate="2016-01-14T15:15:48.223" Title="Complex signal transform" Tags="|signal-analysis|fourier-transform|continuous-signals|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28269" PostTypeId="2" ParentId="28268" CreationDate="2016-01-13T23:17:14.513" Score="2" Body="&lt;p&gt;A complex signal can be written as $s(t)=a(t)+jb(t)$, which indeed corresponds to two real signals ($a(t)$ and $b(t)$) &quot;embedded&quot; in the single signal $s(t)$. What makes this interesting is that $a(t)$ and $b(t)$ can be easily recovered from $s(t)$. This is true whether you write the complex signal in rectangular or polar coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, regarding how to interpret the phase of a signal. Let's say that the Fourier transform of $s(t)$ is $S(f)=|S(f)|e^{j\phi(f)}$. Imagine that you have an infinitely narrow band-pass filter with center frequency $f_0$. Then, you connect the signal $s(t)$ to the filter's input and see the output in an oscilloscope. You'll see a sinusoidal wave, with frequency $f_0$, amplitude $|S(f_0)|$ and phase $\phi(f_0)$. Here, &quot;phase&quot; indicates the difference, in radians, between a zero-phase cosine $\cos(2\pi f_0t)$ and the sinusoid you see in the scope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that sense, the phase $\phi(f_0)$ can be thought of as a &quot;delay&quot;; the sinusoid in the scope is just a cosine with a delay, $\cos(2\pi f_0t+\phi(f_0))$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an application, consider a signal that goes through an LTI system. The system doesn't touch $|S(f)|$ but it modifies the phase $\phi(t)$ -- that is, it changes the phase of each individual sinusoid. If this results in &lt;em&gt;the same delay&lt;/em&gt; for each and every sinusoid, then the system output will be a delayed version of $s(t)$. If some of the sinusoids suffer different delays, then the signal at the system's output will be a distorted version of $s(t)$.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-01-14T15:15:48.223" LastActivityDate="2016-01-14T15:15:48.223" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28272" PostTypeId="2" ParentId="22840" CreationDate="2016-01-14T06:35:07.190" Score="1" Body="&lt;p&gt;As mentioned in question, the algorithm is needed for pre-recorded calls(not real time), So one can determine the frequency bins that represents the Dialtone/Ringtone by spectrum analysis(short time spectrogram). Once the Dialtone/Ringtone bins are known energy based VAD could be used, where energy calculation should be done excluding Dialtone/Ringtone bins for each frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two average energies could be used, one short term energy with high updation factor per frame and other long term energy with small updation factor per frame. every time short term energy is high for particular frame declare it as speech, otherwise non-speech. Tuning of the updation factor's is needed based on your recorded data.&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-01-14T06:35:07.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28275" PostTypeId="2" ParentId="28265" CreationDate="2016-01-14T12:06:17.413" Score="1" Body="&lt;p&gt;I first wasn't sure that this was in the scope of a &lt;strong&gt;digital&lt;/strong&gt; signal processing site, but then decided that it is about &lt;em&gt;limits&lt;/em&gt; and &lt;em&gt;environments&lt;/em&gt; for doing DSP, so it's quite on-topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your paper (&lt;strong&gt;what&lt;/strong&gt; paper? Please, please, get used to always correctly cite!) hit the spot:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the acoustical design of the system is not optimized,the digital controller may not be able to attenuate the undesired noise adequately.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think you understand quite well what they're saying: You've got to deal with signals in the real world, i.e. with actual, physical, pressure waves. You're doing that by modeling the real world mathematically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can of course only be a success if your reality is &quot;easy&quot; enough to fit your model. For example, your ANC probably assumes that there's a position for the noise emitter, and position(s) for the cancellation signal emitter(s). What it probably doesn't involve is that with a bad acoustic design, noise might be leaking out of the back of your emitter, bounce off a distant wall, and come back with a huge, random phase shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is science. In science, you try to reduce the amount of uncontrollable effects as far as possible to make as many things certain as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your design is a good one, in principle: Cardboard is pretty effective at absorbing sound. However, you weren't really too careful when constructing your system:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;gaps. Close them.&lt;/li&gt;&#xA;&lt;li&gt;Walls. Make them thicker.&lt;/li&gt;&#xA;&lt;li&gt;backs of speakers, open for absorption and emission of ambient noise. Pad them.&lt;/li&gt;&#xA;&lt;li&gt;Not too sure about the bottom of your &quot;tube&quot;: Is it dampening cardboard or actually the table, which probably is much better at transporting power of a speaker lying flat atop than air is?&lt;/li&gt;&#xA;&lt;li&gt;Overall system exposed to ambient noise. I'd get a big cardboard, put down a layer of insulation (e.g. styrofoam), put everything inside, fill things up with insulating material.&lt;/li&gt;&#xA;&lt;li&gt;Is omni-directional really the pattern you're looking for in microphones? This all sounds like you want your noise source mic to be &lt;em&gt;highly&lt;/em&gt; directional to only capture the noise, and not the effect your own emissions have at the noise source.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, make sure all the components, especially your sensors, work very well:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;are your microphones (especially that right in front of the noise emitter) perhaps clipping?&lt;/li&gt;&#xA;&lt;li&gt;if not 1., then, how clean is the signal your speaker produces? Maybe you want to try and produce a few tones at different volumes, and look at the spectra (coming from an RF background, I'd propose full correlation-based channel sounding, but I don't know how well that works).&lt;/li&gt;&#xA;&lt;li&gt;Verify your model: unplug your cancellation speakers. Run your device, and record what they would have produced as sound to a file, as well as what your microphones heard. Simulate what the mics at the places where you want your noise to be cancelled should have heard based on these files. Do exactly the same with the  speakers plugged in. Compare simulation with actual microphone recording.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-14T12:06:17.413" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28276" PostTypeId="2" ParentId="28262" CreationDate="2016-01-14T12:14:49.813" Score="5" Body="&lt;p&gt;A quick scribble on paper shows that FMCW radar has a resolution of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Delta d = \frac{c}{2b}&#xA;$$ with $c$ being the speed of wave propagation (aka speed of light, essentially), $b$ being the bandwidth, and $2$ coming into play because the wave has to trave both ways. For your $\Delta d\overset != 1\mathrm m$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;1\mathrm{m} = \frac{3 \cdot 10^8 \frac{\mathrm{m}}{\mathrm{s}}}{2b}&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means you'd only need $b\ge 150\, \mathrm{MHz}$ in my calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's something that software defined radio devices can do nowadays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, to answer your questions:&#xA;My questions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How, if at all, high-resolution, high-bandwidth digital radars are realised in practice?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Simply be mixing the signal down to baseband (or a low IF), and then sampling it with an ADC.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what would make sense in case of FMCW radar is to mix the transmitted signal and the target return signal and digitize only the beat frequency for Inverse FFT and further analysis.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, that's the way it's done in most &quot;small&quot; FMCW radars, for example automotive radars.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In that case, could you still call it a digital or software defined radar?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Puh. &lt;em&gt;Digital&lt;/em&gt;: &lt;strong&gt;yes&lt;/strong&gt;.&#xA;&lt;em&gt;Software defined&lt;/em&gt;: well, if everyone asked me, &lt;strong&gt;no&lt;/strong&gt;, but paper doesn't blush, so there's probably someone out there who calls this kind of radar &quot;software defined&quot;. Please don't do that.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-01-14T19:17:15.840" LastActivityDate="2016-01-14T19:17:15.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28277" PostTypeId="1" CreationDate="2016-01-14T12:30:54.803" Score="2" ViewCount="1204" Body="&lt;p&gt;Suppose I have 2000 point(time series) signal and I take 512 point FFT, after this some operation is done in frequency domain. Now if I take IFFT to get 512 points in time domain, Is there a way to map the output 512 IFFT points to the original time domain 2000 points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inverse  of this problem would be 400 point(time series) data and 512 point fft, and finally 512 IFFT points, here we can use Overlap and Add method to get 400 point output, is there any similar method for above problem. &lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2017-04-24T19:14:55.267" Title="Extrapolation after taking inverse Fourier transform" Tags="|fft|signal-analysis|ifft|signal-synthesis|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28278" PostTypeId="1" CreationDate="2016-01-14T12:31:41.460" Score="2" ViewCount="167" Body="&lt;p&gt;I have compressed and reconstructed an ECG signal using wavelet coefficients.&#xA;In the compression part, many of wavelet coefficients are set to zero. For example, if in original ECG $5000$ wavelet coefficients have been obtained, now $4900$ coefficients have been set to zero. I have reconstructed the ECG signal using only $100$ coefficient, but how do I measure the compression ratio?&lt;/p&gt;&#xA;" OwnerUserId="17979" LastEditorUserId="15892" LastEditDate="2016-11-10T20:54:26.410" LastActivityDate="2017-05-10T00:54:03.833" Title="Compression Ratio in ECG compression using Wavelet Decomposition" Tags="|discrete-signals|wavelet|compression|ecg|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28279" PostTypeId="1" CreationDate="2016-01-14T12:36:13.893" Score="0" ViewCount="2008" Body="&lt;p&gt;Kindly explain why type 2 FIR filter cannot be used to design high pass filter. &lt;/p&gt;&#xA;" OwnerUserId="18980" LastActivityDate="2016-01-14T21:11:58.943" Title="why type 2 FIR cannot be used to design high pass filter" Tags="|filters|finite-impulse-response|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28280" PostTypeId="2" ParentId="28279" CreationDate="2016-01-14T12:46:01.060" Score="1" Body="&lt;p&gt;Type 2 filters are even and symmetric.  A signal with a frequency of $f_s/2$ is just a scaled version of &lt;code&gt;[+1,-1,+1,-1,+1,...]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means, at $f_s/2$, the response of a type 2 filter will always be zero as the coefficients of the same magnitude are an even number of samples apart so they cancel each other out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A filter with a magnitude frequency response of zero at $f_s/2$ makes a very poor high pass filter.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-14T12:46:01.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28282" PostTypeId="1" AcceptedAnswerId="28288" CreationDate="2016-01-14T14:12:31.463" Score="1" ViewCount="939" Body="&lt;p&gt;Suppose I have a 1D image with intensities $f_i$, $i=[0,n-1]$, where $n$ is the number of pixels. I want to downsample it to have $\frac{n}{2}$ pixels (let $n$ be an even number). For each new point I want to average the intensity over 2 neighboring pixels as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde f_i = 0.5(f_{2i}+f_{2i+1}), \qquad i=[0,n/2-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody, please, answer the following questions&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Will such transformation introduce aliasing (and if so, what is the correct way to resample with averaging over pixels?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there some math procedure, using which I can answer questions like #1 myself?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How, in general, discrete signals are anti-aliased? From DSP books I know that for continuous signals you just apply low-pass filter to your input signal and then sample whatever you got after the low-pass transform. But here is the problem: for images from the very beginning I have only discrete signal and I cannot figure out how to use continuous coordinate low-pass filters for discrete signals. May be I should treat an image as a piece-wise continuous function, which is constant within each interval $[i,i+1)$ ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15439" LastEditorUserId="15439" LastEditDate="2016-01-14T14:26:52.797" LastActivityDate="2016-01-15T10:42:12.983" Title="How to ensure anti-aliasing in image resampling at lower resolution?" Tags="|image-processing|resampling|aliasing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28283" PostTypeId="1" AcceptedAnswerId="28458" CreationDate="2016-01-14T14:28:53.510" Score="0" ViewCount="4326" Body="&lt;p&gt;I trained a cascade-LBP to detect Lollipops with 1000 images, now I'm trying to &quot;adapt&quot; the openCV HAAR-Cascade example to use my LBP trained .xml but I'm not sure about the &quot;HAAR_SCALE_IMAGE&quot; flag, I read that optimizes the downscale to increase the HAAR features is it right to use it with LBP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;//-- Detect Lollipops&#xA;  lollipops_cascade.detectMultiScale( frame_gray, lollipops, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of imput image:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yeasM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yeasM.jpg&quot; alt=&quot;Lollipops&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info:&#xA;&lt;a href=&quot;http://docs.opencv.org/2.4/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.opencv.org/2.4/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18589" LastEditorUserId="18589" LastEditDate="2016-01-14T14:37:03.370" LastActivityDate="2016-03-04T00:08:18.717" Title="Should I use CV_HAAR_SCALE_IMAGE while using LBP CascadeClassifier?" Tags="|opencv|local-features|classification|c++|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28284" PostTypeId="2" ParentId="28268" CreationDate="2016-01-14T14:39:19.320" Score="0" Body="&lt;p&gt;You can write the overall frequency response in the format:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \displaystyle X(f) = A(f) e^{j\phi(f)}, $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ \displaystyle A(f) = |X(f)| $ is the magnitude response and $ \displaystyle \phi (f) = \angle X(f) $ is the phase response. You can obtain both through the graphics you have shown in your question (let me know if you have problems about this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next you just need to compute the inverse transform.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastActivityDate="2016-01-14T14:39:19.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28285" PostTypeId="2" ParentId="28277" CreationDate="2016-01-14T17:54:11.327" Score="3" Body="&lt;p&gt;Assuming you used a 512 point rectangular window on your 2000 original points of data, you need to know something additional about the other 1488 points and how they are related or correlated to the 512 points that were analyzed by your 512 point FFT if you want to do any &quot;mapping&quot;.  Otherwise, those 1488 points could be completely independent and of any value, no matter what mapping you might try.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-14T20:30:58.287" LastActivityDate="2016-01-14T20:30:58.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28286" PostTypeId="1" AcceptedAnswerId="30158" CreationDate="2016-01-14T18:12:19.840" Score="0" ViewCount="917" Body="&lt;p&gt;I've shot a series of photographs in a sort of stop-motion fashion, and although the camera was mounted on a tripod, there are tiny motions between each two successive photos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some experimentation, I figured that using a perspective transform would be appropriate to apply a correction to a photo so that the difference frame is minimised. This transform basically just moves the four corners of a picture by a given offset, allowing for a trapezoid distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this process by hand is impossible in this case, as it takes me like half an hour for each frame. So I am looking for an &lt;strong&gt;effective algorithm to estimate the transform parameters (the four corner offsets).&lt;/strong&gt; I would give the algorithm the maximum magnitude of the offset, and it should then find, as quickly as possible, the parameters (eight values).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is such an efficient algorithm known? The photos are in colour but could be converted to grey scale, although the lighting changes also over time, so taking a difference image and summing the pixels is not enough, but probably one needs to auto-adjust the contrast and brightness as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gYFO2.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gYFO2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19088" LastActivityDate="2016-04-16T09:34:41.597" Title="Algorithm to effectively find perspective transform in motion estimation" Tags="|image-processing|algorithms|motion-detection|geometry|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28287" PostTypeId="2" ParentId="28277" CreationDate="2016-01-14T18:15:02.373" Score="2" Body="&lt;p&gt;In general, no. Consider the matrix form of the DFT. It will be $512 \times 2000$, which is not in general invertible.&lt;/p&gt;&#xA;" OwnerUserId="5134" LastActivityDate="2016-01-14T18:15:02.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28288" PostTypeId="2" ParentId="28282" CreationDate="2016-01-14T20:05:38.957" Score="2" Body="&lt;p&gt;A &quot;&lt;em&gt;1D image&lt;/em&gt;&quot; is just a discrete signal. All the classic signal theory applies:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Will such transformation introduce aliasing (and if so, what is the correct way to resample with averaging over pixels?)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, what happens when you downsample is &lt;em&gt;decimation&lt;/em&gt;. The aliases are the &quot;folding&quot; of existing spectrum over the conserved part of the spectrum; imagine you have a signal whose spectrum (for simplicity, assume that's its discrete Fourier transform) is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[A\,|\,B\,|\,C\,|\,D\,|\,E\,|\,F\,|\,G\,|\,H]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you simply throw away half of the samples, the resulting spectrum is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac 12 [A+E| B+F| C+G| D+H]$. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there some math procedure, using which I can answer questions like #1 myself?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So what you'd need to do is suppress $[E\,|\,F\,|\,G\,|\,H]$ before throwing away the samples. Something that does that is usually called a &lt;em&gt;low pass filter&lt;/em&gt; (LPF).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LPFs are often implemented as Finite Impulse Response Filter (FIR), where you take the current input sample, multiply it with a factor, add a previous input sample (also multiplied with a, possibly different, factor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it turns out, your averaging is indeed such an LPF FIR. It has the taps (coefficients) of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[0.5, 0.5]$. To see this, consider your $2i+1$th sample to be your &quot;current&quot; one, and the $2i$th to be &quot;one in the past&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, such a FIR can be analyzed; it's z-domain frequency response is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pg1iq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pg1iq.png&quot; alt=&quot;filter response&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how at the vertical bar, i.e. the point below which you want to preserve and above you want to suppress the spectrum, this only has a value of 0.5; in fact, about 22% of the total pixel &quot;energy&quot; that passes through your filter is in the &quot;upper&quot; spectral half. That's too much, and you'll get aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You simply might want to build a better filter. This implies you'll add more taps, i.e. more samples right and left of your current sample&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's plenty of tools out there to design filters. Scipy's filter design tools will absolutely do; just design a low pass filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I've used &lt;a href=&quot;http://gnuradio.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;GNU Radio&lt;/a&gt;'s &lt;code&gt;gr_filter_design&lt;/code&gt; tool, and specified the &lt;em&gt;passband&lt;/em&gt; to end just below the half-band boundary (at frequency $0.45f_{sample}$), and the &lt;em&gt;stopband&lt;/em&gt; to start just above that boundary ($0.55f_{sample}$)¹. Suppression should be 30dB, i.e. the magnitude in the $\le\frac1{1000}$ of the passband in the stopband. The resulting filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bSOwz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bSOwz.png&quot; alt=&quot;gr_filter_design&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has 13 taps, i.e. one coefficient for the &quot;center&quot; pixel and one for each of the six pixels left and right of it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/atARR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/atARR.png&quot; alt=&quot;taps&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-0.00405147997662425, 0.009050002321600914, -0.02354922890663147, 0.04652633145451546, -0.07230162620544434, 0.09264583140611649, 0.9033603072166443, 0.09264583140611649, -0.07230162620544434, 0.04652633145451546, -0.02354922890663147, 0.009050002321600914, -0.00405147997662425&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the symmetry (typical for the class of linear-phase FIRs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original | Filtered with your averaging filter, then downsampled | filtered with the 13-tap filter, then downsampled (please view in full size; it doesn't make sense to compare things scaled by your browser)².&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/x9bHe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/x9bHe.png&quot; alt=&quot;original&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6Nwzr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6Nwzr.png&quot; alt=&quot;averaged&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/8uePf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8uePf.png&quot; alt=&quot;filtered 13 taps&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Visual comparison shows that the readability of the text suffers a bit more from the long filter response, while the reproduction of the fine structures of the dark cacao powder atop the tasty, juicy FFTiramisu is is better with the 13tap filter.&#xA;This is most probably an effect of the filter design (it's a design processed based on the Hamming window). Pre-scaling low pass filters employed by picture processing software often aren't even linear; that makes modeling significantly more complicated, but since sensory input in humans typically has logarithmic charactistics, I presume that hides &quot;border effects&quot; better.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How, in general, discrete signals are anti-aliased? From DSP books I know that for continuous signals you just apply low-pass filter to your input signal and then sample whatever you got after the low-pass transform. But here is the problem: for images from the very beginning I have only discrete signal and I cannot figure out how to use continuous coordinate low-pass filters for discrete signals. May be I should treat an image as a piece-wise continuous function, which is constant within each interval [i,i+1)[i,i+1) ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, in DSP downsampling is a very common thing to do, so you do with digital filters, as explained above. Don't consider your signal to be continuous; it's not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;¹ FIRs can't have infinitely steep responses. As a general rule, the closer the passband edge is to the stopband edge, the more taps you will need to realize the filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;² Processing was done using Python, numpy, scipy.signal.lfilter, scipy.misc.im{read,save}.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-01-15T10:42:12.983" LastActivityDate="2016-01-15T10:42:12.983" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28289" PostTypeId="2" ParentId="28277" CreationDate="2016-01-14T20:41:00.593" Score="5" Body="&lt;p&gt;An FFT possesses linear features. Let us use a linear analogy. If one tells you that the sum of two numbers is $a+b=3$, what can you say about these numbers? Not much. More generally, $n$ linear equations on $m$ variables is underdetermined when $n&amp;lt;m$: you do not have enough information to retrieve the variables without more conditions. This can be experimented with a very simple DFT case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume the vector $x = [1,-1]^T$. A simple &lt;a href=&quot;https://en.wikipedia.org/wiki/DFT_matrix#Two-point&quot; rel=&quot;nofollow noreferrer&quot;&gt;two-point DFT&lt;/a&gt; is defined by the matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{bmatrix}&#xA; +1 &amp;amp; 1\\ 1 &amp;amp; -1 &#xA;\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its products with $x$ yields either $0$ (for the DC) or $2$ (up to a  $\sqrt{2}$ Fourier definition scaling) at Nyquist. Can you recover the two elements from $x$ from only a single coefficient $0$ or (&lt;code&gt;xor&lt;/code&gt;) $2$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably not, without further assumptions, or on very specific signals.&#xA;This happens whenever you have less DFT points than samples. There is no bijection between two finite sets of different sizes. This is indeed one definition of infinity: a set is infinite if it can be put in bijection with a proper subset. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, using sparsity, positivity properties, there are frameworks to retrieve (at least approximately) the data.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2017-04-24T19:14:55.267" LastActivityDate="2017-04-24T19:14:55.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28290" PostTypeId="2" ParentId="27705" CreationDate="2016-01-14T21:07:34.357" Score="1" Body="&lt;p&gt;I only provide (yet) one piece of literature: &lt;a href=&quot;http://dx.doi.org/10.1016/j.ocemod.2012.09.004&quot; rel=&quot;nofollow&quot;&gt;Combination of statistical Kalman filters and data assimilation for improving ocean waves analysis and forecasting&lt;/a&gt;, 2012.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not about Kalman, but adaptive filters, and was just published, I guess it could be useful (for methods and references): &lt;a href=&quot;http://dx.doi.org/10.1109/MSP.2015.2481746&quot; rel=&quot;nofollow&quot;&gt;Combinations of Adaptive Filters: Performance and convergence properties&lt;/a&gt;, IEEE Signal Processing Magazine, Jan. 2016.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-14T21:07:34.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28292" PostTypeId="2" ParentId="22207" CreationDate="2016-01-15T06:23:13.820" Score="0" Body="&lt;p&gt;Probably it would be more suited as a comment than a full answer but I don't have enough points yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I personally found very instructive the book from E. O. Brigham, &lt;a href=&quot;http://www.ingelec.uns.edu.ar/pds2803/Materiales/LibrosPDF/Brigham/TOC.htm&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;The Fast Fourier Transform&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doesn't cover Laplace and Z, but IMHO it explains really well how the DTFT and DFT stem from continuous Fourier Transform when you introduce sampling, just using continuous math, convolutions and distribution theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also does this using a pictorial, easy to understand and remember approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Definitely not enough to cover everything, but I believe it's a really good starting point.&lt;/p&gt;&#xA;" OwnerUserId="18984" LastActivityDate="2016-01-15T06:23:13.820" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28293" PostTypeId="2" ParentId="10193" CreationDate="2016-01-15T07:06:38.517" Score="0" Body="&lt;p&gt;The following paper gives an insight on avoiding dependence on GCI for speech processing&#xA;&lt;a href=&quot;https://ieeexplore.ieee.org/document/6952839&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15874" LastEditorUserId="26573" LastEditDate="2022-07-30T14:35:25.530" LastActivityDate="2022-07-30T14:35:25.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28294" PostTypeId="1" CreationDate="2016-01-15T09:01:34.050" Score="1" ViewCount="187" Body="&lt;p&gt;I am in the process of implementing MFCC and I'm unsure about the DCT part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I implemented it (using DCT II).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//some coefficients&#xA;let k = Math.PI/numFilters;&#xA;let w1 = 1.0/Math.sqrt(2);&#xA;let w2 = Math.sqrt(2.0/numFilters);&#xA;let numCoeffs = numFilters;&#xA;let dctMatrix = new Float32Array(numCoeffs*numFilters);&#xA;&#xA;// compute the dct matrix&#xA;for(let i = 0; i &amp;lt; numCoeffs; i++){&#xA;    for (let j = 0; j &amp;lt; numFilters; j++) {&#xA;        let idx = i + (j*numCoeffs);&#xA;        if(i === 0){&#xA;            dctMatrix[idx] = w1 * Math.cos(k * (i+1) * (j+0.5));&#xA;        }&#xA;        else{&#xA;            dctMatrix[idx] = w2 * Math.cos(k * (i+1) * (j+0.5));&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;// apply it on the logged energies.&#xA;let mfccs = new Float32Array(numCoeffs);&#xA;for (let k = 0; k &amp;lt; numCoeffs; k++) {&#xA;    let v = 0;&#xA;    for (let n = 0; n &amp;lt; numFilters; n++) {&#xA;        let idx = k + (n*numCoeffs);&#xA;        v += (dctMatrix[idx] * loggedMelBands[n]);&#xA;    }&#xA;    mfccs[k] = v;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm getting 26 values (which is the number of filters I defined), both negative and positive values, where the first value is always has highest magnitude and the rest are in the range of -1 and 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this implementation seem correct to you?&lt;/p&gt;&#xA;" OwnerUserId="14992" LastActivityDate="2016-01-15T09:01:34.050" Title="Implementation of DCT for MFCC" Tags="|mfcc|dct|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28295" PostTypeId="1" CreationDate="2016-01-15T09:15:49.750" Score="1" ViewCount="439" Body="&lt;p&gt;Say I have a binary FSK with &lt;code&gt;+f&lt;/code&gt; and &lt;code&gt;-f&lt;/code&gt; frequencies and I have two samples per symbol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider the &quot;1) multiply with &lt;code&gt;+f&lt;/code&gt;/&lt;code&gt;-f&lt;/code&gt; then 2) integrate over the number of samples per symbol, 3) take absolute value, 4) take the difference&quot; demodulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets call this type of demodulator &lt;code&gt;Integrating FSK Demodulator&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have only two samples per symbol, then is the &lt;code&gt;Integrating FSK Demodulator&lt;/code&gt; the same as if I would just use a differential FM demodulator (which takes 2 consecutive samples into account) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they are different, what is the difference ?&lt;/p&gt;&#xA;" OwnerUserId="19066" LastActivityDate="2016-01-15T09:15:49.750" Title="FSK demodulator by integration if the samples per symbols is 2" Tags="|modulation|demodulation|fsk|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28296" PostTypeId="1" AcceptedAnswerId="28299" CreationDate="2016-01-15T09:41:51.027" Score="2" ViewCount="7010" Body="&lt;p&gt;There are many articles on the frequency response of the moving average filter but they all seem to focus on magnitude. However the phase response is intriguing and I find it hard to interpret. The phase appears to &quot;wrap&quot;, but it wraps within the [-pi, pi) interval rather than at its edges. Example below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/LfQIK.jpg&quot; alt=&quot;moving average, 5 tap&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A phase unwrapping algorithm would not resolve this, so it is really a &quot;pseudo-wrap&quot;. Further, if I add taps to the moving average, it flattens this process out, so I suspect that mathematically, the moving average filter will never reach 0 or 2 pi, though I have never seen an explanation why. Example of an 11-tap:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/BmqYW.jpg&quot; alt=&quot;moving average, 11 tap&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find this behaviour fascinating and would be interested in the interpretation of an expert. Does this suggest that features will be distorted at certain &quot;weak spots&quot; in the frequency response? Is it correct to call the phase of a moving average filter &quot;piecewise-linear&quot; rather than linear? I suspect not, given that symmetric FIR filters are analytically shown to have linear phase, but I have a hard time calling this linear.&lt;/p&gt;&#xA;" OwnerUserId="5623" LastActivityDate="2016-01-15T11:35:10.410" Title="Phase response of moving average filter -- how to interpret?" Tags="|frequency-response|moving-average|linear-phase|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28297" PostTypeId="2" ParentId="28169" CreationDate="2016-01-15T10:52:25.387" Score="3" Body="&lt;p&gt;I provide another answer because this approach is completely different in the sense that I do not try to approximate the filter's amplitude function to compute an approximation of the cut-off frequency, but I use a pure data fitting approach given the exact cut-off frequencies, which were computed numerically (and which are also given for a set of filter lengths in the leftmost column of &lt;a href=&quot;https://dsp.stackexchange.com/questions/28169/3db-cut-off-frequency-of-moving-average/28263#28263&quot;&gt;this table&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With data fitting, often the most difficult problem is to find an appropriate parameterization of the approximating function. Since from the other answers in this thread we know that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{\omega}_c(N)=\frac{a}{\sqrt{N^2-c}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with appropriately chosen constants $a$ and $c$ is a surprisingly good approximation for a wide range of values of $N$, and since &lt;a href=&quot;http://wolfr.am/9KqdA1Cl&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wolfram Alpha&lt;/a&gt; tells us that the Laurent series expansion of $(1)$ at $N=\infty$ has only terms with odd powers of $1/N$, it appears reasonable to parameterize the cut-off frequency by a Laurent series with odd powers of $1/N$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{\omega}_c(N)=\frac{a_1}{N}+\frac{a_3}{N^3}+\frac{a_5}{N^5}+\ldots\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can compute the exact value of $a_1$ in $(2)$ from the requirement that the estimate $\hat{\omega}_c(N)$ has zero bias, i.e. that it converges to the true cut-off frequency for large $N$. This is explained in &lt;a href=&quot;https://dsp.stackexchange.com/questions/28169/3db-cut-off-frequency-of-moving-average/28267#28267&quot;&gt;my other answer&lt;/a&gt;. Its value is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_1=2.78311475650302\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other constants in $(2)$ can be computed by a least squares fit of $(2)$ to the data, which are the exact cut-off frequencies. The least squares fit can be computed by the following simple Matlab/Octave script (assuming the variable &lt;code&gt;wc&lt;/code&gt; is a vector with pre-computed exact cut-off frequencies for the desired set of filter lengths):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;N = [2:10, 100, 1000, 10000]';    % some set of filter lengths&#xA;a = 2.78311475650302;             % magic constant&#xA;A = [1./N.^3, 1./N.^5, 1./N.^7, 1./N.^9];&#xA;B = wc - a./N;                    % wc (exact cut-off freq.) must be available!&#xA;x = A\B;                          % solve Ax=B in a least squares sense&#xA;wc1 = a./N + A*x;                 % Laurent series approximation of cut-off frequencies&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting coefficients are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}a_3&amp;amp;=1.201014809636180\\&#xA;a_5&amp;amp;=0.768735238011194\\&#xA;a_7&amp;amp;=0.514237034990353\\&#xA;a_9&amp;amp;=0.548681885931852\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $a_1$ given by $(3)$. This approximation comes extremely close to the exact values of $\omega_c$. The approximation error can be found in &lt;a href=&quot;https://dsp.stackexchange.com/questions/28169/3db-cut-off-frequency-of-moving-average/28263#28263&quot;&gt;this table&lt;/a&gt; (column g).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-01-15T17:19:10.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28298" PostTypeId="1" AcceptedAnswerId="28301" CreationDate="2016-01-15T10:56:26.523" Score="1" ViewCount="1122" Body="&lt;p&gt;I'm new to SP Stack Exchange . I am doing a project on implementing a handwriting recognition machine using Neural Networks in Real Time .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Image Processing Part involves convolving a 4*5 kernel over a 28*28 image. I want to know the pros and cons involved with using a DSP vs FPGA .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FPGA I plan to use belongs to Xilinx's Spartan 6 family which has 90 DSP slices. Each DSP Slice has 18*18 bit MAC units which can operate in parallel at 200MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My college has a DSP starter kit TMS320C6713 DSK from Spectrum DIGITAL. I'm not sure how MAC operations are performed in DSP .Do we have parallel MAC units? The datasheet isn't very clear on the MAC units .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any advantages on using the DSP over the FPGA which I might have overlooked?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is appreciated .&lt;/p&gt;&#xA;" OwnerUserId="18317" LastActivityDate="2016-01-15T12:48:17.233" Title="FPGA vs DSP for MAC operations" Tags="|dsp-core|neural-network|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28299" PostTypeId="2" ParentId="28296" CreationDate="2016-01-15T11:29:43.510" Score="3" Body="&lt;p&gt;The frequency response of a causal length $N$ moving average filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=\frac{\sin\left(\frac{N\omega}{2}\right)}{N\sin\left(\frac{\omega}{2}\right)}e^{-j\omega(N-1)/2}=A(\omega)e^{j\phi(\omega)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $A(\omega)$ is &lt;em&gt;not&lt;/em&gt; the magnitude of $H(\omega)$, but it is a real-valued amplitude function, which takes on positive as well as negative values. The phase $\phi(\omega)=-(N-1)\omega/2$, as defined in $(1)$, is obviously linear. That's also the common definition when we talk about a &lt;em&gt;linear phase response&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase you plotted is not $\phi(\omega)$, but $\hat{\phi}(\omega)$ as defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=|A(\omega)|e^{j\hat{\phi}(\omega)}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference between $\phi(\omega)$ and $\hat{\phi}(\omega)$ is that whenever $A(\omega)$ crosses zero, a phase jump of $\pm \pi$ occurs in $\hat{\phi}(\omega)$, corresponding to a sign change in $A(\omega)$. Nevertheless, we still refer to $H(\omega)$ as a frequency response with a linear phase, because $\phi(\omega)$ is a linear function of $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in practice, a linear phase is only relevant in the pass band of a filter, i.e. in a frequency region where no zeros of $H(\omega)$ occur. In the pass band, also $\hat{\phi}(\omega)$ is linear, because it only jumps at the zeros of $H(\omega)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-15T11:35:10.410" LastActivityDate="2016-01-15T11:35:10.410" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28300" PostTypeId="2" ParentId="28278" CreationDate="2016-01-15T12:41:03.320" Score="0" Body="&lt;p&gt;The compression ratio can be obtained by dividing the number of non-zero values in the output by the number of non-zero values in the input. Therefore, the smaller the resulting value the better.&lt;/p&gt;&#xA;" OwnerUserId="14992" LastActivityDate="2016-01-15T12:41:03.320" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28301" PostTypeId="2" ParentId="28298" CreationDate="2016-01-15T12:48:17.233" Score="0" Body="&lt;p&gt;At a high level, it's a relatively simple tradeoff: software development for DSP or general-purpose microprocessors is typically much less labor-intensive than FPGA development. At the same time, the amount of computational throughput offered by an FPGA typically far exceeds what a CPU can do, because you can tailor the logic specifically for your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most any processor that is advertised for &quot;DSP&quot; will have multiply-accumulate (MAC) instructions available, and it is common for DSP processors to be able to execute multiple instructions per cycle. If you read the &lt;a href=&quot;http://www.ti.com/product/tms320c6713b/description&quot; rel=&quot;nofollow&quot;&gt;specifications for TI's C6713&lt;/a&gt;, you'll see that they advertise that it can complete up to 8 instructions per cycle (not necessarily all MACs, but a mix of several types of instructions). Note that it is pretty difficult to get close to that throughput, but it is possible if you invest enough effort learning how the architecture works and structuring your code accordingly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other major difference between an FPGA implementation and the particular DSP that you noted is that the C6713 supports native floating-point capability (instead of just fixed-point). For some applications, this can make algorithm implementation much simpler, as you don't have to worry about the issues that come along with fixed-point computations. While it is possible to implement floating-point computations in an FPGA, such an implementation would be much more demanding on the hardware, so depending on how complex your algorithm is, you might run into issues with resource utilization, achievable clock speed, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should start by quantifying what kind of computational demands your algorithm is going to place on your hardware. Then, decide how much engineering time you can allocate to the project; from there, the choice will likely be clear.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2016-01-15T12:48:17.233" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28303" PostTypeId="1" AcceptedAnswerId="28305" CreationDate="2016-01-15T14:00:48.827" Score="1" ViewCount="531" Body="&lt;p&gt;There are 4 cos signals with 10,20,30 and 100 Hz each.&#xA;The main signal is the sum of those 4 and I have to create a low pass filter, on the main signal for the frequency's &gt; 50 Hz.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% design of low pass filter&#xA;f = [0 0.6 0.6 1];&#xA;m = [1 1 0 0 ];&#xA;b = fir2(30, f, m);&#xA;[h, w] = freqz(b,1,128);&#xA;&#xA;hold on;&#xA;plot(f,m,'b')&#xA;plot(w/pi, abs(h), 'r')&#xA;xlabel('Normalized Frequency (\times\pi rad/sample)')&#xA;ylabel('Magnitude')&#xA;legend('Ideal', 'fir2 designed')&#xA;legend boxoff&#xA;title('comparison of frequency Response Magnitytes');&#xA;hold off;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's the example code that our professor gave us.On maltab using help fir2 there is a similar example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Example 1:&#xA;%   Design a 30th-order lowpass filter and overplot the desired &#xA;%   frequency response with the actual frequency response.&#xA;&#xA;f = [0 0.6 0.6 1];      % Frequency breakpoints&#xA;m = [1 1 0 0];          % Magnitude breakpoints&#xA;b = fir2(30,f,m);       % Frequency sampling-based FIR filter design&#xA;[h,w] = freqz(b,1,128); % Frequency response of filter&#xA;plot(f,m,w/pi,abs(h))&#xA;legend('Ideal','fir2 Designed')&#xA;title('Comparison of Frequency Response Magnitudes')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What i don't understand is how to find the frequency breakpoints and the magnitude breakpoints?&#xA;Also whats the relation of the filter order with the low-high, band filters?&lt;/p&gt;&#xA;" OwnerUserId="19095" LastActivityDate="2016-01-15T16:11:32.823" Title="how to find breakpoints of a signal based on the frequency of the signal" Tags="|matlab|filter-design|frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28305" PostTypeId="2" ParentId="28303" CreationDate="2016-01-15T16:11:32.823" Score="1" Body="&lt;p&gt;The samples in the 'f' vector in the Matlab Example 1 code are arbitrary, ...just an example of a lowpass filter. The purpose of that code is to merely show you how the &quot;designed&quot; (actual) freq response is similar to, but not equal to, the &quot;ideal&quot; rectangular  freq response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't like that Matlab Example 1 example. It's confusing to some beginners to have two different magnitude ('m') sample values associated with a single 'f' value of 0.6. A better example would define 'f' as f = [0 0.6 0.7 1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, the Example 1 example's f = [0 0.6 0.6 1] and m = [1 1 0 0], vectors specify that the lowpass filter's &quot;ideal&quot; passband gain is one at $0*f_s/2$ Hz and is one at $0.6*f_s/2$ Hz. (The '*' symbol means multiply.) So the &quot;ideal&quot; lowpass passband extends from $0*f_s/2$ -to- $0.6*f_s/2$ Hz. The code also specifies that the lowpass filter's &quot;ideal&quot; stopband gain is zero at $0.6*f_s/2$ Hz and is zero at $1*f_s/2$ Hz. So the &quot;ideal&quot; stopband extends from $0.6*f_s/2$ -to- $1*f_s/2$ Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you wanted the filter's &quot;ideal&quot; lowpass passband to extend from $0*f_s/2$ -to- $0.5*f_s/2$ Hz (zero Hz –to- $f_s/4$ Hz), you would define vector 'f' as f = [0 0.5 0.5 1].&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2016-01-15T16:11:32.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28308" PostTypeId="1" AcceptedAnswerId="28314" CreationDate="2016-01-16T11:48:20.253" Score="6" ViewCount="8697" Body="&lt;p&gt;I think it is an easy question but I am stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to derive that $$ \alpha = -e^{\frac{-T}{\tau}}\,. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone provide me with an answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT] Sorry guys, this was really a senseless question. Here are some more informations. The differential equation of the EWMA:&#xA;$$y(n)=\alpha\cdot x(n)+(1-\alpha)y(n-1)$$&#xA;and the corresponding frequency magnitude response:&#xA;$$H_E(z)=\frac{\alpha}{1-(1-\alpha)z^{-1}}$$&#xA;and in the frequency domain for $\omega_s=1 \rightarrow T=1 $ :&#xA;$$H_E(\omega)=\frac{\alpha}{\sqrt{1-2(1-\alpha)\cos(\omega)+(1-\alpha)^2}}$$ &#xA;$$\tau=\frac{1}{2\pi\omega_{3dB}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence&#xA;$$H_E(\omega_{3dB})=\frac{\alpha}{\sqrt{1-2(1-\alpha)\cos(\omega_{3dB})+(1-\alpha)^2}}\overset!=\frac{1}{\sqrt{2}}\text.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for $\alpha$, given an $\omega_{3dB}$.&lt;/p&gt;&#xA;" OwnerUserId="19003" LastEditorUserId="13320" LastEditDate="2016-01-17T11:42:22.483" LastActivityDate="2022-05-12T01:02:30.120" Title="Exponential weighted moving average time constant" Tags="|digital-filters|averaging|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28309" PostTypeId="1" CreationDate="2016-01-16T12:46:46.773" Score="0" ViewCount="205" Body="&lt;p&gt;I came across a concept that says we can design LPH and HPF from APF when the transfer function of the two APFs given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}A_0(z)&amp;amp;=1\\&#xA;A_1(z)&amp;amp;=\frac{-a+z^{-1}}{1-az^{-1}}\\\\&#xA;H_{LP}(z)&amp;amp;=A_0(z)+A_1(z)\\&#xA;H_{HP}(z)&amp;amp;=A_0(z)-A_1(z)\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i tried to implement this in matlab but i did not get the desired frequency response..kindly help me with the matlab code for the same..&lt;/p&gt;&#xA;" OwnerUserId="18980" LastEditorUserId="1629" LastEditDate="2016-01-16T16:53:22.630" LastActivityDate="2016-04-16T11:50:57.713" Title="how to design LPH and HPF from APF" Tags="|matlab|filter-design|lowpass-filter|highpass-filter|allpass|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28313" PostTypeId="1" AcceptedAnswerId="28319" CreationDate="2016-01-16T18:36:59.563" Score="1" ViewCount="150" Body="&lt;p&gt;I have a 2D image (obtained using computed tomography) that I'm &quot;transforming&quot; for image segmentation purposes, and I'm looking for a formal way of describing the transformation I'm doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transformation I'm doing defines a centre point $(x_0,y_0)$, angles $\theta_i$ from 0 to 360 degrees, and a set of centrifugal lines defined by $x_0 + L\cos(\theta_i)$, $y_0 + L\sin(\theta_i)$. For simplicity, we can imagine that the original image is circular and thus $L$ is simply the radius of the circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of the transform is simply the 2D &quot;stacking&quot; of the intensity function $I(x,y)$ on each line defined above. This is essentially &quot;unrolling&quot; a circular image into a 2D image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks superficially similar to the Radon transform, but there's not integral involved - I'm simply copying the intensity values. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this have a formal name?&lt;/p&gt;&#xA;" OwnerUserId="10475" LastEditorUserId="8202" LastEditDate="2016-01-16T19:09:30.443" LastActivityDate="2016-01-17T13:37:45.567" Title="What is the name of this transform similar to the Radon transform?" Tags="|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28314" PostTypeId="2" ParentId="28308" CreationDate="2016-01-16T21:06:19.960" Score="11" Body="&lt;p&gt;If I understood you correctly, you want to compute the value of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; that results in a specified 3dB cut-off frequency for an exponentially weighted moving average filter. If you square your last equation, you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\alpha^2}{1-2(1-\alpha)\cos(\omega_c)+(1-\alpha)^2}=\frac12\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be rearranged into the following quadratic equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha^2+2\alpha(1-\cos(\omega_c))-2(1-\cos(\omega_c))=0\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the positive solution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha = \cos(\omega_c)-1+\sqrt{\cos^2(\omega_c)-4\cos(\omega_c)+3}\tag{3} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, e.g., for a desired cut-off frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_c=0.2\pi$&lt;/span&gt;, you obtain from &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt; a value of &lt;span class=&quot;math-container&quot;&gt;$\alpha=0.455886780102867$&lt;/span&gt;. The figure below shows the magnitude of the frequency response of the resulting exponentially weighted moving average filter, from which you can see that the desired cut-off frequency is achieved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/T638h.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T638h.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; The formula for &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; in your question should actually be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha=1-e^{-T/\tau},\qquad \tau=1/\Omega_c\tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that unlike &lt;span class=&quot;math-container&quot;&gt;$\omega_c$&lt;/span&gt; in Eq. &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\Omega_c$&lt;/span&gt; in Eq. &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; is not normalized by the sampling frequency. So we have &lt;span class=&quot;math-container&quot;&gt;$-T/\tau=-\Omega_cT=-\omega_c$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; is an approximation, and it comes from applying the &lt;a href=&quot;https://en.wikipedia.org/wiki/Impulse_invariance&quot; rel=&quot;noreferrer&quot;&gt;impulse invariant transformation&lt;/a&gt; to the continuous-time transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(s)=\frac{1}{1+s\tau}\tag{5}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has a 3dB cut-off frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_c=1/\tau$&lt;/span&gt;. Applying the impulse invariant transformation to &lt;span class=&quot;math-container&quot;&gt;$(5)$&lt;/span&gt; gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(z)=\frac{T}{\tau}\frac{1}{1-e^{-T/\tau}z^{-1}}\tag{6}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing the denominator of &lt;span class=&quot;math-container&quot;&gt;$(6)$&lt;/span&gt; with the denominator of the discrete-time transfer function of an EWMA filter&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(z)=\frac{\alpha}{1-(1-\alpha)z^{-1}}\tag{7}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;results in the given formula.&#xA;Note, however, that this is only an approximation. Especially for cut-off frequencies close to Nyquist, the error of formula &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; becomes relatively large.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2018-12-12T10:14:21.997" LastActivityDate="2018-12-12T10:14:21.997" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28315" PostTypeId="2" ParentId="28286" CreationDate="2016-01-16T23:49:20.987" Score="1" Body="&lt;p&gt;The suggested technique seems to be to gather points of interest, calculate a feature vector for them, and then find matching pairs of points in both images, followed by a calculation of the transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a sample project: &lt;a href=&quot;http://www.codeproject.com/Articles/95453/Automatic-Image-Stitching-with-Accord-NET&quot; rel=&quot;nofollow&quot;&gt;http://www.codeproject.com/Articles/95453/Automatic-Image-Stitching-with-Accord-NET&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a paper that claims improvement by preparing through a phase correlation stage: &lt;a href=&quot;http://www3.nd.edu/~kwb/ThomasKareemBowyerIGARSS_2012.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www3.nd.edu/~kwb/ThomasKareemBowyerIGARSS_2012.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19088" LastActivityDate="2016-01-16T23:49:20.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28316" PostTypeId="2" ParentId="28309" CreationDate="2016-01-17T10:46:40.153" Score="1" Body="&lt;p&gt;Since you don't say what response you're &lt;em&gt;actually&lt;/em&gt; getting from Matlab, this is all guesswork. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's do the basics: A little formula juggling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}A_0(z)&amp;amp;=1\\&#xA;A_1(z)&amp;amp;=\frac{-a+z^{-1}}{1-az^{-1}}\\[4em]&#xA;H_{LP}(z)&amp;amp;=A_0(z)+A_1(z)\\&#xA;   &amp;amp;= 1 + \frac{-a+z^{-1}}{1-az^{-1}}\\&#xA;   &amp;amp;= \frac{{1-az^{-1}}-a+z^{-1}}{1-az^{-1}}\\&#xA;   &amp;amp;= \frac{(1-a)\quad +\quad (1-a)z^{-1}}{1-az^{-1}}\\[4em]&#xA;H_{HP}(z)&amp;amp;=A_0(z)-A_1(z)\\&#xA;   &amp;amp;= 1 - \frac{-a+z^{-1}}{1-az^{-1}}\\&#xA;   &amp;amp;= \frac{{1-az^{-1}}+a-z^{-1}}{1-az^{-1}}\\&#xA;   &amp;amp;= \frac{(1+a)\quad +\quad (-1-a)z^{-1}}{1-az^{-1}}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, taken from these formulas, the filter coefficients for $H_{LP}$ are $b=[1-a,1-a]$, $a=[1,-a]$, and  for $H_{HP}$ it's $b=[1+a,-1-a]$, $a=[1,-a]$ for the canonical form of recursive filters&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H= \frac{\sum\limits_{i=0}^N b_i z^{-i}}{\sum\limits_{i=0}^M a_i z^{-i}}\text.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging that into scipy's &lt;code&gt;scipy.signal.freqz&lt;/code&gt; for different $a$ yielded (abscissa: normalized frequency $\in[0,\pi[$, ordinate: magnitude):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{LP,a}$ for $a\in\{0,0.1,\dots,0.9,1\}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BJ8QE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BJ8QE.png&quot; alt=&quot;LPFs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{HP,a}$ for $ a\in\{0,0.1,\dots,0.9,1\}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AYRp1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AYRp1.png&quot; alt=&quot;HPFs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which both very nicely match the terms low and high pass filters, respectively.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-01-17T10:52:51.113" LastActivityDate="2016-01-17T10:52:51.113" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="28317" PostTypeId="1" AcceptedAnswerId="28325" CreationDate="2016-01-17T12:38:38.253" Score="0" ViewCount="184" Body="&lt;p&gt;I want to find the following: $\mathfrak{F}[{\Pi}_{a}(t)\cos(2{\pi}f_{0}t)]$ &lt;br&gt;&#xA;&lt;br&gt;&#xA;I first did: $\mathfrak{F}[{\Pi}_{a}(t)] = 2a\text{ sinc}(2af)$ &lt;br&gt;&#xA;&lt;br&gt;then: $\mathfrak{F}[\cos(2{\pi}f_{0}t)] = \frac{1}{2}[\delta(f-f_{0})+\delta(f+f_{0})]$ &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: $$\begin{align}\mathfrak{F}[{\Pi}_{a}(t)\cos(2{\pi}f_{0}t)] &amp;amp;= \mathfrak{F}[{\Pi}_{a}(t)]\ast \mathfrak{F}[\cos(2{\pi}f_{0}t)]\\&amp;amp;=2a\text{ sinc}(2af)\ast\frac{1}{2}[\delta(f-f_{0})+\delta(f+f_{0})]\\&amp;amp;=a\text{ sinc}(2af)\ast\delta(f-f_{0})+a\text{ sinc}(2af)\ast\delta(f+f_{0})\\&amp;amp;=a\text{ sinc}(2af)+a\text{ sinc}(2af)=2a\text{ sinc}(2af)\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br/&gt;&lt;br/&gt;I would like to know if it is correct and if there is an alternative way to find the result easier.&lt;/p&gt;&#xA;" OwnerUserId="18287" LastEditorUserId="8202" LastEditDate="2016-01-17T14:21:06.857" LastActivityDate="2016-01-18T11:46:49.210" Title="Fourier transform of ${\Pi}_{a}(t)\cos(2{\pi}f_{0}t)$" Tags="|fourier-transform|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="28318" PostTypeId="1" CreationDate="2016-01-17T12:43:12.650" Score="1" ViewCount="1156" Body="&lt;p&gt;For a project I am attempting to create an automatic tuner for a guitar, which reads the audio from the guitar jack, determines the frequency and adjusts the string by a motor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;http://www.instructables.com/id/Reliable-Frequency-Detection-Using-DSP-Techniques/&quot; rel=&quot;nofollow&quot;&gt;http://www.instructables.com/id/Reliable-Frequency-Detection-Using-DSP-Techniques/&lt;/a&gt; the algorithm is quite accurate.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void setup() {&#xA;      sum = 0;&#xA;      pd_state = 0;&#xA;      int period = 0;&#xA;      // Autocorrelation&#xA;      for(i=0; i &amp;lt; samples; i++)&#xA;      {&#xA;        sum_old = sum;&#xA;        sum = 0;&#xA;        for(k=0; k &amp;lt; samples-i; k++) sum += (values[k])*(values[k+i]);&#xA;&#xA;    // Peak Detect State Machine&#xA;    if (pd_state == 2 &amp;amp;&amp;amp; (sum-sum_old) &amp;lt;=0) &#xA;    {&#xA;      period = i;&#xA;      pd_state = 3;&#xA;    }&#xA;    if (pd_state == 1 &amp;amp;&amp;amp; (sum &amp;gt; thresh) &amp;amp;&amp;amp; (sum-sum_old) &amp;gt; 0) pd_state = 2;&#xA;    if (!i) {&#xA;      thresh = sum * 0.5;&#xA;      pd_state = 1;&#xA;    }&#xA;  }&#xA;  // Frequency identified in Hz&#xA;  freq_per = realFreq/period;&#xA;  lcd.cls();&#xA;  lcd.printf(&quot;%f&quot;,freq_per);&#xA;  }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At the end the frequency is determined by the by dividing the realFreq, which is the precise reading frequency with the period determined by the peak detection portion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency is quite accurate between 40-200 Hz normally about 0.5 Hz out which is accurate enough for my needs. But above 200 Hz the accuracy falls to 2-3Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a technique to improve the accuracy of this function. The sampling frequency is 4410 and I wanted to reduce this to improve the speed but keep the accuracy as high as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="18605" LastActivityDate="2016-01-17T16:08:47.820" Title="Getting a more accurate frequency read from autocorrelation and peak-detection algorithm" Tags="|autocorrelation|pitch|peak-detection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28319" PostTypeId="2" ParentId="28313" CreationDate="2016-01-17T13:37:45.567" Score="1" Body="&lt;p&gt;This is a simple Cartesian to Polar coordinates transformation. Instead of expressing the position of a pixel using $(x,y)$ you are expressing it using $(r, θ)$ where $r$ is distance from the centre $(x_0,y_0)$ and $θ$ is angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The images are exactly the same, wherever they are definable, but the &quot;unrolling&quot; results from still using $(x,y)$ to depict $(r,θ)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, please see &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_common_coordinate_transformations&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://stackoverflow.com/questions/18038936/image-conversion-from-cartesian-coordinate-to-polar-coordinate&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2016-01-17T13:37:45.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28320" PostTypeId="2" ParentId="28318" CreationDate="2016-01-17T14:26:33.080" Score="1" Body="&lt;p&gt;If you were using an omnidirectional microphone to pick up the instrument sound you wanted to determine the pitch for, then using the autocorrelation method of determining the period of a waveform could have some merit in reducing the impact of random uncorrelated noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, the way it is attempted to be used here seems to be an incomplete match to the problem's specifications. The signal is not expected to have high levels of noise, the hardware platform is &quot;weak&quot; (limited wordlength and processing power) and all that the selected method is doing is a &quot;fancy&quot; way of deriving a (periodic) signal's period. In addition to this, at some point later on, the same platform is going to have to control the motors too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the signal will be coming directly from the guitar's pickup, it will be loud enough and clean (assuming no problems with the instrument's wiring). In this case, the zero-crossing method is probably the better choice for a guitar tuner. All that the processor would be doing is count how much time passes between setting and resetting a counter as the signal crosses a &quot;zero voltage&quot; point within limits. This method would return the pitch of a guitar string with much higher accuracy given the clock speeds that an Arduino is capable of running at and also leave plenty of time to the CPU to perform other tasks with ease (such as controlling the motors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on pitch detection in DSP, please see &lt;a href=&quot;http://sound.eti.pg.gda.pl/student/eim/synteza/leszczyna/index_ang.htm#a3&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on zero crossing, please see &lt;a href=&quot;http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-frequency-counter-library/&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt; (linked from the same Instructables article that was posted along with the question).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on the basic technique required to create the circuit that will be converting the guitar's signal to the digital form that Arduino expects, please see &lt;a href=&quot;http://www.circuitstoday.com/zero-crossing-detector&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2016-01-17T14:26:33.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28321" PostTypeId="2" ParentId="28318" CreationDate="2016-01-17T16:08:47.820" Score="1" Body="&lt;p&gt;A zero crossing count method alone might be unreliable over the full pitch range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But zero crossing measurements averaged over enough periods in conjunction with your autocorrelation method might be usable to improve an initial frequency estimate.  e.g. only use the zero crossing information if it stays within a few percent of the autocorrelation estimate and that estimate is higher than a certain frequency (such as 199 Hz in your case).  A low performance processor that can do a correlation estimate can likely also do a simultaneous zero crossing count measurement.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-17T16:08:47.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28322" PostTypeId="1" AcceptedAnswerId="28323" CreationDate="2016-01-09T03:23:22.357" Score="5" ViewCount="61993" Body="&lt;p&gt;I'm trying to measure per-pixel similarities in two images (same array shape and type) using Python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many scientific papers (&lt;a href=&quot;http://ict.usc.edu/pubs/Driving%20High-Resolution%20Facial%20Scans%20with%20Video%20Performance%20Capture.pdf&quot; rel=&quot;noreferrer&quot;&gt;like this one&lt;/a&gt;), normalized cross-correlation is used. Here's an image from the ict paper showing the wanted result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VrcrR.jpg&quot; alt=&quot;Link to the result image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(b) and (c) are the 2 input images, and (d) is the per-pixel confidence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only used OpenCV before to do template matching with normalized cross correlation using cv2.matchTemplate function, but in this case it seems to be a really different use of cross correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know if I can approch this result using Python and image processing libraries (numpy, openCV, sciPy etc...), and the logic behind this use of cross correlation ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerDisplayName="Paul Parneix" LastActivityDate="2021-05-31T14:47:59.207" Title="Python - Normalized cross-correlation to measure similarites in 2 images" Tags="|python|opencv|image-processing|cross-correlation|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28323" PostTypeId="2" ParentId="28322" CreationDate="2016-01-10T22:00:03.330" Score="6" Body="&lt;p&gt;I guess you can compute for each pixel the correlation coefficient between patches centered on this pixel in the two images of interest. Here is an example where I downloaded the figure attached here and tried to compute the correlation in such a way. The output looks different from the one of the article, but it was to be expected since the resolution is very different.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from skimage import io, feature&#xA;from scipy import ndimage&#xA;import numpy as np&#xA;&#xA;def correlation_coefficient(patch1, patch2):&#xA;    product = np.mean((patch1 - patch1.mean()) * (patch2 - patch2.mean()))&#xA;    stds = patch1.std() * patch2.std()&#xA;    if stds == 0:&#xA;        return 0&#xA;    else:&#xA;        product /= stds&#xA;        return product&#xA;&#xA;im = io.imread('faces.jpg', as_grey=True)&#xA;&#xA;im1 = im[16:263, 4:146]&#xA;sh_row, sh_col = im1.shape&#xA;im2 = im[16:263, 155:155+sh_col]&#xA;&#xA;# Registration of the two images&#xA;translation = feature.register_translation(im1, im2, upsample_factor=10)[0]&#xA;im2_register = ndimage.shift(im2, translation)&#xA;&#xA;d = 1&#xA;&#xA;correlation = np.zeros_like(im1)&#xA;&#xA;for i in range(d, sh_row - (d + 1)):&#xA;    for j in range(d, sh_col - (d + 1)):&#xA;        correlation[i, j] = correlation_coefficient(im1[i - d: i + d + 1,&#xA;                                                        j - d: j + d + 1],&#xA;                                                    im2[i - d: i + d + 1,&#xA;                                                        j - d: j + d + 1])&#xA;&#xA;io.imshow(correlation, cmap='gray')&#xA;io.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4PhiR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4PhiR.png&quot; alt=&quot;Output of the script&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code above is a naive and slow implementation of the correlation, as the two for loops are very slow. For faster execution, you could for example port the script to Cython.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the article, I think the idea is to measure whether face expressions look similar or not. If a pixel has a large correlation index between two images, it means that the region of the face where this pixel is located does not change much between the images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use this method on good-resolution images, you should increase the patch size for more accurate results (d=2 or 3).&lt;/p&gt;&#xA;" OwnerUserId="19018" OwnerDisplayName="Emmanuelle Gouillart" LastActivityDate="2016-01-10T22:00:03.330" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28324" PostTypeId="1" AcceptedAnswerId="28327" CreationDate="2016-01-17T19:05:48.680" Score="1" ViewCount="699" Body="&lt;p&gt;For my academic project, I need to process image to get pixel color and also needs to change the pixel color.I need pattern recognition. It is a web application. All I am trying is to capture the image of debit card by webcam and read the details. Please suggest me programming language.  &lt;/p&gt;&#xA;" OwnerUserId="19116" LastEditorUserId="19116" LastEditDate="2016-01-18T06:56:36.557" LastActivityDate="2016-01-18T06:56:36.557" Title="Which one is good Image processing language?" Tags="|image-processing|optical-char-recognition|" AnswerCount="2" CommentCount="0" ClosedDate="2016-01-18T02:10:48.050" ContentLicense="CC BY-SA 3.0" />
  <row Id="28325" PostTypeId="2" ParentId="28317" CreationDate="2016-01-17T20:48:20.703" Score="0" Body="&lt;p&gt;Your last line is wrong. Note that you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(f)\star\delta(f-f_0)=H(f-f_0)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for any $H(f)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your last line should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;&amp;amp;a\,\text{sinc}(2af)\star\delta(f-f_{0})+a\text{ sinc}(2af)\star\delta(f+f_{0})=\\&amp;amp;a\,\text{sinc}(2a(f-f_0))+a\,\text{sinc}(2a(f+f_0))\tag{2}&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You basically get copies of your original spectrum centered at $f_0$ and $-f_0$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-18T11:46:49.210" LastActivityDate="2016-01-18T11:46:49.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28326" PostTypeId="1" AcceptedAnswerId="28333" CreationDate="2016-01-18T00:10:41.450" Score="0" ViewCount="1781" Body="&lt;p&gt;I want to find the pre envelope of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = {\Pi}_{a}(t)\cos(2{\pi}f_{0}t)$$&#xA;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the Fourier transform to be &lt;br&gt;&#xA;$$  \begin{align} X(f) &amp;amp; \triangleq \mathfrak{F}[{\Pi}_{a}(t)\cos(2{\pi}f_{0}t)] \\ &amp;amp; = a\text{ sinc}(2a(f-f_{0})) + a\text{ sinc}(2a(f+f_{0})) \\ \end{align} $$&#xA;&lt;br&gt;So $$X_{+}(f) = 2u(f)X(f)$$ &lt;br&gt;&#xA;But I don't know how to continue from here.&#xA;Is there an easier way to find the pre envelope with another method?&lt;/p&gt;&#xA;" OwnerUserId="18287" LastEditorUserId="18287" LastEditDate="2016-01-18T07:21:29.000" LastActivityDate="2018-10-26T10:21:53.843" Title="Pre-envelope of ${\Pi}_{a}(t)\cos(2{\pi}f_{0}t)$" Tags="|hilbert-transform|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="28327" PostTypeId="2" ParentId="28324" CreationDate="2016-01-18T01:32:14.337" Score="1" Body="&lt;p&gt;I'am using &lt;a href=&quot;http://opencv.org/&quot; rel=&quot;nofollow&quot;&gt;Opencv&lt;/a&gt;, you can program in it with C++ and Python, for example.&lt;/p&gt;&#xA;" OwnerUserId="19091" LastActivityDate="2016-01-18T01:32:14.337" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28328" PostTypeId="2" ParentId="28324" CreationDate="2016-01-18T02:39:49.560" Score="0" Body="&lt;p&gt;This question is much subjective in sense that &lt;em&gt;&quot;how familiar you is with computers programming?&quot;&lt;/em&gt; or &lt;em&gt;&quot;how much is your knowledge about programming and your pratices?&quot;.&lt;/em&gt;&#xA;Commonly, some researchers have adopted MATLAB for prototype projects and after implements this project in a programming language like Java, C++, C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this time, some researchs have adopted Python and your modules for scientific computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what is the best way to getting started?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fist thing that you should be in mind is: both languages are scripted programming languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second one is: the Math Work's software , MATLAB, is a comercial software and you can get prices &lt;a href=&quot;http://www.mathworks.com&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third is: Python is an open-source project, besides this uses the concept of object oriented programming. All infortmation about license and scipy ecossystem is found &lt;a href=&quot;http://www.scipy.org&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example for the question in the context of practical programming is a for loop.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Python using numpy module&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;import numpy as np&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;a = np.ndarray([1, 2, 3])&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;for i in a-1&#xA;     print a[i]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MATLAB&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;a = [1, 2, 3];&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;for i = 1:length(a)&#xA;    disp(a(i))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;end&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To develop in these programming languages ,  the initital skill that you should have is undestand arrays in depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To know about slicing, dimensions and all the operations that you can do with arrays, is highly recommend check the user guide of the languages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to comunity both languages have a great active comunity, and you can get help easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question &lt;em&gt;&quot;How to choose?&quot;&lt;/em&gt; is answered with another question &lt;em&gt;&quot; What language is comfortable to you?&quot;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="17817" LastActivityDate="2016-01-18T02:39:49.560" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28329" PostTypeId="2" ParentId="6405" CreationDate="2016-01-18T03:00:15.553" Score="2" Body="&lt;p&gt;I'm not sure what the freak out about causality or lack thereof is about.  You can approach this problem just by thinking about linear algebra. $L$ is a linear transformation.  Applying $L$ to the input is just matrix multiplication.  So we have $$Lx = y$$  If $x$ is an impulse then it's just picking out a column of $L$, so the columns of $L$ are the impulse responses.  Of course, 3 input-output pairs is not enough to completely determine $L$ as a 5x5 matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider what time-invariance would mean from this perspective.  If a transformation is linear and time-invariant then it's impulse response always has the same shape and is only shifted in time by the same amount as the input impulse.  So let's say the impulse response for $L$ is 0 1 2 3 0 centered on top of the input impulse (and thus non-causal).  The matrix for a linear time-invariant $L$ would then look like:&#xA;$$L = \left(\begin{array}{ccc}&#xA;2 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;3 &amp;amp; 2 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 3 &amp;amp; 2 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 3 &amp;amp; 2 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 3 &amp;amp; 2 &#xA;\end{array}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to answer the first question, you just need to build enough of two columns to see that they are different to disprove time-invariance.  A direct way to do this is to assume it is time-invariant and derive a contradiction.  However, to show that it &lt;em&gt;is&lt;/em&gt; time-invariant requires more information, i.e. it requires completely specifying the matrix.  If it is not time-invariant, then there is a potentially different impulse response for each sample, not a single one, as others have mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, as others have alluded to, we can't actually know whether a linear system is time-invariant or what it's impulse response is just by looking at short input-output pairs without more information.  For all we know, $L$ is a 1,000,000 wide FIR filter or even an IIR filter that just happens to be 0 near the middle.  Or it appears time-invariant so far, but it changes in the next sample.  In general, we have to use multiple hypothesis testing to pick what the evidence best supports.  Probability theory is a crucial part of signal processing.&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-01-18T03:00:15.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28330" PostTypeId="1" AcceptedAnswerId="28331" CreationDate="2016-01-18T07:34:43.663" Score="0" ViewCount="55" Body="&lt;p&gt;Even though the wave of $\sin(2x-4)$ looks like &lt;a href=&quot;https://www.google.co.in/?gfe_rd=cr&amp;amp;ei=3I2cVrxnkMjwB_vzoaAP&amp;amp;gws_rd=ssl#q=plot%20sin%282x-4%29&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; and it starts from position 2 out of curiosity I would like to know whether we could start it from position 4 like the wave of $\sin(2x)$ shown &lt;a href=&quot;https://www.google.co.in/?gfe_rd=cr&amp;amp;ei=cI-cVvaNDI7I8Af3k6SoCQ&amp;amp;gws_rd=ssl#q=plot%20sin%282x%29&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11615" LastEditorUserId="8202" LastEditDate="2016-01-18T09:02:39.967" LastActivityDate="2016-01-18T20:44:33.757" Title="Can we start a wave $\sin(2x-4)$ from position 4 in the horizontal axis?" Tags="|signal-analysis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28331" PostTypeId="2" ParentId="28330" CreationDate="2016-01-18T10:48:08.580" Score="4" Body="&lt;p&gt;You can shift the origin to $x=a$ by replacing the argument $x$ by $x-a$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(2(x-a))\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since for $\sin(2x-4)=\sin(2(x-2))$ you have $a=2$, the origin is shifted to $x=2$. If you want to shift it to $x=4$, you get from Eq. $(1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(2(x-4))=\sin(2x-8)\tag{2}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-18T10:48:08.580" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28332" PostTypeId="2" ParentId="28330" CreationDate="2016-01-18T10:50:35.910" Score="1" Body="&lt;p&gt;I am not sure whether I understand the question completely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all do you mean this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.google.de/?gfe_rd=cr&amp;amp;ei=3I2cVrxnkMjwB_vzoaAP&amp;amp;gws_rd=cr#q=plot+sin(2x-8)&quot; rel=&quot;nofollow&quot;&gt;sin(2x-8)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here ONE zero crossing of the sin-wave is at the point (4,0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general the sinus is has no real starting point since its periodic, therefor you get an infinite amount of zero-crossings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you might want to look at the equation this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$sin(2*pi*Frequency*x+Phase) \tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here Phase represents the shift to the left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case with the nested frequency and phase it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$sin(2*(x-2))$$ or $$sin(2*(x-4))$$&lt;/p&gt;&#xA;" OwnerUserId="19108" LastEditorUserId="19108" LastEditDate="2016-01-18T20:44:33.757" LastActivityDate="2016-01-18T20:44:33.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28333" PostTypeId="2" ParentId="28326" CreationDate="2016-01-18T11:40:42.333" Score="1" Body="&lt;p&gt;The pre-envelope is also called &lt;a href=&quot;https://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow noreferrer&quot;&gt;analytic signal&lt;/a&gt;. Its Fourier transform is indeed given by the expression in your question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X_+(f)=2X(f)u(f)\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X(f)$&lt;/span&gt; is the Fourier transform of the original signal, and &lt;span class=&quot;math-container&quot;&gt;$u(f)$&lt;/span&gt; is the unit step function. Obviously, &lt;span class=&quot;math-container&quot;&gt;$X_+(f)$&lt;/span&gt; has only positive frequency components. The analytic signal &lt;span class=&quot;math-container&quot;&gt;$x_+(t)$&lt;/span&gt; with its Fourier transform given by &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is necessarily a complex-valued signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x_+(t)=x(t)+j\mathcal{H}\{x(t)\}\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}\{\cdot\}$&lt;/span&gt; denotes the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hilbert transform&lt;/a&gt;. Note that the analytic signal is not the same as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Analytic_signal#Complex_envelope.2Fbaseband&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex envelope&lt;/a&gt;. For a band pass signal &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;, the complex envelope is a low pass signal, whereas the analytic signal is a band pass signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;, in order to compute the analytic signal you need to compute the Hilbert transform of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{x}(t)=\mathcal{H}\{x(t)\}=\frac{1}{\pi}\int_{-\infty}^{\infty}\frac{x(\tau)}{t-\tau}d\tau\tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the given signal you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{x}(t)=\frac{1}{\pi}\int_{-a}^a\frac{\cos(2\pi f_0\tau)}{t-\tau}d\tau\tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result of &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; can be written in terms of the &lt;a href=&quot;http://mathworld.wolfram.com/CosineIntegral.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;cosine integral&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\text{Ci}(x)$&lt;/span&gt; and the &lt;a href=&quot;http://mathworld.wolfram.com/SineIntegral.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;sine integral&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\text{Si}(x)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{x}(t)=\frac{1}{\pi}\left\{\cos(2\pi f_0t)\left[\text{Ci}(2\pi f_0(t+a))-\text{Ci}(2\pi f_0(t-a))\right]+\\\sin(2\pi f_0)\left[\text{Si}(2\pi f_0(t+a))-\text{Si}(2\pi f_0(t-a))\right]\right\}\tag{5}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think that anybody expected you to come up with that awful expression. Anyway, for large values of &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt;, the first term in &lt;span class=&quot;math-container&quot;&gt;$(5)$&lt;/span&gt; becomes very small, and the second term converges to &lt;span class=&quot;math-container&quot;&gt;$\sin(2\pi f_0)\Pi_a(t)$&lt;/span&gt;. So for large &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt; you get the expected result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x_+(t)\approx x(t)+j\sin(2\pi f_0)\Pi_a(t)=\Pi_a(t)e^{j2\pi f_0 t}\tag{6}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the respresentation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x(t)=\text{Re}\left\{\Pi_a(t)e^{j2\pi f_0 t}\right\}\tag{7}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is always valid, but the complex-valued signal &lt;span class=&quot;math-container&quot;&gt;$\Pi_a(t)e^{j2\pi f_0 t}$&lt;/span&gt; is no analytic signal, it's just a good approximation of the analytic signal for large values of &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for &lt;span class=&quot;math-container&quot;&gt;$x(t)=m(t)\cos(2\pi f_0t)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$m(t)$&lt;/span&gt; a band-limited function, i.e. &lt;span class=&quot;math-container&quot;&gt;$M(f)=0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|f|&amp;gt;B$&lt;/span&gt;, the complex-valued signal &lt;span class=&quot;math-container&quot;&gt;$m(t)e^{j2\pi f_0 t}$&lt;/span&gt; &lt;em&gt;is&lt;/em&gt; an analytic signal, as long as &lt;span class=&quot;math-container&quot;&gt;$f_0&amp;gt;B$&lt;/span&gt;. The problem with the function given in your question is that &lt;span class=&quot;math-container&quot;&gt;$\Pi_a(t)$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; band-limited.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2018-10-26T10:21:53.843" LastActivityDate="2018-10-26T10:21:53.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28334" PostTypeId="1" AcceptedAnswerId="28336" CreationDate="2016-01-18T11:48:19.743" Score="0" ViewCount="3015" Body="&lt;p&gt;After performing the fft transform there are 2 options to plot the spectrum&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the &lt;code&gt;complex (Real and imaginair) spectrum&lt;/code&gt; and the &lt;code&gt;magnitude with the phase&lt;/code&gt;.&lt;br&gt;&#xA;(I neglect the magnitude only for this question)&lt;br&gt;&#xA;My question is why is the spectrum of &lt;code&gt;magnitude with phase&lt;/code&gt; always &lt;code&gt;single sided&lt;/code&gt;.&#xA;and why is the &lt;code&gt;complex spectrum&lt;/code&gt; always &lt;code&gt;double sided&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;second questsion is&#xA;make it sense to create a &lt;code&gt;double sided magnitude phase&lt;/code&gt; plot or an &lt;code&gt;single sided complex&lt;/code&gt; plot?&lt;/p&gt;&#xA;" OwnerUserId="13541" LastEditorUserId="13541" LastEditDate="2016-01-18T12:45:47.963" LastActivityDate="2016-01-18T12:45:47.963" Title="Single/ Double sided spectrum plot" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28335" PostTypeId="1" AcceptedAnswerId="28340" CreationDate="2016-01-18T12:27:59.767" Score="7" ViewCount="3213" Body="&lt;p&gt;I'm reading up on Kalman filtering at the moment. In particular, I'm interested in using the &quot;extended&quot; and &quot;unscented&quot; variants for IMU sensor fusion and calibration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;http://graphics.cs.brown.edu/~jjl/pubs/laviola_acc2003.pdf&quot;&gt;A comparison of unscented and extended Kalman filtering for estimating quaternion motion&lt;/a&gt;, quaternions are used to represent 3d rotation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand &lt;a href=&quot;https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation&quot;&gt;unit quaternions can be used to represent a 3d rotation&lt;/a&gt;. They suit for representing absolute attitude (a rotation from a universal reference), relative rotation, or angular velocity (a rotation representing rate per second, or some other fixed time period).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this papers discuss using &lt;a href=&quot;https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods&quot;&gt;Runge-Kutta integration&lt;/a&gt;, specifically RK4. It uses RK4 with the quaternions but doesn't seem to furnish details of what this involves or why it is necessary. Here's the part of the paper that mentions it…&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given the state vector at step k − 1, we first perform the prediction step by finding the a priori state estimate xˆ−k by integrating equation 1 &lt;strong&gt;[f = dq/dt = qω/2]&lt;/strong&gt; through time by ∆t (i.e., 1.0 divided by the current sampling rate) using a 4th Order Runge-Kutta scheme.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've encountered Runge Kutta before for integrating positions in kinematics. I don't really understand how or why it would be needed here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My naive approach would be to simply multiply the existing attitude q by the angular velocity ω to get the expected new q – I don't see why numerical integration is necessary here? Perhaps it's to &quot;scale&quot; the unit time ω to the change that occurs in in ∆t, but surely that can be done very simply by directly manipulating of ω (raising it to fractional power ∆t)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know?&lt;/p&gt;&#xA;" OwnerUserId="12213" LastEditorUserId="12213" LastEditDate="2016-01-18T12:38:40.997" LastActivityDate="2016-06-08T20:46:47.893" Title="Why Runge-Kutta for Quaternion integration in Kalman filter?" Tags="|kalman-filters|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28336" PostTypeId="2" ParentId="28334" CreationDate="2016-01-18T12:35:27.887" Score="0" Body="&lt;p&gt;For real-valued sequences, the DFT is always conjugate symmetrical, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=X^*[N-k],\qquad k=0,1,\ldots N-1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the DFT length. From $(1)$ with $X[k]=X_R[k]+jX_I[k]$ it follows that the real part of $X[k]$ is symmetrical, and the imaginary part is anti-symmetrical:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_R[k]=X_R[N-k]\\&#xA;X_I[k]=-X_I[N-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, with $X[k]=M[k]e^{j\phi[k]}$ we get for magnitude and phase&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M[k]=M[N-k]\\&#xA;\phi[k]=-\phi[N-k]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for real-valued sequences, you get the above symmetries in the real and imaginary parts, and also in the magnitude and phase. So no matter if you represent the DFT in terms of real and imaginary parts, or in terms of magnitude and phase, a one-sided spectrum (i.e. for indices $0,\ldots, \lfloor N/2\rfloor$) is always sufficient, as long as the sequence is real-valued.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-18T12:35:27.887" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28338" PostTypeId="1" AcceptedAnswerId="28339" CreationDate="2016-01-18T18:24:28.737" Score="4" ViewCount="362" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z(t) = A\cos(\omega t+\theta)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;~&lt;span class=&quot;math-container&quot;&gt;$\mathcal N(0,\sigma ^2) $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta $&lt;/span&gt;~&lt;span class=&quot;math-container&quot;&gt;$\mathcal U(0,2\pi)$&lt;/span&gt; are independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to figure out if &lt;span class=&quot;math-container&quot;&gt;$Z(t)$&lt;/span&gt; is a Gaussian random process and whether it is strict sense stationary.&#xA;It is easy to see that it is  WSS, but I can't figure out about the SSS and whether it is a Gaussian process.&#xA;It does look like to me that for every chosen time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; I get  some kind of a normal random variable multiplied by a constant per &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and therefore it is a Gaussian process, but I can't seem to prove nor disprove it.&#xA;Can someone clarify this for me?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="16669" LastEditorUserId="235" LastEditDate="2020-04-24T03:14:53.440" LastActivityDate="2020-04-24T03:14:53.440" Title="Is $A\cos(\omega t+\theta)$ a Gaussian random process?" Tags="|gaussian|stationary|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28339" PostTypeId="2" ParentId="28338" CreationDate="2016-01-18T19:47:09.160" Score="3" Body="&lt;p&gt;I'm pretty sure that even algebraically, $Z$ will not be Gaussian.  You're multiplying a Gaussian by a random variable that has a distribution that is effectively the histogram of a (co)sine function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gdRAB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gdRAB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's do it empirically, though, following the example &lt;a href=&quot;https://stats.stackexchange.com/a/3138/161&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking first at the densities, you can see that the density estimate for $Z$ (red) is much more central than that of $A$ (green).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KhiP8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KhiP8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plotting the &lt;code&gt;qqnorm&lt;/code&gt; and &lt;code&gt;qqline&lt;/code&gt; plots for both, are below. As you can see, the one for $Z$ does not coincide much with the red line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, for $A$:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/HNsFC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HNsFC.png&quot; alt=&quot;Plot for $A$&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, for $Z$:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/oQthv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oQthv.png&quot; alt=&quot;Plot for $Z$&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding stationarity: the signal $Z$ is not stationary at all because it is &lt;a href=&quot;https://en.wikipedia.org/wiki/Cyclostationary_process&quot; rel=&quot;nofollow noreferrer&quot;&gt;cyclostationary&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 28338&#xA;T &amp;lt;- 10000&#xA;sigma  &amp;lt;- 1&#xA;&#xA;A &amp;lt;- rnorm(T,0,sigma)&#xA;theta &amp;lt;- runif(1,0, 2 * pi)&#xA;&#xA;fs &amp;lt;- 100&#xA;t &amp;lt;- (1:T)/fs&#xA;omega &amp;lt;- 2* pi * 0.0892987&#xA;Z &amp;lt;- A * cos(omega*t + theta)&#xA;&#xA;# First diagram&#xA;hist(sin(omega*t))&#xA;&#xA;# Second diagram&#xA;dA &amp;lt;- density(A)&#xA;dZ &amp;lt;- density(Z)&#xA;plot(dZ, col=&quot;red&quot;, lwd=5)&#xA;lines(dA, col=&quot;green&quot;, lwd=5)&#xA;&#xA;# Third diagram&#xA;qqnorm(A)&#xA;qqline(A, col = 2)&#xA;&#xA;# Fourth diagram&#xA;qqnorm(Z)&#xA;qqline(Z, col = 2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2016-01-19T17:41:04.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28340" PostTypeId="2" ParentId="28335" CreationDate="2016-01-19T03:32:52.390" Score="7" Body="&lt;p&gt;I think the confusion comes from the authors not parameterizing things clearly.  Furthermore, by switching to &lt;a href=&quot;http://geocalc.clas.asu.edu/html/Intro.html&quot;&gt;geometric algebra&lt;/a&gt; rather than quaternions, some additional confusion can be cleared up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main difference between normal vector algebra and geometric algebra is that we can multiply vectors. So of $e_x$, $e_y$, and $e_z$ are our (orthonormal) basis vectors, we also have $e_x e_y$ which is not a vector but a bivector which can be thought of as an oriented plane element.  (By &quot;pure vector quaternion&quot; they mean a bivector; you are correct that that means $0$ $w$ part and it's reasonable to say it has a $0$ &quot;real&quot; part.)  A key property is that the basis vectors anti-commute with each other, i.e. $e_x e_y = -e_y e_x$.  This leads to $(e_x e_y)^2 = -1$.  In general, any unit bivector squares to $-1$, which means we can apply Euler's formula: $$R = e^{\theta B} = \cos\theta + B\sin\theta$$ where $B$ is a unit bivector and we call $R$ a &lt;strong&gt;rotor&lt;/strong&gt;.  A unit quaternion is just a 3D rotor.  (Complex numbers are just the even sub-algebra of the 2D geometric algebra.  Here we are looking at quaternions, the even sub-algebra of 3D GA.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want a rotation by $\theta$ in the plane of a unit bivector $B$ we use the rotor $R = e^{\frac{\theta}{2}B}$.  (The half comes in because we rotate a vector $v$ via $Rv\widetilde{R}$; see the link above.)  Of course, we want to allow both the plane and the angle to vary so we define the (non-unit) bivector $\Theta(t) = \theta(t)B(t)$ so if $$R(t) = e^{\frac{1}{2}\Theta(t)}$$ then $$\dot{R}(t) = \frac{1}{2}\Omega(t)R(t)$$ where $\Omega = \dot{\Theta}$.  This is their $f = q\omega/2$; their $q$ is our $R$ and their $\omega$ is our $\Omega$.  Now if we have $R(t_0)$ and we want $R(t_0 + \Delta{}t)$ we need to integrate $\dot{R}$ from $t_0$ to $t_0 + \Delta{}t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scheme you describe is roughly analogous to doing forward Euler integration, which essentially assumes their $q$ and $\omega$ our $R$ and $\Omega$ is constant over $\Delta{}t$.  RK4 is just a better integration method.  I doubt there is any special reason they chose to use RK4 as opposed to other integration methods.  It's just the default choice typically.&lt;/p&gt;&#xA;" OwnerUserId="19119" LastEditorUserId="19119" LastEditDate="2016-01-19T04:04:02.617" LastActivityDate="2016-01-19T04:04:02.617" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28341" PostTypeId="2" ParentId="27178" CreationDate="2016-01-19T10:09:33.997" Score="1" Body="&lt;p&gt;LTE is very much &quot;everything described in this humongous collection of standard documents is possible, you will have to accept what the base station tells you your downstream signal will look like&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's highly adaptive and will give you as many ressource blocks as it deems you deserve, and will add as much coding as necessary to retain a certain BER etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking for something that can at least partially understand LTE downlink, have a look at Johannes Demel's &lt;a href=&quot;https://github.com/kit-cel/gr-lte&quot; rel=&quot;nofollow&quot;&gt;gr-lte&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;gr-lte provides blocks to synchronize to a LTE downlink signal. It performs OFDM operation to operate in the frequency domain and provides a channel estimator. At this point physical LTE downlink channels can be extracted from the symbols and be processed. PBCH is fully implemented and decodes MIB. PCFICH is available too. Almost all code for PHICH is implemented and there is lots of code to bring PDCCH support. It is not yet possible to just plug it in, though. Eventually all channels shall be supported.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-19T10:09:33.997" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28342" PostTypeId="2" ParentId="28250" CreationDate="2016-01-19T10:37:13.987" Score="4" Body="&lt;p&gt;Don't be confused; you're doing everything correctly here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;f_{sample,in} &amp;amp;&amp;amp;\overset{\text{interpolate}}{\rightarrow}&amp;amp;&amp;amp; f_{sample,intermediate} &amp;amp;&amp;amp;\overset{\text{decimate}}{\rightarrow}&amp;amp;&amp;amp; f_{sample,out}\\&#xA;22 \mathrm{kHz}&amp;amp;&amp;amp;\overset{\uparrow 20}{\rightarrow}&amp;amp;&amp;amp; 440 \mathrm{kHz} &amp;amp;&amp;amp;\overset{\downarrow 11}{\rightarrow}&amp;amp;&amp;amp; f_{sample,out}&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;To avoid images after interpolating, you will have to suppress all signal above 11kHz, which demands low pass with a cut off of $\frac1{2\cdot20}f_{sample,intermediate}$.&lt;/li&gt;&#xA;&lt;li&gt;To avoid aliases during decimation, you will have to suppress all signal above 20kHz, which demands a low pass filter with a cut off frequency of $\frac1{2\cdot11}f_{sample,intermediate}$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Since the filter from 1. implies 2., using one filter is sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a very commonly applied optimization.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-19T10:37:13.987" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28344" PostTypeId="1" AcceptedAnswerId="28346" CreationDate="2016-01-19T13:23:42.777" Score="2" ViewCount="5965" Body="&lt;p&gt;I'm reading a paper on EMG analysis. The formulas are all clear to me, but the paper refers to the signal amplitude as &quot;instantaneous&quot; amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know what instantaneous mean, but what does it mean in the context of signal processing?&lt;/p&gt;&#xA;" OwnerUserId="15934" LastEditorUserId="4298" LastEditDate="2018-08-15T16:58:30.020" LastActivityDate="2020-04-20T13:01:52.233" Title="Estimation of Instantaneous Amplitude" Tags="|signal-analysis|hilbert-transform|emg|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28345" PostTypeId="2" ParentId="28344" CreationDate="2016-01-19T13:37:08.903" Score="3" Body="&lt;p&gt;Instantaneous amplitude is usually done in conjunction with analytic signals and the Hilbert transform. &lt;a href=&quot;https://dsp.stackexchange.com/a/25846/80&quot;&gt;See this answer on this site.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For signal $s(t)$, given its Hilbert Transform $\hat{s}(t)$ it is defined as a composition:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$s_A(t)=s(t)+j\hat{s}(t) $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The Analytic Signal that we obtain is complex valued, therefore we can express it in exponential notation:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$s_A(t)=A(t)e^{j\psi(t)}$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$A(t)$ is the instantaneous amplitude (envelope)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$\psi(t)$ is the instantaneous phase.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-01-19T13:37:08.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28346" PostTypeId="2" ParentId="28344" CreationDate="2016-01-19T13:38:12.623" Score="3" Body="&lt;p&gt;The instantaneous amplitude (or envelope) is usually defined as the magnitude of the (complex-valued) &lt;a href=&quot;https://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;nofollow&quot;&gt;analytic signal&lt;/a&gt; $x_a(t)$ associated with the given signal $x(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_a(t)=x(t)+j\mathcal{H}\{x(t)\}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathcal{H}$ denotes the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow&quot;&gt;Hilbert transform&lt;/a&gt;. So the instantaneous amplitude (envelope) of $x(t)$ is given by $|x_a(t)|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a very simple example, take $x(t)=\cos(\omega_0t)$. Its Hilbert transform is $\sin(\omega_0t)$, and, consequently, its associated analytic signal is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_a(t)=\cos(\omega_0t)+j\sin(\omega_0t)=e^{j\omega_0t}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The instantaneous amplitude (envelope) of $x(t)$ is $|x_a(t)|=1$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-19T13:38:12.623" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28347" PostTypeId="1" AcceptedAnswerId="28348" CreationDate="2016-01-19T19:42:00.117" Score="0" ViewCount="107" Body="&lt;p&gt;I've read this signal from a radio remote that opens a gate. This signal is already after AM demodulation, read by using a Saleae logic analyzer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/33Hvf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/33Hvf.png&quot; alt=&quot;signal screenshot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know much about signal processing, but I would like to emit the same signal with my own transmitter. To do this I would like to know what encoding this signal is using? Is it possible to determine the encoding type only by looking at the signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spikes at the left is the beginning of the signal. I've truncated the rest of the signal because I guess there's no point in showing all of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also could anyone guide me to some good resources about self-clocking signals, usage of low duty cycle clocks in signals, that would help me to decode the message in this signal?&lt;/p&gt;&#xA;" OwnerUserId="19141" LastEditorUserId="19141" LastEditDate="2016-01-19T19:49:25.837" LastActivityDate="2016-01-19T19:59:10.930" Title="Signal encoding identification" Tags="|signal-analysis|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28348" PostTypeId="2" ParentId="28347" CreationDate="2016-01-19T19:59:10.930" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;This signal is already after AM demodulation&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That means this is only meaningful if the signal actually only contains information in its amplitude; luckily, most simple remotes just use some form of On-Off-Keying or Pulse Position Modulation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible to determine the encoding type only by looking at the signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If this really is just a signal that is either on or off, then this looks like on-off keying. But really, your visualization might have hidden a lot of relevant information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be a lot. It might simply be that the receiver uses the clock it has, or derives its clock from the preamble. Then, it could just be on/off, or it could also be manchester encoded.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-19T19:59:10.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28349" PostTypeId="2" ParentId="25339" CreationDate="2016-01-19T20:29:38.247" Score="0" Body="&lt;p&gt;I understand that you might already have a set of approximate solutions (&quot;Now that I obtained all $x$  for which&quot;), and look for a &quot;best&quot; sparse solution. The $\ell_0$ count measure (not a norm, nor a quasinorm) is the most natural and homogeneous ($\ell_0(\alpha x) =\ell_0( x)$ for $\alpha\neq 0$), but is not computationally tractable, and very sensitive to noise. Other measures have been designed to address this issue in &lt;a href=&quot;http://arxiv.org/pdf/0811.4706&quot; rel=&quot;nofollow&quot;&gt;Comparing measures of sparsity&lt;/a&gt;. Among the proposals, the Gini index and the $\ell_1/\ell_2$ norm ratio are quite promising (they are homogeneous too, in contrary to norms). The latter has been used for instance as a stopping criterion in sparse source separation algorithms. It can even be used as a sparsity- inducing penalty, see for instance  &lt;a href=&quot;http://arxiv.org/pdf/1407.5465&quot; rel=&quot;nofollow&quot;&gt;Euclid in a Taxicab: Sparse Blind Deconvolution with Smoothed $\ell_1/\ell_2$ Regularization&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-19T20:29:38.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28350" PostTypeId="1" CreationDate="2016-01-19T20:52:38.647" Score="0" ViewCount="191" Body="&lt;p&gt;I've come across an issue with my ANN when attempting to port my offline analysis to an online, real-time, application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently train my algorithm using an array of input data, number of channels (columns) against number of samples (rows), and I preprocess the data by subtracting the samples mean and dividing through the standard deviation. This works well, and I'm getting accuracies for each of the output target values (4 targets in total) around 98%. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in a real-time application, where only one sample is arriving at a time, I cannot apply this same preprocessing method, as I can't determine the mean and STD on a single sample! So far this is purely a feed-forward problem, using saved weights from the offline analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious solution is to not use that preprocessing method, but it's the only way I can get working results. If I remove the preprocessing method all together the ANN just doesn't work, and all estimates are put in the first target value. Same goes for trying to preprocess the data based on the single sample (i.e. the same method mentioned above but determining the mean and STD on the data x axis, instead of the y axis). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Why is preprocessing in this manner necessary? What is happening when I subtract the mean and divide through the STD that makes everything work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What can I do to correct this issue? The only idea I have is to save the mean and STD value for real-time processing, and then update the mean/STD as new samples are presented. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally I want a preprocessing method which I can perform on a single sample, or no preprocessing at all! Failing that, any suggestions on how you would go about this issue would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7855" LastActivityDate="2016-01-19T21:16:33.843" Title="Artificial Neural Network Preprocessing in Real-Time Applications" Tags="|algorithms|python|preprocessing|neural-network|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28351" PostTypeId="2" ParentId="28350" CreationDate="2016-01-19T21:07:02.967" Score="1" Body="&lt;p&gt;The answer i give is probably partly help full.&lt;br&gt;&#xA;What you can do is when you have a pre stored STD and MEAN(N samples long). While running the real time proces update the stored MEAN.&lt;br&gt;&#xA;Create an array of you mean value. During the loop add every cycle a sample to your array and remove the oldest one. You create a kind of circular pattern. After N samples your MEAN is only the MEAN from your data.&lt;br&gt;&#xA;Do the same with the STD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you can create a different MEAN and STD from different types of data so the error is less worse  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good Luck&lt;/p&gt;&#xA;" OwnerUserId="13541" LastEditorUserId="13541" LastEditDate="2016-01-19T21:16:33.843" LastActivityDate="2016-01-19T21:16:33.843" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28352" PostTypeId="1" AcceptedAnswerId="28358" CreationDate="2016-01-19T21:22:12.723" Score="0" ViewCount="721" Body="&lt;p&gt;I have a function of type &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(t)=0.31 \left(e^{-0.267t}-e^{-1.72t}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $t$ is in hours&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function represents the evolution in a window of 24 hours of a drug blood concentration, after a dose of a drug is given at  $t = 0$ to a patient. I would like to use Fourier transform, to identify th best sampling step to reconstruct the concentration curve. Because it is a human whose blood we are sampling here I would like to reduce the sampling as much as possible, with a reconstruction error of around 20%. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Matlab FFT function to compute the function's Fourier transform and plot the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I am not sure if my frequency are in Hertz or Millihertz. Because I am sampling in hours, I am expecting lower frequencies (millihertz), but I am not sure of the logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my Matlab Code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; clc;close all;&#xA;%% Time-domain signal&#xA;Ts=0.25; % time discretization step&#xA;t=0:Ts:24 % in hours&#xA;C=0.31* (exp(-0.267*(t))-exp(-1.72*(t)));&#xA;&#xA;figure,plot(t,C);&#xA;&#xA;title('Time domain signal');&#xA;xlabel('Time in hours ')&#xA;&#xA;%Frequency domain signal Via Matlab FFT function&#xA;F2=fft(C);&#xA;L=length(F2);&#xA;figure,plot((0:L-1)*(1/(L*Ts)),abs(F2));&#xA;title('Frequency domain signal via FFT of C(t)');&#xA;xlabel('Frequency in Hz or Millihertz?')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16213" LastEditorUserId="16213" LastEditDate="2016-01-22T15:28:33.190" LastActivityDate="2016-01-22T15:28:33.190" Title="Matlab fast fourier transform (FFT) function and time in hours frequency : hertz or millihertz?" Tags="|matlab|fourier-transform|frequency-spectrum|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28353" PostTypeId="2" ParentId="28352" CreationDate="2016-01-19T21:49:15.850" Score="0" Body="&lt;p&gt;That function is not periodic. Using the Fourier transform to analyze its behaviour is &lt;em&gt;questionable&lt;/em&gt;, to say the least. Maybe you're confusing things with the Laplace transform, which is more useful when analyzing control systems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why should the axis in your plot have Hertz as unit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The discrete Fourier transform¹ does a base transform from a vector in $C^N$ to a vector in $C^N$; its physical significance is that the result is that each bin represents another frequency between $0$ and the the Nyquist rate (which, in the complex sampling case is the sample rate, and in the real sampling case is half the sample rate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you only have a real function, I'd argue frequencies are relative to $\frac{f_{sample}}2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{sample}$ is $\frac{4}{\text{hour}}=\frac4{60\cdot60\,\text{s}}= \frac1{900}\,\text{Hz}$ in your case. So each bin represents a frequency $$f\in [-\frac{f_{sample}}2 ; \frac{f_{sample}}2[\,=\,[-\frac{1}{1800}\,\text{Hz}; \frac{1}{1800}\,\text{Hz}[$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, frequency base vectors are uniformly spread over the nyquist rate, so the $n^\text{th}$ bin represents frequency $\frac{\frac{1}{900}\,\text{Hz}}{n_\text{bins}}$. $n_\text{bins}$ is the number of bins, which is the same as the input vector size; which is $4\cdot24=96$. So each bin is $\frac1{96\cdot900}\,\text{Hz}= 11.5741\,\mu\text{Hz}$. Not very handy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you're somewhat confused what an FFT is. I think a textbook on signal theory will do you very well!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;¹ you're using &lt;code&gt;fft&lt;/code&gt;, which is a fast implementation of the DFT; not the continuous &lt;em&gt;Fourier transform&lt;/em&gt;. That's an important difference.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-19T21:49:15.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28354" PostTypeId="1" AcceptedAnswerId="28355" CreationDate="2016-01-20T00:28:26.190" Score="3" ViewCount="1966" Body="&lt;p&gt;&lt;code&gt;fftw_plan_dft_r2c_1d&lt;/code&gt; takes an array for real numbers and produces an array of complex numbers 1/2 the size of input array + 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;per fftw's website:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As a result of this symmetry, half of the output Y is redundant (being the complex conjugate of the other half), and so the 1d r2c transforms only output elements 0...n/2 of Y (n/2+1 complex numbers), where the division by 2 is rounded down.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When I normalize do I normalize by the size of the fft or the resulting fft_size / 2&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // normalize the fft&#xA;    for (unsigned int x = 0; x &amp;lt;(fftSize/2); x++)&#xA;        array[x] = array[x] / complex&amp;lt;double&amp;gt;((fftSize/2), 0);   &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    // normalize the fft&#xA;    for (unsigned int x = 0; x &amp;lt;(fftSize/2); x++)&#xA;        array[x] = array[x] / complex&amp;lt;double&amp;gt;(fftSize, 0);       &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19142" LastEditorUserId="80" LastEditDate="2016-01-20T01:04:51.057" LastActivityDate="2016-01-20T01:04:51.057" Title="normalize fft produced by fftw_plan_dft_r2c_1d" Tags="|fft|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28355" PostTypeId="2" ParentId="28354" CreationDate="2016-01-20T01:04:12.480" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://www.fftw.org/doc/The-1d-Real_002ddata-DFT.html#The-1d-Real_002ddata-DFT&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reading the manual&lt;/a&gt;, even though only half the data is returned, the full length FFT is calculated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8KPb4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8KPb4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you should normalize by whatever the full length is normalized to: &lt;code&gt;fft_size&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-20T01:04:12.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28356" PostTypeId="1" AcceptedAnswerId="28372" CreationDate="2016-01-20T05:01:50.250" Score="0" ViewCount="464" Body="&lt;p&gt;For example, I would like to do like in this video:&#xA;&lt;a href=&quot;https://www.youtube.com/watch?v=YBhneZuAb5k&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=YBhneZuAb5k&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have for example a goat yelling sample and from this sample, we can change the pitch according to the pressed piano key. I would like to make a script that will, from one input sample, generate all samples for each pitch/note (do re mi...).&#xA;What is the algorithm for doing that?&lt;/p&gt;&#xA;" OwnerUserId="19144" LastEditorUserId="13320" LastEditDate="2016-01-20T13:06:21.157" LastActivityDate="2016-01-21T02:07:23.500" Title="Convert one sound sample in different sample where each sample's pitch is a note (do-re-mi...)" Tags="|audio|pitch|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28358" PostTypeId="2" ParentId="28352" CreationDate="2016-01-20T06:59:51.207" Score="0" Body="&lt;p&gt;Provided you make your function causal, for instance with $C(t) =0$ for $t&amp;lt;0$ you get a function whose continuous Fourier transform is well defined (&lt;a href=&quot;http://www.thefouriertransform.com/pairs/decayingexponential.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;as the sum of two one-sided decaying exponentials&lt;/a&gt;). The first step is to compute it, for sanity  check.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, $C$ is not band-limited, so a direct sampling (for  Matlab) is likely to induce errors, but  you can get a reasonable approximation, provided your sampling is fine enough. $0.25$ hour was a bit coarse, and on a smaller time range:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cW38j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cW38j.png&quot; alt=&quot;Time signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I strongly recommand to tick your x-axis in seconds, to get sound frequencies in Herz. here I took:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ts=0.1; % time discretization step&#xA;t=-0.03*3600:Ts:0.03*3600 % in hours (0.03) times seconds/hour&#xA;C=0.31* (exp(-0.267*(t))-exp(-1.72*(t)));&#xA;C(t&amp;lt;0) = 0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, using a standard &lt;code&gt;FFT&lt;/code&gt; code, you can get a 'reasonable' idea of the amplitude spectrum. Here I used &lt;a href=&quot;http://www.laurent-duval.eu/Documents-Common/FFTR.m&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;FFTR.m&lt;/code&gt;&lt;/a&gt;, a code I made for a quick display of one half of the spectrum for a real function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FFTR(C',Ts);&#xA;set(gca,'XScale','linear')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y5TKV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y5TKV.png&quot; alt=&quot;Time signal spectrum&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What could be interesting for you is to superimpose the actual continuous Fourier transform, to check the differences.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-20T06:59:51.207" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28359" PostTypeId="1" AcceptedAnswerId="28479" CreationDate="2016-01-20T09:54:41.623" Score="1" ViewCount="100" Body="&lt;p&gt;I have passed random numbers $${89, 58, 13, 70, 24}$$ with their negatives alternating, through 5 order moving average filter and output was positive and negative numbers alternating. After I have passed output through 4 order mov. average filter, output was positive and negative semi-periods! although no quasi-sinusoidal. But after passing this second output through 3 order moving average filter, output was quasi-sinusoidal! How then all that happened? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following are input signal and outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Random numbers alternate with their negatives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${89, -89, 58, -58, 13, -13, 70, -70, 24, -24,&#xA;    89, -89, 58, -58, 13, -13, 70, -70, 24, -24,&#xA;    89, -89, 58, -58}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After passing through 5 order moving average:&#xA;$$2.6, -17.8, 14, -11.6, 4.8, -2.6, 17.8, -14, 11.6, -4.8, 2.6, -17.8, 14, -11.6, 4.8, -2.6, 17.8, -14, 11.6, -4.8$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After passing through 4 order moving average: &#xA;$$-3.2, -2.65, 1.15, 2.1, 1.5, 3.2, 2.65, -1.15, -2.1, -1.5, -3.2, -2.65, 1.15, 2.1, 1.5, 3.2, 2.65 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After passing through 3 order moving average: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-1.56667, 0.2, 1.58333, 2.26667, 2.45, 1.56667, -0.2, -1.58333, -2.26667, -2.45, -1.56667, 0.2, 1.58333, 2.26667, 2.45$$&lt;/p&gt;&#xA;" OwnerUserId="17893" LastEditorUserId="17893" LastEditDate="2016-01-21T13:05:46.707" LastActivityDate="2016-01-27T01:31:01.930" Title="How is that after random numbers with their negatives alternating passing through 5, 4, 3 order moving average filter, become quasi sinusoidals?" Tags="|moving-average|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="28360" PostTypeId="1" CreationDate="2016-01-20T10:46:26.730" Score="1" ViewCount="3874" Body="&lt;p&gt;I need to calculate a series of coefficients for several FIR filters having 96 taps is there a standard or set formula for calculating these, it is a low pass filter.&lt;/p&gt;&#xA;" OwnerUserId="19150" LastEditorUserId="4298" LastEditDate="2016-01-20T11:07:48.587" LastActivityDate="2016-02-19T11:57:37.037" Title="Is there a set formula for calculating FIR coefficients (for a LPF ir 96 taps)?" Tags="|filters|filter-design|lowpass-filter|finite-impulse-response|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28361" PostTypeId="2" ParentId="28360" CreationDate="2016-01-20T11:02:05.280" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;is there a standard or set formula for calculating these, it is a low pass filter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. There's very many approaches to filter design, and it very much depends on what you want to achieve with your filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What do you need as a low pass filter? Is it important to have linear phase?&lt;/li&gt;&#xA;&lt;li&gt;Is it going to be narrow, or wide? (i.e. is the stopband bigger or smaller than half of the input bandwidth)&lt;/li&gt;&#xA;&lt;li&gt;Is it going to be implemented in hard- or software?&lt;/li&gt;&#xA;&lt;li&gt;What about numerical precision? If software: fixed or floating point? SIMD'ability? Enforcing linear phase to be able to exploit coefficient symmetry?&lt;/li&gt;&#xA;&lt;li&gt;What's more important:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Passband ripple?&lt;/li&gt;&#xA;&lt;li&gt;strength of the strongest sidelobe?&lt;/li&gt;&#xA;&lt;li&gt;Cumulative stopband power leakage?&lt;/li&gt;&#xA;&lt;li&gt;Maximum steepness for given length?&lt;/li&gt;&#xA;&lt;li&gt;Numerical stability (i.e. well-conditioned taps)?&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, assuming you &quot;just&quot; want a FIR for usage with e.g. Python, you go ahead and use your favourite scientific/signal processing toolkit, and use one of the many window design methods. Often, things will get automatically chosen correctly for you. In essence, &lt;code&gt;scipy&lt;/code&gt; has an extensive documentation on its filter design routines, and I urge you to look at that.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-20T11:02:05.280" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28362" PostTypeId="2" ParentId="28356" CreationDate="2016-01-20T11:41:49.017" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I would like to make a script that will, from one input sample, generate all samples for each pitch/note (do re mi...). What is the algorithm for doing that?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's different algorithms that can do what you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's say, you got a got that emits a known pitch, C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;C has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Piano_key_frequencies&quot; rel=&quot;nofollow&quot;&gt;certain frequency on the usual tone scales&lt;/a&gt;, 261.626Hz. You want to pitch it up one octave? sure, just double that frequency. You can do that rather easily by multiplying your goat sample with a 261....Hz tone. Now, downside of that is that, for example, a low-frequency hum at 50Hz present in the original sample will suddenly be present as a 311Hz tone -- and clearly disturbing your audio perception. Also, for pitches, not only the fundamental tone, but also the harmonics, i.e. the multiples of the fundamental, are important. Now, the harmonics of 261.6Hz are $2\cdot,3\cdot,4\cdot,\dots\cdot 261.6Hz$, whereas the harmonics of 623.2Hz (=c) are $2\cdot,3\cdot,4\cdot,\dots\cdot 523.2Hz$. However, by shifting both the fundamental and its harmonics up by 261.6Hz, you end up with $1.5\cdot,2\cdot,2.5\cdot,3\cdot,3.5\cdot,\dots\cdot 523.2Hz$, which will sound strange. So that's not really a solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another solution that &quot;doubles&quot; &lt;em&gt;all&lt;/em&gt; the frequencies is just what happens when you play an LP record at twice the speed it should be played; digitally, you can achieve that by decimation of the original signal. Now, if you play that goat record at twice the speed, it will only be half as long. So that's not the whole solution either. Notice how when you listen to heavily autotuned songs like &lt;a href=&quot;https://www.youtube.com/watch?v=_Z1Krfww5eE&quot; rel=&quot;nofollow&quot;&gt;Dayum&lt;/a&gt; you seem to be able to hear some kind of &quot;vibrato&quot; in the longer-stretched high pitched tones?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that autotune algorithms try to first convert the tone to the desired frequency (possibly through frequency, or cepstrum transformations), and then match the original tone duration, which leads to periodicity of $\frac{\text{original length}}{\text{in/out frequency ration}}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this is a complex topic, and there's not a single solution to the problem -- after all, music &lt;strong&gt;is&lt;/strong&gt; art, and to me all the autotune pop/house sounds terrible exactly because of this &quot;mechanical&quot; vibrato. Other folks really like that; it's a question of taste and preference. I'd say: get a well-trained goat. Make it emit a few different sounds. Analyze the sounds. Understand how a goat sound works: What's its start/cadence? How does the signal look like if the goat gives you a long C, compared with a short C? Can you manually make the C longer by copy&amp;amp;pasting without sounding awkward? Then, you might have a chance of making an aesthetically pleasing &lt;em&gt;goatophone&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-20T11:41:49.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28364" PostTypeId="1" AcceptedAnswerId="28370" CreationDate="2016-01-20T14:17:04.770" Score="0" ViewCount="258" Body="&lt;p&gt;Hi everybody i'm a student. Yesterday i had a test about my Engineering subject about signal processing and there was this problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You have the sequence $x(n) = N+1 - |n|$. With $|n|\leq N.$ Determine the $\mathcal{Z}$-transformation of the signal and the fourier transformation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm going mad, me and my colleagues feel to miss something, each way we try gets us drowning in calculations...&lt;/p&gt;&#xA;" OwnerUserId="19155" LastEditorUserId="19155" LastEditDate="2016-01-20T18:28:25.067" LastActivityDate="2016-01-20T18:28:25.067" Title="Z-transformation" Tags="|fourier-transform|z-transform|self-study|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28366" PostTypeId="1" CreationDate="2016-01-20T14:23:41.830" Score="0" ViewCount="60" Body="&lt;p&gt;Is it when the cost function such as the error signal or Mean Square Error (MSE) signal is minimised?&lt;/p&gt;&#xA;" OwnerUserId="19156" LastActivityDate="2016-01-20T20:42:27.067" Title="How is it determined that an adaptive filter has converged?" Tags="|adaptive-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28367" PostTypeId="1" CreationDate="2016-01-20T14:39:51.120" Score="1" ViewCount="204" Body="&lt;p&gt;I wonder if every time series data should contain noise or not. For example I am taking the price of a ticker, say Yahoo, every hour and noting the values. Does this data contains noise or not? &lt;/p&gt;&#xA;" OwnerUserId="19157" LastEditorUserId="15892" LastEditDate="2016-01-21T06:37:35.060" LastActivityDate="2016-01-21T08:02:36.743" Title="Are time series data always contain noise?" Tags="|noise|aliasing|quantization|time-series|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28368" PostTypeId="1" AcceptedAnswerId="28369" CreationDate="2016-01-20T15:00:14.557" Score="2" ViewCount="1384" Body="&lt;p&gt;We are capturing data using a PX14400 adc.  The samples are 16bit unsigned integer, 200M samples/sec, I data only.  100MHz bandwith.  We have a cw signal at 51MHz, -11.4dBm.  The -11.4dBm is measured by a power meter so that includes all losses right before being digitized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 1:  when I apply a blackman harris 4 term window, the fft data calculates to -14dBm which sounds reasonable since bh loss is about 3dB, however when I dont apply the window the fft data calculates to -5.3dBm.  I would have expected a 3dB jump, not almost 9.  Why the large jump?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2:  Does anything jump out in the code below that might be off in my calculations.  For brevity not all the code is shown (threads, board init, etc).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Initialzied elsewhere in the class&#xA;const int fftSize = 8192;         // size of the fft&#xA;complex&amp;lt;double&amp;gt; array[fftSize];   // array of complex (r+i)...used post fft&#xA;double dData[fftSize];            // array of doubles, used pre and post fft&#xA;fftPlan = fftw_plan_dft_r2c_1d(fftSize, dData, reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(array), FFTW_ESTIMATE);&#xA;&#xA;void processNewBuff(uint16_t *rawdata) {&#xA;&#xA;        // convert the samples to V.  This formula is provided by the vendor&#xA;        // dData is an array containing the converted to V data (double)&#xA;        // rawdata is an array containing the initial adc counts&#xA;        // since we only fft the first 8192 values, we effectively throw out the rest of the data&#xA;        // we skip the rest of the 10ms sample (200MS/s * .01 = 2MB sample, 8192 is processed the rest is discarded&#xA;        double dInputRange = .220;&#xA;        for (int x=0; x&amp;lt;fftSize; x++) {&#xA;            dData[x] = (-dInputRange)/2 + ((rawdata[x]/65532) * dInputRange);&#xA;        }&#xA;&#xA;        // apply blackmanHarris&#xA;//        double bhtmp;&#xA;//        for (int x=0; x&amp;lt;fftSize; x++) {&#xA;//            bhtmp = (double)(2 * 3.1415 * x / fftSize);&#xA;//            dData[x] *=(double)(0.35875 - (0.48829*cos(bhtmp)) + (0.14128 * cos(2*bhtmp)) - (0.01168*cos(3*bhtmp)));&#xA;//        }&#xA;&#xA;        // do the fft.  fftPlan is a &quot;fftw_plan_dft_r2c_1d&quot;, discreet fourier transform, real 2 complex&#xA;        // see: http://www.fftw.org/doc/Real_002ddata-DFTs.html&#xA;        // after the fft, we throw away the upper half of the fft since we only started with 'I' data&#xA;        fftw_execute(fftPlan);&#xA;&#xA;        // normalize the fft for power&#xA;        for (unsigned int x = 0; x &amp;lt;(fftSize/2); x++)&#xA;            array[x] = array[x] / complex&amp;lt;double&amp;gt;(fftSize, 0);&#xA;&#xA;        // convert the fft to power spectrum&#xA;        // I have this separated into 3 distinct lines for readability, final code will be all in a single line&#xA;        for (unsigned int x = 0; x &amp;lt;(fftSize/2); x++) {&#xA;                dData[x] = sqrt(real( array[x] * conj(array[x]) ));&#xA;                dData[x] = ((dData[x]) / 50) * 1000;     // convert to W, then mW&#xA;                dData[x] = (20 * log10(dData[x]));&#xA;        }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19142" LastActivityDate="2016-01-20T17:54:34.207" Title="removal of blackman harris window results in signal higher than expected" Tags="|fft|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28369" PostTypeId="2" ParentId="28368" CreationDate="2016-01-20T15:47:39.340" Score="6" Body="&lt;p&gt;The reason for that is that you don't normalize the DFT samples properly. Dividing by number of samples in time domain is valid only for Rectangular Window. For simple case of DFT, you should divide your amplitude by sum of window samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S=\sum_{i=0}^{N-1}w_i $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This for Rectangular Window will be obviously equal to $N$ ($8192$ in your case), whereas for Blackman-Harris Window it's about $2939$, therefore the Coherent Gain is about $0.36$ instead of $1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reading more about this interesting topic I recommend you these papers (especially the first one):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://holometer.fnal.gov/GH_FFT.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;G. Heinzel et al&lt;/em&gt; - Spectrum and spectral density estimation by the&#xA;  DFT, including a comprehensive list of window functions and some new&#xA;  flat-top windows&lt;/a&gt; - &lt;strong&gt;especially chapter 9&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;F. J. Harris&lt;/em&gt; - On the Use of Windows for Harmonic Analysis with the&#xA;  Discrete Fourier&#xA;  Transform&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2016-01-20T17:54:34.207" LastActivityDate="2016-01-20T17:54:34.207" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28370" PostTypeId="2" ParentId="28364" CreationDate="2016-01-20T16:35:07.050" Score="1" Body="&lt;p&gt;You're a student, so I'll try to help you figure out the solution by yourself. Make sure you understand the following points:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The signal is a triangle of length $2N+1$.&lt;/li&gt;&#xA;&lt;li&gt;A triangular sequence can be written as the convolution of two even more basic sequences, each of length $N+1$.&lt;/li&gt;&#xA;&lt;li&gt;Convolution in the time domain corresponds to multiplication of the $\mathcal{Z}$-transforms.&lt;/li&gt;&#xA;&lt;li&gt;Define the basic signal determined in point 2. in the interval $0\le n\le N$ and compute its $\mathcal{Z}$-transform.&lt;/li&gt;&#xA;&lt;li&gt;Take the square of that $\mathcal{Z}$-transform, which gives you the $\mathcal{Z}$-transform of a triangle in the range $0\le n\le 2N$.&lt;/li&gt;&#xA;&lt;li&gt;In order to get the transform of $x[n]$, you need to shift the triangle to the left by $N$, which corresponds to a multiplication by $z^N$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you did everything right, the resulting $\mathcal{Z}$-transform should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z)=\left(\frac{1-z^{N+1}}{1-z^{-1}}\right)^2z^N\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You obtain the Fourier transform by substituting $z=e^{j\omega}$ in $(1)$. Note that the result must be real-valued due to the symmetry of $x[n]$. I leave the intermediate steps up to you, but your solution should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(e^{j\omega})=\left(\frac{\sin\left(\frac{(N+1)\omega}{2}\right)}{\sin\left(\frac{\omega}{2}\right)}\right)^2\tag{2}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-20T17:29:17.310" LastActivityDate="2016-01-20T17:29:17.310" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28371" PostTypeId="2" ParentId="28367" CreationDate="2016-01-20T16:49:29.013" Score="1" Body="&lt;p&gt;Periodically taken ticker data is very likely not a set of samples of a band-limited function, thus can contain aliasing artifacts which can be considered noise.  This is possibly a much larger contribution than quantization and time jitter noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Absence of noise requires the existence of well defined signal being measured.  Proving that such a signal really exists is a separate and likely far more difficult problem for some types of time series.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-21T02:25:20.527" LastActivityDate="2016-01-21T02:25:20.527" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28372" PostTypeId="2" ParentId="28356" CreationDate="2016-01-20T17:07:46.443" Score="1" Body="&lt;p&gt;One generic term for the class of libraries and algorithms that do this, make a set of music keyboard notes from random (psuedo-periodic) pitched sounds, is &quot;time pitch modification&quot;.  This is sometimes accomplished by frequency domain phase vocoder analysis-resynthesis or by time domain synchronized overlap-add, followed by filtered resampling.  One example library might be Apple's OS X AVAudioUnitTimePitch effect unit.  Here's a wikipedia page on the topic: &lt;a href=&quot;https://en.wikipedia.org/wiki/Audio_time-scale/pitch_modification&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Audio_time-scale/pitch_modification&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you might have to use a pitch estimation algorithm to determine a perceived pitch for the original sound sample.  Here's a wikipedia page summarizing some of these methods: &lt;a href=&quot;https://en.wikipedia.org/wiki/Pitch_detection_algorithm&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Pitch_detection_algorithm&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-21T02:07:23.500" LastActivityDate="2016-01-21T02:07:23.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28373" PostTypeId="1" CreationDate="2016-01-20T19:10:58.740" Score="0" ViewCount="453" Body="&lt;p&gt;I use a Discrete Fourier Transform to have a representation in the frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BWqF0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BWqF0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that, both the real and the imaginary line are softly reaching zero on the left, from 0.5 Hz to 0 Hz. This is a right function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subsequently, I wish to multiply the above complex frequency function with another frequency function: DFT*TF, where TF is in the form &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VCQza.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VCQza.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result appears an undesired shift of the imaginary line (and of the module, as a consequence) instead of the previously observed reduction to zero of the above mentioned lines. This shift is a problem because of causing wrong results to the following signal processes.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How could we give a theoretical explanation what kind of problem it is and what have been so far explained about such cases? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We may say that it happens due to the boundary conditions of zero out of the sampling period (the interval I apply the DFT is from 0 to 2047 sampling points, I plot only the part from 0 to 3.5 Hz below) and drives to this shift (see on the left) which is an aliasing error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bVxxu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bVxxu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Have you ever heard something about such a case?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A practical explanation I could give to this is that, we cannot avoid this phenomenon when multiplying two complex numbers (functions herein) where the imaginary part of (at least) one of them is reduced to zero and is low but not lower than the real part reduction to zero. For example, see below I attach indicative arithmetical values for which the first seven imaginary parts, being a little larger than the real ones, causes a great problem in the following methodology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nLzYI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nLzYI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correction I thought is to process the imaginary parts and reduce them to values at least equal to the real ones. Then all the following results works right !&#xA;Well, I 've tried this process and works but I cannot be sure myself before asking the experience of others.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What do you think? Could you please indicate me something from books or a useful link?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19163" LastEditorUserId="13320" LastEditDate="2016-11-21T13:13:17.587" LastActivityDate="2018-06-15T06:47:23.660" Title="Is this a kind of aliasing error and how to make correction?" Tags="|discrete-signals|fourier-transform|aliasing|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28374" PostTypeId="2" ParentId="28373" CreationDate="2016-01-20T19:35:17.810" Score="1" Body="&lt;p&gt;Complex multiplication dictates that even a complex series with a disappearing imaginary when multiplied with a complex number:&#xA;let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;z_n &amp;amp;= a_n + i\cdot b_n,\quad a_n, b_n \in \mathbb{R}\\&#xA;&amp;amp;\text{then}\\&#xA; z_1 \cdot z_2 &amp;amp;= a_1\cdot a_2+a_1\cdot ib_2+ ib_1 \cdot ia_2 + ib_1\cdot ib_2\\&#xA;&amp;amp;=(a_1a_2-b_1b_2) + (a_1b_2+a_2b_1)i\\&#xA;&amp;amp;\text{let }b_1\equiv0\\&#xA;&amp;amp;=(a_1a_2-b_1b_2) + ({a_1b_2})i&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and hence, the imaginary part of $z_1$ multiplied with a complex number is not inherently zero, just because the imaginary part of $z_1$ is zero.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-20T19:35:17.810" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28375" PostTypeId="2" ParentId="28366" CreationDate="2016-01-20T20:42:27.067" Score="2" Body="&lt;p&gt;The adaptive filter is converged when the error is what they call Wide Sense Stationary, meaning the mean and variance of the error are unchanging over long time intervals.&lt;/p&gt;&#xA;" OwnerUserId="16238" LastActivityDate="2016-01-20T20:42:27.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28377" PostTypeId="1" CreationDate="2016-01-20T22:26:42.240" Score="2" ViewCount="369" Body="&lt;p&gt;I want to find repeating structures from the image .But I have no idea how to do it.Please help me.Actually i want to find how many lines and oval shapes look like similar and mark these by separate color.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Olczj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Olczj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19166" LastEditorUserId="19166" LastEditDate="2016-01-21T14:37:34.673" LastActivityDate="2016-01-23T17:03:38.987" Title="Extract repeating structure from an image" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28378" PostTypeId="2" ParentId="2404" CreationDate="2016-01-21T01:21:19.317" Score="0" Body="&lt;p&gt;It is not like that it will work only for sparse signals, but you have find the domain in which the signal is nearly sparse (All naturally occurring signals will be sparse in some domain,except for random noise).In some domain the signal can be approximated with fewer measurements, all other measurements will be relatively small so you can safety discard them.&lt;/p&gt;&#xA;" OwnerUserId="17018" LastActivityDate="2016-01-21T01:21:19.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28379" PostTypeId="2" ParentId="22839" CreationDate="2016-01-21T01:30:35.697" Score="1" Body="&lt;p&gt;An easiest way I would recommend is (provided your data set is small or you are working frame by frame) just do transformation(wave let/Forier) and count the number of non zeros. Matlab does this by using the command nnz(). &lt;/p&gt;&#xA;" OwnerUserId="17018" LastActivityDate="2016-01-21T01:30:35.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28380" PostTypeId="2" ParentId="18354" CreationDate="2016-01-21T05:10:31.270" Score="1" Body="&lt;p&gt;Adaptive filters could be used in situations where you have a reference signal, what adaptive filters basically do is to try modelling the signal that is present in captured signal using reference signal. So, we can subtract and/or extract the required signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the situation mentioned in question, you can use adaptive filter if you have reference for either the signal you are interested in or the noise you want to remove. If you have the noise signal as reference adaptive filters will remove the required signal(signal of interest) from input and only noise will be remaining, now this noise can be subtracted from original input signal to get the required signal(signal of interest).        &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same could be done if signal of interest is present as a reference, but in this case the adaptive filters output will be the required output.&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-01-21T05:10:31.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28381" PostTypeId="1" AcceptedAnswerId="28396" CreationDate="2016-01-21T06:32:26.473" Score="6" ViewCount="1874" Body="&lt;h2&gt;Prelude&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I am writing an elaborate text on the relationship between the real and imaginary parts of a LTI causal system and how &lt;em&gt;stability&lt;/em&gt;, &lt;em&gt;causality&lt;/em&gt; and &lt;em&gt;analyticity&lt;/em&gt; imposes various constraints on its magnitude response and the phase response. I am trying to explain three topics &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Kramers Kronig Relationship&lt;/li&gt;&#xA;&lt;li&gt;Bode's Gain-Phase Relationship&lt;/li&gt;&#xA;&lt;li&gt;Hilbert Transform relationship&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And finally, explain the connection between the three and their practical implications. This, I feel, is a much-needed text for people like me entering into this field. I have a list of questions, which I feel must come under the same context - please be patient in answering and kind enough to point out any mistakes.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Questions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The text, &lt;a href=&quot;http://arxiv.org/pdf/1107.0071&quot; rel=&quot;noreferrer&quot;&gt;Kramers–Kronig Bode and the meaning of zero&lt;/a&gt; by John Bechhoefe, provides a short derivation of the gain-phase relation.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the motivation behind taking the logarithm of the response function in deriving the gain-phase relation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kramers Kronig (KK) relation requires only a &lt;em&gt;causal&lt;/em&gt; system (&lt;em&gt;analytic&lt;/em&gt; in the upper half of the complex $\omega$-plane) and does not talk about stability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Bode's Gain Phase relation requires a &lt;em&gt;minimum phase system&lt;/em&gt; with no zeroes in the upper half of the complex $\omega$-plane and for &lt;em&gt;non-minimum phase&lt;/em&gt; it becomes an inequality. In other words, Bode's Gain-Phase relationship necessitates that the response function &lt;strong&gt;must&lt;/strong&gt; obey KK relations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;So, is the Gain-Phase relation a special case of KK relations accounting for stability too?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Causality in time domain implies analyticity in frequency domain, vice-versa&lt;/em&gt;.  Is my statement true?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How are Hilbert transform relationship and KK relationship related?&#xA;By Hilbert Transform relationship I mean the following (for a discrete case):&#xA;$$ H_{Im}(\omega)=-\frac{1}{2\pi}\int_{-\pi}^\pi H_{Re}(\lambda)\cot(\frac{\omega-\lambda}{2})d\lambda. $$&#xA;For a given response function $H(\omega)=H_{Re}(\omega) +j H_{Im}(\omega)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do these relationships extend to higher dimensions? (for images and videos).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you for your patience.&lt;/p&gt;&#xA;" OwnerUserId="17556" LastEditorUserId="11256" LastEditDate="2016-01-21T16:00:00.670" LastActivityDate="2018-10-08T15:00:13.763" Title="Relationship between the Real and Imaginary parts of a LTI causal system" Tags="|frequency-spectrum|frequency-response|transfer-function|hilbert-transform|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28382" PostTypeId="2" ParentId="28367" CreationDate="2016-01-21T07:09:57.017" Score="1" Body="&lt;p&gt;A huge yes. Perhaps stated in another way, due  to the stochasticity, you can never be certain in practice that there is absolutely no noise in your  data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The timing at which you sample (almost periodic,  every hour) might subject to small uncertainties (whether you do it by hand or by an automatic request).  There is no infinite sampling precision. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noting the values (do you note it by hand, actually?) is subject to perception and one can write figures noon accurately, forget a comma. Change $3.14$ as $31.4$ and you get a spurious peak on your time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those are &quot;copy or retrieval&quot; noises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @hotpaw2 said, aliasing is a type of noise that occurs when converting a seemingly continuous data into a discrete one. It is  worth pointing out (I have heard &quot;I sample this day every 24 hour, so I have no noise&quot;. Actually, an irregular sampling might help in the  case of a non band-limited signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you have almost the same issues with what Yahoo, considered here as a sensor, does. How long does it hold values? Sometimes free information is delivered at a slower pace than when it is paid? How does it round it? Does it smooth it over $3$ seconds? Moreover, does Yahoo always  perform these actions in the same manner? In other words, is your signal seem stationary, or time invariant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those are system/sensor noises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you take a price for a specific goal. It is a quantity that can be observed, that you may use to model a certain &quot;real word&quot; behavior. There might  be events in the data that are &quot;noises&quot; for your purpose (slow trends, seasonality).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is important is how those combined noises affect your modeling and processing.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="498" LastEditDate="2016-01-21T08:02:36.743" LastActivityDate="2016-01-21T08:02:36.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28383" PostTypeId="1" AcceptedAnswerId="28384" CreationDate="2016-01-21T07:52:30.280" Score="1" ViewCount="1542" Body="&lt;p&gt;In GNURADIO when &lt;code&gt;RTL-SDR Source&lt;/code&gt; block is placed there is a parameter &lt;code&gt;Sample Rate (sps)&lt;/code&gt; and &lt;code&gt;Channel frequency&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can put there for example 32kHz into &lt;code&gt;Sample rate&lt;/code&gt; and 107.5MHz into &lt;code&gt;Channel frequency&lt;/code&gt; to tune some FM station in my location. FFT block shows a signal of that station in a correct frequency as shown on the picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FC7XJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FC7XJ.png&quot; alt=&quot;GNU Radio&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But according to Nyquist–Shannon sampling theorem, &lt;code&gt;Sample rate&lt;/code&gt; should be at least 2 times higher than signal frequency, so in this situation I should set at least 215MHz into &lt;code&gt;Sample rate&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why can I set much lower sampling frequency of a signal and it still looks correctly?&lt;/p&gt;&#xA;" OwnerUserId="7743" LastEditorUserId="7743" LastEditDate="2017-09-04T15:10:29.000" LastActivityDate="2017-09-04T15:10:29.000" Title="Sampling frequency lower than half of sampled signal frequency?" Tags="|sampling|nyquist|software-defined-radio|gnuradio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28384" PostTypeId="2" ParentId="28383" CreationDate="2016-01-21T08:18:27.040" Score="5" Body="&lt;p&gt;The channel frequency controls the local oscillator on your SDR which is the frequency &lt;em&gt;about&lt;/em&gt; which it covers.  So you are receiving signals from 16KHz below 107.5MHz to 16KHz above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The concept you want to look up is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Heterodyne&quot; rel=&quot;noreferrer&quot;&gt;heterodyning&lt;/a&gt;.  When you modulate (multiply) a signal by a sine wave you end up with two copies shifted in frequency space by the frequency of the sine wave.  So in your case, you've told the local oscillator to run at 107.5MHz which shifts the 107.5MHz carrier from the radio tower to 0Hz and to 215MHz though the high frequency version gets cut off by the low pass filter in your radio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in the math then if we want to shift a complex signal $X(t)$ by a frequency of $f$ we multiply by $e^{2\pi f i t}$.  $i\sin(2\pi f t) = e^{2\pi f i t } - e^{-2\pi f i t}$ where $i = \sqrt{-1}$.  So multiplying by $i\sin(2\pi f t)$ gives $X(t)i\sin(2\pi f t) = e^{2\pi f i t}X(t) - e^{-2\pi f i t}X(t)$ which is where the two copies come from.  (The multiplication by $i$ in, e.g., $i\sin(2\pi f t)$ ultimately just adds a $90^\circ$ phase shift.)&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-01-21T08:18:27.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28385" PostTypeId="1" CreationDate="2016-01-21T08:44:08.620" Score="2" ViewCount="206" Body="&lt;p&gt;I have asked the question in the following link: &lt;a href=&quot;https://dsp.stackexchange.com/questions/28367/are-time-series-data-always-contain-noise&quot;&gt;Are time series data always contain noise?&lt;/a&gt;&#xA;I wonder if we could use variational methods to denoise the time series data just as in computer vision? &#xA;Thanks in advance...&lt;/p&gt;&#xA;" OwnerUserId="19157" LastActivityDate="2016-01-21T11:54:03.247" Title="How the noise in time series can be reduced?" Tags="|computer-vision|noise|time-series|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28386" PostTypeId="2" ParentId="28383" CreationDate="2016-01-21T08:46:52.217" Score="2" Body="&lt;p&gt;I believe that what you are looking for is &lt;a href=&quot;https://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow&quot;&gt;Bandpass Sampling&lt;/a&gt;. What Nyquist theorem says is that your sampling frequency must twice the &lt;strong&gt;bandwidth&lt;/strong&gt; of your signal - not carrier frequency of it. Hence in FM modulated signals you don't need to take it into consideration.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-01-21T08:46:52.217" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28387" PostTypeId="2" ParentId="28385" CreationDate="2016-01-21T09:06:07.473" Score="2" Body="&lt;p&gt;Yes indeed, there is a huge body of works on the topic of variational methods for signal restoration (more general than denoising), one example being &lt;a href=&quot;https://en.wikipedia.org/wiki/Total_variation_denoising#Mathematical_exposition_for_1D_digital_signals&quot; rel=&quot;nofollow&quot;&gt;total variation denoising&lt;/a&gt;, or &lt;a href=&quot;http://arxiv.org/pdf/0912.3522&quot; rel=&quot;nofollow&quot;&gt;proximal methods&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can be more specific, you could get more accurate and precise answers.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-01-21T11:54:03.247" LastActivityDate="2016-01-21T11:54:03.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28388" PostTypeId="1" AcceptedAnswerId="28394" CreationDate="2016-01-21T09:24:07.183" Score="1" ViewCount="408" Body="&lt;p&gt;I have a question about measuring precision of chromatic tuners.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to divide 2 cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CASE1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.korg.de/uploads/tx_softwarecenter/KORG_AW2_G_Handbuch.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link; Korg AW-2G's precision&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CRTDI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CRTDI.png&quot; alt=&quot;precision&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you check the link or this picture, it says that&#xA;Korg AW-2G has the precision of +/- 1 cent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the way or measurement to get this result (+/- 1 cent)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CASE2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are people using Arduino (ATMEL328 MCU) with microphone or piezoelectric diaphragm for the ADC input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One blog introduced the autocorrelation method&#xA;for detecting the instrument's pitch.&#xA;After calculating autocorrelation, using parabolic interpolation gives&#xA;&quot;accurate&quot; results. (This is not sarcasm, don't get me wrong. :D)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I made a chromatic tuner using ATMEL328 and a piezoelectric diaphragm.&#xA;Also, suppose I chose sampling rate 9240 Hz, 512 samples, the autocorrelation method (with parabolic interpolation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, how should I define the precision of this chromatic tuner?&#xA;I can't buy tuning forks to compare the results.&#xA;Let's suppose I'm testing with electrical guitar, classical guitar, and violin.&#xA;So any ideas?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Best Regards~&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19172" LastEditorUserId="19172" LastEditDate="2016-01-22T13:06:42.847" LastActivityDate="2016-01-22T13:06:42.847" Title="The way to measure chromatic tuners' precision" Tags="|autocorrelation|pitch|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="28389" PostTypeId="1" AcceptedAnswerId="28390" CreationDate="2016-01-21T10:13:19.207" Score="0" ViewCount="571" Body="&lt;p&gt;A vanilla &lt;a href=&quot;http://www.bzarg.com/p/how-a-kalman-filter-works-in-pictures/&quot; rel=&quot;nofollow&quot;&gt;Kalman Filter&lt;/a&gt; allows for a &lt;em&gt;time varying&lt;/em&gt; observation matrix $H_k$. Is it allowable for $H_k$ to be a function of the system state $x_k$ in a vanilla Kalman filter? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, am I correct that this is not allowed in the vanilla Kalman filter? If it is allowed, then I don't understand how measurements would then act to correct the parameters of $x$ that predict them via $H_k$. I'd appreciate a more explicit description of this than my own hunch though!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, am I correct that the Extended Kalman Filter &amp;amp; the Unscented Kalman Filter &lt;em&gt;do explicitly allow&lt;/em&gt; for this situation? If I am, do these filters allow observations to correct the terms of $x$ that are predicting them?&lt;/p&gt;&#xA;" OwnerUserId="12213" LastEditorUserId="12213" LastEditDate="2016-01-21T10:33:51.753" LastActivityDate="2016-01-21T11:27:22.877" Title="Can a (vanilla) Kalman Filter's Observation Matrix $H_k$ depend on the state vector $x_k$?" Tags="|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28390" PostTypeId="2" ParentId="28389" CreationDate="2016-01-21T11:27:22.877" Score="2" Body="&lt;p&gt;The non-linear system model that the unscented and extended Kalman filters work with (omitting control) is the following:&#xA;$$x_{k+1} = F(k, x_k, v_k) \\ y_k = H(k, x_k, n_k)$$&#xA;where $F$ is the state transition function and $H$ is the observation function.  The linear Kalman filter is just the special case where $F$ and $H$ have the form:&#xA;$$ F(k, x, v) = A_k x + v \\ H(k, x, n) = B_k x + n$$ for sequences of matrices $A_k$ and $B_k$.  In particular, the functions $F$ and $H$ are linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is a bit of a pedantic distinction (particularly in the non-linear case) but while the expression $F(k, x_k, v_k)$ clearly depends on $x_k$, the function $F$ &lt;em&gt;itself&lt;/em&gt; does not.  In the non-linear case this is no limitation.  In the linear case, if the matrix $B_k$ depended $x_k$ then the function $H$ would no longer be linear.&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-01-21T11:27:22.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28391" PostTypeId="1" CreationDate="2016-01-21T12:40:45.327" Score="1" ViewCount="334" Body="&lt;p&gt;I read some papers about fast normalized cross-correlation techniques. Most of them are used to identify a template in an original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was not able to find information about input-data in a stream-based fashion:&#xA;Assume, that there are two audio signals &lt;strong&gt;a&lt;/strong&gt; and &lt;strong&gt;b&lt;/strong&gt; both of the same length. Now, I want to find the position where both signals are best aligned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should possible to use normalized cross-correlation to calculate this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Example (1):&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;a&lt;/strong&gt; = {1,2,3,4}; &lt;strong&gt;b&lt;/strong&gt; = {1,2,3,4}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using normalized cross-correlation the result is given as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;{-1.8, 1.2, 1, 4, 1, 1.2, -1.8}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let us assume that the signals will be extended, but we have a fixed queue-size for &lt;strong&gt;a&lt;/strong&gt; and &lt;strong&gt;b&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Example (2):&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;a&lt;/strong&gt; = {2,3,4,7}; &lt;strong&gt;b&lt;/strong&gt; = {2,3,4,4}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, we use normalized cross-correlation to get our results: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;{-0.967, -1.450, -0.161, 3.223, 2.256, -0.483, -2.417}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalized cross-correlation makes use of mean and variance of &lt;strong&gt;a&lt;/strong&gt; and &lt;strong&gt;b&lt;/strong&gt; and for me it seems, that there is no option to get a stream-based version of the normalized cross-correlation without recalculate the complete normalized cross-correlation. For sure, variance and mean can be calculated in a stream-based fashion.&#xA;$$&#xA;\frac{1}{n} \sum \frac{(f(x,y)- \overline{f})(t(x,y)- \overline{t}) }{\sigma_{f}\sigma_{t}}&#xA;$$&#xA;Is it correct, that because of each calculation consists of mean and variance, it is not possible to have a stream-based normalized cross-correlation, because they change if &lt;strong&gt;a&lt;/strong&gt; and &lt;strong&gt;b&lt;/strong&gt; change?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be happy to have a great discussion about this.&lt;/p&gt;&#xA;" OwnerUserId="19174" LastActivityDate="2016-01-21T12:40:45.327" Title="Fast Normalized Cross-Correlation for Stream-Data" Tags="|cross-correlation|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28392" PostTypeId="1" CreationDate="2016-01-21T14:09:32.210" Score="0" ViewCount="2361" Body="&lt;p&gt;I have a signal that is sampled at $20 \mathrm{Hz}$. It has almost stationary behavior, with a main frequency around $1\ \mathrm{Hz}-1.5 \ \mathrm{Hz}$. This frequency range is to be expected and is of interest for further processing.  Unfortunately, I don't know the noise present at the signal in order to calculate the SNR of the signal as a way of assessing its quality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking that since I know a priori the frequency range of the fundamental frequency of interest that should exist in the signal, I could calculate the SNR based on the power spectral density (PSD) of the signal. Moreover, after PSD calculation using Welch's method, I could integrate within a frequency range that corresponds to my main frequency (assuming that within this frequency range there is one main lobe) and divide that to the integration of the rest of the calculated spectrum as an SNR metric: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathrm{SNR}_\textrm{metric}=\frac{\int_{n_{f_1}}^{n_{f_2}}p_{xx}(n)*f(n)dn}{\int_{n_\textrm{f=0}}^{n_{f=f_1}}p_{xx}(n)*f(n)dn + \int_{n_{f=f2}}^{n_{f=\textrm{flast}}}p_{xx}(n)*f(n)dn}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $p_{xx}$ the PSD, $f(n)$ the corresponding frequencies vector based on Welch's PSD calculation method, $n$ is the index of the frequencies and $f_1$, $f_2$ is the bandwidth at the PSD that surrounds the fundamental peak of the frequency of interest that should be around 1.0 to 1.5 Hz when the lobe attenuates completely.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Would you consider this approach valid and why?&lt;/li&gt;&#xA;&lt;li&gt;If you have advice for a different method to calculate the SNR let me know!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would like to thank everyone in advance.&lt;/p&gt;&#xA;" OwnerUserId="19179" LastEditorUserId="19249" LastEditDate="2017-02-15T08:54:12.560" LastActivityDate="2017-02-15T08:54:12.560" Title="Calculating the SNR from the power spectrum. Is my suggestion relevant?" Tags="|power-spectral-density|snr|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28393" PostTypeId="2" ParentId="1626" CreationDate="2016-01-21T14:58:19.393" Score="-4" Body="&lt;p&gt;For your own implementation see:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.emt.tugraz.at/publications/diplomarbeiten/da_hoebenreich/node21.html#fig:StateSpaceDiagram&quot; rel=&quot;nofollow&quot;&gt;http://www.emt.tugraz.at/publications/diplomarbeiten/da_hoebenreich/node21.html#fig:StateSpaceDiagram&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19182" LastActivityDate="2016-01-21T14:58:19.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28394" PostTypeId="2" ParentId="28388" CreationDate="2016-01-21T15:11:45.567" Score="0" Body="&lt;p&gt;Precision and accuracy are 2 different things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 cent is 1/100th of the frequency difference between 2 adjacent semitone pitches in equal temperament tuning.  The frequency ratio is exp(ln(2)/1200) or roughly 1.00059  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Precision of 1 cent might mean the tuner reports frequency error from the nearest semitone in 1 cent units, whether accurate or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To test accuracy, you might want to synthesize test signals that &quot;sound like&quot; your desired instrument (in software, or using a calibrated programmable synthesizer).  Feed those test signal to your tuner (or your tuner's pitch estimation algorithm in a software environment as unit testing).  If the results matches the synthesized pitch to within 0.5 cents, then your accuracy is 1 cent at that frequency.  Vary the test signal (perhaps randomized) to different semitone notes and cent (or cent fraction) offsets over your tuners entire range to find the worst case to evaluate (get a statistical estimate of) your tuners accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can add Gaussian random white noise or recorded typical background room noises to your generated test signals to test measurement precision (repeatability) at realistic S/N ratios as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One &quot;gold standard&quot; is to measure the WWV audio frequencies (500 and 600 Hz), and use those to calibrate your synth and test your tuner.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-21T15:26:29.810" LastActivityDate="2016-01-21T15:26:29.810" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28396" PostTypeId="2" ParentId="28381" CreationDate="2016-01-21T17:54:32.570" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I believe the motivation is to make the math easier. Without the logarithm, you have &lt;span class=&quot;math-container&quot;&gt;$G(\omega)=|G(\omega)|e^{j\angle G(\omega)}$&lt;/span&gt;. By taking the logarithm, you have &lt;span class=&quot;math-container&quot;&gt;$\ln G(\omega)=\ln |G(\omega)|+j\angle G(\omega)$&lt;/span&gt;; by removing the exponential function and turning it into a sum, the relationship between &lt;span class=&quot;math-container&quot;&gt;$|G(\omega)|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\angle G(\omega)$&lt;/span&gt; becomes much easier to handle.&lt;/p&gt;&#xA;&lt;p&gt;KK only requires causality and linearity. Bode is more strict because it also requires no zeros in the upper half of the plane (but make sure to look at note 16 in the paper).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As far as I can see, the value of the real part of the zeros is irrelevant; only their existance matters. So, stability is not really involved in this analysis at all.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The implication (causal -&amp;gt; analytic half plane) is true. I believe the &amp;quot;vice versa&amp;quot; (iff) is only true for stable systems, but I'm not 100% sure.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I don't know the answers to your questions 4 and 5.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-01-21T17:54:32.570" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28399" PostTypeId="1" AcceptedAnswerId="28421" CreationDate="2016-01-21T21:34:40.227" Score="2" ViewCount="2907" Body="&lt;p&gt;After an interesting recent &lt;a href=&quot;https://dsp.stackexchange.com/a/28369/18984&quot;&gt;answer&lt;/a&gt;, I'm doing some research on proper DFT normalization for sinusoidal peak estimation. It's clear that to get the correct amplitude from DFT peaks we need to normalize by the window gain&#xA;\begin{equation}&#xA;S_w \triangleq \sum_{n=0}^{N-1} w[k]&#xA;\end{equation}&#xA;Which becomes $S_w = N$ for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function#Rectangular_window&quot; rel=&quot;nofollow noreferrer&quot;&gt;rect window&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'd like to find some rough demonstration, &lt;em&gt;Harris&lt;/em&gt; has one (see equations 12 and 13 in the article below), &lt;strike&gt;but he chooses the easiest path by making exponentials cancel out.&lt;/strike&gt; &lt;em&gt;Well he actually does a pretty good job, it's me that thought it could be inferred to some more general relation.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the rectangular window I've come up with this.&#xA;Let's say we have a sampled analytic sinusoidal signal $x[n]$, with frequency of $m/N$ cycles per sample (or $m$ cycles in $N$ samples), and compute the DFT $X[k]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;x[n] = A \ e^{j 2\pi m n/N}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;X[k] &amp;amp; = A\sum_{n=0}^{N-1}e^{j \frac{2\pi n}{N} m} e^{-j \frac{2\pi&#xA;  n}{N} k} \\&#xA;\\&#xA;&amp;amp; =  A\sum_{n=0}^{N-1}e^{-j \frac{2\pi n}{N} (k-m)}\notag \\&#xA;\\&#xA;&amp;amp; = A \ \dfrac{1-e^{-j2\pi(k-m)}}{1-e^{-j\frac{2\pi}{N}(k-m)}} \\&#xA;\\&#xA;&amp;amp; = AN\delta \left[ k-m\right]&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta[k]$ is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_delta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker delta&lt;/a&gt;.&#xA;To get the correct amplitude in freq space we need to divide by $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's say we have a windowed signal, let me call it $x[n]$ again&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;x[n] = w[n] \ A \ e^{j 2\pi m n/N}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its transform, again overloading notation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;X[k] = A\sum_{n=0}^{N-1} w[n] e^{-j \frac{2\pi n}{N} (k-m)} &#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here I'm not sure how to proceed, guess the result should be&#xA;$$&#xA;\require{cancel}\cancel{X[k] \overset{?}{=} A \ S_w \ \delta[k-m]}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &lt;em&gt;after some discussion with Robert I believe the previous equation is just wrong. It works for the rectangular window only, while for the other windows the only thing we can say is about the peak $k=m$, which can be easily demonstrated just from the sum.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://holometer.fnal.gov/GH_FFT.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;G. Heinzel et al&lt;/em&gt; - Spectrum and spectral density estimation by the&#xA;  DFT, including a comprehensive list of window functions and some new&#xA;  flat-top windows&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;F. J. Harris&lt;/em&gt; - On the Use of Windows for Harmonic Analysis with the&#xA;  Discrete Fourier&#xA;  Transform&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="18984" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-01-23T15:14:01.203" Title="DFT normalization for amplitude estimation" Tags="|dft|window-functions|peak-detection|amplitude|normalization|" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="28401" PostTypeId="1" CreationDate="2016-01-22T01:23:17.327" Score="2" ViewCount="1156" Body="&lt;p&gt;According to the wikipedia(&lt;a href=&quot;https://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow&quot;&gt;Link&lt;/a&gt;), autocorrelation has two definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In statistics, the definition of the autocorrelation between times $s$ and $t$ is like the following:&#xA;$$\displaystyle R(s,t) = \frac{\mathbb{E}[(X_t-\mu_t)(X_s-\mu_s]}{\sigma_t\sigma_s}$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, in signal processing, the above definition is &lt;strong&gt;often&lt;/strong&gt; used without the normalizaiton.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to digital communication written by Bernard Sklar,&#xA;$$R_x(\tau)=\int_{-\infty}^{\infty}x(t)x(t+\tau)du$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_X(\tau)=\mathbb{E}\{X(t)X(t+\tau)\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where \begin{array}{a}&#xA;\tau &amp;amp; \mbox{ is the difference between } t \mbox{ and }s.\\&#xA;x(t) &amp;amp; \mbox{ is real-valued energy signal.}\\&#xA;X(t) &amp;amp; \mbox{ is a random process. }\end{array}&lt;/p&gt;&#xA;" OwnerUserId="17105" LastEditorUserId="4346" LastEditDate="2016-01-22T05:52:29.113" LastActivityDate="2016-04-21T11:05:30.697" Title="Why is autocorrelation used without normalization in signal processing field?" Tags="|correlation|statistics|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28402" PostTypeId="1" AcceptedAnswerId="28404" CreationDate="2016-01-22T04:05:55.810" Score="1" ViewCount="45" Body="&lt;p&gt;Consider discrete time sinusoids of the form $$x[n] = \cos(\omega n) \ ,$$ where $n$ is an integer. What frequency range of $\omega$ would constitute all the possible sinusoids? I'm thinking that $0\leq\omega&amp;lt;\pi$ would suffice, but my teacher tells me it's $-\pi\leq\omega&amp;lt;\pi$. &lt;/p&gt;&#xA;" OwnerUserId="19190" LastEditorUserId="4346" LastEditDate="2016-01-22T05:45:25.867" LastActivityDate="2016-01-22T05:48:58.757" Title="Frequency range for set of all discrete-time sinusoids" Tags="|discrete-signals|theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28404" PostTypeId="2" ParentId="28402" CreationDate="2016-01-22T05:48:58.757" Score="0" Body="&lt;p&gt;assuming $\omega$ is real, if the form of $x[n]$ is how you've defined it above, your thinking is correct.  doesn't matter if it's $+\omega$ or $-\omega$, the sinusoid behaves exactly the same.  if instead, the sinusoid had form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = e^{j \omega n}  \ ,$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;then your teacher would be correct.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-01-22T05:48:58.757" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28405" PostTypeId="2" ParentId="28401" CreationDate="2016-01-22T06:16:58.813" Score="0" Body="&lt;p&gt;Usually such operation are made as &quot;filtering&quot; technique to improve signal to noise ratio. a threshold than is set to derive probability of detection given a certain false alarm rate. These two probabilities are not impacted by the scaling of the two signals - thus the normalization is nor required and the processing associated with it is saved.&lt;/p&gt;&#xA;" OwnerUserId="14988" LastActivityDate="2016-01-22T06:16:58.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28410" PostTypeId="2" ParentId="23681" CreationDate="2016-01-22T10:30:40.123" Score="1" Body="&lt;p&gt;Assuming that you do not need to beat-to-beat information on the EKG morphology, which would be subject signficant noise anyway, one approach would be ensemble averaging on the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the heart rhythm has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Vagal_tone&quot; rel=&quot;nofollow&quot;&gt;natural arrhythmia&lt;/a&gt; it is very unlikely that the spikes will occur at the same point in the waveform even when the heart rate matches the periodicity of the artifact. Thus by identifying a QRS complex and averaging (most likely a median) around some window with the last couple of beats should provide a robust measure of the EKG.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As others have mentioned, the underlying electrical noise should be minimized at the signal capture stage however I appreciate this is not always appropriate and you never want to throw away otherwise good data.&lt;/p&gt;&#xA;" OwnerUserId="8667" LastActivityDate="2016-01-22T10:30:40.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28411" PostTypeId="1" AcceptedAnswerId="78284" CreationDate="2016-01-22T10:48:06.927" Score="15" ViewCount="868" Body="&lt;p&gt;I want to calibrate a tri-axis magnetometer when a tri-axis gyroscope is also available.&lt;/p&gt;&#xA;&lt;p&gt;I am fairly certain I can solve this problem using various optimisation algorithms, but I would prefer to use an unscented Kalman filter for a number of reasons that I'll discuss later, but in short: because it is online, allows change, and explicitly exposes uncertainty.&lt;/p&gt;&#xA;&lt;p&gt;However, a Kalman filter seems mysterious here! – I don't really see how its covariance matrix can store enough information about what has been determined and what remains uncertain such that its recursive process can eliminate the now unlikely possibilities.&lt;/p&gt;&#xA;&lt;p&gt;I think my questions boil down to:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Will this problem be solved well with an unscented Kalman filter?&lt;/li&gt;&#xA;&lt;li&gt;Will a Kalman filter be &amp;quot;as good&amp;quot; as a batch / offline optimisation algorithm?&lt;/li&gt;&#xA;&lt;li&gt;How should I add a normalisation step to the Kalman filter (see later)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;A further point I would love to understand: I assume that there are optimisations problems where a (non linear) Kalman filter is not suitable and other techniques must be used. What factors should I use to decide this?&lt;/p&gt;&#xA;&lt;h1&gt;Background&lt;/h1&gt;&#xA;&lt;p&gt;A tri-axis magnetometer produces time varying 3 vector samples &lt;span class=&quot;math-container&quot;&gt;$m_k$&lt;/span&gt;. These are in the &amp;quot;body frame&amp;quot;. They contain noise. Due to sensor calibration, device construction, and soft and hard iron effects around the sensor: The measurements are highly biased away from the origin; The measurements may not properly align to the body coordinate system; The vector components may not all have the same gain and their axis vectors may not be orthogonal to each other. All this means that the uncalibrated sensor will not give a useful indication  of the true local field &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://cache.freescale.com/files/sensors/doc/app_note/AN4246.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A method&lt;/a&gt; for calibrating a magnetometer is to rotate the device having the magnetometer to numerous poses in a constant magnetic field and build up a large set of samples. The samples will all be found to lie on an ellipsoid. A best fit is performed, and a mapping to turn the ellipsoid in to a unit sphere centred on the origin is determined.&lt;/p&gt;&#xA;&lt;p&gt;I suspect some disadvantages exist with this approach:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The magnetic field may not be constant during this process.&lt;/li&gt;&#xA;&lt;li&gt;A good ellipsoid fit depends on fairly uniform sampling of the ellipsoid surface, perhaps particularly at its &amp;quot;extreme&amp;quot; points. This may not happen during a human assisted calibration.&lt;/li&gt;&#xA;&lt;li&gt;The process does not account for a rotation between the magnetometer and the device's body frame.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;Calibrating with Gyroscope&lt;/h1&gt;&#xA;&lt;p&gt;It seems to me that it ought to be possible to get a more reliable, more accurate, and more rapid calibration if a gyroscope is also available.&lt;/p&gt;&#xA;&lt;p&gt;I believe that all this can be modelled with:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$h = R_k M (m_k-b)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Where:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is the true local field (and not the Kalman observation function that I'll use &lt;span class=&quot;math-container&quot;&gt;$\mathbf{h}$&lt;/span&gt; for – sorry the overloaded terminology);&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt; a 3x3 time varying rotation matrix transforming from body coordinates to world coordinates;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; a 3x3 matrix that corrects the tri-axis magnetometer's gains, rotation, non-orthogonality, and hard / soft iron.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$m_k$&lt;/span&gt; is an instantaneous sample from the magnetometer;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is the magnetometer bias.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;There is no limit on scaling here, so I would add the constraint that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is normalised with &lt;span class=&quot;math-container&quot;&gt;$\det(M)=1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I assume that &lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt; can be obtained from the gyroscopes by integration. On the device I'm using it seems to have low enough drift.&lt;/p&gt;&#xA;&lt;p&gt;I could collect &amp;quot;enough&amp;quot; data like this, and then perform an optimisation to obtain a best fit. All the samples should result in the same &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt;, so this should give a way to determine the unknown parameters.&lt;/p&gt;&#xA;&lt;p&gt;However, I would like to use an unscented Kalman filter.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Kalman filter should allow for &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; to change during calibration (due to local field perturbation) and similarly allow for a degree of drift in &lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;It would mean that I would have a measure of the certainty of all the estimated parameters, and that I could run the process until the parameters are &amp;quot;certain enough&amp;quot;, or simply leave it running all the time.&lt;/li&gt;&#xA;&lt;li&gt;It'll also mean that during calibration I'll have useful preliminary results available that can be shown to the user.&lt;/li&gt;&#xA;&lt;li&gt;It may be possible to provide instruction feedback to the user derived from the covariance matrix. This would direct the user to move the device in a way that will much more quickly reduce the known remaining uncertainty.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;Kalman Filter Model&lt;/h1&gt;&#xA;&lt;p&gt;Taking the form of the process and measurement models from &lt;a href=&quot;http://isas.uka.de/Material/Samba-Papierkorb/vorl2014_15/SI/Terejanu_tutorialUKF.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Unscented Kalman Filter Tutorial – Terejanu&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x_k = \mathbf{f}(x_{k-1}) + w_{k-1}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$z_k = \mathbf{h}(x_k) + v_k$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The Kalman filter process model here is the identity: &lt;span class=&quot;math-container&quot;&gt;$\mathbf{f} = \mathbf{I}$&lt;/span&gt;. There isn't any process beyond process noise, so &lt;span class=&quot;math-container&quot;&gt;$x_k = x_{k-1} + w_{k-1}$&lt;/span&gt;. I believe the process noise is only on &lt;span class=&quot;math-container&quot;&gt;$h_k$&lt;/span&gt; – the other parameters should be constant over the expected time scale.&lt;/p&gt;&#xA;&lt;p&gt;Everything happens in the measurement model. &lt;span class=&quot;math-container&quot;&gt;$z_k$&lt;/span&gt; is just the magnetometer reading &lt;span class=&quot;math-container&quot;&gt;$m_k$&lt;/span&gt;. So, &lt;span class=&quot;math-container&quot;&gt;$z_k = m_k = M_k^{-1} R_k^{-1} h_k + b_k + v_k$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It may make sense to maintain &lt;span class=&quot;math-container&quot;&gt;$M_k^{-1}$&lt;/span&gt; in the state variable &lt;span class=&quot;math-container&quot;&gt;$x_k$&lt;/span&gt;, rather than &lt;span class=&quot;math-container&quot;&gt;$M_k$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt; is a rotation, &lt;span class=&quot;math-container&quot;&gt;$R_k^{-1} = R_k^\top$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h1&gt;Initial State&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$M_0$&lt;/span&gt; can be initialised as &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$b_0$&lt;/span&gt; can be initialised as the first sensor reading &lt;span class=&quot;math-container&quot;&gt;$m_0$&lt;/span&gt;, as the bias seems to have greater magnitude than the signal.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$h_0$&lt;/span&gt; can be the zero vector.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;Initial Variance&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The diagonal terms of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; will have a small variance to allow for differential sensor gain because &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta) \approx 1$&lt;/span&gt; for the small &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; angles that are expected.&lt;/li&gt;&#xA;&lt;li&gt;The off diagonal terms would have variance depending on the maximum expected &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\sin(\theta) \approx \theta$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Variance for &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; should depend on the magnitude of the expected field.&lt;/li&gt;&#xA;&lt;li&gt;Variance of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; – I'm not sure!&lt;/li&gt;&#xA;&lt;li&gt;I presume the initial covariances can be 0?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;Summary&lt;/h1&gt;&#xA;&lt;p&gt;The question is – will this work as a Kalman filter and give useful results? Will it work at least as well as batch optimisation? Or have I got completely the wrong end of the stick?&lt;/p&gt;&#xA;&lt;p&gt;Also – where should I add normalisation such that &lt;span class=&quot;math-container&quot;&gt;$\det(M) = 1$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Implementing this with Lapack to get it running on an iPhone seems like it will be quite an investment, so I'd like to feel fairly sure that it will work before I begin!&lt;/p&gt;&#xA;&lt;h1&gt;Progress&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've built a dirt simple App to capture data from my test device (an iPhone).&lt;/li&gt;&#xA;&lt;li&gt;I've imported the data in to &lt;a href=&quot;http://julialang.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Julia&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I'm going to see if I can use some Julia packages implementing &lt;a href=&quot;https://github.com/JuliaOpt/Optim.jl&quot; rel=&quot;nofollow noreferrer&quot;&gt;general optimisation&lt;/a&gt; and &lt;a href=&quot;https://github.com/wkearn/Kalman.jl&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kalman filtering&lt;/a&gt; to determine the model parameters from the data I've captured, and hopefully see which works better.&lt;/li&gt;&#xA;&lt;li&gt;(25/1/16) I've got the optimisation version possibly working. The &amp;quot;corrected&amp;quot; readings appear to have more (gyro) drift than I'd expect over the capture timescale, so I think I'm going to need to revisit / check my assumptions on that.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12213" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2022-03-13T13:19:08.123" Title="Will an Unscented Kalman Filter Be &quot;As Good&quot; as Other Optimization Algorithms for This Problem?" Tags="|kalman-filters|optimization|bayesian-estimation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28413" PostTypeId="2" ParentId="28251" CreationDate="2016-01-22T13:33:08.810" Score="2" Body="&lt;p&gt;First it should be noted that the nomenclature using power and energy as properties of signals is somewhat misleading. For physical energy to come out of a time integral over a squared signal, the signal would need to be of dimension $\sqrt{[\mathrm{energy}]/[\mathrm{time}]}$, which is not the case for practically all signals that you encounter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, if you have signals that fully describe the state of a physical system over time, and the energy of the system can there be expressed using just that signal, the result is usually very different and most importantly, it is a property of each time instant and not the whole signal. If you have a signal that describes a non-temporal aspect of a physical signal, like the momentary state of a string, the energy of the system will in general require the time derivative of that state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the terms energy and power are a bit of stretch and should be used carefully. I personally prefer speaking of a squared magnitude and a squared magnitude density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this preamble, the use of physical units like time and frequency in the definition of power and energy of a signal become somewhat relative. The choice of scaling and therefore of units is mostly arbitrary and depends on what you want to express and which transformations you want to keep your measures invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you have a choice of sampling your physical system at different rates and you want the energy measure to be invariant under such rate changes, then you need to first understand how the amplitudes behave under a rate change. The normal behaviour of an amplitude is to be be unaffected by a change of sampling rate. Some acquisition methods may however rely on integration to record the samples and your sample values may therefore scale with the sampling rate. So your energy sum may contain different powers of the time step in order to keep the energy invariant under sampling rate changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keeping track of all this for different kinds of signal behaviours quickly become tricky. That is why I made a habit of defining a discrete signal not just by giving a sequence of numbers, but also by providing a homomorphism to an infinite dimensional function space that allows me to work out all the meaningful measures and properties in a well defined framework with properly defined integral transforms and continuous variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, a discrete signal is a tuple $\{ s\in \mathbb{S},\, D: \mathbb{C}\to\mathbb{S},\, \bar{D}:\mathbb{S}\to\mathbb{C} \}$ where $\mathbb{S}$ is the space the discrete signal lives in, $\mathbb{C}$ the space of the continuous time signals, and $s$ a representation of the discrete time signal in $\mathbb{S}$. Note that $D\circ\bar{D}=\mathrm{id}_\mathbb{S}$ but not necessarily $\bar{D}\circ D=\mathrm{id}_\mathbb{C}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You give these two maps $D$ and $\bar{D}$ all the invariance properties you would like to see. Afterwards you can pull back all definitions from $\mathbb{C}$ to $\mathbb{S}$ by applying the two domain changing maps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method of working with discrete signals will give you a well defined way of talking about properties define for continuous signals and allow you to get your scaling correct under sample rate changes or changes of other parameters relevant for your discrete signal representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will not try to replicate your derivation using this approach, because it is not clear to me which invariance and signal properties you want to preserve and what exactly your goal is. Like I said, it depends on the context what is right. I still hope this answer helps your understanding and answers the slightly more fundamental question of how to deal with units, dimensions and scaling of discrete signals compared to continuous signals.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2016-01-22T13:33:08.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28415" PostTypeId="1" CreationDate="2016-01-22T15:59:10.530" Score="0" ViewCount="376" Body="&lt;p&gt;You did it using the norm of the function(signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to measure this symmetry by subtracting each point of my signal from the flipped one. My question is about the way to normalize this difference. Can standard deviation of the signal be a good option? ( I do not want to divide it by the value of max).&lt;/p&gt;&#xA;" OwnerUserId="19201" LastEditorUserId="13320" LastEditDate="2016-11-13T13:23:46.080" LastActivityDate="2016-11-13T13:23:46.080" Title="Quantifying the symmetry of a signal" Tags="|signal-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28416" PostTypeId="2" ParentId="27861" CreationDate="2016-01-22T16:29:31.813" Score="2" Body="&lt;p&gt;I highly recommend taking a closer look on great book:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Zolzer U. - DAFX Digital Audio Effects&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As well as his publication on this specific topic:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.google.co.uk/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0ahUKEwiGiNCl673KAhUGSiYKHXDmDq4QFggkMAA&amp;amp;url=http%3A%2F%2Fwww.hsu-hh.de%2Fdownload-1.5.1.php%3Fbrick_id%3D0GN3KB3EBJ62XalX&amp;amp;usg=AFQjCNGJXGkexKyxJcXXcCQ-CxCmrE5BaQ&amp;amp;sig2=cA-LmYCG-dA6HAniaU4AYQ&amp;amp;cad=rja&quot; rel=&quot;nofollow noreferrer&quot;&gt;Disch S., Zolzer U. - Modulation and Delay Line Based Digital Audio&#xA;  Effects&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Leslie (Rotary) speaker can be simulated using tremolo and Doppler effect for both change in signal amplitude and pitch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basic signal flow diagram that can be found in the article:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bKIhU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bKIhU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-01-22T16:29:31.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28417" PostTypeId="2" ParentId="27863" CreationDate="2016-01-22T18:33:41.930" Score="2" Body="&lt;p&gt;Assuming you have MATLAB, you can just look at the source code, where you will see that the EM is defined as&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;em = maxval/(sum(p.*((1:num_bins).^2)') - mu_t^2);&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;I = im2uint8(I(:)); # the input image&#xA;num_bins = 256;&#xA;counts = imhist(I,num_bins);&#xA;p = counts / sum(counts);&#xA;omega = cumsum(p)&#xA;mu = cumsum(p .* (1:num_bins)');&#xA;mu_t = mu(end);&#xA;sigma_b_squared = (mu_t * omega - mu).^2 ./ (omega .* (1 - omega));&#xA;maxval = max(sigma_b_squared);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="1059" LastEditDate="2016-01-22T20:53:26.923" LastActivityDate="2016-01-22T20:53:26.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28420" PostTypeId="2" ParentId="20349" CreationDate="2016-01-22T20:50:22.540" Score="2" Body="&lt;p&gt;Start by getting rid of the background (Mathematica example):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;map = Import[&quot;&lt;a href=&quot;https://i.stack.imgur.com/HYtbo.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/HYtbo.jpg&lt;/a&gt;&quot;]&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;fg = ImageAdjust[map, {1.0, 1.0}]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/76l5g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/76l5g.png&quot; alt=&quot;Foreground&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then use a graph extraction tool like &lt;a href=&quot;http://nefi.mpi-inf.mpg.de/guide.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;NEFI&lt;/a&gt;. If you want to do it all in Mathematica, &lt;a href=&quot;https://mathematica.stackexchange.com/questions/102362/reconstruct-a-graph-from-an-image-curved-edges-and-edge-crossings&quot;&gt;that's possible too&lt;/a&gt;. You might want to add another preprocessing step to decompose the graph by edge type if you want to treat them separately, like you said.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastEditorUserId="-1" LastEditDate="2017-04-13T12:55:35.443" LastActivityDate="2016-01-22T20:50:22.540" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28421" PostTypeId="2" ParentId="28399" CreationDate="2016-01-22T21:46:13.077" Score="1" Body="&lt;p&gt;okay, since this is about scaling, i should be anal about definitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;discrete-time signal: $x[n]$  where $n$ are only integer values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DTFT:  $$ X\left( e^{j\omega} \right) \triangleq \sum\limits_{n=-\infty}^{+\infty} x[n] \ e^{-j \omega n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it is necessarily the case that $ X\left( e^{j(\omega + 2 \pi)} \right) = X\left( e^{j\omega} \right) $ for all real $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DFT:  $$ \begin{align} X[k] &amp;amp; \triangleq \sum\limits_{n=0}^{N-1} x[n] \ e^{-j 2 \pi \frac{k}{N} n} \\ &#xA;&amp;amp; = X\left( e^{j\omega} \right) \Bigg|_{\omega=2 \pi \frac{k}{N}} \quad \quad \text{if } x[n] = 0 \text{ for } n&amp;lt;0 \text{ or } n \ge N\\ \end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it is also necessarily the case that $X[k+N]=X[k]$ for all integer $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and another fact is that $ X\left( e^{j0} \right) = X(1) = \sum\limits_{n=-\infty}^{+\infty} x[n] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $ X[0] = \sum\limits_{n=0}^{N-1} x[n] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if x[n] is a &quot;low-pass&quot; function, we will expect $X[k]$ to peak at $k=0$.  and the value of that peak is shown as $X[0]$ above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, now consider a window function $w[n]$ that has DFT defined the same way&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ W[k] = \sum\limits_{n=0}^{N-1} w[n] \ e^{-j 2 \pi \frac{k}{N} n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;normally we think of the window function as always non-negative, $w[n] \ge 0$, but it wouldn't necessarily have to be that.  nonetheless, just like $x[n]$, the window function has a DC component:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ W[0] = \sum\limits_{n=0}^{N-1} w[n] \triangleq S_w $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the DFT of the window function must also be periodic, $W[k+N] = W[k]$, for all integer $k$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;now there is a &quot;translation property&quot; of all forms of the Fourier Transform that has a particular expression for the DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} \text{DFT} \left\{ x[n] e^{j 2 \pi \frac{m}{N}} \right\} &amp;amp; = \sum\limits_{n=0}^{N-1} \left( x[n] e^{j 2 \pi \frac{m}{N}} \right) \ e^{-j 2 \pi \frac{k}{N} n} \\&#xA;&amp;amp; = X[k-m] \\ &#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $m$ equal to an integer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;same applies for $w[n]$ with an amplitude scaling factor of $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} \text{DFT} \left\{ w[n] \ A e^{j 2 \pi \frac{m}{N}} \right\} &amp;amp; = \sum\limits_{n=0}^{N-1} \left( w[n] \ A e^{j 2 \pi \frac{m}{N}} \right) \ e^{-j 2 \pi \frac{k}{N} n} \\&#xA;&amp;amp; = A \ W[k-m] \\ &#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;now we &lt;strong&gt;do&lt;/strong&gt; expect the window function to be a &quot;low-pass&quot; function.  that's how we design them, so we also expect $W[k]$ to peak at $k=0$ (or any other integer multiple of $N$) and we expect the expression above to peak when $k-m=0$ (or $k=m$) and the value of that peak is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ A \ W[0] = A \ S_w $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if $A$ is the amplitude we're trying to find, we would take the value of the peak, wherever $k=m$, and divide that value by $S_w$ to get the amplitude of the complex sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it's as simple as that, but it is also shown to be too simple.  we know that a &lt;strong&gt;real&lt;/strong&gt; sinusoid is the sum of two complex sinusoid, so there will be overlapping interference (a.k.a. &quot;leakage&quot;) of one onto the other.  we also expect that the frequency will not be exactly an integer number of cycles $m$ during the time of $N$ samples.  then the math gets a little more involved, but the scaling issues should, if $N$ is large enough, approach the result we have above.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-01-22T21:46:13.077" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28423" PostTypeId="2" ParentId="28415" CreationDate="2016-01-23T06:04:19.173" Score="1" Body="&lt;p&gt;A signal can be decomposed into the sum of an even (symmetric) signal plus an odd (anti-symmetric) signal.  One measure of symmetry of the signal might be the ratio between of the energy in the even decomposition to the energy of the total signal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-02-24T00:54:47.630" LastActivityDate="2016-02-24T00:54:47.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28424" PostTypeId="2" ParentId="28377" CreationDate="2016-01-23T07:00:22.023" Score="2" Body="&lt;p&gt;You want to detect two things: lines/curves and circles. There are well-known algorithms to do both, so let's find them separately. I will present a solution in Mathematica. You can translate to your language.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The first step is to eliminate the background. We do this by finding the background: &lt;code&gt;&#xA;img = Import[&quot;https://i.stack.imgur.com/Olczj.jpg&quot;]&#xA;bimg = ColorConvert[img, &quot;Grayscale&quot;]&#xA;Blur[Closing[bimg, 20], 15]&#xA;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jMT6N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jMT6N.png&quot; alt=&quot;background&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then dividing by it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;evenImg = Image[ImageData@bimg/ImageData@Blur[Closing[bimg, 20], 10]]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NRUDj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NRUDj.jpg&quot; alt=&quot;even image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Detect the edges:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;binImg = EdgeDetect[evenImg, 1, .1]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sL93b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sL93b.png&quot; alt=&quot;Edges&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we just need to fill in the strokes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;smImg = ImageResize[Dilation[binImg, 2], {500}]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qki2h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qki2h.png&quot; alt=&quot;dilated&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;We are finally ready for some detection. Let's start with the lines/curves:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Show[smImg, &#xA;   Graphics[{Yellow, Thick, Line /@ ImageLines[smImg, 0.25]}]]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cNR9a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cNR9a.png&quot; alt=&quot;Line detection&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;What about the circles? Let's start by looking at all the connected components:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;morph = MorphologicalComponents@smImg; Colorize@morph&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PbhYX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PbhYX.png&quot; alt=&quot;Components&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circles are there, all right. We just need to filter out the objects that are not circular. We can do this by looking at the circularity, elongation, &lt;a href=&quot;https://en.wikipedia.org/wiki/Eccentricity_%28mathematics%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;eccentricity&lt;/a&gt;, or &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler_characteristic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Euler characteristic&lt;/a&gt;. Circles are easy to distinguish from other shapes by these properties.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;noncircles = #[[1]] &amp;amp; /@ ComponentMeasurements[morph, &quot;Elongation&quot;, # &amp;gt; 0.3 &amp;amp;]&#xA;circles = morph /. x_ :&amp;gt; 0 /; MemberQ[noncircles, x] // &#xA;  Colorize // RemoveBackground&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pFdaJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pFdaJ.png&quot; alt=&quot;Circles&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2016-01-23T07:00:22.023" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28426" PostTypeId="1" AcceptedAnswerId="28428" CreationDate="2016-01-23T11:52:17.517" Score="0" ViewCount="248" Body="&lt;p&gt;I'm trying to construct a higher order IIR from a biquad cascade, I know this is generally frowned upon, but it's necessary as the coefficients will be embedded into a larger formula used in a FDTD boundary condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to this &lt;a href=&quot;https://dsp.stackexchange.com/questions/10571/group-cascading-iir-filters-of-different-orders&quot;&gt;answer&lt;/a&gt;, I simply need to multiply the biquad transfer functions together, however I'm not sure how to do that.  Is it simply a case of multiplying each numerator polynomial into a higher order one, and then doing the same for the denominator?&lt;/p&gt;&#xA;" OwnerUserId="5213" LastActivityDate="2016-01-23T12:06:40.483" Title="Calculating the product of discrete transfer functions" Tags="|infinite-impulse-response|transfer-function|biquad|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28428" PostTypeId="2" ParentId="28426" CreationDate="2016-01-23T12:06:40.483" Score="1" Body="&lt;p&gt;The total transfer function is indeed just the product of the individual transfer functions of the biquads:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\prod_{i=1}^NH_i(z)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $H(z)=B(z)/A(z)$, this means that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$B(z)=\prod_{i=1}^NB_i(z)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(z)=\prod_{i=1}^NA_i(z)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in order to get the coefficients of the polynomials $B(z)$ and $A(z)$ you need to do polynomial multiplication, or, equivalently, &lt;a href=&quot;https://en.wikipedia.org/wiki/Convolution#Discrete_convolution&quot; rel=&quot;nofollow&quot;&gt;convolution&lt;/a&gt; of the polynomial coefficients. The coefficients of $B(z)$ are obtained by convolving the coefficients of the individual numerator polynomials $B_i(z)$, and the coefficients of $A(z)$ are obtained in an analogous manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matlab function &lt;a href=&quot;http://nl.mathworks.com/help/signal/ref/sos2tf.html&quot; rel=&quot;nofollow&quot;&gt;sos2tf&lt;/a&gt; does exactly that.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-23T12:06:40.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28435" PostTypeId="1" AcceptedAnswerId="28441" CreationDate="2016-01-23T17:06:27.450" Score="0" ViewCount="717" Body="&lt;p&gt;How would you generate the sample of a drum, say &quot;tom&quot;. Using the programming language and it's functions like addition, multiplication, sine, sqrt etc. I tried to generate the sine wave and then sharply cut the volume and add some white noise. This trick gave me something somewhat drumish, but far from perfect.&lt;/p&gt;&#xA;" OwnerUserId="19026" LastActivityDate="2016-01-24T15:05:20.090" Title="Generating drum sample in programming language" Tags="|audio|tone-generation|" AnswerCount="1" CommentCount="0" ClosedDate="2016-02-02T13:08:54.793" ContentLicense="CC BY-SA 3.0" />
  <row Id="28436" PostTypeId="1" CreationDate="2016-01-23T17:30:18.210" Score="0" ViewCount="318" Body="&lt;p&gt;I am implementing a microphone array simulation in my thesis. &#xA;My prof and many documents indicates that microphone array behaves like filters in DSP but instead time-frequency domain there exists sensivity-directivity domains.&#xA;My microphone array directivity responce is a sinc like shape which can be seen below(x axis is angle from -90 to 90 ): &#xA;&lt;a href=&quot;https://i.stack.imgur.com/u2Mys.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u2Mys.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I took the ifft of such directivity responce I am expecting to get a rectangle. &#xA;But instead ifft result is : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nPeG0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nPeG0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My microphone array composes of 41 apartures and distance between apartures is 10 cm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first question after taking ifft I am having 180 bins. How should I assign 180 values to my 41 apartures. Should I just take 41 bins in the middle? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second question since microphone array directivity responce is a sinc like shape. I were expecting a rectangle like result after ifft. Why I am not getting rectangle? &lt;/p&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="1825" LastEditDate="2016-08-21T19:43:36.607" LastActivityDate="2017-01-19T23:55:26.280" Title="IFFT of Microphone Array Directivity Response" Tags="|beamforming|spatial|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28437" PostTypeId="2" ParentId="28436" CreationDate="2016-01-23T18:13:10.113" Score="0" Body="&lt;p&gt;I don't have a lat of experience with microphone arrays (yet).&lt;br&gt;&#xA;I have just a bit of experience with windows and i think this is similar. &lt;em&gt;(If not comments are welcome for me to learn about this topic as well)&lt;/em&gt;&lt;br&gt;&#xA;When i look to just your figure it doesn't have the shape i should suspect what a rectangular window should have. for me it looks more like a shifted Hann window or blackman window or something like that.&lt;br&gt;&#xA;Just look at the figures at&lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window function at wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2016-01-23T18:13:10.113" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28439" PostTypeId="1" AcceptedAnswerId="28442" CreationDate="2016-01-24T14:20:48.033" Score="1" ViewCount="244" Body="&lt;p&gt;I'm trying to build an audio player that has this specific feature: when you scroll to x sample time, [x to x + 4096] samples are played in a loop until you move the mouse to another place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The samples are taken from the backing audio. The problem is, I fail to play them back as a continuous note: the looping is not seamless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I tried to start and end the loop at zero crossings. This slightly improved it, but I can still hear the seamless looping. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One idea I had was to go to the frequency domain, remove all, but the max magnitude bin and do an inverse FFT afterwards. This, sort of works, the looping is better, not perfect, but better, however, removing all the other freq components from the loop leaves it really &quot;dry&quot;, not resembling the original (missing the harmonics)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to handle this in the time domain? Where should I look? Are there any filters/algorithms that could help me?&lt;/p&gt;&#xA;" OwnerUserId="19226" LastActivityDate="2016-01-24T17:35:23.983" Title="Playing samples in a loop, without clicks or pops" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28441" PostTypeId="2" ParentId="28435" CreationDate="2016-01-24T15:05:20.090" Score="1" Body="&lt;p&gt;There are different approaches to generate artificial (I guess that's what you're aiming at here) drum sounds. The approach that you describe is certainly a good way to start - i.e. look at an existing sample that you're trying to approximate and find the properties that make up it's main characteristics. For example&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;is it tonal (e.g. like a tom or bass drum) or noise-like (e.g. like a high-hat) or a mixture (e.g. like a snare)?&lt;/li&gt;&#xA;&lt;li&gt;what's the frequency/spectrum of the tonal part&lt;/li&gt;&#xA;&lt;li&gt;what's the bandwidth of the noise part&lt;/li&gt;&#xA;&lt;li&gt;what's the attack / decay behaviour&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Knowing these important aspects of many percussive sounds, you can try to modify - e.g. - a sine wave by changing the frequency and amplitude over time, adding (filtered) noise and so on. Some experimenting will yield sounds similar to that of the classic &lt;a href=&quot;https://en.wikipedia.org/wiki/Roland_TR-808&quot; rel=&quot;nofollow&quot;&gt;TR-808&lt;/a&gt;. This machine may also be a nice source of inspiration on how to approach drum modelling using basic synthesis elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another - somewhat more involved - approach is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Physical_modelling_synthesis&quot; rel=&quot;nofollow&quot;&gt;physical modelling&lt;/a&gt;. This method starts from trying to emulate and - as the name says - physically model the elements that are involved in actually generating a sound. In the case of drum synthesis this comprises, for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the drum head&lt;/li&gt;&#xA;&lt;li&gt;the stick that is used to hit the head&lt;/li&gt;&#xA;&lt;li&gt;the drum shell.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A thesis on exactly this topic can be found &lt;a href=&quot;http://publications.lib.chalmers.se/records/fulltext/5768.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resources on how to actually program these models can for example be found in the communities of &lt;a href=&quot;https://puredata.info/&quot; rel=&quot;nofollow&quot;&gt;Pure Data&lt;/a&gt;, &lt;a href=&quot;http://csound.github.io/&quot; rel=&quot;nofollow&quot;&gt;Csound&lt;/a&gt; or &lt;a href=&quot;http://supercollider.github.io/&quot; rel=&quot;nofollow&quot;&gt;SuperCollider&lt;/a&gt; as these are programming environments that have been specifically designed for audio/music signal processing (for example, see &lt;a href=&quot;https://puredata.info/Members/Junk/drumsynthesis&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for a short tutorial on drum synthesis in Pure Data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some theoretical background, I have been recommended the &lt;a href=&quot;http://www.musimathics.com/&quot; rel=&quot;nofollow&quot;&gt;musimathics&lt;/a&gt; books, but have not read them personally.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2016-01-24T15:05:20.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28442" PostTypeId="2" ParentId="28439" CreationDate="2016-01-24T17:35:23.983" Score="2" Body="&lt;p&gt;The popping comes from discontinuities in the signal or its derivative.  Even if you match the starting sample value with the ending one, you will still have a &quot;corner&quot; in most cases.  Imagine a pure sine wave of one frequency at the start and a pure sine wave of another at the end. Discontinuities tend to produce a lot of high frequency noise.  Your second solution using the low pass filter eliminated that noise (it smoothed out the signal), but at the cost of eliminating the signal too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest solution to this is just to &lt;a href=&quot;https://en.wikipedia.org/wiki/Crossfade_%28audio_engineering%29&quot; rel=&quot;nofollow&quot;&gt;crossfade&lt;/a&gt; the end into the start.  Admittedly, at typical playback rates (22KHz) you are looping about 200ms which gives very little time to fade in/out.  At this point, you may be closer to doing an (overlapped) &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function&quot; rel=&quot;nofollow&quot;&gt;window function&lt;/a&gt;.  Doing an abrupt crossfade would be roughly akin to a Tukey window.&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-01-24T17:35:23.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28444" PostTypeId="1" AcceptedAnswerId="28677" CreationDate="2016-01-24T22:30:37.143" Score="0" ViewCount="493" Body="&lt;p&gt;I am trying to link sample and hold to discrete and continuous time domain.&#xA;Could someone please confirm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When sampling but not holding for &quot;an extended&quot; period of time, you have discrete samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When sampling AND holding you lose the &quot;discretion&quot; and obtain an approximated continuous signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="19209" LastEditorUserId="4346" LastEditDate="2016-02-05T05:23:12.887" LastActivityDate="2016-03-06T05:55:01.393" Title="Does the hold part in sample and hold turns the signal from discrete to continuous?" Tags="|discrete-signals|sampling|continuous-signals|zoh|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28445" PostTypeId="2" ParentId="28444" CreationDate="2016-01-25T01:32:00.560" Score="1" Body="&lt;p&gt;The sample-and-hold circuit is a physical, analog electrical circuit and, by definition, its output is continuous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual conversion to discrete time happens at the quantizer, not at the sampler. The output of the quantizer is a discrete sequence of numbers associated with time instants, so it can be said to be a discrete signal.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-01-25T01:32:00.560" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28447" PostTypeId="1" CreationDate="2016-01-25T02:49:27.800" Score="1" ViewCount="26056" Body="&lt;p&gt;$u[n]$ is the unit step function in discrete form. I want to know which one of the following two is the correct waveshape for $u[2-n]$, where $k$ is a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the answer? The top one is $u[n]$, the unit step function. So, what's the graph for $u[2-n]$, middle or bottom?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GnJuU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GnJuU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17687" LastEditorUserId="13320" LastEditDate="2016-11-13T13:37:33.087" LastActivityDate="2023-10-20T04:31:03.900" Title="Which one is the correct graph for $u[2-n]$?" Tags="|discrete-signals|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28448" PostTypeId="1" AcceptedAnswerId="28449" CreationDate="2016-01-25T03:52:49.510" Score="2" ViewCount="2360" Body="&lt;p&gt;Is there an easy/general way to calculate this? For instance, the rectangular window has a maximum scalloping loss of 0.3634, which can be derived in frequency domain from a normalized &lt;code&gt;sinc(0.5)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way, given a precomputed window function, I can think of, is to apply the window function to a signal whose period is 2pi*(k + 0.5)/N and amplitude A, calculate a N FFT and measure the bin k. Bin k should have a magnitude of A * N * f, where f is a factor giving the worst-case scalloping loss, irrespective of N/sampling size, right?&lt;/p&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2016-01-25T21:26:13.633" Title="Measure scalloping loss of window function" Tags="|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28449" PostTypeId="2" ParentId="28448" CreationDate="2016-01-25T06:40:49.457" Score="2" Body="&lt;p&gt;Harris defines the scalloping loss as the ratio of coherent gain for a tone located half a bin from a DFT sample to the coherent gain at a sample (see the paper for the definitions)&#xA;$$&#xA;\mathrm{SL} = \frac{\left\lvert \sum_n w(nT)e^{-j\frac{\pi}{N}n} \right\rvert}{\sum_n w(nT)} = \frac{W\left(\omega_{1/2}\right)}{W(0)}&#xA;$$&#xA;Where $w$ is the window and $W$ is the window DFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\omega_{1/2} =\frac{\pi}{NT}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Guess the value you are after is really $1-SL$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; &lt;em&gt;I believe the left hand side of the equation is enough to answer @Shaggi's question, but to clarify a bit the notation of the rest, Harris defines DFTs as functions of $\omega_k$, so&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;  W(\omega_k) &amp;amp; = W\left(\frac{2\pi k}{NT}\right) = \\&#xA;              &amp;amp; = \sum_n w(nT) e^{-j\omega_k nT}\\&#xA;              &amp;amp; = \sum_n w(nT) e^{-j 2\pi kn/N}\\&#xA;  W(\omega_{1/2}) &amp;amp; = \sum_n w(nT) e^{-j \pi n/N}\\&#xA;  W(0) &amp;amp;= \sum_n w(nT)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://www.utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;F. J. Harris&lt;/em&gt; - On the Use of Windows for Harmonic Analysis with the&#xA;  Discrete Fourier&#xA;  Transform&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="18984" LastEditorUserId="18984" LastEditDate="2016-01-25T21:26:13.633" LastActivityDate="2016-01-25T21:26:13.633" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="28450" PostTypeId="1" CreationDate="2016-01-25T07:14:32.660" Score="1" ViewCount="59" Body="&lt;p&gt;I have encoded a video stream using JM using RTP. Then i have applied rtp_loss on it but after that i am unable to decode video. &lt;a href=&quot;http://www.cs.tut.fi/~belyaev/football.gif&quot; rel=&quot;nofollow&quot;&gt;Like in this example&lt;/a&gt; a video with different packet loss percentages are depicted. I want to apply packet loss on H.264 RTP stream than want to decode it. But whenever i want to decode using JM it is unable to handle it. I have heard that &lt;a href=&quot;http://www.linuxfoundation.org/collaborate/workgroups/networking/netem&quot; rel=&quot;nofollow&quot;&gt;Netem&lt;/a&gt; could be an option but i am not using Linux. So Is there a way to apply packet loss on video and than see how  video quality is changed after it like in the example link given above?&lt;/p&gt;&#xA;" OwnerUserId="18454" LastEditorUserId="18454" LastEditDate="2016-01-27T10:52:15.817" LastActivityDate="2016-01-27T10:52:15.817" Title="Is there a way to see video after applying packet loss" Tags="|video-processing|video|forward-error-correction|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28451" PostTypeId="2" ParentId="28447" CreationDate="2016-01-25T08:27:29.660" Score="8" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt; For which value of $n$ does the argument of $u[2-n]$ become zero? That's where the step occurs. For which values of $n$ is the argument non-negative? That's where your unit step equals $1$. If you think about it for a minute, it should become really easy.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-25T08:27:29.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28452" PostTypeId="2" ParentId="28444" CreationDate="2016-01-25T08:46:24.740" Score="0" Body="&lt;p&gt;Yes. Conceptually (or mathematically), the sample part turns the signal from a continuous-in-time signal to a discrete-in-time signal; the hold part turns it back into a continuous-in-time signal.  Of course, if you sample at only finitely many points, you will only have finitely many (but still unconstrained) amplitudes.  So after the sample-and-hold the output amplitudes will have a discrete but not quantized set of possible values.  For example, if you sampled at three points in time, say 1sec, 2sec, 3sec, the set of amplitudes at those three points might be $\{1, 0.25, \pi\}$.  Quantizing would then be some form of &quot;rounding&quot; those output values, say to $\{1,0,3\}$.&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-01-25T08:46:24.740" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28453" PostTypeId="1" CreationDate="2016-01-25T10:51:18.220" Score="2" ViewCount="1115" Body="&lt;p&gt;I am using a Kalman filter to fuse gyro and inclinometer data. The prediction step is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{\alpha_{i}}^- = \hat{\alpha}^+_{i-1} + \omega_{i}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\hat{\alpha_{i}}^-$ is the prediction for the angle, $\hat{\alpha}^+_{i-1}$ is the previous a-posteriori state estimate and $\omega_i$ is the change in angle measured by the gyro.&#xA;The innovation of the filter is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\alpha_i - \hat{\alpha_{i}}^- $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\alpha_i$ is the current measurement of the inclinometer. As far as my understanding of the Kalman filter goes, the innovation is expected to have a zero mean. However, the following Figure shows the histogramm for some 25000 datapoints of the innovation: &lt;a href=&quot;https://i.stack.imgur.com/21enO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/21enO.png&quot; alt=&quot;Histogramm of the innovation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mean is obviously non-zero. Would it be correct to claim that this means that some error source is present, for example an uncorrected gyro offset? Or is the non-zero mean more an &quot;academic&quot; property of the filter, can't be expected to be true in a real-world implementation, and thus a non-zero mean should not be overrated?&lt;/p&gt;&#xA;" OwnerUserId="19238" LastActivityDate="2017-05-16T10:48:17.490" Title="Non-zero mean of Kalman innovation" Tags="|kalman-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28454" PostTypeId="1" AcceptedAnswerId="28455" CreationDate="2016-01-25T12:06:49.520" Score="1" ViewCount="11095" Body="&lt;p&gt;I am new to this forum. I have been teaching myself DSP for the last two years, so my experience and knowledge has a long way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to find the phase response of a specific filter that I am using on Csound for any given fundamental frequency of the input (and I guess I'll need to be able to do that for any cuttoff frequency and ideally any sampling rate as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter is a 1st order lowpass IIR, and the filter's equation is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = c_1  x[n] + c_2 y[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$h_p$ - half power point&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$b = 2 - \cos(2 \pi h_p/s_r)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$c_2 = b - \sqrt{b^2 - 1}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$c_1 = 1 - c_2$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Three questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Can I find the phase response for any frequency based on this equation alone? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can I derive a phase response equation from this equation alone?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there a standardised way of finding the phase response for any lowpass filter, or does it depend on what kind of filter it is?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I have found some info about finding phase response both in these forums and elsewhere online, but without knowing the answer to question 3, it's hard to know if they are relevant or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also read most of the scientists and engineers guide to DSP (which I notice is also the boards DSP guide, awesome!), and I have been going back over it the last few days to try and get some clues. The best solution I can find is to fft the impulse response, and I know how to find the impulse response for a cuttoff frequency, but it'll take a long time to calculate the impulse response for all possible cuttoff frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been reexamining ths online resouce from analog.com:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.analog.com/library/analogDialogue/archives/43-09/active_filters.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.analog.com/library/analogDialogue/archives/43-09/active_filters.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website tells me this about the phase response of a 1 pole lowpass filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oIPfq.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oIPfq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this true of any 1st order low pass filter, or are they refering to a specific filter type? If this is true of my filter, I think I might be able to do this (though I won't say for sure yet!)&lt;/p&gt;&#xA;" OwnerUserId="19240" LastEditorUserId="19240" LastEditDate="2016-01-25T12:44:30.347" LastActivityDate="2016-01-25T21:58:35.423" Title="How do I find the phase response of a filter from the filter equation?" Tags="|filters|lowpass-filter|phase|infinite-impulse-response|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28455" PostTypeId="2" ParentId="28454" CreationDate="2016-01-25T12:39:49.880" Score="4" Body="&lt;p&gt;You need to determine the frequency response of the filter. The phase of this complex function is the filter's phase response. If you have the filter's difference equation, you need to transform it to the $\mathcal{Z}$-transform domain, where a delay of $k$ (with integer $k$) corresponds to a multiplication by $z^{-k}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=c_1X(z)+c_2Y(z)z^{-1}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(1)$ you can determine the transfer function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{Y(z)}{X(z)}=\frac{c_1}{1-c_2z^{-1}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency response is the transfer function evaluated at $z=e^{j\omega}$, where $\omega$ is the normalized frequency in radians:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega=\frac{2\pi f}{f_s}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $f_s$ the sampling frequency, and $f$ the actual frequency in Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From $(2)$, the filter's frequency response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\frac{c_1}{1-c_2e^{-j\omega}}=|H(e^{j\omega})|e^{j\phi(\omega)}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the phase response $\phi(\omega)$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi(\omega)=\text{atan2}\left(\frac{-c_2\sin(\omega)}{1-c_2\cos(\omega)}\right)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more complicated filters it's usually easier to determine the frequency response (and the phase response) numerically by using an FFT. The (sampled) frequency response is obtained by element-wise division of the FFT of the numerator coefficients of the transfer function by the FFT of the denominator coefficients. The (sampled) phase is then obtained as the argument of this complex-valued vector. In Matlab/Octave, the frequency response can be obtained directly from the filter coefficients using the command &lt;a href=&quot;http://nl.mathworks.com/help/signal/ref/freqz.html&quot; rel=&quot;nofollow&quot;&gt;freqz&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-25T12:39:49.880" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="28456" PostTypeId="1" AcceptedAnswerId="28457" CreationDate="2016-01-25T13:37:44.433" Score="4" ViewCount="517" Body="&lt;p&gt;I am very familiar with IIR and FIR filters for processing digital signals (audio is my main interest). I am keen to know if there are alternative filters based on different mathematical models to IIR and FIR?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a degree in maths but learning about DSP is just a hobby (I didn't study it at university) so I haven't a clue whether this is a stupid question or not :-)&lt;/p&gt;&#xA;" OwnerUserId="15030" LastActivityDate="2016-01-25T19:48:34.683" Title="Are there other filter models besides IIR and FIR for processing digital signals?" Tags="|filters|audio|filter-design|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28457" PostTypeId="2" ParentId="28456" CreationDate="2016-01-25T13:58:26.903" Score="6" Body="&lt;p&gt;FIR and IIR filters are discrete-time &lt;em&gt;linear time-invariant&lt;/em&gt; (LTI) filters. There are also (linear) &lt;em&gt;time-varying&lt;/em&gt; systems, which could be implemented just like FIR or IIR filters, but with time-varying coefficients. Audio effects like &lt;a href=&quot;https://en.wikipedia.org/wiki/Chorus_effect&quot; rel=&quot;nofollow&quot;&gt;chorus&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Flanging&quot; rel=&quot;nofollow&quot;&gt;flanger&lt;/a&gt;, or &lt;a href=&quot;https://en.wikipedia.org/wiki/Phaser_%28effect%29&quot; rel=&quot;nofollow&quot;&gt;phaser&lt;/a&gt; are time-varying filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course there are also &lt;em&gt;non-linear&lt;/em&gt; filters, the most well-known of which is probably the &lt;a href=&quot;https://en.wikipedia.org/wiki/Median_filter&quot; rel=&quot;nofollow&quot;&gt;median filter&lt;/a&gt;, which is very useful for removing impulsive noise. Many different types of non-linear filters are used in image processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that none of the above mentioned filters can be characterized by their impulse response or, equivalently, by their frequency response. This is only possible for LTI systems.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-25T19:48:34.683" LastActivityDate="2016-01-25T19:48:34.683" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28458" PostTypeId="2" ParentId="28283" CreationDate="2016-01-25T14:15:14.977" Score="0" Body="&lt;p&gt;The OpenCV documentation suggests using CASCADE_SCALE_IMAGE when performing a detectMultiScale with LBP features.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lollipops_cascade.detectMultiScale(frame_gray, lollipops,1.1, 2, 0|CASCADE_SCALE_IMAGE, Size(30, 30));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even though, it works perfectly with  &lt;code&gt;CV_HAAR_SCALE_IMAGE&lt;/code&gt; flag instead of &lt;code&gt;CASCADE_SCALE_IMAGE&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18589" LastActivityDate="2016-01-25T14:15:14.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28460" PostTypeId="1" AcceptedAnswerId="28461" CreationDate="2016-01-25T17:03:57.970" Score="-2" ViewCount="230" Body="&lt;p&gt;The question is about the notion of variance in control theory, a college course I am taking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ever since I can remember, in every maths or physics class, whenever a professor started teaching something they just listed definitions from a textbook. For example: speed is equal to the ratio between distance and time. Thankfully, common sense tells me that speed just measures how fast I can go from x to y. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keeping this in mind, variance, as my professor so dearly explained, is&#xA;$$\frac1 {N+1} \sum_{t=-\frac N 2} ^ {\frac N 2} (u[t] - &#xA;{\frac1 {N+1} \sum_{t=-\frac N 2} ^ {\frac N 2} (u[t])^2)     }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone be kind enough to tell me with English words what meaning this actually has? &#xA;What is it that variance actually measures and how can I visualize it so I can actually understand it? &lt;/p&gt;&#xA;" OwnerUserId="19211" LastEditorUserId="8202" LastEditDate="2016-01-25T17:13:21.123" LastActivityDate="2016-01-25T17:18:18.007" Title="What does variance actually mean in control theory?" Tags="|control-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28461" PostTypeId="2" ParentId="28460" CreationDate="2016-01-25T17:18:18.007" Score="-1" Body="&lt;p&gt;Variance is a measure of how likely it is that a particular sample is very different from the average of all the samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a sequence $\{5,5,5,5,5,5\}$. Its variance is zero because every sample is equal to the sequence average. Now consider the sequence $\{0,10,0,10,0,10\}$. Its mean is the same as the previous sequence (5), but now its variance is large, because samples are &quot;far&quot; from the mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The textbook formula can be interpreted as follows: it is the average of the square of the difference between every sample and the sequence average. The &quot;inner&quot; summation is the sequence average. The &quot;outer&quot; summation is the average of the difference between each sample and the sequence average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason there is a square operation in the formula is that you don't want differences of equal magnitude but opposite sign to cancel each other out.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-01-25T17:18:18.007" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28463" PostTypeId="2" ParentId="28454" CreationDate="2016-01-25T21:58:35.423" Score="0" Body="&lt;p&gt;If you can factor your LTI filter's equation into the ratio of zeros over poles, then you can calculate phase very simply (even graphically) by adding up the angles from every pole and subtracting the angles from every zero to points on the unit circle in the complex plane representing frequency.  The atan2() in equation (4) in Matt L's answer gives just such a phase angle.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-25T21:58:35.423" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28464" PostTypeId="1" AcceptedAnswerId="28465" CreationDate="2016-01-25T21:59:12.773" Score="0" ViewCount="267" Body="&lt;p&gt;I have seen people using 10*log10 and/or 20*log10 while converting magnitude to dBs. What are the differences and which one is valid?&lt;/p&gt;&#xA;" OwnerUserId="19233" LastActivityDate="2016-01-25T22:20:40.157" Title="Converting magnitude to dBs" Tags="|fft|magnitude|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28465" PostTypeId="2" ParentId="28464" CreationDate="2016-01-25T22:12:40.383" Score="0" Body="&lt;p&gt;They are both valid:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$10 \cdot \log_{10}$ is for power ratios&lt;/li&gt;&#xA;&lt;li&gt;$20 \cdot \log_{10}$ is for voltage/pressure/etc ratios (these are called &quot;field quantities&quot; or &quot;root-power quantities&quot;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://en.wikipedia.org/wiki/Field,_power,_and_root-power_quantities&quot; rel=&quot;nofollow&quot;&gt;Field, power, and root-power quantities&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Decibel#Definition&quot; rel=&quot;nofollow&quot;&gt;Decibel definition&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Digital values are just unitless numbers, so you need to think about what they ultimately represent.  Typically they're root-power quantities (like audio pressure waveforms), but could conceivably represent power waveforms.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2016-01-25T22:20:40.157" LastActivityDate="2016-01-25T22:20:40.157" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="28466" PostTypeId="1" AcceptedAnswerId="28471" CreationDate="2016-01-26T01:40:21.447" Score="1" ViewCount="10278" Body="&lt;p&gt;I'm studying for a Signals Processing exam and came across an exercise that I'm finding pretty difficult to solve. It says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Asume there is a signal $x[n]$ of length $N$. Its $\mathcal{Z}$-Transform is $X(z)$. Find the expressions of the DFTs of the next signals using a&#xA;  correct sampling of $X(z)$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;a) $x_{1}[n]=x[n]$  if  $0\le n \le N-1$ and $x_{1}[n]=0$  if  $N\le n \le 2N-1$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;b) $x_{1}[n]=x[n]+x[n-N]$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For a), I thought of expressing  $X[k] = X(z) \bigg|_{z=e^{j\frac{2\pi}{N} k}}$, i.e. the $\mathcal{Z}$-Transform evaluated in $z=j\frac{2\pi}{N} k$ is the DFT of $x[n]$. Due to the zeros added at the end of the original signal, I arrived at the conclusion that  $X[k] = X(z) \bigg|_{z=e^{j\frac{2\pi}{2N} k}}$. Namely, the $\mathcal{Z}$-Transform is now sampled in $2N$ points around the unity circle. Is this reasoning right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And regarding exercise b), I have absolutely no idea how to solve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="1629" LastEditDate="2016-01-26T11:19:02.853" LastActivityDate="2016-01-26T11:19:02.853" Title="Relationship between z-transform and DFT" Tags="|dft|z-transform|zero-padding|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28467" PostTypeId="2" ParentId="28466" CreationDate="2016-01-26T04:32:11.797" Score="1" Body="&lt;p&gt;here is the relationship in a quick and concise (or terse) manner:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;discrete-time signal: $x[n]$ where $n$ is an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Z transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(z) \triangleq \sum\limits_{n=-\infty}^{+\infty} x[n] \ z^{-n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Discrete-time Fourier transform (DTFT):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align} &#xA; X\left(e^{j\omega}\right) \ &amp;amp;= \ X(z) \Big|_{z=e^{j\omega}} \\&#xA;  &amp;amp;= \ \sum\limits_{n=-\infty}^{+\infty} x[n] \ e^{-j \omega n} \\&#xA; \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that is how the DTFT is related to the Z transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align} &#xA; X[k] &amp;amp;= X\left(e^{j\omega}\right)\Big|_{\omega = \frac{2 \pi k}{N}} \quad \text{where } x[n]=0 \text{ for } n&amp;lt;0 \text{ or }n\ge N  \\&#xA;  &amp;amp;= \ \sum\limits_{n=-\infty}^{+\infty} x[n] (u[n]-u[n-N]) \ e^{-j \frac{2 \pi k}{N} n} \\&#xA;  &amp;amp;= \ \sum\limits_{n=0}^{N-1} x[n] \ e^{-j \frac{2 \pi k}{N} n} \\&#xA; \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here $k$ is an integer and $u[n]$ is the discrete unit step function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u[n] \triangleq \begin{cases} 1 \quad \text{for } n \ge 0 \\&#xA;0 \quad \text{for } n &amp;lt; 0 \end{cases} $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-01-26T04:32:11.797" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28468" PostTypeId="1" AcceptedAnswerId="28474" CreationDate="2016-01-26T04:37:44.973" Score="1" ViewCount="1288" Body="&lt;p&gt;Suppose I have an LTI system $$H(z)=\frac{z}{(z-2)(z-\frac{1}{2})}$$ and I want to know its response to the step function $u[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The LTI system $H(z)$ has three possible ROCs: $$|z|&amp;lt;\frac{1}{2}$$ $$\frac{1}{2}&amp;lt;|z|&amp;lt;2$$ $$|z|&amp;gt;2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The response to the step function can be expressed as $$S(z)=H(z)U(z)=\frac{z^{2}}{(z-2)(z-\frac{1}{2})(z-1)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the ROC of $U(z)$ being $$|z|&amp;gt;1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my question is: what is the response to the step function in each case (i.e. for every different ROC of $H(z)$)? Is the ROC of $S(z)$ the intersection of the other two? And what happens when the intersection is empty (when the ROC of $H(z)$ is $|z|&amp;lt;\frac{1}{2}$)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="19249" LastEditDate="2016-01-26T13:55:01.277" LastActivityDate="2016-01-26T13:55:01.277" Title="ROC of the product of two Z-Transforms" Tags="|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28470" PostTypeId="1" AcceptedAnswerId="28472" CreationDate="2016-01-26T07:15:21.960" Score="0" ViewCount="54" Body="&lt;p&gt;I am trying to generate a signal with specific frequency and shape. I have accomplished to get a time domain signal with the specified frequency, however the shape does not match. Is there any method to get the desired shape. Will phase be any helpful?&lt;/p&gt;&#xA;" OwnerUserId="16628" LastEditorUserId="13541" LastEditDate="2016-01-26T11:49:33.020" LastActivityDate="2016-01-26T11:49:33.020" Title="Problem with simulation of the desired shape of the signal" Tags="|signal-analysis|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28471" PostTypeId="2" ParentId="28466" CreationDate="2016-01-26T07:56:24.663" Score="3" Body="&lt;p&gt;For a) you're correct. For b), $x_1$ is a length $2N$ signal, and its DFT is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_1[k]=\sum_{n=0}^{2N-1}x_1[n]e^{-j2\pi kn/2N}=\sum_{n=0}^{2N-1}x_1[n]e^{-j\pi kn/N}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $x_1=x[n]+x[n-N]$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X_1[k]&amp;amp;=\sum_{n=0}^{N-1}x[n]e^{-j\pi kn/N}+\sum_{n=N}^{2N-1}x[n-N]e^{-j\pi kn/N}\\&amp;amp;=X\left(e^{j\pi k/N}\right)+\sum_{n=0}^{N-1}x[n]e^{-jk\pi(n+N)/N}\\&amp;amp;=X\left(e^{j\pi k/N}\right)+e^{-jk\pi}X\left(e^{j\pi k/N}\right)\\&amp;amp;=X\left(e^{j\pi k/N}\right)(1+(-1)^k)=\begin{cases}2X\left(e^{j\pi k/N}\right),&amp;amp;k \text{ even}\\&#xA;0&amp;amp;k\text{ odd}\end{cases}\tag{2}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. $(2)$ shows that decimation in the frequency domain corresponds to aliasing in the time domain.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-26T07:56:24.663" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28472" PostTypeId="2" ParentId="28470" CreationDate="2016-01-26T09:35:11.937" Score="1" Body="&lt;p&gt;For a square wave as used in your example phase don't do anything.&#xA;Since the fourrier series is just based on a sine wave without phase.&#xA;The fourrier series are:&#xA;$$ &#xA;S_n (x) = \frac{a_0}{2}+ \sum_{n=1}^{N} A_n \cdot \sin (\frac{2 \pi \cdot n \cdot x}{P}) \qquad \text{for integer } N \geq 1&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the square wave have only the odd frequencies. you can choose for the sinewaves: 1, 3, 5, 7, 9, 11, 13 ,...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For other functions it is different. In that case you have both sine and cosine signals. Combination of both give as result the phase.&#xA;if you have an series of 7 or 8 frequencies it is allready close to a square wave. &lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2016-01-26T09:35:11.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28474" PostTypeId="2" ParentId="28468" CreationDate="2016-01-26T11:12:46.640" Score="2" Body="&lt;p&gt;Note that for any impulse response $h[n]$, the step response is given by the cumulative sum of $h[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[n]=\sum_{k=-\infty}^nh[k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Its $\mathcal{Z}$-transform is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A(z)=\sum_{n=-\infty}^{\infty}a[n]z^{-n}=\sum_{n=-\infty}^{\infty}z^{-n}\sum_{k=-\infty}^nh[k]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The region of convergence (ROC) of $(2)$ is the range of values of $|z|$ for which the sum in $(2)$ converges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your example, you have three different impulse responses with the same expression for their $\mathcal{Z}$-transform, each with a different ROC. You are right that the ROC of $A(z)$ is the intersection of the ROC of $h[n]$ and the ROC of the unit step $u[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the ROC $|z|&amp;lt;\frac12$ you get an empty intersection. This simply means that the sum $(2)$ converges nowhere in the $z$-plane, i.e. the $\mathcal{Z}$-transform of the step response $a[n]$ doesn't exist in this case. The reason is that the corresponding impulse response is anti-causal and exponentially increasing towards negative values of $n$, so from $(1)$, $a[n]$ is infinite for any value of $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the ROC $\frac12&amp;lt;|z|&amp;lt;2$ you have the intersection $1&amp;lt;|z|&amp;lt;2$, i.e., the step response $a[n]$ is a two-sided sequence with a $\mathcal{Z}$-transform $A(z)$ that converges in that range of values of $|z|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the ROC $|z|&amp;gt;2$ the intersection is $|z|&amp;gt;2$, and, consequently, the step response $a[n]$ is an exponentially increasing right-sided sequence with a $\mathcal{Z}$-transform $A(z)$ that converges for $|z|&amp;gt;2$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-26T11:12:46.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28478" PostTypeId="2" ParentId="248" CreationDate="2016-01-26T15:43:15.843" Score="-1" Body="&lt;p&gt;Usually wide window size gives better frequency resolution but poor time resolution and vice-versa. Look at this example where I generated a spectrogram of a sine wave with 5kHz and sample rate of 22050Hz, from my C++ code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FtHVc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FtHVc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above spectrogram has window size of 2048 samples and overlap of 1024 samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at this spectrogram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Fl9n5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Fl9n5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This one has window size of 512 samples and overlap of 256 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you see the difference? The first one has better frequency resolution than the second one. But the second one has better time resolution when compared to the first one. So, choosing window size depends upon your application. If you are dealing with speech samples to track pitch, choosing larger window size should be the appropriate one. &lt;/p&gt;&#xA;" OwnerUserId="19233" LastActivityDate="2016-01-26T15:43:15.843" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28479" PostTypeId="2" ParentId="28359" CreationDate="2016-01-26T16:11:03.623" Score="2" Body="&lt;p&gt;There isn't a mystery here. Your input signal isn't random; you chose 5 numbers at random, perhaps, but then you repeated the sequence of 5 numbers several times. This is a periodic signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In continuous time, a periodic signal has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_series&quot; rel=&quot;nofollow&quot;&gt;Fourier series&lt;/a&gt; representation; its spectrum contains discrete lines (i.e. sinusoidal tones). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a finite-length discrete-time signal, such as the one you proposed, you see a similar phenomenon. The spectrum of a signal that is periodic within its duration will have a line structure to it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your moving averages are simple lowpass filters. As you apply more and more averages, you're filtering out the higher harmonics, leaving a combination of relatively fewer sinusoids. Thus, output of the cascade of moving average filters has a readily discernible structure as a sum of a relatively small number of sinusoids, as you described.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2016-01-26T23:35:37.227" LastActivityDate="2016-01-26T23:35:37.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28480" PostTypeId="1" CreationDate="2016-01-26T17:38:02.130" Score="1" ViewCount="88" Body="&lt;p&gt;So I am wondering why I keep seeing that the rank of the LCMV Broadband Constraint Matrix is equal to the number of constraints, when in practice, I find that the rank is only 1. This is precluding me from performing any sort of 'low rank' approximation since it is already of the lowest rank possible! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constraint matrix is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C = [ \mathbf{d}(\theta, \omega_{0}) | \mathbf{d}(\theta, \omega_{1})| \ldots |\mathbf{d}(\theta, \omega_{r-1})] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where each $\mathbf{d}(\theta, \omega_{i})$ is a column vector of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \mathbf{d}(\theta, \omega_{i}) = [ e^{-j \omega_{i} \tau_{0}}, \ldots, e^{-j \omega_{i} \tau_{M-1}} | e^{-j \omega_{i} (\tau_{0} + T_{s})}, \ldots, e^{-j \omega_{i} (\tau_{M-1} + T_{s})} | \ldots | e^{-j \omega_{i} (\tau_{0} + (J-1)T_{s})}, \ldots, e^{-j \omega_{i} (\tau_{M-1} + (J-1)T_{s})}]^{T}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $M$ is the number of sensors, $J$ is the length of the attached FIR filter, $T_{s}$ is the sampling interval, and $\tau_{i}$ is the delay of the signal coming from angle $\theta$ to the $i$th sensor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I create this matrix and compute the SVD via zgesvd_ , I get only one significant singular value. The literature says the rank should be $r$, ie the same as the number of columns of $C$, but this is not the case -- ie the columns have linear dependence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Why do they say this? Is there something I am missing? Has anyone else encountered this?&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wei Liu and Stephan Weiss. Wideband Beamforming: Concepts and Techniques. Wiley. 2010. pp. 33-35&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kevin M. Buckley. Spatial/Spectral Filtering with Linearly Constrained Minimum Variance Beamformers. IEEE Trans. Acoustics, Speech, and Signal Processing. March 1987 pp.249-266&lt;/p&gt;&#xA;" OwnerUserId="19259" LastEditorUserId="19259" LastEditDate="2016-01-27T16:16:50.530" LastActivityDate="2016-01-27T16:16:50.530" Title="The Rank Of Broadband LCMV Beamformer Constraint Matrix" Tags="|c|beamforming|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28481" PostTypeId="1" CreationDate="2016-01-26T17:55:17.227" Score="0" ViewCount="1164" Body="&lt;p&gt;What is the most efficient pitch detection algorithms in terms of computation? I need something to implement on a DSP.&#xA;The typical signal in my situation would be a mixture of low-level wide-band noise plus a series of strong harmonics below 1000 Hz (think of the noise produced by industrial machinery or by car engines). The system needs to sample (&quot;know&quot;) the current fundamental frequency of the signal every second or so.&lt;/p&gt;&#xA;" OwnerUserId="18997" LastEditorUserId="18997" LastEditDate="2016-01-26T18:23:27.420" LastActivityDate="2016-02-25T18:26:35.810" Title="Efficient real-time pitch detection algorithm" Tags="|audio|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28482" PostTypeId="2" ParentId="28481" CreationDate="2016-01-26T18:07:56.960" Score="-2" Body="&lt;p&gt;YINS fft is the best method that worked for me in the past. I have my open source implementation of it written in awesome D language: &lt;a href=&quot;https://github.com/kerdemdemir/YINS-FFT-DLANG&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; . I compared the results with Praat they match. &lt;/p&gt;&#xA;" OwnerUserId="5392" LastActivityDate="2016-01-26T18:07:56.960" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28483" PostTypeId="1" AcceptedAnswerId="28484" CreationDate="2016-01-26T18:58:29.150" Score="2" ViewCount="224" Body="&lt;p&gt;Assuming the system $h[n]$ is LTI (and has an associated $H(z)$ transform), is the &lt;strong&gt;whole&lt;/strong&gt; system below LTI?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/GQQ3j.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the impulse response of the system and I got that it is $$h_{0}[n]=\alpha ^{-n}\cdot h[n]$$&#xA;where $h_{0}[n]$ is $y[n]$ when $x[n]=\delta [n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That doesn't give us much information, so I thought of testing the system with the input signal being a complex exponential (i.e. $x[n]=a^{n}$). Because complex exponentials are eigenfunctions of LTI systems, if the output is not something like $y[n]=z^{n}\cdot H(z)$ then the system would not be LTI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the output with $x[n]=a^{n}$ turned out to be $$y[n]=a^{n}\cdot H(a\cdot \alpha)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, apparently, complex exponentials are eigenfunctions of the whole system. Also, I think that $H_{0}(z)=H(z\cdot \alpha)$. Is that right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this enough to affirm that the &lt;strong&gt;whole&lt;/strong&gt; system &lt;strong&gt;is&lt;/strong&gt; LTI? Or does it just prove that it &lt;strong&gt;could&lt;/strong&gt; be LTI?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time!&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="4298" LastEditDate="2016-01-26T19:25:35.330" LastActivityDate="2016-01-26T19:25:35.330" Title="Is this system LTI?" Tags="|linear-systems|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28484" PostTypeId="2" ParentId="28483" CreationDate="2016-01-26T19:18:28.223" Score="3" Body="&lt;p&gt;You are right that determining the response to an impulse will generally not lead to any useful description of system behavior, unless the system is LTI. Your reasoning using eigenfunctions is correct. However, I would approach the problem as follows. If (and only if) the input/output relation can be formulated as a convolution of the input signal with a sequence that is independent of the input signal (the impulse response), then the system is LTI. And this is indeed possible:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}y[n]&amp;amp;=\alpha^{-n}\sum_{k=-\infty}^{\infty}x[k]\alpha^kh[n-k]\\&amp;amp;=\sum_{k=-\infty}^{\infty}x[k]\alpha^{-(n-k)}h[n-k]\\&amp;amp;=\sum_{k=-\infty}^{\infty}x[k]\tilde{h}[n-k]\end{align}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\tilde{h}[n]=\alpha^{-n}h[n]$ is the impulse response of the total system, as you've already found out by yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\mathcal{Z}$-transform of $\tilde{h}[n]$ is indeed easily expressed in terms of $H(z)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{H}(z)=\sum_{n=-\infty}^{\infty}\tilde{h}[n]z^{-n}=\sum_{n=-\infty}^{\infty}h[n]\alpha^{-n}z^{-n}=H(\alpha z)$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-26T19:18:28.223" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28485" PostTypeId="1" AcceptedAnswerId="28504" CreationDate="2016-01-26T19:41:04.350" Score="5" ViewCount="20907" Body="&lt;p&gt;I have an exam next week and it's verty certain that a task of this kind will be there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there some good tips how to match the right pole zero plot to the right responses? No proof is needed in the task. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment I try to find two of the same kind and kinda guess which of the two same looking responses could be which. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I know so far for the impulse response:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Amount of zeros = amount of poles -&gt; dirac impulse at 0&lt;/li&gt;&#xA;&lt;li&gt;Complex conjugated poles cause oscillation &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For the magnitude response:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Zeros in the left half plane have low pass characteristics/highpass charactresistics in the right half plane&lt;/li&gt;&#xA;&lt;li&gt;Poles outside the unit circle means unstable system&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Are there quick ways without computing $\left\{\left|H(e^{j \Omega } )\right|\right\}$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GGMGi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GGMGi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For A:&lt;/strong&gt; &#xA;zero at z=1, and complex poles, so it has to be one of the oscillating impulse responses: 1 or 5. D has the poles closer together so it oscialltes less, so D is probably 1 and A is 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For B&lt;/strong&gt;&#xA;Zeros are symmetric so magnitude response is probably symmetric.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For C&lt;/strong&gt;&#xA;Amount of zeros = amount of poles, so dirac at 0 (2 or 3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For D&lt;/strong&gt;&#xA;See A&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For E&lt;/strong&gt; &#xA;No idea, should have a dirac at 0, but no oscillation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really unsure about the magnitude responses.&lt;/p&gt;&#xA;" OwnerUserId="19225" LastEditorUserId="1629" LastEditDate="2016-01-27T14:23:26.397" LastActivityDate="2016-01-27T14:37:42.953" Title="Identifying the magnitude and impulse response from pole zero plot quickly" Tags="|impulse-response|z-transform|magnitude|poles-zeros|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28486" PostTypeId="1" AcceptedAnswerId="28488" CreationDate="2016-01-26T20:22:06.200" Score="0" ViewCount="174" Body="&lt;p&gt;How do I prove that the absolute value of CTFT of a positive continuous time signal is less than or equal to its value at central frequency(0)?&lt;/p&gt;&#xA;" OwnerUserId="11977" LastActivityDate="2016-01-26T21:20:56.000" Title="Proof of a CTFT property" Tags="|continuous-signals|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28487" PostTypeId="2" ParentId="248" CreationDate="2016-01-26T20:51:16.073" Score="1" Body="&lt;p&gt;I have spent a lot of time &lt;a href=&quot;http://dx.doi.org/10.1109/TSP.2009.2023947&quot; rel=&quot;nofollow&quot;&gt;optimizing windows in time-frequency analysis or filter-banks&lt;/a&gt;. One can optimize them for detection, denoising, signal separation... It is very dependant on the application. As time-frequency analysis is generally redundant, optimizing analysis or synthesis  windows are different tasks. And length only one parameter in window design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is even more complex as the discretized formulation of optimality is &#xA;much more complicated than the continuous time-domain case (see e.g. &lt;a href=&quot;http://dx.doi.org/10.1007/s10444-013-9337-9&quot; rel=&quot;nofollow&quot;&gt;An optimally concentrated Gabor transform for localized time-frequency components&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my present practical rule of thumb is: start with a window shape and length that seems ok. Then repeat the analysis with two windows with twice and half the length, and combine the results.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-01-26T20:51:16.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28488" PostTypeId="2" ParentId="28486" CreationDate="2016-01-26T21:20:56.000" Score="1" Body="&lt;p&gt;If $f(t)$ is a real non-negative function with Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=\int_{-\infty}^{\infty}f(t)e^{-j\omega t}dt\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the following must hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|F(\omega)|=\left|\int_{-\infty}^{\infty}f(t)e^{-j\omega t}dt\right|\le\int_{-\infty}^{\infty}|f(t)|dt=\int_{-\infty}^{\infty}f(t)dt=F(0)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since $f(t)=|f(t)|$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-26T21:20:56.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28490" PostTypeId="1" AcceptedAnswerId="28550" CreationDate="2016-01-26T21:37:52.050" Score="0" ViewCount="462" Body="&lt;p&gt;Given the system defined in the following figure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/W6HGD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/W6HGD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a system $ G \left( f \right) $ which is unknown yet can be defined by $ {N}_{p} $ poles and $ {N}_{z} $ zeros.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal $ x \left( t \right) $ is an IID White Noise.&lt;br&gt;&#xA;This signal samples can not be accessed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal $ y \left( t \right) $ is the colored noise (Filtered).&lt;br&gt;&#xA;This signal samples are available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter $ H \left( f \right) $ is adaptive (Time changing).&lt;br&gt;&#xA;Its model, which is to be determined, is given by $ {N}_{z} $ poles and $ {N}_{p} $ zeros. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal $ z \left( t \right) $ is the result of the $ H \left( f \right) $ Filter.&lt;br&gt;&#xA;This signal samples are available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can one set the parameters (Poles and Zeros) of $ H \left( f \right) $ such that $ z \left( t \right) $ is White Noise?&lt;br&gt;&#xA;This means how to adaptively set the parameters of $ H \left( f \right) $ to be the inverse filter of $ G \left( f \right) $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually those kind of problems are solved using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Least_mean_squares_filter&quot; rel=&quot;noreferrer&quot;&gt;Least Mean Square Filter&lt;/a&gt; yet since the samples of $ x \left( t \right) $ aren't accessible it is not the classic model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any other way to set the parameters of $ H \left( f \right) $ s.t. its output, $ z \left( t \right) $, is white noise without requiring access to $ x \left( t \right) $?&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2017-01-23T13:11:28.667" Title="Channel Estimation / Equalization - Estimate Channel Inverse Using White Noise Statistics Only" Tags="|filters|noise|estimation|linear-systems|adaptive-filters|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28491" PostTypeId="1" AcceptedAnswerId="28495" CreationDate="2016-01-27T01:06:23.370" Score="2" ViewCount="167" Body="&lt;p&gt;Consider an LTI system whose impulse response is $$h[n]=\frac{1}{2^n}u[n]+\frac{1}{3^n}u[n]$$&#xA;The input signal to this system is $x[n]$ and is null for $n&amp;lt;0$ but may or may not be null for $n=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the difference equation, which turned out to be $$y[n]-\frac{5}{6}y[n-1]+\frac{1}{6}y[n-2]=2x[n]-\frac{5}{6}x[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the instruction goes as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is desired to compute the output $y[n]$ for $n=0,1,...,1000$ with the input signal being the same $x[n]$. Determine the impulse response $\hat{h}[n]$ of the &lt;strong&gt;minimum-sized&lt;/strong&gt; FIR system whose output $\hat{y}[n]$ equals $y[n]$ for $n=0,1,...,1000$ and find the difference equation of that FIR filter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't know for certain how to deal with this. My first attempt consisted of establishing that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{h}[n]=\left\{&#xA;	\begin{array}{ll}&#xA;		h[n]  &amp;amp; \mbox{if } 0\leq n\leq 1000 \\&#xA;		0 &amp;amp; \mbox{otherwise }&#xA;	\end{array}&#xA;\right.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if that is correct. I just thought that, due to the causality of both $h[n]$ and $x[n]$, the convolution between them would be exactly the same for the first 1001 values if $h[n]$ were cut off at $n=1000$. I named $\hat{h}[n]$ that cut-off version of the first impulse response. Nevertheless, I'm really doubtful about this reasoning. On top of it, I don't even know if that response is the shortest possible as I am asked to find in the exercise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that the expression above for $\hat{h}[n]$ is okay, it can be expressed as $$\hat{h}[n]=\frac{1}{2^n}(u[n]-u[n-1001])+\frac{1}{3^n}(u[n]-u[n-1001])$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some algebra, that equation becomes impossible to deal with. The $\hat{H}(z)$ has a 1001st grade polynomial in its numerator and a 2nd grade one in its denominator. Because the filter is a FIR one, those poles should be cancelled by two of the zeros of the numerator, but it's just impossible to find the zeros of a 1001st grade polynomial, so I really don't think that this is the way to solve this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-01-27T07:54:43.080" Title="Problem designing a specific FIR filter" Tags="|filter-design|z-transform|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28492" PostTypeId="2" ParentId="28359" CreationDate="2016-01-27T01:31:01.930" Score="0" Body="&lt;p&gt;The spectrum of white noise is flat, constant. If you pass that through a low-pass filter, you'll get a rectangle, which translated back into the time domain becomes a sinc. Of course, you are not dealing with perfectly white noise, but it seems to be close enough for you to observe what you did.&lt;/p&gt;&#xA;" OwnerUserId="1059" LastActivityDate="2016-01-27T01:31:01.930" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28495" PostTypeId="2" ParentId="28491" CreationDate="2016-01-27T07:54:43.080" Score="1" Body="&lt;p&gt;Think about how the output signal $y[n]$ is computed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}y[0]&amp;amp;=x[0]h[0]\\&#xA;y[1]&amp;amp;=x[1]h[0]+x[0]h[1]\\&#xA;y[2]&amp;amp;=x[2]h[0]+x[1]h[1]+x[0]h[2]\\\vdots\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the first equation above you know that the first coefficients of the FIR filter must equal $h[0]$. The second equation gives you $h[1]$ as the second coefficient, etc. So your intuition was correct: the FIR filter's impulse response is just a truncated version of the original impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For finding the difference equation, you don't need to compute any zeros or poles, you just need the coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]h[0]+x[n-1]h[1]+\ldots +x[n-1000]h[1000]=\sum_{k=0}^{1000}h[k]x[n-k]$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-27T07:54:43.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28496" PostTypeId="1" CreationDate="2016-01-27T08:35:14.127" Score="3" ViewCount="295" Body="&lt;p&gt;I am now reading about Code Division Multiple Access method (&lt;strong&gt;CDMA&lt;/strong&gt;), which is used for &lt;strong&gt;multiple&lt;/strong&gt; hosts to send data at the &lt;strong&gt;same&lt;/strong&gt; time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main idea behind it is to use &lt;strong&gt;orthogonal vector basis&lt;/strong&gt; to encode multiple bit streams into one, send the joined stream across the link, then decode the stream differently for every separate message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What confuses me is that in digital logic &lt;strong&gt;negative&lt;/strong&gt; numbers are introduced, as well as 0 indicating &lt;strong&gt;no signal&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I first heard that such encoding exists, my first idea of how it should work was different from the original and it looks way simpler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Could someone check and add comments to my method? WHY is it not used instead of ORIGINAL CDMA?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Outline of my solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take &lt;strong&gt;n&lt;/strong&gt; orthogonal vectors (where &lt;strong&gt;xor&lt;/strong&gt; is the addition operation in my vector space), each vector corresponding to one chip code. I then encode every bit as a &lt;strong&gt;chip code&lt;/strong&gt; if it is &lt;strong&gt;1&lt;/strong&gt;, as &lt;strong&gt;0 otherwise&lt;/strong&gt;. Finally, I &lt;strong&gt;xor&lt;/strong&gt; all bit sequences together and send the joined result. At the other end, recipient can &lt;strong&gt;decompose&lt;/strong&gt; the bit stream into &lt;strong&gt;unique&lt;/strong&gt; components and read the message of every host.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution in more details&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Assumptions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;There are &lt;strong&gt;n&lt;/strong&gt; hosts (numbered from &lt;strong&gt;0&lt;/strong&gt; up to &lt;strong&gt;n - 1&lt;/strong&gt;), and &lt;strong&gt;all&lt;/strong&gt; of them want to send &lt;strong&gt;b&lt;/strong&gt; bits at the &lt;strong&gt;same time&lt;/strong&gt; using the &lt;strong&gt;same link&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The receiver gets a &lt;strong&gt;joined&lt;/strong&gt; bit stream, but is interested in reading the message of only &lt;strong&gt;one&lt;/strong&gt; host (WLOG the message sent from the 0-th host).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: create a &lt;strong&gt;protocol&lt;/strong&gt; that would satisfy the assumptions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;My solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For &lt;strong&gt;i-th&lt;/strong&gt; host, assign a &lt;strong&gt;chip code&lt;/strong&gt; to him of the form &lt;strong&gt;2^i&lt;/strong&gt; (power not xor here) written in &lt;strong&gt;binary&lt;/strong&gt;. Call this chip code &lt;strong&gt;c(i)&lt;/strong&gt;. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Chip code 1000..00 would be given to host 0 &#xA;Chip code 0100..00 would be given to host 1&#xA;...&#xA;Chip code 0000..01 would be given to host n-1.&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Every &lt;strong&gt;single&lt;/strong&gt; bit will be encoded using &lt;strong&gt;n&lt;/strong&gt; bits.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (host i wants to send 0) {&#xA;    encode it as 0000...00  // n zeroes &#xA;} else {&#xA;    encode it as c(i)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For host &lt;strong&gt;i&lt;/strong&gt; wishing to send &lt;strong&gt;j-th&lt;/strong&gt; bit, call the encoded bit as &lt;strong&gt;e(i, j)&lt;/strong&gt;. For example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (host i wants to send a bit stream, such that j-th bit is 1) { &#xA;    e(i, j) = c(i)&#xA;} else {&#xA;    e(i, j) = 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For every &lt;strong&gt;j&lt;/strong&gt;, compute &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;d(j) = e(0, j) ^ e(1, j) ^ ... ^ e(n - 1, j)  // xor operation here&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Concatenate&lt;/strong&gt; d(0), d(1), ... d(n - 1) and send these &lt;strong&gt;n * b&lt;/strong&gt; bits through the link. This will be the joined stream that the recipient at the other end should receive.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The recipient wishing to read the data sent by &lt;strong&gt;host 0&lt;/strong&gt; can look at (&lt;strong&gt;0&lt;/strong&gt;-&lt;em&gt;th&lt;/em&gt;, &lt;strong&gt;n&lt;/strong&gt;-&lt;em&gt;th&lt;/em&gt;, &lt;strong&gt;2n&lt;/strong&gt;-&lt;em&gt;th&lt;/em&gt;, ..., &lt;strong&gt;b(n-1)&lt;/strong&gt;-&lt;em&gt;th&lt;/em&gt;) bits to see what the first host has sent.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The solution is &lt;strong&gt;simpler&lt;/strong&gt; than original, because it uses &lt;strong&gt;only&lt;/strong&gt; xor operation for encoding, and digits are &lt;strong&gt;only binary&lt;/strong&gt; (i.e. no -2, +3 when doing vector addition). QED.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Does this solution work? If yes, why is it not used?&lt;/em&gt; The best reason I could guess is that we want to distinguish between hosts sending &lt;strong&gt;something&lt;/strong&gt; and &lt;strong&gt;nothing&lt;/strong&gt;. &lt;em&gt;Are there other reasons&lt;/em&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside question: &lt;em&gt;what are &quot;nearly orthogonal&quot; vectors in the context of CDMA?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="19266" LastActivityDate="2016-01-27T23:29:33.977" Title="Why is CDMA so complicated, wouldn't this simpler solution work?" Tags="|digital-communications|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28497" PostTypeId="1" CreationDate="2016-01-27T09:20:14.527" Score="3" ViewCount="1655" Body="&lt;p&gt;I'm wondering if there is a technique by which to analyze an existing sound recording and extract some details of the reverb and echo that are present (either due to natural environment, or added during production). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there software packages or libraries that implement that sort of analysis? (Is there even a chance of recovering the audio minus the reverb?)&lt;/p&gt;&#xA;" OwnerUserId="19267" LastEditorUserId="19267" LastEditDate="2016-01-27T09:39:52.940" LastActivityDate="2021-09-21T02:17:18.840" Title="How to analyze reverb in existing sound recording?" Tags="|signal-analysis|audio|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28499" PostTypeId="2" ParentId="28497" CreationDate="2016-01-27T10:36:49.397" Score="1" Body="&lt;p&gt;You may be able to reverse engineer the reverb if you have a segment of relatively clean reverb 'tail'. This will allow you to play around and get some metrics such as decay time and frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Convolution_reverb&quot; rel=&quot;nofollow&quot;&gt;Convolution reverb&lt;/a&gt; works by recording an impulse response in a particular location/machine after a burst of noise. This is then convolved with the input signal to apply the reverb.&lt;/p&gt;&#xA;" OwnerUserId="8667" LastActivityDate="2016-01-27T10:36:49.397" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28501" PostTypeId="1" AcceptedAnswerId="28503" CreationDate="2016-01-27T10:54:59.537" Score="0" ViewCount="306" Body="&lt;p&gt;I need to find a way to create some fractional delay in a signal processing application that I am working on. Separately to this, I have been messing around with basic filter design (despite reading alot about them, including in the Scientists and engineers guide to DSP, I have still only basic understanding of filters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the course of this experimentation, I noticed that one of the random filters I was messing around with caused a delay of 3 samples, and that the impulse response was centred at 3 samples. I have gone back over relevant pages in the DSP guide and now understand what it says better, and that this should be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, by my current understanding, if I was to create a filter with an impulse response of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1, 0, 0, 0, 0, 0   (starting at sample 0)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it would pass the signal unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if I had an impulse response of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0, 0, 1, 0, 0, 0   (starting at sample 0)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it would pass the signal unchanged aside from a delay of 2 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, could I create a filter that gives fractional delay by interpolating the impulse response? As an example, if I wanted a delay of 0.75 samples, could I create a filter with this impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0.25, 0.75, 0, 0, 0, 0   (starting at sample 0)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and if I wanted a time delay of 2.4 samples, an impulse response of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0, 0, 0.6, 0.4, 0, 0   (starting at sample 0)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware that these filters would be very much sample rate dependant in terms of the real time shifts they created, but that could be easily accounted for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers in advance for any help,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pete&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sorry if the impulse response notation is a bit crummy, I'm not really sure how the best way to write it would be&lt;/p&gt;&#xA;" OwnerUserId="19240" LastEditorUserId="19240" LastEditDate="2016-01-27T11:59:33.400" LastActivityDate="2022-08-03T13:27:16.290" Title="Interpolated impulse response for fraction delay?" Tags="|filter-design|impulse-response|interpolation|finite-impulse-response|delay|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28502" PostTypeId="2" ParentId="16157" CreationDate="2016-01-27T11:10:13.813" Score="1" Body="&lt;p&gt;As suggested by @Drazick, I post as an answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good code according to the comments:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure;&#xA;n = 2e3;&#xA;t = 1:n;&#xA;m = n/2+1;&#xA;f = linspace(0,1,m);&#xA;x = rand(1,n) - 0.5;&#xA;y = fft(x);&#xA;subplot(2,2,1); plot(t,x,'k'); &#xA;axis tight; xlabel('t/s'); title('original signal x');&#xA;subplot(2,2,2); plot(f,abs(y(1:m)),'k'); &#xA;axis tight; xlabel('f/hz'); title('original spectrum');&#xA;y1 = y ./ abs(y);&#xA;x1 = real(ifft(y1));&#xA;y2 = fft(x1);&#xA;x2 = real(ifft(y2));&#xA;subplot(2,2,3); plot(t,x1,'k',t,x2-x1,'r'); &#xA;axis tight; xlabel('t/s'); title('whitened signal x1(black) and x2-x1(red)');&#xA;subplot(2,2,4); plot(f,abs(y1(1:m)),'k',f,abs(y2(1:m)),'r');&#xA;axis tight; xlabel('f/hz'); title('whitened spectrum y1(black) and y2(red)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The spectrum is flat after whitening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CAQBb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CAQBb.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8863" LastActivityDate="2016-01-27T11:10:13.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28503" PostTypeId="2" ParentId="28501" CreationDate="2016-01-27T12:33:53.987" Score="0" Body="&lt;p&gt;Unfortunately fractional delays are much more complicated than this. Your example would create a filter where delay and amplitude are significantly dependent on frequency.&#xA;I strongly suggest reading &lt;a href=&quot;https://ieeexplore.ieee.org/document/482137&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ieeexplore.ieee.org/document/482137&lt;/a&gt;&#xA;and&#xA;&lt;a href=&quot;https://ccrma.stanford.edu/%7Ejos/Interpolation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ccrma.stanford.edu/~jos/Interpolation/&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="7092" LastEditDate="2022-08-03T13:27:16.290" LastActivityDate="2022-08-03T13:27:16.290" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28504" PostTypeId="2" ParentId="28485" CreationDate="2016-01-27T12:52:18.497" Score="3" Body="&lt;p&gt;Some of the cues you want to look for are the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A zero &lt;em&gt;on&lt;/em&gt; the unit circle causes a zero in the magnitude response at the corresponding frequency ($z=1$ is DC, and $z=-1$ is Nyquist)&lt;/li&gt;&#xA;&lt;li&gt;For a zero at DC ($z=1$), the sum of all impulse response coefficients must be zero.&lt;/li&gt;&#xA;&lt;li&gt;A zero near the unit circle causes a dip in the magnitude response at the corresponding frequency. The closer the zero to the circle the more pronounced the dip.&lt;/li&gt;&#xA;&lt;li&gt;A pole close to the unit circle causes a peak in the magnitude response at the corresponding frequency. The closer to the circle the sharper the peak.&lt;/li&gt;&#xA;&lt;li&gt;Complex conjugate poles cause oscillation. The closer to the unit circle they are, the slower does the impulse response decay.&lt;/li&gt;&#xA;&lt;li&gt;If all poles are at the origin, the impulse response has a finite length (FIR).&lt;/li&gt;&#xA;&lt;li&gt;If there are fewer (finite) zeros than poles then the first few samples of the impulse response are zero. The number of zero coefficients equals the difference between the number of poles and (finite) zeros.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For PZ-plot A, the magnitude response must be zero at DC and it must peak at $\pi/2$ (i.e., at $0.5$ in the magnitude plot). The impulse response (IR) must be oscillating and its values must add up to zero (which you can of course check only approximately). Furthermore, since there are two poles and only one zero, the first IR coefficient must be zero. So we are left with IRs 1 and 5, and with magnitudes b and c. Since we have a PZ-plot which is qualitatively the same as A (namely D), just with a smaller pole radius, we can easily guess that the peakier magnitude and the more slowly decaying IR correspond to A, whereas the others correspond to D. So we get&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A-5-b&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;D-1-c&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;PZ-plot B must be FIR (all poles in the origin), and the first coefficients must be zero (3 poles, only 2 zeros). The magnitude must be symmetrical with respect to $\pi/2$ ($0.5$ in the magnitude plot), and there must be (equal) dips at DC and at Nyquist. Only magnitue plot &quot;a&quot; satisfies these criteria. The only matching finite IR is &quot;4&quot;. So we have&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;B-4-a&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;PZ-plot C is also FIR, and the first coefficient is not zero (because the number of poles equals the number of zeros). The magnitude must have a slight dip at $0.5$ and it must be symmetrical (because the PZ-plot is). This gives&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;C-2-e&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This would leave us with&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;E-3-d&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but the latter is non-sense, as I've mentioned in my comments. The PZ-plot E corresponds to a finite IR, but that IR must be complex valued. From the plot, let's estimate the zero at $0.8j$, which gives us&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=c\cdot (1-0.8jz^{-1})\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with an arbitrary scaling constant $c\neq 0$. This corresponds to an impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=c(\delta[n]-0.8j\delta[n-1])\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is obviously complex-valued. The magnitude response must have a dip at 0.5, but no dip at -0.5 (note that for real-valued impulse responses the magnitude response is symmetrical). IR 3 is just an impulse at zero, so the corresponding PZ-plot must be empty, because there are neither poles nor zeros. IR 3 just shows the &lt;em&gt;real part&lt;/em&gt; of the actual impulse response. The magnitude response &quot;d&quot; can be the response corresponding to E, but only for positive frequencies, which are not sufficient to characterize the system. So the PZ-plot E is misleading, to say the least. The same is true for the single impulse shown in 3, because it corresponds to none of the PZ-plots and to none of the magnitude plots shown in the figure.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-01-27T14:37:42.953" LastActivityDate="2016-01-27T14:37:42.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28508" PostTypeId="2" ParentId="28501" CreationDate="2016-01-27T15:30:53.977" Score="0" Body="&lt;p&gt;A windowed Sinc interpolator with a kernel of sufficient width would be better (have lower stop-band noise) than a two point linear interpolation.  You can offset the windowed Sinc to get fractional delays.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-27T15:30:53.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28509" PostTypeId="2" ParentId="28496" CreationDate="2016-01-27T15:34:26.163" Score="1" Body="&lt;p&gt;Your solution works, and it is known by the name &quot;time division multiple access&quot; (TDMA). Basically, you assign time slots to each transmitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CDMA has several advantages compared to TDMA, but it also has its own disadvantages. Both schemes are inferior to more modern techniques such as OFDMA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Main disadvantages of TDMA:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;With data rate constant, the time slices become narrower as the number of transmitters increases. This means that the bandwidth also increases. With CDMA, you can increase the number of transmitters without increasing the bandwidth, by adding orthogonal code words.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;TDMA requires very precise synchronization between transmitters. It is very hard to keep a large number of mobile units synchronized so that they won't transmit during the time slot of another unit. This may be solved using guardbands, but that decreases efficiency.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A couple of advantages of CDMA:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;More resistance to fading and multipath. CDMA reflections are orthogonal to each other, so they cancel out.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the codes are private, then there's a measure of inherent privacy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-01-27T23:29:33.977" LastActivityDate="2016-01-27T23:29:33.977" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="28512" PostTypeId="1" CreationDate="2016-01-27T17:04:51.963" Score="0" ViewCount="2218" Body="&lt;p&gt;The matrix pencil method is an algorithm which can be used to find the individual exponential decaying sinusoids' parameters (frequency, amplitude, decay factor and initial phase) in a signal consisting of multiple such signals added. I am trying to implement the algorithm. The algorithm can be found in the paper from &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=370583&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt; or &lt;a href=&quot;http://krein.unica.it/~cornelis/private/IEEE/IEEEAntennasPropagMag_37_48.pdf&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to test the algorithm, I created a synthetic signal composed of four exponentially decaying sinusoids generated as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fs=2205;&#xA;t=0:1/fs:249/fs;&#xA;f(1)=80;&#xA;f(2)=120;&#xA;f(3)=250;&#xA;f(4)=560;&#xA;a(1)=.4;&#xA;a(2)=1;&#xA;a(3)=0.89;&#xA;a(4)=.65;&#xA;d(1)=70;&#xA;d(2)=50;&#xA;d(3)=90;&#xA;d(4)=80;&#xA;for i=1:4&#xA;    x(i,:)=a(i)*exp(-d(i)*t).*cos(2*pi*f(i)*t);&#xA;end&#xA;y=x(1,:)+x(2,:)+x(3,:)+x(4,:);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then feed this signal to the algorithm described in the paper as follows: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [f d] = mpencil(y)&#xA;&#xA;%construct hankel matrix&#xA;N = size(y,2);&#xA;L1 = ceil(1/3 * N);&#xA;L2 = floor(2/3 * N);&#xA;L = ceil((L1 + L2) / 2);&#xA;&#xA;fs=2205;&#xA;for i=1:1:(N-L)&#xA;    Y(i,:)=y(i:(i+L));&#xA;end&#xA;&#xA;Y1=Y(:,1:L);&#xA;Y2=Y(:,2:(L+1));&#xA;&#xA;[U,S,V] = svd(Y);&#xA;D=diag(S);&#xA;tol=1e-3;&#xA;m=0;&#xA;l=length(D);&#xA;for i=1:l&#xA;    if( abs(D(i)/D(1)) &amp;gt;= tol)&#xA;        m=m+1;&#xA;    end&#xA;end&#xA;Ss=S(:,1:m);&#xA;Vnew=V(:,1:m);&#xA;a=size(Vnew,1);&#xA;Vs1=Vnew(1:(a-1),:);&#xA;Vs2=Vnew(2:end,:);&#xA;Y1=U*Ss*(Vs1');&#xA;Y2=U*Ss*(Vs2');&#xA;D_fil=(pinv(Y1))*Y2;&#xA;z = eig(D_fil);&#xA;&#xA;l=length(z);&#xA;for i=1:2:l&#xA;    f((i+1)/2)= (angle(z(i))*fs)/(2*pi);&#xA;    d((i+1)/2)=-real(z(i))*fs;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the output from the above code, I am correctly getting the four constituent frequency components but am not getting their decaying factors. If anybody has prior experience with this algorithm or has some understanding about why this discrepancy might be there, I would be very grateful for your help. I have tried rewriting the code from a scratch multiple times but it has been of no help, giving the same results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="19272" LastEditorUserId="1629" LastEditDate="2016-05-20T06:29:56.893" LastActivityDate="2018-02-05T13:57:08.773" Title="Finding parameters of exponentially decaying sinusoids (Matrix Pencil Method)" Tags="|matlab|discrete-signals|algorithms|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28514" PostTypeId="1" AcceptedAnswerId="28541" CreationDate="2016-01-27T18:28:35.157" Score="1" ViewCount="4819" Body="&lt;p&gt;So I would like to have a design method for filters with 3dB and 6dB per octave roll off -- for generating pink and brown noise respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the following 'pinking' filters exist:&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/27520/filter-to-add-3db-per-octave&quot;&gt;Filter to add 3dB per octave?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the poster says he doesn't remember the value for A, nor does he give any idea of how he did it in the first place. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;So my main question is:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How do we pick the poles and zeros of such a filter?&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="19259" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-01-29T21:49:31.173" Title="3dB and 6dB Per Octave Rolloff Digital Filters / Generating Pink and Brown Noise" Tags="|filters|filter-design|noise|c|octave|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28515" PostTypeId="2" ParentId="28514" CreationDate="2016-01-27T18:43:48.260" Score="3" Body="&lt;p&gt;-6 dB / octave is trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a common reference for a pinking filter is &lt;a href=&quot;http://www.firstpr.com.au/dsp/pink-noise/&quot; rel=&quot;nofollow&quot;&gt;http://www.firstpr.com.au/dsp/pink-noise/&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-01-27T18:43:48.260" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="28516" PostTypeId="2" ParentId="28512" CreationDate="2016-01-27T19:24:34.587" Score="1" Body="&lt;p&gt;In his book, &lt;a href=&quot;http://epubs.siam.org/doi/abs/10.1137/1013112&quot; rel=&quot;nofollow&quot;&gt;Numerical Methods that Work&lt;/a&gt;, Forman S. Acton writes, page 253:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For it is  well known that an exponential equation of this type [$y=Ae^{-at}+Be^{-bt}$] in which all four parameters are to be fitted is extremely ill conditionned. That is, there are many combinations of $(a,b,A,B)$ that will fit most exact data quite well indeed (will you believe four significant figures? and when experimental noise is thrown into into the pot, the entire operation becomes hopeless. But those with Faith in Science...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A four exponential sum seems quite ill-posed to me, yet there have been recent advances using sparsity assumptions or more involved optimization algorithms. Recent examples can be found for instance in &lt;a href=&quot;http://arxiv.org/pdf/1310.7095.pdf&quot; rel=&quot;nofollow&quot;&gt;Parameter estimation of monomial-exponential sums&lt;/a&gt; or &lt;a href=&quot;http://doi.org/10.1137/100790094&quot; rel=&quot;nofollow&quot;&gt;Nonlinear Approximation by Sums of Exponentials and Translates&lt;/a&gt;, or citations thereof (I have not had the opportunity to test them by myself.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="80" LastEditDate="2016-04-19T19:55:15.317" LastActivityDate="2016-04-19T19:55:15.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28518" PostTypeId="1" CreationDate="2016-01-27T21:36:06.630" Score="0" ViewCount="334" Body="&lt;p&gt;I am working on an audio upsampling/oversampling project where I am testing different interpolating schemes in hardware and comparing measurements to my expected results. In one of my interpolating strategies, linear (first-order-hold), I am measuring unexpected FFT peaks centered around the Nyquist frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My setup is: between every two digital samples of recorded audio (44.1kHz), 15 intermediate samples are computed along a line (fixed point, in an FPGA). The 16x oversampled data is sent to a D/A (which zero-order-holds, obviously) and measured on a scope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results: if for example I am playing a tone signal of 2kHz, in FFT on oscilloscope I see main fundamental, small peak at (22.1-2)kHz, and a small peak at (22.1+2)kHz - unexpectedly! I also see as expected images centered around 44.1kHZ, 88.2kHZ, etc (these are also small, on account of linear interp./ZOH of DAC). I don't have any explicit analog processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theories: I honeslty don't know...but possibilities are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;scaling I do in FPGA to convert from 16 bit input to 20 bits for DAC&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;using fixed point arithmetic in FPGA (I don't ever overflow or anything, but it rounds everything so it's not exact to be sure)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;technically non-uniform sampling (I space the samples I created pretty evenly in time, but not perfectly...the last interpolated sample (i.e., #15 is held a little longer than the rest)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what gives?&lt;/p&gt;&#xA;" OwnerUserId="19278" LastEditorUserId="80" LastEditDate="2016-01-28T02:08:57.953" LastActivityDate="2016-08-25T12:37:20.230" Title="Noise Peaks Near Nyquist Frequency" Tags="|nyquist|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28520" PostTypeId="1" AcceptedAnswerId="28523" CreationDate="2016-01-27T22:23:53.637" Score="1" ViewCount="168" Body="&lt;p&gt;Suppose that I have a $H(z)$ and I sample it to get a DFT of 15 values. Let's call this DFT $H_{1}[k]$. Then, suppose I antitransform $H(z)$ and grab the first 10 values of the sequence, and then I add 5 zeros. After this, I calculate the DFT of this new sequence. Let's call it $H_{2}[k]$. What differences would these two DFTs have between each other (if any)?&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-01-28T03:21:03.313" Title="Sampling H(z) to get DFT" Tags="|sampling|dft|z-transform|" AnswerCount="2" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="28522" PostTypeId="2" ParentId="28520" CreationDate="2016-01-28T02:20:43.660" Score="0" Body="&lt;p&gt;Note that if your original H is not representative of a sufficiently time limited window, the sampling process will be lossy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H2 would be the transform of an even shorter time domain window.  A rectangular window in one DFT domain is equivalent to circular convolution with a Sinc function in the other DFT domain.  The shorter the rectangular window, the wider the Sinc, likely making H2 &quot;blurrier&quot; (unless the 5 zeroed values are already zero).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-01-28T02:40:18.077" LastActivityDate="2016-01-28T02:40:18.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28523" PostTypeId="2" ParentId="28520" CreationDate="2016-01-28T03:01:28.757" Score="2" Body="&lt;p&gt;When grabbing the first 10 samples of $h_1[n]$ you are essentially multiplying the whole sequence $h_1[n]$ with the rectangular window&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  w[n] = &#xA;\begin{cases} &#xA;  1 &amp;amp; 0 \leq n &amp;lt; 10 \\&#xA;  0 &amp;amp; \mbox{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whose DFT is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;  W\left[k\right]&#xA;    &amp;amp;= \sum_{n=0}^{9} e^{-j 2\pi k n / N} \\&#xA;    &amp;amp;= \frac{1 - e^{-j 2\pi k \cdot 10/15}}{1 - e^{-j 2\pi k / 15}}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the &lt;a href=&quot;https://en.wikibooks.org/wiki/Digital_Signal_Processing/Discrete_Fourier_Transform#Circular_Convolution_Theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;circular convolution theorem&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Multiplication in the discrete-time domain becomes circular convolution in the discrete-frequency domain. Circular convolution in the discrete-time domain becomes multiplication in the discrete-frequency domain.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In other words, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  \mbox{DFT}\left\{h_1[n] \cdot w[n]\right\}&#xA;  = \frac{1}{N} H_1\left[k\right] \otimes W\left[k\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\otimes$ is the circular convolution operator.&#xA;This can be seen with the following matlab script (you can play around with &lt;code&gt;h1&lt;/code&gt; to see what happens with other waveforms):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = [0:14]; % discrete-time index&#xA;k = [0:14];&#xA;h1 = sin(pi*n/14); % some arbitrary function&#xA;&#xA;% window function&#xA;w = [ones(1,10) zeros(1,5)];&#xA;&#xA;% time domain operation&#xA;h2  = h1.*w;&#xA;% convert to frequency domain&#xA;H2t = fft(h2);&#xA;&#xA;% frequency domain operation&#xA;W   = fft(w);&#xA;H1  = fft(h1);&#xA;H2f = cconv(W,H1) / 15;&#xA;&#xA;% Compare H2t &amp;amp; H2f&#xA;figure(1);&#xA;subplot(2,1,1);&#xA;hold off; plot(k, abs(H2t), 'b');&#xA;hold on;  plot(k, abs(H2t), 'bx');&#xA;hold on;  plot(k, abs(H2f), 'ro');&#xA;title('Magnitude');&#xA;subplot(2,1,2);&#xA;hold off; plot(k, angle(H2t), 'b');&#xA;hold on;  plot(k, angle(H2t), 'bx');&#xA;hold on;  plot(k, angle(H2f), 'ro');&#xA;title('Phase');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VxaVW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VxaVW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if $h_1[n]$ is already no longer than 10 samples (i.e. if those truncated samples are already zero), then windowing in the time-domain will have no effect and similarly the circular convolution with $W[k]$ in the frequency domain will happen to produce $H_1[k] = \frac{1}{N} H_1[k] \otimes W[k]$ (but &lt;em&gt;only&lt;/em&gt; as a special case). &lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="8952" LastEditDate="2016-01-28T03:21:03.313" LastActivityDate="2016-01-28T03:21:03.313" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28524" PostTypeId="1" CreationDate="2016-01-28T03:57:36.347" Score="-1" ViewCount="351" Body="&lt;p&gt;I am writing a program to compute the cross spectral density of an image, and a template image, which is the image I am trying to find in other image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading &lt;a href=&quot;https://en.wikipedia.org/wiki/Coherence_(signal_processing)&quot; rel=&quot;nofollow&quot;&gt;wiki1&lt;/a&gt;,&lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_density&quot; rel=&quot;nofollow&quot;&gt;wiki2&lt;/a&gt;,&lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation&quot; rel=&quot;nofollow&quot;&gt;wiki3&lt;/a&gt; from wikipedia, and from my knowledge of dsp I want to verify that I did this correctly because I keep getting 1 as my answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if I have two images of equal size in the fourier domain and point $(0,0)$ for one image is $3+2i$ and point $(0,0)$ of the other &quot;template&quot; (the image I am trying to find) is $4+2i$&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First I would do correlation so I take the conjugate of the template and multiply so I do $(3+2i)(4-2i)$ and get my $G_{xy}= 16+2i$&lt;/li&gt;&#xA;&lt;li&gt;Then I would auto correlate the image with itself $(3+2i)(3-2i)$ to get $13+0i$, and correlate the template with itself $(4+2i)(4-2i)$ and get $20+0i$. So my $G_{xx} = 13+0i$ and my $G_{yy} = 20+0i$&lt;/li&gt;&#xA;&lt;li&gt;Then I would get $\left|G_{xy}\right|^2$ which is $16^2 + 2^2 = 260$&lt;/li&gt;&#xA;&lt;li&gt;Lastly I would get the cross spectral coherence by doing the power of the cross correlation squared divided by the power of the image correlated with itself, multiplied by the power of template correlated with itself or $\frac {\left|G_{xy}\right|^2}{\left(G_{xx}G_{yy}\right)}$, or $\frac {260}{(13+0i)(20+0i)}$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As you can see I would get $1$, but I am unsure of what I am interpreting wrong in the wiki articles. Can someone be of assistance and enlighten me? Thanks&lt;/p&gt;&#xA;" OwnerUserId="16673" LastEditorUserId="1629" LastEditDate="2016-01-28T13:03:58.843" LastActivityDate="2016-01-28T21:12:35.323" Title="How to implement Cross Spectral Density" Tags="|fourier-transform|autocorrelation|correlation|magnitude|coherence|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ClosedDate="2016-01-28T22:26:32.457" ContentLicense="CC BY-SA 3.0" />
  <row Id="28526" PostTypeId="1" CreationDate="2016-01-28T08:24:44.480" Score="2" ViewCount="5147" Body="&lt;p&gt;How does formant shifting in synthesizers such as Reason's Maelstrom work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been pointed to the PSOLA algorithm among others, but I cannot understand how exactly does it result to formant shifting, because its base operation seems to be &quot;formant preserving pitch shifting&quot;.&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="4346" LastEditDate="2016-01-29T03:24:35.647" LastActivityDate="2023-09-05T01:13:33.783" Title="How does formant shifting work?" Tags="|audio|sola|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28527" PostTypeId="2" ParentId="28518" CreationDate="2016-01-28T08:59:36.243" Score="1" Body="&lt;p&gt;You're doing interpolation &quot;wrong&quot;, at least in the sense I assume you want it to happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you'd normally do is just take every input sample, and insert 15 &lt;em&gt;zeros&lt;/em&gt; in between each of them. Spectrally, the resulting signal would be your input signal, plus 14 images of it, spaced 1/15 of the output bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, your approach of sample and hold interpolation is the same signal, i.e. the zero padded one, unshifted, plus shifted by one sample, plus shifted by two..., plus shifted by 14 samples. So let $x$ be the input $y$ be the zero-padded and $w$ be your repetition-interpolated signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;x[n]&amp;amp;:=\text{input}\\&#xA;y[n] &amp;amp;= \begin{cases}&#xA;x[\frac{n}{15}]&amp;amp; \text{for}\, n\, \mathrm{mod}\, 15 = 0\\&#xA;0&amp;amp; \text{else}&#xA;\end{cases}\\&#xA;w[n] &amp;amp;= x\left[\left\lfloor \frac{n}{15}\right\rfloor\right]\\&#xA;&amp;amp;= x[n] + x[n-1] + \dots + x[n-14]\\&#xA;&amp;amp;= \sum_{l=0}^{14}x[n-l]&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the spectrum of $w$ is just that of $y$, superimposed with 14 phase-rotated versions of itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;W[z] &#xA;&amp;amp;= \sum_{l=0}^{14}\mathcal{Z}\left\{x[n-l]\right\}&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, you've built a signal whose 15 polyphase decomposition components are identical!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, that will lead to interesting effects. In contrast, if you did the usual interpolation, i.e. took my $y[n]$ and low-pass filtering it to its original Nyquist bandwidth (i.e. $\frac{1}{15}$ of the output rate) it, none of the  polyphase components of the resulting signal wouldn't be identical to the previous one -- they'd incorporate a phase shift that ensures continuity.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-28T08:59:36.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28530" PostTypeId="1" CreationDate="2016-01-28T10:56:08.233" Score="1" ViewCount="142" Body="&lt;p&gt;Creating a noise cancelling earphones that cancel/suppress speech is a huge challenge , maybe even impossible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what happens if we change the goals a bit:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;We need to cancel the noise(music,speech) coming from a tv in the same room. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We can receive what audio the tv will create , some time before it's created through the speaker. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Does it make it possible to create great noise cancellation ? how would it work ? &lt;/p&gt;&#xA;" OwnerUserId="10223" LastActivityDate="2016-01-28T11:24:21.083" Title="Noise cancellation for known sources" Tags="|noise|adaptive-filters|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28531" PostTypeId="2" ParentId="28530" CreationDate="2016-01-28T11:24:21.083" Score="2" Body="&lt;p&gt;If you have audio that will be played by TV beforehand, then this problem becomes almost similar to echo cancellation, i.e. adaptive filters could be used and cancellation will be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we have is the audio that will be played through TV, this audio will be used as reference for adaptive filter and input to the adaptive filter would be the capture(noisy music in earphone/headphone).&#xA;so adaptive filter will try to estimate the TV's audio in the earphone capture, then this estimate could be subtracted from earphone capture to get noise free(TV noise) music in earphone/headphone.   &lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-01-28T11:24:21.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28534" PostTypeId="1" CreationDate="2016-01-28T13:17:10.807" Score="0" ViewCount="565" Body="&lt;p&gt;Is it possible to extract DCT coefficients from H.264/AVC bitstream without doing a full-decoding of the video? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a lot of papers on &lt;em&gt;compressed domain&lt;/em&gt; video processing which are based on the assumption that DCT coefficients can be extracted through partial decoding and thus a lower computational complexity and faster than real time decoding can be achieved by using the DCT coefficients for various computer vision tasks (e.g. tracking, action recognition). However, nobody really describes the exact process of such partial decoding, and I seriously doubt it can be achieved with the recent video codecs such as H.264/AVC or H.265/HEVC. Does anybody have an insight on this one?&lt;/p&gt;&#xA;" OwnerUserId="8751" LastActivityDate="2016-04-17T12:57:36.257" Title="Extracting DCT coefficients from H.264/AVC bitstream" Tags="|computer-vision|video-processing|dct|video-compression|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28535" PostTypeId="1" CreationDate="2016-01-28T13:37:16.163" Score="4" ViewCount="2831" Body="&lt;p&gt;I found some explanation alongwith the Matlab Code &lt;a href=&quot;http://prod.sandia.gov/techlib/access-control.cgi/2005/057084.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here,&lt;/a&gt;&#xA;but I can't figure out, without a good example, why would this result in spectral zooming? (or develop some time intuition like viewing it as time resolution vs. frequency resolution thing). Any help (hopefully with an example) will be appreciated.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dDSNH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dDSNH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13339" LastEditorUserId="80" LastEditDate="2021-02-18T18:56:35.090" LastActivityDate="2021-02-18T18:56:35.090" Title="Can anyone explain how does CZT (Chirp Z Transform) really help in 'spectral zooming'?" Tags="|transform|music|linear-chirp|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28536" PostTypeId="2" ParentId="28535" CreationDate="2016-01-28T13:44:20.000" Score="3" Body="&lt;p&gt;This part of that paper suggests the answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7ZvNd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7ZvNd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue being that the standard FFT just does linearly-spaced spectral samples from $-f_s/2$ to $f_s/2$ where $f_s$ is the sampling frequency. The CZT allows for &#xA;arbitrary selection of the sampled points by selection of &lt;code&gt;f2&lt;/code&gt; and &lt;code&gt;f1&lt;/code&gt; in &lt;code&gt;w&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, as @johnnymopo says below,  the CZT is not limited to the unit circle: any part of the $z$-plane can be examined.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-02-01T15:51:44.320" LastActivityDate="2016-02-01T15:51:44.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28537" PostTypeId="1" CreationDate="2016-01-28T14:42:30.427" Score="6" ViewCount="445" Body="&lt;p&gt;I'm looking for a way to remove quasi-parallel curves from the net, as depicted in the figure. Not only the original nets (upper row in figure) contain many spurs, but also the curves to be detected are not necessary straight lines. Ideally, I'd like to keep only the border of each such a region (lower row in figure).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/45fNw.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/45fNw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've came across solutions like hit-or-miss with line structuring element, Hough transform and Radon transform - but they were aimed at either detecting long straight lines or arbitrary shapes (like ellipses).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea was to represent a net as a graph, linearly approximate each edge (and split it into smaller segments if it deviates from the approximated line too much), for each pixel store the slope of an approximated edge in a matrix, and finally for each pixel I'd search such a matrix in a given neighborhood for other pixels (belonging to a different edge) with a similar slope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you recommend me any method already used to accomplish such a task or tell me whether my approach seems reasonable?&lt;/p&gt;&#xA;" OwnerUserId="17395" LastActivityDate="2022-07-29T08:08:35.837" Title="Detect quasi-parallel lines with spurs in a binary image" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28538" PostTypeId="2" ParentId="28526" CreationDate="2016-01-28T14:52:42.823" Score="0" Body="&lt;p&gt;Probaly you have seen this papers/ info allready:&lt;br&gt;&#xA;&lt;a href=&quot;http://iris.elf.stuba.sk/JEEEC/data/pdf/1_110-08.pdf&quot; rel=&quot;nofollow&quot;&gt;VOICE CONVERSION USING PITCH SHIFTING ALGORITHM&#xA;BY TIME STRETCHING WITH PSOLA AND RE–SAMPLING&lt;/a&gt; and&#xA;&lt;a href=&quot;http://dsp-book.narod.ru/Pitch_shifting.pdf&quot; rel=&quot;nofollow&quot;&gt;Pitch shifting TC- Helicon&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2016-01-28T14:52:42.823" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28539" PostTypeId="1" AcceptedAnswerId="28540" CreationDate="2016-01-28T14:54:18.937" Score="0" ViewCount="235" Body="&lt;p&gt;From &lt;a href=&quot;https://en.wikipedia.org/wiki/Zero-order_hold&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A zero-order hold reconstructs the following continuous-time waveform&#xA;  from a sample sequence $x[n]$, assuming one sample per time interval&#xA;  $T$: $$x_{\mathrm{ZOH}}(t)\,= \sum_{n=-\infty}^{\infty} x[n]\cdot&#xA; \mathrm{rect} \left(\frac{t-T/2 -nT}{T} \right) \ $$ where&#xA;  $\mathrm{rect}()$  is the rectangular function.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'd like to find a good bibliographic reference for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="17183" LastEditorUserId="11256" LastEditDate="2016-01-28T15:44:27.917" LastActivityDate="2016-01-28T15:49:28.557" Title="A reference request for zero-order hold (ZOH)" Tags="|sampling|reference-request|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28540" PostTypeId="2" ParentId="28539" CreationDate="2016-01-28T15:49:28.557" Score="0" Body="&lt;p&gt;I'd personally start with &quot;Signals and Systems&quot; by Oppenheim and Willsky. I have the second edition, and it has a good description of zero-order hold. This book is a must-have if you're interested in signals and systems. There is also a version that focuses on discrete signals. In addition, this book is probably available at most engineering libraries.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-01-28T15:49:28.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28541" PostTypeId="2" ParentId="28514" CreationDate="2016-01-28T16:13:57.000" Score="-1" Body="&lt;p&gt;So I have figured out the answer, thanks to a little prodding by RBJ.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Creating -6dB/octave Filters and Brown Noise:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Generate a White Noise Sequence.&lt;/li&gt;&#xA;&lt;li&gt;Design a 1st Order Butterworth Filter&lt;/li&gt;&#xA;&lt;li&gt;Apply 1st Order Buttworth to the White Noise Sequence&#xA;[Use the Bilinear Transform to convert the analog coefficients to digital, and apply the digital filter to the white noise sequence].&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Creating -3dB/octave Filters and Pink Noise:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Generate a White Noise Sequence&lt;/li&gt;&#xA;&lt;li&gt;Generate arbitrary interleaved poles and zeros on the positive real line within the unit circle. Such that $|p_{i}| &amp;gt; |z_{i}|$ and $|z_{i}| &amp;gt; |p_{i+1}|$. Set the first pole close to the unit circle.&lt;/li&gt;&#xA;&lt;li&gt;Convert these roots to coefficients, and use these coefficients as the coefficients of a digital filter.&lt;/li&gt;&#xA;&lt;li&gt;Apply said digital filter to the White Noise Sequence.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I am still not sure of is why we need to interleave the poles and zeros, but that isn't exactly what the question asked. Can anybody elaborate?&lt;/p&gt;&#xA;" OwnerUserId="19259" LastEditorUserId="19259" LastEditDate="2016-01-28T16:52:47.680" LastActivityDate="2016-01-28T16:52:47.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28544" PostTypeId="2" ParentId="28524" CreationDate="2016-01-28T21:12:35.323" Score="-1" Body="&lt;p&gt;So after doing some reading, and looking at this matlab article I should be getting a 1 when I do this. As stated here in this matlab &lt;a href=&quot;http://www.mathworks.com/help/signal/ug/cross-spectrum-and-magnitude-squared-coherence.html&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt; &quot;To prevent obtaining a magnitude-squared coherence estimate, which is identically 1 for all frequencies, you must use an averaged MSC estimator. &quot; So because I was not using an MSC estimator, and simply just using calculating the power, I continued to get a 1 for my answer.&lt;/p&gt;&#xA;" OwnerUserId="16673" LastActivityDate="2016-01-28T21:12:35.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28545" PostTypeId="1" CreationDate="2016-01-28T23:18:45.310" Score="1" ViewCount="83" Body="&lt;p&gt;I have a simple question &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could one implement the $z$ or $z^2$ in simulink? The $z^{-2}$ could be implemented by Variable Integer Delay block, but what about $z^2$?&lt;/p&gt;&#xA;" OwnerUserId="16855" LastEditorUserId="4298" LastEditDate="2016-03-20T08:38:56.233" LastActivityDate="2016-03-20T08:38:56.233" Title="Delay by &quot;$z$&quot; in matlab simulink" Tags="|matlab|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28546" PostTypeId="2" ParentId="27989" CreationDate="2016-01-29T00:48:33.367" Score="0" Body="&lt;p&gt;okay so you'll have a little problem quantifying the &amp;quot;horrible&amp;quot; in the music.  it's not such an identifiable parameter is this would depict:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pkBti.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pkBti.jpg&quot; alt=&quot;suck knob&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&#xA;&lt;sub&gt;(source: &lt;a href=&quot;http://tcttest.iawti.org/wp-content/uploads/2010/03/SuckKnob1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;iawti.org&lt;/a&gt;)&lt;/sub&gt;&lt;/p&gt;&#xA;&lt;p&gt;to differentiate a talking voice from &lt;strong&gt;any&lt;/strong&gt; music &lt;em&gt;might&lt;/em&gt; be possible with some really good and responsive tracking pitch detection and looking for the inflections of pitch that resemble that of a normally animated talking voice.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-02-26T00:05:32.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28547" PostTypeId="2" ParentId="28526" CreationDate="2016-01-29T03:13:43.113" Score="2" Body="&lt;p&gt;PSOLA can mean different things to different people.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the &quot;Formant Preserving Pitch Shifting&quot; that is done in the time domain requires a really good, tracking, pitch detector.  knowing the pitch (which changes) at every arbitrary time means you know the period length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so this Formant Preserving Pitch Shifting in the time domain, identifies the onsets of every period of the input waveform, when it is voiced.  each period is isolated with a window and now becomes a &quot;grain&quot; or (my poorly-considered name for it) a &quot;wavelet&quot;.  then you launch these grains or wavelets out at the rate of the &lt;em&gt;new&lt;/em&gt; fundamental frequency.  but, to preserve the formants, you neither stretch (if down-shifting) nor scrunch (if up-shifting) the grains or wavelets.  you overlap and add them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the rate of firing out those grains determines the output pitch.  the degree of stretching or scrunching the grains along the time axis determines the formant shift.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-01-29T03:13:43.113" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28548" PostTypeId="1" CreationDate="2016-01-29T05:44:40.477" Score="7" ViewCount="3033" Body="&lt;p&gt;I want to know more about where it is advantageous to use a soft knee and where and why a hard knee is preferred. Also I would like to get my hands on some good resources which talk about implementation of soft knee in DRC&lt;/p&gt;&#xA;" OwnerUserId="19298" LastEditorUserId="29" LastEditDate="2016-01-30T03:25:40.127" LastActivityDate="2023-05-04T14:40:25.180" Title="Differences between soft knee and hard knee in Dynamic Range Compression (DRC)?" Tags="|dynamic-range-compression|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28550" PostTypeId="2" ParentId="28490" CreationDate="2016-01-29T07:55:04.793" Score="1" Body="&lt;p&gt;A Regular Random Process is is the the result of White Noise Going through a &lt;a href=&quot;https://en.wikipedia.org/wiki/Minimum_phase&quot; rel=&quot;noreferrer&quot;&gt;Minimum Phase LTI System&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Non Perfectly Predictable Random Process can be defined as (See &lt;a href=&quot;https://en.wikipedia.org/wiki/Wold%27s_theorem&quot; rel=&quot;noreferrer&quot;&gt;Wold Theorem&lt;/a&gt; / &lt;a href=&quot;https://en.wikipedia.org/wiki/Wold%27s_decomposition&quot; rel=&quot;noreferrer&quot;&gt;Wold Decomposition&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x \left[ n \right] = \sum_{k = 0}^{\infty} {g}_{k} u \left[ n - k \right] + z \left[ n \right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ {\left\{ {g}_{k} \right\}}_{k = 1}^{\infty} $ is a Minimum Phase LTI System, $ u \left[ n \right] $ is White Noise and $ z \left[ n \right] $ is a Perfectly Predictable Process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the questions deals with colored noise, $ z \left[ n \right] = 0 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the process can be defined as following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/isJ97.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/isJ97.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The optimal linear predictor is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{x} \left[ n \mid n - 1 \right] = \sum_{k = 0}^{\infty} {h}_{k} x \left[ n - 1 - k \right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the filter $ H \left( f \right) $ is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H \left( f \right) = 1 - \frac{1}{G \left( f \right)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, given the Linear Prediction Filter one could define the Whitening Filter as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ W \left( f \right) = 1 - H \left( f \right) = \frac{1}{G \left( f \right)} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Linear Predictor Filter can be approximated by the LMS Filter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9GtC0.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9GtC0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which now, the Whitening Filter can be easily defined and approximated using the LMS Framework.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2016-01-29T07:55:04.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28551" PostTypeId="1" AcceptedAnswerId="28572" CreationDate="2016-01-29T09:53:14.293" Score="1" ViewCount="725" Body="&lt;p&gt;I am interested in how to add resonance (Q) to the magnitude response of a Butterworth low pass when it is expressed in the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;G^2(\omega)=\frac {1}{1+\left(\frac{\omega}{\omega_c}\right)^{2n}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to add resonance $Q &amp;gt; 0$ for $n &amp;gt;= 2$ i.e. include it in one (and only one) of the second second order terms (if the equation is expanded as a product of second order sections):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s) = \frac{ \omega_0^2 }{ s^2 + \frac{ \omega_0 }{Q} + \omega_0^2 }&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I wonder whether there is a general formula for resonance $Q$ that is a function of $\omega$ that can be used for fractional $n$ such that it can be added to the transfer function $G$ or $G^2$ to yield a new magnitude response?&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="15030" LastEditDate="2016-01-29T12:50:50.337" LastActivityDate="2016-01-30T16:37:43.257" Title="How can resonance be added to a fractional order Butterworth low pass" Tags="|filters|magnitude|butterworth|resonance|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="28552" PostTypeId="1" AcceptedAnswerId="28554" CreationDate="2016-01-29T10:21:11.800" Score="0" ViewCount="1081" Body="&lt;p&gt;In GQRX (an GNURadio based RTL-SDR receiver) I have an FFT and waterfall display. When I tune to a local FM station (107.5MHz) I can hear strong, clear voice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But on FFT and waterfall display I can see also a weaker signal at 107.9MHz:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/omLhQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/omLhQ.png&quot; alt=&quot;gqrx&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why I see this little signal of my receiver is tuned to other frequency? There is almost always such a weak signal in the center of a display no matter at which frequency I'm tuned.&lt;/p&gt;&#xA;" OwnerUserId="7743" LastEditorUserId="13320" LastEditDate="2016-11-13T13:26:22.240" LastActivityDate="2016-11-13T13:26:22.240" Title="GQRX Frequency tuning" Tags="|frequency-spectrum|software-defined-radio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28553" PostTypeId="1" CreationDate="2016-01-29T11:08:01.423" Score="-1" ViewCount="767" Body="&lt;p&gt;I am trying to learn DSP. I'm reading the 2nd edition of Oppenheim &amp;amp; Schafer's &quot;Discrete-Time Sig. Proc.&quot; book. On the topic of converting a continuous signal to a discrete-time signal the idea of a time-domain $s(t)$ impulse train is discussed, where $s(t)$ is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t) = \sum_{n = -\infty}^\infty \delta\left(t - nT\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where variable $T$ is the time between the impulses. Next I read, from Oppenheim &amp;amp; Schafer's equation (4.5) on page 143, that the spectrum of $s(t)$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}S(j\omega) &amp;amp;= \frac{2\pi}{T}\sum_{k = -\infty}^\infty \delta\left(\omega - k\omega_s\right)\\&amp;amp;=\omega_s \sum_{k = -\infty}^\infty \delta\left(\omega - k\omega_s\right)\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_s$ is the sampling frequency in radians/second. That $S(j\omega)$ expression has a scaling factor of $\omega_s$. My questions are: Does that $\omega_s$ scaling factor mean that the $S(j\omega)$ impulses in the frequency domain have amplitudes proportional to the sampling frequency? What is the physical meaning of that $\omega_s$ scaling factor? Does it even have a physical meaning?&lt;/p&gt;&#xA;" OwnerUserId="18822" LastEditorUserId="1629" LastEditDate="2016-01-29T11:57:55.887" LastActivityDate="2016-02-28T16:22:52.797" Title="Spectrum of a time-domain impulse train" Tags="|theory|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28554" PostTypeId="2" ParentId="28552" CreationDate="2016-01-29T12:36:04.173" Score="3" Body="&lt;p&gt;It is common for low-cost direct-conversion (zero-IF) RF receivers to have a DC offset in their A/D hardware, which would correspond to a large spike at the frequency that you're tuned to. That's probably what you're seeing in the waterfall display, as some models of RTL2832U receivers use zero-IF architectures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For what it's worth, for such a cheap device, I'd say the above is actually pretty good from a DC-offset perspective. You can work around it by tuning slightly away from the signal that you want, then apply the residual frequency offset yourself in your signal processing (it looks like that's what your SDR software package is doing).&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2016-01-29T12:36:04.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28556" PostTypeId="2" ParentId="24430" CreationDate="2016-01-29T13:47:22.943" Score="1" Body="&lt;p&gt;There is a nice introductory book to the topic &lt;a href=&quot;http://greenteapress.com/thinkdsp/&quot; rel=&quot;nofollow&quot;&gt;Think DSP - Digital Signal Processing in Python&lt;/a&gt; that covers just what you asked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book is free and comes with simple library and examples for generating different types of signals (sine, triangle, square, brownian/pink/gaussian noise), summing those signals together, calculating FFT and plotting both spectrum and spectrograms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a more detailed example on how to generate, store and plot a sine signal in python (with NumPy, pylab and wave): &lt;a href=&quot;http://howto.quasoft.net/create-sinusoid-signal-and-store-to-wave-file.html&quot; rel=&quot;nofollow&quot;&gt;http://howto.quasoft.net/create-sinusoid-signal-and-store-to-wave-file.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will find similar examples in the book.&lt;/p&gt;&#xA;" OwnerUserId="19302" LastActivityDate="2016-01-29T13:47:22.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28557" PostTypeId="1" AcceptedAnswerId="28560" CreationDate="2016-01-29T13:57:35.430" Score="3" ViewCount="3708" Body="&lt;p&gt;I'm trying to use ORB features with a &lt;code&gt;cv::BFMatcher&lt;/code&gt;. ORB is based on binary descriptors so HAMMING must be the choice, but I'm not sure I understand the difference between &lt;code&gt;NORM_HAMMING2&lt;/code&gt; vs &lt;code&gt;NORM_HAMMING&lt;/code&gt; and witch one is the right choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made some test but I couldn't find any reliable  difference.&lt;/p&gt;&#xA;" OwnerUserId="18589" LastEditorUserId="18589" LastEditDate="2016-01-29T14:06:09.323" LastActivityDate="2016-01-29T16:08:54.763" Title="NORM_HAMMING2 vs NORM_HAMMING" Tags="|image-processing|computer-vision|opencv|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28558" PostTypeId="2" ParentId="28553" CreationDate="2016-01-29T14:27:11.300" Score="2" Body="&lt;p&gt;I think of it in terms of the relationship between a sampled analog signal $x_a(t)$ to its discrete discrete-time signal $x(n)$  (at period $T$) and their spectrum relationship:&#xA;\begin{align}x(n)&amp;amp;=x_a(nT)\\X(F)&amp;amp;=F_s\sum_{k=-\infty}^\infty X_a(F - kF_s)\end{align}&#xA;With $T = \frac 1F$. Think of the sampled version as any continuous signal $\textit{sifted}$ by the impulse train. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The spectrum on the LHS is a periodic function of $F$ consisting of a sum of shifted (by integer multiples of $F_s$) and &lt;strong&gt;scaled&lt;/strong&gt; replicas of $X_a(F)$. To be strict mathematically, the scaling must be there. So yes, proportional to $F_s$. But in most real-world applications, scaling factors are skipped to save computation. As to its physical meaning, I don't know if there is any. Kinda baffling though when inspecting units with the scaling, one is tempted to say that each term in the summation is in $\textrm{[unit/Hz]}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, the two formulas are very useful in ideal sampling and reconstruction.&lt;/p&gt;&#xA;" OwnerUserId="1629" LastActivityDate="2016-01-29T14:27:11.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28559" PostTypeId="2" ParentId="27989" CreationDate="2016-01-29T15:21:20.073" Score="2" Body="&lt;p&gt;If this is a typical case of a podcast that sounds like a radio broadcast then you could discriminate between music and speech purely based on the &quot;shape&quot; of the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if there is special software that could handle this but I will provide a simple example using Audacity further below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main idea is that a mixed track coming from a variety of different instruments would be expected to occupy a wider range of the spectrum than just someone talking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a quick test using Audacity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fyRgi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fyRgi.jpg&quot; alt=&quot;Podcast spectrum&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just by visual inspection, a set of &quot;noisy bands&quot; appear in the spectrum view. These are the locations where it is either music played along with someone speaking or just music playing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My settings for this image (Edit-&gt;Preferences-&gt;Spectrogram): Window-size 4096, window:Blackman, minFreq:0, maxFreq:8kHz, Gain:20, Range:80, freqGain:0, use grayscale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To switch to this view, load your podcast into Audacity and then click on its track name and select &quot;Spectrogram&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To achieve the same thing in an automatic way, you would have to create a very simple classifier. The classifier would break down the incoming signal into &quot;chunks&quot; and obtain their spectrum. This is roughly what Audacity does to generate each one of the vertical columns that make up the spectrogram of the sound. The classifier would then &quot;scan&quot; these columns from left to right deciding what each column represents (&quot;Music&quot;, &quot;Speech&quot;, ..., other?). The decision would be based on the relative amplitude of each harmonic in the spectrum. After this, you could decide to drop or silence those frames that have been characterised as &quot;Music&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But all this means writing some form of code in a programming language (e.g. Python). I can expand this response with the simplest of classifiers that could work for this problem but only if that would be seen as useful (?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this technique would work with mixed tracks whose &lt;strong&gt;full&lt;/strong&gt; spectrum (including all their possible harmonics) extends well beyond the spectrum of the human voice. There might indeed be some special cases as mentioned earlier by &lt;code&gt;robert bristow-johnson&lt;/code&gt; where the discrimination is much more difficult and more complex techniques would be required but for a generic podcast, just basing the decision on the spectrum might do just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, the podcast I used in this example is &lt;a href=&quot;https://soundcloud.com/guardianbookspodcast/michel-houellebecq-profane-or&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2016-01-29T15:21:20.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28560" PostTypeId="2" ParentId="28557" CreationDate="2016-01-29T16:08:54.763" Score="3" Body="&lt;p&gt;From &lt;a href=&quot;http://docs.opencv.org/2.4/modules/features2d/doc/common_interfaces_of_descriptor_matchers.html#bfmatcher-bfmatcher&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;BFMatcher&lt;/code&gt; constructor documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;NORM_HAMMING&lt;/code&gt; should be used with ORB, BRISK and BRIEF, &lt;code&gt;NORM_HAMMING2&lt;/code&gt; should be used with &lt;code&gt;ORB&lt;/code&gt; when &lt;code&gt;WTA_K==3&lt;/code&gt; or &lt;code&gt;4&lt;/code&gt; (see &lt;code&gt;ORB::ORB&lt;/code&gt; constructor description)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And &lt;a href=&quot;http://docs.opencv.org/2.4/modules/features2d/doc/feature_detection_and_description.html#orb-orb&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;ORB&lt;/code&gt; constructor documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;WTA_K&lt;/strong&gt; - &lt;em&gt;[...]&lt;/em&gt; Other possible values are 3 and 4. &lt;em&gt;[...]&lt;/em&gt; Such output will occupy 2 bits, and therefore it will need a special variant of Hamming distance, denoted as &lt;code&gt;NORM_HAMMING2&lt;/code&gt; (2 bits per bin).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In other words the right choice is the one that matches your &lt;code&gt;ORB&lt;/code&gt; configuration (&lt;code&gt;NORM_HAMMING&lt;/code&gt; when &lt;code&gt;WTA_K==2&lt;/code&gt;, and &lt;code&gt;NORM_HAMMING2&lt;/code&gt; when &lt;code&gt;WTA_K==3&lt;/code&gt; or &lt;code&gt;WTA_K==4&lt;/code&gt;), otherwise you'll wind up with incorrect norms and correspondingly poorer/inconsistent matching performance. &lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2016-01-29T16:08:54.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28561" PostTypeId="1" AcceptedAnswerId="28562" CreationDate="2016-01-29T16:22:32.833" Score="1" ViewCount="219" Body="&lt;p&gt;I've been wondering,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since some sound generating physical phenomena have been physically modelled as physical modelling synthesisers,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does there exist a &quot;physical audio theory&quot; (or scientific subdomains fit for belonging to &quot;physical audio theory&quot;), which is like a subfield of applied mathematics or physics that describes the theory of sound generators, propagation and such. For example, the Karplus-Strong algorithm and its analysis would belong there and it would be presented as a derivation of string physics. Sure there's the physics of sound under physics, but I have not seen a coherent mathematical theory on &quot;physical modelling synthesis&quot;, even if &quot;physical modelling synthesis&quot; could perhaps be laid out as mathematical formalisms, e.g. as an &quot;applied linear algebra&quot; body of theory. It seems like much of audio DSP is just scattered information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those interested, I also think there are at least some books concerning &quot;physical audio theory&quot;, an example would be this book:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://mitpress.mit.edu/books/designing-sound&quot; rel=&quot;nofollow&quot;&gt;https://mitpress.mit.edu/books/designing-sound&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does contain chapters that predominantly analyze natural phenomena or &quot;sound generating settings&quot; and try to translate those into expressions in mathematics, using concepts from physics. The derivations don't differ that much from e.g. typical engineering analysis. Much like the Karplus-Strong algorithm was developed by analyzing string instruments.&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="16003" LastEditDate="2016-01-30T09:59:37.720" LastActivityDate="2016-01-31T00:06:04.540" Title="Does/can physical audio theory exist?" Tags="|audio|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28562" PostTypeId="2" ParentId="28561" CreationDate="2016-01-29T17:11:46.963" Score="4" Body="&lt;p&gt;Physics-based sound synthesis is a pretty multidisciplinary topic.  Quoting from the preface of &lt;a href=&quot;https://ccrma.stanford.edu/~jos/pasp/&quot; rel=&quot;nofollow&quot;&gt;Physical Audio Signal Processing&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[T]he material of this book is multidisciplinary, building on results&#xA;  from physics, musical acoustics, psychoacoustics, signal processing,&#xA;  control engineering, computer music, and computer science. Such&#xA;  diversity is typical of applied research.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It wouldn't really make sense to have it be some kind of subfield of math or physics; computer graphics is in a similar position.  Physics-based sound synthesis is mainly numerically simulating a physical model.  The trick, as usual, is making approximations to arrive at something reasonably efficient while not losing too much of what is important.  This is how fields like psychoacoustics and computer science come in.  There isn't a mathematical theory that will tell you what approximations won't produce unpleasant sounds and will run efficiently on a SHARC DSP.  The constraints are too ad-hoc.  Of course, you can put the constraints of a particular problem into a general mathematical theory of approximation and optimization to help derive solutions.&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-01-29T17:11:46.963" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28563" PostTypeId="1" CreationDate="2016-01-29T18:18:51.410" Score="0" ViewCount="4332" Body="&lt;p&gt;I wish to calculate the signal-to-noise ratio (SNR) of a speech signal in MATLAB. I only have the speech signal, and the speech-in-noise, but I don't have the noise file alone. How do I calculate the SNR of the speech in noise?&lt;/p&gt;&#xA;" OwnerUserId="9130" LastEditorUserId="12261" LastEditDate="2018-12-17T14:21:51.240" LastActivityDate="2018-12-17T14:21:51.240" Title="How do I calculate the SNR of a noisy signal without having the noise?" Tags="|matlab|noise|snr|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28565" PostTypeId="2" ParentId="28514" CreationDate="2016-01-29T21:49:31.173" Score="2" Body="&lt;p&gt;here's what to do for -3 dB/octave (what i remember from 1985):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;first take your 1/sqrt(f) magnitude function and &lt;strong&gt;inverse&lt;/strong&gt;-warp that frequency response to what it will look like in the analog s-domain.  instead of only a -3 dB/oct ramp (which is what you &lt;strong&gt;after&lt;/strong&gt; BLT frequency warping) you have a -3 dB/oct ramp that starts to level out a little in the s-domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then apply straight line ramps at -6 dB/oct and 0 dB/oct (like with &quot;Bode plots, remember them from electronics class?) to approximate your pre-warped ramp.  convert those alternating poles and zeros to digital using the BLT.  then your pre-warped ramp will come out like a straight ramp after BLT frequency warping.  then adjust the pole or zero that is on the &lt;strong&gt;edges&lt;/strong&gt; to minimize the maximum error in the log-log plot in the digital domain.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-01-29T21:49:31.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28566" PostTypeId="2" ParentId="28548" CreationDate="2016-01-30T02:32:16.797" Score="2" Body="&lt;p&gt;depends on if you like discontinuities in your signal or parameter processing chain, or if you like it if the mathematics is as continuous as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how to implement a soft knee?  consider this function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f(x) \ = \ \alpha_0 \ x \ - \ \beta \ \log_2 \left(1 + 2^{\frac{\alpha_0 - \alpha_1}{\beta} (x - x_0)} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $ 0 &amp;lt; \alpha_1 &amp;lt; \alpha_0 $ and $ \beta &amp;gt; 0 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;tell me what you get for tiny $\beta$ and then what you get for nominal $\beta$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-01-30T03:37:09.383" LastActivityDate="2016-01-30T03:37:09.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28567" PostTypeId="5" CreationDate="2016-01-30T03:31:34.077" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Dynamic_range_compression&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Dynamic_range_compression&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2016-01-30T03:31:34.077" LastActivityDate="2016-01-30T03:31:34.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28568" PostTypeId="4" CreationDate="2016-01-30T03:31:34.077" Score="0" Body="This is for algorithms that compress the dynamic range of a signal, such as used in audio or image processing." OwnerUserId="29" LastEditorUserId="29" LastEditDate="2016-01-30T03:31:34.077" LastActivityDate="2016-01-30T03:31:34.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28569" PostTypeId="1" AcceptedAnswerId="28579" CreationDate="2016-01-30T05:33:39.417" Score="2" ViewCount="2991" Body="&lt;p&gt;In &lt;a href=&quot;https://dsp.stackexchange.com/a/13401/17877&quot;&gt;this answer&lt;/a&gt;, an iterative algorithm is given for recovering a signal from its spectrogram, assuming overlapping windows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x_{n+1} = \operatorname{istft}(S \cdot \exp(i \cdot \operatorname{angle}(\operatorname{stft}(x_n)))),&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $S$ is the spectrogram and $\operatorname{(i)stft}$ is the (inverse) short-time Fourier transform. I tried this out using NumPy, SciPy, and &lt;a href=&quot;https://github.com/bmcfee/librosa&quot; rel=&quot;nofollow noreferrer&quot;&gt;librosa&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import librosa&#xA;import numpy as np&#xA;import scipy&#xA;&#xA;def mse(phase_pred, phase_true):&#xA;    '''&#xA;    Calculate the mean square error between the true phase and the&#xA;    predicted (reconstructed) phase.&#xA;    '''&#xA;    return np.mean(np.angle(phase_pred/phase_true)**2)&#xA;&#xA;# Load an audio file and calculate STFT.&#xA;x, sample_rate = librosa.load('audio.wav', sr=44100)&#xA;D = librosa.stft(x)&#xA;mag, actual_phase = librosa.magphase(D)&#xA;&#xA;# Try to reconstruct the phase using the iterative algorithm above.&#xA;phase = np.exp(1.j * np.random.uniform(0., 2*np.pi, size=actual_phase.shape))&#xA;x_ = librosa.istft(mag * phase)&#xA;print('iter {} mse {}'.format(-1, mse(phase, actual_phase)))&#xA;for i in range(100+1):&#xA;    _, phase = librosa.magphase(librosa.stft(x_))&#xA;    x_ = librosa.istft(mag * phase)&#xA;    print('iter {} mse {}'.format(i, mse(phase, actual_phase)))&#xA;    if i % 10 == 0:&#xA;        scipy.io.wavfile.write('recons{:05d}.wav'.format(i), 44100, x_)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, it isn't converging:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uZ5Ji.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uZ5Ji.png&quot; alt=&quot;convergence&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the audio after the 100th iteration definitely &lt;em&gt;sounds&lt;/em&gt; closer to the original than the one with randomized phases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why isn't this algorithm converging to the correct phase? Am I misunderstanding its purpose?&lt;/p&gt;&#xA;" OwnerUserId="17877" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-01-31T10:53:02.943" Title="Recovering phase from spectrogram" Tags="|fourier-transform|frequency-spectrum|spectrogram|stft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28570" PostTypeId="2" ParentId="28563" CreationDate="2016-01-30T10:16:14.640" Score="0" Body="&lt;p&gt;I use alway the &lt;a href=&quot;https://en.wikipedia.org/wiki/Signal-to-noise_ratio&quot; rel=&quot;nofollow&quot;&gt;wikipedia alternative definition&lt;/a&gt;&lt;br&gt;&#xA;here is &#xA;$$&#xA;SNR = \frac{\mu}{\sigma} = \frac{\text{mean}}{\text{Standard deviation}}&#xA;$$&#xA;I choose the arithmetic mean what is &#xA;$$&#xA;\mu = \frac{1}{N} \sum_{n=0}^{N} (x_1 + x_2 + \ldots x_N)&#xA;$$&#xA;and the Standard deviation is&#xA;$$&#xA;\sigma = \sqrt{\frac{1}{N} \sum_{i=0}^{N} (x_i - \mu)^2 }&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2016-01-30T10:16:14.640" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28571" PostTypeId="1" CreationDate="2016-01-30T16:23:27.503" Score="0" ViewCount="238" Body="&lt;p&gt;Suppose that we have a dynamical system of which the impulse responses are infinite (IIR). Now I found methods on papers (&lt;a href=&quot;http://dx.doi.org/10.1109/9.839942&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1109/9.839942&lt;/a&gt;) estimating states or outputs of such a system with a FIR estimator. So this FIR estimator gives me approximately the same (state) output as my original system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find it hard to conceive how an estimator with only poles in $z_i=0$ is able to duplicate a system with poles $|z_i|&amp;lt;1$ (but not necessarily $z_i=0$). I think it has something to do with interpolation conditions, but I would really appreciate it if someone could make this clear to me. Thanks :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that for a stable dynamical system IIR will decay to zero and thus can be truncated to FIR. But my question remains how a FIR could 'mimic' the poles of an IIR?&lt;/p&gt;&#xA;" OwnerUserId="19315" LastEditorUserId="19318" LastEditDate="2016-01-30T23:06:30.770" LastActivityDate="2016-03-01T23:58:46.263" Title="FIR estimator for IIR system" Tags="|infinite-impulse-response|interpolation|finite-impulse-response|poles-zeros|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28572" PostTypeId="2" ParentId="28551" CreationDate="2016-01-30T16:30:13.287" Score="1" Body="&lt;p&gt;Given the formula for second order sections:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;s_k = \omega_c e^{\frac{j(2k+n-1)\pi}{2n}}\qquad k = 1,2,3,\ldots, n \qquad s = i\omega&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(s)=\frac{G_0}{\prod_{k=1}^n (s-s_k)/\omega_c}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use k = 1 for the resonance section, add $Q$ in the normal way i.e. calculate $H_{k=1}^2 = H_{k=1}(s) \overline{H_{k=1}(s)}$ where $s = i\omega$ and the denominator will be of the form $w^4 + cw^2 + 1$ where $c$ is a constant calculated from $s_k$. We add $Q$ to the first order term (note that this is a quadratic in $\omega^2$). Using any positive real $n$ in $s_k$ gives valid values for $c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $R^2$ be a modified $H_{k=1}^2$ with $Q$ added in to the first order term of the quadratic in $w^2$ then to add resonance to the original equation in the question multiply it by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac {R^2}{H_{k=1}^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This effectively removes the $k = 1$ second order section and adds a resonant section back in. It turns out once you do this, $n$ can be any positive real value when used in $c$ but note this wouldn't work for fractional roots of the sections (you would have to use fractional calculus if you wanted the roots of the fractional equation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without resonance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;c = 2 \cos^2(\frac{\pi (1+n) } {2n}) - 2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With resonance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;c = \frac{2}{Q^2}\cos^2(\frac{\pi (1+n) } {2n}) - 2&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="15030" LastEditDate="2016-01-30T16:37:43.257" LastActivityDate="2016-01-30T16:37:43.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28575" PostTypeId="2" ParentId="28571" CreationDate="2016-01-30T19:18:22.050" Score="1" Body="&lt;p&gt;Note that approximation of an impulse response by a FIR usually requires a lot more zeros and poles (at z = 0) than the nearly equivalent IIR.  Enough extra degrees of freedom in the amount and placement of zeros might allow shaping a FIR response arbitrarily close to a stable IIR response (with more degrees of freedom in the placement of poles), at the cost of a lot more (often magnitudes more) zeros.  So this &quot;duplication&quot; doesn't come for free.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-01-30T19:18:22.050" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28577" PostTypeId="1" CreationDate="2016-01-30T23:14:04.093" Score="0" ViewCount="344" Body="&lt;p&gt;I'm new to using filter tools in MATLAB and I'm having a bit of difficulty. I'm designing a lowpass FIR filter and I'm trying to keep the passband ripple below 0dB in the magnitude response. So far, the passband ripple travels up above 0dB the same amount that it travels below. Any ideas on how to accomplish this using fvtool? I've been reading up on fvtool all day and I still can't figure it out. Thanks in advance for your help. Also, I apologize for this being so wordy for such a simple questions. &lt;/p&gt;&#xA;" OwnerUserId="19321" LastActivityDate="2016-01-31T11:03:39.953" Title="MATLAB fvtool: Setting the passband ripple below 0dB for a FIR Filter" Tags="|matlab|signal-analysis|filter-design|lowpass-filter|finite-impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28578" PostTypeId="1" AcceptedAnswerId="28600" CreationDate="2016-01-31T00:16:15.933" Score="0" ViewCount="744" Body="&lt;p&gt;I have a sample test with an answer but don't understand how they got to the answer: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$x(t)$ has info only between $2 &amp;lt; |\omega| &amp;lt; 4$&lt;br&gt;&#xA;  $X^F(\omega) = 0$&#xA;  for other frequencies.  &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;All noise was cleaned from the signal and its CTFT is defined:&lt;br&gt;&#xA;  $X^F(\omega) = \begin{cases} |\omega|-2  &amp;amp; \text{for 2 &amp;lt; |$\omega$| &amp;lt; 4}\\ 0 &amp;amp; \text{otherwise} \end{cases}$   &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The clean signal was sampled&#xA;  at $\frac 1 T = \frac {12}\pi$&lt;br&gt;&#xA;  Draw the DTFT of $X^f(\theta) \text{ for} -3\pi &amp;lt; \theta &amp;lt; 3\pi$   &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Use a clear coordinate system.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer has x-axis span of -9 to 9 and y-axis of 0 to 4. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mZUq7.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mZUq7.jpg&quot; alt=&quot;answer&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How was this answer calculated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought I would get a simple repeating copy of the original CTFT, but the original CTFT with $2 &amp;lt; |w| &amp;lt; 4$ is a line beginning at w=2 (on the x-axis) with the value zero, going up until the point  $w=4$ where it has the value of 2... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help!!  Thanks  &lt;/p&gt;&#xA;" OwnerUserId="19322" LastEditorUserId="19322" LastEditDate="2016-02-21T20:42:47.960" LastActivityDate="2016-02-21T21:32:43.953" Title="Why this DTFT plot from CTFT?" Tags="|fourier-transform|self-study|dtft|" AnswerCount="2" CommentCount="3" ClosedDate="2016-02-01T15:52:42.980" ContentLicense="CC BY-SA 3.0" />
  <row Id="28579" PostTypeId="2" ParentId="28569" CreationDate="2016-01-31T01:08:31.077" Score="1" Body="&lt;p&gt;It should be clear from the definition of the STFT that the result is invariant under &lt;em&gt;global&lt;/em&gt; phase changes. With the restriction to real input signals that still provides for a sign ambiguity, or a phase difference of $\pi$. That means, even if your reconstruction is perfect, the result may differ by that phase from the original.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another reason for the failure to converge may be the existence of nearly disconnected components in your signal. Say you have two sound components that are temporally separated so that there is no STFT frame that overlaps with both. Each component may be reconstructed with a different sign, giving you four different reconstructions with identical STFT. The same works for components that are separated well enough in frequency direction. Each component doubles the ambiguity of the reconstructed signal and will increase the probability of a deviation from the original signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final reason I can see lies in the nature of the iterative algorithm. &lt;a href=&quot;https://en.wikipedia.org/wiki/Fixed-point_iteration&quot; rel=&quot;nofollow&quot;&gt;Fixed point iterations&lt;/a&gt;, of which kind this algorithm is, can fail to converge to a proper fixed point, keep oscillating or even diverge. Unless the maps involved are well behaved in a certain sense, predicting convergence is hard. It seems that your iteration doesn't settle, and it's unclear if adding iterations will help. So this may apply here, together with the other two problems.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2016-01-31T10:53:02.943" LastActivityDate="2016-01-31T10:53:02.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28580" PostTypeId="1" AcceptedAnswerId="28587" CreationDate="2016-01-31T05:13:14.297" Score="0" ViewCount="374" Body="&lt;p&gt;I'm trying to determine the shape of the FFT response of a signal which had a kaiser windowing function applied to it. What I mean by this is if the shape is a normal bell curve or a Lorentzian distribution shape. I want to be able do a curve fit to the FFT response of the windowed signal for an analysis, but cannot find information on the shape of it. Here is an example of what the FFT response looks like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eUdv9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eUdv9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16054" LastActivityDate="2016-01-31T20:35:25.427" Title="Shape of Kaiser windowing function FFT response" Tags="|window-functions|math|shape-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28581" PostTypeId="2" ParentId="28577" CreationDate="2016-01-31T11:03:39.953" Score="2" Body="&lt;p&gt;From your question I conclude that it is an equi-ripple filter that you designed, probably using the Parks-McClellan algorithm. Such an equi-ripple FIR filter has a magnitude response alternating between the values $1+\delta_p$ and $1-\delta_p$ in the pass band (where $\delta_p$ is the maximum approximation error in the pass band), and in the stop band it also has ripples of equal height $\delta_s$, where $\delta_s$ is the maximum stop band error. Note that all quantities I use here are linear, not in dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as mentioned by SleuthEye in a comment, after designing such a filter you can simply scale it to get the desired behavior. If $h[n]$ are your original filter coefficients, your desired filter has the coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{h}[n]=\frac{1}{1+\delta_p}h[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter in $(1)$ will have a pass band magnitude alternating between the values $1$ (i.e., 0 dB) and $(1-\delta_p)/(1+\delta_p)$, and its minimum stopband attenuation will be $\delta_s/(1+\delta_p)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-01-31T11:03:39.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28582" PostTypeId="1" CreationDate="2016-01-31T12:49:02.227" Score="2" ViewCount="256" Body="&lt;p&gt;I am making a speech comparison app in javascript.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this dsp.SE post:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/7581/speech-comparison-algorithm-for-rating-on-similarities&quot;&gt;Speech comparison algorithm for rating on similarities&lt;/a&gt;,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;where I read it is best to use &lt;strong&gt;mfcc&lt;/strong&gt; and &lt;strong&gt;dtw&lt;/strong&gt; algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the Node.js implementation of &lt;strong&gt;mfcc&lt;/strong&gt; which I'd like to use. However, it is only working with 8 bit audio samples. Will that affect the quality of speech comparison, and by how much? If the difference is big enough I will edit the algorithm to support 16 bit samples.&lt;/p&gt;&#xA;" OwnerUserId="19326" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-05-31T13:45:13.170" Title="Using 8 bit samples for speech comparison" Tags="|audio|speech-processing|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28583" PostTypeId="1" CreationDate="2016-01-31T17:14:36.013" Score="6" ViewCount="1227" Body="&lt;p&gt;Related to &lt;a href=&quot;https://dsp.stackexchange.com/questions/93/could-a-dct-be-used-for-an-audio-magnitude-spectrum-rather-than-dft&quot;&gt;Could a DCT be used for an audio magnitude spectrum rather than DFT?&lt;/a&gt;, but more on the (audio) spectrogram side of things&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been reading about the DCT (such as from &lt;a href=&quot;https://www.cs.unc.edu/~kmp/comp832-s08/readings/blinn-dct.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) and it seemingly provides quite a few advantages over the DFT such as having more frequency bins for the same number of samples and better power compaction, which sounds useful for signal analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet all the programs I've used that have spectrograms seems to use the (magnitude of) DFT rather than DCT. Why is that? Is there something bad or &quot;missing&quot; from the DCT that is important for spectrograms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note: I already understand the benefits of the DCT for compression, and this question is about audio (or other time-displacement) signals, so please avoid focusing too much on compression or images)&lt;/p&gt;&#xA;" OwnerUserId="19328" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-02-01T09:21:58.870" Title="Why is the DFT used for spectrograms rather than the DCT?" Tags="|dft|spectrogram|dct|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28584" PostTypeId="1" CreationDate="2016-01-31T17:59:15.553" Score="0" ViewCount="380" Body="&lt;p&gt;Existing literatures say that the generalized frequency division multiplexing (GFDM) has lower out-of-band emission (OOBE) levels compared to orthogonal frequency division multiplexing (OFDM). However, this is actually untrue in a fair manner. In the previous papers, the OOBE levels of these two schemes have been compared under the assumption of the same number of subcarriers. But such an assumption is very unfair! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the total number of subcarriers of OFDM system (denoted by 'K') is determined by considering the coherence time and bandwidth expected. Therefore, under the same (or similar) circumstances, it is fair to set the number of samples in the GFDM symbols to be equal to 'K', which means that MN=K (M: number of subsymbols in GFDM system, N: number of subcarriers in GFDM system). In short, comparing the OOBE levels under the condition of K=N is quite unfair because GFDM requires the longer coherence time than OFDM in that case, and two systems have different spectral efficiencies. Instead, assuming MN=K is fair. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when MN=K, there is no gain of OOBE of GFDM systems compared to the OFDM one because of circular filtering, and I have already checked it up through both mathematical analysis and computer simulations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I want to know what benefits we can get from the use of GFDM. As I know, the improved PAPR performance can be expected. But I'm not sure it is meaningful because of high implementation complexity of GFDM transceiver. In my opinion, the OFDM with PAPR reduction techniques may be preferable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you think about it? Am I missing something? If it is, can you please let me know what benefits we can obtain from GFDM?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank in advance&lt;/p&gt;&#xA;" OwnerUserId="19329" LastEditorUserId="19329" LastEditDate="2016-02-02T13:04:53.513" LastActivityDate="2016-02-02T13:04:53.513" Title="What benefits can we get from the use of GFDM?" Tags="|digital-communications|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28585" PostTypeId="2" ParentId="28584" CreationDate="2016-01-31T18:51:17.360" Score="1" Body="&lt;p&gt;In a system where subcarrier crosstalk is not defined by how well the parties are synchronized, synchronization can might more easily be implemented. Whether that really compensates for the more complex filtering structure is up to research or even questionable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Point is that you can actually, in math and simulation bring down OOBE with GFDM, not even considering different comparison bases for the number of subcarriers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider this: The pulse shape of a single OFDM subcarrier is inherently a sinc. Hence, the first side lobes of the outermost carriers can only be $\approx13$ dB lower than the desired signal, and will continue periodically, whereas such a statement cannot be universally made for GFDM.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-01-31T18:51:17.360" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28586" PostTypeId="2" ParentId="28583" CreationDate="2016-01-31T19:03:57.597" Score="3" Body="&lt;p&gt;Let's define the N-point IDFT $y[n]$ of a signal $Y[f]$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;y[n] &amp;amp;= \sum\limits_{f=0}^{N-1} Y[f] e^{j2\pi n\,\frac{f}{N}},&amp;amp; n\in \{0,\dots,N-1 \}\tag{1} &#xA;\end{align*}$$&#xA;The DCT-II (which is most probably what we're looking at; the others are mathematically useful, but less nice to implement) $\mathbf{Y}[f]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;\mathbf{Y}[f] &amp;amp;= \sum\limits_{n=0}^{N-1} y[n] \cos\left(\pi (k+\frac12) \frac nN \right) ,&amp;amp; f\in \{0,\dots,N-1\}\\&#xA;&amp;amp;\text{which, Euler says, is}\\&#xA;&amp;amp;= \frac12 \sum\limits_{n=0}^{N-1} y[n]\left(e^{j\pi (k+\frac12) \frac nN } + e^{-j\pi (k+\frac12) \frac nN }\right),&amp;amp; f\in \{0,\dots,N-1\}\text.\tag{2}&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, calculating the inverse discrete Fourier of the discrete cosine transform becomes but a matter of diligence; calculating by inserting $(2)$ into $(1)$, you'll notice that the complex sinusoids are &lt;em&gt;orthogonal&lt;/em&gt; w.r.t. the scalar product, ie. the sum over the element-wise products becomes zero for everything but the same exponents.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-02-01T09:21:58.870" LastActivityDate="2016-02-01T09:21:58.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28587" PostTypeId="2" ParentId="28580" CreationDate="2016-01-31T20:35:25.427" Score="2" Body="&lt;p&gt;The Kaiser window approximates the discrete prolate spheroidal sequence (DPSS) window which I think tends to a Gaussian function in an appropriate limit of large window and large $\alpha$, because the DPSS window concentrates energy both in time and frequency domain, as does the Gaussian function. The the zero-phase Kaiser window of length $N$ with shape parameter $\alpha$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$w_0(n) = \frac{I_0\left(\pi\alpha \sqrt{1-(\frac{2 n}{N-1})^2}\right)}{I_0(\pi\alpha)},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $I_0$ is the zeroth-order modified Bessel function of the first kind. Substituting $n=\frac{(N-1)t}{2\sqrt{\alpha}}$ appears to normalize time so that the shape of the window does not change at large $\alpha$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$= \frac{I_0\left(\pi\sqrt{\alpha^2-\alpha t^2}\right)}{I_0(\pi\alpha)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was unable to calculate the limit $\alpha \rightarrow \infty$ symbolically but numerical testing indicates that at large $\alpha$ the window tends to a peak-normalized Gaussian function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\approx e^{-\displaystyle\frac{\pi t^2}{2}}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maximum difference between the window and the Gaussian appears to be in the order of $\frac{1}{\alpha}$. The Fourier transform of a Gaussian function is a Gaussian function.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-01-31T20:35:25.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28588" PostTypeId="2" ParentId="28571" CreationDate="2016-01-31T21:15:08.050" Score="0" Body="&lt;p&gt;This isn't a direct answer to your paraphrased question, &quot;How can an FIR system mimic the poles of an IIR system&quot;, but this should give you an idea how well it can be done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, download both the IIR and FIR filter programs from this &lt;a href=&quot;http://iowahills.com/8DownloadPage.html&quot; rel=&quot;nofollow&quot;&gt;site&lt;/a&gt; and design the same Inverse Chebyshev filter in both programs. Use the Edit | Copy and Edit | Paste commands to copy the response from the IIR into the FIR program and see how many FIR taps are required to &quot;mimic&quot; an IIR response. I think you will understand the point Hotpaw2 is making rather quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to download these programs, at least take a look at this &lt;a href=&quot;http://iowahills.com/B2PolynomialFIRFilters.html&quot; rel=&quot;nofollow&quot;&gt;web page&lt;/a&gt; to see how the tap count affects the duplication of an IIR filter response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, the answer to your question is; if you don't have a limit on FIR tap count, you can emulate any IIR response with an FIR system. Or said a bit differently, if you have an infinite number of taps, you can easily emulate an infinitely long IIR response.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastEditorUserId="5108" LastEditDate="2016-01-31T21:22:09.827" LastActivityDate="2016-01-31T21:22:09.827" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28590" PostTypeId="2" ParentId="28571" CreationDate="2016-01-31T23:37:01.990" Score="2" Body="&lt;p&gt;Simply truncating the impulse response of an IIR filter will give the optimal $\ell_2$ FIR approximation to the IIR system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whether this form of approximation is good enough to &quot;mimic&quot; the IIR system depends on what you mean by that.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-01-31T23:37:01.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28592" PostTypeId="2" ParentId="28578" CreationDate="2016-02-01T03:58:45.247" Score="2" Body="&lt;p&gt;When a continuous time signal is sampled in discrete intervals, the effect in the frequency domain is that the CTFT becomes periodic in frequency - that is, you end up with &quot;copies&quot; of the original CTFT, with each copy centered at frequencies equal to k*1/T (k = any integer). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, when you sample at 12/pi you will get a copy of the original CTFT centered at w=0, w=12/pi, w=-12/pi, w=24/pi, w=-24/pi, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you have frequency content between 2&amp;lt;|w|&amp;lt;4 in the w=0 case, the w=k*12/pi cases will have frequency content between 2&amp;lt;|w-k*12/pi|&amp;lt;4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be careful - if frequency content from multiple copies have frequency content in the same places on the frequency axis, the effect is that they add together.  This is called &quot;aliasing&quot; and is usually an unwanted effect of sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform#/media/File:Fourier_transform,_Fourier_series,_DTFT,_DFT.gif&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a nice graph that shows the effect of sampling a continuous time signal on the FT.&lt;/p&gt;&#xA;" OwnerUserId="19335" LastActivityDate="2016-02-01T03:58:45.247" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28593" PostTypeId="1" CreationDate="2016-02-01T05:15:11.193" Score="4" ViewCount="6166" Body="&lt;p&gt;I am studying decision trees and machine learning. I have encountered with this word several time. Although, it seems that it not an important concept, I cannot understand this word in machine learning literature. For example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;if the test does not significantly satisfy the criteria, then it creates a leaf and computes the prototype of the instances belonging to the leaf&quot;&#xA;  . &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;what does prototype in this sentence mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A prototype is an early sample, model, or release of a product built to test a concept or process or to act as a thing to be replicated or learned from.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But it does not make sense. &lt;/p&gt;&#xA;" OwnerUserId="15003" LastActivityDate="2019-10-15T16:58:01.167" Title="what does prototype mean in clustering?" Tags="|machine-learning|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28595" PostTypeId="1" CreationDate="2016-01-31T04:15:52.057" Score="0" ViewCount="209" Body="&lt;p&gt;I use a microphone array to localise a sound source in a small lecture theatre. &#xA;I tested it  with white noise and a bird noise source. I found out that the white noise source give very good results. However, bird noise give noisy results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: does white noise produce less reverb and echo noise?&#xA;If so, why is that?&lt;/p&gt;&#xA;" OwnerDisplayName="Minh Nguyen" LastEditorUserId="15892" LastEditDate="2016-02-01T10:40:52.247" LastActivityDate="2016-02-01T10:40:52.247" Title="White noise sound vs harmonic sound reverb" Tags="|sound|acoustics|measurement|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28596" PostTypeId="2" ParentId="28582" CreationDate="2016-02-01T09:53:17.037" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Will that affect the quality of speech comparison, and by how much?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That is impossible to tell without knowing what the Node.js thing does internally; I think it's a bit much too ask for us to search for what you meant. As a comment: signal processing in JavaScript sounds like a bad idea, performance-wise &lt;em&gt;and&lt;/em&gt; development-wise; it's really not what JS was designed and optimized for, and there's a significant lack of libraries, let alone efficient ones. I always urge people to use the right tools for their job, and JS isn't that here, I think. &lt;code&gt;&amp;lt;/comment&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a pure signal point of view, you can model the effect of quantization as noise. The problem here being that this kind of noise is neither uncorrelated to the signal, nor necessarily white. To make things a bit harder  on the compensation side, its amplitude typically isn't Gaussian even. Oh, well, but here goes quantization noise power, a figure that is both very important to understand the maximum SNR you can get out of a digital system and doesn't say much as long as you don't say how well the signal processing can deal with this specific kind of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily, for &quot;small enough&quot; quantization steps, a little stochastic consideration¹ says that the assumption that quantization noise (QN henceforth) is additive is pretty justified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assuming your signal amplitude is really uniformly distributed, and your ADC being perfectly uniform, the amplitude $\text{SNR}_Q$ (signal-to-QN-ratio) for an M-bit ADC becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;\text{SNR}_Q &amp;amp;= 2^M\\&#xA;\text{SNR}_Q \text{[dB]}&amp;amp;= 20 \log_{10}(2^M)\\&#xA; &amp;amp;= 20  \log_{10}(2)\,M \\&#xA;&amp;amp;\approx 6 M\text,&#xA;\end{align*}&#xA;$$&#xA;which implies that for 8bit, your $\text{SNR}_{Q,8b} \approx 48\,\text{dB}$, and for 16bit $\text{SNR}_{Q,16b} \approx 96\,\text{dB}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, speech definitely isn't uniform in amplitude; it's a bit hard to justify this model without knowing what your recording looks like, but I'd rather say it's composed of sines; in that case, you get an additional $1.8\text{dB}$ noise for both cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Point here is that I doubt that a &quot;real world, non-studio equipment, non-anechoic-chamber silence&quot; speech recording will ever be any close to $48\,\text{dB}$, so probably, no, that's a fine choice, and by the way you ask this question, I kind of doubt it will be trivial to extend the algorithm (which probably uses a lot of elegant numerical math internally) to 16bit, anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;¹ the amount of noise power correlated to the signal necessarily being very limited, and an mutually independent set of sufficiently many i.i.d. realizations (Normal due to CLT) added up still being Normal if their moments weren't too different ...&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-01T09:53:17.037" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28597" PostTypeId="2" ParentId="28593" CreationDate="2016-02-01T10:35:58.340" Score="2" Body="&lt;p&gt;A prototype is an element of the data space that represents a group of elements. On the context of clustering (e.g. under a leaf), a cluster prototype serves to characterize the cluster, their elements. You can have a look at &lt;a href=&quot;https://www-users.cs.umn.edu/~kumar/dmbook/ch8.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cluster analysis: basic concepts and algorithms&lt;/a&gt; for instance, taken from &lt;a href=&quot;http://www-users.cs.umn.edu/~kumar/dmbook/index.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to data mining&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a more specific acceptation, it denotes an instance of clustering for combined numerical and categorical values, in the spirit of k-means, k-modes, k-medians, see for instance &lt;a href=&quot;https://amva4newphysics.wordpress.com/2016/10/26/into-the-world-of-clustering-algorithms-k-means-k-modes-and-k-prototypes/comment-page-1/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Into the world of clustering algorithms: k-means, k-modes and k-prototypes&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For numerical and categorical data, another extension of these&#xA;  algorithms exists, basically combining k-means and k-modes. It is&#xA;  called k-prototypes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2018-03-13T09:41:04.590" LastActivityDate="2018-03-13T09:41:04.590" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28598" PostTypeId="1" CreationDate="2016-02-01T10:48:33.250" Score="1" ViewCount="784" Body="&lt;p&gt;Is it possible to realize DFT of 6 samples by using 3 DFT2 blocks? For example if had 2 * N samples by one step of decimation in frequency or time is possible to reduce DFT(2N) to 2 * DFT(N). So if we had 2 * DFT(N) blocks we could do it that way. What if we had 3N samples and 3 DFT(N) blocks. In my question N equals 2. How would the structure look and what is formula for X(k) element of spectrum? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic problem here is how to find different ways to calculate DFT with given blocks and using only additional sum blocks and multiplying with twiddle factors?&lt;/p&gt;&#xA;" OwnerUserId="19339" LastEditorUserId="19339" LastEditDate="2016-02-05T15:12:55.967" LastActivityDate="2016-02-05T15:12:55.967" Title="How to realize DFT6 with 3 DFT2 blocks?" Tags="|fft|dft|" AnswerCount="2" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28599" PostTypeId="1" CreationDate="2016-02-01T12:29:41.763" Score="0" ViewCount="129" Body="&lt;p&gt;Digital signal &lt;a href=&quot;http://hpiers.obspm.fr/eop-pc/index.php?index=C04&amp;amp;lang=en&quot; rel=&quot;nofollow&quot;&gt;UT1-UTC&lt;/a&gt; is not periodic but is including many sinusoids (periodic elements in IERS nomenclature) that are not multiples of some fundamental. For example tidal sinusoids are not multiples of yearly seasonal sinusoid because lunar month is not submultiple of the year. Then, is it possible these sinusoids be extracted from UT1-UTC by Discrete Fourier Transform? &lt;/p&gt;&#xA;" OwnerUserId="17893" LastActivityDate="2016-07-01T02:21:52.650" Title="Is it possible exctract sinusoids from non periodic signal?" Tags="|fourier-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28600" PostTypeId="2" ParentId="28578" CreationDate="2016-02-01T13:35:36.057" Score="-1" Body="&lt;p&gt;Thanks @rothloup !&lt;br&gt;&#xA;I'm adding a layman's explanation to your answer and explaining the result: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;strong&gt;&lt;em&gt;four&lt;/em&gt;&lt;/strong&gt; types of &lt;strong&gt;&lt;em&gt;Fourier&lt;/em&gt;&lt;/strong&gt; transforms: (that's easy to remember!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All Fourier transforms work with infinite values so either we add zeroes around the given signal or we repeat the signal to infinity, with the length of the given signal as its periodicity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The four types of transforms are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;CTFT&lt;/strong&gt; or simply the &lt;strong&gt;FT&lt;/strong&gt; (Fourier Transform): &lt;strong&gt;&lt;em&gt;Continuous, Aperiodic&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;&#xA;Used for a continuous signal with &quot;one time&quot; information in a small region of time. &lt;strong&gt;Zeroes added&lt;/strong&gt; before and after to infinity, for using this transformation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;FS&lt;/strong&gt; or &lt;strong&gt;Fourier Series&lt;/strong&gt;: &lt;strong&gt;&lt;em&gt;Continuous, Periodic&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;&#xA;Used for a continuous periodic signal. We &lt;strong&gt;repeat the original (limited time region) signal&lt;/strong&gt; before and after to infinity, for using this transformation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;DTFT&lt;/strong&gt;: &lt;strong&gt;&lt;em&gt;Discrete, Aperiodic&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;&#xA;Used for a discrete signal with &quot;one time&quot; information in a small region of time. &lt;strong&gt;Zeroes added&lt;/strong&gt; before and after to infinity, for using this transformation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;DFT&lt;/strong&gt;: &lt;strong&gt;&lt;em&gt;Discrete, Periodic&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;&#xA;Used for a periodic discrete signal. We &lt;strong&gt;repeat the original (limited time region) signal&lt;/strong&gt; before and after to infinity, for using this transformation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The input of the DTFT - is discrete (sampled) input from an &lt;strong&gt;aperiodic&lt;/strong&gt; signal (actually: information in a specified finite region of time, the rest set to zero...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the infinite zeroes being added, the period becomes extremely large, actually infinitely large, so there is only one period - or in other words the input is actually aperiodic!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the zeroes added, the spacing in the frequency domain of the transform's &lt;strong&gt;output&lt;/strong&gt; become extremely (actually: infinitely) close to each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the &lt;strong&gt;output of the DTFT&lt;/strong&gt; is &lt;strong&gt;&lt;em&gt;Continuous&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Periodic&lt;/em&gt;&lt;/strong&gt; and also &lt;strong&gt;&lt;em&gt;Symetric&lt;/em&gt;&lt;/strong&gt; around the Nyquist number (in our case zero).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(That is why in the computer, where you deal only with sampled discrete data, we use the DFT and not the DTFT)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we have the CTFT $X[(\omega]$, we get the DTFT $X(\Omega)$ by setting:&lt;br&gt;&#xA;$$\Omega = \omega T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case: since the samples were $12/\pi$ (in words: 12 times each cycle) and since the DTFT is symetric the period is half of the cycle (the other half is simply its mirror image) so the period is 6 and we multiply the $\Omega$ by that. While the areas with valid info are reduced: Formerly from 2-4, a quarter of the -4 to 4 period span, And become a sixth of the now -3 to 3 span:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(\Omega) = \begin{cases} 6|\Omega|-2  &amp;amp; \text{for 1 &amp;lt; |$\Omega$| &amp;lt; 2}\\ 0 &amp;amp; \text{otherwise} \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a line from 4 to 0 between $\Omega$ 1 and 2  &lt;/li&gt;&#xA;&lt;li&gt;a line from 0 to 4 between $\omega$ -2 to -1. (actually down from 4 to 0 going backwards, from $\Omega$ 2 to 1)  &lt;/li&gt;&#xA;&lt;li&gt;and zero: between 0 and 1, between 2 and 3, and between 0 to -1 and -2 to -3. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As seen on the plot between -3 and +3 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pattern is repeated, starting with -3, resulting in: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(\Omega) = \begin{cases} \frac{6|\Omega|}{k}-2  &amp;amp; \text{for: $6k+1$ &amp;lt; |$\Omega$| &amp;lt; $6k+2$ ($k$ being any positive integer)} \\ 0 &amp;amp; \text{otherwise} \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As plotted in the answer&lt;/p&gt;&#xA;" OwnerUserId="19322" LastEditorUserId="19322" LastEditDate="2016-02-21T21:32:43.953" LastActivityDate="2016-02-21T21:32:43.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28601" PostTypeId="1" AcceptedAnswerId="28602" CreationDate="2016-02-01T15:52:39.350" Score="1" ViewCount="225" Body="&lt;p&gt;Can anyone help with this exercise from my Signal Processing exam? The text is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given two sequences $x$ and $y$ whose supports are respectively $[0,1]$&#xA;  and $[0,3]$ and their circular convolution's DFT is equally null, if&#xA;  the first value of $x$ sequence is $x(0)=2$ and the first value of $y$&#xA;  sequence is $y(0)=1$ then obtain $x(1), y(1), y(2), y(3)$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have tried to solve that supposing respectively that $X(k)=0$ for a first case, $Y(k)=0$ for a second case and then both equal to zero, and I have found two solution for each case. The problem is that my professor tell me that it has just one solution and it can be solve using DFT properties in, more or less, 1 minute, without solving linear system or doing hypothesis on the DFTs but I really don't understand what is referring to because I don't find anything on my notes or on my book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyone that have 1-minute solution? :S&lt;/p&gt;&#xA;" OwnerUserId="19343" LastEditorUserId="13309" LastEditDate="2016-03-26T13:33:23.410" LastActivityDate="2016-03-26T13:33:23.410" Title="Determine sequence's value from equally null circular convolution DFT" Tags="|dft|self-study|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28602" PostTypeId="2" ParentId="28601" CreationDate="2016-02-01T18:29:48.553" Score="2" Body="&lt;p&gt;Your professor is wrong, the solution is not unique. There are two (real-valued) solutions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x1 = [2, 2, 0, 0]; y1 = [1, -1, 1, -1]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with DFTs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;X1 = [4, 2-2i, 0, 2+2i]; Y1 = [0, 0, 4, 0]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(the product of which is obviously zero)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x2 = [2, -2, 0, 0]; y2 = [1, 1, 1, 1]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with DFTs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;X2 = [0, 2+2i, 4, 2-2i]; Y2 = [4, 0, 0, 0]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(the product of which is also zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how you obtain these two solutions: first of all, note that the DFT of the circular convolution of the two sequences is equal to the product of the DFTs of the two sequences, where the individual DFTs are of length $4$. The product is zero for all indices $0\le k&amp;lt;4$ if for each index at least one of the two DFTs is zero. Since I assume that we're talking about real-valued sequences, we only need to consider the indices up to and including Nyquist (i.e. index $k=2$), because the last index $k=3$ is redundant due to the symmetry of the DFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since none of the two sequences can be identical to zero ($x[0]$ and $y[0]$ are both given and non-zero), only specific DFT bins can be zero, not all of them. For the length $4$ DFT of the zero-padded length $2$ sequence $x[n]$ it is easy to see that its DFT is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X[0]&amp;amp;=x[0]+x[1]\\&#xA;X[1]&amp;amp;=x[0]-jx[1]\\&#xA;X[2]&amp;amp;=x[0]-x[1]\\&#xA;X[3]&amp;amp;=x[0]+jx[1]\;\;(=X^*[1]\;)\end{align}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which it is clear that with $x[0]\neq 0$, only $X[0]$ or $X[2]$ (but not both) can be zero. $X[1]$ can never be zero (for real-valued $x[1]$), from which it follows that $Y[1]$ must be zero. Since $Y[k]$ cannot be zero for all $k$, $X[0]$ or $X[2]$ must be zero. This leaves us with two possible choices for $x[1]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[1]=x[0]\rightarrow X[2]=0\tag{a}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[1]=-x[0]\rightarrow X[0]=0\tag{b}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first case, we need a DFT $Y[k]$ which is zero for all $k$ except for $k=2$, in the other case $Y[k]$ must be zero for all $k$ except for $k=0$. Note that $k=0$ corresponds to DC, and $k=2$ corresponds to Nyquist. The DFT of a sequence is zero everywhere except at DC if the sequence is constant, and it is zero everywhere except at Nyquist if the sequence is alternating. So for choice $(a)$ we need to choose $y[n]$ to alternate, and for choice $(b)$, $y[n]$ needs to be constant. These are the only two real-valued options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; If you allow the sequences $x[n]$ and $y[n]$ to be complex-valued, there are two additional solutions. From $(1)$ it can be seen that for $x[0]\neq 0$, $X[k]$ can only be made zero for one index $k$. This means that $Y[k]$ must be zero for all indices except for that one index where $X[k]$ is zero. Therefore, $Y[k]$ must be a spectral line, i.e. its corresponding sequence $y[n]$ must be a complex exponential on the DFT ($N=4$) grid:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=e^{j\pi nl/2},\quad l=0,1,2,3\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $y[n]$ as given by $(2)$, $Y[k]$ is zero for $k=l$. The solutions $l=0$ (constant sequence), and $l=2$ alternating sequence are real-valued and were given above. The two other solutions are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;y3 = [1, i, -1, -i]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;($l=1$) and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;y4 = [1, -i, -1, i]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;($l=3$). The DFT of the corresponding sequences $x[n]$ must have a zero at $k=l$. From $(1)$ we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;x3 = [2, -2i, 0, 0]&lt;/code&gt;&#xA;and&#xA;&lt;code&gt;x4 = [2, 2i, 0, 0]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The DFTs are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;X3 = [2 - 2i, 0, 2 + 2i, 4]; Y3 = [0 4 0 0]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;X4 = [2 + 2i, 4, 2 - 2i, 0]; Y4 = [0 0 0 4]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both products are clearly zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, there are four solutions to the problem, two of which are real-valued.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-02T08:11:28.787" LastActivityDate="2016-02-02T08:11:28.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28603" PostTypeId="2" ParentId="28599" CreationDate="2016-02-01T20:46:18.657" Score="0" Body="&lt;p&gt;DFT is always finitely long. So yes, that's what it does: deconstruct a finite sequence of $N$ samples into a representation based on the orthogonal $N$ sinusoidals. That works for every sample vector $\in \mathbb C^N$, the DFT mathematically just being a multiplication with a Matrix $\in \mathbb C^{N\times N}$, and being bijective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question how meaningful that representation is can only be answered by yourself, because it depends on what you want to do, and what assumptions you make about the signal.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-01T20:46:18.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28604" PostTypeId="2" ParentId="28599" CreationDate="2016-02-01T21:43:21.540" Score="1" Body="&lt;p&gt;Fourier's theorem say almost any (non-pathological) waveform, periodic or not, can be decomposed into sinusoids (or complex exponentials).  Whether, or how well, those sinusoids correspond to any underlying pseudo-periodic phenomena or not is another issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that with a DFT, you may need to interpolate a periodic signal between the DFT result bin sinusoids.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-01T21:43:21.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28605" PostTypeId="1" AcceptedAnswerId="28615" CreationDate="2016-02-02T00:07:54.017" Score="2" ViewCount="1233" Body="&lt;p&gt;I've been experimenting with &lt;a href=&quot;http://ajaxsoundstudio.com/software/pyo/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PYO&lt;/a&gt; recently, a Python module for sound synthesis and audio processing.  This is really my first foray into this topic, so I have what is probably a very basic question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few alternative mechanisms available for creating periodic waveforms such as a sawtooth or triangle wave:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Using additive synthesis (via &lt;a href=&quot;http://ajaxsoundstudio.com/pyodoc/api/classes/tables.html#sawtable&quot; rel=&quot;nofollow noreferrer&quot;&gt;SawTable&lt;/a&gt;, which internally calls &lt;a href=&quot;http://ajaxsoundstudio.com/pyodoc/api/classes/tables.html#harmtable&quot; rel=&quot;nofollow noreferrer&quot;&gt;HarmTable&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approximates a waveform through successive addition of sine waves.  E.g.,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pyo import *&#xA;table = SawTable(order=20)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which gets me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tQyA5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tQyA5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using a &quot;linear&quot; table (&lt;a href=&quot;http://ajaxsoundstudio.com/pyodoc/api/classes/tables.html#lintable&quot; rel=&quot;nofollow noreferrer&quot;&gt;LinTable&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows one to construct a waveform as a series of straight line segments.  E.g.,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pyo import *&#xA;table = pyo.LinTable([(0, -1), (8191, 1)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which gets me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1zxVS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1zxVS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These two waveforms sound similar, of course, but they are qualitatively different.  What is the technical difference between the two?  Is there a reason to prefer one mechanism over the other?&lt;/p&gt;&#xA;" OwnerUserId="19349" LastEditorUserId="19349" LastEditDate="2016-02-02T19:40:23.340" LastActivityDate="2016-02-02T19:40:23.340" Title="Additive synthesis vs. &quot;just draw the waveform&quot;" Tags="|python|signal-synthesis|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28606" PostTypeId="2" ParentId="28605" CreationDate="2016-02-02T00:19:35.320" Score="1" Body="&lt;p&gt;If your goal is to get a sawtooth wave, then additive synthesis is a bad way to go about it as a sawtooth wave is a superposition of an infinite number  of sine waves (in the continuous case).  Many instruments, particularly woodwinds, are well modeled by a relatively few sine waves.  The exact mixture determines the &lt;a href=&quot;https://en.wikipedia.org/wiki/Timbre&quot; rel=&quot;nofollow&quot;&gt;timbre&lt;/a&gt; and thus what instrument it sounds like, e.g. an oboe as compared to a clarinet.  Violins, however, generate a slip-stick motion that is more like a sawtooth wave and thus are harder to model accurately and efficiently with additive synthesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you are going for an &quot;electronic&quot; sound, I would say using &lt;code&gt;LinTable&lt;/code&gt; &lt;em&gt;by itself&lt;/em&gt; would be a somewhat unusual thing.  However, using it as input to a filter would make more sense.  For example, if you did use a sawtooth wave to model a violin, you'd almost certainly pass it through a (among other things) low-pass filter to round it out a little and change the timbre.&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-02-02T00:19:35.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28609" PostTypeId="1" AcceptedAnswerId="28610" CreationDate="2016-02-02T02:58:49.607" Score="0" ViewCount="447" Body="&lt;p&gt;As usual, $y(t)$ is the output signal of a system, and $x(t)$ is the input signal.  I'm wondering whether or not a certain system has memory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's easy for me to see that the system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = \int_{t-T}^{t} x(t) dt$ where $T &amp;gt; 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;has memory, because an output at time $t_0$ depends on all values of input from $[t_0 - T, t_0]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about the following system, which just delays input by some constant $C$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y(t) = x(t - C)$ where $ C &amp;gt; 0 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon first glance, this doen't feel like it has memory because there is no integral.  &lt;strong&gt;But the output of a delay system does depend upon inputs from the past.  Does that mean a simple constant delay system has memory?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="19353" LastActivityDate="2016-12-15T07:27:18.000" Title="Memorylessness of simple delay system" Tags="|continuous-signals|system-identification|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28610" PostTypeId="2" ParentId="28609" CreationDate="2016-02-02T04:13:19.590" Score="3" Body="&lt;p&gt;A system is memoryless if its output ($y(t)$) for each value of the independent variable ($t$ in this case) at a given time is dependent &lt;strong&gt;only&lt;/strong&gt; on the input at that same time ($x(t)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every system that consists of a delay (like the one in your example) or an accumulator, for example, are systems &lt;strong&gt;with memory&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be seen just by replacing $t$ by some number. Take, for instance, $t=0$. In that case, the output for that instant ($y(0)$) depends on the input for another value of the independent variable ($x(C),C&amp;gt;0$); that means that the system has memory.&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-02-02T04:13:19.590" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28612" PostTypeId="1" CreationDate="2016-02-02T10:49:53.113" Score="0" ViewCount="1753" Body="&lt;p&gt;I'm doing a project on audio classification, mainly focused on Bird sounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know which is the best similarity measure that I can adopt to check test signal with training data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I intent to do the project in matlab.&lt;/p&gt;&#xA;" OwnerUserId="19361" LastEditorUserId="13320" LastEditDate="2016-02-02T12:28:48.530" LastActivityDate="2016-02-02T20:36:13.750" Title="best similarity measure for audio classification" Tags="|audio|classification|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28613" PostTypeId="2" ParentId="28612" CreationDate="2016-02-02T10:58:53.863" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I would like to know which is the best similarity measure that I can adopt to check test signal with training data.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Welcome to engineering. There is no universally &quot;best&quot; approach, as it always depends on your specific models. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, as soon as you can define what &quot;similarity&quot; should mean, you might be able to derive something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that bird's auditory senses kind of work similar to human hearing, I'd try with the usual audio comparison models, probably a basic MFCC thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a comment: A former advisor of me once said: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A week in the lab can easily save you up to two hours of reading literature.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Really, there's a whole lot of papers, textbook introductions and wikipedia articles on sound comparison. Start with anything, and read forward. That's going to be faster than asking for a single answer to your acute problem without getting the bigger picture of how things work.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-02T10:58:53.863" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28614" PostTypeId="2" ParentId="28612" CreationDate="2016-02-02T11:41:39.373" Score="1" Body="&lt;p&gt;As @Marcus Müller wrote, the best similarity remains an open question depending on the context. For birds which imitate human speech, you can have a look at: &lt;a href=&quot;http://assta.org/sst/SST-94-Vol-l/cache/SST-94-VOL1-Chapter4-p13.pdf&quot; rel=&quot;nofollow&quot;&gt;The transformation of birds sounds into &quot;speech&quot;&lt;/a&gt;. Other references are: &lt;a href=&quot;http://www.maths.tcd.ie/~mnl/store/TchernichovskiEtAl2000a.pdf&quot; rel=&quot;nofollow&quot;&gt;A procedure for an automated measurement of song similarity&lt;/a&gt; or &lt;a href=&quot;http://dx.doi.org/10.1109/TASL.2006.872624&quot; rel=&quot;nofollow&quot;&gt;Parametric Representations of Bird Sounds for Automatic Species Recognition&lt;/a&gt;. A look at IEEE Xplore (as suggested by @Marcus Müller), Scopus,  or Google Scholar with queries  like [similarity AND (&quot;bird sounds&quot; OR &quot;bird songs&quot;)] can provide results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even better, ask your favorite university librarian, she/he knows where to look at.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-02-02T20:36:13.750" LastActivityDate="2016-02-02T20:36:13.750" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28615" PostTypeId="2" ParentId="28605" CreationDate="2016-02-02T13:53:42.400" Score="1" Body="&lt;p&gt;A drawn sawtooth waveform can contain higher frequency harmonics than half the waveform sampling rate, thus leading to aliasing (potentially noise at other folded frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additive synthesis using pure sine tables can avoid this aliasing noise problem.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-02T13:53:42.400" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28616" PostTypeId="1" AcceptedAnswerId="28618" CreationDate="2016-02-02T13:59:48.237" Score="3" ViewCount="178" Body="&lt;p&gt;I'm reading Udo Zölzer's &quot;Digital Audio Signal Processing&quot; and there's a piece about acoustic room simulation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question will be more about maths and acoustics, but I assume anybody who does DSP with sound knows the topic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to understand an excerpt about Craven's hypothesis (conerning human's sound source distance evaluation) which is used at Gerzon's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XdRR5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XdRR5.png&quot; alt=&quot;The excerpt from the book&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding: Craven was trying to say that as we perceive signals with our ears, we can easily evaluate two things: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;time difference between arrivals of the direct signal and the first reflection&lt;/li&gt;&#xA;&lt;li&gt;the ratio of their amplitudes&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, he says, our brain evaluates these two and can determine (more or less) the distance of the sound source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't get the thing with &lt;strong&gt;g&lt;/strong&gt;. It's said, that &lt;strong&gt;g&lt;/strong&gt; stands for relative amplitude of direct signal to first reflection. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shouldn't it be the other way? I mean, shouldn't it stand for &quot;relative amplitude of first reflection to direct signal&quot;? If we assume same SPL at both sources, the source that is further provides a weaker signal, than the one that is closer to the receiver. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I would know only the verbal description of &lt;strong&gt;g&lt;/strong&gt;, I would expect it to always be greater than 1, as direct signal is always louder than any reflected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how does it happen, that&#xA;g = SPL/SPL' = d/d' &#xA;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HWSGP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HWSGP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to inversed square distance law for sound, if we use SPLs, sound pressure level at distance r: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;SPL(r) = (SPL@source)/r&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if &lt;strong&gt;g&lt;/strong&gt; would stand for the &quot;relative amplitude of direct signal to first reflection&quot; I would calculate: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;g = SPL/SPL' = (P/d) / (P/d') = d'/d&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;SPL&lt;/strong&gt; is Sound Pressure Level of the direct sound at the receiver,&#xA;&lt;strong&gt;SPL'&lt;/strong&gt; is SPL of the first reflection at the receiver, &lt;strong&gt;P&lt;/strong&gt; is sound source's SPL, &lt;strong&gt;d&lt;/strong&gt; and &lt;strong&gt;d'&lt;/strong&gt; are distances from sources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 1.&lt;/strong&gt;: is there a mistake at my interpretation or in the description in the book?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2.&lt;/strong&gt;: after all the calculations, when we have the formula for d, that Craven says allows our brain to evaluate the distance of the source, where does brain take the speed of sound from to calculate it? Should it be trained?&lt;/p&gt;&#xA;" OwnerUserId="19362" LastActivityDate="2016-02-02T14:28:03.220" Title="Acoustic room simulation - Craven's hypothesis" Tags="|sound|acoustics|psychoacoustics|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28617" PostTypeId="2" ParentId="28535" CreationDate="2016-02-02T14:23:27.187" Score="4" Body="&lt;p&gt;The CZT allows for a fairly general evaluation of the Z transform - the more general evaluation path looks like a spiral, so it has a radial component step size as well an angular step size.For  spectral zooming, you're only using a subset of this. You're evaluating around the unit circle and only for a small set of frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Zoom FFT can be implement in a more traditional manner:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Frequency shift by multiplying time domain signal by a complex exponential - baseband around the center frequency.&lt;/li&gt;&#xA;&lt;li&gt;Low-pass filter and decimate - to reduce the sampling frequency.&lt;/li&gt;&#xA;&lt;li&gt;Apply a (shorter) FFT&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that the FFT in step 3 is shorter because of the reduced sampling rate. To get a frequency resolution of $\nabla f$ you need a time series of length $T=1/\nabla f$ and at a lower sampling frequency you can get that time length signal in fewer samples. This series of steps applies a series of operations to the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now another way of looking at those series of steps is to apply them to the filter rather than the signal. Now you're shifting a low-pass filter in frequency so it becomes a complex band-pass filter and the decimation step causes duplicates of your band-pass signal to appear around 0 Hz (and throughout the entire frequency spectrum). At this point you can apply a shorter FFT. To make the two series of steps exactly equivalent there are some restrictions on the sampling frequency - If you shift the filter to a center frequency of $f_c$ then you have to be careful of the decimation factor if you want the frequency content at $f_c$ to be mapped exactly to 0 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CZT for Zoom FFT is essentially doing these same steps. If you examine the CZT from this point of view you can work the mathematical equivalence.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2016-02-02T14:23:27.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28618" PostTypeId="2" ParentId="28616" CreationDate="2016-02-02T14:28:03.220" Score="1" Body="&lt;p&gt;&lt;strong&gt;Question 1:&lt;/strong&gt; The equations (6.7), (6.8), and (6.9) are all consistent, so I suggest that the wording for the definition of $g$ is incorrect in the book.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2:&lt;/strong&gt; The brain just hears the time difference and, by experience, can figure out what that means in terms of distance. So the brain has effectively &quot;calibrated&quot; for whatever the usual speed of sound in air is.  I find that hearing things under water (where the speed of sound is about five times faster) makes things seem much closer.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-02-02T14:28:03.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28620" PostTypeId="1" CreationDate="2016-02-02T16:50:53.723" Score="1" ViewCount="91" Body="&lt;p&gt;I'm looking for a short lowpass filter that also extrapolates lines,&#xA;[0 1 2 3] --&gt; 4,&lt;br&gt;&#xA;so I need (correct me) $H([\ 0\ \ 0.25\ \ 0.5\ ]) \approx [ 1\ \ 2\ \ 0 ]$ .&lt;br&gt;&#xA;How close can one get to this with 2 to 4 FIR and 1 IIR coefficient ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added: for a 3-term FIR, I want&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Input     -&amp;gt; output&#xA; 1  1  1  -&amp;gt; 1  # const -&amp;gt; const&#xA;-1  0  1  -&amp;gt; 2  # extrapolate lines&#xA; 1 -1  1  -&amp;gt; 0  # low-pass&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Solving these 3 equations gives the FIR [1.25 .5 -.75] .&#xA;I can do longer FIRs by least squares + fiddling. But how do I do FIR x 1-term IIR ?&#xA;Is there a general approach to filters that extrapolate lines ?&lt;/p&gt;&#xA;" OwnerUserId="4389" LastEditorUserId="4389" LastEditDate="2016-02-03T13:07:26.083" LastActivityDate="2016-12-29T17:27:04.737" Title="Short lowpass filter that also extrapolates lines" Tags="|filter-design|lowpass-filter|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28621" PostTypeId="2" ParentId="28620" CreationDate="2016-02-02T17:22:10.407" Score="1" Body="&lt;p&gt;The most straight-forward solution is a length $N$ FIR filter with impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=\begin{cases}\frac{N}{N-1},&amp;amp;\quad n=0\\&#xA;-\frac{1}{N-1},&amp;amp;\quad n=N-1\\0,&amp;amp;\quad\text{otherwise}\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $N=3$, the output sample computed from three input samples &lt;code&gt;x = [1 3 5]&lt;/code&gt; is $\frac32\cdot 5 - \frac12\cdot 1 =7$, as it should be. Note that this filter is very cheap, it has only two non-zero taps regardless of the value $N$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-02T17:22:10.407" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28623" PostTypeId="1" AcceptedAnswerId="28791" CreationDate="2016-02-02T20:22:30.467" Score="0" ViewCount="155" Body="&lt;p&gt;I have the next problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ncSzi.png&quot; alt=&quot;1&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_{c1}(j\omega )$ is the ideal antialising filter and $H_{c2}(j\omega )$ is a real one. I'm asked to design $H(e^{j\Omega })$ so that $y[n]$ in the second diagram (the one on the right) is exactly the same as $x[n]$ in the first diagram (the one on the left).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did something but I'm pretty sure that it isn't right. I found the equation for $H_{c2}(j\omega )$ as a function of $\omega$. Then I normalized the $\omega$-axis due to the A/D converter and divided the magnitude by $T$. If I didn't make any mistakes while doing the algebra, we get that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H_{c2}(e^{j\Omega })=\frac{9}{10}\cdot \frac{1}{\pi - \omega _{p}T}\cdot \Omega + \frac{9}{10}\cdot \frac{1}{\pi - \omega _{p}T}\cdot \pi + \frac{1}{10}\hspace{0.5cm} for\hspace{0.5cm} -\pi &amp;lt; \Omega &amp;lt; -\omega _{p}T$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, I just thought of finding the inverse function of $H_{c2}(e^{j\Omega })$ for $-\pi &amp;lt; \Omega &amp;lt; -\omega _{p}T$... And that was it. Let $B(\Omega)=\frac{1}{\frac{9}{10}\cdot \frac{1}{\pi - \omega _{p}T}\cdot \Omega + \frac{9}{10}\cdot \frac{1}{\pi - \omega _{p}T}\cdot \pi + \frac{1}{10}}$. Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\Omega }) =&#xA;\left\{&#xA;	\begin{array}{l1}&#xA;		B(\Omega )  &amp;amp; \mbox{if } -\pi &amp;lt;\Omega &amp;lt;-\omega _{p}T \\&#xA;		1 &amp;amp; \mbox{if } -\omega _{p}T &amp;lt; \Omega&amp;lt;\omega _{p}T \\&#xA;B(-\Omega) &amp;amp; \mbox{if } \omega _{p}T &amp;lt; \Omega&amp;lt;\pi&#xA;	\end{array}&#xA;\right.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with this is that I'm pretty sure that the filter I &quot;designed&quot; has no antitransform. I think that there is a smarter way of approaching this exercise but I just can't see it.&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-02-10T14:31:28.310" Title="Problem designing a specific filter" Tags="|fourier-transform|filter-design|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28624" PostTypeId="1" CreationDate="2016-02-02T21:01:18.103" Score="1" ViewCount="644" Body="&lt;p&gt;As I'm learning about DSP I can understand the process of taking a continuous signal into a discrete signal. I understand an oscillator producing different types of signals, including a periodic signals (especially sinusoids), phase shifts and amplitudes etc., &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://class.coursera.org/dsp-006&quot; rel=&quot;nofollow&quot;&gt;I'm following a coursera class&lt;/a&gt;, and reading DSP theory.. Rather than blindly using the DSP libraries out there I want to know exactly why something is happening. My 1st roadblock is this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If we already have enough samples of amplitudes collected at a reasonably sample rate (using Nyquist-Shannon) Why does it matter that a signal (Sinusoid) can be broken down into other sinusoids? Aren't the samples enough to reconstruct the original signal/sound?&lt;/li&gt;&#xA;&lt;li&gt;What is advantageous by knowing that the Fast Fourier Transform can decompose a signal into multiple signals?&lt;/li&gt;&#xA;&lt;li&gt;The sinusoids that make up a single sinusoid also have other sinusoids that compose them. If a signal has say 5 sinusoids, those 5 sinusoids, according to DFT if I'm correct, can also each have sinusoids.. Isn't this recursive or infinite? At what point can we say we have &quot;enough&quot; sinusoids to represent a signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the clarification &amp;amp; patience.&lt;/p&gt;&#xA;" OwnerUserId="19367" LastEditorUserId="80" LastEditDate="2016-05-03T19:53:27.577" LastActivityDate="2016-05-03T20:01:29.640" Title="What is the benefit of FFT when we're already sampling at an acceptable rate?" Tags="|discrete-signals|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28625" PostTypeId="2" ParentId="28624" CreationDate="2016-02-02T21:36:48.923" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Not all periodic signals are sinusoids.  Items 1 and 3 should not assume such.  Not all sampling is done just for reconstruction.  Look up other needs or uses for sampled signals.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A linear time-invariant system can behave differently to different frequency sinusoidal inputs (as provided by common solutions to certain low order differential equations), so it may be easier to figure how that system responds to other types of far more complicated inputs by breaking them down into the sum of simpler sinusoidal ones.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A DFT or FFT won't break down a pure (unmodulated) sinusoid that is integer periodic in aperture into other sinusoids (other than that a pure sinusoid of an arbitrary phase can be broken down into component cosine and sine sinusoids of that same frequency).  But an FFT can &quot;break down&quot; other types of signals.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-02-03T17:35:33.507" LastActivityDate="2016-02-03T17:35:33.507" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28626" PostTypeId="1" AcceptedAnswerId="28627" CreationDate="2016-02-03T00:14:34.857" Score="3" ViewCount="3003" Body="&lt;p&gt;Given this system:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/b7T4Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b7T4Z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to show the $\mathcal Z$-transform of $y[n]$ as a function of the $\mathcal Z$-transform of $x[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I know that for downsampling alone:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z) = \frac1M\sum_{m=0}^{M-1} X\left(e^\frac{-j2\pi{m}}M\cdot z^\frac 1M\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that for upsampling alone:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z) = X\left(z^M\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem here is that I don't quite understand how upsampling would affect the downsampling equation. Say we call the point between downsampling and upsampling $w[n]$, we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}Y(z) &amp;amp;= W\left(z^M\right)\\&#xA;W(z) &amp;amp;= \frac1M\sum_{m=0}^{M-1} X\left(e^\frac{-j2\pi{m}}M\cdot z^\frac 1M\right)\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if I will be getting:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z) = \frac1M\sum_{m=0}^{M-1} X\left(e^\frac{-j2\pi{m}}M\cdot z\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z) = \frac1M\sum_{m=0}^{M-1} X\left(e^{-j2\pi{m}}\cdot z\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or even something else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll be very happy for some clarification on this subject because I'm very baffled by it and I cannot find a solution anywhere, thank you.&lt;/p&gt;&#xA;" OwnerUserId="19368" LastEditorUserId="1629" LastEditDate="2016-02-03T12:52:06.037" LastActivityDate="2016-02-03T17:02:18.047" Title="Downsampling and Then Upsampling" Tags="|discrete-signals|sampling|z-transform|downsampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28627" PostTypeId="2" ParentId="28626" CreationDate="2016-02-03T04:56:04.763" Score="4" Body="&lt;p&gt;You will get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(z) = \frac1M\sum_{m=0}^{M-1} X(e^\frac{-j2\pi{m}}M*z)$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you were to upsample first and then downsample you would get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Y(z) = \frac1M\sum_{m=0}^{M-1} X(e^{-j2\pi{m}}*z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which just simplifies to (since $e^{-j2\pi{m}}=1$ for $m\in\mathbb{Z}$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac1M\sum_{m=0}^{M-1} X(e^{-j2\pi{m}}*z) = \frac1M\sum_{m=0}^{M-1} X(z) = X(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, if you upsample and downsample you can perfectly reconstruct the signal but if you downsample and then upsample, you are aliasing in the summation over rotations in the z-domain of the input.&lt;/p&gt;&#xA;" OwnerUserId="7600" LastEditorUserId="7600" LastEditDate="2016-02-03T17:02:18.047" LastActivityDate="2016-02-03T17:02:18.047" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28629" PostTypeId="1" AcceptedAnswerId="28634" CreationDate="2016-02-03T06:33:49.283" Score="0" ViewCount="842" Body="&lt;p&gt;i have N samples obtained by sampling a signal with lot of frequency contents. How will i apply daubechies wavelet transform to obtain the frequency and its location? i need to write a program which will process the signal and gives the frequency and location as the result.&lt;/p&gt;&#xA;" OwnerUserId="18914" LastActivityDate="2016-02-10T15:13:30.330" Title="Daubechies wavelet transform" Tags="|discrete-signals|signal-analysis|wavelet|transform|signal-synthesis|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28632" PostTypeId="2" ParentId="28598" CreationDate="2016-02-03T08:09:14.323" Score="5" Body="&lt;p&gt;The following is an important paper about FFT algorithms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tran-Thong, “Algebraic Formulation of the Fast Fourier Transform,” IEEE Circuits and&#xA;Systems magazine, vol. 3, no. 2, June 1981, pp. 9-19.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above, the author distinguishes 16 basic types of FFT algorithm, characterized by: 1) decimation type (DIT - type T below, or DIF - type F below), 2) input order, 3) output order, and 4) geometry.  The author also shows graphs, but they will not be shown here.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Alg.    Input Order Output Order Geometry&#xA;&#xA;T1      bit reverse sequential  in-place&#xA;T2      sequential  bit reverse in-place&#xA;T3      bit reverse bit reverse same output&#xA;T4      sequential  sequential  same output&#xA;T5      bit reverse bit reverse same input&#xA;T6      sequential  sequential  same input&#xA;T7      bit reverse sequential  isogeometric&#xA;T8      sequential  bit reverse isogeometric&#xA;&#xA;F1      bit reverse sequential  in-place        &#xA;F2      sequential  bit reverse in-place&#xA;F3      bit reverse bit reverse same output&#xA;F4      sequential  sequential  same output&#xA;F5      bit reverse bit reverse same input&#xA;F6      sequential  sequential  same input&#xA;F7      bit reverse sequential  isogeometric&#xA;F8      sequential  bit reverse isogeometric&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Although many of the algorithms can be attributed to different authors, as stated in the above paper: &quot;The Cooley-Tukey algorithm and its modifications are DIT algorithms.  The Gentleman-Sande algorithms and their modifications are DIF algorithms.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many more FFT algorithms other than the ones described above, including higher and mixed radix ones.  But they also exhibit similar characteristics.  For instance, take a look at the 6 point DIT radix-3/radix-2 graph shown on page 13 in the following reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ece.cmu.edu/~ee791/lectures/L18/FFTstructures.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://www.ece.cmu.edu/~ee791/lectures/L18/FFTstructures.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is two radix-3 butterflies followed by three radix-2 butterflies.  It is bit-reversed input and sequential output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, given that the FFT can be viewed as a matrix transpose, one can also decompose a 6 point FFT into three radix-2 butterflies, followed by two radix-3 butterflies.  You can also have DIT or DIT (or mixed decimation).  So you have several options to choose from.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastEditorUserId="14819" LastEditDate="2016-02-03T08:43:12.877" LastActivityDate="2016-02-03T08:43:12.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28634" PostTypeId="2" ParentId="28629" CreationDate="2016-02-03T10:32:45.870" Score="4" Body="&lt;p&gt;Looks like you need a general explanation of the discrete wavelet transform (DWT). DWT breaks a signal down into subbands distributed evenly in a logarithmic frequency scale, each subband sampled at a rate proportional to the frequencies in that band. The traditional Fourier transformation has no time domain resolution at all, or when done using many short windows on a longer data, equal resolution at all frequencies. The distribution of samples in the time and frequency domain by DWT is of form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;log f&#xA; |XXXXXXXXXXXXXXXX  X = a sample&#xA; |X X X X X X X X   f = frequency&#xA; |X   X   X   X     t = time&#xA; |X       X&#xA; |X&#xA; |X                &#xA;  ----------------t&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Single subband decomposition and reconstruction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    -&amp;gt; high -&amp;gt; decimate -------------&amp;gt; dilute -&amp;gt; high&#xA;   |   pass    by 2      high subband  by 2      pass \&#xA;in |                                                   + out&#xA;   |                                                  /  =in&#xA;    -&amp;gt; low  -&amp;gt; decimate -------------&amp;gt; dilute -&amp;gt; low&#xA;       pass    by 2      low subband   by 2      pass&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This creates two subbands from the input signal, both sampled at half&#xA;the original frequency. The filters approximate halfband finite impulse response (FIR) filters&#xA;and are determined by the choice of wavelet. Using Daubechies wavelets&#xA;(and most others), the data can be reconstructed to the exact original&#xA;even when the halfband filters are not perfect. Note that in the above scheme, the total amount of information (samples) stays the same throughout.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Decimation by 2: ABCDEFGHIJKLMNOPQR -&amp;gt; ACEGIKMOQ&#xA;  Dilution by 2: ACEGIKMOQ -&amp;gt; A0C0E0G0I0K0M0O0Q0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get the logarithmic resolution in frequency, the low subband is&#xA;re-transformed, and again, the low subband from this transformation&#xA;gets the same treatment etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Decomposition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    -&amp;gt; high -&amp;gt; decimate --------------------------------&amp;gt; subband0&#xA;   |   pass    by 2&#xA;in |                 -&amp;gt; high -&amp;gt; decimate ---------------&amp;gt; subband1&#xA;   |                |   pass    by 2&#xA;    -&amp;gt; low -&amp;gt; decim |                 -&amp;gt; high -&amp;gt; decim -&amp;gt; subband2&#xA;       pass   by 2  |                |   pass    by 2&#xA;                     -&amp;gt; low -&amp;gt; decim |&#xA;                        pass   by 2  |   .   down to what suffices&#xA;                                      -&amp;gt; .    or if periodic data,&#xA;                                         .     until short of data&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reconstruction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;subband0 -----------------------------------&amp;gt; dilute -&amp;gt; high&#xA;                                              by 2      pass \&#xA;subband1 ------------------&amp;gt; dilute -&amp;gt; high                   + out&#xA;                             by 2      pass \                /  =in&#xA;subband2 -&amp;gt; dilute -&amp;gt; high                   + dilute -&amp;gt; low&#xA;            by 2      pass \                /  by 2      pass&#xA;                            + dilute -&amp;gt; low&#xA;Start   .                  /  by 2      pass&#xA;here!   . -&amp;gt; dilute -&amp;gt; low&#xA;        .    by 2      pass&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In a real-time application, the filters introduce delays, so you need&#xA;to compensate them by adding additional delays to less-delayed higher&#xA;bands, to get the summation work as intended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For periodic signals or windowed operation, this problem doesn't exist -&#xA;a single subband transformation is a matrix multiplication, with wrapping&#xA;implemented in the matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Decomposition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|L0|   |C0  C1  C2  C3                | |I0|     L = lowpass output&#xA;|H0|   |C3 -C2  C1 -C0                | |I1|     H = highpass output&#xA;|L1|   |        C0  C1  C2  C3        | |I2|     I = input&#xA;|H1| = |        C3 -C2  C1 -C0        | |I3|     C = coefficients&#xA;|L2|   |                C0  C1  C2  C3| |I4|&#xA;|H2|   |                C3 -C2  C1 -C0| |I5|&#xA;|L3|   |C2  C3                  C0  C1| |I6|&#xA;|H3|   |C1 -C0                  C3 -C2| |I7|     Daubechies 4-coef:&#xA;&#xA;     1+sqrt(3)        3+sqrt(3)        3-sqrt(3)        1-sqrt(3)&#xA;C0 = ---------   C1 = ---------   C2 = ---------   C3 = ---------&#xA;     4 sqrt(2)        4 sqrt(2)        4 sqrt(2)        4 sqrt(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reconstruction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|I0|   |C0  C3                  C2  C1| |L0|&#xA;|I1|   |C1 -C2                  C3 -C0| |H0|&#xA;|I2|   |C2  C1  C0  C3                | |L1|&#xA;|I3| = |C3 -C0  C1 -C2                | |H1|&#xA;|I4|   |        C2  C1  C0  C3        | |L2|&#xA;|I5|   |        C3 -C0  C1 -C2        | |H2|&#xA;|I6|   |                C2  C1  C0  C3| |L3|&#xA;|I7|   |                C3 -C0  C1 -C2| |H3|&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;C0, C1, C2, C3 are the &quot;db2&quot; lowpass FIR filter coefficients. Highpass&#xA;coefficients you get by reversing tap order and multiplying by&#xA;sequence 1,-1, 1,-1, ... Because these are orthogonal wavelets, the&#xA;analysis and reconstruction coefficients are the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A coefficient set convolved by its reverse is an ideal halfband lowpass&#xA;filter multiplied by a symmetric windowing function. This creates the&#xA;kind of symmetry in the frequency domain that enables aliasing-free&#xA;reconstruction. Daubechies wavelets are the minimum-phase, minimum&#xA;number of taps solutions for a number of vanishing moments (seven in&#xA;&quot;db7&quot; etc.), which determines their frequency selectivity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was asked to show the matrices for 6 coefficients, so here they are, made a bit larger for clarity but could be the same size as before too. Decomposition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|L0|   |C0  C1  C2  C3  C4  C5                | |I0|     &#xA;|H0|   |C5 -C4  C3 -C2  C1 -C0                | |I1|     &#xA;|L1|   |        C0  C1  C2  C3  C4  C5        | |I2|     &#xA;|H1|   |        C5 -C4  C3 -C2  C1 -C0        | |I3|     &#xA;|L2| = |                C0  C1  C2  C3  C4  C5| |I4|&#xA;|H2|   |                C5 -C4  C3 -C2  C1 -C0| |I5|&#xA;|L3|   |C4  C5                  C0  C1  C2  C3| |I6|&#xA;|H3|   |C1 -C0                  C5 -C4  C3 -C2| |I7|&#xA;|L4|   |C2  C3  C4  C5                  C0  C1| |I8|&#xA;|H4|   |C3 -C2  C1 -C0                  C5 -C4| |I9|     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reconstruction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|I0|   |C0  C5                  C4  C1  C2  C3| |L0|&#xA;|I1|   |C1 -C4                  C5 -C0  C3 -C2| |H0|&#xA;|I2|   |C2  C3  C0  C5                  C4  C1| |L1|&#xA;|I3|   |C3 -C2  C1 -C4                  C5 -C0| |H1|&#xA;|I4| = |C4  C1  C2  C3  C0  C5                | |L2|&#xA;|I5|   |C5 -C0  C3 -C2  C1 -C4                | |H2|&#xA;|I6|   |        C4  C1  C2  C3  C0  C5        | |L3|&#xA;|I7|   |        C5 -C0  C3 -C2  C1 -C4        | |H3|&#xA;|I8|   |                C4  C1  C2  C3  C0  C5| |L4|&#xA;|I9|   |                C5 -C0  C3 -C2  C1 -C4| |H4|&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;C0 = 3.326705529500826159985115891390056300129233992450683597084705e-01&#xA;C1 = 8.068915093110925764944936040887134905192973949948236181650920e-01&#xA;C2 = 4.598775021184915700951519421476167208081101774314923066433867e-01&#xA;C3 = -1.350110200102545886963899066993744805622198452237811919756862e-01&#xA;C4 = -8.544127388202666169281916918177331153619763898808662976351748e-02&#xA;C5 = 3.522629188570953660274066471551002932775838791743161039893406e-02&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More coefficient sets can be found &lt;a href=&quot;http://yehar.com/blog/wp-content/uploads/2009/09/daub.h&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-02-10T15:13:30.330" LastActivityDate="2016-02-10T15:13:30.330" CommentCount="30" ContentLicense="CC BY-SA 3.0" />
  <row Id="28635" PostTypeId="1" CreationDate="2016-02-03T11:58:20.023" Score="1" ViewCount="861" Body="&lt;p&gt;Currently I am doing my project on SKIN DISEASE DIAGNOSIS USING TEXTURE ANALYSIS in IMAGE PROCESSING domain.In this project,the histopathological image of diseased skin image is given as input and the name of the disease,details about the particular disease related to that image should be displayed as output.For feature extraction of such image,GLCM is not useful(as the input is a histopathological image).So,CLCM(Color Level Co occurrence Matrix) works well for such input.Can anyone help me with the matlab code for CLCM?&lt;a href=&quot;https://i.stack.imgur.com/bLtDa.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bLtDa.jpg&quot; alt=&quot;Example of histopathological image&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using MATLAB R2013a for this project.Is this okay or Do i need to change the version for better results? &lt;/p&gt;&#xA;" OwnerUserId="19377" LastEditorUserId="19377" LastEditDate="2016-02-03T12:05:54.530" LastActivityDate="2016-02-03T12:05:54.530" Title="How can I improvise matlab code from GLCM to CLCM(Color Level Co occurrence Matrix) for feature extraction in texture analysis?" Tags="|image-processing|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28636" PostTypeId="1" CreationDate="2016-02-03T13:15:47.603" Score="2" ViewCount="2800" Body="&lt;p&gt;I am capturing some body internal signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using 2 identical mics. One captures the in body signal and one open air.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to remove/delete/subtract the open air signal (noise for me) from  the main signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please suggest an efficient algorithm.&lt;/p&gt;&#xA;" OwnerUserId="19379" LastEditorUserId="128" LastEditDate="2019-05-23T08:53:36.153" LastActivityDate="2019-05-23T08:53:36.153" Title="How to Subtract One Signal from Another?" Tags="|audio|adaptive-filters|denoising|audio-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="28638" PostTypeId="2" ParentId="24517" CreationDate="2016-02-03T15:16:29.480" Score="1" Body="&lt;p&gt;In order to check system's resonance, we should get FRF(frequency response function), the ratio between input fft and output fft. Output signal's fft depends on input signal's signature. Only with fft of output signal, we can't insist the pick of frequency is resonance.&lt;/p&gt;&#xA;" OwnerUserId="19371" LastEditorUserId="19371" LastEditDate="2016-02-03T15:21:45.787" LastActivityDate="2016-02-03T15:21:45.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28641" PostTypeId="1" CreationDate="2016-02-03T17:11:13.117" Score="1" ViewCount="112" Body="&lt;p&gt;I'm learning about DSP and I've doubts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resampling process can be do it with only one filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L$: Increment Sample Rate Integer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M$: Decrement Sample Rate Integer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_S$: Frequency Sampling&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For Low Pass Filter:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequencies allowed are in the range: from &lt;strong&gt;$0$&lt;/strong&gt; until &lt;strong&gt;$f_{pass}$&lt;/strong&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequencies denied are in the range: from &lt;strong&gt;$f_{stop}$&lt;/strong&gt; until &lt;strong&gt;$f_S/2$&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{pass}$: Highest pass frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{stop}$: Lowest cut frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I'm simplifying my calculations as well:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm defining: $ 0 &amp;lt; \delta &amp;lt; 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_{stop} = f_S/2\\&#xA;f_{pass} = \delta f_{stop} = \delta f_S/2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Known formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Delta F = (f_{stop}-f_{pass})/f_S\\&#xA;f_c = (f_{stop}+f_{pass})/2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Hamming Window:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$N = 3.3/\Delta F$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming $f_S = 24000$, $\delta = 0.97$ and the most demanding requirements for FIR filter calculus.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If $L=3$ and $M=2$; How can I to calculate (step by step) $N=?$&#xA;and $f_c = ?$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $L=2$ and $M=3$; How can I to calculate (step by step) $N=?$&#xA;and $f_c = ?$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Case 1&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$f_{S1} = 24000\\f_{stop1} = f_{S1}/2 = 12000\\f_{pass1} = 0.97*f_{S1}/2 = 11640$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L=3$&#xA;$$f_{S2} = 72000\\f_{stop2} = f_{S2}/2 = 36000\\f_{pass2} = 0.97*f_{S2}/2 = 34920$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M=2$&#xA;$$f_{S3} = 36000\\f_{stop3} = f_{S3}/2 = 18000\\f_{pass3} = 0.97*f_{S3}/2 = 17460$$&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Case 2&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$f_{S1} = 24000\\f_{stop1} = f_{S1}/2 = 12000\\f_{pass1} = 0.97*f_{S1}/2 = 11640$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$L=2$&#xA;$$f_{S2} = 48000\\f_{stop2} = f_{S2}/2 = 24000\\f_{pass2} = 0.97*f_{S2}/2 = 23280$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M=3$&#xA;$$f_{S3} = 16000\\f_{stop3} = f_{S3}/2 =  8000\\f_{pass3} = 0.97*f_{S3}/2 =  5173$$&lt;/p&gt;&#xA;" OwnerUserId="19381" LastEditorUserId="19381" LastEditDate="2016-02-08T21:34:19.627" LastActivityDate="2016-02-08T21:34:19.627" Title="Specifications (N) FIR Low Pass Resamplig, Hamming Window" Tags="|filter-design|window-functions|finite-impulse-response|resampling|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28642" PostTypeId="1" CreationDate="2016-02-03T20:48:22.390" Score="1" ViewCount="3034" Body="&lt;p&gt;I'm trying to track players on a soccer field, using a fixed camera. The picture below shows the results of BackgroundSubtractorMOG2, the second picture below the results of findContours on the results of BackgroundSubtractorMOG2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see there are a lot off small contours detected. How can a I alter the results of BackgroundSubtractorMOG2 so one shape (a player) results in one contour I can track ?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NWH8V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NWH8V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import cv2&#xA;&#xA;cap = cv2.VideoCapture(&quot;images/Keeper.mov&quot;)&#xA;history = 30   # or whatever you want it to be&#xA;accelerate = 5&#xA;&#xA;kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(3,3))&#xA;fgbg = cv2.BackgroundSubtractorMOG2()&#xA;&#xA;while(1):&#xA;    for i in (1, accelerate):&#xA;        ret, frame = cap.read()&#xA;&#xA;    fgmask = fgbg.apply(frame, learningRate=1.0/history)&#xA;&#xA;    fgmask = cv2.morphologyEx(fgmask, cv2.MORPH_OPEN, kernel)&#xA;    cv2.imshow('frame',fgmask)&#xA;&#xA;    h, w = fgmask.shape[:2]&#xA;&#xA;    contours0, hierarchy = cv2.findContours( fgmask.copy(), cv2.RETR_TREE, &#xA;    cv2.CHAIN_APPROX_SIMPLE)&#xA;    contours = [cv2.approxPolyDP(cnt, 3, True) for cnt in contours0]&#xA;&#xA;    vis = np.zeros((h, w, 3), np.uint8)&#xA;    levels = 17&#xA;    cv2.drawContours( vis, contours, (-1, 3)[levels &amp;lt;= 0], (128,255,255),&#xA;            -1, cv2.CV_AA, hierarchy, abs(levels) )&#xA;    cv2.imshow('contours', vis)&#xA;&#xA;    k = cv2.waitKey(30) &amp;amp; 0xff&#xA;    if k == 27:&#xA;        break&#xA;&#xA;cap.release()&#xA;cv2.destroyAllWindows()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19383" LastEditorUserId="19383" LastEditDate="2016-02-03T21:20:00.600" LastActivityDate="2016-07-09T13:53:58.247" Title="Improve coverage of BackgroundSubtractorMOG2 and findContours" Tags="|opencv|python|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28643" PostTypeId="1" AcceptedAnswerId="28644" CreationDate="2016-02-03T20:49:34.887" Score="1" ViewCount="3322" Body="&lt;p&gt;I'm seeing everywhere that the DFT of a sinusoid (i.e. a sine that has been windowed with a rectangular window) are just two deltas. What I don't understand is why the DFT is not the convolution of the transform of the infinite sinusoid (two deltas) and the transform of the rectangular window (a sinc). Wouldn't this be the right thing to do?&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-02-03T21:28:57.307" Title="DFT of a cosine/sine wave?" Tags="|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28644" PostTypeId="2" ParentId="28643" CreationDate="2016-02-03T21:28:57.307" Score="3" Body="&lt;p&gt;If a pure sinusoid is exactly integer periodic in the DFT's aperture, then the Sinc function, resulting from the rectangular window, will pass exactly thru zero at all but two points of the DFT results, thus appear to be invisible except for the two deltas.  If you vary the DFT window size by fractions of a period of the sinusoid, then it will show up, as you expect, since the DFT will no longer sample the Sinc when it crosses zero.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-03T21:28:57.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28645" PostTypeId="1" AcceptedAnswerId="28653" CreationDate="2016-02-03T21:55:26.107" Score="1" ViewCount="4007" Body="&lt;p&gt;For a school project, I'm working on a software-defined radio transmitter intended for the HF amateur radio bands. I'm planning to support SSB transmission with the formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = m(t) \cos(2\pi f_\text{carrier}t) \pm \hat m(t)\sin(2\pi f_\text {carrier}t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_\text{carrier}$ is the IF carrier and $\hat m$ is the Hilbert transform of $m(t)$. Of course, I will use a discrete form of this equation for my implementation, which means I need to calculate the discrete Hilbert transform of $m(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked around online but can't seem to find a decent C/C++ implementation of the discrete Hilbert transform that would be suitable for my purposes. However, there are plenty of libraries to calculate FFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my understanding, a discrete Hilbert transform can be calculated by taking the FFT of the signal and multiplying by j to achieve the 90° shift. It suffers from Gibbs' phenomenon, it seems, and might need a wide bandpass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me if my understanding is correct (or of a good discrete Hilbert transform function)?&lt;/p&gt;&#xA;" OwnerUserId="18625" LastEditorUserId="13320" LastEditDate="2016-02-04T13:22:41.490" LastActivityDate="2016-04-04T14:52:30.867" Title="Hilbert Transform from FFT?" Tags="|fft|modulation|hilbert-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28648" PostTypeId="1" CreationDate="2016-02-04T07:16:42.217" Score="1" ViewCount="233" Body="&lt;p&gt;We have a channel $c(t)$ that we want to sample. It can be expressed as $ c(t)= g\ast x(t)$ where $x(t)$ is white complex Gaussian noise and $g(t)$ is a function that we know the PSD of, let's call it $G(f)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So two options  if we want to generate samples of the channel response:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Let $g(t) = \mathcal{F}^{-1}[G(f)]$, then generate white noise $x(t)$ and let $c(t) = g\ast x(t)$&lt;/li&gt;&#xA;&lt;li&gt;Since $C(f) = G(f)X(f)$, we instead generate the  white noise $X(f)$, mulitply $G(f)$ and $X(f)$ and let $c(t) = \mathcal{F}^{-1}[C(f)]$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Apart from complexity issues, I wouldn't guess these methods would be too different. But at least for the PSD I tried it for (the Clarke's spectrum bathtub shape), there definitely was a difference at least when the number of samples $N_s$ was small. Sampling in frequency domain was better for small $N_s$. For large $N_s$ it didn't seem to matter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, why does it matter? Does it have anything to do with my PSD getting asymptotic around the edges and that this will not be noticed when sampling?&lt;/p&gt;&#xA;" OwnerUserId="9140" LastEditorUserId="1629" LastEditDate="2016-02-04T09:47:46.193" LastActivityDate="2016-02-04T09:47:46.193" Title="Why is it better to sample white noise in frequency domain here?" Tags="|sampling|power-spectral-density|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28651" PostTypeId="2" ParentId="28636" CreationDate="2016-02-04T10:48:18.033" Score="2" Body="&lt;p&gt;Under the assumption that your background noise is &lt;em&gt;statistically independent&lt;/em&gt; of the signal you want to recover and that your second microphone picks up virtually &lt;em&gt;nothing&lt;/em&gt; from the body noise, you have the following model for your measurements:&#xA;$$ \begin{eqnarray} M_1(t) &amp;amp;=&amp;amp; L\{N(t)\} + B(t) \\ M_2(t) &amp;amp;=&amp;amp; N(t) \end{eqnarray}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $M_1,M_2$ are the signals picked up by the microphone, $B(t)$ is the signal you want to recover, $N(t)$ is the environmental noise signal and $L$ is a linear time invariant system that maps the recorded environmental noise to what is picked up by the second microphone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $\langle\langle \cdot, \cdot \rangle\rangle$ as cross correlation, we also have the non-correlation constraint $\langle\langle N,B \rangle\rangle=0$ and $\langle\langle L\{N\},B \rangle\rangle=0$ as a consequence of statistical independence of $N$ and $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These prerequisites guarantee a &lt;em&gt;cross correlation matching pursuit&lt;/em&gt; to converge against $B(t)$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Normalise $M_2$ with the standard inner product: $M_2(t)\leftarrow \frac{M_2}{\sqrt{\langle M_2(t),M_2(t) \rangle}}$&lt;/li&gt;&#xA;&lt;li&gt;Find $c(t):=\langle\langle M_2,M_1\rangle\rangle$&lt;/li&gt;&#xA;&lt;li&gt;Find the time associated with the maximum of the squared cross correlation: $\tau=\mathrm{argmax}\left( c^2(t) \right)$&lt;/li&gt;&#xA;&lt;li&gt;Update $M_1$ to remove the contribution of the environmental noise: $M_1(t)\leftarrow M_1(t)-\langle M_2(t-\tau),M_2 \rangle\cdot M_2(t-\tau)$&lt;/li&gt;&#xA;&lt;li&gt;If result not good enough, go back to 2.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In step 4 you may also use $c(\tau)$ instead of the inner product if the cross correlation uses the same inner product. Stopping the matching pursuit is a question of experience. Some of the assumptions you need for this algorithm are only approximately true, like the perfect uncorrelatedness of the environmental noise and the body signal. A good way to check if your matching pursuit runs into a non-productive state of signal modifications is to observe the natural square-norm of $M_1$. If it stops decreasing in step 4, terminate the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the algorithm ran, $M_1(t)$ will contain only your body signal $B(t)$.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2016-02-04T10:57:06.623" LastActivityDate="2016-02-04T10:57:06.623" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28652" PostTypeId="2" ParentId="28636" CreationDate="2016-02-04T11:01:23.897" Score="0" Body="&lt;p&gt;You can use adaptive filters for this kind of application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as you mentioned in question &quot;&lt;strong&gt;&lt;em&gt;One captures the in body signal and one open air&lt;/em&gt;&lt;/strong&gt;&quot;, so what you can do is use open air signal as reference and body signal as input to the adaptive filter, by doing this we will get the estimation of the open air signal in main body signal. if we subtract this estimate from original main body signal we will get noise(open air) free signal. &lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-02-04T11:01:23.897" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28653" PostTypeId="2" ParentId="28645" CreationDate="2016-02-04T11:50:06.240" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I've looked around online but can't seem to find a decent C/C++ implementation of the discrete Hilbert transform that would be suitable for my purposes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can't completely agree to that, see links below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt; &#xA;So, a hilbert filter generates the analytical signal out of a real signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, it's but a complex bandpass filter: It cancels out all the negative frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a lot of ways you can implement that (including GNU Radio's &lt;a href=&quot;https://gnuradio.org/doc/doxygen/classgr_1_1filter_1_1hilbert__fc.html#details&quot; rel=&quot;nofollow noreferrer&quot;&gt;hilbert filter&lt;/a&gt;, &lt;a href=&quot;https://github.com/gnuradio/gnuradio/blob/master/gr-filter/lib/hilbert_fc_impl.cc&quot; rel=&quot;nofollow noreferrer&quot;&gt;source code&lt;/a&gt;, &lt;a href=&quot;https://github.com/gnuradio/gnuradio/blob/master/gr-filter/lib/firdes.cc#L548&quot; rel=&quot;nofollow noreferrer&quot;&gt;filter generation code&lt;/a&gt;), but you can imagine taking a symmetrical half-band low pass filter, and shifting it up for half the sampling rate, so that its passband now covers the positive frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Luckily, half-band filters are easy to produce and to implement; what is often done is that you take a prototype window, interpolate it by a factor 2 (adding zeros between the window taps), and weigh it, for example with 1/n (n=tap distance from center tap). The result works quite fine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jlwUl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jlwUl.png&quot; alt=&quot;flow graph&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/43ri8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/43ri8.png&quot; alt=&quot;PSD plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-04T11:50:06.240" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28654" PostTypeId="2" ParentId="1949" CreationDate="2016-02-04T15:47:04.203" Score="0" Body="&lt;p&gt;Based on Muhammad's suggestion, I tried to make a Matlab script. However, I am not able to deduce if he constructs a Gaussian distribution based on the variances and then takes a KDE estimation or he performs a KDE estimation with Gaussian assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also it is difficult to infer how he translates the KDE offset time onto the time domain. Here is my attempt to it. Any user who is interested in using the script is free to and update the improved version if possible.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% Initialising data&#xA;&#xA;Ws1 = data1;&#xA;Ws2 = data2;&#xA;mWs1 = nanmean(Ws1);&#xA;mWs2 = nanmean(Ws2);&#xA;sdWs1 = nanstd(Ws1);&#xA;sdWs2 = nanstd(Ws2);&#xA;&#xA;%% Computing the signal envelopes&#xA;Ws1d = Ws1 - mWs1;&#xA;Ws2d = Ws2 - mWs2;&#xA;h1 = abs(hilbert(Ws1d));&#xA;h2 = abs(hilbert(Ws2d));&#xA;figure();&#xA;subplot(211)&#xA;plot([Ws1d, h1])&#xA;subplot(212)&#xA;plot([Ws2d, h2])&#xA;&#xA;%% Denoise the signal with edge preserving nonlinear medial filtering&#xA;w = 25;&#xA;mf1 = medfilt1(h1, w);&#xA;mf2 = medfilt1(h2, w);&#xA;figure();&#xA;subplot(211)&#xA;plot(mf1)&#xA;subplot(212)&#xA;plot(mf2)&#xA;&#xA;&amp;lt;%% Remove time: construct the gaussian kernel density estimation functions&amp;gt;&#xA;% Using the kde from Matlab central directly on the filtered data&#xA;data1 = mf1;&#xA;[bw1, den1, xmesh1, cdf1] = kde(data1, 2^14);&#xA;der1 = diff(den1);&#xA;data2 = mf2;&#xA;[bw2, den2, xmesh2, cdf2] = kde(data2, 2^14);&#xA;der2 = diff(den2);&#xA;figure();&#xA;plot([der1, der2]);&#xA;legend('Sig1', 'Sig2')&#xA;&#xA;% the other method as explained in Muhammad's post&#xA;for i = 1:length(mf1)&#xA;gf1(:,i) = mf1(i) + sdWs1*randn(1000,1);&#xA;gf2(:,i) = mf2(i) + sdWs2*randn(1000,1);&#xA;end&#xA;[bwM1, denM1, xmeshM1, cdfM1] = kde(gf1(:,1), 2.^11);&#xA;dd1 = diff(denM1);&#xA;[bwM2, denM2, xmeshM2, cdfM2] = kde(gf2(:,1), 2.^11);&#xA;dd2 = diff(denM2);&#xA;figure();&#xA;plot([dd1, dd2]);&#xA;legend('Sig1', 'Sig2')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16381" LastActivityDate="2016-02-04T15:47:04.203" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28656" PostTypeId="2" ParentId="28563" CreationDate="2016-02-04T16:09:33.700" Score="2" Body="&lt;p&gt;If the noise is additive, and your signals are in sync (i.e. same number of samples, and temporal aligned). You need to subtract your original signal from your Noisy signal - which will give you the additive noise. You can then calculate the power of this and compare it to the clean version of your signal to compute the SNR &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab this should just be:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Noise = NoisySignal - OriginalSignal; %//Should give a vector or Matrix depending on what stereo or mono.&#xA;SNR = snr(OriginalSignal,Noise) %// should give the single SNR reading in dB.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;However, in a case where the signals are not in sync, it becomes much harder, and in general, we consider it a mix of different elements that could have caused the distortion (or lose in sync), and usually a combination of SAR (Signal to Artefact Ratio), SIR (Signal to Interference Ratio) and SDR (Signal to Distortion Ratio) are used instead. The SIR is very similar to SNR in this case. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19399" LastActivityDate="2016-02-04T16:09:33.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28658" PostTypeId="1" AcceptedAnswerId="28666" CreationDate="2016-02-04T19:19:30.723" Score="5" ViewCount="7247" Body="&lt;p&gt;Why do we need the initial conditions to be zero for the LTI systems described as a difference equations?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First question is why do we need it for linearity? I can't think of any example of the non linear system described as a difference equation with constant coefficients.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The definition of TI system is that it does not depend on particular time the input is applied. I can't understand how does this definition relate to the initial conditions? Those initial conditions will be the same whenever we apply the input so why they have to be zero?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanx &lt;/p&gt;&#xA;" OwnerUserId="17597" LastEditorUserId="21075" LastEditDate="2018-03-15T11:14:19.200" LastActivityDate="2018-03-15T11:14:19.200" Title="Initial conditions for the LTI systems described as a difference equations" Tags="|discrete-signals|linear-systems|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28659" PostTypeId="1" CreationDate="2016-02-04T19:19:58.060" Score="0" ViewCount="174" Body="&lt;p&gt;Some may think this question is little primarily,I just want to know the differences between different wavelet filters like decomposition high pass,low pass,reconstruction high pass,low pass filters..Which one is best suited for an ECG type signal &lt;/p&gt;&#xA;" OwnerUserId="17018" LastActivityDate="2016-02-29T11:11:02.210" Title="difference between wavelet filters" Tags="|image-processing|signal-analysis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28660" PostTypeId="1" CreationDate="2016-02-04T19:24:01.497" Score="0" ViewCount="57" Body="&lt;p&gt;I have data that is affected by temperature.  How can I filter out the temperature signal considering I have temperature data collected?  &lt;/p&gt;&#xA;" OwnerUserId="19402" LastEditorUserId="13320" LastEditDate="2016-02-04T19:44:11.967" LastActivityDate="2016-04-04T20:56:53.960" Title="Filtering data on a known signal" Tags="|filters|" AnswerCount="1" CommentCount="0" ClosedDate="2016-04-04T20:59:44.833" ContentLicense="CC BY-SA 3.0" />
  <row Id="28662" PostTypeId="2" ParentId="28660" CreationDate="2016-02-04T19:39:13.883" Score="1" Body="&lt;p&gt;The obvious answer: define a mathematical model of how the temperature affects your data, and use that model to remove the effect of temperature on your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry, but with the amount of information you give on your data, the way your temperature affects it or any approach, this is the precisest possible answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to add that what signal processing defines as &quot;filter&quot; is probably not the tool you're looking for, unless you now the spectral properties of your data and your temperature.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-04T19:39:13.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28663" PostTypeId="1" CreationDate="2016-02-04T19:40:10.150" Score="1" ViewCount="188" Body="&lt;p&gt;In Compressed sensing ECG reconstruction I would like to use biorthogonal wavelet basis as transform/sparsifying domain. I found out that &lt;code&gt;wfilters&lt;/code&gt; command in MATLAB will give 4 type of filters, but which filter I would use to make the transform matrix? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either decomposition lowpass/highpass or reconstruction low pass/high pass or is there any other better ways to make the transform matrix??&lt;/p&gt;&#xA;" OwnerUserId="17018" LastEditorUserId="1629" LastEditDate="2016-04-05T11:39:49.530" LastActivityDate="2019-03-05T15:53:05.903" Title="Transform matrix creation in compressed sensing" Tags="|image-processing|signal-analysis|filter-design|compressive-sensing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28666" PostTypeId="2" ParentId="28658" CreationDate="2016-02-04T21:47:41.343" Score="6" Body="&lt;p&gt;The problem is that non-zero initial conditions cause a term in the output signal that &lt;em&gt;does not depend on the input signal&lt;/em&gt;. This explains why a system with non-zero initial conditions can neither be linear nor time-invariant. A linear system must have a zero output for zero input. With non-zero initial conditions the output will generally be non-zero, even for a zero input signal. Alternatively, think of scaling a given input signal. A linear system will have a response that is scaled in the same way. However, the part of the output signal caused by non-zero initial conditions will not scale accordingly, because it's independent of the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same is true concerning time-invariance. For a time-invariant system, a shifted version of the input signal must result in an output signal with the same shift. However, the output term caused by non-zero initial conditions will not shift accordingly, as it is independent of the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, a system described by a linear difference equation with constant coefficients plus initial conditions is only linear and time-invariant if the initial conditions are zero.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-04T21:47:41.343" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28667" PostTypeId="1" AcceptedAnswerId="28906" CreationDate="2016-02-04T23:10:47.547" Score="0" ViewCount="2839" Body="&lt;p&gt;I'm trying to deskew an image that contains an element of known size. Here's a test image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EFXtV.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EFXtV.jpg&quot; alt=&quot;Source image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use &lt;code&gt;aruco::estimatePoseBoard&lt;/code&gt; which returns rotation and translation vectors. Is there a way to use that information to deskew everything that's in the same plane as the marker board? (Presumably by using the rotation and translation vectors to create a transformation matrix to pass to &lt;code&gt;warpPerspective&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to deskew the marker board itself. What I want to be able to do is deskew the other things (in this case, the cloud-shaped object) that are in the same plane as the marker board. I'm trying to determine whether or not that's possible and, if so, how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can already put four individual markers around the object I want to deskew and use the detected corners along with the known distance between them as input to &lt;code&gt;getPerspectiveTransform&lt;/code&gt;. That works very well. But for our real-world application it may be difficult for the user to place markers exactly. It would be much easier if they could place a single marker board in the frame and have the software deskew the other objects.&lt;/p&gt;&#xA;" OwnerUserId="19407" LastEditorUserId="19407" LastEditDate="2016-02-11T01:30:30.200" LastActivityDate="2016-02-17T01:55:44.240" Title="Can I create a transformation matrix from rotation/translation vectors?" Tags="|opencv|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28668" PostTypeId="2" ParentId="28598" CreationDate="2016-02-04T23:13:53.440" Score="2" Body="&lt;p&gt;Ok, I worked out this and i got this for decimation in time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0dWs4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0dWs4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is how structure looks:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yEj83.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yEj83.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19339" LastActivityDate="2016-02-04T23:13:53.440" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28669" PostTypeId="1" CreationDate="2016-02-05T00:26:41.673" Score="2" ViewCount="503" Body="&lt;p&gt;I was playing with the idea of performing integration on a sound signal, since I've never heard of where it'd be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it used somewhere?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here's something:&lt;br&gt;&#xA;&lt;a href=&quot;http://pcfarina.eng.unipr.it/Differentiation-Integration.htm&quot; rel=&quot;nofollow&quot;&gt;http://pcfarina.eng.unipr.it/Differentiation-Integration.htm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16003" LastActivityDate="2016-04-05T16:19:04.020" Title="Calculus on sound signals?" Tags="|audio|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28671" PostTypeId="1" CreationDate="2016-02-05T03:03:57.473" Score="1" ViewCount="1104" Body="&lt;p&gt;We are currently learning about convolution in my signals and systems class, and one of our textbook problems is to compute the convolution of $x(t) = e^{-\alpha t} u(t)$ and $y(t) = e^{-\beta t} u(t)$. After working out the integral, I obtained the following result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) * h(t) = \frac{e^{-\alpha t} - e^{-\beta t}}{\beta - \alpha}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solutions manual for my textbook has the same answer, except their result is multiplied by $u(t)$. I am unsure of where this is coming from, since I know that I computed the integral correctly. I used the unit step functions to simplify the bounds on the integral, so I do not see how they are still around in the final answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain what is going on here?&lt;/p&gt;&#xA;" OwnerUserId="19410" LastActivityDate="2016-02-05T05:14:32.937" Title="Unit step function present in convolution result" Tags="|convolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28672" PostTypeId="1" CreationDate="2016-02-05T04:35:37.587" Score="2" ViewCount="431" Body="&lt;p&gt;In the audio domain, I am currently attempting to use MATLAB to distil:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$\textrm{signal}$ from $\textrm{noise + signal}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\textrm{noise}$ from $\textrm{noise + signal}$ &#xA;using two adaptive filters $\rightarrow$ two results.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I get the first answer quite effectively using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hFDAF1 = adaptfilt.fdaf(AdaptFiltLength,StepSize,Leakage,Delta,Lambda)&#xA;&#xA;[Errors1, Adapt_Out_Audio] = filter(hFDAF1, NoisePlusAudio, Audio)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;NoisePlusAudio&lt;/code&gt; is a microphone in the room, and &lt;code&gt;Audio&lt;/code&gt; is music playing through speakers in the room.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get the adaptive filter to remove the &lt;code&gt;Audio&lt;/code&gt; from &lt;code&gt;NoisePlusAudio&lt;/code&gt;, just leaving the background noise of the room, much like an echo canceller?&#xA;The following does not work, it just lets all the sound through.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Errors2, Adapt_Out_Noise] = filter(hFDAF2, Audio, NoisePlusAudio)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd love to know the answer ....&lt;/p&gt;&#xA;" OwnerUserId="19412" LastEditorUserId="1629" LastEditDate="2016-06-04T17:47:13.373" LastActivityDate="2017-11-27T04:50:16.167" Title="MATLAB Adaptive Filters" Tags="|matlab|adaptive-filters|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28673" PostTypeId="1" AcceptedAnswerId="28679" CreationDate="2016-02-05T04:45:49.017" Score="1" ViewCount="523" Body="&lt;p&gt;According to Sampling theorem, in order to reconstruct a signal we need to sample it at the rate =&gt; twice the highest frequency component of that signal. (provided signal is band limited).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say, we have a signal with f= 2MHz (highest freq component), so we will be sampling it at 4MHz or more as Sampling theorem say's.. and we will have N Samples in signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what if I want to know the exact value of a sample (information) between two samples..??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we find the value at every possible instantaneous.. in a signal..when we know we only have N samples after sampling..??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know we can increasing sampling rate to have more sample. But is there any other way to do it..?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question was asked to me in an interview at NCRA-TIFR, Pune, India.&lt;/p&gt;&#xA;" OwnerUserId="19413" LastActivityDate="2016-02-21T08:12:19.590" Title="Sampling Theorem: How to know the value between two samples of a Signal" Tags="|discrete-signals|signal-analysis|sampling|continuous-signals|nyquist|" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28674" PostTypeId="2" ParentId="28672" CreationDate="2016-02-05T05:14:02.783" Score="1" Body="&lt;p&gt;Reason for it might be the continuous adaptation, even in non speech regions. So, you can try Voice Activity Detector (VAD) for knowing the exact regions for adaptation of filter, and processing will be frame wise (20 ms).  &lt;/p&gt;&#xA;" OwnerUserId="15911" LastEditorUserId="128" LastEditDate="2017-11-27T04:50:16.167" LastActivityDate="2017-11-27T04:50:16.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28675" PostTypeId="2" ParentId="28671" CreationDate="2016-02-05T05:14:32.937" Score="1" Body="&lt;p&gt;A step by step derivation of this convolution would start with the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;f(t)&#xA;  &amp;amp;= \int_{-\infty}^\infty x(\tau) h(t-\tau) \,d\tau \\&#xA;  &amp;amp;= \int_{-\infty}^\infty e^{-\alpha\tau} u(\tau) e^{-\beta(t-\tau)} u(t-\tau) \,d\tau&#xA;\end{align}&#xA;$$&#xA;And this is probably where you probably went on and tried to simplified the bounds on the integral with:&#xA;$$&#xA;\begin{align}&#xA;  f(t) &amp;amp;= \int_0^t e^{-\alpha\tau} e^{-\beta(t-\tau)} \, d\tau \\&#xA;\end{align}&#xA;$$&#xA;forgetting that this is only true if $t \geq 0$. &#xA;Indeed for $t &amp;lt; 0$ the product $u(\tau) u(t-\tau)$ is 0 for all values of $\tau$, and the result of the integral is thus 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the correct expression would be:&#xA;$$&#xA;\begin{align}&#xA;f(t)&#xA;  &amp;amp;= u(t) \int_0^t e^{-\alpha\tau} e^{-\beta(t-\tau)} \, d\tau \\&#xA;  &amp;amp;= \cdots \\&#xA;  &amp;amp;= u(t) \frac{e^{-\alpha t} - e^{-\beta t}}{\beta-\alpha}&#xA;\end{align} &#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2016-02-05T05:14:32.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28676" PostTypeId="2" ParentId="28673" CreationDate="2016-02-05T05:23:41.170" Score="0" Body="&lt;p&gt;watch &lt;a href=&quot;https://www.xiph.org/video/vid2.shtml&quot; rel=&quot;nofollow&quot;&gt;Digital show &amp;amp; Tell&lt;/a&gt; from Xiph.org. Same situation only sound frequency. They explain better as i can why there is just one possible solution from every set of samples&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2016-02-05T05:23:41.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28677" PostTypeId="2" ParentId="28444" CreationDate="2016-02-05T05:32:02.273" Score="1" Body="&lt;p&gt;the topic that i think you're groping for is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Zero-order_hold&quot; rel=&quot;nofollow&quot;&gt;Zero-order hold&lt;/a&gt; or &lt;em&gt;&quot;ZOH&quot;&lt;/em&gt;.  i changed the tags a little to reflect this.  conceptually, the ZOH is not quite the same thing as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Sample_and_hold&quot; rel=&quot;nofollow&quot;&gt;Sample-and-hold&lt;/a&gt; circuit which has continuous functions going in and piecewise-constant signal coming out.  the ZOH is a conceptual LTI system that has a string of dirac impulses going in and a piecewise-constant signal coming out.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-02-05T05:32:02.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28678" PostTypeId="1" CreationDate="2016-02-05T06:15:28.227" Score="2" ViewCount="3723" Body="&lt;p&gt;I have to fix the amplitude of measured IQ receiver data. According to my information about the data, I can estimate that one signal needs to be corrected to the other in amplitude. The phase offset/imbalance can be ignored in this case. I would like to implement this in MATLAB. At the moment my I/Q signal looks like this:&lt;a href=&quot;https://i.stack.imgur.com/pzJzv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pzJzv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to correct it, that is shows a circle (would be the ideal result). But until now, I found no direct way to do that. I have no possibility to train or measure the amplitude imbalance from the I/Q receiver direclty. I have only the data. What have I to do, to normalize the Q component that the chart shows a circle? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already tried to calculate the amplitude offset: &lt;code&gt;o=sqrt(Q^2/(1-I^2))&lt;/code&gt;, but this doesn't work. Both signals have a small DC offset (really small, about $10^{-4}$ in relation to values between $0$ and $1$), but this is not relevant.&lt;/p&gt;&#xA;" OwnerUserId="19405" LastEditorUserId="1629" LastEditDate="2016-06-04T17:44:22.640" LastActivityDate="2018-02-27T08:54:55.307" Title="IQ imbalance amplitude" Tags="|matlab|discrete-signals|quadrature|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28679" PostTypeId="2" ParentId="28673" CreationDate="2016-02-05T06:21:17.263" Score="3" Body="&lt;p&gt;Interpolation using a Sinc function kernel.  This assumes that the sampled signal was perfectly bandlimited to below half the sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that perfectly bandlimited signal are infinite in extent.  For finite-length &quot;real world&quot; signals, using a windowed Sinc interpolation kernel (thus a finite computation with a noise floor) is a common method to approximate points between samples (for upsampling, for instance).&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-02-05T07:43:07.407" LastActivityDate="2016-02-05T07:43:07.407" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28680" PostTypeId="2" ParentId="28673" CreationDate="2016-02-05T07:11:10.227" Score="0" Body="&lt;p&gt;Another practical approach is to delay the signal a fraction of the sample period using a fractional delay filter.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2016-02-05T07:11:10.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28681" PostTypeId="2" ParentId="28673" CreationDate="2016-02-05T07:36:22.090" Score="3" Body="&lt;p&gt;Another way to do it (eg: converting N samples to 2N): take the N point FFT of the signal, then zero pad the frequency domain result to 2N.  Then compute the 2N sized inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But note that when zero padding the N point frequency domain result, the zero padding is done in the middle of the spectrum, and the Fs/2 bin is split between the upper and lower halves of the spectrum.  For instance, using 8 points as an example, where element A is the zero frequency bin, and element E is your Fs/2 bin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A B C D E F G H   ---- zero pad ----&gt;    A B C D E/2 0 0 0 0 0 0 0 E/2 F G H   -------&gt; inverse FFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such an operation will give you a 2N result where every other value is an interpolated one.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2016-02-05T07:36:22.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28682" PostTypeId="2" ParentId="28663" CreationDate="2016-02-05T08:04:02.557" Score="1" Body="&lt;p&gt;I recommend not forming the transform matrix directly. That will cost more memory and take longer to compute the transform. Instead, use the idwt/dwt or waverec/wavedec functions in place of multiplying by A/A.T.&#xA;Many reconstruction solvers and convex optimisation toolboxes support supplying function handles for this instead of a matrix. If you are implementing your own solver it should also be easy enough to integrate these functions instead of the matrix-vector products.&lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2016-02-05T08:04:02.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28683" PostTypeId="2" ParentId="28659" CreationDate="2016-02-05T09:10:02.533" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://www.ijcst.org/Volume3/Issue5/p5_3_5.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Comparative Analysis of Wavelet Basis Functions for ECG Signal Compression through Compressive Sensing,&lt;/a&gt; 2012 provides a comparative analysis for different wavelets. On a more generic basis, &lt;a href=&quot;https://dsp.stackexchange.com/questions/28659/difference-between-wavelet-filters?noredirect=1#comment53584_28659&quot;&gt;Compressed Sensing for Bioelectric Signals: A Review&lt;/a&gt;, 2015, addresses other kinds on splines, Gabor wavelets, etc. The references therein could provide you with a good starting point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://dx.doi.org/10.1049/el:20030560&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fixed percentage of wavelet coefficients to be zeroed for ECG ccompression&lt;/a&gt;, 2003, could be interesting as well, but I cannot access the paper.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-02-29T11:11:02.210" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28684" PostTypeId="1" CreationDate="2016-02-05T09:20:54.540" Score="0" ViewCount="757" Body="&lt;p&gt;How can I generate a Gaussian wavelet (time domain) with a given central frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, if I take the Fourier Transform then its spectrum should be around that given central frequency. For example the peak of spectrum is 20Hz and its side lobes becomes nearly zero around 20±10 .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I carried out a few coding exercise but the fourier transform of the gaussian wavelet was always centered around 0 Hz regardless of shape of gaussian spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code and explanation are here &lt;strong&gt;&lt;a href=&quot;https://stackoverflow.com/questions/35211841/gaussian-wave-generation-with-a-given-central-frequency&quot;&gt;Link&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="19414" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2017-05-01T08:50:35.033" Title="Gaussian wavelet generation of a given frequency" Tags="|matlab|fft|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28685" PostTypeId="1" AcceptedAnswerId="28686" CreationDate="2016-02-05T09:53:36.983" Score="1" ViewCount="694" Body="&lt;p&gt;I am currently working on an application which deals with the restoration of fluorescent beads examined using widefield microscopy. There are two major sources of noises that are being encountered in the image: photon shot noise and salt and pepper noise. I have read in a paper that, both of them can be filtered using a median filter. So, is the essential difference between them only their sources?&lt;/p&gt;&#xA;" OwnerUserId="18501" LastActivityDate="2018-04-25T04:19:07.007" Title="What is the difference between photon shot noise and salt and pepper noise?" Tags="|filters|noise|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28686" PostTypeId="2" ParentId="28685" CreationDate="2016-02-05T10:05:34.840" Score="2" Body="&lt;p&gt;photon shot noise follows a Poisson Distribution, which is essentially a shifted Normal Distribution. It is an electrical noise usually caused by charge surges. Salt and Pepper Noise is more due to digital conversion, and is usually modelled using a Fat-tailed distribution (which is essentially a shifted Normal Distribution). What to note is for any unaltered image, the order of magnitude of each type of noise, with photon shot noise usually much lower than salt and pepper noise (unless specifically created)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;True both noise can be treated using median filter, and often people use salt and pepper noise to represent shot noise.&lt;/p&gt;&#xA;" OwnerUserId="19399" LastActivityDate="2016-02-05T10:05:34.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28687" PostTypeId="1" CreationDate="2016-02-05T10:32:50.290" Score="0" ViewCount="4788" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QBmM5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QBmM5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;output from wavelet filter using daubechies 4 wavelet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using wavelet filter this is the output obtained. The problem is elimination of the spikes at 0.023,0.043,0.063 and so on. Please note: no predefined filters present in simulink and dsp toolbox are to be used. Kindly suggest an alternative method to remove the spikes.&lt;/p&gt;&#xA;" OwnerUserId="19416" LastEditorUserId="19416" LastEditDate="2016-02-05T21:35:52.080" LastActivityDate="2016-03-07T16:35:19.473" Title="What are the spike removal techniques in matlab without using filters" Tags="|signal-analysis|wavelet|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28689" PostTypeId="2" ParentId="28687" CreationDate="2016-02-05T11:10:45.823" Score="2" Body="&lt;p&gt;based on your results, you can try a median filter, in Matlab - &lt;code&gt;medfilt1&lt;/code&gt;; which takes n-length samples of your series x at a time and computes the median, and apply the median value to each value of x. It is a very common non-linear filtering technique. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;try something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = medfilt1(signal,6)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you and alter the length of evaluation from 6 to whichever number suits the data.&lt;/p&gt;&#xA;" OwnerUserId="19399" LastActivityDate="2016-02-05T11:10:45.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28690" PostTypeId="1" CreationDate="2016-02-05T13:08:48.507" Score="0" ViewCount="182" Body="&lt;p&gt;I'm trying to wrap my head around how does &quot;beamforming&quot; work when there's no physical &quot;space&quot; between receivers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My background knowledge:&lt;br&gt;&#xA;I've always thought about beamforming as a sort of spacial FIR filter. We have a number of antennas (or in this case microphones) that are at some distance one from another. Due to that distance, the signal will arrive with different phase at each of the receivers. Afterwards, we multiply the received signals with weighting factors that basically decide in which direction we'll look at. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did:&lt;br&gt;&#xA;I have a laptop with an integrated stereo microphone and stereo microphone input. Driver for the soundcard, among other options, gives option to enable beamforming. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I connected a LW/MW/SW/FM radio with stereo signal output to the microphone input of the computer. Signal provided by the radio is a mono signal from an AM station duplicated to two channels for stereo output on the radio.  In time-domain, signals on both channels are completely same and in phase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happened:&lt;br&gt;&#xA;I was quite surprised that after enabling beamforming under soundcard options, I got a significant noise reduction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thoughts about this:&lt;br&gt;&#xA;My understanding so far was that since I have two channels that are 100% same, that should be equivalent to having two microphones in same physical location. Because the distance is zero, beamforming should not be possible. &#xA;From what I could dig up, the laptop itself uses &lt;a href=&quot;http://www.andreaelectronics.com/da-250-array-microphone-digital-signal-processor/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; product as the audio DSP. There's not much information available on the manufacturer's web site and the whitepaper they show doesn't tell much above the usual beamforming stuff with space between microphones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is what could be happening here? How do I understand this application of beamforming where both receive channels are getting the same signal and yet the beamforming does work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;So commenters think it's not beamforming at work. Could it be that they are using noise-shaping and then low-pass filtering as well as as step in-between?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I have a spectrum with &quot;beamforming&quot; on:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/TBM0A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TBM0A.png&quot; alt=&quot;Spectrum with &amp;quot;beamforming&amp;quot; turned on&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and with it off:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vWwSV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vWwSV.png&quot; alt=&quot;Spectrum with &amp;quot;beamforming&amp;quot; turned off&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4977" LastEditorUserId="4977" LastEditDate="2016-02-05T19:13:42.657" LastActivityDate="2016-02-05T19:13:42.657" Title="How to think about beamforming when there's no &quot;space&quot; between receivers?" Tags="|audio|beamforming|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28691" PostTypeId="2" ParentId="28678" CreationDate="2016-02-05T13:45:46.817" Score="0" Body="&lt;p&gt;There's a lot of papers out there on IQ imbalance corrections out there, but from a practical background I know that the typical way to calibrate this IQ imbalance, if it really can be sufficiently modeled as non-unity scalar factor between the I and Q amplitudes by observing a complex signal with known moments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This, in the &lt;a href=&quot;https://github.com/EttusResearch/uhd/blob/master/host/utils/uhd_cal_rx_iq_balance.cpp&quot; rel=&quot;nofollow&quot;&gt;devices I know&lt;/a&gt; is done by disconnecting the actual antenna input, and just measuring Johnson-Nyquist (aka thermal) noise -- that should be uncorrelated and having the same magnitude on both I and Q.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, observing the resulting digital signal for a while, calculating the ratio of I and Q magnitude squares and thus calculating the inverse of the correction factor is what suffices in correcting these kind of hardware impairments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a whole &lt;a href=&quot;http://s.hostalia.de/gr&quot; rel=&quot;nofollow&quot;&gt;GNU Radio&lt;/a&gt; module dedicated to cancelling that out later on -- have a look at &lt;code&gt;gr-iqbal&lt;/code&gt;'s &lt;a href=&quot;http://cgit.osmocom.org/gr-iqbal/tree/lib&quot; rel=&quot;nofollow&quot;&gt;source code&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-05T13:45:46.817" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="28692" PostTypeId="2" ParentId="28669" CreationDate="2016-02-05T13:54:58.450" Score="1" Body="&lt;p&gt;So, a sound signal $s$, in the DSP sense, is but a sequence of real-valued digital numbers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s = (1, 232, -12, 121, 0, 131, \dots) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integrating that is nothing but adding these up, so the integrated signal $r$ would have the formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ r[n] = \sum\limits_{i=0}^n s[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or, writing that recursively, is the signal that it was at the last sampling time, plus the next input sample:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ r[n] = r[n-1] + s[n]\quad \text{ for }r&amp;gt;0\\&#xA;r[0] = 0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, that is what DSP people call a recursive system, or in this specific case, a single-pole IIR filter (IIR: &lt;em&gt;infinite impulse response&lt;/em&gt;, because you send one pulse in, you see it in the output forever). It's transfer function $H(z)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{1}{1+a\cdot z^{-1}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your $a=1$, here, because the last value of $r$ doesn't get multiplied with a dampening factor. You will find a lot of literature out there explaining the properties of IIR filters, but for all practical things, you could build a &lt;em&gt;low-pass filter&lt;/em&gt; out of your integrator, if you use a factor $a&amp;lt;1$. &lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-05T13:54:58.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28694" PostTypeId="1" CreationDate="2016-02-05T17:12:08.440" Score="0" ViewCount="20" Body="&lt;p&gt;I'm having trouble finding information on the topic I'm interested in, and maybe my problem is just how I'm wording things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's say I have a repeater-based communication system, where one node in the system receives a message, and then passes it along to the next node. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this example, let's say we have nodes 1, 2, 3, 4, 5, and 6. Also let's assume nodes can always receive the message from their neighbors, but may or may not receive it from further nodes. (ex. 3 will always receive from 2 and 4, and it might receive it from 6)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wanting to find some information on different wants to determine the path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, i can always assume the path is fixed, where the message goes from Node 1 to 2, 2 to 3, etc. so the path would be 1-2-3-4-5-6. By doing this, the message only needs to contain the node number of the node sending the message&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if I want to send the path that I want the message to go through, with the smallest amount of data possible? For instance I might want one message to go through the path 1-2-5-6, and another message to go through the path 1-5-2-3-6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thoughts to do this is to use a lookup table that is saved on all nodes, but the problem arises when I have a lot of nodes. If I have 100+ nodes, my table is huge and therefore the data I send to associate the path to the table gets large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone point me  to the right direction to even look at this subject matter?&lt;/p&gt;&#xA;" OwnerUserId="16913" LastEditorUserId="15892" LastEditDate="2016-02-06T17:53:37.320" LastActivityDate="2016-02-06T17:53:37.320" Title="Repeater based pathing" Tags="|digital-communications|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28695" PostTypeId="1" CreationDate="2016-02-05T18:28:06.627" Score="0" ViewCount="84" Body="&lt;p&gt;Suppose I have a data set of a large number of related images and I extract HOG features and train it using SVM Classifier or KNN Classifier. How can I use this model to generate a new image which is related to the images in the dataset (rather than testing on a new image which we do traditionally)?&lt;/p&gt;&#xA;" OwnerUserId="19425" LastEditorUserId="15892" LastEditDate="2016-02-05T19:06:30.600" LastActivityDate="2017-08-09T22:41:46.723" Title="How can I use a trained model to generate related images?" Tags="|image-processing|computer-vision|python|machine-learning|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28696" PostTypeId="1" CreationDate="2016-02-05T19:18:53.060" Score="0" ViewCount="588" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;You are testing a new device to determine its characteristics. You find the magnitude of its frequency response shows a peak at 500 Hz, and the measured overshoot of the step response is 40% of the steady state level. Find the system’s characteristics and confirm your answers by generate plots of its frequency and step response using either Simulink or Pspice.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm trying to figure out how to find the natural frequency with the given info. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{500\,\text{Hz}}{140\,\%}\approx 357.145$;  I'm assuming my $r_o = 357.145$, where we settle at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given percentage overshoot (40%) I can solve for our damping ratio $\zeta = 0.279$.   I have formulas to solve for Natural Frequency ($\omega_n$) but not enough known variables to solve for it.  Does anyone know how to solve for $\omega_n$ here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case, $\beta = 1.288$, if that helps.&lt;/p&gt;&#xA;" OwnerUserId="19427" LastEditorUserId="13320" LastEditDate="2016-02-07T17:27:18.437" LastActivityDate="2016-03-08T20:38:59.983" Title="Find Natural Frequency $\omega_n$" Tags="|frequency|frequency-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28697" PostTypeId="2" ParentId="28687" CreationDate="2016-02-05T20:24:14.353" Score="2" Body="&lt;p&gt;Forget about filters, just use a &lt;a href=&quot;http://fr.mathworks.com/help/dsp/ref/median.html&quot; rel=&quot;nofollow&quot;&gt;median block&lt;/a&gt; from the &lt;a href=&quot;http://fr.mathworks.com/help/dsp/&quot; rel=&quot;nofollow&quot;&gt;DSP system toolbox&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-05T20:24:14.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28698" PostTypeId="2" ParentId="28684" CreationDate="2016-02-05T21:06:47.233" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform#Basic_properties&quot; rel=&quot;nofollow&quot;&gt;modulation property of the Fourier Transform&lt;/a&gt; states that given a continuous time domain function $x(t)$ with Fourier transform $X(f)$, the function&#xA;$h(t) = e^{j 2\pi f_0 t} x(t)$ has the Fourier transform $X(f-f_0)$ (i.e. shifted by $f_0$ in the frequency domain):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;   e^{j 2\pi f_0 t} x(t) \overset{\mathcal F}\Longleftrightarrow X(f-f_0)&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly for a discrete time signal $x[n]$ with period $N$ and Discrete Fourier Transform $X_k$ (under an $N$-point DFT), the equivalent relation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;   e^{j 2\pi \frac{m}{N} n} x[n] \overset{\mbox{DFT}_N}\Longleftrightarrow X_{k-m}&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you might have noticed, these expressions multiply you original time-domain signal by a complex term, which gives you a complex valued time-domain signal. If you want a real valued time-domain signal, you would actually need to construct a combination of a signal frequency shifted by $m$ with another one frequency shifted by $-m$. This can be carried out in the time-domain by multiplying the signal by $\cos(2\pi\frac{m}{N} n)$.&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2016-02-05T21:06:47.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28700" PostTypeId="1" CreationDate="2016-02-06T01:29:33.403" Score="0" ViewCount="411" Body="&lt;p&gt;Suppose that you have a &lt;strong&gt;thumbnail&lt;/strong&gt; &lt;em&gt;and&lt;/em&gt; the &lt;strong&gt;original image&lt;/strong&gt; from which it was generated. You need to match the thumbnail to an area in the original image that represents the &lt;strong&gt;original selection&lt;/strong&gt; from which that thumbnail was generated. Humans are really good at this sort of matching, but I have no idea how to go about writing an algorithm to do this automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my thoughts on the matter so far:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A thumbnail is created by first &lt;strong&gt;cropping&lt;/strong&gt; then &lt;strong&gt;scaling&lt;/strong&gt; the original selection. Logically, some scaling is required to reverse the process.&lt;/li&gt;&#xA;&lt;li&gt;A thumbnail's dimensions could be greater than that of the original selection. Therefore, this algorithm should account not only for the common &lt;strong&gt;downscaled&lt;/strong&gt; thumbnails, but also for cases where the cropped original selection has been &lt;strong&gt;upscaled&lt;/strong&gt; to the thumbnail's intended dimensions.&lt;/li&gt;&#xA;&lt;li&gt;Theoretically, it is possible that a thumbnail was generated such that the entire original image was encompassed inside the original selection, akin to &lt;code&gt;background-size: contain&lt;/code&gt; in CSS. All four corners of the original selection thus fall outside of the original image. The extra space could have been filled either with a solid color (possibly transparent) or with Photoshop's &lt;em&gt;Content Aware Fill&lt;/em&gt; or a similar algorithm (inpainting). This is an edge case; however, an ideal reverse-thumbnail algorithm should be able to handle such cases.&lt;/li&gt;&#xA;&lt;li&gt;This algorithm should return the &lt;code&gt;x,y&lt;/code&gt; pixel coordinates of the top-left corner of the original selection as it falls on the original image, as well as the &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;length&lt;/code&gt; of the selection. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I suspect that feature detection is required to make this work, but I don't know where to start. Partial answers are acceptable, but if this is an easier problem than I think it is, please do give it a shot. Any language is fine, but the implementation should not rely on proprietary software, and Python or JavaScript are tentatively preferred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've put together a sample set of 30 images from my current project for testing  potential algorithms. I tried to include a variety of images to challenge any feature-recognition approach. All selections in this collection have been &lt;strong&gt;downscaled&lt;/strong&gt; to the intended thumbnail size of &lt;code&gt;300x300&lt;/code&gt; after cropping. I included an &lt;code&gt;info.csv&lt;/code&gt;, which contains &lt;code&gt;id,x,y,w,h&lt;/code&gt; representing the coordinates and dimensions of the original selection relative to the full-sized image. These values were obtained by applying Deep Zoom coordinates saved from the source &lt;code&gt;tiff&lt;/code&gt; files to the &lt;code&gt;full&lt;/code&gt; images. Due to floating point inaccuracy, &lt;code&gt;w&lt;/code&gt; and &lt;code&gt;h&lt;/code&gt; differ by one pixel in three cases (&lt;code&gt;13, 17, 21&lt;/code&gt;). These images were included intentionally to test how your algorithm might handle accuracy concerns. A second &lt;code&gt;info_ur.csv&lt;/code&gt; includes unrounded values for reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Download test images:&lt;/strong&gt; &lt;a href=&quot;https://app.box.com/s/65240dlgvfvevw2grhyaqqjjc29jzv65&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://app.box.com/s/65240dlgvfvevw2grhyaqqjjc29jzv65&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, here's an illustration of the four cases such an algorithm might encounter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7lyBf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7lyBf.png&quot; alt=&quot;four ways to generate a thumbnail from an image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19374" LastEditorUserId="19374" LastEditDate="2016-02-08T05:17:24.607" LastActivityDate="2016-02-08T05:17:24.607" Title="How to match a thumbnail to an area in the original image?" Tags="|image-processing|computer-vision|local-features|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28701" PostTypeId="1" AcceptedAnswerId="28703" CreationDate="2016-02-06T03:50:00.720" Score="0" ViewCount="490" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Consider an LTI system $$H(z)=1-\frac{1}{2}z^{-1}+\frac{3}{4}z^{-2}$$&#xA;  Let $x[n]=(\frac{1}{3})^n\cdot u[n]$ be the input signal. It is desired to determine the output for $n=0,1...,N_a$. To achieve that, a relevant part of the DFT will be used together with an uniform sampling of $H(z)$ in the unity circle with a separation of $\frac{2\pi}{N_b}$.&#xA;  &lt;strong&gt;a)&lt;/strong&gt; Explain the process to achieve this. &lt;strong&gt;b)&lt;/strong&gt; Are there any restrictions for $N_a$ and $N_b$? &lt;strong&gt;c)&lt;/strong&gt; For the same $x[n]$, would the method described in &lt;strong&gt;a)&lt;/strong&gt; work if $H(z)=\frac{1}{1-\frac{1}{2}z^{-1}}$? If not, correct the previous method to find the correct result.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$H(z)$ is sampled in $N_b$ points. $\hat{h}[n]$ (the sequence whose DFT is the sampled version of $H(z)$) has only 3 non-zero values, so... the sampled version of it would have $N_b -3$ zeros (I'm not sure about this). About the size of $X[k]$, I thought that, if I want to know the first $N_a +1$ values of $y[n]$, maybe it is enough to grab the first $N_a +1$ points of $x[n]$ to do the DFT and add the necessary amount of zeros to avoid aliasing? This may be false but I just don't know how to determine the &lt;em&gt;relevant part&lt;/em&gt; of the input signal that has to be used. If everything I said above is correct (I highly doubt it), then I thought that the only restriction on $N_a$ and $N_b$ is that $N_a +3 = N_b$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About &lt;strong&gt;c)&lt;/strong&gt;, I have no idea of how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion?&#xA;Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-02-06T13:47:45.173" Title="Analysis of a LTI system using DFT" Tags="|dft|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28702" PostTypeId="1" AcceptedAnswerId="28704" CreationDate="2016-02-06T06:46:48.537" Score="0" ViewCount="184" Body="&lt;p&gt;I am reading the book &lt;em&gt;Noise reduction by wavelet thresholding by Maarten Jansen.&lt;/em&gt; About &lt;a href=&quot;https://math.stackexchange.com/questions/128165/what-is-a-vanishing-moment&quot;&gt;vanishing moments&lt;/a&gt;, it reads &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To create a really sparse representation, we try to make coefficients&#xA;  that live between point s of singularities as small as possible. In&#xA;  these intervals of smooth behavior , the signal can be locally well&#xA;  approximated by a polynomial.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand the sentence. If the number of vanishing moments is large, does it mean that the filtered image will be smoother? If I hope to keep edges in images, do I need to use Haar wavelets?&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="-1" LastEditDate="2017-04-13T12:19:22.547" LastActivityDate="2016-07-26T20:14:22.363" Title="Question about vanishing moments in wavelet transforms" Tags="|wavelet|transform|denoising|sparsity|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28703" PostTypeId="2" ParentId="28701" CreationDate="2016-02-06T08:45:16.730" Score="1" Body="&lt;p&gt;Since the system described by $H(z)$ is causal, it's sufficient to consider the input sequence in the range $0\le n\le N_a$ in order to compute the output sequence in the same range. Each output sample can only depend on the current input sample and on past input samples. Since the length of the truncated input sequence is $N_a+1$, and the length of the system's impulse response is $3$, the length of the convolution of these two sequences is $N_a+3$. If you want to compute this linear convolution using circular convolution (i.e., using the DFT), the DFT length $N_b$ must satisfy $N_b\ge N_a+3$. So you must zero-pad the truncated input sequence as well as the impulse response to that length, then compute the DFTs of both zero-padded sequences, multiply them, and compute the IDFT of the resulting sequence, the first $N_a+1$ elements of which equal the desired output sequence. This answers a) and b).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For part c) it will not suffice to sample $H(z)$ on the unit circle, because the corresponding impulse response is infinitely long. However, for computing the first $N_a+1$ output samples it is sufficient to consider the first $N_a+1$ samples of the impulse response. Just like before, this works because the system's impulse response as well as the input signal are both zero for $n&amp;lt;0$. So you need to consider a system $\hat{H}(z)$ the impulse response of which is a truncated version of the infinite impulse response corresponding to $H(z)$. The length of the convolution of the truncated input signal and the truncated impulse response is $2N_a+1$, so the DFT length $N_b$ needs to satisfy $N_b\ge 2N_a+1$. The rest of the procedure is the same as before.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-06T13:47:45.173" LastActivityDate="2016-02-06T13:47:45.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28704" PostTypeId="2" ParentId="28702" CreationDate="2016-02-06T08:53:45.873" Score="1" Body="&lt;p&gt;The initial motivation of a sparse representation for a class of signals or images is to pre-separate components with different morphological behaviors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A traditional model for images is the augmented cartoon: piece-wise smooth + contours + geometrical textures + &quot;noise (unmodelled)&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hW22w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hW22w.png&quot; alt=&quot;Smooth background, contour and texture&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mother wavelets (gradient-like operators) can capture isolated singularities at different scale with a few coefficients (and if they oscillate, a bit of textures as well). If the singularities are mixed with a polynomial trend, a standard gradient may also produce coefficients. With a sufficient number of vanishing moments, wavelets somehow &quot;pre-separate&quot; polynomials and singularities, and the polynomial part is cast, subsampled, to a small set of approximmation coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all, you can get few coefficients for singularities, and few coefficients for polynomials between singularities (a long polynomial can be encoded into a few polynomial factors). But still you preserve all the information, especially about the gradients you want to keep. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wavelets are, under some theoretical conditions, quite optimal for such 1D signals. In practice on 2D data, other aspects come into play and counterbalance the need for vanishing moments: the nature of singularities in images, their finite size, the other wavelet properties, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Resultingly, 1D wavelets work ok for not-too-complex images, but become limited with complicated data, complicated processing, or  high noise conditions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My experience is that, unless you have specific needs, 2-4 moments suffice in most of the cases, meaning that if finally you use a wavelet with more moments, it will be a by-product of other wavelet properties, and not a strong requirement. There are many options in finding the optimal multiscale  geometric representation.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-06T08:53:45.873" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28705" PostTypeId="2" ParentId="26261" CreationDate="2016-02-06T10:45:32.340" Score="3" Body="&lt;p&gt;Your signals look like they have about the same ordinal scale, and little lag. Hence, you can perform local correlations: take a segment of both signals centered at a time location, you can normalize them in amplitude  and dispersion (divise by mean and standard deviation, or median and median absolute deviation). Apply a smoothing window: if you do not do that, remember you are already applying a rectangular window. Then do a cross-correlation, and repeat over time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a process creates a 2D image from two 1D signals. It  could be called &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.330.7112&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;windowed cross-correlation&lt;/a&gt; (see also &lt;a href=&quot;https://stackoverflow.com/questions/23270911/windowed-cross-correlation-in-matlab&quot;&gt;Windowed cross correlation in Matlab&lt;/a&gt;), or &lt;a href=&quot;http://www.cs.cmu.edu/~spapadim/pdf/loco_icdm06.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;local cross-correlation&lt;/a&gt;. From the latter:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We address the problem of capturing and tracking local correlations&#xA;  among time evolving time series. Our approach is based on comparing&#xA;  the local auto-covariance matrices (via their spectral decompositions)&#xA;  of each series and generalizes the notion of linear cross-correlation&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you are unsure about scales, or want of more generic setting, some perform cross-correlation in a multiscale wavelet domain. You can check the concept of &lt;a href=&quot;http://fr.mathworks.com/help/wavelet/examples/wavelet-coherence.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;wavelet coherence&lt;/a&gt; (Matlab), illustrated by Torrence et al. &lt;a href=&quot;http://paos.colorado.edu/research/wavelets/interdecadal.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Interdecadal Changes in the ENSO–Monsoon System&#xA;&lt;/a&gt;, with &lt;a href=&quot;http://atoc.colorado.edu/research/wavelets/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab software&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-02-06T10:45:32.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28707" PostTypeId="2" ParentId="14667" CreationDate="2016-02-06T15:04:56.440" Score="1" Body="&lt;p&gt;All discrete spectral representations that exist strictly on a fixed spacing grid that includes 0 (DC) represent a signal that is periodic in time.  Other grids (with different irrational number spacings for instance) can indicate aperiodic waveforms in continuous time.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-02-16T05:08:56.190" LastActivityDate="2016-02-16T05:08:56.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28708" PostTypeId="2" ParentId="26252" CreationDate="2016-02-06T18:07:01.853" Score="-1" Body="&lt;p&gt;You will need to think about what model you want for the dependence of errors on one hop on the second hop. For instance, the simplest model might be to assume that errors are independent on the two hold. In that case, think about how the BER for the entire link can be determined by the BER in each link.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, this gives you enough information to move forward. &lt;/p&gt;&#xA;" OwnerUserId="19437" LastActivityDate="2016-02-06T18:07:01.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28710" PostTypeId="1" AcceptedAnswerId="28712" CreationDate="2016-02-06T23:34:49.537" Score="3" ViewCount="2670" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Let $x[n]$ be a real signal whose length $N$ is even. Let $y[n]=x[2n]+jx[2n+1]$ a signal whose length is $M=\frac{N}{2}$. $X[k]$ for $k=0,...,N-1$ and $Y[k]$ for $k=0,...,M-1$ are the respective DFTs of those signals. Find $Y[k]$ as a function of $X[k]$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I haven't been able to find a scaling time property for the DFT. I read all the Oppenheim-Schafer's discrete signals book and found nothing about the subject. I tried doing it by definition but I just can't realize what the relationship between both DFTs is.&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="19249" LastEditDate="2016-02-07T13:49:39.570" LastActivityDate="2016-02-07T19:55:18.477" Title="Time scaling in DFT?" Tags="|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28711" PostTypeId="1" CreationDate="2016-02-07T06:02:16.447" Score="0" ViewCount="62" Body="&lt;p&gt;This is about error control coding formula &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ d \ge  c+u+1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;of a block code, with&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$c$ being the number of correctable errors,&lt;/li&gt;&#xA;&lt;li&gt;$u$ being the number of uncorrectable errors, and &lt;/li&gt;&#xA;&lt;li&gt;$d$ being the distance of the code.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Per my understanding, this is applicable for all the block codes - linear or not. Now let us dissect the repeat code with respect to this formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Repeat code with $k=1$, $n=7$: Let us say we repeat each bit 7 times. $\mathrm 0$ is sent as $\mathrm 0000000$ and $\mathrm 1$ is sent $\mathrm 1111111$.  $d = 7$ in this case.  We conclude that all these combinations below are possible:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{|c|c|}\hline&#xA; c &amp;amp; u \\ \hline&#xA;6&amp;amp;   0\\&#xA;5&amp;amp;   1\\&#xA;4&amp;amp;   2\\&#xA;3&amp;amp;   3\\&#xA;2&amp;amp;   4\\&#xA;1&amp;amp;   5\\&#xA;0&amp;amp;   6\\\hline&#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Now let us consider $c=3$ and $u =3$.  With respect to the repeat code we are discussing above, what does it really mean?  &lt;/li&gt;&#xA;&lt;li&gt;Can someone kindly explain with examples ?&lt;/li&gt;&#xA;&lt;li&gt;How does the explanation change with one or two more of the above combinations?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="1629" LastEditDate="2016-06-14T02:12:19.197" LastActivityDate="2016-06-14T02:12:19.197" Title="Block code error control with $d \ge c+u+1$" Tags="|forward-error-correction|channelcoding|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28712" PostTypeId="2" ParentId="28710" CreationDate="2016-02-07T08:36:07.233" Score="5" Body="&lt;p&gt;This is a classic exercise and it shows you how to obtain the DFT of a real-valued length $N$ signal in terms of the DFT of a length $N/2$ complex-valued signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to write $X[k]$ in terms of the even and odd samples of $x[n]$. With $W_N=e^{-j2\pi /N}$ you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}X[k]=\sum_{n=0}^{N-1}x[n]W_N^{kn}&amp;amp;=\sum_{n=0}^{N/2-1}x[2n]W_{N/2}^{kn}+W_N^k\sum_{n=0}^{N/2-1}x[2n+1]W_{N/2}^{kn}\\&amp;amp;=\text{DFT}_{N/2}\{y_R[n]\}+W_N^k\;\text{DFT}_{N/2}\{y_I[n]\}\\&amp;amp;=Y_e[k]-jW_N^kY_o[k]\tag{1}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y_R[n]$ and $y_I[n]$ are the real and imaginary parts of $y[n]$, respectively, and $Y_e[k]$ and $Y_o[k]$ are the even and odd parts of $Y[k]$. Eq. $(1)$ shows that after having computed the length $N/2$ DFT $Y[k]$, you need to split it into its even an odd parts, and from them you can obtain the length $N$ DFT $X[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obtaining $Y[k]$ from $X[k]$ is also possible, even though that's usually the less practical problem, because often you have an FFT routine that takes complex input signals, so it's more efficient to compute a lenght $N$ FFT of a real-valued sequence by computing a length $N/2$ FFT of a complex-valued sequence. Anyway, $Y[k]$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y[k]=\sum_{n=0}^{N/2-1}x[2n]W_{N/2}^{kn}+j\sum_{n=0}^{N/2-1}x[2n+1]W_{N/2}^{kn}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $W_{N/2}^n=W_N^{2n}$, the first term on the right-hand side of $(2)$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\sum_{n=0}^{N/2-1}x[2n]W_{N}^{k(2n)}&amp;amp;=\sum_{n=0}^{N-1}x[n]W_N^{kn}\frac{1+(-1)^n}{2}\\&amp;amp;=\frac12\sum_{n=0}^{N-1}x[n]W_N^{kn}+\frac12\sum_{n=0}^{N-1}x[n]W_N^{nN/2}W_N^{kn}\\&amp;amp;=\frac12\left(X[k]+X[k+N/2]\right)\tag{3}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I used $(-1)^n=W_N^{nN/2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. $(3)$ shows that decimation in the time domain corresponds to aliasing in the frequency domain, as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a completely analogous manner, the last term in Eq. $(2)$ can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$j\sum_{n=0}^{N/2-1}x[2n+1]W_{N/2}^{kn}=\frac{j}{2}\left(X[k]-X[k+N/2]\right)W_N^{-k}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting $(3)$ and $(4)$ into $(2)$ gives the final solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y[k]=\frac12X[k]\left(1+jW_N^{-k}\right)+\frac12X[k+N/2]\left(1-jW_N^{-k}\right)\tag{5}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-07T19:55:18.477" LastActivityDate="2016-02-07T19:55:18.477" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="28713" PostTypeId="2" ParentId="28711" CreationDate="2016-02-07T10:17:05.830" Score="1" Body="&lt;p&gt;You have to realize that $d$ is specifically the &lt;strong&gt;minimum&lt;/strong&gt; distance in your code, i.e. the distance between the to code words that are closest together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And $u$ is &lt;strong&gt;not&lt;/strong&gt; exactly the number of &quot;uncorrectable errors&quot;, but the maximum number of errors that can definitely be &lt;strong&gt;detected, but not corrected correctly&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &quot;distance&quot; here is the hamming distance, i.e. the number of bits you'd have to flip until you end up with another codeword.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We conclude that all these combinations below are possible: ...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;False. The first three lines ($c\in\{6,5,4\}$) are impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, your table doesn't make much sense. Given a code, you'd &lt;em&gt;always&lt;/em&gt; correct as many errors as possible¹, so for a given code, $c$ is given, and $u$ is given. The fact that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;c &amp;amp;=&amp;amp; \#(\text{detectable bit flips, which ARE correctable})\\&#xA;  &amp;amp;=&amp;amp; \#(\text{total detectable bit flips}) &amp;amp;- \#(\text{detectable bit flips, which AREN'T correctable})\\&#xA;  &amp;amp;=&amp;amp; (d-1) &amp;amp;- u\tag{*}&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is just your definition of $c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A $k=7$ repetition code can never correct 6, 5 or even 4 bit errors; I find &lt;em&gt;&quot;you can't flip more than $\left\lfloor \frac d2 \right\rfloor$ bits until it looks more like another codeword than like the original&quot;&lt;/em&gt; highly intuitive, so the only way I can explain this is by example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;take your &lt;code&gt;0&lt;/code&gt; code word, and flip 4 bits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 0 0 0 0 0 &#xA;0 1 1 1 0 1 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, that looks much more like the &lt;code&gt;1&lt;/code&gt; keyword, doesn't it? In fact, &lt;code&gt;0 1 1 1 0 1 0&lt;/code&gt; has a hamming distance of 4 to the &lt;code&gt;0&lt;/code&gt; code word, and a hamming distance of &lt;code&gt;3&lt;/code&gt; to the &lt;code&gt;1&lt;/code&gt; code word, so it's &lt;em&gt;closer&lt;/em&gt; to &lt;code&gt;1&lt;/code&gt;, and will &lt;em&gt;correctly be identified&lt;/em&gt; as error, but &lt;em&gt;falsely get corrected&lt;/em&gt; to &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at this, any error is detectable, as long &lt;strong&gt;less&lt;/strong&gt; than the minimum distance bits are flipped (&lt;em&gt;for any code&lt;/em&gt;, pretty logical, isn't it?). So, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c_\text{max} = d -1 \text.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, your formula simply &quot;happens&quot; when you put in your definition of $c$ and $u$, see $(*)$ above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's not much to explain here: for repitition codes $d=k$, and you can always correct $\left\lfloor \frac d2 \right\rfloor=\left\lfloor \frac k2 \right\rfloor$ bit errors and detect $d-1=k-1$ errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can't explain your other combinations, as they are basically wrong for any maximum likelihood decoder. You can of course work &quot;worse&quot; than possible, but especially for the  repitition codes, summing up the received bits and deciding whether the result is larger than $\frac k2$ gives you $c=\left\lfloor \frac k2 \right\rfloor$ and thus, $u=(d-1)-c=(k-1)-\left\lfloor \frac k2 \right\rfloor =\left\lceil \frac{k-1}{2}\right\rceil $, and, in your $k=7$ case, $c=u=3$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;¹: point is that there's many codes where you can't, with reasonable effort, correct as much correctable errors as the code would allow you too, that means that $c \le \left\lfloor \frac d2 \right\rfloor$ in general, and that's why $d\ge c+u +1$ and not $d = c+u +1$. However, repetition codes are so trivial, we can truly Maximum-Likelihood-decode them and correct $\left\lfloor \frac d2 \right\rfloor$ errors.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-02-07T10:29:31.877" LastActivityDate="2016-02-07T10:29:31.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28714" PostTypeId="1" CreationDate="2016-02-07T12:24:06.733" Score="2" ViewCount="2101" Body="&lt;p&gt;Before I begin, I have read these already:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8020/iir-filter-parallelization&quot;&gt;IIR filter parallelization&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/20194/concept-of-combining-multiple-fir-filters-into-1-fir-filter&quot;&gt;Concept of combining multiple FIR Filters into 1 FIR filter&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am processing audio using Csound in a high performance real time environment. One part of my code uses 10 butterworth bandpass filters in parallel, each with a different centre frequency and bandwidth. However, the centre frequencies and bandwidths are all relative to each other. The centre frequency of each filter are set whole number multiples or divisions of the main filter's centre frequency (ie, if main filter has cf of 100Hz, the other filters cfs would be 200, 300, 400, 500, 600, 50, 33.333, 25, and 20). The bandwidths of each filter are all a specific division of the associated centre frequency (ie, cf 100 = bw 10, cf 200 = bw 20, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main centre frequency is not fixed, but seeing as the filter centre frequencies and bandwidths are all relative to the main filters centre frequency and bandwidth, could I design a filter that combines all these filters into one? And most importantly, if I could, would it make any major difference to performance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My best guess as to how to achieve this would be to combine the filter equations into one. I don't know if this would actually work, but if it did, I don't feel like it would improve the performance by much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sample being filtered is rich in harmonic and in-harmonic frequencies. It is borderline noisy, so the sum of the outputs of the BP filters is quite interesting, and the harmonies aren't always perfectly related. This quality I would like to keep.&lt;/p&gt;&#xA;" OwnerUserId="19240" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2017-08-06T21:06:33.807" Title="Multiple parallel IIR bandpass filters with different centre frequencies combined into one filter for optimisation... possible?" Tags="|filter-design|bandpass|optimization|" AnswerCount="1" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="28715" PostTypeId="1" CreationDate="2016-02-07T16:09:24.323" Score="0" ViewCount="1305" Body="&lt;p&gt;I have seen different formulations of how to calculate delta MFCCs.  In general, I want to be consistent in such a way that if I have other features to look at other than MFCCs, the way I would calculate their deltas would be the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;http://www.ee.columbia.edu/ln/LabROSA/doc/HTKBook21/node56.html&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;, HTK supported different ways of looking at how to calculate MFCCs.  One was using a regression formula.  Another is just doing a simple first order difference.  Another listed on that page is doing a modified kind of simple difference.  &lt;a href=&quot;http://practicalcryptography.com/miscellaneous/machine-learning/guide-mel-frequency-cepstral-coefficients-mfccs/#deltas-and-delta-deltas&quot; rel=&quot;nofollow&quot;&gt;Another link&lt;/a&gt; also showcases the regression formula.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Which one of these is the best way to go?  &lt;/li&gt;&#xA;&lt;li&gt;In what situations might one outperform the other?  I can see that doing first order differences can be easily done in code and doesn't require end frame replication, but many sources I've been reading for MFCCs at least do not use the first order difference. &lt;/li&gt;&#xA;&lt;li&gt;For other types of delta features that arent MFCCs, is that also the case?  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19447" LastEditorUserId="1629" LastEditDate="2016-06-07T13:38:50.637" LastActivityDate="2017-04-03T20:39:07.770" Title="Calculating Delta MFCC, correct formula?" Tags="|speech-processing|mfcc|speech|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28717" PostTypeId="1" CreationDate="2016-02-07T19:22:53.447" Score="2" ViewCount="276" Body="&lt;p&gt;I'm a Python programmer, but a beginner to image processing :) Apologies if this isn't a suitable question for the forum, happy to rewrite or move. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to create a supervised classifier to distinguish between &lt;a href=&quot;https://i.stack.imgur.com/meWjo.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;the two images in this album&lt;/a&gt; (or more generally, with more training data, this scene containing some pavement for available parking, and this scene containing no pavement).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is about how to extract features, using Pillow or scikit-image, that would be appropriate for classification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, I have skeleton code for an SVM classifier: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data = []&#xA;classes = []&#xA;for imagefile in glob.glob('./img/training/*/*.bmp'):&#xA;    data.append(extract_features(imagefile))&#xA;    if 'nospace' in imagefile:&#xA;        classes.append('nospace')&#xA;    else:&#xA;        classes.append('space')&#xA;clf = svm.SVC(gamma=0.001, C=100.)&#xA;clf.fit(data, classes)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I have a very simple feature extraction method, which just returns a colour histogram for the image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def extract_features(imagefile):&#xA;    im = Image.open(imagefile)&#xA;    width, height = im.size&#xA;    im = im.crop((0, int(height * 0.4), width, int(height * 0.8)))&#xA;    # Improve on just returning a colour histogram?&#xA;    return im.histogram()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that this doesn't give great results - particularly if the car is nearly the same colour as the tarmac, as in my example album. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I looked at edge detection. This seems to be quite easy to do with Pillow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;im.filter(ImageFilter.FIND_EDGES)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But just passing this in to the classifier also doesn't give great results - I'm guessing because I should turn it from a matrix of pixels into something more meaningful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone suggest a good approach for extracting features for this problem? I think ideally I want to detect &quot;blobs&quot;, i.e. cars. &lt;/p&gt;&#xA;" OwnerUserId="19448" LastEditorUserId="128" LastEditDate="2018-05-31T04:47:34.933" LastActivityDate="2018-11-27T16:03:00.627" Title="Beginner Question: Extracting Features for Image Classification" Tags="|image-processing|computer-vision|machine-learning|edge-detection|scipy|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28718" PostTypeId="2" ParentId="28696" CreationDate="2016-02-07T20:25:06.857" Score="1" Body="&lt;p&gt;Using &lt;a href=&quot;https://en.wikipedia.org/wiki/Overshoot_%28signal%29#Control_theory&quot; rel=&quot;nofollow&quot;&gt;this formula&lt;/a&gt; for the percentage overshoot, the damping ratio is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\zeta=\sqrt{\frac{\log(0.4)^2}{\pi^2+\log(0.4)^2}}=0.28$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is more or less the same value that you obtained. Consequently, you have an underdamped system. The peak frequency $\omega_{max}$ of the frequency response is related to the damping ratio and to the natural frequency in the following way (&lt;a href=&quot;http://www.kves.uniza.sk/kvesnew/dokumenty/DREP/Filters/2nd%20order%20transfer%20function.pdf&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_{max}=\omega_n\sqrt{1-2\zeta^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $\zeta=0.28$ and $f_{max}=500\text{ Hz}$ this results in a natural frequency $f_n=544.51\text{ Hz}$. Apart from a scaling factor, a second order system is completely characterized by $\zeta$ and $\omega_n=2\pi f_n$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-07T20:38:26.767" LastActivityDate="2016-02-07T20:38:26.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28719" PostTypeId="2" ParentId="28717" CreationDate="2016-02-07T23:51:30.143" Score="2" Body="&lt;p&gt;You are just using the histogram as your features, yet your image contains very slight differences. This is not discriminative enough for SVM, you should focus on better features. In this case, you might be better of with subtraction, change detection and etc.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2016-02-07T23:51:30.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28720" PostTypeId="2" ParentId="28715" CreationDate="2016-02-08T01:57:00.763" Score="1" Body="&lt;p&gt;The way you compute MFCCs and derivatives has little-to-no influence on the final result, so just pick one and go ahead. Although when applied to speech recognition and similar problems the same algorithm should be used for training and decoding. Thus if you use a pre-trained model you have to know how features for its training were computed. If not sure, you can always take a look at real-world examples - &lt;a href=&quot;https://github.com/cmusphinx/sphinxbase&quot; rel=&quot;nofollow&quot;&gt;CMU Sphinx&lt;/a&gt; and &lt;a href=&quot;https://github.com/kaldi-asr/kaldi&quot; rel=&quot;nofollow&quot;&gt;Kaldi&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18297" LastActivityDate="2016-02-08T01:57:00.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28721" PostTypeId="1" AcceptedAnswerId="37158" CreationDate="2016-02-08T04:53:47.667" Score="1" ViewCount="12214" Body="&lt;p&gt;Do the processes of upsampling and downsampling affect the magnitude of the transform of a signal? And if not, why am I seeing everywhere that a filter with gain different from 1 is applied after up/downsampling a signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: For example in &lt;em&gt;Discrete-Time Signal Processing&lt;/em&gt; by Oppenheim-Schafer (Section 4.6, 2nd edition):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H6dDi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H6dDi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in the summaries of the subject that my teacher did himself, up- and downsampling are always followed by a lowpassfilter with gain different from 1.&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="1585" LastEditDate="2018-04-04T15:46:03.247" LastActivityDate="2018-04-04T15:46:03.247" Title="Output gain when upsampling and downsampling" Tags="|interpolation|downsampling|decimation|" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28722" PostTypeId="2" ParentId="28721" CreationDate="2016-02-08T10:16:52.107" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Do the processes of upsampling and downsampling affect the magnitude of the transform of a signal? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. No. Well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It all depends on how you define up- and downsampling, but usually, it's defined in a manner that keeps the total energy constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, assume you downsample by a factor of 2, that means you simply &quot;throw away&quot; every second sample. Now, there's two options:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;your input signal was appropriately filtered to only contain half of its bandwidth of signal. In that case, that signal doesn't really change; Assume you'd have a signal that is constant 1. Throwing away half of it will still lead to constant 1. Assume your signal is a sine of relative frequency $f=\frac{f_\text{signal}}{f_\text{sample}}$ and amplitude $A$: throwing away half of its samples will change its frequency relative to the sampling rate, but it won't change its amplitude, and therefore its energy. Now, we're doing classical signal theory by postulating you can define every signal as sum of sinusoids: since none of the original sinusoids changes its amplitude, so can't the resulting sum signal.&lt;/li&gt;&#xA;&lt;li&gt;your signal contained more spectrum than Nyquist would allow for the downsampled signal. You end up with aliases, and thus, amplitude changes...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And if not, why am I seeing everywhere that a filter with gain different from 1 is applied after up/downsampling a signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Oh come on. Really. This would be the time to actually &lt;strong&gt;cite&lt;/strong&gt; where you see that. I don't do that. I don't usually see people do that, unless they need to achieve a specific fixed point bit width. So I'd say your claim is unbacked and hence indistinguishable from false.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-02-08T10:25:00.807" LastActivityDate="2016-02-08T10:25:00.807" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28723" PostTypeId="2" ParentId="28714" CreationDate="2016-02-08T10:39:51.650" Score="1" Body="&lt;p&gt;So, what I took away from my multirate lectures is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't use IIRs in that case, because the recursive part isn't shareable among multiple filter implementations (being specific to the output of each filter), and hence, you end up with a lot more multipliers than you'd have if you went for a FIR system and removed redundancies. This is especially true for hardware/FPGA implementation, where placing a wire to use a result twice is cheap. You're doing software, so saving a few registers worth of filter taps really won't pay -- you're breaking the linear nature of memory access that way, and that will impose a performance hit that is much, much worse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, I'd challenge you to look at how you can understand your filter bank as an array of filterbanks with identical filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, assume that all your BPFs have equally spaced center frequencies $\frac{f_\text{sample}}{N}$. Also, they might have different bandwidths, but since you say they are related to each other, let's assume there's one &quot;maximum bandwidth&quot; that is a multiple of all smaller bandwidths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, implementing a polyphase filterbank (&quot;channelizer&quot;) with a BPF of that maximum bandwidth and the constant frequency spacing is very efficient. Basically, it's like taking a single very BPF at full rate, add one FFT, and you get the complexity of the system for up to $N$ channels (note: this is $N-1$ free channels!). Then, take the channels whose bandwidth you'd need to be reduced further. Now, assume these $m&amp;lt;N$ channels all need to be reduced in bandwidth by a factor of $4$, for example. So that's $m$ identical quarterband lowpass filters! Implementing identical filters in hardware is pretty efficient, usually, especially because after the first filterbank, sampling rate might already be reduced (so you can multiplex multipliers); now, you're seemingly doing audio on a PC: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take these $m$ channels, and just implement individual filters. There's nothing much you can or need to optimize here; assuming this is on something that has a PC-like CPU, caching will keep your filter taps close to CPU registers, and and only the actual samples will need to go through memory buses. Also, not that things like $\frac{1}{M}$ low pass filters are relatively relaxed in transition width requirements, and hence, FIR implementations are short in taps, and thus fast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As usual in signal processing, decimate whenever possible! The polyphase filterbank might already decimate, but also your $m$ channel low pass filters should do that, too, and in a clever manner (a polyphase lowpass decimator runs at the output, not the input sampling rate!). Not processing samples you don't need is probably reason Nr. 1 that modern DSP is so capable.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-08T10:39:51.650" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="28725" PostTypeId="1" AcceptedAnswerId="28732" CreationDate="2016-02-08T12:36:21.600" Score="9" ViewCount="16854" Body="&lt;p&gt;I am currently trying to apply a bandpass filter to a signal in real-time. There are samples coming in with a constant sampling rate and i would like to calculate the corresponding bandpass filtered signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the best way to do this? Do I have to filter the whole (or at least a huge bit) of the signal every time a few new samples came in or is there a way (like the sliding DFT) where it is possible to efficiently determine the new part of the filtered signal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to use a butterworth filter (for offline analysis I am currently using scipy's butter and lfilter). I know that this function can return a filter delay, but I don't know how to use it to get a constant signal.&lt;/p&gt;&#xA;" OwnerUserId="15853" LastActivityDate="2022-01-23T20:01:25.233" Title="Filtering a digital signal online in real-time using python" Tags="|filters|python|real-time|online-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28728" PostTypeId="1" AcceptedAnswerId="28734" CreationDate="2016-02-08T14:14:44.867" Score="2" ViewCount="1426" Body="&lt;p&gt;I want to optimize a sum of complex frequency responses (complex sum is SPL, sound pressure level as a complex function of distance) of a number of loudspeakers, say 10. There is a reference, desired SPL curve given (objective function), which represents the magnitude of the sum of 10 frequency responses. I have read a number of papers how to do optimization using Lagrange Multipliers, however, did not find many papers (only one) about optimization when the functions are complex (Re and Im parts). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help or pointing to a good references, examples would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15718" LastActivityDate="2017-11-15T19:20:32.513" Title="Lagrange Multipliers Optimization - Complex Functions" Tags="|frequency-response|optimization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28730" PostTypeId="1" CreationDate="2016-02-08T15:12:50.347" Score="1" ViewCount="68" Body="&lt;p&gt;Let $\alpha, \beta &amp;gt; 0$ and $\Delta := \nabla^T \nabla$ be the discrete laplacian operator,&#xA;$$\nabla: \mathbb{R}^{n_x \times n_y \times  n_z} \rightarrow \mathbb{R}^{3 \times n_x \times n_y \times n_z}, \hspace{.5em}w \mapsto (\nabla_xw, \nabla_yw, \nabla_zw)&#xA;$$&#xA;being the discrete spatial gradient operator in $3$D. You can see $\Delta$ as a linear operator of shape $p \times p$, where $p := n_xn_yn_z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My intuition is that the operator $(\alpha I + \beta \Delta)^{-1}$ corresponds to some kind of Gaussian smoothing. Is this true ? If yes, what's the width of the corresponding kernel in terms of $\alpha$ and $\beta$ ?&lt;/p&gt;&#xA;" OwnerUserId="15159" LastEditorUserId="15159" LastEditDate="2016-02-08T19:25:46.067" LastActivityDate="2016-02-08T19:25:46.067" Title="Proximal operator of image Laplacian" Tags="|image-processing|filtering|smoothing|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28731" PostTypeId="2" ParentId="28725" CreationDate="2016-02-08T15:23:02.227" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Do I have to filter the whole (or at least a huge bit) of the signal every time a few new samples came in or is there a way (like the sliding DFT) where it is possible to efficiently determine the new part of the filtered signal? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Digital filters don't work like that -- basically, classical FIR or IIR can work on &lt;em&gt;every single new sample&lt;/em&gt;. You should really read up on what these filters are, and how people model them.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I would like to use a butterworth filter&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, there's plenty implementations of that out there,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I am currently using scipy's butter and lfilter&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;of which you already know one!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, a butterworth filter is a recursive thing, so to calculate the next part of your sampled signal, you'll need the last state. That's exactly the &quot;filter delay state zi&quot; that &lt;code&gt;lfilter&lt;/code&gt; returns and can take in on the next call as &lt;code&gt;zi&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;but I don't know how to use it to get a constant signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think you mean &quot;to achieve continuous filtering&quot;.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;Now, that being said, the point is that you're setting yourself up for writing your own streaming architecture. I wouldn't do that. Use an existing framework. For example, there's GNU Radio, which lets you define signal processing flow graphs in Python, and also is inherently multithreaded, uses highly optimized algorithm implementations, has a lot of in- and output facilities, and comes with a huge library of signal processing blocks, which can be written in Python or C++, if you happen to need to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a flow graph that takes in samples from a sound card, butterworth-filters them and writes them to a file is:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/env python2&#xA;# -*- coding: utf-8 -*-&#xA;##################################################&#xA;# GNU Radio Python Flow Graph&#xA;# Title: Butterworth Test&#xA;# Generated: Mon Feb  8 16:17:18 2016&#xA;##################################################&#xA;&#xA;from gnuradio import audio&#xA;from gnuradio import blocks&#xA;from gnuradio import eng_notation&#xA;from gnuradio import filter&#xA;from gnuradio import gr&#xA;from gnuradio.eng_option import eng_option&#xA;from gnuradio.filter import firdes&#xA;from optparse import OptionParser&#xA;&#xA;&#xA;class butterworth_test(gr.top_block):&#xA;&#xA;    def __init__(self):&#xA;        gr.top_block.__init__(self, &quot;Butterworth Test&quot;)&#xA;&#xA;        ##################################################&#xA;        # Variables&#xA;        ##################################################&#xA;        self.samp_rate = samp_rate = 48000&#xA;&#xA;        ##################################################&#xA;        # Blocks&#xA;        ##################################################&#xA;        # taps from scipy.butter!&#xA;        self.iir_filter_xxx_0 = filter.iir_filter_ffd(([1.0952627450621233e-05, 0.00013143152940745496, 0.0007228734117410033, 0.0024095780391366808, 0.005421550588057537, 0.008674480940892064, 0.010120227764374086, 0.008674480940892081, 0.005421550588057554, 0.0024095780391366955, 0.0007228734117410089, 0.00013143152940745594, 1.0952627450621367e-05]), ([1.0, -4.4363862740719835, 10.215121830052535, -15.374408118154847, 16.57333784740102, -13.325056987818655, 8.133543488903097, -3.77641064765334, 1.3181452681671835, -0.3361758629961047, 0.05930166356243964, -0.0064815521348275, 0.00033130678123743994]), False)&#xA;        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, &quot;&quot;, False)&#xA;        self.blocks_file_sink_0.set_unbuffered(False)&#xA;        self.audio_source_0 = audio.source(samp_rate, &quot;&quot;, True)&#xA;&#xA;        ##################################################&#xA;        # Connections&#xA;        ##################################################&#xA;        self.connect((self.audio_source_0, 0), (self.iir_filter_xxx_0, 0))    &#xA;        self.connect((self.iir_filter_xxx_0, 0), (self.blocks_file_sink_0, 0))    &#xA;&#xA;def main(top_block_cls=butterworth_test, options=None):&#xA;&#xA;    tb = top_block_cls()&#xA;    tb.start()&#xA;    try:&#xA;        raw_input('Press Enter to quit: ')&#xA;    except EOFError:&#xA;        pass&#xA;    tb.stop()&#xA;    tb.wait()&#xA;&#xA;&#xA;if __name__ == '__main__':&#xA;    main()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this code was auto-generated from a graphical flow graph that I just clicked together using the &lt;code&gt;gnuradio-companion&lt;/code&gt; program:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4h4H8.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4h4H8.png&quot; alt=&quot;flow graph as designed in GRC&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know more about how to implement signal processing flow graphs in Python, go for  &lt;a href=&quot;https://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorials&quot; rel=&quot;noreferrer&quot;&gt;the GNU Radio Guided Tutorials&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: I liked @Fat32's answer pretty much! What he describes as a double buffering architecture is pretty close to what GNU Radio does:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An upstream block produces samples in sample chunks of arbitrary sizes, writes them to the output ring buffer (which is represented as an arrow in above picture), and notifies its downstream blocks that there's new data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The downstream block gets notified, checks whether there's enough space in its output buffer to process the samples that are in his input ring buffer (which is the same as the output buffer of the upstream block), processes these. When finished, it informs the upstream block(s) that it has used up input ring buffer (which can then be reused by the upstream blocks as output), and the downstream blocks about new samples being available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, GNU Radio being multi-threaded, the upstream block might already be producing samples again; in a normal GNU Radio application, nearly all blocks are &quot;active&quot; simultaneously and things scale pretty well on multi-CPU machines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, GNU Radio's main job is to give you this buffer infrastructure, the notifying and thread housekeeping, the clear signal processing block API and something to define how everything is connected, so you don't have to write what Fat32 describes in her/his post yourself! Notice that doing sample stream marshalling isn't that easy to do properly, and GNU Radio takes the hardness out of it and lets your concentrate on what you want to do: DSP.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-02-09T08:25:16.907" LastActivityDate="2016-02-09T08:25:16.907" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28732" PostTypeId="2" ParentId="28725" CreationDate="2016-02-08T15:48:45.533" Score="2" Body="&lt;p&gt;Real-time digital auido processing under a PC platform is based on double-buffering scenarios. [Note that it may not be a perfectly real-time solution, as the general purpose PC operating systems are not tailored for real-time tasks at their core.]&lt;/p&gt;&#xA;&lt;p&gt;Sound that comes through an analog input source is first converted into digital samples via soundcard ADC, and filled into an user specified input buffer at selected audio sampling rate. When this buffer is completely filled, the soundcard controller notifies the OS, and the OS notifies back your application program so that your program can access the audio block to begin processing.&lt;/p&gt;&#xA;&lt;p&gt;While processing the current available block, your program provides another (the second) buffer, to the audio card, to be filled with new samples that arrive during the processing of the current buffer. When the currently available buffer is completely processed, the second buffer should have also been filled-up and be ready for processing, that you need to begin processing the second buffer immediately without any delays. And while processing the second bufer, the first buffer is filled in parallel for the next cycle. In this manner of double buffering, you have the chance of creating a smooth audio playback without glitches or cracks.&lt;/p&gt;&#xA;&lt;p&gt;Also, whether you will do an FIR or IIR based filtering, you can either filter the whole buffer at once like that of FIR case, or go recursively sample by sample for an IIR case.&lt;/p&gt;&#xA;&lt;p&gt;The size of the buffers is important too: for if you take it too large, you have to wait untill both buffers are filled up before outputting anything. Or if you take them too short, then the system will be overwhelmed by the incoming interrrupts. And most multi-tasking operating systems will not be able to handle such high rate of interrupts. A typical choice for the buffer size could be between 128 and 1024 samples, depending on auido sample rate.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2022-01-23T20:01:25.233" LastActivityDate="2022-01-23T20:01:25.233" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28733" PostTypeId="1" CreationDate="2016-02-08T16:03:00.213" Score="1" ViewCount="592" Body="&lt;p&gt;I want to estimate depth from live video stream with two calibrated webcams in matlab but has no results. In &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/depth-estimation-from-stereo-video.html&quot; rel=&quot;nofollow&quot;&gt;this post&lt;/a&gt; depth is estimated with two recorded video files. how can I estimate depth in live video stream?&lt;/p&gt;&#xA;" OwnerUserId="19461" LastEditorUserId="53" LastEditDate="2016-02-08T18:45:34.460" LastActivityDate="2017-07-04T04:08:52.583" Title="Depth estimation from live video stream in matlab" Tags="|image-processing|matlab|video-processing|matlab-cvst|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28734" PostTypeId="2" ParentId="28728" CreationDate="2016-02-08T16:11:06.763" Score="5" Body="&lt;p&gt;I found the following in Charles Therrien's &quot;Discrete Random Signals and Statistical Signal Processing&quot; in one of the Appendicies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have the function $Q(a)$ you wish to minimize such that $C(a)=0$, where $C(a)$ may be complex valued and $a$ may be a complex vector. The constraint really represents two real-valued constraints.&#xA;$$C_r(a)=0,\qquad &#xA;C_i(a)=0,&#xA;$$&#xA;where $C_r(a)$ and $C_i(a)$ represent the real and imaginary components. The Lagrangian can be written as:&#xA;$$\mathcal{L}=Q(a) +\mu_1C_r(a)+\mu_2C_i(a),&#xA;$$&#xA;where $\mu_1$ and $\mu_2$ are real valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can also be written more compactly using a single complex parameter $\lambda=\lambda_r+j\lambda_i$ as&#xA;$$\mathcal{L}=Q(a) +\lambda C(a)+\lambda ^*C^*(a)&#xA;$$&#xA;where $\lambda^*$  and $C^*(a)$ denote the complex conjugate of the quantities. The reason for this is that&#xA;$$&#xA;\lambda C(a)+\lambda ^*C^*(a)=2Re[\lambda C(a)]=2\lambda_rC_r(a)-2\lambda_iC_i(a)&#xA;$$&#xA;and letting $\mu_1=2\lambda_r$ and $\mu_2=-2\lambda_i$, then the two Lagrangians  are seen to be equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note - to apply the gradient to a real valued function with respect to a complex parameter you should also be familiar with Brandwood &quot;A complex gradient operator and its application in adaptive array theory&quot; IEE Proceedings 130(1) 11-16, Feb, 1983. This essentially treats the variables $a$ and $a^*$ as two separate variables and you only have to take the derivative wrt to one of them to perform a minimization. &lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2016-02-08T16:24:22.813" LastActivityDate="2016-02-08T16:24:22.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28735" PostTypeId="1" AcceptedAnswerId="28745" CreationDate="2016-02-08T16:39:39.000" Score="0" ViewCount="915" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Let $x_c(t)=\cos(\omega_0t)$. This signal is sampled with $\omega_s$, which is greater than the Nyquist rate. It is then interpolated with a zero-order interpolator. The signal obtained is $y_c(t)$. What should be the relationship between $\omega_0$ and $\omega_s$ so that $y_c(t)$ is periodic? Also, find the relationship between the amplitudes of the first two non-zero Fourier coefficients of $y_c(t)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I guess that, for $y_c(t)$ being periodic, $Y(j\omega )$ should consist of just deltas. The problem is that I don't see how this could happen. Mathematically,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_p(j\omega)=\frac{\omega_s}{2}\sum\limits_{k=-\infty}^\infty [\delta(\omega -k\omega_s- \omega_0)+\delta(\omega -k\omega_s+ \omega_0)]$$&#xA;$$H_0(j\omega )=\frac{2\pi}{\omega_s}\text{sinc}\left(\frac{\omega}{\omega_s}\right)e^{-j\frac{\pi\omega}{\omega_s}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $x_p(t)$ being the sampled signal and $h_0(t)$ the impulse response of the interpolator. So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y_c(j\omega)=X_p(j\omega)\cdot H_0(j\omega )$$&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="4298" LastEditDate="2023-03-16T12:56:02.477" LastActivityDate="2023-03-16T12:56:02.477" Title="Zero-order interpolation problem" Tags="|fourier-transform|sampling|interpolation|zoh|dirac-delta-impulse|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28736" PostTypeId="1" AcceptedAnswerId="28737" CreationDate="2016-02-08T16:57:40.103" Score="0" ViewCount="278" Body="&lt;p&gt;I am trying to understand pre-emphasis equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n]=x[n]-\alpha x[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\alpha = 0.95$. &#xA;My question is what does it mean if $\alpha = 1$?&lt;/p&gt;&#xA;" OwnerUserId="18275" LastEditorUserId="8202" LastEditDate="2016-02-08T18:01:00.627" LastActivityDate="2016-02-08T18:01:00.627" Title="What does pre-emphasis $\alpha=1$ will do to a signal?" Tags="|noise|frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28737" PostTypeId="2" ParentId="28736" CreationDate="2016-02-08T17:28:42.690" Score="3" Body="&lt;p&gt;The pre-emphasis filter is a simple high-pass filter with a monotonically increasing magnitude of its frequency response $H(\omega)$. Its value at DC is $H(0)=1-\alpha$, and its value at Nyquist (i.e., the maximum frequency) is $H(\pi)=1+\alpha$. Consequently, for $\alpha=1$ you get a zero at DC, which means that the filter will totally suppress a constant input signal (which is obvious from looking at the difference equation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a pre-emphasis with $\alpha=1$ cannot be compensated for because the DC component is lost and can't be recovered. In signal processing terms: there is no stable inverse filter.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-08T17:28:42.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28739" PostTypeId="2" ParentId="28733" CreationDate="2016-02-08T18:48:32.617" Score="0" Body="&lt;p&gt;You can capture the video from webcams using the &lt;a href=&quot;http://www.mathworks.com/help/supportpkg/usbwebcams/ug/installing-the-webcams-support-package.html&quot; rel=&quot;nofollow&quot;&gt;Webcam Support Package&lt;/a&gt;. Alternatively, you can use the &lt;a href=&quot;http://www.mathworks.com/products/imaq/&quot; rel=&quot;nofollow&quot;&gt;Image Acquisition Toolobx&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2016-02-08T18:48:32.617" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28740" PostTypeId="2" ParentId="28735" CreationDate="2016-02-08T19:07:12.640" Score="2" Body="&lt;p&gt;You're thinking too complicated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a digital signal to be periodic, it simply has to repeat every $P\in\mathbb N$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you have a continuous signal which is $\frac{2\pi}{\omega_0}$-periodic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, if a period happens to be exactly &quot;worth&quot; a natural number $N\in\mathbb N$ sample times, the resulting sample from sampling it will repeat with a period of $N$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, if $M\in\mathbb N$ periods of the continuous signal are as long as $N$ sampling times, the digital signal will also be periodic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as a general rule, one period of the input signal must be worth $\frac{N}{M}$ sampling times, or:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;\frac{2\pi}{\omega_0} &amp;amp;\overset != \frac NM \frac {1}{f_\text{sampl}}&amp;amp;\quad N,M\in \mathbb N\\&#xA;&amp;amp;= R\frac {1}{f_\text{sampl}} &amp;amp;\quad R\in \mathbb Q\text,\\&#xA;\text{which means that}\\&#xA;\frac{f_\text{sample}}{\omega_0} &amp;amp;= \frac {R}{2\pi}\text;\\&#xA;\text{with}\\&#xA;f_{sample}&amp;amp;=\frac{\omega_s}{2\pi}\\&#xA;\text{it follows that}\\&#xA;\frac{\omega_s}{\omega_0} &amp;amp;= R\text,&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. the relationship between signal frequency and sampling rate needs to be rational.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that you have a zero-order interpolator afterwards doesn't change this consideration -- the interpolator's output will be periodic &lt;em&gt;iff&lt;/em&gt; its input is.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-02-08T20:51:27.030" LastActivityDate="2016-02-08T20:51:27.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28741" PostTypeId="2" ParentId="28623" CreationDate="2016-02-08T19:14:37.203" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;so that $y[n]$ in the second diagram (the one on the right) is exactly the same as $x[n]$ in the first diagram (the one on the left).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Considering that $H_{c1}$ is per your very own definition $\ne H_{c2}$ means that without restricting your system's input $r_c$, there's nothing you can do. You will have to implement a filter with transfer function $H_{c1}$ if you need a system with transfer function  $H_{c1}$; there's no way around that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now,  $H_{c1}$ being impossible with finitely long filters (as it is infinitely sharp in frequency domain), this is impossible.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-08T19:14:37.203" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28742" PostTypeId="1" AcceptedAnswerId="28749" CreationDate="2016-02-08T19:21:33.970" Score="6" ViewCount="523" Body="&lt;p&gt;I want to compute the following derivative with respect to $n\times1$ vector $\mathbf x$. &#xA;$$g = \left\lVert \mathbf x - A \mathbf x  \right\rVert_1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g = \left\lVert \mathbf x - A \mathbf x  \right\rVert_1  = \sum_{i=1}^{n} \lvert x_i - (A\mathbf x)_i\rvert = \sum_{i=1}^{n} \lvert x_i - A_i \cdot \mathbf x \rvert = \sum_{i=1}^{n} \lvert x_i - \sum_{j=1}^n a_{ij} x_j\rvert$$ &#xA;So the $k$th element of derivative is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\partial g}{\partial x_k} = \frac{\partial }{\partial x_k}\sum_{i=1}^n \lvert x_i - \sum_{j=1}^n a_{ij} x_j\rvert $$&#xA;$$= \frac{\partial }{\partial x_k}\bigg(\lvert x_1 - \sum_{j=1}^n a_{1j} x_j\rvert +\cdots+ \lvert x_k - \sum_{j=1}^n a_{kj} x_j\rvert + \cdots\lvert x_n - \sum_{j=1}^n a_{nj} x_j\rvert  \bigg)$$&#xA;$$ =-a_{1k}sign(x_1 - \sum_{j=1}^n a_{1j} x_j)-\cdots+(1-a_{kk})sign(x_k - \sum_{j=1}^n a_{kj} x_j)-\cdots -a_{nk}sign(x_n - \sum_{j=1}^n a_{nj} x_j)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And my questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this derivation correct?&lt;/li&gt;&#xA;&lt;li&gt;How I can represent the answer compactly?&lt;/li&gt;&#xA;&lt;li&gt;Can you introduce me a source to master this material? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="17059" LastEditorUserId="13320" LastEditDate="2016-11-13T13:46:59.750" LastActivityDate="2016-11-13T13:46:59.750" Title="Derivative of $l_1$ norm" Tags="|gradient|norm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28743" PostTypeId="1" CreationDate="2016-02-08T20:06:58.010" Score="0" ViewCount="793" Body="&lt;p&gt;I am working on a project which intends to use Time Difference of Arrival (TDoA) for localization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, my understanding is that a matched filter is the most common method for estimating signal-delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get performance metrics for TDoA, I need the variance of the time-delay estimate. Thus, what I'm looking for is a way to calculate the variance in the signal-delay estimate using a matched filter as an estimator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like it would be a very common problem; however, I have consulted three books and searched online, and I have not found anything which addresses this issue.&lt;/p&gt;&#xA;" OwnerUserId="15784" LastEditorUserId="1212" LastEditDate="2016-02-08T22:25:32.877" LastActivityDate="2022-08-06T12:23:48.010" Title="Cross-Correlation Signal Delay Estimation Variance" Tags="|estimation|matched-filter|localization|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28744" PostTypeId="1" CreationDate="2016-02-08T20:13:19.307" Score="2" ViewCount="105" Body="&lt;p&gt;At work we run a physics simulator (video game) that operates in an inner loop at 360 Hz.  Data from that inner loop is collected 60 times a second and sent out to hardware (a force feedback steering wheel) in order for playback to the user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions on this system.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First what is the best way to decimate the 360 Hz data down to 60 Hz.  Right now we do a straight average of 6 samples together, but I suspect that this is causing some aliasing of the data and we are very sensitive to high frequency noise.  We are also extremely sensitive to latency and even adding in 4 samples of latency (in the 60 Hz loop) would cause a noticeable delay between the onscreen display and the force feedback device that the users would pick up on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the hardware (steering wheels) is typically made to very poor tolerances and usually has a difficult time playing back data above about 20 Hz before the signal significantly degrades.  Would it be better to low pass filter the 360 Hz data down to 20 Hz, or to low pass the 60 Hz data to 20 Hz, and what would be the most efficient way to handle this.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a single pole IIR filter that you can optionally define on the 60 Hz signal, this does smooth the data out, and adds in a considerable amount of latency as well.  Mixing less than 0.20 of the current sample causes an odd disconnected feeling in the wheel so that is my lower bound.  I would assume that going to a more complex filter would give me a much faster falloff and would both smooth out the high frequency chatter and noise in the wheel without increasing the latency beyond 4 samples (66 ms)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm half way through Steven W. Smiths book &quot;The Scientists and Engineer's Guide to Digital Signal Processing&quot; so I have a limited understanding of DSP's.  I do have 20+ years of programming experience in 2D image manipulation so I have been using dsp's all along without knowing what they were.  The point is go easy on my poor mind :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also point out that the 60 Hz loop is running in 'real time' that is timed to the pc clock, and all communication with the wheel is also in real time, however the inner loop is processed 60 times a second and there is no way to get access to the inner loop data at a faster rate than 60 Hz.&lt;/p&gt;&#xA;" OwnerUserId="19467" LastActivityDate="2016-02-09T02:12:52.723" Title="Decimating physics data" Tags="|infinite-impulse-response|decimation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28745" PostTypeId="2" ParentId="28735" CreationDate="2016-02-08T20:40:43.510" Score="2" Body="&lt;p&gt;I'd like to clear up some confusion in your question. First you state that for $y_c(t)$ to be periodic, its Fourier transform should consist only of Dirac delta impulses. That's not true, at least it's not sufficient. As an example, take a signal with Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(j\omega)=\delta(\omega -1)+\delta(\omega - \sqrt{2})\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding signal is not periodic even though its spectrum only consists of Dirac delta impulses. The reason is that the discrete frequency contributions of a periodic signal must be at integer multiples of the fundamental frequency, which is not the case for the spectrum given in $(2)$. So it's important to realize that a discrete spectrum is only necessary but not sufficient for periodicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second confusion is that you don't see how $Y_c(j\omega)$ can only consist of Dirac impulses. Note that for any function $H(j\omega)$ (which is continuous at $\omega=\omega_0$), we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(j\omega)\delta(\omega-\omega_0)=H(j\omega_0)\delta(\omega-\omega_0)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So no matter which form $H_0(j\omega)$ takes, $Y_c(j\omega)$ will &lt;em&gt;always&lt;/em&gt; be an infinite sum of Dirac impulses, where the weight of each impulse is determined by the value of $H_0(j\omega)$ at the respective frequency. So the question is not whether $Y_c(j\omega)$ is a sum of weighted Dirac impulses (it always is!), but whether this sum of Dirac impulses corresponds to a periodic signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it is only about the relation of the frequencies of the Dirac impulses, not about their weights, which are determined by $H_0(j\omega)$. So for the determination of periodicity, $H_0(j\omega)$ is irrelevant, as already pointed out in Marcus Müller's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you already know that the ratio $\omega_s/\omega_0$ must be rational for the sampled signal to be periodic, let me show you how to obtain the ratio of the amplitudes of the first two non-zero Fourier coefficients of $y_c(t)$. Since $\omega_s&amp;gt;2\omega_0$, the first frequency component of $y_c(t)$ is at $\omega_0$, and the second one is at $\omega_s-\omega_0$. As mentioned before, the weights of the Dirac impulses are given by $H_0(j\omega)$ evaluated at the respective frequencies. So the amplitude ratio of the first and second Fourier coefficient is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{H(j\omega_0)}{H(j(\omega_s-\omega_0))}=\frac{\text{sinc}(\frac{\omega_0}{\omega_s})}{\text{sinc}(\frac{\omega_s-\omega_0}{\omega_s})}=\frac{\sin(\pi\frac{\omega_0}{\omega_s})}{\pi\frac{\omega_0}{\omega_s}}\frac{\pi(1-\frac{\omega_0}{\omega_s})}{\sin(\pi(1-\frac{\omega_0}{\omega_s}))}=\frac{\omega_s}{\omega_0}-1\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because $\sin(\pi-x)=\sin(x)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-08T20:40:43.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28748" PostTypeId="2" ParentId="28743" CreationDate="2016-02-08T21:27:13.187" Score="1" Body="&lt;p&gt;One warning first: this is going to be a bit literature-heavy, because I think that's what you're more or less explicitly ask for. You want something that you can read, understand and cite for your publication.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Firstly, my understanding is that a matched filter is the most common method for estimating signal-delay.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;No. A matched filter can be used to effectively correlate a receive signal against a transmit signal shape. It's can but be a puzzle piece in a TDOA system.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Thus, what I'm looking for is how to calculate the variance in the signal-delay estimate using a matched filter as an estimator.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Again, the matched filter is not the delay estimator; think of it as a signal preconditioner!&lt;/p&gt;&#xA;&lt;p&gt;Now, what you &lt;em&gt;probably mean&lt;/em&gt; is that you use matched filters for the TX pulse shape and the RX pulse shape filter, and then, based on the post-filter signal, do a delay estimate.&lt;/p&gt;&#xA;&lt;p&gt;I'd like to cite a paper,[1] :&lt;/p&gt;&#xA;&lt;p&gt;which doesn't actually deal with matched filtering directly, as the TDoA system isn't able to define the pulse shape the transmitter uses; instead, it's about cross-correlation of the received signals at different positions.&lt;/p&gt;&#xA;&lt;p&gt;The interesting point is that the defining entity (aside from the obvious &lt;span class=&quot;math-container&quot;&gt;$\frac{c}{f_\text{Nyquist}}$&lt;/span&gt; limit) is the SNR of the received signal -- that's pretty obvious, if you think about it: The &amp;quot;certainty&amp;quot; with which the correlation of RX and TX signal has a maximum at the &amp;quot;right&amp;quot; position is reduced with increased SNR.&lt;/p&gt;&#xA;&lt;p&gt;In previous work of the author, she uses in [2] that with AWGN assumption and cross-correlation (i.e. matched filter with a known TX signal)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}&#xA;\sigma^2_{\hat\tau}&amp;amp;=\frac{3}{8\pi^2}\,\frac{1+2\, \text{SNR}}{\text{SNR}^2}\, \frac {1}{T_o B^3}\text,\,\text{with}\\&#xA;\sigma^2_{\hat\tau}&amp;amp;: \text{Variance of the timing estimate}\\&#xA;T_o&amp;amp;: \text{Duration of observation, and}\\&#xA;B&amp;amp;: \text{bandwidth of the system.}&#xA;\end{align*}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Interesting here, aside from the &lt;span class=&quot;math-container&quot;&gt;$B^{-3}$&lt;/span&gt; relationship of variance and bandwidth, is the cited paper (if you find it in full text available online for free; I have IEEExplore access, but I don't know about you...) [9], which pretty much should give you plenty of background to work with.&lt;/p&gt;&#xA;&lt;p&gt;[1]Noha El Gemayel, Holger Jäkel, Friedrich K. Jondral: &lt;a href=&quot;https://www.cel.kit.edu/download/ElGemayel_PLANS_2014.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Error Analysis of a Low Cost TDoA Sensor Network&lt;/em&gt;&lt;/a&gt;, IEEE/ION Position, Location and Navigation Symposium 2014, Monterey, CA, USA, May 5-8, 2014&lt;/p&gt;&#xA;&lt;p&gt;[2]Noha El Gemayel, Sebastian Koslowski, Friedrich K. Jondral:&#xA;&lt;a href=&quot;https://www.cel.kit.edu/download/WPNC_2013.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;A low cost TDOA Localization System: Setup, Challenges and Results&lt;/em&gt;,&#xA;&lt;/a&gt;,&#xA;10th Workshop on Positioning, Navigation and Communication 2013 (WPNC'13), Dresden, Germany, March 20-21, 2013&lt;/p&gt;&#xA;&lt;p&gt;[9] G. Carter, &lt;a href=&quot;https://ieeexplore.ieee.org/document/1457990&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Coherence and time delay estimation&lt;/em&gt;&lt;/a&gt;, Proceedings of the&#xA;IEEE, vol. 75, no. 2, pp. 236 – 255, Feb. 1987&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="7092" LastEditDate="2022-08-06T12:23:48.010" LastActivityDate="2022-08-06T12:23:48.010" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28749" PostTypeId="2" ParentId="28742" CreationDate="2016-02-08T21:32:02.710" Score="6" Body="&lt;p&gt;Apart from a sign error, your result looks correct. The term with $(1-a_{1k})$ should have a positive sign. Also note that $\text{sgn}(x)$ as the derivative of $|x|$ is of course only valid for $x\neq 0$. If you take this into account, you can write the derivative in vector/matrix notation if you define $\text{sgn}(\mathbf{a})$ to be a vector with elements $\text{sgn}(a_i)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\nabla g=(\mathbf{I}-\mathbf{A}^T)\text{sgn}(\mathbf{x}-\mathbf{Ax})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{I}$ is the $n\times n$ identity matrix.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-09T20:39:23.653" LastActivityDate="2016-02-09T20:39:23.653" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28750" PostTypeId="1" AcceptedAnswerId="28751" CreationDate="2016-02-08T21:36:42.597" Score="2" ViewCount="16252" Body="&lt;p&gt;I just learned following notation for a sine wave:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A e^{j\phi t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A low passfilter and a highpass filter respectively generate a phase shift in the complex plane of the sine wave as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A e^{-j\phi t}$ and $A e^{+j\phi t}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand what phase shifting has to do with letting higher or lower frequencies intact... How do these things( filtering and phase shifting) relate to each other? They just seem like to completely and independent things to me&lt;/p&gt;&#xA;" OwnerUserId="19209" LastActivityDate="2018-04-28T18:53:51.443" Title="why do low pass and high pass filters generate a phase shift?" Tags="|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28751" PostTypeId="2" ParentId="28750" CreationDate="2016-02-08T21:48:42.640" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I just learned following notation for a sine wave: $Ae^{j\phi t}$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;well, that's not really a sine wave; that's a complex sinusoid. The real and imaginary parts of that are cosine and sine, respectively.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A low passfilter and a highpass filter respectively generate a phase shift in the complex plane of the sine wave as follows:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. There's all kind of LPFs and HPFs, and only the linear phase ones do what you claim.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is that (although you're basically asking us to write a textbook on filter and signal theory) you'd typically understand filters as systems with poles and zeros, as the transfer function of LTI (linear, time-invariant) systems can usually be written as fraction with polynomials (which have roots).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to find something that actually fulfills the boundaries these representations set, your system needs to move its response in relation to frequency over the complex plane; &quot;moving over the complex plane&quot; is something that can be understood as changing a complex number over a variable; the rate of change of the argument of that number is a phase shift.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be shown (and you'll probably learn this later on) that you cannot change the magnitude of a signal over frequency (i.e. do the filtering) without changing it's argument.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-08T21:48:42.640" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28752" PostTypeId="1" AcceptedAnswerId="28766" CreationDate="2016-02-08T23:32:25.540" Score="0" ViewCount="104" Body="&lt;p&gt;If a have a causal IIR filter described by $H(z)$ and I sample it in $N$ equispaced values around the unit circle, I get a DFT of $N$ points. That DFT corresponds to $h[n]$ truncated in $n=N-1$ or to the DFT of $h[n]$ periodized with period $N$ (i.e. with copies of itself overlapped every $N$ points)?&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="4298" LastEditDate="2016-02-09T10:02:59.117" LastActivityDate="2016-02-09T12:47:42.723" Title="IDFT of H(z) sampled in N values" Tags="|filters|sampling|dft|infinite-impulse-response|z-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28753" PostTypeId="1" CreationDate="2016-02-09T00:52:46.510" Score="1" ViewCount="356" Body="&lt;p&gt;Background: I do time-dependent simulations of physical systems. Like this: &lt;a href=&quot;http://journals.aps.org/prb/abstract/10.1103/PhysRevB.91.115431&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://journals.aps.org/prb/abstract/10.1103/PhysRevB.91.115431&lt;/a&gt; During the simulation, observables are recorded and later Fourier (usually sin-transformed) transformed to analyse things like absortion of a nanoparticle. The problem is that the system is huge in and all time steps cannot be stored to hard disk. But maybe I could save every 10th or 20th iteration to hard disk. This quantity is the density matrix. But for this questions purpose, each element of this matrix are to be filtered independently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prevent folding, one needs to low-pass filter the signal. Our analysis methods are extremely sensitive to phase, if the signal is sin, it needs to remain that way. Phase deviation (mixing of cos) will ruin the analysis. Then the filter has to have a zero delay (but it can access future data to some extent). Then it has to filter sharply before Nyquist frequency to prevent folding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I played with matlab a year ago a bit, but was unable to produce such a filter. I have very litle experience with DSP, so I am therefore asking for suggestions. Is such a filter possible, what I require? To what extent one has to give up on the requirements? IIR or FIR? How to generate the filter coefficients? How long does the filter have to be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say the data is 10Hz, can I get a linear phase response with no delay up to 0.4Hz, if I resample a low-pass filtered signal at 1Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was also thinking that if this is not possible, perhaps one could send the preliminary filtered and presampled data through a &quot;correction&quot; filter to reconstruct the data at 10Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In reality, the signal is $10^{15}$ Hz)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I tried to create symmetric FIR low-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%symmetric FIR low-pass filter&#xA;N=200&#xA;M = N/2;&#xA;n=0:N;&#xA;wc=0.02 * 2 * pi;&#xA;h = sin(wc*(n-M)) ./ (pi*(n-M));&#xA;h(M+1) = wc/pi;&#xA;new_signal = conv(signal, h,'full');&#xA;plot(signal,'b-');&#xA;hold on&#xA;plot(new_signal,'r-');&#xA;% Resample&#xA;time=(0:(prod(size(new_signal))-1))*dt - M*dt;&#xA;time=time(1:10:end)';&#xA;new_signal = new_signal(1:10:end);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the figure below with bold red, is a quantity calculated from the original signal. It has a frequency content till about 80 (eV, but unit is irrelevant). It has a characteristic feature that it is always positive. If I just resample the signal 10:1 without any filtering, I get the green curve. It has terrible folding effects, but it is actually not that bad. With blue is my first attempt of a symmetric filter, but I used conv(...,'same') so I basically tossed away the beginning of the signal. This resulted into some unwanted phase effects (negative values close to zero frequency). In purple curve, I keep the acausal part of the signal, and this resolves that issue (the conv(...,'full', and -M*dt parts of my script). One has also clearly a low-pass filter effect near frequency 10. Cyan curve the same thing, but only with 20 coefficient FIR filter, and that does not seem to work at all.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lXO4n.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lXO4n.png&quot; alt=&quot;Figure 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second figure one sees that basically all the filters cause unwanted negative signals close to zero frequency. So I have not yet found the filter I am looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, none of the filters produce well the amplitude of the 'plasmon' peak at 4eV.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/beGjD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/beGjD.png&quot; alt=&quot;Figure 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="19471" LastEditorUserId="19471" LastEditDate="2016-02-09T11:44:22.423" LastActivityDate="2016-02-09T11:44:22.423" Title="Which method to choose to get linear phase response zero group delay low-pass filter?" Tags="|filter-design|lowpass-filter|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28754" PostTypeId="2" ParentId="28744" CreationDate="2016-02-09T01:04:18.297" Score="2" Body="&lt;p&gt;This is a really very nice applied signal processing question. Unfortunately your lack of DSP and physics expertise, builds some barriers on the way of your understanding. Hopefully this answer helps to tunnel through.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, your first question is about downsampling a discrete time signal. In fact there are already plenty of such questions here under the title of interpolators, downsampling etc. These are already answered with great detail. You better make a search on the site for more detailed answers but here once more I'll give a brief reply. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In downsampling a discrete-time signal (say from 360 hz to 60 hz in your case, by a facttor 6) the most critical thing to consider is the Spectral Utilisation of the original (360 Hz) signal. Based on Shannon-Nyquist sampling theorem criteria, this signal is assumed to contain meaningful (non-trivial) information in the band of frequencies 0 to 180 hz. However for many applications the frequency band of interest within the say 0-180 hz range will be a much smaller band, say for example from 0-20 hz. In such a case, the original signal is said to be &quot;oversampled&quot; (by a factor of 9 in this case). When a signal is oversampled by a factor of say M, then it is somewhat acceptable to discard every (M-1) samples and use the Mth one to represent the information content of the original signal without loss (except at the higher end of the band which gets to limit of aliasing). But this will/may produce some noise due to aliasing being on the very edge of it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There won't be any aliasing, as long as the out-of-interest frequency band in the original signal contains no energy. In order to guarantee this condition of zero energy in the out of interest band, it is required to filter out those out of interest bands by a suitable filter of sufficient quality, before decimating the signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quality of such a filter depends on, therefore, i-the spectral distribution of the original signal, ii-band of interest, iii-downsampling factor and other requirements such as real time processing or offline, accuracy, CPU power etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the answer lies in the following: the best downsampler should produce the most accurate representation of the band of interest signals and reject any irrelevant information for your steering hardware to process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The short answer is this: as long as your system is configured to use 60 hz information (30 hz band) for the force-feedback processing, it seems that (and from my experience with mechanical acceleration signals, it is indeed so) this band of signals is adequate to represent average mechanical control. (as long as I can remember, most mechanical acceleration sensors do use at most a band of a few hundred hz). So just use a simple low-pass filter of cutoff frequency at pi/6 for better performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second questions simply asks which is better to choose i-filtering 360hz into 20hz or ii-60 hz into 20 hz. The answer is the latter. It will be a much shorter filter to apply, and the transition band would also be easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the latency of a few samples becomes so critical as in your example of real time forced-feedback control of a physical simulator, then high accuracy filters becomes impractical to use. May be you should completely discard using any filters at all, as you have pointed out the physical limitations of the wheel mechanics already prevents bulding of responses faster than 20 hz... &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-02-09T02:12:52.723" LastActivityDate="2016-02-09T02:12:52.723" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28755" PostTypeId="1" CreationDate="2016-02-09T01:14:43.160" Score="0" ViewCount="108" Body="&lt;p&gt;I am studying DAPSK(Differential amplitude phase shift keying) at the moment. I have a 64-DAPSK. We are using 4 concentric rings and 6 bits per symbol. The first two bits contain the information of amplitude difference and the rest contain the information of the phase difference. I am having trouble understanding how the table on the bottom left of this example is filled out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[&lt;img src=&quot;https://i.stack.imgur.com/AJReX.png&quot; alt=&quot;&quot;&gt;]&lt;/p&gt;&#xA;" OwnerUserId="18217" LastEditorUserId="11256" LastEditDate="2016-02-10T23:02:11.807" LastActivityDate="2016-09-08T02:07:50.553" Title="DAPSK bit assignment for the amplitude difference" Tags="|phase|amplitude|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28756" PostTypeId="2" ParentId="28755" CreationDate="2016-02-09T02:17:00.567" Score="1" Body="&lt;p&gt;Each circle is identified by its amplitude, either 1, $a$, $a^2$, or $a^3$. The table shows the &quot;amplitude transition factor&quot;; that is, you need to multiply the previous amplitude by this factor to find the next amplitude. In other words, it is not the amplitude difference that is encoded, but the amplitude ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's follow the example above the table. You start with $d_{n-1}$ with amplitude $a^3$. The next symbol, $d_n$, has amplitude 1, so the factor is $1/a^3$, which corresponds to bits $01$ (indicated also as the first two bits under &quot;info bits&quot; in the figure, top right).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, $d_n$ has amplitude 1 and the next symbol, $d_{n+1}$, has amplitude $a^2$. The factor is $a^2$ and the corresponding bit sequence is $11$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how the table is designed to allow transitions from any of the four amplitudes to any other amplitude.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-02-09T02:17:00.567" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28757" PostTypeId="1" CreationDate="2016-02-09T08:07:18.900" Score="0" ViewCount="521" Body="&lt;p&gt;We're learning about convolution in my signals and systems class right now. I have been able to do all of the problems by simply working out the respective sum/integral, but I'm still having trouble gaining the intuition behind it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following example. Let $x[n]$ be a discrete-time signal and input it into some LTI system with impulse response $h[n]$. Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = \sum_{k=-\infty}^{\infty} x[k] h[n-k].&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's plug in some values to make this more concrete. Suppose that we want to compute $y[6]$. Well,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[6] = \sum_{k=-\infty}^{\infty} x[k] h[6-k] = \cdots + x[4]h[2] + x[5]h[1] + x[6]h[0] + x[7]h[-1] + \cdots.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the shifting, but I feel as if the multiplications should be in a different order. Namely, why are we multiplying $x[7]$ by $h[-1]$. I feel as if we should be multiplying it by $h[1]$, since we've essentially shifted everything to the right by $6$ units, to $6$ is the new $0$, which would mean that $7$ is the new $1$ (under the shifting). I have it backwards, and understand why when I work out the math, but why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More concretely, my question is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;With respect to the above example, what exactly is the meaning of $h[2]$? $h[-1]$? $h[k]$ in general?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="19474" LastActivityDate="2016-02-09T09:20:40.787" Title="Intuition behind impulse response terms in convolution" Tags="|convolution|linear-systems|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28758" PostTypeId="2" ParentId="28757" CreationDate="2016-02-09T08:16:14.753" Score="1" Body="&lt;p&gt;Consider if you had a polynomial with coefficients $x[n]$, i.e. $\sum_n x[n]z^n$, and a polynomial with coefficients $h[n]$ and you multiplied them together... what would the coefficients of the result be?&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-02-09T08:16:14.753" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28760" PostTypeId="2" ParentId="28757" CreationDate="2016-02-09T09:20:40.787" Score="2" Body="&lt;p&gt;The coefficient $h[n]$ is the value of the system's response at time $n$ when the input signal was an impulse at $n=0$. Obviously, that's why we call $h[n]$ the impulse response. From this you can see that for a system to be causal, $h[n]$ must be zero for $n&amp;lt;0$, otherwise the system would &quot;know&quot; in advance that an impulse will come at $n=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that any discrete-time signal $x[n]$ can be written as a sum of unit impulses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\sum_{k=-\infty}^{\infty}x[k]\delta[n-k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the response to a shifted impulse $\delta[n-k]$ is $h[n-k]$, and since the system is linear and time-invariant, from $(1)$ the output signal must be given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=-\infty}^{\infty}x[k]h[n-k]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is of course the discrete-time convolution. Consequently, positive indices of $h[n]$ correspond to the memory of the system, that's why $h[1]$ is multiplied with the past input sample $x[n-1]$, etc.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-09T09:20:40.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28763" PostTypeId="1" AcceptedAnswerId="28854" CreationDate="2016-02-09T09:55:36.373" Score="4" ViewCount="1887" Body="&lt;p&gt;I am trying to understand how convolution and deconvolution can be represented for 3D images/ stacks of data. I would prefer it, if you built the these concepts from 1D vectors to 3D matrices in terms of their equations. I am currently writing a report and am trying to represent 3D deconvolution as an equation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please do not hesitate to ask me any questions to clarify this question. &lt;/p&gt;&#xA;" OwnerUserId="18501" LastEditorUserId="128" LastEditDate="2019-11-28T06:42:08.093" LastActivityDate="2019-11-28T06:42:08.093" Title="How Can Convolution and Deconvolution be Defined for 3D Images?" Tags="|image-processing|convolution|deconvolution|3d|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="28766" PostTypeId="2" ParentId="28752" CreationDate="2016-02-09T12:47:42.723" Score="1" Body="&lt;p&gt;The fact that sampling in one domain corresponds to aliasing in the other domain is an important property of the Fourier transform. Of course, this can also be shown formally. If $X[k]$ is the length $N$ DFT of $x[n]$, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, $H(z)$ is related to the impulse response by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\sum_{m=-\infty}^{\infty}h[m]z^{-m}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we define&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=H(e^{j2\pi k/N})=\sum_{m=-\infty}^{\infty}h[m]e^{-j2\pi mk/N}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can determine $x[n]$ as follows. From $(1)$ and $(3)$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}x[n]&amp;amp;=\frac{1}{N}\sum_{k=0}^{N-1}\sum_{m=-\infty}^{\infty}h[m]e^{-j2\pi mk/N}e^{j2\pi nk/N}\\&amp;amp;=\frac{1}{N}\sum_{m=-\infty}^{\infty}h[m]\sum_{k=0}^{N-1}e^{j2\pi(n-m)k/N}\tag{4}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last sum in $(4)$ equals $N$ for $n-m=lN$ for integer $l$, and zero otherwise. Consequently, this last sum can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{k=0}^{N-1}e^{j2\pi(n-m)k/N}=N\sum_{l=-\infty}^{\infty}\delta[n-m-lN]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $(4)$ becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}x[n]&amp;amp;=\sum_{m=-\infty}^{\infty}h[m]\sum_{l=-\infty}^{\infty}\delta[n-m-lN]\\&amp;amp;=\sum_{l=-\infty}^{\infty}\sum_{m=-\infty}^{\infty}h[m]\delta[n-m-lN]\\&amp;amp;=\sum_{l=-\infty}^{\infty}h[n-lN]\tag{5}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I've used the fact that the sum over $m$ is the convolution of $h[n]$ with $\delta[n-lN]$, and consequently equals $h[n-lN]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eq. $(5)$ establishes the result that the IDFT of an equidistantly sampled discrete-time Fourier transform (DTFT) equals an aliased version of the sequence corresponding to the given DTFT.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-09T12:47:42.723" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28767" PostTypeId="2" ParentId="28721" CreationDate="2016-02-09T13:30:40.120" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In downsampling you will throw away samples, so if you have a signal&#xA;of X samples, you'll end up with a signal of X/R samples where R is&#xA;the downsampling factor. If you do the FFT of the whole signal then&#xA;you'll see that the energy is lower now of course, where you don't have as many samples. However the&#xA;average energy is constant in this case, where you didn't alter the&#xA;signal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For upsampling, you will add zeros between samples, so the total&#xA;    energy will stay constant no matter what the upsampling rate is.&#xA;    However the average energy is lower in this case where you added&#xA;    samples without energy (the zeros).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You would use an anti-imaging filter with gain after you do&#xA;    upsampling. Since this filter will interpolate the values of all the&#xA;    samples, hence if you used a filter without gain, think of it as you'll be taking&#xA;    energy from the original samples so you put it in the interpolated&#xA;    zero samples when you're smoothing the signal and removing the images of&#xA;    the frequency spectrum created by upsampling (i.e: if you upsample an    audio track and do an anti-imaging filtering without gain, the result track will have a lower volume (actually the same volume without filtering too), you want the same average energy to have the same volume, so you want a filter with gain to give energy to the added zeros). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the anti-aliasing&#xA;   filter, you may want to use a filter with gain if you're interested&#xA;   in having a constant total energy. However in anti-aliasing think of it as trying to filter unwanted frequency components, that you don't want them to mix with your useful signal, so you'll always have the same energy for that latter. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Don't confuse filter gain with signal energy in any way, the gain of the filter is how much you boost each freqeuncy component, this however will increase the signal energy in the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Btw, what I think Marcus meant is that you want to keep a constant average energy, not the total energy, where a shorter signal will have lower energy anyway, but average energy defines the power of a DAC's output. (Correct me if I'm wrong please)&lt;/p&gt;&#xA;" OwnerUserId="15696" LastActivityDate="2016-02-09T13:30:40.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28769" PostTypeId="1" AcceptedAnswerId="28770" CreationDate="2016-02-09T17:28:19.253" Score="4" ViewCount="714" Body="&lt;p&gt;When  you load the speech file 'mtlb' in MATLAB (which is by the way the voice of a woman saying the word 'MATLAB'), and plot the data, you get the following plot:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/TLp3W.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TLp3W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is this: what does the y-axis represent? What is MATLAB actually plotting here? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="19480" LastActivityDate="2016-02-09T18:04:06.807" Title="What does MATLAB display when plotting a sound signal?" Tags="|matlab|sound|speech|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28770" PostTypeId="2" ParentId="28769" CreationDate="2016-02-09T18:04:06.807" Score="4" Body="&lt;p&gt;What you are observing is the digital representation of the voltage, which in fact represents the acoustic pressure.&#xA;Workflow would be something like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Vibrating larynx is producing &lt;code&gt;Acoustic Pressure [Pa]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Variations of that pressure are converted by the microphone into &lt;code&gt;Voltage [V]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Voltage is being sampled and quantized by the ADC (Analog to Digital Converter) and represented as series of numbers.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now knowing your microphone's sensitivity &lt;code&gt;[mV/Pa]&lt;/code&gt; you can relate the voltage and acoustic pressure. Additionally if ADC's parameters are known (or measured) then you can directly relate sample values to Pascals. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-02-09T18:04:06.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28773" PostTypeId="1" CreationDate="2016-02-09T19:02:09.720" Score="1" ViewCount="111" Body="&lt;p&gt;I'm very new to the idea of signal processing, could someone point me in the direction of of a program to toy with images, below is a link to 2 taken a split second apart that showed up on my Amazon app. I've been making decimated images recently in Photoshop and want to play with images in a way that may have more effect like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zxPe7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zxPe7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eXC9t.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eXC9t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second image is sort of pixelated but not totally decimated image of the first image, an almost plain book cover. It's a split second of the lower one of this pixelation  then snaps into the regular image. How can I take original images and process them with different signals to this effect. Notice there's banding on the top and bottom so it's not just a simple rescaling in Photoshop which I'm very familiar with. &lt;/p&gt;&#xA;" OwnerUserId="19482" LastEditorUserId="19482" LastEditDate="2016-02-09T19:59:29.610" LastActivityDate="2017-07-26T13:03:26.263" Title="How can I duplicate this type of image?" Tags="|image-processing|filters|noise|sampling|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28775" PostTypeId="2" ParentId="28773" CreationDate="2016-02-09T20:53:27.720" Score="0" Body="&lt;p&gt;That second image really just looks like a strongly compressed JPEG image, with the typical artefacts of chosing only the lower-frequency DCT coefficients for storage. Notice how these blocks seem to all be squares of ca 8x8 px size? The &quot;storage unit&quot; of JPEGs is 8x8 pixels, and these blocks get 2D discrete cosine transformed, after which the resulting 8x8 coefficients are stored with different &quot;precision&quot;. In this case, it seems only the first of that $8\cdot8=64$ coefficients actually made it to the JPEG, hence, the 8x8 blocks are constant. Some blocks on the very top also show some oscillations with a ca 2px period in y-direction, so there's a second stored coefficient for those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to produce a similar result by just saving your image to a JPEG file with very high compression/very low quality.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-09T20:53:27.720" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28776" PostTypeId="1" AcceptedAnswerId="28779" CreationDate="2016-02-10T01:03:28.880" Score="2" ViewCount="724" Body="&lt;p&gt;I have a clearly 4Hz periodic signal (see image below). However when I apply a fourier transform, there is no peak at 4Hz. Also, when I do a power spectrum density (using Matlab's pwelch algorithm), there is no peak at 4Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My original signal is sampled at 5ms, and is 141 bins (705ms) long. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this &amp;amp; which alogithm will detect the 4Hz peak?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;a href=&quot;https://i.stack.imgur.com/OWR6p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OWR6p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4550" LastActivityDate="2016-02-10T11:26:01.417" Title="Why Fourier Transform doesn't show obvious periodicity?" Tags="|matlab|fft|frequency-spectrum|power-spectral-density|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28777" PostTypeId="1" CreationDate="2016-02-10T02:19:37.273" Score="2" ViewCount="1485" Body="&lt;p&gt;I'm new to Kalman filters and my extensive web search about them has helped me understand the majority of it (or so I think). However I still need some light shed on my problem formulation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a set of points $(x,y)$ provided by some other part of my program that correspond to the coordinates of a target whose position is being estimated. Let's assume the coordinates have have error with known variances $\sigma_x$ and $\sigma_y$, zero mean and are normally distributed. I have no other information (for example, regarding velocity or acceleration). The path of the target is completely random as it modeled by a walking person and it can remain long periods of time just standing still. The samples $(x,y)$ are obtained with a well defined and constant time interval $\Delta t$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Is a Kalman filter the best approach to smooth the path in my case? It seems to me that, although the person can walk freely and apparently randomly, their movements still have a high correlation in a small scale, so a Kalman filter could be a choice.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is an example in Wikipedia on &lt;a href=&quot;https://en.wikipedia.org/wiki/Kalman_filter&quot; rel=&quot;nofollow&quot;&gt;Kalman filtering&lt;/a&gt; with a truck whose velocity is not known and where its unknown acceleration is modeled by the noise vector $\boldsymbol{w_k}$. Is this the best approach to solve my problem? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also, how would the system be formulated in the case of two dimensions $(x,y)$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there any harm in feeding the same coordinates $(x,y)$ to the filter for long periods of time? (Meaning the person is standing still)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How does the Kalman filter differ from, for example, the Savitzy-Golay approach to data smoothing? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="19486" LastEditorUserId="1629" LastEditDate="2016-07-14T01:10:48.660" LastActivityDate="2017-07-10T00:14:57.680" Title="Structuring Kalman filter for tracking problem where only position is known" Tags="|filters|kalman-filters|smoothing|tracking|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28779" PostTypeId="2" ParentId="28776" CreationDate="2016-02-10T03:32:46.627" Score="4" Body="&lt;p&gt;An FFT doesn't necessarily show a fundamental periodicity, but instead spectral periodicities, which might be higher harmonics (or overtones) of the periodicity that you might perceive visually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, some spectral peaks can be hidden under (the windowing artifacts of) a relatively  large enough DC offset.  If you subtract the mean of the data before doing the FFT, these frequency peaks might show up more clearly.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-10T03:32:46.627" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28781" PostTypeId="2" ParentId="2608" CreationDate="2016-02-10T06:23:52.530" Score="1" Body="&lt;p&gt;@robert-bristow-johnson &lt;a href=&quot;http://www.dsprelated.com/showthread/comp.dsp/57208-1.php&quot; rel=&quot;nofollow&quot;&gt;explains this very clearly on comp.dsp&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;you have to oversample to a finite extent.  if you represent the&#xA;  (memoryless, i assume) non-linearity as a finite order polynomial (that&#xA;  approximates whatever curve you are trying to implement), then whatever&#xA;  is the order of polynomial is the same factor of oversampling needed&#xA;  and no aliases will occur.  then low-pass filter (at that oversampled&#xA;  rate) to get rid of all frequency components higher than your original&#xA;  Nyquist, then downsample and you will not have aliasing.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In other words, if your nonlinearity is a polynomial, the highest frequency that can be produced by the distortion will be the highest frequency in your signal times the order &lt;em&gt;N&lt;/em&gt; of the polynomial.  (The polynomial nonlinearity is multiplying the signal by itself &lt;em&gt;N&lt;/em&gt; times, so its spectrum gets convolved with itself and spreads out by the same ratio.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then you know the maximum frequency (whether Nyquist or some lower limit for your application), and you know the order of the polynomial, so you can oversample enough to prevent aliasing, do the distortion, and then low-pass filter and downsample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, you can reduce the oversampling rate by letting some aliasing happen, as long as it's contained in the band that will be removed before downsampling:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;another little trick is that you need not care about aliasing that&#xA;  folds down to the area that you'll LPF out.  so a 5th order polynomial&#xA;  needs only to have an oversampling ratio of 3.  those top 2 harmonics&#xA;  might alias, but won't get back into the baseband.  when downsampling,&#xA;  you filter those aliased harmonics out.  so i think the hard and fast&#xA;  rule is&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;oversampling ratio = (polynomial order + 1)/2&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2016-02-10T06:31:31.297" LastActivityDate="2016-02-10T06:31:31.297" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28783" PostTypeId="1" AcceptedAnswerId="28784" CreationDate="2016-02-10T09:11:07.853" Score="3" ViewCount="414" Body="&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: There was a small error in my code when plotting the Squared RC. Below is the correct frequency response, and clearly RC² doesn't fulfill Nyquist's criterion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LiI3N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LiI3N.png&quot; alt=&quot;Correct plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---------------------------------- Original question (to discard)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So first let me start by asking if using a &lt;strong&gt;Raised Cosine&lt;/strong&gt; filter at &lt;strong&gt;both&lt;/strong&gt; the transmitter and receiver (matched filter) gives a response that is ISI free? (Assuming an ideal channel)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words is the &lt;strong&gt;SQUARED&lt;/strong&gt; (not root-squared) frequency response of RC $H_{RC}(f)^2$ still fulfills Nyquist's ISI criterion? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I avoided a direct derivation since the mathematical expressions are quite intimidating so I turned to Matlab and quickly plotted the frequency response of both the RC &amp;amp; RC squared and tried to calculate: $\sum H(f-k/Ts)$ and check if it's constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The graphs show that both $H_{RC}(f)$ and $H_{RC}(f)^2$ add up to a constant after performing the previous operation. Moreover I performed an &lt;em&gt;ifft&lt;/em&gt; on $H_{RC}(f)^2$ and plotted it and it seems to have zeroes at $kTs$ (for $k\neq 0$) just like the RC time domain function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DSljf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DSljf.png&quot; alt=&quot;RC and RC SQUARED Frequency response and ISI criterion&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So bets are, if my Matlab code is correct, that RC² fulfills Nyquist's criterion. Am I missing something here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if the RC² is also ISI free, why wouldn't we use an RC at both the transmitter and receiver? Why do we turn to a root-raised cosine instead?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why did we go from an RC to a Root-RC? Most textbooks say it's to split the filtering between TX &amp;amp; RX and to get an overall ISI free response but the same could be done with a RC filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="19495" LastEditorUserId="19495" LastEditDate="2016-02-21T09:36:04.440" LastActivityDate="2016-02-21T09:36:04.440" Title="Why do we really split pulse shaping between the transmitter and the receiver?" Tags="|digital-communications|matched-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28784" PostTypeId="2" ParentId="28783" CreationDate="2016-02-10T11:08:28.210" Score="6" Body="&lt;p&gt;There must be something wrong in your code because it's quite straightforward to show that the squared frequency response of a raised cosine pulse does not satisfy the Nyquist criterion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A raised cosine pulse satisfies the Nyquist criterion simply because a raised (co)sine function and an inverted raised (co)sine function add up to a constant:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(1+\sin(x))+(1-\sin(x))=2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where one of the two expressions corresponds to the rising edge of the frequency response whereas the other corresponds to the falling edge of a shifted version of the frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you square the frequency response you get the following expression in the region where two shifted spectra overlap:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(1+\sin(x))^2+(1-\sin(x))^2=2(1+\sin^2(x))\neq const$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is not constant, and which proves that the squared frequency response of a raised-cosine pulse does not correspond to a Nyquist pulse.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-10T11:38:28.820" LastActivityDate="2016-02-10T11:38:28.820" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28785" PostTypeId="2" ParentId="28776" CreationDate="2016-02-10T11:26:01.417" Score="1" Body="&lt;p&gt;From the axis label time period seems to be 250 s, so the frequency is 0.004 Hz which is very close to DC, in that case you are seeing the right thing. If the axis label is in ms then you may try - &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take the mean of the signal and apply FFT, that way it will show the frequencies close to DC without getting buried under DC or 1/f noise &lt;/li&gt;&#xA;&lt;li&gt;Check if your FFT sampling rate is same as the signal's sampling rate&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19499" LastActivityDate="2016-02-10T11:26:01.417" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28786" PostTypeId="1" AcceptedAnswerId="28789" CreationDate="2016-02-10T12:03:36.593" Score="0" ViewCount="565" Body="&lt;p&gt;The text of my exercise ask : &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Determine the closed form of the $\mathcal{Z}$-transform for this $x(n)$  $$ x(n) = \begin{cases} |n-N|  &amp;amp; \text{if 0&amp;lt;$n$&amp;lt;2N} \\ 0 &amp;amp; \text{elsewhere} \end{cases} $$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I see $x(n)$ like a composition of two signals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(n)= x'(n)+x''(n) $$&#xA;I use for greater semplicity $x_1(n)$&#xA;$$x_1(n)= (u(n)-(u-(N+1))$$&#xA;whence&#xA;$$x'(n)= (n-N) x_1(n) $$&#xA;$$x''(n)= x'(n-N)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determination $X(Z)$ it easy, but if &#xA;the above equations are correct, for this reason i need post this question here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_1(Z)= \frac{z^{-(N+1)}-1}{Z^{-1} -1}$$&#xA;$$X'(Z)= z^{-1} \frac{{d}}{dz^{-1}} X_1(Z)- N X_1(Z)$$ &#xA;$$X''(Z)= X_1 (\frac{1}{Z})z^{-N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(Z)= X'(Z)+X''(Z)$$&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hAFkT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hAFkT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18327" LastEditorUserId="18327" LastEditDate="2016-02-10T15:28:23.010" LastActivityDate="2016-02-10T15:28:23.010" Title="Closed form of $\mathcal Z$-transform : decomposition signal $x(n)$" Tags="|discrete-signals|z-transform|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28787" PostTypeId="2" ParentId="2608" CreationDate="2016-02-10T12:50:08.987" Score="4" Body="&lt;p&gt;&lt;strong&gt;A few approaches to alias-free nonlinear distortion (in increasing order of difficulty):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Subband distortion&lt;/em&gt;&lt;/strong&gt;: Use a low pass filter to extract the lower end of the signal. If you choose a cutoff frequency of $\frac{f_s}{2N}$ you can apply any non-linear transfer function $f$ with derivatives starting at $f^{N+1}$ vanishing to avoid aliasing. Add just the distortion output of the low band back to the original signal. For this, modify your nonlinear transfer function to only produce the distortion, not the incoming signal. This approach is often totally sufficient for audio, because the distortion contribution of the higher frequencies would be inaudible in most cases.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Oversampling&lt;/em&gt;&lt;/strong&gt;: This is similar to approach 1, but does require the extra steps of upsampling and downsampling to make sure that all information in the original signal band contributes to the distorted signal, if you think this is needed. It also allows you to distort to higher order, because parts of the back-folded spectrum will be removed by the downsampling filter. That means if you oversample by a factor $N$, the derivatives of the nonlinear transfer function starting at order $2N$ have to vanish. The procedure is a simple as upsampling, applying the nonlinear transfer function, downsampling.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Using a local analytic solution&lt;/em&gt;&lt;/strong&gt;: Any &lt;em&gt;smooth&lt;/em&gt; nonlinear transfer function can be applied to a signal that is described by a power series. If you let the transfer function act on a power series, you will get a power series back. If you restrict yourself to truncated power series of a certain order, and the transfer function to a certain degree of smoothness, you can write the transfer function as a map on the coefficients of the truncated series. That means instead of $f:\mathbb{R}\to\mathbb{R}$, you consider $f:\mathbb{R}^N\to\mathbb{R}^M$ taking an input series expansion of length $N$ to an output series expansion of length $M&amp;gt;N$. With this understanding, you can use a local finite approximation of the input signal in terms of a power series and map it to a power series approximation of the output. Then you can analytically integrate the output series to create a box-car antialiasing filter to get the output sample value. All these computations can be done symbolically, and because you have to include local features of the input signal, you will finally get a nonlinear filter that uses past values of your input signal to generate the current output.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Constrain based algebraic design&lt;/em&gt;&lt;/strong&gt;: In the previous item, you have seen that antialiasing nonlinear distortion leads to nonlinear filters. Of course, not all nonlinear filters are alias free, but some may be. So the obvious question is for a criterium to make such a filter strictly alias free and how to design it. As it turns out, an equivalent statement to being free of aliasing is, that the non-linear filter commutes with sub-sample translations. So you must make sure that it does not make a difference if you translate first and then filter, or filter first and then translate. This condition leads to &lt;em&gt;very strict design constraints&lt;/em&gt; for nonlinear filters, but depends on how you realise the signal translation. For example, the ideal translation would require infinitely many coefficients for the nonlinear filter. So you have to approximate signal translation to finite order to get a finite nonlinear filter. Alias-freeness scales with the approximation you use, but you have very good control over it. After you've worked through the mathematics of this approach, you can design any (not just smooth) nonlinear transfer function as a nearly ideal digital model in the form of a nonlinear filter. I cannot possibly sketch the details here, but maybe you can find some inspiration from this description.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2016-02-10T13:13:38.817" LastActivityDate="2016-02-10T13:13:38.817" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28789" PostTypeId="2" ParentId="28786" CreationDate="2016-02-10T13:23:25.653" Score="0" Body="&lt;p&gt;Or you can proceed this way: \begin{align}\mathcal Z\left\{x(n)\right\}= X(z) &amp;amp;= \sum_{n=-\infty}^\infty x(n)z^{-n}\\&#xA;&amp;amp; = 0 + \sum_{n=0}^{2N} \left|n - N\right|z^{-n} + 0\\&#xA;&amp;amp; = \sum_{n=0}^{N} \left(-n + N\right)z^{-n} + \sum_{n=N}^{2N} \left(n - N\right)z^{-n}\\&#xA;&amp;amp; = N\sum_{n=0}^{N}z^{-n} - N\sum_{n=N}^{2N}z^{-n} - \sum_{n=0}^{N} nz^{-n} + \sum_{n=N}^{2N} nz^{-n} &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And changing the boundaries for the second and fourth term, putting $k = n - N$, you get :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(z) = N\sum_{n=0}^{N}z^{-n} - Nz^{-N}\sum_{k=0}^{N}z^{-k} - \sum_{n=0}^{N} nz^{-n} + z^{-N}\sum_{k=0}^{N} kz^{-k} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can continue from there.&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-02-10T14:13:54.970" LastActivityDate="2016-02-10T14:13:54.970" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28790" PostTypeId="1" CreationDate="2016-02-10T13:45:08.287" Score="1" ViewCount="79" Body="&lt;p&gt;I have a PI temperature controller being used in experiments, which I am also trying to simulate. However, using the proportional gain and integral time as used in the experiments gives different outputs from the experiments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to determine the k_p and T_i of the controller using only the measured input and output temperatures? A linear regression on the difference between output and input temperatures as a function of the error and the integral of the error gives unrealistic results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The (possibly incorrect) estimation code in MATLAB I used is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;error = T_target - T_in(1:end-1);&#xA;integ = cumsum(error.*diff(time));&#xA;ctrl_input_exp = T_out(1:end-1) - T_in(1:end-1);&#xA;fit_model = @(a,b,x,y) a*x + a/b*y ;&#xA;fittedmodel = fit([error,integ],ctrl_input_exp,fit_model);&#xA;fit_coeffs = coeffvalues(fittedmodel);&#xA;k_p = fit_coeffs(1);&#xA;T_i = fit_coeffs(2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19498" LastActivityDate="2016-02-10T13:45:08.287" Title="Parameter identification for PI controller" Tags="|transfer-function|control-systems|parameter-estimation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28791" PostTypeId="2" ParentId="28623" CreationDate="2016-02-10T14:31:28.310" Score="-1" Body="&lt;p&gt;I just found this exact problem in Oppenheim-Schafer's &lt;em&gt;Discrete Time Signal Processing&lt;/em&gt; (2nd edition). For those interested, it's exercise 4.56.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've found in Internet the solutions for those problems. The solution for 4.56 that the book gives us is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7ByyR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7ByyR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the definition of the filter written in the original question was correct.&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-02-10T14:31:28.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28792" PostTypeId="1" AcceptedAnswerId="28796" CreationDate="2016-02-10T17:31:47.200" Score="0" ViewCount="356" Body="&lt;p&gt;is it possible to guess the stability of a filter with given coefficients a and b? I know that the right way would be to calculate the pole positions and check if they are in the unit circle but I think I read that there also is another method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers&lt;/p&gt;&#xA;" OwnerUserId="11623" LastActivityDate="2016-02-10T20:44:48.393" Title="Guess stability based on filter coefficients" Tags="|filters|linear-systems|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28794" PostTypeId="1" AcceptedAnswerId="28795" CreationDate="2016-02-10T18:59:23.063" Score="0" ViewCount="9231" Body="&lt;p&gt;This is a very common example in most Signal Processing books I have come across.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x(n) = cos($\frac{n}{6}$) is a non-periodic discrete signal because it doesn't satisfy the periodicity condition for discrete time signals i.e, it is not of the form 2$\pi$($\frac{m}{N}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;the coefficient of n, i.e, $\Omega_0$=$\frac{1}{6}$ here can also be expressed as $\frac{1}{6}$ = $\frac{1}{6}$ * $\frac{2\pi}{2\pi}$ = 2$\pi$$\frac{1}{12\pi}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, substituting for $\pi$ = $\frac{22}{7}$ in above, we get 2$\pi$$\frac{7}{12*22}$. So, $\frac{1}{6}$ can be written as 2$\pi$($\frac{7}{264}$), which is in the form 2$\pi$($\frac{m}{N}$) with a period N=264.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure I'm missing something which may be obvious but it would be of great help if someone could point it out and explain.&lt;/p&gt;&#xA;" OwnerUserId="18333" LastActivityDate="2019-03-14T13:16:14.980" Title="Why is cos(n/6) aperiodic?" Tags="|discrete-signals|digital|periodic|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28795" PostTypeId="2" ParentId="28794" CreationDate="2016-02-10T19:25:48.987" Score="6" Body="&lt;p&gt;The problem with your reasoning is that $\pi \ne \frac{22}{7}$; $\pi$ is an irrational number. There is no period $N$ for which $x[n] = x[n+N] \ \forall \ n \in \mathbb{Z}$. Hence, the sequence is not periodic.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="80" LastEditDate="2016-02-10T19:35:56.213" LastActivityDate="2016-02-10T19:35:56.213" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28796" PostTypeId="2" ParentId="28792" CreationDate="2016-02-10T20:44:48.393" Score="2" Body="&lt;p&gt;In the general case there is no simple way to determine the stability of a discrete-time system (unless it is FIR, in which case it is always stable). In order to check stability you don't necessarily need to compute the poles of the transfer function, but you can use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Jury_stability_criterion&quot; rel=&quot;nofollow&quot;&gt;Jury stability criterion&lt;/a&gt;, which does not explicitly compute the poles, because the latter is generally a numerically ill-conditioned problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a second-order system the denominator coefficients have to be inside the &lt;a href=&quot;https://books.google.nl/books?id=Crggzv_PqqAC&amp;amp;lpg=PA155&amp;amp;ots=dbxYytFw7z&amp;amp;dq=stability%20triangle%20poles&amp;amp;pg=PA156#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow&quot;&gt;stability triangle&lt;/a&gt;, which can be checked very easily.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-10T20:44:48.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28799" PostTypeId="1" AcceptedAnswerId="28808" CreationDate="2016-02-10T22:01:08.687" Score="2" ViewCount="892" Body="&lt;p&gt;I am using a FIR filter to generate Root Raised Cosine pulse for an IQ modulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I predict the peak value at the output, depending on the roll-off factor of the pulse ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing that :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;FIR taps are root raised cosine pulse, with a peak value of 1.0&lt;/li&gt;&#xA;&lt;li&gt;Input of the filter is I or Q channel, valued +1 or -1, upsampled by adding 0s between each symbol&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;By experimenting, I can see that depending on the input sequence and the roll-off factor, the peak output varies. But I can't predict it theoretically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This plot illustrates my question (while this particular sequence may not generates the maximum peak that I want to predict) :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xy8TF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xy8TF.png&quot; alt=&quot;RRC pulse shaped signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19507" LastEditorUserId="19507" LastEditDate="2016-02-10T22:32:40.407" LastActivityDate="2016-02-11T12:10:08.277" Title="Root raised cosine pulse shaping peak value" Tags="|filters|modulation|finite-impulse-response|quadrature|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28802" PostTypeId="1" AcceptedAnswerId="28804" CreationDate="2016-02-11T01:12:54.640" Score="0" ViewCount="132" Body="&lt;p&gt;I'm still learning DSP and referring to &lt;a href=&quot;http://ocw.mit.edu/resources/res-6-008-digital-signal-processing-spring-2011/video-lectures/&quot; rel=&quot;nofollow&quot;&gt;Oppenheim&lt;/a&gt; video lectures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that lectures, differential difference equation is obtained for IIR filter design, in Lecture 14.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{L}[\frac{\mathrm d}{\mathrm dx}y_a(t)] = sY_a(S)$$&#xA;$$\mathcal{Z}[\frac{y[n+1] - y[n]}{T}] = \frac{z-1}{T}Y(z)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And using these two equations, difference equation $z-1=sT$ is obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate the z-transform of the differential, $y(n+1)$ is used. By using that term, are we making our system non-causal..? (As our equation depends on future values)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time..&lt;/p&gt;&#xA;" OwnerUserId="18617" LastEditorUserId="18617" LastEditDate="2016-02-14T00:05:17.680" LastActivityDate="2016-02-14T00:05:17.680" Title="Differentials - Differences: Non causality in the system" Tags="|filter-design|infinite-impulse-response|z-transform|laplace-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28803" PostTypeId="1" CreationDate="2016-02-11T01:35:04.177" Score="2" ViewCount="386" Body="&lt;p&gt;I'm using Arduino DUE (Cortex-M3 based board).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to make a guitar sound using DAC (digital to analog converter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, the note A2's fundamental frequency is 110 Hz (using A4 440 Hz as the standard).&#xA;As you know, guitar generates harmonics like 220, 330, 440 Hz, and more.&#xA;More complex, the amplitudes of each sine waves change as time goes by.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is described with detail at &lt;a href=&quot;https://courses.physics.illinois.edu/phys406/student_projects/fall02/rlee/ryan_lee_p398emi_main_report.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper (Figure 1, Electric &amp;amp; Acoustic Guitar Strings: A Recording of Harmonic Content by Ryan Lee)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to understand the Karplus–Strong string synthesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I used Matlab and some &lt;a href=&quot;http://mathworks.com/help/signal/examples/generating-guitar-chords-using-the-karplus-strong-algorithm.html&quot; rel=&quot;nofollow&quot;&gt;examples from Mathworks&lt;/a&gt; to understand it.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not sure whether using this algorithm will generate a guitar sound like the acoustic guitar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean is that, I'm trying to test my pitch detection algorithm with a guitar. But taking a guitar all the time for testing is quite bothersome.&#xA;So I tried to generate a wave using DAC for faster testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;When using DAC, will the generated waveform which uses Karplus–Strong algorithm be a reliable input for testing a instrument pitch detection algorithm?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Or is there something else that can be used?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="19172" LastEditorUserId="19512" LastEditDate="2016-02-16T18:57:12.980" LastActivityDate="2016-02-16T18:57:12.980" Title="Is Karplus-Strong synthesis a reliable way to test pitch detection algorithms?" Tags="|matlab|pitch|hardware|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28804" PostTypeId="2" ParentId="28802" CreationDate="2016-02-11T09:11:14.567" Score="1" Body="&lt;p&gt;Replacing the derivative by forward differences is just a way to define a transformation from the $s$-plane to the $z$-plane, and it has nothing to do with the causality of the resulting discrete-time filter. As an exercise you could try to do the same with backward differences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this method for transforming a continuous-time filter to a discrete-time filter is useless in practice because stability is generally not preserved, and the transformed frequency response may be drastically different from the original response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-11T09:11:14.567" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28805" PostTypeId="1" AcceptedAnswerId="28809" CreationDate="2016-02-11T10:50:15.677" Score="0" ViewCount="2757" Body="&lt;p&gt;I am using the &lt;code&gt;audioread(filename,y,Fs)&lt;/code&gt; function of Matlab and it converts an audio file to a matrix. I want to know how is each value of that matrix generated. Is it possible to produce a specific sound like the sound of a guitar by giving your own values to the matrix and then sounding it using the &lt;code&gt;sound()&lt;/code&gt; function?&lt;/p&gt;&#xA;" OwnerUserId="19170" LastEditorUserId="80" LastEditDate="2016-02-11T14:50:23.580" LastActivityDate="2016-09-27T08:44:19.963" Title="How is the sound converted to matrix in Matlab?" Tags="|matlab|audio|matrix|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28807" PostTypeId="2" ParentId="28805" CreationDate="2016-02-11T11:57:03.237" Score="1" Body="&lt;p&gt;Yes, it is definitely possible to produce the specific sound like guitar. but the point is do we know the values(matrix values) which will produce that specific sound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding &quot; how is each value of that matrix generated&quot; , those are generated by the transducer's(microphone) action on sound waves.When you read a file using audioread, you are just able to see those values in matrix form.   &lt;/p&gt;&#xA;" OwnerUserId="15911" LastEditorUserId="15911" LastEditDate="2016-02-11T12:43:52.720" LastActivityDate="2016-02-11T12:43:52.720" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28808" PostTypeId="2" ParentId="28799" CreationDate="2016-02-11T12:04:15.817" Score="0" Body="&lt;p&gt;You can derive an upper bound for the peak value of the output signal depending on the filter's impulse response. The output is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=0}^{N-1}h[k]x[n-k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h[k]$ is the length $N$ impulse response, and $x[k]$ is the input signal. From $(1)$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|y[n]|=\left|\sum_{k=0}^{N-1}h[k]x[n-k]\right|\le\sum_{k=0}^{N-1}|h[k]||x[n-k]|\le |x[n]|_{\text{max}}\sum_{k=0}^{N-1}|h[k]|\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since in your case $|x[n]|_{\text{max}}=1$, the magnitude of the peak value of the output signal is guaranteed to be smaller than the sum of the absolute value of all filter coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since your input signal is upsampled by a factor $L$ (i.e., it has $L-1$ zeros between two signal values), we can come up with an improved (i.e., tighter) bound:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|y[n]|\le\max_{l=0,1,\ldots L-1}\sum_{k=0}^{\lfloor \frac{N-1}{L}\rfloor}|h[l+kL]|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because in the sums $(1)$ and $(2)$ only every $L^{th}$ filter coefficient is multiplied by a non-zero input value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following Matlab/Octave script shows the computation of the bound:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;h = randn(50,1);    % some impulse response&#xA;x = randi([-1,1],1,20); % input signal&#xA;L = 10;         % interpolation factor&#xA;x = [x;zeros(L-1,20)]; x=x(:);  % interpolate x&#xA;y = filter(h,1,x);  % compute output signal&#xA;p = max(abs(y));    % peak value&#xA;&#xA;% compute bound&#xA;b = zeros(L,1);&#xA;for i = 1:L, b(i) = sum(abs(h(i:L:end))); end&#xA;b = max(b);&#xA;&#xA;% show peak value and bound&#xA;[p,b]&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A few runs of the script show that the bound is pretty tight.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-11T12:10:08.277" LastActivityDate="2016-02-11T12:10:08.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28809" PostTypeId="2" ParentId="28805" CreationDate="2016-02-11T12:36:10.540" Score="2" Body="&lt;p&gt;The function &lt;code&gt;audioread&lt;/code&gt; doesn't generate any values, it just reads audio samples stored in a file. If you want to generate the sound of a guitar, you need to look into sound synthesis, such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Karplus%E2%80%93Strong_string_synthesis&quot; rel=&quot;nofollow&quot;&gt;Karplus-Strong method&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-11T12:36:10.540" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28811" PostTypeId="1" AcceptedAnswerId="42133" CreationDate="2016-02-11T16:58:22.303" Score="4" ViewCount="643" Body="&lt;p&gt;I need to have causal noise free first order derivation (Derivative).&#xA;Now I am using a simple finite differences formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{ x \left( n \right) - x \left( n - 1 \right) }{ {T}_{s} } $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter above, being High Pass, is super sensitive to noise.&#xA;Do we have a noise free or noise reduced first order differentiation which does not need more than three point for calculation?&lt;/p&gt;&#xA;" OwnerUserId="19515" LastEditorUserId="128" LastEditDate="2020-01-10T17:56:18.663" LastActivityDate="2020-01-10T17:56:18.663" Title="Causal Noise Free 1st Order Derivative in Discrete Domain" Tags="|matlab|discrete-signals|noise|derivative|finite-differences|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="28812" PostTypeId="1" AcceptedAnswerId="28816" CreationDate="2016-02-11T17:03:44.833" Score="1" ViewCount="116" Body="&lt;p&gt;I study condition for fix if filter is a linear phase,but it's not clear in my mind!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have this $h(n)$:&#xA;$$h(n) = \begin{cases} \left(\frac{1}{2}\right)^{n} &amp;amp; 0&amp;lt;n&amp;lt;N-1 \\[2ex] 0 &amp;amp; \text{elsewhere} \end{cases}$$&#xA;I got the $H(z)$: &#xA;$$&#xA;H(z) = \frac {\left(\frac{1}{2}\right)^{N}{z}^{-N}-1}{\frac{1}{2}{z}^{-1}-1}&#xA;$$&#xA;Now, for the phase linear what I do ? I think to verify palindrome property for this $h(n)$, but how ?? or I can finally say that to the form that has definitely not linear ? &lt;/p&gt;&#xA;" OwnerUserId="18327" LastEditorUserId="1629" LastEditDate="2016-02-11T18:39:03.850" LastActivityDate="2016-02-11T21:16:17.227" Title="FIR filter : $h(n)$ is palindrome?" Tags="|finite-impulse-response|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28814" PostTypeId="1" AcceptedAnswerId="28873" CreationDate="2016-02-11T18:57:18.750" Score="14" ViewCount="4936" Body="&lt;p&gt;I am in need of computing &lt;code&gt;atan2(x,y)&lt;/code&gt; on an FPGA with a continuous input/output stream of data. I managed to implement it using unrolled, pipelined CORDIC kernels, but to get the accuracy I need, I had to perform 32 iterations. This led to a pretty large amount of LUTs being devoted to this one task. I tried changing the flow to use partially unrolled CORDIC kernels, but then I needed a multiplied clock frequency to execute repeated loops while still maintaining a continuous input/output flow. With this, I could not meet timing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now I am reaching out for alternative ways of computing &lt;code&gt;atan2(x,y)&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about using block-RAM lookup tables with interpolation, but since there are 2 variables I would need 2 dimensions of lookup tables, and this is very resource intensive in terms of block-RAM usage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then thought about using the fact that &lt;code&gt;atan2(x,y)&lt;/code&gt; is related to &lt;code&gt;atan(x/y)&lt;/code&gt; with quadrant adjustment. The problem with this is that &lt;code&gt;x/y&lt;/code&gt; needs a true divide since &lt;code&gt;y&lt;/code&gt; is not a constant, and divisions on FPGAs are very resource intensive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any more novel ways to implement &lt;code&gt;atan2(x,y)&lt;/code&gt; on an FPGA that would result in lower LUT usage, but still provide good accuracy ?&lt;/p&gt;&#xA;" OwnerUserId="19517" LastEditorUserId="1629" LastEditDate="2016-02-12T15:38:16.133" LastActivityDate="2020-07-30T14:09:06.483" Title="methods of computing fixed point atan2 on FPGA" Tags="|algorithms|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28816" PostTypeId="2" ParentId="28812" CreationDate="2016-02-11T21:16:17.227" Score="1" Body="&lt;p&gt;There are four types of linear phase FIR filters, as described in &lt;a href=&quot;https://dsp.stackexchange.com/questions/9408/fir-filter-with-linear-phase-4-types/9413#9413&quot;&gt;this answer&lt;/a&gt;. They have to satisfy the following symmetry conditions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=h[N-1-n]\quad \text{or}\quad h[n]=-h[N-1-n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(assuming the impulse response $h[n]$ is zero for $n&amp;lt;0$ and $n\ge N$). Since your filter satisfies neither of the two conditions given by $(1)$ it can't have a linear phase response.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-02-11T21:16:17.227" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28819" PostTypeId="2" ParentId="24064" CreationDate="2016-02-12T02:33:55.277" Score="1" Body="&lt;h3&gt;Quick Answer&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The main difference of this filters is how it perform the operations.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Mean Filter&lt;/h2&gt;&#xA;&#xA;&lt;h3&gt;Brief Description&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Mean filtering is a spatial filter, and it's a simple, intuitive and easy to implement method of smoothing images, i.e. reducing the amount of intensity variation between one pixel and the next.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;How It Works&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The idea of mean filtering is simply to replace each pixel value in an image with the mean (`average') value of its neighbors, including itself.&#xA;Mean filtering is usually thought of as a convolution filter and it's based around a kernel, which represents the shape and size of the neighborhood to be sampled when calculating the mean. Often a 3×3 square kernel is used like this&#xA; $$&#xA;   K =&#xA;  \left[ {\begin{array}{cc}&#xA;                \frac{1}{9} &amp;amp; \frac{1}{9} &amp;amp; \frac{1}{9}\\  &#xA;                \frac{1}{9} &amp;amp; \frac{1}{9} &amp;amp; \frac{1}{9}\\  &#xA;                \frac{1}{9} &amp;amp; \frac{1}{9} &amp;amp; \frac{1}{9}\\  &#xA;              \end{array} } \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: &lt;em&gt;Check this link for more details in &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/mean.htm&quot; rel=&quot;nofollow&quot;&gt;mean filtering&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Order Statistics Filter&lt;/h2&gt;&#xA;&#xA;&lt;h3&gt;Brief Description&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This type of filter is based on estimators and  is based on &lt;em&gt;&quot;order&quot;&lt;/em&gt;, the sense of order is about some quatities like $\operatorname{min} $ &lt;em&gt;(first order statistic)&lt;/em&gt;, $\operatorname{max}$ &lt;em&gt;(largest order statistic)&lt;/em&gt; and etc...&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;How It Works&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Given $N$ observations $ X_{1}, X_{2}, X_{3}, \dots X_{N} $ of a random variable $X$, the order statistics are obtained by sorting the $\{X_{i}\}$ in ascending order. This produces $\{X_{(i)}\}$ satisfying: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_{(1)} \leq X_{(2)} \leq X_{(3)} \dots \leq X_{(N)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\{X_{i}\}$ are the order statistics of the N observations.&#xA;So, an Order Statistic Filter (OSF) is a estimator $ F(X_{1}, X_{2}, X_{3}, \dots X_{N})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some common filters which fit the order statistic filter framework are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;strong&gt;linear average&lt;/strong&gt;, which has coefficients:&#xA;  $$ \alpha_{i} = \frac{1}{N} $$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;strong&gt;median filter&lt;/strong&gt;, which has coefficients: &#xA;$$ \alpha_{i} = \left\{ \begin{array}{ll}&#xA;			  1 &amp;amp; i = (N+1)/2\\&#xA;			  0 &amp;amp; \text{otherwise} \end{array} \right.$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;strong&gt;trimmed mean filter&lt;/strong&gt;, which has coefficients:&#xA;$$ \alpha_{i} = \left\{ \begin{array}{ll}&#xA;			  1/M &amp;amp; (N - M + 1)/2 \leq i \leq (N + M + 1)/2 \\&#xA;			  0 &amp;amp; \text{otherwise} \end{array} \right.$$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Please check the references for more details in the &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/VELDHUIZEN/node13.html&quot; rel=&quot;nofollow&quot;&gt;Todd Veldhuizen&lt;/a&gt; web page.&lt;/p&gt;&#xA;" OwnerUserId="17817" LastEditorUserId="11256" LastEditDate="2016-02-12T02:58:13.990" LastActivityDate="2016-02-12T02:58:13.990" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28820" PostTypeId="1" CreationDate="2016-02-12T03:38:57.583" Score="1" ViewCount="305" Body="&lt;p&gt;In one of my projects I need to do a large number of real FFTs, so I'm looking for the most efficient algorithm. Is it possible to pre/process the N DCT in N operations to produce the real FFT - exactly opposite to the N FFT case in &lt;a href=&quot;https://dsp.stackexchange.com/questions/2807/fast-cosine-transform-via-fft&quot;&gt;Fast Cosine Transform via FFT&lt;/a&gt;? If so, would this be, as I expect, several times as fast as the real FFT given the use of real numbers rather than complex?&lt;/p&gt;&#xA;" OwnerUserId="5592" LastActivityDate="2016-02-12T09:59:20.077" Title="Real DFT Using DCT" Tags="|fft|dct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28821" PostTypeId="1" CreationDate="2016-02-12T04:55:53.967" Score="1" ViewCount="7060" Body="&lt;p&gt;Suppose the signal is shifted by dt (signal 'starts' later, say after 1s instead of 0s), does that correspond to a positive or a negative phase shift df in the frequency domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are certainly very detailed answers to this but I am still having trouble, especially with the sign conventions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="19523" LastEditorUserId="19523" LastEditDate="2016-02-12T05:34:45.543" LastActivityDate="2016-02-12T17:01:42.127" Title="How does shifting a signal in the time domain affect its frequency domain?" Tags="|fourier-transform|time-frequency|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28823" PostTypeId="2" ParentId="28820" CreationDate="2016-02-12T09:59:20.077" Score="1" Body="&lt;p&gt;If you have an efficient FFT routine (and there are many out there) the best and easiest approach to compute DFTs of real-valued data is to combine two real-valued signals into one complex valued signal and compute the DFT of the complex-valued signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=x_1[n]+jx_2[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the DFT $X[k]$ of $(1)$ you can obtain the DFTs of the two individual signals $x_1[n]$ and $x_2[n]$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_1[k]=\frac12\left(X[k]+X^*[N-k]\right)\\&#xA;X_2[k]=\frac{1}{2j}\left(X[k]-X^*[N-k]\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way you've computed the length $N$ DFTs of two real-valued signals by one length $N$ DFT of a complex-valued signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a similar manner, you can compute the length $N$ DFT of a real-valued signal by computing the length $N/2$ DFT of a complex-valued signal. This is explained in detail in &lt;a href=&quot;https://dsp.stackexchange.com/questions/28710/time-scaling-in-dft/28712#28712&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-02-12T09:59:20.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28824" PostTypeId="1" AcceptedAnswerId="28827" CreationDate="2016-02-12T10:10:22.510" Score="3" ViewCount="3509" Body="&lt;p&gt;I have a time series and I want to apply:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a differentiation&lt;/li&gt;&#xA;&lt;li&gt;a Butterworth filter&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Does the order theoretically (mathematically) make any difference? Does it make any difference in real life when I use numpy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="19527" LastActivityDate="2016-03-01T20:29:33.960" Title="Is there a difference between filtering a signal before or after differentiating it?" Tags="|filters|filter-design|derivative|derivation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28825" PostTypeId="1" CreationDate="2016-02-12T10:39:41.287" Score="0" ViewCount="2348" Body="&lt;p&gt;I have a time series signal I need to smoothen to get rid of some noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I decided to apply a moving average filter to this signal. I know the choice of the length of the MA is critical. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I choose the length?&lt;/p&gt;&#xA;" OwnerUserId="19527" LastActivityDate="2016-02-12T15:55:25.043" Title="How to select the length of a smoothing moving average filter?" Tags="|filters|filter-design|moving-average|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28827" PostTypeId="2" ParentId="28824" CreationDate="2016-02-12T13:10:10.183" Score="3" Body="&lt;p&gt;So, first of all:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A differentiator is really just a high-pass filter. Digitally (and this is dsp.SE, so I presume this is the case), that typically means a differentiator is really just FIR with taps $[1;-1]$. A butterworth filter being a low-pass IIR, the combination of both does sound like you might want to build a bandpass, or are doing something that doesn't make very much sense; see the comparison of a very relaxed second order butterworth and a differentiator magnitude responses below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tq5f5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tq5f5.png&quot; alt=&quot;comparison of magnitude responses&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, mathematically, that's identical: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In time domain, you convolve ($*$) the signal $x[n]$ with the filter impulse response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}\\&#xA;y[n] &amp;amp;= x[n] * h_{diff} * h_{butter}\\&#xA;&amp;amp;\text{or, in freq. domain, thanks to the convolution theorem}\\&#xA;Y[z] &amp;amp;= X[z] H_{diff} H_{butter}\\&#xA;&amp;amp;\text{multiplication is commutative}\\&#xA;&amp;amp;= X[z] H_{butter} H_{diff} \\&#xA;&amp;amp;\text{but it's also associative}\\&#xA;&amp;amp;= X[z](H_{butter}H_{diff})\\&#xA;&amp;amp;= X[z] \mathcal Z\{h_{butter}*h_{diff}\}&#xA;\end{array}$$&#xA;which implies you can even without problem combine the differentiator and the low pass filter. To little surprise, you get the discrete derivative of the butterworth filter. &lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-02-12T14:22:27.103" LastActivityDate="2016-02-12T14:22:27.103" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28828" PostTypeId="1" AcceptedAnswerId="28843" CreationDate="2016-02-12T14:57:19.750" Score="6" ViewCount="1873" Body="&lt;p&gt;Is it possible to estimate the symbol rate of a signal whose modulation is not know exactly but it can only be guessed that it is probably some kind of QAM (probably 64 or 256). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to get an estimate for the  symbol rate of a signal of unknown modulation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example by feeding the signal through some non-linearity and then looking at it's spectra, should that reveal something about the symbol rate ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, I have a 10 MHz wide signal recorded with an SDR at 2.45GHz. It is emitted by a wireless camera.&lt;/p&gt;&#xA;" OwnerUserId="19066" LastEditorUserId="13320" LastEditDate="2016-02-15T10:10:14.667" LastActivityDate="2016-02-15T10:10:14.667" Title="How to measure/estimate symbol rate of a signal with unknown ( but probably QAM ) modulation?" Tags="|digital-communications|signal-identification|symbol-timing|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="28829" PostTypeId="2" ParentId="28825" CreationDate="2016-02-12T15:55:25.043" Score="2" Body="&lt;p&gt;The magnitude frequency response $|Y(\omega)|$ of moving average of length $N$ can be approximated by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|Y(\omega)| \approx |\hat Y(\omega)| = \left|\frac{2\sin(\frac{N\omega}{2})}{N\omega}\right|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BnbW2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BnbW2.png&quot; alt=&quot;Plot of the approximate frequency response&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 1. Horizontal axis: $N\omega$, vertical axis: $|\hat Y(\omega)|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency $\omega$ is in radians, meaning that $\omega=2\pi$ corresponds to the sampling frequency. You should choose $N$ such that the noise is attenuated as much as possible while keeping a flat enough frequency response over the signal's bandwidth so that the signal's waveform is not distorted too much. What is flat enough depends on what you are going to do with the signal. A good first bet is to have the -3 dB cutoff frequency at the upper bandlimit of your signal so that no frequency of the signal is attenuated by more than 3 dB. The -3 dB cutoff frequency $\omega_c$ of moving average can be approximated by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\omega_c \approx \hat\omega_c = \frac{2.783}{N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These approximations were derived &lt;a href=&quot;https://dsp.stackexchange.com/questions/28169/3db-cut-off-frequency-of-moving-average/28186#28186&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-02-12T15:55:25.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28830" PostTypeId="2" ParentId="28821" CreationDate="2016-02-12T17:01:42.127" Score="3" Body="&lt;p&gt;According to the Fourier's transform properties, the Fourier's transform of $f(t+dt)$ would be $F(f)e(j2\pi fdt)$&#xA;So, basically, the spectrum (Fourier's transform magnitude, representing the frequency content of your signal) does not change. However, f Fourier's now has a phase-shift proportional to the frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your question : the phase-shift's sign is the time delay's sign.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastActivityDate="2016-02-12T17:01:42.127" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28831" PostTypeId="1" AcceptedAnswerId="28834" CreationDate="2016-02-12T18:05:36.750" Score="2" ViewCount="1006" Body="&lt;p&gt;\begin{align}&#xA;x(n)&amp;amp;=\left(-1\right)^n u(n)\\&#xA;h(n)&amp;amp;= u(n-1)+u(n-2)\\&#xA;y(n)&amp;amp;= x(n)*h(n)\\&#xA;y(n)&amp;amp;= \sum_{k=-\infty}^\infty \left(-1\right)^k u(k)\left[u(n-k-1)+u(n-k-2)\right] &#xA;\end{align}&#xA;Graphically it looks like the output is $u(n-1)$ but I can't do the math to get it into the closed form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Ok I pretty much worked it through I'm just iffy on justifying $n \ge 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$u(k)$ sets the bottom limit of the summation to $0$ and $u(n-k-1)$ sets the upper limit to $n-1$. $n$ has to be at least $1$ for the summation to make sense and the partial sums = $1$.&lt;/p&gt;&#xA;" OwnerUserId="19534" LastEditorUserId="1629" LastEditDate="2016-02-13T19:41:01.757" LastActivityDate="2016-02-13T19:41:01.757" Title="Does the output of this system have a closed form expression?" Tags="|convolution|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28834" PostTypeId="2" ParentId="28831" CreationDate="2016-02-12T22:59:14.887" Score="2" Body="&lt;p&gt;You figured out the solution by yourself, so this is just about how to show it formally. First, split the sum into two sums:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=-\infty}^{\infty}(-1)^ku[k]u[n-1-k]+\sum_{k=-\infty}^{\infty}(-1)^ku[k]u[n-2-k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The unit steps give you upper and lower summation indices, but note that the resulting sums are only valid if the upper summation index is not smaller than the lower one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=u[n-1]\sum_{k=0}^{n-1}(-1)^k+u[n-2]\sum_{k=0}^{n-2}(-1)^k\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now note that you can increase the upper summation index by any even number without changing the value of the sum. The second term on the right-hand side of $(2)$ can thus be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u[n-2]\sum_{k=0}^{n-2}(-1)^k=u[n-1]\sum_{k=0}^{n}(-1)^k\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In $(3)$ the argument of the unit step can be changed to $n-1$ because the value of the sum equals zero for $n=1$. Using $(3)$, Eq. $(2)$ can be rewritten as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}y[n]&amp;amp;=u[n-1]\left(\sum_{k=0}^{n-1}(-1)^k+\sum_{k=0}^{n}(-1)^k\right)\\&amp;amp;=u[n-1]\left(2\sum_{k=0}^{n-1}(-1)^k+(-1)^n\right)\\&amp;amp;=u[n-1]\left((1+(-1)^{n+1})+(-1)^n\right)\\&amp;amp;=u[n-1]\tag{4}\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-12T22:59:14.887" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28839" PostTypeId="1" AcceptedAnswerId="28841" CreationDate="2016-02-13T09:31:19.540" Score="1" ViewCount="440" Body="&lt;p&gt;Suppose I have a digital signal measured with sampling time, $T_s=1$ sec. If I take it's derivative, it will, naturally have $T_s=1$ sec. But what are the implications  if I re-sample this derivative to have a lower sampling time, such as $T_s=0.1$ sec?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, how is the accuracy or representatives of the derivative influenced by re-sampling?&lt;/p&gt;&#xA;" OwnerUserId="19540" LastActivityDate="2016-02-13T10:43:22.003" Title="What are the implications of resampling the derivative of a signal with a higher frequency than the original signal?" Tags="|frequency|sampling|resampling|derivative|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28841" PostTypeId="2" ParentId="28839" CreationDate="2016-02-13T09:56:30.990" Score="0" Body="&lt;p&gt;As you start from a discrete signal, you are likely to interpolate the derivative at a finer step. The result depends on the combination of your interpolation scheme and your discrete  derivative estimation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your numerical derivative will probably be more convenient, perhaps smoothed, but not &quot;accurate&quot; with respect to what you would have obtained from a $10$ Hz signal, unless you make assumptions on your original signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, you can fit (locally) the signal by continuous functions, differentiate them (with penalities on thier variations), and sample the result. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-13T09:56:30.990" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28843" PostTypeId="2" ParentId="28828" CreationDate="2016-02-13T10:43:06.303" Score="2" Body="&lt;p&gt;The nonlinear trick is in fact often used to recover the symbol clock of $\frac \pi {2N}$ phase-shifted signals, e.g. BPSK, QPSK: Squaring samples $x[n]$ (or even taking $x^4$) leads to a removal of phase information, and you can then optimize timing with something that is pseudo-derivate based like Müller&amp;amp;Muller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the problem with QAM is usually that there's no two constellation points with the same phase; so an arbitrary amount of squaring can not reduce the number of phases to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For such signals synchronization is complicated even with exact knowledge of what to expect; it's pretty common to see preamble-correlation based synchronization in receivers. Upside of that is that you can not only get timing, but also a fair amount of CSI that way, which leads to the possibility of equalization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a first step, however, some kind of autocorrelation-based detector surely sounds promising: Assuming that with a finite set of constellation points, there's also only finitely many sequences of symbols within the influence of a single pulse shaping filter impulse response, which also means that one might expect the signal to repeat after that amount of time. Hence, a peak on the autocorrelation¹ function of your signal probably signifies the length of $N,\, N\in\mathbb N$ symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that known, you'd still be on the lookout for $N$; remember that the spectrum of a data-modulated signal is the pulse shape convolved with a diraccomb with an inter-dirac distance of $\frac{1}{f_{symbol}}$. Hoping that symbol timing coincides with the pulse shape filter's time domain roots, you could just look at a sufficiently oversampled signal and count the spectral &quot;peaks&quot;; in reality, this will typically not be as clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few other hints: If the spectral shape is wideband and rectangular, possibly even with a bit of &quot;sincy&quot; sidelobe on either side, it's probably OFDM. That'll make your life a little harder, but: OFDM typically uses cyclic prefixes, which means that you can find the OFDM symbol duration using autocorrelation; since the cyclic prefix needs to be a whole number of subsymbols (IDFT bins), you can narrow down the possible OFDM configurations quite a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;¹In fact, any periodicity-based estimator might work; have a look at the&lt;a href=&quot;https://github.com/kit-cel/gr-specest&quot; rel=&quot;nofollow&quot;&gt;gr-specest toolbox&lt;/a&gt;. It has some parametric spectrum estimators, of which MTM might be very interesting, here.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-13T10:43:06.303" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28844" PostTypeId="2" ParentId="28839" CreationDate="2016-02-13T10:43:22.003" Score="1" Body="&lt;p&gt;As Laurent said, no amount of interpolation will restore the information that's not in the original $f_s=1\,\text{Hz}$ signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's been discussed in other posts' comments what a suitable digital differentiator looks like; that's not really easy to answer universally. However, it's certainly a high pass filter. So, I'd say: Try to understand your derivate as a filter operation, if possible. Maybe this gives you a suitable approach on how to implement a &quot;good&quot; (by your application's needs) differentiation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, as Laurent said, when you make assumptions on your original signal, you might find a suitable derivative estimator. The typical approach for DSP (and where Nyquist's theorem mentioned above comes form) is to assume that your signal is a finite sum of complex sinusoids, and hence, every digital signal is equivalently representable by its Discrete Fourier Transform. You might find a derivative according to the differentiation theorem of the Fourier transform, if you want to represent your signal as a sum of orthogonal sinusoids, but you might also represent it according to any other base – and derive a differentiation algorithm that fits your needs best.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-13T10:43:22.003" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28846" PostTypeId="1" AcceptedAnswerId="28847" CreationDate="2016-02-13T11:49:29.940" Score="3" ViewCount="2314" Body="&lt;p&gt;As we know, as frequencies becomes higher, bandwidth becomes higher.And, according to channel capacity theorem, channel capacity increases with higher bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also,  energy is directly proportional to frequency(E=hf). So, if frequency increases, signals possesses higher energy and can travel far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one of them would be more relevant to prove our need of higher frequency? Why not the other one?&lt;/p&gt;&#xA;" OwnerUserId="19542" LastEditorUserId="19542" LastEditDate="2016-02-13T12:07:26.960" LastActivityDate="2016-03-10T06:36:13.090" Title="why is moving towards higher frequencies so important in frequency spectrum?" Tags="|frequency-spectrum|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28847" PostTypeId="2" ParentId="28846" CreationDate="2016-02-13T11:57:05.283" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So, if frequency increases, signals possesses higher energy and can&#xA;  travel far.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not really, it's more the other way round:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When transmitting signals with radiowaves in free-space, most telecommunications engineers use the Friis equation which gives the amount of received power $(P_r)$ according to emitted power $(P_t)$, distance between emitter and receiver ($R$) and wavelength ($\lambda$) :&#xA;$$&#xA;\frac{P_r}{P_t} = G_tG_r\left(\frac{\lambda}{4\pi R}\right)^2&#xA;$$&#xA;$G_t$ and $G_r$ being the transmitter and receiver's antenna gain. &#xA;We see with this equation that $\frac{P_r}{P_t}$ is proportionnal to $\frac{1}{f^2}$ (because $\lambda = \frac{c}{f}$) which means that the higher the frequency, the higher the loss (and ^2 higher !).&#xA;The equation $E = h\nu$ is more related to quantum physics and has no practical use in telecommunications. Maybe it means that higher frequency signals are &quot;more energetic&quot; that low frequency ones, I don't really know honestly, maybe someone else* can answer better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the need to increase frequencies is mostly due to :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Saturation of the currently used spectrum : if you read international and national regulations and standards, you'll see that being able to emit on the RF spectrum is very expensive, because it's actually saturated, every frequency is reserved for a certain application (e.g. GSM signals is my country are transmitted in 200 KHz wide canals around 900 Mhz-ish frequencies). Still in my country, a new mobile phone operator had to pay billions of € to the governement to access some mobile comm. bands. Increasing the frequencies will give everyone more &quot;room&quot; to transmit radiowaves.&lt;/li&gt;&#xA;&lt;li&gt;Increasing data rates, because having a higher carrier frequency also allows to widen the communication channel &lt;/li&gt;&#xA;&lt;li&gt;Miniaturization (higher frequencies = lower wavelengths = smaller antennas and systems)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;*edit : &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;your claim on signal energy and frequency relation, which is based on photo-electricity (E=hv) effect is improper. First of all, the physical nature of waves has nothing to do in developing the mathematical notion of waves and their spectral representation by periodic signals. And even though it's true that the magnitude-squarred |x(t)|2 signal power relation is basicly adopted from power calculations in physics, that power (and energy) is implied to be the energy carried out by the waveform of a classical physics kind.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;from Fat32's comment above&lt;/p&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="19532" LastEditDate="2016-02-14T09:22:51.723" LastActivityDate="2016-02-14T09:22:51.723" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28849" PostTypeId="1" AcceptedAnswerId="28850" CreationDate="2016-02-13T12:26:13.003" Score="2" ViewCount="124" Body="&lt;p&gt;Why do the in-phase and quadrature components of a narrowband signal each have half the bandwidth of the signal?&lt;/p&gt;&#xA;" OwnerUserId="11664" LastActivityDate="2016-02-13T15:26:44.310" Title="Narrowband Signal Decomposition" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28850" PostTypeId="2" ParentId="28849" CreationDate="2016-02-13T15:26:44.310" Score="3" Body="&lt;p&gt;The in-phase and quadrature components of a bandpass signal are real-valued baseband signals. So if the spectrum of a bandpass signal with bandwidth $B$ extends from $f_c-B/2$ to $f_c+B/2$ (where $f_c&amp;gt;B/2$ is the carrier frequency), the spectra of the in-phase and quadrature components extend from $-B/2$ to $B/2$. Since bandwidth is measured at positive frequencies, the baseband bandwidth is $B/2$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-13T15:26:44.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28851" PostTypeId="1" CreationDate="2016-02-13T18:42:15.483" Score="0" ViewCount="97" Body="&lt;p&gt;I'm looking for a way to shield or protect produced signal or wave. In mechanics suppose you run the wave in tunnel. Is there a way to do it in transmitting the signals or waves created by mobile phone or wifi or in the internet?&lt;/p&gt;&#xA;" OwnerUserId="19545" LastEditorUserId="21075" LastEditDate="2020-04-29T06:04:45.290" LastActivityDate="2020-04-29T06:12:27.433" Title="Is there a way to protect your signal?" Tags="|signal-detection|electronic-warfare|" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28852" PostTypeId="2" ParentId="28851" CreationDate="2016-02-13T18:51:31.460" Score="1" Body="&lt;p&gt;Signal integrity is a full area of electrical engineering and signal engineering.&#xA;A few examples :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;To protect a propagating signal in free-space you can emit it louder (=more transmitting power, hence increasing signal to noise ratio (SNR)). &lt;/li&gt;&#xA;&lt;li&gt;Numerical transmissions often include error correcting codes.&lt;/li&gt;&#xA;&lt;li&gt;To protect propagating signals in cables, most of them are electromagnetically shielded.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I may detail my answer according to what you want to know exactly.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastActivityDate="2016-02-13T18:51:31.460" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28854" PostTypeId="2" ParentId="28763" CreationDate="2016-02-13T20:39:04.177" Score="5" Body="&lt;p&gt;For one variable, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(i) = \sum_m x(i-m) \cdot h(m).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For two variables it's&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(i,j) = \sum_m \sum_n x(m,n) \cdot h(i-m,j-n).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For three:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y(i,j,k) = \sum_m \sum_n \sum_p x(m,n,p) \cdot h(i-m,j-n,k-p).&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="5134" LastEditorUserId="-1" LastEditDate="2018-05-22T21:13:06.683" LastActivityDate="2018-05-22T21:13:06.683" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28855" PostTypeId="2" ParentId="13327" CreationDate="2016-02-13T21:52:19.720" Score="2" Body="&lt;p&gt;Some papers provide rule-of-thumb formula for the filter length (and coefficient quantization), for instance:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/82.877143&quot; rel=&quot;nofollow noreferrer&quot;&gt;Accurate estimation of minimum filter length for optimum FIR digital filters&lt;/a&gt;, 2000, Ichige &lt;em&gt;et al.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1049/iet-cds.2010.0010&quot; rel=&quot;nofollow noreferrer&quot;&gt;On computational complexity in digital filters&lt;/a&gt;, 1981, Bellanger&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://bme.elektro.dtu.dk/31610/documents/R_M_P_1975.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;FIR Digital Filter Design Techniques Using Weighted Chebyshev Approximation&lt;/a&gt;, 1975, Rabiner &lt;em&gt;et al.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The one I generally  use in lectures is borrowed from the second paper, for a low-pass filter with the following design:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Utxx0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Utxx0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the estimated filter length $N$ (apparently $2M+1$ for you) is, with sampling frequency $f_s$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ N = \frac{2 f_s}{3(f_2-f_1)}\log_{10} \left(\frac{1}{10\delta_1\delta_2}\right)$$&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-02-13T22:11:15.777" LastActivityDate="2016-02-13T22:11:15.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28856" PostTypeId="1" CreationDate="2016-02-14T00:12:00.893" Score="0" ViewCount="254" Body="&lt;p&gt;As one starts learning signal processing, then comes inevitably the topic of Fourier Transforms. Unfortunately I have difficulties not in computing but in interpreting the results of the Fourier Transforms, in particular the one being Continuous-Time Fourier Transform, CTFT, of the signal $x(t)$ which is: $$X(j\omega) = \int_{-\infty}^{\infty}{x(t)e^{-j\omega t}dt}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I wonder what kind of information does this $X(j\omega)$ give about the signal $x(t)$?  An example is highly appreciated, if possible.&lt;/p&gt;&#xA;" OwnerUserId="19542" LastEditorUserId="13309" LastEditDate="2016-02-14T03:58:32.920" LastActivityDate="2016-02-14T12:27:16.647" Title="What information does fourier transform carry?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="1" ClosedDate="2016-02-15T12:59:13.867" ContentLicense="CC BY-SA 3.0" />
  <row Id="28857" PostTypeId="2" ParentId="28856" CreationDate="2016-02-14T01:06:44.273" Score="2" Body="&lt;p&gt;There are a variety of Fourier Transforms (and Series) such as Continuous Time FT, Discrete Time FT, Discrete FT all of which are generally attributed to the fundamental assertion made by J.B.Fourier about at the beginning of 19th century, which claims (without proof) that &quot;if a continuous-time signal (function) x(t) is periodic with T, then it is possible to represent that signal x(t) as an infinite sum of harmonically related trigonometric functions (sines and cosines) as $ x(t)= \sum{ a_k \sin { 2\pi kt \over T} + b_k \cos { 2\pi kt \over T}}$  in which the weights $a_k$ and $b_k$ (the Fourier Coefficients) represent the amount of that particular harmonic in the signal x(t) being analysed&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact the above argumentation is strictly for Continuous-Time Fourier Series. But the core idea is generalised into Fourier-Transforms of aperiodic and periodic (with the help of impulse $\delta (t)$ functions) signals. There are conditions on which signals can have such a representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In essence, computing a Fourier Transform means finding those coefficients $a_k$ and $b_k$ for which the method is suggested by the analysis equation of the Fourier transform, while the equality in the first paragraph is noted as the synthesis equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventhough it is quite solid to understand the meaning of those sinusoids inside a periodic signal, when it comes to non-periodic signals, for which we use the Fourier Transforms, the exact meaning of what a single sine wave represents inside such a signal is a little vague and instead we emphasize the transient character of that signal under concern and the necessity of existance of a continuum of infinetely many sine waves.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2016-02-14T01:06:44.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28858" PostTypeId="1" CreationDate="2016-02-14T01:41:19.583" Score="2" ViewCount="500" Body="&lt;p&gt;I'm new in StackExchange and I'd appreciate some help. I'm working in an algorithm for detecting &quot;aguajes&quot;, a particular kind of palm. So far, I got good results using a texture feature extractor and other characteristics, but the main problem is that I can't difference between an &quot;aguaje&quot; and other palms (mainly pinnated palms) because the texture is very similar. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.&lt;strong&gt;AGUAJE&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/tgeQY.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tgeQY.jpg&quot; alt=&quot;AGUAJE&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.&lt;strong&gt;Pinnated Palm&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/31a9J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/31a9J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that the &lt;strong&gt;main difference in the second one is the presence of a Central Axis (also called Petiole or Rachis)&lt;/strong&gt;. The question is &quot;&lt;strong&gt;How to detect it?&lt;/strong&gt;&quot;. I mean, if I'm able to detect the presence of a Petiole, I'd be able to distinguish between this two types of palm. I think color is not an important issue because even when there's no color (gray image), we can discern where is located that Axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="19549" LastEditorUserId="19549" LastEditDate="2016-02-14T13:47:44.463" LastActivityDate="2017-07-09T23:14:57.620" Title="Detecting Central Axis (petiole/rachis) of a Pinnated Palm" Tags="|image-processing|image-segmentation|classification|detection|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28860" PostTypeId="1" CreationDate="2016-02-14T07:47:47.497" Score="5" ViewCount="725" Body="&lt;p&gt;After reading this Signal processing Stack Exchange article tonight, &lt;a href=&quot;https://dsp.stackexchange.com/questions/1693/what-is-the-walsh-hadamard-transform-and-what-is-it-good-for&quot;&gt;What Is the Walsh Hadamard Transform? How Could One Use It in Image Processing?&lt;/a&gt;, I became interested in applying the Walsh-Hadamard transform to filter one of three classes of 24 bit RGB color values, True Blue or True Green or Tree Red, in a localized spatial region of the color image seen from a commercial airplane cockpit.&lt;/p&gt;&#xA;&lt;p&gt;In the book Color Image Processing and Applications, the authors Konstantinos Plataniotis, Anastasios N. Venetsanopoulos state that the RGB space is not an efficient representation for compression because there is a significant correlation between the three color components since the image energy is distributed equally among them both spatially and spectrally.&lt;/p&gt;&#xA;&lt;p&gt;A solution is to apply an orthogonal decomposition of the RGB color signals in order to compact the color image data into fewer channels. The commonly used YIQ, YUV and YCBCR color spaces are examples of color spaces based on these principles. The resulting luminance chrominance decomposition exhibits unequal  energy distribution from the luminance component in which the vast majority of fine detail high frequencies can be found&lt;/p&gt;&#xA;&lt;p&gt;I would like to apply color image YUV or YUV (or YCbCrYCbCr which is like HSV) compression to theoretically attain almost real time filtering of RGB color coordinates in a localized spatial region of the color image seen from a commercial airplane cockpit. The reason for the spatial localization is that we do not want to subtract green from everywhere uniformly in the color image projected to the commercial airliner flight team.&lt;/p&gt;&#xA;&lt;p&gt;Please consider the paper, NTSC component separation via Hadamard transform,&#xA;Published in: Vision, Image and Signal Processing, IEE Proceedings -  (Volume:141 ,  Issue: 1 ) Feb. 1994 page 27-32 where the authors, M. Coley and J.Barba of the New York Institute of Technology present a technique for separating the NTSC composite signal into its components (Y, I, Q) by applying an N×N Hadamard transform directly to the composite signal sampled at four times the colour subcarrier.  They show that the Y, I, Q component signals are mapped into specific areas in the Hadamard domain. Component separation is achieved by assigning particular transform coefficients to each component signal. Simulation results of component separation applied to five colour images and one black and white test pattern&#xA;are presented. Both signal to noise ratios and subjective results are presented. The results indicate that no noticeable degradation is expected in typical colour images.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I am interested in restricting RGB color filtering to small localized&#xA;spatial regions of the color image acquired by per pixel processing of&#xA;an array of sensors developed by either by M.I.T Lincoln Labs [27]&#xA;Kelly, M. W. and Blackwell, M. H., “Digital-pixel FPAs enhance&#xA;infrared imaging capabilities,” Laser Focus World 49(1), 90 (2013).&#xA;or Stanford University's DEpartment of Electrical Engineering and Computer Science, [28] Wan, G., Li, X., Agranov, G., Levoy, M., and&#xA;Horowitz, M., “CMOS Image Sensors With Multi-Bucket Pixels for&#xA;Computational Photography,” IEEE J. Solid State Circuits 47(4),&#xA;1031–1042 (2012).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="19299" LastEditorUserId="11256" LastEditDate="2021-09-05T15:46:56.723" LastActivityDate="2024-04-01T15:02:35.347" Title="How to Use the Walsh Hadamard Transform to Filter 24 bit RGB Color Values in a Localized Spatial Region?" Tags="|image-processing|algorithms|color|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="28861" PostTypeId="1" CreationDate="2016-02-14T08:47:27.163" Score="2" ViewCount="2800" Body="&lt;p&gt;I am using Matlab function imnoise to add gaussian noise to one image. However, it seems that adjacent samples of the noise is correlated. I am using matlab code below to add noise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; I = imread('eight.tif');&#xA; J = imnoise(I, 'gaussian', 0, 0.02);&#xA; figure; imshow(I);&#xA; figure; imshow(J);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K8DuW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K8DuW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the image, it contains many short vertical gray lines which maybe be image structures for some cases. Is the noise really additive white gaussian noise(AWGN)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;histogram of noise:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/y9a5M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y9a5M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2016-02-15T04:55:52.203" LastActivityDate="2016-02-15T04:55:52.203" Title="what's gaussian noise look like?" Tags="|image-processing|noise|gaussian|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28863" PostTypeId="2" ParentId="28861" CreationDate="2016-02-14T09:37:10.887" Score="2" Body="&lt;p&gt;Yes it is. However, unlike real AWGN which comes mostly from thermal agitation in electronics, matlab's noise is not purely random, this might be the cause of you seeing a deterministic pattern. But this pseudo-random noise is usually random enough to approximate real life noise&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to assess the noise &quot;randomness&quot;, plot an intensity histogram of In-I, with In being the noised image and I the original image (you are subtracting the deterministic part and keeping the random part).&lt;/p&gt;&#xA;" OwnerUserId="19532" LastActivityDate="2016-02-14T09:37:10.887" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28864" PostTypeId="2" ParentId="28851" CreationDate="2016-02-14T10:31:34.467" Score="1" Body="&lt;p&gt;You could use an antenna array to focus the transmission to the intended receiver only and to send a more powerful jamming signal to all other directions.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-02-14T10:31:34.467" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28867" PostTypeId="2" ParentId="28858" CreationDate="2016-02-14T12:59:28.717" Score="1" Body="&lt;p&gt;In your provided image the central axis is straight and have the same color throughout, therefore a Hough operator can detect this.&lt;/p&gt;&#xA;" OwnerUserId="17405" LastEditorUserId="13309" LastEditDate="2016-02-15T02:46:04.903" LastActivityDate="2016-02-15T02:46:04.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28868" PostTypeId="2" ParentId="14707" CreationDate="2016-02-14T14:29:11.900" Score="0" Body="&lt;p&gt;I also recommend bilinear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beware that the default setting of most image editing apps is &lt;a href=&quot;https://en.wikipedia.org/wiki/Bicubic_interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;bicubic&lt;/a&gt; interpolation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bicubic makes sense for a wide range of scaling: up/down, photo/vector (&lt;a href=&quot;https://en.wikipedia.org/wiki/Comparison_gallery_of_image_scaling_algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;comparisons here&lt;/a&gt;).  But when scaling down by a power of two, bilinear results in less distortion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this image, I have resized part of an &quot;R&quot; character using bilinear sampling from ImageMagick's &lt;code&gt;-scale&lt;/code&gt; option.  (In this case, the original image was larger by a power of 2, so we are taking the mean.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HiAr9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HiAr9.png&quot; alt=&quot;Image shrunk by ImageMagick with -scale&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is bicubic scaling with The GIMP's &quot;cubic&quot; option.  Notice how a few extra bright and dark &quot;ringing&quot; pixels were introduced, which make the edge appear sharper, but also look a bit dirty under close inspection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y7BW5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y7BW5.png&quot; alt=&quot;Image shrunk by The GIMP with cubic scaling&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect is even stronger when scaling with ImageMagick's &lt;code&gt;-geometry&lt;/code&gt; or &lt;code&gt;-resize&lt;/code&gt; option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nGYBw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nGYBw.png&quot; alt=&quot;Image shrunk by ImageMagick with -resize&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19554" LastEditorUserId="19554" LastEditDate="2017-03-30T02:21:39.673" LastActivityDate="2017-03-30T02:21:39.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28869" PostTypeId="2" ParentId="9099" CreationDate="2016-02-14T14:56:46.913" Score="0" Body="&lt;p&gt;Maybe this paper can help you: &lt;a href=&quot;http://ai.stanford.edu/~ang/papers/iros09-ScalableLearningObjectDetectionGPU.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ai.stanford.edu/~ang/papers/iros09-ScalableLearningObjectDetectionGPU.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although they use the active stereo system in addition to 2D images in order to acquire depth images, is interesting how they use the patch-based features, constructing a dictionary of the object with many small fragments and then training a classifier. Maybe you can add this features to improve your detection rate.&lt;/p&gt;&#xA;" OwnerUserId="19549" LastActivityDate="2016-02-14T14:56:46.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28870" PostTypeId="2" ParentId="14707" CreationDate="2016-02-14T18:17:42.593" Score="0" Body="&lt;p&gt;I believe the answer (bilateral is good) can be balanced by the luminance quantization (from 1-bit black and white or true color), and the fact that your image is very small, so standard statistics don't apply here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, a mean over $4$ pixels is generally not an integer, and will be rounded at the end. If you stick to $2\times2$ blocks, I would suggest to take the median of the four values: get rid of the &lt;code&gt;min&lt;/code&gt; and the &lt;code&gt;max&lt;/code&gt; of the four, and take the &quot;nearest&quot; integer (&lt;code&gt;ceil&lt;/code&gt; or &lt;code&gt;floor&lt;/code&gt; depending on whether you want a darker or brighter icon), and the  &lt;code&gt;min&lt;/code&gt; or &lt;code&gt;max&lt;/code&gt; of the mean of the two remaining pixels. I expect this to limit &quot;intermediate luminance borders&quot; that may not be useful at this size, and avoids grays on low-quantization images. I would treat the corners by &quot;duplicating&quot; the corner value (to limit the chances of an ugly color change at the borders): you will get $5$ pixel values, and then the standard median will be an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More involved processing may resort to averaging $4\times 4$ patches, with a lower weight for the 10 surrounding pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the effectiveness depends on the morphology of yoour image: is it flat, smoothly varying or stochastic?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Honestly, I suspect this proposal won't change dramatically the result on standard displays.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-14T18:17:42.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28871" PostTypeId="2" ParentId="28777" CreationDate="2016-02-14T20:25:52.260" Score="0" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I'm new to Kalman filters&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I'm new too.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I have no other information (for example, regarding velocity or acceleration).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is a common situation.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The path of the target is completely random as it modeled by a walking person and it can remain long periods of time just standing still.&lt;/p&gt;&#xA;&lt;p&gt;It seems to me that, although the person can walk freely and apparently randomly, their movements still have a high correlation in a small scale,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In general all objects in the real world moved randomly. But usually dynamic model approximated by some deterministic (quasi-deterministic) model. For example dynamic model of plains approximated by polynomial of degree 1 to describe uniform motion (when this is necessary used polynomial of degree 2 to describe uniformly accelerated motion). Obviously that such models doesn't allow perfectly describe the dynamic model and can be used only for pieces of path without maneuver. To detect maneuver (by speed or heading) used other techniques for example IMM (Interacting Multiple Model). This allow switch current model to more appropriate another. But! Every time you use well defined (not random) dynamic model.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is a Kalman filter the best approach to smooth the path in my case?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I don't know, I haven't had such experience.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is this the best approach to solve my problem?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As far you use discrete time and measurement without non-linear transformation this should solve you problem in my opinion.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Also, how would the system be formulated in the case of two dimensions (x,y)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It would be called the Multivariate Kalman Filter (or may be Two-variate Kalman Filter).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is there any harm in feeding the same coordinates (x,y) to the filter for long periods of time? (Meaning the person is standing still)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It is not a problem. It just mean that first derivation of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is zero.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How does the Kalman filter differ from, for example, the Savitzy-Golay approach to data smoothing?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I don't know, I haven't had such experience.&lt;/p&gt;&#xA;" OwnerUserId="10169" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-02-14T20:25:52.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28872" PostTypeId="2" ParentId="22211" CreationDate="2016-02-14T20:53:09.867" Score="1" Body="&lt;p&gt;I don't have any idea about Accelerometer in iPhone, but converting Accelerometer data into distance is fairly difficult because the offset in double integration causes drift as already told. Check this interesting presentation &lt;a href=&quot;https://youtu.be/C7JQ7Rpwn2k?t=23m22s&quot; rel=&quot;nofollow&quot;&gt;sensor fusion&lt;/a&gt; for further details.&lt;br&gt;&#xA;As far as I  know this can be avoided by using Digital Accelerometers( with high sampling rates), double integration has to be performed using electronic integrators with appropriate filters at every stage to remove the offset as well as the low frequency noise.&lt;br&gt;&#xA;Also in that presentation he mentions the possibility of using more sophisticated algorithms like use of Kalman Filter for object&#xA;tracking or Pedometer Algorithm for pedometer design.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this gives little more insight into your problem:)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: This does not accurately address your question still I thought I will share my knowledge, I want to comment but I don't have enough reputation ! &lt;/p&gt;&#xA;" OwnerUserId="17708" LastActivityDate="2016-02-14T20:53:09.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28873" PostTypeId="2" ParentId="28814" CreationDate="2016-02-14T21:41:27.037" Score="23" Body="&lt;p&gt;You can use logarithms to get rid of the division. For &lt;span class=&quot;math-container&quot;&gt;$(x, y)$&lt;/span&gt; in the first quadrant:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$z = \log_2(y)-\log_2(x)\\&#xA;\text{atan2}(y, x) = \text{atan}(y/x) = \text{atan}(2^z)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/clsf0.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/clsf0.png&quot; alt=&quot;atan(2^z)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Figure 1. Plot of &lt;span class=&quot;math-container&quot;&gt;$\text{atan}(2^z)$&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would need to approximate &lt;span class=&quot;math-container&quot;&gt;$\text{atan}(2^z)$&lt;/span&gt; in range &lt;span class=&quot;math-container&quot;&gt;$-30 &amp;lt; z &amp;lt; 30$&lt;/span&gt; to get your required accuracy of 1E-9. You can take advantage of the symmetry &lt;span class=&quot;math-container&quot;&gt;$\text{atan}(2^{-z}) = \frac{\pi}{2}-\text{atan}(2^z)$&lt;/span&gt; or alternatively ensure that &lt;span class=&quot;math-container&quot;&gt;$(x, y)$&lt;/span&gt; is in a known octant. To approximate &lt;span class=&quot;math-container&quot;&gt;$\log_2(a)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$b = \text{floor}(\log_2(a))\\&#xA;c = \frac{a}{2^b}\\ &#xA;\log_2(a) = b + \log_2(c)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; can be calculated by finding the location of the most significant non-zero bit. &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; can be calculated by a bit shift. You would need to approximate &lt;span class=&quot;math-container&quot;&gt;$\log_2(c)$&lt;/span&gt; in range &lt;span class=&quot;math-container&quot;&gt;$1 \le c &amp;lt; 2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GFg87.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GFg87.png&quot; alt=&quot;log2(c)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Figure 2. Plot of &lt;span class=&quot;math-container&quot;&gt;$\log_2(c)$&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your accuracy requirements, linear interpolation and uniform sampling, &lt;span class=&quot;math-container&quot;&gt;$2^{14} + 1 = 16385$&lt;/span&gt; samples of &lt;span class=&quot;math-container&quot;&gt;$\log_2(c)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$30\times 2^{12} + 1 = 122881$&lt;/span&gt; samples of &lt;span class=&quot;math-container&quot;&gt;$\text{atan}(2^z)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$0 &amp;lt; z &amp;lt; 30$&lt;/span&gt; should suffice. The latter table is pretty large. With it, the error due to interpolation depends greatly on &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/efVAz.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/efVAz.png&quot; alt=&quot;Error of atan(2^z) approximation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Figure 3. &lt;span class=&quot;math-container&quot;&gt;$\text{atan}(2^z)$&lt;/span&gt; approximation largest absolute error for different ranges of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; (horizontal axis) for different numbers of samples (32 to 8192) per unit interval of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. The largest absolute error for &lt;span class=&quot;math-container&quot;&gt;$0 \le z &amp;lt; 1$&lt;/span&gt; (omitted) is slightly less than for &lt;span class=&quot;math-container&quot;&gt;$\text{floor}(\log_2(z)) = 0$&lt;/span&gt;.&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\text{atan}(2^z)$&lt;/span&gt; table can be split into multiple subtables that correspond to &lt;span class=&quot;math-container&quot;&gt;$0 \le z &amp;lt; 1$&lt;/span&gt; and different &lt;span class=&quot;math-container&quot;&gt;$\text{floor}(\log_2(z))$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$z \ge 1$&lt;/span&gt;, which is easy to calculate. The table lengths can be chosen as guided by Fig. 3. The within-subtable index can be calculated by a simple bit string manipulation. For your accuracy requirements the &lt;span class=&quot;math-container&quot;&gt;$\text{atan}(2^z)$&lt;/span&gt; subtables will have a total of 29217 samples if you extend the range of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$0 \le z &amp;lt; 32$&lt;/span&gt; for simplicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For later reference, here is the clunky Python script that I used to calculate the approximation errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from numpy import *&#xA;from math import *&#xA;N = 10&#xA;M = 20&#xA;x = array(range(N + 1))/double(N) + 1&#xA;y = empty(N + 1, double)&#xA;for i in range(N + 1):&#xA;    y[i] = log(x[i], 2)&#xA;&#xA;maxErr = 0&#xA;for i in range(N):&#xA;    for j in range(M):&#xA;        a = y[i] + (y[i + 1] - y[i])*j/M&#xA;        if N*M &amp;lt; 1000: &#xA;            print str((i*M + j)/double(N*M) + 1) + ' ' + str(a)&#xA;        b = log((i*M + j)/double(N*M) + 1, 2)&#xA;        err = abs(a - b)&#xA;        if err &amp;gt; maxErr:&#xA;            maxErr = err&#xA;&#xA;print maxErr&#xA;&#xA;y2 = empty(N + 1, double)&#xA;for i in range(1, N):&#xA;    y2[i] = -1.0/16.0*y[i-1] + 9.0/8.0*y[i] - 1.0/16.0*y[i+1]&#xA;&#xA;&#xA;y2[0] = -1.0/16.0*log(-1.0/N + 1, 2) + 9.0/8.0*y[0] - 1.0/16.0*y[1]&#xA;y2[N] = -1.0/16.0*y[N-1] + 9.0/8.0*y[N] - 1.0/16.0*log((N+1.0)/N + 1, 2)&#xA;&#xA;maxErr = 0&#xA;for i in range(N):&#xA;    for j in range(M):&#xA;        a = y2[i] + (y2[i + 1] - y2[i])*j/M&#xA;        b = log((i*M + j)/double(N*M) + 1, 2)&#xA;        if N*M &amp;lt; 1000: &#xA;            print a&#xA;        err = abs(a - b)&#xA;        if err &amp;gt; maxErr:&#xA;            maxErr = err&#xA;&#xA;print maxErr&#xA;&#xA;y2[0] = 15.0/16.0*y[0] + 1.0/8.0*y[1] - 1.0/16.0*y[2]&#xA;y2[N] = -1.0/16.0*y[N - 2] + 1.0/8.0*y[N - 1] + 15.0/16.0*y[N]&#xA;&#xA;maxErr = 0&#xA;for i in range(N):&#xA;    for j in range(M):&#xA;        a = y2[i] + (y2[i + 1] - y2[i])*j/M&#xA;        b = log((i*M + j)/double(N*M) + 1, 2)&#xA;        if N*M &amp;lt; 1000: &#xA;            print str(a) + ' ' + str(b)&#xA;        err = abs(a - b)&#xA;        if err &amp;gt; maxErr:&#xA;            maxErr = err&#xA;&#xA;print maxErr&#xA;&#xA;P = 32&#xA;NN = 13&#xA;M = 8&#xA;for k in range(NN):&#xA;    N = 2**k&#xA;    x = array(range(N*P + 1))/double(N)&#xA;    y = empty((N*P + 1, NN), double)&#xA;    maxErr = zeros(P)&#xA;    for i in range(N*P + 1):&#xA;        y[i] = atan(2**x[i])&#xA;&#xA;    for i in range(N*P):&#xA;        for j in range(M):&#xA;            a = y[i] + (y[i + 1] - y[i])*j/M&#xA;            b = atan(2**((i*M + j)/double(N*M)))&#xA;            err = abs(a - b)&#xA;            if (i*M + j &amp;gt; 0 and err &amp;gt; maxErr[int(i/N)]):&#xA;                maxErr[int(i/N)] = err&#xA;&#xA;    print N&#xA;    for i in range(P):&#xA;        print str(i) + &quot; &quot; + str(maxErr[i])    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The local maximum error from approximating a function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; by linearly interpolating &lt;span class=&quot;math-container&quot;&gt;$\hat{f}(x)$&lt;/span&gt; from samples of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, taken by uniform sampling with sampling interval &lt;span class=&quot;math-container&quot;&gt;$\Delta x$&lt;/span&gt;, can be approximated analytically by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\widehat{f}(x) - f(x) \approx (\Delta x)^2\lim_{\Delta x\rightarrow 0}\frac{\frac{f(x) + f(x + \Delta x)}{2} - f(x + \frac{\Delta x}{2})}{(\Delta x)^2} = \frac{(\Delta x)^2 f''(x)}{8},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$f''(x)$&lt;/span&gt; is the second derivative of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is at a local maximum of the absolute error. With the above we get the approximations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\widehat{\text{atan}}(2^z) - \text{atan}(2^z) \approx \frac{(\Delta z)^2 2^z(1 - 4^z)\ln(2)^2}{8(4^z + 1)^2},\\&#xA;\widehat{\log_2}(a) - \log_2(a) \approx \frac{-(\Delta a)^2}{8 a^2\ln(2)}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the functions are concave and the samples match the function, the error is always to one direction. The local maximum absolute error could be halved if the sign of the error was made to alternate back and forth once every sampling interval. With linear interpolation, close to optimal results can be achieved by prefiltering each table by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[k] = \cases{\begin{array}{rrrrrl}&amp;amp;&amp;amp;b_0x[k]&amp;amp;\negthickspace\negthickspace\negthickspace+ b_1x[k+1]&amp;amp;\negthickspace\negthickspace\negthickspace+ b_2x[k+2]&amp;amp;\text{if } k = 0,\\&#xA;&amp;amp;c_1x[k-1]&amp;amp;\negthickspace\negthickspace\negthickspace+ c_0x[k]&amp;amp;\negthickspace\negthickspace\negthickspace+ c_1x[k+1]&amp;amp;&amp;amp;\text{if }0 &amp;lt; k &amp;lt; N,\\&#xA;b_2x[k-2]&amp;amp;\negthickspace\negthickspace\negthickspace+ b_1x[k-1]&amp;amp;\negthickspace\negthickspace\negthickspace+ b_0x[k]&amp;amp;&amp;amp;&amp;amp;\text{if } k = N,&#xA;\end{array}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; are the original and the filtered table both spanning &lt;span class=&quot;math-container&quot;&gt;$0 \le k \le N$&lt;/span&gt; and the weights are &lt;span class=&quot;math-container&quot;&gt;$c_0 = \frac{9}{8}, c_1 = -\frac{1}{16}, b_0 = \frac{15}{16}, b_1 = \frac{1}{8}, b_2 = -\frac{1}{16}$&lt;/span&gt;. The end conditioning (first and last row in the above equation) reduces error at the ends of the table compared to using samples of the function outside of the table, because the first and the last sample need not be adjusted to reduce the error from interpolation between it and a sample just outside the table. Subtables with different sampling intervals should be prefiltered separately. The values of the weights &lt;span class=&quot;math-container&quot;&gt;$c_0, c_1$&lt;/span&gt; were found by minimizing sequentially for increasing exponent &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; the maximum absolute value  of the approximate error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\Delta x)^N\lim_{\Delta x\rightarrow 0}\frac{\left(c_1f(x - \Delta x) + c_0f(x) + c_1f(x + \Delta x)\right)(1-a) + \left(c_1f(x) + c_0f(x + \Delta x) + c_1f(x + 2 \Delta x)\right)a - f(x + a\Delta x)}{(\Delta x)^N}&#xA;=\left\{\begin{array}{ll}(c_0 + 2c_1 - 1)f(x) &amp;amp;\text{if } N = 0, \bigg| c_1 = \frac{1 - c_0}{2}\\&#xA;0&amp;amp;\text{if }N = 1,\\&#xA;\frac{1+a-a^2-c_0}{2}(\Delta x)^2 f''(x)&amp;amp;\text{if }N=2, \bigg|c_0 = \frac{9}{8}\end{array}\right.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for inter-sample interpolation positions &lt;span class=&quot;math-container&quot;&gt;$0 \le a &amp;lt; 1$&lt;/span&gt;, with a concave or convex function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; (for example &lt;span class=&quot;math-container&quot;&gt;$f(x) = e^x$&lt;/span&gt;). With those weights solved, the values of the end conditioning weights &lt;span class=&quot;math-container&quot;&gt;$b_0, b_1, b_2$&lt;/span&gt; were found by minimizing similarly the maximum absolute value of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\Delta x)^N\lim_{\Delta x\rightarrow 0}\frac{\left(b_0f(x) + b_1f(x + \Delta x) + b_2f(x + 2 \Delta x)\right)(1-a) + \left(c_1f(x) + c_0f(x + \Delta x) + c_1f(x + 2 \Delta x)\right)a - f(x + a\Delta x)}{(\Delta x)^N}&#xA;=\left\{\begin{array}{ll}\left(b_0 + b_1 + b_2 - 1 + a(1 - b_0 - b_1 - b_2)\right)f(x) &amp;amp;\text{if } N = 0, \bigg| b_2 = 1 - b_0 - b_1\\&#xA;(a-1)(2b_0+b_1-2)\Delta x f'(x)&amp;amp;\text{if }N = 1,\bigg|b_1=2-2b_0\\&#xA;\left(-\frac{1}{2}a^2 + \left(\frac{23}{16} - b_0\right)a + b_0 - 1\right)(\Delta x)^2f''(x)&amp;amp;\text{if }N=2, \bigg|b_0 = \frac{15}{16}\end{array}\right.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$0 \le a &amp;lt; 1$&lt;/span&gt;. Use of the prefilter about halves the approximation error and is easier to do than full optimization of the tables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pD3Fu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pD3Fu.png&quot; alt=&quot;Approximation error with and without prefilter and end conditioning&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Figure 4. Approximation error of &lt;span class=&quot;math-container&quot;&gt;$\log_2(a)$&lt;/span&gt; from 11 samples, with and without prefilter and with and without end conditioning. Without end conditioning the prefilter has access to values of the function just outside of the table.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This article probably presents a very similar algorithm: R. Gutierrez, V. Torres, and J. Valls, “&lt;strong&gt;FPGA-implementation of atan(Y/X) based on logarithmic transformation and LUT-based techniques,&lt;/strong&gt;” &lt;em&gt;Journal of Systems Architecture&lt;/em&gt;, vol. 56, 2010. The abstract says their implementation beats previous CORDIC-based algorithms in speed and LUT-based algorithms in footprint size.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2018-11-27T12:23:37.410" LastActivityDate="2018-11-27T12:23:37.410" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="28874" PostTypeId="1" AcceptedAnswerId="28875" CreationDate="2016-02-15T00:45:00.773" Score="2" ViewCount="141" Body="&lt;p&gt;I am taking computer vision course, where I learned about Sobel operator for detecting edges. I somewhat understand how it works as described &lt;a href=&quot;https://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. But I have a basic confusion. The operator can be divided along $x$ and $y$ axis (as $G_x$ and $G_y$). But these divided operators are finding derivative along one direction, then why are they 2-dimensional?&lt;/p&gt;&#xA;" OwnerUserId="19334" LastEditorUserId="8202" LastEditDate="2016-02-15T08:38:40.907" LastActivityDate="2016-02-15T08:38:40.907" Title="Confusion regarding Sobel operator" Tags="|image-processing|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28875" PostTypeId="2" ParentId="28874" CreationDate="2016-02-15T02:40:36.947" Score="3" Body="&lt;p&gt;Actually the answer is already provided in the wiki page as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Since the Sobel kernels can be decomposed as the products of an averaging and a differentiation kernel, they compute the gradient with smoothing...&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed those 1-D differentiation and averaging kernels are pre-multiplied to form the 2D final kernels to compute directional derivaties. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, even though as you correctly expected the row and column derivates can be computed via 1D kernels, the averaging function being utilized into, renders them to be 2D.  &lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2016-02-15T02:40:36.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28876" PostTypeId="1" CreationDate="2016-02-15T03:18:57.347" Score="4" ViewCount="758" Body="&lt;p&gt;What I mean by passivity of impulse response is that the energy of impulse response for this system is less than the input impulse signal energy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in a discrete-time system, considering the impulse response, the input is Kronecker delta function $δ[n]$, and the output is the impulse response $h[n]$. Suppose that &#xA;$$&#xA;h[n]=\sqrt2/2 , n=1,2&#xA;$$&#xA;and $h[n]$ is 0 for any other components. In discrete-time system, We calculate the energy of the signal with&#xA;$$&#xA;Energy = \sum_{n=-\infty}^{\infty} |h(n)|^2&#xA;$$&#xA;Therefore, the energy of the impulse response is 1, and the input signal energy($δ[n]$) is also 1, which means the system is passive for this input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then considering another input signal $δ[n] + δ[n-1]$, the energy of this input is 2. The output can be derived by convolution of impulse response and this input signal. We get:&#xA;$$&#xA;y[n]=\sqrt2/2 , n=1,3&#xA;$$&#xA;$$&#xA;y[n]=\sqrt2 , n=2&#xA;$$&#xA;and $y[n]$ is 0 for any other components. The energy of this output is 3, larger than the input energy. Therefore, It seems that the passive impulse response doesn't necessarily  make a system passive. But if a system is passive, the impulse response of the system should always be passive. Am I right with this conclusion? or can anyone give a rigorous proof for this?&lt;/p&gt;&#xA;" OwnerUserId="19001" LastEditorUserId="19001" LastEditDate="2016-02-15T19:56:13.503" LastActivityDate="2016-02-15T19:56:13.503" Title="What is the relationship between passivity of impulse response and passivity of the system?" Tags="|discrete-signals|convolution|impulse-response|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28879" PostTypeId="1" AcceptedAnswerId="28882" CreationDate="2016-02-15T06:48:35.217" Score="0" ViewCount="1013" Body="&lt;p&gt;I recorded this signal at 2.45GHz, it is coming from a camera.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this QAM or OFDM ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on those side-lobes I would guess OFDM but I am not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also there seems to be an interesting preamble at the top. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XP7Z2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XP7Z2.png&quot; alt=&quot;PSD of the RX signal as shown by GNU Radio Qt GUI frequency sink&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KPgVP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KPgVP.png&quot; alt=&quot;spectrogram (vertically running) of the RX signal as shown by GNU Radio Qt GUI waterfall sink&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19066" LastEditorUserId="13320" LastEditDate="2016-02-15T10:09:38.543" LastActivityDate="2016-02-15T10:09:38.543" Title="Is this waterfall characteristic of QAM or OFDM (or something other) modulation?" Tags="|signal-analysis|modulation|ofdm|spectrogram|signal-identification|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28880" PostTypeId="2" ParentId="18476" CreationDate="2016-02-15T06:59:43.583" Score="0" Body="&lt;p&gt;It is indeed possible (up to a period), with complex &quot;continuous&quot; wavelet transforms, provide your mother wavelet ooscillate sufficiently. You can look at the scalogram modulus and its phase at the appropriate scales, as illustrated from &lt;a href=&quot;http://fr.mathworks.com/help/wavelet/examples/wavelet-coherence.html?refresh=true&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab: Wavelet coherence&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6D9n4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6D9n4.png&quot; alt=&quot;Wavelet coherence&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can convert your signal into an analytic one (using the Hilbert transform) and perform a real wavelet analysis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you might dig into other linear (short-term Fourier transform) or bilinear time-frequency (Wgner-Ville, Choi-Williams) or time-scale tools.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-15T06:59:43.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28881" PostTypeId="2" ParentId="28876" CreationDate="2016-02-15T09:02:34.920" Score="9" Body="&lt;p&gt;Let me clarify some definitions first. There is no such thing as a &quot;passive impulse response&quot;, there are only passive &lt;em&gt;systems&lt;/em&gt;. If you like, you can call the impulse response of a passive LTI system &quot;passive&quot;, but that's not common usage. From what I understand from your question, you probably mean by a &quot;passive impulse response&quot; an impulse response $h[n]$ that satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}|h[n]|^2\le 1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e., an impulse response with energy not greater than $1$. However, as you've shown yourself in an example, this is not sufficient for the corresponding system to be passive. Let's use the following definition of passivity [1]:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A discrete-time system is said to be &lt;em&gt;passive&lt;/em&gt; if, for every finite energy input sequence $x[n]$, the output sequence $y[n]$ has, at most, the same energy, i.e.,&#xA;  $$\sum_{n=-\infty}^{\infty}|y[n]|^2\le\sum_{n=-\infty}^{\infty}|x[n]|^2\tag{2}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is more straightforward to investigate the passivity of a linear and time-invariant discrete-time system in the frequency domain than in the time domain. Let $H(e^{j\omega})$ be the frequency response corresponding to the impulse response $h[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega})=\sum_{n=-\infty}^{\infty}h[n]e^{-jn\omega}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the Fourier transforms of the input and output sequences are related by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(e^{j\omega})=H(e^{j\omega})X(e^{j\omega})\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the condition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|Y(e^{j\omega})|^2\le |X(e^{j\omega})|^2\quad\text{for all }\omega\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;holds if and only if $H(e^{j\omega})$ satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|H(e^{j\omega})|\le 1\quad\text{for all }\omega\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integrating $(5)$ gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi}\int_{-\pi}^{\pi}|Y(e^{j\omega})|^2\le \frac{1}{2\pi}\int_{-\pi}^{\pi}|X(e^{j\omega})|^2d\omega\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which it follows via Parseval's theorem that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{n=-\infty}^{\infty}|y[n]|^2\le\sum_{n=-\infty}^{\infty}|x[n]|^2\tag{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;must hold. So it is not condition $(1)$ which makes a system passive, but condition $(6)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A causal and stable transfer function with real coefficients satisfying $(6)$ is called a &lt;em&gt;bounded real transfer function&lt;/em&gt; [2]. This type of transfer function is important for the realization of low-sensitivity digital filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;[1] S.K. Mitra, &lt;em&gt;Digital Signal Processing, A Computer-Based Approach,&lt;/em&gt; 2nd ed., p. 70&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] P.P. Vaidyanathan and Mitra, S.K., &lt;em&gt;Low Passband Sensitivity Digital Filters: A Generalized Viewpoint and Synthesis Procedures&lt;/em&gt;, Proc. IEEE, vol. 72, no. 4, April 1984, pp. 404-423.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-15T09:02:34.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28882" PostTypeId="2" ParentId="28879" CreationDate="2016-02-15T09:19:23.913" Score="3" Body="&lt;p&gt;The sharp rectangular shape of the spectrum, with the immensely flat top definitely says &quot;OFDM, with suitable whitening/PAPR reduction&quot;; what constellation is used on the individual carriers is a bit hard to tell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you, with a no-samples-left-out spectrogram (e.g. gr-fosphor sink, or by playing back your recorded file slower and using a suitably high update rate and suitable low number of FFT points in your QT waterfall sink, determine how long the OFDM &quot;burst&quot; is?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a bunch of samples from the end, and a bunch of samples from the start (like, one fourth of the burst duration), and calculate a cross-correlation. The maximum correlation should give you the time when what is used as the cyclic prefix at the end of the burst starts; that way, you'll be able to make an educated guess at the symbol number that makes up the CP, and by that the OFDM symbol length/IFFT size. Take frame, and try to manually resample it, so that both CP starts are exactly that (guessed) IFFT size apart. FFT the hell out of the frame; because your resampling had the purpose of time-stretching your signal so that the length of it actually (hopefully) matches the transmitter's sampling, you'd have a timing-synced demodulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at the spectrum and the constellation plot of the resulting signal; maybe you can already guess the constellation used to modulate the OFDM subcarriers from that.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-15T09:19:23.913" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28885" PostTypeId="2" ParentId="25312" CreationDate="2016-02-15T14:58:03.247" Score="1" Body="&lt;p&gt;The answer depends on the signal to noise ratio and whether the signal is a single sinusoid that is integer periodic in a window that number of samples in length.  Or perhaps a number of pure integer periodic sinusoids that is low enough compared to N/2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The a-priori bandwidth of the signal would also need to be small enough with respect to the number of samples, otherwise aliasing ambiguity leads to phase ambiguity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Hilbert transform doesn't magically add information to frequency estimation methods.  And frequency estimation errors lead to phase estimation errors.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-02-15T15:08:53.647" LastActivityDate="2016-02-15T15:08:53.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28886" PostTypeId="1" CreationDate="2016-02-15T19:48:02.147" Score="0" ViewCount="277" Body="&lt;p&gt;I am working on the localization problem of an underwater vehicle. However the problem is still in very simple and it does not matter that it is about underwater.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I use the EKF when I have multiple measurements but with different sampling? Not all the measurements are available at the same time to perform the update step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I perform the update for the measurements that I have at each time step? For example, I have a pressure sensor and a speed sensor with frequency $1$ Hz. But I have also another sensor (USBL) system with $0.01$ Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if I perform update step for pressure and speed sensor at each time step adjusting the measurement model to that case (like I have only these sensors) and once I receive the USBL measurement I augment the measurement vector including the USBL measurement?&lt;/p&gt;&#xA;" OwnerDisplayName="user19571" LastEditorUserId="15892" LastEditDate="2016-02-15T21:16:19.850" LastActivityDate="2016-02-15T21:16:19.850" Title="Extended Kalman filter (EKF)" Tags="|kalman-filters|resampling|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28889" PostTypeId="2" ParentId="2347" CreationDate="2016-02-16T04:57:07.760" Score="-1" Body="&lt;p&gt;I am working on the Kalman Filter (KF) algorithm. I observed that the kalman gain deals with convergence of algorithm with time, that is, how fast the algorithm corrects and minimizes the residual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming to the equation choose an initial kalman gain value and vary it from low to high, that can give you an approximated one.&lt;/p&gt;&#xA;" OwnerUserId="19574" LastEditorUserId="1212" LastEditDate="2016-02-16T11:33:43.697" LastActivityDate="2016-02-16T11:33:43.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28891" PostTypeId="1" AcceptedAnswerId="28894" CreationDate="2016-02-16T10:06:36.373" Score="0" ViewCount="115" Body="&lt;p&gt;An analog signal $x(t)$ was sampled for a period $T$ of $1 \text{ms}$. The resulting, discrete signal is denoted as $x[n]$. Now you are given the spectrum $X[k]$ of the sampled signal $x[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doubts regarding the attached images 1 &amp;amp; 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please explain how this coefficients and signs for sin and cos term are considered??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QNbhx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QNbhx.png&quot; alt=&quot;Im 1&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rMpAj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rMpAj.png&quot; alt=&quot;Im 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19577" LastEditorUserId="1629" LastEditDate="2016-02-16T11:34:36.870" LastActivityDate="2016-02-16T13:07:54.290" Title="Discrete signals in spectrum to Analog : DFT" Tags="|dft|" AnswerCount="1" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28892" PostTypeId="1" AcceptedAnswerId="28896" CreationDate="2016-02-16T10:09:47.007" Score="1" ViewCount="235" Body="&lt;p&gt;Text of my exercise request:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Determine the transfer function $H(z)$ of a causal linear phase FIR filter with zeros at $z= \frac{1}{3}$ and $z=-2$. The value of the impulse response at $n=0$ equals $2$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I calculated $H ( z )$, taking into account the zeros and their inverses (due to the linear phase property): $$H(z)= k(z^{-1}-3) (z^{-1}-\frac {1}{3})(z^{-1}+ \frac{1}2)(z^{-1}+2)$$&#xA;intermediate steps of the multiplication, take me&#xA;$$  H(z) = k (z^{-4} - \frac{5}{6}z^{-3} - \frac{19}{3}z^{-2} -\frac{5}{6}z^{-1}+1) $$ &#xA;and finally $$ h(0) = k=2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but what is the corresponding DFT? I think it's a 5-point DFT, but I do not know calculate it, I just say that&#xA;$$H(K)=H(z) _{|z= e^{\frac{j2 \pi k }{5}}}$$ &#xA;but it would be necessary to do the calculations?&lt;/p&gt;&#xA;" OwnerUserId="18327" LastEditorUserId="13320" LastEditDate="2016-02-16T13:20:29.527" LastActivityDate="2016-02-17T10:47:03.887" Title="Transfer function of linear phase filter &amp; its frequency domain representation" Tags="|dft|linear-phase|" AnswerCount="3" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="28894" PostTypeId="2" ParentId="28891" CreationDate="2016-02-16T10:34:15.013" Score="1" Body="&lt;p&gt;For signal 1 ($x_1(t)$) :&#xA;The Fourier's transform ($F(f)$) of $Acos(2\pi ft)$ is $\frac{A}{2}(\delta(f-f_0)+\delta(f+f_0))$ and for $Asin(2\pi ft)$ it's $\frac{jA}{2}(\delta(f-f_0)-\delta(f+f_0))$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replacing frequencies and amplitudes with the appropriate ones, the Fourier's transform of $x_1(t)$ is :&#xA;$$&#xA;F(f) = \delta(f-3000 Hz)+\delta(f+3000 Hz)+\frac{j}{2}\left(\delta(f-2000 Hz)-\delta(f+2000 Hz)\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the observed Diracs on fig. 1. You did not scale your axis according to the fft sampling while plotting it so the frequency does not appear clearly. The amplitudes are respectively 4 and 8 which is the right ratio so I guess you also did not scale the fft result (matlab doesnt do it itself), it should be 0.5 and 1 according to what I calculated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For signal 2 it works the same way&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit : there is a mistake in the sampling frequency (1 kHz) you mention. To fit the graphs properly (and respect Shanon) it should be 8 KHz.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="19532" LastEditDate="2016-02-16T13:07:54.290" LastActivityDate="2016-02-16T13:07:54.290" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28896" PostTypeId="2" ParentId="28892" CreationDate="2016-02-16T12:31:45.263" Score="1" Body="&lt;p&gt;You finally have changed your $H(z)$ and added a qualifier &quot;linear phase&quot; , so is the new answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assuming that you have already determined $H(z)$ from the problem specifications, so the rest of obtaining DFT $H[k]$ can be approached in a number of ways one of which (perhaps longer than necessary) is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the linearity and shift properties of the Z-Transform, we can show that that if a given signal $x[n]$ is of the form $$x[n] = a\delta[n] + b\delta[n-1] + c\delta[n-k]$$ then its Z-Transform is of the form: $$X(z) = a + b z^{-1} + c z^{-k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying this observation, in the reverse direction, to $H(z)$ in your problem we get a prototype for $h[n]$ as: $$h[n]=k(\delta[n] - {5\over6} \delta[n-1] - {19\over3} \delta[n-2] - {5\over6} \delta[n-3] + \delta[n-4])$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also as you state that $h[0]=2$, yields $k=2$, hence the signal $h[n]$ is: $$h[n]= 2\delta[n] - {5\over3} \delta[n-1] - {38\over3} \delta[n-2] - {5\over3} \delta[n-1] + 2\delta[n-4]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obtaining DFT $H[k]$ of this $h[n]$ is actually a very similar procedure to obtaining $H(z)$, you shall simply plug $e^{j{2\pi \over N} k}$ in place of $z$ where you simply get this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H[k]= 2 - {5\over3} e^{-j{2\pi \over N} k} - {38\over3} e^{-j{4\pi \over N} k} -{5\over3} e^{-j{6\pi \over N} k} + 2e^{-j{8\pi \over N} k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k$ ranges from $0$ to $N-1$ and plugging $N=5$ produces:&#xA;$$H[k]= 2 - {5\over3} e^{-j{2\pi \over 5} k} - {38\over3} e^{-j{4\pi \over 5} k} -{5\over3} e^{-j{6\pi \over 5} k} + 2e^{-j{8\pi \over 5} k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that eventhough it is perfectly valid to state that, under suitable conditions, $H[k]=H(z)$ evaluated at $z=e^{j{2\pi\over N} k}$ , I guess it does not make an answer...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-02-16T13:22:08.943" LastActivityDate="2016-02-16T13:22:08.943" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28897" PostTypeId="2" ParentId="28892" CreationDate="2016-02-16T12:32:34.107" Score="1" Body="&lt;p&gt;Since this appears to be homework, I'll give you a few hints how to arrive at the correct solution. You got the zeros right: since it's a linear phase filter, the zeros appear mirrored across the unit circle; they are at $z=1/3$, $z=3$, $z=-2$, and $z=-1/2$. You clearly made an error multiplying the terms. There should be a term with $z^{-3}$. And also note that the coefficients for $z^{-1}$ and $z^{-3}$ must be identical, because due to the linear phase property the impulse response must be symmetrical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the DFT, take the definitions of the $\mathcal{Z}$-transform and of the length-$N$ DFT, and show that the length-$N$ DFT can be expressed easily in terms of $H(z)$, for any $N\ge 5$. Also here you were close but there's again something wrong in the details (note that you suggested to sample $H(z)$ at $z=e^{j2\pi nk/N}$, but what do those two variables $n$ and $k$ mean? You should probably get rid of one of them.)&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-16T12:32:34.107" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28898" PostTypeId="1" AcceptedAnswerId="28900" CreationDate="2016-02-16T16:00:06.667" Score="4" ViewCount="11992" Body="&lt;p&gt;I have been doing some readings on the computation of Mel-Frequency Cepstral Coefficients (MFCC) and further use of Vector Quantizers (VQ) for recognition purposes. I am however stumped by the method of computation for those MFCCs regarding the number of suggested frequency bands. For example, why is the recommended number of mel filterbank filters 20 -40? Why do we eventually end up with 13 coefficients and not 40 as will have been found from the 40 log energies we shall calculate?&lt;/p&gt;&#xA;" OwnerUserId="19582" LastEditorUserId="8202" LastEditDate="2016-02-17T09:43:57.980" LastActivityDate="2022-05-19T23:56:17.607" Title="MFCC - Significance of number of features" Tags="|mfcc|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28899" PostTypeId="1" CreationDate="2016-02-16T17:51:40.237" Score="1" ViewCount="419" Body="&lt;p&gt;I wrote a wavetable oscillator that scans a file and extracts grains etc. The sound doesnt seem clear and I think it has aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are ways to be able to play the audio file at any frequency without aliasing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there should be interpolation, is there any specific type of interpolation that is better suited for recorded audio files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other techniques to reduce this aliasing during playback?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to visualize how an audio file at any frequency, that is played back at different frequencies by jumping samples during indexing, aliases back into the waveform, and what depth of interpolation is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will scanning an audio file at higher frequencies cause aliasing due to index jumping, or is it rather precision loss? If the audio is already recorded, without aliasing, 44khz sample rate, bandwidth of 22khz and playback rate up to +6 octaves, is the aliasing added inside the real time signal?&lt;/p&gt;&#xA;" OwnerUserId="4602" LastEditorUserId="4602" LastEditDate="2016-02-16T19:04:49.720" LastActivityDate="2016-02-17T00:27:07.743" Title="Aliasing in wave-scanning oscillator" Tags="|audio|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28900" PostTypeId="2" ParentId="28898" CreationDate="2016-02-16T18:44:26.600" Score="6" Body="&lt;h1&gt;Number of filter banks&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;One of the last steps in the MFCC's calculation is measuring the energy in the filter banks. We do that because want to reduce the dimensionality of our input vector (amplitude spectrum), as well as capture its envelope. Those triangular filters are spaced over the Mel scale:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5d6mA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5d6mA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that we have very good resolution in low frequencies. Exactly opposite is true for higher frequencies. We do that because MFCC's are suited for speech-related tasks and most of the information is located in lower frequencies (i.e. formants). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how many filter banks do we actually want? For example HTK by default is using 20 filter banks. You might increase that number, especially if you are dealing with signals that contain a lot of closely spaced frequencies and you want to resolve them between each other. It's totally up to you - in the end what really matters is the classification performance. &lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Number of coefficients&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;After taking the logarithm of energies in each filter bank, the last step (or second last if you are doing some liftering) is to calculate the Mel Frequency Cepstral Coefficients. We do that by fitting the cosines to calculated log energies using the DCT. This captures the periodicity in the reduced spectrum. Figure below should help you in understanding that process. You can imagine that for number of coefficients equal to number of filter banks this would correspond to capturing the alternating energy between each of the filter banks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DuIB4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DuIB4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how many MFCC's do we want to calculate? HTK by default uses 12 and in most applications it is more than enough. In general we don't want too many coefficients because:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It's all about reducing the dimensionality of our feature space.&lt;/li&gt;&#xA;&lt;li&gt;One DCT properties is that it de-correlates and keeps most of the information in first few coefficients.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Again it all depends on your application and you should adjust this number based on the recognition performance. From my experience the gain from increasing the number of MFCC's was negligible compared to introducing the $\Delta$ and $\Delta\Delta$ coefficients. &lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2016-02-20T09:34:27.757" LastActivityDate="2016-02-20T09:34:27.757" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28901" PostTypeId="2" ParentId="28899" CreationDate="2016-02-16T19:38:24.747" Score="3" Body="&lt;p&gt;You don't seem to fully understand what wavetable synthesis / scanning with higher jump lengths than the original signal was sampled with is &lt;em&gt;meant&lt;/em&gt; to be doing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course you will see aliasing; but that's the whole point!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to actually resample the original signal, you would have to implement a $\frac 1M$-band lowpass filter to avoid signal from higher frequencies alias into yours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, with wavetable synthesis, you normally strive to get exactly these spectral repitions, allowing you to not only generate higher frequency versions of the original signal, but also lower frequency versions of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose you have a $f_{signal}=100\,\text{Hz}$ signal that you sample with $f_{sample}=16\,\text{kHz}$ for a full period, ie. you get 160 samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0lAf4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0lAf4.png&quot; alt=&quot;signal:100Hz f_sample:16kHz&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you take that wavetable and go through it with a jump size of $M=2$, and play back the resulting signal with a 16kHz DAC. Of course, your full period will now only be 5 samples long, and your signal will have a frequency of $\frac{f_{signal}}{M}=200\,\text{Hz}$. Obviously, that would also work for jump sizes like $M=4$ or $M=16$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q6czl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q6czl.png&quot; alt=&quot;undersampling&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose you have another wavetable, again thought to be sampled at 16kHz, and you got a 5kHz sine in there:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WkNdx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WkNdx.png&quot; alt=&quot;undersampling and aliasing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, $M=4$ undersampling leads to a &lt;strong&gt;lower&lt;/strong&gt; frequency, instead of a higher one, &lt;em&gt;due to desired aliasing&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-16T19:38:24.747" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28902" PostTypeId="2" ParentId="28899" CreationDate="2016-02-16T20:32:44.933" Score="4" Body="&lt;p&gt;i am a little confused by the first sentence. i dunno how a wavetable oscillator &lt;strong&gt;scans&lt;/strong&gt; a sound file at all. some algorithm can scan a file and extract either grains (or little &quot;wavelets&quot;, which is a term i have misused in the past) or single-cycle wavetable &quot;snapshots&quot;. but the wavetable oscillator starts with wavetable(s) and outputs a periodic or quasiperiodic tone.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;about aliasing, if you extract wavetables from a real tone (and let's assume you have a decent pitch detector, so you know how long each period is to a precision of fraction of sample, and decent interpolation, so you you can resample the period to a, say, 256 or 1024 point wavetable) and you up-pitch the tone by more than a couple of semitones, there is a danger of aliasing unless you remove some of the higher harmonics. you can remove these higher harmonics by performing a DFT (a.k.a. FFT) on the wavetable and zero some of the bins centered around bin N/2 . then inverse DFT back to a wavetable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;actually, the number of bins centered around bin N/2 that are already zero is dependent on the degree of upsampling in the interpolation when the period in the soundfile is converted into a wavetable.  consider this example:  suppose the sample rate of the sound file is 44100 Hz and you have a note that is at middle C, with a fundamental at 261.6255653 Hz.  this means that your period length is 168.5615 samples and a really good pitch detector can return a period value with that precision (even though i doubt it would be that &lt;strong&gt;accurate&lt;/strong&gt;, precision and accuracy are different things).  now a 128-sample wavetable would be insufficient to represent that waveform, or at least &lt;em&gt;possibly&lt;/em&gt; insufficient to represent &lt;strong&gt;all&lt;/strong&gt; of the harmonics of that waveform.  there are conceptually 84 harmonics.  a 256-samplewavetable &lt;em&gt;would&lt;/em&gt; be sufficient to represent all of the harmonics, but let's say, for playback reasons, you resample that 168.5615 sample period to a 1024-sample wavetable, $x[n]$.  that means you have a step size (the reciprocal of the sample-rate-conversion ratio) of 168.5615/1024 = 0.16461084 .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, if you were to FFT that 1024-sample wavetable, you would possibly have non-zero bins for $X[0]$ up to $X[84]$ (and also the mirror image of $X[1024-84]$ up to $X[1023]$ .  all of the bins from $X[85]$ to $X[1024-85]$ should be zero if the interpolation kernel was any good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, when you play that wavetable back at the same note, middle C, then the sample stride would be the reciprocal of the step size above, or 6.074934 wavetable samples per output sample (assuming the same 44100 Hz sample rate).  and you would have no aliasing because all of those harmonics above the 84th harmonic are zero.  but if you start pitching that note higher, your stride will be longer.  if you pitched it 7 semitones higher (to G), then the stride would be 9.1021167 wavetable samples per output sample.  but then your 84th harmonic gets bumped up to around 33 kHz which is above Nyquist and you will have aliasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so what you need to do, if you plan to pitch that note up 7 semitones (i would not pitch a sampled piano up that far, because it will sound &quot;plinky&quot;), you must &lt;strong&gt;lose&lt;/strong&gt; all of those harmonics above the 56th harmonic.  ($56 \approx 84 \times 2^{-7/12} $).  you do that with the FFT, zeroing bins, and then inverse FFT&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-02-16T20:41:11.947" LastActivityDate="2016-02-16T20:41:11.947" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28903" PostTypeId="1" CreationDate="2016-02-16T22:40:20.553" Score="0" ViewCount="563" Body="&lt;p&gt;I am sampling short bursts of signal (20ms length) in 30ms buffers in time domain.&#xA;The 30ms buffer consists from 4096 I/Q samples from which roughly 2550 cover the actual signal. Now I do in-place FFT on that.&#xA;If carrier signal is in the sampled data then it is found by FFT but the power of frequency bin varies depending where inside of the samples the actual signal is located.&#xA;If I have more noise after signal then FFT power is higher, if I have more before signal then it is weaker. &#xA;How I can overcome this problem ? I understand FFT will interpolate signal over the noise samples in this case.&#xA;I would like to have the same FFT power for signal frequency despite of location inside the processed samples.&#xA;Thanks&#xA;Michal&lt;/p&gt;&#xA;" OwnerUserId="19584" LastActivityDate="2016-02-17T15:41:57.457" Title="FFT results for short burst of signal" Tags="|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28904" PostTypeId="2" ParentId="28903" CreationDate="2016-02-16T23:43:31.153" Score="1" Body="&lt;p&gt;Eventhough you are asking for an answer about your problem with FFT usage, It seems to me, based on your definition of what you are looking for (detecting the presence of a carrier -a known signal?- inside a buffer of 4096 samples) that you would better use a &quot;matched-filter&quot; to detect the presence of that carrier, a known signal, inside the noisy 30ms measurement buffer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course FFT would still help especially for high SNR cases, but for noisy data, matched filter is the optimal choice (under suitable conditions). And I have never heard of FFT by itself reducing noise. May be I am wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement a matched-filter, you would simply convolve the time reversed carrier signal with the noisy observation and look for a thresholded peak.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-02-17T15:41:57.457" LastActivityDate="2016-02-17T15:41:57.457" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="28905" PostTypeId="2" ParentId="28899" CreationDate="2016-02-17T00:27:07.743" Score="1" Body="&lt;p&gt;It appears that you might be trying to play a segment of a sound file at a wide range of varying rates by skipping or repeating samples (which can sound terrible), instead of by interpolating samples using a windowed Sinc interpolation kernel of a suitable width.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also have put a confusing title on your question.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-17T00:27:07.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28906" PostTypeId="2" ParentId="28667" CreationDate="2016-02-17T01:55:44.240" Score="0" Body="&lt;p&gt;I was stuck on the assumption that the destination points in the call to &lt;code&gt;getPerspectiveTransform&lt;/code&gt; had to be the corners of the output image. Once it dawned on me that the destination points could be somewhere within the output image I had my answer.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float boardX = 1240;&#xA;float boardY = 1570;&#xA;float boardWidth = 1730;&#xA;float boardHeight = 1400;&#xA;&#xA;vector&amp;lt;Point2f&amp;gt; destinationCorners;&#xA;destinationCorners(Point2f(boardX+boardWidth, boardY));&#xA;destinationCorners(Point2f(boardX+boardWidth, boardY+boardHeight));&#xA;destinationCorners(Point2f(boardX, boardY+boardHeight));&#xA;destinationCorners(Point2f(boardX, boardY));&#xA;&#xA;Mat h = getPerspectiveTransform(detectedCorners, destinationCorners);&#xA;&#xA;Mat bigImage(image.size() * 3, image.type(), Scalar(0, 50, 50));&#xA;&#xA;warpPerspective(image, bigImage, h, bigImage.size());&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This fixed the perspective of the board and everything in its plane. (The waviness of the board is due to the fact that the paper wasn't lying flat in the original photo.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xGRXi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xGRXi.jpg&quot; alt=&quot;corrected perspective&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19407" LastActivityDate="2016-02-17T01:55:44.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28907" PostTypeId="2" ParentId="700" CreationDate="2016-02-17T03:08:27.290" Score="2" Body="&lt;p&gt;Your question has received quite few contributions, probably because of a lacking content. During a recent conference , I came across the PhD thesis: &lt;a href=&quot;https://tel.archives-ouvertes.fr/tel-00174276/document&quot; rel=&quot;nofollow&quot;&gt;Détection en Environnement non Gaussien&lt;/a&gt; (&lt;a href=&quot;https://tel.archives-ouvertes.fr/tel-00174276/en/&quot; rel=&quot;nofollow&quot;&gt;Detection in a non-Gaussian environment&lt;/a&gt;). Since it is in French, I reproduce the abstract here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For a long time, radar echoes coming from the various returns of the&#xA;  transmitted signal on many objects of the environment (clutter) have&#xA;  been exclusively modelled by Gaussian vectors. The related optimal&#xA;  detection procedure was then performed by the classical matched&#xA;  filter. Then, the technological improvement of radar systems showed&#xA;  that the true nature of the clutter could not be considered as&#xA;  Gaussian any more. Though the optimality of the matched filter is no&#xA;  more valid in such cases, CFAR techniques (Constant False Alarm Rate)&#xA;  were proposed for this detector in order to adapt the value of the&#xA;  detection threshold to the multiple local variations of the clutter.&#xA;  In spite of their diversity, none of these techniques turned to be&#xA;  either robust or optimal in these situations. With the modelling of&#xA;  the clutter by non-Gaussian complex processes, such as SIRP&#xA;  (Spherically Invariant Random Process), optimal structures of coherent&#xA;  detection have been found. These models describe many non-Gaussian&#xA;  laws, like K-distribution or Weibull laws, and are acknowledged in the&#xA;  literature to model many experimental situations in a relevant way. To&#xA;  identify the law of their characteristic component (namely the&#xA;  texture) without statistical a priori on the model, we propose, in&#xA;  this thesis, to tackle the problem by a Bayesian approach. Two new&#xA;  estimation methods of the texture law emerge from this proposition:&#xA;  the first one is a parametric method, based on a Padé approximation of&#xA;  the moment generating function, and the second one results from a&#xA;  Monte Carlo estimation. These estimations are carried out on reference&#xA;  clutter data and lead to two new optimal detection strategies,&#xA;  respectively named PEOD (Padé Estimated Optimum Detector) and BORD&#xA;  (Bayesian Optimum Detector Radar). The asymptotic expression of the&#xA;  BORD (convergence in law), called the &quot;Asymptotic BORD&quot;, is&#xA;  established together with its law. This last result gives access to&#xA;  the optimal theoretical performances of the Asymptotic BORD, and may&#xA;  also applied to the BORD if the data correlation matrix is&#xA;  non-singular. The detection performances of BORD and those of&#xA;  Asymptotic BORD are evaluated on experimental ground clutter data. We&#xA;  obtained results that validate both the relevance of SIRP model for&#xA;  the clutter, the optimality of the BORD and its adaptability to any&#xA;  type of environment.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The math should be readable. If it is of any help, you can track English reference by the author or PhD thesis committee.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-17T03:08:27.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28909" PostTypeId="2" ParentId="19755" CreationDate="2016-02-17T05:07:07.033" Score="1" Body="&lt;p&gt;JPEG doesn't remove the high-frequency components of an image.  It quantizes them more coarsely, allowing them to be represented in fewer bits.  A lot of the high-frequency components are close enough to zero that they'll round to zero when quantized, and these are compressed even more efficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you equalize the image or perform other operations that enhance the high-frequency content, you make those components larger compared to the quantization steps.  They will be represented with larger numbers, and &lt;em&gt;more&lt;/em&gt; of the high-frequency information will be preserved.  In addition, fewer of the high-frequency components will come out to zero, which will significantly increase the size of the compressed image.&lt;/p&gt;&#xA;" OwnerUserId="19432" LastActivityDate="2016-02-17T05:07:07.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28910" PostTypeId="2" ParentId="25323" CreationDate="2016-02-17T07:57:04.303" Score="0" Body="&lt;p&gt;This is a statistics question and should not be asked here. But I will try to answer the question as best as I can (it won't be the best answer). First off, I don't see what the phenomenon you are observing has to do with frequency response or LPFs. Low pass filters makes data smoother, which is not what you have. Instead you have a situation, where estimate for one set of data differs greatly from a other set of data. The OLS estimator also is not an MA process, the formula being cov(x,y)/var(x). The filter described in the paper is not a linear time invariant filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, if you regress a line on white noise process or linearly growing process, the regression line should not change slope significantly as more data is gathered. Instead as the amount of data grows you should be more certain of that the coefficient is right, generating greater variance for the rolling process, but on average the slope should be right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have here is not a process that satisfies Gauss Markov assumptions. As can easily be seen the expected value of the error is not zero, and there is heavy auto correlation. This means that the error term is correlated with the independent variable, producing a biased estimate. Besides that the data is not randomly selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most importantly, the data is increasing as a function of time. This generates a so called spurious correlation. Since Y increases faster than X as time passes, the beta becomes upwardly biased. You can model autocorrelation with an MA process, but this is not really important...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure statistics stackexchange (crossvalidated) would provide you with much more mathematically precise answer and a better explanation of what the phenomenon. One thing fix that might help is to difference both of the variables, which changes the autocorrelation structure of the error. This can be equally viewed as a (1-1) MA process applied to both of the variables, which is a comb filter at a high frequency, producing a high pass filter below the nyquist frequency. But the data has such a non-standard structure that I wouldn't be so sure that the fix will help you.&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="16605" LastEditDate="2016-02-17T15:28:15.813" LastActivityDate="2016-02-17T15:28:15.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28911" PostTypeId="1" CreationDate="2016-02-17T08:17:38.367" Score="2" ViewCount="179" Body="&lt;p&gt;Generalized/power means may be used to construct &lt;strong&gt;moving-average&lt;/strong&gt; filters with different properties than regular one which is based on arithmetic mean. This observation seems to be trivial - even Wikipedia mentions that. &#xA;The problem is that power means are usually defined for sets of positive numbers - while in DSP we often deal with negative numbers too. Therefore, many of well-known inequalities and properties of power means may not be applied to sets with negative numbers.&#xA;&lt;br/&gt;&lt;br/&gt;&#xA;This is of interest to me since I have found that in my partical area of application power means of higher order give better results than arithmetic mean. I have been able to prove some basic properties and I more or less understand where does the improvement come from. However, I would be interested in learning. However, everything I have found seems to focus on positive numbers. So my question is:&lt;br/&gt;&lt;br/&gt;&#xA;&lt;strong&gt;Are there any papers on using generalized means for moving average filtering or some other signal processing?&lt;/strong&gt; Any papers on purely mathematical properties of generalized means for sets with negative values may be relevant too. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="19589" LastActivityDate="2017-09-10T21:41:35.760" Title="Generalized/Power means in DSP" Tags="|moving-average|averaging|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28912" PostTypeId="2" ParentId="28911" CreationDate="2016-02-17T10:12:58.633" Score="1" Body="&lt;p&gt;Certain varieties of generalized means have been applied in signal processing, such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lehmer_mean#Applications&quot; rel=&quot;nofollow&quot;&gt;Lehmer mean&lt;/a&gt;. &lt;a href=&quot;http://arxiv.org/pdf/1408.0328.pdf&quot; rel=&quot;nofollow&quot;&gt;This paper&lt;/a&gt; discusses several generalized means, mainly from a theoretical point of view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, however, that all applications of generalized means deal with signals that are inherently non-negative. This is also the case in signal processing, where there are many applications with non-negative signals, such as frequency domain denoising, image processing, fuzzy logic, etc. The application of generalized means in image processing is discussed in &lt;a href=&quot;http://dro.deakin.edu.au/eserv/DU:30067486/wilkin-weakly-2014A.pdf&quot; rel=&quot;nofollow&quot;&gt;this thesis&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that rather than looking for new definitions of generalized means for bipolar signals, it is probably more useful to define the signals properly such that generalized means can be applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A completely different alternative to generalized means might be general non-linear filters, such as Volterra filters, which don't have the restriction that the input signal must be non-negative.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-17T10:12:58.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28913" PostTypeId="2" ParentId="28892" CreationDate="2016-02-17T10:20:33.697" Score="0" Body="&lt;p&gt;Once you determine the form of the Z-transform, in order to get the DFT, you just need to put $z=\exp(j2\pi/N)$. &#xA;But my question is: is it typical to request the values of the values of the DFT for each given $k$? It's not a big deal but it doesn't seem so easy to do if you have a 5-point sequence (unless you use a great calculator of course) &lt;/p&gt;&#xA;" OwnerUserId="19592" LastEditorUserId="8202" LastEditDate="2016-02-17T10:47:03.887" LastActivityDate="2016-02-17T10:47:03.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28915" PostTypeId="1" CreationDate="2016-02-17T11:31:24.393" Score="1" ViewCount="3983" Body="&lt;p&gt;For digital images, noise is assumed to be additive gaussian white noise. I remember noise in images is considered as high frequency. However, from the link&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/White_noise&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/White_noise&lt;/a&gt;, it says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a random signal is considered &quot;white noise&quot; if it is observed to have&#xA;  a flat spectrum over the range of frequencies that is relevant to the&#xA;  context.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does it mean frequencies of noise will extend from low frequencies to high frequencies? Why do we try to only remove high frequency component? Is human visual system  not sensitive to low frequency noise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the same link, &lt;a href=&quot;https://en.wikipedia.org/wiki/White_noise&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/White_noise&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In digital image processing, the pixels of a white noise image are&#xA;  typically arranged in a rectangular grid, and are assumed to be&#xA;  independent random variables with uniform probability distribution&#xA;  over some interval.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It reads that the pixels of a white noise image are assumed to be independent random variables with uniform probability distribution over some interval.&#xA;Does it mean that one pixel and its neighbors are i.i.d?&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2016-02-17T15:48:47.720" LastActivityDate="2016-02-17T15:48:47.720" Title="white noise in images" Tags="|noise|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28916" PostTypeId="2" ParentId="28915" CreationDate="2016-02-17T12:10:21.777" Score="2" Body="&lt;p&gt;Yes, the noise is wide-band. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A challenge in images resides in lowering the high-frequency noise components, while preserving the local high-frequency features of the contours and the textures, where you have fewer pixels to estimate a consistent denoised value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On low-frequency parts, the data is generally more regular or smooth, and getting rid of the noise is often performed more easily by averaging over neighboring pixels. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-17T12:10:21.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28917" PostTypeId="2" ParentId="28915" CreationDate="2016-02-17T13:53:49.913" Score="1" Body="&lt;p&gt;In addition to @Laurent's answer, images &lt;em&gt;tend&lt;/em&gt; to be low-pass. That is, their main frequency components tend to be in the lower end of the range.  That means that the effective SNR at those lower frequencies is not as much of an issue compared with the effective SNR at higher frequencies: white noise has more effect on high frequency features than it does on low frequency features.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-02-17T13:53:49.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28918" PostTypeId="1" CreationDate="2016-02-17T14:03:48.097" Score="1" ViewCount="861" Body="&lt;p&gt;I am working on a project where I am classifying coughs of a patient as either positive or negative for a certain pulmonary illness. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have at the moment is multiple cough events, segmented from larger recordings. I have extracted various spectral features for each cough event and want to add all of these to one feature vector to train a Logistic Regression (LR) classifier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that each cough event is different in length and this results in my Mel-Frequency Cepstrum Coefficients (MFCC) being different (in length) too, which is an issue when training the LR classifier.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I want to know if anyone has some fix for dealing with MFCC feature vectors of different sizes and how to get them in the correct shape to use as a training vector. I feel really stupid, but I can't find anything about this online. Surely this issue has been encountered before (?)&lt;/p&gt;&#xA;" OwnerUserId="19595" LastEditorUserId="19595" LastEditDate="2016-02-17T14:59:24.750" LastActivityDate="2016-05-17T16:52:18.957" Title="Dealing with MFCC Feature Vectors of different sizes" Tags="|mfcc|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28920" PostTypeId="1" CreationDate="2016-02-17T16:22:04.340" Score="4" ViewCount="8329" Body="&lt;p&gt;How does salt &amp;amp; pepper noise occur? And, what are some techniques to remove it?&lt;/p&gt;&#xA;" OwnerUserId="19597" LastEditorUserId="11256" LastEditDate="2016-02-17T17:28:36.707" LastActivityDate="2019-11-19T14:17:50.600" Title="How does salt and pepper noise occurs in an image" Tags="|image-processing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28921" PostTypeId="2" ParentId="28920" CreationDate="2016-02-17T16:53:02.070" Score="2" Body="&lt;p&gt;According to &lt;a href=&quot;https://en.wikipedia.org/wiki/Image_noise#Salt-and-pepper_noise&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;, salt-and-pepper noise is generated by errors during analog to digital conversion or data transfer. It can be corrected with median filtering.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastActivityDate="2016-02-17T16:53:02.070" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28923" PostTypeId="2" ParentId="28920" CreationDate="2016-02-17T18:28:40.437" Score="6" Body="&lt;p&gt;Salt-and-pepper noise is a form of noise sometimes seen on images. It presents itself as sparsely occurring white and black pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In another words ( in the sense of pixels), salt and pepper noise means that are high frequencies, so for salt noise the values of this noise type is high &lt;code&gt;(255 ... 200)&lt;/code&gt;, and for the pepper noise the values of this noise type is low &lt;code&gt;(5 ... 0)&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To salt noise there are good filters like harmonic mean filters&#xA;to salt and pepper noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;			\hat{f}(x,y) = \frac{mn}{\sum_{(s,t) \in S_{xy}}\frac{1}{g(s,t)} }&#xA;			$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are the contra harmonic filter that depends of a &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; argument, e.g., for salt noise &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; should be negative and for pepper Q should be positive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;			\hat{f}(x,y) = \frac{\sum_{(s,t) \in S_{xy}}g(s,t)^{Q+1}}{{\tiny\sum_{(s,t) \in S_{xy}}}g(s,t)^{Q} }&#xA;			$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another aproach is the order statistics filters, e.g., &lt;span class=&quot;math-container&quot;&gt;$\operatorname{max}$&lt;/span&gt;&#xA; filter are good for pepper noise, and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{min}$&lt;/span&gt; filter are good for salt noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{f}(x,y) = \operatorname{max}_{(s,t)\in S_{xy}}{g(s,t)}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{f}(x,y) = \operatorname{min}_{(s,t)\in S_{xy}}{g(s,t)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And another one is alpha trimmed filter that also are a order statistics filter type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{f}(x,y) = \frac{1}{mn-d}\sum_{(s,t) \in S_{x,y}} g_r(s,t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beside this there are Adaptive Mean Filter.&lt;/p&gt;&#xA;" OwnerUserId="17817" LastEditorUserId="-1" LastEditDate="2019-11-19T14:17:50.600" LastActivityDate="2019-11-19T14:17:50.600" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28924" PostTypeId="1" CreationDate="2016-02-17T19:10:38.913" Score="2" ViewCount="92" Body="&lt;p&gt;I am practicing for an exam and I need help in the following question (it is just for me- no grade...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we get an input image, 6 convolution filters and 6 results.&#xA;we need to find the matches between the filters to the result images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bucAP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bucAP.png&quot; alt=&quot;the question is here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so far I found that filter 3 matches to image D and filter 4 matches to image f.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now I stuck and I would appreciate any help.&#xA;thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; the origin of all the filters is in the center. &lt;/p&gt;&#xA;" OwnerUserId="19600" LastEditorUserId="19600" LastEditDate="2016-02-17T19:56:23.023" LastActivityDate="2016-02-17T19:56:23.023" Title="maching convolution filters to results" Tags="|filters|convolution|filtering|" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="28925" PostTypeId="1" AcceptedAnswerId="28926" CreationDate="2016-02-17T22:01:52.813" Score="2" ViewCount="148" Body="&lt;p&gt;I have sound files that contain recordings of an impulse signal in a room.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to make such a plot from it. I basically want to compare early reflections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I go about it? Is just taking the waveform, pulling the absolute values and plotting it in bar/impulse form the right way? Or is this just an idealized form? If this is all wrong, could anyone point me towards the correct way of comparing early reflections in a plot form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GDHwC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GDHwC.png&quot; alt=&quot;Plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19601" LastEditorUserId="13320" LastEditDate="2016-11-21T13:00:43.830" LastActivityDate="2016-11-21T13:00:43.830" Title="Sound reflections plot" Tags="|sound|multipath|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28926" PostTypeId="2" ParentId="28925" CreationDate="2016-02-17T22:46:02.843" Score="3" Body="&lt;p&gt;This is an idealized case of the echogram that simply depicts the times of arrival and energy of reflections. You can see this type of plot in literature and as an output in modelling software such as CATT-A and ODEON. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a real-life impulse response then you can obtain information about reflections by representing the IR in logarithmic scale, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KOoEr.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KOoEr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-02-17T22:46:02.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28927" PostTypeId="1" AcceptedAnswerId="28928" CreationDate="2016-02-18T00:27:45.450" Score="0" ViewCount="193" Body="&lt;p&gt;So i was just revising some basic DSP concepts. Just wanted to verify this fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier series represents a periodic signal $\hat{x}(t)$ with period P as a countably infinite sum of sinusoids of frequency $0$, $\frac{1}{P},\frac{2}{P},\frac{3}{P}...$. This converges to the signal in the interval, $-\frac{P}{2} &amp;lt; t &amp;lt; +\frac{P}{2}$, and if the time domain signal is periodic, then over the whole time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier Transform is sorta like a limit of the fourier series where P goes to $\infty$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i know that the fourier transform of $\operatorname{rect}(t)$ is $\operatorname{sinc}(f)$ ( ignoring the scaling factors ) . And that the fourier series of a $\operatorname{rect}()$ is given by &lt;a href=&quot;http://mathworld.wolfram.com/FourierSeriesSquareWave.html&quot; rel=&quot;nofollow&quot;&gt;http://mathworld.wolfram.com/FourierSeriesSquareWave.html&lt;/a&gt; ( which is also a $\operatorname{sinc}()$ in the frequency domain ) . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just wanted to confirm the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I sample the $\operatorname{sinc}()$ i obtain from the fourier transform of a $\operatorname{rect}()$, and use those values to reconstruct a fourier series, will i end up getting a square wave ? &lt;/p&gt;&#xA;" OwnerUserId="11519" LastEditorUserId="4346" LastEditDate="2016-02-18T02:46:45.423" LastActivityDate="2016-02-18T03:00:51.867" Title="Relation between Fourier Series &amp; Fourier transform" Tags="|fourier-transform|fourier-series|" AnswerCount="1" CommentCount="3" ClosedDate="2016-02-18T17:00:47.607" ContentLicense="CC BY-SA 3.0" />
  <row Id="28928" PostTypeId="2" ParentId="28927" CreationDate="2016-02-18T02:53:39.507" Score="3" Body="&lt;p&gt;Regarding reciprocal domains, such as the &lt;em&gt;&quot;time&quot; domain&lt;/em&gt; and &lt;em&gt;&quot;frequency&quot; domain&lt;/em&gt;, that are related to each other by the Fourier Transform, whenever you uniformly sample in one domain, it causes periodic extension in the other domain.  It does that always.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the Fourier Series is an example of sampling in the frequency domain causing periodicity in the time domain.  The corresponding example (using &lt;em&gt;duality&lt;/em&gt; of the Fourier Transform) is the so-called DTFT (Discrete-Time Fourier Transform) $X(e^{j\omega})$ of a sampled sequence $x[n]$ which is naturally periodic with period $2 \pi$.  And normally we consider $X(e^{j\omega})$ with $-\pi &amp;lt; \omega \le +\pi$ .&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="11256" LastEditDate="2016-02-18T03:00:51.867" LastActivityDate="2016-02-18T03:00:51.867" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28931" PostTypeId="1" CreationDate="2016-02-18T12:38:17.493" Score="1" ViewCount="365" Body="&lt;p&gt;If we have two processes and both of them are ergodic. Does this mean that the joint proces is ergodic? Or other way around? If we have the dynamics for both components of the joint process what are the possible ways to show ergodicityof the joint process?&lt;/p&gt;&#xA;" OwnerUserId="19607" LastActivityDate="2016-02-19T14:30:28.137" Title="Ergodicity of joint process" Tags="|stochastic|ergodic|random-process|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28932" PostTypeId="1" AcceptedAnswerId="28933" CreationDate="2016-02-18T15:16:00.887" Score="1" ViewCount="197" Body="&lt;p&gt;I was learning of Fourier Transform from this book 'Scientist and Engineer Guide to DSP'. Suppose we have a digital periodic signal and there are 128 of samples of it in the time domain i.e X[0] to X[127], then on converting it to frequency domain (only real DFT is considered i.e no complex variables) why do we need only 65 points in the frequency domain, is this related to the Nyquist rate since the highest frequency in the sample can have a maximum value of 64. Are the last 64 points not needed for calculation&lt;/p&gt;&#xA;" OwnerUserId="19609" LastEditorUserId="4298" LastEditDate="2016-02-19T13:14:09.853" LastActivityDate="2016-02-19T18:38:37.813" Title="DFT have independent variable in between 0 to $\frac{1}{2}$ no of samples" Tags="|fourier-transform|dft|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28933" PostTypeId="2" ParentId="28932" CreationDate="2016-02-18T16:26:39.577" Score="2" Body="&lt;p&gt;This statement is only true if your time-domain signal $x[n]$ is real. A real signal has a Fourier transform that is conjugate-symmetric. Stated differently the &quot;negative frequencies&quot; are just the conjugate of the corresponding &quot;positive frequencies.&quot; Therefore, the negative frequencies add no new information, so they can be discarded from the DFT of a real signal.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2016-02-18T16:26:39.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28934" PostTypeId="1" CreationDate="2016-02-19T14:12:16.947" Score="0" ViewCount="157" Body="&lt;p&gt;I am somewhat confused on the terminology used in Computer Vision. Suppose I wanted to detect (localize) an object (say, a human) in an image. However, a box around the human is not sufficient, what I need is a pixelwise localization. More precisely, I need a mask telling me which pixels belong to the human and which ones don't. &#xA;If I wanted to find papers dealing with this problem, what would be the term to search for?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Object detection: Yes, but most approaches actually work in terms of bounding boxes&lt;/li&gt;&#xA;&lt;li&gt;Object localization: If I see it correctly, this is essentially used as a synonym for object detection&lt;/li&gt;&#xA;&lt;li&gt;Image segmentation: Here we segment objects in terms of pixels but we do not necessarily only aim to segment out one specific object that is known.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is there very famous work in this area I should not miss?&lt;/p&gt;&#xA;" OwnerUserId="16462" LastEditorUserId="16462" LastEditDate="2016-02-22T07:39:25.383" LastActivityDate="2016-02-22T07:39:25.383" Title="Object localization down to the pixel" Tags="|computer-vision|image-segmentation|detection|localization|" AnswerCount="0" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="28935" PostTypeId="2" ParentId="28931" CreationDate="2016-02-19T14:30:28.137" Score="4" Body="&lt;p&gt;Joint behavior cannot always be deduced from individual behavior. For example, if $X$ and $Y$ are (nondegenerate) random variables with &#xA;finite means, then $P\{X&amp;lt;E[X]\}$ and $P\{Y&amp;lt;E[Y]\}$ both are nonzero. This&#xA;is because there must be probability mass to the left of the mean (and to the right of the mean too) except in the degenerate case when $X$ has value $E[X]$ with probability $1$. However, $P\{X&amp;lt;E[X],Y&amp;lt;E[Y]\}$ can be zero. Don't believe me? Consider $X\sim$ Bernoulli$(\frac 12)$ and&#xA;$Y=1−X$ which is also Bernoulli$(\frac 12)$. Both have means $\frac 12$&#xA;but $P\{X &amp;lt; \frac 12, Y &amp;lt; \frac 12\} = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning to ergodicity, one characteristic of an ergodic process is that&#xA;over long periods of time (say duration $T$), a typical sample path has value $\alpha$ or less for approximately $F_X(\alpha)\cdot T$ time units where $F_X(\cdot)$ is the first-order CDF of all the random variables&#xA;comprising the process. That is, we can get good approximations to the&#xA;value of the first-order CDF at $\alpha$&#xA;by observing what &lt;em&gt;fraction&lt;/em&gt; of time a sample path spends&#xA;below level $\alpha$. So, going back to your question, if $\{X(t)\}$&#xA;and $\{Y(t)\}$ are ergodic processes, we cannot deduce that the&#xA;joint process is also ergodic, for reasons similar to the example&#xA;I gave in the first paragraph above. Now, if you impose conditions&#xA;such as $\{X(t)\}$ and $\{Y(t)\}$ are &lt;em&gt;independent&lt;/em&gt; processes&#xA;in addition to being &lt;em&gt;ergodic&lt;/em&gt; processes, then Yes, the joint&#xA;process is also ergodic. &lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2016-02-19T14:30:28.137" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28936" PostTypeId="1" CreationDate="2016-02-19T16:04:06.633" Score="2" ViewCount="116" Body="&lt;p&gt;I'm entertaining the idea of making a music-creating application. I'm a total newb at signal processing. The question that concerns me most right now is, if I apply a filter/effect such as convolution, echo or reverb, flanging, etc. to only a part of a song (starting at a certain time and ending at a certain time within the span of the song), will I end up with glitch artifacts in the sound where the filter comes into and goes out of effect? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though I don't know much about DSP, it seems like I would, unless I were a mathematical genius and knew how to eliminate them with precision. Is this an issue, and if so, what are the ways to circumvent it? Maybe one would have to apply the filter to the entire song and change some modulating variable in the filter so that it applies the effect at zero percent at the times it's not supposed to be in effect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="19624" LastActivityDate="2016-02-19T16:04:06.633" Title="Can you apply an audio filter/effect to only part of an audio signal and not get audio glitches?" Tags="|audio|filter-design|sound|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28937" PostTypeId="2" ParentId="28932" CreationDate="2016-02-19T18:38:37.813" Score="2" Body="&lt;p&gt;Different way but related way to answer: A real valued signal requires 128 real numbers to represent. The DFT also has 128 values, 126 of which are complex and two of which are real (DC and Nyquist). The 126 complex values are all conjugate symmetric so only half of them are independent and need to be stored. So we end up with 2 real plus 63 complex values which requires a total of 2*63+2 = 128 real numbers to be represented. Hence the information content (room to store) is exactly the same in both domains. &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-02-19T18:38:37.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28939" PostTypeId="1" CreationDate="2016-02-19T20:53:08.300" Score="1" ViewCount="790" Body="&lt;p&gt;I am using matched filters using GNU Radio to extract from noise a CW Morse signal. The filter actually performs pretty well in various SNR environments. My problem is that the threshold upon I decide for a presence or absence of a CW transmission vary with different SNR/CW frequency/WPM/incoming signal amplitude setups.&lt;/p&gt;&#xA;&lt;p&gt;Conventional normalization methods, (eg dividing with the max value) are not applicable since the program runs continuously and the max value is not known a priori.&#xA;I believe that a moving normalization scheme should deal with this problem. In the past, for preamble detection I have used the moving normalized autocorrelation method that is depicted below (&lt;code&gt;C&lt;/code&gt; and &lt;code&gt;P&lt;/code&gt; are moving sums). I tried to adapt this approach in my case but with no luck. &lt;a href=&quot;https://i.stack.imgur.com/noKcY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/noKcY.png&quot; alt=&quot;autocorrelation normalization&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is, if there is a method to normalize either the output signal power of the matched filter or the input signal itself, so I can rely on a one predefined decision threshold for CW signal presence/absence.&lt;/p&gt;&#xA;" OwnerUserId="19015" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-05-05T14:20:10.203" Title="Moving signal power normalization" Tags="|normalization|matched-filter|software-defined-radio|gnuradio|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28941" PostTypeId="1" AcceptedAnswerId="28961" CreationDate="2016-02-19T22:57:02.910" Score="5" ViewCount="1102" Body="&lt;p&gt;I am reading the Chan-Vese paper &lt;a href=&quot;http://cmp.felk.cvut.cz/~kratkj3/articles/An%20active%20contour%20model%20without%20edges.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;An Active Contour Model without Edges&quot;&lt;/a&gt; and IPOL tutorial &lt;a href=&quot;http://www.ipol.im/pub/art/2012/g-cv/article.pdf&quot; rel=&quot;nofollow&quot;&gt;&quot;Chan-Vese Segmentation&quot;&lt;/a&gt; by Pascal Getreuer.  The energy for this model is given by:&#xA;$$&#xA;E(\varphi) = {\mu \int_{\Omega} \delta(\varphi(x)) | \nabla \varphi(x)|dx} + \nu\int_{\Omega} H(\varphi(x)) dx \;+$$&#xA;$$\lambda_1\int_{\Omega}|f - c_1| H(\varphi(x))+\lambda_2\int_{\Omega}|f - c_2|(1 - H(\varphi(x))dx&#xA;$$&#xA;Above, $\mu, \nu, \lambda_1, \lambda_2$ are real parameters, $c_1, c_2$ are constants determined for segmentation, $-1 \leq \varphi(x) \leq 1$ is the level-set function in which $\varphi(x) = 0$ specifies the interface,  $f$ is the original image, $H$ is the heavyside function in 1 dimension centered at $0$ and $\delta = H'$.  The Euler-Lagrange equations can be derived by inspecting the following derivative:&#xA;$$&#xA;\left.\frac{d}{d\epsilon} E(\varphi(x) + \epsilon \eta(x))\right|_{t = 0}&#xA;$$&#xA;for some test function $\eta(x)$.  Writing the Euler-Lagrange Equations as a gradient descent both papers claim:&#xA;$$&#xA;\begin{cases}&#xA;\frac{d\varphi}{dt} = \delta(\varphi(x))\left[\mathrm{div}\left( \frac{\nabla \varphi}{\mu |\nabla \varphi|}\right) - \nu - \lambda_1(f- c_1)^2 + \lambda_2(f-c_2)^2\right]\\&#xA;\frac{\delta(\phi(x))}{|\nabla \varphi|} \nabla \varphi \cdot \mathbf{n} = 0 &amp;amp; x \in \partial \Omega.&#xA;\end{cases}&#xA;$$&#xA;My problem is coming from the differentiation of&#xA;$$&#xA;{\int_{\Omega} \delta(\varphi(x)) | \nabla \varphi(x)|dx}.&#xA;$$&#xA;in the variation of the energy.  It should look like:&#xA;$$&#xA;\int_{\Omega} \underbrace{\left(\frac{d}{d\epsilon} \delta( \varphi (x) + \epsilon \eta(x) )\right)|\nabla \varphi(x)|}_{(*)} + \underbrace{\delta(\varphi(x)) \left(\frac{d}{d\epsilon}|\nabla\varphi(x) + \epsilon \nabla\eta(x)|\right)}_{(**)}.&#xA;$$&#xA;Now, $(**)$ gives us the curvature/divergence term in the Euler-Lagrange equations as well as the boundary condition after applying Green's first identity.  However, I don't understand how one might argue in this case why $(*)$ goes to 0 or why, for practical considerations, we can just ignore it.&lt;/p&gt;&#xA;" OwnerUserId="19631" LastEditorUserId="19631" LastEditDate="2016-02-21T02:16:09.493" LastActivityDate="2018-05-17T12:51:55.527" Title="Deriving the Euler-Lagrange Equations for the Chan-Vese Model" Tags="|image-processing|image-segmentation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28942" PostTypeId="2" ParentId="27819" CreationDate="2016-02-20T00:15:32.283" Score="0" Body="&lt;p&gt;Late response, but it may help others in the futrue: why not use a taylor or MacLaurin series expansion? &lt;a href=&quot;http://www.emathhelp.net/calculators/calculus-1/taylor-and-maclaurin-series-calculator/?f=sin%28x%29&amp;amp;p=0&amp;amp;n=5&amp;amp;steps=on&quot; rel=&quot;nofollow&quot;&gt;Here is a handy calculator&lt;/a&gt; But the expansion for sin is well defined &lt;a href=&quot;https://en.wikipedia.org/wiki/Taylor_series#List_of_Maclaurin_series_of_some_common_functions&quot; rel=&quot;nofollow&quot;&gt;take a look at wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The taylor/maclaurin series gives approximations for equations about a specific point to approximate the functions true value. In fact this is actually how calculators/computers compute many complex functions (exponentials, sinusoids, logs, etc). Your terms would be &lt;code&gt;Cx^n&lt;/code&gt; where &lt;code&gt;n&lt;/code&gt; indicates the number of terms to include, &lt;code&gt;C&lt;/code&gt; is a constant coefficient. More terms = more precision You can almost think of these as a fourier series where &lt;code&gt;x^n&lt;/code&gt; closely mirrors &lt;code&gt;e^jx&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; is your coefficient. As Laurant mentioned, you don't need the entire infinite set to get an answer, using the most powerful terms will result in a signal that is close enough&lt;/p&gt;&#xA;" OwnerUserId="13714" LastActivityDate="2016-02-20T00:15:32.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28943" PostTypeId="1" AcceptedAnswerId="28944" CreationDate="2016-02-20T02:42:59.517" Score="3" ViewCount="3676" Body="&lt;p&gt;Suppose we have this signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=5 \sin(2\pi 1000 t) \cos(2\pi 10000 t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculated the Fourier transform as below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(f)=\left(j\frac{5}{4}\right)\left[\delta(f-9000)+\delta(f+11000)-\delta(f-11000)-\delta(f+9000)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then I would like to convert it to $\omega$ form. I know that the result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega )=\left(j\frac{5}{2}\right)\left[\delta(\omega -9000)+\delta(\omega +11000)-\delta(\omega -11000)-\delta(\omega +9000)\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that &#xA;$\omega=2\pi f T$&#xA;where $T$ is sampling rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I cannot understand is how we convert the Fourier transform of our signal to $\omega$ form using above formula.&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="13320" LastEditDate="2016-11-21T12:33:52.183" LastActivityDate="2016-11-21T12:33:52.183" Title="Convert Fourier transform of a signal to $\omega$ form?" Tags="|fourier-transform|continuous-signals|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28944" PostTypeId="2" ParentId="28943" CreationDate="2016-02-20T07:25:35.130" Score="2" Body="&lt;p&gt;In your example there is no sampling involved, so you simply have $\omega=2\pi f$, where $f$ is the frequency in Hertz, and $\omega$ is the frequency in radians.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your first result for $X(f)$ looks correct. However, your result for $X(\omega)$ is wrong. What you need to know to be able to convert an expression with Dirac deltas from $f$ to $\omega$ is the following relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\delta(af)=\frac{1}{|a|}\delta(f)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $a=2\pi$ and $\omega=2\pi f$ you get from $(1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2\pi\delta(\omega)=\delta(f)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You get the two following basic Fourier transform correspondences, depending on whether you use $f$ or $\omega=2\pi f$ as the frequency domain variable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}e^{j2\pi f_0t}&amp;amp;\longleftrightarrow \delta(f-f_0)\\&#xA;e^{j\omega_0t}&amp;amp;\longleftrightarrow 2\pi\delta(\omega-\omega_0)\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your expression for $X(\omega)$ misses a factor of $\pi$, and the sums and differences of the two frequencies in the arguments of the Dirac deltas need to be multiplied by $2\pi$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(\omega)=\frac{5\pi j}{2}[\delta(\omega-2\pi9000)-\delta(\omega+2\pi9000)+\delta(\omega+2\pi11000)-\delta(\omega-2\pi11000)]$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-20T12:09:58.127" LastActivityDate="2016-02-20T12:09:58.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28947" PostTypeId="1" CreationDate="2016-02-20T12:51:10.850" Score="1" ViewCount="526" Body="&lt;p&gt;I need to get coefficients for my FIR filter. &#xA;I know my pass band lets say between 350 - 400 Hz &#xA;And my stop band(s) lets say 200 - 250 and 500 - 500 Hz, &#xA;The other regions in the spectrum I simply don't care. I want the Filter to be relaxed in this regions so be more effective in pass and stop bands. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a library with a  simple interface that I will just give passband and stop bands and number of taps. Than I will get my coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I found is &lt;a href=&quot;http://aquila-dsp.org/articles/updated-frequency-domain-filtering-example/&quot; rel=&quot;nofollow&quot;&gt;aquila example&lt;/a&gt;, but I couldn't see how can I define relaxed regions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you please advise me a C/C++ library with relaxed, pass, stop bands and easy to use even for a computer scientist?  &lt;/p&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="4298" LastEditDate="2016-03-20T08:38:42.513" LastActivityDate="2016-03-20T08:38:42.513" Title="A C/C++ library for FIR filter design with &quot;Don't Care region&quot;" Tags="|filter-design|c|" AnswerCount="0" CommentCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="28950" PostTypeId="1" CreationDate="2016-02-20T22:05:44.563" Score="-2" ViewCount="48" Body="&lt;p&gt;I've been trying to find the transform of the following signal, but have not been successful, any help would be greatly appreciated:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Find $X_s(f)$ of the following signal the &quot;mathematical DAC&quot;&#xA;  generates:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$x_s(t)=\sum_{n=-\infty}^{\infty}(-1)^nx(nT_s)\delta(t-nT_s)$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="19641" LastEditorUserId="13320" LastEditDate="2016-02-21T08:03:55.530" LastActivityDate="2016-02-21T08:13:01.980" Title="Find $X_s(f)$ of a sampled continuous signal" Tags="|discrete-signals|fourier-transform|transform|digital|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28953" PostTypeId="2" ParentId="28950" CreationDate="2016-02-21T08:13:01.980" Score="0" Body="&lt;p&gt;As this feels extremely much like homework, let's give you pointers and let you derive the final answer: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Fourier transform is a linear operation, which means&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the transform of a sum is the sum of the transforms of the single parts, and&lt;/li&gt;&#xA;&lt;li&gt;constants can be &quot;extracted&quot; from each transform and just scale it.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;li&gt;Summation is associative and hence, you can first look at all even and then at all odd terms isolatedly&lt;/li&gt;&#xA;&lt;li&gt;There's the convolution theorem that tells you something about the transform of $x(t) \cdot \delta(t)$, &lt;/li&gt;&#xA;&lt;li&gt;the transform of $\delta(t)$ is especially simply done manually, and the transform of $\delta(t-\tau)$ can easily be found manually, too. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-21T08:13:01.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28954" PostTypeId="2" ParentId="28401" CreationDate="2016-02-21T08:50:04.033" Score="1" Body="&lt;p&gt;Autocorrelation (sometimes also termed aucovariance) is often used in the context of stationnary time signals.  As the $\sigma_t$ and $\sigma_s$ are &quot;equal&quot;. Since the autocorrelation is symmetric and peaks at $\tau=0$, $R_x(\tau)$ (as noted by @robert bristow-johnson) is often regarded as the natural reference. In a lot of applications, one mostly look at its scale-variant properties: as a measure on how signal chunks look similar, or modeling its decay, or by fitting a linear model through it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes, to distinguish the normalized version, it is called an &lt;a href=&quot;https://en.wikipedia.org/wiki/Autocovariance#Normalization&quot; rel=&quot;nofollow&quot;&gt;autocorrelation coefficient function&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When dealing with non-stationnary signals, it would be unnatural to stationnarize it artificially. For instance, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Wigner_distribution_function&quot; rel=&quot;nofollow&quot;&gt;Wigner-Ville distribution&lt;/a&gt; is based on the Fourier transform of the unnormalized non-stationary autocorrelation function.  &lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-21T08:50:04.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28955" PostTypeId="1" AcceptedAnswerId="28956" CreationDate="2016-02-21T09:45:22.860" Score="0" ViewCount="519" Body="&lt;p&gt;How can I calculate the color temperature(CCT) of the light source illuminating a given raw image correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I used is proposed by McCamy, and the algorithm was also described in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Color_temperature&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;. The problem is that I don't know whether should I apply white balance process before calculating CCT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it should not, how do I get the conversion matrix that convert the current device-dependent RGB color space to CIE XYZ to calculate the algorithm correctly? &lt;/p&gt;&#xA;" OwnerUserId="19645" LastEditorUserId="13320" LastEditDate="2016-02-21T11:30:57.843" LastActivityDate="2016-02-21T11:33:51.437" Title="How do I calculate correlated color temperature correctly?" Tags="|image-processing|color|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28956" PostTypeId="2" ParentId="28955" CreationDate="2016-02-21T11:33:51.437" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The problem is that I don't know whether should I apply white balance process before calculating CCT. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Definitely not. Afterwards, the light source would have a completely different color profile, depending on how you implement white balance, and hence, a different color temperature.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If it should not, how do I get the conversion matrix that convert the current device-dependent RGB color space to CIE XYZ to calculate the algorithm correctly? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Get the color profile (which might be much more complex than a simple matrix) of your device; usually, that means getting the ICC file for your camera/scanner/sensor, and applying that to convert your image from the device color space to something canonical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your camera/scanner/sensor doesn't have such a profile, you will need to calibrate it first.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-02-21T11:33:51.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28957" PostTypeId="2" ParentId="13142" CreationDate="2016-02-21T14:03:40.863" Score="2" Body="&lt;p&gt;You can write the body of the function &lt;a href=&quot;http://www.wolframalpha.com/input/?i=x%2F%7Cx%7C*(1-e%5E(x%5E2%2F%7Cx%7C))&quot; rel=&quot;nofollow noreferrer&quot;&gt;directly into Wolfram Alpha&lt;/a&gt; and it plots it:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DSgbh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DSgbh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It looks like a &lt;a href=&quot;https://en.wikipedia.org/wiki/Waveshaper&quot; rel=&quot;nofollow noreferrer&quot;&gt;waveshaper&lt;/a&gt; to me, and those can be used as you describe. But there was an error in the formula, see &lt;a href=&quot;https://dsp.stackexchange.com/a/28962/15347&quot;&gt;@Matt L.'s answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2020-07-08T05:28:39.113" LastActivityDate="2020-07-08T05:28:39.113" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="28958" PostTypeId="1" CreationDate="2016-02-21T16:09:34.577" Score="-3" ViewCount="147" Body="&lt;p&gt;I have been trying hardly to check if these equalities are true or false. However, I have not been able to conclude anything. Could you help me, please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[2n]=h[n]\star x[2n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathfrak{F}(x[-n])e^{-jp\pi Fm}=\mathfrak{F}(x[-n+m]) $$&lt;/p&gt;&#xA;" OwnerUserId="19652" LastEditorUserId="8202" LastEditDate="2016-02-22T08:42:13.763" LastActivityDate="2020-02-10T11:32:20.160" Title="Convolution &amp; FT properties" Tags="|fourier-transform|convolution|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="28959" PostTypeId="2" ParentId="28958" CreationDate="2016-02-21T17:20:04.737" Score="0" Body="&lt;p&gt;I'll try to get you started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first part:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Write out the convolution sum for $y[n]=h[n]\star x[n]$&lt;/li&gt;&#xA;&lt;li&gt;Replace $n$ by $2n$, which gives you an expression for $y[2n]$&lt;/li&gt;&#xA;&lt;li&gt;Write out the convolution sum for $h[n]\star x[2n]$&lt;/li&gt;&#xA;&lt;li&gt;Check if both expressions are equal. If you've done everything right, the answer should be 'no' (i.e., they're not equal). If you fail showing this, add your steps to your question and explain what the problem was.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For the second part:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Write the Fourier transform of $x[-n]$ in terms of the Fourier transform of $x[n]$, and multiply by $e^{-j2\pi fm}$; that's the left-hand side of the equation.&lt;/li&gt;&#xA;&lt;li&gt;Compute the Fourier transform of the right-hand side. &lt;a href=&quot;https://dsp.stackexchange.com/questions/27955/z-transform-of-xa-n-where-a-is-int/27971#27971&quot;&gt;This answer&lt;/a&gt; will be helpful (replace $z$ by $e^{j2\pi f}$).&lt;/li&gt;&#xA;&lt;li&gt;Like step 4 above, just that in this case the answer should be 'yes' (i.e., they're equal).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-02-21T17:20:04.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28960" PostTypeId="2" ParentId="28958" CreationDate="2016-02-21T17:22:12.957" Score="0" Body="&lt;p&gt;If you make the variable change &lt;span class=&quot;math-container&quot;&gt;$2n=m$&lt;/span&gt; you can easily see that &lt;span class=&quot;math-container&quot;&gt;$$y[m]=h[m]*x[m]$$&lt;/span&gt; that is obviously different from &lt;span class=&quot;math-container&quot;&gt;$$y[m]=h[m/2]*x[m]$$&lt;/span&gt; therefore it's FALSE.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The second sentence could be explained by the transposition property &lt;span class=&quot;math-container&quot;&gt;$$x[-n]=X(-F)$$&lt;/span&gt; and the property of frequency displacement &lt;span class=&quot;math-container&quot;&gt;$$X(F)\cdot e^{(-j·2·\pi·m·F)} \longleftrightarrow x[n-m]$$&lt;/span&gt; After applying that you got that it's TRUE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I'm your classmate&lt;/p&gt;&#xA;" OwnerUserId="19653" LastEditorUserId="47251" LastEditDate="2020-02-10T11:32:20.160" LastActivityDate="2020-02-10T11:32:20.160" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="28961" PostTypeId="2" ParentId="28941" CreationDate="2016-02-21T18:05:02.717" Score="4" Body="&lt;p&gt;Thanks to Luminita Vese, who responded to this question via email. I will post the answer here.  Let $\varphi_\epsilon(x) = \varphi(x) + \epsilon\eta(x)$ for some test function $\eta(x)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;\int_{\Omega} \frac{d}{d\epsilon} \left[ \delta(\varphi_\epsilon(x)) |\nabla (\varphi_\epsilon(x))|\right]dx &amp;amp;=&amp;amp; \int_{\Omega} \left[\frac d{d\epsilon} \delta(\varphi_\epsilon(x))\right] |\nabla (\varphi(x))|+  \delta(\varphi(x)) \left[\frac{d}{d\epsilon}|\nabla (\varphi_\epsilon(x))|\right]dx\\&#xA;&amp;amp;=&amp;amp;\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| + \delta(\varphi(x))\left[\frac{d}{d\epsilon} \sqrt{\left&amp;lt;\nabla\varphi_\epsilon(x), \nabla\varphi_\epsilon(x)\right&amp;gt;}\right]dx\\&#xA;&amp;amp;=&amp;amp;\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| + \delta(\varphi(x))\left[ \frac{\frac{d}{d\epsilon}{\left&amp;lt;\nabla\varphi_\epsilon(x), \nabla \varphi_\epsilon(x)\right&amp;gt;}}{2|\nabla(\varphi(x)|}\right]dx\\&#xA;&amp;amp;=&amp;amp;\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| \\&#xA;&amp;amp;\quad&amp;amp;+ \delta(\varphi(x))\left[ \frac{{\left&amp;lt;\nabla\varphi (x), \nabla \eta(x)\right&amp;gt;}}{|\nabla(\varphi(x)|}\right]\\&#xA;&amp;amp;=&amp;amp;\int_\Omega \delta'(\varphi(x))\eta(x) |\nabla \varphi(x)| \\&#xA;&amp;amp;\quad&amp;amp;+ \frac{{\left&amp;lt;\delta(\varphi(x))\nabla\varphi (x), \nabla \eta(x)\right&amp;gt;}}{|\nabla(\varphi(x)|}dx \quad (*)\\&#xA;&amp;amp;=&amp;amp;\int_{\Omega}\delta'(\varphi(x))\eta(x)|\nabla \varphi(x)|\\&#xA;&amp;amp;\quad&amp;amp;-\delta(\varphi(x))\mathrm{div}\left(\frac{\nabla \varphi}{|\nabla \varphi|}\right) \eta(x) \\&#xA;&amp;amp;\quad&amp;amp;- \delta'(\varphi(x))\frac{|\nabla(\varphi(x))|^2}{|\nabla \varphi(x)|}\eta(x)dx\quad(**)\\&#xA;&amp;amp;=&amp;amp;-\int_{\Omega}\delta(\varphi(x))\mathrm{div}\left(\frac{\nabla \varphi}{|\nabla \varphi|}\right) \eta(x) dx&#xA;\end{eqnarray}&#xA;Above, I am writing $\left&amp;lt; \cdot , \cdot \right&amp;gt;$ to denote the vector inner product, From (*) to (**), Green's first identity was applied as well as the product rule for divergence.&lt;/p&gt;&#xA;" OwnerUserId="19631" LastEditorUserId="19631" LastEditDate="2016-02-21T18:35:58.870" LastActivityDate="2016-02-21T18:35:58.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28962" PostTypeId="2" ParentId="13142" CreationDate="2016-02-21T19:53:05.773" Score="11" Body="&lt;p&gt;Thanks to the plot in &lt;a href=&quot;https://dsp.stackexchange.com/questions/13142/digital-distortion-effect-algorithm/28957#28957&quot;&gt;Olli Niemitalo's answer&lt;/a&gt; I got convinced that the formula given in the book has a sign error. The non-linearity used for fuzz or distortion is always some type of smoothed clipping function, which compresses the input signal. So small input amplitudes experience little change whereas high input amplitudes are (more or less) softly clipped. And the figure shown in Olli's answer does exactly the opposite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I'm convinced that the correct formula should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(x)=\frac{x}{|x|}\left(1-e^{-x^2/|x|}\right)=&#xA;\text{sgn}(x)\left(1-e^{-|x|}\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For small values of $x$ we have $f(x)\approx\text{sgn}(x)|x|=x$, and for large (magnitude) values we get $f(x)\approx\text{sgn}(x)$, i.e., clipping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a plot of the corrected non-linearity $f(x)$ (&lt;a href=&quot;http://www.wolframalpha.com/input/?i=sgn%28x%29*%281-e%5E%28-|x|%29%29&quot; rel=&quot;noreferrer&quot;&gt;WolframAlpha&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VPBxq.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VPBxq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula should also be simplified like the right-most expression in $(1)$, because a beginner might be inclined to literally implement the other formula and try to evaluate the terms $x/|x|$ and $x^2/|x|$, which is unnecessarily complex and also gives trouble when $x$ is close to zero. A typical implementation would look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;if (x &gt; 0)&#xA;   y = 1 - exp(-x);&#xA;else&#xA;   y = -1 + exp(x);&#xA;end&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-02-24T12:55:21.380" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="28964" PostTypeId="1" AcceptedAnswerId="28974" CreationDate="2016-02-22T02:44:44.577" Score="1" ViewCount="517" Body="&lt;p&gt;Can you please tell me if my working is right for the Fourier Transform of this function: $$x(t)=\Delta\left(\frac{t-1}{2}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My workings are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NqZKX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NqZKX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the fourier transform standard results. Please could you tell me if I which I have to apply:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First the $F(t-1)$, then $F(t/2)$&lt;/li&gt;&#xA;&lt;li&gt;First the $F(t/2)$, then $F(t-1)$&lt;/li&gt;&#xA;&lt;li&gt;First the $F(t/2)$, then $F(-1/2)$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Please tell me where I have gone wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My final answer is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\mathrm{sinc}^2(\omega/2)e^{-j\pi f}$$&lt;/p&gt;&#xA;" OwnerUserId="19633" LastEditorUserId="8202" LastEditDate="2016-02-22T08:35:09.687" LastActivityDate="2016-02-22T09:24:36.080" Title="Fourier Transform of triangle function $x(t)=\Delta\left(\frac{t-1}{2}\right)$" Tags="|fourier-transform|frequency-spectrum|continuous-signals|z-transform|fourier|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28965" PostTypeId="1" CreationDate="2016-02-22T05:10:26.017" Score="2" ViewCount="867" Body="&lt;p&gt;Let's say I have a 2 second data set taken at 220Hz sample rate and I would like to filter out the frequency bands associated with the EEG Spectrum:&#xA;$$\begin{align}&#xA;\Delta:&amp;amp; [1,3]\text{ Hz}\\&#xA;\theta:&amp;amp; [4,7]\text{ Hz}\\&#xA;\alpha_1:&amp;amp; [8,9]\text{ Hz}\\&#xA;\alpha_2:&amp;amp; [10,12]\text{ Hz}\\&#xA;\beta_1:&amp;amp; [13,17]\text{ Hz}\\&#xA;\beta_2:&amp;amp; [18,30]\text{ Hz}\\&#xA;\gamma_1:&amp;amp; [31,40]\text{ Hz}\\&#xA;\gamma_2:&amp;amp; [41,50]\text{ Hz}&#xA;\end{align}&#xA;$$&#xA;What would be the most simple approach to do this ?&lt;/p&gt;&#xA;" OwnerUserId="19666" OwnerDisplayName="William John-Pierre Duhe" LastEditorUserId="13320" LastEditDate="2016-05-24T10:43:48.167" LastActivityDate="2016-05-24T11:15:23.090" Title="Filtering Frequency Bands Out of a Signal" Tags="|filtering|bandpass|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28966" PostTypeId="1" CreationDate="2016-02-22T05:30:39.500" Score="1" ViewCount="2860" Body="&lt;p&gt;I have two sets of time domain data.  One is the input to a system and the other is its corresponding output, both measured at the same sampling frequency.  How to calculate the system's transfer function from this experimental data?&lt;/p&gt;&#xA;" OwnerUserId="19658" LastActivityDate="2016-02-22T05:59:17.843" Title="Transfer function from experimental time domain data" Tags="|transfer-function|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28967" PostTypeId="2" ParentId="28966" CreationDate="2016-02-22T05:59:17.843" Score="2" Body="&lt;p&gt;assuming your sets of time-domain data begin with $n=0$, Z transform both the input data, $x[n]$ and the output data, $y[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(z) \triangleq \mathcal{Z}\{x[n]\} = \sum\limits_{n=0}^{\infty} x[n] \ z^{-n} $$&#xA;$$ Y(z) \triangleq \mathcal{Z}\{y[n]\} = \sum\limits_{n=0}^{\infty} y[n] \ z^{-n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;divide the Z transform of the output by the Z transform of the input.  the result of that division is your transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) \triangleq \frac{Y(z)}{X(z)} = \frac{\sum\limits_{n=0}^{\infty} y[n] \ z^{-n} }{\sum\limits_{n=0}^{\infty} x[n] \ z^{-n} } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i cannot guarantee that, if you were to factor numerator and denominator, there will not be identical poles with zeros that could cancel and make the transfer function simpler, but it's a transfer function.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-02-22T05:59:17.843" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28968" PostTypeId="1" AcceptedAnswerId="28984" CreationDate="2016-02-22T06:54:45.740" Score="2" ViewCount="313" Body="&lt;p&gt;I reconstruct images from MRI k-space using ifft and root-sum-of-squares method. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imRef = ifftshift(ifftshift(ifft(ifft( ifftshift(ifftshift( kspacedata,1),2),[],1),[],2),1),2); &#xA;imSOS    = squeeze(sqrt(sum( abs(angle(imRef)).^2, 3))); &#xA;imagesc(abs(imSOS))&#xA;&#xA;k = abs(imSOS); &#xA;disp(class(k)); %double&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Class of image matrix &lt;code&gt;k&lt;/code&gt; is shown as &lt;code&gt;double&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the image matrix &lt;code&gt;k&lt;/code&gt; an indexed image or intensity image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sample values from reconstructed image &lt;code&gt;k&lt;/code&gt; is shown below. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;4.2753    4.9807    4.5435    5.6548    6.1303    5.0229&#xA;3.3805    4.6260    5.1594    5.2692    4.1187    4.4885&#xA;5.8990    5.5275    4.3493    5.6182    6.7237    4.3071&#xA;6.4885    4.6861    4.4086    3.5034    5.2378    4.7466&#xA;6.1099    4.6995    4.1673    4.7408    3.8915    5.7531&#xA;5.4006    3.1289    5.6541    5.8782    4.6568    3.8166&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By referrring &lt;a href=&quot;http://in.mathworks.com/help/matlab/creating_plots/image-types.html&quot; rel=&quot;nofollow&quot;&gt;http://in.mathworks.com/help/matlab/creating_plots/image-types.html&lt;/a&gt;,&#xA;I learned that for indexed images, the data matrix is represented by integers which are indices to color map. And if it were intensity images, I feel the data range is somewhere between 0 and 1. If &lt;code&gt;k&lt;/code&gt; represents an indexed image, how can I know the colormap associated with it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="18691" LastActivityDate="2016-03-21T13:53:32.707" Title="image type after an ifft reconstruction" Tags="|matlab|image-processing|ifft|reconstruction|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28972" PostTypeId="2" ParentId="28965" CreationDate="2016-02-22T08:32:37.147" Score="1" Body="&lt;p&gt;The sampling frequency seems right (220 Hz &gt; 2*50 Hz) so there's no loss of information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have to do is design a bandpass filter for each frequency band and apply it to your signal to extract each band. Since you seem to have &quot;unlimited&quot; computing amount, you can easily apply high-order filters and get your signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are using mathematica, I suggest this function :&#xA;&lt;a href=&quot;https://reference.wolfram.com/language/ref/BandpassFilter.html&quot; rel=&quot;nofollow&quot;&gt;https://reference.wolfram.com/language/ref/BandpassFilter.html&lt;/a&gt;&#xA;Which allows to specify frequencies and other parameters easily without having to design the whole thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's say you have a signal $S$ in mathematica, which is defined by an array of numbers {12,21,...,36,...}. And you want to extract the $\alpha_2$ waves.&#xA;You'll have to use the function as follow (n is the filter's kernel length)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BandPassFilter[S, {w1,w2},n]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;w1 and w2 being defined as :&#xA;$$&#xA;w_1 = 2*\pi*10\\&#xA;w_2 = 2*\pi*12&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are free to use any software, I also suggest you switch to MatLab, which is more appropriate than mathematica (it's my opinion) to process data as you want to do, and widely used in the signal engineering community.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="19532" LastEditDate="2016-02-22T15:59:29.607" LastActivityDate="2016-02-22T15:59:29.607" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="28974" PostTypeId="2" ParentId="28964" CreationDate="2016-02-22T09:24:36.080" Score="2" Body="&lt;p&gt;I will not go into the details of the specific function that you need to transform. This is for two reasons: first, with a bit of effort you will be able to do it yourself (after having read this answer), and second, because you didn't define your functions. Note that it is not immediately clear how $\Delta(t)$ is defined; also note that there are two frequently used definitions of $\text{sinc}(x)$ (either with or without an implicit factor of $\pi$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will discuss the way to derive the Fourier transform of a shifted and scaled version of a function $f(t)$ with Fourier transform $F(\omega)$. For this you need to know the two following Fourier transform properties (derive them yourself and you'll never forget them!):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(at)\Longleftrightarrow \frac{1}{|a|}F\left(\frac{\omega}{a}\right)\\&#xA;f(t-a)\Longleftrightarrow F(\omega)e^{-ja\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of $f((t-a)/b)$ can be derived from $(1)$ in two different ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the transform of $f(t-\frac{a}{b})$, then substitute $t\rightarrow t/b$&lt;/li&gt;&#xA;&lt;li&gt;Find the transform of $f(\frac{t}{b})$, then substitute $t\rightarrow t-a$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The first way is then&#xA;$$f\left(t-\frac{a}{b}\right)\Longleftrightarrow F(\omega)e^{-ja\omega/b}\\&#xA;f\left(\frac{t-a}{b}\right)\Longleftrightarrow |b|F(b\omega)e^{-ja\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second way of course gives the same result:&#xA;$$f\left(\frac{t}{b}\right)\Longleftrightarrow |b|F(b\omega)\\&#xA;f\left(\frac{t-a}{b}\right)\Longleftrightarrow |b|F(b\omega)e^{-ja\omega}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-22T09:24:36.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28977" PostTypeId="1" AcceptedAnswerId="28980" CreationDate="2016-02-22T11:47:03.400" Score="0" ViewCount="2362" Body="&lt;p&gt;I'm currently working on vibration detection machine used to detect unbalance from a rotating shaft, rotating from 300-2500 Hz. I have both the tacho signal ( 1 PPR ) and the vibration from transducer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm really confused. After the transducer there is sweep filter that uses the tacho signal as center frequency so at 1 kHz the output sine wave is 1 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do i extract useful data from this signal ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read for the past week on the internet about order analysis and different methods but im so confused about how to implement it, how fast should the ADC sample rate be for the order tracking?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I do Fourier transform over the sine wave?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to transfer the signal to angular domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is just confusing. A little help on order analysis, or how to extract information from rotating shaft would be very appreciated!&lt;/p&gt;&#xA;" OwnerUserId="19662" LastEditorUserId="13320" LastEditDate="2016-02-22T18:26:54.837" LastActivityDate="2016-02-22T21:36:08.600" Title="Order Analysis Signal Processing" Tags="|fft|fourier-transform|frequency-spectrum|analog-to-digital|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28978" PostTypeId="2" ParentId="3444" CreationDate="2016-02-22T12:32:51.320" Score="0" Body="&lt;p&gt;Fourier transform is periodic in nature.&#xA;Periodic function can cause interference between adjacent periods&#xA;and this will lead to wraparound error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y0o6O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y0o6O.png&quot; alt=&quot;wraparound error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To overcome this we go for zero padding&lt;/p&gt;&#xA;" OwnerUserId="7794" LastActivityDate="2016-02-22T12:32:51.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28979" PostTypeId="2" ParentId="11326" CreationDate="2016-02-22T12:42:12.367" Score="0" Body="&lt;p&gt;Signal to Noise Ratio&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shows the relationship between the real image and estimated image. This ratio indicates how strong the noise corrupted the original image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peak Signal to Noise Ratio&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In PSNR we are interested in signal peak. This is more content specific than pure SNR.Here we say how high intensity regions of the image come through the noise and paying much less attention to low intensity regions. &lt;/p&gt;&#xA;" OwnerUserId="7794" LastActivityDate="2016-02-22T12:42:12.367" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28980" PostTypeId="2" ParentId="28977" CreationDate="2016-02-22T14:05:21.013" Score="1" Body="&lt;p&gt;Most signal processing starts with time-sampling a signal: you have two signals, the vibration signal, $v$, and the tachometer signal, $t$. The first thing you need to be sure of is that these are sampled synchronously in time. Do you know if that's the case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason &lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/372416A-01/svtconcepts/intro_ord_ana/&quot; rel=&quot;nofollow&quot;&gt;order analysis&lt;/a&gt; is used in the analysis of rotating machinery is that the various frequencies present in the vibration signal often depend on the rotational speed of the main shaft --- which can vary with time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Order analysis gets around this by resampling the vibration signal synchronously with rotation angle of the main (reference) shaft.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you need to do is to take the time-sampled signals you have and produce a single rotation-angle-sampled signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To generate the rotation angle signal, you need to take the tachometer signal, $t[n]$, and find the instantaneous phase of it. The way I'd start this is to find the Hilbert transform of $t$ and form the analytic signal:&#xA;$$&#xA;a[n] = t[n] + j H\left\{ t[n] \right\}&#xA;$$&#xA;where $H$ is the Hilbert transform and then the instantaneous phase is:&#xA;$$&#xA;\theta[n] = {\rm atan2}\left( {\tt Im}\{a[n]\} , {\tt Re}\{a[n]\} \right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there you should be able to resample both $a$ and $v$ so that you get each evenly sampled in phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once $v$ is evenly sampled in phase, you can then just use an FFT to do order analysis.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;yes they are sampled synchronously in time, does the hilbert transform still need to be applied ? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If they were not sampled synchronously, then it would be almost impossible to perform order analysis at all.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the purpose of the sweep filter ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The aim of the sweep filter is to turn the tacho signal into as pure a tone as possible.  If it's not a tone, then the Hilbert transform trick will not work correctly for finding the instantaneous phase.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;do i still need to apply FFT? Or does FFT only works on the broadband signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Once the vibration signal is resampled, it will be synchronous with the main shaft.  To get the orders (frequencies, in effect), you need to have some sort of frequency plot. The FFT is the easiest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The effect of this analysis is &lt;a href=&quot;http://www.mathworks.com/help/signal/examples/order-analysis-of-a-vibration-signal.html&quot; rel=&quot;nofollow&quot;&gt;illustrated in this Matlab application note&lt;/a&gt;. I believe the matlab function &lt;code&gt;rpmordermap&lt;/code&gt; effectively computes the short-time Fourier transform (but for &quot;orders&quot; rather than &quot;frequencies&quot;).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-02-22T21:36:08.600" LastActivityDate="2016-02-22T21:36:08.600" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="28983" PostTypeId="1" CreationDate="2016-02-22T19:58:41.423" Score="1" ViewCount="933" Body="&lt;p&gt;I want to compare throughput under different MCS( modulation and coding scheme). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know Shannon capacity $C = B \log(1+SNR)$ can be used to calculate throughput by SNR. However, there is no MCS parameter in this formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to calculate throughput using following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\rm throughput} = B \cdot ( {\rm code rate} ) \cdot \log(M)  \cdot  (1-P(r \cdot G(r))).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $B$ is bandwidth,&#xA;$M$ is constellation size,&#xA;$P()$ is bit error rate function,&#xA;$G()$ is coding gain function, &#xA;$r$ is SNR,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, 64QAM code rate 0.5 throughput will be $B \cdot 0.5 \cdot 6 \cdot (1-P(r \cdot G(r)))$.&#xA;However, it seems that no mathematical formula to calculate coding gain for turbo code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find a rough coding gain formula to compare different MCS performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any formula for coding gain of Turbo code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if there exist general formula to map MCS to bit error rate without considering which code is use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;any idea/reference will be great help on this regard. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="19669" LastEditorUserId="80" LastEditDate="2016-02-22T22:57:29.133" LastActivityDate="2016-02-22T22:57:29.133" Title="Is there any formula for coding gain of Turbo code?" Tags="|information-theory|channelcoding|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="28984" PostTypeId="2" ParentId="28968" CreationDate="2016-02-22T20:48:30.527" Score="3" Body="&lt;p&gt;FFT and IFFT are linear operators, and as such, the results only make a lot of sense in a linear intensity space, not if indexed into a non-linearly mapped space.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-22T20:48:30.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28985" PostTypeId="1" CreationDate="2016-02-22T21:12:50.370" Score="1" ViewCount="568" Body="&lt;p&gt;I am having an issue using neural networks to predict time series. Some predicted data fits with the expected data, as bellow: (In black the real time series and in blue the output of my neural network)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dsXUw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dsXUw.png&quot; alt=&quot;Australia energy demand&quot;&gt;&lt;/a&gt;&#xA;&lt;em&gt;Time serie: Australia energy demand.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But with the same code, with other time series, the predicted data does not fits with the expected data, and has a delay of one unit, as bellow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7C3QR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7C3QR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;em&gt;Time serie: Walmart Stock price.&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NoAyb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NoAyb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;em&gt;Time serie: Dollar libra exchange.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some articles about some variations of neural networks and at the results section shows the plot with the delay like my results, as bellow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7wuJO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7wuJO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;em&gt;Time serie: Dollar libra exchange. &#xA;(Article link: &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S1877050915015793&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.sciencedirect.com/science/article/pii/S1877050915015793&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone knows if this is a common behavior or can be something wrong with my code ? I am having this issue about three months ago, and since there I am trying to figure out some bug in my code but is all right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks and I appreciate any tip.&lt;/p&gt;&#xA;" OwnerUserId="19674" LastActivityDate="2016-03-09T21:31:32.843" Title="Delay issue in time series prediction" Tags="|matlab|time-series|neural-network|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28986" PostTypeId="2" ParentId="27257" CreationDate="2016-02-22T21:28:10.783" Score="1" Body="&lt;p&gt;You have to estimate a velocity based on a regularly sampled signal. The velocity is given by the derivative on a continuous time signal. The approximation of this value with discrete data is a long-lasting topic. @Juancho is correct with the proposal of the $2$-point difference scheme. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the sampling is never perfect, and $x[i]-x[i-1]$ is not symmetric. So if you do not need fully causal results, there exists more &lt;a href=&quot;https://en.wikipedia.org/wiki/Symmetric_derivative&quot; rel=&quot;nofollow noreferrer&quot;&gt;symmetric derivative&lt;/a&gt; schemes, such as an average of forward and backward differences:  $\frac{1}{2}(x[i]-x[i-1])+(x[i+1]-x[i]) = \frac{x[i+1]-x[i-1]}{2}$. Other schemes can be found in &lt;a href=&quot;https://www3.nd.edu/~coast/jjwteach/www/www/30125/pdfnotes/lecture8_13v15.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Numerical differentiation formulae&lt;/a&gt; (see &lt;a href=&quot;https://dsp.stackexchange.com/questions/28839/what-are-the-implications-of-resampling-the-derivative-of-a-signal-with-a-higher/28844?noredirect=1#comment53983_28844&quot;&gt;here&lt;/a&gt; for a discussion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need to compute forward derivatives for real-time purposes, a paper (in French, but formulae are readable) is &lt;a href=&quot;http://documents.irevues.inist.fr/handle/2042/13661&quot; rel=&quot;nofollow noreferrer&quot;&gt;Estimation par maximum de vraisemblance de la dérivée d'un signal bruité&lt;/a&gt;, with cares about noise issues.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-02-22T21:28:10.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28988" PostTypeId="2" ParentId="28985" CreationDate="2016-02-22T22:49:23.723" Score="1" Body="&lt;p&gt;The error may be in calling the actual time series &quot;expected data&quot; (unless you expect an unpredictable random walk).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If each sample is random and uncorrelated with all previous time series measurements, except for having a distribution mean near that of the immediately preceding sample (such as in a random walk), than any predictor (NN or other) of the next sample might lag (guess near the mean of the distribution, e.g. just the previous sample).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the cases where the mechanics of some hidden state (planetary rotational or orbital momentum, etc.) is producing the measured data, a NN might be able to be trained to deduce certain hidden oscillators (low order diffEQ solutions involving that state) or some trend line, and thus not lag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the lag you find may be a measurement of how well your NN is differentiating between the two cases above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to see a lag, then try increasing the training error function for producing a lagged output until the NN is trained to produce a different (more random?) output than a mere input follower, given a random walk input.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-03-09T21:31:32.843" LastActivityDate="2016-03-09T21:31:32.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28989" PostTypeId="1" AcceptedAnswerId="28990" CreationDate="2016-02-23T04:08:24.710" Score="0" ViewCount="414" Body="&lt;p&gt;So I'm currently studying ASK (amplitude shift keying) and how it is modulated and demodulated. The modulation take out data signal, $M(t)$, and multiplies it with our carrier frequency, lets say $\cos(2\pi f t)$, and that's our modulated signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the demodulation, we our taking our received signal and multiplying it with our carrier frequency, which in the frequency domain shifts our received signal to the left and right by our carrier frequency. So we end up with out signal both at the origin and at 2 times our carrier frequency. After that we can do a low pass filter to recover out message signal $M(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, what happened to our correlator? I thought in digital communications you take your received signal and pass it through a match filter, which can also be implemented as a correlator. In discrete time this is a multiplication with a signal and then a summation, right? What it seems like we're doing is just multiplying just a single point from the received signal with a single point of our carrier frequency. I've simulated this in MATLAB, and I can see what happens to the signal, I'm just confused why this simple multiplication be being called a correlator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, can this multiplication and low pass filter be done in the frequency domain by any chance? I know a convolution (or correlation) in the time domain is just a multiplication in the frequency domain, but i'm not sure how to do what we're doing for the ASK demodulation in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time and input!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastEditorUserId="8202" LastEditDate="2016-02-23T10:15:08.573" LastActivityDate="2016-02-23T19:01:13.643" Title="Question about ASK, correlation, and frequency domain" Tags="|discrete-signals|digital-communications|modulation|demodulation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28990" PostTypeId="2" ParentId="28989" CreationDate="2016-02-23T09:02:55.223" Score="0" Body="&lt;p&gt;You are mixing different notions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens in basic digital transmission is :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Digital signal generation (0's and 1's)&lt;/li&gt;&#xA;&lt;li&gt;Bit to symbol association (digital modulation), in our example ASK.&lt;/li&gt;&#xA;&lt;li&gt;Shape filtering, which allows the signal's spectrum to be contained within a standardized shape, since we can't just throw a digital signal with very sharp transitions in the air, in would pollute the electromagnetic spectrum.&lt;/li&gt;&#xA;&lt;li&gt;Finally, we mix the signal with a carrier frequency in order to shifts it's spectrum around the appropriate transmitting frequency&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What happens at the receptor is the same operations in anti-chronological order :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Analog demodulation (the signal is mixed with a carrier of the same frequency)&lt;/li&gt;&#xA;&lt;li&gt;Matched filtering, which is the same operation as in the emitter, but with a specific filter, which is ideally the complex conjugate and temporally reverted of the filter used in emission ($g^*(-t)$). Why is it this one and not another ? &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist_ISI_criterion&quot; rel=&quot;nofollow&quot;&gt;See Nyquist ISI criterion.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Symbol estimation&lt;/li&gt;&#xA;&lt;li&gt;Digital demodulation of estimed symbol&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;About the filtering operation specifically : time domain and frequency domain operations are equivalent. If you do a time domain filtering, or any mathematical operation (under trivial notations) :&#xA;$$&#xA;y(t) = g(t)*x(t)&#xA;$$&#xA;It is equivalent to frequency domain multiplication :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y(f) = G(f)X(f)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Analog amplitude modulation of a signal $r(t)$ is, like you say, the operation $r(t)\cos(2\pi f_0t)$ (multiplication) which in frequency domain is equivalent to $R(f)(1/2)*(\delta(f-f_0)+\delta(f+f_0))$ (convolution). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Demodulation takes $r(t)\cos(2\pi f_0t)$ and multiply it again :&#xA;$$&#xA;s(t) = r(t)\cos(2\pi f_0t)\cos(2\pi f_0t)&#xA;$$&#xA;Which gives after simplifications :&#xA;$$&#xA;s(t) = r(t)\frac{1}{2}\left(1+\cos(4\pi f_0t)\right)&#xA;$$&#xA;That's when your LPF comes into action : it filters the unwanted $2f_0$ component and keeps only $r(t)$ which is the demodulated signal, and to do this mathematically, we write $s(t)*lpf(t)$, $lpf(t)$ being the LPF's impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short : analog demodulation is either a &lt;strong&gt;multiplication&lt;/strong&gt; in time domain ($r(t)\cos(2\pi f_0t)\cos(2\pi f_0t)$) followed by a convolution in time domain ($s(t)*lpf(t)$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OR&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a &lt;strong&gt;convolution&lt;/strong&gt; in frequency domain ($R(f)*M(f)*M(f)$) (with $M(f)=(1/2)*(\delta(f-f_0)+\delta(f+f_0))$ followed by a multiplication in frequency domain ($S(f)LPF(f)$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BUT both methods outputs are the same, physically speaking. We work in frequency or time domain according to which domain is best suited to give easy calculations, as you may have noticed.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="11256" LastEditDate="2016-02-23T19:01:13.643" LastActivityDate="2016-02-23T19:01:13.643" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="28994" PostTypeId="1" AcceptedAnswerId="29038" CreationDate="2016-02-23T16:16:00.010" Score="0" ViewCount="449" Body="&lt;p&gt;This question is possibly relevant to &lt;a href=&quot;https://dsp.stackexchange.com/questions/15763/resonant-peak-frequencies-for-phaser-effect&quot;&gt;this&lt;/a&gt; one, but it's not duplicate as far as I'm aware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to make phaser with feedback control as shown in the picture below: (Got it from &lt;a href=&quot;https://en.wikipedia.org/wiki/Phaser_%28effect%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0dI8y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0dI8y.png&quot; alt=&quot;reference phaser design&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First problem for me was that feedback loop here doesn't have any delay, so at time $n$ I should pass allpass cascade output $y_n$ to its input at this exact time which seemed impossible to me. However, thanks to &lt;a href=&quot;https://dsp.stackexchange.com/questions/15763/resonant-peak-frequencies-for-phaser-effect#comment27282_15767&quot;&gt;this&lt;/a&gt; comment I was able to figure out how to transform IIR filter cascade to incorporate this feedback into it in terms of its coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recursive equation for $k$-th order IIR filter:&#xA;$$y_n = b_0x_n + b_1x_{n-1} + ... + b_kx_{n-k} - a_1y_{n-1} - a_2y_{n-2} - ... - a_ky_{n-k}$$&#xA;As we pass system output through explicit feedback loop our input sequence $x_n$ is defined as follows:&#xA;$$x_n = d_n + fy_n$$ where $d_n$ is system &quot;dry&quot; input and $f$ is feedback coefficient such as $|f| &amp;lt; 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we plug this into the first equation we'll get&#xA;$$y_n = b_0(d_n + fy_n) + b_1(d_{n-1} + fy_{n-1}) + ... + b_k(d_{n-k} + fy_{n-k}) - a_1y_{n-1} - a_2y_{n-2} - ... - a_ky_{n-k}=\\&#xA;=b_0d_n + b_0fy_n+...+b_kd_{n-k}+b_kfy_{n-k}-a_1y_{n-1}-...-a_ky_{n-k}=\\&#xA;= b_0fy_n+b_0d_n+...+b_kd_{n-k}-(a_1-b_1f)y_{n-1}-...-(a_k-b_kf)y_{n-k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving all $y_n$ terms to the left and grouping them we'll finally get our desired system coefficients:&#xA;$$(1-b_0f)y_n = b_0d_n+b_1d_{n-1}+...+b_kd_{n-k}-(a_1-b_1f)y_{n-1}-(a_2-b_2)y_{n-2} -...-(a_k-b_k)y_{n-k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the problem is: we all know we cannot directly use filters with order $k &amp;gt; 2$ without stumbling upon various stability problems. Say, I want to implement phaser with four notches, meaning I'll have allpass cascade of overall order $k = 8$ In that case I would probably want to find poles/zeros of my system analytically (instead of coefficients) and split it to second order sections afterwards or something like that, but I cannot figure out how to find poles/zeros instead of coefficients or is it even possible to do so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I've got is that using the fact that for allpass of order $k$ and having poles $[p_1, p_2, ..., p_k]$ its zeros will be always equal to $[1/p_1, 1/p_2, ..., 1/p_k]$ and knowing that all poles of initial system (without feedback) are equal I can write down my problem as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(x - p)^8 + a(x-1/p)^8= 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p,a \in ℝ$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|p| &amp;lt; 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|a| &amp;lt; 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, below you can find matlab code which calculates filter coefficients for the whole phaser, you can see unstable case on &#xA;&lt;code&gt;[bf, af] = notch_reso2(100, 48000, 0.5, 0.5);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [ b, a ] = notch_reso2(  fc, fs, feedback, depth  )&#xA;order = 8;&#xA;w = pi * fc / fs;&#xA;a1 = (1 - cot(w)) / (1 + cot(w));&#xA;k = a1 ^ order;&#xA;p = -a1;&#xA;z = 1/p;&#xA;&#xA;zs = repmat(z, 1, order);&#xA;ps = repmat(p, 1, order);&#xA;&#xA;b = poly(zs) .* k;&#xA;a = poly(ps);&#xA;&#xA;f = feedback;&#xA;&#xA;af = a - b .* f;&#xA;bf = b ./ af(1);&#xA;af = af ./ af(1);&#xA;&#xA;bf = bf .* depth + af * (1 - depth);&#xA;b = bf;&#xA;a = af;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19685" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-02-26T10:49:45.270" Title="Phaser effect with feedback control IIR filter calculation" Tags="|filters|audio|filter-design|infinite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="28996" PostTypeId="1" CreationDate="2016-02-23T18:05:17.710" Score="2" ViewCount="108" Body="&lt;p&gt;I need to detect two sounds (913 Hz and 1370 Hz), knowing the time in which each starts and ends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this time, I am using a band pass filter (butter), and this is the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KEmYj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KEmYj.png&quot; alt=&quot;First image is the original signal, second is after a bpf at 913Hz (window=150 Hz)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the first time this sound occurs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DgqTc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DgqTc.png&quot; alt=&quot;First time the sound at 913 Hz occurs&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red line is where the sound is supposed to end (276 ms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can I detect that the first time the tone occurs it starts at 0 ms and ends at 276 ms?&lt;/p&gt;&#xA;" OwnerUserId="19667" LastActivityDate="2016-03-04T17:43:22.243" Title="How to know when a sound in a given frequency starts and ends?" Tags="|audio|python|scipy|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="28997" PostTypeId="2" ParentId="28996" CreationDate="2016-02-23T18:29:32.097" Score="0" Body="&lt;p&gt;A matched filter trained on the onset and release keying times for your particular keyboard (perhaps unified, or perhaps divided into the two frequency bands) might work.  The length of the matched filter might depend on the S/N ratio and your desired statistical error rate.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-23T18:29:32.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29000" PostTypeId="1" CreationDate="2016-02-23T22:08:07.533" Score="0" ViewCount="2999" Body="&lt;p&gt;Our teacher gave us a homework.&#xA;He says first find an ecg signal, then take FFT of that signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we need to take FFT of an ecg signal? Is it that we can cancel noise only if we know the frequency spectrum of the signal?&lt;/p&gt;&#xA;" OwnerUserId="19105" LastActivityDate="2016-02-23T22:30:47.880" Title="What is the beneficient of taking the FFT of an ecg signal?" Tags="|fft|ecg|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29001" PostTypeId="2" ParentId="29000" CreationDate="2016-02-23T22:30:47.880" Score="1" Body="&lt;p&gt;I'm not a doctor, I'm an engineer. However, I think I see the point of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An electrocardiograph is used as a diagnostic tool to assess the state of the heart and cardiovascular system. Several signals are measured, each of which can be used to make judgements about the health of the patient. Most of the signals measured in an ECG are periodic (in other words, they occur at a given frequency). The DFT/FFT is basically a way of analyzing the frequency content of a signal. So, it follows that by taking the DFT/FFT of an ECG, you can easily see those frequency components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the Wikipedia article on ECGs, here are some common components of an ECG and their associated frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P Wave: 0.08s, 12.5Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;QRS Complex 0.09s, 11Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;T Wave: 0.16s, 6.25Hz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't actually know the medical meaning of those features, but in any case, they're periodic, meaning you can analyze them using spectral analysis.&lt;/p&gt;&#xA;" OwnerUserId="19548" LastActivityDate="2016-02-23T22:30:47.880" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29002" PostTypeId="1" CreationDate="2016-02-24T01:48:38.907" Score="0" ViewCount="895" Body="&lt;p&gt;Please, take a look at section, 1.2.3 (Signal Duration), Page-03, of the book Shaum's Outlines: Digital Signal Processing by  by Monson H. Hayes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the definition, I can imagine how a right-sided and a left-sided signal look like.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0SWeQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0SWeQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I cannot visualize a two-sided signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would an two sided signal look like?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I need is to see a double-sided signal. As far as I know, a double sided signal is a complex exponential signal. So, that means it should be a plot of a complex exponential function. Am I correct?&lt;/p&gt;&#xA;" OwnerDisplayName="user18425" LastEditorDisplayName="user18425" LastEditDate="2016-02-24T06:20:58.337" LastActivityDate="2016-02-24T07:23:50.110" Title="What would the plot of an two sided digital signal look like?" Tags="|discrete-signals|digital|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29003" PostTypeId="1" CreationDate="2016-02-24T05:21:01.657" Score="1" ViewCount="868" Body="&lt;p&gt;For the zero input + zero state response in continuous time linearly time-invariant systems, why is the $y(t)$ equation not &quot;technically&quot; considered an LTI? I read this in a journal and there was no justification. How would you change the equation to make it a true LTI?&lt;/p&gt;&#xA;" OwnerUserId="19696" LastEditorUserId="1629" LastEditDate="2016-02-24T10:04:27.820" LastActivityDate="2016-02-24T10:04:27.820" Title="Why is the total signal response response of zero input + zero state, $y(t) = y_0(t) + h(t)\star x(t)$, not an LTI?" Tags="|linear-systems|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29004" PostTypeId="2" ParentId="29002" CreationDate="2016-02-24T06:51:45.070" Score="1" Body="&lt;p&gt;A function of $x$ is &lt;em&gt;right-sided&lt;/em&gt; if and only if there is some&#xA;$x_0$ such that the value of the function is zero for all $x &amp;lt;&#xA;x_0$, and &lt;em&gt;left-sided&lt;/em&gt; if and only if there is&#xA;some $x_0$ such that the value of the function is zero for all $x &amp;gt;&#xA;x_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise for signals with time represented by $x$. A &lt;em&gt;double-sided&lt;/em&gt; signal has neither restriction. For example a Gaussian function and $\sin(x)$ (both pictured below) are double-sided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jgXqk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jgXqk.png&quot; alt=&quot;Gaussian function&quot;&gt;&lt;/a&gt;&lt;br&gt;$f(x) = \frac{e^{-\frac{x^2}{2}}}{\sqrt{2 \pi }}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kbZzL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kbZzL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;br&gt;$f(x) = \sin(x)$&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-02-24T07:23:50.110" LastActivityDate="2016-02-24T07:23:50.110" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29005" PostTypeId="1" CreationDate="2016-02-24T08:21:22.603" Score="0" ViewCount="86" Body="&lt;p&gt;I need to control crane trolley (pendulum), I have state space representation as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;A=\begin{bmatrix}&#xA;	0	&amp;amp;	1	&amp;amp;	0	&amp;amp;	0	 \\&#xA;	0	&amp;amp;	0	&amp;amp;	\frac{m_b}{m_j}g		&amp;amp;	0	 \\&#xA;	0	&amp;amp;	0	&amp;amp;	0	&amp;amp;	1	 \\&#xA;	0	&amp;amp;	0	&amp;amp;	\frac{m_b+m_j}{m_j L}g		&amp;amp;	0	 \\&#xA;	\end{bmatrix}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;	B=\begin{bmatrix}&#xA;	0	\\	\frac{1}{m_j}	\\	0	\\	-\frac{1}{m_j L}&#xA;	\end{bmatrix}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;	C=\begin{bmatrix}&#xA;	1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;	\end{bmatrix}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;	D=\begin{bmatrix}&#xA;	0&#xA;	\end{bmatrix}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been told that if I want to use state feedback, I need to extend this system with integrator. Why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I could provide any other possible information, just ask in comment)&lt;/p&gt;&#xA;" OwnerUserId="19697" LastActivityDate="2016-02-24T08:21:22.603" Title="Control of pendulum (crane trolley)" Tags="|control-systems|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29007" PostTypeId="1" CreationDate="2016-02-24T08:28:26.957" Score="2" ViewCount="52" Body="&lt;p&gt;Can any one tell me how to design wavelets from splines using matlab. whether we can make wavelets from higher order splines or only with B splines&lt;/p&gt;&#xA;" OwnerUserId="17018" LastActivityDate="2016-02-24T08:28:26.957" Title="how to design wavelets from splines" Tags="|signal-analysis|filter-design|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29008" PostTypeId="2" ParentId="29003" CreationDate="2016-02-24T08:29:10.090" Score="5" Body="&lt;p&gt;The response of the system is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=h(t)\star x(t)+y_0(t)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x(t)$ is the input signal, $h(t)$ is some well-behaved function, $y_0(t)$ is a function which is &lt;em&gt;independent&lt;/em&gt; of $x(t)$, and $\star$ denotes convolution. The model $(1)$ can be used for describing systems with non-zero initial conditions that would be LTI were it not for the non-zero initial conditions (such as an initially charged capacitor). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $y_0(t)=0$, $h(t)$ would be the impulse response of the corresponding LTI system. For $y_0(t)\neq 0$, $h(t)$ is not the impulse response, neither can the system be characterized by an impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $y_0(t)\neq 0$, the system described by $(1)$ cannot be linear, which is easily shown by considering a response $y_1(t)$ to an input signal $x_1(t)$. For a linear system, the response to a scaled version of $x_1(t)$ must be a scaled version of $y_1(t)$, with the same scaling factor. So the response to $ax_1(t)$ must be $ay_1(t)$ if the system is linear. But from $(1)$ we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_1(t)=h(t)\star x_1(t)+y_0(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and for the scaled input we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t)=h(t)\star ax_1(t)+y_0(t)=ay_1(t)+(1-a)y_0(t)\neq ay_1(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $y_0(t)\neq 0$ and $a\neq 1$. Consequently, the system described by $(1)$ is not linear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a similar way it can be shown that the system is also not time-invariant. The reason is again the function $y_0(t)$, which is independent of the input signal $x(t)$. If $x(t)$ is shifted, the output doesn't shift accordingly, because $y_0(t)$ doesn't shift.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-24T08:39:29.430" LastActivityDate="2016-02-24T08:39:29.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29009" PostTypeId="1" CreationDate="2016-02-24T09:50:07.203" Score="0" ViewCount="37" Body="&lt;p&gt;Does Reed-Muller codes $\mathrm{RM}(r,m)$ exist for $r = 0$ and $m = 0$? Namely,  does $\mathrm{RM}(0,0)$ exist?  Some books mention that $m$ should be a natural number whereas some books mention that it can be a whole number including $0$,  for example Shu Lin and  Daniel Costello  &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0130426725&quot; rel=&quot;nofollow&quot;&gt;Error Control Coding&lt;/a&gt;  book.&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="15892" LastEditDate="2016-02-24T20:38:28.757" LastActivityDate="2016-02-24T21:52:39.247" Title="Does Reed-Muller codes exist when $r = 0$ and $m = 0$?" Tags="|forward-error-correction|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29011" PostTypeId="1" CreationDate="2016-02-24T11:04:03.803" Score="4" ViewCount="679" Body="&lt;p&gt;The Sliding DFT generates the spectrum for every input sample. Using the FFT, the spectrum is generated only after a certain number of samples (N) are obtained. It appears to me as though the cycles to perform the Sliding DFT would be much larger than the cycles required to do an FFT, to generate an N point DFT. Would it be recommended to use the Sliding DFT to generate an N point spectrum? The motivation for me to consider using the Sliding DFT to generate an N point spectrum is time resolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone give me an idea of the challenges in implementing the Sliding DFT on a DSP?&lt;/p&gt;&#xA;" OwnerUserId="18014" LastActivityDate="2016-03-25T21:32:23.997" Title="Would it be feasible to implement the Sliding DFT on a digital signal processor?" Tags="|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29013" PostTypeId="1" AcceptedAnswerId="29014" CreationDate="2016-02-24T14:34:25.007" Score="1" ViewCount="79" Body="&lt;p&gt;In theory, how would one process an audio signal to find the spots marked in the linked picture below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/41BKO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mel Spectrogram&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I am not really conform with signal processing and could not find any fitting solutions while looking for similar problems.&lt;br&gt;&#xA;I have read a lot about signal processing but might have looked in the wrong places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, my idea would be: windowing over the signal, applying FFT to each window and check if the frequency/signal strength exceeds a certain value. I am not quite sure if this would work out, plus it seems rather ineficcient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point me in the direction of where to begin and how to identify these spots?&lt;/p&gt;&#xA;" OwnerUserId="19694" LastActivityDate="2016-02-24T17:09:39.030" Title="Finding specific spots in an audio signal" Tags="|fft|audio|interest-points|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29014" PostTypeId="2" ParentId="29013" CreationDate="2016-02-24T14:38:00.820" Score="1" Body="&lt;p&gt;What you are describing is exactly how to plot a spectrogram. Finding the spots can be done with a classic peak-finding function in any software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking for coding the algorithm from scratch, here is a method, which is the most intuitive but not the fastest in term of calculations :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider your spectrogram as a $n\times m$ array of numbers, with each number position referenced as $(i,j)$. You have to find which points are greater or equal to all of their neighbors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In pseudo-code it would give something like :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i from 1 to n&#xA;  for j from 1 to m&#xA;     if : &#xA;       number(i,j) &amp;gt; number (i-1,j-1)&#xA;   and number(i,j) &amp;gt; number (i-1,j)&#xA;   and number(i,j) &amp;gt; number (i-1,j+1)&#xA;   and number(i,j) &amp;gt; number (i,j-1)&#xA;   and number(i,j) &amp;gt; number (i,j+1)&#xA;   and number(i,j) &amp;gt; number (i+1,j-1)&#xA;   and number(i,j) &amp;gt; number (i+1,j)&#xA;   and number(i,j) &amp;gt; number (i+1,j+1)&#xA;     then : &#xA;       save (i,j) as a peak value&#xA;   end if&#xA;end for&#xA;end for&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, this is not very sharp since it does not consider whether you are finding a &quot;big&quot; peak or just a smaller one. In that case, you can improve it by setting a minimum offset value like :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if number(i,j) &amp;gt; number(i-1,j-1) + offset&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this is just a simple example of a peak finding algorithm and I didn't took the boundary points specific case into account. More efficient methods exist but I can detail each one here.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="19532" LastEditDate="2016-02-24T17:09:39.030" LastActivityDate="2016-02-24T17:09:39.030" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29015" PostTypeId="1" CreationDate="2016-02-24T14:48:21.993" Score="1" ViewCount="97" Body="&lt;p&gt;Hello I'm reading the following document to better understand windowing and how to use it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Spectrum and spectral density estimation by the Discrete Fourier&#xA;  transform (DFT), including a comprehensive list of window functions&#xA;  and some new  at-top windows.&quot; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.rssd.esa.int/SP/LISAPATHFINDER/docs/Data_Analysis/GH_FFT.pdf&quot; rel=&quot;nofollow&quot;&gt;You can find the file overhere&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to reproduce their example (chapter 13) on audio signals but i have some questions.&#xA;Just like the example i use the Hann(ing) window. with a overlab of 50%&#xA;For reproducion i use python&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let say i have a typical Audio signal with a &lt;code&gt;fs&lt;/code&gt; of &lt;code&gt;44100 Hz&lt;/code&gt; and a length of &lt;code&gt;T = 5 sec&lt;/code&gt;. &#xA;I have a window of 0.1 sec(neglecting the nice length of &lt;code&gt;N&lt;/code&gt;).&#xA;With the overlab i get an matrix of 100(Windows) X 4410 Samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Normaly i see just a single Spectrum plot (exept STFT). How come i from a my set of spectra to a single spectrum? &lt;a href=&quot;http://manual.audacityteam.org/o/man/plot_spectrum.html&quot; rel=&quot;nofollow&quot;&gt;Like what Audacity have&lt;/a&gt;&lt;br&gt;&#xA;Averaging; summing; ... other&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;what is the impact of changes in time at the resulting spectrum. Let say using a (measured) sweeping signal?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope that somebody can help me now&lt;/p&gt;&#xA;" OwnerUserId="13541" LastEditorUserId="13541" LastEditDate="2016-03-10T08:01:40.083" LastActivityDate="2016-03-10T08:01:40.083" Title="Window function on large arays" Tags="|fft|python|window-functions|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29016" PostTypeId="2" ParentId="29009" CreationDate="2016-02-24T15:14:09.657" Score="2" Body="&lt;p&gt;The codewords in a Reed-Muller code of degree $d$ and length $2^n$ are binary vectors of the form&#xA;$$\big(f(0,0,\ldots, 0, 0), f(0,0, \ldots, 0, 1),&#xA;f(0,0, \ldots, 1, 0), f(0,0, \ldots, 1, 1), \cdots, f(1,1,\ldots, 1,1)&#xA;\big)$$&#xA;where $f$ is the corresponding binary polynomial of degree at most&#xA;$d$ in $n$ variables. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose first that $n &amp;gt; 0$. The &lt;em&gt;dimension&lt;/em&gt; of the code is&#xA;$$k = \sum_{i=0}^d \binom{n}{i}\tag{1}$$&#xA;If $d=0$, then $k = \binom{n}{0}=1.$ There are only two &quot;polynomials&quot;&#xA;of degree $0$ in $n$ variables, namely the constants $0$ and $1$, and consequently&#xA;the codewords of length $2^n$ are $000\cdots 0$ and $111\cdots 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $n=0$ also, the codewords (if any) are of length $2^0 = 1$.&#xA;Now, you might want to claim from $(1)$ that $k = \binom{0}{0} = \frac{0!}{0!(0-0)!} = 1$ and so there are $2^k = 2$ codewords &#xA;(which, of course, are $0$ and $1$).&#xA;Alternatively, the $k$ in Equation $(1)$ is the total number of&#xA;subsets of cardinality $d$ or less of a set of $n$ elements.&#xA;There is exactly one subset (of cardinality $0$) &#xA;of the set of $0$ elements (namely,the empty set $\emptyset$).&#xA;and that subset is $\emptyset$ itself. Thus, the Reed-Muller code&#xA;of order $0$ and length $2^0$ is the $(1,1)$ code consisting&#xA;of two codewords $0$ and $1$. As a linear code, this is the&#xA;identity map.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2016-02-24T21:52:39.247" LastActivityDate="2016-02-24T21:52:39.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29018" PostTypeId="1" CreationDate="2016-02-24T16:13:59.747" Score="1" ViewCount="550" Body="&lt;p&gt;I would like to determine the number of text-blocks verifying a roughly similar pattern. I have the intuition that I could do it using some Discrete Fourier Transform (DFT)-like methodology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Votre date de livraison estimée est :  Mercredi 7 octobre 2015 - &#xA;  Vendredi 9 octobre 2015&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Votre mode de livraison est :  Livraison Rapide&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Vos commandes     Votre commande sera expédiée à : &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;M. X &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;120 Road Nowhere &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Floor 1 Company Z &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;City, Zipcode &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Country&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Votre date de livraison estimée est :  Mercredi 13 mai 2016 - &#xA;  Vendredi 1 juin 2016&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Votre mode de livraison est :  Livraison Rapide&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Vos commandes     Votre commande sera expédiée à : &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Mrs ZZ&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;10, Street Paradise &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Another city, another zipcode &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Country2&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Votre date de livraison estimée est :  Mercredi 7 octobre 2010 - &#xA;  Vendredi 9 octobre 2011&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Votre mode de livraison est :  Livraison Rapide&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Vos commandes     Votre commande sera expédiée à : &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;M. YX&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;333, avenue WeirdName &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Door 5 Start-up U &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;SF, ZIP &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;US&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I want to determine that there are 3 blocks (the 3 info for delivery address Amazon-like). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot rely rely on vocabulary (it is not necessarily this kind of text-content). The structure of the blocks is similar (+noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone (in)validate this idea, and help me to develop it? &lt;/p&gt;&#xA;" OwnerUserId="18913" LastActivityDate="2016-02-24T16:13:59.747" Title="Discrete Fourier Transform for text analysis?" Tags="|discrete-signals|signal-analysis|fourier-transform|dft|text-recognition|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29019" PostTypeId="1" AcceptedAnswerId="29021" CreationDate="2016-02-24T16:32:27.913" Score="5" ViewCount="2030" Body="&lt;p&gt;My question is about the number of data points when doing a convolution (or correlation) in the the time or frequency domain. let's say we have two signals, $a(t)$ and $b(t)$ each of length $16$. When we do the convolution as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c(t) =a(t)\star b(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$c(t)$ consists of $31$ points, right? Now if we transform these into $A(f) = \mathrm{FFT}(a(t))$ and $B(f) = \mathrm{FFT}(b(t))$, $A(f)$ and $B(f)$ each consist of $16$ points still, were the first half is a mirror of the second half. The convolution is just a multiplication in the frequency domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(f) = A(f)\cdot B(f)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe $C(f)$ should be $16$ points. I'm fine with that much, but if we transform $C(f)$ back to the time domain, doesn't  $c(t)$  end up having $16$ points?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure I'm just not thinking correctly about this. Thanks for any clarification!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastEditorUserId="4298" LastEditDate="2017-12-17T17:35:49.920" LastActivityDate="2017-12-17T17:35:49.920" Title="Question about convolution in time and frequency domain" Tags="|fft|convolution|dft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29021" PostTypeId="2" ParentId="29019" CreationDate="2016-02-24T17:55:02.097" Score="7" Body="&lt;p&gt;Normally, the variables $t$ and $f$ are used for &lt;em&gt;continuous&lt;/em&gt; time and frequency. But from your question I understand that you're talking about &lt;em&gt;discrete&lt;/em&gt; time and frequency, and their relation via the &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot;&gt;Discrete Fourier Transform (DFT)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have discrete-time sequences $a[n]$ and $b[n]$ and their DFTs $A[k]$ and $B[k]$, then the DFT of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Convolution#Discrete_convolution&quot;&gt;linear convolution&lt;/a&gt; $c[n]=a[n]\star b[n]$ is NOT equal to $A[k]\cdot B[k]$. The product of the DFTs corresponds to &lt;a href=&quot;https://en.wikipedia.org/wiki/Circular_convolution&quot;&gt;circular (or cyclic) convolution&lt;/a&gt; in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The linear convolution of two $16$-point sequences has indeed $2\cdot 16-1=31$ points, whereas the circular convolution of two $16$-point sequences also has $16$ points.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-02-24T18:33:12.647" LastActivityDate="2016-02-24T18:33:12.647" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29022" PostTypeId="1" CreationDate="2016-02-24T18:43:25.187" Score="1" ViewCount="799" Body="&lt;p&gt;Although I am not new to math or programming, I am a total newbie to image segmentation.  I have the following light microscope image&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Z7wxX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z7wxX.jpg&quot; alt=&quot;H&amp;amp;E Stail&quot;&gt;&lt;/a&gt;&#xA;and I would like to segment it into cytoplasm (the magenta background) vs. the nuclei (the round-ish objects that look like cells).  I am working in MATLAB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was hoping someone with segmentation or image processing experience could tell me what they thought would be an efficient approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, do you see any issues with this image that I ought to pre-process out?  E.g. non-uniform background illumination, noise, etc.  I am not familiar with how to identify these things visually in an image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, there are two dominant colors in this image, corresponding to two dyes (hematoxylin and eosin, or &quot;H&amp;amp;E&quot; for short).  The cytoplasm and nuclei have different colors, which in principle we know the RGB values of.  So I first tried a method of color deconvolution by Ruifrok to try to separate out the pink from the purple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I did that, the cytoplasm and nuclei seem to have very different textures.  I tried a range filter and got the result below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uAD3E.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uAD3E.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any suggestions for where I can go from here?  How can I eliminate the regions with cytoplasm and end up with clearly segmented nuclei?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know much about graph cuts.  Do you think they would be useful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if I need to clarify the question.&lt;/p&gt;&#xA;" OwnerUserId="19630" LastEditorUserId="19630" LastEditDate="2016-02-24T19:00:33.267" LastActivityDate="2016-03-01T08:42:34.053" Title="Seeking segmentation methods for this light microscope image" Tags="|computer-vision|image-segmentation|color|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29023" PostTypeId="2" ParentId="29022" CreationDate="2016-02-24T19:36:27.350" Score="1" Body="&lt;p&gt;People were approaching similar problems with methods deriving from &lt;a href=&quot;http://de.mathworks.com/company/newsletters/articles/the-watershed-transform-strategies-for-image-segmentation.html?refresh=true&quot; rel=&quot;nofollow&quot;&gt;Watersheds thresholding&lt;/a&gt;. &lt;a href=&quot;http://fiji.sc/Nuclei_Watershed_Separation&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt;, is a sample of Nuclei Seperation, and &lt;a href=&quot;http://docs.opencv.org/master/d3/db4/tutorial_py_watershed.html#gsc.tab=0&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; is an OpenCV sample. You might try it out.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2016-02-24T19:36:27.350" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29024" PostTypeId="2" ParentId="29011" CreationDate="2016-02-24T21:01:30.033" Score="1" Body="&lt;p&gt;The paper &lt;a href=&quot;http://dx.doi.org/10.1109/APEC.2006.1620695&quot; rel=&quot;nofollow&quot;&gt;Sliding DFT control algorithm for three-phase active power filter&lt;/a&gt; implements a sliding a sliding DFT on a TMS320F2812 from Texas Instruments, and discusses some advantages, and &lt;a href=&quot;http://www.cdax.eu/sites/default/papers/AMPS_2014.pdf&quot; rel=&quot;nofollow&quot;&gt;An Enhanced Interpolated-Modulated Sliding DFT for High Reporting Rate PMUs&lt;/a&gt; does similar work on FPGA.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I remember, you may have a look at the stability, see  &lt;a href=&quot;http://www.cmlab.csie.ntu.edu.tw/DSPCourse/reference/Sliding%20DFT.pdf&quot; rel=&quot;nofollow&quot;&gt;The Sliding DFT&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-24T21:01:30.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29025" PostTypeId="2" ParentId="29019" CreationDate="2016-02-24T21:21:13.810" Score="2" Body="&lt;p&gt;If you want to do linear convolution in the frequency domain, first you would zero-pad your length 16 sequences to 31 or 32 long, then do the FFT, multiply, IFFT, to end up with your 31 point result (plus perhaps one extra in the more efficient 32 point case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise, circular convolution would munge the 15 more results of the 31 in with the first 16 results, making a mess (unless you wanted a circular convolution).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-24T21:21:13.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29026" PostTypeId="1" CreationDate="2016-02-25T03:22:05.683" Score="2" ViewCount="9359" Body="&lt;p&gt;What is the way to address the removal of white noise from a signal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extra Details &#xA;Hi I also agree the details are as follow:                                                                                    The signal is a acoustic or a sound wave. The the power associated with the frequency of the noise is distributed evenly across the whole frequency range (white noise) The actual signal characteristic is not known as its a inverse problem. But the actual frequency of the signal is a part of the total frequency. Power associated with the signal is higher than the noise can be seen in a spectogram.&#xA;Actuallty I also cant figure out how to extract the coefficients of the power/frequency  (db/Hz) from the spectogram. Can you suggest a way?&#xA; see the graphs in the link&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/signal/ref/spectrogram.html?refresh=true&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/help/signal/ref/spectrogram.html?refresh=true&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actual problem is to find the time of arrival of the actual signal &lt;/p&gt;&#xA;" OwnerUserId="19706" LastEditorUserId="13320" LastEditDate="2016-11-21T13:07:07.507" LastActivityDate="2017-08-19T02:00:25.560" Title="Matlab signal processing removing white noise from signal" Tags="|matlab|signal-analysis|noise|time-frequency|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29027" PostTypeId="1" CreationDate="2016-02-25T08:17:12.337" Score="3" ViewCount="311" Body="&lt;p&gt;I am a little bit confused concerning different Shannon's notions :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Over an AWGN channel Shannon's capacity is in my knowledge : $R_b&amp;lt;C=B.\log(1+SNR)$.&#xA;Is Shannon's &quot;limit&quot; a different notion than that ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to convert this equation to a $BER=f(E_b/N_0)$ chart ? for example &lt;a href=&quot;http://www.josephboutros.org/ldpc_vs_turbo/ldpc_Chung_CLfeb01.pdf&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; there is a Shannon limit plotted in fig.2, how is it done ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the equation stated above one can derive the maximum spectral efficiency : $\eta = R_b/B &amp;lt;\eta_{max} = C/B = \log(1+SNR)$ is that correct ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a channel code introduces redundacy bits it introduces a inevitably a loss in $\eta$, so what does Shannon mean when he states that to achieve capacity one has to tend code length to infinity ?  one of my proffessors once said that the LDPC is an example of such a code because it is very long and thus achieves capacity (almost), where is spectral efficiency loss gone ?&lt;/p&gt;&#xA;" OwnerUserId="19720" LastEditorUserId="80" LastEditDate="2016-02-25T12:26:34.190" LastActivityDate="2017-01-16T22:37:14.640" Title="How to achieve Shannon's capacity if coding introduces a spectral efficiency loss?" Tags="|digital-communications|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29028" PostTypeId="2" ParentId="29026" CreationDate="2016-02-25T09:52:51.623" Score="1" Body="&lt;p&gt;Without further details on the signal and the type of processing you want to apply, the two most basic approaches are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;signal enhancement via &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_filter&quot; rel=&quot;nofollow&quot;&gt;linear filtering&lt;/a&gt; (&lt;code&gt;filter&lt;/code&gt; or &lt;code&gt;filtfilt&lt;/code&gt;),&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Wiener_filter&quot; rel=&quot;nofollow&quot;&gt;Wiener filtering&lt;/a&gt;, assuming a known stationary signal and noise spectra in an additive noise &lt;a href=&quot;http://fr.mathworks.com/matlabcentral/fileexchange/7673-wiener-filter&quot; rel=&quot;nofollow&quot;&gt;(matlab code)&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If your signal is non-stationary, a time-frequency (spectrogram) or time-scale (wavelet) decompositions might help. In their domain, signal and noise are often better separated, and you can there apply Wiener filering, or alternative forms of thresholding, or more involved source separation techniques.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wiener filtering in the wavelet domain are generated a lot of works, and codes, that you can test.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-03-01T20:37:09.787" LastActivityDate="2016-03-01T20:37:09.787" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29029" PostTypeId="1" CreationDate="2016-02-25T11:23:29.770" Score="0" ViewCount="1546" Body="&lt;p&gt;I need to compute the envelope of a spectrum in MATLAB. Is there a specific function that can do it?  I saw the function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[yupper,ylower] = envelope(x,np,'peak')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but i'm not sure this one can be used in the frequency domain. The image below shows the result I would like to obtain (green line).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KA2xg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KA2xg.png&quot; alt=&quot;spectrum envelope&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestion? Thank you.&lt;/p&gt;&#xA;" OwnerUserId="19725" LastActivityDate="2022-03-22T14:02:55.253" Title="Envelope detection in frequency domain with MATLAB" Tags="|matlab|frequency-domain|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29030" PostTypeId="1" AcceptedAnswerId="29258" CreationDate="2016-02-25T19:15:51.397" Score="0" ViewCount="788" Body="&lt;p&gt;I would like to understand the relation between the TB size calculation in the TS36.213 document and in the simulator (&lt;a href=&quot;https://www.nt.tuwien.ac.at/research/mobile-communications/vienna-lte-a-simulators/&quot; rel=&quot;nofollow&quot;&gt;https://www.nt.tuwien.ac.at/research/mobile-communications/vienna-lte-a-simulators/&lt;/a&gt;). I’m going to make an example so maybe you can help me to see this relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Method 1 (from the TS36.213)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculation Procedure for downlink(PDSCH) is as follows :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;i) refer to TS36.213 Table 7.1.7.1-1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ii) get I_TBS for using MCS value (Let’s assume MCS is 1. in this&#xA;case, I_TBS is 1 )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iii) refer to TS36.213 Table7.1.7.2.1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iv) go to column header indicating the number of RB (Let’s assume&#xA;that RB is 50)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;v) go to row header ‘1’ which is I_TBS&lt;/p&gt;&#xA;&#xA;&lt;p&gt;vi) we would get 1800 (if the number of RB is 50 and I_TBS is 9)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;vii) (This is Transport Block Size per 1 ms for one Antenna)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;And this is method 2 (from the Vienna LTE System Level simulator):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;i) This is the formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TB_size_bits = max(8*round(1/8*(the_RB_grid.sym_per_RB_nosync .* num_assigned_RB .* modulation_order .* coding_rate * 2))-24,0);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;ii) if the_RB_grid.sym_per_RB_nosyn= 80&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iii) num_assigned_RB=50&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iv) modulation_order = 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;v) coding_rate=0.0762&lt;/p&gt;&#xA;&#xA;&lt;p&gt;vi) That gives TB_size_bits = 1195 bits&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Do you know how I can go from one method to another or if there is any relation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. Best regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Natalia.&lt;/p&gt;&#xA;" OwnerUserId="11502" LastActivityDate="2016-03-06T07:30:13.483" Title="Transport Block calculation in LTE Downlink" Tags="|communication-standard|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29032" PostTypeId="1" CreationDate="2016-02-26T01:40:30.547" Score="4" ViewCount="1615" Body="&lt;p&gt;I'm a statistics grad student, and I &lt;strong&gt;just&lt;/strong&gt; started getting into Digital-Image-Processing (an analogy for processing super-large contingency tables).  In the book &quot;&lt;strong&gt;Digital Image Processing&lt;/strong&gt;&quot; by Gonzalez and Woods, I was reading chapter 2, page 94 of the third edition, and found the following image that is MAGIC to me...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y0Jme.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y0Jme.jpg&quot; alt=&quot;Removing Sinusoidal interference - DIP Gonzalez Woods&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They begin with a noisy image, identify some 'hot points' surrounding the center of the Fourier transform, then simply remove them, reverse the transform, and I can't help vocally demonstrate an emotional reaction while assessing that the image is now crystal clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any insight into this?  I'd like to know what are the underlying notions and methods used to filter this image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, if any of the StackExchange users a familiar with this topic and can suggest some articles/books that I might read, I would be very grateful.&lt;/p&gt;&#xA;" OwnerUserId="19276" LastEditorUserId="19532" LastEditDate="2016-02-26T16:22:04.883" LastActivityDate="2022-12-15T00:36:14.893" Title="Fourier transform of Image to identify sinusoidal sources of interference" Tags="|image-processing|filters|fourier-transform|noise|signal-detection|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29035" PostTypeId="1" AcceptedAnswerId="29036" CreationDate="2016-02-24T19:59:09.033" Score="0" ViewCount="149" Body="&lt;p&gt;I have discrete Fourier transformation results from measurements. Looking at the signal from the time domain perspective, I want to shift the signal on the $x$-axis to the left or right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which transformation in the frequency-domain results in a left/right shift in the time-domain?&lt;/p&gt;&#xA;" OwnerUserId="19755" OwnerDisplayName="user259819" LastEditorUserId="15892" LastEditDate="2016-02-26T16:38:49.947" LastActivityDate="2016-02-26T17:33:03.743" Title="Which transformation in frequency domain equals a x-axis shift of a signal in time domain?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29036" PostTypeId="2" ParentId="29035" CreationDate="2016-02-26T09:58:41.047" Score="1" Body="&lt;p&gt;If $s(t)$ is your signal in time domain, you want to make the operation $s(t+\Delta t)$, which according to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Fourier's transform&lt;/a&gt; properties, is equivalent to the operation :&#xA;$$&#xA;S(f)e^{j2\pi f\Delta t}&#xA;$$&#xA;$S(f)$ being $s(t)$ Fourier's transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;discrete Fourier's transform&lt;/a&gt;, which is defined as &#xA;$$&#xA;S[k] = \sum^{N-1}_{n=0}{s[n]e^{\frac{-i2\pi kn}{N}}}&#xA;$$ &#xA;with $s$ the signal and N the number of points of both signal and DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operation to be applied in order to induce a shift by a number c of samples to $s[n]$ and obtain $s[n+c]$ is :&#xA;$$&#xA;e^{\frac{-i2\pi kc}{N}}S[k]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which in matlab code would be done with :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;exp(-j*2*pi*(1:(N-1))*c/N).*S_fdt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="19532" LastEditDate="2016-02-26T17:33:03.743" LastActivityDate="2016-02-26T17:33:03.743" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29037" PostTypeId="1" CreationDate="2016-02-26T10:39:04.707" Score="1" ViewCount="234" Body="&lt;p&gt;I am currently developing algorithm using openCV C++ for implementing laser as a mouse.Currently am having an issue of hand jitters.(ie. The presenter's hand may shake unnecessarily which may cause pointer to move continuously.).Can anyone please tell me how to avoid this problem using openCV or is there any in build function available to overcome this problem ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="19282" LastActivityDate="2024-03-27T16:36:26.427" Title="Hand Jitter Problem" Tags="|image-processing|opencv|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29038" PostTypeId="2" ParentId="28994" CreationDate="2016-02-26T10:49:45.270" Score="0" Body="&lt;p&gt;Solution can be found in the well-known &lt;a href=&quot;https://www.native-instruments.com/fileadmin/ni_media/downloads/pdf/VAFilterDesign_1.1.1.pdf&quot; rel=&quot;nofollow&quot;&gt;paper&lt;/a&gt; of Vadim Zavalishin. In sections (4.1) and (4.2) there's an explanation on how to implement zero feedback loop around cascade of LP filters. He even mentions later in the paper that exactly the same approach can be used to implement phaser (6.1)&lt;/p&gt;&#xA;" OwnerUserId="19685" LastActivityDate="2016-02-26T10:49:45.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29039" PostTypeId="1" AcceptedAnswerId="29044" CreationDate="2016-02-26T10:51:16.180" Score="3" ViewCount="3819" Body="&lt;p&gt;I have a signal containing a variation of digital ASK type on-off keyed sine wave among which some stochastic irrelevant harmonic waves occur, like you can see on this figure:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/UYuhT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UYuhT.png&quot; alt=&quot;Original signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In its current form each pulse duration is the same, but it's not always the case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to calculate each pulse duration. To do that, I was thinking of converting this signal to a square wave signal like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2JCCH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2JCCH.png&quot; alt=&quot;Expected signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure of the different steps needed for this conversion but I have some leads:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Remove the noise =&gt; Low pass filter I presume? &lt;/li&gt;&#xA;&lt;li&gt;To have the signal between 0 and the amplitude, I multiply the signal by itself&lt;/li&gt;&#xA;&lt;li&gt;I apply a magic filter to convert the signal to square signal.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So my questions are: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do I need a low pass filter to remove the noise?&lt;/li&gt;&#xA;&lt;li&gt;What kind of filter do I need to convert the signal to square signal? Is it possible?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For information, I'm using Python and Numpy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is any other method to calculate the duration of each pulse in the sequence, I'm open to all ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Here's my signal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   freq = 1000000&#xA;   fs = int(2*freq) # sample rate&#xA;   x = np.linspace(0, 10, fs)&#xA;   noise1 = 0.01*np.sin(2*np.pi * 1*x) + 0.05*np.sin(2*np.pi * 1.5*x) +     0.04*np.sin(2*np.pi * 0.2*x)&#xA;   noise2 = 0.1*np.sin(2*np.pi * 0.1*x) + 0.2*np.sin(2*np.pi * 1.8*x) + 0.1*np.sin(2*np.pi * 0.4*x)&#xA;&#xA;  realSignal = 2*np.sin(2*np.pi * freq*x)&#xA;  sig =  noise1&#xA;&#xA;  sig = np.append(sig, [realSignal, noise2, realSignal, noise1*noise2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19740" LastEditorUserId="13309" LastEditDate="2016-02-26T16:25:17.867" LastActivityDate="2016-02-27T19:30:39.257" Title="Convert sine wave signal to square wave signal" Tags="|noise|python|conversion|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29040" PostTypeId="1" CreationDate="2016-02-26T10:55:00.040" Score="3" ViewCount="517" Body="&lt;p&gt;I have a filter design problem in which lowpass filters have to be designed with varying roll-off. E.g: 2.7 db/ocatve or 1.4 db/ocave. See picture below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is easy to achieve with a FIR filter, yet its computational cost is too large. Therefore, if at all possible, I would like to do this with an IIR filter. Sadly, most IIR filters have multiples of 6dB/octave rolloff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2o6Sc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2o6Sc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7488" LastEditorDisplayName="user7488" LastEditDate="2016-02-26T13:03:27.387" LastActivityDate="2016-02-26T13:03:27.387" Title="IIR filters with variable roll-off" Tags="|infinite-impulse-response|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29041" PostTypeId="1" AcceptedAnswerId="29042" CreationDate="2016-02-26T11:22:48.903" Score="4" ViewCount="1342" Body="&lt;p&gt;I am looking for a good example that showing the different between Guided and Gaussian Filters. The example need to show the benefit of Guided filter, (for example: preserving edge...). Could you give me some example for that task? Thanks in advance&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried some example, but it did not show benefit of Guided comparison with Gaussian&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% example: edge-preserving smoothing&#xA;% figure 1 in our paper&#xA;&#xA;close all;&#xA;&#xA;I = double(imread('.\img_smoothing\cat.bmp')) / 255;&#xA;I = imnoise(I,'gaussian',0.1,0);&#xA;p = I;&#xA;r = 4; % try r=2, 4, or 8&#xA;eps = 0.2^2; % try eps=0.1^2, 0.2^2, 0.4^2&#xA;&#xA;q = guidedfilter(I, p, r, eps);&#xA;std_Gb=1;&#xA;beta=0.1;&#xA;%% Initialization &#xA;Ng=ceil(3*std_Gb)+1; Gaussian = fspecial('gaussian',[Ng Ng],std_Gb);&#xA;imsm = conv2(I,Gaussian,'same');&#xA;&#xA;[Gx,Gy] = gradient(q );&#xA;NormGrad = sqrt(Gx.^2 + Gy.^2); &#xA;Gb1 = 1./ (1 + 1* NormGrad.^2);&#xA;&#xA;[Gx,Gy] = gradient(imsm);&#xA;NormGrad = sqrt(Gx.^2 + Gy.^2); &#xA;Gb2= 1./ (1 + 1* NormGrad.^2);&#xA;&#xA;figure();&#xA;subplot(2,1,1);imshow([I, q,imsm],[]);&#xA;subplot(2,1,2);imshow([Gb1,Gb2],[]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KKXaF.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KKXaF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8430" LastEditorUserId="128" LastEditDate="2018-08-22T20:51:19.937" LastActivityDate="2022-03-28T08:09:59.220" Title="Comparison Between Guided Filter (Edge Preserving Filter) and Gaussian Filter" Tags="|image-processing|matlab|filters|computer-vision|edge-preserving-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29042" PostTypeId="2" ParentId="29041" CreationDate="2016-02-26T12:41:59.077" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;Create  a synthetic image with abrupt change form black to white (Better yest from Dark Gray to Bright Gray).&lt;/li&gt;&#xA;&lt;li&gt;Add Gaussian Noise to it.&lt;/li&gt;&#xA;&lt;li&gt;Filter it with Guided Filter and Gaussian Filter.&lt;/li&gt;&#xA;&lt;li&gt;Look at the results.&lt;/li&gt;&#xA;&lt;li&gt;Draw a 1D Line which crosses it and look at the Original, Noisy, Filters Guided, Filtered Gaussian.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Here are the results:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Noisy Image&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hTach.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hTach.png&quot; alt=&quot;Noisy Image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WZY4l.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WZY4l.png&quot; alt=&quot;Lines - Noisy Image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Gaussian Filtered Image&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0toVe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0toVe.png&quot; alt=&quot;Gaussian Filtered Image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AiFka.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AiFka.png&quot; alt=&quot;Lines - Gaussian Filtered Image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Guided Filtered Image&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WO60F.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WO60F.png&quot; alt=&quot;Guided Filtered Image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MV2C7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MV2C7.png&quot; alt=&quot;Lines - Guided Filtered Image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As one could see, the Gaussian Filter smooth the image across high contrast edges while the Guided Filter keep the edges.&lt;/p&gt;&#xA;&lt;p&gt;The MATLAB code is available at my &lt;a href=&quot;https://github.com/RoyiAvital/StackExchangeCodes&quot; rel=&quot;nofollow noreferrer&quot;&gt;StackExchange Signal Processing Q29041 GitHub Repository&lt;/a&gt; (Look at the &lt;code&gt;SignalProcessing\Q29041&lt;/code&gt; folder).&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2022-03-28T08:09:59.220" LastActivityDate="2022-03-28T08:09:59.220" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="29043" PostTypeId="1" AcceptedAnswerId="29074" CreationDate="2016-02-26T13:08:49.550" Score="3" ViewCount="2754" Body="&lt;p&gt;Anybody knows of better ways to fit an IIR filter to a complex transfer function than Matlab's &lt;code&gt;invfreqz.m&lt;/code&gt;? I'm implementing a little transfer function fitting toolbox for myself. I started with re-implementing the methods used in Matlab's &lt;code&gt;invfreqz.m&lt;/code&gt;. &lt;code&gt;Invfreqz.m&lt;/code&gt; is using &lt;a href=&quot;https://ieeexplore.ieee.org/document/6429401&quot; rel=&quot;nofollow noreferrer&quot;&gt;Levy's complex curve fitting&lt;/a&gt; algorithm to compute starting coefficients for a iterative Gauss-Newton algorithm. Since Levy's paper is not documenting the algorithm very well and it's quite old, I'm looking for easier implementations and maybe even better algorithms to do the same job. Literature recherche turns out to be a real pain - so any hints from experienced people regarding literature, starting points or examples for implementations would be very appreciated.&lt;/p&gt;&#xA;" OwnerUserId="19741" LastEditorUserId="7092" LastEditDate="2022-05-15T13:01:39.233" LastActivityDate="2022-05-15T13:01:39.233" Title="Fitting an IIR filter to a complex transfer function" Tags="|matlab|filters|filter-design|infinite-impulse-response|optimization|" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="29044" PostTypeId="2" ParentId="29039" CreationDate="2016-02-26T14:24:58.070" Score="2" Body="&lt;p&gt;What you can do is process this signal with a windowed RMS function (I'm writing in matlab code, but it can easily be translated in python) :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;windowlength = 5; %you can change that, but keep it odd&#xA;hw = (windowlength-1)/2; %hw stands for &amp;quot;half window&amp;quot;&#xA;%pre-assigning the output RMS signal&#xA;sig_RMS = zeros(1,length(sig)); &#xA;%I'm adding zeros the the signal's left and right for boundary calculation&#xA;sig_zero_padded = [zeros(hw,1), sig, zeros(hw,1)];&#xA;&#xA;sig_zero_padded = sig_zero_padded.^2; %squaring the samples&#xA;for i=(hw+1):(length(sig_zero_padded)-hw)&#xA;   % calculating square-mean inside the window and assigning the result&#xA;   %to the appropriate sample in sig_RMS&#xA;  sig_RMS(i-hw) = sqrt(mean(sig_zero_padded(i-hw:i+hw)));&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then you set a minimum value for which superior values of the RMS signal will be assigned to 1, and the other to zero :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;trigger = 0.5; %I chose arbitrarily&#xA;square_sig = (sig_RMS &amp;gt; trigger);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And you should get your square signal.&lt;/p&gt;&#xA;&lt;p&gt;What we are doing here, in simple language, is taking little bits of the signal and calculating the RMS value of each bit. If this calculated value is significant enough to be considered as &amp;quot;not noise&amp;quot;, we assign '1' to it.&lt;/p&gt;&#xA;&lt;p&gt;EDIT :&#xA;I managed to compute it and it worked. Note that I had to take &lt;code&gt;Fs = 10^5&lt;/code&gt; because my computer does not have enough capacity for &lt;code&gt;Fs = 10^6&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here is the signal (blue), and the calculated RMS signal (red) for &lt;code&gt;windowlength = 8191&lt;/code&gt; :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GZMZU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GZMZU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then I set &lt;code&gt;trigger = 0.4&lt;/code&gt; and obtained two crystal clear zones identifying the useful signal :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ejPqh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ejPqh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So in conclusion :&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set windowlength to get the RMS signal mean value far enough of the noise while keeping accuracy. In my case it was approximately 1 % of the total number of samples.&lt;/li&gt;&#xA;&lt;li&gt;Set trigger between the RMS crests and the noise&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;However, I'm having that feeling that I'm reinventing something so feel free to look up for some literature about this method, I'm sure someone did the math to obtain optimal values of windowslength and trigger. ;)&lt;/p&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-02-27T19:30:39.257" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29045" PostTypeId="2" ParentId="13844" CreationDate="2016-02-26T17:50:51.257" Score="-1" Body="&lt;p&gt;&lt;a href=&quot;http://www.gaussianwaves.com/2015/11/interpreting-fft-results-obtaining-magnitude-and-phase-information/&quot; rel=&quot;nofollow&quot;&gt;The Gaussian Waves site&lt;/a&gt; details the part about the phase and its random-like behaviour: just a matter of floating-point error as DumpsterDoofus said&lt;/p&gt;&#xA;" OwnerUserId="17516" LastActivityDate="2016-02-26T17:50:51.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29046" PostTypeId="2" ParentId="2954" CreationDate="2016-02-26T21:24:54.673" Score="1" Body="&lt;p&gt;When we add the window function to the definition of the DFT we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(k) = \sum_{n=0}^{N-1} w[n]x[n] e^{-j \omega n} $$&#xA;with $\omega_k= \frac{2\pi k}{N}, k\in \mathbb{Z} , $ $w[n]$  the window function and $x[n]$ the data. The multiplication of the data $x[n]$ with the window function $w[n]$ in the time domain corresponds to a convolution in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CZT and the FFT are basically just different ways to compute this sum.  Each algorithm has its advantages and disadvantages. The FFT is fast, the CZT is more flexible. If you use both algorithms  to compute the same coefficients $X(k)$ you get the same results. So, in this case, the window choice considerations should be the same for CZT and FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I can answer only have of the original question: If the CZT is used to compute the same frequency bins as delivered by the FFT, there is no difference with respect to window selection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note1: Are you aware of the issues regarding frequency resolution of different DFT algorithms, as discussed &lt;a href=&quot;https://dsp.stackexchange.com/questions/741/why-should-i-zero-pad-a-signal-before-taking-the-fourier-transform/745#745&quot;&gt;e.g. in this thread&lt;/a&gt; ? The frequency resolution topic is the same for &quot;&lt;em&gt;CZT vs. FFT&lt;/em&gt;&quot; as for &quot;&lt;em&gt;zero padding of FFT&lt;/em&gt;&quot; or for &quot;&lt;em&gt;Goertzel vs. FFT&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note2: This was the basic message of my original post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If  the CZT is used to compute the DFT on a finer frequency resolution, things are more complicated. In &lt;a href=&quot;https://dsp.stackexchange.com/a/1685/19747&quot;&gt;this thread&lt;/a&gt; the effect on the DFT is discussed. To make it short, the CZT interpolates the DFT. This interpolation makes window selection more involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If (as intended by the OP) the CZT is used to interpolate the DFT at a finer frequency resolution, the underlying maths remain the same, however the different frequency resolution must be kept in mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is illustrated in a very simple example. The first figure shows the absolute values of a rectangular window. The FFT (without zero padding or similar things) computes the DFT right at frequencies where the window is zero, here marked in orange. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/B23J5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B23J5.png&quot; alt=&quot;Frequency resolution from FFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With finer frequency resolution this changes, as shown in the next figure.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/P2wSg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/P2wSg.png&quot; alt=&quot;Frequency resolution from CZT&quot;&gt;&lt;/a&gt; This may (as in the example) introduce additional leakage.&lt;/p&gt;&#xA;" OwnerUserId="19747" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-06-21T14:09:24.750" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29047" PostTypeId="1" CreationDate="2016-02-26T22:32:42.323" Score="1" ViewCount="35" Body="&lt;p&gt;I have problems understanding connection between theory that is done in $L^2(\mathbb{R})$ and its application to discrete signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at this paper: &lt;a href=&quot;http://home.ustc.edu.cn/~zhanghan/cs/Mallat_Zhang93.pdf&quot; rel=&quot;nofollow&quot;&gt;http://home.ustc.edu.cn/~zhanghan/cs/Mallat_Zhang93.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All theory is done for $L^2(\mathbb{R})$&#xA;and integrals, and that's all fine. On page 8(3404) functions $g$ &#xA;are sampled with period $T$ so that we are able to perform calculations on a computer in order to get representation of some sampled function $f$. &#xA;We use sum inner product and work with sequences instead of functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What allows us to use theory about square integrable functions on a sequence of numbers?&lt;/p&gt;&#xA;" OwnerUserId="19749" LastEditorUserId="11256" LastEditDate="2016-02-27T01:01:32.340" LastActivityDate="2016-02-27T01:01:32.340" Title="connection between theory that is done in $L^2(\mathbb{R})$ and its application on discrete signal" Tags="|discrete-signals|signal-analysis|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29048" PostTypeId="2" ParentId="26196" CreationDate="2016-02-27T00:04:19.203" Score="2" Body="&lt;p&gt;The point is, that you need to look at the influence of averaging on the final term in the equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{G}_N = [...] + \frac{V_N}{U_N}. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of periodic excitation $u$, the noise term $|V_N|$ is decreased by averaging over independent realizations (=measurements). However $|U_N|$ is not affected by averaging, as each period of u(t) is &lt;em&gt;identical&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of non-periodic excitation, both terms are affected in the same way. As each is different, $|U_N|$ is reduced by averaging and so does the quotient $|\frac{V_N}{U_N}|$ and  $|E_N|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: In your example plots you do not take averages in the non-periodic case. The frequency resolution in the first plot is different for each N. If the non-periodic signal is split in segments with equal length and averaged over segments, the frequency resolution would be the same for all N. However in your plot  you just compute longer DFTs that result in finer frequency resolution. However this is not relevant for the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit: Extended my notes on DFT lenghts; thanks to Maximilian Matthé for his comment.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="19747" LastEditorUserId="19747" LastEditDate="2016-12-07T14:32:19.793" LastActivityDate="2016-12-07T14:32:19.793" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29050" PostTypeId="2" ParentId="29039" CreationDate="2016-02-27T06:23:46.857" Score="2" Body="&lt;p&gt;Create the envelope of the signal (analytic signal) using the Hilbert transform and then threshold.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import scipy.signal.signaltools as sigtool&#xA;&#xA;env = numpy.abs(sigtool.hilbert(sig))&#xA;threshold = 1&#xA;square_sig = (env &amp;gt; threshold)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(I haven't got python installed ATM so I can't test this)&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-02-27T06:23:46.857" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29051" PostTypeId="1" CreationDate="2016-02-27T10:39:46.110" Score="1" ViewCount="122" Body="&lt;p&gt;In block codes (channel coding), in practice, how is the message length ($k$) fixed?  If $k$ is large, the practical implementation of it requires huge memory if look up table approach is adopted. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the disadvantage with short $k$'s?  Code rate will degrade?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="1629" LastEditDate="2016-02-27T17:49:44.543" LastActivityDate="2016-02-27T19:04:16.257" Title="In block codes (channel coding), in practice how is the message length ($k$) fixed?" Tags="|channelcoding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29052" PostTypeId="1" AcceptedAnswerId="29056" CreationDate="2016-02-27T12:22:25.927" Score="0" ViewCount="169" Body="&lt;p&gt;The discrete signal is provided in the following table:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{|c|ccccccc|}\hline &#xA; n&amp;amp; -3 &amp;amp; -2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 2 &amp;amp; 3\\ \hline&#xA;x[n] &amp;amp; 3 &amp;amp;  2 &amp;amp;  1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 2 &amp;amp; 3 \\ \hline&#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book is asking to determine $x[3n-1]$. This involves shifting by one and then scaling by $3$. My answer to this problem is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{|c|cc|}\hline &#xA; 3n-1 &amp;amp;    0 &amp;amp; 1\\ \hline&#xA;x[3n-1]&amp;amp;  1 &amp;amp; 2 \\ \hline&#xA;\end{array}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the answer in the book is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{array}{|c|ccc|}\hline &#xA; 3n-1 &amp;amp;  -1 &amp;amp; 0 &amp;amp; 1\\ \hline&#xA;x[3n-1]&amp;amp; 0 &amp;amp; 1 &amp;amp; 2 \\ \hline&#xA;\end{array}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which answer is correct?&lt;/p&gt;&#xA;" OwnerUserId="5788" LastEditorUserId="1629" LastEditDate="2016-02-27T15:55:20.380" LastActivityDate="2016-02-27T15:55:20.380" Title="what is the correct answer for shifting and scaling this signal?" Tags="|discrete-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29054" PostTypeId="2" ParentId="15662" CreationDate="2016-02-27T12:29:39.683" Score="-1" Body="&lt;p&gt;You might be interested in the following link where wavelet transform is intuitively presented. It starts from Fourier transform and points out the problem of loss of localisation in frequency domain. It is followed by Short Time Fourier Transform (STFT). Duality in time frequency is also stated for STFT and then the concept of SCALE is introduced followed by THE WAVELET TRANSFORM&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=qy6r5TE7YxU&amp;amp;index=10&amp;amp;list=PL_1-_Q4VI1Sdfh6hLIlDnZj6TY0pXQwkN&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=qy6r5TE7YxU&amp;amp;index=10&amp;amp;list=PL_1-_Q4VI1Sdfh6hLIlDnZj6TY0pXQwkN&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19753" LastActivityDate="2016-02-27T12:29:39.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29056" PostTypeId="2" ParentId="29052" CreationDate="2016-02-27T12:40:17.500" Score="1" Body="&lt;p&gt;The sequence $x[n]$ is only non-zero in the range $-3\le n\le 3$. So if you change the index to $3n-1$, in order to remain inside that region, $n$ can only take the values $n=0$ (giving $3n-1=-1$), and $n=1$ (giving $3n-1=2$). This gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[3n-1]=\begin{cases}x[-1]=1,&amp;amp;n=0\\x[2]=2,&amp;amp;n=1\\&#xA;0,&amp;amp;\text{otherwise}\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the exercise is as you stated it, then your solution is correct, apart from the fact that it is not $3n-1$ but $n$ that takes the values $0$ and $1$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-27T12:40:17.500" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29059" PostTypeId="1" CreationDate="2016-02-27T16:28:03.457" Score="1" ViewCount="301" Body="&lt;p&gt;From &lt;a href=&quot;https://en.wikipedia.org/wiki/Zero-order_hold&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A zero-order hold reconstructs the following continuous-time waveform&#xA;  from a sample sequence $x[n]$, assuming one sample per time interval&#xA;  $T$: $$x_{\mathrm{ZOH}}(t)\,= \sum_{n=-\infty}^{\infty} x[n]\cdot&#xA; \mathrm{rect} \left(\frac{t-T/2 -nT}{T} \right) \ $$ where&#xA;  $\mathrm{rect}()$  is the rectangular function.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We can refer to $\mathrm{rect}()$ also as &lt;em&gt;one-dimensional&lt;/em&gt; rectangular function. For example, the product of two one-dimensional rect functions can be viewed as a rect function in two dimension, i.e. a function&#xA;that has the value 1 on the square of side length 1 centered at the origin, and has the value 0 outside this&#xA;square. I am wondering if there exists, for example, a two dimensional version of ZOH for a signal in two variable, $x(t_1,t_2)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="17183" LastActivityDate="2016-02-28T11:37:08.590" Title="Zero-order-hold for two dimensional signal $x(t_1,t_2)$" Tags="|sampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29060" PostTypeId="2" ParentId="29059" CreationDate="2016-02-27T16:53:04.880" Score="3" Body="&lt;p&gt;Yes there exists a 2D analog of the 1D zero order hold for image reconstruction, whose mathematical formulation follows closely that of 1D case as:&#xA;$$I_{\mathrm{ZOH}}(x,y)\,= \sum_{n=-\infty}^{\infty} \sum_{m=-\infty}^{\infty} x[n,m]\cdot \operatorname{rect} \left( {x-nT_x,y-mT_y} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $x[n,m]$ is the spatial samples of 2D image to be reconstructed, $T_x$ and $T_y$ are sampling periods in $x$ and $y$ dimensions (which are generally equal in practice) and the $\operatorname{rect}()$ function is a 2D rectengular pulse of height one and durations $T_x$ and $T_y$ along the dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The zero order hold interpolation can easily be observed when you enlarge an image through an image editor by not using any smooth interpolation methods but just repeated filling of those new enlarged pixels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular just use, for example, IrfanView to open any image and choose Image-&gt;Resize from menu, then choose to enlarge the image from the options in the coming window, and finally choose &quot;Resize (faster, lo quality)&quot; option from the &quot;Size Methods&quot; sections about lower right corner (for version 4.40)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you instead choose &quot;smooth&quot; methods, they will fill in the pixels with calculated intermediate values, therefore implementing higher order holds than zero. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-02-28T11:37:08.590" LastActivityDate="2016-02-28T11:37:08.590" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29063" PostTypeId="2" ParentId="29051" CreationDate="2016-02-27T19:04:16.257" Score="1" Body="&lt;p&gt;There are a few rules of thumb:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For a fixed code rate $r = \frac{k}{n}$, the amount of gain you observe from applying coding typically increases as you increase the block size $n$. Accordingly, the complexity of decoding the larger blocks is often larger.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you decrease the number of information symbols in the block $k$ and keep $n$ fixed, the code rate decreases. This will result in higher coding gain, but lower information throughput for a given channel symbol rate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you increase the number of information symbols in the block $k$ and keep $n$ fixed, the code rate increases. This will result in lower coding gain, but higher information throughput for a given channel symbol rate.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="90" LastActivityDate="2016-02-27T19:04:16.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29065" PostTypeId="1" AcceptedAnswerId="29066" CreationDate="2016-02-27T22:37:14.420" Score="2" ViewCount="1771" Body="&lt;p&gt;I have a 2D image and I convolve it with a 2D kernel image using FFT. So far I was always using symmetric kernels (e.g., Gaussian with stddev_x = stddev_y). As a result, I never bothered thinking whether I have to flip my kernel image or not because it wouldn't have made any difference. However, now I want to convolve my image using an elliptical Gaussian kernel with stddev_x != stddev_y and an arbitrary angle. Now, do I have to flip my kernel image prior the FFT convolution? Or the flipping is required only when using the usual convolution algorithm and not the FFT-based one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="19762" LastActivityDate="2016-02-27T23:54:53.637" Title="Do I have to flip my kernel when performing an FFT-based convolution?" Tags="|fft|convolution|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29066" PostTypeId="2" ParentId="29065" CreationDate="2016-02-27T23:47:59.743" Score="4" Body="&lt;p&gt;Flipping &amp;amp; dragging is an animative method used in graphical computation of convolution in time (or space) domain. It is the result of an argument manipulation in $h[n-k]$ (or $x[n-k]$) signal animated as a function of n, but drawn on an axis of k, in the convolution sum: $$y[n] = x[n]*h[n]=\sum {x[k]h[n-k] }$$ On the other hand in frequency domain DFT (FFT) based convolution implementations you don't need it as you simply multiply the two DFTs.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-02-27T23:54:53.637" LastActivityDate="2016-02-27T23:54:53.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29069" PostTypeId="2" ParentId="15662" CreationDate="2016-02-28T04:51:42.077" Score="4" Body="&lt;p&gt;I think that the best way to explain the CWT is to start by explaining the Fourier Transform, then move on to explaining the Short-Time Fourier Transform, and then finally explain the CWT as a variation of the STFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier Transform exploits the fact that any decently behaved function can be represented as a sum of sinusoids (i.e. a Fourier series) and that the sinusoid basis posses the property of orthogonality:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \int_{-\infty}^{\infty}  \sin(nx)\,\sin(mx)\,dx = \int_{-\infty}^{\infty}  \cos(nx)\,\cos(mx)\,dx = \begin{cases}&#xA;1,  &amp;amp; \text{if $n=m$} \\&#xA;0, &amp;amp; \text{if $n\neq m$}&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, since:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ e^{iax} = \cos(ax)+i\,\sin(ax)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the Fourier Transform is simply doing this integration for all frequencies and keeping track of which outputs are zero (i.e. that frequency is not in the signal) and which are non-zeros (i.e. that frequency is in the data and its output is scaled by how much of it is in there):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S(f) = \int_{-\infty}^{\infty} s(t)\,e^{i2\pi ft}dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case you are doing this integration over the entire signal so you can't really tell if the frequency content is changing from the beginning of the signal to the end. One way around this is to compute the Short-Time Fourier Transform: i.e. window the signal, calculate the Fourier transform of the windowed signal, store it, then shift the window down a bit and repeat for all shifts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S(\tau,f) = \int_{-\infty}^{\infty} w(t- \tau)\,s(t)\,e^{i2\pi ft}dt  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ w(\tau,t)=\begin{cases}&#xA;1,  &amp;amp; \text{if $\tau\approx t$} \\&#xA;0, &amp;amp; \text{if $\tau \not\approx t$}&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key thing here is that you are calculating the typical Fourier transform but of a new signal that only exists in a localized part of the t-axis. To emphasize this, you can see the new signal whose Fourier transform we are calculating by associating:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S(\tau,f) = \int_{-\infty}^{\infty} [w(t-\tau)\,s(t)]\,e^{i2\pi ft}dt  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's a graphical example of this showing the new signal for different $\tau$ values and on the right are a few sinusoids to represent what we are using to decompose the signals (i.e. our basis, or kernel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X3fzf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X3fzf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, we can also change the association as such without changing the outcome:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S(\tau,f) = \int_{-\infty}^{\infty} s(t)\,[w(t-\tau)\,e^{i2\pi ft}]dt  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this means that instead of windowing our signal, we are windowing our basis functions. But here's the kicker, if we are windowing our basis functions, we don't have to use a constant-size window since we know that a basis function of high frequency will need a shorter window than a basis function of low frequency. This is the whole point of the CWT. It is a decomposition of a signal by &quot;wavelets&quot; (i.e. windowed sinusoids in this case) where the windowing is adaptive to the sinusoid frequency. If the we choose a Gaussian window (as I have chosen in these examples), then our wavelets are called Morlet wavelets (or Gabor wavelets, in some literature).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YzoO9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YzoO9.png&quot; alt=&quot;CWT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you can generalize this for any choice of wavelet that you want. In that generalization, you can describe your wavelet basis functions as being &quot;stretched&quot; and &quot;squeezed&quot; versions of some arbitrary &quot;mother&quot; wavelet, $ \psi $. And so the previous equation can now be written as the final form of the CWT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ S(a,b) = \frac{1}{\sqrt b}\int_{-\infty}^{\infty} s(t)\,\psi (\frac{t-a}{b})dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a$ is now what used to be our $\tau$ (i.e. a time shift), and $b$ is called the &quot;scale&quot; which is just a parameter to stretch and squeeze the wavelet (similar to what our parameter $f$ was except now the interpretation is more difficult). And the only reason you have the $\frac{1}{\sqrt b}$ up front is to normalize the wavelets so that they have the same &quot;energy&quot; and you end up comparing apples to apples in your time-frequency representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Antonio&lt;/p&gt;&#xA;" OwnerUserId="19763" LastEditorUserId="8202" LastEditDate="2016-02-28T10:40:40.107" LastActivityDate="2016-02-28T10:40:40.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29070" PostTypeId="1" CreationDate="2016-02-28T05:09:23.000" Score="1" ViewCount="694" Body="&lt;p&gt;New to this signals stuff and i'm confused about the frequency representation of the square wave. Correct me if i'm wrong, a periodic square wave is composed of odd harmonics sine waves which are multiples of the fundamental frequency, In the frequency domain this just represents decreasing impulses at every odd multiple of the fundamental frequency . What relation does the sinc function have with the square wave? and which is the correct spectral representation of the square wave? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="19767" LastActivityDate="2016-02-28T07:00:52.437" Title="square wave frequency representation" Tags="|fft|fourier-transform|continuous-signals|fourier-series|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29071" PostTypeId="1" AcceptedAnswerId="29117" CreationDate="2016-02-28T06:00:17.287" Score="1" ViewCount="176" Body="&lt;p&gt;I have recently started learning about the image edge detection methods. I studied few of these methods including &lt;strong&gt;Sobel&lt;/strong&gt; and &lt;strong&gt;Canny&lt;/strong&gt;. I observed that edge detection is performed using &lt;strong&gt;patch/kernel&lt;/strong&gt; size as &lt;strong&gt;3x3&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, &lt;strong&gt;Is it necessary to fix the patch size as 3x3? OR can we take it as 5x5, 7x7, 9x9 etc&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already studied few technical papers that says that &lt;strong&gt;patch size is taken as low as possible in order to make computational complexity as low as possible&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="4444" LastActivityDate="2016-03-01T03:32:10.430" Title="necessity of patch size in edge detection algorithms" Tags="|image-processing|edge-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29072" PostTypeId="2" ParentId="29070" CreationDate="2016-02-28T07:00:52.437" Score="1" Body="&lt;p&gt;The transform of a single rectangular pulse is a Sinc function.  Each added translation of that pulse adds a twisted repitition of that Sinc.  The twist will equal 2 pi at all spectral distances that are odd integer multiples of the reciprocal of the repeat period.  Repeat, and eventually all the twisted portions will all cancel out (form circles in the complex plane around zero) except at those points representing the odd harmonics.  Thus an infinite repeating square wave will be left with only non-zero spectrum at odd harmonics in its transform.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-02-28T07:00:52.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29074" PostTypeId="2" ParentId="29043" CreationDate="2016-02-28T12:14:13.130" Score="3" Body="&lt;p&gt;As I mentioned in a comment, I think that the equation error method is a very good starting point for designing an IIR filter in the frequency domain with prescribed magnitude and phase responses. For an explanation of this method have a look at &lt;a href=&quot;https://dsp.stackexchange.com/questions/15007/l2-optimal-iir-filters/15016#15016&quot;&gt;this answer&lt;/a&gt; and the references there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two problems associated with the equation error method are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;stability of the designed filter is not guaranteed&lt;/li&gt;&#xA;&lt;li&gt;the frequency domain error is weighted with the squared magnitude of the denominator polynomial of the designed filter, which means that the approximation is better in certain frequency regions than in others, but this weighting is a result of the design process and is usually undesirable.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The first problem can be tackled by adapting the total delay of the desired frequency response such that it matches with what a causal and stable filter with the chosen orders of numerator and denominator polynomials can achieve. So the desired complex frequency response $D(\omega)$ is changed to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\tilde{D}(\omega)=D(\omega)e^{-j\omega\tau}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with some delay parameter $\tau$ (which can also be negative). Optimizing the value of $\tau$ will help designing a stable filter with the smallest possible error. The only difference with the original desired response is an added (or subtracted) delay (i.e., a linear phase component).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One option to address the second problem is to solve a sequence of equation error problems with an adapted weight function, which is the basic idea of the &lt;a href=&quot;http://www.cs.princeton.edu/~ken/stmcb.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Steiglitz-McBride method&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented the equation error method for the frequency domain design of IIR filters, and I've also added the possibility to iteratively approximate the optimal least squares solution, as described above. Note that convergence cannot be guaranteed, but in practice convergence is usually achieved after a few iterations. Also note that the resulting filter may be unstable, but this problem can be solved by adjusting the total delay of the desired response, as explained above. The Matlab/Octave code can be found at &lt;a href=&quot;https://gist.github.com/mattdsp/7617379e9920c5cbb016&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a simple filter design example. The desired response is a low-pass filter with a linear phase response in the pass band. The delay is desired to be an integer number of samples, but the exact value is to be optimized to get the best approximation by a stable filter. The numerator and denominator orders are chosen to be $M=N=10$. Experiments showed that the best value for the desired pass band group delay is $28$ samples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;w = pi*[linspace(0,.2,20),linspace(.25,1,75)];   % frequency grid&#xA;D = [exp(-j*w(1:20)*28),zeros(1,75)];           % desired response&#xA;W = [ones(1,20),10*ones(1,75)];                  % error weighting&#xA;[a,b] = eqnerror(10,10,w,D,W,6);                 % 6 iterations of equation error method&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The figure below shows the design result. Note that the pass band group delay approximates the desired $28$ samples. The designed filter is stable and has a maximum pole radius of $0.98$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mFNFg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mFNFg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-02-29T10:19:45.683" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29076" PostTypeId="1" CreationDate="2016-02-28T14:00:32.267" Score="3" ViewCount="1822" Body="&lt;p&gt;How can I extract a signal to baseband?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather that just listen to one signal at a time, I want to take advantage of my RTL-SDR's 2mhz bandwidth and listen to multiple FM signals at the same time. I think that what need to do for each signal is filter out everything but the signal, then shift the signal to baseband and reduce the bandwidth. Once it's a baseband, I can take it from there.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Which filter or pair of filters would be a decent way of to filter out all but the signal I want?&lt;/li&gt;&#xA;&lt;li&gt;Should I be using IIR vs FIR?&lt;/li&gt;&#xA;&lt;li&gt;What would be a decent way to shift to baseband and reduce bandwidth?&lt;/li&gt;&#xA;&lt;li&gt;Can shifting to baseband and reducing bandwidth be done at the same time? Should these be done at the same time?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Everything I'm working with is a complex signal. I'm planning on implementing these myself for the greater education value. (IE, I'm not using GNUradio, or existing libraries. Mostly I need to know what to Google.)&lt;/p&gt;&#xA;" OwnerUserId="19772" LastEditorUserId="19772" LastEditDate="2016-02-29T12:29:41.843" LastActivityDate="2016-03-30T15:14:49.857" Title="Extracting multiple signals to baseband" Tags="|filters|bandwidth|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29078" PostTypeId="1" AcceptedAnswerId="29085" CreationDate="2016-02-28T19:48:55.750" Score="4" ViewCount="8341" Body="&lt;p&gt;The following makes sense to me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Decimation reduces the number of samples so it reduces the amount of data that is metered across networks and reduces the processing time for chips. That sounds great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the following does not make sense to me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see decimation used in gnuradio-companion all the time.  Often the signal is decimated to reduce the sample rate, then later the sample rate is increased somehow.  What is the point of this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the vagueness of this question.&lt;/p&gt;&#xA;" OwnerUserId="18745" LastActivityDate="2019-04-30T16:34:00.263" Title="What is the point of decimation?" Tags="|decimation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29080" PostTypeId="1" AcceptedAnswerId="29082" CreationDate="2016-02-28T21:18:42.107" Score="2" ViewCount="773" Body="&lt;p&gt;I am having difficulty with this question specifically with the $\sin()$ part. So here goes nothing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a Linear Time-Invariant system with input $x[n]$ and output $y[n]$. When the input to the system is&#xA;$$x[n]=5 \sin(0.4\pi n)/(\pi n) + 10 \cos(0.5 \pi n)$$&#xA;and corresponding output is $$y[n] = 10 \sin(0.3 \pi (n-10))/(\pi (n-10))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determine the frequency response $H(e^{jw})$ and the impulse response $h[n]$ for the Linear Time-Invariant system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="19775" LastEditorUserId="13320" LastEditDate="2016-11-21T12:33:45.167" LastActivityDate="2016-11-21T12:33:45.167" Title="Linear Time-Invariant system frequency response and impulse response given input and output in time domain" Tags="|frequency-response|homework|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29081" PostTypeId="1" AcceptedAnswerId="29173" CreationDate="2016-02-28T21:24:20.247" Score="2" ViewCount="962" Body="&lt;p&gt;A Linear Time-Invariant system with impulse response $h_1[n]$ is an ideal lowpass filter with cutoff frequency $\omega_c =\pi/2$. The frequency response of the system is $H_1\left(e^{j\omega}\right)$. Suppose a new LTI system with impulse response $h_2[n]$ is obtained from $h_1[n]$ by $h_2[n] = (-1)^n\cdot h_1[n]$. Sketch the frequency response $H_2\left(e^{j\omega}\right)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this problem I know what a lowpass filter looks like in frequency domain but I don't know what $(-1)^n$ is. If I could just get some help with that, I could then convolve the two to get the frequency response. Or should I find the lowpass filter in time domain multiply it by $(-1)^n$ and then find its frequency response? Either way I would still need to know what to do with the $(-1)^n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so now I know that $H_1\left(e^{j\omega}\right)$ has a magnitude of $1$ and $0$ phase when $\omega &amp;lt;\omega_c$ and $0$ when $\omega&amp;gt;\omega_c$ and that $(-1)^n$ has a DTFT of: $$\frac{2}{1-e^{-j\omega}}$$ because $(-1)^n$ is not causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then multiply the two and I get the same system as $h_1[n]$ but shifted by $1$ radian and its magnitude doubled? I am not totally sure, can someone please help?&lt;/p&gt;&#xA;" OwnerUserId="19775" LastEditorUserId="1629" LastEditDate="2016-03-02T21:15:10.603" LastActivityDate="2016-03-02T21:15:10.603" Title="Lowpass filter impulse response in frequency domain" Tags="|linear-systems|frequency-response|time-frequency|digital-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29082" PostTypeId="2" ParentId="29080" CreationDate="2016-02-28T22:45:10.270" Score="1" Body="&lt;p&gt;A classical question on signals and systems, for which I provide you one method of solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now given an LTI system, and its input $x[n]$ and output $y[n]$, the fundamental approach to determine the impulse response $h[n]$ involves the utilisation of a frequency domain approach to assert $H(e^{jw}) = Y(e^{jw})/X(e^{jw})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this problem however, I would choose a different approach which involves more of an analysis by inspection rather than pure mathematical operations, because of the fact that the input $x[n]$ involves a cosine term whose DTFT is includes impulses and will be problematic in the division process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method proceeds by drawing the DTFTs of input and output:&#xA;The input $x[n]$ involves two terms one of which is $$5 \sin(0.4 \pi n)/ \pi n$$ whose DTFT is a zero phase ideal lowpass filter of cutoff frequency $W_c = 0.4 \pi$ with a gain of 5. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the second term of input is $$10 \cos (0.5 \pi n)$$ whose DTFT is modeled as two impulses at $$ 5 \pi \delta(\omega + 0.5 \pi) +  5 \pi \delta(\omega - 0.5 \pi) $$ Because of linearity property of DTFT, these two DTFT are added to represent the DTFT of the input $x[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, look at the DTFT of the output $$y[n] = \frac {10 \sin(0.3 \pi (n-10) )}{\pi (n-10)} $$ which is again an ideal low pass filter of gain = 10 and $W_c = 0.3 \pi$ with a phase term of $e^{-10 \omega}$ hence $Y(e^{j\omega}) =10 e^{-j10 \omega}$ when $|\omega| &amp;lt; 0.3 \pi$ and zero elsewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we want to find a frequency response $H(e^{j\omega})$ such that when it is multiplied by the DTFT $X(e^{j\omega})$ of the input $x[n]$, it should produce the DTFT $Y(e^{j\omega})$ of the output $y[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The observation of the input and output DTFTs yields the conclusion that one such $H(e^{j \omega})$ is a linear phase ideal lowpass filter of gain = 2, $W_c = 0.3\pi$ and phase term of $e^{-j10 \omega}$, whose time domain correspondence is found by inspection as $$h[n] = \frac {2 \sin(0.3 \pi (n-10))}{\pi (n-10)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The justification of this solution can be made by observing the effect of this filter on its input: it will completely supress any signal above the frequency $\omega = 0.3 \pi$ and it will multiply any signal below that frequency by 2, while adding a phase shift of -10 radians which reflects itself as a group delay of 10 samples in (n-10) term.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2016-02-28T22:45:10.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29083" PostTypeId="1" CreationDate="2016-02-28T23:08:01.117" Score="2" ViewCount="3099" Body="&lt;p&gt;The figure shows the pole–zero plots for three different causal linear time-invariant systems with real impulse responses.&#xA;Indicate which of the following properties apply to each of the systems pictured: stable, IIR, FIR, minimum phase, all pass,linear phase, positive group delay at all $w$:&lt;a href=&quot;https://i.stack.imgur.com/yFUkV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yFUkV.png&quot; alt=&quot;Pole-zero maps of different systems&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having problems specifically finding out if the system is linear phase and has a positive group delay, and all pass or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first plot: the system is stable since we have a region of convergence containing the unit circle, and FIR because it is stable, and minimum phase because we have a pair of complex conjugate pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so on with the other figures...But I still cannot quite figure out how to determine the other properties given the pole-zero mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so I've gotten to this point:&#xA;Plot 1 is not stable because the ROC doesn't contain the unit circle and since all zeros are in the unit circle, we have a minimum phase system. Additionally, we have a IIR system because of the 3 poles so we have feedback. Its also not an allpass filter because poles and zeros are not reciprocals of each other. I hope those are right and I understand the concept so that I can continue with the other plots. But, I'm really having difficulty trying to find out if the system is a linear phase system or not and if it has a positive group delay. I know that linear phase translates in delay in time for all frequencies by the same amount and that group delay $\tau_g = -d\theta(w)/dw$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance guys. &lt;/p&gt;&#xA;" OwnerUserId="19775" LastEditorUserId="19775" LastEditDate="2016-02-29T11:11:05.283" LastActivityDate="2016-03-30T12:02:21.327" Title="System characterization given pole-zero mapping" Tags="|filters|linear-systems|digital|poles-zeros|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29085" PostTypeId="2" ParentId="29078" CreationDate="2016-02-29T03:55:43.183" Score="4" Body="&lt;p&gt;In communications and in typical GnuRadio applications, decimation is most commonly used to reduce the sampling rate of an oversampled signal, in order to reduce the computational complexity of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider this example: You design a stereo FM receiver in GnuRadio. The FM signal is approximately 200 KHz wide, so you sample the downconverted signal at (let's say) 512 kHz. After FM demodulation, the L+R audio signal is present between 0 and 15 kHz; to recover it, you low-pass filter the signal. This leaves you with a signal whose spectrum extends to 256 kHz, but has actual content only up to 15 kHz. It makes sense to decimate it so that its sampling rate becomes, let's say, 32 kHz. In any further processing of this signal, you just reduced the number of operations required by a factor of 512/32=16.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes you have to interpolate (increase the sampling rate). Let's say that now you're creating a stereo FM signal. You need to shift the spectrum of the L-M signal from the range 0-15 kHz to the range 23-38 kHz. If the signal is originally sampled at 32 kHz, the operation is impossible. You need to first interpolate it to a new sampling rate of at least 38*2=76 kHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(See &lt;a href=&quot;https://en.wikipedia.org/wiki/FM_broadcasting#Stereo_FM&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/FM_broadcasting#Stereo_FM&lt;/a&gt; if you're unfamiliar with the format of FM broadcast signals).&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-02-29T03:55:43.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29086" PostTypeId="2" ParentId="29076" CreationDate="2016-02-29T04:10:56.260" Score="3" Body="&lt;p&gt;I would do it like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Start with a 2 MHz signal containing up to 10 FM stations. In practice it will contain maybe three or so.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Identify the carrier frequencies of each station; call them &lt;code&gt;f0&lt;/code&gt; to &lt;code&gt;f9&lt;/code&gt;. These are the frequencies in your downconverted 2 MHz signal, not the original carriers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Design 10 200kHz-wide bandpass filters centered around each &lt;code&gt;f0:f9&lt;/code&gt;. Filter the 2-MHz signal with each of these filters to separate each individual FM carrier.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Downconvert each FM carrier back to baseband. To do this, multiply each carrier by the signal &lt;code&gt;exp(-j*2*pi*fi*t)&lt;/code&gt;, where &lt;code&gt;fi&lt;/code&gt; is the carrier frequency and &lt;code&gt;t&lt;/code&gt; is time. This will bring each FM signal to baseband.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Demodulate each signal using a regular FM demodulator.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Send each resulting audio signal to its destination.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;An alternative procedure would swap steps 3 and 4:&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Frequency-shift the entire 2 MHz signal so that the desired carrier ends up at 0 Hz.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a low-pass filter to remove all undesired frequencies.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The advantage of this method is that you need to design only one low-pass filter instead of 10 band-pass filters. However, you need to be careful that you don't introduce aliases that can affect the frequencies you want to recover. The reason is that a 2-MHz signal sampled at 4-MHz doesn't have any &quot;headroom&quot; at the ends; any time shifting will introduce aliases. Just make sure these don't end up in the passband of your low-pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you need to: design bandpass filters (or one low-pass filter), generate complex exponentials, and demodulate the FM signals. You can do this Matlab, Liquid DSP, GnuRadio, or any number of other numerical/radio programs and languages. I think your largest constraint will be computer power, unless you only have a couple of FM stations.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-02-29T14:22:07.910" LastActivityDate="2016-02-29T14:22:07.910" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29087" PostTypeId="1" CreationDate="2016-02-29T04:16:58.850" Score="0" ViewCount="460" Body="&lt;p&gt;A car's engine rotates in the range of 500 RPM to 6000 RPM. This is in the audible range. The car's engine is activated using spark plugs which are an electrical system at the same frequency (or some harmonic).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning on the radio to an AM receiver, you can sometimes hear a sound at the frequency that the engine is spinning. I believe this happens because the electrical system radiates EM with a broad spectrum and it is enveloped at the audible RPM rate. The broad spectrum intersects with the receiver frequency selection.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a name for this type of system? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any effective DSP techniques for selecting and &quot;receiving&quot; the RPM sound in this scenario?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;My application is a transmission scheme similar to the above. My receiver will be a software defined radio.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1171" LastActivityDate="2016-02-29T04:16:58.850" Title="Car engine audible through AM radio -- what is this called?" Tags="|modulation|demodulation|radio|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29089" PostTypeId="2" ParentId="29083" CreationDate="2016-02-29T06:37:19.823" Score="2" Body="&lt;p&gt;I will not do the homework for you, but I'll make a few comments on your observations to clear up some of your misconceptions. Concerning the first plot (top left I suppose) you wrote:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&quot;&lt;em&gt;the system is stable since we have a region of convergence containing the unit circle&lt;/em&gt;&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This would be correct if the system were non-causal (i.e., with a two-sided impulse response), but since - according to the first sentence in the question - the system is &lt;em&gt;causal&lt;/em&gt;, it can't be stable if it has poles outside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&quot; ... &lt;em&gt;and FIR because it is stable&lt;/em&gt;&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is wrong. What you're saying is that any stable system is FIR, which is definitely not the case. Of course there are stable IIR filters. Here you'll have to do some more studying to learn what stability means and to understand that it is not necessary (only sufficient) for a stable system to be FIR.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&quot;... &lt;em&gt;and minimum phase because we have a pair of complex conjugate pairs&lt;/em&gt;&quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;That's also wrong. The fact that a system has complex conjugate pairs of poles and zeros has nothing to do with the minimum-phase property. You need to read up on minimum-phase systems. They can be inverted by a causal and stable system. What does this tell you about its zeros?&#xA;Any system with a real-valued impulse response has either real-valued or complex conjugate pairs of poles and zeros. That's because $H(z)$ is a real-valued function of a complex argument.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-02-29T06:37:19.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29093" PostTypeId="1" AcceptedAnswerId="29097" CreationDate="2016-02-29T09:15:10.807" Score="4" ViewCount="3297" Body="&lt;p&gt;I have a pressure transducer signal from a reacting mixture available &lt;a href=&quot;https://drive.google.com/file/d/0BwwhEMUIYGyTczFWSk1RX1BTYVU/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, which has a sampling frequency of 50kHZ. I have also obtained the spectrogram of the signal with NFFT=256, noverlap=4 as shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f2su0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f2su0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expected to see one high power frequency after pressure rise, instead of multiple frequencies (after t=0.03s). &lt;strong&gt;&lt;em&gt;Why are multiple frequencies detected? Am I using the correct NFFT and noverlap parameters? How are NFFT and noverlap selected for this signal?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="19783" LastActivityDate="2016-02-29T20:11:31.103" Title="How to interpret spectrogram correctly?" Tags="|fft|frequency-spectrum|power-spectral-density|spectrogram|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29094" PostTypeId="1" CreationDate="2016-02-29T10:59:41.307" Score="1" ViewCount="102" Body="&lt;p&gt;Now I receive $y=s+n$, $s$ is the signal and $n$ is the white guassion noise. Everytime $s$ will be change irregularly, have some methods to get a estimation of $s$ namely $\hat s$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely $s$ is random.&#xA;And I don't know $s$ how to change everytime,so the traditional kalman filter algorithm may can't be used in this circumstance.&lt;/p&gt;&#xA;" OwnerUserId="18603" LastEditorUserId="13320" LastEditDate="2016-11-21T12:33:32.313" LastActivityDate="2016-11-21T12:33:32.313" Title="Estimate $s$ from $y=s+n$" Tags="|signal-analysis|kalman-filters|adaptive-algorithms|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29095" PostTypeId="2" ParentId="29093" CreationDate="2016-02-29T11:03:01.547" Score="0" Body="&lt;p&gt;For plotting spectrogram, size of the window, and percentage overlap depends on the signal you are using, usually window length is taken as the time till which you believe that the signal will be stationary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if window length is small(number of samples) than you will get better resolution in time domain. and if window length is large you will get more resolution in frequency domain.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have plotted the spectrogram of your signal for various window lengths(with 50% overlap), I am always getting multiple frequency components.&lt;a href=&quot;https://i.stack.imgur.com/gceyH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gceyH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-02-29T11:03:01.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29096" PostTypeId="1" CreationDate="2016-02-29T11:52:55.933" Score="1" ViewCount="808" Body="&lt;p&gt;I am sampling a sine wave of 50Hz(stepped down from 230V) at the rate of 500KHz. For identifying disturbances in the wave, i was thinking of comparing a cycle of incoming sine values with reference sine values(pure sine wave). But will the method be accurate? one of my friends told that there will be loss of synchronization and so number of samples in one cycle wont be the same every time we measure and comparison will give wrong answer. If so, could anyone suggest some method for doing the same? Also,how to detect the zero crossing point without using any hardware?&lt;/p&gt;&#xA;" OwnerUserId="18914" LastActivityDate="2016-02-29T11:52:55.933" Title="Sampling and zero crossing" Tags="|discrete-signals|signal-analysis|sampling|measurement|" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29097" PostTypeId="2" ParentId="29093" CreationDate="2016-02-29T14:01:31.440" Score="7" Body="&lt;p&gt;The problem is not the spectrogram parameters, these are correct since they only depend on what resolution you want in time and frequency domain. Also, the spectrogram interpretation is correct, there are multiple frequency peaks. The problem may be:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I expected to see one high power frequency after pressure rise, instead of multiple frequencies &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why? If you are not in free-field conditions (and you mention a cylinder) there will be multiple wave reflections, resonances, standing waves and 3D pressure patterns. A sudden pressure step will distribute its power over the spectrum, but frequency peaks will appear because you are essentially &quot;tuning&quot; your cylinder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that pressure waves travel at sound speed. Considering for example the habitual 340 m/s; if your cylinder measures 1m, the wave front will travel back and forth each 0.0029s, adding multiple frequency components to the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for standing wave patterns, we can consider the case of a closed cylinder, where we can compute the frequency of the fundamental frequency as $f_1 = \frac{a}{4L}$ with subsequent harmonics at $nf_1$ where $n$ are odd integers (if your cylinder is indeed closed, does it have a length of ~20cm?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1yvHf.gif&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1yvHf.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the problem of measuring higher frequency waves in ducts, consider that according to &lt;a href=&quot;http://scitation.aip.org/content/asa/journal/jasa/68/2/10.1121/1.384768&quot; rel=&quot;noreferrer&quot;&gt;Eriksson&lt;/a&gt;, it may be assumed that waves in a circular duct propagate in a planar fashion (i.e., pressure is constant in every cross-sectional area of the duct) &lt;strong&gt;only&lt;/strong&gt; below a cut-off frequency of:&#xA;$$&#xA;f = 1.84 \frac{a}{\pi D}\sqrt{1-M^2}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where a is the sound speed, D the duct diameter and M the Mach number of the mean flow. Above this frequency, the pressure distribution in a given section of the duct will not be uniform, it will have nodes. See the following animation for an idea on how pressure varies in a given planar section, noting that only the Z(0,0) is a typical planar wave. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CSG0e.gif&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CSG0e.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond the planar wave frequency it is difficult to correctly measure the pressure spectrum with only one transducer. In any case, I believe that the signal processing that you are performing is correct; the only problem is that you are witnessing the acoustic effects of your cylinder. &lt;/p&gt;&#xA;" OwnerUserId="3241" LastEditorUserId="3241" LastEditDate="2016-02-29T17:19:13.373" LastActivityDate="2016-02-29T17:19:13.373" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29100" PostTypeId="1" CreationDate="2016-02-29T17:03:56.223" Score="0" ViewCount="79" Body="&lt;p&gt;So I think I have my thinking correct on what I'm trying to do, but I just want to make sure I'm not assuming something that isn't true. Below is what I'm currently doing in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$r(t)$ is my received signal&lt;br&gt;&#xA;$T$ is my period&lt;br&gt;&#xA;$MultCurrent = r(n)\cdot r(n-T)$&lt;br&gt;&#xA;$MultPrevious = r(n-T)\cdot r(n-2T)$&lt;br&gt;&#xA;$Average(i) = Average(i-1) + MultCurrent - MultPrevious$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The average should be acting as a low pass filter. I'm using this to get my original data message back. This is working for me, but I'd like to do things in the frequency domain. Am I doing this correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm assuming $x(n) \cdot y(n)$ is equivalent to $X(f)\star Y(f)$ where the convolution is a circular convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N= 32$&lt;br&gt;&#xA;$cconv()$ is the $N$ point circular convolution of two sequences&lt;br&gt;&#xA;$fft1 = fft(r(n)$ from $n$ to $N)$&lt;br&gt;&#xA;$fft2 = fft(r(n-T)$ from $n-T$ to $N)$&lt;br&gt;&#xA;$fft3 = fft(r(n-2T)$ from $n-2T$ to $N)$&lt;br&gt;&#xA;$ConvCurrent = cconv(fft1,fft2)$&lt;br&gt;&#xA;$ConvPrevious = cconv(fft2,fft3)$&lt;br&gt;&#xA;$Average(i) = Average(i) + ConvCurrent(0) - ConvPrevious(0)$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ConvCurrent(0)$ is bin 0 of the result of the circular convolution (DC component). This is because i'm wanting the low pass filtered result. Is this the correct way to think about it? From what i'm thinking, i should need to transform back into the time domain. Also, if i'm wanting to filter my results before i do the circular convolution, can i just zero out all the frequency bins except for the frequency I care about? I'm not sure if this would cause any problems. Thanks a bunch!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastActivityDate="2016-02-29T17:03:56.223" Title="Concept check on doing multiply in time with circular convolution in frequency domain" Tags="|fft|convolution|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29102" PostTypeId="1" CreationDate="2016-02-29T17:17:57.027" Score="1" ViewCount="73" Body="&lt;p&gt;I'm trying to write some image processing code in python to differentiate between two types of images (we'll call them set Blue and set Amber).  I have run an algorithm I wrote that results in the data graphed below for a sample from one image from each set.  Although the absolute scale of the data varies, the Blue image always seems to have that characteristic steep ramp somewhere in the middle of the data.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Programmatically, what would be the best way to find such a steep, high ramp in this noisy data?  I'm looking for a binary answer: is this ramp present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/G7YMN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/G7YMN.png&quot; alt=&quot;Ramped Data&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19789" LastActivityDate="2016-02-29T17:17:57.027" Title="approach to differentiate noisy data with steep ramp" Tags="|noise|python|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29103" PostTypeId="1" AcceptedAnswerId="30915" CreationDate="2016-02-29T18:36:43.100" Score="2" ViewCount="436" Body="&lt;h2&gt;Problem statement:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I am designing a NP detector for the following detection problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathcal H_{0}: x[n] = A_0\cos(2\pi f_0n) + w[n]$&lt;br&gt;&#xA;$\mathcal H_{1}: x[n] = A_1\cos(2\pi f_0n) + w[n]$&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_{0}: \text{known parameter}$&lt;br&gt;&#xA;$w[n] \sim \mathcal N\left(0, \sigma^2\right), \text {WGN}$&lt;br&gt;&#xA;$A_{0}\ \ \sim \mathcal N\left(a_0, \sigma_0^2\right)$&lt;br&gt;&#xA;$A_{1}\ \ \sim \mathcal N\left(a_{1},\sigma_1^2\right)$&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What didn't work for me:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;o I have tried to  directly apply &lt;a href=&quot;https://en.wikipedia.org/wiki/Neyman%E2%80%93Pearson_lemma&quot; rel=&quot;nofollow&quot;&gt;Neyman-Pearson theorem&lt;/a&gt; in the way it's done in &quot;Fundamentals of Statistical Signal Processing, Volume II, Detection Theory&quot; by Steven M. Kay. But I have failed to derive test statistics for optimal detector.&lt;br&gt;&#xA;o I have tried to use the amplitude of the spectral component for $f_{0}$ as a test statistics and estimate threshold of making decision from given $P_{FA}$ (probability of false alarm). It worked fine for me, but I'm still concerned that this detector is not optimal.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Is there some way to design optimal NP detector for such problem?&lt;br&gt;&#xA;Any ideas, advices, links will be much appreciated.&lt;br&gt; &lt;/p&gt;&#xA;" OwnerUserId="6961" LastEditorUserId="6961" LastEditDate="2016-05-20T08:25:06.853" LastActivityDate="2016-05-20T18:40:45.833" Title="Detection of sine signals with random amplitudes" Tags="|signal-detection|statistics|random|hypothesis-testing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29104" PostTypeId="1" CreationDate="2016-02-29T18:51:05.280" Score="0" ViewCount="300" Body="&lt;p&gt;I'll be processing stereo music signal. What I need is to first split the frequency range into 2 bands at 50-100 Hz. In the higher band, I need to delay one of the channels by a certain number of milliseconds. The lower band has to be delayed as a whole (left+right channel) by a different value. Is this doable? Is this doable in real-time (think VST plugin for an audio player)? If it's possible, can you please give me pointers (algorithm-wise) on how to implement it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P. S. I need to preserve the sound quality. If such a filter would ruin it, then my idea goes to the trash can.&lt;/p&gt;&#xA;" OwnerUserId="9100" LastActivityDate="2018-01-02T04:54:23.400" Title="Multi-band audio delay filter?" Tags="|audio|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29105" PostTypeId="2" ParentId="22699" CreationDate="2016-02-29T19:31:56.903" Score="1" Body="&lt;p&gt;When you use the opening, the overall operation is called a granulometry. However, when you use a closing, it's called an anti-granulometry. It's the dual operation. Combined together, they form the Pattern Spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, if you apply a closing, you will certainly measure the structures between the marbles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is definitely not recommended to apply a smoothing first, because it will smooth the edges and small particles. Consequently, the particles detection will be less accurate.&lt;/p&gt;&#xA;" OwnerUserId="19791" LastActivityDate="2016-02-29T19:31:56.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29106" PostTypeId="1" AcceptedAnswerId="29142" CreationDate="2016-02-29T19:40:02.247" Score="-1" ViewCount="524" Body="&lt;p&gt;I want to take FFT of my signal and reconstruct it back via IFFT. It seems the real part of odd numbered samples and image part of even numbered samples are multiplied by -1 which can be observed below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if I have &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        [995]   (-0.382624, 0.000000)   std::complex&amp;lt;double&amp;gt;&#xA;        [996]   (-0.831434, 0.000000)   std::complex&amp;lt;double&amp;gt;&#xA;        [997]   (-1.000000, 0.000000)   std::complex&amp;lt;double&amp;gt;&#xA;        [998]   (-0.831506, 0.000000)   std::complex&amp;lt;double&amp;gt;&#xA;        [999]   (-0.382743, 0.000000)   std::complex&amp;lt;double&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some of the values(not all) having the negative sign like below &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    [995]   (0.382624, 0.000000)    std::complex&amp;lt;double&amp;gt;&#xA;    [996]   (-0.831434, -0.000000)  std::complex&amp;lt;double&amp;gt;&#xA;    [997]   (1.000000, 0.000000)    std::complex&amp;lt;double&amp;gt;&#xA;    [998]   (-0.831506, 0.000000)   std::complex&amp;lt;double&amp;gt;&#xA;    [999]   (0.382743, -0.000000)   std::complex&amp;lt;double&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any explanation for this behavior? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using FFTW library and I wrap it a bit like below ; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;in = sharpFFT(in, true);&#xA;in = swapVectorWithIn(in);&#xA;in = sharpFFT(in, false);&#xA;for ( auto&amp;amp; elem : in)&#xA;    elem /= in.size();&#xA;&#xA;using CDataType = std::vector&amp;lt; std::complex&amp;lt;double&amp;gt; &amp;gt; ;&#xA;&#xA;inline&#xA;CDataType swapVectorWithIn( const CDataType&amp;amp; in )&#xA;{&#xA;&#xA;    auto middlePos = in.begin() + in.size()/2;&#xA;    CDataType returnVal( middlePos , in.end() );&#xA;    returnVal.insert( returnVal.end(), in.begin(), middlePos);&#xA;    return returnVal;&#xA;}&#xA;&#xA;inline&#xA;CDataType sharpFFT( CDataType&amp;amp; in, bool isForward )&#xA;{&#xA;    const int N =  in.size() ;&#xA;&#xA;    std::vector&amp;lt; std::complex&amp;lt;double&amp;gt; &amp;gt; out (N);&#xA;&#xA;    fftw_plan my_plan;&#xA;    if (!isForward)&#xA;      my_plan = fftw_plan_dft_1d(N, reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(&amp;amp;in[0]),&#xA;                                             reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(&amp;amp;out[0]), FFTW_BACKWARD, FFTW_ESTIMATE);&#xA;    else&#xA;      my_plan = fftw_plan_dft_1d(N, reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(&amp;amp;in[0]),&#xA;                                               reinterpret_cast&amp;lt;fftw_complex*&amp;gt;(&amp;amp;out[0]), FFTW_FORWARD, FFTW_ESTIMATE);&#xA;&#xA;    fftw_execute(my_plan);&#xA;    if (!isForward)&#xA;    {&#xA;        std::transform(out.begin(), out.end(), out.begin(), [N]( std::complex&amp;lt;double&amp;gt;&amp;amp; elem ){&#xA;            return elem / (double)N;&#xA;        });&#xA;    }&#xA;    return out;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5392" LastActivityDate="2016-03-01T17:04:00.487" Title="Signal signs are changing after IFFT reconstruction" Tags="|fft|ifft|c|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29107" PostTypeId="2" ParentId="20236" CreationDate="2016-02-29T19:41:07.337" Score="0" Body="&lt;p&gt;I've spent few years working with specialists on mathematical morphology, and I didn't get a mathematical answer why morphological gradient was better than a classical convolution. It was more a choice of ideology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the results are a little bit different and according to the problem, you can choose one over the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But morphological gradient is super fast, because it is usually performed with a small structuring element (radius 1 or 2) of type square or hexagon, so you can use SIMD/SSE optimization.&lt;/p&gt;&#xA;" OwnerUserId="19791" LastActivityDate="2016-02-29T19:41:07.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29108" PostTypeId="2" ParentId="18253" CreationDate="2016-02-29T19:45:58.573" Score="1" Body="&lt;p&gt;Take a look to &lt;a href=&quot;https://hal.archives-ouvertes.fr/hal-00797378/document&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt; from Santiago Velasco, it's about Conditional Toggle Mapping, and it's application to denoising.&lt;/p&gt;&#xA;" OwnerUserId="19791" LastActivityDate="2016-02-29T19:45:58.573" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29109" PostTypeId="2" ParentId="13414" CreationDate="2016-02-29T19:51:07.943" Score="1" Body="&lt;p&gt;If you know the median filter principle, that's exactly the same type of operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each pixel, you take a look to all the neighbor pixels (defined by the structuring element), and you take the max (dilation) or the min (erosion). Therefore it's like the median filter, but instead of taking the median value, you take the min/max.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mathematical formulae is &lt;a href=&quot;https://hal.archives-ouvertes.fr/hal-00797378/document&quot; rel=&quot;nofollow&quot;&gt;here, page 3&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="19791" LastEditorUserId="19791" LastEditDate="2016-03-02T18:31:01.013" LastActivityDate="2016-03-02T18:31:01.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29110" PostTypeId="2" ParentId="29093" CreationDate="2016-02-29T20:11:31.103" Score="4" Body="&lt;p&gt;The answer from @orgeGT is quite detailed. It really looks like, to me, a pressure signal from a knocking gazoline engine, where you observe a wide band effect (the impulse part of the knock) and  resonant frequencies and their harmonics (the wiggling part of the knock), and a (slight) decay in their amplitude, related to the variations of the volume of the cylinder volume, and the change in temperature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p1Dh3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p1Dh3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the knock phenomenon may be unrelated to your, you can check the literature, as signal analysis sounds close&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-02-29T20:11:31.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29111" PostTypeId="2" ParentId="28537" CreationDate="2016-03-01T01:03:20.797" Score="-1" Body="&lt;p&gt;I would start with a pruning algorithm (see skeleton pruning) in order to erase small segments, then use:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the Hough transform, but segments are not really straights.&lt;/li&gt;&#xA;&lt;li&gt;if the pruning was a success, then you separate each segment and use the first and last point to compute the orientation, which will define when line are parallel. You will have to introduce a tolerance because you want quasi-parallel lines.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19791" LastActivityDate="2016-03-01T01:03:20.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29112" PostTypeId="1" AcceptedAnswerId="29116" CreationDate="2016-03-01T01:06:41.813" Score="0" ViewCount="2709" Body="&lt;p&gt;One of my tutorial questions for communication systems asks me to find the time function $x(t)$ which has the Continuous-Time Fourier Transform: $$X(\omega) = \frac{3}{(1+j\omega)(2-j\omega)}$$ So far all I have been able to do is rationalize the function so by multiplying the numerator and denominator by $(1-j\omega)(2+j\omega)$ and then substituting the resulting function $X(j\omega)$ into the formula for the inverse Fourier Transform. I can't find examples like this anywhere and so I can't evaluate where the upper and lower limits should be in order to solve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have some knowledge to shed some light on this for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simon.&lt;/p&gt;&#xA;" OwnerUserId="18974" LastEditorUserId="1629" LastEditDate="2016-03-05T12:34:02.953" LastActivityDate="2016-03-05T12:34:02.953" Title="Inverse Fourier Transform problem" Tags="|transform|fourier|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29113" PostTypeId="2" ParentId="28115" CreationDate="2016-03-01T01:06:53.860" Score="0" Body="&lt;p&gt;I would use a Gabor filter or a difference of gaussians.&lt;/p&gt;&#xA;" OwnerUserId="19791" LastActivityDate="2016-03-01T01:06:53.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29116" PostTypeId="2" ParentId="29112" CreationDate="2016-03-01T01:56:49.827" Score="2" Body="&lt;p&gt;Problems involving the derivations of CTFT $X(j\omega)$ for a given signal $x(t)$ or the reverse: finding $x(t)$ for a given $X(j\omega)$ can be solved in a number of ways. Fundamentally there exists the so called fourier integrals: the Analysis $$X(j\omega) = \int_{-\infty}^{\infty} {x(t) e^{-j\omega t} dt }$$ &#xA;and the synthesis: $$x(t) = \frac {1}{2\pi} \int_{-\infty}^{\infty} {X(j\omega) e^{j\omega t} d\omega }$$ &#xA;to directly compute what is being asked. But due to several reasons we also develop practical, shortway techniques to find those signals, as a very natural extension of engineering practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One such practical method of finding the forward or inverse fourier transforms involves the systematic application of known pairs with partial fraction expansions. Which enables the bypass of the integrals and yields fast answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all you shall apply the method of partial fraction expansion to your given CTFT $$X(j\omega) = \frac {3}{(1+j\omega)(2-j\omega)} = \frac {1}{1+j\omega} + \frac {1}{2-j\omega} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you shall consult into a table of fourier pairs, which would guide you to find which signal has transforms of this kind. From those standard tables one can see that $x(t) =  e^{-at} u(t) $ has the transform of $1/(a + j\omega)$ and also $x(t) =  e^{at} u(-t) $ has the transform of $1/(a - j\omega)$, for $ a&amp;gt; 0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Henceforth, you would conlcude by finally invoking the linearity property of CTFT that $$ x(t) = e^{-t} u(t) + e^{2t} u(-t)$$&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2016-03-01T01:56:49.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29117" PostTypeId="2" ParentId="29071" CreationDate="2016-03-01T03:27:02.937" Score="2" Body="&lt;p&gt;Let's start to given some information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now that the sobel operator perform a aproximmation of the image gradient using convolution ( $ * $ ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being $\mathbf{A}$ an image of $n \times m$ size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operator $\mathbf{K}$, commonly, uses two $3 \times 3$ kernels which are convolved with the original image. Thus we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{G_x} = \mathbf{K_x} * \mathbf{A} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{G_y} = \mathbf{K_y} * \mathbf{A} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being &#xA;$$&#xA;  \mathbf{K_x} =  &#xA;  \left[ {\begin{array}{cc}&#xA;                -1 &amp;amp; 0 &amp;amp; +1\\  &#xA;                -2 &amp;amp; 0 &amp;amp; +2\\  &#xA;                -1 &amp;amp; 0 &amp;amp; +1\\  &#xA;              \end{array} } \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  \mathbf{K_y} =  &#xA;  \left[ {\begin{array}{cc}&#xA;                -1 &amp;amp; -2 &amp;amp; -1\\  &#xA;                 0 &amp;amp; 0 &amp;amp; 0\\  &#xA;                +1 &amp;amp; +2 &amp;amp; +1\\  &#xA;              \end{array} } \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, an extension of this kernel is a $5 \times 5$ matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  \mathbf{K_y} =  &#xA;  \left[ {\begin{array}{cc}&#xA;                -1 &amp;amp; -4 &amp;amp; -6  &amp;amp; -4 &amp;amp; -1\\  &#xA;                -2 &amp;amp; -8 &amp;amp; -12 &amp;amp; -8 &amp;amp; -2\\  &#xA;                 0 &amp;amp;  0 &amp;amp;  0  &amp;amp;  0 &amp;amp;  0\\&#xA;                +2 &amp;amp; +8 &amp;amp; +12 &amp;amp;  8 &amp;amp;  2\\ &#xA;                +1 &amp;amp; +4 &amp;amp; +6  &amp;amp; +4 &amp;amp; +1\\ &#xA;              \end{array} } \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  \mathbf{K_x} =  &#xA;  \left[ {\begin{array}{cc}&#xA;                 +1 &amp;amp;  +2  &amp;amp; 0 &amp;amp; -2  &amp;amp; -1\\  &#xA;                 +4 &amp;amp;  +8  &amp;amp; 0 &amp;amp; -8  &amp;amp; -4\\  &#xA;                 +6 &amp;amp;  +12 &amp;amp; 0 &amp;amp; -12 &amp;amp; -6\\&#xA;                 +4 &amp;amp;  +8  &amp;amp; 0 &amp;amp; -8  &amp;amp; -4\\ &#xA;                 +1 &amp;amp;  +2  &amp;amp; 0 &amp;amp; -2  &amp;amp; -1\\ &#xA;              \end{array} } \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;http://www.hlevkin.com/articles/SobelScharrGradients5x5.pdf&quot; rel=&quot;nofollow&quot;&gt;article&lt;/a&gt; demonstrates how to get Sobel gradient operators analytically. For that was using linear approximation of brightness in window 3x3.  Every pixel in window has its own weight. Special weight matrix selection gives Sobel gradient operator. &lt;/p&gt;&#xA;" OwnerUserId="17817" LastEditorUserId="17817" LastEditDate="2016-03-01T03:32:10.430" LastActivityDate="2016-03-01T03:32:10.430" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29118" PostTypeId="2" ParentId="28115" CreationDate="2016-03-01T03:41:56.237" Score="1" Body="&lt;p&gt;For dealing with images like this in the past, I have always had good luck using the &quot;Vesselness&quot; filter designed by Frangi et al. It utilizes the eigenvectors of the Hessian to determine the probability of a given pixel belonging to a vessel. The code is available on the &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/24409-hessian-based-frangi-vesselness-filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;MATLAB File Exchange&lt;/a&gt; and using the default parameters I was able to get the following result.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = imread('image.jpg');&#xA;img = 1 - (img(:,:,1) ./ max(max(img(:,:,1))));&#xA;f = FrangiFilter2D(img);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7z9yn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7z9yn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19801" LastActivityDate="2016-03-01T03:41:56.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29119" PostTypeId="2" ParentId="27764" CreationDate="2016-03-01T03:59:59.820" Score="1" Body="&lt;p&gt;Your mileage may vary, but in multiple environments on my x86_64 bit linux machine, I get much less error than 1 / 10^9.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;julia:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;julia&amp;gt; a=randn(32768); f=ifft(fft(a)); print(maximum(abs(f-a)))&#xA;1.782802105510316e-15&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;octave:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;octave:1&amp;gt; a=randn(32768,1); f=ifft(fft(a)); disp(max(abs(f-a)))&#xA;1.8184e-15&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;numpy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In [1]: %pylab&#xA;Using matplotlib backend: Qt4Agg&#xA;Populating the interactive namespace from numpy and matplotlib&#xA;&#xA;In [2]: a=randn(32768); f=fft.ifft(fft.fft(a)); print(max(abs(f-a)))&#xA;7.58800755928e-15&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The default for all these environments is float64.  If you want to share how the signal is bandlimited, that might shed more light on the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;UPDATE: To satisfy my curiosity, I tried this with a single sine-wav and basically get the same results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;julia&amp;gt; th=collect(0:32767)*(1000*pi/32767); a=sin(th); &#xA;       f=ifft(fft(a)); print(maximum(abs(f-a)))&#xA;9.393934579042684e-16&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Again, without more knowledge about the signal or the computation environment, this is hard to address.&lt;/p&gt;&#xA;" OwnerUserId="3644" LastEditorUserId="3644" LastEditDate="2016-03-17T04:24:34.823" LastActivityDate="2016-03-17T04:24:34.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29120" PostTypeId="2" ParentId="28115" CreationDate="2016-03-01T05:30:08.903" Score="3" Body="&lt;p&gt;I would like to direct you to 3 references:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;C. Steger: “Extracting Curvilinear Structures: A Differential&#xA;  Geometric Approach”. In B. Buxton, R. Cipolla, eds., “Fourth European&#xA;  Conference on Computer Vision”, Lecture Notes in Computer Science,&#xA;  Volume 1064, Springer Verlag, pp. 630-641, 1996.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;C. Steger: “Extraction of Curved Lines from Images”. In “13th&#xA;  International Conference on Pattern Recognition”, Volume II, pp.&#xA;  251-255, 1996.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;C. Steger: “An Unbiased Detector of Curvilinear Structures”. IEEE&#xA;  Transactions on Pattern Analysis and Machine Intelligence, vol. 20,&#xA;  no. 2, pp. 113-125, 1998.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In these works, Steger develops a subpixel curvilinear structure extraction algorithm, which is found to work very well for such images. I have also run the algorithm on your images and here you go:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Lines visualized on original image&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/IOnrB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IOnrB.png&quot; alt=&quot;Lines visualized on original image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Lines only&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/cBBwL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cBBwL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I set the line thickness to 2 for better visualization, normal contours are at sub-pixel level.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2016-03-01T05:30:08.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29121" PostTypeId="1" AcceptedAnswerId="29126" CreationDate="2016-03-01T06:27:42.153" Score="3" ViewCount="838" Body="&lt;p&gt;The CTFT of an analog signal is a representation of that analog signal in terms of the frequency parameter of sinusoidal (cosine specifically) functions whose weighted sum make up that signal. The cosines are continuous functions of time and the amplitude of a particular cosine at a given frequency is given by the amplitude of the spectrum at that frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the interpretation for the DTFT of a sampled signal analogous where the spectrum indicates the frequency of (discrete-time/sampled) cosines that sum to the sampled signal, the spectrum amplitude indicates the magnitude of that cosine, etc.?     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if $F=100\textrm{ Hz}$ and $|X(F=100\textrm{ Hz})| = 50$, then we know we have the component cosine signal: $50\cdot\cos(100n)$. Assuming $X(F)$ is the DTFT of $x(n)$. &lt;/p&gt;&#xA;" OwnerUserId="19803" LastEditorUserId="15892" LastEditDate="2016-03-31T10:07:36.597" LastActivityDate="2016-03-31T10:07:36.597" Title="What is the interpretation of the discrete-time spectrum?" Tags="|fourier-transform|dtft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29123" PostTypeId="1" CreationDate="2016-03-01T07:06:37.593" Score="1" ViewCount="206" Body="&lt;p&gt;I have continuous data with very high amplitude periodic noise. Data is sampled at 500 Hz. The period of the noise does change with time but within a short interval (~ a minute) it is constant. Top picture shows an interval where there is very little noise. Second picture is the noisy data. In this example the noise period is 112 samples, that is 0.22 second. Third picture shows the frequency spectra of the noisy data up to 25 Hz (sorry, freq. axis slightly shifted) and the last one is a section of auto-correlation function. Sometimes the noise is more complex (multiple periodic), but the periodicity is still there. I have tried to remove the noise by making a reference signal and some adaptive filtering in a windowing scheme. Though it more or less works, it takes too much time. I have many channels of streaming data. Not all channels are affected and between those that are, the noise doesn't correlate (directional sensors). The filter does not need to do an excellent job. Just so to allow a real signal to be detected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Appreciate your help&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H2PQE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H2PQE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4036" LastEditorUserId="4036" LastEditDate="2016-03-01T08:38:53.283" LastActivityDate="2016-03-01T08:38:53.283" Title="Periodic noise attenuation" Tags="|filters|noise|periodic|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29124" PostTypeId="1" AcceptedAnswerId="29339" CreationDate="2016-03-01T07:24:06.703" Score="2" ViewCount="1932" Body="&lt;p&gt;I'm looking for an algorithm for &lt;a href=&quot;https://en.wikipedia.org/wiki/Vibrato&quot; rel=&quot;nofollow&quot;&gt;Vibrato audio effect&lt;/a&gt; for a cross-platform C++ program of audio processing. Now I use the realization from &lt;a href=&quot;https://github.com/dliganov/Chaotic-DAW/blob/master/rosic/effects/rosic_Vibrato.h&quot; rel=&quot;nofollow&quot;&gt;Chaotic-DAW sources&lt;/a&gt;. The problem is that Chaotic-DAW has a &lt;strong&gt;&lt;em&gt;huge&lt;/em&gt;&lt;/strong&gt; class hierarchy, and:&lt;br&gt;&#xA; 1. I don't want to use such a huge library&lt;br&gt;&#xA; 2. I cannot use it on Mac OS X (&lt;a href=&quot;https://stackoverflow.com/questions/35699727/qt-clang-portaudio-what-does-those-errors-mean?&quot;&gt;cannot compile&lt;/a&gt;)&lt;br&gt;&#xA; 3. I will not be able to port the program to a microcontroller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The necessary Vibrato parameters: delay, depth, period (cycle length).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://softwarerecs.stackexchange.com/questions/30018/looking-for-audio-processing-library&quot;&gt;Related topic on Software Recommendations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update.&lt;/strong&gt; &lt;em&gt;I have tried to isolate the Vibrato class, but the hierarchy is so large that it's impossible.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="13286" LastEditorUserId="13286" LastEditDate="2016-03-09T17:47:41.547" LastActivityDate="2016-03-09T17:47:41.547" Title="VIbrato (pitch variation) function" Tags="|audio|frequency|c|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29125" PostTypeId="1" AcceptedAnswerId="30475" CreationDate="2016-03-01T07:55:38.680" Score="1" ViewCount="5051" Body="&lt;p&gt;I have an EEG data of 200 Hz and sampled at 4097. I have few doubts and questions related to this data:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What does it mean by sampling in EEG data? &lt;/li&gt;&#xA;&lt;li&gt;I am getting the sample rate and the frequency when I plot the data as shown below. Shouldn't it be the time and frequency?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I don't understand what I'm missing here. Can anyone explain how am I supposed to identify the time and frequency of EEG data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EEG data file : &lt;a href=&quot;http://filesave.me/file/123174/eeg-txt.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://filesave.me/file/123174/eeg-txt.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code for the above plot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = np.array([])&#xA;input = open('eeg.txt', 'r')&#xA;for file in input:&#xA;    file = file.replace(',','')&#xA;    x = np.append(x, float(file))&#xA;input.close()&#xA;plt.subplot(1, 1, 1)&#xA;plt.plot(x)&#xA;plt.ylabel('EEG signal')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;FFT calculation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;x = np.array([])&#xA;input = open('eeg.txt', 'r')&#xA;for file in input:&#xA;    file = file.replace(',','')&#xA;    x = np.append(x, float(file))&#xA;input.close()&#xA;plt.subplot(1, 1, 1)&#xA;ff = fft(x)&#xA;plt.plot(ff)&#xA;plt.ylabel('EEG signal')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Wavelet decomposition:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;coeffs = wavedec(x, 'db4', level=6)&#xA;cA2, cD1, cD2,cD3,cD4,cD5,cD6 = coeffs&#xA;&#xA;plt.subplot(7, 1, 1)&#xA;plt.plot(x)&#xA;plt.ylabel('Noisy Signal')&#xA;plt.subplot(7, 1, 2)&#xA;plt.plot(cD6)&#xA;plt.ylabel('noisy')&#xA;plt.subplot(7,1,3)&#xA;plt.plot(cD5)&#xA;plt.ylabel(&quot;gamma&quot;)&#xA;plt.subplot(7,1,4)&#xA;plt.plot(cD4)&#xA;plt.ylabel(&quot;beta&quot;)&#xA;plt.subplot(7,1,5)&#xA;plt.plot(cD3)&#xA;plt.ylabel(&quot;alpha&quot;)&#xA;plt.subplot(7,1,6)&#xA;plt.plot(cD2)&#xA;plt.ylabel(&quot;theta&quot;)&#xA;plt.subplot(7,1,7)&#xA;plt.plot(cD1)&#xA;plt.ylabel(&quot;delta&quot;)&#xA;plt.draw()&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Results of wavelet: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/i6ZtS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i6ZtS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19806" LastEditorUserId="13320" LastEditDate="2016-11-13T13:01:01.977" LastActivityDate="2020-10-15T12:22:24.020" Title="How to identify and differentiate frequency and time in EEG data using python?" Tags="|python|eeg|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29126" PostTypeId="2" ParentId="29121" CreationDate="2016-03-01T08:18:55.870" Score="1" Body="&lt;p&gt;Let's first consider the continuous-time case. From the formula for the inverse Fourier transform&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty}X(\Omega)e^{j\Omega t}d\Omega\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see that at a given frequency $\Omega$ (in rad/s), the value of the spectrum $X(\Omega)$ can be interpreted as the &quot;strength&quot; with which the complex exponential $e^{j\Omega t}$ contributes to the signal $x(t)$. You &lt;em&gt;cannot&lt;/em&gt; conclude (as you seem to suggest) that the signal contains a sinusoid with amplitude $|X(\Omega)|$. This would only be the case if the signal $x(t)$ were periodic and, consequently, the integral in $(1)$ could be written as a sum, namely the Fourier series. Also note that even in that case the sinusoid is not just a cosine with zero phase, because the Fourier coefficients are generally complex and, hence, determine the amplitude as well as the phase of the respective sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this in mind, we can interpret the formula for the inverse discrete-time Fourier transform (IDTFT):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\frac{1}{2\pi}\int_{-\pi}^{\pi}X(\omega)e^{jn\omega}d\omega\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I use a different variable here because $\omega$ in $(2)$ is not the same as $\Omega$ in $(1)$ (see below). Also note that the limits of the integral in $(2)$ are $\pm \pi$ instead of $\pm \infty$. The reason for the latter is that the sampling frequency sets an upper limit for the frequencies that can be uniquely represented by the DTFT (check out &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;Aliasing&lt;/a&gt; and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;Sampling Theorem&lt;/a&gt; if this is new to you). Apart from that, the structures of $(1)$ and $(2)$ are the same. So you can interpret the DTFT of $x[n]$ at a certain &quot;frequency&quot; $\omega$ as the &quot;strength&quot; with which the complex exponential $e^{jn\omega}$ is represented in the sequence $x[n]$. Again, it's generally not the amplitude of some sinusoid contained in $x[n]$, for the same reasons as outlined above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last thing that remains is the explanation of the difference between the frequency variables $\Omega$ and $\omega$. $\Omega$ is simply the frequency in radians per second, so we have $\Omega=2\pi f$, where $f$ is the frequency in Hertz. Since in discrete-time all frequencies must be seen as relative to the sampling frequency $f_s$, the variable $\omega$ is a normalized frequency in radians: $\omega=2\pi f/f_s$. So the integration limits in $(2)$ correspond to $f=\pm f_s/2$. The frequency $f_s/2$ is called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow&quot;&gt;Nyquist frequency&lt;/a&gt;, and frequencies above the Nyquist frequency cannot be represented uniquely for a given sampling frequency.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-01T08:18:55.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29127" PostTypeId="2" ParentId="29022" CreationDate="2016-03-01T08:42:34.053" Score="0" Body="&lt;p&gt;There an algorithm in &lt;a href=&quot;http://cellprofiler.org&quot; rel=&quot;nofollow&quot;&gt;CellProfiler&lt;/a&gt;. It's basic, but it may help you if you are a beginner. The algorithm separates the channels, applies a threshold to detect roughly the nuclei, then use the result to feed a watershed constrained.&lt;/p&gt;&#xA;" OwnerUserId="19791" LastActivityDate="2016-03-01T08:42:34.053" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29128" PostTypeId="2" ParentId="28240" CreationDate="2016-03-01T08:47:58.150" Score="1" Body="&lt;p&gt;The butterflies are really different and the backgrounds as well, then it makes it really difficult. I would try one of these ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Train the Viola &amp;amp; Jones algorithm on your butterflies. It's a cascade of weak classifiers usually used for face detection (algorithm implemented in all the cameras), but it can be trained for other purposed.&lt;/li&gt;&#xA;&lt;li&gt;The background seems to be pretty different of the butterflies. I would try to apply the thresholding by histereis according to the values of the pixels on the borders. Like that you select all the similar pixels that touch the border, and it will reduced a lot the region of interest.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19791" LastActivityDate="2016-03-01T08:47:58.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29129" PostTypeId="2" ParentId="24578" CreationDate="2016-03-01T08:53:19.103" Score="1" Body="&lt;p&gt;Take a look to the &lt;a href=&quot;http://fiji.sc/TurboReg&quot; rel=&quot;nofollow&quot;&gt;ImageJ plugin&lt;/a&gt; called &lt;a href=&quot;http://bigwww.epfl.ch/thevenaz/turboreg/&quot; rel=&quot;nofollow&quot;&gt;TurboReg&lt;/a&gt; algorithm (or &lt;a href=&quot;http://bigwww.epfl.ch/thevenaz/stackreg/&quot; rel=&quot;nofollow&quot;&gt;StackReg&lt;/a&gt;). It should be really effective for such images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in your example, the two pictures seem to have been taken from different angles (right left), but also different height. So two angles are different, and then you have to find an affine transformation.&lt;/p&gt;&#xA;" OwnerUserId="19791" LastEditorUserId="19791" LastEditDate="2016-03-01T09:00:05.540" LastActivityDate="2016-03-01T09:00:05.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29131" PostTypeId="1" CreationDate="2016-03-01T09:44:35.430" Score="6" ViewCount="4860" Body="&lt;p&gt;In my signals and systems course, we have learned that the discrete-time Fourier transform is $2\pi$ periodic, but the continuous-time Fourier transform is &lt;em&gt;not&lt;/em&gt; periodic in general. For reference, we are using the following definitions of each transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuous-Time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = \int_{-\infty}^{\infty} X(j\omega) e^{j\omega t} \, d\omega \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ X(j\omega) = \int_{-\infty}^{\infty} x(t) e^{-j\omega t} \, dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Discrete-Time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = \int_{\langle 2\pi \rangle} X(e^{j\omega}) e^{j\omega n} \, d\omega \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ X(e^{j\omega}) = \sum_{n=-\infty}^{\infty} x[n] e^{-j\omega n}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm searching for some intuition as for why the DTFT is periodic, but the CTFT is not. In class, my instructor presented the following argument: for a discrete-time signal,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;e^{j\omega n} = e^{j\omega(n + 2\pi)}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and thus any $x[n]$ can be expressed as a sum of individually $2\pi$ periodic functions. However, I don't see why that argument only applies to discrete-time signals - I feel as if it also works for continuous-time signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any someone explain?&lt;/p&gt;&#xA;" OwnerUserId="19807" LastActivityDate="2021-05-02T14:45:03.530" Title="$2\pi$ periodicity of discrete-time Fourier transform" Tags="|discrete-signals|fourier-transform|continuous-signals|periodic|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29132" PostTypeId="2" ParentId="6319" CreationDate="2016-03-01T10:14:28.987" Score="2" Body="&lt;p&gt;Generated in Audacity, from top to bottom: white, pink, brownian noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NifrM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NifrM.png&quot; alt=&quot;noises&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zoomed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Rwu0d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rwu0d.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I note the following differences:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Distribution of amplitudes is uniform and uncorrelated for white noise.&lt;/li&gt;&#xA;&lt;li&gt;Brownian noise is literally Brownian motion (a random walk) in the time domain.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hard to say anything more really.&lt;/p&gt;&#xA;" OwnerUserId="19808" LastActivityDate="2016-03-01T10:14:28.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29134" PostTypeId="2" ParentId="29131" CreationDate="2016-03-01T11:55:55.213" Score="9" Body="&lt;p&gt;The argument does not work in continuous time. In discrete time the argument is that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{j\omega n}=e^{j(\omega+2\pi)n},\qquad n\in\mathbb{Z}\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is true because by definition &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is an integer. In continuous time we generally have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{j\omega t}\neq e^{j(\omega+2\pi)t},\qquad t\in\mathbb{R}\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is a real variable. Eq. &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; only holds with equality for integer &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, but not for all other values of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; (which would be necessary for &lt;span class=&quot;math-container&quot;&gt;$e^{j\omega t}$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;-periodic).&lt;/p&gt;&#xA;&lt;p&gt;But the fundamental reason why the DTFT is periodic is the fact that we deal with sequences, and if we assume that the sequence is the result of sampling a continuous-time signal, then it becomes obvious that different continuous-time signals can result in the same sampled sequence. E.g., take a continuous-time cosine&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x(t)=\cos(2\pi f_0 t)\tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we sample &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; at instances &lt;span class=&quot;math-container&quot;&gt;$nT=n/f_s$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$f_s$&lt;/span&gt; is the sampling frequency:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x[n]=\cos(2\pi f_0 nT)=\cos(2\pi n f_0/f_s)\tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I leave it as an exercise to you to show that the frequencies &lt;span class=&quot;math-container&quot;&gt;$f_0=f_s-\Delta f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f_0=f_s+\Delta f$&lt;/span&gt; (with some &lt;span class=&quot;math-container&quot;&gt;$\Delta f&amp;gt;0$&lt;/span&gt;) result in the same sequence &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;. This phenomenon is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow noreferrer&quot;&gt;aliasing&lt;/a&gt;. This means that frequencies above &lt;span class=&quot;math-container&quot;&gt;$f_s/2$&lt;/span&gt; (also called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nyquist frequency&lt;/a&gt;) cannot be distinguished from the corresponding frequencies below the Nyquist frequency. That's why the DTFT is periodic. There cannot be any new spectral information outside the frequency interval &lt;span class=&quot;math-container&quot;&gt;$[-f_s/2,f_s/2]$&lt;/span&gt;. If you haven't learned it yet, check out the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;sampling theorem&lt;/a&gt;, which will also help you understand the nature of spectra of discrete-time signals.&lt;/p&gt;&#xA;&lt;p&gt;Also have a look at &lt;a href=&quot;https://dsp.stackexchange.com/a/29126/4298&quot;&gt;this answer&lt;/a&gt; to a related question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2021-05-02T14:45:03.530" LastActivityDate="2021-05-02T14:45:03.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29135" PostTypeId="2" ParentId="29125" CreationDate="2016-03-01T12:39:08.890" Score="1" Body="&lt;p&gt;It is hard to answer your question, since you do not seem to have experience with EEG data and/or general signal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say, your data is sampled at 200 Hz, which seems good to me for EEG data. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What does it mean by sampling in EEG data? &#xA;That means, that the (continous) EEG signal is choped up into discrete values. This is always necessary for further signal processing with computers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I am getting the sample rate and the frequency when I plot the data as shown below. Shouldn't it be the time and frequency?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I don't know what you mean by &lt;em&gt;I am getting the sample rate and the frequency when I plot the data&lt;/em&gt;. You certainly don't. The sampling rate/frequency is a fixed number given by your experimental hardware. You don't get it from your data - you have to know it from your experiment to get meaningful results from your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also don't know what &lt;em&gt;Shouldn't it be the time and frequency?&lt;/em&gt; means. Your EEG data is certainly a voltage signal over time, hence you have a signal in time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your sampling rate is given from your experimental settings and is 200 Hz as you say. Hence, each time point is separated by $$\Delta t = \frac{1}{f} = \frac{1}{200\,\textrm{Hz}} = 5\,\textrm{ms}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your total signal that you have plotted is therefore $$4097 \times 5\times 10^{-3}\textrm{s} = 20.485\,\textrm{s}$$&#xA;long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is what you know from your data. &lt;strong&gt;Any&lt;/strong&gt; further data extraction is up to you or your research question. If you'd like to get the frequencies that are in the signal, try to Fourier-transform it and extract the frequency region that you are interested in. As I see it, you have some apparent frequency components at approx. 13.4 Hz, 57.7 Hz, 81.0 Hz, and 88.0 Hz. Probably you are only interested in the lower spectrum around 13.4 Hz...&lt;/p&gt;&#xA;" OwnerUserId="19501" LastEditorUserId="19501" LastEditDate="2016-03-01T12:44:38.030" LastActivityDate="2016-03-01T12:44:38.030" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29136" PostTypeId="1" AcceptedAnswerId="29181" CreationDate="2016-03-01T13:08:47.260" Score="2" ViewCount="5443" Body="&lt;p&gt;In the &lt;span class=&quot;math-container&quot;&gt;$\rm DTFT$&lt;/span&gt; (Discrete Time Fourier Transform) the spectrum is periodic with a period of &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; . A continuous signal when sampled has a spectrum which is a repeated version of its original spectrum before sampling with a period equal to the sampling frequency. Both have periodic spectra and both are discrete in nature.&lt;/p&gt;&#xA;&lt;p&gt;When we sample a continuous signal, its values at &lt;span class=&quot;math-container&quot;&gt;$nT$&lt;/span&gt; are multiplied by impulse fn. But in discrete aperiodic signal it is of finite height (where impulse has infinite height)&lt;/p&gt;&#xA;&lt;p&gt;Question is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can both signals be considered similar because their spectra are having a kind of similarity?&lt;/li&gt;&#xA;&lt;li&gt;Is there any application for the above observation?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11809" LastEditorUserId="4346" LastEditDate="2022-08-17T15:14:35.330" LastActivityDate="2022-08-17T15:14:35.330" Title="Relation between the DTFT and the spectrum of a sampled signal" Tags="|fourier-transform|frequency-spectrum|sampling|dtft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29138" PostTypeId="1" AcceptedAnswerId="29140" CreationDate="2016-03-01T13:49:52.360" Score="1" ViewCount="798" Body="&lt;p&gt;I am unable to understand the &lt;strong&gt;discrete wavelet transform&lt;/strong&gt; on images. I followed Robi Polikar's tutorial and got a brief idea about the theory. But I'm unable to understand w.r.t images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Matlab's &lt;code&gt;ndwt2('chess.jpg', 2, 'haar')&lt;/code&gt; function on the chess board , I obtained the other 7 images in the album. (Link to the album given in the end)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ndwt2()&lt;/code&gt; returns a structure, whose member &lt;code&gt;dec&lt;/code&gt; contains the &lt;strong&gt;approximation (A), horizontal (H) , vertical (V) and diagonal (D)&lt;/strong&gt; details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where I have problem. What does &lt;strong&gt;A, H, V and D details&lt;/strong&gt; of the image mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, how come is 1st image in the album approximation of the chessboard (assuming approximation means a rough estimate of the image) ? It just has lines where the borders of chess boxes are there. How is that an approximation, or have I understood it wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was doing the mistake of converting the datatype of image returned by &lt;code&gt;ndwt2&lt;/code&gt; (which is the &lt;code&gt;double&lt;/code&gt; datatype) to &lt;code&gt;uint8&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SHajj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;these&lt;/a&gt; are the images that I now get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does H details image contains some V details also, though the V in H are noisy? Same for V, it also contains some H details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was not the case previously, there H had exclusively vertical lines, V had only horizontal details, D was blank.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sWLEE.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;previous album&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19265" LastEditorUserId="19265" LastEditDate="2016-03-02T06:52:14.533" LastActivityDate="2016-03-02T06:52:14.533" Title="Discrete wavelet transform" Tags="|image-processing|wavelet|transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29139" PostTypeId="2" ParentId="22488" CreationDate="2016-03-01T14:58:57.843" Score="0" Body="&lt;p&gt;Here is my understanding of these points. I apologize if my answer comes too late. I post it anyway in the hope it helps someone.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The 4 parameters in the &lt;em&gt;param&lt;/em&gt; vector respectively controls the radial width, radial location, angular width, and angular location of the filter in the Fourier domain. In other words, the filter's response is a (separable) Gaussian function of the frequency modulus and orientation (that is, the polar coordinates). The parameters #2 and #4 gives the location of this Gaussian while parameters #1 and #3 gives its scale. However, I have no explanation regarding the &quot;magic&quot; values (maybe they were simply obtained by trial &amp;amp; error).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;These filters are not Gabor filters since their Fourier transforms are not Gaussian functions of the 2D frequencies. On the figure you showed, Gabor filters would result in ellipsoid curves instead of these drop-shaped curves. I guess the authors made this choice to have a better coverage of the spectral plane.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19815" LastActivityDate="2016-03-01T14:58:57.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29140" PostTypeId="2" ParentId="29138" CreationDate="2016-03-01T15:51:56.550" Score="3" Body="&lt;p&gt;One can implement the standard discrete wavelet transform (DWT) on an image (&lt;code&gt;dwt2&lt;/code&gt; in Matlab) with a series of filtering and decimation operations, on the rows and the columns. And the  wavelet by itself results from the iteration at different levels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start with the Haar wavelet. In 1D, it can be implemented by a series of sums and differences ($[1,1]$ and $[1,-1]$ filter) on $2$-pixel sets. If you combine these two filters on the rows and the colums, you get $4$ possible combinations. They are illustrated in the four $2\times 2$ matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5HbXk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5HbXk.png&quot; alt=&quot;One level wavelet decomposition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So take the small $2\times 2$ block from the hat (left image). If you sum the pixels on the rows and the columns, you globally sum all four pixels. That gives you the top-left cyan on the right image. If you repeat the process on all  $2\times 2$ blocks, you get the top-left small image, often called the approximation at level 1 (A1). If you apply $[1,-1]$ on the rows, and sum the columns, you get the top-right small image. The difference along the rows detect some vertical details, as you can see (more or less vetical edges). It is called vertical details at level 1 (V1). Now, if you apply $[1,-1]$ on the columns, and sum the rows, you get the bottom-left small image, which detects &#xA;some more of less horizontal  details, called H1. The bottom-left small image computes differences on both rows and columns. It is called D1 for diagonal, though it is not very precise, in general, at detecting $\pm 45°$ edges. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There, you have A, H, V and D. A standard DWT further  decomposes the small top-left image. With the same reasoning, you get approximation, vertical, horizontal and &quot;diagonal&quot; details at a second level (the $2$ in your comand):A2, D2, H2, V2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since A1 has been decomposed, you are left with A2, V2, H2, D2,  V1, H1 and D1, hence $7$ images. With the DWT, those  images are smaller (by $4 \times 4$ and $2 \times 2$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, we have taken separate original $2 \times 2$ blocks. Another word for it is decimation, by $2$, after each filter pass. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wiht &lt;code&gt;ndwt2&lt;/code&gt;, the main difference is that you do not decimate, it is like taking blocks with overlap. So, normally, the A, V, H, D images look about the same, except they have almost the same size as the original (up to border effects and extension).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am surprised by the apprroximation you show. Indeed, I believe there is a read or format issue with it. Open it with an image editor, save it again an a new JPG or PNG seems to fix the problem.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-01T15:51:56.550" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29141" PostTypeId="2" ParentId="29106" CreationDate="2016-03-01T16:27:19.603" Score="1" Body="&lt;p&gt;Basic Fourier theory: you appear to have multiplied your signal with &lt;code&gt;+1 -1 +1 -1 +1 -1&lt;/code&gt;. This is a very high frequency wave, at precisely the Nyquist frequency in fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The energy at the Nyquist Frequency is stored in your last FFT bin. And you wouldn't be the first programmer to have a one-off error, especially since the DFT has a rather odd number of bins: A 1024 point real FFT produces 513 (N/2 &lt;strong&gt;+1&lt;/strong&gt;) bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't spot an immediate cause in your C+ code, but the pattern is mathematically clear at least.&lt;/p&gt;&#xA;" OwnerUserId="21" LastActivityDate="2016-03-01T16:27:19.603" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29142" PostTypeId="2" ParentId="29106" CreationDate="2016-03-01T17:04:00.487" Score="2" Body="&lt;p&gt;I am not fully sure about your code, but swapVectorWithIn() does shift your input vector by half of its lengths (or in Fourier terms: It shifts the spectrum so that the DC component is in the middle of the spectrum and not on the left side).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output you show comes from doing an FFT, bringing the DC component to the middle of the spectrum, and doing an inverse FFT, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is true, than your algorithm works perfectly normal. Have a look at the Fourier-Shift-Theorem: A shift in one domain results in a linear phase in the other domain. Your shift is in the frequency domain, hence you can expect a linear phase variation in the time domain. The sign alternation is a result from a 0°-180°-0°-180°-... modulation, which is correlated to the amout of shifting in the frequency domain. And since 180° corresponds to a  multiplication by -1, you get this patterin in your data. Try shifting it not by half of the length, but by a quarter. Then your alternation pattern should be 0°-90°-180°-270°-0° = 1-i-(-1)-(-i)-... multiplication of your input data, if I get that right right now.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-01T17:04:00.487" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29143" PostTypeId="1" AcceptedAnswerId="29159" CreationDate="2016-03-01T17:24:32.303" Score="5" ViewCount="2935" Body="&lt;p&gt;I'm trying to figure out a way to construct (numerically) time series of random variables given some spectral density $S_{xx}(f)$. I'm interested in various types of spectral densities (flat, lorentzian, 1/f) so if there is a general method that starts from an expression of $S_{xx}(f)$ and generates a suitable time series that would be ideal of course, but I am not sure if there is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Honestly I am not so sure where to start. My guess is that you compose your random signal as a sum of different components with amplitudes related to your spectral density at a certain frequency. I understand that if you want your noise to have a complete frequency range you need infinitely many terms, so I suppose you cut off your noise at some frequency $f_{max}$, giving you some maximum amount of terms $K$. You'll also need some step size $\Delta f$ for the different frequency components, but after that I get kind of stuck. How do you incorporate your spectral density into this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that the question is perhaps a bit too general, so I'm also very much interested in advice on some sources on the subject. The ones I have been able to find are very technical, while for now I'm simply trying to create some time series in Mathematica given some spectral density as input, after which I want to see if I can reconstruct the spectral density from the output. That would get me started quite well, and I can think about what features are essential from there on.&lt;/p&gt;&#xA;" OwnerUserId="8593" LastActivityDate="2024-03-06T23:18:20.030" Title="Numerically generating noise time series from spectral density" Tags="|noise|power-spectral-density|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29144" PostTypeId="1" CreationDate="2016-03-01T17:58:09.853" Score="2" ViewCount="1023" Body="&lt;p&gt;I'm  looking for a tool\method which allows me to design a filter without involving the frequency response at all.&lt;br&gt;&#xA;Specifically, I'm trying to design a simple FIR smoothing filter for an emmbedded system which reads different analog sensors. My sampling rate is 1kHz and I'd like to generate an FIR filter with 0-overshoot and a smoothing effect (e.g. in attached pic).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Qd4i7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qd4i7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The different tools I found (including MATLAB) all involved a design around a LP filter, which means I have to analyze the frequency response of my system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any relevant tools\methods out there? &lt;/p&gt;&#xA;" OwnerUserId="19818" LastActivityDate="2018-11-14T17:24:25.953" Title="Filter Design - Step Response" Tags="|filters|real-time|digital-filters|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29145" PostTypeId="2" ParentId="29144" CreationDate="2016-03-01T19:13:30.430" Score="3" Body="&lt;p&gt;For linear filters, &lt;a href=&quot;http://www.doc.ic.ac.uk/~wl/papers/bf95.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;binomial filters&lt;/a&gt;, which can be considered as FIR approximation to Gaussians, are very simple. Their coefficients are given by:&#xA;$$ h_k=\frac{ \binom{n}{k}}{2^n} \,.$$&#xA;For instance, you can get $H_3 = [ \frac{1}{4},\frac{1}{2},\frac{1}{4}]$, or $H_5 = [ \frac{1}{16},\frac{1}{4},\frac{3}{8},\frac{1}{4},\frac{1}{16}]$. Since their coefficients are positive, they do not overshoot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are graphs for $n = 5,17,25,31$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qxp0U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qxp0U.png&quot; alt=&quot;Step responses&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Savitzky-Golay filters, performing polynomial interpolation, are interesting too, but tend to   overshoot with higher degrees. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do not fool yourself though: as long as the filters are linear, there is a notion of frequency very close behind.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-03-02T15:09:45.877" LastActivityDate="2016-03-02T15:09:45.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29146" PostTypeId="1" AcceptedAnswerId="29148" CreationDate="2016-03-01T19:26:20.327" Score="4" ViewCount="1073" Body="&lt;p&gt;Basically my question is the same as the title: Are the 4 types of linear phase FIR filters the only linear phase FIR filters one can come up with? And if so, then why? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm pretty sure that they are the only ones but I really can't explain why. Can someone articulate it clearly?&lt;/p&gt;&#xA;" OwnerUserId="19775" LastActivityDate="2016-03-01T21:19:28.033" Title="Are the 4 types of linear phase FIR filters the only linear phase FIR filters one can come up with?" Tags="|filters|finite-impulse-response|linear-phase|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29147" PostTypeId="2" ParentId="29144" CreationDate="2016-03-01T19:28:30.147" Score="1" Body="&lt;p&gt;Designing an FIR filter with a given step response is very easy. Since&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[n]=\sum_{k=-\infty}^nh[k]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a[n]$ is the step response, and $h[n]$ is the impulse response, the impulse response can be obtained from the given step response by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n]=a[n]-a[n-1]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a causal filter, you have $a[-1]=0$ as initial condition for the recursion $(2)$. So you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[0]=a[0]\\h[1]=a[1]-a[0]\\h[2]=a[2]-a[1]\\\vdots$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-01T19:28:30.147" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29148" PostTypeId="2" ParentId="29146" CreationDate="2016-03-01T19:39:10.297" Score="4" Body="&lt;p&gt;It can be shown that in order for an FIR filter to have linear phase, its impulse response must be symmetric or anti-symmetric. The impulse response length $L$ can be either odd or even. Those two variables lead to 4 combinations, hence the 4 types of linear-phase filters.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="90" LastEditDate="2016-03-01T21:19:28.033" LastActivityDate="2016-03-01T21:19:28.033" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29149" PostTypeId="2" ParentId="28824" CreationDate="2016-03-01T20:29:33.960" Score="0" Body="&lt;p&gt;If you apply a linear differentiation operator, i. e. satisfying &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linear system&lt;/a&gt; axioms (the standard derivatives are linear, but in some cases, to limit noise influence, for instance in image processing, non-linear derivative schemes are used), and the filter (or kernel) $h $ is linear too, they &quot;should&quot; commute. In other words:&#xA;$$ \frac{\partial}{\partial t} (h \star x) = \left(\frac{\partial}{\partial t} h \right) \star x  \,.$$&#xA;In practice, doing both operations successively:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/3Ifjn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Ifjn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;does the same as performing the two operations simultaneously:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/4o4aY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4o4aY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;yields the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @Jazzmaniac said, an implemetation might yield slight difference, for instance at both ends of the signal, especially with IIR filters (or IIR derivatives). Indeed, they assume what the signal could be on the left and the right. Filtering then differentiating is generally safer. However, when the signal is almost flat on the border, but non-zero, differentiating it might flatten it to zero, providing an effect similar to apodization, resulting in smaller IIR overshoot at the ends.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-01T20:29:33.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29150" PostTypeId="2" ParentId="29136" CreationDate="2016-03-01T20:34:57.853" Score="2" Body="&lt;p&gt;The relationship between an analog (continuous-time) signal $x_a(t)$ sampled uniformly at $t = nT$ to its discrete-time signal $x(n)$ and their spectrum relationship is:&#xA;\begin{align}x(n)&amp;amp;=x_a(nT), \quad-\infty \leq n\leq \tag{1}\infty\\X(F)&amp;amp;=F_s\sum_{k=-\infty}^\infty X_a(F - kF_s)\tag{2}\end{align}  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With: $T = \frac 1{F_s} \Rightarrow t=nT=\frac{n}{F_s}$. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can both signals be considered similar because their spectra are&#xA;  having a kind of similarity?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Clearly one is continuous time, whilst the other discrete time. They are equal only at those discrete and uniformly sampled times $t=nT$; or $x(n) \ne x_a(nT)$ when $t\ne nT$. Put another way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n) = \begin{cases}&#xA;x_a(nT), &amp;amp;\text{ if } t=nT,  (\text{ with } n \in \mathbb Z) \\[2ex]&#xA;\text{undefined}, &amp;amp; \text{elsewhere} \tag{3}\\&#xA; \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain, and with no &lt;a href=&quot;https://en.wikipedia.org/wiki/Aliasing&quot; rel=&quot;nofollow&quot;&gt;aliasing&lt;/a&gt;, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_a(F) = \begin{cases}&#xA;\frac{1}{F_s}X(F), &amp;amp;\left|F\right|\leq \frac{F_s}{2}\\[2ex]&#xA;0, &amp;amp;\left|F\right| &amp;gt; \frac{F_s}{2}\tag{4}\\&#xA; \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any application for the above observation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is the basis of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;Sampling theorem&lt;/a&gt; and reconstruction. That is, if $x_a(t)$ is band-limited with $B\text{ Hz}$ the highest frequency, it can be uniquely recovered from its samples if $F_s \geq B$. So, from $(2)$, a lowpass filter of gain $T$  with cutoff frequency $F_c &amp;gt; B$ is used to remove the spectral periodicity to get the spectrum of the continuous-time signal. You may have a look at interpolation in $\rm DACs$, this happens there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The relationship between the sampled signal $x(n)$ and the discrete aperiodic signal $x_a(nT)$ is none other that the relationship in equation $(3)$. And this is by definition: Sampling uniformly the function $x_a(t)$ at $t=nT$, or: $$x(n) \triangleq x_a(nT)\tag{5}$$&#xA;You don't have a different/separate signal $x(n)$ you're trying to equate to $x_a(nT)$, no. You have $x_a(t)$ and &quot;extract&quot; $x(n)$ by ideal continuous-time-to-discrete-time conversion as defined in equation $(3)$. So, by definition in the equality in equation $(5)$ we're talking about an &lt;strong&gt;ideal&lt;/strong&gt; conversion of a continuous-time signal to a discrete-time signal. In practice this involves $\rm ADCs$, that's another story.&lt;/li&gt;&#xA;&lt;li&gt;The spectrum of $x_a(t)$ (in its continuous form) given by the $\rm CTFT$ is a continuous aperiodic function of frequency: $$\displaystyle X_a(F) = \int_{-\infty}^{\infty}x_a(t)e^{-j2\pi Ft}dt, \quad -\infty\leq F\leq \infty\tag{6}$$&lt;/li&gt;&#xA;&lt;li&gt;The spectrum of $x(n)$, &lt;strong&gt;obtained by sampling uniformly&lt;/strong&gt; $x_a(t)$, given by the $\rm DTFT$ is a continuous and periodic function of $\omega$ with period $2\pi$:&#xA;$$\displaystyle X(\omega) = \sum_{n=-\infty}^{\infty}x(n)e^{-j\omega n}, \quad -\infty\leq n\leq \infty\tag{7}$$&lt;/li&gt;&#xA;&lt;li&gt;With the relation $t = \frac{n}{F_s}$, equation $(5)$, and inverse transform $(6)$:&#xA;$$\displaystyle x(n) \equiv x_a(nT)= \int_{-\infty}^{\infty}X_a(F)e^{j2\pi nF/F_s}dF\tag{8}$$&lt;/li&gt;&#xA;&lt;li&gt;With the uniform sampling, you have the following relationship with frequency variables: &#xA;$$\omega = 2\pi f = 2\pi \frac{F}{F_s}\tag{9}$$&#xA;The periodicity of $2\pi$ in $\omega$, or chunks of $\left[-\pi, \pi\right]$, is equivalent to a periodicity of $F_s$ in $F$, or chunks of $\left[-\frac{F_s}{2}, \frac{F_s}{2}\right]$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-03-02T21:22:38.457" LastActivityDate="2016-03-02T21:22:38.457" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29151" PostTypeId="2" ParentId="29094" CreationDate="2016-03-01T20:57:52.590" Score="1" Body="&lt;p&gt;I think you are seeking for an algorithm but this may help. If you don't know how $ s $ is distributed but you know its moments of first and second order, you can try with the linear estimator of the linear Minimum-mean Square Error (lmmse), with the following form,&#xA;$$&#xA;\hat{s}(y) = ay + b&#xA;$$&#xA;with&#xA;$$&#xA;a = \frac{ \mathrm{C}_{xy} }{ \sigma_{y}^{2} } \\&#xA;b = m_{s} - am_{y}&#xA;$$&#xA;where $ m $ denotes mean, $ \sigma $ variance and $ C $ covariance. It would help to know the moments of the noise, I mean, for example if is zero-mean and normalized to unity.&lt;/p&gt;&#xA;" OwnerUserId="18045" LastEditorUserId="18045" LastEditDate="2016-03-01T21:08:10.637" LastActivityDate="2016-03-01T21:08:10.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29152" PostTypeId="2" ParentId="29146" CreationDate="2016-03-01T21:18:57.667" Score="2" Body="&lt;p&gt;The answer by @Jason R is short and perfect. Just adding a pictorial version, from Openstax: &lt;a href=&quot;https://cnx.org/contents/MuhmqM-3@3/Four-Types-of-Linear-Phase-FIR&quot; rel=&quot;nofollow noreferrer&quot;&gt;Four types of linear-phase FIR filters&lt;/a&gt;:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/HTfUZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HTfUZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more text, I suggest the short text &lt;a href=&quot;http://eeweb.poly.edu/iselesni/EL713/zoom/linphase.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linear-Phase FIR Filters&lt;/a&gt;, by Ivan Selesnick.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-01T21:18:57.667" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29153" PostTypeId="1" AcceptedAnswerId="29369" CreationDate="2016-03-01T21:25:43.680" Score="3" ViewCount="371" Body="&lt;p&gt;I am trying to extrapolate the bearing of a vehicle using GPS and a gyroscope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To this end, I first obtain the yaw component using gyroscope readings and the (known) yaw axis of the vehicle, then integrate the result over time and add it to the previous bearing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have implemented a real-time visualization of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the direction of the vehicle yaw axis&lt;/li&gt;&#xA;&lt;li&gt;the direction of the rotation vector reported by the gyroscope&lt;/li&gt;&#xA;&lt;li&gt;raw GPS bearing&lt;/li&gt;&#xA;&lt;li&gt;extrapolated bearing&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;About half of the time this works very well: the extrapolated bearing smoothly moves as the vehicle turns, and the GPS (which updates a second later) aligns with it almost perfectly. The other half of the time the gyroscope seems to suffer from bias, causing the extrapolated bearing to drift even when the vehicle is stationary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The visualization shows me that the gyroscope rotation vector changes direction at random as long as I'm not suffering from the bias problem and the vehicle is not turning (indicating I'm getting something close to white noise from the gyroscope, which is what I'd expect). When the bias problem occurs, the gyroscope direction remains constant, corroborating my suspicion that I'm suffering from bias.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the assumption that a vehicle will never turn in the same direction for more than about 1–4 minutes, and on the observation that bias comes and goes at longer intervals (several minutes), I tried using a highpass filter to eliminate bias. I used a 5th-order Butterworth filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With an initial cutoff frequency of $\frac{1}{240} \text{Hz}$ (corresponding to a 4-minute period), when I rotate the device by 90° at roughly $\frac{\pi}{2} \frac{\text {rad}}{\text s}$, as soon as the rotation stops, the bearing drifts in the opposite direction. I then started working downward from there: at $\frac{1}{1800} \text{Hz}$ (a half-an-hour period) the effect was still visible but much weaker, and at $\frac{1}{3600} \text{Hz}$ (one hour) it was virtually gone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A real-world test at $\frac{1}{3600} \text{Hz}$, however, still resulted in random bias, &lt;del&gt;of an even greater magnitude than what I'd experienced with raw values&lt;/del&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then tried increasing the frequency to $\frac{1}{15} \text{Hz}$ and noticed I am likely suffering from overshoot, as the bearing now bounces back and oscillates around a certain value somewhere between the old and the new bearing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then went back to the original $\frac{1}{240} \text{Hz}$ and experimented with the filter order and characteristics: First I tried a 1st-order Butterworth filter, then a 5th-order Bessel filter – to no avail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where's the error here, and how can I elimiate bias without introducing any other, even less desirable artifacts?&lt;/p&gt;&#xA;" OwnerUserId="19821" LastEditorUserId="19821" LastEditDate="2016-03-11T08:52:02.837" LastActivityDate="2017-02-05T00:29:37.063" Title="Filtering out low-frequency bias" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29154" PostTypeId="2" ParentId="24900" CreationDate="2016-03-01T21:31:30.997" Score="2" Body="&lt;p&gt;The idea of complex cell layer is to &quot;pool&quot; a set of simple cells and acquire the same data from those simple cells (e.g invariant translation, rotation invariant, etc). One nice illustration is the computational model of Neocognitron  &lt;a href=&quot;https://youtu.be/Qil4kmvm2Sw?t=6m9s&quot; rel=&quot;nofollow&quot;&gt;https://youtu.be/Qil4kmvm2Sw?t=6m9s&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the example of translating 2x2 and 3x3 matrix by one pixel in deeplearning.net, I think one possible explanation is that the Pooling map &lt;strong&gt;returns&lt;/strong&gt; the same value for the subsequent Convolution map. Considering the following 4x4 image with our significant data in 2x2 region (row = 2, col = 2) to (3,3):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0 0 0 0 &lt;br&gt;&#xA;0 &lt;strong&gt;1&lt;/strong&gt; &lt;strong&gt;6&lt;/strong&gt; 0 &lt;br&gt;&#xA;0 &lt;strong&gt;2&lt;/strong&gt; &lt;strong&gt;3&lt;/strong&gt; 0 &lt;br&gt;&#xA;0 0 0 0 &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Max-Pooling map always look at the region (2,2) and (3,3) and it returns 6. If our data were translated (moved) one pixel, there would be 8 different ways to do that. Among those there are 3 ways that keep region ((2,2); (3,3)) has 6 as the maximum value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;drow = 1, dcol = 0 &lt;br&gt;&#xA;0 0 0 0 &lt;br&gt;&#xA;0 0 0 0 &lt;br&gt;&#xA;0 &lt;strong&gt;1&lt;/strong&gt; &lt;strong&gt;6&lt;/strong&gt; 0 &lt;br&gt;&#xA;0 &lt;strong&gt;2&lt;/strong&gt; &lt;strong&gt;3&lt;/strong&gt; 0 &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;drow = 0, dcol = -1 &lt;br&gt;&#xA;0 0 0 0 &lt;br&gt;&#xA;&lt;strong&gt;1&lt;/strong&gt; &lt;strong&gt;6&lt;/strong&gt; 0 0 &lt;br&gt;&#xA;&lt;strong&gt;2&lt;/strong&gt; &lt;strong&gt;3&lt;/strong&gt; 0 0&lt;br&gt;&#xA;0 0 0 0 &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;drow = 1, dcol = -1 &lt;br&gt;&#xA;0 0 0 0 &lt;br&gt;&#xA;0 0 0 0 &lt;br&gt;&#xA;&lt;strong&gt;1&lt;/strong&gt; &lt;strong&gt;6&lt;/strong&gt; 0 0 &lt;br&gt;&#xA;&lt;strong&gt;2&lt;/strong&gt; &lt;strong&gt;3&lt;/strong&gt; 0 0&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, if our data is represented by the maximum value then the recognition will work for all those 3 cases. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When applying the same translation process (by 1 pixel) for 3x3 matrix &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 2 3 &lt;br&gt;&#xA;4 5 6 &lt;br&gt;&#xA;7 8 9 &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The the maximum value at the corner (1, 3, 7, 9) will be retained in 3 translations, the value in the middle of each edge (2, 4, 6, 8) will be retained in 5 translations. The simple cells are responsible for line/edge detection, so probably the center position (5) is left out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's how I understand translation invariance. I'm not completely sure though, since the author stated that &quot;[...]produce exactly the same output at the convolutional layer.&quot; It would be great if the author of deeplearning.net could explain a bit more on that.&lt;/p&gt;&#xA;" OwnerUserId="19822" LastActivityDate="2016-03-01T21:31:30.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29155" PostTypeId="1" AcceptedAnswerId="29160" CreationDate="2016-03-01T22:23:43.053" Score="0" ViewCount="75" Body="&lt;p&gt;Can I find the inverse $\mathcal Z$-transform of this transfer function: $$H(z)=\frac{1}{1-\alpha z^{-8}}$$&#xA;in a way other than contour integration and finding the residues of the 8 poles?&#xA;If so, how? &lt;/p&gt;&#xA;" OwnerUserId="19775" LastEditorUserId="1629" LastEditDate="2016-03-02T05:19:53.383" LastActivityDate="2016-03-02T11:51:51.940" Title="Inverse $\mathcal Z$-transform of system with an 8th order pole" Tags="|linear-systems|z-transform|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29156" PostTypeId="1" AcceptedAnswerId="29500" CreationDate="2016-03-01T22:36:05.820" Score="2" ViewCount="6596" Body="&lt;p&gt;I am using OpenCV to blend a set of pre-warped images. As input I have some 4-channel images (*.png or *.tif) from where I can extract a bgr image and an alpha mask with the region related to the image (white) and the background (black). Both image and mask are the inputs of the Blender module &lt;code&gt;cv::detail::Blender::blend&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use feather (alpha) blending the result is ok, however, I would like to avoid ghosting effects. When I use multi-band, some artifacts are appearing on the edges of the images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Emg0j.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Emg0j.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is similar to the one raised &lt;a href=&quot;https://dsp.stackexchange.com/questions/3082/blending-artifacts-in-photo-stitching&quot;&gt;here&lt;/a&gt;, and solved &lt;a href=&quot;https://dsp.stackexchange.com/questions/6362/blurring-non-uniform-areas&quot;&gt;here&lt;/a&gt;. The thing is, if the solution is creating a binary mask (that I already extract from the alpha channel), it does not work for me. If I add padding to the ovelap between both images, it takes pixels from the background and messes up even more the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that probably it has to do with the functions &lt;code&gt;pyrUp&lt;/code&gt; and &lt;code&gt;pyrDown&lt;/code&gt;, because maybe the blurring to create the Gaussian and Laplacian pyramids is applied to the whole image, and not only to the positive alpha region. In any case, I don't know how to fix the problem using these functions, and I cannot find another efficient solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use another implementation of multiresolution blending, it works perfectly, however, I am very interested in integrating the multi-band implementation of OpenCV. Any idea of how to fix this issue?&lt;/p&gt;&#xA;" OwnerUserId="19397" LastEditorUserId="15347" LastEditDate="2019-08-19T07:19:47.577" LastActivityDate="2019-08-19T07:19:47.577" Title="Blending artifacts in OpenCV image stitching" Tags="|image-processing|opencv|blur|multi-scale-analysis|stitching|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29159" PostTypeId="2" ParentId="29143" CreationDate="2016-03-02T04:05:40.640" Score="7" Body="&lt;p&gt;As mentioned by @MBaz in comments, you could use the fact that filtering white noise with unitary power spectral density (for example from independent Gaussian samples zero mean and unitary standard deviation) with a filter having a frequency response $H(f)$ gives you colored noise with power spectral density $S_{xx}(f) = |H(f)|^2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then comes the question of designing such a filter. A flexible approach would be to use a Frequency sampling-based FIR filter design. Note that this is readily available as &lt;a href=&quot;https://reference.wolfram.com/language/ref/FrequencySamplingFilterKernel.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;FrequencySamplingFilterKernel&lt;/code&gt;&lt;/a&gt; in Mathematica (or similarly &lt;code&gt;fir2&lt;/code&gt; in matlab for future readers), using an evenly spaced sampling of $|H(f)| = \sqrt{S_{xx}(f)}$ up to the Nyquist frequency (i.e. $f_{max}$ which would correspond to half your time-domain sampling rate). Once you have the FIR filter coefficients, you can use those to filter your white noise with &lt;code&gt;ListConvolve&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the steeper the slopes in your power spectral density, the more frequency samples (resulting in a higher number of FIR filter coefficients) you'll need to get an accurate representation of your power spectral density. &lt;/p&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="8952" LastEditDate="2016-03-02T20:42:36.473" LastActivityDate="2016-03-02T20:42:36.473" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="29160" PostTypeId="2" ParentId="29155" CreationDate="2016-03-02T07:54:56.927" Score="1" Body="&lt;p&gt;Applying the geometric series directly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;H(z) = \frac{1}{1-\alpha z^{-8}} = \sum_{n=0}^{\infty}(\alpha z^{-8})^n = \sum_{n=0}^{\infty}\alpha^n z^{-8n}&#xA;$$&#xA;If $h_n = \mathcal Z^{-1}\{H(z)\}$, then&#xA;$$&#xA;h_n = \begin{cases}&#xA;a^{n/8} \; , \;  \text{n is multiple of 8} \\&#xA;0 \; , \; \text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="4298" LastEditDate="2016-03-02T11:51:51.940" LastActivityDate="2016-03-02T11:51:51.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29161" PostTypeId="1" CreationDate="2016-03-02T11:59:31.060" Score="1" ViewCount="48" Body="&lt;p&gt;I'm currently working in a Lolipop LBP cascade detector using OpenCV. The training is correctly done and the cascade classifier detects the sticks of the Lolipops correctly but with some minor errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s7jVu.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s7jVu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to obtain a &quot;level of trust&quot; or an index of how many features had been detected during the cascade detection process?&lt;/p&gt;&#xA;" OwnerUserId="18589" LastEditorUserId="18589" LastEditDate="2016-03-02T15:51:00.560" LastActivityDate="2016-03-02T15:51:00.560" Title="Get level of wellness in a cascade classifier using LBP" Tags="|opencv|classification|local-features|c++|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29163" PostTypeId="1" AcceptedAnswerId="29172" CreationDate="2016-03-02T16:02:16.733" Score="2" ViewCount="808" Body="&lt;p&gt;I have the following signal from a temperature sensor (broadcasts on 433.92 MHz, apparently as ASK).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot for the life of me extract the temperature data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried reading off the bits in so many different ways (mostly by looking at the pulse widths) then searching the data for the temperature info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nU79A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nU79A.png&quot; alt=&quot;pwm signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This corresponds to a temp of 21.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to read each pulse after the first 4 big pulses - that gives 37 bits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1000111110010010110001100011111111000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I tried searching just for the 21 part. So I tried searching for 21, 61, 71 (in case the designer was adding 40 or 50 degrees to avoid negative numbers). I tried searching for the 2 and then the 1 bit shifted by 4. I tried negating all the bits.  I tried searching in reverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible this is not pulse width modulation?  Is it possible there are not 37 bits here?&lt;/p&gt;&#xA;" OwnerUserId="18745" LastEditorUserId="8202" LastEditDate="2016-03-03T08:56:54.577" LastActivityDate="2016-03-03T08:56:54.577" Title="Decoding of binary signal from a temperature sensor" Tags="|signal-detection|" AnswerCount="1" CommentCount="2" ClosedDate="2016-03-04T09:45:54.467" ContentLicense="CC BY-SA 3.0" />
  <row Id="29164" PostTypeId="1" AcceptedAnswerId="29203" CreationDate="2016-03-02T16:04:03.023" Score="-1" ViewCount="227" Body="&lt;p&gt;I know the question has been asked about why it's a bad idea to zero bins in an FFT, but those all seemed to be taking the IFFT afterwards. What if I want to do all my analysis in the frequency domain? Then would it be alright to zero the bins with frequencies i don't care about, and then perform my analysis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to add to that, if I only care about a certain range of frequencies, can I perform the DFT instead of an FFT, but were I'm only calculating the bins that I care about (I believe this should be the same as zeroing out all the other frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, lets say I have a signal sampled at 16000Hz. and the frequency range I care about is between 2000-4000Hz. if I'm taking a 64 point FFT/DFT, then I only care about bins 8-16. Since my signal is real, that should save some time on the DFT (real number multiplied by complex number as opposed to two complex numbers multiplied), and then I just do 9 DFT calculations and forget about the other 55. I think this should be less memory need and should perform the calculation quicker. I think this is right, but I'm probably missing something. Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastActivityDate="2016-03-03T22:16:41.687" Title="Zeroing FFT bins without taking inverse FFT" Tags="|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29165" PostTypeId="1" AcceptedAnswerId="29167" CreationDate="2016-03-02T16:13:50.247" Score="2" ViewCount="4970" Body="&lt;p&gt;I know basics about DSP, and now trying to complete a project on Speech recognition. So I read as many resources as I found, and got some ideas. They are like:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;take a sample sound and break it into small frames&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;calculate MFCC for each frames( 13 of them)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;use DTW to match the testing and template pattern.&lt;/p&gt;&#xA;&lt;p&gt;Now, here are the things I am having trouble with-&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;13 MFCC's for n frames leaves me with 13*n MFCC's. How exactly do I use DTW here?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;DTW gives me a distance between two patterns. How do I determine if they match or not?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19770" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-06-04T18:59:09.940" Title="Speech recognition using MFCC and DTW(Dynamic Time Warping)?" Tags="|speech-recognition|mfcc|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29167" PostTypeId="2" ParentId="29165" CreationDate="2016-03-02T17:36:36.467" Score="2" Body="&lt;p&gt;At the very beginning let me warn you that DTW approach is suitable only for spoken word recognition. Nonetheless it is interesting as a basic exercise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that you have a database of training files (templates) and you already extracted MFCC's for those. Each training file contains one utterance for a given word class, i.e. &quot;Hello&quot;, &quot;Bye&quot;. I also imagine that each class has more than one example (plausible). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what you should do during the recognition stage:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Once you have the recording for the whole word, you calculate the MFCC's for each frame. You want the recording of the whole word, not just part of it.&lt;/li&gt;&#xA;&lt;li&gt;Now you calculate the distance between your recording and each of the templates in your database. In case of DTW you will be calculating the cost between each of 13 dimensional frames (simple distance metric/norm, i.e. Euclidean, Manhattan, etc.). Once the DTW algorithm is finished, you will end up with the distance value (upper right matrix entry as can be seen below) between your test sample and each of the templates.&lt;/li&gt;&#xA;&lt;li&gt;The last step is to make a decision: to which class your test sample actually belongs to? You can either do it by picking the class of template with the minimum DTW distance. But what is even better, you can use the k-Nearest Neighbours for that.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AnO31.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AnO31.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-03-02T17:36:36.467" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29168" PostTypeId="1" CreationDate="2016-03-02T18:10:28.630" Score="0" ViewCount="2828" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZksKl.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an acoustic signal from a Ffowcs Williams Hawkings CFD analysis and would like to convert it to the frequency domain and see the SPL and OASPL. I know I need to use fft() but I am unsure why my plot differs so much from the one from FLUENT.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;time = data{1};&#xA;p = data{2};&#xA;&#xA;Fs = 1/(time(end)-time(end-1));&#xA;L = 0.887*Fs+1;&#xA;N = 2^9;&#xA;Y = fft(p,N);&#xA;&#xA;for k = 1:N/2&#xA;   f(k) = (k-1)*Fs/N;&#xA;end&#xA;spl=20*log10(abs(Y(1:length(Y)/2)));&#xA;semilogx(f,spl,'k','Linewidth',2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19839" LastActivityDate="2017-04-28T12:42:47.167" Title="I have a pressure signal and want to do SPL analysis on it" Tags="|matlab|fourier-transform|acoustics|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29169" PostTypeId="2" ParentId="29168" CreationDate="2016-03-02T18:38:27.660" Score="2" Body="&lt;p&gt;Steps are quite simple:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply the window to your signal&lt;/li&gt;&#xA;&lt;li&gt;Calculate the DFT of your signal&lt;/li&gt;&#xA;&lt;li&gt;Scale the DFT properly (half of spectra and coherent gain)&lt;/li&gt;&#xA;&lt;li&gt;Convert the result to decibel scale with a reference acoustic pressure of $2\cdot 10^{-5} \mathrm{Pa}$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I don't have MATLAB with me right now so here is some Python code.&#xA;Considering 1 kHz sinusoid with amplitude of 1 Pascal (94 dB SPL). Resulting plot:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Usddq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Usddq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/env python&#xA;&#xA;from __future__ import print_function&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;if __name__ == '__main__':&#xA;&#xA;    plt.close('all')&#xA;&#xA;    # Generate 94 dB (Peak) SPL sinusoid&#xA;    fs = 48000&#xA;    duration = 1&#xA;    npts = int(fs*duration)&#xA;    t = np.linspace(0, 2*np.pi, npts)&#xA;    f = 500&#xA;    ref = 2.0e-5 # 20 uPa&#xA;    amp = 1      # 1 Pa -&amp;gt; 94 dB SPL&#xA;    s = amp * np.sin((f*duration) * t)&#xA;&#xA;    # Window signal&#xA;    win = np.hamming(npts)&#xA;    signal = s * win&#xA;&#xA;    sp = np.fft.fft(signal)&#xA;    freq = np.fft.fftfreq(npts, 1.0/fs)&#xA;&#xA;    # Scale the magnitude of FFT by window energy and factor of 2, &#xA;    # because we are using half of FFT.&#xA;    # To obtain RMS values, divide by sqrt(2)&#xA;    sp_mag = np.abs(sp) * 2 / np.sum(win)&#xA;&#xA;    # Shift both vectors to have DC at center&#xA;    freq   = np.fft.fftshift(freq)&#xA;    sp_mag = np.fft.fftshift(sp_mag)&#xA;&#xA;    # Convert to decibel scale&#xA;    sp_db = 20 * np.log10( sp_mag/ref )&#xA;&#xA;    plt.subplot(2,1,1)&#xA;    plt.plot(t, s)&#xA;    plt.xlabel('Time [s]')&#xA;    plt.ylabel('Acoustic pressure [Pa]')&#xA;    plt.grid(True)&#xA;&#xA;    plt.subplot(2,1,2)    &#xA;    plt.semilogx(freq, sp_db)&#xA;    plt.xlim( (0, fs/2)  )&#xA;    plt.ylim( (0, 100))&#xA;    plt.grid(True)&#xA;    plt.xlabel('Frequency [Hz]')&#xA;    plt.ylabel('SPL [dB]')&#xA;    plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="13742" LastEditDate="2016-03-16T08:59:37.467" LastActivityDate="2016-03-16T08:59:37.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29170" PostTypeId="2" ParentId="28135" CreationDate="2016-03-02T18:46:43.590" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Hit-or-miss_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hit-or-Miss transform&lt;/a&gt; as the name suggest uses 2 structuring elements (SE) to identify structures which are specific to the foreground (first SE) and background (second SE).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/hitmiss.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;, you have a good example for corner detection. The only difference is that the two SE are merged into 1: The 1 are part of the foreground SE in order to determine a specific shape in the pattern, and the 0 are part of the background SE. Consequently, the algorithm hits only if all the conditions on the 1 and 0 are respected, else it's a miss.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This principle is mainly used for skeleton computation, but it can be derived to build all the mathematical morphology basic operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are more explanations:&#xA; - &lt;a href=&quot;https://www.youtube.com/watch?v=b87PK29j9m0&quot; rel=&quot;nofollow noreferrer&quot;&gt;A complete video of a class&lt;/a&gt;.&#xA; - &lt;a href=&quot;http://www.math.tau.ac.il/~turkel/notes/hit-or-miss.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Much more examples in this complete lesson&lt;/a&gt;.&#xA; - &lt;a href=&quot;https://stackoverflow.com/questions/17609869/hit-and-miss-transform-in-image-processing&quot;&gt;StackOverflow&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19791" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-04-01T20:36:52.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29172" PostTypeId="2" ParentId="29163" CreationDate="2016-03-02T20:08:38.817" Score="3" Body="&lt;p&gt;It is impossible to extract the correct data from this string with only one sample (as is mentioned by Laurent Duval in the comments). Here is something that caught my eye:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Markers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have these four blocks at the beginning and the end of the signal that are some kind of start/end markers, I suppose. Are you sure that you caught the whole markers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1000111110010010110001100011111111000&lt;/code&gt; could be split up in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1000&#xA;1111&#xA;&#xA;100100101100011000111&#xA;&#xA;1111&#xA;1000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so the &lt;code&gt;1000&lt;/code&gt; and &lt;code&gt;1111&lt;/code&gt; might actually be part of the markers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The temperature itself&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say the signal corresponds to 21.0°, i.e. a number with an accuracy of 0.1°. It &lt;em&gt;could&lt;/em&gt; be that this is encoded as the integer 210. 210 in binary is &lt;code&gt;11010010&lt;/code&gt; and you can find this string (reversed) in there:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;100100101100011000111&#xA;  01001011&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The prefixing &lt;code&gt;10&lt;/code&gt; is 2 in decimal and &lt;em&gt;could&lt;/em&gt; be a 2 bit indicator of the number of 4 bit words that encode the temperature, however this would be strange since the temperature is reversed and the prefix is not...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please try the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure the same temperature multiple times in independent experiments. Is the resulting data string the same in each experiment? Are parts of the string the same in each experiment?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure multiple temperatures that only differ by 0.1°. Is there a corresponding pattern in the data string?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do you have a datasheet of your sensor? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-02T20:08:38.817" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29173" PostTypeId="2" ParentId="29081" CreationDate="2016-03-02T20:49:30.923" Score="2" Body="&lt;p&gt;Discrete time domain comes with its magics and one of the funniest of them out there is the result of the multiplication of an impulse response $h[n]$ by $(-1)^n$, which is equivalent to an alternating version of the original response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key to its understanding comes from a very little effort of converting $(-1)^n$ into a complex exponential and then invoking a fundamental DTFT property, namely: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $x[n]$ has the DTFT of $X(e^{j\omega})$ , then $x[n]e^{j\omega_0 n}$ has the DTFT of $X(e^{j(\omega-\omega_0)})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, since $(-1)^n = e^{j\pi n}$, then DTFT of  $$h_2[n]=(-1)^n h_1[n]$$ is $$H_2(e^{j\omega}) = H_1(e^{j(\omega - \pi)})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally the interpretation of $H_1(e^{j(\omega - \pi)})$ is as follows, given that $H_1(e^{j\omega})$ is an ideal lowpass filter of cutoff frequency $\omega_c = \pi/2$ then $H_2(e^{j\omega})$ is a shifted by $\pi$ to the right version of $H_1(e^{j\omega})$ which will be an ideal highpass filter with a cutoff frequecy of $\omega_c = \pi /2$. And the best way to see this will come from drawing the magnitude reponses on the paper...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2016-03-02T20:49:30.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29174" PostTypeId="2" ParentId="29037" CreationDate="2016-03-02T22:20:33.013" Score="0" Body="&lt;p&gt;I'm not having an OpenCV solution for you, but what about the following approachs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;#1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Assume that the jitter is Gaussian and calculate the mean and variance of the laser point for a certain number of frames (this number is something that you should estimate or measure in an experiment)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Keep the mouse cursor at the mean position.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Update the position of the mouse cursor only if the mean position has changed more than one standard deviation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;#2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the mean position of the laser point for a certain number of frames (this number is something that you should estimate or measure in an experiment). This is the same as a sliding average position of the laser point. Use this mean position as the cursor position.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-02T22:20:33.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29175" PostTypeId="2" ParentId="19740" CreationDate="2016-03-02T22:32:49.073" Score="0" Body="&lt;p&gt;What you are planning to do sounds like a non-trivial task. Minimizing the variability between the images and the reference image is certainly a way to improve your results - no matter what algorithm you decide for at the end of the day.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My suggestions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Since you are using a jig, why don't you place that jig in a box and use artificial illumination? This way you minimize illumination variances.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Place reference colors on the jig. Those can be used to recalibrate the images in case of illumination changes. Besides general colors (e.g. red, green, blue), you can also include all fuses on that reference chart. That way you know exactly what color the fuses are and you can use this information to specifically cut out the corresponding areas in the image via simple histogram manipulations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate a binary mask for each fuse type. Apply the mask to the image under investigation and check if the resulting image only consists of the colors that you expect for the fuses that make up that mask image. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use different illuminations (e.g. color filters) and acquire multiple images. Chose the colors in a way that only one type of fuse is bright. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-02T22:32:49.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29176" PostTypeId="2" ParentId="28773" CreationDate="2016-03-02T22:45:06.807" Score="0" Body="&lt;p&gt;Do I understand you right that you want to take the original (&quot;good&quot;) image and degrade its quality so that it becomes this (&quot;bad&quot;) blocky version?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, using a high JPG compression as suggested in other answers is a way to go. However, you would need an image processing library for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be an easier way:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Your image is nothing else than a 2D array (ok, 3D if you count the color dimension. This does not complicate things, since you could do this calculation for each color channel and combine the three results at the end) for numbers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Choose a block size (e.g. 8 px as suggested in other answers)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Chop up the image into patches of 8-by-8 pixels&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each patch: Calculate the mean value of those numbers and set all the pixels in that patch to this mean value&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You'll end up with something that looks very similar to your image without the need of a image processing library. You can do this just by two simple loops.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-02T22:45:06.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29177" PostTypeId="1" AcceptedAnswerId="29193" CreationDate="2016-03-03T02:07:12.163" Score="3" ViewCount="704" Body="&lt;p&gt;I have a basic question about the metric spaces. There are several metric spaces like $L_1$, $L_2$ to $L_\infty$. The $L_p$ metric is defined by the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d_p(x,y)=\left(\sum_{i=1}^{n}|x_i-y_i|^p \right)^{1/p}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when $p = \infty$, then the equation of the matrix is following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$d_{\infty}(x,y)=\max_{i=1,2,\ldots, n}|x_i-y_i|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am taking the value of $x$ as $x = [1,2,3]^T$ (Transpose) and compute $L_p$ metric for, $p = 1,2$ and $\infty$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, why $L_\infty$ metric choose the maximum value. &lt;/p&gt;&#xA;" OwnerUserId="19844" LastEditorUserId="80" LastEditDate="2016-03-23T12:42:52.433" LastActivityDate="2019-03-22T17:10:57.650" Title="Metric Spaces: Why $L_\infty$ selects the maximum value" Tags="|distance-metrics|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29178" PostTypeId="2" ParentId="29177" CreationDate="2016-03-03T03:17:10.213" Score="1" Body="&lt;p&gt;The $L_p$ norm is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ d_p(\mathbf{x}, \mathbf{y}) \triangleq \left( \sum\limits_{i=1}^{n} |x_i - y_i|^p \right)^{\frac{1}{p}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there exists a positive value that &lt;strong&gt;is&lt;/strong&gt; the maximum value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ M \triangleq \max_{1 \le i \le n} |x_i - y_i| $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, suppose you divide both sides of the $L_p$ norm definition by that positive value,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{d_p(\mathbf{x}, \mathbf{y})}{M} = \frac{1}{M} \left( \sum\limits_{i=1}^{n} |x_i - y_i|^p \right)^{\frac{1}{p}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;\frac{d_p(\mathbf{x}, \mathbf{y})}{M} &amp;amp; = \frac{1}{M} \left( \sum\limits_{i=1}^{n} |x_i - y_i|^p \right)^{\frac{1}{p}} \\&#xA;&amp;amp; =  \left( \frac{1}{M^p} \right)^{\frac{1}{p}} \left( \sum\limits_{i=1}^{n} |x_i - y_i|^p \right)^{\frac{1}{p}} \\&#xA;&amp;amp; =  \left( \frac{1}{M^p} \sum\limits_{i=1}^{n} |x_i - y_i|^p \right)^{\frac{1}{p}} \\&#xA;&amp;amp; =  \left( \sum\limits_{i=1}^{n} \frac{1}{M^p} |x_i - y_i|^p \right)^{\frac{1}{p}} \\&#xA;&amp;amp; =  \left( \sum\limits_{i=1}^{n} \left( \frac{|x_i - y_i|}{M} \right)^p \right)^{\frac{1}{p}} \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now ask yourself, what will happen to the right-hand side of this equation as $p \to \infty$?  all terms, except for the term that is equal to the maximum, will have value of less than 1.  they will go to 0 as  $p \to \infty$, but the term that has $|x_i - y_i| = M$, that term is equal to 1 and will remain 1 even as  $p \to \infty$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-03-03T03:17:10.213" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29181" PostTypeId="2" ParentId="29136" CreationDate="2016-03-03T09:29:02.887" Score="5" Body="&lt;p&gt;If you have a continuous-time signal $x(t)$, then the two signals you're talking about are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;x_c(t) &amp;amp;=x(t)\cdot\sum_{n=-\infty}^{\infty}\delta(t-nT) \\&#xA; &amp;amp;=\sum_{n=-\infty}^{\infty}x(t)\delta(t-nT) \\&#xA; &amp;amp;=\sum_{n=-\infty}^{\infty}x(nT)\delta(t-nT) \\ \tag{1}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you define&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_d[n] \triangleq x(nT)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first signal given by $(1)$ is technically a continuous-time signal, even though it is only non-zero at discrete times $t=nT$. The reason why it is considered a continuous-time signal is because it can and must be transformed using the continuous-time Fourier transform (CTFT). So $(1)$ is the continuous-time representation of a sampled signal. Eq. $(2)$ is the discrete-time representation of the &lt;em&gt;same&lt;/em&gt; signal. Here the sampled signal is represented as a sequence of numbers. You can't apply the CTFT to $(2)$, but you must use the discrete-time Fourier transform (DTFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nice thing is now that the CTFT of $x_c(t)$ given by $(1)$ and the DTFT of $x_d[n]$ given by $(2)$ are identical. So if the CTFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;X_c(j\Omega) &amp;amp;= \int_{-\infty}^{\infty}x_c(t)e^{-j\Omega t}dt \\&#xA;   &amp;amp;= \int_{-\infty}^{\infty}\sum_{n=-\infty}^{\infty}x(nT)\delta(t-nT) e^{-j\Omega t}dt \\&#xA;   &amp;amp;= \sum_{n=-\infty}^{\infty}x(nT) \int_{-\infty}^{\infty}\delta(t-nT) e^{-j\Omega t}dt \\&#xA;   &amp;amp;= \sum_{n=-\infty}^{\infty}x(nT)  e^{-j\Omega nT} \\&#xA;   &amp;amp;= \sum_{n=-\infty}^{\infty}x_d[n]  e^{-j n(\Omega T)} \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the DTFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_d(e^{j\omega})=\sum_{n=-\infty}^{\infty}x_d[n]e^{-jn\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_d(e^{j\omega})=X_c\left(\tfrac{j\omega}{T}\right)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, the signals $(1)$ and $(2)$ are just two different representations of the same signal, and their spectra (one defined by the CTFT, the other defined by the DTFT) are identical.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4346" LastEditDate="2018-06-29T06:09:58.563" LastActivityDate="2018-06-29T06:09:58.563" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29183" PostTypeId="1" AcceptedAnswerId="29340" CreationDate="2016-03-03T11:19:33.490" Score="0" ViewCount="2023" Body="&lt;p&gt;I have a digital audio signal (float samples). I need to apply the &lt;a href=&quot;https://en.wikipedia.org/wiki/Vibrato&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vibrato effect&lt;/a&gt; to a signal. &amp;quot;Vibrato&amp;quot; is no common term, but it is the same as the frequency modulation.&lt;br /&gt;&#xA;So, I need to modulate my audio signal by a low-frequency sinusoid. I need to set two parameters for the modulation: &amp;quot;amplitude&amp;quot; and period. In this case, &amp;quot;amplitude&amp;quot; of freq modulation is a maximum shift of signal frequency, for example 10 Hz. Period is just a period of the sinusoid.&lt;br /&gt;&#xA;So, I need a C/C++ function for such modulation.&lt;/p&gt;&#xA;&lt;p&gt;The related article, but I cannot quite understand it: &lt;a href=&quot;https://christianfloisand.wordpress.com/2012/05/01/shaking-it-up-with-vibrato-2/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://christianfloisand.wordpress.com/2012/05/01/shaking-it-up-with-vibrato-2/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13286" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-03-09T17:49:55.330" Title="Audio frequency modulation algorithm" Tags="|audio|frequency|algorithms|modulation|c|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29184" PostTypeId="2" ParentId="29156" CreationDate="2016-03-03T12:10:21.270" Score="0" Body="&lt;p&gt;You need a edge detection algotithm witch will filter the critical edges and then create out of them an binary image. That image will give you an region to blur and the rest should tay the same. This should avoid the water stains or ghost efects.&lt;/p&gt;&#xA;" OwnerUserId="8872" LastActivityDate="2016-03-03T12:10:21.270" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29187" PostTypeId="1" AcceptedAnswerId="29190" CreationDate="2016-03-03T13:43:36.893" Score="0" ViewCount="2775" Body="&lt;p&gt;I read the book &lt;em&gt;Image Processing, Vision and Machine Vision&lt;/em&gt; and find the concept Fourier descriptors hard to understand, although literally its derivation is somewhat reasonable. Can anyone give me a detailed picture about what's really going on about it? Thx.&lt;/p&gt;&#xA;" OwnerUserId="19831" LastActivityDate="2018-11-26T17:01:31.160" Title="How do I understand Fourier descriptors more visually and intuitively?" Tags="|fourier-transform|computer-vision|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29189" PostTypeId="2" ParentId="29183" CreationDate="2016-03-03T14:39:10.187" Score="6" Body="&lt;p&gt;You need to build a time varying delay, where you can modulate the delay amount over time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The peak delay modulation is a function of your maximum desired frequency shift and the modulation frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not trivial since it will require fractional sample delays with some kind of interpolation algorithm. You can't round to the nearest integer delay without &quot;zipper&quot; noise. The best interpolation method depends on the specific requirements of your application (tolerance for noise, input spectrum, MIPS &amp;amp; memory available, etc.) &lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-03-03T14:39:10.187" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29190" PostTypeId="2" ParentId="29187" CreationDate="2016-03-03T15:27:13.873" Score="2" Body="&lt;p&gt;Fourier Descriptors (FD) are a way of representing the shape of a closed curve at varying forms of detail. In the following discussion, I am assuming that you are familiar with the one-dimensional Discrete Fourier Transform (DFT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FD are essentially the application of the Fourier Transform to decompose the form of the curve into a sum of shapes that look roughly like circles whose radius has been modulated. In fact, the equivalent of the zero frequency component (or DC) is a perfect circle with a radius equal to the average distance to the centroid of the curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can continue thinking in terms of superimposed &quot;squiggly&quot; circles that result to a complex curve, or, we can &quot;transfer&quot; the curve to a more familiar setting of a &quot;waveform&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, first estimate the centroid of the curve by calculating the arithmetic mean of the curve's coordinates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine that you have the familiar $x,y$ coordinate system but &quot;wrapped&quot; around the curve. The $x$ axis now corresponds to some angle ($\theta$) around the curve and the $y$ axis now corresponds to the distance between a point on the curve and the centroid at angle $\theta$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply a polar to cartesian coordinate transform that takes the pair of $\theta, r$ coordinates to the familiar $x,y$ space, you will have unfolded that axis to its more familiar &quot;rectangular&quot; shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now, you have a very simple one-dimensional waveform whose overall shape you can analyse by using (usually) just a few FDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just two further points that might not be immediately obvious:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The curve has to be closed because the Fourier Transform is defined over periodic waveforms.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The way to &quot;input&quot; the curve to the Fourier Transform is by taking its $x,y$ points to form a complex number (e.g. $z= x \cdot i +y$). After this, you apply the Fourier Transform on that set of complex numbers (i.e. a series of $z_k$ where $k \in \left[0 .. N-1\right]$ and $N$ being the total number of $x,y$ points that the curve is composed of.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2016-03-04T12:04:53.803" LastActivityDate="2016-03-04T12:04:53.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29193" PostTypeId="2" ParentId="29177" CreationDate="2016-03-03T16:20:54.163" Score="7" Body="&lt;p&gt;In the general case, let  &lt;span class=&quot;math-container&quot;&gt;$x = (x_1,\dots,x_n)$&lt;/span&gt; be a finite-length vector (in a finite dimensional space). &#xA;The finite sequence of absolute values &lt;span class=&quot;math-container&quot;&gt;$|x_i|$&lt;/span&gt; does attain its maximum (because the sequence is finite), denoted &lt;span class=&quot;math-container&quot;&gt;$M = \max_i |x_i|$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; be the (exact) number of coordinates in &lt;span class=&quot;math-container&quot;&gt;$x = (x_1,\dots,x_n)$&lt;/span&gt; whose absolute value  is equal to &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. Thus, &lt;span class=&quot;math-container&quot;&gt;$1\le m\le n$&lt;/span&gt;. Then, we can lower and upper bound the &lt;span class=&quot;math-container&quot;&gt;$\ell_p$&lt;/span&gt; norm of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as follows: &lt;span class=&quot;math-container&quot;&gt;$$(mM^p)^{\frac{1}{p}}\le\ell_p(x)\le (nM^p)^{\frac{1}{p}}\,.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both &lt;span class=&quot;math-container&quot;&gt;$m^\frac{1}{p}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n^\frac{1}{p}$&lt;/span&gt; tend to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$p\to\infty$&lt;/span&gt;, thus &lt;span class=&quot;math-container&quot;&gt;$\ell_p(x) \to M$&lt;/span&gt;, by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Squeeze_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;squeeze theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT] To provide more concrete substance, let us see what happen with your example: &lt;span class=&quot;math-container&quot;&gt;$x=[1,2,3]^T$&lt;/span&gt; (the transposition does not change the result): &lt;span class=&quot;math-container&quot;&gt;$$\|x\|_p = d_p(x,0) = (1^p+2^p+3^p)^{1/p} = 3\times\left(\left(\frac{1}{3}\right)^p+\left(\frac{2}{3}\right)^p+1\right)^{1/p}\,.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both &lt;span class=&quot;math-container&quot;&gt;$\left(\frac{1}{3}\right)^p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left(\frac{2}{3}\right)^p$&lt;/span&gt; tend to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$p \to \infty$&lt;/span&gt;. Thus, &lt;span class=&quot;math-container&quot;&gt;$\|x\|_p \to 3$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2019-03-22T17:10:57.650" LastActivityDate="2019-03-22T17:10:57.650" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29202" PostTypeId="1" CreationDate="2016-03-03T22:09:30.293" Score="1" ViewCount="1450" Body="&lt;p&gt;I was working on wavelet signal decomposition and got confused with the downsampling part of &lt;strong&gt;Discrete Wavelet Transform algorithm&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we consider a signal $\{a_0[0], ... ,a_0[N-1]\}$ of length N and &lt;strong&gt;use formula&lt;/strong&gt;&#xA;$$&#xA;a_1[k] = \sum_m h[m-2k]a_0[m]&#xA;$$&#xA;then for &lt;strong&gt;two low pass filters&lt;/strong&gt; &#xA;$$\{h[0]=h_0,~h[1]=h_1, ~h[2]=h_2, ~h[3]=h_3\}$$&#xA;and &#xA;$$\{g[-2]=h_0,~g[-1]=h_1, ~g[0]=h_2, ~g[1]=h_3\}$$&#xA;(which are the &lt;strong&gt;same thing&lt;/strong&gt; except the second filter is time-shifted version of the first one) we will get &lt;strong&gt;different results&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Let me clarify&lt;/strong&gt;. After convolution of $a_0$ and $h$ we will get $N+3$ samples $\tilde a_1[k]$, $k=-1,...,N+1$ with the first non zero sample being $\tilde a_1[-1]$. So, after downsampling we will result in the following sequence&#xA;$$&#xA;\tilde a_1[0], \tilde a_1[2], \tilde a_1[4], ..., \tilde a_1[N_1]&#xA;$$&#xA;where $N_1$ is the integer part of $(N+1)/2$, with total number of samples equal to $N_1 + 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if we convolve $g$ and $a_0$ again we will get $N+3$ samples, but this time $\hat a_1[k]$, $k=0,...,N+2$. And after downsampling we will get&#xA;$$&#xA;\hat a_1[0], \hat a_1[2], \hat a_1[4], ..., \hat a_1[N_2]&#xA;$$&#xA;where $N_2$ is the integer part of $(N+2)/2$, with total number of samples equal to $N_2 + 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as a result, if number of samples $N$ of input signal $a_0$ is even, then number of approximation coefficients for $h$ and $g$ is different (integer part of $(N+1)/2$ is less than integer part of $(N+2)/2$). More than that, second sequence consists of exactly those samples which are excluded from the first one and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my questions are&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Is this correct or do I have a mistake somewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If this is correct, then why implementations of dwt algorithm ignore this fact? (I've tested dwt from PyWavelets package)&lt;/p&gt;&#xA;" OwnerUserId="12002" LastActivityDate="2016-03-03T22:26:44.300" Title="Downsampling in DWT algorithm" Tags="|discrete-signals|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29203" PostTypeId="2" ParentId="29164" CreationDate="2016-03-03T22:16:41.687" Score="2" Body="&lt;p&gt;The FFT result bins representing frequencies outside your frequency range of interest still carry information about spectrum within your frequency range slice.  So you would lose some information, especially near the edges of your frequency block, by not doing a full FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if the number of bins within your frequency slice is anywhere close to (or larger than) log(N), doing a full FFT using a well optimized library might well be faster than naively calculating just the frequency bins you think you need.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-03T22:16:41.687" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29204" PostTypeId="2" ParentId="29202" CreationDate="2016-03-03T22:26:44.300" Score="1" Body="&lt;p&gt;Wavelet analysis results in information about both frequency and time localization.  Since the two filters are slightly offset in time, if your signal varies over time, one might expect the two wavelet results to be different.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-03T22:26:44.300" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29206" PostTypeId="1" CreationDate="2016-03-03T23:18:16.937" Score="1" ViewCount="74" Body="&lt;p&gt;I recently asked a question here on how to create noise with a specific spectral density $S_{xx}(f)$. The helpful people of this stack exchange told me one way to do it was filtering white noise with a unitary spectral density using a filter with impulse response $H(f) = \sqrt{S_{xx}(f)}$ and then suggested how to do this. The way that was proposed was using a frequency sampling based FIR filter. As I use Mathematica the idea was to use &lt;code&gt;FrequencySamplingFilterKernel&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, this seems to work reasonably well qualitatively, but I am trying to find a way of quantifying this. So my question comes down to how I quantitaviely test how well the noise produced with my filter resembles the desired spectral density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To take a specific example, I am trying to produce (not exclusively, but to begin with) the Ornstein Uhlenbeck spectral density given by $S_{xx}(f) = \frac{2c\tau^2}{1+(2 \pi f)^2}$. So I suppose it is the easiest if I just show my work and then get to my specific question. What I did was generate the amplitudes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Γ = 10; (* bandwidth of Lorentzian*)&#xA;P = 2; (* std dev of noise *)&#xA;τn = 1/Γ;(* relaxation time of OU process *)&#xA;c = 2 P^2 Γ;(* diffusion constant of OU process *)&#xA;S[f_] := (2 c τn^2)/(&#xA; 1 + (2 Pi f  τn)^2); (* power spectral density *)&#xA;K = 100; (* number of frequency components taken into account *)&#xA;fmax = 5; (*max frequency*)&#xA;Δf = fmax/(K - 1);(* freq step *)&#xA;fk = Range[0, fmax, Δf]; (* sampling frequencies *)&#xA;FilterAmps = Sqrt[S[fk]]; (* Amplitudes for the FIR filter *)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The parameter choices are arbitrary, and definitely not necessarily what I want to do in practice, but that shouldn't matter too much for now. I then generate some white noise (the times list is not needed at this point, but I'm just doing it to keep track of what I'm doing for now):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ns = 1000; (* number of time points generated; output time points \&#xA;after filter is n = Ns - 2K + 2*)&#xA;Δt = 1/(2 fmax); (*Nyquist rate*)&#xA;Tmax = (Ns - 1) Δt;&#xA;times = Range[0, &#xA;  Tmax, Δt]; (*Using Nyquist rate as step size*)&#xA;UnitDataWhite = &#xA; RandomVariate[NormalDistribution[0, 1], Length[times]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Okay, great, so then we filter&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FilteredNoise = &#xA; ListConvolve[FrequencySamplingFilterKernel[FilterAmps], &#xA;  UnitDataWhite]; &#xA;FilteredTimes = &#xA; Range[0, (Length[FilteredNoise] - &#xA;     1) Δt, Δt];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Giving me a dataset of $n = N - K + 2$ noise datapoints which should behave according to the spectral density of the Ornstein Uhlenbeck process. The problem is, how do I quantify how well this works? The first thing that came to mind was just constructing the power spectral density and seeing how well it agreed with theory. Well, there I ran into my first real meeting with the fact that one does not simply find the power spectral density from a dataset to some arbitrary degree of precision. Mathematica has a built in function &lt;code&gt;periodogram&lt;/code&gt; which is supposed to do this, but while the shape is definitely as desired, is not exactly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okay, so then I thought perhaps it is too much to ask to reconstruct the spectral density in this way. Should I look instead at other quantities that carry the same information, such as the autocovariance? For the OU process this is given by $C_{x}(t) = \frac{c\tau}{2} e^{-t/\tau}$ so that's also relatively nice. But calculating the autocovariance with &lt;code&gt;CovarianceFunction&lt;/code&gt; again runs into amplitude trouble, so that doesn't seem like a good method either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the end my question boils down to this. Creating noise with a spectral density using the way I described here, how do I reliably quantify how well I am succeeding? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;*Note that I know that there are nicer ways of creating OU noise, but I am trying to construct a method for general spectral densities&lt;/p&gt;&#xA;" OwnerUserId="8593" LastEditorUserId="13320" LastEditDate="2016-11-21T13:06:56.420" LastActivityDate="2016-11-21T13:06:56.420" Title="Quantifying how good I'm producing a spectral density" Tags="|filters|filter-design|power-spectral-density|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29207" PostTypeId="1" CreationDate="2016-03-03T23:29:45.470" Score="1" ViewCount="2616" Body="&lt;p&gt;I have a a time domain data set that records the magnetic field vs time, which must be processed to reveal an embedded signal.  This data also contains power line harmonics (i.e. multiples of 60 Hz) that must be removed from the signal.  I am processing the data with Python and am using the numpy, scipy.signal and scipy.fftpack modules to filter out information.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using a traditional notch/comb filter I am writing a function that will transform the data to the frequency domain with an array of values corresponding to amplitude and another array corresponding to frequency.  The arrays are also reformatted to exist properly in the frequency spectrum.  The code then determines where the frequency peaks are and the array indice that corresponds to each peak.  Finally, the code analyzes each peak to see if it exists as a multiple of 60 Hz (i.e. a power line harmonic).  If any of the data points corresponds to the first 50 multiples of 60 Hz, the code finds the amplitude and frequency array values for indice-1 and indice+1 and then does a linear interpolation between them to find a new amplitude.  The new value of amplitude replaces the old value, thus eradicating the frequency peaks corresponding to each power line harmonic, without the depressions caused by normal notch filters.  The Python function is shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I plot the frequency response I get a very nice looking plot that has clearly erased the harmonic peaks.  However, when I used an ifft function to transform the data back to the time domain, I see that the power line harmonics all still exist, but the amplitude has been reduced.  I suspect that python is only working on the even (real) series and is neglecting the odd (imaginary) data, but I am not sure what is causing this.  Again, when I plot the frequency domain info, there are no harmonic peaks (60, 180, 300, 440, 600 Hz, etc...), but when I plot the time domain it is clearly there.  Any help would be appreciated.  Also, I am not including the peakdet and the linear_interpolate functions because I have tested those and am confident the problem does not lie with them.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def Interpolate_US_Power_Harmonics(XData,YData):&#xA;    from scipy.fftpack import fft&#xA;    import numpy as np&#xA;&#xA;    # Determines time between sampling assuming uniform intervals&#xA;    Sample_Freq = XData[1] - XData[0]&#xA;&#xA;    # Resize x and y axis for frequency domain&#xA;    Y_Data = fft(YData,n=YData.size)&#xA;    array_length = len(Y_Data)&#xA;    Y1_Data = 20*np.log10(Y_Data/1) # transform to decibels&#xA;    Y1_Data = 2.0/array_length*np.abs(Y1_Data[0:array_length/2])&#xA;    XTicks = np.linspace(0.0,1.0/(2*Sample_Freq),array_length/2)&#xA;&#xA;    # - Determine the frequency peaks (maxima) and troughs (minima) and their array&#xA;    #   positions.  Odd array positions correspond to peaks and even points&#xA;    #   correspond to minimas&#xA;    maxima, minima, position = peakdet(Y1_Data, 200*Sample_Freq, XTicks)&#xA;&#xA;    # Determine array position of frequency peaks&#xA;    new_position = []&#xA;    for i in range(0,len(position)):&#xA;        if i% 2 != 0:&#xA;            new_position.append(position[i])&#xA;&#xA;    # - Determine if a peak is a powerline harmonic (multiple of 60 Hz) and if so&#xA;    #   replace magnitude array point with one interpolated from the previous&#xA;    #   and next array points.&#xA;    for x in range(0,len(maxima)):&#xA;        frequency = 60.0&#xA;        for y in range(100):&#xA;            if maxima[x][0] &amp;gt; frequency - 1 and maxima[x][0] &amp;lt; frequency + 1:&#xA;                X1 = XTicks[new_position[x-1]-1]; X2 = XTicks[new_position[x-1]+1]&#xA;                Y1 = Y_Data[new_position[x-1]-1]; Y2 = Y_Data[new_position[x-1]+1]&#xA;                X3 = maxima[x][0]&#xA;                Y_Data[new_position[x-1]] = Linear_Interpolate(X1,X2,Y1,Y2,X3)&#xA;                print frequency, XTicks[new_position[x-1]]&#xA;            frequency = frequency + 60&#xA;&#xA;    # Return frequency domain data to main program&#xA;    return Y_Data&#xA;&#xA;# Main program&#xA;import scipy.fftpack.ifft&#xA;# meta code to show time and amplitude array as well as plotting&#xA;Time      = insert data here&#xA;Amplitude = insert data here&#xA;&#xA;# used pylab to plot original time and frequency domain signals&#xA;&#xA;# Produce new frequency series filtered&#xA;new_data = Interpolate_US_Power_Harmonics(Time,Amplitude)&#xA;&#xA;# - used pylab to plot filtered data.  The frequency domain showed no harmonics.&#xA;#   but the time series plots still contained 60, 180, etc.. harmonics with&#xA;#   a reduced amplitude&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19862" LastActivityDate="2017-09-22T15:05:18.670" Title="How to design an interpolated notch filter in Python to filter powerline harmonics" Tags="|fft|frequency-spectrum|filter-design|python|scipy|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29208" PostTypeId="2" ParentId="28283" CreationDate="2016-03-04T00:08:18.717" Score="-1" Body="&lt;p&gt;According to EMGU, which is an .NET wrapper for OpenCV, and sometimes has way better documentation than OpenCV, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;DO_CANNY_PRUNING&lt;br&gt;&#xA;  If it is set, the function uses Canny edge detector&#xA;  to reject some image regions that contain too few or too much edges&#xA;  and thus can not contain the searched object. The particular threshold&#xA;  values are tuned for face detection and in this case the pruning&#xA;  speeds up the processing&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;SCALE_IMAGE&lt;br&gt;&#xA;  For each scale factor used the function will downscale&#xA;  the image rather than &quot;zoom&quot; the feature coordinates in the classifier&#xA;  cascade. Currently, the option can only be used alone, i.e. the flag&#xA;  can not be set together with the others&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;FIND_BIGGEST_OBJECT&lt;br&gt;&#xA;  If it is set, the function finds the largest&#xA;  object (if any) in the image. That is, the output sequence will&#xA;  contain one (or zero) element(s)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;DO_ROUGH_SEARCH&lt;br&gt;&#xA;  It should be used only when&#xA;  CV_HAAR_FIND_BIGGEST_OBJECT is set and min_neighbors &gt; 0. If the flag&#xA;  is set, the function does not look for candidates of a smaller size as&#xA;  soon as it has found the object (with enough neighbor candidates) at&#xA;  the current scale. Typically, when min_neighbors is fixed, the mode&#xA;  yields less accurate (a bit larger) object rectangle than the regular&#xA;  single-object mode (flags=CV_HAAR_FIND_BIGGEST_OBJECT), but it is much&#xA;  faster, up to an order of magnitude. A greater value of min_neighbors may be specified to improve the accuracy.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.emgu.com/wiki/files/1.5.0.0/Help/html/e2278977-87ea-8fa9-b78e-0e52cfe6406a.htm&quot; rel=&quot;nofollow&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19864" LastActivityDate="2016-03-04T00:08:18.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29209" PostTypeId="2" ParentId="29143" CreationDate="2016-03-04T01:13:00.383" Score="3" Body="&lt;p&gt;The spectral density $S_{xx}(f)$ basically defines the magnitude of the signal in the frequency domain. This leaves the phase information to be chosen at will. For this, as mentioned by others, you could start of with white noise and filter it, but you can also start in the frequency domain and use a uniform random distribution of the phase from $0$ to $2\pi$ (or $360^{\circ}$ if you prefer degrees) and take the inverse fft to get a time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first option will probably be easier to implement and more dynamic in length, however the implementation of the filter might not give the exact spectral density you wanted if you use something like a FIR or IIR filter. So the second method might give you more control over it and you can also play around a bit with different phase distributions.&lt;/p&gt;&#xA;" OwnerUserId="7579" LastActivityDate="2016-03-04T01:13:00.383" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29211" PostTypeId="1" AcceptedAnswerId="29296" CreationDate="2016-03-04T03:18:12.370" Score="1" ViewCount="1008" Body="&lt;p&gt;My question has to do with integrating gaussian noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume we have samples of discrete gaussian white noise  with mean $\mu = 0$ and variance $\sigma_{th}^2$. These noise samples are passed through the system shown in the Figure (a cascade of two integrators with outputs $y_1[n]$ and $y_2[n]$, respectively).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Irl8Z.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Irl8Z.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What will be the mean and variance of $y_1$ and $y_2$ (let us say after $N$ cycles)?  &lt;/p&gt;&#xA;" OwnerUserId="19865" LastEditorUserId="19865" LastEditDate="2016-03-04T23:20:11.653" LastActivityDate="2016-03-08T01:16:33.143" Title="Double Integrating Gaussian Noise" Tags="|noise|gaussian|integration|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="29218" PostTypeId="2" ParentId="18504" CreationDate="2016-03-04T12:15:03.603" Score="1" Body="&lt;p&gt;&lt;strong&gt;Why this is happening?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is quite simple and the error message exactly tells you what is wrong: Apparently you do not have the function &lt;code&gt;psnr()&lt;/code&gt; available on your system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might have many reasons. Most probably:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You are missing a Matlab toolbox that provides this function&lt;/li&gt;&#xA;&lt;li&gt;You are missing a Matlab script that provides this function&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you have the script, then Matlab does not know about it. Check your Matlab path settings&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-04T12:15:03.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29219" PostTypeId="2" ParentId="4677" CreationDate="2016-03-04T12:26:41.167" Score="-1" Body="&lt;p&gt;Class to translate the example shown between [0, 1 ]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Color Gradient [0, 1] =&amp;gt; Result (R, G, B) R, G, B [0, 1]&#xA;void GradientCor::set_value (double y, int y_min, int y_max) &#xA;{&#xA;    /* &#xA;      y = mx+b&#xA;      x -&amp;gt; y&#xA;      -0 -&amp;gt; -80&#xA;       1 -&amp;gt; 120&#xA;      m = dy/dx= 120 - (-80) = 200; b = y + mx = -80; x = (y-b)/m &#xA;    */&#xA;    valor = (y-y_min)/(y_max - y_min);&#xA;}&#xA;    /*  &#xA;    0.0  -&amp;gt; (0, 0, 128)    (dark blue)&#xA;    0.25 -&amp;gt; (0, 255, 0)    (green)&#xA;    0.5  -&amp;gt; (255, 255, 0)  (yellow)&#xA;    0.75 -&amp;gt; (255, 128, 0)  (orange)&#xA;    1.0  -&amp;gt; (255, 0, 0)    (red) &#xA;    x -&amp;gt; y para (dark blue) &#xA;    0 -&amp;gt; 128&#xA;    0.25 -&amp;gt; 0&#xA;    m = dy/dx= 1020; b = y + mx = 128; y = mx+b&#xA;    result = y/255&#xA;    */&#xA;double GradientCor::get_R()&#xA;{&#xA;    if (valor &amp;lt;= 0.25)&#xA;        return 0; &#xA;    else if (valor &amp;lt;= 0.5)&#xA;        return(double)(1020*valor - 255)/255;&#xA;    else return 1; &#xA;}&#xA;&#xA;double GradientCor::get_G()&#xA;{&#xA;    if (valor &amp;lt;= 0.25)&#xA;        return(double)(1020*valor)/255;&#xA;    else if (valor &amp;lt;= 0.5)&#xA;        return 1;&#xA;    else&#xA;        return(double)(-510*valor + 510)/255;&#xA;}&#xA;&#xA;double GradientCor::get_B()&#xA;{&#xA;    if (valor &amp;lt;= 0.25)&#xA;        return (double)(-512*valor + 128)/255;&#xA;    else return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19875" LastEditorUserId="8202" LastEditDate="2016-03-04T12:41:07.463" LastActivityDate="2016-03-04T12:41:07.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29220" PostTypeId="2" ParentId="29032" CreationDate="2016-03-04T12:38:53.770" Score="2" Body="&lt;p&gt;This is image processing: many times, you see authors discussing an algorithm to process a given distorted / noisy image, and converting it into an (unbelievably) perfected form, without providing any code or input-output images (in files). Then it becomes quite impossible to replicate what they propose to achieve.&lt;/p&gt;&#xA;&lt;p&gt;In your example, basic LSI spatial filtering is demonstrated. The original image is so much degraded that visually it seems very hard to recover. Yet, looking into its spectrum reveals that there are some components unlikely to come from an original undistorted image. In addition, it's quite nice that those components are all distributed around a circular ring of frequencies. So, a circular 2D filter, narrow enough to suppress all those circular band of spurious components while leaving all the rest of spectrum untouched, will do the magic for this image at hand.&lt;/p&gt;&#xA;&lt;p&gt;That being said, however, in practice such a structured distortion is less likely to be observed. Imho, it was added there just for the purpose of the demonstration, yet I can't confirm it. You should better ask NASA, for a credit of the original image, and for the mechanism of its distortion...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2022-12-15T00:36:14.893" LastActivityDate="2022-12-15T00:36:14.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29223" PostTypeId="1" AcceptedAnswerId="32045" CreationDate="2016-03-04T13:22:51.793" Score="1" ViewCount="1055" Body="&lt;p&gt;I am creating a nonuniform illumination in MATLAB R2015. The nonuniform illumination (known as bias field) is defined as&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Nonuniform Illumination (intensity inhomogeneity) which manifests itself as slow intensity variations in the same class over the image domain.&lt;/p&gt;&#xA;&lt;p&gt;The non-linear degree of intensity inhomogeneity is indicated by the range of values of the bias field in the interval &lt;code&gt;[1 − α, 1 + α]&lt;/code&gt; with &lt;code&gt;α &amp;gt; 0&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I used the below MATLAB code to generate the intensity inhomogeneity image in case of &lt;code&gt;α = 0.2&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cols=256;rows=256;&#xA;alpha=0.2;&#xA;x = linspace(1-alpha,1+alpha,cols);&#xA;y = linspace(1-alpha,1+alpha,row2);&#xA;% Transform into a grid&#xA;[X,Y] = meshgrid(x,y);&#xA;bias=X;&#xA;imshow(bias,[]) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9ttTE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9ttTE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I am confused about the term 'non-linear'. It means that the value in the range &lt;code&gt;[1 − α, 1 + α]&lt;/code&gt; needs to be slowly changed in a non-linear manner. In the above code, it seems that it is linearly changing. Is this correct? Could you suggest me a method to create an image based on the definition?&lt;/p&gt;&#xA;&lt;p&gt;This is an expected example which I need to obtain&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mqG3a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mqG3a.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lfuME.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lfuME.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8430" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2020-06-08T15:15:45.023" Title="Generate a nonuniform illumination (bias field) 2D image" Tags="|matlab|computer-vision|image-processing|image-segmentation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29224" PostTypeId="7" CreationDate="2016-03-04T13:41:06.080" Score="0" Body="&lt;p&gt;&#xA;    On Stack Exchange, we believe the core moderators should come &lt;i&gt;from&lt;/i&gt; the community, and be elected by the community itself through popular vote. We hold regular elections to determine who these community moderators will be.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;    Community moderators are &lt;a href=&quot;http://blog.stackoverflow.com/2009/05/a-theory-of-moderation/&quot;&gt;accorded the highest level of privilege on our community&lt;/a&gt;, and should themselves be exemplars of positive behavior and leaders within the community.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;    Our general criteria for moderators is as follows:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;    &lt;li&gt;patient and fair&lt;/li&gt;&#xA;    &lt;li&gt;leads by example&lt;/li&gt;&#xA;    &lt;li&gt;shows respect for their fellow community members in their actions and words&lt;/li&gt;&#xA;    &lt;li&gt;open to some light but firm moderation to keep the community on track and resolve (hopefully) uncommon disputes and exceptions&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&#xA;    Every election has three phases:&#xA;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;    &lt;li&gt;Nomination&lt;/li&gt;&#xA;    &lt;li&gt;Primary&lt;/li&gt;&#xA;    &lt;li&gt;Election&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;    Please participate in the moderator elections by voting, and perhaps even by nominating yourself to be a community moderator!&#xA;&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="15250" LastEditDate="2022-02-15T15:41:41.437" LastActivityDate="2022-02-15T15:41:41.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29225" PostTypeId="1" AcceptedAnswerId="29228" CreationDate="2016-03-04T14:19:27.870" Score="12" ViewCount="6651" Body="&lt;p&gt;I am looking for some good book, that simply show how you actually write a code in C, to do all the main DSP methods .&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;FFT.&lt;/li&gt;&#xA;&lt;li&gt;Low-pass and high-pass filters.&lt;/li&gt;&#xA;&lt;li&gt;Auto-correlation.&lt;/li&gt;&#xA;&lt;li&gt;Noise processing.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And all the basics of DSP, from theory into a real code in C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have got 1000 samples, now i would like to compute FFT of it, remove noises, then bring back to the time axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something good that cover all of these?&lt;/p&gt;&#xA;" OwnerUserId="17182" LastEditorUserId="18297" LastEditDate="2017-04-26T04:42:19.290" LastActivityDate="2018-12-01T21:04:26.780" Title="Recommendation for book - Writing DSP code in C" Tags="|fft|filters|autocorrelation|c|reference-request|" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29227" PostTypeId="2" ParentId="29225" CreationDate="2016-03-04T15:47:07.790" Score="7" Body="&lt;p&gt;I'd recommend &lt;a href=&quot;http://www.ece.rutgers.edu/~orfanidi/intro2sp/&quot;&gt;Introduction to Signal Processing&lt;/a&gt; by S.J. Orfanidis. It's a great book with a good mix of theory and practice, and it also has code examples in C and Matlab. Once you've worked through it you'll know enough to carry on by yourself.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-04T15:47:07.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29228" PostTypeId="2" ParentId="29225" CreationDate="2016-03-04T15:51:49.070" Score="13" Body="&lt;p&gt;I can recommend you two books about DSP for C language.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Embree P. M. - &lt;strong&gt;C Language Algorithms for Digital Signal Processing&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is old and you can easily get it second-hand for a decent price. It covers pretty much all 4 topics that you described.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other one I recommend is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Malepati H. - &lt;strong&gt;Digital Media Processing: DSP Algorithms Using C&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It covers way more topics (including error correction algorithms and image/video processing algorithms). The nice thing about that one is that test signals are provided to test your implementation.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I just recalled that there is another book on my desk which has some C code for DSP in it. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Press W. H. - &lt;strong&gt;Numerical Recipes: The Art of Scientific Computing&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are two chapters about the Fourier Transform and its applications.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;One last suggestion - if you can, please use an existing C library instead of writing your own tools. There is no point in re-inventing the wheel.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2016-03-04T16:02:00.400" LastActivityDate="2016-03-04T16:02:00.400" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29229" PostTypeId="1" CreationDate="2016-03-04T15:59:57.433" Score="-1" ViewCount="528" Body="&lt;p&gt;I have a sample signal, and I computed MFCC using this &lt;a href=&quot;http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/doc/voicebox/melcepst.html&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt;.Now I have an array of 1225x12 size, where there are 12 coefficients for 1225 frames. Now I want to test another signal against this sample, and use vector quantization for this.I have this &lt;a href=&quot;http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/doc/voicebox/kmeanlbg.html&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt;, but cannot quite understand what to do. It takes data vectors as input,but I have a matrics. Do I convert it into a vector in some way? And how do I determine if two arrays match?&lt;/p&gt;&#xA;" OwnerUserId="19770" LastActivityDate="2016-03-09T15:45:09.003" Title="Help using vector quantization" Tags="|matlab|speech-recognition|mfcc|quantization|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29230" PostTypeId="2" ParentId="28996" CreationDate="2016-03-04T17:43:22.243" Score="1" Body="&lt;p&gt;I would recommend reading about &lt;a href=&quot;http://www.nyu.edu/classes/bello/MIR_files/2005_BelloEtAl_IEEE_TSALP.pdf&quot; rel=&quot;nofollow&quot;&gt;onset detection&lt;/a&gt;. It's about music signals but nevertheless a few ideas might be extracted from it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a more general point of view, what I would do is a frame-based analysis of the signal and define some kind of energy threshold/noise floor with which I could determine if there is activity or not.&lt;/p&gt;&#xA;" OwnerUserId="3445" LastActivityDate="2016-03-04T17:43:22.243" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29231" PostTypeId="1" CreationDate="2016-03-04T18:49:34.003" Score="0" ViewCount="186" Body="&lt;p&gt;I'm a computer science student and I took a network course this semester which assumes some signal processing backgrounds which I have not. Last time We talked about &lt;strong&gt;ASK&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ASK is Amplitude Shift Keying,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it uses two different amplitudes to describes $0$ or $1$. We can use several levels to represents more symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A\sin(2\pi fnt+\phi)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many harmonics does a signal with an ASK coding has?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have such a message to broadcast: $01101101$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we code in ASK this series of bits when the frequency used is: $f=1kHz$? And when the bit-time is $T_b=1ms$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what about varying its amplitude? If we have 4 levels for instance?&lt;/p&gt;&#xA;" OwnerUserId="19882" LastEditorUserId="13309" LastEditDate="2016-03-04T20:18:15.313" LastActivityDate="2016-03-04T20:50:59.410" Title="Amplitude Shift Keying coding" Tags="|bandpass|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29232" PostTypeId="1" AcceptedAnswerId="29234" CreationDate="2016-03-04T18:50:47.990" Score="0" ViewCount="2133" Body="&lt;p&gt;Assume we have:&#xA;$$x_c(t)=\sum_{k=-9}^{9} a_k e^{j(2000\pi kt)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and Fourier coefficients out of $$|k|&amp;gt;9$$  is zero. So, it is band-limited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling frequency is:$$F_s=\frac {6} {10^{-6}} HZ$$ and $$T_s=\frac {10^{-3}} {6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: what is the maximum frequency? how we can calculate it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the answer that is $$F_n=\frac {9} {10^{-6}} HZ$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="13320" LastEditDate="2016-11-13T13:01:47.707" LastActivityDate="2016-11-13T13:01:47.707" Title="finding maximum frequency" Tags="|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29233" PostTypeId="2" ParentId="29231" CreationDate="2016-03-04T19:38:06.513" Score="1" Body="&lt;p&gt;Regarding the harmonics: ASK has an infinite number of them. The ASK signal can be thought of as a square wave multiplied by a sinusoid. In frequency, this corresponds to the spectrum of the square wave shifted to the frequency of the sinusoid. Since the spectrum of the square wave is infinite, the spectrum of the ASK signal is infinite too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, the ASK signal is filtered to force it to fit in a specific bandwidth. This has the effect of distorting the signal, but if done carefully the distortion is not severe. In any case, ASK is only used in applications where bandwidth is not a constraint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend the following procedure to understand how to generate an ASK signal. First you need to map &quot;bits&quot; to &quot;voltages&quot; (also called &quot;amplitudes&quot;). Bits are abstract quantities that do not have physical substance, while voltages are physical. In ASK you typically map a bit 0 to 0 volts, and a bit 1 to $A$ volts. Now you can generate a sequence of voltages that corresponds to your bits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \text{bits}=\lbrace 0,1,1,0,1,1,0,1 \rbrace$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \text{amplitudes} = \lbrace 0, A, A, 0, A, A, 0, A \rbrace $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you need to define a pulse $p(t)$ of duration $T_b$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ p(t) = \begin{cases}1,\quad0\leq t\leq T_b,\\0,\quad\text{otherwise}\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You will eventually want to control the energy of the pulse by changing its amplitude).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step is to define the &quot;baseband&quot; ASK (that is, with no carrier) signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s_{BB}(t) = \sum_{k=0}^7 a_k p(t-kTb) $$ where $a_k$ is the $k$-th amplitude (starting from 0), and $p(t-kT_b)$ is the pulse shifted $kT_b$ seconds &quot;to the right&quot;. Take a moment to study this equation and you'll see that it is a train of pulses of amplitude 0 for a bit 0 and amplitude A for a bit 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you're ready to create the ASK signal, which is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s(t) = s_{BB}(t)\sin(2\pi f_c t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To transmit more bits per pulse, all you need to is to increase the range of values of the amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that this is different from the way most undergrad textbooks teach this subject, but I still think it makes more sense to think about it this way.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-03-04T19:38:06.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29234" PostTypeId="2" ParentId="29232" CreationDate="2016-03-04T19:44:35.730" Score="0" Body="&lt;p&gt;What you need to know is that the signal $$s(t)=e^{j2\pi f t}$$ has frequency $f$. At any time $t_0$, $s(t_0$) is a point on the unit circle. As time advances, this point moves on the circle, and it completes $f$ turns in one second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing this, you can easily see that the maximum frequency in your signal $x_c(t)$ is 9000 Hz. That is because, for $k=9$, you can write the exponent as $j2\pi 9\cdot 1000 t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling frequency you mention has no bearing on the signal's maximum frequency. However, if you intend to sample this signal, you need to make sure that the sampling frequency is at least twice the maximum frequency, or $f_s=18000$.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-03-04T19:44:35.730" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29236" PostTypeId="2" ParentId="29231" CreationDate="2016-03-04T20:50:59.410" Score="1" Body="&lt;p&gt;If you want 4 discrete levels for your ASK, that would correspond to 2 bits per symbol. From what I have seen you would want the distance on between each symbol to be the same, so you would end up with amplitudes of $A = [ -3, -1, 1, 3]$ correspond to data $[00, 01, 11, 10]$ (gray coding). As you can see, the elements of A have the same distances between corresponding points (a distance of 2 in this case). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To modulate your signal, you would then create a &quot;data&quot; signal, which will just be an amplitude for a period of time. Let's call this $M(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M(t) = -1$ for $0 &amp;lt; t &amp;lt; 2 T_b  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M(t) = 3$ for $2 T_b &amp;lt; t &amp;lt; 4 T_b  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M(t) = 1 $ for $ 4 T_b &amp;lt; t &amp;lt; 6 T_b  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$M(t) = -1$ for $6 T_b &amp;lt; t &amp;lt; 8 T_b  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now take your message signal and multiply it by your carrier $cos(2 \pi f_n t + \phi)$ (I'm changing it to cos to match with my signals that I'll show later)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S(t) = M(t) \cdot cos(2 \pi f_n t + \phi)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To demodulate this, you would take your received signal $r(t)$, and multiply it again with your carrier signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$d(t) = r(t) \cdot cos(2 \pi f_n t + \phi)  $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$d(t) = M(t) \cdot cos(2 \pi f_n t + \phi) \cdot cos(2 \pi f_n t + \phi) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$     = M(t)/2 + cos(4 \pi f_n t + \phi)/2$  &amp;lt;-- (I think the $cos(4 \pi f_n t + \phi)$ component should be devided by 4 instead... I'm missing something there&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This with shift your signal up and down in frequency by $f$ (should be at $cos(4 \pi f_n t + \phi)$ , and also have a component of your signal at low frequencies (but at half the amplitude). So all you need to do to get your data signal back is to take a low pass filter. See the code and graph below for how I implemented it in matlab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8ajlU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8ajlU.png&quot; alt=&quot;Transmitted ASK signal&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Q8KIA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q8KIA.png&quot; alt=&quot;Received and Demodulated ASK Signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;&#xA;clear all;&#xA;clc;&#xA;&#xA;Fs = 8000; %Sample Rate&#xA;f = 2000;      %Carrier Frequency (should probably be at least 200 Hz)&#xA;sampPerSymbol = 4000;     % Number of samples per bit&#xA;bitStream = [0,1,1,0,1,1,0,1];    %Data to me Modulated/Demodulated&#xA;M = [];     %message signal&#xA;t = [];     %time used for cos function and plotting&#xA;SNR = 1;    %signal to noise ratio&#xA;phi = 0*pi;&#xA;&#xA;bitPerSymbol = 2;&#xA;&#xA;%create Message signal&#xA;if bitPerSymbol ==1&#xA;    for i = 1:1:length(bitStream)&#xA;        if bitStream(i) == 0&#xA;           M = [M (-1*ones(1,sampPerSymbol))];    %data = 0, amplitude = -1 &#xA;        else&#xA;           M = [M ones(1,sampPerSymbol)];          %data = 1, amplitude = 1&#xA;        end&#xA;    end&#xA;elseif bitPerSymbol == 2&#xA;    if mod(length(bitStream),2) == 1&#xA;        bitStream = [bitStrea, 0];&#xA;    end&#xA;    for i = 1:2:length(bitStream)&#xA;        if (bitStream(i) == 0) &amp;&amp; (bitStream(i+1) == 0) &#xA;           M = [M (-3*ones(1,sampPerSymbol))];    %data = 00, amplitude = -3&#xA;        elseif (bitStream(i) == 0) &amp;&amp; (bitStream(i+1) == 1)&#xA;           M = [M -1*ones(1,sampPerSymbol)];          %data = 01, amplitude = -1&#xA;        elseif (bitStream(i) == 1) &amp;&amp; (bitStream(i+1) == 1)&#xA;            M = [M ones(1,sampPerSymbol)];          %data = 11, amplitude = 1&#xA;        elseif (bitStream(i) == 1) &amp;&amp; (bitStream(i+1) == 0)&#xA;            M = [M 3*ones(1,sampPerSymbol)];          %data = 10, amplitude = 3&#xA;        end&#xA;    end&#xA;end&#xA;t = 0:1/Fs:((length(bitStream)/bitPerSymbol)*sampPerSymbol -1)/Fs;&#xA;&#xA;&#xA;%Modulate Signal&#xA;S = M.*cos(2*pi*f*t);&#xA;&#xA;%plot graphs for transmitted signal&#xA;figure(1);&#xA;clf(1,'reset'); %clear figure, but don't close it in case you want to leave it at a specific location                                                                        &#xA;numSubPlots = 3;&#xA;currPlot = 1;&#xA;&#xA;a(currPlot) = subplot(numSubPlots,1,currPlot);&#xA;plot(t,M);&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;title('Data signal');&#xA;axis([0 t(end) (min(M)-.5) (max(M)+.5)]);&#xA;currPlot = currPlot +1;&#xA;&#xA;&#xA;a(currPlot) = subplot(numSubPlots,1,currPlot);&#xA;plot(t,cos(2*pi*f*t));&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;title('Carrier Signal');&#xA;currPlot = currPlot +1;&#xA;&#xA;&#xA;a(currPlot) = subplot(numSubPlots,1,currPlot);&#xA;plot(t,S);&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;title('Signal to be transmitted');&#xA;currPlot = currPlot +1;&#xA;&#xA;linkaxes(a,'x');&#xA;&#xA;%*********************** Receiver**********************&#xA;&#xA;r = S;&#xA;&#xA;tCorr = 0:1/Fs:(sampPerSymbol -1)/Fs;&#xA;corrSig = cos(2*pi*f*tCorr + phi);&#xA;&#xA;demodeSig = [];&#xA;for i = 1:bitPerSymbol:length(bitStream)/bitPerSymbol&#xA;    demodeSig = [demodeSig corrSig.*r((i-1)*sampPerSymbol+1:(i-1)*sampPerSymbol + sampPerSymbol)];&#xA;end&#xA;&#xA;demodeSig = r.*cos(2*pi*f*t+ phi);&#xA;&#xA;d  = fdesign.lowpass('N,F3dB,Ap', 10, 300, .5, Fs);  %creat lowpass filter with order 10, cutoff freq 300Hz, and passband ripple - .5dB&#xA;Hd = design(d, 'cheby1');&#xA;filterDemodeSig = filter(Hd,demodeSig);&#xA;&#xA;&#xA;figure(2);&#xA;clf(2,'reset'); %clear figure, but don't close it in case you want to leave it at a specific location                                                                        &#xA;numSubPlots = 3;&#xA;currPlot = 1;&#xA;&#xA;a(currPlot) = subplot(numSubPlots,1,currPlot);&#xA;plot(t,r);&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;title('Received Signal - r(t)');&#xA;currPlot = currPlot +1;&#xA;&#xA;a(currPlot) = subplot(numSubPlots,1,currPlot);&#xA;plot(t,demodeSig,'b');&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;title('r(t) \cdot cos(2 \pi f t)');&#xA;currPlot = currPlot +1;&#xA;&#xA;a(currPlot) = subplot(numSubPlots,1,currPlot);&#xA;plot(t,filterDemodeSig,'b');&#xA;xlabel('Time');&#xA;ylabel('Amplitude');&#xA;title('Low Pass filter of correlation - Recovered M(t)');&#xA;currPlot = currPlot +1;&#xA;&#xA;&#xA;linkaxes(a,'x');&#xA;&lt;/code&gt; &lt;/pre&gt;&#xA;" OwnerUserId="16913" LastActivityDate="2016-03-04T20:50:59.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29237" PostTypeId="1" AcceptedAnswerId="29238" CreationDate="2016-03-04T21:49:59.377" Score="0" ViewCount="4684" Body="&lt;p&gt;I have been reading this &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm&quot; rel=&quot;nofollow&quot;&gt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm&lt;/a&gt; and I am having trouble to perform the seperability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I kinda did it in paper. Lets say y Gaussian function is G(X,Y), then seperating them will become G(X)G(Y), and then I will need to calculate the 1D component for X and 1D component for Y. Then I can pass over my image twice using the two components each time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do have a couple of questions though (one of them is more general):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - When I calculate the 2D Gaussian why do I need to normalize it by dividing each pixel of the template with the sum of the template?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Do I need to do the same for the 1D components aswell?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - In the link it says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Figure 4 shows the 1-D x component kernel that would be used to&#xA;  produce the full kernel shown in Figure 3 (after scaling by 273,&#xA;  rounding and truncating one row of pixels around the boundary because&#xA;  they mostly have the value 0. This reduces the 7x7 matrix to the 5x5&#xA;  shown above.). The y component is exactly the same but is oriented&#xA;  vertically.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why scale the 1D component by 273? 273 is the sum of the 2D template not the 1D. And how does he truncate 1 row? The 1D X component is 1 row by itself...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&#xA;I hope my questions make sense.&lt;/p&gt;&#xA;" OwnerUserId="15860" LastActivityDate="2018-01-30T12:56:30.297" Title="2D Gaussian Seperation into 1D Gaussian components" Tags="|image-processing|gaussian|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29238" PostTypeId="2" ParentId="29237" CreationDate="2016-03-04T22:56:39.160" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;Normalization is not &quot;required&quot;. It only serves to have scale-consistent results, which a not so useful for visualization, but mostly for measurements: if the Gaussian kernel is &quot;sum normalized&quot;, the result of the filtering of a constant image is the same constant image. Constant images are &quot;invariant&quot; for smoothing. &lt;/li&gt;&#xA;&lt;li&gt;You need (or not) to do that for exactly the same reason as above. As it is separable, you can, if you want, normalize first on the 1D sum on the rows, second on the sum onn the columns.&lt;/li&gt;&#xA;&lt;li&gt;They do not scale the 1D component: the 1D kernel &lt;code&gt;g1d7&lt;/code&gt; $[   0.006  ,  0.061    ,0.242 ,   0.383  ,  0.242  ,  0.061  ,  0.006]$ has almost $1$ average. They do a tensor product of $x$ ($x'. x$) to build a $7\times 7$ kernel, and only keep the center kernel with $273$ normalization.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So,  here is, in pseudo-code with Matlab syntax, a sequence of operations that leads to the $5\times 5$ array &lt;code&gt;g2d5ci&lt;/code&gt; from Figure 3. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% 1D 7-tap Gaussian kernel&#xA;g1d7 = [0.006,0.061,.242,.383,.242,.061,0.006]';&#xA;&#xA;% 2D 7-tap Gaussian kernel, normalized to 1&#xA;g2d7 = g1d7*g1d7';g2d7 =g2d7/sum(g2d7(:));&#xA;&#xA;% 2D 5-tap Gaussian kernel cropped from the central 5x5 part of g2d7, normalized to 1&#xA;g2d5c = g2d7(2:6,2:6);g2d5c =g2d5c/sum(g2d5c(:));&#xA;&#xA;% 2D 5-tap Gaussian kernel with integer values&#xA;g2d5ci = round(273*g2d5c);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The 1D kernel is not obtained by sampling the Gaussian, but by integrating it over  sub-intervals. For instance, instead of computing $g(x) = \frac{1}{\sqrt{2\pi}\sigma}\exp\left({-\frac{x^2}{2\sigma^2}}\right)$ at $t=3$, you integrate it over the interval $[-3.5,-2.5]$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is in the following figure (pretty close, isn't?):&lt;a href=&quot;https://i.stack.imgur.com/QnAzK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QnAzK.png&quot; alt=&quot;Gaussian kernel discretization via integration&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Matlab code goes like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;increment = 0.001;sigma = 1;&#xA;time = [-3.5+increment/2:increment:3.5-increment/2]';&#xA;data = exp(-0.5*(time/sigma).^2)/(sigma*sqrt(2*pi));&#xA;plot(time,data)&#xA;data7 = reshape(data,length(data)/7,7);&#xA;data7p = sum(data7)';&#xA;data7p = data7p/sum(data7p);&#xA;&#xA;figure(1);clf;hold on&#xA;plot(time,data)&#xA;plot([-3:1:3]',g1d7,'ob')&#xA;plot([-3:1:3]',data7p,'xr')&#xA;legend('Gaussian kernel','Given values','Recomputed values')&#xA;axis tight&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2018-01-30T12:56:30.297" LastActivityDate="2018-01-30T12:56:30.297" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29239" PostTypeId="1" AcceptedAnswerId="29247" CreationDate="2016-03-04T23:03:22.820" Score="3" ViewCount="368" Body="&lt;p&gt;Now I'm trying to implement a SDLWGW algorithm by the MATLAB.&#xA;currently I'm referencing from &lt;a href=&quot;https://winnie.kuis.kyoto-u.ac.jp/local/CDROM/icassp04/pdfs/0300493.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Automatic White Balancing Using Luminance Component and Standard Deviation of RGB Components&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The problem is I can't understand  how to get a &lt;span class=&quot;math-container&quot;&gt;$SDLWA_{R}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\overline{L_{red}(k)}$&lt;/span&gt;?&#xA;Also what if the &lt;span class=&quot;math-container&quot;&gt;$L_{weight}(i,j)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$0.9$&lt;/span&gt; then how to calculate the bar of &lt;span class=&quot;math-container&quot;&gt;$L_{red}(k)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I can't understand it.&lt;/p&gt;&#xA;&lt;p&gt;I want to know that what is the different between &lt;span class=&quot;math-container&quot;&gt;$SD_{red}(k)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$SD_{red}(l)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$SDLWA_{R}=\sum_{k=1}^{n}\frac{SD_{red}(k)}{\sum_{l=1}^{n}SD_{red}(l)}\times red_{i,j}(k) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What is the &lt;span class=&quot;math-container&quot;&gt;$SD_{red}(l)$&lt;/span&gt;? Especially, what is the &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{l=1}^{n}SD_{red}(l) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h1&gt;Update 1&lt;/h1&gt;&#xA;&lt;p&gt;I have got a question one more,&lt;/p&gt;&#xA;&lt;p&gt;The paper was written like this&#xA;&lt;code&gt;L_weight(i,j)&lt;/code&gt; is a positive single-peak function (e.g Triangular function or Gaussian function) value for the luminance value at &lt;code&gt;i-th&lt;/code&gt; row, &lt;code&gt;j-th&lt;/code&gt; column of the &lt;code&gt;k-th&lt;/code&gt; block. But I can't understand what is the mean? How can I make &lt;code&gt;L_weight(i,j)&lt;/code&gt;?&#xA;Would you please give me any hint please ?&lt;/p&gt;&#xA;&lt;h1&gt;Update 2&lt;/h1&gt;&#xA;&lt;p&gt;I'm trying to understand a below answer.&lt;/p&gt;&#xA;&lt;p&gt;Q1. What if I've got a this block then I think that the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is to&#xA;be &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;. am I correct?&lt;/p&gt;&#xA;&lt;p&gt;Q2. How to get a &lt;span class=&quot;math-container&quot;&gt;$\overline{L\_red(k)}$&lt;/span&gt; value as below the case?&lt;/p&gt;&#xA;&lt;p&gt;Q2-1. Especially, I want to know that what does exactly indicate the &lt;span class=&quot;math-container&quot;&gt;$L\_weight(1,1)red_{1,1}(k)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$L\_weight(1,1)$&lt;/span&gt;, as below the case?&#xA;I think we know the value of the &lt;span class=&quot;math-container&quot;&gt;$red_{1,1}(k)$&lt;/span&gt; But I'm confused that how to know the value of &lt;span class=&quot;math-container&quot;&gt;$L\_weight(1,1)$&lt;/span&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/r14Ny.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/r14Ny.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1&gt;Update 3&lt;/h1&gt;&#xA;&lt;p&gt;Does anyone know the relationship between Gaussian weight and one Block?&lt;/p&gt;&#xA;" OwnerUserId="19834" LastEditorUserId="7092" LastEditDate="2022-06-08T21:09:04.007" LastActivityDate="2022-06-08T21:09:04.007" Title="How to get a Standard Deviation weighted average in image?" Tags="|image-processing|matlab|algorithms|gaussian|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29240" PostTypeId="1" CreationDate="2016-03-05T04:05:40.937" Score="1" ViewCount="961" Body="&lt;p&gt;I have a recording, corrupted by environment noise. The measurement noise is zero. How can I use Kalman filter to remove environment noise? I tried this Matlab code &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/5377-learning-the-kalman-filter&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; but if the measurement error covariance is set to zero, the Kalman values are always the same as the measurements. The process noise is not removed at all.&lt;/p&gt;&#xA;" OwnerUserId="19890" LastActivityDate="2016-03-05T04:39:32.220" Title="Apply Kalman filter to remove process noise, given zero measurement error" Tags="|kalman-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29241" PostTypeId="2" ParentId="29240" CreationDate="2016-03-05T04:39:32.220" Score="3" Body="&lt;p&gt;You're misunderstanding how the Kalman filter framework works. Your measurements are a reflection of what the underlying state of the system is at each time instant. If you have zero measurement covariance, then your measurements perfectly reflect the system state, so there's no need for any filter whatsoever. It's not likely that this is truly the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Process noise is a representation of uncertainty in the model for how your system's state changes as time goes on. It's not something to be &quot;removed&quot; by the Kalman filter. Instead, it gives you the ability to accommodate higher-order effects that you aren't modeling in your state transition matrix.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2016-03-05T04:39:32.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29242" PostTypeId="1" AcceptedAnswerId="29243" CreationDate="2016-03-05T08:06:47.717" Score="1" ViewCount="559" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/C9QTi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/C9QTi.png&quot; alt=&quot;system diagram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi,&#xA;I am really confused with the system in the diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input-output relation of the system is given by $y[n]=\exp(x^2[n])$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to find the transfer function of this system $Y(z)$ in $z$-domain. My question is: is it really the simple exponential system I am missing out or something complex. If otherwise what would be the system transfer function.&lt;/p&gt;&#xA;" OwnerUserId="19893" LastEditorUserId="8202" LastEditDate="2016-03-05T10:07:19.630" LastActivityDate="2016-03-05T10:07:19.630" Title="Transfer function of an Exponential system in Z domain" Tags="|discrete-signals|z-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29243" PostTypeId="2" ParentId="29242" CreationDate="2016-03-05T08:25:26.100" Score="3" Body="&lt;p&gt;This system doesn't have a transfer function, so there's no way to find it. Only linear time-invariant (LTI) systems can be described by a transfer function. In discrete-time, the $\mathcal{Z}$-transforms of input and output sequences of an LTI system are related by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z)=H(z)X(z)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(z)$ is the system's transfer function, which is the $\mathcal{Z}$-transform of its impulse response. Equation $(1)$ is another way to state that the output sequence is given by the convolution of the input sequence with the system's impulse response. If the system is not LTI there is no function $H(z)$ which relates $X(z)$ and $Y(z)$ as in Eq. $(1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your system is definitely non-linear so whoever asked you to find its transfer function is either clueless or wanted to fool you.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-05T08:25:26.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29244" PostTypeId="2" ParentId="23281" CreationDate="2016-03-05T10:23:29.680" Score="0" Body="&lt;p&gt;A very simple numerical approach:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Pad your image with zeros up to the size that you want the final image/lines to be&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Run your Hough transformation code&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Draw the lines in the padded image&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The zeros don't give you additional signal in the Hough transformation, hence the resulting lines will be the same. By padding the image, you enlarge the area to paint the lines onto.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-05T10:23:29.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29245" PostTypeId="1" AcceptedAnswerId="29249" CreationDate="2016-03-05T10:54:30.677" Score="9" ViewCount="12115" Body="&lt;p&gt;The rectangular function is defined as:&#xA;$$\mathrm{rect}(t) = \begin{cases}&#xA;0 &amp;amp; \mbox{if } |t| &amp;gt; \frac{1}{2} \\&#xA;\frac{1}{2} &amp;amp; \mbox{if } |t| = \frac{1}{2} \\&#xA;1 &amp;amp; \mbox{if } |t| &amp;lt; \frac{1}{2}. \\&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The triangular function is defined as:&#xA;$$\operatorname{tri}(t)&#xA;= &#xA;\begin{cases}&#xA;1 - |t|, &amp;amp; |t| &amp;lt; 1 \\&#xA;0, &amp;amp; \mbox{otherwise} &#xA;\end{cases}&#xA;$$&#xA;It is the convolution of two identical unit rectangular functions:&#xA;$$&#xA;\operatorname{tri}(t) = \operatorname{rect}(t) * \operatorname{rect}(t) \quad&#xA;=  \int_{-\infty}^\infty \mathrm{rect}(\tau) \cdot \mathrm{rect}(t-\tau)\ d\tau$$&#xA;Zero-order hold and First-order hold use these functions. In fact, it has:&#xA;$$&#xA;x_{\mathrm{ZOH}}(t)\,= \sum_{n=-\infty}^{\infty} x(n)\, \mathrm{rect} \left(t-n\right) \ &#xA;$$&#xA;for Zero-order hold, and&#xA;$$x_{\mathrm{FOH}}(t)\,= \sum_{n=-\infty}^{\infty} x(n)\, \mathrm{tri} \left(t-n\right) \ $$&#xA;for First-order hold. Since $\operatorname{tri}(t) = \operatorname{rect}(t) * \operatorname{rect}(t)$, I would like to know if this is just a coincidence or if, for the Second-order hold the impulse response is&#xA;$$\operatorname{tri}(t)*\operatorname{tri}(t)=\left(\operatorname{rect}(t) * \operatorname{rect}(t)\right)*\left(\operatorname{rect}(t) * \operatorname{rect}(t)\right).$$&#xA;Is it true also for a general $k$-th order hold? Namely, put&#xA;$$x_{\mathrm{K-TH}}(t)\,= \sum_{n=-\infty}^{\infty} x(n)\, \mathrm{g}_k \left(t-n\right) \ $$&#xA;where $\mathrm{g}_k \left(t-n\right)$ is the impulse response of the $k$-th order hold, I would like to know if its impulse response is&#xA;$$\mathrm{g}_k \left(t-n\right)=\left(\operatorname{rect}(t) * \operatorname{rect}(t)\right)* \dots * \left(\operatorname{rect}(t) * \operatorname{rect}(t)\right),$$&#xA;k times.&lt;/p&gt;&#xA;" OwnerUserId="17183" LastEditorUserId="4298" LastEditDate="2016-03-05T15:32:10.403" LastActivityDate="2020-07-13T22:07:39.450" Title="Zero, First, Second ... nth-order Hold" Tags="|sampling|interpolation|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29246" PostTypeId="2" ParentId="15148" CreationDate="2016-03-05T12:10:17.553" Score="1" Body="&lt;p&gt;If you consider the whole set of potential wavelet transforms, then you have a lot of flexibility. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, should you use 1D continuous complex wavelet transforms, by analyzing the modulus and the phase of the scalogram, and provided you use well-chosen wavelets (potentially different for the analysis and the synthesis), and a proper discretization, you can:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;find discontinuities and irregularities of a signal and its derivatives &lt;a href=&quot;https://i.stack.imgur.com/jg016.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jg016.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;find break point location by wavelet ridge extrapolation&lt;/li&gt;&#xA;&lt;li&gt;denoise&lt;/li&gt;&#xA;&lt;li&gt;perform matched filtering based on templates (with &lt;a href=&quot;http://arxiv.org/abs/1108.4674&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex continuous&lt;/a&gt; or &lt;a href=&quot;http://arxiv.org/abs/1405.1081&quot; rel=&quot;nofollow noreferrer&quot;&gt;discrete dual-tree wavelet&lt;/a&gt; frames)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.scholarpedia.org/article/Wavelet-based_multifractal_analysis&quot; rel=&quot;nofollow noreferrer&quot;&gt;analyse (multi-)fractalty&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;analyse frequencies (with Gabor wavelets for instance)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Due to the redundancy, and the quantity of available wavelets (not the same is best for different purposes), they could  appear a little less efficient for the analysis of pure stationary and harmonics signals, for which Fourier is better suited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main drawbacks are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;for fine analysis, it becomes computationaly intensive &lt;/li&gt;&#xA;&lt;li&gt;its discretization, the discrete wavelet transform (comp. efficient), is less efficient and natural&lt;/li&gt;&#xA;&lt;li&gt;it  take some energy to invest in wavelets to become able to choose the proper ones for a specific purpose, and to implement it correcly.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-05T12:10:17.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29247" PostTypeId="2" ParentId="29239" CreationDate="2016-03-05T13:32:59.503" Score="1" Body="&lt;p&gt;The $k$ and $l$ indices are to be understood with indexes under the $\sum$ sign. They can be called &quot;free variables&quot;. Suppose that the block $k$ has only two pixels, then $p=1$ and $q=2$. So $\overline{L\_red(k)} $ is just a weighted average (a kind of center of mass) of the $2$ red components from the two pixels  of the block:&#xA;$$ \frac{L\_weight(1,1)red_{1,1}(k)+L\_weight(1,2)red_{1,2}(k)}{L\_weight(1,1)+L\_weight(1,2)} $$&#xA;which gives you a single value for each block.&#xA;Formula (5) has the same interpretation,  you perform the weighted average of those averaged values over blocks, with weights $SD\_red(k)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;it is quite easy to use &lt;a href=&quot;http://www.peteryu.ca/tutorials/matlab/blockaverage&quot; rel=&quot;nofollow&quot;&gt;Matlab's block processing tools&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-05T13:32:59.503" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="29248" PostTypeId="2" ParentId="19119" CreationDate="2016-03-05T14:00:34.240" Score="0" Body="&lt;p&gt;If you differentiate in the $x$ direction, due  to the separability, you simply replace the scale factor $\sigma$ that goes out of the exponential by  $\sigma_x$ (potentially with its square), the same in the $y$-direction. If you differentiate two times, you will get some $\sigma_x^2\sigma_y^2$, $\sigma_x^4$ or $\sigma_y^4$ instead of $\sigma^4$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your formula should be consistent with the former ones when you set  $\sigma_x = \sigma_y = \sigma$.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-05T14:00:34.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29249" PostTypeId="2" ParentId="29245" CreationDate="2016-03-05T16:03:25.953" Score="9" Body="&lt;p&gt;This is not the case. First of all, a second-order hold would use three sample points to compute an interpolation polynomial, but your suggested impulse response $\text{tri}(t)\star\text{tri}(t)$ is non-zero in an interval of size $4$ (assuming a sample interval of $T=1$, as you do in your question). However, the impulse response corresponding to a second-order hold must have a support of length $3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you could suggest that an $n^{th}$-order hold could have an impulse response which is the convolution of $n$ rectangular functions. In this case you would get the correct support size, but of course that's not sufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An $n^{th}$-order hold computes a piece-wise interpolation using $n+1$ consecutive data points. This is in analogy with a zero-order hold using a single data point, and a first-order hold, which uses two data points. This definition is commonly used in the literature (see e.g. &lt;a href=&quot;https://books.google.at/books?id=D_zXMLtYUpsC&amp;amp;lpg=PA272&amp;amp;ots=fpOiHyZv5a&amp;amp;dq=nth%20order%20hold&amp;amp;pg=PA272#v=onepage&amp;amp;q=nth%20order%20hold&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.eolss.net/sample-chapters/c18/e6-43-04-02.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's straightforward to show that the second-order polynomial that interpolates three data points $y[-1]$, $y[0]$, and $y[1]$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P(t)=y[-1]\frac{t(t-1)}{2}+y[0](1-t^2)+y[1]\frac{t(t+1)}{2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to find the impulse response achieving the interpolation given by $(1)$, we have to equate $(1)$ with the expression&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[-1]h(t+1)+y[0]h(t)+y[1]h(t-1)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we choose the support of the impulse response $h(t)$ as the interval $[-1,2]$, which is equivalent to choosing the interpolation interval $[0,1]$, equating $(1)$ and $(2)$ results in the following impulse response of a second-order hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t)=\begin{cases}\frac12(t+1)(t+2),&amp;amp;\quad -1&amp;lt;t&amp;lt;0\\&#xA;1-t^2,&amp;amp;\quad0\le t \le 1\\&#xA;\frac12 (t-1)(t-2),&amp;amp;\quad 1&amp;lt;t&amp;lt;2\\&#xA;0,&amp;amp;\quad\text{otherwise}\end{cases}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The impulse response $(3)$ of a second-order hold looks like this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/koqX1.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/koqX1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I leave it up to you to show that this impulse response cannot be generated by convolving three rectangular functions with each other.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-03-27T18:44:52.593" LastActivityDate="2016-03-27T18:44:52.593" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29251" PostTypeId="1" CreationDate="2016-03-05T07:40:24.720" Score="3" ViewCount="4524" Body="&lt;p&gt;I'm trying to understand how to derive the BEP for 8PSK by geometrically looking at the decision regions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have this 8PSK signal set and the corresponding decision boundaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7jm8r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7jm8r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that '000' is sent, and I want to calculate the BEP. So I have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_b(e) = \frac{1}{3}(1 \times R_1 + 1 \times R_2 + 2 \times R_3 + 1 \times R_4 + 2 \times R_5 + 2 \times R_6 + 3 \times R_7)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $R_1 = R_4$, $R_3 = R_5$ and $R_2 = R_7$ by symmetry, the above can be simplified to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_b(e) = \frac{2}{3}(R_1 + 2R_2 + 2R_3 + R_6)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_1 + R_2 + R_3 + R_6 = P\Big(n &amp;gt; d_1\sin\frac{\pi}{8}\Big)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_2 + R_3 = P\Big(n_0 &amp;gt; d_1\sin\frac{3\pi}{8}\Big) \times P\Big(n_1 &amp;lt; d_1\sin\frac{\pi}{8}\Big)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having a hard time visualizing and understanding how $(1)$ and $(2)$ are obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that $n$ is the noise vector, and $n_0$ and $n_1$ are the horizontal and vertical components of the noise vector, and we are trying to find out how far $n$ or $n_0$ and $n_1$ will go to &quot;push&quot; the signal into the wrong decision region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen the following from this &lt;a href=&quot;http://iwct.sjtu.edu.cn/Personal/mxtao/course_comm/comm_ch08_digmod_en.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;website&lt;/a&gt;, and it seems to explain $(1)$, that is, the noise vector $n$ &quot;pushes&quot; the signal past the decision line (dl) into the wrong decision regions $R_1 + R_2 + R_3 + R_6$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about $(2)$? I don't know why we have $\sin\frac{3\pi}{8}$ and $\sin\frac\pi8$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UwtWC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UwtWC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is the noise vector always perpendicular to the decision boundaries?&lt;/p&gt;&#xA;" OwnerUserId="19903" OwnerDisplayName="Rayne" LastEditorUserId="20082" LastEditDate="2016-03-16T16:44:47.040" LastActivityDate="2021-12-04T21:03:04.150" Title="Bit Error Probability for 8PSK" Tags="|digital-communications|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29253" PostTypeId="2" ParentId="29251" CreationDate="2016-03-05T21:15:48.097" Score="4" Body="&lt;p&gt;The way I learned this is there's two ways to find the probability of error. You can find the exact or as estimated probability. Exact is typically calculated for signal space where the points are in a rectangular pattern, because you're decision regions are nice and easy. You would see this rectangular pattern in a 4-QAM, 16-QAM, etc.&lt;/p&gt;&#xA;&lt;p&gt;For estimated probability, we use the Union Bound. This states that the symbol probability of error = &lt;span class=&quot;math-container&quot;&gt;$P_{se|1} = \sum P_{se}($&lt;/span&gt;between point 1 and each other individual point&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt;. Out total symbol probability of error&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_{se} = $$\frac{\sum_{i=1}^M P_{es|i} }{M} $&lt;/span&gt; where M is the number of points on our signal space (&lt;span class=&quot;math-container&quot;&gt;$M= 8$&lt;/span&gt; in this case)&lt;/p&gt;&#xA;&lt;p&gt;This means we're take a single point, and then with each other individual point we're going to create a new decision boundaries exactly half way between to the two and find the probability of error for just those two points. We do that for all the points, add them up, and now we have an estimated probability of error for the symbol. So let's say our noise is Gaussian, the variance of our noise &lt;span class=&quot;math-container&quot;&gt;$\sigma^2 = \frac{N_0}{2}$&lt;/span&gt;. Let's say D is the distance between two points. The probability of error between those two points &lt;span class=&quot;math-container&quot;&gt;$= Q(\frac{D}{2\sigma}) = Q(\frac{\sqrt2 \cdot D}{\sqrt N_0})$&lt;/span&gt; So, let's look at point 000 in your examples. We can use cosine theory to find the distance between two points.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$D^2 = D_1^2 + D_2^2 -2\cdot D_1 \cdot D_2 \cdot cos(\theta)$&lt;/span&gt;  where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the angle between two points. Note &lt;span class=&quot;math-container&quot;&gt;$D_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D_2$&lt;/span&gt; are the distances from the origin of our points, and in this case &lt;span class=&quot;math-container&quot;&gt;$D_1 = D_2$&lt;/span&gt; because all points are&#xA;the same distance from the origin.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;P_{se} &amp;amp;=  Q(\frac{d_1\cdot \sqrt {2+\sqrt2}}{2 \sigma})  +  Q(\frac{d_1\cdot \sqrt {2+\sqrt2}}{2 \sigma})  +Q(\frac{\sqrt2\cdot d_1}{2 \sigma}) + Q(\frac{\sqrt2\cdot d_1}{2 \sigma}) +\ldots\\&#xA;P_{se} &amp;amp;= 2\cdot Q(\frac{d_1\cdot \sqrt {2+\sqrt2}}{2 \sigma}) + 2 \cdot Q(\frac{\sqrt2\cdot d_1}{2 \sigma})+\ldots&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We could go on, but since the &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; function falls off so quickly, we really only care about the point(s) closes to what we're comparing too. All the other terms are insignificant cared to that. So we end up with &lt;span class=&quot;math-container&quot;&gt;$P_se = 2\cdot Q(\frac{d_1\cdot \sqrt {2+\sqrt2}}{2 \sigma})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That's the symbol probability of error if we look at the point 000. We can calculate this for the other points, but it's just going to be the exact same due to symmetry. Since the Probability of error is the same for each symbol, we know the probability of error for all symbols is what we found above.&lt;/p&gt;&#xA;&lt;p&gt;This is for symbol probability of error. To get to bit probability of error we have to look at our bit mapping. Since each point will only have two points that are closest to it, we can implement Gray coding. That means we can divide our symbol probability by &lt;span class=&quot;math-container&quot;&gt;$log_2(M)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$M =$&lt;/span&gt; the number of different points we have on our signal space, which is 8 in this case. Therefore our &lt;span class=&quot;math-container&quot;&gt;$P_{be}$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_{be} = \frac{P_{es}}{log_2(8)} = \frac{2\cdot Q(\frac{d_1\cdot sqrt(2+sqrt(2))}{(2 \sigma)})}{3}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="16913" LastEditorUserId="13320" LastEditDate="2021-11-19T21:12:24.267" LastActivityDate="2021-11-19T21:12:24.267" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29255" PostTypeId="1" AcceptedAnswerId="29260" CreationDate="2016-03-06T03:42:12.143" Score="0" ViewCount="1833" Body="&lt;p&gt;I currently have a real-time noise suppression algorithm based on two inputs from different microphones. It has passed most tests that I have thrown at it, however when the signal I am trying to retrieve has a slight delay one mic relative to the other it works poorly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done preprocessing delay estimation in the input signal through cross-correlation just for testing and it works, however in the final algorithm I can't preprocess the signal as it is supposed to be real-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am taking sub windows of signals and applying my algorithm, what I tried to do is apply the cross-correlation to each sub window, it takes the FFT of the sub windows does the calculation and then the IFFT just to get the delay each time. I later have to take the FFT of the sub window with a different windowing function for my filtering algorithm. This much extra processing will drastically reduce the sub window size my algorithm can keep up with in real-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, is there a faster way to do this delay estimation? Maybe something that works with each input sample to get a better estimation each time? Something like a control loop? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="19901" LastActivityDate="2016-03-06T07:43:54.390" Title="Real-time delay between signals" Tags="|matlab|cross-correlation|real-time|delay|multi-channel|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="29258" PostTypeId="2" ParentId="29030" CreationDate="2016-03-06T07:30:13.483" Score="0" Body="&lt;p&gt;I found this ppt: &lt;a href=&quot;http://www.ece.drexel.edu/walsh/Gwanmo-Nov11-2.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.ece.drexel.edu/walsh/Gwanmo-Nov11-2.pdf&lt;/a&gt; (slides 9-12) where I saw a bit of light regarding on how the method 1 calculates TB size:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For data, there are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;10 OFDM symbols per subframe x 12 subcarriers = 120 (we are counting the 6 RS symbols and excluding the PDCCH symbols)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;120 symbols x 50 RBs x 2 bits/symbol (QPSK) = 12000 bits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For QPSK we know that the efficiency is 0.15 (approx.), so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;12000 x 0.15 = 1800 bits, as in table Table7.1.7.2.1 3GPP TS 36.312 for 50 RBs and I_TBS=1 (sorry, in my question I made a mistake and wrote I_TBS 9 the second time: can’t edit it in the forum)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in the simulator, using method 2, we are considering:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Number of non-sync symbols per RB= 12×7 – 4 (RS symbols)=80 OFDM symbols per slot&lt;/p&gt;&#xA;&#xA;&lt;p&gt;80 non-sync symbols x 50 RBs x 2 bits/symbol x 0.0762 x 2 slots =1219 bits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1219 bits -24 bits for the CRC = 1195 bits :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, let me know if you don’t agree with these methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTS.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-06T07:30:13.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29259" PostTypeId="1" AcceptedAnswerId="29267" CreationDate="2016-03-06T07:34:31.513" Score="1" ViewCount="964" Body="&lt;p&gt;As part of a project I have a video from a quadrotor that captures the road and the environment around it and I want to identify and detect potholes and speedbumps on the road using image processing. What is the best approach for this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I've done until now.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1CSqA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1CSqA.png&quot; alt=&quot;output&quot;&gt;&lt;/a&gt;&#xA;The video feed is converted into grey scale and I use one particular portion of it(marked by the blue rectangle) for processing. In that window, I again get smaller windows of and I calculated their corresponding Grey Level co-occurrence Matrix (GLCM henceforth) of all those windows. I calculated the textural features from the GLCMs like ASM, erratic homogeneity etc and I plotted them as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did this with the hope that there will be some kind of obvious change in the features when the blue rectangle reaches the speed bump(which is slightly ahead in the image). But the results erratic and I cannot make a definite decision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is any other approach, or if there's any change I could implement to get better results in the same method do let me know. &lt;/p&gt;&#xA;" OwnerUserId="19905" LastEditorUserId="19905" LastEditDate="2016-03-06T09:04:06.367" LastActivityDate="2016-03-06T13:37:09.087" Title="How to approach detection of anomalies in a video feed?" Tags="|image-processing|computer-vision|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29260" PostTypeId="2" ParentId="29255" CreationDate="2016-03-06T07:43:54.390" Score="1" Body="&lt;p&gt;I can't comment because I'm a new user... have a look to these questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8737/estimating-the-time-offset-delay-between-two-audio-signals-in-real-time?rq=1&quot;&gt;Estimating the time offset (delay) between two audio signals in real-time&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/8732/generalized-cross-correlation&quot;&gt;Generalized Cross Correlation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/1949/time-delay-estimation-of-oscilloscope-signals-using-cross-correlation?rq=1&quot;&gt;Time delay estimation of oscilloscope signals using cross correlation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19904" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-03-06T07:43:54.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29262" PostTypeId="2" ParentId="27560" CreationDate="2016-03-06T09:26:31.423" Score="4" Body="&lt;p&gt;As said by @robert bristow-johnson, a squared window is another window. If you take a quite standard type, symmetric, unimodal, positive (with the related question &lt;a href=&quot;https://dsp.stackexchange.com/questions/36247/conditions-for-symmetric-and-unimodal-windows-in-both-time-and-frequency-domains&quot;&gt;Conditions for symmetric and unimodal windows in both time and frequency domains&lt;/a&gt;) and peaking at $1$, like a Hamming window, you can see the following behavior:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wzINh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wzINh.png&quot; alt=&quot;Hamming and squared Hamming window&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The squared one is below the original, due to the contractive effect  of $t \to t^2$ in $[0,1]$ (in other words, $t^2\le t$), while keeping the same maximum location. So the window is better localized, and gets improved apodizing at the ends, which can be useful to reduce &quot;blocking&quot; artifacts at the edges of overlapped frames: if the original window ends at $0.1$, its squared version ends at  $0.01$, a ten-fold reduction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other effect is that the new window is close to energy-normalized. Even if your &quot;window&quot; is zero-mean (like a wavelet), the energy of its square is never zero (unless the window is zero), so you can use it as a weighted average, of the shape (similar to equation 4):&#xA;$$\frac{\sum a^2(k).x(k)}{\sum a^2(k)}\,.$$&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2017-07-17T13:59:37.743" LastActivityDate="2017-07-17T13:59:37.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29263" PostTypeId="1" AcceptedAnswerId="29265" CreationDate="2016-03-06T10:23:42.993" Score="3" ViewCount="2393" Body="&lt;p&gt;Is Hilbert transform not defined for complex signals?  In MATLAB, the function hilbert ignores if you give a complex sequence as input.  Why?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2020-01-21T19:42:30.033" Title="Is Hilbert transform not defined for complex signals?" Tags="|hilbert-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29264" PostTypeId="2" ParentId="29259" CreationDate="2016-03-06T11:05:34.070" Score="0" Body="&lt;p&gt;Here is some brainstorming: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have two interesting variables here, I would say: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;spatial changes in &lt;code&gt;y&lt;/code&gt;-direction (left to right) &lt;/li&gt;&#xA;&lt;li&gt;temporal changes (&lt;code&gt;t&lt;/code&gt;-direction).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would not directly include the &lt;code&gt;x&lt;/code&gt;-direction (up-down direction) in the first try, since this is correlated to the &lt;code&gt;t&lt;/code&gt;-direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Calculate the &lt;code&gt;y&lt;/code&gt;-gradient&lt;/li&gt;&#xA;&lt;li&gt;Calculate the &lt;code&gt;t&lt;/code&gt;-gradient&lt;/li&gt;&#xA;&lt;li&gt;Create a binary mask from both using two threshold values (you probably have to figure them out in a test run), so that the whole image is zero where there is no change and one where there is a change. &lt;/li&gt;&#xA;&lt;li&gt;To suppress spurious noise in the binary mask, you could median-filter it with a 5-by-5 or 7-by-7 median filter (try out the best size)&lt;/li&gt;&#xA;&lt;li&gt;Use a morphologic dilate filter to close &quot;holes&quot; in the binary mask and also to dilate the masks so that they do have a broader overlap&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This way you are directly using the visual features of the image - changes in the gray values. Now a few things can happen with those two masks&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Areas of the &lt;code&gt;t&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; masks overlap: You have a change in the image in &lt;code&gt;y&lt;/code&gt; direction and there is also a change between to consecutive images - you found a localized change that could be a hole or a speedbump&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is a change in &lt;code&gt;y&lt;/code&gt; direction, but no or just a small area in &lt;code&gt;t&lt;/code&gt; direction: That could be a road marking (the algorithm might fail if your drone tumbles quite strongly and your camera has a low number of frames per second - then the &lt;code&gt;t&lt;/code&gt;-gradient might be quite high in this case. To suppress those signal changes from lane markings, you could suppress lines in the binary mask by a Hough-transformation of the mask and kicking out pairs of dots)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is change in &lt;code&gt;t&lt;/code&gt; but not in &lt;code&gt;y&lt;/code&gt; - probably a lane mark that started/stopped&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If this really works with your data, I do not know. However, starting with simple things can lead you into a quite robust and reasonably fast direction for your image processing task. &lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-06T11:05:34.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29265" PostTypeId="2" ParentId="29263" CreationDate="2016-03-06T11:47:05.773" Score="8" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;noreferrer&quot;&gt;Hilbert transform&lt;/a&gt; &lt;em&gt;can&lt;/em&gt; be applied to complex functions of a real variable. E.g., the Hilbert transform of the complex exponential $e^{j\omega_0t}$, $\omega_0&amp;gt;0$, is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal{H}\{e^{j\omega_0t}\}=-je^{j\omega_0t},\qquad\omega_0&amp;gt;0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem you encounter has to do with Matlab's implementation of the function &lt;code&gt;hilbert.m&lt;/code&gt;. It is designed for real-valued input sequences and it will ignore any imaginary part. Note that despite its name this function does not simply return the Hilbert transform of the input vector, but it computes the corresponding &lt;a href=&quot;https://en.wikipedia.org/wiki/Analytic_signal&quot; rel=&quot;noreferrer&quot;&gt;analytic signal&lt;/a&gt;, i.e. it returns a complex vector, the real part of which is equal to the input vector, and the imaginary part of which is the Hilbert transform of the input vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if for whatever reason you want to compute the Hilbert transform of a complex vector, you need to do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;x = ...    % some complex vector&#xA;xr = real(x);&#xA;xi = imag(x);&#xA;xr_ = imag(hilbert(xr));    % Hilbert transform of real part&#xA;xi_ = imag(hilbert(xi));    % Hilbert transform of imaginary part&#xA;x_ = xr_ + 1i * xi_;        % Hilbert transform of complex vector x&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-03-06T14:54:58.377" LastActivityDate="2016-03-06T14:54:58.377" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29266" PostTypeId="1" AcceptedAnswerId="29268" CreationDate="2016-03-06T13:06:49.167" Score="0" ViewCount="343" Body="&lt;p&gt;How does iZotope RX handle the FFT (i.e. how does it manage to perform those processes in the frequency domain without creating glitches) since its able to e.g.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply another DSP process (even time-domain) into a spectral part (i.e. apply e.g. a phaser onto individual parts of the FFT). &lt;/li&gt;&#xA;&lt;li&gt;Attenuate or gain spectral    parts (without touching the surrounding parts).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is it really frequency domain filtering or time domain using time domain filters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4KvQC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4KvQC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought this kind of processing was impossible:&lt;br&gt; &lt;a href=&quot;https://dsp.stackexchange.com/questions/6220/why-is-it-a-bad-idea-to-filter-by-zeroing-out-fft-bins&quot;&gt;Why is it a bad idea to filter by zeroing out FFT bins?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16003" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2016-03-06T14:26:25.407" Title="iZotope RX's FFT processing?" Tags="|audio|filtering|frequency-domain|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29267" PostTypeId="2" ParentId="29259" CreationDate="2016-03-06T13:30:19.943" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;As part of a project I have a video from a quadrotor that captures the&#xA;  road and the environment around it and I want to identify and detect&#xA;  potholes and speedbumps on the road using image processing. What is&#xA;  the best approach for this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are two approaches that can be taken at this. One operates in two dimensions, the other in three. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neither is going to be &quot;easy&quot; but the application is interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Working in two dimensions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, try to resolve &lt;em&gt;potholes&lt;/em&gt; and &lt;em&gt;speed bumps&lt;/em&gt; using the video stream from a single camera on the quadro-copter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a simple pattern recognition problem where a &lt;em&gt;pothole&lt;/em&gt; is defined as &quot;a patch of asphalt with a definite shape that is not as smooth as its surrounding&quot; and a &lt;em&gt;speed bump&lt;/em&gt; as &quot;a band of asphalt, usually vertical to the direction of the road that has a checker-board pattern on it&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this to work well, the drone will need to fly higher, with a down facing stabilised camera and auto-pilot on the height (&lt;strong&gt;with respect to the ground&lt;/strong&gt;). This will provide a clear video stream that is also &quot;slow&quot; enough to avoid motion-blur artifacts and makes it easier for simple algorithms to process the video on a frame-by-frame basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &quot;training&quot; video will need to be recorded which will be used to isolate representative &lt;em&gt;pothole&lt;/em&gt; and &lt;em&gt;speed-bump&lt;/em&gt; patches that will be used to train a very simple classifier. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The features mentioned in the original question would probably work well, especially GLCM, as it makes it easy to discriminate different textures. Information on colour can be used as well to easily reject things that could get in the way (for example leafs, branches, people etc). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, fly with the quad, collect the video, mark the areas of interest, calculate feature values for 4 (possible) classes of ROAD, NOT ROAD, POTHOLE and SPEEDBUMP and use them to build the decision boundaries. For more information about this, please see &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/classify.htm&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the simpler approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Working in three dimensions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, try to resolve &lt;em&gt;potholes&lt;/em&gt; and &lt;em&gt;speed bumps&lt;/em&gt; using either successive frames from a single camera on the quadrocopter or fitting a stereo-camera on the quadrocopter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The same comment for the flight path applies here as well, fly higher with a down-facing camera).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either of these options poses further difficulties. Both of these solutions are trying to take advantage of parallax to derive the third dimension (depth). For more information about parallax please see &lt;a href=&quot;https://en.wikipedia.org/wiki/Parallax&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt; and &lt;a href=&quot;http://www.geog.ucsb.edu/~jeff/115a/lectures/stereoscopy_and_height_measurement.html&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, a &lt;em&gt;pothole&lt;/em&gt; is defined as &quot;a hole in the average level of what is perceived as ground&quot; and a &quot;speed bump&quot; is defined as &quot;a bump in the average level of what is perceived as ground&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, successive frames of the video feed ($n$, $n+1$ where $n$ is the frame number) would need to be processed to derive a &quot;height&quot; map of the scene which would then be used to detect &lt;em&gt;very low&lt;/em&gt; and &lt;em&gt;very high&lt;/em&gt; areas (with &lt;em&gt;very low&lt;/em&gt; and &lt;em&gt;very high&lt;/em&gt; depending on the application). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, for this solution to work effectively, the information from the GPS (and ideally gyroscopes too) would be required to be able to tell how far has the camera travel between two frames and how much it rotated towards a direction. All of these parameters need to be taken into account to derive a reliable &quot;height&quot; map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The task becomes a little bit easier if a stereo-camera was to be used, some of which already support extracting the &quot;height&quot; map via their APIs (for example &lt;a href=&quot;https://www.stereolabs.com/&quot; rel=&quot;nofollow&quot;&gt;this one&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, because of reasons to do with how parallax works, there would be limits in how deep a hole or how high a bump you can detect as a function of drone flight level. Furthermore, the lower the drone flies, the more motion-blur the images would be getting which would make recognition even more difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2016-03-06T13:37:09.087" LastActivityDate="2016-03-06T13:37:09.087" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29268" PostTypeId="2" ParentId="29266" CreationDate="2016-03-06T14:26:25.407" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://help.izotope.com/docs/rx/pages/userguide_spectralrepair.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spectral Repair&lt;/a&gt; is more complex than just muting a handful of harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But first, let's just clarify that as far as Linear Time Invariant (LTI) systems are concerned, their processing can be applied, equivalently, either in the time domain (via the operation of convolution) or the frequency domain via either the &lt;a href=&quot;https://en.wikipedia.org/wiki/Overlap%E2%80%93add_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;overlap-add&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Overlap%E2%80%93save_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;overlap-save&lt;/a&gt; methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;iZotope's Spectral Repair performs interpolation. That is, to remove an unwanted portion of a recording, it will try to &quot;mimic&quot; the characteristics of the spectrum in either ends of the unwanted region.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zbyAo.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zbyAo.jpg&quot; alt=&quot;Railings with a uniform background&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't we just remove the railings by copying and pasting the grass from another (and very similar) part of the image and adjust its brightness? Couldn't we even replicate how the green colour varies in the grass portions and just generate some &quot;new&quot; grass for the regions of the railings?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it going to look odd? Possibly, if it was overdone, but for small regions it may be good enough to fool the eye.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what the &quot;Replace&quot; mode (and &quot;Attenuate&quot;) does in iZotope, but instead of &lt;em&gt;grass&lt;/em&gt; and &lt;em&gt;railing&lt;/em&gt; there is &lt;em&gt;background noise&lt;/em&gt; and &lt;em&gt;local disturbance&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not so much attenuation (or &quot;setting harmonics to zero&quot;) as &quot;masking&quot; or &quot;hiding&quot; the unwanted sound, since it attempts to make up a good enough patch of harmonics to bury it in by &quot;looking at&quot; the surroundings of the disturbance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information on interpolation please see &lt;a href=&quot;https://en.wikipedia.org/wiki/Interpolation&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt;. For an example of &quot;learning the profile and applying a filter&quot; please see &lt;a href=&quot;http://wiki.audacityteam.org/wiki/Noise_Reduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt; and &lt;a href=&quot;http://manual.audacityteam.org/o/man/repair.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2016-03-06T14:26:25.407" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29270" PostTypeId="1" AcceptedAnswerId="29306" CreationDate="2016-03-06T19:05:03.693" Score="2" ViewCount="668" Body="&lt;p&gt;I ran into a strange bug while implementing a complex band-pass filter. The filter design process is based on the windowing method and seems to be working well, but when i apply the coefs of the filter on my time domain input samples and perform DFFT the carrier frequency is doubled. I can´t really figure out why is this happening but my guess is that i'm doing something bad during the convolution. The first plot shows the magnitude response of the complex band pass filter. The second plot shows FFT of my input 5kHz carrier signal, the third one shows the same data but with BP filter applied. Everything is happening in the complex plain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7huYn.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7huYn.jpg&quot; alt=&quot;complex band pass filter&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Luy0o.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Luy0o.jpg&quot; alt=&quot;No filter applied - 5kHz carrier&quot;&gt;&lt;/a&gt; &#xA;&lt;a href=&quot;https://i.stack.imgur.com/LP8BZ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LP8BZ.jpg&quot; alt=&quot;Band-pass filter applied on the same 5kHz carrier input&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16270" LastEditorUserId="4298" LastEditDate="2016-03-06T20:11:32.233" LastActivityDate="2019-11-13T04:09:42.610" Title="Band-pass filter doubles the frequency" Tags="|filters|frequency-spectrum|convolution|bandpass|" AnswerCount="3" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="29272" PostTypeId="2" ParentId="29270" CreationDate="2016-03-06T23:13:29.120" Score="2" Body="&lt;p&gt;You complex multiplication code inputs 2 samples for every output sample.  That will act as a frequency doubler.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-06T23:13:29.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29273" PostTypeId="1" CreationDate="2016-03-07T03:17:54.083" Score="1" ViewCount="155" Body="&lt;p&gt;I'm working on a project at school and the first step is to choose a dsp/evaluation board but I'm having trouble. The project is to create a system that can be used for a variety of audio applications (such as sound localization or digital effects processing). Because of this the evaluation board should have at least 3 inputs and 1 output. Some other requirements at 16 bits/sample and at least a 16KHz sampling rate and the ability to operate in real time. The final result should be a setup where to do a new audio project, one would only have to do simple coding (preferably C, or maybe python). Thanks for any recommendations or general help, feel free to ask more questions about the project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ryan&lt;/p&gt;&#xA;" OwnerUserId="19913" LastActivityDate="2017-07-31T00:02:05.330" Title="Multichannel input/output evaluation board" Tags="|audio|sound|real-time|hardware|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29274" PostTypeId="2" ParentId="29270" CreationDate="2016-03-07T06:41:49.973" Score="0" Body="&lt;p&gt;what's your sample frequency, fm? did you apply Nyquist theorem? You may need to do fm/2=fe and then transform the pass band, Wp, and the band eliminated, Ws, into Wp/fe and Ws/fe.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-07T06:41:49.973" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29275" PostTypeId="1" AcceptedAnswerId="29276" CreationDate="2016-03-07T07:21:22.987" Score="1" ViewCount="120" Body="&lt;p&gt;In MATLAB, there is a command called &lt;code&gt;hilb(n)&lt;/code&gt; which it says gives a Hilbert matrix of order &lt;code&gt;n&lt;/code&gt;.  Is this matrix the one used for Hilbert transformation?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="1629" LastEditDate="2016-03-07T10:35:51.447" LastActivityDate="2016-03-07T10:35:51.447" Title="What is the relation between hilb and Hilbert transform in MATLAB?" Tags="|matlab|hilbert-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29276" PostTypeId="2" ParentId="29275" CreationDate="2016-03-07T07:49:41.883" Score="2" Body="&lt;p&gt;No, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_matrix&quot; rel=&quot;nofollow&quot;&gt;Hilbert matrix&lt;/a&gt; has nothing to do with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_transform&quot; rel=&quot;nofollow&quot;&gt;Hilbert transform&lt;/a&gt;, other than that both are named after the famous German mathematician &lt;a href=&quot;https://en.wikipedia.org/wiki/David_Hilbert&quot; rel=&quot;nofollow&quot;&gt;David Hilbert&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-07T07:49:41.883" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29278" PostTypeId="1" AcceptedAnswerId="29279" CreationDate="2016-03-07T09:26:41.167" Score="1" ViewCount="207" Body="&lt;p&gt;I read &lt;strong&gt;Digital Signal Processing&lt;/strong&gt; of author &lt;strong&gt;G.Proakis&lt;/strong&gt; and see this FIR Filter Structure. I understand all about this but I wonder that what is &lt;strong&gt;purpose of classification to 4 structures&lt;/strong&gt;? &#xA;Here is this section:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/71FYR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/71FYR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19766" LastEditorUserId="4298" LastEditDate="2016-03-07T09:44:29.977" LastActivityDate="2016-03-07T09:44:29.977" Title="Purpose of FIR Filter Structure" Tags="|filters|finite-impulse-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29279" PostTypeId="2" ParentId="29278" CreationDate="2016-03-07T09:43:20.853" Score="5" Body="&lt;p&gt;These are just different ways to implement FIR filters. In theory these structures are all equivalent in the sense that they compute exactly the same output signal for a given input signal (under ideal circumstances, i.e., infinite precision), but in practice they behave differently. The differences are mainly the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;their behavior when implemented with finite word-length&lt;/li&gt;&#xA;&lt;li&gt;computational complexity&lt;/li&gt;&#xA;&lt;li&gt;memory requirements&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm sure that if you continue reading the book, these structures will be explained in more detail, and their relative merits will be discussed.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-07T09:43:20.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29280" PostTypeId="2" ParentId="29273" CreationDate="2016-03-07T10:25:53.500" Score="1" Body="&lt;p&gt;This is a little bit of a tricky question because it is homework and a direct answer would simply equate to doing that homework which is not what this website is about. Apart, from the purely technical bit of the right decisions, which you should do entirely on your own, I am interpreting this question as &quot;There are so many options out there! Where do I start? I am lost!&quot; and I am providing the following answer on a general framework that can be used in these cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Very briefly: Use a requirements matrix to rank your options. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The requirements matrix lists each of the requirements of the project. These are already available (Minimum sampling frequency, C compiler, number and type of I/O, real-time requirements, etc). Some of the requirements of course will need further unpicking. For example, the requirement &quot;Capable of doing sound localisation&quot; immediately leads to the question of &quot;How accurate does this have to be?&quot; which tightens the requirements of sampling frequency and data processing. Is floating point processing required or fixed point? Is the board fast enough to emulate floating point? And other similar considerations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each design option, add one column and provide a simple answer of how well does it cover that requirement. For example, suppose that you have an audio design project and your possible implementation options are Product 1, product 2, product 3, ... and each one has different ways of providing an audio output (Simple filtered Pulse Width Modulation, audio chipset, virtual sound card, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the very minimum, this matrix will help in selecting the one option that covers the most requirements for the design. More elaborate scoring scales are possible but also application dependant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, please see &lt;a href=&quot;http://www.me.umn.edu/courses/me4054/lecnotes/LecSpring2013/6T-Concept_Selection.pdf&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2016-03-07T10:25:53.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29281" PostTypeId="2" ParentId="26220" CreationDate="2016-03-07T10:25:56.703" Score="0" Body="&lt;p&gt;Have you tried filling wall by doing:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; nhood = true(6);&#xA; closeBW = imclose(BWImage,nhood);&#xA; figure;&#xA; imshow(closeBW);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19916" LastEditorUserId="1212" LastEditDate="2016-03-07T10:32:28.530" LastActivityDate="2016-03-07T10:32:28.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29283" PostTypeId="1" CreationDate="2016-03-07T11:07:59.983" Score="0" ViewCount="87" Body="&lt;p&gt;suppose if we send AM modulated message signal through space how the receiver will be knowing that we applied AM modulation basically how it will be knowing that which modulation is applied for our modulated signal&lt;/p&gt;&#xA;" OwnerUserId="18316" LastActivityDate="2016-03-07T17:07:42.440" Title="suppose if we send AM modulated message signal through space how the receiver will be knowing that we applied AM modulation?" Tags="|digital-communications|signal-detection|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29284" PostTypeId="2" ParentId="29283" CreationDate="2016-03-07T12:37:43.020" Score="5" Body="&lt;p&gt;Communications systems are always designed under the assumption that both emitter and receiver know what &quot;language&quot; they will be speaking to each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AM modulation comms are standardized in frequency, channel width for example. So each receiver is materially designed to demodulate AM signals with the appropriate hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When people start trying to find which modulation was applied to a signal its generally involving &lt;a href=&quot;https://en.wikipedia.org/wiki/Electronic_warfare&quot; rel=&quot;noreferrer&quot;&gt;electronic warfare&lt;/a&gt; or &lt;a href=&quot;https://fr.wikipedia.org/wiki/Reverse_Engineering&quot; rel=&quot;noreferrer&quot;&gt;reverse engineering&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="19532" LastEditDate="2016-03-07T12:46:59.550" LastActivityDate="2016-03-07T12:46:59.550" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29286" PostTypeId="2" ParentId="2725" CreationDate="2016-03-07T16:25:22.710" Score="1" Body="&lt;p&gt;There may be many techniques. Your idea seems good to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two other ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Do a FFT of your data and filter out the lowest frequencies. This also removes the baseline modulations. Certainly you have to find the correct filter width by hand or from an educated guess from the data.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use Cosine functions with multiple long wavelengths and do a linear fit to your data. You could also throw out the peaks via an simple filter or by weighting the data points with their signal strength.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-07T16:25:22.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29287" PostTypeId="2" ParentId="28687" CreationDate="2016-03-07T16:35:19.473" Score="0" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Guess a threshold from your data (e.g. from a cumulative probability density function of the abs value of your signal, where you then say the threshold &lt;code&gt;t&lt;/code&gt; = the point closest to the 95% mark)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Threshold your signal by signal(signal &gt; 1.25*t) = NaN&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Interpolate the NaN-points away, if necessary via a linear interpolation&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-07T16:35:19.473" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29288" PostTypeId="2" ParentId="29283" CreationDate="2016-03-07T17:07:42.440" Score="2" Body="&lt;p&gt;This is a signal intelligence version of a randomness test (plus possibly a Turing test).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A receiver (of many simple modulation schemes) can &quot;demodulate&quot; any signal, but the result might just be noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a slice of spectrum, one can try analyzing it to estimate the likelihood that it is random or perhaps varied by some non-random process.  Given that one finds some non-random modulation(s), one might try estimating whether that modulation was produced by a physical process or holds much more information than can be produced by any known non-intelligent mechanism, thus indicating a signal.  But a smarter spy might try to make their modulation  look like random noise rather than patterned or intelligent to try and fool you.  Game On.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-07T17:07:42.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29289" PostTypeId="2" ParentId="22355" CreationDate="2016-03-07T19:57:46.823" Score="5" Body="&lt;p&gt;Here is an easier approach, that does not involve sliding-window analysis. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Convert your image to grayscale (this is not required, but I will assume that you only have one channel for the sake of clarity)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the gradient in both directions&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the magnitude (or just square the gradient)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sum both gradient images in both directions&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As was already said, the focussed part of the image will have higher frequencies than the non-focussed area. From the summation you will end up with two projections, where there is a lot of variation (higher values) in that part where the focussed object is placed along this direction. You can do now the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Determine the start and end point of these higher values. You could use a simple threshold (e.g. 0.7*maximum_value) or smooth the profiles, take the second derivative and check for the highest values in there.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Start/Stop positions from the previous step give you the pixel positions along both directions where to place your area-of-sharpnes-indicating rectangle.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-07T19:57:46.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29290" PostTypeId="2" ParentId="2725" CreationDate="2016-03-07T20:03:57.950" Score="0" Body="&lt;p&gt;[EDIT 2018/03/24] Since the answer, several uses on spectral data have been recorded&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your spectral peaks are relatively fine, and almost positive above a baseline with a more low-frequency behavior, I suggest to give a try to &lt;a href=&quot;http://dx.doi.org/10.1016/j.chemolab.2014.09.014&quot; rel=&quot;nofollow noreferrer&quot;&gt;BEADS (Baseline Estimation And Denoising w/ Sparsity)&lt;/a&gt;, an algorithm based on the sparsity of the data and soome of its derivatives. It works fine with chromatographic data. &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/49974-beads--baseline-estimation-and-denoising-w--sparsity--chromatogram-signals-&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matlab code is available&lt;/a&gt;, and &lt;a href=&quot;http://www.laurent-duval.eu/siva-beads-baseline-background-removal-filtering-sparsity.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the BEADS page gathers R or C++ codes, and known uses&lt;/a&gt;. Here you can find uses for Raman spectra, astronomical hyperspectral galaxy spectrum,  X-ray absorption spectroscopy (XAS), X-ray diffraction (XRD), and combined XAS/XRD measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yur3V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yur3V.png&quot; alt=&quot;Chromatography with simulated baseline&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/99Z4b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/99Z4b.png&quot; alt=&quot;Baseline and noise corrected&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2018-03-24T17:46:36.743" LastActivityDate="2018-03-24T17:46:36.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29291" PostTypeId="6" CreationDate="2016-03-07T20:38:39.253" Score="0" Body="&lt;p&gt;As one of the &lt;code&gt;pro tem&lt;/code&gt;  moderators, I'd like to continue in the moderator's position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the &quot;Good moderators often&quot; panel, here's some information:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dsp.stackexchange.com/users?tab=Reputation&amp;amp;filter=all&quot;&gt;I have a reasonably high reputation on this site.&lt;/a&gt;  At the time of writing, I am #6 overall.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://meta.dsp.stackexchange.com/users?tab=participation&quot;&gt;I am involved in meta activities,&lt;/a&gt; though meta on DSP.SE is not as active as on other sites.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dsp.stackexchange.com/users/80/peter-k?tab=answers&quot;&gt;I believe I make an attempt to answer what questions I can&lt;/a&gt;. I like to get the check mark, but I'm perfectly happy to just answer and provide information.&lt;/li&gt;&#xA;&lt;li&gt;I try to err on the side of assuming my own misunderstanding, rather than getting too hung up on specifics. So I tend to write many comments (link directly to comments doesn't appear to work!).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Apart from all that, I have an interest in continuing to see DSP.SE thrive because &lt;a href=&quot;http://area51.stackexchange.com/proposals/1691?phase=beta&quot;&gt;I started the original proposal on Area 51 back in 2010.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-03-08T12:28:55.020" LastActivityDate="2016-03-08T12:28:55.020" CommentCount="2" CommunityOwnedDate="2016-03-07T20:38:39.253" ContentLicense="CC BY-SA 3.0" />
  <row Id="29292" PostTypeId="1" AcceptedAnswerId="29315" CreationDate="2016-03-07T21:15:20.397" Score="2" ViewCount="323" Body="&lt;p&gt;I'm given a continuous-time analog signal $x_a(t) = \cos(2\pi f_1t)+\sin(2\pi f_2t)$, for some frequency $f_1, f_2$. I'm asked to sample $x_a(t)$ at $F_s=1024\textrm{ Hz}$, apply a 128-point Hamming Window, and take the DFT(&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Discrete Fourier Transform&lt;/a&gt;) of the resulting windowed, sampled signal.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expression for a sampled signal is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = x_a\left(\dfrac{n}{F_s}\right)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To apply the hamming window, we multiply $x[n]$ by the 128-point window function (courtesy of ML):   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_w[n]=x[n].*\mathrm{hamming}[128]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then take the DFT of the windowed function $x_w[n]$: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_w[k] = \mathrm{DFT}\left\{x_w[n]\right\}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read that the DTFT(&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete-time_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Discrete-time Fourier transform&lt;/a&gt;) is a continuous spectrum of $x[n]$ and that the DFT of $x[n]$ (in a nutshell) is a sampling of that spectrum. When we take the $N$-point DFT of $x[n]$, we are taking $N$ samples of the DTFT of $x[n]$ where frequencies are unique (i.e., we sample within $2\pi$). That is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\mathrm{DTFT}\left\{x[n]\right\} &amp;amp;= X(\omega)\\ &#xA;\mathrm{DFT}\left\{x[n]\right\} &amp;amp;= X\left(\omega = \frac{2\pi k}{N}\right) = X[k],\quad \textrm{ for } k=0,1,...,N-1.&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If we plot $X[k]$, we are still plotting the sample of the spectrum  against frequency, right? Is the frequency, given $k$, denoted by $2\pi k/N $ radians?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My professor asked me to plot the FFT versus $k/F_s$ where $k=0,\ldots,127$. What does $k/F_s$ represent?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A homework problem asks (given application of the 128-point Hamming window, above) to find the &quot;continuous-time frequency spacing $\Delta F$ between DFT samples&quot;? What does this mean? Isn't this just $2\pi/N$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My professor told me that $2\pi/N$ is the discrete-time frequency spacing in radians and that I have to multiply that by $Fs/(2 \pi)$. I'm not sure how to make sense of $Fs/N$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="18485" LastEditorUserId="1629" LastEditDate="2016-04-08T08:22:58.913" LastActivityDate="2016-08-06T23:07:53.790" Title="What is plotted against the DFT of a windowed sampled signal?" Tags="|dft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29294" PostTypeId="1" CreationDate="2016-03-07T23:53:49.413" Score="1" ViewCount="43" Body="&lt;p&gt;Posted also here, where it's been put on hold. I did modify it afterwards though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://biology.stackexchange.com/questions/43997/how-can-a-medical-doctor-use-the-information-given-by-someone-working-in-medical&quot;&gt;https://biology.stackexchange.com/questions/43997/how-can-a-medical-doctor-use-the-information-given-by-someone-working-in-medical&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm an academic researcher in the US working in an area called &quot;statistical shape analysis&quot;, which is intimately connected with medical image computing. It deals with how to mathematically compare two images, or predict (regression problem) how the future images (say MRI image of Alzheimer's patients, or images of protein structures) will be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I'm working on statistical modeling of hippocampus (a part of the brain) to infer about which stage the Alzheimer's disease is. So I obtain the segmented MRI images, perform statistics on it to predict future segmented images. But I can't tell how exactly the image itself will look like, but only how the segmentation will be like. I hand this prediction to a doctor. How will that be helpful to a doctor who's treating Alzheimer's? Of course, intuitively it's clear it's helpful, but I'm asking what exactly the doctor will do with these kind of computational data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, could you mention some hospitals in Europe where they use informaticians/statisticians to collaborate with doctors for the above kind of work?&lt;/p&gt;&#xA;" OwnerUserId="4927" LastEditorUserId="-1" LastEditDate="2017-04-13T12:48:10.227" LastActivityDate="2016-03-07T23:53:49.413" Title="How can a medical doctor use the information given by someone working in medical image computing(shape analysis)? Details follow" Tags="|image-processing|computer-vision|statistics|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29295" PostTypeId="1" CreationDate="2016-03-08T01:02:53.297" Score="0" ViewCount="144" Body="&lt;p&gt;I have a filter whose respose I have in angular frequency. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A0 = [1.0000000,0.3281250,0.0000000];&#xA;B0 = [0.5859375,-0.0625000,0.0000000];&#xA;[z,p,k]=tf2zp(B0,A0);&#xA;figure;&#xA;zplane(z,p);&#xA;w = 0:(pi/500):pi;&#xA;H=freqz(B0,A0,w)&#xA;figure;&#xA;plot(w,20*log10(abs(H)/max(abs(H))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;1) How can I get the corresponding response in Hertz? Is it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;plot(w/(2*pi),20*log10(abs(H)/max(abs(H))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2) Also, how do I get the response of the above filter, if I apply it to a sinusoidal signal at 20MHz, with a sampling freq of Fs=300MHz&lt;/p&gt;&#xA;" OwnerUserId="19921" LastActivityDate="2016-08-05T10:56:42.047" Title="Signal response in Frequency Hz from angular frequency" Tags="|frequency|frequency-response|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29296" PostTypeId="2" ParentId="29211" CreationDate="2016-03-08T01:16:33.143" Score="2" Body="&lt;p&gt;Thanks to Dilip, I managed to figure out the answer to the question.&#xA;$y_1[n]$ will  be a normal random variable, with its variance given by the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\sigma_{y_1}^2=N\sigma_{th}^2&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be explained by using the fact that the variances will just add up. The mean will stay zero.$\\$&#xA;A similar approach can be used to find the variance of $y_2[n]$ ($\sigma_{y_2}$), which begins by writing the equation for $y_2[N-1]$ ($y_2[n]$ after $N$ cycles):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;y_2[N-1]=(N-2)x[0] + (N-3)x[1] + (N-4)x[2]...+x[N-3]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking variances on both sides:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\sigma_{y_2}^2=\sigma_{th}^2(1+2^2+3^2+...(N-2)^2)=\sigma_{th}^2\frac{(N-2)(N-1‌​)(2N-3)}{6}\approx \sigma_{th}^2\frac{N^3}{3} (N&amp;gt;&amp;gt;1)&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, the mean will stay zero.&lt;/p&gt;&#xA;" OwnerUserId="19865" LastActivityDate="2016-03-08T01:16:33.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29297" PostTypeId="6" CreationDate="2016-03-08T01:56:14.553" Score="0" Body="&lt;p&gt;As one of the original moderators on the site, I'd be happy to continue moderating, as I think the site would benefit from some measure of continuity as we transition out of beta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The community has grown to do an excellent job of self-moderation, and there are vastly fewer major &quot;incidents&quot; than there were during the first couple of years. It's been a real pleasure helping to develop this resource into something that will now continue to live on for many years to come.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stack Exchange can be intimidating for beginners, and I like to think that during my time as moderator I've been able to soften the experience for new users to some extent. I have no idea how successful my efforts have been, but that has been one of my goals. The other has been to ensure that we don't devolve, as a site, into an excessive focus on any particular sub-field of signal processing. There was a real danger, in the early days, for this to become merely a collection of questions about linear digital systems, and I'm very glad that we were able to maintain a broader scope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you know, vote for me if you're into that kind of thing.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="35" LastEditDate="2016-03-08T01:56:14.553" LastActivityDate="2016-03-08T01:56:14.553" CommentCount="2" CommunityOwnedDate="2016-03-08T01:56:14.553" ContentLicense="CC BY-SA 3.0" />
  <row Id="29298" PostTypeId="1" AcceptedAnswerId="29301" CreationDate="2016-03-08T04:51:52.547" Score="2" ViewCount="446" Body="&lt;p&gt;As the order of filter needed for digital information gets higher, it takes longer to process and requires more memory. Maybe analog filtering could be of use here. I know that the words analog and high precision dont often appear in the same room together, but lets assume they do for the sake of this post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so I suggest that when a higher order filter is needed the following linkage of devices could be implemented:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DAC &gt; Analog Filter &gt; ADC&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question regarding this are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Has this linkage of devices been used before?&lt;/li&gt;&#xA;&lt;li&gt;If so, where can I find literature on it?&lt;/li&gt;&#xA;&lt;li&gt;If not, why do you think it hasn't been used? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(Assume highly precise analog filters are being used)&lt;/p&gt;&#xA;" OwnerUserId="18815" LastActivityDate="2016-03-08T17:44:29.630" Title="DAC to Analog Filter to ADC" Tags="|filters|filter-design|digital|digital-filters|analog|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29299" PostTypeId="1" AcceptedAnswerId="29354" CreationDate="2016-03-08T05:28:37.177" Score="2" ViewCount="200" Body="&lt;p&gt;I have some images of answered tests. I am working on recognizing the answers for the multiple choice questions on each test. A example:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/iRPG3.jpg&quot; alt=&quot;test example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the problem can be separate into two sub-problems: &#xA;    1.) Identify and segment the multiple choice answers from the rest of the test.  2.) Classify and recognize the answer as one of the letters in A, B, C, D, E.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second sub-problem, there exists libraries like &lt;em&gt;Tesseract&lt;/em&gt;, also I can train a neural network to identify among the five letters which is not hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am not sure how to approach the first sub-problem. The most important part in identifying the multiple choice answers would be identifying the region that contain the multiple choice answers (the red box region in the example). Since multiple choices answers are typically written in a table that has two rows and number_of_questions + 1 columns. My first step is to identify this table in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the best way to identify such table? I am currently thinking about training a neural network to identify the table. Should I use template matching or other methods instead? Which one is better?&lt;/p&gt;&#xA;" OwnerUserId="19922" LastEditorUserId="26573" LastEditDate="2019-01-16T16:40:29.647" LastActivityDate="2019-01-16T16:40:29.647" Title="identify a specific table in document image" Tags="|image-processing|neural-network|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29300" PostTypeId="2" ParentId="29295" CreationDate="2016-03-08T06:58:43.973" Score="1" Body="&lt;p&gt;have a look to this example: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/55822-low-pass-filtering&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/55822-low-pass-filtering&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;here you have a signal that can be represented/plot in both frequencies scales:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;omegas_axis=[0:2*pi/L:2*pi-2*pi/L];%axis input signal&#xA;frec_axis=[0:fs/L:fs-fs/L];%axis input signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the &quot;omegas_axis&quot; is the angluar frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTS.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-08T06:58:43.973" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29301" PostTypeId="2" ParentId="29298" CreationDate="2016-03-08T08:27:10.100" Score="3" Body="&lt;p&gt;You wouldn't normally do that because it isn't worth the cost (hardware.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FIR filters get computationally very expensive if you need sharp cutoffs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Digital IIR filters that provide the same cutoff as a long FIR are computationally very cheap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An analog filter will be equivalent to a digital IIR.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an analog filter can provide the performance you need, then you are better off implementing a digital IIR filter.  It saves you the DAC/ADC parts and it saves you the mess of an additional analog section with its inherent instabilities and potential to pickup noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the digital IIR that can provide the performance you need is unstable, then it is very likely that the equivalent analog filter will also be very difficult to make work correctly.&lt;/p&gt;&#xA;" OwnerUserId="10650" LastActivityDate="2016-03-08T08:27:10.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29303" PostTypeId="1" CreationDate="2016-03-08T10:27:52.533" Score="0" ViewCount="242" Body="&lt;p&gt;my application :&#xA;sensing a photo diode output and processing it further, the per-processed output would be a digitally converted pulse waveform with pulse width ranging from 1ns-150ns and pulse repetition frequency 1Hz to 50KHz,now i should find the repetition rate of the 1ns-150ns pulse&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as sensing this kind of narrow pulse signals is difficult, my per-processing stage would expand input signal by a factor of 100 thus my signal would become a signal with pulse width 100ns-15000ns&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to find pulse repetition frequency for which i thought FFT would do the job&lt;/p&gt;&#xA;&#xA;&lt;p&gt;problem statement:&#xA;my sampling rate would be 2MSPS - to acquire a 100ns pulse i require that much&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if i perform a 1024 FFT over 1024 samples i acquired i will not find the pulse repetition rate at all, in order to find the repetition rate i have to grab at least 1sec samples and do a very large FFT over it. which is practically foolish&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so i am a bit confused in this situation how can i find the pulse repetition frequency of a 100ns pulse,through huge samples acquired, mean while i am of the idea to just using a pulse counter of micro controller.&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="4513" LastEditDate="2016-03-12T06:24:23.430" LastActivityDate="2018-05-02T02:47:35.700" Title="Finding Repetetion rate of ns pulsed waveforms" Tags="|fft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29304" PostTypeId="2" ParentId="29303" CreationDate="2016-03-08T10:57:37.040" Score="0" Body="&lt;p&gt;You could acquire your signal and check its autocorrelation. This gives you insight into how much the signal must be shifted in order to match again with itself at a later time. This lag is your repetition time $T$, from which you can calculate the repetition frequency simply by $1/T$. Of course you have to acquire enough data points so that you capture each pulse accurately. But this you have to do with every other analysis technique as well ;) &lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-08T10:57:37.040" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29306" PostTypeId="2" ParentId="29270" CreationDate="2016-03-08T12:39:18.003" Score="1" Body="&lt;p&gt;I found the origin of the problem while double checking the whole iplementation of my application. I added a method for reading a single input sample from binary file few weeks ago, but I somehow messed up the size of the buffer which I use. It has to be 8-byte long (room for 2 floats) representing real and imaginary part of the sample, but I used 16 bytes instead. Really stupid mistake! Thanks for your hepl, I appriciate it!&lt;/p&gt;&#xA;" OwnerUserId="16270" LastActivityDate="2016-03-08T12:39:18.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29307" PostTypeId="2" ParentId="12681" CreationDate="2016-03-08T12:54:36.110" Score="0" Body="&lt;p&gt;This should answer your question (mainly your notation):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$Q = \frac{S_1}{|S_1|}\frac{S_2^*}{|S_2|} = e^{i(k_x\Delta x + k_y \Delta y)}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This quantity is the phase in Fourier-space. Since a displacement in image space results in a &lt;em&gt;linear&lt;/em&gt; phase in Fourier space, you end up with the phase factor here. Note that the magnitudes of $S_1$ and $S_2$ are identical - only the phase is different, if you have a translation in image space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you transform $Q$ back to image space by an inverse Fourier transformation, you end up with an image that is mainly zero everywhere and should have a strong peak at one position only. This peak, relative to the center pixel of your image, gives you the shifts $\Delta x$ and $\Delta y$, i. e. if your image center is at pixel (128, 128) and the peak you get is at (130, 124), then the image was shifted by $\Delta x = 2\,\textrm{px}$, and $\Delta y = -4\,\textrm{px}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you have to transform Q back to image space. The phase distribution in Fourier space itself will be of less value to your application!&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-08T12:54:36.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29310" PostTypeId="2" ParentId="27708" CreationDate="2016-03-08T16:52:17.640" Score="1" Body="&lt;p&gt;Coherence and incoherence with respect to compressive sensing is a feature that has to be implemented when designing your sensing matrix. See if my write up below could be of any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Incoherence:&lt;/strong&gt; This is the property of the sensing matrix $A$ that aids to determine the recovery ability of $A$ &lt;a href=&quot;http://web.math.princeton.edu/tfbb/spring03/greed-ticam0304.pdf&quot; rel=&quot;nofollow&quot;&gt;(Joel, 2003)&lt;/a&gt; &lt;a href=&quot;http://statweb.stanford.edu/~donoho/Reports/2002/OptSparse.pdf&quot; rel=&quot;nofollow&quot;&gt;(David &amp;amp; Michael, 2002)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is specifically used to determine the sufficient condition for $L_0$ and $L_1$ unique solutions (Heung-No, 2011 - &lt;em&gt;Introduction to compressive sensing: With coding theory perspective&lt;/em&gt;). The coherence of the sensing matrix $A$ ($\mu(A)$)   is the largest absolute, relative inner product between two columns $A_i$ and $A_j$ of the sensing matrix $A$ as given in (1) below &lt;a href=&quot;http://arxiv.org/abs/1005.2613&quot; rel=&quot;nofollow&quot;&gt;(Emmanuel et al., 2010)&lt;/a&gt;.&#xA;$$&#xA;\mu(A) = \max_{j&amp;lt;k} \frac{|\langle A_j,A_k \rangle|}{\|A_j\|_2 \|A_k\|_2} \tag{1}&#xA;$$&#xA;This property of $A$ is easier to evaluate than RIP of $A$, reason being that the computational complexity of evaluating $\mu(A)$ scales exponentially with the number of columns in $A$ (Dennis, S. 2012).  The relationship between coherence and spark of $A$ is given in (2) - see reference in &lt;a href=&quot;https://cnx.org/contents/9wtroLnw@5.12:YcCc-ZVZ@5/Coherence&quot; rel=&quot;nofollow&quot;&gt;(Marco, 2009)&lt;/a&gt;. If (2) holds, then for each measured vector $b \in \mathbb{R}^M$  there exist at most one signal $x$ such that  $Ax=b  + \epsilon$ holds. &#xA;$$&#xA;k &amp;lt; \frac{1}{2} \left(1 + \frac{1}{\mu(A)} \right) \tag{2}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="19918" LastEditorUserId="1464" LastEditDate="2016-03-16T09:56:36.093" LastActivityDate="2016-03-16T09:56:36.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29311" PostTypeId="2" ParentId="8629" CreationDate="2016-03-08T17:33:19.677" Score="2" Body="&lt;p&gt;Yes it is: unless you take into account that infinite power is hard to come by in these post big-bang times.  Actually all white noise processes end up in a physical implementation that has a capacitance and thus limits on the effective bandwidth.  Consider the (reasonable) arguments leading to Johnson R noise: they would produce infinite energy; except there are always bandwidth limits in implementation.&#xA;A similar situation applies at the opposite end: 1/F noise.  Yes some processes fit 1/f noise very well over a long time; I have measured them.  But in the end you are constrained by physical laws.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2016-03-08T17:33:19.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29312" PostTypeId="2" ParentId="29298" CreationDate="2016-03-08T17:44:29.630" Score="1" Body="&lt;p&gt;There is an analog filtering technique that can be effective for narrow band filtering.  It's call switched capacitor filtering.  If you can switch at the center frequency then you can modulate the center frequency down to DC and then impose as narrow a low pass filter as you want; subsequently you switch it back up to the desired frequency; which doesn't &lt;em&gt;have&lt;/em&gt; to be the same although it usually would be.  This allows very narrow filtering in the analog domain at some cost in cash and additional noise.  Incidentally the straight single pole filter at DC can be enhanced at will.  The extra noise comes from the switching so you have to read the application notes and make sure you don't contaminate your signal beyond it's original noise level. &#xA;As I recall Maxim has a line and application notes.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastActivityDate="2016-03-08T17:44:29.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29313" PostTypeId="1" AcceptedAnswerId="29322" CreationDate="2016-03-08T19:10:21.230" Score="3" ViewCount="745" Body="&lt;p&gt;I am working on a school project on converting a 6th order butterworth high pass filter to digital filter using bilinear transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just got a couple conceptual questions need to be clarified before I continue.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In an analog 6th order butterworth filter, the poles are the same for highpass and lowpass since poles are found in the denominator? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have found 6 poles, and say my first pole is &lt;code&gt;-0.259+ 0.966i&lt;/code&gt; if my cut off frequency is $1 \textrm{ rad/s}$. If my cut off frequency is changed to $10000 \textrm{ rad/sec}$. The radius of the unit circle would be $10000$ and my pole would be &lt;code&gt;-2590 + 9660i&lt;/code&gt;?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there anyway someone could verify that once applied bilinear transformation without pre-wraping the frequency (professor said do it without pre-wraping first and compare to wrapped after), in the $z$-plane the poles would be: &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;pre&gt;&#xA;0.1894 + 0.7499i&#xA;0.1894 - 0.7499i&#xA;0.1405 + 0.4077i&#xA;0.1405 - 0.4077i&#xA;0.1222 + 0.1283i&#xA;0.1222 - 0.1283i &#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm quite new on DSP, any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="19933" LastEditorUserId="4298" LastEditDate="2018-08-07T22:36:00.097" LastActivityDate="2018-08-07T22:36:00.097" Title="A few conceptual questions about filter, pole, and bilinear" Tags="|filters|filter-design|poles-zeros|butterworth|bilinear-transform|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29314" PostTypeId="1" CreationDate="2016-03-08T20:47:10.707" Score="4" ViewCount="6261" Body="&lt;p&gt;Given a discrete-time signal &lt;code&gt;x[n]&lt;/code&gt;, how does one determine if it is an eigenfunction of a stable, discrete-time LTI system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$5^nu[n]$&lt;/li&gt;&#xA;&lt;li&gt;$2^nu[-n-1]$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Intuitively, second one seems to be an eigenfunction of an LTI system while first one does not. Since the second sequence is absolutely summable while first one is not, is this the criteria for deciding?&lt;/p&gt;&#xA;" OwnerUserId="19934" LastActivityDate="2016-03-09T13:15:22.017" Title="Eigenfunctions of discrete-time LTI systems" Tags="|discrete-signals|" AnswerCount="2" CommentCount="23" ContentLicense="CC BY-SA 3.0" />
  <row Id="29315" PostTypeId="2" ParentId="29292" CreationDate="2016-03-08T22:26:49.797" Score="1" Body="&lt;p&gt;As you've noted, for a length-$N$ time-domain sequence $x[n]$, the $\mathrm{DTFT}$ (aka Fourier transform) is given by the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathrm{DTFT}\left\{x[n]\right\}=X(e^{j\omega})=X(\omega), \quad 0\leq n\leq N - 1.\tag{1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the $N$-point $\mathrm{DFT}$ is given by uniformly sampling equation $(1)$ to obtain $N$ equally spaced frequencies $\omega_k = 2\pi k/N$: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathrm{DFT}\left\{x[n]\right\}=X(e^{j\omega_k})=X\left(\frac{2\pi k}{N}\right)=X[k], \quad 0\leq k\leq N - 1.$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you plot $X[k]$, you're plotting the $N$ equally spaced samples from the $\mathrm{DFT}$ equation not against the continuous frequency $\omega$ but against the index number $k$ which in frequency corresponds to $2\pi k/N$. &lt;/li&gt;&#xA;&lt;li&gt;The $\mathrm{FFTs}$ are algorithms to compute the $\mathrm{DFT}$. I don't know what's the goal in plotting the $\mathrm{DFT}$ against $k/F_s$. If you check the units you see that $k$ is just a bin number, unit-less, but $F_s$ is in Samples per second. So, that division has units in Seconds per samples... &lt;/li&gt;&#xA;&lt;li&gt;The spacing between the discrete frequencies is indeed $2\pi/N$ radians. By the &lt;em&gt;continuous-time frequency spacing&lt;/em&gt;, I think he meant the corresponding frequency spacing in $\rm Hz$ and this is the frequency resolution:&#xA;$$f_k=k\cdot \frac{F_s}{N}$$&#xA;From here you can guess what's the frequency spacing since two consecutive bins from the $\mathrm{DFT}$ samples are at $\Delta k=1$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-08-06T23:07:53.790" LastActivityDate="2016-08-06T23:07:53.790" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29318" PostTypeId="1" AcceptedAnswerId="29320" CreationDate="2016-03-09T03:57:15.793" Score="-1" ViewCount="102" Body="&lt;p&gt;I want to get into audio signal processing. I know how to generate a tone, but I have no idea how filters work. What do I do to a set of samples to boost/cut a frequency with adjustable bandwidth? What is FFT? What's the code behind a parametric equalizer?&lt;/p&gt;&#xA;" OwnerUserId="19943" LastActivityDate="2016-03-09T06:55:59.947" Title="Programming a peaking filter (and how do I FFT?)" Tags="|fft|filters|audio|" AnswerCount="1" CommentCount="1" ClosedDate="2016-03-09T13:27:27.377" ContentLicense="CC BY-SA 3.0" />
  <row Id="29319" PostTypeId="2" ParentId="29314" CreationDate="2016-03-09T04:31:19.023" Score="3" Body="&lt;p&gt;i think the only family of functions that are eigenfunctions to LTI systems the sole exponential.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for continuous-time, if it's LTI:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = \int\limits_{-\infty}^{+\infty} h(u) \ x(t-u) \ du $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the eigenfunction is $x(t) = A e^{st}$ and the output is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = H(s) \ x(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(s) = \int\limits_{-\infty}^{+\infty} h(t) \ e^{-st} \ dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for discrete-time LTI systems, it is similar&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = \sum\limits_{m=-\infty}^{+\infty} h[m] \ x[n-m] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the eigenfunction is $x[n] = A z^n$ and the output is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y[n] = H(z) \ x[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(z) = \sum\limits_{n=-\infty}^{+\infty} h[n] \ z^{-n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;often $s=j\Omega$ or $z=e^{j\omega}$ but it wouldn't have to be that.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-03-09T06:46:02.267" LastActivityDate="2016-03-09T06:46:02.267" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29320" PostTypeId="2" ParentId="29318" CreationDate="2016-03-09T06:55:59.947" Score="0" Body="&lt;p&gt;you need to familiarize with concepts such us:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;FIR filters and their frequency response: &lt;a href=&quot;https://en.wikipedia.org/wiki/Finite_impulse_response&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Finite_impulse_response&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Nyquist frequency and sample frequency:&lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And then, have a look to the filters used for equalization: &lt;a href=&quot;https://en.wikipedia.org/wiki/Equalization_(audio)&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Equalization_(audio)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope these basic links help you to do a bit more of research :)&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-09T06:55:59.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29321" PostTypeId="2" ParentId="29314" CreationDate="2016-03-09T08:41:24.060" Score="3" Body="&lt;p&gt;I'll try to answer your question &quot;how does one determine if it is an eigenfunction of a stable, discrete-time LTI system?&quot; for the type of sequences specified in your question. Let's consider the signal $x[n]=5^nu[n]$ and let $h[n]$ be the system's impulse response. If $x[n]$ is an eigenfunction of the system, then the output signal must be a scaled version of the input signal: $y[n]=c\cdot x[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The convolution sum is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}y[n]&amp;amp;=\sum_{k=-\infty}^{\infty}h[k]x[n-k]\\&amp;amp;=\sum_{k=-\infty}^{\infty}h[k]5^{n-k}u[n-k]\\&amp;amp;=5^n\sum_{k=-\infty}^{n}h[k]5^{-k}\tag{1}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can make the sum in $(1)$ zero for $n&amp;lt;0$ by requiring $h[n]$ to be causal, i.e., $h[n]=0$, $n&amp;lt;0$. With this requirement we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=5^nu[n]\sum_{k=0}^{n}h[k]5^{-k}=x[n]\sum_{k=0}^{n}h[k]5^{-k}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This almost looks like the form we're looking for. However, note that the multiplicative term in $(2)$ is not constant but it depends on $n$. So $(2)$ shows that the given $x[n]$ is generally not an eigenfunction of an LTI system. Of course it &lt;em&gt;is&lt;/em&gt; an eigenfunction of the trivial system with impulse response $c\cdot \delta[n]$, but any other sequence is so too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use a similar argument to show that also the second signal in your question is not an eigenfunction of any LTI system other than the trivial system mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, if you're looking for functions/sequences that are eigenfunctions of &lt;em&gt;all&lt;/em&gt; LTI systems, then you'll end up with complex exponentials, as pointed out in &lt;a href=&quot;https://dsp.stackexchange.com/a/29319/4298&quot;&gt;RBJ's answer&lt;/a&gt;. For special systems there are also other eigenfunctions, such as the ones pointed out by Jazzmaniac in the comments. E.g., any band-limited function is an eigenfunction of an ideally frequency-selective filter with a pass band extending over the frequency range of the input signal. But such ideally frequency-selective systems are not stable, so they're not in the category of systems you are looking for. Note that there are other stable LTI systems with specific eigenfunctions different from complex exponentials. But in general it is not possible to construct an LTI system for a given function such that this function becomes an eigenfunction of the system (if we exclude the trivial system $h[n]=c\cdot \delta[n]$ mentioned above). And this last sentence is also true for the two signals given in your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-03-09T13:15:22.017" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="29322" PostTypeId="2" ParentId="29313" CreationDate="2016-03-09T09:53:45.840" Score="4" Body="&lt;p&gt;The poles of low pass and high pass Butterworth filters are indeed the same if both filters have the same cut-off frequency. The difference between the two lies in the numerator. A low pass filter has a constant in the numerator, whereas a high pass filter has a constant times $s^N$, where $N$ is the filter order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The poles of a normalized Butterworth low pass filter (i.e., one with cut-off frequency $\omega_c=1$) lie on a circle with center $s=0$ and radius $1$ in the complex $s$-plane. Of course they are all in the left-half plane:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p_k=-e^{j\frac{k\pi}{2N}}\tag{1}\\&#xA;k=\pm 1,\pm 3,\ldots,\pm (N-1),\quad N\text{ even}\\&#xA;k=0 ,\pm 2,\ldots,\pm (N-1),\quad N\text{ odd}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a cut-off frequency $\omega_c\neq 1$, the variable $s$ is transformed as $s\rightarrow \frac{s}{\omega_c}$, so a factor $\frac{1}{s-p_k}$ of the transfer function becomes $\frac{1}{s/\omega_c-p_k}=\frac{1}{\omega_c}\frac{1}{s-\omega_cp_k}$. So the poles are indeed multiplied by the cut-off frequency $\omega_c$, i.e., they lie on a circle with radius $\omega_c$. Their angles of course remain unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without pre-warping, the bilinear transformation is usually implemented as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s=2f_s\frac{z-1}{z+1}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_s$ is the sampling frequency. Expressing $z$ in terms of $s$ gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z=\frac{2f_s+s}{2f_s-s}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation $(3)$ can be used to determine the pole locations in the complex $z$-plane. If the cut-off frequency of the analog filter is $\omega_c$, its poles are located at $\omega_cp_k$, with $p_k$ given by $(1)$. So the poles in the complex $z$-plane are given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$z_{\infty,k}=\frac{2f_s+\omega_cp_k}{2f_s-\omega_cp_k}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use $(4)$ to check the pole locations you obtained from Matlab (and I don't doubt that they are identical up to numerical inaccuracies).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-03-10T07:09:49.947" LastActivityDate="2016-03-10T07:09:49.947" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29325" PostTypeId="1" AcceptedAnswerId="30061" CreationDate="2016-03-09T12:39:15.047" Score="2" ViewCount="937" Body="&lt;p&gt;I am recording vibration data using an adxl335 accelerometer.I have ~50ms delay before i save a reading from this sensor so most probably each second i have ~20 readings. I verified that by checking the difference between two consecutive readings since i am recording the time of reading, however since my pc is not real time i guess matlab is varying but i found that the average time between two consecutive readings is 0.0517 so my sampling should be ~19 hz ? is this the value that should be chosen ?&lt;/p&gt;&#xA;" OwnerUserId="19948" LastActivityDate="2016-04-12T10:40:08.867" Title="How to pick a sampling frequency for Matlab fft" Tags="|matlab|fft|frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29326" PostTypeId="1" CreationDate="2016-03-09T12:46:56.647" Score="0" ViewCount="176" Body="&lt;p&gt;I have 3 identical gears that are meshing together, on each shaft that is holding these gears I have an accelerometer recording vibration data.&#xA;Once I move to the frequency domain via MATLAB's &lt;code&gt;fft&lt;/code&gt; I am unable to see any specific frequency that would describe the meshing frequency of my gears, it looks all the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any methods I should be looking at to tackle such a challenge of identifying the gear meshing frequency and probably identify which gear is inducing what frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DkncH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DkncH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also would it make any sense to run the motor while disconnecting the gears and record the vibration induced by the motor, and analyze that to filter out the motor's influence?&lt;/p&gt;&#xA;" OwnerUserId="19948" LastEditorUserId="24461" LastEditDate="2019-06-12T02:31:34.600" LastActivityDate="2019-06-12T02:31:34.600" Title="How to separate mixed signals, 3 identical gears meshing together" Tags="|matlab|fft|filters|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29327" PostTypeId="2" ParentId="29325" CreationDate="2016-03-09T12:54:25.047" Score="0" Body="&lt;p&gt;Sampling rate = samples per second.&#xA;Since your fft frame will be several samples long, you could think about:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;recording the time when you read the first sample of the frame&lt;/li&gt;&#xA;&lt;li&gt;reading in a certain number of samples&lt;/li&gt;&#xA;&lt;li&gt;querying the time again&lt;/li&gt;&#xA;&lt;li&gt;computing time difference in seconds&lt;/li&gt;&#xA;&lt;li&gt;then, divide number of recorded samples by the time difference to find average sampling rate&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19928" LastActivityDate="2016-03-09T12:54:25.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29329" PostTypeId="1" AcceptedAnswerId="29337" CreationDate="2016-03-09T13:43:11.513" Score="1" ViewCount="7170" Body="&lt;p&gt;I would like to compute the gradient of an image I. I have the following two options :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[Gx, Gy] = gradient(I);&#xA;g = sqrt(Gx.^2+Gy.^2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[g,~] = imgradient(I, 'sobel');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My questions are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the gradient method used in the first option ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What are the benefits of using Sobel method to estimate the gradient ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8430" LastEditorUserId="19532" LastEditDate="2016-03-09T15:59:07.157" LastActivityDate="2016-03-09T16:36:32.837" Title="What is different between gradient and imgradient functions in MATLAB" Tags="|image-processing|matlab|computer-vision|edge-detection|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29330" PostTypeId="1" CreationDate="2016-03-09T13:44:38.827" Score="1" ViewCount="117" Body="&lt;p&gt;In live sound it is common to have a left/right sub-speaker configuration, which will produce an strong interference pattern in the audience area based on listener/sub-speaker locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the left/right sub-speakers were decorrelated (phase randomization?) would this help reduce the interference pattern in the audience area? Would the effect be minimal or significant at low frequencies?&lt;/p&gt;&#xA;" OwnerUserId="19949" LastActivityDate="2017-08-04T07:34:57.210" Title="Will decorrelating an audio signal help reduce interference patterns at low frequencies?" Tags="|frequency|phase|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29331" PostTypeId="1" AcceptedAnswerId="29342" CreationDate="2016-03-09T14:10:12.093" Score="0" ViewCount="437" Body="&lt;p&gt;Check the equation 4.8-1 $H(u,v)=1$ if $D(u,v)\le D_0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my question is the high frequency is at center.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$D(u,v)$ is smaller if it is close to center.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;why $H(u,v)=1$ in that case.&#xA;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1GYJj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1GYJj.png&quot; alt=&quot;lowpass &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19870" LastEditorUserId="15892" LastEditDate="2016-03-09T20:04:40.857" LastActivityDate="2016-03-09T20:50:16.387" Title="graph of lowpass filter" Tags="|image-processing|lowpass-filter|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29332" PostTypeId="2" ParentId="29331" CreationDate="2016-03-09T14:46:54.293" Score="0" Body="&lt;p&gt;There is no high frequency in the center. In the center of your 2D spatial frequency distribution is the 0-frequency (constant DC component of the Fourier-transformation). The text excerpt is in itself consistent. Therefore I suppose you misunderstood the problem or the initial assumptions of its solution.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-09T14:46:54.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29333" PostTypeId="1" AcceptedAnswerId="29347" CreationDate="2016-03-09T14:52:50.757" Score="1" ViewCount="175" Body="&lt;p&gt;Can a CDMA PN sequence be fully random, as in encryption-grade randomness, or must it be deterministic? I have tried the first bytes of SHA-256 hashes as PN sequences, but somehow they don't coexist too well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know a deterministic code can be generated on-the-fly so no storage is needed, but let's say I have 500 fully random PN sequences stored on a device. Is that good or do you really need deterministic codes like the Gold codes?&lt;/p&gt;&#xA;" OwnerUserId="19936" LastEditorUserId="17530" LastEditDate="2016-03-10T12:31:36.230" LastActivityDate="2019-09-25T12:07:37.710" Title="Fully random PN sequence" Tags="|digital-communications|radio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29334" PostTypeId="2" ParentId="29225" CreationDate="2016-03-09T14:58:55.973" Score="-1" Body="&lt;p&gt;You can look to the source code of openSAL and Octave sources of Matlab signal processing functions (not C, but useful). This is what I did.&lt;/p&gt;&#xA;" OwnerUserId="19345" LastActivityDate="2016-03-09T14:58:55.973" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29335" PostTypeId="1" CreationDate="2016-03-09T15:43:35.640" Score="1" ViewCount="389" Body="&lt;p&gt;I'm using Matlab R2015a and I want &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/depth-estimation-from-stereo-video.html?s_tid=srchtitle&quot; rel=&quot;nofollow noreferrer&quot;&gt;estimate depth&lt;/a&gt;&#xA;but an error occurs and I wonder that it doesn't know pcshow() function. Why it doesn't work and is there another alternative for that?&lt;a href=&quot;https://i.stack.imgur.com/GZkDH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GZkDH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="19462" LastEditorUserId="19462" LastEditDate="2016-03-09T16:34:48.473" LastActivityDate="2016-03-09T16:34:48.473" Title="Alternative for pcshow() function in matlab" Tags="|image-processing|matlab-cvst|" AnswerCount="1" CommentCount="2" ClosedDate="2016-03-10T11:15:39.877" ContentLicense="CC BY-SA 3.0" />
  <row Id="29336" PostTypeId="2" ParentId="29229" CreationDate="2016-03-09T15:45:09.003" Score="0" Body="&lt;p&gt;From your reference :&#xA;Inputs:&#xA; D contains data vectors (one per row)&#xA;...&#xA;Outputs &#xA;J indicates which centre each data vector belongs to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to have 12 coefficients in each row of your input matrix. In J you will have a number from 1 to K indicating the cluster number. The number of rows in J will be as in D.&#xA;You can use cell2mat and reshape if you need.&#xA;I just not sure that clustering in such high dimensions make sense. It may worth making PCA first.&lt;/p&gt;&#xA;" OwnerUserId="19345" LastActivityDate="2016-03-09T15:45:09.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29337" PostTypeId="2" ParentId="29329" CreationDate="2016-03-09T15:55:04.627" Score="2" Body="&lt;p&gt;Question 1:&#xA;&lt;a href=&quot;http://fr.mathworks.com/help/matlab/ref/gradient.html&quot; rel=&quot;nofollow&quot;&gt;gradient&lt;/a&gt; returns both estimated horizontal $\left(\frac{\partial I}{\partial x}\right)$ and vertical components $\left(\frac{\partial I}{\partial y}\right)$ of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gradient&quot; rel=&quot;nofollow&quot;&gt;gradient vector&lt;/a&gt;, which in your example code are Gx and Gy. To do so, gradient computes for each point $X(i)$ the half difference of $X(i-1)$ and $X(i+1)$, which is the most basic gradient estimation method (it's called the central difference method). &#xA;Then, computing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;g = sqrt(Gx.^2+Gy.^2);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;gives you the gradient magnitude at each point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://fr.mathworks.com/help/images/ref/imgradient.html&quot; rel=&quot;nofollow&quot;&gt;imgradient&lt;/a&gt; differs since it directly outputs the gradient's magnitude (g) and direction (which you suppressed using ~) at each point. In addition, it computes the gradient using a two-dimensional method applying a sobel kernel to each point and its neighbors. Finally, this function allows you to specify which kernel to use to compute the numerical gradient if you don't want to use the Sobel estimator. You can for example choose to estimate the gradient with the central difference method as in &lt;em&gt;gradient&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question 2 :&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;nofollow&quot;&gt;Sobel method&lt;/a&gt; is just the simplest contour detection method providing good results for a low computation cost. But there are plenty of others, that are used depending on the application I guess.&#xA;Compared to the central difference method, it achieves better noise rejection using a different kernel with coefficients designed to do so. See as an example the kernel used for horizontal gradient estimation :&#xA;$$&#xA;\begin{matrix}&#xA;-1 &amp;amp; 0 &amp;amp; 1\\&#xA;-2 &amp;amp; 0 &amp;amp; 2\\&#xA;-1 &amp;amp; 0 &amp;amp; 1&#xA;\end{matrix}&#xA;$$&#xA;The considered point's row is emphasized (factor 2) compared to it's neighbors (factor 1). While the central difference method does not make that difference and weights all points with the same coefficient :&#xA;$$&#xA;\begin{matrix}&#xA;-1 &amp;amp; 0 &amp;amp; 1\\&#xA;-1 &amp;amp; 0 &amp;amp; 1\\&#xA;-1 &amp;amp; 0 &amp;amp; 1&#xA;\end{matrix}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="19532" LastEditorUserId="19532" LastEditDate="2016-03-09T16:36:32.837" LastActivityDate="2016-03-09T16:36:32.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29338" PostTypeId="2" ParentId="29335" CreationDate="2016-03-09T16:15:10.377" Score="1" Body="&lt;p&gt;pcshow() was implemented in 2015b and in R2015a the equivalent function is called showPointCloud.&lt;/p&gt;&#xA;" OwnerUserId="19462" LastActivityDate="2016-03-09T16:15:10.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29339" PostTypeId="2" ParentId="29124" CreationDate="2016-03-09T17:46:39.047" Score="0" Body="&lt;p&gt;After much searching and asking questions, I have written my own realization for the vibrato effect: &lt;strong&gt;&lt;a href=&quot;https://github.com/Bershov/Vibrato-effect&quot; rel=&quot;nofollow&quot;&gt;https://github.com/Bershov/Vibrato-effect&lt;/a&gt;&lt;/strong&gt;. The code is not hard for understanding and works fine. In fact, the vibrato is a kind of &lt;a href=&quot;https://en.wikipedia.org/wiki/Frequency_modulation&quot; rel=&quot;nofollow&quot;&gt;frequency modulation.&lt;/a&gt; Its key concepts: variable delay, low-frequency oscillation and intelpolation.&lt;/p&gt;&#xA;" OwnerUserId="13286" LastActivityDate="2016-03-09T17:46:39.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29340" PostTypeId="2" ParentId="29183" CreationDate="2016-03-09T17:49:55.330" Score="1" Body="&lt;p&gt;After much searching and asking questions, I have written my own realization for the vibrato effect: &lt;strong&gt;&lt;a href=&quot;https://github.com/Bershov/Vibrato-effect&quot; rel=&quot;nofollow&quot;&gt;https://github.com/Bershov/Vibrato-effect&lt;/a&gt;&lt;/strong&gt;. The code is not hard for understanding and works fine. In fact, the vibrato is a kind of &lt;a href=&quot;https://en.wikipedia.org/wiki/Frequency_modulation&quot; rel=&quot;nofollow&quot;&gt;frequency modulation.&lt;/a&gt; Its key concepts: variable delay, low-frequency oscillation and intelpolation.&lt;/p&gt;&#xA;" OwnerUserId="13286" LastActivityDate="2016-03-09T17:49:55.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29342" PostTypeId="2" ParentId="29331" CreationDate="2016-03-09T20:50:16.387" Score="0" Body="&lt;p&gt;I suspect a confusion between the ordinal domain (where the  frequencies indexed by $(u,v)$ live), and the cardinal domain (the amplitude of the filter for each $(u,v)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An ideal low-pass filter in 2D has amplitude $1$ (white disk) in some frequency domain $\mathcal{D}$ around the zero frequency, and $0$ outside (black), as illustrated in the central figure. The theory somehow requests that the domain $\mathcal{D}$ possesses central symmetry around point $(0,0)$: if $(u,v)\in \mathcal{D}$, then  $(-u,-v)\in \mathcal{D}$. One of the most natural domain has circular symmetry: it is defined as a disk centered at $(u_0,v_0) =(0,0)$, and radius $D_0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the amplitude is &quot;high&quot; ($1$), this is not a high frequency,  in a domain of low frequencies around $(0,0)$.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-09T20:50:16.387" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29343" PostTypeId="1" CreationDate="2016-03-10T00:00:44.873" Score="1" ViewCount="275" Body="&lt;p&gt;Please explain, mathematically, how can a bank of modulators be replaced with the IFFT in an OFDM system?&lt;/p&gt;&#xA;" OwnerUserId="19957" LastEditorUserId="11256" LastEditDate="2016-03-10T23:52:44.680" LastActivityDate="2016-03-10T23:52:44.680" Title="IFFT-based OFDM system" Tags="|modulation|ofdm|ifft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29344" PostTypeId="2" ParentId="29343" CreationDate="2016-03-10T02:16:02.980" Score="5" Body="&lt;p&gt;Say you want to transmit complex symbols $s_0,s_2,\ldots,s_{N-1}$ using frequency-division multiplexing. In the &quot;bank of modulators&quot; approach, you  would assign a carrier frequency $f_k$ to each symbol and create the signal &#xA;$$x(t) = \sum_{k=0}^{N-1} s_k \exp(j2\pi f_kt).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contrast this with the definition of the inverse discrete Fourier transform:&#xA;$$x[n] = \sum_{k=0}^{N-1} s_i \exp(j2\pi nk/N).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you interpret the symbols as the magnitude and phase of each carrier, and choose the carriers as $f_k=k/N$, then you'll see that you can generate $x(t)$ simply by converting $x[n]$ to an analog signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've explained how to transmit one block of symbols; extending this to multiple blocks has a slight complication and requires inserting a cyclic prefix to $x[n]$.&lt;/li&gt;&#xA;&lt;li&gt;I'm assuming a rectangular pulse shape, which results in sinc-shaped carriers in frequency. The beauty of this method is that the carriers are orthogonal even if they overlap. In practice, this means that you can recover the symbols $s_k$ by performing the DFT of $x(t)$.&lt;/li&gt;&#xA;&lt;li&gt;It is perfectly possible to use other pulse shapes with this method.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-03-10T02:16:02.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29346" PostTypeId="6" CreationDate="2016-03-10T02:30:12.260" Score="0" Body="&lt;p&gt;i dunno if i should toss my hat in the ring or not.  but it says there is one more position than the number of other candidates at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i haven't been around SE as long as datageist♦ or PeterK♦ have.  i have been around the USENET &lt;em&gt;comp.dsp&lt;/em&gt; longer than PeterK and likely longer than datageist.  on comp.dsp, we don't get to attach graphics or LaTeX-formatted equations like we get to do here, which is nice about this SE site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i poke my head around meta &lt;a href=&quot;http://meta.dsp.stackexchange.com/users?tab=participation&quot;&gt;http://meta.dsp.stackexchange.com/users?tab=participation&lt;/a&gt; a few times, but usually only if i wanna complain about something.  i am not fond of the extra layer of SE chat, but i'll go there if i have to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i used to consider myself reasonably anal regarding mathematics and mathematical expression, but cannot hold a candle to some other participants here.  i'm not going to worry too much about $\delta(t)$ being a &quot;distribution&quot;.  it's fine with me to call it a &quot;function&quot; and naked Dirac deltas outside of an integral are fine by me.  i don't worry too much about ROC or whatever regarding transforms.  and i don't worry too much about the difference between a norm (for a normed space) and a metric (for a more general metric space).&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-03-10T05:32:26.857" LastActivityDate="2016-03-10T05:32:26.857" CommentCount="2" CommunityOwnedDate="2016-03-10T02:30:12.260" ContentLicense="CC BY-SA 3.0" />
  <row Id="29347" PostTypeId="2" ParentId="29333" CreationDate="2016-03-10T06:03:48.577" Score="0" Body="&lt;p&gt;A typical type of &quot;pseudo-random&quot; sequences used in CDMA is the &quot;m-sequences&quot; that also provide good properties in wireless channels with multipath. Have a look to this post for more information about these: &lt;a href=&quot;http://www.behindthesciences.com/towards-5g/directsequencespreadspectrumandrakereceiver&quot; rel=&quot;nofollow&quot;&gt;http://www.behindthesciences.com/towards-5g/directsequencespreadspectrumandrakereceiver&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hope this helps :)&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-10T06:03:48.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29348" PostTypeId="2" ParentId="29343" CreationDate="2016-03-10T06:09:39.170" Score="-1" Body="&lt;p&gt;In order to understand the Pilots and Cyclic Prefix insertion you may want to have a look to a simpler OFDM blocks system. I hope this one: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/42902-lte-16qam&quot; rel=&quot;nofollow&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/42902-lte-16qam&lt;/a&gt; in Simulink can help you. Let me know if you have any question about the model :)&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-10T06:09:39.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29352" PostTypeId="2" ParentId="28846" CreationDate="2016-03-10T06:36:13.090" Score="-1" Body="&lt;p&gt;I'd like to make a comment about the relevance of this question in relation to 5G standards, where the lack of available spectrum is making researchers consider more and more to use of millimetre waves. This is a simple article about it: &lt;a href=&quot;http://www.radio-electronics.com/info/cellulartelecomms/5g-mobile-cellular/millimetre-wave-links.php&quot; rel=&quot;nofollow&quot;&gt;http://www.radio-electronics.com/info/cellulartelecomms/5g-mobile-cellular/millimetre-wave-links.php&lt;/a&gt; and this one is a bit more complete: &lt;a href=&quot;http://spectrum.ieee.org/telecom/wireless/millimeter-waves-may-be-the-future-of-5g-phones&quot; rel=&quot;nofollow&quot;&gt;http://spectrum.ieee.org/telecom/wireless/millimeter-waves-may-be-the-future-of-5g-phones&lt;/a&gt; note that this is from 2013. At the moment there are lots of publications talking about this topic and it is creating even a bit of controversy :D &lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-10T06:36:13.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29353" PostTypeId="1" CreationDate="2016-03-10T10:42:28.260" Score="1" ViewCount="61" Body="&lt;p&gt;I am trying to understand the following fact from this article (page 13):&#xA;&lt;a href=&quot;http://www.cell.com/neuron/pdf/S0896-6273(15)00596-6.pdf&quot; rel=&quot;nofollow&quot;&gt;How can single neurons predict behaviour&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a linear estimation of a stimulus:&#xA;$ \hat{s} = \mathbf{w}^T(\mathbf{r} - \mathbf{f}(s_0)) + s_0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{w}$ is a vector of weights, $\mathbf{r}$ is a vector of responses of two neurons to a stimulus, $\mathbf{f}$ is the vector of average neural responses to the stimulus, and the stimuli (angels between $-\pi$ to $\pi$) are symetric (amount and location) around $s_0 = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone see why the following is true for the Pearson correlation (where $\Sigma$ is the covariance matrix of $\mathbf{r}$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Corr(\hat{s},r_k) = \frac{\langle \hat{s}r_k \rangle - \langle \hat{s} \rangle \langle r_k \rangle}{\sqrt{( \langle \hat{s}^2 \rangle - \langle \hat{s} \rangle^2) }\sqrt{( \langle r_k^2 \rangle - \langle r_k \rangle^2) }} = \frac{(\Sigma \mathbf{w})_k}{\sqrt{(\Sigma_{kk}\mathbf{w}^T \Sigma \mathbf{w})}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="16077" LastEditorUserId="8202" LastEditDate="2016-03-21T23:49:50.657" LastActivityDate="2016-03-21T23:49:50.657" Title="Pearson correlation of neural responses with it's linear estimation" Tags="|image-processing|correlation|statistics|neural-network|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29354" PostTypeId="2" ParentId="29299" CreationDate="2016-03-10T12:58:13.503" Score="1" Body="&lt;p&gt;The simplest approach to this would be &lt;a href=&quot;https://en.wikipedia.org/wiki/Template_matching&quot; rel=&quot;nofollow noreferrer&quot;&gt;template matching&lt;/a&gt; via two-dimensional &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross-correlation#Normalized_cross-correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;normalised cross correlation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this basically does is looking for a &lt;em&gt;template&lt;/em&gt;: a small image representing the response letters, inside a (usually bigger) &lt;em&gt;image&lt;/em&gt;. The result that is returned from this operation looks like an image but it essentially has peak values where the template matches the image. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach transferred to this problem means that one cross correlation would have to be carried out for each possible answer and each resulting image examined for &quot;peaks&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this assumes that the letters appear at a single scale throughout the document. Otherwise, cross correlations would have to be applied (via an appropriate method) at different scales too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two components to be carefully managed here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quality and scale of the image:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be roughly controlled by instructing users to align the top left corner of their camera's field of view with the paper. This will constrain the distance from the image but it still depends on the lens of the mobile phone.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quality and scale of the template:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This depends on #1 and the hand-writing of the users. But on average, roughly equal size fonts can be used (as further below).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is an example based on &lt;a href=&quot;https://www.python.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python&lt;/a&gt;, &lt;a href=&quot;http://matplotlib.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;matplotlib&lt;/a&gt; and &lt;a href=&quot;https://scikits.appspot.com/scikit-image&quot; rel=&quot;nofollow noreferrer&quot;&gt;scikit-image&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from matplotlib import imshow, show&#xA;from skimage.io import imread&#xA;from skimage.feature import match_template&#xA;&#xA;#Load the image&#xA;Q = imread(&quot;tst4.jpg&quot;)&#xA;&#xA;#Load the template, here it is the letter A from the Sans font, approximately at the same size as the hand-written provided&#xA;A = imread(&quot;letter2.png&quot;)&#xA;&#xA;U = match_template(Q, A, pad_input = True)&#xA;&#xA;#Show the result&#xA;imshow(U);show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Please note, a more elaborate version of that is available via &lt;a href=&quot;http://scikit-image.org/docs/dev/auto_examples/plot_template.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result &lt;code&gt;U&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HFaCk.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HFaCk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a &lt;code&gt;Q&lt;/code&gt; that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q6b4e.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q6b4e.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And an &lt;code&gt;A&lt;/code&gt; that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ej7AX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ej7AX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;code&gt;U&lt;/code&gt; image, please note that the red colour corresponds to high peaks (very close to 1.0). Just putting a threshold on the pixel values of &lt;code&gt;U&lt;/code&gt; will return the centers of the 'A' symbols. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, other formations seem to have high correlation as well in that image. These are &quot;false-positives&quot;, that is, places where the algorithm THINKS there is an &quot;A&quot; but in reality there is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways by which these can be reduced (and increase the system's reliability):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply the template matching over a smaller area (this is now possible if the top left corner is roughly aligned with the edge of the paper)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add more features to the classification operation than just the peak of the cross-correlation between the template and the image to make it more robust. This is probably the next level in complexity and more information can be provided if needed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2016-03-10T12:58:13.503" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29355" PostTypeId="1" AcceptedAnswerId="29364" CreationDate="2016-03-10T12:59:01.717" Score="4" ViewCount="5872" Body="&lt;p&gt;I am trying to detect outliers/noise as indicated on the diagram below from sensor data. Can anyone advice how to go about it? I can only do this in python, so are there libraries in python that I can leverage? Is there an example that can be given. Sample data am using has timestamps and the value.&#xA;Also how can I also get the frequency of the noise/outlier occurence?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/AcFKw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AcFKw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19970" LastActivityDate="2023-06-11T17:36:25.683" Title="Detecting outliers/noise from sensor data" Tags="|signal-analysis|noise|continuous-signals|sensor|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29357" PostTypeId="2" ParentId="29223" CreationDate="2016-03-10T14:14:18.427" Score="0" Body="&lt;p&gt;An usual approach is to use two-dimensional polynomials of low degrees (lets say up to 5). For your images, probably a polynomial of 3rd degree would be sufficient to simulate/estimate the bias field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your images happen to have more structure (i.e. magnitude images), it is feasable to smooth them strongly (e.g. Gaussian blur with a large FWHM), since those field variations live on a larger scale than anatomical variations.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastEditorUserId="19501" LastEditDate="2016-03-10T19:33:58.190" LastActivityDate="2016-03-10T19:33:58.190" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29358" PostTypeId="1" CreationDate="2016-03-10T14:29:24.563" Score="0" ViewCount="65" Body="&lt;p&gt;I was looking at &lt;a href=&quot;https://stackoverflow.com/questions/27345861/extending-1d-function-across-3-dimensions-for-data-windowing&quot;&gt;this&lt;/a&gt; particular thread that discusses extending windowing functions for singling function to higher dimension. There is one bit in the accepted answer that I could not get my head around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, they create a multi-dimensional windowing function but then they scale the weights in this line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# scale the window intensities to maintain image intensity&#xA;np.power(window, (1.0/data.ndim), output=window)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the purpose of doing that?&lt;/p&gt;&#xA;" OwnerUserId="13347" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-06-09T12:29:55.167" Title="extending windowing function to higher dimensions" Tags="|filters|lowpass-filter|window-functions|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29359" PostTypeId="2" ParentId="1626" CreationDate="2016-03-10T14:29:56.057" Score="1" Body="&lt;p&gt;Here is a Matlab implementation of projection initialization for a 2nd order IIR.  For details, see &lt;a href=&quot;http://dspace.mit.edu/bitstream/handle/1721.1/97640/Chornoboy_1990_TR-828_WW-18359.pdf?sequence=1%00&quot; rel=&quot;nofollow&quot;&gt;Initialization for Improved IIR Filter Performance&lt;/a&gt; by Chornoboy.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% x is your input signal.&#xA;% y is the output signal.&#xA;% fs is the sample rate.&#xA;&#xA;% This example uses a 2nd order Butterworth high-pass filter with fc = 0.3 Hz.&#xA;fc = 0.3;&#xA;[bh, ah] = butter(2, fc/fs, 'high');&#xA;&#xA;A = [bh(2)-bh(1)*ah(2); bh(3)-bh(1)*ah(3)];&#xA;B = [-ah(2), -ah(3); 1 0];&#xA;C = [1;0];&#xA;&#xA;Np = 1.0 * fs; % Set Np to the length of data you want to train on.&#xA;F = zeros(Np, 2);&#xA;G = diag(bh(1) * ones(1, Np));&#xA;for ix = 1:Np&#xA;   F(ix, :) = A'*B^(ix-1);&#xA;   if ix &amp;gt; 1&#xA;      for cix = (ix-1):-1:1&#xA;         G(ix, cix) = A'*B^(ix-cix-1)*C;&#xA;      end&#xA;   end&#xA;end&#xA;&#xA;% Filter the data using state variables.&#xA;Mm1 = -inv(F'*F)*F'*G * x(1:Np); % M(-1)&#xA;y = zeros(size(x));&#xA;for ix = 1:length(y)&#xA;   Mn = B*Mm1 + C*x(ix);&#xA;   y(ix) = A'*Mm1 + bh(1)*x(ix);&#xA;   Mm1 = Mn;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that step initialization is done by setting &lt;code&gt;Mm1 = 1/(1 + ah(2) + ah(3)) * [1; 1];&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And zero initialization is done by setting &lt;code&gt;Mm1 = [0;0];&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="570" LastActivityDate="2016-03-10T14:29:56.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29363" PostTypeId="2" ParentId="9033" CreationDate="2016-03-10T20:04:04.520" Score="1" Body="&lt;p&gt;Well, without knowing the specifics of your algorithm, I assume that you basically have multiple functions (e.g. Gaussian or Lorentzian peaks, each with position and FWHM parameters, additionally maybe some polynomials for backgrounds etc.) and you sum them all up into one big &quot;fit function&quot; that you hand over to an optimization algorithm that jiggles the parameters around until you found a good fit in the sense of non-linear least squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do then is computing the &lt;em&gt;asymptotic standard errors&lt;/em&gt;. For this, you have to (most likely numerically) compute the Jacobi Matrix of your fit function (matrix of partial derivatives for each parameter (columns) at each measurement point (rows)). From this you can compute the variance-covariance matrix and then compute the errors for each parameter. This is an approach very often found in curve fitting software. In fact, there is a quite comprehensive explanation &lt;a href=&quot;http://www.originlab.com/doc/Origin-Help/NLFit-Algorithm#How_Origin_Fits_the_Curve&quot; rel=&quot;nofollow&quot;&gt;here at OriginLabs&lt;/a&gt; (see the section on Parameter Standard Errors). Also a more detailed overview can be found &lt;a href=&quot;http://arxiv.org/abs/1210.3781&quot; rel=&quot;nofollow&quot;&gt;here at arxiv&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other methods are discussed in &lt;a href=&quot;http://arxiv.org/abs/1009.2755&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;. They certainly are appropriate and maybe even mandatory in some cases, but I find them a bit too complicated for most &quot;real world&quot; applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were you, I would go with the asymptotic standard errors for a first start and see, if they fit the needs. It is an easy to implement strategy that is, as already said, also widely found in software packages.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-10T20:04:04.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29364" PostTypeId="2" ParentId="29355" CreationDate="2016-03-10T21:08:16.753" Score="3" Body="&lt;p&gt;There are several ways you can do this, however this is highly specific to the data you are analyzing. I will describe some of very general (not domain/data specific) approaches below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible approach I can think of that'd deal with this sudden, HF noise is to run a window with desired length through the signal. In every iteration, you'd take several samples for this window (i.e. for t=0 to t=10, then t=1 to t=11 and so on) and measure the rate of change within the window. If the rate of change is below some threshold you defined, you'd draw a line from the last point where the rate of change is below the threshold to the beginning on the next window where the rate of change is below the threshold again. This might or might not work, however I described the more general and popular ways below:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;One of the simplest and most naive ways would be to apply a high order low pass filter that would remove higher frequencies (sudden changes are high frequency peaks in Fourier spectrum) - this would simply smooth out your signal but it would also alter it, so it could be no longer useful. Obviously you'd have to set up the cutoff frequency properly to get a satisfactory result. If the HF peaks have some specific, known frequency, you can also apply a band stop filter (or a few of them, pretty much like an audio equalizer!). It's pretty trivial to implement these filters as IIR and a bit more complex if you need FIR. You can find a lot of information about how to implement them in the Internet and there are most likely ready scripts for Python that readily implement them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another - and perhaps a better approach - would be to use Kalman filter, but again, it's not obvious to tune and you'd need some more understanding of your signal and the Kalman filter to implement it succesfuly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Yet another (more sophisticated) approach is to use sample-based noise removal techniques, however the signal you presented doesn't seem to have just a single feature that could be processed with such the filter, so you'd have to apply it several times. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you need help understanding/implementing any of the solutions described below, feel free to ask!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the question about how to measure the noise frequency - you can manually select the time range in which the noise occurs and draw a FFT spectrum / Histogram of it and find the peak value. That's the most prevalent frequency in your noise. As far as I can see, your signal is very smooth and thus low frequency, so it won't have much influence on this kind of measurement. If you don't feel like doing this in Python, you can always export it to a text format acceptable by Matlab or Scilab (free) and these programs have ready tools for doing this kind of analysis.&lt;/p&gt;&#xA;" OwnerUserId="19977" LastEditorUserId="19977" LastEditDate="2016-03-10T21:25:38.960" LastActivityDate="2016-03-10T21:25:38.960" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29365" PostTypeId="2" ParentId="29330" CreationDate="2016-03-10T21:32:44.463" Score="0" Body="&lt;p&gt;You are moving a fairly advanced topic here. I'm not an acoustics expert, but I can clearly see how the room layout (i.e. are there just walls or lots of furniture, curtains etc.) would affect the answer here. The frequency of the sound, position of the listener and distance/orientation of the speakers are not without meaning here. Based on this data, you could come up with some specific solution that'd reduce the interference &lt;strong&gt;locally&lt;/strong&gt;, but simple phase decorelation will only make it sound strange (i.e. if you simply reverse the polarity of one speaker and leave one unchanged or digitally shift the phase by fixed number of deg)&lt;/p&gt;&#xA;" OwnerUserId="19977" LastActivityDate="2016-03-10T21:32:44.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29366" PostTypeId="2" ParentId="26360" CreationDate="2016-03-11T03:03:31.180" Score="2" Body="&lt;p&gt;I would use a novelty detection approach: Use SVMs (one-class) to find a hyperplane around the existing positive samples. Alternatively, you could use GMMs to fit multiple hyper-ellipsoids to enclose the positive examples. Then given a test image, for the case of SVMs, you check whether this falls within the hyperplane or not. For GMMs, you check if it is enclosed in the hyper-ellipsoids. They are both proven to work well in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you also have some unlabled data in your training set, I would certainly adapt a variant of &lt;a href=&quot;ftp://ftp.cs.wisc.edu/machine-learning/shavlik-group/torrey.handbook09.pdf&quot; rel=&quot;nofollow&quot;&gt;transfer learning&lt;/a&gt;. Maybe you would be able to automatically label the unlabeled data, based on the already learnt samples.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2016-03-11T03:03:31.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29369" PostTypeId="2" ParentId="29153" CreationDate="2016-03-11T08:49:43.983" Score="0" Body="&lt;p&gt;I have decided to take a different approach: Rather than passing the raw accelerometer data through a filter and choosing between overshoot and ringing versus bias, I am now detecting bias by periodically comparing extrapolated $\Delta \psi _{gyro}$ to $\Delta \psi _{GPS}$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Initially assume zero bias.&lt;/li&gt;&#xA;&lt;li&gt;For each extrapolation step, subtract bias from measured $\omega _\psi$&lt;/li&gt;&#xA;&lt;li&gt;On each new GPS bearing, calculate the &lt;em&gt;change&lt;/em&gt; in bias as $\frac{\Delta \psi _{gyro} - \Delta \psi _{GPS}}{t}$&lt;/li&gt;&#xA;&lt;li&gt;Add this change to the previous bias estimate&lt;/li&gt;&#xA;&lt;li&gt;Determine the accuracy of the new bias estimate, considering the accuracy of $\psi _{GPS}$, approximate standard deviation of gyroscope output at rest and time elapsed&lt;/li&gt;&#xA;&lt;li&gt;If we have a previous bias estimate (other than the initial assumption of zero), run the old and new bias estimate through a Kálmán filter; else simply continue with the new bias estimate&lt;/li&gt;&#xA;&lt;li&gt;Return to step 2.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Results look good so far – this visibly reduces bias without introducing any new artifacts. Responsiveness still needs to be improved, which I can probably tackle by tweaking my accuracy model.&lt;/p&gt;&#xA;" OwnerUserId="19821" LastActivityDate="2016-03-11T08:49:43.983" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29370" PostTypeId="2" ParentId="29358" CreationDate="2016-03-11T09:34:24.127" Score="1" Body="&lt;p&gt;Without being familiar with the library they use, this pretty much looks to me like a numerical normalizing condition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why you need this&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is needed in order to not change the magnitude of the numbers in your data set after filtering. Consider for example a large (multidimensional) region in your image data that exhibits the same value everywhere, e.g. 529. If you filter/smooth this dataset with a filter that has a FWHM that is considerably smaller than the size of the region, you would expect that the value in this region does not change. If you wouldn't include this normalizing condition, this behavior is not guaranteed and you could end up with totally different values... e.g. 1E6 or 0.02 instead of 529. This would seriously complicate further computation, if you had a threshold or so in later processing steps. Or if you converted your data later on... The values would always depend on the filter settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A somewhat analytical example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a 1D Gaussian curve. It has a normalization factor $\displaystyle\frac{1}{\sqrt{2\pi}\sigma}$ that is needed to satisfy $\displaystyle\int G(x)\,\textrm{d}x = 1$. For higher dimensions this becomes a little bit more complex: $\displaystyle\frac{1}{\sqrt{(2\pi)^k |\Sigma|}}$, with $|\Sigma|$ being the determinant of the covariance matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A somewhat numerical example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do not know the analytical formula, you could also just construct your multidimensional Gaussian without the prefactor, numerically integrate it, and use the resulting factor as the normalization constant.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastEditorUserId="80" LastEditDate="2016-05-10T12:03:27.340" LastActivityDate="2016-05-10T12:03:27.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29372" PostTypeId="1" AcceptedAnswerId="29397" CreationDate="2016-03-11T11:59:20.467" Score="0" ViewCount="320" Body="&lt;p&gt;This my 1st post here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using this impulse invariant (MZT) based method to calculate coefficients for biquad digital filter (for RIAA and non-RIAA de-emph.):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double a0, a1, a2, b0, b1, b2;&#xA;double fs = 44100;&#xA;//timeconstants (case RIAA):&#xA;// frequency -&amp;gt; time conversion 1/(2*pi*fc) (= R*C)&#xA;//poles&#xA;double p1 = 3180e-6; // 1/(2*pi*50.05Hz)&#xA;double p2 = 75e-6;    // 2212Hz&#xA;//zeros&#xA;double z1 = 318e-6;  // 500.5Hz&#xA;double z2 = 0.0;       // 3.18e-6 for Neumann pole (50kHz)&#xA;&#xA;double pole1= exp(-1.0/(fs*p1)); &#xA;double pole2 = exp(-1.0/(fs*p2)); &#xA;double zero1 = exp(-1.0/(fs*z1));&#xA;double zero2 = exp(-1.0/(fs*z2));&#xA;&#xA;a0 = 1.0;   // = 1.0&#xA;a1 = -pole1 - pole2; // = -0.931176&#xA;a2 = pole1 * pole2; // = 0&#xA;b0 = 1.0; // = 1.0&#xA;b1 = -zero1 - zero2; // = -1.731986&#xA;b2 = zero1 * zero2; // = 0.733838&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Known issue for MZT is magnitude error close Nyqvist at low sample rates - above filter results over -3dB error at 20kHz. I'm trying to find a way to fix this error. When using 96kHz sampling the error at 20kHz is around 0.5dB so the error (range 20Hz-20kHz) gets fixed by rising the sampling frequency high enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not long ago Martin Visanec published an article &quot;Matched Second Order Digital Filters&quot; and he even kindly looked this case and tweaked his method suitable for above filter but the results he posted was not what I'm looking after (though, (without additional pole/zero pair) the result was less than ±0.3dB error in this above case). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there fitting methods one could consider to use for to improve the filter at low fs (for filtering system where coefficients are calculated in real time)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any thoughts and help with equations would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Juha&lt;/p&gt;&#xA;" OwnerUserId="19991" LastEditorUserId="19991" LastEditDate="2016-09-29T14:03:22.487" LastActivityDate="2016-09-29T14:03:22.487" Title="How to improve filter quality at low fs" Tags="|filters|optimization|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29375" PostTypeId="1" CreationDate="2016-03-11T16:05:50.673" Score="1" ViewCount="320" Body="&lt;p&gt;Let's suppose I have a camera which can move freely in 3D space and has 6 degrees of freedom. Is it possible to estimate the linear and angular velocity of the camera from 2 or more consecutive frames? If yes, are there any environment or camera constraints that must hold?&lt;/p&gt;&#xA;" OwnerUserId="14901" LastActivityDate="2016-03-12T09:44:56.233" Title="Estimate camera generalized velocity from consecutive frames" Tags="|computer-vision|estimation|camera|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29376" PostTypeId="1" AcceptedAnswerId="29378" CreationDate="2016-03-11T16:12:18.383" Score="0" ViewCount="271" Body="&lt;p&gt;I am not a &quot;proper&quot; DSP guy at all, so apologies in advance if I am making any basic errors in this question. I would really appreciate it if you could point out any errors I make.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an audio signal sampled at (say) 44100 Hz. I want to get a spectrogram from this signal and display it. For this question, I will be using the formula as displayed in &lt;a href=&quot;https://ccrma.stanford.edu/~jos/mdft/DFT_Definition.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/mdft/DFT_Definition.html&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take (say) 1024 of the frames at a time (which I will denote by $x$), and run an FFT routine over them, probably after applying a Hann window.&lt;/li&gt;&#xA;&lt;li&gt;This will give me the frequency domain representation of the input window. I will denote the output of the FFT routine by $X$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$X$ will effectively contain 512 values, with the value at index $n$ being the Fourier coefficient of the frequency $n * 22050 / 512$ Hz. Thus, say, the 300th sample of $X$ will correspond to the frequency 12919.92 Hz. (Is this understanding correct?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my actual problem: I am not really interested in frequencies above 5000 Hz since my input will be human voice. Instead of $X$ covering a frequency range of 22050 Hz, I would like to &quot;zoom in&quot; so that it covers a range of only 5000 Hz. I.e., I want a finer grained spectral decomposition till a lower frequency of 5000 Hz. My question: how do I do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An approach I can think of: currently my sampling rate is 44100 Hz. If I can &quot;reduce&quot; the sampling rate to 11025 Hz, then the normal FFT approach will work and the output of the FFT routine will cover only frequencies till approximately 5000 Hz. I can accomplish this by either,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Averaging every 4 frames of my original input.&lt;/li&gt;&#xA;&lt;li&gt;Taking only every 4th frame of my original input.&lt;/li&gt;&#xA;&lt;li&gt;Taking the max of every 4 frames of my original input.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Will any of the above 3 approaches work? Is there any other way of getting a finer grained spectrum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: it struck me later that I could achieve the result by using a larger &quot;bin&quot; . I.e., 8192 frames instead of 1024 frames as input to my FFT routine. Is this the best approach available?&lt;/p&gt;&#xA;" OwnerUserId="19997" LastEditorUserId="19997" LastEditDate="2016-03-11T16:57:51.290" LastActivityDate="2016-03-12T05:12:46.070" Title="How to get finer grained spectral decomposition for audio signals?" Tags="|fft|audio|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29378" PostTypeId="2" ParentId="29376" CreationDate="2016-03-11T17:19:39.920" Score="3" Body="&lt;p&gt;if you are not experiencing computational limits (like you have all of the CPU speed and memory that your heart desires), what i would suggest is just do a much longer DFT or FFT.  instead of 1024 points, do it with 16384 points or 65536 points or more.  you will have lotsa data up in the top two octaves that you don't need and can decide to ignore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you do &lt;strong&gt;not&lt;/strong&gt; want to have all of that data above 5512 Hz, then what i would recommend is formally downsampling by a factor of 4 and running the FFT on the downsampled data.  to downsample legitimately, first you have to apply a good low-pass filter and kill all of the content above 5 kHz.  after that LPF, then simply pick out every 4th sample, discarding the 3 samples in between.  your data will be reduced by a factor of 4, your sample rate will be 11025 Hz and your Nyquist will be 5512.5 Hz and you can send that data into an FFT and look at those results.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-03-11T17:26:12.293" LastActivityDate="2016-03-11T17:26:12.293" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29379" PostTypeId="2" ParentId="29375" CreationDate="2016-03-11T19:27:45.307" Score="1" Body="&lt;p&gt;It's possible, but it takes some sophisticated processing to do it effectively in a general environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, you can only detect motion &lt;em&gt;relative to&lt;/em&gt; what you can see in the field of view. This requires good foreground/background separation to eliminate objects that might themselves be moving relative to the background (which is presumably what you want to measure the camera motion against).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, the background must have enough features (edges) in it to make all six degrees of freedom unambiguously observable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It boils down to figuring out what the trajectories through the viewspace are of all the features in the scene, and then doing a cluster analysis of those trajectories in order to assign them to distinct objects. Finally, pick the cluster that most probably and most consistently represents the background. The inverse of this trajectory is the camera's trajectory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the geometry of the situation squared away, you still need information about the size of objects in the field of view in order to scale the results correctly.&lt;/p&gt;&#xA;" OwnerUserId="1996" LastEditorUserId="1996" LastEditDate="2016-03-11T22:35:28.090" LastActivityDate="2016-03-11T22:35:28.090" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29381" PostTypeId="2" ParentId="29376" CreationDate="2016-03-11T23:12:58.257" Score="3" Body="&lt;p&gt;If, by &quot;finer grained&quot;, you just want a more precise estimate of some isolated spectral frequency peaks, in low enough noise, of a single (pseudo)periodic signal (a single human voice, no background accompaniment, etc.) than provided by the given FFT result bin spacing, you do not need to use a lower sampling rate, nor need to use a longer window of data that might lower time resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead you can just interpolate a peak or peaks between DFT/FFT result bins, as long as none are closely spaced (less than several FFT bins apart).  &lt;a href=&quot;https://www.dsprelated.com/freebooks/sasp/Quadratic_Interpolation_Spectral_Peaks.html&quot; rel=&quot;nofollow&quot;&gt;Parabolic interpolation&lt;/a&gt; may slightly increase frequency resolution, &lt;a href=&quot;http://www.nicholson.com/rhn/dsp.html#3&quot; rel=&quot;nofollow&quot;&gt;windowed-Sinc interpolation&lt;/a&gt; is better.  But zero padding your short data window and using a much longer FFT is one simple very high-quality way to interpolate extra, more closely spaced, frequency points.  Note that interpolation does not help increase resolution if there are nearby spectral peaks or a high surrounding noise floor, so it does not work in the general case.  But in the case of a single voice in low noise, it might work reasonable well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW: Lowering sample rate by directly decimating or averaging is incredibly noisy and will likely corrupt your results.  Use a high quality low pass anti-aliasing filter instead.  Also, trying to zoom-in by 4X by various means may well be slower than just computing the full FFT with all the &quot;un-needed&quot; FFT result bins, and just throwing away (not looking at) the higher frequency results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you actually want a pitch frequency estimate rather than a spectral frequency peak estimate (two very different things, especially for voice), you can also interpolate an autocorrelation result.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-03-12T05:12:46.070" LastActivityDate="2016-03-12T05:12:46.070" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29383" PostTypeId="1" CreationDate="2016-03-12T03:30:11.037" Score="-1" ViewCount="79" Body="&lt;p&gt;It is well known that no time-limited signal is frequency-limited. So the frequencies of a time-limited signal extend upto infinity - may be decaying slowly or fastly in frequency domain.  But we take signal's frequency content to be zero beyond some frequency and take that as the maximum frequency of the signal. My two questions are: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is there a solid fail-proof rule by which we can fix the maximum frequency?&lt;/li&gt;&#xA;&lt;li&gt;When the max freq is fixed and sampling is done, how do we guarantee that the infinite foldings that occur in frequency spectrum due to sampling, do not reinforce each other, at some particular frequency within folding frequency and distort the spectrum of the sampled signal? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="1629" LastEditDate="2016-03-13T17:57:33.113" LastActivityDate="2016-03-13T17:57:33.113" Title="How is the 'max frequency' of a signal fixed?" Tags="|nyquist|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29384" PostTypeId="2" ParentId="26405" CreationDate="2016-03-12T04:59:29.537" Score="0" Body="&lt;p&gt;Maybe you could try using cross-correlation &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/xcorr.html&quot; rel=&quot;nofollow&quot;&gt;xcorr&lt;/a&gt;. It would give you delay in time domain.&lt;/p&gt;&#xA;" OwnerUserId="19345" LastActivityDate="2016-03-12T04:59:29.537" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29385" PostTypeId="2" ParentId="29383" CreationDate="2016-03-12T05:31:21.447" Score="1" Body="&lt;p&gt;In the real world, one must a-priori know or assume something about your time-limited signal, such as that all the stuff in the stop-band of your signal, system, and chosen anti-aliasing filter is below your desired noise floor at or above half your chosen sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's more out-of-band noise than you expect, say a nuclear warhead EMP goes off next to your microphone or 20 kHz audio low pass filter, and melts it, your assumptions may have failed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, nothing is fool proof.  You might be able to statistically characterize your signal to a distribution that fits within some bounds with sufficient likelihood.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, one doesn't necessarily assume anything to be zero.  There's usually some noise floor, even if you set it below preceptability.  Thus, you might be able to adjust your max frequency by requiring/allowing a different/higher noise floor for a given signal.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-03-13T04:59:03.583" LastActivityDate="2016-03-13T04:59:03.583" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29386" PostTypeId="1" AcceptedAnswerId="29387" CreationDate="2016-03-12T06:53:19.540" Score="0" ViewCount="182" Body="&lt;p&gt;I am working in something were I should use a upsampling filter. I have decided to use a Nyquist filter(Lth filter). I know that there are two constraints. The first The frequency vector values must mirror each other in pairs around $\pi/2$. The second is the amplitude vector values must mirror each other in pairs around a magnitude of 0.50 What I am looking for are references to actually design these types of filters. I cant find any references that show how to implement them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So dose anyone have a decent reference on hoe to design these filters? Does anyone have a reference on implementing these in Verilog?&lt;/p&gt;&#xA;" OwnerUserId="20006" LastEditorUserId="8202" LastEditDate="2016-03-12T10:05:24.390" LastActivityDate="2016-03-12T10:05:24.390" Title="Nyquist (Nth) digital filters" Tags="|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29387" PostTypeId="2" ParentId="29386" CreationDate="2016-03-12T07:45:21.460" Score="0" Body="&lt;p&gt;This Mathworks documentation gives a good overview about the different parameters: &lt;a href=&quot;http://uk.mathworks.com/help/dsp/examples/fir-nyquist-l-th-band-filter-design.html?requestedDomain=uk.mathworks.com&quot; rel=&quot;nofollow&quot;&gt;http://uk.mathworks.com/help/dsp/examples/fir-nyquist-l-th-band-filter-design.html?requestedDomain=uk.mathworks.com&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This tutorial goes into more detail: &lt;a href=&quot;http://www.analog.com/media/en/training-seminars/tutorials/MT-002.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.analog.com/media/en/training-seminars/tutorials/MT-002.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this one may be useful to clarify any doubt in the concepts presented before: &lt;a href=&quot;http://www.lumerink.com/courses/ECE697A/docs/Matlab%20Filter%20Design%20and%20Implementation.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.lumerink.com/courses/ECE697A/docs/Matlab%20Filter%20Design%20and%20Implementation.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;hope this helps&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-12T07:45:21.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29388" PostTypeId="1" CreationDate="2016-03-12T08:18:46.063" Score="3" ViewCount="257" Body="&lt;p&gt;If there is an N-point sequence, it has a Fourier Transform.  DFT of this sequence is the sampling of the Fourier Transform at N equally spaced points on the unit circle.  What happens if we take some M non-uniformly spaced samples on the unit circle with M &amp;lt; N, M = N and M &gt; N.  Any studies done on this.  If yes, what are the applications?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2016-04-11T09:57:37.517" Title="non-uniform sampling on the unit circle - applications" Tags="|dft|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29389" PostTypeId="2" ParentId="29388" CreationDate="2016-03-12T08:55:16.773" Score="1" Body="&lt;p&gt;You might like to have a look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Non-uniform_discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Wikipedia here&lt;/a&gt;. There are non-uniform Fourier Transformation applications. The article also gives some fields as example that use this technique.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more application that I am aware of is magnetic resonance imaging (MRI). In MRI, image data is sampled in Fourier space, hence you simply do a FFT of your data and you have your image - as long as the imaging sequence samples the data on a Cartesian grid. However, there are techniques that do &lt;em&gt;not&lt;/em&gt; obey this restriction, e.g. sample the data radially. By this, the measured data is distributed on concentric circles around the DC frequency and a simple FFT is therefore not suitable. It is possible to interpolate this data to a Cartesian grid and use FFT for the imaging process (this process is called regridding). Another technique is using a non-uniform FFT algorithm - which answers your question where it is used.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-12T08:55:16.773" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29390" PostTypeId="1" CreationDate="2016-03-12T08:55:19.163" Score="3" ViewCount="627" Body="&lt;p&gt;I am trying to display the spectrogram of an input audio signal (a newcomer to all things spectral here). The amplitudes of my audio signal can be assumed to be normalized between -1 and +1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose for the frequency $f$ in the DFT's output, the corresponding coefficient is $c$, in general a complex number. I would like to display the &quot;amplitude&quot; information contained in $c$ as a corresponding colored region on the spectrogram. Ideally to plot the spectrum, I would need a number that ranges from 0 to 1. 0 will represent the lowest amplitude I will record, and 1 the highest. There are a few ways I can think of to achieve this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Since the $|c| \le N$, where $N$ is the number of samples, I can normalize the magnitude of $c$ with respect to $N$ ($v = |c|/N$) and display the resulting $v$ as a spectral colour.&lt;/li&gt;&#xA;&lt;li&gt;Same as 1, but normalize $|c|$ wrt to $M$, the maximum magnitude of all Fourier coefficients. But this has the disadvantage of having to scan the entire data before the spectrum can be displayed, and will be a problem for large files. Also, this means that the spectrum display is relative to the intensity levels present in the current audio signal, and not valid in an &quot;objective&quot; sense.&lt;/li&gt;&#xA;&lt;li&gt;Convert $|c|$ into decibels, say $d = 20 \log_{10}(|c|/b)$, where $b$ is a base magnitude. I will then normalize $d$ from say $l$ (where $l$ is a lowest dB value I will register) to $u = 20 \log_{10}(N/b)$. I can then use $d$ in displaying the spectrum. But in this case, what should $b$ be?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question: what is the exact &lt;em&gt;physical&lt;/em&gt; significance of the magnitudes of the Fourier coefficients in the DFT of audio signals and how can it be best displayed? I have tried all the above approaches, but am wondering which of them is the most proper or if I am missing any others.&lt;/p&gt;&#xA;" OwnerUserId="19997" LastEditorUserId="8202" LastEditDate="2016-03-13T09:51:22.233" LastActivityDate="2018-06-04T02:17:51.230" Title="What is the physical significance of the Fourier coefficients in the DFT of audio signals and how can they be best displayed in a spectrogram?" Tags="|audio|dft|" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29391" PostTypeId="1" AcceptedAnswerId="29409" CreationDate="2016-03-12T09:29:08.257" Score="1" ViewCount="613" Body="&lt;p&gt;I want to filter a very long signal in smaller parts, therefor I am currently using scipys &lt;code&gt;lfilter&lt;/code&gt; with an initial filter delay doing multiple iterations of: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(signal_part_filtered, filter_delay) = lfilter(b, a, signal_part, zi = filter_delay)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first few iterarions are going as expected (original is blue; filtered is red): &#xA;&lt;a href=&quot;https://i.stack.imgur.com/tREUE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tREUE.png&quot; alt=&quot;First iteration&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But after a few iterations the inital filter delay keeps getting bigger: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/pnS6K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pnS6K.png&quot; alt=&quot;After a few iterations&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Qthc8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qthc8.png&quot; alt=&quot;Even more iterations&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the issue might be the limited precision of the float datatype, is there any way to solve this? &lt;/p&gt;&#xA;" OwnerUserId="15853" LastEditorUserId="4298" LastEditDate="2016-03-13T10:22:19.763" LastActivityDate="2016-03-13T17:57:37.850" Title="Unexpected behaviour when using lfilter with initial filter delay multiple times" Tags="|filters|python|infinite-impulse-response|butterworth|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29392" PostTypeId="2" ParentId="29375" CreationDate="2016-03-12T09:44:56.233" Score="1" Body="&lt;p&gt;The term you are looking for is &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Optical_flow&quot; rel=&quot;nofollow&quot;&gt;Optical Flow&lt;/a&gt; and it is a very actively researched field along with (the also relevant here) Simultaneous Localisation and Mapping or &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Simultaneous_localization_and_mapping&quot; rel=&quot;nofollow&quot;&gt;SLAM&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting a robust velocity estimate from one or more cameras is not going to be &quot;easy&quot; as a lot of processing needs to be carried out to reduce uncertainties from a number of factors that are difficult to control for (e.g relative motion and constantly changing geometry). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information and representative examples please see &lt;a href=&quot;http://people.inf.ethz.ch/lomeier/publications/IROS_2012_realtime_optical_flow_stereo.pdf&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt; and &lt;a href=&quot;http://www.robots.ox.ac.uk/~lav/Papers/williams_reid_icra2010/williams_reid_icra2010.pdf&quot; rel=&quot;nofollow&quot;&gt;this link&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="1212" LastActivityDate="2016-03-12T09:44:56.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29393" PostTypeId="1" AcceptedAnswerId="29481" CreationDate="2016-03-12T10:20:35.477" Score="2" ViewCount="678" Body="&lt;p&gt;I am not from DSP background and also not sure if I am posting this in right community. I have basic understanding of resistors, capacitors and filters.&#xA;My requirement is as follows- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The supply voltage is fixed and I would like to simulate the output of the filter using Python. With a fixed input voltage, I would like to know what is the output voltage at R3. The current is sampled at a frequency of 100 milliseconds. The input is a DC voltage, which can change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused where should I start from. Should I use scipy library? &#xA;Since I want a time domain output, what is the best approach?&#xA;Is there some specific reading material for such problem?&#xA;Which kind of filter would be this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please excuse for a basic question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aSR5j.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aSR5j.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20007" LastEditorUserId="20007" LastEditDate="2016-03-12T18:45:52.303" LastActivityDate="2016-03-16T07:51:24.280" Title="discrete digital filtering in python" Tags="|filters|python|scipy|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29395" PostTypeId="1" CreationDate="2016-03-12T11:29:12.380" Score="1" ViewCount="352" Body="&lt;p&gt;I am having little difficulty to understand that why most of the adaptive algorithms use error power or addition of error power as cost function/minimization criterion. I have read that minimization of error power criterion gives us best results from estimation mean point of view. I am not being able to grasp that either. So can someone please tell me in simple language what are the actual reasons to use above criterion? Why cant we simply use error as the minimization criterion?&lt;/p&gt;&#xA;" OwnerUserId="20010" LastActivityDate="2016-03-12T13:41:01.533" Title="Cost function for adaptive algorithms" Tags="|discrete-signals|estimation|adaptive-algorithms|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29396" PostTypeId="1" CreationDate="2016-03-12T11:50:57.830" Score="1" ViewCount="204" Body="&lt;p&gt;I am looking for some help to understand the concept how RLS converges? If possible to present it graphically that would be best. It is very easy to understand the understanding of convergence in case of LMS Algorithm but i am not being able to graphically visualize how its happening in case of RLS. How the cost function surface is being formed combining all previous weighted error? and How the weights are approaching towards optimum value on that surface?&lt;/p&gt;&#xA;" OwnerUserId="20010" LastActivityDate="2016-03-12T11:50:57.830" Title="RLS Algorithm Convergence" Tags="|estimation|kalman-filters|adaptive-filters|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29397" PostTypeId="2" ParentId="29372" CreationDate="2016-03-12T11:54:58.930" Score="0" Body="&lt;p&gt;The impulse invariance method as well as the bilinear transform will give you relatively large errors close the Nyquist and there is nothing you can do about it. One thing you &lt;em&gt;could&lt;/em&gt; do is use a filter design method that approximates the given analog response. I've tried this for the RIAA de-emphasis fitler with an (unpublished) algorithm I came up with some time ago, and the figure below shows the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vccjE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vccjE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The digital filter is a second-order IIR filter, the sampling frequency is $f_s=44100\text{ Hz}$, and the error is much less than 1dB over the whole frequency range up to Nyquist. The price you pay for it is 20 iterations of an approximation method, which solves a $5\times 5$ system of linear equations in each iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you add one more pole and one more zero (i.e. your discrete-time filter has 3 poles and 3 zeros), then the error goes down to less than 0.1 dB over the whole frequency range up to Nyquist:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lTLvZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lTLvZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-03-12T17:25:57.753" LastActivityDate="2016-03-12T17:25:57.753" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29398" PostTypeId="2" ParentId="29395" CreationDate="2016-03-12T13:41:01.533" Score="1" Body="&lt;p&gt;In a very simple form: Gaussian-like noises are frequent, and derivatives of squared functions are easy to minimize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In very simple words: error, directly, cannot be used as a criterion. You can minimize a signed function to $-\infty$, which is not really useful here. As least, you need a cost function with a lower bound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Power (if by that you mean the squared error) is an increasing function of the error, and positive. So if you minimize power, you can expect to minimize, somehow, a measure of the error (more precisely its absolute value). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first problem is that the absolute value is not differentiable around zero, and can be difficult to optimize (one may look for a zero in the derivative). And when can you very easily find a zero in a derivative? When it is linear, because since Laplace, Gauss, Seidel such systems can be solved efficiently (matrix inversion). What are the functions that yield linear derivatives? Squares, parabolas...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, for a while, squared functions were the only ones one could solve easily. The standard mean is just the minimum of the sum of differences squared. Interestingly, in linear cases, unrelated disturbances can add with a Gaussian distributions. And Gaussian distributions are well-related to squared errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you are interested, recent advances in optimization allow to optimize more easily other types of functions, including absolute value loss criteria   or penalties.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-12T13:41:01.533" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29399" PostTypeId="1" AcceptedAnswerId="29400" CreationDate="2016-03-12T14:15:03.683" Score="0" ViewCount="76" Body="&lt;p&gt;I have taken measures of an antenna with a vectorial spectrum analyzer. I need to obtain the central frequency at which the antenna works. In order to do so, I have selected S11 (reflection) and I have plotted the &quot;log magnitude&quot; of the spectrum, I obtained something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/er14J.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/er14J.jpg&quot; alt=&quot;Results obtained from the spectrum analyzer&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the central frequency is obtained from one of the peaks shown on the plot. But in this case, I obtain three peaks. Which one should I take if they are pretty much the same? (no peak is considerably greater than the others)&lt;/p&gt;&#xA;" OwnerUserId="15846" LastActivityDate="2016-03-12T14:19:58.190" Title="How to determine the central frequency from a vectorial spectrum analyzer?" Tags="|frequency-spectrum|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29400" PostTypeId="2" ParentId="29399" CreationDate="2016-03-12T14:19:58.190" Score="1" Body="&lt;p&gt;The S11 represents the relative amount of signal that is reflected from the antenna, so the lower the better, because lower means more radiated by the antenna.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, we consider the antenna to be &quot;working&quot; at a given frequency if its S11 is lower than -10 dB (of course, this requirement can be changed according to the application. spatial antennas are more around -20 dB for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, your antenna seems to be working at three distinct frequencies (with the s11 &amp;lt; -10 dB criterion). Is this a problem ? It depends on the hardware you put behind it during operation.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastActivityDate="2016-03-12T14:19:58.190" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29403" PostTypeId="1" AcceptedAnswerId="29408" CreationDate="2016-03-12T19:05:02.357" Score="0" ViewCount="316" Body="&lt;p&gt;I've been attempting to plot the following function using MATLAB:&#xA;$$&#xA;x(k)=\sum_{n=11}^{50} \sqrt{n} \sin (2n\pi k) +\sum_{n=1}^{40}\sqrt[3]{n} \sin (3n\pi k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $k$ is a continuous variable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I am facing with MATLAB is when I plot it, I get a signal which has a fundamental period of 2 seconds, and not 1.5 seconds. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pgjNW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pgjNW.png&quot; alt=&quot;Plot using MATLAB plot function&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried a higher sampling rate:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7eO5Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7eO5Z.png&quot; alt=&quot;At a higher sampling rate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what is going on wrong? Why isn't the fundamental period 1.5Hz? &lt;/p&gt;&#xA;" OwnerUserId="8409" LastEditorUserId="4298" LastEditDate="2016-03-13T09:21:02.023" LastActivityDate="2016-03-13T09:21:02.023" Title="Signal's Fundamental Frequency is different from Plotted Signal" Tags="|matlab|fourier-series|bandwidth|periodic|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29406" PostTypeId="1" CreationDate="2016-03-13T02:03:50.823" Score="4" ViewCount="293" Body="&lt;p&gt;If I'm analyzing a signal in the frequency domain, I know about the well known Nyquist criteria that the sample frequency must be &gt; 2x of the highest component present in the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are very few references related to the lowest frequency I can analyze.    This problem comes up in a lot of natural data where we have limited windows of observation because the instruments to do so were only invented or in wide spread use in the last 50-100 years, and natural cycles can be decades, centuries, or longer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One would think that you could analyze a component where at least one period was in the sample window, but I find because of required windowing to prevent edge effects that the signal often disappears (it depends on the phase).  I then thought it was a mirror of Nyquist and I could resolve any signal with at least 2 periods in a window, but actual analysis shows that to not be true when there's a another overlying signal whose period is similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found through experiment that I needed at least 5 periods to resolve a signal where there's another signal near the same frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a formal way of representing this problem or a definitive reference I can use?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the same issue apply to wavelet analysis in the same manner?&lt;/p&gt;&#xA;" OwnerUserId="19585" LastEditorUserId="19585" LastEditDate="2016-03-14T21:23:56.620" LastActivityDate="2016-03-14T21:23:56.620" Title="What is the LOW frequency resolution rule analogous to Nyquist?" Tags="|frequency-domain|nyquist|window|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29407" PostTypeId="2" ParentId="29390" CreationDate="2016-03-13T06:46:54.503" Score="0" Body="&lt;p&gt;Your question about the meaning of the coefficients is that they indicate the amplitude and phase at each frequency. Have a look at &lt;a href=&quot;http://ptolemy.eecs.berkeley.edu/eecs20/labs/LabVIEW_Labs/Lab07/Lab07.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this document&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For examples of spectrograms, have a look at &lt;a href=&quot;http://www.jot.fm/issues/issue_2010_01/column2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both documents are for the study of audio signals.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastEditorUserId="19249" LastEditDate="2017-01-08T08:34:49.523" LastActivityDate="2017-01-08T08:34:49.523" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29408" PostTypeId="2" ParentId="29403" CreationDate="2016-03-13T09:17:11.490" Score="0" Body="&lt;p&gt;With $k$ a continuous variable, the frequencies of the sinusoids in the first sum are $f_n=n$, i.e. they are integers. The frequencies in the second sum are integer multiples of $\frac32$. The highest fundamental frequency of which all those frequencies are integer multiples is $f_0=\frac12$. The frequencies in the first sum are given by $2mf_0$ (with integer $m$), and the frequencies in the second sum are $3mf_0$. With a fundamental frequency of $f_0=\frac12$, the fundamental period is $T=2$, as observed by you.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-13T09:17:11.490" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29409" PostTypeId="2" ParentId="29391" CreationDate="2016-03-13T10:32:00.187" Score="2" Body="&lt;p&gt;The problem is not in the filtering process but already at the design stage. Your specifications are very difficult to realize because your desired band is at very low frequencies. With these specs, the &lt;code&gt;butter&lt;/code&gt; routine returns an unstable filter (i.e., with two pole pairs outside the unit circle of the complex plane).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing you could try is reduce the filter order. Always check the maximum pole radius by computing the (magnitude of the) roots of the denominator polynomial. It could be that the design turns out to be OK for a lower filter order. Of course, your filter will be less steep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another, better approach would be to downsample your signal before filtering, so your pass band is not anymore in such a low frequency range (compared to the sampling frequency). This will avoid numerical problems in the filter design routine.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-13T10:32:00.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29410" PostTypeId="1" CreationDate="2016-03-13T12:50:41.707" Score="2" ViewCount="145" Body="&lt;p&gt;I'm trying to derive the Chernoff bound $\mathrm{erfc}(x) \le \exp(-x^2)$, by first showing:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathrm{erfc}(x) = \frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}\exp\left(-\frac{x^2}{\cos^2\theta}\right)d\theta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This equality should be derived by considering 2 independent, standard gaussian random variables $x_1, x_2$ and the region in the $x_1x_2$-plane where $|x_1|\le x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have so far, is come up with a diagram like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BqhTX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BqhTX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I consider the the probability where $x_1, x_2$ falls in the square (4 $\times$ &quot;blue square&quot;). Then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;P(x_1&amp;lt;x,x_2&amp;lt;x) &amp;amp;= P(x_1&amp;lt;x)P(x_2&amp;lt;x)\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{x}\int_{0}^{x}e^{-\frac{x_1^2+x_2^2}{2}}dx_1dx_2\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}\int_{0}^{\frac{x}{\cos\theta}}e^{-\frac{r^2}{2}}rdrd\theta\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}\int_{0}^{\frac{x^2}{2\cos^2\theta}}e^{-v}dvd\theta\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}-e^{-v}\Big|_0^{\frac{x^2}{2\cos^2\theta}}d\theta\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}1-e^{-\frac{x^2}{2\cos^2\theta}}d\theta\\&#xA;&amp;amp;=\frac{1}{4} - \frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}e^{-\frac{x^2}{2\cos^2\theta}}d\theta&#xA;\end{align}&#xA;This is the probability for the blue square, so for the entire square, I have:&#xA;\begin{align}&#xA;4P(x_1&amp;lt;x,x_2&amp;lt;x)&amp;amp;=1-\frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}e^{-\frac{x^2}{2\cos^2\theta}}d\theta&#xA;\end{align}&#xA;The probability of falling outside the square is:&#xA;$$1-\Big[1-\frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}e^{-\frac{x^2}{2\cos^2\theta}}d\theta\Big] = \frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}e^{-\frac{x^2}{2\cos^2\theta}}d\theta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm kind of stuck here. I think this is my $[Q(x)]^2$, but according to &lt;a href=&quot;http://wsl.stanford.edu/~ee359/craig.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (Eq 9), my $Q(x)$ is incorrect. How can I derive the $Q$-function in the paper using this gaussian RV derivation method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ETA: As per Dilip Sarwate's suggestion, I considered the circle that circumscribes the squares, and I got the following by considering just 1 (upper-right) quadrant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;P(\text{in the circle quadrant}) &amp;amp;= \frac{1}{2\pi}\int_{0}^{\sqrt{2}x}\int_{0}^{\sqrt{2x^2-x_2^2}}e^{-\frac{x_1^2+x_2^2}{2}}dx_1dx_2\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}\int_{0}^{\sqrt{2}x}e^{-\frac{r^2}{2}}rdrd\theta\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}\int_{0}^{x^2}e^{-v}dvd\theta\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}-e^{-v}\Big|_0^{x^2}d\theta\\&#xA;&amp;amp;=\frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}1-e^{-x^2}d\theta\\&#xA;&amp;amp;=\frac{1}{4}-\frac{1}{4}e^{-x^2}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\text{P(in the blue square)} &amp;amp;&amp;lt; \text{P(in the circle quadrant)}\\&#xA;\frac{1}{4} - \frac{1}{2\pi}\int_{0}^{\frac{\pi}{2}}e^{-\frac{x^2}{2\cos^2\theta}}d\theta &amp;amp;&amp;lt; \frac{1}{4}-\frac{1}{4}e^{-x^2}\\&#xA;\frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}e^{-\frac{x^2}{2\cos^2\theta}}d\theta &amp;amp;&amp;gt; e^{-x^2}&#xA;\end{align}&#xA;Let $v = \frac{x}{\sqrt{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}e^{-\frac{v^2}{cos^2\theta}}d\theta &amp;amp;&amp;gt; e^{-2v^2}&#xA;\end{align}&#xA;I still don't quite understand how my lefthand expression became erfc(v), since it was calculated from $P(x_1&amp;lt;x,x_2&amp;lt;x)$, and how to eventually get $\mathrm{erfc}(x) \le \exp(-x^2)$.&lt;/p&gt;&#xA;" OwnerUserId="19903" LastEditorUserId="19903" LastEditDate="2016-03-14T07:16:06.833" LastActivityDate="2016-03-14T20:05:47.053" Title="Derive chernoff bound for $\mathrm{erfc}(x)$" Tags="|digital-communications|math|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29411" PostTypeId="2" ParentId="29406" CreationDate="2016-03-13T16:30:08.857" Score="1" Body="&lt;p&gt;The &quot;limit&quot; depends on the signal-to-noise ratio, and the nearest interfering frequency(s). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the nearest interfering frequency carrier is tuned 1% away, you might need (not just 6, but) 250 cycles or more to resolve the two separated frequency peaks, depending on the window and the S/N.  Whereas, a single pure unmodulated sinusoid in zero noise might be determined in as little as 3 or 4 non-aliased samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, there may be better low frequency estimators than depending on just a single non-rectangularly-windowed peak DFT magnitude bin, as using just that magnitude bin might be throwing some information about the phase of interference from the (nearby) conjugate negative frequency image that could be useful in improving frequency estimation and/or detection.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-03-13T18:04:24.293" LastActivityDate="2016-03-13T18:04:24.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29413" PostTypeId="2" ParentId="29391" CreationDate="2016-03-13T17:57:37.850" Score="0" Body="&lt;p&gt;Alternative suggestion: don't use polynomials [b,a] as filter representation but keep it in poles and zeroes [z,p,k]. Then execute the filter as cascaded second order section. This will insure the that the poles stay inside the unit circle. In Matlab that would look something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% does not work&#xA;x0 = zeros(8192,1); x0(1) = 1; % digital delta function&#xA;[b,a] = butter(5,[0.00125 0.0625]);&#xA;y0 = filter(b,a,x0); &#xA;fprintf('Max of the impules response with polynomials = %g\n',max(abs(y0)));&#xA;&#xA;%% does work&#xA;[z,p,k] = butter(5,[0.00125 0.0625]);&#xA;sos = zp2sos(z,p,k);&#xA;y1 = sosfilt(sos,x0); &#xA;fprintf('Max of the impules response with second order sections = %f\n',max(abs(y1)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-03-13T17:57:37.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29415" PostTypeId="1" CreationDate="2016-03-13T19:27:14.740" Score="2" ViewCount="5438" Body="&lt;p&gt;I am very much into &lt;code&gt;DSP&lt;/code&gt;, but lately everybody is talking about &lt;code&gt;&quot;Data science&quot;&lt;/code&gt; and &lt;code&gt;&quot;deep learning&quot;&lt;/code&gt;, and from what I understand the whole thing about data science is &lt;strong&gt;to take a huge row of data, and extract meaningful data only from it.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isn't it what you do with &lt;code&gt;DSP&lt;/code&gt;, when you have a signal with noise and you extract the data from a raw of sampling? Or for example when you auto-correlate to find matches between signals?&#xA;Do you use the same statistical tools in both cases?&lt;/p&gt;&#xA;" OwnerUserId="17182" LastEditorUserId="15892" LastEditDate="2016-03-15T21:12:55.183" LastActivityDate="2016-03-16T08:56:34.627" Title="What is the real difference between DSP and AI/data science?" Tags="|discrete-signals|signal-analysis|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29416" PostTypeId="2" ParentId="29415" CreationDate="2016-03-13T22:00:44.847" Score="1" Body="&lt;p&gt;Currently, one difference between data science and DSP seems to be in the amount of literature on computational efficiency at lower transistor counts and/or energy levels.  A rack-full of GPU cores with a few kW of water cooling finds many different applications than something tiny that has to &quot;extract meaningful results&quot; using a hearing aid battery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another difference is that some well-defined problems have short clean mathematical closed-form DSP solutions that do not need huge data sets for training, plus even more testing.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-03-16T00:58:19.633" LastActivityDate="2016-03-16T00:58:19.633" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29417" PostTypeId="2" ParentId="29415" CreationDate="2016-03-14T02:56:00.143" Score="-2" Body="&lt;p&gt;DSP code that i see and try to write usually has a lot fewer conditional execution constructs (&lt;code&gt;if&lt;/code&gt; statements) than AI code does.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-03-14T02:56:00.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29418" PostTypeId="2" ParentId="27836" CreationDate="2016-03-14T03:18:29.307" Score="0" Body="&lt;p&gt;swt is udwt but the signal length in swt must be a power of two for more information check  pages 81-87 &quot;Wavelets and their Applications&quot; written by Misiti&lt;/p&gt;&#xA;" OwnerUserId="20027" LastActivityDate="2016-03-14T03:18:29.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29419" PostTypeId="1" AcceptedAnswerId="29431" CreationDate="2016-03-14T03:34:19.943" Score="0" ViewCount="74" Body="&lt;p&gt;In cyclic codes, a code vector can be obtained from another by simple circular shift.  Why then the other method is taught that is a bit round about?  Take the code polynomial. Multiply it by the polynomial with power equal to the circular shift amount and then take the modulo of another polynomial and then convert this resulting polynomial to the codevector to find that the code vector obtained by circular shift and this polynomial method are the same.  Apart from this interesting property is there any advantage of the polynomial method in implementation or in any other way?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="1629" LastEditDate="2016-03-15T16:42:40.977" LastActivityDate="2016-03-15T16:42:40.977" Title="In cyclic codes, a code vector can be obtained from another by simple circular shift. Why then the other method?" Tags="|channelcoding|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29420" PostTypeId="2" ParentId="29419" CreationDate="2016-03-14T06:46:01.163" Score="0" Body="&lt;p&gt;A codeword of a cyclic code is usually denoted: $a_0 a_1\ldots a_{n -1}$,&#xA;and to each such a codeword the polynomial $a_0 + a_1 x_1 + a_2 x_2 + \ldots + a_{n -1} x_{n -1}$ is associated.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\mathbf{F}_q[x]$ denotes the set of all polynomials over $\mathrm{GF}(q)$. $G$ is the generator matrix.&#xA;&lt;em&gt;$\text{deg}(f(x ))$ = the largest $m$ such that $x_m$ has a non-zero coefficient in $f(x)$&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Multiplication of polynomials:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $f(x)$, $g(x)$ belong to $\mathbf{F}_q[x]$, then &lt;em&gt;$\text{deg}(f(x) g(x)) = \text{deg}(f(x)) + \text{deg}(g(x))$.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Division of polynomials:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For every pair of polynomials $a(x)$, $b(x)$ different from $0$ in $\mathbf{F}_q[x]$ there exists a unique pair of polynomials $q(x)$, $r(x)$ in $\mathbf{F}_q[x]$ such that $a(x) = q(x)b(x) + r(x), \text{deg}(r(x)) &amp;lt; \text{deg}(b(x))$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, maybe &lt;a href=&quot;http://users.math.msu.edu/users/jhall/classes/codenotes/cyclic.pdf&quot; rel=&quot;nofollow&quot;&gt;this document&lt;/a&gt; is useful.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastEditorUserId="1629" LastEditDate="2016-03-14T13:28:43.763" LastActivityDate="2016-03-14T13:28:43.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29423" PostTypeId="1" AcceptedAnswerId="29501" CreationDate="2016-03-14T07:51:05.120" Score="3" ViewCount="3829" Body="&lt;p&gt;Is it possible to achieve image straightening as &lt;a href=&quot;https://www.camscanner.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;cam scanner&lt;/a&gt; does&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wIh0z.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wIh0z.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean selecting a non-rectangular region and converting it to a rectangular region as an image. I can only do re sizing and crop of rectangular region of image.  &lt;/p&gt;&#xA;" OwnerUserId="10220" LastActivityDate="2017-10-11T20:24:23.097" Title="How to achieve image straightening as cam scanner does?" Tags="|image-processing|image-registration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29424" PostTypeId="1" AcceptedAnswerId="29425" CreationDate="2016-03-14T07:54:34.643" Score="0" ViewCount="822" Body="&lt;p&gt;Currently I have a fairly accurate (50 µm) and large dataset from a 3D scanner and a set of high resolution pictures. Sadly the 3D scanner (a Nikon/Metris arm-based CMM that was hanging around the lab) doesn't record colour data, but this would be exactly what I need to extract the actual features I'm interested in. I started out by correcting the lens distortion for the camera, and also accounted for the non-linear distortion. What prevents me from doing this manually in software like Meshlab or Geomagic is that I have an extremely large set of objects to scan, which makes it highly unrealistic to do it by hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took the liberty to add a series of reference points which are visible to both the 3D scanner and conventional camera. I am able to detect these features on both the point cloud and images automatically. Sadly I must admit I underestimated a big part of this task: I now wish to automatically align the image versus the point cloud based on these reference points and project the image onto the point cloud or mesh. The reference points from the point cloud are in a XYZ format, while those from the image are 2D coordinates in the plane. They are already matched, so that presumably - according to a fellow Ph.D. student - difficult part is already done. And while I can think of a few ways to align, distort, and project the images this would most likely be a large investment of time from my part. I was wondering if any pre-existing libraries for this exist or at least if there are papers which present a method to do so. Based on the fact that software like Geomagic is able to do it I'd like to avoid reinventing the wheel. However I must humbly admit I can't seem to find them as I am probably using the wrong terminology.&lt;/p&gt;&#xA;" OwnerUserId="20030" LastEditorUserId="7338" LastEditDate="2016-03-14T17:22:02.587" LastActivityDate="2016-03-15T17:56:04.980" Title="Image distortion and alignment on 3D mesh / pointcloud" Tags="|computer-vision|3d|point-cloud|projection|photo|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29425" PostTypeId="2" ParentId="29424" CreationDate="2016-03-14T08:03:02.840" Score="0" Body="&lt;p&gt;If you're only left with matching 3D points to their corresponding 2D parts, this is a fairly task and called PnP &lt;a href=&quot;https://en.wikipedia.org/wiki/3D_pose_estimation&quot; rel=&quot;nofollow&quot;&gt;pose estimation&lt;/a&gt;. OpenCV has a lot of options to solve this problem. &lt;a href=&quot;http://docs.opencv.org/3.1.0/dc/d2c/tutorial_real_time_pose.html#gsc.tab=0&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is one tutorial, which you could maybe benefit. &lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2016-03-14T08:03:02.840" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29426" PostTypeId="1" CreationDate="2016-03-14T08:18:26.093" Score="0" ViewCount="29" Body="&lt;p&gt;I am looking for a transformation in which the gaussian wave when transformed with a particular analysis function would make the energy contents be mostly present only in a short band of frequencies? &lt;/p&gt;&#xA;" OwnerUserId="20028" LastActivityDate="2016-03-14T21:04:15.837" Title="Is there any transformation to exploit the sparsity of a Gaussian Wave?" Tags="|gaussian|sparsity|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29427" PostTypeId="2" ParentId="13106" CreationDate="2016-03-14T08:26:58.080" Score="1" Body="&lt;p&gt;This, I think is a homework question. When the signal of 4 KHz is sampled We will have 4KHz, 10 +/- 4KHz, 20 +/- 4KHz signals being present. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a signal of 8 Khz is samplrd, We will hve 8, 10+/-8KHz, 20 +/-8KHz etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There for we Will have 2KHz,KHz, 6KHz,and 8KHz being present when you use a low pass filter&lt;/p&gt;&#xA;" OwnerUserId="20028" LastActivityDate="2016-03-14T08:26:58.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29428" PostTypeId="6" CreationDate="2016-03-14T09:38:15.653" Score="0" Body="&lt;p&gt;Hi guys. I've been around here for a while. It all started by trying to find an answer about Kalman filters. DSP SE popped in my search results. That's how I fell in love with it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;So many clever people giving great answers. &lt;/li&gt;&#xA;&lt;li&gt;Only best answers are being upvoted. &lt;/li&gt;&#xA;&lt;li&gt;Duplicates are closed and deleted.&lt;/li&gt;&#xA;&lt;li&gt;Plain users can edit the Q/A to improve formatting and content.&lt;/li&gt;&#xA;&lt;li&gt;There is $\LaTeX$ $\heartsuit$ !!!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The one thing I really miss here is the culture of chatting with other people (take the Stack Overflow as an example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I tried to use my current moderation privileges as much as possible. Things to brag about:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Top #10 in &lt;a href=&quot;http://bit.ly/1MhsZ8j&quot; rel=&quot;nofollow&quot;&gt;all-time reputation&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Top #1 in &lt;a href=&quot;http://bit.ly/1P7RdSx&quot; rel=&quot;nofollow&quot;&gt;First Posts review queue&lt;/a&gt; - 1492/5480 reviews all-time.&lt;/li&gt;&#xA;&lt;li&gt;Top #1 in &lt;a href=&quot;http://bit.ly/1QS1nvZ&quot; rel=&quot;nofollow&quot;&gt;Posts edited&lt;/a&gt; - 557 so far. Sometimes spending even 30 minutes on a single question, trying to rewrite a terrible photo of a page filled with equations into $\LaTeX$.&lt;/li&gt;&#xA;&lt;li&gt;148 helpful flags. No idea how that compares to all users, but by looking at other profiles, it's quite a lot. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Apart from the main page, I am spending some time on &lt;a href=&quot;http://bit.ly/1pp9aaP&quot; rel=&quot;nofollow&quot;&gt;meta&lt;/a&gt; as well.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="8202" LastEditDate="2016-03-14T09:38:15.653" LastActivityDate="2016-03-14T09:38:15.653" CommentCount="2" CommunityOwnedDate="2016-03-14T09:38:15.653" ContentLicense="CC BY-SA 3.0" />
  <row Id="29429" PostTypeId="2" ParentId="29426" CreationDate="2016-03-14T11:15:07.270" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Gabor_wavelet&quot; rel=&quot;nofollow&quot;&gt;Gabor transform&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Morlet_wavelet&quot; rel=&quot;nofollow&quot;&gt;Morlet Wavelet&lt;/a&gt; could help you. Morlet Wavelet scaling functions are gaussians, whereas the imaginary and real parts of the wavelet can be tuned in frequency to be first and second differential approximators of gaussians.&lt;/p&gt;&#xA;" OwnerUserId="18051" LastActivityDate="2016-03-14T11:15:07.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29430" PostTypeId="1" AcceptedAnswerId="29455" CreationDate="2016-03-14T12:47:38.887" Score="1" ViewCount="640" Body="&lt;p&gt;I'm trying to find out if the correction (Jackson, Nelatury, Mecklenbräuker) could improve the (IIM based) filter response near Nyqvist.&lt;/p&gt;&#xA;&lt;p&gt;Here's my c++ routine (which is used for to calculate various RIAA and non-RIAA filters by just changing the timeconstant values and samplerate):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;double a0, a1, a2, b0, b1, b2;&#xA;double fs = 44100;&#xA;//timeconstants (case RIAA):&#xA;// frequency -&amp;gt; time conversion 1/(2*pi*fc) (= R*C)&#xA;//poles&#xA;double p1 = 3180e-6; // 1/(2*pi*50.05Hz)&#xA;double p2 = 75e-6;    // 2212Hz&#xA;//zeros&#xA;double z1 = 318e-6;  // 500.5Hz&#xA;double z2 = 0.0;       // 3.18e-6 for Neumann pole (50kHz)&#xA;&#xA;double pole1= exp(-1.0/(fs*p1)); &#xA;double pole2 = exp(-1.0/(fs*p2)); &#xA;double zero1 = exp(-1.0/(fs*z1));&#xA;double zero2 = exp(-1.0/(fs*z2));&#xA;&#xA;a0 = 1.0;   // = 1.0&#xA;a1 = -pole1 - pole2; // = -0.931176&#xA;a2 = pole1 * pole2; // = 0&#xA;b0 = 1.0; // = 1.0&#xA;b1 = -zero1 - zero2; // = -1.731986&#xA;b2 = zero1 * zero2; // = 0.733838&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Tried to google &amp;quot;ready to use&amp;quot; solution of this but the only source code I found few papers I could use for correction.&lt;/p&gt;&#xA;&lt;p&gt;Papers:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/870677&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jackson&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S0165168400001134&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mecklenbräuker&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S1051200406001424&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nelatury&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&lt;p&gt;Bypassed the above mentioned papers. Improved the method so that now there's no need for additional correction biquad but by using z2 (which is unused) for the correction. One can decide where the error lies. Result:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a4rCA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a4rCA.png&quot; alt=&quot;better fit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19991" LastEditorUserId="7092" LastEditDate="2022-05-18T12:13:09.667" LastActivityDate="2022-08-09T12:01:58.513" Title="Correcting Impulse Invariance Method" Tags="|filters|filter-design|infinite-impulse-response|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29431" PostTypeId="2" ParentId="29419" CreationDate="2016-03-14T13:18:06.240" Score="1" Body="&lt;p&gt;While it's true that a circular shift of a codeword is another codeword, it's not true that you can generate all codewords by shifting one codeword. Consider the all-zeros or all-ones codewords; they can't be generated by shifting any of the other codewords.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For very large codes, it is important to have simple algorithms to generate a codeword based on the input. Even if the algorithm seems to operate on a &quot;roundabout&quot; way for small codes, try to implement your idea using a code with $(n,k)=(100,50)$, just to give one example. You'll find that the &quot;roundabout&quot; way is actually much easier to implement!&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-03-14T16:02:45.490" LastActivityDate="2016-03-14T16:02:45.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29432" PostTypeId="1" CreationDate="2016-03-14T13:56:51.133" Score="1" ViewCount="273" Body="&lt;p&gt;I haven't been doing much signal processing over the years and I'm wondering if my logic is sound. I'd appreciate any input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I have a data set with independent variable ($A$) in Frequency ($1\textrm{ kHz}$-$101\textrm{ kHz}$) and the dependent variable ($B$) with units $\textrm{ Pa}$ (Pascals). These are experimental data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have a graph of $B$ ($\textrm{ Pa}$) versus $A$($\textrm{ Hz}$).&#xA;However, I'm required to represent my data in graph of $\frac{\textrm{ Pa}}{\sqrt{\textrm{Hz}}}$ versus $\textrm{ Hz}$. ($C$ being the new variable with units of $\frac{\textrm{ Pa}}{\sqrt{\textrm{Hz}}}$, Amplitude Spectral Density, or the square root of the Power Spectral Density)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Would it be grossly inaccurate to just average my dependent variable $A$ (with Units of $\textrm{ Pa}$) over the square-root bandwidth ($100\textrm{ kHz}$) of data $B$ to derive $C$?&lt;/li&gt;&#xA;&lt;li&gt;Or should I simply (not so simple,but) &lt;code&gt;ifft(A)&lt;/code&gt;. Then use &lt;code&gt;PSD = [fft(x).*conj(fft(x))]&lt;/code&gt;, and take the square root of PSD?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20035" LastEditorUserId="20035" LastEditDate="2016-03-15T07:52:55.027" LastActivityDate="2016-03-15T07:52:55.027" Title="How do I perform a spectral averaging? Amplitude spectral density" Tags="|power-spectral-density|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29433" PostTypeId="1" CreationDate="2016-03-14T14:47:15.313" Score="1" ViewCount="205" Body="&lt;p&gt;Scheduler schedules the resource for each UE. How often do a LTE eNodeB scheduler schedule? Is the time between each scheduling fixed?&lt;br&gt;&#xA; any idea/reference will be great help on this regard. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="19669" LastActivityDate="2016-03-14T14:47:15.313" Title="How often do a LTE eNodeB scheduler schedule?" Tags="|digital-communications|communication-standard|lte|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29435" PostTypeId="1" CreationDate="2016-03-14T15:58:04.310" Score="3" ViewCount="97" Body="&lt;p&gt;I have an image that has gone through an unknown number of jpeg and webp conversions (at least one but more likely 2+). Currently this image is a JPEG and contains corruptions in single color or mild gradient backgrounds. What could cause this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t4ijn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t4ijn.png&quot; alt=&quot;hmbrgr&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20041" LastActivityDate="2016-03-14T18:18:32.363" Title="What would produce this &quot;hamburger&quot; corruption on images?" Tags="|noise|image-processing|compression|jpeg|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29436" PostTypeId="2" ParentId="29410" CreationDate="2016-03-14T17:43:21.557" Score="2" Body="&lt;p&gt;I don't know why you are approaching the problem the way you are by going to a two-dimensional approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Chernoff bound starts with the observation that for any random variable&#xA;$X$ and &lt;em&gt;any&lt;/em&gt; $\lambda &amp;gt; 0$,&#xA;$$P\{X \geq a\} \leq E[\exp(\lambda(X-a))]\tag{1}$$&#xA;because $\exp(\lambda(x-a))\geq  \mathbf 1_{\{x\colon x \geq a\}}$.&#xA;Consequently, &#xA;$$P\{X \geq a\} \leq \min_{\lambda &amp;gt; 0}E[\exp(\lambda(X-a))].\tag{2}$$&#xA;For a standard Gaussian random variable, $E[\exp(\lambda(X-a))]$&#xA;can be found easily by using a method called &quot;completing the square&quot;&#xA;(in the exponent which as terms like $-\frac{1}{2}x^2+\lambda(x-a)$ in&#xA;it) and noting that the resulting integral is the integral&#xA;of a Gaussian density times a constant. Alternatively, you can&#xA;use the &lt;em&gt;moment-generating function&lt;/em&gt; and read off the answer.&#xA;After minimization with respect to $\lambda$, the result is&#xA;$$P\{X \geq a\} = Q(x) \leq e^{-\frac{x^2}{2}}.\tag{3}$$&#xA;The two-dimensional approach leads to the slightly better result&#xA;$$Q(x) \leq \frac 12e^{-\frac{x^2}{2}}.\tag{4}$$&#xA;Note that you have proved already that for $x &amp;gt; 0$,&#xA;$$P\{X_1&amp;gt;x, X_2&amp;gt;x\} = Q^2(x) \leq \frac 14 e^{-{x^2}}$$&#xA;from which $(4)$ follows immediately, and $(4)$ is not the&#xA;Chernoff bound on $Q(x)$.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2016-03-14T20:05:47.053" LastActivityDate="2016-03-14T20:05:47.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29437" PostTypeId="1" CreationDate="2016-03-14T17:54:31.797" Score="0" ViewCount="512" Body="&lt;p&gt;I have a DFT bank analyzer with N channels, but the the bandwidth of the signal occupies only the first 2 channels, therefore I'll reconstruct only these and not entire full bandwidth. I'd like to know if is mandatory to use an FFT with N points all polyphase components in the synthesis bank and . I would to use only FFT 2 points and only 2 polyphase components(8 taps each) in the synthesis bank. Is it possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks to all&#xA;Stefano&lt;/p&gt;&#xA;" OwnerUserId="18931" LastActivityDate="2017-05-12T05:23:23.040" Title="Synthesis DFT Filter Bank" Tags="|fft|filters|discrete-signals|signal-analysis|filter-bank|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29438" PostTypeId="2" ParentId="29435" CreationDate="2016-03-14T18:18:32.363" Score="5" Body="&lt;p&gt;JPEG projects $8\times 8$ blocks of images onto $64$ 2D cosine patterns:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y6x0D.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y6x0D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one in column $1$ and row $5$, once quantized, may look like your hamburger. Luminance and chroma components may get different subsampling patterns. I suspect that the low varying background is nearly horizontal, and due to the different processing steps, it ends up with a mid-frequency non-zero component. My main issue is its $10\times 10$ apparent size. Apparently, WebP also does some prediction on blocks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be interested in compression forencics, that try to recover the history of compression. For JPEG, &lt;a href=&quot;http://dsp.rice.edu/software/jpeg-chest&quot; rel=&quot;nofollow noreferrer&quot;&gt;JPEG CHEst (JPEG Compression History Estimation for Color Images)&lt;/a&gt; does the job, based on paper &lt;a href=&quot;http://signal.ece.utexas.edu/~queiroz/papers/neelsh-journal.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;JPEG Compression History Estimation&#xA;for Color Images&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-14T18:18:32.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29439" PostTypeId="2" ParentId="29437" CreationDate="2016-03-14T18:23:32.020" Score="1" Body="&lt;p&gt;Any spectrum that is between the two DFT bin centers ends up getting represented, in various proportions, in &lt;strong&gt;all&lt;/strong&gt; the DFT bins (in the rectangular window case, the proportions decay as in a Sinc function, roughly by 1/(i-k)).  Those proportions might be needed for your synthesis to be an accurate enough reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using 2 bins alone usually creates a beating effect at a low beat frequency.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-14T18:23:32.020" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29440" PostTypeId="1" CreationDate="2016-03-14T19:04:54.113" Score="2" ViewCount="956" Body="&lt;p&gt;I need to implement an ASK (ampliltude shift keying) demodulation using a DSP ( a dsPIC ) and programming in C. Especifically talking, I need to demodulate a signal from a car's key transponder. I already have a circuit of antenna that receive the signal and I already can sample it, but I still have a doubt of how could be the best way, faster and reliable, to filter the signal. &#xA;I was using a FIR filter using Kaiser windowing and 13 taps, but it demanded a lot of processing time and I still have some errors. Is there a better way to do it ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With my best regards,&#xA;Daniel.&lt;/p&gt;&#xA;" OwnerUserId="20038" LastActivityDate="2022-01-27T19:33:29.117" Title="ASK demodulation using DSP" Tags="|demodulation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29441" PostTypeId="2" ParentId="29437" CreationDate="2016-03-14T19:32:16.483" Score="0" Body="&lt;p&gt;If you only want to reconstruct your signal, as perfectly answered by @hotpaw2, the answer is no in general, especially if you have finnite length windows. But I do not see the point of performing analysis and synthesis without processing in the middle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do perform some processing or detection inbetween, then errors in reconstruction (ripples, leakage) can become negligible, especially if you use some amount of oversampling and use optimized inverses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An option though: downsample your sample first at a $2/N$ rate, and you can use the DFT filterbank on the full bandwidth, yet at a reduced rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[EDIT] After your mail, it  took me a while to understand... something. Let me try to rephrase it (and tell me if wrong). You have a 16-channel analysis filter-bank. You keep the first 2 channels, $c_1$ and $c_2$. You have a 16-channel analysis filter-bank, and you want to split it into two polyphase components $d_1$ and $d_2$. From what I understand, both A and S frequency comments won't match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, you can try to perform an implementation, input  a random noise, see what happens, and report the results here. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-03-17T21:07:01.283" LastActivityDate="2016-03-17T21:07:01.283" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29442" PostTypeId="1" CreationDate="2016-03-14T20:14:22.207" Score="1" ViewCount="2943" Body="&lt;p&gt;Is it true that if the order of numerator of a system function is larger than its denominator, then we can say that the system is causal? (Without finding R.O.C.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there similar thing for Stability?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="13320" LastEditDate="2016-11-21T12:56:50.773" LastActivityDate="2016-11-21T12:56:50.773" Title="Causal system, order of numerator and denominator" Tags="|signal-analysis|" AnswerCount="2" CommentCount="1" ClosedDate="2016-03-16T11:53:50.967" ContentLicense="CC BY-SA 3.0" />
  <row Id="29443" PostTypeId="2" ParentId="29426" CreationDate="2016-03-14T20:47:36.537" Score="1" Body="&lt;p&gt;Use a dictionary of Gaussian wave atoms, at all different locations and scales (or frequencies). A specific Gaussian should matching maximally with one of the atoms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a generic answer. More details to come if you tell more about your wave: definition, dimension, and purpose of the sparsifying transform&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-03-14T21:04:15.837" LastActivityDate="2016-03-14T21:04:15.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29444" PostTypeId="2" ParentId="21580" CreationDate="2016-03-14T21:52:49.167" Score="1" Body="&lt;p&gt;You dont have sigma specified for the gaussian filter. I typically use something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fspecial('gaussian',6*sigma,sigma);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as the gaussian kernel is roughly 6 x sigma wide. (see graph here but note they plot against variance &lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_function&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Gaussian_function&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of that, your padding should be 3 x sigma. But padding with zeros creates an edge in the image that might not have been there. You may get better results by replicating the outer pixels instead of padding with zeros:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;padarray(I,[3*sigma,3*sigma],'symmetric');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also you might want to do an &lt;code&gt;ifftshift&lt;/code&gt; before doing the &lt;code&gt;fft2&lt;/code&gt; of the filter (note the &lt;code&gt;i&lt;/code&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could up this to 8 x sigma (and 4 x sigma) if you really want most of the kernel. The gaussian kernel has infinite support so there will always be some circular convolution effect - you can't pad to infinity - but with 3 or 4 sigma padding it will be small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;btw MATLAB recommends using &lt;code&gt;imgaussfilt&lt;/code&gt; &lt;a href=&quot;http://au.mathworks.com/help/images/ref/imgaussfilt.html&quot; rel=&quot;nofollow&quot;&gt;http://au.mathworks.com/help/images/ref/imgaussfilt.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-03-14T21:52:49.167" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29445" PostTypeId="2" ParentId="29355" CreationDate="2016-03-14T22:14:57.060" Score="4" Body="&lt;p&gt;Regarding your next question, I will try to give you some long description explainig a general way of transforming filters defined by their transfer function into discrete domain. &lt;strong&gt;If you are not interested in the details, you can skip to the bottom, where I wrote a C code (tested).&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function of a first-order low pass filter (with unit gain) is defined as follows:&#xA;$$K(s) = \frac{1}{1+sT}$$&#xA;And its angular cutoff frequency defined as $$\omega_c = \frac{1}{T}$$&#xA;Therefore the cutoff frequency expressed in Hertz becomes &#xA;$$f_c=\frac{1}{2 \pi T}$$&#xA;$$T=\frac{1}{2 \pi f_c}$$&#xA;Whatever goes above this frequency, will be cut off with gain equal to -3dB/decade for the first order low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either using bilinear transform or by expressing the gain in form of differential equations and then discretizing them with Euler scheme you can obtain a discrete domain equation that expresses the gain. I prefer bilinear transform as it is more straightforward.&#xA;In order to apply bilinear transform we perform the following substitution:&#xA;$$ s = \frac{1}{T_s} \frac{1-z^{-1}}{1+z^{-1}}$$&#xA;Where Ts (&lt;strong&gt;not to be mistaken with T&lt;/strong&gt;) is sampling period, so in your case it is the number of seconds between each sample. I.e. for 44100Hz sampling frequency, Ts becomes 1/44100 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, after performing this substitution and simplifying terms, the discrete time transfer function (Z transform) of your filter becomes:&#xA;$$\frac{1+z^{-1}}{(1+2T_s/T) + (1-2T_s/T)z^{-1}}$$&#xA;Now lets recall the definition of Z transform. In general form it is expressed as the following:&#xA;$$ H(z) = \frac{b_0 + b_1z^{-1}+ b_2z^{-2} + ... + b_Mz^{-M}}{1 + a_1z^{-1}+ a_2z^{-2} + ... + a_Nz^{-N}} = \frac{Y(z)}{X(z)}$$&#xA;Where bare numerator coefficients from 1 to M (highest power) and a are denominator coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, a difference equation can be derived in the following way:&#xA;$$y(n) = b_0x(n) + b_1x(n-1) + b_2x(n-2) + ... + b_Mx(n-M)  - a_1y(n-1) - a_2y(n-2) - ... - a_Ny(n-N) $$&#xA;Where n means n-th sample, y is your output and x is your input. After applying the above, the simplified form of difference equation for your filter becomes:&#xA;$$y(n) = (1-\alpha)y(n-1) + \alpha x(n)$$&#xA;Where &#xA;$$ \alpha = \frac{T_s}{T + T_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that n-th sample (the current one) in filtered signal, called y(n) here, equals one minus alpha times the previous sample in filtered signal plus alpha times n-th sample in your source (noised) signal. In C language:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double lowpass (double x, double y_prev, double alpha)&#xA;{&#xA;    return (1.0-alpha)*y_prev + alpha*x;&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    double x[10] = {1,2,3,4,5,6,7,8,9,10}; //signal with noise&#xA;    double y[10]; //filtered signal (will be generated)&#xA;    double fc = 500.0; //500Hz cutoff frequency&#xA;    double Ts = 1.0/44100.0; //for example&#xA;    double T  = 1.0/(2.0*3.1415*fc);&#xA;    double alpha = Ts/(T+Ts);&#xA;&#xA;    y[0] = x[0]; //initialize first y sample as equal to first x sample&#xA;&#xA;    printf(&quot;Input\tOutput\n&quot;);&#xA;    int i;&#xA;    for(i=1; i&amp;lt;10; ++i)&#xA;    {&#xA;        y[i] = lowpass(x[i], y[i-1], alpha);&#xA;        printf(&quot;%.4f\t%.4f\n&quot;, x[i], y[i]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Without complicating this code, for higher order filtering, you can swap y with x once it is filtered and repeat what's in the loop. It's slow and naive, but otherwise, you'd have to take a power of the transfer function (i.e. K(s)^2 for second order filter) and derive the discrete equation again. Thankfully with some practice, you will see a pattern in this and (even better!) you can find ready derivations of higher order low pass filters in the Internet :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt; &lt;br&gt;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Low-pass_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Low-pass_filter&lt;/a&gt; &lt;br&gt;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Bilinear_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Bilinear_transform&lt;/a&gt; &#xA;&lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/Z_Transform_Difference_Equations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ccrma.stanford.edu/~jos/fp/Z_Transform_Difference_Equations.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19977" LastEditorUserId="19977" LastEditDate="2017-11-08T10:03:20.160" LastActivityDate="2017-11-08T10:03:20.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29446" PostTypeId="2" ParentId="29440" CreationDate="2016-03-15T00:44:56.173" Score="2" Body="&lt;p&gt;In general, a receiver would consist of these blocks:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;An analog band-pass filter centered around the carrier frequency.&lt;/li&gt;&#xA;&lt;li&gt;A low-noise amplifier to bring the signal above the receiver's sensitivity.&lt;/li&gt;&#xA;&lt;li&gt;Optionally, an analog intermediate frequency stage.&lt;/li&gt;&#xA;&lt;li&gt;A sampler. You can do bandpass sampling if the carrier frequency is too large for the ADC.&lt;/li&gt;&#xA;&lt;li&gt;In a DSP, implement:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Final downconversion if needed.&lt;/li&gt;&#xA;&lt;li&gt;Downsampling to reduce the sampling rate&lt;/li&gt;&#xA;&lt;li&gt;Carrier, frame and symbol synchronization&lt;/li&gt;&#xA;&lt;li&gt;Matched filtering to recover the bits with optimum BER (in the case of ASK with rectangular pulse shaping, the matched filter is just an integrate &amp;amp; dump filter)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I highly recommend that you get and read Telecommunications Breakdown, by Johnson and Sethares, which is available for free (as a draft) from the authors' website: &lt;a href=&quot;http://sethares.engr.wisc.edu/telebreak.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;C. R. Johnson, W. A. Sethares - Telecommunication Breakdown - Concepts of Communication Transmitted via Software-Defined Radio&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="7092" LastEditDate="2022-01-27T19:33:29.117" LastActivityDate="2022-01-27T19:33:29.117" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29447" PostTypeId="2" ParentId="29419" CreationDate="2016-03-15T03:19:26.460" Score="0" Body="&lt;p&gt;The &quot;other method&quot; that you refer to is in the &quot;frequency domain&quot; &#xA;or transform domain in some sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that $\mathbf C = (C_0, C_1, \cdots, C_{n-1})$ is the codeword&#xA;under consideration. A &lt;em&gt;cyclic right shift&lt;/em&gt; by $m$ places results in the&#xA;codeword $\hat{\mathbf C} = (C_{n-m}, C_{n-m+1}, \cdots, &#xA;C_{n-2}, C_{n-1}, C_0, C_1, \cdots, C_{n-m-1})$. As you cogently&#xA;observe, this shifting is easy to understand and implement etc.&#xA;Why, then, is the other, more complicated, method taught or used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that there are many things in DSP that are easy to do in one&#xA;domain that in the other. Now, the codeword $\mathbf C$, which can&#xA;thought of as being in the time domain has a corresponding&#xA;representation as a &lt;em&gt;polynomial&lt;/em&gt; $C(x)$ in the transform domain:&#xA;$$\mathbf C = (C_0, C_1, \cdots, C_{n-1}) \longleftrightarrow&#xA;C(x) = C_0 + C_1x + \cdots + C_{n-1}x^{n-1}.$$&#xA;(Any resemblance to a $z$-transform is strictly unintentional).&#xA;So, what is the polynomial $\hat{C}(x)$ corresponding to &#xA;$\hat{\mathbf C}$, the right cyclic shift of $\mathbf C$ by $m$&#xA;places? Well, first of all, note that the desired polynomial&#xA;is &#xA;\begin{align}&#xA;\hat{C}(x) = C_{n-m} +C_{n-m+1}x + \cdots &#xA; + C_{n-1}x^{m-1} + C_0x^m +  C_1x^{m+1} \cdots&#xA;+ C_{n-m-1}x^{n-1}.\tag{1}&#xA;\end{align}&#xA;Now, note that&#xA;\begin{align}&#xA;x^m C(x) &amp;amp;= 0 + 0x + 0x^2 + \cdots + 0x^{m-1}\\&#xA;&amp;amp; \qquad + C_0x^m + C_1x^{m+1} + \cdots + C_{n-m-1}x^{n-1}\\&#xA;&amp;amp; \qquad\qquad + C_{n-m}x^{n} + C_{n-m+1}x^{n+1} +&#xA;\cdots + C_{n-2}x^{n+m-2} + C_{n-1}x^{n+m-1}&#xA;\end{align}&#xA;which in comparison to $(1)$ has $m$ leading $0$'s, then $C_0$ through $C_{n-m-1}$ in the proper place, and then extra stuff at the high&#xA;order end.  So, how can we massage $x^mC(x)$ to produce &#xA;$\hat{C}(x)$?  Well, adding and subtracting&#xA;the quantity $C_{n-m} +C_{n-m+1}x + \cdots &#xA; + C_{n-1}x^{m-1}$ to $x^mC(x)$, we can write&#xA;\begin{align}&#xA;x^mC(x) &amp;amp;= &#xA;\left(C_{n-m} + C_{n-m+1}x +&#xA;\cdots + C_{n-2}x^{m-2} + C_{n-1}x^{m-1}\right)(x^n-1)\\&#xA;&amp;amp; \qquad + C_0x^m + C_1x^{m+1} + \cdots + C_{n-m-1}x^{n-1}\\&#xA;&amp;amp; \qquad\qquad + C_{n-m} + C_{n-m+1}x^{1} +&#xA;\cdots + C_{n-2}x^{m-2} + C_{n-1}x^{m-1}.&#xA;\end{align}&#xA;The terms on the second and third lines above are all of&#xA;degree smaller than $n$, and have all the coefficients in&#xA;their proper place. We conclude that&#xA;$$\hat{C}(x) = x^m C(x) \bmod (x^n-1).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, as you have noted, cyclic shifts are easy to do in&#xA;the &quot;time domain&quot; and much harder in the transform domain.&#xA;Think of it as payback for the fact that convolutions&#xA;are easy to do in the transform domain and harder in the&#xA;time domain.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="235" LastEditDate="2016-03-15T14:58:58.187" LastActivityDate="2016-03-15T14:58:58.187" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29448" PostTypeId="2" ParentId="29442" CreationDate="2016-03-15T06:32:32.917" Score="2" Body="&lt;p&gt;When $H(z)$ is rational, then the system is causal if and only if its ROC is the exterior of a circle outside the out-most pole, and the order of numerator is no greater than the order of the denominator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A causal LTI system with a rational transfer function $H(z)$ is stable if and only if all poles of $H(z)$ are inside the unit circle of the z-plane, i.e., the magnitudes of all poles are smaller than 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so you also need to find the R.O.C.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-15T06:32:32.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29450" PostTypeId="1" AcceptedAnswerId="29462" CreationDate="2016-03-15T08:23:15.813" Score="-1" ViewCount="250" Body="&lt;p&gt;I have a signal sampled at 100 sample per second. After low pass filtering of 200 order and some calculation such as zero crossing detection, I am getting around 1 second delayed signal. I want it in Realtime so that I have to predict signal 100 samples in future. I am using kalman filter to predict 2 samples ahead but I am confused wether I can use it or not to predict 100 samples in future. So that I can compensate delay introduced by low pass filter. What are the other methods available other than kalman filter.&lt;/p&gt;&#xA;" OwnerUserId="19428" LastActivityDate="2016-03-15T12:14:32.923" Title="100 samples ahead signal prediction" Tags="|kalman-filters|linear-prediction|" AnswerCount="1" CommentCount="4" ClosedDate="2016-03-15T13:03:35.850" ContentLicense="CC BY-SA 3.0" />
  <row Id="29455" PostTypeId="2" ParentId="29430" CreationDate="2016-03-15T09:31:33.997" Score="4" Body="&lt;p&gt;You might be surprised to hear that your code implements neither the conventional impulse invariance method (IIM) nor the corrected IIM. Instead it implements the &lt;a href=&quot;https://en.wikipedia.org/wiki/Matched_Z-transform_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;matched Z-transform&lt;/a&gt;, which maps the poles and zeros of the analog prototype according to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$z_k=e^{s_kT}\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$T=1/f_s$&lt;/span&gt; is the sampling interval.&lt;/p&gt;&#xA;&lt;p&gt;The two versions of the IIM can be derived as follows. If we take as an example the RIAA de-emphasis transfer function&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(s)=\frac{sT_2+1}{(sT_1+1)(sT_3+1)}\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$T_1=3.18\,\text{ms}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T_2=75\,\mu\text{s}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$T_3=318\,\mu\text{s}$&lt;/span&gt;, we first have to do a partial fraction expansion of &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; to get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(s)=\frac{A_1}{s-p_1}+\frac{A_2}{s-p_2}\tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$p_1=-1/T_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$p_2=-1/T_3$&lt;/span&gt;, and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A_1=\frac{1}{T_1}\frac{T_2-T_1}{T_3-T_1},\qquad A_2=\frac{1}{T_3}\frac{T_3-T_2}{T_3-T_1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With the constants used in &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt;, the transfer function of the transformed system can directly be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(z)=\frac{TA_1}{1-e^{p_1T}z^{-1}}+\frac{TA_2}{1-e^{p_2T}z^{-1}}\tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; it can be seen that the poles are the same as for the matched Z-transform, but the zeros are different. Note that for this example there is only one zero for the matched Z-transform as well as for the conventional IIM.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Impulse_invariance#Corrected_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;corrected IIM&lt;/a&gt; according to &lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S0165168400001134&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mecklenbräuker&lt;/a&gt; and &lt;a href=&quot;https://ieeexplore.ieee.org/document/870677&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jackson&lt;/a&gt; subtracts a constant term from the transfer function &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; of the conventional IIM:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(z)=\frac{TA_1}{1-e^{p_1T}z^{-1}}+\frac{TA_2}{1-e^{p_2T}z^{-1}}-\frac{T}{2}(A_1+A_2)\tag{5}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that this solution has one more zero than the other two methods. The poles of all three methods are identical.&lt;/p&gt;&#xA;&lt;p&gt;The figure below shows the approximation of the RIAA de-emphasis filter given by &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; according to the three aforementioned transformations (IIM in red, IIM corrected in green, matched Z in magenta). IIM performs worst, matched Z-transform and the corrected IIM are similar but their errors have different signs. This fact could be used to come up with a filter that combines the corrected IIM and the matched Z-transform. Since their poles are identical, we only need to combine their numerator coefficients. The result of the combined filter is shown in black. Its approximation error is less than 1 dB over the whole frequency range.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FiCiQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FiCiQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="26573" LastEditDate="2022-08-09T12:01:58.513" LastActivityDate="2022-08-09T12:01:58.513" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29456" PostTypeId="1" AcceptedAnswerId="29460" CreationDate="2016-03-15T09:46:55.543" Score="2" ViewCount="183" Body="&lt;p&gt;I followed the tutorial for generating the frequency spectrum of a signal &lt;a href=&quot;http://samcarcagno.altervista.org/blog/basic-sound-processing-python/?doing_wp_cron=1458030091.8829839229583740234375&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and for testing I generated a sine signal with the frequency of $440 \textrm{ Hz}$. That resulted in the time domain in the following picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kqQln.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kqQln.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when I convert it into the frequency domain, I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hbIeT.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hbIeT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question now is: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why is the background noise shaped like it is? &lt;/li&gt;&#xA;&lt;li&gt;I would have expected a more even noise, or rather a linear shaped noise. Where does this shape come from?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Edit concerning the technical data:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sample rate is $44100\,\textrm{Hz}$, which should be enough  &lt;/li&gt;&#xA;&lt;li&gt;FFT length is identical to the signal length, i.e. 1323000 points.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20054" LastEditorUserId="20054" LastEditDate="2016-03-15T12:32:29.667" LastActivityDate="2016-03-15T12:48:20.393" Title="$\mathrm{FFT}$ generates non-linear noise" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29460" PostTypeId="2" ParentId="29456" CreationDate="2016-03-15T11:54:18.753" Score="4" Body="&lt;p&gt;First of all, look at the power of what you call background noise:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's between -150 dB and -120 dB below your peak's power. Which means that the magnitude of these FFT points is somewhere in $[10^{-7.5};10^{-6}]$ of the main peak magnitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That screams &quot;numerical inaccuracy&quot; all over the place:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming your FFT was implemented using 32 bit IEEE754 floating point numbers, you'd have to realize that for each point of the FFT output, there's at least an FFT-length amount of additions taking place with a very finite numerical precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now your FFT has an enormous length; $1323000\approx 1.3\cdot 10^6$ additions bring the most stable algorithm to its knees. For a bit of details on error analysis on commonly used FFT algorithms, refer to [1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the DFT matrix to understand the concept of how these values come to be: For the frequency of your spectral peak, signal-period ($\frac{1}{f_\text{signal}}$) spaced samples are added up; since they always have the same value (definition of &quot;period&quot;), the result is large; for all the others, the should cancel each other out. For example, the bin at $2\cdot f_\text{signal}$ always adds up the same absolute value, but with alternating sign. For other bins, you just take values from the sine and add them up. What happens now is that due to limited floating point math, when you add up a large and a small number, and then subtract the large number again, you won't get the same small number you had – accuracy reduces with magnitude!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the FFT is an algorithm that is pretty resilient with respect to that (because it doesn't try to add up all FFT-length values at once), but there's only so much stability that an algorithm can achieve with a given machine $\epsilon$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I would have expected a more even noise, or rather a linear shaped noise. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why that? If anything, you're observing a process where the imperfections of the FFT are correlated with the input signal. Something like that won't have &quot;white&quot; PSD! Remember, the PSD of a process is the Fourier transform of its autocorrelation; in your case, it seems there's more autocorrelation at higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do your understanding a favor and add a bit of as-good-as-feasible white, gaussian noise to the input, maybe with a variance of $N=10^{-3}$ of the sine's amplitude, and do your mag squared FFT again. You'll see the noise floor where you expect it, and it will be flat, because the (dominant) source of noise is actually white, and not strongly correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, your $1.3\cdot10^6$ FFT really isn't all that helpful, unless you actually need a frequency resolution of $\frac{f_\text{sample}}{N}=\frac{4.41\cdot 10^4}{1.323\cdot10^6}=33\,\text{mHz}$ (which I dare to doubt). Try with shorter pieces of your signal!&lt;/p&gt;&#xA;&#xA;&lt;hr/&gt;&#xA;&#xA;&lt;p&gt;[1] Tasche, M., and H. Zeuner, &lt;em&gt;Roundoff error analysis for fast trigonometric transforms&lt;/em&gt;, in &lt;em&gt;Handbook of Analytic-Computational Methods&#xA;in Applied Mathematics&lt;/em&gt;, G. Anastassiou (ed.), Chapman &amp;amp; Hall/CRC, Boca Rota, 2000, 357–406.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-03-15T12:48:20.393" LastActivityDate="2016-03-15T12:48:20.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29462" PostTypeId="2" ParentId="29450" CreationDate="2016-03-15T12:14:11.563" Score="0" Body="&lt;p&gt;if you can determine the main sine frequencies that compose the lowpass signal throughput via fft or a filter bank, and their phase at the time of the signal (if last sample was rising or falling) you can predict as many samples ahead as their wavelength, for the bass component. as the signal rises and the prediction time is longer the prediction is worse obviously. So an FFT to see the frequencies of the bass components and an idea of their phase is ok to predict them roughly to the number of samples of their wavelength with certainty reducing over time. What is the overall context of the project?&lt;/p&gt;&#xA;" OwnerUserId="20058" LastEditorUserId="20058" LastEditDate="2016-03-15T12:14:32.923" LastActivityDate="2016-03-15T12:14:32.923" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29464" PostTypeId="1" CreationDate="2016-03-15T14:13:57.580" Score="2" ViewCount="972" Body="&lt;p&gt;I want to estimate depth from live video stream with two calibrated webcams in MATLAB but has no results. I have Webcam Support Package and Image Acquisition Toolbox but I don't know how to use live video stream via stereo calibrated webcams against recorded video file. In &lt;a href=&quot;http://www.mathworks.com/help/vision/examples/depth-estimation-from-stereo-video.html&quot; rel=&quot;nofollow&quot;&gt;this post&lt;/a&gt; depth is estimated with two recorded video files. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I estimate depth in live video stream?&lt;/p&gt;&#xA;" OwnerUserId="19462" LastEditorUserId="128" LastEditDate="2018-08-04T16:13:48.553" LastActivityDate="2018-08-04T16:13:48.553" Title="Real Time Depth Estimation in MATLAB" Tags="|image-processing|matlab|video-processing|matlab-cvst|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29465" PostTypeId="1" CreationDate="2016-03-15T14:52:34.767" Score="2" ViewCount="1964" Body="&lt;p&gt;Say we want to design an OFDM system and we have some parameters given to us, i.e. the coherence time $T_c$ and the max delay spread $T_m$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's clear to me why we need to ensure $T_s(N+N_{cp}) \ll T_c$ where $N_{cp}$ is the cyclic prefix in samples - we want the channel to stay coherent during the entire symbol. What is not clear is what happens to the constraint $T_s(N+N_{cp}) \gg T_m \Leftrightarrow B_N \ll B_c$. Apparently, in OFDM it suffices with $T_s N_{cp} \geq T_m$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It makes intuitive sense in a way, but I'm still not sure exactly how the coherence bandwidth interacts with the subchannel bandwidths. Why don't we need to ensure $B_N \ll B_c$?&lt;/p&gt;&#xA;" OwnerUserId="9140" LastActivityDate="2017-04-19T15:25:25.767" Title="Coherence bandwidth/delay spread in OFDM" Tags="|digital-communications|ofdm|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29466" PostTypeId="2" ParentId="29326" CreationDate="2016-03-15T15:13:28.913" Score="1" Body="&lt;p&gt;Yes it would make sense to analyse the sound of the vibrations without the gear interactions if you can, and then delete that sound profile from the overall sound using a noise remover that works with a sample of the noise only prior to the noise + recorded signal. You should say roughly what frequencies you expect from the gears based on the RPM and number of teeth, because it affects analysis methods. On this and many other programs there is &quot;noise reduction using noise sample profiling&quot; &lt;a href=&quot;http://wiki.audacityteam.org/wiki/Noise_Reduction&quot; rel=&quot;nofollow&quot;&gt;http://wiki.audacityteam.org/wiki/Noise_Reduction&lt;/a&gt; it is tremendously efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are no obvious correlations or patterns in the graph, it is true. Read about engine vibration analysis. I found a paper on engine sound graphs when i was researchign SPWVD, and indeed it is 100ds of times more precise than FFT and pseudo smoothed wigner ville distribution makes waterfall graphs which show the clearest patterns of sound that are physically measurable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To seriously analyse your vibrations, you should not use coarse FFT, instead use pseudo smoothed wigner ville distribution which is available as an addon. this program can do it too, see the graphs: &lt;a href=&quot;http://www.christoph-lauer.de/sonogram&quot; rel=&quot;nofollow&quot;&gt;http://www.christoph-lauer.de/sonogram&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12103" LastEditorUserId="12103" LastEditDate="2016-03-15T16:30:24.727" LastActivityDate="2016-03-15T16:30:24.727" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29467" PostTypeId="2" ParentId="29464" CreationDate="2016-03-15T15:22:00.307" Score="1" Body="&lt;p&gt;You would have to connect both cameras to your computer, and either create two &lt;code&gt;webcam&lt;/code&gt; objects or two &lt;code&gt;videoinput&lt;/code&gt; objects to read images from them.&lt;/p&gt;&#xA;" OwnerUserId="53" LastActivityDate="2016-03-15T15:22:00.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29469" PostTypeId="2" ParentId="29465" CreationDate="2016-03-15T17:10:14.240" Score="1" Body="&lt;p&gt;Well, the reason you do OFDM in the first place is that you can take a large piece of bandwidth, and instead of using it as a single channel that would be heavily frequency-selective, use it as a set of much narrower subchannels which can typically be considered to be represented by single tap channels. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, coherence bandwidth isn't directly bounded by the overall OFDM bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-03-15T17:10:14.240" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29470" PostTypeId="1" CreationDate="2016-03-15T17:22:35.310" Score="5" ViewCount="1527" Body="&lt;p&gt;The restricted isometry property (RIP) states that:&#xA;\begin{equation}&#xA;  (1-\delta_K)||x||_2^2 \le ||A x||_2^2 \le (1+\delta_K)||x||_2^2&#xA;\end{equation} &#xA;for any $K$-sparse vector $x$ of length $N$. The corresponding restricted isometry constant is $\delta_K$, $0 &amp;lt; \delta_K &amp;lt; 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to perform a numerical experiment based this expression to produce a RIP-compliant matrix $A$ (Matlab code is supplied below).&#xA;The matrix is constructed with Gaussian-distributed RV's (zero mean, variance $1/\sqrt{M}$). Having specified $N$ and $K$, the number of measurements $M$ is obtained with $M \geq K \log(N/K)$. This is a hit-or-miss procedure, I let the code run until the isometry constant falls between zero and one.&#xA;Is this the proper way to generate $A$? Am I missing anything? Further analysis on $A$ (eigenvalues, etc.) doesn't seem to behave properly...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [delta] = RIP_numerical(n,s)&#xA;&#xA;% delta: restricted isometry constant; n: # columns; s: sparsity&#xA;&#xA;% choose m (# measurements/rows) based on measurement criterion&#xA;&#xA;m = ceil(s*log(n/s))&#xA;&#xA;flag = 0; incr = 0; % initialize computing parameters&#xA;&#xA;while flag ~= 1  % run until condition met&#xA;&#xA;    incr = incr + 1&#xA;    % generate random, m x n normalized matrix N(0,1/m)&#xA;    A = (1/sqrt(m))*randn(m,n);&#xA;    sumA = sum(A);&#xA;    for k = 1:n&#xA;        A(:,k) = A(:,k)/sum(A(:,k));&#xA;    end&#xA;&#xA;    % generate vector of length n, sparsity k&#xA;    x = zeros(n,1);&#xA;    list = randperm(n);&#xA;    for l = 1:s&#xA;        x(list(l))= randn;&#xA;    end&#xA;&#xA;    y = A*x;    % obtain measurements&#xA;&#xA;    norm_x = norm(x,2);  % l_2 norms&#xA;    norm_y = norm(y,2);&#xA;&#xA;    delta = 1-(norm_y^2/norm_x^2);  % look at lower bound&#xA;&#xA;    if (delta &amp;gt;0 &amp;amp; delta &amp;lt; 1) % condition met; save vars and kick out of routine.&#xA;        flag = 1&#xA;        save('RIP_config.mat', 'A','x','n','m','s');&#xA;    end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20065" LastEditorUserId="8202" LastEditDate="2016-03-15T17:51:48.133" LastActivityDate="2023-05-08T09:02:11.923" Title="Compressive sensing: numerical generation of RIP matrices" Tags="|compressive-sensing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29471" PostTypeId="2" ParentId="29424" CreationDate="2016-03-15T17:56:04.980" Score="0" Body="&lt;p&gt;&quot;Project the image onto the point cloud or mesh&quot;: this not a trivial step either, depending on your application requirements (e.g., do you need large contiguous textures?), the result quality you expect (e.g. image edge blending, relighting), and whether you want to perform some further 3D-related manipulation on the images (e.g 3D painting).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suggest to look for papers on projective texture mapping. Or, once you have the poses of all cameras, you could just import the data in a 3D editing application (Blender, Maya, 3DStudioMax, ...) and go from there. &lt;/p&gt;&#xA;" OwnerUserId="9110" LastActivityDate="2016-03-15T17:56:04.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29472" PostTypeId="2" ParentId="29442" CreationDate="2016-03-15T18:32:05.920" Score="2" Body="&lt;p&gt;for causal systems (which are the only ones i know that are physically realizable) which means the number of zeros may not exceed the number of poles, the system is stable if and only if all poles are inside of the unit circle.  that's the only criteria you need to worry about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there is a discrete-time counterpart to the Routh-Hurwitz criterion called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Jury_stability_criterion&quot; rel=&quot;nofollow&quot;&gt;Jury test&lt;/a&gt; that allows you to determine stability &lt;strong&gt;without&lt;/strong&gt; factoring the denominator of $H(z)$ into factors that identify the poles, but the basic criterion is the same.  whether you factor the denominator into factors with poles $(z-p_i)$ or use the Jury test, the salient test is &quot;are there any poles, $p_i$, such that $|p_i| \ge 1$?&quot;  if so, the system is not stable.  if &lt;strong&gt;all&lt;/strong&gt; poles satisfy $|p_i| &amp;lt; 1$, the system is stable (we must include any poles that are cancelled by zeros).&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-03-15T18:32:05.920" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29473" PostTypeId="2" ParentId="29415" CreationDate="2016-03-15T21:50:28.750" Score="0" Body="&lt;p&gt;When performing a tiny edit to the question, I looked at tags, and found that here, so far, only one tag contains &lt;code&gt;data&lt;/code&gt;: &lt;code&gt;data-request&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I consider the fields of signal processing, and image analysis, as quite composite. Almost everybody (my grand-mother as well) has some insight of what a chemist, a biologist is. In my time, explaining to my family what signal processing meant was a pain in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Application-specific_integrated_circuit&quot; rel=&quot;nofollow&quot;&gt;ASIC&lt;/a&gt;. I had to explain what a sensor was, and how a digital signal was  composed. Then, after losing patience, I'd say I deal with mp3 and photoshop. Everybody then understands, but my so-called science suddently vanishes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal processing, and image analysis, are composite. But not similar. They borrow from different other fields. In addition to the interest in low-level efficiency, I believe that a huge part of DSP is dedicated to more or less structured data, with the aim of extracting more or less &quot;constructed&quot; features. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Data_science&quot; rel=&quot;nofollow&quot;&gt;Data science&lt;/a&gt; is an other umbrella term that encompasses even more than the two latter.  From the &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_science&quot; rel=&quot;nofollow&quot;&gt;wiki page&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[It draws] from many fields within the broad areas of mathematics,&#xA;  statistics, information science, and computer science, including&#xA;  signal processing, probability models, machine learning, statistical&#xA;  learning, data mining, database, data engineering, pattern recognition&#xA;  and learning, visualization, predictive analytics, uncertainty&#xA;  modeling, data warehousing, data compression, computer programming,&#xA;  artificial intelligence, and high performance computing.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Because it is fashionable, because with the advent of social media, people now know that there are &lt;strong&gt;data&lt;/strong&gt;. And sounds, signals and images have becoming no more that &quot;some data&quot;. Almost everybody gets what a data is: bits, unstructured. Or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is funny: a lot asked me (in the past) to define a signal, no one ever asked me what a data is (while the question is more fundamental). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And everybody produces data, while few produced signals. The time was ripe. With the production of even more types of data, less structured, the features to be extracted became less and less &quot;contructed&quot;, less &quot;low-dimension&quot; and  hand-crafted, with interaction with machine learning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, some of the features used in deep learning are less fine-designed than the usual ones, and the huge human-created tagged data compensate for that.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-15T21:50:28.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29474" PostTypeId="1" CreationDate="2016-03-15T23:12:04.660" Score="-1" ViewCount="165" Body="&lt;p&gt;I am studying cyclic codes.  From what I understood of it, a cyclic code is a special kind of linear code with the property that any codeword cyclic shift is also a codeword.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, we start with number of message bits $k$ and number of code bits $n$ in a codeword and then try to build a cyclic code with these requirements.  I am thinking of writing a GF(2) cyclic code in the following way and want to know the problems with this approach:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take a codeword of size $n$ such that circular shifts of it (max possible $n-1$) gives $k$ linearly independent vectors.  I take all linear combinations and circular shifts of these linear combinations of these codewords and include them in code.  It has dimension $k$ and $n$ code bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any theorems about circular shifts of the linear combinations?  Since we have taken all the circular shifts of the original codeword, is it sufficient if we take all the linear combinations OR we should also specifically add the circular shifts of these linear combinations so as to NOT violate the cyclic property of a cyclic code?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="11256" LastEditDate="2016-03-16T01:11:28.277" LastActivityDate="2016-03-16T01:11:28.277" Title="How to write cyclic codes?" Tags="|digital-communications|channelcoding|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29475" PostTypeId="1" CreationDate="2016-03-15T23:40:16.183" Score="9" ViewCount="4189" Body="&lt;p&gt;Can you please explain: why is a specific type of noise called &quot;Gaussian noise&quot;? Why is it relevant to call it Gaussian? Please, explain in layman's terms.&lt;/p&gt;&#xA;" OwnerDisplayName="user18425" LastEditorUserId="11256" LastEditDate="2016-03-16T00:54:42.090" LastActivityDate="2016-03-16T08:59:34.587" Title="Why is Gaussian noise called so?" Tags="|noise|gaussian|statistics|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29476" PostTypeId="2" ParentId="29475" CreationDate="2016-03-16T00:53:38.230" Score="14" Body="&lt;p&gt;Noise is random, but like most random phenomena, it follows a certain pattern. Different patterns are given different names.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider rolling a die. This is clearly random. Roll the die 1000 times, keeping track of each result. Then, calculate the histogram of the result; you'll find that you got each of 1, 2, 3, 4, 5 and 6 approximately the same number of times. This pattern is called &quot;uniform&quot;, and throwing a die can be modeled by a &quot;uniform random variable&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same experiment can be repeated with thermal noise. Heat up a resistor, amplify the resulting voltage and measure its instantaneous power multiple times. Then calculate the histogram. This time, you won't find a uniform histogram; it will be shaped like a bell curve, with values near zero more common than values far away from zero. This kind of histogram is called Gaussian, after K. F. Gauss.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gaussian random phenomena are very common in nature. It turns out that whenever the random thing you observe is the aggregate of many, independent random events, the overall random variable is Gaussian (this is technically called the central limit theorem). In the case of thermal noise, you're measuring the aggregate effect of millions or billions of randomly oscillating electrons, excited by the heat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's an easier way to create Gaussian randomness at home (or simulated in a computer): take many dice, say 100, throw them all many times, and keep track of the total sum of each throw. If you find the histogram again, you'll see it follows a bell curve. The reason is intuitively easy to grasp: with 100 dice, you're very unlikely to get a total of 100 (all dice would have to land in 1), but it's very easy to get a number around 350, because many different combinations add up to such a number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize, there are many different kinds of noise that can affect a signal or an image, each with different statistical properties. Gaussian noise is a particularly important kind of noise because it is very prevalent. It is characterized by a histogram (more precisely, a probability density function) that follows the bell curve (or Gaussian function). As you study it more, you'll find that it also has several other important statistical properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/17990/why-gaussian-noise-is-usually-used&quot;&gt;why Gaussian noise is usually used?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/28861/whats-gaussian-noise-look-like&quot;&gt;what&amp;#39;s gaussian noise look like?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and many other related questions on this website.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="13320" LastEditDate="2016-03-16T08:56:07.953" LastActivityDate="2016-03-16T08:56:07.953" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29477" PostTypeId="2" ParentId="29474" CreationDate="2016-03-16T01:07:43.823" Score="0" Body="&lt;p&gt;A few comments:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It's not evident to me that your algorithm will produce $2^k$ codewords that are linear and cyclic. Have you tried it out?&lt;/li&gt;&#xA;&lt;li&gt;It's not evident how you're going to assign codewords to inputs. This may seem trivial for small codes but becomes harder and harder as the code grows.&lt;/li&gt;&#xA;&lt;li&gt;It's not evident how you're going to calculate the code's minimum distance. Again, this is easy to do by brute force for small codes, but impossible for large codes.&lt;/li&gt;&#xA;&lt;li&gt;And the most important question: how are you going to decode this code?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;See also related questions such as: &lt;a href=&quot;https://dsp.stackexchange.com/questions/25209/generate-minimum-distance-codes&quot;&gt;Generate Minimum distance codes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-03-16T01:07:43.823" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29478" PostTypeId="1" AcceptedAnswerId="29479" CreationDate="2016-03-16T02:26:24.690" Score="0" ViewCount="113" Body="&lt;p&gt;I'm trying to get a good understanding of causality and I can't wrap my head around the first definition of it, as noted in &lt;a href=&quot;https://en.wikipedia.org/wiki/Causal_system#Mathematical_definitions&quot; rel=&quot;nofollow&quot;&gt;this Wikipedia article&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Definition 1: A system mapping $x$ to $y$ is causal if and only if,&#xA;  for any pair of input signals $x_1(t)$ and $x_2(t)$ such that &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$x_{1}(t) = x_{2}(t), \quad \forall \ t \le t_{0},$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;the corresponding outputs satisfy&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$y_{1}(t) = y_{2}(t), \quad \forall \ t \le t_{0}.$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can anyone help explain this?&lt;/p&gt;&#xA;" OwnerUserId="20073" LastEditorUserId="1629" LastEditDate="2016-03-16T10:22:35.343" LastActivityDate="2016-03-16T20:49:58.603" Title="Why must outputs be the same for a pair of inputs for a causal system?" Tags="|continuous-signals|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29479" PostTypeId="2" ParentId="29478" CreationDate="2016-03-16T03:13:04.767" Score="0" Body="&lt;p&gt;So $x_1(t)$ and $x_2(t)$ are equal up to a certain time $t_0$, and diverge after that time. What this definition is saying is that, up to time $t_0$, the system will produce the exact same output, without regard for whether the input is actually $x_1(t)$ or $x_2(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the system is non-causal, then it may &quot;know&quot; whether the input is actually $x_1(t)$ or $x_2(t)$, because it can &quot;look ahead&quot; in time beyond $t_0$, and it could modify its output accordingly, even before $t_0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, consider a lightbulb connected to a battery and to a switch. The switch is initially on, and the lightbulb is also on. At time $t=0$, you decide whether you'll turn off the switch at time $t=60$ (one minute). The lightbulb, being causal, cannot know in advance what will happen, and will stay on at least up to $t=60$. A non-causal lightbulb will know in advance what will happen and may turn itself off at, say, $t=30&amp;lt;60$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this makes sense -- let me know if you need more clarification.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-03-16T03:13:04.767" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29480" PostTypeId="2" ParentId="29478" CreationDate="2016-03-16T05:57:02.177" Score="0" Body="&lt;p&gt;Causal System: cannot see into the future&#xA;i.e. output at time n depends only on inputs up to time n. Formal definition:&#xA;If $v(t) = x(t)$ for $t ≤ t_0$ then $H (v(t)) = H (x(t))% for t ≤ t0$. The following are equivalent:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;An LTI system is causal &lt;/li&gt;&#xA;&lt;li&gt;$h(t)$ is causal ⇔ $h(t) = 0$ for $t &amp;lt; 0 $&lt;/li&gt;&#xA;&lt;li&gt;$H(s)$ converges for $s = ∞$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any right-sided sequence can be made causal by adding a delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Examples here&lt;/strong&gt;: &lt;a href=&quot;http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/assignments/MITRES_6_007S11_hw05_sol.pdf&quot; rel=&quot;nofollow&quot;&gt;http://ocw.mit.edu/resources/res-6-007-signals-and-systems-spring-2011/assignments/MITRES_6_007S11_hw05_sol.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://home.npru.ac.th/sopapun/Solved_Problems.pdf&quot; rel=&quot;nofollow&quot;&gt;http://home.npru.ac.th/sopapun/Solved_Problems.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19904" LastEditorUserId="13309" LastEditDate="2016-03-16T20:49:58.603" LastActivityDate="2016-03-16T20:49:58.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29481" PostTypeId="2" ParentId="29393" CreationDate="2016-03-16T07:51:24.280" Score="1" Body="&lt;p&gt;&lt;strong&gt;Obtaining the system equations&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;https://en.wikipedia.org/wiki/Kirchhoff%27s_circuit_laws#Kirchhoff.27s_voltage_law_.28KVL.29&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kirchhoff's voltage law&lt;/a&gt;:&#xA;$$&#xA;\begin{align}&#xA;  V(t) &amp;amp;= V_{R_1}(t) + V_{R_2}(t) + V_{R_3}(t) + V_I(t) \tag{1}\\&#xA;  V_{R_1}(t) &amp;amp;= V_{C_1}(t) \tag{2} \\&#xA;  V_{R_2}(t) &amp;amp;= V_{C_2}(t) \tag{3}&#xA;\end{align}&#xA;$$&#xA;And similarly using &lt;a href=&quot;https://en.wikipedia.org/wiki/Kirchhoff%27s_circuit_laws#Kirchhoff.27s_current_law_.28KCL.29&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kirchhof's current law&lt;/a&gt;:&#xA;\begin{align}&#xA;  I_{R_3}(t) &amp;amp;= I_{R_1}(t) + I_{C_1}(t) \tag{4}\\&#xA;             &amp;amp;= I_{R_2}(t) + I_{C_2}(t) \tag{5}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now using the Voltage-Current relationships of the resistances and capacitors (assuming ideal components):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;  V_{R_1}(t) &amp;amp;= R_1 I_{R_1}(t) \tag{6}\\&#xA;  V_{R_2}(t) &amp;amp;= R_2 I_{R_2}(t) \tag{7}\\&#xA;  V_{R_3}(t) &amp;amp;= R_3 I_{R_3}(t) \tag{8}\\&#xA;  I_{C_1}(t) &amp;amp;= C_1 \frac{d\,V_{C_1}(t)}{dt} \tag{9}\\&#xA;  I_{C_2}(t) &amp;amp;= C_2 \frac{d\,V_{C_2}(t)}{dt} \tag{10}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on your comments, a current sink with a resistive internal resistance can be assumed. For analysis, it is common to replace such a load with its Norton equivalent circuit (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Norton%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Norton theorem&lt;/a&gt;) which consists of putting the internal resistance (say $R_4$) accross an ideal current sink $I(t)$.&#xA;\begin{align}&#xA;  V_I(t) &amp;amp;= R_4 I_{R_4}(t) \tag{11} \\&#xA;         &amp;amp;= R_4 (I_{R_3}(t) - I_I(t)) \tag{12}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Numerical solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To discretize the problem to discrete time step $t_n = n \Delta t = n/f_s$, we can make approximations for $(9)$ and $(10)$:&#xA;\begin{align*}&#xA;  I_{C_1}[n] &#xA;    &amp;amp;\approx C_1 \frac{V_{C_1}[n+1] - V_{C_1}[n]}{\Delta t} \\&#xA;    &amp;amp;\approx C_1 f_s \left(V_{R_1}[n+1] - V_{R_1}[n]\right) \\&#xA;  I_{C_2}[n] &amp;amp;\approx C_2 \frac{V_{C_2}[n+1] - V_{C_2}[n]}{\Delta t} \\&#xA;    &amp;amp;\approx C_1 f_s \left(V_{R_1}[n+1] - V_{R_1}[n]\right)&#xA;\end{align*}&#xA;This gives us the recurrence equations:&#xA;\begin{align*}&#xA;  V_{R_1}[n+1] &#xA;    &amp;amp;\approx V_{R_1}[n] + \frac{1}{C_1 f_s} I_{C_1}[n] \\&#xA;    &amp;amp;\approx V_{R_1}[n] + \frac{1}{C_1 f_s} \left(I_{R_3}[n] - I_{R_1}\right) \\&#xA;    &amp;amp;\approx V_{R_1}[n] + \frac{1}{C_1 f_s} \left(\frac{V_{R_3}[n]}{R_3} - \frac{V_{R_1}[n]}{R_1}\right) \\&#xA;  V_{R_2}[n+1] &#xA;    &amp;amp;\approx V_{R_2}[n] + \frac{1}{C_2 f_s} I_{C_2}[n] \\&#xA;    &amp;amp;\approx V_{R_1}[n] + \frac{1}{C_2 f_s} \left(I_{R_3}[n] - I_{R_2}\right) \\&#xA;    &amp;amp;\approx V_{R_1}[n] + \frac{1}{C_2 f_s} \left(\frac{V_{R_3}[n]}{R_3} - \frac{V_{R_2}[n]}{R_2}\right) &#xA;\end{align*}&#xA;And $V_{R_3}[n]$ begin obtained by substituting $(8)$ and $(12)$ into $(1)$:&#xA;\begin{align*}&#xA;  V_{R_3}[n] &#xA;    &amp;amp;= \frac{V[n] - V_{R_1}[n] - V_{R_2}[n] + R_4 I[n]}{1+R_4/R_3}&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can readily be implemented in python (with $V(t)$ and $I_I(t)$ being constant for illustration, but the extension to arbitrary function is trivial) with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# numerical solution&#xA;T    = 1.0/fs&#xA;Tmax = 20&#xA;t = np.arange(0,Tmax,T)&#xA;&#xA;vr3 = np.zeros(len(t))&#xA;vr1 = 0&#xA;vr2 = 0&#xA;for i in np.arange(len(t)-1):&#xA;    vr3[i] = (V-vr1-vr2+R4*I)/(1+R4/R3)&#xA;    i3  = vr3[i]/R3&#xA;    ic1 = i3 - vr1/R1&#xA;    ic2 = i3 - vr2/R2&#xA;    vr1 = vr1 + ic1/(C1*fs)&#xA;    vr2 = vr2 + ic2/(C2*fs)&#xA;vr3[-1] = (V-vr1-vr2+R4*I)/(1+R4/R3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Steady-state solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a validation of the above numerical solution, we can check whether it converges to a steady state which can be computed analytically fairly easily (assuming a steady state can be reached, which typically requires $V(t)$ and $I_I(t)$ to be near constant). To do this we note that in the steady state derivative terms go to zero. As a result, $I_{C_1}(t) = I_{C_2}(t) = 0$ and consequently, $I_{R_1}(t)=I_{R_2}(t)=I_{R_3}(t)$. Thus $(1)$ can be written as:&#xA;\begin{align*}&#xA;  V(t) &amp;amp;= R_1 I_{R_1}(t) + R_2 I_{R_1}(t) + R_3 I_{R_1}(t) + R_4\left(I_{R_1}(t) - I_I(t)\right) \\&#xA;     &amp;amp;= \left(R_1+R_2+R_3+R_4\right) I_{R_1}(t) - R_4 I_I(t)&#xA;\end{align*}&#xA;From which we can solve for $V_{R_3}(t)$:&#xA;\begin{align*}&#xA;  V_{R_3}(t) &amp;amp;= \frac{R_3}{R_1+R_2+R_3+R_4} \left(V(t) + R_4 I_I(t)\right)&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For illustration, the graph below shows an example for the following parameters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# parameters&#xA;R1 = 2200.0&#xA;C1 = 0.001&#xA;R2 = 1000.0&#xA;C2 = 0.0047&#xA;R3 = 5600.0&#xA;R4 = 100000.0&#xA;V  = 5&#xA;I  = 1e-5&#xA;fs = 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E57kP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E57kP.png&quot; alt=&quot;Example solution with above paramters&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final note, for voltage source $V(t)$ and current sink $I_I(t)$ which are constant or are from a set of fairly simple functions, the solution could also be obtained analytically with the use of &lt;a href=&quot;https://en.wikipedia.org/wiki/Laplace_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Laplace transforms&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8952" LastActivityDate="2016-03-16T07:51:24.280" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29482" PostTypeId="2" ParentId="29475" CreationDate="2016-03-16T08:20:33.803" Score="3" Body="&lt;p&gt;It is named after extremely influential and famous german-speaking mathematician &lt;a href=&quot;https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss&quot; rel=&quot;nofollow&quot;&gt;Carl Friedrich Gauss&lt;/a&gt; who lived during the 18th and 19th centuries and influenced among other things early statistics in which the Gaussian distribution (normal distribution) is related to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Central_limit_theorem&quot; rel=&quot;nofollow&quot;&gt;central limit theorem&lt;/a&gt;, a sum or mean value of enough of equidistributed random numbers will be (close to) gaussian if the underlying distribution is &lt;strong&gt;nice enough&lt;/strong&gt; (in practice it needs to be rather nasty behaving distribution for it not to be true). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In pronouncing Gauss, if you start out with a g the rest keeps going like a mouse, but in the english speaking world usually the &quot;ou&quot; in mouse turns into an &quot;o&quot; in german &quot;hallo&quot;.&lt;/p&gt;&#xA;" OwnerUserId="18051" LastEditorUserId="18051" LastEditDate="2016-03-16T08:59:34.587" LastActivityDate="2016-03-16T08:59:34.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29484" PostTypeId="2" ParentId="29470" CreationDate="2016-03-16T08:40:40.713" Score="3" Body="&lt;p&gt;Unfortunately, you cannot test for RIP this way. You calculate &lt;code&gt;delta&lt;/code&gt; for one random &lt;code&gt;s&lt;/code&gt;-sparse vector. The RIP condition must hold for all possible such vectors. In principle you can calculate it via the singular value decomposition, but you will have to do so for all possible sub-matrices of $A$ with $K$ or fewer columns from the original $A$. Evidently, this quickly becomes an insanely large and computationally intractable number of combinations for all but the very smallest (and practically irrelevant) matrices. Testing the RIP of a particular matrix $A$ is hopeless (I have tried - just to get a feel of what it would take).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in a measure you can realistically calculate, have a look at the coherence of $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my opinion, the RIP is not that useful a measure in practice. For example, have a look at &lt;a href=&quot;https://people.maths.ox.ac.uk/tanner/papers/DoTa_PUT.pdf&quot; rel=&quot;nofollow&quot;&gt;Donoho &amp;amp; Tanner, &lt;em&gt;Precise Undersampling Theorems&lt;/em&gt;&lt;/a&gt;. Figure 6a illustrates the so-called phase transition performance implied by the RIP compared to the one they derive in said paper. The polytope-based phase transition derived in the paper far more accurately reflects the practical performance you are going to experience with compressed sensing reconstruction.&lt;/p&gt;&#xA;" OwnerUserId="1464" LastEditorUserId="1464" LastEditDate="2016-04-17T05:46:06.260" LastActivityDate="2016-04-17T05:46:06.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29485" PostTypeId="2" ParentId="29415" CreationDate="2016-03-16T08:56:34.627" Score="2" Body="&lt;p&gt;The purpose of both DSP and machine learning is to transform the input signal / data set into more meaningful information. This could be,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;removal of noise from an audio recording&lt;/li&gt;&#xA;&lt;li&gt;location of faces in an image&lt;/li&gt;&#xA;&lt;li&gt;classification of objects in an image&lt;/li&gt;&#xA;&lt;li&gt;etc&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The main difference as I see it, is that in DSP the transform is designed by the engineer. The engineer will choose a set of signal processing operations that give the desired output. That choice is guided by experience and validated from the results of experiments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In machine learning the transform is learnt. Typically, this requires a set of training signals with known outputs, over which the system will optimise its transform. The engineer still has to choose a machine learning architecture that can replicate the transform that is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often the two will be combined. And DSP is kind of machine learning anyway - the machine learning bit is done by the human and the test set is the sum of their existence.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-03-16T08:56:34.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29486" PostTypeId="2" ParentId="28548" CreationDate="2016-03-16T09:50:21.223" Score="7" Body="&lt;p&gt;Regarding advantages - there is only one I can think of... The soft knee makes the compressor less noticeable. It sounds more natural, especially when you are dealing with higher compression ratios (like 4:1, etc.).&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, if you want to participate in the &amp;quot;Loudness War&amp;quot;, then you should rather use hard knee, as it allows you to squeeze out even more loudness.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Regarding implementation. Assuming the:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; - threshold&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; - soft knee width (soft knee extends from &lt;span class=&quot;math-container&quot;&gt;$T-\frac{W}{2}$&lt;/span&gt; up to &lt;span class=&quot;math-container&quot;&gt;$T+\frac{W}{2}$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; - compression ratio&lt;/p&gt;&#xA;&lt;p&gt;The soft knee compressor is governed by the equation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;y_G = \begin{cases}&#xA;x_G &amp;amp; x_G-T&amp;lt;\frac{-W}{2} \\&#xA;x_G+\frac{\left(\frac{1}{R}-1\right)\left( x_G - T+ \frac{W}{2}\right)^2}{2W} &amp;amp; |x_G-T| \le \frac{W}{2} \\&#xA;T+\frac{x_G-T}{R} &amp;amp; x_G - T &amp;gt; \frac{W}{2}&#xA;\end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is how the compression curve will look like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YXDfg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YXDfg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to achieve the hard knee, then just drop the middle equation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;y_G = \begin{cases}&#xA;x_G &amp;amp; x_G &amp;lt; T \\&#xA;T+\frac{x_G-T}{R} &amp;amp; x_G &amp;gt; T&#xA;\end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Obviously then you will get the following compression characteristic:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xf1l6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xf1l6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Whenever you have to do something about Dynamic Range Compression, I suggest you to take a look at the article below. Those guys did a great job of putting together all the info. Nonetheless I highly recommend reading the articles in references.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.eecs.qmul.ac.uk/%7Ejosh/documents/2012/GiannoulisMassbergReiss-dynamicrangecompression-JAES2012.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Giannoulis D. et al. - &lt;strong&gt;Digital Dynamic Range Compressor Design - A&#xA;Tutorial and&#xA;Analysis&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="7092" LastEditDate="2023-05-04T14:40:25.180" LastActivityDate="2023-05-04T14:40:25.180" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="29490" PostTypeId="1" AcceptedAnswerId="29497" CreationDate="2016-03-16T13:32:38.447" Score="4" ViewCount="3195" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Defined as:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\hat{f}(x,y)=\frac{1}{mn}\sum_{(s,t)\in S_{xy}}g(s,t) $$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As far as I understand:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$g(x, y)$ is the original image&lt;/li&gt;&#xA;&lt;li&gt;$g(s, t)$ is a sub-image of $g(x, y)$ with a dimension of &lt;code&gt;m&lt;/code&gt;x&lt;code&gt;n&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;$\hat f(x, y)$ is the filtered image&lt;/li&gt;&#xA;&lt;li&gt;Sub-images are summed up and then multiplied by ${ \frac {1}{mn}}$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Am I correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes, then, I have several questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is $g(s,t)$ a pixel in the neighborhood? What does it mean by that?&lt;/li&gt;&#xA;&lt;li&gt;What is $S_{xy}$ ?&lt;/li&gt;&#xA;&lt;li&gt;What are the meanings of $s$ and $t$?&lt;/li&gt;&#xA;&lt;li&gt;What is the meaning of $(s,t) \in S_{xy}$?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="user18425" LastEditorUserId="11256" LastEditDate="2016-03-16T15:22:43.470" LastActivityDate="2016-03-17T06:05:25.750" Title="What is an arithmetic mean filter?" Tags="|image-processing|filters|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29491" PostTypeId="2" ParentId="29490" CreationDate="2016-03-16T17:52:39.467" Score="2" Body="&lt;p&gt;I guess from pure logic, filter naming and its definition claimed to be average that &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Is $g(s,t)$ a pixel in the neighborhood? What does it mean by that?&lt;/strong&gt; I do not know what is a pixel neighbourhood but it is just a value, the height you have in the point $(s,t)$. $g(s,t)$ is an invocation of a function that will give you a value (numeric one, I guess, to be summable).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What is $S_{xy}$ ?&lt;/strong&gt; I guess it is what called &lt;a href=&quot;https://en.wikipedia.org/wiki/Support_(mathematics)&quot; rel=&quot;nofollow&quot;&gt;support&lt;/a&gt;. It is the place where your function is defined or non-zero because it makes no sense to sum up the infinite number of places where height is zero because it adds up noting to your sum but just makes your average 0 if you divide by infinity. In simplest case, you have one-dimensional array and one-dimensional support. In the case of average filter, it plays a role of &lt;a href=&quot;https://en.wikipedia.org/wiki/Moving_average&quot; rel=&quot;nofollow&quot;&gt;sliding window&lt;/a&gt;, supposedly. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What are the meanings of $s$ and $t$?&lt;/strong&gt; These are just &lt;a href=&quot;https://en.wikipedia.org/wiki/Loop_counter#Example&quot; rel=&quot;nofollow&quot;&gt;loop variables&lt;/a&gt;. You iterate over the space and the point in that space is controlled by s and t. In the case of one-dimensional array, support will have only one index variable. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What is the meaning of $(s,t) \in S_{xy}$?&lt;/strong&gt; It means that if your array is &lt;code&gt;int[10]&lt;/code&gt;, it is defined on the range 0..9 and you cannot index (variable) to transcend this range. Your function will $g(s,t)$ fail or you will sum a wrong number of samples because I expect that &lt;code&gt;sxt&lt;/code&gt; spans a rectangular area of size &lt;code&gt;MxN&lt;/code&gt; and adding points outside this range to your sum will invalidate your average.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19489" LastEditorUserId="17817" LastEditDate="2016-03-17T06:05:25.750" LastActivityDate="2016-03-17T06:05:25.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29492" PostTypeId="2" ParentId="29490" CreationDate="2016-03-16T17:54:40.960" Score="0" Body="&lt;p&gt;Yes, you are correct. By dividing the sum of pixels of the sub-image by 1/mn, you compute the average of the sub-image. Then it's an average filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it is in fact a convolution filter with a kernel having the same weight 1/mn.&lt;/p&gt;&#xA;" OwnerUserId="19791" LastActivityDate="2016-03-16T17:54:40.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29493" PostTypeId="1" AcceptedAnswerId="29504" CreationDate="2016-03-16T18:01:07.053" Score="1" ViewCount="13828" Body="&lt;p&gt;I am encoding my video using JM reference software. The encoded file is divided into RTP packets. I can set a RTP packet size in bytes using configuration file. But i am unable to find what should be the RTP packet size for H.264 video used in video telephony? I know RTP packet size is variable but there should be some limit.&#xA;Any help would be highly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="18454" LastActivityDate="2016-03-17T06:30:26.593" Title="What is Typical RTP Packet size for H.264 video transmission" Tags="|real-time|bandwidth|video|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29494" PostTypeId="1" AcceptedAnswerId="29978" CreationDate="2016-03-16T18:22:48.127" Score="-1" ViewCount="156" Body="&lt;p&gt;I have a 4-channel image (.png, .tif) like this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1nJ0j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1nJ0j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using OpenCV, and I would like to add padding of type &lt;code&gt;BORDER_REFLECT&lt;/code&gt; around the flower. &lt;code&gt;copyMakeBorder&lt;/code&gt; is not useful, since it adds padding to the edges of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can add certain padding if I split the image in bgr + alpha and apply &lt;code&gt;dilate&lt;/code&gt; with &lt;code&gt;BORDER_REFLECT&lt;/code&gt; option on the bgr image, but that solution spoils all the pixels of the flower.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to perform a selective &lt;code&gt;BORDER_REFLECT&lt;/code&gt; padding addition on a ROI defined by a binary mask?&lt;/p&gt;&#xA;" OwnerUserId="19397" LastEditorUserId="19397" LastEditDate="2016-04-06T09:32:53.213" LastActivityDate="2016-05-12T07:11:15.510" Title="Add padding to object in 4-channel image" Tags="|image-processing|opencv|image-segmentation|c++|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29497" PostTypeId="2" ParentId="29490" CreationDate="2016-03-16T20:25:13.077" Score="4" Body="&lt;p&gt;In one picture: here, the mask is of size $m=3\times n=5$, filled with value $\frac{1}{3\times 5}$, the light gray shadow on the input image defines the neighborhood of the dark gray pixel: a set of pixels (all your $g(s,t)$) close to the center one (it moves with the pixel). Let us suppose the dark gray pixel has coordinates $x=5$ and $y=6$. The shadow defines $S_{5,6}$ having $s\in[5-(m-1),\dots,5+(m-1)]$ and $t\in[6-(n-1),\dots,6+(n-1)]$. $(s,t)\in S_{5,6} $ means for instance that the light gray pixel on the bottom left of the dark gray one, with coordinates $(6,5)$ belongs to the shadow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4TGrs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4TGrs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-16T20:25:13.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29498" PostTypeId="1" CreationDate="2016-03-16T21:24:15.327" Score="3" ViewCount="139" Body="&lt;p&gt;I am new in compressive sensing and I would like to know if there already exists a deterministic or probabilistic approach to estimate the locations of the $k$ non-zero entries in the $k$-sparse vectore $x$.&lt;/p&gt;&#xA;" OwnerUserId="4224" LastEditorUserId="128" LastEditDate="2019-06-03T03:59:24.970" LastActivityDate="2019-06-03T03:59:24.970" Title="Compressive Sensing - Location of Non Zero Elements" Tags="|compressive-sensing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29500" PostTypeId="2" ParentId="29156" CreationDate="2016-03-16T23:10:59.533" Score="0" Body="&lt;p&gt;Issue has been already reported and solved here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://answers.opencv.org/question/89028/blending-artifacts-in-opencv-image-stitching/&quot; rel=&quot;nofollow&quot;&gt;http://answers.opencv.org/question/89028/blending-artifacts-in-opencv-image-stitching/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19397" LastActivityDate="2016-03-16T23:10:59.533" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29501" PostTypeId="2" ParentId="29423" CreationDate="2016-03-16T23:17:11.103" Score="3" Body="&lt;h2&gt;Geometric Transformation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Supose that $f$ is an image, defined over $(w,z)$ coordinate system, undergoes geometric distortion to produce an image $g$, defined over $(x,y)$ coordinate system. To perform this operation is used this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(x,y) = T\{(w,z)\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, one of most commmonly used forms of spatial transformation is the &lt;em&gt;affine transform&lt;/em&gt; (Wolberg [1990]). It can be written in the matrix form as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ [x \ y \ 1] = [w \  z \ 1] \ \mathbf{T} = [w \  z \ 1] &#xA;\left[ { \begin{array}{ccc}&#xA;         t_{11} &amp;amp; t_{12} &amp;amp; 0 \\ &#xA;         t_{21} &amp;amp; t_{22} &amp;amp; 0 \\ &#xA;         t_{31} &amp;amp; t_{32} &amp;amp; 1 \\ &#xA;        \end{array}} \right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This transformation can scale, rotate, translate or shear a set of points, depending on the values choosen for the elements of $\mathbf{T}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Your case: Perspective Transformation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For perspective transformation, you need a 3x3 transformation matrix. Straight lines will remain straight even after the transformation. To find this transformation matrix, you need 4 points on the input image and corresponding points on the output image. Among these 4 points, 3 of them should not be collinear.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Implementations&lt;/h2&gt;&#xA;&#xA;&lt;h3&gt;Python&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;OpenCV&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;OpenCV has a lot of methods to perform image warping and geometric transformation an you can get the examples in the &lt;a href=&quot;http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_geometric_transformations/py_geometric_transformations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; page&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;scikit-image&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;scikit-image also have many examples in the &lt;a href=&quot;http://scikit-image.org/docs/dev/auto_examples/applications/plot_geometric.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documation&lt;/a&gt; page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For python just choose the module more comfortable to you or use both.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;MATLAB ® Image Processing Toolbox&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As the others examples the Math Work's software have a lot of functions to perform geometric transformation. Beware that is an commercial software and it not have a strong programming language if you want make a little software.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;References&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Wolberg [1990]&lt;/strong&gt; &lt;em&gt;G. Wolberg. Digital Image Warping . IEEE Computer Society Press, 1990.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Gonzalez [1987]&lt;/strong&gt; &lt;em&gt;Gonzalez, R.C., P. Wintz, 1987. Digital Image Processing. 2nd Ed., Addison-Wesley, Reading:MA.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Futher Reading&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://www.cs.utexas.edu/~fussell/courses/cs384g/lectures/lecture07-Affine.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; is a good introduction to this process &lt;/p&gt;&#xA;" OwnerUserId="17817" LastEditorUserId="17817" LastEditDate="2017-10-11T20:24:23.097" LastActivityDate="2017-10-11T20:24:23.097" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29502" PostTypeId="1" AcceptedAnswerId="29506" CreationDate="2016-03-17T03:28:26.503" Score="0" ViewCount="831" Body="&lt;p&gt;I don't know where to start from, I'm not familiar with math.&#xA;I'm trying to understand this question &quot;how to identify impulse response of a system?&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see as below figure, as I know, the input delta function and output is $h[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uGBcE.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uGBcE.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, if I put impulse (function) signal in to above system, then I can get the impulse response. Then I think the output $h[n]$ and impulse response are the same, doesn't it?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Question 1: What is the meaning of &quot;how to identify impulse response of a system&quot;? Is this asking about convolution or auocorrelation? I can't understand what it does  mean.&lt;/li&gt;&#xA;&lt;li&gt;Question 2: I want to know how to identify impulse response of a system?&lt;/li&gt;&#xA;&lt;li&gt;Question 3: Why do we get the output of $y[n]$ when if we know that input $x[n]$, impulse response $h[n]$. I mean the output $y[n]$ is the same $h[n]$ isn't it? I'm very confused.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you have any hint, please let me know. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a question in my case as below,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1.2.8 Consider a discrete-time LTI system described by the rule $$y(n)=x(n-5)+\frac 12 x(n-7).$$  What is the impulse response $h(n)$&#xA;  of the system ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How to identify $h[n]$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the answer : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h[5]$ = 1+ 0 = 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$h[7]$ = 0 + 1/2 = 1/2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;. . .&lt;/p&gt;&#xA;" OwnerUserId="20088" LastEditorUserId="20088" LastEditDate="2016-03-17T13:44:40.753" LastActivityDate="2016-03-18T01:12:15.857" Title="What does &quot;how to identify impulse response of a system?&quot; mean?" Tags="|linear-systems|impulse-response|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29503" PostTypeId="2" ParentId="29502" CreationDate="2016-03-17T03:39:39.503" Score="0" Body="&lt;p&gt;The operation of linear time invariant system on a signal $f[n]$ can be described as a convolution, e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(f \ast h)[n] = g[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $g[n]$ is the output and $h[n]$ is convolution filter representing the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is called the impulse response because if you feed in the impulse signal you get the convolution filter as the output, e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(\delta \ast h)[n] = h[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So once you know the impulse response, you can calculate the response to any signal using the first equation.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="13309" LastEditDate="2016-03-18T01:10:41.850" LastActivityDate="2016-03-18T01:10:41.850" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29504" PostTypeId="2" ParentId="29493" CreationDate="2016-03-17T06:30:26.593" Score="1" Body="&lt;p&gt;RTP Payload Format for H.264 Video&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   0                   1                   2                   3&#xA;   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1&#xA;  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&#xA;  |V=2|P|X|  CC   |M|     PT      |       sequence number         |&#xA;  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&#xA;  |                           timestamp                           |&#xA;  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&#xA;  |           synchronization source (SSRC) identifier            |&#xA;  +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+&#xA;  |            contributing source (CSRC) identifiers             |&#xA;  |                             ....                              |&#xA;  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&#xA;&#xA;    RTP header according to RFC 3550&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The RTP header information to be set according to this RTP payload&#xA;   format is set as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Marker bit (M): 1 bit&#xA;      Set for the very last packet of the access unit indicated by the&#xA;      RTP timestamp, in line with the normal use of the M bit in video&#xA;      formats, to allow an efficient playout buffer handling.  For&#xA;      aggregation packets (STAP and MTAP), the marker bit in the RTP&#xA;      header MUST be set to the value that the marker bit of the last&#xA;      NAL unit of the aggregation packet would have been if it were&#xA;      transported in its own RTP packet.  Decoders MAY use this bit as&#xA;      an early indication of the last packet of an access unit, but MUST&#xA;      NOT rely on this property.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;     Note: Only one M bit is associated with an&#xA;     aggregation packet carrying multiple NAL units.  Thus, if a&#xA;     gateway has re-packetized an aggregation packet into several&#xA;     packets, it cannot reliably set the M bit of those packets.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Payload type (PT): 7 bits&#xA;      The assignment of an RTP payload type for this new packet format&#xA;      is outside the scope of this document and will not be specified&#xA;      here.  The assignment of a payload type has to be performed either&#xA;      through the profile used or in a dynamic way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sequence number (SN): 16 bits&#xA;      Set and used in accordance with RFC 3550.  For the single NALU and&#xA;      non-interleaved packetization mode, the sequence number is used to&#xA;      determine decoding order for the NALU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Timestamp: 32 bits&#xA;      The RTP timestamp is set to the sampling timestamp of the content.&#xA;      A 90 kHz clock rate MUST be used.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;H.264 also implements B-Frames. This type of frame fills in information between P-Frames. This means that the B-Frame will need to be held until the next P-frame arrives before the information can be used. B-Frames are not used in all modes of H.264. The encoder decides what type of frame is best suited. There are typically more P-frames than I-frames. Lab analysis has shown TelePresence I-frames to generally be 64K wide (50 packets @ 1316 bytes), while P- frames average 8K wide (9 packets at 900 bytes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-17T06:30:26.593" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29505" PostTypeId="1" AcceptedAnswerId="29518" CreationDate="2016-03-17T08:06:16.150" Score="0" ViewCount="135" Body="&lt;p&gt;Assumed I have a signal where different frequencies appear depending on the time position, i.e. a signal of $440\,\textrm{Hz}$ appears at $t=0$, a signal of $441\,\textrm{Hz}$ appears at $t=1$, a signal of $442\,\textrm{Hz}$ appears at $t=3$. Is it now possible to find out when the different signals appeared, and when they leave again, and relate that to the time position? The normal &lt;code&gt;fft&lt;/code&gt; in one dimension just tells me that there are different frequencies, but not which.&lt;br&gt;&#xA;My application is, that I have a sound file taken from an interferometer. The sound is generated by the interfering light beams. Different wavelengths generate different interference frequencies, but at different times. Thus I want to get the different frequencies in the resulting signal, and the time when they begin/end. The interference pattern generates a sine wave while interfering.&lt;/p&gt;&#xA;" OwnerUserId="20054" LastEditorUserId="20054" LastEditDate="2016-03-17T23:05:05.330" LastActivityDate="2016-03-17T23:05:05.330" Title="Get position of different frequencies in sound signal" Tags="|fft|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29506" PostTypeId="2" ParentId="29502" CreationDate="2016-03-17T08:22:01.707" Score="1" Body="&lt;p&gt;Given a system, one often wants to be able to predict the output $y$, given an input $x$. This amounts to identifying a mathematical relation between all inputs and outputs, optimaly as $y = S(x)$. This can be a difficult task in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the system is linear, and time-invariant (its properties do not change over time), then it is proven that it  suffices to know the system's response to a discrete unit pulse $\delta$, to be able to compute the output for any other input $x$, in the form of a convolution equation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So suppose that your system outputs $h[n]$ when you input $\delta[n]$, then for any $x[n]$, the output will be:&#xA;$$y[n] = \sum_k x[k]h[n-k]\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To identify the impulse response of the system, you ought to provide the numbers, or a generic formula, that give the value for each $h[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try some exercices in &lt;a href=&quot;http://eeweb.poly.edu/iselesni/EL6113/Signals_Exercises.pdf&quot; rel=&quot;nofollow&quot;&gt;Exercises in Signals, Systems, and Transforms&lt;/a&gt;, for  instance 1.2.4 and 1.2.7. You can also check the applet in the &lt;a href=&quot;http://pages.jh.edu/~signals/discreteconv2/&quot; rel=&quot;nofollow&quot;&gt;joy of convolution&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since, in practice, it is impossible to generate a discrete pulse, there are other practical identification techniques for real-life systems, using random sequences or sine waves. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="13309" LastEditDate="2016-03-18T01:12:15.857" LastActivityDate="2016-03-18T01:12:15.857" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="29509" PostTypeId="1" AcceptedAnswerId="29539" CreationDate="2016-03-17T13:39:09.943" Score="9" ViewCount="7753" Body="&lt;p&gt;This is a followup question to one I asked &lt;a href=&quot;https://stackoverflow.com/questions/36018875/extracting-phase-information-using-numpy-fft&quot;&gt;earlier&lt;/a&gt; based on the chat after the answer given by @hotpaw2, and cross-posted from stackoverflow since it was suggested it is more relevant to DSP. I have a signal which will be a single cosine wave, with a phase offset. My task is to extract (with very high accuracy required) the amplitude and phase of this single frequency component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On paper, the following relations hold assuming a properly normalized fourier transform $T$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T(\omega) = \mathcal{F}\left\{A \cos(\omega_0 t+ \phi) \right\} $$&#xA;$$A = 2|T(\omega_0)|= 2\sqrt{\mathrm{Re}(T(\omega_0))^2+\mathrm{Im}(T(\omega_0))^2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;\phi &amp;amp; =  \arg \left\{\mathrm{Re}(T(\omega_0)) + j \mathrm{Im}(T(\omega_0)) \right\} \\&#xA;&amp;amp; = \mathrm{atan2}\left( \mathrm{Im}(T(\omega_0)), \ \mathrm{Re}(T(\omega_0) \right) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unsurprisingly, there is a bit more to the DFT than simply taking the transform and picking off the relevent components. In particular, the discussion suggested to me that I was not entirely clear on what the phase offset is being measured with respect to, and that there are significant edge effects that can destroy the accuracy of the result if data is not properly windowed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been googling around but most of the discussion is fairly technical and light on example, so I was hoping that someone can shed some light on things. In particular, I came across one example suggesting that instead of doing a simple transform, I should be shifting it first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I put together this code to test some ideas:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab as pl&#xA;&#xA;def flattop(n):&#xA;    return [1.0 - 1.93*np.cos(2*np.pi*k/(float(n-1))) + 1.29*np.cos(4*np.pi*k/(float(n-1)))- 0.388*np.cos(6*np.pi*k/(float(n-1))) + 0.028*np.cos(8*np.pi*k/(float(n-1))) for k in range(int(n))]&#xA;&#xA;f = 30.0&#xA;w = 2.0*np.pi*f&#xA;phase = np.pi/7&#xA;num_t = 10*f&#xA;window = flattop(num_t)&#xA;&#xA;t, dt = np.linspace(0, 1, num_t, endpoint=False, retstep=True)&#xA;&#xA;signal = np.cos(w*t+phase)+np.random.normal(0,0.05,len(t))&#xA;&#xA;pl.plot(t,window*signal)&#xA;pl.show()&#xA;&#xA;amp = np.fft.rfft(window*signal)&#xA;freqs = np.fft.rfftfreq(t.shape[-1],dt)&#xA;&#xA;index = np.argmax(np.abs(amp))&#xA;print index&#xA;print(np.arctan2(amp.imag,amp.real))[index]&#xA;print (np.abs(amp))[index]*(2.0/len(t))&#xA;&#xA;pl.subplot(211)&#xA;pl.plot(freqs,np.abs(amp))&#xA;pl.subplot(212)&#xA;pl.plot(freqs,(np.arctan2(amp.imag,amp.real)))&#xA;pl.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Some observations: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use &lt;code&gt;num=10*f&lt;/code&gt;, I get perfect results for both phase and amplitude. However, if I use &lt;code&gt;num=10*f+1&lt;/code&gt;, the phase I get is completely wrong. I have tried using a window (in particular, a flat top window since it preserves amplitude) and I get the same thing: unless I control the number of samples to be an integer multiple (actually, 10.2, 10.4, 10.6, and 10.8*f also give good results for some reason) of the signal frequency, I get garbage back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was suggested that I could improve this by measuring the phase in the center of the window and that this could be achieved using fftshift. Googling around gave me a couple of examples which I have implemented in the code, but the results are the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: first set of questions: can someone explain the point of using fftshift, and what exactly it is doing to the data? Why does using an inverse shift, transforming, and then shifting then require a frequency component set which is only shifted once, with no inverse opration? Is this approach the correct one (ignoring for the moment the issue of a window). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also seems that using a window is required for finite time-domain signals, which I can understand. What's not clear to me is how to correct the amplitude and phase for the effect of the window in general. I have played with flat top windows to preserve the amplitude, and it seems to work, but I don't understand why the amplitude gain is not a function of frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second set of questions: if I window my data, presumably this will affect the amplitude and likely the phase(?) of the result. Is there an analytical way to correct for the amplitude change for a given window shape? I can find a few tables that list correction factors, but I haven't really seen a good explanation yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the linked question, it was stated that phase should be measured near the center of the hump of the window function. But because the window function is a time-domain function and I want the phase for a specific frequency, I don't quite understand what that means. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reality my sample signal will not be a generated perfect cosine wave and I won't have control over the number of samples, so I need to refine the method to give accurate information regardless of the exact number of samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: it appears that the first answer &lt;a href=&quot;https://dsp.stackexchange.com/questions/3301/is-there-an-algorithm-to-compute-the-phase-for-a-single-frequecy&quot;&gt;here&lt;/a&gt; might be a solution, but I still would like to understand the issues raised in the question in more depth if someone could provide insight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2: it seems that the problem is related to the fact that for accurate phase information we require that the frequency of interest be exactly centered in a DFT bin. How can that be ensured for an arbitrary number of samples? The question linked above provides a nice example that functions well for a single frequency, but there must be a general way to do this for more than one frequency. &lt;/p&gt;&#xA;" OwnerUserId="20090" LastEditorUserId="50076" LastEditDate="2023-07-22T21:46:00.107" LastActivityDate="2023-07-22T21:52:50.513" Title="Extract Sine Phase and Amplitude - accurate and robust method" Tags="|dft|phase|window-functions|amplitude|parameter-estimation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29510" PostTypeId="1" CreationDate="2016-03-17T14:11:05.183" Score="1" ViewCount="33" Body="&lt;p&gt;I am familiar with Kalman filtering given a linear (time-invariant) state space model. &#xA;However, the state space parametrization is not unique. Given a controllable and observable state space model (A,B,C,D), I can find multiple equivalent forms, e.g. controllable canonical form, observable canonical form, Jordan normal form, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a state space parametrization which is beneficial to transform the model to before running the Kalman filter, especially in terms of numerical stability. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there papers you could point to?&#xA;I am running a Kalman Filter on an 8th order SSM on a DSP and am running into numerical issues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="11714" LastActivityDate="2016-03-17T14:11:05.183" Title="Kalman Filtering and space parametrization" Tags="|kalman-filters|linear-systems|state-space|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29511" PostTypeId="2" ParentId="24417" CreationDate="2016-03-17T14:28:45.980" Score="1" Body="&lt;p&gt;The EM algorithm is used to solve iteratively a maximum likelihood (or MAP) estimation problem. &#xA;The unknown quantities you want to estimate could be e.g. the model parameters in a state space model, i.e. (A,B,C,D) or any subset of it. &#xA;Otherwise you could also estimate noise variances (e.g. state or measurement noise). &#xA;The EM is an iterative algorithm, in the expectation step you marginalize out the hidden variables, namely the states, via Kalman filtering (or smoothing) and then you maximize to update the values of the unknown parameters. &#xA;Then follows a new run of the Kalman filter, up until convergence.&lt;/p&gt;&#xA;" OwnerUserId="11714" LastActivityDate="2016-03-17T14:28:45.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29512" PostTypeId="2" ParentId="25154" CreationDate="2016-03-17T14:33:19.913" Score="1" Body="&lt;p&gt;The filtering distribution $p(x_k|y_1,...,y_k)$ is computed via the Kalman filter and given a linear-time invariant system is parametrized by the mean $E[x_k|y_1,...,y_k]$ and covariance matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When doing smoothing we want to compute $p(x_k|y_1,...,y_N)$ with $N \ge k$, in this case the mean we compute is $E[x_k|y_1,...,y_N]$.&lt;/p&gt;&#xA;" OwnerUserId="11714" LastEditorUserId="15892" LastEditDate="2016-03-17T15:09:18.127" LastActivityDate="2016-03-17T15:09:18.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29513" PostTypeId="1" AcceptedAnswerId="29523" CreationDate="2016-03-17T14:40:50.317" Score="0" ViewCount="1371" Body="&lt;p&gt;$$\hat f(x, y) = g(x, y)-\frac{\sigma_n^2}{\sigma_L^2}\left[g(x, y)-m_L\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the meanings of the following terms:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$m_L$&lt;/li&gt;&#xA;&lt;li&gt;${\sigma_\eta}^2$&lt;/li&gt;&#xA;&lt;li&gt;${\sigma_L}^2$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here we see that $m_L$ is subtracted from the Image and then the whole term is multiplied by $\frac{{\sigma_\eta}^2}{{\sigma_L}^2} $. Then, the whole term is again subtracted from $g(x,y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does that actually mean?&lt;/p&gt;&#xA;" OwnerDisplayName="user18425" LastEditorUserId="1629" LastEditDate="2016-03-17T14:59:01.877" LastActivityDate="2016-03-18T06:09:23.747" Title="What is an Adaptive Mean Filter?" Tags="|image-processing|filters|adaptive-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29515" PostTypeId="1" CreationDate="2016-03-17T15:40:38.337" Score="1" ViewCount="196" Body="&lt;p&gt;Hi I would like to find a line in a noisy image as showed bellow. I tried gabor filter and cany edge detection, but it didn't produce anything usefull. I am looking for lines of specific orientation and I don't want to segment them, just to find if the line exist in the picture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example pictures with lines&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/clcBd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/clcBd.png&quot; alt=&quot;Picture with line 1&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ptG3U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ptG3U.png&quot; alt=&quot;picture with line 2&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lYuU9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lYuU9.png&quot; alt=&quot;picture with line 3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example pictures without lines&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AUb7Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AUb7Z.png&quot; alt=&quot;no line 1&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pf4eb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pf4eb.png&quot; alt=&quot;no line 2&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Zc6cH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zc6cH.png&quot; alt=&quot;no line 3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18830" LastEditorUserId="18830" LastEditDate="2016-03-17T16:12:54.340" LastActivityDate="2016-05-16T19:27:31.710" Title="How to find a noisy line in a picture" Tags="|image-segmentation|edge-detection|object-recognition|template-matching|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29516" PostTypeId="2" ParentId="29505" CreationDate="2016-03-17T15:47:53.647" Score="2" Body="&lt;p&gt;I don't understand the interferometer setup but have a look at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eric Jacobsen &amp;amp; Richard Lyons. &lt;b&gt;DSP Tips &amp;amp; Tricks: &lt;a href=&quot;http://www.cmlab.csie.ntu.edu.tw/DSPCourse/reference/Sliding%20DFT.pdf&quot; rel=&quot;nofollow&quot;&gt;The Sliding DFT&lt;/a&gt;&lt;/b&gt;. &lt;i&gt;IEEE Signal Processing Magazine&lt;/i&gt;, March 2003, pp 74–80.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eric Jacobsen &amp;amp; Richard Lyons. &lt;b&gt;DSP Tips &amp;amp; Tricks: &lt;a href=&quot;http://www.cmlab.csie.ntu.edu.tw/DSPCourse/reference/Sliding%20DFT%20update.pdf&quot; rel=&quot;nofollow&quot;&gt;An Update to the Sliding DFT&lt;/a&gt;&lt;/b&gt;. &lt;i&gt;IEEE Signal Processing Magazine&lt;/i&gt;, January 2004, pp 110–111.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the sliding DFT (discrete Fourier transform) to calculate a windowed DFT starting at the time of each sample, not for all frequencies but for just the frequency you are interested about. See the subsections about &lt;a href=&quot;https://en.wikipedia.org/wiki/Window_function#Generalized_Hamming_windows&quot; rel=&quot;nofollow&quot;&gt;generalized cosine windows&lt;/a&gt; in Wikipedia for the kind of windows that work with sliding DFT. Perhaps you can then use the magnitude and phase information from sliding DFT for your task.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-03-17T16:35:52.197" LastActivityDate="2016-03-17T16:35:52.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29517" PostTypeId="2" ParentId="29515" CreationDate="2016-03-17T16:38:55.540" Score="1" Body="&lt;p&gt;What about an algorithm in image domain?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For every pixel, check into the direction you desire to know (up-down in your images above, I guess) if there is a pixel with &quot;the same&quot; value (i.e. a value inside an acceptance band, of course. Let's say +/- 10%) as the pixel under investigation. If so, go further into that direction. Count every pixel that you find. If the number of counts exceeds a certain threshold (i.e. 1/4 FOV or so in your case), then there is a line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would first try to use something simple like that instead of using more complicated algorithms that might be suitable for different kinds of images. Yours pretty much look like MRI phase images that can be nasty ;) )&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-17T16:38:55.540" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29518" PostTypeId="2" ParentId="29505" CreationDate="2016-03-17T17:05:21.180" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectrogram&lt;/a&gt; is a practical tool for this kind of application. It plots successively the FFT magnitudes calculated on a time-sliding window. You end up with the frequency content plot against time. Here is an example of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Chirp#Linear&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear chirp&lt;/a&gt; spectrogram (from mathworks) :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.mathworks.com/help/examples/signal/LinearChirpExample_01.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.mathworks.com/help/examples/signal/LinearChirpExample_01.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://fr.mathworks.com/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;corresponding matlab function&lt;/a&gt; carries the same name and is ready for use, you can specify the length of the sliding windows and how successive windows overlap.&lt;/p&gt;&#xA;" OwnerUserId="19532" LastActivityDate="2016-03-17T17:05:21.180" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29520" PostTypeId="1" AcceptedAnswerId="31534" CreationDate="2016-03-17T18:02:35.013" Score="0" ViewCount="384" Body="&lt;p&gt;I'm implementing the technique found in this paper: &lt;a href=&quot;http://front.sjtu.edu.cn/~jinyh/gradCourse/Paper/Wireless/SpotFi%20Decimeter%20Level%20Localization%20Using%20WiFi.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://front.sjtu.edu.cn/~jinyh/gradCourse/Paper/Wireless/SpotFi%20Decimeter%20Level%20Localization%20Using%20WiFi.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to perform localization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've implemented 95% of the technique, but this one short algorithm is giving me problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E0tIs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E0tIs.png&quot; alt=&quot;Algorithm pseudocode&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The explanation in pseudocode is very simple but the results I'm obtaining are wildly different than reported in the paper, and I don't think this is just a case of misreporting results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that to minimize the function in step 1, rho will always go to 0! Which is clearly not right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of this algorithm being applied in the paper is given here, with the first figure being the unwrapped phase prior to running Algorithm 1 and the second one being the resulting phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vL5j0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vL5j0.png&quot; alt=&quot;Algorithm 1 Output Example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can share my code so far for Algorithm 1 but I really think that I'm just missing something pretty essential in the description....&lt;/p&gt;&#xA;" OwnerUserId="17379" LastActivityDate="2016-06-15T01:57:24.940" Title="Help Understanding Time of Flight Phase Sanitization Algorithm" Tags="|signal-analysis|phase|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29521" PostTypeId="2" ParentId="29509" CreationDate="2016-03-17T20:39:38.353" Score="4" Body="&lt;p&gt;This is the problem we have in sinusoidal modeling. There are lots of issues, and your window function might be one of them. &lt;a href=&quot;https://www.researchgate.net/publication/3927319_Intraframe_time-scaling_of_nonstationary_sinusoids_within_the_phase_vocoder&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; by me is a little more general in that it not only are the amplitude and phase and frequency of each sinusoid derived, but also the sweep rate on frequency and the &quot;ramp rate&quot; of the amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nonetheless, if you're concerned about the sinusoid existing at a frequency that is in-between FFT bins, I would recommend using the Gaussian window and deriving the parameters of each sinusoid from the equations in the referenced paper.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="13475" LastEditDate="2016-12-23T16:43:27.277" LastActivityDate="2016-12-23T16:43:27.277" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29522" PostTypeId="1" AcceptedAnswerId="29524" CreationDate="2016-03-17T21:38:13.223" Score="2" ViewCount="3882" Body="&lt;p&gt;As far as I understand,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose, we have a 2D image of pixel resolution 200 x 300. That means, the image has 60000 pixels in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we would generate $n$ random values and add those values to $n$ number of random pixels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my question is, what would make those $n$ values to look like Gaussian Random Values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the logic that I should use?&lt;/p&gt;&#xA;" OwnerDisplayName="user18425" LastActivityDate="2016-03-18T08:14:04.077" Title="What does it mean by &quot;Adding Gaussian Noise to a 2D Image&quot;?" Tags="|image-processing|noise|gaussian|" AnswerCount="1" CommentCount="2" ClosedDate="2016-03-18T12:37:58.647" ContentLicense="CC BY-SA 3.0" />
  <row Id="29523" PostTypeId="2" ParentId="29513" CreationDate="2016-03-17T21:42:58.493" Score="1" Body="&lt;p&gt;A wild guess. $L$ denotes a region $R$ around pixel $g(x,y)$, potentially a symmetric one of size $(2L+1)\times (2L+1)$. $m_L$ and  $\sigma_L^2$ are the average and variance in $R$. And $\sigma_n^2$? Probably the estimated noise variance over the whole image, supposed stationary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a flat region with noise $\sigma_L^2 \sim \sigma_n^2$, the result could be close to the average. Around edges, one expect an higher response, so sharper. Potential problems arise when  $\sigma_L \ll \sigma_n $. Another interpretation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{f}(x,y)=(1-\frac{\sigma_n^2}{\sigma_L^2})g(x,y)+ \frac{\sigma_n^2}{\sigma_L^2}m_L(x,y)$$&#xA;is a sort of weighted mean (since weights sum to one) of the image and its smoothed version, whose dependency on $(x,y)$ is made more explicit.  &lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-03-18T06:09:23.747" LastActivityDate="2016-03-18T06:09:23.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29524" PostTypeId="2" ParentId="29522" CreationDate="2016-03-17T21:58:38.827" Score="2" Body="&lt;p&gt;You can find Gaussian noise generators in many image processing softwares.At each pixel, you add a realization from such random noise generators. You can look for more details at &lt;a href=&quot;http://dspguru.com/dsp/howtos/how-to-generate-white-gaussian-noise&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to Generate White Gaussian Noise&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On StackExchange, additional sources of information:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/17990/why-gaussian-noise-is-usually-used&quot;&gt;Why Gaussian noise is usually used?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/29475/why-is-gaussian-noise-called-so&quot;&gt;Why is Gaussian noise called so?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/28861/whats-gaussian-noise-look-like&quot;&gt;What's gaussian noise look like?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dsp.stackexchange.com/questions/26968/the-model-of-noise-in-image-denoising-problem&quot;&gt;The model of noise in Image denoising problem&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-03-18T08:14:04.077" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29525" PostTypeId="1" AcceptedAnswerId="29526" CreationDate="2016-03-17T21:59:21.627" Score="0" ViewCount="1753" Body="&lt;p&gt;Can someone explain to me what each element of the 1D FFT algorithm are (i.e. N,x,n,j,k) ? From here, &lt;a href=&quot;http://zone.ni.com/reference/en-XX/help/371361H-01/lvanls/fft/#details&quot; rel=&quot;nofollow&quot;&gt;http://zone.ni.com/reference/en-XX/help/371361H-01/lvanls/fft/#details&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Can't post pictures on stackoverflow just yet.... but its the 1D FFT description)&lt;/p&gt;&#xA;" OwnerUserId="20103" LastEditorUserId="15892" LastEditDate="2016-03-18T06:41:01.097" LastActivityDate="2020-01-04T03:07:07.673" Title="1D FFT algorithm elements explanation?" Tags="|fft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29526" PostTypeId="2" ParentId="29525" CreationDate="2016-03-17T23:08:12.333" Score="1" Body="&lt;p&gt;Consider a MATLAB/OCTAVE implementation of 1D-DFT/FFT sum:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X[k] = \sum_{n=0}^{N-1} {x[n]e^{-j \frac {2\pi}{N} k n} } $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$n=0,...,N-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k=0,...,N-1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those identifiers are used to denote the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;: is the FFT length as in &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-point FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;: is the discrete-time signal whose DFT &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; is to be computed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;: is the complex-valued DFT of the signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;: is the discrete-time index for the signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; in the range &lt;span class=&quot;math-container&quot;&gt;$n=0,...,N-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;: is the frequency sample index of &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;, in the range &lt;span class=&quot;math-container&quot;&gt;$k=0,...,N-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;: is the imaginary unit &lt;span class=&quot;math-container&quot;&gt;$\sqrt {-1}$&lt;/span&gt; in signal processing terminology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note if the signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;'s length is shorter than the FFT length, then zero padding is applied on &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; to make its length &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. Otherwise if it's longer than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, then the samples after &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; are ignored according to MATLAB/OCTAVE implementation. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2020-01-04T03:07:07.673" LastActivityDate="2020-01-04T03:07:07.673" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="29529" PostTypeId="1" CreationDate="2016-03-18T03:32:45.893" Score="2" ViewCount="1895" Body="&lt;p&gt;I have the following function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ g(t) = A\cdot \textrm{rect}\left(\frac{t}{T}\right)\cos\left(\frac{\pi  t}{T}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I find the energy spectral density function? I think? it is defined as : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \int\limits_{-\infty}^\infty \left|g(t)\right|^2\, dt $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After squaring it, I'm a bit lost since I do not know how to continue...&lt;/p&gt;&#xA;" OwnerUserId="20105" LastEditorUserId="13309" LastEditDate="2016-03-18T13:32:18.073" LastActivityDate="2016-03-21T19:08:42.520" Title="Calculating energy spectral density function of half-cosine function" Tags="|digital-communications|power-spectral-density|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29534" PostTypeId="2" ParentId="28534" CreationDate="2016-03-18T10:17:46.177" Score="1" Body="&lt;p&gt;It is possible to extract the transform coefficients without fully decoding the entire picture, but you would still have to find your way through the bit stream, parsing whatever is necessary in order to arrive at every transform unit, which might also not be present for every coding unit (if some macroblock matches exactly one in a reference picture then you don't need to encode any residual, for example).&#xA;How you would use only the transform information to do your computer vision tasks, I have no idea, but it is entirely possible to only extract the transform coefficients. What i suggest you do is grab whatever standard you want (H.264 or H.265 or some other) and go through all of the tables with the syntax elements, and the parsing process for arriving at the transform coefficients would be to ignore every fixed width syntax element not useful for decoding the transform (anything related to motion vectors or reference pictures) and parse whatever is necesary to obtain all the transform units in the coded picture. I don't know if there is any tool out there that does this, perhaps you can go into ffmpeg or one of the libraries like x264 or x265 and modify them to extract what you want. It is a difficult task, but definitely possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2016-03-18T10:17:46.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29535" PostTypeId="1" AcceptedAnswerId="29536" CreationDate="2016-03-18T10:21:24.183" Score="2" ViewCount="14346" Body="&lt;p&gt;I've been practicing problems relating to the dB conversion and came across this interesting example problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3d5Pt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3d5Pt.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above example Tx power is defined in Watts and the conversion from the Watts to dB is done. However, so far according to my understanding of the definition of dB, is defined in relative to receiver power too. But in the above example the calculation was done just by considering the Tx power. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can some one enlighten me? If I'm understanding it wrong or the example is wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="13557" LastActivityDate="2016-03-18T14:12:45.090" Title="Conversion of transmitter power from Watts into dB" Tags="|power-law|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29536" PostTypeId="2" ParentId="29535" CreationDate="2016-03-18T10:45:41.877" Score="2" Body="&lt;p&gt;Thanks to @MBaz who pointed out my mistake: dBm and dBW are unitless, but they relate to  a reference of 1 mwatt, and 1 Watt. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question has an error, as well as the answer. Watts does not convert to dB, it converts to dBW. (i) should be as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;find (i) the transmit power in dBm and dBW. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason behind that is that dB is a ratio, while dBm and dBW are ratios with a reference to 1 mWatt and 1 Watt, respectively, and you can use them to recover an absolute value of the power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the signal to noise ratio is a measure of how strong a signal is compared to the noise. In the linear scale it is written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{\text{Signal Power (in watts or miliwatts)}}{\text{Noise Power (in watts or miliwatts)}} = SNR (\text{unitless})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or in logarithmic domain: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\text{Signal Power (in dBW or dBm)}-\text{Noise Power (in dBW or dBm)} = SNR (\text{in dB})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the correct answer to (i) is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;TX power = $10\log(50)=17\text{ dBW}=17+30=47\text{ dBm}$&lt;/p&gt;&#xA;" OwnerUserId="20094" LastEditorUserId="20094" LastEditDate="2016-03-18T14:12:45.090" LastActivityDate="2016-03-18T14:12:45.090" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="29537" PostTypeId="1" CreationDate="2016-03-18T11:23:19.687" Score="1" ViewCount="59" Body="&lt;p&gt;Can channel capacity be explained in simple terms - without mutual information and such probabilistic concepts? In its most general form, what are all the parameters that it depends on?  What is its dependence on physical parameters such as the electrical parameters if we talk of information conveying through electrical signals?  Can we measure/calculate the channel capacity of any channel given its physical parameters?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2016-03-18T14:46:19.387" Title="Can channel capcity be explained in simple terms?" Tags="|information-theory|" AnswerCount="1" CommentCount="2" ClosedDate="2016-03-18T14:22:57.497" ContentLicense="CC BY-SA 3.0" />
  <row Id="29538" PostTypeId="2" ParentId="29529" CreationDate="2016-03-18T12:52:13.757" Score="2" Body="&lt;p&gt;For a &quot;deterministic finite energy&quot; continuous time signal $x\left(t\right)$, as you have exemplified, the energy density spectrum, or equivalently energy spectral density, which is a real nonnegative signal, meant to be used as a function showing the energy distribution of the signal with respect to the frequency is defined to be: $$S_x\left(\omega\right) = \left|X\left(j\omega\right)\right|^2 $$  where $X\left(j\omega\right)$ is the Continuous-Time Fourier Transform $\left(CTFT\right)$ of the signal $x\left(t\right)$ given as: $$X\left(j\omega\right) = \int_{-\infty}^{\infty}{x\left(t\right)e^{-j\omega t} dt}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now coming to the specific sample of your question, you should first find the CTFT $G\left(j\omega\right)$ of $g\left(t\right)$: That your signal is a multiplication of two other signals you should use a fundamental property of CTFT namely the ${multiplication}$ in time equals ${convolution}$ in frequency. Hence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x\left(t\right)y\left(t\right) \leftrightarrow \frac{1}{2\pi} X\left(j\omega\right) \star Y\left(j\omega\right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a table of FTs (or by carrying out the integral if you can) find that for &#xA;$x\left(t\right)= \textrm {rect} \left( \frac {t}{T} \right)$ which is defined from $t=-T/2$ to $t=T/2$, we have: $$X\left(j\omega\right) = \frac{2 \sin \left({\omega \frac{T}{2} }\right)} {\omega}$$ and for the $y\left(t\right) = \cos\left( \pi \frac {t}{T}\right)$ we have $$Y\left(j\omega\right) = \pi \delta \left(\omega - \frac {\pi}{T}\right) + \pi \delta \left(\omega + \frac{\pi}{T}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What remains now is to compute their convolution, which is easy considering the convolution with impulse given as:$X\left(j\omega\right) \star \delta\left(\omega - \omega_0\right) = X\left(j\left(\omega - \omega_0\right)\right) $ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence we get: $$G\left(j\omega\right) = \frac{1}{2\pi} X\left(j\omega\right) \star Y\left(j\omega\right)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;as $$\frac{\sin \left({\left(\omega- \frac {\pi}{T}\right) \frac{T}{2} }\right)} {\left(\omega- \frac {\pi}{T}\right)} + \frac{\sin \left({\left(\omega + \frac {\pi}{T}\right) \frac{T}{2} }\right)} {\left(\omega + \frac {\pi}{T}\right)}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, after simplyfying, becomes: &#xA;$$G\left(j\omega\right) =  \cos\left({\omega\frac{T}{2} }\right)  \left( \frac{-1} {\left(\omega- \frac {\pi}{T}\right)} + \frac{1} {\left(\omega + \frac {\pi}{T}\right)} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whose magnitude is $$\left|G\left(j\omega\right)\right| = \left|\cos\left(\omega \frac{T}{2}\right)\right| \cdot \left|\left( \frac{ \frac{-2\pi}{T}}{\omega^2 - \frac{\pi^2}{T^2}} \right)\right|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And from which we conclude for the Energy Spectrum Density to be:&#xA;$$S_x\left(\omega\right) = \left|G\left(j\omega\right)\right|^2 = A^2 \cos^2\left(\omega \frac{T}{2}\right)  \left( \frac{ \frac{2\pi}{T}}{\omega^2 - \frac{\pi^2}{T^2}} \right)^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I have added the last linear scaler A in $g\left(t\right)$.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-03-21T19:08:42.520" LastActivityDate="2016-03-21T19:08:42.520" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29539" PostTypeId="2" ParentId="29509" CreationDate="2016-03-18T12:58:50.690" Score="5" Body="&lt;p&gt;Regarding your Edit #2: It is not true that phase estimation requires that frequency be at a bin center.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if a frequency estimate requires interpolation between FFT result bins, so does any phase estimation at that frequency estimate.  Using a Sinc interpolation kernel on the complex FFT results, plus successive approximation for the magnitude peak, can also improve the phase estimation.  Symmetric zero-padding and using a much longer FFT is one way to do Sinc-kernel interpolation.  An fftshift will make sure the oddness/evenness ratio, thus the atan2(), remains close to the same after interpolation.  But note that this moves the phase reference to the middle of the time-domain window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Added Update:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you swap halves of a vector of input samples (same as an fftshift for even N) of a reasonably smooth waveform (say a sinusoid), then the smooth part of the waveform crosses from the end of the vector back around to the beginning of the vector, thus removing the discontinuity (of any non-exactly-integer-periodic-sinusoids) from near that wrap-around point.  As a result, any errors in estimating frequency between bins will not effect the odd/even ratio of the complex FFT result (e.g. adjacent bins will have nearly the same phase) allowing easier interpolation.  If the discontinuity is near the first and/or last element of the vector before the FFT, then the FFT phase result can flip back-and-forth between adjacent FFT result bins (for any non-exactly-integer-periodic-sinusoids, due to their discontinuity between the last and first element), making phase interpolation less intuitive (but still possible by post-un-flipping alternating FFT bin phase results).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase flips because the sign of the Sinc function flips between alternate Sinc lobes, and the rectangular window (inherent in any finite length DFT) on any between-DFT-bin sinusoid causes the transform to sample the lobes, not the zero-crossings, of this Sinc function.  However, an fftshift &quot;twists&quot; this Sinc function in complex space so that it always gets sampled with the same signedness (not alternating, or &quot;flipping&quot;).  (Exercise for the math student: show that a shift in time results in a twist in phase across the DFT result vector and that an fftshift results in a pi per lobe twist of a Sinc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, I usually post-unflip rather than pre-fftshift, as this produces identical phase results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fftshift moves the phase reference (the point in time at which the phase of a sinusoid is measured) from element[0] to element[N/2] of the original data vector.  You can move the phase angle back to any other point in time (such as to element[0] in time) by using the estimated frequency and the equation of how phase changes with time at that frequency.  But, of course, the accuracy of that moved phase estimate depends on the accuracy of the frequency estimate.  So I usually just design my experiments to need a phase measurement/estimate result in the middle of my data capture window, not at one end or the other.  &lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-12T16:03:42.533" LastActivityDate="2016-04-12T16:03:42.533" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29540" PostTypeId="2" ParentId="29537" CreationDate="2016-03-18T14:40:17.107" Score="2" Body="&lt;p&gt;There is a limit where simplifying a scientific concept starts becoming inaccurate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the capacity of a channel is a really simple idea that is completely illustrated by the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$C = B\log_2(1+\frac{S}{N})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation says that the maximum amount of information (in bits per second) that can be transmitted in a channel error-free is proportional to the Bandwidth $B$ in Hertz, and is also proportional to the logarithm of base-2 of 1+ the signal to noise ratio. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let us break this down to two points, the bandwidth and signal to noise ratio. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bandwidth is the range of frequencies that you use in your channel.  Let us take an example where your channel has a really small bandwidth ($B=0$) where you only have one frequency that you can operate on. This translates to a single sinusoid of a certain frequency. Note that you cannot turn it on or off, or even change its phase because that will result in a range of other frequencies. Therefore communication is impossible on this channel.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal to noise ratio, is a measure of how strong a signal is to how strong the noise is and can take values between 0 and $\infty$. A signal power equal to 0 or a noise power equal to $\inf$ will make $\log_2(1+S/N)$ go to zero where communication is impossible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, 0 noise power, or an infinite signal power (given the bandwidth is not 0) will mean that you can send as much data as you like through the channel without any errors. Which is also the case for an infinite bandwidth and a non-zero value of $\log_2(1+S/N)$. &lt;/p&gt;&#xA;" OwnerUserId="20094" LastEditorUserId="20094" LastEditDate="2016-03-18T14:46:19.387" LastActivityDate="2016-03-18T14:46:19.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29541" PostTypeId="1" AcceptedAnswerId="29543" CreationDate="2016-03-18T16:00:24.270" Score="1" ViewCount="183" Body="&lt;p&gt;I have a general question in image processing. I have a noisy image. I would like to classify the noisy image into some regions. Two famous approaches I can use are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;MRF/Gibbs MRF: Model the spatial dependence between neighborhood&#xA;pixels.&lt;/li&gt;&#xA;&lt;li&gt;Total Variation: Key idea may be based on smallest variation&#xA;of the image.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is: Could you tell me what is different between two approaches for noise removal? What is the key idea of TV? Which one is better? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10792" LastEditorUserId="128" LastEditDate="2018-05-12T09:17:36.607" LastActivityDate="2019-10-19T21:45:45.497" Title="What Is the Difference Between MRF and Total Variation in Noise Removal?" Tags="|filters|image-processing|image-segmentation|total-variation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29542" PostTypeId="1" AcceptedAnswerId="29556" CreationDate="2016-03-18T16:57:07.717" Score="0" ViewCount="3675" Body="&lt;p&gt;I have a signal (x-axis: Time, y-axis: Data) which has more than 10000 samples per second.&#xA;The signal itself represents some physical data (e.g. speed, acceleration, etc.) and has some noise on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Details about the considered signal:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The signal increases/decreases over the considered capture interval with a small gradient&lt;/li&gt;&#xA;&lt;li&gt;Let's consider the case where the signal decreases:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Due to the arbitrary noise (which has a very small amplitude) it regularly happens that one (or more consecutive) samples are not smaller than their predecessor.&lt;/li&gt;&#xA;&lt;li&gt;However due to the high sampling rate those deviations are just an issue for the evaluation routine (Python) trying to decide whether the signals is continously decreasing in the considered time interval.&lt;/li&gt;&#xA;&lt;li&gt;For a human being, with optical inspection of the plot it is very clear that the signal is decreasing&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What is the most robust way to determine, whether the signal is increasing or decreasing over time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about using a moving average filter but I am curious to know whether there is a more proper way to reach my goal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any answer is highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5416" LastEditorUserId="5416" LastEditDate="2016-03-19T09:30:32.443" LastActivityDate="2016-03-20T23:14:37.283" Title="Determine whether a signal is increasing or decreasing over time" Tags="|filters|signal-analysis|noise|continuous-signals|moving-average|" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29543" PostTypeId="2" ParentId="29541" CreationDate="2016-03-18T17:05:32.340" Score="4" Body="&lt;p&gt;These are two different concepts that you talk about. First, MRF gives you a framework to do discrete optimization of problems, which respect the Markovian property, that is a pixel is conditioned only on the neighboring ones (roughly stated). Typical applications include binary or multi-class labeling problems. Total variation on the other hand, is generally used as a regularization by adding the integral of the absolute gradient of the signal/image to the energy functional. This helps to neglect irrelevant detail and focus on important ones. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You cannot say one is better than the other, as they are not exactly contradictory things. It depends on the application and the energy function you use in the MRFs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://hal.archives-ouvertes.fr/hal-00437581/document&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Introduction to Total Variation for Image Analysis&lt;/a&gt; is a good total variation tutorial to begin with. Also, Chambolle provides a link between total variation and binary MRFs, leading to new algorithms in the work entitled &lt;a href=&quot;http://blanche.polytechnique.fr/preprint/repository/578.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Total Variation Minimization and a Class of Binary MRF Models&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Total Variation Minimization and a Class of Binary MRF Models&lt;/em&gt;, Antonin Chambolle, 2005&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2019-10-19T21:45:45.497" LastActivityDate="2019-10-19T21:45:45.497" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29545" PostTypeId="1" CreationDate="2016-03-18T18:10:19.437" Score="0" ViewCount="1946" Body="&lt;p&gt;After an FFT of a signal is done, it is plotted as in the image below, with the original signal is on the first subplot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Wf23i.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wf23i.jpg&quot; alt=&quot;No Ballast&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the magnitude and phase data of each frequency, it's reconstructed, and the produced signal is as the image below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EN5hl.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EN5hl.jpg&quot; alt=&quot;No Ballast Reconstruction&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reconstructed is signal is good except it's shifted 4 milliseconds earlier from the the original signal. I also has done this with another signal, but this 4 milliseconds shift is there too. Why does this happen?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additional question: I used this for harmonic analysis of 50 Hz fundamental frequency (electric power system frequency). I had a slightly hard time determining which frequency of each harmonic (50*n Hz) frequency to use because, from the FFT result, the phase angle is θ at (50*n∓0.001) Hz but suddenly becomes θ±180° at (50*n±0.001) Hz. For example, at 149.999Hz the phase angle is 223.3° but at 150.001Hz the phase angle is suddenly 403.3°. &#xA;Is this hard time determining which angle of each frequency to use for reconstruction, normal?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, this is the Matlab code I use to do the FFT and the plotting.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 1/(8e-6);                % Sampling frequency&#xA;T = 1/Fs;                     % Sample time&#xA;L = 2^21;                     % Length of signal&#xA;t = (0:L-1)*T;                % Time vector&#xA;&#xA;SampleNoBallast;              % The original signal&#xA;&#xA;NFFT = 2^nextpow2(L);         % Next power of 2 from length of y&#xA;Y = fft(y,NFFT)/L;            % The Fast Fourier Transform producing FFT complex&#xA;f = Fs/2*linspace(0,1,NFFT/2+1);     % Frequencies to plot&#xA;P = rad2deg(unwrap(angle(Y)));       % Phase degrees from FFT complex&#xA;&#xA;% Plotting the original signal&#xA;subplot(3,1,1); plot(t(1:12500),y(1:12500))&#xA;title('Arus Masukan LED T8 Opple 18 W tanpa Ballast')&#xA;ylabel('arus (mA)')&#xA;xlabel('waktu (s)')&#xA;grid on&#xA;set(gca,'ButtonDownFcn','selectmoveresize');&#xA;% Plot single-sided amplitude spectrum.&#xA;&#xA;% Plotting the magnitude of each frequency&#xA;subplot(3,1,2); plot(f(1:17000),2*abs(Y(1:17000))) &#xA;title('Hasil FFT')&#xA;xlabel('Frekuensi (Hz)')&#xA;ylabel('Amplitudo (mA)')&#xA;set(gca,'ButtonDownFcn','selectmoveresize');&#xA;&#xA;% Plotting the phase of each frequency    &#xA;subplot(3,1,3); plot(f(1:17000),P(1:17000)) &#xA;title('Sudut Komponen Harmonik')&#xA;xlabel('Frekuensi (Hz)')&#xA;ylabel('Sudut (derajat)')&#xA;set(gca,'ButtonDownFcn','selectmoveresize');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20115" LastEditorUserId="20115" LastEditDate="2016-03-18T18:31:35.433" LastActivityDate="2016-08-15T22:19:27.123" Title="Why does this reconstruction produce a phase shift from the original signal?" Tags="|fft|discrete-signals|phase|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29546" PostTypeId="2" ParentId="29542" CreationDate="2016-03-18T18:23:10.093" Score="1" Body="&lt;p&gt;You may use a bandlimited differentiator (i.e. the cascading of a low-pass filter to remove noise, and a differentiator to get the value of the slope).&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2016-03-18T18:23:10.093" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29548" PostTypeId="2" ParentId="29545" CreationDate="2016-03-18T19:54:29.463" Score="1" Body="&lt;p&gt;The shift is due to using an FFT with a different length than the length of the data, and likely using a non-symmetric arrangement of zero-padding to increase that original length to the zero-padded length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Non-symmetric zero-padding rotates the phase results of an FFT, spiraling across result bins.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-18T19:54:29.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29549" PostTypeId="1" AcceptedAnswerId="29550" CreationDate="2016-03-18T21:56:17.567" Score="0" ViewCount="149" Body="&lt;p&gt;I'm developing a synthesiser and have finished the LFO's.   I'm wanting to provide a knob on the UI for setting the rate.   The minimum value of the LFO will be .01 Hz and the maximum value will be 3000 hz.   I'll have 100 increments in the knob and I want to apply an exponential curve to the values (Lfo rate).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the formula/function for calculating this?   &lt;/p&gt;&#xA;" OwnerUserId="16389" LastActivityDate="2016-03-18T22:10:57.323" Title="Calculating an exponential curve" Tags="|audio|algorithms|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29550" PostTypeId="2" ParentId="29549" CreationDate="2016-03-18T22:10:57.323" Score="2" Body="&lt;p&gt;Set $\Delta=\frac{1}{99}\log_{10}\left(\frac{3000}{0.01}\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the $n_{th}$ knob position should be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_n=10^{n\Delta-2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $n$ runs between 0 and 99 in integer step. &lt;/p&gt;&#xA;" OwnerUserId="20090" LastActivityDate="2016-03-18T22:10:57.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29551" PostTypeId="1" CreationDate="2016-03-18T23:27:47.777" Score="2" ViewCount="465" Body="&lt;p&gt;I'm a newbie at DSP. I am starting a hobbyist project where I plan to monitor 100's of wildlife radio collar frequencies (at my job) and record how many &quot;beeps&quot; per minute are received. My software budget is zero. I have been starting to learn GNU radio and I find most of the tutorials are from 2012 and the many of the blocks are no longer here or soon to be deprecated (WX GUI). Also notice it is not a common tag on Stackexchange. Is GNU Radio a good choice for me?&lt;/p&gt;&#xA;" OwnerUserId="20116" LastEditorUserId="13320" LastEditDate="2016-04-08T14:54:28.403" LastActivityDate="2016-04-08T14:54:28.403" Title="Is GNU Radio a good choice still?" Tags="|signal-analysis|radio|gnuradio|" AnswerCount="0" CommentCount="8" ClosedDate="2016-03-21T11:47:28.853" ContentLicense="CC BY-SA 3.0" />
  <row Id="29553" PostTypeId="1" CreationDate="2016-03-19T06:47:49.963" Score="0" ViewCount="37" Body="&lt;p&gt;Say we have the following (wavelet) series representation at some location and scale in a signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f = \sum_{k=1}^{K} c_k \psi_k$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $c_k$ is the coefficient, in order of magnitude ($|c_k| &amp;gt; |c_{k+1}|$) and $\psi_k$ is the wavelet, although it could be any $L_2$ function I guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a principled way of truncating the series? E.g. could AIC be applied to say choose the first $N &amp;lt; K$ wavelets? If so how?&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="2046" LastEditDate="2016-03-20T21:14:12.207" LastActivityDate="2016-03-20T21:14:12.207" Title="Measures that can be used to truncate linear series of functions" Tags="|wavelet|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29554" PostTypeId="1" AcceptedAnswerId="29581" CreationDate="2016-03-19T08:27:28.140" Score="0" ViewCount="230" Body="&lt;p&gt;How can I make a graph of the noisiness of some audio durations of 100ms - 10s with 100% being white noise and 0% being a sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have FFT at the moment, are there other ways to know the commensurate random nature and perhaps even the dissonance of sound?&lt;/p&gt;&#xA;" OwnerUserId="20058" LastEditorUserId="20058" LastEditDate="2016-03-19T09:17:09.207" LastActivityDate="2016-03-20T16:44:14.903" Title="How to measure noise, consonance, dissonance of a sound?" Tags="|fft|audio|signal-analysis|noise|random|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29555" PostTypeId="1" CreationDate="2016-03-19T10:46:12.450" Score="1" ViewCount="38088" Body="&lt;p&gt;I am very confused about when to use bandwidth as bit rate and where not. Are these terms one and the same?&lt;/p&gt;&#xA;" OwnerUserId="20119" LastEditorUserId="4298" LastEditDate="2016-03-19T18:34:53.123" LastActivityDate="2016-03-20T06:43:37.467" Title="What is bit rate? How is it related to bandwidth?" Tags="|digital-communications|bandwidth|" AnswerCount="3" CommentCount="1" ClosedDate="2016-03-21T11:47:07.587" ContentLicense="CC BY-SA 3.0" />
  <row Id="29556" PostTypeId="2" ParentId="29542" CreationDate="2016-03-19T11:19:34.830" Score="1" Body="&lt;p&gt;You can simply average N samples to know if 100 samples was larger than the previous 100 samples, either in steps of 100 or in steps of 10 or whatever is ideal for your platform. it allows you to achieve average scale assessment of any number of values and at any intervals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's the most easy, simple, and customiseable way to do it. your eye is also just assessing the averages, so you just have to tell the pc to do the same as the eye, using a similar number of samples. &lt;/p&gt;&#xA;" OwnerUserId="20058" LastActivityDate="2016-03-19T11:19:34.830" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29557" PostTypeId="2" ParentId="29555" CreationDate="2016-03-19T11:25:25.560" Score="-1" Body="&lt;p&gt;Bit rate is the number of bits transferred/processed per second. Bandwidth in measured in bits per second. So, you confuse distance with meters. In fact, you should confuse the bandwidth with throughput. &lt;/p&gt;&#xA;" OwnerUserId="19489" LastActivityDate="2016-03-19T11:25:25.560" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29558" PostTypeId="1" CreationDate="2016-03-19T11:33:49.510" Score="2" ViewCount="2956" Body="&lt;p&gt;Suppose, a 2D image is represented by &lt;code&gt;g(x,y)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, what does it mean by &quot;Gradient of &lt;code&gt;g(x,y)&lt;/code&gt;&quot;, &quot;Divergence of &lt;code&gt;g(x,y)&lt;/code&gt;&quot; and &quot;Curl of &lt;code&gt;g(x,y)&lt;/code&gt;&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, avoid formal math for explanations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, use layman's terms and informal discussions.&lt;/p&gt;&#xA;" OwnerDisplayName="user18425" LastEditorUserId="128" LastEditorDisplayName="user18425" LastEditDate="2019-06-24T08:47:27.237" LastActivityDate="2019-11-28T17:12:44.167" Title="What Does It Mean by Gradient / Divergence / Curl of a 2D Image $ g \left( x, y \right) $?" Tags="|image-processing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29559" PostTypeId="2" ParentId="29558" CreationDate="2016-03-19T12:18:19.867" Score="3" Body="&lt;h2&gt;Original Image&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bIMxv.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bIMxv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Image Gradient&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The gradient shows how quickly the color (or greyscale) changes from pixel to pixel. In very &quot;busy&quot; images, the gradient will change much. In areas of less color change, the gradient will be close to zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the image above, the petals don't change color very much so the gradient is close to zero (or small). At the edges of the petals where the color changes from purple to green, the gradient is large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uK0Xz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uK0Xz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Image Divergent&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In the sense of image processing, it is the inverse of gradient, this is a indicate of minor gray scale variation.In this aproach i used the channel Red and Green as vector field&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k9diU.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k9diU.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Image Curl&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Its a like a circular motion of variation of pixels. The curl operation measures the tendency of rotation around the point itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qe5Dv.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qe5Dv.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17817" LastEditorUserId="17817" LastEditDate="2019-11-28T17:12:44.167" LastActivityDate="2019-11-28T17:12:44.167" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29560" PostTypeId="1" AcceptedAnswerId="29561" CreationDate="2016-03-19T18:05:15.190" Score="-2" ViewCount="173" Body="&lt;p&gt;I have a hydrophone which sends voltage as input into my PC. I want to pass this through an FFT, yet from what i can find real and imaginary numbers are given as input. How will this work for me? Or are there other FFT's i should be using?&lt;/p&gt;&#xA;" OwnerUserId="20103" LastActivityDate="2016-03-19T18:12:40.903" Title="FFT and input voltage" Tags="|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29561" PostTypeId="2" ParentId="29560" CreationDate="2016-03-19T18:12:40.903" Score="1" Body="&lt;p&gt;If efficiency is of no concern, you can just use your data as the real part of the input to the FFT, and set the imaginary part to zero. If you want to compute the result more efficiently, you can use a length $N/2$ complex FFT to compute the FFT of a real-valued length $N$ sequence. For the latter, see &lt;a href=&quot;https://dsp.stackexchange.com/questions/28710/time-scaling-in-dft/28712#28712&quot;&gt;this answer&lt;/a&gt; for the theory, and &lt;a href=&quot;https://dsp.stackexchange.com/questions/20115/real-valued-fft-in-matlab/20118#20118&quot;&gt;this one&lt;/a&gt; for a code example.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-03-19T18:12:40.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29563" PostTypeId="2" ParentId="10204" CreationDate="2016-03-19T20:14:24.403" Score="0" Body="&lt;p&gt;There are answers which considers inputs X in the nominator and characteristic polynomial in the denominator. Let me explain in terms of simple signal x[n]. It's z-transform, $$Z\{x[n]\} = x_0 + x_1 z^{-1} + x_2 z^{-2} + \cdots,$$ by definition. For instance,$$Z\{a_0, a_1, a_2\} = a_0 + a_1 z^{-1} + a_2 z^{-2} = {a_0 z^2 + a_1 z^1 + a_2 \over z^2 }.$$ Note that signal is causal by definion when it has all negative time values equal 0. That is, you cannot have $a_{-3}$ in the series. This means that you cannot have z with positive powers in the series, which means that in the fractional form, nominator powers cannot be greater than denominator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, System is z-transform of the impulse response, which can be considered as a signal in time domain or a rational z-function $H(z)=Y(z)/X(z)$, which naturally comes out from system equation $\sum a_n y_n = \sum b_n x_n.$ System is causal if it's impulse response is causal.&lt;/p&gt;&#xA;" OwnerUserId="19489" LastEditorUserId="19489" LastEditDate="2016-03-19T21:33:14.367" LastActivityDate="2016-03-19T21:33:14.367" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29564" PostTypeId="1" AcceptedAnswerId="29568" CreationDate="2016-03-19T20:54:44.507" Score="3" ViewCount="1144" Body="&lt;p&gt;So in class, we've been asked to find the best bit mapping policy for QAM modulation schemes (4-QAM, 8-QAM, 128-QAM, etc). Best meaning the one that will provide the lowest bit error Probability ($P_{be}$). I think I understand the concept, which is for each point closest to a given point, try to change the fewest number of bits. The absolute best case is gray coding, but that would only be possible for 4-QAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I can come up with the best bit mapping policy for the star 8-QAM constellation below. ( the points are numbered in red)&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;https://i.stack.imgur.com/u8xsH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u8xsH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;for outside points (points 1,3,5, and 7) I'm making sure that the two closest points to each only 1 bit changes. So point 1 = 000, and point 2 = 100 (only the Most significant bit changed) and points 8 = 001 (only the least significant bit changed). For the 8-QAM, it's small enough that Just pick a random bit combination for the outside points, and then try to only change 1 bit to get to the center, but for a 16-QAM, for even a 256-QAM this starts getting difficult to just go about picking at random. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is this; Is there a systematic way to go about selecting the bit mapping for these larger constellations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, once we find the bit mapping policy, how can we calculate the bit error probability $P_{be}$? I know how to find the symbol error probability $P_{es}$, and i know for gray coding $P_{be} = \frac{P_{es}}{log_2 M}$ where $M$ is the number of symbols (for 8-QAM $M = 8$). but since everything higher than 4-QAM can only be partial gray coding, how do we determine $P_{be}$ in terms of $P_{es}$?&lt;/p&gt;&#xA;" OwnerUserId="16913" LastActivityDate="2016-03-20T17:00:36.407" Title="systematic way to determine best bit mapping policy" Tags="|digital-communications|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29566" PostTypeId="2" ParentId="29555" CreationDate="2016-03-20T01:02:53.863" Score="2" Body="&lt;p&gt;As hinted by Mr Duval, the term &quot;bandwidth&quot; has been adopted by networking engineers to mean something similar to &quot;transfer rate&quot; (just as &quot;wideband&quot; in networking tends to mean &quot;high speed&quot;). You've tagged your question &quot;digital communications&quot;, though, where the term is very precisely defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bit is the unit of information in information theory. Intuitively, a bit is the information conveyed by the answer to a yes/no question, where each answer is equally likely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In communications we want to transfer information from a transmitter (information source) to a receiver (information sink). The information transfer rate is measured in bits per second. Informally, you can think of this as the number of zeros and ones that a system can transmit per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it turns out that information is transmitted and received using physical, analog signals (voltages or electromagnetic (radio) radiation). These signals pass through a physical medium, called a &quot;channel&quot;, that acts like a filter: only certain frequencies make it from the channel input to its output. So, the channel is said to have a bandwidth, just like any filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the main jobs of communications engineers is to transfer information as fast and reliably as possible over a channel of given bandwidth. Basically, the problem is how to design a physical signal that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fits over the channel bandwidth&lt;/li&gt;&#xA;&lt;li&gt;Conveys bits at a high rate&lt;/li&gt;&#xA;&lt;li&gt;Does so reliably (with few bit errors at the receiver)&lt;/li&gt;&#xA;&lt;li&gt;Does so at feasible complexity at both transmitter and receiver.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The design of such signals is, in a broad sense, covered by the term &quot;modulation&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this is clear -- please comment if you need clarification.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-03-20T01:02:53.863" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="29568" PostTypeId="2" ParentId="29564" CreationDate="2016-03-20T01:15:21.393" Score="2" Body="&lt;p&gt;In general, the method to follow is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Find the distance between each pair of points.&lt;/li&gt;&#xA;&lt;li&gt;Select one point and assign it a label (a set of bits).&lt;/li&gt;&#xA;&lt;li&gt;Then, put its closest neighbors in set A, its second closest in set B, and so on.&lt;/li&gt;&#xA;&lt;li&gt;Label (assign bits to) points in set A so that only one bit is different from the starting point, label points in set B so that two bits are different, and so on.&lt;/li&gt;&#xA;&lt;li&gt;Verify that the labeling works for all points.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It make take several tries before you find a good labeling scheme. As far as I know, there is no general algorithm guaranteed to work for any constellations, but Gray labelings are known for all the main constellations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the example you posted, your proposed labeling is not necessarily correct. For example, the labeling might change depending on whether the distance between 2 and 4 is longer or shorter than the distance between 5 and 4. That is why you need to find the distances before you start labeling.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-03-20T01:15:21.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29571" PostTypeId="2" ParentId="29555" CreationDate="2016-03-20T06:43:37.467" Score="2" Body="&lt;p&gt;In communications engineering, &lt;strong&gt;bandwidth&lt;/strong&gt; is the measure of the width of a range of frequencies, measured in Hertz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Rate&lt;/strong&gt; is the number of transmitted bits per time unit, usually seconds, so it's measured in bit/second. Equivalently, it can be given in symbols/time unit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rate is proportional to the system bandwidth. The &lt;a href=&quot;https://en.wikipedia.org/wiki/Shannon%E2%80%93Hartley_theorem&quot; rel=&quot;nofollow&quot;&gt;Shannon Capacity&lt;/a&gt; is one theoretical way to see this relation, as it provides the maximum number of bits transmitted for a given system bandwidth in the presence of noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in the specifications for each communication's standard, you can find the exact relation between system bandwidth and achievable rate (which is smaller than the Shannon Capacity), and these depends on other parameters such as type of channel and modulation order, but the two magnitudes are still proportional.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-20T06:43:37.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29572" PostTypeId="5" CreationDate="2016-03-20T08:31:45.823" Score="0" Body="&lt;p&gt;Use this tag only for questions related to the implementation of algorithms on a dedicated digital signal processor, or for asking about the properties of such a processing unit.&lt;/p&gt;&#xA;&lt;p&gt;Digital Signal Processors are typically specialized processors that sport signal-processing typical such as multiple address generation units, instructions for low-overhead built-in tight loop constructs, and fused multiply-accumulates for vector operations.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="13320" LastEditDate="2021-01-14T11:11:30.540" LastActivityDate="2021-01-14T11:11:30.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29573" PostTypeId="4" CreationDate="2016-03-20T08:31:45.823" Score="0" Body="**Do NOT use this tag for general questions about digital signal processing!** A DSP core is a processing unit specialized for digital signal processing tasks. " OwnerUserId="4298" LastEditorUserId="13320" LastEditDate="2021-01-14T11:11:53.963" LastActivityDate="2021-01-14T11:11:53.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29575" PostTypeId="1" AcceptedAnswerId="29608" CreationDate="2016-03-20T09:16:59.650" Score="0" ViewCount="1154" Body="&lt;p&gt;I'm trying to smooth a Sawtooth wave coming out of my LFO.   Effectively the transition from 1.0 to -1.0 in a 1 sample step is causing clicks and pops if I modulate my audio signals amplitude with this LFO output.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the best way to smooth this basic waveform to eliminate the clicks without adversely affecting performance (significantly)?&lt;/p&gt;&#xA;" OwnerUserId="16389" LastEditorUserId="16389" LastEditDate="2016-03-20T09:24:27.800" LastActivityDate="2016-03-21T15:52:59.940" Title="Smoothing an LFO Sawtooth Wave" Tags="|audio|algorithms|modulation|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29576" PostTypeId="1" AcceptedAnswerId="29577" CreationDate="2016-03-20T13:28:47.273" Score="0" ViewCount="585" Body="&lt;p&gt;I'm taking an online image and signals class and the structure is absolutely horrible.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if you can provide me hints, or tips to solving the below question.  I'm not looking for an answer, because I'd actually like to learn something!  The structure of the class is just not conducive to learning as they just point us to online resources without any real &quot;teaching.&quot;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Consider a basketball being dribbled. If the height of the basketball can be described by a sine wave of maximum height 2h, average height h and minimum height 0, and the ball hits the ground once per second, how fast would a video camera have to sample the dribbling to extract its frequency? What happens to the frequency estimate if the sampling rate is too low?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So just thinking out loud... the ball is bouncing at a rate of $1\frac{bounce}{sec}$, which from my reading tells me the frequency is just the inverse of this, so $1\frac{sec}{bounce}$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand, though, how to extract how fast a video camera would need to sample this to extract its frequency as it seems like I already have the frequency.  &lt;/p&gt;&#xA;" OwnerUserId="20129" LastEditorUserId="20129" LastEditDate="2016-03-20T13:38:50.773" LastActivityDate="2016-03-20T14:49:15.283" Title="Capturing the sampling rate from a basketball being dribbled" Tags="|frequency|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29577" PostTypeId="2" ParentId="29576" CreationDate="2016-03-20T14:22:57.490" Score="3" Body="&lt;p&gt;The information you are given is $f_\textrm{bounce} = 1\,\textrm{Hz}$ - all the technical details about the sine wave and its amplitude is irrelevant. Please note that &lt;em&gt;frequency&lt;/em&gt; is always measured in &lt;em&gt;something happening per second&lt;/em&gt;, i.e. the unit is always $\frac{1}{\textrm{s}}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you do not want to have an answer, I try to give you a hint:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Imagine you had a camera that would capture an image once a second. Assume that the moment the image is taken is always when the basketball exactly in the middle between the floor and the player's hand. What can you say about the motion of the basketball after having watched this video?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Imagine your camera would capture the scene every $0.5\,\textrm{s}$, i.e. the frame rate would be $2f_\textrm{bounce} = 2\,\textrm{Hz}$, again exactly when the basketball is between the player's hand and the floor. What would be the difference between this video and the first video? What would you learn about the motion of the basketball by watching this video?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you want to get more information, you could search for the &lt;em&gt;Nyquist–Shannon sampling theorem&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-20T14:22:57.490" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29578" PostTypeId="2" ParentId="29576" CreationDate="2016-03-20T14:49:15.283" Score="1" Body="&lt;p&gt;I find the exercice a bit confusing, let me share why, and provide some hints. First, when thinking about a basketball bouncing, the approximation I have in mind is a rectified sine ($|\sin x|$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vbNgR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vbNgR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since it looks more natural:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IW58I.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IW58I.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that it is not bandlimited, so traditional sampling is unlikely to work. Plus, the average height of the rectified sine is not half the maximum height.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, consider the bouncing is actually a sine wave. The period is $1 $ s, which gives you a $f_0=1$ Hz sine, which is $h\sin (2 \pi f_0 t)+h$, which satistifies the other parameters. This signal is band-limited, and can be sampled &quot;perfectly' using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nyquist-Shannon formula&lt;/a&gt;, baased on the maximum frequency of your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second question, a visual hint is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/omTfr.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/omTfr.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with additional notions &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem#Aliasing&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-20T14:49:15.283" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="29579" PostTypeId="1" AcceptedAnswerId="29583" CreationDate="2016-03-20T16:13:18.427" Score="1" ViewCount="3735" Body="&lt;p&gt;This place has been great in helping me to understand my online image and signals class!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've moved on to another question and wanted to see if I'm correctly grasping the subject.  The next question is as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If we sample a pure sine signal at &quot;sam&quot; samples per second, and there are 8 samples per cycle of the signal, and we have not undersampled the signal, what is the signal's frequency in cycles per second?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So using the Nyquist-Shannon theorem I know I have a Nyquist rate of &lt;span class=&quot;math-container&quot;&gt;$8\frac{samples}{cycle}$&lt;/span&gt; so I believe to calculate the signals frequency in cycles per second I need to do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$8\frac{sam}{cycle} = 2\,f_{max}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$8\frac{sam}{cycle} = 2\left(\frac{sam}{sec}\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$4\frac{sam}{cycle} = \frac{sam}{sec}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{sam}{sam}=\frac{1}{4}\frac{cycle}{sec}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="20129" LastEditorUserId="8202" LastEditDate="2020-01-15T18:15:51.810" LastActivityDate="2020-01-15T18:15:51.810" Title="No of samples 4mega samples per second,using 8 bit ADC,V p_p is6V. calculate frequency and peak power" Tags="|frequency|sampling|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29580" PostTypeId="2" ParentId="29553" CreationDate="2016-03-20T16:28:31.733" Score="1" Body="&lt;p&gt;We are in the realm of non-linear data approximation. Among the standard litterature, there are &lt;a href=&quot;http://people.math.sc.edu/devore/publications/NLACTA.pdf&quot; rel=&quot;nofollow&quot;&gt;Nonlinear approximation&lt;/a&gt;, 1998 (R. de Vore), or the more visual &lt;a href=&quot;http://icwww.epfl.ch/~vetterli/talks/MTNS06.pdf&quot; rel=&quot;nofollow&quot;&gt;On Fourier and Wavelets: Representation, Approximation and Compression&lt;/a&gt;, 2006, Vetterli.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best $N$-term approximation, with respect to some norm $\|f-f_N \|_p$, is quite involved (generically, &lt;a href=&quot;https://en.wikipedia.org/wiki/NP-hardness&quot; rel=&quot;nofollow&quot;&gt;NP-hard&lt;/a&gt;). A basic (suboptimal) approach keeps the $N$ biggest terms (esp. with an orthogonal basis)), which (since $|c_k|\ge|c_{k+1}|$) amounts to finding a proper threshold $\gamma$, and perfom hard-thresholding, up to $|c_N|\ge \gamma &amp;gt;|c_{N+1}|$. There are many strategies to pick an optimal threshold, with additional assumptions on the data, on the noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you are interested in the Akaike Information Criterion (AIC), you can check &lt;a href=&quot;https://doi.org/10.1093/biomet/85.3.701&quot; rel=&quot;nofollow&quot;&gt;A Crossvalidatory AIC for Hard Wavelet Thresholding in Spatially Adaptive Function Estimation&lt;/a&gt;, 1998, that compares with other standard wavelet shrinkages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, you have to balance a number of terms (on even bits) with the accuracy. The $\ell_0$ constraint can be converted into other norm penalty. If you want to compress, denoise, you can use other sparsity measures like entropy-based method. Further, you have all sort of matching techniques. You can have a quick overview, for images, in &lt;a href=&quot;http://arxiv.org/abs/1101.5320&quot; rel=&quot;nofollow&quot;&gt;Chapter 4: Redundancy and adaptivity&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-20T16:28:31.733" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29581" PostTypeId="2" ParentId="29554" CreationDate="2016-03-20T16:44:14.903" Score="1" Body="&lt;p&gt;If there are spectral peaks and you want to calculate the dissonance of this sound, you can calculate the &lt;em&gt;sensory dissonance&lt;/em&gt;. See the &lt;a href=&quot;http://essentia.upf.edu/documentation/reference/std_Dissonance.html&quot; rel=&quot;nofollow&quot;&gt;Essentia explanation&lt;/a&gt; and the references mentioned there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you rather want to measure how noisy a sound is, &lt;em&gt;spectral flatness&lt;/em&gt; may be the audio feature of your choice. E.g. see this &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_flatness&quot; rel=&quot;nofollow&quot;&gt;Wikipedia page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8462" LastActivityDate="2016-03-20T16:44:14.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29582" PostTypeId="2" ParentId="29564" CreationDate="2016-03-20T17:00:36.407" Score="2" Body="&lt;p&gt;For $2^{2n}$-QAM, Gray code &lt;em&gt;labeling&lt;/em&gt; often assigns the odd-numbered bits to one axis (I or Q) and the even-numbered bits to the other axis (Q or I) and uses $n$-bit Gray code labeling along each axis. Alternatively, the first $n$ bits could be assigned to I (or Q) and the last $n$ bits to Q (or I). Depending on the structure of the modulator (e.g. 8 bits entering the modulator on a serial line versus 8 bits entering the modulator simultaneously on a 8-bit-wide bus), one method might be preferable over the other. It is important to note that it is not necessary to &lt;em&gt;convert&lt;/em&gt; the data into Gray code; just to &lt;em&gt;use&lt;/em&gt; the Gray code labeling.  An extensive discussion of this last point can be found &lt;a href=&quot;https://groups.google.com/forum/#!searchin/comp.dsp/Sarwate$20Gray$20code$20QAM/comp.dsp/CB_yJ5EztMk/PgMdv0aaN90J&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; on Google Groups.&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2016-03-20T17:00:36.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29583" PostTypeId="2" ParentId="29579" CreationDate="2016-03-20T17:26:15.377" Score="0" Body="&lt;p&gt;There are &lt;code&gt;sam&lt;/code&gt; samples per second and 8 times less pure sine cycles per second. This means that there are &lt;code&gt;sam/8&lt;/code&gt; pure sine cycles per second. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What shannon has to do with that? Probably you mean that Niquitz allows you to reduce sampling, make it 4 times more rarely, as low as &lt;code&gt;sam/4&lt;/code&gt; samples per second. That would sample twice per sine period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1bnxJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1bnxJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19489" LastEditorUserId="19489" LastEditDate="2016-03-21T06:13:37.470" LastActivityDate="2016-03-21T06:13:37.470" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="29584" PostTypeId="1" CreationDate="2016-03-20T18:22:32.793" Score="1" ViewCount="106" Body="&lt;p&gt;I have pictures of an oesophagus (ie a tube) taken under standard white light looking down the tube. I have about 10 images taken over 20cm in series. The image looks forward down into the tube and examples can be found &lt;a href=&quot;http://www.gastrolab.net/pa-170.htm&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. Each image is taken serially down the tube at the same session and the centre is positioned largely the same in all the pictures. I would like to be able to combine these images into one (I guess 3D cylinder) in order to then create a flat 2D surface image of the surface lining the tube. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="20132" LastEditorUserId="20132" LastEditDate="2016-03-20T18:34:32.430" LastActivityDate="2016-03-20T18:34:32.430" Title="How to reconstruct 2D flat image from a series of pictures of a tube" Tags="|3d|reconstruction|panorama|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29585" PostTypeId="1" CreationDate="2016-03-20T18:43:33.240" Score="1" ViewCount="2956" Body="&lt;p&gt;I am working on license plate detection using &lt;code&gt;hough transform&lt;/code&gt;. I am trying to detect the horizontal and vertical edges and then to find the parallel lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;img = rgb2gray(img);&#xA;&#xA;img = medfilt2(img);&#xA;&#xA;v = edge(img,'sobel','vertical');&#xA;v = bwlabel(v);&#xA;stats = regionprops(v, 'Area','BoundingBox','Image');&#xA;ids = find([stats.Area] &amp;gt; 30 &amp;amp; [stats.Area] &amp;lt; 2000);&#xA;v = ismember(v,ids);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sWhMR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sWhMR.png&quot; alt=&quot;Image after vertical edge detection and applying the area filtering&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to detect the parallel lines. I have consulted different examples on &lt;a href=&quot;http://www.mathworks.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mathworks&lt;/a&gt; but unfortunately I couldn't get much of it. Someone please guide me &lt;strong&gt;how to detect two &lt;em&gt;almost straight and parallel&lt;/em&gt; lines in a binary image?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="20130" LastActivityDate="2018-06-30T19:44:01.750" Title="how to detect two parallel lines in a binary image with MATLAB" Tags="|image-processing|matlab|hough-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29586" PostTypeId="1" CreationDate="2016-03-20T21:16:52.003" Score="1" ViewCount="1135" Body="&lt;p&gt;I have a hydrophone which gives input into my PC as voltage. I have an FFT which uses both real and complex numbers; however the hydrophone output I have set as the real and have set complex to all zero's. The output I get is an array of data in the form (r,c). Given that I collect 500,000 data points every 1 second, how would I plot this on a graph? this is what I can't seem to get my head around. &lt;/p&gt;&#xA;" OwnerUserId="20103" LastActivityDate="2016-03-21T08:26:39.277" Title="FFT output to graph" Tags="|fft|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29587" PostTypeId="1" CreationDate="2016-03-20T21:30:37.640" Score="2" ViewCount="1002" Body="&lt;p&gt;I'm studying various publications about symbol timing recovery algorithms, Early-late, Mueller and Muller &amp;amp; Gardner. All documents I've read tells that, to minimize ISI :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The optimal time for sampling the signal is at the peak of the receiver matched filter&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Looking at a real signal, it seems that a local peak is not always the right sampling time. For example, this figure shows the output of the receiver matched filter and the ideal sampling times :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u496O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u496O.png&quot; alt=&quot;Optimal sampling time&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, the ideal sampling times are not always at local peaks of the signal. Are there special requirements so that the &quot;optimal sampling time is at local peaks&quot; or could you point me in the right direction to understand this particular point ?&lt;/p&gt;&#xA;" OwnerUserId="19507" LastEditorUserId="11256" LastEditDate="2016-03-20T22:19:01.417" LastActivityDate="2016-03-21T14:50:46.637" Title="Optimal time for sampling symbol in digital receivers" Tags="|digital-communications|matched-filter|symbol-timing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29589" PostTypeId="1" AcceptedAnswerId="29603" CreationDate="2016-03-20T22:34:05.390" Score="2" ViewCount="3975" Body="&lt;p&gt;I'm writing a simple function in Python to return the Q of a circuit, given its poles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Q of a system with pole p, can be found using $Q=-\frac{\left|p\right|}{2*Re(p)}$.  Obviously, in a natural system, such a pole must come as part of a pair, and both would yield the same result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For coincident poles on the real axis, this gives a Q of 1/2 (critically damped).  For poles on the imaginary axis, that gives a Q of $\infty$ (undamped).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing the function left me with the question, as a matter of completeness, of what to do if the pole is at the origin.  Is there a customary value to assign to poles at the origin?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Background material:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anyone interested in where the equation relating pole location to Q comes from,   It derives from the 2nd order transfer function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/480Rh.png&quot; width=&quot;300&quot;&gt;&#xA;&lt;a href=&quot;http://image.ing.bth.se/ipl-bth/siamak.khatibi/signal%20and%20system%20-%20C%20level%20-%20spring%202006%20-LP4/lectures/Lec-pole-zero.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;(source)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graphically described here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/2qyvf.jpg&quot; width=&quot;300&quot;&gt;&#xA;&lt;a href=&quot;http://www-inst.eecs.berkeley.edu/~ee247/fa10/files07/lectures/L2_2_f10n.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;(source)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A decent discussion of Q and damping in 2nd order systems can also be found here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/41RnS.png&quot; width=&quot;300&quot;&gt;&#xA;&lt;a href=&quot;http://ocw.mit.edu/courses/mechanical-engineering/2-003-modeling-dynamics-and-control-i-spring-2005/readings/notesinstalment2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;(source)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives an excellent review of how the pole placement corresponds to various damping characteristics.&lt;/p&gt;&#xA;" OwnerUserId="18971" LastEditorUserId="18971" LastEditDate="2016-03-22T18:35:09.093" LastActivityDate="2019-11-12T11:24:37.577" Title="What's the Q of a pole at the origin of the s-plane?" Tags="|poles-zeros|quality-factor|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29591" PostTypeId="2" ParentId="29542" CreationDate="2016-03-20T23:14:37.283" Score="1" Body="&lt;p&gt;Here some answers for the case where you're processing your data in a single batch (as opposed to online/in real time). These methods will take all of your data into account, so local sample-to-sample fluctuations aren't a problem. These are very well established methods and it should be easy to find existing code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is increasing/decreasing linearly with respect to time, then you can fit a line to the amplitude vs. time curve using linear regression. The slope of the line tells you the amount of the increase or decrease per unit time. Alternatively, you can calculate the Pearson correlation coefficient. Its value ranges from -1 for perfectly decreasing to 1 for perfectly increasing, with 0 meaning no dependence. Unlike slope, correlation would give you a measure of the degree of linear dependence between signal amplitude and time, but not the magnitude of the increase/decrease.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your signal is increasing/decreasing monotonically with time but the relationship isn't necessarily linear, then you can calculate the Spearman rank correlation or Kendall's tau. Similar to the Pearson correlation, these statistics will measure how much your signal depends on time, ranging from -1 (perfectly decreasing) to 1 (perfectly increasing), with 0 meaning no dependence. Unlike Pearson correlation, the nature of the increase/decrease can be any monotonic function, not just a straight line (e.g. an exponential or logarithmic curve).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any of these methods, you can do statistical tests to make more well-founded statements about the increase/decrease. The issue is that you're trying to estimate something about the underlying signal from a finite, noisy set of data points. For a given true/underlying signal, any statistic you compute will be different each time you run the measurement because the noise is different. So, say your statistic says the signal is increasing; is this because it's really increasing, or could it be because noise just made it look that way? Statistical tests will help answer that question. Things to look into here are 'confidence intervals' and 'statistical hypothesis testing' (i.e. 'p values'). Depending on your application and level of noise, statistical testing may or may not be necessary. There may be nuances if your noise itself has temporal correlations.&lt;/p&gt;&#xA;" OwnerUserId="20134" LastActivityDate="2016-03-20T23:14:37.283" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29593" PostTypeId="1" AcceptedAnswerId="29676" CreationDate="2016-03-21T02:37:36.777" Score="4" ViewCount="3136" Body="&lt;p&gt;I have some data which are the sets of values uniformly distributed along some measure (simple example - along the time intervals).&#xA;I tested both the coefficients and found the difference, some times essential.&#xA;F.e. if both the data are noise-like, signal r is about 0.7, and Pearson r - about 0.25.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which coefficient should be considered better and why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I compute the signal correlation coefficient as&#xA;$$&#xA;r=\frac{\sum_ix_iy_i}{\sqrt{\sum_ix_i^2}\sqrt{\sum_iy_i^2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and Pearson correlation coefficient as&#xA;$$&#xA;r=\frac{\sum_i(x_i-m_x)(y_i-m_y)}{\sqrt{\sum_i(x_i-m_x)^2}\sqrt{\sum_i(y_i-m_y)^2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two fragments of pair of signals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fragment 1. Two signals with similar Signal- and Pearson- coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://net2ftp.ru/node0/nf05@ngs.ru/Signals1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fragment 1 http://net2ftp.ru/node0/nf05@ngs.ru/Signals1.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fragment 2. Two noise-like signals: Signal r = 0.7, Pearson r = 0.2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://net2ftp.ru/node0/nf05@ngs.ru/Signals2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fragment 2 http://net2ftp.ru/node0/nf05@ngs.ru/Signals2.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS I do not need to performe cross-corelation, convolution etc.&lt;/p&gt;&#xA;" OwnerUserId="20137" LastEditorUserId="8202" LastEditDate="2016-03-24T07:34:42.423" LastActivityDate="2016-06-22T09:56:09.207" Title="Signal correlation vs Pearson correlation between signals" Tags="|discrete-signals|correlation|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29594" PostTypeId="1" AcceptedAnswerId="29598" CreationDate="2016-03-21T03:19:30.450" Score="0" ViewCount="1679" Body="&lt;p&gt;As I know, if we want to know the LTI system output, then we do convolution between input x[n] and impulse response h[n].&#xA;but actually,in this question, I want to know what does convolution has the behind meaning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we do convolution(sum of products) not just using adder or multiplier for calculation between input signal and impulse response? &lt;/p&gt;&#xA;" OwnerUserId="20136" LastEditorUserId="20136" LastEditDate="2016-03-21T04:17:01.230" LastActivityDate="2016-03-21T07:54:17.310" Title="What does convolution has the meaning?" Tags="|convolution|" AnswerCount="2" CommentCount="1" ClosedDate="2016-03-21T11:48:26.577" ContentLicense="CC BY-SA 3.0" />
  <row Id="29595" PostTypeId="2" ParentId="29586" CreationDate="2016-03-21T03:47:11.623" Score="1" Body="&lt;p&gt;You could probably improve your question with more detail of what you are trying to do and what the data flow is.  You have what I presume is audio data coming in, and I'm guessing you want to know what frequencies are present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the FFT complex values which encode the magnitude and phase of the various frequencies in your signal.  $\sqrt{re^2+im^2}$ will give you the magnitude of each frequency.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like $atan2(im,re)$ will give you the phase.  You're probably looking to plot one of these types of values.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://webpages.ursinus.edu/lriley/ref/complex/node1.html&quot; rel=&quot;nofollow&quot;&gt;http://webpages.ursinus.edu/lriley/ref/complex/node1.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are only interested in knowing what the frequency content is, then magnitude is probably what you want.  If you are interested in knowing something about how far away the source is or how the sound is being affected by the water, then you want to look at the phase.  I would guess that just looking at the phase information visually in degrees or radians won't be useful-- you'll need to take the phase information through your model and then look at the result in meters or whatever you're trying to measure.&lt;/p&gt;&#xA;" OwnerUserId="18971" LastEditorUserId="18971" LastEditDate="2016-03-21T03:58:33.437" LastActivityDate="2016-03-21T03:58:33.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29596" PostTypeId="1" AcceptedAnswerId="29609" CreationDate="2016-03-21T05:31:09.263" Score="2" ViewCount="2649" Body="&lt;p&gt;I have an MRI K-Space data 320 x 320 x 256 x 8 (4D complex double) from &amp;lt; mridata.org &gt; . The data represents 320 x 320 K-Space of 256 slices from 8 channels. I am trying to reconstruct images for each slice. Here is the matlab code I tried:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Version - 1&#xA;kspacedata= kspacefile.kdata;&#xA;imRef = ifftshift(ifftn(kspacedata));&#xA;imSOS    = squeeze(sqrt(sum( abs(imRef).^2, 4))); % sum-of-squares to combine all channels&#xA;&#xA;% Version - 2&#xA;kspaceSlicedata = kspacedata(:,:,100,:);&#xA;imSliceRef = ifftshift(ifftn(kspaceSlicedata));&#xA;imSliceSOS    = squeeze(sqrt(sum(abs(imSliceRef).^2, 4))); % sum-of-squares to combine all channels&#xA;&#xA;% Plotting&#xA;figure;&#xA;subplot(1,2,1); imagesc(imSOS(:,:,100));title('Version - 1');axis image; colormap(gray);&#xA;subplot(1,2,2); imagesc(imSliceSOS);title('Version - 2');axis image; colormap(gray);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In Version - 1, I take inverse transform on entire kspace data and plot image data corresponding to slice 100. In Version - 2, I take kspace data corresponding to slice 100 and do inverse transform on this kspace and plot the image data. Here is the output images I obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DUbi0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DUbi0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought both versions will reconstruct the same way. But images appeared different. How can I take kspace data corresponding to one slice and perform inverse transform to reconstruct slice image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="18691" LastActivityDate="2016-03-21T12:05:57.300" Title="MRI Slice image reconstruction" Tags="|matlab|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29597" PostTypeId="2" ParentId="29594" CreationDate="2016-03-21T07:07:19.833" Score="0" Body="&lt;p&gt;An LTI system can be completely described by its impulse response.  That means, the output of this system can be calculated for any input,  once you are given the output of this LTI system to the special input called impulse sequence.  So you derive the output for any input x(n), given the impulse response of the system h(n).  And you call this particular formula convolution of the sequences h(n) and x(n).  So convolution is the special property of LTI systems.  For excellent derivation of the relation between y(n),x(n) and h(n), please refer to Oppenheim and Schafer books on disrete time systems.&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2016-03-21T07:07:19.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29598" PostTypeId="2" ParentId="29594" CreationDate="2016-03-21T07:54:17.310" Score="3" Body="&lt;p&gt;I explained in &lt;a href=&quot;https://en.wikipedia.org/wiki/Talk:Convolution#Why_the_time_inversion.3F&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Why is time inversion?&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WdcEZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WdcEZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Red is a reference delta impulse (of height 1), whereas green is a typical response to that impulse, denoted by function h(t). In LTI, output is proportional to the input, that is if we have a delta impulses at the input at time 0, output at time t will be a*h(t). Now, instead of single impulse at the origin, you apply a series of input impulses at various times. What will be the output? Say, there was input impulse of height $a_1$ at $T_1$. Since current time is $t$, impulse occurred $t-T_1$ seconds ago and its contribution to the current output y(t) is $a_1 h(t - T_1)$. There is another contribution from another impulse, occurred at $T_2$. Its contribution is $a_2 h(t-T_2)$. So, $y(t) = a_1 h(t-T_1) + a_2 h(t-T_2)$. You simply add up the contributions beacuse of LTI linearity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, you have $y_t = \sum_0^t {a_i h(t-i)}$. That is a convolution formula. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also appears when you multiply to polynomials $(a_0 + a_1 z + a_2 z^2 + ...)(b_0 + b_1 z + b_2 z^2 + ...) =\sum_0^\infty {c_n z^n} $ where $c_n = a_i b_{n-i}$. That is why you tend to represent series as z-transforms. In this case you can simply multiply them and have convolution on the background. &lt;/p&gt;&#xA;" OwnerUserId="19489" LastActivityDate="2016-03-21T07:54:17.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29599" PostTypeId="2" ParentId="29593" CreationDate="2016-03-21T08:10:53.810" Score="0" Body="&lt;p&gt;The Pearson correlation gives you a measure of the degree of linear dependence between two variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Correlation refers to any of a broad class of statistical relationships involving dependence.From the cross-correlation function you can obtain the correlation coefficient which will give you a single value of similarity.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-21T08:10:53.810" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29601" PostTypeId="2" ParentId="29586" CreationDate="2016-03-21T08:26:39.277" Score="0" Body="&lt;p&gt;You could separate the real and the imaginary part and plot both graphs separately in terms of magnitude. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, as suggested in the previous answer, you can plot the complex signal in terms of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Phase (radians and/or degrees)&lt;/li&gt;&#xA;&lt;li&gt;Absolute value&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Usually, having a set of different representations will help you to understand the meaning of your data. It can be very helpful if you find some other signal representation that you would like to use as a benchmark, but also you can learn how to extract the information from complex signals like the ones in this &lt;a href=&quot;http://www.dspguide.com/ch10/2.htm&quot; rel=&quot;nofollow&quot;&gt;post&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-21T08:26:39.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29603" PostTypeId="2" ParentId="29589" CreationDate="2016-03-21T08:44:26.100" Score="4" Body="&lt;p&gt;Note that the formula given in your question is valid for a system with a complex-conjugate pole pair $p$ and $p^*$ with $\text{Re}(p)\neq 0$. As you've correctly pointed out, if for $|p|&amp;gt;0$ the real part $\text{Re}(p)$ approaches zero, the $Q$ factor approaches infinity. This is the case for a pole pair on the $j\omega$-axis with $|p|&amp;gt;0$, i.e. not at $s=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that you can't use that formula for two distinct real-valued poles. That situation corresponds to an overdamped system with $Q&amp;lt;\frac12$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with a double pole at $s=0$ is that there is no reasonable way to evaluate the formula given in your question. The corresponding limit does not exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, we can think of a reasonable definition of $Q$ for the case of a double pole at $s=0$.&#xA;For $p=p^*=0$ the transfer function of the corresponding system is (assuming no finite zeros)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(s)=\frac{A}{s^2}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with some constant $A$. The impulse response is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t)=\mathcal{L}^{-1}\{H(s)\}=A\,t\,u(t)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have to ask ourselves what we mean by $Q$ in this case. Since the damping is zero, you could say that $Q=\infty$. I haven't come across a definition of $Q$ in the case of a double real pole at $s=0$, and I think that for this degenerate case there cannot be any useful definition. If I had to decide on a value, I'd say $Q=\infty$, in analogy with all other pole pairs on the $j\omega$-axis.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-03-22T18:21:32.523" LastActivityDate="2016-03-22T18:21:32.523" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29604" PostTypeId="1" CreationDate="2016-03-21T08:55:08.163" Score="3" ViewCount="947" Body="&lt;p&gt;I am looking for methods to identify sounds within audio files.  I was hoping to find some ready-made user-friendly software to do this but haven't found it yet.  I am familiar with Matlab and some C++ and have mech. eng. background so I can do some coding work myself to implement a solution but I'm not a serious programmer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my online searches I seem to have found there are 2 potential methods; cross correlation and fingerprinting.  It seems to me that the audio fingerprinting method is potentially more accurate than raw cross correlation.  At this point this investigation is for my own hobby purposes to be implemented with a robot.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone with related experience comment which approach may be more successful?    It seems there are several audio fingerprinting methods and some open source codes even for matlab so I am intrigued, however, these methods are mostly developed to identify entire songs.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sounds I want to identify are short (from &amp;lt; 1s to ~5s).  I was thinking if the analysis sample rate was increased to fill the short sound file that maybe the method could work with very short files such as these sounds, but I do not know the implications for the rest of the techniques of fingerprinting.  Does this seem like a reasonable / possible approach to anyone?  If not are there references for other potentially applicable DSP techniques for this I can research?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="20142" LastActivityDate="2024-03-29T12:01:40.167" Title="identification of sounds within audio signals" Tags="|audio|sound|cross-correlation|signal-identification|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29607" PostTypeId="2" ParentId="29575" CreationDate="2016-03-21T11:28:44.133" Score="0" Body="&lt;p&gt;Multiply by $\pi$ and feed to a sinewave lookup table.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="80" LastEditDate="2016-03-21T12:00:33.987" LastActivityDate="2016-03-21T12:00:33.987" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29608" PostTypeId="2" ParentId="29575" CreationDate="2016-03-21T12:02:26.167" Score="1" Body="&lt;p&gt;Reason that it's clicking is that you are jumping from 1 to 0 in the time that the audio signal reads the last of the 1 control signal and then the 0 control signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to slow fast signal transitions over multiple samples, for example 1 to 0 should take 5ms or 10ms which is dozens or 100ds of samples. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, you can use a lowpass filter at about 300Hz more or less, which can actually be very cheap for a single monophone LFO its less that 1% cpu useage, or you can use a signal smoothing algorithm, for exampel a linear interpolation function or a SmoothStep which is awesome general knowledge for audio programmers.&#xA;&lt;a href=&quot;http://paulbourke.net/miscellaneous/interpolation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://paulbourke.net/miscellaneous/interpolation/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BTW what is the platform? i can't give you code exampels if i dont know what code you use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the cool thing about smoothstep is how easy it is, its very good knowldedge in synths:&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Smoothstep&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Smoothstep&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://documentation.apple.com/en/logicstudio/instruments/index.html#chapter=A%26section=3%26tasks=true&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://documentation.apple.com/en/logicstudio/instruments/index.html#chapter=A%26section=3%26tasks=true&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;check the filtered sawtooth there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also a smoother that says &quot;if difference between last signal and this signal was larger than 0.02, signal - 0.02... and create a secondary smothed signal... there are fairly simple smoothing algo's based on that it's pretty straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://mathematica.stackexchange.com/questions/38293/make-a-differentiable-smooth-sawtooth-waveform&quot;&gt;There is also an entire page on the topic.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12103" LastEditorUserId="-1" LastEditDate="2017-04-13T12:55:35.443" LastActivityDate="2016-03-21T15:52:59.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29609" PostTypeId="2" ParentId="29596" CreationDate="2016-03-21T12:05:57.300" Score="2" Body="&lt;p&gt;The two reconstructions are both valid in general. In MRI images can be acquired in multiple 2D slices and as a 3D volume. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When data is acquired in slices, you would take the 2D Fourier Transform of the k-space of each slice (and each channel, if it is a multi-channel coil). Then you would sum the channel data up in a Sum of Squares fashion as you did. The result would be the reconstructed slices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When data is acquired in a true 3D mode, you do not have separate k-spaces, but only one big k-space. To reconstruct this data, you would do a 3D Fourier Transformation of your k-space (and do so separately for each channel, if the coil had multiple channels). After a Sum of Squares summation of the channel, you have reconstructed the whole volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can easily check, if you data is acquired in 2D or 3D mode: Take the absolute of your k-space data. If you have only one maximum in your data (one DC component), data was acquired in 3D. If there are multiple maxima in the same order of magnitude (one per slice), then data was acquired in 2D mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you cannot replace a 3D FFT by applying 2D FFTs for each slice. That is why your second reconstruction failed. Look at an orthogonal &quot;slice&quot; to what you have shown - you will clearly see the typical k-space modulation with the maximum intensity in the middle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-21T12:05:57.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29611" PostTypeId="2" ParentId="29585" CreationDate="2016-03-21T12:44:52.083" Score="2" Body="&lt;p&gt;You mentioned the Hough transform, but your code doesn't use it. However, it can help you to find out the orientations of lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The maximum values of the Hough transform correspond to probable lines. These maxima are defined by their coordinates $(\rho, \theta)$, where $\rho$ is the distance from the origin to the closest point on the straight line, and $\theta$ is the angle between the $x$ axis and the line connecting the origin with that closest point (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Hough_transform#Theory&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, two parallel lines have a close $\theta$ (or $\theta + \pi$).&lt;/p&gt;&#xA;" OwnerUserId="20147" LastEditorUserId="80" LastEditDate="2016-03-21T16:10:59.547" LastActivityDate="2016-03-21T16:10:59.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29612" PostTypeId="2" ParentId="28968" CreationDate="2016-03-21T13:53:32.707" Score="0" Body="&lt;p&gt;In MRI, there is no intrinsic &quot;color map&quot;. Opposed to Computed Tomography, there is no analogy to the Hounsfield Units. Hence, you only have relative intensity information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commonly, if you reconstruct your images by yourself, you'll have double values in an arbitrary range. If you compare that to the DICOM data from the MR machine, you'll notice that the DICOM images are rescaled to integer values, lets say between 0 and 4095. The rescaling factor is just a number to fit the signals in a predefined range - again no additional quantitative information here.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-21T13:53:32.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29614" PostTypeId="2" ParentId="29587" CreationDate="2016-03-21T14:50:46.637" Score="1" Body="&lt;p&gt;You are mixing up two different notions of sampling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a digital&#xA;communications system, the received (analog, continuous-time) signal&#xA;is passed through an A/D converter so that the needed further&#xA;processing (e.g. matched filtering) can be implemented on a &#xA;programmable DSP processor or as a MATLAB or C++ program or &#xA;on a special purpose ASIC. The sampling that you show in your question&#xA;is the one being carried out in the A/D converter, and as long as&#xA;the sampling is above the Nyqvist rate, the fact that the samples&#xA;are not at the peaks of the signal is irrelevant: the original&#xA;signal is represented perfectly adequately by the samples regardless&#xA;of where the peaks in the signal are with respect to the sampling&#xA;instants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other notion of sampling has to do with the matched filter&#xA;output which is a sequence of digital data. &lt;em&gt;Which&lt;/em&gt; of these&#xA;data should the decision-making device use to decide whether&#xA;(in the simplest case) whether a 0 or a 1 was transmitted?&#xA;The answer is what you quote: it is the datum when the&#xA;&lt;em&gt;signal&lt;/em&gt; output of the matched filter has a peak. That is,&#xA;we are picking &lt;em&gt;one&lt;/em&gt; value from the matched filter output&#xA;sequence and making the decision based on that.&#xA;Note that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;We are not going to &lt;em&gt;average&lt;/em&gt; the matched filter output (or&#xA;take a weighted average of the output) and make a decision on that&#xA;quantity.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We are not going to take the maximum value of the actual output&#xA;sequence (which may, because of noise, be at a different location&#xA;than the time when the &lt;em&gt;signal&lt;/em&gt; output of the matched filter is&#xA;supposed to peak) and make a decision based on that.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For more information on matched filters (including explanations&#xA;of the above bulleted points), see &#xA;&lt;a href=&quot;https://dsp.stackexchange.com/a/9389/235&quot;&gt;this other answer&lt;/a&gt; of mine.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-03-21T14:50:46.637" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29618" PostTypeId="1" CreationDate="2016-03-21T21:38:31.587" Score="1" ViewCount="167" Body="&lt;p&gt;I'm wondering if MATLAB communications or DSP toolboxes has a FM discriminator? If so, what is the name of the function/object?&lt;/p&gt;&#xA;" OwnerUserId="11242" LastActivityDate="2016-03-21T21:38:31.587" Title="Does MATLAB have a FM discriminator" Tags="|matlab|frequency-domain|time-frequency|" AnswerCount="0" CommentCount="0" ClosedDate="2016-03-21T23:41:41.960" ContentLicense="CC BY-SA 3.0" />
  <row Id="29619" PostTypeId="1" AcceptedAnswerId="31696" CreationDate="2016-03-21T21:41:25.870" Score="4" ViewCount="3187" Body="&lt;p&gt;I always hear that wavelet transform is not shift invariant, and that there are other types of wavelet, like stationary wavelet and double density dual-tree wavelet transform, that are shift invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain to me, what is the meaning of &quot;shift invariant&quot; .&lt;/p&gt;&#xA;" OwnerUserId="16855" LastActivityDate="2018-03-11T20:17:50.570" Title="Shift invariant in wavelet" Tags="|wavelet|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29620" PostTypeId="1" CreationDate="2016-03-21T23:42:13.310" Score="2" ViewCount="124" Body="&lt;p&gt;Suppose, we have the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lOBW1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lOBW1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we want to apply a 5x5 filter to the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would the filter sweep the image?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/goe0v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/goe0v.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, like this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cSieK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cSieK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, anything else?&lt;/p&gt;&#xA;" OwnerDisplayName="user18425" LastActivityDate="2016-03-22T02:20:04.653" Title="How does an Image filter really sweep an Image?" Tags="|image-processing|filters|" AnswerCount="1" CommentCount="0" ClosedDate="2016-08-25T12:27:03.010" ContentLicense="CC BY-SA 3.0" />
  <row Id="29622" PostTypeId="2" ParentId="29620" CreationDate="2016-03-22T00:07:47.473" Score="2" Body="&lt;p&gt;I assume by image filter sweeping, you mean the image is convolved with a kernel.  In that case, the method is more similar to what you show in your second image.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conceptually, the NxM kernel is multiplied by an NxM block of pixels in the image, and the results are summed to a single value-- this is the first value in your 2D result array.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the next NxM block of pixels is taken by offsetting the window one pixel to the right, the kernel is multiplied by this block, the results summed, and this is the second value (top row, 2nd from left) in your result array.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This continues until you reach the end of the row, then you offset down one pixel and start again at the beginning of the row.  This result is then the first result in the second row of your result array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, it doesn't have to be done in order, and many optimizations or parallel programming techniques may perform better if you don't step through sequentially overlapped like this, but conceptually this is what's happening-- take a block, convolve, get one pixel output, put it into the result for that offset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the question of how to handle edges-- if you want the convolution result to be the same size as the input image, you need to assume values for pixels outside the border of the actual image.  Zero is a common assumption. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering edges, and in reference to the question in the comments, where you start the kernel depends on what exactly you want out.  First, different kernels may have different &quot;origins&quot;-- typically the result of the kernel calculation is referenced to the center of the kernel, but that's not a requirement (and can't happen if the kernel is an even number of units across).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the tradeoff needs to be resolved between the size of the output and the validity of the data.  If you want an output image of the same size as the input image, then starting (3,3) of the kernel at (1,1) in the image, assuming 1 based indexing, will give you that result.  The challenge is what value to use for parts of the kernel that don't overlap the image.  For example, if you are using a kernel to average a neighborhood of pixels, and you assume 0 for values outside the image, then the edge-most pixels of your result image will darken because you are averaging in those zeros with the existing data.  That may be reasonably harmless.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other kernels, however, may give bad data at the border if you assume values outside the image.  Assuming zero outside the image when you're taking a picture of sky could cause &quot;phantom&quot; edges to appear with an edge detection kernel, for example, and this could cause problems later in your processing pipeline.  In this case you might prefer to start with (3,3) of your kernel at (3,3) of the image, and then your result image will be 4 pixels narrower and 4 pixels shorter.&lt;/p&gt;&#xA;" OwnerUserId="18971" LastEditorUserId="18971" LastEditDate="2016-03-22T02:20:04.653" LastActivityDate="2016-03-22T02:20:04.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29623" PostTypeId="1" AcceptedAnswerId="29624" CreationDate="2016-03-22T01:59:37.500" Score="0" ViewCount="172" Body="&lt;p&gt;'bits' are used with 2 different meanings.  One can use 'bits' to mean the binary digits i.e. 1's and 0's.  Bits are also the units of information in a event of discrete source.  I think when channel capacity is measured in bits/sec, we use the second meaning of bits.  Not how many 1's and 0's we can send down the channel but how much information we can send per second through that channel.  Is my interpretation right? &lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2016-03-22T02:11:27.770" Title="What are bits in the context of channel capacity units?" Tags="|information-theory|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29624" PostTypeId="2" ParentId="29623" CreationDate="2016-03-22T02:11:27.770" Score="1" Body="&lt;p&gt;in Information Theory, the amount of information in a message is proportional to the logarithm of the probability of occurrence of the message:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ I(m) = -C \log\left( P(m) \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the only difference between different bases of logarithms is a scaling constant.  if $ C = \frac{1}{\log(2)} $, that is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;I(m) &amp;amp; = -\frac{1}{\log(2)} \log\left( P(m) \right) \\&#xA;     &amp;amp;= - \log_2\left( P(m) \right) \\&#xA; \end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then we say that the $I(m)$ is in units of bits.  the reason why is if the message $m$ had only two possibilities and both had equal likelihood, then $P(m) = \frac12 $ and $I(m) = 1$.  there are two messages, two possibilities of equal likelihood, like heads and tails of a coin.  and you need only one bit, 0 or 1, to represent the two possibilities.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-03-22T02:11:27.770" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29625" PostTypeId="1" CreationDate="2016-03-22T06:32:59.963" Score="1" ViewCount="110" Body="&lt;p&gt;I have $x_A$, $y_A$, and $z_A$ acceleration signals collected from a smartphone and I call it: set $A$ and I also  have $x_B$, $y_B$, and $z_B$ same acceleration signals from smartwatch: let's call this set $B$. I need to combine them together to obtain set $C$, but since I don't have good knowledge in signal processing I am not sure if it is this logically correct to combine them and take the average of them, or any other way should I follow to have one set of signals instead of having two separate sets?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to select the set if it is possible? The signals are raw data. &lt;/p&gt;&#xA;" OwnerUserId="20162" LastEditorUserId="15892" LastEditDate="2016-03-22T19:28:24.713" LastActivityDate="2016-03-22T19:52:14.357" Title="Combination of accelation signals from two devices" Tags="|discrete-signals|sensor|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29626" PostTypeId="2" ParentId="29625" CreationDate="2016-03-22T06:43:18.613" Score="2" Body="&lt;p&gt;May be you can find &lt;a href=&quot;https://en.wikipedia.org/wiki/Variance&quot; rel=&quot;nofollow&quot;&gt;variance&lt;/a&gt; of acceleration along x,y, and z direction in SET A and in set B separately and choose the the device which has least variance.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Sensor_fusion#Example_sensor_fusion_calculations&quot; rel=&quot;nofollow&quot;&gt;As this Wikipedia page suggests,&lt;/a&gt; you can combine the two by weighting by their respective variances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to get $x_C$ simply:&#xA;$$&#xA;x_C = \frac{1}{\sigma_1^{-2} + \sigma_2^{-2}} \left(  \frac{x_A}{\sigma_1^2} + \frac{x_B}{\sigma_2^2}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting some numbers on this, suppose $\sigma^2_1 = 1$ and $\sigma^2_2 = 0.5$, then &#xA;$$&#xA;\sigma_3^2 = \frac{1}{\sigma_1^{-2} + \sigma_2^{-2}} = \frac{1}{1 + 2} = \frac{1}{3}&#xA;$$&#xA;which is a lower variance than either of the individual measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the same process to find $y_C$ and $z_C$.&lt;/p&gt;&#xA;" OwnerUserId="20067" LastEditorUserId="80" LastEditDate="2016-03-22T19:52:14.357" LastActivityDate="2016-03-22T19:52:14.357" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29631" PostTypeId="2" ParentId="27748" CreationDate="2016-03-22T13:59:34.970" Score="1" Body="&lt;p&gt;In MRI the term $k$-space usually means that you have spatial frequencies in a matrix. The Fourier Transformation of this matrix is the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The terms &lt;em&gt;readout&lt;/em&gt; and &lt;em&gt;frequency&lt;/em&gt; correspond to each other; they mean the same. The &lt;em&gt;readout&lt;/em&gt; direction is a logical direction, along which a gradient is applied &lt;em&gt;during signal acquisition&lt;/em&gt;, i.e. &lt;em&gt;during readout&lt;/em&gt;. This gradient field causes a frequency spread of the excited magnetization along the direction of this gradient, hence the second name &lt;em&gt;readout&lt;/em&gt; for this direction and for the corresponding signal axis in $k$-space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term &lt;em&gt;phase&lt;/em&gt; is associated with another direction, usually perpendicular to the &lt;em&gt;readout&lt;/em&gt;/&lt;em&gt;frequency&lt;/em&gt; direction. It is called so, because a gradient field is applied before the signal is read out. This causes a frequency shift, too, but the gradient field is switched off before the read out of the signal, hence in this direction there is only one frequency during read out. What is left from this frequency spread is a &lt;em&gt;phase shift&lt;/em&gt; of the magnetization vectors along that direction. The trick here is to repeat the measurement with different field strengths of that &lt;em&gt;phase&lt;/em&gt; encoding gradient - that way, this direction is fully encoded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course you are right: The coil that measures the signal does measure it in a time-domain. Keep in mind, that you additionally switch magnetic gradient fields. These fields act upon the magnetization and hence alter the measured signal. Since the temporal behavior of those gradient fields is known and chosen carefully (to fulfill certain criteria such as the Sampling Theorem, etc.), there is a simple relation between the time $t$ of the measured signal and the corresponding $k$-space position: $\vec{k}(t) = \frac{\gamma}{2\pi}\int_0^t \vec{G}(\tau)\,\textrm{d}\tau$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Even though the &lt;em&gt;phase&lt;/em&gt; and &lt;em&gt;readout&lt;/em&gt; gradients look completely different in sequence diagrams and appear to be completely different encoding techniques - they are completely the same! Even for physicists who are new to the field of MRI this bears some trouble initially in understanding the image measurement process. &lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-22T13:59:34.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29632" PostTypeId="1" CreationDate="2016-03-22T14:21:35.147" Score="1" ViewCount="2649" Body="&lt;p&gt;I'm reading chunks of audio signal (1024 samples) using a buffer, applying a Hanning window, doing an FFT on it, then reading an Impulse Response, doing its FFT and then multiplying the two (convolution) and then taking that resulting signal back to the time domain using an IFFT. I'm zero padding the Impulse Response to match the length of the input signal chunk. However, I still get a noisy click sound after it reads every chunk, because of differences in amplitude I suspect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this stage I want to do an Overlap Add but am unclear on how to do it on a buffer. Convolving the input signal chunk with the Impulse Response results on a signal with the same number of samples (1024) so what am I overlapping when it gets to the next chunk? &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Should I be using a longer impulse response and zero pad the signal&#xA;instead, and then add the rest of that signal after sample 1024 to&#xA;the next window and so on?  Or should I use a longer window on the&#xA;input signal?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am doing all this in Python using PyAudio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much for your help&lt;/p&gt;&#xA;" OwnerUserId="20167" LastActivityDate="2019-07-14T13:56:38.980" Title="Convolution and windowing using a buffer - how do I do overlap add?" Tags="|fft|audio|convolution|python|" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29634" PostTypeId="1" CreationDate="2016-03-22T15:14:39.550" Score="2" ViewCount="260" Body="&lt;p&gt;I want to implement an $M$-band (or multi-band) wavelet transform, to be used for feature extraction on images.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a built-in Matlab function available? &lt;/li&gt;&#xA;&lt;li&gt;Do I have to implement is using filter coefficients?&lt;/li&gt;&#xA;&lt;li&gt;Where can I get filter coefficients for $M$-band wavelets?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20170" LastEditorUserId="15892" LastEditDate="2016-03-22T19:06:29.410" LastActivityDate="2016-04-24T09:03:27.470" Title="How to implement a $j$-level $M$-band wavelet transform of an image?" Tags="|image-processing|wavelet|multi-channel|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29635" PostTypeId="5" CreationDate="2016-03-22T16:42:49.777" Score="0" Body="&lt;p&gt;An all-pass filter is a signal processing filter that passes all frequencies equally in gain, but changes the phase relationship among various frequencies (source: &lt;a href=&quot;https://en.wikipedia.org/wiki/All-pass_filter&quot; rel=&quot;nofollow&quot;&gt;Wikipedia&lt;/a&gt;). &lt;/p&gt;&#xA;" OwnerUserId="20158" LastEditorUserId="20158" LastEditDate="2016-03-22T18:09:24.767" LastActivityDate="2016-03-22T18:09:24.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29636" PostTypeId="4" CreationDate="2016-03-22T16:42:49.777" Score="0" Body="Use this tag for questions related to filters that change the phase relationship of a signal, but does not change the gain (amplitude) of the signals." OwnerUserId="20158" LastEditorUserId="20158" LastEditDate="2016-03-22T18:09:36.587" LastActivityDate="2016-03-22T18:09:36.587" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29637" PostTypeId="1" CreationDate="2016-03-22T18:25:36.513" Score="2" ViewCount="1377" Body="&lt;p&gt;I want to use MFCC (Mel-frequency cepstral coefficients) and DTW (dynamic time warping) algorithms to make a speech comparison script. I calculated MFCC  and got 13 coefficients for each frame. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I calculate DWT from that? Should I discard the frames and just look at coefficents as an array. I read in this post: &lt;a href=&quot;https://dsp.stackexchange.com/questions/29165/speech-recognition-using-mfcc-and-dtwdynamic-time-warping&quot;&gt;Speech recognition using MFCC and DTW(Dynamic Time Warping)?&lt;/a&gt; that you should calculate DTW between each frame, but I don't understand what I should do after I have calculated all those DTWs. If I have one audio sequence of $n$ frames and the other one of $m$ frames, then I get $n \times m$ DTW costs. And, where do I go from there.&lt;/p&gt;&#xA;" OwnerUserId="20172" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2022-04-14T16:08:30.833" Title="Applying DTW on MFCC frames" Tags="|audio|mfcc|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29638" PostTypeId="2" ParentId="29634" CreationDate="2016-03-22T21:07:59.913" Score="2" Body="&lt;p&gt;[EDIT: some code made available]  The  notion of $M$-band wavelet transform, $M\ge2$, generalizes the standard $2$-band wavelet. The theory is provides, for instance, in &lt;a href=&quot;http://dx.doi.org/10.1109/78.258088&quot; rel=&quot;nofollow noreferrer&quot;&gt;Theory Of Regular M-Band Wavelet Bases&lt;/a&gt;, P. Steffen &lt;em&gt;et al.&lt;/em&gt;, 1993. Remember that with $2$-band wavelets, one cannot obtain wavelets that are real-valued, symmetric, orthogonal and with finite support, except for the Haar wavelet (not very regular). For $M&amp;gt;2$, such designs can be obtained with sufficient regularity, and $M$-band wavelets are sometimes believed to be more efficient for image analysis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1ly07.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1ly07.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alas, regular $M$-band filterbank are generally harder to design, and $M$-band wavelets have been used more rarely. Resultingly, they are less implemented in standard software. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On $M$-band implementations: I am not aware of build-in Matlab functions. However, there exist $1$D versions, that you can built upon for your applications:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;LTFAT (Large Time-Frequency Analysis Toolbox) : &lt;a href=&quot;http://ltfat.sourceforge.net/doc/wavelets/wfilt_cmband.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;WFILT_CMBAND&lt;/a&gt; - Generates $$M$-Band cosine modulated wavelet filters, from &lt;a href=&quot;http://dx.doi.org/10.1109/83.342190&quot; rel=&quot;nofollow noreferrer&quot;&gt;On cosine-modulated wavelet orthonormal bases&lt;/a&gt;, 1995&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www-syscom.univ-mlv.fr/~chaux/toolbox/TOOLBOX_DTMband1D_v1.2.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;M-band dual-tree wavelet&lt;/a&gt;: Shannon &amp;amp; Meyer wavelets, and Modulated Lapped Transforms for specific $M$s, and a $4$-band filter from &lt;a href=&quot;http://dx.doi.org/10.1109/78.398719&quot; rel=&quot;nofollow noreferrer&quot;&gt;Design of Efficient $M$-Band Coders with Linear-Phase and Perfect-Reconstruction Properties&lt;/a&gt;, 1995, Alkin and Caglar. They  come with their Hiilbert transform, and are detailed in &lt;a href=&quot;http://dx.doi.org/10.1109/TIP.2006.875178&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Analysis Using a Dual-Tree M-Band Wavelet Transform&lt;/a&gt;, 2006; &lt;a href=&quot;http://dx.doi.org/10.1109/TIT.2007.909104&quot; rel=&quot;nofollow noreferrer&quot;&gt;Noise Covariance Properties in Dual-Tree Wavelet Decompositions&lt;/a&gt;, 2007; &lt;a href=&quot;http://dx.doi.org/10.1109/TSP.2008.921757&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Nonlinear Stein Based Estimator for Multichannel Image Denoising&lt;/a&gt;, 2008. Below, 2D oriented $4$-band wavelets from Alkin and Caglar:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FoM1I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FoM1I.png&quot; alt=&quot;Dual wavelets from Alkin &amp;amp; Caglar&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A $2$-D version is now embedded in the Matlab toolbox:  &lt;a href=&quot;http://fr.mathworks.com/matlabcentral/fileexchange/56705-m-band-2d-dual-tree--hilbert--wavelet-multicomponent-image-denoising&quot; rel=&quot;nofollow noreferrer&quot;&gt;$M$-band $2$D dual-tree (Hilbert) wavelet multicomponent image denoising.&lt;/a&gt; Other sources to grab coefficients from:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-&lt;a href=&quot;http://dx.doi.org/10.1016/j.amc.2004.11.025&quot; rel=&quot;nofollow noreferrer&quot;&gt;An algebraic construction of orthonormal $M$-band wavelets with perfect reconstruction&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And one day, I shall rewrite my own codes to make them much cleaner.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-04-24T09:03:27.470" LastActivityDate="2016-04-24T09:03:27.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29643" PostTypeId="2" ParentId="27878" CreationDate="2016-03-22T23:39:15.057" Score="1" Body="&lt;p&gt;A DSP / Audio delay line doesnt create any effect in itself, a delay is simply a timed delay in the signal. it has no sound difference, it repeats the sound once and mixes it over original or sends it to a different mix line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A feedback delay repeats the sound multiple times at the delay interval frequency, it sounds like a digital echo, and can become an oscillator above 20hz. almost all fx delays use variable feedback controls to control the number of repetitions of a sound, and they are filtered out as they feed back therefore diminishing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Modern delays can work like grain synth samplers and often are based on them which have integrated effects like pitch shifting and research Grain-Delay and Grain-Resampling for infor about that. Squarepusher is somneone who uses alot of grain delay sometimes...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So a delay in effect is barealy an effect, but it can become an osciallator, has complex variants, and can feed into other lines that have any kind of additional FX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a firmer grasp of that program i foudn this vid was more informative:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=ySzjFU6J4Ck&quot; rel=&quot;nofollow&quot;&gt;https://www.youtube.com/watch?v=ySzjFU6J4Ck&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it's a pretty simple and very well balanced grain-delay with good controls and some bit crushing types of FX, and probably some filters too.&lt;/p&gt;&#xA;" OwnerUserId="20058" LastActivityDate="2016-03-22T23:39:15.057" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29644" PostTypeId="2" ParentId="29632" CreationDate="2016-03-22T23:47:19.047" Score="0" Body="&lt;p&gt;it doesnt matter if it's a buffer or not, you still have to have samples of lengths required by the overlap-add.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reconstitute the buffers into samples of the necessary length, a delay will be necessary as long as the samples required by an overlap-add code function. After than you just need normal overlap add code.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2016-03-22T23:47:19.047" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29645" PostTypeId="2" ParentId="29632" CreationDate="2016-03-23T00:15:18.800" Score="2" Body="&lt;p&gt;An input chunk of length N convolved with an impulse response of length M will result in an output of length N+M-1 before overlap-add is implemented. Also to prevent circular convolution taking place you need to make sure that the FFT size you use for both is the same size as the output chunk N+M-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Choose an input segment size N so that N + M - 1 = a power of 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Take input chunk of length N and zero pad so that it is length N + M-1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Take impulse response of length M and zero pad so that it length N + M-1 also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Compute DFT of both signals with FFT-size of N+M-1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) Multiply both signals in frequency domain and IFFT the result&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now remember that the IFFT output is of length N+M-1, hence why methods like overlap-add and overlap-save are used. You need to sum the first M-1 samples from an output chunk with the last M-1 samples from the previous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch18.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch18.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S I only learned this recently so apologise if i haven't explained anything very well, I have attached a PDF from the DSP guide about FFT convolution which goes into more depth.&lt;/p&gt;&#xA;" OwnerUserId="20175" LastActivityDate="2016-03-23T00:15:18.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29647" PostTypeId="2" ParentId="29632" CreationDate="2016-03-23T02:18:48.380" Score="3" Body="&lt;p&gt;normally i like to define windows to have even symmetry about $t=0$ or $n=0$, but this time i'll do it like MATLAB (except i know how to count from $0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hann Window of width $B$ samples:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ w[n] \triangleq \begin{cases} \frac12 \left(1 - \cos\left(\frac{2 \pi}{B} (n+\frac12)\right) \right) \quad \text{for } 0 \le n &amp;lt; B \\&#xA;0  \quad \text{for } n &amp;lt; 0 \text{ or } B \le n \\&#xA; \end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another way to write it is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ w[n] = \tfrac12 \left(1 - \cos\left(\tfrac{2 \pi}{B} (n+\tfrac12) \right) \right) \cdot \left(u[n] - u[n-B] \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $u[n]$ is the discrete unit step function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ u[n] \triangleq \begin{cases} &#xA;1 \quad \text{for } n \ge 0 \\&#xA;0 \quad \text{for } n &amp;lt; 0 \\&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;all $B$ samples within the window width are non-zero.  let's assume $B$ is even, so that $\frac{B}2$ is an integer.  turns out that the Hann window is &lt;em&gt;&quot;complementary&quot;&lt;/em&gt; which means the downslope of one Hann window adds to $1$ with the upslope of the window adjacent to its right if they are staggered by $\frac{B}2$ samples.  in fact this is true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \sum\limits_{m=-\infty}^{\infty} w\left[n-m\tfrac{B}2 \right] = 1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that means&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x[n] &amp;amp; = x[n] \sum\limits_{m=-\infty}^{\infty} w\left[n-m\tfrac{B}2 \right] \\&#xA;     &amp;amp; = \sum\limits_{m=-\infty}^{\infty} x[n]  w\left[n-m\tfrac{B}2 \right] \\&#xA;     &amp;amp; = \sum\limits_{m=-\infty}^{\infty} x_m[n-m\tfrac{B}2]   \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_m[n] \triangleq x\left[n+m\tfrac{B}2 \right]  w[n] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we broke up the input into overlapping little &lt;em&gt;&quot;wavelets&quot;&lt;/em&gt; (my term, not in the sense of Daubechies) or &lt;em&gt;&quot;grains&quot;&lt;/em&gt;, $x_m[n]$, each delayed, in the summation, by $\frac{B}2$ samples in relation to their preceding neighbor $x_{m-1}[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now we know that for the $m$-th delayed &lt;em&gt;grain&lt;/em&gt;, $x_m\left[n-m\tfrac{B}2 \right] \ne 0$ &lt;strong&gt;only&lt;/strong&gt; for $m\tfrac{B}2 \le n &amp;lt; m\tfrac{B}2 + B$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FIR convolution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we have an FIR filter with causal finite impulse response, $h[n]$, with length $L$.  so $h[n]=0$ for $n&amp;lt;0$ or $L\le n$.  the output of this FIR filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;y[n] &amp;amp; = h[n] \ \circledast \ x[n] \\&#xA;     &amp;amp; \triangleq \sum\limits_{i=-\infty}^{\infty} h[i] x[n-i] \\&#xA;     &amp;amp; = \sum\limits_{i=0}^{L-1} h[i] x[n-i] \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;OLA convolution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;one way to write this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;y[n] &amp;amp; = h[n] \ \circledast \ x[n] \\&#xA;     &amp;amp; = h[n] \ \circledast \ \sum\limits_{m=-\infty}^{\infty} x_m[n-m\tfrac{B}2] \\&#xA;     &amp;amp; = \sum\limits_{m=-\infty}^{\infty} h[n] \ \circledast \ x_m[n-m\tfrac{B}2] \\&#xA;     &amp;amp; = \sum\limits_{m=-\infty}^{\infty} y_m[n-m\tfrac{B}2] \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; y_m[n] &amp;amp; \triangleq h[n] \ \circledast \ x_m[n] \\&#xA;        &amp;amp; = \sum\limits_{i=0}^{L-1} h[i] x_m[n-i] \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;another way to say it is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;y[n] &amp;amp; = h[n] \ \circledast \ x[n] \\&#xA;     &amp;amp; = \sum\limits_{i=0}^{L-1} h[i] x[n-i] \\&#xA;     &amp;amp; = \sum\limits_{i=0}^{L-1} h[i] \sum\limits_{m=-\infty}^{\infty} x_m[n-m\tfrac{B}2 - i]  \\&#xA;     &amp;amp; = \sum\limits_{m=-\infty}^{\infty} \sum\limits_{i=0}^{L-1} h[i] \ x_m[n-i - m\tfrac{B}2]  \\&#xA;     &amp;amp; = \sum\limits_{m=-\infty}^{\infty} y_m[n-m\tfrac{B}2]  \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_m[n]$ defined the same way as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the potentially non-zero length of the block of input samples $x_m[n]$ is $B$ samples, the length of the FIR is $L$ samples, and that makes the potentially non-zero length of the block of output samples $B+L-1$.  you can see that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y_m[n] = 0 \quad \text{for }n&amp;lt;0 \text{ or }n \ge B+L-1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_m[n]$ could be non-zero for $0 \le n &amp;lt; B+L-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;unlike the overlapping input segments $x_m[n]$, the length of the output grains $y_m[n]$ need not be the block length $B$, but can be (and are) longer.  so instead of 50% overlap (which is $\frac{B-\tfrac12 B}{B} = \frac12$ or an overlap of $B - \tfrac12 B$ samples) like you might have with the Hann-windowed input, your overlap with the output blocks will be $B+L-1 - \tfrac12 B$ samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FFT convolution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the convolution of each block&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y_m[n] = \sum\limits_{i=0}^{L-1} h[i] x_m[n-i] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be done with an FFT as long as the FFT size $N$ is at least the length of the output block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ N \ge B+L-1 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;X_m[k] &amp;amp; = \mathcal{DFT} \left\{ x_m[n] \right\} \\&#xA;       &amp;amp; = \sum\limits_{n=0}^{N-1} x_m[n] \ e^{-j 2 \pi \frac{nk}{N}}  \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y_m[k] = H[k] \cdot X_m[k] \quad \text{for } 0 \le k &amp;lt; N $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;H[k] &amp;amp; = \mathcal{DFT} \left\{ h[n] \right\} \\&#xA;       &amp;amp; = \sum\limits_{n=0}^{N-1} h[n] \ e^{-j 2 \pi \frac{nk}{N}}  \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;Y_m[k] &amp;amp; = \mathcal{DFT} \left\{ y_m[n] \right\} \\&#xA;       &amp;amp; = \sum\limits_{n=0}^{N-1} y_m[n] \ e^{-j 2 \pi \frac{nk}{N}}  \\&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you need only compute $H[k]$ once for use with all of the blocks. and you get the time-domain samples for each output block with the inverse FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;y_m[n] &amp;amp; = \mathcal{IDFT} \left\{ Y_m[k] \right\} \\&#xA;       &amp;amp; = \frac1N \sum\limits_{k=0}^{N-1} Y_m[k] \ e^{+j 2 \pi \frac{nk}{N}}  \\&#xA;\end{align} $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-03-23T17:59:44.583" LastActivityDate="2016-03-23T17:59:44.583" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29649" PostTypeId="1" AcceptedAnswerId="29656" CreationDate="2016-03-23T04:17:57.880" Score="0" ViewCount="1089" Body="&lt;p&gt;I came across &lt;a href=&quot;http://www.wolframalpha.com/input/?i=fourier+transform+sin%28x%29&quot; rel=&quot;nofollow&quot;&gt;the Fourier transform of sin(t)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It ends up being a purely imaginary (dirac delta) impulse pair. But when considering the frequency domain representation of a signal, we consider the graphs of (i) the magnitude of the signal w.r.t. frequency and (ii) the phase (i.e. argument or angle) of the signal w.r.t. frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of $\sin(t)$, the phase can be seen to be 90 degrees, treating the delta functions in manner analogous to real numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how would I find the magnitude? Could someone please provide a reference to a textbook?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As another example, what would be the magnitude and phase of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\operatorname{FourierTransform}(\cos(t)) \cdot (4 + 2j) \text{ ?}$$&lt;/p&gt;&#xA;" OwnerUserId="20177" LastEditorUserId="80" LastEditDate="2016-03-23T12:43:29.120" LastActivityDate="2016-03-23T15:51:10.800" Title="Polar form of the Fourier transform of $\sin(t)$" Tags="|fourier-transform|math|" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29650" PostTypeId="1" AcceptedAnswerId="34365" CreationDate="2016-03-23T05:21:50.530" Score="0" ViewCount="55" Body="&lt;p&gt;I am trying to extract some features of the accelerometer sensor and during the feature extraction each 5 second segment in the array is windowed and features are generated from these windows. Features extracted include:&#xA;•   Mean of the magnitude data &#xA;•   Maximum value. &#xA;•   Minimum value.&#xA;•   Standard Deviation value for each axis (x, y, and z).&#xA;•   Average Standard Deviation over 3 axes.&#xA;•   Root mean squared acceleration (RMS). &#xA;•   The sum of height of frequency component below 5 Hz.&#xA;•   Number of peaks in spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if mixing all these is adding redundant values and affect the final results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="20162" LastActivityDate="2016-09-22T14:46:38.387" Title="Which of these features may not be needed or redundant?" Tags="|continuous-signals|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29651" PostTypeId="1" AcceptedAnswerId="29652" CreationDate="2016-03-23T06:02:40.267" Score="3" ViewCount="3538" Body="&lt;p&gt;Basically I couldnt find proof for this anywhere though it's a very simple and basic equation.&lt;/p&gt;&#xA;" OwnerUserId="16107" LastEditorUserId="1629" LastEditDate="2016-03-23T19:18:39.903" LastActivityDate="2020-10-06T21:50:03.833" Title="Why is the signum function $=2u(t) - 1$?" Tags="|discrete-signals|proof|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29652" PostTypeId="2" ParentId="29651" CreationDate="2016-03-23T06:48:14.157" Score="7" Body="&lt;p&gt;The signum function is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{sgn}(t)=\begin{cases}-1,&amp;amp;t&amp;lt;0\\0,&amp;amp;t=0\\1,&amp;amp;t&amp;gt;0\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the half-maximum convention, the unit step function is defined by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$u(t)=\begin{cases}0,&amp;amp;t&amp;lt;0\\\frac12,&amp;amp;t=0\\1,&amp;amp;t&amp;gt;0\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From these two definitions it should be obvious that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{sgn}(t)=2u(t)-1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;must hold.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-23T06:48:14.157" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29653" PostTypeId="2" ParentId="29649" CreationDate="2016-03-23T07:35:45.377" Score="-1" Body="&lt;p&gt;Regarding to the magnitude and phase representation of delta functions, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.dspguide.com/ch11/1.htm&quot; rel=&quot;nofollow&quot;&gt;http://www.dspguide.com/ch11/1.htm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.math.hcmus.edu.vn/~tatuana/Xu%20Ly%20Anh/Ebook%20Others/CS450%20Slide%20Khac/ft-properties.seminar.pdf&quot; rel=&quot;nofollow&quot;&gt;http://www.math.hcmus.edu.vn/~tatuana/Xu%20Ly%20Anh/Ebook%20Others/CS450%20Slide%20Khac/ft-properties.seminar.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, for the second example, you may need to develop that function as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$4\cdot\cos(t) + 2j\cdot\cos(t)$ and then, you will end up with some deltas as well. This is the answer for the $2j\cdot\cos(t)$ one: &lt;a href=&quot;http://www.wolframalpha.com/input/?i=fourier+transform+2jcos(x)&quot; rel=&quot;nofollow&quot;&gt;http://www.wolframalpha.com/input/?i=fourier+transform+2jcos(x)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you don't really need to expand the second example, but if you want to find the polar representation, you are going to do it anyway.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastEditorUserId="8202" LastEditDate="2016-03-23T15:51:10.800" LastActivityDate="2016-03-23T15:51:10.800" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29655" PostTypeId="1" CreationDate="2016-03-23T09:34:28.200" Score="2" ViewCount="2227" Body="&lt;p&gt;I asked exact the same here one year ago: &lt;a href=&quot;https://dsp.stackexchange.com/questions/22314/how-to-design-very-narrow-band-very-sharp-low-pass-filters-only-dc-needed&quot;&gt;One year ago question&lt;/a&gt; I asked this question again here, because after one year, I have learned more about DSP and am thinking ways to improve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Filter description&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Filter input data rate is 64kHz&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Filter output data rate is 0.5Hz - 2Hz&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The filter is preferably to have bandwidth of 1mHz with very sharp transition area, since only DC is needed and the noises at 0-5Hz is large. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The answer I got&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The averaging data is the best DC I can get. I bought this answer. However, it now becomes plausible to me, since a filter always have a bandwidth and frequency responses. Averaging is essentially a FIR with no superior characteristics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Shall the filter be designed in this way: 9 stages of halfband filters(64kHz -&gt; 125Hz). Followed by three stages of cascaded integrator–comb (CIC) filters with R=5. Then the output will be fed into a 1st order IIR filter?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Maybe 16 stages of halfband filters? (64kHz -&gt;  0.9765625Hz) And then be fed into an IIR filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How shall the filter be designed?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10200" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-03-25T14:56:18.040" Title="How to design very narrow, sharp lowpass filters - Only DC needed?" Tags="|filters|infinite-impulse-response|finite-impulse-response|decimation|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29656" PostTypeId="2" ParentId="29649" CreationDate="2016-03-23T12:56:29.197" Score="2" Body="&lt;p&gt;I read two question here. One is about the graphical representation of the Fourier transform of a sinusoidal function, and the other is about the magnitude (and phase) of such a Fourier transform. For ordinary functions, these two would be equivalent, but for Fourier transforms containing Dirac delta impulses they are not. The reason is that mathematically you can't compute the magnitude of a Dirac delta impulse. It is not a function, so there are no function values to take the magnitude of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A standard graphical representation of the Fourier transform of the function $\sin(\omega_0t)$ would usually just be two arrows at $\omega=\omega_0$ and $\omega=-\omega_0$, one pointing up, the other one pointing down, where the $y$-axis is labeled by $j$ (which makes a separate phase plot unnecessary). An example of such a graph is shown &lt;a href=&quot;https://mathematica.stackexchange.com/a/42395&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though you can't compute the magnitude of a Dirac impulse, you could write down a representation of the Fourier transform of a sinusoid consisting of a sum of Dirac impulses with positive areas and a phase term. For the function $f(t)=\sin(\omega_0t)$ such a representation would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega)=\pi[\delta(\omega-\omega_0)+\delta(\omega+\omega_0)]e^{-j\frac{\pi}{2}\text{sign}(\omega)}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that I use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform#Other_conventions&quot; rel=&quot;nofollow noreferrer&quot;&gt;non-unitary definition&lt;/a&gt; of the Fourier transform, which is different from the unitary version used by Wolfram Alpha. This is why there's a factor of $\pi$ in $(1)$ instead of $\sqrt{\frac{\pi}{2}}$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar representation of your example $A\cdot\mathcal{F}\{\cos(\omega_0t)\}$ with complex $A=|A|e^{j\phi_A}$, where $\phi_A$ is the argument of the complex number $A$, is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A\cdot\mathcal{F}\{\cos(\omega_0t)\}=|A|\pi [\delta(\omega-\omega_0)+\delta(\omega+\omega_0)]e^{j\phi_A}\tag{2}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:55:35.443" LastActivityDate="2016-03-23T12:56:29.197" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29658" PostTypeId="1" CreationDate="2016-03-23T13:03:45.027" Score="1" ViewCount="807" Body="&lt;p&gt;In &quot;Shu Lin, Daniel J. Costello-Error Control Coding (2nd Edition), Prentice Hall 2004&quot; it is given that in $GF(2)$, if $f(x)$ is an irreducible polynomial of degree $m$ it divides $x^n+1$ where $n = 2^m -1$. And as per mathematica documentation, $x$ is an irreducible polynomial, here is the conflict.  $x$ does not divide $x+1$.  Also $x$ is declared non-primitive!  Just want clarification. &lt;a href=&quot;https://i.stack.imgur.com/zLfxD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zLfxD.png&quot; alt=&quot;Wolfram documentation i.e mathematica documentation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="8202" LastEditDate="2019-12-16T10:43:40.770" LastActivityDate="2019-12-16T10:43:40.770" Title="Why is $x$ not considered a primitive polynomial while being considered an irreducible polynomial?" Tags="|channelcoding|information-theory|mathematica|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29659" PostTypeId="1" AcceptedAnswerId="29665" CreationDate="2016-03-23T13:04:33.067" Score="0" ViewCount="102" Body="&lt;p&gt;I am a beginner to study about the filter notion and property&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being a real digital filter, &#xA;(here &quot;real filter&quot; I means that its impulse response is real-valued)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this formula is established. &#xA;But I have no idea how to prove it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |H(\pi +w )|=|H(\pi -w)|$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should be $H(w)$ or $|H(w)| $ for generalized proof procedure? &lt;/p&gt;&#xA;" OwnerUserId="10537" LastActivityDate="2016-03-23T17:11:44.250" Title="Real digital filter property" Tags="|filters|filter-design|digital-filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29660" PostTypeId="1" AcceptedAnswerId="29669" CreationDate="2016-03-23T13:55:58.847" Score="3" ViewCount="109" Body="&lt;p&gt;I am trying to solve the following exercise:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Show that the signal $x_n = A\cos(\omega n)$ can be fully predicted by a system with two weights $w_1,w_2$ (i.e. $x_n = w_1 x_{n-1} + w_2 x_{n-2}$). Find $w_1,w_2$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Some ideas came up but, even if they are right, I can't seem to order them in the right direction:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I can see that $x'' = -\omega^2x$. Does it connected somehow to what is asked?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I guess it has something to do with stationary signals. If yes, how can I prove that this signal is stationary? (Also, somehow I can't find in the internet a clear definition of &quot;stationary signal&quot;. Just vague ideas like &quot;not dependant on time&quot;. What does this mean mathematically for a signal to be &quot;not dependant on time&quot;?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Maybe it is concerned with some trigonometry of this form:&#xA;\begin{align} x_{n+2} &amp;amp;= A\cos((n+2)\omega) \\ &amp;amp;= A\cos(n\omega + 2\omega) \\ &amp;amp;= A\cos(n\omega)\cos(2\omega) - A\sin(n\omega)\sin(2\omega) \\ &amp;amp;= B\cos(n\omega) + C\sin(n\omega)\end{align}&#xA;I could go on with this development but I am realy not sure what am I looking for..&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any help?&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="16077" LastEditorUserId="11256" LastEditDate="2016-03-23T15:00:49.823" LastActivityDate="2016-03-28T08:53:29.940" Title="How to show that the signal $x_n = A\cos(\omega n)$ can be fully predicted by a system with two weights $w_1,w_2$" Tags="|linear-systems|stationary|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29661" PostTypeId="2" ParentId="29655" CreationDate="2016-03-23T14:02:51.480" Score="6" Body="&lt;p&gt;Your questions still leave me wondering as to what you're actually designing. For software implementation on modern x86 CPUs, CICs make almost no sense, but they are extremely elegant in hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These filter definitions are ridiculous if you're planning to use a FIR – a transition width of 1mHz means that a minimum phase equiripple filter [1, (5.75), p. 142] would have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;N_e' \approx \frac 16 \log_{10}\left(\frac{1}{10\delta_1\delta_2^2}\right)\frac{f_s}{\Delta f}&#xA;$$&#xA;taps, with $f_s$ the sampling rate, $\Delta f$ the transition width, and $\delta_{1,2}$ the passband ripple and the stopband attenuation, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, your use case; I'm guessing from your the graphs from your question from 1 year ago, and also bearing in mind that you'd need incredible numerical accuracy to make use of &gt; 80dB attenuation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align*}&#xA;f_s &amp;amp;= 6.4\cdot10^4\,\text{Hz,}\\&#xA;\Delta f &amp;amp;= 10^{-3}\,\text{Hz,}\\&#xA;\delta_2 &amp;amp;= -90\,\text{dB}\\&#xA;&amp;amp;= 10^{-9}\\&#xA;\delta_1 &amp;amp;= \delta_1\,\text{, everything else being wasteful either on suppression or precision side,}\\\\&#xA;N_e' &amp;amp; \approx \frac 16 \log_{10}\left(\frac{1}{10\cdot10^{-27}}\right)\frac{6.4\cdot10^4}{10^{-3}}\\&#xA;&amp;amp;=\frac16\cdot 26\cdot6.4\cdot10^7\\&#xA;&amp;amp;\approx 2.7 \cdot 10^8\,\text.&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, Bellanger's approximation wasn't meant for such extreme cases, but the order of magnitude alone highlights the impossibility. Of course, you'd implement this as a decimating polyphase FIR, which means that you'd only need to apply&#xA;$$\frac{N_e'}{\frac{f_{s,input}}{f_{s,output}}}=N_e' \frac{f_{s,output}}{f_{s,input}}= N_e'\frac{\frac12}{6.4\cdot10^4}\approx2110$$&#xA;tapped filter every input sample clock, but the filter length puts impossible constraints on your machine accuracy if you're using floating point, and very hard constraints if you're building this in hardware on the bitwidth of your samples. As you notice, it &lt;em&gt;does&lt;/em&gt; make a lot of difference for what we're designing a filter here – Matlab is &lt;strong&gt;not&lt;/strong&gt; hardware :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, you &lt;em&gt;can&lt;/em&gt; split your filter into multiple stages, but that will usually only reduce the computational load by running &quot;parts&quot; of the filter at lower rates, and will not solve the precision/bit width problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we're ditching FIRs here, unless you're willing to reduce the requirements on stopband attenuation or transition width.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr/&gt;&#xA;On to IIRs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's an approximate formula for the order necessary to achieve given specifications, and that is [1, (7.18), p. 184]:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;N_{IIR}\approx 1.076\log_{10}\left(\frac{2}{\sqrt{\delta_1}\delta_2}\right)&#xA;\log_{10}\left(\frac{f_s}{\Delta f}\frac4\pi\sin\left(2\pi\frac{f_1}{f_s}\right)\right)\text,&#xA;$$&#xA;$f_1=f_2-\Delta f$ and $f_2$ being your pass- and stopband edge. Since you're lowest output rate is 0.5 Hz, I'm guessing $f_2=0.5\,\text{Hz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the same specifications as above,&#xA;$$\begin{align*}&#xA;N_{IIR}&amp;amp;\approx 1.076\log_{10}\left(\frac{2}{\sqrt{10^{-9}}10^{-9}}\right)&#xA;\log_{10}\left(\frac{6.4\cdot10^4}{10^-3}\frac4\pi\sin\left(2\pi\frac{4.99\cdot10^{-1}}{6.4\cdot 10^{4}}\right)\right)\\&#xA;&amp;amp;\approx 1.076\log_{10}\left(2\cdot10^{13.5}\right)&#xA;\log_{10}\left(\frac{2.56\cdot10^8}\pi\cdot4.899\cdot10^{-5}\right)\\&#xA;&amp;amp;\approx 1.076\log_{10}\left(2\cdot10^{13.5}\right)&#xA;\log_{10}\left(3992\right)\\&#xA;&amp;amp;\approx 1.076\cdot13.80\cdot3.601\\&#xA;&amp;amp;\approx 53.48&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is but an estimate! Also notice that this is far from a design approach, it just gives us an idea of how complicated the IIR will end up being.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, realistically, let's round up to $N_{IIR}=64$, and then do the classical approach of directly calculation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll consider elliptic filters, which are optimal in the sense that for any given order, and accepting a certain ripple (which is your DC estimate accuracy, here), they have the most narrow transition width [1, p. 183].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, designing these taps isn't a trivial feat; scipy gives me something that roughly looks like that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0gdsW.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0gdsW.png&quot; alt=&quot;taps (absolute values)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the enormous dynamic range of each tap set ($\approx 10^{18}$), and of the overall filter ($\approx10^{65}$). That filter is nothing that reaches its accuracy on a double precision IEEE754 float. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I propose a hybrid approach: take cascaded halfband filters to get down to something like $\frac1{512}$ of the input sample rate, and then apply an elliptic filter.&#xA;&lt;hr/&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0gdsW.png&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt; Bellanger, Maurice: &lt;em&gt;Digital Processing of Signals: theory and practice&lt;/em&gt;, second edition, Wiley 1988. &lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-03-23T14:02:51.480" CommentCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="29662" PostTypeId="1" CreationDate="2016-03-23T15:06:52.380" Score="1" ViewCount="50" Body="&lt;p&gt;This is the scenario: I marked two axes (figure below) on a board and a camera(global vision system) sees the board. I want to make the vision system to recognize $X$ and $Y$ axes and specify coordinates of an object (preferably a colored one )in the form of $(x,y)$. How can I do that? is there any functionality in matlab to help me?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XoDBi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XoDBi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19462" LastEditorUserId="19462" LastEditDate="2016-03-27T07:05:53.573" LastActivityDate="2016-03-27T07:05:53.573" Title="How to specify 2-D coordinates of an object in matlab?" Tags="|image-processing|matlab|video-processing|matlab-cvst|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29663" PostTypeId="1" AcceptedAnswerId="29666" CreationDate="2016-03-23T15:31:27.450" Score="0" ViewCount="286" Body="&lt;p&gt;I'm in my second week of an online DSP class and I'm still kinda lost on some of the concepts of what we are actually doing.  I'm hoping you guys can help clear up my understanding.  Please forgive me if what I'm asking makes no sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm reading about continuous time sampling, which I don't think I fully understand yet, and discrete time sampling.  But I guess to understand those concepts I really need to understand sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think sampling is gathering discrete data points from a continuous time signal?  But how?  How is this &lt;em&gt;physically&lt;/em&gt; done?  What are we using to get the actual data to convert it into a discrete time sample?  Is there a good example I can look at to understand this more?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now the text book just shows math formulas, pictures of graphs of sines with various frequencies and amplitudes, and with dots representing discrete time samples vs continuous time samples - but no application of what is actually happening?  For example, is an instrument making a consistent sound, that is being captured through some microphone and producing the signal, which is then passed through some system that calculates data points?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a continuous time signal just a signal being actively captured and a discrete signal just data points over a certain period of time?  How and when do I apply the mathematics we are learning about (as we haven't needed to really do so yet)?&lt;/p&gt;&#xA;" OwnerUserId="20129" LastEditorUserId="20129" LastEditDate="2016-03-23T15:36:27.713" LastActivityDate="2016-03-23T17:38:46.550" Title="How do we actually obtain samples to form discrete time samples?" Tags="|discrete-signals|sampling|continuous-signals|" AnswerCount="2" CommentCount="2" ClosedDate="2016-03-23T19:19:06.537" ContentLicense="CC BY-SA 3.0" />
  <row Id="29664" PostTypeId="2" ParentId="29663" CreationDate="2016-03-23T16:12:58.340" Score="1" Body="&lt;p&gt;Assume you are speaking, those vibrations (sound) are converted into electrical signals(continuous time signal) by Mike. After that, a &lt;strong&gt;Sample &amp;amp; hold circuit&lt;/strong&gt; is placed, which stores the converted electrical signal inside a capacitor in the form of charge (now u get discrete time signal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every signal is  sampled at some frequency called sampling frequency. Let the sampling frequency in this case be 8KHz. It means, at time t=0, you &lt;strong&gt;sample&lt;/strong&gt; (read) the electrical signal amplitude (by using sample &amp;amp; hold circuit) and &lt;strong&gt;hold&lt;/strong&gt; it(store it) in a capacitor. You wait till some time and when time t=0.00125 seconds(1/8KHz, remember our sampling frequency is 8KHz), you again sample the electrical signal and store it . You repeat this process every 0.00125 seconds. Now you have got discrete version of your continuous time electrical signal (in fact speech signal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the time between every samples(0.00125 seconds), the charge stored in the capacitor is converted to digital binary values using special circuits called ADCs. These converted digital values and discrete signals in binary form(1s and 0s which may be stored or for further processing in a computer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested, read about how sample and hold circuit works. You need some electronics background for that.&lt;/p&gt;&#xA;" OwnerUserId="20067" LastActivityDate="2016-03-23T16:12:58.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29665" PostTypeId="2" ParentId="29659" CreationDate="2016-03-23T17:11:44.250" Score="1" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the definition of the DTFT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega)=\sum_{n=-\infty}^{\infty}h[n]e^{-jn\omega}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;derive the following facts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$H(\omega)=H(\omega+2\pi)$&lt;/li&gt;&#xA;&lt;li&gt;$H(\omega)=H^*(-\omega)$ for real-valued $h[n]$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;where $*$ means complex conjugation. Combine these two results to prove the given equation.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-23T17:11:44.250" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29666" PostTypeId="2" ParentId="29663" CreationDate="2016-03-23T17:38:46.550" Score="1" Body="&lt;p&gt;You can get discrete time samples by taking periodic measurements physically if needed&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance you can walk out to your porch, look at the thermometer on your porch, every day or every hour, and type the temperature that you read into a spreadsheet.  Result: a discrete time series of temperature samples.  You can do the same with a voltmeter, a barometer, a tape measure, etc. depending on the quantity you want to measure periodically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you take measurements too infrequently, at the wrong times, or without enough accuracy, or of a signal changing too quickly, certain types of problems can occur.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-23T17:38:46.550" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29667" PostTypeId="2" ParentId="19057" CreationDate="2016-03-23T17:47:42.297" Score="0" Body="&lt;p&gt;Frequency estimation of a sinusoid (in software) can be done robustly using an autocorrelation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The center peak (lag of 0) will always be a (or &lt;em&gt;the&lt;/em&gt;) maximum value.  For a periodic signal, you'll get additional peaks every &lt;em&gt;n&lt;/em&gt; lags.  This second peak location tells you the period of the signal, in samples.  However, you get no phase information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then construct your own sinusoid of the same frequency, with a known phase reference.  Then compute the cross-correlation function between your original signal and the reference signal.  Now, the first peak value location will tell you the phase difference between the signals.  Where the phase = 2*pi*(lag in samples)/(sinusoid period in samples)&lt;/p&gt;&#xA;" OwnerUserId="20169" LastActivityDate="2016-03-23T17:47:42.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29668" PostTypeId="2" ParentId="29655" CreationDate="2016-03-23T18:39:40.180" Score="3" Body="&lt;p&gt;This answer assumes that some passband flatness is required.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Two-path all-pass half-band IIR&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you can accept the phase distortion, may I recommend the &lt;a href=&quot;http://ldesoras.free.fr/prod.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;HIIR half-band lowpass filter library&lt;/a&gt; by Laurent de Soras. It implements half-band elliptic lowpass filters as a sum of all-pass filters that are 180° out of phase in the stop band. It is a very efficient structure that takes advantage of the symmetry of the frequency response. From the documentation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$\begin{eqnarray}A_0(z)&amp;amp;=&amp;amp;\prod^{\frac{N}{2}}_{k=0}\frac{a_{2k+1}+z^{-2}}{1+a_{2k+1}z^{-2}}\\&#xA;A_1(z)&amp;amp;=&amp;amp;z^{-1}\prod^{\frac{N-1}{2}}_{k=0}\frac{a_{2k}+z^{-2}}{1+a_{2k}z^{-2}}\\&#xA;H(z)&amp;amp;=&amp;amp;\frac{1}{2}\left(A_0(z)+A_1(z)\right)\end{eqnarray}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$A_0$ and $A_1$ are all-pass. This could be used in place of large FIR filters. Laurent doesn't recommend replacing small FIR filters when using single-instruction-multiple-data (SIMD) architecture. (I wonder if unrolling a couple of steps into a state change matrix would help with these IIR filters.) If you don't want to decimate the lowest-frequency band you can dilute the filter by substitution $z\rightarrow z^{N/2}$ for even $N$ to get $1/N$th-band filters. This has the advantage that the filter can be run in parallel in $N$ independent branches of execution with each branch calculating every $N$th output. I don't know if the library supports that other than by coefficient calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HIIR is released under the most permissive Do What the Fuck You Want to Public License.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a performance comparison of a linear-phase half-band FIR and a minimum-phase IIR filter like this designed to replace the FIR used in &lt;a href=&quot;https://en.wikipedia.org/wiki/Channelization_(telecommunications)&quot; rel=&quot;nofollow noreferrer&quot;&gt;channelization&lt;/a&gt; in a communications satellite, taken from a conference article Adem Coskun, Izzet Kale, Richard C. Morling, Robert Hughes, Stephen Brown, and Piero Angeletti. &lt;strong&gt;&quot;Halfband IIR Filter Alternatives for On-Board Digital Channelisation&quot;&lt;/strong&gt;. &lt;em&gt;31st AIAA International Communications Satellite Systems Conference, International Communications Satellite Systems Conferences (ICSSC), (AIAA 2013-5711).&lt;/em&gt; DOI: &lt;a href=&quot;http://arc.aiaa.org/doi/abs/10.2514/6.2013-5711&quot; rel=&quot;nofollow noreferrer&quot;&gt;10.2514/6.2013-5711&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    RAM use     Combinational Logic &#xA;    Power (mW)  Power (mW)  Area     Total Power (mW) &#xA;FIR 19.44       8.35        17266    27.79&#xA;IIR 9.33        2.64        5462     11.97&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately they did not give the filter specification.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt; FIR vs. IIR &lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The discrete FIR transfer function is a polynomial in $z$ while the IIR transfer function is a rational function in $z$. Rational functions can better approximate functions with sharp corners. As an important example, the maximum absolute error of degree $N$ approximation of $|x|$ centered around $x=0$ by a polynomial approximation decays by $1/N$ and by a rational approximation by $\exp(-c\sqrt{N})$ with a constant $c$ (see &lt;a href=&quot;http://projecteuclid.org/euclid.mmj/1028999029&quot; rel=&quot;nofollow noreferrer&quot;&gt;Newman 1964&lt;/a&gt;), here plotted with $c=1$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AHVc3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AHVc3.png&quot; alt=&quot;Approximation error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't say much about low-order filters but kind of implies that IIR wins over FIR for large enough filters if complexity is measured by filter order. The desired magnitude frequency response has corners similar to $|x|$ if it is defined by a passband and a stopband separated by a transition band. So the above graph would probably not change much if it compared FIR and IIR. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;CIC–FIR-cascade&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;A serially connected CIC filter that implements a cascade of $M$ moving average filters of length $N$ has approximately a degree $M-1$ B-spline impulse response. This can be cascaded with a low-tap-count FIR prefilter that has a tap only at every $N$th multiple of the sampling period. I call it a prefilter because they are used as such in the context of piecewise approximation from uniform samples of a function, to reduce approximation error. Compared to a B-spline frequency response, the prefilter improves passband behavior at the cost of increased sidelobe level. For example for $M = 2$ one possible prefilter is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[k] = -\frac{1}{16}x[k-N] + \frac{9}{8}x[k] - \frac{1}{16} x[k+N],$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;derived &lt;a href=&quot;https://dsp.stackexchange.com/questions/28814/methods-of-computing-fixed-point-atan2-on-fpga/28873#28873&quot;&gt;here&lt;/a&gt;. I find it difficult to say what meaning its optimality properties have in the CIC–FIR context. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cPJsg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cPJsg.png&quot; alt=&quot;CIC–FIR cascade impulse response&quot;&gt;&lt;/a&gt;&#xA;&lt;em&gt;Figure 1. Impulse response of the full CIC–FIR cascade with the horizontal axis expressed as a multiple of $N$.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the limit of large $N$, the shape of the frequency response of $M$ cascaded identical running average filters is the same as the frequency response of the degree $M-1$ B-spline: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left(\frac{2\sin\left(\frac{\omega}{2}\right)}{\omega}\right)^M.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5HITb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5HITb.png&quot; alt=&quot;CIC–FIR cascade frequency response&quot;&gt;&lt;/a&gt;&#xA;&lt;em&gt;Figure 2. The asymptotic (as $N\rightarrow\infty$) frequency response of the CIC–FIR cascade for $M=2$ (red), with frequency expressed as a multiple of $1/N$, compared to different B-spline frequency responses (grey).&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can decide for what $M$ the frequency response is satisfactory. By increasing $M$ and by a suitable FIR prefilter similar to what I show above you can get arbitrarily close to a brickwall lowpass filter. So with a large enough $M$ you can definitely get sufficient quality.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-03-24T14:06:37.480" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29669" PostTypeId="2" ParentId="29660" CreationDate="2016-03-23T21:19:14.763" Score="1" Body="&lt;p&gt;&lt;strong&gt;HINT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2\cos(x)\cos(y)=\cos(x+y)+\cos(x-y)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $x=(n-1)\omega$ and $y=\omega$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-23T21:19:14.763" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29670" PostTypeId="1" CreationDate="2016-03-23T23:29:55.450" Score="1" ViewCount="779" Body="&lt;p&gt;Q1) I have understood that linear-phase filters have more delay time whereas minimum phase filters implement a lesser delay time but introduce phase distortion artifacts which linear-phase filters avoid. For which applications in real-time DSP is minimum phase more useful than linear phase.&lt;/p&gt;&#xA;" OwnerUserId="19352" LastActivityDate="2016-03-26T23:01:53.483" Title="When do you use a minimum-phase filter over a linear-phase filter" Tags="|finite-impulse-response|delay|linear-phase|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29671" PostTypeId="1" CreationDate="2016-03-24T01:08:43.127" Score="0" ViewCount="350" Body="&lt;p&gt;I have a signal of the form $s(t)=A(t) \sum \cos(\omega_i(t)t +\phi_0) + n(t)$, where $n$ is gaussian noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can only read the &lt;em&gt;signal+noise&lt;/em&gt; and thus can not separate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to phase shift the signal to $A(t) \sum\cos(\omega_i(t)t)+n'(t)$ and I am at a loss on how to do this. During lectures / courses I've always done phase shifts simply by multiplying with $e^{i\phi_0}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My signal is of the form $s(t)=A(t) \sum \cos(\omega_i(t)t +\phi_0) + n(t)$, as opposed to $s(t)=A(t) \sum e^{\omega_i(t)t +\phi_0} + n(t)$, so I can not simply multiply with $e^{i\phi_0}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to do this? I'm asking because I am interested in cross-correlating two signals.&lt;/p&gt;&#xA;" OwnerUserId="20194" LastEditorUserId="8202" LastEditDate="2016-03-24T07:35:48.500" LastActivityDate="2016-03-24T08:40:38.303" Title="Phase shifting a noisy signal" Tags="|signal-analysis|phase|correlation|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29672" PostTypeId="2" ParentId="29671" CreationDate="2016-03-24T02:07:14.917" Score="1" Body="&lt;p&gt;Your question is a bit confusing, so take this as just a possible step to the solution you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $s(t)=\cos(2\pi f_0t+\phi_0)$, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s(t)\cos(4\pi f_0t+\phi_0) =\frac12 \left( \cos(2\pi f_0t) + \cos(6\pi f_0t+2\phi_0 \right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get rid of the high-frequency cosine with a low-pass filter. If the signal is a sum of sinusoids, and you know their frequencies, then you can use band-pass filters to isolate each sinusoid, shift each one individually using the idea above, and then add them all again. However, this process is likely to increase the noise power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your particular case is further complicated by the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You seem to have an undefined envelope $A(t)$. You need to be careful and define it precisely, because it will have an effect on the spectrum of $s(t)$. Recall that in suppressed-carrier modulation, the carriers are not even present in the signal anymore, so it will be impossible to shift them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Your cosines seem to be angle-modulated (their instantaneous frequency is time-varying). I think in this case all bets are off: angle-modulated signals in general have infinite bandwidth and you won't be able to decompose the signal into individual sinusoids.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-03-24T02:07:14.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29673" PostTypeId="2" ParentId="29671" CreationDate="2016-03-24T03:13:33.640" Score="3" Body="&lt;p&gt;With a real cosine a phase shift is equivalent to a time delay.  If you delay the signal by $\phi_0$ then you will get the result you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of samples that you will need to delay by will likely not be an integer number.  You can delay by a non-integer number of samples via a &lt;a href=&quot;https://dsp.stackexchange.com/questions/9349/how-to-pick-coefficients-for-fractional-delay-filters&quot;&gt;fractional delay filter&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-03-24T03:13:33.640" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29676" PostTypeId="2" ParentId="29593" CreationDate="2016-03-24T08:06:48.893" Score="1" Body="&lt;p&gt;Thank &lt;a href=&quot;https://dsp.stackexchange.com/users/4346/robert-bristow-johnson&quot;&gt;robert bristow-johnson&lt;/a&gt; for the right question.&#xA;In my case signal coefficient shows a some level of similarity between noise-like signals because of appreciable mean values. That is as you compare two electrical noises with some direct voltage: of course they are as more similar as high equal direct voltage they have.&#xA;Since I need to compare specifically shapes, I should use Pearson method only (which &quot;normalizes&quot; data itself in terms of mean values).&lt;/p&gt;&#xA;" OwnerUserId="20137" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-03-24T08:06:48.893" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29677" PostTypeId="2" ParentId="29671" CreationDate="2016-03-24T08:40:38.303" Score="0" Body="&lt;p&gt;Couldn't you just rewrite your signal via $\cos{x} = \frac{1}{2}(e^{ix}+e^{-ix})$ and apply your phase shifting by multiplying $e^{i\phi_0}$ then?&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-03-24T08:40:38.303" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29678" PostTypeId="2" ParentId="29604" CreationDate="2016-03-24T11:19:42.873" Score="0" Body="&lt;p&gt;Audio Fingerprinting can be used to match near identical recordings of sounds with a bit of additive noise. It will not work for similar sounds, cover versions etc.&lt;/p&gt;&#xA;&lt;p&gt;Without knowing your application, I'd recommend giving Dan Ellis' audio fingerprinting code a try. You'll find the MATLAB and Python versions here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;s&gt;http://labrosa.ee.columbia.edu/matlab/audfprint/&lt;/s&gt;&lt;br /&gt;&#xA;&lt;a href=&quot;https://www.ee.columbia.edu/%7Edpwe/resources/matlab/audfprint/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ee.columbia.edu/~dpwe/resources/matlab/audfprint/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5105" LastEditorUserId="7092" LastEditDate="2024-02-28T11:27:04.337" LastActivityDate="2024-02-28T11:27:04.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29679" PostTypeId="1" CreationDate="2016-03-24T11:57:27.277" Score="3" ViewCount="714" Body="&lt;p&gt;For example, I want to feed a DC into a low pass filter. The the filter's first several output will not have the same DC value I want. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Does it mean that I need to dispose first several results? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How many shall I dispose? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the technical term describing this phenomenon, step response? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does it only happen to DC or to other frequency signals as well?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here comes sample code and diagram:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 64e3;&#xA;f = 8e3;&#xA;T = 1/Fs;&#xA;t = 0:T:0.002;&#xA;input = 0.002*cos(2*pi*f*t);&#xA;input_with_DC = input+0.5;&#xA;&#xA;[b,a]=cheby1(1,2,0.4);&#xA;output = filter(b,a,input_with_DC);&#xA;&#xA;plot(input_with_DC)&#xA;hold&#xA;plot(output,'r')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tFCB2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tFCB2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be seen from above diagram that the DC rises at first and then approach to the actual DC value.&lt;/p&gt;&#xA;" OwnerUserId="10200" LastActivityDate="2016-03-25T11:54:34.027" Title="When input data into a low pass filter, are the first several data unusable?" Tags="|lowpass-filter|infinite-impulse-response|step-response|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29680" PostTypeId="1" CreationDate="2016-03-24T12:00:36.263" Score="3" ViewCount="196" Body="&lt;p&gt;I need to model the &lt;a href=&quot;https://en.wikipedia.org/wiki/Minimum_mean_square_error&quot; rel=&quot;nofollow&quot;&gt;minimum mean square error&lt;/a&gt; (MMSE) performance in estimating channel frequency response. I have channel's &lt;a href=&quot;https://en.wikipedia.org/wiki/Power_delay_profile&quot; rel=&quot;nofollow&quot;&gt;power delay profile&lt;/a&gt; (PDP) as a table with tap delays and powers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The channel frequency response (FR) is computed in frequency domain via&#xA;$$H(f) = \sum_i a_i \exp\left(j2\pi\tau_i f\right),$$ &#xA;where $\tau_i$ are delays from the PDP and $a_i$ are independent complex gaussian variables with variances $\sigma^2_i$, taken from the same PDP.&#xA;MMSE is given by&#xA;$$\hat{H}_{MMSE} = R_{HH}\left(R_{HH}+\frac{\beta}{SNR}I\right)^{-1}\hat{H}_{LS}.$$&#xA;To compute covariance matrix $R_{HH}$ I compute a vector with components&#xA;$$r_k = \sum_i \sigma_i^2 \exp\left(j2\pi\tau_i f\right)$$&#xA;and construct a Toeplitz matrix with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To model MSE I compute an $H(f)$ realization, add AWGN and apply an MSSE. In this case $\beta=1$ since transmitted signal is all 1's. The process is repeated N times and MSE is averaged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is the estimation error is so big that it beats simple LS estimate only on very low SNR and then comes to an error floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If instead I compute $R_{HH}$ as $HH^*$, i.e. as an ideal momentary statistic, everything works fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some additional notes. Numerical computation of $R_{HH}$ via lots of channel realizations yields the same result as using the construction with $r_k$, so it's correct and consistent. If the overall concept is fine then the mistake should be in the code. I will post MWE if needed.&lt;/p&gt;&#xA;" OwnerUserId="20204" LastEditorUserId="80" LastEditDate="2016-03-24T20:04:47.133" LastActivityDate="2016-03-24T20:04:47.133" Title="Problem using MMSE estimation of channel frequency response" Tags="|estimation|ofdm|multipath|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29682" PostTypeId="1" CreationDate="2016-03-24T21:34:46.487" Score="0" ViewCount="275" Body="&lt;p&gt;For a bandlimited signal $x(t)$ that is reconstructed after Nyquist-sampling at intervals $T$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t) = \sum_{k=-\infty}^{\infty} {x[k]\textrm{sinc}\left(\frac{t-kT}{T}\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x[k]$ = $x(kT)$. For a non-band limited signal $x(t)$, the reconstructed signal will not be same as $x(t)$. Let me call that $p(t)$. Writing the same formula again, so &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p(t) = \sum_{k=-\infty}^{\infty} {x[k]\textrm{ sinc}\left(\frac{t-kT}{T}\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to see if there is an alternate way of expressing $p(t)$ in terms of $x(t)$ WITHOUT INVOLVING AN INFINITE SUM. It need not be simpler looking, but just wondering if there are other ways of expressing it.&lt;/p&gt;&#xA;" OwnerUserId="20214" LastEditorUserId="11256" LastEditDate="2016-03-25T13:46:41.500" LastActivityDate="2016-03-25T13:46:41.500" Title="Closed-form expression for Whittaker-Shannon interpolation for non-bandlimited signals" Tags="|sampling|interpolation|" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29683" PostTypeId="1" AcceptedAnswerId="29687" CreationDate="2016-03-24T22:11:02.943" Score="6" ViewCount="1169" Body="&lt;p&gt;I have two different impulse response each with different length, is it possible that they have the same frequency response?&lt;/p&gt;&#xA;" OwnerUserId="20215" LastActivityDate="2021-10-24T04:54:00.403" Title="Can two different impulse responses give the same frequency response?" Tags="|filter-design|frequency-response|impulse-response|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29684" PostTypeId="1" CreationDate="2016-03-24T22:21:15.990" Score="1" ViewCount="261" Body="&lt;p&gt;I recently read that for polynomials of degree 5 or more, when executed with the roots() command on MATLAB produces an error. The documentation said as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ZAhre.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZAhre.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7bdA4.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7bdA4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a substitute, using the deconv() in-built function was recommended. How do we find accurate roots to a polynomial using deconv()? I can't seem to figure it out&lt;/p&gt;&#xA;" OwnerUserId="19352" LastActivityDate="2016-03-24T22:21:15.990" Title="How to use deconv() instead of roots() on MATLAB to find roots to a polynomial" Tags="|matlab|transfer-function|deconvolution|poles-zeros|" AnswerCount="0" CommentCount="1" ClosedDate="2016-03-25T11:31:31.443" ContentLicense="CC BY-SA 3.0" />
  <row Id="29685" PostTypeId="2" ParentId="29683" CreationDate="2016-03-24T22:23:02.943" Score="9" Body="&lt;p&gt;No. The impulse response and frequency response of an LTI system are related by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform&quot;&gt;Fourier transform&lt;/a&gt;, which is one-to-one.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2016-03-24T22:23:02.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29686" PostTypeId="2" ParentId="29682" CreationDate="2016-03-24T23:00:05.223" Score="1" Body="&lt;p&gt;It seems to me that the only way is to cheat and hide the sum behind a variable. For example, say that $X_T(f)$ is the Fourier transform of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x_T(t) = T \sum_{n=-\infty}^\infty x(nT)\delta(t-nT).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; X_T(f) &amp;amp;= \mathcal F \lbrace x_T(t) \rbrace \\&#xA; &amp;amp;= \sum_{k=-\infty}^\infty X\left(f - \frac{k}{T}\right) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $ X(f) = \mathcal F \lbrace x(t) \rbrace .$ Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p(t)=\mathcal F^{-1} \lbrace H(f)X_T(f) \rbrace$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H(f)$ is a brick-wall low-pass filter with cutoff frequency $f_c=1/(2T)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(f) = \begin{cases}&#xA;1 \quad \text{for }|f|&amp;lt;f_c \\&#xA;0 \quad \text{for }|f|&amp;gt;f_c \\&#xA;\end{cases} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $\mathcal F^{-1}$ represents the inverse Fourier transform. This is cheating, though, since in general $X_T(f)$ involves an infinite sum.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-03-25T02:04:58.070" LastActivityDate="2016-03-25T02:04:58.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29687" PostTypeId="2" ParentId="29683" CreationDate="2016-03-25T00:01:09.133" Score="5" Body="&lt;p&gt;Let me play with fire, since I agree with @Jason R answer.&lt;/p&gt;&#xA;&lt;p&gt;Some consider, loosely, that the frequency response is magnitude only (which is not correct, as a frequency response should have a  phase as well). Then, impulse responses with different supports (shown below), and  related through the Hilbert tranform, may exhibit the same absolute &amp;quot;frequency response&amp;quot;. I like the way it shows that the same amplitude spectrum might be shared with quite different functions, one piece-wise constant, the other with singularities.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s2V3e.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s2V3e.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2021-10-24T04:54:00.403" LastActivityDate="2021-10-24T04:54:00.403" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29688" PostTypeId="2" ParentId="29683" CreationDate="2016-03-25T00:01:10.603" Score="1" Body="&lt;p&gt;Questions a little vague.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well certainly not of different length, but if one impulse is a permutation of the other (if the coefficients are shuffled), if it possible for them to have the same &lt;strong&gt;magnitude&lt;/strong&gt; response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectral Factorization works primarily on this principle. In the z-domain, the zeros on the pole-zero plot that are outside the unit are reflected inside about the unit circle and vice-versa. As an example written by Prof. Ivan Selesnick:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hwJdx.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hwJdx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extra help: If you are confused about how the frequency response can be directly plotted from the z-domain diagram, click &lt;a href=&quot;https://www.youtube.com/watch?v=8jNjVkoZQCU&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; to see an explanation by Barry Van Veen&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: If the two impulse vary in length only in terms of zero padding, then the frequency response does not change&lt;/p&gt;&#xA;" OwnerUserId="19352" LastEditorUserId="4346" LastEditDate="2016-03-25T00:33:36.260" LastActivityDate="2016-03-25T00:33:36.260" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29689" PostTypeId="2" ParentId="29683" CreationDate="2016-03-25T06:43:05.800" Score="0" Body="&lt;p&gt;If you mean the magnitude frequency response, then yes it is possible, as shown in other answers. Another way to demonstrate this is by all-pass filters, which have a gain of 1 at all frequencies and a non-zero phase. If you make a cascade of a given filter and an all-pass filter, you get a composite filter the impulse response of which is a convolution of the two filters' impulse responses. Its phase frequency response will be different than the original filter's. A very simple all-pass filter is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[k] = x[k-1],$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a one-sample delay.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-03-25T06:43:05.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29690" PostTypeId="2" ParentId="2152" CreationDate="2016-03-25T06:44:34.107" Score="1" Body="&lt;p&gt;You may try this paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://www.ericsson.com/res/thecompany/docs/journal_conference_papers/atsp/typical_urban_channel_model.pdf&quot; rel=&quot;nofollow&quot;&gt;Asplund H., et al - How typical is the &quot;Typical Urban&quot; channel&#xA;  model? - Mobile-based Delay Spread and Orthogonality Measurements&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;to see an actual measurments result, though it's quite old and discusses &quot;Typical Urban&quot; model that aren't used now. I don't know any other results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in fact all these models should be used as a reference for lab testing and initial decision making. When designing a real system it should be taken to the fields and tested in actual environments, which are quite various.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering your estimation question. You are concerned with measuring channel power delay profile (PDP), i.e. it's fadings and delays. It is one way of estimating a multipath channel, one of many. Other approaches include frequency-domain estimation, like polynomial fitting or various time-domain estimations. If you are interested in concrete methods, there is a great survey on this topic.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://pdfs.semanticscholar.org/3d1f/93d7bfeb3e8cb91b3ccc702b07f1654fa7e3.pdf&quot; rel=&quot;nofollow&quot;&gt;Ozdemir M. K., et al - Channel Estimation for Wireless OFDM&#xA;  Systems&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="20204" LastEditorUserId="8202" LastEditDate="2016-03-25T08:35:03.683" LastActivityDate="2016-03-25T08:35:03.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29691" PostTypeId="2" ParentId="29679" CreationDate="2016-03-25T09:55:07.583" Score="2" Body="&lt;p&gt;You have to judge yourself if for your purposes you need to get rid of the first few output values. The phenomenon you observe is determined by two factors. The first is the delay of the filter (which is usually frequency dependent). This delay is a consequence of the causality of the filter. For a linear phase FIR filter that delay is independent of frequency and equals $(N-1)/2$ samples, where $N$ is the filter length (as pointed out in a comment by MBaz). The other factor lies in the nature of low pass filters and has nothing to do with a non-ideal (causal) implementation. It is the non-zero rise time that any low pass filter exhibits, even an ideal (non-causal) brick-wall filter. The rise time is proportional to the inverse of the cut-off frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For minimum-phase filters with a very low order (as in your example), the first factor plays only a small role, so the delay you observe is mainly caused by the non-zero rise time of the low pass filter. If you decrease the cut-off frequency you will observe an increase in rise time and vice versa. Note that the input signal that your filter sees is actually a jump from zero (no input signal) to a DC value (plus some small signal), so you pretty much see the system's step response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general the response to a change in the input signal is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Transient_response&quot; rel=&quot;nofollow&quot;&gt;transient response&lt;/a&gt;, and it is not restricted to a change in DC value.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-03-25T11:54:34.027" LastActivityDate="2016-03-25T11:54:34.027" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29692" PostTypeId="1" AcceptedAnswerId="29947" CreationDate="2016-03-25T11:16:49.883" Score="1" ViewCount="567" Body="&lt;p&gt;I am trying to calculate the SCC of a cyclostationary signal. I have estimated the Spectral Correlation Function (scf) of the signal using FFT Accumulation Method (FAM). I implemented the following pseudocode in matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function [Sx, alphao, f] = scf(x, fs, d_f, d_alpha)&#xA;    Compute N' = pow2(nextpow2(fs/df))&#xA;            L = N'/4&#xA;            P=pow2(nextpow2(fs/dalpha/L));&#xA;    N = P*L;    %total no of datat points to process&#xA;    x = x(1:N)&#xA;    Divide x into chunks of length N' with L overlapping points&#xA;    Apply Hamming window across each chunk&#xA;    Perform FFT&#xA;    Perform the downshift to baseband&#xA;    Multiply the baseband with it's complex conjugate&#xA;    Execute smoothing by means of P-points FFT.&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;fs&lt;/code&gt; is sampling frequency, &lt;code&gt;d_f&lt;/code&gt; is frequency resolution and &lt;code&gt;d_alpha&lt;/code&gt; is cyclic frequency resolution&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have three matrices : $S_x^\alpha$, which is the SCF, $alphao$, which is a 1D vector the cyclic frequencies and $f$, which is a 1D vector the spectral frequencies. I need to calculate the Spectral Coherence Coefficient which is given by the following equation:&#xA;$C_x^\alpha(f) = \frac{S_x^\alpha(f)}{\sqrt{S_x^0(f-\alpha/2)S_x^0(f+\alpha/2)}} \forall f$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If I put $S_x^0(f-\alpha/2)$ in the denominator then won't the denominator essentially becomes $S_x^0(f)$ since $\alpha = 0$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Will $C_x^\alpha$ be of the same size as $S^\alpha_x$?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="20218" LastEditorUserId="23777" LastEditDate="2018-07-07T16:13:44.813" LastActivityDate="2018-07-07T16:13:44.813" Title="Calculating spectral coherence coefficient (scc) - implementation help" Tags="|matlab|frequency-spectrum|coherence|cyclostationary-random-process|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29693" PostTypeId="2" ParentId="29683" CreationDate="2016-03-25T13:02:44.587" Score="6" Body="&lt;p&gt;To add on to what has been said, what you're asking is, if you have $h_1$ and $h_2$ as impulse responses of a LTI systems (continuous-time or discrete time) and $H_1$, $H_2$ their respective frequency responses, is it possible that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_1\neq h_2 \overset{?}\implies H_1=H_2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier Transform is &lt;a href=&quot;https://en.wikipedia.org/wiki/Injective_function&quot; rel=&quot;noreferrer&quot;&gt;injective&lt;/a&gt;, that is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal F\left\{h_1\right\}=\mathcal F\left\{h_2\right\}\Longrightarrow h_1 = h_2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\equiv h_1\neq h_2\Longrightarrow  F\left\{h_1\right\}\neq\mathcal F\left\{h_2\right\}$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the discrete case, the injectivity holds as it is. &lt;/li&gt;&#xA;&lt;li&gt;In the continuous case however, it is possible to have $h_1\neq h_2$ at jump discontinuities and isolated points and have $\mathcal F\left\{h_1\right\}=\mathcal F\left\{h_2\right\}$. [1]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;[1] D. Cohen, &lt;em&gt;Performance Analysis of Standard Fourier-Transform Spectrometers&lt;/em&gt;, p 124.&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-03-25T13:08:28.940" LastActivityDate="2016-03-25T13:08:28.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29694" PostTypeId="2" ParentId="29655" CreationDate="2016-03-25T14:05:42.480" Score="0" Body="&lt;p&gt;So, in your comments to my &lt;a href=&quot;https://dsp.stackexchange.com/a/29661/13320&quot;&gt;previous answer&lt;/a&gt; you added a different specification; summing it up here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I assume that you'll take the cutoff frequency you specify as the sample rate coming out of your decimating filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we first need to think about attenuation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with -40dB you probably meant that &quot;the total power of all the noise that gets aliased back into my passband should be attenuated by 40 dB&quot;. Now, let's act if that noise had a constant PSD, so in every frequency band there was an equal amount of noise. We're decimating by $d$ to a bandwidth $f_2$. That means that there are $d-1\approx d$ noise-containing bandwidths, each $f_2$ wide, that get aliased onto your passband. Hence, your stopband attenuation should be $d\left[\text{dB}\right]+ 40\text{ dB}$.&lt;/p&gt;&#xA;&#xA;&lt;hr/&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$&#xA;\begin{align*}&#xA;f_s &amp;amp;= 6.4 \cdot 10^4 \text{ Hz}\\[1.2em]&#xA;f_1 &amp;amp;= 5 \cdot 10^{-2} \text{ Hz}\\&#xA;f_2 &amp;amp;= 1 \text{ Hz}\\[1.2em]&#xA;\Delta f &amp;amp;= f_2 - f_1\\&#xA;&amp;amp;= 9.5 \cdot 10^{-1} \text{ Hz}\\[1.2em]&#xA;d &amp;amp;= \frac{f_s}{f_2}\\&#xA; &amp;amp;= 6.4\cdot10^4\\[1.2em]&#xA;\delta_1 &amp;amp;= -40\text{ dB}\\&#xA;&amp;amp;= 10^{-4}\\&#xA;\delta_2 &amp;amp;= \delta_1\cdot d\\&#xA;&amp;amp;= 10^{-4}\cdot \frac{1}{6.4\cdot10^4}\\&#xA;&amp;amp;= 1.563\cdot 10^-9\\&#xA;&amp;amp;\approx -88dB\\[1.2em]&#xA;\frac{f_s}{\Delta f} &amp;amp;=\frac{6.4}{9.5}\,10^5\\&#xA;&amp;amp;\approx 6.737\cdot 10^4&#xA;\end{align*}&#xA;$$&#xA;  Working on an ARM-Cortex M4F&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Notice that this kind of interpreting your attenuation requirements makes the attenuation even stronger than before.&lt;/p&gt;&#xA;&#xA;&lt;hr/&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;FIR&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Minimal phase equiripple filter &#xA;$$&#xA;\begin{align*}&#xA;N_e' &amp;amp;\approx \frac 16 \log_{10}\left(\frac{1}{10\delta_1\delta_2^2}\right)\frac{f_s}{\Delta f}\\&#xA;&amp;amp;\approx \frac 16 \log_{10}\left(\frac{1}{10\cdot10^{-4}(1.563\cdot10^{-9})^2}\right)\cdot6.737\cdot10^4\\&#xA;&amp;amp;\approx \frac 16 \log_{10}\left(\frac{1}{2.441\cdot10^{-21}}\right)\cdot6.737\cdot10^4\\&#xA;&amp;amp;\approx \frac 16 20.61 \cdot6.737\cdot10^4\\&#xA;&amp;amp;\approx 2.314\cdot10^8&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, no, not much luck reducing the filter length by increasing transition width whilst also increasing attenuation demands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering a polyphase implementation, where only $\frac 1d$ coefficients would be used per input sample, $d$ being the decimation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;N_{e,PP}' &amp;amp;= \frac{N_e'}{d}\\&#xA;&amp;amp;\approx 3617&#xA;\end{align*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3617 Floating-Point Multiply-Accumulates at the sampling rate, which happens to be $\frac1d\text{ Hz}$ means your CPU would need to do 231.4 MFlop/s (a floating point operation being an Multiplication and Accumulation combined); that's certainly in the possible range for Desktop CPUs, but definitely impossible with the Cortex M4 – you'd have to store all the coefficients (minimal phase FIR isn't symmetrical¹), and at a 32bit floating point precision, that'll be more than 882 MB of coefficient storage; your device probably won't have more than 256kB of space for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;&lt;strong&gt;IIR&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in my last answer I used $\frac {f_1}{f_s}$ with $f_1 =4.99\text{ Hz}$; this time $f_1 = 0.05$. In this situation, Bellanger's approximation formula must fall flat.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, let's just take the same 64 coefficient IIR, as the FIR hasn't changed length that much. And Olli's excellent answer shows that we can most likely link FIR and IIR length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the takeaway was that you'd need to be extremely clever to implement the IIR with 64bit floats; the Cortex-M4 only has hardware support for 32bit, as far as I know; that's making things a lot more complicated. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Recommendation: Cascade $\frac12$-band (Nyquist) FIRs with an IIR.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, with a microcontroller as target, there's no tricks such as multiplexing high-rate multiplier hardware units as in FPGAs; there's one FPU, and only a little RAM, so you'll have to write your filter with these constraints in mind:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A halfband Nyquist-M  filter has only half of its taps + 1 $\ne 0$, and it can be designed symmetrical, so that you'd only need roughly one quarter of the taps of a &quot;normal&quot; FIR. Since RAM and fast ROM are really sparse on Cortex-M processors, that is something that you'll have to exploit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know which actual microcontroller you use, but chances are that whoever took ARM's Cortex-M4F core and used it in his silicone didn't add a memory cache controller to its RAM interface (a Cortex-M4 is a microcontroller, after all), so we can't optimize towards &quot;cacheability&quot;, but would still much rather work on blocks of samples than on individual samples, reducing the control flow overhead (grossly oversimplifying: &quot;do the same operation on the next 256 values, then do this operation on the resulting 128 values&quot; is less CPU-intense than &quot;multiply this value with a, that value with b, add that up and save it in the first output value; go back to beginning (do that 128 times)&quot;), you'd instruct your ADC/DMA controller to give you as many consecutive samples as possible in a fixed region of RAM before triggering a CPU interrupt to process these. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;¹ by the way, often you'd go for &quot;the best FIR I can do with this architecture&quot; on a general purpose, e.g. PC, CPU. In that case, a good rule of thumb is to go for a linear phase filter with a little less than twice as many coefficients as fit into a CPU cache line. Linear filters are symmetrical, so you can fit your whole filter into CPU cache at once, and fetching a value from RAM rather than cache typically takes $approx 100$ times the amount of time you'd spent calculating one multiply-accumulate (at least for naively programmed x86s; using hand-optimized SIMD, e.g. SSE4, you can typically increase multiplication speed, also).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that, if you're using the ADC of your microcontroller, many manufacturers have an averaging filter built into the ADC controller to allow for sample-rate reduction before the samples even reach RAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the same halfband decimator sequentially first on the input rate, then on the saved half-input-rate samples, and then on the saved quarter-input-rate samples will make for a relatively efficient $2^n$ decimator, but your $n$ will be very limited by RAM (luckily, you can re-use the input sample storage space of your last stage as output of your current) and by the fact that for your 64,000 decimation, you'd need $n=15$ stages; you'd need to start pipelining things a lot so that you don't have to process the full 64,000 samples input buffer at once (which you probably won't be done with before the next bunch of samples comes in and overwrites your input...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, again, combine halfband FIRs with a good IIR, and come up with a clever scheduling scheme so that your data marshalling doesn't interfere with your algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Allow me one general note: When going for a decimation of 64,000, the best approach might really be an analog one; there's awesome analog filter architectures and ready-made ICs; for example, Maxim sells switched capacitance elliptic filters, which you'd have to chain with a simple one- or two-stage RC filter before connecting it to your ADC's input, and you could then really run at much lower sampling rates/ignore a lot of samples; these ICs can be configured for really low cutoff frequencies!&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-03-25T14:56:18.040" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29695" PostTypeId="2" ParentId="26996" CreationDate="2016-03-25T14:59:41.370" Score="3" Body="&lt;p&gt;In simple words, convexity defect is a cavity in an object (blob, contour) segmented out from an image. That means an area that do not belong to the object but located inside of its outer boundary -convex hull (read documentation of cv::convexHull function for details).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image below shows it better than million of words. Areas between fingers (all marked with arrows) in this schematics of a hand contour are the convexity defects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EBlnT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EBlnT.png&quot; alt=&quot;Convexity defects example&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the defects using OpenCV's function &lt;a href=&quot;http://docs.opencv.org/2.4/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=convexhull#convexitydefects&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;cv::convexityDefects&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="20225" LastActivityDate="2016-03-25T14:59:41.370" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29697" PostTypeId="1" CreationDate="2016-03-25T16:30:03.910" Score="2" ViewCount="120" Body="&lt;p&gt;I'm wondering if there's a simple way to decode this pulse signal as I'm reading it in. I'm thinking the simplest way to decode this is if i can shift the whole signal down so that it's centered around 0. Then if my pulse goes above 0, I know it's a 1 and it'f it's below zero, i know it's a zero. Figures below to see what i'm trying to do. Please note that my sampling frequnecy $Fs = 8Hz$, my pulse width is between 1-2 seconds, and come in pairs of 2. these pairs are spaced about 20 seconds apart. There is also a 3 pulse header which denotes the start of the message, with the first pulse being wider than the other pulses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/avrlv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/avrlv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/diGe6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/diGe6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if I know the peak value of the pulses, then this is obviously just taking my signal and subtracting half of the peak, $d(t) = r(t) - peak/2$. The problem is this peak amplitude is going to vary, as is the noise level. If i try to just subtract a running average, then the noise part of my signal will be centered around 0 as well, which then my decision won't be a simple above/below zero decision. I've plotted subtracting the mean in figure 3 below. My signal is $d(t) = r(t) - runAvg(past 4 samples)$&lt;a href=&quot;https://i.stack.imgur.com/qc9Ry.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qc9Ry.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like there should be an easy way to filter this, either in the time or frequency domain, I'm just not thinking of it. Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastEditorUserId="16913" LastEditDate="2016-03-25T18:03:21.797" LastActivityDate="2016-03-25T19:42:29.947" Title="How can I shift this signal to it's midpoint in order to decode it" Tags="|filters|digital-communications|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29698" PostTypeId="1" AcceptedAnswerId="29705" CreationDate="2016-03-25T17:18:59.743" Score="2" ViewCount="535" Body="&lt;p&gt;I have a question regarding basic signal processing, which I have to start using since I have started studying fault isolation. The thing is, I have three computed signals, which are gathered in the matrix $\mathbf X \in \Re^{p \times n}$, where $p$ is the signal length and $n=3$ is the number of signals. The three signals should emulate some real measurements in &lt;strong&gt;different&lt;/strong&gt; sensors, for instance, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf x_i = A_i \sin(\omega t), \quad \text{with } A_1 \neq A_2 \neq A_3.$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I want to add some white Gaussian noise to these signals, but then I started thinking; how can I do this somewhat &quot;realistically&quot; when the three signals have different amplitudes? My basic understanding is that the amplitude of the noise in real measurements is independent of the amplitudes of the signals, hence implying that my signal-to-noise ratio will not be the same for the three signals (since the variance of the noise is taken as constant). Is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have done at the moment is simply to form $\mathbf Y = \text{vec}\left(\mathbf X\right) \in \Re^{pn \times 1}$ (with $\text{vec}$ being the vectorization operator), calculated the variance of $\mathbf Y$, and then added noise as a fraction of this variance (with zero mean). The reason for this is that I often come across the phrase &quot;we added this percentage of noise to the signals&quot;, and I don't suspect that one adds this to each signal seperately according to the variance of each signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long post. I hope you get my point and can answer my questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;James &lt;/p&gt;&#xA;" OwnerUserId="20228" LastEditorUserId="20228" LastEditDate="2016-03-25T20:34:50.490" LastActivityDate="2016-03-25T21:04:14.587" Title="Adding &quot;realistic&quot; noise to signals of different amplitudes" Tags="|discrete-signals|noise|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29701" PostTypeId="2" ParentId="29697" CreationDate="2016-03-25T19:42:29.947" Score="1" Body="&lt;p&gt;You don't need to remove the DC part of your signal (i.e. &quot;to center&quot; it). In terms of decoding performance, there is no gain. Your signal looks like a typical &lt;a href=&quot;https://en.wikipedia.org/wiki/On-off_keying&quot; rel=&quot;nofollow&quot;&gt;ASK&lt;/a&gt;. Applying a simple integrator and sampling at $t=T$, where $T$ is the pulse duration, would do the job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only need to define a threshold, which usually corresponds to $AT/2$, where $A$ is the expected pulse amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: forgot to mention the fact that you need to determine when to sample the output of the integrator. A symbol-level synchroniser is required for that. &lt;/p&gt;&#xA;" OwnerUserId="17530" LastActivityDate="2016-03-25T19:42:29.947" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29703" PostTypeId="2" ParentId="29698" CreationDate="2016-03-25T19:46:01.293" Score="0" Body="&lt;p&gt;I would do it this way in Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;stanDevNoise_i=sqrt((Ai^2)/(2*EbNo));&#xA;noise_i=stanDevNoise*(randn(length(xi),1)+1i*randn(length(xi),1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason I put &lt;em&gt;(Ai^2)/2&lt;/em&gt; is because you want to put there your signal power. &#xA;The noise is just a random number with the same length as your signal (p, in your case). &lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-25T19:46:01.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29705" PostTypeId="2" ParentId="29698" CreationDate="2016-03-25T20:59:09.840" Score="0" Body="&lt;p&gt;I am assuming we're talking about discrete measurements here, i.e. $n$ instead of $t$ with $n = 0, \cdots, p-1$. If all you want is adding some realistic noise to your three-component matrix $\mathbf X$, you could do this in the case of white Gaussian noise $\mathbf W_{p\times n}$. Using the subscript $\sigma$ for noisy data:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Same noise in all three channels:&#xA;\begin{align}&#xA;\mathbf X_\sigma &amp;amp;= \mathbf X + \mathbf W\tag{$p\times n$ matrices}\\&#xA;\Rightarrow\mathbf x_{i\sigma} &amp;amp;= \mathbf x_i + \mathbf w\tag{$p\times 1$ vectors}\\  &#xA;\Rightarrow x_{i\sigma}[n] &amp;amp;= A_i \sin(\omega n)+ w[n] \quad\text{ with } w \sim \mathcal N\left(0, \sigma^2\right)&#xA;\end{align}  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though you're adding the same noise in all three channels, i.e. $w_1=w_2=w_3=w$, the SNR of the channels will be different (directly proportional the amplitudes $A_i$) unless the three different sensors are capturing exactly identical (real copies) measurements.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Different noise values in the three channels:&#xA;\begin{align}&#xA;\mathbf X_\sigma &amp;amp;= \mathbf X + \mathbf W\tag{$p\times n$ matrices}\\&#xA;\Rightarrow\mathbf x_{i\sigma} &amp;amp;= \mathbf x_i + \mathbf w_i\tag{$p\times 1$ vectors}\\  &#xA;\Rightarrow x_{i\sigma}[n] &amp;amp;= A_i \sin(\omega n)+ w_i[n] \quad\text{ with } w_i \sim \mathcal N\left(0, \sigma_i^2\right)&#xA;\end{align}&#xA;Your SNR of each channel $i$ will be different as the value will be directly proportional to the amplitudes $A_i$ and inversely proportional the channel's variance $\sigma_i^2$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you were having one physical quantity in all three signals (a three-axis sensor for instance), you could compute the norm for each value of $n$ and work with one signal measurement, the magnitude of size $p\times 1$. Like: &#xA;$$\left|x[n]\right|=\sqrt{\sum_{i=1}^3 x_i^2[n]}$$&#xA;Then you would be looking at one $p\times 1$ signal component versus one $p\times 1$ noise component. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-03-25T21:04:14.587" LastActivityDate="2016-03-25T21:04:14.587" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29706" PostTypeId="1" CreationDate="2016-03-26T01:23:24.163" Score="4" ViewCount="143" Body="&lt;p&gt;What is the best Daubechies wavelet (i.e. the number of vanishing moment) to expand a signal $\boldsymbol{x} \in \mathbb{R}^n$? &#xA;$\boldsymbol{x}$ consists of $m$ pieces of polynomial with $d$ degree. The criterium is to make the DWT signal as sparse as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update:&#xA;The goal of sparsifying the signal in wavelet domain is denoising. Let $\boldsymbol{W}$ denote DWT. &#xA;$$&#xA;\boldsymbol{y} = \boldsymbol{Wx}&#xA;$$&#xA;Apply a soft-thresholding to $\boldsymbol{y}$,&#xA;$$&#xA;\hat{\boldsymbol{y}} = \text{sign}(\boldsymbol{y})(\max(\boldsymbol{y}-\lambda,0))&#xA;$$&#xA;Choose $\lambda=\sqrt{2\log n}$ according to &lt;a href=&quot;http://biomet.oxfordjournals.org/content/81/3/425.short&quot; rel=&quot;nofollow&quot;&gt;Ideal spatial adaptation by wavelet shrinkage&lt;/a&gt;.&#xA;The sparsity is defined by $\| \hat{\boldsymbol{y}} \|_0$.&lt;/p&gt;&#xA;" OwnerUserId="12270" LastEditorUserId="12270" LastEditDate="2016-03-26T16:34:41.000" LastActivityDate="2017-06-03T02:51:24.587" Title="Expanding piecewise polynomial using Daubechies wavelet" Tags="|wavelet|transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29707" PostTypeId="2" ParentId="29245" CreationDate="2016-03-26T07:52:11.840" Score="5" Body="&lt;p&gt;so this is why i think an $n$-th order hold is a $\operatorname{rect}\left( \frac{t - T/2}{T} \right)$ convolved against itself $n$ times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia isn't the final reference of all things, but there is something that i sniffed from there.  consider sampling and reconstruction (the Shannon Whittaker whatever formula).  if the original bandlimited input is $x(t)$ and the samples are $x[n]\triangleq x(nT)$ that bandlimited input can be reconstructed from the samples with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \sum\limits_{n=-\infty}^{\infty} x[n] \ \operatorname{sinc}\left( \frac{t - nT}{T} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the output of an ideal brickwall filter with frequency response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; H(f) &amp;amp;= \operatorname{rect}(fT) \\ &#xA;      &amp;amp;= \begin{cases}&#xA;         1 \quad |f| &amp;lt; \frac{1}{2T} \\&#xA;         0 \quad |f| &amp;gt; \frac{1}{2T} \\&#xA;         \end{cases}&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when driven by the ideally sampled function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} &#xA;x_\text{s}(t) &amp;amp; = x(t) \cdot \sum\limits_{n=-\infty}^{\infty} \delta\left( \frac{t - nT}{T} \right) \\&#xA; &amp;amp; = x(t) \cdot T \sum\limits_{n=-\infty}^{\infty} \delta(t - nT) \\&#xA; &amp;amp; = T \sum\limits_{n=-\infty}^{\infty} x(t) \delta(t - nT) \\&#xA; &amp;amp; = T \sum\limits_{n=-\infty}^{\infty} x(nT) \delta(t - nT) \\&#xA; &amp;amp; = T \sum\limits_{n=-\infty}^{\infty} x[n] \delta(t - nT) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so when $x_\text{s}(t)$ goes into $H(f)$, what comes out is $x(t)$.  the $T$ factor is needed so that the passband gain of the reconstruction filter, $H(f)$ is the dimensionless $1$ or 0 dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that means that the impulse response of this ideal brickwall filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;h(t) &amp;amp; = \mathcal{F}^{-1} \left\{ H(f) \right\} \\&#xA; &amp;amp; = \frac1T \operatorname{sinc}\left( \frac{t}{T} \right) \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the reconstructed $x(t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = h(t) \circledast x_\text{s}(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we clearly cannot realize that reconstruction filter because it is not causal.  but with enough delay, we might be able to get closer and closer with a delayed causal $h(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now a practical DAC does not get particularly close, but because it simply outputs the sample value $x[n]$ for the sample period immediately after the sample, the output of the DAC looks like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_\text{DAC}(t) = \sum\limits_{n=-\infty}^{\infty} x[n] \ \operatorname{rect}\left( \frac{t - nT - \tfrac{T}2}{T} \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and it can be modeled as a filter with impulse response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ h_\text{ZOH}(t) = \frac1T \operatorname{rect}\left( \frac{t-\tfrac{T}2}{T} \right)  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;driven by the same $x_\text{s}(t)$.  so &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x_\text{DAC}(t) =  h_\text{ZOH}(t) \circledast x_\text{s}(t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the frequency response of the implied reconstruction filter is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; H_\text{ZOH}(f) &amp;amp;= \mathcal{F}^{-1}\{ h_\text{ZOH}(t) \} \\&#xA;  &amp;amp;= \frac{1 - e^{j 2 \pi f T}}{j 2 \pi f T} \\ &#xA;  &amp;amp;= e^{j \pi f T} \operatorname{sinc}(fT) \\ &#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note the constant half-sample delay in this frequency response. that's where the &lt;strong&gt;Zero-order hold&lt;/strong&gt; comes from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, while the ZOH has the same DC gain as the ideal brickwall reconstruction but not the same gain at other frequencies.  in addition, the images in $x_\text{s}(t)$ aren't fully beaten down as would be with the brickwall, but they're beaten down a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so why, in the POV of the time domain, is this?  i think it's because of the discontinuities in $x_\text{DAC}(t)$.  it's not as bad as the sum of dirac impulses in $x_\text{s}(t)$, but $x_\text{DAC}(t)$ has jump discontinuities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;how do you get rid of jump discontinuities?  maybe turn them into discontinuities of the first derivative.  and you do that by used if integration in the continuous time domain.  so a &lt;strong&gt;first-order hold&lt;/strong&gt; is one where the output of the DAC is run through an integrator with transfer function $\frac{1}{j 2 \pi f T}$ but we try to undo the effects of integrator with a differentiator done in the discrete-time domain.  the output of that discrete-time differentiator is $x[n] - x[n-1]$  or Z-transform $X(z) - z^{-1}X(z) = X(z)(1 - z^{-1})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the transfer function of that differentiator is $(1 - z^{-1})$ or, in the continuous Fourier domain, $(1 - (e^{j 2 \pi f T})^{-1}) = 1 - (e^{-j 2 \pi f T})$.  this makes the transfer function of the first-order hold that of the continuous-time integrator, the discrete-time differentiator, and the ZOH of the DAC all multiplied together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; H_\text{FOH}(f) &amp;amp;= \mathcal{F}^{-1}\{ h_\text{FOH}(t) \} \\&#xA;  &amp;amp;= \left( \frac{1 - e^{j 2 \pi f T}}{j 2 \pi f T} \right)^2 \\ &#xA;  &amp;amp;= e^{j 2 \pi f T} \operatorname{sinc}^2(fT) \\ &#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the impulse response of this is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA; h_\text{FOH}(t) &amp;amp;= \mathcal{F}\{ H_\text{FOH}(f) \} \\&#xA;  &amp;amp;= \left( \operatorname{rect}\left( \frac{t-\tfrac{T}{2}}{T}\right) \right)  \circledast \left( \operatorname{rect}\left( \frac{t-\tfrac{T}{2}}{T}\right) \right) \\ &#xA;  &amp;amp;= \frac{1}{T} \operatorname{tri}\left( \frac{t-T}{T} \right) \\ &#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, continuing with this further, the &lt;strong&gt;second-order hold&lt;/strong&gt; would have both continuous zeroth and first derivatives.  it does this by integrating again in the continuous-time domain and trying to make up for it in the discrete-time domain with another differentiator.  that tosses in another $e^{j \pi f T} \operatorname{sinc}(fT)$ factor which means convolving with another $\operatorname{rect}\left( \frac{t-\tfrac{T}{2}}{T}\right)$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-03-26T09:01:54.723" LastActivityDate="2016-03-26T09:01:54.723" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29709" PostTypeId="1" AcceptedAnswerId="29743" CreationDate="2016-03-26T12:15:00.587" Score="10" ViewCount="13709" Body="&lt;p&gt;I am new to DSP and was going through different responses of a system subjected to an input. My understanding of zero input response is: it is the response/output of the system when the input signal is set to zero. In other words if a system is described by a linear constant coefficient difference equation the zero input response is the homogeneous solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if the $\mathcal Z$-transform of the input is a rational function $X(z)=N(z)/Q(z)$ and that of the LTI system function is $H(z)=B(z)/A(z)$ and &lt;strong&gt;the system is initially relaxed&lt;/strong&gt;, then $Y(z)= H(z)X(z) = N(z)B(z)/A(z)Q(z)$. Assuming distinct zeros(real  only) and poles(real only) of $X(z)$ and $H(z)$ then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(z) = \sum_{k=1}^N \frac{A_k}{1-p_kz^{-1}} + \sum_{k=1}^L \frac{Q_k}{1-q_kz^{-1}}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(n) = \sum_{k=1}^N A_k(p_k)^{n}u(n) + \sum_{k=1}^L Q_k(q_k)^{n}u(n)$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $p_k$ and $q_k$ are the poles of system $H(z)$ and input signal $X(z)$ respectively and $u(n)$ is the unit step function. Now the first term is referred to as the natural response of the system $H(z)$. It's very confusing to grasp the difference between zero input and natural response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: The reference of the question is to book DSP : Principles , Algorithms and Applications by John Proakis and D Manolakis &#xA;&lt;a href=&quot;http://itl7.elte.hu/~zsolt/Oktatas/editable_Digital_Signal_Processing_Principles_Algorithms_and_Applications_Third_Edition.pdf&quot; rel=&quot;noreferrer&quot;&gt;pdf of the book is here&lt;/a&gt;&#xA;Page no 203 and 204. The two paragraphs after formula 3.6.4 explains the difference between zero input response and natural response&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you Peter and Matt for your answers and comments.&lt;/p&gt;&#xA;" OwnerUserId="1942" LastEditorUserId="1942" LastEditDate="2016-03-30T17:30:34.327" LastActivityDate="2022-05-05T08:57:31.263" Title="What is the difference between natural response and zero input response?" Tags="|discrete-signals|linear-systems|z-transform|poles-zeros|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29711" PostTypeId="2" ParentId="23080" CreationDate="2016-03-26T20:05:01.690" Score="1" Body="&lt;p&gt;One approach would be to use the &lt;strong&gt;spectral flux&lt;/strong&gt; of a sequence of STFT frames $X(n,k)$, namely&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathit{SF}(n) = \sum_{k = -N/2}^{N/2 - 1}{H(\left|X(n,k)\right| - \left|X(n-1,k)\right|)},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $n$ is the frame number, $N$ is the size (in samples) of each frame, and $H(x) = \frac{x + \left|x\right|}{2}$ is the half-wave rectifier function. Intuitively, it attempts to measure how much the spectrum changes from frame to frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The overall area of research is called &lt;strong&gt;onset detection&lt;/strong&gt;. A good overview of techniques can be found in the following paper (which also describes spectral flux):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;S. Dixon. &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.414.8898&quot; rel=&quot;nofollow&quot;&gt;Onset detection revisited&lt;/a&gt;. In Proceedings of the 9th&#xA;  International Conference on Digital Audio Effects, volume 120, pages&#xA;  133-137, 2006.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;An example implementation of spectral flux can be found in the &lt;a href=&quot;http://nsg.sourceforge.net/doc/helpers/specflux.php&quot; rel=&quot;nofollow&quot;&gt;NSGToolbox&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="35" LastActivityDate="2016-03-26T20:05:01.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29716" PostTypeId="1" AcceptedAnswerId="29719" CreationDate="2016-03-27T00:25:59.967" Score="0" ViewCount="2021" Body="&lt;p&gt;If I have $b[n]$ of length 30 (30 non-zero samples) and $c[n]$ of length 40 (40 non-zero samples).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many non-zero samples will $a[n]=b[n] * c[n]$ have? (Note '$*$' is a convolution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think there will be 30 non-zero samples. Am I correct?&lt;/p&gt;&#xA;" OwnerUserId="20215" LastEditorUserId="19249" LastEditDate="2016-03-27T08:38:46.043" LastActivityDate="2018-02-01T18:18:14.783" Title="How many non-zeros samples in convolution" Tags="|discrete-signals|signal-analysis|filter-design|convolution|frequency-response|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29717" PostTypeId="1" AcceptedAnswerId="29728" CreationDate="2016-03-27T00:50:47.670" Score="-1" ViewCount="923" Body="&lt;p&gt;If P is a projection operator, show that I-P is a projection operator. Determine the range and nullspace of I-P.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I solve this? What should be my approach?&lt;/p&gt;&#xA;" OwnerUserId="19844" LastActivityDate="2016-03-27T23:32:25.850" Title="Projection Operator Related question" Tags="|projection|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29719" PostTypeId="2" ParentId="29716" CreationDate="2016-03-27T01:08:19.743" Score="3" Body="&lt;p&gt;Actually, you can't say how many non-zero values $a[n]$ is going to have because, depending on the values that $b[n]$ and $c[n]$ take, $a[n]$ may equal 0 for some values of $n$ or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, I think that you want to know the length of the sequence $a[n]$. As a general rule, for two sequences of length $P$ and $L$, the linear convolution between them returns a sequence of length $N=P+L-1$. In this case, the maximum length of $a[n]$ would be $N=30+40-1=69$ (it can be less than 69 if $b[n]$ and $c[n]$ are such that the convolution between them returns null values for the first or the last values of $a[n]$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why the resulting sequence has a length of $N=P+L-1$ can be easily seen by doing the convolution graphically. Let's assume for simplicity (although the reasoning without these assumptions would be exactly the same) that the first non-zero value of $b[n]$ appears at $n=0$ and that the same thing happens with $c[n]$. Let's remember what the definition of convolution is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a[n]=b[n]*c[n]=\sum\limits_{m=-\infty}^\infty b[m]c[n-m]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that we should have in mind $b[m]$ and $c[-m]$, and then start moving $c[-m]$ from $-\infty$ until we get our first non-zero value for $a[n]$. This happens for $n=0$. Then the two sequences always return some information until the last value of $b[m]$ is in the same spot as the first value of $c[n-m]$. This happens for $n=L+P-2=68$. So that leaves us with the length I wrote before: $N=69$.&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="19249" LastEditDate="2018-02-01T12:50:28.313" LastActivityDate="2018-02-01T12:50:28.313" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="29721" PostTypeId="1" CreationDate="2016-03-27T09:48:48.807" Score="2" ViewCount="709" Body="&lt;p&gt;Standard bandpass filters can make super precise analysis filterbanks with 1024 to 4096 filters, on reaktor4. I tried in code to used cookbook BandPass and the result was aweful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does someone know a precise BandPass Filter that transmits narrow bands of an intended frequency without noise and irregularity? resonance is an advantage because it takes the detected frequency's value and adds a large pure amount of that frequency as a sine wave, which is cool because ideally i would be letting through individual sine waves of given frequency. i want something of that kind. what kind of filter should be used on filterbanks? do you have an example in code?&lt;/p&gt;&#xA;" OwnerUserId="20058" LastEditorUserId="20058" LastEditDate="2016-03-27T10:02:10.813" LastActivityDate="2016-04-26T17:31:20.660" Title="What filter to use in audio analysis filterbank instead of FFT?" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29722" PostTypeId="2" ParentId="29721" CreationDate="2016-03-27T10:08:30.427" Score="2" Body="&lt;p&gt;This has already been addressed in depth here:&#xA;&lt;a href=&quot;https://stackoverflow.com/questions/5901483/simple-audio-filter-bank&quot;&gt;https://stackoverflow.com/questions/5901483/simple-audio-filter-bank&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and i found some c# code on the subject here:&lt;br&gt;&#xA;&lt;a href=&quot;https://waveletstudio.codeplex.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://waveletstudio.codeplex.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Copied answer from SO here&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using FFT to split an Audio signal into few bands is overkill. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need is one or two Linkwitz-Riley filters. These filters split a signal into a high and low frequency part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A nice property of this filter is, that if you add the low and high frequency parts you get almost the original signal back. There will be a little bit of phase-shift but the ear will not be able to hear this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need more than two bands you can chain the filters. For example if you want to separate the signal at 100 and 2000Hz it would in pseudo-code somewhat like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;low  = linkwitz-riley-low (100, input-samples)&#xA;temp = linkwitz-riley-high (100, input-samples)&#xA;&#xA;mids = linkwitz-riley-low (2000, temp)&#xA;highs = linkwitz-riley-high (2000, temp);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and so on..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After splitting the signal you can for example amplifiy the three output bands: low, mids and highs and later add them together to get your processed signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter sections itself can be implemented using IIR filters. A google search for &quot;Linkwitz-Riley digital IIR&quot; should give lots of good hits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Linkwitz-Riley_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://en.wikipedia.org/wiki/Linkwitz-Riley_filter&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20058" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-04-26T17:31:20.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29723" PostTypeId="2" ParentId="29717" CreationDate="2016-03-27T10:17:25.157" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;since $P$ is a projection matrix $P^2=P$. Using this it is easy to show that (I-P)(I-P) = I-P. Hence I-P is also Projection (symmetry property also preserves).&lt;/li&gt;&#xA;&lt;li&gt;Since the eigenvalues of a projection matrix are either ones or zeros you can use eigendecomposition: $P = U \begin{pmatrix}&#xA;I_M &amp;amp; \bf{0}\\ &#xA;\bf{0} &amp;amp;\bf{0} &#xA;\end{pmatrix} U^T$ where $M$ is the dimension of the subspace to which the projectios is carried it's easy to show that  $I - U \begin{pmatrix}&#xA;I_M &amp;amp; \bf{0}\\ &#xA;\bf{0} &amp;amp;\bf{0} &#xA;\end{pmatrix} U^T = U \begin{pmatrix}&#xA;\bf{0} &amp;amp; \bf{0}\\ &#xA;\bf{0} &amp;amp; I_{N-M}&#xA;\end{pmatrix} U^T$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From here it is easy to extract the 4 sub-spaces of each projection operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above analysis is correct for orthogonal projectors. For oblique projectors a similar calculation can be done using singular value decomposition.&lt;/p&gt;&#xA;" OwnerUserId="15513" LastEditorUserId="15513" LastEditDate="2016-03-27T12:29:19.113" LastActivityDate="2016-03-27T12:29:19.113" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29724" PostTypeId="1" CreationDate="2016-03-27T10:58:41.160" Score="1" ViewCount="470" Body="&lt;p&gt;I would like to try optimize a bit more the biquad filters indended for RIAA/non-RIAA equalization at low samplerates (44.1/48kHz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any open source optimization libraries (C, C++ or C#) out there I could examine or even use? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Juha&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: continues in thread &lt;a href=&quot;https://dsp.stackexchange.com/questions/29372/how-to-improve-filter-quality-at-low-fs&quot;&gt;How to improve filter quality at low fs&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19991" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-09-18T05:05:20.997" Title="Biquad Filter Optimization" Tags="|filters|filter-design|optimization|biquad|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29726" PostTypeId="1" CreationDate="2016-03-27T18:13:04.527" Score="0" ViewCount="115" Body="&lt;p&gt;I want to recognize table structure from some arbitrary photo image and store it in some formal notation (Let it be HTML table notation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I have this blurry image as input:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Q67uo.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q67uo.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After binarization I achieved this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hb44S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hb44S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to detect structure I want to detect intersections between lines, their type (T-type, X-type, or simple corner), their orientations and their location on the image. After this I'm going to use all gained information for further joining of adjacent crosses in some structure, and translate this structure into formal representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is in detecting crosses and their orientation:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uj4fs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uj4fs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6ijMR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6ijMR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general these crosses may be scaled and/or rotated.&#xA;Maybe someone could help with method of solving this problem? Or maybe recommend different methods for this whole task?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's what I have written so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; # -*- coding: utf-8 -*-&#xA;&#xA; import cv2&#xA; import cv&#xA; import numpy&#xA;&#xA; original = cv2.imread(&quot;/home/user/my_photo-1.jpg&quot;)&#xA; grayscale = cv2.cvtColor(original, cv2.COLOR_BGR2GRAY)&#xA; smoothed = cv2.GaussianBlur(grayscale, (5,5), 0)&#xA; cv2.imshow(&quot;original&quot;, original)&#xA; cv2.imshow(&quot;grayscale&quot;, grayscale)&#xA;&#xA; binarized = cv2.adaptiveThreshold(grayscale, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 7, 8)&#xA; binarized = cv2.Canny(grayscale, 50, 200)&#xA; cv2.imshow(&quot;binarized&quot;, binarized)&#xA; cv2.waitKey(0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any response/idea.&lt;/p&gt;&#xA;" OwnerUserId="20251" LastEditorUserId="20251" LastEditDate="2016-03-28T07:13:26.800" LastActivityDate="2016-04-04T11:18:07.307" Title="Finding crosses and their orientation on a given image" Tags="|image-processing|computer-vision|opencv|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29728" PostTypeId="2" ParentId="29717" CreationDate="2016-03-27T20:38:47.797" Score="0" Body="&lt;p&gt;A linear operator $P:V\to V$ on a vector space $V$ is a projector iff $P^2=P$. For such a projector it follows that $(1-P)^2=1^2+P^2-2P=1+P-2P=1-P$ and therefore $1-P$ is a projector too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider $P\circ (1-P) = P - P^2 = 0$. This implies that the $\mathrm{range}(1-P)\subset\ker(P)$. In the same way $(1-P)\circ P = 0$, implying $\mathrm{range}(P)\subset\ker(1-P).$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the dimension theorem between kernel and range of $P$ and $1-P$, the subsets turn out to be improper: $$\ker(1-P)=\mathrm{range}(P)$$ $$\mathrm{range}(1-P)=\ker(P)$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Some more details on the eigenstructure of projectors, as it is mentioned in Nir Regev's answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $\lambda$ is an eigenvalue of $P$ then $Pv=\lambda v$ for a corresponding eigenvector $v$. Letting $P$ act twice gives $P(Pv)=\lambda^2 v$. Because $P^2=P$ it follows that $\lambda^2=\lambda$. The only possible eigenvalues of a projector are therefore $0$ and $1$. With those eigenvalues, the eigenvector equation for $v\neq 0$ becomes $Pv=v$ and $Pv=0$, which define the range and the kernel of $P$ respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The eigenstructure of projectors can be used for a more constructive proof of what you ask for: $v \in \ker(P) \Leftrightarrow Pv=0 \Leftrightarrow (1-P)v=(v-Pv)=v \Leftrightarrow v \in \mathrm{range}(1-P)$ and similarly for the nullspace of $1-P$.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2016-03-27T23:32:25.850" LastActivityDate="2016-03-27T23:32:25.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29729" PostTypeId="1" AcceptedAnswerId="35465" CreationDate="2016-03-27T23:59:54.747" Score="0" ViewCount="390" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$y(n)$ = output signal&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$x(n)$ = input signal&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$\mathbf H$ = system response as a toeplitz matrix&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf H = \begin{bmatrix}h(0)&amp;amp;&amp;amp;&amp;amp;\\h(1)&amp;amp;h(0)&amp;amp;&amp;amp;\\h(2)&amp;amp;h(1)&amp;amp;h(0)&amp;amp;\\\vdots&amp;amp;&amp;amp;&amp;amp;\ddots\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that $\mathbf H$, with its transposable (orthonormal) properties, makes it easy achieve $x(n)$ when we only know $y(n)$ during deconvolution. But how did we just assume $\mathbf H$ to be of this shape. Why not some other matrix shape when doing deconvolution? Is there a certain reason for this?&lt;/p&gt;&#xA;" OwnerUserId="19352" LastEditorUserId="19352" LastEditDate="2016-03-28T01:43:01.730" LastActivityDate="2017-01-11T01:01:37.693" Title="Why do we assume the matrix of impulse responses to be a Toeplitz matrix during deconvolution" Tags="|denoising|deconvolution|matrix|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29730" PostTypeId="1" CreationDate="2016-03-28T02:30:16.283" Score="5" ViewCount="531" Body="&lt;p&gt;I have encountered a system where the output $y(t)$ and input $x(t)$ are related in the laplace domain as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(s) = H(s)X(s) \tag1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is typical. However, $H(s)$ is not a rational function of polynomials of $s$. Instead, $H(s)$ contains terms like $\log(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far I knew, one can write equation $(1)$ only for an LTI system and LTI systems have rational polynomial transfer functions. Am I correct in this analysis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a logarithm in $H(s)$, that implies that I cannot write a linear differential equation with constant coefficients in the time domain. Is it possible to have an LTI system that is not representable by such differential equation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does a frequency domain analysis always imply an LTI system?&lt;/p&gt;&#xA;" OwnerUserId="20255" LastEditorUserId="19249" LastEditDate="2016-03-28T07:46:14.830" LastActivityDate="2016-03-29T11:16:55.643" Title="LTI system without constant coefficient differential equation" Tags="|linear-systems|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29731" PostTypeId="1" CreationDate="2016-03-28T03:45:59.313" Score="1" ViewCount="164" Body="&lt;p&gt;I have read that &amp;quot;&lt;em&gt;Debauchies Wavelet is simply a short FIR&lt;/em&gt;&amp;quot; so i am searching for a single FIR that i can make into a filterbank, a precise &amp;quot;bandpass filter&amp;quot; that detects narrow frequencies, i.e. 1Hz resolution and very narrow.&lt;/p&gt;&#xA;&lt;p&gt;Having an FIR filter function allows for multithreading which is not easy with a transformation matrix, and arbitrary analysis windows.&lt;/p&gt;&#xA;&lt;p&gt;In Reaktor DSP suite i simply used a bandpass to make an amazing filterbank program. I tried the same with a cookbook FIR filter and it was totally erratic and garbled as a filterbank analysis filter, even though it sounds good.&lt;/p&gt;&#xA;&lt;p&gt;What FIR or wavelet can i use for a filterbank where:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; T=time, F=freq;&#xA;&#xA; for loop T++;                        // (1 second 0-44100 samples)&#xA;    for loop F++;                     // (512 bands 0-512 kHz frequencies)&#xA;       graph2D[T,F] = FIRfilter(T , F );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;EDIT- on request, schematic of a bandpass that can be used for audio analysis:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EpTDM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EpTDM.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20058" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-03-29T00:24:58.797" Title="Are wavelets for audio spectrograms available as a simple FIR filter?" Tags="|fft|filters|wavelet|bandpass|filter-bank|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="29733" PostTypeId="1" CreationDate="2016-03-28T06:05:14.887" Score="2" ViewCount="3197" Body="&lt;ul&gt;&#xA;&lt;li&gt;What happens if zeros are added instead of cyclic prefix in OFDM system?&lt;/li&gt;&#xA;&lt;li&gt;How does it affect performance of system?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20258" LastEditorUserId="1629" LastEditDate="2016-03-28T15:30:09.177" LastActivityDate="2024-03-27T21:43:56.393" Title="Effect of cyclic prefix and zero-padding in OFDM" Tags="|dft|ofdm|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29734" PostTypeId="2" ParentId="29660" CreationDate="2016-03-28T07:07:56.280" Score="0" Body="&lt;p&gt;Consider this:&#xA;$$ \cos(\omega n) = W_1 \cos(\omega{(n-1)}) +  W_2 \cos(\omega{(n-2)})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expand expand both the cos terms in the above expression and start comparing the like terms on both left and right hand side of the equation.  Two equations for $W_1$ and $W_2$ can be obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solving these will show that $W_1$ and $W_2$ take real values and hence it is possible to predict the system with only two weights.&lt;/p&gt;&#xA;" OwnerUserId="20260" LastEditorUserId="20260" LastEditDate="2016-03-28T08:53:29.940" LastActivityDate="2016-03-28T08:53:29.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29735" PostTypeId="2" ParentId="29730" CreationDate="2016-03-28T08:37:48.397" Score="4" Body="&lt;p&gt;As long as a system can be characterized by its transfer function, or, equivalently, by its impulse response, the system is LTI. For the LTI property it's irrelevant if the transfer function is rational or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the transfer function is rational (and &lt;a href=&quot;https://en.wikipedia.org/wiki/Positive-real_function&quot; rel=&quot;nofollow&quot;&gt;positive-real&lt;/a&gt;), the system can be realized by a circuit containing &lt;a href=&quot;https://en.wikipedia.org/wiki/Lumped_element_model&quot; rel=&quot;nofollow&quot;&gt;lumped elements&lt;/a&gt;, i.e., ideal R, L, and Cs. On the other hand, a simple example of a non-rational transfer function is an ideal delay line (e.g., approximated by a long cable), the transfer function of which is $H(s)=e^{-sT}$, where $T$ is the delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In sum, the exact expression for $H(s)$ is irrelevant for the LTI property of the corresponding system. However, $H(s)$ can only be realized by resistors, inductors, and capacitors if it is a rational function (and if it is &lt;a href=&quot;https://en.wikipedia.org/wiki/Positive-real_function&quot; rel=&quot;nofollow&quot;&gt;positive-real&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="19249" LastEditDate="2016-03-29T11:16:55.643" LastActivityDate="2016-03-29T11:16:55.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29737" PostTypeId="2" ParentId="29733" CreationDate="2016-03-28T09:53:39.480" Score="7" Body="&lt;p&gt;The main idea of using Cyclic prefix in OFDM systems is because of 2 reasons, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) To eliminate ISI from previous symbol. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) To model linear convolution as circular convolution &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an OFDM symbol is Zero padded instead of cyclic prefix, ISI due to adjacent symbol still gets eliminated, but it cannot be modeled using  circular convolution. Circular convolution converts frequency selective multipath channel into flat fading channel. Circular convolution simplifies channel estimation and equalization which can be done easily in Frequency domain. &lt;/p&gt;&#xA;" OwnerUserId="11809" LastActivityDate="2016-03-28T09:53:39.480" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29738" PostTypeId="1" AcceptedAnswerId="29740" CreationDate="2016-03-28T12:49:11.783" Score="0" ViewCount="47" Body="&lt;p&gt;I have a first-order high-pass filter with transfer function:&#xA;$$G(f)=\dfrac{G_0 jf}{jf + f_c}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $G_0$ is the gain at high frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I input a sine wave with frequency 1 KHz and I want a maximum disturbance of 0.1% in the amplitude, how can I know the maximum value of the corner frequency ($f_c$) that allows this error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.: Corner frequency is the frequency when the gain is at -2dB.&lt;/p&gt;&#xA;" OwnerUserId="15846" LastEditorUserId="11256" LastEditDate="2016-03-28T13:13:48.727" LastActivityDate="2016-03-28T13:13:48.727" Title="Adjusting corner frequency to constrain maximum disturbance in a high-pass filter" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29740" PostTypeId="2" ParentId="29738" CreationDate="2016-03-28T13:12:15.847" Score="0" Body="&lt;p&gt;You set $|G/G_0| = 0.001$ and $f = 1kHz$ and then solve your equation (in magnitude form) for $f_c$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-03-28T13:12:15.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29742" PostTypeId="2" ParentId="29709" CreationDate="2016-03-28T19:10:41.423" Score="3" Body="&lt;p&gt;OK, now that I've had a chance to read it a bit (not just on mobile!), this is what I think is happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a linear, constant coefficient difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] + \sum_{k=1}^N \alpha_k y[n-k] = \sum_{m=0}^M \beta_m x[n-m]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we wish to find the $y$ for a given $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, the solution $Y$ will comprise two components:&#xA;$$ &#xA;y = y_p + y_h&#xA;$$&#xA;where $y_p$ is the particular solution and $y_h$ is the homogenous solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The particular solution is obtained by setting the system input to $x$.  The homogenous solution is obtained by setting the input of the system to 0 (zero) &lt;em&gt;and selecting an arbitrary initial condition for the system state&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What Proakis and Manolakis assume is that the initial system state is all zero (just above equation 3.6.2, and as you've highlighted in your question).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that's the difference between the zero-input (and zero-state) solution and the zero-input (and arbitrary state or homogenous) solution: what you select the initial conditions to be. The homogeneous solution &lt;em&gt;requires&lt;/em&gt; arbitrary initial conditions, otherwise every homogeneous solution would be $y_h = 0$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-03-28T19:10:41.423" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29743" PostTypeId="2" ParentId="29709" CreationDate="2016-03-28T19:48:10.430" Score="13" Body="&lt;p&gt;First it's important to realize that many authors use the terms &lt;em&gt;zero-input response&lt;/em&gt; and &lt;em&gt;natural response&lt;/em&gt; as synonyms. This convention is used in the corresponding &lt;a href=&quot;https://en.wikipedia.org/wiki/Zero_state_response&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia article&lt;/a&gt;, and for instance also in &lt;a href=&quot;https://books.google.at/books?id=M-e68BhrG_4C&amp;amp;lpg=PA371&amp;amp;ots=fpVxD_6HEp&amp;amp;dq=natural%20response%20zero%20input%20response&amp;amp;pg=PA371#v=onepage&amp;amp;q=natural%20response%20zero%20input%20response&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book&lt;/a&gt;. Even Proakis and Manolakis are not entirely clear about it. In the book you quoted you can find the following sentence on page 97:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[...] the output of the system with zero input is called the &lt;em&gt;zero-input response&lt;/em&gt; or &lt;em&gt;natural response&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This suggests that the two terms can be used interchangeably. Further down the page, we find the following sentence:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Thus the &lt;em&gt;zero-input response&lt;/em&gt; is a characteristic of&#xA;the system itself, and it is also known as the &lt;em&gt;natural&lt;/em&gt; or &lt;em&gt;free response&lt;/em&gt; of the svstem.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Again, this strongly suggests that the authors believe that both terms are equivalent.&lt;/p&gt;&#xA;&lt;p&gt;However, on the pages you mentioned they appear to make a difference between the two. And the difference is as follows. The &lt;em&gt;zero-input response&lt;/em&gt; is the response which is caused by non-zero initial conditions. It only depends on the system properties and on the values of the initial conditions. The zero-input response is zero if the initial conditions are zero.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;em&gt;natural response&lt;/em&gt; is the part of the total response the shape of which is only determined by the poles of the system, and which doesn't depend on the poles of the (transform of the) input signal. The natural response does depend on the input signal in terms of constants but its form is entirely determined by the system's poles. Unlike the zero-input response, the natural response does not vanish for zero initial conditions.&lt;/p&gt;&#xA;&lt;p&gt;The total response of the system can be written as the following two sums:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;zero-input response + zero-state response&lt;/li&gt;&#xA;&lt;li&gt;natural response + forced response&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The zero-state response is the response for zero initial conditions, and the forced response is the part of the response the form of which is determined by the form of the input signal.&lt;/p&gt;&#xA;&lt;p&gt;I hope this becomes clear in the following example. Let's investigate the following system:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n]+ay[n-1]=b^nu[n],\qquad y[-1]=c\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$u[n]$&lt;/span&gt; is the unit step sequence. The total response can be computed using &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;-transform techniques:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n]=\left[\frac{1}{a+b}b^{n+1}+\left(c-\frac{1}{a+b}\right)(-a)^{n+1}\right]u[n]\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The zero-input response is the part of the total response that is determined by the initial condition and that does not depend on &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y_{ZI}[n]=c(-a)^{n+1}u[n]\tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Obviously, &lt;span class=&quot;math-container&quot;&gt;$y_{ZI}[n]=0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$c=y[-1]=0$&lt;/span&gt;, i.e., for zero initial condition.&lt;/p&gt;&#xA;&lt;p&gt;The natural response is the part of the total response the shape of which is determined by the system's pole:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y_N[n]=\left(c-\frac{1}{a+b}\right)(-a)^{n+1}u[n]\tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that it depends on the initial conditions as well as on the input signal (via the constant &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Also note that it is the shape of the &lt;em&gt;zero-state response&lt;/em&gt; that depends on the poles of the system as well as on the poles of the input signal transform. All other responses mentioned here only depend on one of the two sets of poles. The shapes of the zero-input response and of the natural response depend only on the system's poles, whereas the shape of the forced response is determined by the poles of the input signal. The expression for &lt;span class=&quot;math-container&quot;&gt;$y[n]$&lt;/span&gt; quoted in your question from Proakis and Manolakis is the zero-state response (because the system is initially at rest), and the first sum is the forced response, and the second sum is the natural response. Since the zero-input response is zero in this case, the sum of natural response and forced response (i.e., the total response) equals the zero-state response&lt;/p&gt;&#xA;&lt;p&gt;In mathematical terms, the &lt;em&gt;natural response&lt;/em&gt; is the homogeneous solution of the difference equation, where the constants are determined such that the sum of the particular solution (the forced response) and the homogeneous solution satisfy the given initial condition. Clearly, the &lt;em&gt;zero-input response&lt;/em&gt; is also a solution to the homogeneous equation, but the difference with the natural response is that the zero-input response alone satisfies the initial conditions, because it is combined with the zero-state response, which assumes zero initial conditions. On the other hand, the natural response alone does not satisfy the initial conditions. The initial conditions are satisfied only by combining the natural response with the particular solution of the difference equation (the latter being the &lt;em&gt;forced response&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;As mentioned above, we can write the total solution as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n]=y_{ZI}[n]+y_{ZS}[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(zero-input response plus zero-state response)&lt;/p&gt;&#xA;&lt;p&gt;and as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[n]=y_N[n]+y_F[n]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(natural response plus forced response). For the given example, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y_{ZI}[-1]=y[-1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;i.e., it is &lt;span class=&quot;math-container&quot;&gt;$y_{ZI}[n]$&lt;/span&gt; that takes care of the initial condition. That's also why &lt;span class=&quot;math-container&quot;&gt;$y_{ZI}[n]=0$&lt;/span&gt; if the initial condition is zero. &lt;span class=&quot;math-container&quot;&gt;$y_{ZI}[n]$&lt;/span&gt; must satisfy the homogeneous equation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y_{ZI}[n]+ay_{ZI}[n-1]=0,\qquad y_{ZI}[-1]=y[-1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if &lt;span class=&quot;math-container&quot;&gt;$y[-1]=0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y_{ZI}[n]=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. The natural response also satisfies the homogeneous equation, but &lt;em&gt;not&lt;/em&gt; with the initial condition &lt;span class=&quot;math-container&quot;&gt;$y_N[-1]=y[-1]$&lt;/span&gt;. What is satisfied is &lt;span class=&quot;math-container&quot;&gt;$y_N[-1]+y_F[-1]=y[-1]$&lt;/span&gt;. This is why the natural response is generally non-zero, even for zero initial conditions. And the natural response is the homogeneous solution which we need to combine with the particular solution (forced response) found in the standard way. We usually have no direct means to find the specific particular solution which, when combined with the special homogeneous solution represented by the zero-input response, will give the complete solution of the difference equation. For this we need another homogeneous solution, and this is the natural response.&lt;/p&gt;&#xA;&lt;p&gt;Again using the above example will hopefully clarify this. For an exponential forcing signal, the standard (and most straight-forward) way to obtain a particular solution is choosing a scaled version of the forcing function:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y_p[n]=Ab^n\tag{A1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(for the sake of simplicity I leave out the unit step &lt;span class=&quot;math-container&quot;&gt;$u[n]$&lt;/span&gt;, assuming that we consider &lt;span class=&quot;math-container&quot;&gt;$n\ge 0$&lt;/span&gt;, unless we talk about the initial condition). The constant &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is determined by plugging &lt;span class=&quot;math-container&quot;&gt;$(A1)$&lt;/span&gt; into the difference equation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Ab^n+aAb^{n-1}=b^n$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;giving &lt;span class=&quot;math-container&quot;&gt;$A=\frac{b}{a+b}$&lt;/span&gt;. The general form of the homogeneous solution is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y_h[n]=B(-a)^n\tag{A2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Of course &lt;span class=&quot;math-container&quot;&gt;$y_h[n]=0$&lt;/span&gt; (i.e., &lt;span class=&quot;math-container&quot;&gt;$B=0$&lt;/span&gt;) is one specific solution, but that's not the one we're looking for. We need to determine the constant &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in such a way that the sum of the particular and the homogeneous solution satisfies the initial condition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y[-1]=y_p[-1]+y_h[-1]=\frac{A}{b}-\frac{B}{a}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From this equation we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$B=\frac{a}{a+b}-ay[-1]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which shows that the homogeneous solution we need is non-zero if &lt;span class=&quot;math-container&quot;&gt;$y[-1]=0$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$y_p[n]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_h[n]$&lt;/span&gt; found in this way are identical to the forced response and the natural response, respectively, as shown in &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; and - implicitly - in &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2021-03-07T13:56:54.020" LastActivityDate="2021-03-07T13:56:54.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29744" PostTypeId="1" CreationDate="2016-03-28T21:59:05.553" Score="3" ViewCount="349" Body="&lt;p&gt;I have a noisy signal that has an ac component of fixed frequency but variable amplitude and phase. I'd like to recover the ac component.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal (blue trace) is mostly smooth, but has a few larger discontinuities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase and amplitude of the ac component vary with time,&#xA;this is how the signal looks like (green). Noise not shown:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/UDFpn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UDFpn.png&quot; alt=&quot;signal and signal + ac component&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling rate is not commensurate with the ac period, this causes the aliasing seen in the picture. Unfortunately I cannot change this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this data, I need to recover amplitude and phase of the ac component, if possible also the harmonics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current approach is to multiply the data with a sine and cosine and then use a LPF to recover the quadrature components. I am not too happy with that approach, as the aliasing requires a very low cutoff frequency that smears out sharp transitions in the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I'd like to explore the solution space with some global constraints on amplitude and phase, e.g. sparsity and piece-wise continuity of the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the right approach for phase and amplitude recovery? Can this be treated as a constraint convex optimization problem, or are there better solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have taken some real measurement data. I didn't have any data with the ac signal, so I have added an ac component numerically. The ac peak due to the signal is the highest green peak close to DC. The other two blue peaks are due to a digitizer artifact. The green curve is pretty much the same as the blue one in front elsewhere.&#xA;This curve did not have any modulation on the ac signal, for a real signal, the peak would be about 2/3 that high and have some sidebands. This is shown in the inset image, the red curve is for the amplitude and phase modulated signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xrXdb.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xrXdb.jpg&quot; alt=&quot;FFT of measurement data with ac signal added on&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# simulated raw data for first plot&#xA;d=[0] * 50 + [1]*50 + list(np.linspace(0.5,1,50)) + list(np.exp(np.linspace(0,-1,30)))&#xA;# with additional small signal ac overimposed. Normally amplitude and phase would change as well&#xA;ds=d + 0.1*np.sin(100*np.linspace(0,6,180))&#xA;plt.plot(ds)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what I meant with &lt;em&gt;global constraints&lt;/em&gt;: The data is very noisy, and it is not realistic to measure amplitude and phase without any averaging. On the other hand, I have some hypotheses about amplitude and phase, and would like to make use of them for filtering the data. For example, I know that there are sharp transitions in the phase, with areas of constant phase in-between. I don't want to average out the transitions. So ideally, I would like to recover the instantaneous amplitude and phase of the ac signal and then use a LASSO-like method to filter.&lt;/p&gt;&#xA;" OwnerUserId="20265" LastEditorUserId="128" LastEditDate="2023-07-15T16:29:09.843" LastActivityDate="2023-12-12T17:04:45.653" Title="Amplitude and Phase Recovery of a Signal Embedded in Linear Signal with Noise" Tags="|phase|estimation|demodulation|compressive-sensing|graph-theory|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29746" PostTypeId="1" CreationDate="2016-03-29T03:27:46.887" Score="1" ViewCount="917" Body="&lt;p&gt;I have two speech audio wav files. &lt;code&gt;file1&lt;/code&gt; is primary speech, &lt;code&gt;file2&lt;/code&gt; is supposed to be interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to add them so that the SIR (signal to interference ratio) is 10 dB.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How do I proceed? &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do I do sample by sample addition like below? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming $N$ is the data-length of both the files (single channel).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;for i = 1:N&#xA;   x = 0.1 * file1(i)^2 / file2(i)^2 &#xA;   file3(i) = file1(i) + x*file2(i)  &#xA;end&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;file3&lt;/code&gt; is the output file.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Are there any better ways to do this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note: $\textrm{SIR(in dB) = 10 log (Power(signal) / Power(interference))}$&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="1629" LastEditDate="2016-03-29T13:55:35.657" LastActivityDate="2016-03-29T13:55:35.657" Title="Adding two audio files at a predefined SNR level" Tags="|audio|noise|snr|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29752" PostTypeId="2" ParentId="2969" CreationDate="2016-03-29T14:08:34.863" Score="2" Body="&lt;p&gt;The answer provided by Andrey Rubshtein will fail miserably in the presence of noise, as the described problem is very sensitive to noise and modeling errors. It is a good idea to construct a convolution matrix, but the use of &lt;strong&gt;regularization&lt;/strong&gt; in the inversion is an absolute must in a problem like this. A very simple and straight forward regularization method (although computationally expensive) is the &lt;strong&gt;Truncated Singular Value Decomposition&lt;/strong&gt; (TSVD). Methods like &lt;strong&gt;Tikhonov Regularization&lt;/strong&gt; and &lt;strong&gt;Total Variation Regularization&lt;/strong&gt; are worth checking out. Tikhonov regularization (and its general form) has a very elegant stacked form that is easy to implement in Matlab. Check out the book: Linear and nonlinear inverse problems with practical applications by Samuli Siltanen and Jennifer  Mueller. &lt;/p&gt;&#xA;" OwnerUserId="20272" LastActivityDate="2016-03-29T14:08:34.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29755" PostTypeId="1" CreationDate="2016-03-29T17:44:44.257" Score="1" ViewCount="990" Body="&lt;p&gt;I am trying to design a discrete-time inverse system to eliminate an undesired echo in a data transmission problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The echo caused by the transmission channel is represented as attenuation by a factor of 0.9 and a delay corresponding to one time unit of the input sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The received signal $y[n]$ can be expressed as follow;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = x[n] + 0.9x[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically, I'm trying to determine the unit impulse response of a causal inverse system to discover $x[n]$ from $y[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conceptually, I'm thinking I need to connect a system $h_2[n]$ in series with the system $h_1[n]$ such that $h_1[n]*h_2[n] = \delta[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone offer some advice on how best to go about this ? I've been searching online but can't find a concrete example to use as a starting point.&lt;/p&gt;&#xA;" OwnerUserId="20275" LastEditorUserId="80" LastEditDate="2016-03-30T11:36:48.840" LastActivityDate="2016-03-30T15:21:28.563" Title="Designing a discrete-time inverse system" Tags="|delay|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29756" PostTypeId="1" CreationDate="2016-03-29T17:58:53.897" Score="1" ViewCount="299" Body="&lt;p&gt;Let's say I have an audio clip of $N$ samples.  I want to describe every $10$ ms of audio with an FFT of size $1024$, without information bleeding over from other $10$ ms windows.  Given that the sample rate of this audio clip is a standard $44100$, I can't do that with a regular FFT.  A regular FFT would give me $441 / 2 = 220$ bins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to take many, many FFTs of differing sizes over different windows to infer a larger frequency resolution for a smaller timeframe?  Let's say I take a $1024$-FFT for each sample range increasing by $t = 1$ (samples $0$ through $2047$, then samples $1$ through $2048$ and so on), then a bunch of $512$-FFTs, then a bunch of $256$-FFTs.  Would this large dataset contain enough useful information to &quot;subdivide&quot; the bins of the smaller, $220$-FFT?&lt;/p&gt;&#xA;" OwnerUserId="10577" LastActivityDate="2017-08-22T11:32:04.320" Title="FFT Resolution Inference" Tags="|fft|resolution|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29757" PostTypeId="1" CreationDate="2016-03-29T18:17:55.450" Score="1" ViewCount="42" Body="&lt;p&gt;I'm stumped trying to find a way to generate a 3-dimensional $1/f^\alpha$ noise time series. Basically I want simulate a forcing that is $1/f^\alpha$ in the 2 space dimensions and $1/f^\beta$ in time, $0&amp;lt;\alpha&amp;lt;2$ and $0&amp;lt;\beta&amp;lt;1$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It believe I should be able to 3D fourier filter a giant random matrix, but the matrix sizes needed are around $512\times512\times2048$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know of a clever way to do this? Is fourier filtering my only option or is there some way to draw from a distribution so as to to generate these surfaces at each time step in a model, rather than creating and saving these giant matrices?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any insight is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="20276" LastActivityDate="2016-03-29T18:17:55.450" Title="Generating 3-dimension $1/f^\alpha$ noise" Tags="|filter-design|noise|power-spectral-density|power-law|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29759" PostTypeId="2" ParentId="29756" CreationDate="2016-03-29T19:26:27.677" Score="1" Body="&lt;p&gt;You can use interpolation (or equivalent zero-padding) to get your desired sub-divided 512 frequency points from your 220 FFT bins.  Use a Sinc interpolation kernel for a rectangular window, or the transform of the window for other windows.  If you want more real frequency resolution (as in clear separation of multiple peaks present in the frequency spectrum), you will have to use (overlap or &quot;smear&quot;) more than 10 mS of data (perhaps over 50 mS).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-29T19:26:27.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29760" PostTypeId="1" CreationDate="2016-03-29T19:54:12.937" Score="1" ViewCount="2125" Body="&lt;p&gt;I would like to characterize 1/f noise in some time series data. I would like to estimate the 1/f noise corner, and the standard deviation of the 1/f noise component and white noise component. The best thing I could find was this paper: &lt;a href=&quot;http://www.biophot.caltech.edu/publications/pdf/mcdowell-2007-pink-noise-homodyne.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A generalized noise variance analysis model and&#xA;its application to the characterization of 1/f noise&lt;/a&gt; that deals with photon noise arrival rates. That's great, I follow their math and everything. &#xA;They start of with a random variable that is photon count rates. The problem is I want to do this for an ADC or electronic noise source and I'm not sure what my random variable would be. How do I estimate the 1/f noise corner, and the standard deviation of the 1/f noise component and white noise component with an electronic noise source from time series data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show what a 1/f noise spectrum looks like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/l05Pc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l05Pc.png&quot; alt=&quot;http://electronicdesign.com/analog/understanding-noise-terms-electronic-circuits&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what the FFT looks like. I'm hoping for something that is more numerical based than semi-empirically modeled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qOxv9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qOxv9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19823" LastEditorUserId="19823" LastEditDate="2016-04-01T23:00:31.243" LastActivityDate="2016-04-01T23:00:31.243" Title="1/f noise parameter characterization" Tags="|noise|power-spectral-density|estimation|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="29761" PostTypeId="1" AcceptedAnswerId="29762" CreationDate="2016-03-29T20:38:52.403" Score="0" ViewCount="1887" Body="&lt;p&gt;Forgive me is this is an ill-posed question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any such thing as a 'convolution theorem' for the cross-correlation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Namely, the convolution theorem states that:&#xA;$$&#xA;x[n] * h[n] = \sum_{k=0}^{\infty}h[k] x[n-k] = X(f)H(f)&#xA;$$&#xA;Where $X(f)$ is the Fourier transform of $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any equivalent theorem for cross-correlation, i.e.:&#xA;$$&#xA;\textrm{corr}(x[n],h[n])=r_{xh}[k]= \sum_{k=0}^{\infty}h[k] x[n+k] = F_?[X(f),H(f)]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, is there a way to express $r_{xh}[k]$ in terms of $X(f)$ and $H(f)$, or even in terms of the autocorrelation $r_x[k]$ and $r_h[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried self-deriving this but couldn't come up with anything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4550" LastEditorUserId="11256" LastEditDate="2016-03-29T22:33:35.593" LastActivityDate="2021-11-01T17:40:16.557" Title="Convolution theorem for cross-correlation" Tags="|fourier-transform|convolution|cross-correlation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29762" PostTypeId="2" ParentId="29761" CreationDate="2016-03-29T21:13:14.397" Score="1" Body="&lt;p&gt;Yes. Cross correlation is the same as convolution with a time reversed signal. That corresponds to conjugate komplex in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R(\omega) = X(\omega ) \cdot H(\omega )^*$&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-03-29T21:13:14.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29763" PostTypeId="2" ParentId="29761" CreationDate="2016-03-29T21:54:55.037" Score="2" Body="&lt;p&gt;To stick to proper notations, if $\mathcal F \left\{x[n]\right\}=X(\omega)$ and $\mathcal F \left\{h[n]\right\}=H(\omega)$, what you mean is the &lt;strong&gt;Fourier transform&lt;/strong&gt; of a convolution gives the product of the transforms of each term:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal F \left\{x[n] * h[n]\right\} = \mathcal F\left\{\sum_{k=0}^{\infty}h[k] x[n-k]\right\} =X(\omega)\cdot H(\omega)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As already mentioned, there is a similar formulation for correlation, the correlation theorem. And again, the &lt;strong&gt;Fourier transform&lt;/strong&gt; of the correlation:&#xA;$$&#xA;\mathcal F\left\{\mathrm{corr}\left(x[n],h[n]\right)\right\}=\mathcal F\left\{r_{xh}[n]\right\}= \mathcal F\left\{\sum_{k=0}^{\infty}h[k] x[n+k] \right\}= X(\omega)\cdot H^*(\omega)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The product $X(\omega) H^*(\omega)$ is called &lt;em&gt;cross-energy density  spectrum&lt;/em&gt; and noted $S_{xh}(\omega)$, and this is just $\mathcal F\left\{r_{xh}[n]\right\}$. The $^*$ sign is for conjugate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that your convolution/correlation are on &lt;strong&gt;discrete-time&lt;/strong&gt; signals $x[n]$ and $h[n]$. So $X(\omega)$ and $H(\omega)$ are transforms of $x[n]$ and $h[n]$ respectively, and not of continuous-time signals $x(t)$ and $h(t)$.&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-03-29T22:11:08.160" LastActivityDate="2016-03-29T22:11:08.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29764" PostTypeId="1" CreationDate="2016-03-29T23:19:06.843" Score="0" ViewCount="1242" Body="&lt;p&gt;I can quote from &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6678248&amp;amp;tag=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;an article&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;The first category of methods, known as diffusion-based inpainting,&#xA;  introduces smoothness priors via parametric models or partial&#xA;  differential equations (PDE) to propagate or diffuse local structures&#xA;  from the exterior to the interior of the hole.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What is Smoothness Prior?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this definition mean?&lt;/p&gt;&#xA;" OwnerDisplayName="user18425" LastEditorUserId="26573" LastEditDate="2019-07-23T17:04:24.133" LastActivityDate="2023-07-07T06:49:12.777" Title="What does Smoothness Prior mean in the context of image processing?" Tags="|image-processing|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29767" PostTypeId="1" CreationDate="2016-03-30T01:49:36.870" Score="1" ViewCount="243" Body="&lt;p&gt;My question has to do with the definition of auto correlation/cross-correlation for random processes.&lt;br&gt;&#xA;Oppenheim/Schafer (Discrete time Signal Processing, Pg. 815 (Appendix A.2),2nd ed.) define auto correlation in the following way:&lt;br&gt;&#xA;$\phi_{xx}[n,m]=E[\mathbf{x_nx^*_m}]=\int_\infty^\infty x_nx^*_m p_{x_n,x_m}(x_n,n,x_m,m)dx_ndx_m$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{$\mathbf{x_n}$} is a random process and $p_{x_n,x_m}(x_n,n,x_m,m)$ is it's joint probability density function.&lt;br&gt;&#xA;What is the significance of using the conjugate of $x_m$ in the above formula? Is there a physical interpretation for it?&lt;/p&gt;&#xA;" OwnerUserId="19865" LastActivityDate="2016-03-30T02:58:08.460" Title="Auto correlation definition" Tags="|autocorrelation|random-process|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29768" PostTypeId="2" ParentId="29767" CreationDate="2016-03-30T02:58:08.460" Score="1" Body="&lt;p&gt;it's funny, but i have an old copy of O&amp;amp;S and i would have expected them to be consistent and use &quot;$x[n]$&quot; notation instead of &quot;$x_n$&quot; notation for discrete-time signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expression above&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \phi_{xx}[n,m] \ = \ E[\mathbf{x_n \ x^*_m}] \ = \ \int_\infty^\infty \int_\infty^\infty \ x_n \ x^*_m \ p_{x_n,x_m}(x_n,n,x_m,m) \ dx_n dx_m $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is the &lt;strong&gt;average&lt;/strong&gt; value of the pair $\mathbf{x_n \ x^*_m}$ where the average is computed from the joint probability density function $ p_{x_n,x_m}(x_n,n,x_m,m) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the process is stationary and &lt;a href=&quot;https://en.wikipedia.org/wiki/Ergodic_process&quot; rel=&quot;nofollow&quot;&gt;ergodic&lt;/a&gt; (and i think that any process that is fully stationary is also ergodic) i think this can be simplified a little&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \phi_{xx}[n-m] \ = \ E[\mathbf{x_n \ x^*_m}] \ = \ \int_\infty^\infty \int_\infty^\infty \ x_n \ x^*_m \ p_{x_n,x_m}(x_n,x_m) \ dx_n dx_m $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now the root meaning of &lt;em&gt;&quot;ergodic&quot;&lt;/em&gt; is that probabilistic averages can be replaced with time averages and vise-versa:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \langle \mathbf{x_n \ x^*_{n+k}} \rangle = \lim_{L \to \infty} \frac{1}{2L+1} \sum\limits_{n=-L}^L \mathbf{x_n \ x^*_{n+k}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the process is ergodic if all averages, including the one expressed above, are the same, whether they are probabilistic or computed from the data&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \langle \mathbf{x_n \ x^*_{n+k}} \rangle = \phi_{xx}[k] = E[\mathbf{x_n \ x^*_{n+k}}] $$&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-03-30T02:58:08.460" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29769" PostTypeId="1" AcceptedAnswerId="29781" CreationDate="2016-03-30T04:44:41.123" Score="0" ViewCount="44" Body="&lt;p&gt;What is special about the theorem that over GF(2), $f^2(X) = f(X^2)$?  There is a some 10-line proof for the same in &quot;page no.42, Shu Lin, Daniel J. Costello-Error Control Coding (2nd Edition)-Prentice Hall (2004)&quot;  I think the fact is more general and can be proved straight away.  I feel that  $f^m(X) = f(X^n)$ because in GF(2), $A^m=A=A^n$ where A is any polynomial, variable or constant from/over GF(2)and m and n are any two positive integers.  Am I missing some important point here?&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2016-03-30T08:36:17.810" Title="What is special about the theorem that over GF(2), $f^2(X) = f(X^2)$?" Tags="|channelcoding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29770" PostTypeId="1" AcceptedAnswerId="29788" CreationDate="2016-03-30T05:28:28.613" Score="4" ViewCount="524" Body="&lt;p&gt;My understanding is that signal averaging works this way. If we take the average of the waveform, we get the average of the signal component (which is the magnitude of the signal) and the average of the noise component (which becomes closer to zero as number of samples are increased).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is based on the assumption that the noise has zero mean and constant variance (i.e. white or Gaussian noise). What if the noise is not white? For example, what if the noise decreases as frequency increases? Will the noise still be averaged out by signal averaging?&lt;/p&gt;&#xA;" OwnerUserId="20286" LastEditorUserId="80" LastEditDate="2016-03-30T14:11:29.203" LastActivityDate="2016-03-30T14:11:29.203" Title="In signal averaging, will the noise be reduced if the noise is not Gaussian?" Tags="|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29771" PostTypeId="1" AcceptedAnswerId="29793" CreationDate="2016-03-30T05:53:52.717" Score="4" ViewCount="1793" Body="&lt;p&gt;I'm going through a Coursera course on signal processing, and we're just introduced to DFTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are told that if you have a complex sinusoidal signal &#xA;$x[n]$ where $n=0,1...\ N-1$, its DFT is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1} x[n] e^{-j2\pi kn/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this makes sense to me. Because $x[n]$ has $N$ samples. You take each one, multiply it with the sample of a basis function, essentially taking the dot product of the signal with the basis function, and you get how much of that frequency is present in the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we are told that if you have a real sinusoidal signal $y[n]$ where $n=0,1...\ N-1$, then the DFT is given as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=-N/2}^{N/2-1} y[n] e^{-j2\pi kn/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;Why do we sum over the different values?&lt;/em&gt;&lt;/strong&gt; What is the intuition and explanation behind this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not even sure what $y[-N/2]$ would mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the $-N/2^{th}$ sample the same as the $N/2^{th}$ sample because we assume the input signal is periodic? Even if so, why is taking the DFT summation over such a range beneficial? We could also do this for complex sinusoidal signals since they're periodic too right? What's the advantage?&lt;/p&gt;&#xA;" OwnerUserId="20287" LastEditorUserId="4346" LastEditDate="2016-03-31T01:55:18.053" LastActivityDate="2016-03-31T13:24:35.443" Title="DFT of real sinusoids - why sum over -$N/2$ to $N/2-1$ as opposed to $0$ to $N-1$?" Tags="|signal-analysis|fourier-transform|dft|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29773" PostTypeId="1" CreationDate="2016-03-30T06:07:32.797" Score="4" ViewCount="2434" Body="&lt;p&gt;Can you suggest me some books/webpages on Bandpass sampling? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I undestand that if the signal is restricted between $f_L$ and $f_H$, then the minimum bandwidth required is $2(f_H - f_L)$. But say the centre frequency is in GHz and the bandwidth is in MHz, then by this theory I would have the sampling frequency to be in a few MHz. So in case of GHz centre frequency signal(say 1 GHz), I collect the samples every microsecond. But the signal is changing every nanosecond. I did not understand this concept. &lt;/p&gt;&#xA;" OwnerUserId="20028" LastEditorUserId="1629" LastEditDate="2016-03-30T11:06:53.520" LastActivityDate="2019-02-11T23:11:34.317" Title="What is the underlying concept behind Bandpass sampling?" Tags="|sampling|bandpass|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29774" PostTypeId="1" CreationDate="2016-03-30T06:48:17.750" Score="0" ViewCount="1382" Body="&lt;p&gt;When you get a DFT of a signal, you use the basis functions as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$e^{-j2\pi kn/N}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it so? Why don't we use the conjugate, $e^{j2\pi kn/N}$, or any other function?&lt;/p&gt;&#xA;" OwnerUserId="20287" LastActivityDate="2016-07-29T18:40:04.693" Title="Why are the basis functions for DFT so?" Tags="|signal-analysis|fourier-transform|dft|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29776" PostTypeId="2" ParentId="29773" CreationDate="2016-03-30T06:52:46.233" Score="2" Body="&lt;p&gt;Yes, the signal is changing &quot;every nanosecond&quot; for any non DC signal.  But if the bandwidth is really limited to 0.001 of the carrier frequency, then those changes are very predictable, as the changes result in a carrier waveform that is a nearly perfect sinusoid of a known frequency.  The signal can't differ too much from that highly predictable sinusoidal waveform unless the bandwidth is increased.  Assuming the bandwidth doesn't increase, any changes to the near perfect sinusoid are so small that one only needs to check the waveform every few hundred cycles of the sinusoid to see if it has drifted a bit from the expected point on the expected cycle.  Thus under-sampling at somewhere above 0.002 cf can tell you all you need to know in addition to knowing that the bandwidth was absolutely constrained to 0.001 cf or below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the sampling jitter requirement has to be on the order of a very tiny fraction of a nanosecond, or else one will completely miss the expected point on the expected cycle of the 1 Ghz sinusoid.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-29T23:11:11.290" LastActivityDate="2016-04-29T23:11:11.290" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29777" PostTypeId="1" AcceptedAnswerId="29910" CreationDate="2016-03-30T06:55:33.613" Score="10" ViewCount="1851" Body="&lt;p&gt;If we have a signal $x[n]$ such that we have $N$ samples i.e. $n=0, \ldots, N-1$, then when we analyze the DFT $X[k]$ we only analyze for $k=0,\dots,N-1$ as well. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why is the range of $k$ tied to the range of $n$? &lt;/li&gt;&#xA;&lt;li&gt;Why don't we analyze more, or less number of frequencies?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20287" LastEditorUserId="1629" LastEditDate="2016-03-30T11:36:17.217" LastActivityDate="2016-10-04T17:53:33.680" Title="DFT of discrete signals, why do we only analyze frequency bins equal to number of input samples?" Tags="|fourier-transform|dft|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29778" PostTypeId="2" ParentId="29777" CreationDate="2016-03-30T07:12:09.967" Score="5" Body="&lt;p&gt;A DFT is an invertable (square matrix) transform, thus the complex result vector is the same size as the complex input vector.  But you can analyze as many (additional) frequencies as you want by interpolating the results after the DFT (which requires additional computation that doesn't really increase separation resolution, but can produce a smoother looking plot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can analyze less if you want by using the Goertzel algorithm, which can be used to compute any single frequency result bin of a DFT.  (But calculating less than N orthogonal bins won't be invertable or &quot;complete&quot;.  And any more than log(N) bins will likely be a lot slower than just doing a full FFT and throwing away what you don't need.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-03-30T07:18:20.963" LastActivityDate="2016-03-30T07:18:20.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29779" PostTypeId="2" ParentId="29777" CreationDate="2016-03-30T08:11:54.440" Score="3" Body="&lt;p&gt;One easy way to understand DFT is direct substitution of $k$ in $X[k]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you calculate $X[N:2N-1]$, you will get the same result with $X[0:N-1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then If you calculate $X[2N:3N-1]$, you will get the same result with $X[0:N-1]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will always find the same result with $N$ period substitution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means $X[k]$ is periodic function having $N$ period and all information is in $X[0:N-1]$.&lt;/p&gt;&#xA;" OwnerUserId="19371" LastEditorUserId="8202" LastEditDate="2016-04-07T07:33:32.963" LastActivityDate="2016-04-07T07:33:32.963" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29781" PostTypeId="2" ParentId="29769" CreationDate="2016-03-30T08:36:17.810" Score="1" Body="&lt;p&gt;You are confusing polynomials, elements of $\text{GF}(2)[X]$, with coefficients, elements of $\text{GF}(2)$.  Admittedly, it's certainly the case that &lt;em&gt;as functions&lt;/em&gt; $\text{GF}(2)\to\text{GF}(2)$, any polynomial (or any function at all) will be equal to its (pointwise) power for any exponent greater than 0 which no doubt adds to the confusion.  Still, &lt;em&gt;as polynomials&lt;/em&gt; (roughly, finite lists of coefficients), they need not be equal.  For example, $X^2 \neq X$ in $\text{GF}(2)[X]$ simply by definition.  With fields of characteristic $0$, evaluation is injective as a function $F[X]\to F^F$, so conflating polynomials with the functions they represent is not as much of a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for $f(X) = 1+X$, $$f(X)^3 = (1+X)^3 = 1 + 3X + 3X^2 + X^3 = 1 + X + X^2 + X^3 \neq 1+X^3 = f(X^3)$$&lt;/p&gt;&#xA;" OwnerUserId="19119" LastActivityDate="2016-03-30T08:36:17.810" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29782" PostTypeId="2" ParentId="29774" CreationDate="2016-03-30T08:39:30.173" Score="1" Body="&lt;p&gt;If you look at the idea of Continuous Time Fourier Series (CTFT), it says any periodic signal can be constructed by summation of infinite number of complex exponentials. But in descrete case , only 'N' different  complex exponentials are enough , because there are only 'N' distinct complex  exponentials exists (N is the period of discrete signal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;DFT is nothing but DFS (Discrete Fourier Series).So You can extend the &#xA;same idea to get the answer. &lt;/p&gt;&#xA;" OwnerUserId="11809" LastActivityDate="2016-03-30T08:39:30.173" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29783" PostTypeId="1" AcceptedAnswerId="29787" CreationDate="2016-03-30T09:49:59.803" Score="0" ViewCount="315" Body="&lt;p&gt;I have a transfer function in Fourier space with $N=2028$ frequencies $(\frac {0, 1}{(N\cdot dx)} \dots ) $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $dx = 0.1m$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to apply this transfer function to a signal with 20000 samples (also $dx=0.1m$). &#xA;When I transform this signal to Fourier space I get 20000 frequencies.&#xA; So, the sizes don't match. What do I need to do to be able to apply the transfer function (i.e. to multiply the Fourier transforms)? I guess, I could just remove the first $20000-2028=17952$ frequencies from the Fourier transform of the input signal, since they are not present in the transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is that correct?&lt;/p&gt;&#xA;" OwnerUserId="20292" LastEditorUserId="8202" LastEditDate="2016-03-31T06:11:27.583" LastActivityDate="2016-03-31T06:11:27.583" Title="In fourier space, how to apply transfer function with n frequencies to input data with m&gt;&gt;n frequencies" Tags="|fourier-transform|filtering|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29785" PostTypeId="1" CreationDate="2016-03-30T13:01:28.810" Score="1" ViewCount="333" Body="&lt;p&gt;I'm performing a series of FFTs on windowed extracts of an input signal, to get a frequency spectrum over time.  This is for a visualisation - I'd like to keep the window small, so the visualisation is fast-moving and responsive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm only interested in the amplitude.  Occasionally, two or more frequencies are close enough that the amplitude flickers wildly with the interference pattern between the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What ways are there to reduce this flickering, that will disturb my time-domain responsiveness less than increasing the window length?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(For reference, &lt;a href=&quot;https://youtu.be/_uBm2UQJu0M?t=2m12s&quot; rel=&quot;nofollow&quot;&gt;this is the visualisation&lt;/a&gt; - I'm not concerned with the &quot;flashes&quot; when something happens in the audio, but the juddering is not good.)&lt;/p&gt;&#xA;" OwnerUserId="14861" LastEditorUserId="14861" LastEditDate="2016-03-30T15:53:58.857" LastActivityDate="2016-03-30T18:22:36.070" Title="Reduce &quot;flicker&quot; in spectrum analysis / spectrogram" Tags="|fft|window-functions|spectrogram|visualization|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29786" PostTypeId="2" ParentId="29783" CreationDate="2016-03-30T13:09:30.410" Score="2" Body="&lt;p&gt;For the signal that is shorter than the other, before you FFT it, zero-pad it so that the length is the same as the other. &lt;/p&gt;&#xA;" OwnerUserId="11102" LastActivityDate="2016-03-30T13:09:30.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29787" PostTypeId="2" ParentId="29783" CreationDate="2016-03-30T13:10:16.657" Score="0" Body="&lt;p&gt;That is not correct. The frequency range is still the same with 20000 bins, the bins are just closer. What you need to do is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply a Window Function with lenght 2028 (such as Hamming Window) with an appropriate overlap between windows.&lt;/li&gt;&#xA;&lt;li&gt;Fourier-transform each window.&lt;/li&gt;&#xA;&lt;li&gt;Multiply each window by the transfer function.&lt;/li&gt;&#xA;&lt;li&gt;Inverse-F-transform each window.&lt;/li&gt;&#xA;&lt;li&gt;Overlap-Add the windows again to gain the filtered signal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20297" LastActivityDate="2016-03-30T13:10:16.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29788" PostTypeId="2" ParentId="29770" CreationDate="2016-03-30T13:41:43.410" Score="2" Body="&lt;p&gt;Consider two zero mean signals $x(n)$ and $y(n)$. Let $z(n)=x(n)+y(n)$. In the following $E()$ denotes the expectation.&#xA;$$E(z) = E(x+y)= E(x)+E(y)= 0$$&#xA;I've dropped the time index $n$ for convenience. So $z(n)$ has zero mean. Now let's look at the variance. Since $z(n)$ is zero mean - I'll just use the correlation.&#xA;$$E[z^2] =E[(x+y)(x+y)]=E[x^2+2xy+y^2]=E(x^2)+2E(xy)+E(y^2) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the correlation between $x(n)$ and $y(n)$ is zero, then $E(xy)=0$, then the variances add. Usually this is done by stating the $x(n)$ and $(y)$ are independent which implies uncorrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the general case $E(xy)\neq 0$, so the resulting variance could increase or decrease depending on the sign of the correlation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note - stating that $x(n)$ and $y(n)$ are white can be a little unclear. Usually saying $x(n)$ is white implies it is uncorrelated with itself - it does not state how it is correlated to another noise process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above analysis is not dependent on the type of noise (Gaussian or not) and it does not make any assumptions on the autocorrelation functions of $x(n)$ and $y(n)$.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="80" LastEditDate="2016-03-30T14:10:57.233" LastActivityDate="2016-03-30T14:10:57.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29789" PostTypeId="2" ParentId="29785" CreationDate="2016-03-30T14:20:48.487" Score="1" Body="&lt;p&gt;My suggestion is to low pass filter the FFT slices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose your current FFTs are:&#xA;$$&#xA;X(n,k) = {\tt FFT}\{x[n] \cdot w_n[n]\}&#xA;$$&#xA;where your signal is $x[n]$ and the window $w_n[n]$ enforces how much of the signal you want to include in the FFT at time $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then form:&#xA;$$&#xA;Y(n,k) = \alpha \cdot Y(n-1,k)  + (1-\alpha) \cdot X(n,k)&#xA;$$&#xA;where $\alpha$ is a fraction between 0 and 1 (probably around 0.7 to 0.99).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will effectively apply a first order lowpass filter to your FFTs.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another possibility:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y(n,k) = {\tt median}\{X(n,k)\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the median is taken over the last $M$ values of $X(n,k)$ i.e. $\{ X(n,k), X(n-1,k), \ldots, X(N-M+1, k)\}$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-03-30T17:25:17.407" LastActivityDate="2016-03-30T17:25:17.407" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29792" PostTypeId="2" ParentId="29755" CreationDate="2016-03-30T15:15:35.540" Score="3" Body="&lt;p&gt;Correct answer is in the comment already but for completion: Your transfer function is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = b_0 + b_1 \cdot z^{-1}, \mbox{ with } b_0 = 1, b_1 = .9$$&#xA;which makes the inverse&#xA;$$H^{-1}(z) = \frac{1}{b_0 + b_1 \cdot z^{-1}} $$&#xA;which corresponds to the difference equation&#xA;$$y(n) + 0.9 \cdot y(n-1) = x(n) $$ or&#xA;$$y(n) = x(n) -0.9 \cdot y(n-1)  $$ &lt;/p&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="80" LastEditDate="2016-03-30T15:21:28.563" LastActivityDate="2016-03-30T15:21:28.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29793" PostTypeId="2" ParentId="29771" CreationDate="2016-03-30T15:37:54.613" Score="3" Body="&lt;p&gt;The DFT (&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;Discrete Fourier Transform&lt;/a&gt;) of an $N$-point sequence $\left\{x[n]\right\}$ is given as:&#xA;$$X[k]=\sum_{n=0}^{N-1} x[n] e^{-j2\pi kn/N}, \quad k=0, 1, \ldots, N-1\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume the sequence $\left\{x[n]\right\}$ and its DFT are complex, they can be expressed as follows (with the subscript $r$ and $i$ for real and imaginary part respectively): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;x[n] &amp;amp;= x_r[n]+jx_i[n], \quad 0\leq n\leq N-1\\&#xA;X[k] &amp;amp;= X_r[k]+jX_i[k], \quad 0\leq k\leq N-1&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a bit of algebra and using equation $(1)$, you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;X_r[k] &amp;amp;= \sum_{n=0}^{N-1}\left[ x_r[n]\cos\left(\frac{2\pi kn}{N}&#xA;\right)+x_i[n]\sin\left(\frac{2\pi kn}{N}&#xA;\right)\right]\\&#xA;X_i[k] &amp;amp;= -\sum_{n=0}^{N-1}\left[ x_r[n]\sin\left(\frac{2\pi kn}{N}&#xA;\right)-x_i[n]\cos\left(\frac{2\pi kn}{N}&#xA;\right)\right]&#xA;\end{align}&#xA;If the sequence $\left\{x[n]\right\}$ is real-valued, this means $ x[n]=x_r[n]$ as $x_i[n]=0$. The DFT will then be expressed as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1} x[n]\left[\cos\left(\frac{2\pi kn}{N}&#xA;\right)-j\sin\left(\frac{2\pi kn}{N}&#xA;\right)\right]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it can be shown from equation $(1)$ and $(2)$ that for these real-valued signals: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(N-k)=X^*(k)=X(-k)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;From the above results, it suffices to compute the DFT for half of the values of $k$ to get the full characteristic of the spectrum. From the $N$ values you compute &lt;strong&gt;less&lt;/strong&gt; (roughly half) $k$ values. The boundaries of the summation are still the same, it still goes from $n=0$ to $N-1$ but your $k$'s shouldn't go up to $N-1$ as it will be a waste of resources. &#xA;$$X[k]=\sum_{n=0}^{N-1}y[n] e^{-j2\pi kn/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $N$ even, $ 0\leq k \leq N/2$ suffices. With the results from equation $(3)$ you can get the remaining values from $N/2 + 1$ to $N-1$ or from $-N/2 + 1$ to $-1$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have $ 0\leq n \leq N$. So, $y[-N/2]$ does not exist and $y[N/2]$ is the value of your sequence $\left\{y[n]\right\}$ at $n=N/2$ (if $N$ is even).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;However, for a real even sequence $\left\{y[n]\right\}$, the DFT $X[-N/2]$ equals $X[N/2]$ and this is the value at Nyquist.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Also note from equation $(3)$ that if $N$ is even, $X[0]$ and $X[N/2]$ must be real, and if $N$ is odd $X[0]$ is still real but you don't have a frequency bin at exactly $N/2$. Equation $(3)$ applies for real-valued sequences, what has been concluded from that equation doesn't apply for strictly complex-valued sequences. The advantage is that you've saved computations by computing only half of what you need to compute. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-03-31T13:24:35.443" LastActivityDate="2016-03-31T13:24:35.443" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="29794" PostTypeId="2" ParentId="29785" CreationDate="2016-03-30T18:01:08.777" Score="0" Body="&lt;p&gt;If you know how close the frequency bands are that are causing the flicker by beating against each other, you can try to post filter that beat-frequency band out of the sequences of FFTs across time used for the visualization animation.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think filtering before the FFTs will help, since the problem of beating is between adjacent FFT windows, not within the windows, due to the desire to use short windows.  (If two nearby frequency spectra cancel out due to being of opposite phase, nothing you can do in that window will bring them back.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Averaging or a median filtering across window results in time might also help, but that might reduce other frequency transients between windows more than a notch filter and/or band re-assignment (move the beat-frequency band to DC, etc.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-03-30T18:22:36.070" LastActivityDate="2016-03-30T18:22:36.070" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29795" PostTypeId="2" ParentId="25590" CreationDate="2016-03-30T19:42:27.500" Score="1" Body="&lt;p&gt;@Peter K.'s answer is right to the point. You can also have most proposed implementations side-by-side, with comparisons,  in Pascal Getreuer, &lt;a href=&quot;http://dx.doi.org/10.5201/ipol.2013.87&quot; rel=&quot;nofollow&quot;&gt;A Survey of Gaussian Convolution Algorithms&lt;/a&gt;, Image Processing On Line, 2013, with &lt;a href=&quot;http://www.ipol.im/pub/art/2013/87/gaussian_20131215.tgz&quot; rel=&quot;nofollow&quot;&gt;alternative source code&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-03-30T19:42:27.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29796" PostTypeId="2" ParentId="29764" CreationDate="2016-03-30T20:41:48.577" Score="2" Body="&lt;p&gt;A &lt;em&gt;prior&lt;/em&gt; is something that you know &lt;strong&gt;a priori&lt;/strong&gt; (beforehand) about how the system you're looking at works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;em&gt;smoothness prior&lt;/em&gt; means that you know that the image you're looking at will be smooth in a particular way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That paper goes on to say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The term diffusion comes from the idea of propagating local information with smoothness constraints, by analogy with physical phenomena like heat propagation in physical structures. These phenomena can be formalized with PDEs, and diffusion is therefore performed using PDE-based regularization.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So in this case the smoothness that you know about beforehand is enforced using a partial differential equation.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-03-30T20:41:48.577" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29797" PostTypeId="2" ParentId="29771" CreationDate="2016-03-30T20:50:49.860" Score="1" Body="&lt;p&gt;The DFT is one and the same as the DFS.  The DFT maps a discrete and periodic sequence of values with period $N$, that is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n] = x[n+N] \quad \quad \forall n \in \mathbb{Z}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to another discrete and periodic sequence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k] = X[k+N] \quad \quad \forall k \in \mathbb{Z}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the iDFT maps it back.  the discreteness in one domain causes the periodicity in the other domain, and since the mapping is &lt;a href=&quot;https://en.wikipedia.org/wiki/Bijection&quot; rel=&quot;nofollow&quot;&gt;1-to-1&lt;/a&gt;, you can say that periodicity in one domain causes discreteness in the other.  both periodic sequences are fully defined by $N$ complex numbers and a practical iDFT and DFT maps those two finite-length sets of numbers back and forth to each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although not commonly done, it's perfectly okay to generalize the DFT and iDFT to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X[k] = \sum\limits_{n=n_0}^{n_0+N-1} x[n] \ e^{-j 2 \pi nk/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \frac1N \sum\limits_{k=k_0}^{k_0+N-1} X[k] \ e^{j 2 \pi nk/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$n, n_0, k, k_0$ can be any integers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the choice of $k_0 = -\frac{N}{2}$ comes from the convenience of pairing $X[-k]$ to $X[k]$.  since, in general&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X[k] = \Re\{X[k]\} + j \Im\{X[k]\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and if $\Im\{x[n]\}=0$ for all $n$, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X[-k] = X^*[k] = \Re\{X[k]\} - j \Im\{X[k]\} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then you can say, about reconstructing $x[n]$, that if $N$ is even&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \frac1N \sum\limits_{k=-\frac{N}{2}}^{\frac{N}{2}-1} X[k] \ e^{j 2 \pi nk/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if $N$ is odd, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \frac1N \sum\limits_{k=-\frac{N-1}{2}}^{\frac{N-1}{2}} X[k] \ e^{j 2 \pi nk/N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you can sorta plug in $n = f_\text{s} t$ to reconstruct bandlimited $x(t)$ outa $x[n]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the $N$ even case, then you have an extra term at Nyquist, the $k=-\frac{N}{2}$ term,  for that you cannot know both the amplitude and phase of that sinusoid.  you must assume one or the other.  often people only keep the $\cos(\pi f_\text{s} t)$ term at Nyquist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x[n] &amp;amp; = \frac1N \sum\limits_{k=-\frac{N}{2}}^{\frac{N}{2}-1} X[k] \ e^{j 2 \pi nk/N}  \\&#xA; &amp;amp; = \frac1N \left( X[0] + X[N/2] \cos(\pi n) + \sum\limits_{k=1}^{\frac{N}{2}-1} X[k] e^{j 2 \pi nk/N} \ + \ X[-k] e^{-j 2 \pi nk/N} \right) \\&#xA; &amp;amp; = \frac1N \left( X[0] + X[N/2] \cos(\pi n)  \right) \\ &amp;amp; \quad + \frac1N \sum\limits_{k=1}^{\frac{N}{2}-1} (\Re\{X[k]\} + j \Im\{X[k]\}) e^{j 2 \pi nk/N} \ + \ (\Re\{X[k]\} - j \Im\{X[k]\}) e^{-j 2 \pi nk/N} \\&#xA; &amp;amp; = \frac1N \left( X[0] + X[N/2] \cos(\pi n)  \right) \\ &amp;amp; \quad + \frac1N \sum\limits_{k=1}^{\frac{N}{2}-1} 2\Re\{X[k]\} \frac{e^{j 2 \pi nk/N} + e^{-j 2 \pi nk/N}}{2} + j (2j) \Im\{X[k]\} \frac{e^{j 2 \pi nk/N} - e^{-j 2 \pi nk/N}}{2j}   \\&#xA; &amp;amp; = \frac1N \left( X[0] + X[N/2] \cos(\pi n)  \right) \\ &amp;amp; \quad + \frac2N \sum\limits_{k=1}^{\frac{N}{2}-1} \Re\{X[k]\} \frac{e^{j 2 \pi nk/N} + e^{-j 2 \pi nk/N}}{2} - \Im\{X[k]\} \frac{e^{j 2 \pi nk/N} - e^{-j 2 \pi nk/N}}{2j}   \\&#xA; &amp;amp; = \frac1N \left( X[0] + X[N/2] \cos(\pi n)  \right) \\ &amp;amp; \quad + \frac2N \sum\limits_{k=1}^{\frac{N}{2}-1} \Re\{X[k]\} \cos(2 \pi nk/N) - \Im\{X[k]\} \sin(2 \pi nk/N)   \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for $N$ odd, you can go through the same song and dance, but there is no Nyquist term and it comes out as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] = \frac1N X[0] + \frac2N \sum\limits_{k=1}^{\frac{N-1}{2}} \Re\{X[k]\} \cos(2 \pi nk/N) - \Im\{X[k]\} \sin(2 \pi nk/N) $$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;for odd $N$, all of these discrete-time sinusoids can be understood as a properly-sampled &lt;strong&gt;bandlimited&lt;/strong&gt; periodic, continuous-time, real signal, $x(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x[n] \triangleq x(nT) = x(n/f_\text{s}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or setting $ n \leftarrow f_\text{s} t $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \frac1N X[0] + \frac2N \sum\limits_{k=1}^{\frac{N-1}{2}} \Re\{X[k]\} \cos(2 \pi (k/N) f_\text{s} t) - \Im\{X[k]\} \sin(2 \pi (k/N) f_\text{s} t) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when $N$ is even, the Nyquist term is a little more ambiguous:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align}&#xA;x(t) &amp;amp; = \frac1N \left( X[0] + X[N/2] \cos(2 \pi (f_\text{s}/2) t)  \right) \\ &amp;amp; \quad + \frac2N \sum\limits_{k=1}^{\frac{N}{2}-1} \Re\{X[k]\} \cos(2 \pi k f_\text{s} t) - \Im\{X[k]\} \sin(2 \pi k f_\text{s} t)   \\&#xA; &amp;amp; = \frac1N \left( X[0] + X[N/2] \cos(2 \pi (f_\text{s}/2) t)  \right) \\ &amp;amp; \quad + \frac2N \sum\limits_{k=1}^{\frac{N}{2}-1} \Re\{X[k]\} \cos(2 \pi (k/N) f_\text{s} t) - \Im\{X[k]\} \sin(2 \pi (k/N) f_\text{s} t)   \\&#xA; &amp;amp; = \frac1N \left( X[0] + X[N/2] \cos(2 \pi (f_\text{s}/2) t) +  A_x \sin(2 \pi (f_\text{s}/2) t)  \right) \\ &amp;amp; \quad + \frac2N \sum\limits_{k=1}^{\frac{N}{2}-1} \Re\{X[k]\} \cos(2 \pi (k/N) f_\text{s} t) - \Im\{X[k]\} \sin(2 \pi (k/N) f_\text{s} t)   \\&#xA;\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A_x$ can be any number, because that term will be zero at the sampling instances, when $t = nT = n/f_\text{s}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;looking at it from a magnitude/phase POV, for $N$ odd&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ x(t) = \frac{X[0]}{N} + \frac2N \sum\limits_{k=1}^{\frac{N-1}{2}} |X[k]| \cos(2 \pi (k/N) f_\text{s} t + \arg\{X[k]\})  $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and for $N$ even&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \begin{align} x(t) &amp;amp; = \frac{X[0]}{N} +  \frac{X[N/2]}{N \cos(\theta)} \cos(2 \pi (f_\text{s}/2) t + \theta) \\ &amp;amp; \quad + \frac2N \sum\limits_{k=1}^{\frac{N}{2}-1} |X[k]| \cos(2 \pi (k/N) f_\text{s} t + \arg\{X[k]\}) \end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &#xA;$$ \Re\{X[k]\} = |X[k]| \cos(\arg\{X[k]\}) $$&#xA;$$ \Im\{X[k]\} = |X[k]| \sin(\arg\{X[k]\}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or &#xA;$$ |X[k]| = \sqrt{\Re\{X[k]\}^2 + \Im\{X[k]\}^2} $$&#xA;$$ \arg\{X[k]\} = \operatorname{atan2}(\Im\{X[k]\}, \Re\{X[k]\}) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $\theta$ is the phase of the Nyquist component and can be any real value except $\pm \frac{\pi}{2}$ or $\frac{\pi}{2}+ m \pi$ for integer $m$ (because you cannot divide by zero).  the samples $x[n] \triangleq x(n/f_\text{s})$ will come out the same regardless of the phase of the Nyquist component as long as the amplitude of the component is adjusted accordingly by dividing by $\cos(\theta)$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-03-31T06:23:29.483" LastActivityDate="2016-03-31T06:23:29.483" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="29799" PostTypeId="1" CreationDate="2016-03-30T23:10:39.583" Score="0" ViewCount="324" Body="&lt;p&gt;I am interested in calculating the autocorrelation function of a linear map with some noise (model given below) but am slightly confused in doing so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first, I did not realize there were two definitions of the autocorrelation function: one where you subtract the mean of the time series data (often used in statistics), and one where you do not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x(n) = \frac{1}{2}\left(a x(n) + b + \xi\right)$ where $\xi$ is some Gaussian noise with mean zero and standard deviation $\sigma$. One can analytically calculate the autocorrelation function as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\langle x(n+1)x(n)\rangle = \langle \frac{1}{2} (a x(n) + b + \xi_n)x(n)\rangle\\&#xA;= \frac{a}{2}\sigma_x^2 + \frac{b}{2}\mu_x&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where we have used that the noise is uncorrelated with the time series data by assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\langle x(n+2)x(n) \rangle = \frac{a}{2}\langle x(n+1)x(n) \rangle + \frac{b}{2}\langle x(n) \rangle \\&#xA;= \left(\frac{a}{2}\right)^2 \sigma_x^2 + \frac{a}{2}\frac{b}{2}\mu_x + \frac{b}{2}\mu_x&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then generalizing,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\langle x(n+\tau)x(n) \rangle = \left(\frac{a}{2}\right)^\tau\sigma_x^2 + \frac{b}{2}\mu_x\sum_{l=0}^{\tau-1}\left(\frac{a}{2}\right)^l\\&#xA;= \left(\frac{a}{2}\right)^\tau\sigma_x^2 + \frac{b}{2}\mu_x\frac{1 - \left(\frac{a}{2}\right)^\tau}{1-\frac{a}{2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where I've summed the geometric series to arrive at the final result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Autocorrelations are computed using NumPy's &lt;code&gt;fftconvolve&lt;/code&gt; function as &lt;code&gt;acf = fftconvolve(x, x[::-1])&lt;/code&gt; (i.e., convolve the time series data with itself reversed, for anyone not familiar with Python).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I subtract the mean, I get an exponentially decaying autocorrelation function, as depicted in the plot below. This makes sense, given the first term in the analytically derived expression above. Clearly $\mu_x = 0$ after we have subtracted off the mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/7p5ZU.png&quot; alt=&quot;mean subtracted&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, originally, I did not realize I was supposed to subtract the mean, and I found a linearly decaying plot as depicted below. By increasing the duration of the simulation, the line extends seemingly to infinity. Is there a simple explanation for this? It does not fall out of the analytical calculation, so I assume there must be something going on because it is a discrete time series? I am new to this, but I assume there is a simple explanation for this phenomenon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3gFGZ.png&quot; alt=&quot;mean included&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="20309" LastEditorUserId="1629" LastEditDate="2016-05-30T15:02:30.427" LastActivityDate="2016-06-29T15:08:09.473" Title="Autocorrelation of a noisy linear map" Tags="|signal-analysis|fourier-transform|python|autocorrelation|time-series|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29800" PostTypeId="1" CreationDate="2016-03-30T23:27:20.570" Score="1" ViewCount="231" Body="&lt;p&gt;I am trying to get an understanding of autocorrelation and I am having some issues  with trying to understand the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Bernoulli process called $X[t]$. In this process, $P(X[t] = 1) = p$ and $P(X[t] = 0) = 1-p.$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have a new process formed from $X[t]$ that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;Y[t] = \frac 12 \left(X[t] + X[t-1]\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have to find the autocorrelation $r_Y [t+\tau,t]$. Here's what I got so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;r_Y [t+\tau,t]&amp;amp; = E\left(Y[t+\tau]Y[t]\right)\\&#xA;&amp;amp;= \frac 14 E\left\{\left(X[t+\tau] + X[t+\tau-1]\right)\left(X[t] + X[t-1]\right)\right\}\\&#xA;&amp;amp;= \frac 14 \left(r_X[t+\tau,t]+r_X[t+\tau,t-1]+r_X[t+\tau-1,t]+r_X[t+\tau-1,t-1]\right)&#xA;\end{align}&#xA;From there, I can get $r_x[t+\tau,t]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;r_X[t+\tau,t] =&#xA;  \begin{cases}&#xA;    p^2       &amp;amp; \quad \text{if } \tau \neq 0\\&#xA;    p  &amp;amp; \quad \text{if } \tau = 0\\&#xA;  \end{cases}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the wall that I am running into (and maybe it's because it's not making sense to me because of lack of sleep) is how you substitute that expression back into $r_Y[t+\tau,t]$? I know you end up with three different answers, but trying to substitute it back in seems to cause a mess for me. I am hoping someone will help me with that part.&lt;/p&gt;&#xA;" OwnerUserId="20310" LastEditorUserId="1629" LastEditDate="2016-03-31T10:15:16.747" LastActivityDate="2016-03-31T10:15:16.747" Title="Autocorrelation question" Tags="|autocorrelation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29801" PostTypeId="1" CreationDate="2016-03-31T00:03:15.227" Score="5" ViewCount="162" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Is Diffusion-based inpaiting Local or Global?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is Pixel-based inpaiting Local or Global?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is Patch-based inpaiting Local or Global?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can Local-diffusion be used inside Patch-based in-painting problems of Image Processing?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Or, three of them can be applied separately to operate on the same type of problem?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerDisplayName="user18425" LastEditorUserId="128" LastEditDate="2018-08-19T16:27:03.560" LastActivityDate="2024-04-01T20:08:51.070" Title="What are Local and Global Inpainting Techniques in Image Processing?" Tags="|image-processing|inverse-problem|image-restoration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29803" PostTypeId="2" ParentId="29801" CreationDate="2016-03-31T06:10:50.697" Score="0" Body="&lt;p&gt;Usually one could divide the methods according to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Global Method&lt;br&gt;&#xA;The function optimized is all over the image with no local data.&lt;br&gt;&#xA;Namely it finds best solution involving all pixels.&lt;br&gt;&#xA;Diffusion Based is usually iterative method to solve such a Global model.&lt;/li&gt;&#xA;&lt;li&gt;Local Method&lt;br&gt;&#xA;The optimization function is local for a group of patches and holes.&lt;br&gt;&#xA;Most &quot;Patch&quot; based methods are local in their nature.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In practice, state of the art methods combine both approaches.&lt;br&gt;&#xA;Namely global regulator over a local optimization function or the other way around.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2016-03-31T06:10:50.697" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29804" PostTypeId="2" ParentId="28860" CreationDate="2016-03-31T06:15:47.650" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/JPEG_XR&quot; rel=&quot;noreferrer&quot;&gt;JPEG-XR Standard&lt;/a&gt; is using the Walsh Hadamard transform (Instead of DCT / Wavelets).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has pretty good results (Unfortunately, it didn't get enough traction, yet it is supported on Windows).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can follow the standard and have idea how to use it for image compression.&lt;br&gt;&#xA;You'll be able to even get some source code.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2016-03-31T06:15:47.650" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29805" PostTypeId="2" ParentId="24436" CreationDate="2016-03-31T06:18:46.890" Score="3" Body="&lt;p&gt;It sounds like &lt;a href=&quot;http://www.imagemagick.org/&quot; rel=&quot;noreferrer&quot;&gt;ImageMagick&lt;/a&gt; is a good fit for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Give it a try and tell us what you think.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2016-03-31T06:18:46.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29806" PostTypeId="2" ParentId="29774" CreationDate="2016-03-31T06:52:43.903" Score="1" Body="&lt;p&gt;Developing a bit more the previous answer, note that the definition of &lt;strong&gt;continuous FT&lt;/strong&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X(f) = \int_{-\infty}^\infty x(t)\cdot e^{- i 2\pi f t}\,dt$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now, as stated in the previous answer, we can calculate the &lt;strong&gt;DFT&lt;/strong&gt; from the previous equation as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X_T(f)\ \stackrel{\mathrm{def}}{=} \sum_{k=-\infty}^{\infty} X\left(f - k f_s\right) \equiv T \sum_{n=-\infty}^{\infty} x(nT)\ e^{-i 2\pi f T n}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, reciprocally, we can come back to time domain by doing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x(t) = \int_{-\infty}^\infty X(f)\cdot e^{ i 2\pi f t}\,df$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the last equation, the exponential's phase is positive. Actually, that equation is also named &lt;strong&gt;the inverse Fourier Transform&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the negative sign in the exponent indicates the integrated juxtaposed supplements' transpolation. These supplements can be analysed through the application of variance for each function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the FT can be understood as the scalar product between the function x (t) and the complex exponential $e ^ {i2 \pi\,ft}$ evaluated over the entire frequency range f. From the usual interpretation of the scalar product, in those frequencies at which the transform has a higher value, x (t) will look more similar to a complex exponential.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-03-31T06:52:43.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29807" PostTypeId="1" AcceptedAnswerId="29817" CreationDate="2016-03-31T06:56:33.187" Score="5" ViewCount="411" Body="&lt;p&gt;When performing image deconvolution (deblurring), people often make use of priors to get rid of the illness of the problem. One very common prior is total variation, a sparse prior. Compared to Gaussian prior, it is supposed to be better as it concentrate derivatives at a small number of pixels, which fulfill the assumption people have with clear images. So my question is: how can we understand that sparse prior such as total variation concentrate derivatives at a small number of pixels while the Gaussian prior cannot. Thanks. &lt;/p&gt;&#xA;" OwnerUserId="1674" LastEditorUserId="128" LastEditDate="2017-09-27T09:55:23.167" LastActivityDate="2017-09-27T09:55:23.167" Title="Why Sparse Priors Like Total Variation Opts to Concentrate Derivatives at a Small Number of Pixels?" Tags="|image-processing|deconvolution|blind-deconvolution|inverse-problem|sparse-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29808" PostTypeId="2" ParentId="29800" CreationDate="2016-03-31T08:23:29.323" Score="3" Body="&lt;p&gt;It is helpful to realize that the auto-correlation of $X[t]$ does not depend on $t$, just on the time difference $\tau$. So we can write it as $r_X(\tau)$. Your result, which is correct, can then be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E(Y[t+\tau]Y[t])=\frac14\left(r_X(\tau)+r_X(\tau+1)+r_X(\tau-1)+r_X(\tau)\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the expression for $r_X(\tau)$, which is correctly given in your question, $(1)$ can be simplified to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E(Y[t+\tau]Y[t])=\begin{cases}\frac{p}{2}(1+p),&amp;amp;\tau=0\\&#xA;\frac{p}{4}(1+3p),&amp;amp;\tau\in\{-1,1\}\\p^2,&amp;amp; \text{otherwise}\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is of course also independent of $t$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-31T08:23:29.323" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29809" PostTypeId="1" AcceptedAnswerId="29824" CreationDate="2016-03-31T08:43:32.620" Score="0" ViewCount="1178" Body="&lt;p&gt;&lt;em&gt;Note: This question may seem extremely elementary, but I am &lt;strong&gt;not&lt;/strong&gt; a beginner to signal processing, linear system theory, control theory, etc.&lt;/em&gt;&#xA;&lt;em&gt;I believe my confusion is over a subtle point, so, before responding, please read the entire question so you understand the source of my confusion first.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Consider this simple autonomous system (&lt;a href=&quot;https://en.wikipedia.org/wiki/Autonomous_system_(mathematics)#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;autonomous means it has no direct dependence on $t$&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\dot{x}(t) = A x(t)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the output is the state ($y(t) = x(t)$) and $A \neq 0$. My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is this system necessarily linear?&lt;/li&gt;&#xA;&lt;li&gt;Is this system necessarily time-invariant?&lt;/li&gt;&#xA;&lt;li&gt;What is the &lt;em&gt;zero-input response&lt;/em&gt; of this system?  &lt;/li&gt;&#xA;&lt;li&gt;Would the answers above change if we assumed the system was causal?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Easy, right?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://see.stanford.edu/materials/lsoeldsee263/09-auto-sys.pdf#page=2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Obviously yes, since it is in the form $\dot{x}(t) = Ax(t)$&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://see.stanford.edu/materials/lsoeldsee263/09-auto-sys.pdf#page=2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Obviously yes, since $A$ does not depend on $t$&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;The zero-input response is: $x(t) = x(0)\,e^{At}$&lt;/li&gt;&#xA;&lt;li&gt;No, these are unrelated properties.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But wait&lt;/strong&gt;!&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Linearity means a linear combination of the inputs must give the same linear combination of the outputs. If I scale the input, $u$, then $x$ is not affected at all. So how can it be linear?!&lt;/li&gt;&#xA;&lt;li&gt;Time-invariance means that if I delay the input, the output is delayed by the same amount of time. But if I delay the input, $u$, then $x$ is not affected at all. So how can it be time-invariant?!  &lt;/li&gt;&#xA;&lt;li&gt;If the initial state is an &quot;input&quot;: Doesn't linearity imply $x(0) = 0 \implies x(t) = 0$?&lt;br&gt;&#xA;If the initial state isn't  an &quot;input&quot;: Isn't the system nonlinear unless $x(0) = 0$? (see #1)&lt;/li&gt;&#xA;&lt;li&gt;Wouldn't &lt;em&gt;zero-input&lt;/em&gt; give &lt;em&gt;zero-output&lt;/em&gt; for a causal LTI system (the &quot;ZIZO&quot; property)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hopefully it's clear why I'm confused.&lt;br&gt;&#xA;Where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="310" LastEditorUserId="310" LastEditDate="2018-09-12T00:19:26.043" LastActivityDate="2018-09-12T00:19:26.043" Title="Very basic questions about linear systems" Tags="|linear-systems|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="29810" PostTypeId="1" CreationDate="2016-03-31T09:21:02.367" Score="0" ViewCount="309" Body="&lt;p&gt;Suppose I have discrete noisy signal $X = (0.096, -0.0632, 0.351, 0.531, 0.360, 0.006, -0.320)$ sampled at discrete time points $T = (1, 2, 3, 4, 5, 6, 7)$. Filtering (zero-padded) $X$ with symmetrical FIR $G = (\frac{1}{4}, \frac{1}{2}, \frac{1}{4})$ gives me a good approximation of underlying $f(t)$ but only at discrete time points $T$. Is it possible to use filter coefficients to approximate the values of $f(t)$ between discrete values, e.g. estimate $f(\sqrt 2)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://dsp.stackexchange.com/questions/6372/interpolation-with-an-fir-filter&quot;&gt;Interpolation with an FIR filter&lt;/a&gt; user Hilmar mentions Whittaker–Shannon interpolation formula, but it is sensitive to noise. Is it possible to construct smooth but more noise-robust interpolation by using FIR coefficients somehow?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, separate interpolation step (e.g. spline or polynomial interpolation) after FIR application is the only practical way to go?&lt;/p&gt;&#xA;" OwnerUserId="20319" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-03-31T12:26:07.780" Title="Inter-point interpolation using FIR filter" Tags="|interpolation|finite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29812" PostTypeId="2" ParentId="29810" CreationDate="2016-03-31T09:32:29.510" Score="0" Body="&lt;p&gt;The filter you are applying is a lowpass. So noise is high frequency?&#xA;You could just do an upsampling of your signal and set the cutoff frequency of the lowpass, that is required for upsampling, to the lowest frequency of the noise.&#xA;Then you have two tasks in one step: de-noising and interpolating.&lt;/p&gt;&#xA;" OwnerUserId="20297" LastActivityDate="2016-03-31T09:32:29.510" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29813" PostTypeId="2" ParentId="29809" CreationDate="2016-03-31T09:42:11.077" Score="2" Body="&lt;p&gt;The state-space model of a causal continuous-time LTI system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\dot{x}(t)&amp;amp;=Ax(t)+bu(t)\\y(t)&amp;amp;=cx(t)+du(t)\tag{1}\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $x(t)$ is the state (vector), $u(t)$ is the input, and $y(t)$ is the output.&#xA;If the state $x(t)$ is a length $N$ vector, then $A$ is an $N\times N$ matrix, and $c$ is a $1\times N$ matrix (or row-vector, if you like).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, $b=0$, $c=0$, and $d=0$. So there is basically no input and no output. We can only observe the state, i.e., the &quot;internal behavior&quot; of the system. We can only talk about linearity and time-invariance concerning the states. If $A$ is constant, the system is linear and time-invariant in that sense. But since we can't observe a response to an input signal it is impossible to talk about linearity and time-invariance of the system in terms of its input/output behavior. And, consequently, the corresponding tests become pointless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And concerning point 4. in your question: yes, an LTI system must have zero output for zero input. It is a non-zero initial state that can produce a non-zero output for zero-input, but with a non-zero initial state, a system is not LTI anymore. If it is LTI otherwise (apart from the non-zero initial state), then it can be modeled as LTI by representing the non-zero initial state as an additional input to the LTI system (which must now have a zero initial state, otherwise it couldn't be LTI).&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-03-31T09:42:11.077" CommentCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="29814" PostTypeId="1" CreationDate="2016-03-31T10:46:53.963" Score="3" ViewCount="348" Body="&lt;p&gt;I have a long signal (1 day sampled at 500 Hz), which results in many frequencies if I calculate the amplitude spectrum (see e.g. &lt;a href=&quot;https://electronics.stackexchange.com/questions/12407/what-is-the-relation-between-fft-length-and-frequency-resolution&quot;&gt;here&lt;/a&gt;). However, I am only interested in the &quot;big picture&quot;, let's say only frequencies of natural numbers (i.e. 1, 2, ..., 250 Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I simply remove all other frequencies? Should I do something like a binning? Or is there even a better solution?&lt;/p&gt;&#xA;" OwnerUserId="20320" LastEditorUserId="-1" LastEditDate="2017-04-13T12:33:07.187" LastActivityDate="2016-03-31T12:34:24.503" Title="Reduce the number of frequencies after FFT" Tags="|fft|frequency-spectrum|resolution|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29815" PostTypeId="2" ParentId="29799" CreationDate="2016-03-31T11:55:02.020" Score="1" Body="&lt;p&gt;I believe the issue is just that when using NumPy you're using finite duration data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example shows what I mean. It starts with a 100-vector of 1s and takes the correlation as you suggest.  The resulting output is definitely not a constant, but a triangle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because, in python, you're using finite duration data. So any constant (DC) value will show up like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; #&#xA; # Example for correlation of a &quot;constant&quot; value.&#xA; #&#xA; #&#xA; import numpy&#xA; import scipy.signal&#xA;&#xA; x = numpy.empty(100); x.fill(1)&#xA;&#xA; acf = scipy.signal.fftconvolve(x, x[::-1])&#xA;&#xA; print acf&#xA;&#xA; # OUTPUT:&#xA; #&#xA; #[  1.   2.   3.   4.   5.   6.   7.   8.   9.  10.  11.  12.  13.  14.  15.&#xA; #  16.  17.  18.  19.  20.  21.  22.  23.  24.  25.  26.  27.  28.  29.  30.&#xA; #  31.  32.  33.  34.  35.  36.  37.  38.  39.  40.  41.  42.  43.  44.  45.&#xA; #  46.  47.  48.  49.  50.  51.  52.  53.  54.  55.  56.  57.  58.  59.  60.&#xA; #  61.  62.  63.  64.  65.  66.  67.  68.  69.  70.  71.  72.  73.  74.  75.&#xA; #  76.  77.  78.  79.  80.  81.  82.  83.  84.  85.  86.  87.  88.  89.  90.&#xA; #  91.  92.  93.  94.  95.  96.  97.  98.  99. 100.  99.  98.  97.  96.  95.&#xA; #  94.  93.  92.  91.  90.  89.  88.  87.  86.  85.  84.  83.  82.  81.  80.&#xA; #  79.  78.  77.  76.  75.  74.  73.  72.  71.  70.  69.  68.  67.  66.  65.&#xA; #  64.  63.  62.  61.  60.  59.  58.  57.  56.  55.  54.  53.  52.  51.  50.&#xA; #  49.  48.  47.  46.  45.  44.  43.  42.  41.  40.  39.  38.  37.  36.  35.&#xA; #  34.  33.  32.  31.  30.  29.  28.  27.  26.  25.  24.  23.  22.  21.  20.&#xA; #  19.  18.  17.  16.  15.  14.  13.  12.  11.  10.   9.   8.   7.   6.   5.&#xA; #   4.   3.   2.   1.]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://moodle.cecs.pdx.edu/pluginfile.php/1102/mod_resource/content/0/Slides/Autocorrelation.pdf&quot; rel=&quot;nofollow&quot;&gt;This is why sometimes&lt;/a&gt;, rather than using the biased estimator of autocorrelation:&#xA;$$&#xA;\hat\rho[m] = \frac{1}{N} \sum_{n=0}^{N-1-|m|} x[n+m]x[n]&#xA;$$&#xA;the unbiased estimator is used:&#xA;$$&#xA;\hat\rho_{\tt u}[m] = \frac{1}{N-|m|} \sum_{n=0}^{N-1-m} x[n+|m|]x[n]&#xA;$$&#xA;which effectively applies an inverse triangular window to the biased estimator.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-03-31T12:21:27.407" LastActivityDate="2016-03-31T12:21:27.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29816" PostTypeId="2" ParentId="29810" CreationDate="2016-03-31T12:12:30.307" Score="1" Body="&lt;p&gt;From Hilmar's answer to &lt;a href=&quot;https://dsp.stackexchange.com/questions/6372/interpolation-with-an-fir-filter&quot;&gt;the linked question&lt;/a&gt;, the Whittaker–Shannon interpolation formula is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$x(t)=\sum_{n=-\infty }^{\infty }x[n]\cdot \operatorname{sinc}\left(\frac{t-nT}{T}\right).$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If the signal is low-pass and the noise is high-pass, to filter high-pass noise, we can make a low-pass version of the interpolation formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{n=-\infty }^{\infty }x[n]\cdot 2f_c/f_s\cdot \operatorname{sinc}\left(\frac{t-2f_c/f_s\cdot nT}{T}\right),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f_c$ is the cutoff frequency and $f_s$ is the sampling frequency. The highest signal-to-noise ratio is obtained by setting the cutoff frequency to a frequency for which the signal and the noise have equal power. Actually the Whittaker–Shannon interpolation formula is low-pass as well, with $f_c=f_s/2$.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-03-31T12:26:07.780" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29817" PostTypeId="2" ParentId="29807" CreationDate="2016-03-31T12:22:17.350" Score="3" Body="&lt;p&gt;I will divide my answer into 3 sections.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The Distribution of the Derivative of Images&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Take a real world image, any image.&lt;br&gt;&#xA;Apply the derivative operator on it (Namely apply the kernel $ \left[ 1, -1 \right] $ on it.&lt;br&gt;&#xA;Display the histogram of the filtered image.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hLPA3.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hLPA3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The histogram I got is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qBbwY.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qBbwY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This distribution is very similar to &lt;a href=&quot;https://en.wikipedia.org/wiki/Laplace_distribution&quot; rel=&quot;noreferrer&quot;&gt;Laplace Distribution&lt;/a&gt;.&lt;br&gt;&#xA;Clearly, this distribution is &quot;Sparse&quot; namely most of the values are 0 (Or close) and very few are different.&lt;br&gt;&#xA;In real world we assume most of the values which are small yet not zero are actually due to the noise.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Total Variation Optimization Problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Look at the Optimization Function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{x} = \arg \min_{x} {\| Hx -y \|}^{2} + \lambda {\| G x \|}_{1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ H $ is the Blur Operator and $ G $ is the Derivative Operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can look at it in the Sparse sense or you can look at it as the MAP solution given a Laplace prior for the Gradient.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As written above, it fits very well to real world images.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Sparse Optimization&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Look at the Optimization Function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{x} = \arg \min_{x} {\| Hx -y \|}^{2} + \lambda {\| G x \|}_{0} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ H $ is the Blur Operator and $ G $ is the Derivative Operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This optimization problem clearly promote Sparse solution (With respect to the Derivative).&lt;br&gt;&#xA;Yet, this is a very hard problem to solve.&lt;br&gt;&#xA;Hence it was shown that under some circumstances the solution of the problem with $ {\ell}_{1} $ coincide with this solution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, by looking at the Unit Sphere of different norms (And the Pseudo Norm $ {\ell}_{o} $, or more correctly Cardinality Function) you can see why the lower the norm the Sparse Solution it promotes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all you have many point of view on the same problem.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2017-09-14T10:42:25.840" LastActivityDate="2017-09-14T10:42:25.840" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29818" PostTypeId="2" ParentId="29814" CreationDate="2016-03-31T12:28:41.673" Score="4" Body="&lt;p&gt;Apply a sliding window function of 500 samples length to the signal, for example a Hamming window. Choose a suitable overlap between windows e.g. 75%. Calculate the spectrum of each window and then average over all windows. Then the frequency bins lie exactly at the natural numbers as you wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But beware: each bin does not only represent one exact frequency, but the energy in a frequency band, in this case  $[f-0.5,f+0.5]$Hz&lt;/p&gt;&#xA;" OwnerUserId="20297" LastEditorUserId="20297" LastEditDate="2016-03-31T12:34:24.503" LastActivityDate="2016-03-31T12:34:24.503" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29819" PostTypeId="1" CreationDate="2016-03-31T12:51:54.047" Score="1" ViewCount="236" Body="&lt;p&gt;Hello friends am studying the topic of signal processing and the Fourier transform and the s-transform and in most books as for example &quot;Time-Frequency Signal Analysis and Processing. 2nd&quot; of Boashash in section 5.11.2.3 says that these transforms retain the absolute phase information of the signal and I do not understand that it mean with this concept about retain the absolute phase information of the signal and why this is important?.&lt;/p&gt;&#xA;" OwnerUserId="20278" LastActivityDate="2016-03-31T14:12:00.410" Title="Why Fourier transform and Stockwell-transform retain the absolute phase information of one signal?" Tags="|signal-analysis|fourier-transform|signal-detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29820" PostTypeId="2" ParentId="29819" CreationDate="2016-03-31T13:25:49.763" Score="2" Body="&lt;p&gt;It simply means that for a signal:&#xA;$$&#xA;x(t) = a(t) e^{j\phi(t)}&#xA;$$&#xA;that the phase information $\phi(t)$ is completely preserved in the transform &#xA;domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time-frequency representations that use a &lt;a href=&quot;https://en.wikipedia.org/wiki/Time%E2%80%93frequency_representation#Quadratic_forms&quot; rel=&quot;nofollow&quot;&gt;quadratic form&lt;/a&gt; do not necessarily have this property:&#xA;$$&#xA;x(t+\tau)x^*(t-\tau) = a(t+\tau)a(t-\tau)e^{j(\phi(t+\tau) - \phi(t-\tau))}&#xA;$$&#xA;so if $\phi$ is of the form:&#xA;$$&#xA;\phi(t) = f(t) + C&#xA;$$&#xA;where $C$ is a constant, then $C$ is not preserved in $x(t+\tau)x^*(t-\tau)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is important because sometimes you are interested in the absolute phase of a signal, not just its relative phase.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-03-31T14:12:00.410" LastActivityDate="2016-03-31T14:12:00.410" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29821" PostTypeId="1" AcceptedAnswerId="32394" CreationDate="2016-03-31T14:22:04.123" Score="1" ViewCount="361" Body="&lt;p&gt;I am trying the DC blocking function in matlab. The algorithm of DC blocking is to find DC of the signal first and then remove the DC value from the signals. Here are the codes I tried, which are sample codes from Matlab:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  t         = (0:0.001:10000)';&#xA;  x         = sin(30*pi*t) + 1;&#xA;&#xA;  hDCBlock1 = dsp.DCBlocker('Order', 4);  % IIR is default&#xA;  hDCBlock2 = dsp.DCBlocker('Algorithm', 'FIR', 'Length', 100);&#xA;  hDCBlock3 = dsp.DCBlocker('Algorithm', 'Subtract mean');&#xA;  for idx = 1 : 10&#xA;    range = (1:1000) + 1000*(idx-1);&#xA;    y1 = step(hDCBlock1, x(range));&#xA;    y2 = step(hDCBlock2, x(range));&#xA;    y3 = step(hDCBlock3, x(range));&#xA;  end&#xA;  plot(t(1:1000),x(1:1000),...&#xA;    t(1:1000),y1, ...&#xA;    t(1:1000),y2, ...&#xA;    t(1:1000),y3);&#xA;  legend(sprintf('Input DC:%.3f',    mean(x)), ...&#xA;    sprintf('IIR DC:%.3f',           mean(y1)), ...&#xA;    sprintf('FIR DC:%.3f',           mean(y2)), ...&#xA;    sprintf('Subtract mean DC:%.3f', mean(y3)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to adjust the length of data and order of the IIR, the DC given by IIR always returns a bias error. However the FIR and mean does not, or gives very little errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone explain on this?&lt;/p&gt;&#xA;" OwnerUserId="10200" LastActivityDate="2016-07-30T15:23:33.163" Title="Comparing with FIR, why does IIR always gives a bias error, when calculating signal DC?" Tags="|infinite-impulse-response|finite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29822" PostTypeId="1" CreationDate="2016-03-31T15:37:06.253" Score="1" ViewCount="143" Body="&lt;p&gt;WSOLA, basically, is the same as OLA but with a dynamic hop size. That part is clear to me. What is not so clear is the following: The stretching factor is determined by alpha = Hs / Ha and WSOLA uses a small increment, obtained through cross-correlation, to determine where the next input frame will be extracted. If that's the case, doesn't that small increment introduce a deviation between the requested alpha and the real one? After all, that increment determines a new analysis hop size, Ha' = Ha + incr, meaning that, if we maintain the same synthesis hop size, the alpha will change.&lt;/p&gt;&#xA;" OwnerUserId="16111" LastActivityDate="2016-05-31T03:41:44.320" Title="Impact of the WSOLA analysis increment on the time stretching factor" Tags="|sola|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29823" PostTypeId="1" CreationDate="2016-03-31T16:38:46.370" Score="4" ViewCount="8622" Body="&lt;p&gt;Recently, convolutional neural network based, &lt;em&gt;deep&lt;/em&gt; architectures (DNN) such as &lt;a href=&quot;http://www.cs.toronto.edu/~fritz/absps/imagenet.pdf&quot;&gt;AlexNet&lt;/a&gt; and &lt;a href=&quot;http://arxiv.org/pdf/1409.1556.pdf&quot;&gt;VGGnet&lt;/a&gt; have been very successful in image classification challenges (e.g. &lt;a href=&quot;http://www.image-net.org/&quot;&gt;ImageNet&lt;/a&gt;) and action recognition/video classification tasks. They surpassed hand-crafted feature-based approaches by a large margin in various cases, and thus became the new state-of-the-art approach for many computer vision problems, including but not limited to classification, object detection, and action recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the state-of-the-art DNN papers, the focus is mostly on achieving a better classification or detection accuracy, whereas the complexity of the model and computational issues stay rather in the background. This made me think whether these DNN-based approaches would be suitable in future real-time action recognition applications (e.g. video surveillance, pedestrian detection etc.) where the test time speed is of utmost importance. It is very important, for example, whether an algorithm can classify the captured video in real-time and respond very quickly to the classification decision to take some pre-determined action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any DNN-based action recognition algorithms published so far that can satisfy these criteria about real-time operation (possibly even at the expense of classification accuracy)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe for many practical applications, achieving real-time or even faster-than-real-time performance is and will be much more important than providing marginally more accurate classification results compared to the previous state-of-the-art-.&lt;/p&gt;&#xA;" OwnerUserId="8751" LastActivityDate="2016-06-19T19:08:55.200" Title="Can deep neural networks achieve real-time video analysis?" Tags="|computer-vision|real-time|neural-network|deep-learning|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29824" PostTypeId="2" ParentId="29809" CreationDate="2016-03-31T18:39:28.297" Score="2" Body="&lt;p&gt;LDSs are systems &lt;em&gt;of differential equations&lt;/em&gt;. For such things the terms &quot;linear&quot; and &quot;time-invariant&quot; have different definitions when compared with control theory or signal processing. For example &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_differential_equation&quot; rel=&quot;nofollow&quot;&gt;linearity&lt;/a&gt; means &lt;code&gt;having solutions which can be added together in particular linear combinations to form further solutions&lt;/code&gt;. For example &lt;a href=&quot;https://en.wikipedia.org/wiki/Autonomous_system_(mathematics)&quot; rel=&quot;nofollow&quot;&gt;time-invariant&lt;/a&gt; means &lt;code&gt;when the [independent] variable is time, they are also called time-invariant systems.&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-03-31T18:39:28.297" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29825" PostTypeId="1" CreationDate="2016-03-31T20:40:35.920" Score="2" ViewCount="484" Body="&lt;p&gt;I have been reading about various telecommunications technologies and one thing keeps being repeated many times without a clear explanation - that spread spectrum is not only resistant to multipath interference, but that it can even use it to improve recovery of the data being transmitted. This is frequently mentioned in articles about LTE or DVB-T.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this work? I can imagine that something like autocorrelation could be used, but I'm also pretty sure that this is not the way it's done.&lt;/p&gt;&#xA;" OwnerUserId="20328" LastActivityDate="2016-03-31T23:22:32.620" Title="Multipath resistance of spread spectrum systems" Tags="|frequency-spectrum|ofdm|multipath|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29826" PostTypeId="2" ParentId="29825" CreationDate="2016-03-31T20:58:52.443" Score="4" Body="&lt;p&gt;The key idea in spread-spectrum communications is to use much more bandwidth than the minimum required for the signal being sent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multipath effects occur when the sent signal $s(t)$ and a delayed, attenuated version of it interfere at the receiver:&#xA;$$&#xA;r(t) = s(t) + \alpha \cdot s(t-\tau)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $s(t)$ is really narrow band (a sinusoid), and $\alpha = 1$, then &#xA;$$&#xA;r(t) = \sin(\omega t) + \sin(\omega(t+\tau))&#xA;$$&#xA;and if $\omega\tau = \pi$ you can get perfect nulling:&#xA;$$&#xA;r(t) = \sin(\omega t) + \sin(\omega t + \pi) = 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, however, $s(t)$ is not a simple sinusoid, then perfect nulling can be eliminated:&#xA;$$&#xA;r(t) = [\sin(\omega t) + \sin(\omega_2 t) ] + [\sin(\omega(t+\tau)) + \sin(\omega_2 (t+\tau)) ]&#xA;$$&#xA;even if  $\omega\tau = \pi$, if $\omega_2$ is chosen well, then $\omega_2\tau \ne \pi$ so there is still some signal to receive.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-03-31T20:58:52.443" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29828" PostTypeId="2" ParentId="29825" CreationDate="2016-03-31T23:22:32.620" Score="1" Body="&lt;p&gt;LTE uses OFDM.  OFDM with a long enough cyclic prefix turns multipath distortion into a large number of flat fading channels at slightly different frequencies.  An OFDM system can either dynamically re-assign channels that have faded below some allowed S/N, or use some sort of redundancy (an ECC or error correcting code) across channels.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-03-31T23:22:32.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29829" PostTypeId="1" CreationDate="2016-03-31T23:55:25.247" Score="0" ViewCount="6820" Body="&lt;p&gt;I need to know what is the absolute phase and the relative phase, of a signal? &#xA;and why these phases are important in the signal processing?&lt;/p&gt;&#xA;" OwnerUserId="20278" LastActivityDate="2016-11-27T17:58:31.337" Title="What is the absolute phase and the relative phase, of a signal?" Tags="|signal-analysis|phase|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29830" PostTypeId="2" ParentId="29823" CreationDate="2016-04-01T00:18:23.850" Score="7" Body="&lt;p&gt;Nvidia seems to have published some white papers comparing DNN inference performance between high-powered CPUs and (of course) Nvidia GPUs.  (&lt;a href=&quot;http://www.nvidia.com/content/tegra/embedded-systems/pdf/jetson_tx1_whitepaper.pdf&quot;&gt;one example&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ballpark seems to be that some systems can meet or exceed typical video frame rate thru-put for some class of DNN classification tasks.  Whether those image sizes and/or DNN architectures and hyperparameters meets your needs is one question, and whether desktop/server-class GPUs fit your desired power envelope is another question.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-01T00:42:27.557" LastActivityDate="2016-04-01T00:42:27.557" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29831" PostTypeId="1" CreationDate="2016-04-01T00:26:35.727" Score="1" ViewCount="45" Body="&lt;p&gt;&lt;a href=&quot;http://www.cns.nyu.edu/pub/eero/simoncelli91-reprint.pdf&quot; rel=&quot;nofollow&quot;&gt;Simoncelli's &quot;Shiftable multi-scale transforms&quot; paper&lt;/a&gt; talks about shiftability of the parameters of a wavelet transform, in particular translation, rotation and scale. The first two are used in his steerable pyramid decomposition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point to an example of a filterbank used for the latter - scale shiftability? I have used sin and cos (Fourier series) as radial basis functions, but I wonder if there is a better set that have been optimised for some property, e.g. space-frequency localisation.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="80" LastEditDate="2016-04-01T14:25:33.110" LastActivityDate="2016-04-01T14:25:33.110" Title="Example of radial frequency functions that give scale shiftability" Tags="|wavelet|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29832" PostTypeId="2" ParentId="29829" CreationDate="2016-04-01T02:55:53.843" Score="1" Body="&lt;ul&gt;&#xA;&lt;li&gt;&quot;Absolute phase&quot; is really relative phase to a point in time at which the phase measurement is referenced (Noon GMT on Tuesday, the first sample in a time-domain window of sample data for instance, or maybe the middle sample in a vector).  &lt;/li&gt;&#xA;&lt;li&gt;Relative phase can also be measured with respect to another waveform of the exact same constant frequency, as the difference in phase measurement between the two waveforms at any one point will be the same at all other points, as long as the two frequencies stay identical.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Phase is important because it is one of the 3 parameters needed in an equation that completely describes a sinusoid.  Without phase information, the waveform is ambiguous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(t) = a\cdot \cos\left(b\cdot t + \phi_{t_0}\right), \quad \text{ where }\phi_{t_0} \text{is the phase at time } t = t_0.$$&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-11-27T17:58:31.337" LastActivityDate="2016-11-27T17:58:31.337" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29833" PostTypeId="2" ParentId="29822" CreationDate="2016-04-01T03:16:50.287" Score="2" Body="&lt;p&gt;Yes, there can be jitter between the requested alpha and the one provided by WSOLA; but that jitter will average out over the long run, and the peak jitter is bounded by on the order of twice the lowest frequency (half the longest period) accepted by the autocorrelation algorithm.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-01T03:16:50.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29834" PostTypeId="2" ParentId="29821" CreationDate="2016-04-01T05:29:42.503" Score="0" Body="&lt;p&gt;The IIR has a tail that gets cut and discarded at the end of the array. Taking into account the tail in the mean calculation would probably show zero mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your sine is ascending in the beginning of the array and descending at the end of the array, symmetrically, and this probably makes the discarded non-zero FIR outputs outside the array cancel each other.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-04-01T05:45:49.833" LastActivityDate="2016-04-01T05:45:49.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29835" PostTypeId="1" AcceptedAnswerId="29836" CreationDate="2016-04-01T06:26:42.713" Score="1" ViewCount="359" Body="&lt;p&gt;I have seen a $1^{\rm st}$ order IIR filter in the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = \alpha x[n] + (1 - \alpha) y[n - 1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such as: &lt;a href=&quot;https://dsp.stackexchange.com/questions/378/what-is-the-best-first-order-iir-approximation-to-a-moving-average-filter&quot;&gt;another post in this forum&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the filters generated by Matlab, such as &lt;code&gt;[b,a] = ellip(1,1,10,0.1);&lt;/code&gt; usually have following format:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = b_1 x[n] + b_2 x[n-1]-a_2 y[n - 1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a $x[n-1]$ case in the second format. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;May I know why there is such a difference? &lt;/li&gt;&#xA;&lt;li&gt;Is it possible to deduce one format from the other?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10200" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-04-01T10:30:46.530" Title="Shall a $1^{\rm st}$ order IIR filter include $x[n-1]$ term?" Tags="|matlab|filters|infinite-impulse-response|digital-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29836" PostTypeId="2" ParentId="29835" CreationDate="2016-04-01T08:11:51.953" Score="3" Body="&lt;p&gt;A filter described by the difference equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=bx[n]+ay[n-1]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is just a special case of a first-order filter. Its transfer function is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{b}{1-az^{-1}}=\frac{bz}{z-a}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which you can see that it has one pole (at $z=a$) and one zero (at $z=0$). A more general first-order filter has a zero that is not necessarily at the origin of the $z$-plane:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z)=\frac{b_0z+b_1}{z-a}\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the zero is at $z=-b_1/b_0$.&#xA;This corresponds to the more general first-order difference equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=b_0x[n]+b_1x[n-1]+ay[n-1]\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that $(1)$ and $(2)$ are just special cases of $(4)$ and $(3)$ with $b_1=0$.&#xA;So both filters you mentioned in your question are first-order filters, but the first one is a special case because its zero is at $z=0$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-04-01T08:16:57.243" LastActivityDate="2016-04-01T08:16:57.243" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29837" PostTypeId="1" CreationDate="2016-04-01T08:45:02.577" Score="3" ViewCount="1727" Body="&lt;p&gt;I'm doing a student research project connected with VAD.&#xA;And I want to find speech corpora with added noise.&#xA;I found many references to the NIST Speaker Recognition Corpora. But unfortunately, all links on main site are already dead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe someone has this Corpora? Or someone can recommend a good Corpora with noise?&lt;/p&gt;&#xA;" OwnerUserId="20331" LastEditorUserId="80" LastEditDate="2016-04-01T15:10:43.357" LastActivityDate="2017-11-09T12:37:37.470" Title="Speech corpora for VAD" Tags="|dsp-core|speech-recognition|speech-processing|speech|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29839" PostTypeId="1" CreationDate="2016-04-01T09:28:49.003" Score="1" ViewCount="172" Body="&lt;p&gt;I am really struggling to see how the lecturer took this transfer function and produced the bode plot that I have in my notebook. It is not the plotting so much that is confusing, I just don't understand how he manipulated the transfer function into this form that he did and why it needed to be in that form in the first place when it looked solvable in its original form.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\textrm{(b)}\quad T(s) = 180\displaystyle\frac{s(1+0.01s)}{(1+0.05s)(1+0.001s)}$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Looking at the transfer function shown I would have thought that all one would simply need to do is evaluate the gain at $20\log(180)$ and then plot the bode plot using the two zeros and two poles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supposedly to plot the asymptotic bode plot for this function correctly one needs to get it into the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$3600\times\frac{\left(\frac s{20}\right)\left(1+\frac s{100}\right)}{\left(1+\frac s{20}\right)\left(1+\frac s{1000}\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the bad format but basically the answer provided has it rising to its pole at $20$ on the $71\textrm{ dB}$ line and going flat until it hits $100 \textrm{ rad/s}$ and then rising up again at $20\textrm{ dB}$ per decade until it meets its pole at $1000$. I don't understand what is going on and everything I have written hitherto is just my observation of how the lecturer demonstrated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone with any knowledge on the mechanics of plotting bode plots by hand could shed some light on this for me I'd greatly appreciate it.&#xA;Simon.&lt;/p&gt;&#xA;" OwnerUserId="18974" LastEditorUserId="1629" LastEditDate="2016-04-01T11:25:13.410" LastActivityDate="2016-04-01T12:40:09.393" Title="Asymptotic bode plots" Tags="|transfer-function|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29840" PostTypeId="2" ParentId="29839" CreationDate="2016-04-01T10:24:42.270" Score="1" Body="&lt;p&gt;Quick Answer cause I'm at work and don't have time to do the plotting but basically, in equation b you already have the expression i what i like to call &quot;The Bode Form&quot;, to only a gain and terms of the form $(1+s/A)$ with $A$ some value. I'm sure the professor explained this, that when you take logarithm you add and subtract all this different terms because the log turns multiplication into addition and division into subtraction, etc. This individual terms, When $s &amp;lt; A$ are approximately equal to 1 (a constant line at 0db Gain in the plot), and when$ s &amp;gt; A$ are approximately equal to $s/A$ ( a 20db/decade drop in the gain).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the plot would be an increasing line of 20db/decade from  up to your first pole at 20 rad/s, where the gain would be $20\log_{10}(3600)$, and then it would remain at that until 100 rad/s where the next pole appears which again makes the gain drop at 20db/decade, and then at the next pole at 1000 rad/s it drops at 40db/decade and that's it, that's your plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you maybe put up the image you have in your notebook so everyone could see what the professor did.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Attempt at illustrating below. &lt;a href=&quot;https://www.youtube.com/watch?v=XsmWHkojyIY&quot; rel=&quot;nofollow noreferrer&quot;&gt;This video may be instructive.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/71atA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/71atA.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7599" LastEditorUserId="80" LastEditDate="2016-04-01T12:40:09.393" LastActivityDate="2016-04-01T12:40:09.393" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29841" PostTypeId="1" CreationDate="2016-04-01T10:47:13.387" Score="0" ViewCount="206" Body="&lt;p&gt;Split from thread: &lt;a href=&quot;https://dsp.stackexchange.com/questions/29430/correcting-impulse-invariance-method&quot;&gt;Correcting Impulse Invariance Method&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Back to this subject. Matt L suggested combining IIM and MZT b-coeffs to get the filter response improved at hihger frequency area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Couldn't find suitable IIM (C++) implementation to use so, I'm still having some difficulties with calculating and combining coefficients. How's that done?&lt;/p&gt;&#xA;" OwnerUserId="19991" LastEditorUserId="19991" LastEditDate="2016-09-18T05:10:22.140" LastActivityDate="2016-09-18T05:10:22.140" Title="Combining IIM and MZT transformation" Tags="|filters|filter-design|digital-filters|biquad|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29842" PostTypeId="1" AcceptedAnswerId="29843" CreationDate="2016-04-01T12:15:08.307" Score="4" ViewCount="5284" Body="&lt;p&gt;It looks exactly like an integrator to me.&#xA;Since $$y[k] = y[k-1]+x[k] = y[k-2] + x[k-1] +x[k] = \sum{x}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the Z-transform gives&#xA;\begin{align}&#xA;Y(z) &amp;amp;= Y(z)\cdot z^{-1} + X(z)\\&#xA;\Rightarrow\frac{Y(z)}{X(z)} &amp;amp;= \frac{1}{1-z^{-1}}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I convert $\frac{1}{1-z^{-1}}$ into Lapace transform in Matlab using &lt;code&gt;d2c&lt;/code&gt;, it does not return $\frac{k}{s}$. Instead, it returns $\frac{1+s}{s}$. It seems there is a proportional term inside, when thinking in PID control point of view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone explain on that?&lt;/p&gt;&#xA;" OwnerUserId="10200" LastEditorUserId="4298" LastEditDate="2020-11-01T18:16:20.987" LastActivityDate="2020-11-01T18:16:20.987" Title="Is $y[k] = y[k-1] + x[k]$ an integrator?" Tags="|filters|discrete-signals|infinite-impulse-response|z-transform|pid|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29843" PostTypeId="2" ParentId="29842" CreationDate="2016-04-01T13:08:01.673" Score="9" Body="&lt;p&gt;The system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=y[n-1]+x[n]\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is an ideal accumulator, i.e., it computes the cumulative sum of the input samples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=\sum_{k=-\infty}^nx[k]\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is in a way analogous to a continuous-time integrator, but this doesn't mean that you will necessarily obtain an ideal integrator by transforming the discrete-time system to a continuous-time system. There are several methods to do the conversion, and I'm not sure which one you used when calling &lt;code&gt;d2c&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, the properties of the transformed continuous-time system not only reflect the properties of the original discrete-time system, but also the properties of the transformation. So the properties of a discrete-time system should be investigated directly in the discrete-time domain, not by transforming it to a continuous-time system.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-04-03T10:57:00.563" LastActivityDate="2016-04-03T10:57:00.563" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29844" PostTypeId="1" CreationDate="2016-04-01T13:45:42.170" Score="0" ViewCount="437" Body="&lt;p&gt;&lt;a href=&quot;https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/transform/FastFourierTransformer.html&quot; rel=&quot;nofollow&quot;&gt;I use this FFT&lt;/a&gt; and wrote a short program to test it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;package test_FFT;&#xA;import org.apache.commons.math3.transform.FastFourierTransformer;&#xA;import org.apache.commons.math3.transform.DftNormalization;&#xA;import org.apache.commons.math3.transform.TransformType;&#xA;&#xA;&#xA;public class FFT2 {&#xA;&#xA;public static void main(String[] args) {&#xA;    double[][] array=new double[2][8];&#xA;    //An array of complex numbers with real part array[0][*]&#xA;    //and complex part array[1][*]&#xA;    //The output of the transformation will be saved in the input array&#xA;    array[0][0]=5.0;&#xA;    array[0][1]=2.0;&#xA;    array[0][2]=3.0;&#xA;    array[0][3]=4.0;&#xA;    array[0][4]=5.0;&#xA;    array[0][5]=6.0;&#xA;    array[0][6]=7.0;&#xA;    array[0][7]=9.0;&#xA;    FastFourierTransformer.transformInPlace(array,DftNormalization.STANDARD,TransformType.FORWARD);&#xA;&#xA;    for(int i=0;i&amp;lt;8;i++){&#xA;        System.out.println(&quot;real &quot;+array[0][i]);&#xA;        System.out.println(&quot;complex &quot;+array[1][i]);&#xA;    }&#xA;&#xA;}&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the output array I get amplitudes of sin and cos functions. The information about the frequencies should depend on the position within the output array.&#xA;After some research &lt;a href=&quot;http://matheplanet.com/default3.html?call=viewtopic.php?topic=149341&quot; rel=&quot;nofollow&quot;&gt;on this page&lt;/a&gt;, I still don't understand how to calculate frequencies out of array positions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I learned that there are many flavours of how to perform a FFT. Has anyone of you detailed knowledge on how calculate frequencies out of output of the FFT I use? A code sample computing frequencies for the output of the example below would be greatly appreciated. Thank you &lt;/p&gt;&#xA;" OwnerUserId="20338" LastEditorUserId="80" LastEditDate="2016-04-01T14:23:45.340" LastActivityDate="2016-04-01T14:48:23.620" Title="Getting frequencies out of a FFT" Tags="|fft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29845" PostTypeId="2" ParentId="29842" CreationDate="2016-04-01T14:09:11.583" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://lpsa.swarthmore.edu/LaplaceZTable/LaplaceZFuncTable.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yes, the system should be an integrator.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oIsBK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oIsBK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What &lt;a href=&quot;http://www.mathworks.com/help/control/ref/d2c.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;method&lt;/code&gt;&lt;/a&gt; did you use in the call to &lt;code&gt;d2c&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-01T14:09:11.583" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29847" PostTypeId="2" ParentId="29844" CreationDate="2016-04-01T14:48:23.620" Score="-1" Body="&lt;p&gt;At this moment i'm not hos i can't check my answer...&#xA;You say&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the output array I get amplitudes of sin and cos functions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well that is you frequency array. Probably not the way want it. I suspect youre looking for the magnitude and maybe the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the magnitude is quite easy.. it is the $abs(array (real + imag)$.&#xA;the phase $ \phi = \arctan \frac{imag}{real} $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in this way it is common to show the half the frequency array because of it's symmetry.&#xA;if you plot $array[0]$ to $array[N/2]$ you shoult get your frequecy array from $ \frac{1}{N}$ to $\frac{F_s}{2}$&lt;/p&gt;&#xA;" OwnerUserId="13541" LastActivityDate="2016-04-01T14:48:23.620" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29853" PostTypeId="1" CreationDate="2016-04-02T07:48:35.343" Score="0" ViewCount="1411" Body="&lt;p&gt;I have short-wave digital receiver that send RP packets with IQ components over network depend of the RF frequency and passband. I need to work with the telephone passband (0.3 - 3.4 kHz). The task is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using ordinary notebook receive RTP packets in the real-time, extract IQ-data, build FFT, visualize it and then I need to playback this data on the ordinary soundcard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, help me out. How can I do this quickly (in the short time)? Maybe prepared solution exists.&lt;/p&gt;&#xA;" OwnerUserId="20349" LastEditorUserId="8202" LastEditDate="2016-04-03T08:58:05.147" LastActivityDate="2018-05-14T13:31:23.213" Title="Play IQ data in the soundcard" Tags="|fft|real-time|quadrature|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29854" PostTypeId="2" ParentId="29837" CreationDate="2016-04-02T08:40:59.697" Score="1" Body="&lt;p&gt;Relevant paper is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The QUT-NOISE-TIMIT corpus for the evaluation of voice activity detection algorithms&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://eprints.qut.edu.au/38144/&quot; rel=&quot;nofollow&quot;&gt;http://eprints.qut.edu.au/38144/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise database is available here&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.qut.edu.au/research/research-projects/speech-audio-image-and-video-technology-saivt&quot; rel=&quot;nofollow&quot;&gt;https://www.qut.edu.au/research/research-projects/speech-audio-image-and-video-technology-saivt&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For speech instead of TIMIT you can take any public database, for example, librispeech:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.openslr.org/12/&quot; rel=&quot;nofollow&quot;&gt;http://www.openslr.org/12/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3453" LastActivityDate="2016-04-02T08:40:59.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29855" PostTypeId="1" CreationDate="2016-04-02T12:18:04.107" Score="2" ViewCount="4894" Body="&lt;p&gt;This seems a simple task, yet I am making some stupid mistakes I am not able to find. I create a sinus wave (integer) and then convert it to 16 bit char, little endian. Then I save to file and open it in Audacity (see image below). The first channel in the image is created by Audacity, the second by me. Something is really wrong there. I think it must be in the bit shifting, because if I use 8 Bit, it works. So the extra byte causes trouble but I don't see, how.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;bitset&amp;gt;&#xA;#include &amp;lt;iostream&amp;gt;&#xA;#include &amp;lt;chrono&amp;gt;&#xA;#include &amp;lt;math.h&amp;gt;&#xA;#include &amp;lt;fstream&amp;gt;&#xA;#include &amp;lt;iomanip&amp;gt;&#xA;&#xA;#define PI 3.14159265359  &#xA;&#xA;void&#xA;test_sine16Bit(){&#xA;&#xA;    int samplesize          = 16;&#xA;    unsigned int samplerate = 44100;&#xA;    int duration            = 3; // seconds&#xA;    int channels            = 1;&#xA;    //long samples            = 4096;&#xA;    long samples            = samplerate * duration; // per channel&#xA;    long total_samples      = samples * channels; // all channels&#xA;&#xA;    // Create test input buffer&#xA;    char input[total_samples * samplesize/8];&#xA;&#xA;    // Initialize test buffer with zeros&#xA;    for (int i=0;i&amp;lt;total_samples * samplesize/8;++i){&#xA;        input[i]=0;&#xA;    }&#xA;&#xA;    // Create test input&#xA;    int total_index=0;&#xA;    char graph[20];&#xA;    for (long i=0;i&amp;lt;samples;++i){&#xA;        // Channel 1: 440 Hz sinus&#xA;        int sinus    = .8*0x8000*sin(2*PI*440*i/samplerate); //  amplitude = 0.8 * max range; max range = 0x8000 = 32768 ( max value for 16 Bit signed int )&#xA;&#xA;&#xA;        // Little Endian: BUG HERE?&#xA;        input[total_index] =  sinus &amp;amp; 0xFF;             // LoByte&#xA;        //input[total_index+1] = (sinus &amp;amp; 0xFF00) &amp;gt;&amp;gt; 8; // HiByte&#xA;        input[total_index+1] = (sinus &amp;gt;&amp;gt; 8) &amp;amp; 0xFF;     // HiByte&#xA;        total_index += 2;&#xA;&#xA;    }&#xA;&#xA;    // Export raw audio data to file&#xA;    std::ofstream fout(&quot;sine_char16bit.raw&quot;);&#xA;    if (fout.is_open()){&#xA;        long idx = 0;&#xA;        for(long i = 0; i &amp;lt; samples; ++i){&#xA;            fout &amp;lt;&amp;lt; input[idx] &amp;lt;&amp;lt; input[idx+1]; idx+=2;&#xA;        }&#xA;        fout.close();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bHTkA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bHTkA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Found the solution: You need to open the file in binary mode and &lt;strong&gt;not&lt;/strong&gt; write via &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt;, but with &lt;code&gt;put&lt;/code&gt; or &lt;code&gt;write&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;std::ofstream fout(&quot;sine_char16bit.raw&quot;, std::ios::out | std::ios::binary);&#xA;if (fout.is_open()){&#xA;    fout.write(input, total_samples * samplesize/8);&#xA;}&#xA;fout.close();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12029" LastEditorUserId="12029" LastEditDate="2016-04-02T22:55:01.527" LastActivityDate="2023-12-29T20:26:32.793" Title="Create 16 bit sine and write to file" Tags="|c++|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29857" PostTypeId="2" ParentId="29855" CreationDate="2016-04-02T14:21:05.903" Score="1" Body="&lt;p&gt;Create low-frequency triangular or square waveform. Start from constant value, written into the wave. Generate one in audacity and save. Compare. Do not generate sine or anithing more compled right away. Start building complexity from simple components. Be smart, use simplicity and evolutionary approach. &lt;/p&gt;&#xA;" OwnerUserId="19489" LastActivityDate="2016-04-02T14:21:05.903" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29858" PostTypeId="1" AcceptedAnswerId="29859" CreationDate="2016-04-02T15:21:06.507" Score="0" ViewCount="103" Body="&lt;h1&gt;Problem statement&lt;/h1&gt;&#xA;&lt;p&gt;I am starting a project soon where I need to create a method to &lt;strong&gt;automatically create landmarks&lt;/strong&gt; on a set of images of human hands. I do not have a sample image but the images are taken with the same background and stable lightning conditions. The images &lt;em&gt;probably look similar to this one&lt;/em&gt;, (but should be the other side of the hand).&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/USp8w.jpg&quot; alt=&quot;sample hand&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;My colleagues have defined some landmarks, but I would like to first just detect the tips of the fingers and the inner most part between the fingers. I was looking into potential solutions and active shape or active appearance models look like a good idea, although they might also be an overkill. I was also thinking about just creating a template of a hand with landmarks, segmenting the hand with foreground/background segmentation (probably thresholding, PCA or even MRFs if the others fail a lot), and then do an affine + non-rigid registration to transfer the landmarks.&lt;/p&gt;&#xA;&lt;h1&gt;What I am asking is:&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are the methods that I mention for solving this task appropriate?&lt;/li&gt;&#xA;&lt;li&gt;Is there any solution out there that already solves this problem?&lt;/li&gt;&#xA;&lt;li&gt;Referrals to code to do some of this is appreciated.&lt;/li&gt;&#xA;&lt;li&gt;Do you have other better suited ideas to solve this problem?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;Note&lt;/h1&gt;&#xA;&lt;p&gt;I am going to play around with the images in &lt;a href=&quot;http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=403&quot; rel=&quot;nofollow noreferrer&quot;&gt;this dataset&lt;/a&gt;, which already have lots of annotated landmarks.&lt;/p&gt;&#xA;&lt;h1&gt;I'm new&lt;/h1&gt;&#xA;&lt;p&gt;Yes, this is my first post, so if you have ideas for other tags to include let me know. Also if you need further clarifications, don't hesitate to ask!&lt;/p&gt;&#xA;" OwnerUserId="20164" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2019-01-18T02:58:48.420" Title="Automatic landmarks on images of hands" Tags="|image-processing|image-segmentation|image-registration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29859" PostTypeId="2" ParentId="29858" CreationDate="2016-04-02T15:33:48.357" Score="1" Body="&lt;p&gt;There are two simple approaches. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the hand region with thresholding and then use something like &lt;a href=&quot;http://docs.opencv.org/2.4/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html&quot; rel=&quot;nofollow&quot;&gt;convexity defects&lt;/a&gt;. Even though you will have many spurious landmarks at the end, you could easily cluster them out, as your scene is well controlled. There are also couple of youtube videos, if you like to get an idea in advance, &lt;a href=&quot;https://www.youtube.com/watch?v=MmZc1REg6uw&quot; rel=&quot;nofollow&quot;&gt;[1]&lt;/a&gt;, &lt;a href=&quot;https://www.youtube.com/watch?v=xML2S6bvMwI&quot; rel=&quot;nofollow&quot;&gt;[2]&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fit a hand model to the image. There are many works in this field, and it's an active academic area. Some are, &lt;a href=&quot;http://research.microsoft.com/pubs/244775/HandShapeVariation.pdf&quot; rel=&quot;nofollow&quot;&gt;[1]&lt;/a&gt;, &lt;a href=&quot;http://www.macdorman.com/kfm/writings/pubs/Bhuyan-2015-Hand-Pose-Recognition.pdf&quot; rel=&quot;nofollow&quot;&gt;[2]&lt;/a&gt;, &lt;a href=&quot;http://vision.mas.ecp.fr/pub/bmvc06.pdf&quot; rel=&quot;nofollow&quot;&gt;[3]&lt;/a&gt;. Once the model is fit, you could extract any landmark you desire, since the correspondence to the canonical hand frame is determined.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The pdf you provided also gives a simple method for fitting a hand region.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2016-04-02T17:00:06.840" LastActivityDate="2016-04-02T17:00:06.840" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29860" PostTypeId="1" AcceptedAnswerId="29863" CreationDate="2016-04-02T15:42:44.817" Score="0" ViewCount="467" Body="&lt;p&gt;I'm using the matlab function &lt;a href=&quot;http://in.mathworks.com/help/comm/ref/pskmod.html&quot; rel=&quot;nofollow&quot;&gt;pskmod&lt;/a&gt; for modulating a bit string. What is the carrier frequency used by default by the function? &lt;/p&gt;&#xA;" OwnerUserId="20218" LastActivityDate="2016-04-02T20:39:48.343" Title="What is the default carrier frequency of matlab's pskmod?" Tags="|matlab|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29861" PostTypeId="1" CreationDate="2016-04-02T19:14:20.853" Score="-1" ViewCount="550" Body="&lt;p&gt;I have a pcm linear file (16 bits) collected with a sampling rate 8000 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to read the file in octave. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever I read it using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = fread(fid, inf, &quot;short&quot;);&#xA;sound(x, 8000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get a very distorted audio.&lt;/p&gt;&#xA;" OwnerUserId="20357" LastEditorUserId="13320" LastEditDate="2016-11-21T12:56:58.720" LastActivityDate="2016-11-21T12:56:58.720" Title="How can I read PCM linear file in Octave?" Tags="|audio|octave|" AnswerCount="1" CommentCount="3" ClosedDate="2016-04-03T22:07:50.400" ContentLicense="CC BY-SA 3.0" />
  <row Id="29862" PostTypeId="2" ParentId="29861" CreationDate="2016-04-02T20:08:48.540" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikiquote.org/wiki/Andrew_S._Tanenbaum&quot; rel=&quot;nofollow&quot;&gt;A. Tanenbaum&lt;/a&gt; is credited with:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The nice thing about standards is that you have so many to choose from&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Two main options, for PCM or other formats: 1) the reading is not fully adapted 2) the file is not fully compatible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try with other higher-level audio functions like described in &lt;a href=&quot;http://www.gnu.org/software/octave/doc/v4.0.1/Audio-File-Utilities.html#Audio-File-Utilities&quot; rel=&quot;nofollow&quot;&gt;33.1 Audio File Utilities&lt;/a&gt;. And cross-check with hexadecimal editors, or other PCM decoders, that the PCM file is sound. Three quite typical issues are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the file is not PCM,&lt;/li&gt;&#xA;&lt;li&gt;a problem with the PCM file header,&lt;/li&gt;&#xA;&lt;li&gt;a little-endian or big-endian byte-ordering trouble.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-04-02T20:08:48.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29863" PostTypeId="2" ParentId="29860" CreationDate="2016-04-02T20:39:48.343" Score="1" Body="&lt;p&gt;The function &lt;code&gt;pskmod.m&lt;/code&gt; returns a vector of complex baseband symbols. Each element of that vector has the form $y_k=e^{j(2\pi m(k)/M+\phi) }$, where $M$ is the alphabet size, $m(k)$ is an integer between $0$ and $M-1$ which depends on the message symbol at time $k$, and $\phi$ is some initial phase (which defaults to $0$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no carrier involved, and for simulation purposes it's usually also not necessary to use one because a digital communication system can be simulated by using the equivalent baseband system.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-04-02T20:39:48.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29864" PostTypeId="1" AcceptedAnswerId="29867" CreationDate="2016-04-02T20:51:06.450" Score="3" ViewCount="1465" Body="&lt;p&gt;Hilbert transform is a &lt;a href=&quot;https://dsp.stackexchange.com/questions/25845/meaning-of-hilbert-transform&quot;&gt;quite sensitive topic here&lt;/a&gt;, since Gabor's paper,  &lt;a href=&quot;http://www.csee.wvu.edu/~xinl/library/papers/physics/gabor1946.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Theory of Communication&lt;/a&gt;,  J. Inst. Electr. Engineering, London, 1946. &lt;a href=&quot;https://math.stackexchange.com/questions/1717578/intuition-behind-fourier-and-hilbert-transform/1717668#1717668&quot;&gt;Perhaps even more important than the Fourier transform&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are short Gaussian FIR approximations, smoothing filters, or polynomial fits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be methods for very short (say, less than $16$ taps) Hilbert tranform approximations of a signal, possibly including a weighting factor? I am intending to use them on small chunks of signals, in moving frames that progress along data as new samples are acquired. Signals can be considered freed from a potential low-frequency trend (e.g. polynomial).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fey features would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a management or reduction of small-sized frame artifacts (I am aware of those for short Fourier frames, much less with short Hilbert transforms),&lt;/li&gt;&#xA;&lt;li&gt;potential asymmetric windowing to add a forgeting factor to older samples,&lt;/li&gt;&#xA;&lt;li&gt;a recursive formulation, in the spirit of the sliding DFT, would be a plus.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Finally, an IIR formulation, such as the one of the recursive least squares (RLS) adaptive filters, or the exponentially-weighted moving average filter, would be very interesting as well.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="128" LastEditDate="2018-06-18T20:43:17.590" LastActivityDate="2018-06-18T20:43:17.590" Title="Approximation of Hilbert Transform Using Very Short Hilbert Transform FIR / IIR Filter" Tags="|filter-design|stft|finite-impulse-response|approximation|hilbert-transform|" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="29865" PostTypeId="1" AcceptedAnswerId="51796" CreationDate="2016-04-02T21:46:57.497" Score="4" ViewCount="1511" Body="&lt;p&gt;Just reading &lt;a href=&quot;http://andrewduncan.net/air/&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Analytic Impulse&lt;/a&gt;, A. Duncan, 1988, I met the name &quot;Heyser corkscrew&quot; for the first time in my DSP life, for a 3D display of a cisoid or complex exponential &lt;span class=&quot;math-container&quot;&gt;$e^{i\omega }$&lt;/span&gt; (often denoted  &lt;span class=&quot;math-container&quot;&gt;$\text{cis}\, x$&lt;/span&gt; for &quot;&lt;strong&gt;c&lt;/strong&gt;osine plus &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; &lt;strong&gt;s&lt;/strong&gt;ine&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RODAv.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RODAv.jpg&quot; alt=&quot;Heyser corkscrew spiral of the cisoid or complex exponential&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The view is mentioned as Euler formula's 3D view in the context of circular polarization:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rFC8Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rFC8Z.png&quot; alt=&quot;Euler formula and circular polarization&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This representation is quite common for analytic signals, but this name does not seem standard. Questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the history of this Heyser name, with a precise reference?&lt;/li&gt;&#xA;&lt;li&gt;What are the (earlier) history and names for this representation  (going back to the Fourier oblique view)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;After @MBaz hints, the term &quot;Heyser spiral&quot; seems a little more common. It is named after &lt;a href=&quot;http://www.aes.org/aeshc/docs/jaes.obit/JAES_V35_5_PG413.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Richard C. Heyser&lt;/a&gt;, and can be interpreted as a 3D variant of Nyquist plots... Indeed, in  &lt;a href=&quot;https://www.prosoundweb.com/topics/sound_reinforcement/the_nyquist_plot/&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Matter Of Frequency: The Nyquist Plot Explained&lt;/a&gt;, one can read:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Dennis Gabor proposed the “analytic signal” which Richard Heyser&#xA;  developed into what has since been named the Heyser Spiral. The&#xA;  Nyquist plot is the “end view” shadow of the complex analytic signal&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2019-07-25T18:57:02.143" LastActivityDate="2019-07-25T18:57:02.143" Title="3D wiggle plot for an analytic signal: Heyser corkscrew/spiral" Tags="|fourier-transform|continuous-signals|visualization|signals-history|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="29866" PostTypeId="1" AcceptedAnswerId="29870" CreationDate="2016-04-02T23:12:19.430" Score="3" ViewCount="2521" Body="&lt;p&gt;I generate a Gaussian noise and then I filter it with a passband FIR Kaiser window filter. When I perform the Fourier transform of the output of the filter and plot its magnitude spectrum, it is filtered in the correct frequency band. Now, I perform a second Fourier transform on the output of the first Fourier transform (I'm performing it on a complex vector this time and in the frequency domain), and when I plot the magnitude spectrum I see something very similar to the original filtered noise. I know this isn't time domain, I know this spectrum is not even because the input signal is complex. But as the time plot of the filtered noise and the absolute value plot of the Fourier transform (of the Fourier transform of the noise) are visually similar a doubt arised on me.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why is the amplitude spectrum of the complex vector obtained after performing a Fourier tranform on the filtered noise once again occupying the whole vector (the whole frequency band) as if they were time samples spread in the time vector? &lt;/li&gt;&#xA;&lt;li&gt;Is the negative symbol in the inverse Fourier transform of the Fourier transform of the noise having no effect so that it is visually similar performing a Fourier transform of Fourier transform of noise and performing an inverse Fourier transform of Fourier transform of noise?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This doubt arised to me when I was trying to filter on a matched filter implemented in Matlab using &lt;code&gt;IFFT(FFT(signal_1).*FFT(signal_1_inverted))&lt;/code&gt; and I accidentally filtered the output of an already Fourier transformed signal and coudn't notice the difference (not on the output of the filter but on the output of the first FFT stage). And this leads me to another question. &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Suppose I would like to detect the likelihood of 2 signals by comparing their spectrums and I want to measure the likelihood by using a matched filter. Knowing that the convolution in time is the multiplication in frequency, is the convolution in frequency the multiplication in time and I get the same result if I use a matched filter (sort of convolution operation) on the spectrums than if I perform a sample by sample multiplication in time domain of the signals whose spectrums likelihood I want to determine?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="17077" LastEditorUserId="15892" LastEditDate="2016-04-02T23:17:48.780" LastActivityDate="2021-01-28T14:09:25.977" Title="Fourier transform of a Fourier transform" Tags="|fourier-transform|frequency-spectrum|noise|convolution|matched-filter|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29867" PostTypeId="2" ParentId="29864" CreationDate="2016-04-02T23:33:56.310" Score="3" Body="&lt;p&gt;This is more like an extended comment to chart the possible answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hilbert transform is a frequency domain 90-degree phase shift of the signal. It has an antisymmetrical impulse response around time = 0. You specify that the approximation shall be causal (EDIT: this requirement has since been removed), so I think you need to reference the phase shift to that provided by another filter. If we denote the two filters F1 and F2, some usable alternatives are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Case | Filter F1    | Filter F2           | Phase diff     | Magnitude frequency responses&#xA;-----+--------------+---------------------+----------------+------------------------------&#xA;  C1 | pure delay   | antisymmetrical FIR | exactly 90 deg | F2 has ripple&#xA;  C2 | pure delay   | all-pass IIR        | approx 90 deg  | No ripple&#xA;  C3 | all-pass IIR | all-pass IIR        | approx 90 deg  | No ripple&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In all those cases you have two filters whose phase frequency responses have a phase difference of exactly or close to 90 degrees over the desired frequency band.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the filter outputs are used &quot;in quadrature&quot; (summed, with the other multiplied by the imaginary unit) to create an analytic signal, any phase frequency response ripple will become magnitude frequency response ripple of the composite negative frequency removal filter.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-04-02T23:41:58.957" LastActivityDate="2016-04-02T23:41:58.957" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29868" PostTypeId="1" CreationDate="2016-04-02T23:43:12.450" Score="0" ViewCount="732" Body="&lt;p&gt;So say there's a filter with an impulse response of $h(t) = (0.8)^t u(t)$. I'd like to pass white noise through this and figure out the autocorrelation and power spectral density of the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having a bit of trouble figuring out exactly how to do this. I know if you pass a signal through a filter, you simply take the Fourier transforms of the signal and the impulse response, multiply them together, and that's the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, not being any mathematical expression for the noise, I'm unsure how to proceed. Any tips would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="20359" LastEditorUserId="4346" LastEditDate="2016-04-03T02:45:31.077" LastActivityDate="2016-04-03T02:45:31.077" Title="Evaluation of Autocorrelation and Power Spectral Density of white noise through a filter" Tags="|filters|power-spectral-density|autocorrelation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29869" PostTypeId="2" ParentId="29866" CreationDate="2016-04-03T00:15:02.253" Score="1" Body="&lt;p&gt;The difference between an IFFT and an FFT is (merely) in the direction of the result vector (indexed forwards or backwards/reversed in time), and usually a scaling factor of N or 1/N.  So you should see nearly the same thing if the input is so close to symmetrical looking that it doesn't look too different when reversed, and your plot auto-scales.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-03T06:28:00.670" LastActivityDate="2016-04-03T06:28:00.670" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29870" PostTypeId="2" ParentId="29866" CreationDate="2016-04-03T00:17:57.707" Score="4" Body="&lt;p&gt;Applying the discrete Fourier transform (DFT) twice to a time-domain signal, should produce the original time-domain signal in a circularly time-reversed, and linearly scaled (by N) form; as the inverse DFT is very similar to the forward DFT, except the sign of the complex exponential,a linear scale by 1/N.&lt;/p&gt;&#xA;&lt;p&gt;The inverse DFT of &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ x[n] = \frac {1}{N} \sum_{k=0}^{N-1} {X[k]e^{j \frac{2\pi}{N} k n}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By reverting the sign of the exponent &lt;span class=&quot;math-container&quot;&gt;$e^{j \frac{2\pi}{N} k n}$&lt;/span&gt; into negative, by a change in the sign of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; what you get is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  N x[(-n)_N] = \sum_{k=0}^{N-1} {X[k]e^{-j \frac{2\pi}{N} k n}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is N times the &lt;strong&gt;circularly&lt;/strong&gt; reversed (obtained via modulus operator denoted by &lt;span class=&quot;math-container&quot;&gt;$(.)_N$&lt;/span&gt;) version of the original signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, which is obtained by an apparently forward but effectively inverse DFT applied to &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; which is treated as a time-domain sequence, which is what you do at your second stage of applying forward FFT to &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2021-01-28T14:09:25.977" LastActivityDate="2021-01-28T14:09:25.977" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="29872" PostTypeId="2" ParentId="29868" CreationDate="2016-04-03T02:41:17.450" Score="2" Body="&lt;p&gt;White noise is modelled as a process having spectral density $G_n(f) = k$, a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the filter, the resulting process $y$ will have spectral density $G_y(f) = G_n(f) |H(f)|^2$. And the autocorrelation will be the inverse Fourier transform of the spectral density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a general result for any stable filter and finite power, wide-sense stationary input process (in this case we are pushing the boundaries because white noise has infinite power as defined above).&lt;/p&gt;&#xA;" OwnerUserId="330" LastActivityDate="2016-04-03T02:41:17.450" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29874" PostTypeId="2" ParentId="29853" CreationDate="2016-04-03T05:59:01.380" Score="3" Body="&lt;p&gt;If the spectrum of your I/Q samples is centered at zero then you'll have to perform either AM or FM demodulation before routing any real-valued audio samples to a sound card. For AM demodulation you'll need to implement a complex-input &quot;envelope detector&quot; which produces a real-valued audio signal riding on a DC bias. (In a few days check the web page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;www.dsprelated.com&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for a blog of mine describing different envelope detectors.) That amplitude-biased audio signal then needs to be passed through a &quot;DC blocking&quot; filter (a highpass filter whose cutoff frequency is very close to zero Hz) and the output of that filter goes to your sound card.  From Chapter 13 of my DSP book, the most common DC blocking filters look like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cgHtf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cgHtf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where alpha is a number close to, but less than, one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if your I/Q signal (whose spectrum is centered at zero Hz) is an FM modulated signal there are two common ways to perform FM demodulation to produce a real-valued audio signal sequence.  One way is unpleasant because it requires the computation of arctangents and the other way is unpleasant because it requires you to perform divisions. Oleg, search the Internet for &quot;digital FM demodulation&quot; and you will be able to learn about those two different FM demodulation methods.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2016-04-03T05:59:01.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29875" PostTypeId="2" ParentId="29842" CreationDate="2016-04-03T06:14:41.750" Score="6" Body="&lt;p&gt;Your simple integrator is called a &quot;Rectangular Rule&quot; integrator. There are more complicated (and more accurate) integrators called &quot;Trapazoidal Rule&quot;, &quot;Simpson's Rule&quot;, and &quot;Tick's Rule&quot; integrators.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2016-04-03T06:14:41.750" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29876" PostTypeId="1" CreationDate="2016-04-03T06:19:59.283" Score="0" ViewCount="1131" Body="&lt;p&gt;Assume $F=1$ $(T=1)$. A 2nd order FIR filter with real coefficients has a zero in $H(e^{j\omega T})$ at $z_0=e^{j\omega /6}$. In addition, $|H(e^{j\pi T})| = 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the coefficients of the FIR filter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;current progress&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having trouble understanding the $H(e^{j\omega T})$ function.&#xA;Tried to start from&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = \sum_{i=0}^2 b_i z[n-2].$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that fact that it has a zero in a point means I must apply zero-pole rules here?&lt;/p&gt;&#xA;" OwnerUserId="20364" LastEditorUserId="1629" LastEditDate="2016-04-03T11:06:08.937" LastActivityDate="2016-04-03T19:41:30.043" Title="FIR filter (from zeros to filter coefficients)" Tags="|finite-impulse-response|poles-zeros|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29878" PostTypeId="1" CreationDate="2016-04-03T14:33:52.053" Score="0" ViewCount="994" Body="&lt;p&gt;I am trying to detect straight vertical lines in an image. I used vertical edge detection and then I tried to check which objects has the &lt;code&gt;orientation &amp;gt; 80 &amp;amp; &amp;lt; 100&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Input Image:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2kK38.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2kK38.jpg&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% Vertical Edge Detection&#xA;&#xA;v = edge(img,'sobel','vertical');&#xA;v = bwlabel(v);&#xA;stats = regionprops(v, 'All');&#xA;&#xA;% ids = find([stats.Orientation] &amp;gt; 80 &amp;amp; [stats.Orientation] &amp;lt; 100);&#xA;% v = ismember(v,ids);&#xA;&#xA;figure,imshow(v);title('Vertical');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that most of the objects are having some weird orientation (some -ve value e.g. -53.xyz)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;when I try to filter the objects, it gives me a full black image as an output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Someone please explain this behavior. &lt;strong&gt;How can I get only straight vertical lines?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="20130" LastActivityDate="2018-08-24T06:00:00.050" Title="How to filter objects on basis of orientation of regionprops" Tags="|image-processing|matlab|computer-vision|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29880" PostTypeId="1" AcceptedAnswerId="29881" CreationDate="2016-04-03T17:45:20.503" Score="1" ViewCount="151" Body="&lt;p&gt;Let`s say I have a signal &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$m(t)=\cos(4\pi t) + \cos(6\pi t)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we can say the signal is containing frequencies $f_1= 2\mathrm{Hz}$ and $f_2= 3\mathrm{Hz}$. The cut-off frequency of the low pass filter is equal to $f_c= 3.5\mathrm{Hz}$, and the sampling frequency is $5\mathrm{Hz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an overlap (aliasing error) when receiving the original signal (After LPF)?&lt;/p&gt;&#xA;" OwnerUserId="20369" LastEditorUserId="13320" LastEditDate="2016-11-13T13:06:51.503" LastActivityDate="2016-11-13T13:06:51.503" Title="A question about sampling theory" Tags="|filtering|aliasing|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29881" PostTypeId="2" ParentId="29880" CreationDate="2016-04-03T18:10:19.030" Score="0" Body="&lt;p&gt;Given two signals $x_1(t) = \cos(2\pi 2t)$ and $x_2(t) = \cos(2\pi 3t)$ which have frequencies of 2 and 3 Hz respectiveley, if you sample them uniformly with a sampling rate of 5 samples per second (or a sampling period $T$ of $\frac {1}{5}$ = 0.2 seconds) you will get the following two discrete time signals $$x_1[n] = x_1(nT) =  \cos(4\pi \frac {n}{5} )$$ and $$x_2[n] = x_2(nT) = \cos(6\pi \frac {n}{5})$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be easily seen with simple trigonometry, ( by using $\cos(x) = \cos(2\pi-x)$) ,  that $x_1[n] = x_2[n]$ which is a manifestation of aliasing that occured on the 3hz signal, therefore, the 3Hz signal seems like 2Hz.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-04-03T22:20:26.763" LastActivityDate="2016-04-03T22:20:26.763" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29882" PostTypeId="1" CreationDate="2016-04-03T18:10:19.077" Score="4" ViewCount="1740" Body="&lt;p&gt;I'm working with the Aquila C++ DSP library. I'm computing the FFT of a wave file (16 bit depth, single channel, 44100 sample rate). I am using a window size of 16384 to calculate the FFT spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having an issue converting the the digital frequency (0/N, 1/N, ... N/N) to the corresponding analog frequency. When I apply the sample rate multiplier S,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;f = S*i/N; // Convert from digital frequency to analog frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get analog frequencies that are 4 times greater than what I expect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I read in a pianos A1 note. I expect this to be ~55 Hz. Instead I'm getting ~220 Hz. Refer to the photo below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I1NNB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I1NNB.png&quot; alt=&quot;FFT with analog frequncies 4x larger than expected&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm first wondering if I'm scaling my the wrong number. However, I'm pretty sure it's correct. So now I'm curious if somehow the time domain data I'm reading is compressed by a factor of 4, such that the frequencies appear to be 4 times greater. Does anyone know if there is a common .wav file 'gotch-ya' when reading from them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've posted the relevant part of my code if anyone is interested.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* sample window */&#xA;int window_size = 16384;&#xA;&#xA;/* Calculate the FFT */&#xA;std::shared_ptr&amp;lt;Aquila::Fft&amp;gt; p_fft_interface = Aquila::FftFactory::getFft(window_size);  // This returns a shared pointer to an FFT calculation object.&#xA;auto spectrum = p_fft_interface-&amp;gt;fft(wave_object.toArray());&#xA;&#xA;QVector&amp;lt;double&amp;gt; x(window_size);&#xA;QVector&amp;lt;double&amp;gt; y(window_size);&#xA;&#xA;/* Prepare to plot &amp;amp; convert to analog frequency */&#xA;double max_value = 0;&#xA;for(int i = 0; i &amp;lt; window_size; i++)&#xA;{&#xA;    x[i] = i*(sample_freq/window_size);&#xA;    y[i] = abs(spectrum[i]);&#xA;&#xA;    if(abs(spectrum[i]) &amp;gt; max_value)&#xA;    {&#xA;        max_value = abs(spectrum[i]);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20371" LastActivityDate="2022-03-30T16:03:15.367" Title="Aquila DSP C++ Library - Wave file FFT analog frequency off by factor of 4?" Tags="|fft|sampling|c++|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29883" PostTypeId="2" ParentId="29876" CreationDate="2016-04-03T19:41:30.043" Score="1" Body="&lt;p&gt;First of all a discrete filter having a zero somewhere means it's Z-transform (which is a polynomial) acquires the value 0 there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you remember, there is a theorem in calculus saying: for a polynomial to have real coefficients any complex roots which are not on the real line must come in complex conjugate pairs. So if $z_0 = e^{j\omega /6}$ then $z_1 = e^{-j\omega / 6}$ and that gives : $$(z - z_0)(z - z_1)C = (z - e^{j\omega /6})(z - e^{-j\omega /6})C$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then to find the constant $C$ solve the equation with the absolute value of the polynomial equals 1 for $z = e^{j\pi}$.&lt;/p&gt;&#xA;" OwnerUserId="18051" LastActivityDate="2016-04-03T19:41:30.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29884" PostTypeId="1" CreationDate="2016-04-03T21:28:20.023" Score="0" ViewCount="33" Body="&lt;p&gt;If you have two different methods of calculating a continuous parameter (eg. heart rate), each with their own uncertainty, what would be some common methods of combining these parameters to create a better estimate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One simple implementation I can think of would be a simple weighted average of the two based on a confidence metric (eg. $σ^2$) but I am curious as to what some alternative methods might be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8667" LastEditorUserId="8667" LastEditDate="2016-04-05T15:33:16.000" LastActivityDate="2016-04-05T15:33:16.000" Title="Methods of combing two parameter estimates" Tags="|filters|estimation|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29885" PostTypeId="1" CreationDate="2016-04-03T21:57:29.377" Score="-1" ViewCount="1421" Body="&lt;p&gt;Given the signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x[n]=\left(\frac{1}{2}\right)^nu[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find its energy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_\infty = \sum_{n=-\infty}^{\infty}|x[n]|^2$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can I compute $E_\infty$? Could anyone help?&lt;/p&gt;&#xA;" OwnerUserId="20375" LastEditorUserId="21075" LastEditDate="2017-10-25T13:18:38.897" LastActivityDate="2017-10-25T13:18:38.897" Title="Energy of a discrete-time decaying exponential" Tags="|discrete-signals|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29886" PostTypeId="1" CreationDate="2016-04-03T22:09:03.477" Score="2" ViewCount="785" Body="&lt;p&gt;I am having some trouble in my attempt to understand some of the operations in the Farneback optical flow algorithm, and i would really appriciate if somebody could help me a bit along the way (and i hope i am able to express myself properly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.ida.liu.se/ext/WITAS-ev/Computer_Vision_Technologies/Papers/ssab02_fn.pdf&quot; rel=&quot;nofollow&quot;&gt;The article i am currently reading is the &quot;MOTION DETECTION IN THE WITAS PROJECT&quot;, which is availiable for free on ResearchGat&lt;/a&gt;e.  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;I have interpret the approximation part of the algorithm as following&lt;/em&gt; [seen in equation (1) to (3)]: A local signal model for each image pixel is found by approximating a quadratic polynomial, based on the pixel neighborhood. The approximated coefficients are found in A, b and c - while x = (x,y) is a running variable? The result is that the local signal model is a bivariate quadratic curve?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;From the part 3.1 First Attempt&lt;/em&gt;: I am having trouble understanding the term A(x,y) = [A1(x,y) + A2(x,y)]/2. Is the (x,y) index related to the pixel coordinate where the expansion coefficients belong? I would have expected that A2 was belonging to an local signal model that was identical, but displaced, with respect to the local signal model which has the A1 expansion coefficient. I read equation (10) as: &quot;Find the expansion coefficient A1 to pixel (1,1) in image 1, add it with expansion coefficient A2 to pixel (1,1) in image 2 - and divide by 2&quot;? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The use of indexing in equation (10) to (13) is also making me insecure if we are talking about pixel coordinates. The same variables is used in equation (1), but i assume that this is running variables that is used to make the polynomial?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Kind regards&#xA;VegardB&lt;/p&gt;&#xA;" OwnerUserId="20368" LastActivityDate="2016-04-03T22:09:03.477" Title="Understanding Farneback Displacement Estimation" Tags="|optical-flow|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29889" PostTypeId="1" CreationDate="2016-04-04T09:14:11.917" Score="0" ViewCount="845" Body="&lt;p&gt;I would like to count the number of short pauses in a speech and know the duration of the pauses by loading the signal into Matlab but I am very new to Matlab.&#xA;Can anyone help and give me some ideas about this?&lt;/p&gt;&#xA;" OwnerUserId="8581" LastActivityDate="2016-09-01T11:55:21.643" Title="how to detect short pause in a speech with noise?" Tags="|matlab|audio|voice|detection|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29890" PostTypeId="2" ParentId="29889" CreationDate="2016-04-04T09:50:53.660" Score="2" Body="&lt;p&gt;You can use Voice Activity Detector(VAD) for detecting the pauses in speech and there location(and duration). if your input signal is not very noisy and noise is not varying much you can use a fixed threshold on the energy(calculated for short frames, ex-20 ms), so if energy is above that threshold you declare that frame as speech else pause. if input signal is very noisy(varying noise) you can use adaptive threshold and do the same,i.e. you can have short term(lasting for 10-12 frames) and long term energies(lasting 40-50frames) and long term energy can be used as threshold. once this classification is done for entire input signal you can get duration's of pauses in speech&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-04-04T09:50:53.660" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29892" PostTypeId="2" ParentId="29878" CreationDate="2016-04-04T10:59:10.553" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Sobel_operator&quot; rel=&quot;nofollow&quot;&gt;Sobel filter&lt;/a&gt; you used bases on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Image_gradient&quot; rel=&quot;nofollow&quot;&gt;gradient of the image&lt;/a&gt;. It seems (I am not using Matlab) you specified to &quot;find&quot; the &quot;objects&quot; that have significant horizontal gradient (so: the most vertical). But -- as you see -- not only the vertical lines have horizontal gradient...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not able to give you the complete answer, as I do not know Matlab's image processing toolbox, but maybe the hint will be useful:&#xA;Try to find the horizontal lines in the same way. This will give you the skewed ones as well, but not the vertical ones. Once you subtract the 'horizontal plus skewed' set from 'vertical plus skewed' objects, the only remaining will be pure vertical lines. It will be much easier then to find the vertical ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will not be just simple subtract operations -maybe some morphological operations will be necessary.&lt;/p&gt;&#xA;" OwnerUserId="20225" LastActivityDate="2016-04-04T10:59:10.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29893" PostTypeId="1" CreationDate="2016-04-04T11:01:24.487" Score="0" ViewCount="154" Body="&lt;p&gt;I've read somewhere that the Fast Fourier is only applicable to those processes exhibiting bandwidth. Where as principal component analysis can be applied to a process exhibiting any finite  bandwidth. Why is this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The band width is simply the difference in the upper and lower frequencies in a contentious set of frequencies? So, for the Fast Fourier only a set of basis functions of discrete frequencies (i.e. $\sin(2\pi f x)$) are considered, but why does the bandwidth ($f_\text{max}-f_\text{min}$) need to be infinitesimal? Why can it not be finite? Is is due to the fact that the duration of the sine wave is infinite and therefore the bandwidth infinitesimal? Or have I miss understood? I cannot find this information anywhere.&lt;/p&gt;&#xA;" OwnerUserId="20377" LastEditorUserId="11256" LastEditDate="2016-04-04T14:45:02.250" LastActivityDate="2016-04-04T14:50:08.930" Title="Bandwidth range for Fast Fourier vs principal component analysis?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29895" PostTypeId="2" ParentId="29726" CreationDate="2016-04-04T11:18:07.307" Score="1" Body="&lt;p&gt;Try to use cv2.HoughLinesP (see an &lt;a href=&quot;http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html&quot; rel=&quot;nofollow&quot;&gt;example&lt;/a&gt;) to detect the straight lines (segments). As a result you will get the segments' endpoints, so finding all the intersections and its type will be quite simple maths.&#xA;The problem will be rather with finding the proper and universal parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theoretically you could use a morphological operation called &lt;a href=&quot;http://homepages.inf.ed.ac.uk/rbf/HIPR2/hitmiss.htm&quot; rel=&quot;nofollow&quot;&gt;hit-and-miss transform&lt;/a&gt;, but this will be difficult in your case, as the lines are hand-drawn and even after thinning the crosspoints may be difficult to be properly classified (as 'T', '+' or 'corner').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest you to make some &lt;a href=&quot;http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.html&quot; rel=&quot;nofollow&quot;&gt;morphological preprocessing&lt;/a&gt; to improve the binary image you have got.&lt;/p&gt;&#xA;" OwnerUserId="20225" LastActivityDate="2016-04-04T11:18:07.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29896" PostTypeId="1" CreationDate="2016-04-04T12:31:54.550" Score="3" ViewCount="150" Body="&lt;p&gt;I want to replace color in an image from another color: For that sample image is below&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k6vb5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k6vb5.png&quot; alt=&quot;sample image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to replace color such that it becomes &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZT2oF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZT2oF.png&quot; alt=&quot;Resulted Image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it can be easily done in Photoshop but I am looking for an algorithm which can replace a particular region color with another color but texture and shades should be preserved. These image are only for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried changing hue and maintaining saturation and brightness but it fails when I try to change image to white/Black and nearby colors&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;style&amp;gt;&#xA;  img{&#xA;      -webkit-filter: hue-rotate(120deg);&#xA;  }&#xA;&amp;lt;/style&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20379" LastEditorUserId="20379" LastEditDate="2016-04-06T05:41:00.627" LastActivityDate="2016-04-06T05:41:00.627" Title="How to replace color in an image without changing its texture/shades or brightness?" Tags="|image-processing|color|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29898" PostTypeId="2" ParentId="29893" CreationDate="2016-04-04T14:50:08.930" Score="1" Body="&lt;p&gt;From &lt;a href=&quot;https://en.wikipedia.org/wiki/Karhunen%E2%80%93Lo%C3%A8ve_theorem&quot; rel=&quot;nofollow&quot;&gt;Karhunen–Loève theorem&lt;/a&gt;, when talking about stochastic processes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the theory of stochastic processes, the Karhunen–Loève theorem&#xA;  (named after Kari Karhunen and Michel Loève), also known as the&#xA;  Kosambi–Karhunen–Loève theorem is a representation of a&#xA;  stochastic process as an infinite linear combination of orthogonal&#xA;  functions, analogous to a Fourier series representation of a function&#xA;  on a bounded interval.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically, K.-L. yields an adaptive representation, while Fourier provides a fixed representation with  sinusoidal functions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many flavors of Fourier tools, so since you are talking about &quot;fast&quot; Fourier and PCA, I assume for now you are dealing with discrete data, thus the empirical version of the  Karhunen–Loève transform (PCA) and the discrete Fourier transform (DFT). The idea of a continuous set of frequencies does not fit gracefully here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both PCA et discrete Fourier can be cast into linear and orthogonal transforms, so they are applicable to any data, and may preserve all information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;http://luthuli.cs.uiuc.edu/~daf/courses/CS-498-DAF-PS/Lecture%209%20-%20PCA.pdf&quot; rel=&quot;nofollow&quot;&gt;Principal Component Analysis&lt;/a&gt; (p. 44 sq.), you can find that you can derive DFT bases from PCA, when you are studying a process that follows a &quot;correlated&quot; Markov model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, when you talk about infinite sines with infinitesimal bandwidth, you are more in the context of continuous functions (or distributions) and standard Fourier analysis, which might be a cause for confusion. A solid book on the topic could help, like Mathematical principles of signal processing: Fourier and wavelet analysis, by P. Brémaud.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-04-04T14:50:08.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29899" PostTypeId="1" AcceptedAnswerId="30034" CreationDate="2016-04-04T15:09:25.503" Score="5" ViewCount="972" Body="&lt;p&gt;I would like to estimate the phase delay accurately for any random FIR filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of the phase delay is the continuous phase divided by the angular frequency (with a sign change). That means that you can't simply use the wrapped phase, between $-\pi$ and $+\pi$ you can get with a FFT to obtain the phase delay estimation. At least, you need to use an unwrapped version of the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, with a linear phase FIR filter, the phase delay is supposed to be a constant, so the phase you have to use to do the calculus has to be monophonic and decreasing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, by doing some tests in MATLAB, I have been able to see that the unwrapped phase doesn't have this property everywhere. For a halfband lowpass filter for example, there are a few &quot;jumps&quot; in the stopband with a length not related with $\pi$, so they are untouched in the unwrapped phase, which gives me a wrong estimation of the phase delay, featuring jumps as well instead of a constant value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the &quot;continuous phase&quot; I need isn't the same thing than the unwrapped phase, and is associated with the zero-phase amplitude of the FIR filter. I have not found yet a way to get it, and MATLAB with its &lt;code&gt;zerophase&lt;/code&gt; function is giving wrong results as well, because it cheats ! If the filter is linear phase, it uses the formula we all know for the phase delay. If it is a FIR linear phase transformed into a minimum-phase filter for example, then the phase delay displayed features again this low size jumps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking about doing something like detecting the jump length, assuming the phase is supposed to be smooth everywhere, and using the derivative at the sample before the jump to do something which might look good... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I would like to know if someone knows a rigorous way to get the continuous phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT :&lt;/strong&gt; here is an example. You can find there the phase for a FIR linear phase filter, wrapped and unwrapped. As you can see on the unwrapped, some phase jumps are still here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wMkii.png&quot; alt=&quot;wrapped&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/vLPRy.png&quot; alt=&quot;unwrapped&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2 :&lt;/strong&gt; my problem can be redefined this way. Most of the time, any FIR filter can be studied with its frequency response H($\omega$) = |H($\omega$)| $e^{j \phi( \omega)}$ with |H($\omega$)| the magnitude, always positive or zero, and $\phi(\omega)$ the wrapped phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an alternative notation : H($\omega$) = A($\omega$) $e^{j \theta( \omega)}$ with A($\omega$) the amplitude or zero-phase amplitude and $\theta( \omega)$ the continuous phase representation, still between -$\pi$ and $\pi$. Apparently, it features only 2$\pi$ jumps, and can be fully continuous with a standard unwrap algorithm. That's because A($\omega$) can be positive or negative. Each time there is a zero in the FIR filter, A($\omega$) changes its sign. That's the zeroes which are causing the lowest jumps. Since A($\omega$) contains the sign information, the low jumps are no more present in the new phase representation $\theta( \omega)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what I need now, is in fact a way to calculate accurately $\theta( \omega)$, maybe by calculating first A($\omega$). I might detect the low jumps easily and change the sign of |H($\omega$)|, then use it to get the remaining $e^{j \phi( \omega)}$. But there is maybe a better way of doing this, and I'd like to know if someone familiar with this notation has already done that.&lt;/p&gt;&#xA;" OwnerUserId="15899" LastEditorUserId="15899" LastEditDate="2016-04-05T08:53:42.223" LastActivityDate="2016-04-11T12:58:06.510" Title="Continuous phase for phase delay calculus in FIR filters" Tags="|filter-design|phase|finite-impulse-response|delay|visualization|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29900" PostTypeId="1" CreationDate="2016-04-04T15:40:30.170" Score="1" ViewCount="28" Body="&lt;p&gt;I know that I can find the autocorrelation matrix of a series of finite length sequences via rank-1 updates using the relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{R}[k] = \frac{1}{k}\mathbf{R}[k-1] + \frac{1}{k+1}\mathbf{r}[k]\mathbf{r}^{H}[k]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $k$ is the discrete time index and $\mathbf{r}$ is the autocorrelation of the current signal sequence. The true autocorrelation can then be found via the first column of the matrix (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Autocorrelation_matrix&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Autocorrelation_matrix&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I imagine I can do the same for the PSD, correct? Namely: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{S}[k] = \frac{1}{k}\mathbf{S}[k-1] + \frac{1}{k+1}\mathbf{s}[k]\mathbf{s}^{H}[k]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\mathbf{s}$ is the fourier spectrum of the current frame. The PSD will then be found as the first column of $\mathbf{S}$. Correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way I can transform $\mu: \mathbf{R} \rightarrow \mathbf{S}$ directly, that is, without having to compute the PSD of every sequence frame?&lt;/p&gt;&#xA;" OwnerUserId="19259" LastActivityDate="2016-04-04T15:40:30.170" Title="Power Spectral Density Via Rank 1 Update" Tags="|discrete-signals|autocorrelation|power-spectral-density|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29901" PostTypeId="1" CreationDate="2016-04-04T16:53:07.140" Score="3" ViewCount="1058" Body="&lt;p&gt;I know except for some special cases, aliasing is unavoidable. Assume we time-limit a function, $f(t)$, so that it is zero outside an interval say $[0,T]$ to form $y(t)$. Then, in the frequency domain, infinite frequency components are introduced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the system that makes this time limitation has impulse response $h(t)$, we have its Fourier representation $H(u)$. We can then calculate $Y(u)$ using convolution to obtain:&#xA;$$Y(u)=F(u)*H(u)$$&#xA;Obviously, it has frequency components that are replicated to infinity. This phenomenon is because of sliding it across the original function to calculate Convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone possibly let me know in what condition we can have band-limited input &lt;strong&gt;and output&lt;/strong&gt;. &lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="80" LastEditDate="2016-11-15T09:46:08.793" LastActivityDate="2016-11-15T09:46:08.793" Title="Special case: Band-limited in time domain and band-limited in frequency domain" Tags="|discrete-signals|signal-analysis|continuous-signals|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29902" PostTypeId="2" ParentId="29885" CreationDate="2016-04-04T17:01:07.947" Score="1" Body="&lt;p&gt;Assuming that $u[n]$ denotes the unit step function, equal to $1$ when $n\ge 0$ and $0$ elsewhere, then:&#xA;$$ \sum_{-\infty}^{\infty} |x[n]|^2 = \sum_{0}^{\infty} \left(\frac{1}{2}\right)^{2n} = \sum_{0}^{\infty} \left(\frac{1}{4}\right)^{n} = \frac{1-0}{1-\frac{1}{4}} = \frac{4}{3}\,.$$&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-04-04T17:01:07.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29903" PostTypeId="2" ParentId="29901" CreationDate="2016-04-04T17:19:47.697" Score="5" Body="&lt;p&gt;The condition is that the function $f(t)=0$, if you are talking about continuous time signals and frequencies (some of your formulations are confusing to me). In other words, a (nonzero) time-limited signal cannot be also band-limited. In other words, a function and its (continuous) Fourier transform cannot both have finite support. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The core of one proof (using complex analysis) relies on &lt;a href=&quot;https://en.wikipedia.org/wiki/Paley%E2%80%93Wiener_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Paley-Wiener theorems&lt;/a&gt;: the Fourier transform of a time-limited function would be an entire function (a complex-valued function, holomorphic over the whole complex plane), that would vanish on an open interval, and hence be zero (almost) everywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find details in &lt;a href=&quot;https://mathoverflow.net/questions/29991/fourier-transforms-of-compactly-supported-functions&quot;&gt;Fourier transforms of compactly supported functions&lt;/a&gt;, and the paper (for instance) &lt;a href=&quot;http://math.uchicago.edu/~may/REU2013/REUPapers/Hill.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The uncertainty principle for Fourier transforms on the real line&lt;/a&gt;. This is a reason for the development of time-frequency analysis.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:57:54.877" LastActivityDate="2016-04-04T17:19:47.697" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="29905" PostTypeId="2" ParentId="29899" CreationDate="2016-04-04T19:05:41.927" Score="1" Body="&lt;p&gt;The problem is that magnitudes close to zero in the stop band change their sign almost arbitrarily / randomly.  And that's why you're seeing arbitrary jumps of $\pi$ radians --- it's a sign change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of that, I'd be tempted to just ignore the phase of any part of the magnitude response below some low value. What value to use will depend on your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Zero padding will not generally help because that just gives you more &quot;random&quot; sign changes around the frequency axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use &quot;random&quot; in quotes as it's not stochastic, but it is hard to predict.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I interpolate the phase on 100,000 points for an FIR filter of length 126 taps and unwrap the phase I get the picture below. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/Anrsz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Anrsz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason the unwrapping algorithm fails is because the phase in the stop band is changing very quickly compared with that in the passband. Comparison below of unwrapped phases.  The red lines are $\pm \pi/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/49ZHJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/49ZHJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Aztjr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Aztjr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Changing the &lt;code&gt;complex_magnitude&lt;/code&gt; expression to mimic the &lt;code&gt;fftshift&lt;/code&gt; idea from @hotpaw, to:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    complex_magnitude &amp;lt;- polyval(f1[c(63:125,1:62)], exp(-1i*freq))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/in8lW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/in8lW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is slightly better, but not ideal.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#29899&#xA;&#xA;library(&quot;signal&quot;)&#xA;&#xA;f1 &amp;lt;- remez(125, c(0, 0.3, 0.4, 1), c(1, 1, 0, 0))&#xA;plot(f1,type=&quot;l&quot;)&#xA;dev.copy(png, 'Q29899-ImpulseResponse.png')&#xA;dev.off()&#xA;&#xA;freq &amp;lt;- seq(0,pi,pi/100000)&#xA;&#xA;complex_magnitude &amp;lt;- polyval(f1, exp(-1i*freq))&#xA;&#xA;plot(freq, unwrap(Arg(complex_magnitude)), type=&quot;l&quot;);&#xA;dev.copy(png, 'Q29899-UnwrappedPhase.png')&#xA;dev.off()&#xA;&#xA;plot(freq[60000:100000],Arg(complex_magnitude[60000:100000]), type=&quot;l&quot;)&#xA;lines(freq[c(60000,100000)],c(pi/2,pi/2), col=&quot;red&quot;)&#xA;lines(freq[c(60000,100000)],c(-pi/2,-pi/2), col=&quot;red&quot;)&#xA;title('Stop band phase detail')&#xA;dev.copy(png, 'Q29899-PhaseDetailWrapped.png')&#xA;dev.off()&#xA;&#xA;plot(freq[1:10000],Arg(complex_magnitude[1:10000]), type=&quot;l&quot;)&#xA;lines(freq[c(1,10000)],c(pi/2,pi/2), col=&quot;red&quot;)&#xA;lines(freq[c(1,10000)],c(-pi/2,-pi/2), col=&quot;red&quot;)&#xA;title('Pass band phase detail')&#xA;dev.copy(png, 'Q29899-PhaseDetailWrappedPassband.png')&#xA;dev.off()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-04T23:32:11.697" LastActivityDate="2016-04-04T23:32:11.697" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29906" PostTypeId="1" AcceptedAnswerId="30305" CreationDate="2016-04-01T13:02:49.603" Score="1" ViewCount="4753" Body="&lt;p&gt;I have a IMU sensor breakoutboard using ITG3701, LSM303D &lt;a href=&quot;https://www.tindie.com/products/onehorse/itg3701lsm303dms5637-10-axis-motion-sensor/&quot; rel=&quot;nofollow noreferrer&quot;&gt;LinkProduct&lt;/a&gt;. This involves accelerometer, gyroscope and magnetometer. I have connected the sensors to a Arduino and sending the datas to another computer over Xbee. My sensor is placed on a wheel along its radius. The controller sends data at every 100 ms delay. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5iFg9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5iFg9.png&quot; alt=&quot;orientation of model&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency parameters for sensors , i have chosen to be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Specify sensor full scale&#xA;uint8_t OSR = ADC_8192;  // set pressure amd temperature oversample rate&#xA;uint8_t Gscale = GFS_4000DPS; // gyro full scale&#xA;uint8_t Godr = GODR_190Hz;  // gyro data sample rate&#xA;uint8_t Gbw = GBW_low;  // gyro data bandwidth&#xA;uint8_t Ascale = AFS_16G; // accel full scale&#xA;uint8_t Aodr = AODR_200Hz;  // accel data sample rate&#xA;uint8_t Abw = ABW_50Hz;  // accel data bandwidth&#xA;uint8_t Mscale = MFS_2G; // mag full scale&#xA;uint8_t Modr = MODR_25Hz; // mag data sample rate&#xA;uint8_t Mres = MRES_HighResolution; // magnetometer operation mode&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It can be changed to several other allowable limits given &lt;a href=&quot;https://github.com/kriswiner/ITG3701_LSM303D_MS5637/blob/master/ITG3701_LSM303D_MS5637.ino&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to process the sensor datas through two filters, first HPF (to remove DC components noise) and then LPF (to remove high frequency noise)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to do the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accelerometer_Raw -&gt;  /&lt;strong&gt;HPF&lt;/strong&gt;/  -&gt; Accelerometer_HPF_datas -&gt; /&lt;strong&gt;LPF&lt;/strong&gt;/ -&gt; Accelerometer_LPF_datas&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gyroscope_Raw -&gt;  /&lt;strong&gt;HPF&lt;/strong&gt;/  -&gt; Gyroscope_HPF_datas -&gt; /&lt;strong&gt;LPF&lt;/strong&gt;/ -&gt; Gyroscope_LPF_datas&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the receiver side, i did the following on the sensor datas&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   FSa=200; % accelerometer sampling&#xA;        FSg=190; %gyroscope sampling&#xA;&#xA;&#xA;&#xA;d = fdesign.highpass('N,F3dB',2,3/(FSa/2));&#xA;            H_a1 = design(d,'butter');&#xA;            H_a1.PersistentMemory=true;&#xA;            H_a2 = design(d,'butter');&#xA;            H_a2.PersistentMemory=true;&#xA;            H_a3 = design(d,'butter');&#xA;            H_a3.PersistentMemory=true;&#xA;            d = fdesign.lowpass('N,F3dB',2,30/(FSa/2));&#xA;            L_a1 = design(d,'butter');&#xA;            L_a1.PersistentMemory=true;&#xA;            L_a2 = design(d,'butter');&#xA;            L_a2.PersistentMemory=true;&#xA;            L_a3 = design(d,'butter');&#xA;            L_a3.PersistentMemory=true;&#xA;            d = fdesign.highpass('N,F3dB',2,3/(FSg/2));&#xA;            H_g1 = design(d,'butter');&#xA;            H_g1.PersistentMemory=true;&#xA;            H_g2 = design(d,'butter');&#xA;            H_g2.PersistentMemory=true;&#xA;            H_g3 = design(d,'butter');&#xA;            H_g3.PersistentMemory=true;&#xA;            d = fdesign.lowpass('N,F3dB',2,30/(FSg/2));&#xA;            L_g1 = design(d,'butter');&#xA;            L_g1.PersistentMemory=true;&#xA;            L_g2 = design(d,'butter');&#xA;            L_g2.PersistentMemory=true;&#xA;            L_g3 = design(d,'butter');&#xA;            L_g3.PersistentMemory=true;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Gyroscope_Z axis in degrees per second &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GkZns.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GkZns.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accelerometer_X axis in g&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8msS3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8msS3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I chosed the cutoff frequncy to be HPF to be 3Hz and for LPF to be 30 Hz. I found there is a very big difference with the gyroscope datas after filtering when the wheel rotates. The output datas are significantly reduced for gyroscope.There are also difference at the peaks of accelerometer datas measured. Hence, when i input this to Kalman, I am getting  lower velocty and the lower angle rotated. I have also verified that the output is wrong, as rotating a complete rotation gives me less than 2Pi radians after using filtering. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If my method is correct for filtering and choosing the sampling rate, cutoff frequency, order of filter etc. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If not, what filter parameters should I chose instead to get better results? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If HPF for gyroscope is necessary?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Additional:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After suggested the lower frequency limit should be much lower: I did the following High pass filtering at 0.05 Hz, The accelerometer datas are good, however i am somehow filtering out the content from Gyroscope datas&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/24P14.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/24P14.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7u9fU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7u9fU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The lowpass filter at 3 HZ gave me much better result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZTEud.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZTEud.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AoVWd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AoVWd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I found the these 3 and 0.05 HZ from the FFT analysis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hmdYU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hmdYU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20345" OwnerDisplayName="bsnayak" LastEditorUserId="20345" LastEditDate="2016-04-07T21:47:57.187" LastActivityDate="2016-04-27T20:47:44.033" Title="Choosing correct filter parameters for IMU sensor datas" Tags="|matlab|filtering|sensor|" AnswerCount="1" CommentCount="16" ContentLicense="CC BY-SA 3.0" />
  <row Id="29907" PostTypeId="2" ParentId="29901" CreationDate="2016-04-04T20:39:43.123" Score="1" Body="&lt;p&gt;This is not possible for actual &lt;em&gt;signals&lt;/em&gt; (i.e., functions of a real variable). It &lt;em&gt;is&lt;/em&gt; possible for functions on a domain that is already compact itself, e.g. functions from the unit circle (or, as multivariate generalisations, from tori or spheres).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is not completely hypothetical: &lt;em&gt;perfectly periodic signals&lt;/em&gt; can be understood as functions on a compact time interval, which is however closed by the ends to be periodic.&lt;/p&gt;&#xA;" OwnerUserId="246" LastActivityDate="2016-04-04T20:39:43.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29908" PostTypeId="1" CreationDate="2016-04-04T21:07:24.620" Score="1" ViewCount="3601" Body="&lt;p&gt;I'm given a zero-pole plot (Real/Imaginary Plane) of a system in which &lt;em&gt;poles&lt;/em&gt; occur at $\frac{-9}{10}$, $\frac{9}{10}$, and &lt;em&gt;zeros&lt;/em&gt; occur at $\frac{10}{9}j$, $\frac{-10}{9}j$. An additional zero occurs at negative infinity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also given that $H_{F}(f)=1$ for $f=0$, where $H_{F}(f)$ refers to $H(z)$ for when $z=e^{-j 2\pi  f}$. I'm tasked to find $H(z)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I can express $H(z)$ as $$H(z)=G_0z^{-1}\frac{(z-z_0)(z-z_1)\ldots}{(z-p_0)(z-p_1)\ldots} $$ for zeros $$z_0,z_1,\ldots$$ and poles $$p_0, p_1,\ldots$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can find the constant $G_0$ by using the fact  $H_{F}(f)=1$ for $f=0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unsure how to express the fact that the system has a zero at negative infinity. &lt;/p&gt;&#xA;" OwnerUserId="18485" LastEditorUserId="18485" LastEditDate="2016-04-05T00:58:09.960" LastActivityDate="2017-03-31T14:36:43.317" Title="How to find system function, H(z) in the z-domain, given zero-pole plot of the system?" Tags="|poles-zeros|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29910" PostTypeId="2" ParentId="29777" CreationDate="2016-04-04T21:31:07.177" Score="5" Body="&lt;p&gt;From the definition of a $N$-point DFT of a sequence $\left\{x[n]\right\}$, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k]=\sum_{n=0}^{N-1} x[n]\exp\left(-j\frac{2\pi kn}{N}\right),\quad k=0, 1, \dots, N-1\tag{1}$$   &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's say for a fixed $N$ we go against equation $(1)$ and compute more values to let's say $N_2$ such that $N_2\gg N$. Looking at the exponential term, let's say:&#xA;$$e_k = \exp\left(-j\frac{2\pi kn}{N}\right),\quad k=0, 1, \dots, N-1, N, N+1, \ldots, N_2-1$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be verified that for $m\in \mathbb Z$:&#xA;$$e_{k+m N} = \exp \left[-j\left(\frac{2\pi kn}{N}+ 2\pi mn\right)\right]=\exp\left(-j\frac{2\pi kn}{N}\right)\cdot 1=e_k\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, all the values you'll compute for $k \gt N-1$ you already computed them. Equation $(1)$ requires $N$ harmonically related exponentials determined by the index $k$, and that is sufficient for a $N$-point DFT. No extra/new info beyond that, all the signal's spectral information can be extracted to at most $k=N-1$. And this is regardless of the nature of $x[n]$, whether $x[n]$ is periodic or not periodic the DFT by its definition in equation $(1)$ does &lt;strong&gt;not&lt;/strong&gt; make such an assumption. (@Matt. L puts it nicely in his &lt;a href=&quot;https://dsp.stackexchange.com/questions/17814/why-does-the-dft-assume-the-transformed-signal-is-periodic?rq=1&quot;&gt;answer and comments here&lt;/a&gt; regarding the confusion on the periodicity assumption).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, we can analyze more than the range of $n$. Let's say $N_2$. Note that we are doing a $N_2$-point DFT, (i.e. the denominator in the exponential term is $N_2$) and $0\leq k \leq N_2-1$. The choice of $N$(here $N_2$) determines two things: the frequency spacing of the DFT samples and the computation time taken to compute those DFT samples. The corresponding frequency spacing $\Delta f$ in $\textrm{ Hz}$ between two consecutive DFT samples is:&#xA;$$\Delta f=\frac{F_s}{N}$$&#xA;$$N_2&amp;gt;N \Longrightarrow \frac{F_s}{N_2} &amp;lt; \frac{F_s}{N} $$&#xA;So, this will increase the computation time as you'll have more DFT samples since you have more $k$'s; but the frequency spacing gets smaller (i.e. reduces the spectral separation of consecutive DFT samples), and this gives a high resolution in the frequency domain.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, we can even analyze less than the range of $n$. Application-dependent like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Goertzel_algorithm#Computational_complexity&quot; rel=&quot;nofollow&quot;&gt;Goertzel algorithm&lt;/a&gt; already mentioned is one example. Or depending on nature of the signal, like real signals for instance where the resulting redundancies in the DFT can be used to compute up to half of the values to have a full spectral characteristic instead of going up to $N$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-10-04T17:53:33.680" LastActivityDate="2016-10-04T17:53:33.680" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29911" PostTypeId="2" ParentId="29899" CreationDate="2016-04-04T22:26:11.930" Score="0" Body="&lt;p&gt;Interpolating more points can assist the phase unwrapping algorithm.  To interpolate phase, do a partial negative circular rotation of the input vector to center the FIR filter around x[0] (first element of the vector being fed to an FFT) in a sufficiently zero-padded window, before the FFT.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this rotation does is to move the edges of the inherent rectangular window around the impulse response away from the phase measurement point (x[0] for a typical DFT or FFT).  Otherwise, you might end up interpolating the implied Gibbs horns around the discontinuity at the first element or last element of the DFT input.  Thus a small rotation, plus zero-padding to interpolate more points, might remove some of the zig-zag artifact of the unwrapped phase (for those portions of the passband, or even stop-band sufficiently above the noise floor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase reference point can be moved back to any other point in time, if needed, by the linear phase shift identity for time-shifted data vectors (after interpolation and phase unwrapping, of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if the spectrum magnitude passes thru zero at a point where it is being sampled, that point should probably be removed before the phase unwrapping algorithm tries to use it.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-05T16:56:13.333" LastActivityDate="2016-04-05T16:56:13.333" CommentCount="12" ContentLicense="CC BY-SA 3.0" />
  <row Id="29913" PostTypeId="2" ParentId="29853" CreationDate="2016-04-05T01:07:05.407" Score="3" Body="&lt;p&gt;I'm replying to Oleg's recent comments here in an &quot;Another Answer&quot; block because the &quot;add a comment&quot; capability prevents me from providing a complete reply to Oleg. Here's my reply:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You &lt;em&gt;can&lt;/em&gt; indeed take the sqrt(I^2 + Q^2). (That is one step in one method of AM demodulation.) But you realize that if you do so all of your computed sqrt samples will be positive-valued, right?  What you will have then is an &quot;amplitude-biased audio signal&quot; as I described in my above answer. Oleg, try these three things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Route just your real-valued 'I' signal to your sound card and see how the audio sounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Compute the sqrt(I^2 + Q^2) and route that real-valued signal to your sound card and see how the audio sounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] Pass your sqrt(I^2 + Q^2) through a DC blocking filter (that I mentioned in my above answer), and then route that real-valued filter output signal to your sound card and see how the audio sounds. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, because you are working with a digital receiver I suggest you have a look at the envelope detectors at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dsprelated.com/showarticle/938.php&quot; rel=&quot;nofollow&quot;&gt;https://www.dsprelated.com/showarticle/938.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any one of those detectors can be used for AM demodulation (with a DC blocking filter, or course).&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2016-04-05T01:07:05.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29914" PostTypeId="1" AcceptedAnswerId="29919" CreationDate="2016-04-05T01:46:26.230" Score="0" ViewCount="3836" Body="&lt;p&gt;I am using the standard MATLAB &lt;code&gt;filter&lt;/code&gt; function to design pre-emphasis filter. However, I am getting the wrong results back! I have the ground truth so I can check it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I wrote this one Matlab code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; B = ones(1,6);&#xA; B=B*(-0.97);&#xA; B(1)=1;&#xA; z = 1; &#xA; xd = filter(B,z,data,[], 2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I only getting back correctly only the first two columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ground truth:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-604.981536865234   -98.1470046997071   -105.546778869629   -114.096517944336   -113.826526184082   -112.466567687988&#xA;-615.981201171875   -17.4794665527344   -22.4493148803712   -27.5691586303711   -19.8393945312500   -21.8693325805664&#xA;-448.986297607422   4.52986175537109    6.06981475830077    1.63994995117184    -0.939971313476576  -7.60976776123050&#xA;-10.9996643066406   -18.3294406127930   -18.8694241333008   -16.4094992065430   -16.8594854736328   -15.3095327758789&#xA;207.993652343750    -3.75988525390625   5.93981872558595    3.93987976074220    2.87991210937500    2.78991485595705&#xA;105.996765136719    11.1796588134766    6.41980407714844    6.50980133056640    10.5996765136719    3.80988372802734&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I recover:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-604.981536865234   -98.1470046997071   481.285311889649    1137.16529541016    1884.31249359131    2720.81696472168&#xA;-615.981201171875   -17.4794665527344   575.052450256348    1166.46440124512    1774.60584167480    2381.71731353760&#xA;-448.986297607422   4.52986175537109    441.586523437500    855.213900146484    1252.26178283691    1631.64020477295&#xA;-10.9996643066406   -18.3294406127930   -8.19974975585937   22.3893167114258    67.5279391479492    129.216056518555&#xA;207.993652343750    -3.75988525390625   -195.814024047852   -389.868101806641   -582.982208251953   -773.186403503418&#xA;105.996765136719    11.1796588134766    -96.3970581054687   -206.883686218262   -316.280347595215   -439.466588134766&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My coeff is supposed to be 0.97, I don't get the partial correct results to be honest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;cheers for any input! &lt;/p&gt;&#xA;" OwnerUserId="20389" LastEditorUserId="8202" LastEditDate="2016-04-05T07:01:16.457" LastActivityDate="2016-04-05T13:02:59.617" Title="Pre-emphasis filter design" Tags="|matlab|signal-analysis|filter-design|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29915" PostTypeId="1" CreationDate="2016-04-05T02:40:16.533" Score="1" ViewCount="1855" Body="&lt;p&gt;I want to design some specific slope highpass filter to enhance  speech; just like $1$ dB/octave,  $2$ dB/octave and more. Is there a method to calculate the coefficients by specific slope?&lt;/p&gt;&#xA;" OwnerUserId="20316" LastEditorUserId="15892" LastEditDate="2016-04-05T05:32:53.650" LastActivityDate="2016-10-03T02:17:55.397" Title="How to design a variable slope highpass filter" Tags="|filter-design|frequency-response|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="29917" PostTypeId="2" ParentId="29908" CreationDate="2016-04-05T05:45:48.447" Score="0" Body="&lt;p&gt;&lt;strong&gt;First&lt;/strong&gt;, express the zeros and poles in a polar form: $z=re^{-j 2\pi  f}$ You can do this using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;nofollow&quot;&gt;Euler formula&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second&lt;/strong&gt;, substitute $z=e^{-j 2\pi  f}$ in $H(z)$, including the values for the poles and zeros. You will have $H(f)$ now. Everything should be expressed as a function of $f$ and $G_0$ at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Third&lt;/strong&gt;, substitute $f=0$ in $H(f)$ and do $H(f)=1$. Then you will be able to get the value for $G_0$.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-04-05T05:45:48.447" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29918" PostTypeId="2" ParentId="29915" CreationDate="2016-04-05T05:57:49.477" Score="1" Body="&lt;p&gt;You can design a &lt;a href=&quot;https://en.wikipedia.org/wiki/Butterworth_filter#Transfer_function&quot; rel=&quot;nofollow&quot;&gt;Butterworth low pass filter&lt;/a&gt; and convert it into &lt;a href=&quot;http://uk.mathworks.com/help/signal/ref/butter.html?requestedDomain=www.mathworks.com&quot; rel=&quot;nofollow&quot;&gt;high pass filter&lt;/a&gt;. The slope in these filters is Cn dB/decade where C is a constant and n is the filter order. The polynomial for these filters are tabulated.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-04-05T05:57:49.477" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29919" PostTypeId="2" ParentId="29914" CreationDate="2016-04-05T07:12:04.263" Score="3" Body="&lt;p&gt;I don't really understand what are you trying to achieve with vector &lt;code&gt;B&lt;/code&gt; that has 6 elements. Pre-emphasis filter is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n]=x[n]-\alpha x[n-1]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\alpha$ is $0.97$ in your case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that there are only two elements in vector &lt;code&gt;B&lt;/code&gt;, right? So the code should be something like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B=[1, -0.97];&#xA;xd = filter(B, 1, data, [], 2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can verify the frequency response:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;freqz(B, 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SydUs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SydUs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-04-05T07:12:04.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29922" PostTypeId="1" CreationDate="2016-04-05T10:43:22.823" Score="4" ViewCount="394" Body="&lt;p&gt;I am trying to develop a new type of wavelets and I found out a function that following a particular two scale relation. The function at a scale $t$ say $x(t)$ can be related in a finer scale $x(2t)$ by the following relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=0.1x\left(2t\right)+ 0.5x\left(2t-1\right)+0.8x\left(2t-2\right)+0.5x\left(2t-3\right)+0.1x\left(2t-4\right),$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is found out by trial and error method by simply changing the values. Now I know that the points $\begin{bmatrix}0.1&amp;amp;0.5&amp;amp;0.8&amp;amp;0.5&amp;amp;0.1\end{bmatrix}$ can be considered as  the scaling filter coefficients. Now the problem is finding the wavelet filter coefficients, I am not able to find out a particular relation connecting scaling filter coefficients and wavelet filter coefficients. Is there is a relation connecting the two ??&lt;/p&gt;&#xA;" OwnerUserId="17018" LastEditorUserId="128" LastEditDate="2019-11-18T07:13:05.030" LastActivityDate="2021-01-24T14:29:23.760" Title="Wavelet Filter Coefficients from Scaling Filter Coefficients" Tags="|image-processing|signal-analysis|filter-design|wavelet|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29923" PostTypeId="2" ParentId="29922" CreationDate="2016-04-05T11:18:42.553" Score="0" Body="&lt;p&gt;For perfect reconstruction you need:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ g \left[ n \right] * \hat{g} \left[ n \right] + h \left[ n \right] * \hat{h} \left[ n \right] = \delta \left[ n \right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $ g \left[ n \right] $ is the Analysis Wavelet Function, $ \hat{g} \left[ n \right] $ is the Synthesis Wavelet Function, $ h \left[ n \right] $ Analysis Scaling Function and $ \hat{h} \left[ n \right] $ is the Synthesis Scaling Function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically, Scaling Function is the LPF and Wavelet Function is the HPF.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2016-04-05T11:18:42.553" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29924" PostTypeId="1" AcceptedAnswerId="29933" CreationDate="2016-04-05T11:50:37.993" Score="2" ViewCount="5680" Body="&lt;p&gt;I can remove the noise using moving average filter. The MATLAB code is shown bellow. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I remove the noise using mean and meadian filters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vOskK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vOskK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20396" LastEditorUserId="1629" LastEditDate="2016-04-05T15:01:24.347" LastActivityDate="2019-04-26T04:54:22.763" Title="How to remove noise using mean and median filters?" Tags="|matlab|filters|dsp-core|" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="29925" PostTypeId="1" CreationDate="2016-04-05T12:34:27.510" Score="1" ViewCount="93" Body="&lt;p&gt;I have a problem where all images have the same object; however, these objects can either have number_of_colors&amp;lt;=3 OR number_of_colors&gt;3 and images are not labeled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt starts by converting RGB to LAB and Consider only the A &amp;amp; B to find the color coverage of that image. I was thinking of it as an area on the AB space.   So for every image, I found the range of A and B (i.e max(A)-min(A), max(B)-min(B)) and multiplied them together to get the area, assuming it's a rectangle. Then I threshold using this feature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the confusion matrix:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;TP: 0.41935483871, FN: 0.0645161290323&lt;/li&gt;&#xA;&lt;li&gt;FP: 0.0967741935484, TN: 0.41935483871&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Here is the basic routine the should work per image&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    LAB = rgb_to_lab(data_rgb[...,0],data_rgb[...,1],data_rgb[...,2])&#xA;    A = LAB[1]&#xA;    B = LAB[2]&#xA;&#xA;    minA,maxA = np.min(A),np.max(A)&#xA;    minB,maxB = np.min(B),np.max(B)&#xA;&#xA;    diff_A = maxA - minA&#xA;    diff_B = maxB - minB&#xA;&#xA;    area = diff_A * diff_B &#xA;    # p is the normalized area&#xA;    p = area/(200*200.)&#xA;    # Found 0.5 to be the best possible threshold&#xA;    if p &amp;gt;0.53:&#xA;        print 'class 1 - colors &amp;gt; 3'&#xA;    else:&#xA;        print 'class 2 - colors &amp;lt;= 3'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rvSZp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rvSZp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if my intuition is correct and why it isn't working. I have no experience in image processing. I would love to know what is the standard way to do this. I could manually find the range of each color in Hue after converting to HSV but it seems too specific which might not handle all the colors in the test set.&lt;/p&gt;&#xA;" OwnerUserId="20397" LastActivityDate="2016-04-05T12:34:27.510" Title="How to classify images based on the amount of colors in the image?" Tags="|image-processing|image-segmentation|classification|thresholding|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29926" PostTypeId="2" ParentId="29914" CreationDate="2016-04-05T13:02:59.617" Score="1" Body="&lt;p&gt;Only two columns of your output match the expected results, because the first $N$ columns only depend on the first $N$ filter coefficients and only the first two coefficients are consistent with the desired result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working back from your original &lt;code&gt;data&lt;/code&gt; (which I recreated back from the provided &quot;recovered&quot; result):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-604.9815368652340   -684.9790954589840   -769.9765014648426   -860.9737243652289   -948.9710388183510  -1032.9684753417814&#xA;-615.9812011718750   -614.9812316894531   -618.9811096191402   -627.9808349609343   -628.9808044433603   -631.9807128906195&#xA;-448.9862976074220   -430.9868469238282   -411.9874267578127   -397.9878540039070   -386.9881896972709   -382.9883117675836&#xA; -10.9996643066406    -28.9991149902344    -46.9985656738281    -61.9981079101562    -76.9976501464843    -89.9972534179683&#xA; 207.9936523437500    197.9939575195312    197.9939575195308    195.9940185546867    192.9941101074209    189.9942016601541&#xA; 105.9967651367190    113.9965209960940    116.9964294433599    119.9963378906258    126.9961242675798    126.9961242675811&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can compute what the coefficients should be to get your expected results with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;row = 1; % choose any row, results should be the same within numerical errors&#xA;B_expected = zeros(size(B));&#xA;for col=1:size(data,2)&#xA;  sum = 0;&#xA;  for idx=2:col&#xA;    if col &amp;lt;= length(B)&#xA;      sum = sum + B_expected(col-idx+1)*data(row,idx);&#xA;    end&#xA;  end&#xA;  B_expected(col) = (Ground_Truth(row,col)-sum)./data(row,1);&#xA;end&#xA;B_expected&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which gives you:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1.0000e+000  -9.7000e-001  1.3859e-015  5.7785e-015  -3.2181e-015  6.0134e-015&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Asides from numerical errors, this essentially corresponds to using only two non-zero coefficients of &lt;code&gt;[1 -0.97]&lt;/code&gt; and is consistent with the pre-emphasis filter definition as indicated in &lt;a href=&quot;https://dsp.stackexchange.com/a/29919/8952&quot;&gt;@jojek's answer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B=[1, -0.97];&#xA;xd = filter(B, 1, data, [], 2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8952" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-04-05T13:02:59.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29927" PostTypeId="2" ParentId="29915" CreationDate="2016-04-05T14:37:41.253" Score="2" Body="&lt;p&gt;The order of a filter determines its slope. Normally orders are positive integers (1, 2, 3, ...). So the slopes are fixed to multiples of approximately 3db/octave. However, taking the case of a Butterworth filter, someone has applied partial calculus to obtain fractional order Butterworth filters which will effectively allow you to chose the slope. If you do a Google search for &lt;em&gt;fractional order Butterworth filters&lt;/em&gt; you will get back some papers on the subject. For instance here: &lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1210/1210.8194.pdf&quot; rel=&quot;nofollow&quot;&gt;https://arxiv.org/ftp/arxiv/papers/1210/1210.8194.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need a different filter type you could apply the same thinking, but the maths may be more complicated for, say, an elliptic filter.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="15030" LastEditDate="2016-04-05T14:46:33.923" LastActivityDate="2016-04-05T14:46:33.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29928" PostTypeId="2" ParentId="1765" CreationDate="2016-04-05T16:45:06.433" Score="2" Body="&lt;p&gt;This Q&amp;amp;A is a bit old, but merits some clarification. To form a beam with an array of elements, you compensate for the phase differences in responses from each one, so that when the compensated element outputs are summed they are in phase.&#xA;The differences in responses include:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Difference in the response of each element in the direction of the formed beam. However, if all elements are identical and placed in the same orientation, the nominal responses are equal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Difference in response of element IN THE ARRAY instead of in isolation. All isolated elements have identical responses (except for real-world variation, see #3). In the array they can be affected by the presence of the other elements; this is called mutual coupling, at least for RF arrays. This can be handled by calibration, or make the spacing wide, or other techniques.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Differences in actual vs. nominal responses of the RF hardware. This includes element response due to manufacturing variation, same for cables and RF components. You must calibrate your array and retain the phase differences between elements over all operating frequencies to compensate this.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Difference in path length. The incoming wavefront creates a response in each element, but delayed more or less based on the position of the element. This is a TIME DELAY. The amount of time delay can be calculated as the time for the wave to travel the distance between elements, projected along the line-of-sight (LOS).&#xA;You asked good questions, because compensating for this time delay can be done with phase shifts, IF the signal has a narrow enough bandwidth. If not, this is the &quot;wideband array&quot; case, and time delay must be used to compensate.&#xA;One response to the question seemed to state that this item tended to drop off as the distance gets large. Untrue. For a source at infinity, you still must account for the different pathlength to each element.&#xA;The beamforming calculation (time) for element i is&#xA;Tdi = (di . r) / v&#xA;where di is a vector from the array phase center to the element i (choose distance units), r is a unit vector in the direction of the source (the direction to form the beam), v is the velocity of the wave in the array medium, and &quot;.&quot; is the vector dot product. This dot product gives you the projected distance of the element along the LOS; that distance divided by velocity gives the time delay. Correcting for these time delays causes all element outputs to be synchronized to the phase center.&#xA;The correction factor, in phase, is&#xA;Pdi = 360 Tdi / (lambda/v)&#xA;where lambda is the center frequency wavelength, lambda/v is the time the wave takes to travel a wavelength. So the fraction of this time is multiplied by 360 to give a phase shift. If signal is narrowband, the phases can wrap around.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="20399" LastEditorUserId="80" LastEditDate="2016-04-05T17:09:45.907" LastActivityDate="2016-04-05T17:09:45.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29929" PostTypeId="2" ParentId="1765" CreationDate="2016-04-05T17:20:55.167" Score="1" Body="&lt;p&gt;Check out Harry Van Tree's Optimal Array Processing. I find it to be one of the best books on the subject. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the book, he explains the geometry of the planar array, and what the array manifold should look like. From there, you can implement some solutions and see if they are appropriate for the geometry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A side note:&lt;/strong&gt; In my personal work, I have found frequency domain implementations (DFT versions) of broadband beamformers to perform much better than their time domain cousins. Frequency domain beamformers appear to be more stable computationally, at the expense of greater end-to-end delay. At least to me, they are also much easier to generalize from the narrowband literature, thereby allowing quicker development time. &lt;/p&gt;&#xA;" OwnerUserId="19259" LastActivityDate="2016-04-05T17:20:55.167" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29930" PostTypeId="1" CreationDate="2016-04-05T17:27:33.497" Score="1" ViewCount="99" Body="&lt;p&gt;So it appears that Linear Prediction as performed via Durbin Recursion is sensitive to additive noise. What are some techniques for linear prediction that may be more robust? Can anyone supply a link that discusses the noise sensitivity of linear prediction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to perform inverse filtering of a voiced speech signal by finding the linear prediction coefficients. It honestly doesn't work too bad, even in the presence strong pink or brown noise, but I have a feeling there are some more robust ways to get these coefficients.&lt;/p&gt;&#xA;" OwnerUserId="19259" LastEditorUserId="19259" LastEditDate="2016-04-05T17:33:15.980" LastActivityDate="2016-04-05T17:33:15.980" Title="Noise Robust Linear Prediction" Tags="|noise|linear-prediction|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29931" PostTypeId="1" AcceptedAnswerId="29932" CreationDate="2016-04-05T18:22:27.470" Score="2" ViewCount="414" Body="&lt;p&gt;In the figure there is represented a step response of a mechanical system. I created a step variation in the excitation of a DC generator. This lead to a step variation in the torque developed by that generator. I measured this torque with a arm connected to the stator and to a load cell.&#xA;Is this thing normal? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to identify the transfer function of this system have as output the plot from the figure and a step change as input. I used IDENT from MATLAB and got a transfer function with 3 zeros and 3 poles with a fit of 85%. I used this transfer function with a sin wave input and computed the phase shift between the input and the output. This shift is very small, 2-3°. Is this thing normal?&#xA;I see that my system has a big delay from the step response but with sin wave response the delay is very small.&#xA;Is it possible that the procedure for obtaining the transfer function is not correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1rntu.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1rntu.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16809" LastEditorUserId="16809" LastEditDate="2016-04-08T08:19:02.580" LastActivityDate="2016-04-08T08:19:02.580" Title="Strange step response" Tags="|phase|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29932" PostTypeId="2" ParentId="29931" CreationDate="2016-04-05T18:57:37.437" Score="4" Body="&lt;p&gt;The step response you have is non-minimum phase. That means various things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There are zeros (or poles, if the system is unstable) outside the unit circle (in discrete time).&lt;/li&gt;&#xA;&lt;li&gt;The peak of the impulse response is delayed from the origin.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Below is an example showing an &quot;ideal&quot; delayed step, a non-minimum phase filter impulse response and the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the output exhibits similar characteristics to what you have plotted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9Y5Rz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Y5Rz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-05T18:57:37.437" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29933" PostTypeId="2" ParentId="29924" CreationDate="2016-04-05T19:56:32.350" Score="3" Body="&lt;p&gt;You do not need loops. This implements a moving average filter, a median filter, and a median filter followed by a moving average:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%x = noise1;&#xA;x = randn(1,2000)+1;&#xA;lengthMean = 5;&#xA;lengthMedian = 7;&#xA;xFiltMedian = medfilt1(x,lengthMedian);&#xA;xFiltMean = filter(ones(lengthMean,1)/lengthMean,1,x);&#xA;xFiltMedianMean = filter(ones(lengthMean,1)/lengthMean,1,xFiltMedian);&#xA;figure(1);clf;hold on&#xA;plot(x(500:1500),'b');&#xA;plot(xFiltMedian(500:1500),'r');&#xA;plot(xFiltMean(500:1500),'g');&#xA;plot(xFiltMedianMean(500:1500),'c');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As said by @jojek the median filter is often more efficient than an averaging filter for spikes and outliers. And if you choose to apply both filters, it is generally more useful to apply the  median first (as done in the code above). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The choice of filter length should normally be related to properties of your signal and the noise (spectrum, distribution), and to the goal  you are assigned with. But the length of the signal is usually not a criterion.  For symmetry  properties, odd-length filters are practical. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without further details, you can start with longer filters (e.g. &lt;code&gt;lengthMedian= 37&lt;/code&gt;), see how they perform (how they reduce the  noise but also degrade the signal's properties), and reduce the length progressively to the equilibrium point, where shorter filters do not yield better results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the noise in the  valley suggests it is not stationary, so you may need more adaptive filters (e.g. with a varying length), or a little more involved like a &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/23077-weighted-median&quot; rel=&quot;nofollow noreferrer&quot;&gt;weigthed median filter&lt;/a&gt; that limits the location and flattening issues you get with long median filters. It is discussed on &lt;a href=&quot;https://stats.stackexchange.com/questions/167977/weighted-median&quot;&gt;SE Cross validated&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2016-04-06T08:38:37.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29934" PostTypeId="1" AcceptedAnswerId="29935" CreationDate="2016-04-05T20:02:43.420" Score="2" ViewCount="1025" Body="&lt;p&gt;There is the concept of audio played at specific locations relative to the listener, such as in games.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What are the details of how this is accomplished in stereo or higher number of channels?&lt;/li&gt;&#xA;&lt;li&gt;I know that there is volume adjustment and delaying of playback for the farther ear (in the case of stereo), but does anyone know the details of that? &lt;/li&gt;&#xA;&lt;li&gt;Are there other considerations?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15130" LastEditorUserId="1629" LastEditDate="2016-04-05T21:44:08.063" LastActivityDate="2019-01-19T16:32:15.560" Title="How to do 3D audio?" Tags="|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29935" PostTypeId="2" ParentId="29934" CreationDate="2016-04-05T20:58:55.813" Score="5" Body="&lt;p&gt;first, there is a difference between doing this with headphones or doing this with a pair or larger collection of loud speakers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there are a few basic physical and physiological mechanisms:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Interaural_time_difference&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;interaural time difference&lt;/strong&gt;&lt;/a&gt; (ITD) from which &lt;a href=&quot;https://en.wikipedia.org/wiki/Blumlein_Pair&quot; rel=&quot;nofollow noreferrer&quot;&gt;Blumlein stereo&lt;/a&gt; is based on.  this is the most salient or precise &lt;a href=&quot;https://en.wikipedia.org/wiki/Sensory_cue&quot; rel=&quot;nofollow noreferrer&quot;&gt;cue&lt;/a&gt; to locate the azimuth angle (where in front or behind of the listener, from left to right) of a sound source, but it does not differentiate between whether the source is in front or rear or above or below. if you can imagine an axis that goes through your head, from left to right, where your ears (or ear openings) are, if a sound at, say 40° left from directly in front, causes the sound to arrive at your left ear 450 microseconds before arriving at your right ear (that's the ITD), there is an imaginary cone centered on that axis with the same 40° going around and &lt;strong&gt;all&lt;/strong&gt; sources of sound lying on that cone will have the same ITD.  you cannot tell if it's 40° left of front or 40° down from straight up (on the left) or 40° left of directly behind or 40° up from straight down (on the left).  ITD is only about the time difference, it is not the model of front vs. up vs. behind vs. down.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://interface.cipic.ucdavis.edu/images/research/pathgeo.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://interface.cipic.ucdavis.edu/images/research/pathgeo.gif&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Head-related_transfer_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;head-related transfer functions&lt;/strong&gt;&lt;/a&gt; (HRTF) which models the &lt;a href=&quot;https://en.wikipedia.org/wiki/Auricle_(anatomy)&quot; rel=&quot;nofollow noreferrer&quot;&gt;pinna&lt;/a&gt; of the ear (and perhaps head shading, but i think that is less salient).  because the pinna shape is not the same viewed from in front or behind or above, the &lt;em&gt;&quot;pinna cues&quot;&lt;/em&gt; are what will tell your brain where the sound source might be in addition to the information coming from ITD.  &lt;a href=&quot;http://interface.cipic.ucdavis.edu/sound/tutorial/hrtf.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this looks like a good tutorial for HRTF.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/5/53/Hrtf_diagram.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/5/53/Hrtf_diagram.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Nqwo1.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nqwo1.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;oh, there are a few more physical mechanisms. (the above two mechanisms will give the listener an azimuth and elevation angle, but not distance or depth.)&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;inverse-square law with distance.&lt;/strong&gt;  every time you double the distance of the sound source from the listener, the power intensity (watts per square meter) is reduced by a factor of 4 (the &quot;voltage&quot; level is cut in half) which is a 6 dB drop in the signal level.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;filtering from distance.&lt;/strong&gt;  in addition, high frequencies are sometimes attenuated by distance and by reflections off of soft surfaces more than low frequencies.  the transfer function is not only a delay (&lt;span class=&quot;math-container&quot;&gt;$e^{-s\tau}$&lt;/span&gt;)  so distant sounds might be a little bit low-pass filtered, less &quot;crisp&quot;, than sounds that are much closer.  consider the classic movie effect sound of the &lt;a href=&quot;https://www.audioblocks.com/stock-audio/shotgun-pump-action-sound-effect.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;pump-action shotgun being actuated&lt;/a&gt;.  consider what that will sound like if it is up close or further away.  it won't only be quieter when further away, but a little less crisp.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;direct/reflection energy ratio.&lt;/strong&gt;  if the brain decodes multiple arrivals of a sound that are correlated, the first arrival might be considered the direct path and the latter arrivals are reflections.  if the energy of the direct is much more than the energy of the reflections, the sound might be perceived to be closer.  if the energy of the direct is at about the same energy as that of the reflections, the sound might be perceived to be farther away.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oZYKo.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oZYKo.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i s'pose i could blap some transfer function - matrix math to outline the HRTFs from source to each ear.  that will take more time to look up.  don't wanna do this from out of my memory.  &lt;a href=&quot;https://en.wikipedia.org/wiki/Sound_localization&quot; rel=&quot;nofollow noreferrer&quot;&gt;here's a good Wikipedia article.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="26573" LastEditDate="2019-01-19T16:32:15.560" LastActivityDate="2019-01-19T16:32:15.560" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="29936" PostTypeId="1" CreationDate="2016-04-06T02:32:41.033" Score="1" ViewCount="1846" Body="&lt;p&gt;Are you kind to tell me the odds or the means by which should I grab a clean signal with the $~50 \mathrm{Hz}$ hum removed using just programming? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to make a program in Visual-C that composes a sinusoid and overlaps it over a signal in a file. The file is recorded using a microphone. At recording time using a PC I get the frequency hum of the AC, with the phase with which it overlaps the signal. I see that the noise's frequency is not influenced and remains constant over time.&lt;/p&gt;&#xA;" OwnerUserId="20406" LastEditorUserId="20406" LastEditDate="2018-02-18T12:22:19.363" LastActivityDate="2018-02-18T12:22:19.363" Title="How to remove 50 Hz frequency noise from a PCM file?" Tags="|audio|frequency|phase|pll|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29938" PostTypeId="2" ParentId="29931" CreationDate="2016-04-06T05:01:01.533" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MYRHU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MYRHU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Transfer Function:&#xA;$$TF = \frac{1}{s}\cdot\frac{\omega_n^2}{s^2+2\xi \omega_n s+\omega_n^2}$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Settling time:&#xA;$$T_s = \frac{-\ln (0.02\sqrt{1-\xi ^2})}{\xi \omega_n} $$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Rise Time&#xA;$$\omega_n T_r = 1.76 \xi ^3 - 0.417\xi ^2 + 1.039\xi + 1 $$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Overshoot time:&#xA;$$\zeta = \frac{-\ln(\%\mathrm{OS}/100)}{\sqrt{\pi^2+\ln^2(\%\mathrm{OS}/100)}} $$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Exactly, this is the stable system. Because as the x-axis tends to infinity the system goes to zero. So we can say the poles are exactly minus value. This system has long rise time and settling time. Therefore it is a over-damped system. We can say those things using the graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to prove mathematically, we must known the transfer function of the system.&lt;/p&gt;&#xA;" OwnerUserId="20396" LastEditorUserId="8202" LastEditDate="2016-04-07T07:56:48.607" LastActivityDate="2016-04-07T07:56:48.607" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29939" PostTypeId="1" CreationDate="2016-04-06T06:52:13.197" Score="2" ViewCount="229" Body="&lt;p&gt;I have been given the task to develop a code which checks if the display of a device is showing information correctly (i.e. any segments are activating when they are not supposed to).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To meet this goal the device is able to show different segment sets, especifically symbol segments, numeric segments, all segments and none.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image is captured in these conditions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2tu9X.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2tu9X.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prepare the image, I rotate it and  afterwards apply some filtering while decomposing the image channels and working on the Green channel, resulting in the following image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dwQ5b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dwQ5b.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using HALCON to carry out this task, developing a code which performs a pattern matching over a set of ROIs with the following result. For the following images I zommed in to the region most interesting for the pattern matching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RjIlT.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RjIlT.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in the resulting pattern, there are some segments I am not checking (i.e the decimal points) while some not being completely checked like the PROG segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After altering the parameters I get the following pattern:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M3ywM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M3ywM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, it now checks for more information, but now there have appeared undesired traces in the pattern, which might end up affecting the performance of the pattern matching procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the images taken are not the original ones, I have performed the following filters on the image:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;shock_filter (ImageRotate, SharpenedImage, 0.1, 20, 'canny', 1)&#xA;&#xA;binomial_filter (SharpenedImage, ImageBinomial, 9, 17)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Am I approaching this pattern detection correctly? If not, how should I approach it.&lt;/li&gt;&#xA;&lt;li&gt;For better results, should I illuminate the display as to reduce the amount of noise to a minimum?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I feel like I should do a matching per every segment group (Perform a matching for every ROI)&lt;/p&gt;&#xA;" OwnerUserId="18373" LastEditorUserId="18373" LastEditDate="2016-04-06T08:29:46.693" LastActivityDate="2016-04-06T08:29:46.693" Title="How to properly detect segments in a LCD segment display" Tags="|image-processing|image-segmentation|detection|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29940" PostTypeId="1" AcceptedAnswerId="29945" CreationDate="2016-04-06T12:40:54.287" Score="1" ViewCount="677" Body="&lt;p&gt;I'm working on a project where I need to measure the size of a 2D object on a flat surface from an image. I have total freedom to create a reference with any shape and size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The camera I am using is the &lt;a href=&quot;https://www.raspberrypi.org/products/camera-module/&quot; rel=&quot;nofollow noreferrer&quot;&gt;raspberry pi cam.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is simple: what is the best reference to use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ended up using &lt;a href=&quot;http://www.uco.es/investiga/grupos/ava/node/26&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; thanks to &lt;a href=&quot;https://dsp.stackexchange.com/users/80/peter-k&quot;&gt;Peter K.&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18167" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-04-19T11:14:51.637" Title="Best reference for object size estimation in an image" Tags="|image-processing|object-recognition|measurement|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29941" PostTypeId="2" ParentId="29936" CreationDate="2016-04-06T13:28:51.543" Score="2" Body="&lt;p&gt;You should just use a notch filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below shows two sinusoids added together (top) and the result of filtering the lower frequency one (bottom).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter is just:&#xA;$$&#xA;H(z) = \frac{1 - 2 \cos(2\pi \omega_{b}) z^{-1} + z^{-2}}&#xA;{1 - 2 \alpha \cos(2\pi \omega_{b}) z^{-1} + \alpha^2z^{-2}}&#xA;$$&#xA;where $\omega_b$ is the bad frequency and $\alpha&amp;lt;1.0$ is related to the notch width / depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5eaS9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5eaS9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#29936&#xA;&#xA;fs &amp;lt;- 8000&#xA;fbad &amp;lt;- 50&#xA;phibad &amp;lt;- 2*pi*runif(1,0,1)&#xA;fgood &amp;lt;- 101.98340234&#xA;phigood &amp;lt;- 2*pi*runif(1,0,1)&#xA;&#xA;T &amp;lt;- 1000&#xA;t &amp;lt;- seq(1,T)&#xA;&#xA;x_noisy &amp;lt;-  sin(2*pi*fgood/fs*t + phigood) + sin(2*pi*fbad/fs*t + phibad) &#xA;&#xA;num &amp;lt;- c(1, -2*cos(2*pi*fbad/fs), 1)&#xA;alpha &amp;lt;- 0.99&#xA;den &amp;lt;- c(1, -2*alpha*cos(2*pi*fbad/fs), alpha*alpha)&#xA;&#xA;x_filtered &amp;lt;- filter(num, den, x_noisy)&#xA;&#xA;par(mfrow = c(2,1))&#xA;plot(t,x_noisy, type=&quot;l&quot;)&#xA;&#xA;plot(t,x_filtered, type=&quot;l&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-06T13:28:51.543" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29942" PostTypeId="1" CreationDate="2016-04-06T13:36:26.417" Score="0" ViewCount="153" Body="&lt;p&gt;I have two signals, the first is a reference signal from which I selected a segment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to find which segment of the other signal is the most similar to this selected segment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd be glad to have some ideas.&lt;/p&gt;&#xA;" OwnerUserId="20416" LastEditorUserId="13320" LastEditDate="2016-11-13T13:24:06.827" LastActivityDate="2016-11-13T13:24:06.827" Title="Detection of similar segments of two signal" Tags="|signal-analysis|signal-detection|" AnswerCount="1" CommentCount="2" ClosedDate="2016-11-13T18:32:29.320" ContentLicense="CC BY-SA 3.0" />
  <row Id="29943" PostTypeId="1" AcceptedAnswerId="29949" CreationDate="2016-04-06T13:52:35.310" Score="1" ViewCount="573" Body="&lt;p&gt;I am a beginner in the field of Image processing. I was designing a camera sensor when I came across these two type of sensors:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Active_pixel_sensor&quot; rel=&quot;nofollow noreferrer&quot;&gt;CMOS (Active Pixel Sensor)&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Oversampled_binary_image_sensor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Oversampled Binary Image Sensor&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now, I can find many websites for comparing CMOS vs CCD but nowhere can I find a comparison with OBIS. Why is this? Is the OBIS too &lt;strong&gt;outdated&lt;/strong&gt; to be used?&lt;/p&gt;&#xA;&lt;p&gt;I was thinking of designing a camera that captures images using OBIS and later converts them into RGB format (with a variety of processes I have not discussed here). The advantages of Binary Sensor I mentioned Low image size and super fast processing. Are these really going to be an advantage over CMOS sensor? Will my camera be a success or is this a really bad idea trying to use Binary Image sensor? Is using Binary Sensor a good idea or is it a too outdated idea?&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance for helping this novice!!&lt;/p&gt;&#xA;" OwnerUserId="20414" LastEditorUserId="60971" LastEditDate="2022-05-18T02:47:06.333" LastActivityDate="2022-05-18T02:47:06.333" Title="Oversampled Binary Image Sensor vs Active Pixel Sensor(CMOS)" Tags="|image-processing|camera|sensor|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="29945" PostTypeId="2" ParentId="29940" CreationDate="2016-04-06T19:48:37.260" Score="1" Body="&lt;p&gt;The usual way to do this is to form a calibration plate.  One way to form a calibration plate is to place known-shaped &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fiducial_marker&quot; rel=&quot;nofollow noreferrer&quot;&gt;fiducials&lt;/a&gt;&quot; in a known-sized array on the surface where you want to do the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, knowing the measurements of the calibration plate, you can count pixels and do a map from pixels in each direction (possibly in each area of the image) to real-world measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need to know that your camera will always be in a fixed location relative to the measurement surface, and that the lighting is good enough for you to pick up the external shape of the object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of one possible calibration plate is below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0dWdz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0dWdz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-06T19:48:37.260" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29946" PostTypeId="1" CreationDate="2016-04-06T20:58:50.307" Score="5" ViewCount="9092" Body="&lt;p&gt;I am trying to write a Python script that can demodulate an FSK modulated audio file and return the data encoded in the audio.  The data being transmitted is GPS NMEA strings which are embedded as the audio channel in video files.  Basically, text is encoded with FSK modulation, and I am trying to retrieve the text using Python.  The device I am using to encode the data can also decode it, so I have been able to generate the correct output, but I need to be able to do it using software.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have done some background reading to introduce myself to signal processing and FSK, and I have looked at example scripts, but I feel a little lost in the specific application of building my own demodulator in software.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to write a Python script that runs successfully, although the output is incorrect.  The correct output derived from the encoding/decoding device has 8,280 raw binary (0 and 1) characters, the Python output has 1,344,786.  I think I am missing a symbol synchronizer, but I'm not sure how this works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question now is: how can I add symbol synchronization to the script and/or symbol timing?  Are there better examples or explanations of how to do FSK demodulation in Python?  I would appreciate any feedback or direction.  Thank you.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;I have changed my original script.  Now there is a problem where the mark and space frequencies (1200 Hz and 2200 Hz, respectively) have the same shape when plotted, and the output of the script is all 1s.  The script works by bandpass filtering each frequency, comparing them, and deciding a 1 when mark is greater than space (based on &lt;a href=&quot;http://www.control.aau.dk/~kresten/stuff/GND/FSK_signals_demod.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a spectrogram (from Baudline) of the audio file:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vzT7o.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vzT7o.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: This is my updated script with as suggested in comments:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import scipy.signal.signaltools as sigtool&#xA;from scipy import signal&#xA;from scipy.signal import butter, lfilter, blackman&#xA;import wave&#xA;import struct&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;from scipy.fftpack import rfft, rfftfreq&#xA;&#xA;mark_f = 1200&#xA;space_f = 2200&#xA;Fs = 44100&#xA;&#xA;waveFile = wave.open(&quot;Sample4_160224_mono.wav&quot;, &quot;r&quot;)&#xA;length = waveFile.getnframes()&#xA;sig = []&#xA;for i in range(0, length):&#xA;    waveData = waveFile.readframes(1)&#xA;    data = struct.unpack(&quot;&amp;lt;h&quot;, waveData)&#xA;    sig.append(data)&#xA;&#xA;&#xA;# Bandpass filter mark and space frequencies:&#xA;&#xA;low_bpass = signal.remez(5, [.1,.109,.11,.13,.131,.14],[0,1,0])&#xA;mark_filtered = signal.lfilter(low_bpass, 1, sig)&#xA;&#xA;high_bpass = signal.remez(5, [.2,.209,.2100,.23,.231,.2400],[0,1,0])&#xA;space_filtered = signal.lfilter(high_bpass, 1, sig)&#xA;&#xA;&#xA;# Envelope detector on mark and space bandpass filtered signals:&#xA;&#xA;mark_env = np.abs(sigtool.hilbert(mark_filtered))&#xA;space_env = np.abs(sigtool.hilbert(space_filtered))&#xA;&#xA;&#xA;# Compare and decision:&#xA;&#xA;seq = range(0, len(mark_env))&#xA;rx = []&#xA;for i in seq:&#xA;    if mark_env[i] &amp;gt; space_env[i]:&#xA;        rx.append(1)&#xA;    if mark_env[i] &amp;lt; space_env[i]:&#xA;        rx.append(0)&#xA;    if mark_env[i] == space_env[i]:&#xA;        rx.append(0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19205" LastEditorUserId="19205" LastEditDate="2016-04-11T19:59:41.570" LastActivityDate="2022-04-13T06:04:20.580" Title="Demodulating FSK audio in Python" Tags="|audio|python|demodulation|fsk|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="29947" PostTypeId="2" ParentId="29692" CreationDate="2016-04-06T20:59:27.807" Score="1" Body="&lt;p&gt;I am just working through this information myself, but I believe I understand your questions.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;If I put $S_x^0(f-\alpha/2)$ in the denominator then won't the denominator essentially become $S_x^0(f)$, since $\alpha = 0$?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It will become $|S_x^0(f)|$ at $\alpha = 0$, but at other values of $\alpha$, you would need the conjugate multiply at offsets of $f$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;Will $C_x^\alpha$ be of the same size as $S^\alpha_x$?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, one would think. The coherence SOF function, is just supposed to be some normalized version of the SCF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am struggling with the FAM, it appears to output data on a tilted spectral plane, where $\alpha=0$ lies on the matrix diagonal. &lt;/p&gt;&#xA;" OwnerUserId="20419" LastEditorUserId="8202" LastEditDate="2016-04-07T06:24:21.443" LastActivityDate="2016-04-07T06:24:21.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29948" PostTypeId="1" AcceptedAnswerId="29951" CreationDate="2016-04-06T22:15:59.903" Score="1" ViewCount="2815" Body="&lt;p&gt;I have implemented a matched filter based on the Fourier Transform approach. In the real numbers domain that means that I use as the coefficients of my filter (B) the inverted time-samples of the signal that I'm trying to find and I compute:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;real_output = IFFT(FFT(A).*FFT(B))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where, if we assume the moment of exact match, A is an input signal of real value samples and B is the signal made from inverted time-samples of A (or I can also conjugate the spectrum of B and I get the required time inversion because the signal is real). In order to avoid aliasing I perform both FFT with length(A)+length(B)-1 samples.&#xA;The output of this filter is always real and its maximum, points at the moment in which a match has occurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assume that instead of a real valued A we have a complex valued A. My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible to apply a matched filter for complex domain signals?&lt;/li&gt;&#xA;&lt;li&gt;Would I have to invert the complex valued A to get the coefficients of my filter or should I do something else like conjugating them?&lt;/li&gt;&#xA;&lt;li&gt;How do I interpret the output of the filter, should I say a match happens if the absolute value of the output is maximum or just when the real part is maximized?&lt;/li&gt;&#xA;&lt;li&gt;In some experiments I have noticed that at the moment of a match the output of the filter is real if spectrum(B) is the complex conjugate of spectrum(A), is this correct?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="17077" LastEditorUserId="17077" LastEditDate="2018-03-14T14:17:02.180" LastActivityDate="2018-03-14T14:17:02.180" Title="How to interpret output of matched filter with complex input?" Tags="|discrete-signals|fourier-transform|signal-detection|matched-filter|conjugate|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29949" PostTypeId="2" ParentId="29943" CreationDate="2016-04-06T23:31:47.343" Score="2" Body="&lt;p&gt;The success of your camera depends on too many factors! and they're out of the scope of this page. If the dynamic range requirements of your application are not too demanding then you could take advantage of the fast sampling rate and try to reconstruct a low quality image (by the same principle by which sigma delta modulation works, eg reconstructing a PCM signal from the output of a 1 bit output digital microphone). There's technique called halftoning, which has been the basis for reproducing images in print media since the invention of the newspaper. It is based on sampling an image with 1 bit and diffusing the error. Determining if using a Binary Sensor instead of a CMOS is a good or bad idea depends on your intended application. You should also pay attention to the size of the objects you want to picture. CMOS technology is widely used and you could probably find a cheap sensor to use in your camera.&lt;/p&gt;&#xA;" OwnerUserId="17077" LastActivityDate="2016-04-06T23:31:47.343" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29950" PostTypeId="2" ParentId="29942" CreationDate="2016-04-06T23:41:44.067" Score="1" Body="&lt;p&gt;You could use correlation between the two signals or a matched filter in which you set the filter coefficients as the samples from the selected segment inverted in time. In matlab it would be something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;coef = knownSegment (end:-1:1,:);&#xA;&#xA;minSize = length(other_signal) + length(knownSegment) - 1;&#xA;N = 2^nextpow2(minSize);&#xA;OUT = ifft(fft(other_signal,N).*fft(coef,N));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you find the maximum value of variable OUT and at that point in time the two signals are most similar&lt;/p&gt;&#xA;" OwnerUserId="17077" LastActivityDate="2016-04-06T23:41:44.067" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29951" PostTypeId="2" ParentId="29948" CreationDate="2016-04-07T01:07:28.440" Score="3" Body="&lt;p&gt;Yes, it is possible (at least on paper or code, since complex signal don't exist physically) to apply a matched filter to complex signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one way to look at it that I think is illustrative. Assume that a pulse $p(t)$ is real and has energy 1, that is, $$\int_{-\infty}^\infty p^2(t) \, dt=1.$$ The filter matched to $p(t)$ has impulse response $p(-t)$. Then, if the filter's input is $ap(t)$ for real $a$, the matched filter's output (sampled at the appropriate time) is equal to $$ap(t)\star p(-t)=a.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the pulse amplitude is complex, say $a+jb$ for real $a$ and $b$, then we can use the linearity of the convolution operation to calculate &#xA;\begin{align}&#xA;(a+jb)p(t) \star p(-t) &amp;amp;= \left(ap(t)+jbp(t)\right) \star p(-t) \\&#xA;&amp;amp;=ap(t)\star p(-t) + jbp(t)\star p(-t) \\&#xA;&amp;amp;= a+jb.&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to interpret the result is that the filter is matching the real part and the imaginary part independently (but &quot;at the same time&quot;). Recall that $j=\sqrt{-1}$ is orthogonal to the real line; this means that $a$ and $b$ don't &quot;interfere&quot; with each other during the convolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize, the answers to your questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Yes.&lt;/li&gt;&#xA;&lt;li&gt;If you can define the system as using a real pulse $p(t)$, then the matched filter is $p(-t)$. If you must use a complex pulse, then the matched filter is $p^\star(-t)$.&lt;/li&gt;&#xA;&lt;li&gt;A &quot;match&quot; can be declared when the filter's ouput is close enough (in Euclidean distance sense) to the matched signal (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Maximum_a_posteriori_estimation&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Maximum_a_posteriori_estimation&lt;/a&gt; for more details).&lt;/li&gt;&#xA;&lt;li&gt;The output of the filter should be real only when $b$ is zero.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-04-14T16:59:06.557" LastActivityDate="2016-04-14T16:59:06.557" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29953" PostTypeId="1" CreationDate="2016-04-07T04:07:52.553" Score="3" ViewCount="476" Body="&lt;p&gt;I am using an on-chip SAR adc where for some reason I can only get accurate signal reconstruction and filtering when I sample at almost 100 times my desired sampling frequency. Specifically, the minimum working sampling rate right now is 25KHz but the desired sampling rate is 500Hz for a signal with a BW of 0.5-100Hz, therefore I am still slightly oversampling this signal but the 25KHz is clearly overkill. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to downsample this signal to that desired sampling frequency to aid in the design and implementation of digital filters in that passband of .5-100Hz. I know a key thing to look out for is aliasing and because of that you should use a digital anti-aliasing filter but is it pretty much the same concept as an analog anti-aliasing filter where I simply lowpass filter the signal bandwidth that I want to reconstruct after sampling? Also are there any other pitfalls/design tips that I should know to be able to implement downsampling in a DSP? Thanks in advance.   &lt;/p&gt;&#xA;" OwnerUserId="20374" LastActivityDate="2016-04-08T11:16:42.950" Title="Question about decimation/downsampling" Tags="|modulation|downsampling|digital-filters|analog-to-digital|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29954" PostTypeId="2" ParentId="29953" CreationDate="2016-04-07T05:12:41.667" Score="1" Body="&lt;p&gt;The key point is that you remove any signal outside of the final bandwidth before downsampling to avoid aliasing. If you want to do this analog or digitally it doesn't really make a difference technically. From an engineering perspective, digital filtering is typically more economical. As for pitfalls/design tips - if you do use digital filtering keep in mind that you can save CPU cycles by not computing filtered output samples which will ultimately be thrown away by downsampling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to conclude, design a 100Hz LPF FIR at the 25kHz sample rate, run the filter on every 50th sample and then throw all but those samples away.&lt;/p&gt;&#xA;" OwnerUserId="15735" LastEditorUserId="15735" LastEditDate="2016-04-07T06:08:09.883" LastActivityDate="2016-04-07T06:08:09.883" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29955" PostTypeId="1" AcceptedAnswerId="29986" CreationDate="2016-04-07T09:51:28.957" Score="2" ViewCount="723" Body="&lt;p&gt;In standard MRA we have that the space of functions at scale J can be expressed as&lt;br&gt;&#xA;$$V_j = V_0\oplus \left(\bigoplus_{j=0}^{J} W_j\right)$$&#xA;where $V_0$ is spanned by the orthonormal system of the translates of the scaling function $\phi(x)$, i.e. $V_0 = \overline{\text{span}}\{\phi(x-k)\}_{k\in\mathbb{Z}}$ and the detail spaces $W_j$ are spanned by the wavelets ,i.e. $W_j = \overline{\text{span}}\{\psi_{j,k}\}_{k\in\mathbb{Z}}$, being $\psi_{j,k} = 2^{j/2}\psi(2^j x - k)$ and $\psi(x)$ the mother Wavelet. From the two scales equation and from the wavelet equation we obtain the iterative algorithm to compute the coefficients at the coarser scale from those of the finer one. That is, given a function $f(x)$ in $V_J$ (which can be for instance an approximation of another function up to such scale) then since by definition of MRA we have that $\{\phi_{j,k}\}_{k\in\mathbb{Z}}=\{2^{j/2}\phi(2^jx-k)\}_{k\in\mathbb{Z}}$ spans $V_j$, we can compute the coefficients $a_{J,k} = \langle f,\phi_{J,k} \rangle$ and then I can compute the coefficients at each scale $0\le j&amp;lt;J$ as &#xA;$$a_{j,k} = \sum_{l\in\mathbb{Z}} h(l-2k)a_{j+1,l},\qquad b_{j,k} = \sum_{l\in\mathbb Z}g(l-2k)a_{j+1,l}$$&#xA;where $b_{j,k} = \langle f,\psi_{j,k}\rangle$ and $h(n)$ and $g(n)$ are the scaling and wavelet filters, such that $$\phi(x) = \sqrt{2}\sum_{k\in\mathbb Z} h(k)\phi(2x-k),\qquad\psi(x) = \sqrt{2}\sum_{k\in\mathbb Z} g(k)\phi(2x-k)$$&#xA;So, once I have $a_{J,k}$ I can compute the whole decomposition, making filtering and all the operations I want and then re-synthetize the function inverting the iterative relation among the coefficients and rewriting&#xA;$$ f = \sum_{k\in\mathbb Z} a_{J,k}^{new} \psi_{J,k}$$&#xA;The problem is, in order to start the whole I need to compute the scalar products&#xA;$$a_{J,k} = \langle f,\phi_{J,k} \rangle$$ &#xA;How I can I do it is I only have some samples of $f(x)$, say $\{f(x_i)\}_{0\le i\le N} $ ? (note that the samples can also be not equally spaced). &#xA;The solutions I heard about are&lt;br&gt;&#xA;1) Use the low of large numbers and approximate&#xA;$$\hat{a}_{J,k} = \dfrac{1}{N}\sum_{i=1}^N f(x_i)\phi_{J,k}(x_i)$$&lt;br&gt;&#xA;2) Solve the system of N equations &#xA;$$ f(x_i) = \sum_{k} \hat{a}_{J,k}\phi_{J,k}(x_i)$$&lt;br&gt;&#xA;The first one is the simplest, and has the advantage that it can be computed very fast as a new sample arrives, however it has the problem that many coefficients will be undefined and many will be defined with very few terms. The second asks to solve a possibily big system of equations any time a new sample arrives. Are there any smart way to compute the tarting coefficients $a_{J,k}$?&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2020-05-26T21:54:32.063" Title="Wavelet transform: How to compute the initial coefficients when only samples are available?" Tags="|wavelet|transform|approximation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29956" PostTypeId="1" AcceptedAnswerId="29958" CreationDate="2016-04-07T10:42:45.733" Score="0" ViewCount="914" Body="&lt;p&gt;I have the input and the output of a system and I want to determine the transfer function of it. I am using Ident Tool from Matlab.&#xA;How is it more ok: to normalize the output and the input between 0 and 1 or to leave it as they are?&lt;/p&gt;&#xA;" OwnerUserId="16809" LastActivityDate="2016-04-07T12:16:09.810" Title="Normalize data for transfer function determination?" Tags="|system-identification|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29957" PostTypeId="2" ParentId="2140" CreationDate="2016-04-07T11:41:00.843" Score="0" Body="&lt;p&gt;If you have two sequences of input and output samples and you use least squares you need your input to persistently explore the input space, i.e. you have to invert matrix $H^T H$ being &#xA;$$&#xA; H = \begin{pmatrix}&#xA;y(n) &amp;amp; y(n-1) &amp;amp; \dots &amp;amp; y(1) &amp;amp; u(n) &amp;amp; ... &amp;amp; u(1)\\&#xA;y(n+1)&amp;amp;y(n) &amp;amp; \dots &amp;amp;y(2) &amp;amp; u(n+1) &amp;amp; \dots &amp;amp; u(2)\\&#xA;\vdots &amp;amp; \vdots &amp;amp; &amp;amp; \vdots &amp;amp;\vdots &amp;amp;&amp;amp;\vdots\\&#xA;y(L-1) &amp;amp; y(L-2)&amp;amp; \dots &amp;amp;y(L-n-1) &amp;amp; u(L-1) &amp;amp;\dots &amp;amp; u(L-n-1)&#xA;\end{pmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so a good sequence will be a sequence of uncorrelated samples, for example a white noise sequence&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-04-07T11:41:00.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29958" PostTypeId="2" ParentId="29956" CreationDate="2016-04-07T11:45:05.080" Score="1" Body="&lt;p&gt;For what I know there is no reason to normalize data in general, if you use least squares like methods, all you need is that your input is persistently exciting, in the sense that the Hankel matrix $H$ of the observations must be such that $H^T H$ is nonsingular.&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-04-07T11:45:05.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29959" PostTypeId="2" ParentId="29922" CreationDate="2016-04-07T11:54:52.147" Score="2" Body="&lt;p&gt;If $\{h(n)\}_{n\in\mathbb{N}}$ is the scaling filter, i.e. the sequence such that&#xA;$$&#xA;\phi(x) = \sum_{n} h(n) 2^{1/2} \phi(2x-n)&#xA;$$&#xA;where with $\phi(\cdot)$ I indicated the scaling function, then the mother wavelet satisfies&#xA;$$&#xA;\psi(x) = \sum_{n} g(n) 2^{1/2} \phi(2x - n)&#xA;$$&#xA;being&#xA;$$&#xA;g(n) = (-1)^n \overline{h(1-n)}$$&#xA;being $\bar{z}$ the complex conjugate of $z\in\mathbb{C}$.&#xA;This according to D. F. Walnut, An Introduction to Wavelet Analysis&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-04-07T11:54:52.147" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29960" PostTypeId="2" ParentId="29956" CreationDate="2016-04-07T12:16:09.810" Score="0" Body="&lt;p&gt;If you system is linear, the linear property holds: multiplying the input by $\lambda$ should yield an output multiplied by $\lambda$. So you should not normalize I/Os independently, which happens when you normalize them between $0$ and $1$, since you will be using the $\min$ and $\max$ separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is possible to normalize them to the same units, if for some reason, inputs are in mV and output in V, for instance.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-04-07T12:16:09.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29961" PostTypeId="1" CreationDate="2016-04-07T12:33:25.080" Score="0" ViewCount="869" Body="&lt;p&gt;I know we can shift an image entirely with FFT as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/25827916/matlab-shifting-an-image-using-fft&quot;&gt;https://stackoverflow.com/questions/25827916/matlab-shifting-an-image-using-fft&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, is it possible to shift the image pixel-wise? I just found a similar description in a recently published paper:&#xA;X. Wang, L. Li, and G. Hou, &quot;High-resolution light field reconstruction using a hybrid imaging system,&quot; Appl. Opt.  55, 2580-2593 (2016). &#xA;They use a subband approach that really confused me.&lt;/p&gt;&#xA;" OwnerUserId="20430" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-06-07T12:53:11.187" Title="Possible to shift image pixel-wise with FFT?" Tags="|image-processing|fft|dft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29962" PostTypeId="1" CreationDate="2016-04-07T13:54:01.383" Score="13" ViewCount="5007" Body="&lt;p&gt;I am using the &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=1162598&quot; rel=&quot;noreferrer&quot;&gt;Average Magnitude Difference Function&lt;/a&gt; to estimate the fundamental frequency of a quasi-periodic audio signal. The AMDF is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ D_n = \frac{1}{N-n}\sum_{k=n}^{N-1}|S_k - S_{k-n}| $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $N$ is the length of the signal. This function exhibits a minimum when the signal is shifted by an amount equal to its period. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I am using to extract the pitch (in Matlab):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; a = amdf(f);&#xA; a = a/max(a);&#xA; [p l] = findpeaks(-a, 'minpeakprominence', 0.6);&#xA; pitch = round(sample_freq/l(1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I am dealing with an audio signal where the fundamental frequency is very low: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vNpdd.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vNpdd.jpg&quot; alt=&quot;spectrum of the audio signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a consequence, a pitch doubling problem arises: the detected minimum corresponds to half the period of the signal (i.e. the second harmonic):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uPtMJ.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uPtMJ.jpg&quot; alt=&quot;AMDF of the signal above&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to extract the largest peak and not just the first, but sometimes this problem remains. How can I improve my code and/or the AMDF function in order to deal with low fundamental?&lt;/p&gt;&#xA;" OwnerUserId="15543" LastEditorUserId="4346" LastEditDate="2018-09-10T10:35:46.227" LastActivityDate="2021-01-06T05:33:41.300" Title="How to deal with low fundamental when using AMDF for pitch extraction?" Tags="|audio|pitch|fundamental-frequency|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29963" PostTypeId="1" CreationDate="2016-04-07T15:26:56.027" Score="4" ViewCount="2511" Body="&lt;p&gt;I am working with a discret Kalman filter on a System &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_{k+1}=A_k x_k+B_k u_k+\omega_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$y_k=C_k x_k+\upsilon_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E[\omega_k\omega_k^T]=Q$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$E[\upsilon_k \upsilon_k^T]=R$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have estimated the State from the available noisy $y(k)$, which is generated from the same system state equations with Reference Trajectory of the state. Then I have tested it with a wrong initial state $x_0$ and a big initial covariance (simulation 1). I have noticed that the KF works very well, after a few steps the gain $K$ quickly converges to a very small value near zero. I think it is maybe caused by the Process noise $Q$. I have set it small because the $Q$ stands for the accuracy of the model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to modify it to a Steady State Kalman filter. I used the steady gain from simulation 1 as constant instead of the calculation in every iteration. Then the five equations can be simplified to one equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{x}(k+1)=(I-KC)A \hat{x}(k)+(I-KC)B u(k)+K y(k+1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to test it with same initial state and covariance matrix as the one in simulation 1.&#xA;But the result is very different from reference trajectory, and even the result of simulation 1.&#xA;I have tested it with the covariance matrix $p_\infty$, which is solved from the discret Riccati equation. And the use the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$k_\infty=\dfrac{p_\infty C'}{C p_\infty C'+R}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This neither works. I am wondering:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How should I apply Steady State Kalman Filter and how should I set the initial state for it? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is Steady State KF only used for scalar system? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Should I use it with LQ-controller or some others?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Eddit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to compare the performence between standard Kalman filter and steady state Kalman filter like this:&#xA;firstly, I set a wrong Initial State: $X_0=[5, -6, 0]^T$ but in fact it should be $X_0=[0, 0, 0]^T$. And I set the $P_0$ like a diagonal Matrix, on the main Diagonal are $25, 36, 0$. I get the steady gain $k_\infty$ and  $p_\infty$ from solving the discret Riccati equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P_\infty=AP_\infty A^T-(AP_\infty C^T)(CP_\infty C^T+R)^{-1}(CP_\infty A^T)+Q$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be solved by using Matlab Toolbox. I adjust the Koefficient $Q$ ($R$ is constant and available) until the &quot;real&quot; Kalman gain same as $k_\infty$ and at the same time standard Kalman filter works well. Then I think $Q$ in this time the best one. The result is good&#xA;&lt;a href=&quot;https://i.stack.imgur.com/89O63.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/89O63.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;And now I don't know, how to set the parameter in steady state Kalman filter.&#xA;I set  $X_0=[5, -6, 0]^T$ and $R$ same as ones in the standard kalman filter and use $k_\infty$ as constant Kalman gain. But it works with same parametmer not well.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/a5FhU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a5FhU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to know, what's wrong with my design. &#xA;The plot is below:&lt;/p&gt;&#xA;" OwnerUserId="20432" LastEditorUserId="20432" LastEditDate="2016-04-08T08:28:46.293" LastActivityDate="2018-05-30T01:54:48.837" Title="State Estimation by steady state Kalman Filter" Tags="|kalman-filters|math|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29967" PostTypeId="2" ParentId="29962" CreationDate="2016-04-07T20:15:07.540" Score="0" Body="&lt;p&gt;Heuristically, the fundamental frequency of voiced speech will lie in the interval [70, 400] Hz. So, the first step would be to apply a bandpass filter to approximately isolate that band. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, you could apply a weighting function to the power spectrum. Near the fundamental, the weight should be near 1, while closer to the end of the band, the weight should be near 0. This weighting is normalized of course. I would recommend something super-linear: quadratic, quartic etc -- to really kill the octaves off.&lt;/p&gt;&#xA;" OwnerUserId="19259" LastActivityDate="2016-04-07T20:15:07.540" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29968" PostTypeId="2" ParentId="29962" CreationDate="2016-04-07T21:03:01.577" Score="15" Body="&lt;p&gt;This is what we call in the pitch-detection biz, the &amp;quot;&lt;strong&gt;octave problem&lt;/strong&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;First of all, I would change the AMDF to ASDF.  And I would not reduce the window size as the lag increases.  (Also, I am changing notation to what I consider to be more conventional.  &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;&amp;quot; is a discrete-time signal.)&lt;/p&gt;&#xA;&lt;p&gt;The Average Squared Difference Function (ASDF) of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; in the neighborhood of sample &lt;span class=&quot;math-container&quot;&gt;$x[n_0]$&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Q_x[k, n_0] \triangleq \frac{1}{N} \sum\limits_{n=0}^{N-1} \left(x[n+n_0-\left\lfloor \tfrac{N+k}{2}\right\rfloor] \ - \ x[n+n_0-\left\lfloor \tfrac{N+k}{2}\right\rfloor + k] \right)^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left\lfloor \cdot \right\rfloor$&lt;/span&gt; is the &lt;code&gt;floor()&lt;/code&gt; function and, if &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is even then &lt;span class=&quot;math-container&quot;&gt;$ \left\lfloor \frac{k}{2}\right\rfloor = \left\lfloor \frac{k+1}{2}\right\rfloor = \frac{k}{2} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, expand the square and consider what the summations look like as &lt;span class=&quot;math-container&quot;&gt;$N \to \infty$&lt;/span&gt; (not that &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; &lt;strong&gt;is&lt;/strong&gt; going to infinity, but to give you an idea if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is large).  The ASDF is directly related to the autocorrelation.  It is essentially the autocorrelation turned upside down.  These steps I will leave to you. &lt;a href=&quot;https://dsp.stackexchange.com/questions/22067/what-is-an-amdf/22070#22070&quot;&gt;take a look at this answer.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So now consider this finite-length &lt;em&gt;&amp;quot;autocorrelation&amp;quot;&lt;/em&gt; (in the neighborhood of sample &lt;span class=&quot;math-container&quot;&gt;$x[n_0]$&lt;/span&gt;) defined from the ASDF:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ R_x[k,n_0] = R_x[0,n_0] - \tfrac12 Q_x[k, n_0]  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ R_x[0, n_0] \triangleq \frac{1}{N} \sum\limits_{n=0}^{N-1} \Big(x[n+n_0-\left\lfloor \tfrac{N}{2}\right\rfloor]\Big)^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This value &lt;span class=&quot;math-container&quot;&gt;$R_x[0,n_0]$&lt;/span&gt; is a measure of the &lt;em&gt;mean power&lt;/em&gt; of the signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; in the neighborhood of &lt;span class=&quot;math-container&quot;&gt;$n \approx n_0$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$Q_x[0,n_0]=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q_x[k,n_0] \ge 0$&lt;/span&gt; for all lags &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, that means that &lt;span class=&quot;math-container&quot;&gt;$ R_x[k,n_0] \le R_x[0,n_0] $&lt;/span&gt; for all lags &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Another useful way to look at this autocorrelation taking place in the neighborhood centered at sample &lt;span class=&quot;math-container&quot;&gt;$x[n_0]$&lt;/span&gt; is to normalize &lt;span class=&quot;math-container&quot;&gt;$R_x[k, n_0]$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$R_x[0, n_0]$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ r_x[k,n_0] \triangleq \frac{R_x[k,n_0]}{R_x[0,n_0]} = 1 - \frac{Q_x[k,n_0]}{2 R_x[0,n_0]}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This normalized autocorrelation has &lt;span class=&quot;math-container&quot;&gt;$r_x[0,n_0]=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r_x[k,n_0] \le 1$&lt;/span&gt; for all other &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose for a minute that &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is periodic with period &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; (and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; happens to be an integer), then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ x[n+P] = x[n] \quad \forall n $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and  &lt;span class=&quot;math-container&quot;&gt;$Q_x[mP, n_0] = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_x[mP, n_0] = R_x[0, n_0] \ge R_x[k, n_0]$&lt;/span&gt; for any integer number of periods (&lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is an integer).  So you get a peak at &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt; and at &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; equal to any other multiple of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is periodic.  If &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is &lt;strong&gt;not&lt;/strong&gt; perfectly periodic, what we might expect is the biggest peak at &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt;, another peak (but slightly smaller) at &lt;span class=&quot;math-container&quot;&gt;$k=P$&lt;/span&gt; (the period we are looking for) and progressively smaller peaks for larger multiples of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can then expect that the value of the normalized autocorrelation, &lt;span class=&quot;math-container&quot;&gt;$r_x[k,n_0]$&lt;/span&gt; evaluated at a lag of &lt;span class=&quot;math-container&quot;&gt;$k=P$&lt;/span&gt; or other multiples of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; should be pretty close to 1.  That value &lt;span class=&quot;math-container&quot;&gt;$r_x[P,n_0]$&lt;/span&gt; can be thought of as a measure of the degree of periodicity (sometimes called the &lt;em&gt;pitch confidence&lt;/em&gt;) of the estimated period &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; for the quasiperiodic &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; in the neighborhood of &lt;span class=&quot;math-container&quot;&gt;$n \approx n_0$&lt;/span&gt;.  If &lt;span class=&quot;math-container&quot;&gt;$r_x[P,n_0]=1$&lt;/span&gt;, we can say that &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is perfectly periodic with period &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;.  If the best &lt;span class=&quot;math-container&quot;&gt;$r_x[k,n_0]$&lt;/span&gt; you can get (with &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; that's not close to &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt;) is very small, then &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; shows &lt;strong&gt;no&lt;/strong&gt; periodicity and your pitch confidence is low.&lt;/p&gt;&#xA;&lt;p&gt;So the &lt;em&gt;octave problem&lt;/em&gt; comes about because of a couple of reasons.  First of all, &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is not necessarily an integer.  That is an interpolation problem, not a big deal.&lt;/p&gt;&#xA;&lt;p&gt;The second reason and more difficult problem is that of &lt;strong&gt;subharmonics&lt;/strong&gt;.  Consider that you're listening to a nice periodic tone at exactly A-440 Hz and it sounds like an A that is 9 semitones above middle C.  Now suppose someone adds to that tone a very tiny-amplitude (like down 60 dB) A-220?  What will it sound like and mathematically what is the &amp;quot;true&amp;quot; period?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Choosing the &lt;em&gt;&amp;quot;right&amp;quot;&lt;/em&gt; peak for the period.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let's say you run your note through a DC-blocking filter, so that the mean of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is zero.  It turns out that causes the mean of the autocorrelation &lt;span class=&quot;math-container&quot;&gt;$R_x[k, n_0]$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$n_0$&lt;/span&gt; to also be zero (or close to it if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is large).  That means &lt;span class=&quot;math-container&quot;&gt;$R_x[k, n_0]$&lt;/span&gt; must sum (over &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;) to be about zero which means there is as much area above zero as below.&lt;/p&gt;&#xA;&lt;p&gt;Okay, so &lt;span class=&quot;math-container&quot;&gt;$R_x[0, n_0]$&lt;/span&gt; represents the power of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; in the vicinity around &lt;span class=&quot;math-container&quot;&gt;$n=n_0$&lt;/span&gt; and must be non-negative.  &lt;span class=&quot;math-container&quot;&gt;$R_x[k, n_0]$&lt;/span&gt; never exceeds &lt;span class=&quot;math-container&quot;&gt;$R_x[0, n_0]$&lt;/span&gt; but can get as large as it when &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is periodic.  &lt;span class=&quot;math-container&quot;&gt;$R_x[P, n_0] = R_x[0, n_0]$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x[n+P]=x[n]$&lt;/span&gt;.  So if &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; is periodic with period &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and you have a bunch of peaks spaced apart by &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and you have an idea for how high those peaks should be.  And if the DC component of &lt;span class=&quot;math-container&quot;&gt;$R_x[k, n_0]$&lt;/span&gt; is zero, that means in-between the peaks, it &lt;strong&gt;must&lt;/strong&gt; have negative values.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; was &amp;quot;quasi-periodic&amp;quot;, one cycle of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; will look a lot like an adjacent cycle, but not so much like a cycle of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; farther down the signal in time.  That means the first peak &lt;span class=&quot;math-container&quot;&gt;$R_x[P, n_0]$&lt;/span&gt; will be higher than the second at &lt;span class=&quot;math-container&quot;&gt;$R_x[2P, n_0]$&lt;/span&gt; or the third &lt;span class=&quot;math-container&quot;&gt;$R_x[3P, n_0]$&lt;/span&gt;.  One could use the rule to always pick the highest peak and expect the highest peak to always be the first one.  But, because of inaudible subharmonics, sometimes that is not the case.  sometimes the second or possibly the third peak is oh-so-slightly higher.  Also, because the period &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is likely not an integer number of samples but &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$R_x[k, n_0]$&lt;/span&gt; is always an integer, so the true peak will likely be in-between integer values of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.  Even if you were to interpolate where the smooth peak is (which I recommend and quadratic interpolation is good enough), and how high it really is between integer &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, your interpolation alg could make a peak slightly higher or slightly lower than it really is.  So choosing the absolutely highest peak can result in spuriously picking the second over the first peak (or vise versa) when you really wanted the other.&lt;/p&gt;&#xA;&lt;p&gt;So somehow you have to &lt;strong&gt;handicap&lt;/strong&gt; the peaks at increasing &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; so that the first peak has a &lt;em&gt;slight&lt;/em&gt; advantage over the second, and the second over the fourth (the next octave down), etc.  How do you do that?&lt;/p&gt;&#xA;&lt;p&gt;You do that by multiplying &lt;span class=&quot;math-container&quot;&gt;$R_x[k, n_0]$&lt;/span&gt; with a decreasing function of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; so that the peak at &lt;span class=&quot;math-container&quot;&gt;$k=2P$&lt;/span&gt; is reduced by some factor, relative to an identical peak at &lt;span class=&quot;math-container&quot;&gt;$k=P$&lt;/span&gt;.  Turns out that the power function (not the exponential) does that.  so compute&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ k^{-\alpha} \ R_x[k, n_0] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, if &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; were perfectly periodic with period &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, and ignoring interpolation issues for non-integer &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ R_x[2P, n_0] = R_x[P, n_0] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA; (2P)^{-\alpha} R_x[2P, n_0] &amp;amp; = \\&#xA; (2P)^{-\alpha} R_x[P, n_0] &amp;amp; &amp;lt; P^{-\alpha} R_x[P, n_0] \\ &#xA; \end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The factor by which the peak for a pitch of one octave lower is reduced is the ratio&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{(2P)^{-\alpha} R_x[2P, n_0]}{P^{-\alpha} R_x[P, n_0]} = \frac{(2P)^{-\alpha}}{P^{-\alpha}} = 2^{-\alpha} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if you want to give your first peak a 1% boost over the second peak, which means you will not choose the pitch to be the sub-harmonic pitch, unless the sub-harmonic pitch autocorrelation is at least 1% more than the first peak, you would solve for &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; from&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 2^{-\alpha} = 0.99 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That is the consistent way to weight or de-emphasize or handicap the peak corresponding to the subharmonic pitch one octave below.&lt;/p&gt;&#xA;&lt;p&gt;It still leaves you with a thresholding issue.  You have to choose &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; well. But this is a consistent way emphasize the first peak over the second, which is an octave lower, but not so much that if the note really &lt;strong&gt;is&lt;/strong&gt; an octave lower, but the energy in all of the even harmonics was strong, compared to the odd harmonics, this will still leave a possibility for the second peak being chosen.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2021-01-06T05:33:41.300" LastActivityDate="2021-01-06T05:33:41.300" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="29969" PostTypeId="2" ParentId="29963" CreationDate="2016-04-07T23:16:05.953" Score="1" Body="&lt;p&gt;I've just tried a toy example of doing what you're suggesting and it works fine. The plot below shows how the standard Kalman filter (red line) and the steady-state Kalman filter (green circles) outputs are the same, except for some minor differences at the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom plot shows the evolution of the Kalman gain coefficients for the standard Kalman filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without seeing more detail of what you're doing, I don't think I can help much.  Note that I'm using SISO example, which may not be what you're after... but I haven't ever seen reasons for MIMO models to work differently than expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tZaf4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tZaf4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#27879 and 29963&#xA;&#xA;T &amp;lt;- 100&#xA;&#xA;#H = [3 -3 1]&#xA;H &amp;lt;- matrix(c(1,0,0),c(1,3)) &#xA;&#xA;#F is just a tapped delay line&#xA;alpha &amp;lt;- matrix(c(0.9,0,0,0,0.9,0,0,0,0.9),3,3)&#xA;A &amp;lt;- matrix(c(3,1,0,-3,0,1,1,0,0),3,3)&#xA;B &amp;lt;- matrix(c(1,0,0),c(3,1))&#xA;&#xA;sigma_v &amp;lt;- 1&#xA;v &amp;lt;- rnorm(T,0,sigma_v)&#xA;sigma_w &amp;lt;- 0.01&#xA;w &amp;lt;- rnorm(T,0,sigma_w)&#xA;&#xA;x &amp;lt;- matrix(c(0,0,0),c(3,1))&#xA;z &amp;lt;- rep(0,T)&#xA;&#xA;for (t in 1:T)&#xA;{&#xA;  z[t] &amp;lt;- H %*% x + w[t]&#xA;  x &amp;lt;- A %*% x +v[t]&#xA;}&#xA;par(mfrow=c(2,1))&#xA;plot(z,type=&quot;l&quot;, col=&quot;blue&quot;, lwd=5)&#xA;title('Measurements and both Filtered Measurements')&#xA;&#xA;Q &amp;lt;- matrix(c(0,0,0,0,0,0,0,0,sigma_v^2),3,3)&#xA;R &amp;lt;- sigma_w^2&#xA;&#xA;&#xA;library(&quot;MASS&quot;) # For pseudo inverse ginv()&#xA;&#xA;xkm1km1 &amp;lt;- matrix(rep(0,3*T+3),3,T+1)&#xA;xkkm1 &amp;lt;- matrix(rep(0,3*T),3,T)&#xA;K &amp;lt;- matrix(rep(0,3*T),3,T)&#xA;Pkm1km1 &amp;lt;- matrix(c(1000,0,0 ,0,1000,0, 0,0,1000),3,3)&#xA;zhat &amp;lt;- matrix(rep(0,T),c(T,1))&#xA;&#xA;for (k in 1:T)&#xA;{&#xA;  xkkm1[,k] &amp;lt;- A %*% xkm1km1[,k]&#xA;  Pkkm1 &amp;lt;- A %*% Pkm1km1 %*% t(A) + Q&#xA;  K[,k] &amp;lt;- Pkkm1 %*% t(H) %*% ginv( H %*% Pkkm1 %*% t(H) + R)&#xA;  xkm1km1[,k+1] &amp;lt;- xkkm1[,k] + K[,k] %*% (z[k] - H %*% xkkm1[,k])&#xA;  Pkm1km1 &amp;lt;- (matrix(c(1,0,0,0,1,0,0,0,1),3,3) - K[,k] %*% H) %*% Pkkm1  &#xA;  zhat[k] &amp;lt;- as.numeric(H %*% xkkm1[,k])&#xA;}&#xA;lines(zhat, col=&quot;red&quot;)&#xA;&#xA;xkm1km1 &amp;lt;- matrix(rep(0,3*T+3),3,T+1)&#xA;xkkm1 &amp;lt;- matrix(rep(0,3*T),3,T)&#xA;zhat &amp;lt;- matrix(rep(0,T),c(T,1))&#xA;&#xA;for (k in 1:T)&#xA;{&#xA;  xkkm1[,k] &amp;lt;- A %*% xkm1km1[,k]&#xA;  K[,T] &amp;lt;- Pkkm1 %*% t(H) %*% ginv( H %*% Pkkm1 %*% t(H) + R)&#xA;  xkm1km1[,k+1] &amp;lt;- xkkm1[,k] + K[,T] %*% (z[k] - H %*% xkkm1[,k])&#xA;  zhat[k] &amp;lt;- as.numeric(H %*% xkkm1[,k])&#xA;}&#xA;points(zhat, col=&quot;green&quot;)&#xA;&#xA;plot(1:100, K[1,], type=&quot;l&quot;, ylim=c(-1,1))&#xA;title('Kalman Gain coefficients')&#xA;lines(1:100, K[2,], col=&quot;red&quot;)&#xA;lines(1:100, K[3,], col=&quot;green&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-07T23:16:05.953" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29972" PostTypeId="2" ParentId="27623" CreationDate="2016-04-08T08:00:35.920" Score="0" Body="&lt;p&gt;After some research, I have found &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6157574&amp;amp;tag=1&quot; rel=&quot;nofollow&quot;&gt;a paper&lt;/a&gt; that resumes well the answer to my question. As other people might be interested, here is a short summary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two important things to note: from a purely information theoretical approach, where only transmission power consumption is considered, it has been found that transmitting at infinite rate or at infinitely small rate maximises the bits-per-Joule capacity. By contrast, when circuit power is also considered---and of course, depending on the physical layer implementation---the overall energy-per-bit required for transmission may show different behaviours that depend on parameters such as communication distance (short/long range), duty-cycle, average message length, modulation and so no. The paper shows an example where the energy-per-bit required as a function of the rate shows an optimum minimum which is not at minimum rate, as information theory suggests.&lt;/p&gt;&#xA;" OwnerUserId="17530" LastActivityDate="2016-04-08T08:00:35.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29973" PostTypeId="2" ParentId="29961" CreationDate="2016-04-08T09:02:51.013" Score="1" Body="&lt;p&gt;The point that with &quot;pixel-wise&quot; you mean &quot;differently for each pixel&quot; indicates that a frequency-domain transform is a really bad approach for this. The DFT of a single element is that element (scaled, if at all modified), so you can't win with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the FFT and similar algorithms to do elegant shifts, but the fact that it's used in light-field reconstruction stems from the fact that there's a certain, mathematically elegant model of what should happen to many of those pixels that relates nicely to frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you just want to shift/interpolate/distort your image pixel-wise, the normal distortion matrices are the way to go – ask google about that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, OpenCV has a very short &lt;a href=&quot;http://docs.opencv.org/2.4/doc/tutorials/calib3d/camera_calibration/camera_calibration.html&quot; rel=&quot;nofollow&quot;&gt;tutorial&lt;/a&gt; on camera calibration; maybe the &lt;em&gt;theory&lt;/em&gt; contained in there is something for you?&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-04-08T09:02:51.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29974" PostTypeId="1" CreationDate="2016-04-08T09:35:51.353" Score="1" ViewCount="920" Body="&lt;p&gt;I'm using &lt;a href=&quot;http://sox.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;sox&lt;/a&gt; to emulate RIAA pre-emphasis and de-emphasis effects on audio files. For pre-emphasis I call it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sox --plot octave in.wav out_biquad.wav biquad 1 -1.700724 0.7029382 0.2380952 -0.1718791 -0.0442981&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The biquad coefficients are taken from &lt;a href=&quot;http://jiiteepee.tripod.com/de-pre-emphasis.html&quot; rel=&quot;nofollow&quot;&gt;http://jiiteepee.tripod.com/de-pre-emphasis.html&lt;/a&gt;. I wonder if there is any easy way to calculate the biquad coefficients if I want to apply pre-emphasis only partially - in the range from 0% (no pre-emphasis) to 100% (full pre-emphasis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The case for 0% seems to be easy, coefficients &lt;code&gt;1 0 0 1 0 0&lt;/code&gt; would work just fine. But I'm not sure how to approach calculation of biquad coefficients for the combination of zero_filter + float_fraction * full_filter.&lt;/p&gt;&#xA;" OwnerUserId="20441" LastEditorUserId="8202" LastEditDate="2016-04-08T10:16:20.870" LastActivityDate="2023-02-14T21:07:02.403" Title="How to calculate biquad coefficients for the partial (1%, 10%) applying of pre-emphasis effect" Tags="|biquad|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29976" PostTypeId="2" ParentId="29953" CreationDate="2016-04-08T11:16:42.950" Score="1" Body="&lt;p&gt;If you're decimating by a factor of 50 then I suggest you decimate in two stages. Lowpass filter with LPF1, decimate by factor D1, next lowpass filter with LPF2, and finally decimate by factor D2.  To minimize the total number of multipliers in the two filters, set D1 = 25 and D2 = 2. Decimation factor D1 = 25 will tell you what the cutoff frequency should be for the LPF1 to avoid aliasing after decimation by 25. (Use a halfband filter for LPF2.)&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2016-04-08T11:16:42.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29978" PostTypeId="2" ParentId="29494" CreationDate="2016-04-08T12:36:09.520" Score="-1" Body="&lt;p&gt;FYI, the issue has been already addressed and solved here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://answers.opencv.org/question/90229/add-padding-to-object-in-4-channel-image/&quot; rel=&quot;nofollow&quot;&gt;http://answers.opencv.org/question/90229/add-padding-to-object-in-4-channel-image/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19397" LastEditorUserId="19397" LastEditDate="2016-05-12T07:11:15.510" LastActivityDate="2016-05-12T07:11:15.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29979" PostTypeId="1" CreationDate="2016-04-08T14:09:43.350" Score="2" ViewCount="555" Body="&lt;p&gt;I am trying to write software that will perform the discrete fourier transform of real time data coming from the microphone into the sound card on a computer. I am using Java with the javax.sound APIs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am capturing 250 ms of data each time. That means, as the sampling rate is 44100, I am buffering 11025 of 16-bit shorts and performing the DFT on this data in each iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My DFT code correlates this window of data with sine and cosine waves from 19 Hz up to 198 Hz in steps of 1, so as this window is 250 ms of data , this means it is actually correlating the incoming audio with frequencies from 76 Hz up to 792Hz in steps of 4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I now wish to take a smaller window of data each time of 125ms instead of 250ms in order to speed things up. If i correlate this data with sine and cosine waves of incrementing frequencies by 1 like before, this means that it is actually correlating the incoming audio with waves in steps of 8Hz. This is not good for my problem as I want to be able to look for frequency differences in the signal of less than 8Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, is this the normal trade-off, speed versus frequency resolution , or is there some way around this ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks in advance. I am new to audio processing so forgive me if i'm missing out on some common sense :)&lt;/p&gt;&#xA;" OwnerUserId="20443" LastActivityDate="2016-04-11T11:56:38.923" Title="Performing DFT of streaming audio problem. Is there a limit?" Tags="|fft|audio|sampling|dft|java|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="29980" PostTypeId="5" CreationDate="2016-04-08T14:53:59.837" Score="0" Body="&lt;p&gt;&lt;a href=&quot;http://gnuradio.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;GNU Radio&lt;/a&gt; is a free software development toolkit that provides the signal processing runtime and processing blocks to implement software radios using readily-available, low-cost external RF hardware and commodity processors. It is widely used in hobbyist, academic and commercial environments to support wireless communications research as well as to implement real-world radio systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/YCZf7.png&quot; alt=&quot;Official GNU Radio Logo&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GNU Radio applications are primarily written using the Python programming language, while the supplied, performance-critical signal processing path is implemented in C++ using processor floating point extensions where available. Thus, the developer is able to implement real-time, high-throughput radio systems in a simple-to-use, rapid-application-development environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While not primarily a simulation tool, GNU Radio does support development of signal processing algorithms using pre-recorded or generated data, avoiding the need for actual RF hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GNU Radio is licensed under the GNU General Public License (GPL) version 3. All of the code is copyright of the Free Software Foundation.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-04-08T17:07:10.850" LastActivityDate="2016-04-08T17:07:10.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29981" PostTypeId="4" CreationDate="2016-04-08T14:53:59.837" Score="0" Body="GNU Radio is a free software development toolkit that provides the signal processing runtime and processing blocks to implement software radios." OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-04-08T17:07:02.927" LastActivityDate="2016-04-08T17:07:02.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29982" PostTypeId="2" ParentId="19289" CreationDate="2016-04-08T15:15:53.413" Score="1" Body="&lt;p&gt;audfprint is the best way to do this. Don't mind the comments about being overkill. Correlations and such like in R will take you a long time to skill up on if you are not a statistician. If you get it working which is the hardest part (using pip install) of the necessary packages, you then just have to run 3 audfprint commands and a few linux commands to get the peaks of the original sample into a subdirectory, run peak generation over the sample to be aligned and then extract the answer at the end (the offset start time). The issue you might find is that your sample to be aligned is greater than 1 minute long and therefore you have to set a large max size for sampling for the clip to be found. To avoid using non-default settings for audfprint you can just extract the first 6 seconds or so from the clip (to be offset) and then run this into audfprint to ensure that you get 100% accuracy in its location. All you want is the offset after all. I've done this for 24 hour videos and it works really well.&lt;/p&gt;&#xA;" OwnerUserId="20444" LastActivityDate="2016-04-08T15:15:53.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29983" PostTypeId="2" ParentId="29979" CreationDate="2016-04-08T15:16:10.263" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;My question is, is this the normal trade-off, speed versus frequency resolution , or is there some way around this ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, yes, that is the normal trade-off. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But: If speed is a concern, why on earth are you using your own correlation-based DFT? There's &lt;em&gt;a lot&lt;/em&gt; of FFT implementations out there, and a 11025-point FFT done with the FFTw takes a few µs on my PC, so you can have a running FFT for every other sample without problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence: if you care for speed, use a library that someone with experiences (or decades of development time, university carreers full of theory and a lot of assistant researchers) has written for you. A &quot;correlation with sines&quot; based DFT is bound to be slower, especially since I presume you didn't even implement this as simple multiplication with a DFT matrix, based on how you worded your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there might be even more specific algorithms that perform even better, if you don't really need all equidistant frequencies that a DFT would give you, but just need to test a few frequencies (e.g. parametric pseudospectrum estimators such as MUSIC) or know exactly how many discrete tones there are (the closely related ESPRIT).&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-04-08T15:38:30.127" LastActivityDate="2016-04-08T15:38:30.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29984" PostTypeId="2" ParentId="29974" CreationDate="2016-04-08T15:37:09.977" Score="3" Body="&lt;p&gt;So, sox defines its &lt;code&gt;biquad&lt;/code&gt; operation parameters as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;biquad b0 b1 b2 a0 a1 a2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Apply a biquad IIR filter with the given coefficients. Where b* and a* are the numerator and denominator coefficients respectively.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;See &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_biquad_filter&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Digital_biquad_filter&lt;/a&gt; (where a0 = 1).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This effect supports the −−plot global option.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A biquad filter is just a special case of an IIR filter, which is a linear system! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that you can just have two signal streams, one filtered and one un-filtered, and add them up, scaled by two coefficients with constant sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing you'd have to care about is delay, which is a bit tricky to calculate for IIRs; now, luckily, the RIAA biquad guarantees phase errors of this filter to be below 30% at any given frequency, so you can probably get away with summing up with a single-sample delayed input signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A single sample delay is a FIR filter with coefficients &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b0 = 0, b1 = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and any FIR is also understandable as IIR with all &lt;code&gt;aN==0&lt;/code&gt; but &lt;code&gt;a0=1&lt;/code&gt;, since IIRs are linear, you can directly modify the coefficients of your biquad by mutliplying them with the aforementioned coefficient and adding &lt;code&gt;1-coefficient&lt;/code&gt; to &lt;code&gt;a0&lt;/code&gt; and &lt;code&gt;b1&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-04-08T15:37:09.977" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29985" PostTypeId="2" ParentId="28170" CreationDate="2016-04-08T15:41:54.770" Score="0" Body="&lt;p&gt;No. There is no good definition of &quot;complimentary&quot; for sound. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It only works for colors because of the way the human eye is constructed and has nothing to do with the underlying physics (which perhaps could be applied to sound as well). Since the human ear works totally different the concept of complimentary doesn't translate.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-04-08T15:41:54.770" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29986" PostTypeId="2" ParentId="29955" CreationDate="2016-04-08T16:16:31.773" Score="1" Body="&lt;p&gt;I remember that using the discrete samples was termed  &quot;wavelet crime&quot; by Gilbert Strang (Strang and Nguyen, Wavelets and Filter banks, 1996, pages 232 sq.), or &quot;wavelet sin&quot; by others. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On prefiltering discrete signals to obtain &quot;better&quot; wavelet coefficients, here are some references I have in store:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/78.301858&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wavelet coefficient computation with optimal prefiltering&lt;/a&gt;, IEEE Trans. Signal Processing, 1994, Xia, X.-G. and Kuo, C.-C.J. and Zhang, Z.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://perso.ens-lyon.fr/patrick.flandrin/IEEE_SPL1994.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;On the initialization of the discrete wavelet transform algorithm&lt;/a&gt;, IEEE Signal Processing Letters, 1994, Abry and Flandrin&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.ee.ryerson.ca/~xzhang/publications/sampsp.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;From the wavelet series to the discrete wavelet transform - the initialization&lt;/a&gt;, IEEE Trans. Signal Processing, 1996, Xiao-Ping Zhang and Li-Sheng Tian and Ying-Ning Peng&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://doi.org/10.1023/A:1019103617219&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sard-optimal prefilters for the fast wavelet transform&lt;/a&gt;, Numer. Algorithms, 1997, S. Ehrich&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/78.678469&quot; rel=&quot;nofollow noreferrer&quot;&gt;A new prefilter design for discrete multiwavelet transforms&lt;/a&gt;, IEEE Trans. Signal Processing, 1998, Xia, X.-G.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/78.824683&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quadrature prefilters for the discrete wavelet transform&lt;/a&gt;, IEEE Trans. Signal Processing, 2000, Johnson, B. R. and Kinsey, J. L.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1016/S0165-1684(00)00106-7&quot; rel=&quot;nofollow noreferrer&quot;&gt;Meaningful MRA initialization for discrete time series&lt;/a&gt;, Signal Processing, 2000, D. Veitch and M. S. Taqqu and P. Abry&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/TSP.2005.849188&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient Wavelet Prefilters with Optimal Time-Shifts&lt;/a&gt;, IEEE Trans. Signal Processing, 2003, Ericsson, S. and Grip, N.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It seems however that no prefiltering does not induce too much errors for compression, denoising, deconvolution. But for detection, or using multiple  different  wavelets at once (like with &lt;a href=&quot;https://hal.archives-ouvertes.fr/hal-00617268&quot; rel=&quot;nofollow noreferrer&quot;&gt;dual-tree wavelets&lt;/a&gt;, or unions of wavelet bases), or with multiwavelets, it is quite mandatory.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2020-05-26T21:54:32.063" LastActivityDate="2020-05-26T21:54:32.063" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="29987" PostTypeId="1" AcceptedAnswerId="29988" CreationDate="2016-04-08T17:06:28.033" Score="3" ViewCount="1455" Body="&lt;p&gt;I am reading up about notch filters. I understand the closer the pole is to the zero, the narrower the width gets and thus the bandwidth gets smaller. Is there an equation that links the bandwidth to the location of a pole? I have tried searching for so long and I couldn't get any useful answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to determine the position of the pole given the required bandwidth and sampling rate and the frequency of the noise. I do not want to do it via trial and error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="20445" LastEditorUserId="8202" LastEditDate="2016-04-08T20:11:47.013" LastActivityDate="2016-04-08T21:05:16.927" Title="Notch Filter - Bandwidth vs pole / zero location vs Q factor" Tags="|filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="29988" PostTypeId="2" ParentId="29987" CreationDate="2016-04-08T17:38:32.920" Score="6" Body="&lt;p&gt;In this paper by Nehora, &quot;A Minimal Parameter Adaptive Notch Filter With&#xA;Constrained Poles and Zeros&quot; IEEE Trans ASSP, vol 33, No 4, 1985 &lt;a href=&quot;http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1164643&amp;amp;tag=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Bandwidth is given as&#xA;$$BW=\pi(1-\rho) $$&#xA;where $\rho$ is the radius of the pole. The zero is assumed to be on the unit circle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Excerpt from the relevant section of that paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NdJkh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NdJkh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the references &lt;a href=&quot;https://i.stack.imgur.com/NdJkh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; through &lt;a href=&quot;https://i.stack.imgur.com/VTHGp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XfMfk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XfMfk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another paper gives the same bandwidth and it is listed as the 3dB bandwidth - see (Yong, Kechu, Xiaofan, &quot;A gradient algorithm for complex adaptive notch filters&quot; - Intl Conf on Signal Processing, 2004) &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=1452702&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet another paper with bandwidth details is by Regalia,&quot;A Complex Adaptive Notch Filter&quot; IEEE Sig Proc Letters, Vol 17, No 11, 2010, &lt;a href=&quot;http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=5570911&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link&lt;/a&gt;. &#xA;Note that Regalia's notch filter is based on All-pass filters and so it has a different equation for bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant section from the Regalia paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VTHGp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VTHGp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="80" LastEditDate="2016-04-08T21:05:16.927" LastActivityDate="2016-04-08T21:05:16.927" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29989" PostTypeId="2" ParentId="29979" CreationDate="2016-04-08T17:50:45.737" Score="0" Body="&lt;p&gt;The trade-off between the length of samples and frequency resolution varies with the signal to noise ratio (or spectral sparcity) and in what kind of resolution you need.  If the noise level is low enough, then sufficiently isolated narrow frequency spectrum can be interpolated to within some fraction of the DFT result frequency bin spacing (e.g. perhaps enough to get 1 or 2 Hz resolution from 8 Hz DFT result spacings).  If the interference level is high enough, then more than 2 DFT result bin spacings may be required to cleanly separate spectral peaks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For signals with a very sparse spectrum, there are also other parametric estimators than just using DFT magnitude peaks.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-08T17:50:45.737" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29991" PostTypeId="2" ParentId="29934" CreationDate="2016-04-09T00:33:36.910" Score="1" Body="&lt;p&gt;I do not have a definitive answer, can only report on what I came up with and tried so far, in a very recent experiment. It seems to be fairly effective, at least for an aural world primarily consisting of an X-axis, Z-axis plane. There is probably considerable room for optimization of the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we have a camera-eye location that is moving about the 3D world. I maintain the location of two virtual &quot;ears&quot;, a fixed distance 90 degrees left and right from the direction the camera is pointing, corresponding to what we might call a virtual head. I determine the distance of the sound to each ear and calculate the difference. The sound is placed in a stereo delay line consisting of an array of 32 frames (to approximate the amount of time, at 44100 fps, that matches the speed of sound in air and the size of a real-world head). The number of frames may not be optimal. A dedicated &quot;read head&quot; (for that sound) is positioned on the lagging stereo channel based on the time difference. Linear interpolation is used in the reading of the signal when the calculated &quot;read&quot; position does not lie squarely on a given sound frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to me to be more convincing than using volume differences, especially since the lagging ear, with volume diffs, can receive a significantly quieter signal, and thus not mask other sounds properly. IMHO, an ear turned away from a nearby, loud jackhammer should not be able to hear other quieter, more distant sounds because the jackhammer has been attenuated to that ear to achieve a stereo placement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The texts that I have found so far seem to rely on filtering and attenuation rather than on delay, and rely on math that is harder for me to follow than the simple trig needed to calculate distance differences. I'm still looking for a more definitive answer, and will be monitoring this question to see what else comes up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I posted a demo/example file (java jar can be downloaded and run) on java-gaming.org &lt;a href=&quot;http://www.java-gaming.org/topics/3d-audio-test-using-javafx-and-procedural-java-sound/37238/msg/355133/view.html#msg355133&quot; rel=&quot;nofollow&quot;&gt;3D audio test&lt;/a&gt; to solicit comments. I got some interesting feedback similar to that which you received from robert bristow-johnson. I haven't tried filtering in real time yet, for HRTF. Presumably, a bit of low-pass filtering can be done relatively inexpensively, and be &quot;good enough&quot; for some game applications where an amount of distance or an acoustic obstruction (and muffling) needs to be indicated by the sound.&lt;/p&gt;&#xA;" OwnerUserId="15285" LastActivityDate="2016-04-09T00:33:36.910" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="29993" PostTypeId="1" AcceptedAnswerId="29994" CreationDate="2016-04-09T08:03:14.140" Score="0" ViewCount="120" Body="&lt;p&gt;Why is $e^{i2\pi Nf_snT}=1$ in snippet from book?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fvzZ7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fvzZ7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="20451" LastEditorUserId="8202" LastEditDate="2016-04-09T10:12:21.203" LastActivityDate="2016-04-09T10:12:21.203" Title="Why is $e^{i2\pi Nf_snT}=1$?" Tags="|sampling|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29994" PostTypeId="2" ParentId="29993" CreationDate="2016-04-09T08:26:25.143" Score="7" Body="&lt;p&gt;Because $Tf{_s}$=1 and $N$ and $n$ are integers.  So the exponent becomes 2$\pi$ times an integer, say $K$. But $e{^{i\theta}} = \cos(\theta)+i\sin(\theta)$. Therefore $e{^{i2K\pi}} = 1$.&lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="1629" LastEditDate="2016-04-09T09:45:56.520" LastActivityDate="2016-04-09T09:45:56.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29995" PostTypeId="2" ParentId="29993" CreationDate="2016-04-09T09:23:54.777" Score="3" Body="&lt;p&gt;A try without maths: $x(t)$ gives you your location in the complex plane at time $t$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is: because when you walk in circles ($2\pi$) an integer number of times, whatever your rotational speed,  or the length of your steps, you finally up end at  the same place as in the beginning, like in   the latin palindromic sentence:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In girum imus nocte ecce et consumimur igni &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which means: &quot;At night we wander in circles and are consumed by fire.&quot;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-04-09T09:23:54.777" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="29997" PostTypeId="1" CreationDate="2016-04-09T09:55:13.430" Score="0" ViewCount="2150" Body="&lt;p&gt;i got similar question as in &lt;a href=&quot;https://dsp.stackexchange.com/questions/19368/fft-scaling-in-gnu-radio&quot;&gt;FFT scaling in GNU Radio&lt;/a&gt;&#xA;and quite not clear about the answer given so far. I understood that the FFT plot is a relative value in which we have to use measurement instrument to get the actual value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, without the measurement instrument, in general, &lt;strong&gt;what value will be shown on the plot if the given input is for example complex cosine waveform with amplitude 1?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried the following flowgraph: signal_source - throttle - qt_frequency_sink&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and vary the cosine waveform amplitude from 0 to 100. other than amplitude, all blocks use default setting. I expect to get 0dB when the amplitude is 1, but the plot shows ~ -10dB instead,and ~32dB when amplitude is 100 (i'm not sure if this value make sense). SO, &lt;strong&gt;how actually the frequency sink calculates these value?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="20433" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-04-09T15:24:41.867" Title="FFT plot in GNU Radio" Tags="|fft|gnuradio|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="29999" PostTypeId="2" ParentId="10193" CreationDate="2016-04-09T11:52:46.677" Score="1" Body="&lt;p&gt;As others have mentioned, there have been &lt;strong&gt;many&lt;/strong&gt; methods developed to determine voicing of speech and, for voiced speech, to mark the individual pitch epochs.  This is &lt;strong&gt;not a trivial problem&lt;/strong&gt; if one wants to have robust and accurate epoch marking.  There are many challenges, &lt;em&gt;diplophonic speech&lt;/em&gt; is one of them.  Both time-domain as well as frequency-domain techniques exist.  In this &lt;a href=&quot;http://www.rmcet.com/lib/Resources/Archieve%20Report/E-Journals/Speech%20Communication/1-s2.0-S0167639301000176-main.pdf&quot; rel=&quot;nofollow&quot; title=&quot;Analysis, enhancement and evaluation of five pitch determination techniques&quot;&gt;&lt;strong&gt;paper&lt;/strong&gt;&lt;/a&gt; you can find description of five techniques (detailed enough to enable you to implement them), their comparison, and a set of intuitive enhancements -- a great &lt;strong&gt;starting point&lt;/strong&gt; if you want to develop your own algorithm.  If you need high-quality speech processing (e.g. to minimize any jitter) then I strongly recommend this &lt;a href=&quot;https://pdfs.semanticscholar.org/ec3b/c1ea5cc16aa16bfacd0e445e6dd4ff08d139.pdf&quot; rel=&quot;nofollow&quot; title=&quot;A NOVEL METHOD OF FORMANT ANALYSIS AND GLOTTAL INVERSE FILTERING&quot;&gt;&lt;strong&gt;paper&lt;/strong&gt;&lt;/a&gt;.  It describes the essence of a very &lt;strong&gt;accurate and reliable method&lt;/strong&gt; but be prepared to do a lot of detailed development yourself.&lt;/p&gt;&#xA;" OwnerUserId="18273" LastEditorUserId="18273" LastEditDate="2016-04-09T13:04:19.017" LastActivityDate="2016-04-09T13:04:19.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30001" PostTypeId="2" ParentId="29997" CreationDate="2016-04-09T15:24:41.867" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;But, without the measurement instrument, in general, what value will be shown on the plot if the given input is for example complex cosine waveform with amplitude 1?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You've done the &quot;right&quot; thing by simply trying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Realize that the frequency sink simply does a forward FFT and &lt;strong&gt;windowing&lt;/strong&gt;, if you don't set the window to &lt;code&gt;rectangular&lt;/code&gt;; the window you're using has a response of ca -9.8dB at DC, so that's what you're seeing here. Use &quot;FFT Window&quot; &lt;code&gt;none&lt;/code&gt;, and you'll see your perfect 0dB for a constant 1 input, and 40dB for a constant 100 input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you only have a constant value, so all bins are 0, but the middle one, which will, as defined for the DFT without scaling, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA; Y[f] &amp;amp;= \sum_{k=0}^{N_{DFT}-1} y[k] e^{j2\pi f \frac kN},\\&#xA;\text{for }f&amp;amp;=0\text{, it follows that }&#xA;e^{j2\pi 0 \frac kN}\equiv 1,\text{ so}\\&#xA;Y[0] &amp;amp;= \sum_{k=0}^{N_{DFT}-1} y[k] &amp;amp;y\text{ being constant}\\&#xA;&amp;amp;= N_{DFT}\cdot y[0]&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because it's handy for visualization, GR's approach to scaling of these values is to divide them by the DFT length $N_{DFT}$; otherwise, the same constant signal would have more power in a longer DFT.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-04-09T15:24:41.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30002" PostTypeId="1" CreationDate="2016-04-09T16:36:17.367" Score="0" ViewCount="58" Body="&lt;p&gt;Clustering is an unsupervised learning method and classification is a supervised one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that a tree can be used for image classification since it is based on decision tree in which we have yes/no conditions. we grow a tree to classify a query image whether it belongs to a predefined group or not. But what I cannot understand is clustering using trees. In clustering, how we can adopt a decision tree to group our data in $n$ groups? &lt;/p&gt;&#xA;" OwnerUserId="15003" LastActivityDate="2016-04-09T16:36:17.367" Title="What is the difference between &quot;tree-based clustering&quot; and &quot;tree-based classification&quot;?" Tags="|image-processing|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30004" PostTypeId="1" CreationDate="2016-04-09T18:38:08.783" Score="1" ViewCount="928" Body="&lt;p&gt;I'm quite new to audio processing and i'm trying to extract frequencies from a wav file. As research papers stated i put the wav audio into a byte array and segmented and trying to apply FFT to get the frequencies from the audio. However the problem is even when i enter a audio track with only one note played (With no noise) i get a lot of frequencies as a result where as i'm supposed to get one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is something is wrong with the FFT code because the audio gets segmented properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks everyone in advance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My fft code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public void getFFT(double[] x, int a) {&#xA;&#xA;double amp[] = new double[512];&#xA;&#xA;double firstSum;&#xA;double secSum;&#xA;double twoPInjk;&#xA;double[][] s = new double[512][2];&#xA;for (int j = 0; j &amp;lt; 512; j++) {&#xA;    firstSum = 0;&#xA;    secSum = 0;&#xA;    FreqArr[j] = (j * sampleRate) / (512);&#xA;    for (int k = 0; k &amp;lt; 512; k++) {&#xA;        twoPInjk = ((2 * Math.PI) / 512) * (j * k);&#xA;        firstSum += x[k] * Math.cos(twoPInjk);&#xA;        secSum += x[k] * Math.sin(twoPInjk);&#xA;    }&#xA;    amp[j] = Math.abs(Math.sqrt(Math.pow(firstSum, 2) + Math.pow(secSum, 2)));&#xA;}&#xA;highest(amp, a);&#xA;}&#xA;&#xA;public void highest(double[] amp, int a) {&#xA;String note;&#xA;double all = 0;&#xA;double max_magnitude = -1;&#xA;int max_index = -1;&#xA;&#xA;for (int i = 0; i &amp;lt; (512); i++) {&#xA;&#xA;    all = all + amp[i];&#xA;&#xA;    if (amp[i] &amp;gt; max_magnitude) {&#xA;        max_magnitude = amp[i];&#xA;        max_index = i;&#xA;    }&#xA;}&#xA;double freq = 0;&#xA;int cnt = 0;&#xA;&#xA;freq = max_index * (sampleRate / 2) / (512);&#xA;System.out.println(&quot;Maximum_index: &quot; + max_index);&#xA;System.out.println(&quot;Sample rate: &quot; + sampleRate);&#xA;&#xA;  System.out.println(freq + &quot; is the frequnecy&quot;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;my result (for the 1 second audio with only one note played)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sample rate 44100 My data size 70376 My myBitsPerSample 16 My channels 2 My myByteRate 176400 My Length 0.7983219954648526 0.7983219954648526 44100.0 Max_index: 56 Sample rate: 44100.0 2411.71875 is the frequnecy Max_index: 256 Sample rate: 44100.0 11025.0 is the frequnecy Max_index: 256 Sample rate: 44100.0 11025.0 is the frequnecy Max_index: 129 Sample rate: 44100.0 5555.56640625 is the frequnecy Max_index: 511 Sample rate: 44100.0 22006.93359375 is the frequnecy Max_index: 256 Sample rate: 44100.0 11025.0 is the frequnecy Max_index: 152 Sample rate: 44100.0 6546.09375 is the frequnecy Max_index: 422 Sample rate: 44100.0 18174.0234375 is the frequnecy Max_index: 26 Sample rate: 44100.0 1119.7265625 is the frequnecy Max_index: 462 Sample rate: 44100.0 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it goes on.&lt;/p&gt;&#xA;" OwnerUserId="20460" LastActivityDate="2016-07-06T21:36:13.587" Title="Why is this FFT code not working to extract frequencies from a wav audio?" Tags="|fft|audio|dsp-core|pitch|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30006" PostTypeId="2" ParentId="30004" CreationDate="2016-04-09T18:47:55.453" Score="1" Body="&lt;p&gt;Your DFT is working as expected at extracting frequency information.  One musical note at one pitch usually contains a lot of spectral frequencies: from harmonics and overtones plus broadband noise from any transients, such as note attack and decay.  Furthermore, the max magnitude frequency from an actual sound recording is often not the same as the heard note pitch frequency (one possibility is the magnitude peak is instead a strong overtone).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, search for pitch detection/estimation algorithms.  The good (working, more reliable) ones will do a lot more than just an FFT peak magnitude search.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-09T20:52:04.483" LastActivityDate="2016-04-09T20:52:04.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30013" PostTypeId="1" CreationDate="2016-04-10T10:16:02.277" Score="1" ViewCount="47" Body="&lt;p&gt;I'm working on a project which requires analysis of filter transfer function of vocal tract. The vocal tract is excited by a source signal that is a frequency sweep. The source signal is provided through an audio device. The device has it's own transfer function which would change the results as expected from the actual transfer function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the transfer function of the device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me with how should I eliminate the effect of transfer function of the device from the recording in MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="20470" LastActivityDate="2016-04-10T10:16:02.277" Title="How to eliminate audio device transfer function from recording?" Tags="|frequency-response|transfer-function|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30014" PostTypeId="1" AcceptedAnswerId="33776" CreationDate="2016-04-10T11:16:53.753" Score="0" ViewCount="190" Body="&lt;p&gt;I am using wavelet coefficients for feature extraction in classification problem. As the wavelet coefficient values are real, positive and negative, is it required to quantize them before feature extraction?&lt;/p&gt;&#xA;" OwnerUserId="20170" LastActivityDate="2017-06-17T22:19:46.117" Title="Is it required to quantize wavelet coefficients before one derives features from?" Tags="|wavelet|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30015" PostTypeId="1" AcceptedAnswerId="30025" CreationDate="2016-04-10T12:13:36.973" Score="0" ViewCount="1225" Body="&lt;p&gt;I am currently working on a set of .wav files which, unfortunately, do not have the same sampling rate - I need to resample them for the purpose of feeding them to a neural net.&lt;br&gt;&#xA;So - using Sox I resampled every file - with the command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sox -v 0.99 filein -G -r 192000 fileout&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, having a look at the resampled files: &lt;a href=&quot;https://i.stack.imgur.com/kxCO1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kxCO1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;,&lt;br&gt;&#xA;the frequency range has changed. Which is confusing me. I have put several hours into finding out why this is happening but i can't seem to find the reason.&lt;br&gt;&#xA;Can somebody explain? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT1: Just realized that this example is misleading as I am referring to the change in maximum Frequency, (the y-labels)&lt;/p&gt;&#xA;" OwnerUserId="19694" LastEditorUserId="19694" LastEditDate="2016-04-10T12:26:10.760" LastActivityDate="2016-04-11T05:34:39.137" Title="Why does resampling change the frequency range?" Tags="|frequency|resampling|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30016" PostTypeId="1" AcceptedAnswerId="30167" CreationDate="2016-04-10T15:57:33.027" Score="3" ViewCount="869" Body="&lt;p&gt;I'm trying to automatically calculate particles sizes histogram for images like this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zImpv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zImpv.png&quot; alt=&quot;Image example: sphere particles with overlapping and superposition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Common threshold and segmentation doesn't seem to work. What filters and algorithms do you suggest to be used?&lt;/p&gt;&#xA;" OwnerUserId="20472" LastActivityDate="2016-04-19T23:41:48.080" Title="How to calculate particles sizes for spheric particles with overlapping and superposition? (Example image included)" Tags="|image-processing|computer-vision|hough-transform|shape-analysis|particle-filter|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30017" PostTypeId="1" AcceptedAnswerId="30020" CreationDate="2016-04-10T16:31:24.390" Score="1" ViewCount="547" Body="&lt;p&gt;I have recently studied few work where the low and high frequency components of an image is accessed using the discrete cosine transform (one such example is presented &lt;a href=&quot;https://stackoverflow.com/questions/22322427/decomposing-an-image-into-two-frequency-components-using-dct&quot;&gt;here&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Low and High frequency components of an image can be easily accessed by applying a high pass filter in transformed domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is that what extra importance does DCT have over the simple high pass filter in accessing high and low frequency components of an image. In other words instead of applying DCT can't we directly access these components using High Pass filter?&lt;/p&gt;&#xA;" OwnerUserId="4444" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2016-04-10T18:06:04.120" Title="Importance of Discrete Cosine Transform over High Pass filter?" Tags="|image-processing|discrete-signals|frequency-domain|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30020" PostTypeId="2" ParentId="30017" CreationDate="2016-04-10T18:06:04.120" Score="1" Body="&lt;p&gt;Yes, if you apply a filter, say a high Pass, you get the low frequency components of the image, &lt;strong&gt;but still in the image domain&lt;/strong&gt;. You need a Transformation, like the DCT or the FFT to get to the frequency domain, to see the separate frequency components of the image.&lt;/p&gt;&#xA;" OwnerUserId="20297" LastActivityDate="2016-04-10T18:06:04.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30021" PostTypeId="2" ParentId="28170" CreationDate="2016-04-10T19:47:31.660" Score="0" Body="&lt;p&gt;My best interpretation of complimentary frequencies is this.&#xA;We could assume that each frequency in an octave represents a colour.&#xA;(All our visible colours are within one octave). If A is Green, A in&#xA;any octave is green. &#xA;So then lets compare the properties of complimentary colours and then&#xA;use those as an assumption to calculate a complimentary frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A property of complimentary colours is that there is only 1 complimentary&#xA;colour for each colour. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume that we find a complimentary frequency by taking it as&#xA;a ratio of the original frequency. &#xA;There is only 1 ratio that will give 1 complimentary frequency&#xA;for each frequency. It would also have to have the property that multiplying&#xA;the complimentary frequency by the same ratio gives you an octave of its&#xA;original frequency. &#xA;The only ratio that does this is  The square root of 2 (2^0.5). multiplying or dividing by the square root of 2 finds only one other frequency per octave and will get you back to an octave of its original frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is equivalent of 6 semi-tones or 600 cents. Sebastian is correct !!&lt;/p&gt;&#xA;" OwnerUserId="20476" LastEditorUserId="20476" LastEditDate="2016-04-10T21:39:47.593" LastActivityDate="2016-04-10T21:39:47.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30022" PostTypeId="1" CreationDate="2016-04-10T23:09:50.943" Score="1" ViewCount="53" Body="&lt;p&gt;I hope this is the right place to ask this, so here goes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently trying to implement a convolutional neural network in C++, but since I have no formal education in signal processing, image classification, or anything of the sort, I am a bit confused as to the filter part of it. So I understand the general structure, but I don't understand where you get the convolution filters from. Do you just use a general set of filters that are supposed to identify things like edges. Or do you train the filters? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So say I have 64x64 images of either a face or not a face. If I understand  it correctly, you pass this image into a set of convolutional filters, and pass that output into something that downsizes the new images. Then you keep doing this until the images are suitable for direct classification. Am I getting something wrong here? And how do I know which convolutional filters to use? Is there some sort of standard set of filters that detect features?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated!!!&lt;/p&gt;&#xA;" OwnerUserId="20478" LastActivityDate="2016-04-10T23:09:50.943" Title="Feature maps for a Convolutional Neural Network" Tags="|filters|convolution|neural-network|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30023" PostTypeId="2" ParentId="28059" CreationDate="2016-04-11T01:33:46.327" Score="0" Body="&lt;p&gt;In case you are looking for opensource, R is a good choice.&#xA;You can use the tuneR library in R for signal processing &lt;/p&gt;&#xA;" OwnerUserId="18006" LastActivityDate="2016-04-11T01:33:46.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30024" PostTypeId="1" AcceptedAnswerId="30026" CreationDate="2016-04-11T02:35:25.233" Score="1" ViewCount="432" Body="&lt;p&gt;I need to show that the following system is always controllable:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}A &amp;amp;= \begin{bmatrix}&#xA;-\alpha_1I_{k\times k}&amp;amp; -\alpha_2I_{k\times k}&amp;amp; \cdots &amp;amp;-\alpha_{n-1}I_{k\times k}&amp;amp;-\alpha_nI_{k\times k}\\&#xA;I_{k\times k}&amp;amp;0_{k\times k}&amp;amp;\cdots&amp;amp;0_{k\times k}&amp;amp;0_{k\times k}\\&#xA;0_{k\times k}&amp;amp;I_{k\times k}&amp;amp;\cdots&amp;amp;0_{k\times k}&amp;amp;0_{k\times k}\\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots&amp;amp;&#xA;\vdots&amp;amp;\vdots\\&#xA;0_{k\times k}&amp;amp;0_{k\times k}&amp;amp;\cdots&amp;amp;I_{k\times k}&amp;amp;0_{k\times k}\end{bmatrix}_{nk\times nk}\\&#xA;B&amp;amp;=\begin{bmatrix}&#xA;I_{k\times k}\\&#xA;0_{k\times k}\\&#xA;\vdots\\&#xA;0_{k\times k}\end{bmatrix}_{nk\times n} \quad C=\begin{bmatrix}N_1&amp;amp;N_2&amp;amp;\cdots&amp;amp;N_n\end{bmatrix}_{m\times nk}.&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I think this is actually the controllable canonical form, but I'm really confused about how to show this is always controllable. Can anyone help? Sorry if this is a dumb question.&lt;/p&gt;&#xA;" OwnerUserId="15460" LastEditorUserId="1629" LastEditDate="2016-04-11T09:36:45.313" LastActivityDate="2016-04-11T09:36:45.313" Title="Showing a system is always controllable?" Tags="|signal-analysis|linear-systems|control-systems|system-identification|linear-algebra|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30025" PostTypeId="2" ParentId="30015" CreationDate="2016-04-11T05:34:39.137" Score="1" Body="&lt;p&gt;Uniformly sampled pulse code modulation (PCM) audio such as WAV files only encodes frequencies up to the Nyquist frequency, which is half the sampling frequency. So for a sampling frequency of 500 kHz you can have frequencies up to 250 kHz, and for a sampling frequency of 192 kHz you can have frequencies up to 96 kHz. This is reflected in the range of the Y labels.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-04-11T05:34:39.137" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30026" PostTypeId="2" ParentId="30024" CreationDate="2016-04-11T09:26:16.483" Score="3" Body="&lt;p&gt;There's a very simple way to check controllability, indeed if you define the reachability matrix&#xA;$$&#xA;R = \begin{pmatrix}B &amp;amp; AB &amp;amp; \dots &amp;amp; A^{n-1}B\end{pmatrix}&#xA;$$&#xA;then the reachable subspace is the image of R. Hence to check complete controllability you just have to check that $R$ is full rank. &#xA;First, I think there's an error in the question, $B$ should be $nk\times k$ as you defined it.&#xA;Anyway, in your case $R$ will be a $nk\times nk$ matrix, the first $k$ columns are given by the columns of $B$, which are linearly independent by definition of $B$ (in fact you have the identity as the first block), thus $rankR\ge k$. The second $k$ columns are given by $AB$ which has the form&#xA;$$&#xA;AB = \begin{pmatrix}\star\\I_k\\0_{k\times k}\\\vdots\\0_{k\times k}\end{pmatrix}&#xA;$$&#xA;where $\star$ means a block you dont care about. Note that the columns of the matrix&#xA;$$&#xA;\begin{pmatrix}B &amp;amp; AB\end{pmatrix} = \begin{pmatrix}I_k &amp;amp; \star \\ 0_{k\times k} &amp;amp; I_k \\ 0_{k\times k} &amp;amp; 0_{k\times k} \\ \vdots &amp;amp; \vdots \\ 0_{k\times k} &amp;amp; 0_{k\times k}\end{pmatrix}&#xA;$$&#xA;are linearly independent reguardless of $\star$. Hence $rankR\ge 2k$. In the same way, for the term $A^k B$ you get the form&#xA;$$&#xA;A^k B = \begin{pmatrix}\star_1 \\ \star_2 \\ \vdots\\ \star_{k}\\ I_k\\0_{k\times k}\\ \vdots \\ 0_{k\times k}\end{pmatrix}&#xA;$$&#xA;where the Identity block is at position $k+1$. hence for any $0\ge k&amp;lt;j\ge n-1$ $A^{k}B$ and $A^jB$ have linearly independent columns, hence you obtain thart $R$ is full rank an the system is completely controllable &lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-04-11T09:26:16.483" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30028" PostTypeId="2" ParentId="29388" CreationDate="2016-04-11T09:57:37.517" Score="2" Body="&lt;p&gt;Uniform sampling is the definite standard as it simplifies not only mathematical derivations but also practical applications. On the other hand, there are some applications (such as array of sensors located in a nonuniform grid) in which taking uniformly distributed samples from a signal of interest is impossible. In such cases nonuniform sampling in either time or space is performed and the usual approach is to convert those nonuniform samples to uniform ones. Then follows the standard operations on those precomputed uniform samples. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2016-04-11T09:57:37.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30029" PostTypeId="1" CreationDate="2016-04-11T10:03:59.213" Score="0" ViewCount="245" Body="&lt;p&gt;I studied about Kalman filter(KF) for about a week. And I understand that Kalman filter(KF) is suitable for linear system and extended Kalman filter(EKF) can be used for nonlinear system. However, I wonder if extended Kalman filter(EKF) can be used for linear system. I understand that Kalman filter(KF) would be okay for the linear system. But I wonder if there's logical error of using the extended Kalman filter(EKF) for linear system. &lt;/p&gt;&#xA;" OwnerUserId="20485" LastEditorUserId="80" LastEditDate="2016-04-14T16:08:22.820" LastActivityDate="2016-04-14T16:08:22.820" Title="Extended kalman filter for linear system" Tags="|filters|kalman-filters|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30030" PostTypeId="2" ParentId="30029" CreationDate="2016-04-11T10:30:06.907" Score="1" Body="&lt;p&gt;the word &quot;extended&quot; might suggest you that EKF is a generalization of the result developed for the linear case. Hence the EKF applied to a linear system reduces to the standard KF.&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-04-11T10:30:06.907" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30031" PostTypeId="2" ParentId="9938" CreationDate="2016-04-11T10:33:09.710" Score="4" Body="&lt;p&gt;&lt;a href=&quot;http://gweep.net/%7Erocko/FFT/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;! you can find an explanation of the main differences between the two algorithms for the FFT.&#xA;At the end of the document there are some tables in which is it possible to note that, if the size of the data increases, the performance of the radix-4 fft are better than the radix-2.&lt;/p&gt;&#xA;" OwnerUserId="20486" LastEditorUserId="20486" LastEditDate="2023-11-13T09:51:29.883" LastActivityDate="2023-11-13T09:51:29.883" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30033" PostTypeId="2" ParentId="29979" CreationDate="2016-04-11T11:37:07.980" Score="1" Body="&lt;p&gt;The window size of your FFT limits your resolution and there is no way round this (i.e. you can't zero pad or zero stuff to get round it). The easiest way to think about it is: lower frequencies have longer periods so need a longer window (more samples) to differentiate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe it would be impossible to increase your resolution even if you used an alternaitve method like a series of very steep band passes narrower than the frequency resolution permitted by FFT for your window size. Yes, you would get some measures out from your band passes but if the window size was not long enough, the data would be highly inaccurate in differentiating very close lower frequencies as there would not be enough data to disentangle them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a window of 1 sample or 2 samples, in these cases it is easy to see that you just can't recover resolution from small windows without making them bigger by gathering more independent samples.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="15030" LastEditDate="2016-04-11T11:56:38.923" LastActivityDate="2016-04-11T11:56:38.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30034" PostTypeId="2" ParentId="29899" CreationDate="2016-04-11T12:58:06.510" Score="1" Body="&lt;p&gt;Just found the real answer. So far it's working well for a variety of different FIR filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I did. I detect the zero-crossings of the magnitude, using the derivative of the phase and the derivative of the magnitude for example. Each time I see one, I change the sign of the magnitude. By doing so, I get the amplitude $A(\omega)$ with values positive or negative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I divide the $H(\omega)$ by the amplitude I have calculated, to get $e^{j\theta(\omega)}$. Finally I take the phase $\theta(\omega)$ from this new term, unwrap the result, and I have a continuous phase without any extra jump, well suited to calculate the phase delay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The true power of this method is that it works even when the zeroes are close to be zeroes but are not exactly, which might happen for some minimum-phase FIR filters depending on the algorithm used to convert a linear phase FIR filter. In this particular case, the low jumps are not straight $\pi$ jumps, so all the other methods might fail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, shifting the filter coefficients is totally useless, because it didn't solve at all the problem of the phase delay calculus.&lt;/p&gt;&#xA;" OwnerUserId="15899" LastActivityDate="2016-04-11T12:58:06.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30035" PostTypeId="1" CreationDate="2016-04-11T13:12:19.440" Score="1" ViewCount="431" Body="&lt;p&gt;This is a question from control theory but I hope you can help me with it. I was pointed to this community. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in my control loop I have elements that have cut-off frequency of 3-5kHz and I designed a PID controller for the inner loop and those elements and suddenly I get a closed loop bandwidth of 30-50kHz cut-off frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the loop is in the figure bellow.&lt;a href=&quot;https://i.stack.imgur.com/oU5FU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oU5FU.png&quot; alt=&quot;Closed control loop&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the PID controller, or voltage controller I designed is a PID with a derivative filter. Current sources are modeled as 1st order filters with 3-5kHz cutoff frequency. How is it possible to get such a high bandwidth of the closed loop if the inner elements have a lower cut-off frequency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="20488" LastEditorUserId="80" LastEditDate="2016-04-11T14:20:09.010" LastActivityDate="2016-06-11T01:03:45.917" Title="Can bandwidth of the closed loop be bigger than bandwidth of individual elements in it?" Tags="|control-systems|bandwidth|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="30039" PostTypeId="1" CreationDate="2016-04-11T14:44:20.437" Score="3" ViewCount="5783" Body="&lt;p&gt;I am working on basic signal processing problems in MATLAB. I have found a signal from the internet (i don't remember the site exactly). The data is organized in column wise. 1st and 2nd column is data and 3rd column is a rectangular wave. The rectangular wave is not very smooth. So I decided to detect four points as shown in the figure. I spend 2 days to find the exact solution but i couldn't find any solution to the detect those four points.&#xA;I tried few things:&lt;br&gt;&#xA;1) finding the difference between the points to get 1,2,3 and 4 points.&#xA;but it doesn't work.&lt;br&gt;&#xA;2) Median Filter to smooth the wave.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xWZXQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xWZXQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;Anyone, please give some suggestion to detect these points in MATLAB&lt;/p&gt;&#xA;" OwnerUserId="16293" LastEditorUserId="16293" LastEditDate="2016-04-11T17:17:16.750" LastActivityDate="2016-04-13T15:59:35.363" Title="detect to rising, stable and falling point in non-smooth rectangular wave" Tags="|matlab|filters|signal-analysis|edge-detection|smoothing|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30042" PostTypeId="2" ParentId="30035" CreationDate="2016-04-11T15:08:03.930" Score="1" Body="&lt;p&gt;Yes, that's perfectly possible and to be expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a toy example that starts with a Butterworth low pass filter and puts it in the forward path of a feedback loop. The feedback path has a gain of two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes the whole loop unstable, but it also makes the bandwidth very high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original filter's frequency response is below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BtzzQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BtzzQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is the closed loop response.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;https://i.stack.imgur.com/fHrY5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fHrY5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&#xA;    #30035&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;library(&quot;signal&quot;)&#xA;&#xA;bf &amp;lt;- butter(5, 0.1)&#xA;freqz(bf)&#xA;dev.copy(png, 'Q30035/Q30035-Butterworth.png')&#xA;dev.off()&#xA;&#xA;k &amp;lt;- 2&#xA;bf2 &amp;lt;- bf&#xA;bf2$a &amp;lt;- bf$a + k*bf$b&#xA;bf2$b &amp;lt;- bf$a*k&#xA;freqz(bf2)&#xA;dev.copy(png, 'Q30035/Q30035-Feedback.png')&#xA;dev.off()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-11T15:08:03.930" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30043" PostTypeId="1" CreationDate="2016-04-11T15:41:28.210" Score="0" ViewCount="1322" Body="&lt;p&gt;I wish to do the FFT of streaming audio data coming into a computer. I am just interested in frequencies from 80 Hz up to 1000 Hz but with a frequency resolution of 3 to 4 Hz and no more. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically my question is , as my sampling frequency (Fs) is 44100, will my FFT window size have to be no less than 11025 (N) ?  (because spacing of FFT bins = Fs/N). Does this mean that I am completely limited to taking windows of data any higher than 4 times a second with my desired resolution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately I need to be able to capture windows of data 8 times a second and also have a resolution of 3 to 4 Hz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this actually possible? Many thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="20443" LastActivityDate="2016-04-11T16:22:34.493" Title="How to do the highest resolution FFT?" Tags="|fft|audio|sampling|dft|sound|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30044" PostTypeId="2" ParentId="30043" CreationDate="2016-04-11T16:17:31.043" Score="1" Body="&lt;p&gt;The FFT size can be longer than the window size.  For instance you can use audio sample windows of 5512 (about 8 per second) and zero-pad them to length 16384 for each FFT.  If noise level is low enough and the separation between frequency peaks is great enough, the interpolation provided by this zero-padding can provide better frequency estimation and plot resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;highest resolution&quot; FFT reasonable depends on the signal-to-noise ratio as well as the window length, as after a certain point, interpolation and frequency estimation methods will be affected as much by nearby spectral noise as by the spectral peaks that one is trying to estimate at &quot;high resolution&quot;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-11T16:22:34.493" LastActivityDate="2016-04-11T16:22:34.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30045" PostTypeId="2" ParentId="30043" CreationDate="2016-04-11T16:18:44.010" Score="-1" Body="&lt;p&gt;You can zero pad your &quot;windows&quot; of data to increase the frequency resolution. to get 3-4 Hz resolution, you would need to take a 16384 point FFT (gets you about 2.5Hz resolution). you could then take 1/8th of your sampling rate in samples (5513 samples) and add zeros to the end until you get 16384 samples. By taking the FFT of this, new block with zeros at the end, you still get a 16384 point FFT, which gives you the frequency resolution you need, but still be able do your fft 8 times a second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that you need a number of samples that is a power of 2 to do an FFT, If you are doing the fft in matlab, i believe it will add zeros to the end of your signal if you don't give it enough samples. If you can get by with a resolution of 5.4Hz, then you can do a 8192 point FFT.&lt;/p&gt;&#xA;" OwnerUserId="16913" LastActivityDate="2016-04-11T16:18:44.010" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30046" PostTypeId="2" ParentId="30039" CreationDate="2016-04-11T16:23:20.180" Score="6" Body="&lt;p&gt;The usual approach to change detection is &lt;a href=&quot;https://en.wikipedia.org/wiki/CUSUM&quot; rel=&quot;nofollow noreferrer&quot;&gt;the CUSUM algorithm.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've done an implementation that just addresses the level (mean) change issue. It's included (in R) below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The black line is the noise-free data, the red line is the noisy data and the blue bars are the detected breaks (for this realization).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This just addresses the level change; to address the three zones: low level, changing level, and high level, you'll need to figure out the way to estimate the mean in the changing level (perhaps assume a rise time and fix the two levels?).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://chamilo2.grenet.fr/inp/courses/ENSE3A35EMIAAZ0/document/change_detection.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The code below is based on this document.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1L963.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1L963.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A slight change might get you the first and second changes easily: instead of working with the data, work with the difference of the data.  If I do that, then I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tBwEL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tBwEL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I've had to add:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sigma &amp;lt;- 0.001&#xA;data_before_diff &amp;lt;- noiseless_data + rnorm(length(noiseless_data),0,sigma)&#xA;data &amp;lt;- diff(data_before_diff)&#xA;mu2diff &amp;lt;- 0.04&#xA;thresh &amp;lt;- 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then later:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; s[k] = (mu2diff - mu1)/sigma*(data[k] - (mu2diff + mu1)/2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    tmp &amp;lt;- mu1&#xA;    mu1 &amp;lt;- mu2diff&#xA;    mu2diff &amp;lt;- tmp&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To find the changes at the end of the signal, you'll probably need to change &lt;code&gt;mu2diff&lt;/code&gt; to &lt;code&gt;-mu2diff&lt;/code&gt; and check for that versus 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note I've had to greatly reduce the noise variance and thus the threshold to get this to work.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 30039&#xA;# CUSUM &#xA;&#xA;N &amp;lt;- 30&#xA;&#xA;mu1 &amp;lt;- 0&#xA;mu2 &amp;lt;- 1&#xA;noiseless_data &amp;lt;- c(rep(mu1,N), seq(mu1,mu2,1/N), rep(mu2,N*4), seq(mu2,mu1,-1/N), rep(mu1,N))&#xA;&#xA;&#xA;sigma &amp;lt;- 0.1&#xA;data &amp;lt;- noiseless_data + rnorm(length(noiseless_data),0,sigma)&#xA;&#xA;thresh &amp;lt;- 100&#xA;&#xA;breaks &amp;lt;- rep(0,N)&#xA;num_breaks &amp;lt;- 0&#xA;&#xA;s &amp;lt;- rep(0,length(data))&#xA;capS &amp;lt;- rep(0,length(data))&#xA;G &amp;lt;- rep(0,length(data))&#xA;for (k in 1:length(data))&#xA;{&#xA;  s[k] = (mu2 - mu1)/sigma*(data[k] - (mu2+mu1)/2)&#xA;  if (k==1)&#xA;  {&#xA;    capS[k] = s[k]&#xA;  }&#xA;  else&#xA;  {&#xA;    capS[k] = capS[k-1] + s[k]&#xA;  }&#xA;&#xA;  G[k] &amp;lt;- max(0,capS[k] - min(capS[1:k]))&#xA;&#xA;  if (abs(G[k]) &amp;gt; thresh)&#xA;  {&#xA;    #capS[k] &amp;lt;- 0&#xA;    num_breaks &amp;lt;- num_breaks + 1&#xA;    breaks[num_breaks] &amp;lt;- which.min(capS[1:k])&#xA;    tmp &amp;lt;- mu1&#xA;    mu1 &amp;lt;- mu2&#xA;    mu2 &amp;lt;- tmp&#xA;  }&#xA;}&#xA;&#xA;first_break &amp;lt;- min(breaks[1:num_breaks])&#xA;last_break &amp;lt;- max(breaks[1:num_breaks])&#xA;&#xA;plot(data,col=&quot;red&quot;, type=&quot;l&quot;)&#xA;lines(noiseless_data)&#xA;lines(c(first_break,first_break),c(0,1),col=&quot;blue&quot;, lwd=10)&#xA;lines(c(last_break,last_break),c(0,1),col=&quot;blue&quot;,lwd=10)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-11T19:01:16.003" LastActivityDate="2016-04-11T19:01:16.003" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30047" PostTypeId="2" ParentId="26895" CreationDate="2016-04-11T17:00:14.947" Score="0" Body="&lt;p&gt;You should not have to compress the audio signal. Check your microphone level and adjust, so that the signal does not clip at 0dB. The level meter of any modern Windows machine will show when this happens. The reason for your muffled sound is that the filter needs to be done as apart of the re-sampling process. This is because the filter is used as an interpolator that will pick which samples to keep and discard the rest. It also needs to be low-pass filter when resampling downward to prevent aliasing. Not sure if band passing beforehand will do the same. I would set the high frequency at 8 kHz to preserve the frequency range. The Nyquist theory states that sound must be sampled at over twice the highest frequency to preserve the signal. Hopefully these suggestions will improve your results. I prefer doing my resampling and other digital signal processing via source code, which I do not distribute freely. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                               Regards, &#xA;&#xA;                                 thomasjonkeratyahoodotcom &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20494" LastActivityDate="2016-04-11T17:00:14.947" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30053" PostTypeId="2" ParentId="29372" CreationDate="2016-04-11T21:20:50.317" Score="0" Body="&lt;p&gt;Solved this by using binary search to find suitable position for leaky integrator.&lt;/p&gt;&#xA;" OwnerUserId="19991" LastEditorUserId="19991" LastEditDate="2016-09-18T05:17:03.193" LastActivityDate="2016-09-18T05:17:03.193" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30056" PostTypeId="1" CreationDate="2016-04-12T04:11:02.437" Score="0" ViewCount="1259" Body="&lt;p&gt;I have a Gaussian random variable $z$, whose mean $\mu$ and variance $\sigma^2$ are functions of two variables $x$ and $y$. Is there any way in MATLAB so that I can find the values of $x$ and $y$ for which $P(z)$ = $N(z$;$\mu$$(x,y)$,$\sigma$$(x,y))$ is maximised for a given value of $z$? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="20383" LastEditorUserId="20383" LastEditDate="2016-04-12T08:47:17.730" LastActivityDate="2016-04-12T15:01:59.637" Title="Finding Argmax in MATLAB" Tags="|matlab|gaussian|" AnswerCount="2" CommentCount="4" ClosedDate="2016-04-12T15:02:14.497" ContentLicense="CC BY-SA 3.0" />
  <row Id="30058" PostTypeId="2" ParentId="22829" CreationDate="2016-04-12T06:08:26.937" Score="0" Body="&lt;p&gt;The power spectral density (PSD) indicates the strength of the energy as a function of frequency. In other words, it shows at which frequencies energy variations are strong and at which frequencies they are weak. The unit of PSD is energy per bandwidth and you can obtain energy within a specific frequency range by integrating PSD within that frequency range. Computation of PSD is done directly by the FFT or computing autocorrelation function and then transforming it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-011-introduction-to-communication-control-and-signal-processing-spring-2010/readings/MIT6_011S10_chap10.pdf&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; there is a detailed explanation of how it is calculated.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-04-12T06:08:26.937" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30059" PostTypeId="2" ParentId="30056" CreationDate="2016-04-12T06:12:37.580" Score="2" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[argvalue, argmin] = min(x);&#xA;[argvalue, argmax] = max(x);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also, have a look to &lt;a href=&quot;https://stackoverflow.com/questions/14556733/matlab-argmax-and-argmin&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2016-04-12T06:12:37.580" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30060" PostTypeId="1" AcceptedAnswerId="30063" CreationDate="2016-04-12T09:04:32.643" Score="26" ViewCount="37574" Body="&lt;p&gt;There are nice technical definitions in textbooks and wikipedia, but I'm having a hard time understanding what differentiates stationary and non-stationary signals in practice?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which of the following &lt;strong&gt;discrete signals&lt;/strong&gt; are stationary? why?:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;white noise - &lt;strong&gt;YES&lt;/strong&gt; (according to every possible information found)  &lt;/li&gt;&#xA;&lt;li&gt;colored noise - &lt;strong&gt;YES&lt;/strong&gt; (according to&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/q/13954/19697&quot;&gt;Colored noises: Stationary or non-stationary?&lt;/a&gt; )&lt;/li&gt;&#xA;&lt;li&gt;chirp (sinus with&#xA;changing frequency) - ? &lt;/li&gt;&#xA;&lt;li&gt;sinus - ?&lt;/li&gt;&#xA;&lt;li&gt;sum of multiple sinuses with different periods and amplitudes - ?&lt;/li&gt;&#xA;&lt;li&gt;ECG, EEG, PPT and similar - ?&lt;/li&gt;&#xA;&lt;li&gt;Chaotic system output (mackey-glass, logistic map) - ?&lt;/li&gt;&#xA;&lt;li&gt;Record of outdoors temperature - ?&lt;/li&gt;&#xA;&lt;li&gt;Record of forex market currency pair development - ?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="19697" LastEditorUserId="36334" LastEditDate="2018-06-18T13:28:43.487" LastActivityDate="2018-06-18T13:28:43.487" Title="Stationary vs non-stationary signals?" Tags="|discrete-signals|stationary|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="30061" PostTypeId="2" ParentId="29325" CreationDate="2016-04-12T10:40:08.867" Score="1" Body="&lt;p&gt;The sensor is analogue and being input to Arduino for analogue to digital conversion. Arduino has a function &lt;strong&gt;Micros()&lt;/strong&gt; which Returns the number of microseconds since the Arduino board began running the current program, I suggest using this to accurately save the time of analogue read on Arduino. Calculate the difference as shown in the code below and send it through with the sensor reading to Matlab. Then just average the values of the time difference calculated by &lt;strong&gt;t2-t1&lt;/strong&gt; &lt;em&gt;which will be almost constant&lt;/em&gt;, and you will have as accurate as possible the sampling time/Sampling frequency used and so you can very accurately do an FFT analysis using this information. Hope this will be helpful.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Define Analogue Ports for Sensor input&#xA;const int xpin1 = A2; // x-axis of the accelerometer 1&#xA;&#xA;//Define variable t1 for timing&#xA;unsigned long t1 = micros();&#xA;&#xA;void loop()&#xA;{&#xA;  int x1 = analogRead(xpin1);  //read x from 1&#xA;&#xA;  Serial.print(x1);  //print x1 value on serial monitor&#xA;  Serial.print(&quot;\t&quot;);&#xA;&#xA;  unsigned long t2 = micros();&#xA;  Serial.print(t2-t1);&#xA;  Serial.print(&quot;\t&quot;);&#xA;  t1 = t2;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="19948" LastActivityDate="2016-04-12T10:40:08.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30063" PostTypeId="2" ParentId="30060" CreationDate="2016-04-12T13:17:48.433" Score="34" Body="&lt;p&gt;There is no stationary signal. Stationary and non-stationary are characterisations of the process that generated the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A signal is an observation. A recording of something that has happened. A recording of a series of events as a result of some process. If the properties of the process that generates the events DOES NOT change in time, then the process is stationary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know what a signal $x(n)$ is, it is a collection of events (measurements) at different time instances ($n$). But how can we describe the process that generated it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way of capturing the properties of a process is to obtain the probability distribution of the events it describes. Practically, this could look like a histogram but that's not entirely useful here because it only provides information on each event as if it was unrelated to its neighbour events. Another type of &quot;histogram&quot; is one where we could fix an event and ask what is the probability that the other events happen GIVEN another event has already taken place. So, if we were to capture this &lt;a href=&quot;https://en.wikipedia.org/wiki/Markov_chain&quot; rel=&quot;noreferrer&quot;&gt;&quot;monster histogram&quot;&lt;/a&gt; that describes the probability of transition from any possible event to any other possible event, we would be able to describe any process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, if we were to obtain this at two different time instances and the event-to-event probabilities did not seem to change then that process would be called a stationary process. (Absolute knowledge of the characteristics of a process in nature is rarely assumed of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said this, let's look at the examples:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;White Noise:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;White noise is stationary because any signal value (event) is equally&#xA;probable to happen given any other signal value (another event) at&#xA;any two time instances no matter how far apart they are.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Coloured Noise:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is coloured noise? It is essentially white-noise with some additional constraints. The constraints mean that the event-to-event probabilities are now not equal BUT this doesn't mean that they are allowed to change with time. So, &lt;a href=&quot;https://en.wikipedia.org/wiki/Pink_noise&quot; rel=&quot;noreferrer&quot;&gt;Pink noise&lt;/a&gt; is filtered white noise whose frequency spectrum decreases following a specific relationship. This means that pink noise has more low frequencies which in turn means that any two &lt;em&gt;neighbouring&lt;/em&gt; events would have higher probabilities of occurring but that would not hold for &lt;strong&gt;any&lt;/strong&gt; two events (as it was in the case of white noise). Fine, but if we were to obtain these event-to-event probabilities at two different time instances and they did not seem to change, then the process that generated the signals would be stationary.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chirp:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Non stationary, because the event-to-event probabilities change with time. Here is a relatively easy way to visualise this: Consider a sampled version of the lowest frequency sinusoid at some sampling frequency. This has some event-to-event probabilities. For example, you can't really go from -1 to 1, if you are at -1 then the next probable value is much more likely to be closer to -0.9 depending of course on the sampling frequency. But, actually, to generate the higher frequencies you can resample this low frequency sinusoid. All you have to do for the low frequency to change pitch is to &quot;play it faster&quot;. AHA! THEREFORE, YES! You can actually move from -1 to 1 in one sample, provided that the sinusoid is resampled really really fast. THEREFORE!!! The event-to-event probabilities CHANGE WITH TIME!, we have by passed so many different values and went from -1 to 1 in this extreme case....So, this is a non-stationary process.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sinus(oid)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Stationary...Self-explanatory, given #3&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sum of multiple sinuses with different periods and amplitudes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Self explanatory given #1, #2,#3 and #4. If the periods and amplitudes of the components do not change in time, then the constraints between the samples do not change in time, therefore the process will end up stationary.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;ECG, EEG, PPT and similar&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I am not really sure what PPT is but ECG and EEG are prime examples of non-stationary signals. Why? The ECG represents the electrical activity of the heart. The heart has &lt;a href=&quot;https://en.wikipedia.org/wiki/Purkinje_fibers&quot; rel=&quot;noreferrer&quot;&gt;its own oscillator&lt;/a&gt; which is modulated by signals from the brain AT EVERY HEARTBEAT! Therefore, since the process changes with time (i.e. the way that the heart beats changes at each heart beat) then it is considered non-stationary. The same applies for the EEG. The EEG represents a sum of localised electrical activity of neurons in the brain. The brain cannot be considered stationary in time since a human being performs different activities. Conversely, if we were to fix the observation window we could claim some form of stationarity. For example, in neuroscience, you can say that 30 subjects were instructed to stay at rest with their eyes closed while EEG recordings were obtained for 30 seconds and then say that FOR THOSE SPECIFIC 30 SEC AND CONDITION (rest, eyes closed) THE BRAIN (as a process) IS &lt;strong&gt;ASSUMED&lt;/strong&gt; TO BE STATIONARY.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chaotic system output.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Similar to #6, chaotic systems could be considered stationary over brief periods of time but that's not general.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Temperature recordings:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Similar to #6 and #7. &lt;a href=&quot;http://research.metoffice.gov.uk/research/nwp/ensemble/concept.html&quot; rel=&quot;noreferrer&quot;&gt;Weather&lt;/a&gt; is a prime example of a chaotic process, it cannot be considered stationary for too long.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Financial indicators:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Similar to #6,#7,#8,#9. In general cannot be considered stationary.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A useful concept to keep in mind when talking about practical situations is &lt;a href=&quot;https://en.wikipedia.org/wiki/Ergodic_process&quot; rel=&quot;noreferrer&quot;&gt;ergodicity&lt;/a&gt;. Also, there is something that eventually creeps up here and that is the scale of observation. Look too close and it's not stationary, look from very far away and everything is stationary. The scale of observation is context dependent. For more information and a large number of illustrating examples as far as the chaotic systems are concenred, I would recommend &lt;a href=&quot;http://www.cambridge.org/us/academic/subjects/physics/nonlinear-science-and-fluid-dynamics/nonlinear-time-series-analysis-2nd-edition?format=PB&quot; rel=&quot;noreferrer&quot;&gt;this book&lt;/a&gt; and specifically chapters 1,6,7,10,12 and 13 which are really central on stationarity and periodicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="1212" LastEditorUserId="1212" LastEditDate="2016-04-13T14:45:10.640" LastActivityDate="2016-04-13T14:45:10.640" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30064" PostTypeId="1" CreationDate="2016-04-12T13:53:31.207" Score="0" ViewCount="333" Body="&lt;p&gt;I'm fitting IIR filters to a complex transfer function with Matlab's &lt;a href=&quot;http://de.mathworks.com/help/signal/ref/invfreqz.html&quot; rel=&quot;nofollow&quot;&gt;invfreqz.m&lt;/a&gt;. My fitting results are very good, but when I come very close to the Nyquist frequency the phase response runs to 0 and I also get deviations in the magnitude response. I did some research but couldn't find anything regarding that phenomenon. Can anybody point me in the right direction, for which keywords I have to search in order to find something on that topic and how I can try to optimize the fitting near the Nyquist frequency?&lt;/p&gt;&#xA;" OwnerUserId="19741" LastEditorUserId="80" LastEditDate="2016-04-12T14:12:28.770" LastActivityDate="2016-04-12T16:22:23.777" Title="Filter Design near Nyquist frequency (complex curve fitting)" Tags="|matlab|discrete-signals|filter-design|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30065" PostTypeId="2" ParentId="30060" CreationDate="2016-04-12T13:58:09.983" Score="20" Body="&lt;p&gt;@A_A's good answer misses one point:  stationarity or nonstationarity are generally only applied to stochastic signals, not deterministic signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, when statistical tests are applied for stationarity or nonstationarity, the deterministic component must be removed first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, in my view, numbers 3, 4, and 5 are non-sensical questions because they contain no stochastic component and, therefore, cannot be considered either stationary or nonstationary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Item #3, if the sinusoid has stationary noise added to it, could be considered a &lt;a href=&quot;https://en.wikipedia.org/wiki/Cyclostationary_process&quot;&gt;&lt;em&gt;cyclostationary&lt;/em&gt; process&lt;/a&gt;, as the mean of the process changes (though generally with cyclostationary processes it is assumed the variance also changes with time).&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-12T13:58:09.983" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30066" PostTypeId="2" ParentId="27034" CreationDate="2016-04-12T14:39:50.983" Score="1" Body="&lt;p&gt;I would try techniques related to low-rank approximations of your data $X$. For instance, the paper &lt;a href=&quot;http://www.icml-2011.org/papers/41_icmlpaper.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;GoDec: Randomized Low-rank &amp;amp; Sparse Matrix Decomposition in Noisy Case&lt;/a&gt; attempts to decompose&#xA;$$X = L + S + G$$&#xA;with a low-rank part ($\mathrm{rank}(L) \le r$), a sparse part ($\mathrm{card}(S) \le k$) and a residual $G$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been employed for background modeling, with backgrounds related to the low-rank part, plus sparse en independent objects. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1NHPh.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1NHPh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some video demos are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=YpdCvbJI2eg&quot; rel=&quot;nofollow noreferrer&quot;&gt;GoDec and Robust PCA for background modeling on Escalator&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=BTrbow8u4Cw&quot; rel=&quot;nofollow noreferrer&quot;&gt;GoDec and Robust PCA for background modeling on Hall&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are alternatives in the field of robust matrix factorization, and I understand it as an instance of sparse coding.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-04-12T14:48:52.377" LastActivityDate="2016-04-12T14:48:52.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30067" PostTypeId="1" CreationDate="2016-04-12T14:57:31.310" Score="2" ViewCount="316" Body="&lt;p&gt;I am building a sensor and I am trying to understand how to process the signal that it generates. The sensor has a library of reference signals. When 'event a' occurs, it produces signal A, when 'event B' occurs it produces signal B. EX:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/omGPN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/omGPN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible for multiple (but few) events to occur, and their signals would add together linearly. I am looking for an algorithm for signal decomposition which takes advantage of the fact that the decomposition is discrete (It can give integer multiples of the library signals only). I also need some measure of the reliability of the identification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ex:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Input:&#xA;  &lt;a href=&quot;https://i.stack.imgur.com/qThZs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qThZs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;     (I made this image by taking A + 2 * B + noise)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Example Output:&#xA;A + 2 B  -  95% confidence&#xA;A + B    -  3% confidence&#xA;A        -  1% confidence&#xA;None of the Above - 1% confidence    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've noticed that I can compare two different possibilities by taking an inner product of the normalized proposed solution and input signals. For instance: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input Signal .  (A + 2 B) = 0.999&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input Signal .  (A + B) = 0.985 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the first solution is a closer match to the input signal. I thought about using a Newton-Raphson to maximize this inner product, but when the actual sensor is in use it could have 1000s of signals in it's library and that would not be realistic.&lt;/p&gt;&#xA;" OwnerUserId="20512" LastEditorUserId="128" LastEditDate="2023-06-24T09:20:36.117" LastActivityDate="2023-06-24T09:20:36.117" Title="Algorithm for Discrete Signal Decomposition" Tags="|signal-analysis|decomposition|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30068" PostTypeId="2" ParentId="30056" CreationDate="2016-04-12T15:01:59.637" Score="0" Body="&lt;p&gt;If you can express $\mu$ in an functional form, you could use &lt;a href=&quot;http://www.mathworks.com/help/optim/ug/fsolve.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fsolve&lt;/code&gt;.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-12T15:01:59.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30069" PostTypeId="1" CreationDate="2016-04-12T15:13:33.927" Score="3" ViewCount="2823" Body="&lt;p&gt;I'm trying to solve for the amplitude and frequency of a sinusoid embedded in zero-mean gaussian white noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am supplied a sample file of a 40000 element array. I first took the autocorrelation function in matlab and then took the fft of this to find the power spectral density. From there I was able to find the frequency of the sinusoid due to the peaks. I am unsure how I could go about finding the amplitude, as I am unsure how I can go about normalizing the PSD or Autocorrelation function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ps this is all done in matlab, thanks!&lt;/p&gt;&#xA;" OwnerUserId="20513" LastActivityDate="2016-04-14T16:10:25.463" Title="Finding the Amplitude of a Sinusoid in Noise" Tags="|noise|autocorrelation|power-spectral-density|" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30071" PostTypeId="2" ParentId="30069" CreationDate="2016-04-12T16:09:02.377" Score="3" Body="&lt;p&gt;If you know you have a single sinusoid in Gaussian noise, then a least squares type parametric estimator might be one method of estimating the amplitude. See  &lt;a href=&quot;https://www.dsprelated.com/freebooks/sasp/Least_Squares_Sinusoidal_Parameter.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DSP Related&lt;/a&gt;, specifically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LPrf9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LPrf9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="80" LastEditDate="2016-04-13T15:28:42.823" LastActivityDate="2016-04-13T15:28:42.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30072" PostTypeId="2" ParentId="30064" CreationDate="2016-04-12T16:22:23.777" Score="1" Body="&lt;p&gt;You can't get a good fit very near the Nyquist frequency (or near DC) because information is lost due to the imaginary components around that frequency being of (almost) opposite phase and thus (nearly) cancelling out.  Thus, there will be ambiguity errors due to trying to fit any curve to lost information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If possible, you can try to gather more information near (but not at) the Nyquist frequency by sampling for a longer time span or at a higher sample rate.  This will move the measurement point slightly farther from where there is complete cancellation of the imaginary component.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-12T16:22:23.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30073" PostTypeId="1" AcceptedAnswerId="30074" CreationDate="2016-04-12T16:23:43.013" Score="4" ViewCount="192" Body="&lt;p&gt;I have read few image enhancement papers, where an image is enhanced in transformed domain using either DCT (discrete cosine transform) or DWT (discrete wavelet transform) with SVD (singular value decomposition). An example is given in  &lt;a href=&quot;http://waset.org/publications/4004/enhancement-of-low-contrast-satellite-images-using-discrete-cosine-transform-and-singular-value-decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancement of low contrast satellite images using discrete cosine transform and singular value decomposition&lt;/a&gt;, 2011.&lt;/p&gt;&#xA;&lt;p&gt;In these works, once the image matrix is factored into three matrices (say &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;) using the SVD, then only the maximum value of matrix S is taken for processing. Can anyone please tell that why only the  maximum value is taken for processing?&lt;/p&gt;&#xA;" OwnerUserId="4444" LastEditorUserId="7092" LastEditDate="2022-02-20T16:30:29.230" LastActivityDate="2022-02-20T16:30:29.230" Title="Accessing Maximum Value from a Singular Value Decomposed Matrix" Tags="|image-processing|signal-analysis|linear-algebra|svd|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30074" PostTypeId="2" ParentId="30073" CreationDate="2016-04-12T17:27:50.943" Score="7" Body="&lt;p&gt;The SVD Decompose the image into the (One way to look at it) many matrices.&lt;br&gt;&#xA;For instance, given an Image $ I $ its SVD is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ I = U S {V}^{T} = \sum_{i=1}^{\textrm{rank}(I)} {s}_{i} {u}_{i} {v}_{i}^{T} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the image is decomposed into linear combination of matrices (Given by $ {u}_{i} {v}_{i}^{T} $) where the weight of the $ i $ -th matrix is given by $ {s}_{i} $ which is the $ i $-th Singular Value (Usually they are organized in descending order).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dominant features are usually goes with the large Singular Values (Moreover, the smallest one usually describe noise).&#xA;I guess methods want to focus on the large dominant features and avoid dealing with noise hence it makes sense to deal only with the dominant matrix in this decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, I'd experiment with trying to work on the next ones as well.&lt;br&gt;&#xA;In addition, on the recompositon process I'd neglect the last few to have &quot;Simple Denoising&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One should be aware that the SVD of the whole image might be time and memory consuming when dealing with large images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, it makes sense to stack few image patches into large matrix and then apply the SVD.&lt;br&gt;&#xA;This might extract what is common to all patches (Linear Dimensionality Reduction).&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2016-10-17T09:42:05.190" LastActivityDate="2016-10-17T09:42:05.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30075" PostTypeId="2" ParentId="29946" CreationDate="2016-04-12T18:00:16.593" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://op25.osmocom.org/trac/wiki&quot; rel=&quot;nofollow&quot;&gt;This project&lt;/a&gt; had fsk demodulation implemented( actually, they reuse another open source project). &#xA;I think it would be much easy for you to build python bridge to it, then to recreate all of it from scratch.&lt;/p&gt;&#xA;" OwnerUserId="19345" LastActivityDate="2016-04-12T18:00:16.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30076" PostTypeId="2" ParentId="30067" CreationDate="2016-04-12T18:41:27.117" Score="3" Body="&lt;p&gt;I'd just take a KIS (keep it simple) approach as a first step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define your (unknown) signal as&#xA;$$ s(t) = k A(t) + m B(t) + n(t)$$&#xA;and then just define the error:&#xA;$$ e(\tilde{k}, \tilde{m}) = \sum_{\forall t} \left| s(t) - \tilde{k} A(t) - \tilde{m} B(t) \right|^2 $$&#xA;and then your estimates $\hat{k}$ and $\hat{m}$ are just chosen as:&#xA;$$&#xA;(\hat{k}, \hat{m}) = \arg \min e(\tilde{k}, \tilde{m})&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The R code below does this, and the output seems to do the right thing. Here $n(t)$ is a Gaussian noise with zero mean and standard deviation of $0.1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rW9pV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rW9pV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual $k$ and $m$ values are at the green circle, the estimates are the blue diagonal bar beneath it (in the rightmost plot).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This appears to work for any values of $k$ and $m$, including zero.  You can probably extend it for more signals $C(t)$, $D(t)$, etc. too.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 30067&#xA;&#xA;prototype_length &amp;lt;- 40&#xA;&#xA;A &amp;lt;- rep(0, prototype_length)&#xA;A[(prototype_length/4+1):(3*prototype_length/4)] &amp;lt;- sin(2*pi*seq(0,prototype_length/2-1)/prototype_length)&#xA;&#xA;&#xA;B &amp;lt;- rep(0, prototype_length)&#xA;B[(prototype_length/2+1):(prototype_length)] &amp;lt;- `^`(sin(2*pi*seq(0,prototype_length/2-1)/prototype_length),12)*3/8&#xA;&#xA;par(mfrow = c(1,3), pty=&quot;s&quot;)&#xA;plot(A, type=&quot;l&quot;, col=&quot;blue&quot;, lwd=5)&#xA;lines(B, col=&quot;red&quot;, lwd=5)&#xA;title('Original Signals')&#xA;&#xA;k &amp;lt;- sample(0:10, 1)&#xA;m &amp;lt;- sample(0:10, 1)&#xA;&#xA;data &amp;lt;- k*A + m*B + 0.1 * rnorm(prototype_length, 0, 0.1)&#xA;plot(data, type=&quot;l&quot;)&#xA;title('Scaled &amp;amp; Added Signals')&#xA;&#xA;err &amp;lt;- array(0,c(11,11))&#xA;kvals &amp;lt;- array(0,c(11,11))&#xA;mvals &amp;lt;- array(0,c(11,11))&#xA;for (khat in 0:10)&#xA;{&#xA;  for (mhat in 0:10)&#xA;  {&#xA;    err[khat+1,mhat+1] &amp;lt;- sum('^'(abs(data - khat*A - mhat*B), 2))&#xA;    kvals[khat+1,mhat+1] &amp;lt;- khat&#xA;    mvals[khat+1,mhat+1] &amp;lt;- mhat&#xA;  }&#xA;}&#xA;&#xA;image(0:10,0:10,err, xlab=&quot;k hat&quot;, ylab = &quot;m hat&quot;)&#xA;ix &amp;lt;- which.min(err)&#xA;lines(kvals[ix] + c(-0.2,0.2), mvals[ix]+ c(-0.2,0.2), col=&quot;blue&quot;, lwd = 10)&#xA;points(k, m, col=&quot;green&quot;, lwd = 10)&#xA;title('Error, actual values, and minimum')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-12T18:41:27.117" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30077" PostTypeId="2" ParentId="30073" CreationDate="2016-04-12T19:01:59.103" Score="4" Body="&lt;p&gt;[EDIT: some code made available] A common framework for (multivariate) image processing is to suppose that its useful features (edges, textures, spectral correlation) contain  redundancy, while the noise is pretty uncorrelated. A major preprocessing task consists in decorrelating or compacting the image features prior to processing, hoping to separate them from unwanted noises better in some transformed domain, or by projection onto a set of vectors $v_i$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One holy grail in image $I$ decomposition is to find the best $M$-term approximation, so that a norm $\|I-\sum_1^M \lambda_i v_i\|$ is minimal, when $M$ is small with respect to the size of the image. Such a problem is generally very difficult. So many methods try to find the best $v_i$s or $\lambda_i$ (or both) under some assumptions, or using optimization methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two main types of linear transformations are usually considered:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;adaptive transformations, dependent on image characteristics&lt;/li&gt;&#xA;&lt;li&gt;fixed transformations, independent of images, but generally designed to capture features of image classes or models&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;SVD, PCA, Karhunen-Loève transformations belong to Type 1. Fourier, DCT and wavelets belong to Type 2. However, they are somehow related, and under some assumptions, Fourier derives from PCA, and DCT is a good approximation to Karhunen-Loève. They are all related to minimum squared norm formulations, provide &quot;orthogonal&quot; vectors $v_i$, and very often, one considers that the energy of the projection coefficients $\lambda_i$ onto the $v_i$s are good enough representations for practical purposes, less efficient than best $M$-terms, but easier to compute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the bigger the $\lambda_i^2$, the more it contributes to the energy of the image. Resultingly, as long as the vectors have the same norm, it is a good bet to select the most important projection coefficients $|\lambda_i$| (in magnitude), to provide a sparse representation of the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, depending on the direction (spatial, spectral), fixed and adapted transformations can be combined, such as PCA (or other learnt linear transformations) and wavelets. Three additional sources on multivariate denoising for you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1016/j.csda.2004.12.010&quot; rel=&quot;nofollow&quot;&gt;Multivariate denoising using wavelets and principal component analysis&lt;/a&gt;, 2006, Computational Statistics &amp;amp; Data Analysis&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/TSP.2008.921757&quot; rel=&quot;nofollow&quot;&gt;A Nonlinear Stein Based Estimator for Multichannel Image Denoising&lt;/a&gt;, 2008, IEEE Transactions on Image Processing (the decorrelating part is discrete, but dwells in Section III.B) [EDIT: Matlab code is now available in &lt;a href=&quot;http://fr.mathworks.com/matlabcentral/fileexchange/56705-m-band-2d-dual-tree--hilbert--wavelet-multicomponent-image-denoising&quot; rel=&quot;nofollow&quot;&gt;$M$-band 2D dual-tree (Hilbert) wavelet multicomponent image denoising]&#xA;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://dx.doi.org/10.1109/LGRS.2006.888109&quot; rel=&quot;nofollow&quot;&gt;Hyperspectral Image Compression Using JPEG2000 and Principal Component Analysis&lt;/a&gt;, 2007, IEEE Geosciences Remote Sensing Letters&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-04-25T08:01:36.483" LastActivityDate="2016-04-25T08:01:36.483" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="30081" PostTypeId="1" CreationDate="2016-04-13T02:39:00.880" Score="0" ViewCount="505" Body="&lt;p&gt;I am new to signal processing world.  I am working on a project where we have to find change points using spectral densities.  I am running some simulations where in I created a wave which is a linear combination of a few sinusoidals of frequency ranges (3.5-7.5, 7.5-9, 9-12, 12-14).  I find the periodogram of these sinusoidals using the usual formula which goes from 0 to pi.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is, I will be able to observe peaks in the periodograms which corresponds to the frequencies of the signal.  But since the x axis in a periodogram ranges only from -pi to pi, how can I compare my input frequencies and the frequencies I got in periodogram?&lt;/p&gt;&#xA;" OwnerUserId="19824" LastActivityDate="2016-04-13T13:11:36.387" Title="Periodogram frequencies not matching with signals" Tags="|signal-analysis|power-spectral-density|time-series|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30084" PostTypeId="2" ParentId="23409" CreationDate="2016-04-13T10:02:10.277" Score="0" Body="&lt;p&gt;In the paper 4-(8-) refers to the 4 and 8 neighbor connectivity between the two pixels and in the algorithm NBD is the newest border found during the raster scan of the binary image and LNBD refers to the last newest border, NBD and LNBD is stored to obtain the surroundness relation between the borders.  &lt;/p&gt;&#xA;" OwnerUserId="20524" LastActivityDate="2016-04-13T10:02:10.277" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30085" PostTypeId="1" CreationDate="2016-04-13T10:04:54.437" Score="1" ViewCount="129" Body="&lt;p&gt;So I am working on a project where I have to model a communication system in MATLAB, then implement it on an FBGA.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My transmitter goes something like that: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;M        = 4;   N = 1000;&#xA;Symb     = randi([0,M-1],N,1);&#xA;Mod_Symb = qammod(Symb,M);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, as you can see the output is complex consisting of four possibilities [+1+1i, +1-1i, -1+1i, -1-1i].  The question is (which I don't know after 4 years mobile com. school!) how do I go from those complex representations to a real time system? I mean, when I want to feed my antenna amplitude data, how do I do that? &lt;/p&gt;&#xA;" OwnerUserId="20094" LastActivityDate="2017-11-27T05:08:39.203" Title="How can I realize a complex communication system in a real time application?" Tags="|signal-synthesis|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30086" PostTypeId="2" ParentId="29974" CreationDate="2016-04-13T11:48:10.010" Score="4" Body="&lt;p&gt;I have too few points for to comment so I try give you at least a partial answer.&lt;/p&gt;&#xA;&lt;p&gt;You can't change those b coefficients using equal multiplier with a's.&#xA;As those final coefficients comes from transformation there might be some ratios you loose in that process. In my MZT based example below, you get the final coefficients from equations&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;b1 = -(pole1 + pole2)&#xA;b2 = pole1 * pole2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So, you can't restore the original ratio from b1 nor from b2 --&amp;gt; remember also that when swap the a's and b's to get pre-emphasis filter from de-emphasis filter (or vice versa) you need to do it using those coefficients having a0 and b0 = 1.0 (i.e. not tose normalized to have 0dB at 1kHz).&lt;/p&gt;&#xA;&lt;p&gt;So, I would suggest you to manipulate coefficients before transformation. You'll find needed coefficients for that filter mentioned in your post &lt;a href=&quot;https://www.dsprelated.com/showthread/comp.dsp/73300-3.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;here from&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here's an example based on MZT transfer (you'll find the missing info through my posts here).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pole1 = 0.99289462847423215&#xA;pole2 = 0.73908439754585875&#xA;zero1 = 0.93117565229670540&#xA;zero2 = 0.0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To get flat response in range 20Hz-20kHz you decrease the value of pole1 to around 0.93289462847523175 and pole2 to 0.0. In this example zero1 and zero2 remains untouched.&#xA;Note: These are not exact values especially for those coefficients from my nor Orban's posts but you get the idea.&lt;/p&gt;&#xA;&lt;p&gt;Juha&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Here's Octave code to demonstrate post:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pkg load signal;&#xA;pkg load control;&#xA;&#xA;%clear all;&#xA;%clf;&#xA;&#xA;Fs = 44100;&#xA;minF=20;&#xA;maxF=20000; %Fs/2;&#xA;sweepF=logspace(log10(minF), log10(maxF),1024);&#xA;&#xA;%% poles for RIAA de-emphasis filter @ 44100&#xA;p1 = 0.992894628474;&#xA;p2 = 0.739084397546;&#xA;z1 = 0.931175652297;&#xA;z2 = 0;&#xA;&#xA;%% --------------------------------------------------&#xA;RIAApercent = 100                  %% 100 = RIAA, 0 = ~FLAT&#xA;%% --------------------------------------------------&#xA;RIAApercent = (100-RIAApercent)/100;&#xA;k1 = RIAApercent * -0.061718976177;&#xA;k2 = RIAApercent * -0.739084397546;&#xA;&#xA;p1 = p1 + k1;&#xA;p2 = p2 + k2;&#xA;&#xA;b(1) = 1.0&#xA;b(2) = -(p1 + p2)&#xA;b(3) = p1 * p2&#xA;&#xA;a(1)= 1.0&#xA;a(2)= -(z1 + z2)&#xA;a(3)= z1 * z2&#xA;&#xA;%% normalize 0dB @ 1kHz&#xA;w = 2.0*pi*(1000/Fs);&#xA;num = b(1)*b(1)+b(2)*b(2)+b(3)*b(3)+2.0*(b(1)*b(2)+b(2)*b(3))*cos(w)+2.0*b(1)*b(3)*cos(2.0*w);&#xA;den = 1.0+a(2)*a(2)+a(3)*a(3)+2.0*(a(2)+a(2)*a(3))*cos(w)+2.0*a(3)*cos(2.0*w);&#xA;G = sqrt(num/den);&#xA;b(1) = b(1)/G;&#xA;b(2) = b(2)/G;&#xA;b(3) = b(3)/G;&#xA;&#xA;%% plot&#xA;hold on;&#xA;[h, w] = freqz(a,b, sweepF, Fs);&#xA;semilogx(w, 20*log10(h));&#xA;grid on;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;results:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p6pJl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p6pJl.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Reverse the curve by swapping &lt;em&gt;b&lt;/em&gt; and &lt;em&gt;a&lt;/em&gt; coefficients:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M5evP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M5evP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19991" LastEditorUserId="19991" LastEditDate="2023-02-14T21:07:02.403" LastActivityDate="2023-02-14T21:07:02.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30087" PostTypeId="2" ParentId="30069" CreationDate="2016-04-13T12:17:29.560" Score="2" Body="&lt;p&gt;You could try an approach that is inspired by a Lock-In-amplifier:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Assumptions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have the correct frequency of the sine wave. I assume that you do also have the initial phase; therefore I will assume that without loss of generality this initial phase is 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Calculation of the amplitude, version 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiply your signal by $\sin(2\pi\,ft)$ for a reasonable time, e.g. one period $T$ of your sine. The frequency $f = \frac{1}{T}$. Both is therefore known from your first analysis step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since your signal is $A\sin(2\pi\,ft) + N$, where N is the noise, you'll end up with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \int_0^T (A \sin(2 \pi \, f t)^2 + N \sin(2 \pi\, f t)) \textrm{d}t = \frac{4 \pi A f T - A \sin(4 \pi \, f T) + 8 N \sin(\pi \, f T)^2}{8 \pi f}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sines in the result will be $0$, since $\sin(n\pi) = 0$ for integer values of $n$, and $fT = 1$. Hence, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \int_0^T (A \sin(2 \pi \, f t)^2 + N \sin(2 \pi\, f t)) \textrm{d}t = \frac{4 \pi A f T}{8 \pi f} = \frac{AT}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be solved for $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use multiple periods, i.e. an integration time $KT$ with an integer K, you would end up with $\frac{AKT}{2}$. Since each half-period constitutes a kind of averaging in this approach, and you do not integrate, but sum up the values in your discrete case, your results should become better when you take multiple periods into account. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Calculation of the amplitude, version 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is basically the same idea, but in another form. $X = \sin(2\pi\, ft)$ is a matrix with only one column, that holds the pure sine with the known frequency. $\vec{y}$ is your noisy measurement as a column vector. With the linear approach $XA + \vec{N} = \vec{y}$, you could estimate the amplitude $A$ in a linear least squares sense:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A = \frac{1}{X^TX}X^T\vec{y}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since $X$ is a one-column matrix, it essentially behaves like a vector. Hence, this equation simply is $A = \frac{&amp;lt;X,\vec{y}&amp;gt;}{&amp;lt;X,X&amp;gt;}$, where $&amp;lt;\cdot,\cdot&amp;gt;$ denotes the scalar product.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastEditorUserId="19501" LastEditDate="2016-04-13T17:22:00.153" LastActivityDate="2016-04-13T17:22:00.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30088" PostTypeId="1" AcceptedAnswerId="30110" CreationDate="2016-04-13T12:58:42.140" Score="1" ViewCount="1746" Body="&lt;p&gt;I am creating a spectrum analyser to visualize some stereo audio data in real time. I want to display a single spectrum for the input and a single spectrum for the output. The stereo data is the usual two channels: left (L) and right (R).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am combining them into a single channel by taking the FFT of L + R. Is this conventional or would it be more appropriate to combine FFT(L) + FFT(R) rather than use FFT(L + R).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also if I encode the left and right channels as mid (M) and side (S) do some processing on each of M and S and convert back to L and R then I observe the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the side channel is modified, then taking FFT(L + R) shows no visible difference between the input and output (because L + R is pretty much the mid channel without side) so the question is: is there a way to combine the mid and side channels together so that taking the FFT of them gives a good representation of the sound. Or should I be doing FFT(L) + FFT(R) for both L/R and M/S processing modes? I would rather not have to do two FFTs if one would suffice.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastActivityDate="2016-04-14T08:16:27.167" Title="Combining channels into single FFT left/right vs mid/side" Tags="|fft|audio|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30089" PostTypeId="2" ParentId="30081" CreationDate="2016-04-13T13:11:36.387" Score="1" Body="&lt;p&gt;The output you get from the periodogram are the power spectral density for the angular frequencies W in the range from 0 to pi. With the sampling rate Fs you can compute the frequencies f from W with: f = W * Fs / (2pi).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware that you can only display frequencies from 0 to Fs/2 due to the Nyquist criterium which states that you need at least two points of a signal to be able to detect it.&lt;/p&gt;&#xA;" OwnerUserId="20508" LastActivityDate="2016-04-13T13:11:36.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30090" PostTypeId="2" ParentId="30085" CreationDate="2016-04-13T13:50:20.877" Score="1" Body="&lt;p&gt;The output of &lt;code&gt;qammod&lt;/code&gt; in your program is a sequence of amplitudes. If $a_k$ is the real part of the sequence, and $b_k$ the imaginary part, then the QAM baseband signal is: &#xA;\begin{align*}&#xA;s_{BB}(t)&amp;amp;=\sum_k a_k p(t-kT_p) + j\sum b_k p(t-kT_p) \\&#xA;&amp;amp;= A(t) + jB(t).&#xA;\end{align*} In this equation, $T_p$ is the pulse (baud) rate, and $p(t)$ is the pulse shape.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to convert this to a real, physical passband signal with carrier frequency $f_c$, you upconvert the baseband signal to frequency $f_c$: $$s_{PB}(t)=\text{Re}(s_{BB}(t)e^{j2\pi f_ct}).$$ While the previous equation is mathematically nice, in practice this is implemented as: $$s_{PB}(t)=A(t)\cos(2\pi f_ct)+B(t)\sin(2\pi f_ct)$$ with possible scale factors to keep the signal energy constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have $s_{PB}(t)$, all that remains is amplify it, possibly bandpass filter it to eliminate out-of-band emissions, and connect an antenna.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that Matlab works in the discrete-time domain and the signals I've described are continuous time. At some point in your system, you will need to do a digital to analog conversion. Exactly where that will happen depends on many factors. I recommend that you take a look at some common RF architectures, such as heterodyne, homodyne, zero-IF and so on. They can give you ideas on how to implement the analog part of your system. One good reference is &quot;RF System Design of Transceivers for Wireless Communications&quot; by Q. Gu. Another very good book is Steven Tretter's &quot;Communication System Design Using DSP Algorithms: With Laboratory Experiments&quot;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-04-13T13:50:20.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30091" PostTypeId="2" ParentId="30069" CreationDate="2016-04-13T14:19:26.437" Score="1" Body="&lt;p&gt;Use a flat top window and then perform an fft to obtain the peak and its gain, which will be the maximum of the two bins covering the signal.&lt;/p&gt;&#xA;" OwnerDisplayName="user7488" LastActivityDate="2016-04-13T14:19:26.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30092" PostTypeId="2" ParentId="30088" CreationDate="2016-04-13T15:46:14.903" Score="1" Body="&lt;p&gt;Whether FFT(L+R) will work depends on how the stereo recording was mic'd and mixed.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If just 2 separated stereo microphones were used to record a group of spatially separated sound sources (say an orchestra), then there will be location and frequency dependent phase differences between the 2 channels than could cause cancellations or nulls in a simple (L+R) mono mix.  If a lot of individually mic'd tracks were mixed down into 2 channels, this might be less of a problem.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-13T15:46:14.903" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30093" PostTypeId="1" CreationDate="2016-04-13T15:56:02.567" Score="2" ViewCount="502" Body="&lt;p&gt;I am studying some code for smoothed Wigner-Ville distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;update 3- solution, graph was over amplified in a 2d overdrive/oversaturation effect. if i divide by 20 only a line is visible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update - indeed there is a bug, the current image is from 128 samples of a $44.1\textrm{ kHz}$ signal where &lt;code&gt;sample[i] = sin[i/10.0]&lt;/code&gt;; i.e. a $4410 \textrm{ Hz}$ sine wave, to fit inside the 128 samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As suggested by JazzManiac, &lt;a href=&quot;https://dl.dropboxusercontent.com/u/114667999/cohens1024ok.c&quot; rel=&quot;nofollow noreferrer&quot;&gt;here is the code which is causing errors,&lt;/a&gt; it's actually P Kootsookos Cohens.C code, with a minor change, instead of a .raw input audio TFD file i am using a sine wave array in &lt;code&gt;get_my_signal&lt;/code&gt; function... A trivial and simple patch, wouldnt you agree? that can't be the error?!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a professional C programmer who has been coding for 30 years who provided this version of the code, it's just setting the &lt;code&gt;argc&lt;/code&gt; and &lt;code&gt;argv&lt;/code&gt; options in advance, to &lt;code&gt;spwvd&lt;/code&gt;, &lt;code&gt;hamming&lt;/code&gt;, and default window (was 128, is now 1024).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is smoothed Wigner-Ville the same as smoothed pseudo Wigner-Ville?...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/STz7m.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/STz7m.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The original author (i.e. me) gets this for each of the three test cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0CiZH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0CiZH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12103" LastEditorUserId="12103" LastEditDate="2016-04-14T18:22:42.880" LastActivityDate="2016-04-14T19:39:53.660" Title="Is this graph of Wigner-Ville distribution OK?" Tags="|fft|algorithms|time-frequency|" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="30094" PostTypeId="2" ParentId="30039" CreationDate="2016-04-13T15:59:35.363" Score="0" Body="&lt;p&gt;@Peter&#xA;I have trief to implement your code in MATLAB, but the output is not same as yours. Can you please suggest why is it so?&#xA;Second thing I want to know is why you used difference data?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;data_before_diff &amp;lt;- noiseless_data + rnorm(length(noiseless_data),0,sigma)&#xA;data &amp;lt;- diff(data_before_diff)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RSfQL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RSfQL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;    MATLAB CODE&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N=30;&#xA;&#xA;mu1=0;&#xA;mu2=1;&#xA;noiseless_data=[mu1*ones(mu1,N), mu1:1/N:mu2, mu2*ones(1,4*N), mu2:-1/N:mu1, mu1*ones(1,N)];&#xA;&#xA;sigma=0.01;&#xA;data=noiseless_data+ rand(1,length(noiseless_data));&#xA;&#xA;thresh=100;&#xA;&#xA;breaks=zeros(1,N);&#xA;&#xA;num_breaks=0;&#xA;&#xA;s= zeros(1,length(data));&#xA;&#xA;capS=zeros(1,length(data));&#xA;&#xA;G=zeros(1,length(data));&#xA;for k =1:length(data)&#xA;    s(1,k) = (mu2 - mu1)/sigma*(data(1,k) - (mu2+mu1)/2);&#xA;    if (k==1)&#xA;      capS(1,k) = s(1,k);&#xA;&#xA;    else&#xA;&#xA;        capS(k) = capS(k-1) + s(k);&#xA;&#xA;    end&#xA;    G(k) = max(0,capS(k) - min( capS(1:k)));&#xA;&#xA;    if (abs(G(k)) &amp;gt; thresh)&#xA;&#xA;%         capS(k)= 0&#xA;        num_breaks=num_breaks + 1;&#xA;        breaks(num_breaks) = find(min(capS(1:k)));&#xA;        tmp = mu1;&#xA;        mu1 = mu2;&#xA;        mu2 = tmp;&#xA;    end&#xA;end&#xA;&#xA;&#xA;first_break = min(breaks(1:num_breaks));&#xA;last_break = max(breaks(1:num_breaks));&#xA;&#xA;plot(data,'r')&#xA;hold on&#xA;plot(noiseless_data)&#xA;line([first_break first_break],[0,1],'LineWidth',4,'Color','b')&#xA;line([last_break last_break],[0,1],'LineWidth',4,'Color','b')&#xA;hold off&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16293" LastActivityDate="2016-04-13T15:59:35.363" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30101" PostTypeId="1" AcceptedAnswerId="30107" CreationDate="2016-04-13T22:07:08.600" Score="-1" ViewCount="236" Body="&lt;p&gt;We were given the above systems and we were asked to tell whether they are linear (or not) and time invariant(or not).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$y(m,n)=x(m,n)+c,\quad c&amp;gt;0$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$ y(m,n)=x(m,n)+x(m,-n)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$y(m,n)=x(m,n+m)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;$y(m,n)=x(m,n) + y(m-a,n-b)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Although I know the theory for the signal to be linear and time invariant I have trouble applying it. Can  any of you explain one of the above so I can continue on my own for the rest of them? &#xA;Thank you in advance&lt;/p&gt;&#xA;" OwnerUserId="20522" LastEditorUserId="20522" LastEditDate="2016-04-14T00:03:47.137" LastActivityDate="2016-04-14T06:00:40.717" Title="Are these Linear and Time Invariant Systems?" Tags="|linear-systems|homework|theory|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30102" PostTypeId="1" CreationDate="2016-04-14T00:30:50.170" Score="0" ViewCount="244" Body="&lt;p&gt;I have generated 16 chirps in experimental study:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K8SjX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K8SjX.jpg&quot; alt=&quot;Time domain data&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the signal was picked up by some electronic sensor, and then I have calculated the spectrum of the received signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LpIws.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LpIws.jpg&quot; alt=&quot;spectrum of signal&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following that I have calculated the cross spectrum density between the sound emitter and receiver and did some post processing, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x=voltage1(:,2);    &#xA;y1=vertgeo1(:,2);&#xA;&#xA;Fs=1000;&#xA;window=hamming(512);&#xA;noverlap=512/2&#xA;nfft=512;Fs=1000;&#xA;&#xA;[Pxy1,f]=cpsd(x,y1,window,noverlap,nfft,Fs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From this code the number of the points that shows the frequency resolution, essentially the number of the point that &lt;code&gt;f&lt;/code&gt; contains is $1\times 256$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know how I can increase this to $1025$ points. &lt;/p&gt;&#xA;" OwnerUserId="20184" LastEditorUserId="26389" LastEditDate="2019-04-26T18:48:23.463" LastActivityDate="2019-04-26T18:48:23.463" Title="Zero-pad to chirp signal" Tags="|matlab|chirp|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30103" PostTypeId="1" CreationDate="2016-04-14T01:40:51.937" Score="2" ViewCount="384" Body="&lt;p&gt;I'm new to Kalman filters and estimation in general. I'm running a simple test of an EKF to check my understanding, but I'm getting some odd results with a particular case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a state vector:&#xA;$$ \textbf{x} = &#xA;\left(\begin{matrix}&#xA;p_x \\&#xA;p_y \\&#xA;p_z \\&#xA;\end{matrix}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a sensor that measures these values directly, i.e.:&#xA;$$ \textbf{z} = &#xA;\left(\begin{matrix}&#xA;p_x \\&#xA;p_y \\&#xA;p_z \\&#xA;\end{matrix}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I get a converging solution. However, if I decide that my sensor actually measures the square of each value, i.e.&#xA;$$ \textbf{z} = &#xA;\left(\begin{matrix}&#xA;p_x^2 \\&#xA;p_y^2 \\&#xA;p_z^2 \\&#xA;\end{matrix}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then following the process on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Extended_Kalman_filter&quot; rel=&quot;nofollow&quot;&gt;EKF wiki page&lt;/a&gt; causes my solution to diverge very rapidly. This seems to be irrespective of the dynamic model of the system, but entirely dependent on whether what the sensor is measuring is linear. Is there a standard approach to follow in this situation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: Turns out it was a silly mistake on my part. I just implemented the filter incorrectly. The EKF was valid in this case.&lt;/p&gt;&#xA;" OwnerUserId="20536" LastEditorUserId="128" LastEditDate="2020-04-08T08:23:49.740" LastActivityDate="2020-04-08T08:23:49.740" Title="Kalman Filter - Non Linear Measurement Model" Tags="|filters|kalman-filters|estimation|bayesian-estimation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="30104" PostTypeId="1" CreationDate="2016-04-14T02:17:34.463" Score="1" ViewCount="205" Body="&lt;p&gt;I'm looking for a source of very low-noise audio data for use in benchmarking various methods of random noise correction methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My intention is to have a very clean signal to which I can add known random noise such that I can test the efficacy of various methods of dealing with that noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would need to be in some lossless format (preferably .wav).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have suggestions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="20537" LastActivityDate="2016-06-17T05:33:50.307" Title="Looking for low-noise audio data to benchmark some noise-processing techniques" Tags="|filters|audio|noise|data-request|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30105" PostTypeId="1" AcceptedAnswerId="30115" CreationDate="2016-04-14T05:10:49.743" Score="0" ViewCount="968" Body="&lt;p&gt;I have been asked to calculate the power of a speech signal given by the following:&#xA;$$\ p(x)= \left(\frac a2\right)e^{-a\mid x \mid}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the formula for the power of a signal to be the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{T}\int_\frac{-T}{2}^\frac{T}{2}p(x)^2dx$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only this is not a periodic signal so I don't know where to set the upper and lower limits. I have tried taking the Fourier transform and evaluating but that gives me $\ P(f) = \frac{a^2}{a^2+2\pi f^2} $. If anyone would be able to guide me through a solution to this I'd really appreciate it. Simon.&lt;/p&gt;&#xA;" OwnerUserId="18974" LastEditorUserId="1629" LastEditDate="2016-04-14T07:09:33.803" LastActivityDate="2016-04-14T10:35:36.797" Title="Power of a speech signal" Tags="|signal-analysis|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30106" PostTypeId="2" ParentId="30105" CreationDate="2016-04-14T05:59:07.427" Score="0" Body="&lt;p&gt;for negative 'a' you can limit the integration up-to the 5-6 times of time constant of the dying exponential(as per your equation). this will give you the power approximately equal to actual.&#xA;The time constant of dying exponential is given by 1/abs(a). more details could be checked at &lt;a href=&quot;https://en.wikipedia.org/wiki/Exponential_decay&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Exponential_decay&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-04-14T05:59:07.427" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30107" PostTypeId="2" ParentId="30101" CreationDate="2016-04-14T06:00:40.717" Score="0" Body="&lt;p&gt;Well, the system described in problem 1 is non-linear and time invariant. A linear system cannot have a constant term(or a term independent of input/output).&#xA;Here is the proof of it's non-linearity: &#xA;Let y1 and x1 be a set of the o/p and i/p respectively &#xA;y1(m,n)=x1(m,n)+c&#xA;Similarly, let y2 and x2 be another such set&#xA;y2(m,n)=x2(m,n)+c&#xA;Now, let x(m,n)=x1(m,n)+x2(m,n)......(1)&#xA;For the system to be linear, when x(m,n)[which is a sum of two signals] is given as input, the output should be a sum of the individual outputs. Let's check:&#xA;y(m,n)=x(m,n)+c&#xA;from (1), we can write&#xA;y(m,n)=x1(m,n)+x2(m,n)+c which is not equal to y1(m,n)+y2(m,n). Hence proved.&#xA;The time invariance property is quite straight forward to prove.&lt;/p&gt;&#xA;" OwnerUserId="20211" LastActivityDate="2016-04-14T06:00:40.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30108" PostTypeId="1" AcceptedAnswerId="30113" CreationDate="2016-04-14T06:24:37.540" Score="2" ViewCount="165" Body="&lt;p&gt;I am trying to understand the signal formation in MRI and have a confusion. I understand that in the presence of the external magnetic field $B0$, the protons are precessing at the frequency given by the Larmor equation i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\omega = \gamma B_0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we apply an RF pulse and tip the magnetisation vector to $xy$ plane, it induces a voltage in the receiver coil and that is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;v \approx \Sigma \ M_{xy} e ^{i \phi_j(t)} \Delta v_j&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This voltage induced is the contribution frm all particles in the receiver coil listening area. $M_{xy}$ is the magnetization vector and $\Delta v_j$ is the volume of the particle and $\phi_j$ is the phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am having trouble understanding how the phase comes into picture here in contributing to the MRI signal. Also, why is the volume of the particle also considered? &lt;/p&gt;&#xA;" OwnerUserId="13347" LastActivityDate="2016-04-14T09:03:37.280" Title="The signal in MRI" Tags="|signal-analysis|fourier-transform|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30109" PostTypeId="1" CreationDate="2016-04-14T06:49:10.743" Score="1" ViewCount="1560" Body="&lt;p&gt;Till now I know that- first the speech is converted frames and feature vectors are calculated for each frame using MFCC. And while training the Acoustic model- HMM model is generate for each phoneme and each such HMM model has 3 states representing starting, middle and ending of context dependent phonemes. Also each of these states gives the likelihood probability for a given observation sequence using GMM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is this observation sequence taken in GMM, is it the feature vector of a single MFCC frame or a sequence of MFCC frames ? If not then what exactly are these observation sequences and how are they related to MFCC feature vectors.&lt;/p&gt;&#xA;" OwnerUserId="20539" LastActivityDate="2016-04-14T06:49:10.743" Title="What does the output of Gaussian Mixture Model (GMM) represents in a HMM-GMM based speech recognition application?" Tags="|gaussian|speech-recognition|mfcc|hmm|" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30110" PostTypeId="2" ParentId="30088" CreationDate="2016-04-14T08:16:27.167" Score="1" Body="&lt;p&gt;If I get you correctly, your first question is: What is more appropriate, taking the &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;DFT&lt;/a&gt; (via the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow&quot;&gt;FFT&lt;/a&gt; algorithm) of the sum,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{DFT}\left\{l + r\right\},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or summing the DFTs&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{DFT}\left\{l\right\} + \text{DFT}\left\{r\right\}?&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the linearity of the DFT (and, hence, the FFT) they are the same&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\text{DFT}\left\{l + r\right\} = \text{DFT}\left\{l\right\} + \text{DFT}\left\{r\right\}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, summing $l + r$ in the time domain will lead to lower computational requirements than taking two DFTs and then summing, of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second topic concerns mid/side encoding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sum signal, $l + r$, does not change when you modify the side information. Let's check the equalities for mid ($m$) and side ($s$) signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;m &amp;amp; = &amp;amp; \frac{l+r}{2}\\&#xA;s &amp;amp;=&amp;amp; \frac{l-r}{2}.&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You already mentioned, that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;L + R is pretty much the mid channel without side&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In fact, it is &lt;em&gt;exactly&lt;/em&gt; the mid signal (up to a scaling factor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;mid&lt;/em&gt; signal contains everything that is identical in both channels - the &lt;em&gt;side&lt;/em&gt; signal contains everything that has a $180°$ phase shift between both channels. All modifications that are done to the side signal cancel out completely when summing up both channels. I'll detail this a little bit in the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You know that the left ($l$) and right ($r$) signals are obtained from the m/s representation as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;l &amp;amp; = &amp;amp; m + s\\&#xA; &amp;amp; = &amp;amp; \frac{l+r}{2} + \frac{l-r}{2}\\&#xA; &amp;amp; = &amp;amp; l&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;r = m-s.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computing $l + r$ simply cancels out the side signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{eqnarray}&#xA;l + r &amp;amp; = &amp;amp; \left(m+s\right) + \left(m-s\right)\\&#xA; &amp;amp; = &amp;amp; 2\cdot m&#xA;\end{eqnarray}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary: If you want a proper representation of what happened to the m/s signals summing the channels will probably not work. However, you will have to decide what a &lt;em&gt;good representation&lt;/em&gt; is for your application.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2016-04-14T08:16:27.167" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30111" PostTypeId="1" CreationDate="2016-04-14T08:42:16.963" Score="2" ViewCount="1858" Body="&lt;p&gt;I want to filter deviations from an ADC over time (low pass), not very critical. So I first tried exponential averaging, something like  y= (7*y+x)/8. That gave useful results, but there is an obvious rounding issue (no increase as long as x smaller than y+8, decrease if x smaller than y). Adding +4 doesn't really solve the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I implemented a fixed-point lowpass Butterworth third order filter, with various cutoff frequencies, based on coefficients extracted from &lt;a href=&quot;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&quot; rel=&quot;nofollow&quot;&gt;http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html&lt;/a&gt; (unfortunately down since a few months).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code looks as follows for 0.033 sampling cutoff&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;byte dtTI[4], // filter input (0 newest)&#xA; dtTIFast[8]; // filter output, [0]=y, [1]=8 bit decimals&#xA;// dtTIFast[2,4,6]= previous filter outputs&#xA;dtTIFast[7]=dtTIFast[5]; dtTIFast[5]=dtTIFast[3]; dtTIFast[3]=dtTIFast[1];&#xA;dtTIFast[6]=dtTIFast[4]; dtTIFast[4]=dtTIFast[2]; dtTIFast[2]=dtTIFast[0];&#xA;unsigned long modifier = 30UL*64*(dtTI[0] + dtTI[3] + 3*dtTI[1] + 3*dtTI[2]);&#xA;modifier += 84739UL*(dtTIFast[3]/4+64*dtTIFast[2]); &#xA;modifier -= 73839UL*(dtTIFast[5]/4+64*dtTIFast[4]); &#xA;modifier += 21628UL*(dtTIFast[7]/4+64*dtTIFast[6]); &#xA;dtTIFast[0]=modifier&amp;gt;&amp;gt;21;  dtTIFast[1]=modifier&amp;gt;&amp;gt;13;  // No need to add 2^12, 0.0004deg&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output seemed to give correct results at first, but if I iterate the filter 50 times with the same input(s), I see it keeps oscillating instead of converging to a steady value, and not centered around the x input. For other values (for example 0.001 cutoff), its way worse !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you tell me where I'm wrong ? I checked that the sum of my coefficient is 32768, and it looks like there can't be any overflow. I use 14bits y values now, and the real values of coeffs are 2.586028659, -2.253398256 0.660048953 and 0,000915081. Should I need more precision ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your help&lt;/p&gt;&#xA;" OwnerUserId="20540" LastEditorUserId="20540" LastEditDate="2016-06-09T15:20:49.130" LastActivityDate="2016-06-09T15:20:49.130" Title="Simple (Arduino) digital butterworth filter : why do I see oscillations?" Tags="|digital|fixed-point|butterworth|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="30112" PostTypeId="1" CreationDate="2016-04-14T08:48:12.690" Score="-1" ViewCount="2101" Body="&lt;p&gt;I am totally new in Matlab. Can anyone please explain in details how I can extract pitch contour of a speech? I would like to observe how the speaker's pitch varies during his speech to know whether he is speaking in a flat tone.&lt;/p&gt;&#xA;" OwnerUserId="8581" LastActivityDate="2016-04-20T21:46:48.657" Title="how to extract pitch contour of a speech by matlab?" Tags="|matlab|speech-processing|pitch|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30113" PostTypeId="2" ParentId="30108" CreationDate="2016-04-14T09:03:37.280" Score="2" Body="&lt;p&gt;&lt;strong&gt;General information&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MRI (Magnetic Resonance Imaging), you manipulate protons to get a signal. This is, of course, a quantum mechanical process - luckily it is possible to describe the process in a semi-classical way as you did. In this case, you do not consider individual protons, but small volume elements (voxels). In those voxels, there are enough proton spins to average over, which will give you the &lt;em&gt;magnetization vector&lt;/em&gt; of this voxel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If left alone in the external magnetic field $B_0$, this vector will grow along the field and reach a certain &quot;lengths&quot;, i.e. a certain &quot;amout&quot; of magnetization that does depend on the strength of the external field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If an external RF field is applied for excitation, this vector is deflected towards the transverse plane. Since there is a precession around the external field $B_0$, this vector will spin with the frequency equal to the Larmor-frequency. It is therefore convenient to transform the coordinate system so that it also rotates with this frequency. The result is a magnetization vector that - under perfect conditions - would not precess anymore in this rotating coordinate system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On what you have asked&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the vector is in the transverse plane, there may be several reasons for it to have a phase. A phase in this case could mean an angle between the $x$-axis of the rotating coordinate system and the magnetization vector. This additional phase can be caused by several things, e.g.:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The exciting RF pulses phase. The irradiated RF pulse does also have a phase This is the angle between the $x$-axis of the rotating coordinate system and the magnetic component of the RF-pulse (called the $B_1$ field. This RF phase is important for several imaging sequences. For example in a spoiled gradient-echo sequence (common acronyms: FLASH, FFE), the RF phase is key to achieve good spoiling properties. The reason for this is that transverse magnetization cannot be &quot;destroyed&quot;, what would be the ideal thing to happen in these sequences. Hence, there always is a little transverse magnetization that could spill over into the next data acquisition. By choosing an appropriate time-varying phase for each RF pulse, one can achieve that the remaining transverse magnetization does not add up coherently, and does therefore not build up a large, but unwanted signal. On the other hand, in a steady-state free precession sequence (acronyms fully-balanced SSFP (fbSSFP), TrueFISP, balanced FFE, or FIESTA) there is a certain 0°-180°-0°-180°-... pattern in the RF-pulses phase that ensures maximum coherent addition. For this reason, fbSSFP is the gradient-echo sequence with the highest signal in general. Note that the RF phase is &lt;em&gt;not&lt;/em&gt; to be confused with the tip angle. Under perfect conditions, the transverse magnetization vector will exhibit a phase in the rotating frame due to the RF pulse's phase. The phase of the magnetization vector after excitation is constant in time under ideal conditions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;External variances in the $B_0$ field. Due to tissue borders or technical imperfections, the main magnetic field $B_0$ may vary in the object under infestigation. Hence, the transverse magnetization vector experiences a different Larmor-frequency that the one in the rotating frame. This means, it is (slowly) precessing in the rotating frame. This is the reason why $\phi$ does depend on $t$ in your formula. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The volume itself is not of that high importance. I assume, the $v_j$ in your formula is a &quot;spin density&quot;, i.e. &quot;spins per volume&quot;. Of course, voxels exhibiting less protons and therefore less signal-baring spins will contribute less to the signal than areas with high spin density.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-04-14T09:03:37.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30114" PostTypeId="1" CreationDate="2016-04-14T10:05:53.847" Score="1" ViewCount="2059" Body="&lt;p&gt;Assume I have a signal that oscillates between 10KHz and 9Khz every 500msec (Change happens linearly, so at t=0, it is 10KHz and it goes to 9.5Kz at t=250msec and 9KHz at t=500msec and frequency start to increase and goes back to 10KHz at 1 sec and this goes on)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume I sample this signal at 50Khz and I do fft to find out what's the frequency. But due to sampling rate, I have to accumulate some samples where the interest frequency is slowly shifting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were to sample at 500KHz or even 5MHz, can I get a better SNR? (The assumption here is that I can sample for a shorter duration -still several cycles of the target frequency in time domain- and this will provide a less spread signal in a given time and better fft snr. )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My gut tells me, this won't help but I like to ask the crowd. &lt;/p&gt;&#xA;" OwnerUserId="831" LastActivityDate="2022-08-12T13:17:48.470" Title="Sampling Rate and SNR" Tags="|sampling|snr|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30115" PostTypeId="2" ParentId="30105" CreationDate="2016-04-14T10:35:36.797" Score="0" Body="&lt;p&gt;This looks like energy rather than power. The $p(x)$ looks like voltage at a given moment of time. You square it to get the power. You integrate the power to get the energy. You then divide total energy by total time to get the average power. Why periodicy? I would just&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_{avg} = {a\over 2T} \int_0^T{e^{-ax}dx}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Single period average should equal all time average, if it is truly average.&lt;/p&gt;&#xA;" OwnerUserId="19489" LastActivityDate="2016-04-14T10:35:36.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30116" PostTypeId="1" CreationDate="2016-04-14T12:02:51.977" Score="1" ViewCount="634" Body="&lt;p&gt;I'm working on generating noise signals $X(t)$ (with $t \in \left[0,T\right]$ with step size $\delta t$) with a prescribed power spectral density $S_{XX}(f)$ and I'm figuring out how well I am generating said noise; I need to know if it has the desired spectral density (in case someone notices, I posted about similar issues a while back. I've since then worked on a different topic and I am now returning to this).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, estimating the spectral density of a signal is a tedious process. It involves a lot of estimation through periodograms and window functions and such, and it is therefore not so easy to quantify numerically if the spectrum not only has the desired trends but actually implements the desired parameters (in practice I will simply use a spectrum analyzer, but that is a different story).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The auto covariance function $C_{XX}(t') = \left&amp;lt;X(t) X(t+t') \right&amp;gt;$ on the other hand is very easy to calculate and subsequently fit. Moreover, the auto covariance function and the spectral density are related by a Fourier transform: $C_{XX}(t') = \int_0^\infty{S_{XX}(f)\cos{2\pi f}}$ (note that I'm using the cosine transform as this is customary in these settings, due to the evenness of the spectral density). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, how much do I learn about the spectral density by fitting the auto covariance? Say I am working with the Ornstein Uhlenbeck process, which has auto covariance $C_{XX}(t') = \frac{c \tau}{2}e^{-t'/\tau}$ and spectral density $S_{XX}(f) = \frac{2 c \tau^2}{1+(2\pi f \tau)^2}$. If I fit my numerically generated $X(t)$ to $C_{XX}$ to extract $c$ and $\tau$ and am able to do so with high accuracy, do I then know that my spectral density is also as desired?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively I would say yes, Fourier pairs contain the exact same information. The reason I am not sure if this is the case is due to the fact that I am unsure of how sampling rates and such come into this. Of course one cannot expect a spectral density to be accurate up to the GHz range if one has an $X(t)$ point every millisecond. But is this equally true for the auto covariance? In other words, if my autocovariance is accurate up to some specific lag time (which means I have a high enough sampling rate I suppose), is the spectral density then also accurate up to some specific frequency? And can I quantify this in some way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean by that last sentence is, can I tell up to (or down to) what frequencies I can trust my spectral density, given my auto covariance fit, $T$ and $\delta t$?&lt;/p&gt;&#xA;" OwnerUserId="8593" LastActivityDate="2016-04-14T18:36:06.293" Title="Evaluating the spectral density of generated noise through the autocovariance" Tags="|power-spectral-density|autocorrelation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30117" PostTypeId="1" AcceptedAnswerId="30121" CreationDate="2016-04-14T12:07:27.513" Score="3" ViewCount="570" Body="&lt;p&gt;I'm implementing my first EKF and using a Taylor expansion to linearize the model. I'm somewhat new to this. Based on a paper I've read, I'm attempting to linearize the state transition matrix using a Taylor Expansion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AFAIU, given a state vector &lt;strong&gt;X&lt;/strong&gt; and state transition matrix &lt;strong&gt;F&lt;/strong&gt;, we can write a linearized state transition matrix &lt;strong&gt;Φ&lt;/strong&gt; (probably not the name) in the following manner:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\textbf{F} = \frac{\partial \dot{\textbf{X}}}{\partial \textbf{X}}&#xA;$$&#xA;$$&#xA;\Phi = \textbf{I} + \textbf{F}\Delta t + \textbf{F}^2 \frac{\Delta t^2}{2!} + H.O.T&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such that the state and covariance estimates are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{\textbf{X}}_k = \Phi \hat{\textbf{X}}_{k-1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\hat{\textbf{P}}_k = \Phi \hat{\textbf{P}}_{k-1} \Phi^T + \textbf{Q}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a 2nd order expansion instead of a 1st, I've found that I get a much more accurate solution. It also allows me to use a larger timestep (minutes instead of seconds). I worry though that in doing so, I'm not actually linearizing, since the 2nd order TSE corresponds to a quadratic approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the above steps are correct, is there anything wrong with taking the 2nd order TSE?&lt;/p&gt;&#xA;" OwnerUserId="20536" LastEditorUserId="80" LastEditDate="2016-04-14T16:01:23.313" LastActivityDate="2020-08-14T19:19:01.067" Title="Extended Kalman filter - why not use a 2nd order Taylor expansion?" Tags="|filters|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30119" PostTypeId="1" AcceptedAnswerId="30122" CreationDate="2016-04-14T15:04:27.883" Score="0" ViewCount="1580" Body="&lt;p&gt;I have noticed that some manufacturers of audio processing products label a 2nd order Butterworth low pass as having a slope of 12dB per octave, but then also label a 2nd order Butterworth band pass as having a slope of 12dB per octave. In actuality each side of a 2nd order Butterworth band pass has a slope of only 6dB per octave. Is there a convention that because it is symmetrical that the slope of each together constitute the &quot;slope&quot; or is it just that they are wrongly assuming that order is equivalent to slope for all the Butterworth filter types?&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="15030" LastEditDate="2016-04-14T16:05:08.303" LastActivityDate="2016-04-14T16:06:21.810" Title="Slope of 2nd order low pass vs band pass Butterworth filters" Tags="|filters|audio|lowpass-filter|bandpass|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30121" PostTypeId="2" ParentId="30117" CreationDate="2016-04-14T16:00:16.737" Score="4" Body="&lt;p&gt;There is nothing wrong with taking a higher order approximation than first order.&lt;/p&gt;&#xA;&lt;p&gt;An issue in doing so is that you no longer have Gaussian statistics, so some of the standard Kalman filter equations (which are derived using Gaussianity) no longer hold strictly true.&lt;/p&gt;&#xA;&lt;p&gt;The usual approach to dealing with (otherwise ignored) higher order terms in the standard EKF is to increase either the process noise or the measurement noise variances from what the model tells you they should be. This is like saying,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;I know what the noise power is, but I'm going to say the second and higher order terms in my Taylor series expansion add to it so I'm going to increase the noise variance I use in my filter to cater for it.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2020-08-14T19:19:01.067" LastActivityDate="2020-08-14T19:19:01.067" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30122" PostTypeId="2" ParentId="30119" CreationDate="2016-04-14T16:06:21.810" Score="1" Body="&lt;p&gt;By convention, the pole count refers to the number of poles in the design polynomial (Butterworth, Chebyshev, etc) and this defines the amount of roll off in the stop band. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we maintain this convention, then all filters roll off at the rate of 6 dB / octave / pole in the stop band, whether it is a low pass, high pass, band pass, or notch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, a nth order Elliptic has the same ultimate roll off rate in the stop band as a nth order Butterworth. Of course, the Elliptic's transition band will be much narrower.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/B1t9G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B1t9G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2016-04-14T16:06:21.810" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30123" PostTypeId="2" ParentId="30069" CreationDate="2016-04-14T16:10:25.463" Score="1" Body="&lt;p&gt;There is an IEEE Standard for Digitizing Waveform Recorders (IEEE Std 1057). It can be found under terms like three-, four- (or seven-)parameter sine fit, for instance:&#xA;$$y = a + b \sin(c+d x)$$&#xA;MatlabCentral offers a well-received tool for that: &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/41246-sine-function-fit&quot; rel=&quot;nofollow&quot;&gt;Four-Parameter Sinefit&lt;/a&gt;. You can use Fourier or PSD estimates to intialize such algorithms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Several additional works offer to estimates the bias and variance, for instance: &lt;a href=&quot;http://dx.doi.org/10.1016/j.measurement.2010.02.007&quot; rel=&quot;nofollow&quot;&gt;Amplitude estimation using IEEE-STD-1057 three-parameter sine wave fit: Statistical distribution, bias and variance&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be intersting as well to consider the effect of signal quantization $Q$, and estimate thee related uncertainty, see for instance &lt;a href=&quot;http://dx.doi.org/10.1109/IMTC.2006.328187&quot; rel=&quot;nofollow&quot;&gt;Uncertainty of the Estimates of Sine Wave Fitting of Digital Data in the Presence of Additive Noise&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-04-14T16:10:25.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30124" PostTypeId="1" CreationDate="2016-04-14T16:17:31.153" Score="1" ViewCount="262" Body="&lt;p&gt;I am trying to simulate the data transmission of a GPS satellite. Telecommunications is not my field so I am struggling a bit with some concepts. I managed to generate the Gold code of the GPS transmitter using shift registers. This creates a pseudorandom 1023-vector with [-1 1] values. Now I want to create a sampled version of this signal up to 5.714Hz assuming the clock of the codes work at 1.023 Mchip/s and then modulate this signal with a sinusoidal carrier of 4.309 MHz sampled at the same frequency. I am not sure how to sample the signal.&#xA;From what I've understood, I wrote something like this in Matlab but it's not right :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a = [1 1 1 1 1 1 1 1 1 1 ]&#xA;b = [1 1 1 1 1 1 1 1 1 1 ]&#xA;for k = 1: 1023&#xA;    A(k) = a(10) ;&#xA;    B(k) = mod(b(2)+b(6),2) ;  &#xA;    C_A(k) = mod(A(j)+B(j),2) ;&#xA;    Af = mod(a(3)+a(10),2) ;&#xA;    Bf = mod(b(2)+b(3)+b(6)+b(8)+b(9)+b(10),2) ;&#xA;% shifting&#xA;    sg_1 = [ Af a(1:n-1) ] ;&#xA;    sg_2 = [ Bf b(1:n-1) ] ;&#xA;end&#xA;code_vect = (C_A-0.5)*2 ;&#xA;% UP TO HERE IT'S OK, I GOT THE C/A CODE, how to modulate it?&#xA;code_vect = code_vect(index,:) % this is 1x1023 Gold code vector&#xA;sa_fq = 5.714e6     %sampling freq&#xA;ca_fq = 4.309e6     %carrier freq&#xA;cd_fq = 1.023e6   %code frequency (I am right?)&#xA;clk = 1.023e6   %clock rate&#xA;time = 1/sa_fq : 1/sa_fq :1023/sa_fq   %time vector&#xA;for i = 1:1023&#xA;%sampled signal, I'm sure this is wrong but don't know how to do it&#xA;code_vect_sa((ceil(sa_fq)*i)-(ceil(sa_fq)-1):(ceil(sa_fq)*i))=code_vect(i)*ones(1,ceil(sa_fq))&#xA;end&#xA;carr = cos(2*pi*(ca_fq+cd_fq)*time) %carrier&#xA;sig_mod = code_vect_sa*carr ; modulated signal &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can you guys give a hint on how to solve it. Thanks in advance &lt;/p&gt;&#xA;" OwnerUserId="15442" LastEditorUserId="15442" LastEditDate="2016-04-14T19:36:38.347" LastActivityDate="2018-03-29T06:51:05.077" Title="how to sample and modulate a gps gold code" Tags="|sampling|modulation|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30125" PostTypeId="2" ParentId="30114" CreationDate="2016-04-14T17:01:10.600" Score="3" Body="&lt;p&gt;Your instincts are right. You won't increase SNR by increasing sampling rate because you also have more noise samples. The overall signal energy and noise energy does not depend on sampling rate.&lt;/p&gt;&#xA;&lt;p&gt;But, I believe you are mixing up two problems. In your case the frequency is not constant, therefore Fourier based analysis yield less than optimal results. Your problem is in the signal itself, not the signal to noise ratio. You can have a look at the high-order ambiguity function (try &lt;a href=&quot;https://ieeexplore.ieee.org/document/1261326&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; or &lt;a href=&quot;https://ieeexplore.ieee.org/document/4545291&quot; rel=&quot;nofollow noreferrer&quot;&gt;that&lt;/a&gt;) or the Wigner-Ville transform. Those are more suitable for linearly changing frequency.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="7092" LastEditDate="2022-08-12T13:17:48.470" LastActivityDate="2022-08-12T13:17:48.470" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30126" PostTypeId="2" ParentId="30102" CreationDate="2016-04-14T17:33:36.860" Score="1" Body="&lt;p&gt;No you don't need to zero-pad each chirp. MATLAB's &lt;code&gt;cspd&lt;/code&gt; function divide the signal into segments of length &lt;code&gt;nfft&lt;/code&gt;. Would you want is to zero-pad each segment. Luckily for you, the &lt;code&gt;cspd&lt;/code&gt; function can do it for you. Take a look &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/cpsd.html?refresh=true&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If $\tt nfft$ is greater than the signal length, the data is zero-padded. If $\tt nfft$ is less than the signal length, the segment is wrapped so that the length is equal to $\tt nfft$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So what you should do is increase the value of &lt;code&gt;nfft&lt;/code&gt; from $512$ to $2048$.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="1629" LastEditDate="2016-06-14T01:00:15.690" LastActivityDate="2016-06-14T01:00:15.690" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30128" PostTypeId="2" ParentId="30093" CreationDate="2016-04-14T18:24:45.263" Score="1" Body="&lt;p&gt;The graph is over amplified. If the image in blue is divided by factor of 20, the transients vanish and only a line of the detected frequency is visible.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2016-04-14T18:24:45.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30129" PostTypeId="2" ParentId="30093" CreationDate="2016-04-14T18:29:19.623" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is smoothed Wigner-Ville the same as smoothed pseudo Wigner-Ville?...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Wigner-Ville is calculated using a window length that is the same as the signal length. The &lt;em&gt;pseudo&lt;/em&gt; Wigner-Ville is computed using a window length that is shorter than the signal length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, no, they are not the same as they are smoothing two different things.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-14T19:39:53.660" LastActivityDate="2016-04-14T19:39:53.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30130" PostTypeId="2" ParentId="30116" CreationDate="2016-04-14T18:36:06.293" Score="2" Body="&lt;p&gt;The autocovariance and spectral density are Fourier transform pairs. Therefore, the autocovariance function and spectral density are equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look to the definitions and examples for white noise in this &lt;a href=&quot;http://www.stat.berkeley.edu/~bartlett/courses/153-fall2010/lectures/16.pdf&quot; rel=&quot;nofollow&quot;&gt;presentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-04-14T18:36:06.293" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30131" PostTypeId="2" ParentId="30124" CreationDate="2016-04-14T18:56:25.013" Score="1" Body="&lt;p&gt;Have a look to the definition of the C/A signal &lt;a href=&quot;https://en.wikipedia.org/wiki/GPS_signals#Legacy_GPS_signals&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;: where it says &lt;em&gt;t&lt;/em&gt; you need to put your &lt;em&gt;time&lt;/em&gt;, where it says &lt;em&gt;i&lt;/em&gt;, you need to put your index &lt;em&gt;i&lt;/em&gt;  from the for loop, so that concept is correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think your confusion comes from using the frequency in the equation instead of the sampling time which is your &lt;em&gt;time&lt;/em&gt; vector. &lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-04-14T18:56:25.013" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30132" PostTypeId="2" ParentId="29948" CreationDate="2016-04-14T20:28:46.627" Score="1" Body="&lt;p&gt;The answer by @MBaz is very complete. I am adding a shameless plug to the debate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a past work, I have been involved in the design of an algorithm aimed at finding, locally, the &quot;best&quot; matched filtering involving one signal $d$, and one template $x$ (and later several ones). Due to the noisiness and the non-stationnarity of the (seismic) data, we wanted to perform the matched filtering in a transformed domain. Skipping failures and other details, we ended up with a complex wavelet transform (you can think of windowed Fourier transforms). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And after some trials, we found that a &quot;single&quot; or unary coefficient matched filter was quite efficient. As weird it may seem (single-coefficient real filters are not so interesting), it worked because this coefficient was complex. The amplitude was  interpreted as  the amplitude correction, and the phase as (somehow)  a sub-sample time shift. You can find the whole story in &lt;a href=&quot;http://arxiv.org/abs/1108.4674&quot; rel=&quot;nofollow&quot;&gt;Adaptive multiple subtraction with wavelet-based complex unary Wiener filters&lt;/a&gt;, 2012. We later added a lag parameter to account for super-sample shifts. So you can check the derivations with a single complex coefficient quite easily, with the complex conjugation and stuff. So:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Yes it does&lt;/li&gt;&#xA;&lt;li&gt;You should place yourself in the most general context of complex data for Fourier, correlation, etc. to avoid mistakes&lt;/li&gt;&#xA;&lt;li&gt;You have an amplitude and a shift term, but it is somehow tricky (sub-sample)&lt;/li&gt;&#xA;&lt;li&gt;Appparently so, but I am not as sure as @MBaz&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-04-14T20:28:46.627" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30134" PostTypeId="1" CreationDate="2016-04-14T23:00:26.420" Score="5" ViewCount="614" Body="&lt;p&gt;We know that (7,4) hamming code has 4 message bits and 7 code bits and can detect any single bit error.  The (12,4) repetition code has 4 message bits and 12 code bits and can detect any single bit error.  I tend to think that since in hamming code we are using less number of parity bits, there should be some disadvantage vis a vis repetition code.  Is it true and if yes, what is the downside of hamming code? (One known disadvantage is that of encoding and decoding complexity.)  &lt;/p&gt;&#xA;" OwnerUserId="15664" LastEditorUserId="11256" LastEditDate="2016-04-14T23:21:43.180" LastActivityDate="2017-01-10T08:52:03.783" Title="What is the cost of Hamming coding?" Tags="|digital-communications|channelcoding|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30135" PostTypeId="2" ParentId="30134" CreationDate="2016-04-14T23:20:45.003" Score="1" Body="&lt;p&gt;This is an important subject that (IMO) is poorly handled in many introductory textbooks. To start, assume that an uncoded system spends $E_b$ joules per bit and transmits at rate $R_p$ information bits per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can you compare this system fairly with the Hamming (7,4) code? Making them operate at the same bit rate implies a bandwidth expansion of 7/4, which is not always possible or desirable. Making them operate at the same energy per bit means that the energy of each Hamming coded bit should be $E_c=4E_b/7$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you could say: under the same bandwidth and energy constraints, the cost of using a Hamming (7,4) code is a reduction in the data rate by a factor of 7/4. The benefit is a slight reduction in bit-error probabilty (but quite a bit less than that predicted by the binary symmetric channel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the repetition code: under the same assumptions, the repetion code has a rate reduction of a factor of 3, while offering &lt;strong&gt;zero&lt;/strong&gt; gain in probability of error!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under the assumption that $E_c=E_b$, then the repetition code has quite a bit to offer in terms of bit-error rate. However, the cost is that you're multiplying the energy consumption by 3 while reducing your data rate by 3. To be fair, you'd need to compare the repetion code with an uncoded system whose $E_b$ is also increased by a factor of 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize: comparing codes is not trivial, but not terribly hard either, as long as you make all your assumptions clear.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-04-14T23:20:45.003" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="30139" PostTypeId="1" CreationDate="2016-04-15T10:11:58.350" Score="2" ViewCount="237" Body="&lt;p&gt;I have a corpus of short speech samples from Kiswahili speakers, and I want to detect the number of syllables in each audio recording. How should I approach this task?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt; I asked a conceptual/programming variant of this question on StackOverflow showing my attempt at peak detection in R. Users &lt;a href=&quot;https://stats.stackexchange.com/questions/207400/detect-number-of-peaks-in-audio-recording&quot;&gt;migrated the question to CrossValidated&lt;/a&gt;, but someone suggested that SP might be a better home. I &lt;a href=&quot;https://dsp.meta.stackexchange.com/questions/1364/stackoverflow-to-crossvalidated-to-signal-processing&quot;&gt;asked how to handle the situation on SP Meta&lt;/a&gt;, and a user gave me helpful advice to frame this question more conceptually on SP.&lt;/p&gt;&#xA;" OwnerUserId="20546" LastEditorUserId="-1" LastEditDate="2017-04-13T12:44:17.740" LastActivityDate="2016-04-15T10:11:58.350" Title="how to detect number of syllables in a batch of audio recordings?" Tags="|peak-detection|lpc|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30145" PostTypeId="2" ParentId="30114" CreationDate="2016-04-15T12:17:32.380" Score="1" Body="&lt;p&gt;You haven't told us what is the goal of your processing. If you're trying to estimate the instantaneous frequency of your signal then I agree with ThP, the FFT is not the best approach. To measure the instantaneous frequency of your signal I suggest you perform FM demodulation. The FM demodulation schemes I'm familiar with have better performance the higher the data sample rate. So, I suggest you sample your signal at a rate that's several times higher than the minimum rate required by the Nyquist criterion and perform FM demodulation. If you need guidance on how to perform FM demodulation, let us know.&lt;/p&gt;&#xA;" OwnerUserId="15391" LastActivityDate="2016-04-15T12:17:32.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30146" PostTypeId="1" AcceptedAnswerId="30151" CreationDate="2016-04-15T12:39:09.060" Score="0" ViewCount="1915" Body="&lt;p&gt;Why does the phase shift between the input and the output of a transfer function vary with the frequency of the input sinusoid?&lt;/p&gt;&#xA;" OwnerUserId="16809" LastEditorUserId="80" LastEditDate="2016-04-15T14:53:35.627" LastActivityDate="2016-04-15T19:41:36.827" Title="Transfer function sinusoidal response" Tags="|transfer-function|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30147" PostTypeId="1" CreationDate="2016-04-15T12:41:50.857" Score="7" ViewCount="906" Body="&lt;p&gt;I have the following question about the maximum likelihood (ML) in presence of inter-symbol interference and colored noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the communication system is as follows. Information source, modulator, transmit pulse filtering, channel, AWGN, matched receiver pulse filtering, sampler, and then ML estimator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The received signal after the sampler is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = h\star h\star c\:a + n\star h$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $y$ is the received samples (contains transmit symbols + ISI + noise), $a$ is the transmit symbols, $h$ transmit/receive pulse shaping filter, $c$ is the channel impulse response, $n$ is the AWGN, and $\star$ denotes convolution. This can be further written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y = A\:a + \eta$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $A$ is a convolution matrix whose elements contains $h\star h\star c$ and $\eta$ is a colored noise. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I wonder what will be the ML in this case? &lt;/li&gt;&#xA;&lt;li&gt;And how to derive/calculate it?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15078" LastEditorUserId="128" LastEditDate="2018-08-26T07:09:51.097" LastActivityDate="2021-11-12T07:25:00.133" Title="Maximum Likelihood for Colored Noise" Tags="|digital-communications|signal-detection|estimation|parameter-estimation|maximum-likelihood-estimation|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30148" PostTypeId="2" ParentId="30146" CreationDate="2016-04-15T14:45:25.883" Score="1" Body="&lt;p&gt;For any LTI (Linear Time Invariant) system (considering the steady state response i.e. ignoring the transient response which generally becomes negligible in a very short period), if the input is a sinusoidal signal, the output is always a sinusoidal signal of the same frequency.  But the amplitude of the output sinusoidal can be different from the input amplitude.  And the ratio of the output amplitude to input amplitude is a constant for that particular frequency - whatever the input amplitude and phase are. Similarly, the difference between the input and output sinusoidal phases is also constant for the particular frequency - irrespective of the amplitude. The transfer function can be used to give this input-output amplitudes ratio and input-output phase difference as a function of frequency.  Hope this helps.  The frequency dependency is derivable from the input/output differential equation in analog case or difference equation in discrete case.&lt;/p&gt;&#xA;" OwnerUserId="15664" LastActivityDate="2016-04-15T14:45:25.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30149" PostTypeId="1" CreationDate="2016-04-15T16:25:45.250" Score="1" ViewCount="428" Body="&lt;p&gt;I am looking into detection of pressurized gas leaks by means of the broadband hissing sound (white noise) generated from pressurized leaking gas. The instrument will have a broadband microphone followed by a high pass filter to filter away all low frequency audible noise below 15-20 kHz, but when broadband noise from leaks occure, they will pass the filter and activate an alarm. The problem is that in noisy industrial environments, machines (compressors), and other equipment will also have some ultrasound components above 15-20 kHz, and it will do false activation. Is it possible to recomend optimal DSP algoritms to be used, after the raw 15-20 kHz filtering to do a efficient suppression of machine made background noise, without affecting the sensitivity for the leak noise? I cannot tolerate varible gain for the leak noise (white noise) because then it will affect the sensitivity to detect leaks in a predefined distance, so the system must automatically suppress unwanted industrial background noise, but not affect the sensitivity to the leak noise (white noise in frequency range 20 kHz to 50 kHz).?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I would say that the main difference between leak noise i want to detect (the broadband white noise) and the machine noise is that the leak noise is just plain white noise, while very often the machine noise will have some components of high frequency reprocicating noise pattern in it from highspeed running compressors which the white noise leak noise do not have, but the high frequency reprocicating background noise can vary in frequenct from machine to machine so I do noy want to use some kind of fixed notch filter, so I am locked to one machine, at one rotation speed. Actually the problem is that the machines main noise frequency will be belos the 15-20 kHz, but it is the harmonics that repeat itself up above 15-20 kHz, and it is those I need to have filtered away. Seen from a more practical point of view, my own ears will be able to hear the difference, so I woundered if that could be realized in a electronic filter too.&lt;/p&gt;&#xA;" OwnerUserId="20561" LastEditorUserId="80" LastEditDate="2016-04-18T12:29:50.837" LastActivityDate="2016-04-18T12:43:48.173" Title="Best DSP algoritms for ultrasonic background noise cancellation" Tags="|audio|adaptive-filters|detection|adaptive-algorithms|ultrasound|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30150" PostTypeId="1" AcceptedAnswerId="30152" CreationDate="2016-04-15T16:42:02.203" Score="3" ViewCount="1040" Body="&lt;p&gt;Let's say we have $h_c(t)$ as a continuous-time signal with bandwidth $B$ and we would like to sample it.&#xA;To be able to reconstruct it correctly, the sampling rate must be greater than $2B$.&#xA;Now assume we have $h_{c1}(t)=h_c(t)\cdot h_c(t)$ and $h_{c2}(t)=h_c(t)\circledast h_c(t)$ what is Nyquist rate of these two signals? Is it $4B$ for both of them because each $h_{c}(t)$ needs $2B$?&lt;/p&gt;&#xA;" OwnerUserId="15003" LastEditorUserId="80" LastEditDate="2016-11-15T09:46:38.707" LastActivityDate="2016-11-15T09:46:38.707" Title="what is nyquist rate of $h(t)\cdot h(t)$ and $h(t)\circledast h(t)$" Tags="|discrete-signals|fourier-transform|impulse-response|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30151" PostTypeId="2" ParentId="30146" CreationDate="2016-04-15T19:41:36.827" Score="1" Body="&lt;p&gt;Assuming you're asking about Linear and Time-Invariant systems (LTI), the phase is shifted only for such systems that have &lt;em&gt;&quot;reactive&quot;&lt;/em&gt; elements in the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LTI systems are made up of signal-processing elements that fall into 3 fundamental classes:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;adders (devices that add two signals).&lt;/li&gt;&#xA;&lt;li&gt;scalers (devices that scale a signal by a constant).&lt;/li&gt;&#xA;&lt;li&gt;&quot;reactive&quot; elements (devices that are able to discriminate w.r.t. frequency).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Element classes 1. and 2. are essentially the same for analog or digital filters.  The are sometimes called &lt;em&gt;&quot;memoryless&quot;&lt;/em&gt; devices or elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an analog filter (or &quot;analog LTI system&quot;), those reactive elements would be capacitors or inductors.  They integrate or differentiate one signal to become another.  That turns a sine signal into a cosine signal or shifts the phase by $\pm$ 90°.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\cos(\Omega t) = \sin(\Omega t + \tfrac{\pi}{2})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For digital filters, the reactive elements are delay elements.  A unit delay (a delay of exactly one sample period $T$) will delay any signal, including a sinusoid, by 1 sample or $T$ units of time.  That shifts the phase by an amount that is dependent on frequency&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(\Omega (t-T) ) = \sin(\Omega t - \Omega T)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sin(\omega (n-1) ) = \sin(\omega n - \omega )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any LTI system that acts as a &lt;em&gt;&quot;filter&quot;&lt;/em&gt;, a device to filter out some frequency components and leave others, &lt;strong&gt;must&lt;/strong&gt; have reactive elements (or &lt;em&gt;&quot;non-memoryless&quot;&lt;/em&gt; elements or components having memory) in order to discriminate one frequency from another.  And such a filter will shift phase which will normally be different for different frequencies.  But a memoryless LTI system (which is just a scaler) will not discriminate between frequencies nor will shift phase, except for possibly by 180°, which is just a polarity reversal or scaling by a negative constant.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-04-15T19:41:36.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30152" PostTypeId="2" ParentId="30150" CreationDate="2016-04-15T21:03:04.890" Score="3" Body="&lt;p&gt;squaring a signal effectively doubles the bandwidth of the signal (and doubles the Nyquist rate, which is the lower limit of the sampling rate).  convolving a signal with anything, even itself, does not in general increase the bandwidth.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-04-15T21:03:04.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30154" PostTypeId="2" ParentId="30150" CreationDate="2016-04-15T23:00:38.933" Score="2" Body="&lt;p&gt;Convolution spreads the signal in the domain in which the convolution takes place. Convolution in the time domain spreads the signal in time. Convolution in the frequency domain spreads the signal in frequency. Multiplying the signal by itself in time domain is equivalent to convolution in the frequency domain - so the resulting signal will have twice the bandwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For convolution in time-domain - this corresponds to multiplication in the frequency domain, so the resulting signal will have the essentially the same bandwidth. The bandwidth may change slightly. If you consider the -3 dB point of the original signal - the multiplication or convolution will change the position of the -3 dB points slightly in the final signal. How much the position of these points change, will depend of the definition of bandwidth you use and the exact signal you use.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="7483" LastEditDate="2016-04-16T12:39:37.390" LastActivityDate="2016-04-16T12:39:37.390" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30155" PostTypeId="2" ParentId="30147" CreationDate="2016-04-16T00:25:15.630" Score="1" Body="&lt;p&gt;First, I think that the expression &lt;span class=&quot;math-container&quot;&gt;$ A = h\star h\star c $&lt;/span&gt; is not correct. Actually, &lt;span class=&quot;math-container&quot;&gt;$ A $&lt;/span&gt; is a convolution matrix whose elements contains &lt;span class=&quot;math-container&quot;&gt;$ h\star h\star c $&lt;/span&gt;. The dimensions of &lt;span class=&quot;math-container&quot;&gt;$ A $&lt;/span&gt; will depend on the dimensions of &lt;span class=&quot;math-container&quot;&gt;$ h $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ c $&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$ h $&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$ N_{h} $&lt;/span&gt; coefficients and &lt;span class=&quot;math-container&quot;&gt;$ c $&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$ N_{c} $&lt;/span&gt; coefficients, and let &lt;span class=&quot;math-container&quot;&gt;$ m = h\star h\star c $&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$ m $&lt;/span&gt; will have &lt;span class=&quot;math-container&quot;&gt;$ N_{a} = 2N_{h} + N_{c} -2 $&lt;/span&gt; coefficients.&lt;/p&gt;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$ h = [h_{1} \ h_{2} \ h_{3}]^{T} $&lt;/span&gt; has 3 coefficients and &lt;span class=&quot;math-container&quot;&gt;$ c = [c_{1} \ c_{2} \ c_{3} \ c_{4}]^{T}  $&lt;/span&gt; has four coefficients, then &lt;span class=&quot;math-container&quot;&gt;$ m $&lt;/span&gt; will have 8 coefficients.&lt;/p&gt;&#xA;&lt;p&gt;The matrix &lt;span class=&quot;math-container&quot;&gt;$ A $&lt;/span&gt; will have &lt;span class=&quot;math-container&quot;&gt;$ N_{m} $&lt;/span&gt; rows and &lt;span class=&quot;math-container&quot;&gt;$ N $&lt;/span&gt; columns, where &lt;span class=&quot;math-container&quot;&gt;$ N $&lt;/span&gt; is the length of your &lt;span class=&quot;math-container&quot;&gt;$ a $&lt;/span&gt;, so as to make the product &lt;span class=&quot;math-container&quot;&gt;$ Aa $&lt;/span&gt; equivalent to the convolution operation &lt;span class=&quot;math-container&quot;&gt;$ m\star a $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Pay attention the colored noise is the result of AWGN through a linear system, hence it is still an Additive Gaussian Noise So, the ML problem can written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{a} = \arg \min_{a} {\left\| A a - y \right\|}_{2}^{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The solution to this ML problem can be found at any book about estimation theory and other materials like &lt;a href=&quot;http://times.cs.uiuc.edu/course/410/note/mle.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;In Jae Myung - Tutorial on Maximum Likelihood Tstimation&lt;/a&gt;. The analytical solution will depend on the statistics involved. The implementation of the ML can be made using the Viterbi algorithm, for example.&lt;/p&gt;&#xA;" OwnerUserId="17125" LastEditorUserId="7092" LastEditDate="2021-05-06T17:48:20.567" LastActivityDate="2021-05-06T17:48:20.567" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="30156" PostTypeId="1" CreationDate="2016-04-16T06:24:17.927" Score="1" ViewCount="97" Body="&lt;p&gt;We have designed a system which has an 8X8 array of photo diodes, we sense 10ns pulses of laser falling on those photo diodes with a repetetion rate of maximum 50Khz i.e. 20us, we were successfully able to sense them and detect them,please note that our system only senses those laser pulses and gives out the frequency of those pulses and amplitude/energy of those pulses, but doesn't do any kind of imaging&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but now the problem statement has become a bit complex, for increased requirements we are forced to switch to a 64X64 array model, now we have to have 4096 stages of processing which will make the design very bulky&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now i am thinking of solving this problem with a different approach, so in this need i need some suggestions, what alternatives can solve the problem by reducing the electronics stages&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i thought of solving it by using a line scanning mechanism where 64 stages of processing will be given to 64 rows and 64 columns will be switched to use the same stages, but with this it will be very difficult to sense the 10ns pulses, because my sampling rate for each row should be at least 2GHz to acquire at least 10samples of the pulse the total sampling rate for scanning all columns is 2GHz X 64 = 128GHz sampling rate, working at this rate is very costly affair and over ambitious to go at a frame rate of 2GHz&lt;/p&gt;&#xA;&#xA;&lt;p&gt;please throw some light by suggesting any alternate techniques that these to solve the problem of increased replica of electronic stages&lt;/p&gt;&#xA;" OwnerUserId="4513" LastEditorUserId="4513" LastEditDate="2016-04-17T06:23:55.547" LastActivityDate="2016-04-17T06:23:55.547" Title="processing photo diode array data" Tags="|image-processing|signal-detection|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="30157" PostTypeId="1" CreationDate="2016-04-16T06:58:07.957" Score="0" ViewCount="170" Body="&lt;p&gt;I have question and looking for help. Suppose we have a vector of real values (lat's say 64 length resulting from factorization 8*8 block image). We got a sparse representation of that vector (let's suppose that the sparse vector is 128 length with very few active elements, about 4 coefficients). I want to send this sparse vector through a channel, so I need bit stream of 1,0. Are there any efficient encoding/decoding technique for the sparse signals ?&lt;/p&gt;&#xA;" OwnerUserId="20569" LastActivityDate="2016-08-15T10:15:51.233" Title="How we can encode/decode sparse signals?" Tags="|compressive-sensing|sparsity|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30158" PostTypeId="2" ParentId="28286" CreationDate="2016-04-16T07:59:22.563" Score="1" Body="&lt;p&gt;&lt;strong&gt;Assumptions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your question, I assume you already have an algorithm that does produce the transformation you want, but you have to play with the parameters manually.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proposed solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, convert the images to grayscale (this is mainly for convenience). You might play around a bit with the channels of your images - do you need all channels, or do some only contribute noise? Is it a good idea to have a certain channel overrepresented, e.g. the red one because there is least distracting information in it, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, check if you can find threshold on the values that drops most parts of the noise and leaves you mainly with desired information. In the image you posted, there is this kind of rainbow band... I assume this is something unwanted and you could get rid of it in this step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define an objective function to minimize, e.g. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum\limits_{(x,y)}(I_\textrm{ref}(x,y) - T(I(x,y),\vec{\zeta}))^2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, $I_\textrm{ref}(x,y)$ is your reference image, and $I(x,y)$ is the image to be transformed to match the reference as closely as possible. $T(I(x,y),\vec{\zeta})$ is your image correction transformation applied to the image $I(x,y)$, and its (eight you say) parameters are summarized in the vector $\vec{\zeta}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, take an optimization algorithm of your choice. Probably it is best to take one that does not depend on the derivative of your objective function, or one that automatically estimates the derivative numerically. An very well-studied algorithm of the first kind is the Downhill-Simplex-algorithm (or also called Nelder-Mead-algorithm, see &lt;a href=&quot;https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method&quot; rel=&quot;nofollow&quot;&gt;https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method&lt;/a&gt;). Give your objective function to it and let it play with the parameters $\vec{\zeta}$ until it finds an optimum (i.e. a minimum). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how your transformation handles edges, it might be necessary to modify the objective function a bit, so that it does not sum over all pixels $(x,y)$, but only over the central part of your image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if you would like the letters to match as well as possible, it might be an idea to invert your images, so that the background is mainly black (i.e. zero). In theory, this should not make a difference, but it might in practice due to numerical reasons. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Further improvement&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do have slight differences in the illumination in your images, you could use &lt;em&gt;Mutual Information&lt;/em&gt; as a cost function. This is very often done in medical imaging, when registering two images with different contrasts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastEditorUserId="19501" LastEditDate="2016-04-16T09:34:41.597" LastActivityDate="2016-04-16T09:34:41.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30161" PostTypeId="2" ParentId="26954" CreationDate="2016-04-16T12:30:40.977" Score="1" Body="&lt;p&gt;You have a signal in a 2D-frequency domain. You know the maximum frequencies in both directions, I assume. Hence, you know which bandwidth is represented by one pixel and then... just count the pixels from the center to the point of interest along the axes and your done. Depending on your application, taking the Euclidean distance from the center to the peak is also an option, which does end in one instead of two frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would like to do a more sophisticated approach, you could fit a Gaussian distribution (or another function, if you have one in mind that is more appropriate in your case) to the peak. That way you could get a sub-pixel accuracy of the location of the peak.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-04-16T12:30:40.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30163" PostTypeId="1" AcceptedAnswerId="30164" CreationDate="2016-04-16T16:42:26.120" Score="1" ViewCount="406" Body="&lt;p&gt;In this: &lt;a href=&quot;http://dspguru.com/dsp/howtos/how-to-interpolate-in-time-domain-by-zero-padding-in-frequency-domain&quot; rel=&quot;nofollow&quot;&gt;http://dspguru.com/dsp/howtos/how-to-interpolate-in-time-domain-by-zero-padding-in-frequency-domain&lt;/a&gt;&#xA;the author says that we can interpolate a signal by zero-padding the &lt;em&gt;middle&lt;/em&gt; frequencies in the DFT. But then the high frequency components are pushed even higher, so shouldn't the result look more wiggly? Why is that not so?&lt;/p&gt;&#xA;" OwnerUserId="18835" LastActivityDate="2016-04-16T17:37:25.440" Title="Why does Fourier zero-fill interpolation pad the middle frequencies?" Tags="|discrete-signals|fourier-transform|interpolation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30164" PostTypeId="2" ParentId="30163" CreationDate="2016-04-16T17:37:25.440" Score="4" Body="&lt;p&gt;Usually a fast Fourier transform (FFT) returns a vector that starts with the zero-frequency bin. This means that the Nyquist frequency (sampling frequency / 2) bin is in the middle of the vector. So you are not pushing apart the low and high frequencies by zero padding at the middle. The zeros go between the highest positive frequency bin and the highest-absolute-frequency negative frequency bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rick omits the details of how to deal with the Nyquist frequency bin (which is there with even-length DFT): If you have a non-zero Nyquist frequency bin then you need to split it into a half-amplitude positive Nyquist frequency bin and a half-amplitude negative Nyquist frequency bin, and insert the zero padding between those. ...I think.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-04-16T17:37:25.440" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30165" PostTypeId="1" CreationDate="2016-04-16T19:49:53.300" Score="1" ViewCount="471" Body="&lt;p&gt;i am trying to do some experiments with Total Harmonic Distortion.&#xA;According to &lt;a href=&quot;https://www.researchgate.net/publication/2456363_Simultaneous_Measurement_of_Impulse_Response_and_Distortion_With_a_Swept-Sine_Technique&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Simultaneous measurement of impulse response and distortion with a swept-sine technique&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;i have to use the deconvolution method to get distortion harmonics.&#xA;The problem i have is that i don have any experience with the mathematics behind deconvolution. So i want to test it with some known signals.&#xA;but i have the problem i need thus some signals with known distortion to try out... How do i make this kind of signals.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Input signals&#xA;&lt;ul&gt;&#xA;&lt;li&gt;sine wave ?&lt;/li&gt;&#xA;&lt;li&gt;chirp&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;added distortion&#xA;&lt;ul&gt;&#xA;&lt;li&gt;specific filters&lt;/li&gt;&#xA;&lt;li&gt;sine waves&lt;/li&gt;&#xA;&lt;li&gt;chirp ( how to add this frequency specific...)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I use python with numpy and scipy&lt;/p&gt;&#xA;" OwnerUserId="13541" LastEditorUserId="13541" LastEditDate="2021-05-11T12:06:49.350" LastActivityDate="2021-05-11T12:06:49.350" Title="how to get an input test signal for convolution/ distortion method" Tags="|python|deconvolution|distortion|" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="30167" PostTypeId="2" ParentId="30016" CreationDate="2016-04-16T21:16:32.817" Score="9" Body="&lt;p&gt;Here is what I experimented with:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use &lt;a href=&quot;http://dev.ipol.im/~jirafa/ipol_demo/elsdc/input_upload&quot; rel=&quot;noreferrer&quot;&gt;ELSD&lt;/a&gt; to generate elliptic contours. You could basically use any edge detector, but since in the following stages I will benefit from circle detectors, it is good to already have some geometrical edges. Here is what the output looks like:&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://i.stack.imgur.com/t5LQo.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t5LQo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Collect all circular (also non-circular) edges via collecting the channels into a single image. This can also be done via simple thresholding. Again, the output looks like:&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://i.stack.imgur.com/rgTjV.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rgTjV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I will denote this image to be $C$.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;We will now compute the &lt;a href=&quot;https://en.wikipedia.org/wiki/Circle_Hough_Transform&quot; rel=&quot;noreferrer&quot;&gt;circular hough transform&lt;/a&gt; on this image. However, there are many spheres (which appear to be circular) in varying radii. Thus, we select a range $\mathbf{r}=\{9, 12, 15..150\}$ to be the expected radii per hough transform. The pseudocode looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;$c_x$ $\leftarrow$ $\emptyset$, $c_y$ $\leftarrow$ $\emptyset$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for all ($r_i \in \mathbf{r}$) $\{$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{x, y} = hough_circles($C$, $r_i$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$c_x \leftarrow \{c_x \cup x \}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$c_y \leftarrow \{c_y \cup y \}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;$\}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Depending on the peaks of the accumulator, Hough might report multiple center locations. A simple clustering might help avoiding this (Just average the close-by centers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final image with the resulting centers overlayed (in different colors), looks like: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Scm3C.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Scm3C.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could customize the radius to be robust to different circles. Moreover, one can use elliptic Hough transform to have a better coverage of the particles (as some of them are not circular). Finally, the much-occluded large circles can be obtained after masking out the small ones - even with the help of a distance transform. If the false circle hypothesis are desired to be eliminated, you can always reduce the Hough sensitivity. Or you could always render the contours of the circle and compare to the detected edges.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2016-04-19T23:41:48.080" LastActivityDate="2016-04-19T23:41:48.080" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30170" PostTypeId="2" ParentId="30157" CreationDate="2016-04-17T05:29:39.227" Score="1" Body="&lt;p&gt;Since you have tagged your question compressive-sensing, I would guess that you are interested in a compressive sensing solution to this. In principle, this could work by taking a number (less than 64) of random linear combinations (measurements) of your length 64 vector and transmitting these. At the receiver, the fact that this vector has a sparse representation allows you to reconstruct it again from these measurements. However, compressive sensing does not work that well on low-dimensional vectors (64 is relatively small) and so I do not expect this scheme to work very well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more natural solution, since you mention that you know the sparse length 128 representation of the vector, is to use run-length encoding (&lt;a href=&quot;https://en.m.wikipedia.org/wiki/Run-length_encoding&quot; rel=&quot;nofollow&quot;&gt;Wikipedia explanation&lt;/a&gt;) of the sparse representation and transmit that. Since the sparse vector is almost all zeros, this should be very efficient. &lt;/p&gt;&#xA;" OwnerUserId="1464" LastActivityDate="2016-04-17T05:29:39.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30174" PostTypeId="1" AcceptedAnswerId="30175" CreationDate="2016-04-17T12:06:23.980" Score="0" ViewCount="557" Body="&lt;p&gt;I have to quantify the broadband noise of an audio track.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen lots of things around and the only viable option to estimate the broadband noise (without having any information about it) is something like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;noise=0;&#xA;sig=0;&#xA;for i=in:fin&#xA;   nois(j)=(abs((min(B(:,i)).^2))); &#xA;   sign(j)=(abs((max(B(:,i)).^2)));&#xA;   j=j+1;&#xA;end&#xA;snr=var(sign)/var(noise)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where B is the matrix of the spectrogram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm doing FFT analysis of the audio, finding the minimum amplitude for each bin for an approximation of the noise floor and the maximum amplitude for an approximation of the signal. Then I'm doing the variances of both vectors and finally making a simple signal to noise calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's not a very sophisticated method but things previously tried have not worked. This gives me more solid results but it doesn't work for all kinds of genres.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has someone something more to suggest me to improve this algorithm? Other approaches that work better?&lt;/p&gt;&#xA;" OwnerUserId="20581" LastActivityDate="2016-04-17T14:18:04.953" Title="Audio Broadband Noise Detection" Tags="|audio|noise|detection|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30175" PostTypeId="2" ParentId="30174" CreationDate="2016-04-17T14:18:04.953" Score="0" Body="&lt;p&gt;The algorithm is basically based on the assumption that noise is &quot;white&quot;, ie. in the expectation value, the noise energy in every DFT bin is equal. Under that assumption, and assuming a &quot;long enough&quot; observation, there has to be the same noise floor in every bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sound on the other hand, is a highly correlated signal. So the assumption is that there's at least one DFT bin at a time where there's no significant sound signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you might imagine, that's a bit of an oversimplification on both sides: There's a lot of music that actually uses Noise, or broadband signals, and audio noise typically is everything but white. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In essence: this boils down to the good ol' &quot;What is my SNR?&quot; question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;You&lt;/em&gt;, as the DSP designer, will have to model your signal, and your noise. After that, the question kind of answers itself. It's really more of a question of semantics than engineering: For example, take psychedelic rock/stoner/doom metal: wideband noise in the string instrument's track is very essential to that genre; is it noise, then? And if you get a recording of a classical guitar piece, wouldn't you consider the same noise in the signal part of the noise or music energy?&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-04-17T14:18:04.953" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30176" PostTypeId="1" CreationDate="2016-04-17T14:53:56.533" Score="3" ViewCount="2873" Body="&lt;p&gt;A sample of a random process is given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x(t) = A\cos(2\pi f_0t) + Bw(t)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w(t)$ is a white noise process with $0$ mean and a power spectral density of $\frac{N_0}{2}$, and $f_0$, $A$ and $B$ are constants.&#xA;Find the auto-correlation function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my attempt at a solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $a = 2\pi f_0t$, and $b = 2\pi f_0(t+\tau)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\text{Autocorrelation of } x(t) &amp;amp; = E\left\{x(t)x(t + \tau)\right\}\\&#xA;&amp;amp; = E\left\{\left(A\cos(a) + Bw(t)\right)\left(A\cos(b) + Bw(t+\tau)\right)\right\}\\&#xA;&amp;amp; = E\{A^2\cos(a)\cos(b) + AB\cos(a)w(t+\tau) + AB\cos(b)(wt)\\&amp;amp;\quad + B^2w(t)w(t+\tau)\}\\&#xA;&amp;amp; = E\left\{A^2\cos(a)\cos(b)\right\} + E\left\{AB\cos(a)w(t+\tau)\right\} + E\left\{AB\cos(b)(wt)\right\}\\&amp;amp;\quad + E\left\{B^2w(t)w(t+\tau)\right\}\\&#xA;&amp;amp; = E\left\{A^2\cos(a)\cos(b)\right\} + E\left\{B^2w(t)w(t+\tau)\right\}\\&#xA;&amp;amp; = E\left\{A^2\cos(a)\cos(b)\right\} + B^2\left(R_w(\tau)\right)\\&#xA;&amp;amp; = E\left\{A^2\cos(a)\cos(b)\right\} + B^2\left(\frac{N_0}{2}\right)(\delta(\tau))\\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expectation terms with the noise in them all equal $0$ (the last is just the auto correlation of white noise ... hence the simplification above. Using trigonometric identities:&#xA;$$&#xA;\cos(a)\cos(b) = \frac 12\left[\cos(a + b) + \cos(a - b)\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\text{Autocorrelation of } x(t) &amp;amp; = E\left\{A^2\cos(a)\cos(b)\right\} + B^2\left(\frac{N_0}{2}\right)(\delta(\tau))\\&#xA;&amp;amp; = E\left\{\left(A^2\right)\frac 12\left[\cos(a+b)+\cos(a-b)\right]\right\} + B^2\left(\frac{N_0}{2}\right)(\delta(\tau))\\&#xA;&amp;amp; = \left(\frac{A^2}{2}\right)\left[E\{\cos(a+b)\} + E\{\cos(a-b)\}\right] + B^2\left(\frac{N_0}{2}\right)(\delta(\tau))\\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're dealing with constant terms, so expectation term goes away and subbing in our initial conditions we get:&#xA;$$&#xA;\frac {A^2}2 \left[\cos(2\pi f_o(2t + \tau) + \cos(2\pi f_o\tau)\right] + B^2\left(\frac{N_0}{2}\right)(\delta(\tau))&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason I can't help but feel I did something incorrectly calculating that autocorrelation ... it's supposed to be a function of $\tau$, but has a $t$ is in there ... I would very much appreciate it if someone could point me in the right direction, or explain what I messed up. I don't know whether it matters, but in this class we're dealing with only wide sense stationary processes.&lt;/p&gt;&#xA;" OwnerUserId="20588" LastEditorUserId="1629" LastEditDate="2016-04-17T20:03:44.030" LastActivityDate="2016-04-18T07:50:03.960" Title="Calculation of an autocorrelation function" Tags="|noise|autocorrelation|random-process|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30177" PostTypeId="1" CreationDate="2016-04-17T14:58:37.993" Score="-1" ViewCount="285" Body="&lt;p&gt;Assume N receivers, detecting the same sine signal in AWGN with FFT, then we have N peaks for the same frequency corrupted by noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to use the N FFT observations of the same signal to get a more accurate estimate of the frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first intuition is averaging the frequency values at each peak, but the noise in frequency domain is not gaussian, so I guess averaging is not the right way to do it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks&lt;/p&gt;&#xA;" OwnerUserId="16922" LastActivityDate="2016-04-18T08:05:27.857" Title="Frequency estimation of N FFTs of one sine signal in AWGN" Tags="|estimation|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30178" PostTypeId="2" ParentId="30176" CreationDate="2016-04-17T17:41:06.843" Score="-1" Body="&lt;p&gt;I guess you've done almost everything right, but have a problem at the calculation of the expectation value regarding $t$. You should calculate the expectation value of the cosine function. Sadly, it does not simply &quot;go away&quot; as you wrote.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Autocorrelation&quot; rel=&quot;nofollow&quot;&gt;Wikipedia page&lt;/a&gt;. There you can find another, more explicit, formula for the auto-correlation function of a function $f(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R_{\textrm{ff}}(\tau) = \int\limits_{-\infty}^\infty f(t+\tau)\bar{f}(t) \, \textrm{d}t$ .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note, that compared to the Wikipedia page, I have taken the liberty to use the variable $t$ in the integration instead of $u$, which would be the mathematically more accurate version.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from this equation, you &quot;integrate away&quot; the dependency on t, and indeed you should be left with a function that is independent of $t$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there is also an version that does not go to infinite times, but is constrained to a period $T$. Maybe this version is more appropriate in your case. However, the same holds for this version: $t$ is integrated away and should not be a variable in the resulting formula.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastEditorUserId="19501" LastEditDate="2016-04-18T07:50:03.960" LastActivityDate="2016-04-18T07:50:03.960" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30179" PostTypeId="2" ParentId="7988" CreationDate="2016-04-17T19:43:51.197" Score="0" Body="&lt;p&gt;Indeed, as Jason R sais, that's how all sine oscillators are designed for synthesizers, they must change frequency without changing phase, so you have to control them only using a counter, and you vary the counter increment speed to change the sine/cosine frequency, in that way the sine is always one count onwards from it's previous value regardles of speed changes.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2016-04-17T19:43:51.197" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30180" PostTypeId="2" ParentId="30104" CreationDate="2016-04-18T04:07:04.927" Score="1" Body="&lt;p&gt;That is a simple question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All sound that passes into analogue domain using digital audio converters (DACs) have a SNR inferior to about 113 at best, and more probably 96-100... everything recorded using microphones will have inherant noise, unless the recording has been copy pasted onto a silent track leaving intervals of silence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what you need to do to have a very clean signal, is to take a totally digital sound which was generated with i.e. sine waves and has not had reverb and echo effects that raise the noise in the silent time(s) of the recording, and digital synthesizers which return to 0 after the note envelope. You can go though a track that contains elements of silence in Audacity or a more easy to zoom editor, and check that you are having times in the track where the amplitude = 0.0; or program a fast test code to count that the track has amplitudes of 0.0 lasting for more than 500ms or something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you take any recording and vary the volume of the track, for example you take an AC-DC rock song, and apply an artificial envelope that fades the track to 0.00 regularly i.e. every couple of seconds, it also makes a test file with totally silent intervals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can also write a code that sais : if volume &amp;lt; than 0.05, volume =0; to artifically make any track you want totally silent at times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;find digital recordings on freesound and measure them for 0.00 intervals in between sounds, check digital music artists that boast about 192khz recording equipment for a particular album, get a feel of which artists use state of the art production equipment, check standard commercial tracks that are used to measure monitor speakers, there are many options.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastEditorUserId="12103" LastEditDate="2016-04-18T04:18:56.150" LastActivityDate="2016-04-18T04:18:56.150" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30183" PostTypeId="2" ParentId="30177" CreationDate="2016-04-18T08:05:27.857" Score="1" Body="&lt;p&gt;Let's calculate: Suppose we have a $\underline{x} \sim \mathcal{N}\left ( \underline{0}, \sigma_x^2 I_N \right )$, where $I_N$ is the $N \times N$ identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denote by $\bf{W}$ the unitary DFT matrix, and by $\bf{W}^H$ its Hermitian transpose.&#xA;Note that $\bf{W}\bf{W}^H=\bf{W}^H\bf{W}=I_N$, thus, $\underline{X} = DFT\left (  \underline{x}\right ) = \bf{W} \underline{x}$ and &#xA;\begin{equation}&#xA;E\left \{ \underline{X} \right \} = E\left \{ \bf{W} \underline{x} \right \} = \bf{W} E\left \{ \underline{x} \right \} = \underline{0},&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;COV\left \{ \underline{X} \right \} = COV\left \{ \bf{W} \underline{x} \right \} = \bf{W} COV\left \{ \underline{x} \right \} \bf{W}^H = \sigma^2I_N.&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so in the frequency domain, $\underline{X} \sim \mathcal{N}\left ( \underline{0}, \sigma_x^2 I_N \right )$, thus, you can take the mean in the frequency domain as well as in the time domain and the estimation will be minimum variance unbiased.&lt;/p&gt;&#xA;" OwnerUserId="15513" LastActivityDate="2016-04-18T08:05:27.857" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30184" PostTypeId="1" CreationDate="2016-04-18T09:17:35.533" Score="1" ViewCount="331" Body="&lt;p&gt;What is the relation between sampling frequency  and the frequency of the signal after sampling? For example sampling frequency is 100 Hz,&#xA;that is the signal contain maximum frequency of 50 Hz. Then what will be the maximum frequency after sampling? Is it 100 or 50?&#xA;Or it is above it? How can we see it in MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="20599" LastEditorUserId="8202" LastEditDate="2016-04-18T12:31:22.680" LastActivityDate="2016-04-18T12:31:22.680" Title="EEG signal processing with sampling frequency" Tags="|sampling|frequency|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30185" PostTypeId="1" CreationDate="2016-04-18T09:32:33.880" Score="2" ViewCount="369" Body="&lt;p&gt;I am doing FFT. The one way I did is to put real part in one array and the imaginary part as zeros and then calculated the FFT. But this take up lots of resources. &#xA;Now I want to calculate FFT by Dividing Real Input by 2 in the form of ODD and EVEN samples and put even in real array and odd in Imaginary array. Then calculate the FFT. But after the FFT calculation how can I combine them to get the same results as I got when I used imaginary as zero's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea?? &lt;/p&gt;&#xA;" OwnerUserId="20600" LastEditorUserId="8202" LastEditDate="2016-04-18T10:30:05.373" LastActivityDate="2016-04-18T13:56:51.603" Title="FFT of a $N$-length real sequence via FFT of a $N/2$-length complex sequence" Tags="|fft|dsp-core|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30186" PostTypeId="2" ParentId="30184" CreationDate="2016-04-18T09:48:34.307" Score="2" Body="&lt;p&gt;Intuitively... Assume to have a sampled signal, i.e. a sequence $\{s(n)\}$. The &quot;fastest&quot; oscillatory behaviour you can see is a component which changes &quot;polarity&quot; at any successive sample, for example consider&#xA;$$&#xA;s(n) = (-1)^n&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it is positive for $n=0$, negative for $n=1$, positive again for $n=2$ and so on. Trivially you cannot have something oscillating faster. The period of this signal is 2 (samples), infact you have $s(n) = s(n+2)$ for any $n$. Therefore its frequency is half the sampling frequency.&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-04-18T09:48:34.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30188" PostTypeId="2" ParentId="30185" CreationDate="2016-04-18T10:20:25.763" Score="3" Body="&lt;p&gt;You can use Decimation In Time (DIT) to calculate the FFT of single $N$ length sequence, using two $N/2$ sequences and combine them later on with a single butterfly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing that FFT of an even length, real sequence, can be decomposed into even and odd part as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;\mathrm{FFT_N}(x)&amp;amp;=\sum_{m=0}^{N/2-1}x(2m)e^{-2\pi j k(2m)/N} + \sum_{m=0}^{N/2-1}x(2m+1)e^{-2\pi j k(2m+1)/N}\\&#xA;&amp;amp;=\sum_{m=0}^{N/2-1}x(2m)e^{\frac{-2 \pi j k m}{N/2}}+e^{-2\pi j k/N} \sum_{m=0}^{N/2-1}x(2m+1)e^{\frac{-2\pi j k m}{N/2}} \\&#xA;&amp;amp;= \mathrm{FFT}_{N/2}(x_{even})+e^{-2\pi j k/N}\mathrm{FFT}_{N/2}(x_{odd})&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the following holds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_{even}(m)=x(2m)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x_{odd}(m)=x(2m+1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can form the imaginary signal from both:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{x}(m)=x_{even}(m)+jx_{odd}(m)$$&#xA;for $m=0\ldots N/2-1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the FFT of that complex sequence:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{X}=\mathrm{FFT}_{N/2}(\hat{x})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can extract corresponding FFT's of both even and odd part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_{even}(k)=\frac{\hat{X}(k)+\hat{X}(N/2-k)^*}{2}$$&#xA;$$X_{odd}(k)=-j\frac{\hat{X}(k)-\hat{X}(N/2-k)^*}{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And combine them using a butterfly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(k)=X_{even}(k)+e^{-2\pi j k /N}X_{odd}(k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that those values are for $k=0\ldots N/2-1$. The missing value for $N/2$ can be obtained knowing the symmetry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X(N/2)=\frac{[\hat{X}(0)+\hat{X}^*(0)]+j[\hat{X}(0)-\hat{X}^*(0)]}{2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that gives you the final result.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-04-18T10:20:25.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30190" PostTypeId="2" ParentId="30149" CreationDate="2016-04-18T12:43:48.173" Score="3" Body="&lt;p&gt;One way to do this is to look at modeling your signal:&#xA;$$&#xA;x[n] = x_h[n] + x_n[n]&#xA;$$&#xA;where $x_h$ is the hissing sound and $x_n$ is the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can say that $x_n$ is modeled as:&#xA;$$&#xA;x_n[n] = \sum_{k=K_1}^{K_2} a_k \sin(k\omega_0 n + \phi_k)&#xA;$$&#xA;where $K_1$ is the lowest harmonic of frequency $\omega_0$ that makes it through your high pass filter, $K_2$ is the highest harmonic, $a_k$ is the amplitude of the $k^{\rm th}$ harmonic, $\omega_0$ is the fundamental frequency and $\phi_k$ is the absolute phase of the $k^{\rm th}$ harmoninc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can estimate $(a_k,\omega_0, \phi_k)$ by minimizing&#xA;$$&#xA;\left| x[n] - \sum_{k=K_1}^{K_2} a_k \sin(k\omega_0 n + \phi_k) \right|^2&#xA;$$&#xA;to find $(\hat{a}_k,\hat{\omega}_0, \hat{\phi}_k)$ and then look at the residual:&#xA;$$&#xA;\hat{x}_h[n] = x[n] - \sum_{k=K_1}^{K_2} \hat{a}_k \sin(k\hat{\omega}_0 n + \hat{\phi}_k)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should allow some cancellation of the harmonic background noise, but won't be real time.  &lt;a href=&quot;https://www.researchgate.net/publication/236334712_Real_Time_PC_Implementation_of_Power_Quality_Monitoring_System_Based_on_Multiharmonic_Least-Squares_Fitting&quot; rel=&quot;nofollow&quot;&gt;There are algorithms that can do the estimation in real-time&lt;/a&gt;, but you're best trying this first on recorded data to see if it works.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-18T12:43:48.173" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30193" PostTypeId="1" AcceptedAnswerId="30194" CreationDate="2016-04-18T15:58:23.413" Score="3" ViewCount="296" Body="&lt;p&gt;What do you call it when you add zeros between the elements of a vector?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;let's say you have &lt;code&gt;x =[1 2 3 4]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;code&gt;x_2 = [0 1 0 2 0 3 0 4]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what do you call this process? &lt;/p&gt;&#xA;" OwnerUserId="11988" LastEditorUserId="80" LastEditDate="2016-11-15T09:46:24.050" LastActivityDate="2016-11-15T09:46:24.050" Title="What do you call it when you add zeros between the elements of a vector?" Tags="|terminology|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30194" PostTypeId="2" ParentId="30193" CreationDate="2016-04-18T16:09:34.957" Score="6" Body="&lt;p&gt;In the context of filter banks, simply &lt;a href=&quot;https://en.wikipedia.org/wiki/Upsampling&quot; rel=&quot;noreferrer&quot;&gt;upsampling&lt;/a&gt; (without filtering, or with the trivial all-pass filter, as Wikipedia relates it to interpolation), denoted by an up-arrow, as illustrated below fro a 2-fold or order-2 upsampling:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c6as4.gif&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c6as4.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is described in &lt;a href=&quot;https://en.wikipedia.org/wiki/Filter_bank#Decimation.2C_Interpolation.2C_and_Modulation&quot; rel=&quot;noreferrer&quot;&gt;Filter banks: Decimation, Interpolation, and Modulation&lt;/a&gt;, and the  interpolation filter associated with upsampling is called synthesis filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As noted by @Jason R, one also finds &quot;expansion&quot;. Expansion is also found as &lt;a href=&quot;http://www.dspguide.com/ch10/4.htm&quot; rel=&quot;noreferrer&quot;&gt;a streching for continuous signals&lt;/a&gt;, while compression is the effect in the dual Fourier domain. Sometimes, one can find &quot;zero-insertion&quot; or &quot;zero-stuffing&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually in image processing some use &quot;upsampling&quot; as a proxy for pixel increase with filtering.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-04-18T17:06:00.923" LastActivityDate="2016-04-18T17:06:00.923" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30195" PostTypeId="1" AcceptedAnswerId="30220" CreationDate="2016-04-18T20:24:48.080" Score="1" ViewCount="443" Body="&lt;p&gt;What is the difference between image scrambling and image encryption or are they the same thing in the context of image processing? What about in communication systems in general?&lt;/p&gt;&#xA;" OwnerUserId="11664" LastActivityDate="2016-04-20T09:12:01.367" Title="Image Scrambling versus Image Encryption" Tags="|image-processing|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30196" PostTypeId="1" CreationDate="2016-04-18T22:15:02.450" Score="2" ViewCount="4908" Body="&lt;p&gt;I'm new to Discrete Cosine Transform (DCT) and I have a question relating to basis functions.&#xA;In DCT, basis functions are defined by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha_p\alpha_q\cos\frac{\pi&#xA;\left(2m+1\right)p}{2M}\cos\frac{\pi&#xA;\left(2n+1\right)q}{2N},\quad \begin{align}0&amp;amp;\leq p\leq M-1\\0&amp;amp;\leq q\leq N-1\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $M = N = 64$, we'll have $64$ basis functions. These functions have two variables including $p$ and $q$. Now, to verify, I take the first basis function with $m = n = 0$. Clearly, this function changes with different values of $p$ and $q$. Why it's drawn with same color in the following image (the upper left gray square)?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nV6yD.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nV6yD.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="17842" LastEditorUserId="1629" LastEditDate="2016-04-18T23:12:35.317" LastActivityDate="2016-04-18T23:25:16.207" Title="Basis functions in DCT" Tags="|image-processing|dct|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30198" PostTypeId="2" ParentId="30196" CreationDate="2016-04-18T23:25:16.207" Score="3" Body="&lt;p&gt;Because the upper left square would correspond to values of $p=0$ and $q=0$, and $cos(\alpha) = 1 $ if $\alpha=0$, so you get a constant term, that is why it is all gray.&#xA;Basically as you increment $p$ and $q$ you get basis images that oscillate more either in vertical or horizontal directions.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2016-04-18T23:25:16.207" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30200" PostTypeId="1" AcceptedAnswerId="30212" CreationDate="2016-04-19T01:11:59.750" Score="9" ViewCount="6201" Body="&lt;p&gt;I have been studying signal processing and control for a while now, and I use Laplace and Fourier transforms almost everyday. Also another tools such as Nyquist or Bode plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I had never thought of this until today: what is the &lt;em&gt;physical&lt;/em&gt; meaning of a complex number when dealing with frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may sound silly, but I was asked this question and I didn't know what to answer. Why do we talk about $j\omega$ and not just $\omega$ in, for example, Fourier transforms and Bode or Nyquist plots? What is the physical sense of the real and imaginary part of a zero or a pole in the Laplace domain?&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2020-02-02T18:27:59.490" Title="What's the meaning of a complex zero/pole?" Tags="|frequency-domain|laplace-transform|" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30201" PostTypeId="2" ParentId="30200" CreationDate="2016-04-19T05:42:20.993" Score="1" Body="&lt;p&gt;Laplace transforms can be used to predict a circuit's behavior. The Laplace transform takes a time-domain function $f(t)$, and transforms it into the function $F(s)$ in the $s$-domain. You can view the Laplace transforms $F(s)$ as ratios of polynomials in the $s$-domain. If you find the real and complex roots (poles) of these polynomials, you can get a general idea of what the waveform $f(t)$ will look like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, as shown in this table, if the roots are real, then the waveform is exponential. If they’re imaginary, then it’s a combination of sines and cosines. And if they’re complex, then it’s a damping sinusoid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of that comes from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;nofollow&quot;&gt;Euler's formula&lt;/a&gt; and the definition of &lt;strong&gt;Fourier series&lt;/strong&gt; which is a way to represent a (wave-like) function as the sum of simple sine waves.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastEditorUserId="1629" LastEditDate="2016-04-19T06:52:28.603" LastActivityDate="2016-04-19T06:52:28.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30203" PostTypeId="1" CreationDate="2016-04-19T07:11:37.303" Score="5" ViewCount="1592" Body="&lt;p&gt;I am new to image processing and I am interested how image masking can be used to extract a portion of a image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at &lt;a href=&quot;http://docs.opencv.org/3.1.0/d1/db7/tutorial_py_histogram_begins.html#gsc.tab=0&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; OpenCV tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the section Application of Mask, they say that you can use a white mask over the area of the image you want to extract.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am interested in how this math works. &lt;strong&gt;Correct me if I am wrong but if I take the minimum of the pixel from the original pixel and the mask I should get the portion of the portion of the image I want to extract.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works because the area that I want to extract is covered by the white area of the mask, ie covered by pixels with 255 in all channels, so&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;min(pixel, 255) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will always give me the pixel value,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while on the other hand the portions I don't want are covered by black pixels(intensity value of 0), so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;min(pixel, 0)&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;will always give me 0 thus I will exclude these sections from my filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This my intuition correct ? Is this how image masking works in order to extract the image ?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="20614" LastEditorUserId="8764" LastEditDate="2017-03-17T11:34:00.543" LastActivityDate="2021-08-24T08:04:45.510" Title="How does image masking work?" Tags="|image-processing|image-segmentation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30205" PostTypeId="2" ParentId="30203" CreationDate="2016-04-19T11:23:34.150" Score="3" Body="&lt;p&gt;You may interpret it this way, but this yields a limited interpretation, because for instance the image may have a maximum different from $255$. &#xA;I consider masking as a product operation. For a binary mask, the values are $0$ and $1$. Thus if $p$ denotes one pixel value, you get $0\times p = 0$ outside the mask, and $1\times p = p$ inside. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way, you do not depend on the range of the image anymore. The product can be interpret as the binary &lt;code&gt;AND&lt;/code&gt; operation, as you can see in &lt;a href=&quot;https://en.wikipedia.org/wiki/Mask_(computing)#Image_masks&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image masks&lt;/a&gt;. The relation between &lt;code&gt;min&lt;/code&gt;, &lt;code&gt;max&lt;/code&gt; and products could be understood in the more global framework of &lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice_(order)&quot; rel=&quot;nofollow noreferrer&quot;&gt;lattices&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_algebra&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boolean algebras&lt;/a&gt;, which are useful in mathematical morphology, and help you define other types of useful masks.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more continuous operations on &quot;real-valued&quot; images, you can use masks with values in $[0,1]$, whose product with the image allows dimming between white and black mask areas, using intermediate values. For instance in the following, the mask   masks the left part of an image (black mask values), keep the right part, and  affects attenuated values (smooth transition) in the central part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/D2QZL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/D2QZL.jpg&quot; alt=&quot;grayscale mask&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-07-19T05:01:18.857" LastActivityDate="2016-07-19T05:01:18.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30206" PostTypeId="1" CreationDate="2016-04-19T14:48:50.570" Score="0" ViewCount="195" Body="&lt;p&gt;I am interested in extracting specific timechange information from an mp4 1900x1200 20fps video.The only pixels I want to process can be found in its borders. Therefore I only need to process approximately 6200 pixels/frame. I am using Matlab and VideoReader function, which is terribly slow. Is there a way to extract only one pixel from each frame of the video throughout its duration, in order to speed up the process? Or am I obliged to load the whole frame? To rephrase the question, if the video is considered to be a mxnxt complex array and the frames are mxn size, can I get a 1x1xt stream instead of mxnx1? I tried to bruteforce by finding information considering the way mp4 is encoded, with no success. If I changed the video encoding or used any other program would that be possible?&lt;/p&gt;&#xA;" OwnerUserId="20618" LastEditorUserId="13320" LastEditDate="2016-11-21T13:12:54.097" LastActivityDate="2016-11-21T13:12:54.097" Title="How to extract pixel-specific time-stream from mp4 video" Tags="|matlab|video|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30208" PostTypeId="2" ParentId="30103" CreationDate="2016-04-19T15:11:59.810" Score="2" Body="&lt;p&gt;So let's assume your model is:&#xA;$$&#xA; \textbf{x}_{k} = \textbf{x}_{k-1} +  \textbf{n}_k  &#xA;$$&#xA;where &#xA;$$&#xA;\textbf{n}_k = &#xA;\left(\begin{matrix}&#xA;n_x \\&#xA;n_y \\&#xA;n_z \\&#xA;\end{matrix}\right)&#xA;$$&#xA;and each of the $n_x,n_y,n_z$ are independent, zero-mean Gaussian noise terms with variances $\sigma^2_{nx},\sigma^2_{ny},\sigma^2_{nz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output equation is then:&#xA;$$&#xA;\textbf{z}_k = \textbf{f}(\textbf{x}_k) +  \textbf{m}_k = \left(\begin{matrix}&#xA;p_x^2 \\&#xA;p_y^2 \\&#xA;p_z^2 \\&#xA;\end{matrix}\right)  &#xA;+  \textbf{m}_k  &#xA;$$&#xA;where &#xA;$$&#xA;\textbf{m}_k = &#xA;\left(\begin{matrix}&#xA;m_x \\&#xA;m_y \\&#xA;m_z \\&#xA;\end{matrix}\right)&#xA;$$&#xA;and each of the $m_x,m_y,m_z$ are independent, zero-mean Gaussian noise terms with variances $\sigma^2_{mx},\sigma^2_{my},\sigma^2_{mz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So following the EKF Wikipedia page, that means:&#xA;$$&#xA;\textbf{F}_{k-1} = \textbf{I}\\&#xA;\textbf{H}_{k} = {\tt diag}(2\textbf{x}_k)&#xA;$$&#xA;where ${\tt diag}$ creates a square matrix from the vector argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementing this in R (code below) shows the follow example of the true state and the state estimate.  As you can see, it has some problems because the output equation masks the sign of the state (that's why the top plot shows a mirror image around the zero axis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OSQAA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OSQAA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30103&#xA;&#xA;# First, construct the signal model and generate the data.&#xA;T &amp;lt;- 1000&#xA;&#xA;sigma_n &amp;lt;- 0.1&#xA;n_k &amp;lt;- array(rnorm(T*3,0, sigma_n), c(3,T))&#xA;&#xA;sigma_m &amp;lt;- 0.1&#xA;m_k &amp;lt;- array(rnorm(T*3,0, sigma_m), c(3,T))&#xA;&#xA;F &amp;lt;- array(c(1,0,0, 0, 1, 0, 0, 0,1),c(3,3))&#xA;&#xA;x_0 &amp;lt;- array(1,c(3,1))&#xA;x &amp;lt;- array(0,c(3,T))&#xA;x[,1] &amp;lt;- x_0&#xA;&#xA;z &amp;lt;- array(0,c(3,T))&#xA;&#xA;&#xA;for (k in 2:T)&#xA;{&#xA;  x[,k] &amp;lt;- F %*% x[,k-1] + n_k[,k]&#xA;  z[,k] &amp;lt;- `^`(x[,k],2) + m_k[,k]&#xA;}&#xA;&#xA;&#xA;# Next, form the EKF&#xA;H &amp;lt;- 2* array(c(1,0,0, 0, 1, 0, 0, 0,1),c(3,3))&#xA;&#xA;Q &amp;lt;- sigma_m^2*array(c(1,0,0, 0, 1, 0, 0, 0,1),c(3,3))&#xA;R &amp;lt;- sigma_n^2*array(c(1,0,0, 0, 1, 0, 0, 0,1),c(3,3))&#xA;&#xA;library(&quot;MASS&quot;) # For pseudo inverse ginv()&#xA;&#xA;xkm1km1 &amp;lt;- matrix(rep(0,3*T+3),3,T+1)&#xA;xkm1km1[,1] &amp;lt;- x_0&#xA;&#xA;xkkm1 &amp;lt;- matrix(rep(0,3*T),3,T)&#xA;K &amp;lt;- array(rep(0,3*3*T),c(3,3,T))&#xA;Pkm1km1 &amp;lt;- array(0,c(3,3,T+1))&#xA;Pkm1km1[,,1] &amp;lt;- array(c(1000,0,0 ,0,1000,0, 0,0,1000), c(3,3))&#xA;&#xA;zhat &amp;lt;- matrix(rep(0,3*T),c(3,T))&#xA;err &amp;lt;-  matrix(rep(0,3*T),c(3,T))&#xA;&#xA;for (k in 2:T)&#xA;{  &#xA;  xkkm1[,k] &amp;lt;- F %*% xkm1km1[,k-1]&#xA;  Pkkm1 &amp;lt;- F %*% Pkm1km1[,,k-1] %*% t(F) + Q&#xA;&#xA;  H &amp;lt;- 2*diag(xkkm1[,k])&#xA;&#xA;  K[,,k] &amp;lt;- Pkkm1 %*% t(H) %*% ginv( H %*% Pkkm1 %*% t(H) + R)&#xA;  err[,k] &amp;lt;- z[,k] - H %*% xkkm1[,k]&#xA;  xkm1km1[,k] &amp;lt;- xkkm1[,k] + K[,,k] %*% err[,k]&#xA;  Pkm1km1[,,k] &amp;lt;- (matrix(c(1,0,0,0,1,0,0,0,1),3,3) - K[,,k] %*% H) %*% Pkkm1  &#xA;  zhat[,k] &amp;lt;- as.numeric(H %*% xkkm1[,k])&#xA;}&#xA;&#xA;&#xA;p1 &amp;lt;- x&#xA;p2 &amp;lt;- xkm1km1&#xA;lims &amp;lt;- c(-5,5)&#xA;par(mfrow = c(3,1), pty=&quot;m&quot;)&#xA;plot(p1[1,], col=&quot;grey&quot;,ylim=lims)&#xA;lines(p2[1,], col=&quot;red&quot;)&#xA;title(&quot;True (grey) and Estimated (red) State p_x&quot;)&#xA;plot(p1[2,], col=&quot;grey&quot;,ylim=lims)&#xA;lines(p2[2,], col=&quot;red&quot;)&#xA;title(&quot;True (grey) and Estimated (red) State p_y&quot;)&#xA;plot(p1[3,], col=&quot;grey&quot;,ylim=lims)&#xA;lines(p2[3,], col=&quot;red&quot;)&#xA;title(&quot;True (grey) and Estimated (red) State p_z&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-19T18:22:01.390" LastActivityDate="2016-04-19T18:22:01.390" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30210" PostTypeId="1" CreationDate="2016-04-19T15:42:57.993" Score="12" ViewCount="1027" Body="&lt;p&gt;I'm working on a project of applying &lt;a href=&quot;http://person.hst.aau.dk/lasse/teaching/IACV/doc/asm_overview.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Active Shape Model&lt;/a&gt;  to locate tooth in dental radiograph. For those familiar with the technique, I'm currently trying to sample along normal vectors for each landmark. The paper recommends to take derivatives of sampled pixels: &quot;To reduce effects of global intensity changes we sample the derivative along the profile, rather than the absolute grey-level values.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my problem is how to filter dental radiographs in the best way to prepare them for applying derivative operator. I'm currently using combination of &lt;a href=&quot;http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html#medianblur&quot; rel=&quot;nofollow noreferrer&quot;&gt;median filter&lt;/a&gt; to remove most of what I think is quantum noise (mottle). It is followed by &lt;a href=&quot;http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html#bilateralfilter&quot; rel=&quot;nofollow noreferrer&quot;&gt;bilateral filter&lt;/a&gt;. Then I apply &lt;a href=&quot;http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html#scharr&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scharr operator&lt;/a&gt; to compute the actual gradient which should be sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results are presented below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VYmPL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VYmPL.png&quot; alt=&quot;Results&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first image shows original data. In the second and third image, filtered data are presented, first as a magnitude of spectrum after FFT and then as a filtered image data. Fourth image show result of applying Scharr operator to third image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are there a well known approaches for reducing noise in dental radiograph that would differ from my approach?&lt;/li&gt;&#xA;&lt;li&gt;What is causing the &quot;smoky&quot; appearance of the edges and &quot;flat&quot;(non-edge) areas? Is it some kind of leftover noise in the filtered image or is it inherent to the gradient operator? If it is indeed a noise, which filter would be most suitable to use? Median filter was good at removing small noisy blobs but large kernel causes the edges to blur out too much. So bilateral filter is used to filter out larger blobs and equalize color over area without harming edges, but it is not able to filter this smoky structure.&lt;/li&gt;&#xA;&lt;li&gt;Is there a better option than Scharr operator to create gradient in this case?&lt;/li&gt;&#xA;&lt;li&gt;Bonus: Would this be considered a good input for Active Shape Model? I'm not yet aware how robust they are.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15602" LastEditorUserId="128" LastEditDate="2022-10-21T17:50:41.157" LastActivityDate="2022-10-21T17:50:41.157" Title="Removing Noise from Dental Radiography" Tags="|computer-vision|image-processing|denoising|object-recognition|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30211" PostTypeId="2" ParentId="30206" CreationDate="2016-04-19T17:52:14.510" Score="1" Body="&lt;p&gt;In video, pixels are not usually encoded independently; you will need to decode full frames. If you are going to run several experiments on a single video, I would suggest that you decode the video once frame-by-frame and write the border pixels into a file in your own raw format for easy access. This should give a manageable file size perhaps of a few gigabytes for a movie-length video.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-04-19T18:00:05.690" LastActivityDate="2016-04-19T18:00:05.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30212" PostTypeId="2" ParentId="30200" CreationDate="2016-04-19T19:53:27.637" Score="4" Body="&lt;p&gt;We usually talk of $j\omega$ when we're also interested in the Laplace transform of a signal / system, but want to just talk about the frequency response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physical meaning of the imaginary part is that it refers to purely sinusoidal signals and are constant &quot;amplitude&quot;. The real part refers to signals for which the &quot;amplitude&quot; decays or grows exponentially.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-19T19:53:27.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30213" PostTypeId="1" CreationDate="2016-04-20T00:14:58.997" Score="2" ViewCount="2115" Body="&lt;p&gt;I would like a simplified measure to quantify spikes in my time series, I have one series that has many and I would like to compare it to another that has very few. I have thought through several options for example fitting a sine wave and looking at the R values as a measure of smoothness etc but I thought that a measure of the Coefficient of variation of the differences in the series may be suitable. I was wondering if this was a good approach and also as the mean values of the differences are very small I was wondering if theres a common alternative for the CV which of course would become meaningless. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also just to mention that there is no proportionality between the means and standard deviations of the data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to ask this question would be if anyone had suggestions for the inverse, a successful measurement of smoothness? or a way to summarise jerking in the data&lt;/p&gt;&#xA;" OwnerUserId="8478" LastEditorUserId="8478" LastEditDate="2016-04-20T18:14:07.420" LastActivityDate="2016-04-20T18:14:07.420" Title="Spikes in time series" Tags="|time-series|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30214" PostTypeId="2" ParentId="30213" CreationDate="2016-04-20T00:52:43.423" Score="5" Body="&lt;p&gt;I would try a median filter.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Let your original signal be $f[n]$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Median filter $f[n]$ using $N$ pixels, where $N &amp;gt; 2 \times S + 1$, where $S$ is the maximum number of samples in the spike. The resulting signal, lets call it $g[n]$ should have all the spikes removed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the absolute of the difference between the two signals, $h[n] = |f[n] - g[n]|$. This signal represents the spikes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Count the number of positive transitions in $h[n]$ that are above a threshold. This is the number of spikes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original signal $f[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GCPt5.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GCPt5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Median filtered signal $g[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nYZzn.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nYZzn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Absolute difference $h[n]$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VDCav.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VDCav.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-04-20T00:52:43.423" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="30218" PostTypeId="1" CreationDate="2016-04-20T07:26:20.090" Score="1" ViewCount="1353" Body="&lt;p&gt;I'm getting some accelerometer readings from an Android phone, but it comes in on the phone's coordinate system. I want to apply a transformation to put the acceleration in the world coordinate system (e.g. so Y will always be up and down, regardless of how the phone is rotated)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Android allows you to get the accelerometer values. It can also calculate a rotation matrix (using a gyroscope and a magnetic sensor), so all I need to do is multiple the acceleration vector through by this matrix and I have transformed values. I followed the steps here: &lt;a href=&quot;https://stackoverflow.com/questions/14963190/calculate-acceleration-in-reference-to-true-north&quot;&gt;https://stackoverflow.com/questions/14963190/calculate-acceleration-in-reference-to-true-north&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are 3 sensors at play here: acceleration, gyro, magnetic. The way android operates is event based, so whenever it detects a change in any of these sensors, it will give you back a value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given these are 3 different sensors, the events for each one is very likely to come in at different times, and you may get more readings from one sensor than another within some time period&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, does varying amounts of spacing between readings for the 3 different sensors matter for doing coordinate system transformations? And if so, what is the best solution for doing this type of transformation with event based sensors?&lt;/p&gt;&#xA;" OwnerUserId="16842" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:34.000" LastActivityDate="2017-08-23T12:40:19.913" Title="Accelerometer - coordinate system transformation" Tags="|transform|matrix|3d|sensor|motion|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30219" PostTypeId="1" CreationDate="2016-04-20T08:23:14.793" Score="8" ViewCount="6647" Body="&lt;p&gt;In &lt;a href=&quot;http://www.eecs.berkeley.edu/~mlustig/CS/SparseMRI.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; of Lustig, he speaks about a something which appears unintuitive: sampling at random may exhibit better performance than sampling uniformly. I tried to understand this starting from page 15 of &lt;a href=&quot;http://www.eecs.berkeley.edu/~mlustig/CS/cs_slides.pdf&quot; rel=&quot;noreferrer&quot;&gt;these slides&lt;/a&gt;, but I can't really make sense of anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why, if we take random permutation of frequency coefficients, do we get a better reconstruction in terms of signal similarity? Why does this give better reconstruction, and what's the intuition behind the phenomenon?&lt;/p&gt;&#xA;" OwnerUserId="18390" LastActivityDate="2016-06-19T16:25:02.967" Title="Random sampling vs uniform sampling" Tags="|signal-analysis|sampling|downsampling|random|reconstruction|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30220" PostTypeId="2" ParentId="30195" CreationDate="2016-04-20T09:12:01.367" Score="1" Body="&lt;p&gt;Scrambling is used for making a signal more white (I mean flat spectrum). Encryption is used for protecting the data from unauthorized listener. If you just scramble the data it is quite easy for a professional to descramble it and obtain the source image, but if you encrypt it then it is difficult or impossible to reverse it for someone without the code. &lt;/p&gt;&#xA;" OwnerUserId="20584" LastActivityDate="2016-04-20T09:12:01.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30221" PostTypeId="1" AcceptedAnswerId="30222" CreationDate="2016-04-20T10:00:36.137" Score="1" ViewCount="460" Body="&lt;p&gt;Will constantly randomizing the phase of an audio signal, say a speaker in the corner of a square room, reduce standing waves (i.e. room modes) in the room? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if you wanted to create a diffuse field (i.e. no standing wave interference patterns) in a small room at low frequencies.&lt;/p&gt;&#xA;" OwnerUserId="19949" LastEditorUserId="19949" LastEditDate="2016-04-20T10:48:47.287" LastActivityDate="2016-04-20T12:13:06.157" Title="Reducing standing waves with phase randomization" Tags="|phase|resonance|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30222" PostTypeId="2" ParentId="30221" CreationDate="2016-04-20T11:34:36.407" Score="2" Body="&lt;p&gt;Assuming that you are not changing the phase too much, you are basically turning sinusoids to narrow-band noise. If there is a room frequency response node that strongly attenuates a sinusoid, the total power of narrow-band noise centered at the same frequency will not be attenuated as much. It will survive with a dip in its spectrum. Room modes or frequency response peaks are usually not as severe and narrow as frequency response nodes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qZoJ0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qZoJ0.png&quot; alt=&quot;An example speaker and room magnitude frequency response (CC-BY-SA 3.0 by Gregory Maxwell)&quot;&gt;&lt;/a&gt;&#xA;&lt;br&gt;&lt;em&gt;An example speaker and room magnitude frequency response (CC-BY-SA 3.0 by Gregory Maxwell)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I wonder if your application affords the degradation of audio quality due to the modulation. Also, the room frequency response is not affected so if the test audio is noise, you won't get any sort of improvement.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-04-20T12:13:06.157" LastActivityDate="2016-04-20T12:13:06.157" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30223" PostTypeId="1" AcceptedAnswerId="30248" CreationDate="2016-04-20T12:06:20.560" Score="5" ViewCount="27555" Body="&lt;p&gt;I am trying to make FFT simulation in Matlab by generating noise added&#xA;two sinus waves in 60Hz and 100Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After adding the noise into these signals then I have applied the FFT&#xA;as I put my Matlab code below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am in difficulty interpreting the FFT plot which shows two spectral peaks in the plot diagram below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please explain how to interpret this spectrum?&#xA;Why we see two peaks in the spectrum? How can we reduce the spectral to show only the frequencies of 60Hz and 100Hz? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%%%% Noise_Added_Two_Sinus%%%&#xA;&amp;gt;&amp;gt; f1=60;&#xA;&amp;gt;&amp;gt; f2=100;&#xA;&amp;gt;&amp;gt; fs=512;&#xA;&amp;gt;&amp;gt; t=0:1/fs:2-1/fs;&#xA;&amp;gt;&amp;gt; x1=2.4*sin(2*pi*f1*t);&#xA;&amp;gt;&amp;gt; x2=0.96*sin(2*pi*f2*t);&#xA;&amp;gt;&amp;gt; y=x1+x2+randn(size(t));&#xA;&amp;gt;&amp;gt; F=fft(y);&#xA;&amp;gt;&amp;gt; plot(abs(F))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WJWwP.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WJWwP.jpg&quot; alt=&quot;Spectrum of two Sin waves&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9014" LastEditorUserId="80" LastEditDate="2016-04-20T12:08:54.827" LastActivityDate="2016-12-19T21:19:03.140" Title="Two-Sided Frequency Spectrum" Tags="|fft|frequency-spectrum|fourier|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30224" PostTypeId="2" ParentId="30223" CreationDate="2016-04-20T12:30:33.820" Score="1" Body="&lt;p&gt;The Fourier transform of a real-valued signal has Hermitian Symmetry to $f=0$. Always.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a direct result of applying the Fourier transform. This really should not surprise you; if it does, I can only encourage you to manually calculate the Fourier transform of e.g. $\cos(2\pi f_{0} t)$ by considering the trigonometric functions as sum of complex oscillations, i.e. considering &lt;em&gt;Euler's formula&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align*}&#xA;\cos(t) &amp;amp;= \frac 12 \left(e^{it}+e^{-it}\right)\\&#xA;\mathcal{F}\left\{\cos(t)\right\}&amp;amp;= \int\limits_{-\infty}^{\infty}\cos(t)e^{i2\pi f t}\,dt\\&#xA;&amp;amp;=\frac12\int\limits_{-\infty}^{\infty}\left(e^{it}+e^{-it}\right)e^{i2\pi f t}\,dt\tag{*}&#xA;\end{align*}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last line shows that the result of the integral must be conjugate-symmetrical to $f=0$.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-04-20T14:30:31.537" LastActivityDate="2016-04-20T14:30:31.537" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30225" PostTypeId="2" ParentId="30219" CreationDate="2016-04-20T14:47:00.333" Score="5" Body="&lt;p&gt;The key idea is that the random sampling approach enforces more constraints on the resulting signal than the uniform sampling approach does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The POCS (projections onto convex sets) algorithm used for the reconstruction of the randomly sampled signal is the key piece: it enforces:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;That the signal must be from this spectrum.&lt;/li&gt;&#xA;&lt;li&gt;That the signal is real-valued.&lt;/li&gt;&#xA;&lt;li&gt;What we know about the signal's spectrum (the randomly sampled Fourier coefficients).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;What we know about the signal's time-domain form.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The uniform sampling approach makes no attempt to enforce the &lt;strong&gt;bold&lt;/strong&gt; constraint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example which shows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Top left: Uniform undersampling and reconstruction using the FFT only.&lt;/li&gt;&#xA;&lt;li&gt;Top right: Random undersampling and reconstruction using the FFT only.&lt;/li&gt;&#xA;&lt;li&gt;Bottom left: Reconstruction using POCS&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As you can see, that final constrain really improves the reconstruction hugely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wrjQn.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wrjQn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30219&#xA;&#xA;T &amp;lt;- 128&#xA;N &amp;lt;- 5&#xA;&#xA;x &amp;lt;- rep(0, T)&#xA;x[sample(T,N)] &amp;lt;- rep(1,N)&#xA;&#xA;X &amp;lt;- fft(x);&#xA;Xu &amp;lt;- rep(0, T)&#xA;Xu[seq(1,T,4)] &amp;lt;- X[seq(1,T,4)];&#xA;xu &amp;lt;- fft(Xu, inverse = TRUE)*4/T;&#xA;&#xA;par(mfrow=c(2,2))&#xA;plot(x, type=&quot;l&quot;, lwd = 5, ylim = c(0,1.2))&#xA;lines(abs(xu), col=&quot;red&quot;)&#xA;title('Original (black) &amp;amp; reconstructed\n from uniform undersampling (red)')&#xA;&#xA;Xr &amp;lt;- rep(0,T)&#xA;r_ix &amp;lt;- sample(T,T/4)&#xA;Xr[r_ix] &amp;lt;- X[r_ix]&#xA;xr &amp;lt;- fft(Xr, inverse = TRUE)*4/T&#xA;&#xA;plot(x, type=&quot;l&quot;, lwd = 5, ylim = c(0,1.2))&#xA;lines(abs(xr), col=&quot;red&quot;)&#xA;#lines(Re(xr), col=&quot;blue&quot;)&#xA;#lines(Im(xr), col=&quot;green&quot;)&#xA;title('Original (black) &amp;amp; reconstructed\n from non-uniform undersampling (red)')&#xA;&#xA;#soft thresh function&#xA;&#xA;softThresh &amp;lt;- function(vals_to_threshold, lambda)&#xA;{&#xA;  ix &amp;lt;- which(abs(vals_to_threshold) &amp;lt; lambda)&#xA;  vals_to_threshold[ix] &amp;lt;- rep(0, length(ix))&#xA;&#xA;  ix &amp;lt;- which(vals_to_threshold &amp;gt;= lambda)&#xA;  vals_to_threshold[ix] &amp;lt;- vals_to_threshold[ix] - lambda&#xA;&#xA;  ix &amp;lt;- which(vals_to_threshold &amp;lt;= -lambda)&#xA;  vals_to_threshold[ix] &amp;lt;- vals_to_threshold[ix] + lambda&#xA;&#xA;  return(vals_to_threshold)&#xA;}&#xA;&#xA;# POCS&#xA;lambda &amp;lt;- 0.1&#xA;Xhat &amp;lt;- Xr&#xA;for (iteration in seq(1,100))&#xA;{&#xA;  # 1. Compute the inverse FT to get estimate&#xA;  xhat &amp;lt;- Re(fft(Xhat, inverse = TRUE)/T)&#xA;  # 2. Apply Softrhesh in the time domain&#xA;  xhat &amp;lt;- softThresh(xhat, lambda)&#xA;  # 3. Find the FFT&#xA;  Xhat &amp;lt;- fft(xhat)&#xA;  # 4. Enforce known values&#xA;  Xhat[r_ix] &amp;lt;- X[r_ix]&#xA;}&#xA;&#xA;plot(x, type=&quot;l&quot;, lwd = 5, ylim = c(0,1.2))&#xA;lines(xhat, col=&quot;red&quot;)&#xA;title('Reconstructed using POCS')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-20T14:58:03.630" LastActivityDate="2016-04-20T14:58:03.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30226" PostTypeId="1" AcceptedAnswerId="30227" CreationDate="2016-04-20T15:04:15.327" Score="0" ViewCount="273" Body="&lt;p&gt;According to &lt;a href=&quot;http://socserv.mcmaster.ca/magee/761_762/other%20material/unit%20and%20char%20roots.pdf&quot; rel=&quot;nofollow&quot;&gt;this paper&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$y(t)$ is stationary if all of the roots (of characteristic equation) lie outside the unit circle&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here, $y(t)$ is causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me it seems the case is exactly the opposite, the roots should be inside the unit circle for causal process to be stable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example, consider the difference equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y_t-5y_{t-1}+6y_{t-2}=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The characteristic equation is then: $$r^2-5r+6=0$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution for characteristic roots: $$r=2, r=3$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solution for the difference equation (assuming 1 as initial conditions): $$y(t)=2^t+3^t$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly the roots are outside the unit circle (as 1&amp;lt;2,3), and the process unstationary (as it grows with t). To me it seems that the 3rd equation in the paper should have negative exponent for zs (in which case the solution would be the same as mine, even if arrived through the z transform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, the claim appears in many places so it can't be wrong (I doubt the paper is wrong either). However, for LTI system to be stable the poles must be inside the circle, a other claim that is repeated everywhere. Is the statement just plain wrong or are these things somehow not equivalent?&lt;/p&gt;&#xA;" OwnerUserId="16605" LastEditorUserId="80" LastEditDate="2016-04-20T15:15:13.557" LastActivityDate="2016-04-20T15:15:13.557" Title="Z-transform of difference equations and stability of a process" Tags="|z-transform|stationary|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30227" PostTypeId="2" ParentId="30226" CreationDate="2016-04-20T15:11:58.137" Score="3" Body="&lt;p&gt;The paper deals in the lag operator $L$, rather than $z^{-1}$ as DSP people tend to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, all the DSP results you know are inverted. So &quot;inside the unit circle&quot; becomes &quot;outside the unit circle&quot;, black is white, and ... &lt;a href=&quot;https://www.goodreads.com/quotes/35681-now-it-is-such-a-bizarrely-improbable-coincidence-that-anything&quot; rel=&quot;nofollow&quot;&gt;avoid zebra crossings.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-20T15:11:58.137" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30228" PostTypeId="1" CreationDate="2016-04-20T15:21:16.567" Score="6" ViewCount="8720" Body="&lt;p&gt;I tried to read up and get a filter for a 3-axis accelerometer but this is more confusing than I thought.&#xA;I have an IMU with a 3-axis accelerometer on the end of a robot link which is rotated  around on one axis.&#xA;When at rest with just gravity acting on it I get these readings:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/p4bu1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p4bu1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lssuq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lssuq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now the band of the data is kinda broad and very noisy . I thought that at first I could maybe look at the frequency spectrum and cut out unwanted frequencies but honestly the FFT doesn't tell me anything I could remove. What does initial spike in the spectrum mean and and how would I put a high or low pass filter over the data if it looks like such a mess? Do I need to smooth it in some way?&lt;/p&gt;&#xA;&lt;p&gt;Preferable I would want a nice arc of the data which follows the movement of the end of the arm but I don't know how to achieve that. Could it be that the arm movement by the motor introduces too much noise?&lt;/p&gt;&#xA;&lt;p&gt;Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="20632" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-04-20T15:30:45.737" Title="Filter for noisy accelerometer data" Tags="|filters|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30229" PostTypeId="2" ParentId="30228" CreationDate="2016-04-20T15:30:45.737" Score="2" Body="&lt;p&gt;Most accelerometers suffer from &lt;em&gt;bias&lt;/em&gt; --- a non-zero, constant rest measurement. &lt;a href=&quot;http://www.digikey.com/en/articles/techzone/2012/jul/a-designers-guide-to-mems-sensors&quot; rel=&quot;nofollow noreferrer&quot;&gt;See, for example, this page.&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A further imperfection is called zero g bias level, or offset. This is the reading the sensor provides with no acceleration, and, unfortunately, that is rarely zero (in the Z direction it should be 1 g). In fact, the error can be substantial, frequently hundreds of times larger than the device’s resolution.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So you need to remove this DC offset (which is how the bias appears) from all your measurements.  If you need to know the $g$ value from the $z$ accelerometer, you will need to calibrate it first in the $x$ or $y$ plane (to remove the effect of gravity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/27471/80&quot;&gt;Have a read through this answer to another question&lt;/a&gt;, and try applying a &lt;a href=&quot;https://ccrma.stanford.edu/~jos/fp/DC_Blocker.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DC blocker&lt;/a&gt; to your data.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-04-20T15:30:45.737" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30230" PostTypeId="2" ParentId="22367" CreationDate="2016-04-20T15:54:33.417" Score="1" Body="&lt;p&gt;I find the diagonal term a bit confusing. Sometimes, for wavelets, people separate scalar and vector or block thresholding. [EDIT] Now I believe I understand it. If you put all your samples or coefficients in a long 1D vector, then multiplying it by a diagonal matrix yield a scalar operation. With non-diagonal, you allow cross-terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For structured signals,  or images, or transformed signals (in a wavelet or a time-frequency domain), neighboring samples or coefficients often possess some local correlations, that you want to exploit in denoising. So assume you have an observation $r(k)$ at location $k$ (could be multidimensional), and look for an estimator $\hat{s}(k)$ of some underlying signal $s(k)$, under a noisy model  $r(k) = s(k)+n(k)$. In the original domain, you could for instance apply a scalar mask $f(k)$ on the observation: $\hat{s}(k) = f(k).r(k)$, especially if you know that at some location you have signal, at other noise. Windowing is a typical example. More generally, you can apply a function $f$: $\hat{s}(k) = f(r(k))$. If you assume local correlations, you can borrow information for close samples. For instance, average filtering can be $\hat{s}(k) = \frac{1}{3}(r(k-1)+r(k)+r(k+1))$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, $f$ now apply over a domain, gathered in a vector $v(k)= [r(k-1),r(k),r(k+1)]$. It can be called Reference Observation Vector (ROV). Then  $\hat{s}(k) = f(v(k))$. So average filters are sort of non-diagonal processing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Traditionnaly with wavelets or time-frequency, the transform compacts or sparsifies noisy data, and data features tends to become relatively higher than  the noise, compared to the original domain. So the previous idea of a scalar mask works better. You can choose $f$ to keep the value of $r(k)$ if $|r(k)|$ is above a threshold $t$, and set it to zero if below. This $f$ is discontinuous.  let us write it $f(x) = \mathrm{sign}(x) (|x|-t)_+$&#xA;This is called scalar wavelet shrinkage or thresholding, scalar because you apply it on a single wavelet coefficient, illustrated in the center plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VfXPS.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VfXPS.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This idea was already used in the Fourier domain for noise reduction in speech. You can have smoother transistion, if you attenuate a bit the higher values, which give you soft thresholding, and you have many more shrinkage functions (garrote, firm) for scalar thresholding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next idea is to combine all of the above. You can modify one coefficient with respect to a certain norm of a surrounding $\|v(k)\|$, as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hat{s}(k) = f(\|v(k)\|)r(k).$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In wavelets, the ROV $v(k)$ can be more complicated. It can gather neighbors of the coefficients, but also coefficients from other scales. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rationale is that, if a coefficient is small, it might be useful to preserve it anyway. If its ROV has high norm (think of energy), the coefficient might small by mistake, and is not noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nice think is that the Stein Unbiased Risk Estimator theory allows you to estimate something on the signal $s(k)$ that you do not know by using only the observation $r(k)$, using some technical conditions, which allows you to find, automatically, the best threshold $t$, or shape paramaters of the function $f$. Such methods yielded almost the state-of-the-art on wavelet denoising. I am not familiar with audio. However, for multispectral images, here is an example: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a satellite image of the port of Tunis:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mY980.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mY980.png&quot; alt=&quot;dual-tree wavelet port of Tunis&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;its noisy version, with heavy Gaussian noise:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3Ki2A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Ki2A.png&quot; alt=&quot;dual-tree wavelet port of Tunis&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the denoised version:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/W4PEb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/W4PEb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While not perfect, it was able to recover details, almost invisible from the noisy image, with very few parameters to set (only the shape of the ROV). This answer is a short version of what you can read in  &lt;a href=&quot;http://arxiv.org/pdf/0712.2317&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Nonlinear Stein-Based Estimator for Multichannel Image Denoising&lt;/a&gt;, 2008.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why can  block denoising be better that scalar?  Because scalar is a specific case of block (non-diagonal) processing, if you take the ROV to be restricted to the coefficient $r(k)$ itself. If you choose the time-frequency or time-scale method well, and the other parameters (block shape and size), the block processing is generally (much) better.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-04-20T17:11:17.667" LastActivityDate="2016-04-20T17:11:17.667" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30232" PostTypeId="1" AcceptedAnswerId="30234" CreationDate="2016-04-20T16:49:38.520" Score="1" ViewCount="99" Body="&lt;p&gt;I've been tasked with creating an artificial neural network that can classify a telephone call as either answered by a human or an answering machine.&#xA;My knowledge of audio processing is, mildly put, limited. I'm quite new to machine learning as well, so feel free to question everything.  Here's what my run-of-the-mill backpropagation network looks like so far:&lt;br&gt;&#xA;1. 37 input units;&lt;br&gt;&#xA;2. One layer of 10 hidden units;&lt;br&gt;&#xA;3. One output unit.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An audio file comes in, and I extract the data like so [&lt;em&gt;X&lt;/em&gt;, &lt;em&gt;fs&lt;/em&gt;] = &lt;em&gt;wavread&lt;/em&gt;(&lt;em&gt;filename&lt;/em&gt;). Then, the 37 features I obtain are the following:&lt;br&gt;&#xA;1. The length of &lt;em&gt;X&lt;/em&gt;;&lt;br&gt;&#xA;2 - 21. In 5% increments, the mean of &lt;em&gt;X&lt;/em&gt; in each interval (I know);&lt;br&gt;&#xA;22. Spread;&lt;br&gt;&#xA;23. The mean of short-time energy;&lt;br&gt;&#xA;24. Zero crossing rate;&lt;br&gt;&#xA;25 - 37. The mean of each in a set of 13 MFCCs.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since I've obviously jumbled it all together, my question is the following: &lt;strong&gt;What do you think would be a good set of features for the problem at hand?&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your time&lt;/p&gt;&#xA;" OwnerUserId="20633" LastEditorUserId="20633" LastEditDate="2016-04-21T05:02:55.960" LastActivityDate="2016-04-21T05:02:55.960" Title="Answering Machine vs. Human -- Neural Network Features Selection" Tags="|speech-processing|machine-learning|neural-network|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30234" PostTypeId="2" ParentId="30232" CreationDate="2016-04-20T17:19:38.510" Score="2" Body="&lt;p&gt;I don't think that you would do this by feature extraction. Instead, I would train a many-to-one &lt;a href=&quot;https://en.wikipedia.org/wiki/Long_short-term_memory&quot; rel=&quot;nofollow&quot;&gt;LSTM&lt;/a&gt;, which classifies the input sequence as -1 or 1. For you, it is easy to collect a huge amount of labeled speech data, just by calling. Note that, the data size is important. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;LSTMs are very powerful techniques and should handle this problem gracefully.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastActivityDate="2016-04-20T17:19:38.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30235" PostTypeId="2" ParentId="30112" CreationDate="2016-04-20T21:46:48.657" Score="0" Body="&lt;p&gt;I recommend computing the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectrogram&quot; rel=&quot;nofollow&quot;&gt;spectrogram&lt;/a&gt; of the audio recording using the MATLAB function &lt;a href=&quot;http://de.mathworks.com/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;spectrogram()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fourth return value (&lt;code&gt;ps&lt;/code&gt; in the documentation page linked above) of the &lt;code&gt;spectrogram()&lt;/code&gt; function is a matrix of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Power_spectral_density&quot; rel=&quot;nofollow&quot;&gt;power spectral density&lt;/a&gt; estimates. This can be used to investigate how much energy there is at each frequency at each time instant. A tone of constant frequency results in a straight horizontal line, a short impulse in a vertical one. Most signals have much more complex spectrograms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the matrix as a two-dimensional image reveals a lot about the signal at hand. As the range of coefficient values in the spectrogram of an audio signal is usually quite large, it is a good idea to compress this range by computing the logarithm before plotting. The following code snippet will hopefully yield the image you had in mind - with &lt;code&gt;x&lt;/code&gt; your (single channel) audio signal and &lt;code&gt;fs&lt;/code&gt; the sampling rate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;L_block = 4096;&#xA;L_overlap = floor(L_block/2);&#xA;L_DFT = L_block;&#xA;[~,f,t,ps] = spectrogram(x, ...&#xA;    hann(L_block, 'periodic'), ...&#xA;    L_overlap, ...&#xA;    L_DFT, ...&#xA;    fs, ...&#xA;    'xaxis');&#xA;imagesc(t, f, 10*log10(ps));&#xA;axis xy;&#xA;ylim([20 600]); % zoom to the fundamental frequency range&#xA;xlabel('Time in s');&#xA;ylabel('Frequency in Hz');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To find out how much the pitch of the speaker varies, analyze the horizontal lines that you see. Experiment with the block length (&lt;code&gt;L_block&lt;/code&gt;), overlap length (&lt;code&gt;L_overlap&lt;/code&gt;) and the window (here: &lt;code&gt;hann()&lt;/code&gt;) to obtain optimum results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way: &lt;a href=&quot;https://plot.ly/matlab/stft/&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is another example on how to compute and display the spectrogram in MATLAB.&lt;/p&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2016-04-20T21:46:48.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30236" PostTypeId="1" AcceptedAnswerId="30270" CreationDate="2016-04-20T22:29:34.303" Score="2" ViewCount="1154" Body="&lt;p&gt;I am thinking about a simple mass-damper system response. Most single DOF systems show a frequency response plot that looks like this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JJCk7.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JJCk7.jpg&quot; alt=&quot;Common frequency response&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;Note how increasing the damping ratio always reduces the output response, and at high frequencies, the response approaches the same line regardless of damping ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, the way I am used to thinking about it, the response should really look like this:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Hyl0D.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hyl0D.gif&quot; alt=&quot;Different? frequency response?&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;Note how the increasing the damping ratio reduces the response below $\omega/\omega_0 \cdot  \sqrt{2}$, but increases at frequencies above $\omega/\omega_0 \cdot  \sqrt{2}$.&lt;br&gt;&#xA;The response does not approach a downward sloping line as damping ratio increases.  Rather, it approaches $1$ as damping ratio increases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what am I missing here?  What is the difference in these two curves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="13436" LastEditorUserId="8202" LastEditDate="2016-04-22T06:49:22.367" LastActivityDate="2016-04-22T09:57:45.490" Title="Difference between these frequency response curves" Tags="|frequency|damping|" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30238" PostTypeId="1" CreationDate="2016-04-21T01:47:33.277" Score="7" ViewCount="8622" Body="&lt;p&gt;In Digital Image Processing, what is the difference between the &lt;strong&gt;intensity&lt;/strong&gt; and the &lt;strong&gt;saturation&lt;/strong&gt; of a color?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you explain the difference to a newbie?&lt;/p&gt;&#xA;" OwnerUserId="18503" LastEditorUserId="128" LastEditDate="2018-09-20T14:42:07.833" LastActivityDate="2023-09-26T16:42:48.370" Title="What Is the Difference Between the Terms Color Intensity and Color Saturation?" Tags="|image-processing|color|" AnswerCount="5" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="30239" PostTypeId="2" ParentId="30238" CreationDate="2016-04-21T05:21:28.917" Score="4" Body="&lt;p&gt;When you take an RGB Image matrix and convert the color into &lt;a href=&quot;https://en.wikipedia.org/wiki/HSL_and_HSV&quot; rel=&quot;noreferrer&quot;&gt;HSV Color Model&lt;/a&gt; the color is represented on Cylinder.&lt;br&gt;&#xA;Now, the intensity (Lightness / Value) is the height on this Cylinder which is going from black to white and basically sets the Gray Color of the neutral color (One which blends RGB in the same intensity).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saturation is the Radius and intuitively is how far the color is from being neutral (Pure Gray).&lt;br&gt;&#xA;Namely, how dominant is one color component versus the others.&lt;/p&gt;&#xA;" OwnerUserId="128" LastActivityDate="2016-04-21T05:21:28.917" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30240" PostTypeId="2" ParentId="30238" CreationDate="2016-04-21T05:27:28.807" Score="3" Body="&lt;p&gt;&lt;strong&gt;Saturation&lt;/strong&gt; is usually one property of three when used to determine a certain color and measured as percentage value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Saturation defines a range from pure color (100%) to gray (0%) at a constant lightness level. A pure color is fully saturated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a perceptional point of view saturation influences the grade of purity or vividness of a color/image. A desaturated image is said to be dull, less colorful or washed out but can also make the impression of being softer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, intensity is a synonym for magnitude, degree or strength. It can therefore be used in conjunction with any color property. Nevertheless, it carries special meaning in certain contexts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;intensity&lt;/strong&gt; refers to different aspects of radiation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When speaking of light, the intensity can mean the number of photons a light source emits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following sources provide a deeper insight:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Luminosity&quot; rel=&quot;nofollow&quot;&gt;Luminosity&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Intensity_%28physics%29&quot; rel=&quot;nofollow&quot;&gt;Intensity&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Luminosity_function&quot; rel=&quot;nofollow&quot;&gt;Luminosity Function&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Lumen_%28unit%29&quot; rel=&quot;nofollow&quot;&gt;Lumen&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Luma (%) is the intensity of the achromatic signal contributing to our color perception. &lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-04-21T05:27:28.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30241" PostTypeId="2" ParentId="30238" CreationDate="2016-04-21T05:47:22.893" Score="3" Body="&lt;p&gt;For 24-bit RGB colors: R=1,G=0,B=0 would be maximally saturated (100%) red, but at the lowest intensity.  R=255,G=254,B=254 would be very high intensity, but very low saturation (most people wouldn't even notice the slight red-ness of the near white).&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-21T05:47:22.893" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30245" PostTypeId="1" AcceptedAnswerId="30254" CreationDate="2016-04-21T10:23:43.897" Score="1" ViewCount="1199" Body="&lt;p&gt;When creating a scipy chirp function I get some clicks at the start end the end.&#xA;The first one is quite easy to fix using a phase difference of 90 degrees.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I have is that the end point is not &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for an static signal I can use the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;period_samples = fs / f&#xA;periods = np.ceil(T * fs / period_samples)&#xA;T = periods * period_samples / fs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then I have the next zero point where I can stop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I do something similar with a chirp&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my code now is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.signal import chirp&#xA;&#xA;T = 1  # sec&#xA;fs = 44100  # samplerate&#xA;f0 = 20  # Hz&#xA;f1 = 20000  # Hz&#xA;&#xA;t = np.arange(T * fs) / fs&#xA;Sig = chirp(t, f0, T, f1, 'logarithmic', 90)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13541" LastEditorUserId="80" LastEditDate="2016-04-21T16:37:19.190" LastActivityDate="2016-04-25T15:28:34.483" Title="Clicks at end of chirp signal" Tags="|python|log-chirp|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30247" PostTypeId="2" ParentId="26630" CreationDate="2016-04-21T13:21:10.660" Score="2" Body="&lt;p&gt;It will depend on what you are modelling in your system. Consider an active radar system. There are both additive noise components and multiplicative noise components. What distinguishes them in this case:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If I increase the transmit pulse power by a factor of $K$ and the SNR improves by a factor of $K$ then the noise is additive&lt;/li&gt;&#xA;&lt;li&gt;If I increase the transmit pulse power by a factor of $K$ and the SNR does not change then the noise is multiplicative&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To give some examples to clarify:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Thermal noise at the input of the ADC is generally additive - noise level does not generally change with power of the received signal, so SNR will change with transmitted/received power.&lt;/li&gt;&#xA;&lt;li&gt;Clipping in the ADC (distortion) is non-linear - it is more multiplicative than additive. Increasing the receive power won't affect the SNR (assuming clipping still occurs).&lt;/li&gt;&#xA;&lt;li&gt;Phase noise in the ADC (timing errors) is multiplicative &lt;/li&gt;&#xA;&lt;li&gt;Speckle noise - Presence of a lot of random scatters in radar resolution cell is usually modeled as multiplicative - increasing the transmit power does not reduce the speckle effect.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Another common example is in active Sonar. In near range there is a lot of reverberation (volume reverberation), but as the transmitted pulse travels away from the sonar the reverberation drops and the system performance becomes limited by the ambient noise. In these two cases the sonar is operating in reverberation limited mode and noise limited modes respectively.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Reverberation - Multiplicative - Increasing transmit power offers no improvement in SNR.&lt;/li&gt;&#xA;&lt;li&gt;Noise Limited - Additive noise - Increasing the transmit power improves the SNR.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This assumes a very simplistic model of underwater sound propagation. You will have other wave propagation effects mostly due to the sound velocity profile (Reverberation at surface/bottom, sound channels, convergence zones, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So within a single system you can have both. In what mode of operation will determine which type of noise dominates. It should also be noted that the noise may not be entirely multiplicative or entirely additive. You can have noise which contains elements of both. In this situation you will get some SNR improvement but it may not be linearly related to the increase in transmit power.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2016-04-21T13:21:10.660" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30248" PostTypeId="2" ParentId="30223" CreationDate="2016-04-21T14:29:38.260" Score="2" Body="&lt;p&gt;First of all, you should totally fix the $x$-axis :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, as you only have two sine waves, you should expect to have peaks at their exact frequencies (that is, at $\pm 60\textrm{ Hz}$ and $\pm 100\textrm{ Hz}$). The FFT function in MATLAB gives you the Discrete Fourier Transform of your signal within $0$ and $F_s$, where $F_s$ is your sampling frequency -and given that you represent your signal with samples, even if you are not aware of it, you have one. Anyway, to make visualization easier, we focus on the interval $[-\frac{F_s}{2},\frac{F_s}{2}]$; that way, your spectrum will be centered around the $0$ frequency -use the function &lt;a href=&quot;http://de.mathworks.com/help/matlab/ref/fftshift.html?refresh=true&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;fftshift&lt;/code&gt;&lt;/a&gt; for that. So, now, once you fix the $x$-axis according to your sampling frequency, you will find that the peaks are at the frequencies you have defined for your sine waves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to the little ripples in the lower part of your spectrum, that's just disturbance caused by the noise. Since you are adding noise to the signal by the &lt;code&gt;randn&lt;/code&gt; function, your noise follows a Gaussian distribution, translating into &lt;a href=&quot;https://en.wikipedia.org/wiki/White_noise&quot; rel=&quot;nofollow&quot;&gt;white noise&lt;/a&gt; for your signal. That is why your entire spectrum is showing sings of being slightly disturbed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, after &lt;code&gt;fftshift&lt;/code&gt;, just get rid of the first half of your vector and you'll end up with positive frequencies.&lt;/p&gt;&#xA;" OwnerUserId="17144" LastEditorUserId="1629" LastEditDate="2016-05-23T14:10:22.830" LastActivityDate="2016-05-23T14:10:22.830" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30250" PostTypeId="1" AcceptedAnswerId="30251" CreationDate="2016-04-21T15:05:52.597" Score="1" ViewCount="985" Body="&lt;p&gt;I want to mix two mono files, signal.wav and noise.wav, into a single mono file, signal_noise_mono.wav. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, I know how to mix the two input files into a stereo file and then remix it to mono, but I would like to mix down to mono directly, and avoid the intermediate file.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Merge signal (mono, L) and noise (mono, R) into a stereo file&#xA;sox -M signal.wav noise.wav signal_noise_stereo.wav&#xA;&#xA;# Remix channels 1 &amp;amp; 2 from the stereo file into a single mono file&#xA;sox signal_noise_stereo.wav signal_noise_mono.wav remix 1,2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any tips? Have I missed an obvious sox switch?&lt;/p&gt;&#xA;" OwnerUserId="16575" LastEditorUserId="13320" LastEditDate="2016-11-21T12:32:46.287" LastActivityDate="2016-11-21T12:32:46.287" Title="Sox, mixing mono inputs into mono output (efficiently)" Tags="|noise|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30251" PostTypeId="2" ParentId="30250" CreationDate="2016-04-21T15:17:03.747" Score="2" Body="&lt;p&gt;As far as I can understand, you want to add two signals, together?&#xA;I guess that you are missing &lt;code&gt;-m&lt;/code&gt; switch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generate two test files (sweep and sine):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sox -Dr 16000 -c 1 -b 16 -n sine.wav synth 5 sin 1000&#xA;sox -Dr 16000 -c 1 -b 16 -n sweep.wav synth 10 sine 100:8000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Merge them together:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sox -m sweep.wav sine.wav -Dr 16000 out.wav&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using &lt;code&gt;soxi out.wav&lt;/code&gt; you can see that produced file is mono:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Input File     : 'out.wav'&#xA;Channels       : 1&#xA;Sample Rate    : 16000&#xA;Precision      : 16-bit&#xA;Duration       : 00:00:10.00 = 160000 samples ~ 750 CDDA sectors&#xA;File Size      : 320k&#xA;Bit Rate       : 256k&#xA;Sample Encoding: 16-bit Signed Integer PCM&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you can observe the spectrograms:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sox sine.wav -n spectrogram -o sine.png&#xA;sox sweep.wav -n spectrogram -o sweep.png&#xA;sox out.wav -n spectrogram -o out.png&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Sine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UVB1g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UVB1g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sweep:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iYjh6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iYjh6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Merged together:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FXNtK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FXNtK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8202" LastActivityDate="2016-04-21T15:17:03.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30252" PostTypeId="1" AcceptedAnswerId="30253" CreationDate="2016-04-21T15:22:54.687" Score="1" ViewCount="117" Body="&lt;p&gt;In MATLAB's Comm System Toolbox there is an option for 'Phase Rotation', defined as the phase difference between previous and current modulated symbols when the input is zero. This is the first time I've heard of this concept. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take DQPSK as an example. Say my previous symbol had an absolute phase of $0$, (1+j0) and I am trying to encode '01'. Under the DQPSK scheme I'm familiar with, '01' corresponds to a phase shift of $\pi/2$. Therefore the absolute phase of this symbol would be $\pi/2$, (0+j1). MATLAB would describe this scheme as having a phase rotation of 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the same example were to use a phase rotation as $\pi/2$ then the absolute phase of the symbol would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$0$ (phase of last symbol) + $\pi/2$ (shift due to modulation) + $\pi/2$ (additional phase rotation) = $\pi$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This brings me to my question. Performing the additional phase shift requires increased complexity at the receiver and transmitter. So what is to be gained from the process of adding an additional phase shift? Why do it in the first place?&lt;/p&gt;&#xA;" OwnerUserId="7047" LastActivityDate="2016-04-21T16:27:51.000" Title="Reasoning Behind Additional Phase Shift in DPSK" Tags="|digital-communications|modulation|phase|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30253" PostTypeId="2" ParentId="30252" CreationDate="2016-04-21T16:27:51.000" Score="1" Body="&lt;p&gt;A QPSK constellation could in theory have any rotation. For example, $$\mathcal{S}=\lbrace 1, j, -1, -j \rbrace $$ is a QPSK constellation, and $e^{j\phi}\cdot\mathcal{S}$ is also a QPSK constellation. Matlab's &lt;code&gt;phaserot&lt;/code&gt; parameter in the &lt;code&gt;dpskmod&lt;/code&gt; command is $\phi$ in the equation above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is to be gained depends on the particular application I guess. In particular, note that $\phi=\pi/4$ is nice because then the ML decoding rule is equivalent to finding what quadrant the received point is in.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-04-21T16:27:51.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30254" PostTypeId="2" ParentId="30245" CreationDate="2016-04-21T17:09:43.250" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/scipy/scipy/blob/master/scipy/signal/waveforms.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;From the code in Olli's comment&lt;/a&gt;, the phase is going to be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;beta = t1 / log(f1 / f0)&#xA;phase = 2 * pi * beta * f0 * (pow(f1 / f0, t / t1) - 1.0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So to ensure you have a zero crossing at the end of your signal, you need to choose a combination of &lt;code&gt;t&lt;/code&gt;'s end value and &lt;code&gt;t1&lt;/code&gt; for which the phase is modulo $2\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From your code, the last value of &lt;code&gt;t&lt;/code&gt; will be 44099/44100. So the &lt;code&gt;beta&lt;/code&gt; value is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;beta = 1 / log(1000)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the phase of the last sample in the signal will be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;phase =  2 * pi * 1/log(1000) * 20 * (pow(1000, 44099/44100) - 1.0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which will be close to modulo $2\pi$ if you have a ratio of &lt;code&gt;f1&lt;/code&gt; to &lt;code&gt;f0&lt;/code&gt; equal to 1000.007748 instead of 1000 (after a bit of playing in Excel).  Try setting &lt;code&gt;f1&lt;/code&gt; to 20000.15495 instead of 20000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; : I made a mistake in the above and have corrected it. &lt;a href=&quot;https://docs.google.com/spreadsheets/d/1jKv0AbjV4sRBHHHzfMyGd-z1d2qy-E1J__B0-pj1li0/edit?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's a Google Doc that has the spreadsheet I've used (read only) for the correction.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Screenshot highlighting the close values below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qIiY0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qIiY0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-25T15:28:34.483" LastActivityDate="2016-04-25T15:28:34.483" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30255" PostTypeId="2" ParentId="30245" CreationDate="2016-04-21T17:21:26.853" Score="2" Body="&lt;p&gt;Olli Niemitalo pointed you &lt;a href=&quot;https://dsp.stackexchange.com/questions/30245/clicks-at-end-of-chirp-signal#comment56919_30245&quot;&gt;in the right direction&lt;/a&gt; already – it's all there in the &lt;a href=&quot;http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.chirp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;logarithmic, log, lo:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$f(t) = f_0 \cdot \left(\frac{f_1}{f_0}\right)^{t/t_1}$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$f_0$ and $f_1$ must be nonzero and have the same sign.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You know that frequency is the derivative of phase, i.e. phase is the integral of frequency, accounting for a constant offset that you might specify as &lt;code&gt;phi&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there's no ambiguity here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;f(t) &amp;amp;= f_0 \cdot \left(\frac{f_1}{f_0}\right)^{t/t_1}\\&#xA;&amp;amp;\implies\\&#xA;\varphi(t) &amp;amp;= \int\limits_{t=t_0}^{t_1} f(t), &amp;amp; t\in\left[t_0,t_1\right]\\&#xA;&amp;amp;=f_0 \, \int\limits_{t=t_0}^{t_1} \left(\frac{f_1}{f_0}\right)^{t/t_1} dt +\phi_0&amp;amp;\| a= \frac{f_1}{f_0}&amp;gt;0\\&#xA;\varphi(t) - \phi_0&amp;amp;= f_0 \, \int\limits_{t=t_0}^{t_1} \left({e^{\ln a}}\right)^{t/t_1}\,dt\\&#xA;&amp;amp;= f_0 \, \int\limits_{t=t_0}^{t_1} {e^{\ln a\,\frac{t}{t_1}}}\,dt\\&#xA;&amp;amp;= f_0 \frac{1}{\ln a \frac{1}{t_1}}e^{\ln a\,\frac{t}{t_1}}\\&#xA;&amp;amp;=  \frac{f_0t_1}{\ln a}e^{\ln a\,\frac{t}{t_1}}\\&#xA;\end{align}$$&#xA;you want $\varphi(t_1)=0$, so setting:&#xA;$$\begin{align}&#xA;0 &amp;amp;= \varphi(t_1)-\phi_0\\&#xA;&amp;amp;\implies\\&#xA;\phi_0 &amp;amp;= \frac{f_0t_1}{\ln a}e^{\ln a\,\frac{t_1}{t_1}}\\&#xA; &amp;amp;= \frac{f_0t_1}{\ln a}e^{\ln a}\\&#xA; &amp;amp;= \frac{f_0t_1}{\ln a} a\\&#xA; &amp;amp;= \frac{f_0t_1}{\ln f_1 - \ln f_0}\frac{f_1}{f_0}\\&#xA; &amp;amp;= \frac{f_1t_1}{\ln f_1 - \ln f_0}\text.&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There you go, derivation with nothing but basic math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for a matter of fact, things aren't quite so easy because of numerical accuracy when summing up phases in floating point numbers – but with the current scipy implementation, you should be pretty good for most cases.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-04-21T17:21:26.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30256" PostTypeId="1" CreationDate="2016-04-21T18:04:09.743" Score="0" ViewCount="5836" Body="&lt;p&gt;I am not sure if it is valid to conclude that a mixer produces a difference/sum of frequencies at output ,while multiplier produces multiples of frequency at its output. I am keen to know how far I have got it right. Is there something else that I should know? please post with simple e.g.&lt;/p&gt;&#xA;" OwnerUserId="20119" LastActivityDate="2016-04-22T12:50:20.913" Title="What is the difference between a'mixer' and a ' multiplier' used in modulation process?" Tags="|signal-analysis|frequency-spectrum|filter-design|noise|frequency|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30257" PostTypeId="2" ParentId="30256" CreationDate="2016-04-21T18:11:04.370" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Frequency_mixer&quot; rel=&quot;nofollow&quot;&gt;For most purposes a mixer is a multiplier.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue regarding sum / difference frequencies is that when you multiply two signals of different frequencies, $\omega_1$ and $\omega_2$ say, then you get one component at the sum of the two frequencies and one component at the difference of the two frequencies:&#xA;$$&#xA;\cos(\omega_1 t) \cdot \cos(\omega_2 t) = \frac{1}{2} \left\{ \cos([\omega_1+\omega_2]t) + \cos([\omega_1 - \omega_2]t) \right \}$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Response to comment&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Frequency_multiplier&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;frequency multiplier&lt;/strong&gt;&lt;/a&gt; is a completely different kettle of fish. These are often highly nonlinear systems that take a signal $\cos(\omega_1 t)$ and produce $$\sum_{k=1}^{N} \cos(k \omega_1 t + \phi_k)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a frequency tripler can be had by driving a transformer into saturation (so that it outputs something like a square wave) and low-pass filtering the result.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-22T12:50:20.913" LastActivityDate="2016-04-22T12:50:20.913" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30258" PostTypeId="1" CreationDate="2016-04-21T19:16:23.257" Score="-1" ViewCount="1032" Body="&lt;p&gt;I have a &lt;strong&gt;continuous-time&lt;/strong&gt; signal $x(t)$ that has the following properties:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It is periodic, with a periodicity of 1 (sec).&lt;/li&gt;&#xA;&lt;li&gt;It has no discontinuities or infinite values at any time.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I want to come up with an LPF to pass $x(t)$ through, but with the following requirements:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The filter is ideal (see point #3), continuous-time, with an impulse response $h(t)$ (and frequency response $H(f)$).&lt;/li&gt;&#xA;&lt;li&gt;The filter need not be a simple looking one like a brick-wall LPF. But $h(t)$ should be describable in closed form (piece-wise definition ok too). I am not looking for anything that involves stuff like dirac-delta function or infinite sums or something that can only be defined as an integral, etc.&lt;/li&gt;&#xA;&lt;li&gt;Any cutoff frequency is ok, but should be a finite number. Beyond that cutoff frequency, $H(f)$ should be 0 (not slowly reaching 0 asymptotically).&lt;/li&gt;&#xA;&lt;li&gt;The main requirement is that the output $y(t) = x(t)\star h(t)$, should have the same values as $x(t)$ at times $0, 1, 2, 3, \ldots$ i.e. $y(t) = x(t)$ for all integers. At other times, there is no restriction on how $y(t)$ should look like, except that it should be finite at all times.&lt;/li&gt;&#xA;&lt;li&gt;The filter need not be physically realizable. Just a mathematical definition is good enough for my purpose.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course, since I have given very few specifics, I am not expecting an exact $h(t)$ or $H(f)$ as an answer, but looking for what generic shape such a filter will have.&lt;/p&gt;&#xA;" OwnerUserId="20214" LastEditorUserId="1629" LastEditDate="2016-05-23T08:12:01.067" LastActivityDate="2016-05-24T05:29:56.317" Title="Continuous low-pass filter (LPF) on a periodic signal" Tags="|lowpass-filter|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30259" PostTypeId="2" ParentId="30258" CreationDate="2016-04-21T20:00:47.040" Score="0" Body="&lt;p&gt;If $x(t)$ has period $T=1$, then $y'(t)=x(t)\star g(t)$ also has period $T=1$ for any filter $g(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that $y'(t)$ is not the zero signal (in other words, assume &#xA;the filter $g(t)$ is such that its cutoff frequency is larger than 1 Hz).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let $$h(t)=\frac{x(1)}{y'(1)}g(t).$$ Then, if $y(t)=x(t)\star h(t)$, it follows that $y(n)=x(n)$ for $n$ integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the definition of the filter $h(t)$ depends on the values $x(1)$ and $y'(1)$. There is no low-pass filter that will meet your condition #4 for general $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Thanks to RBJ for helping me see an error in my previous answer]&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-04-23T01:32:18.803" LastActivityDate="2016-04-23T01:32:18.803" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30261" PostTypeId="2" ParentId="30256" CreationDate="2016-04-21T20:22:54.777" Score="1" Body="&lt;p&gt;A mixer is often synonymous with a crossfader. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A crossfader is made of two amplitude multipliers, in mathematics a liner interpolator of values from 0-1 multiplying one signal and 1-0 multiplying the other signal. there can be mixers for multiple, 3-15 signals using the same control, which are called multiplexers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strictly speaking, modulating a signal relates to a variation in an applied effect on a signal, whereas mixing is not generally related to effects, it's signal and volume control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A multiplier is used also for ring modulation where one sound/osc is multiplied with another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A serge wave multiplier is an analogue trick where a wave is amplified and sent through some rectifiers/mirrors that bounce it backwards from values above 1, thereby increasing the side bands of the original oscillator in a way powerful and economic relative to the electronic components used. it is best applied to a sine wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A mixer is also jargon for a mixing console.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastEditorUserId="12103" LastEditDate="2016-04-21T20:28:17.950" LastActivityDate="2016-04-21T20:28:17.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30262" PostTypeId="1" CreationDate="2016-04-21T20:23:00.110" Score="2" ViewCount="1373" Body="&lt;p&gt;I have a question regarding formula in &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S1077314207001555&quot; rel=&quot;nofollow noreferrer&quot;&gt;SURF article&lt;/a&gt; by Bay et al.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Theory&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a point $p=(x,y)$ in an image $I$, the Hessian matrix $\mathcal{H}$ in $x$ at scale $\sigma$ is defined as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathcal{H}(p, \sigma) = \begin{bmatrix}L_{xx}(p, \sigma) &amp;amp; L_{xy}(p, \sigma)\\L_{xy}(p, \sigma)&amp;amp; L_{yy}(p, \sigma)\end{bmatrix},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $L_{xx}(p,\sigma)$ is the convolution of the Gaussian second&#xA;order derivative $\frac{\partial^2}{\partial x^2}g(\sigma)$ with the image $I$ in point p, and similarly for $L_{xy}(p,\sigma), L_{yy}(p,\sigma)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/83IR9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/83IR9.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $9\times9$ box filters in Fig. 2 are approximations of a&#xA;Gaussian with $\sigma=1.2$ and represent the lowest scale (i.e.&#xA;highest spatial resolution) for computing the blob response&#xA;maps. We will denote them by $D_{xx}$, $D_{yy}$, and $D_{xy}$. The&#xA;weights applied to the rectangular regions are kept simple&#xA;for computational efficiency. This yields&#xA;$$&#xA;\det(\mathcal{H}_{approx}) = D_{xx}D_{yy} - (wD_{xy})^2.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relative weight $w$ of the filter responses is used to balance&#xA;the expression for the Hessian’s determinant. This is&#xA;needed for the energy conservation between the Gaussian&#xA;kernels and the approximated Gaussian kernels,&#xA;$$&#xA;w = \frac{\big\lvert L_{xy}(1.2)\big\rvert_F\big\lvert D_{yy}(9)\big\rvert_F}{\big\lvert L_{yy}(1.2)\big\rvert_F\big\lvert D_{xy}(9)\big\rvert_F} = 0.912\ldots \approx 0.9,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $|X|_F$ is the Frobenius norm. Notice that for theoretical&#xA;correctness, the weighting changes depending on the&#xA;scale. In practice, we keep this factor constant, as this did&#xA;not have a significant impact on the results in our&#xA;experiments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Main question is how this formula for $w$ is obtained?&lt;/li&gt;&#xA;&lt;li&gt;And my another concern is to why $w$ is within the brackets with $D_{xy}$. If it's just a balancing coefficient wouldn't it make more sense to write like this $wD_{xy}^2$? So I guess there is some motivation behind it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My general purpose is to generalize this method for 3D, so it would be great if anyone could share some thoughts about balancing coefficients in that case or some useful links containing relevant information.&lt;/p&gt;&#xA;" OwnerUserId="20649" LastEditorUserId="1629" LastEditDate="2016-05-22T08:16:11.430" LastActivityDate="2018-08-11T03:00:58.327" Title="Determinant of Hessian approximation (SURF)" Tags="|gaussian|local-features|approximation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30263" PostTypeId="2" ParentId="30238" CreationDate="2016-04-21T20:36:19.097" Score="6" Body="&lt;p&gt;Saturation mixes the original color with white to make varying degrees of pastel color.&lt;/p&gt;&#xA;&lt;p&gt;Intensity/Value mixes the above color with black to make varying degrees of brightness.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HBq9I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HBq9I.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;if you raise the value of a color, it's intensity rises. If there are more photons of a color, it is less black.&lt;/p&gt;&#xA;&lt;p&gt;The variable of Intensity isn't used a lot in current color processing, it means mixing with black, or relative intensity... So RGB 0 0 0 is black and RGB 255 0 0 has high intensity value for red with low intensity values for blue and green, and low intensity of a light of any color is black.&lt;/p&gt;&#xA;&lt;p&gt;The best idea is to look &lt;a href=&quot;https://en.wikipedia.org/wiki/HSL_and_HSV&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastEditorUserId="80" LastEditDate="2023-09-26T16:42:48.370" LastActivityDate="2023-09-26T16:42:48.370" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30264" PostTypeId="1" CreationDate="2016-04-22T01:27:31.430" Score="3" ViewCount="1740" Body="&lt;p&gt;On wikipedia there are only 2 lines about ESPRIT: Estimation of signal parameters via rotational invariant techniques (ESPRIT)... MUSIC doesnt have an entry in the music disambiguation page, other than something for neural networks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read that they are more advanced than FFT. What are their advantages and disadvantages?&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2016-04-23T01:24:47.440" Title="what are the Pros and Cons of ESPRIT and MUSIC algorythms?" Tags="|signal-analysis|algorithms|music|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30265" PostTypeId="1" AcceptedAnswerId="35696" CreationDate="2016-04-22T01:42:31.010" Score="3" ViewCount="106" Body="&lt;p&gt;Let's say I have the following LTI system: &#xA;$$\dot{x}(t) = \mathbf{A} x(t) + \mathbf{B} u(t)$$&#xA;I need to somehow show the following is true or false (proof): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This system is controllable if and only if for any $\mu$ such that $(−\mu\mathbf{I − A})$ is &lt;a href=&quot;https://en.wikipedia.org/wiki/Hurwitz_matrix&quot; rel=&quot;nofollow&quot;&gt;Hurwitz&lt;/a&gt;, there exists a unique positive deﬁnite solution $\mathbf W$ to the Lyapunov equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf A \mathbf W + \mathbf W \mathbf A^T − \mathbf B\mathbf B^T = −2\mu\mathbf W$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone see the proof? I tried replacing $\mathbf A$ in the Lyapunov equation with $(−\mu\mathbf I − \mathbf A)$, and then adding the $−2\mu\mathbf W$, to the left side, but the $\mu$'s end up cancelling out, so I'm not sure. &#xA;I'd really appreciate any help.&lt;/p&gt;&#xA;" OwnerUserId="15460" LastEditorUserId="19249" LastEditDate="2016-05-22T17:14:58.083" LastActivityDate="2016-11-20T08:40:04.267" Title="Proving conditions for controllability" Tags="|signal-analysis|linear-systems|system-identification|linear-algebra|proof|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30266" PostTypeId="2" ParentId="30262" CreationDate="2016-04-22T04:25:04.397" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I think $w$ is a factor that makes the ratio of  $D_{xy}$ to $D_{yy}$ the same as $L_{xy}$ to $L_{yy}$. This is so the value of the determinant for the simplified kernel roughly matches that of the continuous version.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You could write it that way. But if you leave it as $wD_{xy}$ then if used in other expressions you don't have to muck around with adding square roots. e.g. $(wD_{xx})^3$ expressed your suggested way would be $\sqrt{w}^3D_{xx}^3$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-04-22T04:25:04.397" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30268" PostTypeId="1" CreationDate="2016-04-22T07:50:25.230" Score="3" ViewCount="152" Body="&lt;p&gt;I understand why most of the classic textbooks only consider Additive White Gaussian Noise channels in digital data transmission. Unfortunately in my case noise is not Gaussian and it might even be colored (non-white). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I spent a couple of hours searching around but only found some special cases that were eventually approximated by Gaussian models. I appreciate if you could point me to some resources that non-Gaussian noise is considered, in concise and direct manners.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some notes: I'm interested in evaluating the performance of a receiver in the presence of Gaussian and other non-Gaussian noise sources. For example, I'd like to see the effect of the ADC quantization noise passed through some filter, like an equalizer (and there is not much support to use Central Limit Theorem to make Gaussian assumption), or some residual jitter from my clock recovery loop that again doesn't fit nicely to a Gaussian model. &lt;/p&gt;&#xA;" OwnerUserId="19184" LastEditorUserId="19184" LastEditDate="2016-04-22T15:15:18.827" LastActivityDate="2016-08-03T04:53:44.260" Title="Resources on Non-Gaussian Channels" Tags="|noise|digital-communications|gaussian|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30269" PostTypeId="2" ParentId="2570" CreationDate="2016-04-22T08:36:11.340" Score="-1" Body="&lt;p&gt;One problem might be that the  &lt;code&gt;kiss_fftr()&lt;/code&gt; function needs a regular &lt;code&gt;kiss_fft_scalar&lt;/code&gt; array and not a &lt;code&gt;kiss_fft_cpx array&lt;/code&gt; as the input argument.&lt;/p&gt;&#xA;" OwnerUserId="20657" LastEditorUserId="80" LastEditDate="2016-04-22T11:33:06.667" LastActivityDate="2016-04-22T11:33:06.667" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30270" PostTypeId="2" ParentId="30236" CreationDate="2016-04-22T09:50:25.800" Score="1" Body="&lt;p&gt;The two frequency response plots are the result of two different models. In the first one, the model is a mass-spring-damper system as shown &lt;a href=&quot;https://en.wikipedia.org/wiki/Damping#Example:_mass.E2.80.93spring.E2.80.93damper&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and the plot shows the ratio of the amplitudes of mass displacement and driving force.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second plot shows the transmissibility of a single DOF mechanical system as shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aeCXO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aeCXO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(from &lt;em&gt;Fundamentals of Mechanical Vibrations&lt;/em&gt; by S.G.Kelly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that here, unlike in the other model, the support is not fixed. The transmissibility shown in your second plot is the ratio of the amplitudes of the mass displacement $x(t)$ and the (forced) displacement of the support $y(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In formulas, your first plot shows the function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M(\omega)=\frac{1}{\sqrt{\left(1-\left(\frac{\omega}{\omega_0}\right)^2\right)^2+\left(2\zeta\frac{\omega}{\omega_0}\right)^2}}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\omega_0$ is the system's natural frequency, and $\zeta$ is the damping ratio. In electrical engineering terms, this is the magnitude of the frequency response of a second-order low pass filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second plot shows the transmissibility given by Eq. (3.73) in &lt;a href=&quot;http://www.slideshare.net/Alsanea/kelly-sg-fundamentals-of-mechanical-vibrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kelly's book&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T(\omega)=\sqrt{\frac{1+\left(2\zeta\frac{\omega}{\omega_0}\right)^2}{{\left(1-\left(\frac{\omega}{\omega_0}\right)^2\right)^2+\left(2\zeta\frac{\omega}{\omega_0}\right)^2}}}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $(1)$ and $(2)$ have the same denominator but different numerators.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-04-22T09:57:45.490" LastActivityDate="2016-04-22T09:57:45.490" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30271" PostTypeId="1" AcceptedAnswerId="30272" CreationDate="2016-04-22T11:09:42.067" Score="2" ViewCount="271" Body="&lt;p&gt;I'm currently studying for an exam in image processing and stumbled upon a exercise which i could not answer and my professor will not be available before the exam anymore. The exercise goes as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Create a Hann-lowpass kernel of size $3\times 3$ and calculate the result of the convolution at $(2,2)$ in the image.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The given solution for the filter kernel is shown below, but I do not understand how he got there:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;A = \frac{1}{4}&#xA;\begin{pmatrix}&#xA;\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}  \\&#xA;\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}  \\&#xA;\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}  \\&#xA;\end{pmatrix}&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second part of the question is a simple convolution with the image which I'm able to do. The factor in front of the kernel is given by the constraint $ \sum A = 1$ to achieve a filter gain of one. &#xA;I've done literature research but none of the books in the library do explain how to calculate such a kernel. The professor gives a &quot;hint&quot; in his presentation pointing to the generalized cosine window with $A = 0.5$, $B = 0.5$ and $C = 0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;w_k = A - B\cdot \cos\left(2\pi\frac{k}{K-1}\right) + C\cdot \cos\left(4\pi\frac{k}{K-1}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet I cannot derive the final kernel from the given formulas. Can anyone give me a step by step solution for the problem?&lt;/p&gt;&#xA;" OwnerUserId="20658" LastEditorUserId="128" LastEditDate="2019-06-24T16:41:17.577" LastActivityDate="2019-06-24T16:41:17.577" Title="How to Calculate the Hann Low Pass Filter / Kernel for Image Processing" Tags="|convolution|image-processing|window|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30272" PostTypeId="2" ParentId="30271" CreationDate="2016-04-22T11:30:42.377" Score="0" Body="&lt;p&gt;So if I run&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30271&#xA;&#xA;A &amp;lt;- 0.5&#xA;B &amp;lt;- 0.5&#xA;C &amp;lt;- 0&#xA;&#xA;K &amp;lt;- 5&#xA;&#xA;k &amp;lt;- seq(0,K-1)&#xA;&#xA;w_k &amp;lt;- A - B * cos(2*pi*k/(K-1)) + C * cos(4*pi*k/(K-1))&#xA;&#xA;print(w_k)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it outputs &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1] 0.0 0.5 1.0 0.5 0.0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does that help?&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-22T11:54:04.563" LastActivityDate="2016-04-22T11:54:04.563" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30273" PostTypeId="2" ParentId="30265" CreationDate="2016-04-22T15:14:23.843" Score="1" Body="&lt;p&gt;Not really a direct help, but &lt;a href=&quot;http://tsakalis.faculty.asu.edu/notes/sco.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; might provide some insight, particularly the paragraph below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KuPEy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KuPEy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-22T15:14:23.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30275" PostTypeId="1" AcceptedAnswerId="30278" CreationDate="2016-04-22T16:06:09.147" Score="9" ViewCount="1105" Body="&lt;p&gt;In my master thesis I am trying to implement a beamformer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already done the delay-sum part 1 year ago. I have been told:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in FIR filtering we can do &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT --&gt; null the unwanted frequency bin --&gt; IFFT .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can to the same in beamformers. If we know the interference DOA (like 0 in angle 25 and 1 in everywhere else between -90 to 90) output we can ---&gt; IFFT and use the weights in aparture elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whatever I tried it didn't work. Than I begin to read books , surprisingly couldn't find the method that my advisor told me. Instead I found out methods like MVDR, LCMV. Now I am tring to use matlab method &lt;a href=&quot;http://www.mathworks.com/help/phased/ref/lcmvweights.html&quot;&gt;lcmvweights&lt;/a&gt; to get correct weights for each element and apply in my delay-sum beamformer.   Even I succeed to use this method I am curious if narrowband-beamformers could be used in complex signals like speech? &lt;/p&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="13320" LastEditDate="2016-04-22T17:50:07.927" LastActivityDate="2016-04-22T20:29:44.760" Title="Can a narrowband beamformer be used for speech separation" Tags="|beamforming|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30278" PostTypeId="2" ParentId="30275" CreationDate="2016-04-22T17:50:14.287" Score="7" Body="&lt;p&gt;If you are dealing with say 8 kHz for a nominal speech bandwidth of of 4kHz i.e. 0 Hz - 4 kHz, then the speech is essentially a wideband signal. Therefore narrowband beamforming won't work very well. Your beam pattern will be okay for the particular frequency of interest - but once you start moving away from that frequency your beam patterns will deteriorate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you are looking for is wideband beamforming - which uses actual time delays (or linear phase shifts across frequency in the frequency domain) rather than just phase shifts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually the techniques like LCMV and MVDR are developed for narrowband signals. There are a couple of ways of approaching the wideband problem:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use a tapped delay line on each channel. If you have $n$ channels and $m$ taps per channel then your correlation matrix is $mn$ x $mn$. So the systems of equations gets very large.&lt;/li&gt;&#xA;&lt;li&gt;Use a bunch of narrowband beamformers. In this case you would have $m$ beamformers ($m$ frequencies) each one having $n$ channels. Now each beamformer has a $n$ x $n$ correlation matrix, but you have $m$ of them. So it leads to a reduction in complexity from the previous case.&lt;/li&gt;&#xA;&lt;li&gt;You can form a set of $b$ conventional beams (using time-delay rather than just phase multiplier) and then do the adaptive processing on the beams.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The best reference I can think of is by Van Trees - Optimum Array Processing. Note you sometimes run into slight differences in terminology - some texts will denote MVDR as using the signal correlation matrix, while others use the signal plus noise correlation matrix - Just be careful which one you're looking at. I know Van Trees makes a distinction between the two cases. Most other texts do not and only use one formulation and call it MVDR.&lt;/p&gt;&#xA;" OwnerUserId="7483" LastEditorUserId="11256" LastEditDate="2016-04-22T18:13:01.643" LastActivityDate="2016-04-22T18:13:01.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30282" PostTypeId="2" ParentId="30275" CreationDate="2016-04-22T18:55:08.467" Score="5" Body="&lt;p&gt;&lt;a href=&quot;http://users.cecs.anu.edu.au/~williams/papers/P97.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The work by Darren Ward, Rod Kennedy, and Bob Williamson&lt;/a&gt; investigated how to design filters applied to a delay-and-sum beamformer that allowed broadband signal acquisition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from their figure 2, a narrow-band beamformer does not perform well as the frequency changes from the design frequency.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DmjkG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DmjkG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suitable choice of filters in the paths of the delay-and-sum beamformer allows a less frequency-dependent array response to be formed (figure 4 from their paper below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1M1xl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1M1xl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://espace.library.uq.edu.au/view/UQ:11249/SSAP1996_FIEND_K.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A later paper that I did with Darren and Bob&lt;/a&gt; shows that it's possible to have a frequency invariant design &lt;strong&gt;and&lt;/strong&gt; position an exact null in one given direction (egad! that paper is 20 years old this year).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-22T20:29:44.760" LastActivityDate="2016-04-22T20:29:44.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30283" PostTypeId="1" AcceptedAnswerId="30287" CreationDate="2016-04-22T19:52:52.607" Score="3" ViewCount="3491" Body="&lt;p&gt;I've started studying Control and I've come across some concepts that I'm finding  a bit difficult to understand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the system showed &lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/2/24/Feedback_loop_with_descriptions.svg&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;, there is a signal called &quot;reference&quot; as well as a feedback block. As far as I know, the feedback block has the function of getting the output as close as possible to the reference. But here is what I don't understand: what if the reference is, for example, an impulse, and I want the system to show a step when an impulse is at its input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm getting confused with the difference between reference signal and input signal. Why would someone connect a feedback block in order to get the output to follow the reference? What's the advantage of doing this?&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2023-09-17T15:46:23.700" Title="What is the Reference in Control Theory?" Tags="|control-systems|feedback|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30284" PostTypeId="2" ParentId="25428" CreationDate="2016-04-22T20:03:58.550" Score="1" Body="&lt;p&gt;The simplest solution in terms of computational resources as much as simplicity, I guess, is the Unscented Kalman Filter (UKF). There, the clipping might easily be added to the calculation of the sigma-points, in a way that they remain in certain boundary. I recommend that you take a look at this article, for example (working in 2016.04.22, &lt;a href=&quot;http://folk.ntnu.no/bjarnean/pubs/conference/conf-99.pdf&quot; rel=&quot;nofollow&quot;&gt;Constrained State Estimation Using the Unscented Kalman Filter, Rambabu Kandepu, Lars Imsland and Bjarne A. Foss&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="4869" LastActivityDate="2016-04-22T20:03:58.550" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30285" PostTypeId="2" ParentId="9564" CreationDate="2016-04-22T20:14:58.210" Score="1" Body="&lt;p&gt;I won't tell the full mapping from poles(1)/zeroes(0) to the frequency response but I think I can explain the connection between frequency and zero/infinite response, why do you have infinite/zero response at $e^{-jw}=z_\text{zero/pole},$ i.e. what $e^{-jw}$ has to do with $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general form of the linear system is &#xA;$$y_n+a_1y_{n-1}+a_2y_{n-2}+\cdots = b_0 x_n + b_1x_{n-1}+b_2x_{n-2}+\cdots, $$ which can be solved in z-from as $$Y(z) = {(b_0 + b_1 z + b_2 z^2+\cdots)\over(1+a_1z+a_2z^2+\cdots)}X(z) = H(z)X(z) = {(1-z_0z)(1-z_1z)\cdots \over(1-p_0z)(1-p_1z)\cdots}X(z).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, the series of binomial products $(1-z_0 z)\cdots{1\over 1-p_0 z}$ can be considered as a series of systems, where first output, is the input for another. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to analyze the effect of single pole and zero. Let's single out the first zero, considering it the transfer function so that the rest of $H(z)X(z)$ is the input signal, $Y(z)=(1-z_0z)Χ(z),$ which corresponds to some $y_n = b_0x_n + b_1x_{n-1}.$ Let's take $b_0=b_1=1$ for simplicity. I mean that $y_n = x_n + x_{n-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we want to determine the effect of the system H(z) upon harmonic signal. That is, the input is going to be test signal $$x_n = e^{jwn}\overset{z}{\leftrightarrow} 1 + e^{jw}z + e^{2jw} z^2 + \cdots = 1/(1-e^{jw})= X(z).$$&#xA;The response is going to be $$y_n = x_n + x_{n-1}|_{x_n = e^{jwn}} = e^{jwn} + e^{jw(n-1)} = e^{jwn}(1+e^{-jw})$$ that is, $1+e^{-jw}$ is the transfer function or $Y(z) = {(1+z)\over (1-e^{jw}z)} =(1+z)X(z)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that $1+z$ basically says that output is sum of input signal plus shifted signal, since single $z$ stands for single clock delay in time domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, as explained &lt;a href=&quot;http://web.eecs.umich.edu/~aey/eecs206/lectures/lti2.pdf&quot; rel=&quot;nofollow&quot;&gt;in&lt;/a&gt;, $H(jw) = 1 + e^{-jw} = e^{-jw/2}(e^{jw/2}+e^{-jw/2}) =e^{-jw/2}2\cos(w/2)$. Cosine makes it to behave like low-pass filter&#xA;$$    \begin{cases}&#xA;      w=0 &amp;amp; \Rightarrow &amp;amp;H(j0) = 1\cdot 2 \cos (0) = 2\\&#xA;      w=\pi &amp;amp; \Rightarrow &amp;amp; H(j\pi) = e^{j\pi/2}2\cos(\pi/2) = 0&#xA;    \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also a good lesson that you get $2 cos \alpha = e^{i\alpha} + e^{-i\alpha}$ because you will supply the real signals rather than complex imaginary ones in real life.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LTI with impulse response  = {1,-1} is $y_n=x_n -x_n|_{x_n=e^{jwn}} =e^{jwn}(1-e^{-jw})$ has transfer function of $H(jw) = (1-e^{-jw}) = e^{-jw/2}(e^{jw/2}-e^{-jw/2})=e^{-jw}2\sin(w/2)$, which has zero at $w=0$ since $sin(0)=0$ but it can be found from the frequency response $$H(jw)=1-e^{-jw} = 0 \Rightarrow e^{-jw} = 1 = e^0 \Rightarrow w = 0.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the textbooks, I can spot the surprising coincidence between transfer function $H(z) = 1\pm z$ and frequency response $H(jw)=1\pm e^{-jw}$. That is, z somehow corresponds to $e^{-jw}$, which is important for zero/pole analysis. I read it like &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;sine z-factor stands for a clock shift and $y_n = x_n \pm x_{n-1}=0$ means that next sample is $\pm$ previous one to get zero response, we need to have $1\pm z=0$ in front of X(z). But, the frequency domain basis functions $e^{jwn}$ evolve by multiplying current value $e^{jw(n-1)}$ with $e^{jw}$ every clock. Therefore, we have $e^{jwn}(1 \pm e^{-jw}) =0$ as condition for constant zero output. The latter $1\pm e^{-jw}$ matches perfectly with zero transfer function $1\pm z=0$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In general, single-zero LTI is given by $y_n = b_0 x_n + b_1 x_{n-1}$ or $$Y(z) = (b_0 + b_1 z)X(z) = (b_0+ b_1z)(1+x_1z+x_2z^2+\cdots) = b_0 + (b_0 x_1 + b_1 x_0)z + (b_0 x_2 + b_1 x_1)z^2 + \cdots. $$ When $b_0+b_1 z = 0$, i.e. when $z=-b_0/b_1,$ whereas frequency response is, $$y_n(x_n = e^{jwn}) = b_0 e^{jwn} + b_1 e^{jw(n-1)} = e^{jwn}(b_0+b_1 e^{-jw})= e^{jwn}b_0(1-z_0 e^{-jw}),$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;which goes to zero when $1-z_0 e^{-jw} = 0$ or $e^{-jw} = 1/z_0$, which matches the computation for $z$ if $z=e^{-jw}$. The only thing that bothers me is that fixed-amplitude complex exponential is not enough for the frequency (harmonic) basis. You cannot obtain arbitrary ratio $1/z_0= e^{-jw}$ by choosing appropriate frequency $w$, a decaying harmonic signal is needed for that. That is weird because I have heard that any signal can be represented as sum of (constant amplitude) sines and cosines. But, anyway, we see that system zero stands for relationship between adjacent samples of input signal. When they are right, the output is identically 0 and we can choose such such frequency $w$ so that zero $z = 1/z_0 = e^{-jw}.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what about the poles? Let's single out a single pole $a$. The system has a from of $y_n = a y_{n-1} + (x_n + x_{n-1} + \cdots)$, under assumption $y_0 = 0$, has z-transform of $Y(z) = X(z)/(1-az)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The feedback $a$ is equivalent to infinite impulse response ${1,a,a^2,\ldots} \overset{z}{\leftrightarrow} 1 + az + a^2z^2 + \cdots = 1/(1-az)$. It says that response is infinite when $z=1/a$. What does it mean if we apply the test signal $$x_n=e^{jwn}\overset{z}{\leftrightarrow} X(z) = 1+e^{jw}z+e^{2jw}z^2+\cdots = 1/(1-e^{jw}z)$$ to our system? We'll get $Y(z)={1\over 1-az}{1\over 1-e^{jw}z},$ or $$y_n = e^{jwn} + ae^{jw(n-1)} +a^2e^{jw(n-2)} +\cdots = e^{jwn}(1+ae^{-jw} + a^2e^{-2jw} + \cdots) ={e^{jwn}\over 1-ae^{-jw}}.$$ That is, frequency response is $1/(1-ae^{-jw}),$ which goes to infinity when $e^{-jw}=1/a,$ the same as $z_{pole}$ above, $e^{-jw}=z_{pole}=1/a$. But again, you can not always arrive at the pole $1/a$ adjusting the frequency $w$ alone. The frequency basis functions must be decaying amplitude in general and look like $(ke^{jw})^n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, zeroes or poles of the transfer function $H(z)$ happen to match the zeroes and poles of frequency response $H(jw)$, which is really amazing. I noticed that this is related to the relation between adjacent samples, $e^{jwn}/e^{jw(n-1)} = e^{jw} = 1/z_{zero}$ in case of zeroes. The fact that $e^{jwn}$ scales exponentially over time, along with the system with feedback $a$, also seems to be the key for matching between $e^{jw}$ and $z_{poles}$. It also seems important that you cannot simply look for the appropriate frequency of $e^{jwn}$, the basis function must also have adjustable amplitude factor $k^n$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be happy if anybody could explain the same more condensely or more crisply. &lt;/p&gt;&#xA;" OwnerUserId="19489" LastActivityDate="2016-04-22T20:14:58.210" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30287" PostTypeId="2" ParentId="30283" CreationDate="2016-04-22T21:39:50.790" Score="5" Body="&lt;p&gt;Imagine that you're heating (or cooling) a home with a modern furnace (or air conditioner).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the &lt;strong&gt;reference&lt;/strong&gt; or &lt;strong&gt;set point&lt;/strong&gt; is the temperature that you set your thermostat to be.  the feedback signal is the &lt;strong&gt;actual&lt;/strong&gt; temperature that is measured with some kinda thermometer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the actual value that you are trying to control, whether it's temperature or the position of a robot arm or the position of a pointer in an asynchronous sample rate converter, that actual value is compared to your reference value.  the difference between those two signals is what drives your &lt;em&gt;&quot;controller&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the case of heating your home, if the actual temperature is below the reference (what you &lt;strong&gt;want&lt;/strong&gt; your temperature to be), the furnace heat is increased.  if the actual temperature is above the reference, the furnace heat is decreased.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-04-22T21:39:50.790" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30289" PostTypeId="2" ParentId="30200" CreationDate="2016-04-22T22:34:33.520" Score="2" Body="&lt;p&gt;I think that I started to understand the &lt;a href=&quot;https://dsp.stackexchange.com/a/30285/19489&quot;&gt;relationship between zeros/poles and the frequency response&lt;/a&gt;. The idea is that you adjust the frequency $w$ of your frequency-domain basis functions $e^{jwn}$ and speed of their decay to match the $z_{zero/pole}$. I mean that that zero/pole can be complex number with amplitude outside the single circle and adjusting the frequency you move your complex number $e^{-jw}$ vector along the single circle in the complex plane but there is no frequency that can make it equal to $z=2$ or $z=j/3$, for instance. So, your basis functions must look like $e^{(k-jw)n}$ to reach any pole/zero in the complex plane. It is interesting because I heard that Fourier basis $e^{-jw}$ can represent any singnal but it seems insufficient and we need Laplace basis $e^{(k-jw)n}$ in filter design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, purely real $z$ means that the &quot;complex exponent&quot; that matches it has no imaginary component. It must decay without oscillations, like $e^{kn}$, in order to respond the zero/pole. Take pole at $z=1$, for instance. You have a system $y_n - y_{n-1} =  x_n + x_{n-1} + \ldots$ so that $Y(z) = X(z)/(1-z).$ The pole $z = e^{-jw} =1$ corresponds to frequency $w=0$. Indeed, with $x_n=1$, we have $y_n = y_{n-1} + 1$ which grows unboundedly. Making it oscillating, i.e. setting $w \neq 1$, will break the growth since it will first accumulate, when $x_n=2cos(wn) = e^{jwn} +e^{-jwn}&amp;gt; 0$ and then reduce the accumulation to zero, during the second half of the sine period. This suggests that imaginary poles will give you infinite responses for oscillating functions (components of your inputs signal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have a system $y_n=ay_{n-1}$, you can easily get the pole function by applying a delta impulse at the input. The response observed is the pole. I mean that response is a decaying exponent $y_n = e^{k-jw}n=a^n$. Every clock it is $a = e^{k-jw}=e^ke^{-jw}$ times the previous value. Note, that it (the pole aka feedback coefficient and, hence the response function) is complex it general, which means that your response will oscillate. When you multiply a complex number by another, your number is scaled in length and shifted in phase. The complex part is responsible for the phase shift (the oscillations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I remember from the system theory that oscillations actually stand for the second order system. &lt;a href=&quot;https://physics.stackexchange.com/questions/221243&quot;&gt;Probably, this will answer mine commutation cell question&lt;/a&gt;. The idea is that when you have first level controls the increment of the other and the other controls the increment of the first, like the electric inductor and capacitor in harmonic oscillator,&#xA;$$\begin{cases}&#xA;\dot{u} &amp;amp; = &amp;amp;i\\&#xA;\dot{i} &amp;amp; = &amp;amp;-u\\&#xA;\end{cases}$$&#xA;&lt;a href=&quot;https://i.stack.imgur.com/N4thR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N4thR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is a second order system because can be expanded into $\ddot{u}  = \dot{i} = -u$, the famous spring osciallator equation: position negatively controls the accelration. So, two purely real state variables (aka accumulators) do oscillate. I see that the complex plane also consists of two axis, the same two variables. When all energy is concentrated in the first accumulator, you have 1+0j state, when half way back, you have the opposite, state=0+1j, then second accumulator pushed energy backwards, state3=-1+0j, which is ponged to the first into the state4= 0-j and process repeats. These are 4 quarters of traveling along a unit circle in the complex plane and mimicking the harmonic oscillations. So, probably, you will be able to split $1/(1-(a+jb)z)$ into $1/(1-r_0z)\cdot 1/(1-r_1z)$ with real $r_0$ and $r_1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wait, you cannot make that decompose single $z$ into $z^2$ and I recall that complex poles always come in conjugate pairs. That is, if you have pole (a+jb), you also have (a-jb). As i understand, this helps to make output purely real, given real input since feedback (a+jb) means that system evolves as $(a+jb)^n = e^{(k+jw)n}$, the phase rotates in one direction whereas $$(a-jb)^n = e^{(k-jw)n}$$ rotates the phase in the other direction and their sum is $e^{kn}(e^{jw}+e^{-jw})^n$ is purely real. The $x_{n+1}=-x_{n-1}$ system above has solution $X(z)=(x_0+zx_1)/(1+z^2)=(x_0+zx_1)/[(1+jz)(1-jz)]$. Probably you already understand this. I just expanded your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transfer function $1/(1+z^2)$ stands for the sequence $\{1,0,-1,0,1,0,\ldots\}$. There must be a &quot;hidden variable&quot; (yes, it is interesting if complexity of poles is identical to the need for imaginary numbers we need in QM. The position and momenta are complex conjugates, a sort of 90° rotated, of each other and knowing one you can compute the other) hidden variable in order to keep in mind if we are moving to 1 or -1 after 0 state. The complex conjugate is a kind of complimentary, orthogonal accumulator yet real variable, such as inductor current for capacitor voltage, that keeps track for that. I join the question for anybody to clarify why we need two such complements in order to have purely real voltage oscillation and what does single complex oscillation mean. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see it this way (for the LC-oscillator above)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{bmatrix}\text{state} &amp;amp;\text{description}&amp;amp; \text{capacitor [V]} &amp;amp; \text{inductor [I]} \\&#xA;0&amp;amp;\text{all energy is in the capacitor} &amp;amp; 1 + 0j &amp;amp; 0 + j \\&#xA;1&amp;amp;\text{all energy is in the inductor} &amp;amp; 0 + j &amp;amp; 1 + 0 \\&#xA;2&amp;amp;\text{all energy is negaitvely charged cap} &amp;amp; -1 + 0 &amp;amp; 0 + -j \\&#xA;3&amp;amp;\text{all energy is negative current} &amp;amp; 0 + -j &amp;amp; -1 + 0 \\&#xA;\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, what you see imaginary voltage is a real current in a parallel frame of reference, i.e. from the inductor's point of view. Because, as I have tolde you, LTI state evolves by multiplying the current state with eigenvalue, we should oscillate between 1 and -1 over the unit circle, which implies j intermediate states. But, what you see as conserved energy in the imaginary space, happens to be just another accumulator. The conjugate accmulaor is just another accumulator. For some reason it happens to be of conjugate kind, as I tried to explain in the &lt;em&gt;commutation cell&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seem to deviate again. Since harmonic oscillation is a superposition of two evolutions, made by two complex poles $j$ and $-j$, we should have two columns per every conjugate variable. Here is the missing part&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{bmatrix}\text{state} &amp;amp; \text{capacitor -j [V]} &amp;amp; \text{inductor [I]} \\&#xA;0&amp;amp; 1  &amp;amp; 0 j \\&#xA;1&amp;amp; 0 - j &amp;amp; -1 \\&#xA;2&amp;amp; -1 + 0 &amp;amp; -j \\&#xA;3&amp;amp; 0 + j &amp;amp; +1 \\&#xA;\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The voltage in capacitor is a real value, which is an average of two capacitor columns, $(j^n + (-j)^n)/2 = \cos (n\pi/2)$. The to processes opposite rotations cancel the imaginary components out. In fact, the current flows in one direction but $\ddot(x)=-x$ admits any direction and abstracts it away but the averaging. So, pole alone stands for a concrete process, the flow of current in one direction or the other. And, if you ask what is the complex pole, the answer is it is the factor by which vector [current, voltage] is scaled every clock if we are in the discrete domain (or [di/dt, dv/dt] if we are in the continous domain) where real factor stands for their amplitude, real part $cos w$ of the complex factor $e^{jw}$ stands for voltage evolution and imaginary part $sin w$ stands for current evolution. The current is imaginary because you look from the voltage point of view, $\ddot{v}=-v$. In contrast, the voltage would be imaginary and current real from the current frame of reference, $\ddot{i}=-i$. Hopefully, this is correct and anybody can explain it better.&lt;/p&gt;&#xA;" OwnerUserId="19489" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-04-24T11:53:10.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30290" PostTypeId="2" ParentId="30264" CreationDate="2016-04-23T01:24:47.440" Score="3" Body="&lt;p&gt;The prime thing such algorithms aim to do is to make use of more information that you may have about the signal. In this case, the extra information is that you know the number of signals (sinusoids) present in your measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One pro for both is, therefore, when your measurements match the assumption, you get a more accurate representation of the spectrum: it has the right number of lines. The FFT does not guarantee this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A con is that, if your assumption is wrong (there are three lines instead of two), then these algorithms perform worse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These algorithms &lt;strong&gt;do not&lt;/strong&gt; give better resolution than the FFT. Only more data can give more resolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a good exposition &lt;a href=&quot;http://www.girdsystems.com/pdf/GIRD_Systems_Intro_to_MUSIC_ESPRIT.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; comparing the two to each other.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-23T01:24:47.440" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30291" PostTypeId="2" ParentId="30258" CreationDate="2016-04-23T06:53:10.290" Score="0" Body="&lt;p&gt;You can't make the filter general, that is, independent of $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a general filter not dependent on $x(t)$ your requirement #4 means that $y(t) = x(t)$, because if the filter is general, it must work just as well for a time-shifted $x(t)$. So due to the time-invariance property of filters, in requirement #4, $y(t) = x(t)$ for all integer $t$ becomes $y(t+u) = x(t+u)$ for all integer $t$ and all real $u$, which can be written simply as $y(t) = x(t)$ for all real $t$. So the filter must pass the signal unchanged. That requires $x(t)$ to be band-limited and the filter can no longer be general: the band-limit of $x(t)$ must be known in order to decide on the filter, which must have in its magnitude frequency response a flat passband of at least the bandwidth of $x(t)$. Without knowing the band-limit of $x(t)$ we would need the filter to have infinite bandwidth which is ruled out by your #2 that prohibits using the Dirac delta function and related abominations.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-04-23T07:11:15.850" LastActivityDate="2016-04-23T07:11:15.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30292" PostTypeId="1" AcceptedAnswerId="30296" CreationDate="2016-04-23T10:48:34.643" Score="1" ViewCount="85" Body="&lt;p&gt;Let's say I made this block diagram and I want to explain it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rIxpl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rIxpl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI: $x$ is a signal and each $y$ box is a matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;I want to say that:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal $x$ is multiplied by each matrix $y$ in the different branches independently to produce &#xA;$f_0=xy_0$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_1=xy_1$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_m=xy_m$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to ask the experts in the signal processing world if this is formal enough? or am I sounding weird?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Edit 1:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What if I said:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal $x$ is multiplied by a set of matrices $y_k$ where $k = 0,1,..., m$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;does it sound better? or would it imply that $x$ is multiplied like: $x*y_0*y_1*...*y_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is &lt;strong&gt;NOT&lt;/strong&gt; what I intend to say&lt;/p&gt;&#xA;" OwnerUserId="11988" LastEditorUserId="13320" LastEditDate="2016-11-21T12:32:30.253" LastActivityDate="2016-11-21T12:32:30.253" Title="describing a block diagram // How do I describe multiplying a signal through multiple branches formally?" Tags="|filter-design|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30293" PostTypeId="1" CreationDate="2016-04-23T11:45:33.727" Score="-1" ViewCount="444" Body="&lt;p&gt;I'm trying to perform an FFT using the CMSIS libraries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My FFT_Output[] provides 1024 bins of data as expected. The issue is that it's linearly spaced and I want to change it to a logarithmic scale into 64 bins (each of these bins correspond to an LED) as it corresponds with how we hear so looks better. I'm sampling at 44kHz and taking 2048 samples (FFT_Output provides 1024) and using a TM4C1294XL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to keep the 'negative' frequencies that the FFT produces for the symmetrical effect that it'll have on the LEDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm really struggling with how to do this, I've never done logarithms in C. I have no problem scaling it linearly. How could I change this function (which scales lin) to do it logarithmically or is there a better way? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FFT_Output[] - my 1024 result &#xA;bin[] - my 64 bit bin that corresponds to my LEDs&#xA;bin_scaled[] - my 64 scaled to 255 (the number needed for my LEDs)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int j;&#xA;    for(j=0; j&amp;lt;N_LED; j++)&#xA;    {&#xA;        IntMasterDisable();&#xA;        int i;&#xA;        for(i=0;i&amp;lt;N_SAMPLES/2;i++)&#xA;        {&#xA;            bin[i/16] += FFT_Output[i];&#xA;        }&#xA;&#xA;        arm_max_f32(bin, N_LED, &amp;amp;Bin_maxValue, &amp;amp;Bin_Index);&#xA;        bin_scaled[j] = (bin[j]/Bin_maxValue)*255; //this is the array that will be used&#xA;        IntMasterEnable();&#xA;     }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20666" LastEditorUserId="13320" LastEditDate="2016-04-23T16:04:44.353" LastActivityDate="2016-04-23T17:42:15.920" Title="FFT: Linear to Logarithmic (TM4C, CMSIS &amp; NeoPixels/ws2812)" Tags="|fft|math|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30295" PostTypeId="1" CreationDate="2016-04-23T14:19:28.037" Score="2" ViewCount="1207" Body="&lt;p&gt;While looking into DFT leakage, I've came across the author saying that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;..., the amplitude response of an N-point DFT bin in terms of the bin index m is approximated by the sinc function.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Other than the fact that the fourier transform of the rectangle function is the sinc function, I have no idea why the statement above is true.&lt;/p&gt;&#xA;" OwnerUserId="20670" LastActivityDate="2016-04-23T21:10:35.807" Title="Why is N-point DFT approximated by the sinc function?" Tags="|fourier-transform|dft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30296" PostTypeId="2" ParentId="30292" CreationDate="2016-04-23T15:39:47.850" Score="3" Body="&lt;p&gt;What I would do is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add $m$ multiplier blocks, using a circle with a $\times$ inside&lt;/li&gt;&#xA;&lt;li&gt;Each multiplier would have inputs $X$ and $Y_k$&lt;/li&gt;&#xA;&lt;li&gt;Each multiplier would have output $f_k$&lt;/li&gt;&#xA;&lt;li&gt;Be consistent in the use of bold typeface, uppercase and lowercase&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then I would say something like &quot;The system has input $X$ and outputs $f_k=XY_k$, for $k = 0,\ldots,m$. In the diagram, $\times$ stands for signal-matrix multiplication, which is defined as follows...&quot;.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-04-23T15:39:47.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30298" PostTypeId="2" ParentId="30295" CreationDate="2016-04-23T16:52:22.720" Score="4" Body="&lt;p&gt;When a waveform of arbitrary length is cut into a length that can be fed to an N-point DFT (with N being finite), that is the same as multiplying that original waveform by a rectangular window of that given finite length.  Multiplication in the time domain is the same as convolution in the frequency domain with the Fourier transform of that multiplying function, which happens to be a Sinc function for a rectangular window (or more precisely, for finite length real data, a conjugate mirrored Dirichlet (or periodic Sinc) function, which is pretty close to a regular Sinc, except near DC or Fs/2 or with very short DFTs.  More details &lt;a href=&quot;http://www.nicholson.com/rhn/dsp.html#4&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to look at it is that any pure sinusoid of a frequency that is not exactly equal to one of the DFT basis vectors will thus not be orthogonal to any of the DFT basis vectors.  Thus any non-zero magnitude of that sinusoid must end up partially represented in every element of a DFT result (since only orthogonal vector dot products will end up zero).  To interpolate the magnitude of that original non-orthogonal pure sinusoid, one might use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula&quot; rel=&quot;nofollow&quot;&gt;Whittaker–Shannon interpolation formula&lt;/a&gt; which happens to use a Sinc kernel to weight the contributions from all the DFT result elements into which energy from the original sinusoid was spread.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-23T21:10:35.807" LastActivityDate="2016-04-23T21:10:35.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30299" PostTypeId="2" ParentId="30293" CreationDate="2016-04-23T17:42:15.920" Score="-1" Body="&lt;p&gt;You could do something similar to using a &lt;a href=&quot;http://www.ee.columbia.edu/ln/rosa/doc/HTKBook21/node54.html&quot; rel=&quot;nofollow&quot;&gt;Mel triangular filter bank&lt;/a&gt; to do a weighted extraction from the longer FFT result vector into your shorter 64 bin log-spaced result vector elements.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-23T17:42:15.920" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30300" PostTypeId="1" AcceptedAnswerId="30481" CreationDate="2016-04-23T17:43:22.227" Score="7" ViewCount="477" Body="&lt;p&gt;I'm very often in the situation that I need to explain / visualize spectrum of signals or frequency behaviour of systems (esp. filters). My favourite, very &quot;textbook&quot; styled way of communicating these would be, in simpler cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cm8Yq.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cm8Yq.png&quot; alt=&quot;simple spectra, Bellanger&quot;&gt;&lt;/a&gt;¹&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, I'd have to visualize something like aliasing, effects of suppressing carriers etc. This also leads to less simple situations, like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xxfPZ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xxfPZ.png&quot; alt=&quot;complicated spectra, Bellanger&quot;&gt;&lt;/a&gt;¹&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, drawing these kinds of diagrams is really a burden if done with my vector program of choice (that being Inkscape) – I want to parametrically specify the spectrum, not manually shift, copy, mirror and repeat lines!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you approach theses kind of visualizations? Vector graphics programs &amp;amp; patience? Pen &amp;amp; paper? Or do you have a private set of scripts that e.g. draw the diagram with the help of matplotlib or tikz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;¹ Bellanger: Digital Processing of Signals: Theory and Practice. 2nd Edition, Wiley 1988. P. 17 &amp;amp; p. 18.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-05-01T01:45:30.573" Title="Explaining / Communicating spectra: Generating Visualizations" Tags="|frequency-spectrum|visualization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30303" PostTypeId="1" AcceptedAnswerId="30700" CreationDate="2016-04-23T20:03:52.947" Score="1" ViewCount="970" Body="&lt;p&gt;Let's assume I have a 1024 x 1024 matrix that represents the spatial domain.  After I perform a FFT and center the frequencies, I get the a signal that looks like the following in the frequency domain.  Let's say that this signal is centered around (812, 812).  Now, I want to shift this to the center of the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZXt9O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZXt9O.png&quot; alt=&quot;Signal in the frequency domain&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what exactly qualifies as the center of the frequency domain?  Is it (512, 512), (512, 513), (513, 512), or (513, 513)?  If I perform the inverse FFT to the shifted signal, and plot the phase of the complex signal, I get results that look like the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6Lt0Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6Lt0Y.png&quot; alt=&quot;Centered at (512, 512)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I shift to other centers (512, 513), (513, 512), or (513, 513), I get a similar slowly-varying frequency in my background.  Whereas in the original signal, the phase of the background is constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, what is the best way to ensure that shifting to the center faithfully represents this constant background phase?&lt;/p&gt;&#xA;" OwnerUserId="18929" LastEditorUserId="18929" LastEditDate="2016-04-23T20:09:51.523" LastActivityDate="2016-05-10T04:34:13.217" Title="How to shift a signal to the center of the frequency domain?" Tags="|matlab|fft|frequency-spectrum|phase|ifft|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30305" PostTypeId="2" ParentId="29906" CreationDate="2016-04-23T20:24:46.103" Score="0" Body="&lt;p&gt;1) HPF I would say you probably can't have one.&lt;br&gt;&#xA;The  accelerometer has similiar considerations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gyroscope stream is in terms of xxx output=yyy angular velocity.  Any HPF analog or digital would sag to zero when you attach it to the hub of bicycle wheel or hub of a motor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The alternative to a HPF is &quot;sample and hold&quot; a value when the unit is at rest.  There are three alternatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1-a) During manufacturing take a string of readings at rest and store the value as an offset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1-b) During power on do the same thing and tell the operator not to disturb it until a ready signal/light comes on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1-c) Just live with the error of about 1/2 deg/sec ; or 1 rpm after 12 minutes.   That's as I read the error from your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are willing to live with the sag then I can do the calculations; but I keep thinking of the motor, or bicyclist, going faster and faster trying to keep up to the &quot;speed&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An &quot;alternative&quot; is to differentiate the input and then integrate but that usually doesn't work out very well due to errors introduced during differentiation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) LPF&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got good results with a cutoff frequency .34 hertz and a fourth order bessel filter.  My octave 4 (a matlab like program) program and data are at:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/sh/av5w0qi4myc2tbm/AACxJllMNDsxT2x9nOvjFjMPa?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/sh/av5w0qi4myc2tbm/AACxJllMNDsxT2x9nOvjFjMPa?dl=0&lt;/a&gt;&#xA;Here are the graphs for the first column of gyros.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;)2-a Overlay of filtered output versus raw.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zBbzq.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zBbzq.jpg&quot; alt=&quot;Overlay&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;)2-b  Filtered signal&#xA;&lt;a href=&quot;https://i.stack.imgur.com/TDZaf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TDZaf.jpg&quot; alt=&quot;Filtered&quot;&gt;&lt;/a&gt;&#xA;)2-c  Normal probability plot pplot()  Straight lines indicate that the errors are gaussian in distribution.  The lapse in the center is a deadband due to resolution&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FLT7s.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FLT7s.jpg&quot; alt=&quot;pplot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other tests but these exemplify the process.  I always check fittings with pplot (or relatives) to see if the fitting leaves gaussian in distribution.  The &quot;staightness&quot; fits into our visual system and is easy.  If not I want to know why; if so I want to know why :) The point is that for some (most?) process trying to dig into gaussian residues is a thankless task.  The truth is I would also look at the autocorrelation as well; but I doubt if you are interested.  One other thing is that one can also plot expected bounds on &quot;straightness&quot; if you want.  In fact this graph indicates that perhaps the filtering is excessive.&lt;/p&gt;&#xA;" OwnerUserId="11607" LastEditorUserId="11607" LastEditDate="2016-04-27T20:47:44.033" LastActivityDate="2016-04-27T20:47:44.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30306" PostTypeId="1" CreationDate="2016-04-23T20:46:43.253" Score="1" ViewCount="246" Body="&lt;p&gt;I am working on a task of segmenting small artifacts from a set of images like below:&lt;a href=&quot;https://i.stack.imgur.com/eEAQ0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eEAQ0.png&quot; alt=&quot;Few samples&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a generic approach, but unsure of what to search?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried looking at density flow analysis, but don't know if that fit in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to come up with a single pattern in all the images. For example I look out for &quot;loops&quot;, but few images have loop plus more lines, like in (d) above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One property I am certain about, the percentage of in these artifacts will be very less compared to the whole image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you help me with:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Any algorithm you know which will solve the problem?&lt;/li&gt;&#xA;&lt;li&gt;Any research paper, where a similar problem is solved. It is okay if that is not the topic of research paper, as this kind of work is usually present in per-processing stages. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="20654" LastActivityDate="2016-05-06T15:15:17.810" Title="Segmentation of small artifacts - Image Processing" Tags="|computer-vision|noise|image-processing|image-segmentation|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30307" PostTypeId="1" CreationDate="2016-04-24T00:42:01.440" Score="2" ViewCount="905" Body="&lt;p&gt;Why is Goertzel Algorithm considered a block algorithm? Given that my input is bounded, couldn't I just run it forever (taking every sample that comes out after some length N) given a big enough word size for the intermediate coefficients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that I would get rectangular window spectral leakage, which may not be desirable, but let's assume it is good enough. If my input signal is stationary, then eventually I should get fairly good spectral resolution, correct? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if it isn't stationary? What is the memory of the Goertzel algorithm? How fast does the input signal frequency need to change before I get garbage results? &lt;/p&gt;&#xA;" OwnerUserId="19259" LastActivityDate="2016-05-24T02:48:28.173" Title="Real Time Goertzel Algorithm" Tags="|discrete-signals|infinite-impulse-response|fourier|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30308" PostTypeId="2" ParentId="30307" CreationDate="2016-04-24T02:09:35.003" Score="2" Body="&lt;p&gt;You can use forms of the Goertzel algorithm as a fixed length block filter, as a IIR filter with a very long impulse response, or as a fixed length running filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a fixed length filter, a Goertzel results in a FIR filter similar (almost identical) to the result of 1 bin of a DFT or FFT of the same length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an IIR filter, a Goertzel filter is on the edge on instability (pole right on the unit circle), so you may need to bound the filter state and/or output externally, or reduce the gain slightly below 1.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a fixed length running filter, you subtract the output of  2 offset (but stabilized) Goertzel IIR filters to get a FIR filter or 1 bin of a DFT (length equaling the offset) that updates every input sample, and with very few MACs per sample.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-24T02:15:36.647" LastActivityDate="2016-04-24T02:15:36.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30310" PostTypeId="1" CreationDate="2016-04-24T03:39:28.853" Score="0" ViewCount="186" Body="&lt;p&gt;I normally implement the Hilbert transform using the Fourier transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have noise related issues I want to solve. Does anybody have an (apodized) implementation of the Hilbert transform handy, preferably using a wavelet transform or some other kind of band limited convolution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints on how to generate a 1D or 2D kernel for instantaneous phase extract would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="941" LastEditorUserId="15892" LastEditDate="2016-04-24T07:36:59.507" LastActivityDate="2016-04-24T08:42:05.123" Title="Code for a wavelet based hilbert transform?" Tags="|wavelet|phase|software-implementation|hilbert-transform|" AnswerCount="1" CommentCount="2" ClosedDate="2016-04-25T11:37:27.777" ContentLicense="CC BY-SA 3.0" />
  <row Id="30311" PostTypeId="2" ParentId="30310" CreationDate="2016-04-24T08:42:05.123" Score="2" Body="&lt;p&gt;Shameless plug ahead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 1D $M$-band dual-tree wavelet toolbox can be found in &lt;a href=&quot;https://www.projet-plume.org/en/relier/1d-wavelet-decompositions&quot; rel=&quot;nofollow noreferrer&quot;&gt;1D Wavelet decompositions : Matlab toolbox for 1D dual-tree M-band wavelet decomposition&lt;/a&gt;, and we just shared the 2D version embedded in a code for multivariate Gaussian noise image filtering in &lt;a href=&quot;http://fr.mathworks.com/matlabcentral/fileexchange/56705-m-band-2d-dual-tree--hilbert--wavelet-multicomponent-image-denoising&quot; rel=&quot;nofollow noreferrer&quot;&gt;$M$-band 2D dual-tree (Hilbert) wavelet multicomponent image denoising&lt;/a&gt;. It is not  as clean as I wished, I hope I can work on a specific version soon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, although the primal wavelet fiters are FIR, these wavelets are implemented in the Fourier domain, as for splines. We found that pure time- or space- FIR approximations for their implemetation included directional issues. We choosed  $M$-band wavelets because they allow orthogonality, symmmetry and finite support. We suspect that the finer frequency decomposition is beneficial to the Hilbert transform, that works better on band-limited signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another discussion can be found in &lt;a href=&quot;https://scicomp.stackexchange.com/questions/23600/what-are-the-most-popular-wavelet-or-tight-frame-regularizers-for-image-reconstr/23601#23601&quot;&gt;What are the most popular wavelet or tight frame regularizers for image reconstruction problems?&lt;/a&gt; and in &lt;a href=&quot;https://dsp.stackexchange.com/questions/29634/how-to-implement-a-j-level-m-band-wavelet-transform-of-an-image/29638#29638&quot;&gt;How to implement a $j$-level $M$-band wavelet transform of an image?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of diversity, you can find other ($2$-band) codes &lt;a href=&quot;http://www.laurent-duval.eu/siva-signal-image-links.html#siva-dual-tree-wavelets&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:53:54.087" LastActivityDate="2016-04-24T08:42:05.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30313" PostTypeId="1" AcceptedAnswerId="30380" CreationDate="2016-04-24T16:48:47.567" Score="0" ViewCount="1342" Body="&lt;p&gt;So i'm trying to figure how how to do the encoding and decoding of an M-array Differential Phase Shift Keying (DPSK) signal. I understand how to do it for binary DPSK, but on higher ordered signals I'm missing something. Here's how I would do it for binary DPSK (M=2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The steps should be as follows: get Data sequence -&gt; Differential encoding -&gt; assign phase for Tx -&gt; (on the receiver side) do Differential decoding - assign bits from phase. The following assumes an initial bit of 1, where 1 corresponds to a phase of $\pi$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Data Sequence $b$ =   | 1 0 1 1 0 0 1 0 1 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Diff Encoding $a$ = 1 | 0 0 1 0 0 0 1 1 0 0  -&gt; this opperation should be $a_k = a_{k-1}\oplus b_k$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Assign phase $\phi$= $\pi$ | 0 0 $\pi$ 0 0 0 $\pi$ $\pi$ 0 0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Diff Decoding $\rho$= $\ $$\ $$\ $| $\pi$ 0 $\pi$ $\pi$ 0 0 $\pi$ 0 $\pi$ 0 -&gt; where $\rho = \phi_n - \phi_{n-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Phase to bit = $\;\;\;\;\;\;\;$| 1 0 1 1 0 0 1 0 1 0  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I end up with my original sequence. but if I try to do this with M=4, I don't end up with the same sequence. Lets assume for M = 4 that 00 = 0, 01 = $\frac{\pi}{2}$, 11 = $\pi$ , and 10 = $\frac{3\pi}{2}$, and that we start with initial data 11&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Data Sequence $b$ = $\ $  | 10 11 00 10 10&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Diff Encoding $a$ = 11 | 00 11 11 01 11  -&gt; this opperation should be $a_k = a_{k-1}\oplus b_k$ = ($a_{k-1} + b_k$) mod M&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Assign phase $\phi$= $\ $ $\pi$ | 0 $\pi$ $\pi$ $\frac{\pi}{2}$ $\pi$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Diff Decoding $\rho$=$\ $$\ $$\ $$\ $$\ $ | $\pi$ $\pi$ 0 $\frac{3\pi}{2}$ $\frac{\pi}{2}$ -&gt;  where $\rho = \phi_n - \phi_{n-1}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\;\;\;\;$Phase to bit =$\, $ $\, $$\, $$\, $$\, $$\, $$\, $$\, $$\, $$\, $ | 11 11 00 10 01&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here I don't end up with the same sequence. I'm not quite sure where I'm messing up there. If feel like if I can do this for M=4 I can do this for any size M. Can someone help me see where I'm going wrong? Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastActivityDate="2016-04-27T01:43:58.843" Title="M-Array DPSK decoding and encoding" Tags="|digital-communications|modulation|demodulation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30314" PostTypeId="1" AcceptedAnswerId="30315" CreationDate="2016-04-24T16:56:15.297" Score="1" ViewCount="100" Body="&lt;p&gt;I've came across the author saying that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... for a real cosine input having &lt;em&gt;k&lt;/em&gt; cycles in the &lt;em&gt;N&lt;/em&gt;-point input time sequence, the amplitude response of an &lt;em&gt;N&lt;/em&gt;-point DFT bin in terms of the bin index &lt;em&gt;m&lt;/em&gt; is approximated by the sinc function $$X(m)=\frac{A_{0}\color{red}{N}}{\color{red}{2}}\cdot\frac{\sin[\pi(k-m)]}{\pi(k-m)}$$ where &lt;em&gt;$A_{0}$&lt;/em&gt; is the peak value of the DFT’s input sinusiod.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have no idea where $\frac{N}{2}$ came from. I'm wondering if you can give me some hints.&lt;/p&gt;&#xA;" OwnerUserId="20683" LastActivityDate="2016-04-24T17:45:04.043" Title="Where does $\frac{N}{2}$ came from in approximating an N-point DFT?" Tags="|fft|fourier-transform|dft|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30315" PostTypeId="2" ParentId="30314" CreationDate="2016-04-24T17:34:06.383" Score="4" Body="&lt;p&gt;The common formulation of the forward DFT preserves energy (&lt;a href=&quot;https://en.wikipedia.org/wiki/Parseval%27s_theorem&quot; rel=&quot;nofollow&quot;&gt;Parseval's theorem&lt;/a&gt;).  This means that a longer constant magnitude sinewave input to a DFT, which has proportionally more energy, must be represented by a proportionally larger value in the DFT result, preserving that greater energy.  Thus a factor of N, which scales with the length of the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For strictly real input, this energy is divided evenly between the positive frequency bin (k) and the negative frequency bin (N-k) of a DFT result (for a DFT of length N). These two complex result bins are always complex conjugates of each other (thus equal in magnitude) for strictly real input to a DFT.  Thus another factor of 1/2 is included to do this even energy split.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N and 1/2 results in a factor of N/2 which has to appear somewhere in the result of an energy preserving formulation of a forward DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the 1/2 does not appear for bin 0 or for bin N/2 of even length DFTs, as these have no complex conjugate image (or rather they include both of their complex conjugates summed together into a single result bin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that this Sinc function result is an approximation.  The actual result is closer to the sum of two Dirichlet functions (also called periodic Sinc functions).  See &lt;a href=&quot;http://www.nicholson.com/rhn/dsp.html#4&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-24T17:45:04.043" LastActivityDate="2016-04-24T17:45:04.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30316" PostTypeId="2" ParentId="30306" CreationDate="2016-04-24T20:59:18.380" Score="0" Body="&lt;p&gt;&lt;strong&gt;Assumptions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All your images are binary, i.e. the background is of a certain value (0) and the data is of a certain value (1). There is no noise in your images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The artifact that you would like to get rid of is those small lines that are attached to some crossing points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you say &lt;em&gt;...the percentage of in these artifacts will be very less compared to the whole image...&lt;/em&gt; you mean that the artifact lines are much shorter than the image lines. Much shorter is quantifiable by you, e.g. by a statement like &lt;em&gt;&quot;The artifact lines are 5% of the length of the other lines in the image&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proposed ansatz for an solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Detect the corners in your images, e.g. by an corner detection algorithm, or by a morphological image processing algorithm (if you have a fixed and known set of possible angles).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Save the corner information in a second array (or however you like), and erase the corner pixels from your original image. This leaves all the lines disjunct.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Label all the lines with an integer number.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate a histogram of these numbers, which is essentially the line length of each labeled line.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply your artifact percentage criterion on the histogram values and discard the lines that fall below it by setting the corresponding lines to the background value. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Get the saved corner pixels back in your image and remove the labeling information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-04-24T20:59:18.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30317" PostTypeId="1" CreationDate="2016-04-24T23:35:54.657" Score="0" ViewCount="138" Body="&lt;p&gt;As I understand it and have it currently implemented, linear prediction [via Burg's method or the autocorrelation method] is a block algorithm. Hence, there will be latency involved because one must first save a block of samples to use in the analysis -- even if the model order is low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But are there any sample by sample implementations of linear prediction? Are they less robust to noise?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: To be clear, I am really looking for a sample by sample estimation of the autoregressive polynomial coefficients in order to do inverse filtering. Does such a thing exist? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Thanks to RBJ for pointing out my conflation of terms.&lt;/p&gt;&#xA;" OwnerUserId="19259" LastEditorUserId="19259" LastEditDate="2016-04-25T13:48:58.647" LastActivityDate="2016-04-25T13:48:58.647" Title="Sample-By-Sample Linear Prediction" Tags="|algorithms|real-time|linear-prediction|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30319" PostTypeId="1" AcceptedAnswerId="30336" CreationDate="2016-04-25T01:24:58.517" Score="1" ViewCount="3118" Body="&lt;p&gt;I wanted to know how observability of a stochastic state space system affects the performance of a Kalman Filter. Do we check for the usual observability matrix involving $\mathbf{C}$ (observation matrix) and $\mathbf{A}$ (state transition matrix) or there is a newer notion of stochastic observability? In case of non-observability, does the error between true and estimated states go out of bound ?&lt;/p&gt;&#xA;" OwnerUserId="20689" LastEditorUserId="80" LastEditDate="2016-04-25T14:20:29.507" LastActivityDate="2018-06-09T23:25:50.990" Title="Observability for Kalman Filtering?" Tags="|kalman-filters|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30322" PostTypeId="1" AcceptedAnswerId="30330" CreationDate="2016-04-25T05:22:59.690" Score="0" ViewCount="191" Body="&lt;p&gt;I'm trying to evaluate received signals from a transceiver. I want to make a threshold of received signals so that we can say some signals are meaningless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have learnt something about Signal-to-Noise-Ratio (SNR) and Received-Signal-Strength (RSS). But I found that symbols can still be decoded even in low SNR ($\le 0$ dB).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If I choose SNR as my metrics, will my threshold be relevant to modulation or coding schemes?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Will RSS be suitable for theoretic analysis as metrics?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="20695" LastEditorUserId="13320" LastEditDate="2016-11-21T12:32:08.307" LastActivityDate="2016-11-21T12:32:08.307" Title="How to evaluate quality of signal?" Tags="|snr|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30324" PostTypeId="2" ParentId="30313" CreationDate="2016-04-25T08:53:21.553" Score="0" Body="&lt;p&gt;First, it seems that your encoding for $M=4$ is not correct. If you start with  $a_0 = 11$ ($\phi = \pi)$ and your first data symbol is $10$, which implies a $+3 \pi/2$ phase shift according to your definition, you should end up transmitting with $\phi = \pi/2$, not $0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the encoding, you may consider use an integer representation, as suggested in another question &lt;a href=&quot;https://dsp.stackexchange.com/questions/8119/why-is-a-precoder-necessary-for-dqpsk-and-what-does-it-accomplish&quot;&gt;here&lt;/a&gt;, so that 00:=0, 01:=1, 11:=2 and 10:=3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if your input data is $b =[ 10 ~ 11 ~ 00 ~ 10 ~ 10 ]$, the encoded data is (starting from 11:=2):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_1 = 2 + 3 \mod 4 = 1 \equiv 01$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_2 = 1 + 2 \mod 4 = 3 \equiv 10$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so on.&lt;/p&gt;&#xA;" OwnerUserId="17530" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-04-25T16:07:23.977" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30325" PostTypeId="1" AcceptedAnswerId="30327" CreationDate="2016-04-25T10:57:18.550" Score="-2" ViewCount="332" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;$\delta[n+1]$ equals to one only $n+1 = 0$ ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the 1. is true, so what does a signal $x[n+1] $ stand for? Is this signal causal or anticausal? I mean, if 1. is true, $n = -1$, so is this signal causal? (because it just happens before the time I want). But Oppenheim says that it is anticausal. Why?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="20519" LastEditorUserId="15892" LastEditDate="2016-04-25T11:21:21.697" LastActivityDate="2016-04-25T12:08:21.480" Title="A question about the concept of the time" Tags="|discrete-signals|signal-analysis|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30326" PostTypeId="1" AcceptedAnswerId="30340" CreationDate="2016-04-25T10:59:23.507" Score="4" ViewCount="331" Body="&lt;p&gt;For simplicity take the transfer function of a second order IIR in $z$-domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ &#xA;H(z) = \frac {b_0 + b_1 z^{-1} + b_2 z^{-2}} {a_0 + a_1 z^{-1} + a_2 z^{-2}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to generate a new transfer function that yields the square root of the magnitude response of $H(z)$? Assuming the new transfer function is minimum phase. I know this would be possible using various numerical approaches such as global optimization or least squares, but has this specific problem been tackled or are their any approaches which would make the problem attainable without resorting to a heavy weight numerical approach? An approach that worked in the $s$-domain for an equivalent $H(s)$ would be equally useful.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="1629" LastEditDate="2016-04-25T11:23:35.500" LastActivityDate="2016-04-26T13:27:17.307" Title="Analytical way to generate an IIR that is the square root response of another IIR" Tags="|filter-design|infinite-impulse-response|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30327" PostTypeId="2" ParentId="30325" CreationDate="2016-04-25T11:26:23.353" Score="1" Body="&lt;p&gt;A discrete signal can be defined at different integer time indices. Generally, one talks about causal or anticausal systems. But since a signal can, when convolved, be interpreted as a system, some say that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Causal signals are signals that are zero for all negative time, while&#xA;  anticausal are signals that are zero for all positive time.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can read that in the &lt;a href=&quot;https://cnx.org/contents/l-e_wSqM@24/Signal-Classifications-and-Pro&quot; rel=&quot;nofollow&quot;&gt;Classification of signals&lt;/a&gt;. Accordingly to that definition, your signal would be anticausal. Oppenheim sounds correct. One interpretation is: if you convolve a signal $x$ by an anticausal signal, the result will start &quot;sooner&quot; that $x$, a breach in causality.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-04-25T12:08:21.480" LastActivityDate="2016-04-25T12:08:21.480" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30328" PostTypeId="2" ParentId="30325" CreationDate="2016-04-25T11:30:48.863" Score="0" Body="&lt;p&gt;The signal $x(n+1)$ just means that it is a signal based on $x(n)$ but with the samples at other time instances, in particular, all the samples are at the previous time instance.&#xA;For example, the value that $x(n)$ had at $n=0$, now would be at $n=-1$, because to obtain $x(0)$ with the new signal $x(n+1)$ you have to put the time index $n=-1$, so that $x(-1+1) = x(0)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the definition that was given in Laurent Duval's answer, if your signal had a non zero value at $n=0$ then after the shift it would become non causal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="7599" LastActivityDate="2016-04-25T11:30:48.863" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30330" PostTypeId="2" ParentId="30322" CreationDate="2016-04-25T12:17:46.527" Score="0" Body="&lt;p&gt;Indeed, in practical systems there is usually a cut-off SNR above which communication is possible with a given amount of reliability. This is usually determined according to a design goal, expressed in terms of a bit error rate (BER) or a packet error rate (PER). Typically, the BER should not exceed $10^{-4}$ or $10^{-5}$.&#xA;According to your signal parameters (modulation and coding), sometimes it is possible to derive the BER as a function of the SNR. This depends on the complexity of your transmitter-receiver architecture and the channel model you use.&#xA;So:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Yes.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, regarding the RSS, I would say that it is not a standard metric. Some equipments give RSS metrics, according to an unknown criteria. Sometimes, it is just a table where a given range of received power is indexed. Hence:&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;It depends. In general, we don't use the RSS to directly determine design parameters of a demodulator (in this case, a threshold). But if you know exactly what it means, you may derive a relation SNR-RSS. But since RSS measures the total received signal power--including noise--I suppose you will have to estimate the noise power also.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="17530" LastActivityDate="2016-04-25T12:17:46.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30331" PostTypeId="1" CreationDate="2016-04-25T12:19:10.743" Score="0" ViewCount="187" Body="&lt;p&gt;I want to design a filter to remove all frequency components from a &lt;em&gt;.wav&lt;/em&gt; file except those within $\pm 25\,\text{Hz}$ of $523\,\text{Hz}$ as well as its harmonics (up to the Nyquist frequency).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to suppress frequencies below 523-25 Hz using a high-pass filter, and suppress the ones higher than 523+25 Hz using a low pass filter. Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[s, Fs] = wavread('x.wav');&#xA;&#xA;for N=2:1:(Fs/(2*(523+25)))&#xA;    % High-pass filter&#xA;    FsNorm =  (523-25).*N / (Fs/2);&#xA;    [b,a] = butter(10, FsNorm, 'high');&#xA;    sHigh = filtfilt(b, a, s);&#xA;&#xA;    % Low pass&#xA;    FsNorm = (523+25).*N / (Fs/2);&#xA;    [b,a] = butter(10, FsNorm, 'low'); &#xA;    sLow = filtfilt(b, a, s);&#xA;end&#xA;&#xA;wavwrite(sLow, Fs, 'x_filtered');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The code doesn't work, the resulting file is mute. My intention is to apply each filter to the output of the previous filter, but I don't know how to implement this in code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used $(523+25) N_{max} &amp;lt; \frac{F_s}{2}$ to include all the harmonics up to the Nyquist frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what do I need to do to get this filter to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Here's my new code:&#xA;&#xA;[s, Fs] = wavread('x.wav');&#xA;&#xA;sNew = zeros(size(s));&#xA;&#xA;for N=2:1:(Fs/(2*(523+25)))&#xA;    % High-pass filter&#xA;    FsNorm =  (523-25).*N / (Fs/2);&#xA;    [b,a] = butter(10, FsNorm, 'high');&#xA;    sHigh = filter(b, a, s);&#xA;&#xA;    % Low pass&#xA;    FsNorm = (523+25).*N / (Fs/2);&#xA;    [b,a] = butter(10, FsNorm, 'low'); &#xA;    sLow = filter(b, a, s);&#xA;&#xA;    Now sum the results&#xA;    sNew = sHigh + sLow;&#xA;end&#xA;&#xA;sNew&#xA;&#xA;wavplay(sNew,Fs);&#xA;wavwrite(sNew, Fs, 'x_filtered');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I still get &lt;code&gt;sNew=0&lt;/code&gt; and the sound is still mute. What's wrong?&lt;/p&gt;&#xA;" OwnerUserId="20697" LastEditorUserId="20697" LastEditDate="2016-04-26T14:07:57.390" LastActivityDate="2016-04-26T14:07:57.390" Title="Filter Design in Matlab" Tags="|matlab|filters|signal-analysis|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30332" PostTypeId="1" CreationDate="2016-04-25T12:44:52.217" Score="1" ViewCount="66" Body="&lt;p&gt;Before moving to the actual question, I would like to emphasize on the following points (maybe they are obvious to some of you, but I still would like to list them, since they make the difference): &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I don't have any reliable information on the input, thus I have only&#xA;the measurements of the output $y(t)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have only 1 set of recorded data, thus no repetitive measurements are in this case available.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Objective:&lt;/em&gt;&lt;/strong&gt; Identifying a reliable transfer function model for this data in the frequency domain (e.g. rational fraction polynomial with numerator $B$ and denominator $A$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Question:&lt;/em&gt;&lt;/strong&gt; After obtaining a transfer function model, how does one validate this model and thus can be assured that it does not contain any systematic/modelling errors? Please, keep in mind the above 2 points!  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To my limited experience, calculating the uncertainty of the transfer function residuals will be not possible, since the missing information on the input (and thus also not having the variance of the input). A second approach that I thought of is to do a 'simple' whiteness test of the residuals (sum of squares due to errors (SSE) or the R-square both mentioned in the Matlab manual), but is this approach even significant? I mean, sure... One obtains a result, but it's complex valued due to the data ($Y(k)$) which is also complex valued. Consequently, there is always an imaginary part which makes it fail the criterion (i.e. model is ok if SSE is close to 0). Any thoughts/solutions on this? Or am I mixing things up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help, advise/guidance (tips) or references that I can consult in order to solve this issue is very much appreciated! Because I'm really lost and totally confused.&lt;/p&gt;&#xA;" OwnerUserId="20661" LastEditorUserId="8202" LastEditDate="2016-04-27T07:27:59.773" LastActivityDate="2016-04-27T07:27:59.773" Title="How to validate an estimated model in case of output-only data (in frequency domain)?" Tags="|frequency-spectrum|estimation|linear-systems|frequency-response|system-identification|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30333" PostTypeId="2" ParentId="30331" CreationDate="2016-04-25T13:12:54.333" Score="1" Body="&lt;p&gt;You just need to make a simple modification:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Send the original signal through each filter and sum the output of each filter together to get your final result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment you are passing the filtered data on to each subsequent filter. If you think carefully about that, the output will be silent i.e. you filter out everything but 523 Hz  +/- 25 which leaves you just frequencies around 523 Hz, then you take that and filter out everything but 1046 Hz  +/- 25 which will strip out the frequencies around 523 Hz and then you have silence after just two iterations of your loop.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;s = s(:).';&#xA;sNew = zeros(1,length(s)); % The eventual output&#xA;&#xA;for N=2:1:(Fs/(2*(523+25)))&#xA;    % High-pass filter&#xA;    FsNorm =  (523-25).*N / (Fs/2);&#xA;    [b,a] = butter(10, FsNorm, 'high');&#xA;    sHigh = filter(b, a, s);&#xA;&#xA;    % Low pass&#xA;    FsNorm = (523+25).*N / (Fs/2);&#xA;    [b,a] = butter(10, FsNorm, 'low'); &#xA;    sLow = filter(b, a, sHigh); % Note we are filtering sHigh, not 's'&#xA;&#xA;    % Now sum the results&#xA;    sNew = sNew + sLow;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="80" LastEditDate="2016-04-26T12:44:48.717" LastActivityDate="2016-04-26T12:44:48.717" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="30334" PostTypeId="2" ParentId="30331" CreationDate="2016-04-25T13:19:40.777" Score="0" Body="&lt;p&gt;You code currently produces a signal &lt;code&gt;sLow&lt;/code&gt; that is &lt;code&gt;s&lt;/code&gt; through a single low-pass filter (using the last value of &lt;code&gt;N&lt;/code&gt;), because you keep applying all the filtering to the original signal &lt;code&gt;s&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you probably need to substitute &lt;code&gt;s&lt;/code&gt; with &lt;code&gt;sNew&lt;/code&gt; in the loop. Before the loop starts do &lt;code&gt;s = sNew&lt;/code&gt;. At the end of each loop do &lt;code&gt;sNew = sLow + sHigh&lt;/code&gt;. Then &lt;code&gt;sNew&lt;/code&gt; is your final result.&lt;/p&gt;&#xA;" OwnerUserId="20703" LastEditorUserId="11256" LastEditDate="2016-04-25T13:49:02.213" LastActivityDate="2016-04-25T13:49:02.213" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30335" PostTypeId="1" AcceptedAnswerId="30339" CreationDate="2016-04-25T13:59:56.830" Score="1" ViewCount="1231" Body="&lt;p&gt;Based on what we choose sampling frequency when sampling some song? Do we use Nyquist–Shannon sampling theorem, or maximum sampling frequencies are pre-defined, so it will never come to aliasing effect?&lt;/p&gt;&#xA;" OwnerDisplayName="user20705" LastActivityDate="2016-04-25T14:34:59.067" Title="Sampling frequency of audio" Tags="|audio|sampling|frequency|music|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30336" PostTypeId="2" ParentId="30319" CreationDate="2016-04-25T14:25:49.053" Score="1" Body="&lt;p&gt;The only quick reference &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.30.2399&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;I can find is this one&lt;/a&gt;, which states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X4C0J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X4C0J.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-25T14:25:49.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30337" PostTypeId="2" ParentId="30335" CreationDate="2016-04-25T14:28:52.343" Score="0" Body="&lt;p&gt;Of course you have to obey Shannon-Nyquist when sampling &lt;em&gt;anything&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, of course, sound cards were designed by engineers, so they have analogue filters that avoid aliasing at the sampling rates the cards offer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you're using a sound card, any sampling rate it supports should be largely alias-free. Use the sampling rate sufficient for your signal of interest and comfortable for your application and available from the sound card hardware. In effect, that means you can chose between 44.1, 48 and 96 kHz on most sound cards.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-04-25T14:28:52.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30339" PostTypeId="2" ParentId="30335" CreationDate="2016-04-25T14:34:59.067" Score="0" Body="&lt;p&gt;Audio is generally regarded to cover the frequency range from 20 Hz to 20,000 Hz, because the human ear is not capable of detecting signals outside of that range. When converting audio to a discrete signal, then, you must follow these steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Bandpass filter the audio to eliminate any signals above 20 kHz. These may be produced by the audio source itself and by non-linearities in the electronics. Filtering prevents those higher frequencies to appear as alias in the 20 Hz -- 20 kHz range.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sample the audio at a frequency of at least 40 kHz (based on the Nyquist sampling theorem). In practice, the sampling frequency will be larger than 40 kHz, to make the reconstruction filter easier to implement. The reconstruction filter converts the sampled audio back to analog audio. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use an appropriate quantization -- for high quality audio, 16 bits per sample is considered acceptable.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that for specific audio signals and for different applications the specific numbers will change. For example: Digital telephony limits the audio (voice) signal to around 3.3 kHz and quantizes using 8 bits per sample. High-end studio equipment usually samples at higher frequencies (like 96,000 Hz) and uses up to 24 bits per sample. Compressed audio uses a variable number of bits per sample.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-04-25T14:34:59.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30340" PostTypeId="2" ParentId="30326" CreationDate="2016-04-25T14:47:01.437" Score="5" Body="&lt;p&gt;The only time you'll be able to do this exactly is when you know that the poles and zeros of $H(z)$ are in complex conjugate pairs inside and outside of the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for systems with real-valued impulse responses, this means you need four of each: two inside and two outside the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The keyword to search on is &lt;a href=&quot;http://wolfweb.unr.edu/~fadali/EE782/SpectralFactor.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;spectral factorization&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that if you can write $H(z)$ as:&#xA;$$&#xA;H(z) = G(z) G(z^{-1})&#xA;$$&#xA;where $G(z)$ is a minimum phase system, then $G$ just takes all the poles and zeros of $H$ that are inside the unit circle (and half those that are on the unit circle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.optimization-online.org/DB_FILE/2011/10/3197.pdf&quot; rel=&quot;noreferrer&quot;&gt;There exist approximate algorithms for finding a solution&lt;/a&gt;, but I am not well-versed in those.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-25T14:47:01.437" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30341" PostTypeId="1" CreationDate="2016-04-25T14:55:50.240" Score="1" ViewCount="742" Body="&lt;p&gt;I am working with Matlab to design a compensator capable to make a system attain the design requirements ($\omega_n\geq 0.3$ rad/s &amp;amp; $\xi\geq 0.5$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to do so I have a discrete-time transfer function with a sampling time of 1 second, which is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(z)=\dfrac{0.5z+0.5}{z^2-2z+1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The functions has already a zero = -1 and a double pole = 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also using Matlab SISOtool to see where is the feasible region in which I should have the root-locus to fulfill the design requirements. Such region is the following (the white one):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0XTc2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0XTc2.png&quot; alt=&quot;Feasible regions&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image shows the root-locus of the plant, G(z). Now I want to add a controller, C(z), that allows me to move the root locus into the white region (at least a part of it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controller should be in the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C(z)=\dfrac{(z-z_1)(z-z_2)...(z-z_n)}{(z-p_1)(z-p_2)...(z-p_m)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And therefore, $C(z)G(z)$ should be evaluated to see that part of the root locus is located into the white area.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the value of the poles and zeros of the controller $C(z)$ that allow me to have part of the root locus into the white region provided in the image, and then being able to fulfill the design requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is driving me crazy because I have tried all the possible ways of adding poles and zeros and I am unable to obtain a region of the root-locus inside of the white area. I only need some idea on where to place the zeros/poles or if it is even feasible to attain this design requirements (it should be).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Matlab code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=[0.5 0.5];&#xA;d=[1 -2 1];&#xA;G=tf(n,d,1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After that, to run SISOtool just type &lt;code&gt;sisotool('rlocus',G)&lt;/code&gt; in Matlab console.&lt;/p&gt;&#xA;" OwnerUserId="15846" LastEditorUserId="15846" LastEditDate="2016-04-26T16:10:41.980" LastActivityDate="2016-04-26T16:10:41.980" Title="Designing a root-locus compensator to attain design requirements" Tags="|matlab|control-systems|poles-zeros|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30342" PostTypeId="2" ParentId="30341" CreationDate="2016-04-25T16:19:48.380" Score="1" Body="&lt;p&gt;I don't have access to &lt;code&gt;matlab&lt;/code&gt;, but I have played with this in R (see code below) and can confirm that if you're trying to transform your $G(s)$ into:&#xA;$$&#xA;H(s) = \frac{K G(s)} {1 + KG(s)}&#xA;$$&#xA;using only a scalar $K$, then you cannot get to the target pole locations (based on the values of $\xi$ and $\omega_n$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the diagram:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The black circles are the starting root (pole) positions.&lt;/li&gt;&#xA;&lt;li&gt;The green circles are the target pole positions.&lt;/li&gt;&#xA;&lt;li&gt;The red circles are the root locus for varying values of $K$.&lt;/li&gt;&#xA;&lt;li&gt;The large black circle is the unit circle.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qY3wM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qY3wM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30341&#xA;&#xA;library(&quot;signal&quot;)&#xA;&#xA;xi &amp;lt;- 0.5&#xA;omega_n &amp;lt;- 0.3&#xA;&#xA;target_den &amp;lt;- c(1, 2*xi*omega_n, omega_n*omega_n)&#xA;&#xA;target_roots &amp;lt;- roots(target_den)&#xA;&#xA;num &amp;lt;- c(0, 0.5, 0.5)&#xA;den &amp;lt;- c(1, -2, 1)&#xA;&#xA;start_roots &amp;lt;- roots(den)&#xA;&#xA;par(pty=&quot;s&quot;)&#xA;plot(Re(start_roots),Im(start_roots),xlim=c(-5,5),ylim=c(-5,5), col=&quot;black&quot;, lwd=5)&#xA;points(Re(target_roots), Im(target_roots), col=&quot;green&quot;, lwd = 3)&#xA;for (k in seq(-100.0, 100.0, 0.1))&#xA;{&#xA;  rts &amp;lt;- roots(k*num + den)&#xA;  points(Re(rts), Im(rts), col=&quot;red&quot;)&#xA;}&#xA;&#xA;theta &amp;lt;- seq(-1,1,.01)*pi&#xA;lines(sin(theta), cos(theta), col=&quot;black&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-25T16:19:48.380" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30343" PostTypeId="2" ParentId="30326" CreationDate="2016-04-25T16:30:31.740" Score="5" Body="&lt;p&gt;Let me just point out in addition to Peter K.'s more definitive answer, that there's an intuitive way to see that you can't do this in the general case. That is, there is no finite order transfer function that gives the square root of a given arbitrary transfer function. Let me indeed first consider the corresponding case on the $s$ -plane. Take $b_0 = b_1 = b_2 = a_0 = a_2 = 0$, so you get&#xA;$$&#xA;H(s) = \frac{1}{s},&#xA;$$&#xA;i.e. an integrator. The desired square-root magnitude of this is $1/\sqrt{|s|} = |s|^{-\frac{1}{2}}$. However, the asymptotic response of any finite order filter is $|s|^n$, where $n$ is an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there is a counter-example, and actually a similar thing holds for any odd-order filter. In the case of even order filters, Peter's answer gives the method for checking if the square root can be taken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since there is a one-to-one map between rational functions on the $s$-plane and the $z$ -plane (one such map is the BLT), the same holds on the $z$ -plane too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an approximate solution, one can try Taylor expanding. Let&#xA;$$&#xA;H(z) = \frac{\sum_k b_k z^k}{\sum_l a_l z^l}&#xA;$$&#xA;(note the change in notation). Now, the desired response is $\sqrt{|H(z)|}$. Let us try, for the sake of simplicity, approximate $\sqrt{H(z)}$ directly&#xA;$$&#xA;\sqrt{H(s)} = \frac{\sqrt{\sum_k b_k z^k}}{\sqrt{\sum_l a_l z^l}} = \frac{\sqrt{p_1(z)}}{\sqrt{p_2(z)}},&#xA;$$&#xA;where $p_1(z)$ and $p_2(z)$ are the nominator and denominator polynomials respectively. Now expand this around some $z_0$ by writing $p_i(z) = p_i(z_0) + (p_i(z) - p_i(z_0)) = p_i(z_0)(1 + \hat{p}_i(z))$, where&#xA;$$&#xA;\hat{p}_i(z) = \frac{p_i(z) - p_i(z_0)}{p_i(z_0)}&#xA;$$  and $i = 1, 2$, so that $\sqrt{p_i(z)} = \sqrt{p_i(z_0)} \sqrt{1 + \hat{p}_i(z)}$. Using the Taylor series of the square root we get&#xA;$$&#xA;\sqrt{p_i(z)} = \sqrt{p_i(z_0)}\sum_{n = 0}^\infty \frac{(-1)^n (2n)!}{(1 - 2n)(n!)^2 4^n} \hat{p}_i(z)^n.&#xA;$$&#xA;We truncate to finite order, and we have an approximation in some region of the $z$-plane. However, there is a problem: the radius of convergence of the series expansion is $|\hat{p}_i(z)| &amp;lt; 1$. When $\hat{p}_i(s) = -1$, $p_i(z) = 0$, so the radius of convergence is limited by zeroes of $p_i(z)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the poles and zeroes of the response $H(z)$ obstruct the convergence of the series. It is easy to convince yourself that as a matter of fact, if there is at least one pole or zero inside the unit circle, the series won't converge everywhere on the unit circle with any choice of $z_0$. This is further made worse by the fact that you will probably want to choose $z_0$ real, to conserve the symmetry between $z$ and $z^\ast$, i.e. keep the system real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you would have been happy with just replicating the square-root magnitude response of the system, and we tried to do a bit more. However, I believe you'll hit essentially the same problem, as the roots of the polynomial are not changed by transforming the phase. I can't prove that explicitly right now, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one exception is if you don't have any poles, you can reflect all of your zeroes outside the unit circle to make a maximum phase version of your response, and then find a convergent Taylor series in this exact case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the message is that a Taylor expansion will almost surely not give you anything useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any of the standard fitting algorithms would work around this by not replicating the response well near the poles and zeroes of the original transfer function, which should be fine  at least for those poles and zeroes not on the unit circle.&lt;/p&gt;&#xA;" OwnerUserId="20701" LastEditorUserId="20701" LastEditDate="2016-04-26T13:27:17.307" LastActivityDate="2016-04-26T13:27:17.307" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30344" PostTypeId="1" AcceptedAnswerId="30347" CreationDate="2016-04-25T16:34:26.537" Score="0" ViewCount="2355" Body="&lt;p&gt;Given that $$x(n) = A\cos(2\pi nk/N),$$ the $N$-point DFT of $x(n)$ can be expressed as follows—the derivation can be found in &lt;a href=&quot;https://www.dsprelated.com/showarticle/607.php&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;: $$X(m) = \color{red}{\frac{A}{2}\sum_{n=1}^{N-1}e^{-j2\pi n(m-k)/N}}+\frac{A}{2}\sum_{n=1}^{N-1}e^{-j2\pi n(m+k)/N}.$$ It is said that &lt;strong&gt;the left summation above represents a positive-frequency spectral component&lt;/strong&gt;. Does it mean to say that, when $m$ is negative, the summation goes down to zero?&lt;/p&gt;&#xA;" OwnerUserId="20709" LastActivityDate="2016-04-25T18:09:05.163" Title="Deriving the DFT magnitude of $A\cos(2\pi nk/N)$" Tags="|fourier-transform|dft|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30345" PostTypeId="1" CreationDate="2016-04-25T16:35:30.470" Score="1" ViewCount="37" Body="&lt;p&gt;I'd like to start off by saying that I am not very experienced at signal processing, so I apologise in advance if I do not explain everything properly the first time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to analyse the following &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Signal A:&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/95DPN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/95DPN.png&quot; alt=&quot;Signal A&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal A is a simplified simulation of an air compressor, with the compressor operating between 140 and 160 PSI &lt;strong&gt;(YELLOW SIGNAL)&lt;/strong&gt;. The blue and orange lines indicate that a component that draws air from the compressor is active, which you can notice causes dips in the PSI level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following signal represents the amount of PSI drawn by the components, causing the noticed drops in PSI:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Signal B:&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/IOTrt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IOTrt.png&quot; alt=&quot;Components which lower the PSI level&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signal B is generated by adding two &lt;strong&gt;separate&lt;/strong&gt; pulse generators, and fed through an integrator. I would like to analyse Signal A to obtain each individual signal that makes up signal B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two pulses that make up signal B are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Off for 14 seconds, on for 1 second, amplitude = 1 PSI&lt;/li&gt;&#xA;&lt;li&gt;Off for 900 seconds, on for 40 seconds, amplitude = 0.5 PSI&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would like some recommendations for what processes to use to achieve this. I have tried wavelets and FFT to no avail so far. I hope to use my findings here to allow me to train a machine learning model to expect drops in air pressure  by X PSI every Y seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; This signal normally has a slight bit of noise, however I removed it for this post. The components turning on are also not exactly periodic in my actual data (reiterating that this is a simulation), however the times are only ever out by 1% at most.&lt;/p&gt;&#xA;" OwnerUserId="20708" LastEditorUserId="20708" LastEditDate="2016-04-25T16:42:59.507" LastActivityDate="2016-04-25T16:42:59.507" Title="Unique signal extraction from a cumulated signal" Tags="|filters|discrete-signals|time-series|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30346" PostTypeId="1" CreationDate="2016-04-25T17:20:47.337" Score="1" ViewCount="170" Body="&lt;p&gt;So I need to program (using Java) some things that include generated sounds.&#xA;I am struggling to understand how to make it work because I require a rather short signal while still using a sampling rate supported by the average sound card.&#xA;For example a 100 uSec beep with a 200 uSec delay followed by another beep (initially supposed to be a click but a sine wave also works, would be grateful if you could explain why a sine wave makes it simpler).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that I need a high sampling rate (number of samples per second), a frequency within hearing range (for example 1000) and a buffer to hold that data that will be fed to the audio stream provided by the Java libraries.&#xA;The issue is that with my limit of sampling rate (hardware limitations) I end up with an almost completely empty buffer because of the tiny intervals of sound it must hold to meet the time requirements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something? Is there another way?&#xA;Why does using a sine wave instead of a click make things easier?&#xA;Any help would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="20710" LastActivityDate="2017-07-20T09:59:48.080" Title="Generating very short signals" Tags="|signal-analysis|sampling|sound|java|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30347" PostTypeId="2" ParentId="30344" CreationDate="2016-04-25T17:31:46.827" Score="0" Body="&lt;p&gt;So here's a plot of the summation.  It is true that $X(m)$ is zero for &lt;em&gt;some&lt;/em&gt; values of $m$ negative. However, due to the $N$-periodic nature of the summation, any $m$ for which $k\ \mbox{mod}\ N = m$ will be non-zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lFqfu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lFqfu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I still don't &lt;em&gt;understand&lt;/em&gt; how the negative portion of bins goes down to zero as a result of &lt;code&gt;m−k&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, rewrite the summation as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\sum_{n=1}^{N-1}e^{-j2\pi nm/N} \cdot e^{j2\pi nk/N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that all you are doing is modulating a complex exponential of frequency $m$ with one of frequency $k$ and summing the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just taking the inner product of two complex exponentials.  The inner product just projects one exponential onto another. In this special case (for discrete time) where the frequencies &lt;a href=&quot;http://cnx.org/contents/jjyLeX3M@1.1:rgcFbDhp@1/Inner-Products-and-Orthogonali&quot; rel=&quot;nofollow noreferrer&quot;&gt;are harmonically related&lt;/a&gt;, the only time when this is non-zero is when $m = k \ \mbox{mod}\ N$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&#xA;    #30344&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N &amp;lt;- 100&#xA;k &amp;lt;- 5&#xA;m_vals &amp;lt;- seq(-N,N)&#xA;&#xA;Xm &amp;lt;- rep(0,2*N+1)&#xA;&#xA;for (m in m_vals)&#xA;{&#xA;  Xm[m+N+1] &amp;lt;- sum(exp(-1i*2*pi*seq(0,N)*(m-k)/N))&#xA;}&#xA;&#xA;&#xA;plot(m_vals, Re(Xm), type=&quot;l&quot;, col=&quot;blue&quot;, xlab=&quot;m&quot;, ylab=&quot;X(m)&quot;)&#xA;&#xA;title(&quot;Plot of X(m) vs m for m -100 to 100&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-25T18:09:05.163" LastActivityDate="2016-04-25T18:09:05.163" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30348" PostTypeId="1" CreationDate="2016-04-25T17:36:50.027" Score="2" ViewCount="146" Body="&lt;p&gt;I have a function as&#xA;$$E=\int_\Omega -\log\big( p_i(x)\big) dx$$&#xA;where $p_i(x)$ is density distribution which estimated by Parzen window method. &#xA;$$p_i(x)=\frac{1}{\Omega_i} \int_{\Omega_i}K_\sigma\big(I(x)-I(y)\big) dy$$&#xA;where $\Omega_i$ is the image domain, with &#xA;$$K_\sigma=\frac{1}{\sqrt{2\pi}\sigma}\exp\left(\frac{-z^2}{2\sigma^2}\right)$$ &#xA;and $\sigma$ is scalar parameter. $I$ is an image $I(x):\Omega \to \mathbb{R}$, $i$ is given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, which ones is correct for left side: $E(\sigma),E(x),E(x,\sigma),E(p_i)$ or other form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: I upload the original equation for better visualization&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EC7eF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EC7eF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8264" LastEditorUserId="8264" LastEditDate="2016-04-27T12:47:00.163" LastActivityDate="2016-04-27T12:58:31.957" Title="Which is correct representation for function of variable?" Tags="|computer-vision|image-processing|estimation|gaussian|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30349" PostTypeId="1" AcceptedAnswerId="30352" CreationDate="2016-04-25T18:19:15.110" Score="1" ViewCount="2628" Body="&lt;p&gt;When I am filtering a signal in python, it has a built in &lt;a href=&quot;http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.bessel.html&quot; rel=&quot;nofollow&quot;&gt;function&lt;/a&gt; to generate bessel filter coefficients given a cutoff ratio and a filter order (number of poles). I am trying to translate this to C code, but I cannot seem to find the formula that is used to calculate the coefficients. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone point me to the formulas to calculate the IIR filter coefficients given a cutoff ratio and order?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to read the scipy source on github but I am having a very hard time of it...&lt;/p&gt;&#xA;" OwnerUserId="20090" LastEditorUserId="20090" LastEditDate="2016-04-25T18:25:16.330" LastActivityDate="2017-05-06T00:42:15.837" Title="Formula for Bessel low-pass filter coefficients" Tags="|lowpass-filter|python|infinite-impulse-response|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30351" PostTypeId="2" ParentId="30346" CreationDate="2016-04-25T19:06:30.270" Score="1" Body="&lt;p&gt;If you want to generate a very short pulse, it is not usually a problem to have it at any time you wish to have it. That is because modern audio interfaces (sound cards) have an interpolating lowpass filter in the output path, usually with an impulse response that without latency looks like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Sinc_function&quot; rel=&quot;nofollow&quot;&gt;sinc function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/f/f7/Sine_cardinal.PNG&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/f/f7/Sine_cardinal.PNG&quot; alt=&quot;sinc function&quot;&gt;&lt;/a&gt;&lt;br&gt;&lt;em&gt;Figure 1. Sinc function, shown truncated at the ends and critically sampled with the sample number shown in the horizontal axis.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you play back audio data that is sampled from a time-shifted sinc function with the peak somewhere between sample points, the interpolating lowpass filter will reconstruct the function from the samples so that the peak is in the correct position. Some audio interfaces use a low-latency variant of the lowpass filter that does not have a symmetrical sinc impulse response. Disregarding latency, it has just as good inter-sample timing capabilities if you give it samples of a time-shifted sinc function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you need a more rectangular pulse, you could add an analog &lt;a href=&quot;https://en.wikipedia.org/wiki/Comparator&quot; rel=&quot;nofollow&quot;&gt;comparator&lt;/a&gt; to the output of the audio interface. You can change the pulse length by varying the voltage level you compare to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First test if you get that sinc shape from your hardware, like MBaz suggested.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-04-25T19:13:22.523" LastActivityDate="2016-04-25T19:13:22.523" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30352" PostTypeId="2" ParentId="30349" CreationDate="2016-04-25T19:17:45.107" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/scipy/scipy/blob/v0.14.0/scipy/signal/filter_design.py#L2351&quot; rel=&quot;nofollow&quot;&gt;Looking at the source code for &lt;code&gt;scipy.signal.bessel&lt;/code&gt;&lt;/a&gt;, you're out of luck for finding a formula: they don't use one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They just have a big &lt;code&gt;if&lt;/code&gt; \ &lt;code&gt;elif&lt;/code&gt; sequence for various values of filter order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if N == 0:&#xA;    p = []&#xA;elif N == 1:&#xA;    p = [-1]&#xA;elif N == 2:&#xA;    p = [-.8660254037844386467637229 + .4999999999999999999999996j,&#xA;         -.8660254037844386467637229 - .4999999999999999999999996j]&#xA;elif N == 3:&#xA;    p = [-.9416000265332067855971980,&#xA;         -.7456403858480766441810907 - .7113666249728352680992154j,&#xA;         -.7456403858480766441810907 + .7113666249728352680992154j]&#xA;elif N == 4:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Bessel_filter#Bessel_polynomials&quot; rel=&quot;nofollow&quot;&gt;The Wikipedia page&lt;/a&gt; has some formulae for Bessel filters in the continuous domain:&#xA;$$&#xA;\theta(s) = \sum_{k=0}^n a_k s^k&#xA;$$&#xA;where&#xA;$$&#xA;a_k = \frac{(2n-k)!}{2^{n-l}k!(n-k)!} \mbox{ for } n = 0,1,\ldots,n.&#xA;$$&#xA;To get discrete-time near-equivalents, you'll need to do a continuous-to-discrete transformation. Note that this will not necessarily preserve the nice phase properties of the continuous-time Bessel filter.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-25T19:17:45.107" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30353" PostTypeId="1" AcceptedAnswerId="30355" CreationDate="2016-04-25T19:40:52.047" Score="2" ViewCount="277" Body="&lt;p&gt;I've been trying to do this problem for the last few hours. Could someone show me the workings on how it is done? Not just the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kq3cY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kq3cY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figure shows the structure of a FIR filter where $A = 1.5$, $B = 0.69$ and $C = 3.0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $x[n] = u[n]$, what is the value of $y[n]$ for $n = 20$?&lt;/p&gt;&#xA;" OwnerUserId="20711" LastEditorUserId="8202" LastEditDate="2016-04-25T20:27:36.187" LastActivityDate="2016-04-26T08:31:24.653" Title="Question on FIR filter" Tags="|filters|finite-impulse-response|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30355" PostTypeId="2" ParentId="30353" CreationDate="2016-04-25T20:20:41.373" Score="2" Body="&lt;p&gt;[EDITED] From left to right, try to find the impulse response. On the bottom branch, delay the unit pulse $d$ and get $d[n-1]$. Add $Ad[n]$. Delay twice and get $d[n-3] +Ad[n-2]$. Add $Bd[n]$. Add $Cd[n-1]$. So the FIR coefficients of the impulse response $h$ will be $[1,A,C,B]$, but in the reverse order (as correctly pointed out by colleagues), because $y[n] = \sum d[k]h[n-k]$. So your system is causal, and $h[0]=B$, $h[1]=C$, $h[2]=A$, $h[3]=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, at $n=20$, you are in a stabilized region of the signal (all the known samples are equal to $1$, so even if you make a mistake as I did first, the answer will be the same, $1+A+C+B$, as stated before by other colleagues.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="4298" LastEditDate="2016-04-26T08:31:24.653" LastActivityDate="2016-04-26T08:31:24.653" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="30357" PostTypeId="2" ParentId="30353" CreationDate="2016-04-26T00:19:17.093" Score="1" Body="&lt;p&gt;Ok may be this simplified explanation fits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- if the input of a delay is x[n] then its output is x[n-1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- when there are k delays in series then it will be x[n-k].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3- based on 1 and 2, and following the signal paths: sum up all the signals:&#xA; $$y[n] = B x[n] + C x[n-1] + A x[n-2] + x[n-3]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if x[n] = u[n], then by its very popular property of being = 1 for n&gt;=0, all input values will be 1 for n&gt;=3. Hence y[n] = A+B+C+1 = 6.19 for all n&gt;=2.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastActivityDate="2016-04-26T00:19:17.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30358" PostTypeId="2" ParentId="30353" CreationDate="2016-04-26T00:37:21.913" Score="2" Body="&lt;p&gt;If you start from the left, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZIhwt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZIhwt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to calculate $y[20]$ when $x[n]=u[n]$, then you have to just replace these expressions in the general form of $y[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y[n] = B x[n] + C x[n-1] + A x[n-2] + x[n-3]$$&#xA;$$y[20] = B u[20] + C u[19] + A u[18] + u[17]$$&#xA;$$y[20] = B+C+A+1=6.19$$&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-04-26T00:37:21.913" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30359" PostTypeId="1" AcceptedAnswerId="30361" CreationDate="2016-04-26T04:58:23.070" Score="0" ViewCount="66" Body="&lt;p&gt;If a linear system is causal and its impulse response is an energy signal. What's the behaviour of the poles of $s$-domain transfer function $H(s)$?&lt;/p&gt;&#xA;" OwnerUserId="20716" LastEditorUserId="8202" LastEditDate="2016-04-26T08:03:22.230" LastActivityDate="2016-04-26T08:03:22.230" Title="Behaviour of the poles in transfer function $H(s)$, given system properties" Tags="|discrete-signals|continuous-signals|transfer-function|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30360" PostTypeId="1" AcceptedAnswerId="30363" CreationDate="2016-04-26T05:05:58.167" Score="1" ViewCount="132" Body="&lt;p&gt;$x(t)$ can be exactly reconstructed from its samples at $\omega_s = 10 \textrm{ rad/sec}$. My conclusion is that the maximum frequency component in $x(t)$ is $5\textrm{ rad/sec}$. But I'm being told that in fact $x(t)$ has maximum frequency component $7 \textrm{ rad/sec}$. How can this be possible?&lt;/p&gt;&#xA;" OwnerUserId="20716" LastEditorUserId="1629" LastEditDate="2016-04-26T07:20:23.660" LastActivityDate="2016-04-26T09:14:49.860" Title="How can a signal have two maximum frequency components?" Tags="|filters|filter-design|frequency|filtering|reconstruction|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30361" PostTypeId="2" ParentId="30359" CreationDate="2016-04-26T06:20:25.073" Score="0" Body="&lt;p&gt;A ROC can be chosen to make the transfer function causal and/or stable depending on the pole/zero plot. If the ROC extends outward from the outermost pole, then the system is causal.&lt;/p&gt;&#xA;" OwnerUserId="19904" LastActivityDate="2016-04-26T06:20:25.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30362" PostTypeId="1" AcceptedAnswerId="30373" CreationDate="2016-04-26T06:40:11.157" Score="1" ViewCount="119" Body="&lt;p&gt;I understand the mathematics behind the use of image averaging for gaussian noise. Why can't it be used for impulse noise ? Would it be because there is no way to prove that impulse noise is additive ? And that it has no mean ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, am I right to say that impulse noise does not affect every pixel in an image, as opposed to gaussian noise ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks !&lt;/p&gt;&#xA;" OwnerUserId="20445" LastActivityDate="2016-04-26T13:51:31.137" Title="Image averaging for impulse noise" Tags="|noise|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30363" PostTypeId="2" ParentId="30360" CreationDate="2016-04-26T08:24:19.370" Score="2" Body="&lt;p&gt;$x(t)$ must be a band pass signal. Under certain conditions on the sampling frequency and its relation to the lower and upper band edges of the signal, $x(t)$ can be sampled at a frequency that is lower than twice its maximum frequency, without introducing aliasing. Have a look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Undersampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; and at &lt;a href=&quot;https://dsp.stackexchange.com/questions/25400/is-there-a-condition-for-bandpass-sampling/25403#25403&quot;&gt;this answer&lt;/a&gt; to a related question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the numbers given in your question, if the lower band edge $\omega_l$ of $x(t)$ satisfies $5&amp;lt;\omega_l&amp;lt;7$ then sampling with $\omega_s=10$ will allow reconstruction of the signal without aliasing.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-04-26T09:14:49.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30364" PostTypeId="1" AcceptedAnswerId="30372" CreationDate="2016-04-26T08:35:26.690" Score="0" ViewCount="2846" Body="&lt;p&gt;I want to make a plot of the power spectrum for a &lt;em&gt;.wav&lt;/em&gt; sound file, over the frequency range from -2000 to 2000 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the following code, but the resulting plot is one sided. It doesn't plot the negative frequencies. But the graph I need to produce has to contain negative frequencies. What do I need to do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[s, Fs] = wavread('chord.wav');&#xA;nfft = 2^nextpow2(length(s));&#xA;Pxx = abs(fft(s,nfft)).^2/length(s)/Fs;&#xA;Hpsd = dspdata.psd(Pxx(1:length(Pxx)/2),'Fs',Fs);  &#xA;plot(Hpsd)&#xA;axis([-2 2 -150 -35])  %change axis range&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Produces:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s75dh.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s75dh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20697" LastActivityDate="2016-04-26T13:55:13.577" Title="Plotting Power Spectrum (Matlab)" Tags="|matlab|signal-analysis|power-spectral-density|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30365" PostTypeId="1" AcceptedAnswerId="30386" CreationDate="2016-04-26T08:46:38.430" Score="5" ViewCount="627" Body="&lt;p&gt;I am reading about edge detection and I read that 2nd order detectors are more susceptible to noise. Is there a mathematical proof to this ? &lt;/p&gt;&#xA;" OwnerUserId="20445" LastEditorUserId="128" LastEditDate="2019-11-18T07:13:36.783" LastActivityDate="2019-11-18T07:13:36.783" Title="Are 2nd Order Edge Detectors More Susceptible to Noise?" Tags="|image-processing|edge-detection|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30366" PostTypeId="2" ParentId="30365" CreationDate="2016-04-26T09:30:49.593" Score="3" Body="&lt;p&gt;If you assume the Edge Detection is SNR driven operation, one could find a Mathematical justification for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the variance of Additive White Noise with Variance $ {\sigma}_{n}^{2} $ at the output of a Linear System given by $ g $ is $ {\sigma}_{n}^{2} {\left\| g \right\|}_{2}^{2} $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look on an Image filtered by a derivative approximating filter $ g = \left[ -1, 1 \right] $.&lt;br&gt;&#xA;This increase the Noise Variance by a factor of 2.&lt;br&gt;&#xA;For 2nd order the filter is $ {g}_{2} = g \ast g = \left[ 1, -2, 1 \right] $ hence the factor is 6 (It comes from the reason the second time we filter the noise is correlated).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the question does the signal (Edge) is amplified by the same factor?&lt;br&gt;&#xA;Moreover, on areas where there is no edge, the probability to detect noise as edge increases.&lt;br&gt;&#xA;To see intuitively, just operate 1st order method on the gradient of the image and see how much False edges you have now.&lt;/p&gt;&#xA;" OwnerUserId="128" LastEditorUserId="128" LastEditDate="2016-04-28T08:18:25.533" LastActivityDate="2016-04-28T08:18:25.533" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30370" PostTypeId="2" ParentId="30348" CreationDate="2016-04-26T12:55:32.403" Score="2" Body="&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Based on your new explanations, I think the answer is just&#xA;$$&#xA;E_{u_i}&#xA;$$&#xA;given that what you're really trying to find a shorthand for is the expression inside the summation sign in (5) of the screenshot. That is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\min_{U} \left\{ \lambda \sum_{i=1}^N \int_\Omega r_i(\chi, p_i(\chi)) u_i(\chi) d\chi \right\} = \min_{U} \left\{ \lambda \sum_{i=1}^N E_{u_i} \right\}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that&#xA;$$&#xA;E_{u_i} = \int_\Omega r_i(\chi, p_i(\chi)) u_i(\chi) d\chi&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original answer below for reference&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per @Fat32's comment, any of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$E(\sigma, z, p_i)$&lt;/li&gt;&#xA;&lt;li&gt;$E_{\sigma,p_i}(z)$&lt;/li&gt;&#xA;&lt;li&gt;$E(z; \sigma,p_i)$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;is acceptable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you need to tighten up your notation. What is $x$ vs $z$? How does $\Omega$ relate to them? What is $y$?&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-27T12:58:31.957" LastActivityDate="2016-04-27T12:58:31.957" CommentCount="10" CommunityOwnedDate="2016-04-26T12:55:32.403" ContentLicense="CC BY-SA 3.0" />
  <row Id="30371" PostTypeId="1" AcceptedAnswerId="30379" CreationDate="2016-04-26T13:37:17.447" Score="1" ViewCount="233" Body="&lt;p&gt;I would like to know how much of the sound of my voice getting through various types of walls can be reconstructed with easily obtainable software and algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My plan is to place a microphone on the other side of the walls I'm interested in and record the sound getting through. I would then apply reconstruction and try to understand my own speech. Since I am the one talking and I know what I was saying, this would be best case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there ready algorithms, as standalone software, libraries or easy to implement in common software packages like Python, Matlab, Octave, ... (I'm talking about script-kiddie level of knowledge) that I can try to reconstruct &lt;strong&gt;offline&lt;/strong&gt; the speech from the distorted recording?&lt;/p&gt;&#xA;" OwnerUserId="16095" LastEditorUserId="16095" LastEditDate="2016-05-27T08:32:38.170" LastActivityDate="2016-05-27T08:32:38.170" Title="Reconstruction of voice from distorted recordings" Tags="|voice|reconstruction|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30372" PostTypeId="2" ParentId="30364" CreationDate="2016-04-26T13:47:39.790" Score="1" Body="&lt;p&gt;First of all, &lt;code&gt;wavread&lt;/code&gt; has been removed in the 2015 &amp;amp; 2016 versions of MATLAB. So, if you plan on using your code in a newer version of MATLAB, I recommend that you use the &lt;code&gt;audioread&lt;/code&gt; function instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to answer your question. MATLAB already have a built-in function for plotting the power spectral density (Pxx) of a given input signal - &lt;code&gt;periodogram&lt;/code&gt;. I've taken the liberty to copy a piece of sample code from MATLAB's documentation that should help you plot the Pxx you want (it will contain negative frequencies as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;periodogram(x,[],NFFT,Fs,'centered')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All you need to keep from your code snippet are the input values seen here. The rest, like the &lt;code&gt;axis&lt;/code&gt; function, aren't necessary to get the plot you want if you use this &lt;code&gt;periodogram&lt;/code&gt; function.&#xA;The above function will plot the power spectral density of a given input signal &lt;code&gt;x&lt;/code&gt; with no specified window (&lt;code&gt;[]&lt;/code&gt; which just means the function defaults to a simple rectangular window). The final argument is the one that I presume you are most interested in: &lt;code&gt;freqrange&lt;/code&gt;. It can have several different inputs, including &lt;code&gt;twosided&lt;/code&gt; and &lt;code&gt;centered&lt;/code&gt;. You should try both options and see which output you find more useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps you!&lt;/p&gt;&#xA;" OwnerUserId="16941" LastEditorUserId="16941" LastEditDate="2016-04-26T13:55:13.577" LastActivityDate="2016-04-26T13:55:13.577" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30373" PostTypeId="2" ParentId="30362" CreationDate="2016-04-26T13:51:31.137" Score="2" Body="&lt;p&gt;I'm not in the image processing filed, but I would say:&lt;br&gt;&#xA;Yes, Gaussian noise means that each of your pixel is assumed to be produced by a stochastic process. Hence you can for instance think of it as a &quot;real&quot; intensity corrupted by an additive normally distributed white noise. Normally distributed means also that if you take $n$ observations of the same pixel you most likely will end up with $n$ wrong measurements. I think this is actually the worst kind of noise since given any pixel, then any other pixel inside a given neighbourhood will be corrupted, hence telling which observation is to trust more is difficult. The way I would go is probably (low pass) filtering.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think to the impulsive noise again as an additive noise potentially present in all the pixels, but potentially also localized in only a subset of pixels or observations (either it is or it is not). I personally would not go for averaging or low pass filtering since it will never erase completely the noise.&lt;br&gt;&#xA;Assume indeed to have $n$ images of the same scene. Assume that for a given pixel $p$ whose &quot;actual&quot; value is $p=0$ you measure it as $255$ in one image and as $0$ in $n$ images. If you take the mean then you will chose $p = 255/n$ as the actual value. Infact a low pass filter is a process with infinite impulse response and it tends to zero only asymptotically.&lt;br&gt;&#xA;In such case for me it looks more effective to take the median, over the $n$ samples. With the median you obtain that you estimate of the actual values of $p$ is exactly $0$.&lt;br&gt;&#xA;You can also take the most-frequent value (the mode) and it will perform better than the mean. In general you can also use a median or a mode inside the same image by taking them in a neighbourhood of a given pixel. Infact for example, take a $10\times 10$ sub-image and assume it corresponds to a white background. Assume that 30 over the 100 pixels are black due to the impulsive noise, then you can substitute to each pixel the median over the entire sub-image obtaining a completely white patch. A mean will lead to a 30% grey (76 / 255)&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-04-26T13:51:31.137" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30374" PostTypeId="1" AcceptedAnswerId="30375" CreationDate="2016-04-26T14:05:11.880" Score="2" ViewCount="5996" Body="&lt;p&gt;I am having trouble understanding a concept that I have seen in many published papers. For example, in this paper (&lt;a href=&quot;http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0082748&quot; rel=&quot;nofollow&quot;&gt;http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0082748&lt;/a&gt;) they wrote in their methods that to &quot;obtain adequate frequency resolution we downsampled from 44.1 kHz to 8 kHz&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that the sample rate is how many times (per second) the actual sound wave was &quot;sampled&quot;, and that the maximum frequency that can be detected is 1/2 the sampling rate (or the Nyquist frequency). So by downsampling, you will lose the ability to detect higher frequencies, and in a sense downsampling acts as a sort of filter, as it gets rid of the higher frequency sounds from the recording. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes sense to do if your signal of interest is at lower frequencies, but I still don't understand how this gives &quot;adequate frequency resolution&quot;. Does downsampling have any influence on the ability to detect lower frequencies? What do they mean by &quot;frequency resolution&quot;? Thank you so much in advance!&lt;/p&gt;&#xA;" OwnerUserId="20725" LastActivityDate="2016-04-26T15:30:42.400" Title="The relationship between downsampling and frequency resolution" Tags="|frequency|downsampling|nyquist|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30375" PostTypeId="2" ParentId="30374" CreationDate="2016-04-26T14:58:07.700" Score="4" Body="&lt;p&gt;Your understanding is correct. I don't have the full text of the paper, but it sounds like they aren't being very precise with their description. As you pointed out, downsampling doesn't improve frequency resolution in and of itself, it merely reduces the amount of bandwidth that can be represented unambiguously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However,&lt;/strong&gt; I can take a guess at what they were referring to. Assuming they are using a DFT for spectral analysis (the common choice), note that the fact that for a given DFT size $N$, the output bin spacing is a function of the sample rate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_{res} = \frac{f_s}{N}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if a smaller frequency resolution in your spectral calculation is desired, decreasing the sample rate of the data can help you do that. Of course, you could also increase the DFT size $N$ as well; there are some applications where that's not an option, though (e.g. if you're using hardware that is limited to certain FFT sizes). Also, this method can have advantages when the signal of interest is in a small band of frequencies relative to the original sample rate; in this case, downsampling followed by a smaller DFT can be more computationally advantageous than doing one large DFT (this is known as the &lt;a href=&quot;https://dsp.stackexchange.com/a/8089/90&quot;&gt;zoom FFT&lt;/a&gt; technique).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there isn't a free lunch here: to actually realize an increase in resolution, you need $N$ samples at the lower sample rate, which requires a longer observation time. This is the same total observation time that is required by just collecting more data at the higher sample rate and then doing a larger DFT.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-04-26T14:58:07.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30376" PostTypeId="2" ParentId="30374" CreationDate="2016-04-26T15:23:10.467" Score="0" Body="&lt;p&gt;It took me a while to visualize this stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the $z$-domain, the frequencies from 0 to Nyquist are always represented as 0 to $\pi$. This means that if you increase the sampling rate, there are more frequencies that must be represented in your 0 to $\pi$ region (represented by $\omega$). This means as the sample rate increases, a 50Hz signal, say, is represented by a smaller $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some types of digital filter (FIR) and also FFT have a poor resolution at the lower frequencies, so you downsample to effectively increase their frequency resolution at lower frequencies. Downsampling increases the $\omega$ value you need to represent say, 50Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An interesting problem will arise though if you want to increase your FFT resolution. Downsampling will not help, you must increase your sample set and ultimately the number of FFT bins you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've mainly hit this problem designing IIRs where trying to design certain types of IIR of, say, 5Hz at a sampling rate of 192KHz can be more prone to problems than at 48KHz.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="15030" LastEditDate="2016-04-26T15:30:42.400" LastActivityDate="2016-04-26T15:30:42.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30377" PostTypeId="1" AcceptedAnswerId="30382" CreationDate="2016-04-26T16:07:00.987" Score="2" ViewCount="506" Body="&lt;p&gt;Can all analog filters be classified as Bessel, Elliptic, Butterworth or Chebyshev? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a physical ladder topology of several stages of {L, C or LC} in {series or parallel}, is it possible to always classify it to one of the above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I got this question while trying to design a steep filter by trial and error on spice, and then realized that it has too long response, as a Chebyshev filter would have, so I wanted to optimize it.)&lt;/p&gt;&#xA;" OwnerUserId="20726" LastActivityDate="2016-04-26T17:28:13.080" Title="Can we determine if a filter is butterworth or chebyshev from its physical topology?" Tags="|filters|filter-design|classification|analog|hardware-implementation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30378" PostTypeId="2" ParentId="10364" CreationDate="2016-04-26T16:28:04.930" Score="0" Body="&lt;p&gt;A similar question was asked on StackOverflow (though it was specific to developing software for the iPhone): &lt;a href=&quot;https://stackoverflow.com/questions/5374839/how-to-detect-music-note-and-chords-programmatically-in-iphone-sdk&quot;&gt;https://stackoverflow.com/questions/5374839/how-to-detect-music-note-and-chords-programmatically-in-iphone-sdk&lt;/a&gt;&#xA;If you don't quite understand some part of my answer below, please refer to the answer provided to that StackOverflow question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a signals perspective, musical note recognition is just dominant frequency identification. Musical notes are directly mapped to dominant frequencies in a sound. So, if you find the dominant frequency present in a given portion of an audio signal then you can find out the musical note that frequency maps to by consulting the table in this Wikipedia page: &lt;a href=&quot;https://en.wikipedia.org/wiki/Piano_key_frequencies&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Piano_key_frequencies&lt;/a&gt;. As with any other sort of frequency analysis, to start you perform a FFT on the given audio signal and find the peak(s) in the frequency domain data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're planning on building your own program for this purpose anyways, I would suggest just building it &quot;from scratch&quot; - there aren't too many steps to the process, as I've shown above. A programming language like MATLAB would give you the perfect tools to perform an FFT (the built-in &lt;code&gt;fft&lt;/code&gt; function) and all of the requisite analysis to discover dominant frequencies in that frequency data. Of course, if you're more comfortable with another language - like C or C++, for instance - there are implementations of the FFT written for software development in those languages as well (i.e., &lt;a href=&quot;http://www.fftw.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.fftw.org/&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="16941" LastEditorUserId="-1" LastEditDate="2017-05-23T12:41:35.370" LastActivityDate="2016-04-28T17:01:52.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30379" PostTypeId="2" ParentId="30371" CreationDate="2016-04-26T16:32:44.637" Score="1" Body="&lt;p&gt;This is a difficult problem. The wall itself is simply a linear time invariant filter. Typically it's just a low pass filter and can theoretically be compensated with a matching inverse filter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However in practice the attenuation at most frequencies is quite severe. Unless the recording room is extremely quiet and the recording extremely low noise, the remaining speech signal will be below the noise floor and hence impossible to recover.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-04-26T16:32:44.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30380" PostTypeId="2" ParentId="30313" CreationDate="2016-04-26T16:33:29.843" Score="1" Body="&lt;p&gt;As vaz's answer suggests, your differential encoding is incorrect. In QPSK&#xA;regarded as a &lt;em&gt;phase-shift-keyed&lt;/em&gt; signaling scheme as opposed to&#xA;a 4-QAM scheme (see &lt;a href=&quot;https://dsp.stackexchange.com/a/6447/235&quot;&gt;this previous answer of mine&lt;/a&gt; for some details), the input dibit $(b_I,b_Q)$ is treated as being the &lt;em&gt;Gray-coded&lt;/em&gt; integer representation of&#xA;the integers $\{0, 1, 2, 3\}$ and the &lt;em&gt;phase&lt;/em&gt; of the RF carrier in the&#xA;corresponding signaling interval is &lt;br&gt;$0$ or $\pi/2$ or $\pi$ or $3\pi/2$. In tabular form, we have&#xA;$$&#xA;\begin{array}{|c|c|c|c|c|c|}&#xA;\hline&#xA;(b_I,b_Q) &amp;amp; \text{normal value} ~k &amp;amp; \text{Gray code value} ~\ell  &amp;amp;\text{phase-modulated signal}\\&#xA;\hline&#xA;(0,0) &amp;amp; 0 &amp;amp; 0 &#xA;&amp;amp; \sqrt{2}\cos\left(2\pi f_c t - 0\frac{\pi}{2}\right)\\&#xA;(0,1) &amp;amp; 1 &amp;amp; 1  &#xA;&amp;amp; \sqrt{2}\cos\left(2\pi f_c t - 1\frac{\pi}{2}\right)\\&#xA;(1,1) &amp;amp; 3 &amp;amp; 2 &#xA;&amp;amp; \sqrt{2}\cos\left(2\pi f_c t - 2\frac{\pi}{2}\right)\\&#xA;(1,0) &amp;amp; 2 &amp;amp; 3  &#xA;&amp;amp; \sqrt{2}\cos\left(2\pi f_c t - 3\frac{\pi}{2}\right)\\&#xA;\hline&#xA;\end{array}&#xA;$$&#xA;That is, we can say that the QPSK modulator input&#xA;$(b_I,b_Q)$ is regarded as the &lt;em&gt;Gray code&lt;/em&gt; representation&#xA;of the integer $\ell \in \{0,1,2,3\}$ and the modulator produces the&#xA;output&#xA;$$\sqrt{2}\cos\left(2\pi f_c t - \ell\frac{\pi}{2}\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;em&gt;differential&lt;/em&gt; QPSK (DQPSK), the input dibit &lt;strong&gt;Gray-code value&lt;/strong&gt;&#xA;is &lt;em&gt;subtracted&lt;/em&gt; (differential, get it?) from the &lt;em&gt;previous&lt;/em&gt; &lt;strong&gt;transmitted&lt;/strong&gt; dibit &lt;strong&gt;Gray-code&lt;/strong&gt; value (left-handed folks can use addition if they prefer) to get&#xA;the &lt;em&gt;next&lt;/em&gt; transmitted dibit Gray code value.  That is, with $\ell$&#xA;continuing to stand for Gray code value, we have that&#xA;$$a_{\ell}[n] \equiv a_{\ell}[n-1] \mp b_{\ell}[n] \bmod 4. \tag{1}$$&#xA;At the demodulator, we have&#xA;$$\hat{b}_{\ell}[n]\equiv \hat{a}_{\ell}[n-1] \mp \hat{a}_{\ell}[n] \bmod 4 \tag{2}$$ where the carets denote the demodulated symbols and&#xA;it is the job of the project manager to make sure that&#xA;the modulator designer and the demodulator designer both use the same&#xA;sign ($+$ or $-$) in $(1)$ and $(2)$.  In well-designed DQPSK systems,&#xA;there is no explicit (two-bit binary) arithmetic used in $(2)$,&#xA;and the DQPSK demodulator determines $b_{\ell}[n]$ from &lt;em&gt;soft-decision&lt;/em&gt;&#xA;data or more usually, the raw matched-filter/correlator outputs in&#xA;the I and Q branches at two successive sampling instants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you can apply the same idea to $M$-PSK with $M = 2^n &amp;gt; 4$&#xA;with the successive phase shifts being labeled with the &lt;em&gt;Gray-coded&lt;/em&gt; representations of the integers $\{0, 1, 2, \ldots, 2^n-1\}$. &#xA;Equations $(1)$ and $(2)$ above get modified to be arithmetic modulo&#xA;$M$ but the same ideas work. The receivers are more complicated, though.&lt;/p&gt;&#xA;" OwnerUserId="235" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-04-27T01:43:58.843" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30382" PostTypeId="2" ParentId="30377" CreationDate="2016-04-26T16:46:49.560" Score="2" Body="&lt;p&gt;As pointed out in a comment by Jason R, you can obviously come up with some random coefficients for the numerator and denominator polynomials of the filter's transfer function, and you'll end up with arbitrary filters that do not satisfy the definitions of any of the filter types you mentioned (even if you make sure that the filter is causal and stable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning your second question, the answer is also no. A Butterworth and a Chebyshev (type I) filter have the same structure, just the element values are different. The structure of an elliptic filter is different because it has zeros at finite frequencies. For passive filters, these are achieved either by parallel circuits of L and C in the signal path, or by series circuits of L and C towards ground. However, this is also true for type II Chebyshev filters, which also have zeros at finite frequencies. So if your passive filter topology has LC resonators (parallel in the signal path, or serial towards ground) you know that the filter can't have a Butterworth, Bessel, or type I Chebyshev characteristic. It &lt;em&gt;could&lt;/em&gt; be an elliptic or a Chebyshev (type II) filter, but it needn't be. If the structure has no LC resonators, the opposite is true: it can't be an elliptic or a Chebyshev (type II) filter, but it &lt;em&gt;could&lt;/em&gt; be a Bessel, Butterworth, or Chebyshev (type I) filter. But again, it could also be some non-standard filter. It all depends on the element values.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-04-26T17:28:13.080" LastActivityDate="2016-04-26T17:28:13.080" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30383" PostTypeId="1" AcceptedAnswerId="30389" CreationDate="2016-04-26T17:41:37.607" Score="0" ViewCount="1219" Body="&lt;p&gt;Using a micro-processor of &lt;strong&gt;48MHz&lt;/strong&gt;, I am trying to output a sine wave from the &lt;code&gt;DAC&lt;/code&gt; (digital to analog ), and I am not sure if my &lt;code&gt;Nyquist&lt;/code&gt; and calculations are good.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I have to output sine in frequencies range of &lt;code&gt;1KHz to 3MHz&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have created an array of a sine samples that has 1000 points(for 1 period )&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I am running a timer between samples, and the frequency calculation   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;float timerFrequency=sineFrequency*1000; //(timerT*1000=finalSineT)&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But then I was thinking that for &lt;code&gt;3MHz&lt;/code&gt; sine wave, I will need a timer frequency of &lt;code&gt;3GHz&lt;/code&gt; with this approach(!). (3Mhz signal * 1000 sine samples)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something here is very wrong with everything, because if I have a processor that is &lt;code&gt;48MHz&lt;/code&gt;, I can probably output a &lt;code&gt;3MHz&lt;/code&gt; , isn't it ?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Whats wrong with my approach, and what are my limits with these assumptions ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can I reduce the sine samples array to lets say &lt;strong&gt;100&lt;/strong&gt; ? what would it do to the &lt;code&gt;Nyqvist&lt;/code&gt; at 3MHz ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How many samples should my sine array needs? (the min), and my timer frequency?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="17182" LastEditorUserId="80" LastEditDate="2016-04-26T17:57:27.300" LastActivityDate="2016-04-26T23:43:59.587" Title="Output a sine wave from samples-limits?" Tags="|discrete-signals|sampling|nyquist|" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="30386" PostTypeId="2" ParentId="30365" CreationDate="2016-04-26T20:05:56.910" Score="4" Body="&lt;p&gt;Suppose that the noise is a random vector $X$ with normal zero-mean components of variance $\sigma_i$, mutually independent, then for the linear combination (the $g_i$ being for instance coefficients of a FIR filter):&#xA;$$ Y = \sum_i g_i X_i\,,$$&#xA;the variance of $Y$ will be:&#xA;$$ V(Y) =\sum_i g_i^2 \sigma_i^2\,, $$&#xA;which boils down to $$\|g\|_2^2 \sigma_2^2\,$$&#xA;for a classical stationnary Gaussian noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now start from $g^1=[1,-1]$, and assume you built higher order derivative by self-convolution, for instance $$g^2=g^1 \ast g^1 = [1 ,-2 ,1],$$ $$g^3 = g^1 \ast g^1  \ast g^1 =[1,-3,3,1] ,$$ etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You easily get that the coefficients of $g^n$ are $$g^n_k=(-1)^k  \binom{n}{k}\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence $\|g^n\|_2^2 = \sum_k    \binom{n}{k} ^2 = \binom{2n}{n}$ (&lt;a href=&quot;https://math.stackexchange.com/questions/148583/combinatorial-proof-of-summation-of-sum-k-0n-n-choose-k2-2n-choose&quot;&gt;a famous identity&lt;/a&gt;). For $n=1$, the amplification is $2$, for $n=2$ it will be $6$, and $20$ for the third derivative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the noise amplification roughly grows with the derivative order (based on Stirling's formula) as &#xA;$$\frac{4^n}{\sqrt{\pi n}}\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all in all, noise power tends to explode with derivatives. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not happen at order $0$, if you consider that traditional low-pass filters having positive coefficients have finite sum, often equal to $1$. Hence, for those  $\|g\|_2 \le \|g\|_1=1$. For instance, if one takes standard smoothing &quot;discrete Gaussian&quot; filters of order $m$ with coefficients&#xA;$$b^m_k=\frac{  \binom{m}{k}}{2^m}\,,$$&#xA;then their $\ell_2$ squared norm is:&#xA;$$\frac{\binom{2m}{m}}{4^m}$$&#xA;and one sees that the $4^m$ term cancels in the asymptotics, and you get that, when $m$ grows:&#xA;$$\|h^m\|_2^2 \approx\frac{1}{\sqrt{\pi m}}\,,$$&#xA;and thus tend to reduce the noise power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, this is not the whole story, since we have not talked about edges, which traditionally are wide-band, and especially hard to detect in high frequencies. A study in the Fourier domains may lead to others aspects, that exceed my time today, but is addressed in @Olli Niemitalo's &lt;a href=&quot;https://dsp.stackexchange.com/questions/30365/2nd-order-edge-detectors-more-susceptible-to-noise/30397#30397&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-05-03T15:15:48.670" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30388" PostTypeId="1" CreationDate="2016-04-26T23:04:57.573" Score="0" ViewCount="194" Body="&lt;p&gt;I need to analyze some signals containing chords. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How big DFT spectrum is needed to identify each possible musical note in such a signal sampled at 44100 Hz? I can see that 8192 bins gives some frequencies close to some notes like C3 A4 etc., but how big should it be to contain the whole scale, let's say to C5 and with good precision, like for a very good tuner?&lt;/p&gt;&#xA;" OwnerUserId="18346" LastEditorUserId="1629" LastEditDate="2016-04-27T08:20:56.863" LastActivityDate="2016-04-27T13:26:09.367" Title="How many DFT bins must I use to get best precision when analyzing melody scale" Tags="|fft|audio|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30389" PostTypeId="2" ParentId="30383" CreationDate="2016-04-26T23:20:08.383" Score="3" Body="&lt;p&gt;Eventhough your problem is quite a practical one, based on a particular chip to produce a sine wave that requres a solid understanding of its blocks, I would, nevertheless, like to provide you a general framework for producing a continuous time sine wave from a set of discrete time samples, from which you can deduce the details of implementation for your particular architecture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for this particular problem of producing a sine wave, the fundamental factor which will determine your analog output capability from a DAC is the quality of the analog &quot;Anti-Imaging&quot; filter (also known as interpolation or reconstruction filter)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When that filter is an ideal one (or a close enough approximation) it can reject all the distorting image frequency bands that exist due to the DAC output being an ideal impulse based sampled representation of the signal to be reconstructed. (A sine wave in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In such a case (of close to ideal) of operating conditions, you can generate a perfect sine wave at any desired frequency from just &quot;2&quot; samples of it, by merely adjusting the output DAC conversion frequency. The filter will interpolate all the missing wave in the ideal case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, your sine wave samples will be this $$x[n] = \cos(\pi n)$$ which has only two samples which are +1 and -1 per period, representing a critically sampled sinusoidal. Your DAC will output +A and -A after scaling for each consequitive conversion period (which is limited by either your chip speed or your DAC output settling time) and that perfect reconstruction filter will convert those apexes into a smooth sine wave. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By adjusting the DAC output conversion period you can control the produced sinusoidal wave frequency simply as: $$f_{sine} = \frac{1}{2 T_{conversion}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now things are not ideal (especially DAC output involves a zero order hold block that should be taken into account in the design of the reconstruction filter) and therefore sadly just two samples per period will not be enough. In such a case, to be able to use a less perfect and easier to design analog output reconstruction filter you will provide more samples of the sine wave per period. But how many samples? It depends on your filter quality. The better the filter the less the number of samples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency is however is still adjusted the same way: In general let: $$x[n] = \cos(\omega_k n)$$&#xA;be your one period of sampled signal (look up table samples) where $w_k$ (being  between $0$ and $\pi$) is the discrete time frequency of the generic set of samples. And let your DAC output period be $T_s$ then the produced output sine wave will have the frequency of:&#xA;$$f_{sine} = \frac {\omega_k}{2 \pi T_s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again by adjusting $T_s$ or $\omega_k$ you can control this frequency.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-04-26T23:43:59.587" LastActivityDate="2016-04-26T23:43:59.587" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30390" PostTypeId="2" ParentId="30332" CreationDate="2016-04-27T00:53:00.700" Score="1" Body="&lt;p&gt;I don't know of a standard way to do this, but I think taking a leaf out of the training of artificial intelligence algorithms might help:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;divide your output data into two disjoint sets, &lt;/li&gt;&#xA;&lt;li&gt;perform whatever identification procedure you want to obtain the ARMA parameters, and &lt;/li&gt;&#xA;&lt;li&gt;then compare the two transfer functions using whatever distance metric makes sense for your application.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the figure below, I've decided that my distance metric is that the poles and zeros of each ARMA model are &quot;not too far&quot; from each other (or the ARMA poles and zeros found using all the data).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The $\color{black}{\bf black} $ markers are the pole ($\times$) and zero ($\circ$) positions for the ARMA model calculated from first half of the data ($G_1$).&lt;/li&gt;&#xA;&lt;li&gt;The $\color{red}{\bf red} $ markers are the pole ($\times$) and zero ($\circ$) positions for the ARMA model calculated from second half of the data ($G_2$).&lt;/li&gt;&#xA;&lt;li&gt;The $\color{grey}{\bf grey} $ markers are the pole ($\times$) and zero ($\circ$) positions for the ARMA model calculated from all of the data ($G_{\rm tot}$).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Hx1pA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hx1pA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to do it might be to look at the transfer function&#xA;$$&#xA;E = G_1 - G_2&#xA;$$&#xA;That is plotted below using the &lt;code&gt;freqz&lt;/code&gt; command in R.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ICiIf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ICiIf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30332&#xA;library(signal)&#xA;library(tseries)&#xA;&#xA;# Create a time series that is not just white noise&#xA;T &amp;lt;- 1000&#xA;&#xA;do_plot &amp;lt;- 1&#xA;&#xA;#for (k in seq(1,100))&#xA;{&#xA;  x &amp;lt;- rnorm(T, 0, 1)&#xA;  bf &amp;lt;- butter(4,0.41)&#xA;  y &amp;lt;- filter(bf$b, bf$a, x)&#xA;&#xA;  # Split data in two and compare ARIMA models&#xA;  L2 &amp;lt;- length(y)/2&#xA;  y1 &amp;lt;- y[100:L2] # Start away from 1 to avoid startup transients&#xA;  y2 &amp;lt;- y[(L2+1):length(y)]&#xA;&#xA;  orders &amp;lt;- c(3,0,3)&#xA;&#xA;  # First half&#xA;  tryCatch(&#xA;  {arima1 &amp;lt;- arima(y1, order = orders)},&#xA;  warning = function(w) {  },&#xA;  error = function(e) {  },&#xA;  finally = {});&#xA;&#xA;  all_1 &amp;lt;- coefficients(arima1)&#xA;  num_1 &amp;lt;- all_1[4:6]&#xA;  den_1 &amp;lt;- all_1[1:3]&#xA;&#xA;  # Second half&#xA;  tryCatch(&#xA;  {arima2 &amp;lt;- arima(y2, order = orders)},&#xA;  warning = function(w) {  },&#xA;  error = function(e) {  },&#xA;  finally = {});&#xA;&#xA;  all_2 &amp;lt;- coefficients(arima2)&#xA;  num_2 &amp;lt;- all_2[4:6]&#xA;  den_2 &amp;lt;- all_2[1:3]&#xA;&#xA;  # All data&#xA;  arima_tot &amp;lt;- arima(y, order = orders)&#xA;  all_tot &amp;lt;- coefficients(arima_tot)&#xA;  num_tot &amp;lt;- all_tot[4:6]&#xA;  den_tot &amp;lt;- all_tot[1:3]&#xA;&#xA;  # Plot  boundaries&#xA;  xs &amp;lt;- c(-1,1)&#xA;  ys &amp;lt;- xs&#xA;&#xA;  if (do_plot == 1)&#xA;  {&#xA;    par(mfrow=c(1,1), pty='s')&#xA;    plot(roots(den_1), xlim=xs, ylim=xs, lwd = 6, pch=4, xlab=&quot;Re(z)&quot;, ylab=&quot;Im(z)&quot;)&#xA;    do_plot &amp;lt;- 0&#xA;  }&#xA;  else&#xA;  {&#xA;    points(roots(den_1), lwd = 6, pch=4)&#xA;  }&#xA;  points(roots(den_2), lwd = 4, col=&quot;red&quot;, pch=4)&#xA;  points(roots(den_tot), lwd = 2, col=&quot;grey&quot;, pch=4)&#xA;&#xA;  points(roots(num_1), lwd = 6, pch=1)&#xA;  points(roots(num_2), lwd = 4, col=&quot;red&quot;, pch=1)&#xA;  points(roots(num_tot), lwd = 2, col=&quot;grey&quot;, pch=1)&#xA;}&#xA;&#xA;&#xA;par(pty=&quot;m&quot;)&#xA;subtract_num &amp;lt;- conv(num_1, den_2) - conv(num_2, den_1)&#xA;subtract_den &amp;lt;- conv(den_1, den_2)&#xA;&#xA;freqz(subtract_num, subtract_den)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-27T00:53:00.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30391" PostTypeId="1" CreationDate="2016-04-27T02:39:51.433" Score="1" ViewCount="227" Body="&lt;p&gt;It is relatively easy to discover overlaid (additive) signals in natural phenomena using wavelet decomposition, Fourier Transforms, CEEMD, etc, because addition in the time domain is the same as addition in the frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I cannot find a clear reference on how to determine if amplitude modulation is occurring in a natural phenomena.   This type of relationship between known or unknown sources results in convolution in the frequency domain, and I can't figure out how to process a time series of data to elicit possible sources of such a signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take for example a commonly available series - monthly sunspots.  There's clear peaks at 10 and 12 year intervals that can be seen by taking an FFT, resulting in the commonly known 11 year cycle average, which makes one suspect amplitude modulation somewhere in the natural processes of the sun.  How would one determine a suspected carrier frequency or prove that some sort of amplitude modulation is taking place?&lt;/p&gt;&#xA;" OwnerUserId="19585" LastActivityDate="2016-04-27T02:39:51.433" Title="How do I find amplitude modulation effects in natural signals" Tags="|signal-analysis|frequency-domain|amplitude|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30392" PostTypeId="1" CreationDate="2016-04-27T04:22:10.893" Score="4" ViewCount="5631" Body="&lt;p&gt;For example, how can I determine if the convolution of $x(t)$ with $y(t)$ is equal to $0$?&lt;/p&gt;&#xA;" OwnerUserId="20716" LastEditorUserId="21075" LastEditDate="2020-05-05T08:50:05.340" LastActivityDate="2020-05-06T13:47:05.133" Title="When does the convolution of $2$ signals equal zero?" Tags="|signal-analysis|convolution|continuous-signals|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="30393" PostTypeId="2" ParentId="30392" CreationDate="2016-04-27T05:23:26.780" Score="7" Body="&lt;p&gt;Time-domain convolution is frequency-domain multiplication. If at all frequencies at least one of the signals is zero-valued in frequency domain, then the convolution of the two signals will be zero-valued at all frequencies, and at all times. Except for a zero signal, no finite-length signal has a continuous run of frequency domain zeros, so your choices are limited to infinite-length signals such as periodic signals with no coinciding non-zero harmonics and ideal lowpass–highpass filter impulse response pairs.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-04-27T08:56:08.013" LastActivityDate="2016-04-27T08:56:08.013" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30395" PostTypeId="1" AcceptedAnswerId="30399" CreationDate="2016-04-27T05:48:42.030" Score="1" ViewCount="788" Body="&lt;p&gt;I have designed a fir filter with my desired frequency response at a specific sampling rate and filter order. If I were to redesign my filter for a new higher sampling rate, should I change the filter order? I am having trouble understanding how the same filter order influences the desired frequency response at different sampling rates.&lt;/p&gt;&#xA;" OwnerUserId="12128" LastActivityDate="2016-04-27T09:03:49.433" Title="Should the order of a filter be proportional to the sampling rate?" Tags="|filters|sampling|finite-impulse-response|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30396" PostTypeId="1" CreationDate="2016-04-27T08:38:01.753" Score="-1" ViewCount="565" Body="&lt;p&gt;for a Project I need to build an Audio Modem in GNU Radio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I decided, that it would be the best to use DBPSK Modulation, because that is fast and relatively noise resistant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as it seems, the DBSK Modulators are just modulating the Signal on the Baseband.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's not what  I want. Would it be enough, to just multiply the signal with a signal source? And when I do that, do I have to meet any preconditions so that the demodulator doesnt expect a Baseband?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: If you have any recommendations what would be a good filter, to get the best out of it, I would like to hear that to.&lt;/p&gt;&#xA;" OwnerUserId="20737" LastEditorUserId="13320" LastEditDate="2016-04-27T08:55:36.283" LastActivityDate="2022-03-29T00:03:15.330" Title="How to set a Carrier Wave for DBPSK Modulators in gnuradio?" Tags="|filters|modulation|demodulation|bpsk|gnuradio|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30397" PostTypeId="2" ParentId="30365" CreationDate="2016-04-27T08:38:51.900" Score="3" Body="&lt;p&gt;Let's assume that the signal has a white (flat) power spectrum $|X(\omega)|^2$ of unity power $P_0$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|X(\omega)|^2 = c$$&#xA;$$P_0 = \int_{-\pi}^\pi |X(\omega)|^2 d\omega = 1$$&#xA;$$\Rightarrow c = \frac{1}{2\pi}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform of the &quot;differentiation&quot; filter $g = \left[1, -1\right]$ is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(\omega) = 1-e^{i\omega}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal power after filtering $n$ times will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_n = \int_{-\pi}^\pi |X(\omega)|^2|G(\omega)|^{2n} d\omega = \int_{-\pi}^\pi \frac{1}{2\pi}\left|1-e^{i\omega}\right|^{2n} d\omega$$&#xA;$$= 2^{2n + 1}\frac{\left(\frac{1}{2}(2n + 1)\right)!}{n!\sqrt{\pi}(2n + 1)}$$&#xA;$$\Rightarrow P_0 = 1, P_1 = 2, P_2 = 6, P_3 = 20, P_4 = 70\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for a flat power spectrum all the way to the Nyquist frequency ($\pi$). We won't see those large gains if the signal is low-pass with a band-limit below the Nyquist frequency, for example at half the Nyquist frequency:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P_n = \int_{-\pi/2}^{\pi/2} \frac{1}{\pi}\left|1-e^{i\omega}\right|^{2n} d\omega$$&#xA;$$\Rightarrow P_0 = 1, P_1 \approx 0.73, P_2 \approx 0.91, P_3 \approx 1.33, P_4 \approx 2.09$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the higher orders of differentiation, if there was any white noise in the data, it would follow (1) and blow up in comparison to a signal that is low-pass with the lower band-limit, giving a hopelessly low signal-to-noise ratio. The situation will be similar for any signal that doesn't utilize the spectrum all the way up to the Nyquist frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;True edges are not low-pass, however, but have a -6 dB / octave decaying spectrum. After the first differentiation, a normalized edge signal $[\dots, 1, 1, 1, 1, 0, 0, 0, \dots]$.looks like an impulse: $[\dots, 0, 0, 0, 1, 0, 0, 0, \dots]$. Based on (1), the second filtering multiplies the noise power by a factor of 3 while the edge signal becomes $[\dots, 0, 0, 0, 1, -1, 0, 0, \dots]$, doubling its sum of squares power and not affecting its peak value. We can conclude that in the presence of white noise, compared to the first order edge detector the second order edge detector suffers from a $10 \log_{10}\left(\frac{3}{2}\right) \text{ dB} \approx 1.76 \text{ dB}$ worse sum of squares and $10 \log_{10}\left(3\right) \text{ dB} \approx 4.77 \text{ dB}$ worse peak to sum of squares signal-to-noise ratio.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-04-30T09:29:36.360" LastActivityDate="2016-04-30T09:29:36.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30398" PostTypeId="2" ParentId="30396" CreationDate="2016-04-27T09:02:30.480" Score="0" Body="&lt;p&gt;Short answer: yes; digitally mixing this up to a carrier frequency and just using the real part will suffice. For more info, refer to the usual &quot;complex baseband&quot; introduction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your filter question is completely impossible to answer – it depends on the characteristics of your transmission and your audio channel, and you mention nothing of that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you say DBPSK is fast. I don't know what you really mean with &quot;fast&quot;, here, but I assure you that a 1bit/symbol modulation isn't per se a very efficient one. Unless you're in a very special case, you typically stay far away from being a good modulation – it's easy to demodulate, indeed, because you don't need knowledge about the initial state and hence can vastly simplify synchronization, but that makes it an especially spectrally inefficient modulation. That means you waste bandwidth that you could use for more bit/second in favour of a simpler system.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-04-27T09:02:30.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30399" PostTypeId="2" ParentId="30395" CreationDate="2016-04-27T09:03:49.433" Score="1" Body="&lt;p&gt;Keeping the FIR filter the same order and doubling the sample rate will effectively halve the accuracy of frequency resolution which will be noticable at low frequencies (this is based on the assumption you are using something like FFT to create your FIR, otherwise the order of the FIR and it's resolution is a bit more complicated).&lt;/p&gt;&#xA;" OwnerUserId="15030" LastActivityDate="2016-04-27T09:03:49.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30401" PostTypeId="1" AcceptedAnswerId="30479" CreationDate="2016-04-27T11:20:16.393" Score="0" ViewCount="555" Body="&lt;p&gt;The paper titled &quot;&lt;a href=&quot;http://www.pauldebevec.com/Research/HDR/debevec-siggraph97.pdf&quot; rel=&quot;nofollow&quot;&gt;Reconvering High Dynamic Range Radiance Maps from Photographs&lt;/a&gt;&quot; from Debevec and Malik is a seminal paper in high dynamic imaging. In this paper, it proposed a method to estimate the camera response function (CRF), which is equal to optimize the following objective function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathcal O = \sum_{i=1}^N\sum_{j=1}^P\left\{w\left(Z_{ij}\right)\left[g\left(Z_{ij}\right)-\ln E_i-\ln\Delta t_j\right]\right\}^2+\lambda \sum_{z=Z_{\rm min}+1}^{Z_{\rm max}-1}\left[w(z)g''(z)\right]^2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author also provides MATLAB codes to optimize this object function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%&#xA;% gsolve.m − Solve for imaging system response function&#xA;%&#xA;% Given a set of pixel values observed for several pixels in several&#xA;% images with different exposure times, this function returns the&#xA;% imaging system’s response function g as well as the log film irradiance&#xA;% values for the observed pixels.&#xA;%&#xA;% Assumes:&#xA;%&#xA;% Zmin = 0&#xA;% Zmax = 255&#xA;%&#xA;% Arguments:&#xA;%&#xA;% Z(i,j) is the pixel values of pixel location number i in image j&#xA;% B(j) is the log delta t, or log shutter speed, for image j&#xA;% l is lamdba, the constant that determines the amount of smoothness&#xA;% w(z) is the weighting function value for pixel value z&#xA;%&#xA;% Returns:&#xA;%&#xA;% g(z) is the log exposure corresponding to pixel value z&#xA;% lE(i) is the log film irradiance at pixel location i&#xA;%&#xA;function [g,lE]=gsolve(Z,B,l,w)&#xA;&#xA;n = 256;&#xA;&#xA;A = zeros(size(Z,1)*size(Z,2)+n+1,n+size(Z,1));&#xA;b = zeros(size(A,1),1);&#xA;&#xA;%% Include the data−fitting equations&#xA;&#xA;k = 1;&#xA;for i=1:size(Z,1)&#xA;  for j=1:size(Z,2)&#xA;    wij = w(Z(i,j)+1);&#xA;    A(k,Z(i,j)+1) = wij; A(k,n+i) = −wij; b(k,1) = wij * B(i,j);&#xA;    k=k+1;&#xA;  end&#xA;end&#xA;&#xA;%% Fix the curve by setting its middle value to 0&#xA;&#xA;A(k,129) = 1;&#xA;k=k+1;&#xA;&#xA;%% Include the smoothness equations&#xA;&#xA;for i=1:n−2&#xA;  A(k,i)=l*w(i+1); A(k,i+1)=−2*l*w(i+1); A(k,i+2)=l*w(i+1);&#xA;  k=k+1;&#xA;end&#xA;&#xA;%% Solve the system using SVD&#xA;&#xA;x = A\b;&#xA;&#xA;g = x(1:n);&#xA;lE = x(n+1:size(x,1));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The implementation codes are well understood, and my question is why this implementation can optimize the object function. If I understand well about this implementation, the solution to the object function is the one that makes the gradients of the object function equal to zero. However, one thing I am confused is that why the first part and the second part of the object function are treated independently.  How could it be possible? &lt;/p&gt;&#xA;" OwnerUserId="1674" LastEditorUserId="1629" LastEditDate="2016-05-03T07:16:55.670" LastActivityDate="2016-05-03T07:16:55.670" Title="How to understand the implementation codes in Debevec and Malik's HDR paper" Tags="|image-processing|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30402" PostTypeId="2" ParentId="30388" CreationDate="2016-04-27T13:26:09.367" Score="1" Body="&lt;p&gt;You can always improve the accuracy of frequency estimates by quadratically interpolating the peaks in the DFT. This page should explain how to do this: &lt;a href=&quot;https://ccrma.stanford.edu/~jos/parshl/Peak_Detection_Steps_3.html&quot; rel=&quot;nofollow&quot;&gt;https://ccrma.stanford.edu/~jos/parshl/Peak_Detection_Steps_3.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You still end up with the issue of converting peaks in the spectrum to pitch, i.e. which peaks correspond to the fundamentals. The fundamental may not even be present as well!&lt;/p&gt;&#xA;" OwnerUserId="20645" LastActivityDate="2016-04-27T13:26:09.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30403" PostTypeId="1" CreationDate="2016-04-27T14:11:13.133" Score="1" ViewCount="60" Body="&lt;p&gt;I am trying to solve a class exercise in which I am given the following, in Laplace domain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G(s)=\dfrac{e^{-Ts}}{s+3}$$&#xA;$$H(s)=\dfrac{1}{s}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I need to calculate $\dfrac{C(z)}{R(z)}$, which is defined as:&#xA;$$\dfrac{C(z)}{R(z)}=\dfrac{G(z)}{1+H(z)G(z)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to do so, I have to transform $G(s)$ and $H(s)$ into the $Z$ domain and operate to compute $\dfrac{C(z)}{R(z)}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to compute $G(z)$ and $H(z)$, and I think I have failed in calculating $G(z)$, because I am not getting the right result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I obtained that $H(z)=\dfrac{1}{1-z^{-1}}$ (that I think is correct).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, my question is how to obtain $G(z)$, I know that $\boxed{e^{sT}=z}$, but I don't know how to relate it with it, because initially I obtained: $G(z)=\dfrac{z^{-1}}{1-e^{-3}z^{-1}}$ but apparently is not correct. What am I doing wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; in the statement of the exercise I am told to consider the period of one second (T=1s).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; $$\dfrac{C(z)}{R(z)}=\dfrac{(1-z^{-1})z^{-1}}{1-(1+e^{-3})z^{-1}+(\dfrac{2}{3}e^{-3}+\dfrac{1}{3})z^{-2}}$$&lt;/p&gt;&#xA;" OwnerUserId="15843" LastEditorUserId="15843" LastEditDate="2016-04-27T14:31:11.097" LastActivityDate="2016-04-27T18:10:04.447" Title="Problems calculating Z-transform" Tags="|discrete-signals|z-transform|control-systems|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30405" PostTypeId="2" ParentId="30403" CreationDate="2016-04-27T15:12:34.517" Score="2" Body="&lt;p&gt;We have&#xA;$$G(z)=\dfrac{z^{-1}}{1-e^{-3}z^{-1}}$$&#xA;and&#xA;$$H(z)=\dfrac{1}{1-z^{-1}}$$&#xA;and we want to calculate&#xA;$$\dfrac{C(z)}{R(z)}=\dfrac{G(z)}{1+H(z)G(z)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's do that:&#xA;$$&#xA;\require{cancel}&#xA;\dfrac{\dfrac{z^{-1}}{1-e^{-3}z^{-1}}}{1+\dfrac{1}{1-z^{-1}}\dfrac{z^{-1}}{1-e^{-3}z^{-1}}} = \frac{z^{-1}(1-z^{-1})}{(1-z^{-1})(1-e^{-3}z^{-1}) + z^{-1}}\\&#xA;= \frac{z^{-1}(1-z^{-1})}{1 - z^{-1} - e^{-3}z^{-1} + e^{-3}z^{-2} + z^{-1}}&#xA;= \frac{z^{-1}(1-z^{-1})}{1 \cancel{- z^{-1}} - e^{-3}z^{-1} + e^{-3}z^{-2} \cancel{+ z^{-1}}}\\&#xA;= \frac{z^{-1}(1-z^{-1})}{1 - e^{-3}z^{-1} + e^{-3}z^{-2} }&#xA;$$&#xA;so it looks like either the solution you have is wrong, or that $G(z)$ is not right.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, let's see what could be wrong. Either&#xA;$$&#xA;z \not = e^{sT}\tag{1}&#xA;$$&#xA;or&#xA;$$&#xA;s \not = 1 - z^{-1}\tag{2}&#xA;$$&#xA;or&#xA;$$&#xA;G(z) \not = \dfrac{1}{1-e^{-3}z^{-1}} \cdot {\cal T}_{s \rightarrow z}(e^{-s})\tag{3}&#xA;$$&#xA;where ${\cal T}_{s \rightarrow z}$ is the $s$ to $z$ conversion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing (1) and (2), it looks like (1) is assuming the &lt;a href=&quot;https://en.wikipedia.org/wiki/Starred_transform&quot; rel=&quot;nofollow&quot;&gt;starred transform&lt;/a&gt; and (2) is assuming the &lt;a href=&quot;https://en.wikipedia.org/wiki/Impulse_invariance&quot; rel=&quot;nofollow&quot;&gt;impulse invariance&lt;/a&gt; method --- which can't both be right.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-27T18:10:04.447" LastActivityDate="2016-04-27T18:10:04.447" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30406" PostTypeId="1" AcceptedAnswerId="30413" CreationDate="2016-04-27T16:21:09.860" Score="1" ViewCount="2001" Body="&lt;p&gt;I have 2 images of the same scene, captured by different cameras. So they a bit displaced. As far as I can understood, phases of FFT contains info about image details. My goal is to take intensity from first image, details from second and produce enhanced highly detailed image with proper intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to solve problem as is - apply FFT for both images, take magnitudes from first image and phases from second and apply iFFT. But I didn't get what I want. Image looked corrupted, see below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k3a0S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k3a0S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I tried to compute &lt;a href=&quot;https://en.wikipedia.org/wiki/Phase_correlation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phase correlation&lt;/a&gt; , align images and &#xA;apply the algorithm described above again. Result was the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do what I want? May be I need to do some calculations in frequency domain, like phase shifting? Matlab code is highly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="20742" LastEditorUserId="80" LastEditDate="2016-04-27T18:17:04.233" LastActivityDate="2016-04-27T18:46:58.770" Title="Replace phases of image FFT" Tags="|image-processing|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30407" PostTypeId="2" ParentId="30406" CreationDate="2016-04-27T16:36:40.287" Score="1" Body="&lt;p&gt;My partner wrote this code in an image processing class and it worked. I hoped you will find here a hint of what you did wrong:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Brad_X = fft2(double(Brad_pic));&#xA;Brad_X_shifted = fftshift(Brad_X);&#xA;&#xA;Baboon_X = fft2(double(Baboon_pic));&#xA;Baboon_X_shifted = fftshift(Baboon_X);&#xA;&#xA;Brad_phase  = angle(Brad_X);&#xA;Brad_amp    = abs(Brad_X);&#xA;&#xA;Baboon_phase  = angle(Baboon_X);&#xA;Baboon_amp    = abs(Baboon_X);&#xA;&#xA;Brad_exp_baboon = Brad_amp.*(exp(1i*Baboon_phase));&#xA;Baboon_exp_brad = Baboon_amp.*(exp(1i*Brad_phase));&#xA;&#xA;Brad_exp_baboon_pic = abs(ifft2(Brad_exp_baboon));&#xA;Baboon_exp_brad_pic = abs(ifft2(Baboon_exp_brad));&#xA;&#xA;    figure;&#xA;subplot(1,2,1); imshow(Brad_exp_baboon_pic,[]); title('Brad Amp, Baboon Phase');&#xA;subplot(1,2,2); imshow(Baboon_exp_brad_pic,[]); title('Baboon Amp, Brad Phase');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In case you were wondering, we are indeed taking a picture of Brad Pitt and a picture of a baboon and changing their phase and amplitude. The result is not perfect, but I wouldn't expect it to be perfect either.&lt;/p&gt;&#xA;" OwnerUserId="20745" LastActivityDate="2016-04-27T16:36:40.287" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30408" PostTypeId="1" CreationDate="2016-04-27T16:39:20.100" Score="7" ViewCount="569" Body="&lt;p&gt;For all the practicing engineers out there: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Where have you encountered a negative SNR? &lt;/li&gt;&#xA;&lt;li&gt;How negative, in dB, was it or estimated to be? &lt;/li&gt;&#xA;&lt;li&gt;Where would you expect to encounter a negative SNR?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note: I am also counting interference signals as noise, so SNR can also include SIR.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my own experience, I have seen negative SNRs in car communications. There is road noise, as well as multi-talker and music interference. I have also seen it in the output from cellular phones. Wind noise can sometimes pose a significant problem there, as well as the myriad of interferences in speakerphone mode. &lt;/p&gt;&#xA;" OwnerUserId="19259" LastEditorUserId="1629" LastEditDate="2016-04-27T22:25:42.520" LastActivityDate="2021-04-30T09:22:01.313" Title="Acoustic Scenarios With Negative SNR" Tags="|signal-analysis|snr|" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30409" PostTypeId="2" ParentId="30408" CreationDate="2016-04-27T16:57:02.323" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://espace.library.uq.edu.au/view/UQ:11277/hmmaster.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;When I was working on SONAR data, the interesting SNR regime was -30dB to -20dB.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this specific paper, we were trying to first find the shape of the towed hydrophone array, and then use that estimated shape to improve bearing estimation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 3 from the paper included below for illustration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5BTfr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5BTfr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-27T16:57:02.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30410" PostTypeId="1" CreationDate="2016-04-27T17:14:08.667" Score="2" ViewCount="4394" Body="&lt;p&gt;I am new to Computer Vision, I am writing my own code for &lt;a href=&quot;https://en.wikipedia.org/wiki/Hough_transform&quot; rel=&quot;nofollow&quot;&gt;Hough Transform&lt;/a&gt; I have found the following algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Algorithm:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;• The cell (i,j) corresponds to the square associated&#xA;with parameter values (θj, ρi).&#xA;&#xA;• Initialize all cells with value 0.&#xA;&#xA;• For each foreground point (xk,yk) in the thresholded&#xA;edge image&#xA;– Let θj equal all the possible θ-values&#xA;&#xA;• Solve for ρ using ρ=x cos θj +ysin θj&#xA;&#xA;• Round ρ to the closest cell value, ρq&#xA;&#xA;• Increment A(i,q) if the θj results in ρq&#xA;&#xA;• After this procedure, A(i,j)=P means that P points in&#xA;the xy-space lie on the line ρj=x cos θj +ysin θj&#xA;&#xA;• Find line candiates where A(i,j) is above a suitable&#xA;threshold&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have written the code to increment the indices of hough accumulator array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Code:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%%&#xA;% Hough Transform&#xA;&#xA;[rows,cols] = size(E); % size of edged image&#xA;&#xA;rhomax = ceil (sqrt(rows^2 + cols^2)); % maximum value of rho&#xA;&#xA;rhomax = rhomax * 2; % multuplied with 2 to cater both +rho and -rho values&#xA;&#xA;accu = zeros(rhomax, 101); % initialization of accumulaor array with rhomax and 101 possible theta values&#xA;&#xA;for i =1:1:rows % for all rows&#xA;&#xA;    for j =1:1:cols % for all columns&#xA;&#xA;        if(E(i,j) ~= 0) % if the pixel is ONE (part of the edge) then process it&#xA;&#xA;            for theta = 85.0:0.1:95.0 % for the theta values 85.0 - 95.0&#xA;&#xA;                % computing the theta index for hough accumulator&#xA;                theta_index = 0;&#xA;                for k =85.0:0.1:theta&#xA;                    theta_index = theta_index + 1;&#xA;                end&#xA;                %---&#xA;&#xA;                rho = round (i*cos(theta) + j*sin(theta)); % computing the value of rho&#xA;&#xA;                % computing the rho index for hough accumulator&#xA;                rho_index = 1;&#xA;                if(rho &amp;lt; 0)&#xA;                    rho_index = rho_index + abs(rho);&#xA;                elseif(rho &amp;gt; 0)&#xA;                    rho_index = rho_index + (rhomax/2) + rho;&#xA;                elseif(rho == 0)&#xA;                    rho_index = rho_index + (rhomax/2);&#xA;                end&#xA;                %---&#xA;&#xA;                accu(rho_index,theta_index) = accu(rho_index,theta_index)+1; % incrementing the corresponding index in accumulator&#xA;&#xA;            end&#xA;&#xA;        end&#xA;&#xA;    end&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now I want to proceed further with the threshold value. I will be very grateful if someone tell me &lt;strong&gt;how should I select my threshold value ?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="20130" LastActivityDate="2016-04-27T19:45:11.810" Title="How to set threshold value for Hough Transform" Tags="|image-processing|hough-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30411" PostTypeId="2" ParentId="30410" CreationDate="2016-04-27T18:13:35.277" Score="3" Body="&lt;p&gt;Well, it really depends on what you expect to find in the image.  &lt;a href=&quot;http://www.mathworks.com/help/images/ref/houghpeaks.html&quot; rel=&quot;nofollow&quot;&gt;The matlab function&lt;/a&gt; uses an example threshold of half the largest peak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What sort of images are you using this on?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, based on just finding vertical lines in your image, let's make some assumptions.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your rectangle's minimum vertical side length is $L_{\rm min}$ pixels.&lt;/li&gt;&#xA;&lt;li&gt;Your edge detection only finds 80% of each edge.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then the minimum threshold will be &#xA;$$&#xA;0.8 L_{\rm min}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You many need to modify this if, for example, your edges tend to be thicker or thinner than the 80% figure.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-27T19:45:11.810" LastActivityDate="2016-04-27T19:45:11.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30412" PostTypeId="2" ParentId="30406" CreationDate="2016-04-27T18:31:13.720" Score="0" Body="&lt;p&gt;If @GaiusJulius's code doesn't help then neither will this. It doesn't appear to have the same issues yours does. Can you share your original two images?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Be3Uu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Be3Uu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30406&#xA;&#xA;require(&quot;EBImage&quot;)&#xA;&#xA;image_url &amp;lt;- &quot;http://www.lhup.edu/~dsimanek/3d/stereo/sailboats.jpg&quot;&#xA;image_file &amp;lt;- basename(image_url)&#xA;&#xA;if (!file.exists(image_file))&#xA;{&#xA;  download.file(image_url,image_file)&#xA;}&#xA;&#xA;library(jpeg)&#xA;image &amp;lt;- readJPEG(image_file)&#xA;dims &amp;lt;- dim(image)&#xA;&#xA;i1 &amp;lt;- flip(t(image[,1:(dims[2]/2),1]))&#xA;i2 &amp;lt;- flip(t(image[,(dims[2]/2 + 1):dims[2],1]))&#xA;&#xA;I1 &amp;lt;- fft(i1)&#xA;I2 &amp;lt;- fft(i2)&#xA;&#xA;I3 &amp;lt;- abs(I1) * exp(1i*Arg(I2))&#xA;i3 &amp;lt;- abs(fft(I3, inverse = TRUE) / length(I3))&#xA;&#xA;par(mfrow=c(2,2))&#xA;image(i1, col  = gray((0:32)/32), axes = FALSE)&#xA;title(&quot;Image 1&quot;)&#xA;image(i2, col  = gray((0:32)/32), axes = FALSE)&#xA;title(&quot;Image 2&quot;)&#xA;image(i3, col  = gray((0:32)/32), axes = FALSE)&#xA;title(&quot;1's amplitude, 2's phase&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-27T18:31:13.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30413" PostTypeId="2" ParentId="30406" CreationDate="2016-04-27T18:46:58.770" Score="3" Body="&lt;p&gt;What you want to do is impossible with your technique. The phase of an FFT does &lt;em&gt;not&lt;/em&gt; provide the details of an image. Even if it did, why would it enhance an image, if you exchanged the &quot;details&quot; of both images without any calculation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase of an FFT of an image mainly holds the structure information, i.e. &lt;em&gt;how&lt;/em&gt; the frequencies contribute to the image (in terms of phase offsets). This is valid for fine and coarse structures in the image. The magnitude tells you, &lt;em&gt;how much&lt;/em&gt; each frequency contributes to the image. This information is in most cases less important, as can be seen by the general shape of the 2D magnitude spectrum (many strong low frequency contributions and a rapid decay towards higher frequencies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume, what you would like do do is more a quite complex problem to be solved in image space. You might want to look for publications and algorithms on &lt;em&gt;super-resolution&lt;/em&gt; for your application.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-04-27T18:46:58.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30414" PostTypeId="1" AcceptedAnswerId="30417" CreationDate="2016-04-27T20:48:49.747" Score="2" ViewCount="441" Body="&lt;p&gt;I'm writing a viterbi decoder and I'm rather confused about the correct process of decoding the final &lt;code&gt;k&lt;/code&gt; bits for a &lt;code&gt;k&lt;/code&gt;th order convolutional filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the bulk of the message, my process considers the 0-successor and 1-successor of every state, that is, the resulting shift register state found by shifting a 0 in or a 1 in, respectively. Both of these successors share a least-error ancestor found by the dynamic programming step in the Viterbi algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the last &lt;code&gt;k&lt;/code&gt; bits, we know that the encoder shifted in 0s in order to flush out the payload and reset to the 0 state. I can confirm this is the case because I've also written the encoder. So, when I get to this part of the message, my decoder only considers 0-successors. I think this is all I can do with this information, but I feel like I'm possibly missing some extra info that would help recover the message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm discovering in reality is that unrecoverable errors are far, far more likely to occur in the final &lt;code&gt;k&lt;/code&gt; bits of the message leading up to these 0 flush bits. For example, if my decoded message is 256 bytes long, and I inject errors at a rate of 3%, I find that 15% of the unrecovered errors occur in the last byte.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To some extent, I might expect this to be the case as there aren't additional bits left to help the Viterbi best path converge. I'm using a convergence length of &lt;code&gt;5k&lt;/code&gt;, or 35 decoded bits for a 7th order filter. Should I just expect that without a padding of 35 bits, the end of my message is more likely to receive errors? Or should I keep looking for a bug in my decoder implementation? In practice, is it common to add additional payload bits to help viterbi converge?&lt;/p&gt;&#xA;" OwnerUserId="20751" LastActivityDate="2016-04-28T17:03:49.367" Title="Decoding final bits with viterbi" Tags="|viterbi-algorithm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30415" PostTypeId="1" CreationDate="2016-04-27T23:53:29.503" Score="0" ViewCount="4218" Body="&lt;p&gt;This task comes from tracking object on a steady background. So far I was able to remove the background and obtain binary masks like this:&lt;a href=&quot;https://i.stack.imgur.com/DaACg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DaACg.png&quot; alt=&quot;mask1&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eJofr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eJofr.png&quot; alt=&quot;mask2&quot;&gt;&lt;/a&gt; &#xA;I need to get bounding rectangle of the toy without the cord attached to it (on some frames it's quite thick). Sounds easy enough but I can't think of a good way to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried cross-correlation with template of the toy I cropped. It wasn't really nice, plus I needed rectangle to be able to change it's size. And the cord added some mess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;meanShift() also didn't show good results because of the cord and occasional noice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now I stopped on findContours() with some tweaks, but it still produces some weird boundaries on what seems like okay image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I keep thinking there must be some more simple and effective solution.&lt;/p&gt;&#xA;" OwnerUserId="20649" LastActivityDate="2016-08-26T14:02:16.140" Title="Object detection in binary image" Tags="|image-processing|opencv|detection|tracking|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30416" PostTypeId="2" ParentId="30408" CreationDate="2016-04-28T00:37:35.283" Score="1" Body="&lt;p&gt;Speakerphones and things like Amazon Echo. The music from the Echo at the microphone is probably 20 dB or so louder then the voice it's trying to pick up.&lt;/p&gt;&#xA;" OwnerUserId="3997" LastActivityDate="2016-04-28T00:37:35.283" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30417" PostTypeId="2" ParentId="30414" CreationDate="2016-04-28T01:22:35.283" Score="2" Body="&lt;p&gt;You do not need any additional bits to help the decoder converge.  There should be no need for convergence at the boundaries, because the start and end states are completely known (the all zeros state) so there is no guessing involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are getting more errors at the end it is likely due to a bug in the decoder.&lt;/p&gt;&#xA;" OwnerUserId="923" LastEditorUserId="923" LastEditDate="2016-04-28T17:03:49.367" LastActivityDate="2016-04-28T17:03:49.367" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30419" PostTypeId="1" CreationDate="2016-04-28T02:36:37.943" Score="1" ViewCount="8792" Body="&lt;h1&gt;Flat Top Sampling&lt;/h1&gt;&#xA;&lt;p&gt;During transmission, noise is introduced at top of the transmission pulse which can be easily removed if the pulse is in the form of flat top. Here, the top of the samples are flat i.e. they have constant amplitude. Hence, it is called as flat top sampling or practical sampling. Flat top sampling makes use of sample and hold circuit.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xUPC4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xUPC4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Theoretically, the sampled signal can be obtained by convolution of rectangular pulse &lt;span class=&quot;math-container&quot;&gt;$p(t)$&lt;/span&gt; with ideally sampled signal say &lt;span class=&quot;math-container&quot;&gt;$y_\delta(t)$&lt;/span&gt;, i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y(t)=p(t)\star y_\delta(t)\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To get the sampled spectrum, consider Fourier transform on both sides for equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y\left[\omega\right]=\mathcal F\left\{p(t)\star y_\delta(t)\right\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By the knowledge of convolution property,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Y\left[\omega\right]=P(\omega)Y_\delta(\omega)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$P(\omega)=TS_a(\omega T_2)=2\sin \omega T/\omega$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h1&gt;My question&lt;/h1&gt;&#xA;&lt;p&gt;If the continue signal &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; is like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/atRv3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/atRv3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;It is a step shape wave. I sampled it by flat top sampling mentioned above. The rectangular pulse width is the same as the step width of &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt;. It is easy to find that the sampled signal is the same as the original signal. So the Fourier transform will not change before and after sampling. However, according the above equation &lt;span class=&quot;math-container&quot;&gt;$Y[\omega]=P(\omega)Y_\delta(\omega)$&lt;/span&gt;, the Fourier transform of the sampled signal is different from the original. &lt;strong&gt;What is going on?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="20282" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2016-04-28T12:18:11.580" Title="Flat top sampling to a step shape signal" Tags="|sampling|fourier|" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30421" PostTypeId="2" ParentId="30408" CreationDate="2016-04-28T07:13:10.647" Score="4" Body="&lt;p&gt;I've heard rumors of covert acoustic room impulse response measurement being done during concerts. You would need the people in the room if you want to use the impulse response for artificial reverberation and you don't want the room to sound overly echoey like there's no-one in it. As received at the microphone, the &lt;strong&gt;signal&lt;/strong&gt; would be a rather quiet noise-like test signal, and the music, the sounds from the people, and equipment noise would be the &lt;strong&gt;noise&lt;/strong&gt;. Because the impulse response is in practice only a few seconds long, a repetitive test signal can be used. The recording would be accumulated into a circular buffer. Because noise has on average zero correlation with what has already been recorded in the buffer, its root mean square amplitude will grow on average as &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; recording cycles, while the signal's root mean square amplitude will grow as &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. At the end of the session, deconvolution is used to get from the test signal response to the impulse response. For a spectrally flat test signal such as a maximum length sequence (MLS), it suffices to convolve with the reverse of the test signal. For a buffer of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; sample points the deconvolution gain is &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; for the signal and &lt;span class=&quot;math-container&quot;&gt;$\sqrt{M}$&lt;/span&gt; for the noise. Combining the gains from repetition and deconvolution and assuming a sampling frequency of 44.1 kHz, we get a recording time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; dependent dB-scale gain difference of &lt;span class=&quot;math-container&quot;&gt;$20\log_{10}\left(\frac{44.1\text{ kHz }\times\ t}{\sqrt{44.1\text{ kHz }\times\ t}}\right)$&lt;/span&gt; dB between the two:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UBNlo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UBNlo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;br&gt;&lt;em&gt;Figure 1. Signal-to-noise ratio (SNR) gain for room impulse response measurement as a function of recording time.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Guessing some numbers for an &amp;quot;easy&amp;quot; scenario, if we start with the signal at a sound pressure level (SPL) of 30 dB and the noise at 60 dB SPL which is a starting SNR of -30 dB, in 1 hour of recording we get a SNR of 52 dB, growing very slowly after that, by 10 dB for every 10-times increase of the recording time. 52 dB is already useful for artificial reverberation.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2021-04-30T09:22:01.313" LastActivityDate="2021-04-30T09:22:01.313" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30422" PostTypeId="2" ParentId="30415" CreationDate="2016-04-28T09:12:41.307" Score="0" Body="&lt;p&gt;&lt;strong&gt;Assumptions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The string is thin compared to the toy hanging from it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The string is oriented in up-down-direction in all frames.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proposed solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the row-sum of the binary image. This gives you a column vector that holds the number of foreground pixels of each row.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Analyze this vector, e.g. by simple thresholding, for a steep increase of foreground pixels.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This position is the position where the toy starts. Hence, you can neglect the corresponding upper part of the image, because it mainly contains the string.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-04-28T09:12:41.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30423" PostTypeId="2" ParentId="29882" CreationDate="2016-04-28T09:52:08.620" Score="1" Body="&lt;p&gt;Not familiar with Aquila in particular, and I don't see how you're mapping the output spectrum samples to an X-axis that ends at 800 Hz,  but remember that a real-only FFT mirrors its output data in the second half of the buffer.  You may need to run your loop from 0 to window_size/2 if Aquila's FFT is implemented the usual way.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That could account for a factor of 2x.  &lt;/p&gt;&#xA;" OwnerUserId="572" LastActivityDate="2016-04-28T09:52:08.620" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30424" PostTypeId="1" CreationDate="2016-04-28T10:08:01.990" Score="1" ViewCount="54" Body="&lt;p&gt;I am working on exact mathematical expression which can be obtained in image processing tasks.(I do not know much about image processing but my work is more mathmatical) In Gaussian scale space, we obtain the salient blob like structures in image by finding the extremum points in scale-normalized Laplacian of the image in the famous SIFT method. Can anyone give me reference to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) how can we represent this condition mathematically, for e.g. this will be the set of points given as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;S=\{s= (x,y,t): \text {s is the point of extremum of }\sigma^2 \nabla^2 L(x,y,t)  \}&#xA;$$&#xA;should I write it as:&#xA;$$&#xA;S=\{s= (x,y,t): \frac{d[ \sigma^2 \nabla^2 L(s)]}{ds}=0 \}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) How have we reached to the fact that extremum in scale-normalized laplacian will give us the salient blob like structures? I have read some papers e.g. Blostein and Ahuja and T lindeberg &quot;scale space theory in computer vision&quot;, where it is mentioned that you can use laplaican operator to obtain such features, but even in that paper I cannot find any mathmatical expression leading to such conclusion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you see paper like &quot;scale and differential structure of images&quot; by florack et. al., they have mathematically proven how we obtain Gaussian kernel in scale space. Why is there no such mathematical treatment of image features like salient blob detection in SIFT and edge detection in non-linear scale space by KAZE(where you use similar extrema for determinant of Hessian.). If there is, can someone give reference of the paper or book?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be very thankful if someone can answer this.&lt;/p&gt;&#xA;" OwnerUserId="20373" LastActivityDate="2016-04-28T10:08:01.990" Title="Analytical expression for salient Blob detection in scale space" Tags="|image-processing|gaussian|edge-detection|sift|scale-space|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30425" PostTypeId="1" AcceptedAnswerId="30428" CreationDate="2016-04-28T11:36:16.980" Score="8" ViewCount="3144" Body="&lt;p&gt;When applying Fourier transform in time domain the signal will be carried to frequency domain. And when we apply Fourier transform in spatial domain the signal will be carried to directivity domain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ D(\theta) = \sum\limits_{n = \frac{-N}{2}}^\frac{N}{2} v(n) \exp\left(\frac{j2\pi}{\lambda} nd \sin(\theta)\right)\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And let's simplify  $ d = \lambda / 2 $ so &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ D(\theta) = \sum\limits_{n = \frac{-N}{2}}^\frac{N}{2} v(n) \exp(j\pi n \sin(\theta))\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see the mathematically this is $\rm sinc$ if I take $v(n)$ as a rectangular window. I have no problem with the result. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;First $\sin(\theta) $ confuses me extremely  how does this $\sin$ performs within Euler's formula ? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Secondly I can understand clear in time domain - frequency relationship: $\exp\left(\frac{j2\pi}{T}t\right) $. From Euler's formula $\cos$ and $\sin$ waves are created every $\frac{t}{T} $ step from $0$ to $ 2\pi$.  I can not understand this when  I look at beamforming function above (formulas (1) and (2)). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And finally why result is in $\theta$ domain how that happened ? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="1629" LastEditDate="2016-05-18T15:43:07.077" LastActivityDate="2016-05-18T15:43:07.077" Title="Intuitive interpretation of Fourier transform in beamforming" Tags="|beamforming|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30426" PostTypeId="1" AcceptedAnswerId="30430" CreationDate="2016-04-28T11:53:40.580" Score="0" ViewCount="45" Body="&lt;p&gt;Currently I am using the &lt;code&gt;transformInPlace()&lt;/code&gt; method from &lt;a href=&quot;https://commons.apache.org/proper/commons-math/apidocs/src-html/org/apache/commons/math3/transform/FastFourierTransformer.html#line.214&quot; rel=&quot;nofollow&quot;&gt;here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for a project at university. &#xA;First of all I thought FFT would be the perfect solution for my problem, but&#xA;now I am not so sure anymore. &#xA;&lt;a href=&quot;http://se.informatik.uni-wuerzburg.de/tools/limbo&quot; rel=&quot;nofollow&quot;&gt;I have to alter a certain component of a software called LIMBO&lt;/a&gt;.&#xA;LIMBO is a load intensity modeling tool.&#xA;Every webpage has a trace that records the number of site views during a fixed period of time.&#xA;&lt;a href=&quot;http://se2.informatik.uni-wuerzburg.de/files/wikipedia_trace.txt&quot; rel=&quot;nofollow&quot;&gt;This leads to trace files like this data.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see lots of (time, arrivalRate(time)) pairs. This is all LIMBO gets as input.&#xA;The goal is to search for dominant periods within the noisy trace via the FFT.&#xA;The problem are the time values of the (time, arrivalRate(time)) pairs.&#xA;For a fixed time (for example 1 day) the page counts views. The total number of views than is&#xA;stored inside arrivalRate(time).&#xA;Then the page listens for another day in order to calculate the next arrivalRate(). This process is repeated&#xA;the whole time.&#xA;So, the time values inside the trace (for example 0.5,1.5,2.5) are not necessarily days (They  could be seconds, weeks or even months as well). They are abstract and depend on individual fixed listen period of every webpage mentioned above. (probably listen period  is called sampling frequency but I am not sure) &#xA;Therefore the information about the listen period of the page can not be retrieved out of the trace file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&#xA;  Is it a problem to know nothing about the listen period of the given page if I want to calculate and interpret dominant periods&#xA;after a FFT has been applied on the trace file?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example I use this formula to calculate $f_i $(the frequency of the $i$-th array position)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$i$: current position in the array&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$N$: length of the array&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$f_s$: the sampling frequency that is probably not revealed in the trace (so far I just used values like &quot;1&quot; or the median of all arrival rates in the trace)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$i = N f_i/f_s$   (so I use $1/f_i = {\rm period}_i = N/(f_s i)$ for calculating the $i$-th period)&lt;/p&gt;&#xA;" OwnerUserId="20761" LastEditorUserId="80" LastEditDate="2016-04-28T12:25:13.883" LastActivityDate="2016-04-28T13:28:40.193" Title="Do I need the sampling frequency in order to gain periods out of FFT?" Tags="|fft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30427" PostTypeId="1" AcceptedAnswerId="30429" CreationDate="2016-04-28T12:16:28.753" Score="1" ViewCount="3623" Body="&lt;p&gt;I'm developing an app that has an EQ &lt;a href=&quot;http://eq10q.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;using eq10q plugin&lt;/a&gt;. My eq has 10 bands. I'm using peaking filters for the middle bands and a low shelf filter for the first band and a high shelf filter for the last band. I calculated the Q factor for the middle bands by dividing the middle frequency by the bandwidth desired for that band but I don't know how to calculate the Q factor for the High Shelf filter and the Low Shelf Filter. How should I do it?&lt;/p&gt;&#xA;" OwnerUserId="20497" LastEditorUserId="4346" LastEditDate="2016-04-29T04:33:59.803" LastActivityDate="2016-04-29T04:33:59.803" Title="Calculate Q factor of a Low Shelf and High Shelf filter" Tags="|filters|equalizer|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30428" PostTypeId="2" ParentId="30425" CreationDate="2016-04-28T12:19:26.430" Score="8" Body="&lt;p&gt;The equations relate to how the directivity of a uniformly spaced linear array of sensors works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start with an array:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8fRcE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8fRcE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\theta$ is our &quot;look&quot; direction (where we want to steer the array), $d$ is the sensor spacing, and, for our purposes, the angles of each segment of the array are all 0 (i.e. $\theta_1 = \theta_2 = \ldots = 0$) so the array is in a straight line along the $x$ axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, the time at which the incoming wavefront hits each sensor, $t_j$ is:&#xA;$$&#xA;t_0 = 0\\&#xA;t_1 = d\sin(\theta)\\&#xA;t_2 = 2d\sin(\theta)\\&#xA;\vdots\\&#xA;t_j = jd\sin(\theta)\\&#xA;\vdots\\&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is that you delay each signal from each sensor by $t_j$, weight them by $v(j)$ and then sum them you'll get an array response like:&#xA;$$&#xA;a_{\rm tot}(t) = \sum_{j=0}^{N-1} v(j) \delta(t-t_j)&#xA;$$&#xA;in the time domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the frequency domain, this looks like:&#xA;$$&#xA;{\cal F}\left[a_{\rm tot}(t)\right] = A_{\rm tot}(f) = \sum_{j=0}^{N-1} v(j) e^{i2\pi f jd\sin(\theta)} \tag{A}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you now assume that the speed of the incoming waves is $c = f\lambda$ so that $f = \frac{c}{\lambda}$ we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A_{\rm tot}(\lambda ) = \sum_{j=0}^{N-1} v(j) e^{i2\pi \frac{c}{\lambda} jd\sin(\theta)} \\&#xA;= \sum_{j=0}^{N-1} v(j) e^{i\pi c j \sin(\theta)} &#xA;$$&#xA;if we assume that $\lambda = \frac{d}{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This last assumption means that now our $A_{\rm tot}$ is not dependent on the frequency variable, and just shows us how the array response changes with bearing angle, $\theta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, really, while the Fourier transform is used in this derivation, equations (1) and (2) in your question are not Fourier transforms themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't believe I've directly answered your questions, but feel free to comment and see if I can remove your doubts.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;if beamforming equations are not Fourier transforms why the result of a uniformly weighted beamformer is sinc function in $\theta$ domain just like Fourier transform ? And also does this means equation 11 in the paper is wrong &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.idiap.ch/~mccowan/arrays/tutorial.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;So equation 11 of that paper&lt;/a&gt; is the same as equation (A) in what I wrote above (I just added the tag).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, no, the equation is not wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dsprelated.com/freebooks/sasp/Rectangular_Window.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The reason there is a $\rm sinc$-like function is simply the maths of summing complex exponentials.&lt;/a&gt;  The function is actually not a $\rm sinc$ but a only like it for small values of the argument in the denominator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see from (4.5) in the link, it actually looks like:&#xA;$$&#xA;{\rm asinc(\omega)} = \frac{\sin(N\omega/2)}{\sin(\omega/2)} \approx \frac{\sin(N\omega/2)}{\omega/2} &#xA;$$&#xA;where the approximation only holds if $\omega/2$ is small.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But in the formula there is $\sin(\theta)$ instead of $\theta$ how $\sin$ affects this equation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As @Marcus says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;using $D(\theta)$ and calling it Fourier Transform is wrong; you could use $D(\sin(\theta))$ and get away with it :) &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This just means that the $\theta$ axis is scaled slightly differently and makes it more periodic. See the picture below which plots:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\require{color}\color{black}{\bf black}$ : $\rm sinc(\theta)$&lt;/li&gt;&#xA;&lt;li&gt;$\require{color}\color{red}{\bf red}$ : $\rm asinc(\theta)$, and&lt;/li&gt;&#xA;&lt;li&gt;$\require{color}\color{green}{\bf green}$ : $\rm asinc(\sin(\theta))$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m9fg4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m9fg4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 30425&#xA;&#xA;M &amp;lt;- 10&#xA;N &amp;lt;- 100&#xA;theta &amp;lt;- seq(-pi*5,pi*5,pi/N)&#xA;&#xA;sinc &amp;lt;- sin(M*theta/2) / (theta/2)&#xA;asinc &amp;lt;- sin(M*theta/2) / sin(theta/2)&#xA;asinctheta &amp;lt;- sin(M*sin(theta)/2) / sin(sin(theta)/2)&#xA;&#xA;plot(theta, sinc, col=1, type=&quot;l&quot;, lwd = 4)&#xA;lines(theta, asinc, col=2, lwd = 2)&#xA;lines(theta, asinctheta, col=3, lwd = 1)&#xA;&#xA;legend(-10, 10, c(&quot;sinc()&quot;, &quot;asinc&quot;,&quot;asinctheta&quot;), col=c(1,2,3), lwd = c(4,2,1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-28T15:03:03.260" LastActivityDate="2016-04-28T15:03:03.260" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30429" PostTypeId="2" ParentId="30427" CreationDate="2016-04-28T13:21:22.690" Score="3" Body="&lt;p&gt;it looks like this eq10q uses cascaded parametric EQs, initially set up to be bell, but switchable to other types (like shelving).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i wouldn't doubt that they're using the audio EQ cookbook.  if you're using that, there is a parameter called &lt;em&gt;&quot;shelf slope&quot;&lt;/em&gt; or $S$ that is often set to 1, because that gets you the steepest slope without dips or lips or bumps.  so it's a straight incline or decline to the shelf level.  if the control is $Q$, instead, there is a relationship between $S$ and $Q$: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \frac{1}{Q} = \sqrt{ \left( A + \frac{1}{A} \right) \left( \frac{1}{S} - 1 \right) + 2} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ A = 10^{dB_\text{gain}/40} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $ dB_\text{gain} $ is the shelf gain in dB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i would just plug in $S=1$ and get a $Q=\frac{1}{\sqrt{2}}$.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-04-28T13:21:22.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30430" PostTypeId="2" ParentId="30426" CreationDate="2016-04-28T13:28:40.193" Score="1" Body="&lt;p&gt;This is DSP – everything that defines time or frequency is only measurable with respect to your sample period; so without that, your FFT output is but a relative measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short: If you can live with giving information like &quot;events per sample period&quot;, then you're fine, if you need to say something about &quot;per hour&quot; or so, well, that information has to come from somewhere, and if you're not feeding in that information into your system, it can't have it.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-04-28T13:28:40.193" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30431" PostTypeId="2" ParentId="29882" CreationDate="2016-04-28T13:28:53.043" Score="1" Body="&lt;p&gt;Further to @user572's answer, the other 2x could be coming from the fact you are passing a real array to a complex FFT: &lt;code&gt;p_fft_interface-&amp;gt;fft(...)&lt;/code&gt;. Check the documentation for &lt;code&gt;p_fft_interface-&amp;gt;fft&lt;/code&gt; to make sure it's not treating your samples as pairs of real/imaginary components rather than just real.&lt;/p&gt;&#xA;" OwnerUserId="15030" LastEditorUserId="15030" LastEditDate="2016-04-28T13:36:50.243" LastActivityDate="2016-04-28T13:36:50.243" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30433" PostTypeId="2" ParentId="30425" CreationDate="2016-04-28T13:54:10.627" Score="3" Body="&lt;p&gt;If you consider the beam pattern for a linear array - so I'm looking at just the magnitude (or magnitude square) i.e. $|B(\theta)|$. Then the $\sin(\theta)$ is telling you how the response changes to different directions of arrival. There are few things to keep in mind:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There is the direction to which you steer the beam - these are the weights you use on the output of the antenna elements - in your examples you are steering the beam to broadside so the weights are just set to 1.&lt;/li&gt;&#xA;&lt;li&gt;There are the phase shifts (narrowband) when a incoming wave approaches at different angles $\theta$.&lt;/li&gt;&#xA;&lt;li&gt;When you steer (electronically not physically) to the direction of the incoming wave, the weights from that you use in 1 will be the complex conjugate of the phase that happens in 2 - phase delay of the wave due to different propagation time of the wave to each of the array elements.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So what this formula is telling you - for a linear array steered to broadside - the response to a wave coming from an angle $90^\circ +\theta$ (because of the way theta is defined) the response is given by $|B(\theta)|$. To see this consider a wave coming from broad-side ($\theta=0$). Then $\sin(0)=0$ and $e^{j0}=1$, so the output is just the sum of the receive elements. Thus, the sum of the array elements add coherently - the array has a maximum response in this direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a continuous array of length $L$ - if we add/integrate elements in pairs and the pairs are separated by $L/2$, then the propagation distance between those pairs is given by $\frac{L}{2}\sin \theta$ - when that distance is equal to half a wavelength ($\lambda/2$) then the sum of the two elements will be zero - this applies no matter where you start on the array. So in this case the output of the array is equal to zero - it is the first null of the beampattern. The null occurs when&#xA;$$ \frac{L}{2}\sin \theta = \frac{\lambda}{2}$$ or&#xA;$$\theta \approx \frac{\lambda}{L},$$&#xA;where I have assumed $\sin \theta \approx \theta$ for small $\theta$. The null on the other side will occur when $\theta =-\frac{\lambda}{L}$. So the null-null beamwidth of a linear array is $\theta_{BW}=\frac{2\lambda}{L}$. Note - for practical purposes the 3dB beamwidth is often used, so this is smaller than the null-null beamwidth and often a weighting window is applied to reduce the level of the sidelobes but at the cost of widening the main lobe, i.e. increasing the beamwidth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some books that have good introductions to these ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sonar Signal Processing (Richard Nielson) - deals with wideband sonar beamforming - approach is not overly mathematical, but the book may be hard to find.&lt;/li&gt;&#xA;&lt;li&gt;Array Signal Processing (Johnson, Dudgeon) - More of an engineering/DSP approach. Book is readily availble&lt;/li&gt;&#xA;&lt;li&gt;Introduction to Airborne Radar (Stimson) - This is more introductory and covers a lot of radar material - but it does explain beamforming in a hand wavy way.&lt;/li&gt;&#xA;&lt;li&gt;Beamforming: a versatile approach to spatial filtering (Van Veen, Buckley) IEEE Acoustics Speech and Signal Processing Magazine, April 1988 - This gets a bit more mathematical, but it's a tutorial like paper. Useful before going into more technical work.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2016-04-28T13:54:10.627" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30434" PostTypeId="1" CreationDate="2016-04-28T14:15:14.287" Score="0" ViewCount="358" Body="&lt;p&gt;I recently translated the code from &lt;code&gt;scipy.signal.bessel&lt;/code&gt; to &lt;code&gt;C&lt;/code&gt; in order to implement a bessel filter in a piece of analysis software I am working on. Everything went well, I was able to reproduce exactly the filter coefficients, and the filter has the right cutoff and produces numerically exact (ie, my &lt;code&gt;C&lt;/code&gt; implementation and the direct use of &lt;code&gt;scipy.signal.filtfilt&lt;/code&gt; agree numerically) results up until the cutoff frequency. After the cutoff frequency, though, the &lt;code&gt;C&lt;/code&gt; implementation levels off. The image below shows the comparison of the PSD after the two filters (200kHz cutoff, 8th order, forward then back filtered) are applied to the same signal (&lt;code&gt;x&lt;/code&gt; - frequency in $Hz$ - &lt;code&gt;y&lt;/code&gt; - amplitude in $pA^2/Hz$). Blue is my &lt;code&gt;C&lt;/code&gt; code, green is scipy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TnACe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TnACe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought was that it might be numerical noise. I use 64-bit doubles for everything in the &lt;code&gt;C&lt;/code&gt; code, and my first guess was that maybe the python implementation uses 128-bit doubles, since the point at which the python code levels off is suspiciously close to 1/2^106. But the &lt;code&gt;C&lt;/code&gt; code levels off well above 1/2^53, and none of my digging through scipy code suggests that they are using long doubles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possiblity is that in my C code implementation, I have not implemented Gustaffson's method to ensure that the forward and backward filtered results are the same, which is done in the python version. Could that be the source of the higher noise in high frequencies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what is happening? I am fairly confident that the filter is implemented correctly since it gives correct results up to the cutoff frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Numerically it hardly matters - leveling off at 1e-10 vs 1e-30 is irrelevent to the actual signals. I would just like to understand where the difference comes from.&lt;/p&gt;&#xA;" OwnerUserId="20090" LastEditorUserId="80" LastEditDate="2016-04-29T17:07:05.320" LastActivityDate="2016-04-29T17:07:05.320" Title="Translating Bessel filter from python to C - odd behavior past the cutoff frequency" Tags="|lowpass-filter|python|c|power-spectral-density|scipy|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30435" PostTypeId="1" CreationDate="2016-04-28T15:13:21.370" Score="4" ViewCount="11647" Body="&lt;p&gt;I understand that the question could mean a lot of things but I am thinking specifically to image processing. For example, I know that the mean can be a basic texture feature that represents the average pixel value of the image. That is, it is useful for determining an image background. Then I know that the standard deviation can be an indicator of how spread is the histogram and is useful for indicating what other pixel values also belong to the background. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In similar terms to this, what do Kurtosis and Skewness represent? I have read about them in various posts but I can't find anything related to what they represent in terms of what I have explained above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if I have came to the right place but if I haven't feel free to point me in the right direction.&lt;/p&gt;&#xA;" OwnerUserId="20734" LastEditorUserId="128" LastEditDate="2020-03-14T09:08:45.153" LastActivityDate="2020-03-14T09:08:45.153" Title="What Do Skewness and Kurtosis Represent?" Tags="|image-processing|probability|probability-distribution-function|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30436" PostTypeId="1" AcceptedAnswerId="30437" CreationDate="2016-04-28T15:57:35.810" Score="1" ViewCount="2356" Body="&lt;p&gt;The following paragraph from &lt;em&gt;Understanding Digital Signal Processing&lt;/em&gt; got me puzzled:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The answer is: The DFT phase at the frequency $mf_s/N$ is relative to a cosine&#xA;  wave at that same frequency of $mf_s/N$ Hz where $m = 1, 2, 3, ..., N−1$. For example, the phase of $X(1)$ is −90 degrees, so the input sinusoid whose frequency is $1\cdot f_s/N = 1000$ Hz was a cosine wave having an initial phase&#xA;  shift of −90 degrees.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have no idea how the DFT phase is related to a cosine wave in the way just mentioned above. Any hints would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="20709" LastEditorUserId="80" LastEditDate="2016-04-28T16:10:40.403" LastActivityDate="2017-12-05T10:34:13.023" Title="What does it mean for the DFT phase to be relative to a cosine wave?" Tags="|fourier-transform|dft|" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30437" PostTypeId="2" ParentId="30436" CreationDate="2016-04-28T16:26:38.227" Score="3" Body="&lt;p&gt;A cosine wave is an even function around the origin (X axis = 0).  The basis vectors of the real components of a DFT are all cosine waves that start at 1 at the first sample.  Imaginary components of DFT basis vectors are all sine waves that are odd functions around the origin 0, and start at zero at the first sample in a DFT window.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for strictly real input, you can add a phase offset p to a cosine wave function to make cosine(x+p) look like any ratio mix of real and imaginary basis vectors (cosine waves and sine waves) in the DFT result, and that phase offset is what this book is calling the DFT phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For even length FFTs of non-fictional data, I prefer to do an fftshift to move the phase reference to the middle of the FFT window, instead of leaving the phase reference at the potential circular discontinuity at the first sample of the DFT window.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-04-28T16:36:02.837" LastActivityDate="2016-04-28T16:36:02.837" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30438" PostTypeId="2" ParentId="30436" CreationDate="2016-04-28T16:48:12.260" Score="1" Body="&lt;p&gt;So let's assume you have a cosine wave:&#xA;$$&#xA;x_m(t) = \cos(2\pi m f_s t /N + \phi_m)&#xA;$$&#xA;which, after ideal sampling becomes&#xA;$$&#xA;x_m[n] = \cos(2\pi m n /N + \phi_m)&#xA;$$&#xA;Then, for $m=1$ we get&#xA;$$&#xA;x_1[n] = \cos(2\pi n/N + \phi_1)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the DFT of $x_1$ is:&#xA;$$&#xA;X_1[k] = \sum_{n=0}^{N-1} \cos(2\pi n/N + \phi_1) e^{-j2\pi nk/N }\\&#xA;=  \frac{1}{2}\sum_{n=0}^{N-1} \left [ e^{j(2\pi n/N + \phi_1)} + e^{-j(2\pi n/N + \phi_1)} \right]e^{-j2\pi nk/N }\\&#xA;= \left\{ &#xA;\begin{array}{lr}&#xA;0, &amp;amp; {\mbox{ for } k \not=1}\\&#xA; \frac{1}{2}\displaystyle \sum_{n=0}^{N-1} \left [ e^{j\phi_1} + e^{-j(4\pi n/N + \phi_1)} \right], &amp;amp; {\mbox{ for } k =1}&#xA;\end{array}&#xA;\right.&#xA;$$&#xA;So &#xA;$$&#xA;X[1] = \frac{N}{2} e^{j\phi_1} +  \frac{1}{2} \sum_{n=0}^{N-1}  e^{-j(4\pi n/N + \phi_1)}&#xA; = \frac{N}{2} e^{j\phi_1} +  e^{-j\phi_1} \frac{1}{2} \sum_{n=0}^{N-1}  e^{-j4\pi n/N }&#xA;$$&#xA;and the term&#xA;$$&#xA;\sum_{n=0}^{N-1}  e^{-j4\pi n/N } = \frac{1 - e^{-j4\pi} }{1 - e^{-j4\pi/N}} = 0&#xA;$$&#xA;so&#xA;$$&#xA;X[1] = \frac{N}{2} e^{j\phi_1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so a cosine wave of frequency $f_s/N$, having an initial phase shift of $\phi_1$, means that the argument (angle) of $X[1]$ is $\phi_1$.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-28T16:48:12.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30439" PostTypeId="2" ParentId="30435" CreationDate="2016-04-28T16:57:51.677" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.444.4861&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow&quot;&gt;This paper has a nice write up on those and many other measures.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For skewness:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In terms of digital image processing, Darker and&#xA;  glossier surfaces tend to be more positively skewed than&#xA;  lighter and matte surfaces. Hence we can use skewness in&#xA;  making judgements about image surfaces. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is because skewness measures how &quot;lopsided&quot; the distribution of pixel values are.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For kurtosis:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In digital image processing kurtosis values are&#xA;  interpreted in combination with noise and resolution&#xA;  measurement. High kurtosis values should go hand in&#xA;  hand with low noise and low resolution. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure I agree with this.  Images with moderate amounts of salt and pepper noise are likely to have a high kurtosis value.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-28T16:57:51.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30440" PostTypeId="2" ParentId="30435" CreationDate="2016-04-28T20:25:28.900" Score="2" Body="&lt;p&gt;Mean, standard deviation, skewness and kurtosis are based on geometrical moments of patches of images. Being homogeneous ratios, and generally centered,  skewness and kurtosis have the advantage of being invariant to affine luminance changes in images.  Based on degree $3$ and $4$ moments, they are sometimes termed &lt;a href=&quot;http://asp.eurasipjournals.springeropen.com/articles/10.1155/2007/47039&quot; rel=&quot;nofollow&quot;&gt;Higher-order-statistics&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding skewness, it was used to detect edges in dark objects on white background, having a sign change at luminance edges, and could replace, with some Gaussian prefiltering, a Laplacian, see &lt;a href=&quot;http://www.eurasip.org/Proceedings/Eusipco/Eusipco1994/EUSIPCO94_VolIII.pdf&quot; rel=&quot;nofollow&quot;&gt;Performance of the Skewness-of-Gaussian (SoG) edge extractor&lt;/a&gt;, Seventh European Signal Processing Conf. 1994.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kurtosis somehow detects if a distribution is flat or peaky, and later was associated to perceptual aspects of sparse coding. It is often considered as a measure a sparsity, and used in early deconvolution methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both have also been used on transformations of images: co-occurence matrices, wavelets, etc., to assess or provide parameters for selection, detection, clustering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find additional literature with &quot;Moment Functions&quot; in &quot;Image Analysis&quot;. Caveat: if pixel distributions are quite multimodal, such simple estimators do no say much.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-04-30T00:18:49.890" LastActivityDate="2016-04-30T00:18:49.890" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30441" PostTypeId="1" AcceptedAnswerId="30442" CreationDate="2016-04-28T20:30:15.447" Score="0" ViewCount="70" Body="&lt;p&gt;Back around 5 BC, where C stands for the programming language, engineers would photograph their oscilloscope's display to record their test results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This appears to be such a photograph, taken from this &lt;a href=&quot;https://en.wikipedia.org/wiki/Elliptic_filter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article&lt;/a&gt; on Elliptic filters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ixLvf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ixLvf.jpg&quot; alt=&quot;Photograph of a pole zero plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The photo is described as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Log of the absolute value of the gain of an 8th order elliptic filter in complex frequency space. The white spots are poles and the black spots are zeroes. There are a total of 16 poles and 8 double zeroes. What appears to be a single pole and zero near the transition region is actually four poles and two double zeroes as shown in the expanded view below. In this image, black corresponds to a gain of 0.0001 or less and white corresponds to a gain of 10 or more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen plots like this many times and always wondered how they were created. In other words, what methods and equipment were used to do this? They even show poles in the RHP, which doesn't make much sense.&lt;/p&gt;&#xA;" OwnerUserId="5108" LastActivityDate="2016-04-28T21:12:50.823" Title="How are these pole zero plots created" Tags="|filters|filter-design|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30442" PostTypeId="2" ParentId="30441" CreationDate="2016-04-28T21:12:50.823" Score="0" Body="&lt;p&gt;You can follow the links to the &lt;a href=&quot;https://commons.wikimedia.org/wiki/File:Elliptic_Filter_s-Plane_Response_(8th_Order).svg&quot; rel=&quot;nofollow&quot;&gt;Mathematica source code&lt;/a&gt;, copy-pasted here:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xp2[xi_] := &#xA;  Module[{g, num, den}, g = Sqrt[4*xi^2 + (4*xi^2*(xi^2 - 1))^(2/3)];&#xA;   num = 2*xi^2*Sqrt[g];&#xA;   den = Sqrt[8*xi^2*(xi^2 + 1) + 12*g*xi^2 - g^3] - Sqrt[g^3];&#xA;   num/den];&#xA;xz2[xi_] := xi^2/xp2[xi];&#xA;&#xA;t[xi_] := Sqrt[1 - 1/xi^2];&#xA;&#xA;(*Use particular values for low-order functions*)&#xA;r1[xi_, x_] := x;&#xA;r2[xi_, x_] := ((t[xi] + 1)*x^2 - 1)/((t[xi] - 1)*x^2 + 1);&#xA;r3[xi_, x_] := &#xA;  x*((1 - xp2[xi])*(x^2 - xz2[xi]))/((1 - xz2[xi])*(x^2 - xp2[xi]));&#xA;&#xA;(*Use nesting property for higher-degree functions*)&#xA;r4[xi_, x_] := r2[r2[xi, xi], r2[xi, x]];&#xA;r8[xi_, x_] := r4[r2[xi, xi], r2[xi, x]];&#xA;&#xA;ellgain[xi_, w_, w0_, ep_] := 1/Sqrt[1 + ep^2*r8[xi, w/w0]^2];&#xA;&#xA;DensityPlot[&#xA; w0 = 1;&#xA; ep = 0.5;&#xA; xi = 1.05;&#xA; min = 0.0001;&#xA; max = 10;&#xA;&#xA; Log[Abs[&#xA;   ellgain[xi, sig + I*w, w0*I, ep]&#xA;   ]],&#xA; {sig, -4, 4},&#xA; {w, -4, 4},&#xA; PlotRange -&amp;gt; {Log[min], Log[max]},&#xA; PlotPoints -&amp;gt; 100,&#xA; ColorFunction -&amp;gt; GrayLevel,&#xA; ClippingStyle -&amp;gt; {Black, White}&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-04-28T21:12:50.823" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30443" PostTypeId="1" CreationDate="2016-04-28T21:18:37.343" Score="0" ViewCount="221" Body="&lt;p&gt;I need to resize an image using &lt;strong&gt;bilinear interpolation&lt;/strong&gt; and create an image pyramid.&#xA;I will detect corners at the different levels of the pyramid and scale the pixel co-ordinates&#xA;so that they are relative to the dimensions of the largest image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a corner of an object is detected as a corner/keypoint/feature in all the levels,&#xA;after scaling the corresponding pixel coordinates from the different levels&#xA;so that they fall on the largest image, ideally I would like them to have the same value.&#xA;Thus when resizing the images, I am trying to be as accurate as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume I am resizing an image &lt;code&gt;L_n_minus_1&lt;/code&gt; to create a smaller image &lt;code&gt;L_n&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My scale factor is &lt;code&gt;ratio&lt;/code&gt; ( with &lt;code&gt;ratio&lt;/code&gt; &gt; 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can resize using the pseudocode below (which is what I generally find when I search online for resizing algorithms.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I cannot use any library&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int offset = 0;&#xA;for (int i = 0; i &amp;lt; height_of_L_n; i++){&#xA;    for (int j = 0; j &amp;lt; width_of_L_n; j++){&#xA;        //********* This part will differ in the later version I provided below **********&#xA;        //&#xA;        int xSrcInt = (int)(ratio * j);&#xA;        float xDiff = ratio * j - xSrcInt;&#xA;&#xA;        int ySrcInt = (int)(ratio * i);&#xA;        float yDiff = ratio * i - ySrcInt;&#xA;&#xA;        //********** The above code will differ in the later version I provided below **********&#xA;&#xA;        index = (ySrcInt * width_of_L_n_minus_1 + xSrcInt);&#xA;&#xA;        //Get the 4 pixel values to interpolate&#xA;        a = L_n_minus_1[index];&#xA;        b = L_n_minus_1[index + 1];&#xA;        c = L_n_minus_1[index + width_of_L_n_minus_1];&#xA;        d = L_n_minus_1[index + width_of_L_n_minus_1 + 1];&#xA;&#xA;        //Calculate the coefficients for interpolation&#xA;        float c0 = (1 - x_diff)*(1 - y_diff);&#xA;        float c1 = (x_diff)*(1 - y_diff);&#xA;        float c2 = (y_diff)*(1 - x_diff);&#xA;        float c3 = (x_diff*y_diff);&#xA;&#xA;        //half is added for rounding the pixel intensity.&#xA;        int intensity = (a*c0) + (b*c1) + (c*c2) + (d*c3) + 0.5;&#xA;&#xA;        if (intensity &amp;gt; 255)&#xA;            intensity = 255;&#xA;&#xA;        L_n[offset++] = intensity;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or I could use this modified piece of code below :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int offset = 0;&#xA;for (int i = 0; i &amp;lt; height_of_L_n; i++){&#xA;    for (int j = 0; j &amp;lt; width_of_L_n; j++){&#xA;&#xA;        //********* Here the code differs from the first piece of code **********&#xA;        // Assume pixel centers start from (0.5,0.5). The top left pixel has co-ordinate (0.5,0.5)&#xA;        // 0.5 is added to go to the co-ordinates where top left pixel has co-ordinate (0.5,0.5) &#xA;        // 0.5 is subtracted to go to the generally used co-ordinates where top left pixel has co-ordinate (0,0)&#xA;        // or in other words map the new co-ordinates to array indices&#xA;&#xA;        int xSrcInt = int((ratio * (j + 0.5)) - 0.5);&#xA;        float xDiff = (ratio * (j + 0.5)) - 0.5 - xSrcInt;&#xA;&#xA;        int ySrcInt = int((ratio * (i + 0.5)) - 0.5);&#xA;        float yDiff = (ratio * (i + 0.5)) - 0.5 - ySrcInt;&#xA;&#xA;        //********** Difference with previous code ends here ************&#xA;&#xA;        index = (ySrcInt * width_of_L_n_minus_1 + xSrcInt);&#xA;&#xA;        //Get the 4 pixel values to interpolate&#xA;        a = L_n_minus_1[index];&#xA;        b = L_n_minus_1[index + 1];&#xA;        c = L_n_minus_1[index + width_of_L_n_minus_1];&#xA;        d = L_n_minus_1[index + width_of_L_n_minus_1 + 1];&#xA;&#xA;        //Calculate the coefficients for interpolation&#xA;        float c0 = (1 - x_diff)*(1 - y_diff);&#xA;        float c1 = (x_diff)*(1 - y_diff);&#xA;        float c2 = (y_diff)*(1 - x_diff);&#xA;        float c3 = (x_diff*y_diff);&#xA;&#xA;        //half is added for rounding the pixel intensity.&#xA;        int intensity = (a*c0) + (b*c1) + (c*c2) + (d*c3) + 0.5;&#xA;&#xA;        if (intensity &amp;gt; 255)&#xA;            intensity = 255;&#xA;&#xA;        L_n[offset++] = intensity;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second piece of code was developed assuming pixel centers having co-ordinates like (0.5, 0.5) as they have in textures.&#xA;This way the top left pixel will have co-ordinate (0.5, 0.5).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume  a 2 by 2 pixel Destination Image is being resized from a 4 by 4 Source Image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first piece of code, it is assumed that the first pixel has co-ordinates (0,0), thus for example my ratio is 2. Then&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xSrcInt = (int)(0*2); // 0&#xA;ySrcInt = (int)(0*2); // 0&#xA;&#xA;xDiff = (0*2) - 0; // 0&#xA;yDiff = (0*2) - 0; // 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus effectively I will just be copying the first pixel value from the source, as &lt;code&gt;c0&lt;/code&gt; will be &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;c1&lt;/code&gt;,&lt;code&gt;c2&lt;/code&gt; and &lt;code&gt;c3&lt;/code&gt; will be &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the second piece of code I will get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xSrcInt = (int)((0.5*2) - 0.5); // 0;&#xA;ySrcInt = (int)((0.5*2) - 0.5); // 0;&#xA;&#xA;xDiff = ((0.5*2) - 0.5) - 0; // 0.5;&#xA;yDiff = ((0.5*2) - 0.5) - 0; // 0.5;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this case c0,c1,c2 and c3 will all be equal to 0.25. Thus I will be using the 4 pixels at the top left.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is any bug in my second piece of code. As far as visual results go they are working perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But yes I do seem to notice better alignment of keypoints with the second piece of code. But may be that's because I am judging with prejudice.&lt;/p&gt;&#xA;" OwnerUserId="20768" LastEditorUserId="80" LastEditDate="2016-04-29T12:40:39.170" LastActivityDate="2016-06-02T16:22:18.067" Title="Accurate Image Resizing" Tags="|image-processing|interpolation|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30444" PostTypeId="1" CreationDate="2016-04-28T21:33:26.223" Score="1" ViewCount="657" Body="&lt;p&gt;I'm currently working on rectifying a respiratory noisy signal shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l90XF.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l90XF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've already tried to filter the noise as you can see in the image below (full &lt;a href=&quot;https://drive.google.com/file/d/0B6dMKbuezqN7UTJNOWh6VUlSSXM/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;image&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xwOLd.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xwOLd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red one is the noisy signal whereas the blue one is the one got after applying the non-linear detrending:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dt_ecgl = detrend(ecgl);&#xA;opol = 6;&#xA;[p,s,mu] = polyfit(t,ecgnl,opol);&#xA;f_y = polyval(p,t,[],mu);&#xA;dt_ecgnl = ecgnl - f_y;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the green one is the reference signal (correct one) which I'm aiming to have as result of filtering. So my question is how can I acheive a better result? My goal is to have the blue and the green ones conbined (same exact shape) in other words how can I denoise such deformed signal in MATLAB or using any other platform?.&lt;/p&gt;&#xA;" OwnerUserId="4442" LastEditorUserId="13320" LastEditDate="2016-11-21T12:31:59.830" LastActivityDate="2017-09-17T20:45:09.557" Title="Noisy signal filtering MATLAB" Tags="|matlab|denoising|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30445" PostTypeId="2" ParentId="30306" CreationDate="2016-04-28T21:35:52.400" Score="2" Body="&lt;p&gt;If this is really what your input looks like then you should be able to handle this with the standard morphological image processing operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming foreground as white and background as black, it basically comes down to a morphological open with a big enough structure element to elide the tails. The only trouble is that doing so will not work given that the input has holes so large the lines in the body of the shape itself would also get nuked by the open operation. One way to handle this is to perform the open on the figure without holes and then put the holes back in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in C++ using OpenCV:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void Test()&#xA;{&#xA;&#xA;    Mat src_bw;&#xA;    cv::threshold(&#xA;        imread(&quot;some_file.png&quot;, CV_LOAD_IMAGE_GRAYSCALE), &#xA;        src_bw, 0, 255, &#xA;        CV_THRESH_BINARY | CV_THRESH_OTSU&#xA;    );&#xA;&#xA;    imshow(&quot;src_bw&quot;, src_bw);&#xA;&#xA;    // perform contour extraction using RETR_CCOMP i.e. we are assuming input doesn't have nested islands/holes just simple holes.&#xA;    std::vector&amp;lt;std::vector&amp;lt;Point&amp;gt; &amp;gt; contours;&#xA;    std::vector&amp;lt;Vec4i&amp;gt; hierarchy;&#xA;    findContours(src_bw.clone(), contours, hierarchy, RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));&#xA;&#xA;    // iterate over the contours, draw the top-level contours into &quot;blobs&quot;&#xA;    Mat blobs = Mat::zeros(src_bw.size(), CV_8U);&#xA;    for (int i = 0; i &amp;lt; contours.size(); i++)&#xA;        if (hierarchy[i][3] == -1) &#xA;            drawContours(blobs, contours, i, 255, CV_FILLED, 8, hierarchy, 0, Point());&#xA;&#xA;    imshow(&quot;blobs&quot;, blobs);&#xA;&#xA;    // do an 'open' on blobs which will remove the artifacts.&#xA;    auto shape = MORPH_ELLIPSE;&#xA;    Mat strel = getStructuringElement(MORPH_ELLIPSE, Size(5,5));&#xA;    Mat blobs_opened;&#xA;    morphologyEx(blobs, blobs_opened, MORPH_OPEN, strel);&#xA;    imshow(&quot;blobs_opened&quot;, blobs_opened);&#xA;&#xA;    // draw the holes back into the output&#xA;    Mat output = blobs_opened.clone();&#xA;    for (int i = 0; i &amp;lt; contours.size(); i++)&#xA;        if (hierarchy[i][3] != -1) {&#xA;            drawContours(output, contours, i, 0, CV_FILLED, 8, hierarchy, 0, Point());&#xA;        }&#xA;&#xA;    imshow(&quot;output&quot;, output);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;yielding the following:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/5svBS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5svBS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20685" LastEditorUserId="20685" LastEditDate="2016-05-06T15:15:17.810" LastActivityDate="2016-05-06T15:15:17.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30447" PostTypeId="1" CreationDate="2016-04-28T23:16:40.350" Score="0" ViewCount="43" Body="&lt;p&gt;I would like to create a set of audio samples for playback as a midi-controlled instrument. Thus: a sample for every key of the piano range, with multiple volume timbres for each note. I am able to create recordings at various specifications. My problem is finding a specification as to how a sample set is packaged so that it can be used by a standard DAW. Searching so far has not turned up any leads. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a appropriate in another forum to try, I'd be happy to learn of it.&lt;/p&gt;&#xA;" OwnerUserId="15285" LastActivityDate="2016-04-29T09:49:09.227" Title="Specs for creating sample set?" Tags="|audio|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30448" PostTypeId="1" CreationDate="2016-04-29T00:57:16.097" Score="0" ViewCount="258" Body="&lt;p&gt;I hope this isn't such a dumb question, but I'm finally getting to grips with the inner workings of the DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm having trouble understanding is why the basis complex sinusoids in the &quot;forward&quot; DFT are conjugated, and why the inverse DFT uses non-conjugated complex sinusoids. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've written a script in MATLAB that attempts to implement what I understand about the DFT (not FFT, I know a fast function for that already exists). I notice that based on this conjugation issue I'm having, when I run a real sinusoid of some frequency through my DFT script, then perform the inverse part I get back the original sinusoid but at what looks like a quarter cycle out of phase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone clarify what's going on for me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(here's my MATLAB code snippet):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%% setup a test sinusoid&#xA;Fs = 44100;&#xA;freq = 440.0;&#xA;amp = 1.0;&#xA;&#xA;% setup col signal vector&#xA;x = generate_sine(freq, 0, amp, Fs, Fs);&#xA;&#xA;% set length of DFT (# of bins/frequency resolution)&#xA;N = 2^13;&#xA;&#xA;% get bin resolution from sampling frequency: acts as&#xA;% a Kth test frequency multiplier for DFTs shorter than&#xA;% the sampling frequency&#xA;bin_width = Fs/N;&#xA;&#xA;% truncate length of input signal to size of DFT (bins)&#xA;x(N+1:end) = [];&#xA;&#xA;% plot original, truncated signal&#xA;figure(1)&#xA;subplot(3,1,1)&#xA;title('original signal')&#xA;stem(x, '.');&#xA;&#xA;%% perform DFT using N test sinusoids (bins)&#xA;% This for loop represents the summation process of the DFT.&#xA;%   -i is an iterator where:&#xA;%       } i = 0 frequency = DC,&#xA;%       } and i &amp;gt; 0 = Kth sinusoid frequency&#xA;%   -in each loop iteration a new test complex sinusoid is&#xA;%    generated based on i iterator which is used a the &#xA;%    frequency number.&#xA;%   -in each loop iteration the dot product of the current test &#xA;%    sinusoid is taken, then stored in a vector of frequency bins&#xA;for i = 0: N-1&#xA;&#xA;    % set current test frequency (Kth frequency)&#xA;    k = bin_width * i;&#xA;&#xA;    % generate a complex sinusoid vector&#xA;    cp_sin = complex(generate_sine(k, 0, 1, Fs, N) / (N/2), generate_sine(k, pi/2, 1, Fs, N) / (N/2));     &#xA;&#xA;    % store dot product result in bin number i&#xA;    bins(i+1) = dot(cp_sin,x);&#xA;    bins = bins.';&#xA;end&#xA;&#xA;% plot DFT result&#xA;subplot(3,1,2)&#xA;title('DFT')&#xA;plot(abs(bins));&#xA;xlim([0 N/2]);&#xA;&#xA;%% perform inverse DFT&#xA;for i = 0:N-1&#xA;&#xA;    % set current test frequency (Kth frequency)&#xA;    k = bin_width * i;&#xA;&#xA;    % generate a sinusoid&#xA;    cp_sin = complex(generate_sine(k, 0, 1, Fs, N) * (N/2), generate_sine(k, pi/2, 1, Fs, N) * (N/2)); &#xA;&#xA;    % perform inverse transform to get original signal back&#xA;    xi(i+1) = (dot(bins,cp_sin))/N;&#xA;    xi = xi.';&#xA;end&#xA;&#xA;&#xA;%% plot inverse DFT result&#xA;subplot(3,1,3)&#xA;title('IDFT')&#xA;stem(real(xi), '.');&#xA;ylim([-1 1]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20772" LastEditorUserId="20772" LastEditDate="2016-04-29T04:35:07.150" LastActivityDate="2016-04-29T11:46:07.030" Title="Complex Conjugate Sinusoids in Forward DFT" Tags="|dft|transform|fourier|conjugate|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30449" PostTypeId="1" CreationDate="2016-04-29T01:33:26.723" Score="0" ViewCount="157" Body="&lt;p&gt;I am employing audio signals generated by a mechanical press for Blind Signal Separation. But, prior to algorithm application, I need to clarify if the signal strengths coming in multipath (except direct path) are significant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, I would like to use the four microphone recordings of audio generated by this press for this task. However, if it's difficult or impractical I am interested in trying out other methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="11712" LastActivityDate="2019-01-02T17:01:35.317" Title="I want to know if there is a practical way to find out if multipath propagation is significant for audio in a given environment?" Tags="|audio|multipath|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30450" PostTypeId="2" ParentId="30448" CreationDate="2016-04-29T02:08:13.470" Score="1" Body="&lt;p&gt;Really the DFT is just the &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Dot_product&quot; rel=&quot;nofollow&quot;&gt;inner product&lt;/a&gt; of your signal with complex exponentially of various frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the inner product of complex vectors requires taking the complex conjugate.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Reading your code, I do not believe this is correct:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cp_sin = complex(generate_sine(k, 0, 1, Fs, N) / (N/2), generate_sine(k, pi/2, 1, Fs, N) / (N/2));     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;shouldn't it make a complex conjugate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cp_sin = complex(generate_sine(k, 0, 1, Fs, N) / (N/2), -generate_sine(k, pi/2, 1, Fs, N) / (N/2));     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where I've placed a &quot;-&quot; in front of the second &lt;code&gt;generate_sine&lt;/code&gt; call.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, can you let us know what the arguments to &lt;code&gt;generate_sine&lt;/code&gt; do. I'm not sure what the third and fourth arguments achieve?&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-04-29T11:46:07.030" LastActivityDate="2016-04-29T11:46:07.030" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30451" PostTypeId="1" CreationDate="2016-04-29T04:21:20.257" Score="3" ViewCount="506" Body="&lt;p&gt;I am looking for &lt;strong&gt;comparing a signal&lt;/strong&gt; (256 / 512 point discrete | non-periodic ) (obtained after extracting some features from the captured image) with a database of around 5000 signals (256 /512 point discrete | non-periodic)(constructed with the same features as the one in the image). The features are angles and distances from an image captured. The signal is constructed by taking &lt;strong&gt;angular value on the x-axis&lt;/strong&gt; and the &lt;strong&gt;corresponding radial distance&lt;/strong&gt; on the y-axis (amplitude). See the two images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YvQuM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YvQuM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image has &lt;strong&gt;15 non-zero&lt;/strong&gt; points and can be considered as one of the 5000 entries in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second image - signal acquired:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Joqp9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Joqp9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This image is that of the signal acquired and as can be seen it has &lt;strong&gt;12 non-zero&lt;/strong&gt; points in the signal. This is actually the corresponding signal of the first image but with some missing points and some variations in the amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is just a &lt;strong&gt;example of one of the entries of the database&lt;/strong&gt; containing 15 non-zeroes and the acquired signal containing 12 non-zeroes. There can be many entries in the database containing the same number of non-zeroes, but the positioning of the non-zeroes will, of course, be different. The number of non-zeroes in a particular entry of the database varies from 5 to 50.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider this as a signal to be compared. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two bottlenecks - Firstly, the acquired signal contains &lt;strong&gt;missing points&lt;/strong&gt; from its corresponding signal in the database. The missing points can be very high sometimes. This can be viewed as the &lt;strong&gt;correlation&lt;/strong&gt; between two signals can drop from &lt;strong&gt;1 to 0.5 sometimes&lt;/strong&gt;. Still I can apply correlation and look for the correct signal match. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, here comes the &lt;strong&gt;second bottleneck&lt;/strong&gt; and that is I do &lt;strong&gt;not&lt;/strong&gt; want to correlate the acquired signal with &lt;strong&gt;each and every entry of the database&lt;/strong&gt; (because it takes a huge amount of time). Instead, I want to &lt;strong&gt;shortlist&lt;/strong&gt; some entries first based on some &lt;strong&gt;feature&lt;/strong&gt; that can be calculated from the signal. This feature can be &lt;strong&gt;mean, variance, standard deviation, 3 dB bandwidth,&lt;/strong&gt; etc. However, this feature must be something that does not vary much in the case that some points are missed as I stated earlier. I also thought of applying FFT on the signal and using some feature such as mean of the absolute value, phase information, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually, I have tried &lt;strong&gt;mean, variance, std, power bandwidth, mean of the absolute value of FFT&lt;/strong&gt;. However, the change is quite drastic and I cannot shortlist to a small number (by small number I mean around 1000). At the same time, as I mentioned earlier, the &lt;strong&gt;correlation also drops quite drastically&lt;/strong&gt; in some cases thus failing to find a match. Do you have any suggestions on how to go about for this problem of comparison when the acquired signal has missing points from the corresponding database signal? Any idea is appreciated! Thanks!&lt;/p&gt;&#xA;" OwnerUserId="20774" LastEditorUserId="20774" LastEditDate="2016-05-10T03:43:02.007" LastActivityDate="2017-03-18T04:25:59.570" Title="Features of a non-periodic signal for comparison" Tags="|fft|discrete-signals|cross-correlation|statistics|" AnswerCount="2" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30452" PostTypeId="1" CreationDate="2016-04-29T05:34:53.153" Score="0" ViewCount="196" Body="&lt;p&gt;I'm working on signal filtering in MATLAB. i wrote sample code that generate 50 Hz signal with some noisy frequency and use Kaiser bandpass filter to get only 50Hz frequency. this code work great! but there is a big problem!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sample Rate is 2000 Hz&lt;/strong&gt; and &lt;strong&gt;Filter Order is about 39000&lt;/strong&gt; , and my &lt;strong&gt;signal length is 50000 samples&lt;/strong&gt;! in other hand i have to &lt;strong&gt;wait about 25 seconds&lt;/strong&gt; to gathering my signal! that is too long time!, if i decrease signal length ( to about 6000 samples ) filter result is so noisy because of filter order. if i decrease filter order , filter signal result is too noisy too! the best time that i cloud wait for gathering data is about 3 seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;is there any way to get same result with 6000 samples of signal and high order filter? ( 39000 )&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thanks.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Fs = 2000;                    % Sampling frequency&#xA;T = 1/Fs;                     % Sample time&#xA;L = 50000;                     % Length of signal&#xA;t = (0:L-1)*T;                % Time vector&#xA;&#xA;Hd =  KAISERFilter;&#xA;&#xA;for i=1:50&#xA;&#xA;a = 5;&#xA;b = 500;&#xA;r1 = a + (b-a).*rand(1,1);&#xA;r2 = a + (b-a).*rand(1,1);&#xA;r3 = a + (b-a).*rand(1,1);&#xA;r4 = a + (b-a).*rand(1,1);&#xA;&#xA;n = r1 *sin(2*pi*49.2*t) + r2 *sin(2*pi*50.5*t) + 0.1 * randn(size(t)) +  r3 *sin(2*pi*15.5*t) +  r4 *sin(2*pi*110*t) ;&#xA;x = 30 *sin(2*pi*50*t); % main frequency&#xA;y = x+n;&#xA;&#xA;&#xA;subplot(2,1,1);&#xA;plot(y)&#xA;title('Signal')&#xA;xlabel('time (milliseconds)');&#xA;&#xA;yf = filter(Hd.Numerator,1,y);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and Kaiser filter code is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function Hd = KieserFilter&#xA;&#xA;% All frequency values are in Hz.&#xA;Fs = 2000;  % Sampling Frequency&#xA;&#xA;Fstop1 = 49.5;              % First Stopband Frequency&#xA;Fpass1 = 49.9;            % First Passband Frequency&#xA;Fpass2 = 50.1;            % Second Passband Frequency&#xA;Fstop2 = 50.5;              % Second Stopband Frequency&#xA;Dstop1 = 1e-06;           % First Stopband Attenuation&#xA;Dpass  = 0.057501127785;  % Passband Ripple&#xA;Dstop2 = 1e-06;           % Second Stopband Attenuation&#xA;flag   = 'scale';         % Sampling Flag&#xA;&#xA;% Calculate the order from the parameters using KAISERORD.&#xA;[N,Wn,BETA,TYPE] = kaiserord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 ...&#xA;                             1 0], [Dstop1 Dpass Dstop2]);&#xA;&#xA;% Calculate the coefficients using the FIR1 function.&#xA;b  = fir1(N, Wn, TYPE, kaiser(N+1, BETA), flag);&#xA;Hd = dfilt.dffir(b);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M40BF.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M40BF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="17187" LastActivityDate="2019-07-08T14:03:12.653" Title="Bandpass Filter Order vs Sample Numbers of Noisy Signal" Tags="|matlab|filters|bandpass|window|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30453" PostTypeId="2" ParentId="30452" CreationDate="2016-04-29T06:35:02.617" Score="1" Body="&lt;p&gt;You are dealing with a time frequency uncertainty in estimation problem.  It takes longer than 3 seconds for there to be enough information in a signal to tell the difference between 3 clearly separated sinewaves between 49 and 51 Hz, and only 1 fat (slightly modulated) one.  And you can't filter out a signal unless there is enough information to tell whether it's even there or not.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-04-29T06:35:02.617" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30454" PostTypeId="2" ParentId="30449" CreationDate="2016-04-29T07:14:29.400" Score="1" Body="&lt;p&gt;Never done this but it might work. Record the audio simultaneously using multiple microphones located in the neighborhood of your main recording position. If the cross-correlations between signals from different pairs of microphones show peaks at different time lags than the autocorrelation, then there must be either multiple sources or multiple paths. Be careful not to confuse multiple paths with reflections from the microphone bodies.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-10-13T09:25:56.600" LastActivityDate="2016-10-13T09:25:56.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30455" PostTypeId="2" ParentId="30449" CreationDate="2016-04-29T07:59:52.657" Score="0" Body="&lt;p&gt;For your problem I think you need the impulse response of the environment in which you want to work. the main(maximum) value in impulse response corresponds to the direct path and rest will be corresponding to mutipaths.                                         for calculating impulse response you can use adaptive filters using your audio as reference and microphone recorded signal/s as input. the weights of adaptive filter(after convergence) will roughly give you the impulse response shape.&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-04-29T07:59:52.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30456" PostTypeId="1" CreationDate="2016-04-29T08:20:48.760" Score="2" ViewCount="1914" Body="&lt;p&gt;I'm working on filtering accelerometer XYZ data. The aim is gait-pattern recognition via finding characteristic frequency points and feeding these to a artificial neural network. The trouble is, and commonly seems to be so, filtering out a massive DC component (a strong peak at 0 Hz) in the power-vs-frequency domain, which overshadows higher frequency components. I'm working with Octave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In literature, the typical approach is to gather accelerometer XYZ data, smooth some noise jitter with a sliding-window-average, apply a 4th order Butterworth highpass (at 0.9 Hz cutoff) and then take an Euclidean sum of the individual processed components (XYZ that is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, whatever I try, there is always a strong peak centered at 0 Hz. Trying has included:&#xA;1) Subtracting mean of raw data (x=x-mean(x), for all channels)&#xA;2) Various orders of Butterworth on individual channels before the Euclidean sum, in various settings&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What did get rid of the strong 0 Hz peak was applying the Butterworth filter on the Euclidean sum of XYZ channels. The characteristic 2 Hz gait peak remains and some higher order frequencies are amplified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; is there anything fundamentally wrong in filtering the XYZ data &lt;em&gt;after&lt;/em&gt; the Euclidean sum? Or: is this correct? Or: what is happening, why is the 0 Hz peak not getting filtered with individual-channel filtering (that would be a hint at something non-distributive).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some plots:&#xA;Raw XYZ accelerometer data&#xA;&lt;a href=&quot;http://www.hot.ee/jaaniussikesed/rawdataxyz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Raw XYZ accelerometer data http://www.hot.ee/jaaniussikesed/rawdataxyz.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data with very slight sliding window average (pretty much raw)&#xA;&lt;a href=&quot;http://www.hot.ee/jaaniussikesed/walk_xyz_nf_fft.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Data with very slight sliding window average (pretty much raw) http://www.hot.ee/jaaniussikesed/walk_xyz_nf_fft.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4th order Butterworth, cutoff at about 1 Hz, on individual XYZ before Euclidean sum&#xA;&lt;a href=&quot;http://www.hot.ee/jaaniussikesed/walk_xyz_f_fft.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;4th order Butterworth, cutoff at about 1 Hz, on individual XYZ before Euclidean sum http://www.hot.ee/jaaniussikesed/walk_xyz_f_fft.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4th order Butterworth, cutoff at about 1 Hz, taken on a Euclidean sum of XYZ accelerometer data. Notice no 0 Hz peak.&#xA;&lt;a href=&quot;http://www.hot.ee/jaaniussikesed/walk_euc_f_fft.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;4th order Butterworth, cutoff at about 1 Hz, taken on data after Euclidean sum of XYZ http://www.hot.ee/jaaniussikesed/walk_euc_f_fft.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4th order Butterworth filter frequency response:&#xA;&lt;a href=&quot;http://www.hot.ee/jaaniussikesed/frq_response.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;4th order Butterworth filter frequency response http://www.hot.ee/jaaniussikesed/frq_response.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some data-data:&#xA;Samples: 1112&#xA;Sample rate: 84 samp/s&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Butterworth implementation in Octave:&#xA;&lt;code&gt;&#xA;Fc= 0.5; #Cutoff frequency in Hz&#xA;Wcn=Fc/(srate/2); #Normalized cutoff frequency&#xA;order=4; #Order of filter&#xA;[B,A]=butter(order,Wcn,&quot;high&quot;); #Define Butterworth highpass filter&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note1: changing the cutoff frequency between 0.1-1 does not really change the picture.&#xA;Note2: there have been quite many posts on a very similar problem, but they all have their nuances, as does this I believe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for any help or/and advice!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT1:&#xA;Here is the code (running Octave 4.0.0, packages: control, data-smoothing, optim, signal, struct):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Load data&#xA;load(&quot;ID:walk-2016-05-02T22:58:23+02:00.mat&quot;);&#xA;&#xA;# Separate XYZ and clip&#xA;clipc=300;&#xA;ax=datamat(clipc:(end-clipc),1);&#xA;ay=datamat(clipc:(end-clipc),2);&#xA;az=datamat(clipc:(end-clipc),3);&#xA;&#xA;srate=floor(srate); #sample rate&#xA;&#xA;# Design filter&#xA;pkg load all&#xA;Fc= 1; #Cutoff frequency in Hz&#xA;Wcn=Fc/(srate/2); #Normalized cutoff frequency, srate (sample rate) loaded from file&#xA;order=4; #Order of filter&#xA;[B,A]=butter(order,Wcn,&quot;high&quot;);&#xA;&#xA;# Apply filter&#xA;axf=filtfilt(B,A,ax);&#xA;ayf=filtfilt(B,A,ay);&#xA;azf=filtfilt(B,A,az);&#xA;&#xA;#Euclidean norm&#xA;afen=(axf.^2+ayf.^2+azf.^2).^(1/2);&#xA;&#xA;#FFT&#xA;N_fft=2^13; #Frequency sample points, empirical&#xA;afft=fft(afen,N_fft); #Centered double sided FFT&#xA;freqpwr=afft.*conj(afft)/(N_fft*rows(afft)); #Power of each frequency spectrum component&#xA;freqpoints=srate*(0:N_fft/2-1)/N_fft; #Bins/points of FFT frequency axis&#xA;&#xA;#Plot power spectral density&#xA;plot(freqpoints,freqpwr(1:N_fft/2));&#xA;title(&quot;One Sided Power Spectral Density&quot;);       &#xA;xlabel(&quot;Frequency (Hz)&quot;);&#xA;ylabel(&quot;Power spectral density&quot;);&#xA;&#xA;fprintf(&quot;Program paused. Press enter to continue.\n&quot;);&#xA;pause;&#xA;close;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.hot.ee/jaaniussikesed/pythzepf_accel_datafile.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link to data file&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="20777" LastEditorUserId="20777" LastEditDate="2016-05-02T22:31:37.990" LastActivityDate="2016-05-02T22:31:37.990" Title="DC component in accelerometer data - filter before or after XYZ Euclidean sum" Tags="|fft|butterworth|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30457" PostTypeId="2" ParentId="30447" CreationDate="2016-04-29T09:49:09.227" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/SoundFont&quot; rel=&quot;nofollow&quot;&gt;SoundFont 2.0&lt;/a&gt; (SF2) sampled sound banks can be used in any digital audio workstation (DAW) software either natively or via a plug-in virtual instrument. It is an old format from the 16-bit Sound Blaster days but still widely supported, and satisfies your requirements of having key and velocity ranges. More recently there is the &lt;a href=&quot;http://ariaengine.com/overview/sfz-format/&quot; rel=&quot;nofollow&quot;&gt;SFZ&lt;/a&gt; file format that is manually editable as a text file. You tell in the SFZ file which WAV files are to be used and how. There are also SF2 and SFZ editors and SF2→SFZ converters available.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastActivityDate="2016-04-29T09:49:09.227" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30458" PostTypeId="2" ParentId="30456" CreationDate="2016-04-29T10:30:46.010" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I notice that after the butterworth filtering the high frequency components are attenuated. That suggests that somehow you are actually low pass filtering. There might be a mistake in your code.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A sliding window averaging is a crude low pass filter. Therefore, given that you have both a low pass filter (window averaging) and a high pass filter, you might try combining both operations by using a band pass filter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You have to remove the DC offset from each channel before taking the magnitude (euclidean sum).  Consider a simple example - the offsets are $[1,2,3]$ and the actual acceleration vector is $[1,1,0]$. The combined magnitude is $\sqrt{(1+3)^2 + (1+2)^2 + (0+3)^2} = \sqrt{34}$. But if the values for two axes were flipped, say $[1,0,1]$, you would get  $\sqrt{(1+3)^2 + (0+2)^2 + (3+1)^2} = \sqrt{36}$. Ideally the magnitude should be invariant to rotation of the axes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-04-29T10:30:46.010" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30459" PostTypeId="2" ParentId="30443" CreationDate="2016-04-29T13:04:47.113" Score="1" Body="&lt;p&gt;If you've described the outcome correctly, the I believe the second approach is sounder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first approach will cause aliasing artifacts, because it is just copying one of the four pixels into &lt;code&gt;Ln&lt;/code&gt; from &lt;code&gt;Ln_minus_1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second approach will effectively low pass filter &lt;code&gt;Ln&lt;/code&gt; by averaging the four pixels from &lt;code&gt;Ln_minus_1&lt;/code&gt; into the one pixel of &lt;code&gt;Ln&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made an attempt to simulate this in the graph below. The images are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Top Left: The original &lt;code&gt;Ln_minus_1&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Top Right: &lt;code&gt;Ln&lt;/code&gt; taking one lot of pixels, using the first code.&lt;/li&gt;&#xA;&lt;li&gt;Bottom Left:&lt;code&gt;Ln&lt;/code&gt; taking another lot of pixels, using the first code.&lt;/li&gt;&#xA;&lt;li&gt;Bottom Right: &lt;code&gt;Ln&lt;/code&gt; using the second code.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that I've added reference pixels in the diagonally opposite corners so that you can see the effect of the averaging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/L3Dv1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/L3Dv1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30443&#xA;&#xA;N &amp;lt;- 10&#xA;&#xA;Ln_minus_1 &amp;lt;- rep(1,N*N)&#xA;dim(Ln_minus_1) &amp;lt;- c(N,N)&#xA;&#xA;for (j in seq(1,N))&#xA;{&#xA;  for (k in seq(1,N))&#xA;  {&#xA;    Ln_minus_1[j,k] = (j + k) %% 2 &#xA;  }&#xA;}&#xA;&#xA;Ln &amp;lt;- rep(1,N*N/4)&#xA;dim(Ln) &amp;lt;- c(N/2,N/2)&#xA;&#xA;Ln2 &amp;lt;- rep(1,N*N/4)&#xA;dim(Ln2) &amp;lt;- c(N/2,N/2)&#xA;&#xA;Ln3 &amp;lt;- rep(1,N*N/4)&#xA;dim(Ln3) &amp;lt;- c(N/2,N/2)&#xA;&#xA;for (j in seq(1,N/2))&#xA;{&#xA;  for (k in seq(1,N/2))&#xA;  {&#xA;    Ln[j,k] = Ln_minus_1[2*j,2*k]&#xA;    Ln2[j,k] = Ln_minus_1[2*j-1,2*k]&#xA;    Ln3[j,k] = (Ln_minus_1[2*j,2*k] + Ln_minus_1[2*j-1,2*k-1] + Ln_minus_1[2*j,2*k-1] +Ln_minus_1[2*j-1,2*k] )/4&#xA;  }&#xA;}&#xA;&#xA;par(mfrow=c(2,2), pty='s')&#xA;image(Ln_minus_1)&#xA;title('Ln_minus_1')&#xA;&#xA;Ln[1,1] &amp;lt;- 0&#xA;Ln[N/2,N/2] &amp;lt;- 1&#xA;image(Ln) &#xA;title('Ln no averaging v 1')&#xA;&#xA;Ln2[1,1] &amp;lt;- 0&#xA;Ln2[N/2,N/2] &amp;lt;- 1&#xA;image(Ln2)&#xA;title('Ln no averaging v 2')&#xA;&#xA;Ln3[1,1] &amp;lt;- 0&#xA;Ln3[N/2,N/2] &amp;lt;- 1&#xA;image(Ln3)&#xA;title('Ln with averaging')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-29T13:04:47.113" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30461" PostTypeId="1" CreationDate="2016-04-29T13:48:28.797" Score="2" ViewCount="1942" Body="&lt;p&gt;I have to calculate time delay between two signals.I am using the GCC-PHAT method. First, I cut the signals into smaller parts (~0.5s) and then try to calculate the delay. When I display those two signals on the graph, the delay is very obvious. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that for some parts of that long signal, my program calculates the correct delay, but for some parts the delay is totally incorrect. In both cases, when I display those two signals on the graph, the delay seems very obvious.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relevant code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;duration=20000&#xA;a=hanning(duration+1)&#xA;[signal1,Fs] = audioread(mic1);&#xA;[signal2,Fs] = audioread(mic2);&#xA;&#xA;start=1000;&#xA;stop=start+duration;&#xA;x1=[a.*signal1(start:stop)];&#xA;x2=[a.*signal2(start:stop)];&#xA;&#xA;A=fft(x1);&#xA;B=fft(x2);&#xA;&#xA;PHAT=A.*conj(B)./(abs((A).*conj(B)));   &#xA;result=abs(ifft(PHAT)); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Examples:&#xA;1) Correct result:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Av9Sd.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Av9Sd.jpg&quot; alt=&quot;Cross correlation result and corresponding signals&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)Incorrect result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iYtgH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iYtgH.jpg&quot; alt=&quot;Cross correlation result and corresponding signals&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recorded those signals in a closed room, so there are probably also reverberations.&#xA;Am I doing something wrong? Or is this method just not very effective in my circumstances?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tried to prefilter signals, but the results were the same.&#xA;There is also no improvement, if I change the length of the signals.&lt;/p&gt;&#xA;" OwnerUserId="20778" LastActivityDate="2019-05-08T16:58:02.740" Title="Problem with Generalized Cross Correlation (PHAT filter)" Tags="|matlab|audio|cross-correlation|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30462" PostTypeId="2" ParentId="30461" CreationDate="2016-04-29T14:05:54.147" Score="0" Body="&lt;p&gt;I suspect you have an issue with &lt;a href=&quot;https://www.dsprelated.com/freebooks/sasp/Example_2_Time_Domain.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;time domain aliasing&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A=fft(x1);&#xA;B=fft(x2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;try&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Nfft = length(x1) + length(x2) - 1;&#xA;A=fft(x1, Nfft);&#xA;B=fft(x2, Nfft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-04-29T14:05:54.147" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30463" PostTypeId="2" ParentId="29773" CreationDate="2016-04-29T14:35:35.373" Score="0" Body="&lt;p&gt;If you shift the signal so that the center frequency of the signal is at 0 Hz (i.e. multiply by $\exp(-j2\pi f_ct)$ and do a low-pass filter, then the bandwidth of this basebanded signal is $f_H-f_L$ and you can sample at slightly greater rate than $f_H-f_L$, but the samples are now complex - due to the loss of symmetry. Once you sample - your frequency spectrum then contains periodic repetitions of the original spectrum. This just shows that the signal can be represented with the lower samples rate - the information in the carrier or center frequency has been removed. Note this is just a representation of your signal - it doesn't equal the original signal. You can recover the original signal by doing D/A conversion and shifting the signal back up to the center frequency. To do this effectively there are requirements on the phase noise of the signal $\exp(-j2\pi f_ct)$ - a similar requirement is also required for the scheme below. This is traditional bandpass sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another technique is to just to sample the signal at $2(f_H-f_L)$. The sampling process makes the frequency domain periodic - so a bunch of repetitions of your signal occur in the frequency domain - even around 0 Hz. This assumes that there are no other signals outside the range $f_L$ to $f_H$ in the original - if there are, then these signals will also periodically repeat and overlap with your desired signal. The doubled sampling rate is required because for a real signal with complex conjugate symmetry in the frequency domain, the positive frequency components and the negative frequency components will both periodically repeat. Again this signal is not equivalent to your original, it is just a representation that allows you to recover your original signal (if desired).&lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2016-04-29T14:35:35.373" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30464" PostTypeId="2" ParentId="14804" CreationDate="2016-04-29T18:42:52.320" Score="2" Body="&lt;p&gt;Here is the algorithm:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Divide an input signal $S$ into $n$ consecutive blocks $S_i$ ($i\in\{1,\ldots,n\}$) of length $l$ each&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute magnitude $A_i$ and phase $\phi_i$ of each block using &lt;a href=&quot;https://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;FFT&lt;/a&gt; where &lt;code&gt;A(i)=abs(fft(S{i}))&lt;/code&gt; and &lt;code&gt;Phi(i)=angle(fft(S{i}))&lt;/code&gt; in &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/angle.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MATLAB&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here are the first 3 elements of $\phi$:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/tohvZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tohvZ.png&quot; alt=&quot;Input phases of the first 3 segments&quot;&gt;&lt;/a&gt;&#xA;(Recall that FFT of real signal has odd symmetry which is clearly visible on plots)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute phase differences $\Delta\phi_i=\phi_i-\phi_{i-1}$ for $i\in\{2,\ldots,n\}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To encode your binary data $d$ of length $m:m&amp;lt;l$ assign&#xA;$$\phi_{data}[i]=&#xA;\begin{cases}&#xA;\pi/2,&amp;amp; d_i=0\\&#xA;-\pi/2,&amp;amp; d_i=1&#xA;\end{cases}$$ for $i\in\{1,\ldots,m\}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Replace following elements of first phase sequence, $ {\phi_1} $,  with ${\phi _{data}}[i]$ for $i\in\{1,\ldots,m\}$ as:&#xA;$${\phi '_1}[ {L/2 - m + i}] = {\phi _{data}}[i]\,$$&#xA;To maintain odd symmetry property of DFT, repeat same progress as:&#xA;$${\phi '_1}[{L/2 + 1 + i}] =  - {\phi _{data}}[{m + 1 - i}]$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To maintain phase differences sequentially reassign $\phi '_i=\phi_{i-1}+\Delta\phi_i$ for $i\in\{2,\ldots,n\}$&lt;br&gt;&#xA;Here are the first 3 elements of $\phi '$ after this step:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WFCK6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WFCK6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;br&gt;&#xA;(Note how encoded $d$ has affected next blocks)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Reconstruct the signal using inverse FFT applied to each block $A_i exp(j \phi '_i)$ (where $j$ is imaginary unit) and joining all blocks together.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Explanations to many details like the length of blocks and why particular steps are taken are given in the documents you and &lt;a href=&quot;https://dsp.stackexchange.com/questions/14804/audio-steganography-using-phase-encoding-technique/30464?noredirect=1#comment29453_14804&quot;&gt;endolith linked to&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A minimal IPython Notebook version: github.com/danylo-dubinin/secret_in_wav.&lt;/p&gt;&#xA;" OwnerUserId="20765" LastEditorUserId="20765" LastEditDate="2018-05-25T13:44:01.820" LastActivityDate="2018-05-25T13:44:01.820" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="30465" PostTypeId="1" AcceptedAnswerId="30469" CreationDate="2016-04-29T18:44:25.313" Score="0" ViewCount="162" Body="&lt;p&gt;I am working with EEG recordings about 1,000,000 data pts long, recorded at 4,000 Hz.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm generating PSD estimates for these recordings using the matlab &quot;periodogram&quot; function like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[power,f]=periodogram(testdata,hamming(length(testdata)),[],4000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and plotted like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;scatter(f,log(power),1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I look at my plotted data (frequency vs. power), I see these strange, camel-like humps with maxima at every 10 Hz. The humps kind of resemble the plot of the absolute value of a sine wave. These humps accompany and are quite distinct from what I believe to the the non-artifactual baseline data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run the periodogram function on smaller portions of the data as opposed to the full 1,000,000 point recording, the humps and the baseline appear to merge together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what these humps might represent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rf9zR.jpg&quot; alt=&quot;example&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="20783" LastEditorUserId="20783" LastEditDate="2016-04-29T20:02:45.720" LastActivityDate="2016-04-30T02:12:35.393" Title="What could be causing these humps every 10 Hz on my PSD estimate data?" Tags="|matlab|power-spectral-density|eeg|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30466" PostTypeId="2" ParentId="30300" CreationDate="2016-04-29T20:48:34.353" Score="3" Body="&lt;p&gt;I had to visualize different mathematical and technical processes in the past. I know Inkscape and Inkscape... Well, it is free and more or less cross platform. But besides of that, it also is very painful to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I do in those situations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If it is a one-time sketch to be done&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I just need a sketch of something (i.e. the functions can be wobbly lines and do not have to be very accurate, angles don't have to be fully correct, etc.), I usually use an appropriate program and create the illustration by hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If it has to be quite accurate&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do the calculations in some math program (e.g. MATLAB, iPython, Maple) with appropriately parametric functions etc. If the graphical output is...&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;ok, I just take it and be happy&lt;/li&gt;&#xA;&lt;li&gt;not ok (I am looking at you, MATLAB! Your SVG output is terrible!), I try to export the graphics and enhance them by hand, e.g. in a vector image program&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If it has to be reproducible&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If chances are, that you have to do the visualization more often, maybe with modifications, there is no way around a scripted creation of your images. Normally, I spend long hours to get the graphics output good enough in the math program. If there is another way of visualizing, I would script the math program to output the numbers and feed those to the appropriate program, that then creates my images. Here I have to mention PovRay for 3D visualizations, and it also does come with scripting capabilities, which is helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thoughts on your diagrams&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess in your case, I would go for another option: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Think about the output style to simplify it. For example, do you really need overlapping regions to be hatched? Would it be easier, if the overlap would be another color, or would be visible from two overlapping semi-transparent polygons that yield a darker color in the overlap region due to the semi-transparancy? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Implement a parametric model of the things you would like to visualize in a scripting language that has high-level support for vector graphics, e.g. Python with some SVG modules&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Create the necessary SVG objects (lines with arrow heads as axes, dotted lines as grids, triangles and squares, etc.), and position them accordingly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Make sure that your images are always contained in the drawing area, so that they always have the same size when you change the model parameters and recreate the images. You do not want to end up with images that vary in their canvas size, because this makes recreating documents a new kind of hell.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Final note&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure that there are visualization tools out there that allow you to draw something and apply some kind of dynamic parametrization, where a click on a slider directly produces a live-view of the image with the modified parameter. However, I would not count on such a thing, because of a simple reason: If there is one option missing that you need, it might become painful or impossible to implement a workaround for the function you require. Besides from OS restrictions, interoperability issues, costs, etc.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-04-29T20:48:34.353" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30467" PostTypeId="2" ParentId="30452" CreationDate="2016-04-30T00:48:26.530" Score="-1" Body="&lt;p&gt;Here is some tutorials which you may need to refer.  Zero phase filtering adjust the time delay produced by digital filters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://youtu.be/7AD21oV-PyU&quot; rel=&quot;nofollow noreferrer&quot;&gt;zero phase filtering to remove noises from signal&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;50 Hz and 60 Hz power hum removal from signals. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://youtu.be/iwR1QIspjM8&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://youtu.be/iwR1QIspjM8&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/playlist?list=PLc2rvfiptPSQT3NBfCv9piRo4CvpsGJf4&quot; rel=&quot;nofollow noreferrer&quot;&gt;high frequency noise removal tutorials in matlab&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19428" LastEditorUserId="26573" LastEditDate="2019-07-08T14:03:12.653" LastActivityDate="2019-07-08T14:03:12.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30468" PostTypeId="2" ParentId="30435" CreationDate="2016-04-30T01:48:41.987" Score="0" Body="&lt;p&gt;this ain't image processing, but think of it regarding flipping a coin.  say the value of heads is +1 and of tails is -1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if the coin ain't honest, the skewness will increase in magnitude (and so will the mean, but if you were to subtract the mean, the skewness would still increase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the kurtosis of the coin flipping is zero whether the coin is honest or not.  but if somehow the results of the coin flip could be something deviating from +1 or -1, like sometimes the coin comes out 95% heads and 5% tails and the value of the flip comes out as 0.9 or -1.04 or something like that.  then the kurtosis would be greater than one.  like the other even-numbered moments, i don't think kurtosis can be negative.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-04-30T01:48:41.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30469" PostTypeId="2" ParentId="30465" CreationDate="2016-04-30T02:12:35.393" Score="2" Body="&lt;p&gt;These are indeed artefacts from the stimulation&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = zeros(1,10*4000)&#xA;x(1) = 1;&#xA;x(401) = 1;&#xA;[power,f]=periodogram(x,hamming(length(x)),[],4000);&#xA;scatter(f,log(power),1);&#xA;xlim([0 200]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QTRfW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QTRfW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-04-30T02:12:35.393" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30470" PostTypeId="2" ParentId="29773" CreationDate="2016-04-30T03:19:33.040" Score="2" Body="&lt;p&gt;Bandpass sampling takes advantage of the empty bands within the signal spectrum so to reduce the minimum necessary sampling rate &lt;span class=&quot;math-container&quot;&gt;$\Omega_s$&lt;/span&gt; from what's suggested by lowpass sampling theorem which considers the minimum &lt;span class=&quot;math-container&quot;&gt;$\Omega_s$&lt;/span&gt; to be 2x the highest frequency in its spectrum, aka its bandwidth. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a real, continuous-time bandpass signal whose spectrum (magnitude) as shown bleow is zero for &lt;span class=&quot;math-container&quot;&gt;$|\Omega| &amp;lt; \Omega_1$&lt;/span&gt; and for &lt;span class=&quot;math-container&quot;&gt;$|\Omega| &amp;gt; \Omega_2$&lt;/span&gt;, the lowpass sampling theorem states that a necessary and sufficient condition for perfect reconstruction is &lt;span class=&quot;math-container&quot;&gt;$\Omega_s &amp;gt; 2 \Omega_2$&lt;/span&gt;. However, this may be reduced by applying bandpass sampling as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yxp9v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yxp9v.png&quot; alt=&quot;Bandpass signal Spectra&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A necessary and sufficient condition on the sampling frequency &lt;span class=&quot;math-container&quot;&gt;$\Omega_s$&lt;/span&gt; for perfect recovery of original signal from its samples is that, shifted spectrums (due to impulse train modulation) do not overlap; i.e., there is no &lt;strong&gt;aliasing&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is depicted from the figure below showing the shifted spectrums of &lt;span class=&quot;math-container&quot;&gt;$X_c(\Omega - k \Omega_s)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=0,1,...,m,$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k=m+1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M43zO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M43zO.png&quot; alt=&quot;sampled spectrum&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from the figure, alias-free positioning is attained if the following conditions hold for some integer &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ -\Omega_1 +  m    ~ \Omega_s &amp;lt; \Omega_1  \tag{1} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ -\Omega_2 + (m+1) ~ \Omega_s &amp;gt; \Omega_2  \tag{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding negative of Eq(1) to Eq(2) yields, a &lt;strong&gt;necessarry&lt;/strong&gt; condition for the sampling rate &lt;span class=&quot;math-container&quot;&gt;$\Omega_s$&lt;/span&gt; :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Omega_s &amp;gt; 2(\Omega_2 - \Omega_1) $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$\Omega_s$&lt;/span&gt; that meets this necessary condition, then the maximum positive integer &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; that satisifes Eq(1) is found to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$m = \lfloor{ \frac{2 \Omega_1}{\Omega_s} }\rfloor $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, finally, the second &lt;strong&gt;necessary&lt;/strong&gt; condition on &lt;span class=&quot;math-container&quot;&gt;$\Omega_s$&lt;/span&gt; to avoid any spectral overlapp is found from Eq.(2) for the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; found as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$2\Omega_2  \leq  (m+1) \Omega_s $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore for a given set of &lt;span class=&quot;math-container&quot;&gt;$\Omega_1$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\Omega_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Omega_s$&lt;/span&gt; to ensure alias free bandpass sampling, &lt;span class=&quot;math-container&quot;&gt;$\Omega_s$&lt;/span&gt; and integer &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; satify :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \Omega_s \geq 2 (\Omega_2 - \Omega_1) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$0 \leq m = \lfloor{ \frac{2 \Omega_1}{\Omega_s} }\rfloor $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$2\Omega_2  \leq  (m+1) \Omega_s $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2019-02-11T23:11:34.317" LastActivityDate="2019-02-11T23:11:34.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30471" PostTypeId="2" ParentId="20225" CreationDate="2016-04-30T04:35:59.747" Score="1" Body="&lt;p&gt;Does your system has an Anti-Aliasing filter before the ADC? If not, I would suggest adding one. Depending on the spectra of the signals you are working with, aliasing can create 1/f noise.&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-04-30T04:35:59.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30472" PostTypeId="2" ParentId="27613" CreationDate="2016-04-30T04:57:26.813" Score="0" Body="&lt;p&gt;One thing (specifically for a problem like this) you can do is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Smooth the signal&lt;/li&gt;&#xA;&lt;li&gt;Get the peaks of the signal&lt;/li&gt;&#xA;&lt;li&gt;Connect the peaks to get rid of the pulses.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Let us say x contains the noisy signal&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%Define a smoothing filter&#xA;h = ones(1, 10)./10;&#xA;&#xA;smoothedSignal = filtfilt(h,1,x); &#xA;[~,locs] = findpeaks(smoothedSignal);&#xA;&#xA;% Connect the peaks together&#xA;plot(locs,smoothedSignal(locs));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RzhfN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RzhfN.png&quot; alt=&quot;Example Plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just an example and you can of course play with different smoothing methods and select the one which works the best. &lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-04-30T04:57:26.813" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30474" PostTypeId="1" AcceptedAnswerId="30756" CreationDate="2016-04-30T16:55:10.937" Score="2" ViewCount="2125" Body="&lt;p&gt;Hi All: I'm  somewhat familiar with the kalman filter from a statistical point of view. But lately I've been trying to familarize myself with the linear systems-EE way of looking at it. So, I've been trying to read the Hannan and Deistler 1988 text slowly. I find it difficult and there is&#xA;material in there that I don't follow so this  is what my question is about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will write down verbatim what the book has and then explain the parts of it that I don't understand. I don't expect the actual detailed answer but rather a book or notes that explain the derivation. I'm totally new to this notation and terminology so maybe my questions can be easily answered but I don't expect it ? In fact, notes or a reference would still be appreciated even if the answers are straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quote from Hannan and Deistler: Page 8&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As will be shown, equations ... can be transformed into a state space system&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1.1.22)$ ~~  x(t+1) = Fx(t) + Lz(t) + K \epsilon(t) $&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1.1.23)  $ ~~ y(t) = H x(t) + \epsilon(t) $&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where $F \in R^{n \times n}$,  $L \in R^{n \times m}$,&#xA;  $K \in R^{n \times s}$ and $H \in R^{s \times n}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then there about five pages before the authors comes back to these equations above. I won't quote these five pages but they are mostly about how to use the lag operator to and the z-generating function. Although I find these pages confusing, I do understand the concept of a lag operator. I have a feeling that, if someone can answer my question or point to a useful reference or notes, then they won't need these pages. If someone does need them, I can copy them and send them in a pdf.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now I continue to where the authors comes back to above and I quote:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hannan and Deistler, page 14&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For a state space system (1.1.22), (1.1.23) we have det$(I - Fz) = 1$ for&#xA;  $z = 0$ and thus there always exists a causal solution&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1.2.21)$ ~~~  x(t) = (I - Fz)^{-1}z[Lz(t) + K e(t)]$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where  $(I - Fz)^{-1} = \sum_{j = 0}^\infty F^{j}z^{j}$, provided that the sum in 1.2.21) exists. In this sense, causality is built into the definition of state-space systems.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The transfer functions corresponding to (1.1.22), (1.1.23) are&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$k(z) = H(I_{n} - Fz)^{-1}zK + I_{s} = I_{s} + \sum_{j=1}^{\infty} HF^{j-1}Kz^{j}$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$l(z) = H(I_{n} - Fz)^{-1} zL = \sum_{j=1}^{\infty} HF^{j-1}Lz^{j}$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Starting the system with given initial values $x(0)$, $z(0)$, $\epsilon(0)$ at t = 1, we have&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$ x(t) = \sum_{j=1}^{t} F^{j-1}Lz(t-j) + \sum_{j=1}^{t} F^{j-1}K\epsilon(t-1) + F^{t}x(0)$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$y(t) = \sum_{j=1}^{t} HF^{j-1}Lz(t-j) + \sum_{j=1}^{t} HF^{j-1}K\epsilon(t-1) + HF^{t}x(0) + \epsilon_{t}$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The three parts that I don't understand regarding above are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) the statement about the determinant of $(I-Fz)$ being 1 when $z$ = zero.&#xA;I mean I understand why that's true but what does it have to do with the price of tea in china ? or causality ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) the derivation of the transfer functions, $k(z)$ and $l(z)$. I do understand 1.2.21) so I imagine that 1.2.21) is used to derive them ????? I also understand the second equalities in $k(z)$ and $l(z)$. But not the first equality signs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) the equation for $x(t)$ at the very end. I do see how $y(t)$ is obtained once one has $x(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine that the material that I'm confused about above ( which is most of it )  is hidden deeply in the 5 pages that I didn't quote but, like I said, I found those pages to be quite &quot;opaque&quot;, to say the least.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that I need is nice reference or lectures notes that explain why, when it comes to the KF, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A) the determinant of $(I-Fz)$  is important and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;B) how the associated transfer response functions are obtained  from a state space representation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;C) How the $x(t)$ equation is obtained given the transfer function ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I'm definitely opened to fighting with this material on my own so even just a good link is fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally,  if anyone knows of a book that has similar objectives to Hannan&#xA;and Deistler but is less concise and shows more steps to things (i.e. doesn't assume as much mathematical maturity ), it's appreciated. &lt;/p&gt;&#xA;" OwnerUserId="5007" LastEditorUserId="128" LastEditDate="2018-07-07T15:54:35.207" LastActivityDate="2018-07-07T15:54:35.207" Title="Derivation of Transfer Functions for Kalman Filter" Tags="|kalman-filters|bayesian-estimation|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30475" PostTypeId="2" ParentId="29125" CreationDate="2016-04-30T17:00:11.440" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What does it mean by sampling in EEG data?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Think of it this way. Some true EEG signal exists, but when you 'sample' you are grabbing little snippets of that signal to try and reconstruct it the way it really is. That signal has a frequency spectrum that looks like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zD3OB.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zD3OB.jpg&quot; alt=&quot;EEG spectrum&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You must sample at a rate called &quot;nyquist&quot; to properly reconstruct the signal. That means at twice the highest frequency in that signal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that spike at 60 Hz. That probably isn't from the EEG but rather your power lines. Where are you located? 60 hz noise is very common in eeg/ekg signals. filter that out. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I am getting the sample rate and the frequency when I plot the data as&#xA;  shown below. Shouldn't it be the time and frequency?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally the signal frequency is plotted against the amplitude or power of the signal if you are analyzing the frequency spectrum (as shown).  On the other hand, you might want to see the signal in the &quot;time domain&quot;. What you probably have is the &quot;sample number&quot; without any reference to time, but if you know the sampling rate then you can convert the x-axis to time. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;samples = 1:4097;    % 4097 samples&#xA;Fs = 200;            % Sampling Frequency (Hz)&#xA;t = samples/Fs;      % Time Vector (seconds)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4prrf.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4prrf.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="18581" LastEditorUserId="8202" LastEditDate="2016-05-01T10:36:03.383" LastActivityDate="2016-05-01T10:36:03.383" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30476" PostTypeId="1" CreationDate="2016-04-30T20:53:48.647" Score="1" ViewCount="2446" Body="&lt;p&gt;I want to know the difference between these following commands (matlab) and why I get two different outputs? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fft(signal);    &#xA;&#xA;fft(signal, nfft);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I found that the output arrays are not the same, but I don't know why! &#xA;how it works with the signal of any length without padding the original signal with zeros! &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;signal length is't a power of 2 &lt;/li&gt;&#xA;&lt;li&gt;nfft is the next power of 2&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20773" LastEditorUserId="128" LastEditDate="2018-07-07T11:15:35.327" LastActivityDate="2018-07-07T11:15:35.327" Title="Difference Between `fft(signal, nfft)` and `fft(signal)`" Tags="|matlab|fft|dft|zero-padding|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="30477" PostTypeId="2" ParentId="30476" CreationDate="2016-04-30T21:36:10.280" Score="1" Body="&lt;p&gt;Assuming a signal x[n] of length L, The Matlab function fft(x) computes an L-point DFT of the signal, whereas fft(x,N) computes an N point DFT of x[n]. For certain reasons N must be greater or equal to L, otherwise a wrong (aliased) DFT result would be computed, so that one cannot reconstruct x[n] back from such a DFT via inverse DFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two calls would result in two DFTs which are of different lengths and which ,in general, take different values. This is because they are in fact L and N samples of DTFT $X(e^{j\omega})$ of the signal x[n]. &lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-05-02T00:27:46.687" LastActivityDate="2016-05-02T00:27:46.687" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30479" PostTypeId="2" ParentId="30401" CreationDate="2016-04-30T23:21:22.060" Score="0" Body="&lt;p&gt;OK, this is incomplete but this is how far I've gotten:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My previous answer, which you can see in the edits was incorrect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question boils down to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, one thing I am confused is that why the first part and the second part of the object function are treated independently. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So let's try having a look at the objective function:&#xA;$$&#xA;\begin{array}{rcl}&#xA;{\cal O} &amp;amp;=&amp;amp; \displaystyle \sum_{i=1}^{N} \sum_{j=1}^P \left\{ &#xA;w(Z_{ij}) [ g(Z_{ij}) - \ln E_i - \ln \Delta t_j ]&#xA;\right\}^2 + \lambda \sum_{z =Z_{\rm min}+1}^{Z_{\rm max}} [w(z) g^&quot;(z)]^2\\&#xA;&amp;amp;=&amp;amp; \displaystyle \sum_{i=1}^{N} \sum_{j=1}^P w(Z_{ij})^2 &#xA; [ g(Z_{ij})^2 + (\ln E_i)^2 + (\ln \Delta t_j)^2&#xA;- 2 g(Z_{ij}) \ln E_i - 2 g(Z_{ij}) \ln \Delta t_j + 2 \ln E_i \ln \Delta t_j&#xA; ]\\&#xA;&amp;amp;&amp;amp;+ \lambda \displaystyle \sum_{z =Z_{\rm min}+1}^{Z_{\rm max}} [w(z) \{ g(z-1) - 2g(z) + g(z + 1) \} ]^2&#xA;\end{array}&#xA;$$&#xA;where the second line just expands the first term and substitutes for $g^&quot;$ as the paper suggests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we need to choose the $\ln E_i$ and $g$ values to minimize this so we must take the derivative of $\cal O$ with respect to $\ln E_i$ and to $g$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{d \cal O}{d \ln E_i} = \sum_{i=1}^{N} \sum_{j=1}^P w(Z_{ij})^2 &#xA; [  2 \ln E_i &#xA;- 2 g(Z_{ij}) + 2 \Delta t_j&#xA; ]&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-05-02T21:56:05.307" LastActivityDate="2016-05-02T21:56:05.307" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30480" PostTypeId="1" CreationDate="2016-05-01T01:11:06.843" Score="0" ViewCount="36664" Body="&lt;p&gt;I have the transfer function of the system, which is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{1-z^{-1}}{5(1+2z^{-1})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I sketch the magnitude and phase response?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sorry for the bad formatting, it's my first time post a question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance for the help!&lt;/p&gt;&#xA;" OwnerUserId="20797" LastEditorUserId="8712" LastEditDate="2016-05-01T09:18:54.953" LastActivityDate="2016-05-01T19:15:26.870" Title="How to plot magnitude and phase response by hand if I have the Transfer Function?" Tags="|filters|phase|transfer-function|magnitude|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30481" PostTypeId="2" ParentId="30300" CreationDate="2016-05-01T01:45:30.573" Score="9" Body="&lt;p&gt;Personally, I value aesthetics and consistency in my documents, so I use Latex whenever I can. I use Inkscape if I'm in a hurry, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found that the pgfplots package (built on top of tikz) reduces the time needed to code a plot substantially, especially once you get the hang of it. As a simple example, the following filter response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dI7LM.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dI7LM.png&quot; alt=&quot;filter&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;was generated with the following Latex code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\documentclass{standalone}&#xA;\usepackage{pgfplots}&#xA;\begin{document}&#xA;\begin{tikzpicture}&#xA;\begin{axis} [&#xA;        height=5cm, width=7cm, xlabel={$f$}, ylabel={Filter A},&#xA;        xmin=0, xmax=300, ymin=0, ymax=1.6, no markers,&#xA;        xtick={100,175,250}, ytick={0.25,0.5,0.75,1},&#xA;        axis lines=middle&#xA;    ]&#xA;    \addplot coordinates {(0,1) (100,1) (250,0)};&#xA;    \addplot[black,dotted] coordinates {(0,0.5) (175,0.5) (175,0)}; &#xA;\end{axis}&#xA;\end{tikzpicture}&#xA;\end{document}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Excluding boilerplate (which can be reused between plots), this is just two lines of &quot;real&quot; code (the &lt;code&gt;\addplot&lt;/code&gt; lines). The benefits are the usual latex quality, plus font/style/size consistency with the rest of the document.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a further example I tried a (simplified) version of the last plot in the question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tUvl1.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tUvl1.png&quot; alt=&quot;filter2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which requires just a bit more code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\documentclass{standalone}&#xA;\usepackage{pgfplots}&#xA;\usepgfplotslibrary{fillbetween}&#xA;\begin{document}&#xA;\begin{tikzpicture}&#xA;\begin{axis} [&#xA;        height=5cm,width=9cm,xlabel={$f$},axis lines=middle,&#xA;        xmin=-120,xmax=200,ymin=0,ymax=1.8,no markers,&#xA;        xtick={80,160},xticklabels={$\frac{f_s}{2}$,$f_s=\frac{1}{T}$},&#xA;        ytick={0},yticklabels={},ylabel={$S_s(f)$}&#xA;	]&#xA;    \addplot[black] coordinates {(-100,0) (-20,1) (0,0)};&#xA;    \addplot[black] coordinates {(0,0) (20,1) (100,0)};&#xA;    \addplot[black,name path=A] coordinates {(60,0) (140,1) (160,0)};&#xA;    \addplot[black,dashed,name path=B] coordinates {(80,0) (80,1.5)};&#xA;    \addplot[blue] fill between[of=A and B,soft clip={domain=60:80}];&#xA;\end{axis}&#xA;\end{tikzpicture}&#xA;\end{document}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is true that generating these plots takes time. When working on anything but the most trivial plot, I constantly need to refer to the manuals and to tex.stackexchange.com. I think the examples above show that the pgfplots package removes some of the pain; once you get practice with the most common commands, it shouldn't take &lt;em&gt;too&lt;/em&gt; long to create nice plots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A final point: while I don't (yet) have a program to automatically generate spectrum plots, it shouldn't be too hard to do. I &lt;em&gt;do&lt;/em&gt; have a script to generate pgfplots scripts from Matlab/Octave, which you can see &lt;a href=&quot;https://bitbucket.org/mbaz/printpgf/raw/28cead667bda6ec745a4418bc408f7f712cf8433/inst/printpgf.m&quot; rel=&quot;noreferrer&quot; title=&quot;here&quot;&gt;here&lt;/a&gt;. This script takes two or more Matlab arrays and a plot description, writes a latex file, and runs pdflatex on it. While laborious, coding it wasn't particularly difficult. It should be possible to modify it to take spectrum descriptions (maybe in the &lt;code&gt;edges&lt;/code&gt;, &lt;code&gt;amplitudes&lt;/code&gt; format of the filter design commands) and generate the plots automatically.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-05-01T01:45:30.573" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30482" PostTypeId="2" ParentId="30480" CreationDate="2016-05-01T03:49:53.150" Score="4" Body="&lt;p&gt;Use the transformation $z = e^{j\omega}$, you will get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(e^{j\omega}) = \frac{1-e^{-j\omega}}{5\left(1+2e^{-j\omega}\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solving this (using $e^{j\omega} = \cos \omega + j \sin \omega$), you should get something like (please double check):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(\omega) = \frac{\left(\cos\omega-1 \right) + j4\sin\omega}{5\left(5+4\cos\omega\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{Re}\left(H(\omega)\right) = A = \frac{\left(\cos\omega-1 \right)}{5\left(5+4\cos\omega\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and, $$\text{Im}\left(H(\omega)\right) = B = \frac{4\sin\omega}{5\left(5+4\cos\omega\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the magnitude response will be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left|H(\omega)\right| = \sqrt{A^2+B^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the phase response will be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\angle{H(\omega)} = \tan^{-1}\frac{B}{A}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will get both responses as a function of $\omega$, just vary $\omega$, calculate the values and plot the response.&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-05-01T03:49:53.150" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30485" PostTypeId="1" CreationDate="2016-05-01T11:02:09.710" Score="0" ViewCount="176" Body="&lt;p&gt;My question is if the transition band in the question below would be from 4Khz to the Nyquist frequency of 22.05Khz or from 4Khz until 44.1Khz-4Khz=40.1Khz?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FUoeE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FUoeE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20800" LastActivityDate="2016-05-31T12:45:14.827" Title="What is the maximum allowed transition band of the low-pass filter used in the reconstruction kernel for a CD with maximum speech frequency of 4 kHz?" Tags="|nyquist|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30488" PostTypeId="2" ParentId="30485" CreationDate="2016-05-01T12:17:01.170" Score="1" Body="&lt;p&gt;If you don't want DAC noise near 40-44 kHz to alias down into your audio, you want the narrower/lower transition band reconstruction filter.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-05-01T12:17:01.170" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30489" PostTypeId="2" ParentId="30480" CreationDate="2016-05-01T12:30:45.610" Score="2" Body="&lt;p&gt;For a rough sketch, you can eyeball or measure the distance of the poles and zeros to a point on the unit circle, multiply/divide to get a magnitude, and sum/difference the angles from the poles and zeros to that point to get a phase.  A protractor and ruler might be useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The angles and distances change more rapidly when a pole or zero is near the unit circle, so you may have to plot more points around that portion of the unit circle before interpolating a spline or something in your sketch.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Random historical note: This was how it was actually done in the age of slide-rules, mechanical adding machines, and drafting tables.)&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-05-01T19:15:26.870" LastActivityDate="2016-05-01T19:15:26.870" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30490" PostTypeId="1" CreationDate="2016-05-01T14:34:38.943" Score="3" ViewCount="89" Body="&lt;p&gt;I have a signal up to $3\textrm{ MHz}$. The ADC that sample it has a rate of $1.5\mu s$. So a full $T$ of the signal is $0.3\mu s$, and I can only sample each $1.5\mu s$. It sounds not enough, but I &lt;em&gt;don't&lt;/em&gt; need to reconstruct it, but to create an envelop detector from it, over time, based on lets say $1000T$ (periods).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, over $1000$ periods of $3\textrm{ MHz}$, I will have: $300 \mu s/1.5 \mu s=200 \textrm{ samples}$. From these $200$ samples, I need to create some envelop detector, or continues curve to then later check if it has some large amplitude changes.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can I chose where to sample the input signal so that I can get the &quot;right points&quot; of it- means &lt;em&gt;mostly its maxes&lt;/em&gt;, where my sample rate is much slower then the signal ?&lt;/li&gt;&#xA;&lt;li&gt;Should I use a moving average to get this curve ?&lt;/li&gt;&#xA;&lt;li&gt;Is there another good approach expect from taking more periods?($&amp;gt;1000$) &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="17182" LastEditorUserId="15892" LastEditDate="2016-05-05T09:26:13.870" LastActivityDate="2016-05-05T09:26:13.870" Title="Envelop detection with low sample rate?" Tags="|discrete-signals|sampling|continuous-signals|moving-average|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30491" PostTypeId="1" AcceptedAnswerId="30493" CreationDate="2016-05-01T17:22:22.327" Score="0" ViewCount="210" Body="&lt;p&gt;My textbook doesn't explain how they got the answer to this question: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;If a transmission channel uses an analog carrier wave that is modulated by eight amplitudes and sixteen frequencies per bit time, then what is the transmission capacity of that channel in bits per bit time?&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how they got the answer and I can't find any good sources online to explain it.&lt;/p&gt;&#xA;" OwnerUserId="20804" LastEditorUserId="20804" LastEditDate="2016-05-01T19:18:41.800" LastActivityDate="2016-05-03T14:10:36.683" Title="How to calculate transmission capacity?" Tags="|digital-communications|homework|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30492" PostTypeId="1" AcceptedAnswerId="30496" CreationDate="2016-05-01T17:48:07.283" Score="1" ViewCount="871" Body="&lt;p&gt;I can't seem to get the right answer for this. Could someone show me the procedure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PNzLw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PNzLw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As shown in the figure a system is constructed by cascading four FIR filters having the following frequency responses,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the input signal is $x[n] = 0.9n(u[n] - u[n - 20])$, compute the value of $y[10]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Edit] working thus far&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H[z] = (1 - e&lt;sup&gt;-jω&lt;/sup&gt;)x(1 + e&lt;sup&gt;-jω&lt;/sup&gt;)x(1 + e&lt;sup&gt;-2jω&lt;/sup&gt;)x(1 + e&lt;sup&gt;-4jω&lt;/sup&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; = (1 - e&amp;lt;sup&amp;gt;-2jω&amp;lt;/sup&amp;gt;)x(1 + e&amp;lt;sup&amp;gt;-2jω&amp;lt;/sup&amp;gt;)x(1 + e&amp;lt;sup&amp;gt;-4jω&amp;lt;/sup&amp;gt;)&#xA; = (1 - e&amp;lt;sup&amp;gt;-4jω&amp;lt;/sup&amp;gt;)x(1 + e&amp;lt;sup&amp;gt;-4jω&amp;lt;/sup&amp;gt;)&#xA; = (1 - e&amp;lt;sup&amp;gt;-8jω&amp;lt;/sup&amp;gt;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;y[n] = x[n] - x[n-20]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this point i'm not sure how to proceed.&lt;/p&gt;&#xA;" OwnerUserId="20711" LastEditorUserId="20711" LastEditDate="2016-05-01T19:05:07.693" LastActivityDate="2016-05-01T19:50:30.877" Title="Response of cascading FIR filters" Tags="|filters|homework|finite-impulse-response|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30493" PostTypeId="2" ParentId="30491" CreationDate="2016-05-01T18:24:46.460" Score="1" Body="&lt;p&gt;The question as stated doesn't make sense. In particular, &quot;sixteen frequencies per bit time&quot; doesn't mean anything. So, I'll try to guess at what the question actually is, and try to point you in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's break the question in two parts. First, we're told that the carrier can have eight different amplitudes. This means we can encode three bits in the carrier amplitude. If we label amplitudes $L_0,\ldots,L_7$, we can encode the bit sequence $000$ as amplitude $L_0$, $001$ as amplitude $L_1$, etc. This means that this carrier can transmit bits 3 times faster than a carrier with only two allowed amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second part of the question seems to indicate that you actually have sixteen carriers, all operating simultaneously. (and that they don't interfere with each other). Each carrier can have eight different amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take $R$ as the baseline rate obtained by a single carrier with two amplitudes, you should now be able to calculate the rate of 16 carriers with 8 amplitudes each, as a multiple of $R$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Edit: I think there is a second possible interpretation of the question: this could be some sort of combination ASK-FSK, where there are 16 possible frequencies (FSK) and each could have 8 possible amplitudes (ASK). Each frequency would carry 4 bits and each amplitude a further 3 bits, for a total of seven bits per symbol time.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-05-03T14:10:36.683" LastActivityDate="2016-05-03T14:10:36.683" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30494" PostTypeId="2" ParentId="27624" CreationDate="2016-05-01T18:48:17.213" Score="1" Body="&lt;p&gt;This is one of the most important papers in this area:&#xA;&lt;a href=&quot;http://www.wisdom.weizmann.ac.il/~levina/papers/colorization-siggraph04.pdf&quot; rel=&quot;nofollow&quot;&gt;Colorization using Optimization&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may found additional information with code &lt;a href=&quot;http://www.cs.huji.ac.il/~yweiss/Colorization/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7527" LastActivityDate="2016-05-01T18:48:17.213" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30495" PostTypeId="2" ParentId="30490" CreationDate="2016-05-01T19:12:16.920" Score="3" Body="&lt;p&gt;Is the ADC sample-and-hold fast enough to even capture any envelope peaks or even half cycles?  If not, all bets are off.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your ADC does have a fast enough capture time, then randomizing your sample times might be a good bet at capturing a few near extrema.  If you know, a priori, the approximate shape of your waveform, then Monte-Carlo sampling might allow one to estimate the waveform amplitude from the statistical distribution of enough sufficiently time-randomized samples.  Assuming the envelope changes slowly enough.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-05-01T19:12:16.920" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30496" PostTypeId="2" ParentId="30492" CreationDate="2016-05-01T19:34:09.920" Score="1" Body="&lt;p&gt;In this problem there are a cascade of 4 LTI systems whose multiplication of frequency responses (or convolution of impulse responses equivalently) provides the overall system Frequency Response (or impulse response equivalently) and the output $y[n]$ at n = 10 is being asked for an input of $x[n] = 0.9 \times n \times (u[n] - u[n-20])$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I would like to proceed by finding the overall impulse response $h[n]$ from the serial convolution of those four individual impulse responses as it seems simpler to find the output in time domain then in the Frequency domain:&#xA;$$ h[n] = (\delta[n] - \delta[n-1]) \star (\delta[n]+\delta[n-1]) \star&#xA; (\delta[n] + \delta[n-2]) \star (\delta[n] + \delta[n-4])$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\star$ denotes convolution operation and those impulses are directly derived from the Frequency Responses $H_i(e^{j\omega})$ of the individual systems. I hope you can see the simple corresponce with each one of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then convolving from left to right, we can show in 3 steps that:&#xA;$$h[n] = (\delta[n] - \delta[n-2]) \star (\delta[n] + \delta[n-2]) \star (\delta[n] + \delta[n-4])$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n] = (\delta[n] - \delta[n-4]) \star (\delta[n] + \delta[n-4])$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h[n] = (\delta[n] - \delta[n-8])$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope also that you have no difficulty in obtainig shifted impulses as a result of convolution with a shifted impulse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore now the question becomes; given LTI impulse response $h[n] = \delta[n] - \delta[n-8]$ , compute $y[n]$ for the given input $x[n]$. It's now easy to show that: &#xA;$$y[n] = h[n] \star x[n] = (\delta[n] - \delta[n-8])*x[n]$$ &#xA;$$y[n] = x[n] -x[n-8]$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;therefore with $x[n] = 9 \times n \times(u[n]-u[n-20]$ , $y[10]$ becomes: &#xA;$$y[10] = x[10] - x[2]$$&#xA;$$y[10] = 0.9 \times 10 \times (u[10]-u[-10]) - 0.9 \times 2 \times (u[2]-u[-18])$$&#xA;$$y[10] = 9 - 1.8 = 7.2$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where before the last line I have used the famous property of unit step $u[n]$.&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-05-01T19:50:30.877" LastActivityDate="2016-05-01T19:50:30.877" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30497" PostTypeId="1" CreationDate="2016-05-01T22:49:30.223" Score="-1" ViewCount="1057" Body="&lt;p&gt;I have the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(n)=\frac{14}{24}x(n-1)+\frac{9}{24}x(n-2)-\frac{1}{24}x(n-3)+w(n)$$&#xA;where, $w(n)$ is a stationary white noise process with variance $\sigma^2_w$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I want to determine the auto correlation sequence $\gamma_{xx}(m)$, for $m = 0,1,\ldots,5$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I know that the autocorrelation function for AR process which is given below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\gamma_{xx}(m)= \begin{cases}\displaystyle-\sum_{k=1}^p a_k\gamma_{xx}(m-k), &amp;amp; m &amp;gt; 0\\&#xA;\displaystyle  -\sum_{k=1}^p a_k\gamma_{xx}(m-k) + \sigma_w^2, &amp;amp; m = 0\\&#xA;\gamma_{xx}^*(-m), &amp;amp; m &amp;lt; 0\\&#xA;\end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, I already found the coefficients of ${a_k}$ which are $a_1=-\frac{14}{24}, a_2=-\frac{9}{24}, a_3=\frac{1}{24}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I don't get, how can I calculate $\gamma_{xx}(0)$ to $\gamma_{xx}(5)$ recursively? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please someone tell me how can I solve  $\gamma_{xx}(0)$ and $\gamma_{xx}(1)$? Then I can do the the rest. &lt;/p&gt;&#xA;" OwnerUserId="19844" LastEditorUserId="1629" LastEditDate="2016-05-02T21:57:39.283" LastActivityDate="2022-04-03T09:06:35.513" Title="Determining the autocorrelation sequence from an AR model" Tags="|autocorrelation|autoregressive-model|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30499" PostTypeId="1" AcceptedAnswerId="30500" CreationDate="2016-05-02T02:14:51.777" Score="0" ViewCount="3142" Body="&lt;p&gt;I'm using MATLAB to analyse a very large sample of acceleration data collected using the MPU9150 IC. My aim is to plot the FFT for this large sample of data.  The daya is of three axes; $x,y,z$ and I have successfully imported the data into matlab as vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I am new to MATLAB I have taken over month to plot the FFT graph but I believe its highly dependent on the smoothing factor. I wish to first illustrate my approach and then showcase my full code for your kind reference. Sampling frequency of of the accelerometer is 10 Hz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Approach in exact order.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Import the raw acceleration vector with $x,y,z$ axes Determine&#xA;butterworth Filter parameters&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply butter-worth filter using &lt;code&gt;filtfilt()&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;use &lt;code&gt;smooth()&lt;/code&gt; function with a smooth factor. ( NOTE: smoothing factor&#xA;effects FFT shape significantly)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;obtain FFT using &lt;code&gt;abs(fft(acceleration_DC_shifted_Filtered_Vector))&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;smooth the FFT line using &lt;code&gt;smooth&lt;/code&gt; function (this smoothing has no&#xA;effect on FFT there fore can be skipped if required.) &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;plot FFT&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My code is below, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%importing data from workspace.&#xA;     accelerationd2 = Xaccelday2; &#xA;% Setting basic Parameters. Number of samples should be same in all day files.         number_of_samples = length (accelerationd2); sampling_frequency = 10;&#xA;&#xA;%Setting filtering paramters.&#xA;          cut_off_frequency = 5;&#xA;          wn = cut_off_frequency/sampling_frequency;&#xA;&#xA;&#xA;           order_of_butterworth_filter = 1;&#xA;              [b1,a1]= butter(order_of_butterworth_filter,wn,'low');&#xA;&#xA;%Filtering data from all ten days.&#xA;                  accelerationd2_filtered = filtfilt(b1,a1,accelerationd2);&#xA;&#xA;&#xA;%DC shift removal`&#xA;&#xA;              accelerationd2_smoothned= smooth(accelerationd2_filtered,36.5);%acceleration 1filtered was passed into all smoothfunctions&#xA;          accelerationd2_DC_shifted = accelerationd2_filtered-accelerationd2_smoothned;&#xA;&#xA;%Computing FFT&#xA;          accelerationd2_FFT = smooth(abs(fft(accelerationd2_DC_shifted)),8000); %1000 is ballpark&#xA;          bin_vals = (0 : number_of_samples-1);&#xA;          fax_Hz = bin_vals*sampling_frequency/number_of_samples;&#xA;          N_2 = ceil(number_of_samples/2);&#xA;&#xA;%Detecting peaks&#xA;          figure;&#xA;          plot((fax_Hz(1:N_2)),(accelerationd2_FFT(1:N_2)),'r');&#xA;          hold on&#xA;          legend('Day-02');&#xA;&#xA;&#xA;%[maxtabDay1, mintabDay1] = peakdet(accelerationd1_FFT(1:N_2), 15, fax_Hz(1:N_2));&#xA;          [maxtabDay2, mintabDay2] = peakdet(accelerationd2_FFT(1:N_2), 15, fax_Hz(1:N_2));&#xA;&#xA;&#xA;%This is where peaks are dressed with markers. Markers must have the same color of the line. Markers can be different symbols. Types of markers that can be used : ^ , * &#xA;           plot(maxtabDay2(:,1), maxtabDay2(:,2), 'r*');&#xA;          xlabel('Frequency (Hz)');&#xA;          ylabel('Magnitude (dB)');&#xA;          title('Single-sided Magnitude Spectrum (Hz)');&#xA;          %hold on&#xA;          hold off&#xA;%axis tight&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My problem is that the FFT changes highly as the smoothing factor in&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; accelerationd2_smoothned= smooth(accelerationd2_filtered,36.5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is changed. Any help would be so much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it my thinking that there is only one correct FFT and the FFT should not change depending on the process I obtain it from? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another important reason to note is that all samples have a DC shift. Which is why the &lt;code&gt;smooth&lt;/code&gt; function has been used. If it is not used, the time domain is not brought about $y=0$-axis before inserting to the FFT function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate if a better procedure can be explained that can be used to obtain the FFT through MATLAB. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. &#xA;It would be nice to have a method I can obtain the FFT for my data set. I collected this data about the motion of an particular animal. And I need to generate the FFT for its movement. I have many records but not a proper method. My data goes like,&#xA;$X_{\rm acceleration}, Y_{\rm acceleration}, Z_{\rm acceleration}$. &#xA;But there can be DC shifts seen on the time domain because the animal because the collar which has the logger was not perfectly in the middle. Therefore I must remove these DC components caused by gravity. &lt;/p&gt;&#xA;" OwnerUserId="20808" LastEditorUserId="1629" LastEditDate="2016-05-02T21:57:33.423" LastActivityDate="2016-05-02T21:57:33.423" Title="Obtaining the FFT of a data set collected through an accelerometer" Tags="|matlab|fft|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30500" PostTypeId="2" ParentId="30499" CreationDate="2016-05-02T06:43:36.530" Score="1" Body="&lt;p&gt;From you code it appears you do a low pass butterworth filter:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[b1,a1]= butter(order_of_butterworth_filter,wn,'low');&#xA;accelerationd2_filtered = filtfilt(b1,a1,accelerationd2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then another low pass moving average filter which you minus from the previous.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;accelerationd2_smoothned = smooth(accelerationd2_filtered,36.5);&#xA;accelerationd2_DC_shifted = accelerationd2_filtered - accelerationd2_smoothned;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yes, this second part will remove DC, but I think this is the first thing you should do. That is, use a HIGH pass butterworth filter (with a few more orders perhaps)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cut_off_frequency = 5;&#xA;wn = cut_off_frequency/sampling_frequency;&#xA;order_of_butterworth_filter = 4;&#xA;[b1,a1]= butter(order_of_butterworth_filter,wn,'high');&#xA;accelerationd2_filtered = filtfilt(b1,a1,accelerationd2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then apply the FFT. If there is two much high frequency noise, you can apply a low pass butterworth filter to the above output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for you analysis, the FFT uses the entire signal to compute. So any frequency magnitudes represent the average over the whole time series. That is, there is no time information in there. Since you have a large sample of animal data, I imagine you would want to see how things change over time, so I suggest instead using the STFT or some other wavelet transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In MATLAB you might get good results out of the box using &lt;a href=&quot;http://au.mathworks.com/help/signal/ref/spectrogram.html&quot; rel=&quot;nofollow&quot;&gt;spectrogram&lt;/a&gt;, no pre-filtering required.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;window = 1000;&#xA;overlap = round(0.9*window);&#xA;s = spectrogram(accelerationd2,window,noverlap)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-05-02T06:43:36.530" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30501" PostTypeId="2" ParentId="21904" CreationDate="2016-05-02T08:01:53.240" Score="1" Body="&lt;p&gt;Usually before processing the speech signals, they are passed through a high pass filter with cutoff frequency of around 150 Hz to remove such artefacts.&lt;/p&gt;&#xA;" OwnerUserId="15911" LastActivityDate="2016-05-02T08:01:53.240" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30502" PostTypeId="1" AcceptedAnswerId="30503" CreationDate="2016-05-02T10:14:06.613" Score="2" ViewCount="168" Body="&lt;p&gt;I am reading the etext on Digital Image Processing by Gonzalez and under the section on Histogram Equalization, an equation which is apparently basic is shown. I have no clue what the equation means and where it is from. I hope someone can point me to it in wiki or something. I have been googling for awhile but I have yet to get any meaningful results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y8kib.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y8kib.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20445" LastActivityDate="2016-05-02T11:15:57.110" Title="Histogram Equalization" Tags="|equalization|histogram|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30503" PostTypeId="2" ParentId="30502" CreationDate="2016-05-02T11:15:57.110" Score="3" Body="&lt;p&gt;Assuming that in your question $T(r)$ denotes a map $:\mathbb{R}\to[0,1]$ and assuming that it is continuous and strictly increasing, then it is obviously an isomorphism among $r\in[0,1]$ onto its image.&lt;br&gt;&#xA;As a consequence you get the following result: let $r$ be any value in $[0,1)$, and let $a=T(r)$, then for any $\rho\in[r,r+dr]$ it is $\alpha = T(\rho) \in [a,a+da]$, having denoted $a+da = T(r+dr)$. Therefore the probability of $r$ and $a$ to belong their infinitesimal intervals (which is actually the definition of PDF) is the same. hence as $dr\to 0$, also $da\to 0$ and you can write&#xA;$$&#xA;p_r(r) dr = p_a(a) da&#xA;$$&#xA;which yields the result&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-05-02T11:15:57.110" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30504" PostTypeId="1" CreationDate="2016-05-02T11:27:51.563" Score="0" ViewCount="2868" Body="&lt;p&gt;What is the definition of 'small signal bandwidth' and 'large signal bandwidth'?&#xA;If I google them, I only encounter them in an electrical context (transistors etc.). However, I am looking for a general definition (for any time signal).&lt;/p&gt;&#xA;" OwnerUserId="13475" LastActivityDate="2017-09-11T18:00:50.497" Title="What is the definition of small/large signal bandwidth?" Tags="|bandwidth|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30506" PostTypeId="1" AcceptedAnswerId="30507" CreationDate="2016-05-02T12:33:04.033" Score="2" ViewCount="5839" Body="&lt;p&gt;I am willing to implement a basic FIR filter using C++ and JUCE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote this simple algorithm using the information &lt;a href=&quot;http://www.dspguide.com/ch16/4.htm&quot; rel=&quot;nofollow&quot;&gt;I found in the DSPGuide&lt;/a&gt;, but I only seem to get a variation in volume for all the frequencies, instead of a frequency filtering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I correct it to effectively apply frequency filtering ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (channel == 0) {&#xA;&#xA;    float result = 0; // initialisation to 0 of the result&#xA;&#xA;    for (int sample = 0; sample &amp;lt; buffer.getNumSamples(); sample++) { // for each sample&#xA;&#xA;        // moving the samples in the delay line&#xA;        for (int i = 0; i &amp;lt; 8; i++) { // delayLine being 9 values long&#xA;            delayLine[i + 1] = delayLine[i];&#xA;        }&#xA;        delayLine[0] = reader[sample];&#xA;&#xA;        result = 0;&#xA;        for (int i = 0; i &amp;lt; 9; i++) { // for each tap&#xA;            result = result + delayLine[i] * filterTaps[i]; // multiply     &#xA;        }&#xA;        writeback[sample] = result; // output&#xA;    }&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are the coefficients used, which are supposed to produce a Low-Pass Filter in the audible range :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;filterTaps[0] = 0.002385;&#xA;    filterTaps[1] = 0.011910;&#xA;    filterTaps[2] = 0.026352;&#xA;    filterTaps[3] = 0.039825;&#xA;    filterTaps[4] = 0.045351;&#xA;    filterTaps[5] = 0.039825;&#xA;    filterTaps[6] = 0.026352;&#xA;    filterTaps[7] = 0.011910;&#xA;    filterTaps[8] = 0.002385;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have generated them using this website &lt;a href=&quot;http://www.arc.id.au/FilterDesign.html&quot; rel=&quot;nofollow&quot;&gt;http://www.arc.id.au/FilterDesign.html&lt;/a&gt; &#xA;Can't remember the cut-off I chose, but it was between 1000 and 5000 kHz with a 44100 Hz sampling rate. These coefficients are just an example, as my initial goal was to make an anti-aliasing filter. Since the filter was not working properly, probably because of the algorithm, I chose another set of coefficients in the audible range to ease the debug process).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="20812" LastEditorUserId="20812" LastEditDate="2016-05-02T13:22:17.487" LastActivityDate="2016-05-02T13:40:30.500" Title="Basic FIR Filtering with audio buffer in C++" Tags="|filters|finite-impulse-response|c++|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30507" PostTypeId="2" ParentId="30506" CreationDate="2016-05-02T13:10:39.610" Score="2" Body="&lt;p&gt;Your implementation of the delay line is flawed.  It's just copying the second last sample over each element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    for (int i = 7; i &amp;gt;=0; i--) { // delayLine being 9 values long&#xA;        delayLine[i + 1] = delayLine[i];&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Previous answer below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your filter seems to be a lossy low pass filter --- even the passband has -15dB attenuation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try using these coefficients instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.01156111 0.05773286 0.12773940 0.19304879 0.21983567 0.19304879 0.12773940 0.05773286 0.01156111&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;They are obtained by normalizing the sum of the coefficients you provided.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your filter has this response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vWEbQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vWEbQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The normalized coefficients give this response:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nRHkt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nRHkt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; #30506&#xA;filterTaps &amp;lt;- c(0.002385,&#xA;0.011910,&#xA;0.026352,&#xA;0.039825,&#xA;0.045351,&#xA;0.039825,&#xA;0.026352,&#xA;0.011910,&#xA;0.002385)&#xA;&#xA;filterTaps2 &amp;lt;- filterTaps / sum(filterTaps)&#xA;&#xA;freqz(filterTaps)&#xA;&#xA;&#xA;freqz(filterTaps2)&#xA;&#xA;getNumSamples &amp;lt;- 1000&#xA;&#xA;reader &amp;lt;- rnorm(getNumSamples,0,1)&#xA;writeback &amp;lt;- 0*reader&#xA;&#xA;delayLine &amp;lt;- 0*filterTaps&#xA;result &amp;lt;- 0; # initialisation to 0 of the result&#xA;for (sample in seq(1,getNumSamples)) &#xA;{ # for each sample&#xA;&#xA;    # moving the samples in the delay line&#xA;    for (i in seq(8,1,-1)) &#xA;    { # delayLine being 9 values long&#xA;        delayLine[i + 1] = delayLine[i];&#xA;    }&#xA;    delayLine[1] = reader[sample];&#xA;&#xA;    result = 0;&#xA;    for (i in seq(1,9)) &#xA;    { # for each tap&#xA;          result = result + delayLine[i] * filterTaps[i]; # multiply     &#xA;    }&#xA;    writeback[sample] &amp;lt;- result; # output&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-05-02T13:39:48.823" LastActivityDate="2016-05-02T13:39:48.823" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30508" PostTypeId="2" ParentId="30504" CreationDate="2016-05-02T13:14:13.003" Score="4" Body="&lt;p&gt;In communications, whether a signal is narrowband (has a small bandwidth) or wideband (has a large bandwidth) is relative to the channel's impulse response.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the channel behaves as a flat filter (constant gain) over the signal's bandwidth, then the signal is narrowband. If the channel introduces significant distortion (that is, if different signal frequencies see different gain) then it is said that the signal is wideband.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastActivityDate="2016-05-02T13:14:13.003" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30509" PostTypeId="2" ParentId="30504" CreationDate="2016-05-02T13:49:22.363" Score="4" Body="&lt;p&gt;Do you perhaps mean &lt;a href=&quot;https://en.wikipedia.org/wiki/Small-signal_model&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;small signal model&lt;/strong&gt;&lt;/a&gt;?  That is often used in the context of analysing the performance of transistor circuits.  The transistors themselves are nonlinear devices, but they can be analysed as linear devices if you choose their operating regime appropriately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conversely, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Large-signal_model&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;large signal model&lt;/strong&gt;&lt;/a&gt; is when the operating regime is such that the nonlinear effects must be taken into account.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-02T13:49:22.363" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30510" PostTypeId="1" CreationDate="2016-05-02T14:24:37.870" Score="-1" ViewCount="160" Body="&lt;p&gt;After converting a 1D signal to 2D using matlab code, can the ridgelet transform be applied? Is this transformation effective compared to wavelet?&lt;/p&gt;&#xA;" OwnerUserId="20814" LastEditorUserId="80" LastEditDate="2016-05-02T19:40:12.320" LastActivityDate="2016-05-02T19:40:12.320" Title="possibility of applying ridgelet transformation on signals" Tags="|wavelet|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30511" PostTypeId="1" CreationDate="2016-05-02T15:28:35.240" Score="1" ViewCount="945" Body="&lt;p&gt;&lt;br&gt;&#xA;I have a signal, in which i want to detect the period of the peaks, that exist within this signal: for example : After each 5mm or (5 seconds depending on the sampling rate and speed of my motor) i have a peak in my motor current.&lt;br&gt;&#xA;I though of using the FFT, but then i had some problems with the sampling rate which lead me to look for the ununiform fft, but i wasnt very successfull.&lt;br&gt;&#xA;I also tried using the Savitzky golay filter to smooth the data, since i read that it actually helps finding peaks within the signal, but not the period.&lt;br&gt;&#xA;I tried appliying the FFT to the smoothed data, but I wasn't able to find any frequence.&lt;br&gt;&#xA;So i was wondering is there is an algorithm that detects the periodicity of peaks within a signal.&#xA;&lt;br&gt; this is the Normal Signal plot .&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/OEK3W.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OEK3W.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt; The signal in display(20mm/s) has been smoothed using the Savitzky golay filter, with a window of 51.&lt;br&gt;&lt;a href=&quot;https://i.stack.imgur.com/dpcZd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dpcZd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20763" LastEditorUserId="20763" LastEditDate="2016-05-03T09:58:22.063" LastActivityDate="2017-07-27T19:20:48.510" Title="Periodicity of peaks within a signal" Tags="|peak-detection|periodic|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30512" PostTypeId="2" ParentId="30511" CreationDate="2016-05-02T16:02:18.393" Score="2" Body="&lt;p&gt;Before applying the algorithm below, you should first &lt;a href=&quot;https://dsp.stackexchange.com/a/9122/80&quot;&gt;apply a DC blocking filter&lt;/a&gt;. That should remove the DC offset (and partially the step at the beginning), which will allow more usual periodicity techniques to be used.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You can try using the average square difference function. There is a nice write up on &lt;a href=&quot;https://dsp.stackexchange.com/a/29968/80&quot;&gt;this answer&lt;/a&gt; and a way to implement it in an efficient manner &lt;a href=&quot;https://stackoverflow.com/a/973478/12570&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example plot. The $\color{red}{\bf red}$ circle shows the selected minimum. Note how the &quot;octave&quot; problem shows up: if the signal is periodic with period $P$, it's also periodic with period $N P$ where $N$ is an integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Wy61G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wy61G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30511&#xA;&#xA;pulse &amp;lt;- 16 - seq(-4,4)^2&#xA;len &amp;lt;- length(pulse)&#xA;&#xA;T &amp;lt;- 1000&#xA;P &amp;lt;- 49&#xA;&#xA;ix &amp;lt;- seq(1,T - len, P)&#xA;&#xA;data &amp;lt;- rep(0,T)&#xA;&#xA;for (this_one in ix)&#xA;{&#xA;  data[this_one + seq(0,len-1)] &amp;lt;- pulse&#xA;}&#xA;&#xA;data &amp;lt;- data #+ rnorm(T,0,1)&#xA;&#xA;plot(data, type=&quot;l&quot;)&#xA;&#xA;asdf &amp;lt;- function(data, Pmax)&#xA;{&#xA;  N &amp;lt;- length(data)&#xA;  asdf &amp;lt;- rep(0,Pmax)&#xA;  for (p in seq(1,Pmax))&#xA;  {    &#xA;    ix &amp;lt;- seq(p+1,N)&#xA;    asdf[p] &amp;lt;- sum((data[1:length(ix)] - data[ix])^2)&#xA;  }&#xA;&#xA;  return(asdf)&#xA;}&#xA;&#xA;calc &amp;lt;- asdf(data, 5*P)&#xA;&#xA;par(mfrow=c(2,1))&#xA;plot(data, type=&quot;l&quot;)&#xA;title('Repeating pulses')&#xA;&#xA;plot(1:(5*P), calc, type=&quot;l&quot;)&#xA;period &amp;lt;- which.min(calc)&#xA;points(P, calc[P], col=&quot;grey&quot;, lwd = 12)&#xA;points(period, calc[period], col=&quot;red&quot;, lwd = 5)&#xA;title('ASDF')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-05-23T11:33:49.783" LastActivityDate="2016-08-31T12:54:41.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30513" PostTypeId="2" ParentId="30497" CreationDate="2016-05-02T16:13:25.427" Score="0" Body="&lt;p&gt;Looking at your definition of $\gamma_{xx}(m)$, it seems that you have 4 equations with 4 unknown (for $m=0,\ldots,3$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;24\gamma_{xx}(0) &amp;amp;= 14\gamma_{xx}(1) + 9\gamma_{xx}(2) - \gamma_{xx}(3) + 24\sigma_w^2  \\&#xA;24\gamma_{xx}(1) &amp;amp;= 14\gamma_{xx}(0) + 9\gamma_{xx}(1) -\gamma_{xx}(2) \\ &#xA;24\gamma_{xx}(2) &amp;amp;= 14\gamma_{xx}(1) + 9\gamma_{xx}(0) - \gamma_{xx}(1)\\&#xA;24\gamma_{xx}(3) &amp;amp;= 14\gamma_{xx}(2) + 9\gamma_{xx}(1) - \gamma_{xx}(0)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solving the above system of equations is straight forward, and after that you can easily obtain $\gamma_{xx}(m)$ for $m=4,5$&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="1629" LastEditDate="2016-06-01T22:43:35.227" LastActivityDate="2016-06-01T22:43:35.227" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30514" PostTypeId="2" ParentId="30510" CreationDate="2016-05-02T17:38:25.053" Score="1" Body="&lt;p&gt;Of course you can. But it is unlikely this will be very effective, unless the features of your signal are well aligned in different orientations in 2D, so that the ridgelet can sparsify them. You can observe this from ridgelet shapes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rs1jk.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rs1jk.jpg&quot; alt=&quot;Ridgelet shape&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it possesses a long support in one direction, it is not very effective with signals having a lot of discontinuities. Of course, it depends a lot on the nature of the signals you are considering. Changing 1D to 2D, or 2D to 1D affects the structure of data a lot. In the following pictures taken from a &lt;a href=&quot;http://perso-math.univ-mlv.fr/users/seuret.stephane/Duval_Slides.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;presentation&lt;/a&gt; of an &lt;a href=&quot;http://www.sciencedirect.com/science/article/pii/S0165168411001356&quot; rel=&quot;nofollow noreferrer&quot;&gt;overview of wavelets in 2D&lt;/a&gt;, you can see a speech signal (JFK at Rice university launching the moon program), and an image turned into 1D:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c2Iyz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c2Iyz.png&quot; alt=&quot;John Fitzgerald Kennedy aat Rice and man on the moon, 1D&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the next images, you have the speech turned into 2D, and the full 2D image represented in 1D above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bOY2B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bOY2B.png&quot; alt=&quot;John Fitzgerald Kennedy aat Rice and man on the moon, 2D&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the structure is lost in both cases.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-05-02T17:38:25.053" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30516" PostTypeId="1" AcceptedAnswerId="37516" CreationDate="2016-05-02T18:44:55.043" Score="0" ViewCount="773" Body="&lt;p&gt;I am trying to perform practical diversity combining implemented in GNU Radio by using Ettus N210 USRPs, one as a transmitter and two as receivers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compare Equal Gain Combining (EGC) and Maximal Ratio Combining (MRC) techniques, I simply add the same received signal from two different receivers constructively for EGC and multiply each branch with a gain derived from square root of its signal-to-noise ratio (signal+noise/noise) before adding for MRC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contrary to the literature, for a few cases MRC is not performing better than EGC. I have noticed that when there is no signal, the noise level for both receivers is not same. In theory, it is assumed that all branches have equal mean power and noise level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am confused. Should I attenuate/amplify the received signal (signal+noise) from each receiver to make the mean signal power same across both receivers or should I attenuate/amplify the received signal (signal+noise) in a way that noise level become same in the signal from both receivers before performing EGC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I am done with EGC, should I simply multiply the weight at each branch to perform MRC?&lt;/p&gt;&#xA;" OwnerUserId="16465" LastEditorUserId="13320" LastEditDate="2016-11-13T13:07:56.990" LastActivityDate="2017-02-09T23:36:48.157" Title="Practical diversity combining at receivers (Maximal Ratio Combining &amp; Equal Gain Combining)" Tags="|signal-analysis|digital-communications|gnuradio|diversity|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30517" PostTypeId="2" ParentId="30451" CreationDate="2016-05-02T19:37:52.417" Score="0" Body="&lt;p&gt;What's wrong with just taking the inner product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is an attempt to generate a database like what you suggest: 5000 signals with 256 coefficients in them, most of which are zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, I've set every even numbered signal to be the same as the odd prior odd numbered signal, with just some missing coefficients selected randomly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\color{green}{\bf green}$ circle on the left shows the value of the inner product for the first signal with itself; the $\color{red}{\bf red}$ circle shows the value of the inner product of the first signal with the second (which should be the same, with missing entries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running that code takes about 0.298 seconds on a 2010 MacBook Pro (yes, I know,  I need a new one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kbzw7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kbzw7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30451&#xA;&#xA;signalLength &amp;lt;- 256&#xA;numberOfSignals &amp;lt;- 5000&#xA;&#xA;database &amp;lt;- array(0,c(signalLength,numberOfSignals))&#xA;&#xA;for (signal in seq(1,numberOfSignals-1,2))&#xA;{&#xA;  ix &amp;lt;- sample(signalLength,runif(1,min = 10, max = 15))&#xA;  database[ix,signal] &amp;lt;- runif(length(ix),min = 400, max = 600)&#xA;  ix2 &amp;lt;- sample(ix,10)&#xA;  database[ix2,signal+1] &amp;lt;- database[ix2,signal]&#xA;}&#xA;&#xA;plot(colSums(database[,1]*database))&#xA;points(1,database[,1] %*% database[,1], col=&quot;green&quot;, lwd=5)&#xA;points(1,database[,2] %*% database[,2], col=&quot;red&quot;, lwd=5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-05-02T20:46:44.023" LastActivityDate="2016-05-02T20:46:44.023" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30518" PostTypeId="1" CreationDate="2016-04-11T15:55:35.527" Score="4" ViewCount="272" Body="&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a (noisy) square wave signal and need to extract the data points that make up the 'baseline' and 'plateau' ONLY. I do not want data from the rise and fall. So far I have accomplished the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;data points designated as 'baseline' or 'plateau' superimposed onto original signal&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5fWuS.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have defined 'baseline' data points as those from the minimum to the mean of the lowest 25% of signals + 1 standard deviation of the lowest 25% of signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly I have defined 'plateau' data points as those from the maximum to the mean of the highest 25% of signals - 1 standard deviation of the highest 25% of signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works ok, but as you can see: sometimes 1 standard deviation is not enough to encapsulate all of the baseline noise. 2 Standard deviations often encapsulate too much of the rise/fall of the signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone provide a more elegant solution to this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to measure the signal to noise ratio of the square pulse, so I need to extract the populations that will give me baseline noise and the mean pulse height.&lt;/p&gt;&#xA;" OwnerUserId="21073" OwnerDisplayName="Pete" LastActivityDate="2016-05-18T17:04:23.500" Title="MATLAB: get members of histogram populations EXCLUDING those inbetween" Tags="|matlab|histogram|" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30521" PostTypeId="1" AcceptedAnswerId="30536" CreationDate="2016-05-03T08:03:07.760" Score="2" ViewCount="5199" Body="&lt;p&gt;I am looking for the proof that the Hilbert transform of $\displaystyle\frac{\sin(at)}{at}$ is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\sin^2(at/2)}{at/2}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we prove this? This is a $\operatorname{sinc}(at)$ function. I could not find a proof of this in any textbook so far. Preferably I want to arrive at this result using the analytic signal whose imaginary part would be the Hilbert transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_a(t) = 2 \int^\infty_0 FT \Big[ \frac{\sin(at)}{at} \Big] \exp(j2 \pi \nu t) \ d\nu$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this in a few different ways, but could not get to the answer.&lt;/p&gt;&#xA;" OwnerUserId="20697" LastEditorUserId="80" LastEditDate="2016-05-03T20:04:35.097" LastActivityDate="2016-05-04T08:20:38.760" Title="Hilbert transform pair proof" Tags="|fourier-transform|hilbert-transform|proof|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30522" PostTypeId="2" ParentId="30521" CreationDate="2016-05-03T08:36:20.853" Score="3" Body="&lt;p&gt;The integrand in the Hilbert transform formula is $h(t,u) = \frac{f(t)}{u-t}$. With a (non-dilated) cardinal sine, you get $$\frac{\sin(t)}{t(u-t)} = \frac{1}{u}\left( \frac{\sin(t)}{u-t}+\frac{\sin(t)}{t}\right)\,,$$ by splitting the rational fraction. The first term inside the parentheses, when integrated (with the principal value), is the Hilbert transform of a sine, $-\cos(u)$, finally divided by $u$. The second one is the integral of a cardinal sine, of value $1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the Hilbert transform is  $$\frac{1-\cos(u)}{u}\,,$$ hence $$\frac{\sin^2(u/2)}{2u}$$ since  $\sin^2(u/2) = \frac{1-\cos(u)}{2}$. Replace $u=at$, and you are done. No need to know the Fourier transform of a $\operatorname{sinc}$, no need to integrate complex functions, too complicated for me;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I like to live in danger, let me try another one, even shorter, without resorting to the analytic signal (again). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $f$  and $g$ be functions whose Fourier transforms have disjoint supports. A nice property of the Hilbert transform is the &lt;a href=&quot;http://www.rand.org/content/dam/rand/pubs/research_memoranda/2008/RM3439.pdf&quot; rel=&quot;nofollow&quot;&gt;Bedrosian theorem&lt;/a&gt;, often used in its simpler form called  &quot;Low-pass High-pass Products&quot; (there exists $W$ such that $F(w) = 0$ if $w&amp;lt; W$ and $G(w) = 0$ if $w &amp;gt; W$).&#xA;The result is:&#xA;$$\mathcal{H}(f(t)g(t)) = f(t)\mathcal{H}(g(t))\,.$$&#xA;Write $\operatorname{sinc}(t) = 2\operatorname{sinc}(t/2)\cos(t/2)$ and apply the above result with $g(t) = \cos(t/2)$:&#xA;$$\mathcal{H}(\operatorname{sinc}(t)) = 2\operatorname{sinc}(t/2)\sin(t/2)\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a sounder use of the Bedrosian theorem, let me suggest &lt;a href=&quot;http://onlinelibrary.wiley.com/doi/10.1002/mma.1221/abstract&quot; rel=&quot;nofollow&quot;&gt;A necessary and sufficient condition for a Bedrosian identity&lt;/a&gt;, 2010, using a generalized cardinal sine.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-05-04T08:20:38.760" LastActivityDate="2016-05-04T08:20:38.760" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30523" PostTypeId="1" AcceptedAnswerId="30526" CreationDate="2016-05-03T08:46:05.407" Score="0" ViewCount="175" Body="&lt;p&gt;I have studied that Fourier transform changes the domain of a signal from time to frequency, and in that way it is a 90 degree shift. When it comes to Fractional Fourier Transform a generalization of Fourier Transform, the resulting transform can lie anywhere between time and frequency domain depending on parameter 'alpha'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how in the same way Linear Canonical Transform is a generalization of Fractional Fourier Transform.Its physical interpretation in terms of signal processing.&#xA;Can any body help?&lt;/p&gt;&#xA;" OwnerUserId="20392" LastActivityDate="2016-05-03T09:54:58.070" Title="How is Linear Canonical Transform a generalization of Fractional Fourier Transform?" Tags="|fourier-transform|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30526" PostTypeId="2" ParentId="30523" CreationDate="2016-05-03T09:54:58.070" Score="0" Body="&lt;p&gt;The linear canonical transforms are all area preserving, orientation preserving, linear transforms on the time-frequency plane. The fractional Fourier transforms are a subset, namely the rotations. Both sets form (Lie-)groups under composition, and the rotations are a subgroup.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2016-05-03T09:54:58.070" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30528" PostTypeId="1" AcceptedAnswerId="30529" CreationDate="2016-05-03T13:37:14.767" Score="0" ViewCount="296" Body="&lt;p&gt;I am currently reading a section in the Handbook for MRI Pulse Sequence book where it says that the time-bandwidth product for a SINC pulse is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;T \Delta f = Z &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $T$ is the length of the pulse, $\Delta f$ is the bandwidth and $Z$ is the number of zero crossings of the SINC pulse. Now, my question might be very naive but it says that this is a dimensionless quantity but I do not understand why that will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if the bandwidth is described in radians/sec, does it not have units of radians? In that case, how does it relate to the number of zero crossings, which is indeed a discrete number.&lt;/p&gt;&#xA;" OwnerUserId="13347" LastEditorUserId="19501" LastEditDate="2016-05-03T15:05:38.227" LastActivityDate="2016-05-03T15:05:38.227" Title="Confusion with regards to units in Sinc pulse" Tags="|signal-analysis|time-frequency|bandwidth|mri|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30529" PostTypeId="2" ParentId="30528" CreationDate="2016-05-03T14:01:04.753" Score="3" Body="&lt;p&gt;The length of the pulse, $T$, would be in units of time (for example, in seconds). The bandwidth would be in units of frequency (for example, in Hz). So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$[T][\Delta f]=sec\frac{1}{sec}=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means that $Z$ is a dimensionless quantity. That makes sense, as $Z$ is just a natural number that describes the number of times that something happens (in this case, the number of zero crossings), and should not have units at all.&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-05-03T14:01:04.753" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30530" PostTypeId="2" ParentId="18824" CreationDate="2016-05-03T14:19:33.910" Score="0" Body="&lt;p&gt;There was a meteorologist (and &lt;a href=&quot;https://en.wikipedia.org/wiki/Hann_function&quot; rel=&quot;nofollow&quot;&gt;Hann window-maker&lt;/a&gt;) named &lt;a href=&quot;https://en.wikipedia.org/wiki/Julius_von_Hann&quot; rel=&quot;nofollow&quot;&gt;Julius von Hann&lt;/a&gt; , Hanning is an abuse (similarity with Hamming). You would have a better control of your code calling the &lt;code&gt;hann.m&lt;/code&gt; or the &lt;code&gt;window.m&lt;/code&gt; functions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nSample = 101; &#xA;t = linspace(0,10,nSample); &#xA;% w = hann(nSample);&#xA;w  = window(@hann,nSample);&#xA;% w = .5-.5*cos(2*pi*t/10);&#xA;plot(t,w)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope that implementing it manually does not involve computing cosine with series.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-05-03T14:19:33.910" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30531" PostTypeId="2" ParentId="30518" CreationDate="2016-05-03T14:35:41.420" Score="1" Body="&lt;p&gt;&lt;strong&gt;Assumption&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your noise is Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proposed solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compute the histogram of your data. There will be two peaks, as in the histogram you've shown. Extract the approximate positions of the peaks and use these values as starting values to fit two Gaussian curves to both peaks, each with the fit parameters $\mu$ (mean signal, i.e. position of the Gaussian) and $\sigma$ (width of the Gaussian). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your signal will then be the difference in positions of the Gaussians, and your noise is given by their widths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, there will still be contributions from the sides of the rect-pulse. However, there probably is no way to fully get rid of them, since you need some criterion to tell apart plateau values from values from the side lobes, what always becomes problematic if a point is close to the baseline/plateau. You could mitigate this effect by using the histogram values not only as datapoints for the fit, but also as fit weights. By doing so, the (low number of) side lobe values gets less weight compared to the (high number of) plateau/baseline values.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-05-03T14:35:41.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30534" PostTypeId="1" CreationDate="2016-05-03T15:55:59.717" Score="4" ViewCount="1536" Body="&lt;p&gt;What is the difference between &lt;a href=&quot;https://dsp.stackexchange.com/a/23697/80&quot;&gt;Spectral Entropy&lt;/a&gt; and &lt;a href=&quot;https://dsp.stackexchange.com/a/2047/80&quot;&gt;Spectral Flatness&lt;/a&gt;?&#xA;As far as I understand, both the terms can be calculated from the power (or amp) spectrum, and describe the flatness (whiteness) of the spectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to distinguish the voiced activity from the unvoiced one using either of these measures, which one would you use and why?&lt;/p&gt;&#xA;" OwnerUserId="20832" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-08-31T23:51:05.070" Title="Difference b/w Spectral Entropy and Flatness Measure" Tags="|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30535" PostTypeId="2" ParentId="30534" CreationDate="2016-05-03T16:17:05.303" Score="3" Body="&lt;p&gt;Assuming that you calculate the Power Spectral Entropy as per the first link I've added to the question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\rm PSE} = -\sum_{i=1}^N p_i\ln p_i $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the spectral flatness (using the same notation) would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;{\rm Flatness} = \exp\left(\frac{1}{N}\sum_{i=1}^{N} \ln p_i\right)&#xA;$$&#xA;because the $p_i$ are normalized to unit sum, so the denominator in the second linked to question is one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the two are similar in form except that Flatness appears to a) exponentiated and b) assume that the $p_i$ are uniform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to which one to use, I'd probably opt for the PSE rather than Flatness. It appears to make more use of the spectral information.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To test my theory, I've written a comparison that starts off with a purely harmonic signal and goes to a purely white noise signal and calculates both measures for each blend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is very little difference between the two measures, as you can see from the closeness of the red and blue curves in the bottom plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I've normalize both curves so they go between 0 and 1, just to make it easier to compare them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bottom line:&lt;/strong&gt; Choose the simplest; there appears to be little difference between the two for this example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YYbcu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YYbcu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30534&#xA;T &amp;lt;- 1000&#xA;white_noise &amp;lt;- rnorm(T,0,1)&#xA;&#xA;K &amp;lt;- array(seq(1,5),c(5,1)) %*% array(1,c(1,T))&#xA;omega &amp;lt;- 2*pi*0.053492384&#xA;t &amp;lt;- array(seq(0,T-1), dim=c(1,T))&#xA;t &amp;lt;- array(1,c(5,1)) %*% t&#xA;harmonic &amp;lt;- colSums(sin(omega*K*t))&#xA;&#xA;spectral_entropy &amp;lt;- function(signal)&#xA;{&#xA;  psd &amp;lt;- abs(fft(signal))^2&#xA;  psd &amp;lt;- psd/sum(psd)&#xA;&#xA;  pse &amp;lt;- 0&#xA;  for (ix in seq(1,length(psd)))&#xA;  {&#xA;    pse &amp;lt;- pse - psd[ix]*log(psd[ix])&#xA;  }&#xA;&#xA;  return(pse)&#xA;}&#xA;&#xA;flatness &amp;lt;- function(signal)&#xA;{&#xA;  psd &amp;lt;- abs(fft(signal))^2&#xA;  psd &amp;lt;- psd/sum(psd)&#xA;&#xA;  flatness &amp;lt;- 0&#xA;  for (ix in seq(1,length(psd)))&#xA;  {&#xA;    flatness &amp;lt;- flatness + log(psd[ix])/length(psd)&#xA;  }&#xA;  return (exp(flatness))&#xA;}&#xA;&#xA;&#xA;P &amp;lt;- 100&#xA;pse &amp;lt;- rep(0,P)&#xA;flt &amp;lt;- rep(0,P)&#xA;for (alpha in seq(0,P))&#xA;{&#xA;  signal &amp;lt;- white_noise*(alpha/P) + (1-alpha/P)*harmonic&#xA;  pse[alpha+1] &amp;lt;- spectral_entropy(signal)&#xA;  flt[alpha+1] &amp;lt;- flatness(signal)&#xA;}&#xA;&#xA;normalize &amp;lt;- function(signal)&#xA;{&#xA; return( (signal - min(signal))/(max(signal) - min(signal)))&#xA;}&#xA;&#xA;layout(matrix(c(1,2,3,3), 2, 2, byrow = TRUE))&#xA;plot(abs(fft(harmonic)), type=&quot;l&quot;, col=&quot;blue&quot;)&#xA;title(&quot;Harmonic Spectrum&quot;)&#xA;plot(abs(fft(white_noise)), type=&quot;l&quot;, col=&quot;blue&quot;)&#xA;title(&quot;White Noise Spectrum&quot;)&#xA;&#xA;plot(seq(0,P)/P, normalize(pse), type=&quot;l&quot;, col=&quot;blue&quot;)&#xA;lines(seq(0,P)/P, normalize(flt), type=&quot;l&quot;, col=&quot;red&quot;)&#xA;title('Comparison of PSE vs Flatness')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-05-03T17:35:30.867" LastActivityDate="2016-05-03T17:35:30.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30536" PostTypeId="2" ParentId="30521" CreationDate="2016-05-03T16:38:41.227" Score="4" Body="&lt;p&gt;I agree that one of the easiest ways to compute the Hilbert transform in this case is to use the analytic signal. This is most easily obtained via the Fourier transform. Note that the Fourier transform of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\frac{\sin(at)}{at}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(j\omega)=\frac{\pi}{a}\text{rect}\left(\frac{\omega}{2a}\right)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e., a rectangular function with value $\pi/a$ in the interval $[-a,a]$, and zero otherwise. The spectrum of the corresponding analytic signal equals the part of $F(j\omega)$ at positive frequencies, scaled by a factor of $2$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_a(j\omega)=\frac{2\pi}{a}\text{rect}\left(\frac{\omega}{a}-\frac12\right)\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse Fourier transform of $(3)$ gives the analytic signal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f_a(t)=\frac{1}{2\pi}\frac{2\pi}{a}\int_0^{a}e^{j\omega t}d\omega=\frac{1}{jat}\left(e^{jat}-1\right)=e^{jat/2}\frac{\sin(at/2)}{at/2}\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform of $f(t)$ is the imaginary part of $(4)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{f}(t)=\text{Im}\{f_a(t)\}=\frac{\sin^2(at/2)}{at/2}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as stated in your question.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-05-04T07:49:27.253" LastActivityDate="2016-05-04T07:49:27.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30538" PostTypeId="1" CreationDate="2016-05-03T17:03:17.497" Score="6" ViewCount="170" Body="&lt;p&gt;In old recordings or highly compressed audio files (lossy), the higher frequencies are lost, and we hear a distinctive muffling effect. (Just like if the song was played through a wall) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to compute the missing harmonics using any method (fourier, bilinear, etc.) and add those back to the sound/song? What is currently feasible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*It is true that those frequencies are lost, and I am not proposing to boost the higher frequencies (as it would raise the noise floor), but I thought there would be some way to approximate the missing frequencies, since we know what all the instruments &lt;em&gt;should&lt;/em&gt; sound like (we know their corresponding harmonics)...*&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm well aware of the fact &quot;garbage in, garbage out&quot;, but even so, our brain itself have very advanced processing techniques. (3D visualization using only 2D sources in vision and audition) Wound't it be possible to fool the brain in &quot;hearing&quot; a better quality sound, and give old recordings back their original sharpness?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: To be more clear, I'm proposing to make audio &quot;sound&quot; better, not to recover lost information.&lt;/p&gt;&#xA;" OwnerUserId="20838" LastEditorUserId="80" LastEditDate="2016-11-13T18:31:13.477" LastActivityDate="2016-11-13T18:31:13.477" Title="Bandwidth expansion by computing missing harmonics in music?" Tags="|audio|frequency-spectrum|algorithms|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30542" PostTypeId="2" ParentId="28624" CreationDate="2016-05-03T20:01:29.640" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If we already have enough samples of amplitudes collected at a reasonably sample rate (using Nyquist-Shannon) Why does it matter that a signal (Sinusoid) can be broken down into other sinusoids? Aren't the samples enough to reconstruct the original signal/sound?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why does it matter?  &lt;a href=&quot;https://dsp.stackexchange.com/a/70/80&quot;&gt;This answer to another question&lt;/a&gt; is mostly about the continuous-time Fourier transform, but most of it applies to the DFT also.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, the samples are enough to reconstruct the analog waveform if it was bandlimited enough when sampled. If the reason you need a discrete time signal does not involve the DFT, then there is no need to use it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is advantageous by knowing that the Fast Fourier Transform can decompose a signal into multiple signals?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Fast Fourier Transform (FFT) is an algorithmic implementation of the Discrete Fourier Transform (DFT).  The DFT's decomposition of a signal into complement (complex) sinusoids is useful for some things we want to do with the signal: filtering, for example, is the main reason we might want to transform to the Fourier domain.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The sinusoids that make up a single sinusoid also have other sinusoids that compose them. If a signal has say 5 sinusoids, those 5 sinusoids, according to DFT if I'm correct, can also each have sinusoids.. Isn't this recursive or infinite? At what point can we say we have &quot;enough&quot; sinusoids to represent a signal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For a signal of length $N$ then $N$ (complex) sinusoids are enough to represent them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick with the $N$ (complex) sinusoids used by the DFT is that they are &lt;strong&gt;periodic&lt;/strong&gt;.  That is the satisfy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;x[n] = x[n+P]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $P$ is an integer and is the period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No other discrete time (complex) sinusoids, apart from these $N$, satisfy this criterion.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-05-03T20:01:29.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30543" PostTypeId="1" AcceptedAnswerId="30591" CreationDate="2016-05-03T20:10:34.007" Score="1" ViewCount="679" Body="&lt;p&gt;I programmed an algorithm for edge detection, i want to compare it with other algorithms but with a criteria (Pratt's figure of merit, GMC1) not only a a visual comparaison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the thing is PFOM needs an image reference (known ground truth) which i don't have, and i tried to find a GMC1 algorithm but i failed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if any body can help me with reference images (known ground truth) (xray) or implementation would be much appreciated&lt;/p&gt;&#xA;" OwnerUserId="19727" LastEditorUserId="19727" LastEditDate="2016-05-03T21:00:34.853" LastActivityDate="2019-06-15T14:41:03.443" Title="edge detection evaluation medical test images MATLAB" Tags="|edge-detection|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30545" PostTypeId="1" AcceptedAnswerId="30546" CreationDate="2016-05-03T21:46:49.757" Score="1" ViewCount="132" Body="&lt;p&gt;It is known that the total power of an OFDM signal equals to the sum of the powers on each individual subcarriers. I am a bit puzzled by the total transmit power of a generalized FDM system if subcarriers are not orthogonal and if it should remain the same or changed due to the non-orthogonality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us consider the following OFDM transmit signal:&#xA;$$s(t) = \sum_{k = 0}^{N-1} a_k e^{j2\pi f_k t} = \sum_{k = 0}^{N-1} a_k e^{j2\pi \frac{k \: \phi}{T} t}, \quad 0\leq t\leq T,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k$ is the subcarrier index, $a_k$ are i.i.d. data symbols with zero mean, $N$ is the total number of subcarriers, $T$ is the FDM symbol duration, and $\phi &amp;lt; 1$ is introduced to break the orthogonality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transmit power is represented as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ P = \frac{1}{T} \int_{0}^{T} s(t) \: s^*(t) dt,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be further simplified as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P = \frac{1}{T} \sum_{k = 0}^{N-1} \sum_{k' = 0}^{N-1} a_k a^*_{k'} \int_{0}^{T} e^{j2\pi \phi (k - k')t/T} dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the value of the integral $\int_{0}^{T} e^{j2\pi \phi (k - k')t/T} dt$ does not equal to $0$ if $k \neq k'$ (due to the non-orthogonality introduced by $\phi$). This means that the transmit power in case of non-orthogonal subcarriers is no longer equals the sum of the power on each subcarrier? However, it is higher than the sum!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel there is something wrong in this simple derivation, as by intuition, if a power source spends a certain amount of power on each subcarrier, then how come the total power will be greater than the sum of these individual powers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;========================&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Update&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The following update to make the modeling of non-orthogonality more clear. Let us consider the FDM signal written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s(t) = \sum_{k = 0}^{N-1} a_k e^{j2\pi (f_k + \delta_k) t} = \sum_{k = 0}^{N-1} a_k e^{j2\pi (\frac{k \:}{T} + \delta_k) t}, \quad 0\leq t\leq T,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\delta_k$ is the frequency offset on subcarrier $k$. Following similar approach, the power $P$ can be found as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P = \frac{1}{T} \sum_{k = 0}^{N-1} \sum_{k' = 0}^{N-1} a_k a^*_{k'} \int_{0}^{T} e^{j2\pi (k/T + \delta_k - k'/T - \delta_{k'})t} dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which does not equal to the sum of power on individual subcarriers.&lt;/p&gt;&#xA;" OwnerUserId="15078" LastEditorUserId="15078" LastEditDate="2016-05-04T04:12:49.403" LastActivityDate="2016-05-04T04:12:49.403" Title="Transmit power of non-orthogonal FDM" Tags="|continuous-signals|ofdm|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30546" PostTypeId="2" ParentId="30545" CreationDate="2016-05-04T01:45:54.573" Score="3" Body="&lt;p&gt;In your example, the sinusoids are still orthogonal to one another; the key is that you must integrate over the correct period when calculating $P$. All of the sinusoids have frequencies that are multiples of $\frac{\phi}{T}$, so their resulting sum will have period $\frac{T}{\phi}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should therefore take this fact into account when calculating the average power over a period of $s(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P = \frac{\phi}{T} \sum_{k = 0}^{N-1} \sum_{k' = 0}^{N-1} a_k a^*_{k'} \int_{0}^{\frac{T}{\phi}} e^{j2\pi \phi (k - k')t/T} dt&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this formulation, then you do get the useful property that the integral is zero for all $k \ne k'$, which allows you to simplify the expression to be simply the sum of the powers of each of the sinusoids.&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2016-05-04T01:45:54.573" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30547" PostTypeId="1" CreationDate="2016-05-04T01:54:55.577" Score="3" ViewCount="108" Body="&lt;p&gt;In article &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=7321034&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ghimpeteanu G., et al. - A Decomposition Framework for Image Denoising Algorithms&lt;/a&gt;, I found as below:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Let $\displaystyle I : \Omega \subset \mathbb{R}^2\mapsto \mathbb{R}$ be a gray-level image, and $(x, y)$ be the standard coordinate system of $\mathbb{R}^2$.We denote by $Ix&#xA; \hspace{.2cm}resp.Iy$ the derivative of $I$ with respect to $x&#xA; \hspace{.2cm}resp. y$, and by $\nabla I$ the gradient of $I$ . Our&#xA;  image decomposition model for $I$ is a two-stages approach: first, we&#xA;  construct an orthonormal moving frame $(Z_1, Z_2, N)$ of $(\mathbb{R}^3,\|&#xA;\|_2)$ over $\Omega$ that encodes the local geometry of $I$ . Then, we&#xA;  compute the components $(J^1, J^2, J^3)$ of the $\mathbb{R}^3-$valued function&#xA;  $(0, 0, I )$ in that moving frame. More precisely, we consider a&#xA;  scaled version $\mu I$ of $I$ , for $\mu \in ]0, 1]$, and its graph,&#xA;  which is the surface $S$ in $\mathbb{R}^3$ parametrized by $\psi : (x, y)&#xA;\mapsto (x, y,μ I (x, y))$&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;See snapshot-&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wfoJv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wfoJv.png&quot; alt=&quot;demo&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please someone explain (possibly visualize &lt;strong&gt;geometrically&lt;/strong&gt;) 4th and 5th line of the excerpt. i.e &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Our image decomposition model for $I$ is a two-stages approach: first, we construct an orthonormal moving frame $(Z_1, Z_2, N)$ of $(\mathbb{R}^3,\| \|_2)$ over $\Omega$ that encodes the local geometry of $I$ . Then, we compute the components $(J^1, J^2, J^3)$ of the $\mathbb{R}^3-$valued function $(0, 0, I )$ in that moving frame.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="20840" LastEditorUserId="80" LastEditDate="2016-11-15T09:45:39.853" LastActivityDate="2016-12-15T10:29:45.190" Title="Geometric explanation of a methodology in the article about Image Denoising" Tags="|image-processing|linear-algebra|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30549" PostTypeId="2" ParentId="27360" CreationDate="2016-05-04T02:27:20.980" Score="1" Body="&lt;p&gt;intensity is the amplitude of the RGB values in if transparency is 1, so you can get brightness by the sum of the rgb values, 1,1,1 is white. 0,0,0 is black. average the entire image and you have its intensity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;also it's the V value of HSV, so you can use rgb or hsv, map the average v per pixel and you have it's intensity also. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that blue and green and red appear to the eye to be the same brightness for the same digital level, but if the eye perceives the three with a small difference in intensity ina non linear way you can probably get some academic research and graph the psychointensity value of it depending on the color. &lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2016-05-04T02:27:20.980" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30550" PostTypeId="1" CreationDate="2016-05-04T04:12:42.220" Score="0" ViewCount="35" Body="&lt;p&gt;Let $w$ be our image. For example, consider the following with the vectorized $w$:&#xA;$$ E(w) = \frac 12 \|Aw+b\|_2^2 $$&#xA;I know the optimal condition of the above equation:&#xA;$$ \nabla_wE = A^TA\hat w + b = 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we consider the filtered image by Gaussian such that&#xA;$$ E(w) = \frac 12 \|A (G * w)+b\|_2^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, how to get the optimal condition? (i.e., how to derivative w.r.t $w$?)&lt;/p&gt;&#xA;" OwnerUserId="4367" LastActivityDate="2016-05-04T17:53:04.460" Title="Derivative of equation containing Gaussian filtered image" Tags="|gaussian|derivative|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30551" PostTypeId="1" AcceptedAnswerId="30791" CreationDate="2016-05-04T04:39:45.173" Score="2" ViewCount="379" Body="&lt;p&gt;One of the properties I have seen for isotropic tight wavelet frames is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{i\in\mathbb{Z}} \left|h(2^i\omega)\right|^2 = 1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $h(\omega)$ is the frequency spectrum of the original wavelet. See page 8 in &lt;a href=&quot;http://bigwww.epfl.ch/preprints/unser1202p.pdf&quot; rel=&quot;nofollow&quot;&gt;A unifying parametric framework for steerable wavelet transforms.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have always assumed that this enables the downsampling often seen in wavelet decompositions, which start off with a wavelet satisfying $h(\omega) = 1\, \forall \omega &amp;gt; \pi/2$, meaning that the top half of the spectrum is covered and thus subsampling of the low pass remainder is possible because there are no longer any frequencies above $\pi/2$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this correct? &lt;/li&gt;&#xA;&lt;li&gt;Or can you perform downsampling still having frequencies above $\pi/2$?&lt;/li&gt;&#xA;&lt;li&gt;If one does not need downsampling or wants to have different partitions, is the following condition sufficient,&#xA;$$\sum_{i=1}^{I} \left|h_i(\omega)\right|^2 = 1$$&#xA;where $\{h_i(\omega)\}$ are the frequency responses of the wavelets in the frame?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2046" LastEditorUserId="15892" LastEditDate="2016-05-09T20:13:08.750" LastActivityDate="2016-05-14T14:39:54.763" Title="Subsampling property of wavelet transform" Tags="|image-processing|wavelet|geometry|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30552" PostTypeId="1" AcceptedAnswerId="30559" CreationDate="2016-05-04T06:46:14.740" Score="2" ViewCount="32795" Body="&lt;p&gt;I am having some trouble understanding the sampling time and frequency used in the computing of the FFT, and I was wondering if someone could make it clear for me :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Sampling time: the time in which I took my sample for example 5 minutes, its the difference between the time at which i started taking measures and the time when I was done.&lt;/li&gt;&#xA;&lt;li&gt;The sampling rate: how many samples do I save per second, which means if I took $N$ sample within $13\textrm{ s}$, my Sampling rate will be $f_s=N/13$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this sampling rate the same as the frequency used when calculating the FFT when creating the frequency axis of the FFT?&lt;/p&gt;&#xA;" OwnerUserId="20763" LastEditorUserId="8202" LastEditDate="2016-05-04T08:26:11.723" LastActivityDate="2016-06-03T08:35:08.323" Title="Sampling rate vs sampling time of FFT" Tags="|fft|frequency-spectrum|sampling|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30553" PostTypeId="1" CreationDate="2016-05-04T06:58:45.087" Score="-1" ViewCount="1343" Body="&lt;p&gt;This example code was used to answer a question about applying a window on the Fourier amplitude spectrum. &lt;a href=&quot;https://dsp.stackexchange.com/questions/9465/how-to-apply-hamming-window&quot;&gt;How to apply Hamming Window?&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a question about the section of code related to the variable &lt;code&gt;mYdft&lt;/code&gt;. It's altered 3 times and I'm not sure why. Could someone elaborate on what's going on here? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Complete example code for reference: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ts = 50e-6;                  % Sampling Time(s)&#xA;Fs = 1/Ts;                   % Sampling rate, Sampling Freq (Hz)&#xA;f0 = 50;                     % Frequency of interest (Hz)&#xA;duraT = 1;&#xA;&#xA;%Calculate time axis&#xA;dt = 1/Fs;&#xA;tAxis = dt:dt:(duraT-dt);&#xA;&#xA;y = cos(2*pi*f0*tAxis) +  2*sin(2*pi*10*tAxis);   y=y';&#xA;&#xA;L = length (y); % Window Length of FFT    &#xA;nfft = 2^nextpow2(L); % Transform length&#xA;&#xA;y_HannWnd = y.*hanning(L);            &#xA;Ydft_HannWnd = fft(y_HannWnd,nfft)/L;&#xA;&#xA;% at all frequencies except zero and the Nyquist&#xA;mYdft = abs(Ydft_HannWnd);&#xA;mYdft = mYdft (1:nfft/2+1);&#xA;mYdft (2:end-1) = 2* mYdft(2:end-1);&#xA;&#xA;f = Fs/2*linspace(0,1,nfft/2+1); &#xA;&#xA;figure(1),&#xA;subplot(2,1,1)&#xA;plot(tAxis,y)&#xA;title('Time Domain y(t)');&#xA;xlabel('Time,s'); &#xA;ylabel('y');&#xA;subplot(2,1,2)  &#xA;plot(f,2*mYdft); % why need *2 ? Bcoz, Hanning Wnd Amplitude Correction Factor = 2&#xA;axis ([0 500 0 5]); %Zoom in &#xA;title('Amplitude Spectrum with Hann Wnd');&#xA;xlabel('Frequency (Hz)with hanning window'); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20844" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.457" LastActivityDate="2016-05-04T08:07:46.177" Title="Explain how to apply Hanning window to Fourier amplitude spectrum" Tags="|matlab|fft|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30554" PostTypeId="1" AcceptedAnswerId="30556" CreationDate="2016-05-04T07:53:42.407" Score="2" ViewCount="309" Body="&lt;p&gt;Show that the Hilbert transform of $h(t) = m(t) \cos(2 \pi \nu_c t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{h} (t) = m(t) \sin(2 \pi \nu_c t),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $m(t)$ is a real valued, band-limited function (i.e. we have Fourier transform $M(\nu) = 0$ for $|\nu| &amp;gt; \nu_m$) and $\nu_c &amp;gt; \nu_m.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did some research and I found out that this result follows directly from 'Bedrosian's theorem'. But I am required to compute this by first finding its analytic signal $h_a$ whose imaginary part would then be the Hilbert transform. Here is my expression for $h_a (t):$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_a (t) = 2 \int^\infty_0 \Big[ H(\nu) \Big] e^{j 2 \pi \nu t} \ d\nu = 2 \int^\infty_0 \Big[ \frac{1}{2} (M(\nu + \nu_c) + M(\nu - \nu_c)) \Big] e^{j 2 \pi \nu t} \ d\nu.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the 'modulation property' of the Fourier transform to get to the RHS. So how can I proceed with the integration when we do not have an explicit expression for $m(t)$?&lt;/p&gt;&#xA;" OwnerUserId="20697" LastEditorUserId="4298" LastEditDate="2016-05-04T08:45:14.443" LastActivityDate="2016-05-04T08:57:21.313" Title="Hilbert transform from analytic signal" Tags="|fourier-transform|hilbert-transform|proof|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30555" PostTypeId="2" ParentId="30553" CreationDate="2016-05-04T08:07:46.177" Score="0" Body="&lt;p&gt;From &lt;code&gt;mYdft = abs(Ydft_HannWnd)&lt;/code&gt;, the variable &lt;code&gt;mYdft&lt;/code&gt; is the absolute value of the elements of the Fourier transform of the time-domain windowed signal &lt;code&gt;y_HannWnd&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the line &lt;code&gt;mYdft = mYdft (1:nfft/2+1)&lt;/code&gt;, a single side of the spectrum is taken instead of the full vector. Since half of the energy is on the positive side of the spectrum and half on the negative side, for a complete representation of the single side spectrum you multiply all the elements by a factor 2 except for the DC value, i.e. &lt;code&gt;2:end-1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the plot, &lt;code&gt;plot(f,2*mYdft)&lt;/code&gt;, the resulting single-side spectrum is simply multiplied by a factor of 2.&lt;/p&gt;&#xA;" OwnerUserId="1629" LastActivityDate="2016-05-04T08:07:46.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30556" PostTypeId="2" ParentId="30554" CreationDate="2016-05-04T08:10:16.070" Score="2" Body="&lt;p&gt;Note that the condition on the relation between the bandwidth of $m(t)$ and the modulation frequency ensures that $h(t)$ is a band pass signal. It can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h(t)=\frac12 m(t)e^{j2\pi \nu_c t}+\frac12 m(t)e^{-j2\pi \nu_c t}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From our assumption $\nu_m&amp;lt;\nu_c$ it follows that the two expressions on the right-hand side of $(1)$ do not overlap in the frequency domain. Consequently, the analytic signal is simply given by the first term on the right-hand side of $(1)$ (scaled by a factor of $2$), which is the part of the spectrum of $h(t)$ occurring at positive frequencies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_a(t)=m(t)e^{j2\pi\nu_c t}\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hilbert transform of $h(t)$ is given by the imaginary part of $(2)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{h}(t)=\text{Im}\{h_a(t)\}=m(t)\sin(2\pi\nu_c t)\tag{3}$$&#xA;&lt;hr&gt;&#xA;&lt;strong&gt;EDIT:&lt;/strong&gt; The equation for $h_a(t)$ given in your question is also correct. If you want to continue that way, it's important to see that due to $\nu_c&amp;gt;\nu_m$, $M(\nu+\nu_c)$ equals zero for $\nu&amp;gt;0$. So the integral can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_a(t)=\int_0^{\infty}M(\nu-\nu_c)e^{j2\pi\nu t}d\nu\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Likewise, $M(\nu-\nu_c)$ is zero for $\nu&amp;lt;0$, so we can extend the lower integration limit in $(4)$ to $-\infty$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$h_a(t)=\int_{-\infty}^{\infty}M(\nu-\nu_c)e^{j2\pi\nu t}d\nu=\mathcal{F}^{-1}\{M(\nu-\nu_c)\}=m(t)e^{j2\pi\nu_c t}\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is of course identical to $(2)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-05-04T08:57:21.313" LastActivityDate="2016-05-04T08:57:21.313" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30557" PostTypeId="1" AcceptedAnswerId="30727" CreationDate="2016-05-04T08:15:03.217" Score="2" ViewCount="498" Body="&lt;p&gt;When I read papers on image denoising, I always encounter sparse representation. For image denoising, we try to separate image signal from noise. It is assumed that signal is correlated and noise is uncorrelated. Sparse representation represents one signal as a linear combination of a small number of dictionary elements. It hope to use as few as non-zero coefficients to represent signal. In my view, it is appropriate for image compression. How can it is related to image denoising?&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2016-05-13T06:07:37.647" Title="sparse representation for image denoising" Tags="|image-processing|denoising|sparsity|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30558" PostTypeId="2" ParentId="30552" CreationDate="2016-05-04T08:20:25.120" Score="-1" Body="&lt;p&gt;When you calculate the Discrete Fourier Transform of a signal, if you have N samples as an input, you calculate two half-sized arrays which are N/2+1 values long.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It implies that when sampling at Fs, you cannot represent frequencies that are higher than Fs/2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the frequency axis resulting of a FFT cannot be higher than Fs/2.&lt;/p&gt;&#xA;" OwnerUserId="20812" LastActivityDate="2016-05-04T08:20:25.120" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30559" PostTypeId="2" ParentId="30552" CreationDate="2016-05-04T08:29:18.247" Score="3" Body="&lt;p&gt;The sampling time is the time interval between successive samples, also called the sampling interval or the sampling period, and denoted $T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sampling rate is the number of samples per second. It is the reciprocal of the sampling time, i.e. $1/T$, also called the sampling frequency, and denoted $F_s$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency axis for the FFT is linked to the number $N$ of points in the DFT and the sampling rate $F_s$. It is defined as $f=k\cdot\frac{F_s}{N}$. With $k$ going up to $N$ &lt;/p&gt;&#xA;" OwnerUserId="1629" LastActivityDate="2016-05-04T08:29:18.247" CommentCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="30560" PostTypeId="2" ParentId="16711" CreationDate="2016-05-04T08:33:34.483" Score="0" Body="&lt;p&gt;The only information you need about each shape is the outer edge, using edge detection. A good edge detection for the outer edge can be to start in a black zone distant to the centre of mass and iterate towards and around the form. Once you have the edge, you only need to measure the angle in between points on the edge in segments, and measure the regularity of the edge of the shape. If there is a large deviation from the regular circular tendency which extends the edge away from the center  on a central axis leading towards the center, then it is a tail. You can measure the same algorithm clockwise and counter clockwise.&lt;/p&gt;&#xA;" OwnerUserId="12103" LastActivityDate="2016-05-04T08:33:34.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30562" PostTypeId="1" AcceptedAnswerId="30565" CreationDate="2016-05-04T09:30:51.063" Score="9" ViewCount="6763" Body="&lt;p&gt;I am using the Ettus X310 SDR and GNU radio. On the GNU radio schema I have a standard UHD USRP source block connected to a GUI FFT sink - basically I'm just displaying the spectrum of the raw signal from the device. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parameters for the USRP source block:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;sample rate = 1.024 MS/s, &lt;/li&gt;&#xA;&lt;li&gt;center freq = 101 MHz, &lt;/li&gt;&#xA;&lt;li&gt;gain = 42 dB, &lt;/li&gt;&#xA;&lt;li&gt;bandwidth = 130 MHz&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The problem that I have is that I always have a big spike (10-15 dB) directly on the center frequency (no matter what frequency I set). I am relatively new to all this so I would appreciate any pointers on how to get rid of the spike.&lt;/p&gt;&#xA;" OwnerUserId="20849" LastEditorUserId="13320" LastEditDate="2016-05-04T09:40:33.943" LastActivityDate="2016-05-04T10:14:27.850" Title="Large spike at the center frequency when using Ettus X310" Tags="|frequency-spectrum|software-defined-radio|gnuradio|usrp|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30563" PostTypeId="1" AcceptedAnswerId="30568" CreationDate="2016-05-04T10:00:49.497" Score="0" ViewCount="465" Body="&lt;p&gt;I'm trying to measure the amplitude of a spectral component in a signal. The component's frequency is always known beforehand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take a given number of samples, apply the flattop window to reduce scalloping loss, then use FFT and look at the bin of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The earlier method used adaptable sampling frequency ($f_s$ was an integer multiple of the signal frequency) -&gt; no windowing was needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compared to the earlier method, measurements with the new method have a lot more variance. I suspect that it is the window that picks up the noise (convolution over the whole spectrum, where there are other strong components).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $f_s$ is either 312 KS/s or 625 KS/s, the signal frequency is 2-15 KHz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;How could I improve my measurement?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Is there an other method which exploits the fact that the frequency of the signal is always exactly known?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="20721" LastEditorUserId="80" LastEditDate="2016-05-04T11:41:39.573" LastActivityDate="2016-05-04T14:42:12.963" Title="Measuring amplitude of a spectral component" Tags="|fft|discrete-signals|power-spectral-density|measurement|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30564" PostTypeId="1" CreationDate="2016-05-04T10:08:02.743" Score="1" ViewCount="244" Body="&lt;p&gt;&lt;strong&gt;Part A: Obtain signal waveform from mathematical equation of the signal&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let a sinusoidal periodical signal is represented by an equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y=f(t)=10+10\cos\left(\frac{2\pi f_1t}{T} +\frac{\pi}{6}\right)+10\sin\left(\frac{2\pi f_2t}{T}+ \frac{\pi}{3}\right)\tag{1}$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, let us take $f_1=10 ,f_2=5 ,T=100$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, with this we can get the &lt;strong&gt;waveform of the signal $y$&lt;/strong&gt; on Cartesian axis with magnitude as $Y$-axis and time as $X$-axis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Sorry but I don't have any software tool now so that I could show the waveform diagram)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Part B: Obtain mathematical equation of the signal from its waveform and Fourier series formula.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. part B is reverse of part A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, my question is that how can we obtain (probably the same) mathematical equation $(1)$ for signal $y$ from &lt;strong&gt;waveform of signal $y$ and Fourier series formula&lt;/strong&gt;&#xA;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourier series formula for any sinusoidal periodical signal $y$ is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ y(t) = \sum\limits_{m=0}^{+\infty} a_m \cos(w_m t) + \sum\limits_{m=0}^{+\infty}b_m \sin(w_m t). \tag{2}$$&lt;/p&gt;&#xA;" OwnerUserId="20848" LastEditorUserId="80" LastEditDate="2016-11-21T08:43:43.707" LastActivityDate="2017-09-17T13:42:39.120" Title="Signal equation using signal waveform and Fourier series?" Tags="|homework|fourier-series|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30565" PostTypeId="2" ParentId="30562" CreationDate="2016-05-04T10:14:27.850" Score="11" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The problem that I have is that I always have a big spike (10-15 dB)&#xA;  directly on the center frequency (no matter what frequency I set). I&#xA;  am relatively new to all this so I would appreciate any pointers on&#xA;  how to get rid of the spike.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That spike is probably nothing surprising – just the LO leakage/DC offset, a very common artifact in direct conversion receivers!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, getting rid of it with a USRP is relatively simple. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to understand that the USRPs have a two-step tuning process:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There's a physical oscillator, the LO, which gets synthesized by the daughterboard, and is used to mix down the target signal to IQ baseband signals. Typically, synthesizers can only generate a discrete set of LO frequencies $f_\text{RF}$.&lt;/li&gt;&#xA;&lt;li&gt;The ADC then samples these signals at the master clock rate, and the FPGA digitally shifts that sample stream in the master clock rate (i.e. 200 MHz for the X310 by default) wide baseband by essentially multiplying with $e^{j2\pi f_\text{offset} n}$, to give you your baseband signal from the desired $f_\text{target}$:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HmPSz.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HmPSz.png&quot; alt=&quot;bandwidth/ offset tuning visualization&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By default, $f_\text{RF}$ is set as closely as possible to $f_\text{target}$, minimizing $f_\text{offset}$, and hence, putting the LO into your observed bandwidth $b_\text{sample}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, however, manually set a &quot;desired&quot; $f_\text{offset}$; as soon as that is more than $\frac 12 b_\text{sample}$, the LO is out of your observer band!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of using &lt;code&gt;101e6&lt;/code&gt; in the &lt;em&gt;Center Frequency&lt;/em&gt; input field, just use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;uhd.tune_request(f_target, f_offset)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;uhd.tune_request(101e6, 4e6)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;hr/&gt;&#xA;&lt;hr/&gt;&#xA;Let me comment on a few other issues directly, too:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I am using the Ettus X310 SDR and GNU radio. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The X310 is the platform, indeed, but the actual analog signal processing (generating the LOs for mixing, mixing, amplification, baseband filtering) happens on the daughterboard. In such cases, it's usually important to specify which daughterboard you're using&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;On the GNU radio schema I&#xA;  have a standard UHD USRP source block connected to a GUI FFT sink -&#xA;  basically I'm just displaying the spectrum of the raw signal from the&#xA;  device. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Indeed, that should work. Notice that the WX Gui blocks are kind of becoming deprecated; if you're just starting with GNU Radio and don't need to continue an existing application based on WX, I'd recommend changing the &quot;build options&quot; in the option block to &quot;Qt&quot;, and replacing the &quot;WX GUI FFT sink&quot; with a &quot;Qt GUI frequency sink&quot;. Same thing, more functionality, less CPU usage, usually.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Parameters for the USRP source block:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;sample rate = 1.024 MS/s, &lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You probably were using a master clock rate of 184.32 MHz, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For future readers, reproducing this (this specific rate really comes up more often then you'd think!):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The X310 doesn't support that sampling rate in the default configuration! The console window should contain a clear warning that UHD decided to use a different frequency, and which frequency that was – in your case, probably 1.02048… MS/s.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;UHD Warning:&#xA;    The hardware does not support the requested RX sample rate:&#xA;    Target sample rate: 1.024000 MSps&#xA;    Actual sample rate: 1.020408 MSps&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That's because the X310 runs its ADC/DAC at what is called the &lt;em&gt;master clock rate&lt;/em&gt;, which can take the values 200 MHz (default), 184.32 MHz (typical for some cellular network standards), 120 MHz (typical for LabView). The sample rate you deliver to the PC is a sample stream sampled at that rate, decimated in the FPGA to the rate you're requesting – and that decimation is done with &quot;normal&quot; decimating FIR filters, which can only give you an integer fraction of the input rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1.020408… \frac{\text{MS}}{s} = \frac{200\frac{\text{ MS}}{s}}{196}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;is possible, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$1.024 \frac{\text{MS}}{s} = \frac{200\frac{\text{ MS}}{s}}{195.3125}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;is not, when the MCR is set to it's default of 200 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With an MCR of $184.32\text{ MHz}$, which is $1.024\text{ MHz}*180$, this is indeed possible!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;center freq = 101 MHz, &lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which probably means you're using the WBX or UBX daughterboard,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;gain = 42 dB, &lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which is not a gain setting that UBX or WBX support, their gain ranges are 0 – 31.5 dB and 0 – 31 dB, respectively.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;bandwidth = 130 MHz&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's the analog bandwidth specification; it applies to daughterboards with adjustable baseband low pass filters. However, there's no daughterboard in existence that has an adjustable baseband filter and a maximum bandwidth &gt; 8 MHz.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, this setting does nothing on UBX or WBX.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-05-04T10:14:27.850" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30566" PostTypeId="5" CreationDate="2016-05-04T10:16:37.517" Score="0" Body="&lt;p&gt;Software-Defined Radio (SDR) takes the analog signal processing and moves it, as far as physically and economically feasible, to processing the radio signal on a computer using algorithms in software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Software Defined Radio, by itself, not a solution to talk to any specific hardware. Nor does it provide out-of-the-box applications for specific radio communications standards (e.g., 802.11, ZigBee, LTE, etc.,); the SDR developer is in charge of writing software that implements communication given a specific standard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SDR requires knowledge about RF signals, the mathematical description of signals in pass- and baseband, digital signal processing and of course software development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Text partly based on &lt;a href=&quot;https://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorial_Introduction&quot; rel=&quot;nofollow&quot;&gt;GNU Radio's introduction to SDR&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-05-04T11:42:17.110" LastActivityDate="2016-05-04T11:42:17.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30567" PostTypeId="4" CreationDate="2016-05-04T10:16:37.517" Score="0" Body="Software Defined Radio (SDR) is the implementation of radio receiver, detector and transmitter systems in software, as opposed to analog hardware or application-specific ICs. It usually uses a baseband sampled representation of the RF bandpass signals." OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2016-05-04T11:42:25.283" LastActivityDate="2016-05-04T11:42:25.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30568" PostTypeId="2" ParentId="30563" CreationDate="2016-05-04T10:30:10.650" Score="1" Body="&lt;p&gt;If you know the frequency beforehand you can simply correlate the signal with a sine and cosine of that frequency and find the magnitude of the response. This is what the DFT is doing at that bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $x[t]$ be your signal, and $f_c$ be the frequency you are interested in, and $f_s$ be your sample rate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a = \left&amp;lt;x,\cos(2\pi t f_c/f_s)\right&amp;gt;$$&#xA;$$ b = \left&amp;lt;y,\sin(2\pi t f_c/f_s)\right&amp;gt;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the amplitude is equal to $\sqrt{a^2 + b^2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you are getting some noise, then other components of the signal are also putting energy into that frequency. It might work to split the signal into blocks, calculate the amplitude for each block, then find median or discard outliers and find the average.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-05-04T10:30:10.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30569" PostTypeId="1" AcceptedAnswerId="30572" CreationDate="2016-05-04T11:29:24.643" Score="0" ViewCount="2161" Body="&lt;p&gt;I have a signal for which I know the OFDM burst length (from the autocorrelation function of the signal) &lt;code&gt;T_burst&lt;/code&gt; and the FFT size 1024 (by measuring the channel spacing) and the guard interval (128). &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How should sample such a signal for OFDM demodulation ? &lt;/li&gt;&#xA;&lt;li&gt;What is the ideal sample rate for that ? &lt;/li&gt;&#xA;&lt;li&gt;Is it &lt;code&gt;(1024+128)/T_burst&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I plan to use GNU radio for demodulation, like this (this image is from IRC channel - credit to drmpeg):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bXjXu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bXjXu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="19066" LastEditorUserId="1629" LastEditDate="2016-05-04T12:11:43.877" LastActivityDate="2016-05-04T12:11:43.877" Title="OFDM demodulation, how to set the sampling rate?" Tags="|sampling|demodulation|ofdm|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30570" PostTypeId="2" ParentId="30564" CreationDate="2016-05-04T11:39:51.533" Score="1" Body="&lt;p&gt;&lt;a href=&quot;http://mathworld.wolfram.com/FourierSeries.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Did you check the usual equations?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XWA4P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XWA4P.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Responding to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The steps I should follow are &lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;Find $f(x)$ from the signal waveform &lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Compute $a_0$, $a_n$, $b_n$ &lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Put above values into the (2) and see whether I get (1) or not.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Essentially, yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your equation to relate to the $f(x)$ in the image above you may want to think about &#xA;$$&#xA;w_m = \frac{2\pi 5 m}{100} = \frac{\pi m}{10}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that there needs to be an integer (or rational) ratio between $f_1$ and $f_2$ in your equation (1).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-05-04T13:24:59.467" LastActivityDate="2016-05-04T13:24:59.467" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30571" PostTypeId="1" CreationDate="2016-05-04T11:45:13.143" Score="2" ViewCount="575" Body="&lt;p&gt;In a waveform designing i am getting this type of constellation(image_attached).&#xA;Can anyone please tell me why i am getting this type of constellation?&#xA;this constellation is after frequency correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mCOuc.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mCOuc.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20850" LastEditorUserId="80" LastEditDate="2016-05-04T11:49:14.497" LastActivityDate="2016-05-05T04:37:01.873" Title="Problem in constellation diagram" Tags="|qpsk|constellation-diagram|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30572" PostTypeId="2" ParentId="30569" CreationDate="2016-05-04T11:48:27.723" Score="3" Body="&lt;p&gt;Your receiver will consist of, apart from synchronization blocks, an FFT. You want that FFT to generate one output bin for each of the subcarriers. Therefore, you should make use of the relationship between the input sample rate of a DFT to its output bin spacing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\Delta f = \frac{f_s}{N_{FFT}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\Delta f$ is the subcarrier spacing and $f_s$ is the sample rate (both in Hz). Assuming you know the subcarrier spacing and the FFT size, then it's straightforward to choose the sample rate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;f_s = N_{FFT} \Delta f&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="90" LastActivityDate="2016-05-04T11:48:27.723" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30573" PostTypeId="2" ParentId="29878" CreationDate="2016-05-04T13:45:26.867" Score="0" Body="&lt;p&gt;Are you sure you are using &lt;a href=&quot;http://www.mathworks.com/help/matlab/ref/ismember.html&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;ismember&lt;/code&gt;&lt;/a&gt; correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like &lt;code&gt;ismember&lt;/code&gt; returns a boolean array... so plotting it might not be giving you what you intend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you loop through &lt;code&gt;stats&lt;/code&gt; and just pull out the appropriate entries in &lt;code&gt;v&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At least try plotting the &lt;code&gt;stats.Centroid&lt;/code&gt; for all the objects with the right orientation, to see if that's giving what you expect.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-04T13:45:26.867" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30575" PostTypeId="1" AcceptedAnswerId="30578" CreationDate="2016-05-04T14:27:40.533" Score="2" ViewCount="16949" Body="&lt;p&gt;I want to know the difference between the two Gaussian noises generated below? Which one is white and how can i make the other one white?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=wgn(1,10000,0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y=randn(1,10000);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9130" LastEditorUserId="80" LastEditDate="2016-05-04T14:33:05.440" LastActivityDate="2019-01-25T04:09:13.967" Title="generating white gaussian noise in matlab using two different functions" Tags="|matlab|noise|gaussian|stochastic|" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30576" PostTypeId="2" ParentId="30563" CreationDate="2016-05-04T14:42:12.963" Score="2" Body="&lt;p&gt;A variation on @geometrikal's answer would be to use the &lt;a href=&quot;https://dsp.stackexchange.com/a/6065/80&quot;&gt;Goertzel Algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y[n] = x[n] + e^{+j\omega_0} y[n-1]&#xA;$$&#xA;where $x[n]$ is your input signal, $\omega_0$ is the frequency you know, and $y[n]$ is the (complex-valued) estimate of the discrete Fourier coefficient.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-05-04T14:42:12.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30577" PostTypeId="2" ParentId="30547" CreationDate="2016-05-04T14:56:58.463" Score="1" Body="&lt;p&gt;The explanation below the section you quote seems to be clear to me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kdszs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kdszs.png&quot; alt=&quot;Screenshot from paper&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's forming a vector field made up of the largest gradient direction, smallest gradient direction, and the normal to them both.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-04T14:56:58.463" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30578" PostTypeId="2" ParentId="30575" CreationDate="2016-05-04T15:02:37.147" Score="5" Body="&lt;p&gt;A &lt;strong&gt;white&lt;/strong&gt; noise sequence is one for which each (random) element is uncorrelated from every other element:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E[y[n]y[m]] = \left \{ \begin{array}{ll}&#xA;0 &amp;amp; \mbox{for } n\not=m\\&#xA;\sigma_y^2 &amp;amp; \mbox{for } n = m&#xA;\end{array}&#xA;\right . \\= \sigma_y^2 \delta[n-m]&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma^2_y$&lt;/span&gt; is the variance of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I am assuming (because of the whiteness) that the signal is zero mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whiteness of a signal says &lt;strong&gt;nothing&lt;/strong&gt; about the distribution of its values.  To know something about that, &lt;em&gt;Gaussianity&lt;/em&gt; or some other distribution needs to be invoked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The functions &lt;code&gt;wgn&lt;/code&gt; and &lt;code&gt;randn&lt;/code&gt; both produce &lt;strong&gt;white,&lt;/strong&gt; &lt;strong&gt;Gaussian&lt;/strong&gt; noise sequences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calling the function &lt;code&gt;rand&lt;/code&gt; would produce a &lt;strong&gt;white&lt;/strong&gt;, &lt;strong&gt;uniformly distributed&lt;/strong&gt; noise sequence.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="15353" LastEditDate="2019-01-25T04:09:13.967" LastActivityDate="2019-01-25T04:09:13.967" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="30579" PostTypeId="1" AcceptedAnswerId="30594" CreationDate="2016-05-04T15:17:09.917" Score="0" ViewCount="102" Body="&lt;p&gt;I am trying to learn digital Image processing by myself and now stuck at a problem in the two dimensional unitary transformations. It states that let $U$ be the input image and $V$ be the transformed image and $A$ is the unitary transformation matrix.&#xA;To prove above equation I am rather trying to prove $$U^2=V^2$$ which I think is equivalent to proving equation in question.We have $$ V=A U A^T $$ now to prove the above relation: $$V^2=V^{*T} V$$ where &#xA; $$ V=A U A^T \mbox{ and } V^{*T}=A^*[A^*U^*]^T$$ which on solving gives me $$ A^* U^{*T} U A^T $$ which gives $$ A^* U^2 A^T $$but it should be equal to $$U^2$$, as I understand. Though $$ A^T A^*=I $$ as $A$ is Unitary matrix, but as much as I know we can't change order. &lt;/p&gt;&#xA;" OwnerUserId="20392" LastEditorUserId="15892" LastEditDate="2016-05-04T23:55:29.277" LastActivityDate="2016-05-05T02:02:38.363" Title="How can this equation hold $$\sum_{m=0}^{N-1} \sum_{n=0}^{N-1} |u(m,n)|^2 = \sum_{k=0}^{N-1}\sum_{l=0}^{N-1} |v(k,l)|^2$$?" Tags="|image-processing|transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30582" PostTypeId="1" AcceptedAnswerId="30593" CreationDate="2016-05-04T16:50:14.097" Score="0" ViewCount="785" Body="&lt;p&gt;I'm having a really weird issue with generating waveforms from frequencies C1 to C8. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I generate sine waves, everything sounds good; no problems whatsoever. However, when I generate a square wave... BAM weird aliasing issues on the higher frequencies (around C6 to C8). I have no idea what I'm doing wrong at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to take a wild guess here but I'm thinking it might be because square waves have a lot of harmonics so it's not producing the higher harmonics correctly when I reach a higher frequency... thus the really high harmonics are getting aliased. Would like someone to confirm with me/guide me to a solution to this. Is it possible to try to implement a filter or is there a better solution ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm setting my sample rate to 44.1 kHz and here are my functions for waveform generation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float generateSin {&#xA;    sample = sinf(_phs);&#xA;&#xA;    _phs += _phs_incr;&#xA;    _phs = wrapPhase(_phs);&#xA;}&#xA;&#xA;float generateSqr {&#xA;    sample = sinf(_phs);&#xA;    if (sample &amp;gt; 0) sample = 1;&#xA;    else if (sample &amp;lt; 0) sample = -1;&#xA;&#xA;    _phs += _phs_incr;&#xA;    _phs = wrapPhase(_phs);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10572" LastActivityDate="2016-05-05T20:57:01.510" Title="Aliasing Square Wave" Tags="|sampling|frequency|c|aliasing|oscillator|" AnswerCount="2" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30583" PostTypeId="2" ParentId="30550" CreationDate="2016-05-04T17:53:04.460" Score="2" Body="&lt;p&gt;You can represent the convolution as a matrix multiplication with a $N\times N$ Toeplitz matrix, where $N$ is the length of $\mathbf{w}$. Check out &lt;a href=&quot;https://en.wikipedia.org/wiki/Toeplitz_matrix#Discrete_convolution&quot; rel=&quot;nofollow&quot;&gt;this explanation&lt;/a&gt;.&lt;br&gt;&#xA;So you can write&#xA;$$&#xA;E(\mathbf{w})=\frac{1}{2}\|\mathbf{AHw}+\mathbf{b}\|^2_2&#xA;$$&#xA;where $\mathbf{H}$ is your Teoplitz matrix filter. Now if you define&#xA;$$&#xA;\tilde{\mathbf{A}} = \mathbf{AH}&#xA;$$&#xA;then&#xA;$$&#xA;E(\mathbf{w})=\frac{1}{2}\|\tilde{\mathbf{A}}\mathbf{w}+\mathbf{b}\|^2_2&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you can see that the solution is exactly as you wrote but with $\tilde{\mathbf{A}}$ instead of $\mathbf{A}$.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastActivityDate="2016-05-04T17:53:04.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30584" PostTypeId="2" ParentId="30582" CreationDate="2016-05-04T19:08:00.783" Score="1" Body="&lt;p&gt;My guess is there's a problem with your &lt;code&gt;wrapPhase&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use the R implementation of it below (C8 shown), then I get all sorts of funny results.  That's the second image.  Removing it from the iteration (but including it in the calculation), makes for much cleaner signals (the first image).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ozKm0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ozKm0.png&quot; alt=&quot;Without using &amp;lt;code&amp;gt;wrapPhase&amp;lt;/code&amp;gt; in correcting phase value&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WvUHi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WvUHi.png&quot; alt=&quot;With using &amp;lt;code&amp;gt;wrapPhase&amp;lt;/code&amp;gt; for corrections.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#30582&#xA;&#xA;wrapPhase &amp;lt;- function(phi)&#xA;{&#xA;  return(phi %% 2*pi)&#xA;}&#xA;&#xA;# https://en.wikipedia.org/wiki/Piano_key_frequencies&#xA;cs &amp;lt;- c(32.7032, 65.4064, 130.813, 261.626, 523.251, 1046.50, 2093.00, 4186.01)&#xA;c1 &amp;lt;- cs[1]&#xA;c8 &amp;lt;- cs[8]&#xA;&#xA;fs &amp;lt;- 44100&#xA;&#xA;phs &amp;lt;- rep(0,T + 1)&#xA;phs_incr &amp;lt;- c8 / fs * 2 * pi&#xA;&#xA;T &amp;lt;- 1000&#xA;&#xA;sample &amp;lt;- rep(0,T)&#xA;sqr_wave &amp;lt;- rep(0,T)&#xA;&#xA;for (t in seq(1,T))&#xA;{  &#xA;  sample[t] &amp;lt;- sin(wrapPhase(phs[t]))&#xA;&#xA;  if (sample[t] &amp;gt; 0)&#xA;  {&#xA;    sqr_wave[t] &amp;lt;- 1&#xA;  }&#xA;  else &#xA;  {&#xA;      sqr_wave[t] = -1;&#xA;  }&#xA;&#xA;  print(sample[t])&#xA;&#xA;  phs[t+1] &amp;lt;- phs[t] +  phs_incr&#xA;  #phs[t+1] &amp;lt;- wrapPhase(phs[t+1]);&#xA;}&#xA;&#xA;phi &amp;lt;- seq(-pi, pi, 0.001*pi)&#xA;phi_wrap &amp;lt;- rep(0, length(phi))&#xA;&#xA;for (k in 1:length(phi))&#xA;{&#xA;  phi_wrap[k] &amp;lt;- wrapPhase(phi[k])&#xA;}&#xA;&#xA;plot(sample[1:50], col=&quot;blue&quot;, type=&quot;l&quot;)&#xA;lines(sqr_wave[1:50], col=&quot;green&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-04T19:08:00.783" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30585" PostTypeId="2" ParentId="30579" CreationDate="2016-05-04T19:41:15.087" Score="2" Body="&lt;p&gt;OK, so let's have a look at whether&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{m=0}^{N-1} \sum_{n=0}^{N-1} |u(m,n)|^2 = \sum_{k=0}^{N-1}\sum_{l=0}^{N-1} |v(k,l)|^2\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$U^2=V^2\tag{2}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's have a look at a simple $2 \times 2$ example:&#xA;$$&#xA;U = \left [ &#xA;\begin{array}{cc}&#xA;u_a &amp;amp; u_b\\&#xA;u_c &amp;amp; u_d&#xA;\end{array}&#xA;\right ] \\&#xA;V = \left [ &#xA;\begin{array}{cc}&#xA;v_a &amp;amp; v_b\\&#xA;v_c &amp;amp; v_d&#xA;\end{array}&#xA;\right ]&#xA;$$&#xA;so that&#xA;$$&#xA;U^2 = \left [ &#xA;\begin{array}{cc}&#xA;u_a &amp;amp; u_b\\&#xA;u_c &amp;amp; u_d&#xA;\end{array}&#xA;\right ]&#xA;\left [ &#xA;\begin{array}{cc}&#xA;u_a &amp;amp; u_b\\&#xA;u_c &amp;amp; u_d&#xA;\end{array}&#xA;\right ] = \left [ &#xA;\begin{array}{cc}&#xA;u_a^2 + u_b u_c &amp;amp; u_au_b + u_bu_d\\&#xA;u_cu_a + u_d u_c &amp;amp; u_c u_b + u_d^2&#xA;\end{array}&#xA;\right ]&#xA;$$&#xA;and&#xA;$$&#xA;V^2 = \left [ &#xA;\begin{array}{cc}&#xA;v_a^2 + v_b v_c &amp;amp; v_av_b + v_bv_d\\&#xA;v_cv_a + v_d v_c &amp;amp; v_c v_b + v_d^2&#xA;\end{array}&#xA;\right ]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then (1) becomes&#xA;$$&#xA;|u_a|^2 + |u_b|^2 + |u_c|^2 + |u_d|^2 =&#xA;|v_a|^2 + |v_b|^2 + |v_c|^2 + |v_d|^2 &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two are completely different.  Why do you think they are the same?&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-04T19:41:15.087" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30587" PostTypeId="1" CreationDate="2016-05-04T20:52:15.923" Score="1" ViewCount="205" Body="&lt;p&gt;I am implementing a filter in hardware, and the intended maximum data input is 16-bit. The question is, if the output is to be re-quantized to 16-bit, does this mean certain coefficients are effectively 'useless' - as outlined here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The filter is a fractional delay filter (FIR), so for very small fractional delays some of the coefficients are very small, while the center tap is large. (large coefficient dynamic range)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the current design the coefficients have been quantized - and in integer form, the smallest is +1, while the largest is 195890 so a range of 2 bit (signed) to 20 bit (signed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is - if I quantized the output to 16-bit, does this mean the smaller coefficients are effectively unused. For example, if I do an impulse response test, I will get zeros for any coefficients that are smaller than 4-bits, due to the fact the 20-bit coefficient sets where the MSB of the output is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For practical data, I imagine these smaller coefficients may have a minor impact as they may effect the output - but it is interesting that the impulse response would show them as dropped. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any guideline that says if the coefficients dynamic range is larger than the output bit-width, that they are effectively unused?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Clarification of the question&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Data-width is 16-bit, Largest coeff width is 20-bit, Smallest Coeff width is 2-bit.&lt;/li&gt;&#xA;&lt;li&gt;Filter internal word-size is ~ 16+20+G, where G are the guard bits.&lt;/li&gt;&#xA;&lt;li&gt;This full precision value is truncated/rounded to a 16-bit output.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Doing an impulse response test on this filter, I will see the larger coefficients, but the smaller ones will come out as 0, due to the fact the output can only take 16-bit, while the difference between the largest and smallest coefficient is 20-2 = 18 bit. Does this mean these smaller coefficients are not effective, given the impulse response 'cant see' them.&lt;/p&gt;&#xA;" OwnerUserId="20859" LastEditorUserId="20859" LastEditDate="2016-05-04T22:17:13.947" LastActivityDate="2016-05-04T22:17:13.947" Title="Filter output quantization - does this limit effective coefficient quantization?" Tags="|quantization|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30589" PostTypeId="1" CreationDate="2016-05-04T23:16:03.180" Score="2" ViewCount="685" Body="&lt;p&gt;Having compressed an image,how can the compression noise or blocking artifacts be suppressed to improve the quality of the image before further processing. Thanks&lt;/p&gt;&#xA;" OwnerUserId="20861" LastActivityDate="2016-05-04T23:50:17.730" Title="Removal of blocking artifacts in images due to compression" Tags="|image-processing|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30590" PostTypeId="2" ParentId="30589" CreationDate="2016-05-04T23:50:17.730" Score="1" Body="&lt;p&gt;If you talk about JPEG-like blocking artifacts, an interesting appproach consists in the re-applications of the same JPEG algorithm on shifted versions of the image, see &lt;a href=&quot;http://www.utdallas.edu/~aria/papers/vlsisp99.pdf&quot; rel=&quot;nofollow&quot;&gt;Enhancement of JPEG-Compressed Images by&#xA;Re-application of JPEG&lt;/a&gt;, by Aria Nosratinia, 1999. It has a &lt;a href=&quot;http://www.utdallas.edu/~aria/mcl/post/&quot; rel=&quot;nofollow&quot;&gt;software implementation&lt;/a&gt;. It implement a sort of shift-invariant processing. He did the same with the JPEG-2000 coder, in &lt;a href=&quot;http://%20www.utdallas.edu/~aria/papers/spl03.pdf&quot; rel=&quot;nofollow&quot;&gt;Post-Processing of JPEG-2000 Images to Remove Compression Artifacts&lt;/a&gt;. You can find &lt;a href=&quot;http://www.stat.columbia.edu/~jakulin/jpeg/artifacts.htm&quot; rel=&quot;nofollow&quot;&gt;an overview of these artifacts here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Improved methods include sparsifying priors like total variation, see for instance &lt;a href=&quot;http://doi.org/10.1007/s10851-005-6467-9&quot; rel=&quot;nofollow&quot;&gt;Adapted Total Variation for Artifact Free Decompression of JPEG Images&lt;/a&gt;. Recent references include &lt;a href=&quot;http://dx.doi.org/10.1109/TSP.2013.2290508&quot; rel=&quot;nofollow&quot;&gt;Reducing Artifacts in JPEG Decompression Via a Learned Dictionary&lt;/a&gt; and &lt;a href=&quot;http://link.springer.com/article/10.1007/s11263-014-0702-z&quot; rel=&quot;nofollow&quot;&gt;Understanding, Optimising, and Extending Data Compression with Anisotropic Diffusion&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-05-04T23:50:17.730" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30591" PostTypeId="2" ParentId="30543" CreationDate="2016-05-05T00:25:37.680" Score="2" Body="&lt;p&gt;The closest resource I have come across is the BSD500 database:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/resources.html&quot; rel=&quot;nofollow&quot;&gt;http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/resources.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a set of natural images that have had the contours drawn by humans. When you download the test images there are also MATLAB files with all the contours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the question is always &quot;what is an edge?&quot; Is it a step in brightness in the local image patch? Is a line an edge? Is it a boundary between semantic objects in a 2D image? The latter is what the above set tests. The best performing approaches for it also consider an abrupt change in &lt;em&gt;texture&lt;/em&gt; to be an edge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess the point is the performance of your edge detector is dependent on the application. One could argue that every edge detector is perfect as it perfectly detects edges according to its own definition. But that is just being cheeky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also test some other properties, such as&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is it invariant to rotation? Does the same line at 0 degrees and X degrees give the same result?&lt;/li&gt;&#xA;&lt;li&gt;Is it invariant to scaling? I.e. zooming of the image&lt;/li&gt;&#xA;&lt;li&gt;Is it invariant to view point? I.e. warping of the image&lt;/li&gt;&#xA;&lt;li&gt;Is it illumination invariant? Does it detect true weak edges as well as strong edges?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I also have a new edge detector that I've been working on. One of recent ideas I have had is to use the &lt;a href=&quot;http://www.robots.ox.ac.uk/~vgg/research/affine/&quot; rel=&quot;nofollow&quot;&gt;Mikolajczyk&lt;/a&gt; test set. It consists of eight sets of images with various transformations, including the above. Typically the test set is used to evaluate interest point descriptors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process would be&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Detect edges in each image in the set.&lt;/li&gt;&#xA;&lt;li&gt;Using the homographies, transform each detection image back to the first image in the set so they can be compared&lt;/li&gt;&#xA;&lt;li&gt;Compare the edges between images using one of the measures you mention. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Ideally, if the edge detector is invariant to the various translations, the same edges should be found. This approach might have already been done in the literature but I haven't looked.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-05-05T00:25:37.680" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30592" PostTypeId="1" AcceptedAnswerId="30595" CreationDate="2016-05-05T01:33:08.577" Score="0" ViewCount="971" Body="&lt;p&gt;For an ultrasound application, I am collecting data from an ADC using high spec Altera FPGA which grabs data and can then do some DSP processing that would be otherwise too slow for a desktop to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of the DSP required is the precursor to envelope detection. The incoming signals from the ADC contain only the in-phase component of the signal. As a result I also need to generate the quadrature component to be able to then do the sum of squares of I/Q to get the envelope. To get the Q component a Hilbert FIR filter is called for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using MATLAB I've been able to design a suitable Hilbert filter for the application. However there are limited resources, so the filter is limited in terms of taps. Using the &quot;Altera FIR Compiler II&quot; tool I've then generated the filter for the FPGA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been doing some simulation and the filter does correctly produce the quadrature component - for example if I feed in a sine I get a cosine. The trouble is the filter causes an attenuation of the signal - i.e. it isn't unity gain. Part of this will be due to coefficient rounding, and part of it due to the calculations being done in fixed point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this filter if I try to do envelope detection using sum of squares, the resulting envelope is not brilliant. in the sine/cosine example I would expect the result to be a DC level, however it is in fact a DC level with a sine wave floating on it. This is presumably due to the Q signal being slightly attenuated. In fact if I multiply all the I values by a constant scalar found by trial and error, the envelope improves in accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trouble is the pass band of the Hilbert filter isn't perfectly flat, there are &amp;lt;0.1dB ripples in it - there is a limitation on the number of taps I can implement due to resource restrictions. As a result the envelope of signals that are not pure tones get distorted again because my scalar for the I data is perfectly flat (its a simple multiplication).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I am wondering then is can I improve the envelope by using a FIR filter on the I data as well. Rather than just delaying the I data and multiplying it by a constant scale factor, is it possible to design a FIR filter whose pass band response is matched to the Hilbert filter? If so, is there a simple way to do it using MATLAB?&lt;/p&gt;&#xA;" OwnerUserId="18281" LastActivityDate="2023-07-28T19:12:23.130" Title="Hilbert FIR Filter for Q - Matching Filter for I" Tags="|filter-design|finite-impulse-response|hilbert-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30593" PostTypeId="2" ParentId="30582" CreationDate="2016-05-05T01:40:20.730" Score="1" Body="&lt;p&gt;After brainstorming/researching for a little longer, I've realized that there are things called Bandlimited Waveforms; these waveforms basically get rid of the aliasing issues that exist within waveforms with harmonics (triangle, square, sawtooth for example). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cause of my issue was that even though I had the right sampling rate for my base tones, they did not support the harmonics that my square waves had, thus creating aliasing. I found out this is a common problem for many others and my implementation of my square wave would be perfect for LFOs/lower frequencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, I implemented a Bandlimited Square Wave and BAM! problem solved!!! no more aliasing! NOW there's a problem with trying to implement a bandlimited PWM but that's another problem for later ;0&lt;/p&gt;&#xA;" OwnerUserId="10572" LastEditorUserId="10572" LastEditDate="2016-05-05T20:57:01.510" LastActivityDate="2016-05-05T20:57:01.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30594" PostTypeId="2" ParentId="30579" CreationDate="2016-05-05T02:02:38.363" Score="1" Body="&lt;p&gt;You can prove this using trace of the matrix and the similarity invariance property:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\sum\limits_{k=0}^{N-1} \sum\limits_{l=0}^{N-1} \left| v(k,l) \right|^2 &amp;amp;=  \text{tr} \left(V^{*} V\right) \\&#xA;&amp;amp;= \text{tr} \left(A U^{*} A^{*} A U A^{*} \right) \\&#xA;&amp;amp;= \text{tr} \left(A U^{*} U A^{*} \right) \\&#xA;&amp;amp;= \text{tr} \left(U^{*} U \right)~~\text{See attached image} \\&#xA;&amp;amp;= \sum\limits_{m=0}^{N-1} \sum\limits_{n=0}^{N-1} \left| u(m,n) \right|^2&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following snapshot has been taken from wikipedia:- &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_(linear_algebra)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trace of a Matrix&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vp9eY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vp9eY.png&quot; alt=&quot;Image copied from Wikipedia&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-05-05T02:02:38.363" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30595" PostTypeId="2" ParentId="30592" CreationDate="2016-05-05T02:03:18.460" Score="5" Body="&lt;p&gt;Clay Turner has an interesting &lt;a href=&quot;http://www.claysturner.com/dsp/asg.pdf&quot; rel=&quot;nofollow&quot;&gt;couple of&lt;/a&gt; &lt;a href=&quot;http://www.claysturner.com/dsp/HilbertTransforms.pdf&quot; rel=&quot;nofollow&quot;&gt;papers&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;what you want to do is compute (using MATLAB &lt;code&gt;firpm()&lt;/code&gt; or &lt;code&gt;firls()&lt;/code&gt;) two filters that shift the phase, one at -45° and the other at +45° relative to some linear phase angle that corresponds to a constant delay.  you design one and then flip the coefficients around for the other.  they will both have the same magnitude frequency response and be 90° out of phase of each other for every frequency.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="4346" LastEditDate="2016-05-05T02:53:15.770" LastActivityDate="2016-05-05T02:53:15.770" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30596" PostTypeId="1" CreationDate="2016-05-05T04:05:57.937" Score="0" ViewCount="457" Body="&lt;p&gt;I have some code, shown below that I have been using to find the fundamental of a guitar string.  After this function is called, I go thru the real buffer and find the peak, whose location gives me the period of the fundamental. Now I have a need to find the phase of the fundamental in relation to the start of the buffer.  Is there a way to find this phase from the info available in the code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not possible, is there a better algorithm to find both the fundamental and it's phase?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void AutoCorrelate(int real[],int imag[],int N,int sine[]){&#xA;&#xA;fftTwiddle(real, imag, N);&#xA;fftForward(real,imag,N,sine);&#xA;&#xA;&#xA;&#xA;for (int i=0;i&amp;lt;N;i++)&#xA;{&#xA;    int h;&#xA;    unsigned int l;&#xA;&#xA;    MACS(h,l,real[i],real[i],0,0);&#xA;    MACS(real[i],l,imag[i],imag[i],h,l);&#xA;&#xA;    imag[i] = 0;&#xA;&#xA;}&#xA;&#xA;fftTwiddle(real, imag, N);&#xA;fftInverse(real,imag,N,sine);}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4008" LastEditorUserId="4008" LastEditDate="2016-05-05T13:53:03.307" LastActivityDate="2016-05-05T13:53:03.307" Title="Finding phase of fundamental from autocorrelation" Tags="|phase|autocorrelation|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30600" PostTypeId="1" AcceptedAnswerId="30604" CreationDate="2016-05-05T12:17:31.123" Score="0" ViewCount="463" Body="&lt;p&gt;Explain why the Hilbert transform of $f(t)=\operatorname{sinc}(at) \cos(2 \pi \nu_c t)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{f} (t) = \operatorname{sinc} (at) \sin(2 \pi \nu_c t),$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $0&amp;lt;a&amp;lt;\nu_c.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already found the Hilbert transform of $\operatorname{sinc}(at)$ &lt;a href=&quot;https://dsp.stackexchange.com/questions/30521/hilbert-transform-pair-proof&quot;&gt;here&lt;/a&gt;. Now I want to use linearity property of the Hilbert transformation. So writing $f(t)$ as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = \frac{1}{2} \left( \operatorname{sinc}(at) e^{j 2 \pi \nu_c t} + \operatorname{sinc}(at) e^{-j 2 \pi \nu_c t} \right) \tag{i}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying linearity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{f}(t) = \frac{1}{2} \left( \frac{\sin^2(at/2)}{at/2} e^{j 2 \pi \nu_c t} + \frac{\sin^2(at/2)}{at/2} e^{-j 2 \pi \nu_c t} \right) \tag{ii}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this doesn't look right. So why does the linearity not work? How can I arrive at the correct Hilbert transform expression given above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P. S.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that this result follows from Bedrosian's theorem but I am not allowed to use that for this problem. I know the Hilbert transform of $f(t)$ has to be $\operatorname{sinc} (at) \sin(2 \pi \nu_c t)$ since I've already plotted its envelope and it looks correct:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u9CVX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u9CVX.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20697" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:27.973" LastActivityDate="2016-05-05T14:52:24.850" Title="Hilbert transform linearity" Tags="|fourier-transform|hilbert-transform|proof|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30601" PostTypeId="2" ParentId="30600" CreationDate="2016-05-05T13:17:05.700" Score="0" Body="&lt;p&gt;You could go through the frequency domain&#xA;$$F(\omega) = c \cdot \text{rect}( \frac{\omega}{2 \pi a} )* [\delta (\omega - v_c) + \delta (\omega + v_c)]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it's basically the convolution of a rectangular function with two delta functions, which is simply&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\omega) = c \cdot [\text{rect}( \frac{\omega - v_c}{2 \pi a} ) + \text{rect}( \frac{\omega + v_c}{2 \pi a} ) ] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;outline of the rest: (sorry, out of time for now).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Multiply this with the Fourier transform of a Hilbert transformer&lt;/li&gt;&#xA;&lt;li&gt;Go back into the time domain&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="3997" LastEditorUserId="11256" LastEditDate="2016-05-05T13:35:42.340" LastActivityDate="2016-05-05T13:35:42.340" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30602" PostTypeId="1" AcceptedAnswerId="30608" CreationDate="2016-05-05T13:58:45.787" Score="2" ViewCount="1587" Body="&lt;p&gt;I'm new to frequency domain analysis. Let's say I have a frequency domain representation from a time domain signal. What I want to do is taking frequencies with a low amplitude out of this frequency domain representation and then convert this frequency domain representation back to the time domain such that the result is almost the original time domain representation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Matlab what I want to do is something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;timeDomain(1:50) -&gt; apply fft(timeDomain) -&gt; inspect frequency domain and filter out low amplitude frequencies yielding a frequency domain vector x with length(x) probably (way) smaller than 50. (so x should contain only the frequencies with the highest amplitudes of the signal) -&gt; apply ifft on this filtered complex vector -&gt; Get an approximation of the original time domain signal (timeDomain(1:50) that has also length 50.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my aim is to represent the time domain signal timeDomain(1:50) with less dimensions in the frequency domain without too much information about the signal getting lost, thus being able to reconstruct the time domain signal, so basically compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time.&lt;/p&gt;&#xA;" OwnerUserId="17738" LastEditorUserId="17738" LastEditDate="2016-05-05T14:04:26.587" LastActivityDate="2016-05-05T16:35:44.290" Title="Compressing a time-domain signal in the frequency domain Matlab" Tags="|frequency-spectrum|frequency|frequency-domain|time-frequency|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30603" PostTypeId="2" ParentId="27899" CreationDate="2016-05-05T14:26:09.423" Score="1" Body="&lt;p&gt;I am developing the same algorithm, but I am using C++ one of the biggest  problem I got was that I  did the math (subtraction and sum) using uchar values obtaining black images. Try transforming uchar to float to do the math and then go back to uchar to visualize the image.&lt;/p&gt;&#xA;" OwnerUserId="20872" LastActivityDate="2016-05-05T14:26:09.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30604" PostTypeId="2" ParentId="30600" CreationDate="2016-05-05T14:52:24.850" Score="2" Body="&lt;p&gt;Transform the signal into frequency domain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(f) = \frac{1}{\left|a\right|} \left[~\frac{\Pi(f-\nu_{c})}{2} + \frac{\Pi(f+\nu_{c})|}{2} ~\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you know the fourier domain representation of the hilbert operator is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(f) = -j\text{sgn}(f)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying this transform means you just multiply $H(f)$ to $F(f)$. That gets you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{F}(f) = -j\text{sgn}(f) \cdot \frac{1}{\left|a\right|} \left[~\frac{\Pi(f-\nu_{c}}{2} + \frac{\Pi(f+\nu_{c})|}{2} ~\right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{F}(f) = \frac{1}{\left|a\right|} \left[~\frac{\Pi(f-\nu_{c})}{2j} + \frac{-\Pi(f+\nu_{c})|}{2j} ~\right] ~~ \text{Remember} -j = \frac{1}{j}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is same as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{F}(f) = \frac{\Pi(f)}{\left|a\right|} \ast  \left[~\frac{1}{2j} \delta(f-\nu) + \frac{-1}{2j} \delta(f+\nu) ~\right] $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inverse Fourier Transformation of this gives you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\hat{f}(t) = \text{sinc}(at)\sin{\left(2\pi\nu_{c}t\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-05-05T14:52:24.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30605" PostTypeId="1" AcceptedAnswerId="30606" CreationDate="2016-05-05T15:04:48.437" Score="6" ViewCount="7584" Body="&lt;p&gt;I found algorithms that seems the same to me, but they are described with different names (in field of adaptive filtering).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;LMS - least-mean-squares&lt;/strong&gt; seems to be &lt;strong&gt;GD - stochastic gradient descent&lt;/strong&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Often the &lt;strong&gt;stochastic gradient descent&lt;/strong&gt; is called just &lt;strong&gt;gradient descent&lt;/strong&gt; what seems to be something different (but still similar) according to wikipedia.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Extension of GD (or LMS) with normalization seems to be always called NLMS, why not NGD?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Why are the used names different? Are the algorithms really the same thing or am I wrong?&lt;/p&gt;&#xA;" OwnerUserId="19697" LastEditorUserId="128" LastEditDate="2018-06-16T22:11:53.020" LastActivityDate="2020-01-05T21:27:29.560" Title="What's the Difference Between LMS and Gradient Descent Adaptation?" Tags="|adaptive-filters|adaptive-algorithms|least-squares|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30606" PostTypeId="2" ParentId="30605" CreationDate="2016-05-05T15:47:59.367" Score="8" Body="&lt;p&gt;The LMS algorithm is based on the idea of gradient descent to search for the optimal (minimum error) condition, with a cost function equal to the mean squared error at the filter output. However, it doesn't actually calculate the gradient directly, as that would require knowing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E(\mathbf{x}[n]e^*[n])&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{x}[n]$ is the input vector and $e[n]$ is the filter output error at time instant $n$. The value of this expectation would typically be something that isn't known ahead of time, so it's instead approximated (in most cases) by the instantaneous value $\mathbf{x}[n]e^*[n]$ instead. This &lt;a href=&quot;https://en.wikipedia.org/wiki/Least_mean_squares_filter#Simplifications&quot; rel=&quot;noreferrer&quot;&gt;(described in more detail at Wikipedia)&lt;/a&gt; is the key feature of the LMS filter structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gradient descent just refers to the method used to hunt for the minimum-cost solution; it doesn't force the use of any particular cost function. An LMS filter is a specialization of gradient descent that uses a mean-squared error cost function and the aforementioned approximation for the gradient at each time step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Stochastic gradient descent&lt;/em&gt; would refer to techniques that don't directly compute the gradient, instead using an approximation to the gradient that has similar stochastic properties (e.g. the same expected value). LMS would be an example of an algorithm that uses a SGD approach, using the approximation I described above.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="80" LastEditDate="2016-05-06T01:31:35.043" LastActivityDate="2016-05-06T01:31:35.043" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30607" PostTypeId="2" ParentId="30602" CreationDate="2016-05-05T16:08:40.673" Score="0" Body="&lt;p&gt;You can look into Compressive Sampling. Exploiting the fact that the Frequency domain representation of your signal is sparse in nature, you can compress the time domain signal by applying a combination of a random matrix and a DFT matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say your time domain signal is $\boldsymbol{x}_{N \times 1}$. You can do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\boldsymbol{y}_{M \times 1} = \boldsymbol{\Phi}_{M \times N}~ \boldsymbol{F}_{N \times N}~ \boldsymbol{x}_{N \times 1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where, $M = O(k \log{(N/k)})$ with $k$ being the sparsity. $\boldsymbol{F}$ is a DFT matrix and $\boldsymbol{\Phi}$ is a random matrix (gaussian, bernoulli, etc.).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do the following to reconstruct your signal $\boldsymbol{\hat{x}}$ &#xA;with almost no loss:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \min{\|\hat{\boldsymbol{x}}\|_{1}}~~\text{subject to} \| \boldsymbol{\Psi} \boldsymbol{\hat{x}} - \boldsymbol{y} \|_{2} \leq \epsilon$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where, $\boldsymbol{\Psi} = \boldsymbol{\Phi}\boldsymbol{F}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are lots of existing methods to do this optimization for you. You can visit the huge &lt;a href=&quot;http://dsp.rice.edu/cs/&quot; rel=&quot;nofollow&quot; title=&quot;Compressive Sampling Resources&quot;&gt;Compressive Sampling Resources&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-05-05T16:08:40.673" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30608" PostTypeId="2" ParentId="30602" CreationDate="2016-05-05T16:35:44.290" Score="2" Body="&lt;p&gt;Everything depends on what you call compressing. What you are proposing is Fourier or spectrum thresholding. You will generate a $50$-length vector with some zeroes, hopefully. Let us ignore &quot;complexness&quot; that requires two floats for now,  you can deal with it using Hermitian symmetry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your main problem is actual compression. Forget about quantization first. The main issue is index location. Assume I have a transformed domain vector $T=[5, 1, 3 ,4, 0.5]$. Suppose I use a threshold on $2$. Now I give you the compressed version  $T_c=[5,  3 ,4]$, a ratio of $3/5$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you retrieve $T_d=[5, 0, 3 ,4, 0]$? Probably not, you do not know where the zeroes were. This problem somehow prevented matching pursuit to be used for image compression, because coding the index penalized the final compressed file too much.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-05-05T16:35:44.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30609" PostTypeId="1" CreationDate="2016-05-05T16:46:41.070" Score="1" ViewCount="1459" Body="&lt;p&gt;I'm trying to generate sine signal and display it's fft in radians, byt I meet several issues that I can't understand. Please find my script below: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all; close all; clc; &#xA;fs = 10*pi; &#xA;ts = 1/fs; &#xA;t = 0:ts:2*pi; &#xA;sine = cos(10*t); &#xA;plot(t/pi,sine) &#xA;sinefft = fft(sine); &#xA;subplot(2,1,1) &#xA;plot(abs(sinefft)) &#xA;subplot(2,1,2) &#xA;plot(abs(fftshift(sinefft))) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Results&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wejeM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wejeM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/RSinB.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RSinB.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. Why on first plot fft shows that cosine has a frequency 11 radians?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. How to shift fft to achieve frequency domain around 0?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be thankful for your explanations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maks&lt;/p&gt;&#xA;" OwnerUserId="20874" LastEditorUserId="80" LastEditDate="2016-05-05T17:30:43.577" LastActivityDate="2016-05-05T18:43:18.167" Title="sinus generation and it's fft in radians" Tags="|fft|frequency-spectrum|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30610" PostTypeId="2" ParentId="30609" CreationDate="2016-05-05T17:47:41.950" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Why on first plot fft shows that cosine has a frequency 11 radians?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;array index number&lt;/strong&gt; of the cosine peak is 11.  The &lt;em&gt;frequency&lt;/em&gt; is different.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matlab indexes from 1, so the &lt;strong&gt;FFT bin number&lt;/strong&gt; will be 10 (as we have a 0 bin in FFTs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;frequency&lt;/em&gt; of that bin will be &#xA;$$&#xA;\frac{2 \pi (11 - 1) }{N } = \frac{2 \pi 10}{ 198} = \frac{10\pi}{99}&#xA;$$&#xA;assuming your FFT length was 198.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this will be a normalized frequency between 0 and $2\pi$ (or, if you prefer, $-\pi$ and +$\pi$).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;How to shift fft to achieve frequency domain around 0?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Your use of &lt;code&gt;fftshift&lt;/code&gt; does this in the second plot.  However, you need to set the $x$ axis by doing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = length(sinefft);&#xA;delta_omega = 2*pi/N; % rad/sec between FFT bins&#xA;omega = -pi:delta_omega:(pi - delta_omega)&#xA;plot(omega, abs(fftshift(sinefft)));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Minor Correction&lt;/strong&gt; I previously had this frequency variable as &lt;code&gt;f&lt;/code&gt;, it's actually &lt;code&gt;omega&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How to calculate now what frequency in Hz has this signal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So the normalized frequency in radian per second is &lt;code&gt;omega&lt;/code&gt;.  That ranges from $-\pi$ to $+\pi$ (modulo some end effects).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The normalized frequency in &quot;Hz&quot; is &lt;code&gt;f&lt;/code&gt;. This will be &lt;code&gt;omega/2/pi&lt;/code&gt;. This ranges from -0.5 to +0.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency in terms of the sampling frequency will be &lt;code&gt;f_true = omega / pi / 2 * fs&lt;/code&gt; (where &lt;code&gt;fs&lt;/code&gt; is the sampling frequency).&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-05-05T18:43:18.167" LastActivityDate="2016-05-05T18:43:18.167" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30611" PostTypeId="2" ParentId="27560" CreationDate="2016-05-05T18:19:16.113" Score="3" Body="&lt;p&gt;Adding to Laurent's answer. I've plotted the magnitude of the FFTs of the two windows. I've padded the FFT to 1024 and the plot is shown in dB. Here's a regular plot:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ps5Mv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ps5Mv.png&quot; alt=&quot;Windows in Frequency Domain&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a zoomed version:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/3pf2K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3pf2K.png&quot; alt=&quot;Windows in Frequency Domain ver 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There effect of squaring the window is more obvious in the frequency domain. There is a loss in the coherent gain because more of the window coefficients are closer to zero. The main lobe widens because multiplication in time corresponds to convolution in frequency domain are this tends to spread the response. The sidelobes are lower and they decay faster - the rate of sidelobe decay is asymptotically proportional to the number of continuous derivatives of the time domain window - See Papoulis - &quot;The Fourier Integral and its Applications&quot;. &lt;/p&gt;&#xA;" OwnerUserId="7483" LastActivityDate="2016-05-05T18:19:16.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30612" PostTypeId="2" ParentId="30538" CreationDate="2016-05-05T22:23:20.640" Score="1" Body="&lt;p&gt;Bandwidth expansion is actually a problem of missing audio data recovery, which is an active area of research.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually you assume that your signal follows some statistical model in the time-frequency domain, and the whole challenge is to infer the parameters of your model, based only on the &lt;em&gt;available&lt;/em&gt; data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of bandwidth expansion, you would infer your model from the lower frequency part of your spectrogram, in order to recover the higher frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can have a look at some of Paris Smaragdis' work on missing audio data and bandwidth expansion, using latent variable models. Some demos are available &lt;a href=&quot;http://paris.cs.illinois.edu/demos/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="18104" LastActivityDate="2016-05-05T22:23:20.640" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30613" PostTypeId="2" ParentId="30575" CreationDate="2016-05-06T03:57:21.470" Score="2" Body="&lt;p&gt;wgn() is specifically meant to create a white noise with a predefined power levels while randn() is meant to generate normally distributed random numbers WITHOUT specifying the power. You will have to scale the values generated from randn() to meet the desired noise power level. Basically wgn() (usually used with awgn()) makes your life easier if you want to create a noise with known power level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-05-06T03:57:21.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30615" PostTypeId="1" AcceptedAnswerId="30616" CreationDate="2016-05-06T06:45:14.373" Score="1" ViewCount="52" Body="&lt;p&gt;Let just say I understand the first process that is white noise, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Process 1: If $x(n)$ is a &lt;strong&gt;Gaussian random variable&lt;/strong&gt; and a process&#xA;  is formed from a sequence of $x(n)$ and all random variables are&#xA;  uncorrelated then this process is white noise.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Process 2: Now if $x(n) = \alpha $ where now $\alpha$ is Gaussian&#xA;  random variable then each process in ensamble is equal to constant for&#xA;  all $n$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But I am not able to get what difference does it makes when we form Process 2 it seems same to me. Can any one explain the difference? Also how the ensamble became constant in the second case?&lt;/p&gt;&#xA;" OwnerUserId="12125" LastActivityDate="2016-05-06T18:47:32.753" Title="Difference in following random proccess" Tags="|discrete-signals|gaussian|random-process|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30616" PostTypeId="2" ParentId="30615" CreationDate="2016-05-06T07:48:50.113" Score="2" Body="&lt;p&gt;In the first case, $x(0)$ and $x(1)$ and $x(2)$ etc are all uncorrelated. (And since they're gaussian, they're independent). This means that, to get a realization of the first random process, you have to take $\infty$ independent samples from a gaussian distribution, and assign each of these $\infty$ samples to a $x(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second process is much simpler. You just take &lt;em&gt;one&lt;/em&gt; sample from a gaussian distribution (and call it $\alpha$), and then assign &lt;em&gt;all&lt;/em&gt; of the $x(n)$ to this $\alpha$. In this way, $\alpha$ may be random, but you will get $x(0)=x(1)=x(2)=\cdots=\alpha$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'll post some plots, as you asked. I used the following code in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 3;&#xA;T = 10;&#xA;t = 0:T;&#xA;x1 = randn(N,T+1);&#xA;x2 = repmat(randn(N,1), 1, T+1);&#xA;&#xA;figure&#xA;subplot(3,1,1); stem(t, x1(1,:));&#xA;subplot(3,1,2); stem(t, x1(2,:));&#xA;subplot(3,1,3); stem(t, x1(3,:));&#xA;&#xA;figure&#xA;subplot(3,1,1); stem(t, x2(1,:));&#xA;subplot(3,1,2); stem(t, x2(2,:));&#xA;subplot(3,1,3); stem(t, x2(3,:));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In this first figure, I plot three independent realizations of Random Process 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Mh7vC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Mh7vC.png&quot; alt=&quot;Three independent realizations of a white noise random process.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in this figure, three independent realizations of Random Process 2. Note that in this case, all the $x$ signals are constant, but the actual level changes from one realization to another:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lmTLj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lmTLj.png&quot; alt=&quot;Three independent realizations of a constant random process.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7289" LastEditorUserId="7289" LastEditDate="2016-05-06T18:47:32.753" LastActivityDate="2016-05-06T18:47:32.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30617" PostTypeId="1" AcceptedAnswerId="30618" CreationDate="2016-05-06T08:01:32.930" Score="2" ViewCount="1414" Body="&lt;p&gt;In the case of OFDM modulation, if the carrier frequency is slightly off  then how does that effect the constellation diagram ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some general rule how it will change (such as rotate) ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is it more or less arbitrary ?&lt;/p&gt;&#xA;" OwnerUserId="19066" LastActivityDate="2016-05-06T09:56:43.213" Title="How does carrier frequency offset effect the constellation diagram in OFDM?" Tags="|demodulation|ofdm|constellation-diagram|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30618" PostTypeId="2" ParentId="30617" CreationDate="2016-05-06T09:56:43.213" Score="2" Body="&lt;p&gt;so let's act as if we had only one active subcarrier &quot;at a time&quot;, just to ignore interference between the different subcarriers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency offset in time domain means a time offset in frequency domain, and probably a fractional one at that. Since that offset is constant for each carrier, the resulting sample stream (i.e. the output of your DFT) is simply shifted in time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now comes two things: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A frequency offset usually means that your sampling rates don't match perfectly, either. In any case, this means you're losing orthogonality of the OFDM subcarriers – which is why OFDM synchronizers need to be more accurate than (non-sinc-shaped) filterbank multicarrier systems, simply because each DFT bin &quot;sees&quot; energy of its adjacent, slightly shifted, neighbor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why OFDM systems typically make use of a proper preamble – if you enjoy reading classics, go for Schmidl and Cox' &lt;a href=&quot;https://scholar.google.de/scholar?oe=utf-8&amp;amp;gws_rd=cr&amp;amp;um=1&amp;amp;ie=UTF-8&amp;amp;lr&amp;amp;q=related:1K8_LtIDmTahtM:scholar.google.com/&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Robust frequency and timing synchronization for OFDM&lt;/em&gt;&lt;/a&gt; (Google tells me you can get the PDF from &lt;a href=&quot;http://home.mit.bme.hu/~kollar/papers/Schmidl2.pdf&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;) – in fact, that paper goes from understanding how to timing-synchronize an OFDM system to fixing the carrier offset (because they are so closely linked together). &lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-05-06T09:56:43.213" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30619" PostTypeId="1" AcceptedAnswerId="30621" CreationDate="2016-05-06T10:39:15.210" Score="4" ViewCount="1612" Body="&lt;p&gt;In linear prediction we can say that in case of optimum linear predictor the error with be orthogonal to data. And when we derive minimum mean square error for $\underline{y} = \mathbf{a}\underline{x} + \underline{b}$ case we find following relation&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\xi = \sigma^2_y (1 - \rho_{xy} )^2$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where $\rho_{xy} $ is correlation coefficient and if we talk about cross correlation $r_{xy}(k,l)$ of zero mean and uncorrelated random variables x and y, then how does this conclude that if $r_{xy}(k,l)$ will be then the signals will be orthogonal?&lt;/p&gt;&#xA;" OwnerUserId="12125" LastEditorUserId="12125" LastEditDate="2016-05-06T13:20:36.983" LastActivityDate="2016-05-07T10:33:58.520" Title="How is cross-correlation related with orthogonality?" Tags="|cross-correlation|statistics|linear-prediction|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30620" PostTypeId="1" CreationDate="2016-05-06T11:30:06.417" Score="4" ViewCount="102" Body="&lt;p&gt;I'm working in speech recognition research, and I wonder if there is a way to analyse sound just like how ears do (i.e. without windowing), so for example to take some feature continuously with an update for each new sample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is similar to talk about windowing with overlapping ratio of 99% or something like this,  you can look at the question like: &lt;strong&gt;How does ear working without windowing concept?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15851" LastEditorUserId="80" LastEditDate="2016-05-06T13:19:13.663" LastActivityDate="2016-05-06T13:19:13.663" Title="How to do continuous signal processing (i.e without windowing)?" Tags="|audio|continuous-signals|window-functions|speech-recognition|voice|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30621" PostTypeId="2" ParentId="30619" CreationDate="2016-05-06T12:17:20.830" Score="5" Body="&lt;p&gt;I suppose you mean the cross-correlation at lag zero. Well take an Hilbert space $H$ (i.e. a metric space in which you can define a scalar product $\langle\cdot ,\cdot\rangle$). Then $x,y\in H$ are orthogonal if $\langle x,y\rangle=0$, by definition.&lt;br&gt;&#xA;If your Hilbert Space is $L_2(\mathbb{R})$ (the space of real square integrable functions) then the scalar product of $f,g\in L_2(\mathbb{R})$ is defined as&lt;br&gt;&#xA;$$&#xA;\langle f, g\rangle = \int_{-\infty}^\infty \overline{f(t)}g(t) dt&#xA;$$&#xA;If the signals are assumed to be ergodic, which is actually a costumary assumption, then the cross-correlation is simply a sliding scalar product, you have&#xA;$$&#xA;\text{corr}(f,g)(\tau) = \int_{-\infty}^\infty\overline{f(t)}g(t+\tau) dt&#xA;$$&#xA;hence&#xA;$$&#xA;\text{corr}(f,g)(0) = \langle f ,g \rangle&#xA;$$&#xA;and uncorrelation means orthogonality.&lt;br&gt;&#xA;The same applies for discrete time signals in $l_2$&lt;/p&gt;&#xA;" OwnerUserId="20425" LastEditorUserId="20425" LastEditDate="2016-05-07T10:33:58.520" LastActivityDate="2016-05-07T10:33:58.520" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30622" PostTypeId="2" ParentId="30620" CreationDate="2016-05-06T12:25:40.937" Score="8" Body="&lt;p&gt;Yes, it's possible to analyse sound the way ears do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you could compute the DFT of a signal continuously using several &lt;a href=&quot;https://en.wikipedia.org/wiki/Goertzel_algorithm&quot;&gt;Goertzel filters&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;y_k[n] = e^{j2\pi k/N} y_k[n-1] + x[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k= 0,1,\ldots, N-1$, so that $y_0$ is the DC or zero frequency term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this is an unstable filter, so some resetting or forgetting factor is needed to keep it stable. There are ways to make it better behaved numerically (&lt;a href=&quot;http://alvand.basu.ac.ir/~dezfoulian/files/Numericals/Springer%20-%20Introduction%20to%20numerical%20analysis,%20Bulirsch,%20Stoer.%20(2ed.,%201993)(400dpi)(ISBN%200387978.pdf&quot;&gt;see pp84-93 of Stoer &amp;amp; Bulirsch&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why we &lt;em&gt;don't&lt;/em&gt; generally do things this way is that we are usually trying to do them in the most computationally efficient way possible.  And nature doesn't necessarily do this, so we find ways to do similar things but that work better on a computer.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-06T12:25:40.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30623" PostTypeId="1" CreationDate="2016-05-06T13:17:11.530" Score="2" ViewCount="3205" Body="&lt;p&gt;How does one get the frequency response of a filter, given an input signal and the signal output by the filter?&lt;/p&gt;&#xA;" OwnerUserId="20885" LastActivityDate="2017-03-03T20:24:47.903" Title="getting frequency response from input and output signal" Tags="|frequency-response|finite-impulse-response|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30624" PostTypeId="1" CreationDate="2016-05-06T13:39:05.170" Score="2" ViewCount="599" Body="&lt;p&gt;Suppose we have two sequences $x[n]$ of length $L$ , and $y[n]$ of length $P$. If we are doing a $L$ length circular convolution between the two sequences ($L&amp;gt;P$), how many of the resultant samples will be uncorrupted, i.e. same as linear convolution values ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think by intuition it should be $P-1$, but I'm not sure.&lt;/p&gt;&#xA;" OwnerUserId="20887" LastEditorUserId="128" LastEditDate="2020-03-11T06:35:24.027" LastActivityDate="2020-03-11T12:09:02.237" Title="How Many Samples Are Identical In Linear and Circular Convolution Result?" Tags="|discrete-signals|convolution|time-frequency|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="30625" PostTypeId="2" ParentId="30624" CreationDate="2016-05-06T13:46:53.627" Score="1" Body="&lt;p&gt;assuming $y[n]$ is padded with $L-P$ zeros (to make it the same length as $x[n]$ and your circular convolution length), then the number uncorrupted samples is $L-P+1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you might want to Google &quot;Overlap Save&quot; (OLS, a better name i have read is &quot;Overlap-Scrap&quot;), which is directly about this issue of uncorrupted samples in circular convolution.  the alternative is &quot;Overlap Add&quot; (OLA) which has no corrupted samples, but you have to overlap the tails of each block and add them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this is well covered in books like O&amp;amp;S.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-05-06T13:46:53.627" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30626" PostTypeId="2" ParentId="30623" CreationDate="2016-05-06T15:00:22.080" Score="0" Body="&lt;p&gt;Frequency response is simply the ratio of the Fourier transforms of the output and input signals.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ H(e^{j\omega}) = \frac{Y(e^{j\omega})}{X(e^{j\omega})} $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $Y(e^{j\omega})$ is the Fourier transform of output $y[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ Y(e^{j\omega}) = \sum\limits_{n=-\infty}^{+\infty} y[n] e^{-j\omega n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $X(e^{j\omega})$ is the Fourier transform of input $x[n]$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ X(e^{j\omega}) = \sum\limits_{n=-\infty}^{+\infty} x[n] e^{-j\omega n} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be a good idea to choose an input $x[n]$ such that $X(e^{j\omega}) \ne 0$ for all $\omega$ of interest in the frequency response.&lt;/p&gt;&#xA;" OwnerUserId="20890" LastEditorUserId="4346" LastEditDate="2016-09-04T06:18:44.340" LastActivityDate="2016-09-04T06:18:44.340" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30627" PostTypeId="2" ParentId="27668" CreationDate="2016-05-06T15:30:42.073" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;However, in Matlab it seems that to implement this I would need to assume either constant acceleration or velocity which is not the case since the rodent is freely moving.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;First of all you can choose any dynamic model not only constant acceleration or velocity. Secondly, In Kalman filter you don't need to have exact dynamic model. consider state dynamic equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\mathbf{x}_k = \mathbf{F}\mathbf{x}_{k-1} + \boldsymbol{\nu}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With your prior knowledge about the dynamic model of the system you specify transition matrix $\mathbf{F}$ and your uncertainty about this model is captured by the dynamic noise vector $\boldsymbol{\nu}$ which is a zero-mean multivariate Gaussian with covariance matrix $\mathbf{R}$. The more uncertain you are about $\mathbf{F}$ the larger the $\mathbf{R}$ you have to choose. The constant velocity or acceleration models are just the most basic dynamic models reflecting the nature lows of kinematics and most of the times they are good enough if you don't choose very small or very large $\mathbf{R}$.&lt;/p&gt;&#xA;" OwnerUserId="20890" LastActivityDate="2016-05-06T15:30:42.073" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30630" PostTypeId="1" AcceptedAnswerId="30650" CreationDate="2016-05-06T16:05:10.050" Score="8" ViewCount="261" Body="&lt;p&gt;&lt;strong&gt;Motivation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recently had my laptop stolen, with lots of pictures of my family, research work and other very important stuff. Of course the theft has been reported, but I think people here are more competent in image processing compared to the local police station :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Video Recordings&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stealing was captured by a security camera, original &lt;code&gt;.dav&lt;/code&gt; files can be downloaded from here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://drive.google.com/open?id=0B4g89zgPp-VzMVdoa1M1cVRKVUU&quot;&gt;ch10.dav&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://drive.google.com/open?id=0B4g89zgPp-VzNXZHcGpkZTJOOEE&quot;&gt;ch13.dav&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Converted &lt;code&gt;.avi&lt;/code&gt; files can be downloaded (or played in browser) from here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://drive.google.com/open?id=0B8IAesl5qmADMWI3SWRRU29UN2c&quot;&gt;ch10.avi&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://drive.google.com/open?id=0B8IAesl5qmADY0tsUGNDLVZPbWc&quot;&gt;ch13.avi&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the file named &lt;code&gt;ch10&lt;/code&gt; (full name: &lt;code&gt;HCVR_ch10_main_20160501143700_20160501143947&lt;/code&gt;) the thief's car enters the frame from the right at 0:48 . In the file named &lt;code&gt;ch13&lt;/code&gt; (full name: &lt;code&gt;HCVR_ch13_main_20160501143811_20160501144205&lt;/code&gt;), in the first 2 minutes, the thief's car enters the frame from the right, makes U-turn, steals my stuff,  makes a U-turn again and go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What has been tried?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried cropping a few frames around the license plate, stretch so that the plate will be on same position and size on every frame, and averaging. The result wasn't better from the original frames :(&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I get the number?&lt;/p&gt;&#xA;" OwnerUserId="20889" LastActivityDate="2021-04-15T20:41:31.370" Title="Identifying license plate number of a thief's car from a video" Tags="|image-processing|video-processing|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30631" PostTypeId="1" CreationDate="2016-05-06T16:08:54.937" Score="0" ViewCount="306" Body="&lt;p&gt;So I know how to plot fft the audio file within Matlab and a window pops up. My question is, what next? I want to know how to go about measuring the frequency(s). I have two similar audio files, of two people saying the same thing, and i want to see if there's a relationship (correlation) between their voices in terms of frequencies and speed (bpm)&lt;/p&gt;&#xA;" OwnerUserId="20893" LastEditorUserId="20893" LastEditDate="2016-05-06T17:04:31.957" LastActivityDate="2016-06-05T18:48:46.307" Title="How do I measure frequency of an audio file into an array?" Tags="|fft|audio|frequency|stft|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30632" PostTypeId="1" CreationDate="2016-05-06T17:06:54.410" Score="0" ViewCount="468" Body="&lt;p&gt;I have a measured signal (time domain) which I take the FFT of. I have a measured frequency dependent sensitivity (magnitude and phase (radians) as a function of frequency) which I need to apply to the measured signal. In effect perform a frequency dependent weighting to the measured signal's FFT.&#xA;I calculate the complex signal for the sensitivity magnitude and phase before dividing this into the FFT of the original signal.&#xA;I then take the IFFT of this which should give me something like the original signal shape but it does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my method correct?&lt;/p&gt;&#xA;" OwnerUserId="20895" LastEditorUserId="1629" LastEditDate="2016-07-05T20:52:25.777" LastActivityDate="2017-01-02T03:15:10.533" Title="Division of complex signal by frequency response" Tags="|fft|signal-analysis|ifft|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30633" PostTypeId="2" ParentId="30631" CreationDate="2016-05-06T17:54:53.383" Score="1" Body="&lt;p&gt;Speech processing is a very long and detailed topic, but let's make a start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Correlation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This probably won't work, but the first thing you can try is &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/xcorr.html&quot; rel=&quot;nofollow&quot;&gt;cross-correlation of the signals.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xc = xcorr(speaker_1, speaker_2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that really all you may get out of this is the delay between each sample (if you're lucky).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also get &lt;strong&gt;some&lt;/strong&gt; level of correlation coefficient by taking the peak value of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xc = xcorr(speaker_1/std(speaker_1), speaker_2/std(speaker2));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Where Next?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that doesn't work (I'm not hopeful), you will need to look at lots of other options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Blocking the data into frames&lt;/li&gt;&#xA;&lt;li&gt;Finding features within these frames (&lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_predictive_coding&quot; rel=&quot;nofollow&quot;&gt;LPCs&lt;/a&gt;, etc.).&lt;/li&gt;&#xA;&lt;li&gt;Using some method to time-align these between speech samples (&lt;a href=&quot;https://en.wikipedia.org/wiki/Dynamic_time_warping&quot; rel=&quot;nofollow&quot;&gt;DTW&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Finding some measure of &quot;likeness&quot; between the time-aligned features.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-06T17:54:53.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30634" PostTypeId="2" ParentId="30632" CreationDate="2016-05-06T18:46:47.250" Score="1" Body="&lt;p&gt;There are several things that could be going wrong here.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Check your FFT lengths&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do multiplication or division in the frequency domain, your frequency domain data needs to be at least as long as $N+M-$ where $N$ is your signal length, $M$ is your weighting length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matlab pseudo code this means you need:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = length(x);&#xA;M = length(w);&#xA;freq_length = N + M - 1;&#xA;&#xA;X = fft(x,freq_length);&#xA;W = fft(x,freq_length);&#xA;&#xA;y = ifft(X./W);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So your resulting &lt;code&gt;y&lt;/code&gt; will be longer than &lt;code&gt;x&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't do this, you will get time-domain aliasing because of the circular nature of convolution using the FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is your weighting real-valued in the time domain?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may need to use &lt;code&gt;conj(W)&lt;/code&gt; in the above, but you also need to check that &lt;code&gt;w&lt;/code&gt; (the time domain version of the frequency weighting) is real-valued. If it's not, you will get a complex-valued signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that you may get a small imaginary component.  Often times all that is required to remove this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;yr = real(y);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-06T18:46:47.250" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30636" PostTypeId="2" ParentId="30451" CreationDate="2016-05-06T20:01:49.580" Score="2" Body="&lt;p&gt;It is just an idea but how about a mean of the terms in a sliding window. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = zeros(1,250);&#xA;c = randi(50,1,15);&#xA;x(c) = randi(500,1,15);&#xA;y = x;&#xA;d = randi(15,1,3);&#xA;y(c(d)) = 0;&#xA;&#xA;figure;&#xA;stem(x,'LineWidth',1); hold on; stem(y,'LineWidth',1);&#xA;legend('Original Signal','Signal with Missing Samples');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Uaiyz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Uaiyz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;N = 5;&#xA;L = numel(x)/N;&#xA;[m, m1] = deal(zeros(1,L));&#xA;&#xA;for i = 1:L&#xA;    mx(1,i) = mean(x((i-1)*N+1:i*N));&#xA;    my(1,i) = mean(y((i-1)*N+1:i*N));&#xA;end&#xA;&#xA;figure;&#xA;stem(mx,'LineWidth',1); hold on; stem(my,'LineWidth',1);&#xA;legend('Mean of x', 'Mean of y');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xyL5z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xyL5z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the plots are very similar now. You can also check their cross-correlation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figure;&#xA;stem(xcorr(mx,my),'LineWidth',2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6GWLh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6GWLh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are of course just ideas to get you started. Now you can play with the window size and instead of doing $1:N$, $N+1:2N$ you can try $1:N$, $2:N+1$ , etc. and replace mean with other statistical parameters to see which one works the best for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps!&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-05-06T20:01:49.580" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30637" PostTypeId="1" CreationDate="2016-05-06T20:35:38.457" Score="2" ViewCount="1612" Body="&lt;p&gt;I have a set of GPS satellite signal data, the set is 1 ms long and has the information of two satellites (satellite number, code phase and frequency) buried in noise. This data has a carrier frequency of 4.309 Mhz and the sampling rate is 5.714 Mhz.I've been reading but I don't really have pretty clear what to do:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;which are the options to make the acquisition? As far as I've read, there are two options: time and frequency based acquisition. which is the best option to use?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The set of data is noisy and continuous:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6PVCY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6PVCY.png&quot; alt=&quot;Satellite data&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have generated the C/A gold sequencies sampled at 5.714 Mhz in order to perform the correlation with the satellite data. How can I design a narrowband filter to get rid of the noise? The local coded I generated are sequencies of +1's and -1's. Do I need to convert this data also into -1's and +1's to perform the acquisition?&lt;/p&gt;&#xA;" OwnerUserId="15442" LastActivityDate="2017-04-23T11:41:47.073" Title="GPS signal acquisition" Tags="|filters|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30638" PostTypeId="1" CreationDate="2016-05-06T21:11:43.313" Score="3" ViewCount="424" Body="&lt;p&gt;I implemented a Wiener filter using Matlab and i noticed that both functions(mine and matlabs) are creating an image with shifted pixels on the edges. Class teacher said it will happen. Is there a simple explanation to that?&lt;/p&gt;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%open image&#xA;I = imread('pout.tif');&#xA;&#xA;%sigma for gaussian&#xA;sigma = 1.2;&#xA;%gaussian kernel max width/height &#xA;N = 2*ceil(3*sigma)+1;&#xA;&#xA;%gaussian PSF(point spread function) &#xA;PSF = fspecial('gaussian',N,sigma);&#xA;&#xA;%Noise&#xA;NSR = 0.05;&#xA;&#xA;%Matlab's Wiener function.&#xA;I1 = deconvwnr(I,PSF,NSR);&#xA;&#xA;%New PSF for my implementation&#xA;PSF1 = zeros(N,N);&#xA;%loop to create the 2D gaussian psf.&#xA;x = (N/2)-0.5;&#xA;for i = -x:x&#xA;    for j = -x:x&#xA;        %gaussian &#xA;         PSF1(i+x+1,j+x+1) = exp( -( ( (i^2) + (j^2) ) / ( 2 * (sigma^2) ) ) );&#xA;    end&#xA;end&#xA;&#xA;%normalization&#xA;PSF1=PSF1/sum(sum(PSF1));&#xA;&#xA;%fourier transformation of PSF1.&#xA;fouri = zeros(size(I,1),size(I,2));&#xA;fouri(1:N,1:N)= PSF1;&#xA;H = fft2(fouri);&#xA;&#xA;%uint8 to double of the original image.&#xA;I = double(I);&#xA;%fourier transformation of the image&#xA;Y = fft2(I);&#xA;%Wiener function.&#xA;X = conj(H)./ ( abs(H).^2 + NSR ).*  Y;&#xA;&#xA;%exit from fourier transformation.&#xA;I2 = real(ifft2(X));&#xA;%go back to uint8 for both images.&#xA;I2 = uint8(I2); &#xA;I = uint8(I);&#xA;&#xA;%Results.&#xA;subplot(1,3,1); imshow(I); title('Original');&#xA;subplot(1,3,2); imshow(I1); title('Matlab function');&#xA;subplot(1,3,3); imshow(I2); title('My implementation');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2DdAb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2DdAb.png&quot; alt=&quot;input and output shifted image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20876" LastEditorUserId="33605" LastEditDate="2023-07-17T01:05:03.730" LastActivityDate="2023-07-17T01:05:03.730" Title="Why pixels on image edges are shifted when using Wiener filter?" Tags="|image-processing|fft|matlab|filters|convolution|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="30639" PostTypeId="1" AcceptedAnswerId="30657" CreationDate="2016-05-06T23:13:48.733" Score="3" ViewCount="119" Body="&lt;p&gt;I have data from two channels, $A$ and $B$. The first contains a signal of interest, $s[n]$, plus some additive white Gaussian noise, and the second contains a scaled (real, non-negative) copy of my signal of interest and noise with different variance (different noise power).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;a[n] &amp;amp;=   s[n] + N_a[n]\\&#xA;b[n] &amp;amp;= m \cdot s[n] + N_b[n]&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know $s[n]$, but assume it is mean zero, and I don't know the noise powers, but they are comparable or slightly higher than the signal power.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is it possible to get an unbiased estimate of $m$?  &lt;/li&gt;&#xA;&lt;li&gt;If so, how?  &lt;/li&gt;&#xA;&lt;li&gt;If not, how could I prove that?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If I could estimate the variance on $N_a$, the following would work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{m} = \frac{\sum_n b[n]a^*[n]}{\sum_n a[n]a^*[n] - \sum_n \sigma^2_{N_a} } $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(edit: correction due to robert bristow-johnson - I need the ratio of the sum, not the sum of ratio)&lt;/p&gt;&#xA;" OwnerUserId="20899" LastEditorUserId="4346" LastEditDate="2016-05-08T03:56:12.837" LastActivityDate="2016-05-09T16:23:14.220" Title="Power estimation" Tags="|parameter-estimation|" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30640" PostTypeId="1" AcceptedAnswerId="30641" CreationDate="2016-05-07T01:55:51.567" Score="3" ViewCount="245" Body="&lt;p&gt;I was wondering why the energy of a signal is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E=\int_{-\infty}^{\infty}|x(t)|^2dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, I know that it is a &lt;em&gt;definition&lt;/em&gt;, but is there a physical reason for it being defined like that?&lt;/p&gt;&#xA;" OwnerUserId="19249" LastActivityDate="2016-05-07T02:48:59.253" Title="Definition of energy of a signal" Tags="|signal-analysis|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30641" PostTypeId="2" ParentId="30640" CreationDate="2016-05-07T02:08:18.540" Score="5" Body="&lt;p&gt;As we know $E = Pt$ where $E$ is the energy and $t$ is the time. In the continuous domain $t$ is never ending and its beginning isn't known either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, signals in the continuous domain are voltages and as you know from Ohm's Law $V = IR$ and $P = I^2R$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This basically tells you that for a given resistance $R$, the energy of a signal over a time interval is given by the integration of the power. So,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ E = \int\limits_{t_1}^{t_2} P(t) ~dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which in this case becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;E &amp;amp;= \int\limits_{-\infty}^{\infty} I^2(t)R ~dt\\&#xA;&amp;amp;= R\int\limits_{-\infty}^{\infty} I^2(t) ~dt\\&#xA;&amp;amp;= \int\limits_{-\infty}^{\infty} I^2(t) ~dt~~\text{(For $R = 1$)}&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually in SP world we like to represent the signal as $x(t)$ giving us&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E = \int\limits_{-\infty}^{\infty} \left|x(t)\right|^2 ~dt$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="8712" LastEditorUserId="8712" LastEditDate="2016-05-07T02:48:59.253" LastActivityDate="2016-05-07T02:48:59.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30642" PostTypeId="1" AcceptedAnswerId="30644" CreationDate="2016-05-07T02:41:16.663" Score="0" ViewCount="165" Body="&lt;p&gt;I am solving a question that says if we have sequence $x(n)$ of a signal missing one term then we have to find autocorrelation matrix $R_x$ as follows: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_x = E\{\mathbf {xx^H}\}$$ &#xA;Now if I take $x(n) = [x(0) , x(2),x(3)]$ that is missing term $x(1)$&#xA;I found following value of $R_x$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$R_x =  $$\left(&#xA;        \begin{matrix}&#xA;        r_x(0) &amp;amp; r_x^*(2) &amp;amp; r_x^*(3) \\&#xA;        r_x(2) &amp;amp; r_x(0) &amp;amp; r_x^*(1) \\&#xA;        r_x(3) &amp;amp; r_x(1) &amp;amp; r_x(0) \\&#xA;        \end{matrix} \right)&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I check that this matrix is Toeplitz or not, by the definition of Toeplitz (constant diagonal term) $R_x$ is Toeplitz. But when I checked the solution it says the above matrix is not Toeplitz and there is no explanation given. I wonder what I am missing in definition of a Toeplitz matrix that does not fit in the above matrix. Can anyone explain this?&lt;/p&gt;&#xA;" OwnerUserId="12125" LastEditorUserId="1629" LastEditDate="2016-05-07T10:24:09.513" LastActivityDate="2016-05-07T10:24:09.513" Title="How is the matrix $\mathbf R_x$ not Toeplitz in case of a signal missing one term?" Tags="|discrete-signals|autocorrelation|matrix|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30643" PostTypeId="2" ParentId="10894" CreationDate="2016-05-07T02:47:23.177" Score="0" Body="&lt;p&gt;I figured this out by making up a &lt;code&gt;N=2&lt;/code&gt; signal, &lt;code&gt;X&lt;/code&gt;, e.g. (matlab) &lt;code&gt;X = [2 3]';&lt;/code&gt; and then doing its sample autocorrelation by hand. I used Marple's 1987 text. Then I did &lt;code&gt;N=3&lt;/code&gt; version and &lt;code&gt;N=4&lt;/code&gt; and saw the pattern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's matlab code to do it&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clear all;  &#xA;close all;  &#xA;Xm(:,1) = [3 1 4 6 9 3 6 1 2 -55 6 3]'; %original signal  &#xA;N = length(Xm(:,1));  &#xA;mu = sum(Xm(:,1))/N; % get the sample mean  &#xA;&#xA;var = 0;  &#xA;for i=1:N  &#xA;  var = var + (Xm(i,1)-mu)^2;  &#xA;end  &#xA;var = var / N; % get the sample variance  &#xA;&#xA;% first col of X has the adjusted signal, and we'll put our recovered X in&#xA;% the second column so they're easy to compare.&#xA;&#xA;X(:,1) = Xm(:,1) - mu;  &#xA;R = autocorr(X(:,1), N-1);  &#xA;&#xA;C = R * var; % this is the denormalized autocovariance.  &#xA;M = triu(toeplitz(X(:,1))); % C = MX (the first col of X, actually)  &#xA;&#xA;X(:,2) = N*inv(M)*C;  &#xA;Xrec = X(:,2)+mu; % this is the recovered Xm.  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20902" LastEditorUserId="15892" LastEditDate="2016-05-07T08:42:04.680" LastActivityDate="2016-05-07T08:42:04.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30644" PostTypeId="2" ParentId="30642" CreationDate="2016-05-07T03:01:41.800" Score="1" Body="&lt;p&gt;For $\boldsymbol{R}_x$ to be toeplitz it should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\boldsymbol{R}_x = \begin{bmatrix}r_{x}(0) &amp;amp; r_{x}(2) &amp;amp; r_{x}(3) \\ r_{x}(2) &amp;amp; r_{x}(0) &amp;amp; r_{x}(2) \\&#xA;r_{x}(3) &amp;amp; r_{x}(2) &amp;amp; r_{x}(0) \end{bmatrix} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is not, it is not a toeplitz matrix.&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-05-07T03:01:41.800" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30647" PostTypeId="2" ParentId="19873" CreationDate="2016-05-07T04:48:57.770" Score="1" Body="&lt;p&gt;to interpolate in the image domain, you don't do any zero padding there.  take your entire image, FFT it, and with the properly swapped quadrants, zero pad that in the 2D-frequency domain.  the IFFT it back and you have more points for the same image.&lt;/p&gt;&#xA;" OwnerUserId="4346" LastActivityDate="2016-05-07T04:48:57.770" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30648" PostTypeId="2" ParentId="25434" CreationDate="2016-05-07T06:21:29.267" Score="1" Body="&lt;p&gt;One key difference between the DFT and discrete wavelet transform (DWT) is that the DFT deals with &lt;em&gt;frequency&lt;/em&gt; whereas the wavelet transform deals with &lt;em&gt;&quot;scales&quot;&lt;/em&gt;. (e.g. you estimate the width of a pulse or a series of pulses in a time series). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A radio signal is more or less a continuous signal when observed locally. A constant waveform signal is very sparse when decoded by FFT. So it is very easy and natural to represent an RF signal using the DFT/frequency domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the common issues one have to deal with in regards to the DFT is spectral leakage. Unfortunately, the wavelet kernels generally have a good amount of spectral leakage also so this issue cannot be improved by using the DWT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The WT does have some useful properties. Aside from the examples you listed, there are some applications in time series analysis where the WT trumps the DFT. For example, detecting drift of atomic clocks or measuring changes in tides (see Wavelet Methods, by Percival and Walden). Also, a more limited application: the WT can be used for denoising a signal when you want to preserve the spikes as well as the baseline drift (e.g. to visually make a spectrum look cleaner).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of time-frequency analysis, the Gabor wavelet is probably the closest you get to STFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like the DFT/FFT the DWT is an orthogonal transform. However, the continuous wavelet transform (CWT), which is computed using convolution, is not. It's useful as an analysis tool only.&lt;/p&gt;&#xA;" OwnerUserId="8167" LastActivityDate="2016-05-07T06:21:29.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30650" PostTypeId="2" ParentId="30630" CreationDate="2016-05-07T16:04:43.917" Score="4" Body="&lt;p&gt;Averaging may not be the best option, due to motion compensation in video frames: one number (say $8$) may be extrapolated for another (say $3$) on a different JPEG block. It might be interesting to dig into the compressed video format, check motion vectors, but this requires a little bit of hacking. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some software which can help:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ampedsoftware.com/samples&quot; rel=&quot;nofollow noreferrer&quot;&gt;Amped FIVE&lt;/a&gt; (used by the local CSI here, I learned it directly from them), with a &lt;a href=&quot;https://www.youtube.com/watch?v=1mrPp3iGKzo&quot; rel=&quot;nofollow noreferrer&quot;&gt;live demo&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.focusmagic.com/forensics-tutorial.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Focus Magic&lt;/a&gt;, with a &lt;a href=&quot;http://www.ronmartblog.com/2009/02/review-focus-magic.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;review here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, while your videos are pretty good, the problem sounds quite difficult. For alight side, I'd like to share the following picture, that tells about issues in image forensics:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QECMe.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QECMe.gif&quot; alt=&quot;image processing CIS&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-05-07T16:04:43.917" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30651" PostTypeId="2" ParentId="30639" CreationDate="2016-05-07T16:27:15.333" Score="0" Body="&lt;p&gt;Well, the obvious approach is to just do&#xA;$$&#xA;\hat{m} = b[n] / a[n]&#xA;$$&#xA;for any particular $n$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that because $a$ and $b$ are Gaussian, the division will be Cauchy distributed. Unfortunately, averaging Cauchy random variables does not improve the variance, so doing&#xA;$$&#xA;\frac{1}{N} \sum_{n=0}^{N-1} b[n] / a[n]&#xA;$$&#xA;won't improve the estimate.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-05-09T15:18:37.653" LastActivityDate="2016-05-09T15:18:37.653" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30653" PostTypeId="1" AcceptedAnswerId="36731" CreationDate="2016-05-07T18:41:37.497" Score="9" ViewCount="15690" Body="&lt;p&gt;I would like to know what does Bandwidth-Time product mean. I understand that Bandwidth ($B$) = 1/Symbol Time ($T$), hence $BT = 1$. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;But how can it vary? &lt;/li&gt;&#xA;&lt;li&gt;What is its significance?&lt;/li&gt;&#xA;&lt;li&gt;e.g. When we say GFSK is GMSK when $BT = 0.5$, what does that mean exactly?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11780" LastEditorUserId="1629" LastEditDate="2016-05-08T13:22:54.460" LastActivityDate="2018-04-16T19:52:56.467" Title="What is a $BT$ (Bandwidth-Time) product with reference to modulation?" Tags="|modulation|gaussian|bandwidth|fsk|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30654" PostTypeId="1" AcceptedAnswerId="30656" CreationDate="2016-05-07T20:57:00.543" Score="2" ViewCount="3368" Body="&lt;p&gt;I'm currently studying some OFDM techniques, and have found that in order to avoid Inter-Symbol Interference (ISI), there needs to be some space in between symbols. Lets assume this length to be $\mu$. This can either be done by adding a cyclic prefix to the beginning of the OFDM symbol, or by adding a simple guard interval (no transmission). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me like a cyclic prefix is typically used, but I'm not sure why this is used over a guard interval. using a guard interval would save power, and since the first $\mu$ points of the received signal will be ignored anyways, wouldn't it be better to save power? I'm not sure what the advantages of using a cyclic prefix are. Thanks for any insight!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastEditorUserId="11256" LastEditDate="2016-05-08T21:39:08.530" LastActivityDate="2019-02-23T13:24:25.923" Title="Cyclic prefix vs. guard interval. Why use one over the other?" Tags="|signal-analysis|digital-communications|ofdm|" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30655" PostTypeId="1" AcceptedAnswerId="30675" CreationDate="2016-05-07T22:37:59.483" Score="0" ViewCount="2522" Body="&lt;p&gt;I'm trying to plot the frequency response $H(z)$ of given zeros/poles using the following code in MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z=[0.36545+0.88446i; 0.01-0.1057i;]&#xA;p=[-0.46016+0.87251i; -0.37649-0.94861i;]&#xA;[num, den]=zp2tf(z,p,K)&#xA;[h,w]=freqz(num,den)&#xA;plot(w,abs(h))   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it appears it doesn't work correctly when the coefficients of the transfer function $H(z)$ are complex. And it gives a different response compared to the expected response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the expected transfer function: &#xA;    $$H(z)=\frac{1+(-1.3745-0.77689i)z^{-1}+(0.46331+0.85406i)z^{-2}}{1+       (0.83665-0.023904i)z^{-1}+(0.91366+0.061999i)z^{-2}}$$&lt;/p&gt;&#xA;" OwnerUserId="20773" LastEditorUserId="20773" LastEditDate="2016-05-08T16:01:13.117" LastActivityDate="2016-05-08T20:21:56.823" Title="Frequency response given poles and zeros" Tags="|matlab|frequency-response|poles-zeros|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30656" PostTypeId="2" ParentId="30654" CreationDate="2016-05-07T23:02:23.950" Score="2" Body="&lt;p&gt;A silent  guard interval would likely increase PAPR (peak to average power), which requires a sender capable of more dynamic range (without clipping or generating power supply noise, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A long enough cyclic prefix prevents multipath echoes from one symbol interfering with the portion of the next symbol after the prefix.  And a symbol interfering with itself from only its own multipath echo can be modeled as a flat fading channel, which may be easier to equalize or to error correct over a far wider range of multipath channel responses.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="154" LastEditDate="2016-05-07T23:07:47.653" LastActivityDate="2016-05-07T23:07:47.653" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30657" PostTypeId="2" ParentId="30639" CreationDate="2016-05-08T02:08:53.903" Score="2" Body="&lt;p&gt;changing the notation to something better, i think the summations have to go in both the numerator and denominator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \hat{m} = \frac{\sum_n b[n]a^*[n]}{\sum_n a[n]a^*[n] - \sum_n \sigma^2_{N_a} }&#xA; $$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is a plot showing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The variation in choosing different $\sigma_{N_a}^2$ values from the true value. The true value is shown by the red line.&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Upshot: always &lt;strong&gt;under&lt;/strong&gt; estimate it, or just choose it to be zero.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;The true value of $m$ in green vs various $b/a$ values from @Peter K.'s answer.&lt;/li&gt;&#xA;&lt;li&gt;The estimates for 100 runs of both estimators. Blue is this estimator, green is the middle quintile of the $b/a$ values.&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For this particular run, the variance of this estimator was 0.03013508; the $b/a$ estimator's was 0.04913840.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bottom line:&lt;/strong&gt; Use this estimator with $\sigma_{N_a}^2 = 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IBxI1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IBxI1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;R Code Below&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 30639&#xA;N &amp;lt;- 1000&#xA;&#xA;s &amp;lt;- rnorm(N, 0, 1)&#xA;&#xA;sigma_a &amp;lt;- 0.1&#xA;sigma_b &amp;lt;- 0.2&#xA;&#xA;na &amp;lt;- rnorm(N,0,sigma_a)&#xA;nb &amp;lt;- rnorm(N,0,sigma_b)&#xA;&#xA;m &amp;lt;- 10&#xA;&#xA;a &amp;lt;- s + na&#xA;b &amp;lt;- m*s  + nb&#xA;&#xA;ix &amp;lt;- 1&#xA;&#xA;test_values &amp;lt;- seq(0,sigma_b*4,0.001)&#xA;mhat &amp;lt;- 0*test_values&#xA;for (test_sigma_b in test_values)&#xA;{  &#xA;  mhat[ix] &amp;lt;- sum(b * a)/(sum(a*a) - N*test_sigma_b*test_sigma_b)&#xA;  ix &amp;lt;- ix + 1&#xA;}&#xA;&#xA;par(mfrow=c(3,1))&#xA;plot(test_values, mhat, ylim=c(-10,20), type=&quot;l&quot;)&#xA;lines(c(sigma_b, sigma_b), c(-10,20), col=&quot;red&quot;);&#xA;title('Effect of varying sigma_b')&#xA;&#xA;plot(b/a,  pch=10, col=&quot;grey&quot;, ylim=c(-10,20))&#xA;lines(c(1,N), c(m, m), type=&quot;l&quot;, col=&quot;green&quot;, lwd=10)&#xA;#lines(c(1,N), c(mhat, mhat), type=&quot;l&quot;, col=&quot;blue&quot;, lwd=5)&#xA;title('True m value vs b/a estimate')&#xA;&#xA;Nruns &amp;lt;- 100&#xA;mhat_1 &amp;lt;- rep(0,Nruns)&#xA;mhat_2 &amp;lt;- rep(0,Nruns)&#xA;&#xA;for (run_number in seq(1,Nruns))&#xA;{&#xA;  s_run &amp;lt;- rnorm(N, 0, 1)&#xA;  a_run &amp;lt;- s_run + rnorm(N,0,sigma_a)&#xA;  b_run &amp;lt;- m * s_run + rnorm(N,0,sigma_b)&#xA;&#xA;  mhat_1[run_number] &amp;lt;- sum(b_run * a_run)/sum(a_run*a_run)&#xA;  mhat_2[run_number] &amp;lt;- quantile(b_run/a_run)[3]&#xA;}&#xA;&#xA;sds &amp;lt;- c(sd(mhat_1), sd(mhat_2))&#xA;print(sds)&#xA;&#xA;plot(mhat_1, type=&quot;l&quot;, col=&quot;blue&quot;)&#xA;lines(mhat_2, col=&quot;green&quot;)&#xA;title('BLUE: rb-j estimate GREEN: middle quintile of b/a estimate')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4346" LastEditorUserId="80" LastEditDate="2016-05-09T16:23:14.220" LastActivityDate="2016-05-09T16:23:14.220" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="30658" PostTypeId="1" AcceptedAnswerId="30659" CreationDate="2016-05-08T02:37:24.260" Score="0" ViewCount="275" Body="&lt;p&gt;I am trying to understand the functionality of &lt;code&gt;fft.m&lt;/code&gt; in matlab . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: if I input a signal of length $7$, and use the FFT function, the output is of the same length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does that occur if the radix-$2$ takes the nearest power of $2$, which is $8$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does it return an output of length $7$, assuming it operates the way I described? &lt;/p&gt;&#xA;" OwnerUserId="20915" LastEditorUserId="15892" LastEditDate="2016-05-08T09:12:23.977" LastActivityDate="2016-05-08T15:35:06.063" Title="Output signal length after fft" Tags="|matlab|fft|" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30659" PostTypeId="2" ParentId="30658" CreationDate="2016-05-08T03:40:18.623" Score="0" Body="&lt;p&gt;There are lots of FFT algorithms, and they don't all require power of 2 sizes.  For instance, you can do &lt;em&gt;any size&lt;/em&gt; (including prime sizes like 7) with Bluestein's (Chirp-Z) algorithm, and the algorithm is still fast ($N \log(N)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've heard that MATLAB uses FFTW under the hood, and FFTW includes many (all?) of these other algorithms.  So MATLAB can do a length 7 FFT without rounding it to a power of 2.&lt;/p&gt;&#xA;" OwnerUserId="20899" LastEditorUserId="15892" LastEditDate="2016-05-08T15:35:06.063" LastActivityDate="2016-05-08T15:35:06.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30660" PostTypeId="2" ParentId="30658" CreationDate="2016-05-08T05:23:38.363" Score="0" Body="&lt;p&gt;I think it has to do with the DFT expansion&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[k] = \sum\limits_{n=0}^{N-1} x[n]e^{-j2\pi nk/N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X[0] = \sum\limits_{n=0}^{N-1} x[n]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you will see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;X[N] &amp;amp;= \sum\limits_{n=0}^{N-1} x[n]e^{-j2\pi n N/N}\\&#xA;&amp;amp;= \sum\limits_{n=0}^{N-1} x[n]e^{-j2\pi n}\\&#xA;&amp;amp;= \sum\limits_{n=0}^{N-1} x[n]&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is again same as $X[0]$. Basically the DFT starts repeating after $N$ samples. So all the required information is already present in the first N frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now $N$ could be defined by you. It is recommended to use $N$ to be the nearest power of $2$ of the length of the input signal. This is done to speed up the FFT computation (radix-2 as you pointed out). If the length of the input signal is more than that, it will be truncated else $0$s will be added. The output length will be same as the input length or the $N$ that you describe.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="8712" LastActivityDate="2016-05-08T05:23:38.363" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30661" PostTypeId="2" ParentId="30658" CreationDate="2016-05-08T05:48:49.960" Score="0" Body="&lt;p&gt;If a length can be broken down into very small prime factors, such as 2, then the FFT of that length can be computed using less steps (MACs, etc.) than using a full DFT to compute the same result.  If not, such as with a length 7, which can't be broken down into smaller factors, then a simple FFT engine often defaults to doing the same computational steps as a DFT, and thus not really a F/Faster FT. And a DFT is the same for any length, output length = input length.&lt;/p&gt;&#xA;" OwnerUserId="154" LastActivityDate="2016-05-08T05:48:49.960" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30662" PostTypeId="1" AcceptedAnswerId="30664" CreationDate="2016-05-08T08:42:12.760" Score="1" ViewCount="3369" Body="&lt;p&gt;What I am trying to achieve is getting the fundamental frequency of a note played by an instrument. What I have already done is performing an FFT on a samples of audio file, and here's what I get:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uxiA4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uxiA4.png&quot; alt=&quot;FFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that I just tried to find the maximum value in that dataset and I get &quot;4138&quot;. Unfortunately, the note being played in the audio file is an E and from internet I know that the E note should have 5274.04 Hz or 2637.02 Hz.&lt;br&gt;&#xA;I continued reading some additional info on the internet and found interesting info that in some cases fundamental frequencies could be missing from the sound, so I have tried doing some autocorrelation on the samples I got from the audio file to find the fundamental frequency and I got something like this:      &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BhGn6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BhGn6.png&quot; alt=&quot;autocorrelation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looked like a frequency domain for me so I performed FFT on that dataset but got similar results.&lt;br&gt;&#xA;Also I have read that some people suggest using HPS (Harmonic Product Spectrum) for finding the fundamental frequency, I have tried that but obviously the result was the same, as the FFT itself didn't change.&lt;br&gt;&#xA;P.S. Of course I use Hamming windowing function for samples. The library I use for FFT is JTransforms.&lt;/p&gt;&#xA;" OwnerUserId="20918" LastEditorUserId="15892" LastEditDate="2016-05-08T09:09:54.650" LastActivityDate="2016-05-10T05:29:55.943" Title="Determining the fundamental frequency/pitch of a note" Tags="|fft|signal-analysis|autocorrelation|music|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30663" PostTypeId="1" CreationDate="2016-05-08T12:45:14.630" Score="2" ViewCount="1401" Body="&lt;p&gt;I have a sampled signal which contains (among other things) some damped oscillations. From the underlying theory I have reasons to believe that it can be characterized by some specific frequencies of oscillation $\omega$ and rates of decay $-\sigma$. I believe the signal contains components of the form $f(t)=e^{\sigma t+i \omega t}$. It might be that these are &quot;there&quot; only in some part of the signal, because at late times other components win over (due to exponential damping of these oscillations). I am interested in finding these dominating timescales. I need a hint how to proceed. There are plenty of tools available, like Fourier analysis, wavelets etc. However, I don't know which is the most appropriate for this task, as I have no experience with any of them, except maybe the Fourier transform. Below I include a graph of the signal that I want to analyze.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/tUQxo.png&quot; alt=&quot;One of my datasets&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tUQxo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/tUQxo.png&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20920" LastEditorUserId="15892" LastEditDate="2016-05-08T13:25:09.770" LastActivityDate="2016-05-08T21:28:45.277" Title="How to detect decaying oscillations in a signal" Tags="|signal-analysis|frequency-spectrum|frequency|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30664" PostTypeId="2" ParentId="30662" CreationDate="2016-05-08T13:37:12.767" Score="0" Body="&lt;p&gt;Ok, everything was working quite fine, the only thing that I have missed is another formula that is used to get the &quot;real&quot; frequency from the FFT power spectrum. And the formula is as follows:      &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;frequency = indexMax * Fs / L;&lt;br&gt;&#xA;  where:&lt;br&gt;&#xA;  indexMax - index of the maximum in power spectrum;&lt;br&gt;&#xA;  Fs - sampling rate of an audio file;&lt;br&gt;&#xA;  L - length of the power spectrum array.       &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;br&gt;&#xA;This approach is working fine for such trivial tasks as making a tuner or something like that, but as &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;robert bristow-johnson        &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;pointed out, this implementation will, in some cases, ignore the fundamental frequency and potentially show you frequency of one of the harmonics. So a better approach would be        &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Autocorrelation&lt;/li&gt;&#xA;&lt;li&gt;AMDF&lt;/li&gt;&#xA;&lt;li&gt;ASDF&lt;/li&gt;&#xA;&lt;li&gt;YIN&lt;/li&gt;&#xA;&lt;li&gt;Mcleod Pitch method&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20918" LastEditorUserId="20918" LastEditDate="2016-05-10T05:29:55.943" LastActivityDate="2016-05-10T05:29:55.943" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30665" PostTypeId="1" AcceptedAnswerId="30669" CreationDate="2016-05-08T16:08:21.417" Score="1" ViewCount="1235" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The impulse response of a continuous time system is $h(t) = e^{-t}u(t)$. When $x(t) = u(t - 1)$ is input to this system what is&#xA;  the value of the output signal $y(t)$ at $t = 2.34$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Attempt&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For convolution $y(t) = h(t) \star x(t)$&#xA;\begin{align}&#xA;x(2.27) &amp;amp;= u(2.34-1) = 1\\&#xA;h(2.27) &amp;amp;= e^{-2.34}\cdot u(2.34) = 0.09632763823\\&#xA;\Longrightarrow y(t) &amp;amp;= 1 \cdot 0.09632 = 0.096&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the answer is wrong. Not too sure where my mistake is. Could someone correct my error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second Attempt&lt;/strong&gt;&#xA;\begin{align}&#xA;y(t) &amp;amp;= ∫x(\tau)h(t-\tau)d\tau \quad\text{with limits negative and positive infinity}\\&#xA;&amp;amp;= ∫u(\tau-1)e^{-\tau}u(t-\tau)d\tau \\&#xA;&amp;amp;= ∫e^{-\tau}u(\tau-1)u(t-\tau)d\tau \\&#xA;&amp;amp;= ∫e^{-\tau}d\tau \quad \text{with limits 1 to 2.34}\\&#xA;&amp;amp;= 0.2715518029 &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though the answer still appears to be wrong.&lt;/p&gt;&#xA;" OwnerUserId="20711" LastEditorUserId="1629" LastEditDate="2016-05-08T18:39:01.273" LastActivityDate="2016-05-08T21:41:47.020" Title="Impulse response of a continuous time system" Tags="|infinite-impulse-response|homework|" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30666" PostTypeId="1" AcceptedAnswerId="30684" CreationDate="2016-05-08T17:56:41.030" Score="9" ViewCount="15955" Body="&lt;p&gt;When analyzing a control system via Bode, Nyquist and Root-Locus, are we using open or closed loop information? I'm not able to understand when the poles of the open loop are used and when the one of the closed loop are. I think that what interests us is the information about closed loop, as that determines whether the final system is stable or not, but I'm pretty confused with this issue.&lt;/p&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="38383" LastEditDate="2019-12-20T12:13:26.997" LastActivityDate="2020-06-03T14:10:15.843" Title="Do we use closed loop or open loop information in Bode plot, Nyquist plot and Root Locus?" Tags="|control-systems|feedback|" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30667" PostTypeId="1" CreationDate="2016-05-08T18:06:28.720" Score="1" ViewCount="1296" Body="&lt;p&gt;I'm trying to calculate coefficients for my Butterworth filter of my own. I've found &lt;a href=&quot;https://engineering.purdue.edu/~ee538/AnalogFilterDesigns.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; that looks really reliable. But I'm trying to implement it in MATLAB and I'm getting bandstop filter.&#xA;Please find attached matlab script below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc, clear all, close all;&#xA;%DIGITAL BUTTERWORTH FILTER DESING  &#xA;%Butterworth LP with -3dB at fc and N order and G gain&#xA;fs = 10; %frequency sampling&#xA;fc = 1;   %cut off frequency&#xA;N = 2;      %filter order&#xA;G = 1;      %filter gain&#xA;wc = 2*pi*fc;&#xA;&#xA;%analog filter design&#xA;%poles and zeros   &#xA;k = [1:1:N];&#xA;%poles searching&#xA;%sk = wc * exp(((j*pi)/(2*N))*(2.*k+N-1))&#xA;sk = wc * exp(j*(pi/2)) * exp(j*(2.*k+1)*pi/2*N);&#xA;z = 0;&#xA;G = 1;&#xA;[NUM,DEN] = zp2tf(z,sk,G);&#xA;%no zeros for LP&#xA;Hs = tf(1,DEN)&#xA;&#xA;%filter analysis&#xA;figure(1);&#xA;subplot(3,1,1)&#xA;pzmap(Hs);&#xA;subplot(3,1,2)&#xA;impulseplot(Hs);&#xA;subplot(3,1,3)&#xA;stepplot(Hs);    &#xA;fvtool(1,DEN);  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've calculated poles according to equation $10.3.47$ in the article and created transfer function with this poles as a parameters. But &lt;code&gt;fvtool&lt;/code&gt; shows bandstop filter instead of lowpass (as described in article). In &lt;code&gt;pzmap&lt;/code&gt; I'm getting also pole on right side of $s$-plane so it seems to be unstable. I dont really know how to interpretet this results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EeTYA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EeTYA.jpg&quot; alt=&quot;impuleplot, stepplot and fvtool&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maks&lt;/p&gt;&#xA;" OwnerUserId="20874" LastEditorUserId="1629" LastEditDate="2016-05-08T18:48:25.500" LastActivityDate="2016-05-15T14:05:03.837" Title="Lowpass Butterworth filter design (own poles' calculations)" Tags="|filter-design|butterworth|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30669" PostTypeId="2" ParentId="30665" CreationDate="2016-05-08T18:17:29.900" Score="1" Body="&lt;p&gt;Given a continuous time LTI system with impulse response $h(t) = e^{-t}\text{u}(t)$ the output $y(t)$ for any input $x(t)$ is found via the convolution-integral:&#xA;$$y(t)  = x(t) \star h(t)  = \int_{-\infty}^{\infty} {x(\tau)h(t-\tau)} d\tau$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically when $x(t) = \text{u}(t-1)$, we can proceed with the most general approach by first taking the integral and then inserting t=2.34, or else as @DilipSarwate suggests, you can first substitude t=2.34 into the integrand and then take the integral. I prefer the first here:&#xA;\begin{align}&#xA;y(t) &amp;amp;= \int_{-\infty}^{\infty} {\text{u}(\tau-1)e^{-(t-\tau)} \text{u}(t-\tau)d\tau}\\&#xA;y(t) &amp;amp;= \int_{\tau=1}^{\tau=t} {e^{-(t-\tau)}d\tau}\\&#xA;y(t) &amp;amp;= 0  &amp;amp;\scriptstyle{\text{for t less than 1}}\\&#xA;y(t) &amp;amp;= e^{-(t-\tau)} \big\vert_{\tau=1}^{\tau=t} = 1 - e^{-(t-1)} &amp;amp;\scriptstyle{\text{         for t greater than 1, hence:}}\\&#xA;y(t) &amp;amp;= [1 - e^{-(t-1)}] \text{u}(t-1) &amp;amp;\scriptstyle{\text{, for all t}}\\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it's clear how the integral limits are modified by the arguments of the $\text{u}(t)$ step function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And inserting $t=2.34$ yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$y(2.34) = [1 - e^{-(2.34-1)}] \text{u}(2.34-1) = [1 -e^{-1.34}]\text{u}(1.34) =  0.7382 $$&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2016-05-08T21:41:47.020" LastActivityDate="2016-05-08T21:41:47.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30670" PostTypeId="2" ParentId="12693" CreationDate="2016-05-08T18:29:56.617" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;If you have original image you can always subtract it from noisy&#xA;image and Wiener filter output to find RMSE (root mean square&#xA;error) or MSE to show how your filter improves the image.&lt;/li&gt;&#xA;&lt;li&gt;If you do not have original image then you might just look at noise variance in both images. Also other metric such as entropy might be useful.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11752" LastActivityDate="2016-05-08T18:29:56.617" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30671" PostTypeId="2" ParentId="30663" CreationDate="2016-05-08T18:58:45.907" Score="0" Body="&lt;p&gt;If you take fourier transform $f_t=e^{\sigma t}\times e^{i\omega_0 t}$ it will be convolution of the two individual signal spectrums. $e^{i\omega_0 t}$ will result into impulse at $\omega_0$ and $e^{\sigma t}$ will give decaying spectrum. You can get some insight about these parameters from simple Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="11752" LastActivityDate="2016-05-08T18:58:45.907" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30674" PostTypeId="2" ParentId="30665" CreationDate="2016-05-08T20:11:50.783" Score="2" Body="&lt;p&gt;\begin{align}&#xA;y(2.34) &amp;amp;= h \star x\,\big\vert_{t=2.34}\\&#xA;&amp;amp;= \int_{-\infty}^\infty h(\tau)x(2.34-\tau)\,\mathrm d\tau&#xA;&amp;amp;\scriptstyle{\text{from the definition of the convolution integral}} \\&#xA;&amp;amp;= \int_0^\infty e^{-\tau}x(2.34-\tau)\,\mathrm d\tau &amp;amp;\scriptstyle{\text{because } h(\tau)=0\text{ for }\tau &amp;lt; 0}\\&#xA;&amp;amp;= \int_0^\infty e^{-\tau}u(1.34-\tau)\,\mathrm d\tau &amp;amp;\scriptstyle{\text{because }x(2.34-\tau) = u((2.34-\tau)-1)}\\&#xA;&amp;amp;= \int_0^{1.34} e^{-\tau}\,\mathrm d\tau&#xA;&amp;amp;\scriptstyle{\text{because }u(1.34-\tau) = 0 \text{ for }\tau &amp;lt; 1.34}\\&#xA;&amp;amp;= 1-e^{-1.34}&#xA;\end{align}&lt;/p&gt;&#xA;" OwnerUserId="235" LastActivityDate="2016-05-08T20:11:50.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30675" PostTypeId="2" ParentId="30655" CreationDate="2016-05-08T20:21:56.823" Score="1" Body="&lt;p&gt;The &lt;a href=&quot;http://nl.mathworks.com/help/signal/ref/zp2tf.html&quot; rel=&quot;nofollow&quot;&gt;MathWorks Documentation&lt;/a&gt; of the function &lt;code&gt;zp2tf&lt;/code&gt; says that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The zeros and poles must be real or come in complex conjugate pairs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which is not the case for your example. With the given values of the vectors &lt;code&gt;z&lt;/code&gt; and &lt;code&gt;p&lt;/code&gt; you can do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;num = poly(z);&#xA;den = poly(p);&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1.00000 + 0.00000i  -0.37545 - 0.77876i   0.09714 - 0.02978i&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for &lt;code&gt;num&lt;/code&gt;, and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1.00000 + 0.00000i   0.83665 + 0.07610i   1.00092 + 0.10802i&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for &lt;code&gt;den&lt;/code&gt;. Note that these are different from the coefficients of your 'expected transfer function'. However, these coefficients correspond to the given pole and zero locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note that one of your poles lies outside the unit circle, so your filter is unstable.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-05-08T20:21:56.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30676" PostTypeId="2" ParentId="30663" CreationDate="2016-05-08T21:28:45.277" Score="2" Body="&lt;p&gt;Your signal model lends itself particularly well for so called parametric frequency analysis. The basic idea is that you find the autocovariance matrix of your signal and identify its eigenstructure. The eigenvalues correspond to the exponents of a sum-of-exponentials model. In your case you will find conjugate pairs of eigenvalues with non-zero imaginary part describing the exponential decay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This thesis looks like a good introduction to the topic:&#xA;&lt;a href=&quot;http://zet10.ipee.pwr.wroc.pl/record/11/files/Leon_mon.pdf&quot; rel=&quot;nofollow&quot;&gt;http://zet10.ipee.pwr.wroc.pl/record/11/files/Leon_mon.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3369" LastActivityDate="2016-05-08T21:28:45.277" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30677" PostTypeId="1" CreationDate="2016-05-09T00:40:06.550" Score="4" ViewCount="137" Body="&lt;p&gt;I am currently thinking about approaches to estimating the position and velocity of an accelerating target. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this time, I have tried a few approaches that work alright. I have tried two variations of Kalman filters, the first where it estimates position and velocity given the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamics&lt;/strong&gt;:&#xA;\begin{align}&#xA;\dot{x} &amp;amp;= v + \eta_1\\&#xA;\dot{v} &amp;amp;= \eta_2&#xA;\end{align}&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Measurement&lt;/strong&gt;: &#xA;$$y = x + \eta_3$$&#xA;where $\eta_i$ are noise from a Gaussian distribution.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The other Kalman Filter approach was based on the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamics&lt;/strong&gt;:&#xA;\begin{align}&#xA;\dot{a_1} &amp;amp;= \eta_1\\&#xA;\dot{a_2} &amp;amp;= \eta_2&#xA;\end{align}&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Measurement&lt;/strong&gt;: &#xA;$$y_{i+1} = y_{i}+a_1 \Delta t + a_2 \frac{\Delta t^2}{2}$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I also implemented a filter using local regression based on the last $N$ position samples in the time series.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these filters do fairly well, but I still question if there might be something better. I have tried looking for any papers or lectures on the subject but struggle to find anything worthwhile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other thing that coworker and myself discussed was potentially using &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_equations_(rigid_body_dynamics)&quot; rel=&quot;nofollow&quot;&gt;Euler's Equation for Rigid Body Dynamics&lt;/a&gt; to add some constraints into a target's ability to turn too rapidly based on using a ballpark inertia matrix (assuming we're going after a small car). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This obviously makes the dynamics nonlinear and would push us to using something like an Unscented Kalman filter. Does anyone know whether this would be worth it? We suspect it could help our estimate not make any unrealistic jumps that it might otherwise make with the purely linear model, but don't know if this would make a big enough difference.&lt;/p&gt;&#xA;" OwnerUserId="20837" LastEditorUserId="20837" LastEditDate="2016-08-07T18:54:23.990" LastActivityDate="2016-08-07T18:54:23.990" Title="Estimation of accelerating target using position measurements only" Tags="|filters|estimation|kalman-filters|parameter-estimation|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30678" PostTypeId="2" ParentId="30666" CreationDate="2016-05-09T01:35:28.317" Score="2" Body="&lt;p&gt;It looks like you are considering these analysis like part of a universal streamline desing process. These analysis techniques are simply tools that helps you understand the behaviour of your system, being open or closed loops, it doesn't matter. Both type of systems can be stable or unstable depending on the value of their poles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Closing the loop on a open-loop system is a modification you make to your system just like any other modification. After that modification, you get a new system with a different transferr function that can be stable or unstable, independently of the previous system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope I was clear enough.&lt;/p&gt;&#xA;" OwnerUserId="20917" LastActivityDate="2016-05-09T01:35:28.317" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30681" PostTypeId="1" AcceptedAnswerId="30691" CreationDate="2016-05-09T04:46:27.030" Score="1" ViewCount="216" Body="&lt;p&gt;What will be inverse $\mathcal Z$-transform for this function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H(z) = \frac{\left(1+\beta z^{-1}\right)\left(1+\beta z\right)}{\left(1+\alpha z^{-1}\right)\left(1+\alpha z\right)}$$&lt;/p&gt;&#xA;" OwnerUserId="12125" LastEditorUserId="1629" LastEditDate="2016-05-09T09:53:04.473" LastActivityDate="2016-05-09T17:33:44.783" Title="Inverse $\mathcal Z$-transform of rational functions" Tags="|z-transform|transfer-function|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30683" PostTypeId="2" ParentId="30666" CreationDate="2016-05-09T10:17:22.713" Score="4" Body="&lt;p&gt;The bode plot is just a plot showing the frequency representation of your system. Any transfer function has one, hence you can use it to see the response of both closed or open loop. Nyquist and the root locus are mainly used to see the properties of the closed loop system. The root locus shows the position of the poles of the c.l. system as the gain of your controller changes. While nyquist diagram contains the same information of the bode plot. But instead of splotting two real graphs of the amplitude and the phase of the complex function the nyquist plot shows the same function in the complex plane&lt;/p&gt;&#xA;" OwnerUserId="20425" LastActivityDate="2016-05-09T10:17:22.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30684" PostTypeId="2" ParentId="30666" CreationDate="2016-05-09T12:22:31.963" Score="4" Body="&lt;p&gt;The &lt;strong&gt;root locus&lt;/strong&gt; is a way to see how the poles of your system vary from their open loop locations to their closed loop locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the closed loop system is&#xA;$$&#xA;C(s) = \frac{O(s)}{1+KO(s)}&#xA;$$&#xA;where $O(s)$ is your open loop system and $K$ is the constant gain in the feedback path around the open loop system, then the root locus looks at how the poles of $C(s)$ vary from those of $O(s)$ (when $K=0$) to something else for $K&amp;gt;0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This picture&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qY3wM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qY3wM.png&quot; alt=&quot;Root locus plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from &lt;a href=&quot;https://dsp.stackexchange.com/a/30342/80&quot;&gt;this answer&lt;/a&gt; shows an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nyquist and Bode plots are applied to any transfer function, as others have said, whether open or closed loop.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.340" LastActivityDate="2016-05-09T12:22:31.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30685" PostTypeId="2" ParentId="30461" CreationDate="2016-05-09T13:09:37.720" Score="2" Body="&lt;p&gt;Using the gcc-phat method, you can use the matlab function &quot;gccphat(s2,s1,fs)&quot; (R2016a) with s1 as the reference signal, s2 the other one and fs the sampling frequency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically it will do a similar correlation calculation :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  Ncorr = 2*N-1;  % N size of the signal&#xA;  NFFT = 2^nextpow2(Ncorr);&#xA;  R12 = bsxfun(@times,fft(s2,NFFT),conj(fft(s1,NFFT)));&#xA;  r12_temp = fftshift(ifft(exp(1i*angle(R12))),1);&#xA;  r12 = r12_temp(NFFT/2+1-(N-1)/2:NFFT/2+1+(N-1)/2,:);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only difference with your code is that the matlab function use the nearest power of two sequence length for the fft (as Peter.K suggest with &quot;Nfft = length(x1) + length(x2) - 1&quot;) and doing an exponentiel stuff (and this part make the difference with a regular correlation, what you were doing)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But to return the time delay, the function is doing an other trick :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  lags = (-(Ncorr-1)/2:(Ncorr-1)/2).';&#xA;  lags = lags/fs;&#xA;  [~,idx] = max(abs(r12));&#xA;  tau = ts/(2*fs)+lags(idx); % ts as the total sample of the signal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm doing similar experimentation and this method is working great for long and short non-moving signal. the reverberation of the room may cause some issue, but if you can see an obvious delay when displaying the signal it should work fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, i'm having difficulty to return a good time delay with a moving source (the function retourn 0 or +/- the length of the signal) And i'm still working on it... So if anybody got a lead, it will be much apreciate ;-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this will help you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Peace&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS : Also, when doing an fft/ifft you really should use fftshift/ifftshift because the matlab fft/ifft is mixing some stuff during the process.&lt;/p&gt;&#xA;" OwnerUserId="20937" LastEditorUserId="20937" LastEditDate="2019-05-08T16:58:02.740" LastActivityDate="2019-05-08T16:58:02.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="30686" PostTypeId="1" CreationDate="2016-05-09T13:39:40.010" Score="2" ViewCount="1062" Body="&lt;p&gt;I have 2D measurement results which seem to have a constant non-trivial background as shown here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/T6RPn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T6RPn.png&quot; alt=&quot;Example for the 2D data set&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For every column in this image, there seems to be a similar oscillation. I'd like to distinguish this oscillation from the real measurement signal, e.g. the oblique band which goes from about (15,1080) to (25,1140) in the image coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already tried several things, including: FFT filtering for each individual column; using a column where no additional signal seems to be for normalization; and independent component analysis (ICA) implemented in python's scikit learn. With ICA, I was able to find a quite satisfying result, as demonstrated in this graph:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zwPJM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zwPJM.png&quot; alt=&quot;Result using ICA&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where each row of the above image is plotted as a red line and the ICA result as a blue line. Unfortunately, the ICA result needs to be rescaled and it gives differing reults from time to time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone give some hints on how to solve a task like this and how to substract the background properly and automatically in the end? Python code is highly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="20932" LastActivityDate="2016-05-09T13:39:40.010" Title="How to remove a common noise signal from a set of signals?" Tags="|filters|python|ica|background-subtraction|" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30687" PostTypeId="2" ParentId="30677" CreationDate="2016-05-09T14:15:13.213" Score="2" Body="&lt;p&gt;I don't have a really good answer for you, but I can see a possible problem with your second attempt:  the value of $a_3$ has the potential to completely blow up the dynamics because it is multiplying $t^3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In cases like this, you are better off defining an interval over which you wish to do the estimation, $[T_1,T_2]$ and then choosing well-behaved polynomials on this interval (e.g. the Legendre polynomials, $P_k(x)$)  and multiplying &lt;em&gt;them&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That way your measurement becomes&#xA;$$&#xA;y(t) =  \alpha_1 P_0(x;T_1, T_2) + \alpha_2 P_1(x;T_1, T_2) + \alpha_3 P_2(x;T_1, T_2)&#xA;$$&#xA;where $P_k(\cdot;T_1, T_2)$ is the (scaled) $k^{\rm th}$ order Legendre polynomial:&#xA;$$&#xA;P_k(\cdot;T_1, T_2) = \frac{1}{T_2 - T_1} P_k\left( \frac{2t -T_1 - T_2}{T_2 - T_1} \right)&#xA;$$&#xA;where $P_k(\cdot)$ is the &lt;a href=&quot;http://mathworld.wolfram.com/LegendrePolynomial.html&quot; rel=&quot;nofollow&quot;&gt;standard Legendre polynomial.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used the technique in a formulation of the &lt;a href=&quot;http://espace.library.uq.edu.au/view/UQ:11308/PPEKF_IEEE_SPL_K.pdf&quot; rel=&quot;nofollow&quot;&gt;EKF for frequency tracking.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-09T14:15:13.213" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30688" PostTypeId="1" AcceptedAnswerId="30714" CreationDate="2016-05-09T14:39:56.303" Score="2" ViewCount="247" Body="&lt;p&gt;Is the following state correct for a Constant Acceleration (CA) model KF applied for tracking an object which moves in (x, y, z) and have the freedom of rotation $\phi$ around the $z$ axis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;	x= &#xA;	\begin{bmatrix}&#xA;	x, \dot x, \ddot x, y, \dot y, \ddot y, z, \dot z, \ddot z, \phi, \dot \phi, \ddot \phi&#xA;	\end{bmatrix}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;UPDATE:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can only measure $(x, y, z)$, directly. After, I computed $\phi$, rotation around the $z$ axis, using $\arctan(\frac{\delta y}{\delta x})$, indirectly. The measurements that I input to KF are: $x, y, z, \phi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming:&#xA;\begin{equation}&#xA;\pmb{\alpha}=&#xA;\begin{bmatrix}&#xA;1  &amp;amp; dt &amp;amp; 0.5 \times dt^2 \\&#xA;0  &amp;amp; 1  &amp;amp; dt \\&#xA;0  &amp;amp; 0  &amp;amp; 1&#xA;\end{bmatrix}_{3 \times 3}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\pmb{\beta}=&#xA;\begin{bmatrix}&#xA;1  &amp;amp; 0 &amp;amp; 0&#xA;\end{bmatrix}_{1 \times 3}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A$, the state transition matrix which applies the effect of each state parameter at time $t-1$ on the state at time $t$, is built using:&#xA;\begin{equation}&#xA;x_{k+1}=&#xA;\begin{bmatrix}&#xA;\pmb{\alpha}_{3 \times 3}  &amp;amp; 0_{3 \times 3} &amp;amp; 0_{3 \times 3} &amp;amp; 0_{3 \times 3} \\&#xA;0_{3 \times 3}  &amp;amp; \pmb{\alpha}_{3 \times 3} &amp;amp; 0_{3 \times 3} &amp;amp; 0_{3 \times 3} \\&#xA;0_{3 \times 3}  &amp;amp; 0_{3 \times 3} &amp;amp; \pmb{\alpha}_{3 \times 3} &amp;amp; 0_{3 \times 3} \\&#xA;0_{3 \times 3}  &amp;amp; 0_{3 \times 3} &amp;amp; 0_{3 \times 3} &amp;amp; \pmb{\alpha}_{3 \times 3} \\&#xA;\end{bmatrix}_{12 \times 12}&#xA;\cdot &#xA;\begin{bmatrix}&#xA;x\\ \dot x\\ \ddot x\\ y\\ \dot y\\ \ddot y\\ z\\ \dot z\\ \ddot z\\ \phi\\ \dot \phi\\ \ddot \phi&#xA;\end{bmatrix}_{k}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same manner, the transformation matrix $H$, which map state vector parameters into the measurements domain, is built using:&#xA;\begin{equation}&#xA;H=&#xA;\begin{bmatrix}&#xA;\pmb{\beta}_{1 \times 3}  &amp;amp; 0_{1 \times 3} &amp;amp; 0_{1 \times 3} &amp;amp; 0_{1 \times 3} \\&#xA;0_{1 \times 3}  &amp;amp; \pmb{\beta}_{1 \times 3} &amp;amp; 0_{1 \times 3} &amp;amp; 0_{1 \times 3} \\&#xA;0_{1 \times 3}  &amp;amp; 0_{1 \times 3} &amp;amp; \pmb{\beta}_{1 \times 3} &amp;amp; 0_{1 \times 3} \\&#xA;0_{1 \times 3}  &amp;amp; 0_{1 \times 3} &amp;amp; 0_{1 \times 3} &amp;amp; \pmb{\beta}_{1 \times 3} \\&#xA;\end{bmatrix}_{4 \times 12}&#xA;\end{equation}&lt;/p&gt;&#xA;" OwnerUserId="20939" LastEditorUserId="20939" LastEditDate="2016-05-11T16:34:30.783" LastActivityDate="2016-05-11T17:24:21.543" Title="Kalman for 3D position and 1D orientation" Tags="|computer-vision|kalman-filters|control-systems|adaptive-filters|" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30689" PostTypeId="1" CreationDate="2016-05-09T14:40:52.750" Score="1" ViewCount="2442" Body="&lt;p&gt;I am trying to calculate the covariance matrix that is required for the calculation of an MVDR beamformer. I am getting confused as to how to calculate it. I have an array of 3 microphones each with a vector of speech signals with N samples in the time domain. I apply an STFT to the signals giving a N x M matrix, where N represents the time domain or a single frame and M is the frequency bins. The covariance matrix can be described as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R_{xx} =E[xx^{H}]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, for a 3 microphone system we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$      R_{xx} = E\left(&#xA;        \begin{matrix}&#xA;        x_1x_1^* &amp;amp; x_1x_2^* &amp;amp; x_1x_3^* \\&#xA;        x_2x_1^* &amp;amp; x_2x_2^* &amp;amp; x_2x_3^* \\&#xA;        x_2x_1^* &amp;amp; x_3x_2^* &amp;amp; x_3x_3^* \\&#xA;        \end{matrix} \right) &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keeping in mind that the system will be done in real-time, would the expectation function apply a time-average across past and current signals (i.e. for the first frame divide by one, second divide by two and so on) or just current signals (i.e. divided by one)? And so, would each frequency bin in each frame have its own $R_{xx}$ giving N x M $R_{xx}$ values?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="20940" LastActivityDate="2016-05-09T18:15:05.317" Title="Calculating covariance matrix for MVDR beamforming" Tags="|matrix|covariance|beamforming|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30690" PostTypeId="1" CreationDate="2016-05-09T15:01:18.407" Score="1" ViewCount="258" Body="&lt;p&gt;Suppose I have two sensors $s_1$ and $s_2$. $s_1$ measures the desired heart signal (with most of the frequency content below 100 Hz), and the other is a reference sensor picking mainly background noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the pumping of the blood in the heart, there is also low frequency vibrations, mainly below 10 Hz that contaminates both sensors. The sensors are spatially separated, making direct cancellation unfeasible.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figure below shows the frequency content of both sensors ($s_1$ is blue and $s_2$ is red), following discrete Fourier Transform. The visible peak is the 50 Hz mains hum. &lt;a href=&quot;https://i.stack.imgur.com/ahDa4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ahDa4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nonlinear denoising is effective in removing mains hum without compromising the signal. However, it seems to be ineffective in removing the low frequency vibrations. The figure below shows the effect of applying it to $s_1$ &lt;a href=&quot;https://i.stack.imgur.com/N1DwG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N1DwG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how can these vibrations be removed from $s_1$, without causing too much distortion to the desired signal?&lt;/p&gt;&#xA;" OwnerUserId="19683" LastActivityDate="2016-05-09T15:01:18.407" Title="Removing low frequency vibrations from measured signal" Tags="|denoising|adaptive-filters|" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="30691" PostTypeId="2" ParentId="30681" CreationDate="2016-05-09T15:25:06.617" Score="3" Body="&lt;p&gt;Given the $\mathcal Z$-transform :&#xA;$$H(z) = \frac{\left(1+\beta z^{-1}\right)\left(1+\beta z\right)}{\left(1+\alpha z^{-1}\right)\left(1+\alpha z\right)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse $\mathcal Z$-transform can be found by the method of partial fraction expansion guided with the Region of Convergence ROC associated with $H(z)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will proceed with the most fundamental method and apply necesary algebraic manipulations to get the required standard form as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;H(z) &amp;amp;= \frac {\left(1 + \beta z^{-1}\right)\left(1 + \beta z\right)}{\left(1 + \alpha z^{-1}\right)\left(1 + \alpha z\right)} &amp;amp;\scriptstyle{\text{convert to negative power of $z$}}\\ &#xA; &amp;amp;= \frac{\left(1 + \beta z^{-1}\right)\left(z^{-1} + \beta\right)}{\left(1 + \alpha z^{-1}\right)\left(z^{-1} + \alpha\right)} &amp;amp;\scriptstyle{\text{convert to standard form of } (1-d_k z^{-1})}\\&#xA;&amp;amp;= \frac{\beta}{\alpha} \frac{\left(1 + \beta z^{-1}\right)\left(1 + \frac{1}{\beta} z^{-1}\right)}{\left(1 + \alpha z^{-1}\right)\left(1 + \frac{1}{\alpha}z^{-1}\right)} &amp;amp;\scriptstyle{\text{expand the brackets}}\\&#xA; &amp;amp;= \frac{\beta}{\alpha} \frac{\left(1 + \left(\beta + \frac{1}{\beta}\right) z^{-1} + z^{-2}\right) }{\left(1 + \left(\alpha + \frac{1}{\alpha}\right) z^{-1} + z^{-2}\right)} &amp;amp;\scriptstyle{\text{apply the long division}}\\&#xA;&amp;amp;= \frac{\beta}{\alpha} \left( 1 + \frac{ \left(\beta + \frac{1}{\beta} - \alpha - \frac{1}{\alpha}\right)z^{-1} }{\left(1 + \alpha z^{-1}\right)\left(1 + \frac{1}{\alpha}z^{-1}\right)} \right) &amp;amp;\scriptstyle{\text{go further...}}\\&#xA;&amp;amp;= \frac{\beta}{\alpha} \left( 1 + \frac{A}{1 + \alpha z^{-1}} + \frac{B}{1 + \frac{1}{\alpha}z^{-1}} \right) &amp;amp;\scriptstyle{\text{where $A$ and $B$ are found from the right side quotient of $H(z)$}}\\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now assuming $A$ and $B$ are found as functions of $\alpha$ and $\beta$, we shall define all possible ROC of $H(z)$ to find the corresponding inverse transform $h[n]$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Now If $0&amp;lt;|\alpha|&amp;lt;1&amp;lt;\frac{1}{|\alpha|}$ and ROC is such that $|z|&amp;lt;|\alpha|$ then: $h[n]$ will be &lt;strong&gt;unstable&lt;/strong&gt; and &lt;strong&gt;anti-causal&lt;/strong&gt; as&#xA;$$h[n] = \frac{\beta}{\alpha} \delta[n] + \frac{\beta}{\alpha} \left(- A\left(-\alpha\right)^n \text{u}[-n-1] - B\left(- \frac{1}{\alpha}\right)^n \text{u}[-n-1] \right)$$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Or else if $0&amp;lt;|\alpha|&amp;lt;1&amp;lt;\frac{1}{|\alpha|}$ and ROC is such that $|\alpha| &amp;lt;|z|&amp;lt;\frac{1}{|\alpha|}$ then: $h[n]$ will be &lt;strong&gt;stable&lt;/strong&gt; and &lt;strong&gt;two-sided&lt;/strong&gt; as&#xA;$$h[n] = \frac{\beta}{\alpha} \delta[n] + \frac{\beta}{\alpha} \left( A(-\alpha)^n \text{u}[n] - B\left(- \frac{1}{\alpha}\right)^n \text{u}[-n-1] \right)$$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Or else if $0&amp;lt;|\alpha|&amp;lt;1&amp;lt;\frac{1}{|\alpha|}$ and ROC is such that $|z|&amp;gt;\frac{1}{|\alpha|}$ then: $h[n]$ will be &lt;strong&gt;unstable&lt;/strong&gt; and &lt;strong&gt;causal&lt;/strong&gt; as&#xA;$$h[n] = \frac{\beta}{\alpha} \delta[n] + \frac{\beta}{\alpha} \left( A(-\alpha)^n \text{u}[n] + B\left(- \frac{1}{\alpha}\right)^n \text{u}[n] \right)$$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The cases for $0&amp;lt;\frac 1\alpha&amp;lt;1&amp;lt;\alpha$ are simply the same, merely interchanging $\alpha$ with $\frac 1\alpha$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="1629" LastEditDate="2016-05-09T17:33:44.783" LastActivityDate="2016-05-09T17:33:44.783" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30692" PostTypeId="1" AcceptedAnswerId="30699" CreationDate="2016-05-09T16:04:39.223" Score="2" ViewCount="3370" Body="&lt;p&gt;I have an algorithm where I am computing the FFT of a large signal. However, I desire only the even or odd terms of the DFT of the signal, but not both. Currently, I discard these undesired terms. Is there a way by which I may appreciably reduce the runtime complexity when only every other DFT term is desired?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How might I begin to find such an optimization? If it is unclear, I will look for how the larger, encompassing algorithm could be improved, but I'm starting by examining the smallest, most expensive portion before thinking about more fundamental changes to the system. &lt;/p&gt;&#xA;" OwnerDisplayName="user20942" LastActivityDate="2021-08-28T12:33:18.253" Title="Computation of Only Even or Odd Frequency Bins of DFT" Tags="|fft|fourier-transform|dft|" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30694" PostTypeId="2" ParentId="30689" CreationDate="2016-05-09T16:55:13.090" Score="3" Body="&lt;p&gt;MVDR is a narrowband beamformer. For broadband signals it is usually applied for each frequency bin. That means that $\mathbf{R}_{xx}$ is frequency dependent. In other words, for each time you should have $M$ matrices, each one is $3\times 3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since you usually cannot compute $\mathbf{R}_{xx}$ exactly, you perform covariance estimation $\tilde{\mathbf{R}}_{xx}$. For more information you can look &lt;a href=&quot;https://en.wikipedia.org/wiki/Estimation_of_covariance_matrices&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for example. In short, as you mention you perform averaging of the covariance matrix in order to improve the estimation. In order to adapt you estimation to time-varying statistics, usually exponential averaging is performed, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\tilde{\mathbf{R}}_{xx}[n] = \alpha\tilde{\mathbf{R}}_{xx}[n-1] + (1-\alpha)\mathbf{x}[n]\mathbf{x}^H[n]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for some $0&amp;lt;\alpha&amp;lt;1$ (usually closer to 1).&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="80" LastEditDate="2016-05-09T18:15:05.317" LastActivityDate="2016-05-09T18:15:05.317" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30695" PostTypeId="2" ParentId="30667" CreationDate="2016-05-09T17:09:10.223" Score="1" Body="&lt;p&gt;The poles of a butterworth filter are located in the s-plane at the locations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s_{k} = \sigma_{k} + j \omega_{k}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sigma_{k} = -sin(\theta_{k})$$ $$\omega_{k} = cos(\theta_{k})$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \theta_{k} = \frac{(2k+1)\pi}{2N} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $N$ is the filter order. So, simply create an array of these poles for your given order, and convert them to coefficients of the filter. (See Numerical Recipes in C for a routine for doing this). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the coefficients are created, perform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ a_{k} \leftarrow \frac{a_{k}}{\omega_{p}^{N-k}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\omega_{p}$ is the passband edge, that was prewarped into the analog domain. Then set the numerator $b_{0}$ to be $b_{0} = \frac{1}{a_{0}}$ for normalization and divide all $a_{k}$ by $a_{0}$, where the $\vec{a}$ are the coefficients of the denominator of course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you have now is an analog filter. To get a digital filter, transform the poles and zeros of the denominator and numerator polynomials respectively with the billinear transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't use MATLAB, so I cant help you with your code, but that is the basic description of the procedure to create a butterworth filter. I have it implemented in C and it works great.&lt;/p&gt;&#xA;" OwnerUserId="19259" LastActivityDate="2016-05-09T17:09:10.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30696" PostTypeId="1" CreationDate="2016-05-09T18:01:44.290" Score="1" ViewCount="673" Body="&lt;p&gt;Let's say I have a 2D image, and I take the discrete Fourier Transform (via FFT) of that image.  In the frequency domain, I get the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Jymza.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jymza.png&quot; alt=&quot;2D DFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this image, let's just assume all the spatial frequencies are zero, except for the selected point at (608, 513).  Now, given the x and y-coordinate of the spatial frequency (note this has been centered via &lt;em&gt;fftshift&lt;/em&gt;), how can I convert the spatial frequency for this selected pixel into radians per pixel?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Guess:&lt;/strong&gt; Since the 2D-DFT is centered, our X spatial frequency is 608-513 = 95, and our Y spatial frequency is 513-513 = 0.  Then, we need to multiply by 95 by 2 * pi and divide by N to get radians per pixel?&lt;/p&gt;&#xA;" OwnerUserId="18929" LastActivityDate="2016-05-09T18:01:44.290" Title="How to convert a spatial frequency in a 2D-DFT into the units radians per pixel?" Tags="|matlab|fourier-transform|dft|frequency-domain|" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30699" PostTypeId="2" ParentId="30692" CreationDate="2016-05-09T22:30:45.703" Score="3" Body="&lt;p&gt;Consider a sequence &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; of length N, and assume &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; is its N-point DFT given by &lt;span class=&quot;math-container&quot;&gt;$$X[k] = \sum_{n=0}^{N-1}{x[n]e^{-j\frac{2\pi}{N}nk}}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$k = 0, 1,..., N-1$&lt;/span&gt;,  which is computed through an N-point FFT. If you wish to compute the even-indexed (&lt;span class=&quot;math-container&quot;&gt;$k=0,2,4,...$&lt;/span&gt;), or the odd-indexed (&lt;span class=&quot;math-container&quot;&gt;$k=1,3,5,...$&lt;/span&gt;) indexed samples of &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt;, you can proceed with the following:&lt;/p&gt;&#xA;&lt;p&gt;Denote the even indexed samples of &lt;span class=&quot;math-container&quot;&gt;$X[k]$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$X_e[k]$&lt;/span&gt; :&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;X_e[k] = X[2k] &amp;amp;=  \sum_{n=0}^{N-1}{x[n]e^{-j\frac{2\pi}{N}n(2k)}} &amp;amp;\scriptstyle{\text{term 2k computes even samples of X[k]}}\\&#xA;X_e[k] &amp;amp;=  \sum_{n=0}^{N-1}{x[n]e^{-j\frac{2\pi}{N/2}nk}} &amp;amp;\scriptstyle{\text{factor 2 is moved into N/2 term}}\\&#xA;X_e[k] &amp;amp;=  \sum_{n=0}^{\frac{N}{2}-1}{x[n]e^{-j\frac{2\pi}{N/2}nk}} + \sum_{n=\frac{N}{2}}^{N-1}{x[n]e^{-j\frac{2\pi}{N/2}nk}} &amp;amp;\scriptstyle{\text{Divide the sum into 2 halves}}\\&#xA;X_e[k] &amp;amp;=  \sum_{n=0}^{\frac{N}{2}-1}{x[n]e^{-j\frac{2\pi}{N/2}nk}} + \sum_{n=0}^{\frac{N}{2}-1}{x[n+\frac{N}{2}]e^{-j\frac{2\pi}{N/2}nk}} &amp;amp;\scriptstyle{\text{adjust the 2nd sum range}}\\&#xA;X_e[k] &amp;amp;=  \sum_{n=0}^{\frac{N}{2}-1}{ (x[n]+x[n+\frac{N}{2}])e^{-j\frac{2\pi}{N/2}nk}}  &amp;amp;\scriptstyle{\text{merge the 2 sums}}\\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Final form suggest that the required even samples of N-point DFT of the sequence &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; can be computed from an N/2-point DFT of a new sequence &lt;span class=&quot;math-container&quot;&gt;$x_{half}[n]= x[n]+x[n+ N/2]$&lt;/span&gt; whose length is half that of &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt;, assuming N is even.&lt;/p&gt;&#xA;&lt;p&gt;The signal &lt;span class=&quot;math-container&quot;&gt;$x_{half}[n]$&lt;/span&gt; is simply computed by adding the first half of the signal &lt;span class=&quot;math-container&quot;&gt;$x[n]$&lt;/span&gt; into its second half. (if the length N of signal x[n] is not even padd a zero to its tail to make it even)&lt;/p&gt;&#xA;&lt;p&gt;The following matlab/octave code gives you the desired even indexed samples of X[k] without computing a full N-point DFT of x[n]:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Xe = fft ( x(1:N/2) + x(N/2 + 1 : end), N/2);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that because of the addition of the halves before the FFT, efficiency will degrade from a pure N/2-point FFT.&lt;/p&gt;&#xA;&lt;p&gt;The case for the odd indexed samples proceeds similary but results in a more complex form which I would like to summarize in the following Matlab script:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;% Let x[n] be the signal of length N&#xA;xc = x .* exp(-j*2*pi*[0:N-1]/N) ; % Multiply x[n] with a complex phase term&#xA;Xo = fft (xc(1:N/2) + xc(N/2 + 1, N), N/2); % odd indexed samples of X[k]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Due to a complex multiplication before the FFT, in this case of computing odd indices performance is further reduced but still preferable over a direct N-point FFT.&lt;/p&gt;&#xA;&lt;p&gt;The following Matlab/Octave excerpt demonstrates the computation of both the even and the odd indexed samples.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;N = 1024;           % original sequence length&#xA;x = randn(1,N);&#xA;X = fft(x,N);       % original DFT of X&#xA;&#xA;Xe = fft( x(1:N/2) + x(N/2 + 1: N) , N/2);                          % Even   samples only from N/2 point FFT&#xA;Xo = fft( ( x(1:N/2) - x(N/2+1:N) ).*exp(-j*pi*[0:2:N-2]/N) , N/2); % Odd samples only from N/2 point FFT&#xA;&#xA;figure,stem( abs ( Xe - X(1:2:N)) ); title('Xe - X(1:2:N)');&#xA;figure,stem( abs ( Xo - X(2:2:N)) ); title('Xo - X(2:2:N)');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Due to numerical roundoff effects, the difference plotted by the stems will be nonzero but very small...&lt;/p&gt;&#xA;" OwnerUserId="13309" LastEditorUserId="13309" LastEditDate="2021-08-28T12:33:18.253" LastActivityDate="2021-08-28T12:33:18.253" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="30700" PostTypeId="2" ParentId="30303" CreationDate="2016-05-10T04:34:13.217" Score="0" Body="&lt;p&gt;I've found that shifting to (513, 513) works best, because in MATLAB, the zero frequency is at the upper left corner of the unshifted Fourier transform.  The operation fftshift flips the 1st and 3rd quadrants, meaning that the zero frequency is now at the top-left of the bottom-right quadrant.&lt;/p&gt;&#xA;" OwnerUserId="18929" LastActivityDate="2016-05-10T04:34:13.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30701" PostTypeId="1" AcceptedAnswerId="30704" CreationDate="2016-05-10T06:26:19.000" Score="2" ViewCount="5845" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Use the complex inversion formula to calculate the inverse Laplace transform $f(t)$ of the following Laplace transform:&#xA;  $$F_L (s) = \frac{1}{(s+2)(s^2 +4)}.$$ &#xA;  When the region of convergence is:&#xA;  \begin{align}(1)&amp;amp; \quad Re(s)&amp;lt;-2;\\(2)&amp;amp;\quad -2&amp;lt;Re(s)&amp;lt;0;\\(3)&amp;amp;\quad Re(s)&amp;gt;0.\end{align}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0oPji.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is an explanation of the complex inversion formula. Plugging the function into the formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = \frac{1}{j2\pi}  \int^{\sigma + j \infty}_{\sigma - j \infty} \frac{e^{st}}{(s+2)(s^2+4)}\ ds \tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;So, how do I need to choose $\sigma$? &lt;/li&gt;&#xA;&lt;li&gt;And how do I evaluate this for each of the three regions?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P. S.&lt;/strong&gt; I tried to solve this without the complex inversion formula, just to see what the answer should look like. I started out by expanding using partial fractions as:&#xA;\begin{align}&#xA;\frac{1}{(s+2)(s^2 +4)}&amp;amp;= \frac{1}{8} \left( \frac{1}{s+2} + \frac{1}{s^2+4} \right)\\&#xA;&amp;amp;=\frac{1}{8} \left( \frac{1}{s+2} + \frac{1}{(s+2j)(s-2j)} \right)\\&#xA;&amp;amp;=\frac{1}{8} \left( \frac{1}{s+2} + \frac{j}{4(s+2j)} - \frac{j}{4(s-2j)} \right).&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at a Laplace transform table, $\frac{1}{s-a} \leftrightarrow e^{at},$ so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t) = \frac{1}{8} \left( e^{-2t} + \frac{j}{4} \left(e^{-2jt} + e^{2jt}\right) \right).$$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is this correct? &lt;/li&gt;&#xA;&lt;li&gt;If so, how can I get to this using the complex inversion formula?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="20697" LastEditorUserId="4298" LastEditDate="2016-05-11T10:36:28.010" LastActivityDate="2016-05-11T11:14:55.997" Title="Inverse Laplace transform Using Inversion Formula" Tags="|laplace-transform|proof|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30703" PostTypeId="2" ParentId="22847" CreationDate="2016-05-10T08:04:41.737" Score="0" Body="&lt;p&gt;Centering is usually conducted at the very beginning step before whitening. It would make the follow-up theory and computation easier.&#xA;The behave of centering is shifting the original X, and thus it won't change other statistics, e.g. variance is not changed after centering. &lt;/p&gt;&#xA;" OwnerUserId="20952" LastActivityDate="2016-05-10T08:04:41.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30704" PostTypeId="2" ParentId="30701" CreationDate="2016-05-10T09:12:18.307" Score="5" Body="&lt;p&gt;In engineering practice, the complex inversion integral is hardly ever used. As an engineer, you will almost exclusively need to invert rational functions, and this can be done by partial fraction expansion and elementary inversions. So first I'll show you how to obtain the inverse Laplace transform by partial fraction expansion, then I'll explain the evaluation of the inversion integral using Cauchy's residue theorem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have an error in the partial fraction expansion. Furthermore, you don't need to split up the complex pole pair. I would rewrite the Laplace transform like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(s)=\frac{1}{(s+2)(s^2+4)}=\frac{A}{s+2}+\frac{Bs+C}{s^2+4}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $A=\frac18$, $B=-\frac18$, and $C=\frac14$. The terms on the right-hand side of $(1)$ are elementary Laplace transforms. Now you just have to consider the different regions of convergence (ROC):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}\frac{1}{s+2}&amp;amp;\Longleftrightarrow e^{-2t}u(t),&amp;amp;\quad \text{Re}\{s\}&amp;gt;-2\\\frac{1}{s+2}&amp;amp;\Longleftrightarrow -e^{-2t}u(-t),&amp;amp;\quad \text{Re}\{s\}&amp;lt;-2\\&#xA;\frac{s}{s^2+4}&amp;amp;\Longleftrightarrow \cos(2t)u(t),&amp;amp;\quad\text{Re}\{s\}&amp;gt;0\\&#xA;\frac{s}{s^2+4}&amp;amp;\Longleftrightarrow -\cos(2t)u(-t),&amp;amp;\quad\text{Re}\{s\}&amp;lt;0\\&#xA;\frac{1}{s^2+4}&amp;amp;\Longleftrightarrow \frac12\sin(2t)u(t),&amp;amp;\quad\text{Re}\{s\}&amp;gt;0\\&#xA;\frac{1}{s^2+4}&amp;amp;\Longleftrightarrow -\frac12\sin(2t)u(-t),&amp;amp;\quad\text{Re}\{s\}&amp;lt;0&#xA;\end{align}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for the ROC $\text{Re}\{s\}&amp;lt;-2$ you get the anti-causal signal&#xA;$$f(t)=\frac18\left[-e^{-2t}+\cos(2t)-\sin(2t)\right]u(-t)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the ROC $-2&amp;lt;\text{Re}\{s\}&amp;lt;0$ you get the two-sided signal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\frac18\left[e^{-2t}u(t)+(\cos(2t)-\sin(2t))u(-t)\right]\tag{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, finally, for the ROC $\text{Re}\{s\}&amp;gt;0$ you get the causal signal&#xA;$$f(t)=\frac18\left[e^{-2t}-\cos(2t)+\sin(2t)\right]u(t)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;If you need to use the inversion formula then it is very helpful to know &lt;a href=&quot;https://en.wikipedia.org/wiki/Residue_theorem&quot; rel=&quot;nofollow&quot;&gt;Cauchy's residue theorem&lt;/a&gt;, which says that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi j}\oint_Cf(s)ds=\sum_kR_k\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $f(s)$ is analytic with finitely many poles, $C$ is a positively oriented closed curve, and $R_k$ are the residues of the poles inside $C$. It can be shown that the inversion integral equals a contour integral if the curve $C$ is chosen appropriately:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi j}\int_{\sigma-j\infty}^{\sigma+j\infty}F(s)e^{st}ds=&#xA;\frac{1}{2\pi j}\oint_CF(s)e^{st}ds\tag{6}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a rational function $F(s)$ the curve $C$ is chosen as a Bromwich contour, as shown &lt;a href=&quot;http://www.solitaryroad.com/c916.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; in Fig.2. The straight line part of the curve is the actual integration path we're interested in. The contribution from the circular part of $C$ approaches zero. Depending on the chosen ROC, we have to choose the position of the straight line (i.e., the value of $\sigma)$ differently. For ROC $\text{Re}\{s\}&amp;lt;-2$ (i.e., the anti-causal solution), the straight line is anywhere to the left of the left-most pole, and so the Bromwich contour enclosing all poles is negatively oriented, which results in a sign change:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi j}\int_{\sigma-j\infty}^{\sigma+j\infty}F(s)e^{st}ds=-\sum_kR_k,\quad\sigma&amp;lt;-2,\quad t&amp;lt;0\tag{7}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $R_k$ are the residues corresponding to the poles of the function $f(s)=F(s)e^{st}$.&#xA;For ROC $\text{Re}\{s\}&amp;gt;0$ (i.e., the causal solution), the straight line is anywhere to the right of the right-most pole, and the Bromwich contour enclosing all poles is positively oriented. Consequently, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi j}\int_{\sigma-j\infty}^{\sigma+j\infty}F(s)e^{st}ds=\sum_kR_k,\quad\sigma&amp;gt;0,\quad t&amp;gt;0\tag{8}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the two-side solution with ROC $-2&amp;lt;\text{Re}\{s\}&amp;lt;0$ we need to choose two curves with the straight line inside the ROC. One encloses the pole to its left at $s=-2$, so the curve is positively oriented, and the other one encloses the two poles at $s=2j$ and $s=-2j$ to the right of the straight line, so it is negatively oriented (which adds a negative sign to the corresponding residues). Let $R_1$ be the residue corresponding to the pole at $s=-2$, and let $R_2$ and $R_3$ be the residues of the two poles at $\pm 2j$, respectively. The inversion integral is then given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2\pi j}\int_{\sigma-j\infty}^{\sigma+j\infty}F(s)e^{st}ds=\begin{cases}R_1,&amp;amp;t&amp;gt;0\\-R_2-R_3,&amp;amp;t&amp;lt;0\end{cases},\quad-2&amp;lt;\sigma&amp;lt;0\tag{9}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What remains is the computation of the residues. The residue at pole $p_k$ is given by&#xA;$$R_k=\lim_{s\rightarrow p_k}(s-p_k)f(s)\tag{10}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $f(s)=F(s)e^{st}$ we get for $p_1=-2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_1=\lim_{s\rightarrow -2}(s+2)F(s)e^{st}=\lim_{s\rightarrow -2}\frac{e^{st}}{s^2+4}=\frac{e^{-2t}}{8}\tag{11}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a similar manner the other residues are obtained:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}R_2&amp;amp;=-\frac{e^{2jt}}{8}\frac{1+j}{2}\\&#xA;R_3&amp;amp;=-\frac{e^{-2jt}}{8}\frac{1-j}{2}\end{align}\tag{12}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now $(7)-(9)$ can be evaluated, and the results are of course the same as $(2)-(4)$.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastEditorUserId="4298" LastEditDate="2016-05-11T11:14:55.997" LastActivityDate="2016-05-11T11:14:55.997" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30705" PostTypeId="2" ParentId="22847" CreationDate="2016-05-10T11:09:01.333" Score="1" Body="&lt;p&gt;The goal of FastICA is to rotate your data (unitary transform) so that each axis looks as non-Gaussian as possible.  Gaussian data still looks Gaussian when you rotate it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't &quot;sphere&quot; the data, all the algorithm can really do is rotate the whole block to one axis.  By bringing the mean to zero (centering), and normalizing the variance in all directions (whitening), you give the algorithm freedom to rotate in all directions.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This lets FastICA find the rotations that correspond to non-gaussian data.  All of the rotations it tries will leave the Gaussian components of your data as zero-mean and unit-variance, but non-gaussian components can be optimized.&lt;/p&gt;&#xA;" OwnerUserId="20899" LastEditorUserId="80" LastEditDate="2016-05-10T13:05:15.010" LastActivityDate="2016-05-10T13:05:15.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30706" PostTypeId="2" ParentId="28642" CreationDate="2016-05-10T12:39:45.257" Score="1" Body="&lt;p&gt;I'm not an expert in this field, but have you tried eroding and then dilating?&#xA;I'm writing a python application to track tennis players in the court, and what I did in order to get a single contour for the players is to erode and dilate the tracked shapes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;erosion = cv2.erode(img,None,iterations = 1);&#xA;dilation = cv2.dilate(erosion,None,iterations = 1);&#xA;cv2.findContours( dilation.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or you can directly call the function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;opening = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel);&#xA;cv2.findContours( opening.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.html&quot; rel=&quot;nofollow&quot;&gt;OpenCv Morphological Transformations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="20954" LastActivityDate="2016-05-10T12:39:45.257" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30707" PostTypeId="1" AcceptedAnswerId="30713" CreationDate="2016-05-10T13:09:24.193" Score="0" ViewCount="132" Body="&lt;p&gt;I made an equalizer using &lt;a href=&quot;http://eq10q.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;eq10q&lt;/a&gt; filters. Now I want to use my equalizer for music equalization and make my own music player. So I have some doubts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If I want to equalize MP3 files, do I have to decode the MP3 file to PCM audio, apply my filters and then play the audio? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What library or codec do you recommend me to this task?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is possible to apply filters to an MP3 file without convert the data to PCM? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="20497" LastEditorUserId="1629" LastEditDate="2016-05-10T13:32:42.870" LastActivityDate="2016-05-10T16:54:08.453" Title="MP3 equalization" Tags="|equalization|mp3|" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30708" PostTypeId="2" ParentId="30707" CreationDate="2016-05-10T13:44:16.177" Score="1" Body="&lt;p&gt;The article &lt;a href=&quot;http://dx.doi.org/10.3390/app6050129&quot; rel=&quot;nofollow&quot;&gt;All About Audio Equalization: Solutions and Frontiers&lt;/a&gt; was just published (May 2016), and should provide you with interesting insights. It comes with some &lt;a href=&quot;https://code.soundsoftware.ac.uk/projects/allaboutaudioeq&quot; rel=&quot;nofollow&quot;&gt;code&lt;/a&gt;. One common and older solution is &lt;a href=&quot;http://mp3gain.sourceforge.net/&quot; rel=&quot;nofollow&quot;&gt;mp3gain&lt;/a&gt; (sourceforge), and others are discussed for instance in &lt;a href=&quot;http://lifehacker.com/225651/ask-the-readers-best-method-of-mp3-volume-leveling&quot; rel=&quot;nofollow&quot;&gt;Ask the Readers: Best method of MP3 volume leveling?&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand, a little bit of mp3 decoding is necessary since it is a compressed format (you cannot apply filters directly on the binary file). Yet, the format allows access to specific chunks of data converted into frequencies, a domain in which equalization can be applied.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastActivityDate="2016-05-10T13:44:16.177" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30709" PostTypeId="1" CreationDate="2016-05-10T14:38:41.723" Score="1" ViewCount="88" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Prove that with appropriate choices of the phase $\varphi$, one can recover the quadratures of $m(t).$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Attempt&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The context of this question is weak optical signals combined with a strong local oscillator at a beamsplitter. And $m(t)$ refers to the complex&#xA;modulating signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal field is given by:  $f(t)=Re \Big[ m(t) \exp (j2 \pi \nu_c) \Big],$ with $m(t)=m_1 (t) + j m_2 (t).$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is linearly combined with the stronger coherent local oscillator which has the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$c(t) = Re \{ A \exp \Big[ j(2 \pi \nu_{het} t - \varphi) \Big] \},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\nu_{het} = \nu_c + \Delta,$ has been shifted from the carrier frequency by $\Delta.$ So the output field would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$g_1 (t) = Re \{ R \ A \exp \Big[ j(2 \pi \nu_{het} t - \varphi) \Big] + T \ m(t) \exp (j 2 \pi \nu_c) \},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $R$ and $T$ are reflection and transmission coefficients for the beamsplitter (I was told that for this problem we can assume for simplicity that $R$ is real and $T$ is imaginary).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unsure how to proceed with the proof so any explanation would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="20697" LastEditorUserId="20697" LastEditDate="2016-05-11T12:40:05.753" LastActivityDate="2016-05-11T12:42:39.907" Title="Heterodyne detection" Tags="|signal-detection|proof|" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30710" PostTypeId="2" ParentId="23466" CreationDate="2016-05-10T15:10:52.673" Score="2" Body="&lt;p&gt;You don't necessarily have to keep a recording of the sound in order to process it. Just read in frames, compute the RMS energy (for example), and recycle your frame buffer. Essentially rewriting history and preserving your privacy. A circular buffer design would be suitable for audio processing (think about sliding windows in FFTs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, while most commercial and open source dog bark detection systems rely on simply the volume of the dog bark, they are not very robust. If your neighbour is hammering away at some DIY woodwork, your system will trigger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the Pi, if you're still working on this, maybe check out David Hunt's &lt;a href=&quot;http://www.davidhunt.ie/pi-rex-bark-activated-door-opening-system-with-raspberry-pi/&quot; rel=&quot;nofollow&quot;&gt;Pi-Rex&lt;/a&gt; project... maybe you can even improve upon it!&lt;/p&gt;&#xA;" OwnerUserId="16575" LastActivityDate="2016-05-10T15:10:52.673" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30712" PostTypeId="1" AcceptedAnswerId="30716" CreationDate="2016-05-10T16:46:18.283" Score="1" ViewCount="2976" Body="&lt;p&gt;I'm trying to find the zero-state response (ZSR) of an LTI system to a one sided periodic input, like a square wave that is equals to zero for $t &amp;lt; 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I can use the Fourier series of said input function to find the steady-state (SS) response, however I'm having trouble understanding how to use the Laplace transform to obtain the ZSR, which contains the SS component plus a transient one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that I need to calculate the Laplace transform of the periodic input, and then solve the system for $s$ to obtain the transform of the output.&lt;/p&gt;&#xA;" OwnerUserId="20958" LastEditorUserId="1629" LastEditDate="2016-05-11T08:38:27.667" LastActivityDate="2016-05-11T08:38:27.667" Title="LTI system response to periodic input" Tags="|linear-systems|fourier|laplace-transform|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30713" PostTypeId="2" ParentId="30707" CreationDate="2016-05-10T16:54:08.453" Score="2" Body="&lt;p&gt;The usual approach to achieve your goal would indeed consist in decoding the MP3 file to a series of uncompressed time-domain samples and then filtering this PCM signal. As you are building a player, and as &lt;em&gt;Jason R&lt;/em&gt; mentioned in his comment, you will have to decode the MP3 file for being able to play it back via the soundcard anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My answer to your three questions would therefore be&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Yes&lt;/li&gt;&#xA;&lt;li&gt;To perform the actual decoding, I can recommend the &lt;a href=&quot;http://www.mega-nerd.com/libsndfile/&quot; rel=&quot;nofollow&quot;&gt;libsndfile&lt;/a&gt; library. Not only does it provide a  high-quality MP3 decoder (and encoder) but it allows you to access a whole bunch of other formats.&lt;/li&gt;&#xA;&lt;li&gt;I'm not sure, however, I think it should be possible. I'm not aware if anyone has ever tried and, furthermore, I'm not aware if it has any benefit compared to the &lt;em&gt;decode&lt;/em&gt; $\rightarrow$ &lt;em&gt;filter&lt;/em&gt; $\rightarrow$ &lt;em&gt;encode&lt;/em&gt; approach. As the MP3 file contains the audio data in a transform domain you would have to figure out how your filters act in this transform domain. (I reckon this could lead to computationally expensive operations.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5664" LastActivityDate="2016-05-10T16:54:08.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30714" PostTypeId="2" ParentId="30688" CreationDate="2016-05-10T18:27:37.177" Score="1" Body="&lt;p&gt;Reading &lt;a href=&quot;http://nbviewer.jupyter.org/github/balzer82/Kalman/blob/master/Kalman-Filter-CA-2.ipynb?create=1&quot; rel=&quot;nofollow&quot;&gt;your link&lt;/a&gt; in more detail, it says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Acceleration ($\ddot{x}$ &amp;amp; $\ddot{y}$) as well as position ($x$ &amp;amp; $y$) is measured.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which, to me, is not a &lt;strong&gt;constant acceleration&lt;/strong&gt;.  What it is doing is a &lt;strong&gt;discretized&lt;/strong&gt; changing acceleration model, assuming that the acceleration is constant between each sample period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to your question: is inclusion of $\phi, \dot \phi,$ and $\ddot \phi$ in the state vector valid?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is yes, but you need to include the dynamics of how those states interact with the other states.  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;OK, so now you've added the extra information, I can take a stab at it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should work with the following provisos:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The noise distribution on the angle $\phi$ will be &lt;strong&gt;uniform&lt;/strong&gt; not Gaussian.  I can't find a good reference, &lt;a href=&quot;https://www.dsprelated.com/showthread/comp.dsp/68256-1.php&quot; rel=&quot;nofollow&quot;&gt;but this discussion on &lt;code&gt;comp.dsp&lt;/code&gt; mentions it&lt;/a&gt;.  That means the KF equations for $\phi$ won't be quite right.  I don't think this is a big deal.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There will be some coloration between the noise on $\phi$ and the noises on $x$ and $y$.  I'm not sure what this should be, but it may mean you need to introduce some off-diagonal terms in the $Q$ matrix in the KF formulation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="80" LastEditorUserId="80" LastEditDate="2016-05-11T17:24:21.543" LastActivityDate="2016-05-11T17:24:21.543" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30715" PostTypeId="2" ParentId="30667" CreationDate="2016-05-10T19:17:14.603" Score="1" Body="&lt;p&gt;Ok, I've solved this problem myself. I've used equation from this article mentioned in first post. I've just implement it in matlab not enough precise.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;clc, clear all, close all;&#xA;&#xA;%ANALOG BUTTERWORTH FILTER DESING&#xA;%https://engineering.purdue.edu/~ee538/AnalogFilterDesigns.pdf&#xA;%Butterworth LP with -3dB at fc and N order and G gain&#xA;&#xA;wc = 1000;   %cut off frequency&#xA;N = 2;      %filter order&#xA;G = 1;      %filter gain &#xA;&#xA;%analog filter design&#xA;%poles and zeros &#xA;&#xA;%poles searching&#xA;for k = 0:N-1&#xA;   sk(k+1) = wc*exp(j*(pi/2))*exp(j*(2*k+1)*(pi/(2*N)));&#xA;end&#xA;&#xA;[NUM,DEN] = zp2tf([],sk,G);&#xA;b0 = DEN(end)*G      %gain normalization  &#xA;&#xA;Hs = tf(b0,DEN)&#xA;&#xA;figure();&#xA;freqs(b0,DEN)&#xA;figure();&#xA;plot(sk./10^2, 'x')&#xA;xlim([-10,10]);&#xA;title('Poles placement in s-plane')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Many thanks for your help,&#xA;Maks&lt;/p&gt;&#xA;" OwnerUserId="20874" LastEditorUserId="20874" LastEditDate="2016-05-15T14:05:03.837" LastActivityDate="2016-05-15T14:05:03.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30716" PostTypeId="2" ParentId="30712" CreationDate="2016-05-10T20:42:00.017" Score="2" Body="&lt;p&gt;You can use the Laplace transform, but can also simply use convolution in the time domain. In any case, you will need the system's impulse response $h(t)$. Let the input signal $x(t)$ satisfy $x(t)=0$ for $t&amp;lt;0$, and $x(t+T)=x(t)$ for $t&amp;gt;0$ and $T&amp;gt;0$, as required. Furthermore, let $f(t)$ be the first period of $x(t)$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=\begin{cases}x(t),&amp;amp;0&amp;lt;t&amp;lt;T\\0,&amp;amp;\text{otherwise}\end{cases}\tag{1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x(t)=\sum_{n=0}^{\infty}f(t-nT)=f(t)\star\sum_{n=0}^{\infty}\delta(t-nT)\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\star$ denotes convolution, and $\delta(t)$ is the Dirac delta impulse. If $g(t)$ denotes the convolution $h(t)\star f(t)$, i.e., the system's response to $f(t)$, then the output signal can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}y(t)&amp;amp;=h(t)\star x(t)\\&amp;amp;=h(t)\star f(t)\star\sum_{n=0}^{\infty}\delta(t-nT)\\&amp;amp;=g(t)\star \sum_{n=0}^{\infty}\delta(t-nT)\\&amp;amp;=\sum_{n=0}^{\infty}g(t-nT)\tag{3}\end{align} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to $(3)$, the output signal can be written as a sum of shifted responses to the finite length signal $f(t)$, which corresponds to the first period of the input signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Laplace transform of the output signal can also be written in terms of the transforms of the input signal and of the function $f(t)$. Note that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f(t)=x(t)-x(t-T)\tag{4}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Laplace transform of $(4)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(s)=X(s)(1-e^{-st})\tag{5}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $H(s)$ is the system's transfer function, i.e. the Laplace transform of the impulse response $h(t)$, then the output is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Y(s)=H(s)X(s)=H(s)\frac{F(s)}{1-e^{-st}}\tag{6}$$&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2016-05-10T20:42:00.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30718" PostTypeId="2" ParentId="30557" CreationDate="2016-05-10T22:44:42.283" Score="2" Body="&lt;p&gt;Here are two interpretations of why sparse representations are useful for denoising:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Your clean image is well represented by your dictionary (usually a wavelet or 2D-DCT dictionary), but the noise &lt;em&gt;isn't&lt;/em&gt;. This means that when calculating your sparse representation from the noisy signal, you will only capture the &lt;em&gt;clean signal&lt;/em&gt;, and not the noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Enforcing the representation vector to be sparse (i.e. with only a few non-zero elements), means that you will eventually &lt;em&gt;threshold out&lt;/em&gt; all the other low-energy noisy components.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you said sparse representations can be pretty useful for compression. Compression is merely about keeping the &lt;em&gt;relevant&lt;/em&gt; information, while discarding the irrelevant one. Well denoising is about keeping the relevant part of your signal (the one that fits your model, or your dictionary), while discarding the irrelevant one (the noise).&lt;/p&gt;&#xA;" OwnerUserId="18104" LastActivityDate="2016-05-10T22:44:42.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30719" PostTypeId="1" AcceptedAnswerId="30763" CreationDate="2016-05-10T22:52:26.107" Score="0" ViewCount="1576" Body="&lt;p&gt;Calibrating a Fish-eye camera / webcam with large angle mounted on car by using opencv 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One important issue is to define the calibration pattern and its position !!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The affects error that paly an essential role in the camera calibration process; of either localizing the control point or using geometric properties of the pattern directly.&#xA;Therefore, the precise localization of control points, or accurate determination of the geometric properties is very important, when a small error lead to imprecise camera calibration .Therefore I decided to use a regular grid of circles as calibration pattern. &#xA;But when using the wide angle lens the camera location has a big inclination with respect to the calibration pattern. Therefore, the size of the control points circles varies a lot (circle radius of the most remote circles could be smaller than those close to the lens).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to that how can &lt;strong&gt;determine rows=? X  columns=?&lt;/strong&gt;  of the calibration sheet, and the d&lt;strong&gt;istance = ?&lt;/strong&gt;  between each row an column, and the &lt;strong&gt;position=?&lt;/strong&gt; for the calibration sheet, in order to obtain the accurate calibration for  the camera mounted on the car .&lt;/p&gt;&#xA;" OwnerUserId="20962" LastEditorUserId="20962" LastEditDate="2016-05-11T15:26:09.633" LastActivityDate="2016-05-13T10:21:01.387" Title="Which pattern (circle pattern or checkerboard pattern) should be used for automotive camera calibration (fisheye/wide webcam)?" Tags="|matlab|opencv|c++|camera-calibration|camera-pose|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30722" PostTypeId="1" CreationDate="2016-05-11T08:15:17.467" Score="1" ViewCount="96" Body="&lt;p&gt;I have a question about sammpling rate in MATLAB. &#xA;I read a &lt;code&gt;.wav&lt;/code&gt; file using &lt;code&gt;audioread()&lt;/code&gt;. It give me sampled data called &lt;code&gt;my_data&lt;/code&gt;, and $88.2 \textrm{ kHz}$ as a samping rate, called &lt;code&gt;Fs&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I played this data with &lt;code&gt;audioplayer(my_data, Fs)&lt;/code&gt;, it works well and totally right sounds with original file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I tried to do is getting odd-indexed data like this :&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my_data = [1 2 3 4 5 6 7 8 9 10]&#xA;my_odd_data = [1 3 5 7 9]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I thought that this procedure is like sampling &lt;code&gt;my_data&lt;/code&gt; with half of &lt;code&gt;Fs&lt;/code&gt;, but it is not true. I want to know why this procedure is not sampling with &lt;code&gt;Fs/2&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="20969" LastEditorUserId="1629" LastEditDate="2016-05-11T12:50:30.757" LastActivityDate="2016-05-11T14:03:29.920" Title="MATLAB and sampling rate" Tags="|matlab|discrete-signals|sampling|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30723" PostTypeId="2" ParentId="2725" CreationDate="2016-05-11T09:19:57.100" Score="9" Body="&lt;p&gt;This can be easily done in &lt;code&gt;R&lt;/code&gt; or &lt;code&gt;Python&lt;/code&gt;. There are well-tested functions available, so you don't have to worry about any boundaries or nuances. Moreover, both are free and popular among scientists.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Solution for R&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;There is a special package to handle spectral data, called &lt;a href=&quot;http://hyperspec.r-forge.r-project.org/&quot; rel=&quot;noreferrer&quot;&gt;hyperSpec&lt;/a&gt;. The rubberband baseline correction is already implemented there (function &lt;code&gt;spc.rubberband&lt;/code&gt;). All details are highlighted in the documentation. The usage is pretty simple:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;require(hyperSpec)&#xA;spc &amp;lt;- read.spe(&quot;paracetamol.SPE&quot;)&#xA;baseline &amp;lt;- spc.rubberband(spc)&#xA;&#xA;corrected &amp;lt;- spc - baseline&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/R7rVF.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/R7rVF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Solution for Python&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;There is no (to the best of my knowledge) out-of-the box solution for python, but you can use &lt;code&gt;scipy.spatial.ConvexHull&lt;/code&gt; function to find indices of all points that form a convex hull around your spectrum. Suppose that the spectrum is contained in &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; arrays:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.spatial import ConvexHull&#xA;&#xA;def rubberband(x, y):&#xA;    # Find the convex hull&#xA;    v = ConvexHull(np.array(zip(x, y))).vertices&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Array &lt;code&gt;v&lt;/code&gt; contains indices of the vertex points, arranged in the CCW direction, e.g. &lt;code&gt;[892, 125, 93, 0, 4, 89, 701, 1023]&lt;/code&gt;. We have to extract part where &lt;code&gt;v&lt;/code&gt; is ascending, e.g. 0–1023.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    # Rotate convex hull vertices until they start from the lowest one&#xA;    v = np.roll(v, -v.argmin())&#xA;    # Leave only the ascending part&#xA;    v = v[:v.argmax()]&#xA;&#xA;    # Create baseline using linear interpolation between vertices&#xA;    return np.interp(x, x[v], y[v])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the baseline is corrected like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;y = y - rubberband(x, y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="20968" LastActivityDate="2016-05-11T09:19:57.100" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30724" PostTypeId="1" CreationDate="2016-05-11T09:25:51.153" Score="2" ViewCount="654" Body="&lt;p&gt;My scope has 200 MHz bandwidth and can sample at 4GS/s&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sampling a 138 MHz RF signal at 500 M Sa/s storing 14 M points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Cnq4U.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cnq4U.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I plot the spectogram in matlab I get the following&#xA;spectrogram(Data,12000,8000,[],fs,'yaxis')&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pRKsd.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pRKsd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally here is the frequency spectrum &#xA;&lt;a href=&quot;https://i.stack.imgur.com/IAz8o.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IAz8o.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the signal does show up at 138 MHz, there appear to be aliases at 50 MHz, 190 Mhz and complex conjugate aliases at 86 MHz, 172MHz and 224 MHz. Does anybody know why this could happen?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;edit:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WYEzZ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WYEzZ.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7273" LastEditorUserId="7273" LastEditDate="2016-05-12T15:12:26.927" LastActivityDate="2016-05-12T16:58:09.387" Title="unexplainable aliases in spectrogram" Tags="|fft|spectrogram|aliasing|" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30725" PostTypeId="1" CreationDate="2016-05-11T09:49:10.857" Score="1" ViewCount="57" Body="&lt;p&gt;For the past few weeks, I have been trying to send a Zaddof Chu signal using a vector signal generator, and receive it using a signal analyzer. Both devices are made by R&amp;amp;S. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the signal I receive is extremely distorted even at very high SNR's. I would really appreciate any hints at where the issue could be originating from. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a the I and Q signals of the 21 samples ZC sequence, upsampled by 8 transmitted at $10\textrm{ kHz}$ base bandwidth and $2.4\textrm{ GHz}$ carrier frequency. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I signal: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/Q7o9g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Q signal: &#xA;&lt;img src=&quot;https://i.stack.imgur.com/VcyK8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And here is the received signal sampled at $1.6\textrm{ MHz}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Received I signal:&#xA; &lt;img src=&quot;https://i.stack.imgur.com/Ok6XO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Received Q signal:&#xA; &lt;img src=&quot;https://i.stack.imgur.com/mEVTV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After using the same clock for both devices, and using a coaxial cable to connect them both, I was able to receive an almost perfect real part, but the imaginary part is very distorted. &lt;/p&gt;&#xA;" OwnerUserId="20094" LastEditorUserId="1629" LastEditDate="2016-08-02T15:31:39.693" LastActivityDate="2016-08-02T15:31:39.693" Title="How do I correctly receive a signal using a signal analyzer?" Tags="|signal-analysis|signal-detection|" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30727" PostTypeId="2" ParentId="30557" CreationDate="2016-05-11T12:45:46.183" Score="2" Body="&lt;p&gt;I will start the explanation from the compression viewpoint. There are two main types: lossless compression, and lossy compression. Noise, at least divergence or loss  from the original data, arises only with lossy compression. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When one considers the original data as the &quot;clean&quot; reference, lossy compression adds a amount of loss related (generally vaguely increasing) to the compression ratio allowed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is interesting to take another perspective, which I borrow from &lt;a href=&quot;http://dx.doi.org/10.1109/78.482110&quot; rel=&quot;nofollow&quot;&gt;Filtering Random Noise from Deterministic Signals via Data Compression&lt;/a&gt;, 1995, B. K. Natarajan, that I found influential. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main idea starts from the observation that noise (with a sense of randomness, lack of predictability) is hard to compress, while structured signals possess a certain amount of correlation that somehow can be compacted. In other words, when data is easy to compress, it is likely to be structured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This led Natarajan to the definition of Occam filters, a name related to W. of Ockham and his (alleged) law of parsimony. Starting from noisy data, one compresses it to a loss close to the original noise power. If the compression system is well designed, this tends to remove (partly) some noise from the original signal. Shocking enough, lossy compression can denoise, killing two birds (denoising and compression) with one stone. This can be found for instance in &lt;a href=&quot;http://dx.doi.org/10.1109/83.862633&quot; rel=&quot;nofollow&quot;&gt;Adaptive wavelet thresholding for image denoising and compression&lt;/a&gt;, 2000, where the noise limit can be made adaptive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sparse representations, such as the wavelets above, but other transforms as well, have been found since effective at concentrating the energy of the structured signals, and at spreading or whitening some random noises. Being sparse, the sparse representation of the image has structures easy to compress, and spread noises. The very same action of obtaining a sparse representation is a good preprocessing for both compression and denoising.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note however that some abuse about &quot;compression&quot;. Actual compression encompasses quantization, coefficient location, entropy coding, etc., and merely producing few large coefficients and many zeroes does not really qualify for compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the analogy between compression and image denoising is not valid for all images, all types and levels of noises, but it is sufficiently correct in standard cases to allow them to be taught together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for comments:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if you have a sparse or compressible signal $x$ (in some representation $f$), and add uncorrelated noise $n$ to it, then applying $f$ on $x+n$ is not denoising &lt;em&gt;per se&lt;/em&gt;, because for denoising you need to decide, or choose, what to keep as a signal component and what to filter as a noise. But it generally provides:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a clearer &quot;distinction&quot; between them, in terms of (local) amplitude, that often simplify the use of statistical tools, or make them more robust&lt;/li&gt;&#xA;&lt;li&gt;better access to signal, or noise, properties, to parametrize the denoising&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;orthogonal transformations are quite good, but the orthogonality limit their ability to sparsely represent signals. Overcomplete transforms induce correlations in the  noise (&lt;a href=&quot;http://arxiv.org/pdf/1108.5395&quot; rel=&quot;nofollow&quot;&gt;Noise Covariance Properties in Dual-Tree Wavelet Decompositions&lt;/a&gt;), but as the signal coefficients are sparser, the relative amplitude of (sparse) signal coefficients and noise is (optimally) more favorable. Examples of correlated noise whitening with for instance redundant complex wavelets can be found for instance  in the  above &lt;a href=&quot;http://arxiv.org/pdf/1108.5395&quot; rel=&quot;nofollow&quot;&gt;reference&lt;/a&gt; or &lt;a href=&quot;https://pdfs.semanticscholar.org/d2bc/d8c1af2c7ded8fa6c1652c9e32e2a304cf6a.pdf&quot; rel=&quot;nofollow&quot;&gt;Removal of Correlated Noise by Modeling the Signal of Interest in the Wavelet Domain&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Of course, a lot the above assumes that the signal is sparse, that the noise is not correlated, and that you are able to find a proper representation, which is not evident in practice.&lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2016-05-13T06:07:37.647" LastActivityDate="2016-05-13T06:07:37.647" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30728" PostTypeId="2" ParentId="30722" CreationDate="2016-05-11T14:03:29.920" Score="2" Body="&lt;p&gt;As people have said in the comments, to have it sound right you will need to low pass filter before subsampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matlab function &lt;a href=&quot;http://www.mathworks.com/help/signal/ref/decimate.html&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;&lt;code&gt;decimate&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; does this automatically and gives some control over the type of low pass filter used.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-11T14:03:29.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30729" PostTypeId="1" AcceptedAnswerId="30754" CreationDate="2016-05-11T14:32:52.813" Score="1" ViewCount="385" Body="&lt;p&gt;Trying to figure out how to synthesize a Bandlimited PWM in my audio code in C. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have already figured out a bandlimited pulse wave but I can't really figure out how to translate that to PWM. I have used the Polynomial Bandlimited Step (PolyBLEP) approach to get a nice bandlimited pulse wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;float generateSample() {&#xA;    float sample = 0;&#xA;    sample = sinf(phase);&#xA;    if (sample &amp;gt;= dutyCycle) sample = 1;&#xA;    else if (sample &amp;lt; 0) sample = -1;&#xA;&#xA;    float t = phase/(2*M_PI);&#xA;    sample += poly_blep(t, phase_incr);&#xA;    sample -= poly_blep(fmod(t + 0.5, 1.0), phase_incr);&#xA;&#xA;    phase += phase_incr;&#xA;    phase = wrapPhase(phase);&#xA;&#xA;    return sample;&#xA;}&#xA;&#xA;// Phase Wrapper&#xA;float wrapPhase(float phs) {&#xA;    if (phs &amp;gt;= (2*M_PI)) phs -= (2*M_PI);&#xA;    return phs;&#xA;};&#xA;&#xA;double poly_blep(double t, double phs) {&#xA;    double dt = phs / (2*M_PI);&#xA;    // 0 &amp;lt;= t &amp;lt; 1&#xA;    if (t &amp;lt; dt) {&#xA;        t /= dt;&#xA;        return t+t - t*t - 1.0;&#xA;    }&#xA;    // -1 &amp;lt; t &amp;lt; 0&#xA;    else if (t &amp;gt; 1.0 - dt) {&#xA;        t = (t - 1.0) / dt;&#xA;        return t*t + t+t + 1.0;&#xA;    }&#xA;    // 0 otherwise&#xA;    else return 0.0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm guessing here that I have to adjust my t variable in &lt;code&gt;generateSample()&lt;/code&gt; to fit the PWM's duty cycle (ranges from 0.5-&gt;1) but I'm not totally sure how to do that... any help is appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! :) &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: Guess I wasn't clear, but I'm producing audible tones with a pulse wave. The PWM controls the pulse width of the pulse wave. I was encountering aliasing issues before I implemented a bandlimited waveform. With a duty cycle of 50%, there are no aliasing issues. However when I try to increase the duty cycle, I encounter aliasing issues again and it sounds audibly not what I want it to sound like&lt;/p&gt;&#xA;" OwnerUserId="10572" LastEditorUserId="10572" LastEditDate="2016-05-11T14:57:33.060" LastActivityDate="2016-05-12T19:41:38.440" Title="Bandlimited PWM" Tags="|audio|signal-synthesis|tone-generation|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30733" PostTypeId="1" AcceptedAnswerId="30735" CreationDate="2016-05-11T17:52:11.657" Score="5" ViewCount="139" Body="&lt;p&gt;If $\mathcal{H}$ denotes the Hilbert transform, the  analytic signal of a signal $x(t)$ is $$x_a(t) = x(t) +\imath \mathcal{H}(x(t))\,.$$ The real and imaginary parts form Hilbert pairs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there natural (and possibly useful) extensions, with another transform $\mathcal{T}$, which possesses involution, anti-involution or even semi-involution properties, see eg &lt;a href=&quot;https://math.stackexchange.com/a/1812005/257503&quot;&gt;Is there a name for a function whose square is an involution?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A shape can be (for instance):&#xA; $$x_b(t) = x(t) +\jmath \mathcal{T}(x(t)) +\jmath^2 \mathcal{T}^2(x(t))$$&#xA;of &quot;Hilbert-like&quot; triples? And $n$-uples? &#xA;Or, if any, related to higher order algebras (quaternions, octonions). What properties can they reveal (generalized instantaneous phase, envelopes?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am mainly   interested in constructions that, as least in some types of signals, in at least one application, have proven more efficient that state of the art. &lt;/p&gt;&#xA;" OwnerUserId="15892" LastEditorUserId="15892" LastEditDate="2017-04-14T13:29:01.647" LastActivityDate="2017-04-14T13:29:01.647" Title="Useful natural &quot;Hilbert-like&quot; $n$-uples and $n$-fold &quot;analytic signals" Tags="|signal-analysis|transform|local-features|hilbert-transform|" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30734" PostTypeId="2" ParentId="23723" CreationDate="2016-05-11T21:55:29.147" Score="2" Body="&lt;p&gt;First of all, SURF only uses it as a blob detector to find interest points.&#xA;The first order derivatives only give you directional information such as edge-ness. However, the Hessian (as the matrix of second derivatives) contains local structure information such as curvature / concavity etc. For instance, its eigenvectors can be used for cornerness measures. It is just more informative. Also, its determinant is used as an automatic scale selector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another common alternative would be a Laplacian detector, but Hessian shows better scale selection properties.&lt;/p&gt;&#xA;" OwnerUserId="7338" LastEditorUserId="7338" LastEditDate="2017-06-06T09:44:53.530" LastActivityDate="2017-06-06T09:44:53.530" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="30735" PostTypeId="2" ParentId="30733" CreationDate="2016-05-11T22:26:29.800" Score="4" Body="&lt;p&gt;The generalisation of the concept of an analytic signal is not straight forward. I'm quite certain however that looking for such a generalisation with quarternions (or even octonions) will not turn out fruitful. Those generalise complex numbers primarily algebraically, attempting to preserve as much of the field structure as possible, and not so much as a smooth geometric structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my experience, the most useful generalisations of the complex numbers are usually either unitary Lie groups or Clifford algebras.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That brings me to my example, which I encountered in my work ten years ago. The mathematical background is unfortunately too vast to be laid out here, but I will attempt a sketch of the problem and explain how it relates to your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the key motivations of finding an analytic signal is the ability to extract instantaneous phase and amplitude. I will take this as the guiding theme for generalisation. In the following, I will refer to the Hilbert transform as the map from a real valued signal to its analytic counterpart and not the quadrature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the signal space $L^2(A,B)$ of square integrable functions from $A$ to $B$. The usual Hilbert transform is then a continuous (with respect to the natural topology) $\mathbb{R}$-linear shift invariant map $$H:L^2(\mathbb{R},\mathbb{R})\to L^2(\mathbb{R},\mathbb{C})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that $\cos(\omega t)\mapsto \exp(i|\omega| t)$ for $\omega \in \mathbb{R}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can slightly reformulate this by replacing $\mathbb{C}$ with $\mathbb{R}^+_0 \times \mathrm{U}(1)$, where $\mathrm{U}(1)$ is the unitary group of dimension 1. To be able to square-integrate that, we define the square operator $\square^2:\mathbb{R}^+_0 \times \mathrm{U}(1)\to\mathbb{R}$ so that $(a,\Phi)^2\mapsto a^2$ and $L^2(A,\mathbb{R}^+_0 \times \mathrm{U}(1))$ is well defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is of course just the polar representation of the complex numbers and the Hilbert transform is still the same transform. However, with this reformulation, there is a nearly obvious generalisation. Replacing $\mathrm{U}(1)$ by a more general unitary group allows us to keep all the structure in place and have a sensible generalisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take $\mathrm{SU}(n)$ for the general case we also require an $n$-dimensional vector space for a faithful irreducible representation, so that we will allow signals in $L^2(\mathbb{R},\mathbb{R}^n)$ and the Hilbert transform is a continuous linear shift invariant map&#xA;$$H:L^2(\mathbb{R},\mathbb{R}^n) \to L^2(\mathbb{R},\mathbb{R}^+_0\times \mathrm{SU}(n) )$$&#xA;The actual map however is not obvious. It is easier to first generalise how it will be undone. The original Hilbert transform can be undone by taking the real part of the analytic result. For the generalisation, we can simply apply the group element to a unit vector, multiply the result with the amplitude and take the real part. So we map $$(a \in \mathbb{R}^+_0,\Phi \in \mathrm{SU}(n)) \mapsto a\cdot\Re\left(\Phi(\mathbf{e}_1)\right)$$ with a canonical basis vector $\mathbf{e}_1\in\mathbb{C}^n$. It is easily verified that this reduces to the standard case for $\mathrm{U}(1)$ and $\mathbf{e}_1=(1)\in\mathbb{C}^1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The preimages of the orbits of $\mathbf{e}_1$ generated by any generator $g\in\mathfrak{su}(n)$ of $\mathrm{SU}(n)$ under $H$ are therefore $$\Re\left( \exp(igt)\mathbf{e}_1 \right)=\frac{1}{2}\left( \exp(igt)+\exp(-igt)  \right)\mathbf{e}_1$$&#xA;where we used $g^\dagger = g$.&#xA;This suggests that $H$ should map&#xA;$$H:\frac{1}{2}\left( \exp(igt)+\exp(-igt)  \right)\mathbf{e}_1 \mapsto \left(1,\exp(igt)\mathbf{e}_1\right)$$&#xA;And here appears a problem. The map is supposed to work for all generators $g$, so also specifically for $-g$. If we plug in $-g$, the left hand side remains unchanged, but the right hand side is mapped to its complex conjugate. Hence, the map is not well defined. It is this very problem that makes using the magnitude of $\omega$ mandatory in the original Hilbert transform map. The generators in the Lie algebra form a vector space, and there is no canonical way to map all generators to a half space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have to equip the Lie algebra with an additional structural element, and that is a continuous map $$|\cdot|:\mathfrak{su}(n)\to\mathfrak{su}(n)$$ with the property $|g|\in \{g,-g \}$ and $|g|=|-g|$ for all $g$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this we have the generalisation of the Hilbert transform to unitary groups, given by the map&#xA;$$H:\frac{1}{2}\left( \exp(igt)+\exp(-igt)  \right)\mathbf{e}_1 \mapsto \left(1,\exp(i|g|t)\mathbf{e}_1\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The geometric interpretation of this transform is that a vector valued signal is decomposed into a real non-negative amplitude signal and a rotation in a complex vector space. The rotation is so the corresponding point on the Lie manifold traces a path whose time-oriented tangent is always in the same half-space, generalising the concept of positive frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not exactly answer your original question though. You can however embed a lower dimensional signal into $\mathbb{R}^n$ and then use this generalisation to find an $n$-dimensional Hilbert transform with any number of generalised components that you desire.&lt;/p&gt;&#xA;" OwnerUserId="3369" LastEditorUserId="3369" LastEditDate="2016-05-12T23:14:40.853" LastActivityDate="2016-05-12T23:14:40.853" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30736" PostTypeId="1" CreationDate="2016-05-12T00:01:48.730" Score="3" ViewCount="3089" Body="&lt;p&gt;Let say we have a stereo recording of only one source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is a correct algorithm to calculate its azimuth using inter channel time difference and inter channel level difference?&lt;/p&gt;&#xA;" OwnerUserId="18346" LastActivityDate="2016-05-15T13:44:28.813" Title="How to calculate an azimuth of a sound source in stereo signal" Tags="|audio|" AnswerCount="4" CommentCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="30737" PostTypeId="1" AcceptedAnswerId="30747" CreationDate="2016-05-12T02:57:55.160" Score="0" ViewCount="102" Body="&lt;p&gt;The entropy of a source $H(S)$, gives you the average codeword length to encode a given source alphabet. i.e. it is the average number of bits per symbol required to encode the information in the source. If: $p_0=3/5$ and $p_1=2/5$ (close probabilities) with $H=0.971 \textrm{ bits/symbol}$, then there's more information than compared to the 2nd case where $p_0=3/4$ and $p_1=1/4$ yielding $H = 0.8113 \textrm{ bits/symbol}$ to encode. Following are the problems that I am facing and I will be very grateful for a detailed answer. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In general, if the source entropy is $H$ then what should be the minimum number of bits if the alphabet is $0,1$ ?&lt;/li&gt;&#xA;&lt;li&gt;In case of discrete chaotic map say Logistic map, the entropy is $\log \lambda$ where $\lambda$ is the largest Lyapunov exponent. What should be the length of the time series in binary or what should be the length of the symbolic representation in binary of the initial condition?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="750" LastEditorUserId="1629" LastEditDate="2016-05-12T09:33:23.287" LastActivityDate="2016-05-13T02:19:04.617" Title="Entropy of a dynamical system and source code length" Tags="|digital-communications|self-study|information-theory|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30738" PostTypeId="1" AcceptedAnswerId="30748" CreationDate="2016-05-12T04:55:07.177" Score="1" ViewCount="80" Body="&lt;p&gt;I am looking to figure out if a current filter algorithm I have built could be useful for some problems I am looking into at work. It isn't a Kalman filter, but is instead making estimations using a Neural Network and the latest $N$ time series measurements for some state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tested it on a 2D particle tracking problem I put together with what I believe to be fairly large Gaussian noise, and it has performed decent as far as I can see. An example figure is below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6Dfq7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6Dfq7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I don't know if this sample problem is challenging enough to prove this algorithm works sufficiently well and I also don't have any reference algorithm results to compare against.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any sample problems seen in the literature or elsewhere that I could run to test this filtering algorithm against so I have a reference of what's good or not?&lt;/p&gt;&#xA;" OwnerUserId="20837" LastEditorUserId="20837" LastEditDate="2016-05-12T05:31:35.180" LastActivityDate="2016-05-12T13:26:07.890" Title="Good Reference Problem to Test Filtering/Estimation Algorithms" Tags="|filters|estimation|kalman-filters|time-series|neural-network|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30740" PostTypeId="1" AcceptedAnswerId="30744" CreationDate="2016-05-12T08:18:11.620" Score="2" ViewCount="7705" Body="&lt;p&gt;What does fixed-point number range represents? Why we use formula $2^a - 2^{-b}$, why minus $2^{-b}$? Where $a$ is number of integer bits, and $b$ is number of fractional bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have for example $a = 8$ and $b = 2$, don't we have a possibility to represent $2^a + 2^{-b}$ number and so that will represent the range?&lt;/p&gt;&#xA;" OwnerDisplayName="user20705" LastEditorUserId="90" LastEditDate="2016-05-13T12:26:04.243" LastActivityDate="2016-05-17T06:19:03.977" Title="How do I calculate the range of a fixed-point number with $a$ integer bits and $b $ fractional bits?" Tags="|fixed-point|" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30741" PostTypeId="2" ParentId="30740" CreationDate="2016-05-12T08:44:20.603" Score="2" Body="&lt;p&gt;The formula expresses the difference between the largest, and smallest numbers we can represent with an integer/fractional representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a simple example, such as 2.2 (where there are 2 integer bits and 2 fractional bits in our fixed point representation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we're using two's complement (signed) binary, the largest positive number we can represent is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;01.11  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This number is equivalent to $2 - \frac{1}{4}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The largest negative number we can represent is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;10.00&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This number is equivalent to $-2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The total &lt;em&gt;range&lt;/em&gt; here is from the largest positive to largest negative, or $-2$ -&gt; $2 - \frac{1}{4}$. Note that this is equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$4 - \frac{1}{4}$, or $2^a - 2^{-b}$ where both $a$ and $b$ are equal to 2, according to our 2.2 representation.  &lt;/p&gt;&#xA;" OwnerUserId="369" LastActivityDate="2016-05-12T08:44:20.603" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30742" PostTypeId="1" AcceptedAnswerId="30746" CreationDate="2016-05-12T08:45:54.680" Score="2" ViewCount="569" Body="&lt;p&gt;Why does the OFDM serializer has such a strong denoising effect in the flow graph below ? Is that normal ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upper constellation is AFTER the OFDM serializer block and the lower is BEFORE the OFDM serializer block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the OFDM documentation : &lt;a href=&quot;http://gnuradio.org/doc/doxygen/page_ofdm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://gnuradio.org/doc/doxygen/page_ofdm.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does not help to explain why the serializer block has such a strong denoising effect, any idea why this denoising happens ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the flowgraph (in .grc format): &lt;a href=&quot;http://pastebin.com/raw/PTY0Q0Ty&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/raw/PTY0Q0Ty&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8pihB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8pihB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/e6raH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/e6raH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further inspection indicates that the serializer block only does remove non data carriers. It just probably so happens that anything that is non data is super noisy, and data carriers are not noisy at all, but I still wonder how is this possible.&lt;/p&gt;&#xA;" OwnerUserId="19066" LastEditorUserId="19066" LastEditDate="2016-05-12T09:37:43.460" LastActivityDate="2016-05-12T10:00:30.777" Title="Denoising effect in GnuRadio OFDM Serializer block" Tags="|demodulation|ofdm|gnuradio|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30743" PostTypeId="2" ParentId="30740" CreationDate="2016-05-12T08:52:33.423" Score="5" Body="&lt;p&gt;For an unsigned fixed-point, the representation for a $N$-bit binary number $x$ is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$x=\frac{1}{2^b}\sum_{n=0}^{N-1}2^n x_n, \quad \text{where $x_n$ is the $n^{\rm th}$ bit value of $x$}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this $N$-bit binary number you can get values from $0$ to $2^N -1$ since the smallest number is the $N$-bit all-zeros ($x_n =0\ \forall n$), and the largest is the $N$-bit all-ones ($x_n =1\ \forall n$). The representation for the minimum and maximum values are then given as follow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;x_{\rm min}&amp;amp;=\frac{1}{2^b}\left(1\cdot 0+ 2^1\cdot 0+\ldots+2^{N-1}\cdot 0\right)=\frac{1}{2^b} \cdot 0=0\\&#xA;x_{\rm max}&amp;amp;=\frac{1}{2^b}\left(1\cdot 1+ 2^1\cdot 1+\ldots+2^{N-1}\cdot 1\right)=\frac{1}{2^b}\left[1\cdot\left(\frac{1-2^N}{1-2}\right)\right]=\frac{2^N - 1}{2^{b}}=2^{N-b} - 2^{-b}\\&#xA;\end{align}&#xA;With $a=N-b$, you get the range. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read &lt;a href=&quot;http://www.digitalsignallabs.com/fp.pdf&quot; rel=&quot;nofollow&quot;&gt;this great paper&lt;/a&gt; by Randy Yates on Fixed-Point Arithmetic. There you find the derivation of the range for the signed case and much more.&lt;/p&gt;&#xA;" OwnerUserId="1629" LastEditorUserId="1629" LastEditDate="2016-05-13T07:47:39.280" LastActivityDate="2016-05-13T07:47:39.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30744" PostTypeId="2" ParentId="30740" CreationDate="2016-05-12T08:57:00.203" Score="7" Body="&lt;p&gt;Let's assume that we are dealing with unsigned number types. If you would use all $a+b$ bits for the integer part then the set of possible numbers would be:&#xA;$$\left\{0, 1, 2, 3, \dots, 2^{a+b}-1\right\}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These numbers can be divided by $2^b$ (or multiplied by $2^{-b}$) to take use of $b$ bits for the fractional part, resulting in this set of possible numbers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left\{0, 1\times2^{-b}, 2\times2^{-b}, 3\times2^{-b},\dots, \left(2^{a+b}-1\right)\times2^{-b}\right\}&#xA;\\=\left\{0, 2^{-b}, 2\times2^{-b}, 3\times2^{-b},\dots, \underline{\underline{2^a-2^{-b}}}\right\}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your formula gives the largest number that can be represented (double underlined).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The formula can also be understood as going a step $2^{-b}$ or one least significant bit (LSB) worth backwards from $2^a$ which is the first number that has the same truncated binary string representation as 0, the first number in the system. In a similar way in the 8-bit unsigned integer system we take a LSB-sized step backwards from 256 (1&amp;nbsp;0000&amp;nbsp;0000 binary) to obtain 255 (1111&amp;nbsp;1111 binary) which is the largest representable number in that system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just found out that &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Range_(statistics)&quot; rel=&quot;nofollow&quot;&gt;range&lt;/a&gt;&lt;/em&gt; has an established meaning in arithmetic: Largest value minus smallest value. The smallest value happens to be zero so in this case the largest value equals the range.&lt;/p&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-05-17T06:19:03.977" LastActivityDate="2016-05-17T06:19:03.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30745" PostTypeId="1" AcceptedAnswerId="30778" CreationDate="2016-05-12T09:50:18.803" Score="1" ViewCount="76" Body="&lt;p&gt;I have read a &lt;a href=&quot;http://web.archive.org/web/20160308225842/http://diracvideo.org/download/specification/dirac-spec-latest.pdf&quot; rel=&quot;nofollow&quot;&gt;specification&lt;/a&gt; of &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_(video_compression_format)&quot; rel=&quot;nofollow&quot;&gt;Dirac&lt;/a&gt; (video compression format). A key element of this format is the use of the discrete wavelet transform. Section 15.6.3 of the specification defines individual wavelets by making use of a lifting scheme. I am interested in the &lt;strong&gt;Fidelity filter&lt;/strong&gt; for improved down-conversion and anti-aliasing. Where did it come from? Is there a paper that describes it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For convenience, the lifting filters are defined as:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;[ −2, 10, −25, 81, 81, −25, 10, −2 ]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[ −8, 21, −46, 161, 161, −46, 21, −8 ]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="18335" LastEditorUserId="8202" LastEditDate="2016-05-12T12:27:03.583" LastActivityDate="2016-05-13T19:53:13.460" Title="Wavelet Fidelity Filter (video compression)" Tags="|filters|wavelet|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30746" PostTypeId="2" ParentId="30742" CreationDate="2016-05-12T10:00:30.777" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Further inspection shows indicates that the serializer block only does remove non data carriers. It just probably so happens that anything that is non data is super noisy, and data carriers are not noisy at all, but I still wonder how is this possible.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The magic that happens here is in the actual equalizer used in the frame equalizer block. If you'd scroll up in the GRC¹, you'd probably see the payload equalizer object block, holding a &quot;simpledfe&quot; equalizer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;em&gt;simpledfe&lt;/em&gt; stands for &lt;em&gt;simple data feed-back equalizer&lt;/em&gt;. It's actually pretty well-documented, but somehow the documentation tool broke and the &lt;a href=&quot;http://gnuradio.org/doc/doxygen/classgr_1_1digital_1_1ofdm__equalizer__simpledfe.html&quot; rel=&quot;nofollow&quot;&gt;HTML documentation&lt;/a&gt; doesn't actually contain any of the explanation given in the source code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, here's a &lt;a href=&quot;https://github.com/gnuradio/gnuradio/blob/master/gr-digital/include/gnuradio/digital/ofdm_equalizer_simpledfe.h#L32&quot; rel=&quot;nofollow&quot;&gt;source code&lt;/a&gt; excerpt with the docs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/* \brief Simple decision feedback equalizer for OFDM.&#xA; * \ingroup ofdm_blk&#xA; * \ingroup equalizers_blk&#xA; *&#xA; * \details&#xA; * Equalizes an OFDM signal symbol by symbol using knowledge of the&#xA; * complex modulations symbols.&#xA; * For every symbol, the following steps are performed:&#xA; * - On every sub-carrier, decode the modulation symbol&#xA; * - Use the difference between the decoded symbol and the received symbol&#xA; *   to update the channel state on this carrier&#xA; * - Whenever a pilot symbol is found, it uses the known pilot symbol to&#xA; *   update the channel state.&#xA; *&#xA; * This equalizer makes a lot of assumptions:&#xA; * - The initial channel state is good enough to decode the first&#xA; *   symbol without error (unless the first symbol only consists of pilot&#xA; *   tones)&#xA; * - The channel changes only very slowly, such that the channel state&#xA; *   from one symbol is enough to decode the next&#xA; * - SNR low enough that equalization will always suffice to correctly&#xA; *   decode a symbol&#xA; * If these assumptions are not met, the most common error is that the&#xA; * channel state is estimated incorrectly during equalization; after that,&#xA; * all subsequent symbols will be completely wrong.&#xA; *&#xA; * Note that the equalized symbols are *exact points* on the constellation.&#xA; * This means soft information of the modulation symbols is lost after the&#xA; * equalization, which is suboptimal for channel codes that use soft decision.&#xA; *&#xA; */&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hm, but what about unoccupied carriers? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, looking at the implementation in &lt;a href=&quot;https://github.com/gnuradio/gnuradio/blob/master/gr-digital/lib/ofdm_equalizer_simpledfe.cc#L90&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;ofdm_equalizer_simpledfe&lt;/code&gt;&lt;/a&gt; we see:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void&#xA;ofdm_equalizer_simpledfe::equalize(gr_complex *frame,&#xA;      int n_sym,&#xA;      const std::vector&amp;lt;gr_complex&amp;gt; &amp;amp;initial_taps,&#xA;      const std::vector&amp;lt;tag_t&amp;gt; &amp;amp;tags)&#xA;{&#xA; […]&#xA;&#xA;  gr_complex sym_eq, sym_est;&#xA;&#xA;  for (int i = 0; i &amp;lt; n_sym; i++) {&#xA;    for (int k = 0; k &amp;lt; d_fft_len; k++) {&#xA;      if (!d_occupied_carriers[k]) {&#xA;        continue;&#xA;      }&#xA;      […]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In other words: those are left untouched from the original FFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, a typical direct conversion OFDM system will leave the DC carrier unoccupied – that containing the leakage of the receiver LO.&#xA;That is typically a relatively powerful FFT bin, shouldn't vary much in magnitude, and its phase should depend on the point in time the DFT was taken, and that's the frame start time as determined by the Schmidl&amp;amp;Cox sync. That would be my explanation of the $|\cdot|\approx 50$ constellation points, and the rest might very well be the unequalized noise in original amplitude, especially since we're looking at a constellation sink that shows 1024 constellation points at once – so we'll see some outliers in noise power. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr/&gt;&#xA;¹ It's often impossible to fit a whole GRC flow graph on the screen. It's therefore really handy that there's the &quot;save screen capture button&quot; in the toolbar and the menu!&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-05-12T10:00:30.777" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30747" PostTypeId="2" ParentId="30737" CreationDate="2016-05-12T13:14:33.300" Score="2" Body="&lt;p&gt;I can try to answer your first question (but I'm not sure I understand exactly what you mean).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A source produces messages with average information $H$. You seem to have a binary source, with two messages $m_1$ and $m_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you want to &lt;em&gt;encode&lt;/em&gt; the messages to a sequence of 1s and 0s (subsequently called &quot;bits&quot;). This is called &quot;source coding&quot;. Even though we know that, in principle, we should be able to encode $N$ messages using $NH$ bits (for large $N$), it is not always obvious how to do so. There are algorithms such as Huffman and Lempel-Ziv that can find good (even optimal) encodings. Note that all good coding algorithms encode messages in groups, not individually, and they approach $NH$ only when $N$ is large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your question is &quot;what's the smallest number of bits that I need to encode $N$ messages from a source with entropy $H$&quot;, the answer is $NH$ (in theory), and somewhat more in practice, depending on the optimality of your encoding algorithm and the value of $N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt; A source produces 8-bit messages $b_7b_6b_5b_4b_3b_2b_2b_1b_0$ uniformly at random, but $b_7$ is always 0. The entropy is 7 bits/message. Let's say we want to transmit 100 messages. Even though the source produced 800 bits, we only need 700 to transmit the messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt; You flip a biased coin with $p(\text{heads})=0.3$ 1000 times. The entropy of the experiment is 0.88 bits/flip. To convey the result of the 1000 flips, you'll need &lt;em&gt;on average&lt;/em&gt; 880 bits. Some particular results will need more bits, some will need less. To figure out how many bits you need for a particular sequence of flips you need to specify your encoder algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example 3:&lt;/strong&gt; You have a biased 3-sided die with probability distribution $p(1)=0.5$, $p(2)=0.25$, $p(3)=0.25$. The entropy is 1.5 bits/throw. It's pretty easy to come up with an encoder:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result  encoding&#xA;1    -&amp;gt; 0&#xA;2    -&amp;gt; 10&#xA;3    -&amp;gt; 11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should be able to convince yourself that, on average, this encoding results in 1.5 bits per throw. However, let's say that you're unlucky and you get 1000 '3' in a row. &lt;em&gt;That&lt;/em&gt; particular sequence will need 2,000 bits to transmit. That's why the entropy can only predict the average sequence length, not the length you'll get for a particular set of messages.&lt;/p&gt;&#xA;" OwnerUserId="11256" LastEditorUserId="11256" LastEditDate="2016-05-13T02:19:04.617" LastActivityDate="2016-05-13T02:19:04.617" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="30748" PostTypeId="2" ParentId="30738" CreationDate="2016-05-12T13:26:07.890" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://dsp.stackexchange.com/a/8869/80&quot;&gt;This answer&lt;/a&gt; might give you one example problem and a KF implementation to solve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual problems are kinematics problems, where you want to track position, velocity, and acceleration in one or more dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some nonlinear problems, too, like &lt;a href=&quot;http://espace.library.uq.edu.au/view/UQ:11308/PPEKF_IEEE_SPL_K.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;frequency / phase tracking&lt;/a&gt; but that might be overkill. See how it works on linear problems first.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-05-12T13:26:07.890" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30750" PostTypeId="2" ParentId="30724" CreationDate="2016-05-12T16:33:04.313" Score="4" Body="&lt;p&gt;Looking at the spectrogram, the prominent artifacts go up or down in frequency synchronously to the 138 MHz signal but have larger bandwidths. That is an indication that they are its harmonics, due to a nonlinearity somewhere in the system. With the sampling frequency of 500 MHz some of the positive and negative harmonics alias to the following (bold) frequencies that match with the prominent artifact bands:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;-138 MHz * 2 = -276 MHz. -276 MHz + 500 MHz = &lt;strong&gt;224 MHz&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;-138 MHz * 3 = -414 MHz. -414 MHz + 500 MHz = &lt;strong&gt;86 MHz&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;138 MHz * 4 = 552 MHz. 552 MHz - 500 MHz = &lt;strong&gt;52 MHz&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The apparent bandwidths and complex conjugacy seem to match those calculations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You did not mention what equipment you are using, but it looks like there is no proper antialias filter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The less prominent artifact bands can be explained similarly:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;138 MHz * 5 = 690 MHz. 690 MHz - 500 MHz = &lt;strong&gt;190 MHz&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;-138 MHz * 6 = -828 MHz. -828 MHz + 2 * 500 MHz = &lt;strong&gt;172 MHz&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15347" LastEditorUserId="15347" LastEditDate="2016-05-12T16:58:09.387" LastActivityDate="2016-05-12T16:58:09.387" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30752" PostTypeId="1" CreationDate="2016-05-12T18:20:25.640" Score="1" ViewCount="1769" Body="&lt;p&gt;I am new in image processing.I know that pixels in the same image are correlated with each other but I don't know how can I draw the relationship b/w these pixels in the form of graph?.&lt;/p&gt;&#xA;" OwnerUserId="20983" LastActivityDate="2017-06-21T13:17:28.627" Title="pixels in the same image are correlated but how can I visualize it?" Tags="|image-processing|image-compression|" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30753" PostTypeId="1" CreationDate="2016-05-12T18:27:46.090" Score="0" ViewCount="313" Body="&lt;p&gt;i'm sure this is a fairly large topic area, but I'm not quite sure where to start. I have a signal in which I can change several parameters, such as the frequency, gain, etc. The modulation is a differential BPSK, and my current metric for determining the signal quality is what percentage of my auto correlation (correlating the current bit signal with the previous bit) is above 0. If it's all above or below zero, a 100% signal quality. if it's half and half, then it's 0%, and then it's linear from there. Is there a better way of doing this? I'm wanting to be able to change my signal parameters in order to increase my signal quality, where a higher signal quality should be a higher reliability of receiving a message correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also looking at doing demodulation in the frequency domain, so then my calculations would probably need to change. Any input and references would be appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="16913" LastEditorUserId="16913" LastEditDate="2016-05-12T20:39:18.077" LastActivityDate="2017-07-07T06:17:34.800" Title="Methods for calculating signal quality metric" Tags="|signal-analysis|digital-communications|signal-detection|" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="30754" PostTypeId="2" ParentId="30729" CreationDate="2016-05-12T19:41:38.440" Score="1" Body="&lt;p&gt;Hey guys I figured it out through reading this: &lt;a href=&quot;http://www.musicdsp.org/files/bandlimited.pdf&quot; rel=&quot;nofollow&quot;&gt;enter link description here&lt;/a&gt;&#xA;and this: &lt;a href=&quot;https://en.wikipedia.org/wiki/Pulse_wave&quot; rel=&quot;nofollow&quot;&gt;Pulse wave Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I was reading that a bandlimited pulse wave could be synthesized with two bandlimited sawtooth waves. One of the saw waveforms will be out of phase with the other to create a rectangular waveform (50% duty cycle is sqr wave). To do PWM, just shift the phase of the out of phase saw waveform. I implemented this and it totally worked!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wiki explanation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A pulse wave can be created by subtracting a sawtooth wave from a phase-shifted version of itself. If the sawtooth waves are bandlimited, the resulting pulse wave is bandlimited, too.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Great learning experience and I'm sure there's a more efficient way to do it and will still be looking out for that. Hopefully this helps another person who is having the same problem one day!&lt;/p&gt;&#xA;" OwnerUserId="10572" LastActivityDate="2016-05-12T19:41:38.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30755" PostTypeId="2" ParentId="30753" CreationDate="2016-05-12T19:53:11.773" Score="2" Body="&lt;p&gt;From your question it sounds like you are looking for a SNDR metric.  In that case you are measuring a distortion level by comparing the distorted signal to a reference.&lt;br&gt;&#xA;For a discrete-time signal $y$, comparable to reference $r$, the SNDR would be:&#xA;$$ SNDR = \frac{E[r^2]}{E[(y-r)^2]} $$&lt;/p&gt;&#xA;" OwnerUserId="20984" LastEditorUserId="80" LastEditDate="2016-05-12T19:58:44.120" LastActivityDate="2016-05-12T19:58:44.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30756" PostTypeId="2" ParentId="30474" CreationDate="2016-05-12T20:35:24.980" Score="1" Body="&lt;p&gt;This is an attempt to answer. It's not complete, and a little fuzzy, but feel free to comment and I can edit / update.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1) the statement about the determinant of $(I-Fz)$ being 1 when $z$ = zero.&#xA;  I mean I understand why that's true but what does it have to do with the price of tea in china ? or causality ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So let's have a look:&#xA;$$&#xA;x(t+1) = Fx(t) + Lz(t) + K \epsilon(t)\\&#xA;zx(t) - Fx(t) = Lz(t) + K \epsilon(t)\\&#xA;(I-Fz^{-1})x(t) = z^{-1}[Lz(t) + K \epsilon(t)]\\&#xA;x(t) = (I-Fz^{-1})^{-1}z^{-1}[Lz(t) + K \epsilon(t)]\\&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to note about this is that $z$ is used twice: once as the lag operator and once as the &quot;reference&quot; signal.  That confused me for a while. Another thing is that they appear to use $z$ as the &lt;em&gt;lag&lt;/em&gt; operator, whereas $z^{-1}$ is usually used. Above I've assumed the conventional approach to $z$ as the &lt;em&gt;advance&lt;/em&gt; operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of causality comes from the ROC associated with the $z$ transform.  A $z$-transform is causal if its ROC extends outwards from the outermost pole.  A $z$-transform is BIBO stable if its ROC includes the unit circle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe what they really should have said is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Because we assume that $\displaystyle(I - Fz)^{-1} = \sum_{j = 0}^\infty F^{j}z^{j}$, we assume $j\not &amp;lt; 0$ and so assume causality.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which is also sort of implied in their use of state space equations, as they say &lt;em&gt;In this sense, causality is built into the definition of state-space systems.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) the derivation of the transfer functions, $k(z)$ and $l(z)$. I do understand 1.2.21) so I imagine that 1.2.21) is used to derive them ????? I also understand the second equalities in $k(z)$ and $l(z)$. But not the first equality signs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Assuming for now that $L=0$, then the state space form of the $z$ transform of (1.1.22) and (1.1.23) is just:&#xA;$$&#xA;H(I - z^{-1})K + I&#xA;$$&#xA;&lt;a href=&quot;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-241j-dynamic-systems-and-control-spring-2011/readings/MIT6_241JS11_chap10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;see these notes&lt;/a&gt;, particularly equation (10.20):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/A1jxE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A1jxE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though they use $A, B, C,$ and $D$ instead of $F, K, H,$ and $I$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just the standard way to represent transfer functions in state space.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;3) the equation for $x(t)$ at the very end. I do see how $y(t)$ is obtained once one has $x(t)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I believe the $x(t)$ equation is just had by the usual solution to a linear, constant coefficient difference equation with non-zero initial conditions (but using their notation). It's not the same notation, &lt;a href=&quot;https://cnx.org/contents/njHe-mRv@6/Solving-Linear-Constant-Coeffi&quot; rel=&quot;nofollow noreferrer&quot;&gt;but try this.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My guess is that I need is nice reference or lectures notes that explain why, when it comes to the KF, &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;A) the determinant of $(I-Fz)$  is important and &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See answer to 2) above.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;B) how the associated transfer response functions are obtained  from a state space representation? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See references above.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;C) How the $x(t)$ equation is obtained given the transfer function ? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See answer to 3) above.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-12T20:35:24.980" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30757" PostTypeId="1" AcceptedAnswerId="30781" CreationDate="2016-05-13T04:16:23.540" Score="2" ViewCount="1049" Body="&lt;p&gt;I have an open-loop system function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$L(s)=6\frac{(s-2)^2}{s(s-20)^2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I wanted to to the root locus diagram for it. I did it in MATLAB and got the following graph&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f5V7S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f5V7S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't know how to do by hand is dealing with the double poles (and zeros). I mean, I think that that's the cause why there are &lt;em&gt;two&lt;/em&gt; lines going out from that pole at $s=20$ and &lt;em&gt;two&lt;/em&gt; going to $s=2$. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a way of, more or less precisely, draw those lines by hand? &lt;/li&gt;&#xA;&lt;li&gt;How can one get the specific value of $k$ for any position of the root locus without using MATLAB (namely, doing it with a pen and a paper)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="19249" LastEditorUserId="19249" LastEditDate="2016-05-13T19:33:58.547" LastActivityDate="2016-05-13T22:24:43.900" Title="How to do this root locus by hand?" Tags="|homework|control-systems|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30758" PostTypeId="2" ParentId="30733" CreationDate="2016-05-13T06:39:25.427" Score="1" Body="&lt;p&gt;In this paper: &quot;&lt;a href=&quot;http://journals.cambridge.org/action/displayAbstract?fromPage=online&amp;amp;aid=4847916&amp;amp;fileId=S0004972700027799&quot; rel=&quot;nofollow&quot;&gt;On the p-norm of the truncated Hilbert transform&lt;/a&gt;&quot; by McLean and Elliot they say that the Hilbert transform is the only bounded integral operator on $L^p(\mathbb{R})$ that commutes with both translation and dilations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper by King, &quot;&lt;a href=&quot;http://link.springer.com/article/10.1007%2Fs11045-007-0034-z&quot; rel=&quot;nofollow&quot;&gt;Operator basis for analytic signal construction&lt;/a&gt;&quot;, might be of interest as it talks about the above property and also gives an overview of a &quot;fractional Hilbert transform&quot;.&lt;/p&gt;&#xA;" OwnerUserId="2046" LastActivityDate="2016-05-13T06:39:25.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30759" PostTypeId="1" CreationDate="2016-05-13T07:04:16.460" Score="1" ViewCount="855" Body="&lt;p&gt;I am having problems generating LDPC codes of arbitrary sizes in MATLAB primarily because MATLAB insists on the parity check matrix that is input into its &lt;code&gt;ldpcenc&lt;/code&gt; function has the sub-matrix that encompasses the last $n-k$ columns being invertible. The error that is thrown by the &lt;code&gt;ldpcenc&lt;/code&gt; function when an unsuitable matrix is input is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The last (N-K) columns of the parity-check matrix must be invertible in GF(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am generating parity matrices with the online tool found &lt;a href=&quot;http://webdemo.inue.uni-stuttgart.de/gauger_webdemos/02_lectures/LDPC_degree_distribution/index.php?id=3#&quot; rel=&quot;nofollow&quot;&gt;HERE&lt;/a&gt; which accepts the maximum node degrees and the code rate as input and outputs optimised parity check matrices for BEC and AWGN channels. An obvious solution to this problem would seem to just convert my parity check matrices to standard systematic form - I tried doing this by using &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/47383-message-passing-algorithm-for-decoding-binary-ldpc-codes/content/mpdecoder/GenerateSystematicCode.m&quot; rel=&quot;nofollow&quot;&gt;THIS&lt;/a&gt; function from Matworks file exchange but the resulting parity check matrix (even though it gets accepted just fine by the &lt;code&gt;ldpcenc&lt;/code&gt; function) doesn't seem to 'work' (i.e a code with rate = 1/2 and block size 20 can't correct the received code even if there is just 1 bit in error). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I generate LDPC codes of arbitrary sizes in MATLAB? Any help appreciated.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="4376" LastEditorUserId="4376" LastEditDate="2016-05-15T15:14:45.947" LastActivityDate="2016-10-18T03:47:36.813" Title="Generating LDPC codes of arbitrary sizes in MATLAB" Tags="|matlab|digital-communications|channelcoding|" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30760" PostTypeId="1" AcceptedAnswerId="30764" CreationDate="2016-05-13T07:44:32.010" Score="0" ViewCount="3574" Body="&lt;p&gt;Why does the constellation rotate when using OFDM Symbol Acquisition block in this flow graph below ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only explanation I could think of would be carrier frequency offset but in this flowgraph there is no carrier offset, so how can the constellation rotate if there is no carrier offset ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the OFDM Symbol Acquisition block only finds where the OFDM symbol is (by finding the cyclic prefix using the autocorrelation function - I believe) and does not do any further magic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am asking this because I am trying to demodulate a recorded OFDM signal for which I do not know the Sync Word but I can do carrier synchronization &quot;by hand&quot;, so the OFDM Symbol Acquisition block would be useful in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the GRC file : &lt;a href=&quot;http://pastebin.com/2WvRG2Ly&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://pastebin.com/2WvRG2Ly&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QQRtk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QQRtk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2y4dU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2y4dU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;Inspired by Marcus' answer I made the following simpler flow graph:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/PMyi3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PMyi3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Which gives this result:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JSE4M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JSE4M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not spinning anymore :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I wonder why is the constellation so noisy if there is no noisy channel? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should not be noisy right ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ClMuY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ClMuY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qPMAd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qPMAd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to be noisy because the source is noisy, strange. Why is that ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT3: The source noisiness comes from the RRC filter.&lt;/p&gt;&#xA;" OwnerUserId="19066" LastEditorUserId="19066" LastEditDate="2016-05-13T11:30:36.853" LastActivityDate="2018-06-01T01:24:12.640" Title="OFDM symbol acquisition block in GNU Radio gives rotating constellation even if there is no carrier offset. How is this possible?" Tags="|demodulation|ofdm|gnuradio|constellation-diagram|synchronization|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30761" PostTypeId="1" CreationDate="2016-05-13T08:35:34.147" Score="1" ViewCount="179" Body="&lt;p&gt;For example, if I have two signals, $\cos(2\pi ft+\frac\pi4)+\cos(2\pi ft+\frac\pi3)$, what would be different in both transforms (Fourier and cosine) how would the spectrum changes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And What would happened for a signal like $\cos(2\pi ft)+\cos(2\pi ft+0.99\pi)$.&lt;/p&gt;&#xA;" OwnerUserId="15851" LastEditorUserId="13320" LastEditDate="2016-05-14T08:56:46.653" LastActivityDate="2016-05-14T09:23:23.623" Title="How would Fourier and Cosine Transforms responds to summation of cosines with same frequency but different phases?" Tags="|fourier-transform|frequency-spectrum|phase|transform|cosine|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30762" PostTypeId="1" AcceptedAnswerId="30768" CreationDate="2016-05-13T09:52:38.150" Score="2" ViewCount="4147" Body="&lt;p&gt;I want to implement Welch's method for PSD calculation in MATLAB. I do not want to use built in MATLAB &lt;code&gt;cpsd&lt;/code&gt; function, such that I can change the FFT implementation in &lt;code&gt;cpsd&lt;/code&gt;(for certain purpose). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already tried to replicate the method based on Welch paper and explanation from the page: &lt;a href=&quot;http://nl.mathworks.com/help/signal/ug/nonparametric-methods.html&quot; rel=&quot;nofollow&quot;&gt;Nonparametric Methods&lt;/a&gt;. Below is the code that I already implemented with comments about steps to achieve the result. (it is used for accelerometer real data, so &lt;code&gt;numaxis&lt;/code&gt; represent number of axis, $xyz$. Each column represent each axis, the time series data is arranged into row):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function psd = pspectra(data1,data2, window, overlap, nfft, fs)&#xA;&#xA;%checking the size&#xA;if(size(data1,2) ~= size(data2,2))&#xA;    error('size of column is not equal');&#xA;elseif(size(data1,1) ~= size(data2,1))&#xA;    error('size of row is not equal');&#xA;else&#xA;    numaxis = size(data1,2);&#xA;end&#xA;&#xA;%calculating window sliding step for iteration&#xA;winsize = length(window);&#xA;step = winsize - overlap;&#xA;iter = 1 + (size(data1,1) - winsize)/step;&#xA;&#xA;%start and end index of first window/segment&#xA;istart = 1;&#xA;iend = istart + winsize - 1;&#xA;&#xA;%start calculating fft for each window&#xA;for i=1:iter&#xA;    for j=1:numaxis&#xA;        %apply window&#xA;        data1(istart:iend,j) = data1(istart:iend,j).*window;&#xA;        data2(istart:iend,j) = data2(istart:iend,j).*window;&#xA;&#xA;        %calculate fft&#xA;        fft1(:,j,i) = fft(data1(istart:iend,j),nfft);&#xA;        fft2(:,j,i) = fft(data2(istart:iend,j),nfft);     &#xA;    end&#xA;&#xA;    %move to next window segment&#xA;    istart = istart + step;&#xA;    iend = iend + step;&#xA;end&#xA;&#xA;%obtain scale to create modified periodogram&#xA;scale = 1/(fs.*sum(window.*window));&#xA;&#xA;%averaging window result and apply the scaling&#xA;psd = zeros((nfft/2)+1,size(fft1,2));&#xA;&#xA;for i=1:iter&#xA;    psd = psd + fft1(1:(nfft/2)+1,:,i).*conj(fft2(1:(nfft/2)+1,:,i));&#xA;end&#xA;&#xA;psd = psd.*scale./iter;&#xA;&#xA;%multiply by 2 except dc and nyquist component (1 and 51)&#xA;psd(2:50,:) = psd(2:50,:).*2;&#xA;&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried using multiple segment with non overlapping window/segment, and got exactly the same result as &lt;code&gt;cpsd()&lt;/code&gt; function from MATLAB. For example, using this call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pspectra(data1,data1,hamming(50),0,100,100);&#xA;pspectra(data1,data1,hamming(25),0,100,100);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I tried overlapping window like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pspectra(data1,data1,hamming(50),25,100,100);&#xA;pspectra(data1,data1,hamming(60),20,100,100);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulted power spectra is totally different. I have tried to find if my implementation is wrong (in theory or code), and unfortunately no luck yet. Do I miss something in here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really appreciate for any help.&lt;/p&gt;&#xA;" OwnerUserId="20988" LastEditorUserId="1629" LastEditDate="2016-05-13T13:14:29.657" LastActivityDate="2019-12-29T05:21:01.380" Title="Implementing Welch's method for Power Spectral Density" Tags="|matlab|discrete-signals|signal-analysis|power-spectral-density|" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30763" PostTypeId="2" ParentId="30719" CreationDate="2016-05-13T10:21:01.387" Score="1" Body="&lt;p&gt;The answer &lt;a href=&quot;https://dsp.stackexchange.com/questions/24734/camera-calibration-why-chessboards&quot;&gt;here&lt;/a&gt; suggests that checkerboard patterns may yield more accurate (subpixel) calibration results and be more robust.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may have edited your question because the title asks which pattern but the text asks about rows and columns. In either case, you may consider using checkerboard instead of circle pattern maybe?&lt;/p&gt;&#xA;" OwnerUserId="20990" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:26.630" LastActivityDate="2016-05-13T10:21:01.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30764" PostTypeId="2" ParentId="30760" CreationDate="2016-05-13T10:32:19.473" Score="3" Body="&lt;p&gt;Got me at that one! The &quot;&lt;a href=&quot;http://gnuradio.org/doc/doxygen/classgr_1_1dtv_1_1dvbt__ofdm__sym__acquisition.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;OFDM symbol acquisition&lt;/a&gt;&quot; block is in fact not from &lt;code&gt;gr-digital&lt;/code&gt; (where your other OFDM blocks come frome), but from gr-dtv, where it is used to capture DVB-T signals, if I remember correctly. It might be very DVB-specific!&#xA;Let us have a look at the dvbt_rx_8k.grc example from gr-dtv (or, at least, the top half):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YN1sH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YN1sH.png&quot; alt=&quot;dvbt_rx_8k.grc&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your understanding is absolutely right, OFDM symbol acquisition just does some syncing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time, I'll leave a bit more up to your own research (as finishing this up as a nice answer will probably take quite some time), and will concentrate on the steps I took to figure out how the block works. I hope this is most helpful to you, and of course helpful for future answer-seekers trying get the general grasp on how to find out how GNU Radio blocks &quot;tick&quot;. Looking at your flow graph, I'm pretty sure you've done most of this already, but as I mentioned, I'd like to illustrate the &quot;investigative principle&quot; for others.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I figured out how the underlying block is called. Typically, the default name of a new block of that type gives that away, or the documentation type. So &lt;code&gt;dtv_dvbt_ofdm_sym_acquisition&lt;/code&gt; was what I found.&lt;/li&gt;&#xA;&lt;li&gt;Then I went to the GNU Radio source repo clone and used git to figure out where to look (I'll annotate the result with a bit of hints):&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre&gt;&#xA;$ git ls-files|grep ofdm_sym_acquisition&#xA;gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.xml ##.xml: the file describing how this block looks in GRC&#xA;gr-dtv/include/gnuradio/dtv/dvbt_ofdm_sym_acquisition.h ##gr-something/include/: public interface, the one accessible and documented in Doxygen&#xA;gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc ##_impl.cc,h: the actual implementation, which has all the &quot;ugly&quot; details, private variables and stuff&#xA;gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.h&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For us, the &lt;code&gt;_impl&lt;/code&gt; is of most relevance. So I &lt;a href=&quot;https://github.com/gnuradio/gnuradio/blob/master/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc#L332&quot; rel=&quot;nofollow noreferrer&quot;&gt;opened it&lt;/a&gt; and looked for a &lt;code&gt;work&lt;/code&gt; or &lt;code&gt;general_work&lt;/code&gt; method right away (for difference between these, refer to the Guided Tutorials &lt;a href=&quot;http://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorial_GNU_Radio_in_C++#432-Specific-block-categories&quot; rel=&quot;nofollow noreferrer&quot;&gt;part 4&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;The (&lt;code&gt;general_&lt;/code&gt;)&lt;code&gt;work&lt;/code&gt; method is the central workhorse of a GNU Radio block: GNU Radio's scheduler will call it whenever there are input items to process (given that there's enough output buffer space). So I skimmed it. Pasting it here, trying to delete all lines that I didn't care about at first. Find my &quot;mental&quot; annotations in between.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre&gt;&#xA;    dvbt_ofdm_sym_acquisition_impl::general_work (int noutput_items,&#xA;…&#xA;    {&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The usual stuff: input items are in &lt;code&gt;in&lt;/code&gt;, output goes to &lt;code&gt;out&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;        const gr_complex *in = (const gr_complex *) input_items[0];&#xA;        gr_complex *out = (gr_complex *) output_items[0];&#xA;…&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Ah-Ha! We loop over something, let's keep an eye out for the &lt;code&gt;i&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        for (int i = 0; i &amp;lt; noutput_items; i++) {&#xA;…&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;ok, judging by the variables name this is the case of us &lt;em&gt;not&lt;/em&gt; having &quot;locked&quot; on to sync sometime. Let's concentrate on this and ignore the other case for now.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;          if (!d_initial_acquisition) {&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This looks a lot as if the interesting work is done in &lt;code&gt;ml_sync&lt;/code&gt;. &lt;code&gt;d_cp_length&lt;/code&gt; definitely points to us having to deal with a system that uses cyclic prefixes.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;            d_initial_acquisition = ml_sync(&amp;in[d_consumed], 2 * d_fft_length + d_cp_length - 1, d_fft_length + d_cp_length - 1, \&#xA;                &amp;d_cp_start, &amp;d_derot[0], &amp;d_to_consume, &amp;d_to_out);&#xA;            d_cp_found = d_initial_acquisition;&#xA;          }&#xA;          else {&#xA;…&#xA;            }&#xA;          }&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I decide to break here and take a look at &lt;code&gt;ml_sync&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The name is pretty revealing already; it's probably going to be a &lt;em&gt;M&lt;/em&gt;aximum &lt;em&gt;L&lt;/em&gt;ikelihood &lt;em&gt;Sync&lt;/em&gt;hronizer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, going up in the source, we &lt;a href=&quot;https://github.com/gnuradio/gnuradio/blob/master/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc#L98&quot; rel=&quot;nofollow noreferrer&quot;&gt;find&lt;/a&gt; &lt;code&gt;ml_sync&lt;/code&gt;. It's pretty well-commented and uses (VOLK = Vector optimized library of kernels) functions that have names like &lt;code&gt;magnitude_squared&lt;/code&gt;; I think I'll leave the lecture up to you and give you my quick understanding of it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;volk_32fc_magnitude_squared_32f(&amp;amp;d_norm[low], &amp;amp;in[low], size);&lt;/code&gt; calculates the mag² == norm of the input, starting at the &lt;code&gt;low&lt;/code&gt; position, saves it in &lt;code&gt;d_norm&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The &quot;moving sum&quot; loop calculates the &quot;amount&quot; of correlation and the signal energy in windows of size &lt;code&gt;d_fft_length&lt;/code&gt;; that makes sense. A high power signal can have a very high correlation coefficient with something that is not really &quot;similar&quot;, so you need to &quot;normalize&quot; later on. Results are stored in &lt;code&gt;d_gamma&lt;/code&gt; and &lt;code&gt;d_phi&lt;/code&gt;, respectively.&lt;/li&gt;&#xA;&lt;li&gt;The magnitudes of the windowed-correlation vector elements in &lt;code&gt;d_gamma&lt;/code&gt; are stored in &lt;code&gt;d_lambda&lt;/code&gt;, and something linearly dependend of &lt;code&gt;d_phi&lt;/code&gt; is subtracted from those.&lt;/li&gt;&#xA;&lt;li&gt;Peak search in &lt;code&gt;d_lambda&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;From the peak position, a frequency correction is calculated. From the correlation coefficients, phase-derotation is done.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr/&gt;&#xA;&#xA;&lt;p&gt;So what we have here is an autocorrelation-based synchronizer that locks onto the cyclic prefix. Nice! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing this with Schmidl&amp;amp;Cox that was used in ofdm_rx.grc, calculating the autocorrelation is of course pretty CPU-intense, and we need as much Cyclic Prefix as we can get. However, this might be (is) a suitable synchronizer for the typical broadcast channel, where FFTs are long, and so are prefixes, and the trade-off between being fast at decoding packets and not missing a single packets is biased in favor of a RX-maximizing receiver operation characteristic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr/&gt; &#xA;To the question why this doesn't work in your setup, I must admit that it's a bit over my head. My intuition tells me that there might be ambiguities due to your 1/4 payload/prefix ratio, and you consistently lock onto the middle of two consecutive frames or so. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is: try! &lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2016-05-13T10:32:19.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30765" PostTypeId="1" AcceptedAnswerId="30977" CreationDate="2016-05-13T10:42:18.147" Score="0" ViewCount="829" Body="&lt;p&gt;I would like to extend my previous question&#xA;&lt;a href=&quot;https://dsp.stackexchange.com/questions/30605/what-is-difference-between-lms-and-gradient-descent-adaptation&quot;&gt;What is difference between LMS and gradient-descent adaptation?&lt;/a&gt;&#xA;with this other question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found out, that RLS and Kalman filter learning seems to be somehow similar. My question is: Can be those algorithms called gradient descent methods? If not, how is this kind of algorithms called?&lt;/p&gt;&#xA;" OwnerUserId="19697" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.363" LastActivityDate="2016-05-23T12:50:18.177" Title="Are the RLS filter and Kalman filter gradient methods?" Tags="|kalman-filters|adaptive-filters|adaptive-algorithms|gradient|" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="30767" PostTypeId="2" ParentId="30736" CreationDate="2016-05-13T12:11:22.027" Score="4" Body="&lt;p&gt;So here's a diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/exC04.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/exC04.png&quot; alt=&quot;a diagram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The signal source is at $(x, y)$, left microphone is at $(-1, 0)$, right microphone is at $(+1, 0)$.  $d=2$ is the distance between the microphones.  $b$ is the distance from the source to the right microphone, and $a$ is the extra distance to the left microphone, which will create additional delay and further decrease the amplitude. The grey circle represents the wavefront as it hits the right microphone.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The delay (time difference) between channels will be $T = \frac a c$, where $c$ is the speed of sound.&lt;/li&gt;&#xA;&lt;li&gt;Since &lt;a href=&quot;https://en.wikipedia.org/wiki/Sound_intensity&quot; rel=&quot;nofollow noreferrer&quot;&gt;microphones are pressure sensors&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Inverse-square_law#Acoustics&quot; rel=&quot;nofollow noreferrer&quot;&gt;pressure drops with inverse distance ($1/r$ law)&lt;/a&gt;, the signal amplitude at the left microphone will be $G = \frac{b} {a+b}$ times the signal at the right microphone.  (It's a level &lt;em&gt;ratio&lt;/em&gt;, not a level difference.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you know $T$ and $G$ then you can find $b$:&#xA;$$b=\frac{G T c}{1-G}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you know $b$ and $a+b$ and using &lt;a href=&quot;https://www.algebra.com/algebra/homework/word/geometry/The-length-of-a-median-of-a-triangle.lesson&quot; rel=&quot;nofollow noreferrer&quot;&gt;law of cosines and Apollonius' theorem&lt;/a&gt; for the median of the triangle you can find $r$ and $\theta$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$r = \frac 1 2 \sqrt{4b^2+4ab+2a^2-d^2}$$&#xA;$$b^2=-d r \cos(\theta) + r^2 + \frac{d^2}{4}$$&#xA;$$\theta=\arccos\left( \frac{r}{d}+\frac{d}{4r}-\frac{b^2}{dr}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then plug in $a$ and $b$ and simplify:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$r = \frac 1 2 \sqrt{\frac{2(Tc)^2(G^2+1)}{(G-1)^2} -d^2}$$&#xA;$$\theta=\arccos\left( \frac{r}{d}+\frac{d}{4r}-\frac{(G T c)^2}{(1-G)^2 d r}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only know $T$, you can place the source along a hyperbola (shown in green) with focal points at the microphones.  If you only know $G$, then you can place the source along a circle (shown in orange).  The intersection of those curves is the location of the source:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7TwZA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7TwZA.png&quot; alt=&quot;locuses&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would think that accuracy becomes smeared out when the green and orange curves meet at sharp angles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course if you only care about separating sounds by location, you can ignore all this and just work in (delay, ratio)-space.&lt;/p&gt;&#xA;" OwnerUserId="29" LastEditorUserId="29" LastEditDate="2016-05-14T02:46:12.590" LastActivityDate="2016-05-14T02:46:12.590" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="30768" PostTypeId="2" ParentId="30762" CreationDate="2016-05-13T12:15:21.017" Score="1" Body="&lt;p&gt;I believe these lines are you problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    data1(istart:iend,j) = data1(istart:iend,j).*window;&#xA;    data2(istart:iend,j) = data2(istart:iend,j).*window;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you are modifying the incoming data.  When you don't have overlapping windows, you don't notice it. However, when you have overlapping windows, the next window will include data that has already had a window applied... which will not be what you want.&lt;/p&gt;&#xA;" OwnerUserId="80" LastActivityDate="2016-05-13T12:15:21.017" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30769" PostTypeId="2" ParentId="30736" CreationDate="2016-05-13T12:47:04.877" Score="1" Body="&lt;p&gt;To complete &lt;a href=&quot;https://dsp.stackexchange.com/a/30767/8140&quot;&gt;endolith's answer&lt;/a&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the source is far enough (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Near_and_far_field&quot; rel=&quot;nofollow noreferrer&quot;&gt;Far Field Assumption&lt;/a&gt;), i.e. $a&amp;lt;&amp;lt;b$, then $G\rightarrow 1$ and you can only estimate angle, not the distance, by using&#xA;$$&#xA;\tau = d/c \cos(\theta)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $d$ is the microphones spacing, $c$ is the sound speed and $\tau$ is the delay.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="-1" LastEditDate="2017-04-13T12:47:25.680" LastActivityDate="2016-05-13T12:47:04.877" CommentCount="22" ContentLicense="CC BY-SA 3.0" />
  <row Id="30770" PostTypeId="1" AcceptedAnswerId="30774" CreationDate="2016-05-13T13:06:30.397" Score="17" ViewCount="1702" Body="&lt;p&gt;I have read this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dMPEp.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dMPEp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;taken its FFT (2D) and then Inverse FFT to get exactly the image back. Code is provided for reference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imfft = fft2(photographer);&#xA;im = uint8(ifft2(imfft));&#xA;&#xA;imshow(im); %Output is same image&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I change the fourier and take only the real part,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;imfft = real(fft2(photographer));&#xA;im = uint8(ifft2(imfft));&#xA;imshow(im);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get an image like this (&lt;em&gt;note that size change is irrelevant and only due to saving it from Matlab figure handler&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rjimZ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rjimZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain me the theory (maths) behind it? Thanks&lt;/p&gt;&#xA;" OwnerUserId="20995" LastActivityDate="2016-12-17T20:41:40.633" Title="Why real part of FFT converts image into rotation + original?" Tags="|image-processing|fft|fourier-transform|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30771" PostTypeId="1" CreationDate="2016-05-13T13:49:23.547" Score="3" ViewCount="262" Body="&lt;p&gt;I do camera calibration for a single camera with a chessboard pattern in opencv for the first time.&#xA;The focus is fixed.&#xA;I'm not sure how to do it, there seems to be many questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How many images should be used for calibration?&lt;/li&gt;&#xA;&lt;li&gt;What pattern should be used? number of points, size of squares&lt;/li&gt;&#xA;&lt;li&gt;What transformations should be applied to the calibration target? rotated, tilted, shifted...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I came to the conclusion that none of the questions above can be answered on their own, because they all depend on each other. Say for example taking a lot of images that are very similar to each other are intuitively not as good as having less images that are better distributed in the frame.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took a step back and thought about what's going on. (I tried)&#xA;Basically, there's a mathematical model of the camera and its aberrations (focal length, distortion, etc...) and the calibration is the process of collecting data to fit the model (its values) to the hardware at hand. &lt;strong&gt;This appears to be mostly statistics&lt;/strong&gt;. In order to fit the model to the entire image well, sample data should be collected from the entire image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I conclude that all questions above boil down to &lt;strong&gt;how should the detectable points of the pattern be distributed in the 3D space&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to know if this thought makes any sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm tired of reading handwavy suggestions like &quot;&lt;em&gt;the more images, the better&lt;/em&gt;&quot;, &quot;&lt;em&gt;at least arbitrary number of images should be used&lt;/em&gt;&quot;, etc. that do not provide &lt;strong&gt;a quantifiable measure for the quality of a calibration&lt;/strong&gt;. Sure, there's a reprojection error, that tells how good the calibration fits to the provided calibration data, but not how good that data is suited for calibration in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came to the conclusion that it makes more sense to evaluate the quality of a calibration by the distribution of the sample data used to create it. Makes sense?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Questions 1 and 2 above are thus combined to : &lt;strong&gt;What should be the overall density (or density distribution) of detected calibration points among all calibration images?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I take all detected points from all calibration images and place them in one image, I could see how many calibration points there are per pixel area $\text{px}^{2}$.If I have a lot of images with the pattern in the center of the image, I get a higher density there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What would be a good minimum (baseline) value for the density of calibration points per pixel area?&lt;/strong&gt; &#xA;$0.1 \ \text{px}^{-2}$ ? $0.5 \ \text{px}^{-2}$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Should the distribution of calibration points per pixel area be constant over the entire image?&lt;/strong&gt; Or do I need a higher density (read: more sample values) at the edges for example?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Question 3 is asking for the distribution in the 3rd dimension. The calibration target with the pattern can be moved back and forth (along the optical axis) or tilted. Both transformations lead to calibration points in front or behind the plane that's in focus&lt;sup&gt;1&lt;/sup&gt;. Depending on the depth of field, corner points can be detected up to some distance from the focal plane. This adds a 3rd dimension to the space in which calibration points can be detected.&#xA;&lt;strong&gt;How should calibration points be distributed with respect to distance from the plane of focus&lt;sup&gt;1&lt;/sup&gt;&lt;/strong&gt;? Should most points be around the plane of focus&lt;sup&gt;1&lt;/sup&gt; given that detection of points further away from it is not as good?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;tl, dr;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In front of a camera, there's a 3D space enclosed by a frustum of a pyramid/cone in which calibration points can be detected. &lt;strong&gt;How should calibration points be distributed in that space in order to get a good calibration?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; With that I mean the plane of points that will be &quot;in focus&quot; in the image.&lt;/p&gt;&#xA;" OwnerUserId="20993" LastActivityDate="2016-05-14T07:45:15.453" Title="How should calibration points be distributed?" Tags="|computer-vision|opencv|camera-calibration|" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30772" PostTypeId="2" ParentId="2411" CreationDate="2016-05-13T13:56:42.690" Score="6" Body="&lt;p&gt;This question has been answered very well from different perspectives, and I just want to summarize my experience and also emphasize some problems related to adaptive binarization. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adaptive binarization can be divided into three categories: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Global method: with this method first of the background of the image is estimated; after that a normalized image is generated with the help of the background information. Then global binarization method is employed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Patch-based method: as the name indicates, patch-based method will perform binarization patch by patch. At each patch, a binarization is estimated with a global binarization method. After that, some post-processing is performed to make sue that binarization threshold in neighboring patches has smooth transition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Moving-window method: with this method, binarization is done pixel by pixel. A moving window is set up to calculate the pixel statistics within the window, and based on the statistics the threshold for the central pixel within the window is calculated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is very hard to tell which method is the best as it depends on the application. When you think of an adaptive binarization, do not forget to consider the following questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) parameter setting: does the method have an automatic parameter setting procedure? How can we set the parameters very well so that it can work on most cases? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) what is the criterion of justifying a good adaptive binarization? In many cases, the difference between different binarization methods is really small. However, the small difference may lead to big difference in the end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) can binarization work on some particular situations? For example, suppose the target of the adaptive binarization is to extract while objects from black background, can the binarization automatically adapt to this situation? Or vice visa. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) adaptive methods have the tendency of only focusing on the local configurations, hence the binary result is not optimized. For example, the famous Sauvola method will generate hollow object if the object to be optimized is far larger than the moving window. Can your adaptive method conque this limitation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) preprocessing. A good binarization also should include image processing insider. If the image is too blurring, it can automatically adjust the parameters of the algorithm or invoke some preprocessing to avoid bad binarization.   &lt;/p&gt;&#xA;" OwnerUserId="1674" LastActivityDate="2016-05-13T13:56:42.690" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30773" PostTypeId="1" AcceptedAnswerId="30777" CreationDate="2016-05-13T16:01:39.970" Score="0" ViewCount="307" Body="&lt;p&gt;I have a question about how I could compute the area (duration and amplitude) for the phase encoding gradient in a typical MRI gradient echo sequence. So, let us assume that my field of view in the phase-encode direction is 20 cms and I have a k-space matrix of size 256. From the tutorial here, I can see that the k-space spacing is $1/20e-3$ per meter. Let us also assume that the maximum gradient strength I can achieve is 10mT/m. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am now stuck and not sure how I can compute the area that I need under the phase encode area. I am aware that the area will change at each phase encoding step and at least from the pulse sequence diagrams that I see for a GE sequence, it seems that the amplitude is adjusted (going for negative max to positive max) and the gradient time is kept constant during each phase encode step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am at a loss as to how to compute this area?&lt;/p&gt;&#xA;" OwnerUserId="13347" LastActivityDate="2016-05-13T19:50:36.330" Title="area under the phase encoding gradient in MRI" Tags="|mri|" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30774" PostTypeId="2" ParentId="30770" CreationDate="2016-05-13T17:36:07.567" Score="17" Body="&lt;p&gt;Let's say your image is given by $I(x,y)$. Then its Fourier transform is given by&#xA;$$ &#xA;I^f(\omega_x,\omega_y) = \int_x\int_yI(x,y)e^{j\omega_xx}e^{j\omega_yy}dxdy&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you take the real part and perform the inverse:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;I_m(\alpha,\beta) &amp;amp;= \int_{\omega_x}\int_{\omega_y}\Re\left\{I^f(\omega_x,\omega_y)\right\} e^{j\omega_x\alpha}e^{j\omega_y\beta}d\omega_xd\omega_y&#xA;\\&#xA;&amp;amp;= \int_{\omega_x}\int_{\omega_y}\Re\left\{\int_x\int_yI(x,y)e^{j\omega_xx}e^{j\omega_yy}dxdy\right\} e^{j\omega_x\alpha}e^{j\omega_y\beta}d\omega_xd\omega_y\\&#xA;&amp;amp;= \int_x\int_yI(x,y)\int_{\omega_x}\int_{\omega_y}\Re\left\{e^{j\omega_xx}e^{j\omega_yy}\right\} e^{j\omega_x\alpha}e^{j\omega_y\beta}d\omega_xd\omega_ydxdy&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can clearly see that the inner integral is the 2D Fourier transform of &#xA;$$&#xA;\cos(\omega_xx)\cos(\omega_yy) + \sin(\omega_xx)\sin(\omega_yy)&#xA;$$&#xA;which is&#xA;$$&#xA;\frac{1}{2}\left[\delta(x-\alpha)\delta(y-\beta) + \delta(x+\alpha)\delta(y+\beta)\right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting the result to $I_m$ yields&#xA;$$&#xA;I_m(x,y) = \frac{1}{2}\left[I(x,y)+I(-x,-y)\right] &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course in your case $x,y&amp;gt;0$, however the discrete Fourier transform assumes your signal is &lt;em&gt;$N$-periodic&lt;/em&gt; and you get&#xA;$$&#xA;I_m(x,y) = \frac{1}{2}\left[I(x,y)+I(N-x,M-y)\right] &#xA;$$&#xA;where $N,M$ are the dimensions of your image. I think you can see now why you got that result.&lt;/p&gt;&#xA;" OwnerUserId="8140" LastEditorUserId="8140" LastEditDate="2016-12-17T20:41:40.633" LastActivityDate="2016-12-17T20:41:40.633" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="30775" PostTypeId="2" ParentId="30770" CreationDate="2016-05-13T18:24:43.513" Score="9" Body="&lt;p&gt;The result ThP provided can also be stated in very simple terms: If you have a data set which is purely real, its (inverse) Fourier transform will have Hermitian symmetry: If you find the value $z$ at position $(x,y)$, then you will find the complex conjugate value $z^*$ at the point-reflected position $(-x,-y)$ about the origin. Note that the origin here would be the center of Fourier-space. This can be reformulated, of course, if the DC component is not in the center of your FFT implementation. And this is what you see in your image: A point-reflected version is overlaying the true image - because you forced one space to be real valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This property is actually being used for accelerating magnetic resonance imaging (MRI) in some cases: MRI acquires the data directly in Fourier-space. Since an ideal MR image can be described by real values only (all excited magnetization vectors have phase 0), you only have to acquire half of the data space, which saves you half of the imaging time. Of course, MR images are not completely real valued due to the limiations of reality... but with a few tricks you can still use this technique advantageously. &lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-05-13T18:24:43.513" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="30776" PostTypeId="1" CreationDate="2016-05-13T19:06:42.383" Score="6" ViewCount="529" Body="&lt;h3&gt;Background:&lt;/h3&gt;&#xA;&lt;p&gt;The intention is feature/formant extraction from speech input.&lt;/p&gt;&#xA;&lt;p&gt;I have used an FFT on raw samples in the past and have done simple peak picking from a weighted average of frequencies over time. That gave results that approximated a voiced non-nasal utterance's location in the vowel quadrilateral, but it was not consistent. I heard that LPC would give a smoother response curve and much greater accuracy in feature extraction. The residual is another desired side-effect which will hopefully allow for analysis of other features as well.&lt;/p&gt;&#xA;&lt;h3&gt;Issue:&lt;/h3&gt;&#xA;&lt;p&gt;I have a large disparity in the peak frequencies between an FFT on the raw samples and an FFT on the derived LP coefficients.&lt;/p&gt;&#xA;&lt;p&gt;I find that the response curves are wildly different in shape and peak frequency locations. Often &lt;b&gt;FFT_LPC&lt;/b&gt; (see definitions below) will show large peaks in the 3000/4000Hz range for simple voiced vowel utterances. Perhaps these are pops - maybe I should perform IFFT and play back the output to check. &lt;b&gt;FFT_Raw&lt;/b&gt; peaks precisely where I would expect given the source samples.&lt;/p&gt;&#xA;&lt;h3&gt;Process:&lt;/h3&gt;&#xA;&lt;p&gt;Here is my current method:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Obtain samples at 22050Hz.&lt;/li&gt;&#xA;&lt;li&gt;From the raw sample frame, window with Hamming and perform FFT. Call this &lt;b&gt;FFT_Raw&lt;/b&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In parallel, extract LP coefficients from the raw samples, do NOT window, and perform FFT directly on the LP coefficients padded with zeroes. In effect, every frame would lead with these coefficients. Call this &lt;b&gt;FFT_LPC&lt;/b&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Take RMS of raw samples and apply an (admittedly arbitrary) multiplier to bring &lt;b&gt;FFT_LPC&lt;/b&gt; to comparable magnitude compared with &lt;b&gt;FFT_Raw&lt;/b&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Display both frequency response curves with one overlaid on top of the other.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I have tried anywhere from 8 to 32 coefficients with similar results.&lt;/p&gt;&#xA;&lt;h3&gt;Questions:&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is using the coefficients directly as input to the FFT the right approach? The assumption on my end is that leading with the coefficients would approximate a unit impulse. However is there any intermediate processing that I should be doing (such as somehow shifting the starting point of each set of coefficient data to match the fundamental frequency)?&lt;/li&gt;&#xA;&lt;li&gt;Should the LPC data be windowed prior to FFT? I would think that my current approach of leading with the coefficients every frame means that windowing would reduce the amplitude of the first set of coefficients and FFT would produce different frequencies. However maybe if I window the raw samples and THEN use that as input to the LPC data then I will obtain more accurate results.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I have not used MATLAB or any other third party applications - the desire is to build this myself using Xcode and its accompanying libraries alone. I can display this code but it is lengthy and spans several classes (including adapter classes between data types and math/FFT operations). Ideally I would seek input on a language-agnostic conceptual level.&lt;/p&gt;&#xA;" OwnerUserId="20997" LastEditorUserId="-1" LastEditDate="2020-06-17T08:24:47.490" LastActivityDate="2022-04-19T06:01:45.137" Title="Matching LPC frequency response to raw sample data frequency response" Tags="|fft|speech-recognition|speech-processing|speech|lpc|" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30777" PostTypeId="2" ParentId="30773" CreationDate="2016-05-13T19:50:36.330" Score="1" Body="&lt;p&gt;Actually, it is as simple as the frequency encoding gradient. Both encoding gradients look terribly different, but in the end they work the very same way.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The outer $k$-space position $k_\textrm{max}$ is related to your &lt;em&gt;resolution&lt;/em&gt;, e.g. $1\,\textrm{mm}$, or in terms of the FOV: $FOV/N$ where $N$ is the number of image pixels.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For the steps between two $k$-space lines, $\Delta k = 1/FOV$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With $k(t) = \frac{\gamma}{2\pi}\int_0^t G(t^\prime)\,\textrm{d}t^\prime$ you can find that for the largest gradient moment $M_\textrm{max} = \frac{\pi(N-1)}{\gamma FOV}$. The steps in between scale this down linearly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pay attention to the line numbering, because the central line in $k$-space should be acquired with zero gradient moment.&lt;/p&gt;&#xA;" OwnerUserId="19501" LastActivityDate="2016-05-13T19:50:36.330" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="30778" PostTypeId="2" ParentId="30745" CreationDate="2016-05-13T19:53:13.460" Score="1" Body="&lt;p&gt;Eventually, I found the answer in &lt;a href=&quot;http://downloads.bbc.co.uk/rd/pubs/whp/whp-pdf-files/WHP238.pdf&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; white paper. I quote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Fidelity filter was specifically developed for VC-2 using an&#xA;  exhaustive search process to select a filter set with simple integer&#xA;  filter coefficients, limited to 8-bit resolution, and offering good&#xA;  alias rejection in both analysis and synthesis operations.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="18335" LastActivityDate="2016-05-13T19:53:13.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30779" PostTypeId="2" ParentId="29837" CreationDate="2016-05-13T20:55:03.210" Score="2" Body="&lt;p&gt;Look into the MUSAN corpus from the Kaldi people (Dan Povey, et al): &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.openslr.org/17/&quot; rel=&quot;nofollow&quot;&gt;Corpus audio/text&lt;/a&gt;  &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://arxiv.org/pdf/1510.08484v1.pdf&quot; rel=&quot;nofollow&quot;&gt;Check the arxiv paper&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;MUSAN is a new corpus of music, speech, and noise. This dataset is&#xA;  suitable for training models for voice activity detection (VAD) and&#xA;  music/speech discrimination. Our corpus is released under a flexible&#xA;  Creative Commons license. The dataset consists of music from several&#xA;  genres, speech from twelve languages, and a wide assortment of&#xA;  technical and non-technical noises. We demonstrate use of this corpus&#xA;  for music/speech discrimination on Broadcast news and VAD for speaker&#xA;  identification.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="11372" LastEditorUserId="11372" LastEditDate="2016-05-13T21:05:37.040" LastActivityDate="2016-05-13T21:05:37.040" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30781" PostTypeId="2" ParentId="30757" CreationDate="2016-05-13T22:24:43.900" Score="2" Body="&lt;p&gt;The root locus is a parametric plot. It shows how zeros and poles move in the complex plain depending on the value of a gain $k$. For all points on the plot both the phase condition&lt;sup&gt;1&lt;/sup&gt; and the amplitude condition&lt;sup&gt;2&lt;/sup&gt; have to be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$G_0(s) = k \cdot  \frac{\prod^q_{i=1}(s-s_{0i})}{\prod^n_{i=1}(s-s_{i})}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, $s_{01} = s_{02} = 2$, $s_1 = 0$ and $s_2 = s_3 = 20$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few rules to construct the root locus by hand, after you added the locations of the zeros and poles to the plot:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;symmetry&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Everything is symmetric to the real axis.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;start and end points&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Every line/curve/branch (whatever you want to call it) of the plot starts in a pole and ends in a zero or infinity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have $q=2$ as the number of zeros and $n=3$ the number of poles. That means that 1 branch will go to infinity and two others will connect the poles with the zeros.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;asymptotes&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There are $n-q = 1$ asymptotes that the branches are converging towards for very large gains. The asymptotes have an angle of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\phi = \frac{\pi + l\cdot 2\pi}{n-q}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and all asymptotes meet in the point&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$s=\frac{\sum^n_{i=1}s_i - \sum^q_{i=1}s_{0i}}{n-q}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in your case $s=16$ which is admittedly only of real help if you have more asymptotes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $l=0, 1, ..., n- q-1$. For the single asymptote of your system, that means $\phi=\pi$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this rule you know that the one pole that goes to infinity will do so by getting close to the asymptote at angle $\pi$ which means it goes to the left of the plot.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;real axis&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is one of those rules where you think it might as well be part of a horoscope (at least I did), because it sounds as arbitrary and random as how much the constellation of planets at your birth has an influence on your life.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Points of the real axis can be part of the plot. Those points that are &lt;strong&gt;part of the plot&lt;/strong&gt; have an &lt;strong&gt;uneven&lt;/strong&gt; number of poles and zeros to their &lt;strong&gt;right&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wait, &lt;em&gt;what&lt;/em&gt;? To estimate the results for your plot, start from $+\infty$ on the real axis and go to $-\infty$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rightmost &quot;thing&quot; in your plot are the double poles at 20. No point of the real axis to the right of those can have any number of poles or zeros to its right, so we conclude that &lt;strong&gt;the real axis to the right of 20 is not part of the plot.&lt;/strong&gt; This means that the 2 branches coming out of the poles at 20 cannot be on the real axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going further to the left, with the 2 poles to the right and then the 2 poles and 2 zeros to the right (4 in total) you know that &lt;strong&gt;no point from 0 to $+\infty$ of the real axis is part of the plot&lt;/strong&gt;.&#xA;Note that this also means that the branches ending in the zeros will not arrive there on the real axis, because the real axis around 2 is not part of the plot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To the left of 0, you now have all your 5 zeros and poles to the right, which means &lt;strong&gt;every point to the left of 0 on the real axis is part of the plot&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;real axis break in/away points&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The branches split or join at points where the following condition is true:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;\sum^q_{i=1}\frac{1}{s-s_{0i}} &amp;amp;= \sum^n_{i=1}\frac{1}{s-s_{i}}\\&#xA;2 \cdot \frac{1}{s-2} &amp;amp;= 2 \cdot \frac{1}{s-20} + \frac{1}{s}\\&#xA;\frac{2}{s-2} &amp;amp;= \frac{3s - 20}{s(s-20)}\\&#xA;2s(s-20) &amp;amp;= (3s - 20)(s-2)\\&#xA;2s^2-40s&amp;amp;=3s^2-26s+40\\&#xA;0&amp;amp;=s^2+14s+40&#xA;\end{align}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that gives $s_1 = -4$ and $s_2 = -10$. At those two points, there's a split or branch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now which one's a split and which one's a join?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remembe